From cd44b58d11105ca6eb98f327a9823313f23f5572 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 9 Dec 2016 12:21:52 +0100 Subject: [PATCH 01/31] Initial commit of NRF52840 target as the copy of NRF52832 and NRF52_DK. --- .../TARGET_NRF5_SDK13/LF_Clock_config.md | 97 + .../TARGET_MCU_NRF52840/PeripheralNames.h | 81 + .../TARGET_MCU_NRF52840/PortNames.h | 53 + .../TARGET_NRF52840_DK/PinNames.h | 203 + .../TARGET_NRF52840_DK/device.h | 38 + .../TARGET_MCU_NRF52840/analogin_api.c | 91 + .../device/TOOLCHAIN_ARM_STD/nRF52832.sct | 27 + .../TOOLCHAIN_ARM_STD/startup_nrf52832.s | 245 + .../device/TOOLCHAIN_ARM_STD/sys.cpp | 31 + .../device/TOOLCHAIN_GCC_ARM/NRF52832.ld | 190 + .../TOOLCHAIN_GCC_ARM/startup_NRF52832.S | 270 + .../device/TOOLCHAIN_IAR/nRF52832.icf | 46 + .../TOOLCHAIN_IAR/startup_NRF52832_IAR.s | 381 + .../TARGET_MCU_NRF52840/device/cmsis.h | 24 + .../TARGET_MCU_NRF52840/device/cmsis_nvic.c | 43 + .../TARGET_MCU_NRF52840/device/cmsis_nvic.h | 53 + .../TARGET_MCU_NRF52840/device/system_nrf52.c | 321 + .../TARGET_MCU_NRF52840/device/system_nrf52.h | 78 + .../TARGET_MCU_NRF52840/pwmout_api.c | 399 + .../sdk/driver_nrf/pwm/nrf_drv_pwm.c | 350 + .../sdk/driver_nrf/pwm/nrf_drv_pwm.h | 426 + .../sdk/driver_nrf/saadc/nrf_drv_saadc.c | 536 + .../sdk/driver_nrf/saadc/nrf_drv_saadc.h | 330 + .../TARGET_MCU_NRF52840/sdk/nrf_drv_config.h | 495 + .../softdevice/s132/headers/nrf52/nrf_mbr.h | 220 + .../sdk/softdevice/s132/headers/nrf_ble.h | 635 + .../sdk/softdevice/s132/headers/nrf_ble_err.h | 93 + .../sdk/softdevice/s132/headers/nrf_ble_gap.h | 1745 ++ .../softdevice/s132/headers/nrf_ble_gatt.h | 215 + .../softdevice/s132/headers/nrf_ble_gattc.h | 572 + .../softdevice/s132/headers/nrf_ble_gatts.h | 725 + .../sdk/softdevice/s132/headers/nrf_ble_hci.h | 134 + .../softdevice/s132/headers/nrf_ble_l2cap.h | 205 + .../softdevice/s132/headers/nrf_ble_ranges.h | 129 + .../softdevice/s132/headers/nrf_ble_types.h | 208 + .../sdk/softdevice/s132/headers/nrf_error.h | 90 + .../softdevice/s132/headers/nrf_error_sdm.h | 70 + .../softdevice/s132/headers/nrf_error_soc.h | 85 + .../sdk/softdevice/s132/headers/nrf_nvic.h | 486 + .../sdk/softdevice/s132/headers/nrf_sd_def.h | 50 + .../sdk/softdevice/s132/headers/nrf_sdm.h | 274 + .../sdk/softdevice/s132/headers/nrf_soc.h | 911 + .../sdk/softdevice/s132/headers/nrf_svc.h | 91 + .../s132/hex/s132_nrf52_2.0.0_softdevice.hex | 6918 +++++++ .../TARGET_NRF5_SDK13/common_rtc.h | 57 + .../TARGET_NRF5_SDK13/gpio_api.c | 249 + .../TARGET_NRF5_SDK13/gpio_object.h | 48 + .../TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c | 329 + .../TARGET_NRF5_SDK13/irq_handlers_hw.h | 55 + .../TARGET_NRF5_SDK13/lp_ticker.c | 48 + .../TARGET_NRF5_SDK13/nordic_critical.c | 57 + .../TARGET_NRF5_SDK13/nrf5x_lf_clk_helper.h | 66 + .../TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h | 94 + .../TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c | 35 + .../TARGET_NRF5_SDK13/port_api.c | 108 + .../TARGET_NRF5_SDK13/reloc_vector_table.c | 76 + .../TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c | 92 + .../sdk/ble/ble_advertising/ble_advertising.c | 594 + .../sdk/ble/ble_advertising/ble_advertising.h | 251 + .../ble/ble_db_discovery/ble_db_discovery.c | 967 + .../ble/ble_db_discovery/ble_db_discovery.h | 208 + .../ble_debug_assert_handler.c | 82 + .../ble_debug_assert_handler.h | 78 + .../sdk/ble/ble_dtm/ble_dtm.c | 670 + .../sdk/ble/ble_dtm/ble_dtm.h | 168 + .../sdk/ble/ble_error_log/ble_error_log.h | 96 + .../sdk/ble/ble_racp/ble_racp.c | 84 + .../sdk/ble/ble_racp/ble_racp.h | 123 + .../ble_radio_notification.c | 88 + .../ble_radio_notification.h | 74 + .../sdk/ble/ble_services/ble_dfu/ble_dfu.c | 676 + .../sdk/ble/ble_services/ble_dfu/ble_dfu.h | 266 + .../sdk/ble/common/ble_advdata.c | 788 + .../sdk/ble/common/ble_advdata.h | 239 + .../sdk/ble/common/ble_conn_params.h | 138 + .../sdk/ble/common/ble_conn_state.c | 414 + .../sdk/ble/common/ble_conn_state.h | 302 + .../sdk/ble/common/ble_date_time.h | 104 + .../sdk/ble/common/ble_gatt_db.h | 77 + .../sdk/ble/common/ble_sensor_location.h | 67 + .../sdk/ble/common/ble_srv_common.c | 224 + .../sdk/ble/common/ble_srv_common.h | 394 + .../config/device_manager_cnfg.h | 126 + .../sdk/ble/device_manager/device_manager.h | 915 + .../device_manager_peripheral.c | 2971 +++ .../sdk/ble/peer_manager/gatt_cache_manager.c | 595 + .../sdk/ble/peer_manager/gatt_cache_manager.h | 236 + .../ble/peer_manager/gattc_cache_manager.c | 139 + .../ble/peer_manager/gattc_cache_manager.h | 132 + .../ble/peer_manager/gatts_cache_manager.c | 396 + .../ble/peer_manager/gatts_cache_manager.h | 228 + .../sdk/ble/peer_manager/id_manager.c | 758 + .../sdk/ble/peer_manager/id_manager.h | 301 + .../sdk/ble/peer_manager/peer_data.c | 92 + .../sdk/ble/peer_manager/peer_data.h | 84 + .../sdk/ble/peer_manager/peer_data_storage.c | 787 + .../sdk/ble/peer_manager/peer_data_storage.h | 381 + .../sdk/ble/peer_manager/peer_database.c | 804 + .../sdk/ble/peer_manager/peer_database.h | 385 + .../sdk/ble/peer_manager/peer_id.c | 186 + .../sdk/ble/peer_manager/peer_id.h | 159 + .../sdk/ble/peer_manager/peer_manager.c | 1039 ++ .../sdk/ble/peer_manager/peer_manager.h | 726 + .../ble/peer_manager/peer_manager_internal.h | 174 + .../sdk/ble/peer_manager/peer_manager_types.h | 202 + .../sdk/ble/peer_manager/pm_buffer.c | 149 + .../sdk/ble/peer_manager/pm_buffer.h | 145 + .../sdk/ble/peer_manager/pm_mutex.c | 142 + .../sdk/ble/peer_manager/pm_mutex.h | 117 + .../ble/peer_manager/security_dispatcher.c | 910 + .../ble/peer_manager/security_dispatcher.h | 281 + .../sdk/ble/peer_manager/security_manager.c | 580 + .../sdk/ble/peer_manager/security_manager.h | 219 + .../sdk/device/compiler_abstraction.h | 135 + .../TARGET_NRF5_SDK13/sdk/device/nrf.h | 76 + .../TARGET_NRF5_SDK13/sdk/device/nrf51.h | 1285 ++ .../sdk/device/nrf51_bitfields.h | 6901 +++++++ .../sdk/device/nrf51_deprecated.h | 447 + .../sdk/device/nrf51_to_nrf52.h | 944 + .../TARGET_NRF5_SDK13/sdk/device/nrf52.h | 2125 +++ .../sdk/device/nrf52_bitfields.h | 14870 ++++++++++++++++ .../sdk/device/nrf52_name_change.h | 79 + .../sdk/drivers_nrf/ble_flash/ble_flash.c | 313 + .../sdk/drivers_nrf/ble_flash/ble_flash.h | 169 + .../sdk/drivers_nrf/clock/nrf_drv_clock.c | 506 + .../sdk/drivers_nrf/clock/nrf_drv_clock.h | 273 + .../sdk/drivers_nrf/common/nrf_drv_common.c | 239 + .../sdk/drivers_nrf/common/nrf_drv_common.h | 221 + .../config/nrf_drv_config_validation.h | 110 + .../sdk/drivers_nrf/delay/nrf_delay.c | 53 + .../sdk/drivers_nrf/delay/nrf_delay.h | 242 + .../sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c | 607 + .../sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h | 336 + .../sdk/drivers_nrf/hal/nrf_adc.c | 105 + .../sdk/drivers_nrf/hal/nrf_adc.h | 443 + .../sdk/drivers_nrf/hal/nrf_clock.h | 441 + .../sdk/drivers_nrf/hal/nrf_ecb.c | 100 + .../sdk/drivers_nrf/hal/nrf_ecb.h | 92 + .../sdk/drivers_nrf/hal/nrf_gpio.h | 674 + .../sdk/drivers_nrf/hal/nrf_gpiote.h | 418 + .../sdk/drivers_nrf/hal/nrf_nvmc.c | 143 + .../sdk/drivers_nrf/hal/nrf_nvmc.h | 116 + .../sdk/drivers_nrf/hal/nrf_pdm.h | 386 + .../sdk/drivers_nrf/hal/nrf_ppi.h | 429 + .../sdk/drivers_nrf/hal/nrf_pwm.h | 665 + .../sdk/drivers_nrf/hal/nrf_rtc.h | 331 + .../sdk/drivers_nrf/hal/nrf_saadc.c | 62 + .../sdk/drivers_nrf/hal/nrf_saadc.h | 587 + .../sdk/drivers_nrf/hal/nrf_spi.h | 361 + .../sdk/drivers_nrf/hal/nrf_spim.h | 547 + .../sdk/drivers_nrf/hal/nrf_spis.h | 539 + .../sdk/drivers_nrf/hal/nrf_temp.h | 82 + .../sdk/drivers_nrf/hal/nrf_timer.h | 603 + .../sdk/drivers_nrf/hal/nrf_twi.h | 429 + .../sdk/drivers_nrf/hal/nrf_uart.h | 498 + .../sdk/drivers_nrf/hal/nrf_wdt.h | 326 + .../sdk/drivers_nrf/ppi/nrf_drv_ppi.c | 454 + .../sdk/drivers_nrf/ppi/nrf_drv_ppi.h | 311 + .../pstorage/config/pstorage_platform.h | 99 + .../sdk/drivers_nrf/pstorage/pstorage.c | 1599 ++ .../sdk/drivers_nrf/pstorage/pstorage.h | 408 + .../sdk/drivers_nrf/spi_master/nrf_drv_spi.c | 715 + .../sdk/drivers_nrf/spi_master/nrf_drv_spi.h | 398 + .../sdk/drivers_nrf/spi_slave/nrf_drv_spis.c | 423 + .../sdk/drivers_nrf/spi_slave/nrf_drv_spis.h | 250 + .../sdk/drivers_nrf/timer/nrf_drv_timer.c | 307 + .../sdk/drivers_nrf/timer/nrf_drv_timer.h | 399 + .../sdk/drivers_nrf/twi_master/nrf_drv_twi.c | 1005 ++ .../sdk/drivers_nrf/twi_master/nrf_drv_twi.h | 421 + .../sdk/libraries/bootloader_dfu/bootloader.h | 124 + .../bootloader_dfu/bootloader_settings.h | 62 + .../bootloader_dfu/bootloader_types.h | 86 + .../bootloader_dfu/bootloader_util.c | 179 + .../bootloader_dfu/bootloader_util.h | 65 + .../sdk/libraries/bootloader_dfu/dfu.h | 161 + .../bootloader_dfu/dfu_app_handler.c | 219 + .../bootloader_dfu/dfu_app_handler.h | 113 + .../bootloader_dfu/dfu_bank_internal.h | 114 + .../libraries/bootloader_dfu/dfu_ble_svc.h | 107 + .../bootloader_dfu/dfu_ble_svc_internal.h | 70 + .../sdk/libraries/bootloader_dfu/dfu_init.h | 161 + .../bootloader_dfu/dfu_init_template.c | 182 + .../libraries/bootloader_dfu/dfu_transport.h | 67 + .../sdk/libraries/bootloader_dfu/dfu_types.h | 195 + .../hci_transport/hci_mem_pool_internal.h | 59 + .../hci_transport/hci_transport_config.h | 72 + .../sdk/libraries/crc16/crc16.c | 58 + .../sdk/libraries/crc16/crc16.h | 71 + .../experimental_section_vars/section_vars.h | 290 + .../sdk/libraries/fds/config/fds_config.h | 90 + .../TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c | 2085 +++ .../TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h | 760 + .../sdk/libraries/fds/fds_internal_defs.h | 332 + .../fstorage/config/fstorage_config.h | 86 + .../sdk/libraries/fstorage/fstorage.c | 521 + .../sdk/libraries/fstorage/fstorage.h | 262 + .../fstorage/fstorage_internal_defs.h | 162 + .../sdk/libraries/fstorage/fstorage_nosd.c | 0 .../hci/config/hci_mem_pool_internal.h | 59 + .../hci/config/hci_transport_config.h | 67 + .../sdk/libraries/hci/hci_mem_pool.c | 262 + .../sdk/libraries/hci/hci_mem_pool.h | 159 + .../sdk/libraries/pwm/app_pwm.c | 907 + .../sdk/libraries/pwm/app_pwm.h | 322 + .../sdk/libraries/scheduler/app_scheduler.c | 254 + .../sdk/libraries/scheduler/app_scheduler.h | 190 + .../sdk/libraries/trace/app_trace.c | 70 + .../sdk/libraries/trace/app_trace.h | 56 + .../sdk/libraries/util/app_error.c | 153 + .../sdk/libraries/util/app_error.h | 228 + .../sdk/libraries/util/app_error_weak.c | 80 + .../sdk/libraries/util/app_error_weak.h | 78 + .../sdk/libraries/util/app_util.h | 520 + .../sdk/libraries/util/app_util_bds.h | 440 + .../sdk/libraries/util/app_util_platform.c | 87 + .../sdk/libraries/util/app_util_platform.h | 236 + .../sdk/libraries/util/common.h | 65 + .../sdk/libraries/util/nordic_common.h | 136 + .../sdk/libraries/util/nrf_assert.c | 55 + .../sdk/libraries/util/nrf_assert.h | 100 + .../sdk/libraries/util/nrf_log.c | 429 + .../sdk/libraries/util/nrf_log.h | 699 + .../sdk/libraries/util/sdk_common.h | 201 + .../sdk/libraries/util/sdk_errors.h | 142 + .../sdk/libraries/util/sdk_macros.h | 99 + .../sdk/libraries/util/sdk_mapped_flags.c | 188 + .../sdk/libraries/util/sdk_mapped_flags.h | 180 + .../sdk/libraries/util/sdk_os.h | 67 + .../sdk/libraries/util/sdk_resources.h | 78 + .../ant_stack_handler_types.h | 100 + .../common/softdevice_handler/app_ram_base.h | 203 + .../ble_stack_handler_types.h | 91 + .../softdevice_handler/softdevice_handler.c | 517 + .../softdevice_handler/softdevice_handler.h | 240 + .../softdevice_handler_appsh.c | 53 + .../softdevice_handler_appsh.h | 51 + .../TARGET_NRF5_SDK13/serial_api.c | 664 + .../TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c | 80 + .../TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c | 537 + .../TARGET_NRF5_SDK13/us_ticker.c | 573 + 240 files changed, 103075 insertions(+) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/LF_Clock_config.md create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PeripheralNames.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/device.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/analogin_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/sys.cpp create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52832.ld create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/nrf_drv_config.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_err.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gap.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatt.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gattc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatts.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_hci.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_l2cap.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_ranges.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_types.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_sdm.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_soc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_nvic.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sd_def.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sdm.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_soc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_svc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/common_rtc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_object.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/irq_handlers_hw.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/lp_ticker.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nordic_critical.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nrf5x_lf_clk_helper.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/reloc_vector_table.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_error_log/ble_error_log.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_date_time.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_sensor_location.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/config/device_manager_cnfg.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager_peripheral.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_types.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/compiler_abstraction.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_bitfields.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_deprecated.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_bitfields.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_name_change.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/config/nrf_drv_config_validation.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_clock.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpio.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpiote.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pdm.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ppi.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pwm.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rtc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spi.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spim.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spis.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_temp.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_timer.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twi.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uart.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_wdt.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/config/pstorage_platform.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_settings.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_types.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_bank_internal.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc_internal.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init_template.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_transport.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_types.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_transport_config.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/experimental_section_vars/section_vars.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/config/fds_config.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds_internal_defs.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/config/fstorage_config.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_internal_defs.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_nosd.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_mem_pool_internal.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_transport_config.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_bds.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/common.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nordic_common.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_common.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_errors.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_macros.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_os.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_resources.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ant_stack_handler_types.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/app_ram_base.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/LF_Clock_config.md b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/LF_Clock_config.md new file mode 100644 index 0000000000..22852ae261 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/LF_Clock_config.md @@ -0,0 +1,97 @@ + +# LF Clock configuration using mbed configuration system + +In order to provide the configuration for a low frequency (LF) clock, add a description of the LF clock inside a mbed configuration JSON file. +For example at application level the description might be added in a mbed_app.json file and on target level the description might be added in the hal/target.json file. +LF clock source configuration is used for MCU startup initialization and the BLE SoftDevice LF clock configuration (if BLE libraries is used). Advanced configurations are used only for the BLE SoftDevice LF clock configuration. + + +## Usage: + +1. Clock source + +Default clock source is XTAL oscillator. It is defined at the target level configuration as the target.lf_clock_src key. +There are three options that can be configured as the clock source: + - NRF_LF_SRC_XTAL + - NRF_LF_SRC_RC + - NRF_LF_SRC_SYNTH + +In order to override this configuration use targed_override section in configuration file (e.g mbed_app.json) + +```json +{ + "target_overrides": { + "*": { + "target.lf_clock_src": "NRF_LF_SRC_XTAL" + } + } +} +``` + +2a. Advanced configuration of the LFCLK RC oscillator: + +```json +{ + "config": { + "lf_clock_rc_calib_timer_interval": { + "value": 16, + "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL" + }, + "lf_clock_rc_calib_mode_config": { + "value": 1, + "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG" + } + } +} + +``` + +"lf_clock_rc_calib_timer_interval" - Calibration timer interval in 250 ms. It is equivalent to nrf_clock_lf_cfg_t::rc_ctiv. +This item generates macro MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL. +By default, such configuration is set to 16. + +"lf_clock_rc_calib_mode_config" - This value configures how often the RC oscillator will be calibrated, in number of calibration intervals. +It is equivalent to nrf_clock_lf_cfg_t::rc_temp_ctiv. +For further information, see the documentation for the [API of a SoftDevice 13x version 2.0.0](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v2.0.0/structnrf__clock__lf__cfg__t.html) +This item generates macro MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG. +By default, such configuration is set to 1. + +2b. Advanced configuration of the LFCLK XTAL oscillator: + +Accuracy of the clock source can be set. In order to do so macro MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY should been provided (e.g. in mbed_app.json). +By default such configuration is set to NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM. +For further information, see the documentation for the [API of a SoftDevice 13x version 2.0.0](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v2.0.0%2Fgroup___n_r_f___s_d_m___d_e_f_i_n_e_s.html) + +```json +{ + "config": { + "lf_clock_xtal_accuracy": { + "value": "NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM", + "macro_name": "MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY" + } + } +} + +``` + + + +2c. Advance configuration of the LFCLK Synthesized from HFCLK: + +Accuracy of the clock source can be set. In order to do so macro MBED_CONF_NORDIC_LF_CLOCK_SYNTH_ACCURACY should been provided (e.g. in mbed_app.json). +By default, such configuration is set to NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM. +For further information, see the documentation for the [API of a SoftDevice 13x version 2.0.0](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v2.0.0%2Fgroup___n_r_f___s_d_m___d_e_f_i_n_e_s.html) + +```json +{ + "config": { + "lf_clock_synth_accuracy": { + "value": "NRF_CLOCK_LF_SYNTH_ACCURACY_250_PPM", + "macro_name": "MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY" + } + } +} + +``` + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PeripheralNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PeripheralNames.h new file mode 100644 index 0000000000..0fe6da592e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PeripheralNames.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MBED_PERIPHERALNAMES_H +#define MBED_PERIPHERALNAMES_H + +#include "cmsis.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define STDIO_UART_TX TX_PIN_NUMBER +#define STDIO_UART_RX RX_PIN_NUMBER +#define STDIO_UART UART_0 + +typedef enum { + UART_0 = (int)NRF_UART0_BASE +} UARTName; + + +typedef enum { + SPI_0 = (int)NRF_SPI0_BASE, + SPI_1 = (int)NRF_SPI1_BASE, + SPIS = (int)NRF_SPIS1_BASE +} SPIName; + +typedef enum { + PWM_1 = 0, + PWM_2 +} PWMName; + +typedef enum { + I2C_0 = (int)NRF_TWI0_BASE, + I2C_1 = (int)NRF_TWI1_BASE +} I2CName; + +typedef enum { + ADC0_0 = (int)0 +} ADCName; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h new file mode 100644 index 0000000000..c63624639b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MBED_PORTNAMES_H +#define MBED_PORTNAMES_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + Port0 = 0 //GPIO pins 0-31 +} PortName; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h new file mode 100644 index 0000000000..2b86eca485 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MBED_PINNAMES_H +#define MBED_PINNAMES_H + +#include "cmsis.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PIN_INPUT, + PIN_OUTPUT +} PinDirection; + +#define PORT_SHIFT 3 + +typedef enum { + p0 = 0, + p1 = 1, + p2 = 2, + p3 = 3, + p4 = 4, + p5 = 5, + p6 = 6, + p7 = 7, + p8 = 8, + p9 = 9, + p10 = 10, + p11 = 11, + p12 = 12, + p13 = 13, + p14 = 14, + p15 = 15, + p16 = 16, + p17 = 17, + p18 = 18, + p19 = 19, + p20 = 20, + p21 = 21, + p22 = 22, + p23 = 23, + p24 = 24, + p25 = 25, + p26 = 26, + p27 = 27, + p28 = 28, + p29 = 29, + p30 = 30, + p31 = 31, + + P0_0 = p0, + P0_1 = p1, + P0_2 = p2, + P0_3 = p3, + P0_4 = p4, + P0_5 = p5, + P0_6 = p6, + P0_7 = p7, + + P0_8 = p8, + P0_9 = p9, + P0_10 = p10, + P0_11 = p11, + P0_12 = p12, + P0_13 = p13, + P0_14 = p14, + P0_15 = p15, + + P0_16 = p16, + P0_17 = p17, + P0_18 = p18, + P0_19 = p19, + P0_20 = p20, + P0_21 = p21, + P0_22 = p22, + P0_23 = p23, + + P0_24 = p24, + P0_25 = p25, + P0_26 = p26, + P0_27 = p27, + P0_28 = p28, + P0_29 = p29, + P0_30 = p30, + P0_31 = p31, + + LED1 = p17, + LED2 = p18, + LED3 = p19, + LED4 = p20, + + BUTTON1 = p13, + BUTTON2 = p14, + BUTTON3 = p15, + BUTTON4 = p16, + + RX_PIN_NUMBER = p8, + TX_PIN_NUMBER = p6, + CTS_PIN_NUMBER = p7, + RTS_PIN_NUMBER = p5, + + // mBed interface Pins + USBTX = TX_PIN_NUMBER, + USBRX = RX_PIN_NUMBER, + + SPI_PSELMOSI0 = p23, + SPI_PSELMISO0 = p24, + SPI_PSELSS0 = p22, + SPI_PSELSCK0 = p25, + + SPI_PSELMOSI1 = p12, + SPI_PSELMISO1 = p13, + SPI_PSELSS1 = p11, + SPI_PSELSCK1 = p14, + + SPIS_PSELMOSI = p12, + SPIS_PSELMISO = p13, + SPIS_PSELSS = p11, + SPIS_PSELSCK = p14, + + I2C_SDA0 = p26, + I2C_SCL0 = p27, + + D0 = p11, + D1 = p12, + D2 = p13, + D3 = p14, + D4 = p15, + D5 = p16, + D6 = p17, + D7 = p18, + + D8 = p19, + D9 = p20, + D10 = p22, + D11 = p23, + D12 = p24, + D13 = p25, + + D14 = p26, + D15 = p27, + + A0 = p3, + A1 = p4, + A2 = p28, + A3 = p29, + A4 = p30, + A5 = p31, + + // Not connected + NC = (int)0xFFFFFFFF +} PinName; + +typedef enum { + PullNone = 0, + PullDown = 1, + PullUp = 3, + PullDefault = PullUp +} PinMode; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/device.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/device.h new file mode 100644 index 0000000000..2427e752ea --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/device.h @@ -0,0 +1,38 @@ +// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches. +// Check the 'features' section of the target description in 'targets.json' for more details. +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MBED_DEVICE_H +#define MBED_DEVICE_H + + + + + + + + + + + + + + + + +#include "objects.h" + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/analogin_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/analogin_api.c new file mode 100644 index 0000000000..d33effecdf --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/analogin_api.c @@ -0,0 +1,91 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mbed_assert.h" +#include "analogin_api.h" +#include "cmsis.h" +#include "pinmap.h" +#include "app_util_platform.h" +#include "nrf_drv_saadc.h" + +#ifdef DEVICE_ANALOGIN + +#define ADC_12BIT_RANGE 0xFFF +#define ADC_RANGE ADC_12BIT_RANGE + +static void analog_in_event_handler(nrf_drv_saadc_evt_t const *p_event)// type of nrf_drv_saadc_event_handler_t +{ + (void) p_event; +} + +static const nrf_drv_saadc_config_t saadc_config = +{ + .resolution = NRF_SAADC_RESOLUTION_12BIT, + .oversample = NRF_SAADC_OVERSAMPLE_DISABLED, + .interrupt_priority = SAADC_CONFIG_IRQ_PRIORITY +}; + +void SAADC_IRQHandler(void); + +void analogin_init(analogin_t *obj, PinName pin) +{ + ret_code_t ret_code; + + NVIC_SetVector(SAADC_IRQn, (uint32_t)SAADC_IRQHandler); + + ret_code = nrf_drv_saadc_init(&saadc_config, analog_in_event_handler); + MBED_ASSERT(((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_INVALID_STATE))); //NRF_ERROR_INVALID_STATE expected for multiple channels used. + + uint8_t saadcIn = nrf_drv_saadc_gpio_to_ain(pin); + MBED_ASSERT(saadcIn != NRF_SAADC_INPUT_DISABLED); + + obj->adc = ADC0_0; // only one instance of ADC in nRF52 SoC + obj->adc_pin = saadcIn - 1; + + nrf_saadc_channel_config_t channel_config = + NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(saadcIn); //Single ended, negative input to ADC shorted to GND. + + ret_code = nrf_drv_saadc_channel_init(obj->adc_pin, &channel_config); + MBED_ASSERT(ret_code == NRF_SUCCESS); +} + + +uint16_t analogin_read_u16(analogin_t *obj) +{ + int16_t adc_value; + ret_code_t ret_code; + + ret_code = nrf_drv_saadc_sample_convert(obj->adc_pin, &adc_value); + MBED_ASSERT(ret_code == NRF_SUCCESS); + + if (adc_value < 0) + { + // Even in the single ended mode measured value can be {-0}. Saturation for avoid casting to a big integer. + return 0; + } + else + { + return (uint16_t) adc_value; + } +} + +float analogin_read(analogin_t *obj) +{ + uint16_t value = analogin_read_u16(obj); + return (float)value * (1.0f / (float)ADC_RANGE); +} + +#endif // DEVICE_ANALOGIN diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct new file mode 100644 index 0000000000..3bb13ec74a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct @@ -0,0 +1,27 @@ +;WITHOUT SOFTDEVICE: +;LR_IROM1 0x00000000 0x00040000 { +; ER_IROM1 0x00000000 0x00040000 { +; *.o (RESET, +First) +; *(InRoot$$Sections) +; .ANY (+RO) +; } +; RW_IRAM1 0x20000000 0x00004000 { +; .ANY (+RW +ZI) +; } +;} +; +;WITH SOFTDEVICE: + +LR_IROM1 0x1C000 0x0064000 { + ER_IROM1 0x1C000 0x0064000 { + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM0 0x20002EF8 UNINIT 0x000000D8 { ;no init section + *(noinit) + } + RW_IRAM1 0x20002FD0 0x0000D030 { + .ANY (+RW +ZI) + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s new file mode 100644 index 0000000000..aac3e2c28f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s @@ -0,0 +1,245 @@ +;/* Copyright (c) 2012 ARM LIMITED +; +; All rights reserved. +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; - Neither the name of ARM nor the names of its contributors may be used +; to endorse or promote products derived from this software without +; specific prior written permission. +; * +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; ---------------------------------------------------------------------------*/ + +__initial_sp EQU 0x20010000 + + PRESERVE8 + THUMB + +; Vector Table Mapped to Address 0 at Reset + + AREA RESET, DATA, READONLY + EXPORT __Vectors + EXPORT __Vectors_End + EXPORT __Vectors_Size + +__Vectors DCD __initial_sp ; Top of Stack + DCD Reset_Handler + DCD NMI_Handler + DCD HardFault_Handler + DCD MemoryManagement_Handler + DCD BusFault_Handler + DCD UsageFault_Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler + DCD DebugMonitor_Handler + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UARTE0_UART0_IRQHandler_v + DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + DCD NFCT_IRQHandler_v + DCD GPIOTE_IRQHandler_v + DCD SAADC_IRQHandler_v + DCD TIMER0_IRQHandler_v + DCD TIMER1_IRQHandler_v + DCD TIMER2_IRQHandler_v + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler_v + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler_v + DCD RTC1_IRQHandler_v + DCD QDEC_IRQHandler_v + DCD COMP_LPCOMP_IRQHandler_v + DCD SWI0_EGU0_IRQHandler_v + DCD SWI1_EGU1_IRQHandler_v + DCD SWI2_EGU2_IRQHandler_v + DCD SWI3_EGU3_IRQHandler_v + DCD SWI4_EGU4_IRQHandler + DCD SWI5_EGU5_IRQHandler + DCD TIMER3_IRQHandler_v + DCD TIMER4_IRQHandler_v + DCD PWM0_IRQHandler_v + DCD PDM_IRQHandler_v + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD MWU_IRQHandler + DCD PWM1_IRQHandler_v + DCD PWM2_IRQHandler_v + DCD SPIM2_SPIS2_SPI2_IRQHandler_v + DCD RTC2_IRQHandler_v + DCD I2S_IRQHandler_v + DCD FPU_IRQHandler_v + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset Handler + + +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + IMPORT nrf_reloc_vector_table + + + LDR R0, =SystemInit + BLX R0 + LDR R0, =nrf_reloc_vector_table + BLX R0 + LDR R0, =__main + BX R0 + ENDP + +; Dummy Exception Handlers (infinite loops which can be modified) + +NMI_Handler PROC + EXPORT NMI_Handler [WEAK] + B . + ENDP +HardFault_Handler\ + PROC + EXPORT HardFault_Handler [WEAK] + B . + ENDP +MemoryManagement_Handler\ + PROC + EXPORT MemoryManagement_Handler [WEAK] + B . + ENDP +BusFault_Handler\ + PROC + EXPORT BusFault_Handler [WEAK] + B . + ENDP +UsageFault_Handler\ + PROC + EXPORT UsageFault_Handler [WEAK] + B . + ENDP +SVC_Handler PROC + EXPORT SVC_Handler [WEAK] + B . + ENDP +DebugMonitor_Handler\ + PROC + EXPORT DebugMonitor_Handler [WEAK] + B . + ENDP +PendSV_Handler PROC + EXPORT PendSV_Handler [WEAK] + B . + ENDP +SysTick_Handler PROC + EXPORT SysTick_Handler [WEAK] + B . + ENDP + +Default_Handler PROC + + EXPORT POWER_CLOCK_IRQHandler [WEAK] + EXPORT RADIO_IRQHandler [WEAK] + EXPORT UARTE0_UART0_IRQHandler_v [WEAK] + EXPORT SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v [WEAK] + EXPORT SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v [WEAK] + EXPORT NFCT_IRQHandler_v [WEAK] + EXPORT GPIOTE_IRQHandler_v [WEAK] + EXPORT SAADC_IRQHandler_v [WEAK] + EXPORT TIMER0_IRQHandler_v [WEAK] + EXPORT TIMER1_IRQHandler_v [WEAK] + EXPORT TIMER2_IRQHandler_v [WEAK] + EXPORT RTC0_IRQHandler [WEAK] + EXPORT TEMP_IRQHandler_v [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT ECB_IRQHandler [WEAK] + EXPORT CCM_AAR_IRQHandler [WEAK] + EXPORT WDT_IRQHandler_v [WEAK] + EXPORT RTC1_IRQHandler_v [WEAK] + EXPORT QDEC_IRQHandler_v [WEAK] + EXPORT COMP_LPCOMP_IRQHandler_v [WEAK] + EXPORT SWI0_EGU0_IRQHandler_v [WEAK] + EXPORT SWI1_EGU1_IRQHandler_v [WEAK] + EXPORT SWI2_EGU2_IRQHandler_v [WEAK] + EXPORT SWI3_EGU3_IRQHandler_v [WEAK] + EXPORT SWI4_EGU4_IRQHandler [WEAK] + EXPORT SWI5_EGU5_IRQHandler [WEAK] + EXPORT TIMER3_IRQHandler_v [WEAK] + EXPORT TIMER4_IRQHandler_v [WEAK] + EXPORT PWM0_IRQHandler_v [WEAK] + EXPORT PDM_IRQHandler_v [WEAK] + EXPORT MWU_IRQHandler [WEAK] + EXPORT PWM1_IRQHandler_v [WEAK] + EXPORT PWM2_IRQHandler_v [WEAK] + EXPORT SPIM2_SPIS2_SPI2_IRQHandler_v [WEAK] + EXPORT RTC2_IRQHandler_v [WEAK] + EXPORT I2S_IRQHandler_v [WEAK] + EXPORT FPU_IRQHandler_v [WEAK] +POWER_CLOCK_IRQHandler +RADIO_IRQHandler +UARTE0_UART0_IRQHandler_v +SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v +SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v +NFCT_IRQHandler_v +GPIOTE_IRQHandler_v +SAADC_IRQHandler_v +TIMER0_IRQHandler_v +TIMER1_IRQHandler_v +TIMER2_IRQHandler_v +RTC0_IRQHandler +TEMP_IRQHandler_v +RNG_IRQHandler +ECB_IRQHandler +CCM_AAR_IRQHandler +WDT_IRQHandler_v +RTC1_IRQHandler_v +QDEC_IRQHandler_v +COMP_LPCOMP_IRQHandler_v +SWI0_EGU0_IRQHandler_v +SWI1_EGU1_IRQHandler_v +SWI2_EGU2_IRQHandler_v +SWI3_EGU3_IRQHandler_v +SWI4_EGU4_IRQHandler +SWI5_EGU5_IRQHandler +TIMER3_IRQHandler_v +TIMER4_IRQHandler_v +PWM0_IRQHandler_v +PDM_IRQHandler_v +MWU_IRQHandler +PWM1_IRQHandler_v +PWM2_IRQHandler_v +SPIM2_SPIS2_SPI2_IRQHandler_v +RTC2_IRQHandler_v +I2S_IRQHandler_v +FPU_IRQHandler_v + B . + ENDP + ALIGN + END diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/sys.cpp b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/sys.cpp new file mode 100644 index 0000000000..2f1024ace8 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/sys.cpp @@ -0,0 +1,31 @@ +/* mbed Microcontroller Library - stackheap + * Copyright (C) 2009-2011 ARM Limited. All rights reserved. + * + * Setup a fixed single stack/heap memory model, + * between the top of the RW/ZI region and the stackpointer + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +extern char Image$$RW_IRAM1$$ZI$$Limit[]; + +extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { + uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; + uint32_t sp_limit = __current_sp(); + + zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned + + struct __initial_stackheap r; + r.heap_base = zi_limit; + r.heap_limit = sp_limit; + return r; +} + +#ifdef __cplusplus +} +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52832.ld b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52832.ld new file mode 100644 index 0000000000..d049cd8818 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52832.ld @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2015 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Linker script to configure memory regions. */ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1C000, LENGTH = 0x64000 + RAM (rwx) : ORIGIN = 0x20002ef8, LENGTH = 0xd108 +} + + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +/* Linker script to place sections and symbol values. Should be used together + * with the other linker script that defines memory regions FLASH and RAM. + * It references the following symbols that must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines the following symbols that the code can use without definition: + * __exidx_start + * __exidx_end + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + + +SECTIONS +{ + .text : + { + KEEP(*(.Vectors)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + . = ALIGN(4); + } > FLASH + __exidx_end = .; + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + . = ALIGN(4); + PROVIDE(__start_fs_data = .); + KEEP(*(.fs_data)) + PROVIDE(__stop_fs_data = .); + + *(.jcr) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + __edata = .; + + .noinit : + { + PROVIDE(__start_noinit = .); + KEEP(*(.noinit)) + PROVIDE(__stop_noinit = .); + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (NOLOAD): + { + __end__ = .; + end = __end__; + *(.heap*); + + /* Expand the heap to reach the stack boundary. */ + ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - 0x800), "heap region overflowed into stack"); + . += (ORIGIN(RAM) + LENGTH(RAM) - 0x800) - .; + } > RAM + PROVIDE(__heap_start = ADDR(.heap)); + PROVIDE(__heap_size = SIZEOF(.heap)); + PROVIDE(__mbed_sbrk_start = ADDR(.heap)); + PROVIDE(__mbed_krbs_start = ADDR(.heap) + SIZEOF(.heap)); + + /* .stack_dummy section does not contain any symbols. It is only + * used for the linker script to calculate the size of stack sections + * and assign values to stack symbols later. */ + .stack (NOLOAD): + { + __StackLimit = .; + *(.stack*) + . += (ORIGIN(RAM) + LENGTH(RAM) - .); + } > RAM + + /* Set the stack top to the end of RAM and move down the stack limit by + * the size of the stack_dummy section. */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack); + PROVIDE(__stack = __StackTop); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S new file mode 100644 index 0000000000..1c6631e7dd --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* +NOTE: Template files (including this one) are application specific and therefore +expected to be copied into the application project folder prior to its use! +*/ + + .syntax unified + .arch armv7e-m + + .section .Vectors + .align 2 + .globl __Vectors +__Vectors: + .long __StackTop /* Top of Stack */ + .long Reset_Handler + .long NMI_Handler + .long HardFault_Handler + .long MemoryManagement_Handler + .long BusFault_Handler + .long UsageFault_Handler + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long SVC_Handler + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long PendSV_Handler + .long SysTick_Handler + + /* External Interrupts */ + .long POWER_CLOCK_IRQHandler + .long RADIO_IRQHandler + .long UARTE0_UART0_IRQHandler_v + .long SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + .long SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + .long NFCT_IRQHandler_v + .long GPIOTE_IRQHandler_v + .long SAADC_IRQHandler_v + .long TIMER0_IRQHandler_v + .long TIMER1_IRQHandler_v + .long TIMER2_IRQHandler_v + .long RTC0_IRQHandler + .long TEMP_IRQHandler_v + .long RNG_IRQHandler + .long ECB_IRQHandler + .long CCM_AAR_IRQHandler + .long WDT_IRQHandler_v + .long RTC1_IRQHandler_v + .long QDEC_IRQHandler_v + .long COMP_LPCOMP_IRQHandler_v + .long SWI0_EGU0_IRQHandler_v + .long SWI1_EGU1_IRQHandler_v + .long SWI2_EGU2_IRQHandler_v + .long SWI3_EGU3_IRQHandler_v + .long SWI4_EGU4_IRQHandler + .long SWI5_EGU5_IRQHandler + .long TIMER3_IRQHandler_v + .long TIMER4_IRQHandler_v + .long PWM0_IRQHandler_v + .long PDM_IRQHandler_v + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long MWU_IRQHandler + .long PWM1_IRQHandler_v + .long PWM2_IRQHandler_v + .long SPIM2_SPIS2_SPI2_IRQHandler_v + .long RTC2_IRQHandler_v + .long I2S_IRQHandler_v + .long FPU_IRQHandler_v + + + .size __Vectors, . - __Vectors + +/* Reset Handler */ + + .text + .thumb + .thumb_func + .align 1 + .globl Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + .fnstart + + +/* Loop to copy data from read only memory to RAM. The ranges + * of copy from/to are specified by following symbols evaluated in + * linker script. + * __etext: End of code section, i.e., begin of data sections to copy from. + * __data_start__/__data_end__: RAM address range that data should be + * copied to. Both must be aligned to 4 bytes boundary. */ + + ldr r1, =__etext + ldr r2, =__data_start__ + ldr r3, =__data_end__ + + subs r3, r2 + ble .LC0 + +.LC1: + subs r3, 4 + ldr r0, [r1,r3] + str r0, [r2,r3] + bgt .LC1 +.LC0: + + LDR R0, =SystemInit + BLX R0 + LDR R0, =nrf_reloc_vector_table + BLX R0 + LDR R0, =_start + BX R0 + + .pool + .cantunwind + .fnend + .size Reset_Handler,.-Reset_Handler + + .section ".text" + + +/* Dummy Exception Handlers (infinite loops which can be modified) */ + + .weak NMI_Handler + .type NMI_Handler, %function +NMI_Handler: + B . + .size NMI_Handler, . - NMI_Handler + + + .weak HardFault_Handler + .type HardFault_Handler, %function +HardFault_Handler: + B . + .size HardFault_Handler, . - HardFault_Handler + + + .weak MemoryManagement_Handler + .type MemoryManagement_Handler, %function +MemoryManagement_Handler: + B . + .size MemoryManagement_Handler, . - MemoryManagement_Handler + + + .weak BusFault_Handler + .type BusFault_Handler, %function +BusFault_Handler: + B . + .size BusFault_Handler, . - BusFault_Handler + + + .weak UsageFault_Handler + .type UsageFault_Handler, %function +UsageFault_Handler: + B . + .size UsageFault_Handler, . - UsageFault_Handler + + + .weak SVC_Handler + .type SVC_Handler, %function +SVC_Handler: + B . + .size SVC_Handler, . - SVC_Handler + + + .weak PendSV_Handler + .type PendSV_Handler, %function +PendSV_Handler: + B . + .size PendSV_Handler, . - PendSV_Handler + + + .weak SysTick_Handler + .type SysTick_Handler, %function +SysTick_Handler: + B . + .size SysTick_Handler, . - SysTick_Handler + + +/* IRQ Handlers */ + + .globl Default_Handler + .type Default_Handler, %function +Default_Handler: + B . + .size Default_Handler, . - Default_Handler + + .macro IRQ handler + .weak \handler + .set \handler, Default_Handler + .endm + + IRQ POWER_CLOCK_IRQHandler /* restricted */ + IRQ RADIO_IRQHandler /* blocked */ + IRQ UARTE0_UART0_IRQHandler_v + IRQ SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + IRQ SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + IRQ NFCT_IRQHandler_v + IRQ GPIOTE_IRQHandler_v + IRQ SAADC_IRQHandler_v + IRQ TIMER0_IRQHandler_v + IRQ TIMER1_IRQHandler_v + IRQ TIMER2_IRQHandler_v + IRQ RTC0_IRQHandler /* blocked */ + IRQ TEMP_IRQHandler_v + IRQ RNG_IRQHandler /* restricted */ + IRQ ECB_IRQHandler /* restricted */ + IRQ CCM_AAR_IRQHandler /* blocked */ + IRQ WDT_IRQHandler_v + IRQ RTC1_IRQHandler_v + IRQ QDEC_IRQHandler_v + IRQ COMP_LPCOMP_IRQHandler_v + IRQ SWI0_EGU0_IRQHandler_v + IRQ SWI1_EGU1_IRQHandler_v /* restricted for Radio Notification */ + IRQ SWI2_EGU2_IRQHandler_v /* blocked for SoftDevice Event */ + IRQ SWI3_EGU3_IRQHandler_v + IRQ SWI4_EGU4_IRQHandler /* blocked */ + IRQ SWI5_EGU5_IRQHandler /* blocked */ + IRQ TIMER3_IRQHandler_v + IRQ TIMER4_IRQHandler_v + IRQ PWM0_IRQHandler_v + IRQ PDM_IRQHandler_v + IRQ MWU_IRQHandler /* restricted */ + IRQ PWM1_IRQHandler_v + IRQ PWM2_IRQHandler_v + IRQ SPIM2_SPIS2_SPI2_IRQHandler_v + IRQ RTC2_IRQHandler_v + IRQ I2S_IRQHandler_v + IRQ FPU_IRQHandler_v + + .end diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf new file mode 100644 index 0000000000..d8dee15e57 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf @@ -0,0 +1,46 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x1c000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x1c000; +define symbol __ICFEDIT_region_ROM_end__ = 0x7ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002ef8; +define symbol __ICFEDIT_region_RAM_end__ = 0x2000ffff; +export symbol __ICFEDIT_region_RAM_start__; +export symbol __ICFEDIT_region_RAM_end__; +/*-Sizes-*/ +/*Heap 1/4 of ram and stack 1/8*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x1800; +/**** End of ICF editor section. ###ICF###*/ + +define symbol __code_start_soft_device__ = 0x0; + +define memory mem with size = 4G; +define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +keep { section .intvec }; +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; +place in ROM_region { readonly }; +place in RAM_region { readwrite, + block HEAP, + block CSTACK }; + +/*This is used for mbed applications build inside the Embedded workbench +Applications build with the python scritps use a hex merge so need to merge it +inside the linker. The linker can only use binary files so the hex merge is not possible +through the linker. That is why a binary is used instead of a hex image for the embedded project. +*/ +if(isdefinedsymbol(SOFT_DEVICE_BIN)) +{ + place at address mem:__code_start_soft_device__ { section .noinit_softdevice }; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s new file mode 100644 index 0000000000..b27d189e7d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s @@ -0,0 +1,381 @@ +;/* Copyright (c) 2012 ARM LIMITED +; +; All rights reserved. +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; - Neither the name of ARM nor the names of its contributors may be used +; to endorse or promote products derived from this software without +; specific prior written permission. +; * +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; ---------------------------------------------------------------------------*/ + + +; The modules in this file are included in the libraries, and may be replaced +; by any user-defined modules that define the PUBLIC symbol _program_start or +; a user defined start symbol. +; To override the cstartup defined in the library, simply add your modified +; version to the workbench project. +; +; The vector table is normally located at address 0. +; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. +; The name "__vector_table" has special meaning for C-SPY: +; it is where the SP start value is found, and the NVIC vector +; table register (VTOR) is initialized to this address if != 0. + + + + MODULE ?cstartup + + ;; Stack size default : Defined in *.icf (linker file). Can be modified inside EW. + ;; Heap size default : Defined in *.icf (linker file). Can be modified inside EW. + + ;; Forward declaration of sections. + SECTION CSTACK:DATA:NOROOT(3) + + SECTION .intvec:CODE:NOROOT(2) + + EXTERN __iar_program_start + EXTERN SystemInit + EXTERN nrf_reloc_vector_table + PUBLIC __vector_table + PUBLIC __Vectors + PUBLIC __Vectors_End + PUBLIC __Vectors_Size + + DATA + +__vector_table + DCD sfe(CSTACK) + DCD Reset_Handler + DCD NMI_Handler + DCD HardFault_Handler + DCD MemoryManagement_Handler + DCD BusFault_Handler + DCD UsageFault_Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler + DCD DebugMonitor_Handler + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UARTE0_UART0_IRQHandler_v + DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + DCD NFCT_IRQHandler_v + DCD GPIOTE_IRQHandler_v + DCD SAADC_IRQHandler_v + DCD TIMER0_IRQHandler_v + DCD TIMER1_IRQHandler_v + DCD TIMER2_IRQHandler_v + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler_v + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler_v + DCD RTC1_IRQHandler_v + DCD QDEC_IRQHandler_v + DCD COMP_LPCOMP_IRQHandler_v + DCD SWI0_EGU0_IRQHandler_v + DCD SWI1_EGU1_IRQHandler_v + DCD SWI2_EGU2_IRQHandler_v + DCD SWI3_EGU3_IRQHandler_v + DCD SWI4_EGU4_IRQHandler + DCD SWI5_EGU5_IRQHandler + DCD TIMER3_IRQHandler_v + DCD TIMER4_IRQHandler_v + DCD PWM0_IRQHandler_v + DCD PDM_IRQHandler_v + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD MWU_IRQHandler + DCD PWM1_IRQHandler_v + DCD PWM2_IRQHandler_v + DCD SPIM2_SPIS2_SPI2_IRQHandler_v + DCD RTC2_IRQHandler_v + DCD I2S_IRQHandler_v + DCD FPU_IRQHandler_v + + +__Vectors_End +__Vectors EQU __vector_table +__Vectors_Size EQU __Vectors_End - __Vectors + + +; Default handlers. + THUMB + + PUBWEAK Reset_Handler + SECTION .text:CODE:NOROOT(2) +Reset_Handler + + LDR R0, =SystemInit + BLX R0 + LDR R0, =nrf_reloc_vector_table + BLX R0 + LDR R0, =__iar_program_start + BX R0 + + ; Dummy exception handlers + + + PUBWEAK NMI_Handler + SECTION .text:CODE:NOROOT(1) +NMI_Handler + B . + + PUBWEAK HardFault_Handler + SECTION .text:CODE:NOROOT(1) +HardFault_Handler + B . + + PUBWEAK MemoryManagement_Handler + SECTION .text:CODE:NOROOT(1) +MemoryManagement_Handler + B . + + PUBWEAK BusFault_Handler + SECTION .text:CODE:NOROOT(1) +BusFault_Handler + B . + + PUBWEAK UsageFault_Handler + SECTION .text:CODE:NOROOT(1) +UsageFault_Handler + B . + + PUBWEAK SVC_Handler + SECTION .text:CODE:NOROOT(1) +SVC_Handler + B . + + PUBWEAK DebugMonitor_Handler + SECTION .text:CODE:NOROOT(1) +DebugMonitor_Handler + B . + + PUBWEAK PendSV_Handler + SECTION .text:CODE:NOROOT(1) +PendSV_Handler + B . + + PUBWEAK SysTick_Handler + SECTION .text:CODE:NOROOT(1) +SysTick_Handler + B . + + + ; Dummy interrupt handlers + + PUBWEAK POWER_CLOCK_IRQHandler + SECTION .text:CODE:NOROOT(1) +POWER_CLOCK_IRQHandler + B . + + PUBWEAK RADIO_IRQHandler + SECTION .text:CODE:NOROOT(1) +RADIO_IRQHandler + B . + + PUBWEAK UARTE0_UART0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +UARTE0_UART0_IRQHandler_v + B . + + PUBWEAK SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + B . + + PUBWEAK SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + B . + + PUBWEAK NFCT_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +NFCT_IRQHandler_v + B . + + PUBWEAK GPIOTE_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +GPIOTE_IRQHandler_v + B . + + PUBWEAK SAADC_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SAADC_IRQHandler_v + B . + + PUBWEAK TIMER0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER0_IRQHandler_v + B . + + PUBWEAK TIMER1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER1_IRQHandler_v + B . + + PUBWEAK TIMER2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER2_IRQHandler_v + B . + + PUBWEAK RTC0_IRQHandler + SECTION .text:CODE:NOROOT(1) +RTC0_IRQHandler + B . + + PUBWEAK TEMP_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TEMP_IRQHandler_v + B . + + PUBWEAK RNG_IRQHandler + SECTION .text:CODE:NOROOT(1) +RNG_IRQHandler + B . + + PUBWEAK ECB_IRQHandler + SECTION .text:CODE:NOROOT(1) +ECB_IRQHandler + B . + + PUBWEAK CCM_AAR_IRQHandler + SECTION .text:CODE:NOROOT(1) +CCM_AAR_IRQHandler + B . + + PUBWEAK WDT_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +WDT_IRQHandler_v + B . + + PUBWEAK RTC1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +RTC1_IRQHandler_v + B . + + PUBWEAK QDEC_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +QDEC_IRQHandler_v + B . + + PUBWEAK COMP_LPCOMP_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +COMP_LPCOMP_IRQHandler_v + B . + + PUBWEAK SWI0_EGU0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SWI0_EGU0_IRQHandler_v + B . + + PUBWEAK SWI1_EGU1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SWI1_EGU1_IRQHandler_v + B . + + PUBWEAK SWI2_EGU2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SWI2_EGU2_IRQHandler_v + B . + + PUBWEAK SWI3_EGU3_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SWI3_EGU3_IRQHandler_v + B . + + PUBWEAK SWI4_EGU4_IRQHandler + SECTION .text:CODE:NOROOT(1) +SWI4_EGU4_IRQHandler + B . + + PUBWEAK SWI5_EGU5_IRQHandler + SECTION .text:CODE:NOROOT(1) +SWI5_EGU5_IRQHandler + B . + + PUBWEAK TIMER3_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER3_IRQHandler_v + B . + + PUBWEAK TIMER4_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER4_IRQHandler_v + B . + + PUBWEAK PWM0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PWM0_IRQHandler_v + B . + + PUBWEAK PDM_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PDM_IRQHandler_v + B . + + PUBWEAK MWU_IRQHandler + SECTION .text:CODE:NOROOT(1) +MWU_IRQHandler + B . + + PUBWEAK PWM1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PWM1_IRQHandler_v + B . + + PUBWEAK PWM2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PWM2_IRQHandler_v + B . + + PUBWEAK SPIM2_SPIS2_SPI2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SPIM2_SPIS2_SPI2_IRQHandler_v + B . + + PUBWEAK RTC2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +RTC2_IRQHandler_v + B . + + PUBWEAK I2S_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +I2S_IRQHandler_v + B . + + PUBWEAK FPU_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +FPU_IRQHandler_v + B . + + + END + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis.h new file mode 100644 index 0000000000..214885742d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis.h @@ -0,0 +1,24 @@ +/* + * PackageLicenseDeclared: Apache-2.0 + * Copyright (c) 2016 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MBED_CMSIS_H +#define MBED_CMSIS_H + +#include "nrf.h" +#include "cmsis_nvic.h" + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.c new file mode 100644 index 0000000000..2efb6da48c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.c @@ -0,0 +1,43 @@ +/* mbed Microcontroller Library + * CMSIS-style functionality to support dynamic vectors + ******************************************************************************* + * Copyright (c) 2016 ARM Limited. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of ARM Limited nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#include "cmsis_nvic.h" + +extern uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS]; + +void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + nrf_dispatch_vector[IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + +uint32_t NVIC_GetVector(IRQn_Type IRQn) +{ + return nrf_dispatch_vector[IRQn + NVIC_USER_IRQ_OFFSET]; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h new file mode 100644 index 0000000000..0837075c40 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h @@ -0,0 +1,53 @@ +/* mbed Microcontroller Library + * CMSIS-style functionality to support dynamic vectors + ******************************************************************************* + * Copyright (c) 2016 ARM Limited. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of ARM Limited nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ + +#ifndef MBED_CMSIS_NVIC_H +#define MBED_CMSIS_NVIC_H + +#define NVIC_NUM_VECTORS (16 + 38) // CORE + MCU Peripherals +#define NVIC_USER_IRQ_OFFSET 16 + +#include "nrf52.h" +#include "cmsis.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); +uint32_t NVIC_GetVector(IRQn_Type IRQn); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.c new file mode 100644 index 0000000000..89d125a37d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.c @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "nrf.h" +#include "system_nrf52.h" +#include "nrf5x_lf_clk_helper.h" + +/*lint ++flb "Enter library region" */ + +#define __SYSTEM_CLOCK_64M (64000000UL) + +static bool errata_16(void); +static bool errata_31(void); +static bool errata_32(void); +static bool errata_36(void); +static bool errata_37(void); +static bool errata_57(void); +static bool errata_66(void); + + +#if defined ( __CC_ARM ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; +#elif defined ( __ICCARM__ ) + __root uint32_t SystemCoreClock = __SYSTEM_CLOCK_64M; +#elif defined ( __GNUC__ ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; +#endif + +void SystemCoreClockUpdate(void) +{ + SystemCoreClock = __SYSTEM_CLOCK_64M; +} + +void SystemInit(void) +{ + /* Workaround for Errata 16 "System: RAM may be corrupt on wakeup from CPU IDLE" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_16()){ + *(volatile uint32_t *)0x4007C074 = 3131961357ul; + } + + /* Workaround for Errata 31 "CLOCK: Calibration values are not correctly loaded from FICR at reset" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_31()){ + *(volatile uint32_t *)0x4000053C = ((*(volatile uint32_t *)0x10000244) & 0x0000E000) >> 13; + } + + /* Workaround for Errata 32 "DIF: Debug session automatically enables TracePort pins" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_32()){ + CoreDebug->DEMCR &= ~CoreDebug_DEMCR_TRCENA_Msk; + } + + /* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_36()){ + NRF_CLOCK->EVENTS_DONE = 0; + NRF_CLOCK->EVENTS_CTTO = 0; + NRF_CLOCK->CTIV = 0; + } + + /* Workaround for Errata 37 "RADIO: Encryption engine is slow by default" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_37()){ + *(volatile uint32_t *)0x400005A0 = 0x3; + } + + /* Workaround for Errata 57 "NFCT: NFC Modulation amplitude" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_57()){ + *(volatile uint32_t *)0x40005610 = 0x00000005; + *(volatile uint32_t *)0x40005688 = 0x00000001; + *(volatile uint32_t *)0x40005618 = 0x00000000; + *(volatile uint32_t *)0x40005614 = 0x0000003F; + } + + /* Workaround for Errata 66 "TEMP: Linearity specification not met with default settings" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_66()){ + NRF_TEMP->A0 = NRF_FICR->TEMP.A0; + NRF_TEMP->A1 = NRF_FICR->TEMP.A1; + NRF_TEMP->A2 = NRF_FICR->TEMP.A2; + NRF_TEMP->A3 = NRF_FICR->TEMP.A3; + NRF_TEMP->A4 = NRF_FICR->TEMP.A4; + NRF_TEMP->A5 = NRF_FICR->TEMP.A5; + NRF_TEMP->B0 = NRF_FICR->TEMP.B0; + NRF_TEMP->B1 = NRF_FICR->TEMP.B1; + NRF_TEMP->B2 = NRF_FICR->TEMP.B2; + NRF_TEMP->B3 = NRF_FICR->TEMP.B3; + NRF_TEMP->B4 = NRF_FICR->TEMP.B4; + NRF_TEMP->B5 = NRF_FICR->TEMP.B5; + NRF_TEMP->T0 = NRF_FICR->TEMP.T0; + NRF_TEMP->T1 = NRF_FICR->TEMP.T1; + NRF_TEMP->T2 = NRF_FICR->TEMP.T2; + NRF_TEMP->T3 = NRF_FICR->TEMP.T3; + NRF_TEMP->T4 = NRF_FICR->TEMP.T4; + } + + /* Enable the FPU if the compiler used floating point unit instructions. __FPU_USED is a MACRO defined by the + * compiler. Since the FPU consumes energy, remember to disable FPU use in the compiler if floating point unit + * operations are not used in your code. */ + #if (__FPU_USED == 1) + SCB->CPACR |= (3UL << 20) | (3UL << 22); + __DSB(); + __ISB(); + #endif + + /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined, + two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as + normal GPIOs. */ + #if defined (CONFIG_NFCT_PINS_AS_GPIOS) + if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){ + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NVIC_SystemReset(); + } + #endif + + /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not + defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be + reserved for PinReset and not available as normal GPIO. */ + #if defined (CONFIG_GPIO_AS_PINRESET) + if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) || + ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){ + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->PSELRESET[0] = 21; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->PSELRESET[1] = 21; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NVIC_SystemReset(); + } + #endif + + /* Enable SWO trace functionality. If ENABLE_SWO is not defined, SWO pin will be used as GPIO (see Product + Specification to see which one). */ + #if defined (ENABLE_SWO) + CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; + NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos; + NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + #endif + + /* Enable Trace functionality. If ENABLE_TRACE is not defined, TRACE pins will be used as GPIOs (see Product + Specification to see which ones). */ + #if defined (ENABLE_TRACE) + CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; + NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Parallel << CLOCK_TRACECONFIG_TRACEMUX_Pos; + NRF_P0->PIN_CNF[14] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[15] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[16] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[20] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + #endif + + SystemCoreClockUpdate(); + + // Start the LF oscilator according to the mbed configuration (over the nrf5x_lf_clk_helper.h file) + NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_TO_USE << CLOCK_LFCLKSRC_SRC_Pos); + NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; + NRF_CLOCK->TASKS_LFCLKSTART = 1; + + // Wait for the external oscillator to start up. + while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) { + // Do nothing. + } +} + + +static bool errata_16(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + } + + return false; +} + +static bool errata_31(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) + { + return true; + } + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) + { + return true; + } + } + + return false; +} + +static bool errata_32(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + } + + return false; +} + +static bool errata_36(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) + { + return true; + } + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) + { + return true; + } + } + + return false; +} + +static bool errata_37(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + } + + return false; +} + +static bool errata_57(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + } + + return false; +} + +static bool errata_66(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) + { + return true; + } + } + + return false; +} + + +/*lint --flb "Leave library region" */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.h new file mode 100644 index 0000000000..5ecc271059 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef SYSTEM_NRF52_H +#define SYSTEM_NRF52_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + + +extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ + +/** + * Initialize the system + * + * @param none + * @return none + * + * @brief Setup the microcontroller system. + * Initialize the System and update the SystemCoreClock variable. + */ +extern void SystemInit (void); + +/** + * Update SystemCoreClock variable + * + * @param none + * @return none + * + * @brief Updates the SystemCoreClock with current core Clock + * retrieved from cpu registers. + */ +extern void SystemCoreClockUpdate (void); + +#ifdef __cplusplus +} +#endif + +#endif /* SYSTEM_NRF52_H */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c new file mode 100644 index 0000000000..97e29f256d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "mbed_assert.h" +#include "mbed_error.h" +#include "pwmout_api.h" +#include "cmsis.h" +#include "pinmap.h" + +#if DEVICE_PWMOUT + +#include "app_util_platform.h" +#include "nrf_drv_pwm.h" + +#define MAX_PWM_COUNTERTOP (0x7FFF) // 0x7FFF is the max of COUNTERTOP value for the PWM peripherial of the nRF52. +#define MAX_PWM_PERIOD_US (MAX_PWM_COUNTERTOP * 8) // PWM hw is driven by 16 MHz clock, hence the tick is 1_us/16, + // and 128 is the max prescaler value. +#define MAX_PWM_PERIOD_MS ((MAX_PWM_PERIOD_US / 1000) + 1) // approximations advance +#define MAX_PWM_PERIOD_S ((MAX_PWM_PERIOD_US / 1000000) + 1) // approximations advance + + +#define PWM_INSTANCE_COUNT (PWM_COUNT) // import from the nrf_drv_config.h file + +///> instances of nRF52 PWM driver +static const nrf_drv_pwm_t m_pwm_driver[PWM_INSTANCE_COUNT] = +{ +#if PWM0_ENABLED + NRF_DRV_PWM_INSTANCE(0), +#endif +#if PWM1_ENABLED + NRF_DRV_PWM_INSTANCE(1), +#endif +#if PWM2_ENABLED + NRF_DRV_PWM_INSTANCE(2) +#endif +}; + +typedef struct +{ + uint32_t period_us; + uint32_t duty_us; + float duty; +} pwm_signal_t; /// PWM signal description type + +typedef struct +{ + nrf_drv_pwm_t * p_pwm_driver; + pwm_signal_t signal; + volatile nrf_pwm_values_common_t seq_values[1]; +} pwm_t; /// internal PWM instance support type + +static pwm_t m_pwm[PWM_INSTANCE_COUNT] = +{ +#if PWM0_ENABLED + {.p_pwm_driver = NULL}, +#endif +#if PWM1_ENABLED + {.p_pwm_driver = NULL}, +#endif +#if PWM2_ENABLED + {.p_pwm_driver = NULL} +#endif +}; /// Array of internal PWM instances. + +typedef struct +{ + uint16_t period_hwu; // unit related to pwm_clk + uint16_t duty_hwu; // unit related to pwm_clk + nrf_pwm_clk_t pwm_clk; +} pulsewidth_set_t; /// helper type for timing calculations + + +static void internal_pwmout_exe(pwmout_t *obj, bool new_period, bool initialization); + +// extern PWM nIRQ handler implementations +void PWM0_IRQHandler(void); +void PWM1_IRQHandler(void); +void PWM2_IRQHandler(void); + +static const peripheral_handler_desc_t pwm_handlers[PWM_INSTANCE_COUNT] = +{ + { + PWM0_IRQn, + (uint32_t)PWM0_IRQHandler + }, + { + PWM1_IRQn, + (uint32_t)PWM1_IRQHandler + }, + { + PWM2_IRQn, + (uint32_t)PWM2_IRQHandler + } +}; + +void pwmout_init(pwmout_t *obj, PinName pin) +{ + uint32_t i; + + for (i = 0; PWM_INSTANCE_COUNT; i++) + { + if (m_pwm[i].p_pwm_driver == NULL) // a driver instance not assigned to the obj? + { + NVIC_SetVector(pwm_handlers[i].IRQn, pwm_handlers[i].vector); + + obj->pin = pin; + + obj->pwm_channel = i; + + m_pwm[i].p_pwm_driver = (nrf_drv_pwm_t *) &m_pwm_driver[i]; + m_pwm[i].signal.period_us = 200000; // 0.02 s + m_pwm[i].signal.duty_us = 100000; + m_pwm[i].signal.duty = 0.5f; + + obj->pwm_struct = &m_pwm[i]; + + internal_pwmout_exe(obj, true, true); + + break; + } + } + + MBED_ASSERT(i != PWM_INSTANCE_COUNT); // assert if free instance was not found. +} + +void pwmout_free(pwmout_t *obj) +{ + nrf_drv_pwm_uninit( (nrf_drv_pwm_t*) obj->pwm_struct ); + + m_pwm[obj->pwm_channel].p_pwm_driver = NULL; +} + +void pwmout_write(pwmout_t *obj, float percent) +{ + + if (percent < 0) + { + percent = 0; + } + else if (percent > 1) + { + percent = 1; + } + + pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + p_pwm_signal->duty = percent; + + int us = (((int)p_pwm_signal->period_us) * percent); + + pwmout_pulsewidth_us(obj, us); +} + +float pwmout_read(pwmout_t *obj) +{ + pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + return (float)p_pwm_signal->duty_us / (float)p_pwm_signal->period_us; +} + +void pwmout_period(pwmout_t *obj, float seconds) +{ + // raught saturation < 0, quasi-max> + if (seconds > MAX_PWM_PERIOD_S) + { + seconds = MAX_PWM_PERIOD_S; + } + else if (seconds < 0) + { + seconds = 0; // f. pwmout_period_us will set period to min. value + } + + int us = seconds * 1000000; + + pwmout_period_us(obj, us); +} + +void pwmout_period_ms(pwmout_t *obj, int ms) +{ + // reught saturation < 0, quasi-max> + if (ms > MAX_PWM_PERIOD_MS) + { + ms = MAX_PWM_PERIOD_MS; + } + else if (ms < 0) + { + ms = 0; // f. pwmout_period_us will set period to min. value + } + + int us = ms * 1000; + + pwmout_period_us(obj, us); +} + + +void pwmout_period_us(pwmout_t *obj, int us) +{ + pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + // saturation <1, real-max> + if (us > MAX_PWM_PERIOD_US) + { + us = MAX_PWM_PERIOD_US; + } + else if (us < 1) + { + us = 1; + } + + p_pwm_signal->duty_us = (int)((float)us * p_pwm_signal->duty); + + p_pwm_signal->period_us = us; + + internal_pwmout_exe(obj, true, false); +} + +void pwmout_pulsewidth(pwmout_t *obj, float seconds) +{ + // raught saturation < 0, quasi-max> + if (seconds > MAX_PWM_PERIOD_S) + { + seconds = MAX_PWM_PERIOD_S; + } + else if (seconds < 0) + { + seconds = 0; + } + + int us = seconds * 1000000; + + pwmout_pulsewidth_us(obj,us); +} + +void pwmout_pulsewidth_ms(pwmout_t *obj, int ms) +{ + // raught saturation < 0, quasi-max> + if (ms > MAX_PWM_PERIOD_MS) + { + ms = MAX_PWM_PERIOD_MS; + } + else if (ms < 0) + { + ms = 0; + } + + int us = ms * 1000; + + pwmout_pulsewidth_us(obj, us); +} + +void pwmout_pulsewidth_us(pwmout_t *obj, int us) +{ + // saturation <0, real-max> + if (us > MAX_PWM_PERIOD_US) + { + us = MAX_PWM_PERIOD_US; + } + else if (us < 0) + { + us = 0; + } + + pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + p_pwm_signal->duty_us = us; + p_pwm_signal->duty = us / p_pwm_signal->period_us; + + internal_pwmout_exe(obj, false, false); +} + + + + + + +static ret_code_t pulsewidth_us_set_get(int period_hwu, int duty_hwu, pulsewidth_set_t * p_settings) +{ + uint16_t div; + nrf_pwm_clk_t pwm_clk = NRF_PWM_CLK_16MHz; + + for(div = 1; div <= 128 ; div <<= 1) // 128 is the maximum of clock prescaler for PWM peripherial + { + if (MAX_PWM_COUNTERTOP >= period_hwu) + { + p_settings->period_hwu = period_hwu; // unit [us/16 * div] + p_settings->duty_hwu = duty_hwu; // unit [us/16 * div] + p_settings->pwm_clk = pwm_clk; + + return NRF_SUCCESS; + } + + period_hwu >>= 1; + duty_hwu >>= 1; + pwm_clk++; + } + + return NRF_ERROR_INVALID_PARAM; +} + + +static void internal_pwmout_exe(pwmout_t *obj, bool new_period, bool initialization) +{ + pulsewidth_set_t pulsewidth_set; + pwm_signal_t * p_pwm_signal; + nrf_drv_pwm_t * p_pwm_driver; + ret_code_t ret_code; + + p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + if (NRF_SUCCESS == pulsewidth_us_set_get(p_pwm_signal->period_us * 16, // base clk for PWM is 16 MHz + p_pwm_signal->duty_us * 16, // base clk for PWM is 16 MHz + &pulsewidth_set)) + { + p_pwm_driver = (((pwm_t*)obj->pwm_struct)->p_pwm_driver); + + const nrf_pwm_sequence_t seq = + { + .values.p_common = (nrf_pwm_values_common_t*) (((pwm_t*)obj->pwm_struct)->seq_values), + .length = 1, + .repeats = 0, + .end_delay = 0 + }; + + (((pwm_t*)obj->pwm_struct)->seq_values)[0] = pulsewidth_set.duty_hwu | 0x8000; + + if (new_period) + { + nrf_drv_pwm_config_t config0 = + { + .output_pins = + { + obj->pin | NRF_DRV_PWM_PIN_INVERTED, // channel 0 + NRF_DRV_PWM_PIN_NOT_USED, // channel 1 + NRF_DRV_PWM_PIN_NOT_USED, // channel 2 + NRF_DRV_PWM_PIN_NOT_USED, // channel 3 + }, + .irq_priority = PWM0_CONFIG_IRQ_PRIORITY, + .base_clock = pulsewidth_set.pwm_clk, + .count_mode = NRF_PWM_MODE_UP, + .top_value = pulsewidth_set.period_hwu, + .load_mode = NRF_PWM_LOAD_COMMON, + .step_mode = NRF_PWM_STEP_AUTO + }; + + if (!initialization) + { + nrf_drv_pwm_uninit(p_pwm_driver); + } + + ret_code = nrf_drv_pwm_init( p_pwm_driver, &config0, NULL); + + MBED_ASSERT(ret_code == NRF_SUCCESS); // assert if free instance was not found. + } + + nrf_drv_pwm_simple_playback(p_pwm_driver, &seq, 0, NRF_DRV_PWM_FLAG_LOOP); + } + else + { + MBED_ASSERT(0); // force assertion + } + +} + +#endif // DEVICE_PWMOUT diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.c new file mode 100644 index 0000000000..df4ec49659 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.c @@ -0,0 +1,350 @@ +/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + +#include +#include "nrf_drv_pwm.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" +#include "app_util_platform.h" + +#if (PWM_COUNT == 0) + #error "No PWM instances enabled in the driver configuration file." +#endif + + +// Control block - driver instance local data. +typedef struct +{ + nrf_drv_pwm_handler_t handler; + nrf_drv_state_t volatile state; +} pwm_control_block_t; +static pwm_control_block_t m_cb[PWM_COUNT]; + +static nrf_drv_pwm_config_t const m_default_config[PWM_COUNT] = { +#if PWM0_ENABLED + NRF_DRV_PWM_DEFAULT_CONFIG(0), +#endif +#if PWM1_ENABLED + NRF_DRV_PWM_DEFAULT_CONFIG(1), +#endif +#if PWM2_ENABLED + NRF_DRV_PWM_DEFAULT_CONFIG(2), +#endif +}; + + +static void configure_pins(nrf_drv_pwm_t const * const p_instance, + nrf_drv_pwm_config_t const * p_config) +{ + uint32_t out_pins[NRF_PWM_CHANNEL_COUNT]; + uint8_t i; + + for (i = 0; i < NRF_PWM_CHANNEL_COUNT; ++i) + { + uint8_t output_pin = p_config->output_pins[i]; + if (output_pin != NRF_DRV_PWM_PIN_NOT_USED) + { + bool inverted = output_pin & NRF_DRV_PWM_PIN_INVERTED; + out_pins[i] = output_pin & ~NRF_DRV_PWM_PIN_INVERTED; + + if (inverted) + { + nrf_gpio_pin_set(out_pins[i]); + } + else + { + nrf_gpio_pin_clear(out_pins[i]); + } + + nrf_gpio_cfg_output(out_pins[i]); + } + else + { + out_pins[i] = NRF_PWM_PIN_NOT_CONNECTED; + } + } + + nrf_pwm_pins_set(p_instance->p_registers, out_pins); +} + + +ret_code_t nrf_drv_pwm_init(nrf_drv_pwm_t const * const p_instance, + nrf_drv_pwm_config_t const * p_config, + nrf_drv_pwm_handler_t handler) +{ + pwm_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_config == NULL) + { + p_config = &m_default_config[p_instance->drv_inst_idx]; + } + + p_cb->handler = handler; + + configure_pins(p_instance, p_config); + + nrf_pwm_enable(p_instance->p_registers); + nrf_pwm_configure(p_instance->p_registers, + p_config->base_clock, p_config->count_mode, p_config->top_value); + nrf_pwm_decoder_set(p_instance->p_registers, + p_config->load_mode, p_config->step_mode); + + nrf_pwm_shorts_set(p_instance->p_registers, 0); + nrf_pwm_int_set(p_instance->p_registers, 0); + nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_LOOPSDONE); + nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_SEQEND0); + nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_SEQEND1); + nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_STOPPED); + + if (p_cb->handler) + { + nrf_drv_common_irq_enable(nrf_drv_get_IRQn(p_instance->p_registers), + p_config->irq_priority); + } + + p_cb->state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + + +void nrf_drv_pwm_uninit(nrf_drv_pwm_t const * const p_instance) +{ + pwm_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_instance->p_registers)); + + nrf_pwm_disable(p_instance->p_registers); + + p_cb->state = NRF_DRV_STATE_UNINITIALIZED; +} + + +static void start_playback(nrf_drv_pwm_t const * const p_instance, + pwm_control_block_t * p_cb, + uint8_t flags, + nrf_pwm_task_t starting_task) +{ + p_cb->state = NRF_DRV_STATE_POWERED_ON; + + if (p_cb->handler) + { + // The notification about finished playback is by default enabled, but + // this can be suppressed. The notification that the peripheral has been + // stopped is always enable. + uint32_t int_mask = NRF_PWM_INT_LOOPSDONE_MASK | + NRF_PWM_INT_STOPPED_MASK; + + if (flags & NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ0) + { + int_mask |= NRF_PWM_INT_SEQEND0_MASK; + } + if (flags & NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ1) + { + int_mask |= NRF_PWM_INT_SEQEND1_MASK; + } + if (flags & NRF_DRV_PWM_FLAG_NO_EVT_FINISHED) + { + int_mask &= ~NRF_PWM_INT_LOOPSDONE_MASK; + } + + nrf_pwm_int_set(p_instance->p_registers, int_mask); + } + + nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_STOPPED); + + nrf_pwm_task_trigger(p_instance->p_registers, starting_task); +} + + +void nrf_drv_pwm_simple_playback(nrf_drv_pwm_t const * const p_instance, + nrf_pwm_sequence_t const * p_sequence, + uint16_t playback_count, + uint32_t flags) +{ + pwm_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(playback_count > 0); + ASSERT(nrf_drv_is_in_RAM(p_sequence->values.p_raw)); + + // To take advantage of the looping mechanism, we need to use both sequences + // (single sequence can be played back only once). + nrf_pwm_sequence_set(p_instance->p_registers, 0, p_sequence); + nrf_pwm_sequence_set(p_instance->p_registers, 1, p_sequence); + bool odd = (playback_count & 1); + nrf_pwm_loop_set(p_instance->p_registers, playback_count/2 + (odd ? 1 : 0)); + + uint32_t shorts_mask; + if (flags & NRF_DRV_PWM_FLAG_STOP) + { + shorts_mask = NRF_PWM_SHORT_LOOPSDONE_STOP_MASK; + } + else if (flags & NRF_DRV_PWM_FLAG_LOOP) + { + shorts_mask = odd ? NRF_PWM_SHORT_LOOPSDONE_SEQSTART1_MASK + : NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK; + } + else + { + shorts_mask = 0; + } + nrf_pwm_shorts_set(p_instance->p_registers, shorts_mask); + + start_playback(p_instance, p_cb, flags, odd ? NRF_PWM_TASK_SEQSTART1 + : NRF_PWM_TASK_SEQSTART0); +} + + +void nrf_drv_pwm_complex_playback(nrf_drv_pwm_t const * const p_instance, + nrf_pwm_sequence_t const * p_sequence_0, + nrf_pwm_sequence_t const * p_sequence_1, + uint16_t playback_count, + uint32_t flags) +{ + pwm_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(playback_count > 0); + ASSERT(nrf_drv_is_in_RAM(p_sequence_0->values.p_raw)); + ASSERT(nrf_drv_is_in_RAM(p_sequence_1->values.p_raw)); + + nrf_pwm_sequence_set(p_instance->p_registers, 0, p_sequence_0); + nrf_pwm_sequence_set(p_instance->p_registers, 1, p_sequence_1); + nrf_pwm_loop_set(p_instance->p_registers, playback_count); + + uint32_t shorts_mask; + if (flags & NRF_DRV_PWM_FLAG_STOP) + { + shorts_mask = NRF_PWM_SHORT_LOOPSDONE_STOP_MASK; + } + else if (flags & NRF_DRV_PWM_FLAG_LOOP) + { + shorts_mask = NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK; + } + else + { + shorts_mask = 0; + } + nrf_pwm_shorts_set(p_instance->p_registers, shorts_mask); + + start_playback(p_instance, p_cb, flags, NRF_PWM_TASK_SEQSTART0); +} + + +bool nrf_drv_pwm_stop(nrf_drv_pwm_t const * const p_instance, + bool wait_until_stopped) +{ + ASSERT(m_cb[p_instance->drv_inst_idx].state != NRF_DRV_STATE_UNINITIALIZED); + + if (nrf_drv_pwm_is_stopped(p_instance)) + { + return true; + } + + nrf_pwm_task_trigger(p_instance->p_registers, NRF_PWM_TASK_STOP); + + do { + if (nrf_drv_pwm_is_stopped(p_instance)) + { + return true; + } + } while (wait_until_stopped); + + return false; +} + + +bool nrf_drv_pwm_is_stopped(nrf_drv_pwm_t const * const p_instance) +{ + pwm_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + // If the event handler is used (interrupts are enabled), the state will + // be changed in interrupt handler when the STOPPED event occurs. + if (p_cb->state != NRF_DRV_STATE_POWERED_ON) + { + return true; + } + // If interrupts are disabled, we must check the STOPPED event here. + if (nrf_pwm_event_check(p_instance->p_registers, NRF_PWM_EVENT_STOPPED)) + { + p_cb->state = NRF_DRV_STATE_INITIALIZED; + return true; + } + + return false; +} + + +static void irq_handler(NRF_PWM_Type * p_pwm, pwm_control_block_t * p_cb) +{ + ASSERT(p_cb->handler); + + // The SEQEND0 and SEQEND1 events are only handled when the user asked for + // it (by setting proper flags when starting the playback). + if (nrf_pwm_int_enable_check(p_pwm, NRF_PWM_INT_SEQEND0_MASK) && + nrf_pwm_event_check(p_pwm, NRF_PWM_EVENT_SEQEND0)) + { + nrf_pwm_event_clear(p_pwm, NRF_PWM_EVENT_SEQEND0); + p_cb->handler(NRF_DRV_PWM_EVT_END_SEQ0); + } + if (nrf_pwm_int_enable_check(p_pwm, NRF_PWM_INT_SEQEND1_MASK) && + nrf_pwm_event_check(p_pwm, NRF_PWM_EVENT_SEQEND1)) + { + nrf_pwm_event_clear(p_pwm, NRF_PWM_EVENT_SEQEND1); + p_cb->handler(NRF_DRV_PWM_EVT_END_SEQ1); + } + + // The LOOPSDONE event is handled by default, but this can be disabled. + if (nrf_pwm_int_enable_check(p_pwm, NRF_PWM_INT_LOOPSDONE_MASK) && + nrf_pwm_event_check(p_pwm, NRF_PWM_EVENT_LOOPSDONE)) + { + nrf_pwm_event_clear(p_pwm, NRF_PWM_EVENT_LOOPSDONE); + p_cb->handler(NRF_DRV_PWM_EVT_FINISHED); + } + + if (nrf_pwm_event_check(p_pwm, NRF_PWM_EVENT_STOPPED)) + { + nrf_pwm_event_clear(p_pwm, NRF_PWM_EVENT_STOPPED); + + p_cb->state = NRF_DRV_STATE_INITIALIZED; + + p_cb->handler(NRF_DRV_PWM_EVT_STOPPED); + } +} + + +#if PWM0_ENABLED +void PWM0_IRQHandler(void) +{ + irq_handler(NRF_PWM0, &m_cb[PWM0_INSTANCE_INDEX]); +} +#endif + +#if PWM1_ENABLED +void PWM1_IRQHandler(void) +{ + irq_handler(NRF_PWM1, &m_cb[PWM1_INSTANCE_INDEX]); +} +#endif + +#if PWM2_ENABLED +void PWM2_IRQHandler(void) +{ + irq_handler(NRF_PWM2, &m_cb[PWM2_INSTANCE_INDEX]); +} +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.h new file mode 100644 index 0000000000..f8b1c1bc97 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.h @@ -0,0 +1,426 @@ +/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + +/**@file + * @addtogroup nrf_pwm PWM HAL and driver + * @ingroup nrf_drivers + * @brief @tagAPI52 Pulse Width Modulation (PWM) module APIs. + * + * @defgroup nrf_drv_pwm PWM driver + * @{ + * @ingroup nrf_pwm + * @brief @tagAPI52 Pulse Width Modulation (PWM) module driver. + */ + + +#ifndef NRF_DRV_PWM_H__ +#define NRF_DRV_PWM_H__ + +#include "nordic_common.h" +#include "nrf_drv_config.h" +#include "nrf_pwm.h" +#include "sdk_errors.h" + + +/** + * @brief PWM driver instance data structure. + */ +typedef struct +{ + NRF_PWM_Type * p_registers; ///< Pointer to the structure with PWM peripheral instance registers. + uint8_t drv_inst_idx; ///< Driver instance index. +} nrf_drv_pwm_t; + +/** + * @brief Macro for creating a PWM driver instance. + */ +#define NRF_DRV_PWM_INSTANCE(id) \ +{ \ + .p_registers = CONCAT_2(NRF_PWM, id), \ + .drv_inst_idx = CONCAT_3(PWM, id, _INSTANCE_INDEX), \ +} + + +/** + * @brief This value can be provided instead of a pin number for any channel + * to specify that its output is not used and therefore does not need + * to be connected to a pin. + */ +#define NRF_DRV_PWM_PIN_NOT_USED 0xFF + +/** + * @brief This value can be added to a pin number to inverse its polarity + * (set idle state = 1). + */ +#define NRF_DRV_PWM_PIN_INVERTED 0x80 + +/** + * @brief PWM driver configuration structure. + */ +typedef struct +{ + uint8_t output_pins[NRF_PWM_CHANNEL_COUNT]; ///< Pin numbers for individual output channels (optional). + /**< Use @ref NRF_DRV_PWM_PIN_NOT_USED + * if a given output channel is not needed. */ + uint8_t irq_priority; ///< Interrupt priority. + nrf_pwm_clk_t base_clock; ///< Base clock frequency. + nrf_pwm_mode_t count_mode; ///< Operating mode of the pulse generator counter. + uint16_t top_value; ///< Value up to which the pulse generator counter counts. + nrf_pwm_dec_load_t load_mode; ///< Mode of loading sequence data from RAM. + nrf_pwm_dec_step_t step_mode; ///< Mode of advancing the active sequence. +} nrf_drv_pwm_config_t; + +/** + * @brief PWM driver default configuration. + */ +#define NRF_DRV_PWM_DEFAULT_CONFIG(id) \ +{ \ + .output_pins = { CONCAT_3(PWM, id, _CONFIG_OUT0_PIN), \ + CONCAT_3(PWM, id, _CONFIG_OUT1_PIN), \ + CONCAT_3(PWM, id, _CONFIG_OUT2_PIN), \ + CONCAT_3(PWM, id, _CONFIG_OUT3_PIN) }, \ + .irq_priority = CONCAT_3(PWM, id, _CONFIG_IRQ_PRIORITY), \ + .base_clock = CONCAT_3(PWM, id, _CONFIG_BASE_CLOCK), \ + .count_mode = CONCAT_3(PWM, id, _CONFIG_COUNT_MODE), \ + .top_value = CONCAT_3(PWM, id, _CONFIG_TOP_VALUE), \ + .load_mode = CONCAT_3(PWM, id, _CONFIG_LOAD_MODE), \ + .step_mode = CONCAT_3(PWM, id, _CONFIG_STEP_MODE), \ +} + + +/** + * @brief PWM flags providing additional playback options. + */ +typedef enum +{ + NRF_DRV_PWM_FLAG_STOP = 0x01, /**< When the requested playback is finished, + the peripheral should be stopped. + @note The STOP task is triggered when + the last value of the final sequence is + loaded from RAM, and the peripheral stops + at the end of the current PWM period. + For sequences with configured repeating + of duty cycle values, this might result in + less than the requested number of repeats + of the last value. */ + NRF_DRV_PWM_FLAG_LOOP = 0x02, /**< When the requested playback is finished, + it should be started from the beginning. + This flag is ignored if used together + with @ref NRF_DRV_PWM_FLAG_STOP. */ + NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ0 = 0x04, /**< The event handler should be + called when the last value + from sequence 0 is loaded. */ + NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ1 = 0x08, /**< The event handler should be + called when the last value + from sequence 1 is loaded. */ + NRF_DRV_PWM_FLAG_NO_EVT_FINISHED = 0x10, /**< The playback finished event + (enabled by default) should be + suppressed. */ +} nrf_drv_pwm_flag_t; + + +/** + * @brief PWM driver event type. + */ +typedef enum +{ + NRF_DRV_PWM_EVT_FINISHED, ///< Sequence playback finished. + NRF_DRV_PWM_EVT_END_SEQ0, /**< End of sequence 0 reached. Its data can be + safely modified now. */ + NRF_DRV_PWM_EVT_END_SEQ1, /**< End of sequence 1 reached. Its data can be + safely modified now. */ + NRF_DRV_PWM_EVT_STOPPED, ///< The PWM peripheral has been stopped. +} nrf_drv_pwm_evt_type_t; + +/** + * @brief PWM driver event handler type. + */ +typedef void (* nrf_drv_pwm_handler_t)(nrf_drv_pwm_evt_type_t event_type); + + +/** + * @brief Function for initializing the PWM driver. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_config Pointer to the structure with initial configuration. + * If NULL, the default configuration is used. + * @param[in] handler Event handler provided by the user. If NULL is passed + * instead, event notifications are not done and PWM + * interrupts are disabled. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver was already initialized. + */ +ret_code_t nrf_drv_pwm_init(nrf_drv_pwm_t const * const p_instance, + nrf_drv_pwm_config_t const * p_config, + nrf_drv_pwm_handler_t handler); + +/** + * @brief Function for uninitializing the PWM driver. + * + * If any sequence playback is in progress, it is stopped immediately. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_pwm_uninit(nrf_drv_pwm_t const * const p_instance); + +/** + * @brief Function for starting a single sequence playback. + * + * To take advantage of the looping mechanism in the PWM peripheral, both + * sequences must be used (single sequence can be played back only once by + * the peripheral). Therefore, the provided sequence is internally set and + * played back as both sequence 0 and sequence 1. Consequently, if end of + * sequence notifications are required, events for both sequences should be + * used (that means that both the @ref NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ0 flag + * and the @ref NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ1 flag should be specified and + * the @ref NRF_DRV_PWM_EVT_END_SEQ0 event and the @ref NRF_DRV_PWM_EVT_END_SEQ1 + * event should be handled in the same way). + * + * @note The array containing the duty cycle values for the specified sequence + * must be in RAM and cannot be allocated on stack. + * For detailed information, see @ref nrf_pwm_sequence_t. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_sequence Sequence to be played back. + * @param[in] playback_count Number of playbacks to be performed (must not be 0). + * @param[in] flags Additional options. Pass any combination of + * @ref nrf_drv_pwm_flag_t "playback flags", or 0 + * for default settings. + */ +void nrf_drv_pwm_simple_playback(nrf_drv_pwm_t const * const p_instance, + nrf_pwm_sequence_t const * p_sequence, + uint16_t playback_count, + uint32_t flags); + +/** + * @brief Function for starting a two-sequence playback. + * + * @note The array containing the duty cycle values for the specified sequence + * must be in RAM and cannot be allocated on stack. + * For detailed information, see @ref nrf_pwm_sequence_t. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_sequence_0 First sequence to be played back. + * @param[in] p_sequence_1 Second sequence to be played back. + * @param[in] playback_count Number of playbacks to be performed (must not be 0). + * @param[in] flags Additional options. Pass any combination of + * @ref nrf_drv_pwm_flag_t "playback flags", or 0 + * for default settings. + */ +void nrf_drv_pwm_complex_playback(nrf_drv_pwm_t const * const p_instance, + nrf_pwm_sequence_t const * p_sequence_0, + nrf_pwm_sequence_t const * p_sequence_1, + uint16_t playback_count, + uint32_t flags); + +/** + * @brief Function for advancing the active sequence. + * + * This function only applies to @ref NRF_PWM_STEP_TRIGGERED mode. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +__STATIC_INLINE void nrf_drv_pwm_step(nrf_drv_pwm_t const * const p_instance); + +/** + * @brief Function for stopping the sequence playback. + * + * The playback is stopped at the end of the current PWM period. + * This means that if the active sequence is configured to repeat each duty + * cycle value for a certain number of PWM periods, the last played value + * might appear on the output less times than requested. + * + * @note This function can be instructed to wait until the playback is stopped + * (by setting @p wait_until_stopped to true). Note that, depending on + * the length of the PMW period, this might take a significant amount of + * time. Alternatively, the @ref nrf_drv_pwm_is_stopped function can be + * used to poll the status, or the @ref NRF_DRV_PWM_EVT_STOPPED event can + * be used to get the notification when the playback is stopped, provided + * the event handler is defined. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] wait_until_stopped If true, the function will not return until + * the playback is stopped. + * + * @retval true If the PWM peripheral is stopped. + * @retval false If the PWM peripheral is not stopped. + */ +bool nrf_drv_pwm_stop(nrf_drv_pwm_t const * const p_instance, + bool wait_until_stopped); + +/** + * @brief Function for checking the status of the PWM peripheral. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval true If the PWM peripheral is stopped. + * @retval false If the PWM peripheral is not stopped. + */ +bool nrf_drv_pwm_is_stopped(nrf_drv_pwm_t const * const p_instance); + +/** + * @brief Function for updating the sequence data during playback. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] p_sequence Pointer to the new sequence definition. + */ +__STATIC_INLINE void nrf_drv_pwm_sequence_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + nrf_pwm_sequence_t const * p_sequence); + +/** + * @brief Function for updating the pointer to the duty cycle values + * in the specified sequence during playback. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] values New pointer to the duty cycle values. + */ +__STATIC_INLINE void nrf_drv_pwm_sequence_values_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + nrf_pwm_values_t values); + +/** + * @brief Function for updating the number of duty cycle values + * in the specified sequence during playback. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] length New number of the duty cycle values. + */ +__STATIC_INLINE void nrf_drv_pwm_sequence_length_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + uint16_t length); + +/** + * @brief Function for updating the number of repeats for duty cycle values + * in specified sequence during playback. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] repeats New number of repeats. + */ +__STATIC_INLINE void nrf_drv_pwm_sequence_repeats_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + uint32_t repeats); + +/** + * @brief Function for updating the additional delay after the specified + * sequence during playback. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] end_delay New end delay value (in PWM periods). + */ +__STATIC_INLINE void nrf_drv_pwm_sequence_end_delay_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + uint32_t end_delay); + +/** + * @brief Function for returning the address of a specified PWM task that can + * be used in PPI module. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] task Requested task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_pwm_task_address_get( + nrf_drv_pwm_t const * const p_instance, + nrf_pwm_task_t task); + +/**@brief Function for returning the address of a specified PWM event that can + * be used in PPI module. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] event Requested event. + * + * @return Event address. + */ +__STATIC_INLINE uint32_t nrf_drv_pwm_event_address_get( + nrf_drv_pwm_t const * const p_instance, + nrf_pwm_event_t event); + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_drv_pwm_step(nrf_drv_pwm_t const * const p_instance) +{ + nrf_pwm_task_trigger(p_instance->p_registers, NRF_PWM_TASK_NEXTSTEP); +} + +__STATIC_INLINE void nrf_drv_pwm_sequence_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + nrf_pwm_sequence_t const * p_sequence) +{ + nrf_pwm_sequence_set(p_instance->p_registers, seq_id, p_sequence); +} + +__STATIC_INLINE void nrf_drv_pwm_sequence_values_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + nrf_pwm_values_t values) +{ + nrf_pwm_seq_ptr_set(p_instance->p_registers, seq_id, values.p_raw); +} + +__STATIC_INLINE void nrf_drv_pwm_sequence_length_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + uint16_t length) +{ + nrf_pwm_seq_cnt_set(p_instance->p_registers, seq_id, length); +} + +__STATIC_INLINE void nrf_drv_pwm_sequence_repeats_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + uint32_t repeats) +{ + nrf_pwm_seq_refresh_set(p_instance->p_registers, seq_id, repeats); +} + +__STATIC_INLINE void nrf_drv_pwm_sequence_end_delay_update( + nrf_drv_pwm_t const * const p_instance, + uint8_t seq_id, + uint32_t end_delay) +{ + nrf_pwm_seq_end_delay_set(p_instance->p_registers, seq_id, end_delay); +} + +__STATIC_INLINE uint32_t nrf_drv_pwm_task_address_get( + nrf_drv_pwm_t const * const p_instance, + nrf_pwm_task_t task) +{ + return nrf_pwm_task_address_get(p_instance->p_registers, task); +} + +__STATIC_INLINE uint32_t nrf_drv_pwm_event_address_get( + nrf_drv_pwm_t const * const p_instance, + nrf_pwm_event_t event) +{ + return nrf_pwm_event_address_get(p_instance->p_registers, event); +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_DRV_PWM_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.c new file mode 100644 index 0000000000..0412f1bcdf --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.c @@ -0,0 +1,536 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "nrf_drv_saadc.h" +#include "nrf_assert.h" +#include "nordic_common.h" +#include "nrf_drv_common.h" +#include "app_util_platform.h" + + +typedef enum +{ + NRF_SAADC_STATE_IDLE = 0, + NRF_SAADC_STATE_BUSY = 1 +} nrf_saadc_state_t; + + +typedef struct +{ + nrf_saadc_input_t pselp; + nrf_saadc_input_t pseln; +} nrf_saadc_psel_buffer; + +static const nrf_drv_saadc_config_t m_default_config = NRF_DRV_SAADC_DEFAULT_CONFIG; + +/** @brief SAADC control block.*/ +typedef struct +{ + nrf_drv_saadc_event_handler_t event_handler; ///< Event handler function pointer. + volatile nrf_saadc_value_t * p_buffer; ///< Sample buffer. + volatile uint16_t buffer_size; ///< Size of the sample buffer. +#ifdef NRF52_PAN_28 + volatile uint16_t buffer_pos; ///< Current sample buffer position. +#endif + volatile nrf_saadc_value_t * p_secondary_buffer; ///< Secondary sample buffer. + uint32_t limits_enabled_flags; ///< Enabled limits flags. + uint16_t secondary_buffer_size; ///< Size of the secondary buffer. + nrf_saadc_psel_buffer psel[NRF_SAADC_CHANNEL_COUNT]; ///< Pin configurations of SAADC channels. + nrf_drv_state_t state; ///< Driver initialization state. + nrf_saadc_state_t adc_state; ///< State of the SAADC. +#ifdef NRF52_PAN_28 + uint8_t scan_pos; ///< Current channel scanning position. +#endif + uint8_t active_channels; ///< Number of enabled SAADC channels. +} nrf_drv_saadc_cb_t; + +static nrf_drv_saadc_cb_t m_cb; + +#define LOW_LIMIT_TO_FLAG(channel) ((2*channel+1)) +#define HIGH_LIMIT_TO_FLAG(channel) ((2*channel)) +#define FLAG_IDX_TO_EVENT(idx) ((nrf_saadc_event_t)((uint32_t)NRF_SAADC_EVENT_CH0_LIMITH+4*idx)) +#define LIMIT_EVENT_TO_CHANNEL(event)(uint8_t)(((uint32_t)event-(uint32_t)NRF_SAADC_EVENT_CH0_LIMITH)/8) +#define LIMIT_EVENT_TO_LIMIT_TYPE(event)((((uint32_t)event-(uint32_t)NRF_SAADC_EVENT_CH0_LIMITH) & 4) ? \ + NRF_SAADC_LIMIT_LOW : NRF_SAADC_LIMIT_HIGH) +#define HW_TIMEOUT 10000 + + +void SAADC_IRQHandler(void) +{ + if (nrf_saadc_event_check(NRF_SAADC_EVENT_END)) + { + nrf_saadc_event_clear(NRF_SAADC_EVENT_END); +#ifdef NRF52_PAN_28 + if (m_cb.active_channels == 1) + { +#endif + nrf_drv_saadc_evt_t evt; + evt.type = NRF_DRV_SAADC_EVT_DONE; + evt.data.done.p_buffer = (nrf_saadc_value_t *)m_cb.p_buffer; + evt.data.done.size = nrf_saadc_amount_get(); + + if (m_cb.p_secondary_buffer == NULL) + { + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + } + else + { + m_cb.p_buffer = m_cb.p_secondary_buffer; + m_cb.buffer_size = m_cb.secondary_buffer_size; + m_cb.p_secondary_buffer = NULL; + nrf_saadc_task_trigger(NRF_SAADC_TASK_START); + } + + m_cb.event_handler(&evt); +#ifdef NRF52_PAN_28 + } + else + { + //PAN-28: scan mode is not working correctly, emulated by interrupts + ++(m_cb.buffer_pos); + uint16_t buffer_pos = m_cb.buffer_pos; + if (buffer_pos == m_cb.buffer_size) + { + nrf_drv_saadc_evt_t evt; + evt.type = NRF_DRV_SAADC_EVT_DONE; + evt.data.done.p_buffer = (nrf_saadc_value_t *)(m_cb.p_buffer); + evt.data.done.size = m_cb.buffer_size; + + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + if (m_cb.p_secondary_buffer == NULL) + { + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + } + else + { + (void)nrf_drv_saadc_buffer_convert((nrf_saadc_value_t *)m_cb.p_secondary_buffer, (uint16_t)m_cb.secondary_buffer_size); + } + m_cb.event_handler(&evt); + } + else + { + uint8_t current_scan_pos = m_cb.scan_pos; + + nrf_saadc_channel_input_set(current_scan_pos, + NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); + + nrf_saadc_buffer_init((nrf_saadc_value_t *)(m_cb.p_buffer + m_cb.buffer_pos), 1); + // Find the next enabled channel. + for (++m_cb.scan_pos; m_cb.scan_pos < NRF_SAADC_CHANNEL_COUNT; ++m_cb.scan_pos) + { + if (m_cb.psel[m_cb.scan_pos].pselp) + { + nrf_saadc_channel_input_set(m_cb.scan_pos, + m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln); + nrf_saadc_task_trigger(NRF_SAADC_TASK_START); + nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); + return; + } + } + //if scanning is done prepare for next round. + for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i) + { + if (m_cb.psel[i].pselp) + { + m_cb.scan_pos = i; + break; + } + } + nrf_saadc_channel_input_set(m_cb.scan_pos, + m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln); + nrf_saadc_task_trigger(NRF_SAADC_TASK_START); + } + } +#endif + } + if (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED)) + { + nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED); + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + } + else + { + uint32_t limit_flags = m_cb.limits_enabled_flags; + uint32_t flag_idx; + nrf_saadc_event_t event; + while (limit_flags) + { + flag_idx = __CLZ(limit_flags); + limit_flags &= ~((1UL<<31) >> flag_idx); + event = FLAG_IDX_TO_EVENT(flag_idx); + if (nrf_saadc_event_check(event)) + { + nrf_saadc_event_clear(event); + nrf_drv_saadc_evt_t evt; + evt.type = NRF_DRV_SAADC_EVT_LIMIT; + evt.data.limit.channel = LIMIT_EVENT_TO_CHANNEL(event); + evt.data.limit.limit_type = LIMIT_EVENT_TO_LIMIT_TYPE(event); + m_cb.event_handler(&evt); + } + } + } +} + + +ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config, + nrf_drv_saadc_event_handler_t event_handler) +{ + if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + if (event_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + m_cb.event_handler = event_handler; + nrf_saadc_resolution_set(p_config->resolution); + nrf_saadc_oversample_set(p_config->oversample); + m_cb.state = NRF_DRV_STATE_INITIALIZED; + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + m_cb.active_channels = 0; + m_cb.limits_enabled_flags = 0; +#ifdef NRF52_PAN_28 + m_cb.buffer_pos = 0; +#endif + + nrf_saadc_int_disable(NRF_SAADC_INT_ALL); + nrf_saadc_event_clear(NRF_SAADC_EVENT_END); + nrf_drv_common_irq_enable(SAADC_IRQn, p_config->interrupt_priority); + nrf_saadc_int_enable(NRF_SAADC_INT_END); + + nrf_saadc_enable(); + + return NRF_SUCCESS; +} + + +void nrf_drv_saadc_uninit(void) +{ + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + nrf_drv_common_irq_disable(SAADC_IRQn); + nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP); + + // Wait for ADC being stopped. + uint32_t timeout = HW_TIMEOUT; + while (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED) == 0 && timeout > 0) + { + --timeout; + } + ASSERT(timeout > 0); + + nrf_saadc_disable(); + nrf_saadc_int_disable(NRF_SAADC_INT_ALL); + + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + + for (uint8_t channel = 0; channel < NRF_SAADC_CHANNEL_COUNT; ++channel) + { + if (m_cb.psel[channel].pselp != NRF_SAADC_INPUT_DISABLED) + { + (void)nrf_drv_saadc_channel_uninit(channel); + } + } + + m_cb.state = NRF_DRV_STATE_UNINITIALIZED; +} + + +ret_code_t nrf_drv_saadc_channel_init(uint8_t channel, + nrf_saadc_channel_config_t const * const p_config) +{ + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(channel < NRF_SAADC_CHANNEL_COUNT); + //Oversampling can be used only with one channel. + ASSERT((nrf_saadc_oversample_get()==NRF_SAADC_OVERSAMPLE_DISABLED) || (m_cb.active_channels == 0)); + ASSERT((p_config->pin_p <= NRF_SAADC_INPUT_VDD) && (p_config->pin_p > NRF_SAADC_INPUT_DISABLED)); + ASSERT(p_config->pin_n <= NRF_SAADC_INPUT_VDD); + + // A channel can only be initialized if the driver is in the idle state. + if (m_cb.adc_state == NRF_SAADC_STATE_BUSY) + { + return NRF_ERROR_BUSY; + } + + if (!m_cb.psel[channel].pselp) + { + ++m_cb.active_channels; + } + m_cb.psel[channel].pselp = p_config->pin_p; + m_cb.psel[channel].pseln = p_config->pin_n; + nrf_saadc_channel_init(channel, p_config); + +#ifdef NRF52_PAN_28 + nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); +#else + nrf_saadc_channel_input_set(channel, p_config->pin_p, p_config->pin_n); +#endif + return NRF_SUCCESS; +} + + +ret_code_t nrf_drv_saadc_channel_uninit(uint8_t channel) +{ + ASSERT(channel <= NRF_SAADC_CHANNEL_COUNT) + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + + // A channel can only be uninitialized if the driver is in the idle state. + if (m_cb.adc_state == NRF_SAADC_STATE_BUSY) + { + return NRF_ERROR_BUSY; + } + + if (m_cb.psel[channel].pselp) + { + --m_cb.active_channels; + } + m_cb.psel[channel].pselp = NRF_SAADC_INPUT_DISABLED; + m_cb.psel[channel].pseln = NRF_SAADC_INPUT_DISABLED; + nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); + nrf_drv_saadc_limits_set(channel, NRF_DRV_SAADC_LIMITL_DISABLED, NRF_DRV_SAADC_LIMITH_DISABLED); + + return NRF_SUCCESS; +} + +ret_code_t nrf_drv_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_value) +{ + if (m_cb.adc_state != NRF_SAADC_STATE_IDLE) + { + return NRF_ERROR_BUSY; + } + m_cb.adc_state = NRF_SAADC_STATE_BUSY; + nrf_saadc_int_disable(NRF_SAADC_INT_END); + nrf_saadc_buffer_init(p_value, 1); +#ifndef NRF52_PAN_28 + if (m_cb.active_channels > 1) + { + for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i) + { + nrf_saadc_channel_input_set(i, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); + } + } +#endif + nrf_saadc_channel_input_set(channel, + m_cb.psel[channel].pselp, m_cb.psel[channel].pseln); + nrf_saadc_task_trigger(NRF_SAADC_TASK_START); + nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); + + uint32_t timeout = HW_TIMEOUT; + while (0 == nrf_saadc_event_check(NRF_SAADC_EVENT_END) && timeout > 0) + { + timeout--; + } + nrf_saadc_event_clear(NRF_SAADC_EVENT_END); + +#ifdef NRF52_PAN_28 + nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); +#else + if (m_cb.active_channels > 1) + { + for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i) + { + nrf_saadc_channel_input_set(i, m_cb.psel[i].pselp, m_cb.psel[i].pseln); + } + } +#endif + + nrf_saadc_int_enable(NRF_SAADC_INT_END); + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + + return NRF_SUCCESS; +} + +ret_code_t nrf_drv_saadc_buffer_convert(nrf_saadc_value_t * p_buffer, uint16_t size) +{ + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_saadc_int_disable(NRF_SAADC_INT_END); + if (m_cb.adc_state == NRF_SAADC_STATE_BUSY) + { + if ( m_cb.p_secondary_buffer) + { + nrf_saadc_int_enable(NRF_SAADC_INT_END); + return NRF_ERROR_BUSY; + } + else + { + m_cb.p_secondary_buffer = p_buffer; + m_cb.secondary_buffer_size = size; +#ifdef NRF52_PAN_28 + if (m_cb.active_channels == 1) +#endif + { + while (nrf_saadc_event_check(NRF_SAADC_EVENT_STARTED) == 0); + nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED); + nrf_saadc_buffer_init(p_buffer, size); + } + nrf_saadc_int_enable(NRF_SAADC_INT_END); + return NRF_SUCCESS; + } + } + nrf_saadc_int_enable(NRF_SAADC_INT_END); + m_cb.adc_state = NRF_SAADC_STATE_BUSY; + +#ifdef NRF52_PAN_28 + m_cb.scan_pos = NRF_SAADC_CHANNEL_COUNT; + for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i) + { + if (m_cb.psel[i].pselp) + { + m_cb.scan_pos = i; + break; + } + } + + // Find the first enabled channel. + if (m_cb.scan_pos >= NRF_SAADC_CHANNEL_COUNT) + { + return NRF_ERROR_INVALID_STATE; + } + + m_cb.buffer_pos = 0; +#endif + m_cb.p_buffer = p_buffer; + m_cb.buffer_size = size; + m_cb.p_secondary_buffer = NULL; + +#ifdef NRF52_PAN_28 + nrf_saadc_channel_input_set(m_cb.scan_pos, + m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln); + + if (m_cb.active_channels == 1) + { + nrf_saadc_buffer_init(p_buffer, size); + } + else + { + nrf_saadc_buffer_init(p_buffer, 1); + } +#else + nrf_saadc_buffer_init(p_buffer, size); +#endif + + nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED); + nrf_saadc_task_trigger(NRF_SAADC_TASK_START); + + return NRF_SUCCESS; +} + +ret_code_t nrf_drv_saadc_sample() +{ + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + + ret_code_t err_code = NRF_SUCCESS; + if (m_cb.adc_state == NRF_SAADC_STATE_IDLE) + { + err_code = NRF_ERROR_BUSY; + } + else + { + nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); + } + + return err_code; +} + + +bool nrf_drv_saadc_is_busy(void) +{ + return (m_cb.adc_state == NRF_SAADC_STATE_BUSY); +} + +void nrf_drv_saadc_abort(void) +{ + if (nrf_drv_saadc_is_busy()) + { + nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED); + nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP); + + // Wait for ADC being stopped. + uint32_t timeout = HW_TIMEOUT; + while ((m_cb.adc_state != NRF_SAADC_STATE_IDLE) && (timeout > 0)) + { + --timeout; + } + ASSERT(timeout > 0); + + m_cb.p_buffer = 0; + m_cb.p_secondary_buffer = 0; + } +} + +void nrf_drv_saadc_limits_set(uint8_t channel, int16_t limit_low, int16_t limit_high) +{ + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(m_cb.event_handler); // only non blocking mode supported + ASSERT(limit_low>=NRF_DRV_SAADC_LIMITL_DISABLED); + ASSERT(limit_high<=NRF_DRV_SAADC_LIMITH_DISABLED); + ASSERT(limit_low> LOW_LIMIT_TO_FLAG(channel)); + nrf_saadc_int_disable(int_mask); + } + else + { + m_cb.limits_enabled_flags |= (0x80000000 >> LOW_LIMIT_TO_FLAG(channel)); + nrf_saadc_int_enable(int_mask); + } + + int_mask = nrf_saadc_limit_int_get(channel, NRF_SAADC_LIMIT_HIGH); + if (limit_high == NRF_DRV_SAADC_LIMITH_DISABLED) + { + m_cb.limits_enabled_flags &= ~(0x80000000 >> HIGH_LIMIT_TO_FLAG(channel)); + nrf_saadc_int_disable(int_mask); + } + else + { + m_cb.limits_enabled_flags |= (0x80000000 >> HIGH_LIMIT_TO_FLAG(channel)); + nrf_saadc_int_enable(int_mask); + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.h new file mode 100644 index 0000000000..661177c424 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.h @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @addtogroup nrf_saadc SAADC HAL and driver + * @ingroup nrf_drivers + * @brief @tagAPI52 Successive Approximation Analog-to-Digital Converter (SAADC) APIs. + * @details The SAADC HAL provides basic APIs for accessing the registers of the SAADC peripheral. + * The SAADC driver provides APIs on a higher level. + * + * @defgroup nrf_drv_saadc SAADC driver + * @{ + * @ingroup nrf_saadc + * + * @brief @tagAPI52 Successive Approximation Analog-to-Digital Converter (SAADC) driver. + */ + +#ifndef NRF_DRV_SAADC_H__ +#define NRF_DRV_SAADC_H__ + +#include "nrf_drv_config.h" +#include "nrf_saadc.h" +#include "sdk_errors.h" + +/** + * @brief Value that should be set as high limit to disable limit detection. + */ +#define NRF_DRV_SAADC_LIMITH_DISABLED (2047) +/** + * @brief Value that should be set as low limit to disable limit detection. + */ +#define NRF_DRV_SAADC_LIMITL_DISABLED (-2048) + +/** + * @brief Macro for setting @ref nrf_drv_saadc_config_t to default settings. + */ +#define NRF_DRV_SAADC_DEFAULT_CONFIG \ +{ \ + .resolution = SAADC_CONFIG_RESOLUTION, \ + .oversample = SAADC_CONFIG_OVERSAMPLE, \ + .interrupt_priority = SAADC_CONFIG_IRQ_PRIORITY \ +} + +/** + * @brief Macro for setting @ref nrf_saadc_channel_config_t to default settings + * in single ended mode. + * + * @param PIN_P Analog input. + */ +#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P) \ +{ \ + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \ + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \ + .gain = NRF_SAADC_GAIN1_6, \ + .reference = NRF_SAADC_REFERENCE_INTERNAL, \ + .acq_time = NRF_SAADC_ACQTIME_10US, \ + .mode = NRF_SAADC_MODE_SINGLE_ENDED, \ + .pin_p = (nrf_saadc_input_t)(PIN_P), \ + .pin_n = NRF_SAADC_INPUT_DISABLED \ +} + +/** + * @brief Macro for setting @ref nrf_saadc_channel_config_t to default settings + * in differential mode. + * + * @param PIN_P Positive analog input. + * @param PIN_N Negative analog input. + */ +#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(PIN_P, PIN_N) \ +{ \ + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \ + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \ + .gain = NRF_SAADC_GAIN1_6, \ + .reference = NRF_SAADC_REFERENCE_INTERNAL, \ + .acq_time = NRF_SAADC_ACQTIME_10US, \ + .mode = NRF_SAADC_MODE_DIFFERENTIAL, \ + .pin_p = (nrf_saadc_input_t)(PIN_P), \ + .pin_n = (nrf_saadc_input_t)(PIN_N) \ +} + +/** + * @brief Analog-to-digital converter driver configuration structure. + */ +typedef struct +{ + nrf_saadc_resolution_t resolution; ///< Resolution configuration. + nrf_saadc_oversample_t oversample; ///< Oversampling configuration. + uint8_t interrupt_priority; ///< Interrupt priority. +} nrf_drv_saadc_config_t; + +/** + * @brief Driver event types. + */ +typedef enum +{ + NRF_DRV_SAADC_EVT_DONE, ///< Event generated when the buffer is filled with samples. + NRF_DRV_SAADC_EVT_LIMIT, ///< Event generated after one of the limits is reached. +} nrf_drv_saadc_evt_type_t; + +/** + * @brief Analog-to-digital converter driver done event data. + */ +typedef struct +{ + nrf_saadc_value_t * p_buffer; ///< Pointer to buffer with converted samples. + uint16_t size; ///< Number of samples in the buffer. +} nrf_drv_saadc_done_evt_t; + +/** + * @brief Analog-to-digital converter driver limit event data. + */ +typedef struct +{ + uint8_t channel; ///< Channel on which the limit was detected. + nrf_saadc_limit_t limit_type; ///< Type of limit detected. +} nrf_drv_saadc_limit_evt_t; + +/** + * @brief Analog-to-digital converter driver event structure. + */ +typedef struct +{ + nrf_drv_saadc_evt_type_t type; ///< Event type. + union + { + nrf_drv_saadc_done_evt_t done; ///< Data for @ref NRF_DRV_SAADC_EVT_DONE event. + nrf_drv_saadc_limit_evt_t limit;///< Data for @ref NRF_DRV_SAADC_EVT_LIMIT event. + } data; +} nrf_drv_saadc_evt_t; + +/** + * @brief ADC event handler. + * + * @param[in] p_event Pointer to an ADC event. The event structure is allocated on + * the stack, so it is valid only within the context of + * the event handler. + */ +typedef void (*nrf_drv_saadc_event_handler_t)(nrf_drv_saadc_evt_t const * p_event); + +/** + * @brief Function for initializing the SAADC. + * + * @param[in] p_config Pointer to a configuration structure. If NULL, the default one is used. + * @param[in] event_handler Event handler provided by the user. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver is already initialized. + * @retval NRF_ERROR_INVALID_PARAM If event_handler is NULL. + */ +ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config, + nrf_drv_saadc_event_handler_t event_handler); + +/** + * @brief Function for uninitializing the SAADC. + * + * This function stops all ongoing conversions and disables all channels. + */ +void nrf_drv_saadc_uninit(void); + +/** + * @brief Function for getting the address of a SAMPLE SAADC task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_saadc_sample_task_get(void) +{ + return nrf_saadc_task_address_get(NRF_SAADC_TASK_SAMPLE); +} + + +/** + * @brief Function for initializing an SAADC channel. + * + * This function configures and enables the channel. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the ADC was not initialized. + * @retval NRF_ERROR_NO_MEM If the specified channel was already allocated. + */ +ret_code_t nrf_drv_saadc_channel_init(uint8_t channel, + nrf_saadc_channel_config_t const * const p_config); + + +/** + * @brief Function for uninitializing an SAADC channel. + * + * @retval NRF_SUCCESS If uninitialization was successful. + * @retval NRF_ERROR_BUSY If the ADC is busy. + */ +ret_code_t nrf_drv_saadc_channel_uninit(uint8_t channel); + +/** + * @brief Function for starting SAADC sampling. + * + * @retval NRF_SUCCESS If ADC sampling was triggered. + * @retval NRF_ERROR_BUSY If ADC is in idle state. + */ +ret_code_t nrf_drv_saadc_sample(void); + +/** + * @brief Blocking function for executing a single ADC conversion. + * + * This function selects the desired input, starts a single conversion, + * waits for it to finish, and returns the result. + * + * The function will fail if ADC is busy. + * + * @param[in] channel Channel. + * @param[out] p_value Pointer to the location where the result should be placed. + * + * @retval NRF_SUCCESS If conversion was successful. + * @retval NRF_ERROR_BUSY If the ADC driver is busy. + */ +ret_code_t nrf_drv_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_value); + +/** + * @brief Function for issuing conversion of data to the buffer. + * + * This function is non-blocking. The application is notified about filling the buffer by the event handler. + * Conversion will be done on all enabled channels. If the ADC is in idle state, the function will set up Easy + * DMA for the conversion. The ADC will be ready for sampling and wait for the SAMPLE task. It can be + * triggered manually by the @ref nrf_drv_saadc_sample function or by PPI using the @ref NRF_SAADC_TASK_SAMPLE + * task. If one buffer is already set and the conversion is ongoing, calling this function will + * result in queuing the given buffer. The driver will start filling the issued buffer when the first one is + * completed. If the function is called again before the first buffer is filled, it will return with error. + * + * @param[in] buffer Result buffer. + * @param[in] size Buffer size in words. + * + * @retval NRF_SUCCESS If conversion was successful. + * @retval NRF_ERROR_BUSY If the driver already has two buffers set. + */ +ret_code_t nrf_drv_saadc_buffer_convert(nrf_saadc_value_t * buffer, uint16_t size); + +/** + * @brief Function for retrieving the SAADC state. + * + * @retval true If the ADC is busy. + * @retval false If the ADC is ready. + */ +bool nrf_drv_saadc_is_busy(void); + +/** + * @brief Function for aborting ongoing and buffered conversions. + * @note @ref NRF_DRV_SAADC_EVT_DONE event will be generated if there is a conversion in progress. + * Event will contain number of words in the sample buffer. + */ +void nrf_drv_saadc_abort(void); + +/** + * @brief Function for setting the SAADC channel limits. + * When limits are enabled and the result exceeds the defined bounds, the limit handler function is called. + * + * @param[in] channel SAADC channel number. + * @param[in] limit_low Lower limit (valid values from @ref NRF_DRV_SAADC_LIMITL_DISABLED to + * @ref NRF_DRV_SAADC_LIMITH_DISABLED). Conversion results below this value will trigger + * the handler function. Set to @ref NRF_DRV_SAADC_LIMITL_DISABLED to disable this limit. + * @param[in] limit_high Upper limit (valid values from @ref NRF_DRV_SAADC_LIMITL_DISABLED to + * @ref NRF_DRV_SAADC_LIMITH_DISABLED). Conversion results above this value will trigger + * the handler function. Set to @ref NRF_DRV_SAADC_LIMITH_DISABLED to disable this limit. + */ +void nrf_drv_saadc_limits_set(uint8_t channel, int16_t limit_low, int16_t limit_high); + +/** + * @brief Function for converting a GPIO pin number to an analog input pin number used in the channel + * configuration. + * + * @param[in] pin GPIO pin. + * + * @return Value representing an analog input pin. The function returns @ref NRF_SAADC_INPUT_DISABLED + * if the specified pin is not an analog input. + */ +__STATIC_INLINE nrf_saadc_input_t nrf_drv_saadc_gpio_to_ain(uint32_t pin) +{ + // AIN0 - AIN3 + if (pin >= 2 && pin <= 5) + { + //0 means "not connected", hence this "+ 1" + return (nrf_saadc_input_t)(pin - 2 + 1); + } + // AIN4 - AIN7 + else if (pin >= 28 && pin <= 31) + { + return (nrf_saadc_input_t)(pin - 24 + 1); + } + else + { + return NRF_SAADC_INPUT_DISABLED; + } +} + +#endif // NRF_DRV_SAADC_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/nrf_drv_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/nrf_drv_config.h new file mode 100644 index 0000000000..4443e68e64 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/nrf_drv_config.h @@ -0,0 +1,495 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_DRV_CONFIG_H +#define NRF_DRV_CONFIG_H + +/** + * Provide a non-zero value here in applications that need to use several + * peripherals with the same ID that are sharing certain resources + * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used + * simultaneously. Therefore, this definition allows to initialize the driver + * for another peripheral from a given group only after the previously used one + * is uninitialized. Normally, this is not possible, because interrupt handlers + * are implemented in individual drivers. + * This functionality requires a more complicated interrupt handling and driver + * initialization, hence it is not always desirable to use it. + */ +#define PERIPHERAL_RESOURCE_SHARING_ENABLED 1 + +/* CLOCK */ +#define CLOCK_ENABLED 1 + +#if (CLOCK_ENABLED == 1) +#define CLOCK_CONFIG_XTAL_FREQ NRF_CLOCK_XTALFREQ_Default +#define CLOCK_CONFIG_LF_SRC NRF_CLOCK_LFCLK_Xtal +#define CLOCK_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +/* GPIOTE */ +#define GPIOTE_ENABLED 1 + +#if (GPIOTE_ENABLED == 1) +#define GPIOTE_CONFIG_USE_SWI_EGU false +#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 8 +#endif + +/* TIMER */ +#ifdef SOFTDEVICE_PRESENT +#define TIMER0_ENABLED 0 +#else +#define TIMER0_ENABLED 1 +#endif + +#if (TIMER0_ENABLED == 1) +#define TIMER0_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER0_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER0_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_32Bit +#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER0_INSTANCE_INDEX 0 +#endif + +#define TIMER1_ENABLED 1 + +#if (TIMER1_ENABLED == 1) +#define TIMER1_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER1_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER1_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit +#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER1_INSTANCE_INDEX (TIMER0_ENABLED) +#endif + +#define TIMER2_ENABLED 1 + +#if (TIMER2_ENABLED == 1) +#define TIMER2_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER2_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER2_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit +#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER2_INSTANCE_INDEX (TIMER1_ENABLED+TIMER0_ENABLED) +#endif + +#define TIMER3_ENABLED 0 + +#if (TIMER3_ENABLED == 1) +#define TIMER3_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER3_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER3_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit +#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER3_INSTANCE_INDEX (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED) +#endif + +#define TIMER4_ENABLED 0 + +#if (TIMER4_ENABLED == 1) +#define TIMER4_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER4_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER4_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit +#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER4_INSTANCE_INDEX (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED) +#endif + + +#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED) + +/* RTC */ +#define RTC0_ENABLED 0 + +#if (RTC0_ENABLED == 1) +#define RTC0_CONFIG_FREQUENCY 32678 +#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define RTC0_CONFIG_RELIABLE false + +#define RTC0_INSTANCE_INDEX 0 +#endif + +#define RTC1_ENABLED 0 + +#if (RTC1_ENABLED == 1) +#define RTC1_CONFIG_FREQUENCY 32768 +#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define RTC1_CONFIG_RELIABLE false + +#define RTC1_INSTANCE_INDEX (RTC0_ENABLED) +#endif + +#define RTC2_ENABLED 0 + +#if (RTC2_ENABLED == 1) +#define RTC2_CONFIG_FREQUENCY 32768 +#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define RTC2_CONFIG_RELIABLE false + +#define RTC2_INSTANCE_INDEX (RTC0_ENABLED+RTC1_ENABLED) +#endif + + +#define RTC_COUNT (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED) + +#define NRF_MAXIMUM_LATENCY_US 2000 + +/* RNG */ +#define RNG_ENABLED 0 + +#if (RNG_ENABLED == 1) +#define RNG_CONFIG_ERROR_CORRECTION true +#define RNG_CONFIG_POOL_SIZE 8 +#define RNG_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +/* PWM */ + +#define PWM0_ENABLED 1 + +#if (PWM0_ENABLED == 1) +#define PWM0_CONFIG_OUT0_PIN 2 +#define PWM0_CONFIG_OUT1_PIN 3 +#define PWM0_CONFIG_OUT2_PIN 4 +#define PWM0_CONFIG_OUT3_PIN 5 +#define PWM0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define PWM0_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz +#define PWM0_CONFIG_COUNT_MODE NRF_PWM_MODE_UP +#define PWM0_CONFIG_TOP_VALUE 1000 +#define PWM0_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON +#define PWM0_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO + +#define PWM0_INSTANCE_INDEX 0 +#endif + +#define PWM1_ENABLED 1 + +#if (PWM1_ENABLED == 1) +#define PWM1_CONFIG_OUT0_PIN 2 +#define PWM1_CONFIG_OUT1_PIN 3 +#define PWM1_CONFIG_OUT2_PIN 4 +#define PWM1_CONFIG_OUT3_PIN 5 +#define PWM1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define PWM1_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz +#define PWM1_CONFIG_COUNT_MODE NRF_PWM_MODE_UP +#define PWM1_CONFIG_TOP_VALUE 1000 +#define PWM1_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON +#define PWM1_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO + +#define PWM1_INSTANCE_INDEX (PWM0_ENABLED) +#endif + +#define PWM2_ENABLED 1 + +#if (PWM2_ENABLED == 1) +#define PWM2_CONFIG_OUT0_PIN 2 +#define PWM2_CONFIG_OUT1_PIN 3 +#define PWM2_CONFIG_OUT2_PIN 4 +#define PWM2_CONFIG_OUT3_PIN 5 +#define PWM2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define PWM2_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz +#define PWM2_CONFIG_COUNT_MODE NRF_PWM_MODE_UP +#define PWM2_CONFIG_TOP_VALUE 1000 +#define PWM2_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON +#define PWM2_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO + +#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED) +#endif + +#define PWM_COUNT (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED) + +/* SPI */ +#define SPI0_ENABLED 1 + +#if (SPI0_ENABLED == 1) +#define SPI0_USE_EASY_DMA 0 + +#define SPI0_CONFIG_SCK_PIN 2 +#define SPI0_CONFIG_MOSI_PIN 3 +#define SPI0_CONFIG_MISO_PIN 4 +#define SPI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPI0_INSTANCE_INDEX 0 +#endif + +#define SPI1_ENABLED 1 + +#if (SPI1_ENABLED == 1) +#define SPI1_USE_EASY_DMA 0 + +#define SPI1_CONFIG_SCK_PIN 2 +#define SPI1_CONFIG_MOSI_PIN 3 +#define SPI1_CONFIG_MISO_PIN 4 +#define SPI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPI1_INSTANCE_INDEX (SPI0_ENABLED) +#endif + +#define SPI2_ENABLED 1 + +#if (SPI2_ENABLED == 1) +#define SPI2_USE_EASY_DMA 0 + +#define SPI2_CONFIG_SCK_PIN 2 +#define SPI2_CONFIG_MOSI_PIN 3 +#define SPI2_CONFIG_MISO_PIN 4 +#define SPI2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED) +#endif + +#define SPI_COUNT (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED) + +/* SPIS */ +#define SPIS0_ENABLED 1 + +#if (SPIS0_ENABLED == 1) +#define SPIS0_CONFIG_SCK_PIN 2 +#define SPIS0_CONFIG_MOSI_PIN 3 +#define SPIS0_CONFIG_MISO_PIN 4 +#define SPIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPIS0_INSTANCE_INDEX 0 +#endif + +#define SPIS1_ENABLED 1 + +#if (SPIS1_ENABLED == 1) +#define SPIS1_CONFIG_SCK_PIN 2 +#define SPIS1_CONFIG_MOSI_PIN 3 +#define SPIS1_CONFIG_MISO_PIN 4 +#define SPIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED +#endif + +#define SPIS2_ENABLED 1 + +#if (SPIS2_ENABLED == 1) +#define SPIS2_CONFIG_SCK_PIN 2 +#define SPIS2_CONFIG_MOSI_PIN 3 +#define SPIS2_CONFIG_MISO_PIN 4 +#define SPIS2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED) +#endif + +#define SPIS_COUNT (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED) + +/* UART */ +#define UART0_ENABLED 1 + +#if (UART0_ENABLED == 1) +#define UART0_CONFIG_HWFC NRF_UART_HWFC_ENABLED +#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED +#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_9600 +#define UART0_CONFIG_PSEL_TXD 6 +#define UART0_CONFIG_PSEL_RXD 8 +#define UART0_CONFIG_PSEL_CTS 7 +#define UART0_CONFIG_PSEL_RTS 5 +#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH +#ifdef NRF52 +#define UART0_CONFIG_USE_EASY_DMA false +//Compile time flag +#define UART_EASY_DMA_SUPPORT 1 +#define UART_LEGACY_SUPPORT 1 +#endif //NRF52 +#endif + +#define TWI0_ENABLED 1 + +#if (TWI0_ENABLED == 1) +#define TWI0_USE_EASY_DMA 0 + +#define TWI0_CONFIG_FREQUENCY NRF_TWI_FREQ_100K +#define TWI0_CONFIG_SCL 0 +#define TWI0_CONFIG_SDA 1 +#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TWI0_INSTANCE_INDEX 0 +#endif + +#define TWI1_ENABLED 1 + +#if (TWI1_ENABLED == 1) +#define TWI1_USE_EASY_DMA 0 + +#define TWI1_CONFIG_FREQUENCY NRF_TWI_FREQ_100K +#define TWI1_CONFIG_SCL 0 +#define TWI1_CONFIG_SDA 1 +#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TWI1_INSTANCE_INDEX (TWI0_ENABLED) +#endif + +#define TWI_COUNT (TWI0_ENABLED + TWI1_ENABLED) + +/* TWIS */ +#define TWIS0_ENABLED 0 + +#if (TWIS0_ENABLED == 1) + #define TWIS0_CONFIG_ADDR0 0 + #define TWIS0_CONFIG_ADDR1 0 /* 0: Disabled */ + #define TWIS0_CONFIG_SCL 0 + #define TWIS0_CONFIG_SDA 1 + #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + + #define TWIS0_INSTANCE_INDEX 0 +#endif + +#define TWIS1_ENABLED 0 + +#if (TWIS1_ENABLED == 1) + #define TWIS1_CONFIG_ADDR0 0 + #define TWIS1_CONFIG_ADDR1 0 /* 0: Disabled */ + #define TWIS1_CONFIG_SCL 0 + #define TWIS1_CONFIG_SDA 1 + #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + + #define TWIS1_INSTANCE_INDEX (TWIS0_ENABLED) +#endif + +#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED) +/* For more documentation see nrf_drv_twis.h file */ +#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 +/* For more documentation see nrf_drv_twis.h file */ +#define TWIS_NO_SYNC_MODE 0 + +/* QDEC */ +#define QDEC_ENABLED 0 + +#if (QDEC_ENABLED == 1) +#define QDEC_CONFIG_REPORTPER NRF_QDEC_REPORTPER_10 +#define QDEC_CONFIG_SAMPLEPER NRF_QDEC_SAMPLEPER_16384us +#define QDEC_CONFIG_PIO_A 1 +#define QDEC_CONFIG_PIO_B 2 +#define QDEC_CONFIG_PIO_LED 3 +#define QDEC_CONFIG_LEDPRE 511 +#define QDEC_CONFIG_LEDPOL NRF_QDEC_LEPOL_ACTIVE_HIGH +#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define QDEC_CONFIG_DBFEN false +#define QDEC_CONFIG_SAMPLE_INTEN false +#endif + +/* ADC */ +#define ADC_ENABLED 0 + +#if (ADC_ENABLED == 1) +#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + + +/* SAADC */ +#define SAADC_ENABLED 1 + +#if (SAADC_ENABLED == 1) +#define SAADC_CONFIG_RESOLUTION NRF_SAADC_RESOLUTION_10BIT +#define SAADC_CONFIG_OVERSAMPLE NRF_SAADC_OVERSAMPLE_DISABLED +#define SAADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +/* PDM */ +#define PDM_ENABLED 0 + +#if (PDM_ENABLED == 1) +#define PDM_CONFIG_MODE NRF_PDM_MODE_MONO +#define PDM_CONFIG_EDGE NRF_PDM_EDGE_LEFTFALLING +#define PDM_CONFIG_CLOCK_FREQ NRF_PDM_FREQ_1032K +#define PDM_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +/* COMP */ +#define COMP_ENABLED 0 + +#if (COMP_ENABLED == 1) +#define COMP_CONFIG_REF NRF_COMP_REF_Int1V8 +#define COMP_CONFIG_MAIN_MODE NRF_COMP_MAIN_MODE_SE +#define COMP_CONFIG_SPEED_MODE NRF_COMP_SP_MODE_High +#define COMP_CONFIG_HYST NRF_COMP_HYST_NoHyst +#define COMP_CONFIG_ISOURCE NRF_COMP_ISOURCE_Off +#define COMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define COMP_CONFIG_INPUT NRF_COMP_INPUT_0 +#endif + +/* LPCOMP */ +#define LPCOMP_ENABLED 0 + +#if (LPCOMP_ENABLED == 1) +#define LPCOMP_CONFIG_REFERENCE NRF_LPCOMP_REF_SUPPLY_4_8 +#define LPCOMP_CONFIG_DETECTION NRF_LPCOMP_DETECT_DOWN +#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define LPCOMP_CONFIG_INPUT NRF_LPCOMP_INPUT_0 +#endif + +/* WDT */ +#define WDT_ENABLED 0 + +#if (WDT_ENABLED == 1) +#define WDT_CONFIG_BEHAVIOUR NRF_WDT_BEHAVIOUR_RUN_SLEEP +#define WDT_CONFIG_RELOAD_VALUE 2000 +#define WDT_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH +#endif + +/* SWI EGU */ +#ifdef NRF52 + #define EGU_ENABLED 0 +#endif + +/* I2S */ +#define I2S_ENABLED 0 + +#if (I2S_ENABLED == 1) +#define I2S_CONFIG_SCK_PIN 22 +#define I2S_CONFIG_LRCK_PIN 23 +#define I2S_CONFIG_MCK_PIN NRF_DRV_I2S_PIN_NOT_USED +#define I2S_CONFIG_SDOUT_PIN 24 +#define I2S_CONFIG_SDIN_PIN 25 +#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH +#define I2S_CONFIG_MASTER NRF_I2S_MODE_MASTER +#define I2S_CONFIG_FORMAT NRF_I2S_FORMAT_I2S +#define I2S_CONFIG_ALIGN NRF_I2S_ALIGN_LEFT +#define I2S_CONFIG_SWIDTH NRF_I2S_SWIDTH_16BIT +#define I2S_CONFIG_CHANNELS NRF_I2S_CHANNELS_STEREO +#define I2S_CONFIG_MCK_SETUP NRF_I2S_MCK_32MDIV8 +#define I2S_CONFIG_RATIO NRF_I2S_RATIO_256X +#endif + +#include "nrf_drv_config_validation.h" + +#endif // NRF_DRV_CONFIG_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h new file mode 100644 index 0000000000..9506d327d3 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @defgroup nrf_mbr_api Master Boot Record API + @{ + + @brief APIs for updating SoftDevice and BootLoader + +*/ + +/* Header guard */ +#ifndef NRF_MBR_H__ +#define NRF_MBR_H__ + +#include "nrf_svc.h" +#include + +#ifndef NRF52 +#error "This header file shall only be included for nRF52 projects" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup NRF_MBR_DEFINES Defines + * @{ */ + +/**@brief MBR SVC Base number. */ +#define MBR_SVC_BASE (0x18) + +/**@brief Page size in words. */ +#define MBR_PAGE_SIZE_IN_WORDS (1024) + +/** @brief The size that must be reserved for the MBR when a softdevice is written to flash. +This is the offset where the first byte of the softdevice hex file is written.*/ +#define MBR_SIZE (0x1000) + +/** @} */ + +/** @addtogroup NRF_MBR_ENUMS Enumerations + * @{ */ + +/**@brief nRF Master Boot Record API SVC numbers. */ +enum NRF_MBR_SVCS +{ + SD_MBR_COMMAND = MBR_SVC_BASE, /**< ::sd_mbr_command */ +}; + +/**@brief Possible values for ::sd_mbr_command_t.command */ +enum NRF_MBR_COMMANDS +{ + SD_MBR_COMMAND_COPY_BL, /**< Copy a new BootLoader. @see sd_mbr_command_copy_bl_t */ + SD_MBR_COMMAND_COPY_SD, /**< Copy a new SoftDevice. @see ::sd_mbr_command_copy_sd_t*/ + SD_MBR_COMMAND_INIT_SD, /**< Init forwarding interrupts to SD, and run reset function in SD*/ + SD_MBR_COMMAND_COMPARE, /**< This command works like memcmp. @see ::sd_mbr_command_compare_t*/ + SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, /**< Start forwarding all exception to this address @see ::sd_mbr_command_vector_table_base_set_t*/ +}; + +/** @} */ + +/** @addtogroup NRF_MBR_TYPES Types + * @{ */ + +/**@brief This command copies part of a new SoftDevice + * The destination area is erased before copying. + * If dst is in the middle of a flash page, that whole flash page will be erased. + * If (dst+len) is in the middle of a flash page, that whole flash page will be erased. + * + * The user of this function is responsible for setting the BPROT registers. + * + * @retval ::NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly. + * @retval ::NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. + */ +typedef struct +{ + uint32_t *src; /**< Pointer to the source of data to be copied.*/ + uint32_t *dst; /**< Pointer to the destination where the content is to be copied.*/ + uint32_t len; /**< Number of 32 bit words to copy. Must be a multiple of @ref MBR_PAGE_SIZE_IN_WORDS words.*/ +} sd_mbr_command_copy_sd_t; + + +/**@brief This command works like memcmp, but takes the length in words. + * + * @retval ::NRF_SUCCESS indicates that the contents of both memory blocks are equal. + * @retval ::NRF_ERROR_NULL indicates that the contents of the memory blocks are not equal. + */ +typedef struct +{ + uint32_t *ptr1; /**< Pointer to block of memory. */ + uint32_t *ptr2; /**< Pointer to block of memory. */ + uint32_t len; /**< Number of 32 bit words to compare.*/ +} sd_mbr_command_compare_t; + + +/**@brief This command copies a new BootLoader. + * With this command, destination of BootLoader is always the address written in NRF_UICR->BOOTADDR. + * + * Destination is erased by this function. + * If (destination+bl_len) is in the middle of a flash page, that whole flash page will be erased. + * + * This function will use PROTENSET to protect the flash that is not intended to be written. + * + * On Success, this function will not return. It will start the new BootLoader from reset-vector as normal. + * + * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. + * @retval ::NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. + * @retval ::NRF_ERROR_INVALID_LENGTH if parameters attempts to read or write outside flash area. + * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) + */ +typedef struct +{ + uint32_t *bl_src; /**< Pointer to the source of the Bootloader to be be copied.*/ + uint32_t bl_len; /**< Number of 32 bit words to copy for BootLoader. */ +} sd_mbr_command_copy_bl_t; + +/**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the MBR + * + * Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset. + * + * To restore default forwarding this function should be called with @param address set to 0. + * The MBR will then start forwarding to interrupts to the address in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. + * + * On Success, this function will not return. It will reset the device. + * + * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. + * @retval ::NRF_ERROR_INVALID_ADDR if parameter address is outside of the flash size. + * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) + */ +typedef struct +{ + uint32_t address; /**< The base address of the interrupt vector table for forwarded interrupts.*/ +} sd_mbr_command_vector_table_base_set_t; + + +typedef struct +{ + uint32_t command; /**< type of command to be issued see @ref NRF_MBR_COMMANDS. */ + union + { + sd_mbr_command_copy_sd_t copy_sd; /**< Parameters for copy SoftDevice.*/ + sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ + sd_mbr_command_copy_bl_t copy_bl; /**< Parameters for copy BootLoader. Requires parameter page. */ + sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set. Requires parameter page.*/ + } params; +} sd_mbr_command_t; + +/** @} */ + +/** @addtogroup NRF_MBR_FUNCTIONS Functions + * @{ */ + +/**@brief Issue Master Boot Record commands + * + * Commands used when updating a SoftDevice and bootloader. + * + * The SD_MBR_COMMAND_COPY_BL and SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET requires parameters to be + * retained by the MBR when resetting the IC. This is done in a separate flash page + * provided by the application. The uicr register UICR.NRFFW[1] must be set + * to an address corresponding to a page in the application flash space. This page will be cleared + * by the MBR and used to store the command before reset. When the UICR.NRFFW[1] field is set + * the page it refers to must not be used by the application. If the UICR.NRFFW[1] is set to + * 0xFFFFFFFF (the default) MBR commands which use flash will be unavailable and return + * NRF_ERROR_NO_MEM. + * + * @param[in] param Pointer to a struct describing the command. + * + * @note for retvals see ::sd_mbr_command_copy_sd_t ::sd_mbr_command_copy_bl_t ::sd_mbr_command_compare_t ::sd_mbr_command_vector_table_base_set_t + * + * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). + * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. +*/ +SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_MBR_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble.h new file mode 100644 index 0000000000..71e3984776 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble.h @@ -0,0 +1,635 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_COMMON BLE SoftDevice Common + @{ + @defgroup ble_api Events, type definitions and API calls + @{ + + @brief Module independent events, type definitions and API calls for the BLE SoftDevice. + + */ + +#ifndef NRF_BLE_H__ +#define NRF_BLE_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" { +#endif + +/** @addtogroup BLE_COMMON_ENUMERATIONS Enumerations + * @{ */ + +/** + * @brief Common API SVC numbers. + */ +enum BLE_COMMON_SVCS +{ + SD_BLE_ENABLE = BLE_SVC_BASE, /**< Enable and initialize the BLE stack */ + SD_BLE_EVT_GET, /**< Get an event from the pending events queue. */ + SD_BLE_TX_PACKET_COUNT_GET, /**< Get the total number of available application transmission packets for a particular connection. */ + SD_BLE_UUID_VS_ADD, /**< Add a Vendor Specific UUID. */ + SD_BLE_UUID_DECODE, /**< Decode UUID bytes. */ + SD_BLE_UUID_ENCODE, /**< Encode UUID bytes. */ + SD_BLE_VERSION_GET, /**< Get the local version information (company id, Link Layer Version, Link Layer Subversion). */ + SD_BLE_USER_MEM_REPLY, /**< User Memory Reply. */ + SD_BLE_OPT_SET, /**< Set a BLE option. */ + SD_BLE_OPT_GET, /**< Get a BLE option. */ +}; + + /** + * @brief BLE Module Independent Event IDs. + */ +enum BLE_COMMON_EVTS +{ + BLE_EVT_TX_COMPLETE = BLE_EVT_BASE, /**< Transmission Complete. @ref ble_evt_tx_complete_t */ + BLE_EVT_USER_MEM_REQUEST, /**< User Memory request. @ref ble_evt_user_mem_request_t */ + BLE_EVT_USER_MEM_RELEASE /**< User Memory release. @ref ble_evt_user_mem_release_t */ +}; + +/**@brief BLE connection bandwidth types. + * Bandwidth types supported by the SoftDevice in packets per connection interval. + */ +enum BLE_CONN_BWS +{ + BLE_CONN_BW_NONE = 0, + BLE_CONN_BW_LOW, + BLE_CONN_BW_MID, + BLE_CONN_BW_HIGH +}; + +/**@brief Common Option IDs. + * IDs that uniquely identify a common option. + */ +enum BLE_COMMON_OPTS +{ + BLE_COMMON_OPT_CONN_BW = BLE_OPT_BASE, /**< Bandwidth configuration @ref ble_common_opt_conn_bw_t */ + BLE_COMMON_OPT_PA_LNA /**< PA and LNA options */ +}; + +/** @} */ + +/** @addtogroup BLE_COMMON_DEFINES Defines + * @{ */ + +/** @brief Required pointer alignment for BLE Events. +*/ +#define BLE_EVTS_PTR_ALIGNMENT 4 + +/** @defgroup BLE_USER_MEM_TYPES User Memory Types + * @{ */ +#define BLE_USER_MEM_TYPE_INVALID 0x00 /**< Invalid User Memory Types. */ +#define BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES 0x01 /**< User Memory for GATTS queued writes. */ +/** @} */ + +/** @defgroup BLE_UUID_VS_COUNTS Vendor Specific UUID counts + * @{ + */ +#define BLE_UUID_VS_COUNT_MIN 1 /**< Minimum VS UUID count. */ +#define BLE_UUID_VS_COUNT_DEFAULT 0 /**< Use the default VS UUID count (10 for this version of the SoftDevice). */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_COMMON_STRUCTURES Structures + * @{ */ + +/**@brief User Memory Block. */ +typedef struct +{ + uint8_t *p_mem; /**< Pointer to the start of the user memory block. */ + uint16_t len; /**< Length in bytes of the user memory block. */ +} ble_user_mem_block_t; + +/** + * @brief Event structure for @ref BLE_EVT_TX_COMPLETE. + */ +typedef struct +{ + uint8_t count; /**< Number of packets transmitted. */ +} ble_evt_tx_complete_t; + +/**@brief Event structure for @ref BLE_EVT_USER_MEM_REQUEST. */ +typedef struct +{ + uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */ +} ble_evt_user_mem_request_t; + +/**@brief Event structure for @ref BLE_EVT_USER_MEM_RELEASE. */ +typedef struct +{ + uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */ + ble_user_mem_block_t mem_block; /**< User memory block */ +} ble_evt_user_mem_release_t; + + +/**@brief Event structure for events not associated with a specific function module. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which this event occurred. */ + union + { + ble_evt_tx_complete_t tx_complete; /**< Transmission Complete. */ + ble_evt_user_mem_request_t user_mem_request; /**< User Memory Request Event Parameters. */ + ble_evt_user_mem_release_t user_mem_release; /**< User Memory Release Event Parameters. */ + } params; +} ble_common_evt_t; + +/**@brief BLE Event header. */ +typedef struct +{ + uint16_t evt_id; /**< Value from a BLE__EVT series. */ + uint16_t evt_len; /**< Length in octets including this header. */ +} ble_evt_hdr_t; + +/**@brief Common BLE Event type, wrapping the module specific event reports. */ +typedef struct +{ + ble_evt_hdr_t header; /**< Event header. */ + union + { + ble_common_evt_t common_evt; /**< Common Event, evt_id in BLE_EVT_* series. */ + ble_gap_evt_t gap_evt; /**< GAP originated event, evt_id in BLE_GAP_EVT_* series. */ + ble_l2cap_evt_t l2cap_evt; /**< L2CAP originated event, evt_id in BLE_L2CAP_EVT* series. */ + ble_gattc_evt_t gattc_evt; /**< GATT client originated event, evt_id in BLE_GATTC_EVT* series. */ + ble_gatts_evt_t gatts_evt; /**< GATT server originated event, evt_id in BLE_GATTS_EVT* series. */ + } evt; +} ble_evt_t; + + +/** + * @brief Version Information. + */ +typedef struct +{ + uint8_t version_number; /**< Link Layer Version number for BT 4.1 spec is 7 (https://www.bluetooth.org/en-us/specification/assigned-numbers/link-layer). */ + uint16_t company_id; /**< Company ID, Nordic Semiconductor's company ID is 89 (0x0059) (https://www.bluetooth.org/apps/content/Default.aspx?doc_id=49708). */ + uint16_t subversion_number; /**< Link Layer Sub Version number, corresponds to the SoftDevice Config ID or Firmware ID (FWID). */ +} ble_version_t; + +/* @brief: Configuration parameters for the PA and LNA. */ +typedef struct +{ + uint8_t enable :1; /**< Enable toggling for this amplifier */ + uint8_t active_high :1; /**< Set the pin to be active high */ + uint8_t gpio_pin :6; /**< The GPIO pin to toggle for this amplifier */ +} ble_pa_lna_cfg_t; + +/* + * @brief PA & LNA GPIO toggle configuration + * + * This option configures the SoftDevice to toggle pins when the radio is active for use with a power amplifier and/or + * a low noise amplifier. + * + * Toggling the pins is achieved by using two PPI channels and a GPIOTE channel. The hardware channel IDs are provided + * by the application and should be regarded as reserved as long as any PA/LNA toggling is enabled. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * @note This feature is only supported for nRF52, on nRF51 @ref NRF_ERROR_NOT_SUPPORTED will always be returned. + * @note Setting this option while the radio is in use (i.e. any of the roles are active) may have undefined consequences + * and must be avoided by the application. + * + */ +typedef struct +{ + ble_pa_lna_cfg_t pa_cfg; /**< Power Amplifier configuration */ + ble_pa_lna_cfg_t lna_cfg; /**< Low Noise Amplifier configuration */ + + uint8_t ppi_ch_id_set; /**< PPI channel used for radio pin setting */ + uint8_t ppi_ch_id_clr; /**< PPI channel used for radio pin clearing */ + uint8_t gpiote_ch_id; /**< GPIOTE channel used for radio pin toggling */ +} ble_common_opt_pa_lna_t; + +/** + * @brief BLE connection bandwidth configuration parameters + */ +typedef struct +{ + uint8_t conn_bw_tx; /**< Connection bandwidth configuration for transmission, see @ref BLE_CONN_BWS.*/ + uint8_t conn_bw_rx; /**< Connection bandwidth configuration for reception, see @ref BLE_CONN_BWS.*/ +} ble_conn_bw_t; + +/**@brief BLE connection specific bandwidth configuration parameters. + * + * This can be used with @ref sd_ble_opt_set to set the bandwidth configuration to be used when creating connections. + * + * Call @ref sd_ble_opt_set with this option prior to calling @ref sd_ble_gap_adv_start or @ref sd_ble_gap_connect. + * + * The bandwidth configurations set via @ref sd_ble_opt_set are maintained separately for central and peripheral + * connections. The given configurations are used for all future connections of the role indicated in this structure + * unless they are changed by subsequent @ref sd_ble_opt_set calls. + * + * @note When this option is not used, the SoftDevice will use the default options: + * - @ref BLE_CONN_BW_HIGH for @ref BLE_GAP_ROLE_PERIPH connections (both transmission and reception). + * - @ref BLE_CONN_BW_MID for @ref BLE_GAP_ROLE_CENTRAL connections (both transmisison and reception). + * This option allows the application to selectively override these defaults for each role. + * + * @note The global memory pool configuration can be set with the @ref ble_conn_bw_counts_t configuration parameter, which + * is provided to @ref sd_ble_enable. + * + * @note Please refer to SoftDevice Specification for more information on bandwidth configuration. + * + * @mscs + * @mmsc{@ref BLE_COMMON_CONF_BW} + * @endmscs + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::BLE_ERROR_INVALID_ROLE The role is invalid. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid bandwidth configuration parameters. + * @retval ::NRF_ERROR_NOT_SUPPORTED If the combination of role and bandwidth configuration is not supported. + */ +typedef struct +{ + uint8_t role; /**< BLE role of the connection, see @ref BLE_GAP_ROLES. */ + ble_conn_bw_t conn_bw; /**< Bandwidth configuration parameters. */ +} ble_common_opt_conn_bw_t; + +/**@brief Option structure for common options. */ +typedef union +{ + ble_common_opt_conn_bw_t conn_bw; /**< Parameters for the connection bandwidth option. */ + ble_common_opt_pa_lna_t pa_lna; /**< Parameters for controlling PA and LNA pin toggling. */ +} ble_common_opt_t; + +/**@brief Common BLE Option type, wrapping the module specific options. */ +typedef union +{ + ble_common_opt_t common_opt; /**< COMMON options, opt_id in @ref BLE_COMMON_OPTS series. */ + ble_gap_opt_t gap_opt; /**< GAP option, opt_id in @ref BLE_GAP_OPTS series. */ +} ble_opt_t; + +/** + * @brief BLE bandwidth count parameters + * + * These parameters are used to configure the memory pools allocated within the SoftDevice for application packets + * (both transmission and reception) for all connections. + * + * @note The sum of all three counts must add up to the sum of @ref ble_gap_enable_params_t::central_conn_count and + * @ref ble_gap_enable_params_t::periph_conn_count in @ref ble_gap_enable_params_t. + */ +typedef struct { + uint8_t high_count; /**< Total number of high bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ + uint8_t mid_count; /**< Total number of medium bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ + uint8_t low_count; /**< Total number of low bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ +} ble_conn_bw_count_t; + +/** + * @brief BLE bandwidth global memory pool configuration parameters + * + * These configuration parameters are used to set the amount of memory dedicated to application packets for + * all connections. The application should specify the most demanding configuration for the intended use. + * + * Please refer to the SoftDevice Specification for more information on bandwidth configuration. + * + * @note Each connection created at runtime requires both a TX and an RX memory pool. By the use of these configuration + * parameters, the application can decide the size and total number of the global memory pools that will be later + * available for connection creation. + * + * @mscs + * @mmsc{@ref BLE_COMMON_CONF_BW} + * @endmscs + * + */ +typedef struct { + ble_conn_bw_count_t tx_counts; /**< Global memory pool configuration for transmission.*/ + ble_conn_bw_count_t rx_counts; /**< Global memory pool configuration for reception.*/ +} ble_conn_bw_counts_t; + +/** + * @brief BLE Common Initialization parameters. + * + * @note If @ref p_conn_bw_counts is NULL the SoftDevice will assume default bandwidth configuration for all connections. + * To fit a custom bandwidth configuration requirement, the application developer may have to specify a custom memory + * pool configuration here. See @ref ble_common_opt_conn_bw_t for bandwidth configuration of individual connections. + * Please refer to the SoftDevice Specification for more information on bandwidth configuration. + */ +typedef struct +{ + uint16_t vs_uuid_count; /**< Maximum number of 128-bit, Vendor Specific UUID bases to allocate. */ + ble_conn_bw_counts_t *p_conn_bw_counts; /**< Bandwidth configuration parameters or NULL for defaults. */ +} ble_common_enable_params_t; + +/** + * @brief BLE Initialization parameters. + */ +typedef struct +{ + ble_common_enable_params_t common_enable_params; /**< Common init parameters @ref ble_common_enable_params_t. */ + ble_gap_enable_params_t gap_enable_params; /**< GAP init parameters @ref ble_gap_enable_params_t. */ + ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init parameters @ref ble_gatts_enable_params_t. */ +} ble_enable_params_t; + +/** @} */ + +/** @addtogroup BLE_COMMON_FUNCTIONS Functions + * @{ */ + +/**@brief Enable the BLE stack + * + * @param[in, out] p_ble_enable_params Pointer to ble_enable_params_t + * @param[in, out] p_app_ram_base Pointer to a variable containing the start address of the application RAM region + * (APP_RAM_BASE). On return, this will contain the minimum start address of the application RAM region required by the + * SoftDevice for this configuration. Calling @ref sd_ble_enable() with *p_app_ram_base set to 0 can be used during + * development to find out how much memory a specific configuration will need. + * + * @note The memory requirement for a specific configuration will not increase between SoftDevices with the same major + * version number. + * + * @note At runtime the IC's RAM is split into 2 regions: The SoftDevice RAM region is located between 0x20000000 and + * APP_RAM_BASE-1 and the application's RAM region is located between APP_RAM_BASE and the start of the call stack. + * + * @details This call initializes the BLE stack, no other BLE related function can be called before this one. + * + * @mscs + * @mmsc{@ref BLE_COMMON_ENABLE} + * @endmscs + * + * @retval ::NRF_SUCCESS The BLE stack has been initialized successfully. + * @retval ::NRF_ERROR_INVALID_STATE The BLE stack had already been initialized and cannot be reinitialized. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. + * @retval ::NRF_ERROR_INVALID_LENGTH The specified Attribute Table size is either too small or not a multiple of 4. + * The minimum acceptable size is defined by @ref BLE_GATTS_ATTR_TAB_SIZE_MIN. + * @retval ::NRF_ERROR_INVALID_PARAM Incorrectly configured VS UUID count or connection count parameters. + * @retval ::NRF_ERROR_NO_MEM The amount of memory assigned to the SoftDevice by *p_app_ram_base is not + * large enough to fit this configuration's memory requirement. Check *p_app_ram_base + * and set the start address of the application RAM region accordingly. + * @retval ::NRF_ERROR_CONN_COUNT The requested number of connections exceeds the maximum supported by the SoftDevice. + * Please refer to the SoftDevice Specification for more information on role configuration. + */ +SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params, uint32_t * p_app_ram_base)); + +/**@brief Get an event from the pending events queue. + * + * @param[out] p_dest Pointer to buffer to be filled in with an event, or NULL to retrieve the event length. + * This buffer must be 4-byte aligned in memory. + * @param[in, out] p_len Pointer the length of the buffer, on return it is filled with the event length. + * + * @details This call allows the application to pull a BLE event from the BLE stack. The application is signaled that + * an event is available from the BLE stack by the triggering of the SD_EVT_IRQn interrupt. + * The application is free to choose whether to call this function from thread mode (main context) or directly from the + * Interrupt Service Routine that maps to SD_EVT_IRQn. In any case however, and because the BLE stack runs at a higher + * priority than the application, this function should be called in a loop (until @ref NRF_ERROR_NOT_FOUND is returned) + * every time SD_EVT_IRQn is raised to ensure that all available events are pulled from the BLE stack. Failure to do so + * could potentially leave events in the internal queue without the application being aware of this fact. Sizing the + * p_dest buffer is equally important, since the application needs to provide all the memory necessary for the event to + * be copied into application memory. If the buffer provided is not large enough to fit the entire contents of the event, + * @ref NRF_ERROR_DATA_SIZE will be returned and the application can then call again with a larger buffer size. + * Please note that because of the variable length nature of some events, sizeof(ble_evt_t) will not always be large + * enough to fit certain events, and so it is the application's responsibility to provide an amount of memory large + * enough so that the relevant event is copied in full. The application may "peek" the event length by providing p_dest + * as a NULL pointer and inspecting the value of *p_len upon return: + * + * \code + * uint16_t len; + * errcode = sd_ble_evt_get(NULL, &len); + * \endcode + * + * @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT + * + * @mscs + * @mmsc{@ref BLE_COMMON_IRQ_EVT_MSC} + * @mmsc{@ref BLE_COMMON_THREAD_EVT_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Event pulled and stored into the supplied buffer. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. + * @retval ::NRF_ERROR_NOT_FOUND No events ready to be pulled. + * @retval ::NRF_ERROR_DATA_SIZE Event ready but could not fit into the supplied buffer. + */ +SVCALL(SD_BLE_EVT_GET, uint32_t, sd_ble_evt_get(uint8_t *p_dest, uint16_t *p_len)); + + +/**@brief Get the total number of available guaranteed application transmission packets for a particular connection. + * + * @details This call allows the application to obtain the total number of guaranteed application transmission packets + * available for a connection. Please note that this does not return the number of free packets, but rather the total + * amount of them for that particular connection. The application has two options to handle transmitting application packets: + * - Use a simple arithmetic calculation: after connection creation time the application should use this function to + * find out the total amount of guaranteed packets available to it and store it in a variable. + * Every time a packet is successfully queued for a transmission on this connection using any of the exposed functions in + * this BLE API, the application should decrement that variable. Conversely, whenever a @ref BLE_EVT_TX_COMPLETE event + * with the conn_handle matching the particular connection is received by the application, it should retrieve the count + * field in such event and add that number to the same variable storing the number of available guaranteed packets. This + * mechanism allows the application to be aware at any time of the number of guaranteed application packets available for + * each of the active connections, and therefore it can know with certainty whether it is possible to send more data or + * it has to wait for a @ref BLE_EVT_TX_COMPLETE event before it proceeds. + * The application can still pursue transmissions when the number of guaranteed application packets available is smaller + * than or equal to zero, but successful queuing of the tranmsission is not guaranteed. + * - Choose to simply not keep track of available packets at all, and instead handle the @ref BLE_ERROR_NO_TX_PACKETS error + * by queueing the packet to be transmitted and try again as soon as a @ref BLE_EVT_TX_COMPLETE event arrives. + * + * The API functions that may consume an application packet depending on the parameters supplied to them can be found below: + * - @ref sd_ble_gattc_write (write without response only) + * - @ref sd_ble_gatts_hvx (notifications only) + * - @ref sd_ble_l2cap_tx (all packets) + * + * @param[in] conn_handle Connection handle. + * @param[out] p_count Pointer to a uint8_t which will contain the number of application transmission packets upon + * successful return. + * @mscs + * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Number of application transmission packets retrieved successfully. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_TX_PACKET_COUNT_GET, uint32_t, sd_ble_tx_packet_count_get(uint16_t conn_handle, uint8_t *p_count)); + + +/**@brief Add a Vendor Specific UUID. + * + * @details This call enables the application to add a vendor specific UUID to the BLE stack's table, for later use + * all other modules and APIs. This then allows the application to use the shorter, 24-bit @ref ble_uuid_t format + * when dealing with both 16-bit and 128-bit UUIDs without having to check for lengths and having split code paths. + * The way that this is accomplished is by extending the grouping mechanism that the Bluetooth SIG standard base + * UUID uses for all other 128-bit UUIDs. The type field in the @ref ble_uuid_t structure is an index (relative to + * @ref BLE_UUID_TYPE_VENDOR_BEGIN) to the table populated by multiple calls to this function, and the uuid field + * in the same structure contains the 2 bytes at indices 12 and 13. The number of possible 128-bit UUIDs available to + * the application is therefore the number of Vendor Specific UUIDs added with the help of this function times 65536, + * although restricted to modifying bytes 12 and 13 for each of the entries in the supplied array. + * + * @note Bytes 12 and 13 of the provided UUID will not be used internally, since those are always replaced by + * the 16-bit uuid field in @ref ble_uuid_t. + * + * @note If a UUID is already present in the BLE stack's internal table, the corresponding index will be returned in + * p_uuid_type along with an NRF_SUCCESS error code. + * + * @param[in] p_vs_uuid Pointer to a 16-octet (128-bit) little endian Vendor Specific UUID disregarding + * bytes 12 and 13. + * @param[out] p_uuid_type Pointer to a uint8_t where the type field in @ref ble_uuid_t corresponding to this UUID will be stored. + * + * @retval ::NRF_SUCCESS Successfully added the Vendor Specific UUID. + * @retval ::NRF_ERROR_INVALID_ADDR If p_vs_uuid or p_uuid_type is NULL or invalid. + * @retval ::NRF_ERROR_NO_MEM If there are no more free slots for VS UUIDs. + */ +SVCALL(SD_BLE_UUID_VS_ADD, uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type)); + + +/** @brief Decode little endian raw UUID bytes (16-bit or 128-bit) into a 24 bit @ref ble_uuid_t structure. + * + * @details The raw UUID bytes excluding bytes 12 and 13 (i.e. bytes 0-11 and 14-15) of p_uuid_le are compared + * to the corresponding ones in each entry of the table of vendor specific UUIDs populated with @ref sd_ble_uuid_vs_add + * to look for a match. If there is such a match, bytes 12 and 13 are returned as p_uuid->uuid and the index + * relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN as p_uuid->type. + * + * @note If the UUID length supplied is 2, then the type set by this call will always be @ref BLE_UUID_TYPE_BLE. + * + * @param[in] uuid_le_len Length in bytes of the buffer pointed to by p_uuid_le (must be 2 or 16 bytes). + * @param[in] p_uuid_le Pointer pointing to little endian raw UUID bytes. + * @param[out] p_uuid Pointer to a @ref ble_uuid_t structure to be filled in. + * + * @retval ::NRF_SUCCESS Successfully decoded into the @ref ble_uuid_t structure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_LENGTH Invalid UUID length. + * @retval ::NRF_ERROR_NOT_FOUND For a 128-bit UUID, no match in the populated table of UUIDs. + */ +SVCALL(SD_BLE_UUID_DECODE, uint32_t, sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const *p_uuid_le, ble_uuid_t *p_uuid)); + + +/** @brief Encode a @ref ble_uuid_t structure into little endian raw UUID bytes (16-bit or 128-bit). + * + * @note The pointer to the destination buffer p_uuid_le may be NULL, in which case only the validity and size of p_uuid is computed. + * + * @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes. + * @param[out] p_uuid_le_len Pointer to a uint8_t that will be filled with the encoded length (2 or 16 bytes). + * @param[out] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes (2 or 16) will be stored. + * + * @retval ::NRF_SUCCESS Successfully encoded into the buffer. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid UUID type. + */ +SVCALL(SD_BLE_UUID_ENCODE, uint32_t, sd_ble_uuid_encode(ble_uuid_t const *p_uuid, uint8_t *p_uuid_le_len, uint8_t *p_uuid_le)); + + +/**@brief Get Version Information. + * + * @details This call allows the application to get the BLE stack version information. + * + * @param[out] p_version Pointer to a ble_version_t structure to be filled in. + * + * @retval ::NRF_SUCCESS Version information stored successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy (typically doing a locally-initiated disconnection procedure). + */ +SVCALL(SD_BLE_VERSION_GET, uint32_t, sd_ble_version_get(ble_version_t *p_version)); + + +/**@brief Provide a user memory block. + * + * @note This call can only be used as a response to a @ref BLE_EVT_USER_MEM_REQUEST event issued to the application. + * + * @param[in] conn_handle Connection handle. + * @param[in,out] p_block Pointer to a user memory block structure. + * + * @mscs + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_PEER_CANCEL_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_NOAUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Successfully queued a response to the peer. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection state or no execute write request pending. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_USER_MEM_REPLY, uint32_t, sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block)); + +/**@brief Set a BLE option. + * + * @details This call allows the application to set the value of an option. + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_STATIC_PK_MSC} + * @mmsc{@ref BLE_COMMON_CONF_BW} + * @endmscs + * + * @param[in] opt_id Option ID, see @ref BLE_COMMON_OPTS and @ref BLE_GAP_OPTS. + * @param[in] p_opt Pointer to a ble_opt_t structure containing the option value. + * + * @retval ::NRF_SUCCESS Option set successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. + * @retval ::NRF_ERROR_INVALID_STATE Unable to set the parameter at this time. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed. + */ +SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt)); + + +/**@brief Get a BLE option. + * + * @details This call allows the application to retrieve the value of an option. + * + * @param[in] opt_id Option ID, see @ref BLE_COMMON_OPTS and @ref BLE_GAP_OPTS. + * @param[out] p_opt Pointer to a ble_opt_t structure to be filled in. + * + * @retval ::NRF_SUCCESS Option retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. + * @retval ::NRF_ERROR_INVALID_STATE Unable to retrieve the parameter at this time. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed. + * @retval ::NRF_ERROR_NOT_SUPPORTED This option is not supported. + * + */ +SVCALL(SD_BLE_OPT_GET, uint32_t, sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt)); + +/** @} */ +#ifdef __cplusplus +} +#endif +#endif /* NRF_BLE_H__ */ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_err.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_err.h new file mode 100644 index 0000000000..7eaf23d125 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_err.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_COMMON + @{ + @addtogroup nrf_error + @{ + @ingroup BLE_COMMON + @} + + @defgroup ble_err General error codes + @{ + + @brief General error code definitions for the BLE API. + + @ingroup BLE_COMMON +*/ +#ifndef NRF_BLE_ERR_H__ +#define NRF_BLE_ERR_H__ + +#include "nrf_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* @defgroup BLE_ERRORS Error Codes + * @{ */ +#define BLE_ERROR_NOT_ENABLED (NRF_ERROR_STK_BASE_NUM+0x001) /**< @ref sd_ble_enable has not been called. */ +#define BLE_ERROR_INVALID_CONN_HANDLE (NRF_ERROR_STK_BASE_NUM+0x002) /**< Invalid connection handle. */ +#define BLE_ERROR_INVALID_ATTR_HANDLE (NRF_ERROR_STK_BASE_NUM+0x003) /**< Invalid attribute handle. */ +#define BLE_ERROR_NO_TX_PACKETS (NRF_ERROR_STK_BASE_NUM+0x004) /**< Not enough application packets available on this connection. */ +#define BLE_ERROR_INVALID_ROLE (NRF_ERROR_STK_BASE_NUM+0x005) /**< Invalid role. */ +/** @} */ + + +/** @defgroup BLE_ERROR_SUBRANGES Module specific error code subranges + * @brief Assignment of subranges for module specific error codes. + * @note For specific error codes, see ble_.h or ble_error_.h. + * @{ */ +#define NRF_L2CAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x100) /**< L2CAP specific errors. */ +#define NRF_GAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x200) /**< GAP specific errors. */ +#define NRF_GATTC_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x300) /**< GATT client specific errors. */ +#define NRF_GATTS_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x400) /**< GATT server specific errors. */ +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif + + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gap.h new file mode 100644 index 0000000000..926714ed36 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gap.h @@ -0,0 +1,1745 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_GAP Generic Access Profile (GAP) + @{ + @brief Definitions and prototypes for the GAP interface. + */ + +#ifndef NRF_BLE_GAP_H__ +#define NRF_BLE_GAP_H__ + +#include "nrf_ble_types.h" +#include "nrf_ble_ranges.h" +#include "nrf_svc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@addtogroup BLE_GAP_ENUMERATIONS Enumerations + * @{ */ + +/**@brief GAP API SVC numbers. + */ +enum BLE_GAP_SVCS +{ + SD_BLE_GAP_ADDRESS_SET = BLE_GAP_SVC_BASE, /**< Set own Bluetooth Address. */ + SD_BLE_GAP_ADDRESS_GET, /**< Get own Bluetooth Address. */ + SD_BLE_GAP_ADV_DATA_SET, /**< Set Advertising Data. */ + SD_BLE_GAP_ADV_START, /**< Start Advertising. */ + SD_BLE_GAP_ADV_STOP, /**< Stop Advertising. */ + SD_BLE_GAP_CONN_PARAM_UPDATE, /**< Connection Parameter Update. */ + SD_BLE_GAP_DISCONNECT, /**< Disconnect. */ + SD_BLE_GAP_TX_POWER_SET, /**< Set TX Power. */ + SD_BLE_GAP_APPEARANCE_SET, /**< Set Appearance. */ + SD_BLE_GAP_APPEARANCE_GET, /**< Get Appearance. */ + SD_BLE_GAP_PPCP_SET, /**< Set PPCP. */ + SD_BLE_GAP_PPCP_GET, /**< Get PPCP. */ + SD_BLE_GAP_DEVICE_NAME_SET, /**< Set Device Name. */ + SD_BLE_GAP_DEVICE_NAME_GET, /**< Get Device Name. */ + SD_BLE_GAP_AUTHENTICATE, /**< Initiate Pairing/Bonding. */ + SD_BLE_GAP_SEC_PARAMS_REPLY, /**< Reply with Security Parameters. */ + SD_BLE_GAP_AUTH_KEY_REPLY, /**< Reply with an authentication key. */ + SD_BLE_GAP_LESC_DHKEY_REPLY, /**< Reply with an LE Secure Connections DHKey. */ + SD_BLE_GAP_KEYPRESS_NOTIFY, /**< Notify of a keypress during an authentication procedure. */ + SD_BLE_GAP_LESC_OOB_DATA_GET, /**< Get the local LE Secure Connections OOB data. */ + SD_BLE_GAP_LESC_OOB_DATA_SET, /**< Set the remote LE Secure Connections OOB data. */ + SD_BLE_GAP_ENCRYPT, /**< Initiate encryption procedure. */ + SD_BLE_GAP_SEC_INFO_REPLY, /**< Reply with Security Information. */ + SD_BLE_GAP_CONN_SEC_GET, /**< Obtain connection security level. */ + SD_BLE_GAP_RSSI_START, /**< Start reporting of changes in RSSI. */ + SD_BLE_GAP_RSSI_STOP, /**< Stop reporting of changes in RSSI. */ + SD_BLE_GAP_SCAN_START, /**< Start Scanning. */ + SD_BLE_GAP_SCAN_STOP, /**< Stop Scanning. */ + SD_BLE_GAP_CONNECT, /**< Connect. */ + SD_BLE_GAP_CONNECT_CANCEL, /**< Cancel ongoing connection procedure. */ + SD_BLE_GAP_RSSI_GET, /**< Get the last RSSI sample. */ +}; + +/**@brief GAP Event IDs. + * IDs that uniquely identify an event coming from the stack to the application. + */ +enum BLE_GAP_EVTS +{ + BLE_GAP_EVT_CONNECTED = BLE_GAP_EVT_BASE, /**< Connection established. \n See @ref ble_gap_evt_connected_t. */ + BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. \n See @ref ble_gap_evt_disconnected_t. */ + BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. \n See @ref ble_gap_evt_conn_param_update_t. */ + BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. \n Reply with @ref sd_ble_gap_sec_params_reply. \n See @ref ble_gap_evt_sec_params_request_t. */ + BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. \n Reply with @ref sd_ble_gap_sec_info_reply. \n See @ref ble_gap_evt_sec_info_request_t. */ + BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. \n In LESC Numeric Comparison, reply with @ref sd_ble_gap_auth_key_reply. \n See @ref ble_gap_evt_passkey_display_t. */ + BLE_GAP_EVT_KEY_PRESSED, /**< Notification of a keypress on the remote device.\n See @ref ble_gap_evt_key_pressed_t */ + BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. \n Reply with @ref sd_ble_gap_auth_key_reply. \n See @ref ble_gap_evt_auth_key_request_t. */ + BLE_GAP_EVT_LESC_DHKEY_REQUEST, /**< Request to calculate an LE Secure Connections DHKey. \n Reply with @ref sd_ble_gap_lesc_dhkey_reply. \n See @ref ble_gap_evt_lesc_dhkey_request_t */ + BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. \n See @ref ble_gap_evt_auth_status_t. */ + BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. \n See @ref ble_gap_evt_conn_sec_update_t. */ + BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. \n See @ref ble_gap_evt_timeout_t. */ + BLE_GAP_EVT_RSSI_CHANGED, /**< RSSI report. \n See @ref ble_gap_evt_rssi_changed_t. */ + BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. \n See @ref ble_gap_evt_adv_report_t. */ + BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. \n See @ref ble_gap_evt_sec_request_t. */ + BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. \n Reply with @ref sd_ble_gap_conn_param_update. \n See @ref ble_gap_evt_conn_param_update_request_t. */ + BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. \n See @ref ble_gap_evt_scan_req_report_t. */ +}; + +/**@brief GAP Option IDs. + * IDs that uniquely identify a GAP option. + */ +enum BLE_GAP_OPTS +{ + BLE_GAP_OPT_CH_MAP = BLE_GAP_OPT_BASE, /**< Channel Map. @ref ble_gap_opt_ch_map_t */ + BLE_GAP_OPT_LOCAL_CONN_LATENCY, /**< Local connection latency. @ref ble_gap_opt_local_conn_latency_t */ + BLE_GAP_OPT_PASSKEY, /**< Set passkey. @ref ble_gap_opt_passkey_t */ + BLE_GAP_OPT_PRIVACY, /**< Custom privacy. @ref ble_gap_opt_privacy_t */ + BLE_GAP_OPT_SCAN_REQ_REPORT, /**< Scan request report. @ref ble_gap_opt_scan_req_report_t */ + BLE_GAP_OPT_COMPAT_MODE /**< Compatibility mode. @ref ble_gap_opt_compat_mode_t */ +}; + +/** @} */ + +/**@addtogroup BLE_GAP_DEFINES Defines + * @{ */ + +/**@defgroup BLE_ERRORS_GAP SVC return values specific to GAP + * @{ */ +#define BLE_ERROR_GAP_UUID_LIST_MISMATCH (NRF_GAP_ERR_BASE + 0x000) /**< UUID list does not contain an integral number of UUIDs. */ +#define BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST (NRF_GAP_ERR_BASE + 0x001) /**< Use of Whitelist not permitted with discoverable advertising. */ +#define BLE_ERROR_GAP_INVALID_BLE_ADDR (NRF_GAP_ERR_BASE + 0x002) /**< The upper two bits of the address do not correspond to the specified address type. */ +#define BLE_ERROR_GAP_WHITELIST_IN_USE (NRF_GAP_ERR_BASE + 0x003) /**< Attempt to overwrite the whitelist while already in use by another operation. */ +/**@} */ + + +/**@defgroup BLE_GAP_ROLES GAP Roles + * @note Not explicitly used in peripheral API, but will be relevant for central API. + * @{ */ +#define BLE_GAP_ROLE_INVALID 0x0 /**< Invalid Role. */ +#define BLE_GAP_ROLE_PERIPH 0x1 /**< Peripheral Role. */ +#define BLE_GAP_ROLE_CENTRAL 0x2 /**< Central Role. */ +/**@} */ + + +/**@defgroup BLE_GAP_TIMEOUT_SOURCES GAP Timeout sources + * @{ */ +#define BLE_GAP_TIMEOUT_SRC_ADVERTISING 0x00 /**< Advertising timeout. */ +#define BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST 0x01 /**< Security request timeout. */ +#define BLE_GAP_TIMEOUT_SRC_SCAN 0x02 /**< Scanning timeout. */ +#define BLE_GAP_TIMEOUT_SRC_CONN 0x03 /**< Connection timeout. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADDR_TYPES GAP Address types + * @{ */ +#define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random Static address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE 0x02 /**< Private Resolvable address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**< Private Non-Resolvable address. */ +/**@} */ + +/**@defgroup BLE_GAP_ADDR_CYCLE_MODES GAP Address cycle modes + * @{ */ +#define BLE_GAP_ADDR_CYCLE_MODE_NONE 0x00 /**< Set addresses directly, no automatic address cycling. */ +#define BLE_GAP_ADDR_CYCLE_MODE_AUTO 0x01 /**< Automatically generate and update private addresses. */ +/** @} */ + +/**@brief The default interval in seconds at which a private address is refreshed when address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO. */ +#define BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S (60 * 15) + +/** @brief BLE address length. */ +#define BLE_GAP_ADDR_LEN 6 + + +/**@defgroup BLE_GAP_AD_TYPE_DEFINITIONS GAP Advertising and Scan Response Data format + * @note Found at https://www.bluetooth.org/Technical/AssignedNumbers/generic_access_profile.htm + * @{ */ +#define BLE_GAP_AD_TYPE_FLAGS 0x01 /**< Flags for discoverability. */ +#define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE 0x02 /**< Partial list of 16 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE 0x03 /**< Complete list of 16 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_MORE_AVAILABLE 0x04 /**< Partial list of 32 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE 0x05 /**< Complete list of 32 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE 0x06 /**< Partial list of 128 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE 0x07 /**< Complete list of 128 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME 0x08 /**< Short local device name. */ +#define BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME 0x09 /**< Complete local device name. */ +#define BLE_GAP_AD_TYPE_TX_POWER_LEVEL 0x0A /**< Transmit power level. */ +#define BLE_GAP_AD_TYPE_CLASS_OF_DEVICE 0x0D /**< Class of device. */ +#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C 0x0E /**< Simple Pairing Hash C. */ +#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R 0x0F /**< Simple Pairing Randomizer R. */ +#define BLE_GAP_AD_TYPE_SECURITY_MANAGER_TK_VALUE 0x10 /**< Security Manager TK Value. */ +#define BLE_GAP_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS 0x11 /**< Security Manager Out Of Band Flags. */ +#define BLE_GAP_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE 0x12 /**< Slave Connection Interval Range. */ +#define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT 0x14 /**< List of 16-bit Service Solicitation UUIDs. */ +#define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT 0x15 /**< List of 128-bit Service Solicitation UUIDs. */ +#define BLE_GAP_AD_TYPE_SERVICE_DATA 0x16 /**< Service Data - 16-bit UUID. */ +#define BLE_GAP_AD_TYPE_PUBLIC_TARGET_ADDRESS 0x17 /**< Public Target Address. */ +#define BLE_GAP_AD_TYPE_RANDOM_TARGET_ADDRESS 0x18 /**< Random Target Address. */ +#define BLE_GAP_AD_TYPE_APPEARANCE 0x19 /**< Appearance. */ +#define BLE_GAP_AD_TYPE_ADVERTISING_INTERVAL 0x1A /**< Advertising Interval. */ +#define BLE_GAP_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS 0x1B /**< LE Bluetooth Device Address. */ +#define BLE_GAP_AD_TYPE_LE_ROLE 0x1C /**< LE Role. */ +#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C256 0x1D /**< Simple Pairing Hash C-256. */ +#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R256 0x1E /**< Simple Pairing Randomizer R-256. */ +#define BLE_GAP_AD_TYPE_SERVICE_DATA_32BIT_UUID 0x20 /**< Service Data - 32-bit UUID. */ +#define BLE_GAP_AD_TYPE_SERVICE_DATA_128BIT_UUID 0x21 /**< Service Data - 128-bit UUID. */ +#define BLE_GAP_AD_TYPE_URI 0x24 /**< URI */ +#define BLE_GAP_AD_TYPE_3D_INFORMATION_DATA 0x3D /**< 3D Information Data. */ +#define BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFF /**< Manufacturer Specific Data. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADV_FLAGS GAP Advertisement Flags + * @{ */ +#define BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE (0x01) /**< LE Limited Discoverable Mode. */ +#define BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE (0x02) /**< LE General Discoverable Mode. */ +#define BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED (0x04) /**< BR/EDR not supported. */ +#define BLE_GAP_ADV_FLAG_LE_BR_EDR_CONTROLLER (0x08) /**< Simultaneous LE and BR/EDR, Controller. */ +#define BLE_GAP_ADV_FLAG_LE_BR_EDR_HOST (0x10) /**< Simultaneous LE and BR/EDR, Host. */ +#define BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE (BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) /**< LE Limited Discoverable Mode, BR/EDR not supported. */ +#define BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE (BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) /**< LE General Discoverable Mode, BR/EDR not supported. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADV_INTERVALS GAP Advertising interval max and min + * @{ */ +#define BLE_GAP_ADV_INTERVAL_MIN 0x0020 /**< Minimum Advertising interval in 625 us units, i.e. 20 ms. */ +#define BLE_GAP_ADV_NONCON_INTERVAL_MIN 0x00A0 /**< Minimum Advertising interval in 625 us units for non connectable mode, i.e. 100 ms. */ +#define BLE_GAP_ADV_INTERVAL_MAX 0x4000 /**< Maximum Advertising interval in 625 us units, i.e. 10.24 s. */ + /**@} */ + + +/**@defgroup BLE_GAP_SCAN_INTERVALS GAP Scan interval max and min + * @{ */ +#define BLE_GAP_SCAN_INTERVAL_MIN 0x0004 /**< Minimum Scan interval in 625 us units, i.e. 2.5 ms. */ +#define BLE_GAP_SCAN_INTERVAL_MAX 0x4000 /**< Maximum Scan interval in 625 us units, i.e. 10.24 s. */ + /** @} */ + + +/**@defgroup BLE_GAP_SCAN_WINDOW GAP Scan window max and min + * @{ */ +#define BLE_GAP_SCAN_WINDOW_MIN 0x0004 /**< Minimum Scan window in 625 us units, i.e. 2.5 ms. */ +#define BLE_GAP_SCAN_WINDOW_MAX 0x4000 /**< Maximum Scan window in 625 us units, i.e. 10.24 s. */ + /** @} */ + + +/**@defgroup BLE_GAP_SCAN_TIMEOUT GAP Scan timeout max and min + * @{ */ +#define BLE_GAP_SCAN_TIMEOUT_MIN 0x0001 /**< Minimum Scan timeout in seconds. */ +#define BLE_GAP_SCAN_TIMEOUT_MAX 0xFFFF /**< Maximum Scan timeout in seconds. */ + /** @} */ + + +/**@brief Maximum size of advertising data in octets. */ +#define BLE_GAP_ADV_MAX_SIZE 31 + + +/**@defgroup BLE_GAP_ADV_TYPES GAP Advertising types + * @{ */ +#define BLE_GAP_ADV_TYPE_ADV_IND 0x00 /**< Connectable undirected. */ +#define BLE_GAP_ADV_TYPE_ADV_DIRECT_IND 0x01 /**< Connectable directed. */ +#define BLE_GAP_ADV_TYPE_ADV_SCAN_IND 0x02 /**< Scannable undirected. */ +#define BLE_GAP_ADV_TYPE_ADV_NONCONN_IND 0x03 /**< Non connectable undirected. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADV_FILTER_POLICIES GAP Advertising filter policies + * @{ */ +#define BLE_GAP_ADV_FP_ANY 0x00 /**< Allow scan requests and connect requests from any device. */ +#define BLE_GAP_ADV_FP_FILTER_SCANREQ 0x01 /**< Filter scan requests with whitelist. */ +#define BLE_GAP_ADV_FP_FILTER_CONNREQ 0x02 /**< Filter connect requests with whitelist. */ +#define BLE_GAP_ADV_FP_FILTER_BOTH 0x03 /**< Filter both scan and connect requests with whitelist. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADV_TIMEOUT_VALUES GAP Advertising timeout values + * @{ */ +#define BLE_GAP_ADV_TIMEOUT_LIMITED_MAX 180 /**< Maximum advertising time in limited discoverable mode (TGAP(lim_adv_timeout) = 180s). */ +#define BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED 0 /**< Unlimited advertising in general discoverable mode. */ +/**@} */ + + +/**@defgroup BLE_GAP_DISC_MODES GAP Discovery modes + * @{ */ +#define BLE_GAP_DISC_MODE_NOT_DISCOVERABLE 0x00 /**< Not discoverable discovery Mode. */ +#define BLE_GAP_DISC_MODE_LIMITED 0x01 /**< Limited Discovery Mode. */ +#define BLE_GAP_DISC_MODE_GENERAL 0x02 /**< General Discovery Mode. */ +/**@} */ + +/**@defgroup BLE_GAP_IO_CAPS GAP IO Capabilities + * @{ */ +#define BLE_GAP_IO_CAPS_DISPLAY_ONLY 0x00 /**< Display Only. */ +#define BLE_GAP_IO_CAPS_DISPLAY_YESNO 0x01 /**< Display and Yes/No entry. */ +#define BLE_GAP_IO_CAPS_KEYBOARD_ONLY 0x02 /**< Keyboard Only. */ +#define BLE_GAP_IO_CAPS_NONE 0x03 /**< No I/O capabilities. */ +#define BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY 0x04 /**< Keyboard and Display. */ +/**@} */ + +/**@defgroup BLE_GAP_AUTH_KEY_TYPES GAP Authentication Key Types + * @{ */ +#define BLE_GAP_AUTH_KEY_TYPE_NONE 0x00 /**< No key (may be used to reject). */ +#define BLE_GAP_AUTH_KEY_TYPE_PASSKEY 0x01 /**< 6-digit Passkey. */ +#define BLE_GAP_AUTH_KEY_TYPE_OOB 0x02 /**< Out Of Band data. */ +/**@} */ + +/**@defgroup BLE_GAP_KP_NOT_TYPES GAP Keypress Notification Types + * @{ */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_START 0x00 /**< Passkey entry started. */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_DIGIT_IN 0x01 /**< Passkey digit entered. */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_DIGIT_OUT 0x02 /**< Passkey digit erased. */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_CLEAR 0x03 /**< Passkey cleared. */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_END 0x04 /**< Passkey entry completed. */ +/**@} */ + +/**@defgroup BLE_GAP_SEC_STATUS GAP Security status + * @{ */ +#define BLE_GAP_SEC_STATUS_SUCCESS 0x00 /**< Procedure completed with success. */ +#define BLE_GAP_SEC_STATUS_TIMEOUT 0x01 /**< Procedure timed out. */ +#define BLE_GAP_SEC_STATUS_PDU_INVALID 0x02 /**< Invalid PDU received. */ +#define BLE_GAP_SEC_STATUS_RFU_RANGE1_BEGIN 0x03 /**< Reserved for Future Use range #1 begin. */ +#define BLE_GAP_SEC_STATUS_RFU_RANGE1_END 0x80 /**< Reserved for Future Use range #1 end. */ +#define BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED 0x81 /**< Passkey entry failed (user cancelled or other). */ +#define BLE_GAP_SEC_STATUS_OOB_NOT_AVAILABLE 0x82 /**< Out of Band Key not available. */ +#define BLE_GAP_SEC_STATUS_AUTH_REQ 0x83 /**< Authentication requirements not met. */ +#define BLE_GAP_SEC_STATUS_CONFIRM_VALUE 0x84 /**< Confirm value failed. */ +#define BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP 0x85 /**< Pairing not supported. */ +#define BLE_GAP_SEC_STATUS_ENC_KEY_SIZE 0x86 /**< Encryption key size. */ +#define BLE_GAP_SEC_STATUS_SMP_CMD_UNSUPPORTED 0x87 /**< Unsupported SMP command. */ +#define BLE_GAP_SEC_STATUS_UNSPECIFIED 0x88 /**< Unspecified reason. */ +#define BLE_GAP_SEC_STATUS_REPEATED_ATTEMPTS 0x89 /**< Too little time elapsed since last attempt. */ +#define BLE_GAP_SEC_STATUS_INVALID_PARAMS 0x8A /**< Invalid parameters. */ +#define BLE_GAP_SEC_STATUS_DHKEY_FAILURE 0x8B /**< DHKey check failure. */ +#define BLE_GAP_SEC_STATUS_NUM_COMP_FAILURE 0x8C /**< Numeric Comparison failure. */ +#define BLE_GAP_SEC_STATUS_BR_EDR_IN_PROG 0x8D /**< BR/EDR pairing in progress. */ +#define BLE_GAP_SEC_STATUS_X_TRANS_KEY_DISALLOWED 0x8E /**< BR/EDR Link Key cannot be used for LE keys. */ +#define BLE_GAP_SEC_STATUS_RFU_RANGE2_BEGIN 0x8F /**< Reserved for Future Use range #2 begin. */ +#define BLE_GAP_SEC_STATUS_RFU_RANGE2_END 0xFF /**< Reserved for Future Use range #2 end. */ +/**@} */ + +/**@defgroup BLE_GAP_SEC_STATUS_SOURCES GAP Security status sources + * @{ */ +#define BLE_GAP_SEC_STATUS_SOURCE_LOCAL 0x00 /**< Local failure. */ +#define BLE_GAP_SEC_STATUS_SOURCE_REMOTE 0x01 /**< Remote failure. */ +/**@} */ + +/**@defgroup BLE_GAP_CP_LIMITS GAP Connection Parameters Limits + * @{ */ +#define BLE_GAP_CP_MIN_CONN_INTVL_NONE 0xFFFF /**< No new minimum connection interval specified in connect parameters. */ +#define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest minimum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */ +#define BLE_GAP_CP_MIN_CONN_INTVL_MAX 0x0C80 /**< Highest minimum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */ +#define BLE_GAP_CP_MAX_CONN_INTVL_NONE 0xFFFF /**< No new maximum connection interval specified in connect parameters. */ +#define BLE_GAP_CP_MAX_CONN_INTVL_MIN 0x0006 /**< Lowest maximum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */ +#define BLE_GAP_CP_MAX_CONN_INTVL_MAX 0x0C80 /**< Highest maximum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */ +#define BLE_GAP_CP_SLAVE_LATENCY_MAX 0x01F3 /**< Highest slave latency permitted, in connection events. */ +#define BLE_GAP_CP_CONN_SUP_TIMEOUT_NONE 0xFFFF /**< No new supervision timeout specified in connect parameters. */ +#define BLE_GAP_CP_CONN_SUP_TIMEOUT_MIN 0x000A /**< Lowest supervision timeout permitted, in units of 10 ms, i.e. 100 ms. */ +#define BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX 0x0C80 /**< Highest supervision timeout permitted, in units of 10 ms, i.e. 32 s. */ +/**@} */ + + +/**@brief GAP device name maximum length. */ +#define BLE_GAP_DEVNAME_MAX_LEN 31 + +/**@brief Disable RSSI events for connections */ +#define BLE_GAP_RSSI_THRESHOLD_INVALID 0xFF + +/**@defgroup BLE_GAP_CONN_SEC_MODE_SET_MACROS GAP attribute security requirement setters + * + * See @ref ble_gap_conn_sec_mode_t. + * @{ */ +/**@brief Set sec_mode pointed to by ptr to have no access rights.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(ptr) do {(ptr)->sm = 0; (ptr)->lv = 0;} while(0) +/**@brief Set sec_mode pointed to by ptr to require no protection, open link.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_OPEN(ptr) do {(ptr)->sm = 1; (ptr)->lv = 1;} while(0) +/**@brief Set sec_mode pointed to by ptr to require encryption, but no MITM protection.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 2;} while(0) +/**@brief Set sec_mode pointed to by ptr to require encryption and MITM protection.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 3;} while(0) +/**@brief Set sec_mode pointed to by ptr to require LESC encryption and MITM protection.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 4;} while(0) +/**@brief Set sec_mode pointed to by ptr to require signing or encryption, no MITM protection needed.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 1;} while(0) +/**@brief Set sec_mode pointed to by ptr to require signing or encryption with MITM protection.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 2;} while(0) +/**@} */ + + +/**@brief GAP Security Random Number Length. */ +#define BLE_GAP_SEC_RAND_LEN 8 + +/**@brief GAP Security Key Length. */ +#define BLE_GAP_SEC_KEY_LEN 16 + +/**@brief GAP LE Secure Connections Elliptic Curve Diffie-Hellman P-256 Public Key Length. */ +#define BLE_GAP_LESC_P256_PK_LEN 64 + +/**@brief GAP LE Secure Connections Elliptic Curve Diffie-Hellman DHKey Length. */ +#define BLE_GAP_LESC_DHKEY_LEN 32 + +/**@brief GAP Passkey Length. */ +#define BLE_GAP_PASSKEY_LEN 6 + +/**@brief Maximum amount of addresses in a whitelist. */ +#define BLE_GAP_WHITELIST_ADDR_MAX_COUNT (8) + +/**@brief Maximum amount of IRKs in a whitelist. + * @note The number of IRKs is limited to 8, even if the hardware supports more. + */ +#define BLE_GAP_WHITELIST_IRK_MAX_COUNT (8) + +/**@defgroup GAP_SEC_MODES GAP Security Modes + * @{ */ +#define BLE_GAP_SEC_MODE 0x00 /**< No key (may be used to reject). */ +/**@} */ +/** @} */ + +/**@addtogroup BLE_GAP_STRUCTURES Structures + * @{ */ + +/** + * @brief BLE GAP initialization parameters. + */ +typedef struct +{ + uint8_t periph_conn_count; /**< Number of connections acting as a peripheral */ + uint8_t central_conn_count; /**< Number of connections acting as a central */ + uint8_t central_sec_count; /**< Number of SMP instances for all connections acting as a central. */ +} ble_gap_enable_params_t; + +/**@brief Bluetooth Low Energy address. */ +typedef struct +{ + uint8_t addr_type; /**< See @ref BLE_GAP_ADDR_TYPES. */ + uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */ +} ble_gap_addr_t; + + +/**@brief GAP connection parameters. + * + * @note When ble_conn_params_t is received in an event, both min_conn_interval and + * max_conn_interval will be equal to the connection interval set by the central. + * + * @note If both conn_sup_timeout and max_conn_interval are specified, then the following constraint applies: + * conn_sup_timeout * 4 > (1 + slave_latency) * max_conn_interval + * that corresponds to the following Bluetooth Spec requirement: + * The Supervision_Timeout in milliseconds shall be larger than + * (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds. + */ +typedef struct +{ + uint16_t min_conn_interval; /**< Minimum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/ + uint16_t max_conn_interval; /**< Maximum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/ + uint16_t slave_latency; /**< Slave Latency in number of connection events, see @ref BLE_GAP_CP_LIMITS.*/ + uint16_t conn_sup_timeout; /**< Connection Supervision Timeout in 10 ms units, see @ref BLE_GAP_CP_LIMITS.*/ +} ble_gap_conn_params_t; + + +/**@brief GAP connection security modes. + * + * Security Mode 0 Level 0: No access permissions at all (this level is not defined by the Bluetooth Core specification).\n + * Security Mode 1 Level 1: No security is needed (aka open link).\n + * Security Mode 1 Level 2: Encrypted link required, MITM protection not necessary.\n + * Security Mode 1 Level 3: MITM protected encrypted link required.\n + * Security Mode 1 Level 4: LESC MITM protected encrypted link required.\n + * Security Mode 2 Level 1: Signing or encryption required, MITM protection not necessary.\n + * Security Mode 2 Level 2: MITM protected signing required, unless link is MITM protected encrypted.\n + */ +typedef struct +{ + uint8_t sm : 4; /**< Security Mode (1 or 2), 0 for no permissions at all. */ + uint8_t lv : 4; /**< Level (1, 2, 3 or 4), 0 for no permissions at all. */ + +} ble_gap_conn_sec_mode_t; + + +/**@brief GAP connection security status.*/ +typedef struct +{ + ble_gap_conn_sec_mode_t sec_mode; /**< Currently active security mode for this connection.*/ + uint8_t encr_key_size; /**< Length of currently active encryption key, 7 to 16 octets (only applicable for bonding procedures). */ +} ble_gap_conn_sec_t; + + +/**@brief Identity Resolving Key. */ +typedef struct +{ + uint8_t irk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing IRK. */ +} ble_gap_irk_t; + + +/**@brief Whitelist structure. */ +typedef struct +{ + ble_gap_addr_t **pp_addrs; /**< Pointer to an array of device address pointers, pointing to addresses to be used in whitelist. NULL if none are given. */ + uint8_t addr_count; /**< Count of device addresses in array, up to @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. */ + ble_gap_irk_t **pp_irks; /**< Pointer to an array of Identity Resolving Key (IRK) pointers, each pointing to an IRK in the whitelist. NULL if none are given. */ + uint8_t irk_count; /**< Count of IRKs in array, up to @ref BLE_GAP_WHITELIST_IRK_MAX_COUNT. */ +} ble_gap_whitelist_t; + +/**@brief Channel mask for RF channels used in advertising. */ +typedef struct +{ + uint8_t ch_37_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 37 */ + uint8_t ch_38_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 38 */ + uint8_t ch_39_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 39 */ +} ble_gap_adv_ch_mask_t; + +/**@brief GAP advertising parameters.*/ +typedef struct +{ + uint8_t type; /**< See @ref BLE_GAP_ADV_TYPES. */ + ble_gap_addr_t *p_peer_addr; /**< For @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND mode only, known peer address. */ + uint8_t fp; /**< Filter Policy, see @ref BLE_GAP_ADV_FILTER_POLICIES. */ + ble_gap_whitelist_t *p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */ + uint16_t interval; /**< Advertising interval between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s), see @ref BLE_GAP_ADV_INTERVALS. + - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for high duty cycle directed advertising. + - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, set @ref BLE_GAP_ADV_INTERVAL_MIN <= interval <= @ref BLE_GAP_ADV_INTERVAL_MAX for low duty cycle advertising.*/ + uint16_t timeout; /**< Advertising timeout between 0x0001 and 0x3FFF in seconds, 0x0000 disables timeout. See also @ref BLE_GAP_ADV_TIMEOUT_VALUES. If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for High duty cycle directed advertising. */ + ble_gap_adv_ch_mask_t channel_mask; /**< Advertising channel mask. See @ref ble_gap_adv_ch_mask_t. */ +} ble_gap_adv_params_t; + + +/**@brief GAP scanning parameters. */ +typedef struct +{ + uint8_t active : 1; /**< If 1, perform active scanning (scan requests). */ + uint8_t selective : 1; /**< If 1, ignore unknown devices (non whitelisted). */ + ble_gap_whitelist_t * p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */ + uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + uint16_t timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ +} ble_gap_scan_params_t; + + +/** @brief Keys that can be exchanged during a bonding procedure. */ +typedef struct +{ + uint8_t enc : 1; /**< Long Term Key and Master Identification. */ + uint8_t id : 1; /**< Identity Resolving Key and Identity Address Information. */ + uint8_t sign : 1; /**< Connection Signature Resolving Key. */ + uint8_t link : 1; /**< Derive the Link Key from the LTK. */ +} ble_gap_sec_kdist_t; + + +/**@brief GAP security parameters. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Enable Man In The Middle protection. */ + uint8_t lesc : 1; /**< Enable LE Secure Connection pairing. */ + uint8_t keypress : 1; /**< Enable generation of keypress notifications. */ + uint8_t io_caps : 3; /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */ + uint8_t oob : 1; /**< Out Of Band data available. */ + uint8_t min_key_size; /**< Minimum encryption key size in octets between 7 and 16. If 0 then not applicable in this instance. */ + uint8_t max_key_size; /**< Maximum encryption key size in octets between min_key_size and 16. */ + ble_gap_sec_kdist_t kdist_own; /**< Key distribution bitmap: keys that the local device will distribute. */ + ble_gap_sec_kdist_t kdist_peer; /**< Key distribution bitmap: keys that the remote device will distribute. */ +} ble_gap_sec_params_t; + + +/**@brief GAP Encryption Information. */ +typedef struct +{ + uint8_t ltk[BLE_GAP_SEC_KEY_LEN]; /**< Long Term Key. */ + uint8_t lesc : 1; /**< Key generated using LE Secure Connections. */ + uint8_t auth : 1; /**< Authenticated Key. */ + uint8_t ltk_len : 6; /**< LTK length in octets. */ +} ble_gap_enc_info_t; + + +/**@brief GAP Master Identification. */ +typedef struct +{ + uint16_t ediv; /**< Encrypted Diversifier. */ + uint8_t rand[BLE_GAP_SEC_RAND_LEN]; /**< Random Number. */ +} ble_gap_master_id_t; + + +/**@brief GAP Signing Information. */ +typedef struct +{ + uint8_t csrk[BLE_GAP_SEC_KEY_LEN]; /**< Connection Signature Resolving Key. */ +} ble_gap_sign_info_t; + +/**@brief GAP LE Secure Connections P-256 Public Key. */ +typedef struct +{ + uint8_t pk[BLE_GAP_LESC_P256_PK_LEN]; /**< LE Secure Connections Elliptic Curve Diffie-Hellman P-256 Public Key. Stored in the standard SMP protocol format: {X,Y} both in little-endian. */ +} ble_gap_lesc_p256_pk_t; + +/**@brief GAP LE Secure Connections DHKey. */ +typedef struct +{ + uint8_t key[BLE_GAP_LESC_DHKEY_LEN]; /**< LE Secure Connections Elliptic Curve Diffie-Hellman Key. Stored in little-endian. */ +} ble_gap_lesc_dhkey_t; + +/**@brief GAP LE Secure Connections OOB data. */ +typedef struct +{ + ble_gap_addr_t addr; /**< Bluetooth address of the device. */ + uint8_t r[BLE_GAP_SEC_KEY_LEN]; /**< Random Number. */ + uint8_t c[BLE_GAP_SEC_KEY_LEN]; /**< Confirm Value. */ +} ble_gap_lesc_oob_data_t; + +/**@brief Event structure for @ref BLE_GAP_EVT_CONNECTED. */ +typedef struct +{ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ + ble_gap_addr_t own_addr; /**< Bluetooth address of the local device used during connection setup. */ + uint8_t role; /**< BLE role for this connection, see @ref BLE_GAP_ROLES */ + uint8_t irk_match :1; /**< If 1, peer device's address resolved using an IRK. */ + uint8_t irk_match_idx :7; /**< Index in IRK list where the address was matched. */ + ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ +} ble_gap_evt_connected_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_DISCONNECTED. */ +typedef struct +{ + uint8_t reason; /**< HCI error code, see @ref BLE_HCI_STATUS_CODES. */ +} ble_gap_evt_disconnected_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE. */ +typedef struct +{ + ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ +} ble_gap_evt_conn_param_update_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. */ +typedef struct +{ + ble_gap_sec_params_t peer_params; /**< Initiator Security Parameters. */ +} ble_gap_evt_sec_params_request_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_SEC_INFO_REQUEST. */ +typedef struct +{ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ + ble_gap_master_id_t master_id; /**< Master Identification for LTK lookup. */ + uint8_t enc_info : 1; /**< If 1, Encryption Information required. */ + uint8_t id_info : 1; /**< If 1, Identity Information required. */ + uint8_t sign_info : 1; /**< If 1, Signing Information required. */ +} ble_gap_evt_sec_info_request_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_PASSKEY_DISPLAY. */ +typedef struct +{ + uint8_t passkey[BLE_GAP_PASSKEY_LEN]; /**< 6-digit passkey in ASCII ('0'-'9' digits only). */ + uint8_t match_request : 1; /**< If 1 requires the application to report the match using @ref sd_ble_gap_auth_key_reply + with either @ref BLE_GAP_AUTH_KEY_TYPE_NONE if there is no match or + @ref BLE_GAP_AUTH_KEY_TYPE_PASSKEY if there is a match. */ +} ble_gap_evt_passkey_display_t; + +/**@brief Event structure for @ref BLE_GAP_EVT_KEY_PRESSED. */ +typedef struct +{ + uint8_t kp_not; /**< Keypress notification type, see @ref BLE_GAP_KP_NOT_TYPES. */ +} ble_gap_evt_key_pressed_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_AUTH_KEY_REQUEST. */ +typedef struct +{ + uint8_t key_type; /**< See @ref BLE_GAP_AUTH_KEY_TYPES. */ +} ble_gap_evt_auth_key_request_t; + +/**@brief Event structure for @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST. */ +typedef struct +{ + ble_gap_lesc_p256_pk_t *p_pk_peer; /**< LE Secure Connections remote P-256 Public Key. This will point to the application-supplied memory + inside the keyset during the call to @ref sd_ble_gap_sec_params_reply. */ + uint8_t oobd_req :1; /**< LESC OOB data required. A call to @ref sd_ble_gap_lesc_oob_data_set is required to complete the procedure. */ +} ble_gap_evt_lesc_dhkey_request_t; + + +/**@brief Security levels supported. + * @note See Bluetooth Specification Version 4.2 Volume 3, Part C, Chapter 10, Section 10.2.1. +*/ +typedef struct +{ + uint8_t lv1 : 1; /**< If 1: Level 1 is supported. */ + uint8_t lv2 : 1; /**< If 1: Level 2 is supported. */ + uint8_t lv3 : 1; /**< If 1: Level 3 is supported. */ + uint8_t lv4 : 1; /**< If 1: Level 4 is supported. */ +} ble_gap_sec_levels_t; + + +/**@brief Encryption Key. */ +typedef struct +{ + ble_gap_enc_info_t enc_info; /**< Encryption Information. */ + ble_gap_master_id_t master_id; /**< Master Identification. */ +} ble_gap_enc_key_t; + + +/**@brief Identity Key. */ +typedef struct +{ + ble_gap_irk_t id_info; /**< Identity Information. */ + ble_gap_addr_t id_addr_info; /**< Identity Address Information. */ +} ble_gap_id_key_t; + + +/**@brief Security Keys. */ +typedef struct +{ + ble_gap_enc_key_t *p_enc_key; /**< Encryption Key, or NULL. */ + ble_gap_id_key_t *p_id_key; /**< Identity Key, or NULL. */ + ble_gap_sign_info_t *p_sign_key; /**< Signing Key, or NULL. */ + ble_gap_lesc_p256_pk_t *p_pk; /**< LE Secure Connections P-256 Public Key. When in debug mode the application must use the value defined + in the Core Bluetooth Specification v4.2 Vol.3, Part H, Section 2.3.5.6.1 */ +} ble_gap_sec_keys_t; + + +/**@brief Security key set for both local and peer keys. */ +typedef struct +{ + ble_gap_sec_keys_t keys_own; /**< Keys distributed by the local device. For LE Secure Connections the encryption key will be generated locally and will always be stored if bonding. */ + ble_gap_sec_keys_t keys_peer; /**< Keys distributed by the remote device. For LE Secure Connections, p_enc_key must always be NULL. */ +} ble_gap_sec_keyset_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_AUTH_STATUS. */ +typedef struct +{ + uint8_t auth_status; /**< Authentication status, see @ref BLE_GAP_SEC_STATUS. */ + uint8_t error_src : 2; /**< On error, source that caused the failure, see @ref BLE_GAP_SEC_STATUS_SOURCES. */ + uint8_t bonded : 1; /**< Procedure resulted in a bond. */ + ble_gap_sec_levels_t sm1_levels; /**< Levels supported in Security Mode 1. */ + ble_gap_sec_levels_t sm2_levels; /**< Levels supported in Security Mode 2. */ + ble_gap_sec_kdist_t kdist_own; /**< Bitmap stating which keys were exchanged (distributed) by the local device. If bonding with LE Secure Connections, the enc bit will be always set. */ + ble_gap_sec_kdist_t kdist_peer; /**< Bitmap stating which keys were exchanged (distributed) by the remote device. If bonding with LE Secure Connections, the enc bit will never be set. */ +} ble_gap_evt_auth_status_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_CONN_SEC_UPDATE. */ +typedef struct +{ + ble_gap_conn_sec_t conn_sec; /**< Connection security level. */ +} ble_gap_evt_conn_sec_update_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_TIMEOUT. */ +typedef struct +{ + uint8_t src; /**< Source of timeout event, see @ref BLE_GAP_TIMEOUT_SOURCES. */ +} ble_gap_evt_timeout_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_RSSI_CHANGED. */ +typedef struct +{ + int8_t rssi; /**< Received Signal Strength Indication in dBm. */ +} ble_gap_evt_rssi_changed_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_ADV_REPORT. */ +typedef struct +{ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ + int8_t rssi; /**< Received Signal Strength Indication in dBm. */ + uint8_t scan_rsp : 1; /**< If 1, the report corresponds to a scan response and the type field may be ignored. */ + uint8_t type : 2; /**< See @ref BLE_GAP_ADV_TYPES. Only valid if the scan_rsp field is 0. */ + uint8_t dlen : 5; /**< Advertising or scan response data length. */ + uint8_t data[BLE_GAP_ADV_MAX_SIZE]; /**< Advertising or scan response data. */ +} ble_gap_evt_adv_report_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_SEC_REQUEST. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Man In The Middle protection requested. */ + uint8_t lesc : 1; /**< LE Secure Connections requested. */ + uint8_t keypress : 1; /**< Generation of keypress notifications requested. */ +} ble_gap_evt_sec_request_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST. */ +typedef struct +{ + ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ +} ble_gap_evt_conn_param_update_request_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_SCAN_REQ_REPORT. */ +typedef struct +{ + int8_t rssi; /**< Received Signal Strength Indication in dBm. */ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ +} ble_gap_evt_scan_req_report_t; + + + +/**@brief GAP event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which event occurred. */ + union /**< union alternative identified by evt_id in enclosing struct. */ + { + ble_gap_evt_connected_t connected; /**< Connected Event Parameters. */ + ble_gap_evt_disconnected_t disconnected; /**< Disconnected Event Parameters. */ + ble_gap_evt_conn_param_update_t conn_param_update; /**< Connection Parameter Update Parameters. */ + ble_gap_evt_sec_params_request_t sec_params_request; /**< Security Parameters Request Event Parameters. */ + ble_gap_evt_sec_info_request_t sec_info_request; /**< Security Information Request Event Parameters. */ + ble_gap_evt_passkey_display_t passkey_display; /**< Passkey Display Event Parameters. */ + ble_gap_evt_key_pressed_t key_pressed; /**< Key Pressed Event Parameters. */ + ble_gap_evt_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */ + ble_gap_evt_lesc_dhkey_request_t lesc_dhkey_request; /**< LE Secure Connections DHKey calculation request. */ + ble_gap_evt_auth_status_t auth_status; /**< Authentication Status Event Parameters. */ + ble_gap_evt_conn_sec_update_t conn_sec_update; /**< Connection Security Update Event Parameters. */ + ble_gap_evt_timeout_t timeout; /**< Timeout Event Parameters. */ + ble_gap_evt_rssi_changed_t rssi_changed; /**< RSSI Event parameters. */ + ble_gap_evt_adv_report_t adv_report; /**< Advertising Report Event Parameters. */ + ble_gap_evt_sec_request_t sec_request; /**< Security Request Event Parameters. */ + ble_gap_evt_conn_param_update_request_t conn_param_update_request; /**< Connection Parameter Update Parameters. */ + ble_gap_evt_scan_req_report_t scan_req_report; /**< Scan Request Report parameters. */ + } params; /**< Event Parameters. */ + +} ble_gap_evt_t; + + +/**@brief Channel Map option. + * Used with @ref sd_ble_opt_get to get the current channel map + * or @ref sd_ble_opt_set to set a new channel map. When setting the + * channel map, it applies to all current and future connections. When getting the + * current channel map, it applies to a single connection and the connection handle + * must be supplied. + * + * @note Setting the channel map may take some time, depending on connection parameters. + * The time taken may be different for each connection and the get operation will + * return the previous channel map until the new one has taken effect. + * + * @note After setting the channel map, by spec it can not be set again until at least 1 s has passed. + * See Bluetooth Specification Version 4.1 Volume 2, Part E, Section 7.3.46. + * + * @retval ::NRF_SUCCESS Get or set successful. + * @retval ::NRF_ERROR_BUSY Channel map was set again before enough time had passed. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied for get. + * @retval ::NRF_ERROR_NOT_SUPPORTED Returned by sd_ble_opt_set in peripheral-only SoftDevices. + * + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle (only applicable for get) */ + uint8_t ch_map[5]; /**< Channel Map (37-bit). */ +} ble_gap_opt_ch_map_t; + + +/**@brief Local connection latency option. + * + * Local connection latency is a feature which enables the slave to improve + * current consumption by ignoring the slave latency set by the peer. The + * local connection latency can only be set to a multiple of the slave latency, + * and cannot be longer than half of the supervision timeout. + * + * Used with @ref sd_ble_opt_set to set the local connection latency. The + * @ref sd_ble_opt_get is not supported for this option, but the actual + * local connection latency (unless set to NULL) is set as a return parameter + * when setting the option. + * + * @note The latency set will be truncated down to the closest slave latency event + * multiple, or the nearest multiple before half of the supervision timeout. + * + * @note The local connection latency is disabled by default, and needs to be enabled for new + * connections and whenever the connection is updated. + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_NOT_SUPPORTED Get is not supported. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle */ + uint16_t requested_latency; /**< Requested local connection latency. */ + uint16_t * p_actual_latency; /**< Pointer to storage for the actual local connection latency (can be set to NULL to skip return value). */ +} ble_gap_opt_local_conn_latency_t; + + +/**@brief Passkey Option. + * + * Structure containing the passkey to be used during pairing. This can be used with @ref + * sd_ble_opt_set to make the SoftDevice use a pre-programmed passkey for authentication + * instead of generating a random one. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * + */ +typedef struct +{ + uint8_t * p_passkey; /**< Pointer to 6-digit ASCII string (digit 0..9 only, no NULL termination) passkey to be used during pairing. If this is NULL, the SoftDevice will generate a random passkey if required.*/ +} ble_gap_opt_passkey_t; + + +/**@brief Custom Privacy Option. + * + * This structure is used with both @ref sd_ble_opt_set (as input) and with + * @ref sd_ble_opt_get (as output). + * + * Structure containing: + * - A pointer to an IRK to set (if input), or a place to store a read IRK (if output). + * - A private address refresh cycle. + * + * @note The specified address cycle interval is used when the address cycle mode is + * @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO. If 0 is given, the address will not be automatically + * refreshed at all. The default interval is @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S. + * + * @note If the current address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address will immediately be + * refreshed when a custom privacy option is set. A new address can be generated manually by calling + * @ref sd_ble_gap_address_set with the same type again. + * + * @note If the IRK is updated, the new IRK becomes the one to be distributed in all + * bonding procedures performed after @ref sd_ble_opt_set returns. + * + * @retval ::NRF_SUCCESS Set or read successfully. + * @retval ::NRF_ERROR_INVALID_ADDR The pointer to IRK storage is invalid. + */ +typedef struct +{ + ble_gap_irk_t * p_irk; /**< When input: Pointer to custom IRK, or NULL to use/reset to the device's default IRK. When output: Pointer to where the current IRK is to be stored, or NULL to not read out the IRK. */ + uint16_t interval_s; /**< When input: Custom private address cycle interval in seconds. When output: The current private address cycle interval. */ +} ble_gap_opt_privacy_t; + + +/**@brief Scan request report option. + * + * This can be used with @ref sd_ble_opt_set to make the SoftDevice send + * @ref BLE_GAP_EVT_SCAN_REQ_REPORT events. + * + * @note Due to the limited space reserved for scan request report events, + * not all received scan requests will be reported. + * + * @note If whitelisting is used, only whitelisted requests are reported. + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_STATE When advertising is ongoing while the option is set. + */ +typedef struct +{ + uint8_t enable : 1; /**< Enable scan request reports. */ +} ble_gap_opt_scan_req_report_t; + +/**@brief Compatibility mode option. + * + * This can be used with @ref sd_ble_opt_set to enable and disable + * compatibility modes. Compatibility modes are disabled by default. + * + * @note Compatibility mode 1 enables interoperability with devices that do not support + * a value of 0 for the WinOffset parameter in the Link Layer CONNECT_REQ packet. + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_STATE When connection creation is ongoing while mode 1 is set. + */ +typedef struct +{ + uint8_t mode_1_enable : 1; /**< Enable compatibility mode 1.*/ +} ble_gap_opt_compat_mode_t; + +/**@brief Option structure for GAP options. */ +typedef union +{ + ble_gap_opt_ch_map_t ch_map; /**< Parameters for the Channel Map option. */ + ble_gap_opt_local_conn_latency_t local_conn_latency; /**< Parameters for the Local connection latency option */ + ble_gap_opt_passkey_t passkey; /**< Parameters for the Passkey option.*/ + ble_gap_opt_privacy_t privacy; /**< Parameters for the Custom privacy option. */ + ble_gap_opt_scan_req_report_t scan_req_report; /**< Parameters for the scan request report option.*/ + ble_gap_opt_compat_mode_t compat_mode; /**< Parameters for the compatibility mode option.*/ +} ble_gap_opt_t; +/**@} */ + + +/**@addtogroup BLE_GAP_FUNCTIONS Functions + * @{ */ + +/**@brief Set local Bluetooth address. + * + * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address type is required to + * be @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or + * @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. The given address is ignored and the + * SoftDevice will generate a new private address automatically every + * @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S seconds. If this API + * call is used again with the same parameters, the SoftDevice will immediately + * generate a new private address to replace the current address. + * + * @note If the application wishes to use a @ref BLE_GAP_ADDR_TYPE_PUBLIC or + * @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC address, the cycle mode must be + * @ref BLE_GAP_ADDR_CYCLE_MODE_NONE. + * + * @note By default the SoftDevice will set an address of type @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC upon being + * enabled. The address is a random number populated during the IC manufacturing process and remains unchanged + * for the lifetime of each IC. + * + * @note If this API function is called while advertising or scanning, the softdevice will immediately update the + * advertising or scanning address without the need to stop the procedure in the following cases: + * - If the previously set address is of type @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address + * is also of type @ref BLE_GAP_ADDR_TYPE_PUBLIC + * - If the previously set address is not @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address is + * also not @ref BLE_GAP_ADDR_TYPE_PUBLIC. + * If the address is changed from a @ref BLE_GAP_ADDR_TYPE_PUBLIC address to another type or from + * another type to a @ref BLE_GAP_ADDR_TYPE_PUBLIC address, the change will take effect the next + * time an advertising or scanning procedure is started. + * + * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_NONE and the application is + * using privacy, the application must take care to generate and set new private addresses + * periodically to comply with the Privacy specification in Bluetooth Core Spec. + * + * @mscs + * @mmsc{@ref BLE_GAP_ADV_MSC} + * @endmscs + * + * @param[in] addr_cycle_mode Address cycle mode, see @ref BLE_GAP_ADDR_CYCLE_MODES. + * @param[in] p_addr Pointer to address structure. + * + * @retval ::NRF_SUCCESS Address successfully set. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameters. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + */ +SVCALL(SD_BLE_GAP_ADDRESS_SET, uint32_t, sd_ble_gap_address_set(uint8_t addr_cycle_mode, ble_gap_addr_t const *p_addr)); + + +/**@brief Get local Bluetooth address. + * + * @param[out] p_addr Pointer to address structure to be filled in. + * + * @retval ::NRF_SUCCESS Address successfully retrieved. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_GAP_ADDRESS_GET, uint32_t, sd_ble_gap_address_get(ble_gap_addr_t *p_addr)); + + +/**@brief Set, clear or update advertising and scan response data. + * + * @note The format of the advertising data will be checked by this call to ensure interoperability. + * Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and + * duplicating the local name in the advertising data and scan response data. + * + * @note To clear the advertising data and set it to a 0-length packet, simply provide a valid pointer (p_data/p_sr_data) with its corresponding + * length (dlen/srdlen) set to 0. + * + * @note The call will fail if p_data and p_sr_data are both NULL since this would have no effect. + * + * @mscs + * @mmsc{@ref BLE_GAP_ADV_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @param[in] p_data Raw data to be placed in advertising packet. If NULL, no changes are made to the current advertising packet data. + * @param[in] dlen Data length for p_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_data is NULL, can be 0 if p_data is not NULL. + * @param[in] p_sr_data Raw data to be placed in scan response packet. If NULL, no changes are made to the current scan response packet data. + * @param[in] srdlen Data length for p_sr_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL. + * + * @retval ::NRF_SUCCESS Advertising data successfully updated or cleared. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, both p_data and p_sr_data cannot be NULL. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_FLAGS Invalid combination of advertising flags supplied. + * @retval ::NRF_ERROR_INVALID_DATA Invalid data type(s) supplied, check the advertising data format specification. + * @retval ::NRF_ERROR_INVALID_LENGTH Invalid data length(s) supplied. + * @retval ::NRF_ERROR_NOT_SUPPORTED Unsupported data type. + * @retval ::BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied. + */ +SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const *p_data, uint8_t dlen, uint8_t const *p_sr_data, uint8_t srdlen)); + + +/**@brief Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). + * + * @note An application can start an advertising procedure for broadcasting purposes while a connection + * is active. After a @ref BLE_GAP_EVT_CONNECTED event is received, this function may therefore + * be called to start a broadcast advertising procedure. The advertising procedure + * cannot however be connectable (it must be of type @ref BLE_GAP_ADV_TYPE_ADV_SCAN_IND or + * @ref BLE_GAP_ADV_TYPE_ADV_NONCONN_IND). @note Only one advertiser may be active at any time. + * + * @note To use the currently active whitelist set p_adv_params->p_whitelist to NULL. + * + * @events + * @event{@ref BLE_GAP_EVT_CONNECTED, Generated after connection has been established through connectable advertising.} + * @event{@ref BLE_GAP_EVT_TIMEOUT, Advertisement has timed out.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_ADV_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @param[in] p_adv_params Pointer to advertising parameters structure. + * + * @retval ::NRF_SUCCESS The BLE stack has started advertising. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_CONN_COUNT The limit of available connections has been reached; connectable advertiser cannot be started. + * @retval ::NRF_ERROR_NO_MEM The configured memory pools (see @ref ble_conn_bw_counts_t) are not large enough for the + * bandwidth selected for this connection. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check the accepted ranges and limits. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Bluetooth address supplied. + * @retval ::BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. + * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. + * Stop one or more currently active roles (Central, Peripheral or Observer) and try again + */ +SVCALL(SD_BLE_GAP_ADV_START, uint32_t, sd_ble_gap_adv_start(ble_gap_adv_params_t const *p_adv_params)); + + +/**@brief Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). + * + * @mscs + * @mmsc{@ref BLE_GAP_ADV_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS The BLE stack has stopped advertising. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in advertising state). + */ +SVCALL(SD_BLE_GAP_ADV_STOP, uint32_t, sd_ble_gap_adv_stop(void)); + + +/**@brief Update connection parameters. + * + * @details In the central role this will initiate a Link Layer connection parameter update procedure, + * otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for + * the central to perform the procedure. In both cases, and regardless of success or failure, the application + * will be informed of the result with a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE event. + * + * @details This function can be used as a central both to reply to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST or to start the procedure unrequested. + * + * @events + * @event{@ref BLE_GAP_EVT_CONN_PARAM_UPDATE, Result of the connection parameter update procedure.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CPU_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} + * @mmsc{@ref BLE_GAP_MULTILINK_CPU_MSC} + * @mmsc{@ref BLE_GAP_MULTILINK_CTRL_PROC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_CPU_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_conn_params Pointer to desired connection parameters. If NULL is provided on a peripheral role, + * the parameters in the PPCP characteristic of the GAP service will be used instead. + * If NULL is provided on a central role and in response to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, the peripheral request will be rejected + * + * @retval ::NRF_SUCCESS The Connection Update procedure has been started successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, process pending events and wait for pending procedures to complete and retry. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + */ +SVCALL(SD_BLE_GAP_CONN_PARAM_UPDATE, uint32_t, sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_t const *p_conn_params)); + + +/**@brief Disconnect (GAP Link Termination). + * + * @details This call initiates the disconnection procedure, and its completion will be communicated to the application + * with a @ref BLE_GAP_EVT_DISCONNECTED event. + * + * @events + * @event{@ref BLE_GAP_EVT_DISCONNECTED, Generated when disconnection procedure is complete.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CONN_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES (accepted values are @ref BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and @ref BLE_HCI_CONN_INTERVAL_UNACCEPTABLE). + * + * @retval ::NRF_SUCCESS The disconnection procedure has been started successfully. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (disconnection is already in progress). + */ +SVCALL(SD_BLE_GAP_DISCONNECT, uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code)); + + +/**@brief Set the radio's transmit power. + * + * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm). + * + * @note The -30dBm setting is only available on nRF51 series ICs. + * @note The -40dBm setting is only available on nRF52 series ICs. + * + * @retval ::NRF_SUCCESS Successfully changed the transmit power. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + */ +SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power)); + + +/**@brief Set GAP Appearance value. + * + * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES. + * + * @retval ::NRF_SUCCESS Appearance value set successfully. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + */ +SVCALL(SD_BLE_GAP_APPEARANCE_SET, uint32_t, sd_ble_gap_appearance_set(uint16_t appearance)); + + +/**@brief Get GAP Appearance value. + * + * @param[out] p_appearance Pointer to appearance (16-bit) to be filled in, see @ref BLE_APPEARANCES. + * + * @retval ::NRF_SUCCESS Appearance value retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_GAP_APPEARANCE_GET, uint32_t, sd_ble_gap_appearance_get(uint16_t *p_appearance)); + + +/**@brief Set GAP Peripheral Preferred Connection Parameters. + * + * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the desired parameters. + * + * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters set successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + */ +SVCALL(SD_BLE_GAP_PPCP_SET, uint32_t, sd_ble_gap_ppcp_set(ble_gap_conn_params_t const *p_conn_params)); + + +/**@brief Get GAP Peripheral Preferred Connection Parameters. + * + * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters will be stored. + * + * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_GAP_PPCP_GET, uint32_t, sd_ble_gap_ppcp_get(ble_gap_conn_params_t *p_conn_params)); + + +/**@brief Set GAP device name. + * + * @param[in] p_write_perm Write permissions for the Device Name characteristic, see @ref ble_gap_conn_sec_mode_t. + * @param[in] p_dev_name Pointer to a UTF-8 encoded, non NULL-terminated string. + * @param[in] len Length of the UTF-8, non NULL-terminated string pointed to by p_dev_name in octets (must be smaller or equal than @ref BLE_GAP_DEVNAME_MAX_LEN). + * + * @retval ::NRF_SUCCESS GAP device name and permissions set successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + */ +SVCALL(SD_BLE_GAP_DEVICE_NAME_SET, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len)); + + +/**@brief Get GAP device name. + * + * @note If the device name is longer than the size of the supplied buffer, + * p_len will return the complete device name length, + * and not the number of bytes actually returned in p_dev_name. + * The application may use this information to allocate a suitable buffer size. + * + * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8 non NULL-terminated string will be placed. Set to NULL to obtain the complete device name length. + * @param[in,out] p_len Length of the buffer pointed by p_dev_name, complete device name length on output. + * + * @retval ::NRF_SUCCESS GAP device name retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + */ +SVCALL(SD_BLE_GAP_DEVICE_NAME_GET, uint32_t, sd_ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_len)); + + +/**@brief Initiate the GAP Authentication procedure. + * + * @details In the central role, this function will send an SMP Pairing Request (or an SMP Pairing Failed if rejected), + * otherwise in the peripheral role, an SMP Security Request will be sent. + * + * @events + * @event{Depending on the security parameters set and the packet exchanges with the peer\, the following events may be generated:} + * @event{@ref BLE_GAP_EVT_SEC_PARAMS_REQUEST} + * @event{@ref BLE_GAP_EVT_SEC_INFO_REQUEST} + * @event{@ref BLE_GAP_EVT_PASSKEY_DISPLAY} + * @event{@ref BLE_GAP_EVT_KEY_PRESSED} + * @event{@ref BLE_GAP_EVT_AUTH_KEY_REQUEST} + * @event{@ref BLE_GAP_EVT_LESC_DHKEY_REQUEST} + * @event{@ref BLE_GAP_EVT_CONN_SEC_UPDATE} + * @event{@ref BLE_GAP_EVT_AUTH_STATUS} + * @event{@ref BLE_GAP_EVT_TIMEOUT} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_SEC_REQ_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_SEC_REQ_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_sec_params Pointer to the @ref ble_gap_sec_params_t structure with the security parameters to be used during the pairing or bonding procedure. + * In the peripheral role, only the bond, mitm, lesc and keypress fields of this structure are used. + * In the central role, this pointer may be NULL to reject a Security Request. + * + * @retval ::NRF_SUCCESS Successfully initiated authentication procedure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::NRF_ERROR_NO_MEM The maximum number of authentication procedures that can run in parallel for the given role is reached. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_NOT_SUPPORTED Setting of sign or link fields in @ref ble_gap_sec_kdist_t not supported. + * @retval ::NRF_ERROR_TIMEOUT A SMP timeout has occurred, and further SMP operations on this link is prohibited. + */ +SVCALL(SD_BLE_GAP_AUTHENTICATE, uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const *p_sec_params)); + + +/**@brief Reply with GAP security parameters. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. + * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. + * + * @events + * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_JW_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_PERIPH_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_CENTRAL_OOB_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_STATIC_PK_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_CONFIRM_FAIL_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_KS_TOO_SMALL_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_APP_ERROR_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_REMOTE_PAIRING_FAIL_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_TIMEOUT_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS. + * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters structure. In the central role this must be set to NULL, as the parameters have + * already been provided during a previous call to @ref sd_ble_gap_authenticate. + * @param[in,out] p_sec_keyset Pointer to a @ref ble_gap_sec_keyset_t security keyset structure. Any keys generated and/or distributed as a result of the ongoing security procedure + * will be stored into the memory referenced by the pointers inside this structure. The keys will be stored and available to the application + * upon reception of a @ref BLE_GAP_EVT_AUTH_STATUS event. + * Note that the SoftDevice expects the application to provide memory for storing the + * peer's keys. So it must be ensured that the relevant pointers inside this structure are not NULL. The pointers to the local key + * can, however, be NULL, in which case, the local key data will not be available to the application upon reception of the + * @ref BLE_GAP_EVT_AUTH_STATUS event. + * + * @retval ::NRF_SUCCESS Successfully accepted security parameter from the application. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_NOT_SUPPORTED Setting of sign or link fields in @ref ble_gap_sec_kdist_t not supported. + */ +SVCALL(SD_BLE_GAP_SEC_PARAMS_REPLY, uint32_t, sd_ble_gap_sec_params_reply(uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params, ble_gap_sec_keyset_t const *p_sec_keyset)); + + +/**@brief Reply with an authentication key. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_REQUEST or a @ref BLE_GAP_EVT_PASSKEY_DISPLAY, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. + * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. + * + * @events + * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_CENTRAL_OOB_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] key_type See @ref BLE_GAP_AUTH_KEY_TYPES. + * @param[in] p_key If key type is @ref BLE_GAP_AUTH_KEY_TYPE_NONE, then NULL. + * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_PASSKEY, then a 6-byte ASCII string (digit 0..9 only, no NULL termination) + * or NULL when confirming LE Secure Connections Numeric Comparison. + * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format. + * + * @retval ::NRF_SUCCESS Authentication key successfully set. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_AUTH_KEY_REPLY, uint32_t, sd_ble_gap_auth_key_reply(uint16_t conn_handle, uint8_t key_type, uint8_t const *p_key)); + +/**@brief Reply with an LE Secure connections DHKey. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. + * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. + * + * @events + * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_dhkey LE Secure Connections DHKey. + * + * @retval ::NRF_SUCCESS DHKey successfully set. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_LESC_DHKEY_REPLY, uint32_t, sd_ble_gap_lesc_dhkey_reply(uint16_t conn_handle, ble_gap_lesc_dhkey_t const *p_dhkey)); + +/**@brief Notify the peer of a local keypress. + * + * @details This function can only be used when an authentication procedure using LE Secure Connection is in progress. Calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] kp_not See @ref BLE_GAP_KP_NOT_TYPES. + * + * @retval ::NRF_SUCCESS Keypress notification successfully queued for transmission. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. Either not entering a passkey or keypresses have not been enabled by both peers. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_GAP_KEYPRESS_NOTIFY, uint32_t, sd_ble_gap_keypress_notify(uint16_t conn_handle, uint8_t kp_not)); + +/**@brief Generate a set of OOB data to send to a peer out of band. + * + * @note The @ref ble_gap_addr_t included in the OOB data returned will be the currently active one (or, if a connection has already been established, + * the one used during connection setup). The application may manually overwrite it with an updated value. + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. Can be BLE_CONN_HANDLE_INVALID if a BLE connection has not been established yet. + * @param[in] p_pk_own LE Secure Connections local P-256 Public Key. + * @param[out] p_oobd_own The OOB data to be sent out of band to a peer. + * + * @retval ::NRF_SUCCESS OOB data successfully generated. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_LESC_OOB_DATA_GET, uint32_t, sd_ble_gap_lesc_oob_data_get(uint16_t conn_handle, ble_gap_lesc_p256_pk_t const *p_pk_own, ble_gap_lesc_oob_data_t *p_oobd_own)); + +/**@brief Provide the OOB data sent/received out of band. + * + * @note At least one of the 2 pointers provided must be different from NULL. + * @note An authentication procedure with OOB selected as an algorithm must be in progress when calling this function. + * @note A @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST event with the oobd_req set to 1 must have been received prior to calling this function. + * + * @events + * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_oobd_own The OOB data sent out of band to a peer or NULL if none sent. + * @param[in] p_oobd_peer The OOB data received out of band from a peer or NULL if none received. + * + * @retval ::NRF_SUCCESS OOB data accepted. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_LESC_OOB_DATA_SET, uint32_t, sd_ble_gap_lesc_oob_data_set(uint16_t conn_handle, ble_gap_lesc_oob_data_t const *p_oobd_own, ble_gap_lesc_oob_data_t const *p_oobd_peer)); + +/**@brief Initiate GAP Encryption procedure. + * + * @details In the central role, this function will initiate the encryption procedure using the encryption information provided. + * + * @events + * @event{@ref BLE_GAP_EVT_CONN_SEC_UPDATE, The connection security has been updated.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_ENC_MSC} + * @mmsc{@ref BLE_GAP_MULTILINK_CTRL_PROC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_SEC_REQ_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_master_id Pointer to a @ref ble_gap_master_id_t master identification structure. + * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure. + * + * @retval ::NRF_SUCCESS Successfully initiated authentication procedure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. + * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, wait for pending procedures to complete and retry. + */ +SVCALL(SD_BLE_GAP_ENCRYPT, uint32_t, sd_ble_gap_encrypt(uint16_t conn_handle, ble_gap_master_id_t const *p_master_id, ble_gap_enc_info_t const *p_enc_info)); + + +/**@brief Reply with GAP security information. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_INFO_REQUEST, calling it at other times will result in @ref NRF_ERROR_INVALID_STATE. + * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. + * @note Data signing is not yet supported, and p_sign_info must therefore be NULL. + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_ENC_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure. May be NULL to signal none is available. + * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t identity information structure. May be NULL to signal none is available. + * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information structure. May be NULL to signal none is available. + * + * @retval ::NRF_SUCCESS Successfully accepted security information. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_SEC_INFO_REPLY, uint32_t, sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_t const *p_enc_info, ble_gap_irk_t const *p_id_info, ble_gap_sign_info_t const *p_sign_info)); + + +/**@brief Get the current connection security. + * + * @param[in] conn_handle Connection handle. + * @param[out] p_conn_sec Pointer to a @ref ble_gap_conn_sec_t structure to be filled in. + * + * @retval ::NRF_SUCCESS Current connection security successfully retrieved. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_CONN_SEC_GET, uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t *p_conn_sec)); + + +/**@brief Start reporting the received signal strength to the application. + * + * A new event is reported whenever the RSSI value changes, until @ref sd_ble_gap_rssi_stop is called. + * + * @events + * @event{@ref BLE_GAP_EVT_RSSI_CHANGED, New RSSI data available. How often the event is generated is + dependent on the settings of the threshold_dbm + and skip_count input parameters.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} + * @mmsc{@ref BLE_GAP_RSSI_FILT_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] threshold_dbm Minimum change in dBm before triggering the @ref BLE_GAP_EVT_RSSI_CHANGED event. Events are disabled if threshold_dbm equals @ref BLE_GAP_RSSI_THRESHOLD_INVALID. + * @param[in] skip_count Number of RSSI samples with a change of threshold_dbm or more before sending a new @ref BLE_GAP_EVT_RSSI_CHANGED event. + * + * @retval ::NRF_SUCCESS Successfully activated RSSI reporting. + * @retval ::NRF_ERROR_INVALID_STATE Disconnection in progress. Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_RSSI_START, uint32_t, sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count)); + + +/**@brief Stop reporting the received signal strength. + * + * @note An RSSI change detected before the call but not yet received by the application + * may be reported after @ref sd_ble_gap_rssi_stop has been called. + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} + * @mmsc{@ref BLE_GAP_RSSI_FILT_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * + * @retval ::NRF_SUCCESS Successfully deactivated RSSI reporting. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_RSSI_STOP, uint32_t, sd_ble_gap_rssi_stop(uint16_t conn_handle)); + + +/**@brief Get the received signal strength for the last connection event. + * + * @ref sd_ble_gap_rssi_start must be called to start reporting RSSI before using this function. @ref NRF_ERROR_NOT_FOUND + * will be returned until RSSI was sampled for the first time after calling @ref sd_ble_gap_rssi_start. + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored. + * + * @retval ::NRF_SUCCESS Successfully read the RSSI. + * @retval ::NRF_ERROR_NOT_FOUND No sample is available. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_INVALID_STATE RSSI reporting is not ongoing, or disconnection in progress. + */ +SVCALL(SD_BLE_GAP_RSSI_GET, uint32_t, sd_ble_gap_rssi_get(uint16_t conn_handle, int8_t *p_rssi)); + + +/**@brief Start scanning (GAP Discovery procedure, Observer Procedure). + * + * @note To use the currently active whitelist set p_scan_params->p_whitelist to NULL. + * + * @events + * @event{@ref BLE_GAP_EVT_ADV_REPORT, An advertising or scan response packet has been received.} + * @event{@ref BLE_GAP_EVT_TIMEOUT, Scanner has timed out.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_SCAN_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @param[in] p_scan_params Pointer to scan parameters structure. + * + * @retval ::NRF_SUCCESS Successfully initiated scanning procedure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. + * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. + * Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again + */ +SVCALL(SD_BLE_GAP_SCAN_START, uint32_t, sd_ble_gap_scan_start(ble_gap_scan_params_t const *p_scan_params)); + + +/**@brief Stop scanning (GAP Discovery procedure, Observer Procedure). + * + * @mscs + * @mmsc{@ref BLE_GAP_SCAN_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Successfully stopped scanning procedure. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in scanning state). + */ +SVCALL(SD_BLE_GAP_SCAN_STOP, uint32_t, sd_ble_gap_scan_stop(void)); + + +/**@brief Create a connection (GAP Link Establishment). + * + * @note To use the currently active whitelist set p_scan_params->p_whitelist to NULL. + * @note If a scanning procedure is currently in progress it will be automatically stopped when calling this function. + * + * @mscs + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_CONN_MSC} + * @endmscs + * + * @param[in] p_peer_addr Pointer to peer address. If the selective bit is set in @ref ble_gap_scan_params_t, then this must be NULL. + * @param[in] p_scan_params Pointer to scan parameters structure. + * @param[in] p_conn_params Pointer to desired connection parameters. + * + * @retval ::NRF_SUCCESS Successfully initiated connection procedure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid parameter(s) pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Peer address. + * @retval ::NRF_ERROR_CONN_COUNT The limit of available connections has been reached. + * @retval ::NRF_ERROR_NO_MEM The configured memory pool (see @ref ble_conn_bw_counts_t) is not large enough for the + * bandwidth selected for this connection. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. If another connection is being established + * wait for the corresponding @ref BLE_GAP_EVT_CONNECTED event before calling again. + * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. + * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. + * Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again + */ +SVCALL(SD_BLE_GAP_CONNECT, uint32_t, sd_ble_gap_connect(ble_gap_addr_t const *p_peer_addr, ble_gap_scan_params_t const *p_scan_params, ble_gap_conn_params_t const *p_conn_params)); + + +/**@brief Cancel a connection establishment. + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_CONN_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Successfully cancelled an ongoing connection procedure. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + */ +SVCALL(SD_BLE_GAP_CONNECT_CANCEL, uint32_t, sd_ble_gap_connect_cancel(void)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_BLE_GAP_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatt.h new file mode 100644 index 0000000000..c7023502bd --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatt.h @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_GATT Generic Attribute Profile (GATT) Common + @{ + @brief Common definitions and prototypes for the GATT interfaces. + */ + +#ifndef NRF_BLE_GATT_H__ +#define NRF_BLE_GATT_H__ + +#include "nrf_ble_types.h" +#include "nrf_ble_ranges.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup BLE_GATT_DEFINES Defines + * @{ */ + +/** @brief Default MTU size. */ +#define GATT_MTU_SIZE_DEFAULT 23 + +/** @brief Only the default MTU size of 23 is currently supported. */ +#define GATT_RX_MTU 23 + + +/**@brief Invalid Attribute Handle. */ +#define BLE_GATT_HANDLE_INVALID 0x0000 + +/**@brief First Attribute Handle. */ +#define BLE_GATT_HANDLE_START 0x0001 + +/**@brief Last Attribute Handle. */ +#define BLE_GATT_HANDLE_END 0xFFFF + +/** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources + * @{ */ +#define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */ +/** @} */ + +/** @defgroup BLE_GATT_WRITE_OPS GATT Write operations + * @{ */ +#define BLE_GATT_OP_INVALID 0x00 /**< Invalid Operation. */ +#define BLE_GATT_OP_WRITE_REQ 0x01 /**< Write Request. */ +#define BLE_GATT_OP_WRITE_CMD 0x02 /**< Write Command. */ +#define BLE_GATT_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */ +#define BLE_GATT_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */ +#define BLE_GATT_OP_EXEC_WRITE_REQ 0x05 /**< Execute Write Request. */ +/** @} */ + +/** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags + * @{ */ +#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00 +#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01 +/** @} */ + +/** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations + * @{ */ +#define BLE_GATT_HVX_INVALID 0x00 /**< Invalid Operation. */ +#define BLE_GATT_HVX_NOTIFICATION 0x01 /**< Handle Value Notification. */ +#define BLE_GATT_HVX_INDICATION 0x02 /**< Handle Value Indication. */ +/** @} */ + +/** @defgroup BLE_GATT_STATUS_CODES GATT Status Codes + * @{ */ +#define BLE_GATT_STATUS_SUCCESS 0x0000 /**< Success. */ +#define BLE_GATT_STATUS_UNKNOWN 0x0001 /**< Unknown or not applicable status. */ +#define BLE_GATT_STATUS_ATTERR_INVALID 0x0100 /**< ATT Error: Invalid Error Code. */ +#define BLE_GATT_STATUS_ATTERR_INVALID_HANDLE 0x0101 /**< ATT Error: Invalid Attribute Handle. */ +#define BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED 0x0102 /**< ATT Error: Read not permitted. */ +#define BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED 0x0103 /**< ATT Error: Write not permitted. */ +#define BLE_GATT_STATUS_ATTERR_INVALID_PDU 0x0104 /**< ATT Error: Used in ATT as Invalid PDU. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION 0x0105 /**< ATT Error: Authenticated link required. */ +#define BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED 0x0106 /**< ATT Error: Used in ATT as Request Not Supported. */ +#define BLE_GATT_STATUS_ATTERR_INVALID_OFFSET 0x0107 /**< ATT Error: Offset specified was past the end of the attribute. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION 0x0108 /**< ATT Error: Used in ATT as Insufficient Authorisation. */ +#define BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL 0x0109 /**< ATT Error: Used in ATT as Prepare Queue Full. */ +#define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A /**< ATT Error: Used in ATT as Attribute not found. */ +#define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG 0x010B /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE 0x010C /**< ATT Error: Encryption key size used is insufficient. */ +#define BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH 0x010D /**< ATT Error: Invalid value size. */ +#define BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR 0x010E /**< ATT Error: Very unlikely error. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION 0x010F /**< ATT Error: Encrypted link required. */ +#define BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE 0x0110 /**< ATT Error: Attribute type is not a supported grouping attribute. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES 0x0111 /**< ATT Error: Encrypted link required. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN 0x0112 /**< ATT Error: Reserved for Future Use range #1 begin. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END 0x017F /**< ATT Error: Reserved for Future Use range #1 end. */ +#define BLE_GATT_STATUS_ATTERR_APP_BEGIN 0x0180 /**< ATT Error: Application range begin. */ +#define BLE_GATT_STATUS_ATTERR_APP_END 0x019F /**< ATT Error: Application range end. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN 0x01A0 /**< ATT Error: Reserved for Future Use range #2 begin. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END 0x01DF /**< ATT Error: Reserved for Future Use range #2 end. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN 0x01E0 /**< ATT Error: Reserved for Future Use range #3 begin. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END 0x01FC /**< ATT Error: Reserved for Future Use range #3 end. */ +#define BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR 0x01FD /**< ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly configured. */ +#define BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG 0x01FE /**< ATT Common Profile and Service Error: Procedure Already in Progress. */ +#define BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE 0x01FF /**< ATT Common Profile and Service Error: Out Of Range. */ +/** @} */ + + +/** @defgroup BLE_GATT_CPF_FORMATS Characteristic Presentation Formats + * @note Found at http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml + * @{ */ +#define BLE_GATT_CPF_FORMAT_RFU 0x00 /**< Reserved For Future Use. */ +#define BLE_GATT_CPF_FORMAT_BOOLEAN 0x01 /**< Boolean. */ +#define BLE_GATT_CPF_FORMAT_2BIT 0x02 /**< Unsigned 2-bit integer. */ +#define BLE_GATT_CPF_FORMAT_NIBBLE 0x03 /**< Unsigned 4-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT8 0x04 /**< Unsigned 8-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT12 0x05 /**< Unsigned 12-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT16 0x06 /**< Unsigned 16-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT24 0x07 /**< Unsigned 24-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT32 0x08 /**< Unsigned 32-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT48 0x09 /**< Unsigned 48-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT64 0x0A /**< Unsigned 64-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT128 0x0B /**< Unsigned 128-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT8 0x0C /**< Signed 2-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT12 0x0D /**< Signed 12-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT16 0x0E /**< Signed 16-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT24 0x0F /**< Signed 24-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT32 0x10 /**< Signed 32-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT48 0x11 /**< Signed 48-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT64 0x12 /**< Signed 64-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT128 0x13 /**< Signed 128-bit integer. */ +#define BLE_GATT_CPF_FORMAT_FLOAT32 0x14 /**< IEEE-754 32-bit floating point. */ +#define BLE_GATT_CPF_FORMAT_FLOAT64 0x15 /**< IEEE-754 64-bit floating point. */ +#define BLE_GATT_CPF_FORMAT_SFLOAT 0x16 /**< IEEE-11073 16-bit SFLOAT. */ +#define BLE_GATT_CPF_FORMAT_FLOAT 0x17 /**< IEEE-11073 32-bit FLOAT. */ +#define BLE_GATT_CPF_FORMAT_DUINT16 0x18 /**< IEEE-20601 format. */ +#define BLE_GATT_CPF_FORMAT_UTF8S 0x19 /**< UTF-8 string. */ +#define BLE_GATT_CPF_FORMAT_UTF16S 0x1A /**< UTF-16 string. */ +#define BLE_GATT_CPF_FORMAT_STRUCT 0x1B /**< Opaque Structure. */ +/** @} */ + +/** @defgroup BLE_GATT_CPF_NAMESPACES GATT Bluetooth Namespaces + * @{ + */ +#define BLE_GATT_CPF_NAMESPACE_BTSIG 0x01 /**< Bluetooth SIG defined Namespace. */ +#define BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN 0x0000 /**< Namespace Description Unknown. */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATT_STRUCTURES Structures + * @{ */ + +/**@brief GATT Characteristic Properties. */ +typedef struct +{ + /* Standard properties */ + uint8_t broadcast :1; /**< Broadcasting of the value permitted. */ + uint8_t read :1; /**< Reading the value permitted. */ + uint8_t write_wo_resp :1; /**< Writing the value with Write Command permitted. */ + uint8_t write :1; /**< Writing the value with Write Request permitted. */ + uint8_t notify :1; /**< Notications of the value permitted. */ + uint8_t indicate :1; /**< Indications of the value permitted. */ + uint8_t auth_signed_wr :1; /**< Writing the value with Signed Write Command permitted. */ +} ble_gatt_char_props_t; + +/**@brief GATT Characteristic Extended Properties. */ +typedef struct +{ + /* Extended properties */ + uint8_t reliable_wr :1; /**< Writing the value with Queued Write operations permitted. */ + uint8_t wr_aux :1; /**< Writing the Characteristic User Description descriptor permitted. */ +} ble_gatt_char_ext_props_t; + +#ifdef __cplusplus +} +#endif +#endif // NRF_BLE_GATT_H__ + +/** @} */ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gattc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gattc.h new file mode 100644 index 0000000000..5aa20fe430 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gattc.h @@ -0,0 +1,572 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client + @{ + @brief Definitions and prototypes for the GATT Client interface. + */ + +#ifndef NRF_BLE_GATTC_H__ +#define NRF_BLE_GATTC_H__ + +#include "nrf_ble_gatt.h" +#include "nrf_ble_types.h" +#include "nrf_ble_ranges.h" +#include "nrf_svc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup BLE_GATTC_ENUMERATIONS Enumerations + * @{ */ + +/**@brief GATTC API SVC numbers. */ +enum BLE_GATTC_SVCS +{ + SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */ + SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */ + SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */ + SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */ + SD_BLE_GATTC_ATTR_INFO_DISCOVER, /**< Attribute Information Discovery. */ + SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */ + SD_BLE_GATTC_READ, /**< Generic read. */ + SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */ + SD_BLE_GATTC_WRITE, /**< Generic write. */ + SD_BLE_GATTC_HV_CONFIRM, /**< Handle Value Confirmation. */ +}; + +/** + * @brief GATT Client Event IDs. + */ +enum BLE_GATTC_EVTS +{ + BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. \n See @ref ble_gattc_evt_prim_srvc_disc_rsp_t. */ + BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. \n See @ref ble_gattc_evt_rel_disc_rsp_t. */ + BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. \n See @ref ble_gattc_evt_char_disc_rsp_t. */ + BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. \n See @ref ble_gattc_evt_desc_disc_rsp_t. */ + BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, /**< Attribute Information Response event. \n See @ref ble_gattc_evt_attr_info_disc_rsp_t. */ + BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. \n See @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t. */ + BLE_GATTC_EVT_READ_RSP, /**< Read Response event. \n See @ref ble_gattc_evt_read_rsp_t. */ + BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. \n See @ref ble_gattc_evt_char_vals_read_rsp_t. */ + BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. \n See @ref ble_gattc_evt_write_rsp_t. */ + BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. \n Confirm indication with @ref sd_ble_gattc_hv_confirm. \n See @ref ble_gattc_evt_hvx_t. */ + BLE_GATTC_EVT_TIMEOUT /**< Timeout event. \n See @ref ble_gattc_evt_timeout_t. */ +}; + +/** @} */ + +/** @addtogroup BLE_GATTC_DEFINES Defines + * @{ */ + +/** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC + * @{ */ +#define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000) /**< Procedure not Permitted. */ +/** @} */ + +/** @defgroup BLE_GATTC_ATTR_INFO_FORMAT Attribute Information Formats + * @{ */ +#define BLE_GATTC_ATTR_INFO_FORMAT_16BIT 1 /**< 16-bit Attribute Information Format. */ +#define BLE_GATTC_ATTR_INFO_FORMAT_128BIT 2 /**< 128-bit Attribute Information Format. */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATTC_STRUCTURES Structures + * @{ */ + +/**@brief Operation Handle Range. */ +typedef struct +{ + uint16_t start_handle; /**< Start Handle. */ + uint16_t end_handle; /**< End Handle. */ +} ble_gattc_handle_range_t; + + +/**@brief GATT service. */ +typedef struct +{ + ble_uuid_t uuid; /**< Service UUID. */ + ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */ +} ble_gattc_service_t; + + +/**@brief GATT include. */ +typedef struct +{ + uint16_t handle; /**< Include Handle. */ + ble_gattc_service_t included_srvc; /**< Handle of the included service. */ +} ble_gattc_include_t; + + +/**@brief GATT characteristic. */ +typedef struct +{ + ble_uuid_t uuid; /**< Characteristic UUID. */ + ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ + uint8_t char_ext_props : 1; /**< Extended properties present. */ + uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */ + uint16_t handle_value; /**< Handle of the Characteristic Value. */ +} ble_gattc_char_t; + + +/**@brief GATT descriptor. */ +typedef struct +{ + uint16_t handle; /**< Descriptor Handle. */ + ble_uuid_t uuid; /**< Descriptor UUID. */ +} ble_gattc_desc_t; + + +/**@brief Write Parameters. */ +typedef struct +{ + uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ + uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ + uint16_t handle; /**< Handle to the attribute to be written. */ + uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ + uint16_t len; /**< Length of data in bytes. */ + uint8_t *p_value; /**< Pointer to the value data. */ +} ble_gattc_write_params_t; + +/**@brief Attribute Information. */ +typedef struct +{ + uint16_t handle; /**< Attribute handle. */ + union { + ble_uuid_t uuid16; /**< 16-bit Attribute UUID. */ + ble_uuid128_t uuid128; /**< 128-bit Attribute UUID. */ + } info; +} ble_gattc_attr_info_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Service count. */ + ble_gattc_service_t services[1]; /**< Service data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_prim_srvc_disc_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_REL_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Include count. */ + ble_gattc_include_t includes[1]; /**< Include data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_rel_disc_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Characteristic count. */ + ble_gattc_char_t chars[1]; /**< Characteristic data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_char_disc_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_DESC_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Descriptor count. */ + ble_gattc_desc_t descs[1]; /**< Descriptor data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_desc_disc_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Attribute count. */ + uint8_t format; /**< Attribute information format, see @ref BLE_GATTC_ATTR_INFO_FORMAT. */ + ble_gattc_attr_info_t attr_info[1]; /**< Attribute information. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_attr_info_disc_rsp_t; + +/**@brief GATT read by UUID handle value pair. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + uint8_t *p_value; /**< Pointer to value, variable length (length available as value_len in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t). + Please note that this pointer is absolute to the memory provided by the user when retrieving the event, + so it will effectively point to a location inside the handle_value array. */ +} ble_gattc_handle_value_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */ +typedef struct +{ + uint16_t count; /**< Handle-Value Pair Count. */ + uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */ + ble_gattc_handle_value_t handle_value[1]; /**< Handle-Value(s) list. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_char_val_by_uuid_read_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_READ_RSP. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + uint16_t offset; /**< Offset of the attribute data. */ + uint16_t len; /**< Attribute data length. */ + uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_read_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */ +typedef struct +{ + uint16_t len; /**< Concatenated Attribute values length. */ + uint8_t values[1]; /**< Attribute values. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_char_vals_read_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_WRITE_RSP. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */ + uint16_t offset; /**< Data offset. */ + uint16_t len; /**< Data length. */ + uint8_t data[1]; /**< Data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_write_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_HVX. */ +typedef struct +{ + uint16_t handle; /**< Handle to which the HVx operation applies. */ + uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ + uint16_t len; /**< Attribute data length. */ + uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_hvx_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_TIMEOUT. */ +typedef struct +{ + uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ +} ble_gattc_evt_timeout_t; + +/**@brief GATTC event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which event occured. */ + uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ + uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases @ref BLE_GATT_HANDLE_INVALID. */ + union + { + ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */ + ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */ + ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */ + ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */ + ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */ + ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */ + ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */ + ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */ + ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */ + ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */ + ble_gattc_evt_attr_info_disc_rsp_t attr_info_disc_rsp; /**< Attribute Information Discovery Event Parameters. */ + } params; /**< Event Parameters. @note Only valid if @ref gatt_status == @ref BLE_GATT_STATUS_SUCCESS. */ +} ble_gattc_evt_t; +/** @} */ + +/** @addtogroup BLE_GATTC_FUNCTIONS Functions + * @{ */ + +/**@brief Initiate or continue a GATT Primary Service Discovery procedure. + * + * @details This function initiates or resumes a Primary Service discovery procedure, starting from the supplied handle. + * If the last service has not been reached, this function must be called again with an updated start handle value to continue the search. + * + * @note If any of the discovered services have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with + * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. + * + * @events + * @event{@ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_PRIM_SRVC_DISC_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] start_handle Handle to start searching from. + * @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, uint32_t, sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *p_srvc_uuid)); + + +/**@brief Initiate or continue a GATT Relationship Discovery procedure. + * + * @details This function initiates or resumes the Find Included Services sub-procedure. If the last included service has not been reached, + * this must be called again with an updated handle range to continue the search. + * + * @events + * @event{@ref BLE_GATTC_EVT_REL_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_REL_DISC_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); + + +/**@brief Initiate or continue a GATT Characteristic Discovery procedure. + * + * @details This function initiates or resumes a Characteristic discovery procedure. If the last Characteristic has not been reached, + * this must be called again with an updated handle range to continue the discovery. + * + * @note If any of the discovered characteristics have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with + * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. + * + * @events + * @event{@ref BLE_GATTC_EVT_CHAR_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_CHAR_DISC_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); + + +/**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure. + * + * @details This function initiates or resumes a Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached, + * this must be called again with an updated handle range to continue the discovery. + * + * @events + * @event{BLE_GATTC_EVT_DESC_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_DESC_DISC_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); + + +/**@brief Initiate or continue a GATT Read using Characteristic UUID procedure. + * + * @details This function initiates or resumes a Read using Characteristic UUID procedure. If the last Characteristic has not been reached, + * this must be called again with an updated handle range to continue the discovery. + * + * @events + * @event{BLE_GATTC_EVT_DESC_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_READ_UUID_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_uuid Pointer to a Characteristic value UUID to read. + * @param[in] p_handle_range A pointer to the range of handles to perform this procedure on. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, uint32_t, sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_t const *p_uuid, ble_gattc_handle_range_t const *p_handle_range)); + + +/**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure. + * + * @details This function initiates or resumes a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor + * to be read is longer than ATT_MTU - 1, this function must be called multiple times with appropriate offset to read the + * complete value. + * + * @events + * @event{@ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_VALUE_READ_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] handle The handle of the attribute to be read. + * @param[in] offset Offset into the attribute value to be read. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Read (Long) procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset)); + + +/**@brief Initiate a GATT Read Multiple Characteristic Values procedure. + * + * @details This function initiates a GATT Read Multiple Characteristic Values procedure. + * + * @events + * @event{@ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_READ_MULT_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read. + * @param[in] handle_count The number of handles in p_handles. + * + * @retval ::NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const *p_handles, uint16_t handle_count)); + + +/**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure. + * + * @details This function can perform all write procedures described in GATT. + * + * @note It is important to note that a write without response will consume an application buffer, and will therefore + * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write (with response) on the other hand will use the + * standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response + * has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. + * + * @events + * @event{@ref BLE_GATTC_EVT_WRITE_RSP, Generated when using write request or queued writes.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_VALUE_WRITE_MSC} + * @mmsc{@ref BLE_GATTC_VALUE_LONG_WRITE_MSC} + * @mmsc{@ref BLE_GATTC_VALUE_RELIABLE_WRITE_MSC} + * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_write_params A pointer to a write parameters structure. + * + * @retval ::NRF_SUCCESS Successfully started the Write procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + * @retval ::NRF_ERROR_BUSY Procedure already in progress. + * @retval ::BLE_ERROR_NO_TX_PACKETS No available application packets for this connection. + */ +SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params)); + + +/**@brief Send a Handle Value Confirmation to the GATT Server. + * + * @mscs + * @mmsc{@ref BLE_GATTC_HVI_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] handle The handle of the attribute in the indication. + * + * @retval ::NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no Indication pending to be confirmed. + * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle. + */ +SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle)); + +/**@brief Discovers information about a range of attributes on a GATT server. + * + * @events + * @event{@ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, Generated when information about a range of attributes has been received.} + * @endevents + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handle_range The range of handles to request information about. + * + * @retval ::NRF_SUCCESS Successfully started an attribute information discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid connection state + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_ATTR_INFO_DISCOVER, uint32_t, sd_ble_gattc_attr_info_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * p_handle_range)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif /* NRF_BLE_GATTC_H__ */ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatts.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatts.h new file mode 100644 index 0000000000..147d1a8fbf --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatts.h @@ -0,0 +1,725 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_GATTS Generic Attribute Profile (GATT) Server + @{ + @brief Definitions and prototypes for the GATTS interface. + */ + +#ifndef NRF_BLE_GATTS_H__ +#define NRF_BLE_GATTS_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 +extern "C" { +#endif + +/** @addtogroup BLE_GATTS_ENUMERATIONS Enumerations + * @{ */ + +/** + * @brief GATTS API SVC numbers. + */ +enum BLE_GATTS_SVCS +{ + SD_BLE_GATTS_SERVICE_ADD = BLE_GATTS_SVC_BASE, /**< Add a service. */ + SD_BLE_GATTS_INCLUDE_ADD, /**< Add an included service. */ + SD_BLE_GATTS_CHARACTERISTIC_ADD, /**< Add a characteristic. */ + SD_BLE_GATTS_DESCRIPTOR_ADD, /**< Add a generic attribute. */ + SD_BLE_GATTS_VALUE_SET, /**< Set an attribute value. */ + SD_BLE_GATTS_VALUE_GET, /**< Get an attribute value. */ + SD_BLE_GATTS_HVX, /**< Handle Value Notification or Indication. */ + SD_BLE_GATTS_SERVICE_CHANGED, /**< Perform a Service Changed Indication to one or more peers. */ + SD_BLE_GATTS_RW_AUTHORIZE_REPLY, /**< Reply to an authorization request for a read or write operation on one or more attributes. */ + SD_BLE_GATTS_SYS_ATTR_SET, /**< Set the persistent system attributes for a connection. */ + SD_BLE_GATTS_SYS_ATTR_GET, /**< Retrieve the persistent system attributes. */ + SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, /**< Retrieve the first valid user handle. */ + SD_BLE_GATTS_ATTR_GET /**< Retrieve the UUID and/or metadata of an attribute. */ +}; + +/** + * @brief GATT Server Event IDs. + */ +enum BLE_GATTS_EVTS +{ + BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE, /**< Write operation performed. \n See @ref ble_gatts_evt_write_t. */ + BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST, /**< Read/Write Authorization request. \n Reply with @ref sd_ble_gatts_rw_authorize_reply. \n See @ref ble_gatts_evt_rw_authorize_request_t. */ + BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending. \n Respond with @ref sd_ble_gatts_sys_attr_set. \n See @ref ble_gatts_evt_sys_attr_missing_t. */ + BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. \n See @ref ble_gatts_evt_hvc_t. */ + BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. No additional event structure applies. */ + BLE_GATTS_EVT_TIMEOUT /**< Peer failed to resonpond to an ATT request in time. \n See @ref ble_gatts_evt_timeout_t. */ +}; +/** @} */ + +/** @addtogroup BLE_GATTS_DEFINES Defines + * @{ */ + +/** @defgroup BLE_ERRORS_GATTS SVC return values specific to GATTS + * @{ */ +#define BLE_ERROR_GATTS_INVALID_ATTR_TYPE (NRF_GATTS_ERR_BASE + 0x000) /**< Invalid attribute type. */ +#define BLE_ERROR_GATTS_SYS_ATTR_MISSING (NRF_GATTS_ERR_BASE + 0x001) /**< System Attributes missing. */ +/** @} */ + +/** @defgroup BLE_GATTS_ATTR_LENS_MAX Maximum attribute lengths + * @{ */ +#define BLE_GATTS_FIX_ATTR_LEN_MAX (510) /**< Maximum length for fixed length Attribute Values. */ +#define BLE_GATTS_VAR_ATTR_LEN_MAX (512) /**< Maximum length for variable length Attribute Values. */ +/** @} */ + +/** @defgroup BLE_GATTS_SRVC_TYPES GATT Server Service Types + * @{ */ +#define BLE_GATTS_SRVC_TYPE_INVALID 0x00 /**< Invalid Service Type. */ +#define BLE_GATTS_SRVC_TYPE_PRIMARY 0x01 /**< Primary Service. */ +#define BLE_GATTS_SRVC_TYPE_SECONDARY 0x02 /**< Secondary Type. */ +/** @} */ + + +/** @defgroup BLE_GATTS_ATTR_TYPES GATT Server Attribute Types + * @{ */ +#define BLE_GATTS_ATTR_TYPE_INVALID 0x00 /**< Invalid Attribute Type. */ +#define BLE_GATTS_ATTR_TYPE_PRIM_SRVC_DECL 0x01 /**< Primary Service Declaration. */ +#define BLE_GATTS_ATTR_TYPE_SEC_SRVC_DECL 0x02 /**< Secondary Service Declaration. */ +#define BLE_GATTS_ATTR_TYPE_INC_DECL 0x03 /**< Include Declaration. */ +#define BLE_GATTS_ATTR_TYPE_CHAR_DECL 0x04 /**< Characteristic Declaration. */ +#define BLE_GATTS_ATTR_TYPE_CHAR_VAL 0x05 /**< Characteristic Value. */ +#define BLE_GATTS_ATTR_TYPE_DESC 0x06 /**< Descriptor. */ +#define BLE_GATTS_ATTR_TYPE_OTHER 0x07 /**< Other, non-GATT specific type. */ +/** @} */ + + +/** @defgroup BLE_GATTS_OPS GATT Server Operations + * @{ */ +#define BLE_GATTS_OP_INVALID 0x00 /**< Invalid Operation. */ +#define BLE_GATTS_OP_WRITE_REQ 0x01 /**< Write Request. */ +#define BLE_GATTS_OP_WRITE_CMD 0x02 /**< Write Command. */ +#define BLE_GATTS_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */ +#define BLE_GATTS_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */ +#define BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL 0x05 /**< Execute Write Request: Cancel all prepared writes. */ +#define BLE_GATTS_OP_EXEC_WRITE_REQ_NOW 0x06 /**< Execute Write Request: Immediately execute all prepared writes. */ +/** @} */ + +/** @defgroup BLE_GATTS_VLOCS GATT Value Locations + * @{ */ +#define BLE_GATTS_VLOC_INVALID 0x00 /**< Invalid Location. */ +#define BLE_GATTS_VLOC_STACK 0x01 /**< Attribute Value is located in stack memory, no user memory is required. */ +#define BLE_GATTS_VLOC_USER 0x02 /**< Attribute Value is located in user memory. This requires the user to maintain a valid buffer through the lifetime of the attribute, since the stack + will read and write directly to the memory using the pointer provided in the APIs. There are no alignment requirements for the buffer. */ +/** @} */ + +/** @defgroup BLE_GATTS_AUTHORIZE_TYPES GATT Server Authorization Types + * @{ */ +#define BLE_GATTS_AUTHORIZE_TYPE_INVALID 0x00 /**< Invalid Type. */ +#define BLE_GATTS_AUTHORIZE_TYPE_READ 0x01 /**< Authorize a Read Operation. */ +#define BLE_GATTS_AUTHORIZE_TYPE_WRITE 0x02 /**< Authorize a Write Request Operation. */ +/** @} */ + +/** @defgroup BLE_GATTS_SYS_ATTR_FLAGS System Attribute Flags + * @{ */ +#define BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS (1 << 0) /**< Restrict system attributes to system services only. */ +#define BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS (1 << 1) /**< Restrict system attributes to user services only. */ +/** @} */ + +/** @defgroup BLE_GATTS_ATTR_TAB_SIZE Attribute Table size + * @{ + */ +#define BLE_GATTS_ATTR_TAB_SIZE_MIN 216 /**< Minimum Attribute Table size */ +#define BLE_GATTS_ATTR_TAB_SIZE_DEFAULT 0x0000 /**< Default Attribute Table size (0x580 bytes for this version of the SoftDevice). */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATTS_STRUCTURES Structures + * @{ */ + +/** + * @brief BLE GATTS initialization parameters. + */ +typedef struct +{ + uint8_t service_changed:1; /**< Include the Service Changed characteristic in the Attribute Table. */ + uint32_t attr_tab_size; /**< Attribute Table size in bytes. The size must be a multiple of 4. @ref BLE_GATTS_ATTR_TAB_SIZE_DEFAULT is used to set the default size. */ +} ble_gatts_enable_params_t; + +/**@brief Attribute metadata. */ +typedef struct +{ + ble_gap_conn_sec_mode_t read_perm; /**< Read permissions. */ + ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */ + uint8_t vlen :1; /**< Variable length attribute. */ + uint8_t vloc :2; /**< Value location, see @ref BLE_GATTS_VLOCS.*/ + uint8_t rd_auth :1; /**< Read authorization and value will be requested from the application on every read operation. */ + uint8_t wr_auth :1; /**< Write authorization will be requested from the application on every Write Request operation (but not Write Command). */ +} ble_gatts_attr_md_t; + + +/**@brief GATT Attribute. */ +typedef struct +{ + ble_uuid_t *p_uuid; /**< Pointer to the attribute UUID. */ + ble_gatts_attr_md_t *p_attr_md; /**< Pointer to the attribute metadata structure. */ + uint16_t init_len; /**< Initial attribute value length in bytes. */ + uint16_t init_offs; /**< Initial attribute value offset in bytes. If different from zero, the first init_offs bytes of the attribute value will be left uninitialized. */ + uint16_t max_len; /**< Maximum attribute value length in bytes, see @ref BLE_GATTS_ATTR_LENS_MAX for maximum values. */ + uint8_t* p_value; /**< Pointer to the attribute data. Please note that if the @ref BLE_GATTS_VLOC_USER value location is selected in the attribute metadata, this will have to point to a buffer + that remains valid through the lifetime of the attribute. This excludes usage of automatic variables that may go out of scope or any other temporary location. + The stack may access that memory directly without the application's knowledge. For writable characteristics, this value must not be a location in flash memory.*/ +} ble_gatts_attr_t; + +/**@brief GATT Attribute Value. */ +typedef struct +{ + uint16_t len; /**< Length in bytes to be written or read. Length in bytes written or read after successful return.*/ + uint16_t offset; /**< Attribute value offset. */ + uint8_t *p_value; /**< Pointer to where value is stored or will be stored. + If value is stored in user memory, only the attribute length is updated when p_value == NULL. + Set to NULL when reading to obtain the complete length of the attribute value */ +} ble_gatts_value_t; + + +/**@brief GATT Characteristic Presentation Format. */ +typedef struct +{ + uint8_t format; /**< Format of the value, see @ref BLE_GATT_CPF_FORMATS. */ + int8_t exponent; /**< Exponent for integer data types. */ + uint16_t unit; /**< Unit from Bluetooth Assigned Numbers. */ + uint8_t name_space; /**< Namespace from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */ + uint16_t desc; /**< Namespace description from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */ +} ble_gatts_char_pf_t; + + +/**@brief GATT Characteristic metadata. */ +typedef struct +{ + ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ + ble_gatt_char_ext_props_t char_ext_props; /**< Characteristic Extended Properties. */ + uint8_t *p_char_user_desc; /**< Pointer to a UTF-8 encoded string (non-NULL terminated), NULL if the descriptor is not required. */ + uint16_t char_user_desc_max_size; /**< The maximum size in bytes of the user description descriptor. */ + uint16_t char_user_desc_size; /**< The size of the user description, must be smaller or equal to char_user_desc_max_size. */ + ble_gatts_char_pf_t* p_char_pf; /**< Pointer to a presentation format structure or NULL if the CPF descriptor is not required. */ + ble_gatts_attr_md_t* p_user_desc_md; /**< Attribute metadata for the User Description descriptor, or NULL for default values. */ + ble_gatts_attr_md_t* p_cccd_md; /**< Attribute metadata for the Client Characteristic Configuration Descriptor, or NULL for default values. */ + ble_gatts_attr_md_t* p_sccd_md; /**< Attribute metadata for the Server Characteristic Configuration Descriptor, or NULL for default values. */ +} ble_gatts_char_md_t; + + +/**@brief GATT Characteristic Definition Handles. */ +typedef struct +{ + uint16_t value_handle; /**< Handle to the characteristic value. */ + uint16_t user_desc_handle; /**< Handle to the User Description descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ + uint16_t cccd_handle; /**< Handle to the Client Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ + uint16_t sccd_handle; /**< Handle to the Server Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ +} ble_gatts_char_handles_t; + + +/**@brief GATT HVx parameters. */ +typedef struct +{ + uint16_t handle; /**< Characteristic Value Handle. */ + uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ + uint16_t offset; /**< Offset within the attribute value. */ + uint16_t *p_len; /**< Length in bytes to be written, length in bytes written after successful return. */ + uint8_t *p_data; /**< Actual data content, use NULL to use the current attribute value. */ +} ble_gatts_hvx_params_t; + +/**@brief GATT Authorization parameters. */ +typedef struct +{ + uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ + uint8_t update : 1; /**< If set, data supplied in p_data will be used to update the attribute value. + Please note that for @ref BLE_GATTS_OP_WRITE_REQ operations this bit must always be set, + as the data to be written needs to be stored and later provided by the application. */ + uint16_t offset; /**< Offset of the attribute value being updated. */ + uint16_t len; /**< Length in bytes of the value in p_data pointer, see @ref BLE_GATTS_ATTR_LENS_MAX. */ + const uint8_t *p_data; /**< Pointer to new value used to update the attribute value. */ +} ble_gatts_authorize_params_t; + +/**@brief GATT Read or Write Authorize Reply parameters. */ +typedef struct +{ + uint8_t type; /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */ + union { + ble_gatts_authorize_params_t read; /**< Read authorization parameters. */ + ble_gatts_authorize_params_t write; /**< Write authorization parameters. */ + } params; /**< Reply Parameters. */ +} ble_gatts_rw_authorize_reply_params_t; + + + +/**@brief Event structure for @ref BLE_GATTS_EVT_WRITE. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + ble_uuid_t uuid; /**< Attribute UUID. */ + uint8_t op; /**< Type of write operation, see @ref BLE_GATTS_OPS. */ + uint8_t auth_required; /**< Writing operation deferred due to authorization requirement. Application may use @ref sd_ble_gatts_value_set to finalise the writing operation. */ + uint16_t offset; /**< Offset for the write operation. */ + uint16_t len; /**< Length of the received data. */ + uint8_t data[1]; /**< Received data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gatts_evt_write_t; + +/**@brief Event substructure for authorized read requests, see @ref ble_gatts_evt_rw_authorize_request_t. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + ble_uuid_t uuid; /**< Attribute UUID. */ + uint16_t offset; /**< Offset for the read operation. */ +} ble_gatts_evt_read_t; + +/**@brief Event structure for @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST. */ +typedef struct +{ + uint8_t type; /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */ + union { + ble_gatts_evt_read_t read; /**< Attribute Read Parameters. */ + ble_gatts_evt_write_t write; /**< Attribute Write Parameters. */ + } request; /**< Request Parameters. */ +} ble_gatts_evt_rw_authorize_request_t; + +/**@brief Event structure for @ref BLE_GATTS_EVT_SYS_ATTR_MISSING. */ +typedef struct +{ + uint8_t hint; /**< Hint (currently unused). */ +} ble_gatts_evt_sys_attr_missing_t; + + +/**@brief Event structure for @ref BLE_GATTS_EVT_HVC. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ +} ble_gatts_evt_hvc_t; + +/**@brief Event structure for @ref BLE_GATTS_EVT_TIMEOUT. */ +typedef struct +{ + uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ +} ble_gatts_evt_timeout_t; + + +/**@brief GATT Server event callback event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which the event occurred. */ + union + { + ble_gatts_evt_write_t write; /**< Write Event Parameters. */ + ble_gatts_evt_rw_authorize_request_t authorize_request; /**< Read or Write Authorize Request Parameters. */ + ble_gatts_evt_sys_attr_missing_t sys_attr_missing; /**< System attributes missing. */ + ble_gatts_evt_hvc_t hvc; /**< Handle Value Confirmation Event Parameters. */ + ble_gatts_evt_timeout_t timeout; /**< Timeout Event. */ + } params; /**< Event Parameters. */ +} ble_gatts_evt_t; + +/** @} */ + +/** @addtogroup BLE_GATTS_FUNCTIONS Functions + * @{ */ + +/**@brief Add a service declaration to the Attribute Table. + * + * @note Secondary Services are only relevant in the context of the entity that references them, it is therefore forbidden to + * add a secondary service declaration that is not referenced by another service later in the Attribute Table. + * + * @mscs + * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} + * @endmscs + * + * @param[in] type Toggles between primary and secondary services, see @ref BLE_GATTS_SRVC_TYPES. + * @param[in] p_uuid Pointer to service UUID. + * @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval ::NRF_SUCCESS Successfully added a service declaration. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, Vendor Specific UUIDs need to be present in the table. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + */ +SVCALL(SD_BLE_GATTS_SERVICE_ADD, uint32_t, sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, uint16_t *p_handle)); + + +/**@brief Add an include declaration to the Attribute Table. + * + * @note It is currently only possible to add an include declaration to the last added service (i.e. only sequential population is supported at this time). + * + * @note The included service must already be present in the Attribute Table prior to this call. + * + * @mscs + * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} + * @endmscs + * + * @param[in] service_handle Handle of the service where the included service is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. + * @param[in] inc_srvc_handle Handle of the included service. + * @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval ::NRF_SUCCESS Successfully added an include declaration. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, handle values need to match previously added services. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, self inclusions are not allowed. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + */ +SVCALL(SD_BLE_GATTS_INCLUDE_ADD, uint32_t, sd_ble_gatts_include_add(uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *p_include_handle)); + + +/**@brief Add a characteristic declaration, a characteristic value declaration and optional characteristic descriptor declarations to the Attribute Table. + * + * @note It is currently only possible to add a characteristic to the last added service (i.e. only sequential population is supported at this time). + * + * @note Several restrictions apply to the parameters, such as matching permissions between the user description descriptor and the writeable auxiliaries bits, + * readable (no security) and writeable (selectable) CCCDs and SCCDs and valid presentation format values. + * + * @note If no metadata is provided for the optional descriptors, their permissions will be derived from the characteristic permissions. + * + * @mscs + * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} + * @endmscs + * + * @param[in] service_handle Handle of the service where the characteristic is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. + * @param[in] p_char_md Characteristic metadata. + * @param[in] p_attr_char_value Pointer to the attribute structure corresponding to the characteristic value. + * @param[out] p_handles Pointer to the structure where the assigned handles will be stored. + * + * @retval ::NRF_SUCCESS Successfully added a characteristic. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, service handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a service context is required. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. + */ +SVCALL(SD_BLE_GATTS_CHARACTERISTIC_ADD, uint32_t, sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_t const *p_char_md, ble_gatts_attr_t const *p_attr_char_value, ble_gatts_char_handles_t *p_handles)); + + +/**@brief Add a descriptor to the Attribute Table. + * + * @note It is currently only possible to add a descriptor to the last added characteristic (i.e. only sequential population is supported at this time). + * + * @mscs + * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} + * @endmscs + * + * @param[in] char_handle Handle of the characteristic where the descriptor is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. + * @param[in] p_attr Pointer to the attribute structure. + * @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval ::NRF_SUCCESS Successfully added a descriptor. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, characteristic handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a characteristic context is required. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. + */ +SVCALL(SD_BLE_GATTS_DESCRIPTOR_ADD, uint32_t, sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_t const *p_attr, uint16_t *p_handle)); + +/**@brief Set the value of a given attribute. + * + * @note Values other than system attributes can be set at any time, regardless of wheter any active connections exist. + * + * @mscs + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. If the value does not belong to a system attribute then @ref BLE_CONN_HANDLE_INVALID can be used. + * @param[in] handle Attribute handle. + * @param[in,out] p_value Attribute value information. + * + * @retval ::NRF_SUCCESS Successfully set the value of the attribute. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden handle supplied, certain attributes are not modifiable by the application. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE @ref BLE_CONN_HANDLE_INVALID supplied on a system attribute. + */ +SVCALL(SD_BLE_GATTS_VALUE_SET, uint32_t, sd_ble_gatts_value_set(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)); + +/**@brief Get the value of a given attribute. + * + * @note If the attribute value is longer than the size of the supplied buffer, + * p_len will return the total attribute value length (excluding offset), + * and not the number of bytes actually returned in p_data. + * The application may use this information to allocate a suitable buffer size. + * + * @note When retrieving system attribute values with this function, the connection handle + * may refer to an already disconnected connection. Refer to the documentation of + * @ref sd_ble_gatts_sys_attr_get for further information. + * + * @param[in] conn_handle Connection handle. If the value does not belong to a system attribute then @ref BLE_CONN_HANDLE_INVALID can be used. + * @param[in] handle Attribute handle. + * @param[in,out] p_value Attribute value information. + * + * @retval ::NRF_SUCCESS Successfully retrieved the value of the attribute. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid attribute offset supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE @ref BLE_CONN_HANDLE_INVALID supplied on a system attribute. + */ +SVCALL(SD_BLE_GATTS_VALUE_GET, uint32_t, sd_ble_gatts_value_get(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)); + +/**@brief Notify or Indicate an attribute value. + * + * @details This function checks for the relevant Client Characteristic Configuration descriptor value to verify that the relevant operation + * (notification or indication) has been enabled by the client. It is also able to update the attribute value before issuing the PDU, so that + * the application can atomically perform a value update and a server initiated transaction with a single API call. + * If the application chooses to indicate an attribute value, a @ref BLE_GATTS_EVT_HVC event will be issued as soon as the confirmation arrives from + * the peer. + * + * @note The local attribute value may be updated even if an outgoing packet is not sent to the peer due to an error during execution. + * When receiveing the error codes @ref NRF_ERROR_INVALID_STATE, @ref NRF_ERROR_BUSY, @ref BLE_ERROR_GATTS_SYS_ATTR_MISSING and + * @ref BLE_ERROR_NO_TX_PACKETS the Attribute Table has been updated. + * The caller can check whether the value has been updated by looking at the contents of *(p_hvx_params->p_len). + * + * @note It is important to note that a notification will consume an application buffer, and will therefore + * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. An indication on the other hand will use the + * standard server internal buffer and thus will only generate a @ref BLE_GATTS_EVT_HVC event as soon as the confirmation + * has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. + * + * @events + * @event{@ref BLE_EVT_TX_COMPLETE, Transmission complete.} + * @event{@ref BLE_GATTS_EVT_HVC, Confirmation received from peer.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC} + * @mmsc{@ref BLE_GATTS_HVN_MSC} + * @mmsc{@ref BLE_GATTS_HVI_MSC} + * @mmsc{@ref BLE_GATTS_HVX_DISABLED_MSC} + * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_hvx_params Pointer to an HVx parameters structure. If the p_data member contains a non-NULL pointer the attribute value will be updated with + * the contents pointed by it before sending the notification or indication. + * + * @retval ::NRF_SUCCESS Successfully queued a notification or indication for transmission, and optionally updated the attribute value. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or notifications and/or indications not enabled in the CCCD. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied. Only attributes added directly by the application are available to notify and indicate. + * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE Invalid attribute type(s) supplied, only characteristic values may be notified and indicated. + * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + * @retval ::NRF_ERROR_BUSY Procedure already in progress. + * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. + * @retval ::BLE_ERROR_NO_TX_PACKETS No available application packets for this connection, applies only to notifications. + */ +SVCALL(SD_BLE_GATTS_HVX, uint32_t, sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const *p_hvx_params)); + +/**@brief Indicate the Service Changed attribute value. + * + * @details This call will send a Handle Value Indication to one or more peers connected to inform them that the Attribute + * Table layout has changed. As soon as the peer has confirmed the indication, a @ref BLE_GATTS_EVT_SC_CONFIRM event will + * be issued. + * + * @note Some of the restrictions and limitations that apply to @ref sd_ble_gatts_hvx also apply here. + * + * @events + * @event{@ref BLE_GATTS_EVT_SC_CONFIRM, Confirmation of attribute table change received from peer.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTS_SC_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] start_handle Start of affected attribute handle range. + * @param[in] end_handle End of affected attribute handle range. + * + * @retval ::NRF_SUCCESS Successfully queued the Service Changed indication for transmission. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_NOT_SUPPORTED Service Changed not enabled at initialization. See @ref sd_ble_enable and @ref ble_gatts_enable_params_t. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or notifications and/or indications not enabled in the CCCD. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied, handles must be in the range populated by the application. + * @retval ::NRF_ERROR_BUSY Procedure already in progress. + * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. + */ +SVCALL(SD_BLE_GATTS_SERVICE_CHANGED, uint32_t, sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle)); + +/**@brief Respond to a Read/Write authorization request. + * + * @note This call should only be used as a response to a @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event issued to the application. + * + * @mscs + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} + * @mmsc{@ref BLE_GATTS_READ_REQ_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_WRITE_REQ_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_PEER_CANCEL_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_rw_authorize_reply_params Pointer to a structure with the attribute provided by the application. + * + * @retval ::NRF_SUCCESS Successfully queued a response to the peer, and in the case of a write operation, Attribute Table updated. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no authorization request pending. + * @retval ::NRF_ERROR_INVALID_PARAM Authorization op invalid, + * handle supplied does not match requested handle, + * or invalid data to be written provided by the application. + * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, uint32_t, sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *p_rw_authorize_reply_params)); + + +/**@brief Update persistent system attribute information. + * + * @details Supply information about persistent system attributes to the stack, + * previously obtained using @ref sd_ble_gatts_sys_attr_get. + * This call is only allowed for active connections, and is usually + * made immediately after a connection is established with an known bonded device, + * often as a response to a @ref BLE_GATTS_EVT_SYS_ATTR_MISSING. + * + * p_sysattrs may point directly to the application's stored copy of the system attributes + * obtained using @ref sd_ble_gatts_sys_attr_get. + * If the pointer is NULL, the system attribute info is initialized, assuming that + * the application does not have any previously saved system attribute data for this device. + * + * @note The state of persistent system attributes is reset upon connection establishment and then remembered for its duration. + * + * @note If this call returns with an error code different from @ref NRF_SUCCESS, the storage of persistent system attributes may have been completed only partially. + * This means that the state of the attribute table is undefined, and the application should either provide a new set of attributes using this same call or + * reset the SoftDevice to return to a known state. + * + * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be modified. + * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be modified. + * + * @mscs + * @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC} + * @mmsc{@ref BLE_GATTS_SYS_ATTRS_UNK_PEER_MSC} + * @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_sys_attr_data Pointer to a saved copy of system attributes supplied to the stack, or NULL. + * @param[in] len Size of data pointed by p_sys_attr_data, in octets. + * @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS + * + * @retval ::NRF_SUCCESS Successfully set the system attribute information. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_DATA Invalid data supplied, the data should be exactly the same as retrieved with @ref sd_ble_gatts_sys_attr_get. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_GATTS_SYS_ATTR_SET, uint32_t, sd_ble_gatts_sys_attr_set(uint16_t conn_handle, uint8_t const *p_sys_attr_data, uint16_t len, uint32_t flags)); + + +/**@brief Retrieve persistent system attribute information from the stack. + * + * @details This call is used to retrieve information about values to be stored perisistently by the application + * during the lifetime of a connection or after it has been terminated. When a new connection is established with the same bonded device, + * the system attribute information retrieved with this function should be restored using using @ref sd_ble_gatts_sys_attr_set. + * If retrieved after disconnection, the data should be read before a new connection established. The connection handle for + * the previous, now disconnected, connection will remain valid until a new one is created to allow this API call to refer to it. + * Connection handles belonging to active connections can be used as well, but care should be taken since the system attributes + * may be written to at any time by the peer during a connection's lifetime. + * + * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be returned. + * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be returned. + * + * @mscs + * @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle of the recently terminated connection. + * @param[out] p_sys_attr_data Pointer to a buffer where updated information about system attributes will be filled in. The format of the data is described + * in @ref BLE_GATTS_SYS_ATTRS_FORMAT. NULL can be provided to obtain the length of the data. + * @param[in,out] p_len Size of application buffer if p_sys_attr_data is not NULL. Unconditially updated to actual length of system attribute data. + * @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS + * + * @retval ::NRF_SUCCESS Successfully retrieved the system attribute information. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_DATA_SIZE The system attribute information did not fit into the provided buffer. + * @retval ::NRF_ERROR_NOT_FOUND No system attributes found. + */ +SVCALL(SD_BLE_GATTS_SYS_ATTR_GET, uint32_t, sd_ble_gatts_sys_attr_get(uint16_t conn_handle, uint8_t *p_sys_attr_data, uint16_t *p_len, uint32_t flags)); + + +/**@brief Retrieve the first valid user attribute handle. + * + * @param[out] p_handle Pointer to an integer where the handle will be stored. + * + * @retval ::NRF_SUCCESS Successfully retrieved the handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, uint32_t, sd_ble_gatts_initial_user_handle_get(uint16_t *p_handle)); + +/**@brief Retrieve the attribute UUID and/or metadata. + * + * @param[in] handle Attribute handle + * @param[out] p_uuid UUID of the attribute. Use NULL to omit this field. + * @param[out] p_md Metadata of the attribute. Use NULL to omit this field. + * + * @retval ::NRF_SUCCESS Successfully retrieved the attribute metadata, + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameters supplied. Returned when both @c p_uuid and @c p_md are NULL. + * @retval ::NRF_ERROR_NOT_FOUND Attribute was not found. + */ +SVCALL(SD_BLE_GATTS_ATTR_GET, uint32_t, sd_ble_gatts_attr_get(uint16_t handle, ble_uuid_t * p_uuid, ble_gatts_attr_md_t * p_md)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_BLE_GATTS_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_hci.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_hci.h new file mode 100644 index 0000000000..a709c0a60f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_hci.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_COMMON + @{ +*/ + + +#ifndef NRF_BLE_HCI_H__ +#define NRF_BLE_HCI_H__ +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup BLE_HCI_STATUS_CODES Bluetooth status codes + * @{ */ + +#define BLE_HCI_STATUS_CODE_SUCCESS 0x00 /**< Success. */ +#define BLE_HCI_STATUS_CODE_UNKNOWN_BTLE_COMMAND 0x01 /**< Unknown BLE Command. */ +#define BLE_HCI_STATUS_CODE_UNKNOWN_CONNECTION_IDENTIFIER 0x02 /**< Unknown Connection Identifier. */ +/*0x03 Hardware Failure +0x04 Page Timeout +*/ +#define BLE_HCI_AUTHENTICATION_FAILURE 0x05 /**< Authentication Failure. */ +#define BLE_HCI_STATUS_CODE_PIN_OR_KEY_MISSING 0x06 /**< Pin or Key missing. */ +#define BLE_HCI_MEMORY_CAPACITY_EXCEEDED 0x07 /**< Memory Capacity Exceeded. */ +#define BLE_HCI_CONNECTION_TIMEOUT 0x08 /**< Connection Timeout. */ +/*0x09 Connection Limit Exceeded +0x0A Synchronous Connection Limit To A Device Exceeded +0x0B ACL Connection Already Exists*/ +#define BLE_HCI_STATUS_CODE_COMMAND_DISALLOWED 0x0C /**< Command Disallowed. */ +/*0x0D Connection Rejected due to Limited Resources +0x0E Connection Rejected Due To Security Reasons +0x0F Connection Rejected due to Unacceptable BD_ADDR +0x10 Connection Accept Timeout Exceeded +0x11 Unsupported Feature or Parameter Value*/ +#define BLE_HCI_STATUS_CODE_INVALID_BTLE_COMMAND_PARAMETERS 0x12 /**< Invalid BLE Command Parameters. */ +#define BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION 0x13 /**< Remote User Terminated Connection. */ +#define BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES 0x14 /**< Remote Device Terminated Connection due to low resources.*/ +#define BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF 0x15 /**< Remote Device Terminated Connection due to power off. */ +#define BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION 0x16 /**< Local Host Terminated Connection. */ +/* +0x17 Repeated Attempts +0x18 Pairing Not Allowed +0x19 Unknown LMP PDU +*/ +#define BLE_HCI_UNSUPPORTED_REMOTE_FEATURE 0x1A /**< Unsupported Remote Feature. */ +/* +0x1B SCO Offset Rejected +0x1C SCO Interval Rejected +0x1D SCO Air Mode Rejected*/ +#define BLE_HCI_STATUS_CODE_INVALID_LMP_PARAMETERS 0x1E /**< Invalid LMP Parameters. */ +#define BLE_HCI_STATUS_CODE_UNSPECIFIED_ERROR 0x1F /**< Unspecified Error. */ +/*0x20 Unsupported LMP Parameter Value +0x21 Role Change Not Allowed +*/ +#define BLE_HCI_STATUS_CODE_LMP_RESPONSE_TIMEOUT 0x22 /**< LMP Response Timeout. */ +/*0x23 LMP Error Transaction Collision*/ +#define BLE_HCI_STATUS_CODE_LMP_PDU_NOT_ALLOWED 0x24 /**< LMP PDU Not Allowed. */ +/*0x25 Encryption Mode Not Acceptable +0x26 Link Key Can Not be Changed +0x27 Requested QoS Not Supported +*/ +#define BLE_HCI_INSTANT_PASSED 0x28 /**< Instant Passed. */ +#define BLE_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED 0x29 /**< Pairing with Unit Key Unsupported. */ +#define BLE_HCI_DIFFERENT_TRANSACTION_COLLISION 0x2A /**< Different Transaction Collision. */ +/* +0x2B Reserved +0x2C QoS Unacceptable Parameter +0x2D QoS Rejected +0x2E Channel Classification Not Supported +0x2F Insufficient Security +0x30 Parameter Out Of Mandatory Range +0x31 Reserved +0x32 Role Switch Pending +0x33 Reserved +0x34 Reserved Slot Violation +0x35 Role Switch Failed +0x36 Extended Inquiry Response Too Large +0x37 Secure Simple Pairing Not Supported By Host. +0x38 Host Busy - Pairing +0x39 Connection Rejected due to No Suitable Channel Found*/ +#define BLE_HCI_CONTROLLER_BUSY 0x3A /**< Controller Busy. */ +#define BLE_HCI_CONN_INTERVAL_UNACCEPTABLE 0x3B /**< Connection Interval Unacceptable. */ +#define BLE_HCI_DIRECTED_ADVERTISER_TIMEOUT 0x3C /**< Directed Adverisement Timeout. */ +#define BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE 0x3D /**< Connection Terminated due to MIC Failure. */ +#define BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED 0x3E /**< Connection Failed to be Established. */ + +/** @} */ + + +#ifdef __cplusplus +} +#endif +#endif // NRF_BLE_HCI_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_l2cap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_l2cap.h new file mode 100644 index 0000000000..57d3592969 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_l2cap.h @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_L2CAP Logical Link Control and Adaptation Protocol (L2CAP) + @{ + @brief Definitions and prototypes for the L2CAP interface. + */ + +#ifndef NRF_BLE_L2CAP_H__ +#define NRF_BLE_L2CAP_H__ + +#include "nrf_ble_types.h" +#include "nrf_ble_ranges.h" +#include "nrf_ble_err.h" +#include "nrf_svc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@addtogroup BLE_L2CAP_ENUMERATIONS Enumerations + * @{ */ + +/**@brief L2CAP API SVC numbers. */ +enum BLE_L2CAP_SVCS +{ + SD_BLE_L2CAP_CID_REGISTER = BLE_L2CAP_SVC_BASE, /**< Register a CID. */ + SD_BLE_L2CAP_CID_UNREGISTER, /**< Unregister a CID. */ + SD_BLE_L2CAP_TX /**< Transmit a packet. */ +}; + +/**@brief L2CAP Event IDs. */ +enum BLE_L2CAP_EVTS +{ + BLE_L2CAP_EVT_RX = BLE_L2CAP_EVT_BASE /**< L2CAP packet received. */ +}; + +/** @} */ + +/**@addtogroup BLE_L2CAP_DEFINES Defines + * @{ */ + +/**@defgroup BLE_ERRORS_L2CAP SVC return values specific to L2CAP + * @{ */ +#define BLE_ERROR_L2CAP_CID_IN_USE (NRF_L2CAP_ERR_BASE + 0x000) /**< CID already in use. */ +/** @} */ + +/**@brief Default L2CAP MTU. */ +#define BLE_L2CAP_MTU_DEF (23) + +/**@brief Invalid Channel Identifier. */ +#define BLE_L2CAP_CID_INVALID (0x0000) + +/**@brief Dynamic Channel Identifier base. */ +#define BLE_L2CAP_CID_DYN_BASE (0x0040) + +/**@brief Maximum amount of dynamic CIDs. */ +#define BLE_L2CAP_CID_DYN_MAX (8) + +/** @} */ + +/**@addtogroup BLE_L2CAP_STRUCTURES Structures + * @{ */ + +/**@brief Packet header format for L2CAP transmission. */ +typedef struct +{ + uint16_t len; /**< Length of valid info in data member. */ + uint16_t cid; /**< Channel ID on which packet is transmitted. */ +} ble_l2cap_header_t; + + +/**@brief L2CAP Received packet event report. */ +typedef struct +{ + ble_l2cap_header_t header; /**< L2CAP packet header. */ + uint8_t data[1]; /**< Packet data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_l2cap_evt_rx_t; + + +/**@brief L2CAP event callback event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which event occured. */ + union + { + ble_l2cap_evt_rx_t rx; /**< RX Event parameters. */ + } params; /**< Event Parameters. */ +} ble_l2cap_evt_t; + +/** @} */ + +/**@addtogroup BLE_L2CAP_FUNCTIONS Functions + * @{ */ + +/**@brief Register a CID with L2CAP. + * + * @details This registers a higher protocol layer with the L2CAP multiplexer, and is requried prior to all operations on the CID. + * + * @mscs + * @mmsc{@ref BLE_L2CAP_API_MSC} + * @endmscs + * + * @param[in] cid L2CAP CID. + * + * @retval ::NRF_SUCCESS Successfully registered a CID with the L2CAP layer. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CID must be above @ref BLE_L2CAP_CID_DYN_BASE. + * @retval ::BLE_ERROR_L2CAP_CID_IN_USE L2CAP CID already in use. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + */ +SVCALL(SD_BLE_L2CAP_CID_REGISTER, uint32_t, sd_ble_l2cap_cid_register(uint16_t cid)); + +/**@brief Unregister a CID with L2CAP. + * + * @details This unregisters a previously registerd higher protocol layer with the L2CAP multiplexer. + * + * @mscs + * @mmsc{@ref BLE_L2CAP_API_MSC} + * @endmscs + * + * @param[in] cid L2CAP CID. + * + * @retval ::NRF_SUCCESS Successfully unregistered the CID. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_NOT_FOUND CID not previously registered. + */ +SVCALL(SD_BLE_L2CAP_CID_UNREGISTER, uint32_t, sd_ble_l2cap_cid_unregister(uint16_t cid)); + +/**@brief Transmit an L2CAP packet. + * + * @note It is important to note that a call to this function will consume an application packet, and will therefore + * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. + * Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. + * + * @events + * @event{@ref BLE_EVT_TX_COMPLETE} + * @event{@ref BLE_L2CAP_EVT_RX} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_L2CAP_API_MSC} + * @endmscs + * + * @param[in] conn_handle Connection Handle. + * @param[in] p_header Pointer to a packet header containing length and CID. + * @param[in] p_data Pointer to the data to be transmitted. + * + * @retval ::NRF_SUCCESS Successfully queued an L2CAP packet for transmission. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register. + * @retval ::NRF_ERROR_NOT_FOUND CID not found. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::BLE_ERROR_NO_TX_PACKETS Not enough application packets available. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF. + */ +SVCALL(SD_BLE_L2CAP_TX, uint32_t, sd_ble_l2cap_tx(uint16_t conn_handle, ble_l2cap_header_t const *p_header, uint8_t const *p_data)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_BLE_L2CAP_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_ranges.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_ranges.h new file mode 100644 index 0000000000..7476d488c0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_ranges.h @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_COMMON + @{ + @defgroup ble_ranges Module specific SVC, event and option number subranges + @{ + + @brief Definition of SVC, event and option number subranges for each API module. + + @note + SVCs, event and option numbers are split into subranges for each API module. + Each module receives its entire allocated range of SVC calls, whether implemented or not, + but return BLE_ERROR_NOT_SUPPORTED for unimplemented or undefined calls in its range. + + Note that the symbols BLE__SVC_LAST is the end of the allocated SVC range, + rather than the last SVC function call actually defined and implemented. + + Specific SVC, event and option values are defined in each module's ble_.h file, + which defines names of each individual SVC code based on the range start value. +*/ + +#ifndef NRF_BLE_RANGES_H__ +#define NRF_BLE_RANGES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define BLE_SVC_BASE 0x60 /**< Common BLE SVC base. */ +#define BLE_SVC_LAST 0x6B /**< Total: 12. */ + +#define BLE_RESERVED_SVC_BASE 0x6C /**< Reserved BLE SVC base. */ +#define BLE_RESERVED_SVC_LAST 0x6F /**< Total: 4. */ + +#define BLE_GAP_SVC_BASE 0x70 /**< GAP BLE SVC base. */ +#define BLE_GAP_SVC_LAST 0x8F /**< Total: 32. */ + +#define BLE_GATTC_SVC_BASE 0x90 /**< GATTC BLE SVC base. */ +#define BLE_GATTC_SVC_LAST 0x9F /**< Total: 32. */ + +#define BLE_GATTS_SVC_BASE 0xA0 /**< GATTS BLE SVC base. */ +#define BLE_GATTS_SVC_LAST 0xAF /**< Total: 16. */ + +#define BLE_L2CAP_SVC_BASE 0xB0 /**< L2CAP BLE SVC base. */ +#define BLE_L2CAP_SVC_LAST 0xBF /**< Total: 16. */ + + +#define BLE_EVT_INVALID 0x00 /**< Invalid BLE Event. */ + +#define BLE_EVT_BASE 0x01 /**< Common BLE Event base. */ +#define BLE_EVT_LAST 0x0F /**< Total: 15. */ + +#define BLE_GAP_EVT_BASE 0x10 /**< GAP BLE Event base. */ +#define BLE_GAP_EVT_LAST 0x2F /**< Total: 32. */ + +#define BLE_GATTC_EVT_BASE 0x30 /**< GATTC BLE Event base. */ +#define BLE_GATTC_EVT_LAST 0x4F /**< Total: 32. */ + +#define BLE_GATTS_EVT_BASE 0x50 /**< GATTS BLE Event base. */ +#define BLE_GATTS_EVT_LAST 0x6F /**< Total: 32. */ + +#define BLE_L2CAP_EVT_BASE 0x70 /**< L2CAP BLE Event base. */ +#define BLE_L2CAP_EVT_LAST 0x8F /**< Total: 32. */ + + +#define BLE_OPT_INVALID 0x00 /**< Invalid BLE Option. */ + +#define BLE_OPT_BASE 0x01 /**< Common BLE Option base. */ +#define BLE_OPT_LAST 0x1F /**< Total: 31. */ + +#define BLE_GAP_OPT_BASE 0x20 /**< GAP BLE Option base. */ +#define BLE_GAP_OPT_LAST 0x3F /**< Total: 32. */ + +#define BLE_GATTC_OPT_BASE 0x40 /**< GATTC BLE Option base. */ +#define BLE_GATTC_OPT_LAST 0x5F /**< Total: 32. */ + +#define BLE_GATTS_OPT_BASE 0x60 /**< GATTS BLE Option base. */ +#define BLE_GATTS_OPT_LAST 0x7F /**< Total: 32. */ + +#define BLE_L2CAP_OPT_BASE 0x80 /**< L2CAP BLE Option base. */ +#define BLE_L2CAP_OPT_LAST 0x9F /**< Total: 32. */ + +#ifdef __cplusplus +} +#endif +#endif /* NRF_BLE_RANGES_H__ */ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_types.h new file mode 100644 index 0000000000..0ef31dd83a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_types.h @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + @addtogroup BLE_COMMON + @{ + @defgroup ble_types Common types and macro definitions + @{ + + @brief Common types and macro definitions for the BLE SoftDevice. + */ + +#ifndef NRF_BLE_TYPES_H__ +#define NRF_BLE_TYPES_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup BLE_TYPES_DEFINES Defines + * @{ */ + +/** @defgroup BLE_CONN_HANDLES BLE Connection Handles + * @{ */ +#define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */ +#define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */ +/** @} */ + + +/** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs + * @{ */ +/* Generic UUIDs, applicable to all services */ +#define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */ +#define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */ +#define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */ +#define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */ +#define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */ +#define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */ +#define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */ +#define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */ +#define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */ +#define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */ +#define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */ +/* GATT specific UUIDs */ +#define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */ +#define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */ +/* GAP specific UUIDs */ +#define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */ +#define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_PPF 0x2A02 /**< Peripheral Privacy Flag Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */ +/** @} */ + + +/** @defgroup BLE_UUID_TYPES Types of UUID + * @{ */ +#define BLE_UUID_TYPE_UNKNOWN 0x00 /**< Invalid UUID type. */ +#define BLE_UUID_TYPE_BLE 0x01 /**< Bluetooth SIG UUID (16-bit). */ +#define BLE_UUID_TYPE_VENDOR_BEGIN 0x02 /**< Vendor UUID types start at this index (128-bit). */ +/** @} */ + + +/** @defgroup BLE_APPEARANCES Bluetooth Appearance values + * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml + * @{ */ +#define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */ +#define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */ +#define BLE_APPEARANCE_GENERIC_COMPUTER 128 /**< Generic Computer. */ +#define BLE_APPEARANCE_GENERIC_WATCH 192 /**< Generic Watch. */ +#define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193 /**< Watch: Sports Watch. */ +#define BLE_APPEARANCE_GENERIC_CLOCK 256 /**< Generic Clock. */ +#define BLE_APPEARANCE_GENERIC_DISPLAY 320 /**< Generic Display. */ +#define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384 /**< Generic Remote Control. */ +#define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448 /**< Generic Eye-glasses. */ +#define BLE_APPEARANCE_GENERIC_TAG 512 /**< Generic Tag. */ +#define BLE_APPEARANCE_GENERIC_KEYRING 576 /**< Generic Keyring. */ +#define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640 /**< Generic Media Player. */ +#define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704 /**< Generic Barcode Scanner. */ +#define BLE_APPEARANCE_GENERIC_THERMOMETER 768 /**< Generic Thermometer. */ +#define BLE_APPEARANCE_THERMOMETER_EAR 769 /**< Thermometer: Ear. */ +#define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832 /**< Generic Heart rate Sensor. */ +#define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833 /**< Heart Rate Sensor: Heart Rate Belt. */ +#define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896 /**< Generic Blood Pressure. */ +#define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897 /**< Blood Pressure: Arm. */ +#define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898 /**< Blood Pressure: Wrist. */ +#define BLE_APPEARANCE_GENERIC_HID 960 /**< Human Interface Device (HID). */ +#define BLE_APPEARANCE_HID_KEYBOARD 961 /**< Keyboard (HID Subtype). */ +#define BLE_APPEARANCE_HID_MOUSE 962 /**< Mouse (HID Subtype). */ +#define BLE_APPEARANCE_HID_JOYSTICK 963 /**< Joystiq (HID Subtype). */ +#define BLE_APPEARANCE_HID_GAMEPAD 964 /**< Gamepad (HID Subtype). */ +#define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965 /**< Digitizer Tablet (HID Subtype). */ +#define BLE_APPEARANCE_HID_CARD_READER 966 /**< Card Reader (HID Subtype). */ +#define BLE_APPEARANCE_HID_DIGITAL_PEN 967 /**< Digital Pen (HID Subtype). */ +#define BLE_APPEARANCE_HID_BARCODE 968 /**< Barcode Scanner (HID Subtype). */ +#define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024 /**< Generic Glucose Meter. */ +#define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088 /**< Generic Running Walking Sensor. */ +#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089 /**< Running Walking Sensor: In-Shoe. */ +#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090 /**< Running Walking Sensor: On-Shoe. */ +#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091 /**< Running Walking Sensor: On-Hip. */ +#define BLE_APPEARANCE_GENERIC_CYCLING 1152 /**< Generic Cycling. */ +#define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153 /**< Cycling: Cycling Computer. */ +#define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154 /**< Cycling: Speed Sensor. */ +#define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155 /**< Cycling: Cadence Sensor. */ +#define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156 /**< Cycling: Power Sensor. */ +#define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157 /**< Cycling: Speed and Cadence Sensor. */ +#define BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 3136 /**< Generic Pulse Oximeter. */ +#define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137 /**< Fingertip (Pulse Oximeter subtype). */ +#define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138 /**< Wrist Worn(Pulse Oximeter subtype). */ +#define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200 /**< Generic Weight Scale. */ +#define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Activity. */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */ +/** @} */ + +/** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */ +#define BLE_UUID_BLE_ASSIGN(instance, value) do {\ + instance.type = BLE_UUID_TYPE_BLE; \ + instance.uuid = value;} while(0) + +/** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */ +#define BLE_UUID_COPY_PTR(dst, src) do {\ + (dst)->type = (src)->type; \ + (dst)->uuid = (src)->uuid;} while(0) + +/** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */ +#define BLE_UUID_COPY_INST(dst, src) do {\ + (dst).type = (src).type; \ + (dst).uuid = (src).uuid;} while(0) + +/** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ +#define BLE_UUID_EQ(p_uuid1, p_uuid2) \ + (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid)) + +/** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ +#define BLE_UUID_NEQ(p_uuid1, p_uuid2) \ + (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid)) + +/** @} */ + +/** @addtogroup BLE_TYPES_STRUCTURES Structures + * @{ */ + +/** @brief 128 bit UUID values. */ +typedef struct +{ + uint8_t uuid128[16]; /**< Little-Endian UUID bytes. */ +} ble_uuid128_t; + +/** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */ +typedef struct +{ + uint16_t uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */ + uint8_t type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is @ref BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */ +} ble_uuid_t; + +/** @} */ +#ifdef __cplusplus +} +#endif + +#endif /* NRF_BLE_TYPES_H__ */ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error.h new file mode 100644 index 0000000000..e4f90fd54c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + /** + @defgroup nrf_error SoftDevice Global Error Codes + @{ + + @brief Global Error definitions +*/ + +/* Header guard */ +#ifndef NRF_ERROR_H__ +#define NRF_ERROR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup NRF_ERRORS_BASE Error Codes Base number definitions + * @{ */ +#define NRF_ERROR_BASE_NUM (0x0) ///< Global error base +#define NRF_ERROR_SDM_BASE_NUM (0x1000) ///< SDM error base +#define NRF_ERROR_SOC_BASE_NUM (0x2000) ///< SoC error base +#define NRF_ERROR_STK_BASE_NUM (0x3000) ///< STK error base +/** @} */ + +#define NRF_SUCCESS (NRF_ERROR_BASE_NUM + 0) ///< Successful command +#define NRF_ERROR_SVC_HANDLER_MISSING (NRF_ERROR_BASE_NUM + 1) ///< SVC handler is missing +#define NRF_ERROR_SOFTDEVICE_NOT_ENABLED (NRF_ERROR_BASE_NUM + 2) ///< SoftDevice has not been enabled +#define NRF_ERROR_INTERNAL (NRF_ERROR_BASE_NUM + 3) ///< Internal Error +#define NRF_ERROR_NO_MEM (NRF_ERROR_BASE_NUM + 4) ///< No Memory for operation +#define NRF_ERROR_NOT_FOUND (NRF_ERROR_BASE_NUM + 5) ///< Not found +#define NRF_ERROR_NOT_SUPPORTED (NRF_ERROR_BASE_NUM + 6) ///< Not supported +#define NRF_ERROR_INVALID_PARAM (NRF_ERROR_BASE_NUM + 7) ///< Invalid Parameter +#define NRF_ERROR_INVALID_STATE (NRF_ERROR_BASE_NUM + 8) ///< Invalid state, operation disallowed in this state +#define NRF_ERROR_INVALID_LENGTH (NRF_ERROR_BASE_NUM + 9) ///< Invalid Length +#define NRF_ERROR_INVALID_FLAGS (NRF_ERROR_BASE_NUM + 10) ///< Invalid Flags +#define NRF_ERROR_INVALID_DATA (NRF_ERROR_BASE_NUM + 11) ///< Invalid Data +#define NRF_ERROR_DATA_SIZE (NRF_ERROR_BASE_NUM + 12) ///< Invalid Data size +#define NRF_ERROR_TIMEOUT (NRF_ERROR_BASE_NUM + 13) ///< Operation timed out +#define NRF_ERROR_NULL (NRF_ERROR_BASE_NUM + 14) ///< Null Pointer +#define NRF_ERROR_FORBIDDEN (NRF_ERROR_BASE_NUM + 15) ///< Forbidden Operation +#define NRF_ERROR_INVALID_ADDR (NRF_ERROR_BASE_NUM + 16) ///< Bad Memory Address +#define NRF_ERROR_BUSY (NRF_ERROR_BASE_NUM + 17) ///< Busy +#define NRF_ERROR_CONN_COUNT (NRF_ERROR_BASE_NUM + 18) ///< Maximum connection count exceeded. +#define NRF_ERROR_RESOURCES (NRF_ERROR_BASE_NUM + 19) ///< Not enough resources for operation + +#ifdef __cplusplus +} +#endif +#endif // NRF_ERROR_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_sdm.h new file mode 100644 index 0000000000..575829c7f9 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_sdm.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + /** + @addtogroup nrf_sdm_api + @{ + @defgroup nrf_sdm_error SoftDevice Manager Error Codes + @{ + + @brief Error definitions for the SDM API +*/ + +/* Header guard */ +#ifndef NRF_ERROR_SDM_H__ +#define NRF_ERROR_SDM_H__ + +#include "nrf_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN (NRF_ERROR_SDM_BASE_NUM + 0) ///< Unknown lfclk source. +#define NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION (NRF_ERROR_SDM_BASE_NUM + 1) ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts). +#define NRF_ERROR_SDM_INCORRECT_CLENR0 (NRF_ERROR_SDM_BASE_NUM + 2) ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing). + +#ifdef __cplusplus +} +#endif +#endif // NRF_ERROR_SDM_H__ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_soc.h new file mode 100644 index 0000000000..28989ee4e1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_soc.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup nrf_soc_api + @{ + @defgroup nrf_soc_error SoC Library Error Codes + @{ + + @brief Error definitions for the SoC library + +*/ + +/* Header guard */ +#ifndef NRF_ERROR_SOC_H__ +#define NRF_ERROR_SOC_H__ + +#include "nrf_error.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* Mutex Errors */ +#define NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN (NRF_ERROR_SOC_BASE_NUM + 0) ///< Mutex already taken + +/* NVIC errors */ +#define NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE (NRF_ERROR_SOC_BASE_NUM + 1) ///< NVIC interrupt not available +#define NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED (NRF_ERROR_SOC_BASE_NUM + 2) ///< NVIC interrupt priority not allowed +#define NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN (NRF_ERROR_SOC_BASE_NUM + 3) ///< NVIC should not return + +/* Power errors */ +#define NRF_ERROR_SOC_POWER_MODE_UNKNOWN (NRF_ERROR_SOC_BASE_NUM + 4) ///< Power mode unknown +#define NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN (NRF_ERROR_SOC_BASE_NUM + 5) ///< Power POF threshold unknown +#define NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN (NRF_ERROR_SOC_BASE_NUM + 6) ///< Power off should not return + +/* Rand errors */ +#define NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES (NRF_ERROR_SOC_BASE_NUM + 7) ///< RAND not enough values + +/* PPI errors */ +#define NRF_ERROR_SOC_PPI_INVALID_CHANNEL (NRF_ERROR_SOC_BASE_NUM + 8) ///< Invalid PPI Channel +#define NRF_ERROR_SOC_PPI_INVALID_GROUP (NRF_ERROR_SOC_BASE_NUM + 9) ///< Invalid PPI Group + +#ifdef __cplusplus +} +#endif +#endif // NRF_ERROR_SOC_H__ +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_nvic.h new file mode 100644 index 0000000000..8b49061c72 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_nvic.h @@ -0,0 +1,486 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @defgroup nrf_nvic_api SoftDevice NVIC API + * @{ + * + * @note In order to use this module, the following code has to be added to a .c file: + * \code + * nrf_nvic_state_t nrf_nvic_state; + * \endcode + * + * @note Definitions and declarations starting with __ (double underscore) in this header file are + * not intended for direct use by the application. + * + * @brief APIs for the accessing NVIC when using a SoftDevice. + * + */ + +#ifndef NRF_NVIC_H__ +#define NRF_NVIC_H__ + +#include +#include "nrf.h" + +#include "nrf_error_soc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@addtogroup NRF_NVIC_DEFINES Defines + * @{ */ + +/**@defgroup NRF_NVIC_ISER_DEFINES SoftDevice NVIC internal definitions + * @{ */ + +#define __NRF_NVIC_NVMC_IRQn (30) /**< The peripheral ID of the NVMC. IRQ numbers are used to identify peripherals, but the NVMC doesn't have an IRQ number in the MDK. */ + +#ifdef NRF51 + #define __NRF_NVIC_ISER_COUNT (1) /**< The number of ISER/ICER registers in the NVIC that are used. */ + + /**@brief Interrupts used by the SoftDevice. */ + #define __NRF_NVIC_SD_IRQS_0 ((uint32_t)( \ + (1U << POWER_CLOCK_IRQn) \ + | (1U << RADIO_IRQn) \ + | (1U << RTC0_IRQn) \ + | (1U << TIMER0_IRQn) \ + | (1U << RNG_IRQn) \ + | (1U << ECB_IRQn) \ + | (1U << CCM_AAR_IRQn) \ + | (1U << TEMP_IRQn) \ + | (1U << __NRF_NVIC_NVMC_IRQn) \ + | (1U << (uint32_t)SWI4_IRQn) \ + | (1U << (uint32_t)SWI5_IRQn) \ + )) + + /**@brief Interrupts available for to application. */ + #define __NRF_NVIC_APP_IRQS_0 (~__NRF_NVIC_SD_IRQS_0) +#endif + +#ifdef NRF52 + #define __NRF_NVIC_ISER_COUNT (2) /**< The number of ISER/ICER registers in the NVIC that are used. */ + + /**@brief Interrupts used by the SoftDevice. */ + #define __NRF_NVIC_SD_IRQS_0 ((uint32_t)( \ + (1U << POWER_CLOCK_IRQn) \ + | (1U << RADIO_IRQn) \ + | (1U << RTC0_IRQn) \ + | (1U << TIMER0_IRQn) \ + | (1U << RNG_IRQn) \ + | (1U << ECB_IRQn) \ + | (1U << CCM_AAR_IRQn) \ + | (1U << TEMP_IRQn) \ + | (1U << __NRF_NVIC_NVMC_IRQn) \ + | (1U << (uint32_t)SWI4_EGU4_IRQn) \ + | (1U << (uint32_t)SWI5_EGU5_IRQn) \ + )) + #define __NRF_NVIC_SD_IRQS_1 ((uint32_t)0) + + /**@brief Interrupts available for to application. */ + #define __NRF_NVIC_APP_IRQS_0 (~__NRF_NVIC_SD_IRQS_0) + #define __NRF_NVIC_APP_IRQS_1 (~__NRF_NVIC_SD_IRQS_1) +#endif +/**@} */ + +/**@} */ + +/**@addtogroup NRF_NVIC_VARIABLES Variables + * @{ */ + +/**@brief Type representing the state struct for the SoftDevice NVIC module. */ +typedef struct +{ + uint32_t volatile __irq_masks[__NRF_NVIC_ISER_COUNT]; /**< IRQs enabled by the application in the NVIC. */ + uint32_t volatile __cr_flag; /**< Non-zero if already in a critical region */ +} nrf_nvic_state_t; + +/**@brief Variable keeping the state for the SoftDevice NVIC module. This must be declared in an + * application source file. */ +extern nrf_nvic_state_t nrf_nvic_state; + +/**@} */ + +/**@addtogroup NRF_NVIC_INTERNAL_FUNCTIONS SoftDevice NVIC internal functions + * @{ */ + +/**@brief Disables IRQ interrupts globally, including the SoftDevice's interrupts. + * + * @retval The value of PRIMASK prior to disabling the interrupts. + */ +static inline int __sd_nvic_irq_disable(void) +{ + int pm = __get_PRIMASK(); + __disable_irq(); + return pm; +} + +/**@brief Enables IRQ interrupts globally, including the SoftDevice's interrupts. + */ +static inline void __sd_nvic_irq_enable(void) +{ + __enable_irq(); +} + +/**@brief Checks if IRQn is available to application + * @param[in] IRQn irq to check + * + * @retval 1 (true) if the irq to check is available to the application + */ +static inline uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn) +{ + if (IRQn < 32) + { + return ((1UL<= (1 << __NVIC_PRIO_BITS)) + { + return 0; + } +#ifdef NRF51 + if( priority == 0 + || priority == 2 + ) + { + return 0; + } +#endif +#ifdef NRF52 + if( priority == 0 + || priority == 1 + || priority == 4 + || priority == 5 + ) + { + return 0; + } +#endif + return 1; +} + +/**@} */ + +/**@addtogroup NRF_NVIC_FUNCTIONS SoftDevice NVIC public functions + * @{ */ + +/**@brief Enable External Interrupt. + * @note Corresponds to NVIC_EnableIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt was enabled. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt has a priority not available for the application. + */ +static inline uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn) +{ + if (!__sd_nvic_app_accessible_irq(IRQn)) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } + if (!__sd_nvic_is_app_accessible_priority(NVIC_GetPriority(IRQn))) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED; + } + + if (nrf_nvic_state.__cr_flag) + { + nrf_nvic_state.__irq_masks[(uint32_t)((int32_t)IRQn) >> 5] |= (uint32_t)(1 << ((uint32_t)((int32_t)IRQn) & (uint32_t)0x1F)); + } + else + { + NVIC_EnableIRQ(IRQn); + } + return NRF_SUCCESS; +} + +/**@brief Disable External Interrupt. + * @note Corresponds to NVIC_DisableIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt was disabled. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. + */ +static inline uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn) +{ + if (!__sd_nvic_app_accessible_irq(IRQn)) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } + + if (nrf_nvic_state.__cr_flag) + { + nrf_nvic_state.__irq_masks[(uint32_t)((int32_t)IRQn) >> 5] &= ~(1UL << ((uint32_t)(IRQn) & 0x1F)); + } + else + { + NVIC_DisableIRQ(IRQn); + } + + return NRF_SUCCESS; +} + +/**@brief Get Pending Interrupt. + * @note Corresponds to NVIC_GetPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_GetPendingIRQ documentation in CMSIS. + * @param[out] p_pending_irq Return value from NVIC_GetPendingIRQ. + * + * @retval ::NRF_SUCCESS The interrupt is available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +static inline uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq) +{ + if (__sd_nvic_app_accessible_irq(IRQn)) + { + *p_pending_irq = NVIC_GetPendingIRQ(IRQn); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } +} + +/**@brief Set Pending Interrupt. + * @note Corresponds to NVIC_SetPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt is set pending. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +static inline uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn) +{ + if (__sd_nvic_app_accessible_irq(IRQn)) + { + NVIC_SetPendingIRQ(IRQn); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } +} + +/**@brief Clear Pending Interrupt. + * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt pending flag is cleared. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +static inline uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn) +{ + if (__sd_nvic_app_accessible_irq(IRQn)) + { + NVIC_ClearPendingIRQ(IRQn); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } +} + +/**@brief Set Interrupt Priority. + * @note Corresponds to NVIC_SetPriority in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * @pre Priority is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_SetPriority documentation in CMSIS. + * @param[in] priority A valid IRQ priority for use by the application. + * + * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt priority is not available for the application. + */ +static inline uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if (!__sd_nvic_app_accessible_irq(IRQn)) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } + + if (!__sd_nvic_is_app_accessible_priority(priority)) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED; + } + + NVIC_SetPriority(IRQn, (uint32_t)priority); + return NRF_SUCCESS; +} + +/**@brief Get Interrupt Priority. + * @note Corresponds to NVIC_GetPriority in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_GetPriority documentation in CMSIS. + * @param[out] p_priority Return value from NVIC_GetPriority. + * + * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE - IRQn is not available for the application. + */ +static inline uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority) +{ + if (__sd_nvic_app_accessible_irq(IRQn)) + { + *p_priority = (NVIC_GetPriority(IRQn) & 0xFF); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } +} + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +static inline uint32_t sd_nvic_SystemReset(void) +{ + NVIC_SystemReset(); + return NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN; +} + +/**@brief Enters critical region. + * + * @post Application interrupts will be disabled. + * @note sd_nvic_critical_region_enter() and ::sd_nvic_critical_region_exit() must be called in matching pairs inside each + * execution context + * @sa sd_nvic_critical_region_exit + * + * @retval ::NRF_SUCCESS + */ +static inline uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region) +{ + int was_masked = __sd_nvic_irq_disable(); + if (!nrf_nvic_state.__cr_flag) + { + nrf_nvic_state.__cr_flag = 1; + nrf_nvic_state.__irq_masks[0] = ( NVIC->ICER[0] & __NRF_NVIC_APP_IRQS_0 ); + NVIC->ICER[0] = __NRF_NVIC_APP_IRQS_0; + #ifdef NRF52 + nrf_nvic_state.__irq_masks[1] = ( NVIC->ICER[1] & __NRF_NVIC_APP_IRQS_1 ); + NVIC->ICER[1] = __NRF_NVIC_APP_IRQS_1; + #endif + *p_is_nested_critical_region = 0; + } + else + { + *p_is_nested_critical_region = 1; + } + if (!was_masked) + { + __sd_nvic_irq_enable(); + } + return NRF_SUCCESS; +} + +/**@brief Exit critical region. + * + * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter. + * @post If not in a nested critical region, the application interrupts will restored to the state before ::sd_nvic_critical_region_enter was called. + * + * @param[in] is_nested_critical_region If this is set to 1, the critical region won't be exited. @sa sd_nvic_critical_region_enter. + * + * @retval ::NRF_SUCCESS + */ +static inline uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region) +{ + if (nrf_nvic_state.__cr_flag && (is_nested_critical_region == 0)) + { + int was_masked = __sd_nvic_irq_disable(); + NVIC->ISER[0] = nrf_nvic_state.__irq_masks[0]; + #ifdef NRF52 + NVIC->ISER[1] = nrf_nvic_state.__irq_masks[1]; + #endif + nrf_nvic_state.__cr_flag = 0; + if (!was_masked) + { + __sd_nvic_irq_enable(); + } + } + + return NRF_SUCCESS; +} +/**@} */ + +#ifdef __cplusplus +} +#endif + +#endif // NRF_NVIC_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sd_def.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sd_def.h new file mode 100644 index 0000000000..1af95f1dc6 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sd_def.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_SD_DEF_H__ +#define NRF_SD_DEF_H__ + +#include + +#define SD_PPI_CHANNELS_USED 0xFFF0C000uL /**< PPI channels utilized by SotfDevice (not available to the application). */ +#define SD_PPI_GROUPS_USED 0x0000000CuL /**< PPI groups utilized by SoftDevice (not available to the application). */ +#define SD_TIMERS_USED 0x00000001uL /**< Timers used by SoftDevice. */ +#define SD_SWI_USED 0x0000003CuL /**< Software interrupts used by SoftDevice */ + +#endif /* NRF_SD_DEF_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sdm.h new file mode 100644 index 0000000000..bb370abffe --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sdm.h @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @defgroup nrf_sdm_api SoftDevice Manager API + @{ + + @brief APIs for SoftDevice management. + +*/ + +/* Header guard */ +#ifndef NRF_SDM_H__ +#define NRF_SDM_H__ + +#include "nrf_svc.h" +#include "nrf.h" +#include "nrf_soc.h" +#include "nrf_error_sdm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ +#ifdef NRFSOC_DOXYGEN +//Stuff defined elsewere, to satisfy doxygen +#define MBR_SIZE 0 +#warning test +#endif + +/** @brief SoftDevice Manager SVC Base number. */ +#define SDM_SVC_BASE 0x10 + +/** @brief Defines the SoftDevice Information Structure location (address) as an offset from +the start of the softdevice (without MBR)*/ +#define SOFTDEVICE_INFO_STRUCT_OFFSET (0x2000) + +/** @brief Defines the absolute Softdevice information structure location (address)*/ +#define SOFTDEVICE_INFO_STRUCT_ADDRESS (SOFTDEVICE_INFO_STRUCT_OFFSET + MBR_SIZE) + +/** @brief Defines the offset for Softdevice size value relative to Softdevice base address*/ +#define SD_SIZE_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x08) + +/** @brief Defines the offset for FWID value relative to Softdevice base address*/ +#define SD_FWID_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x0C) + +/** @brief Defines a macro for retreiving the actual Softdevice size value from a given base address + use @ref MBR_SIZE when Softdevice is installed just above the MBR (the usual case)*/ +#define SD_SIZE_GET(baseaddr) (*((uint32_t *) ((baseaddr) + SD_SIZE_OFFSET))) + +/** @brief Defines a macro for retreiving the actual FWID value from a given base address + use @ref MBR_SIZE when Softdevice is installed just above the MBR (the usual case)*/ +#define SD_FWID_GET(baseaddr) ((*((uint32_t *) ((baseaddr) + SD_FWID_OFFSET))) & 0xFFFF) + +/**@defgroup NRF_FAULT_ID_RANGES Fault ID ranges + * @{ */ +#define NRF_FAULT_ID_SD_RANGE_START 0x00000000 /**< SoftDevice ID range start. */ +#define NRF_FAULT_ID_APP_RANGE_START 0x00001000 /**< Application ID range start. */ +/**@} */ + +/**@defgroup NRF_FAULT_IDS Fault ID types + * @{ */ +#define NRF_FAULT_ID_SD_ASSERT (NRF_FAULT_ID_SD_RANGE_START + 1) /**< SoftDevice assertion. The info parameter will be set to 0x00000000. */ +#define NRF_FAULT_ID_APP_MEMACC (NRF_FAULT_ID_APP_RANGE_START + 1) /**< Application invalid memory access. The info parameter will contain the address in memory that was accessed. */ +/**@} */ + +/** @} */ + +/** @addtogroup NRF_SDM_ENUMS Enumerations + * @{ */ + +/**@brief nRF SoftDevice Manager API SVC numbers. */ +enum NRF_SD_SVCS +{ + SD_SOFTDEVICE_ENABLE = SDM_SVC_BASE, /**< ::sd_softdevice_enable */ + SD_SOFTDEVICE_DISABLE, /**< ::sd_softdevice_disable */ + SD_SOFTDEVICE_IS_ENABLED, /**< ::sd_softdevice_is_enabled */ + SD_SOFTDEVICE_VECTOR_TABLE_BASE_SET, /**< ::sd_softdevice_vector_table_base_set */ + SVC_SDM_LAST /**< Placeholder for last SDM SVC */ +}; + +/** @} */ + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ + +/**@defgroup NRF_CLOCK_LF_XTAL_ACCURACY Clock accuracy * @{ */ + +#define NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM (0) /* Default */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM (1) +#define NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM (2) +#define NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM (3) +#define NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM (4) +#define NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM (5) +#define NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM (6) +#define NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM (7) + +/** @} */ + +/**@defgroup NRF_CLOCK_LF_SRC Possible lfclk oscillator sources * @{ */ + +#define NRF_CLOCK_LF_SRC_RC (0) /**< LFCLK RC oscillator. */ +#define NRF_CLOCK_LF_SRC_XTAL (1) /**< LFCLK crystal oscillator. */ +#define NRF_CLOCK_LF_SRC_SYNTH (2) /**< LFCLK Synthesized from HFCLK. */ + +/** @} */ +/** @} */ + +/** @addtogroup NRF_SDM_TYPES Types + * @{ */ + +/**@brief Type representing lfclk oscillator source. */ +typedef struct +{ + uint8_t source; /**< LF oscillator clock source, see @ref NRF_CLOCK_LF_SRC. */ + uint8_t rc_ctiv; /**< Only for NRF_CLOCK_LF_SRC_RC: Calibration timer interval in 1/4 second + units (nRF51: 1-64, nRF52: 1-32). + @note To avoid excessive clock drift, 0.5 degrees Celsius is the + maximum temperature change allowed in one calibration timer + interval. The interval should be selected to ensure this. + + @note Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. */ + uint8_t rc_temp_ctiv; /**< Only for NRF_CLOCK_LF_SRC_RC: How often (in number of calibration + intervals) the RC oscillator shall be calibrated if the temperature + hasn't changed. + 0: Always calibrate even if the temperature hasn't changed. + 1: Only calibrate if the temperature has changed (nRF51 only). + 2-33: Check the temperature and only calibrate if it has changed, + however calibration will take place every rc_temp_ctiv + intervals in any case. + + @note Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. + + @note For nRF52, the application must ensure calibration at least once + every 8 seconds to ensure +/-250ppm clock stability. The + recommended configuration for NRF_CLOCK_LF_SRC_RC on nRF52 is + rc_ctiv=16 and rc_temp_ctiv=2. This will ensure calibration at + least once every 8 seconds and for temperature changes of 0.5 + degrees Celsius every 4 seconds. See the Product Specification + for the nRF52 device being used for more information.*/ + uint8_t xtal_accuracy; /**< External crystal clock accuracy used in the LL to compute timing windows. + + @note For the NRF_CLOCK_LF_SRC_RC clock source this parameter is ignored. */ +} nrf_clock_lf_cfg_t; + +/**@brief Fault Handler type. + * + * When certain unrecoverable errors occur within the application or SoftDevice the fault handler will be called back. + * The protocol stack will be in an undefined state when this happens and the only way to recover will be to + * perform a reset, using e.g. CMSIS NVIC_SystemReset(). + * + * @note This callback is executed in HardFault context, thus SVC functions cannot be called from the fault callback. + * + * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. + * @param[in] pc The program counter of the instruction that triggered the fault. + * @param[in] info Optional additional information regarding the fault. Refer to each Fault identifier for details. + */ +typedef void (*nrf_fault_handler_t)(uint32_t id, uint32_t pc, uint32_t info); + +/** @} */ + +/** @addtogroup NRF_SDM_FUNCTIONS Functions + * @{ */ + +/**@brief Enables the SoftDevice and by extension the protocol stack. + * + * @note Some care must be taken if a low frequency clock source is already running when calling this function: + * If the LF clock has a different source then the one currently running, it will be stopped. Then, the new + * clock source will be started. + * + * @note This function has no effect when returning with an error. + * + * @post If return code is ::NRF_SUCCESS + * - SoC library and protocol stack APIs are made available. + * - A portion of RAM will be unavailable (see relevant SDS documentation). + * - Some peripherals will be unavailable or available only through the SoC API (see relevant SDS documentation). + * - Interrupts will not arrive from protected peripherals or interrupts. + * - nrf_nvic_ functions must be used instead of CMSIS NVIC_ functions for reliable usage of the SoftDevice. + * - Interrupt latency may be affected by the SoftDevice (see relevant SDS documentation). + * - Chosen low frequency clock source will be running. + * + * @param p_clock_lf_cfg Low frequency clock source and accuracy. + If NULL the clock will be configured as an rc source with rc_ctiv = 16 and .rc_temp_ctiv = 2 + In the case of XTAL source, the PPM accuracy of the chosen clock source must be greater than or equal to the actual characteristics of your XTAL clock. + * @param fault_handler Callback to be invoked in case of fault. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and fault handler cannot be updated. + * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level. + * @retval ::NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN Unknown low frequency clock source selected. + */ +SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler)); + + +/**@brief Disables the SoftDevice and by extension the protocol stack. + * + * Idempotent function to disable the SoftDevice. + * + * @post SoC library and protocol stack APIs are made unavailable. + * @post All interrupts that was protected by the SoftDevice will be disabled and initialized to priority 0 (highest). + * @post All peripherals used by the SoftDevice will be reset to default values. + * @post All of RAM become available. + * @post All interrupts are forwarded to the application. + * @post LFCLK source chosen in ::sd_softdevice_enable will be left running. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_SOFTDEVICE_DISABLE, uint32_t, sd_softdevice_disable(void)); + +/**@brief Check if the SoftDevice is enabled. + * + * @param[out] p_softdevice_enabled If the SoftDevice is enabled: 1 else 0. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_SOFTDEVICE_IS_ENABLED, uint32_t, sd_softdevice_is_enabled(uint8_t * p_softdevice_enabled)); + +/**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the SoftDevice + * + * This function is only intended to be called when a bootloader is enabled. + * + * @param[in] address The base address of the interrupt vector table for forwarded interrupts. + + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_SOFTDEVICE_VECTOR_TABLE_BASE_SET, uint32_t, sd_softdevice_vector_table_base_set(uint32_t address)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_SDM_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_soc.h new file mode 100644 index 0000000000..e1fbb2236a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_soc.h @@ -0,0 +1,911 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @defgroup nrf_soc_api SoC Library API + * @{ + * + * @brief APIs for the SoC library. + * + */ + +#ifndef NRF_SOC_H__ +#define NRF_SOC_H__ + +#include +#include +#include "nrf_svc.h" +#include "nrf.h" + +#include "nrf_error_soc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@addtogroup NRF_SOC_DEFINES Defines + * @{ */ + +/**@brief The number of the lowest SVC number reserved for the SoC library. */ +#define SOC_SVC_BASE (0x20) +#define SOC_SVC_BASE_NOT_AVAILABLE (0x2B) + +/**@brief Guranteed time for application to process radio inactive notification. */ +#define NRF_RADIO_NOTIFICATION_INACTIVE_GUARANTEED_TIME_US (62) + +/**@brief The minimum allowed timeslot extension time. */ +#define NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US (200) + +#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. */ + +#ifdef NRF51 +#define SD_EVT_IRQn (SWI2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ +#define SD_EVT_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. */ +#endif +#ifdef NRF52 +#define SD_EVT_IRQn (SWI2_EGU2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ +#define SD_EVT_IRQHandler (SWI2_EGU2_IRQHandler) /**< SoftDevice Event IRQ handler. Used for both protocol events and SoC events. */ +#define RADIO_NOTIFICATION_IRQn (SWI1_EGU1_IRQn) /**< The radio notification IRQ number. */ +#define RADIO_NOTIFICATION_IRQHandler (SWI1_EGU1_IRQHandler) /**< The radio notification IRQ handler. */ +#endif + +#define NRF_RADIO_LENGTH_MIN_US (100) /**< The shortest allowed radio timeslot, in microseconds. */ +#define NRF_RADIO_LENGTH_MAX_US (100000) /**< The longest allowed radio timeslot, in microseconds. */ + +#define NRF_RADIO_DISTANCE_MAX_US (128000000UL - 1UL) /**< The longest timeslot distance, in microseconds, allowed for the distance parameter (see @ref nrf_radio_request_normal_t) in the request. */ + +#define NRF_RADIO_EARLIEST_TIMEOUT_MAX_US (128000000UL - 1UL) /**< The longest timeout, in microseconds, allowed when requesting the earliest possible timeslot. */ + +#define NRF_RADIO_START_JITTER_US (2) /**< The maximum jitter in @ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START relative to the requested start time. */ + +/**@} */ + +/**@addtogroup NRF_SOC_ENUMS Enumerations + * @{ */ + +/**@brief The SVC numbers used by the SVC functions in the SoC library. */ +enum NRF_SOC_SVCS +{ + SD_PPI_CHANNEL_ENABLE_GET = SOC_SVC_BASE, + 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_FLASH_PAGE_ERASE, + SD_FLASH_WRITE, + SD_FLASH_PROTECT, + SD_MUTEX_NEW = SOC_SVC_BASE_NOT_AVAILABLE, + SD_MUTEX_ACQUIRE, + SD_MUTEX_RELEASE, + SD_RFU_1, + SD_RFU_2, + SD_RFU_3, + SD_RFU_4, + SD_RFU_5, + SD_RFU_6, + SD_RFU_7, + SD_RFU_8, + SD_RFU_9, + SD_RFU_10, + SD_RAND_APPLICATION_POOL_CAPACITY_GET, + SD_RAND_APPLICATION_BYTES_AVAILABLE_GET, + SD_RAND_APPLICATION_VECTOR_GET, + 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_EVT_WAIT, + SD_CLOCK_HFCLK_REQUEST, + SD_CLOCK_HFCLK_RELEASE, + SD_CLOCK_HFCLK_IS_RUNNING, + SD_RADIO_NOTIFICATION_CFG_SET, + SD_ECB_BLOCK_ENCRYPT, + SD_ECB_BLOCKS_ENCRYPT, + SD_RADIO_SESSION_OPEN, + SD_RADIO_SESSION_CLOSE, + SD_RADIO_REQUEST, + SD_EVT_GET, + SD_TEMP_GET, + SVC_SOC_LAST +}; + +/**@brief Possible values of a ::nrf_mutex_t. */ +enum NRF_MUTEX_VALUES +{ + NRF_MUTEX_FREE, + NRF_MUTEX_TAKEN +}; + +/**@brief Power modes. */ +enum NRF_POWER_MODES +{ + NRF_POWER_MODE_CONSTLAT, /**< Constant latency mode. See power management in the reference manual. */ + NRF_POWER_MODE_LOWPWR /**< Low power mode. See power management in the reference manual. */ +}; + + +/**@brief Power failure thresholds */ +enum NRF_POWER_THRESHOLDS +{ + NRF_POWER_THRESHOLD_V21, /**< 2.1 Volts power failure threshold. */ + NRF_POWER_THRESHOLD_V23, /**< 2.3 Volts power failure threshold. */ + NRF_POWER_THRESHOLD_V25, /**< 2.5 Volts power failure threshold. */ + NRF_POWER_THRESHOLD_V27 /**< 2.7 Volts power failure threshold. */ +}; + + +/**@brief DC/DC converter modes. */ +enum NRF_POWER_DCDC_MODES +{ + NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */ + NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */ +}; + +/**@brief Radio notification distances. */ +enum NRF_RADIO_NOTIFICATION_DISTANCES +{ + NRF_RADIO_NOTIFICATION_DISTANCE_NONE = 0, /**< The event does not have a notification. */ + NRF_RADIO_NOTIFICATION_DISTANCE_800US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_1740US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_2680US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_3620US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_4560US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_5500US /**< The distance from the active notification to start of radio activity. */ +}; + + +/**@brief Radio notification types. */ +enum NRF_RADIO_NOTIFICATION_TYPES +{ + NRF_RADIO_NOTIFICATION_TYPE_NONE = 0, /**< The event does not have a radio notification signal. */ + NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE, /**< Using interrupt for notification when the radio will be enabled. */ + NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, /**< Using interrupt for notification when the radio has been disabled. */ + NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH, /**< Using interrupt for notification both when the radio will be enabled and disabled. */ +}; + +/**@brief The Radio signal callback types. */ +enum NRF_RADIO_CALLBACK_SIGNAL_TYPE +{ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_START, /**< This signal indicates the start of the radio timeslot. */ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0, /**< This signal indicates the NRF_TIMER0 interrupt. */ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO, /**< This signal indicates the NRF_RADIO interrupt. */ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED, /**< This signal indicates extend action failed. */ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_SUCCEEDED /**< This signal indicates extend action succeeded. */ +}; + +/**@brief The actions requested by the signal callback. + * + * This code gives the SOC instructions about what action to take when the signal callback has + * returned. + */ +enum NRF_RADIO_SIGNAL_CALLBACK_ACTION +{ + NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE, /**< Return without action. */ + NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND, /**< Request an extension of the current timeslot (maximum execution time for this action is when the extension succeeded). */ + NRF_RADIO_SIGNAL_CALLBACK_ACTION_END, /**< End the current radio timeslot. */ + NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END /**< Request a new radio timeslot and end the current timeslot. */ +}; + +/**@brief Radio timeslot high frequency clock source configuration. */ +enum NRF_RADIO_HFCLK_CFG +{ + NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED, /**< The SoftDevice will guarantee that the high frequency clock source is the + external crystal for the whole duration of the timeslot. This should be the + preferred option for events that use the radio or require high timing accuracy. */ + NRF_RADIO_HFCLK_CFG_NO_GUARANTEE /**< This configuration allows for earlier and tighter scheduling of timeslots. + The RC oscillator may be the clock source in part or for the whole duration of the timeslot. + The RC oscillator's accuracy must therefore be taken into consideration. + @note If the application will use the radio peripheral in timeslots with this configuration, + it must make sure that the crystal is running and stable before starting the radio. */ +}; + +/**@brief Radio timeslot priorities. */ +enum NRF_RADIO_PRIORITY +{ + NRF_RADIO_PRIORITY_HIGH, /**< High (equal priority as the normal connection priority of the SoftDevice stack(s)). */ + NRF_RADIO_PRIORITY_NORMAL, /**< Normal (equal priority as the priority of secondary activites of the SoftDevice stack(s)). */ +}; + +/**@brief Radio timeslot request type. */ +enum NRF_RADIO_REQUEST_TYPE +{ + NRF_RADIO_REQ_TYPE_EARLIEST, /**< Request radio timeslot as early as possible. This should always be used for the first request in a session. */ + NRF_RADIO_REQ_TYPE_NORMAL /**< Normal radio timeslot request. */ +}; + +/**@brief SoC Events. */ +enum NRF_SOC_EVTS +{ + NRF_EVT_HFCLKSTARTED, /**< Event indicating that the HFCLK has started. */ + NRF_EVT_POWER_FAILURE_WARNING, /**< Event indicating that a power failure warning has occurred. */ + NRF_EVT_FLASH_OPERATION_SUCCESS, /**< Event indicating that the ongoing flash operation has completed successfully. */ + NRF_EVT_FLASH_OPERATION_ERROR, /**< Event indicating that the ongoing flash operation has timed out with an error. */ + NRF_EVT_RADIO_BLOCKED, /**< Event indicating that a radio timeslot was blocked. */ + NRF_EVT_RADIO_CANCELED, /**< Event indicating that a radio timeslot was canceled by SoftDevice. */ + NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN, /**< Event indicating that a radio timeslot signal callback handler return was invalid. */ + NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio timeslot session is idle. */ + NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio timeslot session is closed. */ + NRF_EVT_NUMBER_OF_EVTS +}; + +/**@} */ + + +/**@addtogroup NRF_SOC_STRUCTURES Structures + * @{ */ + +/**@brief Represents a mutex for use with the nrf_mutex functions. + * @note Accessing the value directly is not safe, use the mutex functions! + */ +typedef volatile uint8_t nrf_mutex_t; + +/**@brief Parameters for a request for a timeslot as early as possible. */ +typedef struct +{ + uint8_t hfclk; /**< High frequency clock source, see @ref NRF_RADIO_HFCLK_CFG. */ + uint8_t priority; /**< The radio timeslot priority, see @ref NRF_RADIO_PRIORITY. */ + uint32_t length_us; /**< The radio timeslot length (in the range 100 to 100,000] microseconds). */ + uint32_t timeout_us; /**< Longest acceptable delay until the start of the requested timeslot (up to @ref NRF_RADIO_EARLIEST_TIMEOUT_MAX_US microseconds). */ +} nrf_radio_request_earliest_t; + +/**@brief Parameters for a normal radio timeslot request. */ +typedef struct +{ + uint8_t hfclk; /**< High frequency clock source, see @ref NRF_RADIO_HFCLK_CFG. */ + uint8_t priority; /**< The radio timeslot priority, see @ref NRF_RADIO_PRIORITY. */ + uint32_t distance_us; /**< Distance from the start of the previous radio timeslot (up to @ref NRF_RADIO_DISTANCE_MAX_US microseconds). */ + uint32_t length_us; /**< The radio timeslot length (in the range [100..100,000] microseconds). */ +} nrf_radio_request_normal_t; + +/**@brief Radio timeslot request parameters. */ +typedef struct +{ + uint8_t request_type; /**< Type of request, see @ref NRF_RADIO_REQUEST_TYPE. */ + union + { + nrf_radio_request_earliest_t earliest; /**< Parameters for requesting a radio timeslot as early as possible. */ + nrf_radio_request_normal_t normal; /**< Parameters for requesting a normal radio timeslot. */ + } params; +} nrf_radio_request_t; + +/**@brief Return parameters of the radio timeslot signal callback. */ +typedef struct +{ + uint8_t callback_action; /**< The action requested by the application when returning from the signal callback, see @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION. */ + union + { + struct + { + nrf_radio_request_t * p_next; /**< The request parameters for the next radio timeslot. */ + } request; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END. */ + struct + { + uint32_t length_us; /**< Requested extension of the radio timeslot duration (microseconds) (for minimum time see @ref NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US). */ + } extend; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND. */ + } params; +} nrf_radio_signal_callback_return_param_t; + +/**@brief The radio timeslot signal callback type. + * + * @note In case of invalid return parameters, the radio timeslot will automatically end + * immediately after returning from the signal callback and the + * @ref NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN event will be sent. + * @note The returned struct pointer must remain valid after the signal callback + * function returns. For instance, this means that it must not point to a stack variable. + * + * @param[in] signal_type Type of signal, see @ref NRF_RADIO_CALLBACK_SIGNAL_TYPE. + * + * @return Pointer to structure containing action requested by the application. + */ +typedef nrf_radio_signal_callback_return_param_t * (*nrf_radio_signal_callback_t) (uint8_t signal_type); + +/**@brief AES ECB parameter typedefs */ +typedef uint8_t soc_ecb_key_t[SOC_ECB_KEY_LENGTH]; +typedef uint8_t soc_ecb_cleartext_t[SOC_ECB_CLEARTEXT_LENGTH]; +typedef uint8_t soc_ecb_ciphertext_t[SOC_ECB_CIPHERTEXT_LENGTH]; + +/**@brief AES ECB data structure */ +typedef struct +{ + soc_ecb_key_t key; /**< Encryption key. */ + soc_ecb_cleartext_t cleartext; /**< Cleartext data. */ + soc_ecb_ciphertext_t ciphertext; /**< Ciphertext data. */ +} nrf_ecb_hal_data_t; + +/**@brief AES ECB block. Used to provide multiple blocks in a single call + to @ref sd_ecb_blocks_encrypt.*/ +typedef struct +{ + soc_ecb_key_t* p_key; /**< Pointer to the Encryption key. */ + soc_ecb_cleartext_t* p_cleartext; /**< Pointer to the Cleartext data. */ + soc_ecb_ciphertext_t* p_ciphertext; /**< Pointer to the Ciphertext data. */ +} nrf_ecb_hal_data_block_t; + +/**@} */ + +/**@addtogroup NRF_SOC_FUNCTIONS Functions + * @{ */ + +/**@brief Initialize a mutex. + * + * @param[in] p_mutex Pointer to the mutex to initialize. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_MUTEX_NEW, uint32_t, sd_mutex_new(nrf_mutex_t * p_mutex)); + +/**@brief Attempt to acquire a mutex. + * + * @param[in] p_mutex Pointer to the mutex to acquire. + * + * @retval ::NRF_SUCCESS The mutex was successfully acquired. + * @retval ::NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN The mutex could not be acquired. + */ +SVCALL(SD_MUTEX_ACQUIRE, uint32_t, sd_mutex_acquire(nrf_mutex_t * p_mutex)); + +/**@brief Release a mutex. + * + * @param[in] p_mutex Pointer to the mutex to release. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_MUTEX_RELEASE, uint32_t, sd_mutex_release(nrf_mutex_t * p_mutex)); + +/**@brief Query the capacity of the application random pool. + * + * @param[out] p_pool_capacity The capacity of the pool. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_RAND_APPLICATION_POOL_CAPACITY_GET, uint32_t, sd_rand_application_pool_capacity_get(uint8_t * p_pool_capacity)); + +/**@brief Get number of random bytes available to the application. + * + * @param[out] p_bytes_available The number of bytes currently available in the pool. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_RAND_APPLICATION_BYTES_AVAILABLE_GET, uint32_t, sd_rand_application_bytes_available_get(uint8_t * p_bytes_available)); + +/**@brief Get random bytes from the application pool. + * + * @param[out] p_buff Pointer to unit8_t buffer for storing the bytes. + * @param[in] length Number of bytes to take from pool and place in p_buff. + * + * @retval ::NRF_SUCCESS The requested bytes were written to p_buff. + * @retval ::NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES No bytes were written to the buffer, because there were not enough bytes available. +*/ +SVCALL(SD_RAND_APPLICATION_VECTOR_GET, uint32_t, sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length)); + +/**@brief Gets the reset reason register. + * + * @param[out] p_reset_reason Contents of the NRF_POWER->RESETREAS register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RESET_REASON_GET, uint32_t, sd_power_reset_reason_get(uint32_t * p_reset_reason)); + +/**@brief Clears the bits of the reset reason register. + * + * @param[in] reset_reason_clr_msk Contains the bits to clear from the reset reason register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RESET_REASON_CLR, uint32_t, sd_power_reset_reason_clr(uint32_t reset_reason_clr_msk)); + +/**@brief Sets the power mode when in CPU sleep. + * + * @param[in] power_mode The power mode to use when in CPU sleep, see @ref NRF_POWER_MODES. @sa sd_app_evt_wait + * + * @retval ::NRF_SUCCESS The power mode was set. + * @retval ::NRF_ERROR_SOC_POWER_MODE_UNKNOWN The power mode was unknown. + */ +SVCALL(SD_POWER_MODE_SET, uint32_t, sd_power_mode_set(uint8_t power_mode)); + +/**@brief Puts the chip in System OFF mode. + * + * @retval ::NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN + */ +SVCALL(SD_POWER_SYSTEM_OFF, uint32_t, sd_power_system_off(void)); + +/**@brief Enables or disables the power-fail comparator. + * + * Enabling this will give a softdevice event (NRF_EVT_POWER_FAILURE_WARNING) when the power failure warning occurs. + * The event can be retrieved with sd_evt_get(); + * + * @param[in] pof_enable True if the power-fail comparator should be enabled, false if it should be disabled. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_POF_ENABLE, uint32_t, sd_power_pof_enable(uint8_t pof_enable)); + +/**@brief Sets the power-fail threshold value. + * + * @param[in] threshold The power-fail threshold value to use, see @ref NRF_POWER_THRESHOLDS. + * + * @retval ::NRF_SUCCESS The power failure threshold was set. + * @retval ::NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN The power failure threshold is unknown. + */ +SVCALL(SD_POWER_POF_THRESHOLD_SET, uint32_t, sd_power_pof_threshold_set(uint8_t threshold)); + +/**@brief Sets bits in the NRF_POWER->RAMON register. + * + * @param[in] ramon Contains the bits needed to be set in the NRF_POWER->RAMON register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RAMON_SET, uint32_t, sd_power_ramon_set(uint32_t ramon)); + +/**@brief Clears bits in the NRF_POWER->RAMON register. + * + * @param ramon Contains the bits needed to be cleared in the NRF_POWER->RAMON register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RAMON_CLR, uint32_t, sd_power_ramon_clr(uint32_t ramon)); + +/**@brief Get contents of NRF_POWER->RAMON register, indicates power status of ram blocks. + * + * @param[out] p_ramon Content of NRF_POWER->RAMON register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RAMON_GET, uint32_t, sd_power_ramon_get(uint32_t * p_ramon)); + +/**@brief Set bits in the NRF_POWER->GPREGRET register. + * + * @param[in] gpregret_msk Bits to be set in the GPREGRET register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_GPREGRET_SET, uint32_t, sd_power_gpregret_set(uint32_t gpregret_msk)); + +/**@brief Clear bits in the NRF_POWER->GPREGRET register. + * + * @param[in] gpregret_msk Bits to be clear in the GPREGRET register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_GPREGRET_CLR, uint32_t, sd_power_gpregret_clr(uint32_t gpregret_msk)); + +/**@brief Get contents of the NRF_POWER->GPREGRET register. + * + * @param[out] p_gpregret Contents of the GPREGRET register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_GPREGRET_GET, uint32_t, sd_power_gpregret_get(uint32_t *p_gpregret)); + +/**@brief Sets the DCDC mode. + * + * Enable or disable the DCDC peripheral. + * + * @param[in] dcdc_mode The mode of the DCDC, see @ref NRF_POWER_DCDC_MODES. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_PARAM The DCDC mode is invalid. + */ +SVCALL(SD_POWER_DCDC_MODE_SET, uint32_t, sd_power_dcdc_mode_set(uint8_t dcdc_mode)); + +/**@brief Request the high frequency crystal oscillator. + * + * 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. + * + * @see sd_clock_hfclk_is_running + * @see sd_clock_hfclk_release + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_CLOCK_HFCLK_REQUEST, uint32_t, sd_clock_hfclk_request(void)); + +/**@brief Releases the high frequency crystal oscillator. + * + * Will stop the high frequency crystal oscillator, this happens immediately. + * + * @see sd_clock_hfclk_is_running + * @see sd_clock_hfclk_request + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_CLOCK_HFCLK_RELEASE, uint32_t, sd_clock_hfclk_release(void)); + +/**@brief Checks if the high frequency crystal oscillator is running. + * + * @see sd_clock_hfclk_request + * @see sd_clock_hfclk_release + * + * @param[out] p_is_running 1 if the external crystal oscillator is running, 0 if not. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_CLOCK_HFCLK_IS_RUNNING, uint32_t, sd_clock_hfclk_is_running(uint32_t * p_is_running)); + +/**@brief Waits for an application event. + * + * 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). @sa CMSIS_SCB + * + * @note If an application interrupt has happened since the last time sd_app_evt_wait was + * called this function will return immediately and not go to sleep. This is to avoid race + * conditions that can occur when a flag is updated in the interrupt handler and processed + * in the main loop. + * + * @post An application interrupt has happened or a interrupt pending flag is set. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_APP_EVT_WAIT, uint32_t, sd_app_evt_wait(void)); + +/**@brief Get PPI channel enable register contents. + * + * @param[out] p_channel_enable The contents of the PPI CHEN register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_CHANNEL_ENABLE_GET, uint32_t, sd_ppi_channel_enable_get(uint32_t * p_channel_enable)); + +/**@brief Set PPI channel enable register. + * + * @param[in] channel_enable_set_msk Mask containing the bits to set in the PPI CHEN register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_CHANNEL_ENABLE_SET, uint32_t, sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk)); + +/**@brief Clear PPI channel enable register. + * + * @param[in] channel_enable_clr_msk Mask containing the bits to clear in the PPI CHEN register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_CHANNEL_ENABLE_CLR, uint32_t, sd_ppi_channel_enable_clr(uint32_t channel_enable_clr_msk)); + +/**@brief Assign endpoints to a PPI channel. + * + * @param[in] channel_num Number of the PPI channel to assign. + * @param[in] evt_endpoint Event endpoint of the PPI channel. + * @param[in] task_endpoint Task endpoint of the PPI channel. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_CHANNEL The channel number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_CHANNEL_ASSIGN, uint32_t, sd_ppi_channel_assign(uint8_t channel_num, const volatile void * evt_endpoint, const volatile void * task_endpoint)); + +/**@brief Task to enable a channel group. + * + * @param[in] group_num Number of the channel group. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_GROUP_TASK_ENABLE, uint32_t, sd_ppi_group_task_enable(uint8_t group_num)); + +/**@brief Task to disable a channel group. + * + * @param[in] group_num Number of the PPI group. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_GROUP_TASK_DISABLE, uint32_t, sd_ppi_group_task_disable(uint8_t group_num)); + +/**@brief Assign PPI channels to a channel group. + * + * @param[in] group_num Number of the channel group. + * @param[in] channel_msk Mask of the channels to assign to the group. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_GROUP_ASSIGN, uint32_t, sd_ppi_group_assign(uint8_t group_num, uint32_t channel_msk)); + +/**@brief Gets the PPI channels of a channel group. + * + * @param[in] group_num Number of the channel group. + * @param[out] p_channel_msk Mask of the channels assigned to the group. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_GROUP_GET, uint32_t, sd_ppi_group_get(uint8_t group_num, uint32_t * p_channel_msk)); + +/**@brief Configures the Radio Notification signal. + * + * @note + * - The notification signal latency depends on the interrupt priority settings of SWI used + * for notification signal. + * - To ensure that the radio notification signal behaves in a consistent way, always + * configure radio notifications when there is no protocol stack or other SoftDevice + * activity in progress. It is recommended that the radio notification signal is + * configured directly after the SoftDevice has been enabled. + * - In the period between the ACTIVE signal and the start of the Radio Event, the SoftDevice + * will interrupt the application to do Radio Event preparation. + * - Using the Radio Notification feature may limit the bandwidth, as the SoftDevice may have + * to shorten the connection events to have time for the Radio Notification signals. + * + * @param[in] type Type of notification signal, see @ref NRF_RADIO_NOTIFICATION_TYPES. + * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE shall be used to turn off radio + * notification. Using @ref NRF_RADIO_NOTIFICATION_DISTANCE_NONE is + * recommended (but not required) to be used with + * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE. + * + * @param[in] distance Distance between the notification signal and start of radio activity, see @ref NRF_RADIO_NOTIFICATION_DISTANCES. + * This parameter is ignored when @ref NRF_RADIO_NOTIFICATION_TYPE_NONE or + * @ref NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE is used. + * + * @retval ::NRF_ERROR_INVALID_PARAM The group number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_RADIO_NOTIFICATION_CFG_SET, uint32_t, sd_radio_notification_cfg_set(uint8_t type, uint8_t distance)); + +/**@brief Encrypts a block according to the specified parameters. + * + * 128-bit AES encryption. + * + * @note: + * - The application may set the SEVONPEND bit in the SCR to 1 to make the SoftDevice sleep while + * the ECB is running. The SEVONPEND bit should only be cleared (set to 0) from application + * main or low interrupt level. + * + * @param[in, out] p_ecb_data Pointer to the ECB parameters' struct (two input + * parameters and one output parameter). + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_ECB_BLOCK_ENCRYPT, uint32_t, sd_ecb_block_encrypt(nrf_ecb_hal_data_t * p_ecb_data)); + +/**@brief Encrypts multiple data blocks provided as an array of data block structures. + * + * @details: Performs 128-bit AES encryption on multiple data blocks + * + * @note: + * - The application may set the SEVONPEND bit in the SCR to 1 to make the SoftDevice sleep while + * the ECB is running. The SEVONPEND bit should only be cleared (set to 0) from application + * main or low interrupt level. + * + * @param[in] block_count Count of blocks in the p_data_blocks array. + * @param[in,out] p_data_blocks Pointer to the first entry in a contiguous array of + * @ref nrf_ecb_hal_data_block_t structures. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_ECB_BLOCKS_ENCRYPT, uint32_t, sd_ecb_blocks_encrypt(uint8_t block_count, nrf_ecb_hal_data_block_t * p_data_blocks)); + +/**@brief Gets any pending events generated by the SoC API. + * + * The application should keep calling this function to get events, until ::NRF_ERROR_NOT_FOUND is returned. + * + * @param[out] p_evt_id Set to one of the values in @ref NRF_SOC_EVTS, if any events are pending. + * + * @retval ::NRF_SUCCESS An event was pending. The event id is written in the p_evt_id parameter. + * @retval ::NRF_ERROR_NOT_FOUND No pending events. + */ +SVCALL(SD_EVT_GET, uint32_t, sd_evt_get(uint32_t * p_evt_id)); + +/**@brief Get the temperature measured on the chip + * + * This function will block until the temperature measurement is done. + * It takes around 50us from call to return. + * + * @param[out] p_temp Result of temperature measurement. Die temperature in 0.25 degrees celsius. + * + * @retval ::NRF_SUCCESS A temperature measurement was done, and the temperature was written to temp + */ +SVCALL(SD_TEMP_GET, uint32_t, sd_temp_get(int32_t * p_temp)); + +/**@brief Flash Write +* +* Commands to write a buffer to flash +* +* If the SoftDevice is enabled: +* This call initiates the flash access command, and its completion will be communicated to the +* application with exactly one of the following events: +* - @ref NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed. +* - @ref NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started. +* +* If the SoftDevice is not enabled no event will be generated, and this call will return @ref NRF_SUCCESS when the + * write has been completed +* +* @note +* - This call takes control over the radio and the CPU during flash erase and write to make sure that +* they will not interfere with the flash access. This means that all interrupts will be blocked +* for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual +* and the command parameters). +* +* +* @param[in] p_dst Pointer to start of flash location to be written. +* @param[in] p_src Pointer to buffer with data to be written. +* @param[in] size Number of 32-bit words to write. Maximum size is 256 32-bit words for nRF51 and 1024 for nRF52. +* +* @retval ::NRF_ERROR_INVALID_ADDR Tried to write to a non existing flash address, or p_dst or p_src was unaligned. +* @retval ::NRF_ERROR_BUSY The previous command has not yet completed. +* @retval ::NRF_ERROR_INVALID_LENGTH Size was 0, or higher than the maximum allowed size. +* @retval ::NRF_ERROR_FORBIDDEN Tried to write to or read from protected location. +* @retval ::NRF_SUCCESS The command was accepted. +*/ +SVCALL(SD_FLASH_WRITE, uint32_t, sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size)); + + +/**@brief Flash Erase page +* +* Commands to erase a flash page +* If the SoftDevice is enabled: +* This call initiates the flash access command, and its completion will be communicated to the +* application with exactly one of the following events: +* - @ref NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed. +* - @ref NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started. +* +* If the SoftDevice is not enabled no event will be generated, and this call will return @ref NRF_SUCCESS when the +* erase has been completed +* +* @note +* - This call takes control over the radio and the CPU during flash erase and write to make sure that +* they will not interfere with the flash access. This means that all interrupts will be blocked +* for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual +* and the command parameters). +* +* +* @param[in] page_number Pagenumber of the page to erase +* @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error. +* @retval ::NRF_ERROR_INVALID_ADDR Tried to erase to a non existing flash page. +* @retval ::NRF_ERROR_BUSY The previous command has not yet completed. +* @retval ::NRF_ERROR_FORBIDDEN Tried to erase a protected page. +* @retval ::NRF_SUCCESS The command was accepted. +*/ +SVCALL(SD_FLASH_PAGE_ERASE, uint32_t, sd_flash_page_erase(uint32_t page_number)); + + +/**@brief Flash Protection set + * + * Commands to set the flash protection configuration registers. + On nRF51 this sets the PROTENSETx registers of the MPU peripheral. + On nRF52 this sets the CONFIGx registers of the BPROT peripheral. + * + * @note To read the values read them directly. They are only write-protected. + * + * @param[in] block_cfg0 Value to be written to the configuration register. + * @param[in] block_cfg1 Value to be written to the configuration register. + * @param[in] block_cfg2 Value to be written to the configuration register (ignored on nRF51). + * @param[in] block_cfg3 Value to be written to the configuration register (ignored on nRF51). + * + * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice. + * @retval ::NRF_SUCCESS Values successfully written to configuration registers. + */ +SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t block_cfg0, uint32_t block_cfg1, uint32_t block_cfg2, uint32_t block_cfg3)); + +/**@brief Opens a session for radio timeslot requests. + * + * @note Only one session can be open at a time. + * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START) will be called when the radio timeslot + * starts. From this point the NRF_RADIO and NRF_TIMER0 peripherals can be freely accessed + * by the application. + * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0) is called whenever the NRF_TIMER0 + * interrupt occurs. + * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO) is called whenever the NRF_RADIO + * interrupt occurs. + * @note p_radio_signal_callback() will be called at ARM interrupt priority level 0. This + * implies that none of the sd_* API calls can be used from p_radio_signal_callback(). + * + * @param[in] p_radio_signal_callback The signal callback. + * + * @retval ::NRF_ERROR_INVALID_ADDR p_radio_signal_callback is an invalid function pointer. + * @retval ::NRF_ERROR_BUSY If session cannot be opened. + * @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error. + * @retval ::NRF_SUCCESS Otherwise. + */ + SVCALL(SD_RADIO_SESSION_OPEN, uint32_t, sd_radio_session_open(nrf_radio_signal_callback_t p_radio_signal_callback)); + +/**@brief Closes a session for radio timeslot requests. + * + * @note Any current radio timeslot will be finished before the session is closed. + * @note If a radio timeslot is scheduled when the session is closed, it will be canceled. + * @note The application cannot consider the session closed until the @ref NRF_EVT_RADIO_SESSION_CLOSED + * event is received. + * + * @retval ::NRF_ERROR_FORBIDDEN If session not opened. + * @retval ::NRF_ERROR_BUSY If session is currently being closed. + * @retval ::NRF_SUCCESS Otherwise. + */ + SVCALL(SD_RADIO_SESSION_CLOSE, uint32_t, sd_radio_session_close(void)); + +/**@brief Requests a radio timeslot. + * + * @note The request type is determined by p_request->request_type, and can be one of @ref NRF_RADIO_REQ_TYPE_EARLIEST + * and @ref NRF_RADIO_REQ_TYPE_NORMAL. The first request in a session must always be of type @ref NRF_RADIO_REQ_TYPE_EARLIEST. + * @note For a normal request (@ref NRF_RADIO_REQ_TYPE_NORMAL), the start time of a radio timeslot is specified by + * p_request->distance_us and is given relative to the start of the previous timeslot. + * @note A too small p_request->distance_us will lead to a @ref NRF_EVT_RADIO_BLOCKED event. + * @note Timeslots scheduled too close will lead to a @ref NRF_EVT_RADIO_BLOCKED event. + * @note See the SoftDevice Specification for more on radio timeslot scheduling, distances and lengths. + * @note If an opportunity for the first radio timeslot is not found before 100ms after the call to this + * function, it is not scheduled, and instead a @ref NRF_EVT_RADIO_BLOCKED event is sent. + * The application may then try to schedule the first radio timeslot again. + * @note Successful requests will result in nrf_radio_signal_callback_t(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START). + * Unsuccessful requests will result in a @ref NRF_EVT_RADIO_BLOCKED event, see @ref NRF_SOC_EVTS. + * @note The jitter in the start time of the radio timeslots is +/- @ref NRF_RADIO_START_JITTER_US us. + * @note The nrf_radio_signal_callback_t(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START) call has a latency relative to the + * specified radio timeslot start, but this does not affect the actual start time of the timeslot. + * @note NRF_TIMER0 is reset at the start of the radio timeslot, and is clocked at 1MHz from the high frequency + * (16 MHz) clock source. If p_request->hfclk_force_xtal is true, the high frequency clock is + * guaranteed to be clocked from the external crystal. + * @note The SoftDevice will neither access the NRF_RADIO peripheral nor the NRF_TIMER0 peripheral + * during the radio timeslot. + * + * @param[in] p_request Pointer to the request parameters. + * + * @retval ::NRF_ERROR_FORBIDDEN If session not opened or the session is not IDLE. + * @retval ::NRF_ERROR_INVALID_ADDR If the p_request pointer is invalid. + * @retval ::NRF_ERROR_INVALID_PARAM If the parameters of p_request are not valid. + * @retval ::NRF_SUCCESS Otherwise. + */ + SVCALL(SD_RADIO_REQUEST, uint32_t, sd_radio_request(nrf_radio_request_t * p_request )); + +/**@} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_SOC_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_svc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_svc.h new file mode 100644 index 0000000000..aa91e5d35e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_svc.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_SVC__ +#define NRF_SVC__ + +#include "stdint.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SVCALL_AS_NORMAL_FUNCTION +#define SVCALL(number, return_type, signature) return_type signature +#else + +#ifndef SVCALL +#if defined (__CC_ARM) +#define SVCALL(number, return_type, signature) return_type __svc(number) signature +#elif defined (__GNUC__) +#ifdef __cplusplus +#define GCC_CAST_CPP (uint16_t) +#else +#define GCC_CAST_CPP +#endif +#define SVCALL(number, return_type, signature) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + __attribute__((naked)) \ + __attribute__((unused)) \ + static return_type signature \ + { \ + __asm( \ + "svc %0\n" \ + "bx r14" : : "I" (GCC_CAST_CPP number) : "r0" \ + ); \ + } \ + _Pragma("GCC diagnostic pop") + +#elif defined (__ICCARM__) +#define PRAGMA(x) _Pragma(#x) +#define SVCALL(number, return_type, signature) \ +PRAGMA(swi_number = (number)) \ + __swi return_type signature; +#else +#define SVCALL(number, return_type, signature) return_type signature +#endif +#endif // SVCALL + +#endif // SVCALL_AS_NORMAL_FUNCTION + +#ifdef __cplusplus +} +#endif +#endif // NRF_SVC__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex new file mode 100644 index 0000000000..a61b7c914c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex @@ -0,0 +1,6918 @@ +:020000040000FA +:1000000000040020E508000079050000C508000094 +:10001000830500008D05000097050000000000002A +:1000200000000000000000000000000009090000BE +:10003000A105000000000000AB050000B5050000B0 +:10004000BF050000C9050000D3050000DD05000064 +:10005000E7050000F1050000FB05000005060000B3 +:100060000F06000019060000230600002D06000000 +:1000700037060000410600004B0600005506000050 +:100080005F06000069060000730600007D060000A0 +:1000900087060000910600009B060000A5060000F0 +:1000A000AF060000B9060000C3060000CD06000040 +:1000B000D7060000E1060000EB060000F506000090 +:1000C000FF06000009070000130700001D070000DD +:1000D00027070000310700003B070000450700002C +:1000E0004F07000059070000630700006D0700007C +:1000F00077070000810700008B07000095070000CC +:100100009F0700001FB500F003F88DE80F001FBD2A +:1001100000F0DEBB1FB56FF00100009040100390AF +:10012000029001904FF010208069000B420900F00E +:100130001F045DF822300120A04083434DF8223097 +:10014000684600F044F91FBDF0B54FF6FF734FF459 +:10015000B4751A466E1E11E0A94201D3344600E080 +:100160000C46091B30F8027B641E3B441A44F9D14B +:100170009CB204EB134394B204EB12420029EBD17E +:1001800098B200EB134002EB124140EA0140F0BD8F +:10019000DD4992B00446D1E90001CDE91001FF220A +:1001A0004021684600F03AFB94E80F008DE80F000C +:1001B000684610A902E004C841F8042D8842FAD12B +:1001C00010216846FFF7C0FF1090AA208DF8440068 +:1001D000FFF7A0FF00F0F2F84FF01024A069102202 +:1001E0006946803000F001F9A069082210A900F0EA +:1001F000FCF800F0D7F84FF080510A6949690068AF +:100200004A43824201D8102070470020704710B541 +:10021000D0E900214FF0805002EB8103026944696C +:100220006243934209D84FF01022536903EB8103D4 +:100230000169406941438B4201D9092010BD5069D1 +:10024000401C01D0002010BD0F2010BD70B501680A +:100250000446AE4D4FF01020062951D2DFE801F0E0 +:10026000320318283B1DD4E90265646829463046EC +:1002700000F0CDF82A462146304600F0B6F8AA0034 +:100280002146304600F09EFA002800D0032070BDC1 +:1002900000F050FB4FF4805007E0201DFFF7ABFF4C +:1002A0000028F4D100F046FB60682860002070BD93 +:1002B000241D94E80700920000F084FA0028F6D08C +:1002C0000E2070BD8069401C12D0201DFFF79FFFDB +:1002D0000028F6D109E08069401C09D0201DFFF7F5 +:1002E0008AFF0028EDD1606820B12046FFF750FF5B +:1002F000042070BDFFF70EFF00F060F800F052F828 +:10030000072070BD10B50C46182802D001200860E7 +:1003100010BD2068FFF79AFF206010BD4FF0102439 +:10032000A069401C05D0A569A66980353079AA2846 +:1003300008D06069401C2DD060690068401C29D03D +:1003400060692CE010212846FFF7FEFE31688142EB +:100350001CD1A16901F18002C03105E030B108CAA9 +:1003600051F8040D984201D1012000E000208A429A +:10037000F4D158B1286810B1042803D0FEE728460C +:1003800000F057F861496868086008E000F016F866 +:1003900000F008F84FF480500168491C01D000F0CB +:1003A000A3FAFEE7BFF34F8F59480168594A01F499 +:1003B000E06111430160BFF34F8FFEE74FF0102063 +:1003C0008169491C02D0806900F0ADB87047524A7B +:1003D00001681160121D416811604F4A8168103236 +:1003E0001160111DC068086070472DE9F041174683 +:1003F0000D460646002406E03046296800F0A6F8BF +:10040000641C2D1D361DBC42F6D3BDE8F08170B5CD +:100410000C4605464FF4806608E0284600F083F855 +:10042000B44205D3A4F5806405F58055002CF4D1C1 +:1004300070BD4168044609B1012500E000254FF078 +:1004400010267069A268920000F0BCF9C8B120467D +:1004500000F01AF89DB17669A56864684FF4002031 +:1004600084420AD2854208D229463046FFF7CFFFA0 +:100470002A4621463046FFF7B8FFFFF79FFFFFF7F8 +:1004800091FFFFF747FEF8E72DE9FF414FF01024F9 +:10049000616980680D0B01EB800000F6FF70010BB5 +:1004A00000200090019002900246039068460123CC +:1004B0000BE0560902F01F0C50F8267003FA0CFCF2 +:1004C00047EA0C0740F82670521CAA42F1D30AE012 +:1004D0004A0901F01F0650F8225003FA06F6354388 +:1004E00040F82250491C8029F2D3A169090B4A091E +:1004F00001F01F0150F822408B409C4340F82240FD +:10050000FFF765FFBDE8FF815809000000000020EB +:100510000CED00E00400FA050006004014480168F4 +:100520000029FCD07047134A0221116010490B6862 +:10053000002BFCD00F4B1B1D186008680028FCD056 +:100540000020106008680028FCD07047094B10B5E7 +:1005500001221A60064A1468002CFCD00160106861 +:100560000028FCD00020186010680028FCD010BDC6 +:1005700000E4014004E5014008208F49096809585A +:10058000084710208C4909680958084714208A49EF +:100590000968095808471820874909680958084711 +:1005A0003020854909680958084738208249096878 +:1005B000095808473C2080490968095808474020E5 +:1005C0007D4909680958084744207B49096809584A +:1005D0000847482078490968095808474C20764957 +:1005E000096809580847502073490968095808479D +:1005F0005420714909680958084758206E4909680C +:10060000095808475C206C49096809580847602068 +:100610006949096809580847642067490968095801 +:100620000847682064490968095808476C206249EE +:1006300009680958084770205F4909680958084740 +:1006400074205D4909680958084778205A490968A3 +:10065000095808477C2058490968095808478020EC +:1006600055490968095808478420534909680958B9 +:100670000847882050490968095808478C204E4986 +:1006800009680958084790204B49096809580847E4 +:10069000942049490968095808479820464909683B +:1006A000095808479C204449096809580847A02070 +:1006B0004149096809580847A4203F490968095871 +:1006C0000847A8203C49096809580847AC203A491E +:1006D000096809580847B020374909680958084788 +:1006E000B4203549096809580847B82032490968D3 +:1006F00009580847BC203049096809580847C020F4 +:100700002D49096809580847C4202B490968095828 +:100710000847C8202849096809580847CC202649B5 +:10072000096809580847D02023490968095808472B +:10073000D4202149096809580847D8201E4909686A +:1007400009580847DC201C49096809580847E02077 +:100750001949096809580847E420174909680958E0 +:100760000847E8201449096809580847EC2012494D +:10077000096809580847F0200F49096809580847CF +:10078000F4200D49096809580847F8200A49096802 +:1007900009580847FC2008490968095808475FF4C8 +:1007A0008070054909680958084700000348044952 +:1007B000024A034B70470000000000206809000057 +:1007C0006809000040EA010310B59B070FD1042A15 +:1007D0000DD310C808C9121F9C42F8D020BA19BA0C +:1007E000884201D9012010BD4FF0FF3010BD1AB171 +:1007F000D30703D0521C07E0002010BD10F8013BC6 +:1008000011F8014B1B1B07D110F8013B11F8014BEC +:100810001B1B01D1921EF1D1184610BD02F0FF033F +:1008200043EA032242EA024200F005B870477047EB +:1008300070474FF000020429C0F0128010F0030C42 +:1008400000F01B80CCF1040CBCF1020F18BF00F8C3 +:10085000012BA8BF20F8022BA1EB0C0100F00DB872 +:100860005FEAC17C24BF00F8012B00F8012B48BFD0 +:1008700000F8012B70474FF0000200B51346944674 +:100880009646203922BFA0E80C50A0E80C50B1F1E8 +:100890002001BFF4F7AF090728BFA0E80C5048BFFC +:1008A0000CC05DF804EB890028BF40F8042B08BF9A +:1008B000704748BF20F8022B11F0804F18BF00F896 +:1008C000012B7047014B1B68DB68184700000020B4 +:1008D00009480A497047FFF7FBFFFFF713FC00BD0B +:1008E00020BFFDE7064B1847064A1060016881F3F8 +:1008F0000888406800470000680900006809000097 +:100900001D030000000000201EF0040F0CBFEFF3D9 +:100910000881EFF30981886902380078182803D12B +:1009200000E00000074A1047074A12682C3212689C +:100930001047000000B5054B1B68054A9B589847B7 +:1009400000BD000005030000000000205409000065 +:1009500004000000001000000000000000FFFFFF86 +:040960000090D00330 +:10100000881100207DB0010079960000CDAF01006D +:1010100079960000799600007996000000000000A3 +:10102000000000000000000000000000D9B0010036 +:101030007996000000000000799600007996000083 +:1010400041B1010047B10100799600007996000096 +:101050007996000079960000799600007996000054 +:101060004DB10100799600007996000053B101005E +:101070007996000059B101005FB1010065B101002E +:101080007996000079960000799600007996000024 +:101090007996000079960000799600007996000014 +:1010A0006BB1010071B101007996000079960000E2 +:1010B00079960000799600007996000079960000F4 +:1010C00077B10100799600007996000079960000CA +:1010D00079960000799600007996000079960000D4 +:1010E00079960000799600007996000079960000C4 +:1010F00079960000799600007996000079960000B4 +:10110000799600007996000000F002F819F093FF3C +:101110000AA090E8000C82448344AAF10107DA4552 +:1011200001D119F088FFAFF2090EBAE80F0013F0F1 +:10113000010F18BFFB1A43F00103184734A5010043 +:1011400054A501000A4410F8014B14F00F0508BF24 +:1011500010F8015B240908BF10F8014B6D1E05D083 +:1011600010F8013B6D1E01F8013BF9D1641E03D05C +:10117000641E01F8015BFBD19142E4D3704700008B +:101180000023002400250026103A28BF78C1FBD890 +:10119000520728BF30C148BF0B6070471FB500F031 +:1011A0003DF88DE80F001FBD1EF0040F0CBFEFF3DC +:1011B0000880EFF30980014A10470000CB9400003B +:1011C0008269034981614FF00100104470470000BB +:1011D000D511000001B41EB400B510F085F901B4BA +:1011E0000198864601BC01B01EBD0000F0B4404627 +:1011F000494652465B460FB402A0013001B506488D +:10120000004700BF01BC86460FBC80468946924617 +:101210009B46F0BC704700000911000019F008BFA0 +:1012200070B51C4C054608202070A01C00F065F825 +:101230005920A08029462046BDE8704006F067BBD3 +:1012400010B506F06FFB13490020891E087010BD11 +:1012500070B50C460F49891E097829B1A0F16001CB +:10126000532906D3012011E0602802D043F2010087 +:101270000CE020CC084E94E80E0006EB8000A0F5B0 +:101280008050241FD0F8806E2846B047206070BD83 +:10129000012070470A000020BCB1010010B50446CF +:1012A0000021012000F03FF80021182000F03BF859 +:1012B00000210B2000F037F80421192000F033F84A +:1012C00004210D2000F02FF804210E2000F02BF84F +:1012D00004210F2000F027F80421C84300F023F870 +:1012E0000721162000F01FF80721152000F01BF839 +:1012F0002046FFF795FF002010BD81210180704737 +:10130000FFF79EBF10487047104A10B514680F4B86 +:101310000F4A08331A60FFF79BFF0C48001D04605A +:1013200010BD704770474907090E002806DA00F023 +:101330000F0000F1E02080F8141D704700F1E0205C +:1013400080F800147047000003F9004310050240C4 +:101350000100000130B5FB4D044610280AD0112CC5 +:1013600006D02846122C817806D0132C08D0FFDF37 +:10137000AC7030BDFFDFFBE71129F9D0FFDFF7E7E5 +:101380001129F5D0FFDFF3E770B50EF03CF9044604 +:101390000FF072FE201AC4B206200CF0F9FA0546CE +:1013A00006200CF0FDFA2E1A07200CF0F1FA054683 +:1013B00007200CF0F5FAE349281A32188878122829 +:1013C0000DD000231A4413280BD0002002440878C3 +:1013D000022808D000201044201AC0B270BD01239A +:1013E000F0E70120F2E70120F5E7D64810B5C17813 +:1013F00094B0A9B15FF017018DF800104168CDF8E5 +:1014000002100089ADF8060009A968460AF0D1F873 +:101410000446112801D004B1FFDF14B0204610BDEE +:101420003221E9E702210CF008BB2DE9F04194B02C +:101430001D4690460E460746FFF7F4FF04000BD00A +:101440002078222804D3A07FC0F34010A84206D100 +:10145000082014B0BDE8F08143F20200F9E737201C +:101460008DF80000ADF802703DB101208DF8040048 +:101470008DF805608DF8068002E000208DF80400EC +:1014800009A968460AF095F8A07F65F34510A07792 +:101490000020DEE730B50446A1F120000D460A2801 +:1014A0004AD2DFE800F005070C1C2328353A3F44F8 +:1014B000FFDF42E0207820283FD1FFDF3DE0A14858 +:1014C0000178032939D08078132836D02078242851 +:1014D00033D0252831D023282FD0FFDF2DE02078EE +:1014E00022282AD0232828D8FFDF26E020782228A7 +:1014F00023D0FFDF21E0207822281ED024281CD012 +:1015000026281AD0272818D0292816D0FFDF14E063 +:101510002078252811D0FFDF0FE0207825280CD077 +:10152000FFDF0AE02078252807D0FFDF05E02078DC +:10153000282802D0FFDF00E0FFDF257030BD30B586 +:101540000B8840F67B444FF6FF72022801D093428D +:1015500004D09D1FA54224D2022802D04D88954276 +:1015600003D04D88AD1FA5421BD24C88A34218D88A +:101570008B88B3F5FA7F14D2022802D0C888904233 +:1015800005D0C88840F677450A38A84209D2C888ED +:10159000904208D0944206D05B1C6343B3EB800FAB +:1015A00001DB072030BD002030BD70B5044610F0CF +:1015B00003FA60BB207930B1082802D8217B0829C2 +:1015C00005D9072070BD217B0029FAD0F6E718B1B4 +:1015D000206810F0F1F9D0B9207B18B1A06810F0A4 +:1015E000EBF9A0B9002507E0206850F8250010F0BD +:1015F000E3F960B96D1CEDB22079A842F4D800255A +:1016000009E0A06850F8250010F0D6F908B11020C4 +:1016100070BD6D1CEDB2207BA842F2D8002070BDD9 +:1016200010B5028943F6FD73111F994212D2418908 +:1016300004290FD3B1F5804F0CD891420AD8017814 +:10164000890705D5406818B1FFF7AFFF002800D122 +:10165000002010BD072010BDF0B50024059D10B17D +:10166000A94203D851E009B90020F0BD0920F0BD1E +:10167000055D8DB107197E78112E3FD00FDC0A2E43 +:101680003CD2DFE806F03B1624242A2A2C2C3333E4 +:10169000025D72BB641CE4B28C42F9D3E4E71D2EF8 +:1016A0002CDAA6F11206042E28D2DFE806F027274E +:1016B0001018022DDAD1BD781D70072D01D26D07EB +:1016C00001D40A20F0BD157845F0010515E0EE4380 +:1016D000F60707E0012D07D010E00620F0BD2E0729 +:1016E000A6F18056002EF5D06046F0BD1578AE0705 +:1016F00001D50B20F0BD45F002051570055D641C99 +:101700002C44E4B28C4202D9B0E74FF4485C8C42DE +:10171000AED3A9E710B504784CB1012243F20223FD +:10172000012C07D0022C0FD0032C17D112E000227D +:101730000A7015E00A7082790324B4EB921F0DD170 +:101740000EE00000A80100200A708479B2EB941F1B +:1017500004D105E00A708279920901D0184610BDC3 +:1017600050F8012F41F8012F80888880002010BD9B +:1017700008B538B1FEA06B4600680090487903EBCD +:10178000901000781070086842F8010F88889080E7 +:1017900008BD30B50C46097895B0222902D2082040 +:1017A00015B030BD28218DF80010ADF80200132AC5 +:1017B00003D03B2A01D00720F2E78DF8042009A9C5 +:1017C000684609F0F6FE050003D121212046FFF707 +:1017D00061FE2846E4E700B595B023218DF800109E +:1017E000ADF802001088ADF804005088ADF806008E +:1017F000D088ADF80A009088ADF808000020ADF858 +:101800000C00ADF80E0009A9684609F0D2FE15B02B +:1018100000BD70B50E46050003D00021092010F070 +:1018200088F8D44C0120022EE0701CD0032E00D08A +:10183000FFDF0621201D0FF071FD607A20F0C0004F +:1018400084F80900FFF7D1FD608A00280AD0002D36 +:1018500008D083000122002109200FF0CDFF0928C4 +:1018600000D0FFDF70BD0321E01D0FF057FD607A4F +:1018700020F0C00040F040006072E01C02F03BFC31 +:10188000E0E72DE9FF410220BA4E8DF80400002761 +:10189000F08AADF80600B84655E001A80CF037F81C +:1018A000050006D0F08AB0B3A6F81680ADF8068021 +:1018B00047E0039C2078212843D0A07F01072BD547 +:1018C00004F123000090A28EBDF80800214604F127 +:1018D000360301F02BFD050003D011282AD0FFDFCD +:1018E00028E0A07F20F00800A077E07F810861F366 +:1018F0000000C10861F34100E07794F8210000F096 +:101900001F0084F820002078282824D1292120468F +:10191000FFF7C0FD1FE01CE0400712D5BDF808002E +:10192000214604F10E02FFF756FF050004D01128EE +:1019300000D0FFDF00250EE0A07F20F00400A0779C +:1019400009E07F1CFFB202200CF022F8401CB842D4 +:10195000A3D8052D07D0BDF80600F082052D04D0D0 +:10196000284604B076E5A6F816800020F9E72DE9B0 +:10197000F047040000D1FFDF20787E4E20F00F00FA +:10198000801C20F0F0007030207060680178091F22 +:1019900011290BD2DFE801F0F1090A4FF00A0CF02F +:1019A000F0360A0A0A0AF174F100FFDFBDE8F08799 +:1019B00087883846FFF736FD050000D1FFDF6078E5 +:1019C000212140F008006070307D40F00400307547 +:1019D0002846FFF75FFD384606F089FD384603F0DC +:1019E00021FC384604F03BFC394602200FF0A1FFF1 +:1019F000A87F20F01000A877FFF743FF0028D5D07C +:101A0000FFDFD3E785882846FFF70CFD00B9FFDF2D +:101A100060688078012800D0FFDF606881792846FF +:101A200006F0D8FE0028C1D0617841F0080161704D +:101A30006168C880BAE786883046FFF7F3FC050086 +:101A400000D1FFDF6078314640F0080060706068C8 +:101A5000C088288160680089688160684089A881A1 +:101A600002200FF066FF0020A875A87F00F0030099 +:101A700002289BD1FFF705FF002897D0FFDF95E7ED +:101A800080783C2803D0002502280AD000E00125F8 +:101A9000002720B13C2802D0022800D0FFDF17B178 +:101AA0007EE00127F5E7607840F008006070307D47 +:101AB00040F008003075EDBB606802218788384629 +:101AC0000BF0B2FF0546032138460BF0ADFF82460E +:101AD000052138460BF0A8FF8146042138460BF05B +:101AE000A3FF804605B9FFDFBAF1000F00D1FFDF89 +:101AF000B9F1000F00D1FFDFB8F1000F00D1FFDF17 +:101B000022212846FFF7C6FC60688079012837D07B +:101B10004FF00208A87F68F30100A8776068C08AC8 +:101B200028816068008B68816068408BA88160684C +:101B3000C07900E027E0E87560688168A961808964 +:101B4000A8836068807B6870606850F80F1FC5F8D4 +:101B500002108088E880A87F00F00301384606F074 +:101B6000B8FCB8F1010F0ED0B8F1020F18D005E0A3 +:101B70000302FF01A80100201FE023E0FFDF15E7BB +:101B80004FF00108C6E73078032800D0FFDF0021BE +:101B900008460FF0CEFEBDE8F047012000F087BFF9 +:101BA000B078132800D0FFDF002107200FF0C1FE1E +:101BB000BDE8F0471120FFF7CDBB2046BDE8F04758 +:101BC00001F08CBE607840F008006070EEE62DE910 +:101BD000F0470546007800270009DFF894A69146F3 +:101BE0000C463E46012871D0BC464FF6FF710228D4 +:101BF0006DD0072809D00A286AD0FFDFA9F8006055 +:101C00000CB1278066800020D0E6686804F10802E5 +:101C100003780D2B40D006DC042B7DD0072B44D05D +:101C20000A2B7AD106E0122B46D0132B51D0142B5D +:101C3000F7D1C0E011270926002C6FD0B0F804803E +:101C4000A4F804806868807920729AF814104046DD +:101C500021F004018AF8141004210BF000FF052183 +:101C600040460BF0FCFE002140460BF0F8FE01213F +:101C700040460BF0F4FE032140460BF0F0FE02213B +:101C800040460BF0ECFE062140460BF0E8FE072133 +:101C900040460BF0E4FEB1E701270926002CCCD02A +:101CA0008088A080686880790EE0122710268088DE +:101CB000214600F01EFFA1E71C270926002CBCD0FE +:101CC0004088A08068680079207297E78AE0B3E0D6 +:101CD00082E081783C2938D010272026002CACD017 +:101CE0008088A0806868C08A60836868C08A208312 +:101CF0006868008BA0836868408BE0836868417FD8 +:101D0000E07D61F30000E0756968497F490861F38F +:101D10004700E075696802E022E05CE08BE0C8798A +:101D20000831FFF725FD696804F10F0201F10F008A +:101D30008B7B01461846FFF71BFD6868807910B160 +:101D40000120A07507E00220FBE71B270926002CD5 +:101D500071D084F808C09AF8141021F008018CE0C2 +:101D60001D273026002C66D0A1806868411D0079AF +:101D7000FFF7FEFC686890F82B00E0736868C07895 +:101D80000428207C14D020F00100207469681F22F0 +:101D9000C97861F3420020746968C97A61F3C700A9 +:101DA0002074696804F111000C3119F043F825E73B +:101DB00040F00100E9E720271026E4B3A18068681D +:101DC00004F10902407A20726968CB1C88781946B0 +:101DD000FFF7CEFC12E74A4621462846BDE8F04709 +:101DE00001F001BF287E012803D0022813D0FFDFB5 +:101DF00004E71F271026F4B16888A080688B208133 +:101E0000A88B6081E88BA081288CE0819AF814105F +:101E100021F0200131E012271026688800F069FEC9 +:101E20004CB1687800F007000328C0D19AF814106C +:101E300021F0020121E027E0287E062822D2DFE8F7 +:101E400000F0040F0F030303C5E71B270926DCB1CD +:101E5000A18084F808C09AF8141021F001010CE068 +:101E60001B27092684B1A180287E012808D00320E1 +:101E700020729AF8141021F010018AF81410BDE6AF +:101E80000220F5E7FFDFB9E6A9F80060BBE610B570 +:101E9000F74894B08078132802D0082014B010BD01 +:101EA00022208DF8000009A9684609F082FB04464B +:101EB000002107200FF03DFD2046EFE700B5EC487C +:101EC00095B08078122801D00820A0E41E208DF85B +:101ED000000000208DF802008DF8030009A9684673 +:101EE00009F067FB0028F0D1002107200FF021FD49 +:101EF0001120FFF72FFA002089E400B5DC4895B0E7 +:101F00000078022803D0032801D008207FE41B209A +:101F10008DF8000000208DF8020009A9684609F03C +:101F200048FB0028F2D1002108460FF002FD0120F5 +:101F300000F0BDFD00206AE42DE9F0410027CC4C03 +:101F40000A287CD2DFE800F0057B1C7B7B7B7B448E +:101F50003B6AFFF7D2FF002831D105F01FFC0028B3 +:101F60002DD0017821F00F01891C21F0F0012031E2 +:101F70000170077605F0F0FB207D40F001001DE0C8 +:101F80008EB23046FFF74EFA050000D1FFDF287809 +:101F9000212814D005F002FC98B1017821F00F013E +:101FA000891C21F0F0011031017002210176468078 +:101FB000AF7505F0D1FB207D40F002002075BDE833 +:101FC000F08129463046BDE8F0411322FFF7E1BB1E +:101FD000A578122D03D0132D04D0FFDFEFE7FFF714 +:101FE0006DFF01E0FFF753FF0028E8D105F0D6FBB5 +:101FF0000028E4D0017821F00F01891C21F0F001C4 +:1020000020310170122D07D00221017605F0A4FBCA +:10201000207D40F01000D1E70121F6E7607A012130 +:10202000B1EB901F02D1022104E008E0800900D04A +:10203000FFDF0321BDE8F0410020FFF7EABBFFDF2F +:10204000BDE72DE9F04114460D00074600D1FFDF42 +:102050002878012803D0022821D0FFDFAFE73846D7 +:10206000FFF7E0F9060000D1FFDF0220B07520780D +:1020700020F00F00801C20F0F000103020706078FD +:1020800040F0080060702868A0616868E0612889F5 +:1020900020847748017D41F0200101758FE73846A3 +:1020A000FFF7C0F9060000D1FFDF69884FF6FF7027 +:1020B000814209D1AA88824206D131463846BDE81C +:1020C000F0411322FFF765BB814201D1A88898B186 +:1020D000207820F00F00801C20F0F00010302070DD +:1020E000607840F0080060702868A0616868E0616E +:1020F00028892084002006E0782300223946022027 +:102100000FF07AFB0120B07559E730B5054695B060 +:102110000C4608460FF050FC78BB00200121203D02 +:10212000062D5FD2DFE805F0032540444A57002121 +:1021300008200FF0D7FB10B1112015B030BD2420BE +:102140008DF80000D4F80200CDF80200A0798DF8D7 +:10215000060009A9684609F02CFA05002CD10823CD +:102160000022114618460FF047FB082824D0FFDF55 +:1021700022E060680FF062FC08B11020DDE73C202F +:102180008DF800002088ADF802006088ADF80400EA +:1021900009A9684609F00DFA05000DD1606858B12B +:1021A000BDF82810018007E0206801F0E2FF02E09E +:1021B000204600F0B1FC05462846BEE73D220BE074 +:1021C0008DF8021002E000BF8DF8020009A96846F0 +:1021D00009F0EFF9EFE734228DF800202278D207DA +:1021E000F2D0EDE70720A8E730B5054695B00C46DC +:1021F00008460FF005FC70BB203D052D35D2DFE809 +:1022000005F00323232523002088FFF70BF920B1D5 +:102210000078222804D208208FE743F202008CE7DE +:1022200025208DF800002088ADF8020009A9684635 +:1022300009F0BFF9002880D1DDF82A10C4F8021097 +:102240009DF82E10A17178E7062076E7206838B156 +:102250000FF0F4FB08B110206FE7206801F07DFF5C +:102260000348408AA080002067E7072065E7000058 +:10227000A8010020FE487047FD4810B518210A3813 +:1022800018F04FFE012000F012FC1120FFF762F859 +:10229000F74C00200A3C211D60744FF4617060828D +:1022A000E01C05F043FBD4F80300C4F80A00B4F8BE +:1022B0000700E081607A2074FFF797F800B1FFDF34 +:1022C00000F09CFCBDE8104001F0C2BA10B50C460D +:1022D0003E21204618F025FEA07F20F00300A077C5 +:1022E000202020700020A07584F8220010BD7047C7 +:1022F0002DE9FC4105460E4608460FF05DFB10B186 +:102300001020BDE8FC81DA4C0A3C15B1012D38D112 +:102310002CE0D4F803000090B4F80700ADF80400F6 +:102320008046677A8DF80670E11C3046FFF7F2F9B7 +:102330000028E6D1FFF759F830B10099C4F803102E +:10234000A4F807806772DCE7307808B1012808D16B +:10235000D4F80300C4F80A00B4F80700E081607AFA +:102360002074002109200FF0E4FA0FE0317841B128 +:10237000012906D0022906D0032904D043F2022005 +:10238000BFE70720BDE70120FFF743FA657400208F +:10239000B7E710B504460FF033FB08B1102010BDAD +:1023A000B34922460A39C878091DFFF7E1F9002030 +:1023B00010BD2DE9F0419AB0054600208DF85C0073 +:1023C0008DF858008DF828008DF860001E461446E0 +:1023D000884628460FF03BFB18B920460FF037FB24 +:1023E00010B110201AB0EAE555EA040018D01F27F2 +:1023F0000AAB17AA414628460097FFF72DF9002897 +:10240000F0D118AB16AA314620460097FFF724F901 +:102410000028E7D19DF85800C00703D00A20E1E763 +:102420000720DFE701AF7DB11A208DF804008DF899 +:10243000068042462946F81C18F0FCFC0BA901A8AE +:1024400009F0B7F80028CDD17CB120208DF8040028 +:102450008DF8066032462146F81C18F0EBFC0BA9FB +:1024600001A809F0A6F80028BCD181499DF82800F0 +:102470000A3948700020B5E770B506460A200C46B8 +:10248000087015461146204609F093F830B93821F6 +:1024900021702046294609F08CF820B1082801D186 +:1024A00043F2032070BD2A462146304600F05BFB14 +:1024B0000446082800D1FFDF204670BD2DE9F04119 +:1024C0006CA196B00446D1E90001CDE914010027C2 +:1024D00020460FF071FA30B92078012806D16068E3 +:1024E0000FF06AFA10B1102016B068E5604D0A3D91 +:1024F0002878012801D00820F6E707200BF050FAD1 +:1025000018B9207848B1012807D0FEF73DFF30B157 +:10251000287D10F00C0F09D103E01220E4E713200E +:10252000E2E7C10702D1A846800701D51120DBE709 +:10253000208A43F6E172A0F120019142217807D36D +:10254000012942D1002840D1618A00293DD10FE004 +:10255000022901D0032901D1A02836D3012907D0AF +:1025600098F80110C90703D0618A71B3B4292CD837 +:10257000217831B1012908D0022904D0032924D1BE +:1025800015E0002516E0022514E008B9608A60B164 +:1025900004256068007868B101280AD0022808D0B4 +:1025A000032806D043F202209EE70125F1E7032528 +:1025B00000E00127207A30B1012807D0022807D097 +:1025C00003286AD106E0002605E066E0012602E065 +:1025D000022600E003260DB1022D13D196B1E0686A +:1025E00018B1FEF7E2FF002886D198F801008007B5 +:1025F00002D043F2012077E7022D03D1022E4CD006 +:10260000032E4AD018208DF82C00208AADF82E0019 +:10261000208AADF830008DF8325098F80310002071 +:102620004FF0010811B1012968D102E08DF83300A3 +:1026300001E08DF833808DF834702178012925D0A0 +:10264000CDF83500ADF839008DF83C60207DC0F341 +:102650004002014662F35F01C0F3800041EA80005E +:1026600014A9085C8DF83B00B8B169460BA805E0D9 +:10267000B2010020070605040302010008F099FFDB +:10268000002891D15DB1022D09D011E0606850F8A9 +:10269000011FCDF835108088D4E7072024E73EB12C +:1026A000E06828B16A460BA9FFF7E6FE0028A2D130 +:1026B0001B208DF82C008DF82E8069460BA808F0A1 +:1026C00078FF002897D19DF801001B2816D1052D11 +:1026D00009D2DFE805F0030305050300032000E04D +:1026E000022000F0E4F9012D0AD0608A40B10022F6 +:1026F0008300114610460FF07FF808B10320F3E67F +:102700000020F1E62DE9FC4107460D460326084668 +:102710000FF09DF9002863D13846FEF783FE0400D0 +:1027200004D02078222804D20820EAE543F20200EF +:10273000E7E5A07F00F0030C2DB129466046FEF7C7 +:10274000FEFE0600F1D1F948BCF1010F05D0BCF145 +:10275000020F17D0FFDF3046D3E5A27D2946012ABC +:1027600002D0007D800701D51120CAE529B968464D +:1027700000F0FDFA0028D8D16946384605F0A7FFD9 +:102780000646E8E7A17D022914D1007D800611D418 +:1027900025B1A07F40070BD4002100E0012138467D +:1027A00005F0E0FF0600D6D1A075002DD3D002E0E1 +:1027B0001126D0E7A5B12A4621463846FFF70BF887 +:1027C00006461128C7D1A07F4107C4D4296844F820 +:1027D0000E1F6968616040F0040020740026BAE7AB +:1027E00010208EE570B50C460546FEF71BFE010075 +:1027F00005D022462846BDE87040FEF7CABF43F226 +:10280000020070BD00B595B031218DF800108DF833 +:10281000020009A9684608F0CCFE15B000BD0123EE +:10282000FEF703BE00231A461946FEF7FEBD70B53B +:1028300094B004460FF0C0F810B1102014B070BD71 +:102840002046FEF7EDFE0028F8D1B84DA8781128F3 +:1028500001D00820F2E7FEF797FD20B1287DC006E1 +:1028600003D51120EAE71320E8E71D208DF80000CA +:10287000207800F001008DF802002089ADF80400F6 +:102880006089ADF806002078C0F340008DF809009B +:10289000E8780025012618B1012804D00320CDE7EF +:1028A0008DF8085001E08DF8086009A9684608F025 +:1028B00080FE0028C2D12078800707D5606828B143 +:1028C00009AA6946FFF7D8FD0028B7D11E208DF868 +:1028D00000008DF802608DF8035009A9684608F0E1 +:1028E00068FE0028AAD1A08900F0F5F80400A5D15F +:1028F0001220FEF72FFD2046A0E7F0B595B0154653 +:102900000C4607460FF0A3F838B920460FF054F8EC +:1029100018B928460FF050F810B1102015B0F0BDCE +:10292000824E307D10F0180F01D1400701D51120E3 +:10293000F4E72046FEF774FE0028EFD12078C0F3BC +:102940004001394302D0800702D50FB10720E5E7E7 +:1029500029460220FEF7F3FD0028DFD1B0781128C8 +:1029600003D0122801D00820D8E706200BF018F871 +:1029700018B1B078122802D005E01220CEE7FFF798 +:102980009DFA0028CAD1FEF7FFFC022801D21320CD +:10299000C4E72078800707D5606828B109AA69468E +:1029A000FFF76AFD0028B9D121208DF800002089A9 +:1029B000ADF802006089ADF8040020784FF0010105 +:1029C000C0F340008DF80600207882074FF0000029 +:1029D00015D43A7842B1012A09D0022A07D0032A35 +:1029E00005D043F2022099E78DF8070001E08DF849 +:1029F000071057F8012F0292BA88ADF80C20F27830 +:102A00001AB1012A04D0032088E78DF80E0001E0F6 +:102A10008DF80E102988ADF810106988ADF81210E5 +:102A2000A988ADF81410E988ADF81800ADF81610B3 +:102A3000ADF81A0009A9684608F0BBFD002886D148 +:102A4000A08900F048F804008ED11320FEF782FC24 +:102A5000204663E730B5054695B00C4608460EF0B3 +:102A6000CFFF10B1102015B030BD2846FEF7DAFCBC +:102A700038B10178222902D3807F800604D408204F +:102A8000F1E743F20200EEE713208DF80000ADF805 +:102A9000025009A9684608F08CFD0028E3D19DF991 +:102AA0002A107F2901D02170DDE70520DBE730B552 +:102AB0001E4D040008D0012C04D0022C06D0032C9B +:102AC00004D0FFDF2C7030BDFFDFFBE72878012842 +:102AD000F8D0FFDFF6E710B548B1830000221146B9 +:102AE00007200EF089FE072801D0032010BD00202A +:102AF00010BD70B50C0006460DD0FEF793FC050026 +:102B000000D1FFDFA680288920812889608168891B +:102B1000A081A889E08170BD10B50446006840B16D +:102B20000EF095FF20B1102010BD0000A80100207C +:102B3000206801F005FBA0882F4C6082607C012892 +:102B40000FD1002109200EF0CDFE00B10120617AE5 +:102B50000122B2EB911F01D1022100E00321FEF717 +:102B600058FE0020E0E72DE9F047002592460C468C +:102B70000646A8464FF001090B2721E0306850F8BF +:102B80002500007820B1012805D00720BDE8F08796 +:102B900084F8028001E084F80290306850F8250043 +:102BA00050F8011FC4F803108088A4F807002770AC +:102BB0005146204608F0FDFC0028E7D16D1CEDB21F +:102BC0003079A842DAD8002539270FE0B068102202 +:102BD00050F82510A01C18F02DF9277051462046FA +:102BE00008F0E7FC0028D1D16D1CEDB2307BA84283 +:102BF000ECD80020CAE70000A8010020E848002126 +:102C00000160818070472DE9FF41804692B01C46EB +:102C10000E4618460EF0D0FE18B1102016B0BDE8D2 +:102C2000F08121460120FEF78AFC0028F6D101251B +:102C30008DF842504FF4C050ADF84000002210A96A +:102C4000284603F0AAFD0028E8D18DF842504FF441 +:102C50002850ADF8400000271C216846099718F05D +:102C600082F99DF82400ADF8346020F00F00401C7C +:102C700020F0F00010308DF824009DF82500ADF80C +:102C8000367020F0FF008DF825009DF8260007AA79 +:102C900020F00600801C40F001008DF826009DF811 +:102CA00000000BA940F002008DF800001F20ADF8D5 +:102CB000380009A80C9010A80B90CDF83C8068460D +:102CC00003F06EFB0028A9D1B54EBDF81C0007AA81 +:102CD00030808DF8425042F60120ADF840009DF85A +:102CE00026000BA920F00600801C20F001008DF8C2 +:102CF00026000220ADF83400ADF8380014A80F907B +:102D0000684603F04DFB002888D1BDF81C00708098 +:102D1000311D204600F0ECF880E73EB5044608205F +:102D2000ADF8000020460EF047FE08B110203EBD71 +:102D300021460120FEF703FC0028F8D12088ADF8D9 +:102D400004006088ADF80600A088ADF80800E088AF +:102D5000ADF80A00924801AB6A468088002103F072 +:102D600009FFBDF800100829E1D003203EBD1FB5C2 +:102D70000446002002900820ADF80800CDF80CD0E1 +:102D800020460EF019FE10B1102004B010BD84488A +:102D900002AA81884FF6FF7004F07BF80028F4D176 +:102DA000BDF80810082901D00320EEE7BDF8001097 +:102DB0002180BDF802106180BDF80410A180BDF82B +:102DC0000610E180E1E701B582B00220ADF8000015 +:102DD000734802AB6A464088002103F0CBFEBDF881 +:102DE0000010022900D003200EBD1CB50021009167 +:102DF0000221ADF8001001900EF002FE08B1102083 +:102E00001CBD67486A4641884FF6FF7004F041F8E0 +:102E1000BDF800100229F3D003201CBDFEB5074603 +:102E200014460E4608460EF0C7FD08B11020FEBD40 +:102E30001F2C01D90C20FEBD38460EF0BDFD584DAB +:102E400018BB288801A903F021F80028F3D13878AD +:102E50008DF80500288801A903F06DFE0028EAD14D +:102E600000909DF800009DF8051040F002008DF8DC +:102E70000000090703D040F008008DF80000288802 +:102E8000694603F0FBFD0028D5D1ADF8084028883D +:102E9000334602AA002103F06DFEBDF80810A142DE +:102EA000C9D00320FEBD7CB50546002000900190EE +:102EB0000888ADF800000C46284601950EF0BEFDCE +:102EC00018B920460EF09CFD08B110207CBD15B14C +:102ED000BDF8000050B132486A4601884FF6FF70D5 +:102EE00003F0D7FFBDF8001021807CBD0C207CBD15 +:102EF00030B593B0044600200D460090142101A87F +:102F000018F031F81C2108A818F02DF89DF80000E1 +:102F1000CDF808D020F00F00401C20F0F000103059 +:102F20008DF800009DF8010006AA20F0FF008DF842 +:102F300001009DF8200001A940F002008DF820005A +:102F400001208DF8460042F60420ADF8440011A897 +:102F500001902088ADF83C006088ADF83E00A08864 +:102F6000ADF84000E088ADF842009DF8020020F086 +:102F70000600801C20F001008DF802000820ADF84A +:102F80000C00ADF810000FA8059008A803F008FA8F +:102F9000002803D1BDF818002880002013B030BDF0 +:102FA00010000020094810B504680A490848086064 +:102FB0000DF08AFB0848046010BD08490020086035 +:102FC0004FF0E0210220C1F8800270471005024056 +:102FD000010000011805024014050240FC1F0040DA +:102FE00070B50C46054606F0BFFE21462846BDE8F2 +:102FF000704007F09CBE704770477047704770473D +:1030000010FFFFFFDBE5B15100C001008100FFFFB1 +:1030100010B504460EF0D0FC08B1102010BD207889 +:10302000C0F30210042807D86078072804D3A178D9 +:10303000102901D8814201D2072010BDE078410754 +:1030400006D421794A0703D4000701D4080701D523 +:10305000062010BD002010BD10B513785C08C37F9A +:1030600064F30003C3771478A40864F34103C377BF +:103070001078C309887863F34100887013781C09BD +:103080004B7864F347134B701378DB0863F300004D +:1030900088705078487110BD10B5C4780B7864F30F +:1030A00000030B70C478640864F341030B70C478A8 +:1030B000A40864F382030B70C478E40864F3C303C8 +:1030C0000B700379117863F30001117003795B08C9 +:1030D00063F34101117003799B0863F3820111705E +:1030E0000079C00860F3C301117010BD70B51446BB +:1030F0000D46064604F052FB80B10178142221F0FF +:103100000F01891C21F0F001A03100F8181B2146A5 +:1031100017F0D5FEBDE8704004F01EBB29463046CE +:10312000BDE870401322FEF734BB70B514460E465E +:10313000054604F033FB70B1017821F00F01891CC2 +:1031400021F0F00120310170458021688161BDE8E6 +:10315000704004F001BB31462846BDE870401322A0 +:10316000FEF717BB10B5FE4C94F8300000280CD1C8 +:1031700004F120014FF6FF72A1F110000CF0B9F834 +:1031800000B1FFDF012084F8300010BD2DE9F047C9 +:10319000064608A8894690E830041F469046142148 +:1031A000284617F0E0FE0021CAF80010B8F1000F21 +:1031B00003D0B9F1000F03D114E03878C00711D063 +:1031C00020680EF01DFCE8BBB8F1000F07D12068A5 +:1031D000123028602068143068602068A860216878 +:1031E000CAF800103878800727D560680EF026FCF2 +:1031F00040BBB9F1000F2CD0FFF73CF80168C6F8CE +:10320000B4118188A6F8B811807986F8BA01FFF761 +:10321000A9FFDFF84C8308F12008C5F80C8062682C +:103220005AB196F8B40106F2B5111032FEF7A0FAC1 +:1032300010224146606817F0FDFD3878400712D52E +:10324000A06800E002E00EF0DBFB50B11020BDE80A +:10325000F08760680028F9D0E8606068C6F8B001BF +:10326000EBE7A06828610020F1E730B50546087853 +:103270000C4620F00F00401C20F0F00110312170AE +:103280000020607095F8220030B104280FD0052886 +:1032900011D0062814D0FFDF20780121B1EB101FD8 +:1032A00004D295F8200000F01F00607030BD21F0BE +:1032B000F000203002E021F0F00030302070EBE729 +:1032C00021F0F0004030F9E710B510B190F8A940B6 +:1032D00044B1A34890F8354000205CB1086010600C +:1032E000186010BD00F1A8040C6000F1D001F830A6 +:1032F0001160F5E79A4C34340C60F0E700B58BB000 +:103300000823CDE902128DF8013001919449002380 +:1033100064310591099301468DF8103068460BF031 +:10332000C0FF002800D0FFDF0BB000BD30B595B066 +:103330000C462C2518998DF80050ADF80200B3B159 +:103340001868019058680290ADF80C2010220DF119 +:103350000E0017F06FFD09A9684608F02AF9002849 +:1033600003D1A17F41F01001A17715B030BD00203D +:103370000190E8E72DE9F0470646008A8AB080B25E +:103380000D468146FEF74EF80446754F3078283FCB +:10339000DFF8CC814FF0000A122873D2DFE800F08A +:1033A00072E9350936777E98A8F3E7E6E5E4DF5B56 +:1033B000DFDFA07F00F00300012806D0002148468F +:1033C0000AF03BFB050003D101E00121F7E7FFDF35 +:1033D00098F85C10090602D5D8F860000BE00321CC +:1033E00005F121000DF09AFFD5F821005D49B0FBF1 +:1033F000F1F201FB1200C5F8210070686866B06840 +:10340000A8662078252800D0FFDFECE0A07F00F040 +:103410000300012806D0002148460AF00EFB0600F2 +:1034200003D101E00121F7E7FFDF7078810702D5C2 +:103430002178252904D040F0010070700AB006E719 +:103440000220287096F82000287106F121003136FC +:10345000C5E90206F2E7A07F00F00300012806D0CC +:10346000002148460AF0E9FA040003D101E00121F5 +:10347000F7E7FFDF6078C10605D5142028704134D6 +:103480006C60DBE7E2E140F008006070D6E73448AA +:10349000082128380DF042FF032016E02A208DF87D +:1034A000000010220DF10200716817F0C3FC102219 +:1034B0000DF11200B16817F0BDFC294968462C399E +:1034C00008F077F800B1FFDF042028706F60B5E7DF +:1034D000E07FC00600D5FFDFB0680090B388062209 +:1034E0000321484605F063F80028A7D0FFDFA5E7D1 +:1034F00004B9FFDF716821B1102204F1230017F035 +:1035000099FC28212046FDF7C5FFA07F00F00300AD +:1035100002280ED104F12300002300901A46214610 +:103520004846FFF703FF112807D029212046FDF761 +:10353000B1FF307A84F8200080E7A07F000700D533 +:10354000FFDF14F81E0F40F008002070A4F816A04A +:10355000C4F818A0C4F81CA0617808460AE034E05A +:103560005C02002040420F006CE19AE090E062E0D3 +:1035700009E03FE061F38200410861F3C30060703D +:10358000307AE0705AE7A07F00F00300012806D0EF +:10359000002148460AF051FA040003D101E001215C +:1035A000F7E7FFDF022104F175000DF0B7FE1120EF +:1035B000287004F5DA706860B4F875002882FD4858 +:1035C0006C346C61C5E9028038E7A07F00F003002D +:1035D000012805D0002148460AF02FFA18B901E069 +:1035E0000121F8E7FFDF0AB0324621464846BDE830 +:1035F000F0477BE504B9FFDF207821289CD930799A +:10360000012802D002280AD103E0E07F40F0100038 +:10361000E07798F85C1041F0010188F85C103246C0 +:1036200021464846FFF762FD0AB02046BDE8F04754 +:103630002321FDF72FBF327901230321484604F0EF +:10364000B7FD98B1122005F8040B327925F8042B48 +:10365000281DA91E0095CDE901100023032148462D +:1036600004F023FE00288DD0FFDFE7E6A07F00F006 +:103670000300012806D0002148460AF0DEF90400C4 +:1036800003D101E00121F7E7FFDF30792070D5E6B3 +:103690000321484605F02DF9002895D11320287004 +:1036A000CCE6A07F00F00300012806D000214846A8 +:1036B0000AF0C3F9050003D101E00121F7E7FFDFBC +:1036C00095F8740000F00300012878D1A07F00F085 +:1036D0000307E07FC0F3400616B1012F04D02BE0B2 +:1036E00095F89000C0072AD0D5F8AC0118B395F82A +:1036F0007320017C62F387010174E27FD5F8AC018D +:1037000062F341010174D5F8AC0166F30001017464 +:10371000AEB1D5F8AC01102204F12301783517F0D1 +:1037200089FB287E40F001002876287820F00100EF +:1037300005F8780900E016B1022F04D02CE095F8C6 +:103740007800C00726D0D5F8A80118B395F87320E3 +:10375000017C62F387010174E27FD5F8A80162F36E +:1037600041010174D5F8A80166F3000101748EB11E +:10377000D5F8A801102204F12301783517F05AFB7F +:10378000287840F0010005F8180B287820F0010097 +:1037900005F89009022F51D05FF0000000EB4000C7 +:1037A00005EBC00090F87800800708D5D5F8B02167 +:1037B00095F86C0005F16D011032FDF7D9FF052079 +:1037C00060F3070815F8740F00F0030060F30F288A +:1037D000287960F31748287F60F31F687548AC3874 +:1037E000027822F00F02921C22F0F00220320270C6 +:1037F000427822F00702D21C4270A0F80290C0F872 +:10380000188004F033F92078252805D0212807D026 +:10381000FFDF2078222803D922212046FDF73AFE37 +:10382000A07F00F0030001280AD0002148460AF0DA +:1038300016F900283FF40EAEFFDFFFE50120ADE7EB +:103840000121F3E7716881F801A0F7E5FFDFF5E5F5 +:1038500070B5584C0025103C14F85C0F20F0800027 +:10386000207065600BF0E7FC5249A1F1100004F0F4 +:103870008FF804F82C5C072060724E487C30206181 +:103880005030A0611030E06170BD70B50D46FDF79D +:10389000C9FD040000D1FFDF4FF4DE71284617F0A8 +:1038A00062FB44485430686104F123002861A07F22 +:1038B00000F00300012809D05FF0020105F59070C7 +:1038C0000BF0BAFC002800D0FFDF70BD0121F5E746 +:1038D0000A46014602F590700BF0CCBC70B5054667 +:1038E00040689AB0017808290DD00B2903D00C2923 +:1038F00036D101218171686886883046FDF792FDD6 +:10390000040035D133E046883046FDF78BFD0400D6 +:1039100000D1FFDF2078212822D0282822D1686812 +:1039200002210C3001F09CF9E0B168680821001D0B +:1039300001F096F9B0B12D208DF80000ADF80260CD +:10394000102204F1230101A817F074FA09A96846AE +:1039500007F02FFE00B1FFDF29212046FDF79AFD79 +:103960001AB070BD687840F008006870F8E7FFDFB3 +:10397000A07F00F00301022902D120F01000A077FF +:10398000207821280AD06868817909B1807898B1B7 +:10399000A07F00F0030002285BD0FFDFA07F00F0D3 +:1039A00003000228DCD1FDF76CFF0028D8D0FFDF30 +:1039B000D6E700006C020020687840F008006870CC +:1039C000E07FC10720D0800701D5062000E0052058 +:1039D00084F822002078292818D02428DED1314606 +:1039E00006200DF0A6FF22212046FDF753FDA07F03 +:1039F00000F0030001282AD0002130460AF02FF8F9 +:103A00000028CBD0FFDFC9E70420E1E7A07F00F06A +:103A10000300012806D0002130460AF00EF8050008 +:103A200003D101E00121F7E7FFDF25212046FDF763 +:103A300031FD10208DF8500014A905F590700BF0A1 +:103A400010FC0228AAD00028A8D0FFDFA6E7012199 +:103A5000D3E7687840F0080068709FE72DE9F047E9 +:103A60008CB01D46904689460646DDF850A0FDF70D +:103A7000D9FC040052D0207822284FD323284DD0DF +:103A8000E07FC0064AD4A07F00F00300012806D0E2 +:103A90000021304609F0D1FF070002D00BE00121E0 +:103AA000F7E7A07F00F00300012804D10121304690 +:103AB00009F0BAFF074601AB02AA03A93846FFF78F +:103AC00003FC039800B9FFDF4FB1039807F5907727 +:103AD00087612078222806D0242804D007E00399A3 +:103AE0000020886103E025212046FDF7D3FC0398E0 +:103AF0000C2141704662A0F80480C0F80890A0F83C +:103B000006A0C560029901610199416104A90BF009 +:103B1000C8FB022802D0002800D0FFDF0CB0BDE8AF +:103B2000F08730B589B00546FDF77CFC0178222985 +:103B300033D9807F00F00300012806D000212846F9 +:103B400009F07BFF040003D101E00121F7E7FFDF6B +:103B5000227801230321284604F02AFB00281CD0E8 +:103B600012208DF80C00227806A8811F05ABCDE944 +:103B700000310290ADF8102000230321284604F004 +:103B800094FB00B1FFDF03A904F590700BF069FB13 +:103B9000022802D0002800D0FFDF09B030BD10B5E8 +:103BA00086B00446FDF73EFC0178222919D9807FB2 +:103BB00000F00300012806D00021204609F03DFF57 +:103BC000040003D101E00121F7E7FFDF13208DF8A6 +:103BD0000000694604F590700BF043FB002800D00C +:103BE000FFDF06B010BD2DE9F05F05460C4600274B +:103BF0000078904601093E46BB4604F1080A0229B6 +:103C00007ED0072902D00A2909D141E068680178ED +:103C1000082905D00B292BD00C2929D0FFDFC5E1BD +:103C200014271C26002C6CD04088A080FDF7FAFBDE +:103C30005FEA000900D1FFDF99F81700524609F149 +:103C40001801FDF795FD68688089208269684868D9 +:103C5000C4F812008868C4F81600A07E20F00600A0 +:103C600040F00100A07699F81E0040F040014DE0C0 +:103C70001A270A26002CD6D08088A080FDF7D2FB18 +:103C8000050000D1FFDF51462846FFF7EEFA8DE12F +:103C90000CB1288DA080287E0E287CD006DC01285F +:103CA0007AD0022808D0032804D135E0102874D037 +:103CB000112873D0FFDF79E11E270926002CB2D02E +:103CC000A088FDF7AFFB5FEA000900D1FFDF287F86 +:103CD00000F003000128207A1BD020F001002072A0 +:103CE000297F890861F341002072297FC90861F3A7 +:103CF00082002072297F090961F3C300207201E06C +:103D000049E116E199F81E0040F0800189F81E1083 +:103D10004CE140F00100E2E713270D26002CAAD069 +:103D2000A088FDF77FFB8146807F00F0030001281B +:103D300006D00021A08809F080FE050003D101E033 +:103D40000121F7E7FFDF99F81E0000F00302012AC6 +:103D500059D0A86E817801F003010129217A54D04D +:103D600021F00101217283789B0863F341012172E4 +:103D70008378DB0863F38201217283781B0963F384 +:103D8000C3012172037863F306112172437863F350 +:103D9000C711217203E060E0A6E08EE09EE084F8A7 +:103DA00009B0C178A172012A32D04279E17A62F376 +:103DB0000001E1724279520862F34101E1724279F5 +:103DC000920862F38201E1724279D20862F3C30180 +:103DD000E1720279217B62F30001217302795208BA +:103DE00062F3410121730279920862F38201217327 +:103DF0000079C00860F3C301217399F800002328FB +:103E00005AD9262168E0686EA4E741F00101A9E7CC +:103E10000279E17A62F30001E1720279520862F3F9 +:103E20004101E1720279920862F38201E172027942 +:103E3000D20862F3C301E1724279217B62F300018F +:103E400021734279520862F3410121734279920849 +:103E500062F3820121734079CBE718271026002CEA +:103E600067D0A088FDF7DEFA8246807F00F003006D +:103E7000012807D00021A08809F0DFFD5FEA0009D2 +:103E800003D101E00121F6E7FFDFE869A06099F8BE +:103E9000010040F0040189F8011099F80200800740 +:103EA00008D5012020739AF8000023287ED9272105 +:103EB000504663E084F80CB078E015270F26C4B3B1 +:103EC000A088FDF7AFFA814606225146E86907F05F +:103ED000D6FB0120A073AEE048464FE01627092626 +:103EE0003CB3287F207261E0287FFE4902280CD075 +:103EF00019270E26ECB101280DD003281AD004286A +:103F00001BD0052819D0FFDF23E01B270926BCB3EF +:103F10000120207205E001202072607A20F0030069 +:103F2000607211F85C0F4208520062F306000870DC +:103F30000FE02BE00220207207E0697F052801F0E6 +:103F40000F0141F0800121721BD0607A20F0030044 +:103F50006072A088FDF766FA05460078212825D012 +:103F6000232800D0FFDFA87F00F00300012810D035 +:103F70000021A08809F073FD22212846FDF78AFA66 +:103F800014E0607A20F00300401CE1E7A8F800602C +:103F900011E00121EDE70CB16888A080287E03289C +:103FA0002BD004280AD005284BD0FFDFA8F80060EA +:103FB0000CB1278066800020BDE8F09F15270F26F2 +:103FC000002CE3D0A088FDF72DFA807F00F00300DD +:103FD000012806D00021A08809F02FFD050003D19B +:103FE00001E00121F7E7FFDFD5F821000622514665 +:103FF00007F045FB84F80EB0D8E717270926002CF8 +:10400000C4D0A088FDF70EFA8146807F00F003003F +:10401000012806D00021A08809F00FFD050003D17A +:1040200001E00121F7E7FFDFA878800701D5022032 +:1040300000E00120207299F800002328B6D927213A +:104040004AE719270E26002CA0D0A088FDF7EAF930 +:104050005FEA000900D1FFDFC4F808B0A4F80CB093 +:1040600084F808B0A07A40F00300A07299F81F10FD +:1040700061F38200A07299F81F1001EA510161F307 +:10408000C300A072687E00F0030001288ED1607A20 +:1040900040F00400607299F81E0000F0030001284F +:1040A00014D0E97E607B61F300006073AA7E217BFF +:1040B00062F300012173EA7E520862F341006073EB +:1040C000A87E400860F3410121736FE7E87E217B01 +:1040D00060F300012173AA7E607B62F300006073CD +:1040E000EA7E520862F341012173A97E490861F317 +:1040F000410060735AE730B504468079012591B0DC +:10410000B5EB901F00D0FFDFFFF72CF84FF6FF70E4 +:10411000099074488DF8015020300190201D0290C4 +:10412000601C0B900AA968460BF0BBF800B1FFDFDA +:104130000B980188A4F801108078E07011B030BDB0 +:1041400010B5684C30B10146102204F1200016F081 +:1041500071FE012084F8300010BD10B50446FFF751 +:1041600001F8604920461022BDE81040203116F0C9 +:1041700061BE70B55B4C06004FF0000514D00DF029 +:104180001BFC08B110250DE00621304607F05EFA51 +:10419000411C06D0206614F85C0F40F080002070AF +:1041A00000E00725284670BD14F85C0F20F0800061 +:1041B000F5E72DE9F041804688B00D460027084616 +:1041C0000DF045FCA8B94046FDF72CF9040003D0DA +:1041D0002078222815D104E043F2020008B0BDE89F +:1041E000F08145B9A07F010603D500F00300022845 +:1041F00001D01020F2E7A07FC10601D4010702D54B +:104200000DB10820EAE7374991F85C10C90701D0E1 +:104210001120E3E7E17FC90601D50D20DEE700F0BC +:104220000300022805D125B12846FEF7F1FE07005C +:10423000D4D1A07F00F00300012806D00021404621 +:1042400009F0FBFB060002D00CE00121F7E7A07F9C +:1042500000F0030001280BD00021404609F0E4FBE8 +:10426000060007D0A07F00F00300022804D009E078 +:104270000121F2E70420B1E725B12A463146204664 +:10428000FEF7EAFE07AB1A4669463046FFF71CF810 +:10429000009800B9FFDF00990D20487006F5907076 +:1042A000C1F82480486100200881A07F00F003004D +:1042B00001282BD0F5B302200871301D8861707879 +:1042C00040090877B078C0F340004877287800F0BC +:1042D0000102887F62F301008877E27F62F3820047 +:1042E000887701E05C020020E27F520862F3C3009D +:1042F0008877B27862F304108877A878C87701F1DC +:10430000210228462031FEF7C7FE22E00120087175 +:10431000287800F00102087E62F3010008762A780E +:10432000520862F3820008762A78920862F3C3008A +:10433000087600E009E02A78D20862F304100876D3 +:1043400024212046FDF7A6F80BE003200871052084 +:10435000087625212046FDF79DF8A07F20F08000FB +:10436000A07701A900980AF09CFF022801D000B1B3 +:10437000FFDF384632E72DE9FF4FF94A0D4699B085 +:104380009A4607CA14AB002783E807001998FDF77F +:1043900049F8060006D03078262806D008201DB03F +:1043A000BDE8F08F43F20200F9E7B07F00F00309A7 +:1043B000B9F1010F03D0B9F1020F07D008E03DB900 +:1043C0001B98FEF725FE0028E9D101E01B9878BB79 +:1043D000B07F00F00300012806D00021199809F0F1 +:1043E0002CFB040003D101E00121F7E7FFDF852D5D +:1043F00025D007DCD5B1812D1BD0822D1BD0832D7C +:1044000008D11AE0862D1CD0882D1CD0892D1CD0F7 +:104410008A2D1CD00F2020710F281AD001208DF872 +:104420003400201D0E902079A8B158E10020F2E759 +:104430000FE00120EFE70220EDE70320EBE7052086 +:10444000E9E70620E7E70820E5E70920E3E70A2097 +:10445000E1E70720A3E7B9F1010F17D0D4E919501C +:1044600080460220019001200090A87898F8021060 +:10447000C0F3C000C1F3C00108405FEA000B5DD08B +:1044800050460DF099FA00286CD12DE0D4E9198539 +:104490000120019002200090214630461B9AFEF731 +:1044A000DBFD1B98007800F00101A87861F30100A2 +:1044B000A870F17F61F38200A870F17F490861F371 +:1044C000C300A870A17861F30410A8706078400957 +:1044D0002870A078C0F3400068701B988078E8705E +:1044E000002068712871C0E7DAF80C000DF064FA5A +:1044F000C0BBDAF81C000DF05FFA98BBDAF80C00CC +:10450000A060DAF81C00E06098F80100A17800F0E3 +:10451000010041EA4000A07098F80210C0B2C1F357 +:104520000011891E0840A070002084F82000009926 +:1045300006F1170002290BD001210AE098F80110BA +:10454000A07801F00101FD2242EA41010840E2E7C2 +:10455000002104EB810188610199701C022902D0BD +:10456000012101E028E0002104EB81018861A878A5 +:1045700000F00300012849D198F8020000F0030080 +:10458000012843D1B9F1010F04D12A1D691D1B98DF +:10459000FEF782FD297998F8040001408DF82C106F +:1045A000687998F8052010408DF8300001432DD02F +:1045B00050460DF001FA08B11020F0E60AF11000A3 +:1045C00004F5D47104F17C020490B9F1020F3CD0DF +:1045D0000090CDE9012100210BAB5A462046FEF7A1 +:1045E000D5FD0028E9D104F5D67104F19402B9F1A2 +:1045F000010F30D004980090CDE9012100210CABCF +:104600005A462046FEF7C2FD0028D6D1A078800782 +:1046100040D4A87898F80210C0F38000C1F380015C +:10462000084337D0297898F8000014AAB9F1010F8F +:1046300017D032F810204B00DA4012F0030718D0E0 +:10464000012F1ED0022F12D11DE0CDF800A0CDE920 +:1046500001210121C0E7CDF800A0CDE90121012110 +:10466000CDE732F811204300DA4002F00307032FB0 +:1046700007D0BBF1000F0DD0012906D0042904D0CA +:1046800008E00227F5E70127F3E7012801D0042815 +:1046900000D10427F07F40F001006BF34100F07778 +:1046A000A07881074FF003000CD5A071BBF1000F7B +:1046B00015D100BF8DF85C0017AA31461998FEF796 +:1046C00034FD0CE00221022F18D0012F18D0042F46 +:1046D00022D00020A071F07F20F00100F07725218A +:1046E0003046FCF7D7FE0DA904F590700AF0B9FD2D +:1046F00010B1022800D0FFDF002050E6A171D9E7F9 +:10470000A1710D2104F1240016F02DFC607840F019 +:10471000020060700420CDE70120A071DFE72DE9E1 +:10472000F04387B0914688460446FCF77BFE0700BD +:1047300006D03878272806D0082007B0BDE8F083D7 +:1047400043F20200F9E7B87F00F00300012809D026 +:104750000021204609F071F9040006D104E00000B0 +:1047600008B301000121F4E7FFDFA679012E08D08C +:10477000B8F1000F0FD048460DF01EF9B8B1102067 +:10478000DBE7B9F1000F25D1B8F1000F09D0B8F17E +:10479000010F1FD120E0022E05D0032E05D0FFDF30 +:1047A00028E00C2526E0012524E0022522E0B8F1CE +:1047B000020F03D0B8F1010F0AD00BE0032E09D18C +:1047C00000251022494604F1210016F033FB11E0C8 +:1047D000022E01D00720B0E70025102104F12100AE +:1047E00016F09FFB5FEA090004D0062106F02EFFB9 +:1047F000C4F82100607840F002006070C10713D057 +:1048000020F00100607002208DF8000004F121000A +:1048100002908DF804506946FF300AF022FD02280C +:1048200004D018B1FFDF01E084F82050252138467C +:10483000FCF730FE002080E730B587B00D46044617 +:10484000FCF7F0FD88B1807F00F0030001280FD055 +:104850000021204609F0F1F804000ED028460DF0A2 +:10486000ABF838B1102007B030BD43F20200FAE7D0 +:104870000121EEE76078400701D40820F3E72946DC +:1048800004F141002022054616F0D4FA607840F089 +:104890001000607001070FD520F008006070142030 +:1048A0008DF80000694604F5907001950AF0D9FC76 +:1048B000022801D000B1FFDF0020D4E770B594B02A +:1048C0000D460646FCF7AEFD18B10178272944D104 +:1048D00003E043F2020014B070BD807F00F00300DB +:1048E000012806D00021304609F0A7F8040003D1C2 +:1048F00001E00121F7E7FFDFA07902282DD1A078A0 +:10490000C0072AD0002302220321304603F050FCC6 +:1049100028B30D208DF80D0007A80222811FADF8E5 +:10492000142006ABCDE900310C9604F5907402908A +:10493000089400230321304603F0B7FC00B1FFDFE9 +:1049400004208DF810008DF824500DA903A80AF05A +:10495000A8FC00B1FFDF0020BDE70820BBE7112065 +:10496000B9E770B5064686B014460D4608460DF008 +:1049700023F818B920460DF043F810B1102006B006 +:1049800070BDA6F57F40FF380DD03046FCF74AFDDC +:1049900030B14378811C22461846FCF7E9FE07E057 +:1049A00043F20200EBE72046FDF7F3FC0028E6D1D6 +:1049B0001021E01D0CF0B2FCE21D29466846FEF70E +:1049C0009DFC102204F11700019916F033FA002023 +:1049D000D5E72DE9F04104468CB0154688460027FE +:1049E00008460DF034F818B928460DF030F818B123 +:1049F00010200CB0BDE8F0812046FCF713FD060046 +:104A000003D03078272818D102E043F20200F0E703 +:104A1000B07F00F00300012806D00021204609F0F5 +:104A20000CF8040003D101E00121F7E7FFDF607813 +:104A3000400702D5A078800701D40820D9E7B07FCD +:104A400000F00300012818D0D4E91901407800B122 +:104A5000B5B1487810B1B8F1000F11D0C5B1EA1D59 +:104A600006A8E168FEF74AFC102205F11700079935 +:104A700016F0B4F930B104270AE0D4E91910E5E7DB +:104A80000720B6E71022E91D04F1310016F0D2F933 +:104A9000B8F1000F06D0102208F1070104F121003F +:104AA00016F0C8F9607840F002006070C10715D0B8 +:104AB00020F00100607002208DF8000004F1210058 +:104AC0000290103003908DF804706946EF300AF0C0 +:104AD000C8FB022804D018B1FFDF01E084F8207081 +:104AE00025213046FCF7D6FC002082E7F8B51546B4 +:104AF0000E460746FCF796FC040004D020782228D6 +:104B000004D00820F8BD43F20200F8BDA07F00F0F9 +:104B10000300022802D043F20500F8BD30460CF035 +:104B20004BFF18B928460CF047FF08B11020F8BD1C +:104B300000953288B31C21463846FEF7F7FB112852 +:104B400014D00028F3D1297C4A08E17F62F30001E8 +:104B5000E1772A7C62F34101E177297C890884F8B6 +:104B60002010A17F21F08001A177F8BDA17F090766 +:104B7000FBD4D6F80200C4F83600D6F80600C4F814 +:104B80003A003088A0861022294604F1230016F04E +:104B900051F9287C4108E07F61F38200E077297CAD +:104BA00061F3C300E077287C800884F82100A07FAF +:104BB00040F00800A0770020D3E770B594B00D4610 +:104BC00006460BB1072086E6FCF72CFC040007D054 +:104BD0002078222802D3A07F400604D408207AE659 +:104BE00043F2020077E6C5B12D208DF80000ADF844 +:104BF00002601022294601A816F01CF9287C410801 +:104C0000E07F61F30000E077297C61F34100E07709 +:104C1000287C800884F8200004E02E208DF8000015 +:104C2000ADF8026009A9684606F0C3FCA17F21F037 +:104C30004001A1774FE670B50D46FCF7F3FB040089 +:104C400005D028460CF0DCFE20B1102070BD43F2E8 +:104C5000020070BD29462046FEF707FB002070BD0C +:104C600005E000BF10F8012B0AB100207047491E73 +:104C700089B2F7D20120704770B50D4600780499CB +:104C80001446042803D0052832D0FFDF70BDA88B5E +:104C90000E2200EB400002EB400018803320088019 +:104CA000002CF3D0A88BA081002613E0A87F012858 +:104CB00014D006EBC60005EB400106EB460204EB00 +:104CC0004202088CD0811020223110320AF08AFB77 +:104CD000761CB6B2A089B042E8D870BD05EB86015B +:104CE00006EB460204EB4202088CD0810220EBE77F +:104CF000A88B102200EBC00002EB4000188034208B +:104D00000880A87F012808D0022806D0FFDF002CE9 +:104D1000E3D0A88BA081002613E0A073F7E7A87F5B +:104D2000012812D006EBC60005EB400104EB400061 +:104D30000A8C028210221230223116F07BF8761C87 +:104D4000B6B2A089B042EAD870BD05EB860106EB89 +:104D5000C602088C04EB4202223110820220123279 +:104D60000AF040FBEBE72DE9F04105780E20DDF875 +:104D700018C001F1200402F10E074FF00008022DC7 +:104D800006D0032D2DD0062D6AD0FFDFBDE8F081BF +:104D9000CD8B05EB850600EB460018803120ACF882 +:104DA0000000002AF2D0087F9581801FC6B214E06F +:104DB00061682088388031F8020BF88031F8020BE6 +:104DC0003881BA1C30460AF00DFB06B118B187F8DD +:104DD0000480A7F8028008340A376D1EADB2E7D20E +:104DE000D4E7CD8B05EB850600EB4600188032201A +:104DF000ACF80000002AC9D0087F9581401FC6B2D8 +:104E00002AE06168228811F8010BFA803A79430898 +:104E100060F3000263F34102830863F38202C30874 +:104E200063F3C302030963F30412430963F34512F6 +:104E3000830963F386123A71C009787131F8020B65 +:104E400038813A4630460AF0CDFA18B187F8028028 +:104E5000A7F8008008340A376D1EADB2D1D295E7AD +:104E6000087FCD8B801E86B206F1080068431030A3 +:104E700018803520ACF80000002A87D0958102F117 +:104E80001007D68107EBC5080BE020883880C7F8EB +:104E9000048032464046616815F0CCFF0834B044C7 +:104EA00008376D1EADB2F0D270E72DE9F0471D4610 +:104EB000089E0C4681462AB1607E00F58070D08045 +:104EC000E08B108199F800000E274FF000084FF09A +:104ED000100A0C287ED2DFE800F096061521293151 +:104EE0003F4E636B6B6B207F9146082802D00328EE +:104EF00000D0FFDF2F8030200BE000BFA9F80C802E +:104F0000BDE8F087207F9146042800D0FFDF2F8086 +:104F100031203080B9F1000FF0D1F1E7207F9146C8 +:104F2000042800D0FFDF2F803220F2E7207F914657 +:104F3000022800D0FFDF2F803320EAE7207F1746CA +:104F4000022800D0FFDF3420A5F800A03080002F19 +:104F5000D6D0A7F80C80D3E7207F1746042800D0CE +:104F6000FFDF3520A5F800A03080002FC8D04046D4 +:104F7000A7F80C8012E0207F1746052802D00628EB +:104F800000D0FFDF1220288036203080002FB7D0DD +:104F9000E08BB881A7F81080B9F80200F881AFE77C +:104FA000207F9146072800D0FFDF2F803720B0E711 +:104FB0004FF0140018804FF03800170030809FD059 +:104FC000E08BB881A7F8128099F80000092807D073 +:104FD0000A2800E017E009D00B280DD0FFDF8FE78B +:104FE000207F0C2800D0FFDF01200AE0207F0D2861 +:104FF00000D0FFDF042004E0207F0E2800D0FFDF78 +:105000000520B8737CE7FFDF7AE770B50C460546EC +:10501000FCF708FA20B10078222804D2082070BDDD +:1050200043F2020070BD0521284608F006FD20600D +:1050300008B1002070BD032070BDFFB585B00746E4 +:105040001720ADF80C00089814460D46022628B922 +:1050500008A93846FFF7D9FF00283ED15DB10023EB +:10506000BDF80C203146384603F0A2F8B8B30898D2 +:105070000078A0BB05E02078092822D00F282FD087 +:10508000FFDF002004A9CDE9001003460290BDF81F +:105090000C203146384603F008F900281DD1089845 +:1050A00003A9801DC4E901072046049A04F017FBF8 +:1050B00060B3072828D2DFE800F01E1C2727252030 +:1050C000220007260023BDF80C203146384603F0A5 +:1050D0006FF80028D5D143F2040009B0F0BD08E014 +:1050E0000023BDF80C203146384603F061F8002853 +:1050F000C7D11120F1E70020EFE70820EDE743F2E8 +:105100000300EAE70720E8E70320E6E704980090B9 +:10511000BDF80C3004223146384603F048FA002826 +:10512000DBD1002DD9D008990D70D6E710B588B025 +:105130001C46AAB104238DF800301388ADF80C305A +:105140005288ADF80E208A788DF812200988ADF8C3 +:10515000101000236A462146FFF76FFF08B010BD0C +:105160001020FBE72DE9F041074600780C46122895 +:1051700039D2DFE800F0383434141036090909094F +:10518000090909090909090904B9FFDF607840F034 +:105190000800607028E0002CF8D1FFDFF6E7B8883F +:1051A000052186B2304608F048FC054604B1FFDF11 +:1051B00005B9FFDF3146A81D04F08AFA02F0EEFAC5 +:1051C000040007D0607840F008006070668002F04C +:1051D000C3FA0AE013213046FDF704FB16E0FFDFB7 +:1051E00002E0FFDF00E0FFDF84B1607800070DD54B +:1051F0002078582220F00F00C01C20F0F0009030E2 +:105200002070394604F1180015F059FE0020BDE564 +:1052100000200870881D04F058BA0A460146901D07 +:1052200004F05CBA70B50546052108F006FC0400E0 +:1052300000D1FFDF2946A01DBDE8704004F048BA48 +:105240002DE9FE4F4FF00009ADF80890ADF804903D +:1052500047880C46054693460521384608F0EDFB85 +:10526000060000D1FFDF24B1A780A4F80690A4F8BF +:105270000890297E04F112003827C91E4FF001085A +:105280004FF0360A00900F2970D2DFE801F0F9FAEA +:105290006F6108AD6A70812CB6C9E59595003078CC +:1052A000012800D0FFDFA88B0E2101EBC001ADF873 +:1052B00004103021ADF80810002C13D0A08100207C +:1052C0000DE004EBC00132790A747288CA8105EBE3 +:1052D0008002401CD38B4B82128C8A8280B2A189BF +:1052E0008142EED8E8E03078012800D0FFDFE88B7B +:1052F0000E2101EBC001ADF804103021ADF808100B +:10530000297F091FC9B20091002CEBD0A081002792 +:105310001AE000BF05EBC70A04EBC70808F10E024C +:10532000DAF8241000980AF05DF818B188F81090A7 +:10533000A8F80E90BAF82010A8F81210BAF82210A7 +:105340007F1CA8F81410BFB2A089B842E2D8B3E01D +:1053500002A8009001AB224629463046FFF78CFC9C +:10536000AAE03078072806D0FFDF04E0A3E0307819 +:10537000072800D0FFDFE88BADF808A01230ADF8A9 +:105380000400002C38D0A98BA1817188E18123E031 +:105390003078082800D0FFDFA88B00F10E01ADF8AF +:1053A00004103721ADF80810002C25D0A081AA8B5D +:1053B00004F10E00296A4CE0E88B123080B23921EA +:1053C000ADF80400ADF80810F4B3A98BA181287ED4 +:1053D000102807D00221A173E98B2182EA8B296A68 +:1053E000009836E00121F6E702A8009001AB2246C2 +:1053F00029463046FFF7B7FC5EE03078092800D038 +:10540000FFDF1420ADF80400ADF808701CB3A98BC1 +:10541000A181A4F81290A4F8109084F80E804BE0BB +:1054200030780A2800D0FFDF288CADF808701430DF +:10543000ADF804007CB10421A173A98BA181E98B93 +:105440002182298C618200E032E02A8C04F1140070 +:10545000696A15F0EFFC2FE030780B2800D0FFDFF1 +:105460001420ADF80400ADF8087004B30521A17351 +:10547000A4F80C90A4F81090A4F812901CE000E09E +:1054800008E002A8009001AB224629463046FFF70B +:105490000CFD11E00D203A21ADF80400ADF8081024 +:1054A00034B1A4F80680A4F8089084F80C9003E0C6 +:1054B000ABF8000014E0FFDFBDF80400ABF800001B +:1054C00074B1BDF808002080BDF804006080287E1B +:1054D000032805D0102803D0112801D086F80090A9 +:1054E0000020BDE8FE8F2DE9F84356880F46804620 +:1054F00015460521304608F0A0FA040000D1FFDF70 +:10550000A41D33462A4639464046009404F064FA06 +:10551000BDE8F8832DE9F0438DB00D461446814671 +:1055200007A9FFF772FD002814D14FF6FF76012777 +:105530004FF420588CB103208DF800001020ADF8F6 +:10554000140008A802460690204605A909F069FF44 +:1055500078B107200DB0BDE8F0830820ADF80C50FD +:105560008DF812708DF80000ADF80E60ADF8108067 +:105570000CE00798A1780171218841808DF81270A4 +:10558000ADF80C50ADF81080ADF80E606A46012100 +:105590004846079BFFF751FDDCE708B501228DF86F +:1055A000022042F60202ADF800200A4602236946B4 +:1055B000FFF7BCFD08BD08B501228DF8022042F6B8 +:1055C0000302ADF800200A4603236946FFF7AEFD4B +:1055D00008BD00B587B079B102228DF800200A8895 +:1055E000ADF80C204988ADF80E1000236A4604215E +:1055F000FFF723FD07B000BD1020FBE709B106232C +:1056000094E50720704770B588B00D4614460646ED +:1056100007A9FFF7FAFC00280ED17CB10620ADF8EF +:105620000C508DF80000ADF80E40079B6A4607212C +:105630005C803046FFF701FD08B070BD05208DF895 +:105640000000ADF80C50F0E700B587B059B1072362 +:105650008DF80030ADF80C20049100236A46082133 +:10566000FFF7EBFCC6E71020C4E770B5002488B054 +:10567000172391B10A78062A20D2DFE802F01F042E +:10568000041503171523DB1E9DB2CB880BB18E6862 +:105690001EB1AB4203D90C20CEE71020CCE7042A80 +:1056A00004D08B8853B901E00620C5E7012A13D046 +:1056B000022A05D0042A1CD0052A2AD00720BBE7DD +:1056C00009228DF800204A88ADF80C20CA88ADF870 +:1056D0000E208968049123E00C228DF800204A886E +:1056E000ADF80C20CA88ADF80E2089680924049111 +:1056F00016E00D228DF800204A88ADF80C208A882B +:10570000ADF80E20CA88ADF8102089680A240591EA +:1057100006E00E228DF8002049788DF80C100B243D +:1057200000236A462146FFF788FC85E700B587B06D +:105730000F228DF80020ADF80C1000236A461946A0 +:10574000FFF77BFC56E700B587B071B102228DF8F8 +:1057500000200A88ADF80C204988ADF80E1000230F +:105760006A460521FFF769FC44E7102042E7000084 +:1057700018B1817801293CD101E0102070470188DF +:1057800042F60213C81A4FF48072994233D01CDCDF +:1057900042F60103A1EB030099422CD00CDCF9B1D5 +:1057A000B1F5C05F27D06FF4C050081823D0A0F522 +:1057B0007060FF381DD11EE001281CD002281AD0CD +:1057C000FF2818D0904214D115E0904213D008DC85 +:1057D000012810D002280ED0FE280CD0FF2808D1B6 +:1057E00009E0A0F58070013805D0012803D0022817 +:1057F00001D0002070470F2070470B2826D008DC0E +:105800001BD2DFE800F01C2025251A252923252797 +:105810001E0011281CD008DC0C2817D00D281DD024 +:105820000F2815D0102808D110E0822809D084282C +:1058300010D0852810D0872812D003207047002070 +:1058400070470520704743F20300704707207047F8 +:105850000F20704704207047062070470C207047C7 +:105860004FF45050704707280DD2DFE800F00406CF +:10587000040C0C080A000020704711207047072014 +:1058800070470820704703207047007810F00F021F +:1058900004D0012A05D0022A0CD110E0000909D158 +:1058A0000AE00009012807D0022805D0032803D008 +:1058B000042801D007207047087000207047062098 +:1058C000704705282AD2DFE800F003070F171F00F2 +:1058D000087820F0FF001EE0087820F00F00401C40 +:1058E00020F0F000103016E0087820F00F00401C87 +:1058F00020F0F00020300EE0087820F00F00401C6F +:1059000020F0F000303006E0087820F00F00401C56 +:1059100020F0F000403008700020704707207047EA +:1059200038B50C46050041D06946FFF7AEFF0028A8 +:1059300019D19DF80010607861F30200607069462B +:10594000681CFFF7A2FF00280DD19DF800106078B9 +:1059500061F3C5006070A978C1F34101012903D04A +:10596000022905D0072038BD217821F0200102E06E +:10597000217841F020012170410704D0A978C9089D +:1059800061F386106070607810F0380F07D0A97846 +:10599000090961F3C710607010F0380F02D1607808 +:1059A000400603D5207840F040002070002038BD2C +:1059B00070B504460020088015466068FFF7B0FF08 +:1059C000002816D12089A189884211D86068807882 +:1059D000C0070AD0B1F5007F0AD840F20120B1FB20 +:1059E000F0F200FB1210288007E0B1F5FF7F01D92B +:1059F0000C2070BD01F201212980002070BD10B57E +:105A00000478137864F3000313700478640864F373 +:105A1000410313700478A40864F3820313700478BC +:105A2000E40864F3C30313700478240964F30413D3 +:105A300013700478640964F34513137000788009C7 +:105A400060F38613137031B10878C10701D1800764 +:105A500001D5012000E0002060F3C713137010BDD2 +:105A60004278530702D002F0070306E012F0380F25 +:105A700002D0C2F3C20300E001234A7863F30202BA +:105A80004A70407810F0380F02D0C0F3C20005E031 +:105A9000430702D000F0070000E0012060F3C502D8 +:105AA0004A7070472DE9F04792B00D00804613D040 +:105AB000B8F1000F14D01221284615F032FA03AACB +:105AC000FF21012005F0D3FB0024264637464FF482 +:105AD00020596FF4205A6DE0102012B0BDE8F08715 +:105AE0000720FAE79DF8160001280AD1BDF8140036 +:105AF00048450BD010EB0A000AD001280CD0022830 +:105B00000CD0042C0ED0052C0FD10DE0012400E0A8 +:105B10000224BDF8126008E0032406E00424BDF866 +:105B2000127002E0052400E00624BDF81210414581 +:105B300040D12C7486B34FF007090DF134080EAA3A +:105B4000CDF80090CDE9012810230022FF21304636 +:105B500005F029FCF0B9BDF834002A46C0B20EA900 +:105B600009F040FCB0B9AE81B7B108AECDF80090F5 +:105B7000CDE9016813230022FF21384605F013FC0C +:105B800040B9BDF83400F11CC01EC0B22A1D09F096 +:105B900029FC10B10320A0E70AE0BDF82100E8814C +:105BA000062C05D19DF81600A872BDF814002881B6 +:105BB000002092E703A805F062FB002892D0FFF7CF +:105BC0001CFE8AE72DE9F0438BB00E46DDE9129802 +:105BD00005461C461746142103A815F0C4F90120F8 +:105BE0008DF810008DF80C008DF81180ADF8147050 +:105BF00064B1A178C90709D08DF81600E088ADF826 +:105C00001A00A088ADF81800A068079001F0C6FD42 +:105C1000040025D06580002009A9CDE900101722D5 +:105C2000034601460290ADF82020284602F03DFBD5 +:105C3000002812D108368DE8700008AA494603A84A +:105C4000099B04F042FE06466078000701D501F08A +:105C500083FD5EB13046FFF706FE0BB0BDE8F08372 +:105C600013212846FCF7BEFD0320F6E709980090B3 +:105C7000BDF8203004220021284602F098FCECE711 +:105C800070B506468AB000200D46059007240490A2 +:105C9000069003A900940790CDE901010246102364 +:105CA0002946304605F07FFB68B904A9009108A891 +:105CB000CDE90140BDF80C3000222946304605F000 +:105CC00081F9002801D0FFF798FD0AB070BD05F0FA +:105CD0003CB82DE9FC470546002700780C46B8463D +:105CE000B9460C2873D2DFE800F0B8060D2FCE5F5E +:105CF0005F7F96B49AA504B1FFDF288980B201F0D6 +:105D0000BFFEABE0A888042180B2814607F095FE73 +:105D1000064604B1FFDF06B9FFDF494606F1080079 +:105D200004F03CFA01F03AFD040008D0607840F03D +:105D300008006070A4F8029001F00EFD8FE01321BE +:105D40004846FCF74FFD9EE004B9FFDF6088042160 +:105D500007F073FE060000D1FFDFA6F800900020D8 +:105D600029791EE005EBC0029268D3B25FEA037C9A +:105D700007D5DB0605D505EBC10030F8020C3080F5 +:105D800007E0120A52060AD5307105EBC000C08840 +:105D900070806078022740F0080060705EE0401C70 +:105DA000C0B28142DED859E0E888ADF8000004B9FD +:105DB000FFDF9DF80100000604D52878062807D0EB +:105DC00005282AD0607840F00800607046E044E082 +:105DD0006088042107F031FE060000D1FFDF86F85D +:105DE0000490A888708018E004B9FFDF608804215F +:105DF00007F023FE060000D1FFDF06F1080004F0E3 +:105E0000F8FF90F0010F02D1E879000626D56088EE +:105E10000227F080D6E704B9FFDF0227D2E704B9F2 +:105E2000FFDF022761880122204601F06DFE4FF05E +:105E30000108C7E7A88986B204B1FFDF686800904F +:105E40002889ADF8040001226946304601F077FE4A +:105E500004E0002CB6D1FFDFB4E7FFDF9CB160782F +:105E6000000710D5B8F1000F0DD12078582220F08E +:105E70000F00001D20F0F00080302070294604F152 +:105E8000180015F01CF83846BDE8FC873EB50C003C +:105E900008D06B4601AA002105F0F2FA20B1FFF705 +:105EA000ACFC3EBD10203EBD00202080A0709DF8BF +:105EB000050002A900F00700FFF703FD50B99DF8A7 +:105EC000080020709DF8050002A9C0F3C200FFF78A +:105ED000F8FC08B103203EBD9DF8080060709DF8F5 +:105EE0000500C109A07861F30410A0709DF80510A9 +:105EF000890961F3C300A0709DF80410890601D5DB +:105F0000022100E0012161F342009DF8001061F3DD +:105F10000000A07000203EBD70B5144606460D4638 +:105F200051EA040005D075B108460BF087FD78B939 +:105F300001E0072070BD2946304605F0FCFA10B19B +:105F4000BDE8704059E454B120460BF077FD08B12C +:105F5000102070BD21463046BDE8704096E7002015 +:105F600070BD2DE9FE4F05460C46007E0A310091BA +:105F700004F108010027029190460C31821E3E4632 +:105F8000BB464FF0010A0191082A7CD2DFE802F0FB +:105F9000F7047B32327EBCF86888042107F04DFD9F +:105FA0005FEA000900D1FFDFB9F8000010B1522705 +:105FB0000726ECE051271026002C7CD06888A080B2 +:105FC00084F806A099F80400002205EBC0000099AF +:105FD000C08BFFF7A1FF00286ED199F8040005EBF4 +:105FE000C000C08B208199F8040005EBC000408CF4 +:105FF000E081E6E0B5F82290062822D1E87F00068D +:106000001FD5512709F1140086B2002CD5D0A88BDA +:1060100000220099FFF780FF002873D16888A080D4 +:106020000220A071A88B208184F80EA0288C2082E9 +:10603000A4F812904A46696ADDF8040014F0FAFEEA +:10604000BFE0502709F1120086B2002C33D0A88B94 +:1060500000220299FFF760FF002853D16888A080D2 +:10606000A88BE080287E06280ED002202073288C82 +:10607000E081E87F4A46C0096073A4F8109004F1FB +:106080001200696ADAE79BE00120EFE768880421E3 +:1060900007F0D3FCB5F822A05FEA000900D1FFDFCA +:1060A00009F1080004F0A5FE90F0010F02D1E87F8D +:1060B000000626D501E076E024E00AF1140051271D +:1060C00086B2002C70D06888A080A88B002200992E +:1060D000FFF722FF002815D10220A071A88B208194 +:1060E0000420A073288C2082A4F812A05246696A6A +:1060F000019814F09FFE89F804B0A98BA9F802104A +:106100005FE00320BDE8FE8F6888FBF78BF98246CD +:106110006888042107F091FC8146BAF1000F00D194 +:10612000FFDFB9F1000F00D1FFDFB9F80600A0F5DD +:106130007F41FF3902D05127142601E05027122653 +:106140008CB36888A080502F06D00220A071287FD1 +:10615000029901F016F934E0287FA11D01F011F930 +:106160009AF82210CDE9001BB9F8022068880023B4 +:106170004946FFF727FD0028C4D122E000E016E0E1 +:10618000FE49A88BC988814205D15427062654B1FF +:106190006888A08015E05327082624B16888A0806D +:1061A000A88BE0800DE0FFE7A8F800600EE055271F +:1061B0000726002CF8D0A88BA08084F806B000E059 +:1061C000FFDFA8F800600CB127806680002099E707 +:1061D000EA4900200870704730B587B00C4607F0D8 +:1061E000F5FB0546FF2800D1FFDF0020208020714D +:1061F00060804FF6FF70E080294604F1080003F04C +:10620000BFFF02AA2946012005F031F81AE000BFBD +:106210009DF80B00000715D5BDF80E002946FFF7C5 +:106220002FFD9DF80B00FF2340F010008DF80B00B0 +:10623000BDF80B00ADF80400BDF80E002946019A28 +:1062400005F047F902A805F01AF80028E0D007B0D9 +:1062500030BD0A46014602F1080003F0A5BF70B543 +:106260000546042107F0E9FB040000D1FFDF2946C1 +:1062700004F10800BDE8704003F090BF2DE9F04143 +:106280008AB00D468046FBF7CDF8060006D0307880 +:10629000222806D208200AB0BDE8F08143F20200AD +:1062A000F9E70421404607F0C8FB07460DB1A8886E +:1062B00078B101208DF8140002208DF81800002418 +:1062C0008DF819403DB1A888ADF8200028680790E6 +:1062D00004E00920DFE7ADF82040079401F05EFA02 +:1062E000050026D0A5F8028004A8CDE900041722F5 +:1062F0000023ADF80C2019464046029401F0D5FF6A +:106300000028C8D107F108000095CDE9018096F872 +:10631000221003AA05A8049B04F0D7FA0446687863 +:10632000000701D501F018FA4CB12046FFF79BFA9F +:10633000B1E713214046FCF755FA0320ABE7049878 +:106340000090BDF80C3004220021404602F02FF9E5 +:106350004FF6FF71F9809EE72DE9FF5F83460E9EA1 +:106360009846914677888A463846FBF75BF805469B +:106370000421384607F061FB044605B9FFDF04B984 +:10638000FFDF0834CDE90274CDE9008695F82210CC +:106390004B465246584603F037FF04B0BDE8F09F25 +:1063A0002DE9F04F99B004464FF000087348ADF85E +:1063B0004C80ADF82480ADF84880A0F80480ADF89A +:1063C0000C80ADF81080ADF81880ADF8148000781E +:1063D00016460D464746012809D0022807D0032853 +:1063E00005D0042803D0082019B0BDE8F08F20465E +:1063F0000BF0E2FAD0BB28460BF0DEFAB0BB6068C7 +:106400000BF025FB90BB606848B160892189884208 +:1064100002D8B1F5007F01D90C20E5E7804608AA33 +:1064200004A92846FFF7C4FA0028DDD168688078FF +:10643000C0F34100022808D19DF8110010F0380F78 +:1064400003D028690BF0FAFA80B903A92069FFF795 +:1064500067FA0028C8D1206950B1607880079DF89C +:106460000D0000F0380002D5E8B301E011E0D0BB28 +:106470009DF80C0080060ED59DF80D0010F0380F29 +:1064800003D060680BF0DAFA18B960680BF0DFFA35 +:1064900008B11020A8E705A96069FFF741FA0028B4 +:1064A000A2D1606940B19DF8150000F007010129F3 +:1064B0003BD110F0380F38D006A9A069FFF730FAA9 +:1064C000002891D19DF8140080062ED49DF8180064 +:1064D00080062AD4A06950B19DF8190000F0070188 +:1064E000012922D100E020E010F0380F1DD0E06833 +:1064F00018B10078C8B11C2817D20CAA611C20461C +:10650000FFF77DFA0120B94660F30F27BA46074628 +:106510008DF8460042F60300ADF844000DF1330259 +:1065200015A9286808F07DFF08B107205CE79DF8F1 +:10653000540014A9CDF80090C01CCDE9019100F0E1 +:10654000FF0B00230BF20122514611A804F0D7FDE6 +:10655000E8BBBDF850000B9008492A892869091D3D +:106560000092CDE901016B89BDF8202028680499CB +:1065700004F0C5FD01007CD1207801E05803002023 +:10658000C1064FF0020A01D480062BD5ADF81C904D +:10659000606950B905A904A8FFF762FA9DF81500D3 +:1065A00020F00700401C8DF815009DF814008DF8B0 +:1065B000467040F0C8008DF8140042F60210ADF8A5 +:1065C000440009A907AA0023CDF800A000E01CE0C0 +:1065D000CDE9012140F2032211A8059904F08FFDB5 +:1065E000010046D1F8484D464FF007098088ADF8C4 +:1065F00031000CA9CDE900195B4600220295FF216C +:10660000BDF8500004F0DEFC10B1FFF7F6F8EBE641 +:106610009DF83000000625D52946012060F30F21A2 +:106620008DF846704FF42450ADF84400ADF8285072 +:1066300062789DF82800002362F300008DF828009E +:106640006278520862F341008DF828000AAACDF85A +:1066500000A0CDE9012540F2032211A804F04FFD6E +:10666000010006D1606850B3206970B903A904A87D +:1066700000E07DE0FFF7F4F96078800705D49DF82D +:106680000D0020F038008DF80D008DF8467042F6B0 +:106690000110ADF84400208940F20121B0FBF1F275 +:1066A00001FB1202606812ABCDF80080CDE9010356 +:1066B000002311A8039904F022FD010058D120788D +:1066C000C00729D0ADF81C50A06950B906A904A88C +:1066D000FFF7C6F99DF8190020F00700401C8DF85F +:1066E00019009DF818008DF8467040F040008DF8B4 +:1066F000180042F60310ADF8440013A907AACDF81C +:1067000000A0CDE90121002340F2032211A806993F +:1067100004F0F5FC01002BD1E06868B329460120A4 +:1067200060F30F218DF8467042F60410ADF8440076 +:10673000E068002302788DF8582040788DF85900E1 +:10674000E06816AA4088ADF85A00E06800798DF834 +:106750005C00E068C088ADF85D00CDF80090CDE940 +:1067600001254FF4027211A804F0C9FC010003D006 +:106770000B9800F019FE37E693480321017056B1DB +:1067800080883080BDF848007080BDF82400B0805B +:10679000BDF84C00F080002026E670B501258AB0D7 +:1067A00016460B46012802D0022816D104E08DF8C7 +:1067B0000E504FF4205003E08DF80E5042F60100C9 +:1067C000ADF80C0063B10024601C60F30F2404AA30 +:1067D00008A9184608F025FE20B107200AB070BDB0 +:1067E0001020FBE704A99DF820207748CDE900217F +:1067F000801C02900023214603A802F2012204F02B +:106800007EFC10B1FEF7F9FFE8E76F480EB1418852 +:10681000318005700020E1E770B594B00446012690 +:106820008DF83E6041F60100ADF83C0012AA0FA9B8 +:106830003046FFF7B2FF002848D12078624CC007ED +:106840004FF0000544D01C2102A814F08CFB9DF8E9 +:1068500008008DF83E6040F020008DF8080042F6F8 +:106860000520ADF83C000E959DF83A00119520F0FA +:106870000600801C8DF83A009DF838006A4620F02A +:10688000FF008DF838009DF8390009A920F0FF00BD +:106890008DF839000420ADF82C00ADF830000EA8BA +:1068A0000A9011A80D900FA80990ADF82E5002A8DB +:1068B000FFF776FD002809D1BDF80000E080BDF8A3 +:1068C00004002081401C60812570002014B070BD40 +:1068D000E5802581BDF84800F4E72DE9F74F8B46A8 +:1068E000394900269EB00A78012A04D0022A02D033 +:1068F000082021B079E54A88824201D00620F8E7D5 +:1069000089465A4501D10720F3E701214FF00008DD +:106910008DF86610ADF8401042464FF6FF71531CDB +:1069200063F30F220492ADF84210ADF84A10FF2035 +:1069300042F6020A8DF86A801AAA8DF84800ADF86E +:1069400064A0ADF868801192CDF84C8010A804F0D6 +:10695000BDFC0024254627460BAA072110A804F0F9 +:10696000B8FC78B1822857D184B37DB3ADF85C40D0 +:106970009DF85600ADF85E508DF80C8017AC0128DC +:106980005ED065E09DF832000FB3012853D1BDF809 +:10699000301051451DD116AA07A907208DE8070020 +:1069A000BDF82E0010230022FF2104F0FCFC98BB50 +:1069B000BDF85800042801D0062847D1BDF81C10A6 +:1069C000594538D10F2094E75803002036E00128BC +:1069D00031D1BDF83000B0F5205F03D042F601019F +:1069E000884228D1B9F80210BDF82E00814201D1A9 +:1069F000012700E0002704B17DB158451BD116AB3B +:106A000007AA07218DE80E00044610230022FF216B +:106A100004F0C9FC00B902E02DE035460BE0BDF8FA +:106A20005800022801D0102810D1C0B215AA07A919 +:106A300008F0D8FC50B9BDF82E608DE7052058E766 +:106A400003A915A8221D08F0ECFC08B1032050E7AB +:106A50009DF80C000023001DC2B220988DF80C2078 +:106A60000092CDE9014019A8049904F048FB10B93F +:106A7000022289F80020FEF7C0FE3AE710B50B4667 +:106A8000401E86B084B203AA00211846FEF7B7FF65 +:106A900004AA072103A88DE8070001230022FF2193 +:106AA000204604F08FFA0446BDF81000012800D0FB +:106AB000FFDF2046FEF7A1FE06B010BDF0B5FC4F8B +:106AC000044687B038780E46032804D0042802D044 +:106AD000082007B0F0BD04AA03A92046FEF768FF0E +:106AE0000500F6D160688078C0F3410002280AD121 +:106AF0009DF80D0010F0380F05D020690AF09EFFB8 +:106B000008B11020E5E7208905AA21698DE8070072 +:106B10006389BDF810202068039904F0F0FA10B1E1 +:106B2000FEF76BFED5E716B1BDF8140030800420E7 +:106B300038702846CDE738B50C00054609D000234B +:106B40006A46FF2104F09CFC28B100BFFEF755FE09 +:106B500038BD102038BD69462046FEF7E1FE00280A +:106B6000F8D1A078FF2100F001032846009A04F034 +:106B7000B0FCEBE77FB5144603AA07250292CDE9E6 +:106B800000350A462388FF2104F01CFABDF80C10DA +:106B90002180FEF732FE04B070BD2DE9F04192B0C5 +:106BA0004FF000050C000746ADF8105019D0E06812 +:106BB00028B1A068A8B10188ADF81010058038464A +:106BC000FAF730FC88B1007822286AD3384606F0FC +:106BD000FDFE80460421384606F02FFF060008D14E +:106BE00006E0102012B0BDE8F08143F20200F9E7A0 +:106BF000FFDFA078012803D0022801D00720F1E7A9 +:106C0000208838B1401C80B206AA414604F02FFB10 +:106C100038BB02E043F20300E4E706A804F02FFBD0 +:106C20009DF822204FF45051012A09D1BDF82020AF +:106C3000A2F52453023B03D1822801D088B901E098 +:106C40000846CFE7E06898B1072204A9CDE9000221 +:106C50000291A2882088BDF81030FF2104F0B2F91B +:106C600010B1FEF7CAFDBDE7A168BDF810000880AD +:106C70009DF81B00C00602D543F20140B2E70A9816 +:106C800018B1BDF82400022801D00320AAE717227A +:106C90000A98ADF80C20A1780078012903D080076C +:106CA00010D408209EE7C007FBD0002307213846F8 +:106CB00001F07EFA18B14FF00708022005E043F218 +:106CC00004008FE74FF0010803208DF83000208882 +:106CD000ADF834000BA8CDE9000500230295BDF8FE +:106CE0000C204146384601F0E0FA002887D1CDE972 +:106CF00000570836029603AA07210CA80B9B03F045 +:106D0000E4FD10B1FEF7AFFD6CE70B980090BDF805 +:106D10000C3004224146384601F049FC62E770B568 +:106D2000064615460C460846FEF722FD002805D10A +:106D30002A4621463046BDE870402EE570BDCCE5C0 +:106D400070B51E4614460D0009D044B1616831B1DA +:106D500038B157494988814203D0072070BD1020BF +:106D600070BD2068FEF704FD0028F9D132462146A7 +:106D70002846BDE87040FFF713BB70B515460C0000 +:106D800006D038B14A498988814203D0072070BDB6 +:106D9000102070BD2068FEF7EBFC0028F9D12946D1 +:106DA0002046BDE8704089E670B5054686B00E46BF +:106DB000144610460AF024FEF0BB60680AF047FE55 +:106DC000D0BBA5F57F40FF3803D02846FAF72AFB51 +:106DD000A0B1284606F0FAFD054630466946FEF7A2 +:106DE00061FE00280CD19DF810100F20082936D222 +:106DF000DFE801F008060606060A0A0843F2020068 +:106E000006B070BD0320FBE79DF80210012908D1F0 +:106E1000BDF80010B1F5C05FF2D06FF4C052D1429E +:106E2000EED09DF80610012905D1BDF80410A1F59A +:106E300028510529E4D900E022E09DF80A10012933 +:106E40000ED1BDF80810B1F5245FD9D0A1F52451B9 +:106E50000239D5D00129D3D0022901D1D0E7FFDFF3 +:106E6000606878B9002305AA2946304604F008FB7B +:106E700010B1FEF7C2FCC3E79DF81400800601D4F0 +:106E80001020BDE76188224630466368FFF772FE36 +:106E9000B6E72DE9F043074685B08946144610460B +:106EA0000AF0AEFD30B1102005B0BDE8F08300005F +:106EB00058030020384606F089FD4FF6FF76054658 +:106EC000B74201D0FF2D0AD00146002304AA48464C +:106ED00004F0D6FA30B100BFFEF78FFCE4E743F2CE +:106EE0000200E1E79DF81000C00602D543F2014020 +:106EF000DAE74FF0070803A90027CDF80080CDE9B5 +:106F00000171628833462946484604F04CFA06006F +:106F100012D160680AF074FD58B96068CDF800803D +:106F2000CDE90107238862882946484604F03BFAE8 +:106F30000646BDF80C0020803046CDE739B1FD4B48 +:106F40000A881B899A4202D843F20300704724E65C +:106F500010B586B0F74C0423ADF81430E3883BB18C +:106F600024898C4201D2914204D943F20300A3E563 +:106F70000620A1E5ADF81010002100910191ADF8B7 +:106F8000003002218DF8021005A9029104A9039195 +:106F9000ADF812206946FFF700FE8DE52DE9FC47AC +:106FA00081460F4608460AF007FDD0BB4846FAF76F +:106FB00039FA5FEA000811D098F80000222832D38D +:106FC000002317221946484601F0F2F850B1042177 +:106FD000484606F032FD060007D105E043F2020004 +:106FE000BDE8FC871120FBE7FFDF06F1080003F096 +:106FF000F1F805463878012803D0022804D007208C +:10700000EEE7A8070FD502E015F0340F0BD0B879E2 +:107010003C1DC00709D0E08838B1A0680AF0CCFC5C +:1070200018B11020DCE70820DAE73A782088002140 +:1070300028B3A0F201130721112B18D20CD2DFE8DC +:1070400003F00B090D0B1D0B121D100B0B1D1D1D4D +:107050001D0B1D00022A11D10846C1E7012AFBD0F1 +:107060000CE0EA0600E0AA06002AF5DA06E0A0F540 +:10707000C0721F2A02D97D3A022AEDD8C1B298F80F +:107080002200CDE900017288234631464846FEF7CA +:1070900099FDA5E72DE9FF4F89B01E4615460C4620 +:1070A0004FF000080F460998FAF7BCF930B10078A4 +:1070B000222806D208200DB0BDE8F08F43F202006E +:1070C000F9E7B00801D00720F5E7032E00D100262C +:1070D000099806F07BFC83464FF6FF7ACCB1022D6F +:1070E0006AD320460AF0B3FC30B904EB0509A9F1D4 +:1070F00001000AF0ACFC08B11020DCE7AD1EAAB21A +:107100002146504604F0CCFA39F8021C884253D18B +:10711000ADB28848B10702D50189491C00E00121C0 +:107120001FFA81F9F10701D0068900E0564603AA4B +:107130005946484604F09BF84FF0070A0BE0788860 +:10714000102839D808F1040108441FFA80F8A8452E +:1071500032D804EB08078FB339884945EFD34DE0A7 +:107160009DF80F100A0749D54CB304EB080908F144 +:107170000402B9F8023097B2102B1DD8DA19AA42CE +:107180001AD8B9F80020904216D1C80618D5E119CE +:10719000CDE9001A08AA0292B9F800000022594667 +:1071A00003F010FF10B1FEF728FB84E7B9F80200E6 +:1071B000BDF82010884203D00B207CE71EE005E0DC +:1071C000B9F8020038441FFA80F806E0C90604D571 +:1071D0005946FEF755FD00288FD19DF80F00FF237B +:1071E00020F010008DF80F00BDF80F00ADF8000082 +:1071F000BDF812005946009A04F06BF903A804F098 +:107200003EF818B9BDF81200B042A9D90421099876 +:1072100006F013FC040000D1FFDF22885AB10025DC +:10722000CDE900A52B4621460998FEF7CBFC0028A6 +:10723000BBD125803FE700203DE72DE9F04F89B025 +:107240001E4617000D464FF000041BD0B10802D0B7 +:10725000072009B030E7032E00D1002606F0B6FB68 +:107260008046FF2805D07DB128460AF0E7FB48B9E3 +:1072700002E043F20200ECE73988681E08440AF095 +:10728000DDFB08B11020E4E72A49B00701D54889A1 +:1072900000E00120F2074FF6FF7902D04989491E2C +:1072A00000E049468EB204AA414603F0E0FF4FF0E9 +:1072B000070A0DF10C0B33E09DF8131009072FD5C9 +:1072C0000023CDE900A3CDF808B04B46002241468B +:1072D00004F069F8E8B9F5B1BDF80C103A8821441A +:1072E0002819091D8A4231D3BDF8162020F8022B37 +:1072F000BDF80C2020F8022BCDE900A0CDF808B095 +:10730000BDF81600BDF80C300022414604F04BF8E1 +:1073100008B103209DE7BDF80C002044001D84B295 +:1073200004A803F0ACFF38B1822809D0FEF765FA53 +:107330008FE7000058030020BDF81600B042BBD90B +:1073400034B175B13988A01C814203D20C2080E78A +:1073500005207EE722462946484604F0A1F929196E +:107360000880A41C3C80002073E710B504460AF096 +:1073700047FB08B1102010BD114840892080002033 +:1073800010BD70B50C4605460E21204613F0C9FD10 +:10739000002020802DB1012D01D0FFDF70BD06201F +:1073A00000E00520A07170BD10B50C4603F02EFF63 +:1073B00000B1FFDF2046BDE81040FEF71EBA000016 +:1073C000580300204FF0E0224FF400410020C2F8A3 +:1073D000801120490870204990020860704730B53C +:1073E0001C4D04462878A04218BF002C02D000286B +:1073F00018BFFFDF2878A04208BF30BD2C701749A6 +:10740000154A0020ECB1164DDFF858C0131F012CAF +:107410000DD0022C1CBFFFDF30BD086003200860C8 +:10742000CCF800504FF400001060186030BD0860C8 +:1074300002200860CCF800504FF0407010601860D7 +:1074400030BD086008604FF06070106030BD00B55E +:10745000FFDF00BD1600002008F5014000F50040E8 +:107460006403002014F5004010B50446007894B081 +:10747000022805D0012803D043F2050014B010BD46 +:10748000A07828B1032803D8607808B1032801D96F +:107490000720F3E73F208DF800002078022801D074 +:1074A000012000E000208DF80200607800F095FDDA +:1074B000C01D8DF80300A078012800D1022000F043 +:1074C0008CFD8DF80400607800F087FD8DF80500D4 +:1074D000A07800F082FD8DF806002078012804D104 +:1074E0009DF80300401C8DF8030009A9684604F0CC +:1074F00060F800B1FFDF0020C0E72DE9FF4F8DB03D +:10750000FA49DDE91AB90600D1E902010396CDE98D +:107510000901507A117A9A4608441546C7B20DD02F +:107520000024F01D20F00700B04200D0FFDF2888C3 +:107530000399401C1FFA80F814B107E00124F0E71A +:1075400008F0FF0007F0F4FE00B1FFDF03993A46B0 +:1075500001EB0810C01C20F00301D5F81080039146 +:107560003CB9002008701FFA88F003F0F2FC00B16B +:10757000FFDF0399234601EB08000390A87A297ADC +:107580003A460844C1B203A800F071FD0398C01C3C +:1075900020F003000390697A00912B7AAA7A04B153 +:1075A000002001A906F025F900B1FFDFBDF80410A5 +:1075B0000398CDE900B90844C01C20F003001C99D1 +:1075C000CDE902103A4604B10020534605A906F061 +:1075D0009BFA00B1FFDFBDF8141003980844C01DEA +:1075E00020F007000E99821B03900A60002C35D111 +:1075F000C04ABF491160111D401E086001232C22A2 +:107600000BA9BD4806F076F800F0F1FC00211E221F +:10761000084602F053F8FAF72FFE00F034FFFEF7A9 +:10762000D7FD09AB00220521B4A0FBF7ECFA00B1AD +:10763000FFDF05F10C00FFF7EFF800B1FFDF4FF4BB +:107640007F71B04813F08FFCAE48012180F8F91328 +:10765000022180F8FA13062180F8FB1311B0BDE86F +:10766000F08F10B5A74CA078092800D3FFDF207851 +:10767000C0EBC00004EB001010F8041F21F0FF0164 +:107680000170417821F00701C91C21F018014170F7 +:107690000121E17010BD2DE9F04105460C4600279F +:1076A0000078052190463E46B1EB101F00D0FFDF69 +:1076B000287E58B1012810D0FFDF00BFA8F8006075 +:1076C0000CB1278066800020BDE8F08102270926E2 +:1076D0007CB1A88BA080A87F09E00327142644B1C1 +:1076E0006888A080286AE060A88C2082287F2072A9 +:1076F000E4E7A8F80060E6E700B5017895B001F08E +:1077000001018DF80210417801F001018DF803109C +:107710000178C1F340018DF804104178C1F34001B4 +:107720008DF80510017889088DF8061041788908D0 +:107730008DF8071081788DF80810C1788DF8091040 +:1077400000798DF80A003E208DF8000009A96846EE +:1077500003F02FFF15B000BD70B56A4CE07800282B +:107760001BD020780025C0EBC00004EB001040794E +:1077700000F00700011991F8F803401E81F8F803A2 +:107780002078401CC0B22070092800D12570A07854 +:10779000401CA07009F0B1FCE57070BD594890F82C +:1077A000FB03002800D05CE770472DE9F043554DFE +:1077B0009BB00026D5F8F40368B1FFF7EFFF00286F +:1077C00075D07022D5F8F41313F079FBFFF7C4FFDE +:1077D000C5F8F463EEE795F8F903002867D0FFF7E2 +:1077E00040FF0446444805F0B6FF606000B9FFDF83 +:1077F000606803F029FF88B12046FAF7B8F860788E +:10780000010706D520F00700401C6070FFF7A4FFB9 +:10781000D0E73948616805F0A7FFCBE736486168D3 +:1078200005F0A2FF01A800F05BFC00286CD1032149 +:10783000BDF8040006F001F98046BDF8040006F02A +:1078400062FA0746B8F1000F00D1FFDFD8F8040054 +:1078500010B10078FF2857D0FFF703FF04463846E1 +:10786000211D05F0B0FE00B9FFDFD4F8049089F8BF +:107870000060BDF804006080204600F0EAFE384653 +:1078800005F0CDFE00B9FFDF3B208DF81000BDF8FC +:107890000400ADF8120004A805F050FB0EA804F097 +:1078A0003CF96078010703D4C00607D409E02BE057 +:1078B00020F00700801C6070FFF74EFFC8F80490AE +:1078C00078E7D8F8040038B10178491C11F0FF01BD +:1078D00001709DD1FFDF6DE700221146384600F0B0 +:1078E0007AFB002894D1FFDF64E7000014B30100A5 +:1078F0000000002000060240B40700206E5246350A +:1079000078000000B80300201BB0BDE8F08310B57C +:10791000FC4CA0600868E060AFF2711001F031FE2D +:10792000607010BDF74900200870704730B50546FB +:107930004FF080500C46D0F8A41095B0491C05D1EA +:10794000D0F8A810C9430904090C08D050F8A01FAA +:1079500001F0010129704168216080680EE02B2050 +:107960008DF8000009A9684603F023FE00B1FFDF8F +:10797000012028700A982060BDF82C00A08028788B +:10798000002803D0607940F0C000607115B030BDB0 +:10799000F0B54FF080540746D4F8800095B00D46FE +:1079A0002B26401C0BD1D4F88400401C07D1D4F8FE +:1079B0008800401C03D1D4F88C00401C0BD0D4F8B4 +:1079C00080003860D4F884007860D4F88800B8600B +:1079D000D4F88C0016E08DF82C6069460BA803F0F3 +:1079E000E8FD00B1FFDF01983860029878608DF8FB +:1079F0002C6069460BA803F0DCFD00B1FFDF0198A5 +:107A0000B8600298F860D4F89000401C0BD1D4F80C +:107A10009400401C07D1D4F89800401C03D1D4F83E +:107A20009C00401C08D054F8900F28606068686083 +:107A3000A068A860E06816E08DF8006009A96846B3 +:107A400003F0B7FD00B1FFDF0A9828600B9868606B +:107A50008DF8006009A9684603F0ABFD00B1FFDFB7 +:107A60000A98A8600B98E86015B0F0BD30B5A64C38 +:107A70000546D4F8F40300B1FFDFC4F8F45330BD79 +:107A80003EB50546032105F0D8FF0446284606F01A +:107A90003AF9054604B9FFDF606818B10078FF289D +:107AA00000D1FFDF01AA6946284600F094FA60B9C8 +:107AB000FFDF0AE0002202A9284600F08CFA00B994 +:107AC000FFDF9DF8080000B1FFDF9DF80000411EB8 +:107AD0008DF80010EED260680199884201D1002033 +:107AE0006060894C94F8FA03022800D3FFDF94F811 +:107AF000FA03401CC0B284F8FA03012803D181487C +:107B0000407801F05DFD3EBD70B50446A1F57F40B3 +:107B100016460D46FF3800D1FFDF012E01D0FFDFF2 +:107B200070BD207820F00F00401D20F0F000503094 +:107B3000207000202076A5830120A07770BD70B54D +:107B400015460C460646FFF729FE90B1017821F054 +:107B50000F01491D21F0F0015031017046800121D3 +:107B6000017621680162A18881840577BDE87040B3 +:107B7000F2E53046BDE870401321FAF733BE70B528 +:107B800005460C46084609F03BFF08B1102070BDC1 +:107B90002846F9F747FC28B1284600F09DFE2070E2 +:107BA000002070BD43F2020070BD2DE9F04F87B098 +:107BB00005460020059053488946017811B10820F8 +:107BC00007B04CE54F4851494160284609F018FF7D +:107BD000002868D1484609F013FF002863D16F7A66 +:107BE0002B7AF818FF2870D82888FE286DD800B99D +:107BF0000A202880296909B94FF4B06129616A68AF +:107C0000B2B15478907804EB440420441478167987 +:107C100004EB440400EB44005479D27804EB4404B0 +:107C200006EB4606344402EB420204EB420406E053 +:107C300007EB470003EB430200EB42042046C7EB8F +:107C4000C7021044C3EBC3021044184486B206EBCB +:107C5000C60000EB400A04EBC40000EB40000090BB +:107C6000D82901D20920ABE7A87AB8422DD84FF025 +:107C70001208082F0DD8012B0BD807F0C4FC0746BB +:107C800009F0FAF93A1A297A687A521E0B189A42C0 +:107C900001DA404694E76F6883468846BFB13846AC +:107CA00009F0D5FE08B110208AE7B9787878014448 +:107CB00038780A180BEB0800904206D179793A79A6 +:107CC0001144FA781144884201D0072078E70098DF +:107CD0001FFA8AF387B20097CDE901642A4603A907 +:107CE0000020FFF70AFCDFF81C800399D9F8002078 +:107CF000D8F80400014491420AD90420C9F80010C0 +:107D00005EE7000018000020B80300208812002061 +:107D10000097CDE901641FFA8AF32A4604A9FFF708 +:107D2000ECFBDDE90301884200D0FFDF0498D8F8BE +:107D300004100844C8F80400C9F80000FF490120F5 +:107D400088F80000087005983AE72DE9F0470746E3 +:107D50000C46084609F054FE40B9384609F06EFE5C +:107D600020B9F81C20F00300B84202D01020BDE872 +:107D7000F087F3484FF00008817899B14178824646 +:107D8000C1EBC10100EB0115B4F8009015F8040F28 +:107D9000234600F00F000022294600F0F0F906000B +:107DA00004D013E0A4F800800520E0E797B1218813 +:107DB000494501D90C260DE02878234600F00F0034 +:107DC0003A46294600F0DBF9060005D00C2E01D01A +:107DD000A4F800803046CAE79AF801005446401CD7 +:107DE000C0B28AF80100092801D184F80180A07886 +:107DF000401EA070687800F0070101290BD002290D +:107E000003D0032918D0FFDFE4E7C006E2D4688876 +:107E1000FFF736FEDEE7CB48696805F0A5FC94F86D +:107E2000F903401CC0B284F8F9030128D2D1C64836 +:107E3000407801F0C5FBCDE794F8FB03401C8AF8BD +:107E4000FB03C7E770B50D46044609F0B5FD18B948 +:107E5000284609F0D5FD08B1102070BD29462046FE +:107E6000BDE8704007F09BBA70B5044615460E4653 +:107E7000084609F0A1FD18B9284609F0C1FD08B16E +:107E8000102070BD022C03D0102C01D0092070BD31 +:107E90002A463146204607F0A5FA0028F7D00520EB +:107EA00070BD70B514460D46064609F085FD38B91B +:107EB000284609F0A5FD18B9204609F0BFFD08B114 +:107EC000102070BD22462946304607F0AAFA002845 +:107ED000F7D0072070BD10B594B0044609F090FDAE +:107EE00010B1102014B010BD0F208DF8000009A9AA +:107EF000684603F05EFB0028F4D19DF82C0020704A +:107F0000BDF82E006080BDF83000A0800020E9E7B9 +:107F100070B505460C46084609F090FD20B93CB105 +:107F2000206809F06DFD08B1102070BDA08828B14F +:107F300021462846BDE87040FEF7A0B9092070BD73 +:107F400070B504460D46084609F036FD30B9601E8E +:107F50001E2814D8284609F02FFD08B1102070BD46 +:107F6000022C01D9072070BD04B9FFDF774800EB70 +:107F7000840050F8041C2846BDE870400847A4F16E +:107F800020001F28EED829462046BDE87040FAF7A9 +:107F9000BCB870B504460D46084609F031FD30B94D +:107FA000601E1E280DD8284609F006FD08B11020D5 +:107FB00070BD012C01D0022C01D1062070BD07201C +:107FC00070BDA4F120001F28F9D829462046BDE83D +:107FD0007040FAF709B905F099B9032803D00228CF +:107FE00003D001207047062070470320704710B56A +:107FF00094B003F0CFFA54484178806803F0C0FC95 +:10800000514801240C300178012916D130218DF816 +:108010000010C0788DF8020010B1012803D005E0EF +:108020008DF8024002E000208DF80200684604F05E +:1080300085FF10B109A803F070FD02208DF824001F +:108040008DF825008DF8260009A8FFF70DFA00B17C +:10805000FFDF8DF8244003208DF825008DF82600E1 +:1080600009A8FFF701FA002800D0FFDF3AE72DE961 +:10807000F0410646022012B101EB4200401DC7B29A +:108080003068C01C20F0030232601BBB2C483B460A +:108090000A21283809F081FB002408E00A2C11D2BB +:1080A000DFE804F005070509090B0B05050528485D +:1080B00004E0284802E0284800E0284809F08CFB4A +:1080C000054600E0FFDFA54200D0FFDF641CE4B2FC +:1080D0000A2CE3D3306800EB07103060BDE8F08174 +:1080E0002DE9F04395B081463A208DF82C00694681 +:1080F0000BA803F05EFA00B1FFDF43F20406002490 +:108100006D46DFF83C8032E02F19B87DC10706D0FC +:10811000400704D405EB4400C08800F0CEFB98F87B +:10812000FA0310B3B87D80071FD505EB4400C08863 +:1081300000F055FAC8B105EB440011E0080000203A +:10814000B8030020B40700201800002014B3010079 +:10815000391F0000F7840000E12F0000E9F0000063 +:10816000C188A9F80010002605E0641CE4B29DF85F +:108170000400A042C8D815B03046BDE8F0832DE910 +:10818000F041044600201880601E1D4616460F462A +:10819000052800D3FFDF05482A4600EB840031465E +:1081A00050F8043C3846BDE8F041184724B30100BC +:1081B0002DE9F0478A46984615460646032105F004 +:1081C0003CFC0446304605F0B0FD0C35AFB200254E +:1081D00081462E4604B9FFDFB9F1000F00D1FFDF61 +:1081E00004EB8A000189B94200D30125218CB942F0 +:1081F00002D2BAF1060F00D3012638EA050104D0F5 +:10820000817A41F0020181720BE038EA060108D060 +:10821000817A41F00401817214F8220F40F00400C9 +:10822000207005EA0600BDE8F0872DE9F047824698 +:10823000DDE90854174605F10C0099460E461FFA71 +:1082400080F800232A4639465046FFF7B1FF60B157 +:10825000B07800061BD424F8045C24F8029C504635 +:1082600005F063FD040008D106E0072F01D01120BE +:10827000D9E743F20400D6E7FFDF2D1D2046A9B25F +:1082800004F047FF00B9FFDF504603F0E5FA06EBC4 +:108290008700062F0289A2EB0801018103D2318CED +:1082A000A1EB080030840020BDE72DE9F04385B044 +:1082B0001E46DDE90D5491460F46DDF8308005F08D +:1082C00034FD60B309F10402694692B204F0BBFECA +:1082D00050B300980770BDF80800042800D2FFDFF3 +:1082E000002701983A46394607808770019803F0C5 +:1082F00075FB1EB1BDF80800001F3080B8F1000FFB +:1083000003D00198C01DC8F8000015B1BDF81000D9 +:1083100028808CB1288870B1039820600CE043F26B +:10832000020005B0BDE8F083072F01D01120F8E767 +:1083300043F20400F5E727600020F2E72DE9F04F53 +:108340000F46054687B016465088032105F075FB99 +:10835000040000D1FFDF4FF000098DF80C90A078E9 +:10836000400600D1FFDF042F53D3297841F30000EA +:10837000401C06D162786B789A424AD12278120763 +:1083800047D04FF0010B4FF00208142939DA4FF6AD +:10839000FF7A012933D0122902D0132931D11CE0F0 +:1083A0000C2F2ED1A17801F07F01012929D020784E +:1083B00020F00F00401C2070687860708DF80CB0C1 +:1083C000A888ADF80E00E888ADF810002889ADF84F +:1083D00012006889ADF8140016E0062F11D120783C +:1083E00020F00F0020707188012009F0A2FA8DF8AA +:1083F0000C80ADF80EA0A888ADF8100004E0062FA0 +:108400000AD09DF80C10B9B17088324603A9F9F76B +:1084100018FE07B0BDE8F08F207820F00F00207024 +:108420007188012009F085FA8DF80C80A888ADF8D4 +:108430000E00ADF810A0E7E70028EAD0768806A87D +:10844000CDE9000927464C46002306220421304688 +:10845000CDF80890FFF729FF00B1FFDF069805234C +:10846000042280F800B069784170A0F8028084800E +:108470000621CDE9001039463046FFF7D6FE002828 +:10848000C7D0FFDFC5E70020FE49024621F81020D3 +:10849000401C0828FAD3704770B50C46897821F043 +:1084A000FF01A170217821F00F012170012161707D +:1084B0000021616005F039FC050000D1FFDF28468E +:1084C00004F0BFFDF53820852046BDE8704000F07F +:1084D00010BB70B50D46032105F0AFFA040000D1C2 +:1084E000FFDFA07865F30600A07070BD70470146FD +:1084F000012009F01EBA3EB58DB20321284605F0D1 +:108500009CFA040000D1FFDF2078002220F00F0049 +:10851000207002208DF800004FF6FF70ADF80200C9 +:10852000ADF8040069462846F9F78BFD3EBD2DE9FC +:10853000F04705460C4600784FF0000901219246AD +:108540004F46B1EB101F00D0FFDF287E032809D073 +:10855000FFDF00BFAAF8007014B1A4F80090678094 +:10856000002060E6AE8B4FF0700906F10A0087B27A +:10857000D4B16888A080688B2081E680A889A9682A +:10858000001F80B28046024604F10A00C91D12F0A5 +:1085900051FC4645DED904EB0800A6EB08020A3080 +:1085A000296912F047FCD5E7AAF80070D8E72DE951 +:1085B000FC410F461C46164680460321089D05F0E7 +:1085C0003CFA010008D033463A464046CDE9004522 +:1085D000FFF72BFEBDE8FC8143F20200FAE770B51D +:1085E0000546A0F57F4086B0FF3811D0284605F03B +:1085F0008AFB040000D1FFDF2046694604F0E3FF58 +:1086000000B9FFDF019CB4F80500E41C052802D086 +:10861000012006B070BD2E460321284605F00DFA54 +:10862000050000D1FFDF2079122807D120880C280F +:1086300004D1A87800F07F00022806D0002306228B +:1086400004213046FFF7B4FDE3E7002306220521AD +:10865000F7E7F8B5024680689489938A30F8031FDB +:108660001C444588241F8C421ED1042D1DD0052D8D +:1086700029D0062D1ED0402D16D30E46144628466E +:1086800000F0D7F908280FD0207820F00F00401C08 +:1086900020F0F00010302070032020766583A68340 +:1086A000607840F008006070F8BDBDE8F840001D3B +:1086B00000F0CBB90093548813690A46011D204687 +:1086C000FBF7CCF9F8BDBDE8F840001D36E67FB5F4 +:1086D0000D460646032105F0B0F904003DD0207890 +:1086E00000F00F0001283BD0002003A9CDE90010C5 +:1086F000034602900C2205213046FFF7D6FD0028E4 +:1087000029D1039812210523017061781A46891C2A +:10871000417008214180298881806988C180A988A9 +:108720000181E98841810C21CDE9001021463046C4 +:10873000FFF77BFD00B1FFDFF0230022314601206F +:1087400009F05AF8207820F00F00401C2070607863 +:10875000801C6070002004B070BD43F20200FAE794 +:108760001120F8E77FB50D460646032105F065F9AF +:10877000040006D0207800F00F00012804D0082063 +:10878000E9E743F20200E6E7002003A9CDE9001083 +:1087900003460290062205213046FFF786FD002899 +:1087A000D9D103981321052301706178417002210A +:1087B000418085800621CDE900101A4621463046C9 +:1087C000FFF733FD00B1FFDF207820F00F002070AD +:1087D0000020C0E72DE9F84F0F468346032105F03E +:1087E0002CF90546584605F0A0FA80464FF0000ADD +:1087F00005B9FFDFB8F1000F56D1FFDF54E0404666 +:108800006946002204F082FD9DF800408146082C54 +:1088100000D3FFDF05EB840609F108003189062C3F +:108820000144318102D2298C08442884072C03D1C9 +:108830000AF1010000F0FF0AB07AC0070CD021460F +:10884000284600F0DDF838B9B07A032C20F001009A +:10885000B07258462ED0FFDFB07A810706D520F0DF +:108860000200B0722146584600F0DAF8062C1BD8F8 +:1088700095F82200410717D520F0040085F8220062 +:10888000002401E0E407002005EB8401887A420718 +:1088900006D520F0040088722146584600F0C0F842 +:1088A000641CE4B2062CECD37F1EFFB2A7D2504664 +:1088B000BDE8F88FFBF773F9CEE710B5032105F09B +:1088C000BCF8040000D1FFDF204600F012F9A078C8 +:1088D00040F08000A07010BD10B5032105F0ADF888 +:1088E000040000D1FFDF208D2321B0FBF1F0C0B2E6 +:1088F00010BD70B50D46032105F09FF8040000D1AE +:10890000FFDF062D00D9FFDF2946204600F078F86A +:10891000002805D004EB85018A7A42F001028A72B0 +:1089200070BD10B50446402801D2072010BD00F0EC +:1089300080F8082802D04FF4445010BD0021774839 +:1089400002E0491C082903D230F81120002AF8D18E +:10895000082903D020F81140002010BD042010BDCC +:1089600010B5402801D2072010BD00F062F8082899 +:1089700005D06A4A002122F81010084610BD0520D3 +:1089800010BD70B588B015460C00064606D02DB156 +:108990006088402804D2072008B070BD1020FBE793 +:1089A000218849B300F045F8082827D003AA06A972 +:1089B00005A88DE80700228804AB07213046FFF7A1 +:1089C00074FC0028E8D1BDF810202946059812F063 +:1089D00031FA2088BDF81010884204D9421A29447F +:1089E000039812F027FA05980090238862880721DF +:1089F0003046FFF7DCFDCFE70C20CDE70520CBE7C5 +:108A0000072903D0464A32F8112000E0028D00EB1E +:108A100081000089904201D20120704700207047F8 +:108A200010B5032901D0FFDF10BDBDE81040FBF7F2 +:108A300078B801460020394A02E0401C082803D2D9 +:108A400032F810308B42F8D170472DE9F0410F46D3 +:108A50008046014686B014463846FCF744FDC0B255 +:108A600008283CD10025ADF81450039560880321F7 +:108A700004F0E3FF060000D1FFDF00213046FFF7DE +:108A8000BFFF68B91722ADF8142003A8CDE900058F +:108A90000295002360881946FFF707FC00B1FFDF4D +:108AA000009405AA41463846039BFDF755FCC0B229 +:108AB00005281CD2DFE800F0031B13161300BDF8D5 +:108AC000140000280BD003990423CDE9000160882D +:108AD00000223146FFF7A9FB002800D0FFDF06B0D7 +:108AE000BDE8F081607840F010006070F7E7FFDFCC +:108AF000F5E710B504462021083012F034FA084892 +:108B0000002100BF30F8112004EB8103491C1A81B9 +:108B10000629F7D9208DA08410BD0000E4070020AD +:108B20003CB3010030B44FF0E02001234FF4006C5F +:108B30000021C0F880C11D02C0F880511C06C0F899 +:108B40008041E54A82F80014D21E82F80014E34AFC +:108B500082F80014E24A53609360C2F84011C2F8F0 +:108B60004411C2F84811C0F880C2C0F88052C0F861 +:108B70008042C0F800C1C0F80041136030BC7047AB +:108B800070B401204FF0E023C6024FF0000CC3F890 +:108B900080610402C3F880410506C3F88051D04AC1 +:108BA00050609060CF4801680029FCD1C2F840C1F4 +:108BB000C2F844C1C2F848C1C3F88062C3F8804219 +:108BC000C3F8805270BC70474FF0E0204FF4006152 +:108BD000C0F88012C910C0F880127047002804BF86 +:108BE000C1487047012804BFC0487047022804BF2D +:108BF000BF48704700B5FFDF002000BD08B5B84989 +:108C0000002298B101282FD002281CBFFFDF08BD29 +:108C10004FF48020C1F80803C1F84803B54802604A +:108C2000C1F84821B2480068009008BD4FF4803078 +:108C3000C1F80803C1F84803AF4B1A60C1F84021DE +:108C4000AE4BC1031960AE49C1F808034FF0E023F1 +:108C50000012C3F88001AB480260C1F84021C1F89E +:108C60000022A948027008BD4FF40030C1F8080383 +:108C7000C1F84803A5480260C1F844219B48006838 +:108C8000009008BD70B5DFF858C204260024012505 +:108C900058B1012840D002281CBFFFDF70BD9C4A9C +:108CA0004FF48020012B3CD144E0881E20F07F410E +:108CB0004FF48030CCF80803CCF84041CCF84403A2 +:108CC000CCF84015012B14BF002101218E4B5970A7 +:108CD0008B490D61DFF83CC2CCF800408E4C4FF060 +:108CE000020CC4F800C0DFF834C2CCF80060DFF832 +:108CF00014C23D32CCF80020C1F800524FF0E02CF5 +:108D00008A15CCF88022C1F80403CCF800210804AD +:108D1000834908601D7070BD824A4FF40030012BFA +:108D200008D0CCF80803C2F84041CCF84403C2F89C +:108D3000401570BDC2F84041CCF80403CCF84403A0 +:108D4000C2F8401570BD67480068704770B5764836 +:108D50000568774975480860614CD4F840010026E1 +:108D600001280AD1D4F8080310F4803F05D04FF44D +:108D70008030C4F80803C4F84061D4F844010128E5 +:108D80000DD1D4F8080310F4003F08D04FF40030A0 +:108D9000C4F80803C4F84461012007F0BEFBD4F80E +:108DA000480101280DD1D4F8080310F4802F08D011 +:108DB0004FF48020C4F80803C4F84861022007F08B +:108DC000ACFB5C48056070BD574810B50468584955 +:108DD000564808604C490878002808BF03201AD07C +:108DE000464A4FF000401060454AC00BC2F80803E5 +:108DF00003124FF0E02C0020CCF88031414B18607A +:108E0000C2F84001C2F8000208704A78002A1CBF6C +:108E10004870002001D007F080FB4648046010BD78 +:108E20004FF0E0214FF08070C1F8000270474FF022 +:108E3000E0214FF08070C1F8800270474FF0E021D0 +:108E40004FF40010C1F8000270474FF0E0214FF4DA +:108E50000010C1F8800270472949012008614FF0D5 +:108E6000E0210002C1F880027047410A43F609522E +:108E70005143C0F3080010FB02F000F5807001EBD5 +:108E800050207047430B48F2376C03FB0CF31B0C6C +:108E90004FEA432CC1F800C0DFF89CC003FB0C0371 +:108EA00026484CF2F72C5843400D10FB0CFC0CEB01 +:108EB000432303F580735B1213700A681044086043 +:108EC0007047194810B5046819491848086007F038 +:108ED00011FC1848046010BD0BE000E018E000E051 +:108EE00000B0004004B500404081004044B1004063 +:108EF00048B1004048B5004040B5004008F5014089 +:108F000000800040408500402800002044B500401B +:108F100008B00040048500400885004010850040EE +:108F200004F5014004B000401005024001000001BA +:108F30001805024014050240F7C2FFFF6F0C010044 +:108F400010B5EFF3108000F0010472B6EC484178E0 +:108F5000491C41704078012801D108F0EDF8002C3F +:108F600000D162B610BD70B5E54CE07848B9012576 +:108F7000E570FFF7E5FF08F0E7F820B1002008F002 +:108F8000C3F8002070BD4FF080406571C0F80453F5 +:108F9000F7E770B5EFF3108000F0010572B6D84C1A +:108FA000607800B9FFDF6078401E6070607808B9B3 +:108FB00008F0C6F8002D00D162B670BDD04810B5DB +:108FC000C17821B100214171C170FFF7E2FF00209B +:108FD00010BD10B5044608F0B7F8C949C978084073 +:108FE00000D001202060002010BD2DE9F05FDFF8E7 +:108FF00010934278817889F80620002589F80710B7 +:10900000064689F8085000782F4620B101280FD075 +:1090100002280FD0FFDF08F0A4F898B108F0A8F8F4 +:10902000A8420FD1284608F0A7F80028FAD047E058 +:109030000125F0E7FFF784FF08F086F80028FBD051 +:109040000225E8E701208407E060C4F80471AD4917 +:109050000D600107D1F84412AA4AC1F3423124320B +:109060001160A8494FF0020B34310860C4F804B312 +:10907000A060DFF894A2DAF80010C94341F30011B0 +:1090800001F10108DAF8001041F01001CAF80010EF +:1090900000E020BFD4F804010028FAD0284608F0E8 +:1090A0006BF80028FAD0B8F1000F05D1DAF80010FB +:1090B00021F01001CAF80010C4F808B3C4F8047114 +:1090C00099F807004C4670B1307860B908F03CF868 +:1090D000064608F027FA6FF0004116B1C4E9031004 +:1090E00001E0C4E9030115B12771BDE8F09F01203B +:1090F0002071BDE8F05F00F0E1B810B5040000D1C8 +:10910000FFDF4FF080414FF0FF30C1F8080300222D +:10911000C1F80021C1F80421C1F80C21C1F81021C7 +:1091200008F018F828B176490120C8704878401C2A +:1091300048702046BDE8104057E72DE9F041012571 +:10914000AF077D616E4CE079F0B1012803D0217A40 +:10915000401E814218DA07F0F7FF064608F0E2F9F0 +:10916000E179012902D9217A491C21720EB12169C4 +:1091700000E0E168411A022902DA11F1020F0EDC67 +:109180000EB1206100E0E060FFF7DAFE07F0DCFFDF +:1091900010B13D61A57000E0257000202072BDE88F +:1091A000F0812DE9F05F5948D0F800B0574A58498E +:1091B000083211608406D4F8080110B14FF001089C +:1091C00001E04FF00008D4F8000100B10120814611 +:1091D000D4F8040108B1012600E00026D4F80C01FF +:1091E00000B101208246D4F8100108B1012700E047 +:1091F000002748EA090126EA010020EA0A00B843EC +:1092000000D0FFDF0025B8F1000F04D0C4F80851EA +:10921000012007F079FFDFF8E880B9F1000F13D0E3 +:10922000C4F8005198F8050020B188F805500020D6 +:1092300007F06AFF98F8000030B107F085FF18B119 +:10924000012088F8020020610EB1C4F80451BAF17F +:10925000000F0AD0C4F80C5198F80200464600B935 +:10926000FFDFB5703570FFF794FE37B1C4F81051C9 +:1092700098F8040008B1FFF760FF2449091DC1F800 +:1092800000B032E770B51E4DE87808B907F058FF16 +:1092900001208407A061A87858B100BFD4F80C0160 +:1092A00020B9002007F068FF0028F7D10020C4F89B +:1092B0000C014FF0FF30C4F8080370BD2DE9F041F8 +:1092C0001926B507C5F808630124AC610020C5F86C +:1092D0000001C5F80C01C5F8100107F035FF084F73 +:1092E00010B1BC702C6100E03C70FFF729FE05490D +:1092F000B87920310860C5F804636C614FE700005D +:109300002C0000201805004010ED00E01005024080 +:109310000100000110B50D2000F06FF8C4B26FF02D +:10932000040000F06AF8C0B2844200D0FFDF3A497E +:109330000120086010BD70B50D2000F048F8374CD2 +:109340000020C4F800010125C4F804530D2000F0EA +:1093500049F825604FF0E0216014C1F8000170BDAC +:1093600010B50D2000F033F82C4801214160002198 +:10937000C0F80011BDE810400D2000F033B82848B7 +:1093800010B5046826492748083108602349D1F8F8 +:109390000001012804D0FFDF2148001D046010BD3A +:1093A0001D48001D00680022C0B2C1F8002107F06E +:1093B000D4FFF1E710B51948D0F800110029FBD00F +:1093C000FFF7DDFFBDE810400D2000F00BB800F006 +:1093D0001F02012191404009800000F1E020C0F807 +:1093E0008011704700F01F02012191404009800068 +:1093F00000F1E020C0F880127047002806DA00F083 +:109400000F0000F1E02090F8140D03E000F1E020DF +:1094100090F800044009704704D5004000D0004097 +:10942000100502400100000110B5202000F075F881 +:10943000202000F07DF84449202081F800044349B1 +:1094400000060860091D42480860F7F75BFF3F49C6 +:10945000C83108603F48D0F8041341F00101C0F85A +:109460000413D0F8041341F08071C0F80413364996 +:1094700001201C39C1F8000110BD10B5202000F0FA +:109480004CF8324800210160001D01602F4A481E3F +:10949000E83A10602F4AC2F808032C4BC833196011 +:1094A000C2F80001C2F860012B490860BDE8104015 +:1094B000202000F03DB825492848EC390860704765 +:1094C00022492648E8390860704770B51F4A80690C +:1094D000E83A224911601F49D1F800610023204D6C +:1094E0001D4A5C1E1EB1A84206D300210FE0D1F830 +:1094F000606186B1A84209D2C1F80031C1F860317B +:109500001460BDE87040202000F012B81168BDE87A +:10951000704011F05ABDFFDF70BD00F01F02012145 +:1095200091404009800000F1E020C0F880117047B0 +:1095300000F01F02012191404009800000F1E0206D +:10954000C0F880127047000020E000E000060240F2 +:1095500084120020000002400004024001000001CB +:1095600000C001004FF0E0214FF00070C1F8800111 +:10957000C1F88002384B802283F80024C1F8000132 +:10958000704700B502460420344903E001EBC003F4 +:109590001B792BB1401EC0B2F8D2FFDFFF2000BD07 +:1095A00041F8302001EBC00100224A718A7101228A +:1095B0000A7100BD294A002102EBC0000171704709 +:1095C00010B50446042800D3FFDF244800EBC40490 +:1095D0002079012800D0FFDF6079A179401CC0B25A +:1095E000814200D060714FF0E0214FF00070C1F86F +:1095F000000210BD2DE9F0411948056818491948C5 +:10960000083108601448042690F80004134F4009FC +:10961000154C042818D0FFDF16E0217807EBC100B5 +:109620000279012A08D1427983799A4204D0427999 +:10963000827157F8310080472078401CC0B22070FA +:10964000042801D300202070761EF6B2E5D204482B +:10965000001D0560BDE8F08119E000E0F40700207E +:109660001005024001000001400000200F4A12686E +:109670000D498A420CD118470C4A12680A4B9A428B +:1096800006D101B507F022FFFFF715FFBDE8014045 +:10969000074909680958084706480749054A064B1B +:1096A0007047000000000000BEBAFECA980000200B +:1096B000040000208811002088110020F84B586019 +:1096C00019721A80C90011F04EBC00210180704748 +:1096D0004FF6FF720280032008F02BB970472DE986 +:1096E000F04F0E46017804464FF0010A0AFA01F0E5 +:1096F00047F2FF1100EA01086168154697B0088833 +:10970000A0F57F42FF3A06D0B8F1000F07D047F22C +:10971000FE12104203D0012017B0BDE8F08F40EADE +:10972000080008804FF00009A5B185F80090237863 +:109730000027052003220221DFF864B3102B75D225 +:10974000DFE803F0740D131C2F4A515A31A5A1759F +:10975000A9F1F0EF20780B28E9D00420DCE729708C +:10976000A089A5F8010032801DE104212970A1899A +:10977000A5F80110E189A5F8031082E00620287001 +:10978000A089A5F80100E089A5F80300208AA5F8C2 +:109790000500A28AE81DA16911F04CFBA08AC01D3A +:1097A0006FE0082129702178082901D11021297042 +:1097B000A189A5F80110E189A5F8031030806A1D80 +:1097C000694604F1100005F02CFE00287ED1308897 +:1097D0009DF80010084454E00A202870A089A5F8DC +:1097E00001003280AAE00C212970A189A5F801109E +:1097F000E189A5F80310B7E0A2890AEB420081B223 +:109800003088884262D3052960D30E20287000205A +:1098100008E0236905EB400C33F81030401CACF82D +:10982000013080B29042F4D33180BCE0CAE09BF8B2 +:1098300009005A46002873D0401E5072227BDBF884 +:109840000400236900EBC205AA882868D3F800C089 +:109850000244A2F1080042F808CC5A6842608DF830 +:1098600000108DF8019028680290A888ADF80400D7 +:1098700000216846FBF776FCA5F80490002E01D085 +:10988000484630808FE0287840F0800129702878A1 +:1098900040F040012970287820F03F0012302870F5 +:1098A000A189A5F80110E289E81C216911F0C2FA2A +:1098B000E089C01C3080287841063FD5000672D56B +:1098C0008DF800A08DF80190308800E026E0001DA2 +:1098D000ADF804000295E189E81C08440390001DDE +:1098E00004909BF808008DF8140000216846FBF7EF +:1098F00039FC074630880C303080022F01D007B386 +:1099000063E09DF81420DBF804109BF808305846FB +:1099100001EBC2019A4201D28A882AB1042754E09D +:1099200030E02BE022E00DE0427A521C8BF8092057 +:109930000D6030888880A6F8009046E06168A089B4 +:10994000888030E0287820F03F0016302870A08909 +:10995000A5F80100E089A5F80300228A681D616965 +:1099600011F068FA208A401D3080E7E7287820F05F +:109970003F0018302870207B687055E760680188C8 +:10998000090401D4052720E0C088A189884201D0BC +:1099900006271AE01E202870A6F800A0606801883B +:1099A00021F400410180B8F1000F0ED0BBF8000097 +:1099B000002283000320A16807F01EFF6168207861 +:1099C000887007E0A6F8009003276068018821EA04 +:1099D0000801018038469FE62DE9FF4F97B00C46FD +:1099E000249E70B117280CD83288A2F57F43FF3B24 +:1099F00007D02278530601D4120604D508201BB0E4 +:109A00008BE60720FBE74FF000098DF800908DF8FA +:109A100001902278831E02F03F0CA0F1010A611C24 +:109A20004D461FFA8AF702AABCF1200F79D2DFE86F +:109A30000CF089107861786C78AA78CD78F778FC8A +:109A400078F478F378F2787878F178F078EF78EE47 +:109A50007889052876D104208DF80000B0788DF83B +:109A600004006088ADF8060020798DF80100607868 +:109A700000F03F000C282BD00ADCA0F102000928DE +:109A800060D2DFE800F0145F175F1C5F1F5F2200E9 +:109A9000122826D006DC0E281DD01028DAD11DE0B1 +:109AA0001408002016281FD01828D3D11FE03078C2 +:109AB000800701E030784007002843DA37E130784A +:109AC0000007F9E73078C006F6E730788006F3E75C +:109AD00030784006F0E730780006EDE73088C005C2 +:109AE000EAE73088C004E7E730888004E4E730889C +:109AF0004004E1E73178890724D50328AAD105205D +:109B00008DF80000B4F80100D2E031784907F3D5B0 +:109B1000062817D3617898B2012903D0022999D178 +:109B200002E01FE1022700E0102706218DF8001057 +:109B300061788DF80610ADF80490A11C904607F1ED +:109B400002091BE097E000BF31F8022BA0F1020AE6 +:109B5000A8F800208B463A4608F1020011F06AF995 +:109B600008EB070202F10208BDF80420AAEB070087 +:109B7000521C0BEB070180B2ADF804208145E3D9FC +:109B8000002878D1D3E03078000774D507208DF80D +:109B900000001FFA8AF1ADF80490601C0DF1060276 +:109BA0000FE000BF30F8023B22F8023B30F8023BE6 +:109BB00022F8023B091FBDF8043089B25B1CADF8E6 +:109BC00004300429EED2002955D1B0E03178C9061D +:109BD00051D502284FD308208DF80000ADF806902B +:109BE00061789BB28DF80410A01C0CE0078822F865 +:109BF000047B871C80C25B1ABDF8067008447F1C7A +:109C00009BB2ADF806709942F0D9A3BB8FE070E02B +:109C100075E065E04FE042E01DE012E005E0FFE79F +:109C20003078800627D5092003E03078400622D519 +:109C30000A208DF80000B088ADF80400ADF8067079 +:109C400007E03078000616D50B208DF80000ADF83F +:109C5000047002916BE03188C9050CD502287FD3CE +:109C60000C208DF8000099B2ADF8069063788DF85D +:109C70000430A01C10E073E0078822F8027B4788BC +:109C800022F8027B071D80C2C91ABDF8067018446D +:109C90007F1C89B2ADF806708B42EDD993E731880D +:109CA000C9045DD501285BD10D208DF80000B08876 +:109CB000ADF804003BE03188890451D505284FD325 +:109CC0000E218DF80010B188ADF80410B4F803101F +:109CD000401FADF80800601DADF80610039026E0A7 +:109CE000318849043CD501283AD10F208DF8000075 +:109CF0001DE03188090433D4B4F80110F180032841 +:109D00002ED3217801F03F011B2925D011218DF898 +:109D10000010318841F40041A6F80010B4F8011099 +:109D2000ADF80410C01EADF80600E01C02902078CB +:109D300000F03F001B2809D01D2807D003201A99E6 +:109D400007F0F7FD308800F400403080684619992C +:109D5000FBF708FA284652E610218DF80010DDE7DF +:109D60000725F7E70825F5E700B597B0032806D1E2 +:109D70008DF80000019100216846FBF7F3F917B058 +:109D800000BD00002DE9FF4F8DB09346DDE91A5666 +:109D9000DDF8749004464FF0000A082A06D0E06906 +:109DA00001F02CF858B110203070BCE0288809214F +:109DB00040F01000288089F80010022717E0E169C0 +:109DC00001208871E2694FF420519180E169887225 +:109DD000E06942F601010181E16900208873288869 +:109DE00040F020002880112089F8000004273078F6 +:109DF00009900A20307004F1180009F102080225C8 +:109E00000B9001F063FA002066E000BFBBF1100F79 +:109E100006D1022D04D0A8EB0A00BDF80C20428028 +:109E2000BDF80E001099884203D9F649097A0E91BF +:109E300004E003D1099909B131701FE0A8F80000CE +:109E40001C980088A0EB0500A0EB070083B2C7F1C7 +:109E5000FF00984200D203460E980AAA08EB0701B9 +:109E60008DE8070094F82010BDF80E00002201F0E4 +:109E70009AFA307030B1C0B2832858D0BDF80E00C5 +:109E800020833DE0089828B1DE48006800790A2860 +:109E90002BD335E0BDF82800C11901F0FF0A022DCF +:109EA0000ED099F80110514503D1BDF81820824217 +:109EB00008D0D4488A4600680178032908D021E0F8 +:109EC00089F801A0CF4800680178042906D008E08D +:109ED00000790A2816D20120089006E0BDF80E107D +:109EE000818005EB0A00D04485B203AA0E990B9835 +:109EF00001F0EFF920B91C980088401BB84285DAC0 +:109F0000022D0BD0BBF1100F04D1A8EB0A01BDF854 +:109F10000C0048801C98058000203070B94800680B +:109F20000078032803D0002011B0BDE8F08F022094 +:109F3000FAE72DE9F0410546406B1346002758B378 +:109F4000491F8EB2698FA1F57F42FF3A05D04218B2 +:109F500092881144891D8CB200E00024A1192A8F37 +:109F60000831914216D82044B3F8011020F8021BA2 +:109F7000B3F8031020F8021B324620F8026B591D7B +:109F800010F058FF6C87696B00202144B61D3144E6 +:109F9000088002E0092700E083273846BDE8F08109 +:109FA00010B50B88048F9C420CD9446BE0180488D0 +:109FB00044B1848824F40044A41D23440B80106021 +:109FC000002010BD822010BD2DE9F04788B000258B +:109FD000904689468246ADF81050072745E0039821 +:109FE00006888088000440D4A8F8006005A800977F +:109FF000CDE901504FF4007300224946304601F08C +:10A00000D2F9040038D1BDF81000ADF8180003985B +:10A0100004888188B44214D10A0412D4CDE90057CF +:10A0200021F40041029541F480434288494620468C +:10A0300000F0C8FF04000BD10398818841F400416F +:10A04000818003AA06A95046FFF7AAFF0400DED0CC +:10A05000CDE9005703980295BDF81430008800221E +:10A06000494600F0AFFF822C06D103AA04A950464E +:10A07000FFF796FF0400B2D0ADF8105004E003984B +:10A08000818821F40041818003AA04A95046FFF78A +:10A0900087FF0028F3D0822C03D0204608B0BDE80B +:10A0A000F0870020FAE730B50446406B97B00025F2 +:10A0B00070B10B208DF80000208FADF80800606BA8 +:10A0C0000391019000216846FBF703FE8DF80050D4 +:10A0D0004FF6FF7065636087258717B030BD2DE9A7 +:10A0E000F041044686B00E46616B00200C9D174679 +:10A0F00000292AD0012B28D12A4631462046FFF7D5 +:10A1000063FF002821D1002F1FD0A046344600262F +:10A11000ADF8106007270EE00398008828800398A8 +:10A120000296811DCDE90017838842880088214668 +:10A1300000F048FF30B903AA04A94046FFF730FFFA +:10A140000028E9D0822800D1002006B026E72DE9BA +:10A15000F0411546DDE906644A1D378892B2974200 +:10A1600001D206201AE73280172204F8012B0A4692 +:10A17000208065801946201D10F05CFE00200DE750 +:10A1800000220280C262831D0263C36142634FF6F4 +:10A19000FF734387028780F8201070474FF6FF72E5 +:10A1A0000280042007F0C5BB30B597B00D460446C9 +:10A1B000FFF779FF208E48B101208DF80000E06A9A +:10A1C000CDE9010500216846FBF783FD0020E06230 +:10A1D000206382E70146002009880A0700D5012094 +:10A1E00011F0F00F01D040F00200CA0501D540F097 +:10A1F00004008A0501D540F01000490501D540F062 +:10A2000020007047200800202DE9FF4FA7B01F460F +:10A21000349E299D379C5FEA000817D028784106B4 +:10A2200010D400F03F011E290AD0218811F4FE6FDE +:10A230000CD13A88172A09D3A1F57F42FF3A05D0FD +:10A24000010606D500F03F00122802D004202BB0F2 +:10A250006BE6FE4928984FF0000908728DF81090BF +:10A260008DF834900DAA0A60359A4A60ADF81490C2 +:10A27000ADF890902878032200F03F038646711CC9 +:10A2800004F1180CCB464FF0040AA8F10500CDF8F4 +:10A2900098C01F2B7DD2DFE803F07C7C107C1C7CF7 +:10A2A000867CEF7CEE7CED7CEC7CEF7CEB7C7C7C3C +:10A2B000EA7CE97C7C7C7C7CE800B8F1030F02D06E +:10A2C0008DF810A0EFE232701720A6F801003A8056 +:10A2D000BEE2B8F1050FF3D1B5F801002083ADF867 +:10A2E0001400B5F80310618300287DD088427BD824 +:10A2F00084F808B0A4F806B04FF6FF706084269882 +:10A3000000F0E4FF05203070B01C00904FF0020A0E +:10A3100008AA2899269800F0DCFF00287ED19DF835 +:10A320002600012803D002207070102002E00120D6 +:10A33000707002208346002201A909A805F071F877 +:10A3400030BB9DF80400834522D13A88801CA2EBE3 +:10A350000A0181421CDB0098BDF822100AF1020AB2 +:10A360000180009909A8891C0A46009101A905F0FD +:10A3700058F89DF80400009908AA014450441FFAB7 +:10A3800080FA00912899269800F0A3FF0028D2D0E7 +:10A3900000E069E2BAF1020F40D0A7F800A057E24E +:10A3A0008DF8100054E2B8F1070F89D3B5F8010019 +:10A3B0002083ADF81400B5F803106183A0B1884282 +:10A3C00012D84FF0010A84F808A0B5F80500E08023 +:10A3D00000202073E06900F011FD90B9E16981F877 +:10A3E00006A04FF4205100E078E0E26942F6010057 +:10A3F0009180E16981F80AA0E1690881E1690020A2 +:10A400008873A8F107006084E81D6062269800F058 +:10A410005DFF0720307006F1010A00E06FE00020C8 +:10A420004FF0010BADF8220018E000BFBBF1010FA7 +:10A430000CD0E069807901281FD03AF8021C00BFD7 +:10A440000BF102002AF8021B1FFA80FBBDF8221054 +:10A450000BF102002AF8021B1FFA80FB08AA2899B8 +:10A46000269800F036FF58B10FE0DAE16BE10AE11F +:10A47000AEE0D2E17BE05AE01EE0BDF82010DFE75D +:10A480003988A1EB0B000428D0DABBF1010F36D0DC +:10A49000E069807901280CD0BDF82010A1F57F403B +:10A4A000FF3806D03AF8021CAAF800100BF102009F +:10A4B000B1E1BDF82010F7E7B8F1070F03D0B8F10C +:10A4C000150F7FF4FDAEB5F801102183ADF814101F +:10A4D000B5F80320628309B1914201D901205FE7F9 +:10A4E00001212172A4F806B084F80CB0B8F1050F70 +:10A4F00007D0C0B2691DE26904F074FF08B10A20F8 +:10A500004EE74FF6FF70608404A824A9CDE900103F +:10A51000CDE902762878002300F03F0220462899F2 +:10A52000FFF730FC8146208BADF8140090E1B8F1C4 +:10A53000030FC6D14020ADF89000B5F8010020838C +:10A54000ADF81400289ACDE900210AAB02933988AE +:10A550000022491E8BB294F8201000F024FF8DF8E1 +:10A56000100058BB0B203070BDF828002EE0B8F169 +:10A57000050FA6D18020ADF89000B5F8010020832A +:10A58000B5F803206284ADF81400B2F5007F01D95C +:10A59000072005E742F47C426284289BCDE9003124 +:10A5A0000DF12C0CCDF808C03988491E8BB294F8F7 +:10A5B000201000F0F8FE8DF8100018B18328B5D1F6 +:10A5C0000220BEE00D203070BDF82C00401C22E1BE +:10A5D0004FEADE1000EB400002EB8000404505D959 +:10A5E0005FEA4E607FF56CAE584614E1B5F801C0E5 +:10A5F000ADF814C02978490608D505218DF8341026 +:10A600002978090605D58DF834B031E106218DF899 +:10A610003410E91C289BA8EB000ACDE90013CDF803 +:10A6200008B009911FFA8AF394F8201000226046BE +:10A6300000F0C8FC8DF810008DF834B02978490678 +:10A6400010D52088C00509D5208B01E02008002006 +:10A65000BDF81410884201D1C4F824B058468DF8D2 +:10A6600010B0D8E0832801D14FF002094FF4807078 +:10A67000ADF89000BDF814002083A4F822A009983A +:10A6800060621320C5E0B8F1050FFFF419AEB5F80C +:10A6900001C0ADF814C0218F41B3A1F57F42FE3A4D +:10A6A00024D007218DF83410289A6B1DCDE9003293 +:10A6B00080B2CDF808B040F40043DA46B5F8032084 +:10A6C00094F82010604600F07DFC4FF400718DF886 +:10A6D00010008DF834A0ADF89010832810D0E8B1A8 +:10A6E000218FA1F57F40FE3807D0DCE00A218DF8EC +:10A6F00034104FF6FE712187D6E7A4F838A0A7E002 +:10A700002A4641462046FFF714FC8DF8100008B198 +:10A71000832848D1BDF81400208351E72A464146DA +:10A720002046FFF706FC8DF81000E0BB618F606BE0 +:10A73000CDE9007643185A88998833F8060BFFF75D +:10A7400006FD814684E095F801A0B8F1020F7CD1A6 +:10A750005FEA0A0002D0BAF1010F76D108208DF825 +:10A76000340005A800908DF838A094F820105346C6 +:10A7700000222046FFF7B3FC8DF839008DF83AB07F +:10A7800050B9BAF1010F12D0BAF1000F04D1218FE4 +:10A79000A1F57F40FF380AD0208F40B18DF834B04A +:10A7A0004FF4806000E053E0ADF890000DE00DA89C +:10A7B0003599FBF78EFA81464FF480608DF834B0FE +:10A7C000ADF89000B9F1020F06D0FD48006880791D +:10A7D00028B18DF8100043E0A4F818A038E0B9F1D2 +:10A7E000000F03D081208DF8100043E005A80090F1 +:10A7F00094F82010534601222046FFF770FC8DF894 +:10A80000100020463699FFF74EFC9DF81000F8B96D +:10A8100019203070012038801AE006208DF81000D1 +:10A8200041E02078000723D5B8F1010F20D109209D +:10A830008DF83400A088ADF838000420369907F070 +:10A8400078F80820ADF8900000E011E0A7F800B01B +:10A850009DF8340020B10DA83599FBF73AFA8146EE +:10A86000B9F1000F1CD005E05FEA4E607FF528AD1E +:10A870004FF004092088BDF8901008432080BDF8EF +:10A88000900080050AD5218FA1F57F40FE3805D1C3 +:10A890002998E062A4F830804FF003094846D6E4D6 +:10A8A0009DF8100058B10120307028787070BDF804 +:10A8B000140070809DF810003071052038802088C9 +:10A8C000BDF8901088432080E8E72DE9FF4F01781C +:10A8D000A5B080464FF0010B0BFA01F04FF60901CD +:10A8E000349C0840ADF86C0021884FF00009A1F5B8 +:10A8F0007F42FF3A02D028B1080703D5012029B0D2 +:10A90000BDE8F08F289F4FF0000A04A887F800A048 +:10A910002799269A55460988ADF87C10A8498DF8E4 +:10A9200068A00A728DF810A008603298486098F804 +:10A930000000012830D0022809D0032876D13878C9 +:10A9400020F03F001D303870B8F80400A08098F85F +:10A950000000022804D1387820F03F001B30387006 +:10A9600021AAF91C07208DE80700BDF87C0094F8A7 +:10A970002010C01E83B2B8F80400002200F013FDBE +:10A980000028DBD1B8F80400A7F80100BDF8840066 +:10A99000C01CADF87C005FE198F805108DF86810D8 +:10A9A00098F804004FF40079012802D00228C5D19C +:10A9B00033E1208808F1080600F4FE60ADF86C0071 +:10A9C00010F0F00F1BD010F0C00F05D03088228B94 +:10A9D000904201D005257DE189B9B078C0070ED03D +:10A9E000B2680720CDE90020CDF808A0F388B2882E +:10A9F00094F82010308800F0E5FA00286FD12899EB +:10AA0000BDF86C00491C802845D006DC10280ED00B +:10AA100020280CD0402891D122E0B0F5807F5FD073 +:10AA200048457DD0B0F5806F88D1CBE029E1C006E4 +:10AA300001D5082000E0102081460420ADF814A0C4 +:10AA40001BAA8DF8100000921FA81AA90397CDE940 +:10AA5000011033884A4607212046FFF793F992E018 +:10AA60009DF868004FF00A09002894D121AA072018 +:10AA70008DE80700BDF87C0094F82010401E83B2DA +:10AA8000208B002200F08FFC8DF868000B203870BE +:10AA9000BDF8840019E09DF868004FF00C0900280B +:10AAA0001CD123AA07208DE80700BDF87C00628C2A +:10AAB000401E83B294F82010208B00F074FC8DF8B7 +:10AAC00068000D203870BDF88C00401CADF87C008B +:10AAD00004208DF81000208BADF81400BCE057E086 +:10AAE0003188208B814253D19DF868104FF01209B4 +:10AAF000002918D1616A81B1B178C90748D0B3681B +:10AB00000722CDE90032CDF808A0F388B28894F886 +:10AB1000201000F057FA8DF868001320387000E01C +:10AB200002E0ADF87CB097E0B6F800C0208B844519 +:10AB30002ED19DF868004FF016090028606B08D0F0 +:10AB4000E0B34FF6FF7000215646ADF808A0019023 +:10AB500027E060B1B178C9071AD1618F43181FA8E7 +:10AB6000CDE900075A88998833F8060B09E0B078D8 +:10AB7000C0070DD01FA8CDE90007B288F188604654 +:10AB8000B368FFF7E4FA050066D0062D7AD03FE0FF +:10AB900005253DE0019021AA02A92046FFF700FA11 +:10ABA0000146628FBDF80800824201D00029F1D031 +:10ABB000608F616B08440680019860874CE000005C +:10ABC000200800209DF868004FF0180940B1208B44 +:10ABD000C8B13088208320463399FFF764FA3BE000 +:10ABE00004F118000090237E94F8201001222046E2 +:10ABF000FFF775FA8DF868000028ECD1192038703D +:10AC0000ADF87CB0E7E7052520463399FFF74BFA0E +:10AC10009DF81000032857D05CE0208800F40070F5 +:10AC2000ADF86C0048452CD1208FA0F57F41FE394E +:10AC30007FF4D0AED8F808004FF0160948B1606331 +:10AC4000B8F80C1021874FF6FF716187A0F800A0BB +:10AC500002E04FF6FF702087BDF86C0030F4FE6113 +:10AC600016D0782300220420339906F0C5FD98F809 +:10AC70000000A0702088BDF86C10084320800AE016 +:10AC800000E006252088BDF86C108843208021E074 +:10AC90002188814321809DF8100028B15F484168D8 +:10ACA00004A8FBF716F805469DF8680090B187F8F0 +:10ACB000019087F800B0208B78809DF8680038718B +:10ACC0000520ADF87C0005E05448416804A8FBF776 +:10ACD00000F80546208810F4FE6F22D1208E00B3C4 +:10ACE0002799289B01AD0988ADF87C10DDE9321267 +:10ACF000009385E816001FABE26A2699FFF784FAF5 +:10AD0000054603280DD08DF810B0E06A0590339801 +:10AD10000690002104A8FAF7DCFF00B10546A4F86C +:10AD200030A02798BDF87C1001802846E7E500B5E3 +:10AD300097B0042807D102208DF80000019100216E +:10AD40006846FAF7C6FF17B000BD70B5334C0378FC +:10AD500000222168012B02D0022B44D129E00B787C +:10AD60000BB1042B03D10A712268032111702168F1 +:10AD7000062582880B7905EBC303CA522168082394 +:10AD80000A250A7903EBC2021144C2880A802168AD +:10AD900002890B7905EBC303CA52418920680C2351 +:10ADA000027903EBC202815220680179491C0171CA +:10ADB0001DE00A7482888A802168C288CA8022685D +:10ADC00001891181226841895181C1682068C1606F +:10ADD0006168FAF77EFF0146022806D02068007CF1 +:10ADE000002801D119B1812070BD832070BD0020E1 +:10ADF00070BD406B002800D0012070478178012988 +:10AE000009D10088B0F5205F03D042F601018842E5 +:10AE100001D1002070470620704700002008002064 +:10AE200010B58B7883B102789A4205D10B885BB15B +:10AE300002E08B79091D4BB18B789A42F9D1B0F8B9 +:10AE400001300C88A342F4D1002010BD812010BD38 +:10AE500007282BD012B1012A2CD103E0497801F048 +:10AE6000070102E04978C1F3C201052922D2DFE8D7 +:10AE700001F0031D081017000AB1032070470220DB +:10AE80007047042812D0052810D006280ED058B1DB +:10AE90000EE005280AD0062808D0022808D003E0D2 +:10AEA000062803D0032803D00520704700207047F0 +:10AEB0000F2070478120704710B513880B800B78E6 +:10AEC0001C061FD5FE4CA47A844204D843F010001F +:10AED0000870002010BD94682478C44064F3041303 +:10AEE0000B701378D17803F0030341EA032140F299 +:10AEF0000123B1FBF3F403FB1411926800FB012062 +:10AF0000401C10BD906810BD37B5BDF8041011800D +:10AF10009DF8045029061BD5E94901239468897AD4 +:10AF2000814209D8FE280FD1E80602D58B405B1E6E +:10AF300000E00023237007E0217883409943C5F3A4 +:10AF40000013834019432170107820F01000107016 +:10AF50003EBD2DE9F0410746C81C0E4620F0030017 +:10AF6000B04202D08620BDE8F081082A01D90E2027 +:10AF7000F9E7D34D002034462E60AF802881AA72B5 +:10AF8000E8801AE0E988491CE980810614D4E17858 +:10AF900000F0030041EA002040F20121B0FBF1F291 +:10AFA00001FB1201206800F0E3FA2989084480B20D +:10AFB0002881381A3044A0600C3420784107E1D44D +:10AFC0000020D0E72DE9FF4F85B01546DDE912B628 +:10AFD0008046994623F4404700F0BAFA04000BD0AB +:10AFE000207800060AD5B648817A0698814205D8AD +:10AFF000872009B0BDE8F08F0120FAE722466946B4 +:10B000000698FFF759FF824600208DF80400072EAE +:10B0100018D0012221463046FFF71AFF0028E8D158 +:10B02000207840060ED502208DF80400ADF8088087 +:10B03000BDF80000ADF80C50ADF80A00ADF80E7088 +:10B04000CDF810B05FEA094004D500273D46B84668 +:10B0500001260CE02178E07801F0030140EA0120AC +:10B0600040F20121B0FBF1F2804601FB12865FEA5B +:10B07000494009D5B04507D1A178207901F00301F5 +:10B0800040EA0120A84201D3B54201D90720B0E728 +:10B0900078191FFA80F9B14501D90D20A9E79DF86B +:10B0A000040020B101A8FAF712FE0028A1D1B04592 +:10B0B00007D1A0784FEA192161F30100A07084F84C +:10B0C0000490149800B10780BBF1000F15D00AEB73 +:10B0D00005003A4659460FF0ADFE224669460698ED +:10B0E000FFF7EAFE9DF80000224620F010008DF8E0 +:10B0F000000000990698FFF707FF002079E72DE987 +:10B10000FF4FDFF8BC9182461746B9F80610D9F810 +:10B11000000001EB410100EB810440F20120B2FB91 +:10B12000F0F183B000FB11764D46DDF844803146E6 +:10B13000049800F01DFA29682A898B46611A0C319F +:10B1400001441144AB8889B28B4202D8842007B0F5 +:10B1500050E70499CDB2290603D5A90601D585206B +:10B16000F5E7B9F806C00CF1010C1FFA8CFCA9F840 +:10B1700006C0129909B1A1F800C0A90602D5C4F809 +:10B18000088007E0104480B2A9F80800191A01EB02 +:10B190000B00A0602246FE200499FFF7B5FEE77081 +:10B1A00026712078390A61F30100320AA17840F053 +:10B1B000040062F30101A17020709AF8020060712E +:10B1C000BAF80000E08000262673280602D599F818 +:10B1D0000A7000E00127A80601D54FF000084D468F +:10B1E00000244FF007090DE0CDF80080CDE901966D +:10B1F000E8882146109B069AFFF7E4FE0028A6D1B6 +:10B20000641CE4B2BC42EFD30020A0E72DE9F04774 +:10B21000804600F09DF9070005D000264446284DE1 +:10B2200040F2012916E00120BDE8F087204600F039 +:10B230008FF90278C17802F0030241EA0222B2FBE0 +:10B24000F9F309FB1321006800F092F93044641C03 +:10B2500086B2A4B2E988601E8142E7DCA8F1010051 +:10B26000E8802889801B288100203870DCE720B125 +:10B27000401E10809170002070470120704710B56B +:10B280000F4904460088CA88904201D3822010BD2D +:10B29000096800EB400001EB80025079A072D08871 +:10B2A00020819178107901F0030140EA0120A0810A +:10B2B000A078E11CFFF700FE20612088401C01E01F +:10B2C0002C0800202080E080002010BD0121018298 +:10B2D00070472DE9FC474FF6FF780546A2F800803D +:10B2E000406817468A4680788DF8020068680088B2 +:10B2F000ADF8000000208DF80600288A2C88A042B6 +:10B3000000D304462C822DE0288A401C2882701D20 +:10B310006968FFF785FD18BB3988414501D1601E7A +:10B3200038806888A04222D3B178307901F00301D7 +:10B3300040EA01296946701DFFF772FD80B96989ED +:10B34000414519D0002231465046FFF781FD38B9FA +:10B350006A894A4504D1E968B0680FF03FFD58B1E9 +:10B36000641CA4B2204600F0F3F80600CCD1641EA1 +:10B370002C828220BDE8FC877C807079B871F088CF +:10B38000B8803178F07801F0030140EA012078813B +:10B39000A7F80C90287A324607F10801FFF78CFDD8 +:10B3A00038610020E6E72DE9F04F85B01D46904654 +:10B3B0000F468346DDF838A0DDF8409000F0C8F86D +:10B3C000040009D02078000608D57148807AB84278 +:10B3D00004D8872005B00DE60120FBE7C8F3090675 +:10B3E000224669463846FFF767FD07465046BAF1E0 +:10B3F000070F1AD000222146FFF72AFD0028E9D1C5 +:10B400002078400611D501208DF80400ADF808B071 +:10B41000BDF80000ADF80A00ADF80C60ADF80E50B4 +:10B4200001A8FAF754FC0028D4D12178E07801F083 +:10B43000030140EA0121A278207902F0030240EAE8 +:10B440000220464507D0B1F5007F04D9691E81422C +:10B4500001DD0B20BEE7864201D90720BAE7801B39 +:10B4600082B2AA4200D92A46B9F1000F01D0A9F848 +:10B4700000200F9810B1B9190FF0DCFC0020A9E7EB +:10B480002DE9F0411D4617460E4600F061F8040014 +:10B4900008D02078000607D53D48807AB04203D80E +:10B4A000872060E501205EE5224639463046FFF7F9 +:10B4B00003FD65B12178E07801F0030140EA012045 +:10B4C000B0F5007F01D8012000E0002028700020A6 +:10B4D00049E52DE9F0411D4617460E4600F038F8C3 +:10B4E000040008D02078000607D52948807AB042A9 +:10B4F00003D8872037E5012035E522463946304616 +:10B50000FFF702FDFF2D14D02178E07801F003024F +:10B5100040EA022040F20122B0FBF2F302FB1300EA +:10B5200015B900F2012080B2E070000A60F3010159 +:10B530002170002017E510B50C4600F009F828B17D +:10B54000C18821804079A070002010BD012010BD6D +:10B550000F49CA88824209D340B1096800EB400014 +:10B560006FF00B0202EB8000084470470020704728 +:10B57000C0B2820609D4000605D50548807A484342 +:10B58000401C80B27047084670470020704700009A +:10B590002C08002010B506F08BFB05F026FEFBF70B +:10B5A00011FF0EF04FFB06F083FABDE8104006F0E5 +:10B5B0000FBB10B50C4601F0C1FC80B3204600F073 +:10B5C000ACFA68B322780E2A09D00F2A07D0022AD3 +:10B5D00005D0032A03D0102A2ED0FFDF1DE0A0786B +:10B5E0001E282BD00FDC0C2824D008DC092825D2FB +:10B5F000DFE800F013241724241E1E1A1C00122852 +:10B600001CD1072010BD302818DDA0F13A00032816 +:10B6100014D2DFE800F011130B00002010BD11E080 +:10B620000EE043F20200F9E70420F7E70D20F5E70A +:10B630000F20F3E70820F1E71120EFE70320EDE703 +:10B64000FFDFEAE7FFDFE8E700F067BA70B503461F +:10B65000002002466FF02F050EE09C5CA4F130063E +:10B660000A2E02D34FF0FF3070BD00EB800005EBD7 +:10B670004000521C2044D2B28A42EED370BD30B595 +:10B680000A240AE0B0FBF4F304FB13008D183030F9 +:10B6900005F8010C521E1846D2B2002AF2D130BD74 +:10B6A00030B500234FF6FF7510E0040A44EA00208D +:10B6B00084B2C85C6040C0F30314604005EA003403 +:10B6C0004440E0B25B1C84EA40109BB29342ECD34E +:10B6D00030BD000010B509F0DBFB042803D009F0F1 +:10B6E000D7FB052802D108F0D4F950B909F05CFC69 +:10B6F000032803D009F05EFC032804D107F0AEFA5A +:10B7000008B1012010BD002010BD70B50C460546E3 +:10B71000062102F092F9606008B1002006E00721DE +:10B72000284602F08AF9606018B1012020700020DC +:10B7300070BD022070BD2DE9FC470C4606466946E7 +:10B74000FFF7E3FF00287DD19DF8000058B107F016 +:10B75000E7F9B0427ED00022214630460BF0F9FCDA +:10B76000002874D116E007F042FFB04272D00022E8 +:10B77000214630460BF0E0F8002868D1019D95F88D +:10B780009800303518B9687E08B1012000E000202B +:10B79000804603E0019D95F8498030354FF0010A5D +:10B7A00095F82D004FF00009A0B195F82E00800704 +:10B7B00010D584F8019084F800A084F80290A68047 +:10B7C00095F82F10A171298E2181698E618185F8EC +:10B7D0002D903CE0304602F0A8FA070000D1FFDFD0 +:10B7E000384601F049FD10F0FF0008D084F80190C0 +:10B7F0000D212170A680E08084F802A027E0304669 +:10B8000002F081FA070000D1FFDFB8F1000F21D06C +:10B81000384601F0BCFDA8B19DF8000038B9019888 +:10B82000D0F8BC004188B14201D180F80090304688 +:10B8300007F0DBF884F801900A21217084F8029067 +:10B84000A68000E006E0A97EA17185F8199001208C +:10B85000BDE8FC870020FBE71CB56946FFF755FFF4 +:10B8600000B1FFDF684601F0B1FBFD4900208968A7 +:10B87000A1F89A001CBD2DE9FC4104460E460620A5 +:10B8800002F086F80546072002F082F82844C7B285 +:10B890000025A8463E4417E02088401C80B2208046 +:10B8A000B04202D34046A4F8008080B2B84204D32C +:10B8B000B04202D20020BDE8FC816946FFF725FFB7 +:10B8C0000028F8D06D1CEDB2AE42E5D84FF6FF70FF +:10B8D00020801220EFE738B54FF6FF70ADF800007A +:10B8E0000DE00621BDF8000002F0B9F8044607217A +:10B8F000BDF8000002F0B3F80CB100B1FFDF002189 +:10B900006846FFF7B8FF0028EBD038BD2DE9F041BD +:10B91000D4A0D64C06790025076884F8425001F07F +:10B920004EFB84F8435004202087102060874FF698 +:10B93000FF70A4F80A0184F80C51A4F80E0184F8F1 +:10B94000315004F8EE5BC94804F8C05C04F8BA5CF6 +:10B950008030A57340F87D7FC4490671FD31481ED3 +:10B960000BF095F80A20207503206075A075E0752E +:10B970000E20207606206076A076E076BDE8F08185 +:10B980002DE9F041B64C0D466060217007F015F8C6 +:10B99000FFF7A1FFFFF7BAFF207809F01CF8B349C1 +:10B9A000C431A1F181000F46064607F041FF6068EF +:10B9B0000BF038F820780CF0C9FB284609F0C1FEDE +:10B9C0003946304607F0E8F860680BF04DFC01F0AE +:10B9D000F6FAA649002081F84300CFE710B501240C +:10B9E0000AB1002010BD21B1012903D00024204656 +:10B9F00010BD02210DF096FBF9E72DE9F047040098 +:10BA000000D1FFDF994D002695F8310058B16670DE +:10BA10001020207095F83200A07095F83300E07087 +:10BA200085F831606AE0287840B12C22A91C2046B4 +:10BA30000FF000FA0E2020702E705FE095F82E00B7 +:10BA400060B10120E07095F82F00A07095F83000EB +:10BA500060700F20207085F82E604FE0844802212E +:10BA60008246FFF708FF00B1FFDFB5F80E91062010 +:10BA700001F08EFF0746072001F08AFF3844C7B265 +:10BA8000781C00F0FF0800BFB5F80E01B84213D1D2 +:10BA90000021204607F05EFD58BB95F8340080B3C6 +:10BAA0006670132020701C21A01C0FF03AFA0220AF +:10BAB000A07085F8346021E040451BD1002120466C +:10BAC00007F000F8E8B12078132817D1A0783C28B7 +:10BAD00014D1A088072101F0B0FF050000D1FFDFDD +:10BAE000288806F082FFA088072101F0B8FF00B186 +:10BAF000FFDF03E02146FFF71EFE10B10120BDE885 +:10BB0000F087FFE702215046FFF7B5FE18B9B5F8F8 +:10BB10000E114945B8D10020F1E76EE710B508F0E5 +:10BB2000C8FE00B1FFDF0AF07BFF00B1FFDF07F0C6 +:10BB300035FE09F0EFFD00B1FFDF0BF093FB00B124 +:10BB4000FFDF06F0F7FF00B1FFDF0CF0F9FA00B1FC +:10BB5000FFDFFFF7C0FEFFF7D9FE06F017FF02F088 +:10BB6000C1F801F02CFA4148002180F8431001711E +:10BB7000012141710222C270017010BD10B53B4C11 +:10BB8000207828B10A21BDE810400E2001F0E4B968 +:10BB9000FFF7A0FD08B10C2002E001F010FA002030 +:10BBA0002071012060710A21E170207010BD70B514 +:10BBB0002E4C0546207828B1BDE8704039210E2072 +:10BBC00001F0CAB9FFF786FD08B10C2012E094F825 +:10BBD000430008280DD204EB0010102229464430FF +:10BBE00001F0C7F994F84300401C84F8430000209A +:10BBF00000E007202071012060713921E170207080 +:10BC000070BD70B5194C0546207828B1BDE870406C +:10BC10000B210E2001F0A0B9287818B1012801D01D +:10BC2000122016E094F8C400082823D2FFF752FD32 +:10BC300008B10C200DE00E482B7894F8C4106A1C53 +:10BC4000463806F01AF994F8C400401C84F8C40081 +:10BC500000202071012060710B21E170207070BD07 +:10BC600044000020FFFFFFFF1F00000038080020F5 +:10BC7000460900200720ECE710B5FE4C207828B1DB +:10BC80003821BDE810400E2001F066B9FFF722FD13 +:10BC900008B10C2002E0002084F84300207101204C +:10BCA00060713821E170207010BDF248017819B13F +:10BCB0000F210E2001F050B9002101710E21817079 +:10BCC0000F21C170FF2181714FF6FF710181EA4997 +:10BCD00049680A7882728A8882814988C1810121F3 +:10BCE000417101707047E3490A781AB13B210E2077 +:10BCF00001F032B90088A1F80A01012081F80C0195 +:10BD000000220A7148713B22CA700870704710B552 +:10BD1000D84C207828B12B21BDE810400E2001F02E +:10BD20001BB90821A01D05F0F9FA0020207101209F +:10BD300060712B21E170207010BD70B5CD4C217861 +:10BD400029B1BDE8704031210E2001F005B990F90C +:10BD50000000042814D098B1011D11D010F1080F73 +:10BD60000ED010F10C0F0BD010F1100F08D010F105 +:10BD7000140F05D010F1280F02D01220207103E01B +:10BD8000002506F0BBF825713120E07001206071BC +:10BD9000207064E730B5B74D04468DB0287828B1DF +:10BDA0002A210E2001F0D8F80DB030BD1022214616 +:10BDB000684601F0DEF8102204F1100104A801F039 +:10BDC000D8F868460DF0D6FF10222C46A81D08A909 +:10BDD00001F0CFF8002020710E20A0702A20E07022 +:10BDE000012060712070DFE72DE9FF41A14C207830 +:10BDF00028B13A210E2001F0AFF8BDE8FF814FF0E5 +:10BE0000000884F80680B4F80A01ADF8040002A91D +:10BE1000FFF77BFC20B1002101A8FFF72CFDE8BB58 +:10BE2000BDF80400ADF8000002A980B2FFF76DFC78 +:10BE300000B1FFDFBDF8000001F077FF050000D181 +:10BE4000FFDF2846039F01F0A9FA80F0010697F86A +:10BE50004950BDF8000001F056FF070000D1FFDF98 +:10BE6000384601F094FA80F0010255EA020019D038 +:10BE7000A179BDF8000004EB410108817D49A37957 +:10BE80001831585C65F300005854A37962F34100FF +:10BE90005854A27966F38200505400E00DE0A07976 +:10BEA000401CA07100216846FFF7E5FC28B9BDF8E9 +:10BEB0000000BDF804108842B6D1012084F8048047 +:10BEC00060713A21E170207097E770B5694C0546C2 +:10BED000207828B1BDE8704034210E2001F03CB834 +:10BEE00008F0D6FF052804D0284608F061FD0020A0 +:10BEF00000E00C202071012060713421E17020707D +:10BF0000ADE65C48017819B10E21084601F024B86D +:10BF10005949CA68C0F80620098A41810021017187 +:10BF2000012141710E22C2700170704770B5514CF1 +:10BF30000646251D207828B1BDE8704032210E202C +:10BF400001F00AB83146002006F00EFF287058B9FB +:10BF500000213246084607F053FD287020B94648B4 +:10BF60003168C160B1880182012060713221E170C5 +:10BF7000207074E670B53F4C0546207828B1BDE8C6 +:10BF8000704030210E2000F0E7BF08F0C4FD10B96A +:10BF900009F064FE68B1287809F034FC287807F0CD +:10BFA000A7FD00202071012060713021E170207018 +:10BFB00055E60C20F6E72DE9F0412E4C0646251DEE +:10BFC000207828B1BDE8F04117210E2000F0C4BF51 +:10BFD0003146012006F0C8FE2870012768B93246B4 +:10BFE0000121002007F00CFD287030B93068E063B3 +:10BFF000B088A4F8400084F8427067711720E070A0 +:10C000002770BBE438B51B4D0446287828B1BDE83D +:10C01000384030210E2000F09FBF227961798A429A +:10C0200015D0A079E379984211D01F2A0FD81F2983 +:10C030000DD8002211460EF03DF940B90022E079FA +:10C0400011460EF037F910B9207A072801D91220CD +:10C050001BE04FF6FF70ADF8000008F0A5FFD8B95F +:10C0600008F0A8FFC0B908F013FFA8B9002168467E +:10C0700004E000003808002044000020FFF7FBFB2C +:10C0800050B1204605F032FE002028710120687171 +:10C090003E21E970287038BD0C20F6E72DE9FC47F9 +:10C0A000FE4C054694F82E0028B128210F2000F000 +:10C0B00053FFBDE8FC87282084F83000012184F874 +:10C0C0002E10A8784FF000091A2825D00EDC16286B +:10C0D00031D2DFE800F030303030302130303030D5 +:10C0E0003030303030303030302121212A2822D0F9 +:10C0F0000BDCA0F11E000C281DD2DFE800F01C1C98 +:10C100001C1C1C1C1C1C1C1C1C0D3A38042812D2A4 +:10C11000DFE800F0110211022888B0F5706F0AD232 +:10C120001F20884684F82F0028886946FFF7EDFA1B +:10C1300018B1022019E0122017E09DF80000019FBD +:10C14000002806D007F1CE07019E05D106F1B506FD +:10C1500004E007F1B407F7E706F1CF06684600F000 +:10C1600023FF08B1387818B10C2084F82F00A0E71D +:10C1700087F80080A878307084F82F90684600F027 +:10C1800025FF96E77CB5C54C0546207820B12521D2 +:10C190000E2000F0E1FE7CBD28886946FFF7B5FA65 +:10C1A000002168B102202071BC4881600173E180E8 +:10C1B0000E20A0702520E0700120607120707CBDF1 +:10C1C000019A104612F1300282F836108368A3609B +:10C1D000037B237392F83630002BF5D12888E0805A +:10C1E000E6E72DE9FC41AD4C064694F82E0028B157 +:10C1F00010210F2000F0B0FEBDE8FC811F2084F864 +:10C200002F00102084F83000012784F82E70308829 +:10C210006946FFF77AFA70B9684600F0C5FE50B17A +:10C22000019D9DF8000030350028019805D0E230CE +:10C23000017841B904E0022006E0D0F8BC00F7E73D +:10C2400095F82D1019B13A2084F82F00D4E795F80D +:10C250002E1089070CD1042101709DF8000020B92F +:10C2600001993088D1F8BC104880684600F0AEFED5 +:10C27000002084F82F0085F82D70BDE72DE9F047E8 +:10C28000864D0646287828B1BDE8F0471D210E20CE +:10C2900000F062BE4FF01F0985F80490012068711C +:10C2A0001D21E970287008F0F3FD0C2704284ED0FA +:10C2B00005284CD0B0791224012800D0E8B9307894 +:10C2C00008B1012819D1F07908B1012815D1708879 +:10C2D00043F6FD71021F30248A420ED2B288121F2B +:10C2E0008A420AD22887B0886887B0794FF0000860 +:10C2F0004446012803D050B111E02C710CE495F8AC +:10C30000420020B3654A3C320121084602E0644AFB +:10C310000021012007F074FB040000D0FFDFF0795A +:10C32000012800D010B907F093FB044614B185F83A +:10C330000490E3E73078012801D018B109E000212A +:10C34000022001E00021012007F097FB08B12F71C6 +:10C35000D4E785F80480D1E770B5504C217829B135 +:10C36000BDE870401E210E2000F0F6BD1F21217196 +:10C37000012161711E22E270217002781221012ACE +:10C3800000D01AB9407818B1012801D0217166E4B3 +:10C3900000260C25012A08D008F07AFD052802D0D5 +:10C3A00008F034FA30B1257159E4618F208F08F01C +:10C3B000BFFBF7E7267152E42DE9FE4F0546AFF2C9 +:10C3C0005C71D1E90001354E01908A4696F82E0045 +:10C3D00030B103B02121BDE8F04F0F2000F0BCBD0B +:10C3E0001F2086F82F00212086F830004FF001082A +:10C3F00086F82E80298843F6FD730A1F30209A4262 +:10C400007ED26A88141F9C42FAD28A4278D8EA897E +:10C4100040F67B43911F9942F2D2298A8C1F9C429D +:10C42000EED28A42F2D86A8AB2F5FA7FE8D2AA8AB4 +:10C4300040F67744A2F10A03A342E1D2B2EBD10F56 +:10C440005ED9E98A2A8B9142E0D82979122011B16C +:10C45000012955D102E069790029F9D1297B09B177 +:10C460000129F6D108F014FD4FF00C0905286ED013 +:10C4700008F00EFD0428FAD096F83400002866D1A2 +:10C4800007F0B5F8A0F57F41FF39F8D1062102A8E1 +:10C4900001F0A4FA040050D0032103E03808002082 +:10C4A000500000200CF02CFB96F8030100901B229A +:10C4B00096F802312088114601F070FB04283ED026 +:10C4C00000B1FFDF208806F08FFA04F10D07B4F801 +:10C4D00000B00421384604F021FF594638460CF0DC +:10C4E00004FCFDA03F1D006800900321684604F095 +:10C4F000A0FE002069460A5C3A54401CC0B200E02D +:10C500006FE00328F7D3288A6080688AA080A88A11 +:10C51000E08096F8051196F8040108F0C8FA014683 +:10C52000204608F0F0FA002784F8367084F8377057 +:10C53000687968B101280FD10CE0092051E020880A +:10C54000062101F08CFA00B1FFDF072049E071E01D +:10C55000677601E084F81980D5F80600C4F81A005F +:10C560006889E0830198A06084F80CA084F8C480F6 +:10C570008DF800700121684604F05BFE9DF8000014 +:10C5800000F00701C0F3C1021144C0F34010084499 +:10C590008DF80000401D2076092801D20830207651 +:10C5A000002120460CF0ACFA287B18B1012805D0F8 +:10C5B000FFDF24E00021C94A012005E096F842008F +:10C5C00098B10121C64A084607F01AFAB8B1208886 +:10C5D00006F00BFA2088062101F041FA00B1FFDFD6 +:10C5E0001F2086F82F00BDE8FE8F208806F0FDF999 +:10C5F0002088062101F033FAE0B1FFDF1AE0287944 +:10C60000012800D010B907F023FA50B921460320C1 +:10C6100007F033FA28B96A882988204608F005FA15 +:10C6200058B1208806F0E1F92088062101F017FAB8 +:10C6300000B1FFDF86F82F90D5E784F8B87086F850 +:10C640002F70D0E738B5A64C3C3C207820B1222191 +:10C650000E2000F081FC38BD1F202071012565717E +:10C660002220E070257008F013FC052802D00C2071 +:10C67000207138BD00202071684608F090FA00282B +:10C68000F7D10098008806F0B0F9009806210088DC +:10C6900001F0E5F900B1FFDF904884F834500C3820 +:10C6A0000078FCF78DFF38BD2DE9F0418C4D044634 +:10C6B0003C3D95F82E0028B1BDE8F04123210F2024 +:10C6C00000F04ABC1F2085F82F00232085F8300099 +:10C6D000012085F82E00618840F67B438A1F3020B8 +:10C6E0009A4251D2A288961F9E424DD291424BD877 +:10C6F000E188B1F5FA7F47D2218940F67746A1F16A +:10C700000A03B34240D2B1EBD20F3DD96189A2896D +:10C71000914239D84FF000082088062101F08DF9A8 +:10C7200006004FF0020707D000F030FC20B1D6F829 +:10C73000BC00017839B902E085F82F7061E4D6F8C1 +:10C74000D010097809B13A201EE005218171D6F890 +:10C75000BC004146A0F80880D6F8BC20A0885081D3 +:10C76000D6F8BC20E0889081D6F8BC202089D08102 +:10C77000D6F8BC00028943899A4204D88279082AF3 +:10C7800001D89A4203D3122085F82F0039E4228879 +:10C790004280D6F8BC00077085F82F1031E42DE9EF +:10C7A000FE434F4C06463C3C207830B103B0242178 +:10C7B000BDE8F0430E2000F0CFBB012565712420B9 +:10C7C000E070257030460CF0B2FA08B1002000E0AD +:10C7D0001220207100282DD1414884F8FC504430AB +:10C7E000316840F87D1F317901714FF0000884F8FD +:10C7F000FC806946062001F0ACF800B1FFDF684616 +:10C8000001F085F8A0B9BDF8047000BFBDF80400C0 +:10C81000062101F012F9060000D1FFDF86F8C450AE +:10C82000684601F074F818B9BDF80400B842EDD1BB +:10C8300084F80480BDE8FE8370B5294D06463C3D72 +:10C8400095F82E0028B1BDE8704026210F2000F099 +:10C8500083BB1F2085F82F00262085F8300001209B +:10C8600085F82E003088062101F0E7F8040007D093 +:10C8700000F08CFB20B1D4F8BC00017831B901E0A4 +:10C8800002200CE0D4F8D010097809B13A2006E073 +:10C8900005210170D4F8BC1030884880002085F84C +:10C8A0002F0074E50E483C38017819B106210E209E +:10C8B00000F052BB002101710E2282700622C2706C +:10C8C000C0F80610C0F80A10817941F001018171A9 +:10C8D0000121417101707047112233005000002086 +:10C8E0007408002070B5F84E054696F82E0028B161 +:10C8F000BDE870402C210F2000F02EBB1F2086F8D1 +:10C900002F002C2086F83000012086F82E00288881 +:10C91000062101F092F8040007D000F037FB20B1A7 +:10C92000D4F8BC00017831B901E0022020E0D4F84D +:10C93000D010097809B13A201AE094F86410D1B106 +:10C94000D5F802104160D5F80610816054F8BC0F8C +:10C95000698910228181206805F10C010E300EF0EA +:10C9600069FA21680320087021682888488000201F +:10C9700086F82F000BE50C20FAE770B5D24E04467E +:10C980000C25307828B1BDE8704018210E2000F049 +:10C99000E3BA08F009FB032852D008F00BFB032888 +:10C9A0004ED0607908B1012829D1A07908B10128B9 +:10C9B00025D1A07B28B1012803D0022801D003286B +:10C9C0001DD1607BD8B1C00819D162884FF4804076 +:10C9D000824202D82188814203D9207901280ED1D0 +:10C9E00018E0207930B1012814D0022805D003289E +:10C9F00005D102E0202A0BD30CE0A0290AD220792D +:10CA0000042805D12088202802D36188884201D9D2 +:10CA1000122515E0207986F83600607910B10128DA +:10CA200004D00DE0A94A0021204606E096F8420015 +:10CA300030B1A54A01213C32204606F016F90546E0 +:10CA40000120357170711821F17030709FE410B5BC +:10CA50009D4C217829B11A21BDE810400E2000F02C +:10CA60007BBA01781F2902D91220207106E000212B +:10CA700021710278411C104606F0A8F9012060716E +:10CA80001A21E170207010BD10B58F4C217829B1AA +:10CA90002021BDE810400E2000F05EBA01781F2969 +:10CAA00002D91220207106E0002121710278411C78 +:10CAB000104606F07AF9012060712021E1702070A3 +:10CAC00010BD2DE9FC41804C217829B1BDE8FC4125 +:10CAD0001B210E2000F040BA012767710C21217143 +:10CAE00000780026012803D000286AD012205CE0DC +:10CAF00006F085F800287ED094F83600A0B1012811 +:10CB000012D0042810D008F055FA002873D108F08C +:10CB10004BFA18B108F048FA02286CD1002008F04E +:10CB200074FEE0B3FFDF4AE008F03EFA002862D16D +:10CB300008F040FA00285ED105F0F2FFA0F57F4131 +:10CB4000FF3958D1072101A800F048FF5F49054689 +:10CB50000C398860280000D1FFDF032128460BF044 +:10CB60001DFF284606F0FCF994F8091194F8080115 +:10CB700008F023FA0146284608F04BFA94F807011A +:10CB800000901B2294F806312888114601F006F81F +:10CB900068B1042800D0FFDF2888072100E00EE0FC +:10CBA00000F05DFF00B1FFDF0720207123E028883F +:10CBB00005F01AFF284608F028FE00B1FFDF2671B5 +:10CBC00019E008F0F1F9032803D008F0F3F903287D +:10CBD00011D108F0ECF90546002008F027FD50B906 +:10CBE000267145B1288805F000FF2888072100F04C +:10CBF00036FF00B1FFDF1B20E0702770BDE8FC812D +:10CC00002DE9F041304C0646207828B1BDE8F041CE +:10CC10002D210E2000F0A0B93088072100F00DFF73 +:10CC200005004FF0010720D095F8D10040B995F8E4 +:10CC30003C000F2801D0102802D195F8040150B112 +:10CC40000C2020710E20A0702D20E0703088E08034 +:10CC50006771277072E51022B11C05F1D2000EF049 +:10CC6000E9F885F8D1700020EBE70220E9E770B51C +:10CC7000154C0546207828B1BDE870402E210E20C5 +:10CC800000F06AB92888072100F0D7FE022178B1A8 +:10CC900090F8D1202AB990F83C200F2A04D0102A0D +:10CCA00002D00C20207104E080F8D1100020F9E7B8 +:10CCB00021710E20A0702E20E0702888E0800120D5 +:10CCC00060712070EDE50000380800205000002061 +:10CCD0007CB5C54C0546207820B137210E2000F0E8 +:10CCE0003BF97CBD28886946FEF70FFD38B102206C +:10CCF0002071012060713721E17020707CBD0198A6 +:10CD00007F22014680F8382080F83920002280F800 +:10CD10003A20A87801F8280FE878487028798870B8 +:10CD20002271E6E71CB5B04C217821B113210E2009 +:10CD300000F012F91CBD00886946FEF7E6FC08B158 +:10CD4000022005E0019890F82810012902D00C205B +:10CD5000207106E0382100222271095C21720088CE +:10CD6000E080012060711321E1700E21A17020701C +:10CD70001CBD2DE9F0419C4C0546207828B1BDE84A +:10CD8000F04135210E2000F0E7B8A87808B101285D +:10CD900003D1A888B0F5FA7F01D912202071288824 +:10CDA000072100F04AFE0126A0B1002780F8C870D4 +:10CDB000A988A0F8CA1080F8A460A978012900D039 +:10CDC000002180F8C81090F8A50008B108F01CFEFA +:10CDD000277101E00220207166713520E070267015 +:10CDE000ACE42DE9F041804C0546207828B1BDE83F +:10CDF000F0413C210E2000F0AFB82888072100F058 +:10CE00001CFE012358B382886D88C688418803EBD5 +:10CE10004207BD4217D342F210777E43BF107943D9 +:10CE2000B6FBF1F1491E89B24FF4FA76B14200D94E +:10CE300031468D4200D22946491C521CB1FBF2F109 +:10CE40005143491E8AB290F8F01001B90284E28081 +:10CE50000020207163713C20E07023706EE402209A +:10CE6000F7E770B5604C0546207828B1BDE8704002 +:10CE700033210E2000F070B808F096F808B10C20AD +:10CE800017E0297889B10A290FD014290DD01E295D +:10CE90000BD0282909D0322907D04B2905D0642985 +:10CEA00003D0FF2901D0122003E0284608F04FFDEF +:10CEB00000202071012060713321E1702070F0E4C6 +:10CEC00049490A781AB13F210E2000F045B80022E6 +:10CED0000A710278454B4AB1012A0CD01220087120 +:10CEE000012048713F22CA700870F4E4D0F80100B4 +:10CEF000C3F80200F4E7D0F80100C3F80600EFE73A +:10CF000070B5394C0546207828B1BDE870403D2108 +:10CF10000E2000F021B808F047F810B908F04AF8E0 +:10CF200008B10C2003E0287805F060FF0020207194 +:10CF3000012060713D21E1702070B2E410B50178EC +:10CF4000402907D22A4A52F8211019B1801C88477B +:10CF5000012010BD002010BD234A92F83130002B73 +:10CF600006D182F8320082F83310012082F83100B5 +:10CF7000B1E430B5134606E0CC18D51A14F8014CCC +:10CF80005B1E4455DBB2002BF6D130BD90F8491042 +:10CF900041B990F8981029B190F89800042801D070 +:10CFA000012098E4002096E40178406821B190F8CF +:10CFB000490010B100208EE4E8E701208BE40A4824 +:10CFC0000021C0F8F81080F8C41084E40178012929 +:10CFD00009D1406890F8A510002904D0002180F8FC +:10CFE000A51008F011BD76E43808002038090020AB +:10CFF0004CB301003D3070470844C01D424301F16D +:10D000003D00104480B2704770B51C460546A0181C +:10D01000049BC01D00FB03F204F13D00104486B2E6 +:10D02000B14238BFFFDF1C2128460DF07AFFA6F180 +:10D030001C0080B22C752880B0F5004F88BFFFDF40 +:10D0400070BD008870472DE9F04F0E468188044678 +:10D0500000F11C0AC088154620F4004221F4004368 +:10D06000002721F4004820F400499A4208D100F436 +:10D07000004001F4004188421CBF0020BDE8F08F51 +:10D08000C14517D9207DA9EB0801091AC91F8D4296 +:10D0900027DCC11D0AEB08000144C91E71603581FF +:10D0A000F7603782011D3160058047800120A07440 +:10D0B000BDE8F08F2088217DA0EB0800401AB0F178 +:10D0C000070B0ED4BBF11B0FB8BFFFDF5D45D4BF0C +:10D0D00028461FFA8BF0291A0A04120C18BF4A4579 +:10D0E00003DDA7740020BDE8F08F217DCB1D0AEB86 +:10D0F00008010B44DB1E7360308104F11C03F360F4 +:10D1000032820B1D336008804A800120A074BDE884 +:10D11000F08F2DE9F041044600F11C02808820F4D4 +:10D120000043A07C002808BFBDE8F081D018028829 +:10D13000438813448B423CBF0020BDE8F0810027A8 +:10D1400091429CBF0180478013D9891A0D042D0C90 +:10D1500045800ED0A088261D20F40040854288BF5F +:10D16000FFDF30884FF4004121EA0000284330807F +:10D1700008E0217D0088CB1D184481B22288201D43 +:10D1800000F09AFAA7740120BDE8F08130B4B0F83D +:10D1900002C08488034600F11C052CF4004028449A +:10D1A000A44503D10020D88130BC7047B3F80AC031 +:10D1B0000488A44509D34088ACEB040CA0EB0C0018 +:10D1C00084B20CEB0500C01E06E0A4EB0C041D7D30 +:10D1D000A4B2AC446044001DB1F800C0A44588BFAF +:10D1E0000C80B3F80AC0BCF1000F0CBF4FF0010C6B +:10D1F0004FF0000C82F800C00988D98130BC70471C +:10D200002DE9F041044600F11C01408820F4004063 +:10D210004518E089002808BFBDE8F081618908440D +:10D2200080B2608129886A881144814238BFFFDF5B +:10D2300028886D88628941190027914218D175B1FB +:10D240006088A61C20F40040A84238BFFFDF308869 +:10D250004FF4004121EA00002843308007E0217D9F +:10D260002288CB1D184481B2A01C00F025FA6781EA +:10D27000E7810120BDE8F0812DE9F0470189B0F890 +:10D2800002800027044600F11C0A414518BF4FF4F4 +:10D29000004938D021F400400AEB00014E886EB1FD +:10D2A000208904F1080520F40040B04238BFFFDFB8 +:10D2B000288829EA0000304328801FE0207D238948 +:10D2C000C21D088823F4004510442188284480B2F8 +:10D2D00004F1080C88420AD2091A89B21B32914221 +:10D2E0002CBF03F4004129EA030004D204E0401AF1 +:10D2F00080B229EA03010843ACF80000781C2189B8 +:10D3000087B24145C6D13846BDE8F0872DE9F047E0 +:10D31000B0F806800B46044600F11C01B0F80890F6 +:10D32000408828F4004C01EB0C05804504BF002028 +:10D33000BDE8F087002A1CBF281D106023B1227DA4 +:10D34000291D18460DF076FD2F886D8885B1E819E6 +:10D3500087B2E088A61D20F40040A84238BFFFDF56 +:10D3600030884FF4004121EA00002843308007E074 +:10D37000207D2288C31DD81981B2A01D00F09CF920 +:10D38000C84504BFE08820813846BDE8F087418861 +:10D39000808881420CBF0120002070474188C088EE +:10D3A00088420CBF01200020704730B44488828836 +:10D3B00000F11C0324F4004C22F400416344944225 +:10D3C0001BD04289C48915191C885A88A3189D420C +:10D3D00016D312B18A4210D212E0037D0CF1070C71 +:10D3E0001A196244008892B2801A80B2223398429D +:10D3F00001D211B104E08A4202D130BC0020704752 +:10D4000030BC012070472DE9F0078588C48800F101 +:10D410001C06024625F4004C24F4004925F4004A79 +:10D42000002024F4004306EB0C074FF00108D1451F +:10D430000AD104F4004405F40045AC4204D0108243 +:10D44000BDE8F00700207047634506D9147DA3EBC3 +:10D450000C031B1BDD1F002305E01488157DA4EBC6 +:10D460000C04641BE51F002DE9DB94895CB13C884A +:10D470007F8847B1DB1BD0748B42E0DB908930445E +:10D48000001BC01E12E02D1BD0748D4206DB107DE8 +:10D490009389C01D60443344184406E08B42CEDBC0 +:10D4A00082F8138090893044001BC01E1182BDE8B1 +:10D4B000F00770472DE9F05F044600F11C088088F2 +:10D4C000924620F4004B208A894608EB0B0608B1EF +:10D4D000484502D20020BDE8F09FA089002804BF83 +:10D4E00000273D4605D0378875887919884218BFCE +:10D4F000FFDFE07C50EA050101D078B338E0A08975 +:10D5000050B1217D4044C91D59440844B4F8151058 +:10D5100020F8031DE17D8170A18907EB09004944D2 +:10D52000A181308000257580207DBAF1000F09D0DF +:10D53000C31D30882288184481B2201D00F0BCF839 +:10D54000A5813AE0A189C01D58444144084430F8FF +:10D55000031DA4F815108078E0752EE0FFE7A08980 +:10D56000B4F815104044C01B20F8031DE17D817004 +:10D5700005EB090085B2A089BAF1000F4844A081EB +:10D580003780758010D0A088261D20F40040A84266 +:10D5900038BFFFDF30884FF4004121EA0000284304 +:10D5A00030800020A08108E0A0894044C01B30F8F2 +:10D5B000031DA4F815108078E07500202082A07467 +:10D5C0000120BDE8F09F10B4B0F802C0848800F1DB +:10D5D0001C022CF400431344A44504D0B0F80AC044 +:10D5E000BCF1000F02D010BC0020704703F1040C06 +:10D5F000C1F800C0007D00F1070C0CEB0300C01E59 +:10D60000486018880881CA605B880B8220B9D01EE8 +:10D6100048600B810020088210BC0120704770B563 +:10D62000044600F11C018288408820F4004319441C +:10D63000904205D06289002A04BFE289002A01D005 +:10D64000002070BD0A884D8885B1A61C20F40040DA +:10D65000A84238BFFFDF30884FF4004121EA0000C4 +:10D66000284330800020E081012070BD207DC31D53 +:10D67000981881B22288A01C00F01EF8F2E7002161 +:10D680008181C1740182817470478289002A04BF3C +:10D6900000207047828800F11C0322F400421A44E3 +:10D6A000B2F800C0BCF1000F1DBF037D121D1A446B +:10D6B000DA1E4A608089704710B4B0F800C02CF4BC +:10D6C0000044214489B24FF4004491420AD2521AD4 +:10D6D00092B21B339A422CBF0CF4004224EA0C0194 +:10D6E00004D204E0891A89B224EA0C0211430180B1 +:10D6F00010BC70472DE9F04188464FF6FC7102F1ED +:10D7000003021E46040002EA010509D00027E01CBE +:10D7100020F00300A04200D0FFDF201D01210CE01B +:10D720000127F4E7024628442FB9B14201D203464B +:10D7300000E000231360491CC9B2B142F2D9011BB9 +:10D74000C8F80010002F04D10EB1201D00E0002009 +:10D750002060BDE8F081024600201168002902D057 +:10D76000084609681160704702680A6001607047E6 +:10D770004FF6FC73C91C1940101A001F90FBF1F002 +:10D78000C0B270474FF6FC73C91C1940001D01FB65 +:10D7900002007047F8B5D24D04460E46A878A04264 +:10D7A00000D8FFDF05EB8607B86A50F8240000B107 +:10D7B000FFDFB868FFF7CFFF05000DD0B86A062E6F +:10D7C00040F824500AD0082E00D3FFDFC548294670 +:10D7D00050F82620204690472846F8BDC048C24B46 +:10D7E0007A30A0F12E0200902946204609F08FF8E9 +:10D7F000F2E72DE9F84F8046DDF828901E4603EB4E +:10D80000090093468A46C4B25FEA080707D000259C +:10D81000FF2800D9FFDFBAF1000F03D101E0012595 +:10D82000F6E7FFDF08F1030020F00301414500D0D7 +:10D83000FFDFCB4500D9FFDF65B9A94A00204C3294 +:10D840004FF6FF7110705180A74A1070A44A7A32C7 +:10D8500010705180A24880F800B046708470C47087 +:10D860000471447180F80690DFF878B2C671002622 +:10D870000BF1400B8146FF1C27F003000746002DEB +:10D8800002D109EB860188603BF8162019F80630B2 +:10D8900001D04FF000006946FFF72CFF0098761C7E +:10D8A000F6B20744082EE6D3FF1C27F003002346F8 +:10D8B000064675B1002002226946FFF71BFF00985B +:10D8C0003118002003464E46C91C21F003021DB149 +:10D8D00010E0C9F84800EEE706EB80070021BA62C5 +:10D8E00006E000BFD7F828C04CF82130491CC9B267 +:10D8F000A142F7D3401CC0B202EB84010828E3D355 +:10D90000A1EB0800AAF800000020BDE8F88F10B5D0 +:10D91000044604F075F808B1102010BD2078704A54 +:10D92000618802EB800092780EE0836A53F8213020 +:10D9300043B14A1C6280A180806A50F82100A06037 +:10D94000002010BD491C89B28A42EED861800520B2 +:10D9500010BD70B505460C46084604F051F808B1F4 +:10D96000102070BD082D01D3072070BD2570002048 +:10D97000608070BD0EB56946FFF7EBFF00B1FFDFB9 +:10D980006846FFF7C4FF08B100200EBD01200EBDA0 +:10D9900010B50446082800D3FFDF5148005D10BDD4 +:10D9A0003EB5054600246946FFF7D3FF18B1FFDFF7 +:10D9B00001E0641CE4B26846FFF7A9FF0028F8D034 +:10D9C0002846FFF7E5FF001BC0B23EBD44498978F9 +:10D9D000814201D9C0B27047FF2070472DE9F04164 +:10D9E0000C460546062901D0072C10D13C4FB86CD7 +:10D9F000FFF7B1FE02004FF6FF7604D00221B86CAB +:10DA0000FFF7B6FE00E030462880B04202D1002089 +:10DA1000BDE8F0812146FFF7BDFE040002D1288851 +:10DA200000F050F82046F3E7A0F57F42FF3A01D01E +:10DA3000082901D300207047ACE6A0F57F42FF3AE9 +:10DA40000BD0082909D2264A9378834205D902EBE4 +:10DA50008101896A51F820007047002070472DE944 +:10DA6000F04104460D46A4F57F4143F20200FF3920 +:10DA7000CED0082D01D30720CAE719494FF000087E +:10DA80008A78A242C4D901EB85072146BA6A52F8C6 +:10DA90002460002EBCD0134A08462032314652F88A +:10DAA00025209047B96A062D41F8248001D0072D22 +:10DAB00002D1204600F006F83146B868FFF754FE60 +:10DAC0000020A5E710B5064CC2B20221A06CFFF7FA +:10DAD00059FE0146A06CBDE81040FFF745BE0000AE +:10DAE000480900204CB40100560000200146A0481F +:10DAF000002200680260037A00EB830040F80C2FDC +:10DB00008180114600F025B92DE9F05F9846DDF8D7 +:10DB100030B0DDF828A01546894604004FF0000615 +:10DB200025D00027E01C20F00300A04200D0FFDF3A +:10DB30007DB30120FFF75EFA00FB05620AEBCB0024 +:10DB4000104486B20120FFF755FA00FB05620B99DD +:10DB500008EBC100104405EB450100EB4100143017 +:10DB600000EB850000EB850086B217B111E00127BC +:10DB7000D8E7A6EB85000C3887B27D48A900046081 +:10DB8000257204F10C0060600DF0EDF93846FFF7E6 +:10DB9000ADFFA9F800600020BDE8F09F2DE9FF4F20 +:10DBA000734C814681B020689A468B4600B9FFDFEE +:10DBB0002068027A4A4503D9426852F8291021B1F7 +:10DBC00043F2020005B0BDE8F08F006800B9FFDF46 +:10DBD00001210E9A0398FFF70FFAC61C4FF6FC7549 +:10DBE0002E40584601215246FFF706FAC01C00EAB3 +:10DBF000050808EB0600001D85B25D480027006897 +:10DC0000046801E027460446206838B1A188A9428B +:10DC1000F8D13946204600F0A4F813E005F10800D9 +:10DC2000A18880B2814229D33946204600F099F874 +:10DC3000A0880022411B601902608180394600F0F3 +:10DC400088F8A580A08860802680251D0E9F01236E +:10DC5000039A314628460097FFF7D6F920884146B7 +:10DC600028445A460123CDF800A0FFF7CDF94048DB +:10DC700000684168002041F82940A3E70420A1E79B +:10DC800070B53B4C0546206800B9FFDF2068017A7B +:10DC9000A94210D9426852F8250060B1418800239A +:10DCA00042F8253003608180194600F052F821685F +:10DCB00000200A7A08E043F2020070BD4B6853F876 +:10DCC00020306BB9401CC0B28242F7D8002002E07D +:10DCD0008A88104480B209680029F9D1FFF706FF4D +:10DCE000002070BD70B5224D286800280AD000249D +:10DCF00004E02046FFF7C4FF641CE4B22868007A01 +:10DD0000A042F6D870BD70B5194E054600243068A3 +:10DD100000B9FFDF3068017AA94204D9406850F8A1 +:10DD2000250000B1041D204670BD70B5104E05469B +:10DD30000024306800B9FFDF3068017AA94206D9B3 +:10DD4000406850F8251011B131F8040B44182046F2 +:10DD500070BD19B10A68026008607047044909681B +:10DD6000F8E7006809B10860704701490968FAE7F7 +:10DD70005C00002070B5044600780E4601281AD0D9 +:10DD8000072802D00C281AD115E0A068216905786F +:10DD90000B2D0CD0052003F0CCFD052D0FD07823E2 +:10DDA00000220520D4F8101003F026FD07E07823A8 +:10DDB00000220620F8E70520216903F0BAFD31466C +:10DDC0002046BDE8704001F0BDB910B500F1390240 +:10DDD000C3799478411D64F003042340C371DB07C9 +:10DDE0000DD04B79547923404B710B791279134044 +:10DDF0000B718278C9788A4200D9817010BD0022E7 +:10DE00004A710A71F5E74178012900D00C210170AF +:10DE100070472DE9F74F86B000208C698DF800001F +:10DE20000878012617460D464FF0070B4FF01109F1 +:10DE30004FF00A0A2A2878D2DFE810F02A001A03E5 +:10DE400058036D03A703B603D203FF03160440046F +:10DE500068048704A004DD04EE04110519053905E2 +:10DE60005E058905AC05D705F505FF0521063206D7 +:10DE7000440676069806EA0621072F075A077A070E +:10DE80008E079F07D80710083C08F807FC07020810 +:10DE900014B120781D2829D0D5F808805FEA080041 +:10DEA00043D001208DF80000686A049003208DF8AB +:10DEB00004008DF805A0286A0290A8880028EFD0F9 +:10DEC00098F8001091B10F2910D27DD2DFE801F04F +:10DED0007C144BDCFEFDFCFBFAF9F8089EF7F6001B +:10DEE000022822D124B120780C2801D0002676E324 +:10DEF00002208DF80000B7E10620696A03F019FDE1 +:10DF0000A8880728EDD1204601F017F9022809D08A +:10DF1000204601F012F9032808D9204601F00DF936 +:10DF2000072803D20120207005E016E2002CB7D0AC +:10DF300020780128D5D198F80400C11F0A2902D3FE +:10DF400085F81CA093E2A070D8F80010A163B8F87F +:10DF50000410A18798F8060084F83E00012028707C +:10DF60000320207046E00728BBD1002C98D02078F1 +:10DF70000D28B6D198F8031094F83B20C1F3C000E7 +:10DF8000C2F3C002104201D00E2000E00F2089072A +:10DF900007D198F805100142D2D198F80610014235 +:10DFA000CED194F83D2098F8051020EA02021142E3 +:10DFB000C6D194F83E2098F8061090430142BFD194 +:10DFC00098F80400C11F00E04FE20A29B8D2617F2F +:10DFD000814201D90620C9E3D8F800106160B8F881 +:10DFE0000410218198F80600A072012028700E20EC +:10DFF000207003208DF80000686A049004F1390055 +:10E000000190601D029017300390E1E0B5F806B072 +:10E0100041288FD1204601F090F8042802D1E07801 +:10E02000C00704D1204601F088F80F289CD1CBF11D +:10E030004002164608F10101606A0CF0FBFE606ABE +:10E040005A463044E9680CF0F5FE0E208DF80000C9 +:10E05000686A0490606A019000216846FFF78AFEB2 +:10E060002078042808D0A07F48B1012807D00328D1 +:10E0700008D010202070A2E00520207015E284F85E +:10E08000009033E71220F5E71128C2D1204601F0B5 +:10E0900054F8042802D1E078C00719D0204601F0D6 +:10E0A0004CF8062805D1E078C00711D1A07F0228DE +:10E0B0000ED0204601F041F8112808E0B9E089E0CF +:10E0C000A1E178E158E110E1EFE0D5E01DE0A0D159 +:10E0D000102208F1010104F148000CF0ABFE607859 +:10E0E000012809D012202070E078C0076BD0A07FF3 +:10E0F000A0B3012863D066E0607FA17888423FF634 +:10E1000069AF00BF84F800B059E011288ED12046D5 +:10E1100001F013F8082804D0204601F00EF8132867 +:10E1200084D12869D8B16869C8B104F17800102297 +:10E1300008F1010106460CF07DFE2078082812D077 +:10E1400014202070E078C0070FD0A07F022818D0DC +:10E150006178022912D0032831D034E02FE000206A +:10E160008DF80000F9E00920EBE70B202870296901 +:10E1700002204870206CC1E9010695E208B101282F +:10E1800079D10B202870296908204870606A48609E +:10E19000206AC1E902067BE2206CE2780068C2F3E3 +:10E1A0004402521ED04000F0010040F0800000E028 +:10E1B00000200874E06A48617FE20646FEE304201E +:10E1C00028700520EBE185F800A08DF800A0B9E3E8 +:10E1D0003946F4E31128C5D1204600F0AEFF0A28E5 +:10E1E00002D1E078C00704D1204600F0A6FF152830 +:10E1F000B8D1102208F1010104F148000CF01AFE18 +:10E2000020780A2810D01620207012202870296942 +:10E2100004F1580081F801A048602030886010386F +:10E22000C860206C0861AFE30B202070E1E2287029 +:10E23000D4E1022896D1204600F07FFF042804D3C1 +:10E24000204600F07AFF082809D3204600F075FF29 +:10E250000E2887D3204600F070FF12287DD2A07FC1 +:10E260000228B8D18DF80090686A049098F80100EF +:10E270008DF80400FEE367E20228ACD1204600F0EE +:10E280005CFF002869D0204600F057FF0128F9D034 +:10E29000204600F052FF0C28F4D005208DF8040031 +:10E2A00098F801008DF805005CE71128FCD1002CDE +:10E2B000FAD020781728F7D16178E06A022912D0C5 +:10E2C0005FF0000101EB4101182606EBC1011022AD +:10E2D000405808F101010CF0ADFD0520696A00F01D +:10E2E0001FFF267002E60121ECE70B28DCD1002C91 +:10E2F000DAD020781828D7D16178E06A02292DD0A9 +:10E300005FF0000101EB4101102202EBC101415815 +:10E31000B8F8010008806078E16A022821D0002066 +:10E3200000EB4002142000EBC2000958404650F8B0 +:10E33000032F0A60406848600520696A00F0F0FE1B +:10E340006078022810D04FF000002044407A20F07E +:10E3500001010CD14FF001000BE0D3E14FF00101BE +:10E36000D0E74FF00100DBE74FF00100EDE74FF0A1 +:10E3700000002044417281E3112895D1002C93D0F4 +:10E380002078192890D16178E06A022911D0002103 +:10E3900001EB41011C2202EBC1011022405808F19F +:10E3A00001010CF047FD0520696A00F0B9FE1A2052 +:10E3B000E9E00121ECE7082898D1002C98D02078DA +:10E3C0001A2893D1E16A98F801000870E16AD8F838 +:10E3D000022041F8012FB8F8060088800520696AFC +:10E3E00000F09EFE6078022807D04FF00000204425 +:10E3F000407A20F002002CD034E04FF00100F6E724 +:10E40000214448723AE31128B7D1002CB7D02078C4 +:10E410001B28B2D16178E06A02291DD05FF00001AB +:10E4200001EB4101202202EBC1011022405808F10A +:10E4300001010CF0FFFC0520696A00F071FE6078B4 +:10E4400002280CD04FF000002044407A20F0040055 +:10E4500008D14FF00101D3E74FF00101E0E74FF0A1 +:10E460000100F1E74FF00001CAE785F81CB0F4E3C2 +:10E470003878012886D11C2204F11C0079680CF040 +:10E480001EFDE079C10894F83B0001EAD001E07874 +:10E4900061F30000E070217F09B1297732E1217832 +:10E4A00003290AD0C0073FF4E6AD032028708DF899 +:10E4B00000A0686A04904120A7E302262671E17952 +:10E4C000204621F0E001E171617A21F0F0016172F2 +:10E4D000A17A21F0F001A172FFF777FC2E708DF880 +:10E4E00000A0686A04908DF804B071E638781228AC +:10E4F000D4D18DF800B0696A049191680291ADF8A9 +:10E5000004B008466168016021898180A17A817127 +:10E5100004202070AEE23878B7F806801228BDD10A +:10E520008DF800B0686A0490381D01AB07C883E815 +:10E5300007004120ADF8040008460C2100F8011B3B +:10E54000C8F140063246216A0CF074FC206A42464B +:10E550008119F8680CF06EFC00216846FFF70AFC90 +:10E56000E07820F03E00801CE0702078052801D083 +:10E570000F2008E0A07F00283FF4C4AD0128FBD0A5 +:10E58000032870D108202070B0E43878032885D1A2 +:10E5900078680168A1664068E066052028708DF8FB +:10E5A0000000686A049013E638780328A0D17868E0 +:10E5B0000168216740686067206C68B9A07F28B156 +:10E5C000012803D0062028700420E8E785F800B071 +:10E5D000FE482064606401E085F800B00326F0E3A3 +:10E5E0003878022884D13879E0BBA07F02280BD08C +:10E5F0000328F1D1607801280BD0A07994F83A1063 +:10E6000001280AD0F1480BE0B86800287AD02064CD +:10E6100011E0A17994F83A00F2E7B8680028F5D043 +:10E620002064E078C00701D0012901D0E74802E06A +:10E63000F8680028EAD06064CEE78DF800A0696A27 +:10E640000491E1785046C90709D06178022903D1C5 +:10E65000A17F29B1012903D0A17F032900D008207F +:10E66000287046E101E1BFE0387812288FD1B86800 +:10E67000286209202870E0782969C0070DD0082099 +:10E680004870206A4860606A886004F16800C86069 +:10E69000A07F02287FF48CAD7EE502204870206CBC +:10E6A000486004F16800886004F13800C860201DEB +:10E6B0000861206B4861606B88612EE2E1783878F0 +:10E6C000C90701D0072100E00B2188428AD12078B8 +:10E6D000072818D084F800908DF800B0686A04907C +:10E6E000286A0290ADF80490032100F8011B5168DC +:10E6F00010220CF09FFB00216846FFF73BFB002037 +:10E700002862BEE44CE208202070E5E73878122841 +:10E71000ACD18DF800B0686A049090680290ADF8B2 +:10E720000490042100F8011B102204F168010CF090 +:10E7300081FB00216846FFF71DFB2078092801D0E6 +:10E74000132020E784F800A016E0E1783878C907A4 +:10E7500001D0072100E00B21884287D1102204F16B +:10E76000480079680CF03AFB10B104202877B1E337 +:10E77000207809283FF4BFAC0C2058E5E078C107A9 +:10E7800037D0A17F012902D002291BD02EE00D2015 +:10E79000287029690B2048706078012809D0206A08 +:10E7A0004860606A886004F16800C86010300861E1 +:10E7B00000E5606A4860206A886004F17800C860FB +:10E7C0001038F4E7C0F3440114290FD24FF0006170 +:10E7D00001EBB0104FEAB060E0706078012803D020 +:10E7E00010202070042061E10620CCE6607801282A +:10E7F00087D00E201BE538780A2889D185F800A03B +:10E8000010208DF80000686A049050680190002183 +:10E810006846FFF7AFFAE9E7E078C0070AD0A07FC3 +:10E82000012803D10F202870042041E11020287016 +:10E830000F203DE115202870296903204870206CC5 +:10E8400048606078012805D004F1780088601038AD +:10E85000C86062E104F1680088601030F8E7387839 +:10E860000228CAD138790028E0D0287730E33878F8 +:10E870001428FBD185F80090296909204870786830 +:10E880004860607801280DD004F16800886010307D +:10E89000C860206B0861606B486104F158008861B2 +:10E8A000A06A22E004F1780088601038F0E7387838 +:10E8B0000828DBD16078012801D0132043E2A17839 +:10E8C000A06A0844C1F110010CF02BFB1220287043 +:10E8D000296904F1580081F801A04860203088605F +:10E8E0001038C860206C086147E0C861E06A0862BF +:10E8F00013E18DF80490DFE038780928B6D11022B2 +:10E9000004F1480079680CF069FA08B10B202DE792 +:10E9100020780B2812D02046FFF757FAA178A06A7A +:10E920000844C1F110010CF0FCFA162028700820F0 +:10E930008DF80000686A049000206FE013202870B2 +:10E940008DF800A0686A04908DF8049040E438784F +:10E9500012288BD1B868286214202870296904F124 +:10E96000580081F801A04860103088601030C860FD +:10E97000606C08616078012806D004F139004861B4 +:10E98000206B8861606BB0E7601D4861606B8861D7 +:10E99000206BAAE7387809288BD18DF800B0686A17 +:10E9A0000490286A0290ADF804900D2100F8011B34 +:10E9B000102279680CF03EFA002101E077E27CE059 +:10E9C0006846FFF7D7F90020286201E06AB5010028 +:10E9D0006178012901D01520D5E51621297008217B +:10E9E0008DF80010696A049118E038780C2885D1F8 +:10E9F000162028706078022802D12046FFF7E5F93A +:10EA0000A07879680A18C0F1100110460CF089FA54 +:10EA100008208DF80000686A049078680190A0785A +:10EA20008DF8080061E53878102892D1E079C007A8 +:10EA300079D01720287009203AE03878112888D139 +:10EA40001422391D04F11C000CF039FAE16A208D02 +:10EA5000A1F80900E16AA078C871E179E26A01F0E1 +:10EA600003011172E16A627A0A73E16AA07A81F89D +:10EA7000240000E045E26078012876D0B4E16078B7 +:10EA8000022801D0012000E000202044407AC00785 +:10EA900004D0E078C00701D1192054E11E206CE6B3 +:10EAA000387812287CD1B86828621A20287005208E +:10EAB0008DF80000686A049011466846FFF75AF91D +:10EAC000FFF77BBB387803286AD16078E16A0228B7 +:10EAD00001D0012000E0002000EB4002142000EBF8 +:10EAE000C20289587A6813680B6052684A601B2119 +:10EAF0002970D5E9041206234B70636A4B6066786F +:10EB0000E36A022E01D0012600E0002606EB46064D +:10EB100000EBC6001858C1E90202686A486206980C +:10EB200000F027FBCCE788E138780F2838D16078EF +:10EB3000E26A022801D0012000E0002000EB400042 +:10EB4000102101EBC00002231058093279680AF045 +:10EB50006DFC1C202870296905204870206A4860D7 +:10EB6000E06A09308860FA4872E65BE138780E287E +:10EB700016D16178E06A022901D0012100E000216C +:10EB800001EB4101182606EBC101A27840587968D3 +:10EB90000CF050F96178E06A022902D0012101E00D +:10EBA000B8E0002101EB410106EBC1014158A0781A +:10EBB0000A18C0F1100110460CF0B3F98DF800B03E +:10EBC000686A0490286A0290ADF8049006210170EA +:10EBD0006278E16A022A01D0012200E0002202EB01 +:10EBE000420206EBC202401C895810220CF022F9A6 +:10EBF00000216846FFF7BEF8002028621D2028701B +:10EC00008DF800A0686A04900B208DF804006CE475 +:10EC1000387812287ED18DF800B0686A0490906828 +:10EC200002900B20ADF80400029880F800B06278E2 +:10EC3000E16A022A01D0012200E0002202EB420236 +:10EC4000102303EBC20289580988A0F801106178EB +:10EC5000E26A022902D0012101E03BE1002101EB3F +:10EC60004103142101EBC30151580A6840F8032FF6 +:10EC70004968416000216846FFF77CF80EE760783C +:10EC8000022801D0012000E000202044407A8007C3 +:10EC900001D51F2057E021206FE53878122839D19F +:10ECA0008DF800B0686A0490B8680290ADF80490DE +:10ECB000082606706278E16A022A01D0012200E08B +:10ECC000002202EB42021C2303EBC202401C8958C3 +:10ECD00010220CF0AFF800216846FFF74BF8202017 +:10ECE00028708DF800A0686A04908DF804605AE4DA +:10ECF000387812280ED18DF800B0686A04909068B8 +:10ED000002900820ADF80400029809210170E16921 +:10ED1000097800E093E04170E16951F8012FC0F8F3 +:10ED200002208988C18000216846FFF723F8B2E7F6 +:10ED30006078022801D0012100E000212144497AB5 +:10ED4000490706D5222028708DF800A0686A049033 +:10ED5000CFE5012848D067E0387812286FD1B8682D +:10ED6000286223202870296905204870206A48609D +:10ED7000E06A0930886077486AE538780E285ED105 +:10ED80006178E06A022901D0012100E0002101EB55 +:10ED90004101202606EBC1014058516810220CF0B9 +:10EDA00049F88DF800B0686A0490286A0290ADF8BE +:10EDB000049080F800A06278E16A022A02D0012261 +:10EDC00001E0A4E0002202EB420206EBC202401C7A +:10EDD000895810220CF02EF800216846FEF7CAFF71 +:10EDE000002028626078B4E72420C6E46078022816 +:10EDF0000BD000202044407AC10702D0E178C90737 +:10EE000005D0810705D519209BE40120F2E71720E2 +:10EE100097E4400701D51B2093E41C202070607804 +:10EE2000012801D01820A8E42720A6E42820287073 +:10EE30000B203DE6387813284AD129209DE40CE0C8 +:10EE40002078012844D00C2842D02046FEF7DBFF72 +:10EE50000C208DF80000686A049039E038784FF093 +:10EE60002608122805D013201070032685F800808C +:10EE70004DE08DF800B0686A0490B86802900220F6 +:10EE8000ADF80400029805210170297F417000212E +:10EE90006846FEF76FFF0B208DF80000686A04904B +:10EEA00039466846FEF766FF064685F80080012E63 +:10EEB0000ED02CE001208DF80000686A0490042038 +:10EEC0008DF80400287F8DF805000020287712E0D7 +:10EED000287F80B11D202070252028708DF800A08B +:10EEE000686A049002208DF8040039466846FEF7EF +:10EEF00041FF06460BE00CB1FE2020709DF800009B +:10EF000028B100216846FEF735FFFEF7EFBF09B0D4 +:10EF10003046BDE8F08F2DE9F04F0C4601274E69D1 +:10EF2000097885B09046BA464FF00209072021B112 +:10EF300001294FD0022920D1C9E0217901290BD024 +:10EF4000022916D0032911D0042916D11CE0000093 +:10EF500062B501009CB40100707801280CD1062034 +:10EF6000616A02F0BFFC002807D11AE01D20307052 +:10EF700017E07178022901D0052796E031780C2935 +:10EF800027D18DF804000EE03078011F042902D348 +:10EF90000E3803281DD2B07F02281AD120890228FA +:10EFA00017D38DF8049084F800A020899DF80410F0 +:10EFB000884203D20A208DF800003FE01221083475 +:10EFC00088F8001094E80E00C8E901120327C8F879 +:10EFD0000C306AE098F80010122966D18DF8000014 +:10EFE000616A0491D8F80850029521794FF00B0B13 +:10EFF000012906D0022929D0032911D0042954D18E +:10F000005AE0ADF8049085F800B0207E4F4600F03D +:10F010001F00687000216846FEF7ACFE377043E0C1 +:10F02000ADF8049005202870207E68704E460021BF +:10F030006846FEF79FFE26708DF800B0606A049067 +:10F0400041466846FEF796FE07462EE0ADF80400FE +:10F0500085F800A0207F6870607F00F00100A87034 +:10F06000A07F00F01F00E870E17F2971C0071FD06A +:10F0700094F8200000F00F00687194F8210000F06F +:10F080000F00A87100216846FEF774FE2868B0637F +:10F09000A888B087A87986F83E00A0694078707784 +:10F0A0002879B0700D2030700027384605B030E761 +:10F0B0000020A8716871E5E7ADF804900E20287073 +:10F0C000207E687000216846FEF754FEECE7FE20C3 +:10F0D00030708DF800A0606A049004208DF8040060 +:10F0E000207E8DF80500EDE700B50023012285B0F4 +:10F0F00005280FD006280BD102208DF8002004919E +:10F100008DF804008DF8053000216846FEF732FEC8 +:10F1100005B000BD8DF8002004918DF80420F1E7C2 +:10F1200070B50C46054602F004FC21462846BDE8B1 +:10F1300070407823002202F05FBB08B1007870476E +:10F140000C20704770B50C0005784FF000010CD012 +:10F1500021702146F4F70EF973482178405D88420A +:10F1600001D1032070BD022070BDF4F703F9002027 +:10F1700070BD027B032A05D000220A704B780C2B4D +:10F1800002D003E0042070470A770A62027B9300F2 +:10F19000521C0273C15003207047F0B585B00F4672 +:10F1A00005460124287B05EB800050F8046C70783C +:10F1B000411E0D290AD25C493A46123101EB80000A +:10F1C000314650F8043C2846984704460CB1012CBF +:10F1D00011D1287B401E10F0FF00287301D00324BA +:10F1E000E0E70D208DF80000706A04900021019680 +:10F1F0006846FFF7A7FF032CD4D005B02046F0BD2A +:10F2000070B515460A46044629461046FFF7C5FF65 +:10F21000064674B12078FE280BD1207E30B1002044 +:10F220002870294604F10C00FFF7B7FF2046FEF7CF +:10F23000EAFD304670BD704770B50D460446882122 +:10F240000BF091FE012D03D0022D03D0052070BDDF +:10F25000012000E0022060702046FEF7D4FD00206F +:10F2600070BD28B1027E1AB10A4600F10C01C7E751 +:10F270000120704730B5044687B00D46062002F0E5 +:10F2800058FB2946052002F054FB2078FE2806D0C2 +:10F2900000208DF8000069462046FFF7E2FF07B026 +:10F2A00030BD7FB50E4600218DF80C1041780C2939 +:10F2B00003D00D2903D0002405E0846900E04469EF +:10F2C0000CB1217E91B16D4601462846FFF751FFF2 +:10F2D000032809D1324629462046FFF791FF9DF8C1 +:10F2E0000C10002900D0042004B070BD04F10C05FE +:10F2F000EAE710B590B00C4607900B480521801E38 +:10F3000008900A488DF8191009900F92694606A8CE +:10F31000FFF7C7FF002805D11022204601990BF006 +:10F3200089FD002010B010BDA2B4010062B501003B +:10F3300070B50D46040011D085B1210128460BF0AF +:10F34000F0FD10224E4928460BF074FD4C48012177 +:10F350000838018044804560002070BD012070BDE8 +:10F3600070B5474E00240546083E10E07068AA7B41 +:10F3700000EB0410817B914208D1C17BEA7B914272 +:10F3800004D10C2229460BF029FD30B1641C3088D1 +:10F390008442EBDB4FF0FF3070BD204670BD70B58E +:10F3A0000D46060006D02DB1FFF7DAFF002803DB7B +:10F3B000401C14E0102070BD314C083C208862884D +:10F3C000411C914201D9042070BD6168102201EBFB +:10F3D000001031460BF02EFD2088401C2080287044 +:10F3E000002070BD70B514460D0018D0BCB10021CE +:10F3F000A170022802D0102811D105E0288870B130 +:10F400000121A170108008E02846FFF7A9FF00281D +:10F4100005DB401CA070A8892080002070BD012061 +:10F4200070BD70B5054614460E000BD0002030703C +:10F43000A878012808D005D91149A1F108010A8846 +:10F4400090420AD9012070BD24B128782070288804 +:10F45000000A5070022008700FE064B14968102261 +:10F4600001EB0011204610390BF0E4FC28782073E2 +:10F470002888000A607310203070002070BD0000E2 +:10F48000680000202DE9F041FE4C207EE17D88429D +:10F4900008BFBDE8F0810126FB4D0027E07D215C1F +:10F4A00001EB810205EB8200037C052B10D0037C6D +:10F4B000062B1BD0037C072B27D0437C012B18BFC6 +:10F4C000FFDF30D0207EE17D8842E7D1BDE8F081CA +:10F4D0000674E07D16281ABFE07D401C0020E07510 +:10F4E000481CC0B255F8222002210CE00674E07DD1 +:10F4F00016281ABFE07D401C0020E075481C55F816 +:10F500002220C0B203219047DCE70674E07D162874 +:10F510001ABFE07D401C0020E075481CC0B255F8C1 +:10F5200022200821EFE74774E07D16280EBF002057 +:10F53000E07D401CE075481CC0B255F82220072130 +:10F54000E1E770B5D14E00240C2086F82900A6F51D +:10F550003B70254680F8CD4180F8CC4100F5F47031 +:10F560000476C47506F12C000AF0B2FDA6F58E7083 +:10F57000057586F82B50601EB06086F8255086F819 +:10F58000225086F8235086F8245086F82150C0482F +:10F5900005704570A6F1E80004EB840100EB8101E1 +:10F5A0000D74611CCCB20B2CF6D30120F9F726FBAD +:10F5B0000020F9F723FB012086F82600F9F7D2FF97 +:10F5C000B448F9F7DEFFB44C2070B448F9F7D9FF1E +:10F5D0006070BDE87040F9F7A5BA10B5F9F7D0FA38 +:10F5E000AD4C2078F9F7E6FF6078F9F7E3FFA74C18 +:10F5F00094F82800002808BF10BDF9F7CAFC0020C5 +:10F6000084F8280010BD0B20704770B5F9F79BFBFC +:10F610009E4C054694F8260000281CBFFFDF70BDF5 +:10F6200094F82B00002808BFFFDF6FF07F4260696D +:10F630000026291AB1F5800F24BF431BB3F5800FB4 +:10F640000DD38A4203D2101A2844411C07E09A4283 +:10F6500028BFFFDF05D2511B0844401C414200294E +:10F6600000DBFFDF012584F8265084F82B6094F836 +:10F6700029100420844A01EB810102EB8101087406 +:10F68000A068B0F1FF3F04D0A81EA0600120F9F7E8 +:10F69000B5FA0020F9F7B2FAF9F796FA0AF0A6FEE1 +:10F6A000F9F7DAFB7E48066006604FF0E0214FF480 +:10F6B0000040C1F88002F3F780FC7548007802280A +:10F6C00004D0032805D194F8230010B184F8225007 +:10F6D00001E084F82260BDE87040F9F7A1BB034661 +:10F6E00069490B2000EB800201EB820212F8042C26 +:10F6F00022B1401E10F0FF00F4D1704700EB8002F1 +:10F7000001EB8201012241F8143C01F8042C7047FE +:10F71000012804D0032808BF002926D000E021B327 +:10F720005A4B4FF0000C83F821C0594A00289070C2 +:10F7300014BF022882F803C00BD0072915D2DFE8D6 +:10F7400001F01404060C0E1012001B2000E03A20F9 +:10F75000D070012083F8210070475820F8E7772007 +:10F76000F6E79620F4E7B520F2E700207047484816 +:10F7700010B54078F9F779FB80B210BD421E10B584 +:10F78000414900EB800001EB80040A2A02D814F8FA +:10F79000040C00B9FFDF14F8040C012818BFFFDFC8 +:10F7A000002004F8040C10BD70B53E4C94F8CD0157 +:10F7B00094F8CC1188420CBF01250025F9F7C3FA53 +:10F7C000F9F753FB94F8CD1194F8CC2191420CBF7A +:10F7D00001210021A942E9D170BD2DE9F05F8046E9 +:10F7E0004B1E1746DCB2284804EB840200EB82056E +:10F7F0002E1D287CDFF88C9007282DD199F8170052 +:10F80000002299F818C0844524D000BF19F800C020 +:10F81000A44508BF012200D04AB116280CBF4FF002 +:10F82000000C00F1010C19F80CC009F800C01628F2 +:10F830000CBF0020401CC0B299F818C08445E5D127 +:10F8400042B199F818204846002A0EBF1622027EBF +:10F85000521E0276012028740A2B10D80A4801EBA8 +:10F86000810100EB810010F8040C40B1287C0128D4 +:10F8700006D0287C012802D0B87A012816D0FFDFF4 +:10F88000B87A11E0BC0B0020D80B0020C00C00207F +:10F890007A000020A51601007800002085F4000001 +:10F8A00000F50040D409002001284AD1FE49287CF7 +:10F8B000022816D099F8180016284AD099F818008E +:10F8C00099F81710401C884200D1FFDF01206874AE +:10F8D00099F8180009F8004099F8180016283DD04A +:10F8E0003EE0DFF8C8C39CF829000246A04207D0DA +:10F8F000024600EB820001EB8000807CA042F7D141 +:10F900009CF8293083420CD19CF8292002EB82021A +:10F9100001EB8202927C8CF8292001228CF82A20AB +:10F9200009E000EB800301EB830302EB820201EBB1 +:10F9300082029B7C937400EB800001EB80000C2220 +:10F940008274387A062825D2DFE800F012211E1BC7 +:10F95000181599F817000028B8D1B6E7002002E082 +:10F9600099F81800401C89F818000020BDE8F09FA5 +:10F970004FF0000A11E04FF0B40A0EE04FF0730AA6 +:10F980000BE04FF0320A08E04FF00A0A05E04FF0B2 +:10F99000060A02E0FFDF4FF0000A3868A0EB0A0019 +:10F9A0003060397A00290CBF04210221401A20F06E +:10F9B0007F423260D7E90001084420F07F40706048 +:10F9C000B87A022818BF387B7ED1387A00280CBF5D +:10F9D0000420022000EB0A037868591D00EB010B9C +:10F9E000B3484078504503D9B04991F8231011B17C +:10F9F0000BF1060003E0A0EB0A005844801DAB4960 +:10FA000091F829C0BCF10C0F24D08E4691F8291032 +:10FA100001EB810CA44901EB8C0CDCF804C06245BD +:10FA200018D0DFF890C29EF8292002EB820201EB89 +:10FA300082014A688968A2EB080222F07F42A1EBAA +:10FA4000080121F07F41904298BFB2F5800F49D262 +:10FA50008C4547D34044A0EB0B0020F07F41316040 +:10FA60001944F86821F07F410A1A6FF07F43B2F51C +:10FA7000800F24BFA0EB010CBCF5800F0DD3934287 +:10FA800003D2181A0844421C07E0634528BFFFDF71 +:10FA90001FD2591A0844401C4242002A19DD052091 +:10FAA000287499F8180016282DD099F8180099F89C +:10FAB0001710401C884200D1FFDF99F8180009F8A0 +:10FAC000004099F8180000E00BE016287FF448AFDA +:10FAD00044E73068ABF10501084420F07F407060D6 +:10FAE000002030727068401D20F07F407060787A8E +:10FAF000B072387A0627707203280DD260B101F017 +:10FB000023FB28B108E099F817000028D5D1D3E7E6 +:10FB1000CAF138074FF0320A65480178012918BF49 +:10FB200003290AD14078504507D9604991F823103C +:10FB3000002904BFA0EB0A0007445E4B3068A0EB2D +:10FB40000802706822F07F41A0EB080020F07F4C93 +:10FB50008F4298BFB1F5800F1CD263451AD3534929 +:10FB600091F829300C2B32D091F829704FF00C0B02 +:10FB70004FEA0B0A4C4907EB870301EB8303D3F8E9 +:10FB800008C0ACEB080C944531D8BB469F7C0C2FC9 +:10FB9000F0D199E00520287499F81800162811D0A2 +:10FBA00099F8180099F81710401C884200D1FFDF1F +:10FBB00099F8180009F8004099F8180016287FF401 +:10FBC000CFAECBE699F817000028F1D1EFE702207D +:10FBD000287491F829000C2818BF91F82900A874FE +:10FBE00081F82940012081F82A00BDE8F09F0C2F00 +:10FBF0001CBFBA46002267D00AEB8A0301EB8303DD +:10FC0000D3F804C0ACEB080C844528D29A7B96F854 +:10FC10000AC094451CD30520287499F818001628AA +:10FC200011D099F8180099F81710401C884200D19B +:10FC3000FFDF99F8180009F8004099F81800162815 +:10FC40007FF48EAE8AE699F817000028F1D1EFE72D +:10FC500093F812A00122BAF10C0FCDD103E0002AD3 +:10FC600008BFBA4630D03E460F4806EB860200EB8E +:10FC70008208062188F8101099F81800162836D046 +:10FC800099F8180099F81710401C884200D1FFDF3E +:10FC900099F8180009F8006099F8180016280CBFA8 +:10FCA000002099F8180007E0D80B0020C00C0020B5 +:10FCB0007A000020FFFF3F0018BF401C89F81800A1 +:10FCC00098F81260B245CFD10220FE4E287406F19A +:10FCD000E80090F82910B9420ED185F812A080F8FA +:10FCE0002940012180F82A100120BDE8F09F99F8F1 +:10FCF00017000028CCD1CAE70C2F0BD0BBF10C0F9A +:10FD000008BFFFDF0BEB8B0006EB8000847485F8E7 +:10FD100012A0E9E7BBF10C0F08BFFFDF0BEB8B0074 +:10FD200006EB800084740C20A874DDE730B50D4626 +:10FD3000E54A44190021101A71EB010038BFFFDFBA +:10FD4000E2488542C8BFFFDFE1488542B8BFFFDF18 +:10FD5000E0488442A8BFE04804DA002CAABF20464D +:10FD6000DC4830BD201830BD401E70B5C0B200EB7D +:10FD70008001D44800EB8104607B062810D2DFE8C4 +:10FD800000F0030D0B090705002033E0B4200BE061 +:10FD9000732009E0322007E00A2005E0062003E096 +:10FDA000FFDF617B002029B3022108446168084419 +:10FDB00020F07F40F9F759F894F90C50C24A4419E1 +:10FDC0000021101A71EB010038BFFFDFBF488542E8 +:10FDD000C8BFFFDFBE488542B8BFFFDFBD488442D1 +:10FDE000A8BFBD4804DA002CAABF2046B94870BDA0 +:10FDF000201870BD0421D8E72DE9F04F0646B7481A +:10FE000085B00068C005C00D11D0103840B2002880 +:10FE1000B8BF00F00F0000F1E020B4BF90F8140D5F +:10FE200090F80004400908BF4FF0010A01D04FF0DC +:10FE3000000A3078002817BF01283079002005B06B +:10FE400018BFBDE8F08F062810D2DFE800F0030DE0 +:10FE50000B090705002015E0B4200BE0732009E032 +:10FE6000322007E00A2005E0062003E0FFDF3179B9 +:10FE7000002039B15FF0020100EB0109BAF1000F77 +:10FE800006D101E00421F7E79549002081F8270019 +:10FE90006C4602AA2146B068F8F7F4FF9DF90820E5 +:10FEA000F068211D10440122C01C1F28B8BF019218 +:10FEB00008DB03AAF8F7E6FF9DF80C0010B10198E3 +:10FEC000401C0190DDE900100844401D20F07F40F7 +:10FED0000190A1EB090020F07F40009070798DF82F +:10FEE0000A0000980390F8F72EFF0099019B091A69 +:10FEF000181A7C4A21F07F4120F07F40B1F5800F35 +:10FF000010D282420ED3764890F82950009CAB461E +:10FF1000191B21F07F486FF07F41091BA0F1E80712 +:10FF2000049101E0002080E00C2D26D005EB850037 +:10FF300007EB80026FF07F435068011BB1F5800F23 +:10FF400010D3A4EB000CBCF5800F0BD38B4203D273 +:10FF500004990844411C05E063450DD2181A204459 +:10FF6000401C4142002908DA5D48AB46957C90F878 +:10FF700027000028D8D04CE0FFDF5D4525D00BEBF3 +:10FF80008B0007EB80036FF07F429968081BB0F588 +:10FF9000800F12D3A4EB010CBCF5800F0DD382426D +:10FFA00003D204980844401C07E0624528BFFFDFE5 +:10FFB0000BD2521A1019401C4042002805DD9DF852 +:10FFC0000A009A7B904228BF0C460C2D1CBF9DF85E +:10FFD0000A10434A14D000BF05EB850007EB8000F0 +:10FFE00043681B1B23F07F43434509D2837B99421F +:10FFF00028BF8468857C92F8270050B90C2DEBD17E +:020000040001F9 +:100000000098A04205D004EB080020F07F40009447 +:10001000019000990398814206D001EB090020F07D +:100020007F40F8F722FFB06001202D4991F827109A +:10003000002904BF05B0BDE8F08FBAF1000F3FF40E +:1000400023AF05B0BDE8F08F2DE9F04F814687B0B2 +:100050000C4625480AF044F8244901274FF00008CF +:1000600001EB090500287DD0A1F5887898F81400E7 +:10007000002818BFFFDF2078012800F0238200BF8E +:1000800088F810902078022808BFFFDF184E2079EA +:1000900006F10C023072607970723146A068F8F790 +:1000A000F1FE96F90C000F2804DD1F38307330681C +:1000B000401C306096F90C00E168351D0844C01CF6 +:1000C0001F2817E0D80B0020FF7F841E0020A10707 +:1000D00000E05EF80080841E00807BE104ED00E01B +:1000E000C00C0020FFFF3F00EC0C0020B40C0020EF +:1000F000A40B0020B8BF2F6009DB6A462946F8F739 +:10010000C1FE9DF8000010B12868401C28602078CE +:10011000B07288F81470F64D95F8CD0195F8CC11B1 +:10012000884204BF07B0BDE8F08FF24890F829403C +:100130000C2C00F0CF81F8F706FEEF4904EB8402A7 +:1001400001EB82010A7C042A19BF0A7C032A07B04A +:10015000BDE8F08FE94B4A688968121A22F07F42A5 +:10016000081A00E01BE020F07F40062A3CBF07B0E1 +:10017000BDE8F08FB2F5800F24BF07B0BDE8F08F67 +:1001800083423CBF07B0BDE8F08F95F8CD0195F8EC +:10019000CC11884240F0A78107B0BDE8F08FD44E63 +:1001A00096F8CD01162855D096F8CD0196F8CC11C9 +:1001B000401C884200D1FFDF207801284FD0CC4876 +:1001C00090F8CD1101EB810100EB810080F81090D7 +:1001D000207802284BD0C64890F8CD1101EB810160 +:1001E00000EB8105207928726079687205F10C02B4 +:1001F0002946A068F8F746FE95F90C000F2804DDA3 +:100200001F3828732868401C286095F90C00E168A5 +:100210002E1D0844C01C1F28B8BF376009DB6A4682 +:100220003146F8F72FFE9DF8000010B13068401CF1 +:1002300030602078A872AE4991F8CD0116280EBF23 +:10024000002091F8CD01401C81F8CD01AC4809F0A7 +:100250005DFF60E796F8CC010028ADD1ABE715F85B +:10026000010C002818BFFFDF05F8017CA7E7A548AF +:100270000068C005C00D0FD0103840B20028B8BFCC +:1002800000F00F0000F1E020ACBF90F8000490F8FF +:10029000140D400908BFFFDF954890F8CD1101AA61 +:1002A00001EB810100EB8106E068CDF800808DF85C +:1002B00004806946F8F7E6FD9DF904000F28CCBFDD +:1002C000012000200099351D084401900220B072E1 +:1002D0002079307260797072A068C01C1F28B8BF86 +:1002E0002F6009DB6A462946F8F7CCFD9DF800002F +:1002F00010B12868401C2860307A062810D2DFE848 +:1003000000F0030D0B09070500200BE0B42009E005 +:10031000732007E0322005E00A2003E0062001E018 +:10032000FFDF0020217900290CBF042102210844AD +:1003300002907168401D08440199009001440298A0 +:10034000081A05906B4C002084F82700F8F7FBFC96 +:10035000804630600198404420F07F40F06094F87F +:1003600029000C287ED0204690F8291001EB81024C +:10037000A0F1E80101EB82025468009A274622446A +:1003800022F07F42039296F809B090F82950121B90 +:1003900022F07F4A6FF07F42121BA94604920C2D77 +:1003A00027D0554805EB850100EB81036FF07F42B4 +:1003B0005868011BB1F5800F24BFA4EB000CBCF5FD +:1003C000800F0BD38A4203D204990844411C05E0F4 +:1003D00062450DD2111A0819401C4142002908DA61 +:1003E0004448A9469D7C90F827000028D7D04DE0CE +:1003F000FFDF4D4525D0404809EB890100EB810125 +:100400006FF07F438868021B8146B2F5800F24BFDE +:10041000A4EB000CBCF5800F0DD3934203D2049AD9 +:100420001044421C07E0634528BFFFDF09D21A1AB7 +:100430001019401C4242002A03DD887B834528BFF7 +:100440004C460C2D1CBF2B4BA3F1E80116D000BF6E +:1004500005EB850001EB80025068001B20F07F4017 +:10046000504500E026E009D2907B834528BF946880 +:10047000957C93F8270048B90C2DE9D1A74205D007 +:1004800004EB0A0020F07F4027460390039AA7EB75 +:10049000080121F07F41A2EB0802059822F07F427B +:1004A000B1F5800F06D2904204D30298384420F070 +:1004B0007F4030600F4890F8270000287FF442AF5B +:1004C000B9E600BF15F8010C002818BFFFDF05F8DA +:1004D000017CD5E595F8CD0195F8CC11884204BF93 +:1004E00007B0BDE8F08F07B0BDE8F04FF8F798BC53 +:1004F000D4090020C00C0020D80B0020FFFF3F00D3 +:10050000EC0C002004ED00E00020F8F767BB0120B0 +:10051000F8F764BBFD48007870472DE9F0410546C7 +:1005200002282DD0FA4C94F829000C2808BFFFDFD0 +:10053000002784F82670012684F82B6094F829108F +:100540000320DFF8D08301EB810108EB81010874FF +:10055000F8F76DFCD5B1012D39D0032D1CBFFFDF9D +:10056000BDE8F08194F8290094F82910401CC0B22D +:1005700001EB810158F82120BDE8F0410521104729 +:10058000E2480078BDE8F041F9F71AB8207F00286A +:1005900018BFFFDF84F8256000202760F8F72EFBE6 +:1005A000A168B1F1FF3F04D0012300221846F8F7FB +:1005B00069FB94F8290094F82910401CC0B201EBA3 +:1005C000810158F82120BDE8F041012110470120A8 +:1005D000F8F714FB94F8250000281CBFA068B0F1C0 +:1005E000FF3F0DD094F8290094F82910401CC0B2A8 +:1005F00001EB810158F82120BDE8F04106211047A8 +:10060000207F012815D002281FD0032833D00428CA +:100610001CBFFFDFBDE8F08194F820106068012363 +:10062000411A00221846F8F72DFB94F82800B8BBB1 +:1006300037E094F8240028B184F82470F8F7FEFB22 +:1006400084F823602777BDE8F08194F8280018B972 +:10065000F8F776FC84F8286094F8290094F82910BB +:10066000401CC0B201EB810158F8212000219047C5 +:100670002777BDE8F081217B60680123411A0022C1 +:100680001846F8F7FFFA94F8240028B184F824708B +:10069000F8F7D4FB84F8236002202077BDE8F081CE +:1006A00003E0F8F74DFC84F8286094F8290094F8EA +:1006B0002910401CC0B201EB810158F82120002113 +:1006C00090472677BDE8F08110B5914C94F8290049 +:1006D0000C2808BFFFDF94F8290094F82910401C6B +:1006E000C0B28C4A01EB810152F82120BDE81040D4 +:1006F000042110472DE9F05FF8F725FB844C814673 +:100700004FF00C0B94F829000026A4F1E8084FF0F4 +:10071000010A0C282CD094F82910204601EB810105 +:1007200008EB8101097C042922D090F8291001EB03 +:10073000810108EB8101097C032908BFBDE8F09F16 +:10074000754922696069A2EB090222F07F42A0EBA1 +:10075000090020F07F40062A38BFBDE8F09FB2F5BF +:10076000800F28BFBDE8F09F814238BFBDE8F09FF1 +:10077000A068B0F1FF3F18BFFFDF84F8256094F850 +:100780002900664F0C2806D194F8210018B1F8789A +:100790007870B87838705E4890F829000C281ED020 +:1007A0005B4890F8291001EB810108EB8101097C7D +:1007B000042914D190F829B090F8291001EB810197 +:1007C00008EB810181F810A090F8291001EB81015C +:1007D00008EB8101897C80F8291080F82AA0504C10 +:1007E00094F8CD0194F8CC1104F2DF2588424ED064 +:1007F00094F8CC0100EB800004EB8000007C405DAD +:10080000012894F8CC0100EB800004EB800004D0B8 +:10081000007C405D022878D018E0807A01280DD055 +:1008200094F8CC11022001EB810104EB8101097CD9 +:10083000485594F8CC01162820D01BE094F8CC0140 +:1008400000EB800004EB8000007C465594F8CC015E +:1008500000EB800004EB800294F8CC0100EB8000F8 +:1008600004EB8000017C4846FEF7B7FF94F8CC010A +:10087000162803D094F8CC01401C00E0002084F836 +:10088000CC0194F8CD0194F8CC118842B0D1254C1C +:10089000207D70B1207C415D012966D0405D022839 +:1008A0006BD0207D28B1217C1E4A4846FEF795FF7B +:1008B0002675BBF10C0F06D00BEB8B0008EB80000C +:1008C000017C012961D0124C94F829000C2800F019 +:1008D000388194F82A00002800F0428184F82A60C8 +:1008E00094F8290000EB800008EB8003A4F53B702E +:1008F000D3E90112DB68C0F80433C0E9BF12607E9F +:1009000000280CBF042502250EE01CE07800002022 +:10091000C00C0020D80B0020FFFF3F007A00002011 +:10092000D4090020A40B002094F82900C34600EB52 +:10093000800108EB8100407B06284DD2DFE800F003 +:10094000404A4846444294F8CC0100EB800004EB56 +:100950008000807A012818BFFFDF94F8CC0100EBFB +:10096000800004EB8000867268E7A17A01291DBF30 +:10097000022141552675465593E7A07A012818BFF4 +:10098000FFDFA672207C46558BE707210174FE4CE1 +:10099000207E162810D0207EE17D401C884200D1A8 +:1009A000FFDF207E04F800B0207E16280EBF002056 +:1009B000207E401C207686E7E07D0028F1D1EFE71D +:1009C00000200BE0B42009E0732007E0322005E0AE +:1009D0000A2003E0062001E0FFDF00202073617E93 +:1009E000022918BF012911D121690144A1EB090293 +:1009F00022F07F42382A09D903206076A1F1320023 +:100A000020F07F4020613220207309E0322807D295 +:100A100094F8280058B9F8F793FA84F828A006E06B +:100A200094F8280018B1F8F7B4FA84F828607978B7 +:100A300084F8201038780622012818BF032806D130 +:100A400084F824A0207B814284BF081A821D94F878 +:100A50002230002B18BF921C94F82400002808BFF5 +:100A6000002B6AD0D4F810806069A8EB0908DFF881 +:100A70001CC328F07F48A0EB090020F07F404245CE +:100A800098BFB8F5800F41D284453FD3207B884280 +:100A900015D22369A1EB0002A3EB020222F07F42F0 +:100AA0001144294421F07F412261616000280CBF7C +:100AB00001200320207710F0FF0F36D114E00AD96F +:100AC000226900291044284420F07F4060600CBF58 +:100AD00002200420EEE7002B08BFFFDF2069284436 +:100AE00020F07F40606026770120F8F787F800BF8C +:100AF00094F82900012300EB80010BEB8100616871 +:100B000090F90C200020F8F7BDF829E084F8246063 +:100B100084F82260207B0028E0D021690844284422 +:100B200020F07F4060600220207720690123411976 +:100B300000221846F8F7A6F8DAE7207B0028ECD167 +:100B4000CCE70120F8F75AF80020F8F757F8F8F743 +:100B50003BF894F8280018B1F8F71BFA84F82860DD +:100B600094F8220028B1F8F769F984F8236084F832 +:100B7000226094F8210018B1F8787870B87838704D +:100B800094F8240030B184F823603878002808BF36 +:100B900084F824607C48017EC07D814203D07C487B +:100BA0004078F8F70DFD84F827A0BDE8F09F70B5F8 +:100BB000784C054682B094F829000C2808BFFFDF66 +:100BC00094F8290000EB8000734E06EB8000007C57 +:100BD000032818BFFFDFA068B0F1FF3F18BFFFDF99 +:100BE00094F82900002100EB800006EB800001AAA8 +:100BF00090F90C0000918DF8041028446946F8F72C +:100C000041F99DF904000F28CCBF01200020009974 +:100C100008446168084420F07F41A16094F82500F1 +:100C2000002804BF02B070BD012302B00022BDE85D +:100C300070401846F8F726B8584A0B1A02F1010C12 +:100C4000B3EB9C0F3CBF1846704710B5441AB4EB89 +:100C50009C0F3CBF184610BD9A4203D2101A08449C +:100C6000401C10BD94429EBFFFDF002010BD511AF2 +:100C70000844401C404210BD0123002201460220CE +:100C8000F8F700B80220F7F7B9BFF8F75CB8F0B58D +:100C9000404C054683B094F82B00002808BFFFDFC6 +:100CA000642D50D33E490020491B80414BD33D4821 +:100CB00090F8CD1190F8CC01814244D13A48007DA2 +:100CC000002840D194F82900334F00EB800007EB57 +:100CD0008006206801AA28446946F8F7D3F89DF9F0 +:100CE0000400002802DD0098401C0090B2680099C2 +:100CF00073685018C01A20F07F40B0F5800F22D2E0 +:100D0000B07C0C2809D000EB800007EB8000406825 +:100D1000801A20F07F40884215D3A068B0F1FF3FD1 +:100D200005D00120F7F76AFF4FF0FF30A060206880 +:100D300028442060B0680099084420F07F4060613A +:100D400003B00120F0BD03B00020F0BD2DE9F0415B +:100D50000646401EC5B2104805EB850100EB810434 +:100D6000207C002808BFFFDF0E4A92F8CC1192F8D1 +:100D7000CD01814221D000BF01EB810302EB83034F +:100D80001B7CB34220D011E0BC0B0020FFFF3F00D2 +:100D900078000020C00C0020D80B0020FF7F841EAC +:100DA000FF1FA107D4090020A40B002016290CBFA7 +:100DB0000021491CC9B28142DED13A48017D002997 +:100DC00062D0007CB0425FD10020BDE8F081217C80 +:100DD00005291FBF217C0629217C07292CD12774D6 +:100DE000C27D0023017E914218BF014624D000BF7E +:100DF00011F80280A84508BF012300D04BB1162A84 +:100E00000CBF4FF0000802F1010811F8088001F84A +:100E10000280162A0CBF0022521CD2B291F8188010 +:100E20009045E5D143B10A7E002A08BF81F818C079 +:100E300002D00A7E521E0A76617C21B36674C27D9E +:100E40000021037E934224D0835CAB4208BF012182 +:100E500000D029B1162A0CBF0023531CC35C835455 +:100E6000162A0CBF0022521CD2B2037E9342EBD151 +:100E700049B1027E0146002A08BF81F818C008D097 +:100E80000A7E521E0A7604E00127074800264FF02A +:100E9000160C217C012904BF617C002997D1012017 +:100EA000BDE8F081A40B0020BC0B0020F0B5734A14 +:100EB000D2F80032724D002401212E7856B9714EBD +:100EC0003460704F03263F1D3E606E4F04260C3782 +:100ED0003E602970C2F80042D1601160694C48340C +:100EE000D16425688542FBD35160D160C2F80032DD +:100EF000F0BD2DE9F041044680074FF000054FF0AA +:100F0000010604D560480560066024F00204E00490 +:100F10004FF0FF3705D55D484660C0F8087324F4EC +:100F20008054600003D55A48056024F08044E005F1 +:100F30000FD55248C0F80052C0F8087351490D60EF +:100F4000091D0D604F4A04210C321160066124F422 +:100F50008074A00409D54F484660C0F80052C0F81C +:100F600008734D48056024F40054C4F38030C4F382 +:100F7000C031884200D0FFDF14F4404F14D04748FE +:100F80004660C0F8087346488660C0F80052C0F852 +:100F9000087344490D600A1D16608660C0F8087326 +:100FA0000D60166024F4404420050AD53E48466092 +:100FB0008660C0F80873C0F848733C48056024F4A4 +:100FC000006409F0EDF93A48044200D0FFDFBDE8C3 +:100FD000F08170B5202500224FEA020320FA02F1C9 +:100FE000C90719D051B201F01F060124B4404E09BF +:100FF000B60006F1E026C6F88041C6F88042002916 +:1010000006DA01F00F0101F1E02181F8143D03E05F +:1010100001F1E02181F80034521CAA42DED370BDF8 +:1010200070B5174C0D466060FFF763FF6068FFF70F +:10103000D0FF2846F8F761F808F004FE00F0D5F874 +:1010400009F0AEF909F0FBF8F8F78CFABDE870404A +:1010500008F09ABE10B50A4C6068FFF74AFF606856 +:10106000FFF7B7FF09F09CF9F8F70CF90020606072 +:1010700010BD034840687047022070470080004060 +:101080008000002004850040FC1F004000C000409C +:1010900004E5014000D0004004D5004000E00040DD +:1010A00000F0004000F5004000B0004008B50040EE +:1010B000FEFF0FFC70B51F490A68BAB100231D4638 +:1010C00001244A68521C4A60092A00D34D600E79F7 +:1010D00004FA06F20E6816420AD072B60B68934301 +:1010E0000B6062B649680160002070BD052070BDCC +:1010F0005B1C092BE5D3FFDFF8E74FF0E0214FF44D +:101100008000C1F800027047EFF3108111F0010F69 +:1011100072B64FF0010202FA00F20648036842EA92 +:101120000302026000D162B6E7E7024800210160D5 +:1011300041607047880000200120810708607047E7 +:10114000012081074860704712480068C00700D03E +:10115000012070470F48001F0068C00700D0012021 +:1011600070470C4808300068C00700D00120704765 +:10117000084810300068704706490C310A68D203ED +:1011800006D5096801F00301814201D101207047B1 +:10119000002070470C040040C84911F8210F49781D +:1011A000884201D3401A02E0C1F121010844C0B2D3 +:1011B0007047C249233111F8210F4978884201D381 +:1011C000401A02E0C1F121010844C0B27047BB4996 +:1011D000463111F8210F4978884201D3401A02E0C4 +:1011E000C1F121010844C0B27047B54910B5802053 +:1011F00081F80004B1490020233101F8210F487023 +:10120000AE4901F8210F4870AC49463101F8210F71 +:101210004870AC4808F05CFFAA48401C08F058FF32 +:10122000F8F778F8BDE8104000F03DB9202070478D +:10123000B2E770B50C4605460026FFF7ADFF014644 +:101240009E48A14212D30022641EE4B20DD390F84E +:101250002210435C491CC9B205F8013B80F82210FA +:101260002129F1D180F82220EEE7012600F01BF9B8 +:10127000304670BD202070479BE770B50C46054690 +:101280000026FFF796FF01468C482330A14212D377 +:101290000022641EE4B20DD390F82210435C491C76 +:1012A000C9B205F8013B80F822102129F1D180F85C +:1012B0002220EEE7012600F0F6F8304670BD20212E +:1012C00001700020704710B50446FFF780FF2070C2 +:1012D000002010BD70B50C460546FFF778FF0146AB +:1012E00076484630A14213D30022641EE4B20DD3E7 +:1012F00090F82210435C491CC9B205F8013B80F804 +:1013000022102129F1D180F82220EEE7002401E00B +:1013100042F2070400F0C7F8204670BD70B50C46D5 +:101320000546212900D9FFDF67480068103840B220 +:1013300000F0A0F8C6B20D2000F09CF8C0B28642C2 +:1013400004D2FFDF02E000BFF8F734F82146284658 +:10135000FFF76FFF0028F7D070BD2DE9F047DFF8E9 +:101360006481564CA8F101080746233498F8000020 +:10137000DFF84891002604F1230A38B994F82210C6 +:1013800094F82100212200F084F890B14D4699F89C +:10139000221099F82100212200F07BF8B8B15546BF +:1013A0009AF822109AF82100212200F072F848B32E +:1013B00035E094F82100275494F82100401CC0B275 +:1013C00084F8210021282AD184F8216027E095F8AB +:1013D00021002F5495F82100401CC0B285F821004F +:1013E000212801D185F8216098F800004746B0B166 +:1013F00095F8221095F82100212200F04AF870B1EA +:101400003E700CE095F821002F5495F82100401C07 +:10141000C0B285F82100212801D185F8216094F817 +:10142000221094F82100212200F033F800281FD068 +:1014300099F8221099F82100212200F02AF80028BA +:1014400016D09AF822109AF82100212200F021F8F3 +:1014500000280DD0F7F784FF1A4808F041FEB0F5D8 +:10146000005F00D0FFDFBDE8F047164808F04EBE31 +:10147000BDE8F087002806DA00F00F0000F1E02058 +:1014800090F8140D03E000F1E02090F8000440090A +:101490007047401C884204D0904200D109B100201E +:1014A00070470120704710B5064808F019FE002863 +:1014B00003D1BDE81040F7F73EBF10BDF00C00208F +:1014C0000DE000E09100002004ED00E013490878F1 +:1014D0004A78401CC0B2904205D0114B01221A60DC +:1014E000BFF34F8F0870704770B54FF0E0250B4C7D +:1014F000F7F7E6FF20BF40BF20BF6078217861701A +:10150000D5F8001229B9D5F8041211B92178814211 +:10151000EED0F7F7D0FF002070BD00009300002050 +:10152000180502402DE9F041012528034FF0E02184 +:101530000026C1F880011E4CC4F800610C2000F0A8 +:101540002CF81C4801680268C94341F3001142F0BD +:1015500010020260C4F804532560491C00E020BF5B +:10156000D4F80021002AFAD019B9016821F010013D +:101570000160114807686560C4F80853C4F8006149 +:101580000C2000F00AF83846BDE8F08110B504469A +:10159000FFF7C8FF2060002010BD00F01F020121EE +:1015A00091404009800000F1E020C0F880127047AF +:1015B00000C0004010ED00E008C500402DE9F047F4 +:1015C000F84C0646FF21606800EB06121170217886 +:1015D000FF2916D04FF0080909EB011109EB061796 +:1015E0004158C059491E21F07F4100F0DDF918B182 +:1015F00094F80080454614E06168207801EB0611FC +:1016000008702670BDE8F087626809EB0510D159B3 +:10161000105800F0C9F930B96068A84600EB08100E +:101620000578FF2DF0D1606800EB061100EB081083 +:101630000D700670E6E7F0B5DA4B04460020012590 +:101640005A680C261B7A0BE005EB0017D75DA74202 +:1016500004D106EB0017D7598F4204D0401CC0B20A +:101660008342F1D8FF20F0BD70B5FFF70EFBCD4CE3 +:10167000014608252278606805EB0212805800F0C8 +:1016800093F9012808D92178606805EB01114058C9 +:10169000BDE87040FFF7F0BAFEF73CFFBDE87040D0 +:1016A000F7F78EBF2DE9F041BE4C2578FFF7EDFA34 +:1016B0000146FF2D6FD04FF00808626808EB051651 +:1016C000905900F071F90228606801D980595EE0F4 +:1016D00000EB051109782170022101EB0511425C34 +:1016E0005AB1521E4254815901F5000121F07F4147 +:1016F00081512846FFF762FF34E00423012203EB07 +:10170000051302EB051250F803C0875CBCF1000F13 +:1017100010D0BCF5806F10D9CCF3090250F806C088 +:101720000CEB423C2CF07F4C40F806C0C3589A1A90 +:10173000920A09E0FF2181540AE0825902EB4C32FF +:1017400022F07F428251002242542846FFF736FFA2 +:101750000C21606801EB05114158E06850F8272022 +:10176000384690472078FF2815D0FFF78EFA0146BB +:101770002278606808EB02124546805800F014F9A0 +:10178000012891D92178606805EB01114058BDE826 +:10179000F041FFF771BABDE8F081F0B51D4614467F +:1017A0000E460746FF2B00D3FFDFA00700D0FFDF68 +:1017B0007C48FF210022C7604460057206740170F6 +:1017C00042701046012204E002EB0013401CE15479 +:1017D000C0B2A842F8D3F0BD70B5724C0646657829 +:1017E000207C854200D3FFDFE06840F82560607808 +:1017F000401C6070284670BD2DE9FF5F1D468B467A +:101800000746FF24FFF741FADFF89891064699F85A +:101810000100B84200D8FFDF00214FF001084FF06F +:101820000C0A99F80820D9F804000EE008EB01131F +:10183000C35CFF2B27D0BB4205D10AEB011350F844 +:1018400003C0DC4521D0491CC9B28A42EED8FF2C26 +:101850001BD008EB04110AEB0412475440F802B005 +:101860000421029B0022012B01EB041111D04250F4 +:101870004FF4806808234FF0020C454519D9A9059B +:10188000890D08D008E00C46DDE7FF2004B0BDE874 +:10189000F09F4550ECE7414606EB413203EB041361 +:1018A00022F07F42C250691A0CEB0412890A81545B +:1018B0000BE005B9012506EB453103EB041321F0DC +:1018C0007F41C1500CEB0411425499F8005020465E +:1018D000FFF774FE99F80000A84201D0FFF7C4FE9C +:1018E0003846D3E770B50C460546FFF7CEF90646F5 +:1018F00021462846FFF79FFE0446FF2817D0294DB2 +:10190000082101EB041168684058314600F04CF89A +:1019100000F58050400B02216A6801EB0411515C14 +:1019200009B100EB8120002800D1012070BD00200A +:1019300070BD2DE9F0410F468046FFF77CFEFF2881 +:101940001BD0184E357871682A462C4605E0844233 +:1019500006D0254601EB05131C78FF2CF7D10CE0CF +:10196000FF2C0AD0A5420CD101EB02100078307098 +:10197000FF2804D0FFF778FE03E000200BE7FFF715 +:1019800081F939464046FFF7ADFFFF220123716818 +:1019900003EB0413CA5401EB041201EB0511127896 +:1019A0000A70F8E65C0D0020401A20F07F40B0F588 +:1019B000000F00D90020704770B50446A0F5000064 +:1019C0002C4EB0F1786F02D23444A4F500042A48BA +:1019D000844201D2012500E0002500F041F830B139 +:1019E000B4420BD32548006804E0284370BDB442DC +:1019F00004D32348844201D20120F6E70020F4E713 +:101A000010B50446A0F50000B0F1786F03D2194874 +:101A10000444A4F5000400F023F84FF0804130B1F5 +:101A20001648006804E08C4204D2012003E0144808 +:101A30008442F8D2002080F0010010BD10B520B122 +:101A4000FFF7DEFF08B1012010BD002010BD10B56A +:101A500020B1FFF7B1FF08B1012010BD002010BD7B +:101A6000084809490068884201D1012070470020D8 +:101A7000704700000000002000C001001C00002092 +:101A80000800002098000020BEBAFECA0548064A99 +:101A90000168914201D100210160044901200860E0 +:101AA0007047000098000020BEBAFECA40E5014021 +:101AB000404800210170417010218170704770B55D +:101AC000054616460C460220F5F789FC39490120E7 +:101AD00008703949F01E086038480560001F04602E +:101AE00070BD10B50220F5F77AFC3249012008706C +:101AF00033480021C0F80011C0F80411C0F80811E3 +:101B000030494FF40000086010BD2A480178C9B17F +:101B10002D4A4FF4000111602949D1F8003100220B +:101B2000002B1CBFD1F80431002B02D0D1F80811D2 +:101B300011B14270102103E001214170234909686D +:101B4000817002700020F5F74ABC1A48017800291C +:101B500004BF407870471A48D0F80011002904BF2C +:101B600002207047D0F8001100291CBFD0F80411E2 +:101B7000002905D0D0F80801002804BF01207047D3 +:101B8000002070470B480178002904BF8078704717 +:101B90000B48D0F8001100291CBFD0F8041100290F +:101BA00002D0D0F8080108B110207047074800683B +:101BB000C0B270479C00002010F5004008F50040BE +:101BC00000F0004004F5014008F5014000F4004039 +:101BD0003148002101704170704770B506461446C7 +:101BE0000D460120F5F7FBFB2B49012008702B481F +:101BF0000660001D0460001D056070BD2DE9F04108 +:101C000004460120F5F7EBFB234901200870244925 +:101C10000C60244D0026C5F8046123494FF040773D +:101C20000F60A1F1040844B1012C18BFFFDFC5F813 +:101C30000062C8F80070BDE8F081C5F800024FF0FE +:101C40008070C8F80000BDE8F0811348017879B1D0 +:101C5000154A4FF0407111601249D1F8042100215A +:101C6000002A08BF417002D0104A12684270017009 +:101C70000020F5F7B4BB08480178002904BF40787C +:101C800070470848D0F80401002808BF704707488B +:101C90000068C0B2704700009F00002008F50040B7 +:101CA00004F5004000F0004008F5014000F4004059 +:101CB00070B5FE4C002501266570257025626572A1 +:101CC000A572E67284F82950256304F13C00A563EF +:101CD00008F0FEF9002818BFFFDF84F82450F4480C +:101CE00009F062FAF3480660657770BD30B4EF49D9 +:101CF0000268DFF8C8C34A6142688A61007A0877DF +:101D00000A7DED4BACF1040401204AB10A7E00FAD1 +:101D100002F21A608D7D002D0CBF2260CCF80020ED +:101D20004A7D002A04BF30BC70474A7E904018604C +:101D3000C97D00290CBF2060CCF8000030BC704782 +:101D4000DF4900B50A1D40B101281CBFFFDF00BDFF +:101D5000DC480860DC48106000BDDC480860DC48F6 +:101D6000F9E7F0B502264FF0E02701240025C7F877 +:101D70008061D8490D600C60D7490A6822F077026B +:101D800042F0880242F000420A60CD490A1DD0B1FB +:101D9000012818BFFFDF1AD0D04940F25B6008600D +:101DA000091F40F203100860081F0460CC4903209B +:101DB0000860CC4996200860BC4C94F9240010F0CF +:101DC000030F09D033E0C1480860C14802E0BD48B4 +:101DD0000860BD481060DFE780100A300C2826D26A +:101DE000DFE800F021252525251D1915110D0A060E +:101DF000BD49042008601BE0BB48056018E0BA49F3 +:101E0000FC20086014E0B849F820086010E0B649EA +:101E1000F42008600CE0B449F020086008E0B24902 +:101E2000EC20086004E0B049D820086000E0FFDF43 +:101E3000607F002814BF4FF4C020AC48AC49086054 +:101E4000AD49AC480860091FAC480860C7F880621B +:101E5000AB491020C1F80403F0BD944A0368C2F8EE +:101E600002308088D08011727047904890F8290025 +:101E700070478E4A517010707047F0B50D46044699 +:101E800004EB4501908808841078D2F801100127EE +:101E900040EA012044F8250005F1080007FA00F6A1 +:101EA000002B04BF206BB04304D0012B18BFFFDF11 +:101EB000206B304307FA05F108432063F0BD30B5CD +:101EC0000D460446082988BFFFDF0022002D11D9E6 +:101ED00054F82210900000F1804000F58050C0F8C6 +:101EE000001604EB4201098CC0F82016501CC2B247 +:101EF0009542EDD8206B8349086030BD10B504468B +:101F000010F0030F2BD1A0100A300C2827D2DFE8E5 +:101F100000F022262626261E1A16120E0A067249DE +:101F2000042008601CE070490020086018E06E4939 +:101F3000FC20086014E06C49F820086010E06A4951 +:101F4000F42008600CE06849F020086008E0664969 +:101F5000EC20086004E06449D820086000E0FFDF5E +:101F6000524880F8244010BD504890F83400704723 +:101F7000654AC178116000686449000208607047D2 +:101F8000252808BF02210ED0262808BF1A210AD012 +:101F9000272808BF502106D00A2894BF0422062211 +:101FA00002EB4001C9B25A4A11605A4908607047B1 +:101FB0003E49086270473D498A7A012A49D0022A7F +:101FC00018BF70474B7D002B08BF7047DFF848C132 +:101FD000012A42D0CA7D4B7E002A18BF01227D30E3 +:101FE000CCF80000DFF834C10020CCF84C01180216 +:101FF00082F0010240EA025040F00312087F8300A1 +:1020000003F1804303F5C043C3F81025444A02EBB3 +:102010008002887EC30003F1804303F5F833C3F8E0 +:102020001425DFF800C1C3F810C5C97ECB0003F149 +:10203000804303F5F833C3F81425304AC3F810255C +:10204000012202FA00F002FA01F108433649086061 +:1020500070470B7D002BB9D170478A7D0B7E002A1B +:1020600018BF01227E30BBE72DE9F84F00280CBFD6 +:10207000012002200D4C224D0322A072C5F800223F +:10208000627F002A14BF4FF4C022184A264F3A60DC +:102090004FF00108002976D0012973D002291CBF16 +:1020A000FFDFBDE8F88F206A00283FE0700D0020B8 +:1020B000840D0020A0050040180500500C050050BC +:1020C00014150040050103001F0003020601020071 +:1020D00025000302FC1F00403C170040381500405B +:1020E00010150040441500400C1500400000040489 +:1020F00008F5014040800040A4F501401011004067 +:102100000010004040160040241500401C150040FF +:1021100008150040541500404C85004000800040E8 +:10212000006000404C81004004F5014008BFFFDF23 +:10213000216A206B0844FB490860FC49FA480860A2 +:10214000A17AFB4801290EBF0560FA490160A06B26 +:1021500040F40020A063D5F800924FF0100AC5F8B3 +:1021600008A30026C5F80062F3484FF4802BC0F89E +:1021700000B0FF208DF80000C5F81061C5F8108090 +:102180003DE000E01CE0012813D0C5F804800228DF +:1021900018BFBDE8F88F607D002808BFBDE8F88F44 +:1021A000E648C0F84C80E6480068BDE8F84F0A30C1 +:1021B00001E7C5F80080207D0028F1D1BDE8F88F47 +:1021C000E0490128896B07D0022818BFFFDF09D03A +:1021D000BDE8F84F0A20EEE641F48010A0634FF40A +:1021E000801004E041F40010A0634FF40010386048 +:1021F000EEE700BF9DF80000401E8DF800009DF83E +:10220000000018B1D5F810010028F3D09DF80000A7 +:10221000002808BFFFDFC5F80C61C5F81061C5F8DC +:102220000461C5F81461C5F81861C5F82861C6488D +:1022300000680090C5F80092C7F800B0C5F804A384 +:102240004FF400203860216A206BBDE8F84F084445 +:102250000A30B0E62DE9F847BC4CD4F8000220F073 +:102260000309D4F804034FF0100AC0F30018C4F8AF +:1022700008A30026C4F80062B24D687F002814BF8E +:102280004FF4C020B248AC490860A87A0127012861 +:1022900002D0022803D014E0287D10B911E0687D37 +:1022A00078B1A87EEA7E07FA00F007FA02F210433E +:1022B0000860287F800000F1804000F5C040C0F831 +:1022C0001065FF208DF80000C4F81061276104E05C +:1022D0009DF80000401E8DF800009DF8000018B128 +:1022E000D4F810010028F3D09DF80000002808BFA2 +:1022F000FFDFC4F81061C4F828616E72AE72EF722D +:10230000C4F80092B8F1000F18BFC4F804A3BDE8E8 +:10231000F88700688F4920F07F40086070474FF0D1 +:10232000E0200221C0F88011C0F8801270474FF001 +:10233000E0210220C1F8000170478749087070470A +:1023400010B5864807F0CCFE002818BFFFDF10BD8F +:10235000824807F0DBBE82490860704730B5794C8F +:102360000546206BA84228BFFFDF012020732561AE +:10237000607F40B1A81C20617448D0F8001241F081 +:102380004001C0F800126D490020C1F844017549B0 +:1023900020690860A06B744940F48000A0634FF48A +:1023A0008000086030BD674802210173CA210161C5 +:1023B000417F41B1CC2101616449D1F8002242F052 +:1023C0004002C1F800225D4A0021C2F844110269AE +:1023D000016B1144634A1160816B41F48001816398 +:1023E00061494FF4800008607047564901204877E2 +:1023F0005E49022008605F495D480860091F5E4829 +:10240000086070474F490020487770474A494FF4A9 +:10241000800008604B48816B21F4800181630021BA +:1024200001737047454801214160C1600021C0F837 +:1024300044114C480160434801637047414800B56E +:10244000407F002818BFFFDF4020484908603F4810 +:10245000D0F8001241F04001C0F8001200BD394828 +:1024600000B5407F002818BFFFDF3848D0F80012C1 +:1024700021F04001C0F800123C490020086000BD76 +:102480003248D0F8001221F01001C0F800120121EA +:10249000816170472D480021C0F81C11D0F800124E +:1024A00041F01001C0F800127047284981B0D1F8FE +:1024B0001C21012A1EBF002001B070472F4A12685C +:1024C00002F07F02524202700020C1F81C012C4829 +:1024D00000680090012001B0704730B50C0005463F +:1024E00008BFFFDF14F0010F1CBF012CFFDF002D20 +:1024F0000CBF01200220134901284872CC721349F5 +:1025000004BFD1F8000240F0040007D0022807BF42 +:10251000D1F8000240F00800FFDF30BDC1F8000232 +:1025200030BD00004885004048810040A8F50140CA +:10253000ACF501400410004008F501400080004067 +:102540004C850040700D0020181100400010004024 +:10255000000004043C150040A1000020AC0D002048 +:10256000041500404485004004F50140601500401A +:10257000448000409CF5014028110040481500406F +:102580001C11004070B5EB4C0022E17A11F0020FF3 +:1025900018BF10F0040F16D111F0100F1CBF94F8E3 +:1025A0003530002B02D094F8363063B111F0080FAB +:1025B0001CBF94F82830002B05D111F0040F03D074 +:1025C00094F8291001B90122657ADB4900234FF004 +:1025D000010C35B100F00200104314D0BDE870408A +:1025E00038E6607F002814BF4FF4C020D348D44A97 +:1025F0001060D1F8000220F00300C1F80002A372BD +:1026000084F80BC070BD012D14D0022D18BFFFDF60 +:102610001CD0A07A01280CBFCA48CB484FF47A716D +:1026200000F2E730B0FBF1F0216BBDE87040081A12 +:102630008C30C0E4D1F8000220F00400C1F80002A0 +:10264000637284F80BC084F80AC0E2E7D1F8000294 +:1026500020F00800C1F80002637284F80BC0022069 +:10266000A072D6E72DE9F84FB84FD7F84C21B14CFE +:10267000B3494FF00108A07A0026CAB1012802D060 +:10268000022803D014E0227D12B911E0627D7AB1F4 +:10269000A27EE37E08FA02F208FA03F31A430A6004 +:1026A000227F920002F1804202F5C042C2F810651A +:1026B000A26B0A60A663217B19B1D7F844110129E6 +:1026C00000D000219C4DD5F81021012A0CBF4022DA +:1026D0000022012805BFD5F80C31012B002320234F +:1026E0001A43012805BFD5F80431012B002310231C +:1026F0001343974A022804BFD2F800C0BCF1010F6F +:1027000007D1D5F80CC1BCF1010F08BF4FF0080C80 +:1027100001D04FF0000C4CEA0303022804BF1268FA +:10272000002A05D1D5F80C21012A08BF042200D0C7 +:1027300000221A43022803D1002918BF022100D128 +:1027400000211143022804BFD5F80401012805D156 +:10275000D7F84401012818BF012000D1002040EA29 +:1027600001097C48016811F0FF0F03D0D5F814115E +:10277000012900D0002184F83410006810F0FF0F08 +:1027800003D0D5F81801012800D0002084F83500C6 +:102790007148006818B1FFF7D8F9012800D000206F +:1027A00084F83600C5F80C61C5F81061C5F80461FD +:1027B000C5F81461C5F81861C5F828616748006854 +:1027C0000090C7F84461664800684D46DFF8949170 +:1027D0000090D9F80000E062617F00291CBF801ED4 +:1027E000E062614800682063A07ADFF880A10228D7 +:1027F0000CD1607850B1DAF80010097808402178DF +:1028000031EA000008BF84F8288001D084F82860ED +:10281000DFF85C8115F0010F16D098F80010554ACA +:102820004908E06A52F821108847012198F80020F1 +:10283000514B5208206B53F82220904798F8000023 +:1028400010F0010F0BD01FE015F0200F18BF022170 +:10285000ECD115F0020F18BF0021E7D1EEE7DAF84E +:102860000000062200F10901A01C08F0B7FA40B9E7 +:10287000207ADAF800100978B0EBD11F08BF0120E8 +:1028800000D0002084F829002846FFF77BFE15F0D1 +:10289000020F05D0394898F8001050F82100804701 +:1028A00015F00C0F07D0364898F8001050F821109A +:1028B000C5F3C000884715F0200F05D0314898F8BF +:1028C000001050F82100804798F80000022805D138 +:1028D00005F06E00402806D101F00EF998F80000CE +:1028E000042828BFFFDFA07A022818BFBDE8F88FB0 +:1028F000207B002808BFBDE8F88FC7F84461022894 +:1029000014D0012818BFFFDF216B2069884298BFCF +:10291000FFDF2069C9F80000A06B1B4940F480006C +:10292000A0634FF480000860BDE8F88F2169206B38 +:102930000844EFE7700D0020001000400000040480 +:1029400008F50140F0FE0100B0F8010000800040F1 +:10295000001400404016004060150040181100406F +:1029600044810040448500404085004004150040FB +:10297000A1000020E8B40100F0B40100F8B40100A7 +:1029800008B5010018B5010004F5014010B54A482A +:1029900006F0C5FB0021484806F0F6FB0121464839 +:1029A00006F0C0FB4549002081F822004FF6FF7079 +:1029B000888443490880488010BD10B53E4806F021 +:1029C000AEFB00213C4806F0DFFB01213A4806F04F +:1029D000A9FB3A49002081F822004FF6FF70888455 +:1029E00037490880488010BD704734498A8C82423C +:1029F00018BF7047002081F822004FF6FF708884CE +:102A000070472D49016070472D49088070472B4958 +:102A10008A8CA2F57F43FF3B03D00021016008466A +:102A2000704791F822202549012A1ABF0160012030 +:102A300000207047214901F1220091F82220012A4B +:102A400004BF00207047012202701D48008888845E +:102A5000104670471A49488070471849184B8A8CAD +:102A60005B889A4206D191F82220002A1EBF01609D +:102A700001207047002070471048114A818C52880D +:102A8000914209D14FF6FF71818410F8221F19B1CC +:102A90000021017001207047002070470748084A54 +:102AA000818C5288914205D190F8220000281CBFE9 +:102AB0000020704701207047D60D0020B00D002087 +:102AC000A200002070B5FF4E044696F88400002551 +:102AD000012807D096F8660001281CBF002070BDB1 +:102AE000E1B90EE0D1B9657014202070D6F88500E8 +:102AF000C4F80200D6F88900C4F8060086F88450AD +:102B00000CE06570132020701C2206F16801A01CE7 +:102B100008F090F90120A07186F86650012070BD80 +:102B2000E84890F86610002914BFB0F86A004FF624 +:102B3000FF70704770B5E4480178002918BF0C2673 +:102B400001D0304670BDDF4C0026354684F8546015 +:102B500084F8556084F8566084F8576084F85860AB +:102B600084F8596084F84D6084F82D6084F86460BE +:102B70007F21817094F85A0028B1FFF770FCFEF7AE +:102B8000C4FF84F85A5084F86650D04806F074F9AF +:102B9000CF4806F071F9D4E770B5CB4A002515701F +:102BA000C84CC4E91701107800281CBFFFDF70BDB6 +:102BB00084F8545084F8555084F8565084F857508F +:102BC00084F8585084F8595084F84D5084F82D50AA +:102BD00084F864507F20907094F85A0028B1FFF771 +:102BE0003EFCFEF792FF84F85A5084F86650B748CE +:102BF00006F042F9BDE87040B54806F03DB9B1486D +:102C000090F854007047AF4900B591F84F0091F823 +:102C10004E10C0F38002C0F340031A4400F00100DC +:102C20001044052910D2DFE801F00B070B0309005F +:102C3000A84931F8100000BDA74800BDA74900E031 +:102C4000A74931F8100000BDFFDF002000BD9D48FE +:102C500040F27121B0F8500048437047994890F80D +:102C60006500002818BF0120704770B5954C437B64 +:102C7000002584F84F30037984F84E30012B0EBFC5 +:102C8000A4F85050B0F800C0A4F850C090F80EC09E +:102C900084F865C021701168C4F801109188A4F807 +:102CA000051081796173D0F80710C4F80710B0F8E7 +:102CB0000B00A4F80B0094F84D000126002818BF63 +:102CC00084F8556094F82D00002818BF84F85660E9 +:102CD000052B2CD2DFE803F0030821260800002191 +:102CE0007A4806F0CCF823E00121784806F0C7F8CE +:102CF000E11D764806F0F4F8607B20B1012818BF8A +:102D0000FFDF05D014E00021704806F0FDF80FE069 +:102D100001216E4806F0F8F80AE006216B4806F03B +:102D2000AEF805E00221694806F0A9F800E0FFDFEF +:102D300084F8575084F85850611C644806F0C2F873 +:102D40002178624806F0D3F80421614806F097F82C +:102D5000611C5F4806F0B6F821785D4806F0C7F8B8 +:102D600084F85460002070BD564A012382F8583020 +:102D700092F866C0BCF1000F1CBF3A20704710B437 +:102D800014784FF0000C844218BF82F858C009D163 +:102D900082F857C00868C2F801008888A2F80500C8 +:102DA00082F8573010BC0020704770B5454C05467E +:102DB000002084F856002A4604F10E0008F03AF884 +:102DC00084F82D50012084F8560070BD10B53D4C9C +:102DD000002284F8552084F84D00024604F12E00AC +:102DE00008F028F8012084F8550010BD354981F815 +:102DF0006400704770B5344E3078A0BB314C94F805 +:102E0000540080B3FFF79CFA002584F8525084F8F0 +:102E1000535075702846FFF790FA0020FEF7A1FF87 +:102E20003048FFF7A5F83048FFF773FAFFF7BBFA11 +:102E300094F84F0010F0010F04D094F8521011F0E4 +:102E4000010F13D010F0020F04D094F8521011F0BB +:102E5000020F18D010F0040F2CD094F8520010F08C +:102E6000040F1BD026E0FFE70C2070BD2520FFF7E4 +:102E700087F80020FEF764FF94F8520040F001004C +:102E800084F8520016E02620FFF77AF80020FEF7BB +:102E900057FF94F8520040F0020009E02720FFF7A6 +:102EA0006FF80020FEF74CFF94F8520040F0040049 +:102EB00084F85200FFF73BFA01210020FFF7D4F815 +:102EC0000F2113E0F80D0020A8000020880E00203C +:102ED000B00E002038B501009189130040B5010003 +:102EE00030B501002BB5010028B501000520FEF723 +:102EF000C0FF2178601CFEF7B0FF94F84E00012857 +:102F00001EBF042894F85500002808D094F84D20DE +:102F100004F12E01FE4806F012F884F8555094F89A +:102F2000560040B194F82D2004F10E01F94806F046 +:102F300032F884F85650206E017819B110F8041B4D +:102F4000FEF7BDFFE06D017831B1F34A401CFEF79A +:102F5000B6FD012084F85A00FFF7FAF9002070BD91 +:102F6000EE494860704770B5ED4C05003BD02046F7 +:102F700094F84F1090F8520011F0010F02D010F0A9 +:102F8000010F0CD011F0020F02D010F0020F11D07F +:102F900011F0040F27D010F0040F18D023E02520E3 +:102FA000FEF7EEFF0020FEF7CBFE94F8520040F053 +:102FB000010009E02620FEF7E3FF0020FEF7C0FE37 +:102FC00094F8520040F0020084F852000BE02720F1 +:102FD000FEF7D6FF0020FEF7B3FE94F8520040F053 +:102FE000040084F8520094F8530040B194F84E0065 +:102FF000012808BFFFDFBDE8704000F054BA1DB1E2 +:1030000002210020FFF730F894F85700002558B14E +:10301000611CBF4805F056FF611CBE4805F052FF19 +:1030200084F8575084F85850B948FFF794F994F849 +:103030004E00052809D2DFE800F00303030903006E +:1030400001210846FFF749FA00E0FFDF94F84F003E +:1030500094F8521030EA01014FF0010002D0AF495C +:10306000087070BD94F84E10012914BF84F8530005 +:1030700084F85250F3E710B5FFF762F9A7480078DB +:1030800040B9A74890F8540020B10020FFF76BFF2B +:10309000002010BDFFF7C6F9FFF7B8F9FFF7DAF81F +:1030A000FFF73DF9FFF754F90C2010BD9B490120B3 +:1030B000487070479A4981F85900704770B50025EB +:1030C00002F07BFC68B14FF49670FEF771FF934EEF +:1030D0003078012809D0022801D003282ED0FFDF44 +:1030E00070BDBDE8704000F0DEB98D4C94F84E0024 +:1030F000032823D094F85A0018B1FEF7F2FCFFF72A +:103100009DF98848FFF727F994F84E00012818BF69 +:1031100004280AD094F86500012814BF032810255C +:1031200045F00E010020FFF7D8F994F8640001285B +:1031300008BFFFF7AFF90220307070BDBDE87040E6 +:10314000012010E770B5764C744D94F864000128A6 +:1031500020D000BF94F85A0018B1FFF780F9FEF7AD +:10316000D4FC02F02AFCF8B12878022818BFFFDF4F +:1031700094F84E00012804BF4FF41970FEF718FFB1 +:103180000120FFF7F0FE287800281EBF28780128CC +:10319000FFDF70BD6448FFF788F9002804BF7F2077 +:1031A000A870FFF76DF9D5E7BDE8704000F07BB976 +:1031B0002DE9F05F82460027FEF7D6FE574D814687 +:1031C000B8462878022818BFFFDF554C4FF07F0B18 +:1031D00094F86400012825D0524805F06FFE064699 +:1031E000BAF1000F6FD04F4805F065FF00286AD094 +:1031F000FEF73BFE002866D094F85A00002818BF5E +:103200004FF028081ED000BFA8F1010000F0FF0811 +:10321000FEF79BFC02280FD0012808BF4FF00108E1 +:1032200010D00DE04048FFF740F9002808BF85F8AE +:1032300002B0FFF725F9CFE7B8F1000FE4D1FFDFC7 +:103240004FF0000837484FF0010A062E3BD2DFE866 +:1032500006F083838303833B94F84E10012918BF43 +:10326000042979D059EA080105D194F8651000299C +:1032700018BF022970D194F86410012904BF94F892 +:103280008410002905D02348FFF765F80320287033 +:1032900063E084F884A0007804F18C06C0F3801009 +:1032A00084F88500D4F8E300C4F88600B4F8E70099 +:1032B000A4F88A00A8787F2808BFFFDFA8783070BC +:1032C00085F802B0DFE747E0C178E27991421BD18F +:1032D0000179227A914217D14179627A914213D1D0 +:1032E0008179A27A91420FD1C179E27A91420BD1D0 +:1032F000017A227B914207D10178627BC1F3801170 +:10330000914208BF012200D0002294F84E100DE037 +:10331000880E0020B00E0020DB0E0020A800002048 +:10332000F80D0020D80E0020AA000020012918BFA7 +:10333000042900D14AB979B959EA080105D194F8AC +:103340006510002918BF012906D194F8581019B941 +:1033500094F85910A346C9B1012794F85A0018B13E +:10336000FFF77DF8FEF7D1FB002F1CBF0120FFF710 +:10337000FAFD287800281ABF28780128BDE8F09FB8 +:103380002878032818BFFFDFBDE8F09F06466A686B +:10339000DBF8EF10C2F80D1000786B49C0F3801015 +:1033A0005076DBF8E300C2F81A00BBF8E700D083E0 +:1033B000BBF8F300A2F811009BF8F500D074B07DC3 +:1033C0001075B6F81700D082B6F819005080B6F81C +:1033D0001B009080B6F81D00D08002F1080007F0B5 +:1033E000E8FE96F8240000F01F016868017696F860 +:1033F0002410490980F8CC109BF86600002818BFFB +:10340000FFDF00268BF8686068680188ABF86A10F7 +:10341000417E8BF86D10D0F81A10CBF86E10C18B6E +:10342000ABF872109BF800108BF87410DBF80110E9 +:10343000CBF87510BBF80510ABF879104188ABF8E4 +:103440007C108188ABF87E10C188ABF8801090F8B2 +:10345000CC008BF882009BF88300B8F1000F04BF0A +:1034600020F001008BF883000BD040F001008BF8B6 +:103470008300FEF787FB9BF8831060F347018BF80E +:1034800083108BF866A02E70FEF7CCFFFEF7BEFF10 +:10349000FEF7E0FEFEF743FFFEF75AFF01206968E2 +:1034A00002F06AFB59E770B5FEF7BCFFFEF7AEFF0E +:1034B000FEF7D0FEFEF733FF244C002694F85A00A6 +:1034C00028B1FEF7CCFFFEF720FB84F85A60204DB0 +:1034D0002E70FEF73DFF94F84E004FF000010128DA +:1034E00004D0BDE87040002002F046BB022002F08C +:1034F00043FB94F86600002818BFFFDF68780028B7 +:1035000008BF70BD607B84F86D00207884F874007B +:10351000D4F80700C4F86E00B4F80B00A4F87200E9 +:10352000D4F80100C4F87500B4F80500A4F87900D7 +:103530003C2084F8680068680088A4F86A000120CC +:1035400084F866006E7070BDF70E0020F80D002044 +:10355000A80000202DE9F041FF4F044600207A78B2 +:10356000FE4D4FF00108064612B1012A08D00DE0C9 +:1035700095F8492052B1002908BF87F8018004E07E +:10358000AA7F1AB1002908BF7E7001207A782B2308 +:1035900012FB03F22A44937F184312D021BB02F19D +:1035A0001F012A22A01C07F045FC66700420207031 +:1035B00084F8028078782B2110FB01F0284486776C +:1035C00012E0287801281CBF0020BDE8F08159B91D +:1035D0006670132020701C22A91CA01C07F02AFC76 +:1035E000A6712E7085F89F600120BDE8F081DB4850 +:1035F0000178002914BF80884FF6FF7070472DE9CD +:10360000F041D64C0546A07F002818BFBDE8F081E8 +:10361000284605F053FC00210126072834D2DFE8B4 +:1036200000F004070C3333330E0084F8201009E057 +:1036300084F8206084F828100BE0032000E00220CA +:1036400084F8200004F12901284605F08EFC84F856 +:103650002800284605F054FC84F8210004F12201DA +:10366000284605F036FCBC4D04F1480728787F2831 +:1036700008BFFFDF287838707F202870A677BDE864 +:10368000F041032001F023BB84F82810BDE8F0814D +:1036900010B5002001F0ACFAB04CA0B1FEF747FE27 +:1036A00000210120FEF7E0FC04F1B800FEF753FE14 +:1036B000D4F8A800FEF752FE94F88400032818BF3F +:1036C00002281FD022E0FEF7ADFEFEF79FFEFEF7B8 +:1036D000C1FDFEF724FE94F8A10030B1FEF7BFFE55 +:1036E000FEF713FA002084F8A100012084F8AC0052 +:1036F000022084F8A300FEF72BFEBDE81040002056 +:1037000001F0E5BA01210020FEF7E7FEFEF7C2FE58 +:1037100094F8A10018B1FEF7E4F9FEF78FFE03203C +:1037200084F8A30010BD8D490028B1F8AE202CD03C +:10373000FF2A0BD24FF6FF7000EA4200A1F8AE005C +:10374000FF2888BFFF2001D9A1F8AE008248426857 +:10375000012A12BF002A0D224260D243C2EBC203EB +:1037600003EB021291F8AD30DB4303EB830CCCEB9F +:1037700083131A444260900CB1F8AE20B0FBF2F310 +:1037800002FB130081F8AD007047012ADED9500812 +:10379000A1F8AE0008BF0120D8D1D5E770B56F4CB5 +:1037A00094F8A300022819BF94F8A3000128002070 +:1037B00005461CBF0C2070BD2B2101FB00418D77FD +:1037C000401CC0B20228F7D3257094F8A10028B19C +:1037D000FEF745FEFEF799F984F8A15084F89D5054 +:1037E00084F89E5084F89F5084F8A050012084F8FB +:1037F0007E0084F8845084F8A25084F87B0084F81A +:103800007C0084F87D00606FA16FE26FD4F8803097 +:10381000C4F88800C4F88C10C4F89020C4F8943020 +:10382000D4F88400C4F8980084F89C50002070BD3F +:103830004A4A10B5002382F8A330C2E92C010120C6 +:1038400082F8A300FFF7AAFF002818BFFFDF10BD12 +:103850002DE9F047414C81460C2794F8A30001283C +:103860001FBF94F8A30002280C20BDE8F087FEF7E4 +:1038700067FD0020FEF775FA94F89C004FF00108F0 +:10388000002844D0D4F88800D4F88C10D4F89020C4 +:10389000D4F894306067A167E267C4F88030D4F848 +:1038A0009800C4F88400002684F89D6084F89E6027 +:1038B00094F87B00002801BF94F87C00002894F85D +:1038C0007D0000281ABF94F8A000002884F89C60AE +:1038D00023D094F88400032802D0022805D008E001 +:1038E00005211F4800F0F3FC03E003211C4800F011 +:1038F000EEFC94F87A1004F17400FEF7AEFA00279B +:1039000084F89C6094F8A300012815D10FE094F886 +:10391000A300022808BF0027F4D094F8A3000228CF +:1039200002BF84F8A3800C20BDE8F08704E084F88F +:10393000AC80022084F8A300D4F8B400017819B157 +:1039400010F8041BFEF7BBFAD4F8B000017879B187 +:10395000044A401C08E00000B0000020000F0020D6 +:10396000E00F0020BB0F0020FEF7A9F884F8A1802B +:10397000FD48C4F8A890FEF7CCFCFEF7E9FC3846F9 +:10398000BDE8F08770B5FEF7DBFCF84C94F8A300B7 +:10399000022803D0FEF7DCFC0C2070BD012084F867 +:1039A000AD00A4F8AE000220FEF7C7FCF048FEF719 +:1039B000DFFAF04B002004F17B0200BF94F8A21064 +:1039C000491CA3FB015C4FEA5C0CACEB8C0C614422 +:1039D000C9B284F8A210895C012907D0401CC0B28A +:1039E0000328EBD3FFF754FE002070BD94F8A2002B +:1039F000E149085CFEF7C4FA0020FEF7A1F9F1E7FF +:103A0000DA4B10B44FF0010C83F89EC093F89F403E +:103A1000002C1EBF3A2010BC7047002418B993F840 +:103A20008E0088420FD183F88E1083F89D40106875 +:103A3000C3F888009088A3F88C0083F89DC083F8B1 +:103A4000A0C083F89CC083F89E4010BC0020704743 +:103A50000300C6494FF000004FF0010208BF81F893 +:103A6000922005D0012B16BF122081F892007047DA +:103A700081F89C2081F899307047BC4A032808BF20 +:103A8000C2F8941082F89800012082F89C0000206F +:103A90007047B64890F89C1029B190F8990000281A +:103AA00008BF704704E090F88500002808BF704701 +:103AB0000120704710B5FEF7B5FCFEF7A7FCFEF736 +:103AC000C9FBFEF72CFCA94C94F8A10030B1FEF71D +:103AD000C6FCFEF71AF8002084F8A100012084F843 +:103AE000AC00022084F8A300FEF732FC002010BDD9 +:103AF0009E4981F8A400704710B5FEF793FCFEF7CD +:103B000085FCFEF7A7FBFEF70AFC984C94F8A10091 +:103B100030B1FEF7A4FCFDF7F8FF002084F8A10007 +:103B2000012084F8AC00022084F8A300FEF710FC0A +:103B3000BDE81040002001F0CAB82DE9F05F002672 +:103B4000DFF83882894C7F2780B104F1B80005F096 +:103B500082FA20B904F1B80005F09DFA30B194F86A +:103B6000840003280DD194F89E0050B194F8A3006E +:103B7000052828BFBDE8F09FDFE800F0BABABAF523 +:103B8000F40094F8A3007E4D4FF0010A052880F060 +:103B90005D82DFE800F0FBFBFB03FA00784805F0EC +:103BA0008DF97649887094F87E0030B9FEF7DCF91B +:103BB000002808BF4FF0000801D04FF0010894F82A +:103BC000A100002818BF4FF0280915D0A9F1010065 +:103BD00000F0FF09FDF7B9FF8346022803D1B9F1D0 +:103BE000000FF3D1FFDFB8F1000F14D1BBF1010FCB +:103BF00018BF4FF000080ED0DFF880914FF0020B95 +:103C000099F80200072880F08281DFE800F073F75E +:103C100007F6F6F625004FF00108EDE794F8A1004D +:103C200018B1FEF71CFCFDF770FF5448FEF73DFC91 +:103C3000002808BF89F80070FEF722FCB8F1000FD9 +:103C400000F05F8194F88400012818BF022840F03A +:103C50005881FEF7FFFAEBE094F8A10018B1FEF7E7 +:103C6000FEFBFDF752FF4548FEF71FFC002808BF8A +:103C700089F80070FEF704FCB8F1000F00F04181F4 +:103C800094F88400022803D001287DD000F039B9CF +:103C90003B48FFF7B4FC012000F0AAFF58B13949B6 +:103CA000A1F1280005F039F93648FEF754FB94F8E5 +:103CB0009D00A0B190E0FEF7B5FBFEF7A7FBFEF775 +:103CC000C9FAFEF72CFB94F8A100002870D000BFC1 +:103CD000FEF7C5FBFDF719FF84F8A1609DE0012107 +:103CE0000846FEF7FAFBFEF75EFB052084F8A3000A +:103CF000BDE8F09F94F8A10018B1FEF7B0FBFDF706 +:103D000004FF1E48FEF7D1FB002808BF89F80070A9 +:103D1000FEF7B6FBB8F1000F71D094F884000228CA +:103D200047D0012830D003281CBFFFDFBDE8F09F3B +:103D3000E978D4F88000827E914231D12979C27E1F +:103D400091422DD16979027F914229D1A979427F8F +:103D5000914225D1E979827F914221D1297AC27F8E +:103D6000914214E08BE174E148B50100000F00209E +:103D70004EB50100ABAAAAAA4BB50100B0000020C5 +:103D8000B80F0020E00F002052E0CFE05EE107D145 +:103D90002978427EC1F38011914208BF012100D0F1 +:103DA000002194F88520012A48D0002927D0A0E0DE +:103DB00033E0FE48FFF723FC012000F019FFF8B1C3 +:103DC000FB49A1F1280005F0A8F8F948FEF7C3FA6D +:103DD00094F89D00002882D0D4F888006067B4F879 +:103DE0008C00A4F8780004F17401F14805F06AF839 +:103DF00084F89D6084F89E6071E788E02CE07FE0A5 +:103E0000FEF710FBFEF702FBFEF724FAFEF787FA37 +:103E100094F8A10000287FF45BAF84F8ACA084F88C +:103E2000A3B0FEF795FABDE8F05F002000F04FBFA9 +:103E3000DE48FFF7E4FBBDE8F05F29E4F1BB00BF1B +:103E400000F11A01D94805F044F8D84805F058F8AF +:103E5000D4F8801048764CE094F8A10018B1FEF731 +:103E6000FEFAFDF752FED348FEF71FFB002808BFFD +:103E700089F80070FEF704FBB8F1000F41D0FDF7A0 +:103E8000F4FFE8B394F88400032808D0C748FFF78C +:103E9000B6FBFEF7DFF9BDE8F05FFFF7F9BBD4F83A +:103EA0008000E978827E91421DD12979C27E9142BB +:103EB00019D16979027F914215D100E019E0A97901 +:103EC000427F91420FD1E979827F91420BD1297AC9 +:103ED000C27F914207D12978427EC1F3801191427D +:103EE00008BF012100D0002194F88520012A04D0C8 +:103EF00031B1BDE8F05F00F08FB90029F9D19FE73B +:103F0000FFE7FEF7A7F9BDE8F05FFFF7C1BB94F844 +:103F1000A10018B1FEF7A3FAFDF7F7FDA548FEF7DB +:103F2000C4FA002808BF89F80070A0E09F4804F098 +:103F3000C5FF88F802009E48E978427A91421CD178 +:103F40002979827A914218D16979C27A914214D141 +:103F5000A979027B914210D1E979427B91420CD13F +:103F6000297A827B914208D129780078C1F38011A7 +:103F7000B1EBD01F08BF012500D00025FEF76AF97C +:103F800098F8020004284BD1F5B38A48FEF78DFA61 +:103F9000002808BF88F80070FEF772FA94F8AC00A9 +:103FA00000281CBF0020FFF7BEFB84F8ACA07F4DAB +:103FB00094F8490018B1BDE8F05FFFF769BB042031 +:103FC00084F84B00284604F09BFF002808BF84F8C3 +:103FD0004C6003D0012808BF84F84CA004F14D01C7 +:103FE000284604F076FF04F15401284604F0E9FF66 +:103FF00084F853001F2884BF1F2084F8530004F165 +:10400000730598F8000000E00AE07F2808BFFFDF92 +:1040100098F80000287088F8007084F849A0CAE772 +:104020006448FEF742FA002808BF88F80070FEF7DF +:1040300027FA94F8AC00002804BF0120FFF773FBB7 +:1040400084F8AC60BDE8F05FFFF722BBFFDFBDE89E +:10405000F09F94F8A10018B1FEF701FAFDF755FDA5 +:104060005448FEF722FA002808BF88F80070FEF7CF +:1040700007FAFEF7EFF8BDE8F05FFFF709BB4D4820 +:10408000FEF713FA002808BF88F80070FEF7F8F969 +:1040900094F8AC00002804BF0120FFF744FB84F82B +:1040A000AC60FEF7D7F8BDE8F05FFFF7F1BA70B586 +:1040B000414C94F8A30007285ED2DFE800F05D5D74 +:1040C0005D5D5D040D003948FEF745F9FEF7E2F944 +:1040D000042084F8A30070BDFEF7A4F9FEF796F95A +:1040E000FEF7B8F8FEF71BF9012584F8AC50022062 +:1040F00084F8A300FEF72CF92078002818BFFFDF12 +:104100000020A070D4F880000188A180417EE17178 +:10411000D0F81A10A160C18BA1814188E182818809 +:104120002183C088608394F8A400207794F87A00F3 +:10413000A073606FC4F80F00B4F87800A4F81300FF +:1041400094F8A10018B1FDF700FD012809D0607FA7 +:1041500020F0010060772570BDE87040022000F07B +:10416000B6BD607F40F001006077FDF70BFD617F19 +:1041700060F347016177EEE7FFDF70BD70B50E4C6D +:1041800094F8A3000025052828BF70BDDFE800F0E3 +:104190004343432503000748FEF787F910B9054953 +:1041A0007F200870FEF76CF908E00000B80F0020CF +:1041B000E00F0020B0000020000F002094F8AC00B9 +:1041C000002804BF0120FFF7AEFA84F8AC50FEF7D8 +:1041D00041F8BDE87040FFF75BBAFEF723F9FEF740 +:1041E00015F9FEF737F8FEF79AF894F8A10028B110 +:1041F000FEF735F9FDF789FC84F8A150012084F819 +:10420000AC00022084F8A300FEF7A2F8BDE87040DD +:10421000002000F05CBD70BD70B5022000F0E8FC2D +:104220000025604C0126A0B3012000F050FD04F1F0 +:10423000E001A1F1280004F070FED4F88000C18AEA +:1042400004F1E00004F0E9FED4F88000017D04F1FF +:10425000E00004F0E6FE04F1E000FEF77CF894F8DC +:104260009D0080B1D4F888006067B4F88C00A4F891 +:10427000780004F1740104F1E00004F023FE84F8F6 +:104280009D5084F89E5084F89F60062084F8A30017 +:1042900070BDFFE7FEF7C6F8FEF7B8F8FDF7DAFFE6 +:1042A000FEF73DF894F8A10028B1FEF7D8F8FDF725 +:1042B0002CFC84F8A15084F8AC60022084F8A300A0 +:1042C000FEF746F8BDE87040002000F000BD70B574 +:1042D000344C0546032952D0052918BF70BD04F09F +:1042E000CBFD0521284604F0CAFD94F87A10284633 +:1042F00004F0FDFD04F17401284604F0E3FDD4F858 +:10430000800000F10D01284604F071FED4F8800011 +:1043100000F11101284604F06EFED4F88000017D02 +:10432000284604F07EFED4F88000C18A284604F0B6 +:1043300074FED4F880004188284604F062FED4F868 +:1043400080008188284604F060FED4F88000C1888F +:10435000284604F05EFED4F8800000F108012846EB +:1043600004F076FED4F88000017E284604F05BFE5F +:1043700094F8A4102846BDE8704004F05EBE04F036 +:104380007BFD0321284604F07AFD94F87A10284634 +:1043900004F0ADFD04F174012846BDE8704004F05E +:1043A00091BD0000000F00202DE9F047744E054636 +:1043B00084B096F800040C46DFF8C8A140099AF8CA +:1043C00000144909884218BFFFDF96F8000440092D +:1043D0006D4991F800144909884218BFFFDFDFF8E2 +:1043E000AC816E1E08F13809002709EB4505092C40 +:1043F00080F0C280DFE804F005323C3C37C0C0C02A +:1044000070000B2EA8BFFFDF35F8020C0621F9F76C +:1044100014FB040008BFFFDF0B2EA8BFFFDF35F839 +:10442000020C2188884218BFFFDF94F8980000280A +:1044300008BFFFDFC8F8047088F80170C8F80C7076 +:10444000606AB0F5717F88BFA0F237372046C8F8A0 +:10445000087004B0BDE8F04702F0D5B904B0BDE87B +:10446000F04702F02CBA04B0BDE8F047FEF7FAB806 +:104470009AF8140D4649400991F8001449098842F8 +:1044800018BFFFDF0B2EA8BFFFDF35F8020C062197 +:10449000F9F7D3FA040008BFFFDF0B2EA8BFFFDF38 +:1044A00035F8020C2188884218BFFFDF204602F051 +:1044B000BCFA002818BFFFDF00222146684600F042 +:1044C000EAFC94F8A2006946FBF7BEFD208E401C72 +:1044D000208604B0BDE8F0870B2EA8BFFFDF35F8BB +:1044E000020C0621F9F7A9FA040008BFFFDF0B2E22 +:1044F000A8BFFFDF35F8020C2188884218BFFFDF14 +:1045000094F89800042818BFFFDF84F8987094F896 +:10451000A2504FF6FF76681E0B28A8BFFFDF09EBFD +:10452000450020F8026C94F8A200FBF727F984F804 +:10453000A270D4F8A800002804BFD4F8A400C8F8DA +:10454000100008D0D4E92B12114482691144816112 +:10455000D4E92901C860D4F8A400002819BFD4F810 +:10456000A8100161D4F8A80087610A48007804B057 +:10457000BDE8F047F5F724B8FFDF04B0BDE8F087E9 +:1045800001E000E00BE000E018E000E0081000208F +:1045900019E000E0B80000202DE9F047FD4E074685 +:1045A0000024F08B401C80B2F0833278A046002AB1 +:1045B00008BFFFDF09D0F74B042AA3F114095D6897 +:1045C00013D0052A18BFFFDF44D021463069FBF71E +:1045D000ADFB306187F8008001213971B860B068A7 +:1045E00000F22710F860BDE8F0870A282CBF0220EF +:1045F0000320787100297BD0D6F810A0D9F810409C +:1046000034B3A146E468002CFBD1B9F1000F1FD0F0 +:1046100099F80000002808BFFFDFD9F81410D9F876 +:10462000040001445046FCF707FB002807DA291A6A +:104630004A1E92FBF5F202FB0504294604E090FBBA +:10464000F5F202FB150429468C4288BFFFDFBCE768 +:104650004446BAE702207871002953D0D6F818A052 +:10466000BAF1000F08BFFFDF0025DAF8AC20D9F857 +:1046700010402846691E5CB1A069904228BF814263 +:1046800084BF014625462046E468002CF4D105B9D4 +:1046900005460AF19804CAF8A850002D04BFC4F8D2 +:1046A0000C80C9F8104005D0E868EC60E060002894 +:1046B00018BF0461D4F81090C4F81880B9F1000F45 +:1046C0000ED0D9F8180048B1D4F814A0504538BF1E +:1046D000FFDFD9F81800A0EB0A00A061C9F8188024 +:1046E000002D08BFC6F8208009D02878002800E0F7 +:1046F00008E008BFFFDF696968680844306240F677 +:10470000B83462E72C4660E72DE9F041A24C8046C0 +:1047100084B094F800040E46A04F410997F80004B5 +:104720004009814218BFFFDF94F8000440099C490A +:1047300091F800144909884218BFFFDF00250122C3 +:10474000092E944C5ED2DFE806F0051B3636315D4B +:104750005D184C0062732273607800281CBF04B09F +:10476000BDE8F0818F484560C5602573A068CD38ED +:10477000FFF76EF8002818BFFFDF04B0BDE8F08136 +:10478000607850B1207B002808BFFFF793F965736C +:1047900004B0BDE8F041FAF738BFA273FFF7F2F8B2 +:1047A000002818BFFFDF04B0BDE8F08104B0BDE809 +:1047B000F041FDF757BF97F8140D7B49400991F878 +:1047C00000144909884218BFFFDF01220021684612 +:1047D000FFF7E2FE69464046FBF736FC04B0BDE851 +:1047E000F0812078052818BFFFDF207F002808BF50 +:1047F000FFDF25772570207DFAF7C0FF257504B00F +:10480000BDE8F081FFDF04B0BDE8F0812DE9F041A3 +:10481000604C84B00025207804281FBF207805282C +:104820000C2004B018BFBDE8F08101276770607BE1 +:10483000002690B172B6607B00281CBFA07B0028C8 +:1048400005D0FFF737F96673A673FAF7DEFE62B696 +:10485000207DFCF77BFAD0B913E094F81480032094 +:104860008DF804008DF80500FAF79EFF02904FF0D6 +:10487000FF3003908DF8007069464046FBF7E4FB7B +:10488000E6E720BF207DFCF761FA0028F9D0207F01 +:1048900028B126772078052818BFFFDF0C25667021 +:1048A0002670207DFAF76AFF267504B02846BDE819 +:1048B000F0812DE9F047374884B00078002818BF10 +:1048C000FFF7A4FF0120374E307069460620F9F744 +:1048D00040F8002818BFFFDF00254FF6FF7718E0EB +:1048E000029800281CBF90F89810002911D0008869 +:1048F000B84218BFDFF8B48045D00621F9F79DF81B +:10490000040008BFFFDF94F8A200FCF71FFA68B9A3 +:1049100005E06846F8F7FBFF0028E1D033E020BF50 +:1049200094F8A200FCF712FA0028F8D084F8985006 +:1049300094F8A2904FF6FF7AA9F101000B28A8BFC6 +:10494000FFDF08EB490020F802AC94F8A200FAF768 +:1049500015FF84F8A25069460620F8F7FAFF0028F0 +:1049600018BFFFDF0AE0029800281CBF90F89810DB +:10497000002903D00088B842BFD104E06846F8F7A8 +:10498000C6FF0028EFD03570356104B00020BDE8C7 +:10499000F08700001C10002001E000E00BE000E0C8 +:1049A00018E000E00810002019E000E040100020AE +:1049B00010B50078FE4C60B101280CBF40F6C41061 +:1049C000FFDF06D0A06841F66A01884228BFFFDFFA +:1049D00010BDA060F6E710B5F54C00232070F54837 +:1049E00003704370037703734373837383610375A9 +:1049F00024304FF6FF7101800522418020F8041F0A +:104A0000521EFAD1180008BFA36005D0002B0EBFBC +:104A1000FFDF40F6C410A060A06841F66A0188423A +:104A200028BFFFDFBDE8104043E770B5E14C0E46FC +:104A300084B02178154600291EBF0C2004B070BD3B +:104A4000416A01F29731C0F8AC10A06190F898006B +:104A5000002818BFFFDF40F2712006FB00F1684319 +:104A60000A30C4E90110A1F53D71884288BF0846AB +:104A7000A060D1490020C8600521217060702077B6 +:104A8000E083CE48FAF72BFE2075002808BFFFDF31 +:104A9000FAF78AFE2061002201216846FFF77CFDBB +:104AA000207D6946FBF7D0FA04B0002070BD884233 +:104AB00034BF012200220244D2B2814234BF01201D +:104AC00000200844C1B28A4234BF08461046831A07 +:104AD000A0EB010C114401EBC102634402EB411154 +:104AE00003EB83031B0100EB400203EBC10102EB6C +:104AF000001201EBC201C0EBC00202EB401001EB5F +:104B00008000983870474FF44B72B1F54B7F38BF37 +:104B1000114641627047A748007800281CBF00205A +:104B2000704710B50620F8F725FF80F0010010BD92 +:104B300010B5A04C84B02278002A1EBF0C2004B00F +:104B400010BD40F27122424340F2712048430A30C6 +:104B5000C4E90120A2F53D71884298BF01460020BA +:104B6000A160607004212170E0839448FAF7B7FDDA +:104B70002075002808BFFFDFFAF716FE40F6B831AF +:104B8000FBF7D4F82061002201216846FFF704FDFD +:104B9000207D6946FBF758FA04B0002010BD70B5BF +:104BA000844CA1690160FFF731FE002308B1A361C5 +:104BB00070BDA169D1F8A8205AB1D1E92BC5AC4488 +:104BC0009569AC44C2F818C0D1E9292CCCF80C2066 +:104BD00005E0DFF8E4C1D1F8A420CCF81020D1F82A +:104BE000A420D1F8A810002A14BF11618B61DEE760 +:104BF000714910B54968002801F1980408BF04F50F +:104C0000BC7409D0012808BF04F5317404D002280F +:104C100014BFFFDF04F5B07466488068A0428CBF03 +:104C20000120002010BD6448D0E90112914204D255 +:104C30000078002804BF012070470020704730B57D +:104C40005B4D85B0042221B3012908BF03211CD08C +:104C5000022908BF80F8982023D003291EBFFFDF58 +:104C600005B030BD418840F2E2425143544A1160E0 +:104C7000D0F8BC100A89C2828A7902754A894280BA +:104C80008A898280C989C180022180F8981005B084 +:104C900030BD044648480078002818BF84F89820A2 +:104CA00007D0FAF7B2FC287805B0BDE83040F4F739 +:104CB00087BC01222146684600F0EDF894F8A20076 +:104CC0006946FBF7C1F9208E401C2086E9E72DE9F3 +:104CD000F041374F0100374C387884B04FF0000571 +:104CE0000ED001291CD0022976D003291EBFFFDF78 +:104CF00004B0BDE8F08104B0BDE8F041F4F760BC59 +:104D0000E583F4F75DFC6078002875D10022114638 +:104D10006846FFF741FC207D6946FBF795F96BE09B +:104D2000DFF89480206940F2E243D8F80410084488 +:104D3000A16900F251604A88983102FB03F5D8F866 +:104D400010208A4208BF002614D0216AFBF774FFA6 +:104D5000002807DA291A4A1E92FBF5F202FB050623 +:104D6000294604E090FBF5F202FB150629468E4227 +:104D700088BFFFDFB868864208D2A06940F271227E +:104D80004188C1824A4306EB420605E040F2E24018 +:104D9000B6FBF0F0A169C882A06905210175C08A3F +:104DA0006FF41C71484306EB400040F635410AE0C1 +:104DB000B80000201C100020081000200947010046 +:104DC000BC00002008E0C8F80C00B0EB410F28BF81 +:104DD000FFDF04B0BDE8F081E583F4F7F1FB0120CB +:104DE0002077A0692169C0F89C1080F8985021783C +:104DF000052918BFFFDF06D0FAF707FC6573A57316 +:104E000004B0BDE8F081002808BFFFDFA06990F87A +:104E10009800002818BFFFDFA06990F8A2000028C2 +:104E200018BFFFDF5B48FAF75AFCA169064681F814 +:104E3000A2000F88401E0B28A8BFFFDF564800EBDA +:104E4000460020F8027CA06990F8A200002808BF64 +:104E5000FFDF01226846A16900F01DF8A0696946DC +:104E600090F8A200FBF7F0F8A561C5E7704700B520 +:104E70004A4A59B1012908BF401E07D002291CBF68 +:104E8000FFDF00BD5178491C5170C01F506000BD4C +:104E90004348007870472DE9F05F06460C46488885 +:104EA00040F2E24141439046E08A40F2E24200FB98 +:104EB00002FA94F898200025384F4FF0030B4FF07A +:104EC000010952B13846012A40682DD0022A16D075 +:104ED000032A18BFFFDF27D036E0B8F1000F08BF64 +:104EE000FFDF7868002808BFFFDF7868F968C01D19 +:104EF00008440AF25D41451884F8989023E0A8F12F +:104F00000101084308BFFFDF2648B8F1000F006821 +:104F100000EB0A0505D0786800F20F30A84288BF80 +:104F2000FFDF84F898B00EE00D46B8F1000F0AD00C +:104F300018B97878002818BFFFDF786800F20F30C2 +:104F4000A84288BFFFDF05B9FFDF2946D4F89C00DF +:104F5000FAF7ECFEC4F89C000020307086F804904C +:104F6000D4F89C00B060204601F095FD002818BFE1 +:104F700086F8059005D0606A00F5E570F060BDE840 +:104F8000F09F94F89800012806BF0220707186F8FF +:104F900005B0F0E7A94301004010002008100020F0 +:104FA0001C100020BC000020FE48C07E7047FE4858 +:104FB00040687047FD48C07E7047884234BF012278 +:104FC00000220244D2B2814234BF012000200844B2 +:104FD000C1B28A4234BF08461046831AA0EB010CC6 +:104FE000114401EBC102634402EB411103EB830363 +:104FF0001B0100EB400203EBC10102EB001201EBCD +:10500000C201C0EBC00202EB401001EB80009C38F3 +:1050100070474FF44A72B1F54A7F38BF114641627A +:1050200070472DE9FF4FDF4E83B08846706A3468C1 +:105030005FEA03090568D4F804B0306A0190298E4C +:105040000598A0EB010080B2009019BF04F1380769 +:1050500004F1480A371D05F1A80A032038710398A6 +:10506000002832D0012800F0DF8002287DD00328FC +:1050700018BFFFDF00F00C81B9F1000F1EBF3879B7 +:105080000328FFDFA16A7069FAF750FEB860D4E91F +:10509000081081428EBFCAF800000846CAF8001006 +:1050A000696A084400F24F10F860B5F89810059846 +:1050B000081A00B2002840F349810398022818BF5B +:1050C000032040F0448100F041B9306A002808BF55 +:1050D000FFDFE98A40F27120484340F2E24101EBF0 +:1050E00040010020B8F1000F06D0B14808FB01F1E3 +:1050F000B1FBF0F000F10100A061698840F2E242EA +:1051000001FB02F24FF0000106D0A94908FB02F2B0 +:10511000B2FBF1F101F10101E161316A40F2712369 +:1051200001F10101A162EA8A02FB03F2C0EB420233 +:1051300002F237421144A1622A7D40F2E24312FB9F +:1051400003F202EB400000F2151020626062306A48 +:10515000A1EB00009749A0F1010009188CD2B0F52D +:10516000387F98BFFFDF5CE0FFE7E98A40F27122F9 +:10517000E068514300EB41010020B8F1000F06D078 +:105180008B4808FB01F1B1FBF0F000F10100A061D8 +:10519000688840F2E24100FB01F14FF0000006D0C8 +:1051A000834808FB01F1B1FBF0F000F10100E06180 +:1051B000306A002808BFFFDFB5F8AE00E98A002892 +:1051C00040F27122E06801FB02F100EB4100A169AD +:1051D000A0EB010003D13168D33849680844A062CC +:1051E0002269A168A06901FB0200297D40F2E24228 +:1051F00011FB02F101EB400000F2131020626988FC +:105200005210E0695143C0EB4100A0F54770606265 +:10521000A06A316A401AA0F5AA7167484018BFF425 +:105220002BAF0120387127E7B5F8AE00002808BF82 +:10523000FFDF306A002808BFFFDF698840F2712273 +:10524000E0695143C0EB4101A162B5F8AE3022697B +:10525000D4F818C0D4F808809B1A08FB02C203FBDC +:1052600000202A7D40F2E24312FB03F202EB4000F1 +:1052700000F213102062A1F547706062306A081ACC +:10528000A0F5AA714C484018BFF4F6AEC9E700BFBC +:10529000B9F1000F1CBF94F83400002803D007B008 +:1052A0000220BDE8F08F698840F27122E069514325 +:1052B000C0EB410100984843A062B5F8AE0030B39E +:1052C000BBF1000F18BFFFDFB5F8AE100098002249 +:1052D0000844E169484302EB400000F213102062E9 +:1052E000688840F271225043C1EB4000A0F547703E +:1052F000606232484068B0B1A26A01990120511A37 +:10530000A1F5AA722C49891838BF3871B4E6BBF1EF +:10531000000F1ABF01980028FFDFABF1D301A06A8C +:105320000844A062D0E7FAF73FFA726901461046D6 +:10533000FBF782FCA16A081AA0F24F111E48401820 +:105340003EBF012007B0BDE8F08F95E600207871E0 +:105350001098C8B1B5F8C01000290CBF0020B5F8EE +:10536000C200A5F8C20095F8C420401C50438842F2 +:105370000AD27879401E002806DD01207871B5F840 +:10538000C200401CA5F8C20087F80090B9F1000FD8 +:105390001CBF94F83400002881D189F0010084F802 +:1053A00035000DE058100020DC00002080100020A7 +:1053B00040420F00DBF7FFFFF4F8FFFFCC000020B6 +:1053C000307FF27E3946B37E9A4202D0FAF73CFE35 +:1053D00004E00020F076B0763060706207B0002004 +:1053E000BDE8F08F70B5FD4D0929D5E900326FD2C7 +:1053F000DFE801F0055B73816F9494589000002002 +:105400001062D17E04294ED2DFE801F04D4D0245F5 +:10541000516A0C681168087011684860106890F84B +:10542000350040B9FAF7C0F969680968096CFBF7FB +:1054300003FC002818DC686801684A8E218E8A42C5 +:1054400006D1B4F89C20511AA4F89E10228605E0DB +:10545000511AA4F89E100168498E21860268C1681D +:105460001164C168416111E068680168098E228E8B +:10547000891AA4F89E100168098E218601680A6CB9 +:10548000C2600A6C4261886CC4F8A8002046BDE87E +:10549000704002F01DBAD0685061FDF7ABFC0028E7 +:1054A00018BFFFDF70BDFFDF70BDD07E04280DD2B6 +:1054B000DFE800F00C0C0206BDE8704002F0D8BA3C +:1054C000FDF7D9FD002818BFFFDF70BDFFDF70BDFD +:1054D00024E0BDE87040FDF7C5B8D87E022804D0AE +:1054E000D87E032818BFFFDF0CE0BD48007D0128EF +:1054F00008BFFFDF0AE0D87E022807D0D87E032845 +:1055000018BFFFDFBDE8704000F0B5BBBDE87040DC +:1055100000F0FCBBBDE87040FAF730B9FFDF70BDAA +:105520002DE9F047AD4D0024AE4E82460F464FF0B8 +:10553000010809294ED2DFE801F0053B46463B4D04 +:105540004D4646006868DFF89C92002818BFFFDFD0 +:1055500039465046C5F80490FFF744FFF07E022814 +:1055600018BFBDE8F08768680568406A0768FAF701 +:10557000FEF87A8840F27123E9695A43C1EB42018F +:10558000AB39B72898BFB72000F54A70081A796A76 +:10559000A0F20130B1F5717F88BFA1F5717484422A +:1055A00038BF2046E862306880F83480BDE8F08774 +:1055B0005046FFF717FFF07E022804BF306880F8DE +:1055C0003480BDE8F08750462E60FFF70BFF2C605B +:1055D000BDE8F087FFDFBDE8F0872DE9F0417F4CA3 +:1055E00007460D4609291ED2DFE801F00510141404 +:1055F000101D1D14140060687B4E002818BFFFDFCB +:10560000294638466660BDE8F041EBE63846BDE81D +:10561000F041E7E6744820603846FFF7E3FE0020DB +:105620002060BDE8F081FFDFBDE8F081F0B56D4995 +:1056300085B00026CA7E694C032A03D02831CA7E71 +:10564000032A64D10025216000B3012806BF03208E +:105650008876FFDF0AD02068002E0560456225604D +:1056600055D06248456005B00020F0BD2068C17E7D +:1056700029B1C17E827E914208BF20BFF6D0C17E93 +:1056800000290CBF012600268576E4E700260327C3 +:1056900008468F76C97E032904D0C07E002808BF43 +:1056A000012631E00120FDF705FD2068007F00287C +:1056B00008BFFFDF2068067F8DF804708DF8057045 +:1056C000FAF772F802904FF4FA70039001208DF807 +:1056D000000069463046FAF7B7FC2068007FFBF708 +:1056E00035FB30B920BF2068007FFBF72FFB002877 +:1056F000F8D02068007FFAF741F820680577C57672 +:10570000857605600126456220688576A3E705B0A9 +:105710000C20F0BD10B5334800F076FB324800F0A5 +:1057200073FB2F4900200875304948702D494861A6 +:1057300001F1280250618876907628494860086017 +:1057400010BD2DE9F0412A4C064694F80004294D7D +:10575000400995F800144909884218BFFFDF94F802 +:1057600000044009244991F800144909884218BFEF +:10577000FFDF95F8140D4009204991F800144909FC +:10578000884218BFFFDF1E48164D00240670EC76D5 +:10579000AC7605F12806F476B4761030012101715B +:1057A00004606C6274622C6000F108073460284663 +:1057B0007C6000F029FB05F1280000F025FB05F1D5 +:1057C000500004757C706C617461AC76B476A7F19E +:1057D000100044600460BDE8F0810000CC000020AF +:1057E000A81000205810002080100020DC000020AD +:1057F00001E000E00BE000E018E000E019E000E06C +:10580000C4000020F849087170472DE9F843F749B2 +:105810000546CA7EF64C01F12800002A04BFC27E6C +:10582000002A73D0C97E022907BFC17E00290C203F +:10583000BDE8F8832060EF48F9F751FF2168087749 +:10584000ED4845602168086014384862ADB1012117 +:1058500005F1C400FBF762FD0620F8F799F806464B +:105860000720F8F795F895F8C4103044B1FBF0F232 +:1058700000FB1210401C85F8C4002068007F00283F +:1058800008BFFFDFF9F773FFDC49091838BF40F2A2 +:10589000F65000F26B1087B220680326C676FDF73B +:1058A000B2F921680861FDF7D2F94FF0010800252F +:1058B00058B3FDF7CCF921684A6A106008680121E5 +:1058C00080F800806846FBF7B4FC9DF8000042F2C7 +:1058D00010710002B0FBF1F201FB1208F9F764FF4E +:1058E00007EB0801FAF722FA2168C86022681672ED +:1058F00056721571107FD37E111D92F81AC0634540 +:1059000018D0FAF7A1FB19E000E006E0BC482160DE +:10591000F9F7E5FE2168087792E7F9F745FF394680 +:10592000FAF704FA2168C86008680570086880F80A +:105930000180DBE7D5769576156055622068058392 +:105940000020FDF7B7FB00202560BDE8F883704715 +:10595000F8B5A64EF17E19B906F12801C97E09B144 +:105960000C20F8BD0221F1769F4FA64D776235607D +:10597000002438602C750094A3493A7990F8CC0043 +:10598000234631F8122031F81000104481B222462B +:105990002046FFF746FB002818BFFFDF2C610120DF +:1059A000AC6028756C862C8685F836403868018E88 +:1059B000491E018634830020F8BD8D4810B540682B +:1059C0000124817E032908BF002409D00168497899 +:1059D00031B1006A8D49884284BF0024FDF766FB1F +:1059E000204610BD8248406801680A78521C0A703F +:1059F000016A0068C26A914204D8007D01281CBF78 +:105A000001207047002070472DE9F843784C774813 +:105A100000262060416A00680D6880F8346095F8BF +:105A2000A610002904BF007D032850D1F9F7BCFE61 +:105A30002268526901461046FBF7FEF8002846DD51 +:105A4000216840F271274A6A13680A685B88D2F8B5 +:105A50001CC07B43CCEB4303B0FBF3F02B8E401C0C +:105A6000184410860A68B5F89C00118E401A00B2DE +:105A700000282CDD012082F83600B5F84E00B5F87C +:105A80004C10DFF88481401A298E401E084487B2EA +:105A900016E0496A097938F811100096028E95F8D7 +:105AA000CC30007D38F81330194489B20123FFF758 +:105AB000B8FA60B101280DD0022818BFFFDF06D068 +:105AC00021680868028EBA1A12B2002AE1DA26604A +:105AD000BDE8F88320680068018E491C0186EFE765 +:105AE00070B5434E00240628756843D2DFE800F005 +:105AF0001820030E240D002000F0C3F9EC76AC76DC +:105B00002C606C62706888B1746070BD4048356804 +:105B10000078F3F755FDEC76AC762C606C6270BDC6 +:105B2000012000F0AEF970680028EDD1FFDFEBE74F +:105B300029680320087570BD686A29680068CA6909 +:105B40008A60418840F2E24251432A68D160B0F84D +:105B5000E810C18290F8E6100175B0F8EA104180B3 +:105B6000B0F8EC108180B0F8EE10C18029680220F6 +:105B7000087570BDFFDF70BD70B51D4D002470B19C +:105B8000012812D002281CBFFFDF70BD00F0D5F93C +:105B90006868C47684760460446220B93BE000F013 +:105BA000CCF96868B0B36C6070BD686801684C700F +:105BB000C4768476104E046044620021706802F05E +:105BC000EDFE706880F8E24080F8E340FFF7C0FE29 +:105BD000002818BFFFDFF9F718FD0D486C6000784A +:105BE000F3F7EEFC6C6070BDD4000020581000206C +:105BF000CC000020DB550100DC0000200AFAFFFF8A +:105C000021550100A810002052B50100CF821300D9 +:105C1000C4000020FFE7FFDFC5E7E7494968CA7E07 +:105C2000022A18BF70470A681378002B18BF704704 +:105C300050600968CA6A10442838C8627047DE4A52 +:105C400000B5526841B1012908BF401E04D00229A5 +:105C500016BFFFDFC01F00BD106200BDD748C07E69 +:105C600000281CBF0020704710B50720F7F782FE00 +:105C700080F0010010BD38B5CF4C2068016849782C +:105C8000012932D001216846FBF7D3FA9DF80000C4 +:105C900042F210710002B0FBF1F201FB1201206828 +:105CA000426AC06812681144FAF740F82168C86077 +:105CB000C249226803208A4205D0118B0A2924BFD9 +:105CC0000221517203D2118B491C11835072107240 +:105CD00000231371107F92F81BC0111D947EA44500 +:105CE0000FD0BDE83840FAF7AFB9C0684FF47A7109 +:105CF000FAF71CF82168C860FCF785FF2168086185 +:105D0000D6E7D37693761360536238BD2DE9F84316 +:105D1000A94E3068416A04680D6894F8351031B1B5 +:105D2000618E2A8E914202BF407A0028FFDFF9F788 +:105D30003BFD3268526901461046FAF77DFF336831 +:105D40004FF000090028596A096808BF48460AD080 +:105D50001A68498840F2712CD26901FB0CF1C2EB40 +:105D60004101B0FBF1F02A8E618E02EB000C61451F +:105D7000AEBF481C401C1044608694F8360030B911 +:105D8000608EB5F89C10884204BF401C6086188B5A +:105D90008B4F401C1883B5F84E00B5F84C10401AD4 +:105DA000298E401E08441FFA80F818E03068406AC7 +:105DB000007937F81000CDF8009095F8CC1037F83E +:105DC0001110084481B2207D0023FFF72AF9002832 +:105DD00008BFBDE8F883012818BFFFDF10D0628E2E +:105DE000A8EB020000B20028E0DA082085F84A009B +:105DF000012085F849002846BDE8F84301F037BA8C +:105E0000608E401C6086EAE72DE9F047DFF8B48138 +:105E1000694C05464FF01F090027EE7E042E23D261 +:105E2000DFE806F02922021D454518BFFFDF0220EA +:105E30002560A8762168C87E28B1C87E8A7E9042F7 +:105E400008BF20BFF6D0C87E8F7600281CBF4FF059 +:105E50000C0927600CD10F604F6227600BE0012016 +:105E6000FFF7E4FB814600E0FFDFB9F1000F02D04D +:105E7000E87EB042D1D1E87E002818BFFFDFBDE840 +:105E8000F087F8B54C4D002601286A68516A0C6805 +:105E900044D108794A4B33F81010106890F814C0B8 +:105EA0000127BCF1030F06D0027D022A12D0007D2B +:105EB000012823D032E0066110688660009794F8CC +:105EC000CC00B4F89C2033F810000023084481B2C1 +:105ED00003201EE0B4F8AE200261009794F8CC00D5 +:105EE000B4F89C2033F810000023084481B202204B +:105EF000FFF797F8696809680F750CE0009794F848 +:105F0000CC00B4F89C2033F810000023084481B280 +:105F10000120FFF786F8002818BFFFDFF9F775FBAF +:105F200029480078F3F74CFB686806830268218EE5 +:105F30005186006880F83660F8BD38B51E4C0020E8 +:105F40000546616809684A78002A18BF4D702AD151 +:105F5000097861B101216846FBF78FF99DF80000CF +:105F600042F210710002B0FBF1F201FB1200626814 +:105F7000516A09680144D068F9F7D8FE6268D060B8 +:105F8000157103205072107FD37E111D92F81AC034 +:105F9000634502D0FAF758F803E0D5769576156098 +:105FA000556260680583F9F730FB07480078BDE863 +:105FB0003840F3F705BB0000CC0000208010002023 +:105FC00052B5010058100020C400002010B584B064 +:105FD00004466846FCF71BFD002808BFFFDF009859 +:105FE00003F09DF80321009803F0B3F800980178BE +:105FF00021F010010170214603F00EF90D2C7CD226 +:10600000DFE804F03122075CABABAC159AABACAC6B +:106010008100FE48806890F8B510009803F07BF985 +:10602000FCF708FD00281CBF04B010BD81E0F74854 +:10603000806890F89110009803F0BDF9FCF7FAFC25 +:10604000002808BFFFDFA6E0F0488068D0F8C00055 +:10605000411C009803F050F9FCF7ECFC00281CBF31 +:1060600004B010BD65E0E94CA068D0F8BC008179AF +:10607000009803F015F9A068D0F8BC0001890098D9 +:1060800003F007F9A068D0F8BC004189009803F03C +:10609000EBF8A068D0F8BC008189009803F0EBF819 +:1060A000A068D0F8BC00C189009803F0EBF8FCF7B9 +:1060B000C1FC00281CBF04B010BD3AE0D34CA0685E +:1060C000D0F8BC00011D009803F029F9A068D0F8B1 +:1060D000BC0000F10C01009803F02BF9A068D0F887 +:1060E000BC0000F11E01009803F029F9A06800F13E +:1060F0008801009803F031F900E02EE0FCF79AFCEB +:1061000000283CD145E0C14C60690178009803F05B +:106110003CF960698188009803F039F96069418829 +:10612000009803F038F9FCF785FC00281CBF04B088 +:1061300010BDFFDF04B010BD0020029003909DF859 +:10614000080002A940F001008DF80800009803F053 +:1061500034F9FCF76FFC90B91BE0FFDFFCF76AFC39 +:10616000002808BFFFDF0C2C04BF04B010BD072CB3 +:1061700011D0012C19BF002C022C04B010BD00213D +:10618000A2488068A0F85210012180F8561004B08F +:1061900010BDFFDFF3E79D4900208968A1F8580092 +:1061A00004B010BD2DE9F843984D04464FF00006A9 +:1061B0006878084368702846A988806811F0200F25 +:1061C00018BFA0F84C6004D1B0F84C20521CA0F8C5 +:1061D0004C2011F0600F4FF0010707D090F83E10EF +:1061E00021B980F83E700121FEF729FD4FF0080823 +:1061F000002C40F018826878002840F01681287939 +:1062000010F0040F0DD0A86890F83B00052808BFD7 +:10621000FFDFA86890F83D10022904BF2F7080F8B6 +:106220003D60287910F0020F00F0CD8068780028DA +:1062300040F0C980E868C0780D2880F0C380DFE8AE +:1062400000F04333076FC1C1851823C15264900029 +:10625000A8680023012190F83D20303002F0C3FDF2 +:1062600000283FD1A868032180F83D1080F85660CF +:106270008DE0A8680023194690F83C20303002F0E9 +:10628000B2FD00287ED19EE0A8680023194690F850 +:106290003B20303002F0A7FD002808BFFFDF0920B7 +:1062A000A96881F83B008EE0A8680023194690F8A1 +:1062B0003B20303002F097FD002808BFFFDF0720A9 +:1062C000A96881F83B007EE0A8680023194690F891 +:1062D0003B20303002F087FD002808BFFFDFA868B0 +:1062E00080F83B806FE0A8680023194690F83B20B7 +:1062F000303002F078FD002808BFFFDFA8680A21CF +:1063000080F85B7080F83B105DE0A86890F83B0077 +:106310000D2818BFFFDFA8680C2180F85C7012E020 +:10632000A8680023194690F83B20303002F05BFD4E +:1063300028B9A86890F85C00002808BFFFDFA868AB +:106340000E2180F85B7080F83B103CE0A86890F864 +:106350003B00132818BFFFDF1520A96881F83B0018 +:1063600031E0A868D0F8BC1003884A889A4204BF7C +:10637000097804290ED0A8680023194690F83C201B +:10638000303000E002E002F02EFDE0B1A86880F8B5 +:106390005A6018E090F83B2000231946303002F094 +:1063A00022FD002808BFFFDFA86890F85E1011F0FA +:1063B000020F0FBF80F83B7080F85660D0F8BC0029 +:1063C0000670D8E7FFDF287910F0080F0AD0687848 +:1063D00040B9A86890F83D10032903D10221297023 +:1063E00080F83D6000F0E2FBA87810F0080F19D0AB +:1063F000A8680023052190F83B20303002F0F3FC20 +:1064000070B185F80180A86802E00000E400002077 +:10641000D0F8D01008780B2808BF0020087001E0E1 +:1064200002F029F8A86800F046FB6846FCF7EFFA8E +:10643000002800F0F8806878002840F0F480A86810 +:106440000023012190F83D20303002F0CCFC0028E0 +:1064500040F0E980A86890F8B410002918BF022025 +:1064600026D190F83B200C2A0ED00D2A08BF0B2015 +:106470001ED0132A08BF06201AD000230421303072 +:1064800002F0B1FCB8B1CEE0FAF7F6FE0C284DD31D +:10649000A8680821D0F8BC001E30FAF7EEFE28B13B +:1064A000A86804218830FAF7E8FE00B9FFDF03206E +:1064B000FFF78CFDB7E0A86890F83C10012927D0C1 +:1064C000052920D0D0F8BC100A7882B34988028808 +:1064D000914261D190F83B2000231946303002F000 +:1064E00082FC20B3A868D0F8BC100978022908BF44 +:1064F000002026D003291BD004293AD0052908BF43 +:1065000008201ED048E00720FFF760FDA8680BE0D8 +:106510000C20FFF75BFDA868A0F8586090F85E10AB +:1065200041F0010180F85E1080F83C607BE033E0D0 +:1065300090F83F1041B190F84000002808BFFFDFFD +:106540000A20FFF743FD27E0FAF796FE0C2823D335 +:10655000A8680821D0F8BC001E30FAF78EFE28B1DA +:10656000A86804218830FAF788FE00B9FFDF03200D +:10657000E7E790F85E0010F0030F0DD10C20FFF755 +:1065800025FDA868A0F8526080F8567090F85E105B +:1065900041F0010180F85E106846FCF738FAE0B37C +:1065A000A8680023194690F83B20303002F01BFC0D +:1065B00098B3A86890F8C41079B3A969097861BB49 +:1065C000018E0A292FD900F108010522E86904F09B +:1065D00005FC0028A86808BF80F8C46023D0D0F864 +:1065E000C000017851B1411C0522E86904F0F6FBB6 +:1065F00098B9A868D0F8C000007830B9A868E969EF +:10660000D0F8C000401C04F0D4FDA868D0F8C00049 +:106610000178491C0170012000E004E0FFF7D6FC7E +:10662000A86880F8C460A868A14600F1300490F81A +:10663000B40030B9627B00230121204602F0D3FB75 +:1066400010B1208C401C20843D21B9F1000F18D1DD +:106650002878022808BF16200ED0012804BFA86899 +:1066600090F8B60008D06878B0B110F0140F1CBFD5 +:106670001E20A07602D005E0A07603E010F0080FFF +:1066800002D0A17667763AE010F0030F08BFFFDF73 +:106690002A20A076677632E094F8260028B1608C34 +:1066A000411C6184A18C884213D294F82A0028B13D +:1066B000208D411C2185A18C88420AD2208CE18B3F +:1066C000884203D3AA6892F8B42012B9A28C9042EF +:1066D00003D32220A076677611E0A07B0028A08B50 +:1066E00005D0884228BF84F81A80CBD205E006285E +:1066F00003D33E20A076677601E0607E40B1E6726B +:106700002673A673A868BDE8F8430221FEF797BA7E +:10671000A868BDE8F8430021FEF791BAFE494A781F +:106720008B781A430ED101280AD0087910F0040F93 +:1067300004D0886890F83D00022803D001207047FB +:10674000FEF771BA0020704770B5F34C05460E464F +:10675000A0882843A08015F0020F04D015F0010F87 +:1067600018BFFFDFE66015F0010F18BF266115F0B6 +:10677000020F13D0304602F075FD062802D00B2818 +:1067800030D00BE0A06890F83B10132906D100210F +:10679000C0E91C115FF0010180F8401015F0800F76 +:1067A0001CBF0820A07015F4806F08BF70BDA168E1 +:1067B000088E89880844801D85B2304602F052FD5B +:1067C000012817D0304602F04DFD002818BF70BDDB +:1067D000A0682946D0F8BC0085803046BDE87040EE +:1067E00002F062BDA06890F83B100D2908BF00219F +:1067F000D4D1D1E7A0682946A0F8C6503046BDE8FC +:10680000704002F081BDF8B5C34C00260546A0607B +:10681000A6806670A67026700088FCF7F5F8A06860 +:106820000088FCF717F9B5F8A000A168401C82B2F7 +:1068300001F1300002F0FDF9002818BFFFDFA5F8D4 +:10684000A060A06890F8561031B1B0F85210B0F8BE +:106850005420914228BFF8BD90F85A1031B1B0F8D9 +:106860005810B0F85420914228BFF8BDB0F850201D +:10687000B0F84E108A4228BFF8BD90F83E20B0F81C +:106880004C00CAB1884228BFF8BDA4480090A44B70 +:10689000A44A2946304601F066FCA0680023052181 +:1068A00090F83B20303002F09EFA002808BFF8BD77 +:1068B000BDE8F84001F053BC0628E6D3F8BD964881 +:1068C000806890F8561029B1B0F85210B0F85420F2 +:1068D000914219D290F85A1029B1B0F85810B0F876 +:1068E0005420914210D2B0F85020B0F84E108A4295 +:1068F0000AD290F83E20B0F84C001AB1884203D278 +:1069000001F08BBD0628FBD3002001464AE42DE9A7 +:10691000F0410C4607461D461646D8212046DDF8B4 +:10692000188004F020FB2780C4F8D080C4E92F65CC +:10693000BDE8F081F7F7A4B970B50C4615460621FD +:10694000F7F77BF8002808BF70BDD0F8D0100A78A0 +:106950000021072A1ED00C2A2FD00B2A3BD0062A52 +:1069600049D090F8C820002A04BF002070BD617093 +:106970001222227090F8C82052B100BF80F8C810CF +:10698000D0F8CA20C4F8022090F8C820002AF5D117 +:10699000012070BD002DFBD1617007222270D0F85C +:1069A000D0205368C4F802309368C4F80630928946 +:1069B0006281D0F8D0000170EAE7002DE8D1617063 +:1069C0000C222270D0F8D0205268C4F80220D0F8EF +:1069D000D0000170DCE7002DDAD161700B2222704B +:1069E000D0F8D0205368C4F802301289E280D0F881 +:1069F000D0000170CCE7002DCAD161700622227050 +:106A0000D0F8D0205368D2F808C0D268C4F8023059 +:106A1000C4F806C0C4F80A20D0F8D0000170B7E767 +:106A2000002070473C494861704710B50446B0F8F3 +:106A3000A000401CA4F8A000B4F84C00401CA4F82E +:106A40004C0094F8560020B1B4F85200401CA4F851 +:106A5000520094F85A0020B1B4F85800401CA4F831 +:106A6000580094F8B40040B994F83D200023012167 +:106A700004F1300002F0B7F920B1B4F85000401C26 +:106A8000A4F85000204600F016F8002010BD224A5D +:106A9000C2E906017047B0F84C1090F83E20091D7D +:106AA0002AB1B0F84E00814203D301207047062975 +:106AB000FBD20020704770B5044690F83B000025DB +:106AC000072821D1208EB4F8C610401C884218BF78 +:106AD00070BDD4F8C000411C04F1080004F069FB4B +:106AE0000221204602F00CF884F83B50012084F883 +:106AF0006600D4F8C0000078002808BFFFDFD4F893 +:106B0000C0000178491E017094F83B00082818BFA6 +:106B100070BD208E08E00000E4000020A5610100A7 +:106B20001D67010049670100D4F8BC10401C89882A +:106B3000884218BF70BDD4F8D0000178002918BF72 +:106B4000FFDF1ED12188C180D4F8BC00D4F8D0105A +:106B500040890881D4F8BC00D4F8D01080894881DD +:106B6000D4F8BC00D4F8D010C0898881D4F8D00003 +:106B70000571D4F8D01007200870D4F8D010208800 +:106B800048800121204601F0BBFF03212046FEF78B +:106B900056F8D4F8BC0021884088884218BFFFDF2F +:106BA000D4F8BC00057084F83B5070BDF0B5FF4CC4 +:106BB0008DB0207910F0010F04BF0DB0F0BD206939 +:106BC00000230521C578A06890F83B20303002F002 +:106BD0000AF9002818BF022D0CD00B2D18BF042D68 +:106BE00008D0052D1CBF062D0D2D03D0607840F078 +:106BF00008006070607800281CBF0DB0F0BD2069EF +:106C0000C078801E0C2880F0D881DFE800F006FDF7 +:106C10002B4BD2FCFDFBFD21FA96A068002301213D +:106C200090F83D20303002F0DEF8002840F0E3819B +:106C3000206902F072FBA16881F8B600022081F899 +:106C40003D00002081F85A0081F8560000F0D3B9C9 +:106C5000A06890F83B100A2929D1002180F83F1044 +:106C60000D2166E0A06890F83B100E291FD1D0F8E6 +:106C7000BC1000884988814218BFFFDFA068D0F8A7 +:106C8000BC0000F12601206902F074FBA06800F14D +:106C90008C01206902F076FBA168112081F83B008D +:106CA00000F0A9B9A66896F83B00112803D002208D +:106CB000607000F0A0B9D6F8BC10102501F10E0CE0 +:106CC00000210DF1FF3208206B1A6344401E13F8B7 +:106CD000017C577013F8023C02F8023F01F10201F7 +:106CE000F2D1D6F8BC10102601F11E0300210822B3 +:106CF0000DF10F00A6EB010C9C44891C1CF8015CF3 +:106D000045701CF802CC00F802CF521EF2D1684642 +:106D100003F030F808ADA06895E80E1000F1780592 +:106D200085E80E100021C0E91A11012180F83F10FA +:106D3000132180F83B1000F05EB9A16891F83B0088 +:106D4000112812BF0E2891F85C000028AFD12069ED +:106D500002F02FFBA168002581F8900081F85B50BC +:106D600081F85650D1F8BC0009884088884218BF85 +:106D7000FFDFA068D0F8BC100D70D0F8D0100A78F2 +:106D8000002A18BFFFDF40F014810288CA80D0F8C3 +:106D9000D02090F890101171D0F8D0100D72D0F86A +:106DA000D0200B2111700188D0F8D000418000F074 +:106DB00000B9A06890F83B10152918BF022040F0D8 +:106DC0000981002580F85B5080F85650D0F8BC103F +:106DD00000884988814218BFFFDFA068D0F8BC1046 +:106DE0000D70D0F8D0100A78002A18BFFFDF40F0ED +:106DF000E08090F85C20A2B180F85C500288CA80E4 +:106E000003E020E08BE089E0D7E0D0F8D0100D71EE +:106E1000D0F8D0200C2111700188D0F8D00041802A +:106E2000C7E00288CA80D0F8D0100D71D0F8D02009 +:106E300001211172D0F8D0200B2111700188D0F8F7 +:106E4000D0004180B5E0A0680023194690F83C20AE +:106E5000303001F0C8FF48B9A0680023072190F83E +:106E60003B20303001F0BFFF00287DD06078002843 +:106E700054D1A06890F85E0010F0020F17D120697D +:106E800002F08DFAA16881F85F00206902F089FAAA +:106E9000A168A1F86000206902F086FAA168A1F853 +:106EA000620091F85E0040F0020081F85E00A06888 +:106EB00090F85E1011F0010F15D190F83C200023DE +:106EC0001946303001F08FFF002808BFFFDF012195 +:106ED000A068042280F83C1080F8B82080F85A108E +:106EE0000021A0F85810A06890F83B10012904D1A7 +:106EF000002180F83B1080F85610D0F8BC200388A1 +:106F00005188994204BF1178042974D1002111706D +:106F100090F83B20002A08BF80F856106BE0A0686C +:106F20000023062190F83B20303001F05CFFD8B1FF +:106F3000607800285FD16946206902F04DFA9DF81B +:106F4000000010F001008DF8000014BF01200020A7 +:106F5000A168002581F86400A06880F85650D0F838 +:106F6000BC100088498800E033E0814218BFFFDF91 +:106F7000A068D0F8BC100D70D0F8D0100A78002AA4 +:106F800018BFFFDF15D10288CA80D0F8D0100D716C +:106F9000DDE90013D0F8D0209160D360D0F8D02084 +:106FA000062111700188D0F8D00001E0E400002033 +:106FB0004180A06880F83B501DE0A068002319467E +:106FC00090F83C20303001F00EFF10B1607818B11D +:106FD00011E0012060700EE0206902F043F9A16821 +:106FE00081F89100052081F83C000020A1F85800AC +:106FF000012081F85A00A068D0E91C12491C42F116 +:107000000002C0E91C120DB0F0BD000030B585B023 +:1070100004466846FBF7FBFC002808BFFFDF00982A +:1070200002F07DF80321009802F093F800980178AF +:1070300021F010010170214602F0EEF8A01E0C288C +:1070400051D2DFE800F006501E5151165042505107 +:10705000312CFD48C06890F8651021B106210098D8 +:1070600002F059F940E090F8CF10009802F053F97F +:107070003AE0F548C06890F89110009802F09BF94A +:1070800032E0F14DE86800F1B801009802F06DF9C6 +:10709000E86800F18C01009802F071F924E0062103 +:1070A000009802F084F91FE0E74DA8680178009885 +:1070B00002F06BF9A8688188009802F068F9A86866 +:1070C0004188009802F067F90EE0002002900390DA +:1070D0009DF8080002A940F001008DF80800009812 +:1070E00002F075F900E0FFDFFBF7A4FC002808BF01 +:1070F000FFDF0C2C04BF05B030BD072C0DD0022CD7 +:1071000004BF05B030BD0021CF48C068A0F85810BA +:10711000012180F85A1005B030BDCB490020C96864 +:10712000A1F8580005B030BD70B50C4605464FF4C7 +:107130009071204603F017FF2580002084F8F000AE +:1071400084F8FC0084F8040184F8120170BDF6F79D +:1071500097BD70B50C4615460721F6F76EFC002862 +:1071600008BF70BD90F8F0200021DAB1002D77D172 +:1071700061700722227090F8F0208AB1018480F8B3 +:10718000F010D0F8F220C4F80220D0F8F620C4F8AD +:107190000620B0F8FA20628190F8F020002AEDD1A4 +:1071A000A1705DE090F8FC2002B3002D58D190F85A +:1071B000FC200B2A0CD00C2A18BFFFDF50D16170C5 +:1071C0000C22227090F8FE20A2700288A2800AE0B1 +:1071D00061700B22227090F8FE20A2700288A280BB +:1071E00090F80221A27180F8FC1039E090F8042197 +:1071F0008AB17DB961700822227002886280D0F85D +:107200000821D0F80C316260A360B0F81021A2818F +:1072100080F8041124E090F812214AB105BB617096 +:1072200011222270B0F81421628080F8121117E048 +:1072300090F81621002A04BF002070BD85B9617046 +:107240001222227090F8162152B100BF80F8161158 +:10725000D0F81821C4F8022090F81621002AF5D1A0 +:10726000012070BD00207047774988607047002179 +:1072700080F83B1080F83C1080F83E1090F8A60093 +:1072800010B10220FEF72CBC0320FEF729BC2DE92B +:10729000F04F6D4C07468DB0E0680D460088F6F75C +:1072A00044FD5FEA000B08BFFFDF60782843607091 +:1072B000A188E06811F0200F4FF000051CBFA0F876 +:1072C0004C5080F8AC5004D1B0F84C20521CA0F8BF +:1072D0004C2011F0600F4FF002084FF0010613D060 +:1072E000E06890F83E1011B1032907D00CE080F857 +:1072F0003E6000210120FEF7F3FB05E080F83E80B0 +:1073000000210120FEF7ECFBE06890F83E10012917 +:1073100005D1A18811F4807F18BF80F83E80002F2E +:1073200040F09B81A18811F4007F18BFA0F8C050E5 +:1073300004D1B0F8C010491CA0F8C01000F09AFBAE +:107340000CA8FBF764FB002800F0E88060780028B8 +:1073500040F0E480E0680123194690F83D20303089 +:1073600001F041FD002849D1D4F80CC09CF8CE00B2 +:1073700038B1ACF850508CF865500220FFF746FE4B +:10738000CCE09CF83C200B2A08BF0B201AD00ADC6A +:10739000012A7BD0052A08BF072013D0092A08BF7D +:1073A00009200FD005E00F2A0FD0102A20D0162A6E +:1073B0007CD0012304210CF1300001F014FD0028E1 +:1073C0001CD187E0FFF722FEA8E0F9F755FF0C2853 +:1073D00014D3E0680821B830F9F74FFF28B1E0680E +:1073E00004218C30F9F749FF00B9FFDF0420E9E7F9 +:1073F0009CF8D100012802D0022849D08EE09CF8E8 +:10740000FC00002841D100220CF1D2094FF01008F5 +:1074100008210DF1FF3000BFA8EB02034B44491EC9 +:1074200013F801AC80F801A013F8023C00F8023F09 +:1074300002F10202F0D10CF1B00800204FF0100C64 +:107440000DF10F01082201E004010020ACEB000364 +:107450004344801C13F8019C81F8019013F8023C0E +:1074600001F8023F521EEED1684602F083FC0DF196 +:107470002008E06898E80E10783080E80E100520AB +:10748000FFF7C4FDE06880F8D15047E015E00DE05B +:107490009CF85C0000281ABF8CF8656002200D2063 +:1074A000FFF7B4FDE06880F8D15037E00620FFF721 +:1074B000ADFDE06880F85A5030E00C20FFF7A6FDE3 +:1074C000E068A0F8585090F85E1041F0010180F893 +:1074D0005E1023E0E06890F83B2090F8E210E9B1FC +:1074E00001230021303001F07EFCB8B1E06890F853 +:1074F000E210042904BF90F85E0010F0030F0DD1D4 +:107500000C20FFF783FDE068A0F8525080F8566029 +:1075100090F85E1041F0010180F85E1000F0A1FFCC +:107520000028E06818BFA0F8A05004D1B0F8A0105F +:10753000491CA0F8A01000F097FF40B1E06890F857 +:10754000AC1002299CBF491C80F8AC1004D8E0683C +:1075500090F8AC00022806D9E068A0F8A050A0F886 +:10756000A25080F8AC50E0680123002190F83C2044 +:10757000303001F038FC20B9E06890F83C00072872 +:1075800056D1E0680123002190F83B20303001F013 +:107590002AFCE8B3E0680123002190F83D20303058 +:1075A00001F021FCA0B3E06890F83E10022904BF6E +:1075B00090F8AC0000283BD15846F5F7E8FE38B308 +:1075C000FBF76CFA20B3E068B0F89A1001292FD9C4 +:1075D00080F8A560B0F84E10B0F84C208B1E9A428F +:1075E000AFBF0121891A491E89B2B0F8A030E288E4 +:1075F00093422FBF0122D21A521C92B2914288BFED +:107600001146012908BF80F8A55090F8C82000E075 +:107610000EE08AB1B0F8A220B0F8CA0082422FBFB3 +:107620000120801A401C80B2814288BF014603E0DD +:10763000E068012180F8A550E068028E114489B20B +:10764000A0F89C1090F83E30002B18BF012B1DD0E5 +:10765000022B1CBF032BFFDF09D0A088C0F3402002 +:107660000028E06818BFA0F8AE5022D11AE090F8C8 +:107670003D30032B0DD090F83C20082A06D0B0F8FE +:107680004E20B0F84C30D21A921E1144A0F8981037 +:10769000E3E7B0F84C30032BF8D3B0F84E101144A8 +:1076A000491CF3E7B0F8AE10B0F89E201144A0F8E2 +:1076B000AE10E06890F8CE1039B990F83D20012363 +:1076C0001946303001F08FFB38B1E068B0F8501047 +:1076D000B0F89E201144A0F850103D212FB1E06871 +:1076E00080F84A1080F8496069E02078022810D0BC +:1076F00001281AD0607800B310F0140F14BF1E21B7 +:1077000010F0080FEBD110F0030F08BFFFDF2A21A4 +:10771000E5E7E06890F86510002914BF06211621FE +:1077200080F84A1080F8496049E0E06890F8D0108D +:1077300080F84A1080F8496041E0E06890F85610FF +:1077400041B1B0F852104A1CA0F85220B0F85420B1 +:10775000914214D290F85A1041B1B0F858104A1C16 +:10776000A0F85820B0F85420914208D2B0F8502028 +:10777000B0F84E108A4208D390F8CE202AB12221C8 +:1077800080F84A1080F8496019E090F83E204AB12C +:10779000B0F84C208A420FD3082180F84A1080F8B4 +:1077A00049600CE0B0F84C10062905D33E2180F862 +:1077B0004A1080F8496002E090F8490088B1E0681A +:1077C00080F83B5080F83C5080F83E5090F8A6007E +:1077D0004FF00001002814BF02200320FEF780F9BB +:1077E00003E000210846FEF77BF9E06880F8A65028 +:1077F0000DB0BDE8F08FFE494A788B781A430DD161 +:1078000050B1087910F0080F04D0C86890F83D0016 +:10781000032803D001207047FEF7E4B8002070472A +:107820002DE9F041F24C05460E46A0882843A08081 +:1078300015F0020F04D015F0010F18BFFFDF26610D +:1078400015F0010F4FF000084FF001071CD0304633 +:10785000666101F007FD062802D00B280BD013E06B +:10786000E06890F83C1012290ED10021C0E91A11ED +:1078700080F83F7008E0E06890F83C100C2904BFE5 +:1078800080F83F8080F85C7015F0020F19D02069F5 +:1078900001F0E8FC052802D00B280BD011E0E068CD +:1078A00090F83C1010290CD10021C0E91C1180F87F +:1078B000407006E0E06890F83C100B2908BF80F8A3 +:1078C000408015F0800F1CBF0820A070BDE8F0813B +:1078D0002DE9F043C64C83B00127216900250191B1 +:1078E000A5806570A5702570E06067F307080646FF +:1078F00080F8A6700088F6F718FA5FEA000908BF5A +:10790000FFDFE0680088FBF77FF8E0680088FBF79E +:10791000A1F8E068B0F89A00D0B101A8FBF777F8B9 +:10792000B0B1E06890F8CE1091B190F83D200123FD +:107930001946303001F057FA50B9E068A0F85050BD +:1079400080F865500220FFF761FBE06880F8A550E1 +:10795000E26892F8F00028B9108C9188884288BFBC +:10796000E08001D89088E080B2F89E00B2F8A010C4 +:10797000401E80B2014489B2A2F8A01092F8A4304F +:10798000002B1CBFA2F8A25082F8A45004D1B2F878 +:10799000A2300344A2F8A230B2F84C300344A2F85B +:1079A0004C30B2F89A30012B9CBF5B1CA2F89A3085 +:1079B000002818BF82F8AC5092F8A50000281CBF20 +:1079C000E08881420FD24846F5F7E1FC58B1E06803 +:1079D00090F8C81039B1B0F8A210B0F8CA008142CE +:1079E00028BF00F044FDE06880F8A55090F83C10F6 +:1079F000062918BF072916D1018EB0F8E420891A8C +:107A000009B200290FDB00F1E601083003F0D1FBD9 +:107A10000221E06800F0C2FFE06880F8E35080F8DF +:107A20003C5080F86670E16801F13000B1F89E20AA +:107A300001F0FFF8E06890F8C810002918BFA0F81E +:107A4000A2506C4800906C4B6C4A3146404600F0A6 +:107A50008AFBE0680123052190F83C20303001F0DA +:107A6000C2F9002818BF00F07AFB03B0BDE8F0832C +:107A700000F0D3BC2DE9F0415D4C4FF002074FF010 +:107A80000005207910F0080F13D0607888B9E068FD +:107A900090F83C10142905D180F85B5080F85A50BA +:107AA00080F83C5090F83D10032904BF277080F8FF +:107AB0003D5000F043F9A1884FF0010611F0040F8A +:107AC00014D0607890B9E06890F83C20062A08BF8E +:107AD00080F8E36003D0082A08BF80F8E37090F8CC +:107AE0003D20022A04BF267080F83D5011F0020F9D +:107AF0004FF0030754D06078002851D12069C07836 +:107B0000801E0C287CD2DFE800F006B636415718FC +:107B1000B622B6298B4CE0680123194690F83D2027 +:107B2000303001F060F900283AD1E06880F83D700B +:107B300080F8565080F85A509EE0E06890F83C007B +:107B4000052818BFFFDFE06880F83C50F2E7E068E6 +:107B500090F83C00092818BFFFDF6FE0E06890F85C +:107B60003C000B2818BFFFDFE0680C2180F85B6049 +:107B700080F83C1080E0E06890F83C000F2818BFC7 +:107B8000FFDFE068102180F85B60F1E7E06890F8C3 +:107B90003C00102818BFFFDF1220E16881F83C008C +:107BA0006AE0E06890F83C00102818BFFFDF14205E +:107BB000E16881F83C005FE0E06890F83C0016283E +:107BC00018BFFFDFE06880F85B5080F85A5090F8EB +:107BD000FC00002818BFFFDFE06890F85C1091B14E +:107BE00080F85C500188A0F8001180F8FE5008E091 +:107BF000040100208F720100F77701002178010055 +:107C000039E00C2107E00188A0F8001180F8FE504F +:107C100080F802610B2180F8FC1080F83C502BE0CA +:107C2000E06890F8E21004290ED0E06801230721F3 +:107C300090F83C20303001F0D6F8E8B1E06880F8E8 +:107C40005A5080F83C5017E090F83B200123002167 +:107C5000303001F0C8F8002808BFFFDFE06890F876 +:107C60005E1011F0020F0EBF80F83B6080F8565096 +:107C700080F8E250D9E7FFDF207910F0100F09D02B +:107C8000607838B9E06890F83C10062904BF0721F5 +:107C900080F83C10A07810F0080F10D0E0680123A5 +:107CA000052190F83C20303001F09DF828B10820E3 +:107CB0006070E06880F8FC5001E000F0DCFBE068F8 +:107CC00090F83C10082918BFBDE8F081018EB0F88B +:107CD000E420491C914206BF61780029BDE8F0818B +:107CE000B0F8EA104288914209D1B0F8EC208388BC +:107CF0009A4204D1B0F8EE20C3889A420ED002888E +:107D0000A0F8F420A0F8F610B0F8EC10A0F8F810E5 +:107D1000B0F8EE10A0F8FA1080F8F060012100F041 +:107D20003DFE00210420FDF7DBFEE06880F8E35013 +:107D300080F83C5080F83E70BDE8F08130B5FF4CD3 +:107D400083B0207910F0010F04BF03B030BD60692B +:107D500001230521C578E06890F83C20303001F01F +:107D600042F8002818BF022D0BD00A2D18BF0B2D8A +:107D700007D0032D18BF062D03D0607840F008000F +:107D80006070607800281CBF03B030BD6069C078A7 +:107D90000D2880F0AB81DFE800F0462207C8FEFE28 +:107DA000FDDBFCFEA3C0FB00E0680123194690F850 +:107DB0003D20303001F017F8002840F0B4816069B0 +:107DC00001F0ABFAE16881F8D000022081F83D00B3 +:107DD000002081F85A0081F8560000F0A4B9E0684C +:107DE0000123002190F83C20303000F0FCFF0028F7 +:107DF00075D06078002840F09681606901F088FABB +:107E0000E168A1F8E4000A8E801A00B247F6FE721B +:107E10008242A8BF00285ADDE631606901F06FFA9E +:107E20000620E1683FE0E0680123002190F83C2053 +:107E3000303000F0D8FF00285FD06078002840F094 +:107E40007281606901F037FA88B3606901F030FA35 +:107E5000E168A1F8E4000A8E801A00B247F6FE72CB +:107E60008242A8BF002832DD606901F01BFAE16898 +:107E700081F8E600606901F010FAE168A1F8E80015 +:107E8000606901F0F5F9E168A1F8EA00606901F0C4 +:107E9000F6F9E168A1F8EC00606901F0F7F9E16832 +:107EA000A1F8EE00082081F83C0000F03CB9FFE7A3 +:107EB000E0680123002190F83C20303000F093FF6F +:107EC00068B16078002800F01F8100F02CB92820EC +:107ED00081F84A00012081F8490000F024B90CE043 +:107EE000E0680123002190F83C20303000F07BFF57 +:107EF00018B1607828B100F016B90120607000F068 +:107F000012B9E0680021A0F85810012180F85A1039 +:107F10000B2180F83C1000F006B9E06890F83C10A6 +:107F20000C2908BF0D214CD143E0E068012300215A +:107F300090F83C20303000F056FF20B9E06890F80F +:107F40005C0000287ED06078002801D101E06070DC +:107F5000E9E0E06800210125A0F8581080F85A50A7 +:107F600000F1B001606901F0F1F9E06800F1880109 +:107F7000606901F0F6F9E06890F80401002818BF84 +:107F8000FFDFE0680188A0F8061100F5847103E0C6 +:107F90001EE087E010E0A9E0606901F0C5F9E06843 +:107FA00000F58871606901F0C7F9E06880F8045154 +:107FB0000F2180F83C10B6E0E06890F83C101229E0 +:107FC00001D00220C3E7002180F85A101621F0E703 +:107FD000E0680123002190F83C20303000F003FFDE +:107FE00048B9E0680123072190F83B20303000F0C9 +:107FF000FAFE002826D06078002852D1E06890F878 +:108000005E0010F0020F17D1606901F0C8F9E16855 +:1080100081F85F00606901F0C4F9E168A1F86000CF +:10802000606901F0C1F9E168A1F8620091F85E00B1 +:1080300040F0020081F85E00E06890F85E1011F0F8 +:10804000010F00E05EE015D190F83C2001230021F3 +:10805000303000F0C8FE002808BFFFDF0121E068D3 +:10806000042280F83C1080F8E32080F85A100021A8 +:10807000A0F85810E06890F83B10012904D10021C5 +:1080800080F83B1080F8561090F8E21004294AD18D +:10809000002180F8E21090F83B20002A08BF80F809 +:1080A000561040E0E0680123002190F83C20303079 +:1080B00000F099FE30B3607818BB6946606901F042 +:1080C00081F99DF8000010F001008DF8000014BF48 +:1080D00001200020E16881F86400E0680021A0F838 +:1080E0005810012180F85A10092162E7E068012345 +:1080F000002190F83C20303000F075FE10B160781F +:1081000010B110E0012022E7606901F0ABF8E168EE +:1081100081F89100052081F83C000020A1F858006A +:10812000012081F85A00E068D0E91C21521C41F17D +:108130000001C0E91C2103B030BD00000401002093 +:10814000F9480078002818BF0C20704730B5F64C6D +:1081500005462078002818BFFFDF657230BDF24960 +:108160000120087270472DE9F047EF4C8146DDF899 +:10817000208020781E4617460D4628B9002F1CBFC8 +:10818000002EB8F1000F00D1FFDFC4F81C80C4E955 +:108190000C95C4E9057600202072E0712071E07032 +:1081A0006071A071E14EA070608130784FF00108DD +:1081B00005F130072888F5F7B8FDA0622888F5F7A3 +:1081C000A2FDE062FAF7BCF80120F9F7CAFDFAF760 +:1081D0000CF905F11100FAF79CF805F10D00F9F71B +:1081E000C7FE307800280CBF03200120FAF7A5F85D +:1081F000387EF9F7C5FE0120F9F7A2FDFAF797F8E6 +:10820000397CCB48002914BFCA49CB49016030787A +:108210004FF0010170B10120F9F726FF7068D0F826 +:10822000A800FAF79BF800BF84F80080BDE8F0478B +:10823000FAF78EB80020F9F717FFF5E72DE9F047B8 +:10824000DFF8E89282B0484600264068012700F136 +:1082500030041B20ADF8000060794FF00208A9F14E +:10826000300570B301285AD002285CD0032818BF0B +:10827000FFDF62D0286A0823017821F0080101702D +:10828000A27903EAC202114321F004010170E279EC +:10829000042303EA8202114321F01001017094F8D3 +:1082A00005A0A86AF5F781F80646FAF7F7FBBAF1D8 +:1082B000020F49D0BAF1010F49D0BAF1030F49D0EA +:1082C0004BE0FFE79D48FAF7C8FB40B1296AAF7061 +:1082D0006A694FF48060904703206071CAE701AA81 +:1082E0006946A86AF4F752FF286210B194F82B107F +:1082F00021B19248FAF785FB6771BBE79DF804103E +:1083000021B906808670012100F023FFBDF800002E +:10831000C1B2286A01F065F884F80580AAE78748A9 +:10832000FAF76FFBA6E701AA6946A86AF4F72EFFE1 +:108330002862002808BFFFDF9CE78048FAF78DFB22 +:10834000002808BFFFDF95E7B04306D103E0B04344 +:1083500003D100E00EB1012100E00021286A02787B +:1083600042EA01110170E17B00291CBF61790129FA +:1083700026D004F14801724891E80E1000F1480639 +:1083800086E80E10A16DC0F86110E16DC0F86510AF +:108390002230F9F7E0FF99F8000000280CBF012116 +:1083A000002168480176D4E90E12C0E90412A0F158 +:1083B00026012A6AF9F711FC0020F9F71FFC03E0F7 +:1083C000F9F7C9FFF9F741FC99F8000028B1286ACC +:1083D000007810F0100F05D00CE001210846FAF7E4 +:1083E0007CF80AE05848007810F0100F04BF287994 +:1083F000002802D0A8780028EFD06879002804BFB0 +:108400006F71F9F7D0FF286A0188A9818078A87375 +:1084100085F8008002B0BDE8F087434810B50078C9 +:10842000012818BFFFDFF9F78BFF40480178446847 +:1084300011B9FFF703FF01E000F0BCF994F8280040 +:10844000012818BF10BDBDE81040FAF723B8364820 +:1084500010B50078032818BFFFDFBDE8104000F01A +:10846000F4B93148407970472F48007970472E4958 +:108470000120887170472DE9F0412C482A4D0126D2 +:1084800001784068002700F13004686A417801F003 +:108490001F08E96A02F09AF868B1012821D0022881 +:1084A00034D003281CBFFFDFBDE8F081E86ABDE8D7 +:1084B000F041F5F7E4B801224146E86AF4F7FAFF23 +:1084C000D4E91010491C40F10000C4E91010E07913 +:1084D000012814BFE671E771687ABDE8F041F1F751 +:1084E0006FB800224146E86AF4F7E4FFD4E91001CE +:1084F000401C41F10001C4E91001E079012802D1DA +:10850000E771BDE8F081E671BDE8F081E86AF5F752 +:10851000B6F8D4E91010491C40F10000C4E910106D +:10852000E0790128EFD1EBE71C0100204C0100208D +:10853000181500401F0003021B0003023C0100202D +:10854000F8100020401100202B0100202DE9F041FF +:10855000F04F4FF000083846A7F13004406801267C +:1085600000F130052078022818BFFFDFA87850B14D +:1085700085F80280A67062694146042090473878E9 +:10858000002818BF2E71206A0321007831EA00000C +:1085900004BFE878002805D1EE70216AA6706269F0 +:1085A000022090470121002000F072F918B1BDE8C7 +:1085B000F04100F04AB9BDE8F04100F0FBB82DE908 +:1085C000F05FD44E82463046A6F1300540684FF049 +:1085D000000800F1300928780127032818BFFFDFC1 +:1085E0006889BAF1000F40F40070688104BF40F060 +:1085F0004000688100F0CE80F9F73DFB98B999F80A +:10860000100080B1686A417811F01F0F0BD000781C +:1086100099F80710C0F3C000884204D1EF70BDE89C +:10862000F05F00F012B9686A0188A5F80F10807831 +:108630006874688940F02000688185F8048070685B +:1086400000F1300B044690F82800012813D1F9F707 +:1086500017FF5946204600F09BFB60B13078002898 +:1086600070680CBFC83000F58B70218841809BF882 +:10867000081001710770686A99F806100078C0F355 +:108680008000884233D0706800F1300490F83500E3 +:1086900048B3022844D000BF84F80580307838B150 +:1086A0002079414620B12171AF706A69102090474E +:1086B000E07890B184F80380FAF7DEF9002808BF6B +:1086C000FFDF0820AF706A6900219047D4E90E10DF +:1086D000491C40F10000C4E90E10A07901280CBF2C +:1086E00084F80680A771688940F480706881686AA0 +:1086F00099F807300178C1F3C0029A424AD17268F2 +:1087000001F0030102F13004012918BF02292ED023 +:1087100003291CBFE87940F0040012D0E87139E069 +:10872000A86AF4F76DFD002808BFFFDFD4E90E103A +:10873000491C40F10000C4E90E10687AF0F740FFD0 +:10874000AAE700F02AFD70B1A770696AAF706A6984 +:1087500038469047E079012803D100BF84F80780AC +:1087600018E0E77116E0E87940F01000D6E74078AD +:1087700010F01F0F17D0697861B900F01F001B2897 +:10878000F1D8287A20B180206A690021904701E061 +:10879000FFF771FE5146012000F07AF838B1BDE8CC +:1087A000F05F00F052B8E0790128DAD1D6E7BDE8F1 +:1087B000F05F43E570B5584C1B21E06AF4F723FEE7 +:1087C000002101226062002811BF6170627053486D +:1087D0006062504E3078706800F1300590F84000CB +:1087E00038B305F148014D4891E80E1000F1480EEC +:1087F0008EE80E10A96DC0F86110E96DC0F8651023 +:108800002230F9F7A8FD307800280CBF01200020A5 +:1088100080F0010142480176D5E91012C0E9041246 +:10882000A0F12602616AF9F7D8F90120F9F7E6F913 +:1088300004E0606AF9F78FFDF9F707FA01210020DB +:10884000F9F74BFE0320207070BD70B5314900254B +:108850004C68F9F7E7FDF9F7D9FDF9F7FBFCF9F7F3 +:108860005EFDF9F7F2F9F9F7CDFDF9F771FD94F82E +:108870002800012808BFF9F703FE274C0021626990 +:1088800060899047E269E179E0789047257070BD92 +:1088900070B5214C0546002908BF012D05D120796E +:1088A000401CC0B22071012831D8A16928468847F0 +:1088B00000282CD0A1791B4841B1012D01BF41787E +:1088C00011F01F0F017811F0100F20D0E179F1B9EC +:1088D00010490978002918BF002102D0294304D08B +:1088E00013E0012D18BF0121F8D10F49097811F0CB +:1088F000100F04BF007810F0100F08D0A07830B926 +:10890000607810B111F0100F01D0002070BD01206F +:1089100070BD00004C0100201C010020F810002058 +:10892000401100202B0100202801002010B50A7BF7 +:1089300002F01F020A73002282758B181B7A03F063 +:10894000010C5B0803F00104A4445B0803F001047C +:10895000A4445B0803F00104A4445B0803F0010491 +:1089600064444FEA530C0CF0010323444FEA5C0CBF +:108970000CF00104234403EB5C0300EB020C521CDB +:108980008CF8113090F816C0D2B263448375052A72 +:10899000D3D3D8B2252888BFFFDF10BD0A4610B454 +:1089A0000021032A0DD04FF4FA4C002A60D0012A8E +:1089B0007ED0022A1CBF10BC7047014610BC30306C +:1089C000B4E7018680F8361080F8371080F83B1045 +:1089D00080F83C1080F83D1080F83E1080F832108E +:1089E00080F8331080F8341080F8351080F8491082 +:1089F000A0F84C10A0F8521080F85610A0F85810AB +:108A000080F85A1080F8471080F8481080F83F101E +:108A100080F8401080F85B1080F85C1080F85E10E1 +:108A2000012280F86420A0F8501080F86610A0F8A9 +:108A30009810A0F89A10A0F89C10A0F89E10A0F82A +:108A4000A010A0F8A21080F8A510A0F8AE1080F831 +:108A5000AC10A0F8C010A0F8C21080F82810018453 +:108A600080F8C81080F8CE1080F8D11010BC704784 +:108A7000A0F8AE1080F8A6104288C488A0F84C1068 +:108A8000B0F8501000F13003514391FBF2F1A0F81F +:108A90005010E100B1FBF2F1491C89B201FB02F474 +:108AA000A0F84E10B4F5C84FC4BF491ED98300E0EA +:108AB00004E0BCFBF2F1491C99847EE7A0F8AE10FB +:108AC00000F130024488B0F8EA30B0F8EE0091834B +:108AD000118CC0006143B0FBF3F091FBF3F1401C3B +:108AE000118480B200FB03F1D083B1F5C84FC4BF3D +:108AF000401ED083BCFBF3F0401C908410BC704738 +:108B00000A4610B40021032A0DD04FF4FA4C002A73 +:108B10004FD0012A6DD0022A1CBF10BC70470146FD +:108B200010BC303002E7018680F8361080F837102C +:108B300080F83B1080F83C1080F83D1080F83E1023 +:108B400080F8321080F8331080F8341080F8351037 +:108B500080F84910A0F84C10A0F8521080F8561078 +:108B6000A0F8581080F85A1080F8471080F8481084 +:108B700080F83F1080F8401080F85B1080F85C109F +:108B800080F85E10012280F86420A0F8501080F870 +:108B90006610A0F8A01080F8A21080F89810C0F815 +:108BA0009C1080F8281080F8B41080F8C41010BC15 +:108BB00070474288C488A0F84C10B0F8501000F1FB +:108BC0003003514391FBF2F1A0F85010E100B1FBEA +:108BD000F2F1491C89B201FB02F4A0F84E10B4F581 +:108BE000C84FC4BF491ED983BCFBF2F1491C99840C +:108BF00095E7D0F8BC4000F1300243886089E489F1 +:108C00009183118C594391FBF0F11184E100B1FB88 +:108C1000F0F1491C89B201FB00F3D183B3F5C84FD1 +:108C2000C4BF491ED183BCFBF0F0401C908410BC33 +:108C30007047837D0BB1252B01D912207047002A84 +:108C400004BF0020704770B490F817C00C7E894DA7 +:108C500004FB02C22C464FF0000CE2FB054C4FEA2D +:108C60001C1C6FF024040CFB0422D2B201EBD20CCA +:108C7000C27502F007059CF808C0012404FA05F546 +:108C80001CEA050F18BF02762CD1B2FBF3FC03FBE4 +:108C90001C22521CD2B24FF0000C00BF00EB0C03A0 +:108CA0005B7C93423CBFD21AD2B20ED301EB0C05CF +:108CB00000232D7A04FA03F635421CBF521ED2B2AD +:108CC0006AB15B1CDBB2082BF4D30CF1010303F097 +:108CD000FF0CBCF1050FE1D370BC1F20704703EB04 +:108CE000CC01017670BC0020704730B50D460446BB +:108CF000072988BFFFDFE07805F0070100F050008A +:108D0000084340F08800E070A07800F0A70040F031 +:108D10001800A070607800F05E0040F020006070E5 +:108D2000207800F0BC0040F04000207030BD017998 +:108D300031F01F0113BF002000221146704710B40C +:108D4000435C491C03F0010C5B0803F00104A444DC +:108D50005B0803F00104A4445B0803F00104A4448D +:108D60005B0803F00104A4445B0803F001045B0802 +:108D7000A44403F00104A4440CEB53031A44D2B2FC +:108D80000529DDDB012A8CBF0120002010BC7047C3 +:108D900038B505460C466846F9F787FB002808BF3A +:108DA00038BD9DF90020227294F909100020511A53 +:108DB00048BF494295F829308B42C8BF38BDFF2BC8 +:108DC00008BF38BDA17A491CC9B2A17295F82A30F2 +:108DD000994203D8617A7F2918BF38BD627200209A +:108DE000A072012038BD10B4A2F10B0C08293AD2B0 +:108DF000DFE801F004060B10131D333782B332E0B5 +:108E0000022A18BF032A31D02DE0072A18BF062AEC +:108E10002CD028E0082A29D025E01BB1BCF10B0F8B +:108E200024D920E0A2F10A000B281FD91BE01BB1B6 +:108E3000BCF10B0F1AD916E00D2A18BF0C2A15D059 +:108E400090F82C0020B10D2A0DD3152A0ED90AE076 +:108E5000112A08D3152A09D905E0092A06D002E00B +:108E600004E0012A02D010BC0020704710BC012091 +:108E70007047000053E4B36E282102F052B830B5B9 +:108E80000546007801F00F0220F00F001043287013 +:108E900007290BD2DFE801F00406040604080400E9 +:108EA000062405E00C2403E0222401E00024FFDF77 +:108EB000687820F03F002043687030BD007800F0F3 +:108EC0000F0070470A68C0F803208988A0F80710CF +:108ED0007047D0F803200A60B0F807008880704718 +:108EE0000A68C0F809208988A0F80D107047027838 +:108EF000402322F0400203EA8111114301707047C0 +:108F00000078C0F3801070470278802322F080023E +:108F100003EAC111114301707047D0F80320C1F872 +:108F20000920B0F80720A1F80D200A7822F080026D +:108F30000A700078800942EAC0100870704770B566 +:108F400015460E4604461F2A88BFFFDF2A463146D3 +:108F500004F1090001F06EFF6078A91D20F03F00C8 +:108F600001F03F010843607070BD70B50546407860 +:108F70000E4600F03F04062C38BFFFDFA01FC4B22E +:108F80001F2C88BF1F24224605F10901304601F03D +:108F900051FF204670BD70B515460E4604461F2A87 +:108FA00088BFFFDF2A46314604F1090001F042FF85 +:108FB0006078A91D20F03F0001F03F010843607078 +:108FC00070BD70B5054640780E4600F03F04062C93 +:108FD00038BFFFDFA01FC4B21F2C88BFFFDF2246AF +:108FE00005F10901304601F025FF204670BD0968F2 +:108FF000C0F80F1070470A88A0F8132089784175CF +:1090000070474176090A81767047C176090A01776F +:1090100070474177090A81777047C175090A01765F +:1090200070478175704790F8242001F01F0122F0ED +:109030001F02114380F82410704790F82420E02389 +:1090400022F0E00203EA4111114380F82410704736 +:109050001F3002F0AEB84178007801F03F0110F007 +:109060000F0006D0012808D0022809D006280BD00E +:109070000FE0881F1F280AD90BE00C2909D106E050 +:10908000881F1F2803D904E0881F1F2801D801204A +:109090007047002070474178007801F03F0100F0F0 +:1090A0000F00042805D1062903D325299CBF0120E0 +:1090B00070470020704710B4017801F00F010329B8 +:1090C00022D0052925D14478B0F81910B0F81BC07A +:1090D000B0F81730827D04F03F04222C19D1062904 +:1090E00017D3B1F5486F98BFBCF5FA7F11D282B1A2 +:1090F000082A98BF8A420CD28B429CBFB0F81D0050 +:10910000B0F5486F05D807E0407800F03F000C2824 +:1091100002D010BC0020704710BC012070472221F3 +:1091200001F0FFBE00B5027801F0030322F0030254 +:109130001A4302704278012922F01F02427014BFC4 +:10914000022900BD032912BFFFDF42F00101417077 +:1091500000BD01F0030300B5027822F003021A43B8 +:1091600002704278012922F01F02427014BF0229C6 +:1091700000BD032912BFFFDF42F00101417000BDB5 +:10918000007800F0030070470278102322F01002EC +:1091900003EA01111143017070474178C07801F072 +:1091A0001F010E2832D2DFE800F0070A0D10131657 +:1091B000191C1F2225282B2E0C2929D02AE008292A +:1091C00026D027E0022923D024E0172920D021E04F +:1091D0000D291DD01EE001291AD01BE0012917D04E +:1091E00018E0022914D015E0092911D012E009294C +:1091F0000ED00FE001290BD00CE0012908D009E0C6 +:10920000062905D006E0022902D003E01B2901D877 +:10921000012070470020704730B50546C1700E2907 +:1092200018D2DFE801F007090B0D0F11110B131312 +:109230001111150B0C240FE008240DE002240BE0A3 +:10924000172409E00D2407E0012405E0092403E0C8 +:10925000062401E00024FFDF687820F01F0020438F +:10926000687030BDC0787047C171090A01727047DB +:10927000B0F8070070474172090A81727047B0F870 +:1092800009007047C172090A01737047B0F80B00FA +:1092900070474171090A81717047B0F80500704745 +:1092A00001717047007970474173090A81737047F3 +:1092B000B0F80D00704730B4B0F80720504DB0F84A +:1092C00009C0B0F805300179941F2D1998BFBCF57D +:1092D000FA7F0ED269B1082998BF914209D2934210 +:1092E0009FBFB0F80B00B0F5486F012030BC98BFAD +:1092F0007047002030BC7047001D01F05ABF021DAE +:109300000846114601F055BF4172090A8172704743 +:10931000B0F80900704701717047007970470A681A +:10932000426049688160704742680A6080684860AE +:1093300070470988818170478089088070470A6872 +:10934000C0F80E204968C0F812107047D0F80E20FF +:109350000A60D0F81200486070470968C0F816101B +:109360007047D0F81600086070470A684260496884 +:109370008160704742680A60806848607047096889 +:10938000C1607047C06808607047017170474171E3 +:10939000090A81717047C171090A01727047007929 +:1093A0007047B0F805007047B0F8070070470171CA +:1093B000704700797047017170470A6842604968D8 +:1093C0008160704742680A608068486070470A6838 +:1093D000426049688160704742680A6080684860FE +:1093E000704730B50C4605461B2988BFFFDF6878FB +:1093F00004F01F0120F01F000843687030BD00001A +:1094000086F3FFFF70B50446C2F11005281901F07C +:1094100011FD15F0FF0108D0491EC9B2802060542B +:109420002046BDE8704001F07CBD70BD30B505E060 +:109430005B1EDBB2CC5CD55C6C40C454002BF7D116 +:1094400030BD10B5002409E00B78521E44EA4303F6 +:1094500000F8013B11F8013BD2B2DC09002AF3D13C +:1094600010BD30B50C46097889B01546012049B1C8 +:10947000012905D12978042902D105201070002086 +:1094800009B030BD60680590CDF818D00D210DF100 +:10949000030001F046FDA0680188ADF80010807857 +:1094A0008DF802000120207006208DF81000606AFF +:1094B0000890294604A8F5F745FEE1E72DE9F041BB +:1094C0000C46097892B0154601204FF0020CFE4F71 +:1094D00006264FF0040869B101291ED0022946D0A2 +:1094E000032904D12978042901D11670002012B073 +:1094F000BDE8F081606850B1CDE90107012020701E +:109500008DF80060606A04901146684665E084F852 +:1095100000C085F80080576027E029780429E6D14B +:10952000696810222069FFF78CFF6868C07B00061D +:1095300006D5E54A2069102310320146FFF776FF71 +:10954000D4E904101022FFF77CFF2069C07B0006DD +:1095500006D5DD4A6069102310320146FFF766FF29 +:1095600084F800C085F800806F600320BFE7297889 +:109570000429BCD1A08910280CD9A0F1100080B218 +:10958000A081A1684FF01003014468466A68FFF7A4 +:109590004DFF18E004D14FF010032269A16807E0E5 +:1095A000C2B20DA8A168FFF72DFF626910230DA9B3 +:1095B00009A8FFF73BFF102309A968466A68FFF76F +:1095C00035FF0320207060680590CDF818D08DF825 +:1095D0001060606A0890294604A8F5F7B3FD86E795 +:1095E0002DE9F04107460D4601200B7807213BB1DC +:1095F000012B04D11378062B01D11170002077E7DD +:109600006C69012620226170E8686060686A6062A7 +:10961000A168287C0870A681A068A968401C01F098 +:1096200009FCA08920222030A081A068696821302F +:1096300001F000FCA08921462030A0812E70384620 +:10964000BDE8F041F5F795BD2DE9F05F0D46834685 +:1096500001200978174606464FF00708D1B1DFF818 +:1096600068A24FF00009AAF1080A012923D00229B3 +:109670007ED003290CD13978062909D179681022C6 +:10968000E86901F0D7FB08203870183500207D60AC +:10969000BDE8F09F2C6A8C48202284F8018020309D +:1096A00060602020A081686A60626968A06801F03B +:1096B000C1FB2E70D4E039780629E9D12C6A84F8F0 +:1096C0000180686A606251681022E86901F0B2FBAB +:1096D000E8696060A0684F4680F80090A681A068A5 +:1096E0004670A089401C80B2A081A16808446969C5 +:1096F00051F8012F026089888180A089801D80B285 +:10970000A0816969A268097801F001011154A0895A +:10971000401C80B2A081A1680844296951F8012F3A +:10972000026089888180A089801D80B2A08129691A +:10973000A268097801F001011154A0891022401C8F +:1097400080B2A081A1680844E96801F073FBA08998 +:109750001022103080B2A081A1680844A96801F0ED +:1097600069FBA089103080B2A081A168014400E0AB +:109770000DE0DAF804000860A089001D80B2A08125 +:10978000A1680F54A089401CA081022067E03978AD +:10979000062992D151681022A86901F04BFB2C6A6E +:1097A00084F80180E8696060686A6062A16881F895 +:1097B0000090A681A0684670A089401C80B2A0815C +:1097C000A1680844696951F8012F02608988818085 +:1097D000A089801D80B2A0816969A268097801F022 +:1097E00001011154A089401C80B2A081A1680844E5 +:1097F000296951F8012F026089888180A089801D24 +:1098000080B2A0812969A268097801F00101115490 +:10981000A0891022401C80B2A081A1680844E96898 +:1098200001F008FBA0891022103080B2A081A1684D +:109830000844A96801F0FEFAA089103080B2A08126 +:10984000A1680144DAF804000860A089001D80B214 +:10985000A081A1680E54A089401CA081032028701B +:1098600021465846BDE8F05FF5F783BC70B50D465C +:1098700006460978012041B1012905D11178062950 +:1098800002D109201070002070BD2C6A0720607082 +:1098900068686060686A6062E969A06851F8012FD1 +:1098A0000260898881800620A081E869A16800782B +:1098B00000F001008871A089401C80B2A081A168DD +:1098C0000844A96902E000006AB5010051F8012FBF +:1098D000026089888180A089801D80B2A081A969E9 +:1098E000A268097801F001011154A089401C80B2DE +:1098F000A081A168084469690A880280897881701A +:10990000A0891022C01C80B2A081A16808442969E6 +:1099100001F090FAA0891022103080B2A081A168D5 +:109920000844E96801F086FAA0891022103080B25C +:10993000A081A1680844A96801F07CFAA0892146A9 +:109940001030A081012028703046BDE87040F5F746 +:1099500010BC70B50D4606460978012059B10129A1 +:1099600008D11178062905D10A20107050680068C6 +:109970005060002070BD6C69072010226070E8689C +:109980006060686A60622969A06801F053FA10207B +:10999000A081A06820221030A96801F04BFAA089AC +:1099A0002022203080B2A081A1680844696801F0BB +:1099B00041FAA08921462030A0810120287030463C +:1099C000BDE87040F5F7D5BB70B50C4601200978AD +:1099D0008EB01546062659B1012934D0022905D189 +:1099E0002978042902D10B20107000200EB070BD20 +:1099F000606910236A46007800F001008DF80000CD +:109A0000A069007800F001008DF80100E0680168AD +:109A1000CDF802108188ADF8061080798DF8080025 +:109A200020690168CDF809108188ADF80D108079A2 +:109A30008DF80F006068059009A80690A168FFF7EF +:109A4000F5FC01201DE029780429CFD1A06910235D +:109A50006A4650F8011F00918088ADF804006069E3 +:109A600050F8011FCDF806108088ADF80A000020DC +:109A700003906068059009A806906968FFF7D6FC16 +:109A8000022020708DF81060606A0890294604A8B2 +:109A9000F5F758FBAAE700B50B7889B001204BB168 +:109AA000012B05D11178042902D10C20107000205F +:109AB00009B000BD4868019005A80290C868036815 +:109AC000059340680690886803680793406808908B +:109AD0000120087006208DF80000486A04901146A5 +:109AE0006846F5F72FFBE3E700B50B7889B0012056 +:109AF00043B1012BDCD111780429D9D10D2010708C +:109B00000020D5E74868019005A80290886803689E +:109B10000593406806900020079008900120087087 +:109B200006208DF80000486A049011466846F5F753 +:109B300009FBBDE700B50B7889B0012043B1012BCB +:109B4000B6D111780429B3D10E2010700020AFE7F0 +:109B500048680590CDF818D088680088ADF80000F6 +:109B6000C8680088ADF802000020019002900390C0 +:109B70000120087006208DF81000486A08901146F0 +:109B800004A8F5F7DFFA93E730B403460C78012018 +:109B90005CB1012C15D0022C05D111780D2902D110 +:109BA0000F201070002030BC704701200870C8687A +:109BB000052242704A6842600B4A8260921EC2606F +:109BC0000BE014780E2CEED102200870C868042433 +:109BD0004470526842608A688260496A4162014604 +:109BE00030BC1846F5F7C5BA64B501002DE9F0415F +:109BF0000C4611490D68104A104908321160A0F155 +:109C00002001342901D301200CE0482810D040CC99 +:109C10000B4F94E80E0007EB8000241F50F8807C67 +:109C20003046B84720600448001D0560BDE8F0815B +:109C30002046E7F7C5FAF5E71005024001000001EC +:109C40009CB5010010B54C4800F042FA00B1FFDFAE +:109C50004948401C00F03CFA002800D0FFDF10BD4E +:109C60002DE9F05F454D8246D5F800900126424827 +:109C700000F036FA404C18B90026601C00F046FA95 +:109C80003F494FF0000E4FF0010B00BFC1F804B088 +:109C9000C1F800E1C1F804E1C5F800A0C1F800B0C6 +:109CA000384A4FF480434FF0E0274FF0030C1AE09E +:109CB0001068C00617D5C7F88032EFF3108010F097 +:109CC000010072B600D00120C1F804C3D1F80081B0 +:109CD000B8F1000F05D1D1F80481B8F1000F00D11F +:109CE00020BF00B962B6D1F8000118B9D1F804015B +:109CF0000028DDD0D1F804010028C7D12EB1C5F865 +:109D00000090601C00F0ECF907E0601C00F0E8F93E +:109D10000028B2D1184800F0F9F90020BDE8F09F02 +:109D20002DE9F0438DB00D46064600240DF11009D3 +:109D30000DF1200818E000BF04EB4407102255F88D +:109D40002710684601F076F805EB87071022484691 +:109D5000796801F06FF86846FFF782FF10224146EC +:109D6000B86801F067F8641CB442E5DB0DB0002070 +:109D7000BDE8F08374E700005401002004E50040D2 +:109D800000E0004010ED00E0C74800210170817044 +:109D9000704770B5C54D01232B60C54B1C68002C66 +:109DA000FCD0002407E00E6806601E68002EFCD080 +:109DB000001D091D641C9442F5D30020286018681A +:109DC0000028FCD070BD70B5B74E0446B94D307850 +:109DD000022800D0FFDFAC4200D3FFDF7169B64834 +:109DE000012903D847F23052944201DD0322427127 +:109DF000491C7161291BC160AF497078BDE8704092 +:109E0000F6F722B970B5A84C0D466178884200D0AB +:109E1000FFDFA84E092D4FD2DFE805F04E052231B5 +:109E20004E4E4E4E3C002078022800D0FFDF03202B +:109E30002070A078022802D0012804D008E0A06891 +:109E400000F0F4FB04E004F1080007C8FFF7A1FFED +:109E5000052020700020A070BDE87040F5F7D5BB4C +:109E6000F5F7A2FC01466068F6F7E6FEB04202D2C2 +:109E7000616902290BD30320F7F746F912E0F5F7E1 +:109E800093FC01466068F6F7D7FEB042F3D2BDE816 +:109E9000704098E7207802280AD0052806D0FFDF16 +:109EA00004202070BDE8704000F0F4B8022000E00B +:109EB0000320F7F729F9F3E7FFDF70BD70B505461A +:109EC000F5F772FC784C60602078012800D0FFDF45 +:109ED00079490220087000220A718D6004224A71BB +:109EE000744ACA6020706078BDE87040F6F7ACB87C +:109EF00010B56D4CA07808B9207808B1112010BDBC +:109F00006E48F5F7ECFB6070607820B1012020709E +:109F10000020606110BD032010BD0246010B01202E +:109F2000B2F5003F02D2884000F014BFB2F5802F96 +:109F300003D22039884000F015BFB2F5C02F03D2FC +:109F40004039884000F017BFB2F5002F03D26039C6 +:109F5000884000F019BF002070472DE9F0411446F9 +:109F600000EB84070E4605463F1F00F072FB4FF0E2 +:109F700080510A69504306EB8402121FB24201D29B +:109F8000012200E000221CB10969B4EB910F02D953 +:109F90000920BDE8F0814A498D4216D3AF4214D35F +:109FA000854205D2874203D245EA0600800701D0E8 +:109FB0001020EEE78E4208D33AB92846FFF7ADFFEE +:109FC00018B93846FFF7A9FF08B10F20E1E73D486F +:109FD0003D490068884205D0224631462846FFF7B1 +:109FE000D8FE10E0FFF784FF0028D2D12E480121CF +:109FF0008560C0E9036481704FF4A97104FB01F02E +:10A000001830FFF75BFF0020C3E770B54FF08055B5 +:10A01000044628692A49B1FBF0F084420AD300F0D3 +:10A0200018FBA04201D8102070BD28696043FFF7DB +:10A0300074FF08B10F2070BD224823490068884290 +:10A0400004D02869604300F0F1FA0CE0FFF750FFFC +:10A050000028F0D129691448614381600221817090 +:10A060001A48FFF72BFF002070BD1548010B012097 +:10A070008840401E704770B50D460446FFF7F5FF57 +:10A08000204201D00F2070BD29462046BDE8704017 +:10A0900000F083BE10B5044C6078F5F76FFB00202C +:10A0A0002070A07010BD00005801002004E50140A0 +:10A0B00000E40140105C0C0068110020059E0100C6 +:10A0C00000C0010098000020BEBAFECA7C5E0100FC +:10A0D0000021017008467047014600200870704753 +:10A0E000EFF3108101F0010172B60278012A01D06C +:10A0F000012200E000220123037001B962B60AB117 +:10A10000002070474FF400507047E9E7EFF31081EB +:10A1100011F0010F72B64FF00002027000D162B66A +:10A1200000207047F2E700004C49096801600020F8 +:10A1300070474A4908600020704701218A0720B112 +:10A14000012804D042F204007047916700E0D16713 +:10A150000020704742490120086042F20600704723 +:10A1600008B504233E4A1907103230B1C1F8043350 +:10A17000106840F0010010600BE0106820F0010052 +:10A180001060C1F808330020C1F8080135480068A4 +:10A190000090002008BD3249103140B101280AD09A +:10A1A00002280FD0032812D042F205007047086839 +:10A1B00020F01E0003E0086820F01E00801C0860EC +:10A1C00000207047086820F01E00001DF7E70868AF +:10A1D00020F01E00801DF2E7214924310A68024365 +:10A1E0000A60002070471E4924310A6882430A60D1 +:10A1F000002070471A492431096801600020704727 +:10A2000017491C310A6802430A600020704714494C +:10A210001C310A6882430A600020704710491C31D3 +:10A22000096801600020704702000F494FF00000EC +:10A2300003D0012A01D0072070470A6070474FF011 +:10A2400080410020C1F808014FF0E020802180F813 +:10A2500000140121C0F80011704700000004004004 +:10A260000005004008010040780500406249634B4A +:10A270000A6863499A42096801D1C1F3100101607B +:10A28000002070475C495D4B0A685D49091D9A4290 +:10A2900001D1C0F310000860002070475649574BA9 +:10A2A0000A68574908319A4201D1C0F3100008608A +:10A2B0000020704730B5504B504D1C6842F20803E7 +:10A2C000AC4202D0142802D203E0112801D3184670 +:10A2D00030BDC3004B481844C0F81015C0F8142511 +:10A2E000002030BD4449454B0A6842F209019A42B8 +:10A2F00002D0062802D203E0042801D308467047A2 +:10A30000404A012142F83010002070473A493B4B47 +:10A310000A6842F209019A4202D0062802D203E0FA +:10A32000042801D308467047364A012102EBC000D9 +:10A3300041600020704770B52F4A304E314C15688F +:10A3400042F2090304EB8002B54204D0062804D28D +:10A35000C2F8001807E0042801D3184670BDC1F305 +:10A360001000C2F80008002070BD70B5224A234ECC +:10A37000244C156842F2090304EB8002B54204D074 +:10A38000062804D2D2F8000807E0042801D31846B2 +:10A3900070BDD2F80008C0F310000860002070BD46 +:10A3A000174910B50831184808601120154A0021D6 +:10A3B00002EBC003C3F81015C3F81415401C142891 +:10A3C000F6D3002006E0042804D302EB8003C3F890 +:10A3D000001807E002EB8003D3F80048C4F3100430 +:10A3E000C3F80048401C0628EDD310BD04490648B8 +:10A3F000083108607047000098000020BEBAFECA0D +:10A4000000F5014000F001400000FEFF10B572B6FB +:10A4100000F0C2F850B1E6F773FFF5F7DEF8F6F793 +:10A4200019FEEFF72AF861490020086062B60020A3 +:10A4300010BD2DE9F0410F46044672B600F0ACF8AD +:10A4400018B162B60820BDE8F081E6F7CFFEE6F766 +:10A4500059FF064600256909890001F1E02105F050 +:10A460001F00D1F80011C140C80717D0202D03D21A +:10A4700026FA05F0C00716D168B2002806DA00F007 +:10A480000F0000F1E02090F8140D03E000F1E0204F +:10A4900090F80004400900F0E5F820B16D1C642D2F +:10A4A000D9D324B104E062B641F20100CBE7404CBD +:10A4B0002078022803D962B64FF48050C3E73D49A3 +:10A4C000802081F8140DEEF7AFFF20780028607827 +:10A4D00001D058B908E048B1202807D8A078212831 +:10A4E00004D8012802D003E0A07808B10720AAE729 +:10A4F0002E493148086031480760E6F703FF2146DE +:10A50000F6F78EFDF5F71DF800F0F4F9FFF73CFCC7 +:10A510002046E6F7C3FE040062B603D0FFF776FFDD +:10A52000204690E700208EE710B5044600F034F88E +:10A5300000B101202070002010BD214908600020DA +:10A54000704770B50C461F490D681E491E4E0831F4 +:10A550000E60102807D011280CD012280FD0132815 +:10A5600011D0012013E0D4E90001FFF762FF354666 +:10A5700020600DE0FFF74AFF0025206008E020681A +:10A58000FFF7D2FF03E00E4920680860002020603A +:10A590000C48001D056070BD0448074900688842EA +:10A5A00001D1012070470020704700009800002072 +:10A5B0006CB601000BE000E0BEBAFECA70010020DC +:10A5C000040000201005024001000001F0B585B034 +:10A5D0000F460646FEF7D4FD04467078694600F043 +:10A5E0001F053846F3F751F8C0B1012C07BF019998 +:10A5F000B1F80310032005B018BFF0BD091D89B2E2 +:10A600002844884238BF012008BF00209CBF05B005 +:10A61000F0BD00BF05B04FF00200F0BD022CF9D133 +:10A62000042D28BFB6F80310F4D3E7E70B4A022144 +:10A6300011600B490B68002BFCD0084B1B1D1860E8 +:10A6400008680028FCD00020106008680028FCD0B2 +:10A6500070474FF0805040697047000004E50140AA +:10A6600000E40140082808D238B1042805D00128A8 +:10A6700003D0052801D0012070470020704710B595 +:10A68000044600F0F5F880B1204600F0E2F8FFF74C +:10A69000E9FF68B17D4A04F01F010120137888406A +:10A6A0004BB15168084350600BE042F2010010BD0D +:10A6B00042F2020010BD6109890001F1E021C1F8F8 +:10A6C0000001002010BD10B5044600F0D1F850B1D3 +:10A6D0006E4A04F01F0101201378884033B151689D +:10A6E0008143516008E042F2010010BD6109890018 +:10A6F00001F1E021C1F88001002010BD70B50D46C8 +:10A70000044600F0B5F878B16009800000F1E0205F +:10A71000D0F8000204F01F0201219140084000D04F +:10A7200001202860002070BD42F2010070BD10B50C +:10A73000044600F09DF858B104F01F010120884044 +:10A740006109890001F1E021C1F80002002010BD7B +:10A7500042F2010010BD10B5044600F089F858B16E +:10A7600004F01F01012088406109890001F1E02106 +:10A77000C1F88002002010BD42F2010010BD70B58A +:10A780000D46044600F074F870B12846FFF76AFFE2 +:10A7900068B16807000E002C0CDA04F00F0101F11B +:10A7A000E02181F8140D09E042F2010070BD42F28F +:10A7B000020070BD04F1E02484F80004002070BDA4 +:10A7C00070B50C46054600F053F830B1284600F04D +:10A7D00040F8C0B22060002070BD42F2010070BDA0 +:10A7E000BFF34F8F2A4801682A4A01F4E061114300 +:10A7F0000160BFF34F8FFEE770B50546F7F700F92C +:10A8000008B1072070BD214C0120217889B9207042 +:10A8100072B6F6F72EFC4FF0E026D6F8801106F55A +:10A82000C07681436160F6F724FCC043306062B6B5 +:10A8300000202870002070BD14490A783AB130B960 +:10A840004FF0E0224868C2F80001002008700020A4 +:10A850007047002806DA00F00F0000F1E02090F8C1 +:10A86000140D03E000F1E02090F800044009704767 +:10A8700010B50446642807DAF6F7FBFB0121A14076 +:10A88000084201D1012010BD002010BD740100203C +:10A890000CED00E00400FA0510B54FF000040B4683 +:10A8A0000200204621461ED0012A04D0022A04D0EC +:10A8B000032A1DD103E0012002E0022013E003205F +:10A8C000072B15D2DFE803F0140406080A0C0E006B +:10A8D000012108E0022106E0032104E0042102E056 +:10A8E000052100E00621F4F713FF08B1204610BD52 +:10A8F0000724FBE7FE4805218170002101704170AB +:10A90000C17081607047FB490A78022A06D0CA6884 +:10A910001044C860C8683238F6F749B98A681044EC +:10A9200088608868F7E70378F349F44A13B1012B8C +:10A930000ED011E00379012B00D06BB943790BB134 +:10A94000012B09D18368643B8B4205D2C0680EE0BD +:10A950000379012B02D00BB10020704743790BB172 +:10A96000012BF9D1C368643B8B42F5D280689042D9 +:10A97000F2D8012070472DE9F04704460226F5F78A +:10A98000C6FD006800B1FFDFD94D01273CB120783A +:10A99000B0B1012805D0022810D0032813D02F71A0 +:10A9A0000CE06068C82807D3F6F771F920B1606839 +:10A9B000FFF7A9FF012603E0002601E000F0AFF950 +:10A9C0003046BDE8F08728780028F7D16068FFF7A7 +:10A9D000AAFF0028E3D06068DFF81883007810B37E +:10A9E000A878042800D0FFDF0020474688F8000040 +:10A9F00060680079C0B30020387160684079A0B306 +:10AA00000420787160688168E868F5F78FF9B860AC +:10AA10006068C0683230F8600320A870B549E878F3 +:10AA2000F5F712FBCAE74FF00209404688F800909C +:10AA300061680979D1B10021017161684979B9B1C1 +:10AA40000421417161688968323181606168C96837 +:10AA5000C160C068A64C14346060F4F7A5FE2060A5 +:10AA60006F7085F80290A9E704E005E00321E3E7B1 +:10AA70000321E6E70120BFE70320C2E72DE9F04705 +:10AA80009B4C8846E178884200D0FFDFDFF8609277 +:10AA900000250127974E09F11409B8F1090F76D264 +:10AAA000DFE808F0050D2A3D646A769E7E00A078F6 +:10AAB000032886D0A078022883D0FFDF81E7A07822 +:10AAC000032803D0A078022800D0FFDF0420A07064 +:10AAD0002571207800285FD1FFF715FF3078022814 +:10AAE00006D0B068E06000F06CF92061002048E01A +:10AAF000E078F5F739F9F5E7A078032803D0A078D6 +:10AB0000022800D0FFDF207878BBA078032812D17C +:10AB1000042026E00420F6F7F7FAA57051E7A078A4 +:10AB2000032803D0A078022800D0FFDF2078E0B906 +:10AB3000A078032814D0F4F737FE01464F46D9F821 +:10AB40000000F6F779F80028E4DB79688142E1DB60 +:10AB5000081AF0606749E078BDE8F047F5F774BA85 +:10AB60000520F6F7D1FAA7702BE724E0A078042897 +:10AB700000D0FFDF022004E0A078042800D0FFDF2F +:10AB80000120A1688847FFF7F6FE05462EE027E082 +:10AB9000A078042800D0FFDFBDE8F04700F0BFB880 +:10ABA000A078042805D0607810B1A078022800D0E1 +:10ABB000FFDF207818B1BDE8F04700F0B9B8207980 +:10ABC00020B10620F6F7A0FA2571CCE7607828B10D +:10ABD0004849E078F5F738FA6570F2E60720C0E7F3 +:10ABE000FFDFEEE63DB1012D03D0FFDF022DF9D1ED +:10ABF000E7E60420C5E70320C3E770B5050005D0EC +:10AC00003B4CA078052803D0112070BD102070BDEA +:10AC10003B48F4F764FDE070E07818B1A5600020CF +:10AC2000A07070BD032070BD314810B5017809B126 +:10AC3000112010BD817805290CD0817801290BD015 +:10AC4000817849B1012101708178012904D080788F +:10AC500010B103E00F2010BD00F06AF8002010BD15 +:10AC60002DE9F041224E0446B07808B101280AD1FE +:10AC700064B12046FFF757FE50B120781D4D48B112 +:10AC8000B078012822D00F20BDE8F0811020FBE72A +:10AC90000720F9E702272F70207998B1002028714A +:10ACA000607988B104206871A0683230A860E068DB +:10ACB000E860E8680E4C14346060F4F775FD2060BD +:10ACC000B77022E00320EAE70320ECE700202870B9 +:10ACD000207900B3002028716079F0B104206871F8 +:10ACE000A168F068F5F722F8A860E068323009E062 +:10ACF0007C010020781100203D860100FF1FA10784 +:10AD00007DAA0100E8600320B0701049F078F5F7E3 +:10AD10009BF90020B8E70320DDE70320DFE70C48BC +:10AD200010B5006900F045F8BDE81040F4F76DBCBF +:10AD300010B5074CE078F4F721FD0820F6F7E4F9A8 +:10AD40000520A07000202070607010BD78110020D8 +:10AD50007C0100201F490968014201D00120704791 +:10AD6000002070471B49091D0968014201D00120DC +:10AD7000704700207047174910310968014201D01F +:10AD800001207047002070471249143109680142C0 +:10AD900001D0012070470020704710B50D4C206095 +:10ADA000201D01600B4810300260001D0360002070 +:10ADB00010BD09490A6848F202139A4302430A6027 +:10ADC0007047054A116848F2021301EA03009943EB +:10ADD0001160704700060040C806024040EA0103C7 +:10ADE00010B59B070FD1042A0DD310C808C9121F34 +:10ADF0009C42F8D020BA19BA884201D9012010BD6E +:10AE00004FF0FF3010BD1AB1D30703D0521C07E03A +:10AE1000002010BD10F8013B11F8014B1B1B07D19E +:10AE200010F8013B11F8014B1B1B01D1921EF1D10F +:10AE3000184610BD032A40F2308010F0030C00F0D9 +:10AE4000158011F8013BBCF1020F624498BF11F864 +:10AE500001CB00F8013B38BF11F8013BA2F104021D +:10AE600098BF00F801CB38BF00F8013B11F0030395 +:10AE700000F02580083AC0F0088051F8043B083AF9 +:10AE800051F804CBA0E80810F5E7121D5CBF51F89B +:10AE9000043B40F8043BAFF30080D20724BF11F815 +:10AEA000013B11F801CB48BF11F8012B24BF00F87A +:10AEB000013B00F801CB48BF00F8012B704710B5EB +:10AEC000203AC0F00B80B1E81850203AA0E81850A2 +:10AED000B1E81850A0E81850BFF4F5AF5FEA027C63 +:10AEE00024BFB1E81850A0E8185044BF18C918C0D2 +:10AEF000BDE810405FEA827C24BF51F8043B40F873 +:10AF0000043B08BF7047D20728BF31F8023B48BF57 +:10AF100011F8012B28BF20F8023B48BF00F8012B95 +:10AF200070474FF000020429C0F0128010F0030CAB +:10AF300000F01B80CCF1040CBCF1020F18BF00F82C +:10AF4000012BA8BF20F8022BA1EB0C0100F00DB8DB +:10AF50005FEAC17C24BF00F8012B00F8012B48BF39 +:10AF600000F8012B70474FF0000200B513469446DD +:10AF70009646203922BFA0E80C50A0E80C50B1F151 +:10AF80002001BFF4F7AF090728BFA0E80C5048BF65 +:10AF90000CC05DF804EB890028BF40F8042B08BF03 +:10AFA000704748BF20F8022B11F0804F18BF00F8FF +:10AFB000012B70477047704770477047164B1860F9 +:10AFC000164B1960164B1A607047FEDF042071465D +:10AFD00008421BD10699134A914217DC069902399F +:10AFE0004878DF2812D10878FE2808D0FF280DD134 +:10AFF0004FF001004FF000020B4B1B68184741F265 +:10B0000001000099019A084B1B681847069805999A +:10B01000064B1B68DB6818479C010020A00100203C +:10B02000A401002000C001007001002004000020E5 +:10B03000204821497047FFF7FBFFE6F7AFF800BD56 +:10B0400001200007C06AC0B2FF2806D14FF0FF30D0 +:10B050004FF010210968884203D018484FF00801CA +:10B0600001604FF4805016490968884203D1154A9F +:10B0700013605B68184700BD20BFFDE74FF48050A8 +:10B080000F490968884210D10F4B18684FF0FF3103 +:10B090008842F1D080F308884FF02021884204DDF7 +:10B0A0000A48026802210A430260094880470948A9 +:10B0B0008047FFDF88110020881100202C05004008 +:10B0C000000000200400002000C001002405004012 +:10B0D0008D1A010041B0010004207146084202D0DF +:10B0E000EFF3098101E0EFF3088188690238007805 +:10B0F000102813DB20280FDB2B280BDB0A4A1268F1 +:10B100000A4B9A4203D1602804DB094A1047022007 +:10B1100008607047074A1047074A1047074A1268F5 +:10B120002C3212681047000098000020BEBAFECAF8 +:10B1300009130000ED9B010043A50100040000205D +:10B140000E4B0F4908470F4B0D4908470E4B0C4952 +:10B1500008470E4B0A4908470D4B094908470D4B54 +:10B16000074908470C4B064908470C4B0449084758 +:10B170000B4B034908470B4B01490847A3910000BB +:10B180006D960000A52F0000C98D00004D8D0000B8 +:10B190007F930000251300004F740000C38E000051 +:10B1A000F5950000A91100000021016041600172C5 +:10B1B00070470A6802600B7903717047AB7B00002F +:10B1C0004B7D00007F7B0000457E0000697E000013 +:10B1D000A37E0000D77E0000117F0000417F0000A9 +:10B1E000937F000091120000911200009112000064 +:10B1F000911200009112000091120000F122000053 +:10B2000093230000B3230000BD240000FB1E0000B8 +:10B2100005270000E527000005280000C72D0000D5 +:10B22000EB2D00001B2D00006F2D00001D2E0000D7 +:10B23000A72E0000B3410000774300001F47000025 +:10B2400039480000BD48000063490000D3490000B0 +:10B25000ED4A0000BB4B0000374C00001F280000E7 +:10B26000252800002F280000BD1E0000FB2800003C +:10B270008F1E0000552A0000911200001555000095 +:10B280009B550000B7550000D355000047570000FC +:10B29000FD55000007560000495600006B5600009F +:10B2A0002D57000091120000911200009112000031 +:10B2B0009112000091120000911200001F6D000019 +:10B2C0003F6D0000416D00007B6D0000A96D000026 +:10B2D000936E00003D6F0000516F00009D6F0000F5 +:10B2E000957000003B7200006B730000195F000056 +:10B2F00091120000911200009112000023890000B9 +:10B300006189000083890000100110013A020000E9 +:10B310001A02000069740000F9760000FFFFFFFFC9 +:10B320000000FFFF2F850000CF1B000041520000EE +:10B33000635F0000977600000000000023002300F8 +:10B3400046004D0023002300F5000000000000002F +:10B35000000000001DBB0000000000000000000015 +:10B3600000000000A5C80000000000000000000070 +:10B37000000000007DBB000003BC000000000000D6 +:10B380000000000003BF0000ABBC0000E3C10000F0 +:10B39000000000000000000025CD000000000000BB +:10B3A0000000000000000000B7BF00007BC90000E3 +:10B3B000000000004FCA0000C3CA000000000000E7 +:10B3C0007DC2000059C300000000000089CA0000CF +:10B3D000B9C3000045C60000A9C600009FC7000011 +:10B3E00085C1000039C80000000000009DC00000B9 +:10B3F0000000000095BD00000FBD0000E5C8000082 +:10B4000001CC00006FCC00000000000075BF000000 +:10B410003BBD00002DBF000063CE0000CBBE00008E +:10B4200073CD000000000000D1CC000079BC00000A +:10B43000AFBB0000E9BD0000E7BC0000E3CD0000A9 +:10B4400001CF000005C00000C1CE00008B38000015 +:10B450008B380000CD22000099840000D9610000E3 +:10B46000115200000000000029710100D1380000D5 +:10B47000D1380000EF220000ED840000536200008C +:10B480001B520000356901004F710100BC01BC0175 +:10B490003E002C0044000E00D800200101000000F6 +:10B4A000010000000001020304001011121300004B +:10B4B0000014000063940100C9990100979A0100EB +:10B4C000E99A0100359B0100899B0100BD940100B0 +:10B4D000E1950100499601006D9801005399010022 +:10B4E00013DE000017EF00001B5C01006D4E010031 +:10B4F0003F5C01006F4E0100453101004F840100A7 +:10B500007D4101004F840100B1310100BF85010080 +:10B510003B3B0100BF850100BD3001004D850100AE +:10B52000AF4001004D850100555555D6BE898E00AE +:10B5300000006606F30C801300000A033B066C094A +:10B5400000005604D308500D555555252627D6BE64 +:10B55000898EF401FA00960064004B0032001E0050 +:10B56000140000000300656C74620000000000001D +:10B570000000000000000000000087000000000044 +:10B5800000000000000000000000BE83605ADB0BDA +:10B59000376038A5F5AA9183886C00006DA2010080 +:10B5A00085A201009DA20100B5A20100E5A2010053 +:10B5B0000DA3010037A301006BA301000BA0010044 +:10B5C0005B9F010077A00100D1A00100E1A0010074 +:10B5D0000DA101007FA60100C7A60100FDA6010084 +:10B5E0002FA7010057A701007FA70100C1A70100F5 +:10B5F000E1A70100F9A7010039A80100BF1201006D +:10B60000C7120100D51201003BA1010055A10100A4 +:10B6100029A1010033A1010061A1010097A101004E +:10B62000D9A10100E7A10100F5A1010001A20100DB +:10B630000FA201001DA2010029A2010000000000CC +:10B64000678F0000BD8F0000D38F000099A8010014 +:10B65000619C0100219D0100FBAB010029AC0100B0 +:10B6600061AC0100B51001008D1501000010020051 +:10B6700090B6010008000020A00100004411000065 +:10B68000B4B60100A8010020E00F00008011000006 +:10B6900001593601000100683720FB349B5F8004AC +:10B6A0001F800010022001337F0102E429E4BDAFB6 +:04B6B0000100000095 +:00000001FF diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/common_rtc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/common_rtc.h new file mode 100644 index 0000000000..f15ff83a58 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/common_rtc.h @@ -0,0 +1,57 @@ +/* mbed Microcontroller Library + * Copyright (c) 2015 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef COMMON_RTC_H +#define COMMON_RTC_H + +#include "nrf_rtc.h" + +#define RTC_COUNTER_BITS 24u + +// Instance 0 is reserved for SoftDevice. +// Instance 1 is used as a common one for us_ticker, lp_ticker and (in case +// of NRF51) as an alternative tick source for RTOS. +// ["us_ticker.c" uses hard coded addresses of the 'NRF_RTC1->EVENT_COMPARE[1]' +// register in inline assembly implementations of COMMON_RTC_IRQ_HANDLER, +// please remember to update those in case of doing changes here] +#define COMMON_RTC_INSTANCE NRF_RTC1 +#define COMMON_RTC_IRQ_HANDLER RTC1_IRQHandler +#define US_TICKER_CC_CHANNEL 0 +#define OS_TICK_CC_CHANNEL 1 +#define LP_TICKER_CC_CHANNEL 2 + +#define COMMON_RTC_EVENT_COMPARE(channel) \ + CONCAT_2(NRF_RTC_EVENT_COMPARE_, channel) +#define COMMON_RTC_INT_COMPARE_MASK(channel) \ + CONCAT_3(NRF_RTC_INT_COMPARE, channel, _MASK) + +#define US_TICKER_EVENT COMMON_RTC_EVENT_COMPARE(US_TICKER_CC_CHANNEL) +#define US_TICKER_INT_MASK COMMON_RTC_INT_COMPARE_MASK(US_TICKER_CC_CHANNEL) +#define OS_TICK_EVENT COMMON_RTC_EVENT_COMPARE(OS_TICK_CC_CHANNEL) +#define OS_TICK_INT_MASK COMMON_RTC_INT_COMPARE_MASK(OS_TICK_CC_CHANNEL) +#define LP_TICKER_EVENT COMMON_RTC_EVENT_COMPARE(LP_TICKER_CC_CHANNEL) +#define LP_TICKER_INT_MASK COMMON_RTC_INT_COMPARE_MASK(LP_TICKER_CC_CHANNEL) + +extern bool m_common_rtc_enabled; +extern uint32_t volatile m_common_rtc_overflows; + +void common_rtc_init(void); +uint32_t common_rtc_32bit_ticks_get(void); +uint64_t common_rtc_64bit_us_get(void); +void common_rtc_set_interrupt(uint32_t us_timestamp, uint32_t cc_channel, + uint32_t int_mask); + +#endif // COMMON_RTC_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c new file mode 100644 index 0000000000..a5c6c850c2 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c @@ -0,0 +1,249 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mbed_assert.h" +#include "gpio_api.h" +#include "gpio_irq_api.h" +#include "pinmap.h" +#include "nrf_drv_gpiote.h" + + +#if defined(TARGET_MCU_NRF51822) + #define GPIO_PIN_COUNT 31 +#else + #define GPIO_PIN_COUNT 32 +#endif + +typedef struct { + bool used_as_gpio : 1; + PinDirection direction : 1; + bool init_high : 1; + PinMode pull : 2; + bool used_as_irq : 1; + bool irq_fall : 1; + bool irq_rise : 1; +} gpio_cfg_t; + +uint32_t m_gpio_initialized; +gpio_cfg_t m_gpio_cfg[GPIO_PIN_COUNT]; + + +/*********** + GPIO IRQ +***********/ + +static gpio_irq_handler m_irq_handler; +static uint32_t m_channel_ids[GPIO_PIN_COUNT] = {0}; +uint32_t m_gpio_irq_enabled; + + +static void gpiote_irq_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) +{ + nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(pin); + gpio_irq_event event = (sense == NRF_GPIO_PIN_SENSE_LOW) ? IRQ_RISE : IRQ_FALL; + + if (m_gpio_irq_enabled & (1UL << pin)) { + if (((event == IRQ_RISE) && m_gpio_cfg[pin].irq_rise) + || ((event == IRQ_FALL) && m_gpio_cfg[pin].irq_fall)) { + m_irq_handler(m_channel_ids[pin], event); + } + } +} + +void GPIOTE_IRQHandler(void);// exported from nrf_drv_gpiote.c + +void gpio_init(gpio_t *obj, PinName pin) +{ + obj->pin = pin; + if (pin == (PinName)NC) { + return; + } + MBED_ASSERT((uint32_t)pin < GPIO_PIN_COUNT); + + NVIC_SetVector(GPIOTE_IRQn, (uint32_t) GPIOTE_IRQHandler); + + (void) nrf_drv_gpiote_init(); + + m_gpio_cfg[obj->pin].used_as_gpio = true; +} + + +int gpio_read(gpio_t *obj) +{ + MBED_ASSERT(obj->pin != (PinName)NC); + if (m_gpio_cfg[obj->pin].direction == PIN_OUTPUT) { + return ((NRF_GPIO->OUTSET & (1UL << obj->pin)) ? 1 : 0); + } else { + return nrf_gpio_pin_read(obj->pin); + } +} + +static void gpiote_pin_uninit(uint8_t pin) +{ + if (m_gpio_initialized & (1UL << pin)) { + if ((m_gpio_cfg[pin].direction == PIN_OUTPUT) && (!m_gpio_cfg[pin].used_as_irq)) { + nrf_drv_gpiote_out_uninit(pin); + } + else { + nrf_drv_gpiote_in_uninit(pin); + } + } +} + +static void gpio_apply_config(uint8_t pin) +{ + if (m_gpio_cfg[pin].used_as_gpio || m_gpio_cfg[pin].used_as_irq) { + if ((m_gpio_cfg[pin].direction == PIN_INPUT) + || (m_gpio_cfg[pin].used_as_irq)) { + //Configure as input. + nrf_drv_gpiote_in_config_t cfg; + + cfg.hi_accuracy = false; + cfg.is_watcher = false; + cfg.sense = NRF_GPIOTE_POLARITY_TOGGLE; + if (m_gpio_cfg[pin].used_as_irq) { + cfg.pull = NRF_GPIO_PIN_PULLUP; + nrf_drv_gpiote_in_init(pin, &cfg, gpiote_irq_handler); + if ((m_gpio_irq_enabled & (1 << pin)) + && (m_gpio_cfg[pin].irq_rise || m_gpio_cfg[pin].irq_fall)) + { + nrf_drv_gpiote_in_event_enable(pin, true); + } + } + else { + switch(m_gpio_cfg[pin].pull) { + case PullUp: + cfg.pull = NRF_GPIO_PIN_PULLUP; + break; + case PullDown: + cfg.pull = NRF_GPIO_PIN_PULLDOWN; + break; + default: + cfg.pull = NRF_GPIO_PIN_NOPULL; + break; + } + nrf_drv_gpiote_in_init(pin, &cfg, NULL); + } + } + else { + // Configure as output. + nrf_drv_gpiote_out_config_t cfg = GPIOTE_CONFIG_OUT_SIMPLE(m_gpio_cfg[pin].init_high); + nrf_drv_gpiote_out_init(pin, &cfg); + } + m_gpio_initialized |= (1UL << pin); + } + else { + m_gpio_initialized &= ~(1UL << pin); + } +} + + +void gpio_mode(gpio_t *obj, PinMode mode) +{ + MBED_ASSERT(obj->pin <= GPIO_PIN_COUNT); + + gpiote_pin_uninit(obj->pin); // try to uninitialize gpio before a change. + + m_gpio_cfg[obj->pin].pull = mode; + gpio_apply_config(obj->pin); +} + + +void gpio_dir(gpio_t *obj, PinDirection direction) +{ + MBED_ASSERT(obj->pin <= GPIO_PIN_COUNT); + + gpiote_pin_uninit(obj->pin); // try to uninitialize gpio before a change. + + m_gpio_cfg[obj->pin].direction = direction; + gpio_apply_config(obj->pin); +} + + +/*********** + GPIO IRQ +***********/ + +int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) +{ + if (pin == NC) { + return -1; + } + MBED_ASSERT((uint32_t)pin < GPIO_PIN_COUNT); + (void) nrf_drv_gpiote_init(); + + gpiote_pin_uninit(pin); // try to uninitialize gpio before a change. + + m_gpio_cfg[pin].used_as_irq = true; + m_channel_ids[pin] = id; + obj->ch = pin; + m_irq_handler = handler; + m_channel_ids[pin] = id; + + gpio_apply_config(pin); + return 1; +} + + +void gpio_irq_free(gpio_irq_t *obj) +{ + nrf_drv_gpiote_in_uninit(obj->ch); + m_gpio_cfg[obj->ch].used_as_irq = false; + m_channel_ids[obj->ch] = 0; + + gpio_apply_config(obj->ch); +} + + +void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) +{ + gpio_cfg_t* cfg = &m_gpio_cfg[obj->ch]; + bool irq_enabled_before = + (m_gpio_irq_enabled & (1 << obj->ch)) && + (cfg->irq_rise || cfg->irq_fall); + + if (event == IRQ_RISE) { + cfg->irq_rise = enable ? true : false; + } + else if (event == IRQ_FALL) { + cfg->irq_fall = enable ? true : false; + } + + bool irq_enabled_after = cfg->irq_rise || cfg->irq_fall; + + if (irq_enabled_before != irq_enabled_after) { + if (irq_enabled_after) { + gpio_irq_enable(obj); + } else { + gpio_irq_disable(obj); + } + } +} + + +void gpio_irq_enable(gpio_irq_t *obj) +{ + m_gpio_irq_enabled |= (1 << obj->ch); + if (m_gpio_cfg[obj->ch].irq_rise || m_gpio_cfg[obj->ch].irq_fall) { + nrf_drv_gpiote_in_event_enable(obj->ch, true); + } +} + + +void gpio_irq_disable(gpio_irq_t *obj) +{ + m_gpio_irq_enabled &= ~(1 << obj->ch); + nrf_drv_gpiote_in_event_disable(obj->ch); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_object.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_object.h new file mode 100644 index 0000000000..f7b621a9ed --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_object.h @@ -0,0 +1,48 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MBED_GPIO_OBJECT_H +#define MBED_GPIO_OBJECT_H + +#include "mbed_assert.h" + +#include "nrf_gpio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PinName pin; +} gpio_t; + +static inline void gpio_write(gpio_t *obj, int value) { + MBED_ASSERT(obj->pin != (PinName)NC); + if (value) { + nrf_gpio_pin_set(obj->pin); + } else { + nrf_gpio_pin_clear(obj->pin); + } +} + +static inline int gpio_is_connected(const gpio_t *obj) { + return obj->pin != (PinName)NC; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c new file mode 100644 index 0000000000..548aeebe9d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c @@ -0,0 +1,329 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "i2c_api.h" + +#if DEVICE_I2C + +#include "mbed_assert.h" +#include "mbed_error.h" +#include "nrf_drv_twi.h" +#include "app_util_platform.h" + +#if DEVICE_I2C_ASYNCH + #define TWI_IDX(obj) ((obj)->i2c.twi_idx) +#else + #define TWI_IDX(obj) ((obj)->twi_idx) +#endif +#define TWI_INFO(obj) (&m_twi_info[TWI_IDX(obj)]) + +typedef struct { + bool initialized; + nrf_drv_twi_config_t config; + volatile bool transfer_finished; + + #if DEVICE_I2C_ASYNCH + volatile uint32_t events; + void (*handler)(void); + uint32_t event_mask; + #endif +} twi_info_t; +static twi_info_t m_twi_info[TWI_COUNT]; + +static nrf_drv_twi_t const m_twi_instances[TWI_COUNT] = { +#if TWI0_ENABLED + NRF_DRV_TWI_INSTANCE(0), +#endif +#if TWI1_ENABLED + NRF_DRV_TWI_INSTANCE(1), +#endif +}; + +static void twi_event_handler(nrf_drv_twi_evt_t const *event, void *context) +{ + twi_info_t * twi_info = TWI_INFO((i2c_t *)context); + twi_info->transfer_finished = true; + +#if DEVICE_I2C_ASYNCH + switch (event->type) { + case NRF_DRV_TWI_EVT_DONE: + twi_info->events |= I2C_EVENT_TRANSFER_COMPLETE; + break; + + case NRF_DRV_TWI_EVT_ADDRESS_NACK: + twi_info->events |= I2C_EVENT_ERROR_NO_SLAVE; + break; + + case NRF_DRV_TWI_EVT_DATA_NACK: + twi_info->events |= I2C_EVENT_ERROR; + break; + } + + if (twi_info->handler) { + twi_info->handler(); + } +#endif // DEVICE_I2C_ASYNCH +} + +static uint8_t twi_address(int i2c_address) +{ + // The TWI driver requires 7-bit slave address (without R/W bit). + return (i2c_address >> 1); +} + +void SPI0_TWI0_IRQHandler(void); +void SPI1_TWI1_IRQHandler(void); + +static const peripheral_handler_desc_t twi_handlers[TWI_COUNT] = +{ + #if TWI0_ENABLED + { + SPI0_TWI0_IRQn, + (uint32_t) SPI0_TWI0_IRQHandler + }, + #endif + #if TWI1_ENABLED + { + SPI1_TWI1_IRQn, + (uint32_t) SPI1_TWI1_IRQHandler + } + #endif +}; + +void i2c_init(i2c_t *obj, PinName sda, PinName scl) +{ + int i; + for (i = 0; i < TWI_COUNT; ++i) { + if (m_twi_info[i].initialized && + m_twi_info[i].config.sda == (uint32_t)sda && + m_twi_info[i].config.scl == (uint32_t)scl) { + TWI_IDX(obj) = i; + TWI_INFO(obj)->config.frequency = NRF_TWI_FREQ_100K; + i2c_reset(obj); + return; + } + } + + nrf_drv_twi_config_t const config = { + .scl = scl, + .sda = sda, + .frequency = NRF_TWI_FREQ_100K, +#ifdef NRF51 + .interrupt_priority = APP_IRQ_PRIORITY_LOW +#elif defined(NRF52) + .interrupt_priority = APP_IRQ_PRIORITY_LOWEST +#endif + + }; + + for (i = 0; i < TWI_COUNT; ++i) { + if (!m_twi_info[i].initialized) { + + NVIC_SetVector(twi_handlers[i].IRQn, twi_handlers[i].vector); + + nrf_drv_twi_t const *twi = &m_twi_instances[i]; + ret_code_t ret_code = + nrf_drv_twi_init(twi, &config, twi_event_handler, obj); + if (ret_code == NRF_SUCCESS) { + TWI_IDX(obj) = i; + TWI_INFO(obj)->initialized = true; + TWI_INFO(obj)->config = config; + + nrf_drv_twi_enable(twi); + return; + } + } + } + + // No available peripheral + error("No available I2C peripheral\r\n"); +} + +void i2c_reset(i2c_t *obj) +{ + twi_info_t *twi_info = TWI_INFO(obj); + nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + + nrf_drv_twi_uninit(twi); + nrf_drv_twi_init(twi, &twi_info->config, twi_event_handler, obj); + nrf_drv_twi_enable(twi); +} + +int i2c_start(i2c_t *obj) +{ + (void)obj; + + return -1; // Not implemented. +} + +int i2c_stop(i2c_t *obj) +{ + (void)obj; + + return -1; // Not implemented. +} + +void i2c_frequency(i2c_t *obj, int hz) +{ + twi_info_t *twi_info = TWI_INFO(obj); + nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + + if (hz < 250000) { + twi_info->config.frequency = NRF_TWI_FREQ_100K; + } else if (hz < 400000) { + twi_info->config.frequency = NRF_TWI_FREQ_250K; + } else { + twi_info->config.frequency = NRF_TWI_FREQ_400K; + } + nrf_twi_frequency_set(twi->reg.p_twi, twi_info->config.frequency); +} + +int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) +{ + (void)stop; + + twi_info_t *twi_info = TWI_INFO(obj); + nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + + twi_info->transfer_finished = false; + ret_code_t ret_code = nrf_drv_twi_rx(twi, twi_address(address), + (uint8_t *)data, length); + if (ret_code != NRF_SUCCESS) { + return 0; + } + while (!twi_info->transfer_finished) {} + return nrf_drv_twi_data_count_get(twi); +} + +int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) +{ + twi_info_t *twi_info = TWI_INFO(obj); + nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + + twi_info->transfer_finished = false; + ret_code_t ret_code = nrf_drv_twi_tx(twi, twi_address(address), + (uint8_t const *)data, length, (stop == 0)); + if (ret_code != NRF_SUCCESS) { + return 0; + } + while (!twi_info->transfer_finished) {} + return nrf_drv_twi_data_count_get(twi); +} + +int i2c_byte_read(i2c_t *obj, int last) +{ + (void)obj; + (void)last; + + return -1; // Not implemented. +} + +int i2c_byte_write(i2c_t *obj, int data) +{ + (void)obj; + (void)data; + + return -1; // Not implemented. +} + + +#if DEVICE_I2C_ASYNCH + +void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, + void *rx, size_t rx_length, uint32_t address, + uint32_t stop, uint32_t handler, + uint32_t event, DMAUsage hint) +{ + (void)stop; + (void)hint; + + if (i2c_active(obj)) { + return; + } + if ((tx_length == 0) && (rx_length == 0)) { + return; + } + + twi_info_t *twi_info = TWI_INFO(obj); + twi_info->events = 0; + twi_info->handler = (void (*)(void))handler; + twi_info->event_mask = event; + + uint8_t twi_addr = twi_address(address); + nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + + if ((tx_length > 0) && (rx_length == 0)) { + nrf_drv_twi_xfer_desc_t const xfer = + NRF_DRV_TWI_XFER_DESC_TX(twi_addr, (uint8_t *)tx, tx_length); + nrf_drv_twi_xfer(twi, &xfer, + stop ? 0 : NRF_DRV_TWI_FLAG_TX_NO_STOP); + } + else if ((tx_length == 0) && (rx_length > 0)) { + nrf_drv_twi_xfer_desc_t const xfer = + NRF_DRV_TWI_XFER_DESC_RX(twi_addr, rx, rx_length); + nrf_drv_twi_xfer(twi, &xfer, 0); + } + else if ((tx_length > 0) && (rx_length > 0)) { + nrf_drv_twi_xfer_desc_t const xfer = + NRF_DRV_TWI_XFER_DESC_TXRX(twi_addr, + (uint8_t *)tx, tx_length, rx, rx_length); + nrf_drv_twi_xfer(twi, &xfer, 0); + } +} + +uint32_t i2c_irq_handler_asynch(i2c_t *obj) +{ + twi_info_t *twi_info = TWI_INFO(obj); + return (twi_info->events & twi_info->event_mask); +} + +uint8_t i2c_active(i2c_t *obj) +{ + nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + return nrf_drv_twi_is_busy(twi); +} + +void i2c_abort_asynch(i2c_t *obj) +{ + i2c_reset(obj); +} + +#endif // DEVICE_I2C_ASYNCH + +#endif // DEVICE_I2C diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/irq_handlers_hw.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/irq_handlers_hw.h new file mode 100644 index 0000000000..7eba37ad99 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/irq_handlers_hw.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file irq_handlers_hw.h + * @brief Heleper file for wiring irq handlers to theirs vectors. + */ + +#ifndef IRQ_HANDLERS_HW_H__ +#define IRQ_HANDLERS_HW_H__ + + +typedef struct +{ + IRQn_Type IRQn; + uint32_t vector; +} peripheral_handler_desc_t; + +#endif // IRQ_HANDLERS_HW_H__ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/lp_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/lp_ticker.c new file mode 100644 index 0000000000..ae63c2a1e1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/lp_ticker.c @@ -0,0 +1,48 @@ +/* mbed Microcontroller Library + * Copyright (c) 2015 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "lp_ticker_api.h" + +#if DEVICE_LOWPOWERTIMER + +#include "common_rtc.h" + +void lp_ticker_init(void) +{ + common_rtc_init(); +} + +uint32_t lp_ticker_read() +{ + return (uint32_t)common_rtc_64bit_us_get(); +} + +void lp_ticker_set_interrupt(timestamp_t timestamp) +{ + common_rtc_set_interrupt(timestamp, + LP_TICKER_CC_CHANNEL, LP_TICKER_INT_MASK); +} + +void lp_ticker_disable_interrupt(void) +{ + nrf_rtc_event_disable(COMMON_RTC_INSTANCE, LP_TICKER_INT_MASK); +} + +void lp_ticker_clear_interrupt(void) +{ + nrf_rtc_event_clear(COMMON_RTC_INSTANCE, LP_TICKER_EVENT); +} + +#endif // DEVICE_LOWPOWERTIMER diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nordic_critical.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nordic_critical.c new file mode 100644 index 0000000000..4f94263196 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nordic_critical.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include // uint32_t, UINT32_MAX +#include // uint32_t, UINT32_MAX +#include "cmsis.h" +#include "nrf_soc.h" +#include "nrf_sdm.h" +#include "nrf_nvic.h" + +static uint8_t _sd_state = 0; +static volatile uint32_t _entry_count = 0; + +void core_util_critical_section_enter() +{ + // if a critical section has already been entered, just update the counter + if (_entry_count) { + ++_entry_count; + return; + } + + // in this path, a critical section has never been entered + // routine of SD V11 work even if the softdevice is not active + sd_nvic_critical_region_enter(&_sd_state); + + assert(_entry_count == 0); // entry count should always be equal to 0 at this point + ++_entry_count; +} + +void core_util_critical_section_exit() +{ + assert(_entry_count > 0); + --_entry_count; + + // If their is other segments which have entered the critical section, just leave + if (_entry_count) { + return; + } + + // This is the last segment of the critical section, state should be restored as before entering + // the critical section + sd_nvic_critical_region_exit(_sd_state); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nrf5x_lf_clk_helper.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nrf5x_lf_clk_helper.h new file mode 100644 index 0000000000..08744be767 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nrf5x_lf_clk_helper.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __NRF5X_LF_CLK_HELPER_H_ + +#ifndef MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC + #define MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC (NRF_LF_SRC_XTAL) + #warning No configuration for LF clock source. Xtal source will be used as a default configuration. +#endif + + + +#define NRF_LF_SRC_XTAL 2 +#define NRF_LF_SRC_SYNTH 3 +#define NRF_LF_SRC_RC 4 + +#if MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_SYNTH + #define CLOCK_LFCLKSRC_SRC_TO_USE (CLOCK_LFCLKSRC_SRC_Synth) +#elif MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_XTAL + #define CLOCK_LFCLKSRC_SRC_TO_USE (CLOCK_LFCLKSRC_SRC_Xtal) +#elif MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_RC + #define CLOCK_LFCLKSRC_SRC_TO_USE (CLOCK_LFCLKSRC_SRC_RC) +#else + #error Bad LFCLK configuration. Declare proper source through mbed configuration. +#endif + +#undef NRF_LF_SRC_XTAL +#undef NRF_LF_SRC_SYNTH +#undef NRF_LF_SRC_RC + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h new file mode 100644 index 0000000000..209134b7d1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MBED_OBJECTS_H +#define MBED_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct serial_s { + uint32_t placeholder; // struct is unused by nRF5x API implementation +}; // but it must be not empty (required by strict compiler - IAR) + +struct spi_s { + uint8_t spi_idx; +}; + +struct port_s { + __IO uint32_t *reg_cnf; + __IO uint32_t *reg_out; + __I uint32_t *reg_in; + PortName port; + uint32_t mask; +}; + +struct pwmout_s { + PWMName pwm_name; + PinName pin; + uint8_t pwm_channel; + void * pwm_struct; +}; + +struct i2c_s { + uint8_t twi_idx; +}; + +struct analogin_s { + ADCName adc; + uint8_t adc_pin; +}; + +struct gpio_irq_s { + uint32_t ch; +}; + + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c new file mode 100644 index 0000000000..989fbf209b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c @@ -0,0 +1,35 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mbed_assert.h" +#include "mbed_error.h" +#include "pinmap.h" + +void pin_function(PinName pin, int function) +{ + /* Avoid compiler warnings */ + (void) pin; + (void) function; +} + +void pin_mode(PinName pin, PinMode mode) +{ + MBED_ASSERT(pin != (PinName)NC); + + uint32_t pin_number = (uint32_t)pin; + + NRF_GPIO->PIN_CNF[pin_number] &= ~GPIO_PIN_CNF_PULL_Msk; + NRF_GPIO->PIN_CNF[pin_number] |= (mode << GPIO_PIN_CNF_PULL_Pos); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c new file mode 100644 index 0000000000..ad3be04816 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "port_api.h" +#include "pinmap.h" +#include "gpio_api.h" + +PinName port_pin(PortName port, int pin_n) +{ + (void) port; + return (PinName)(pin_n); +} + +void port_init(port_t *obj, PortName port, int mask, PinDirection dir) +{ + obj->port = port; + obj->mask = mask; + + obj->reg_out = &NRF_GPIO->OUT; + obj->reg_in = &NRF_GPIO->IN; + obj->reg_cnf = NRF_GPIO->PIN_CNF; + + port_dir(obj, dir); +} + +void port_mode(port_t *obj, PinMode mode) +{ + uint32_t i; + // The mode is set per pin: reuse pinmap logic + for (i = 0; i<31; i++) { + if (obj->mask & (1 << i)) { + pin_mode(port_pin(obj->port, i), mode); + } + } +} + +void port_dir(port_t *obj, PinDirection dir) +{ + int i; + switch (dir) { + case PIN_INPUT: + for (i = 0; i<31; i++) { + if (obj->mask & (1 << i)) { + obj->reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) + | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) + | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos); + } + } + break; + case PIN_OUTPUT: + for (i = 0; i<31; i++) { + if (obj->mask & (1 << i)) { + obj->reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) + | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) + | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) + | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + } + } + break; + } +} + +void port_write(port_t *obj, int value) +{ + *obj->reg_out = value; +} + +int port_read(port_t *obj) +{ + return (*obj->reg_in); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/reloc_vector_table.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/reloc_vector_table.c new file mode 100644 index 0000000000..2862e6c417 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/reloc_vector_table.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf.h" +#include "cmsis_nvic.h" +#include "stdint.h" +#include "nrf_sdm.h" +#include "section_vars.h" + +#if defined(__CC_ARM) + __attribute__ ((section("noinit"),zero_init)) + uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS]; +#elif defined(__GNUC__) + __attribute__ ((section(".noinit"))) + uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS]; +#elif defined(__ICCARM__) + uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS] @ ".noinit"; +#endif + + +typedef void (*generic_irq_handler_t)(void); + + +extern uint32_t __Vectors[]; +#define VECTORS_FLASH_START __Vectors + +/** + * @brief Function for relocation of the vector to RAM on nRF5x devices. + * This function is intended to be called during startup. + */ +void nrf_reloc_vector_table(void) +{ + // Copy and switch to dynamic vectors + uint32_t *old_vectors = (uint32_t*)VECTORS_FLASH_START; + uint32_t i; + for (i = 0; i< NVIC_NUM_VECTORS; i++) { + nrf_dispatch_vector[i] = old_vectors[i]; + } + + sd_softdevice_vector_table_base_set((uint32_t) nrf_dispatch_vector); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c new file mode 100644 index 0000000000..cc4d0f118f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "rtc_api.h" + +#if DEVICE_RTC + +#include "common_rtc.h" +#include "nrf_drv_clock.h" +#include "app_util_platform.h" + +static time_t m_time_base; + +void rtc_init(void) +{ + common_rtc_init(); +} + +void rtc_free(void) +{ + // A common counter is used for RTC, lp_ticker and us_ticker, so it can't be + // disabled here, but this does not cause any extra cost. Besides, currently + // this function is not used by RTC API in mbed-drivers. +} + +int rtc_isenabled(void) +{ + return m_common_rtc_enabled; +} + +static uint32_t rtc_seconds_get(void) +{ + // Convert current counter value to seconds. + uint32_t seconds = nrf_rtc_counter_get(COMMON_RTC_INSTANCE) / RTC_INPUT_FREQ; + // Add proper amount of seconds for each registered overflow of the counter. + uint32_t seconds_per_overflow = (1uL << RTC_COUNTER_BITS) / RTC_INPUT_FREQ; + return (seconds + (m_common_rtc_overflows * seconds_per_overflow)); +} + +time_t rtc_read(void) +{ + return m_time_base + rtc_seconds_get(); +} + +void rtc_write(time_t t) +{ + uint32_t seconds; + do { + seconds = rtc_seconds_get(); + m_time_base = t - seconds; + // If the number of seconds indicated by the counter changed during the + // update of the time base, just repeat the update, now using the new + // number of seconds. + } while (seconds != rtc_seconds_get()); +} + +#endif // DEVICE_RTC diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.c new file mode 100644 index 0000000000..39a60f7d1c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.c @@ -0,0 +1,594 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "ble_advdata.h" +#include "ble_advertising.h" +#include "nrf_soc.h" +#include "nrf_log.h" +#include "pstorage.h" +#include "fstorage.h" +#include "sdk_common.h" + + +#define ADV_LOG(...) + +static bool m_advertising_start_pending = false; /**< Flag to keep track of ongoing operations on persistent memory. */ + +static ble_gap_addr_t m_peer_address; /**< Address of the most recently connected peer, used for direct advertising. */ +static ble_advdata_t m_advdata; /**< Used by the initialization function to set name, appearance, and UUIDs and advertising flags visible to peer devices. */ +static ble_adv_evt_t m_adv_evt; /**< Advertising event propogated to the main application. The event is either a transaction to a new advertising mode, or a request for whitelist or peer address.. */ +static ble_advertising_evt_handler_t m_evt_handler; /**< Handler for the advertising events. Can be initialized as NULL if no handling is implemented on in the main application. */ +static ble_advertising_error_handler_t m_error_handler; /**< Handler for the advertising error events. */ + +static ble_adv_mode_t m_adv_mode_current; /**< Variable to keep track of the current advertising mode. */ +static ble_adv_modes_config_t m_adv_modes_config; /**< Struct to keep track of disabled and enabled advertising modes, as well as time-outs and intervals.*/ + +static ble_gap_whitelist_t m_whitelist; /**< Struct that points to whitelisted addresses. */ +static ble_gap_addr_t * mp_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; /**< Pointer to a list of addresses. Pointed to by the whitelist */ +static ble_gap_irk_t * mp_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; /**< Pointer to a list of Identity Resolving Keys (IRK). Pointed to by the whitelist */ +static bool m_whitelist_temporarily_disabled = false; /**< Flag to keep track of temporary disabling of the whitelist. */ +static bool m_whitelist_reply_expected = false; /**< Flag to verify that whitelist is only set when it is requested. */ +static bool m_peer_addr_reply_expected = false; /**< Flag to verify that peer address is only set when requested. */ + +static ble_advdata_manuf_data_t m_manuf_specific_data; /**< Manufacturer specific data structure*/ +static uint8_t m_manuf_data_array[BLE_GAP_ADV_MAX_SIZE]; /**< Array to store the Manufacturer specific data*/ +static ble_advdata_service_data_t m_service_data; /**< Service data structure. */ +static uint8_t m_service_data_array[BLE_GAP_ADV_MAX_SIZE]; /**< Array to store the service data. */ +static ble_advdata_conn_int_t m_slave_conn_int; /**< Connection interval range structure.*/ +static int8_t m_tx_power_level; /**< TX power level*/ + + +/**@brief Function for checking that the whitelist has entries. + */ +static bool whitelist_has_entries(ble_gap_whitelist_t const * whitelist) +{ + if ((whitelist->addr_count != 0) || (whitelist->irk_count != 0)) + { + return true; + } + return false; +} + + +/**@brief Function for setting the stored peer address back to zero. + */ +static void ble_advertising_peer_address_clear() +{ + memset(&m_peer_address, 0, sizeof(m_peer_address)); +} + + +/**@brief Function for checking if an address is non-zero. Used to determine if + */ +static bool peer_address_exists(uint8_t const * address) +{ + uint32_t i; + + for (i = 0; i < BLE_GAP_ADDR_LEN; i++) + { + if (address[i] != 0) + { + return true; + } + } + return false; +} + + +uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, + ble_advdata_t const * p_srdata, + ble_adv_modes_config_t const * p_config, + ble_advertising_evt_handler_t const evt_handler, + ble_advertising_error_handler_t const error_handler) +{ + uint32_t err_code; + + VERIFY_PARAM_NOT_NULL(p_advdata); + VERIFY_PARAM_NOT_NULL(p_config); + + m_adv_mode_current = BLE_ADV_MODE_IDLE; + m_evt_handler = evt_handler; + m_error_handler = error_handler; + m_adv_modes_config = *p_config; + + ble_advertising_peer_address_clear(); + + // Prepare Whitelist. Address and IRK double pointers point to allocated arrays. + m_whitelist.pp_addrs = mp_whitelist_addr; + m_whitelist.pp_irks = mp_whitelist_irk; + + // Copy and set advertising data. + memset(&m_advdata, 0, sizeof(m_advdata)); + + // Copy advertising data. + m_advdata.name_type = p_advdata->name_type; + m_advdata.include_appearance = p_advdata->include_appearance; + m_advdata.flags = p_advdata->flags; + m_advdata.short_name_len = p_advdata->short_name_len; + /* + if(p_advdata->uuids_complete != NULL) + { + m_advdata.uuids_complete = p_advdata->uuids_complete; + } + */ + m_advdata.uuids_complete = p_advdata->uuids_complete; + m_advdata.uuids_more_available = p_advdata->uuids_more_available; + m_advdata.uuids_solicited = p_advdata->uuids_solicited; + + if(p_advdata->p_manuf_specific_data != NULL) + { + m_advdata.p_manuf_specific_data = &m_manuf_specific_data; + m_manuf_specific_data.data.p_data = m_manuf_data_array; + m_advdata.p_manuf_specific_data->company_identifier = + p_advdata->p_manuf_specific_data->company_identifier; + m_advdata.p_manuf_specific_data->data.size = p_advdata->p_manuf_specific_data->data.size; + + for(uint32_t i = 0; i < m_advdata.p_manuf_specific_data->data.size; i++) + { + m_manuf_data_array[i] = p_advdata->p_manuf_specific_data->data.p_data[i]; + } + } + + if(p_advdata->p_service_data_array != NULL) + { + m_service_data.data.p_data = m_service_data_array; + m_advdata.p_service_data_array = &m_service_data; + m_advdata.p_service_data_array->data.p_data = m_service_data_array; + m_advdata.p_service_data_array->data.size = p_advdata->p_service_data_array->data.size; + m_advdata.p_service_data_array->service_uuid = p_advdata->p_service_data_array->service_uuid; + + for(uint32_t i = 0; i < m_advdata.p_service_data_array->data.size; i++) + { + m_service_data_array[i] = p_advdata->p_service_data_array->data.p_data[i]; + } + + m_advdata.service_data_count = p_advdata->service_data_count; + } + + + if(p_advdata->p_slave_conn_int != NULL) + { + m_advdata.p_slave_conn_int = &m_slave_conn_int; + m_advdata.p_slave_conn_int->max_conn_interval = p_advdata->p_slave_conn_int->max_conn_interval; + m_advdata.p_slave_conn_int->min_conn_interval = p_advdata->p_slave_conn_int->min_conn_interval; + } + + if(p_advdata->p_tx_power_level != NULL) + { + m_advdata.p_tx_power_level = &m_tx_power_level; + m_advdata.p_tx_power_level = p_advdata->p_tx_power_level; + } + err_code = ble_advdata_set(&m_advdata, p_srdata); + return err_code; +} + +/** @brief Function to determine if a flash access in in progress. If it is the case, we can not +* start advertising until it is finished. attempted restart +* in @ref ble_advertising_on_sys_evt +* +* @return true if a flash access is in progress, false if not. +*/ +static bool flash_access_in_progress() +{ + uint32_t err_code; + uint32_t count = 0; + + err_code = pstorage_access_status_get(&count); + if ((err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_SUCCESS)) + { + ADV_LOG("[ADV]: pstorage_access_status_get returned %d.\r\n", err_code); + return true; + } + + if (err_code == NRF_ERROR_INVALID_STATE) + { + err_code = fs_queued_op_count_get(&count); + if (err_code != FS_SUCCESS) + { + return false; + } + ADV_LOG("[ADV]: fs_queued_op_count_get gives count %d.\r\n", count); + } + + if(count != 0) + { + return true; + } + else + { + return false; + } +} + +uint32_t ble_advertising_start(ble_adv_mode_t advertising_mode) +{ + uint32_t err_code; + ble_gap_adv_params_t adv_params; + + m_adv_mode_current = advertising_mode; + + // Verify if there are any pending flash operations. If so, delay starting advertising until + // the flash operations are complete. + if(flash_access_in_progress()) + { + m_advertising_start_pending = true; + return NRF_SUCCESS; + } + + ADV_LOG("[ADV]: no flash operations in progress, prepare advertising.\r\n"); + // Fetch the peer address. + ble_advertising_peer_address_clear(); + + if ( ((m_adv_modes_config.ble_adv_directed_enabled) && (m_adv_mode_current == BLE_ADV_MODE_DIRECTED)) + ||((m_adv_modes_config.ble_adv_directed_slow_enabled) && (m_adv_mode_current == BLE_ADV_MODE_DIRECTED)) + ||((m_adv_modes_config.ble_adv_directed_slow_enabled) && (m_adv_mode_current == BLE_ADV_MODE_DIRECTED_SLOW)) + ) + { + if (m_evt_handler != NULL) + { + m_peer_addr_reply_expected = true; + m_evt_handler(BLE_ADV_EVT_PEER_ADDR_REQUEST); + } + else + { + m_peer_addr_reply_expected = false; + } + } + + // If a mode is disabled, continue to the next mode. I.e fast instead of direct, slow instead of fast, idle instead of slow. + if ( (m_adv_mode_current == BLE_ADV_MODE_DIRECTED) + &&(!m_adv_modes_config.ble_adv_directed_enabled || !peer_address_exists(m_peer_address.addr))) + { + m_adv_mode_current = BLE_ADV_MODE_DIRECTED_SLOW; + } + if ( (m_adv_mode_current == BLE_ADV_MODE_DIRECTED_SLOW) + &&(!m_adv_modes_config.ble_adv_directed_slow_enabled || !peer_address_exists(m_peer_address.addr))) + { + m_adv_mode_current = BLE_ADV_MODE_FAST; + } + if (!m_adv_modes_config.ble_adv_fast_enabled && m_adv_mode_current == BLE_ADV_MODE_FAST) + { + m_adv_mode_current = BLE_ADV_MODE_SLOW; + } + if (!m_adv_modes_config.ble_adv_slow_enabled && m_adv_mode_current == BLE_ADV_MODE_SLOW) + { + m_adv_mode_current = BLE_ADV_MODE_IDLE; + m_adv_evt = BLE_ADV_EVT_IDLE; + } + + // Fetch the whitelist. + if ( (m_evt_handler != NULL) + && (m_adv_mode_current == BLE_ADV_MODE_FAST || m_adv_mode_current == BLE_ADV_MODE_SLOW) + && (m_adv_modes_config.ble_adv_whitelist_enabled) + && (!m_whitelist_temporarily_disabled)) + { + m_whitelist_reply_expected = true; + m_evt_handler(BLE_ADV_EVT_WHITELIST_REQUEST); + } + else + { + m_whitelist_reply_expected = false; + } + + // Initialize advertising parameters with default values. + memset(&adv_params, 0, sizeof(adv_params)); + + adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND; + adv_params.p_peer_addr = NULL; + adv_params.fp = BLE_GAP_ADV_FP_ANY; + adv_params.p_whitelist = NULL; + + // Set advertising parameters and events according to selected advertising mode. + switch (m_adv_mode_current) + { + case BLE_ADV_MODE_DIRECTED: + ADV_LOG("[ADV]: Starting direct advertisement.\r\n"); + adv_params.p_peer_addr = &m_peer_address; // Directed advertising. + adv_params.type = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND; + adv_params.timeout = 0; + adv_params.interval = 0; + m_adv_evt = BLE_ADV_EVT_DIRECTED; + break; + + case BLE_ADV_MODE_DIRECTED_SLOW: + ADV_LOG("[ADV]: Starting direct advertisement.\r\n"); + adv_params.p_peer_addr = &m_peer_address; // Directed advertising. + adv_params.type = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND; + adv_params.timeout = m_adv_modes_config.ble_adv_directed_slow_timeout; + adv_params.interval = m_adv_modes_config.ble_adv_directed_slow_interval; + m_adv_evt = BLE_ADV_EVT_DIRECTED_SLOW; + break; + + case BLE_ADV_MODE_FAST: + adv_params.timeout = m_adv_modes_config.ble_adv_fast_timeout; + adv_params.interval = m_adv_modes_config.ble_adv_fast_interval; + + if ( whitelist_has_entries(&m_whitelist) + && m_adv_modes_config.ble_adv_whitelist_enabled + && !m_whitelist_temporarily_disabled) + { + adv_params.fp = BLE_GAP_ADV_FP_FILTER_CONNREQ; + adv_params.p_whitelist = &m_whitelist; + m_advdata.flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; + err_code = ble_advdata_set(&m_advdata, NULL); + VERIFY_SUCCESS(err_code); + + m_adv_evt = BLE_ADV_EVT_FAST_WHITELIST; + ADV_LOG("[ADV]: Starting fast advertisement with whitelist.\r\n"); + } + else + { + m_adv_evt = BLE_ADV_EVT_FAST; + ADV_LOG("[ADV]: Starting fast advertisement.\r\n"); + } + break; + + case BLE_ADV_MODE_SLOW: + adv_params.interval = m_adv_modes_config.ble_adv_slow_interval; + adv_params.timeout = m_adv_modes_config.ble_adv_slow_timeout; + + if ( whitelist_has_entries(&m_whitelist) + && m_adv_modes_config.ble_adv_whitelist_enabled + && !m_whitelist_temporarily_disabled) + { + adv_params.fp = BLE_GAP_ADV_FP_FILTER_CONNREQ; + adv_params.p_whitelist = &m_whitelist; + m_advdata.flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; + err_code = ble_advdata_set(&m_advdata, NULL); + VERIFY_SUCCESS(err_code); + + m_adv_evt = BLE_ADV_EVT_SLOW_WHITELIST; + ADV_LOG("[ADV]: Starting slow advertisement with whitelist.\r\n"); + } + else + { + m_adv_evt = BLE_ADV_EVT_SLOW; + ADV_LOG("[ADV]: Starting slow advertisement.\r\n"); + } + break; + + default: + break; + } + if (m_adv_mode_current != BLE_ADV_MODE_IDLE) + { + err_code = sd_ble_gap_adv_start(&adv_params); + VERIFY_SUCCESS(err_code); + } + if (m_evt_handler != NULL) + { + m_evt_handler(m_adv_evt); + } + + return NRF_SUCCESS; +} + + +void ble_advertising_on_ble_evt(ble_evt_t const * p_ble_evt) +{ + static uint16_t current_slave_link_conn_handle = BLE_CONN_HANDLE_INVALID; + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + if (p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_PERIPH) + { + current_slave_link_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + } + break; + + // Upon disconnection, whitelist will be activated and direct advertising is started. + case BLE_GAP_EVT_DISCONNECTED: + { + uint32_t err_code; + m_whitelist_temporarily_disabled = false; + + if (p_ble_evt->evt.gap_evt.conn_handle == current_slave_link_conn_handle) + { + err_code = ble_advertising_start(BLE_ADV_MODE_DIRECTED); + if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(err_code); + } + } + break; + } + // Upon time-out, the next advertising mode is started, i.e. go from fast to slow or from slow to idle. + case BLE_GAP_EVT_TIMEOUT: + if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING) + { + switch (m_adv_mode_current) + { + case BLE_ADV_MODE_DIRECTED: + ADV_LOG("[ADV]: Timed out from directed advertising.\r\n"); + { + uint32_t err_code; + err_code = ble_advertising_start(BLE_ADV_MODE_DIRECTED_SLOW); + if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(err_code); + } + } + break; + case BLE_ADV_MODE_DIRECTED_SLOW: + ADV_LOG("[ADV]: Timed out from directed slow advertising.\r\n"); + { + uint32_t err_code; + err_code = ble_advertising_start(BLE_ADV_MODE_FAST); + if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(err_code); + } + } + break; + case BLE_ADV_MODE_FAST: + { + uint32_t err_code; + m_adv_evt = BLE_ADV_EVT_FAST; + ADV_LOG("[ADV]: Timed out from fast advertising, starting slow advertising.\r\n"); + err_code = ble_advertising_start(BLE_ADV_MODE_SLOW); + if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(err_code); + } + break; + } + case BLE_ADV_MODE_SLOW: + m_adv_evt = BLE_ADV_EVT_IDLE; + ADV_LOG("[ADV]: Timed out from slow advertising, stopping advertising.\r\n"); + if (m_evt_handler != NULL) + { + m_evt_handler(m_adv_evt); + } + break; + + default: + // No implementation needed. + break; + } + } + break; + + default: + // No implementation needed. + break; + } +} +void ble_advertising_on_sys_evt(uint32_t sys_evt) +{ + uint32_t err_code = NRF_SUCCESS; + switch (sys_evt) + { + + case NRF_EVT_FLASH_OPERATION_SUCCESS: + // Fall through. + + //When a flash operation finishes, advertising no longer needs to be pending. + case NRF_EVT_FLASH_OPERATION_ERROR: + if (m_advertising_start_pending) + { + m_advertising_start_pending = false; + err_code = ble_advertising_start(m_adv_mode_current); + if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(err_code); + } + } + break; + + default: + // No implementation needed. + break; + } +} + +uint32_t ble_advertising_peer_addr_reply(ble_gap_addr_t * p_peer_address) +{ + if(m_peer_addr_reply_expected == false) + { + return NRF_ERROR_INVALID_STATE; + } + + m_peer_address.addr_type = p_peer_address->addr_type; + + for (int i = 0; i < BLE_GAP_ADDR_LEN; i++) + { + m_peer_address.addr[i] = p_peer_address->addr[i]; + } + + m_peer_addr_reply_expected = false; + return NRF_SUCCESS; +} + + +uint32_t ble_advertising_whitelist_reply(ble_gap_whitelist_t * p_whitelist) +{ + uint32_t i; + + if(m_whitelist_reply_expected == false) + { + return NRF_ERROR_INVALID_STATE; + } + + m_whitelist.addr_count = p_whitelist->addr_count; + m_whitelist.irk_count = p_whitelist->irk_count; + + for (i = 0; i < m_whitelist.irk_count; i++) + { + mp_whitelist_irk[i] = p_whitelist->pp_irks[i]; + } + + for (i = 0; i < m_whitelist.addr_count; i++) + { + mp_whitelist_addr[i] = p_whitelist->pp_addrs[i]; + } + + m_whitelist_reply_expected = false; + return NRF_SUCCESS; +} + + +uint32_t ble_advertising_restart_without_whitelist(void) +{ + uint32_t err_code; + + if( m_adv_modes_config.ble_adv_whitelist_enabled == BLE_ADV_WHITELIST_ENABLED + && !m_whitelist_temporarily_disabled) + { + if (m_adv_mode_current != BLE_ADV_MODE_IDLE) + { + err_code = sd_ble_gap_adv_stop(); + VERIFY_SUCCESS(err_code); + } + m_whitelist_temporarily_disabled = true; + m_advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; + err_code = ble_advdata_set(&m_advdata, NULL); + VERIFY_SUCCESS(err_code); + + err_code = ble_advertising_start(m_adv_mode_current); + if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(err_code); + } + } + return NRF_SUCCESS; +} + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h new file mode 100644 index 0000000000..c806399eb4 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/**@file + * + * @defgroup ble_sdk_lib_advertising Advertising Module + * @{ + * @ingroup ble_sdk_lib + * @brief Module for handling connectable BLE advertising. + * + * @details The Advertising Module handles connectable advertising for your application. It can + * be configured with advertising modes to suit most typical use cases. + * Your main application can react to changes in advertising modes + * if an event handler is provided. + * + * @note The Advertising Module supports only applications with a single peripheral link. + * + * The application must propagate BLE stack events to this module by calling + * @ref ble_advertising_on_ble_evt() and system events by calling + * @ref ble_advertising_on_sys_evt(). + * + */ + +#ifndef BLE_ADVERTISING_H__ +#define BLE_ADVERTISING_H__ + +#include +#include "nrf_ble_gattc.h" +#include "nrf_ble.h" +#include "nrf_error.h" +#include "ble_advdata.h" + +/**@brief Advertising modes. +*/ +typedef enum +{ + BLE_ADV_MODE_IDLE, /**< Idle; no connectable advertising is ongoing.*/ + BLE_ADV_MODE_DIRECTED, /**< Directed advertising attempts to connect to the most recently disconnected peer. */ + BLE_ADV_MODE_DIRECTED_SLOW, /**< Directed advertising (low duty cycle) attempts to connect to the most recently disconnected peer. */ + BLE_ADV_MODE_FAST, /**< Fast advertising will connect to any peer device, or filter with a whitelist if one exists. */ + BLE_ADV_MODE_SLOW, /**< Slow advertising is similar to fast advertising. By default, it uses a longer advertising interval and time-out than fast advertising. However, these options are defined by the user. */ +} ble_adv_mode_t; + +/**@brief Advertising events. + * + * @details These events are propagated to the main application if a handler was provided during + * initialization of the Advertising Module. Events for modes that are not used can be + * ignored. Similarly, BLE_ADV_EVT_WHITELIST_REQUEST and BLE_ADV_EVT_PEER_ADDR_REQUEST + * can be ignored if whitelist and direct advertising is not used. + */ +typedef enum +{ + BLE_ADV_EVT_IDLE, /**< Idle; no connectable advertising is ongoing.*/ + BLE_ADV_EVT_DIRECTED, /**< Direct advertising mode has started. */ + BLE_ADV_EVT_DIRECTED_SLOW, /**< Directed advertising (low duty cycle) has started. */ + BLE_ADV_EVT_FAST, /**< Fast advertising mode has started. */ + BLE_ADV_EVT_SLOW, /**< Slow advertising mode has started.*/ + BLE_ADV_EVT_FAST_WHITELIST, /**< Fast advertising mode using the whitelist has started. */ + BLE_ADV_EVT_SLOW_WHITELIST, /**< Slow advertising mode using the whitelist has started.*/ + BLE_ADV_EVT_WHITELIST_REQUEST, /**< Request a whitelist from the main application. For whitelist advertising to work, the whitelist must be set when this event occurs. */ + BLE_ADV_EVT_PEER_ADDR_REQUEST /**< Request a peer address from the main application. For directed advertising to work, the peer address must be set when this event occurs. */ +} ble_adv_evt_t; + +/**@brief Options for the different advertisement modes. + * + * @details This structure is used to enable or disable advertising modes and to configure time-out + * periods and advertising intervals. + */ +typedef struct +{ + bool ble_adv_whitelist_enabled; /**< Enable or disable use of the whitelist. */ + bool ble_adv_directed_enabled; /**< Enable or disable direct advertising mode. */ + bool ble_adv_directed_slow_enabled; /**< Enable or disable direct advertising mode. */ + uint32_t ble_adv_directed_slow_interval; /**< Advertising interval for directed advertising. */ + uint32_t ble_adv_directed_slow_timeout; /**< Time-out (number of tries) for direct advertising. */ + bool ble_adv_fast_enabled; /**< Enable or disable fast advertising mode. */ + uint32_t ble_adv_fast_interval; /**< Advertising interval for fast advertising. */ + uint32_t ble_adv_fast_timeout; /**< Time-out (in seconds) for fast advertising. */ + bool ble_adv_slow_enabled; /**< Enable or disable slow advertising mode. */ + uint32_t ble_adv_slow_interval; /**< Advertising interval for slow advertising. */ + uint32_t ble_adv_slow_timeout; /**< Time-out (in seconds) for slow advertising. */ +}ble_adv_modes_config_t; + + +/**@brief BLE advertising event handler type. */ +typedef void (*ble_advertising_evt_handler_t) (ble_adv_evt_t const adv_evt); + +/**@brief BLE advertising error handler type. */ +typedef void (*ble_advertising_error_handler_t) (uint32_t nrf_error); + +/**@brief Initialization parameters for the Advertising Module. + * @details This structure is used to pass advertising options, advertising data, and an event handler to the Advertising Module during initialization. */ +typedef struct +{ + ble_adv_modes_config_t options; /**< Parameters for advertising modes.*/ + ble_advdata_t advdata; /**< Advertising data. */ + ble_advertising_evt_handler_t evt_handler; /**< Event handler. */ +}ble_adv_init_t; + + +/* Defines to make the mode options easier to set during advertising init.*/ +#define BLE_ADV_DIRECTED_ENABLED true +#define BLE_ADV_DIRECTED_DISABLED false + +#define BLE_ADV_DIRECTED_SLOW_ENABLED true +#define BLE_ADV_DIRECTED_SLOW_DISABLED false + +#define BLE_ADV_FAST_ENABLED true +#define BLE_ADV_FAST_DISABLED false + +#define BLE_ADV_SLOW_ENABLED true +#define BLE_ADV_SLOW_DISABLED false + +#define BLE_ADV_WHITELIST_ENABLED true +#define BLE_ADV_WHITELIST_DISABLED false + + +/**@brief Function for handling BLE events. + * + * @details This function must be called from the BLE stack event dispatcher for + * the module to handle BLE events that are relevant for the Advertising Module. + * + * @param[in] p_ble_evt BLE stack event. + */ +void ble_advertising_on_ble_evt(const ble_evt_t * const p_ble_evt); + + +/**@brief Function for handling system events. + * + * @details This function must be called to handle system events that are relevant + * for the Advertising Module. Specifically, the advertising module can not use the + * softdevice as long as there are pending writes to the flash memory. This + * event handler is designed to delay advertising until there is no flash operation. + * + * @param[in] sys_evt System event. + */ +void ble_advertising_on_sys_evt(uint32_t sys_evt); + + +/**@brief Function for initializing the Advertising Module. + * + * @details Encodes the required advertising data and passes it to the stack. + * Also builds a structure to be passed to the stack when starting advertising. + * The supplied advertising data is copied to a local structure and is manipulated + * depending on what advertising modes are started in @ref ble_advertising_start. + * + * @param[in] p_advdata Advertising data: name, appearance, discovery flags, and more. + * @param[in] p_srdata Scan response data: Supplement to advertising data. + * @param[in] p_config Select which advertising modes and intervals will be utilized. + * @param[in] evt_handler Event handler that will be called upon advertising events. + * @param[in] error_handler Error handler that will propogate internal errors to the main applications. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, + ble_advdata_t const * p_srdata, + ble_adv_modes_config_t const * p_config, + ble_advertising_evt_handler_t const evt_handler, + ble_advertising_error_handler_t const error_handler); + + +/**@brief Function for starting advertising. + * + * @details You can start advertising in any of the advertising modes that you enabled + * during initialization. + * + * @param[in] advertising_mode Advertising mode. + * + * @retval @ref NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval @ref NRF_ERROR_INVALID_STATE + */ +uint32_t ble_advertising_start(ble_adv_mode_t advertising_mode); + +/**@brief Function for setting the peer address. + * + * @details The peer address must be set by the application upon receiving a + * @ref BLE_ADV_EVT_PEER_ADDR_REQUEST event. Without the peer address, the directed + * advertising mode will not be run. + * + * @param[in] p_peer_addr Pointer to a peer address. + * + * @retval @ref NRF_SUCCESS Successfully stored the peer address pointer in the advertising module. + * @retval @ref NRF_ERROR_INVALID_STATE If a reply was not expected. + */ +uint32_t ble_advertising_peer_addr_reply(ble_gap_addr_t * p_peer_addr); + + +/**@brief Function for setting a whitelist. + * + * @details The whitelist must be set by the application upon receiving a + * @ref BLE_ADV_EVT_WHITELIST_REQUEST event. Without the whitelist, the whitelist + * advertising for fast and slow modes will not be run. + * + * @param[in] p_whitelist Pointer to a whitelist. + * + * @retval @ref NRF_SUCCESS Successfully stored pointers to the whitelist into the advertising module. + * @retval @ref NRF_ERROR_INVALID_STATE If a reply was not expected. + */ +uint32_t ble_advertising_whitelist_reply(ble_gap_whitelist_t * p_whitelist); + + +/**@brief Function for disabling whitelist advertising. + * + * @details This function temporarily disables whitelist advertising. + * Calling this function resets the current time-out countdown. + * + * @retval @ref NRF_SUCCESS On success, else an error message propogated from the Softdevice. + */ +uint32_t ble_advertising_restart_without_whitelist(void); +/** @} */ + +#endif // BLE_ADVERTISING_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c new file mode 100644 index 0000000000..d2a7b0b213 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c @@ -0,0 +1,967 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_db_discovery.h" +#include +#include "nrf_ble.h" +#include "nrf_log.h" + +#include "sdk_common.h" + +#define SRV_DISC_START_HANDLE 0x0001 /**< The start handle value used during service discovery. */ +#define DB_DISCOVERY_MAX_USERS BLE_DB_DISCOVERY_MAX_SRV /**< The maximum number of users/registrations allowed by this module. */ +#define DB_LOG NRF_LOG_PRINTF_DEBUG /**< A debug logger macro that can be used in this file to do logging information over UART. */ + + +/**@brief Array of structures containing information about the registered application modules. */ +static ble_uuid_t m_registered_handlers[DB_DISCOVERY_MAX_USERS]; + + +/**@brief Array of structures containing pending events to be sent to the application modules. + * + * @details Whenever a discovery related event is to be raised to a user module, it will be stored + * in this array first. When all services needed to be discovered have been + * discovered, all pending events will be sent to the corresponding user modules. + **/ +static struct +{ + ble_db_discovery_evt_t evt; /**< The pending event. */ + ble_db_discovery_evt_handler_t evt_handler; /**< The event handler which should be called to raise this event. */ +} m_pending_user_evts[DB_DISCOVERY_MAX_USERS]; + +static ble_db_discovery_evt_handler_t m_evt_handler; +static uint32_t m_pending_usr_evt_index; /**< The index to the pending user event array, pointing to the last added pending user event. */ +static uint32_t m_num_of_handlers_reg; /**< The number of handlers registered with the DB Discovery module. */ +static bool m_initialized = false; /**< This variable Indicates if the module is initialized or not. */ + +#define MODULE_INITIALIZED (m_initialized == true) +#include "sdk_macros.h" + +/**@brief Function for fetching the event handler provided by a registered application module. + * + * @param[in] srv_uuid UUID of the service. + * + * @retval evt_handler Event handler of the module, registered for the given service UUID. + * @retval NULL If no event handler is found. + */ +static ble_db_discovery_evt_handler_t registered_handler_get(const ble_uuid_t * const p_srv_uuid) +{ + uint32_t i; + + for (i = 0; i < m_num_of_handlers_reg; i++) + { + if (BLE_UUID_EQ(&(m_registered_handlers[i]), p_srv_uuid)) + { + return (m_evt_handler); + } + } + + return NULL; +} + + +/**@brief Function for storing the event handler provided by a registered application module. + * + * @param[in] p_srv_uuid The UUID of the service. + * @param[in] p_evt_handler The event handler provided by the application. + * + * @retval NRF_SUCCESS If the handler was stored or already present in the list. + * @retval NRF_ERROR_NO_MEM If there is no space left to store the handler. + */ +static uint32_t registered_handler_set(const ble_uuid_t * const p_srv_uuid, + ble_db_discovery_evt_handler_t p_evt_handler) +{ + if (registered_handler_get(p_srv_uuid) != NULL) + { + return NRF_SUCCESS; + } + if (m_num_of_handlers_reg < DB_DISCOVERY_MAX_USERS) + { + m_registered_handlers[m_num_of_handlers_reg] = *p_srv_uuid; + + m_num_of_handlers_reg++; + + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_NO_MEM; + } +} + + +/**@brief Function for sending all pending discovery events to the corresponding user modules. + */ +static void pending_user_evts_send(void) +{ + uint32_t i = 0; + + for (i = 0; i < m_num_of_handlers_reg; i++) + { + // Pass the event to the corresponding event handler. + m_pending_user_evts[i].evt_handler(&(m_pending_user_evts[i].evt)); + } + m_pending_usr_evt_index = 0; +} + + +/**@brief Function for indicating error to the application. + * + * @details This function will fetch the event handler based on the UUID of the service being + * discovered. (The event handler is registered by the application beforehand). + * The error code is added to the pending events together with the event handler. + * If no event handler was found, then this function will do nothing. + * + * @param[in] p_db_discovery Pointer to the DB discovery structure. + * @param[in] err_code Error code that should be provided to the application. + * @param[in] conn_handle Connection Handle. + * + */ +static void discovery_error_evt_trigger(ble_db_discovery_t * const p_db_discovery, + uint32_t err_code, + uint16_t const conn_handle) +{ + ble_db_discovery_evt_handler_t p_evt_handler; + ble_gatt_db_srv_t * p_srv_being_discovered; + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + p_evt_handler = registered_handler_get(&(p_srv_being_discovered->srv_uuid)); + + if (p_evt_handler != NULL) + { + ble_db_discovery_evt_t evt; + + evt.conn_handle = conn_handle; + evt.evt_type = BLE_DB_DISCOVERY_ERROR; + evt.params.err_code = err_code; + + p_evt_handler(&evt); + } +} + + +/**@brief Function for triggering a Discovery Complete or Service Not Found event to the + * application. + * + * @details This function will fetch the event handler based on the UUID of the service being + * discovered. (The event handler is registered by the application beforehand). + * It then triggers an event indicating the completion of the service discovery. + * If no event handler was found, then this function will do nothing. + * + * @param[in] p_db_discovery Pointer to the DB discovery structure. + * @param[in] is_srv_found Variable to indicate if the service was found at the peer. + * @param[in] conn_handle Connection Handle. + */ +static void discovery_complete_evt_trigger(ble_db_discovery_t * const p_db_discovery, + bool is_srv_found, + uint16_t const conn_handle) +{ + ble_db_discovery_evt_handler_t p_evt_handler; + ble_gatt_db_srv_t * p_srv_being_discovered; + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + p_evt_handler = registered_handler_get(&(p_srv_being_discovered->srv_uuid)); + + if (p_evt_handler != NULL) + { + if (m_pending_usr_evt_index < DB_DISCOVERY_MAX_USERS) + { + // Insert an event into the pending event list. + m_pending_user_evts[m_pending_usr_evt_index].evt.conn_handle = conn_handle; + + m_pending_user_evts[m_pending_usr_evt_index].evt.params.discovered_db = + *p_srv_being_discovered; + if (is_srv_found) + { + m_pending_user_evts[m_pending_usr_evt_index].evt.evt_type = + BLE_DB_DISCOVERY_COMPLETE; + } + else + { + m_pending_user_evts[m_pending_usr_evt_index].evt.evt_type = + BLE_DB_DISCOVERY_SRV_NOT_FOUND; + } + m_pending_user_evts[m_pending_usr_evt_index].evt_handler = p_evt_handler; + + m_pending_usr_evt_index++; + + if (m_pending_usr_evt_index == m_num_of_handlers_reg) + { + // All registered modules have pending events. Send all pending events to the user + // modules. + pending_user_evts_send(); + } + else + { + // Too many events pending. Do nothing. (Ideally this should not happen.) + } + } + } +} + + +/**@brief Function for handling service discovery completion. + * + * @details This function will be used to determine if there are more services to be discovered, + * and if so, initiate the discovery of the next service. + * + * @param[in] p_db_discovery Pointer to the DB Discovery Structure. + * @param[in] conn_handle Connection Handle. + */ +static void on_srv_disc_completion(ble_db_discovery_t * p_db_discovery, + uint16_t const conn_handle) +{ + p_db_discovery->discoveries_count++; + + // Check if more services need to be discovered. + if (p_db_discovery->discoveries_count < m_num_of_handlers_reg) + { + // Reset the current characteristic index since a new service discovery is about to start. + p_db_discovery->curr_char_ind = 0; + + // Initiate discovery of the next service. + p_db_discovery->curr_srv_ind++; + + ble_gatt_db_srv_t * p_srv_being_discovered; + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + p_srv_being_discovered->srv_uuid = m_registered_handlers[p_db_discovery->curr_srv_ind]; + + // Reset the characteristic count in the current service to zero since a new service + // discovery is about to start. + p_srv_being_discovered->char_count = 0; + + DB_LOG("[DB]: Starting discovery of service with UUID 0x%x for Connection handle %d\r\n", + p_srv_being_discovered->srv_uuid.uuid, conn_handle); + + uint32_t err_code; + + err_code = sd_ble_gattc_primary_services_discover + ( + conn_handle, + SRV_DISC_START_HANDLE, + &(p_srv_being_discovered->srv_uuid) + ); + if (err_code != NRF_SUCCESS) + { + p_db_discovery->discovery_in_progress = false; + + // Error with discovering the service. + // Indicate the error to the registered user application. + discovery_error_evt_trigger(p_db_discovery, err_code, conn_handle); + + m_pending_user_evts[0].evt.evt_type = BLE_DB_DISCOVERY_AVAILABLE; + m_pending_user_evts[0].evt.conn_handle = conn_handle; +// m_evt_handler(&m_pending_user_evts[0].evt); + + return; + } + } + else + { + // No more service discovery is needed. + p_db_discovery->discovery_in_progress = false; + m_pending_user_evts[0].evt.evt_type = BLE_DB_DISCOVERY_AVAILABLE; + m_pending_user_evts[0].evt.conn_handle = conn_handle; + //m_evt_handler(&m_pending_user_evts[0].evt); + } +} + + +/**@brief Function for finding out if a characteristic discovery should be performed after the + * last discovered characteristic. + * + * @details This function is used during the time of database discovery to find out if there is + * a need to do more characteristic discoveries. The value handles of the + * last discovered characteristic is compared with the end handle of the service. + * If the service handle is greater than one of the former characteristic handles, + * it means that a characteristic discovery is required. + * + * @param[in] p_db_discovery The pointer to the DB Discovery structure. + * @param[in] p_after_char The pointer to the last discovered characteristic. + * + * @retval True if a characteristic discovery is required. + * @retval False if a characteristic discovery is NOT required. + */ +static bool is_char_discovery_reqd(ble_db_discovery_t * const p_db_discovery, + ble_gattc_char_t * p_after_char) +{ + if ( + p_after_char->handle_value < + p_db_discovery->services[p_db_discovery->curr_srv_ind].handle_range.end_handle + ) + { + // Handle value of the characteristic being discovered is less than the end handle of + // the service being discovered. There is a possibility of more characteristics being + // present. Hence a characteristic discovery is required. + return true; + } + + return false; +} + + +/**@brief Function to find out if a descriptor discovery is required. + * + * @details This function finds out if there is a possibility of existence of descriptors between + * current characteristic and the next characteristic. If so, this function will compute + * the handle range on which the descriptors may be present and will return it. + * If the current characteristic is the last known characteristic, then this function + * will use the service end handle to find out if the current characteristic can have + * descriptors. + * + * @param[in] p_db_discovery Pointer to the DB Discovery structure. + * @param[in] p_curr_char Pointer to the current characteristic. + * @param[in] p_next_char Pointer to the next characteristic. This should be NULL if the + * caller knows that there is no characteristic after the current + * characteristic at the peer. + * @param[out] p_handle_range Pointer to the handle range in which descriptors may exist at the + * the peer. + * + * @retval True If a descriptor discovery is required. + * @retval False If a descriptor discovery is NOT required. + */ +static bool is_desc_discovery_reqd(ble_db_discovery_t * p_db_discovery, + ble_gatt_db_char_t * p_curr_char, + ble_gatt_db_char_t * p_next_char, + ble_gattc_handle_range_t * p_handle_range) +{ + if (p_next_char == NULL) + { + // Current characteristic is the last characteristic in the service. Check if the value + // handle of the current characteristic is equal to the service end handle. + if ( + p_curr_char->characteristic.handle_value == + p_db_discovery->services[p_db_discovery->curr_srv_ind].handle_range.end_handle + ) + { + // No descriptors can be present for the current characteristic. p_curr_char is the last + // characteristic with no descriptors. + return false; + } + + p_handle_range->start_handle = p_curr_char->characteristic.handle_value + 1; + + // Since the current characteristic is the last characteristic in the service, the end + // handle should be the end handle of the service. + p_handle_range->end_handle = + p_db_discovery->services[p_db_discovery->curr_srv_ind].handle_range.end_handle; + + return true; + } + + // p_next_char != NULL. Check for existence of descriptors between the current and the next + // characteristic. + if ((p_curr_char->characteristic.handle_value + 1) == p_next_char->characteristic.handle_decl) + { + // No descriptors can exist between the two characteristic. + return false; + } + + p_handle_range->start_handle = p_curr_char->characteristic.handle_value + 1; + p_handle_range->end_handle = p_next_char->characteristic.handle_decl - 1; + + return true; +} + + +/**@brief Function for performing characteristic discovery. + * + * @param[in] p_db_discovery Pointer to the DB Discovery structure. + * @param[in] conn_handle Connection Handle. + * + * @return NRF_SUCCESS if the SoftDevice was successfully requested to perform the characteristic + * discovery. Otherwise an error code. This function returns the error code returned + * by the SoftDevice API @ref sd_ble_gattc_characteristics_discover. + */ +static uint32_t characteristics_discover(ble_db_discovery_t * const p_db_discovery, + uint16_t const conn_handle) +{ + ble_gatt_db_srv_t * p_srv_being_discovered; + ble_gattc_handle_range_t handle_range; + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + if (p_db_discovery->curr_char_ind != 0) + { + // This is not the first characteristic being discovered. Hence the 'start handle' to be + // used must be computed using the handle_value of the previous characteristic. + ble_gattc_char_t * p_prev_char; + uint8_t prev_char_ind = p_db_discovery->curr_char_ind - 1; + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + p_prev_char = &(p_srv_being_discovered->charateristics[prev_char_ind].characteristic); + + handle_range.start_handle = p_prev_char->handle_value + 1; + } + else + { + // This is the first characteristic of this service being discovered. + handle_range.start_handle = p_srv_being_discovered->handle_range.start_handle; + } + + handle_range.end_handle = p_srv_being_discovered->handle_range.end_handle; + + return sd_ble_gattc_characteristics_discover(conn_handle, &handle_range); +} + + +/**@brief Function for performing descriptor discovery, if required. + * + * @details This function will check if descriptor discovery is required and then perform it if + * needed. If no more descriptor discovery is required for the service, then the output + * parameter p_raise_discov_complete is set to true, indicating to the caller that a + * discovery complete event can be triggered to the application. + * + * @param[in] p_db_discovery Pointer to the DB Discovery structure. + * @param[out] p_raise_discov_complete The value pointed to by this pointer will be set to true if + * the Discovery Complete event can be triggered to the + * application. + * @param[in] conn_handle Connection Handle. + * + * @return NRF_SUCCESS if the SoftDevice was successfully requested to perform the descriptor + * discovery, or if no more descriptor discovery is required. Otherwise an error code. + * This function returns the error code returned by the SoftDevice API @ref + * sd_ble_gattc_descriptors_discover. + */ +static uint32_t descriptors_discover(ble_db_discovery_t * const p_db_discovery, + bool * p_raise_discov_complete, + uint16_t const conn_handle) +{ + ble_gattc_handle_range_t handle_range; + ble_gatt_db_char_t * p_curr_char_being_discovered; + ble_gatt_db_srv_t * p_srv_being_discovered; + bool is_discovery_reqd = false; + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + p_curr_char_being_discovered = + &(p_srv_being_discovered->charateristics[p_db_discovery->curr_char_ind]); + + if ((p_db_discovery->curr_char_ind + 1) == p_srv_being_discovered->char_count) + { + // This is the last characteristic of this service. + is_discovery_reqd = is_desc_discovery_reqd(p_db_discovery, + p_curr_char_being_discovered, + NULL, + &handle_range); + } + else + { + uint8_t i; + ble_gatt_db_char_t * p_next_char; + + for (i = p_db_discovery->curr_char_ind; + i < p_srv_being_discovered->char_count; + i++) + { + + if (i == (p_srv_being_discovered->char_count - 1)) + { + // The current characteristic is the last characteristic in the service. + p_next_char = NULL; + } + else + { + p_next_char = &(p_srv_being_discovered->charateristics[i + 1]); + } + + // Check if it is possible for the current characteristic to have a descriptor. + if (is_desc_discovery_reqd(p_db_discovery, + p_curr_char_being_discovered, + p_next_char, + &handle_range)) + { + is_discovery_reqd = true; + break; + } + else + { + // No descriptors can exist. + p_curr_char_being_discovered = p_next_char; + p_db_discovery->curr_char_ind++; + } + } + } + + if (!is_discovery_reqd) + { + // No more descriptor discovery required. Discovery is complete. + // This informs the caller that a discovery complete event can be triggered. + *p_raise_discov_complete = true; + + return NRF_SUCCESS; + } + + *p_raise_discov_complete = false; + + return sd_ble_gattc_descriptors_discover(conn_handle, &handle_range); +} + + +/**@brief Function for handling primary service discovery response. + * + * @details This function will handle the primary service discovery response and start the + * discovery of characteristics within that service. + * + * @param[in] p_db_discovery Pointer to the DB Discovery structure. + * @param[in] p_ble_gattc_evt Pointer to the GATT Client event. + */ +static void on_primary_srv_discovery_rsp(ble_db_discovery_t * const p_db_discovery, + const ble_gattc_evt_t * const p_ble_gattc_evt) +{ + ble_gatt_db_srv_t * p_srv_being_discovered; + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + if (p_ble_gattc_evt->conn_handle != p_db_discovery->conn_handle) + { + return; + } + if (p_ble_gattc_evt->gatt_status == BLE_GATT_STATUS_SUCCESS) + { + uint32_t err_code; + const ble_gattc_evt_prim_srvc_disc_rsp_t * p_prim_srvc_disc_rsp_evt; + + DB_LOG("Found service UUID 0x%x\r\n", p_srv_being_discovered->srv_uuid.uuid); + + p_prim_srvc_disc_rsp_evt = &(p_ble_gattc_evt->params.prim_srvc_disc_rsp); + + p_srv_being_discovered->srv_uuid = p_prim_srvc_disc_rsp_evt->services[0].uuid; + p_srv_being_discovered->handle_range = p_prim_srvc_disc_rsp_evt->services[0].handle_range; + + err_code = characteristics_discover(p_db_discovery, + p_ble_gattc_evt->conn_handle); + + if (err_code != NRF_SUCCESS) + { + p_db_discovery->discovery_in_progress = false; + + // Error with discovering the service. + // Indicate the error to the registered user application. + discovery_error_evt_trigger(p_db_discovery, + err_code, + p_ble_gattc_evt->conn_handle); + + m_pending_user_evts[0].evt.evt_type = BLE_DB_DISCOVERY_AVAILABLE; + m_pending_user_evts[0].evt.conn_handle = p_ble_gattc_evt->conn_handle; + //m_evt_handler(&m_pending_user_evts[0].evt); + } + } + else + { + DB_LOG("Service UUID 0x%x Not found\r\n", p_srv_being_discovered->srv_uuid.uuid); + // Trigger Service Not Found event to the application. + discovery_complete_evt_trigger(p_db_discovery, + false, + p_ble_gattc_evt->conn_handle); + + on_srv_disc_completion(p_db_discovery, + p_ble_gattc_evt->conn_handle); + } +} + + +/**@brief Function for handling characteristic discovery response. + * + * @param[in] p_db_discovery Pointer to the DB Discovery structure. + * @param[in] p_ble_gattc_evt Pointer to the GATT Client event. + */ +static void on_characteristic_discovery_rsp(ble_db_discovery_t * const p_db_discovery, + const ble_gattc_evt_t * const p_ble_gattc_evt) +{ + uint32_t err_code; + ble_gatt_db_srv_t * p_srv_being_discovered; + bool perform_desc_discov = false; + + if (p_ble_gattc_evt->conn_handle != p_db_discovery->conn_handle) + { + return; + } + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + if (p_ble_gattc_evt->gatt_status == BLE_GATT_STATUS_SUCCESS) + { + const ble_gattc_evt_char_disc_rsp_t * p_char_disc_rsp_evt; + + p_char_disc_rsp_evt = &(p_ble_gattc_evt->params.char_disc_rsp); + + // Find out the number of characteristics that were previously discovered (in earlier + // characteristic discovery responses, if any). + uint8_t num_chars_prev_disc = p_srv_being_discovered->char_count; + + // Find out the number of characteristics that are currently discovered (in the + // characteristic discovery response being handled). + uint8_t num_chars_curr_disc = p_char_disc_rsp_evt->count; + + // Check if the total number of discovered characteristics are supported by this module. + if ((num_chars_prev_disc + num_chars_curr_disc) <= BLE_GATT_DB_MAX_CHARS) + { + // Update the characteristics count. + p_srv_being_discovered->char_count += num_chars_curr_disc; + } + else + { + // The number of characteristics discovered at the peer is more than the supported + // maximum. This module will store only the characteristics found up to this point. + p_srv_being_discovered->char_count = BLE_GATT_DB_MAX_CHARS; + } + + uint32_t i; + uint32_t j; + + for (i = num_chars_prev_disc, j = 0; i < p_srv_being_discovered->char_count; i++, j++) + { + p_srv_being_discovered->charateristics[i].characteristic = + p_char_disc_rsp_evt->chars[j]; + + p_srv_being_discovered->charateristics[i].cccd_handle = BLE_GATT_HANDLE_INVALID; + } + + ble_gattc_char_t * p_last_known_char; + + p_last_known_char = &(p_srv_being_discovered->charateristics[i - 1].characteristic); + + // If no more characteristic discovery is required, or if the maximum number of supported + // characteristic per service has been reached, descriptor discovery will be performed. + if ( + !is_char_discovery_reqd(p_db_discovery, p_last_known_char) || + (p_srv_being_discovered->char_count == BLE_GATT_DB_MAX_CHARS) + ) + { + perform_desc_discov = true; + } + else + { + // Update the current characteristic index. + p_db_discovery->curr_char_ind = p_srv_being_discovered->char_count; + + // Perform another round of characteristic discovery. + err_code = characteristics_discover(p_db_discovery, + p_ble_gattc_evt->conn_handle); + + if (err_code != NRF_SUCCESS) + { + p_db_discovery->discovery_in_progress = false; + + discovery_error_evt_trigger(p_db_discovery, + err_code, + p_ble_gattc_evt->conn_handle); + + m_pending_user_evts[0].evt.evt_type = BLE_DB_DISCOVERY_AVAILABLE; + m_pending_user_evts[0].evt.conn_handle = p_ble_gattc_evt->conn_handle; + //m_evt_handler(&m_pending_user_evts[0].evt); + + return; + } + } + } + else + { + // The previous characteristic discovery resulted in no characteristics. + // descriptor discovery should be performed. + perform_desc_discov = true; + } + + if (perform_desc_discov) + { + bool raise_discov_complete; + + p_db_discovery->curr_char_ind = 0; + + err_code = descriptors_discover(p_db_discovery, + &raise_discov_complete, + p_ble_gattc_evt->conn_handle); + + if (err_code != NRF_SUCCESS) + { + p_db_discovery->discovery_in_progress = false; + + discovery_error_evt_trigger(p_db_discovery, + err_code, + p_ble_gattc_evt->conn_handle); + + m_pending_user_evts[0].evt.evt_type = BLE_DB_DISCOVERY_AVAILABLE; + m_pending_user_evts[0].evt.conn_handle = p_ble_gattc_evt->conn_handle; + //m_evt_handler(&m_pending_user_evts[0].evt); + + return; + } + if (raise_discov_complete) + { + // No more characteristics and descriptors need to be discovered. Discovery is complete. + // Send a discovery complete event to the user application. + DB_LOG("[DB]: Discovery of service with UUID 0x%x completed with success for Connection" + " handle %d\r\n", p_srv_being_discovered->srv_uuid.uuid, + p_ble_gattc_evt->conn_handle); + + discovery_complete_evt_trigger(p_db_discovery, + true, + p_ble_gattc_evt->conn_handle); + + on_srv_disc_completion(p_db_discovery, + p_ble_gattc_evt->conn_handle); + } + } +} + + +/**@brief Function for handling descriptor discovery response. + * + * @param[in] p_db_discovery Pointer to the DB Discovery structure. + * @param[in] p_ble_gattc_evt Pointer to the GATT Client event. + */ +static void on_descriptor_discovery_rsp(ble_db_discovery_t * const p_db_discovery, + const ble_gattc_evt_t * const p_ble_gattc_evt) +{ + const ble_gattc_evt_desc_disc_rsp_t * p_desc_disc_rsp_evt; + ble_gatt_db_srv_t * p_srv_being_discovered; + + if (p_ble_gattc_evt->conn_handle != p_db_discovery->conn_handle) + { + return; + } + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + p_desc_disc_rsp_evt = &(p_ble_gattc_evt->params.desc_disc_rsp); + + ble_gatt_db_char_t * p_char_being_discovered = + &(p_srv_being_discovered->charateristics[p_db_discovery->curr_char_ind]); + + if (p_ble_gattc_evt->gatt_status == BLE_GATT_STATUS_SUCCESS) + { + // The descriptor was found at the peer. + // If the descriptor was a CCCD, then the cccd_handle needs to be populated. + + uint32_t i; + + // Loop through all the descriptors to find the CCCD. + for (i = 0; i < p_desc_disc_rsp_evt->count; i++) + { + if ( + p_desc_disc_rsp_evt->descs[i].uuid.uuid == + BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG + ) + { + p_char_being_discovered->cccd_handle = p_desc_disc_rsp_evt->descs[i].handle; + + break; + } + } + } + + bool raise_discov_complete = false; + + if ((p_db_discovery->curr_char_ind + 1) == p_srv_being_discovered->char_count) + { + // No more characteristics and descriptors need to be discovered. Discovery is complete. + // Send a discovery complete event to the user application. + + raise_discov_complete = true; + } + else + { + // Begin discovery of descriptors for the next characteristic. + uint32_t err_code; + + p_db_discovery->curr_char_ind++; + + err_code = descriptors_discover(p_db_discovery, + &raise_discov_complete, + p_ble_gattc_evt->conn_handle); + + if (err_code != NRF_SUCCESS) + { + p_db_discovery->discovery_in_progress = false; + + // Error with discovering the service. + // Indicate the error to the registered user application. + discovery_error_evt_trigger(p_db_discovery, + err_code, + p_ble_gattc_evt->conn_handle); + + m_pending_user_evts[0].evt.evt_type = BLE_DB_DISCOVERY_AVAILABLE; + m_pending_user_evts[0].evt.conn_handle = p_ble_gattc_evt->conn_handle; + + return; + } + } + + if (raise_discov_complete) + { + DB_LOG("[DB]: Discovery of service with UUID 0x%x completed with success for Connection" + "handle %d\r\n", p_srv_being_discovered->srv_uuid.uuid, + p_ble_gattc_evt->conn_handle); + + discovery_complete_evt_trigger(p_db_discovery, + true, + p_ble_gattc_evt->conn_handle); + + on_srv_disc_completion(p_db_discovery, + p_ble_gattc_evt->conn_handle); + } +} + + +uint32_t ble_db_discovery_init(const ble_db_discovery_evt_handler_t evt_handler) +{ + uint32_t err_code = NRF_SUCCESS; + VERIFY_PARAM_NOT_NULL(evt_handler); + + m_num_of_handlers_reg = 0; + m_initialized = true; + m_pending_usr_evt_index = 0; + m_evt_handler = evt_handler; + + return err_code; + +} + + +uint32_t ble_db_discovery_close() +{ + m_num_of_handlers_reg = 0; + m_initialized = false; + m_pending_usr_evt_index = 0; + + return NRF_SUCCESS; +} + + +uint32_t ble_db_discovery_evt_register(const ble_uuid_t * const p_uuid) +{ + VERIFY_PARAM_NOT_NULL(p_uuid); + VERIFY_MODULE_INITIALIZED(); + + return registered_handler_set(p_uuid, m_evt_handler); +} + + +uint32_t ble_db_discovery_start(ble_db_discovery_t * const p_db_discovery, + uint16_t conn_handle) +{ + VERIFY_PARAM_NOT_NULL(p_db_discovery); + VERIFY_MODULE_INITIALIZED(); + + if (m_num_of_handlers_reg == 0) + { + // No user modules were registered. There are no services to discover. + return NRF_ERROR_INVALID_STATE; + } + + if (p_db_discovery->discovery_in_progress) + { + return NRF_ERROR_BUSY; + } + + p_db_discovery->conn_handle = conn_handle; + ble_gatt_db_srv_t * p_srv_being_discovered; + + m_pending_usr_evt_index = 0; + + p_db_discovery->discoveries_count = 0; + p_db_discovery->curr_srv_ind = 0; + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + p_srv_being_discovered->srv_uuid = m_registered_handlers[p_db_discovery->curr_srv_ind]; + + DB_LOG("[DB]: Starting discovery of service with UUID 0x%x for Connection handle %d\r\n", + p_srv_being_discovered->srv_uuid.uuid, conn_handle); + + uint32_t err_code; + + err_code = sd_ble_gattc_primary_services_discover(conn_handle, + SRV_DISC_START_HANDLE, + &(p_srv_being_discovered->srv_uuid)); + VERIFY_SUCCESS(err_code); + p_db_discovery->discovery_in_progress = true; + + return NRF_SUCCESS; +} + + +/**@brief Function for handling disconnected event. + * + * @param[in] p_db_discovery Pointer to the DB Discovery structure. + * @param[in] p_ble_gattc_evt Pointer to the GAP event. + */ +static void on_disconnected(ble_db_discovery_t * const p_db_discovery, + const ble_gap_evt_t * const p_evt) +{ + if (p_evt->conn_handle == p_db_discovery->conn_handle) + { + p_db_discovery->discovery_in_progress = false; + } +} + + +void ble_db_discovery_on_ble_evt(ble_db_discovery_t * const p_db_discovery, + const ble_evt_t * const p_ble_evt) +{ + VERIFY_PARAM_NOT_NULL_VOID(p_db_discovery); + VERIFY_PARAM_NOT_NULL_VOID(p_ble_evt); + VERIFY_MODULE_INITIALIZED_VOID(); + + switch (p_ble_evt->header.evt_id) + { + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + on_primary_srv_discovery_rsp(p_db_discovery, &(p_ble_evt->evt.gattc_evt)); + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + on_characteristic_discovery_rsp(p_db_discovery, &(p_ble_evt->evt.gattc_evt)); + break; + + case BLE_GATTC_EVT_DESC_DISC_RSP: + on_descriptor_discovery_rsp(p_db_discovery, &(p_ble_evt->evt.gattc_evt)); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnected(p_db_discovery, &(p_ble_evt->evt.gap_evt)); + break; + + default: + break; + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h new file mode 100644 index 0000000000..edca50f3e5 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/**@file + * + * @defgroup ble_sdk_lib_db_discovery Database Discovery + * @{ + * @ingroup ble_sdk_lib + * @brief Database discovery module. + * + * @details This module contains the APIs and types exposed by the DB Discovery module. These APIs + * and types can be used by the application to perform discovery of a service and its + * characteristics at the peer server. This module can also be used to discover the + * desired services in multiple remote devices. + * + * @warning The maximum number of characteristics per service that can be discovered by this module + * is determined by the number of characteristics in the service structure defined in + * db_disc_config.h. If the peer has more than the supported number of characteristics, then + * the first found will be discovered and any further characteristics will be ignored. No + * descriptors other than Client Characteristic Configuration Descriptors will be searched + * for at the peer. + * + * @note Presently only one instance of a Primary Service can be discovered by this module. If + * there are multiple instances of the service at the peer, only the first instance + * of it at the peer is fetched and returned to the application. + * + * @note The application must propagate BLE stack events to this module by calling + * ble_db_discovery_on_ble_evt(). + * + */ + +#ifndef BLE_DB_DISCOVERY_H__ +#define BLE_DB_DISCOVERY_H__ + +#include +#include "nrf_ble_gattc.h" +#include "nrf_ble.h" +#include "nrf_error.h" +#include "ble_srv_common.h" +#include "ble_gatt_db.h" + + +#define BLE_DB_DISCOVERY_MAX_SRV 6 /**< Maximum number of services supported by this module. This also indicates the maximum number of users allowed to be registered to this module. (one user per service). */ + + +/**@brief Type of the DB Discovery event. + */ +typedef enum +{ + BLE_DB_DISCOVERY_COMPLETE, /**< Event indicating that the GATT Database discovery is complete. */ + BLE_DB_DISCOVERY_ERROR, /**< Event indicating that an internal error has occurred in the DB Discovery module. This could typically be because of the SoftDevice API returning an error code during the DB discover.*/ + BLE_DB_DISCOVERY_SRV_NOT_FOUND, /**< Event indicating that the service was not found at the peer.*/ + BLE_DB_DISCOVERY_AVAILABLE /**< Event indicating that the DB discovery module is available.*/ +} ble_db_discovery_evt_type_t; + + + +/**@brief Structure for holding the information related to the GATT database at the server. + * + * @details This module identifies a remote database. Use one instance of this structure per + * connection. + * + * @warning This structure must be zero-initialized. + */ +typedef struct +{ + ble_gatt_db_srv_t services[BLE_DB_DISCOVERY_MAX_SRV]; /**< Information related to the current service being discovered. This is intended for internal use during service discovery.*/ + uint8_t srv_count; /**< Number of services at the peers GATT database.*/ + uint8_t curr_char_ind; /**< Index of the current characteristic being discovered. This is intended for internal use during service discovery.*/ + uint8_t curr_srv_ind; /**< Index of the current service being discovered. This is intended for internal use during service discovery.*/ + bool discovery_in_progress; /**< Variable to indicate if there is a service discovery in progress. */ + uint8_t discoveries_count; /**< Number of service discoveries made, both successful and unsuccessful. */ + uint16_t conn_handle; /**< Connection handle on which the discovery is started*/ +} ble_db_discovery_t; + + +/**@brief Structure containing the event from the DB discovery module to the application. + */ +typedef struct +{ + ble_db_discovery_evt_type_t evt_type; /**< Type of event. */ + uint16_t conn_handle; /**< Handle of the connection for which this event has occurred. */ + union + { + ble_gatt_db_srv_t discovered_db; /**< Structure containing the information about the GATT Database at the server. This will be filled when the event type is @ref BLE_DB_DISCOVERY_COMPLETE.*/ + uint32_t err_code; /**< nRF Error code indicating the type of error which occurred in the DB Discovery module. This will be filled when the event type is @ref BLE_DB_DISCOVERY_ERROR. */ + } params; +} ble_db_discovery_evt_t; + + +/**@brief DB Discovery event handler type. */ +typedef void (* ble_db_discovery_evt_handler_t)(ble_db_discovery_evt_t * p_evt); + + +/**@brief Function for initializing the DB Discovery module. + * + * @param[in] evt_handler Event handler to be called by the DB discovery module when any event + * related to discovery of the registered service occurs. + * + * @retval NRF_SUCCESS On successful initialization. + * @retval NRF_ERROR_NULL If the handler was NULL. + */ +uint32_t ble_db_discovery_init(ble_db_discovery_evt_handler_t evt_handler); + + +/**@brief Function for closing the DB Discovery module. + * + * @details This function will clear up any internal variables and states maintained by the + * module. To re-use the module after calling this function, the function @ref + * ble_db_discovery_init must be called again. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t ble_db_discovery_close(void); + + +/**@brief Function for registering with the DB Discovery module. + * + * @details The application can use this function to inform which service it is interested in + * discovering at the server. + * + * @param[in] p_uuid Pointer to the UUID of the service to be discovered at the server. + * + * @note The total number of services that can be discovered by this module is @ref + * BLE_DB_DISCOVERY_MAX_SRV. This effectively means that the maximum number of + * registrations possible is equal to the @ref BLE_DB_DISCOVERY_MAX_SRV. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL When a NULL pointer is passed as input. + * @retval NRF_ERROR_INVALID_STATE If this function is called without calling the + * @ref ble_db_discovery_init. + * @retval NRF_ERROR_NO_MEM The maximum number of registrations allowed by this module + * has been reached. + */ +uint32_t ble_db_discovery_evt_register(const ble_uuid_t * const p_uuid); + + +/**@brief Function for starting the discovery of the GATT database at the server. + * + * @warning p_db_discovery structure must be zero-initialized. + * + * @param[out] p_db_discovery Pointer to the DB Discovery structure. + * @param[in] conn_handle The handle of the connection for which the discovery should be + * started. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL When a NULL pointer is passed as input. + * @retval NRF_ERROR_INVALID_STATE If this function is called without calling the + * @ref ble_db_discovery_init, or without calling + * @ref ble_db_discovery_evt_register. + * @retval NRF_ERROR_BUSY If a discovery is already in progress for the current + * connection. + * + * @return This API propagates the error code returned by the + * SoftDevice API @ref sd_ble_gattc_primary_services_discover. + */ +uint32_t ble_db_discovery_start(ble_db_discovery_t * const p_db_discovery, + uint16_t conn_handle); + + +/**@brief Function for handling the Application's BLE Stack events. + * + * @param[in,out] p_db_discovery Pointer to the DB Discovery structure. + * @param[in] p_ble_evt Pointer to the BLE event received. + */ +void ble_db_discovery_on_ble_evt(ble_db_discovery_t * const p_db_discovery, + const ble_evt_t * const p_ble_evt); + +#endif // BLE_DB_DISCOVERY_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.c new file mode 100644 index 0000000000..665393c6fb --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_debug_assert_handler.h" +#include +#include "nrf.h" +#include "ble_error_log.h" +#include "nordic_common.h" + +#define MAX_LENGTH_FILENAME 128 /**< Max length of filename to copy for the debug error handlier. */ + + +// WARNING - DO NOT USE THIS FUNCTION IN END PRODUCT. - WARNING +// WARNING - FOR DEBUG PURPOSES ONLY. - WARNING +void ble_debug_assert_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name) +{ + // Copying parameters to static variables because parameters may not be accessible in debugger. + static volatile uint8_t s_file_name[MAX_LENGTH_FILENAME]; + static volatile uint16_t s_line_num; + static volatile uint32_t s_error_code; + + strncpy((char *)s_file_name, (const char *)p_file_name, MAX_LENGTH_FILENAME - 1); + s_file_name[MAX_LENGTH_FILENAME - 1] = '\0'; + s_line_num = line_num; + s_error_code = error_code; + UNUSED_VARIABLE(s_file_name); + UNUSED_VARIABLE(s_line_num); + UNUSED_VARIABLE(s_error_code); + + // WARNING: The PRIMASK register is set to disable ALL interrups during writing the error log. + // + // Do not use __disable_irq() in normal operation. + __disable_irq(); + + // This function will write error code, filename, and line number to the flash. + // In addition, the Cortex-M0 stack memory will also be written to the flash. + //(void) ble_error_log_write(error_code, p_file_name, line_num); + + // For debug purposes, this function never returns. + // Attach a debugger for tracing the error cause. + for (;;) + { + // Do nothing. + } +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.h new file mode 100644 index 0000000000..7a4ffa2648 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_debug_assert_handler Assert handler for debug purposes + * @{ + * @ingroup ble_sdk_lib + * @brief Module for handling of assert during application development when debugging. + * + * @details This module may be used during development of an application to facilitate debugging. + * It contains a function to write file name, line number and the Stack Memory to flash. + * This module is ONLY for debugging purposes and must never be used in final product. + * + */ + +#ifndef BLE_DEBUG_ASSERT_HANDLER_H__ +#define BLE_DEBUG_ASSERT_HANDLER_H__ + +#include + +/**@brief Function for handling the Debug assert, which can be called from an error handler. + * To be used only for debugging purposes. + * + *@details This code will copy the filename and line number into local variables for them to always + * be accessible in Keil debugger. The function will also write the ARM Cortex-M0 stack + * memory into flash where it can be retrieved and manually un-winded in order to + * back-trace the location where the error ocured.
+ * @warning ALL INTERRUPTS WILL BE DISABLED. + * + * @note This function will never return but loop forever for debug purposes. + * + * @param[in] error_code Error code supplied to the handler. + * @param[in] line_num Line number where the original handler is called. + * @param[in] p_file_name Pointer to the file name. + */ +void ble_debug_assert_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name); + +#endif /* BLE_DEBUG_ASSERT_HANDLER_H__ */ + + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.c new file mode 100644 index 0000000000..dad99f352b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.c @@ -0,0 +1,670 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_dtm.h" +#include +#include +#include "nrf.h" + +#define DTM_HEADER_OFFSET 0 /**< Index where the header of the pdu is located. */ +#define DTM_HEADER_SIZE 2 /**< Size of PDU header. */ +#define DTM_PAYLOAD_MAX_SIZE 37 /**< Maximum payload size allowed during dtm execution. */ +#define DTM_LENGTH_OFFSET (DTM_HEADER_OFFSET + 1) /**< Index where the length of the payload is encoded. */ +#define DTM_PDU_MAX_MEMORY_SIZE (DTM_HEADER_SIZE + DTM_PAYLOAD_MAX_SIZE) /**< Maximum PDU size allowed during dtm execution. */ + +/**@details The UART poll cycle in micro seconds. + * Baud rate of 19200 bits / second, and 8 data bits, 1 start/stop bit, no flow control, + * give the time to transmit a byte: 10 bits * 1/19200 = approx: 520 us. + * + * To ensure no loss of bytes, the UART should be polled every 260 us. + * + * @note If UART bit rate is changed, this value should be recalculated as well. + */ +#define UART_POLL_CYCLE 260 + +#define RX_MODE true /**< Constant defining RX mode for radio during dtm test. */ +#define TX_MODE false /**< Constant defining TX mode for radio during dtm test. */ + +#define PHYS_CH_MAX 39 /**< Maximum number of valid channels in BLE. */ + +// Values that for now are "constants" - they could be configured by a function setting them, +// but most of these are set by the BLE DTM standard, so changing them is not relevant. +#define RFPHY_TEST_0X0F_REF_PATTERN 0x0f /**< RF-PHY test packet patterns, for the repeated octet packets. */ +#define RFPHY_TEST_0X55_REF_PATTERN 0x55 /**< RF-PHY test packet patterns, for the repeated octet packets. */ + +#define PRBS9_CONTENT {0xff, 0xc1, 0xfb, 0xe8, 0x4c, 0x90, 0x72, 0x8b, \ + 0xe7, 0xb3, 0x51, 0x89, 0x63, 0xab, 0x23, 0x23, \ + 0x2, 0x84, 0x18, 0x72, 0xaa, 0x61, 0x2f, 0x3b, \ + 0x51, 0xa8, 0xe5, 0x37, 0x49, 0xfb, 0xc9, 0xca, \ + 0xc, 0x18, 0x53, 0x2c, 0xfd} /**< The PRBS9 sequence used as packet payload. */ + +/**@brief Structure holding the PDU used for transmitting/receiving a PDU. + */ +typedef struct +{ + uint8_t content[DTM_HEADER_SIZE + DTM_PAYLOAD_MAX_SIZE]; /**< PDU packet content. */ +} pdu_type_t; + +/**@brief States used for the DTM test implementation. + */ +typedef enum +{ + STATE_UNINITIALIZED, /**< The DTM is uninitialized. */ + STATE_IDLE, /**< State when system has just initialized, or current test has completed. */ + STATE_TRANSMITTER_TEST, /**< State used when a DTM Transmission test is running. */ + STATE_CARRIER_TEST, /**< State used when a DTM Carrier test is running (Vendor specific test). */ + STATE_RECEIVER_TEST /**< State used when a DTM Receive test is running. */ +} state_t; + +// Internal variables set as side effects of commands or events. +static state_t m_state = STATE_UNINITIALIZED; /**< Current machine state. */ +static uint16_t m_rx_pkt_count; /**< Number of valid packets received. */ +static pdu_type_t m_pdu; /**< PDU to be sent. */ +static uint16_t m_event; /**< current command status - initially "ok", may be set if error detected, or to packet count. */ +static bool m_new_event; /**< Command has been processed - number of not yet reported event bytes. */ +static uint8_t m_packet_length; /**< Payload length of transmitted PDU, bits 2:7 of 16-bit dtm command. */ +static dtm_pkt_type_t m_packet_type; /**< Bits 0..1 of 16-bit transmit command, or 0xFFFFFFFF. */ +static dtm_freq_t m_phys_ch; /**< 0..39 physical channel number (base 2402 MHz, Interval 2 MHz), bits 8:13 of 16-bit dtm command. */ +static uint32_t m_current_time = 0; /**< Counter for interrupts from timer to ensure that the 2 bytes forming a DTM command are received within the time window. */ + +// Nordic specific configuration values (not defined by BLE standard). +// Definition of initial values found in ble_dtm.h +static int32_t m_tx_power = DEFAULT_TX_POWER; /**< TX power for transmission test, default to maximum value (+4 dBm). */ +static NRF_TIMER_Type * mp_timer = DEFAULT_TIMER; /**< Timer to be used. */ +static IRQn_Type m_timer_irq = DEFAULT_TIMER_IRQn; /**< which interrupt line to clear on every timeout */ + +static uint8_t const m_prbs_content[] = PRBS9_CONTENT; /**< Pseudo-random bit sequence defined by the BLE standard. */ +static uint8_t m_packetHeaderLFlen = 8; /**< Length of length field in packet Header (in bits). */ +static uint8_t m_packetHeaderS0len = 1; /**< Length of S0 field in packet Header (in bytes). */ +static uint8_t m_packetHeaderS1len = 0; /**< Length of S1 field in packet Header (in bits). */ +static uint8_t m_crcConfSkipAddr = 1; /**< Leave packet address field out of CRC calculation. */ +static uint8_t m_static_length = 0; /**< Number of bytes sent in addition to the var.length payload. */ +static uint32_t m_balen = 3; /**< Base address length in bytes. */ +static uint32_t m_endian = RADIO_PCNF1_ENDIAN_Little; /**< On air endianess of packet, this applies to the S0, LENGTH, S1 and the PAYLOAD fields. */ +static uint32_t m_whitening = RADIO_PCNF1_WHITEEN_Disabled; /**< Whitening disabled. */ +static uint8_t m_crcLength = RADIO_CRCCNF_LEN_Three; /**< CRC Length (in bytes). */ +static uint32_t m_address = 0x71764129; /**< Address. */ +static uint32_t m_crc_poly = 0x0000065B; /**< CRC polynomial. */ +static uint32_t m_crc_init = 0x00555555; /**< Initial value for CRC calculation. */ +static uint8_t m_radio_mode = RADIO_MODE_MODE_Ble_1Mbit; /**< nRF51 specific radio mode vale. */ +static uint32_t m_txIntervaluS = 625; /**< Time between start of Tx packets (in uS). */ + + +/**@brief Function for verifying that a received PDU has the expected structure and content. + */ +static bool check_pdu(void) +{ + uint8_t k; // Byte pointer for running through PDU payload + uint8_t pattern; // Repeating octet value in payload + dtm_pkt_type_t pdu_packet_type; // Note: PDU packet type is a 4-bit field in HCI, but 2 bits in BLE DTM + uint8_t length; + + pdu_packet_type = (dtm_pkt_type_t)(m_pdu.content[DTM_HEADER_OFFSET] & 0x0F); + length = m_pdu.content[DTM_LENGTH_OFFSET]; + + if ((pdu_packet_type > (dtm_pkt_type_t)PACKET_TYPE_MAX) || (length > DTM_PAYLOAD_MAX_SIZE)) + { + return false; + } + + if (pdu_packet_type == DTM_PKT_PRBS9) + { + // Payload does not consist of one repeated octet; must compare ir with entire block into + return (memcmp(m_pdu.content+DTM_HEADER_SIZE, m_prbs_content, length) == 0); + } + + if (pdu_packet_type == DTM_PKT_0X0F) + { + pattern = RFPHY_TEST_0X0F_REF_PATTERN; + } + else + { + pattern = RFPHY_TEST_0X55_REF_PATTERN; + } + + for (k = 0; k < length; k++) + { + // Check repeated pattern filling the PDU payload + if (m_pdu.content[k + 2] != pattern) + { + return false; + } + } + return true; +} + + +/**@brief Function for turning off the radio after a test. + * Also called after test done, to be ready for next test. + */ +static void radio_reset(void) +{ + NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Msk | PPI_CHENCLR_CH1_Msk; + + NRF_RADIO->SHORTS = 0; + NRF_RADIO->EVENTS_DISABLED = 0; + NRF_RADIO->TASKS_DISABLE = 1; + + while (NRF_RADIO->EVENTS_DISABLED == 0) + { + // Do nothing + } + + NRF_RADIO->EVENTS_DISABLED = 0; + NRF_RADIO->TASKS_RXEN = 0; + NRF_RADIO->TASKS_TXEN = 0; + + m_rx_pkt_count = 0; +} + + +/**@brief Function for initializing the radio for DTM. + */ +static uint32_t radio_init(void) +{ +#ifdef NRF51 + // Handle BLE Radio tuning parameters from production for DTM if required. + // Only needed for DTM without SoftDevice, as the SoftDevice normally handles this. + // PCN-083. + if ( ((NRF_FICR->OVERRIDEEN) & FICR_OVERRIDEEN_BLE_1MBIT_Msk) == FICR_OVERRIDEEN_BLE_1MBIT_Override) + { + NRF_RADIO->OVERRIDE0 = NRF_FICR->BLE_1MBIT[0]; + NRF_RADIO->OVERRIDE1 = NRF_FICR->BLE_1MBIT[1]; + NRF_RADIO->OVERRIDE2 = NRF_FICR->BLE_1MBIT[2]; + NRF_RADIO->OVERRIDE3 = NRF_FICR->BLE_1MBIT[3]; + NRF_RADIO->OVERRIDE4 = NRF_FICR->BLE_1MBIT[4]; + } +#endif // NRF51 + + // Initializing code below is quite generic - for BLE, the values are fixed, and expressions + // are constant. Non-constant values are essentially set in radio_prepare(). + if (((m_tx_power & 0x03) != 0) || // tx_power should be a multiple of 4 + ((m_tx_power & 0xffffff00) != 0) || // Upper 24 bits are required to be zeroed + ((int8_t)m_tx_power > 4) || // Max tx_power is +4 dBm + ((int8_t)(m_tx_power & 0xff) < -40) || // Min tx_power is -40 dBm + (m_radio_mode > RADIO_MODE_MODE_Ble_1Mbit) // Values 0-2: Proprietary mode, 3 (last valid): BLE + ) + { + return DTM_ERROR_ILLEGAL_CONFIGURATION; + } + + // Turn off radio before configuring it + radio_reset(); + + NRF_RADIO->TXPOWER = m_tx_power; + NRF_RADIO->MODE = m_radio_mode << RADIO_MODE_MODE_Pos; + + // Set the access address, address0/prefix0 used for both Rx and Tx address + NRF_RADIO->PREFIX0 &= ~RADIO_PREFIX0_AP0_Msk; + NRF_RADIO->PREFIX0 |= (m_address >> 24) & RADIO_PREFIX0_AP0_Msk; + NRF_RADIO->BASE0 = m_address << 8; + NRF_RADIO->RXADDRESSES = RADIO_RXADDRESSES_ADDR0_Enabled << RADIO_RXADDRESSES_ADDR0_Pos; + NRF_RADIO->TXADDRESS = (0x00 << RADIO_TXADDRESS_TXADDRESS_Pos) & RADIO_TXADDRESS_TXADDRESS_Msk; + + // Configure CRC calculation + NRF_RADIO->CRCCNF = (m_crcConfSkipAddr << RADIO_CRCCNF_SKIP_ADDR_Pos) | + (m_crcLength << RADIO_CRCCNF_LEN_Pos); + + NRF_RADIO->PCNF0 = (m_packetHeaderS1len << RADIO_PCNF0_S1LEN_Pos) | + (m_packetHeaderS0len << RADIO_PCNF0_S0LEN_Pos) | + (m_packetHeaderLFlen << RADIO_PCNF0_LFLEN_Pos); + + NRF_RADIO->PCNF1 = (m_whitening << RADIO_PCNF1_WHITEEN_Pos) | + (m_endian << RADIO_PCNF1_ENDIAN_Pos) | + (m_balen << RADIO_PCNF1_BALEN_Pos) | + (m_static_length << RADIO_PCNF1_STATLEN_Pos) | + (DTM_PAYLOAD_MAX_SIZE << RADIO_PCNF1_MAXLEN_Pos); + + return DTM_SUCCESS; +} + + +/**@brief Function for preparing the radio. At start of each test: Turn off RF, clear interrupt flags of RF, initialize the radio + * at given RF channel. + * + *@param[in] rx boolean indicating if radio should be prepared in rx mode (true) or tx mode. + */ +static void radio_prepare(bool rx) +{ +#ifdef NRF51 + NRF_RADIO->TEST = 0; +#elif defined(NRF52) + NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_RU_Default << RADIO_MODECNF0_RU_Pos) | + (RADIO_MODECNF0_DTX_B1 << RADIO_MODECNF0_DTX_Pos); +#endif // NRF51 / NRF52 + NRF_RADIO->CRCPOLY = m_crc_poly; + NRF_RADIO->CRCINIT = m_crc_init; + NRF_RADIO->FREQUENCY = (m_phys_ch << 1) + 2; // Actual frequency (MHz): 2400 + register value + NRF_RADIO->PACKETPTR = (uint32_t)&m_pdu; // Setting packet pointer will start the radio + NRF_RADIO->EVENTS_READY = 0; + NRF_RADIO->SHORTS = (1 << RADIO_SHORTS_READY_START_Pos) | // Shortcut between READY event and START task + (1 << RADIO_SHORTS_END_DISABLE_Pos); // Shortcut between END event and DISABLE task + + if (rx) + { + NRF_RADIO->EVENTS_END = 0; + NRF_RADIO->TASKS_RXEN = 1; // shorts will start radio in RX mode when it is ready + } + else // tx + { + NRF_RADIO->TXPOWER = m_tx_power; + } +} + + +/**@brief Function for terminating the ongoing test (if any) and closing down the radio. + */ +static void dtm_test_done(void) +{ +#ifdef NRF51 + NRF_RADIO->TEST = 0; +#elif defined(NRF52) + NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_RU_Default << RADIO_MODECNF0_RU_Pos) | + (RADIO_MODECNF0_DTX_B1 << RADIO_MODECNF0_DTX_Pos); +#endif // NRF51 / NRF52 + NRF_PPI->CHENCLR = 0x01; + NRF_PPI->CH[0].EEP = 0; // Break connection from timer to radio to stop transmit loop + NRF_PPI->CH[0].TEP = 0; + + radio_reset(); + m_state = STATE_IDLE; +} + + +/**@brief Function for configuring the timer for 625us cycle time. + */ +static uint32_t timer_init(void) +{ + // Use 16MHz from external crystal + // This could be customized for RC/Xtal, or even to use a 32 kHz crystal + NRF_CLOCK->EVENTS_HFCLKSTARTED = 0; + NRF_CLOCK->TASKS_HFCLKSTART = 1; + + while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) + { + // Do nothing while waiting for the clock to start + } + + mp_timer->TASKS_STOP = 1; // Stop timer, if it was running + mp_timer->TASKS_CLEAR = 1; + mp_timer->MODE = TIMER_MODE_MODE_Timer; // Timer mode (not counter) + mp_timer->EVENTS_COMPARE[0] = 0; // clean up possible old events + mp_timer->EVENTS_COMPARE[1] = 0; + mp_timer->EVENTS_COMPARE[2] = 0; + mp_timer->EVENTS_COMPARE[3] = 0; + + // Timer is polled, but enable the compare0 interrupt in order to wakeup from CPU sleep + mp_timer->INTENSET = TIMER_INTENSET_COMPARE0_Msk; + mp_timer->SHORTS = 1 << TIMER_SHORTS_COMPARE0_CLEAR_Pos; // Clear the count every time timer reaches the CCREG0 count + mp_timer->PRESCALER = 4; // Input clock is 16MHz, timer clock = 2 ^ prescale -> interval 1us + mp_timer->CC[0] = m_txIntervaluS; // 625uS with 1MHz clock to the timer + mp_timer->CC[1] = UART_POLL_CYCLE; // 260uS with 1MHz clock to the timer + mp_timer->TASKS_START = 1; // Start the timer - it will be running continuously + m_current_time = 0; + return DTM_SUCCESS; +} + + +/**@brief Function for handling vendor specific commands. + * Used when packet type is set to Vendor specific. + * The length field is used for encoding vendor specific command. + * The frequency field is used for encoding vendor specific options to the command. + * + * @param[in] vendor_cmd Vendor specific command to be executed. + * @param[in] vendor_option Vendor specific option to the vendor command. + * + * @return DTM_SUCCESS or one of the DTM_ERROR_ values + */ +static uint32_t dtm_vendor_specific_pkt(uint32_t vendor_cmd, dtm_freq_t vendor_option) +{ + switch (vendor_cmd) + { + // nRFgo Studio uses CARRIER_TEST_STUDIO to indicate a continuous carrier without + // a modulated signal. + case CARRIER_TEST: + case CARRIER_TEST_STUDIO: + // Not a packet type, but used to indicate that a continuous carrier signal + // should be transmitted by the radio. + radio_prepare(TX_MODE); +#ifdef NRF51 + NRF_RADIO->TEST = (RADIO_TEST_PLL_LOCK_Enabled << RADIO_TEST_PLL_LOCK_Pos) | + (RADIO_TEST_CONST_CARRIER_Enabled << RADIO_TEST_CONST_CARRIER_Pos); +#elif defined(NRF52) + NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_RU_Default << RADIO_MODECNF0_RU_Pos) | + (RADIO_MODECNF0_DTX_B1 << RADIO_MODECNF0_DTX_Pos); +#endif // NRF51 / NRF52 + + // Shortcut between READY event and START task + NRF_RADIO->SHORTS = 1 << RADIO_SHORTS_READY_START_Pos; + + // Shortcut will start radio in Tx mode when it is ready + NRF_RADIO->TASKS_TXEN = 1; + m_state = STATE_CARRIER_TEST; + break; + + case SET_TX_POWER: + if (!dtm_set_txpower(vendor_option)) + { + return DTM_ERROR_ILLEGAL_CONFIGURATION; + } + break; + + case SELECT_TIMER: + if (!dtm_set_timer(vendor_option)) + { + return DTM_ERROR_ILLEGAL_CONFIGURATION; + } + break; + } + // Event code is unchanged, successful + return DTM_SUCCESS; +} + + +uint32_t dtm_init(void) +{ + if ((timer_init() != DTM_SUCCESS) || (radio_init() != DTM_SUCCESS)) + { + return DTM_ERROR_ILLEGAL_CONFIGURATION; + } + m_new_event = false; + m_state = STATE_IDLE; + + // Enable wake-up on event + SCB->SCR |= SCB_SCR_SEVONPEND_Msk; + + return DTM_SUCCESS; +} + + +uint32_t dtm_wait(void) +{ + // Enable wake-up on event + SCB->SCR |= SCB_SCR_SEVONPEND_Msk; + + for (;;) + { + // Event may be the reception of a packet - + // handle radio first, to give it highest priority: + if (NRF_RADIO->EVENTS_END != 0) + { + NRF_RADIO->EVENTS_END = 0; + NVIC_ClearPendingIRQ(RADIO_IRQn); + + if (m_state == STATE_RECEIVER_TEST) + { + NRF_RADIO->TASKS_RXEN = 1; + if ((NRF_RADIO->CRCSTATUS == 1) && check_pdu()) + { + // Count the number of successfully received packets + m_rx_pkt_count++; + } + // Note that failing packets are simply ignored (CRC or contents error). + + // Zero fill all pdu fields to avoid stray data + memset(&m_pdu, 0, DTM_PDU_MAX_MEMORY_SIZE); + } + // If no RECEIVER_TEST is running, ignore incoming packets (but do clear IRQ!) + } + + // Check for timeouts: + if (mp_timer->EVENTS_COMPARE[0] != 0) + { + mp_timer->EVENTS_COMPARE[0] = 0; + } + else if (mp_timer->EVENTS_COMPARE[1] != 0) + { + // Reset timeout event flag for next iteration. + mp_timer->EVENTS_COMPARE[1] = 0; + NVIC_ClearPendingIRQ(m_timer_irq); + return ++m_current_time; + } + + // Other events: No processing + } +} + + +uint32_t dtm_cmd(dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t payload) +{ + // Save specified packet in static variable for tx/rx functions to use. + // Note that BLE conformance testers always use full length packets. + m_packet_length = ((uint8_t)length & 0xFF); + m_packet_type = payload; + m_phys_ch = freq; + + // Clean out any non-retrieved event that might linger from an earlier test + m_new_event = true; + + // Set default event; any error will set it to LE_TEST_STATUS_EVENT_ERROR + m_event = LE_TEST_STATUS_EVENT_SUCCESS; + + if (m_state == STATE_UNINITIALIZED) + { + // Application has not explicitly initialized DTM, + return DTM_ERROR_UNINITIALIZED; + } + + if (cmd == LE_RESET) + { + // Note that timer will continue running after a reset + dtm_test_done(); + return DTM_SUCCESS; + } + + if (cmd == LE_TEST_END) + { + if (m_state == STATE_IDLE) + { + // Sequencing error - only rx or tx test may be ended! + m_event = LE_TEST_STATUS_EVENT_ERROR; + return DTM_ERROR_INVALID_STATE; + } + m_event = LE_PACKET_REPORTING_EVENT | m_rx_pkt_count; + dtm_test_done(); + return DTM_SUCCESS; + } + + if (m_state != STATE_IDLE) + { + // Sequencing error - only TEST_END/RESET are legal while test is running + // Note: State is unchanged; ongoing test not affected + m_event = LE_TEST_STATUS_EVENT_ERROR; + return DTM_ERROR_INVALID_STATE; + } + + if (m_phys_ch > PHYS_CH_MAX) + { + // Parameter error + // Note: State is unchanged; ongoing test not affected + m_event = LE_TEST_STATUS_EVENT_ERROR; + return DTM_ERROR_ILLEGAL_CHANNEL; + } + + m_rx_pkt_count = 0; + + if (cmd == LE_RECEIVER_TEST) + { + // Zero fill all pdu fields to avoid stray data from earlier test run + memset(&m_pdu, 0, DTM_PDU_MAX_MEMORY_SIZE); + radio_prepare(RX_MODE); // Reinitialize "everything"; RF interrupts OFF + m_state = STATE_RECEIVER_TEST; + return DTM_SUCCESS; + } + + if (cmd == LE_TRANSMITTER_TEST) + { + if (m_packet_length > DTM_PAYLOAD_MAX_SIZE) + { + // Parameter error + m_event = LE_TEST_STATUS_EVENT_ERROR; + return DTM_ERROR_ILLEGAL_LENGTH; + } + + // Note that PDU uses 4 bits even though BLE DTM uses only 2 (the HCI SDU uses all 4) + m_pdu.content[DTM_HEADER_OFFSET] = ((uint8_t)m_packet_type & 0x0F); + m_pdu.content[DTM_LENGTH_OFFSET] = m_packet_length; + + switch (m_packet_type) + { + case DTM_PKT_PRBS9: + // Non-repeated, must copy entire pattern to PDU + memcpy(m_pdu.content + DTM_HEADER_SIZE, m_prbs_content, length); + break; + + case DTM_PKT_0X0F: + // Bit pattern 00001111 repeated + memset(m_pdu.content + DTM_HEADER_SIZE, RFPHY_TEST_0X0F_REF_PATTERN, length); + break; + + case DTM_PKT_0X55: + // Bit pattern 01010101 repeated + memset(m_pdu.content + DTM_HEADER_SIZE, RFPHY_TEST_0X55_REF_PATTERN, length); + break; + + case DTM_PKT_VENDORSPECIFIC: + // The length field is for indicating the vendor specific command to execute. + // The frequency field is used for vendor specific options to the command. + return dtm_vendor_specific_pkt(length, freq); + + default: + // Parameter error + m_event = LE_TEST_STATUS_EVENT_ERROR; + return DTM_ERROR_ILLEGAL_CONFIGURATION; + } + + // Initialize CRC value, set channel: + radio_prepare(TX_MODE); + // Configure PPI so that timer will activate radio every 625 us + NRF_PPI->CH[0].EEP = (uint32_t)&mp_timer->EVENTS_COMPARE[0]; + NRF_PPI->CH[0].TEP = (uint32_t)&NRF_RADIO->TASKS_TXEN; + NRF_PPI->CHENSET = 0x01; + m_state = STATE_TRANSMITTER_TEST; + } + return DTM_SUCCESS; +} + + +bool dtm_event_get(dtm_event_t *p_dtm_event) +{ + bool was_new = m_new_event; + // mark the current event as retrieved + m_new_event = false; + *p_dtm_event = m_event; + // return value indicates whether this value was already retrieved. + return was_new; +} + + +// ================================================================================================= +// Configuration functions (only for parameters not definitely determined by the BLE DTM standard). +// These functions return true if successful, false if value could not be set + + +/**@brief Function for configuring the output power for transmitter test. + This function may be called directly, or through dtm_cmd() specifying + DTM_PKT_VENDORSPECIFIC as payload, SET_TX_POWER as length, and the dBm value as frequency. + */ +bool dtm_set_txpower(uint32_t new_tx_power) +{ + // radio->TXPOWER register is 32 bits, low octet a signed value, upper 24 bits zeroed + int8_t new_power8 = (int8_t)(new_tx_power & 0xFF); + + if (m_state > STATE_IDLE) + { + // radio must be idle to change the tx power + return false; + } + + if ((new_power8 > 4) || (new_power8 < -40)) + { + // Parameter outside valid range: nRF radio is restricted to the range -40 dBm to +4 dBm + return false; + } + + if (new_tx_power & 0x03) + { + // Parameter error: The nRF51 radio requires settings that are a multiple of 4. + return false; + } + m_tx_power = new_tx_power; + + return true; +} + + +/**@brief Function for selecting a timer resource. + * This function may be called directly, or through dtm_cmd() specifying + * DTM_PKT_VENDORSPECIFIC as payload, SELECT_TIMER as length, and the timer as freq + * + * @param[in] new_timer Timer id for the timer to use: 0, 1, or 2. + * + * @return true if the timer was successfully changed, false otherwise. + */ +bool dtm_set_timer(uint32_t new_timer) +{ + if (m_state > STATE_IDLE) + { + return false; + } + if (new_timer == 0) + { + mp_timer = NRF_TIMER0; + m_timer_irq = TIMER0_IRQn; + } + else if (new_timer == 1) + { + mp_timer = NRF_TIMER1; + m_timer_irq = TIMER1_IRQn; + } + else if (new_timer == 2) + { + mp_timer = NRF_TIMER2; + m_timer_irq = TIMER2_IRQn; + } + else + { + // Parameter error: Only TIMER 0, 1, 2 provided by nRF51 + return false; + } + // New timer has been selected: + return true; +} + +/// @} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.h new file mode 100644 index 0000000000..6831a85728 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.h @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_sdk_dtmlib_dtm DTM - Direct Test Mode + * @{ + * @ingroup ble_sdk_lib + * @brief Module for testing RF/PHY using DTM commands. + */ + +#ifndef BLE_DTM_H__ +#define BLE_DTM_H__ + +#include +#include + + +/**@brief Configuration parameters. */ +#define DEFAULT_TX_POWER RADIO_TXPOWER_TXPOWER_0dBm /**< Default Transmission power using in the DTM module. */ +#define DEFAULT_TIMER NRF_TIMER0 /**< Default timer used for timing. */ +#define DEFAULT_TIMER_IRQn TIMER0_IRQn /**< IRQ used for timer. NOTE: MUST correspond to DEFAULT_TIMER. */ + +/**@brief BLE DTM command codes. */ +typedef uint32_t dtm_cmd_t; /**< DTM command type. */ + +#define LE_RESET 0 /**< DTM command: Reset device. */ +#define LE_RECEIVER_TEST 1 /**< DTM command: Start receive test. */ +#define LE_TRANSMITTER_TEST 2 /**< DTM command: Start transmission test. */ +#define LE_TEST_END 3 /**< DTM command: End test and send packet report. */ + +// Configuration options used as parameter 2 +// when cmd == LE_TRANSMITTER_TEST and payload == DTM_PKT_VENDORSPECIFIC +// Configuration value, if any, is supplied in parameter 3 + +#define CARRIER_TEST 0 /**< Length=0 indicates a constant, unmodulated carrier until LE_TEST_END or LE_RESET */ +#define CARRIER_TEST_STUDIO 1 /**< nRFgo Studio uses value 1 in length field, to indicate a constant, unmodulated carrier until LE_TEST_END or LE_RESET */ +#define SET_TX_POWER 2 /**< Set transmission power, value -40..+4 dBm in steps of 4 */ +#define SELECT_TIMER 3 /**< Select on of the 16 MHz timers 0, 1 or 2 */ + +#define LE_PACKET_REPORTING_EVENT 0x8000 /**< DTM Packet reporting event, returned by the device to the tester. */ +#define LE_TEST_STATUS_EVENT_SUCCESS 0x0000 /**< DTM Status event, indicating success. */ +#define LE_TEST_STATUS_EVENT_ERROR 0x0001 /**< DTM Status event, indicating an error. */ + +#define DTM_PKT_PRBS9 0x00 /**< Bit pattern PRBS9. */ +#define DTM_PKT_0X0F 0x01 /**< Bit pattern 11110000 (LSB is the leftmost bit). */ +#define DTM_PKT_0X55 0x02 /**< Bit pattern 10101010 (LSB is the leftmost bit). */ +#define DTM_PKT_VENDORSPECIFIC 0xFFFFFFFF /**< Vendor specific. Nordic: Continuous carrier test, or configuration. */ + +/**@brief Return codes from dtm_cmd(). */ +#define DTM_SUCCESS 0x00 /**< Indicate that the DTM function completed with success. */ +#define DTM_ERROR_ILLEGAL_CHANNEL 0x01 /**< Physical channel number must be in the range 0..39. */ +#define DTM_ERROR_INVALID_STATE 0x02 /**< Sequencing error: Command is not valid now. */ +#define DTM_ERROR_ILLEGAL_LENGTH 0x03 /**< Payload size must be in the range 0..37. */ +#define DTM_ERROR_ILLEGAL_CONFIGURATION 0x04 /**< Parameter out of range (legal range is function dependent). */ +#define DTM_ERROR_UNINITIALIZED 0x05 /**< DTM module has not been initialized by the application. */ + +// Note: DTM_PKT_VENDORSPECIFIC, is not a packet type +#define PACKET_TYPE_MAX DTM_PKT_0X55 /**< Highest value allowed as DTM Packet type. */ + +/** @brief BLE DTM event type. */ +typedef uint32_t dtm_event_t; /**< Type for handling DTM event. */ + +/** @brief BLE DTM frequency type. */ +typedef uint32_t dtm_freq_t; /**< Physical channel, valid range: 0..39. */ + +/**@brief BLE DTM packet types. */ +typedef uint32_t dtm_pkt_type_t; /**< Type for holding the requested DTM payload type.*/ + + +/**@brief Function for initializing or re-initializing DTM module + * + * @return DTM_SUCCESS on successful initialization of the DTM module. +*/ +uint32_t dtm_init(void); + + +/**@brief Function for giving control to dtmlib for handling timer and radio events. + * Will return to caller at 625us intervals or whenever another event than radio occurs + * (such as UART input). Function will put MCU to sleep between events. + * + * @return Time counter, incremented every 625 us. + */ +uint32_t dtm_wait(void); + + +/**@brief Function for calling when a complete command has been prepared by the Tester. + * + * @param[in] cmd One of the DTM_CMD values (bits 14:15 in the 16-bit UART format). + * @param[in] freq Phys. channel no - actual frequency = (2402 + freq * 2) MHz (bits 8:13 in + * the 16-bit UART format). + * @param[in] length Payload length, 0..37 (bits 2:7 in the 16-bit UART format). + * @param[in] payload One of the DTM_PKT values (bits 0:1 in the 16-bit UART format). + * + * @return DTM_SUCCESS or one of the DTM_ERROR_ values + */ +uint32_t dtm_cmd(dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t payload); + + +/**@brief Function for reading the result of a DTM command + * + * @param[out] p_dtm_event Pointer to buffer for 16 bit event code according to DTM standard. + * + * @return true: new event, false: no event since last call, this event has been read earlier + */ +bool dtm_event_get(dtm_event_t * p_dtm_event); + + +/**@brief Function for configuring the timer to use. + * + * @note Must be called when no DTM test is running. + * + * @param[in] new_timer Index (0..2) of timer to be used by the DTM library + * + * @return true: success, new timer was selected, false: parameter error + */ +bool dtm_set_timer(uint32_t new_timer); + + +/**@brief Function for configuring the transmit power. + * + * @note Must be called when no DTM test is running. + * + * @param[in] new_tx_power New output level, +4..-40, in steps of 4. + * + * @return true: tx power setting changed, false: parameter error + */ +bool dtm_set_txpower(uint32_t new_tx_power); + +#endif // BLE_DTM_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_error_log/ble_error_log.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_error_log/ble_error_log.h new file mode 100644 index 0000000000..ab121c2b3c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_error_log/ble_error_log.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_error_log_module Error Log Module + * @{ + * @ingroup ble_sdk_lib + * @brief Module for writing error and stack to flash memory. + * + * @details It contains functions for writing an error code, line number, filename/message and + * the stack to the flash during an error, e.g. in the assert handler. + * + */ +#ifndef BLE_ERROR_LOG_H__ +#define BLE_ERROR_LOG_H__ + +#include +#include +#include "ble_flash.h" + +#define ERROR_MESSAGE_LENGTH 128 /**< Length of error message to stored. */ +#define STACK_DUMP_LENGTH 256 /**< Length of stack to be stored at max: 64 entries of 4 bytes each. */ +#define FLASH_PAGE_ERROR_LOG (BLE_FLASH_PAGE_END - 2) /**< Address in flash where stack trace can be stored. */ + +/**@brief Error Log Data structure. + * + * @details The structure contains the error, message/filename, line number as well as the current + * stack, at the time where an error occured. + */ +typedef struct +{ + uint16_t failure; /**< Indication that a major failure has occurred during last execution of the application. */ + uint16_t line_number; /**< Line number indicating at which line the failure occurred. */ + uint32_t err_code; /**< Error code when failure occurred. */ + uint8_t message[ERROR_MESSAGE_LENGTH]; /**< Will just use the first 128 bytes of filename to store for debugging purposes. */ + uint32_t stack_info[STACK_DUMP_LENGTH / 4]; /**< Will contain stack information, can be manually unwinded for debug purposes. */ +} ble_error_log_data_t; + + +/**@brief Function for writing the file name/message, line number, and current program stack + * to flash. + * + * @note This function will force the writing to flash, and disregard any radio communication. + * USE THIS FUNCTION WITH CARE. + * + * @param[in] err_code Error code to be logged. + * @param[in] p_message Message to be written to the flash together with stack dump, usually + * the file name where the error occured. + * @param[in] line_number Line number where the error occured. + * + * @return NRF_SUCCESS on successful writing of the error log. + * + */ +uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number); + + +#endif /* BLE_ERROR_LOG_H__ */ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.c new file mode 100644 index 0000000000..5229f7ca24 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.c @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_racp.h" +#include + + +void ble_racp_decode(uint8_t data_len, uint8_t * p_data, ble_racp_value_t * p_racp_val) +{ + p_racp_val->opcode = 0xFF; + p_racp_val->operator = 0xFF; + p_racp_val->operand_len = 0; + p_racp_val->p_operand = NULL; + + if (data_len > 0) + { + p_racp_val->opcode = p_data[0]; + } + if (data_len > 1) + { + p_racp_val->operator = p_data[1]; //lint !e415 + } + if (data_len > 2) + { + p_racp_val->operand_len = data_len - 2; + p_racp_val->p_operand = &p_data[2]; //lint !e416 + } +} + + +uint8_t ble_racp_encode(const ble_racp_value_t * p_racp_val, uint8_t * p_data) +{ + uint8_t len = 0; + int i; + + if (p_data != NULL) + { + p_data[len++] = p_racp_val->opcode; + p_data[len++] = p_racp_val->operator; + + for (i = 0; i < p_racp_val->operand_len; i++) + { + p_data[len++] = p_racp_val->p_operand[i]; + } + } + + return len; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h new file mode 100644 index 0000000000..baf11760f1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_sdk_lib_racp Record Access Control Point + * @{ + * @ingroup ble_sdk_lib + * @brief Record Access Control Point library. + */ + +#ifndef BLE_RACP_H__ +#define BLE_RACP_H__ + +#include +#include +#include "nrf_ble.h" +#include "nrf_ble_types.h" +#include "nrf_ble.h" + +/**@brief Record Access Control Point opcodes. */ +#define RACP_OPCODE_RESERVED 0 /**< Record Access Control Point opcode - Reserved for future use. */ +#define RACP_OPCODE_REPORT_RECS 1 /**< Record Access Control Point opcode - Report stored records. */ +#define RACP_OPCODE_DELETE_RECS 2 /**< Record Access Control Point opcode - Delete stored records. */ +#define RACP_OPCODE_ABORT_OPERATION 3 /**< Record Access Control Point opcode - Abort operation. */ +#define RACP_OPCODE_REPORT_NUM_RECS 4 /**< Record Access Control Point opcode - Report number of stored records. */ +#define RACP_OPCODE_NUM_RECS_RESPONSE 5 /**< Record Access Control Point opcode - Number of stored records response. */ +#define RACP_OPCODE_RESPONSE_CODE 6 /**< Record Access Control Point opcode - Response code. */ + +/**@brief Record Access Control Point operators. */ +#define RACP_OPERATOR_NULL 0 /**< Record Access Control Point operator - Null. */ +#define RACP_OPERATOR_ALL 1 /**< Record Access Control Point operator - All records. */ +#define RACP_OPERATOR_LESS_OR_EQUAL 2 /**< Record Access Control Point operator - Less than or equal to. */ +#define RACP_OPERATOR_GREATER_OR_EQUAL 3 /**< Record Access Control Point operator - Greater than or equal to. */ +#define RACP_OPERATOR_RANGE 4 /**< Record Access Control Point operator - Within range of (inclusive). */ +#define RACP_OPERATOR_FIRST 5 /**< Record Access Control Point operator - First record (i.e. oldest record). */ +#define RACP_OPERATOR_LAST 6 /**< Record Access Control Point operator - Last record (i.e. most recent record). */ +#define RACP_OPERATOR_RFU_START 7 /**< Record Access Control Point operator - Start of Reserved for Future Use area. */ + +/**@brief Record Access Control Point response codes. */ +#define RACP_RESPONSE_RESERVED 0 /**< Record Access Control Point response code - Reserved for future use. */ +#define RACP_RESPONSE_SUCCESS 1 /**< Record Access Control Point response code - Successful operation. */ +#define RACP_RESPONSE_OPCODE_UNSUPPORTED 2 /**< Record Access Control Point response code - Unsupported op code received. */ +#define RACP_RESPONSE_INVALID_OPERATOR 3 /**< Record Access Control Point response code - Operator not valid for service. */ +#define RACP_RESPONSE_OPERATOR_UNSUPPORTED 4 /**< Record Access Control Point response code - Unsupported operator. */ +#define RACP_RESPONSE_INVALID_OPERAND 5 /**< Record Access Control Point response code - Operand not valid for service. */ +#define RACP_RESPONSE_NO_RECORDS_FOUND 6 /**< Record Access Control Point response code - No matching records found. */ +#define RACP_RESPONSE_ABORT_FAILED 7 /**< Record Access Control Point response code - Abort could not be completed. */ +#define RACP_RESPONSE_PROCEDURE_NOT_DONE 8 /**< Record Access Control Point response code - Procedure could not be completed. */ +#define RACP_RESPONSE_OPERAND_UNSUPPORTED 9 /**< Record Access Control Point response code - Unsupported operand. */ + +/**@brief Record Access Control Point value structure. */ +typedef struct +{ + uint8_t opcode; /**< Op Code. */ + uint8_t operator; /**< Operator. */ + uint8_t operand_len; /**< Length of the operand. */ + uint8_t * p_operand; /**< Pointer to the operand. */ +} ble_racp_value_t; + +/**@brief Function for decoding a Record Access Control Point write. + * + * @details This call decodes a write to the Record Access Control Point. + * + * @param[in] data_len Length of data in received write. + * @param[in] p_data Pointer to received data. + * @param[out] p_racp_val Pointer to decoded Record Access Control Point write. + * @note This does not do a data copy. It assumes the data pointed to by + * p_data is persistant until no longer needed. + */ +void ble_racp_decode(uint8_t data_len, uint8_t * p_data, ble_racp_value_t * p_racp_val); + +/**@brief Function for encoding a Record Access Control Point response. + * + * @details This call encodes a response from the Record Access Control Point response. + * + * @param[in] p_racp_val Pointer to Record Access Control Point to encode. + * @param[out] p_data Pointer to where encoded data is written. + * NOTE! It is calling routines respsonsibility to make sure. + * + * @return Length of encoded data. + */ +uint8_t ble_racp_encode(const ble_racp_value_t * p_racp_val, uint8_t * p_data); + +#endif // BLE_RACP_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c new file mode 100644 index 0000000000..b460733871 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_radio_notification.h" +#include +#include "nrf_nvic.h" + + +static bool m_radio_active = false; /**< Current radio state. */ +static ble_radio_notification_evt_handler_t m_evt_handler = NULL; /**< Application event handler for handling Radio Notification events. */ + + +void SWI1_IRQHandler(void) +{ + m_radio_active = !m_radio_active; + if (m_evt_handler != NULL) + { + m_evt_handler(m_radio_active); + } +} + + +uint32_t ble_radio_notification_init(uint32_t irq_priority, + uint8_t distance, + ble_radio_notification_evt_handler_t evt_handler) +{ + uint32_t err_code; + + m_evt_handler = evt_handler; + + // Initialize Radio Notification software interrupt + err_code = sd_nvic_ClearPendingIRQ(SWI1_IRQn); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_nvic_SetPriority(SWI1_IRQn, irq_priority); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_nvic_EnableIRQ(SWI1_IRQn); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Configure the event + return sd_radio_notification_cfg_set(NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH, distance); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.h new file mode 100644 index 0000000000..02e5b25bf0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_radio_notification Radio Notification Event Handler + * @{ + * @ingroup ble_sdk_lib + * @brief Module for propagating Radio Notification events to the application. + */ + +#ifndef BLE_RADIO_NOTIFICATION_H__ +#define BLE_RADIO_NOTIFICATION_H__ + +#include +#include +#include "nrf_soc.h" + + +/**@brief Application radio notification event handler type. */ +typedef void (*ble_radio_notification_evt_handler_t) (bool radio_active); + +/**@brief Function for initializing the Radio Notification module. + * + * @param[in] irq_priority Interrupt priority for the Radio Notification interrupt handler. + * @param[in] distance The time from an Active event until the radio is activated. + * @param[in] evt_handler Handler to be executed when a radio notification event has been + * received. + * + * @return NRF_SUCCESS on successful initialization, otherwise an error code. + */ +uint32_t ble_radio_notification_init(uint32_t irq_priority, + uint8_t distance, + ble_radio_notification_evt_handler_t evt_handler); + +#endif // BLE_RADIO_NOTIFICATION_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c new file mode 100644 index 0000000000..333533af54 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c @@ -0,0 +1,676 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_dfu.h" +#include "nrf_ble_types.h" +#include "nrf_ble_gatts.h" +#include "ble_srv_common.h" +#include +#include "sdk_common.h" + +#define MAX_DFU_PKT_LEN 20 /**< Maximum length (in bytes) of the DFU Packet characteristic. */ +#define PKT_START_DFU_PARAM_LEN 2 /**< Length (in bytes) of the parameters for Packet Start DFU Request. */ +#define PKT_INIT_DFU_PARAM_LEN 2 /**< Length (in bytes) of the parameters for Packet Init DFU Request. */ +#define PKT_RCPT_NOTIF_REQ_LEN 3 /**< Length (in bytes) of the Packet Receipt Notification Request. */ +#define MAX_PKTS_RCPT_NOTIF_LEN 6 /**< Maximum length (in bytes) of the Packets Receipt Notification. */ +#define MAX_RESPONSE_LEN 7 /**< Maximum length (in bytes) of the response to a Control Point command. */ +#define MAX_NOTIF_BUFFER_LEN MAX(MAX_PKTS_RCPT_NOTIF_LEN, MAX_RESPONSE_LEN) /**< Maximum length (in bytes) of the buffer needed by DFU Service while sending notifications to peer. */ + +enum +{ + OP_CODE_START_DFU = 1, /**< Value of the Op code field for 'Start DFU' command.*/ + OP_CODE_RECEIVE_INIT = 2, /**< Value of the Op code field for 'Initialize DFU parameters' command.*/ + OP_CODE_RECEIVE_FW = 3, /**< Value of the Op code field for 'Receive firmware image' command.*/ + OP_CODE_VALIDATE = 4, /**< Value of the Op code field for 'Validate firmware' command.*/ + OP_CODE_ACTIVATE_N_RESET = 5, /**< Value of the Op code field for 'Activate & Reset' command.*/ + OP_CODE_SYS_RESET = 6, /**< Value of the Op code field for 'Reset System' command.*/ + OP_CODE_IMAGE_SIZE_REQ = 7, /**< Value of the Op code field for 'Report received image size' command.*/ + OP_CODE_PKT_RCPT_NOTIF_REQ = 8, /**< Value of the Op code field for 'Request packet receipt notification.*/ + OP_CODE_RESPONSE = 16, /**< Value of the Op code field for 'Response.*/ + OP_CODE_PKT_RCPT_NOTIF = 17 /**< Value of the Op code field for 'Packets Receipt Notification'.*/ +}; + +static bool m_is_dfu_service_initialized = false; /**< Variable to check if the DFU service was initialized by the application.*/ +static uint8_t m_notif_buffer[MAX_NOTIF_BUFFER_LEN]; /**< Buffer used for sending notifications to peer. */ + +/**@brief Function for adding DFU Packet characteristic to the BLE Stack. + * + * @param[in] p_dfu DFU Service structure. + * + * @return NRF_SUCCESS on success. Otherwise an error code. + */ +static uint32_t dfu_pkt_char_add(ble_dfu_t * const p_dfu) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t attr_md; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.write_wo_resp = 1; + char_md.p_char_user_desc = NULL; + char_md.p_char_pf = NULL; + char_md.p_user_desc_md = NULL; + char_md.p_cccd_md = NULL; + char_md.p_sccd_md = NULL; + + char_uuid.type = p_dfu->uuid_type; + char_uuid.uuid = BLE_DFU_PKT_CHAR_UUID; + + memset(&attr_md, 0, sizeof(attr_md)); + + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 1; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = 0; + attr_char_value.init_offs = 0; + attr_char_value.max_len = MAX_DFU_PKT_LEN; + attr_char_value.p_value = NULL; + + return sd_ble_gatts_characteristic_add(p_dfu->service_handle, + &char_md, + &attr_char_value, + &p_dfu->dfu_pkt_handles); +} + + +/**@brief Function for adding DFU Revision characteristic to the BLE Stack. + * + * @param[in] p_dfu DFU Service structure. + * + * @return NRF_SUCCESS on success. Otherwise an error code. + */ +static uint32_t dfu_rev_char_add(ble_dfu_t * const p_dfu, ble_dfu_init_t const * const p_dfu_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t attr_md; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.read = 1; + char_md.p_char_user_desc = NULL; + char_md.p_char_pf = NULL; + char_md.p_user_desc_md = NULL; + char_md.p_cccd_md = NULL; + char_md.p_sccd_md = NULL; + + char_uuid.type = p_dfu->uuid_type; + char_uuid.uuid = BLE_DFU_REV_CHAR_UUID; + + memset(&attr_md, 0, sizeof(attr_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 1; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof(uint16_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof(uint16_t); + attr_char_value.p_value = (uint8_t *)&p_dfu_init->revision; + + return sd_ble_gatts_characteristic_add(p_dfu->service_handle, + &char_md, + &attr_char_value, + &p_dfu->dfu_rev_handles); +} + + +/**@brief Function for adding DFU Control Point characteristic to the BLE Stack. + * + * @param[in] p_dfu DFU Service structure. + * + * @return NRF_SUCCESS on success. Otherwise an error code. + */ +static uint32_t dfu_ctrl_pt_add(ble_dfu_t * const p_dfu) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t attr_md; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.write = 1; + char_md.char_props.notify = 1; + char_md.p_char_user_desc = NULL; + char_md.p_char_pf = NULL; + char_md.p_user_desc_md = NULL; + char_md.p_cccd_md = NULL; + char_md.p_sccd_md = NULL; + + char_uuid.type = p_dfu->uuid_type; + char_uuid.uuid = BLE_DFU_CTRL_PT_UUID; + + memset(&attr_md, 0, sizeof(attr_md)); + + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 1; + attr_md.vlen = 1; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = 0; + attr_char_value.init_offs = 0; + attr_char_value.max_len = BLE_L2CAP_MTU_DEF; + attr_char_value.p_value = NULL; + + return sd_ble_gatts_characteristic_add(p_dfu->service_handle, + &char_md, + &attr_char_value, + &p_dfu->dfu_ctrl_pt_handles); +} + + +/**@brief Function for handling the @ref BLE_GAP_EVT_CONNECTED event from the S110 SoftDevice. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_connect(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) +{ + p_dfu->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + + +/**@brief Function for checking if the CCCD of DFU Control point is configured for Notification. + * + * @details This function checks if the CCCD of DFU Control Point characteristic is configured + * for Notification by the DFU Controller. + * + * @param[in] p_dfu DFU Service structure. + * + * @return True if the CCCD of DFU Control Point characteristic is configured for Notification. + * False otherwise. + */ +static bool is_cccd_configured(ble_dfu_t * p_dfu) +{ + // Check if the CCCDs are configured. + uint8_t cccd_val_buf[BLE_CCCD_VALUE_LEN]; + ble_gatts_value_t gatts_value; + + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = BLE_CCCD_VALUE_LEN; + gatts_value.offset = 0; + gatts_value.p_value = cccd_val_buf; + + // Check the CCCD Value of DFU Control Point. + uint32_t err_code = sd_ble_gatts_value_get(p_dfu->conn_handle, + p_dfu->dfu_ctrl_pt_handles.cccd_handle, + &gatts_value); + if (err_code != NRF_SUCCESS) + { + if (p_dfu->error_handler != NULL) + { + p_dfu->error_handler(err_code); + } + return false; + } + + return ble_srv_is_notification_enabled(cccd_val_buf); +} + + +/**@brief Function for handling a Write event on the Control Point characteristic. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_ble_write_evt Pointer to the write event received from BLE stack. + * + * @return NRF_SUCCESS on successful processing of control point write. Otherwise an error code. + */ +static uint32_t on_ctrl_pt_write(ble_dfu_t * p_dfu, ble_gatts_evt_write_t * p_ble_write_evt) +{ + ble_gatts_rw_authorize_reply_params_t auth_reply; + + auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + auth_reply.params.write.update = 1; + auth_reply.params.write.offset = p_ble_write_evt->offset; + auth_reply.params.write.len = p_ble_write_evt->len; + auth_reply.params.write.p_data = p_ble_write_evt->data; + + + if (!is_cccd_configured(p_dfu)) + { + // Send an error response to the peer indicating that the CCCD is improperly configured. + auth_reply.params.write.gatt_status = + BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR; + + return (sd_ble_gatts_rw_authorize_reply(p_dfu->conn_handle, &auth_reply)); + + } + else + { + uint32_t err_code; + + auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + + err_code = (sd_ble_gatts_rw_authorize_reply(p_dfu->conn_handle, &auth_reply)); + VERIFY_SUCCESS(err_code); + } + + ble_dfu_evt_t ble_dfu_evt; + + switch (p_ble_write_evt->data[0]) + { + case OP_CODE_START_DFU: + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_START; + + if (p_ble_write_evt->len < PKT_START_DFU_PARAM_LEN) + { + return ble_dfu_response_send(p_dfu, + (ble_dfu_procedure_t) p_ble_write_evt->data[0], + BLE_DFU_RESP_VAL_OPER_FAILED); + } + + ble_dfu_evt.evt.ble_dfu_pkt_write.len = 1; + ble_dfu_evt.evt.ble_dfu_pkt_write.p_data = &(p_ble_write_evt->data[1]); + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + break; + + case OP_CODE_RECEIVE_INIT: + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_RECEIVE_INIT_DATA; + + if (p_ble_write_evt->len < PKT_INIT_DFU_PARAM_LEN) + { + return ble_dfu_response_send(p_dfu, + (ble_dfu_procedure_t) p_ble_write_evt->data[0], + BLE_DFU_RESP_VAL_OPER_FAILED); + } + + ble_dfu_evt.evt.ble_dfu_pkt_write.len = 1; + ble_dfu_evt.evt.ble_dfu_pkt_write.p_data = &(p_ble_write_evt->data[1]); + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + break; + + case OP_CODE_RECEIVE_FW: + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_RECEIVE_APP_DATA; + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + break; + + case OP_CODE_VALIDATE: + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_VALIDATE; + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + break; + + case OP_CODE_ACTIVATE_N_RESET: + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_ACTIVATE_N_RESET; + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + break; + + case OP_CODE_SYS_RESET: + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_SYS_RESET; + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + break; + + case OP_CODE_PKT_RCPT_NOTIF_REQ: + if (p_ble_write_evt->len < PKT_RCPT_NOTIF_REQ_LEN) + { + return (ble_dfu_response_send(p_dfu, + BLE_DFU_PKT_RCPT_REQ_PROCEDURE, + BLE_DFU_RESP_VAL_NOT_SUPPORTED)); + } + + ble_dfu_evt.evt.pkt_rcpt_notif_req.num_of_pkts = + uint16_decode(&(p_ble_write_evt->data[1])); + + if (ble_dfu_evt.evt.pkt_rcpt_notif_req.num_of_pkts == 0) + { + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_PKT_RCPT_NOTIF_DISABLED; + } + else + { + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_PKT_RCPT_NOTIF_ENABLED; + } + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + + break; + + case OP_CODE_IMAGE_SIZE_REQ: + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_BYTES_RECEIVED_SEND; + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + break; + + default: + // Unsupported op code. + return ble_dfu_response_send(p_dfu, + (ble_dfu_procedure_t) p_ble_write_evt->data[0], + BLE_DFU_RESP_VAL_NOT_SUPPORTED); + } + return NRF_SUCCESS; +} + + +/**@brief Function for handling the @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event from the S110 + * Stack. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_rw_authorize_request_t * p_authorize_request; + + p_authorize_request = &(p_ble_evt->evt.gatts_evt.params.authorize_request); + + if ( + (p_authorize_request->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + && + (p_authorize_request->request.write.handle == p_dfu->dfu_ctrl_pt_handles.value_handle) + && + (p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ) + && + (p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) + && + (p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) + ) + { + uint32_t err_code; + + err_code = on_ctrl_pt_write(p_dfu, &(p_authorize_request->request.write)); + + if (err_code != NRF_SUCCESS && p_dfu->error_handler != NULL) + { + p_dfu->error_handler(err_code); + } + } +} + + +/**@brief Function for handling the @ref BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_write(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) +{ + if (p_ble_evt->evt.gatts_evt.params.write.handle == p_dfu->dfu_pkt_handles.value_handle) + { + // DFU Packet written + + ble_dfu_evt_t ble_dfu_evt; + + ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_PACKET_WRITE; + ble_dfu_evt.evt.ble_dfu_pkt_write.len = p_ble_evt->evt.gatts_evt.params.write.len; + ble_dfu_evt.evt.ble_dfu_pkt_write.p_data = p_ble_evt->evt.gatts_evt.params.write.data; + + p_dfu->evt_handler(p_dfu, &ble_dfu_evt); + } +} + + +/**@brief Function for handling the BLE_GAP_EVT_DISCONNECTED event from the S110 SoftDevice. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_disconnect(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) +{ + p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +uint32_t ble_dfu_init(ble_dfu_t * p_dfu, ble_dfu_init_t * p_dfu_init) +{ + if ((p_dfu == NULL) || (p_dfu_init == NULL) || (p_dfu_init->evt_handler == NULL)) + { + return NRF_ERROR_NULL; + } + + p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; + + ble_uuid_t service_uuid; + uint32_t err_code; + + const ble_uuid128_t base_uuid128 = + { + { + 0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, + 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00 + } + }; + + service_uuid.uuid = BLE_DFU_SERVICE_UUID; + + err_code = sd_ble_uuid_vs_add(&base_uuid128, &(service_uuid.type)); + VERIFY_SUCCESS(err_code); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &service_uuid, + &(p_dfu->service_handle)); + VERIFY_SUCCESS(err_code); + + p_dfu->uuid_type = service_uuid.type; + + err_code = dfu_pkt_char_add(p_dfu); + VERIFY_SUCCESS(err_code); + + err_code = dfu_ctrl_pt_add(p_dfu); + VERIFY_SUCCESS(err_code); + + err_code = dfu_rev_char_add(p_dfu, p_dfu_init); + VERIFY_SUCCESS(err_code); + + p_dfu->evt_handler = p_dfu_init->evt_handler; + + if (p_dfu_init->error_handler != NULL) + { + p_dfu->error_handler = p_dfu_init->error_handler; + } + + m_is_dfu_service_initialized = true; + + return NRF_SUCCESS; +} + + +void ble_dfu_on_ble_evt(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) +{ + if ((p_dfu == NULL) || (p_ble_evt == NULL)) + { + return; + } + + if (p_dfu->evt_handler != NULL) + { + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_dfu, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_dfu, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_dfu, p_ble_evt); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + on_rw_authorize_req(p_dfu, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } + } +} + + +uint32_t ble_dfu_bytes_rcvd_report(ble_dfu_t * p_dfu, uint32_t num_of_firmware_bytes_rcvd) +{ + if (p_dfu == NULL) + { + return NRF_ERROR_NULL; + } + + if ((p_dfu->conn_handle == BLE_CONN_HANDLE_INVALID) || !m_is_dfu_service_initialized) + { + return NRF_ERROR_INVALID_STATE; + } + + ble_gatts_hvx_params_t hvx_params; + uint16_t index = 0; + + // Encode the Op Code. + m_notif_buffer[index++] = OP_CODE_RESPONSE; + + // Encode the Reqest Op Code. + m_notif_buffer[index++] = OP_CODE_IMAGE_SIZE_REQ; + + // Encode the Response Value. + m_notif_buffer[index++] = (uint8_t)BLE_DFU_RESP_VAL_SUCCESS; + + index += uint32_encode(num_of_firmware_bytes_rcvd, &m_notif_buffer[index]); + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_dfu->dfu_ctrl_pt_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &index; + hvx_params.p_data = m_notif_buffer; + + return sd_ble_gatts_hvx(p_dfu->conn_handle, &hvx_params); +} + + +uint32_t ble_dfu_pkts_rcpt_notify(ble_dfu_t * p_dfu, uint32_t num_of_firmware_bytes_rcvd) +{ + if (p_dfu == NULL) + { + return NRF_ERROR_NULL; + } + + if ((p_dfu->conn_handle == BLE_CONN_HANDLE_INVALID) || !m_is_dfu_service_initialized) + { + return NRF_ERROR_INVALID_STATE; + } + + ble_gatts_hvx_params_t hvx_params; + uint16_t index = 0; + + m_notif_buffer[index++] = OP_CODE_PKT_RCPT_NOTIF; + + index += uint32_encode(num_of_firmware_bytes_rcvd, &m_notif_buffer[index]); + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_dfu->dfu_ctrl_pt_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &index; + hvx_params.p_data = m_notif_buffer; + + return sd_ble_gatts_hvx(p_dfu->conn_handle, &hvx_params); +} + + +uint32_t ble_dfu_response_send(ble_dfu_t * p_dfu, + ble_dfu_procedure_t dfu_proc, + ble_dfu_resp_val_t resp_val) +{ + if (p_dfu == NULL) + { + return NRF_ERROR_NULL; + } + + if ((p_dfu->conn_handle == BLE_CONN_HANDLE_INVALID) || !m_is_dfu_service_initialized) + { + return NRF_ERROR_INVALID_STATE; + } + + ble_gatts_hvx_params_t hvx_params; + uint16_t index = 0; + + m_notif_buffer[index++] = OP_CODE_RESPONSE; + + // Encode the Request Op code + m_notif_buffer[index++] = (uint8_t)dfu_proc; + + // Encode the Response Value. + m_notif_buffer[index++] = (uint8_t)resp_val; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_dfu->dfu_ctrl_pt_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &index; + hvx_params.p_data = m_notif_buffer; + + return sd_ble_gatts_hvx(p_dfu->conn_handle, &hvx_params); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h new file mode 100644 index 0000000000..9ce409ee2f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup ble_sdk_srv_dfu Device Firmware Update Service + * @{ + * @ingroup ble_sdk_srv + * @brief Device Firmware Update Service + * + * @details The Device Firmware Update (DFU) service is a GATT based service that can be used for + * performing firmware updates over BLE. Note that this implementation uses vendor + * specific UUIDs for service and characteristics and is intended to demonstrate the + * firmware updates over BLE. Refer @ref bledfu_transport_bleservice and @ref + * bledfu_transport_bleprofile for more information on the service and profile respectively. + */ + +#ifndef BLE_DFU_H__ +#define BLE_DFU_H__ + +#include +#include "nrf_ble_gatts.h" +#include "nrf_ble_gap.h" +#include "nrf_ble.h" +#include "ble_srv_common.h" + +#define BLE_DFU_SERVICE_UUID 0x1530 /**< The UUID of the DFU Service. */ +#define BLE_DFU_PKT_CHAR_UUID 0x1532 /**< The UUID of the DFU Packet Characteristic. */ +#define BLE_DFU_CTRL_PT_UUID 0x1531 /**< The UUID of the DFU Control Point. */ +#define BLE_DFU_STATUS_REP_UUID 0x1533 /**< The UUID of the DFU Status Report Characteristic. */ +#define BLE_DFU_REV_CHAR_UUID 0x1534 /**< The UUID of the DFU Revision Characteristic. */ + +/**@brief DFU Event type. + * + * @details This enumeration contains the types of events that will be received from the DFU Service. + */ +typedef enum +{ + BLE_DFU_START, /**< The event indicating that the peer wants the application to prepare for a new firmware update. */ + BLE_DFU_RECEIVE_INIT_DATA, /**< The event indicating that the peer wants the application to prepare to receive init parameters. */ + BLE_DFU_RECEIVE_APP_DATA, /**< The event indicating that the peer wants the application to prepare to receive the new firmware image. */ + BLE_DFU_VALIDATE, /**< The event indicating that the peer wants the application to validate the newly received firmware image. */ + BLE_DFU_ACTIVATE_N_RESET, /**< The event indicating that the peer wants the application to undergo activate new firmware and restart with new valid application */ + BLE_DFU_SYS_RESET, /**< The event indicating that the peer wants the application to undergo a reset and start the currently valid application image.*/ + BLE_DFU_PKT_RCPT_NOTIF_ENABLED, /**< The event indicating that the peer has enabled packet receipt notifications. It is the responsibility of the application to call @ref ble_dfu_pkts_rcpt_notify each time the number of packets indicated by num_of_pkts field in @ref ble_dfu_evt_t is received.*/ + BLE_DFU_PKT_RCPT_NOTIF_DISABLED, /**< The event indicating that the peer has disabled the packet receipt notifications.*/ + BLE_DFU_PACKET_WRITE, /**< The event indicating that the peer has written a value to the 'DFU Packet' characteristic. The data received from the peer will be present in the @ref BLE_DFU_PACKET_WRITE element contained within @ref ble_dfu_evt_t.*/ + BLE_DFU_BYTES_RECEIVED_SEND /**< The event indicating that the peer is requesting for the number of bytes of firmware data last received by the application. It is the responsibility of the application to call @ref ble_dfu_pkts_rcpt_notify in response to this event. */ +} ble_dfu_evt_type_t; + +/**@brief DFU Procedure type. + * + * @details This enumeration contains the types of DFU procedures. + */ +typedef enum +{ + BLE_DFU_START_PROCEDURE = 1, /**< DFU Start procedure.*/ + BLE_DFU_INIT_PROCEDURE = 2, /**< DFU Initialization procedure.*/ + BLE_DFU_RECEIVE_APP_PROCEDURE = 3, /**< Firmware receiving procedure.*/ + BLE_DFU_VALIDATE_PROCEDURE = 4, /**< Firmware image validation procedure .*/ + BLE_DFU_PKT_RCPT_REQ_PROCEDURE = 8 /**< Packet receipt notification request procedure. */ +} ble_dfu_procedure_t; + +/**@brief DFU Response value type. + */ +typedef enum +{ + BLE_DFU_RESP_VAL_SUCCESS = 1, /**< Success.*/ + BLE_DFU_RESP_VAL_INVALID_STATE, /**< Invalid state.*/ + BLE_DFU_RESP_VAL_NOT_SUPPORTED, /**< Operation not supported.*/ + BLE_DFU_RESP_VAL_DATA_SIZE, /**< Data size exceeds limit.*/ + BLE_DFU_RESP_VAL_CRC_ERROR, /**< CRC Error.*/ + BLE_DFU_RESP_VAL_OPER_FAILED /**< Operation failed.*/ +} ble_dfu_resp_val_t; + + +/**@brief DFU Packet structure. + * + * @details This structure contains the value of the DFU Packet characteristic as written by the + * peer and the length of the value written. It will be filled by the DFU Service when the + * peer writes to the DFU Packet characteristic. + */ +typedef struct +{ + uint8_t * p_data; /**< Pointer to the received packet. This will point to a word aligned memory location.*/ + uint8_t len; /**< Length of the packet received. */ +} ble_dfu_pkt_write_t; + +/**@brief Packet receipt notification request structure. + * + * @details This structure contains the contents of the packet receipt notification request + * sent by the DFU Controller. + */ +typedef struct +{ + uint16_t num_of_pkts; /**< The number of packets of firmware data to be received by application before sending the next Packet Receipt Notification to the peer. */ +} ble_pkt_rcpt_notif_req_t; + +/**@brief DFU Event structure. + * + * @details This structure contains the event generated by the DFU Service based on the data + * received from the peer. + */ +typedef struct +{ + ble_dfu_evt_type_t ble_dfu_evt_type; /**< Type of the event.*/ + union + { + ble_dfu_pkt_write_t ble_dfu_pkt_write; /**< The DFU packet received. This field is when the @ref ble_dfu_evt_type field is set to @ref BLE_DFU_PACKET_WRITE.*/ + ble_pkt_rcpt_notif_req_t pkt_rcpt_notif_req; /**< Packet receipt notification request. This field is when the @ref ble_dfu_evt_type field is set to @ref BLE_DFU_PKT_RCPT_NOTIF_ENABLED.*/ + } evt; +} ble_dfu_evt_t; + +// Forward declaration of the ble_dfu_t type. +typedef struct ble_dfu_s ble_dfu_t; + +/**@brief DFU Service event handler type. */ +typedef void (*ble_dfu_evt_handler_t) (ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt); + +/**@brief DFU service structure. + * + * @details This structure contains status information related to the service. + */ +struct ble_dfu_s +{ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the SoftDevice). This will be BLE_CONN_HANDLE_INVALID when not in a connection. */ + uint16_t revision; /**< Handle of DFU Service (as provided by the SoftDevice). */ + uint16_t service_handle; /**< Handle of DFU Service (as provided by the SoftDevice). */ + uint8_t uuid_type; /**< UUID type assigned for DFU Service by the SoftDevice. */ + ble_gatts_char_handles_t dfu_pkt_handles; /**< Handles related to the DFU Packet characteristic. */ + ble_gatts_char_handles_t dfu_ctrl_pt_handles; /**< Handles related to the DFU Control Point characteristic. */ + ble_gatts_char_handles_t dfu_status_rep_handles; /**< Handles related to the DFU Status Report characteristic. */ + ble_gatts_char_handles_t dfu_rev_handles; /**< Handles related to the DFU Revision characteristic. */ + ble_dfu_evt_handler_t evt_handler; /**< The event handler to be called when an event is to be sent to the application.*/ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ +}; + +/**@brief DFU service initialization structure. + * + * @details This structure contains the initialization information for the DFU Service. The + * application needs to fill this structure and pass it to the DFU Service using the + * @ref ble_dfu_init function. + */ +typedef struct +{ + uint16_t revision; /**< Revision number to be exposed by the DFU service. */ + ble_dfu_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Device Firmware Update Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ +} ble_dfu_init_t; + +/**@brief Function for handling a BLE event. + * + * @details The DFU service expects the application to call this function each time an event + * is received from the SoftDevice. This function processes the event, if it is + * relevant for the DFU service and calls the DFU event handler of the application if + * necessary. + * + * @param[in] p_dfu Pointer to the DFU service structure. + * @param[in] p_ble_evt Pointer to the event received from SoftDevice. + */ +void ble_dfu_on_ble_evt(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt); + +/**@brief Function for initializing the DFU service. + * + * @param[out] p_dfu Device Firmware Update service structure. This structure will have to be + * supplied by the application. It will be initialized by this function, + * and will later be used to identify the service instance. + * @param[in] p_dfu_init Information needed to initialize the service. + * + * @return NRF_SUCCESS if the DFU service and its characteristics were successfully added to the + * SoftDevice. Otherwise an error code. + * This function returns NRF_ERROR_NULL if the value of evt_handler in p_dfu_init + * structure provided is NULL or if the pointers supplied as input are NULL. + */ +uint32_t ble_dfu_init(ble_dfu_t * p_dfu, ble_dfu_init_t * p_dfu_init); + +/**@brief Function for sending response to a control point command. + * + * @details This function will encode a DFU Control Point response using the given input + * parameters and will send a notification of the same to the peer. + * + * @param[in] p_dfu Pointer to the DFU service structure. + * @param[in] dfu_proc Procedure for which this response is to be sent. + * @param[in] resp_val Response value. + * + * @return NRF_SUCCESS if the DFU Service has successfully requested the SoftDevice to + * send the notification. Otherwise an error code. + * This function returns NRF_ERROR_INVALID_STATE if the device is not connected to a + * peer or if the DFU service is not initialized or if the notification of the DFU + * Status Report characteristic was not enabled by the peer. It returns NRF_ERROR_NULL + * if the pointer p_dfu is NULL. + */ +uint32_t ble_dfu_response_send(ble_dfu_t * p_dfu, + ble_dfu_procedure_t dfu_proc, + ble_dfu_resp_val_t resp_val); + +/**@brief Function for notifying the peer about the number of bytes of firmware data received. + * + * @param[in] p_dfu Pointer to the DFU service structure. + * @param[in] num_of_firmware_bytes_rcvd Number of bytes. + * + * @return NRF_SUCCESS if the DFU Service has successfully requested the SoftDevice to send + * the notification. Otherwise an error code. + * This function returns NRF_ERROR_INVALID_STATE if the device is not connected to a + * peer or if the DFU service is not initialized or if the notification of the DFU + * Status Report characteristic was not enabled by the peer. It returns NRF_ERROR_NULL + * if the pointer p_dfu is NULL. + */ +uint32_t ble_dfu_bytes_rcvd_report(ble_dfu_t * p_dfu, uint32_t num_of_firmware_bytes_rcvd); + +/**@brief Function for sending Packet Receipt Notification to the peer. + * + * This function will encode the number of bytes received as input parameter into a + * notification of the control point characteristic and send it to the peer. + * + * @param[in] p_dfu Pointer to the DFU service structure. + * @param[in] num_of_firmware_bytes_rcvd Number of bytes of firmware image received. + * + * @return NRF_SUCCESS if the DFU Service has successfully requested the SoftDevice to send + * the notification. Otherwise an error code. + * This function returns NRF_ERROR_INVALID_STATE if the device is not connected to a + * peer or if the DFU service is not initialized or if the notification of the DFU + * Status Report characteristic was not enabled by the peer. It returns NRF_ERROR_NULL + * if the pointer p_dfu is NULL. + */ +uint32_t ble_dfu_pkts_rcpt_notify(ble_dfu_t * p_dfu, uint32_t num_of_firmware_bytes_rcvd); + +#endif // BLE_DFU_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.c new file mode 100644 index 0000000000..2b9eaaa286 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.c @@ -0,0 +1,788 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_advdata.h" +#include "nrf_ble_gap.h" +#include "ble_srv_common.h" +#include "sdk_common.h" + +// NOTE: For now, Security Manager Out of Band Flags (OOB) are omitted from the advertising data. + +// Types of LE Bluetooth Device Address AD type +#define AD_TYPE_BLE_DEVICE_ADDR_TYPE_PUBLIC 0UL +#define AD_TYPE_BLE_DEVICE_ADDR_TYPE_RANDOM 1UL + +static uint32_t tk_value_encode(ble_advdata_tk_value_t * p_tk_value, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + int8_t i; + + // Check for buffer overflow. + if (((*p_offset) + AD_TYPE_TK_VALUE_SIZE) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // Encode LE Role. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_TK_VALUE_DATA_SIZE); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_SECURITY_MANAGER_TK_VALUE; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + + for (i = AD_TYPE_TK_VALUE_DATA_SIZE - 1; i >= 0; i--, (*p_offset)++) + { + p_encoded_data[*p_offset] = p_tk_value->tk[i]; + } + + return NRF_SUCCESS; +} + +static uint32_t le_role_encode(ble_advdata_le_role_t le_role, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + // Check for buffer overflow. + if (((*p_offset) + AD_TYPE_LE_ROLE_SIZE) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // Encode LE Role. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_LE_ROLE_DATA_SIZE); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_LE_ROLE; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + switch(le_role) + { + case BLE_ADVDATA_ROLE_ONLY_PERIPH: + p_encoded_data[*p_offset] = 0; + break; + case BLE_ADVDATA_ROLE_ONLY_CENTRAL: + p_encoded_data[*p_offset] = 1; + break; + case BLE_ADVDATA_ROLE_BOTH_PERIPH_PREFERRED: + p_encoded_data[*p_offset] = 2; + break; + case BLE_ADVDATA_ROLE_BOTH_CENTRAL_PREFERRED: + p_encoded_data[*p_offset] = 3; + break; + default: + return NRF_ERROR_INVALID_PARAM; + } + *p_offset += AD_TYPE_LE_ROLE_DATA_SIZE; + + return NRF_SUCCESS; +} + +static uint32_t ble_device_addr_encode(uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + uint32_t err_code; + ble_gap_addr_t device_addr; + + // Check for buffer overflow. + if (((*p_offset) + AD_TYPE_BLE_DEVICE_ADDR_SIZE) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // Get BLE address + err_code = sd_ble_gap_address_get(&device_addr); + VERIFY_SUCCESS(err_code); + + // Encode LE Bluetooth Device Address + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + + AD_TYPE_BLE_DEVICE_ADDR_DATA_SIZE); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + memcpy(&p_encoded_data[*p_offset], &device_addr.addr[0], BLE_GAP_ADDR_LEN); + *p_offset += BLE_GAP_ADDR_LEN; + if(BLE_GAP_ADDR_TYPE_PUBLIC == device_addr.addr_type) + { + p_encoded_data[*p_offset] = AD_TYPE_BLE_DEVICE_ADDR_TYPE_PUBLIC; + } + else + { + p_encoded_data[*p_offset] = AD_TYPE_BLE_DEVICE_ADDR_TYPE_RANDOM; + } + *p_offset += AD_TYPE_BLE_DEVICE_ADDR_TYPE_SIZE; + + return NRF_SUCCESS; +} + +static uint32_t name_encode(const ble_advdata_t * p_advdata, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + uint32_t err_code; + uint16_t rem_adv_data_len; + uint16_t actual_length; + uint8_t adv_data_format; + + + // Validate parameters + if((BLE_ADVDATA_SHORT_NAME == p_advdata->name_type) && (0 == p_advdata->short_name_len)) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Check for buffer overflow. + if ( (((*p_offset) + ADV_AD_DATA_OFFSET) > max_size) || + ( (BLE_ADVDATA_SHORT_NAME == p_advdata->name_type) && + (((*p_offset) + ADV_AD_DATA_OFFSET + p_advdata->short_name_len) > max_size))) + { + return NRF_ERROR_DATA_SIZE; + } + + rem_adv_data_len = max_size - (*p_offset) - ADV_AD_DATA_OFFSET; + actual_length = rem_adv_data_len; + + // Get GAP device name and length + err_code = sd_ble_gap_device_name_get(&p_encoded_data[(*p_offset) + ADV_AD_DATA_OFFSET], + &actual_length); + VERIFY_SUCCESS(err_code); + + // Check if device intend to use short name and it can fit available data size. + if ((p_advdata->name_type == BLE_ADVDATA_FULL_NAME) && (actual_length <= rem_adv_data_len)) + { + // Complete device name can fit, setting Complete Name in Adv Data. + adv_data_format = BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME; + } + else + { + // Else short name needs to be used. Or application has requested use of short name. + adv_data_format = BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME; + + // If application has set a preference on the short name size, it needs to be considered, + // else fit what can be fit. + if ((BLE_ADVDATA_SHORT_NAME == p_advdata->name_type) && + (p_advdata->short_name_len <= rem_adv_data_len)) + { + // Short name fits available size. + actual_length = p_advdata->short_name_len; + } + // Else whatever can fit the data buffer will be packed. + else + { + actual_length = rem_adv_data_len; + } + } + + // There is only 1 byte intended to encode length which is (actual_length + ADV_AD_TYPE_FIELD_SIZE) + if(actual_length > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) + { + return NRF_ERROR_DATA_SIZE; + } + + // Complete name field in encoded data. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + actual_length); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = adv_data_format; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + *p_offset += actual_length; + + return NRF_SUCCESS; +} + + +static uint32_t appearance_encode(uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + uint32_t err_code; + uint16_t appearance; + + // Check for buffer overflow. + if (((*p_offset) + AD_TYPE_APPEARANCE_SIZE) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // Get GAP appearance field. + err_code = sd_ble_gap_appearance_get(&appearance); + VERIFY_SUCCESS(err_code); + + // Encode Length, AD Type and Appearance. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_APPEARANCE_DATA_SIZE); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_APPEARANCE; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + *p_offset += uint16_encode(appearance, &p_encoded_data[*p_offset]); + + return NRF_SUCCESS; +} + +static uint32_t flags_encode(int8_t flags, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + // Check for buffer overflow. + if (((*p_offset) + AD_TYPE_FLAGS_SIZE) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // Encode flags. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_FLAGS_DATA_SIZE); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_FLAGS; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + p_encoded_data[*p_offset] = flags; + *p_offset += AD_TYPE_FLAGS_DATA_SIZE; + + return NRF_SUCCESS; +} + +static uint32_t sec_mgr_oob_flags_encode(uint8_t oob_flags, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + // Check for buffer overflow. + if (((*p_offset) + AD_TYPE_OOB_FLAGS_SIZE) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // Encode flags. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_OOB_FLAGS_DATA_SIZE); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + p_encoded_data[*p_offset] = oob_flags; + *p_offset += AD_TYPE_OOB_FLAGS_DATA_SIZE; + + return NRF_SUCCESS; +} + +static uint32_t tx_power_level_encode(int8_t tx_power_level, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + // Check for buffer overflow. + if (((*p_offset) + AD_TYPE_TX_POWER_LEVEL_SIZE) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // Encode TX Power Level. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + + AD_TYPE_TX_POWER_LEVEL_DATA_SIZE); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_TX_POWER_LEVEL; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + p_encoded_data[*p_offset] = tx_power_level; + *p_offset += AD_TYPE_TX_POWER_LEVEL_DATA_SIZE; + + return NRF_SUCCESS; +} + + +static uint32_t uuid_list_sized_encode(const ble_advdata_uuid_list_t * p_uuid_list, + uint8_t adv_type, + uint8_t uuid_size, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + int i; + bool is_heading_written = false; + uint16_t start_pos = *p_offset; + uint16_t length; + + for (i = 0; i < p_uuid_list->uuid_cnt; i++) + { + uint32_t err_code; + uint8_t encoded_size; + ble_uuid_t uuid = p_uuid_list->p_uuids[i]; + + // Find encoded uuid size. + err_code = sd_ble_uuid_encode(&uuid, &encoded_size, NULL); + VERIFY_SUCCESS(err_code); + + // Check size. + if (encoded_size == uuid_size) + { + uint8_t heading_bytes = (is_heading_written) ? 0 : ADV_AD_DATA_OFFSET; + + // Check for buffer overflow + if (((*p_offset) + encoded_size + heading_bytes) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + if (!is_heading_written) + { + // Write AD structure heading. + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = adv_type; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + is_heading_written = true; + } + + // Write UUID. + err_code = sd_ble_uuid_encode(&uuid, &encoded_size, &p_encoded_data[*p_offset]); + VERIFY_SUCCESS(err_code); + *p_offset += encoded_size; + } + } + + if (is_heading_written) + { + // Write length. + length = (*p_offset) - (start_pos + ADV_LENGTH_FIELD_SIZE); + // There is only 1 byte intended to encode length + if(length > 0x00FF) + { + return NRF_ERROR_DATA_SIZE; + } + p_encoded_data[start_pos] = (uint8_t)length; + } + + return NRF_SUCCESS; +} + + +static uint32_t uuid_list_encode(const ble_advdata_uuid_list_t * p_uuid_list, + uint8_t adv_type_16, + uint8_t adv_type_128, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + uint32_t err_code; + + // Encode 16 bit UUIDs. + err_code = uuid_list_sized_encode(p_uuid_list, + adv_type_16, + sizeof(uint16_le_t), + p_encoded_data, + p_offset, + max_size); + VERIFY_SUCCESS(err_code); + + // Encode 128 bit UUIDs. + err_code = uuid_list_sized_encode(p_uuid_list, + adv_type_128, + sizeof(ble_uuid128_t), + p_encoded_data, + p_offset, + max_size); + VERIFY_SUCCESS(err_code); + + return NRF_SUCCESS; +} + + +static uint32_t conn_int_check(const ble_advdata_conn_int_t *p_conn_int) +{ + // Check Minimum Connection Interval. + if ((p_conn_int->min_conn_interval < 0x0006) || + ( + (p_conn_int->min_conn_interval > 0x0c80) && + (p_conn_int->min_conn_interval != 0xffff) + ) + ) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Check Maximum Connection Interval. + if ((p_conn_int->max_conn_interval < 0x0006) || + ( + (p_conn_int->max_conn_interval > 0x0c80) && + (p_conn_int->max_conn_interval != 0xffff) + ) + ) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Make sure Minimum Connection Interval is not bigger than Maximum Connection Interval. + if ((p_conn_int->min_conn_interval != 0xffff) && + (p_conn_int->max_conn_interval != 0xffff) && + (p_conn_int->min_conn_interval > p_conn_int->max_conn_interval) + ) + { + return NRF_ERROR_INVALID_PARAM; + } + + return NRF_SUCCESS; +} + + +static uint32_t conn_int_encode(const ble_advdata_conn_int_t * p_conn_int, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + uint32_t err_code; + + // Check for buffer overflow. + if (((*p_offset) + AD_TYPE_CONN_INT_SIZE) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // Check parameters. + err_code = conn_int_check(p_conn_int); + VERIFY_SUCCESS(err_code); + + // Encode Length and AD Type. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_CONN_INT_DATA_SIZE); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + + // Encode Minimum and Maximum Connection Intervals. + *p_offset += uint16_encode(p_conn_int->min_conn_interval, &p_encoded_data[*p_offset]); + *p_offset += uint16_encode(p_conn_int->max_conn_interval, &p_encoded_data[*p_offset]); + + return NRF_SUCCESS; +} + + +static uint32_t manuf_specific_data_encode(const ble_advdata_manuf_data_t * p_manuf_sp_data, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + uint32_t data_size = AD_TYPE_MANUF_SPEC_DATA_ID_SIZE + p_manuf_sp_data->data.size; + + // Check for buffer overflow. + if (((*p_offset) + ADV_AD_DATA_OFFSET + data_size) > max_size) + { + return NRF_ERROR_DATA_SIZE; + } + + // There is only 1 byte intended to encode length which is (data_size + ADV_AD_TYPE_FIELD_SIZE) + if(data_size > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) + { + return NRF_ERROR_DATA_SIZE; + } + + // Encode Length and AD Type. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + data_size); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + + // Encode Company Identifier. + *p_offset += uint16_encode(p_manuf_sp_data->company_identifier, &p_encoded_data[*p_offset]); + + // Encode additional manufacturer specific data. + if (p_manuf_sp_data->data.size > 0) + { + if (p_manuf_sp_data->data.p_data == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + memcpy(&p_encoded_data[*p_offset], p_manuf_sp_data->data.p_data, p_manuf_sp_data->data.size); + *p_offset += p_manuf_sp_data->data.size; + } + + return NRF_SUCCESS; +} + +// Implemented only for 16-bit UUIDs +static uint32_t service_data_encode(const ble_advdata_t * p_advdata, + uint8_t * p_encoded_data, + uint16_t * p_offset, + uint16_t max_size) +{ + uint8_t i; + + // Check parameter consistency. + if (p_advdata->p_service_data_array == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + for (i = 0; i < p_advdata->service_data_count; i++) + { + ble_advdata_service_data_t * p_service_data; + uint32_t data_size; + + p_service_data = &p_advdata->p_service_data_array[i]; + // For now implemented only for 16-bit UUIDs + data_size = AD_TYPE_SERV_DATA_16BIT_UUID_SIZE + p_service_data->data.size; + + // There is only 1 byte intended to encode length which is (data_size + ADV_AD_TYPE_FIELD_SIZE) + if(data_size > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) + { + return NRF_ERROR_DATA_SIZE; + } + + // Encode Length and AD Type. + p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + data_size); + *p_offset += ADV_LENGTH_FIELD_SIZE; + p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_SERVICE_DATA; + *p_offset += ADV_AD_TYPE_FIELD_SIZE; + + // Encode service 16-bit UUID. + *p_offset += uint16_encode(p_service_data->service_uuid, &p_encoded_data[*p_offset]); + + // Encode additional service data. + if (p_service_data->data.size > 0) + { + if (p_service_data->data.p_data == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + memcpy(&p_encoded_data[*p_offset], p_service_data->data.p_data, p_service_data->data.size); + *p_offset += p_service_data->data.size; + } + } + + return NRF_SUCCESS; +} + +uint32_t adv_data_encode(ble_advdata_t const * const p_advdata, + uint8_t * const p_encoded_data, + uint16_t * const p_len) +{ + uint32_t err_code = NRF_SUCCESS; + uint16_t max_size = *p_len; + *p_len = 0; + + //Encode Security Manager OOB Flags + if (p_advdata->p_sec_mgr_oob_flags != NULL) + { + err_code = sec_mgr_oob_flags_encode(*p_advdata->p_sec_mgr_oob_flags, + p_encoded_data, + p_len, + max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode Security Manager TK value + if (NULL != p_advdata->p_tk_value) + { + err_code = tk_value_encode(p_advdata->p_tk_value, p_encoded_data, p_len, max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode LE Role + if (BLE_ADVDATA_ROLE_NOT_PRESENT != p_advdata->le_role) + { + err_code = le_role_encode(p_advdata->le_role, p_encoded_data, p_len, max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode LE Bluetooth Device Address + if (p_advdata->include_ble_device_addr) + { + err_code = ble_device_addr_encode(p_encoded_data, p_len, max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode appearance. + if (p_advdata->include_appearance) + { + err_code = appearance_encode(p_encoded_data, p_len, max_size); + VERIFY_SUCCESS(err_code); + } + + //Encode Flags + if(p_advdata->flags != 0 ) + { + err_code = flags_encode(p_advdata->flags, p_encoded_data, p_len, max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode TX power level. + if (p_advdata->p_tx_power_level != NULL) + { + err_code = tx_power_level_encode(*p_advdata->p_tx_power_level, + p_encoded_data, + p_len, + max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode 'more available' uuid list. + if (p_advdata->uuids_more_available.uuid_cnt > 0) + { + err_code = uuid_list_encode(&p_advdata->uuids_more_available, + BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE, + BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE, + p_encoded_data, + p_len, + max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode 'complete' uuid list. + if (p_advdata->uuids_complete.uuid_cnt > 0) + { + err_code = uuid_list_encode(&p_advdata->uuids_complete, + BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE, + BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE, + p_encoded_data, + p_len, + max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode 'solicited service' uuid list. + if (p_advdata->uuids_solicited.uuid_cnt > 0) + { + err_code = uuid_list_encode(&p_advdata->uuids_solicited, + BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT, + BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT, + p_encoded_data, + p_len, + max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode Slave Connection Interval Range. + if (p_advdata->p_slave_conn_int != NULL) + { + err_code = conn_int_encode(p_advdata->p_slave_conn_int, p_encoded_data, p_len, max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode Manufacturer Specific Data. + if (p_advdata->p_manuf_specific_data != NULL) + { + err_code = manuf_specific_data_encode(p_advdata->p_manuf_specific_data, + p_encoded_data, + p_len, + max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode Service Data. + if (p_advdata->service_data_count > 0) + { + err_code = service_data_encode(p_advdata, p_encoded_data, p_len, max_size); + VERIFY_SUCCESS(err_code); + } + + // Encode name. WARNING: it is encoded last on purpose since too long device name is truncated. + if (p_advdata->name_type != BLE_ADVDATA_NO_NAME) + { + err_code = name_encode(p_advdata, p_encoded_data, p_len, max_size); + VERIFY_SUCCESS(err_code); + } + + return err_code; +} + + +static uint32_t advdata_check(const ble_advdata_t * p_advdata) +{ + // Flags must be included in advertising data, and the BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED flag must be set. + if ( + ((p_advdata->flags & BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) == 0) + ) + { + return NRF_ERROR_INVALID_PARAM; + } + + return NRF_SUCCESS; +} + + +static uint32_t srdata_check(const ble_advdata_t * p_srdata) +{ + // Flags shall not be included in the scan response data. + if (p_srdata->flags) + { + return NRF_ERROR_INVALID_PARAM; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_advdata_set(const ble_advdata_t * p_advdata, const ble_advdata_t * p_srdata) +{ + uint32_t err_code; + uint16_t len_advdata = BLE_GAP_ADV_MAX_SIZE; + uint16_t len_srdata = BLE_GAP_ADV_MAX_SIZE; + uint8_t encoded_advdata[BLE_GAP_ADV_MAX_SIZE]; + uint8_t encoded_srdata[BLE_GAP_ADV_MAX_SIZE]; + uint8_t * p_encoded_advdata; + uint8_t * p_encoded_srdata; + + // Encode advertising data (if supplied). + if (p_advdata != NULL) + { + err_code = advdata_check(p_advdata); + VERIFY_SUCCESS(err_code); + + err_code = adv_data_encode(p_advdata, encoded_advdata, &len_advdata); + VERIFY_SUCCESS(err_code); + p_encoded_advdata = encoded_advdata; + } + else + { + p_encoded_advdata = NULL; + len_advdata = 0; + } + + // Encode scan response data (if supplied). + if (p_srdata != NULL) + { + err_code = srdata_check(p_srdata); + VERIFY_SUCCESS(err_code); + + err_code = adv_data_encode(p_srdata, encoded_srdata, &len_srdata); + VERIFY_SUCCESS(err_code); + p_encoded_srdata = encoded_srdata; + } + else + { + p_encoded_srdata = NULL; + len_srdata = 0; + } + + // Pass encoded advertising data and/or scan response data to the stack. + return sd_ble_gap_adv_data_set(p_encoded_advdata, len_advdata, p_encoded_srdata, len_srdata); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h new file mode 100644 index 0000000000..75a0d014c9 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_sdk_lib_advdata Advertising and Scan Response Data Encoder + * @{ + * @ingroup ble_sdk_lib + * @brief Functions for encoding data in the Advertising and Scan Response Data format, + * and for passing the data to the stack. + */ + +#ifndef BLE_ADVDATA_H__ +#define BLE_ADVDATA_H__ + +#include +#include +#include +#include "nrf_ble.h" +#include "app_util.h" + + +#define ADV_LENGTH_FIELD_SIZE 1UL /**< Advertising Data and Scan Response format contains 1 octet for the length. */ +#define ADV_AD_TYPE_FIELD_SIZE 1UL /**< Advertising Data and Scan Response format contains 1 octet for the AD type. */ +#define ADV_AD_DATA_OFFSET (ADV_LENGTH_FIELD_SIZE + \ + ADV_AD_TYPE_FIELD_SIZE) /**< Offset for the AD data field of the Advertising Data and Scan Response format. */ +#define AD_TYPE_TK_VALUE_DATA_SIZE (sizeof(ble_advdata_tk_value_t)) /**< Data size (in octets) of the Security Manager TK value AD type. */ +#define AD_TYPE_TK_VALUE_SIZE (ADV_AD_DATA_OFFSET + \ + AD_TYPE_TK_VALUE_DATA_SIZE) /**< Size (in octets) of the Security Manager TK value AD type. */ +#define AD_TYPE_LE_ROLE_DATA_SIZE 1UL /**< Data size (in octets) of the LE Bluetooth Device Address AD type. */ +#define AD_TYPE_LE_ROLE_SIZE (ADV_AD_DATA_OFFSET + \ + AD_TYPE_LE_ROLE_DATA_SIZE) /**< Size (in octets) of the LE Bluetooth Device Address AD type. */ +#define AD_TYPE_BLE_DEVICE_ADDR_TYPE_SIZE 1UL /**< Data size (in octets) of the Address type of the LE Bluetooth Device Address AD type. */ +#define AD_TYPE_BLE_DEVICE_ADDR_DATA_SIZE (BLE_GAP_ADDR_LEN + \ + AD_TYPE_BLE_DEVICE_ADDR_TYPE_SIZE) /**< Data size (in octets) of the LE Bluetooth Device Address AD type. */ +#define AD_TYPE_BLE_DEVICE_ADDR_SIZE (ADV_AD_DATA_OFFSET + \ + AD_TYPE_BLE_DEVICE_ADDR_DATA_SIZE) /**< Size (in octets) of the LE Bluetooth Device Address AD type. */ +#define AD_TYPE_APPEARANCE_DATA_SIZE 2UL /**< Data size (in octets) of the Appearance AD type. */ +#define AD_TYPE_APPEARANCE_SIZE (ADV_AD_DATA_OFFSET + \ + AD_TYPE_APPEARANCE_DATA_SIZE) /**< Size (in octets) of the Appearance AD type. */ +#define AD_TYPE_FLAGS_DATA_SIZE 1UL /**< Data size (in octets) of the Flags AD type. */ +#define AD_TYPE_FLAGS_SIZE (ADV_AD_DATA_OFFSET + \ + AD_TYPE_FLAGS_DATA_SIZE) /**< Size (in octets) of the Flags AD type. */ +#define AD_TYPE_TX_POWER_LEVEL_DATA_SIZE 1UL /**< Data size (in octets) of the TX Power Level AD type. */ +#define AD_TYPE_TX_POWER_LEVEL_SIZE (ADV_AD_DATA_OFFSET + \ + AD_TYPE_TX_POWER_LEVEL_DATA_SIZE) /**< Size (in octets) of the TX Power Level AD type. */ +#define AD_TYPE_CONN_INT_DATA_SIZE 4UL /**< Data size (in octets) of the Slave Connection Interval Range AD type. */ +#define AD_TYPE_CONN_INT_SIZE (ADV_AD_DATA_OFFSET + \ + AD_TYPE_CONN_INT_DATA_SIZE) /**< Data size (in octets) of the Slave Connection Interval Range AD type. */ +#define AD_TYPE_MANUF_SPEC_DATA_ID_SIZE 2UL /**< Size (in octets) of the Company Identifier Code, which is a part of the Manufacturer Specific Data AD type. */ +#define AD_TYPE_SERV_DATA_16BIT_UUID_SIZE 2UL /**< Size (in octets) of the 16-bit UUID, which is a part of the Service Data AD type. */ +#define AD_TYPE_OOB_FLAGS_DATA_SIZE 1UL /**< Data size (in octets) of the Security Manager OOB Flags AD type. */ +#define AD_TYPE_OOB_FLAGS_SIZE (ADV_AD_DATA_OFFSET + \ + AD_TYPE_OOB_FLAGS_DATA_SIZE) /**< Size (in octets) of the Security Manager OOB Flags AD type. */ + +#define AD_TYPE_SEC_MGR_OOB_FLAG_SET 1U /**< Security Manager OOB Flag set. Flag selection is done using _POS defines */ +#define AD_TYPE_SEC_MGR_OOB_FLAG_CLEAR 0U /**< Security Manager OOB Flag clear. Flag selection is done using _POS defines */ +#define AD_TYPE_SEC_MGR_OOB_FLAG_OOB_DATA_PRESENT_POS 0UL /**< Security Manager OOB Data Present Flag position. */ +#define AD_TYPE_SEC_MGR_OOB_FLAG_OOB_LE_SUPPORTED_POS 1UL /**< Security Manager OOB Low Energy Supported Flag position. */ +#define AD_TYPE_SEC_MGR_OOB_FLAG_SIM_LE_AND_EP_POS 2UL /**< Security Manager OOB Simultaneous LE and BR/EDR to Same Device Capable Flag position. */ +#define AD_TYPE_SEC_MGR_OOB_ADDRESS_TYPE_PUBLIC 0UL /**< Security Manager OOB Public Address type. */ +#define AD_TYPE_SEC_MGR_OOB_ADDRESS_TYPE_RANDOM 1UL /**< Security Manager OOB Random Address type. */ +#define AD_TYPE_SEC_MGR_OOB_FLAG_ADDRESS_TYPE_POS 3UL /**< Security Manager OOB Address type Flag (0 = Public Address, 1 = Random Address) position. */ + + +/**@brief Security Manager TK value. */ +typedef struct +{ + uint8_t tk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing TK value. */ +} ble_advdata_tk_value_t; + +/**@brief Advertising data LE Role types. This enumeration contains the options available for the LE role inside + * the advertising data. */ +typedef enum +{ + BLE_ADVDATA_ROLE_NOT_PRESENT = 0, /**< LE Role AD structure not present. */ + BLE_ADVDATA_ROLE_ONLY_PERIPH, /**< Only Peripheral Role supported. */ + BLE_ADVDATA_ROLE_ONLY_CENTRAL, /**< Only Central Role supported. */ + BLE_ADVDATA_ROLE_BOTH_PERIPH_PREFERRED, /**< Peripheral and Central Role supported. Peripheral Role preferred for connection establishment. */ + BLE_ADVDATA_ROLE_BOTH_CENTRAL_PREFERRED /**< Peripheral and Central Role supported. Central Role preferred for connection establishment */ +} ble_advdata_le_role_t; + +/**@brief Advertising data name type. This enumeration contains the options available for the device name inside + * the advertising data. */ +typedef enum +{ + BLE_ADVDATA_NO_NAME, /**< Include no device name in advertising data. */ + BLE_ADVDATA_SHORT_NAME, /**< Include short device name in advertising data. */ + BLE_ADVDATA_FULL_NAME /**< Include full device name in advertising data. */ +} ble_advdata_name_type_t; + +/**@brief UUID list type. */ +typedef struct +{ + uint16_t uuid_cnt; /**< Number of UUID entries. */ + ble_uuid_t * p_uuids; /**< Pointer to UUID array entries. */ +} ble_advdata_uuid_list_t; + +/**@brief Connection interval range structure. */ +typedef struct +{ + uint16_t min_conn_interval; /**< Minimum connection interval, in units of 1.25 ms, range 6 to 3200 (7.5 ms to 4 s). */ + uint16_t max_conn_interval; /**< Maximum connection interval, in units of 1.25 ms, range 6 to 3200 (7.5 ms to 4 s). The value 0xFFFF indicates no specific maximum. */ +} ble_advdata_conn_int_t; + +/**@brief Manufacturer specific data structure. */ +typedef struct +{ + uint16_t company_identifier; /**< Company identifier code. */ + uint8_array_t data; /**< Additional manufacturer specific data. */ +} ble_advdata_manuf_data_t; + +/**@brief Service data structure. */ +typedef struct +{ + uint16_t service_uuid; /**< Service UUID. */ + uint8_array_t data; /**< Additional service data. */ +} ble_advdata_service_data_t; + +/**@brief Advertising data structure. This structure contains all options and data needed for encoding and + * setting the advertising data. */ +typedef struct +{ + ble_advdata_name_type_t name_type; /**< Type of device name. */ + uint8_t short_name_len; /**< Length of short device name (if short type is specified). */ + bool include_appearance; /**< Determines if Appearance shall be included. */ + uint8_t flags; /**< Advertising data Flags field. */ + int8_t * p_tx_power_level; /**< TX Power Level field. */ + ble_advdata_uuid_list_t uuids_more_available; /**< List of UUIDs in the 'More Available' list. */ + ble_advdata_uuid_list_t uuids_complete; /**< List of UUIDs in the 'Complete' list. */ + ble_advdata_uuid_list_t uuids_solicited; /**< List of solicited UUIDs. */ + ble_advdata_conn_int_t * p_slave_conn_int; /**< Slave Connection Interval Range. */ + ble_advdata_manuf_data_t * p_manuf_specific_data; /**< Manufacturer specific data. */ + ble_advdata_service_data_t * p_service_data_array; /**< Array of Service data structures. */ + uint8_t service_data_count; /**< Number of Service data structures. */ + bool include_ble_device_addr; /**< Determines if LE Bluetooth Device Address shall be included. */ + ble_advdata_le_role_t le_role; /**< LE Role field. Included when different from @ref BLE_ADVDATA_ROLE_NOT_PRESENT. @warning This field can be used only for NFC. For BLE advertising, set it to NULL. */ + ble_advdata_tk_value_t * p_tk_value; /**< Security Manager TK value field. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/ + uint8_t * p_sec_mgr_oob_flags; /**< Security Manager Out Of Band Flags field. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/ +} ble_advdata_t; + +/**@brief Function for encoding data in the Advertising and Scan Response data format + * (AD structures). + * + * @details This function encodes data into the Advertising and Scan Response data format + * (AD structures) based on the selections in the supplied structures. This function can be used to + * create a payload of Advertising packet or Scan Response packet, or a payload of NFC + * message intended for initiating the Out-of-Band pairing. + * + * @param[in] p_advdata Pointer to the structure for specifying the content of encoded data. + * @param[out] p_encoded_data Pointer to the buffer where encoded data will be returned. + * @param[in,out] p_len \c in: Size of \p p_encoded_data buffer. + * \c out: Length of encoded data. + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INVALID_PARAM If the operation failed because a wrong parameter was provided in \p p_advdata. + * @retval NRF_ERROR_DATA_SIZE If the operation failed because not all the requested data could fit into the + * provided buffer or some encoded AD structure is too long and its + * length cannot be encoded with one octet. + * + * @warning This API may override the application's request to use the long name and use a short name + * instead. This truncation will occur in case the long name does not fit the provided buffer size. + * The application can specify a preferred short name length if truncation is required. + * For example, if the complete device name is ABCD_HRMonitor, the application can specify the short name + * length to be 8, so that the short device name appears as ABCD_HRM instead of ABCD_HRMo or ABCD_HRMoni + * if the available size for the short name is 9 or 12 respectively, to have a more appropriate short name. + * However, it should be noted that this is just a preference that the application can specify, and + * if the preference is too large to fit in the provided buffer, the name can be truncated further. + */ +uint32_t adv_data_encode(ble_advdata_t const * const p_advdata, + uint8_t * const p_encoded_data, + uint16_t * const p_len); + +/**@brief Function for encoding and setting the advertising data and/or scan response data. + * + * @details This function encodes advertising data and/or scan response data based on the selections + * in the supplied structures, and passes the encoded data to the stack. + * + * @param[in] p_advdata Structure for specifying the content of the advertising data. + * Set to NULL if advertising data is not to be set. + * @param[in] p_srdata Structure for specifying the content of the scan response data. + * Set to NULL if scan response data is not to be set. + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INVALID_PARAM If the operation failed because a wrong parameter was provided in \p p_advdata. + * @retval NRF_ERROR_DATA_SIZE If the operation failed because not all the requested data could fit into the + * advertising packet. The maximum size of the advertisement packet + * is @ref BLE_GAP_ADV_MAX_SIZE. + * + * @warning This API may override the application's request to use the long name and use a short name + * instead. This truncation will occur in case the long name does not fit the provided buffer size. + * The application can specify a preferred short name length if truncation is required. + * For example, if the complete device name is ABCD_HRMonitor, the application can specify the short name + * length to be 8, so that the short device name appears as ABCD_HRM instead of ABCD_HRMo or ABCD_HRMoni + * if the available size for the short name is 9 or 12 respectively, to have a more appropriate short name. + * However, it should be noted that this is just a preference that the application can specify, and + * if the preference is too large to fit in the provided buffer, the name can be truncated further. + */ +uint32_t ble_advdata_set(const ble_advdata_t * p_advdata, const ble_advdata_t * p_srdata); + +#endif // BLE_ADVDATA_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h new file mode 100644 index 0000000000..81bca6eae5 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_sdk_lib_conn_params Connection Parameters Negotiation + * @{ + * @ingroup ble_sdk_lib + * @brief Module for initiating and executing a connection parameters negotiation procedure. + */ + +#ifndef BLE_CONN_PARAMS_H__ +#define BLE_CONN_PARAMS_H__ + +#include +#include "nrf_ble.h" +#include "ble_srv_common.h" + +/**@brief Connection Parameters Module event type. */ +typedef enum +{ + BLE_CONN_PARAMS_EVT_FAILED , /**< Negotiation procedure failed. */ + BLE_CONN_PARAMS_EVT_SUCCEEDED /**< Negotiation procedure succeeded. */ +} ble_conn_params_evt_type_t; + +/**@brief Connection Parameters Module event. */ +typedef struct +{ + ble_conn_params_evt_type_t evt_type; /**< Type of event. */ +} ble_conn_params_evt_t; + +/**@brief Connection Parameters Module event handler type. */ +typedef void (*ble_conn_params_evt_handler_t) (ble_conn_params_evt_t * p_evt); + +/**@brief Connection Parameters Module init structure. This contains all options and data needed for + * initialization of the connection parameters negotiation module. */ +typedef struct +{ + ble_gap_conn_params_t * p_conn_params; /**< Pointer to the connection parameters desired by the application. When calling ble_conn_params_init, if this parameter is set to NULL, the connection parameters will be fetched from host. */ + uint32_t first_conn_params_update_delay; /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (in number of timer ticks). */ + uint32_t next_conn_params_update_delay; /**< Time between each call to sd_ble_gap_conn_param_update after the first (in number of timer ticks). Recommended value 30 seconds as per BLUETOOTH SPECIFICATION Version 4.0. */ + uint8_t max_conn_params_update_count; /**< Number of attempts before giving up the negotiation. */ + uint16_t start_on_notify_cccd_handle; /**< If procedure is to be started when notification is started, set this to the handle of the corresponding CCCD. Set to BLE_GATT_HANDLE_INVALID if procedure is to be started on connect event. */ + bool disconnect_on_fail; /**< Set to TRUE if a failed connection parameters update shall cause an automatic disconnection, set to FALSE otherwise. */ + ble_conn_params_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Connection Parameters. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ +} ble_conn_params_init_t; + + +/**@brief Function for initializing the Connection Parameters module. + * + * @note If the negotiation procedure should be triggered when notification/indication of + * any characteristic is enabled by the peer, then this function must be called after + * having initialized the services. + * + * @param[in] p_init This contains information needed to initialize this module. + * + * @return NRF_SUCCESS on successful initialization, otherwise an error code. + */ +uint32_t ble_conn_params_init(const ble_conn_params_init_t * p_init); + +/**@brief Function for stopping the Connection Parameters module. + * + * @details This function is intended to be used by the application to clean up the connection + * parameters update module. This will stop the connection parameters update timer if + * running, thereby preventing any impending connection parameters update procedure. This + * function must be called by the application when it needs to clean itself up (for + * example, before disabling the bluetooth SoftDevice) so that an unwanted timer expiry + * event can be avoided. + * + * @return NRF_SUCCESS on successful initialization, otherwise an error code. + */ +uint32_t ble_conn_params_stop(void); + +/**@brief Function for changing the current connection parameters to a new set. + * + * @details Use this function to change the connection parameters to a new set of parameter + * (ie different from the ones given at init of the module). + * This function is usefull for scenario where most of the time the application + * needs a relatively big connection interval, and just sometimes, for a temporary + * period requires shorter connection interval, for example to transfer a higher + * amount of data. + * If the given parameters does not match the current connection's parameters + * this function initiates a new negotiation. + * + * @param[in] new_params This contains the new connections parameters to setup. + * + * @return NRF_SUCCESS on successful initialization, otherwise an error code. + */ +uint32_t ble_conn_params_change_conn_params(ble_gap_conn_params_t *new_params); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack that are of interest to this module. + * + * @param[in] p_ble_evt The event received from the BLE stack. + */ +void ble_conn_params_on_ble_evt(ble_evt_t * p_ble_evt); + +#endif // BLE_CONN_PARAMS_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c new file mode 100644 index 0000000000..060ce77e34 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c @@ -0,0 +1,414 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_conn_state.h" +#include +#include +#include +#include "nrf_ble.h" +#include "sdk_mapped_flags.h" +#include "app_error.h" + + +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#endif + + +#define BLE_CONN_STATE_N_DEFAULT_FLAGS 5 /**< The number of flags kept for each connection, excluding user flags. */ +#define BLE_CONN_STATE_N_FLAGS (BLE_CONN_STATE_N_DEFAULT_FLAGS + BLE_CONN_STATE_N_USER_FLAGS) /**< The number of flags kept for each connection, including user flags. */ + + +/**@brief Structure containing all the flag collections maintained by the Connection State module. + */ +typedef struct +{ + sdk_mapped_flags_t valid_flags; /**< Flags indicating which connection handles are valid. */ + sdk_mapped_flags_t connected_flags; /**< Flags indicating which connections are connected, since disconnected connection handles will not immediately be invalidated. */ + sdk_mapped_flags_t central_flags; /**< Flags indicating in which connections the local device is the central. */ + sdk_mapped_flags_t encrypted_flags; /**< Flags indicating which connections are encrypted. */ + sdk_mapped_flags_t mitm_protected_flags; /**< Flags indicating which connections have encryption with protection from man-in-the-middle attacks. */ + sdk_mapped_flags_t user_flags[BLE_CONN_STATE_N_USER_FLAGS]; /**< Flags that can be reserved by the user. The flags will be cleared when a connection is invalidated, otherwise, the user is wholly responsible for the flag states. */ +} ble_conn_state_flag_collections_t; + + +/**@brief Structure containing the internal state of the Connection State module. + */ +typedef struct +{ + uint32_t acquired_flags; /**< Bitmap for keeping track of which user flags have been acquired. */ + uint16_t valid_conn_handles[SDK_MAPPED_FLAGS_N_KEYS]; /**< List of connection handles used as keys for the sdk_mapped_flags module. */ + union + { + ble_conn_state_flag_collections_t flags; /**< Flag collections kept by the Connection State module. */ + sdk_mapped_flags_t flag_array[BLE_CONN_STATE_N_FLAGS]; /**< Flag collections as array to allow use of @ref sdk_mapped_flags_bulk_update_by_key() when setting all flags. */ + }; +} ble_conn_state_t; + + +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + /* leave anonymous unions enabled */ +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#endif + + +static ble_conn_state_t m_bcs = {0}; /**< Instantiation of the internal state. */ + + +/**@brief Function for resetting all internal memory to the values it had at initialization. + */ +void bcs_internal_state_reset(void) +{ + memset( &m_bcs, 0, sizeof(ble_conn_state_t) ); +} + + +/**@brief Function for activating a connection record. + * + * @param p_record The record to activate. + * @param conn_handle The connection handle to copy into the record. + * @param role The role of the connection. + * + * @return whether the record was activated successfully. + */ +static bool record_activate(uint16_t conn_handle) +{ + uint16_t available_index = sdk_mapped_flags_first_key_index_get(~m_bcs.flags.valid_flags); + + if (available_index != SDK_MAPPED_FLAGS_INVALID_INDEX) + { + m_bcs.valid_conn_handles[available_index] = conn_handle; + sdk_mapped_flags_update_by_key(m_bcs.valid_conn_handles, + &m_bcs.flags.connected_flags, + conn_handle, + 1); + sdk_mapped_flags_update_by_key(m_bcs.valid_conn_handles, + &m_bcs.flags.valid_flags, + conn_handle, + 1); + + return true; + } + + return false; +} + + +/**@brief Function for marking a connection record as invalid and resetting the values. + * + * @param p_record The record to invalidate. + */ +static void record_invalidate(uint16_t conn_handle) +{ + sdk_mapped_flags_bulk_update_by_key(m_bcs.valid_conn_handles, + m_bcs.flag_array, + BLE_CONN_STATE_N_FLAGS, + conn_handle, + 0); +} + + +/**@brief Function for marking a connection as disconnected. See @ref BLE_CONN_STATUS_DISCONNECTED. + * + * @param p_record The record of the connection to set as disconnected. + */ +static void record_set_disconnected(uint16_t conn_handle) +{ + sdk_mapped_flags_update_by_key(m_bcs.valid_conn_handles, + &m_bcs.flags.connected_flags, + conn_handle, + 0); +} + + +/**@brief Function for invalidating records with a @ref BLE_CONN_STATUS_DISCONNECTED + * connection status + */ +static void record_purge_disconnected() +{ + sdk_mapped_flags_key_list_t disconnected_list; + + disconnected_list = sdk_mapped_flags_key_list_get( + m_bcs.valid_conn_handles, + (~m_bcs.flags.connected_flags) & (m_bcs.flags.valid_flags)); + + for (uint32_t i = 0; i < disconnected_list.len; i++) + { + record_invalidate(disconnected_list.flag_keys[i]); + } +} + + +/**@brief Function for checking if a user flag has been acquired. + * + * @param[in] flag_id Which flag to check. + * + * @return Whether the flag has been acquired. + */ +static bool user_flag_is_acquired(ble_conn_state_user_flag_id_t flag_id) +{ + return ((m_bcs.acquired_flags & (1 << flag_id)) != 0); +} + + +/**@brief Function for marking a user flag as acquired. + * + * @param[in] flag_id Which flag to mark. + */ +static void user_flag_acquire(ble_conn_state_user_flag_id_t flag_id) +{ + m_bcs.acquired_flags |= (1 << flag_id); +} + + +void ble_conn_state_init(void) +{ + bcs_internal_state_reset(); +} + + +void ble_conn_state_on_ble_evt(ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + record_purge_disconnected(); + + if ( !record_activate(p_ble_evt->evt.gap_evt.conn_handle) ) + { + // No more records available. Should not happen. + APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); + } + else + { + bool is_central = + (p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_CENTRAL); + + sdk_mapped_flags_update_by_key(m_bcs.valid_conn_handles, + &m_bcs.flags.central_flags, + p_ble_evt->evt.gap_evt.conn_handle, + is_central); + } + + break; + + case BLE_GAP_EVT_DISCONNECTED: + record_set_disconnected(p_ble_evt->evt.gap_evt.conn_handle); + break; + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + sdk_mapped_flags_update_by_key( + m_bcs.valid_conn_handles, + &m_bcs.flags.encrypted_flags, + p_ble_evt->evt.gap_evt.conn_handle, + (p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv > 1)); + sdk_mapped_flags_update_by_key( + m_bcs.valid_conn_handles, + &m_bcs.flags.mitm_protected_flags, + p_ble_evt->evt.gap_evt.conn_handle, + (p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv > 2)); + break; + } +} + + +bool ble_conn_state_valid(uint16_t conn_handle) +{ + return sdk_mapped_flags_get_by_key(m_bcs.valid_conn_handles, + m_bcs.flags.valid_flags, + conn_handle); +} + + +uint8_t ble_conn_state_role(uint16_t conn_handle) +{ + uint8_t role = BLE_GAP_ROLE_INVALID; + + if ( sdk_mapped_flags_get_by_key(m_bcs.valid_conn_handles, m_bcs.flags.valid_flags, conn_handle) ) + { + bool central = sdk_mapped_flags_get_by_key(m_bcs.valid_conn_handles, + m_bcs.flags.central_flags, + conn_handle); + + role = central ? BLE_GAP_ROLE_CENTRAL : BLE_GAP_ROLE_PERIPH; + } + + return role; +} + + +ble_conn_state_status_t ble_conn_state_status(uint16_t conn_handle) +{ + ble_conn_state_status_t conn_status = BLE_CONN_STATUS_INVALID; + bool valid = sdk_mapped_flags_get_by_key(m_bcs.valid_conn_handles, + m_bcs.flags.valid_flags, + conn_handle); + + if (valid) + { + bool connected = sdk_mapped_flags_get_by_key(m_bcs.valid_conn_handles, + m_bcs.flags.connected_flags, + conn_handle); + + conn_status = connected ? BLE_CONN_STATUS_CONNECTED : BLE_CONN_STATUS_DISCONNECTED; + } + + return conn_status; +} + + +bool ble_conn_state_encrypted(uint16_t conn_handle) +{ + return sdk_mapped_flags_get_by_key(m_bcs.valid_conn_handles, + m_bcs.flags.encrypted_flags, + conn_handle); +} + + +bool ble_conn_state_mitm_protected(uint16_t conn_handle) +{ + return sdk_mapped_flags_get_by_key(m_bcs.valid_conn_handles, + m_bcs.flags.mitm_protected_flags, + conn_handle); +} + + +uint32_t ble_conn_state_n_connections(void) +{ + return sdk_mapped_flags_n_flags_set(m_bcs.flags.connected_flags); +} + + +uint32_t ble_conn_state_n_centrals(void) +{ + return sdk_mapped_flags_n_flags_set((m_bcs.flags.central_flags) & (m_bcs.flags.connected_flags)); +} + + +uint32_t ble_conn_state_n_peripherals(void) +{ + return sdk_mapped_flags_n_flags_set((~m_bcs.flags.central_flags) & (m_bcs.flags.connected_flags)); +} + + +sdk_mapped_flags_key_list_t ble_conn_state_conn_handles(void) +{ + return sdk_mapped_flags_key_list_get(m_bcs.valid_conn_handles, m_bcs.flags.valid_flags); +} + + +sdk_mapped_flags_key_list_t ble_conn_state_central_handles(void) +{ + return sdk_mapped_flags_key_list_get(m_bcs.valid_conn_handles, + (m_bcs.flags.central_flags) & (m_bcs.flags.connected_flags)); +} + + +sdk_mapped_flags_key_list_t ble_conn_state_periph_handles(void) +{ + return sdk_mapped_flags_key_list_get(m_bcs.valid_conn_handles, + (~m_bcs.flags.central_flags) & (m_bcs.flags.connected_flags)); +} + + +ble_conn_state_user_flag_id_t ble_conn_state_user_flag_acquire(void) +{ + for (ble_conn_state_user_flag_id_t i = BLE_CONN_STATE_USER_FLAG0; + i < BLE_CONN_STATE_N_USER_FLAGS; + i++) + { + if ( !user_flag_is_acquired(i) ) + { + user_flag_acquire(i); + return i; + } + } + + return BLE_CONN_STATE_USER_FLAG_INVALID; +} + + +bool ble_conn_state_user_flag_get(uint16_t conn_handle, ble_conn_state_user_flag_id_t flag_id) +{ + if (user_flag_is_acquired(flag_id)) + { + return sdk_mapped_flags_get_by_key(m_bcs.valid_conn_handles, + m_bcs.flags.user_flags[flag_id], + conn_handle); + } + else + { + return false; + } +} + + +void ble_conn_state_user_flag_set(uint16_t conn_handle, + ble_conn_state_user_flag_id_t flag_id, + bool value) +{ + if (user_flag_is_acquired(flag_id)) + { + sdk_mapped_flags_update_by_key(m_bcs.valid_conn_handles, + &m_bcs.flags.user_flags[flag_id], + conn_handle, + value); + } +} + + +sdk_mapped_flags_t ble_conn_state_user_flag_collection(ble_conn_state_user_flag_id_t flag_id) +{ + if ( user_flag_is_acquired(flag_id) ) + { + return m_bcs.flags.user_flags[flag_id]; + } + else + { + return 0; + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h new file mode 100644 index 0000000000..d5b48aa9cf --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file + * + * @defgroup ble_conn_state Connection state + * @ingroup ble_sdk_lib + * @{ + * @brief Module for storing data on BLE connections. + * + * @details This module stores certain states for each connection, which can be queried by + * connection handle. The module uses BLE events to keep the states updated. + * + * In addition to the preprogrammed states, this module can also keep track of a number of + * binary user states, or user flags. These are reset to 0 for new connections, but + * otherwise not touched by this module. + * + * This module uses the @ref sdk_mapped_flags module, with connection handles as keys and + * the connection states as flags. + * + * @note A connection handle is not immediately invalidated when it is disconnected. Certain states, + * such as the role, can still be queried until the next time a new connection is established + * to any device. + * + * To function properly, this module must be provided with BLE events from the SoftDevice + * through the @ref ble_conn_state_on_ble_evt() function. This module should be the first + * to receive BLE events if they are dispatched to multiple modules. + */ + +#ifndef BLE_CONN_STATE_H__ +#define BLE_CONN_STATE_H__ + +#include +#include +#include "nrf_ble.h" +#include "sdk_mapped_flags.h" + +/**@brief Connection handle statuses. + */ +typedef enum +{ + BLE_CONN_STATUS_INVALID, /**< The connection handle is invalid. */ + BLE_CONN_STATUS_DISCONNECTED, /**< The connection handle refers to a connection that has been disconnected, but not yet invalidated. */ + BLE_CONN_STATUS_CONNECTED, /**< The connection handle refers to an active connection. */ +} ble_conn_state_status_t; + +#define BLE_CONN_STATE_N_USER_FLAGS 24 /**< The number of available user flags. */ + + +/**@brief One ID for each user flag collection. + * + * @details These IDs are used to identify user flag collections in the API calls. + */ +typedef enum +{ + BLE_CONN_STATE_USER_FLAG0 = 0, + BLE_CONN_STATE_USER_FLAG1, + BLE_CONN_STATE_USER_FLAG2, + BLE_CONN_STATE_USER_FLAG3, + BLE_CONN_STATE_USER_FLAG4, + BLE_CONN_STATE_USER_FLAG5, + BLE_CONN_STATE_USER_FLAG6, + BLE_CONN_STATE_USER_FLAG7, + BLE_CONN_STATE_USER_FLAG8, + BLE_CONN_STATE_USER_FLAG9, + BLE_CONN_STATE_USER_FLAG10, + BLE_CONN_STATE_USER_FLAG11, + BLE_CONN_STATE_USER_FLAG12, + BLE_CONN_STATE_USER_FLAG13, + BLE_CONN_STATE_USER_FLAG14, + BLE_CONN_STATE_USER_FLAG15, + BLE_CONN_STATE_USER_FLAG16, + BLE_CONN_STATE_USER_FLAG17, + BLE_CONN_STATE_USER_FLAG18, + BLE_CONN_STATE_USER_FLAG19, + BLE_CONN_STATE_USER_FLAG20, + BLE_CONN_STATE_USER_FLAG21, + BLE_CONN_STATE_USER_FLAG22, + BLE_CONN_STATE_USER_FLAG23, + BLE_CONN_STATE_USER_FLAG_INVALID, +} ble_conn_state_user_flag_id_t; + + +/** + * @defgroup ble_conn_state_functions BLE connection state functions + * @{ + */ + + +/**@brief Function for initializing or resetting the module. + * + * @details This function sets all states to their default, removing all records of connection handles. + */ +void ble_conn_state_init(void); + + +/**@brief Function for providing BLE SoftDevice events to the connection state module. + * + * @param[in] p_ble_evt The SoftDevice event. + */ +void ble_conn_state_on_ble_evt(ble_evt_t * p_ble_evt); + + +/**@brief Function for querying whether a connection handle represents a valid connection. + * + * @details A connection might be valid and have a BLE_CONN_STATUS_DISCONNECTED status. + * Those connections are invalidated after a new connection occurs. + * + * @param[in] conn_handle Handle of the connection. + * + * @retval true If conn_handle represents a valid connection, thus a connection for which + we have a record. + * @retval false If conn_handle is @ref BLE_GAP_ROLE_INVALID, or if it has never been recorded. + */ +bool ble_conn_state_valid(uint16_t conn_handle); + + +/**@brief Function for querying the role of the local device in a connection. + * + * @param[in] conn_handle Handle of the connection to get the role for. + * + * @return The role of the local device in the connection (see @ref BLE_GAP_ROLES). + * If conn_handle is not valid, the function returns BLE_GAP_ROLE_INVALID. + */ +uint8_t ble_conn_state_role(uint16_t conn_handle); + + +/**@brief Function for querying the status of a connection. + * + * @param[in] conn_handle Handle of the connection. + * + * @return The status of the connection. + * If conn_handle is not valid, the function returns BLE_CONN_STATE_INVALID. + */ +ble_conn_state_status_t ble_conn_state_status(uint16_t conn_handle); + + +/**@brief Function for querying whether a connection is encrypted. + * + * @param[in] conn_handle Handle of connection to get the encryption state for. + * + * @retval true If the connection is encrypted. + * @retval false If the connection is not encrypted or conn_handle is invalid. + */ +bool ble_conn_state_encrypted(uint16_t conn_handle); + + +/**@brief Function for querying whether a connection encryption is protected from Man in the Middle + * attacks. + * + * @param[in] conn_handle Handle of connection to get the MITM state for. + * + * @retval true If the connection is encrypted with MITM protection. + * @retval false If the connection is not encrypted, or encryption is not MITM protected, or + * conn_handle is invalid. + */ +bool ble_conn_state_mitm_protected(uint16_t conn_handle); + + +/**@brief Function for querying the total number of connections. + * + * @return The total number of valid connections for which the module has a record. + */ +uint32_t ble_conn_state_n_connections(void); + + +/**@brief Function for querying the total number of connections in which the role of the local + * device is @ref BLE_GAP_ROLE_CENTRAL. + * + * @return The number of connections in which the role of the local device is + * @ref BLE_GAP_ROLE_CENTRAL. + */ +uint32_t ble_conn_state_n_centrals(void); + + +/**@brief Function for querying the total number of connections in which the role of the local + * device is @ref BLE_GAP_ROLE_PERIPH. + * + * @return The number of connections in which the role of the local device is + * @ref BLE_GAP_ROLE_PERIPH. + */ +uint32_t ble_conn_state_n_peripherals(void); + + +/**@brief Function for obtaining a list of all connection handles for which the module has a record. + * + * @details This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED. + * + * @return A list of all valid connection handles for which the module has a record. + */ +sdk_mapped_flags_key_list_t ble_conn_state_conn_handles(void); + + +/**@brief Function for obtaining a list of connection handles in which the role of the local + * device is @ref BLE_GAP_ROLE_CENTRAL. + * + * @details This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED. + * + * @return A list of all valid connection handles for which the module has a record and in which + * the role of local device is @ref BLE_GAP_ROLE_CENTRAL. + */ +sdk_mapped_flags_key_list_t ble_conn_state_central_handles(void); + + +/**@brief Function for obtaining the handle for the connection in which the role of the local device + * is @ref BLE_GAP_ROLE_PERIPH. + * + * @details This function takes into account connections whose state is BLE_CONN_STATUS_DISCONNECTED. + * + * @return A list of all valid connection handles for which the module has a record and in which + * the role of local device is @ref BLE_GAP_ROLE_PERIPH. + */ +sdk_mapped_flags_key_list_t ble_conn_state_periph_handles(void); + + +/**@brief Function for obtaining exclusive access to one of the user flag collections. + * + * @details The acquired collection contains one flag for each connection. These flags can be set + * and read individually for each connection. + * + * The state of user flags will not be modified by the connection state module, except to + * set it to 0 for a connection when that connection is invalidated. + * + * @return The ID of the acquired flag, or BLE_CONN_STATE_USER_FLAG_INVALID if none are available. + */ +ble_conn_state_user_flag_id_t ble_conn_state_user_flag_acquire(void); + + +/**@brief Function for reading the value of a user flag. + * + * @param[in] conn_handle Handle of connection to get the flag state for. + * @param[in] flag_id Which flag to get the state for. + * + * @return The state of the flag. If conn_handle is invalid, the function returns false. + */ +bool ble_conn_state_user_flag_get(uint16_t conn_handle, ble_conn_state_user_flag_id_t flag_id); + + +/**@brief Function for setting the value of a user flag. + * + * @param[in] conn_handle Handle of connection to set the flag state for. + * @param[in] flag_id Which flag to set the state for. + * @param[in] value Value to set the flag state to. + */ +void ble_conn_state_user_flag_set(uint16_t conn_handle, + ble_conn_state_user_flag_id_t flag_id, + bool value); + + +/**@brief Function for getting the state of a user flag for all connection handles. + * + * @details The returned collection can be used with the @ref sdk_mapped_flags API. The returned + * collection is a copy, so modifying it has no effect on the conn_state module. + * + * @param[in] flag_id Which flag to get states for. + * + * @return The collection of flag states. The collection is always all zeros when the flag_id is + * unregistered. + */ +sdk_mapped_flags_t ble_conn_state_user_flag_collection(ble_conn_state_user_flag_id_t flag_id); + +/** @} */ +/** @} */ + +#endif /* BLE_CONN_STATE_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_date_time.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_date_time.h new file mode 100644 index 0000000000..7112223857 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_date_time.h @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2011 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +/** @file + * @brief Contains definition of ble_date_time structure. + */ + +/** @file + * + * @defgroup ble_sdk_srv_date_time BLE Date Time characteristic type + * @{ + * @ingroup ble_sdk_lib + * @brief Definition of ble_date_time_t type. + */ + +#ifndef BLE_DATE_TIME_H__ +#define BLE_DATE_TIME_H__ + +#include + +/**@brief Date and Time structure. */ +typedef struct +{ + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hours; + uint8_t minutes; + uint8_t seconds; +} ble_date_time_t; + +static __INLINE uint8_t ble_date_time_encode(const ble_date_time_t * p_date_time, + uint8_t * p_encoded_data) +{ + uint8_t len = uint16_encode(p_date_time->year, p_encoded_data); + + p_encoded_data[len++] = p_date_time->month; + p_encoded_data[len++] = p_date_time->day; + p_encoded_data[len++] = p_date_time->hours; + p_encoded_data[len++] = p_date_time->minutes; + p_encoded_data[len++] = p_date_time->seconds; + + return len; +} + +static __INLINE uint8_t ble_date_time_decode(ble_date_time_t * p_date_time, + const uint8_t * p_encoded_data) +{ + uint8_t len = sizeof(uint16_t); + + p_date_time->year = uint16_decode(p_encoded_data); + p_date_time->month = p_encoded_data[len++]; + p_date_time->day = p_encoded_data[len++]; + p_date_time->hours = p_encoded_data[len++]; + p_date_time->minutes = p_encoded_data[len++]; + p_date_time->seconds = p_encoded_data[len++]; + + return len; +} + +#endif // BLE_DATE_TIME_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h new file mode 100644 index 0000000000..9e9b0deed4 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + /**@file + * + * @defgroup ble_sdk_lib_gatt_db GATT Database Service Structure + * @{ + * @ingroup app_common + */ + +#ifndef BLE_GATT_DB_H__ +#define BLE_GATT_DB_H__ + +#include +#include "nrf_ble.h" +#include "nrf_ble_gattc.h" + +#define BLE_GATT_DB_MAX_CHARS 5 /**< The maximum number of characteristics present in a service record. */ + +/**@brief Structure for holding the characteristic and the handle of its CCCD present on a server. + */ +typedef struct +{ + ble_gattc_char_t characteristic; /**< Structure containing information about the characteristic. */ + uint16_t cccd_handle; /**< CCCD Handle value for this characteristic. This will be set to BLE_GATT_HANDLE_INVALID if a CCCD is not present at the server. */ +} ble_gatt_db_char_t; + +/**@brief Structure for holding information about the service and the characteristics present on a + * server. + */ +typedef struct +{ + ble_uuid_t srv_uuid; /**< UUID of the service. */ + uint8_t char_count; /**< Number of characteristics present in the service. */ + ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */ + ble_gatt_db_char_t charateristics[BLE_GATT_DB_MAX_CHARS]; /**< Array of information related to the characteristics present in the service. This list can extend further than one. */ +} ble_gatt_db_srv_t; + +#endif /* BLE_GATT_DB_H__ */ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_sensor_location.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_sensor_location.h new file mode 100644 index 0000000000..43311a6077 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_sensor_location.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + /* Attention! +* To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#ifndef BLE_SENSOR_LOCATION_H__ +#define BLE_SENSOR_LOCATION_H__ + +typedef enum { + BLE_SENSOR_LOCATION_OTHER = 0 , /**<-- Other */ + BLE_SENSOR_LOCATION_TOP_OF_SHOE = 1 , /**<-- Top of shoe */ + BLE_SENSOR_LOCATION_IN_SHOE = 2 , /**<-- In shoe */ + BLE_SENSOR_LOCATION_HIP = 3 , /**<-- Hip */ + BLE_SENSOR_LOCATION_FRONT_WHEEL = 4 , /**<-- Front Wheel */ + BLE_SENSOR_LOCATION_LEFT_CRANK = 5 , /**<-- Left Crank */ + BLE_SENSOR_LOCATION_RIGHT_CRANK = 6 , /**<-- Right Crank */ + BLE_SENSOR_LOCATION_LEFT_PEDAL = 7 , /**<-- Left Pedal */ + BLE_SENSOR_LOCATION_RIGHT_PEDAL = 8 , /**<-- Right Pedal */ + BLE_SENSOR_LOCATION_FRONT_HUB = 9 , /**<-- Front Hub */ + BLE_SENSOR_LOCATION_REAR_DROPOUT = 10, /**<-- Rear Dropout */ + BLE_SENSOR_LOCATION_CHAINSTAY = 11, /**<-- Chainstay */ + BLE_SENSOR_LOCATION_REAR_WHEEL = 12, /**<-- Rear Wheel */ + BLE_SENSOR_LOCATION_REAR_HUB = 13, /**<-- Rear Hub */ +}ble_sensor_location_t; + +#define BLE_NB_MAX_SENSOR_LOCATIONS 14 + +#endif // BLE_SENSOR_LOCATION_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c new file mode 100644 index 0000000000..42cd2d4f2a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASA�s Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_srv_common.h" +#include +#include "nordic_common.h" +#include "app_error.h" +#include "nrf_ble.h" + +uint8_t ble_srv_report_ref_encode(uint8_t * p_encoded_buffer, + const ble_srv_report_ref_t * p_report_ref) +{ + uint8_t len = 0; + + p_encoded_buffer[len++] = p_report_ref->report_id; + p_encoded_buffer[len++] = p_report_ref->report_type; + + APP_ERROR_CHECK_BOOL(len == BLE_SRV_ENCODED_REPORT_REF_LEN); + return len; +} + + +void ble_srv_ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, char * p_ascii) +{ + p_utf8->length = (uint16_t)strlen(p_ascii); + p_utf8->p_str = (uint8_t *)p_ascii; +} + + +/**@brief Function for setting security requirements of a characteristic. + * + * @param[in] level required security level. + * @param[out] p_perm Characteristic security requirements. + * + * @return encoded security level and security mode. + */ +static inline void set_security_req(security_req_t level, ble_gap_conn_sec_mode_t * p_perm) +{ + + + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(p_perm); + switch (level) + { + case SEC_NO_ACCESS: + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(p_perm); + break; + case SEC_OPEN: + BLE_GAP_CONN_SEC_MODE_SET_OPEN(p_perm); + break; + case SEC_JUST_WORKS: + BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(p_perm); + break; + case SEC_MITM: + BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(p_perm); + break; + case SEC_SIGNED: + BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(p_perm); + break; + case SEC_SIGNED_MITM: + BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(p_perm); + break; + } + return; +} + + +uint32_t characteristic_add(uint16_t service_handle, + ble_add_char_params_t * p_char_props, + ble_gatts_char_handles_t * p_char_handle) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t attr_md; + ble_gatts_attr_md_t user_descr_attr_md; + ble_gatts_attr_md_t cccd_md; + + if (p_char_props->uuid_type == 0) + { + char_uuid.type = BLE_UUID_TYPE_BLE; + } + else + { + char_uuid.type = p_char_props->uuid_type; + } + char_uuid.uuid = p_char_props->uuid; + + memset(&attr_md, 0, sizeof(ble_gatts_attr_md_t)); + set_security_req(p_char_props->read_access, &attr_md.read_perm); + set_security_req(p_char_props->write_access, & attr_md.write_perm); + attr_md.rd_auth = (p_char_props->is_defered_read ? 1 : 0); + attr_md.wr_auth = (p_char_props->is_defered_write ? 1 : 0); + attr_md.vlen = (p_char_props->is_var_len ? 1 : 0); + attr_md.vloc = (p_char_props->is_value_user ? BLE_GATTS_VLOC_USER : BLE_GATTS_VLOC_STACK); + + + memset(&char_md, 0, sizeof(ble_gatts_char_md_t)); + if ((p_char_props->char_props.notify == 1)||(p_char_props->char_props.indicate == 1)) + { + + memset(&cccd_md, 0, sizeof(cccd_md)); + set_security_req(p_char_props->cccd_write_access, &cccd_md.write_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + + char_md.p_cccd_md = &cccd_md; + } + char_md.char_props = p_char_props->char_props; + + memset(&attr_char_value, 0, sizeof(ble_gatts_attr_t)); + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.max_len = p_char_props->max_len; + if (p_char_props->p_init_value != NULL) + { + attr_char_value.init_len = p_char_props->init_len; + attr_char_value.p_value = p_char_props->p_init_value; + } + if (p_char_props->p_user_descr != NULL) + { + memset(&user_descr_attr_md, 0, sizeof(ble_gatts_attr_md_t)); + char_md.char_user_desc_max_size = p_char_props->p_user_descr->max_size; + char_md.char_user_desc_size = p_char_props->p_user_descr->size; + char_md.p_char_user_desc = p_char_props->p_user_descr->p_char_user_desc; + + char_md.p_user_desc_md = &user_descr_attr_md; + + set_security_req(p_char_props->p_user_descr->read_access, &user_descr_attr_md.read_perm); + set_security_req(p_char_props->p_user_descr->write_access, &user_descr_attr_md.write_perm); + + user_descr_attr_md.rd_auth = (p_char_props->p_user_descr->is_defered_read ? 1 : 0); + user_descr_attr_md.wr_auth = (p_char_props->p_user_descr->is_defered_write ? 1 : 0); + user_descr_attr_md.vlen = (p_char_props->p_user_descr->is_var_len ? 1 : 0); + user_descr_attr_md.vloc = (p_char_props->p_user_descr->is_value_user ? BLE_GATTS_VLOC_USER : BLE_GATTS_VLOC_STACK); + } + if (p_char_props->p_presentation_format != NULL) + { + char_md.p_char_pf = p_char_props->p_presentation_format; + } + return sd_ble_gatts_characteristic_add(service_handle, + &char_md, + &attr_char_value, + p_char_handle); +} + + +uint32_t descriptor_add(uint16_t char_handle, + ble_add_descr_params_t * p_descr_props, + uint16_t * p_descr_handle) +{ + ble_gatts_attr_t descr_params; + ble_uuid_t desc_uuid; + ble_gatts_attr_md_t attr_md; + + memset(&descr_params, 0, sizeof(descr_params)); + if (p_descr_props->uuid_type == 0) + { + desc_uuid.type = BLE_UUID_TYPE_BLE; + } + else + { + desc_uuid.type = p_descr_props->uuid_type; + } + desc_uuid.uuid = p_descr_props->uuid; + descr_params.p_uuid = &desc_uuid; + + set_security_req(p_descr_props->read_access, &attr_md.read_perm); + set_security_req(p_descr_props->write_access,&attr_md.write_perm); + + attr_md.rd_auth = (p_descr_props->is_defered_read ? 1 : 0); + attr_md.wr_auth = (p_descr_props->is_defered_write ? 1 : 0); + attr_md.vlen = (p_descr_props->is_var_len ? 1 : 0); + attr_md.vloc = (p_descr_props->is_value_user ? BLE_GATTS_VLOC_USER : BLE_GATTS_VLOC_STACK); + descr_params.p_attr_md = &attr_md; + + descr_params.init_len = p_descr_props->init_len; + descr_params.init_offs = p_descr_props->init_offs; + descr_params.max_len = p_descr_props->max_len; + descr_params.p_value = p_descr_props->p_value; + + return sd_ble_gatts_descriptor_add(char_handle, &descr_params, p_descr_handle); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h new file mode 100644 index 0000000000..79a7ad0bfc --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h @@ -0,0 +1,394 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_sdk_srv_common Common service definitions + * @{ + * @ingroup ble_sdk_srv + * @brief Constants, type definitions, and functions that are common to all services. + */ + +#ifndef BLE_SRV_COMMON_H__ +#define BLE_SRV_COMMON_H__ + +#include +#include +#include "nrf_ble_types.h" +#include "app_util.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "nrf_ble_gatt.h" + +/** @defgroup UUID_SERVICES Service UUID definitions + * @{ */ +#define BLE_UUID_ALERT_NOTIFICATION_SERVICE 0x1811 /**< Alert Notification service UUID. */ +#define BLE_UUID_BATTERY_SERVICE 0x180F /**< Battery service UUID. */ +#define BLE_UUID_BLOOD_PRESSURE_SERVICE 0x1810 /**< Blood Pressure service UUID. */ +#define BLE_UUID_CURRENT_TIME_SERVICE 0x1805 /**< Current Time service UUID. */ +#define BLE_UUID_CYCLING_SPEED_AND_CADENCE 0x1816 /**< Cycling Speed and Cadence service UUID. */ +#define BLE_UUID_LOCATION_AND_NAVIGATION_SERVICE 0x1819 /**< Location and Navigation service UUID. */ +#define BLE_UUID_DEVICE_INFORMATION_SERVICE 0x180A /**< Device Information service UUID. */ +#define BLE_UUID_GLUCOSE_SERVICE 0x1808 /**< Glucose service UUID. */ +#define BLE_UUID_HEALTH_THERMOMETER_SERVICE 0x1809 /**< Health Thermometer service UUID. */ +#define BLE_UUID_HEART_RATE_SERVICE 0x180D /**< Heart Rate service UUID. */ +#define BLE_UUID_HUMAN_INTERFACE_DEVICE_SERVICE 0x1812 /**< Human Interface Device service UUID. */ +#define BLE_UUID_IMMEDIATE_ALERT_SERVICE 0x1802 /**< Immediate Alert service UUID. */ +#define BLE_UUID_LINK_LOSS_SERVICE 0x1803 /**< Link Loss service UUID. */ +#define BLE_UUID_NEXT_DST_CHANGE_SERVICE 0x1807 /**< Next Dst Change service UUID. */ +#define BLE_UUID_PHONE_ALERT_STATUS_SERVICE 0x180E /**< Phone Alert Status service UUID. */ +#define BLE_UUID_REFERENCE_TIME_UPDATE_SERVICE 0x1806 /**< Reference Time Update service UUID. */ +#define BLE_UUID_RUNNING_SPEED_AND_CADENCE 0x1814 /**< Running Speed and Cadence service UUID. */ +#define BLE_UUID_SCAN_PARAMETERS_SERVICE 0x1813 /**< Scan Parameters service UUID. */ +#define BLE_UUID_TX_POWER_SERVICE 0x1804 /**< TX Power service UUID. */ +#define BLE_UUID_IPSP_SERVICE 0x1820 /**< Internet Protocol Support service UUID. */ +#define BLE_UUID_BMS_SERVICE 0x181E /**< BOND MANAGEMENT service UUID*/ +#define BLE_UUID_CGM_SERVICE 0x181F /**< Contiunous Glucose Monitoring service UUID*/ +#define BLE_UUID_PLX_SERVICE 0x1822 /**< Pulse Oximeter Service UUID*/ + + +/** @} */ + +/** @defgroup UUID_CHARACTERISTICS Characteristic UUID definitions + * @{ */ +#define BLE_UUID_REMOVABLE_CHAR 0x2A3A /**< Removable characteristic UUID. */ +#define BLE_UUID_SERVICE_REQUIRED_CHAR 0x2A3B /**< Service Required characteristic UUID. */ +#define BLE_UUID_ALERT_CATEGORY_ID_CHAR 0x2A43 /**< Alert Category Id characteristic UUID. */ +#define BLE_UUID_ALERT_CATEGORY_ID_BIT_MASK_CHAR 0x2A42 /**< Alert Category Id Bit Mask characteristic UUID. */ +#define BLE_UUID_ALERT_LEVEL_CHAR 0x2A06 /**< Alert Level characteristic UUID. */ +#define BLE_UUID_ALERT_NOTIFICATION_CONTROL_POINT_CHAR 0x2A44 /**< Alert Notification Control Point characteristic UUID. */ +#define BLE_UUID_ALERT_STATUS_CHAR 0x2A3F /**< Alert Status characteristic UUID. */ +#define BLE_UUID_BATTERY_LEVEL_CHAR 0x2A19 /**< Battery Level characteristic UUID. */ +#define BLE_UUID_BLOOD_PRESSURE_FEATURE_CHAR 0x2A49 /**< Blood Pressure Feature characteristic UUID. */ +#define BLE_UUID_BLOOD_PRESSURE_MEASUREMENT_CHAR 0x2A35 /**< Blood Pressure Measurement characteristic UUID. */ +#define BLE_UUID_BODY_SENSOR_LOCATION_CHAR 0x2A38 /**< Body Sensor Location characteristic UUID. */ +#define BLE_UUID_BOOT_KEYBOARD_INPUT_REPORT_CHAR 0x2A22 /**< Boot Keyboard Input Report characteristic UUID. */ +#define BLE_UUID_BOOT_KEYBOARD_OUTPUT_REPORT_CHAR 0x2A32 /**< Boot Keyboard Output Report characteristic UUID. */ +#define BLE_UUID_BOOT_MOUSE_INPUT_REPORT_CHAR 0x2A33 /**< Boot Mouse Input Report characteristic UUID. */ +#define BLE_UUID_CURRENT_TIME_CHAR 0x2A2B /**< Current Time characteristic UUID. */ +#define BLE_UUID_DATE_TIME_CHAR 0x2A08 /**< Date Time characteristic UUID. */ +#define BLE_UUID_DAY_DATE_TIME_CHAR 0x2A0A /**< Day Date Time characteristic UUID. */ +#define BLE_UUID_DAY_OF_WEEK_CHAR 0x2A09 /**< Day Of Week characteristic UUID. */ +#define BLE_UUID_DST_OFFSET_CHAR 0x2A0D /**< Dst Offset characteristic UUID. */ +#define BLE_UUID_EXACT_TIME_256_CHAR 0x2A0C /**< Exact Time 256 characteristic UUID. */ +#define BLE_UUID_FIRMWARE_REVISION_STRING_CHAR 0x2A26 /**< Firmware Revision String characteristic UUID. */ +#define BLE_UUID_GLUCOSE_FEATURE_CHAR 0x2A51 /**< Glucose Feature characteristic UUID. */ +#define BLE_UUID_GLUCOSE_MEASUREMENT_CHAR 0x2A18 /**< Glucose Measurement characteristic UUID. */ +#define BLE_UUID_GLUCOSE_MEASUREMENT_CONTEXT_CHAR 0x2A34 /**< Glucose Measurement Context characteristic UUID. */ +#define BLE_UUID_HARDWARE_REVISION_STRING_CHAR 0x2A27 /**< Hardware Revision String characteristic UUID. */ +#define BLE_UUID_HEART_RATE_CONTROL_POINT_CHAR 0x2A39 /**< Heart Rate Control Point characteristic UUID. */ +#define BLE_UUID_HEART_RATE_MEASUREMENT_CHAR 0x2A37 /**< Heart Rate Measurement characteristic UUID. */ +#define BLE_UUID_HID_CONTROL_POINT_CHAR 0x2A4C /**< Hid Control Point characteristic UUID. */ +#define BLE_UUID_HID_INFORMATION_CHAR 0x2A4A /**< Hid Information characteristic UUID. */ +#define BLE_UUID_IEEE_REGULATORY_CERTIFICATION_DATA_LIST_CHAR 0x2A2A /**< IEEE Regulatory Certification Data List characteristic UUID. */ +#define BLE_UUID_INTERMEDIATE_CUFF_PRESSURE_CHAR 0x2A36 /**< Intermediate Cuff Pressure characteristic UUID. */ +#define BLE_UUID_INTERMEDIATE_TEMPERATURE_CHAR 0x2A1E /**< Intermediate Temperature characteristic UUID. */ +#define BLE_UUID_LOCAL_TIME_INFORMATION_CHAR 0x2A0F /**< Local Time Information characteristic UUID. */ +#define BLE_UUID_MANUFACTURER_NAME_STRING_CHAR 0x2A29 /**< Manufacturer Name String characteristic UUID. */ +#define BLE_UUID_MEASUREMENT_INTERVAL_CHAR 0x2A21 /**< Measurement Interval characteristic UUID. */ +#define BLE_UUID_MODEL_NUMBER_STRING_CHAR 0x2A24 /**< Model Number String characteristic UUID. */ +#define BLE_UUID_UNREAD_ALERT_CHAR 0x2A45 /**< Unread Alert characteristic UUID. */ +#define BLE_UUID_NEW_ALERT_CHAR 0x2A46 /**< New Alert characteristic UUID. */ +#define BLE_UUID_PNP_ID_CHAR 0x2A50 /**< PNP Id characteristic UUID. */ +#define BLE_UUID_PROTOCOL_MODE_CHAR 0x2A4E /**< Protocol Mode characteristic UUID. */ +#define BLE_UUID_RECORD_ACCESS_CONTROL_POINT_CHAR 0x2A52 /**< Record Access Control Point characteristic UUID. */ +#define BLE_UUID_REFERENCE_TIME_INFORMATION_CHAR 0x2A14 /**< Reference Time Information characteristic UUID. */ +#define BLE_UUID_REPORT_CHAR 0x2A4D /**< Report characteristic UUID. */ +#define BLE_UUID_REPORT_MAP_CHAR 0x2A4B /**< Report Map characteristic UUID. */ +#define BLE_UUID_RINGER_CONTROL_POINT_CHAR 0x2A40 /**< Ringer Control Point characteristic UUID. */ +#define BLE_UUID_RINGER_SETTING_CHAR 0x2A41 /**< Ringer Setting characteristic UUID. */ +#define BLE_UUID_SCAN_INTERVAL_WINDOW_CHAR 0x2A4F /**< Scan Interval Window characteristic UUID. */ +#define BLE_UUID_SCAN_REFRESH_CHAR 0x2A31 /**< Scan Refresh characteristic UUID. */ +#define BLE_UUID_SERIAL_NUMBER_STRING_CHAR 0x2A25 /**< Serial Number String characteristic UUID. */ +#define BLE_UUID_SOFTWARE_REVISION_STRING_CHAR 0x2A28 /**< Software Revision String characteristic UUID. */ +#define BLE_UUID_SUPPORTED_NEW_ALERT_CATEGORY_CHAR 0x2A47 /**< Supported New Alert Category characteristic UUID. */ +#define BLE_UUID_SUPPORTED_UNREAD_ALERT_CATEGORY_CHAR 0x2A48 /**< Supported Unread Alert Category characteristic UUID. */ +#define BLE_UUID_SYSTEM_ID_CHAR 0x2A23 /**< System Id characteristic UUID. */ +#define BLE_UUID_TEMPERATURE_MEASUREMENT_CHAR 0x2A1C /**< Temperature Measurement characteristic UUID. */ +#define BLE_UUID_TEMPERATURE_TYPE_CHAR 0x2A1D /**< Temperature Type characteristic UUID. */ +#define BLE_UUID_TIME_ACCURACY_CHAR 0x2A12 /**< Time Accuracy characteristic UUID. */ +#define BLE_UUID_TIME_SOURCE_CHAR 0x2A13 /**< Time Source characteristic UUID. */ +#define BLE_UUID_TIME_UPDATE_CONTROL_POINT_CHAR 0x2A16 /**< Time Update Control Point characteristic UUID. */ +#define BLE_UUID_TIME_UPDATE_STATE_CHAR 0x2A17 /**< Time Update State characteristic UUID. */ +#define BLE_UUID_TIME_WITH_DST_CHAR 0x2A11 /**< Time With Dst characteristic UUID. */ +#define BLE_UUID_TIME_ZONE_CHAR 0x2A0E /**< Time Zone characteristic UUID. */ +#define BLE_UUID_TX_POWER_LEVEL_CHAR 0x2A07 /**< TX Power Level characteristic UUID. */ +#define BLE_UUID_CSC_FEATURE_CHAR 0x2A5C /**< Cycling Speed and Cadence Feature characteristic UUID. */ +#define BLE_UUID_CSC_MEASUREMENT_CHAR 0x2A5B /**< Cycling Speed and Cadence Measurement characteristic UUID. */ +#define BLE_UUID_RSC_FEATURE_CHAR 0x2A54 /**< Running Speed and Cadence Feature characteristic UUID. */ +#define BLE_UUID_SC_CTRLPT_CHAR 0x2A55 /**< Speed and Cadence Control Point UUID. */ +#define BLE_UUID_RSC_MEASUREMENT_CHAR 0x2A53 /**< Running Speed and Cadence Measurement characteristic UUID. */ +#define BLE_UUID_SENSOR_LOCATION_CHAR 0x2A5D /**< Sensor Location characteristic UUID. */ +#define BLE_UUID_EXTERNAL_REPORT_REF_DESCR 0x2907 /**< External Report Reference descriptor UUID. */ +#define BLE_UUID_REPORT_REF_DESCR 0x2908 /**< Report Reference descriptor UUID. */ +#define BLE_UUID_LN_FEATURE_CHAR 0x2A6A /**< Location Navigation Service, Feature characteristic UUID. */ +#define BLE_UUID_LN_POSITION_QUALITY_CHAR 0x2A69 /**< Location Navigation Service, Position quality UUID. */ +#define BLE_UUID_LN_LOCATION_AND_SPEED_CHAR 0x2A67 /**< Location Navigation Service, Location and Speed characteristic UUID. */ +#define BLE_UUID_LN_NAVIGATION_CHAR 0x2A68 /**< Location Navigation Service, Navigation characteristic UUID. */ +#define BLE_UUID_LN_CONTROL_POINT_CHAR 0x2A6B /**< Location Navigation Service, Control point characteristic UUID. */ +#define BLE_UUID_BMS_CTRLPT 0x2AA4 /**< BMS Control Point characteristic UUID. */ +#define BLE_UUID_BMS_FEATURE 0x2AA5 /**< BMS Feature characteristic UUID. */ +#define BLE_UUID_CGM_MEASUREMENT 0x2AA7 /**< CGM Service, Measurement characteristic UUID*/ +#define BLE_UUID_CGM_FEATURE 0x2AA8 /**< CGM Service, Feature characteristic UUID*/ +#define BLE_UUID_CGM_STATUS 0x2AA9 /**< CGM Service, Status characteristic UUID*/ +#define BLE_UUID_CGM_SESSION_START_TIME 0x2AAA /**< CGM Service, session start time characteristic UUID*/ +#define BLE_UUID_CGM_SESSION_RUN_TIME 0x2AAB /**< CGM Service, session run time characteristic UUID*/ +#define BLE_UUID_CGM_SPECIFIC_OPS_CTRLPT 0x2AAC /**< CGM Service, specific ops ctrlpt characteristic UUID*/ +#define BLE_UUID_PLX_SPOT_CHECK_MEAS 0x2A5E /**< PLX Service, spot check measurement characteristic UUID*/ +#define BLE_UUID_PLX_CONTINUOUS_MEAS 0x2A5F /**< PLX Service, continuous measurement characteristic UUID*/ +#define BLE_UUID_PLX_FEATURES 0x2A60 /**< PLX Service, feature characteristic UUID*/ + + + + + +/** @} */ + +/** @defgroup ALERT_LEVEL_VALUES Definitions for the Alert Level characteristic values + * @{ */ +#define BLE_CHAR_ALERT_LEVEL_NO_ALERT 0x00 /**< No Alert. */ +#define BLE_CHAR_ALERT_LEVEL_MILD_ALERT 0x01 /**< Mild Alert. */ +#define BLE_CHAR_ALERT_LEVEL_HIGH_ALERT 0x02 /**< High Alert. */ +/** @} */ + +#define BLE_SRV_ENCODED_REPORT_REF_LEN 2 /**< The length of an encoded Report Reference Descriptor. */ +#define BLE_CCCD_VALUE_LEN 2 /**< The length of a CCCD value. */ + +/**@brief Type definition for error handler function that will be called in case of an error in + * a service or a service library module. */ +typedef void (*ble_srv_error_handler_t) (uint32_t nrf_error); + + + +/**@brief Value of a Report Reference descriptor. + * + * @details This is mapping information that maps the parent characteristic to the Report ID(s) and + * Report Type(s) defined within a Report Map characteristic. + */ +typedef struct +{ + uint8_t report_id; /**< Non-zero value if there is more than one instance of the same Report Type */ + uint8_t report_type; /**< Type of Report characteristic (see @ref BLE_HIDS_REPORT_TYPE) */ +} ble_srv_report_ref_t; + +/**@brief UTF-8 string data type. + * + * @note The type can only hold a pointer to the string data (i.e. not the actual data). + */ +typedef struct +{ + uint16_t length; /**< String length. */ + uint8_t * p_str; /**< String data. */ +} ble_srv_utf8_str_t; + + +/**@brief Security settings structure. + * @details This structure contains the security options needed during initialization of the + * service. + */ +typedef struct +{ + ble_gap_conn_sec_mode_t read_perm; /**< Read permissions. */ + ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */ +} ble_srv_security_mode_t; + +/**@brief Security settings structure. + * @details This structure contains the security options needed during initialization of the + * service. It can be used when the characteristics contains a CCCD. + */ +typedef struct +{ + ble_gap_conn_sec_mode_t cccd_write_perm; /**< Write permissions for Client Characteristic Configuration Descriptor. */ + ble_gap_conn_sec_mode_t read_perm; /**< Read permissions. */ + ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */ +} ble_srv_cccd_security_mode_t; + +/**@brief Function for decoding a CCCD value, and then testing if notification is + * enabled. + * + * @param[in] p_encoded_data Buffer where the encoded CCCD is stored. + * + * @retval TRUE If notification is enabled. + * @retval FALSE Otherwise. + */ +static __INLINE bool ble_srv_is_notification_enabled(uint8_t const * p_encoded_data) +{ + uint16_t cccd_value = uint16_decode(p_encoded_data); + return ((cccd_value & BLE_GATT_HVX_NOTIFICATION) != 0); +} + +/**@brief Function for decoding a CCCD value, and then testing if indication is + * enabled. + * + * @param[in] p_encoded_data Buffer where the encoded CCCD is stored. + * + * @retval TRUE If indication is enabled. + * @retval FALSE Otherwise. + */ +static __INLINE bool ble_srv_is_indication_enabled(uint8_t const * p_encoded_data) +{ + uint16_t cccd_value = uint16_decode(p_encoded_data); + return ((cccd_value & BLE_GATT_HVX_INDICATION) != 0); +} + +/**@brief Function for encoding a Report Reference Descriptor. + * + * @param[in] p_encoded_buffer The buffer of the encoded data. + * @param[in] p_report_ref Report Reference value to be encoded. + * + * @return Length of the encoded data. + */ +uint8_t ble_srv_report_ref_encode(uint8_t * p_encoded_buffer, + const ble_srv_report_ref_t * p_report_ref); + +/**@brief Function for making a UTF-8 structure refer to an ASCII string. + * + * @param[out] p_utf8 UTF-8 structure to be set. + * @param[in] p_ascii ASCII string to be referred to. + */ +void ble_srv_ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, char * p_ascii); + + +/**@brief Security Access enumeration. + * @details This enumeration gives the possible requirements for accessing a characteristic value. + */ +typedef enum +{ + SEC_NO_ACCESS = 0, /**< Not possible to access. */ + SEC_OPEN = 1, /**< Access open. */ + SEC_JUST_WORKS = 2, /**< Access possible with 'Just Works' security at least. */ + SEC_MITM = 3, /**< Access possible with 'MITM' security at least. */ + SEC_SIGNED = 4, /**< Access possible with 'signed' security at least. */ + SEC_SIGNED_MITM = 5 /**< Access possible with 'signed and MITM' security at least. */ +}security_req_t; + + +/**@brief Characteristic User Descriptor parameters. + * @details This structure contains the parameters for User Descriptor. + */ +typedef struct +{ + uint16_t max_size; /**< Maximum size of the user descriptor*/ + uint16_t size; /**< Size of the user descriptor*/ + uint8_t *p_char_user_desc; /**< User descriptor content, pointer to a UTF-8 encoded string (non-NULL terminated)*/ + bool is_var_len; /**< Indicates if the user descriptor has variable length.*/ + ble_gatt_char_props_t char_props; /**< user descriptor properties.*/ + bool is_defered_read; /**< Indicate if deferred read operations are supported.*/ + bool is_defered_write; /**< Indicate if deferred write operations are supported.*/ + security_req_t read_access; /**< Security requirement for reading the user descriptor.*/ + security_req_t write_access; /**< Security requirement for writing the user descriptor.*/ + bool is_value_user; /**< Indicate if the content of the characteristic is to be stored in the application (user) or in the stack.*/ +}ble_add_char_user_desc_t; + + +/**@brief Add characteristic parameters structure. + * @details This structure contains the parameters needed to use the @ref characteristic_add function. + */ +typedef struct +{ + uint16_t uuid; /**< Characteristic UUID (16 bits UUIDs).*/ + uint8_t uuid_type; /**< Base UUID. If 0, the Bluetooth SIG UUID will be used. Otherwise, this should be a value returned by @ref sd_ble_uuid_vs_add when adding the base UUID.*/ + uint16_t max_len; /**< Maximum length of the characteristic value.*/ + uint16_t init_len; /**< Initial length of the characteristic value.*/ + uint8_t * p_init_value; /**< Initial encoded value of the characteristic.*/ + bool is_var_len; /**< Indicates if the characteristic value has variable length.*/ + ble_gatt_char_props_t char_props; /**< Characteristic properties.*/ + bool is_defered_read; /**< Indicate if deferred read operations are supported.*/ + bool is_defered_write; /**< Indicate if deferred write operations are supported.*/ + security_req_t read_access; /**< Security requirement for reading the characteristic value.*/ + security_req_t write_access; /**< Security requirement for writing the characteristic value.*/ + security_req_t cccd_write_access; /**< Security requirement for writing the characteristic's CCCD.*/ + bool is_value_user; /**< Indicate if the content of the characteristic is to be stored in the application (user) or in the stack.*/ + ble_add_char_user_desc_t *p_user_descr; /**< Pointer to user descriptor if needed*/ + ble_gatts_char_pf_t *p_presentation_format; /**< Pointer to characteristic format if needed*/ +} ble_add_char_params_t; + + +/**@brief Add descriptor parameters structure. + * @details This structure contains the parameters needed to use the @ref descriptor_add function. + */ +typedef struct +{ + uint16_t uuid; /**< descriptor UUID (16 bits UUIDs).*/ + uint8_t uuid_type; /**< Base UUID. If 0, the Bluetooth SIG UUID will be used. Otherwise, this should be a value returned by @ref sd_ble_uuid_vs_add when adding the base UUID.*/ + bool is_defered_read; /**< Indicate if deferred read operations are supported.*/ + bool is_defered_write; /**< Indicate if deferred write operations are supported.*/ + bool is_var_len; /**< Indicates if the descriptor value has variable length.*/ + security_req_t read_access; /**< Security requirement for reading the descriptor value.*/ + security_req_t write_access; /**< Security requirement for writing the descriptor value.*/ + bool is_value_user; /**< Indicate if the content of the characteristic is to be stored in the application (user) or in the stack.*/ + uint16_t init_len; /**< Initial descriptor value length in bytes. */ + uint16_t init_offs; /**< Initial descriptor value offset in bytes. If different from zero, the first init_offs bytes of the attribute value will be left uninitialized. */ + uint16_t max_len; /**< Maximum descriptor value length in bytes, see @ref BLE_GATTS_ATTR_LENS_MAX for maximum values. */ + uint8_t* p_value; /**< Pointer to the value of the descriptor*/ +} ble_add_descr_params_t; + + +/**@brief Function for adding a characteristic to a given service. + * + * If no pointer is given for the initial value, + * the initial length parameter will be ignored and the initial length will be 0. + * + * @param[in] service_handle Handle of the service to which the characteristic is to be added. + * @param[in] p_char_props Information needed to add the characteristic. + * @param[out] p_char_handle Handle of the added characteristic. + * + * @retval NRF_SUCCESS If the characteristic was added successfully. Otherwise, an error code is returned. + */ +uint32_t characteristic_add(uint16_t service_handle, + ble_add_char_params_t * p_char_props, + ble_gatts_char_handles_t * p_char_handle); + + +/**@brief Function for adding a characteristic's descriptor to a given characteristic. + * + * @param[in] char_handle Handle of the characteristic to which the descriptor is to be added, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. + * @param[in] p_descr_props Information needed to add the descriptor. + * @param[out] p_descr_handle Handle of the added descriptor. + * + * @retval NRF_SUCCESS If the characteristic was added successfully. Otherwise, an error code is returned. + */ +uint32_t descriptor_add(uint16_t char_handle, + ble_add_descr_params_t * p_descr_props, + uint16_t * p_descr_handle); + + +#endif // BLE_SRV_COMMON_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/config/device_manager_cnfg.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/config/device_manager_cnfg.h new file mode 100644 index 0000000000..394a118874 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/config/device_manager_cnfg.h @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + /** + * @file device_manager_cnfg.h + * + * @cond + * @defgroup device_manager_cnfg Device Manager Configuration + * @ingroup device_manager + * @{ + * + * @brief Defines application specific configuration for Device Manager. + * + * @details All configurations that are specific to application have been defined + * here. Application should configuration that best suits its requirements. + */ + +#ifndef DEVICE_MANAGER_CNFG_H__ +#define DEVICE_MANAGER_CNFG_H__ + +/** + * @defgroup device_manager_inst Device Manager Instances + * @{ + */ +/** + * @brief Maximum applications that Device Manager can support. + * + * @details Maximum application that the Device Manager can support. + * Currently only one application can be supported. + * Minimum value : 1 + * Maximum value : 1 + * Dependencies : None. + */ +#define DEVICE_MANAGER_MAX_APPLICATIONS 1 + +/** + * @brief Maximum connections that Device Manager should simultaneously manage. + * + * @details Maximum connections that Device Manager should simultaneously manage. + * Minimum value : 1 + * Maximum value : Maximum links supported by SoftDevice. + * Dependencies : None. + */ +#define DEVICE_MANAGER_MAX_CONNECTIONS 1 + + +/** + * @brief Maximum bonds that Device Manager should manage. + * + * @details Maximum bonds that Device Manager should manage. + * Minimum value : 1 + * Maximum value : 254. + * Dependencies : None. + * @note In case of GAP Peripheral role, the Device Manager will accept bonding procedure + * requests from peers even if this limit is reached, but bonding information will not + * be stored. In such cases, application will be notified with DM_DEVICE_CONTEXT_FULL + * as event result at the completion of the security procedure. + */ +#define DEVICE_MANAGER_MAX_BONDS 7 + + +/** + * @brief Maximum Characteristic Client Descriptors used for GATT Server. + * + * @details Maximum Characteristic Client Descriptors used for GATT Server. + * Minimum value : 1 + * Maximum value : 254. + * Dependencies : None. + */ +#define DM_GATT_CCCD_COUNT 2 + + +/** + * @brief Size of application context. + * + * @details Size of application context that Device Manager should manage for each bonded device. + * Size had to be a multiple of word size. + * Minimum value : 4. + * Maximum value : 256. + * Dependencies : Needed only if Application Context saving is used by the application. + * @note If set to zero, its an indication that application context is not required to be managed + * by the module. + */ +#define DEVICE_MANAGER_APP_CONTEXT_SIZE 0 + +/* @} */ +/* @} */ +/** @endcond */ +#endif // DEVICE_MANAGER_CNFG_H__ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager.h new file mode 100644 index 0000000000..0b085abc64 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager.h @@ -0,0 +1,915 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file device_manager.h + * + * @defgroup device_manager Device Manager + * @ingroup ble_sdk_lib + * @{ + * @brief Device Manager Application Interface Abstraction. + * + * @details The Device Manager module manages Active and Bonded Peers. Management of peer includes + * book keeping of contextual information like the Security Keys, GATT + * configuration and any application specific information. + * + * Active Peers are devices which are connected, and may or may not be bonded. + * Bonded Peers are devices which are bonded, and may or may not be Active (Connected). + * Active Bonded Peer refers to a device which is connected and bonded. + * + * Paired Devices refers to peer devices that are connected and have necessary context + * establishment/exchange for the current connection session. On disconnect, + * all contextual information is flushed. For example, SMP Information Exchanged during + * pairing and GATT Configuration is not retained on disconnection. + * + * Note that this module allows management of contextual information but + * does not provide an interface for connection management. Therefore, entering connectible + * mode, connection establishment, or disconnection of a link with peer is not in scope + * of this module. + * + * For bonded peers, the contextual information is required to be retained on disconnection + * and power cycling. Persistent storage of contextual information is handled by the + * module. This module categorizes the contextual information into 3 categories: + * - Bonding Information + * Bond information is the information exchanged between local and peer device to + * establish a bond. It also includes peer identification information, + * like the peer address or the IRK or both. From here on this category of information + * is referred to as Device Context. + * - Service/Protocol Information + * Service/Protocol information is the information retained for the peer to save on one-time + * procedures like the GATT Service Discovery procedures and Service Configurations. + * It allows devices to resume data exchange on subsequent reconnection without having + * to perform initial set-up procedures each time. From here on this category is + * referred to as Service Context. + * - Application Information + * Application information is the context that the application would like to associate with + * each of the bonded device. For example, if the application chooses to rank its peers + * in order to manage them better, the rank information could be treated as + * Application Information. This storage space is provided to save the application from + * maintaining a mapping table with each Device Instance and Application Information. + * However, if the application have no use for this, it is possible to not + * use or employ this at compile time. From here on this category of information is + * referred to as Application Context. + */ + + +#ifndef DEVICE_MANAGER_H__ +#define DEVICE_MANAGER_H__ + +#include +#include +#include "sdk_common.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "device_manager_cnfg.h" + +/** + * @defgroup dm_service_cntext_types Service/Protocol Types + * + * @brief Describes the possible types of Service/Protocol Contexts for a bonded/peer device. + * + * @details Possible Service/Protocol context per peer device. The Device Manager provides the + * functionality of persistently storing the Service/Protocol context and can automatically + * load them when needed. + * For example system attributes for a GATT Server. Based on the nature of the application, + * not all service types may be needed. The application can specify + * only the service/protocol context it wants to use at the time of registration. + * @{ + */ +#define DM_PROTOCOL_CNTXT_NONE 0x00 /**< No Service Context, this implies the application does not want to associate any service/protocol context with the peer device */ +#define DM_PROTOCOL_CNTXT_GATT_SRVR_ID 0x01 /**< GATT Server Service Context, this implies the application does associate GATT Server with the peer device and this information will be loaded when needed for a bonded device */ +#define DM_PROTOCOL_CNTXT_GATT_CLI_ID 0x02 /**< GATT Client Service Context, this implies the application does associate GATT Client with the peer device and this information will be loaded when needed for a bonded device */ +#define DM_PROTOCOL_CNTXT_ALL \ + (DM_PROTOCOL_CNTXT_GATT_SRVR_ID | DM_PROTOCOL_CNTXT_GATT_CLI_ID) /**< All Service/Protocol Context, this implies that the application wants to associate all Service/Protocol Information with the bonded device. This is configurable based on system requirements. If the application has only one type of service, this define could be altered to reflect the same. */ +/** @} */ + + +/** + * @defgroup dm_events Device Manager Events + * + * @brief This section describes the device manager events that are notified to the application. + * + * @details The Device Manager notifies the application of various asynchronous events using the + * asynchronous event notification callback. All events has been categorized into: + * a. General. + * b. Link Status. + * c. Context Management. + * + * In the callback, these events are notified along with handle that uniquely identifies: + * application instance, active instance (if applicable), device instance + * bonding instance, (if applicable) and service instance. + * Not all events are pertaining to an active connection, for example a context deletion event could occur even if the peer + * is not connected. Also, general category of events may not be pertaining to any specific peer. + * See also \ref dm_event_cb_t and \ref dm_register. + * @{ + */ +/** + * @defgroup general_events General Events + * + * @brief General or miscellaneous events. + * + * @details This category of events are general events not pertaining to a peer or context. + * + * @{ + */ +#define DM_EVT_RFU 0x00 /**< Reserved for future use, is never notified. */ +#define DM_EVT_ERROR 0x01 /**< Device Manager Event Error. */ +/** @} */ + +/** + * @defgroup link_status_events Link Status Events + * + * @brief Link Status Events. + * + * @details This category of events notify the application of the link status. Event result associated + * with the event is provided along with the event in the callback to provide more details of + * whether a procedure succeeded or failed and assist the application in decision making of + * how to proceed. For example if a DM_DEVICE_CONNECT_IND is indicated with NRF_SUCCESS + * result, the application may want to proceed with discovering and association with + * service of the peer. However, if indicated with a failure result, the application may + * want to take an alternate action such as reattempting to connect or go into a + * sleep mode. + * + * @{ + */ +#define DM_EVT_CONNECTION 0x11 /**< Indicates that link with the peer is established. */ +#define DM_EVT_DISCONNECTION 0x12 /**< Indicates that link with peer is torn down. */ +#define DM_EVT_SECURITY_SETUP 0x13 /**< Security procedure for link started indication */ +#define DM_EVT_SECURITY_SETUP_COMPLETE 0x14 /**< Security procedure for link completion indication. */ +#define DM_EVT_LINK_SECURED 0x15 /**< Indicates that link with the peer is secured. For bonded devices, subsequent reconnections with bonded peer will result only in this event when the link is secured and setup procedures will not occur unless the bonding information is either lost or deleted on either or both sides. */ +#define DM_EVT_SECURITY_SETUP_REFRESH 0x16 /**< Indicates that the security on the link was re-established. */ +/** @} */ + +/** + * @defgroup context_mgmt_events Context Management Events + * + * @brief Context Management Events. + * + * @details These events notify the application of the status of context loading and storing. + * + * @{ + */ +#define DM_EVT_DEVICE_CONTEXT_LOADED 0x21 /**< Indicates that device context for a peer is loaded. */ +#define DM_EVT_DEVICE_CONTEXT_STORED 0x22 /**< Indicates that device context is stored persistently. */ +#define DM_EVT_DEVICE_CONTEXT_DELETED 0x23 /**< Indicates that device context is deleted. */ +#define DM_EVT_SERVICE_CONTEXT_LOADED 0x31 /**< Indicates that service context for a peer is loaded. */ +#define DM_EVT_SERVICE_CONTEXT_STORED 0x32 /**< Indicates that service context is stored persistently. */ +#define DM_EVT_SERVICE_CONTEXT_DELETED 0x33 /**< Indicates that service context is deleted. */ +#define DM_EVT_APPL_CONTEXT_LOADED 0x41 /**< Indicates that application context for a peer is loaded. */ +#define DM_EVT_APPL_CONTEXT_STORED 0x42 /**< Indicates that application context is stored persistently. */ +#define DM_EVT_APPL_CONTEXT_DELETED 0x43 /**< Indicates that application context is deleted. */ +/** @} */ +/** @} */ + +#define DM_INVALID_ID 0xFF /**< Invalid instance idenitifer. */ + +/** + * @defgroup dm_data_structure Device Manager Data Types + * + * @brief This section describes all the data types exposed by the module to the application. + * @{ + */ + +/** + * @brief Application Instance. + * + * @details Application instance uniquely identifies an application. The identifier is allocated by + * the device manager when application registers with the module. The application is + * expected to identify itself with this instance identifier when initiating subsequent + * requests. Application should use the utility API \ref dm_application_instance_set in + * order to set its application instance in dm_handle_t needed for all subsequent APIs. + * See also \ref dm_register. + */ +typedef uint8_t dm_application_instance_t; + +/** + * @brief Connection Instance. + * + * @details Identifies connection instance for an active device. This instance is allocated by the + * device manager when a connection is established and is notified with DM_EVT_CONNECTION + * with the event result NRF_SUCCESS. + */ +typedef uint8_t dm_connection_instance_t; + +/** + * @brief Device Instance. + * + * @details Uniquely identifies a bonded peer device. The peer device may or may not be connected. + * In case of the central: The bonded device instance to identify the peer is allocated when bonding procedure is initiated by the central using dm_security_setup_req. + * In case of the peripheral: When the bonding procedure is successful, the DM_EVT_SECURITY_SETUP_COMPLETE event with success event result, is received. + * In case the module cannot add more bonded devices, no instance is allocated, this is indicated by an appropriate error code for the API/event as the case may be. Application can choose to disconnect the link. + */ +typedef uint8_t dm_device_instance_t; + +/** + * @brief Service Instance. + * + * @details Uniquely identifies a peer device. The peer device may or may not be connected. This + * instance is allocated by the device manager when a device is bonded and is notified + * when security procedures have been initiated. + * Security Procedures initiation is notified with DM_SECURITY_SETUP_IND with + * success event result. In case the event result indicates that the module cannot add more + * bonded devices, no instance is allocated. Application can chose to disconnect the link. + */ +typedef uint8_t dm_service_instance_t; + +/** + * @brief Service/Protocol Type Identifier. + * + * @details Uniquely identifies a service or a protocol type. Service/Protocol Type identification + * is needed as each service/protocol can have its own contextual data. + * This allows the peer to access more than one service at a time. \ref dm_service_cntext_types describes the + * list of services/protocols supported. + */ +typedef uint8_t service_type_t; + +/**@brief Device Manager Master identification and encryption information. */ +typedef struct dm_enc_key +{ + ble_gap_enc_info_t enc_info; /**< GAP encryption information. */ + ble_gap_master_id_t master_id; /**< Master identification. */ +} dm_enc_key_t; + +/** @brief Device Manager identity and address information. */ +typedef struct dm_id_key +{ + ble_gap_irk_t id_info; /**< Identity information. */ + ble_gap_addr_t id_addr_info; /**< Identity address information. */ +} dm_id_key_t; + +/** @brief Device Manager signing information. */ +typedef struct dm_sign_key +{ + ble_gap_sign_info_t sign_key; /**< GAP signing information. */ +} dm_sign_key_t; + +/** @brief Security keys. */ +typedef struct dm_sec_keyset +{ + union + { + dm_enc_key_t * p_enc_key; /**< Pointer to Device Manager encryption information structure. */ + } enc_key; + dm_id_key_t * p_id_key; /**< Identity key, or NULL. */ + dm_sign_key_t * p_sign_key; /**< Signing key, or NULL. */ +} dm_sec_keys_t; + +/** @brief Device Manager security key set. */ +typedef struct +{ + dm_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */ + dm_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */ +} dm_sec_keyset_t; + +/** + * @brief Device Handle used for unique identification of each peer. + * + * @details This data type is used to uniquely identify each peer device. A peer device could be + * active and/or bonded. Therefore an instance for active and bonded is provided. + * However, the application is expected to treat this is an opaque structure and use this for + * all API interactions once stored on appropriate events. + * See \ref dm_events. + */ +typedef struct device_handle +{ + dm_application_instance_t appl_id; /**< Identifies the application instances for the device that is being managed. */ + dm_connection_instance_t connection_id; /**< Identifies the active connection instance. */ + dm_device_instance_t device_id; /**< Identifies peer instance in the data base. */ + dm_service_instance_t service_id; /**< Service instance identifier. */ +} dm_handle_t; + +/** + * @brief Definition of Data Context. + * + * @details Defines contextual data format, it consists of context data length and pointer to data. + */ +typedef struct +{ + uint32_t flags; /**< Additional flags identifying data. */ + uint32_t len; /**< Length of data. */ + uint8_t * p_data; /**< Pointer to contextual data, a copy is made of the data. */ +} dm_context_t; + + +/** + * @brief Device Context. + * + * @details Defines "device context" type for a device managed by device manager. + */ +typedef dm_context_t dm_device_context_t; + +/** + * @brief Service Context. + * + * @details Service context data for a service identified by the 'service_type' field. + */ +typedef struct +{ + service_type_t service_type; /**< Identifies the service/protocol to which the context data is related. */ + dm_context_t context_data; /**< Contains length and pointer to context data */ +} dm_service_context_t; + +/** + * @brief Application context. + * + * @details The application context can be used by the application to map any application level + * information that is to be mapped with a particular peer. + * For bonded peers, this information will be stored by the bond manager persistently. + * Note that the device manager treats this information as an + * opaque block of bytes. + * Necessary APIs to get and set this context for a peer have been provided. + */ +typedef dm_context_t dm_application_context_t; + +/** + * @brief Event parameters. + * + * @details Defines event parameters for each of the events notified by the module. + */ +typedef union +{ + ble_gap_evt_t * p_gap_param; /**< All events that are triggered in device manager as a result of GAP events, like connection, disconnection and security procedures are accompanied with GAP parameters. */ + dm_application_context_t * p_app_context; /**< All events that are associated with application context procedures of store, load, and deletion have this as event parameter. */ + dm_service_context_t * p_service_context; /**< All events that are associated with service context procedures of store, load and deletion have this as event parameter. */ + dm_device_context_t * p_device_context; /**< All events that are associated with device context procedures of store, load and deletion have this as event parameter. */ +} dm_event_param_t; + +/** + * @brief Asynchronous events details notified to the application by the module. + * + * @details Defines event type along with event parameters notified to the application by the + * module. + */ +typedef struct +{ + uint8_t event_id; /**< Identifies the event. See \ref dm_events for details on event types and their significance. */ + dm_event_param_t event_param; /**< Event parameters. Can be NULL if the event does not have any parameters. */ + uint16_t event_paramlen; /**< Length of the event parameters, is zero if the event does not have any parameters. */ +} dm_event_t; + +/** + * @brief Event notification callback registered by application with the module. + * + * @details Event notification callback registered by application with the module when registering + * the module using \ref dm_register API. + * + * @param[in] p_handle Identifies the peer for which the event is being notified. + * @param[in] p_event Identifies the event, any associated parameters and parameter length. + * See \ref dm_events for details on event types and their significance. + * @param[in,out] event_result Provide additional information on the event. + * In addition to SDK error codes there is also a return value + * indicating if maximum number of connections has been reached when connecting or bonding. + * + * @retval NRF_SUCCESS on success, or a failure to indicate if it could handle the event + * successfully. There is no action taken in case application returns a failure. + */ +typedef ret_code_t (*dm_event_cb_t)(dm_handle_t const * p_handle, + dm_event_t const * p_event, + ret_code_t event_result); + +/** + * @brief Initialization Parameters. + * + * @details Indicates the application parameters. Currently this only encompasses clearing + * all persistent data. + */ +typedef struct +{ + bool clear_persistent_data; /**< Set to true in case the module should clear all persistent data. */ +} dm_init_param_t; + +/** + * @brief Application Registration Parameters. + * + * @details Parameters needed by the module when registering with it. + */ +typedef struct +{ + dm_event_cb_t evt_handler; /**< Event Handler to be registered. It will receive asynchronous notification from the module, see \ref dm_events for asynchronous events. */ + uint8_t service_type; /**< Bit mask identifying services that the application intends to support for all peers. */ + ble_gap_sec_params_t sec_param; /**< Security parameters to be used for the application. */ +} dm_application_param_t; + +/** + * @brief Defines possible security status/states. + * + * @details Defines possible security status/states of a link when requested by application using + * the \ref dm_security_status_req. + */ +typedef enum +{ + NOT_ENCRYPTED, /**< The link is not secured. */ + ENCRYPTION_IN_PROGRESS, /**< Link security is being established.*/ + ENCRYPTED /**< The link is secure.*/ +} dm_security_status_t; +/** @} */ + +/** + * @defgroup dm_api Device Module APIs + * + * @brief This section describes APIs exposed by the module. + * + * @details This section describes APIs exposed by the module. The APIs have been categorized to provide + * better and specific look up for developers. Categories are: + * - Set up APIs. + * - Context Management APIs. + * - Utility APIs. + * + * MSCs describe usage of these APIs. + * See @ref dm_msc. + * @{ + */ +/** + * @defgroup dm_setup_api Device Module Set-up APIs + * + * @brief Initialization & registration APIs that are pre-requisite for all other module procedures. + * @details This section describes the Module Initialization and Registration APIs needed to be set up by + * the application before device manager can start managing devices and device contexts + * for the application. + * + * @{ + */ + +/** + * @brief Module Initialization Routine. + * + * @details Function for initializing the module. Must called before any other APIs of the module are used. + * + * @param[in] p_init_param Initialization parameters. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * + * @note It is mandatory that pstorage is initialized before initializing this module. + */ +ret_code_t dm_init(dm_init_param_t const * p_init_param); + +/** + * @brief Function for registering the application. + * + * @details This routine is used by the application to register for asynchronous events with the + * device manager. During registration the application also indicates the services that it + * intends to support on this instance. It is possible to register multiple times with the + * device manager. At least one instance shall be registered with the device manager after + * the module has been initialized. + * Maximum number of application instances device manager can support is determined + * by DM_MAX_APPLICATIONS. + * + * All applications must be registered before initiating or accepting connections from the peer. + * + * @param[in] p_appl_param Application parameters. + * @param[out] p_appl_instance Application Instance Identifier in case registration is successful. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization. + * @retval NRF_ERROR_NO_MEM If module cannot support more applications. + * + * @note Currently only one application instance is supported by the module. + */ +ret_code_t dm_register(dm_application_instance_t * p_appl_instance, + dm_application_param_t const * p_appl_param); + +/** + * @brief Function for handling BLE events. + * + * @details BLE Event Handler for the module. This routine should be called from BLE stack event + * dispatcher for the module to work as expected. + * + * @param[in] p_ble_evt BLE stack event being dispatched to the function. + * + */ +void dm_ble_evt_handler(ble_evt_t * p_ble_evt); + +/** @} */ + + +/** + * @defgroup dm_security_api APIs to set up or read status of security on a link. + * + * @brief This section describes APIs to set up Security. These APIs require that the peer is + * connected before the procedures can be requested. + * + * @details This group allows application to request security procedures + * or get the status of the security on a link. + * @{ + */ +/** + * @brief Function for requesting setting up security on a link. + * + * @details This API initiates security procedures with a peer device. + * @note For the GAP Central role, in case peer is not bonded, request to bond/pair is + * initiated. If it is bonded, the link is re-encrypted using the existing bond information. + * For the GAP peripheral role, a Slave security request is sent. + * @details If a pairing procedure is initiated successfully, application is notified of + * @ref DM_EVT_SECURITY_SETUP_COMPLETE. A result indicating success or failure is notified along with the event. + * In case the link is re-encrypted using existing bond information, @ref DM_EVT_LINK_SECURED is + * notified to the application. + * + * @param[in] p_handle Identifies the link on which security is desired. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle is NULL. + * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application + * or if the peer is not connected when this procedure is requested. + */ +ret_code_t dm_security_setup_req(dm_handle_t * p_handle); + +/** + * @brief Function for reading the status of the security on a link. + * + * @details This API allows application to query status of security on a link. + * + * @param[in] p_handle Identifies the link on which security is desired. + * @param[out] p_status Pointer where security status is provided to the application. + * See \ref dm_security_status_t for possible statuses that can be expected. + * + * @retval NRF_SUCCESS Or appropriate error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle or p_status is NULL. + * @retval NRF_ERROR_INVALID_ADDR If peer is not identified by the handle provided by the application + * or if peer is not connected when this procedure is requested. + */ +ret_code_t dm_security_status_req(dm_handle_t const * p_handle, dm_security_status_t * p_status); + +/** + * @brief Function for creating the whitelist. + * + * @details This API allows application to create whitelist based on bonded peer devices in module + * data base. + * + * @param[in] p_handle Identifies the application requesting whitelist creation. + * @param[in,out] p_whitelist Pointer where created whitelist is provided to the application. + * + * @note 'addr_count' and 'irk_count' fields of the structure should be populated with the maximum + * number of devices that the application wishes to request in the whitelist. + * If the number of bonded devices is less than requested, the fields are updated with that number of devices. + * If the number of devices are more than requested, the module will populate the list + * with devices in the order the bond was established with the peer devices. Also, if this routine is + * called when a connection exists with one or more peer devices, + * those connected devices are not added to the whitelist. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle or p_whitelist is NULL. + */ +ret_code_t dm_whitelist_create(dm_application_instance_t const * p_handle, + ble_gap_whitelist_t * p_whitelist); + +/** @} */ + + +/** + * @defgroup dm_cntxt_mgmt_api Context Management APIs + * + * @brief Utility APIs offered by the device manager to get information about the peer if and + * when needed. + * + * @details This group of API allow the application to access information that is not required to be + * maintained by the application but may be needed. Hence it is possible to get the + * information from the module instead of mapping all the information with a device + * context. + * @{ + */ + +ret_code_t dm_device_add(dm_handle_t * p_handle, + dm_device_context_t const * p_context); + +/** + * @brief Function for deleting a peer device context and all related information from the database. + * + * @details Delete peer device context and all related information from database. If + * this API returns NRF_SUCCESS, DM_EVT_DEVICE_CONTEXT_DELETED event is notified to the + * application. Event result notified along with the event indicates success or failure + * of this procedure. + * + * @param[in] p_handle Identifies the peer device to be deleted. + * + * @retval NRF_SUCCESS on success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE In the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle is NULL. + * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application. + * + * @note Deleting device context results in deleting service and application context for the + * bonded device. The respective events DM_EVT_SERVICE_CONTEXT_DELETED and + * DM_EVT_APPL_CONTEXT_DELETED are not notified to the application. + */ +ret_code_t dm_device_delete(dm_handle_t const * p_handle); + +/** + * @brief Function for deleting all peer device context and all related information from the database. + * + * @details Delete peer device context and all related information from database. If + * this API returns NRF_SUCCESS, DM_EVT_DEVICE_CONTEXT_DELETED event is notified to the + * application for each device that is deleted from the data base. Event result + * notified along with the event indicates success or failure of this procedure. + * + * @param[in] p_handle Identifies application instance that is requesting + * the deletion of all bonded devices. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle is NULL. + * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application. + * + * @note Deleting device context results in deleting both service and application context for the + * bonded device. The respective events DM_EVT_SERVICE_CONTEXT_DELETED and + * DM_EVT_APPL_CONTEXT_DELETED are not notified to the application. + */ +ret_code_t dm_device_delete_all(dm_application_instance_t const * p_handle); + +/** + * @brief Function for setting Service Context for a peer device identified by 'p_handle' parameter. + * + * @details This API allows application to Set Service Context for a peer device identified by the + * 'p_handle' parameter. This API is useful when the Service Context cannot be requested + * from the SoftDevice, but needs to be assembled by the application or an another module. + * (or when service context is exchanged in an out of band way.) + * This API could also be used to trigger a storing of service context into persistent + * memory. If this is desired, a NULL pointer could be passed to the p_context. + * + * @param[in] p_handle Identifies peer device for which the procedure is requested. + * @param[in] p_context Service context being set. The context information includes length of + * data and pointer to the contextual data being set. The memory pointed to by + * the pointer to data is assumed to be resident when API is being called and + * can be freed or reused once the set procedure is complete. Set procedure + * completion is indicated by the event \ref DM_EVT_SERVICE_CONTEXT_STORED. + * The Event result is notified along with the event and indicates success or failure of + * this procedure. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle is NULL. + * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. + */ +ret_code_t dm_service_context_set(dm_handle_t const * p_handle, + dm_service_context_t const * p_context); + +/** + * @brief Function for getting Service Context for a peer device identified by 'p_handle' parameter. + * + * @details Get Service Context for a peer device identified by the 'p_handle' parameter. If + * this API returns NRF_SUCCESS, DM_EVT_SERVICE_CONTEXT_LOADED event is notified to the + * application. The event result is notified along with the event indicates success or failure + * of this procedure. + * + * @param[in] p_handle Identifies peer device for which procedure is requested. + * @param[in] p_context Application context being requested. The context information includes length + * of the data and a pointer to the data. Note that requesting a 'get' + * of application does not need to provide memory, the pointer to data will be + * pointing to service data and hence no data movement is involved. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE In case API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle is NULL. + * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. + */ +ret_code_t dm_service_context_get(dm_handle_t const * p_handle, + dm_service_context_t * p_context); + +/** + * @brief Function for deleting a Service Context for a peer device identified by the 'p_handle' parameter. + * + * @details This API allows application to delete a Service Context identified for a peer device + * identified by the 'p_handle' parameter. If this API returns NRF_SUCCESS, + * DM_EVT_SERVICE_CONTEXT_DELETED event is notified to the application. + * Event result is notified along with the event and indicates success or failure of this + * procedure. + * + * @param[in] p_handle Identifies peer device for which procedure is requested. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle is NULL. + * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. + */ +ret_code_t dm_service_context_delete(dm_handle_t const * p_handle); + +/** + * @brief Function for setting Application Context for a peer device identified by the 'p_handle' parameter. + * + * @details This application allows the setting of the application context for the peer device identified by + * the 'p_handle'. Application context is stored persistently by the module and can be + * requested by the application at any time using the \ref dm_application_context_get + * API. Note that this procedure is permitted only for bonded devices. If the + * device is not bonded, application context cannot be set. However, it is not mandatory + * that the bonded device is connected when requesting this procedure. + * + * @param[in] p_handle Identifies peer device for which procedure is requested. + * + * @param[in] p_context Application context being set. The context information includes length of the + * data and pointer to the contextual data being set. The memory pointed to by + * the data pointer is assumed to be resident when API is being called and + * can be freed or reused once the set procedure is complete. Set procedure + * completion is notified by the event \ref DM_EVT_APPL_CONTEXT_STORED. + * The event result is notified along with the event and indicates success or + * failure of this procedure. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle and/or p_context is NULL. + * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application. + * + * @note The API returns FEATURE_NOT_ENABLED in case DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero. + */ +ret_code_t dm_application_context_set(dm_handle_t const * p_handle, + dm_application_context_t const * p_context); + +/** + * @brief Function for getting Application Context for a peer device identified by the 'p_handle' parameter. + * + * @details Get Application Context for a peer device identified by the 'p_handle' parameter. If + * this API returns NRF_SUCCESS, DM_EVT_APPL_CONTEXT_LOADED event is notified to the + * application. Event result notified along with the event indicates success or failure + * of this procedure. + * + * @param[in] p_handle Identifies peer device for which procedure is requested. + * @param[in] p_context Application context being requested. The context information includes + * length of data and pointer to the contextual data is provided. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle and/or p_context is NULL. + * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. + * @retval DM_NO_APP_CONTEXT If no application context was set that can be fetched. + * + * @note The API returns FEATURE_NOT_ENABLED in case DEVICE_MANAGER_APP_CONTEXT_SIZE is set to + * zero. + */ +ret_code_t dm_application_context_get(dm_handle_t const * p_handle, + dm_application_context_t * p_context); + +/** + * @brief Function for deleting Application Context for a peer device identified by the 'p_handle' parameter. + * + * @details Delete Application Context for a peer device identified by the 'p_handle' parameter. If + * this API returns NRF_SUCCESS, DM_EVT_APPL_CONTEXT_DELETED event is notified to the + * application. The event result notified along with the event and indicates success or failure + * of this procedure. + * + * @param[in] p_handle Identifies peer device for which procedure is requested. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If the p_handle is NULL. + * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application. + * @retval DM_NO_APP_CONTEXT If no application context was set that can be deleted. + * + * @note The API returns FEATURE_NOT_ENABLED if the DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero. + */ +ret_code_t dm_application_context_delete(dm_handle_t const * p_handle); + +/** @} */ + + +/** + * @defgroup utility_api Utility APIs + * @{ + * @brief This section describes the utility APIs offered by the module. + * + * @details APIs defined in this section are utility or assisting/helper APIs. + */ +/** + * @brief Function for Setting/Copying Application instance to Device Manager handle. + * + * @param[in] p_appl_instance Application instance to be set. + * @param[out] p_handle Device Manager handle for which the instance is to be copied. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL. + */ +ret_code_t dm_application_instance_set(dm_application_instance_t const * p_appl_instance, + dm_handle_t * p_handle); + +/** + * @brief Function for getting a peer's device address. + * + * @param[in] p_handle Identifies the peer device whose address is requested. Can not be NULL. + * @param[out] p_addr Pointer where address is to be copied. Can not be NULL. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL. + * @retval NRF_ERROR_NOT_FOUND If the peer could not be identified. + */ +ret_code_t dm_peer_addr_get(dm_handle_t const * p_handle, + ble_gap_addr_t * p_addr); + +/** + * @brief Function for setting/updating a peer's device address. + * + * @param[in] p_handle Identifies the peer device whose address is requested to be set/updated. + * @param[out] p_addr Address to be set/updated. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL. + * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. + * @retval NRF_ERROR_INVALID_PARAM If this procedure is requested while connected to the peer or if the address + * type was set to BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE. + * + * @note Setting or updating a peer's device address is permitted + * only for a peer that is bonded and disconnected. + * @note Updated address is reflected only after DM_EVT_DEVICE_CONTEXT_STORED is notified to the + * application for this bonded device instance. In order to avoid abnormal behaviour, it is + * recommended to not invite/initiate connections on the updated address unless this event + * has been notified. + */ +ret_code_t dm_peer_addr_set(dm_handle_t const * p_handle, + ble_gap_addr_t const * p_addr); + +/** + * @brief Function for initializing Device Manager handle. + * + * @param[in] p_handle Device Manager handle to be initialized. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_NULL If p_handle is NULL. + * + * @note This routine is permitted before initialization of the module. + */ +ret_code_t dm_handle_initialize(dm_handle_t * p_handle); + +/** + * @brief Function for getting distributed keys for a device. + * + * @param[in] p_handle Device Manager handle identifying the peer. + * @param[out] p_key_dist Pointer to distributed keys. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + * @retval NRF_ERROR_NULL If the p_handle and/or p_key_dist pointer is NULL. + * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. + */ +ret_code_t dm_distributed_keys_get(dm_handle_t const * p_handle, + dm_sec_keyset_t * p_key_dist); + +/** + * @brief Function for getting the corresponding dm_handle_t based on the connection handle. + * + * @param[in] conn_handle Connection handle as provided by the SoftDevice. + * @param[in,out] p_handle Pointer to the p_handle containg the application instance for the + * registered application. If the application instance is valid then + * the p_handle will be filled with requested data. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + * @retval NRF_ERROR_NULL If the p_handle pointer is NULL. + * @retval NRF_ERROR_NOT_FOUND If no p_handle is found for the provided connection handle. + */ +ret_code_t dm_handle_get(uint16_t conn_handle, dm_handle_t * p_handle); + +/** @} */ +/** @} */ +/** @} */ +#endif // DEVICE_MANAGER_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager_peripheral.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager_peripheral.c new file mode 100644 index 0000000000..0302e2ff9e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager_peripheral.c @@ -0,0 +1,2971 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "device_manager.h" +#include "app_trace.h" +#include "pstorage.h" +#include "nrf_ble_hci.h" +#include "app_error.h" + +#if defined ( __CC_ARM ) + #ifndef __ALIGN + #define __ALIGN(x) __align(x) /**< Forced aligment keyword for ARM Compiler */ + #endif +#elif defined ( __ICCARM__ ) + #ifndef __ALIGN + #define __ALIGN(x) /**< Forced aligment keyword for IAR Compiler */ + #endif +#elif defined ( __GNUC__ ) + #ifndef __ALIGN + #define __ALIGN(x) __attribute__((aligned(x))) /**< Forced aligment keyword for GNU Compiler */ + #endif +#endif + +#define INVALID_ADDR_TYPE 0xFF /**< Identifier for an invalid address type. */ +#define EDIV_INIT_VAL 0xFFFF /**< Initial value for diversifier. */ + +/** + * @defgroup device_manager_app_states Connection Manager Application States + * @{ + */ +#define STATE_CONTROL_PROCEDURE_IN_PROGRESS 0x01 /**< State where a security procedure is ongoing. */ +#define STATE_QUEUED_CONTROL_REQUEST 0x02 /**< State where it is known if there is any queued security request or not. */ +/** @} */ + +/** + * @defgroup device_manager_conn_inst_states Connection Manager Connection Instances States. + * @{ + */ +#define STATE_IDLE 0x01 /**< State where connection instance is free. */ +#define STATE_CONNECTED 0x02 /**< State where connection is successfully established. */ +#define STATE_PAIRING 0x04 /**< State where pairing procedure is in progress. This state is used for pairing and bonding, as pairing is needed for both. */ +#define STATE_BONDED 0x08 /**< State where device is bonded. */ +#define STATE_DISCONNECTING 0x10 /**< State where disconnection is in progress, application will be notified first, but no further active procedures on the link. */ +#define STATE_PAIRING_PENDING 0x20 /**< State where pairing request is pending on the link. */ +#define STATE_BOND_INFO_UPDATE 0x40 /**< State where information has been updated, update the flash. */ +#define STATE_LINK_ENCRYPTED 0x80 /**< State where link is encrypted. */ +/** @} */ + +/** + * @defgroup device_manager_peer_id_defines Peer Identification Information Defines. + * + * @brief These defines are used to know which of the peer identification is applicable for a peer. + * + * @details These defines are used for peer identification. Here, bit map is used because it is + * possible that the application has both IRK and address for identification. + * @{ + */ +#define UNASSIGNED 0xFF /**< Peer instance is unassigned/unused. */ +#define IRK_ENTRY 0x01 /**< Peer instance has IRK as identification information. */ +#define ADDR_ENTRY 0x02 /**< Peer instance has address as identification information. */ +#define SERVICE_CONTEXT_ENTRY 0x04 /**< Peer instance has service context set. */ +#define APP_CONTEXT_ENTRY 0x08 /**< Peer instance has an application context set. */ +/** @} */ + +/**@brief Device store state identifiers. */ +typedef enum +{ + STORE_ALL_CONTEXT, /**< Store all context. */ + FIRST_BOND_STORE, /**< Store bond. */ + UPDATE_PEER_ADDR /**< Update peer address. */ +} device_store_state_t; + +/** + * @defgroup device_manager_context_offsets Context Offsets + * @{ + * + * @brief Context offsets each of the context information in persistent memory. + * + * @details Below is a layout showing how each how the context information is stored in persistent + * memory. + * + * All Device context is stored in the flash as follows: + * +---------+---------+---------+------------------+----------------+--------------------+ + * | Block / Device ID + Layout of stored information in storage block | + * +---------+---------+---------+------------------+----------------+--------------------+ + * | Block 0 | Device 0| Peer Id | Bond Information | Service Context| Application Context| + * +---------+---------+---------+------------------+----------------+--------------------+ + * | Block 1 | Device 1| Peer Id | Bond Information | Service Context| Application Context| + * +---------+---------+---------+------------------+----------------+--------------------+ + * | ... | .... | + * +---------+---------+---------+------------------+----------------+--------------------+ + * | Block N | Device N| Peer Id | Bond Information | Service Context| Application Context| + * +---------+---------+---------+------------------+----------------+--------------------+ + * + * The following defines are used to get offset of each of the components within a block. + */ + +#define PEER_ID_STORAGE_OFFSET 0 /**< Offset at which peer id is stored in the block. */ +#define BOND_STORAGE_OFFSET PEER_ID_SIZE /**< Offset at which bond information is stored in the block. */ +#define SERVICE_STORAGE_OFFSET (BOND_STORAGE_OFFSET + BOND_SIZE) /**< Offset at which service context is stored in the block. */ +#define APP_CONTEXT_STORAGE_OFFSET (SERVICE_STORAGE_OFFSET + SERVICE_CONTEXT_SIZE) /**< Offset at which application context is stored in the block. */ +/** @} */ + +/** + * @defgroup device_manager_context_size Context size. + * @{ + * + * @brief This group defines the size of each of the context information. + */ +#define PEER_ID_SIZE (sizeof(peer_id_t)) /**< Size of peer identification information. */ +#define BOND_SIZE (sizeof(bond_context_t)) /**< Size of bond information. */ +#define DEVICE_CONTEXT_SIZE (PEER_ID_SIZE + BOND_SIZE) /**< Size of Device context, include peer identification and bond information. */ +#define GATTS_SERVICE_CONTEXT_SIZE (sizeof(dm_gatts_context_t)) /**< Size of GATTS service context. */ +#define GATTC_SERVICE_CONTEXT_SIZE (sizeof(dm_gatt_client_context_t)) /**< Size of GATTC service context. */ +#define SERVICE_CONTEXT_SIZE (GATTS_SERVICE_CONTEXT_SIZE + GATTC_SERVICE_CONTEXT_SIZE) /**< Combined size of GATTS and GATTC service contexts. */ +#define APP_CONTEXT_MIN_SIZE 4 /**< Minimum size for application context data. */ +#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) +#define APP_CONTEXT_SIZE (sizeof(uint32_t) + DEVICE_MANAGER_APP_CONTEXT_SIZE) /**< Size of application context including length field. */ +#else //DEVICE_MANAGER_APP_CONTEXT_SIZE +#define APP_CONTEXT_SIZE 0 /**< Size of application context. */ +#endif // DEVICE_MANAGER_APP_CONTEXT_SIZE +#define ALL_CONTEXT_SIZE (DEVICE_CONTEXT_SIZE + SERVICE_CONTEXT_SIZE + APP_CONTEXT_SIZE) /**< Size of all contexts. */ +/** @} */ + + +/** + * @defgroup device_manager_log Module's Log Macros + * + * @details Macros used for creating module logs which can be useful in understanding handling + * of events or actions on API requests. These are intended for debugging purposes and + * can be disabled by defining the DM_DISABLE_LOGS. + * + * @note That if ENABLE_DEBUG_LOG_SUPPORT is disabled, having DM_DISABLE_LOGS has no effect. + * @{ + */ +#define nDM_DISABLE_LOGS /**< Enable this macro to disable any logs from this module. */ + +#ifndef DM_DISABLE_LOGS +#define DM_LOG app_trace_log /**< Used for logging details. */ +#define DM_ERR app_trace_log /**< Used for logging errors in the module. */ +#define DM_TRC app_trace_log /**< Used for getting trace of execution in the module. */ +#define DM_DUMP app_trace_dump /**< Used for dumping octet information to get details of bond information etc. */ +#else //DM_DISABLE_LOGS +#define DM_DUMP(...) /**< Disables dumping of octet streams. */ +#define DM_LOG(...) /**< Disables detailed logs. */ +#define DM_ERR(...) /**< Disables error logs. */ +#define DM_TRC(...) /**< Disables traces. */ +#endif //DM_DISABLE_LOGS +/** @} */ + +/** + * @defgroup device_manager_mutex_lock_unlock Module's Mutex Lock/Unlock Macros. + * + * @details Macros used to lock and unlock modules. Currently the SDK does not use mutexes but + * framework is provided in case need arises to use an alternative architecture. + * @{ + */ +#define DM_MUTEX_LOCK() SDK_MUTEX_LOCK(m_dm_mutex) /**< Lock module using mutex. */ +#define DM_MUTEX_UNLOCK() SDK_MUTEX_UNLOCK(m_dm_mutex) /**< Unlock module using mutex. */ +/** @} */ + + +/** + * @defgroup device_manager_misc_defines Miscellaneous defines used across the module. + * @{ + */ +#define DM_GATT_ATTR_SIZE 6 /**< Size of each GATT attribute to be stored persistently. */ +#define DM_GATT_SERVER_ATTR_MAX_SIZE ((DM_GATT_ATTR_SIZE * DM_GATT_CCCD_COUNT) + 2) /**< Maximum size of GATT attributes to be stored.*/ +#define DM_SERVICE_CONTEXT_COUNT (DM_PROTOCOL_CNTXT_ALL + 1) /**< Maximum number of service contexts. */ +#define DM_EVT_DEVICE_CONTEXT_BASE 0x20 /**< Base for device context base. */ +#define DM_EVT_SERVICE_CONTEXT_BASE 0x30 /**< Base for service context base. */ +#define DM_EVT_APP_CONTEXT_BASE 0x40 /**< Base for application context base. */ +#define DM_LOAD_OPERATION_ID 0x01 /**< Load operation identifier. */ +#define DM_STORE_OPERATION_ID 0x02 /**< Store operation identifier. */ +#define DM_CLEAR_OPERATION_ID 0x03 /**< Clear operation identifier. */ +/** @} */ + +#define DM_GATTS_INVALID_SIZE 0xFFFFFFFF /**< Identifer for GATTS invalid size. */ + +/** + * @defgroup api_param_check API Parameters check macros. + * + * @details Macros for verifying parameters passed to the module in the APIs. These macros + * could be mapped to nothing in the final version of the code in order to save execution + * time and program size. + * @{ + */ + +//#define DM_DISABLE_API_PARAM_CHECK /**< Macro to disable API parameters check. */ + +#undef NULL_PARAM_CHECK +#undef VERIFY_MODULE_INITIALIZED +#undef VERIFY_MODULE_INITIALIZED_VOID +#undef VERIFY_APP_REGISTERED +#undef VERIFY_APP_REGISTERED_VOID +#undef VERIFY_CONNECTION_INSTANCE +#undef VERIFY_DEVICE_INSTANCE + +#ifndef DM_DISABLE_API_PARAM_CHECK + +/**@brief Macro for verifying NULL parameters are not passed to API. + * + * @param[in] PARAM Parameter checked for NULL. + * + * @retval (NRF_ERROR_NULL | DEVICE_MANAGER_ERR_BASE) when @ref PARAM is NULL. + */ +#define NULL_PARAM_CHECK(PARAM) \ + if ((PARAM) == NULL) \ + { \ + return (NRF_ERROR_NULL | DEVICE_MANAGER_ERR_BASE); \ + } +/**@} */ + + +/**@brief Macro for verifying module's initialization status. + * + * @retval (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE) when module is not initialized. + */ +#define VERIFY_MODULE_INITIALIZED() \ + do \ + { \ + if (!m_module_initialized) \ + { \ + return (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE); \ + } \ + } while (0) + + +/**@brief Macro for verifying module's initialization status. Returns in case it is not initialized. + */ +#define VERIFY_MODULE_INITIALIZED_VOID() \ + do \ + { \ + if (!m_module_initialized) \ + { \ + return; \ + } \ + } while (0) + + +/**@brief Macro for verifying that the application is registered. + * + * @param[in] X Application instance identifier. + * + * @retval (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE) when module API is called without + * registering an application with the module. + */ +#define VERIFY_APP_REGISTERED(X) \ + do \ + { \ + if (((X) >= DEVICE_MANAGER_MAX_APPLICATIONS) || \ + (m_application_table[(X)].ntf_cb == NULL)) \ + { \ + return (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE); \ + } \ + } while (0) + + +/**@brief Macro for verifying that the application is registered. Returns in case it is not + * registered. + * + * @param[in] X Application instance identifier. + */ +#define VERIFY_APP_REGISTERED_VOID(X) \ + do \ + { \ + if (((X) >= DEVICE_MANAGER_MAX_APPLICATIONS) || \ + (m_application_table[(X)].ntf_cb == NULL)) \ + { \ + return; \ + } \ + } while (0) + + +/**@brief Macro for verifying connection instance is allocated. + * + * @param[in] X Connection instance identifier. + * + * @retval (NRF_ERROR_INVALID_ADDR | DEVICE_MANAGER_ERR_BASE) when connection instance is not + * allocated. + */ +#define VERIFY_CONNECTION_INSTANCE(X) \ + do \ + { \ + if (((X) >= DEVICE_MANAGER_MAX_CONNECTIONS) || \ + (m_connection_table[(X)].state == STATE_IDLE)) \ + { \ + return (NRF_ERROR_INVALID_ADDR | DEVICE_MANAGER_ERR_BASE); \ + } \ + } while (0) + + +/**@brief Macro for verifying if device instance is allocated. + * + * @param[in] X Device instance identifier. + * + * @retval (NRF_ERROR_INVALID_ADDR | DEVICE_MANAGER_ERR_BASE) when device instance is not allocated. + */ +#define VERIFY_DEVICE_INSTANCE(X) \ + do \ + { \ + if (((X) >= DEVICE_MANAGER_MAX_BONDS) || \ + (m_peer_table[(X)].id_bitmap == UNASSIGNED)) \ + { \ + return (NRF_ERROR_INVALID_ADDR | DEVICE_MANAGER_ERR_BASE); \ + } \ + } while (0) + +/**@brief Macro for verifying if device is bonded and thus can store data persistantly. + * + * @param[in] X Connection instance identifier. + * + * @retval (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE) when device is not bonded. + */ +#define VERIFY_DEVICE_BOND(X) \ + do \ + { \ + if ((m_connection_table[(X)].state & STATE_BONDED) != STATE_BONDED)\ + { \ + return (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE); \ + } \ + } while (0) +#else +#define NULL_PARAM_CHECK(X) +#define VERIFY_MODULE_INITIALIZED() +#define VERIFY_MODULE_INITIALIZED_VOID() +#define VERIFY_APP_REGISTERED(X) +#define VERIFY_APP_REGISTERED_VOID(X) +#define VERIFY_CONNECTION_INSTANCE(X) +#define VERIFY_DEVICE_INSTANCE(X) +#endif //DM_DISABLE_API_PARAM_CHECK +/** @} */ + +#define INVALID_CONTEXT_LEN 0xFFFFFFFF /**< Identifier for invalid context length. */ +/**@brief Macro for checking that application context size is greater that minimal size. + * + * @param[in] X Size of application context. + * + * @retval (NRF_ERROR_INVALID_PARAM) when size is smaller than minimun required size. + */ +#define SIZE_CHECK_APP_CONTEXT(X) \ + if ((X) < (APP_CONTEXT_MIN_SIZE)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + + +/** + * @defgroup dm_data_types Module's internal data types. + * + * @brief This section describes a module's internal data structures. + * @{ + */ +/**@brief Peer identification information. + */ +typedef struct +{ + ble_gap_id_key_t peer_id; /**< IRK and/or address of peer. */ + uint16_t ediv; /**< Peer's encrypted diversifier. */ + uint8_t id_bitmap; /**< Contains information if above field is valid. */ +} peer_id_t; + +STATIC_ASSERT(sizeof(peer_id_t) % 4 == 0); /**< Check to ensure Peer identification information is a multiple of 4. */ + +/**@brief Portion of bonding information exchanged by a device during bond creation that needs to + * be stored persistently. + * + * @note An entry is not made in this table unless device is bonded. + */ +typedef struct +{ + ble_gap_enc_key_t peer_enc_key; /**< Local LTK info, central IRK and address */ +} bond_context_t; + +STATIC_ASSERT(sizeof(bond_context_t) % 4 == 0); /**< Check to ensure bond information is a multiple of 4. */ + +/**@brief GATT Server Attributes size and data. + */ +typedef struct +{ + uint32_t flags; /**< Flags identifying the stored attributes. */ + uint32_t size; /**< Size of stored attributes. */ + uint8_t attributes[DM_GATT_SERVER_ATTR_MAX_SIZE]; /**< Array to hold the server attributes. */ +} dm_gatts_context_t; + +STATIC_ASSERT(sizeof(dm_gatts_context_t) % 4 == 0); /**< Check to ensure GATT Server Attributes size and data information is a multiple of 4. */ + +/**@brief GATT Client context information. Placeholder for now. + */ +typedef struct +{ + void * p_dummy; /**< Placeholder, currently unused. */ +} dm_gatt_client_context_t; + +STATIC_ASSERT(sizeof(dm_gatt_client_context_t) % 4 == 0); /**< Check to ensure GATT Client context information is a multiple of 4. */ +STATIC_ASSERT((DEVICE_MANAGER_APP_CONTEXT_SIZE % 4) == 0); /**< Check to ensure device manager application context information is a multiple of 4. */ + +/**@brief Connection instance definition. Maintains information with respect to an active peer. + */ +typedef struct +{ + ble_gap_addr_t peer_addr; /**< Peer identification information. This information is retained as long as the connection session exists, once disconnected, for non-bonded devices this information is not stored persistently. */ + uint16_t conn_handle; /**< Connection handle for the device. */ + uint8_t state; /**< Link state. */ + uint8_t bonded_dev_id; /**< In case the device is bonded, this points to the corresponding bonded device. This index can be used to index service and bond context as well. */ +} connection_instance_t; + +/**@brief Application instance definition. Maintains information with respect to a registered + * application. + */ +typedef struct +{ + dm_event_cb_t ntf_cb; /**< Callback registered with the application. */ + ble_gap_sec_params_t sec_param; /**< Local security parameters registered by the application. */ + uint8_t state; /**< Application state. Currently this is used only for knowing if any security procedure is in progress and/or a security procedure is pending to be requested. */ + uint8_t service; /**< Service registered by the application. */ +} application_instance_t; + +/**@brief Function for performing necessary action of storing each of the service context as + * registered by the application. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is stored. + * + * @retval Operation result code. + */ +typedef ret_code_t (* service_context_access_t)(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +/**@brief Function for performing necessary action of applying the context information. + * + * @param[in] p_handle Device handle identifying device that is stored. + * + * @retval Operation result code. + */ +typedef ret_code_t (* service_context_apply_t)(dm_handle_t * p_handle); + +/**@brief Function for performing necessary functions of storing or updating. + * + * @param[in] p_dest Destination address where data is stored persistently. + * @param[in] p_src Source address containing data to be stored. + * @param[in] size Size of data to be stored expressed in bytes. Must be word aligned. + * @param[in] offset Offset in bytes to be applied when writing to the block. + * + * @retval Operation result code. + */ +typedef uint32_t (* storage_operation)(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset); +/** @} */ + +/** + * @defgroup dm_tables Module's internal tables. + * + * @brief This section describes the module's internal tables and the static global variables + * needed for its functionality. + * @{ + */ +#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) +static uint8_t * m_app_context_table[DEVICE_MANAGER_MAX_BONDS]; /**< Table to remember application contexts of bonded devices. */ +#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE +__ALIGN(sizeof(uint32_t)) +static peer_id_t m_peer_table[DEVICE_MANAGER_MAX_BONDS] ; /**< Table to maintain bonded devices' identification information, an instance is allocated in the table when a device is bonded and freed when bond information is deleted. */ +__ALIGN(sizeof(uint32_t)) +static bond_context_t m_bond_table[DEVICE_MANAGER_MAX_CONNECTIONS]; /**< Table to maintain bond information for active peers. */ +static dm_gatts_context_t m_gatts_table[DEVICE_MANAGER_MAX_CONNECTIONS]; /**< Table for service information for active connection instances. */ +static connection_instance_t m_connection_table[DEVICE_MANAGER_MAX_CONNECTIONS]; /**< Table to maintain active peer information. An instance is allocated in the table when a new connection is established and freed on disconnection. */ +static application_instance_t m_application_table[DEVICE_MANAGER_MAX_APPLICATIONS]; /**< Table to maintain application instances. */ +static pstorage_handle_t m_storage_handle; /**< Persistent storage handle for blocks requested by the module. */ +static uint32_t m_peer_addr_update; /**< 32-bit bitmap to remember peer device address update. */ +static ble_gap_id_key_t m_local_id_info; /**< ID information of central in case resolvable address is used. */ +static bool m_module_initialized = false; /**< State indicating if module is initialized or not. */ +static uint8_t m_irk_index_table[DEVICE_MANAGER_MAX_BONDS]; /**< List maintaining IRK index list. */ + +SDK_MUTEX_DEFINE(m_dm_mutex) /**< Mutex variable. Currently unused, this declaration does not occupy any space in RAM. */ +/** @} */ + +static __INLINE ret_code_t no_service_context_store(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +static __INLINE ret_code_t gatts_context_store(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +static __INLINE ret_code_t gattc_context_store(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +static __INLINE ret_code_t gattsc_context_store(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +static __INLINE ret_code_t no_service_context_load(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +static __INLINE ret_code_t gatts_context_load(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +static __INLINE ret_code_t gattc_context_load(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +static __INLINE ret_code_t gattsc_context_load(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle); + +static __INLINE ret_code_t no_service_context_apply(dm_handle_t * p_handle); + +static __INLINE ret_code_t gatts_context_apply(dm_handle_t * p_handle); + +static __INLINE ret_code_t gattc_context_apply(dm_handle_t * p_handle); + +static __INLINE ret_code_t gattsc_context_apply(dm_handle_t * p_handle); + + +/**< Array of function pointers based on the types of service registered. */ +const service_context_access_t m_service_context_store[DM_SERVICE_CONTEXT_COUNT] = +{ + no_service_context_store, /**< Dummy function, when there is no service context registered. */ + gatts_context_store, /**< GATT Server context store function. */ + gattc_context_store, /**< GATT Client context store function. */ + gattsc_context_store /**< GATT Server & Client context store function. */ +}; + + +/**< Array of function pointers based on the types of service registered. */ +const service_context_access_t m_service_context_load[DM_SERVICE_CONTEXT_COUNT] = +{ + no_service_context_load, /**< Dummy function, when there is no service context registered. */ + gatts_context_load, /**< GATT Server context load function. */ + gattc_context_load, /**< GATT Client context load function. */ + gattsc_context_load /**< GATT Server & Client context load function. */ +}; + + +/**< Array of function pointers based on the types of service registered. */ +const service_context_apply_t m_service_context_apply[DM_SERVICE_CONTEXT_COUNT] = +{ + no_service_context_apply, /**< Dummy function, when there is no service context registered. */ + gatts_context_apply, /**< GATT Server context apply function. */ + gattc_context_apply, /**< GATT Client context apply function. */ + gattsc_context_apply /**< GATT Server & Client context apply function. */ +}; + + +const uint32_t m_context_init_len = 0xFFFFFFFF; /**< Constant used to update the initial value for context in the flash. */ + +/**@brief Function for setting update status for the device identified by 'index'. + * + * @param[in] index Device identifier. + */ +static __INLINE void update_status_bit_set(uint32_t index) +{ + m_peer_addr_update |= (BIT_0 << index); +} + + +/**@brief Function for resetting update status for device identified by 'index'. + * + * @param[in] index Device identifier. + */ +static __INLINE void update_status_bit_reset(uint32_t index) +{ + m_peer_addr_update &= (~((uint32_t)BIT_0 << index)); +} + + +/**@brief Function for providing update status for the device identified by 'index'. + * + * @param[in] index Device identifier. + * + * @retval true if the bit is set, false otherwise. + */ +static __INLINE bool update_status_bit_is_set(uint32_t index) +{ + return ((m_peer_addr_update & (BIT_0 << index)) ? true : false); +} + + +/**@brief Function for initialiasing the application instance identified by 'index'. + * + * @param[in] index Device identifier. + */ +static __INLINE void application_instance_init(uint32_t index) +{ + DM_TRC("[DM]: Initializing Application Instance 0x%08X.\r\n", index); + + m_application_table[index].ntf_cb = NULL; + m_application_table[index].state = 0x00; + m_application_table[index].service = 0x00; +} + + +/**@brief Function for initialiasing the connection instance identified by 'index'. + * + * @param[in] index Device identifier. + */ +static __INLINE void connection_instance_init(uint32_t index) +{ + DM_TRC("[DM]: Initializing Connection Instance 0x%08X.\r\n", index); + + m_connection_table[index].state = STATE_IDLE; + m_connection_table[index].conn_handle = BLE_CONN_HANDLE_INVALID; + m_connection_table[index].bonded_dev_id = DM_INVALID_ID; + + memset(&m_connection_table[index].peer_addr, 0, sizeof (ble_gap_addr_t)); +} + + +/**@brief Function for initialiasing the peer device instance identified by 'index'. + * + * @param[in] index Device identifier. + */ +static __INLINE void peer_instance_init(uint32_t index) +{ + DM_TRC("[DM]: Initializing Peer Instance 0x%08X.\r\n", index); + + memset(m_peer_table[index].peer_id.id_addr_info.addr, 0, BLE_GAP_ADDR_LEN); + memset(m_peer_table[index].peer_id.id_info.irk, 0, BLE_GAP_SEC_KEY_LEN); + + //Initialize the address type to invalid. + m_peer_table[index].peer_id.id_addr_info.addr_type = INVALID_ADDR_TYPE; + + //Initialize the identification bit map to unassigned. + m_peer_table[index].id_bitmap = UNASSIGNED; + + // Initialize diversifier. + m_peer_table[index].ediv = EDIV_INIT_VAL; + + + //Reset the status bit. + update_status_bit_reset(index); + +#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) + //Initialize the application context for bond device. + m_app_context_table[index] = NULL; +#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE +} + + +/**@brief Function for searching connection instance matching the connection handle and the state + * requested. + * + * @details Connection handle and state information is used to get a connection instance, it + * is possible to ignore the connection handle by using BLE_CONN_HANDLE_INVALID. + * + * @param[in] conn_handle Connection handle. + * @param[in] state Connection instance state. + * @param[out] p_instance Connection instance. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. Invalid state + * @retval NRF_ERROR_NOT_FOUND Operation failure. Not found + */ +static ret_code_t connection_instance_find(uint16_t conn_handle, + uint8_t state, + uint32_t * p_instance) +{ + ret_code_t err_code; + uint32_t index; + + err_code = NRF_ERROR_INVALID_STATE; + + for (index = 0; index < DEVICE_MANAGER_MAX_CONNECTIONS; index++) + { + //Search only based on the state. + if (state & m_connection_table[index].state) + { + //Ignore the connection handle. + if ((conn_handle == BLE_CONN_HANDLE_INVALID) || + (conn_handle == m_connection_table[index].conn_handle)) + { + //Search for matching connection handle. + (*p_instance) = index; + err_code = NRF_SUCCESS; + + break; + } + else + { + err_code = NRF_ERROR_NOT_FOUND; + } + } + } + + return err_code; +} + + +/**@brief Function for allocating device instance for a bonded device. + * + * @param[out] p_device_index Device index. + * @param[in] p_addr Peer identification information. + * + * @retval NRF_SUCCESS Operation success. + * @retval DM_DEVICE_CONTEXT_FULL Operation failure. + */ +static __INLINE ret_code_t device_instance_allocate(uint8_t * p_device_index, + ble_gap_addr_t const * p_addr) +{ + ret_code_t err_code; + uint32_t index; + + err_code = DM_DEVICE_CONTEXT_FULL; + + for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) + { + DM_TRC("[DM]:[DI 0x%02X]: Device type 0x%02X.\r\n", + index, m_peer_table[index].peer_id.id_addr_info.addr_type); + DM_TRC("[DM]: Device Addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n", + m_peer_table[index].peer_id.id_addr_info.addr[0], + m_peer_table[index].peer_id.id_addr_info.addr[1], + m_peer_table[index].peer_id.id_addr_info.addr[2], + m_peer_table[index].peer_id.id_addr_info.addr[3], + m_peer_table[index].peer_id.id_addr_info.addr[4], + m_peer_table[index].peer_id.id_addr_info.addr[5]); + + if (m_peer_table[index].id_bitmap == UNASSIGNED) + { + if (p_addr->addr_type != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE) + { + m_peer_table[index].id_bitmap &= (~ADDR_ENTRY); + m_peer_table[index].peer_id.id_addr_info = (*p_addr); + } + else + { + m_peer_table[index].id_bitmap &= (~IRK_ENTRY); + } + + (*p_device_index) = index; + err_code = NRF_SUCCESS; + + DM_LOG("[DM]: Allocated device instance 0x%02X\r\n", index); + + break; + } + } + + return err_code; +} + + +/**@brief Function for freeing a device instance allocated for bonded device. + * + * @param[in] device_index Device index. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + */ +static __INLINE ret_code_t device_instance_free(uint32_t device_index) +{ + ret_code_t err_code; + pstorage_handle_t block_handle; + + //Get the block handle. + err_code = pstorage_block_identifier_get(&m_storage_handle, device_index, &block_handle); + + if (err_code == NRF_SUCCESS) + { + DM_TRC("[DM]:[DI 0x%02X]: Freeing Instance.\r\n", device_index); + + //Request clearing of the block. + err_code = pstorage_clear(&block_handle, ALL_CONTEXT_SIZE); + + if (err_code == NRF_SUCCESS) + { + peer_instance_init(device_index); + } + } + + return err_code; +} + + +/**@brief Function for searching for the device in the bonded device list. + * + * @param[in] p_addr Peer identification information. + * @param[out] p_device_index Device index. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NOT_FOUND Operation failure. + */ +static ret_code_t device_instance_find(ble_gap_addr_t const * p_addr, uint32_t * p_device_index, uint16_t ediv) +{ + ret_code_t err_code; + uint32_t index; + + err_code = NRF_ERROR_NOT_FOUND; + + if (NULL != p_addr) + { + DM_TRC("[DM]: Searching for device 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n", + p_addr->addr[0], + p_addr->addr[1], + p_addr->addr[2], + p_addr->addr[3], + p_addr->addr[4], + p_addr->addr[5]); + } + + for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) + { + DM_TRC("[DM]:[DI 0x%02X]: Device type 0x%02X.\r\n", + index, m_peer_table[index].peer_id.id_addr_info.addr_type); + DM_TRC("[DM]: Device Addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n", + m_peer_table[index].peer_id.id_addr_info.addr[0], + m_peer_table[index].peer_id.id_addr_info.addr[1], + m_peer_table[index].peer_id.id_addr_info.addr[2], + m_peer_table[index].peer_id.id_addr_info.addr[3], + m_peer_table[index].peer_id.id_addr_info.addr[4], + m_peer_table[index].peer_id.id_addr_info.addr[5]); + + if (((NULL == p_addr) && (ediv == m_peer_table[index].ediv)) || + ((NULL != p_addr) && (memcmp(&m_peer_table[index].peer_id.id_addr_info, p_addr, sizeof(ble_gap_addr_t)) == 0))) + { + DM_LOG("[DM]: Found device at instance 0x%02X\r\n", index); + + (*p_device_index) = index; + err_code = NRF_SUCCESS; + + break; + } + } + + return err_code; +} + + +/**@brief Function for notifying connection manager event to the application. + * + * @param[in] p_handle Device handle identifying device. + * @param[in] p_event Connection manager event details. + * @param[in] event_result Event result code. + */ +static __INLINE void app_evt_notify(dm_handle_t const * const p_handle, + dm_event_t const * const p_event, + uint32_t event_result) +{ + dm_event_cb_t app_cb = m_application_table[0].ntf_cb; + + DM_MUTEX_UNLOCK(); + + DM_TRC("[DM]: Notifying application of event 0x%02X\r\n", p_event->event_id); + + //No need to do any kind of return value processing thus can be supressed. + UNUSED_VARIABLE(app_cb(p_handle, p_event, event_result)); + + DM_MUTEX_LOCK(); +} + + +/**@brief Function for allocating instance. + * + * @details The instance identifier is provided in the 'p_instance' parameter if the routine + * succeeds. + * + * @param[out] p_instance Connection instance. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NO_MEM Operation failure. No memory. + */ +static __INLINE uint32_t connection_instance_allocate(uint32_t * p_instance) +{ + uint32_t err_code; + + DM_TRC("[DM]: Request to allocation connection instance\r\n"); + + err_code = connection_instance_find(BLE_CONN_HANDLE_INVALID, STATE_IDLE, p_instance); + + if (err_code == NRF_SUCCESS) + { + DM_LOG("[DM]:[%02X]: Connection Instance Allocated.\r\n", (*p_instance)); + m_connection_table[*p_instance].state = STATE_CONNECTED; + } + else + { + DM_LOG("[DM]: No free connection instances available\r\n"); + err_code = NRF_ERROR_NO_MEM; + } + + return err_code; +} + + +/**@brief Function for freeing instance. Instance identifier is provided in the parameter + * 'p_instance' in case the routine succeeds. + * + * @param[in] p_instance Connection instance. + */ +static __INLINE void connection_instance_free(uint32_t const * p_instance) +{ + DM_TRC("[DM]:[CI 0x%02X]: Freeing connection instance\r\n", (*p_instance)); + + if (m_connection_table[*p_instance].state != STATE_IDLE) + { + DM_LOG("[DM]:[%02X]: Freed connection instance.\r\n", (*p_instance)); + connection_instance_init(*p_instance); + } +} + + +/**@brief Function for storage operation dummy handler. + * + * @param[in] p_dest Destination address where data is to be stored persistently. + * @param[in] p_src Source address containing data to be stored. API assumes this to be resident + * memory and no intermediate copy of data is made by the API. + * @param[in] size Size of data to be stored expressed in bytes. Should be word aligned. + * @param[in] offset Offset in bytes to be applied when writing to the block. + * For example, if within a block of 100 bytes, application wishes to + * write 20 bytes at offset of 12, then this field should be set to 12. + * Should be word aligned. + * + * @retval NRF_SUCCESS Operation success. + */ +static uint32_t storage_operation_dummy_handler(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset) +{ + return NRF_SUCCESS; +} + + +/**@brief Function for saving the device context persistently. + * + * @param[in] p_handle Device handle identifying device. + * @param[in] state Device store state. + */ +static __INLINE void device_context_store(dm_handle_t const * p_handle, device_store_state_t state) +{ + pstorage_handle_t block_handle; + storage_operation store_fn; + ret_code_t err_code; + + DM_LOG("[DM]: --> device_context_store\r\n"); + + err_code = pstorage_block_identifier_get(&m_storage_handle, + p_handle->device_id, + &block_handle); + + if (err_code == NRF_SUCCESS) + { + if ((STATE_BOND_INFO_UPDATE == + (m_connection_table[p_handle->connection_id].state & STATE_BOND_INFO_UPDATE)) || + (state == UPDATE_PEER_ADDR)) + { + DM_LOG("[DM]:[DI %02X]:[CI %02X]: -> Updating bonding information.\r\n", + p_handle->device_id, p_handle->connection_id); + + store_fn = pstorage_update; + } + else if (state == FIRST_BOND_STORE) + { + DM_LOG("[DM]:[DI %02X]:[CI %02X]: -> Storing bonding information.\r\n", + p_handle->device_id, p_handle->connection_id); + + store_fn = pstorage_store; + } + else + { + DM_LOG("[DM]:[DI %02X]:[CI %02X]: -> No update in bonding information.\r\n", + p_handle->device_id, p_handle->connection_id); + + //No operation needed. + store_fn = storage_operation_dummy_handler; + } + + //Store the peer id. + err_code = store_fn(&block_handle, + (uint8_t *)&m_peer_table[p_handle->device_id], + PEER_ID_SIZE, + PEER_ID_STORAGE_OFFSET); + + if ((err_code == NRF_SUCCESS) && (state != UPDATE_PEER_ADDR)) + { + m_connection_table[p_handle->connection_id].state &= (~STATE_BOND_INFO_UPDATE); + + //Store the bond information. + err_code = store_fn(&block_handle, + (uint8_t *)&m_bond_table[p_handle->connection_id], + BOND_SIZE, + BOND_STORAGE_OFFSET); + + if (err_code != NRF_SUCCESS) + { + DM_ERR("[DM]:[0x%02X]:Failed to store bond information, reason 0x%08X\r\n", + p_handle->device_id, err_code); + } + } + + if (state != UPDATE_PEER_ADDR) + { + //Store the service information + err_code = m_service_context_store[m_application_table[p_handle->appl_id].service] + ( + &block_handle, + p_handle + ); + + if (err_code != NRF_SUCCESS) + { + //Notify application of an error event. + DM_ERR("[DM]: Failed to store service context, reason %08X\r\n", err_code); + } + } + } + + if (err_code != NRF_SUCCESS) + { + //Notify application of an error event. + DM_ERR("[DM]: Failed to store device context, reason %08X\r\n", err_code); + } +} + + +/**@brief Function for storing when there is no service registered. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is loaded. + * + * @retval NRF_SUCCESS + */ +static __INLINE ret_code_t no_service_context_store(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle) +{ + DM_LOG("[DM]: --> no_service_context_store\r\n"); + + return NRF_SUCCESS; +} + + +/**@brief Function for storing GATT Server context. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is stored. + * + * @retval NRF_SUCCESS Operation success. + */ +static __INLINE ret_code_t gatts_context_store(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle) +{ + storage_operation store_fn; + uint32_t attr_flags = BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS | BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS; + uint16_t attr_len = DM_GATT_SERVER_ATTR_MAX_SIZE; + uint8_t sys_data[DM_GATT_SERVER_ATTR_MAX_SIZE]; + + DM_LOG("[DM]: --> gatts_context_store\r\n"); + + uint32_t err_code = sd_ble_gatts_sys_attr_get( + m_connection_table[p_handle->connection_id].conn_handle, + sys_data, + &attr_len, + attr_flags); + + if (err_code == NRF_SUCCESS) + { + if (memcmp(m_gatts_table[p_handle->connection_id].attributes, sys_data, attr_len) == 0) + { + //No store operation is needed. + DM_LOG("[DM]:[0x%02X]: No change in GATTS Context information.\r\n", + p_handle->device_id); + + if ((m_connection_table[p_handle->connection_id].state & STATE_CONNECTED) != + STATE_CONNECTED) + { + DM_LOG("[DM]:[0x%02X]: Resetting GATTS for active instance.\r\n", + p_handle->connection_id); + + //Reset GATTS information for the current context. + memset(&m_gatts_table[p_handle->connection_id], 0, sizeof(dm_gatts_context_t)); + } + } + else + { + if (m_gatts_table[p_handle->connection_id].size != 0) + { + //There is data already stored in persistent memory, therefore an update is needed. + DM_LOG("[DM]:[0x%02X]: Updating stored service context\r\n", p_handle->device_id); + + store_fn = pstorage_update; + } + else + { + //Fresh write, a store is needed. + DM_LOG("[DM]:[0x%02X]: Storing service context\r\n", p_handle->device_id); + + store_fn = pstorage_store; + } + + m_gatts_table[p_handle->connection_id].flags = attr_flags; + m_gatts_table[p_handle->connection_id].size = attr_len; + memcpy(m_gatts_table[p_handle->connection_id].attributes, sys_data, attr_len); + + DM_DUMP((uint8_t *)&m_gatts_table[p_handle->connection_id], sizeof(dm_gatts_context_t)); + + DM_LOG("[DM]:[0x%02X]: GATTS Data size 0x%08X\r\n", + p_handle->device_id, + m_gatts_table[p_handle->connection_id].size); + + //Store GATTS information. + err_code = store_fn((pstorage_handle_t *)p_block_handle, + (uint8_t *)&m_gatts_table[p_handle->connection_id], + GATTS_SERVICE_CONTEXT_SIZE, + SERVICE_STORAGE_OFFSET); + + if (err_code != NRF_SUCCESS) + { + DM_ERR("[DM]:[0x%02X]:Failed to store service context, reason 0x%08X\r\n", + p_handle->device_id, + err_code); + } + else + { + DM_LOG("[DM]: Service context successfully stored.\r\n"); + } + } + } + + return NRF_SUCCESS; +} + + +/**@brief Function for storing GATT Client context. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is stored. + * + * @retval NRF_SUCCESS Operation success. + */ +static __INLINE ret_code_t gattc_context_store(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle) +{ + DM_LOG("[DM]: --> gattc_context_store\r\n"); + + return NRF_SUCCESS; +} + + +/**@brief Function for storing GATT Server & Client context. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is stored. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + */ +static __INLINE ret_code_t gattsc_context_store(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle) +{ + DM_LOG("[DM]: --> gattsc_context_store\r\n"); + + ret_code_t err_code = gatts_context_store(p_block_handle, p_handle); + + if (NRF_SUCCESS == err_code) + { + err_code = gattc_context_store(p_block_handle, p_handle); + } + + return err_code; +} + + +/**@brief Function for loading when there is no service registered. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is loaded. + * + * @retval NRF_SUCCESS + */ +static __INLINE ret_code_t no_service_context_load(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle) +{ + DM_LOG("[DM]: --> no_service_context_load\r\n"); + + return NRF_SUCCESS; +} + + +/**@brief Function for loading GATT Server context. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is loaded. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + */ +static __INLINE ret_code_t gatts_context_load(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle) +{ + DM_LOG("[DM]:[CI 0x%02X]:[DI 0x%02X]: --> gatts_context_load\r\n", + p_handle->connection_id, + p_handle->device_id); + + ret_code_t err_code = pstorage_load((uint8_t *)&m_gatts_table[p_handle->connection_id], + (pstorage_handle_t *)p_block_handle, + GATTS_SERVICE_CONTEXT_SIZE, + SERVICE_STORAGE_OFFSET); + + if (err_code == NRF_SUCCESS) + { + DM_LOG("[DM]:[%02X]:[Block ID 0x%08X]: Service context loaded, size 0x%08X\r\n", + p_handle->connection_id, + p_block_handle->block_id, + m_gatts_table[p_handle->connection_id].size); + DM_DUMP((uint8_t *)&m_gatts_table[p_handle->connection_id], sizeof(dm_gatts_context_t)); + + if (m_gatts_table[p_handle->connection_id].size == DM_GATTS_INVALID_SIZE) + { + m_gatts_table[p_handle->connection_id].size = 0; + } + } + else + { + DM_ERR("[DM]:[%02X]: Failed to load Service context, reason %08X\r\n", + p_handle->connection_id, + err_code); + } + + return err_code; +} + + +/**@brief Function for loading GATT Client context. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is loaded. + * + * @retval NRF_SUCCESS + */ +static __INLINE ret_code_t gattc_context_load(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle) +{ + DM_LOG("[DM]: --> gattc_context_load\r\n"); + + return NRF_SUCCESS; +} + + +/**@brief Function for loading GATT Server & Client context. + * + * @param[in] p_block_handle Storage block identifier. + * @param[in] p_handle Device handle identifying device that is loaded. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + */ +static __INLINE ret_code_t gattsc_context_load(pstorage_handle_t const * p_block_handle, + dm_handle_t const * p_handle) +{ + DM_LOG("[DM]: --> gattsc_context_load\r\n"); + + ret_code_t err_code = gatts_context_load(p_block_handle, p_handle); + + if (NRF_SUCCESS == err_code) + { + err_code = gattc_context_load(p_block_handle, p_handle); + } + + return err_code; +} + + +/**@brief Function for applying when there is no service registered. + * + * @param[in] p_handle Device handle identifying device that is applied. + * + * @retval NRF_SUCCESS + */ +static __INLINE ret_code_t no_service_context_apply(dm_handle_t * p_handle) +{ + DM_LOG("[DM]: --> no_service_context_apply\r\n"); + DM_LOG("[DM]:[CI 0x%02X]: No Service context\r\n", p_handle->connection_id); + + return NRF_SUCCESS; +} + + +/**@brief Function for applying GATT Server context. + * + * @param[in] p_handle Device handle identifying device that is applied. + * + * @retval NRF_SUCCESS On success. + * @retval DM_SERVICE_CONTEXT_NOT_APPLIED On failure. + */ +static __INLINE ret_code_t gatts_context_apply(dm_handle_t * p_handle) +{ + uint32_t err_code; + + uint8_t * p_gatts_context = NULL; + uint16_t context_len = 0; + uint32_t context_flags = 0; + + DM_LOG("[DM]: --> gatts_context_apply\r\n"); + DM_LOG("[DM]:[CI 0x%02X]: State 0x%02X, Size 0x%08X\r\n", + p_handle->connection_id, + m_connection_table[p_handle->connection_id].state, + m_gatts_table[p_handle->connection_id].size); + + if ((m_gatts_table[p_handle->connection_id].size != 0) && + ( + ((m_connection_table[p_handle->connection_id].state & STATE_LINK_ENCRYPTED) == STATE_LINK_ENCRYPTED) && + ((m_connection_table[p_handle->connection_id].state & STATE_BOND_INFO_UPDATE) + != STATE_BOND_INFO_UPDATE) + ) + ) + { + DM_LOG("[DM]: Setting stored context.\r\n"); + + p_gatts_context = &m_gatts_table[p_handle->connection_id].attributes[0]; + context_len = m_gatts_table[p_handle->connection_id].size; + context_flags = m_gatts_table[p_handle->connection_id].flags; + } + + err_code = sd_ble_gatts_sys_attr_set(m_connection_table[p_handle->connection_id].conn_handle, + p_gatts_context, + context_len, + context_flags); + + if (err_code == NRF_ERROR_INVALID_DATA) + { + // Indication that the ATT table has changed. Restore the system attributes to system + // services only and send a service changed indication if possible. + context_flags = BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS; + err_code = sd_ble_gatts_sys_attr_set(m_connection_table[p_handle->connection_id].conn_handle, + p_gatts_context, + context_len, + context_flags); + } + + if (err_code != NRF_SUCCESS) + { + DM_LOG("[DM]: Failed to set system attributes, reason 0x%08X.\r\n", err_code); + + err_code = DM_SERVICE_CONTEXT_NOT_APPLIED; + } + + if (context_flags == BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS) + { + err_code = sd_ble_gatts_service_changed(m_connection_table[p_handle->connection_id].conn_handle, + 0x000C, + 0xFFFF); + if (err_code != NRF_SUCCESS) + { + DM_LOG("[DM]: Failed to send Service Changed indication, reason 0x%08X.\r\n", err_code); + if ((err_code != BLE_ERROR_INVALID_CONN_HANDLE) && + (err_code != NRF_ERROR_INVALID_STATE) && + (err_code != BLE_ERROR_NO_TX_PACKETS) && + (err_code != NRF_ERROR_BUSY)) + { + // Those errors can be expected when sending trying to send Service Changed + // Indication if the CCCD is not set to indicate. Thus set the returning error + // code to success. + err_code = NRF_SUCCESS; + } + else + { + err_code = DM_SERVICE_CONTEXT_NOT_APPLIED; + } + } + } + + return err_code; +} + + +/**@brief Function for applying GATT Client context. + * + * @param[in] p_handle Device handle identifying device that is applied. + * + * @retval NRF_SUCCESS On success. + */ +static __INLINE ret_code_t gattc_context_apply(dm_handle_t * p_handle) +{ + DM_LOG("[DM]: --> gattc_context_apply\r\n"); + + return NRF_SUCCESS; +} + + +/**@brief Function for applying GATT Server & Client context. + * + * @param[in] p_handle Device handle identifying device that is applied. + * + * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. + */ +static __INLINE ret_code_t gattsc_context_apply(dm_handle_t * p_handle) +{ + uint32_t err_code; + + DM_LOG("[DM]: --> gattsc_context_apply\r\n"); + + err_code = gatts_context_apply(p_handle); + + if (err_code == NRF_SUCCESS) + { + err_code = gattc_context_apply(p_handle); + } + + return err_code; +} + + +/**@brief Function for pstorage module callback. + * + * @param[in] p_handle Identifies module and block for which callback is received. + * @param[in] op_code Identifies the operation for which the event is notified. + * @param[in] result Identifies the result of flash access operation. + * NRF_SUCCESS implies, operation succeeded. + * @param[in] p_data Identifies the application data pointer. In case of store operation, this + * points to the resident source of application memory that application can now + * free or reuse. In case of clear, this is NULL as no application pointer is + * needed for this operation. + * @param[in] data_len Length of data provided by the application for the operation. + */ +static void dm_pstorage_cb_handler(pstorage_handle_t * p_handle, + uint8_t op_code, + uint32_t result, + uint8_t * p_data, + uint32_t data_len) +{ + VERIFY_APP_REGISTERED_VOID(0); + + if (data_len > ALL_CONTEXT_SIZE) + { + //Clearing of all bonds at initialization, no event is generated. + return; + } + + DM_MUTEX_LOCK(); + + dm_event_t dm_event; + dm_handle_t dm_handle; + dm_context_t context_data; + pstorage_handle_t block_handle; + uint32_t index_count; + uint32_t err_code; + + bool app_notify = true; + + err_code = dm_handle_initialize(&dm_handle); + APP_ERROR_CHECK(err_code); + + dm_handle.appl_id = 0; + dm_event.event_id = 0x00; + + //Construct the event which it is related to. + + //Initialize context data information and length. + context_data.p_data = p_data; + context_data.len = data_len; + + for (uint32_t index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) + { + err_code = pstorage_block_identifier_get(&m_storage_handle, index, &block_handle); + if ((err_code == NRF_SUCCESS) && + ( + (memcmp(p_handle, &block_handle, sizeof(pstorage_handle_t)) == 0) + ) + ) + { + dm_handle.device_id = index; + break; + } + } + + if (dm_handle.device_id != DM_INVALID_ID) + { + if (op_code == PSTORAGE_CLEAR_OP_CODE) + { + if (data_len == ALL_CONTEXT_SIZE) + { + dm_event.event_id = DM_EVT_DEVICE_CONTEXT_BASE; + } + else + { + dm_event.event_id = DM_EVT_APP_CONTEXT_BASE; + } + } + else + { + //Update or store operation. + //Context is identified based on the pointer value. Device context, application context + //and service context all have their own value range. + index_count = ((uint32_t)(p_data - (uint8_t *)m_peer_table)) / PEER_ID_SIZE; + + if (index_count < DEVICE_MANAGER_MAX_BONDS) + { + dm_event.event_param.p_device_context = &context_data; + + //Only the peer identification is stored, not bond information. Hence do not notify + //the application yet, unless the store operation resulted in a failure. + if ((result == NRF_SUCCESS) && + ( + (update_status_bit_is_set(dm_handle.device_id) == false) + ) + ) + { + app_notify = false; + } + else + { + //Reset update status since update is complete. + update_status_bit_reset(dm_handle.device_id); + + //Notify application of error in storing the context. + dm_event.event_id = DM_EVT_DEVICE_CONTEXT_BASE; + } + } + else + { + index_count = ((uint32_t)(p_data - (uint8_t *)m_bond_table)) / BOND_SIZE; + + if (index_count < DEVICE_MANAGER_MAX_CONNECTIONS) + { + DM_LOG("[DM]:[0x%02X]:[0x%02X]: Bond context Event\r\n", + dm_handle.device_id, + dm_handle.connection_id); + + dm_event.event_param.p_device_context = &context_data; + dm_event.event_id = DM_EVT_DEVICE_CONTEXT_BASE; + dm_handle.connection_id = index_count; + + ble_gap_sec_keyset_t keys_exchanged; + keys_exchanged.keys_peer.p_enc_key = NULL; + keys_exchanged.keys_peer.p_id_key = &m_local_id_info; + keys_exchanged.keys_own.p_enc_key = &m_bond_table[index_count].peer_enc_key; + keys_exchanged.keys_own.p_id_key = &m_peer_table[dm_handle.device_id].peer_id; + + //Context information updated to provide the keys. + context_data.p_data = (uint8_t *)&keys_exchanged; + context_data.len = sizeof(ble_gap_sec_keyset_t); + } + else + { + index_count = ((uint32_t)(p_data - (uint8_t *)m_gatts_table)) / + GATTS_SERVICE_CONTEXT_SIZE; + + if (index_count < DEVICE_MANAGER_MAX_CONNECTIONS) + { + DM_LOG("[DM]:[0x%02X]:[0x%02X]: Service context Event\r\n", + dm_handle.device_id, + dm_handle.connection_id); + + //Notify application. + dm_event.event_id = DM_EVT_SERVICE_CONTEXT_BASE; + dm_handle.connection_id = index_count; + dm_handle.service_id = DM_PROTOCOL_CNTXT_GATT_SRVR_ID; + + //Reset the service context now that it was successfully written to the + //application and the link is disconnected. + if ((m_connection_table[index_count].state & STATE_CONNECTED) != + STATE_CONNECTED) + { + DM_LOG("[DM]:[0x%02X]:[0x%02X]: Resetting bond information for " + "active instance.\r\n", + dm_handle.device_id, + dm_handle.connection_id); + + memset(&m_gatts_table[dm_handle.connection_id], + 0, + sizeof(dm_gatts_context_t)); + } + } + else + { + DM_LOG("[DM]:[0x%02X]:[0x%02X]: App context Event\r\n", + dm_handle.device_id, + dm_handle.connection_id); + + app_notify = false; + dm_event.event_id = DM_EVT_APP_CONTEXT_BASE; +#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) + + if (p_data == (uint8_t *)(&m_context_init_len)) + { + //Context data is deleted. + //This is a workaround to get the right event as on delete operation + //update operation is used instead of clear. + op_code = PSTORAGE_CLEAR_OP_CODE; + app_notify = true; + } + else if (m_app_context_table[dm_handle.device_id] == p_data) + { + app_notify = true; + dm_event.event_param.p_app_context = &context_data; + + //Verify if the device is connected, if yes set connection instance. + for (uint32_t index = 0; + index < DEVICE_MANAGER_MAX_CONNECTIONS; + index++) + { + if (dm_handle.device_id == m_connection_table[index].bonded_dev_id) + { + dm_handle.connection_id = index; + break; + } + } + } + else + { + //No implementation needed. + } +#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE + } + } + } + } + + if (app_notify == true) + { + if (op_code == PSTORAGE_CLEAR_OP_CODE) + { + dm_event.event_id |= DM_CLEAR_OPERATION_ID; + } + else if (op_code == PSTORAGE_LOAD_OP_CODE) + { + dm_event.event_id |= DM_LOAD_OPERATION_ID; + } + else + { + dm_event.event_id |= DM_STORE_OPERATION_ID; + } + + dm_event.event_param.p_app_context = &context_data; + app_evt_notify(&dm_handle, &dm_event, result); + } + } + + DM_MUTEX_UNLOCK(); +} + + +ret_code_t dm_init(dm_init_param_t const * const p_init_param) +{ + pstorage_module_param_t param; + pstorage_handle_t block_handle; + ret_code_t err_code; + uint32_t index; + + DM_LOG("[DM]: >> dm_init.\r\n"); + + NULL_PARAM_CHECK(p_init_param); + + SDK_MUTEX_INIT(m_dm_mutex); + + DM_MUTEX_LOCK(); + + for (index = 0; index < DEVICE_MANAGER_MAX_APPLICATIONS; index++) + { + application_instance_init(index); + } + + for (index = 0; index < DEVICE_MANAGER_MAX_CONNECTIONS; index++) + { + connection_instance_init(index); + } + + memset(m_gatts_table, 0, sizeof(m_gatts_table)); + + //Initialization of all device instances. + for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) + { + peer_instance_init(index); + m_irk_index_table[index] = DM_INVALID_ID; + } + + //All context with respect to a particular device is stored contiguously. + param.block_size = ALL_CONTEXT_SIZE; + param.block_count = DEVICE_MANAGER_MAX_BONDS; + param.cb = dm_pstorage_cb_handler; + + err_code = pstorage_register(¶m, &m_storage_handle); + + if (err_code == NRF_SUCCESS) + { + m_module_initialized = true; + + if (p_init_param->clear_persistent_data == false) + { + DM_LOG("[DM]: Storage handle 0x%08X.\r\n", m_storage_handle.block_id); + + //Copy bonded peer device address and IRK to RAM table. + + //Bonded devices are stored in range (0,DEVICE_MANAGER_MAX_BONDS-1). The remaining + //range is for active connections that may or may not be bonded. + for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) + { + err_code = pstorage_block_identifier_get(&m_storage_handle, index, &block_handle); + + //Issue read request if you successfully get the block identifier. + if (err_code == NRF_SUCCESS) + { + DM_TRC("[DM]:[0x%02X]: Block handle 0x%08X.\r\n", index, block_handle.block_id); + + err_code = pstorage_load((uint8_t *)&m_peer_table[index], + &block_handle, + sizeof(peer_id_t), + 0); + + if (err_code != NRF_SUCCESS) + { + // In case a peer device could not be loaded successfully, rest of the + // initialization procedure are skipped and an error is sent to the + // application. + DM_ERR( + "[DM]: Failed to load peer device %08X from storage, reason %08X.\r\n", + index, + err_code); + + m_module_initialized = false; + break; + } + else + { + DM_TRC("[DM]:[DI 0x%02X]: Device type 0x%02X.\r\n", + index, + m_peer_table[index].peer_id.id_addr_info.addr_type); + DM_TRC("[DM]: Device Addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n", + m_peer_table[index].peer_id.id_addr_info.addr[0], + m_peer_table[index].peer_id.id_addr_info.addr[1], + m_peer_table[index].peer_id.id_addr_info.addr[2], + m_peer_table[index].peer_id.id_addr_info.addr[3], + m_peer_table[index].peer_id.id_addr_info.addr[4], + m_peer_table[index].peer_id.id_addr_info.addr[5]); + } + } + else + { + //In case a peer device could not be loaded successfully, rest of the + //initialization procedure are skipped and an error is sent to the application. + DM_LOG("[DM]: Failed to get block handle for instance %08X, reason %08X.\r\n", + index, + err_code); + + m_module_initialized = false; + break; + } + } + } + else + { + err_code = pstorage_clear(&m_storage_handle, (param.block_size * param.block_count)); + DM_ERR("[DM]: Successfully requested clear of persistent data.\r\n"); + } + } + else + { + DM_ERR("[DM]: Failed to register with storage module, reason 0x%08X.\r\n", err_code); + } + + DM_MUTEX_UNLOCK(); + + DM_TRC("[DM]: << dm_init.\r\n"); + + return err_code; +} + + +ret_code_t dm_register(dm_application_instance_t * p_appl_instance, + dm_application_param_t const * p_appl_param) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_appl_instance); + NULL_PARAM_CHECK(p_appl_param); + NULL_PARAM_CHECK(p_appl_param->evt_handler); + + DM_MUTEX_LOCK(); + + DM_LOG("[DM]: >> dm_register.\r\n"); + + uint32_t err_code; + + //Verify if an application instance is available. Currently only one instance is supported. + if (m_application_table[0].ntf_cb == NULL) + { + DM_LOG("[DM]: Application Instance allocated.\r\n"); + + //Mark instance as allocated. + m_application_table[0].ntf_cb = p_appl_param->evt_handler; + m_application_table[0].sec_param = p_appl_param->sec_param; + m_application_table[0].service = p_appl_param->service_type; + + m_application_table[0].sec_param.kdist_peer.enc = 0; + m_application_table[0].sec_param.kdist_peer.id = 1; + m_application_table[0].sec_param.kdist_peer.sign = 0; + m_application_table[0].sec_param.kdist_own.enc = 1; + m_application_table[0].sec_param.kdist_own.id = 1; + m_application_table[0].sec_param.kdist_own.sign = 0; + //Populate application's instance variable with the assigned allocation instance. + *p_appl_instance = 0; + err_code = NRF_SUCCESS; + } + else + { + err_code = (NRF_ERROR_NO_MEM | DEVICE_MANAGER_ERR_BASE); + } + + DM_MUTEX_UNLOCK(); + + DM_TRC("[DM]: << dm_register.\r\n"); + + return err_code; +} + + +ret_code_t dm_security_setup_req(dm_handle_t * p_handle) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_CONNECTION_INSTANCE(p_handle->connection_id); + + DM_MUTEX_LOCK(); + + DM_LOG("[DM]: >> dm_security_setup_req\r\n"); + + uint32_t err_code = (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE); + + if ((m_connection_table[p_handle->connection_id].state & STATE_CONNECTED) == STATE_CONNECTED) + { + err_code = sd_ble_gap_authenticate(m_connection_table[p_handle->connection_id].conn_handle, + &m_application_table[0].sec_param); + } + + DM_TRC("[DM]: << dm_security_setup_req, 0x%08X\r\n", err_code); + + DM_MUTEX_UNLOCK(); + + return err_code; +} + + +ret_code_t dm_security_status_req(dm_handle_t const * p_handle, + dm_security_status_t * p_status) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_status); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_CONNECTION_INSTANCE(p_handle->connection_id); + + DM_MUTEX_LOCK(); + + DM_LOG("[DM]: >> dm_security_status_req\r\n"); + + if ((m_connection_table[p_handle->connection_id].state & STATE_PAIRING) || + (m_connection_table[p_handle->connection_id].state & STATE_PAIRING_PENDING)) + { + (*p_status) = ENCRYPTION_IN_PROGRESS; + } + else if (m_connection_table[p_handle->connection_id].state & STATE_LINK_ENCRYPTED) + { + (*p_status) = ENCRYPTED; + } + else + { + (*p_status) = NOT_ENCRYPTED; + } + + DM_TRC("[DM]: << dm_security_status_req\r\n"); + + DM_MUTEX_UNLOCK(); + + return NRF_SUCCESS; +} + + +ret_code_t dm_whitelist_create(dm_application_instance_t const * p_handle, + ble_gap_whitelist_t * p_whitelist) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_whitelist); + NULL_PARAM_CHECK(p_whitelist->pp_addrs); + NULL_PARAM_CHECK(p_whitelist->pp_irks); + VERIFY_APP_REGISTERED(*p_handle); + + DM_MUTEX_LOCK(); + + DM_LOG("[DM]: >> dm_whitelist_create\r\n"); + + uint32_t addr_count = 0; + uint32_t irk_count = 0; + bool connected = false; + + for (uint32_t index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) + { + connected = false; + + for (uint32_t c_index = 0; c_index < DEVICE_MANAGER_MAX_CONNECTIONS; c_index++) + { + if ((index == m_connection_table[c_index].bonded_dev_id) && + ((m_connection_table[c_index].state & STATE_CONNECTED) == STATE_CONNECTED)) + { + connected = true; + break; + } + } + + if (connected == false) + { + if ((irk_count < p_whitelist->irk_count) && + ((m_peer_table[index].id_bitmap & IRK_ENTRY) == 0)) + { + p_whitelist->pp_irks[irk_count] = &m_peer_table[index].peer_id.id_info; + m_irk_index_table[irk_count] = index; + irk_count++; + } + + if ((addr_count < p_whitelist->addr_count) && + (m_peer_table[index].id_bitmap & ADDR_ENTRY) == 0) + { + p_whitelist->pp_addrs[addr_count] = &m_peer_table[index].peer_id.id_addr_info; + addr_count++; + } + } + } + + p_whitelist->addr_count = addr_count; + p_whitelist->irk_count = irk_count; + + DM_LOG("[DM]: Created whitelist, number of IRK = 0x%02X, number of addr = 0x%02X\r\n", + irk_count, + addr_count); + + DM_TRC("[DM]: << dm_whitelist_create\r\n"); + + DM_MUTEX_UNLOCK(); + + return NRF_SUCCESS; +} + + +ret_code_t dm_device_add(dm_handle_t * p_handle, + dm_device_context_t const * p_context) +{ + return (API_NOT_IMPLEMENTED | DEVICE_MANAGER_ERR_BASE); +} + + +ret_code_t dm_device_delete(dm_handle_t const * p_handle) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_device_delete\r\n"); + + uint32_t err_code = device_instance_free(p_handle->device_id); + + DM_TRC("[DM]: << dm_device_delete\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; +} + + +ret_code_t dm_device_delete_all(dm_application_instance_t const * p_handle) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + VERIFY_APP_REGISTERED((*p_handle)); + + DM_MUTEX_LOCK(); + + uint32_t err_code = NRF_SUCCESS; + + DM_TRC("[DM]: >> dm_device_delete_all\r\n"); + + for (uint32_t index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) + { + if (m_peer_table[index].id_bitmap != UNASSIGNED) + { + err_code = device_instance_free(index); + } + } + + DM_TRC("[DM]: << dm_device_delete_all\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; +} + + +ret_code_t dm_service_context_set(dm_handle_t const * p_handle, + dm_service_context_t const * p_context) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_context); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_CONNECTION_INSTANCE(p_handle->connection_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_service_context_set\r\n"); + + if ((p_context->context_data.p_data != NULL) && + ( + (p_context->context_data.len != 0) && + (p_context->context_data.len < DM_GATT_SERVER_ATTR_MAX_SIZE) + ) + ) + { + if (p_context->service_type == DM_PROTOCOL_CNTXT_GATT_SRVR_ID) + { + memcpy(m_gatts_table[p_handle->connection_id].attributes, + p_context->context_data.p_data, + p_context->context_data.len); + } + } + + pstorage_handle_t block_handle; + uint32_t err_code = pstorage_block_identifier_get(&m_storage_handle, + p_handle->device_id, + &block_handle); + + err_code = m_service_context_store[p_context->service_type](&block_handle, p_handle); + + DM_TRC("[DM]: << dm_service_context_set\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; +} + + +ret_code_t dm_service_context_get(dm_handle_t const * p_handle, + dm_service_context_t * p_context) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_context); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + + if ((m_connection_table[p_handle->connection_id].state & STATE_CONNECTED) != STATE_CONNECTED) + { + DM_TRC("[DM]: Device must be connected to get context. \r\n"); + + return (FEATURE_NOT_ENABLED | DEVICE_MANAGER_ERR_BASE); + } + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_service_context_get\r\n"); + + if (p_context->service_type == DM_PROTOCOL_CNTXT_GATT_SRVR_ID) + { + p_context->context_data.p_data = m_gatts_table[p_handle->connection_id].attributes; + p_context->context_data.len = m_gatts_table[p_handle->connection_id].size; + } + + pstorage_handle_t block_handle; + uint32_t err_code = pstorage_block_identifier_get(&m_storage_handle, + p_handle->device_id, + &block_handle); + + err_code = m_service_context_load[p_context->service_type](&block_handle, p_handle); + + if (p_context->service_type == DM_PROTOCOL_CNTXT_GATT_SRVR_ID) + { + p_context->context_data.p_data = m_gatts_table[p_handle->connection_id].attributes; + p_context->context_data.len = m_gatts_table[p_handle->connection_id].size; + } + + DM_TRC("[DM]: << dm_service_context_get\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; +} + + +ret_code_t dm_service_context_delete(dm_handle_t const * p_handle) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + + DM_LOG("[DM]: Context delete is not supported yet.\r\n"); + + return (API_NOT_IMPLEMENTED | DEVICE_MANAGER_ERR_BASE); +} + + +ret_code_t dm_application_context_set(dm_handle_t const * p_handle, + dm_application_context_t const * p_context) +{ +#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_context); + NULL_PARAM_CHECK(p_context->p_data); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + VERIFY_DEVICE_BOND(p_handle->connection_id); + SIZE_CHECK_APP_CONTEXT(p_context->len); + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_application_context_set\r\n"); + + uint32_t err_code; + uint32_t context_len; + pstorage_handle_t block_handle; + + storage_operation store_fn = pstorage_store; + + err_code = pstorage_block_identifier_get(&m_storage_handle, + p_handle->device_id, + &block_handle); + + if (err_code == NRF_SUCCESS) + { + err_code = pstorage_load((uint8_t *)&context_len, + &block_handle, + sizeof(uint32_t), + APP_CONTEXT_STORAGE_OFFSET); + + if ((err_code == NRF_SUCCESS) && (context_len != INVALID_CONTEXT_LEN)) + { + //Data already exists. Need an update. + store_fn = pstorage_update; + + DM_LOG("[DM]:[DI 0x%02X]: Updating existing application context, existing len 0x%08X, " + "new length 0x%08X.\r\n", + p_handle->device_id, + context_len, + p_context->len); + } + else + { + DM_LOG("[DM]: Storing application context.\r\n"); + } + + //Store/update context length. + err_code = store_fn(&block_handle, + (uint8_t *)(&p_context->len), + sizeof(uint32_t), + APP_CONTEXT_STORAGE_OFFSET); + + if (err_code == NRF_SUCCESS) + { + //Update context data is used for application context as flash is never + //cleared if a delete of application context is called. + err_code = pstorage_update(&block_handle, + p_context->p_data, + DEVICE_MANAGER_APP_CONTEXT_SIZE, + (APP_CONTEXT_STORAGE_OFFSET + sizeof(uint32_t))); + if (err_code == NRF_SUCCESS) + { + m_app_context_table[p_handle->device_id] = p_context->p_data; + } + } + } + + DM_TRC("[DM]: << dm_application_context_set\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; + +#else //DEVICE_MANAGER_APP_CONTEXT_SIZE + return (FEATURE_NOT_ENABLED | DEVICE_MANAGER_ERR_BASE); +#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE +} + + +ret_code_t dm_application_context_get(dm_handle_t const * p_handle, + dm_application_context_t * p_context) +{ +#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_context); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_application_context_get\r\n"); + + uint32_t context_len; + uint32_t err_code; + pstorage_handle_t block_handle; + + //Check if the context exists. + if (NULL == p_context->p_data) + { + p_context->p_data = m_app_context_table[p_handle->device_id]; + } + else + { + m_app_context_table[p_handle->device_id] = p_context->p_data; + } + + err_code = pstorage_block_identifier_get(&m_storage_handle, + p_handle->device_id, + &block_handle); + + if (err_code == NRF_SUCCESS) + { + err_code = pstorage_load((uint8_t *)&context_len, + &block_handle, + sizeof(uint32_t), + APP_CONTEXT_STORAGE_OFFSET); + + if ((err_code == NRF_SUCCESS) && (context_len != INVALID_CONTEXT_LEN)) + { + err_code = pstorage_load(p_context->p_data, + &block_handle, + DEVICE_MANAGER_APP_CONTEXT_SIZE, + (APP_CONTEXT_STORAGE_OFFSET + sizeof(uint32_t))); + if (err_code == NRF_SUCCESS) + { + p_context->len = context_len; + } + } + else + { + err_code = DM_NO_APP_CONTEXT; + } + } + + DM_TRC("[DM]: << dm_application_context_get\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; + +#else //DEVICE_MANAGER_APP_CONTEXT_SIZE + return (FEATURE_NOT_ENABLED | DEVICE_MANAGER_ERR_BASE); +#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE +} + + +ret_code_t dm_application_context_delete(const dm_handle_t * p_handle) +{ +#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_application_context_delete\r\n"); + + uint32_t err_code; + uint32_t context_len; + pstorage_handle_t block_handle; + + err_code = pstorage_block_identifier_get(&m_storage_handle, + p_handle->device_id, + &block_handle); + + if (err_code == NRF_SUCCESS) + { + err_code = pstorage_load((uint8_t *)&context_len, + &block_handle, + sizeof(uint32_t), + APP_CONTEXT_STORAGE_OFFSET); + + if (context_len != m_context_init_len) + { + err_code = pstorage_update(&block_handle, + (uint8_t *)&m_context_init_len, + sizeof(uint32_t), + APP_CONTEXT_STORAGE_OFFSET); + + if (err_code != NRF_SUCCESS) + { + DM_ERR("[DM]: Failed to delete application context, reason 0x%08X\r\n", err_code); + } + else + { + m_app_context_table[p_handle->device_id] = NULL; + } + } + } + + DM_TRC("[DM]: << dm_application_context_delete\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; +#else //DEVICE_MANAGER_APP_CONTEXT_SIZE + return (FEATURE_NOT_ENABLED | DEVICE_MANAGER_ERR_BASE); +#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE +} + + +ret_code_t dm_application_instance_set(dm_application_instance_t const * p_appl_instance, + dm_handle_t * p_handle) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_appl_instance); + VERIFY_APP_REGISTERED((*p_appl_instance)); + + p_handle->appl_id = (*p_appl_instance); + + return NRF_SUCCESS; +} + + +uint32_t dm_handle_initialize(dm_handle_t * p_handle) +{ + NULL_PARAM_CHECK(p_handle); + + p_handle->appl_id = DM_INVALID_ID; + p_handle->connection_id = DM_INVALID_ID; + p_handle->device_id = DM_INVALID_ID; + p_handle->service_id = DM_INVALID_ID; + + return NRF_SUCCESS; +} + + +ret_code_t dm_peer_addr_set(dm_handle_t const * p_handle, + ble_gap_addr_t const * p_addr) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_addr); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_peer_addr_set\r\n"); + + ret_code_t err_code; + + if ((p_handle->connection_id == DM_INVALID_ID) && + (p_addr->addr_type != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE)) + { + m_peer_table[p_handle->device_id].peer_id.id_addr_info = (*p_addr); + update_status_bit_set(p_handle->device_id); + device_context_store(p_handle, UPDATE_PEER_ADDR); + err_code = NRF_SUCCESS; + } + else + { + err_code = (NRF_ERROR_INVALID_PARAM | DEVICE_MANAGER_ERR_BASE); + } + + DM_TRC("[DM]: << dm_peer_addr_set\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; +} + + +ret_code_t dm_peer_addr_get(dm_handle_t const * p_handle, + ble_gap_addr_t * p_addr) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_addr); + VERIFY_APP_REGISTERED(p_handle->appl_id); + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_peer_addr_get\r\n"); + + ret_code_t err_code; + + err_code = (NRF_ERROR_NOT_FOUND | DEVICE_MANAGER_ERR_BASE); + + if (p_handle->device_id == DM_INVALID_ID) + { + if ((p_handle->connection_id != DM_INVALID_ID) && + ((m_connection_table[p_handle->connection_id].state & STATE_CONNECTED) == + STATE_CONNECTED)) + { + DM_TRC("[DM]:[CI 0x%02X]: Address get for non bonded active connection.\r\n", + p_handle->connection_id); + + (*p_addr) = m_connection_table[p_handle->connection_id].peer_addr; + err_code = NRF_SUCCESS; + } + } + else + { + if ((m_peer_table[p_handle->device_id].id_bitmap & ADDR_ENTRY) == 0) + { + DM_TRC("[DM]:[DI 0x%02X]: Address get for bonded device.\r\n", + p_handle->device_id); + + (*p_addr) = m_peer_table[p_handle->device_id].peer_id.id_addr_info; + err_code = NRF_SUCCESS; + } + } + + DM_TRC("[DM]: << dm_peer_addr_get\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; +} + + +ret_code_t dm_distributed_keys_get(dm_handle_t const * p_handle, + dm_sec_keyset_t * p_key_dist) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_handle); + NULL_PARAM_CHECK(p_key_dist); + VERIFY_APP_REGISTERED(p_handle->appl_id); + VERIFY_DEVICE_INSTANCE(p_handle->device_id); + + DM_MUTEX_LOCK(); + + DM_TRC("[DM]: >> dm_distributed_keys_get\r\n"); + + ret_code_t err_code; + ble_gap_enc_key_t peer_enc_key; + pstorage_handle_t block_handle; + + err_code = NRF_ERROR_NOT_FOUND; + p_key_dist->keys_central.enc_key.p_enc_key = NULL; + p_key_dist->keys_central.p_id_key = (dm_id_key_t *)&m_peer_table[p_handle->device_id].peer_id; + p_key_dist->keys_central.p_sign_key = NULL; + p_key_dist->keys_periph.p_id_key = (dm_id_key_t *)&m_local_id_info; + p_key_dist->keys_periph.p_sign_key = NULL; + p_key_dist->keys_periph.enc_key.p_enc_key = (dm_enc_key_t *)&peer_enc_key; + + if ((m_peer_table[p_handle->device_id].id_bitmap & IRK_ENTRY) == 0) + { +// p_key_dist->keys_periph.p_id_key->id_addr_info.addr_type = INVALID_ADDR_TYPE; + } + + err_code = pstorage_block_identifier_get(&m_storage_handle, p_handle->device_id, &block_handle); + if (err_code == NRF_SUCCESS) + { + + err_code = pstorage_load((uint8_t *)&peer_enc_key, + &block_handle, + BOND_SIZE, + BOND_STORAGE_OFFSET); + + if (err_code == NRF_SUCCESS) + { + p_key_dist->keys_central.enc_key.p_enc_key = NULL; + p_key_dist->keys_central.p_id_key = (dm_id_key_t *)&m_peer_table[p_handle->device_id].peer_id; + p_key_dist->keys_central.p_sign_key = NULL; + p_key_dist->keys_periph.p_id_key = (dm_id_key_t *)&m_local_id_info; + p_key_dist->keys_periph.p_sign_key = NULL; + p_key_dist->keys_periph.enc_key.p_enc_key = (dm_enc_key_t *)&peer_enc_key; + } + } + + DM_TRC("[DM]: << dm_distributed_keys_get\r\n"); + + DM_MUTEX_UNLOCK(); + + return err_code; +} + + +/**@brief Function for loading bond information for a connection instance. + */ +void bond_data_load(dm_handle_t * p_handle) +{ + pstorage_handle_t block_handle; + + uint32_t err_code = pstorage_block_identifier_get(&m_storage_handle, + p_handle->device_id, + &block_handle); + if (err_code == NRF_SUCCESS) + { + DM_LOG( + "[DM]:[%02X]:[Block ID 0x%08X]:Loading bond information at %p, size 0x%08X, offset 0x%08X.\r\n", + p_handle->connection_id, + block_handle.block_id, + &m_bond_table[p_handle->connection_id], + BOND_SIZE, + BOND_STORAGE_OFFSET); + + err_code = pstorage_load((uint8_t *)&m_bond_table[p_handle->connection_id], + &block_handle, + BOND_SIZE, + BOND_STORAGE_OFFSET); + + if (err_code != NRF_SUCCESS) + { + DM_ERR("[DM]:[%02X]: Failed to load Bond information, reason %08X\r\n", + p_handle->connection_id, + err_code); + } + + DM_LOG( + "[DM]:[%02X]:Loading service context at %p, size 0x%08X, offset 0x%08X.\r\n", + p_handle->connection_id, + &m_gatts_table[p_handle->connection_id], + sizeof(dm_gatts_context_t), + SERVICE_STORAGE_OFFSET); + + err_code = m_service_context_load[m_application_table[0].service]( + &block_handle, + p_handle); + + if (err_code != NRF_SUCCESS) + { + DM_ERR( + "[DM]:[%02X]: Failed to load service information, reason %08X\r\n", + p_handle->connection_id, + err_code); + } + } + else + { + DM_ERR("[DM]:[%02X]: Failed to get block identifier for " + "device %08X, reason %08X.\r\n", p_handle->connection_id, p_handle->device_id, err_code); + } +} + + +void dm_ble_evt_handler(ble_evt_t * p_ble_evt) +{ + uint32_t err_code; + uint32_t index; + uint32_t device_index = DM_INVALID_ID; + bool notify_app = false; + dm_handle_t handle; + dm_event_t event; + uint32_t event_result; + ble_gap_enc_info_t * p_enc_info = NULL; + + VERIFY_MODULE_INITIALIZED_VOID(); + VERIFY_APP_REGISTERED_VOID(0); + DM_MUTEX_LOCK(); + + err_code = dm_handle_initialize(&handle); + APP_ERROR_CHECK(err_code); + + event_result = NRF_SUCCESS; + err_code = NRF_SUCCESS; + event.event_param.p_gap_param = &p_ble_evt->evt.gap_evt; + event.event_paramlen = sizeof(ble_gap_evt_t); + handle.device_id = DM_INVALID_ID; + handle.appl_id = 0; + index = 0x00; + + if (p_ble_evt->header.evt_id != BLE_GAP_EVT_CONNECTED) + { + err_code = connection_instance_find(p_ble_evt->evt.gap_evt.conn_handle, + STATE_CONNECTED, + &index); + + if (err_code == NRF_SUCCESS) + { + handle.device_id = m_connection_table[index].bonded_dev_id; + handle.connection_id = index; + } + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + //Allocate connection instance for a new connection. + err_code = connection_instance_allocate(&index); + + //Connection instance is successfully allocated. + if (err_code == NRF_SUCCESS) + { + //Application notification related information. + notify_app = true; + event.event_id = DM_EVT_CONNECTION; + handle.connection_id = index; + + m_connection_table[index].conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + m_connection_table[index].state = STATE_CONNECTED; + m_connection_table[index].peer_addr = + p_ble_evt->evt.gap_evt.params.connected.peer_addr; + + if (p_ble_evt->evt.gap_evt.params.connected.irk_match == 1) + { + if (m_irk_index_table[p_ble_evt->evt.gap_evt.params.connected.irk_match_idx] != DM_INVALID_ID) + { + device_index = m_irk_index_table[p_ble_evt->evt.gap_evt.params.connected.irk_match_idx]; + err_code = NRF_SUCCESS; + } + } + else + { + //Use the device address to check if the device exists in the bonded device list. + err_code = device_instance_find(&p_ble_evt->evt.gap_evt.params.connected.peer_addr, + &device_index, EDIV_INIT_VAL); + } + + if (err_code == NRF_SUCCESS) + { + m_connection_table[index].bonded_dev_id = device_index; + m_connection_table[index].state |= STATE_BONDED; + handle.device_id = device_index; + + bond_data_load(&handle); + } + } + break; + + case BLE_GAP_EVT_DISCONNECTED: + //Disconnection could be peer or self initiated hence disconnecting and connecting + //both states are permitted, however, connection handle must be known. + DM_LOG("[DM]: Disconnect Reason 0x%04X\r\n", + p_ble_evt->evt.gap_evt.params.disconnected.reason); + + m_connection_table[index].state &= (~STATE_CONNECTED); + + if ((m_connection_table[index].state & STATE_BONDED) == STATE_BONDED) + { + if ((m_connection_table[index].state & STATE_LINK_ENCRYPTED) == STATE_LINK_ENCRYPTED) + { + //Write bond information persistently. + device_context_store(&handle, STORE_ALL_CONTEXT); + } + } + else + { + //Free any allocated instances for devices that is not bonded. + if (handle.device_id != DM_INVALID_ID) + { + peer_instance_init(handle.device_id); + handle.device_id = DM_INVALID_ID; + } + } + + m_connection_table[index].state = STATE_DISCONNECTING; + notify_app = true; + event.event_id = DM_EVT_DISCONNECTION; + + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + DM_LOG("[DM]: >> BLE_GAP_EVT_SEC_INFO_REQUEST\r\n"); + + //If the device is already bonded, respond with existing info, else NULL. + if (m_connection_table[index].bonded_dev_id == DM_INVALID_ID) + { + //Find device based on div. + err_code = device_instance_find(NULL,&device_index, p_ble_evt->evt.gap_evt.params.sec_info_request.master_id.ediv); + if (err_code == NRF_SUCCESS) + { + //Load needed bonding information. + m_connection_table[index].bonded_dev_id = device_index; + m_connection_table[index].state |= STATE_BONDED; + handle.device_id = device_index; + bond_data_load(&handle); + } + } + + if (m_connection_table[index].bonded_dev_id != DM_INVALID_ID) + { + p_enc_info = &m_bond_table[index].peer_enc_key.enc_info; + DM_DUMP((uint8_t *)p_enc_info, sizeof(ble_gap_enc_info_t)); + } + + err_code = sd_ble_gap_sec_info_reply(p_ble_evt->evt.gap_evt.conn_handle, + p_enc_info, + &m_peer_table[index].peer_id.id_info, + NULL); + + if (err_code != NRF_SUCCESS) + { + DM_ERR("[DM]:[CI %02X]:[DI %02X]: Security information response failed, reason " + "0x%08X\r\n", index, m_connection_table[index].bonded_dev_id, err_code); + } + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + DM_LOG("[DM]: >> BLE_GAP_EVT_SEC_PARAMS_REQUEST\r\n"); + + event.event_id = DM_EVT_SECURITY_SETUP; + + m_connection_table[index].state |= STATE_PAIRING; + notify_app = true; + + if (m_connection_table[index].bonded_dev_id == DM_INVALID_ID) + { + //Assign a peer index as a new bond or update existing bonds. + err_code = device_instance_allocate((uint8_t *)&device_index, + &m_connection_table[index].peer_addr); + + //Allocation successful. + if (err_code == NRF_SUCCESS) + { + DM_LOG("[DM]:[CI 0x%02X]:[DI 0x%02X]: Bonded!\r\n",index, device_index); + + handle.device_id = device_index; + m_connection_table[index].bonded_dev_id = device_index; + } + else + { + DM_LOG("[DM]: Security parameter request failed, reason 0x%08X.\r\n", err_code); + event_result = err_code; + notify_app = true; + } + + ble_gap_sec_keyset_t keys_exchanged; + + DM_LOG("[DM]: 0x%02X, 0x%02X, 0x%02X, 0x%02X\r\n", + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_peer.enc, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_own.id, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_peer.sign, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.bond); + + keys_exchanged.keys_peer.p_enc_key = NULL; + keys_exchanged.keys_peer.p_id_key = &m_peer_table[m_connection_table[index].bonded_dev_id].peer_id; + keys_exchanged.keys_peer.p_sign_key = NULL; + keys_exchanged.keys_peer.p_pk = NULL; + keys_exchanged.keys_own.p_enc_key = &m_bond_table[index].peer_enc_key; + keys_exchanged.keys_own.p_id_key = NULL; + keys_exchanged.keys_own.p_sign_key = NULL; + keys_exchanged.keys_own.p_pk = NULL; + + err_code = sd_ble_gap_sec_params_reply(p_ble_evt->evt.gap_evt.conn_handle, + BLE_GAP_SEC_STATUS_SUCCESS, + &m_application_table[0].sec_param, + &keys_exchanged); + + if (err_code != NRF_SUCCESS) + { + DM_LOG("[DM]: Security parameter reply request failed, reason 0x%08X.\r\n", err_code); + event_result = err_code; + notify_app = false; + } + + } + else + { + //Bond/key refresh. + DM_LOG("[DM]: !!! Bond/key refresh !!!\r\n"); + //Set the update flag for bond data. + m_connection_table[index].state |= STATE_BOND_INFO_UPDATE; + event.event_id = DM_EVT_SECURITY_SETUP_REFRESH; + + err_code = sd_ble_gap_sec_params_reply(p_ble_evt->evt.gap_evt.conn_handle, + BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, + NULL, + NULL); + + if (err_code != NRF_SUCCESS) + { + DM_LOG("[DM]: Security parameter reply request failed, reason 0x%08X.\r\n", err_code); + event_result = err_code; + notify_app = false; + } + + } + break; + + case BLE_GAP_EVT_AUTH_STATUS: + { + DM_LOG("[DM]: >> BLE_GAP_EVT_AUTH_STATUS, status %08X\r\n", + p_ble_evt->evt.gap_evt.params.auth_status.auth_status); + + m_application_table[0].state &= (~STATE_CONTROL_PROCEDURE_IN_PROGRESS); + m_connection_table[index].state &= (~STATE_PAIRING); + event.event_id = DM_EVT_SECURITY_SETUP_COMPLETE; + notify_app = true; + + if (p_ble_evt->evt.gap_evt.params.auth_status.auth_status != BLE_GAP_SEC_STATUS_SUCCESS) + { + // In case of key refresh attempt, since this behavior is now rejected, we don't do anything here + if ((m_connection_table[index].state & STATE_BOND_INFO_UPDATE) + != STATE_BOND_INFO_UPDATE) + { + // Free the allocation as bonding failed. + ret_code_t result = device_instance_free(m_connection_table[index].bonded_dev_id); + (void) result; + event_result = p_ble_evt->evt.gap_evt.params.auth_status.auth_status; + } + } + else + { + DM_DUMP((uint8_t *)&p_ble_evt->evt.gap_evt.params.auth_status, + sizeof(ble_gap_evt_auth_status_t)); + DM_DUMP((uint8_t *)&m_bond_table[index], sizeof(bond_context_t)); + + if (p_ble_evt->evt.gap_evt.params.auth_status.bonded == 1) + { + if (handle.device_id != DM_INVALID_ID) + { + m_connection_table[index].state |= STATE_BONDED; + + //IRK and/or public address is shared, update it. + if (p_ble_evt->evt.gap_evt.params.auth_status.kdist_peer.id == 1) + { + m_peer_table[handle.device_id].id_bitmap &= (~IRK_ENTRY); + } + + if (m_connection_table[index].bonded_dev_id != DM_INVALID_ID) + { + DM_LOG("[DM]:[CI 0x%02X]:[DI 0x%02X]: Bonded!\r\n", + index, + handle.device_id); + + if (m_connection_table[index].peer_addr.addr_type != + BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE) + { + m_peer_table[handle.device_id].peer_id.id_addr_info = + m_connection_table[index].peer_addr; + m_peer_table[handle.device_id].id_bitmap &= (~ADDR_ENTRY); + + DM_DUMP((uint8_t *)&m_peer_table[handle.device_id].peer_id.id_addr_info, + sizeof(m_peer_table[handle.device_id].peer_id.id_addr_info)); + } + else + { + // Here we must fetch the keys from the keyset distributed. + m_peer_table[handle.device_id].ediv = m_bond_table[index].peer_enc_key.master_id.ediv; + m_peer_table[handle.device_id].id_bitmap &= (~IRK_ENTRY); + } + + device_context_store(&handle, FIRST_BOND_STORE); + } + } + } + else + { + //Pairing request, no need to touch the bonding info. + } + } + break; + } + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + DM_LOG("[DM]: >> BLE_GAP_EVT_CONN_SEC_UPDATE, Mode 0x%02X, Level 0x%02X\r\n", + p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm, + p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv); + + if ((p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv == 1) && + (p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm == 1) && + ((m_connection_table[index].state & STATE_BONDED) == STATE_BONDED)) + { + //Lost bond case, generate a security refresh event! + memset(m_gatts_table[index].attributes, 0, DM_GATT_SERVER_ATTR_MAX_SIZE); + + event.event_id = DM_EVT_SECURITY_SETUP_REFRESH; + m_connection_table[index].state |= STATE_PAIRING_PENDING; + m_connection_table[index].state |= STATE_BOND_INFO_UPDATE; + m_application_table[0].state |= STATE_QUEUED_CONTROL_REQUEST; + } + else + { + m_connection_table[index].state |= STATE_LINK_ENCRYPTED; + event.event_id = DM_EVT_LINK_SECURED; + + //Apply service context. + err_code = m_service_context_apply[m_application_table[0].service](&handle); + + if (err_code != NRF_SUCCESS) + { + DM_ERR("[DM]:[CI 0x%02X]:[DI 0x%02X]: Failed to apply service context\r\n", + handle.connection_id, + handle.device_id); + + event_result = DM_SERVICE_CONTEXT_NOT_APPLIED; + } + } + event_result = NRF_SUCCESS; + notify_app = true; + + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + DM_LOG("[DM]: >> BLE_GATTS_EVT_SYS_ATTR_MISSING\r\n"); + + //Apply service context. + event_result = m_service_context_apply[m_application_table[0].service](&handle); + break; + + case BLE_GAP_EVT_SEC_REQUEST: + DM_LOG("[DM]: >> BLE_GAP_EVT_SEC_REQUEST\r\n"); + + //Verify if the device is already bonded, and if it is bonded, initiate encryption. + //If the device is not bonded, an instance needs to be allocated in order to initiate + //bonding. The application have to initiate the procedure, the module will not do this + //automatically. + event.event_id = DM_EVT_SECURITY_SETUP; + notify_app = true; + + break; + + default: + break; + } + + if (notify_app) + { + app_evt_notify(&handle, &event, event_result); + + //Freeing the instance after the event is notified so the application can get the context. + if (event.event_id == DM_EVT_DISCONNECTION) + { + //Free the instance. + connection_instance_free(&index); + } + } + + UNUSED_VARIABLE(err_code); + + DM_MUTEX_UNLOCK(); +} + + +ret_code_t dm_handle_get(uint16_t conn_handle, dm_handle_t * p_handle) +{ + ret_code_t err_code; + uint32_t index; + + NULL_PARAM_CHECK(p_handle); + VERIFY_APP_REGISTERED(p_handle->appl_id); + + p_handle->device_id = DM_INVALID_ID; + + err_code = NRF_ERROR_NOT_FOUND; + + for (index = 0; index < DEVICE_MANAGER_MAX_CONNECTIONS; index++) + { + //Search for matching connection handle. + if (conn_handle == m_connection_table[index].conn_handle) + { + p_handle->connection_id = index; + p_handle->device_id = m_connection_table[index].bonded_dev_id; + + err_code = NRF_SUCCESS; + break; + } + } + return err_code; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.c new file mode 100644 index 0000000000..ef09362c4c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.c @@ -0,0 +1,595 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "gatt_cache_manager.h" + +#include "nrf_ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_manager_internal.h" +#include "peer_database.h" +#include "id_manager.h" +#include "security_dispatcher.h" +#include "gatts_cache_manager.h" +#include "gattc_cache_manager.h" +#include "sdk_common.h" + +/**@brief Structure containing the module variable(s) of the GCM module. + */ +typedef struct +{ + gcm_evt_handler_t evt_handler; /**< The event handler to use for outbound GSCM events. */ + ble_conn_state_user_flag_id_t flag_id_local_db_update_pending; /**< Flag ID for flag collection to keep track of which connections need a local DB update procedure. */ + ble_conn_state_user_flag_id_t flag_id_local_db_apply_pending; /**< Flag ID for flag collection to keep track of which connections need a local DB apply procedure. */ + ble_conn_state_user_flag_id_t flag_id_service_changed_pending; /**< Flag ID for flag collection to keep track of which connections need to be sent a service changed indication. */ + ble_conn_state_user_flag_id_t flag_id_service_changed_sent; /**< Flag ID for flag collection to keep track of which connections have been sent a service changed indication and are waiting for a handle value confirmation. */ +} gcm_t; + +static gcm_t m_gcm; /**< Instantiation of module variable(s). */ + +#define MODULE_INITIALIZED (m_gcm.evt_handler != NULL) +#include "sdk_macros.h" + + +static void service_changed_pending_flags_check(void); + +/**@brief Function for resetting the module variable(s) of the GSCM module. + * + * @param[out] The instance to reset. + */ +static void internal_state_reset(gcm_t * p_gcm) +{ + memset(p_gcm, 0, sizeof(gcm_t)); +} + + +/**@brief Function for checking a write event for whether a CCCD was written during the write + * operation. + * + * @param[in] p_write_evt The parameters of the write event. + * + * @return Whether the write was on a CCCD. + */ +static bool cccd_written(ble_gatts_evt_write_t * p_write_evt) +{ + return ( (p_write_evt->op == BLE_GATTS_OP_WRITE_REQ) + && (p_write_evt->uuid.type == BLE_UUID_TYPE_BLE) + && (p_write_evt->uuid.uuid == BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG) + ); +} + + +/**@brief Function for performing the local DB update procedure in an event context, where no return + * code can be given. + * + * @details This function will do the procedure, and check the result, set a flag if needed, and + * send an event if needed. + * + * @param[in] conn_handle The connection to perform the procedure on. + */ +static void local_db_apply_in_evt(uint16_t conn_handle) +{ + bool set_procedure_as_pending = false; + ret_code_t err_code; + gcm_evt_t event; + + if (conn_handle == BLE_CONN_HANDLE_INVALID) + { + return; + } + + err_code = gscm_local_db_cache_apply(conn_handle); + + switch(err_code) + { + case NRF_SUCCESS: + event.evt_id = GCM_EVT_LOCAL_DB_CACHE_APPLIED; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + event.params.local_db_cache_applied.conn_handle = conn_handle; + + m_gcm.evt_handler(&event); + break; + + case NRF_ERROR_BUSY: + set_procedure_as_pending = true; + break; + + case NRF_ERROR_INVALID_DATA: + event.evt_id = GCM_EVT_ERROR_LOCAL_DB_CACHE_APPLY; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + event.params.error_local_db_cache_apply.conn_handle = conn_handle; + + m_gcm.evt_handler(&event); + break; + + case BLE_ERROR_INVALID_CONN_HANDLE: + /* Do nothing */ + break; + + default: + event.evt_id = GCM_EVT_ERROR_UNEXPECTED; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + event.params.error_unexpected.conn_handle = conn_handle; + event.params.error_unexpected.error = err_code; + + m_gcm.evt_handler(&event); + break; + } + + ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_local_db_apply_pending, set_procedure_as_pending); +} + + +/**@brief Function for performing the local DB apply procedure in an event context, where no return + * code can be given. + * + * @details This function will do the procedure, and check the result, set a flag if needed, and + * send an event if needed. + * + * @param[in] conn_handle The connection to perform the procedure on. + */ +static void local_db_update_in_evt(uint16_t conn_handle) +{ + gcm_evt_t event; + bool set_procedure_as_pending = false; + ret_code_t err_code = gscm_local_db_cache_update(conn_handle); + + switch(err_code) + { + case NRF_SUCCESS: + event.evt_id = GCM_EVT_LOCAL_DB_CACHE_UPDATED; + event.params.local_db_cache_applied.conn_handle = conn_handle; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + + m_gcm.evt_handler(&event); + break; + + case BLE_ERROR_INVALID_CONN_HANDLE: + /* Do nothing */ + break; + + case NRF_ERROR_BUSY: + set_procedure_as_pending = true; + break; + + case NRF_ERROR_DATA_SIZE: + event.evt_id = GCM_EVT_ERROR_DATA_SIZE; + event.params.error_data_size.conn_handle = conn_handle; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + + m_gcm.evt_handler(&event); + break; + + case NRF_ERROR_NO_MEM: + event.evt_id = GCM_EVT_ERROR_STORAGE_FULL; + event.params.error_no_mem.conn_handle = conn_handle; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + + m_gcm.evt_handler(&event); + break; + + default: + event.evt_id = GCM_EVT_ERROR_UNEXPECTED; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + event.params.error_unexpected.conn_handle = conn_handle; + event.params.error_unexpected.error = err_code; + + m_gcm.evt_handler(&event); + break; + } + + ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_local_db_update_pending, set_procedure_as_pending); +} + + +/**@brief Function for sending a service changed indication in an event context, where no return + * code can be given. + * + * @details This function will do the procedure, and check the result, set a flag if needed, and + * send an event if needed. + * + * @param[in] conn_handle The connection to perform the procedure on. + */ +static void service_changed_send_in_evt(uint16_t conn_handle) +{ + gcm_evt_t event; + bool sc_pending_state = true; + bool sc_sent_state = false; + ret_code_t err_code = gscm_service_changed_ind_send(conn_handle); + + switch(err_code) + { + case NRF_SUCCESS: + sc_sent_state = true; + + event.evt_id = GCM_EVT_SERVICE_CHANGED_IND_SENT; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + event.params.service_changed_ind_sent.conn_handle = conn_handle; + + m_gcm.evt_handler(&event); + break; + + case NRF_ERROR_BUSY: + // Do nothing. + break; + + case NRF_ERROR_INVALID_STATE: + // CCCDs not enabled. Drop indication. + // Fallthrough. + + case NRF_ERROR_NOT_SUPPORTED: + // Service changed not supported. Drop indication. + sc_pending_state = false; + gscm_db_change_notification_done(im_peer_id_get_by_conn_handle(conn_handle)); + break; + + case BLE_ERROR_GATTS_SYS_ATTR_MISSING: + local_db_apply_in_evt(conn_handle); + break; + + case BLE_ERROR_INVALID_CONN_HANDLE: + // Do nothing. + break; + + default: + event.evt_id = GCM_EVT_ERROR_UNEXPECTED; + event.params.error_unexpected.conn_handle = conn_handle; + event.params.error_unexpected.error = err_code; + event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); + + m_gcm.evt_handler(&event); + break; + } + + ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_service_changed_pending, sc_pending_state); + ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_service_changed_sent, sc_sent_state); +} + + +/**@brief Callback function for events from the GATT Cache Server Manager module. + * + * @param[in] p_event The event from the GATT Cache Server Manager module. + */ +static void gscm_evt_handler(gscm_evt_t const * p_event) +{ + gcm_evt_t event; + event.peer_id = p_event->peer_id; + + switch (p_event->evt_id) + { + case GSCM_EVT_LOCAL_DB_CACHE_STORED: + event.evt_id = GCM_EVT_LOCAL_DB_CACHE_STORED; + + m_gcm.evt_handler(&event); + local_db_apply_in_evt(im_conn_handle_get(p_event->peer_id)); + break; + + case GSCM_EVT_LOCAL_DB_CACHE_UPDATED: + event.evt_id = GCM_EVT_LOCAL_DB_CACHE_UPDATED; + event.params.local_db_cache_updated.conn_handle = p_event->params.local_db_cache_updated.conn_handle; + + m_gcm.evt_handler(&event); + break; + + case GSCM_EVT_SC_STATE_STORED: + if (p_event->params.sc_state_stored.state) + { + uint16_t conn_handle = im_conn_handle_get(p_event->peer_id); + if (conn_handle != BLE_CONN_HANDLE_INVALID) + { + ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_service_changed_pending, true); + service_changed_pending_flags_check(); + } + } + break; + } +} + + +/**@brief Callback function for events from the GATT Cache Client Manager module. + * + * @param[in] p_event The event from the GATT Cache Client Manager module. + */ +static void gccm_evt_handler(gccm_evt_t const * p_event) +{ + +} + + +/**@brief Callback function for events from the Identity Manager module. + * + * @param[in] p_event The event from the Identity Manager module. + */ +static void im_evt_handler(im_evt_t const * p_event) +{ + switch (p_event->evt_id) + { + case IM_EVT_BONDED_PEER_CONNECTED: + local_db_apply_in_evt(p_event->conn_handle); + if (gscm_service_changed_ind_needed(p_event->conn_handle)) + { + ble_conn_state_user_flag_set(p_event->conn_handle, m_gcm.flag_id_service_changed_pending, true); + } + break; + default: + break; + } +} + + +/**@brief Callback function for events from the Security Dispatcher module. + * + * @param[in] p_event The event from the Security Dispatcher module. + */ +static void smd_evt_handler(smd_evt_t const * p_event) +{ + switch (p_event->evt_id) + { + case SMD_EVT_BONDING_INFO_STORED: + local_db_update_in_evt(p_event->conn_handle); + break; + default: + break; + } +} + + +ret_code_t gcm_init(gcm_evt_handler_t evt_handler) +{ + VERIFY_PARAM_NOT_NULL(evt_handler); + + ret_code_t err_code; + + err_code = gscm_init(gscm_evt_handler); + VERIFY_SUCCESS(err_code); + + err_code = gccm_init(gccm_evt_handler); + VERIFY_SUCCESS(err_code); + + internal_state_reset(&m_gcm); + m_gcm.evt_handler = evt_handler; + + err_code = im_register(im_evt_handler); + VERIFY_SUCCESS(err_code); + + err_code = smd_register(smd_evt_handler); + VERIFY_SUCCESS(err_code); + + + m_gcm.flag_id_local_db_update_pending = ble_conn_state_user_flag_acquire(); + m_gcm.flag_id_local_db_apply_pending = ble_conn_state_user_flag_acquire(); + m_gcm.flag_id_service_changed_pending = ble_conn_state_user_flag_acquire(); + m_gcm.flag_id_service_changed_sent = ble_conn_state_user_flag_acquire(); + + if ((m_gcm.flag_id_local_db_update_pending == BLE_CONN_STATE_USER_FLAG_INVALID) + || (m_gcm.flag_id_local_db_apply_pending == BLE_CONN_STATE_USER_FLAG_INVALID) + || (m_gcm.flag_id_service_changed_pending == BLE_CONN_STATE_USER_FLAG_INVALID) + || (m_gcm.flag_id_service_changed_sent == BLE_CONN_STATE_USER_FLAG_INVALID)) + { + err_code = NRF_ERROR_INTERNAL; + } + + return err_code; +} + + +/**@brief Function for performing the Local DB apply procedure if it is pending on any connections. + */ +static void apply_pending_flags_check(void) +{ + sdk_mapped_flags_t apply_pending_flags; + + apply_pending_flags = ble_conn_state_user_flag_collection(m_gcm.flag_id_local_db_apply_pending); + if (sdk_mapped_flags_any_set(apply_pending_flags)) + { + sdk_mapped_flags_key_list_t conn_handle_list; + conn_handle_list = ble_conn_state_conn_handles(); + + for (uint32_t i = 0; i < conn_handle_list.len; i++) + { + if (ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_gcm.flag_id_local_db_apply_pending)) + { + local_db_apply_in_evt(conn_handle_list.flag_keys[i]); + } + } + } +} + + +/**@brief Function for performing the Local DB update procedure if it is pending on any connections. + */ +static void update_pending_flags_check(void) +{ + sdk_mapped_flags_t update_pending_flags; + + update_pending_flags = ble_conn_state_user_flag_collection(m_gcm.flag_id_local_db_update_pending); + if (sdk_mapped_flags_any_set(update_pending_flags)) + { + sdk_mapped_flags_key_list_t conn_handle_list; + conn_handle_list = ble_conn_state_conn_handles(); + + for (uint32_t i = 0; i < conn_handle_list.len; i++) + { + if (ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_gcm.flag_id_local_db_update_pending)) + { + local_db_update_in_evt(conn_handle_list.flag_keys[i]); + } + } + } +} + + +/**@brief Function for sending service changed indications if it is pending on any connections. + */ +static void service_changed_pending_flags_check(void) +{ + sdk_mapped_flags_t service_changed_pending_flags; + + service_changed_pending_flags = ble_conn_state_user_flag_collection(m_gcm.flag_id_service_changed_pending); + if (sdk_mapped_flags_any_set(service_changed_pending_flags)) + { + sdk_mapped_flags_key_list_t conn_handle_list; + conn_handle_list = ble_conn_state_conn_handles(); + + for (uint32_t i = 0; i < conn_handle_list.len; i++) + { + if ( ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], + m_gcm.flag_id_service_changed_pending) + && !ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], + m_gcm.flag_id_service_changed_sent)) + { + service_changed_send_in_evt(conn_handle_list.flag_keys[i]); + } + } + } +} + + +/**@brief Callback function for BLE events from the SoftDevice. + * + * @param[in] p_ble_evt The BLE event from the SoftDevice. + */ +void gcm_ble_evt_handler(ble_evt_t * p_ble_evt) +{ + gcm_evt_t event; + + switch(p_ble_evt->header.evt_id) + { + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + local_db_apply_in_evt(p_ble_evt->evt.gatts_evt.conn_handle); + break; + + case BLE_GATTS_EVT_SC_CONFIRM: + event.evt_id = GCM_EVT_SERVICE_CHANGED_IND_CONFIRMED; + event.peer_id = im_peer_id_get_by_conn_handle(p_ble_evt->evt.gatts_evt.conn_handle); + event.params.service_changed_ind_sent.conn_handle = p_ble_evt->evt.gatts_evt.conn_handle; + + gscm_db_change_notification_done(event.peer_id); + ble_conn_state_user_flag_set(p_ble_evt->evt.gatts_evt.conn_handle, m_gcm.flag_id_service_changed_pending, false); + + m_gcm.evt_handler(&event); + break; + + case BLE_GATTS_EVT_WRITE: + if (cccd_written(&p_ble_evt->evt.gatts_evt.params.write)) + { + local_db_update_in_evt(p_ble_evt->evt.gatts_evt.conn_handle); + } + break; + } + + apply_pending_flags_check(); + update_pending_flags_check(); + service_changed_pending_flags_check(); +} + + +ret_code_t gcm_remote_db_store(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_remote_db, + uint32_t n_services) +{ + VERIFY_MODULE_INITIALIZED(); + + return gccm_remote_db_store(peer_id, p_remote_db, n_services); +} + + +ret_code_t gcm_remote_db_retrieve(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_remote_db, + uint32_t * p_n_services) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_remote_db); + + return gccm_remote_db_retrieve(peer_id, p_remote_db, p_n_services); +} + + +ret_code_t gcm_local_db_cache_update(uint16_t conn_handle) +{ + VERIFY_MODULE_INITIALIZED(); + + ret_code_t err_code = gscm_local_db_cache_update(conn_handle); + bool set_procedure_as_pending = false; + + if (err_code == NRF_ERROR_BUSY) + { + set_procedure_as_pending = true; + err_code = NRF_SUCCESS; + } + + ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_local_db_update_pending, set_procedure_as_pending); + + return err_code; +} + + +ret_code_t gcm_local_db_cache_set(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db) +{ + VERIFY_MODULE_INITIALIZED(); + + return gscm_local_db_cache_set(peer_id, p_local_db); +} + + +ret_code_t gcm_local_db_cache_get(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db) +{ + VERIFY_MODULE_INITIALIZED(); + + return gscm_local_db_cache_get(peer_id, p_local_db); +} + + +void gcm_local_database_has_changed(void) +{ + gscm_local_database_has_changed(); + + sdk_mapped_flags_key_list_t conn_handles = ble_conn_state_conn_handles(); + + for (uint16_t i = 0; i < conn_handles.len; i++) + { + if (im_peer_id_get_by_conn_handle(conn_handles.flag_keys[i]) == PM_PEER_ID_INVALID) + { + ble_conn_state_user_flag_set(conn_handles.flag_keys[i], m_gcm.flag_id_service_changed_pending, true); + } + } + + service_changed_pending_flags_check(); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h new file mode 100644 index 0000000000..c4b763c358 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef GATT_CACHE_MANAGER_H__ +#define GATT_CACHE_MANAGER_H__ + +#include +#include "sdk_errors.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" + + + +/** + * @cond NO_DOXYGEN + * @defgroup gatt_cache_manager GATT Cache Manager + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. A module for managing persistent storing of GATT + * attributes. + */ + + +/**@brief Events that can come from the GATT Cache Manager module. + */ +typedef enum +{ + GCM_EVT_LOCAL_DB_CACHE_STORED, /**< The persistent cache for the local database has been updated with provided values, for one peer. */ + GCM_EVT_LOCAL_DB_CACHE_UPDATED, /**< The persistent cache for the local database has been updated with values from the SoftDevice, for one peer. */ + GCM_EVT_LOCAL_DB_CACHE_APPLIED, /**< The SoftDevice has been given local database values from the persistent cache, for one peer. */ + GCM_EVT_ERROR_LOCAL_DB_CACHE_APPLY, /**< The stored local database values for a peer were rejected by the SoftDevice, which means the database has changed. */ + GCM_EVT_REMOTE_DB_CACHE_UPDATED, /**< The persistent cache for the remote database has been updated with provided values, for one peer. */ + GCM_EVT_SERVICE_CHANGED_IND_SENT, /**< A service changed indication has been sent to a peer. */ + GCM_EVT_SERVICE_CHANGED_IND_CONFIRMED, /**< A sent service changed indication has been confirmed by a peer. */ + GCM_EVT_ERROR_DATA_SIZE, /**< An operation failed because the write buffer of the Peer Database module was not large enough. This is a fatal error. */ + GCM_EVT_ERROR_STORAGE_FULL, /**< An operation failed because there was no available storage room in persistent storage. Please free up room, and the operation will automatically continue. */ + GCM_EVT_ERROR_UNEXPECTED, /**< An operation failed with an unexpected error. The error is provided. This is possibly a fatal error. */ +} gcm_evt_id_t; + + +/**@brief A structure meant to be used for event parameters for multiple event types. + */ +typedef struct +{ + uint16_t conn_handle; /**< The connection handle. Likely the connection handle an event pertains to. */ +} gcm_evt_param_conn_handle_t; + + +/**@brief Structure containing an event from the GCM module. + */ +typedef struct +{ + gcm_evt_id_t evt_id; /**< The type of event this is. */ + pm_peer_id_t peer_id; /**< The peer ID this event pertains to. */ + union + { + gcm_evt_param_conn_handle_t local_db_cache_updated; + gcm_evt_param_conn_handle_t local_db_cache_applied; + gcm_evt_param_conn_handle_t error_local_db_cache_apply; + gcm_evt_param_conn_handle_t service_changed_ind_sent; + gcm_evt_param_conn_handle_t service_changed_ind_confirmed; + gcm_evt_param_conn_handle_t error_data_size; + gcm_evt_param_conn_handle_t error_no_mem; + struct + { + uint16_t conn_handle; /**< The handle of the connection the event pertains to. */ + ret_code_t error; /**< The unexpected error that occurred. */ + } error_unexpected; + } params; /**< Event specific parameters. Chosen based on evt_id. */ +} gcm_evt_t; + +/**@brief Event handler for events from the GATT Cache Manager module. + * + * @param[in] event The event that has happened. + * @param[in] peer The id of the peer the event pertains to. + * @param[in] flags The data the event pertains to. + */ +typedef void (*gcm_evt_handler_t)(gcm_evt_t const * p_event); + + +/**@brief Function for initializing the GATT Cache Manager module. + * + * @param[in] evt_handler Callback for events from the GATT Cache Manager module. + * + * @retval NRF_SUCCESS Initialization was successful. + * @retval NRF_ERROR_NULL evt_handler was NULL. + */ +ret_code_t gcm_init(gcm_evt_handler_t evt_handler); + + +/**@brief Function for dispatching SoftDevice events to the GATT Cache Manager module. + * + * @param[in] p_ble_evt The SoftDevice event. + */ +void gcm_ble_evt_handler(ble_evt_t * p_ble_evt); + + + +/**@brief Function for storing a discovered remote database persistently. + * + * @param[in] peer_id Peer to store the database for. + * @param[in] p_remote_db Database values to store as an array. Can be NULL if n_services is 0. + * @param[in] n_services Number of services in p_remote_db array. If 0, values are cleared. + * + * @retval NRF_SUCCESS Store procedure successfully started. + * @retval NRF_ERROR_NOT_FOUND The peer id is invalid or unallocated. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gcm_remote_db_store(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_remote_db, + uint32_t n_services); + + +/**@brief Function for retrieving a persistently stored remote database. + * + * @param[in] peer_id Peer to retrieve data for. + * @param[out] p_remote_db If p_n_services was large enough: Copied database values. + * @param[inout] p_n_services In: Size of provided p_remote_db array. Out: Size of data in flash. + * + * @note p_n_services is always updated with the size of the data to be retrieved. The data is only + * copied if p_remote_db is large enough (p_n_services is large enough initially). + * + * @retval NRF_SUCCESS Data retrieved successfully. + * @retval NRF_ERROR_NOT_FOUND The peer ID is invalid or unallocated. + * @retval NRF_ERROR_NULL p_remote_db is NULL. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gcm_remote_db_retrieve(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_remote_db, + uint32_t * p_n_services); + + +/**@brief Function for triggering local GATT database data to be stored persistently. Values are + * retrieved from SoftDevice and written to persistent storage. + * + * @note This function is only needed when you want to override the regular functionality of the + * module, e.g. to immediately store to flash instead of waiting for the native logic to + * perform the update. + * + * @param[in] conn_handle Connection handle to perform update on. + * + * @retval NRF_SUCCESS Store operation started. + * @retval BLE_ERROR_INVALID_CONN_HANDLE conn_handle does not refer to an active, bonded connection. + * @retval NRF_ERROR_DATA_SIZE Write buffer not large enough. Call will never work with + * this GATT database. + * @retval NRF_ERROR_NO_MEM No room in persistent_storage. Free up space; the + * operation will be automatically reattempted after the + * next compression procedure + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gcm_local_db_cache_update(uint16_t conn_handle); + + +/**@brief Function for setting new values in the local database cache. + * + * @note If the peer is connected, the values will also be applied immediately to the connection. + * @note This function is only needed when you want to override the regular functionality of the + * module. + * @note The data in the pointer must be available until the GCM_EVT_LOCAL_DB_CACHE_SET event is + * received. + * + * @param[in] peer_id Peer to set values for. + * @param[in] p_local_db Database values to apply. If NULL, the values will instead be cleared. + * + * @retval NRF_SUCCESS Operation started, and values were applied (if connected). + * @retval NRF_ERROR_NOT_FOUND The peer ID was invalid or unallocated. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gcm_local_db_cache_set(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db); + + +/**@brief Function for retrieving values in the local database cache. + * + * @note This function is not needed for regular operation of the module. + * + * @param[in] peer_id Peer to get values for. + * @param[out] p_local_db Database values. + * + * @retval NRF_SUCCESS Values retrieved successfully. + * @retval NRF_ERROR_NOT_FOUND The peer ID was invalid or unallocated. + * @retval NRF_ERROR_NULL p_local_db was NULL. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gcm_local_db_cache_get(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db); + + +/**@brief Function for manually informing that the local database has changed. + * + * @details This causes a service changed notification to be sent to all bonded peers that + * subscribe to it. + */ +void gcm_local_database_has_changed(void); + +/** @} + * @endcond + */ + +#endif /* GATT_CACHE_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.c new file mode 100644 index 0000000000..e6b5469b41 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.c @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "gattc_cache_manager.h" + +#include "nrf_ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_database.h" +#include "id_manager.h" +#include "sdk_common.h" + +#define MAX_SIMUL_SEC_PROCEDURES 2 + +typedef struct +{ + gccm_evt_handler_t evt_handler; +} gccm_t; + +static gccm_t m_gccm; + +#define MODULE_INITIALIZED (m_gccm.evt_handler != NULL) +#include "sdk_macros.h" + +static void internal_state_reset(gccm_t * gccm) +{ + memset(gccm, 0, sizeof(gccm_t)); +} + + +/**@brief Event handler for events from the peer_database module. + * + * @param[in] p_event The event that has happend with peer id and flags. + */ +static void pdb_evt_handler(pdb_evt_t const * p_event) +{ + gccm_evt_t gccm_evt; + gccm_evt.evt_id = GCCM_EVT_REMOTE_DB_STORED; + gccm_evt.peer_id = p_event->peer_id; + m_gccm.evt_handler(&gccm_evt); +} + + +ret_code_t gccm_init(gccm_evt_handler_t evt_handler) +{ + ret_code_t err_code; + if (evt_handler == NULL) + { + err_code = NRF_ERROR_NULL; + } + else + { + err_code = pdb_register(pdb_evt_handler); + if (err_code == NRF_SUCCESS) + { + internal_state_reset(&m_gccm); + m_gccm.evt_handler = evt_handler; + } + } + return err_code; +} + + +ret_code_t gccm_remote_db_store(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_remote_db, + uint32_t n_services) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_remote_db); + + // Initialize the peer_data + pm_peer_data_const_t peer_data; + memset(&peer_data, 0, sizeof(peer_data)); + peer_data.data_id = PM_PEER_DATA_ID_GATT_REMOTE; + peer_data.p_remote_gatt_db = p_remote_db; + peer_data.length_words = PM_REMOTE_DB_N_WORDS(n_services); + + return pdb_raw_store(peer_id, &peer_data, NULL); +} + + +ret_code_t gccm_remote_db_retrieve(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_remote_db, + uint32_t * p_n_services) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_remote_db); + VERIFY_PARAM_NOT_NULL(p_n_services); + + // Initialize the peer_data + pm_peer_data_t peer_data; + memset(&peer_data, 0, sizeof(peer_data)); + peer_data.data_id = PM_PEER_DATA_ID_GATT_REMOTE; + peer_data.p_remote_gatt_db = p_remote_db; + peer_data.length_words = PM_REMOTE_DB_N_WORDS(*p_n_services); + + ret_code_t err_code = pdb_raw_read(peer_id, PM_PEER_DATA_ID_GATT_REMOTE, &peer_data); + + *p_n_services = PM_REMOTE_DB_N_SERVICES(peer_data.length_words); + + return err_code; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.h new file mode 100644 index 0000000000..abfca986a4 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef GATTC_CACHE_MANAGER_H__ +#define GATTC_CACHE_MANAGER_H__ + +#include +#include "sdk_errors.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @cond NO_DOXYGEN + * @defgroup gattc_cache_manager GATT Client Cache Manager + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. A module for managing persistent storing of GATT + * attributes pertaining to the GATT client role of the local device. + */ + + +/**@brief Events that can come from the GATT Cache Manager module. + */ +typedef enum +{ + GCCM_EVT_REMOTE_DB_UPDATED, /**< Values for the specified data has been updated in persistent storage. */ + GCCM_EVT_REMOTE_DB_STORED, /**< New values for the specified data has been written in persistent storage. */ +} gccm_evt_id_t; + + +typedef struct +{ + gccm_evt_id_t evt_id; + pm_peer_id_t peer_id; +} gccm_evt_t; + +/**@brief Event handler for events from the GATT Client Cache Manager module. + * + * @param[in] event The event that has happened. + * @param[in] peer The id of the peer the event pertains to. + * @param[in] flags The data the event pertains to. + */ +typedef void (*gccm_evt_handler_t)(gccm_evt_t const * p_event); + + +/**@brief Function for initializing the GATT Client Cache Manager module. + * + * @param[in] evt_handler Callback for events from the GATT Client Cache Manager module. + * + * @retval NRF_SUCCESS Initialization was successful. + * @retval NRF_ERROR_NULL evt_handler was NULL. + */ +ret_code_t gccm_init(gccm_evt_handler_t evt_handler); + + +/**@brief Function for storing a discovered remote database persistently. + * + * @param[in] peer_id Peer to store the database for. + * @param[in] p_remote_db Database values to store as an array. Can be NULL if n_services is 0. + * @param[in] n_services Number of services in p_remote_db array. If 0, values are cleared. + * + * @retval NRF_SUCCESS Store procedure successfully started. + * @retval NRF_ERROR_NOT_FOUND The peer id is invalid or unallocated. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gccm_remote_db_store(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_remote_db, + uint32_t n_services); + + +/**@brief Function for retrieving a persistently stored remote database. + * + * @param[in] peer_id Peer to retrieve data for. + * @param[out] p_remote_db If p_n_services was large enough: Copied database values. + * @param[inout] p_n_services In: Size of provided p_remote_db array. Out: Size of data in flash. + * + * @note p_n_services is always updated with the size of the data to be retrieved. The data is only + * copied if p_remote_db is large enough (p_n_services is large enough initially). + * + * @retval NRF_SUCCESS Data retrieved successfully. + * @retval NRF_ERROR_NOT_FOUND The peer ID is invalid or unallocated. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gccm_remote_db_retrieve(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_remote_db, + uint32_t * p_n_services); + + +/** @} + * @endcond + */ + +#endif /* GATTC_CACHE_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.c new file mode 100644 index 0000000000..8cbca8e3f1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.c @@ -0,0 +1,396 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "gatts_cache_manager.h" + +#include +#include "nrf_ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_manager_internal.h" +#include "peer_database.h" +#include "id_manager.h" +#include "sdk_common.h" + +#define SYS_ATTR_SYS (BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS) /**< Shorthand define for the flag for system attributes. */ +#define SYS_ATTR_USR (BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS) /**< Shorthand define for the flag for user attributes. */ +#define SYS_ATTR_BOTH (SYS_ATTR_SYS | SYS_ATTR_USR) /**< Shorthand define for the combined flags for system and user attributes. */ + + +/**@brief Structure containing the module variable(s) of the GSCM module. + */ +typedef struct +{ + gscm_evt_handler_t evt_handler; /**< The event handler to use for outbound GSCM events. */ + pm_peer_id_t current_sc_store_peer_id; +} gscm_t; + +static gscm_t m_gscm = +{ + .current_sc_store_peer_id = PM_PEER_ID_INVALID, +}; /**< Instantiation of module variable(s). */ + +#define MODULE_INITIALIZED (m_gscm.evt_handler != NULL) +#include "sdk_macros.h" + + +/**@brief Function for resetting the module variable(s) of the GSCM module. + * + * @param[out] p_gscm The instance to reset. + */ +static void internal_state_reset(gscm_t * p_gscm) +{ + memset(p_gscm, 0, sizeof(gscm_t)); + p_gscm->current_sc_store_peer_id = PM_PEER_ID_INVALID; +} + + +//lint -save -e550 +/**@brief Function for storing service_changed_pending = true to flash for all peers, in sequence. + * + * This function aborts if it gets @ref NRF_ERROR_BUSY when trying to store. A subsequent call will + * continue where the last call was aborted. + */ +static void service_changed_pending_set(void) +{ + VERIFY_MODULE_INITIALIZED_VOID(); + static const bool service_changed_pending = true; + ret_code_t err_code; + + //lint -save -e65 -e64 + pm_peer_data_const_t peer_data = + { + .data_id = PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, + .length_words = PM_SC_STATE_N_WORDS(), + .p_service_changed_pending = &service_changed_pending, + }; + //lint -restore + + err_code = pdb_raw_store(m_gscm.current_sc_store_peer_id, &peer_data, NULL); + while((m_gscm.current_sc_store_peer_id != PM_PEER_ID_INVALID) && (err_code != NRF_ERROR_BUSY)) + { + m_gscm.current_sc_store_peer_id = pdb_next_peer_id_get(m_gscm.current_sc_store_peer_id); + err_code = pdb_raw_store(m_gscm.current_sc_store_peer_id, &peer_data, NULL); + } +} +//lint -restore + + + +/**@brief Event handler for events from the peer_database module. + * + * @param[in] p_event The event that has happend with peer id and flags. + */ +static void pdb_evt_handler(pdb_evt_t const * p_event) +{ + if (p_event->evt_id == PDB_EVT_RAW_STORED) + { + if (p_event->data_id == PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING) + { + ret_code_t err_code; + pm_peer_data_flash_t peer_data; + + err_code = pdb_read_buf_get(p_event->peer_id, PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, &peer_data, NULL); + + if (err_code == NRF_SUCCESS) + { + gscm_evt_t gscm_evt; + gscm_evt.evt_id = GSCM_EVT_SC_STATE_STORED; + gscm_evt.peer_id = p_event->peer_id; + gscm_evt.params.sc_state_stored.state = &peer_data.p_service_changed_pending; + + m_gscm.evt_handler(&gscm_evt); + } + } + } + + if (m_gscm.current_sc_store_peer_id != PM_PEER_ID_INVALID) + { + service_changed_pending_set(); + } +} + + +ret_code_t gscm_init(gscm_evt_handler_t evt_handler) +{ + ret_code_t err_code; + if (evt_handler == NULL) + { + err_code = NRF_ERROR_NULL; + } + else + { + err_code = pdb_register(pdb_evt_handler); + if (err_code == NRF_SUCCESS) + { + internal_state_reset(&m_gscm); + m_gscm.evt_handler = evt_handler; + } + } + return err_code; +} + + +ret_code_t gscm_local_db_cache_update(uint16_t conn_handle) +{ + VERIFY_MODULE_INITIALIZED(); + + pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(conn_handle); + ret_code_t err_code; + + if (peer_id == PM_PEER_ID_INVALID) + { + return BLE_ERROR_INVALID_CONN_HANDLE; + } + else + { + pm_peer_data_t peer_data; + uint16_t n_bufs = 1; + bool retry_with_bigger_buffer = false; + + do + { + retry_with_bigger_buffer = false; + + err_code = pdb_write_buf_get(peer_id, PM_PEER_DATA_ID_GATT_LOCAL, n_bufs++, &peer_data); + if (err_code == NRF_SUCCESS) + { + pm_peer_data_local_gatt_db_t * p_local_gatt_db = peer_data.p_local_gatt_db; + + p_local_gatt_db->flags = SYS_ATTR_BOTH; + + err_code = sd_ble_gatts_sys_attr_get(conn_handle, &p_local_gatt_db->data[0], &p_local_gatt_db->len, p_local_gatt_db->flags); + + if (err_code == NRF_SUCCESS) + { + err_code = pdb_write_buf_store(peer_id, PM_PEER_DATA_ID_GATT_LOCAL); + } + else + { + if (err_code == NRF_ERROR_DATA_SIZE) + { + // The sys attributes are bigger than the requested write buffer. + retry_with_bigger_buffer = true; + } + else if (err_code == NRF_ERROR_NOT_FOUND) + { + // There are no sys attributes in the GATT db, so nothing needs to be stored. + err_code = NRF_SUCCESS; + } + + ret_code_t err_code_release = pdb_write_buf_release(peer_id, PM_PEER_DATA_ID_GATT_LOCAL); + if (err_code_release != NRF_SUCCESS) + { + err_code = NRF_ERROR_INTERNAL; + } + } + } + else if (err_code == NRF_ERROR_INVALID_PARAM) + { + // The sys attributes are bigger than the entire write buffer. + err_code = NRF_ERROR_DATA_SIZE; + } + } while (retry_with_bigger_buffer); + } + + return err_code; +} + + +ret_code_t gscm_local_db_cache_apply(uint16_t conn_handle) +{ + VERIFY_MODULE_INITIALIZED(); + + pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(conn_handle); + ret_code_t err_code; + pm_peer_data_flash_t peer_data; + uint8_t const * p_sys_attr_data = NULL; + uint16_t sys_attr_len = 0; + uint32_t sys_attr_flags = (SYS_ATTR_BOTH); + bool all_attributes_applied = true; + + if (peer_id != PM_PEER_ID_INVALID) + { + err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_GATT_LOCAL, &peer_data, NULL); + if (err_code == NRF_SUCCESS) + { + pm_peer_data_local_gatt_db_t const * p_local_gatt_db; + + p_local_gatt_db = peer_data.p_local_gatt_db; + p_sys_attr_data = p_local_gatt_db->data; + sys_attr_len = p_local_gatt_db->len; + sys_attr_flags = p_local_gatt_db->flags; + } + } + + do + { + err_code = sd_ble_gatts_sys_attr_set(conn_handle, p_sys_attr_data, sys_attr_len, sys_attr_flags); + + if (err_code == NRF_ERROR_NO_MEM) + { + err_code = NRF_ERROR_BUSY; + } + else if (err_code == NRF_ERROR_INVALID_STATE) + { + err_code = NRF_SUCCESS; + } + else if (err_code == NRF_ERROR_INVALID_DATA) + { + all_attributes_applied = false; + + if (sys_attr_flags & SYS_ATTR_USR) + { + // Try setting only system attributes. + sys_attr_flags = SYS_ATTR_SYS; + } + else if (p_sys_attr_data || sys_attr_len) + { + // Try reporting that none exist. + p_sys_attr_data = NULL; + sys_attr_len = 0; + sys_attr_flags = SYS_ATTR_BOTH; + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + } while (err_code == NRF_ERROR_INVALID_DATA); + + if (!all_attributes_applied) + { + err_code = NRF_ERROR_INVALID_DATA; + } + + return err_code; +} + + +ret_code_t gscm_local_db_cache_set(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db) +{ + VERIFY_MODULE_INITIALIZED(); + + pm_peer_data_const_t peer_data; + + memset(&peer_data, 0, sizeof(pm_peer_data_const_t)); + peer_data.data_id = PM_PEER_DATA_ID_GATT_LOCAL; + peer_data.p_local_gatt_db = p_local_db; + + return pdb_raw_store(peer_id, &peer_data, NULL); +} + + +ret_code_t gscm_local_db_cache_get(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db) +{ + VERIFY_MODULE_INITIALIZED(); + + pm_peer_data_t peer_data; + memset(&peer_data, 0, sizeof(pm_peer_data_t)); + peer_data.p_local_gatt_db = p_local_db; + + return pdb_raw_read(peer_id, PM_PEER_DATA_ID_GATT_LOCAL, &peer_data); +} + + +void gscm_local_database_has_changed(void) +{ + VERIFY_MODULE_INITIALIZED_VOID(); + m_gscm.current_sc_store_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); + service_changed_pending_set(); +} + + +bool gscm_service_changed_ind_needed(uint16_t conn_handle) +{ + ret_code_t err_code; + pm_peer_data_flash_t peer_data; + pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(conn_handle); + + err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, &peer_data, NULL); + + if (err_code != NRF_SUCCESS) + { + return false; + } + + return &peer_data.p_service_changed_pending; +} + + +ret_code_t gscm_service_changed_ind_send(uint16_t conn_handle) +{ + static uint16_t start_handle = 0x0000; + const uint16_t end_handle = 0xFFFF; + ret_code_t err_code; + + do + { + err_code = sd_ble_gatts_service_changed(conn_handle, start_handle, end_handle); + if (err_code == BLE_ERROR_INVALID_ATTR_HANDLE) + { + start_handle += 1; + } + } while (err_code == BLE_ERROR_INVALID_ATTR_HANDLE); + + return err_code; +} + + +void gscm_db_change_notification_done(pm_peer_id_t peer_id) +{ + VERIFY_MODULE_INITIALIZED_VOID(); + + static const bool service_changed_pending = false; + + //lint -save -e65 -e64 + pm_peer_data_const_t peer_data = + { + .data_id = PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, + .length_words = PM_SC_STATE_N_WORDS(), + .p_service_changed_pending = &service_changed_pending, + }; + //lint -restore + + // Don't need to check return code, because all error conditions can be ignored. + //lint -save -e550 + (void) pdb_raw_store(peer_id, &peer_data, NULL); + //lint -restore +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h new file mode 100644 index 0000000000..6c6b3f8baa --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef GATTS_CACHE_MANAGER_H__ +#define GATTS_CACHE_MANAGER_H__ + +#include +#include "sdk_errors.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" + + + +/** + * @cond NO_DOXYGEN + * @defgroup gatts_cache_manager GATT Server Cache Manager + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. A module for managing persistent storing of GATT + * attributes pertaining to the GATT server role of the local device. + */ + + +/**@brief Events that can come from the GATT Server Cache Manager module. + */ +typedef enum +{ + GSCM_EVT_LOCAL_DB_CACHE_STORED, /**< The persistent cache for the local database has been updated with provided values, for one peer. */ + GSCM_EVT_LOCAL_DB_CACHE_UPDATED, /**< The persistent cache for the local database has been updated with values from the SoftDevice, for one peer. */ + GSCM_EVT_SC_STATE_STORED, /**< The service changed pending flag in persistent storage has been updated, for one peer. */ +} gscm_evt_id_t; + + +/**@brief Structure containing an event from the GSCM module. + */ +typedef struct +{ + gscm_evt_id_t evt_id; /**< The type of event this is. */ + pm_peer_id_t peer_id; /**< The peer ID this event pertains to. */ + union + { + struct + { + uint16_t conn_handle; /**< The connection this event pertains to. */ + } local_db_cache_updated; + struct + { + bool state; /**< The newly stored state of the Service Changed pending flag. */ + } sc_state_stored; + } params; /**< Event parameters specific to certain event types. */ +} gscm_evt_t; + +/**@brief Event handler for events from the GATT Server Cache Manager module. + * + * @param[in] event The event that has happened. + * @param[in] peer The id of the peer the event pertains to. + * @param[in] flags The data the event pertains to. + */ +typedef void (*gscm_evt_handler_t)(gscm_evt_t const * p_event); + + +/**@brief Function for initializing the GATT Server Cache Manager module. + * + * @param[in] evt_handler Callback for events from the GATT Server Cache Manager module. + * + * @retval NRF_SUCCESS Initialization was successful. + * @retval NRF_ERROR_NULL evt_handler was NULL. + */ +ret_code_t gscm_init(gscm_evt_handler_t evt_handler); + + +/**@brief Function for triggering local GATT database data to be stored persistently. Values are + * retrieved from the SoftDevice and written to persistent storage. + * + * @param[in] conn_handle Connection handle to perform update on. + * + * @retval NRF_SUCCESS Store operation started. + * @retval BLE_ERROR_INVALID_CONN_HANDLE conn_handle does not refer to an active connection with a + * bonded peer. + * @retval NRF_ERROR_BUSY Unable to perform operation at this time. Reattempt later. + * @retval NRF_ERROR_DATA_SIZE Write buffer not large enough. Call will never work with + * this GATT database. + * @retval NRF_ERROR_NO_MEM No room in persistent_storage. Free up space; the + * operation will be automatically reattempted after the + * next compression procedure + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gscm_local_db_cache_update(uint16_t conn_handle); + + +/**@brief Function for applying stored local GATT database data to the SoftDevice. Values are + * retrieved from persistent storage and given to the SoftDevice. + * + * @param[in] conn_handle Connection handle to apply values to. + * + * @retval NRF_SUCCESS Store operation started. + * @retval BLE_ERROR_INVALID_CONN_HANDLE conn_handle does not refer to an active connection with a + * bonded peer. + * @retval NRF_ERROR_INVALID_DATA The stored data was rejected by the SoftDevice, which + * probably means that the local database has changed. The + * system part of the sys_attributes was attempted applied, + * so service changed indications can be sent to subscribers. + * @retval NRF_ERROR_BUSY Unable to perform operation at this time. Reattempt later. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @return An unexpected return value from an internal function call. + */ +ret_code_t gscm_local_db_cache_apply(uint16_t conn_handle); + + +/**@brief Function for setting new values in the local database cache. + * + * @note If the peer is connected, the values will also be applied immediately to the connection. + * @note The data in the pointer must be available until the GSCM_EVT_LOCAL_DB_STORED event is + * received. + * + * @param[in] peer_id Peer to set values for. + * @param[in] p_local_db Database values to apply. If NULL, the values will instead be cleared. + * + * @retval NRF_SUCCESS Operation started, and values were applied (if connected). + * @retval NRF_ERROR_NOT_FOUND The peer ID was invalid or unallocated. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @return An unexpected return value from an internal function call. + */ +ret_code_t gscm_local_db_cache_set(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db); + + +/**@brief Function for retrieving values in the local database cache. + * + * @param[in] peer_id Peer to get values for. + * @param[inout] p_local_db Where to store the data. The length field needs to reflect the + * available buffer space. On a successful read, the length field is + * updated to match the length of the read data. + * + * @retval NRF_SUCCESS Values retrieved successfully. + * @retval NRF_ERROR_NOT_FOUND The peer ID was invalid or unallocated. + * @retval NRF_ERROR_NULL p_local_db was NULL. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t gscm_local_db_cache_get(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db); + + +/**@brief Function for storing the fact that the local database has changed, for all currently + * bonded peers. + * + * @note This will cause a later call to @ref gscm_service_changed_ind_needed to return true for + * a connection with a currently bonded peer. + */ +void gscm_local_database_has_changed(void); + + +/**@brief Function for checking if a service changed indication should be sent. + * + * @param[in] conn_handle The connection to check. + * + * @return true if a service changed indication should be sent, false if not. + */ +bool gscm_service_changed_ind_needed(uint16_t conn_handle); + + +/**@brief Function for sending a service changed indication to a connected peer. + * + * @param[in] conn_handle The connection to send the indication on. + * + * @retval NRF_SUCCESS Indication sent or not needed. + * @retval BLE_ERROR_INVALID_CONN_HANDLE conn_handle does not refer to an active connection. + * @retval NRF_ERROR_BUSY Unable to send indication at this time. Reattempt later. + * @retval BLE_ERROR_GATTS_SYS_ATTR_MISSING Information missing. Apply local cache, then reattempt. + * @retval NRF_ERROR_INVALID_PARAM From @ref sd_ble_gatts_service_changed. Unexpected. + * @retval NRF_ERROR_NOT_SUPPORTED Service changed characteristic is not present. + * @retval NRF_ERROR_INVALID_STATE Service changed cannot be indicated to this peer + * because the peer has not subscribed to it. + */ +ret_code_t gscm_service_changed_ind_send(uint16_t conn_handle); + + +/**@brief Function for specifying that a peer has been made aware of the latest local database + * change. + * + * @note After calling this, a later call to @ref gscm_service_changed_ind_needed will to return + * false for this peer unless @ref gscm_local_database_has_changed is called again. + * + * @param[in] peer_id The connection to send the indication on. + */ +void gscm_db_change_notification_done(pm_peer_id_t peer_id); + +/** @} + * @endcond +*/ + +#endif /* GATTS_CACHE_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c new file mode 100644 index 0000000000..94bc363ef6 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c @@ -0,0 +1,758 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "id_manager.h" + +#include +#include "nrf_soc.h" +#include "nrf_ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_database.h" +#include "nordic_common.h" +#include "sdk_common.h" + +#define IM_MAX_CONN_HANDLES 8 +#define IM_NO_INVALID_CONN_HANDLES 0xFF +#define MAX_REGISTRANTS 3 +#define WHITELIST_MAX_COUNT MAX(BLE_GAP_WHITELIST_ADDR_MAX_COUNT, \ + BLE_GAP_WHITELIST_IRK_MAX_COUNT) +#define IM_ADDR_CLEARTEXT_LENGTH 3 +#define IM_ADDR_CIPHERTEXT_LENGTH 3 + +typedef struct +{ + pm_peer_id_t peer_id; + uint16_t conn_handle; + ble_gap_addr_t peer_address; +} im_connection_t; + +typedef struct +{ + im_evt_handler_t evt_handlers[MAX_REGISTRANTS]; + uint8_t n_registrants; + im_connection_t connections[8]; + pm_peer_id_t irk_whitelist_peer_ids[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + ble_gap_irk_t whitelist_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + ble_gap_addr_t whitelist_addrs[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + uint8_t n_irk_whitelist_peer_ids; + ble_conn_state_user_flag_id_t conn_state_user_flag_id; +} im_t; + +static im_t m_im = {.n_registrants = 0}; + +#define MODULE_INITIALIZED (m_im.n_registrants > 0) +#include "sdk_macros.h" + +static void internal_state_reset() +{ + memset(&m_im, 0, sizeof(im_t)); + m_im.n_registrants = 0; + m_im.n_irk_whitelist_peer_ids = 0; + m_im.conn_state_user_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; + for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) + { + m_im.connections[i].conn_handle = BLE_CONN_HANDLE_INVALID; + } +} + + +/**@brief Function for sending an event to all registered event handlers. + * + * @param[in] p_event The event to distribute. + */ +static void evt_send(im_evt_t * p_event) +{ + for (uint32_t i = 0; i < m_im.n_registrants; i++) + { + m_im.evt_handlers[i](p_event); + } +} + +/**@brief Function finding a free position in m_im.connections. + * + * @detail All connection handles in the m_im.connections array are checked against the connection + * state module. The index of the first one that is not a connection handle for a current + * connection is returned. This position in the array can safely be used for a new connection. + * + * @return Either the index of a free position in the array or IM_NO_INVALID_CONN_HANDLES if no free + position exists. + */ +uint8_t get_free_connection() +{ + for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) + { + // Query the connection state module to check if the connection handle does not belong to a + // valid connection. + if (!ble_conn_state_user_flag_get(m_im.connections[i].conn_handle, m_im.conn_state_user_flag_id)) + { + return i; + } + } + // If all connection handles belong to a valid connection, return IM_NO_INVALID_CONN_HANDLES. + return IM_NO_INVALID_CONN_HANDLES; +} + + +/**@brief Function finding a particular connection handle m_im.connections. + * + * @param[in] conn_handle The handle to find. + * + * @return Either the index of the conn_handle in the array or IM_NO_INVALID_CONN_HANDLES if the + * handle was not found. + */ +uint8_t get_connection_by_conn_handle(uint16_t conn_handle) +{ + if (ble_conn_state_user_flag_get(conn_handle, m_im.conn_state_user_flag_id)) + { + for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) + { + if (m_im.connections[i].conn_handle == conn_handle) + { + return i; + } + } + } + // If all connection handles belong to a valid connection, return IM_NO_INVALID_CONN_HANDLES. + return IM_NO_INVALID_CONN_HANDLES; +} + + +/**@brief Function for registering a new connection instance. + * + * @param[in] conn_handle The handle of the new connection. + * @param[in] p_ble_addr The address used to connect. + * + * @return Either the index of the new connection in the array or IM_NO_INVALID_CONN_HANDLES if no + * free position exists. + */ +uint8_t new_connection(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr) +{ + uint8_t conn_index = IM_NO_INVALID_CONN_HANDLES; + + if ((p_ble_addr != NULL) && (conn_handle != BLE_CONN_HANDLE_INVALID)) + { + ble_conn_state_user_flag_set(conn_handle, m_im.conn_state_user_flag_id, true); + + conn_index = get_connection_by_conn_handle(conn_handle); + if (conn_index == IM_NO_INVALID_CONN_HANDLES) + { + conn_index = get_free_connection(); + } + + if (conn_index != IM_NO_INVALID_CONN_HANDLES) + { + m_im.connections[conn_index].conn_handle = conn_handle; + m_im.connections[conn_index].peer_id = PM_PEER_ID_INVALID; + m_im.connections[conn_index].peer_address = *p_ble_addr; + } + } + return conn_index; +} + + +/**@brief Function checking the validity of an IRK + * + * @detail An all-zero IRK is not valid. This function will check if a given IRK is valid. + * + * @param[in] irk The IRK for which the validity is going to be checked. + * + * @retval true The IRK is valid. + * @retval false The IRK is invalid. + */ +bool is_valid_irk(ble_gap_irk_t const * irk) +{ + for (uint32_t i = 0; i < BLE_GAP_SEC_KEY_LEN; i++) + { + if (irk->irk[i] != 0) + { + return true; + } + } + return false; +} + + +/**@brief Function for comparing two addresses to determine if they are identical + * + * @note The address type need to be identical, as well as every bit in the address itself. + * + * @param[in] p_addr1 The first address to be compared. + * @param[in] p_addr2 The second address to be compared. + * + * @retval true The addresses are identical. + * @retval false The addresses are not identical. + */ +bool addr_compare(ble_gap_addr_t const * p_addr1, ble_gap_addr_t const * p_addr2) +{ + if ((p_addr1 == NULL) || (p_addr2 == NULL)) + { + return false; + } + + // Check that the addr type is identical, return false if it is not + if (p_addr1->addr_type != p_addr2->addr_type) + { + return false; + } + // Check if the addr bytes are is identical + return (memcmp(p_addr1->addr, p_addr2->addr, BLE_GAP_ADDR_LEN) == 0); +} + + +void im_ble_evt_handler(ble_evt_t * ble_evt) +{ + ret_code_t err_code; + switch (ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + { + pm_peer_id_t bonded_matching_peer_id = PM_PEER_ID_INVALID; + + if (ble_evt->evt.gap_evt.params.connected.irk_match == 1) + { + // The peer was matched using a whitelist. + bonded_matching_peer_id + = m_im.irk_whitelist_peer_ids[ble_evt->evt.gap_evt.params.connected.irk_match_idx]; + } + else if ( ble_evt->evt.gap_evt.params.connected.peer_addr.addr_type + != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE) + { + /* Search the database for bonding data matching the one that triggered the event. + * Public and static addresses can be matched on address alone, while resolvable + * random addresses can be resolved agains known IRKs. Non-resolvable random addresses + * are never matching because they are not longterm form of identification. + */ + pm_peer_id_t compared_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); + while ( (compared_peer_id != PM_PEER_ID_INVALID) + && (bonded_matching_peer_id == PM_PEER_ID_INVALID)) + { + pm_peer_data_flash_t compared_data; + switch (ble_evt->evt.gap_evt.params.connected.peer_addr.addr_type) + { + case BLE_GAP_ADDR_TYPE_PUBLIC: + /* fall-through */ + case BLE_GAP_ADDR_TYPE_RANDOM_STATIC: + err_code = pdb_read_buf_get(compared_peer_id, + PM_PEER_DATA_ID_BONDING, + &compared_data, + NULL); + if ((err_code == NRF_SUCCESS) && + addr_compare(&ble_evt->evt.gap_evt.params.connected.peer_addr, + &compared_data.p_bonding_data->peer_id.id_addr_info) + ) + { + bonded_matching_peer_id = compared_peer_id; + } + break; + + case BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE: + err_code = pdb_read_buf_get(compared_peer_id, + PM_PEER_DATA_ID_BONDING, + &compared_data, + NULL); + if (err_code == NRF_SUCCESS && + im_address_resolve(&ble_evt->evt.gap_evt.params.connected.peer_addr, + &compared_data.p_bonding_data->peer_id.id_info) + ) + { + bonded_matching_peer_id = compared_peer_id; + } + break; + + case BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE: + // Should not happen. + break; + + default: + break; + } + compared_peer_id = pdb_next_peer_id_get(compared_peer_id); + } + } + uint8_t new_index = new_connection(ble_evt->evt.gap_evt.conn_handle, &ble_evt->evt.gap_evt.params.connected.peer_addr); + UNUSED_VARIABLE(new_index); + + if (bonded_matching_peer_id != PM_PEER_ID_INVALID) + { + im_new_peer_id(ble_evt->evt.gap_evt.conn_handle, bonded_matching_peer_id); + + // Send a bonded peer event + im_evt_t im_evt; + im_evt.conn_handle = ble_evt->evt.gap_evt.conn_handle; + im_evt.evt_id = IM_EVT_BONDED_PEER_CONNECTED; + evt_send(&im_evt); + } + } + } +} + + +/**@brief Function to compare two sets of bonding data to check if they belong to the same device. + * @note Invalid irks will never match even though they are identical. + * + * @param[in] p_bonding_data1 First bonding data for comparison + * @param[in] p_bonding_data2 Second bonding data for comparison + * + * @return True if the input matches, false if it does not. + */ +bool is_duplicate_bonding_data(pm_peer_data_bonding_t const * p_bonding_data1, + pm_peer_data_bonding_t const * p_bonding_data2) +{ + bool valid_irk = is_valid_irk(&p_bonding_data1->peer_id.id_info); + bool duplicate_irk = valid_irk && + (memcmp(p_bonding_data1->peer_id.id_info.irk, + p_bonding_data2->peer_id.id_info.irk, + BLE_GAP_SEC_KEY_LEN) == 0 + ); + bool duplicate_addr = addr_compare(&p_bonding_data1->peer_id.id_addr_info, + &p_bonding_data2->peer_id.id_addr_info + ); + return duplicate_irk || duplicate_addr; +} + + +/**@brief Event handler for events from the peer_database module. + * + * @param[in] p_event The event that has happend with peer id and flags. + */ +static void pdb_evt_handler(pdb_evt_t const * p_event) +{ + ret_code_t err_code; + if ((p_event != NULL) && (p_event->evt_id == PDB_EVT_WRITE_BUF_STORED)) + { + // If new data about peer id has been stored it is compared to other peers peer ids in + // search of duplicates. + if (p_event->data_id == PM_PEER_DATA_ID_BONDING) + { + pm_peer_data_flash_t written_data; + err_code = pdb_read_buf_get(p_event->peer_id, PM_PEER_DATA_ID_BONDING, &written_data, NULL); + if (err_code == NRF_SUCCESS) + { + pm_peer_id_t compared_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); + while (compared_peer_id != PM_PEER_ID_INVALID) + { + pm_peer_data_flash_t compared_data; + err_code = pdb_read_buf_get(compared_peer_id, + PM_PEER_DATA_ID_BONDING, + &compared_data, + NULL); + if ( err_code == NRF_SUCCESS && + p_event->peer_id != compared_peer_id && + is_duplicate_bonding_data(written_data.p_bonding_data, + compared_data.p_bonding_data) + ) + { + im_evt_t im_evt; + im_evt.conn_handle = im_conn_handle_get(p_event->peer_id); + im_evt.evt_id = IM_EVT_DUPLICATE_ID; + im_evt.params.duplicate_id.peer_id_1 = p_event->peer_id; + im_evt.params.duplicate_id.peer_id_2 = compared_peer_id; + evt_send(&im_evt); + } + compared_peer_id = pdb_next_peer_id_get(compared_peer_id); + } + } + } + } +} + + +ret_code_t im_register(im_evt_handler_t evt_handler) +{ + VERIFY_PARAM_NOT_NULL(evt_handler); + ret_code_t err_code = NRF_SUCCESS; + + if (!MODULE_INITIALIZED) + { + internal_state_reset(); + m_im.conn_state_user_flag_id = ble_conn_state_user_flag_acquire(); + if (m_im.conn_state_user_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) + { + err_code = NRF_ERROR_NO_MEM; + } + else + { + err_code = pdb_register(pdb_evt_handler); + } + } + if (err_code == NRF_SUCCESS) + { + if ((m_im.n_registrants < MAX_REGISTRANTS)) + { + m_im.evt_handlers[m_im.n_registrants++] = evt_handler; + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + } + return err_code; +} + + +pm_peer_id_t im_peer_id_get_by_conn_handle(uint16_t conn_handle) +{ + uint8_t conn_index = get_connection_by_conn_handle(conn_handle); + + if (MODULE_INITIALIZED && (conn_index != IM_NO_INVALID_CONN_HANDLES)) + { + return m_im.connections[conn_index].peer_id; + } + + return PM_PEER_ID_INVALID; +} + + +ret_code_t im_ble_addr_get(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_ble_addr); + + uint8_t conn_index = get_connection_by_conn_handle(conn_handle); + if (conn_index != IM_NO_INVALID_CONN_HANDLES) + { + *p_ble_addr = m_im.connections[conn_index].peer_address; + return NRF_SUCCESS; + } + + return NRF_ERROR_NOT_FOUND; +} + + +bool im_master_ids_compare(ble_gap_master_id_t const * p_master_id1, + ble_gap_master_id_t const * p_master_id2) +{ + if(!im_master_id_is_valid(p_master_id1)) + { + return false; + } + if (p_master_id1->ediv != p_master_id2->ediv) + { + return false; + } + return (memcmp(p_master_id1->rand, p_master_id2->rand, BLE_GAP_SEC_RAND_LEN) == 0); +} + + +pm_peer_id_t im_peer_id_get_by_master_id(ble_gap_master_id_t * p_master_id) +{ + ret_code_t err_code; + // For each stored peer, check if the master_id match p_master_id + pm_peer_id_t compared_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); + while (compared_peer_id != PM_PEER_ID_INVALID) + { + pm_peer_data_flash_t compared_data; + ble_gap_master_id_t const * p_compared_master_id; + + err_code = pdb_read_buf_get(compared_peer_id, PM_PEER_DATA_ID_BONDING, &compared_data, NULL); + if (err_code == NRF_SUCCESS) + { + p_compared_master_id = &compared_data.p_bonding_data->own_ltk.master_id; + if (im_master_ids_compare(p_master_id, p_compared_master_id)) + { + // If a matching master_id is found return the peer_id + return compared_peer_id; + } + p_compared_master_id = &compared_data.p_bonding_data->peer_ltk.master_id; + if (im_master_ids_compare(p_master_id, p_compared_master_id)) + { + // If a matching master_id is found return the peer_id + return compared_peer_id; + } + } + compared_peer_id = pdb_next_peer_id_get(compared_peer_id); + } + // If no matching master_id is found return the PM_PEER_ID_INVALID + return PM_PEER_ID_INVALID; +} + + +pm_peer_id_t im_peer_id_get_by_irk_match_idx(uint8_t irk_match_idx) +{ + // Verify that the requested idx is within the list + if (irk_match_idx < m_im.n_irk_whitelist_peer_ids) + { + // Return the peer_id from the white list + return m_im.irk_whitelist_peer_ids[irk_match_idx]; + } + else + { + // Return PM_PEER_ID_INVALID to indicate that there was no peer with the requested idx + return PM_PEER_ID_INVALID; + } +} + + +uint16_t im_conn_handle_get(pm_peer_id_t peer_id) +{ + for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) + { + if (peer_id == m_im.connections[i].peer_id) + { + return m_im.connections[i].conn_handle; + } + } + return BLE_CONN_HANDLE_INVALID; +} + + +bool im_master_id_is_valid(ble_gap_master_id_t const * p_master_id) +{ + if (p_master_id->ediv != 0) + { + return true; + } + for (uint32_t i = 0; i < BLE_GAP_SEC_RAND_LEN; i++) + { + if (p_master_id->rand[i] != 0) + { + return true; + } + } + return false; +} + + +/**@brief Function to set the peer ID associated with a connection handle. + * + * @param[in] conn_handle The connection handle. + * @param[in] peer_id The peer ID to associate with @c conn_handle. + */ +static void peer_id_set(uint16_t conn_handle, pm_peer_id_t peer_id) +{ + uint8_t conn_index = get_connection_by_conn_handle(conn_handle); + if (conn_index != IM_NO_INVALID_CONN_HANDLES) + { + m_im.connections[conn_index].peer_id = peer_id; + } +} + + +void im_new_peer_id(uint16_t conn_handle, pm_peer_id_t peer_id) +{ + peer_id_set(conn_handle, peer_id); +} + + +ret_code_t im_peer_free(pm_peer_id_t peer_id) +{ + VERIFY_MODULE_INITIALIZED(); + + uint16_t conn_handle = im_conn_handle_get(peer_id); + ret_code_t err_code = pdb_peer_free(peer_id); + if ((conn_handle != BLE_CONN_HANDLE_INVALID) && (err_code == NRF_SUCCESS)) + { + peer_id_set(conn_handle, PM_PEER_ID_INVALID); + } + return err_code; +} + + +ret_code_t im_whitelist_create(pm_peer_id_t * p_peer_ids, + uint8_t n_peer_ids, + ble_gap_whitelist_t * p_whitelist) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_whitelist); + ret_code_t err_code; + p_whitelist->addr_count = 0; + p_whitelist->irk_count = 0; + m_im.n_irk_whitelist_peer_ids = 0; + for (uint32_t peer_index = 0; peer_index < n_peer_ids; peer_index++) + { + uint16_t conn_handle = im_conn_handle_get(p_peer_ids[peer_index]); + if (ble_conn_state_status(conn_handle) != BLE_CONN_STATUS_CONNECTED) + { + pm_peer_data_flash_t peer_data; + err_code = pdb_read_buf_get(p_peer_ids[peer_index], PM_PEER_DATA_ID_BONDING, &peer_data, NULL); + if (err_code == NRF_ERROR_INVALID_PARAM || err_code == NRF_ERROR_NOT_FOUND) + { + return NRF_ERROR_INVALID_PARAM; + } + if (p_whitelist->pp_addrs != NULL && + peer_data.p_bonding_data->peer_id.id_addr_info.addr_type + != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE && + peer_data.p_bonding_data->peer_id.id_addr_info.addr_type + != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE + ) + { + memcpy(m_im.whitelist_addrs[peer_index].addr, + peer_data.p_bonding_data->peer_id.id_addr_info.addr, + BLE_GAP_ADDR_LEN + ); + m_im.whitelist_addrs[peer_index].addr_type = + peer_data.p_bonding_data->peer_id.id_addr_info.addr_type; + p_whitelist->pp_addrs[peer_index] = &m_im.whitelist_addrs[peer_index]; + p_whitelist->addr_count++; + } + if (p_whitelist->pp_irks != NULL && + is_valid_irk(&(peer_data.p_bonding_data->peer_id.id_info)) + ) + { + memcpy(m_im.whitelist_irks[peer_index].irk, + peer_data.p_bonding_data->peer_id.id_info.irk, + BLE_GAP_SEC_KEY_LEN + ); + p_whitelist->pp_irks[peer_index] = &m_im.whitelist_irks[peer_index]; + p_whitelist->irk_count++; + m_im.irk_whitelist_peer_ids[peer_index] = p_peer_ids[peer_index]; + m_im.n_irk_whitelist_peer_ids++; + } + } + } + return NRF_SUCCESS; +} + + +ret_code_t im_whitelist_custom(ble_gap_whitelist_t const * p_whitelist) +{ + ret_code_t err_code; + + pm_peer_id_t new_irk_whitelist_peer_ids[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + uint32_t n_new_irk_whitelist_peer_ids = 0; + VERIFY_PARAM_NOT_NULL(p_whitelist); + for (uint32_t i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) + { + new_irk_whitelist_peer_ids[i] = PM_PEER_ID_INVALID; + } + pm_peer_id_t compared_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); + while (compared_peer_id != PM_PEER_ID_INVALID) + { + pm_peer_data_flash_t compared_data; + err_code = pdb_read_buf_get(compared_peer_id, PM_PEER_DATA_ID_BONDING, &compared_data, NULL); + if (err_code == NRF_SUCCESS) + { + for (uint32_t i = 0; i < p_whitelist->irk_count; i++) + { + bool valid_irk = is_valid_irk(&compared_data.p_bonding_data->peer_id.id_info); + bool duplicate_irk = valid_irk && + (memcmp(p_whitelist->pp_irks[i]->irk, + compared_data.p_bonding_data->peer_id.id_info.irk, + BLE_GAP_SEC_KEY_LEN) == 0 + ); + if (duplicate_irk) + { + new_irk_whitelist_peer_ids[i] = compared_peer_id; + n_new_irk_whitelist_peer_ids++; + } + } + } + compared_peer_id = pdb_next_peer_id_get(compared_peer_id); + } + if (n_new_irk_whitelist_peer_ids != p_whitelist->irk_count) + { + return NRF_ERROR_NOT_FOUND; + } + else + { + for (uint32_t i = 0; i < n_new_irk_whitelist_peer_ids; i++) + { + m_im.irk_whitelist_peer_ids[i] = new_irk_whitelist_peer_ids[i]; + } + m_im.n_irk_whitelist_peer_ids = n_new_irk_whitelist_peer_ids; + return NRF_SUCCESS; + } +} + + +/**@brief Function for calculating the ah() hash function described in Bluetooth core specification + * 4.2 section 3.H.2.2.2. + * + * @detail BLE uses a hash function to calculate the first half of a resolvable address + * from the second half of the address and an irk. This function will use the ECB + * periferal to hash these data acording to the Bluetooth core specification. + * + * @note The ECB expect little endian input and output. + * This function expect big endian and will reverse the data as necessary. + * + * @param[in] p_k The key used in the hash function. + * For address resolution this is should be the irk. + * The array must have a length of 16. + * @param[in] p_r The rand used in the hash function. For generating a new address + * this would be a random number. For resolving a resolvable address + * this would be the last half of the address being resolved. + * The array must have a length of 3. + * @param[out] p_local_hash The result of the hash operation. For address resolution this + * will match the first half of the address being resolved if and only + * if the irk used in the hash function is the same one used to generate + * the address. + * The array must have a length of 16. + */ +void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash) +{ + ret_code_t err_code; + nrf_ecb_hal_data_t ecb_hal_data; + for (uint32_t i = 0; i < SOC_ECB_KEY_LENGTH; i++) + { + ecb_hal_data.key[i] = p_k[SOC_ECB_KEY_LENGTH - 1 - i]; + } + memset(ecb_hal_data.cleartext, 0, SOC_ECB_KEY_LENGTH - IM_ADDR_CLEARTEXT_LENGTH); + + for (uint32_t i = 0; i < IM_ADDR_CLEARTEXT_LENGTH; i++) + { + ecb_hal_data.cleartext[SOC_ECB_KEY_LENGTH - 1 - i] = p_r[i]; + } + + err_code = sd_ecb_block_encrypt(&ecb_hal_data); // Can only return NRF_SUCCESS. + UNUSED_VARIABLE(err_code); + + for (uint32_t i = 0; i < IM_ADDR_CIPHERTEXT_LENGTH; i++) + { + p_local_hash[i] = ecb_hal_data.ciphertext[SOC_ECB_KEY_LENGTH - 1 - i]; + } +} + + +bool im_address_resolve(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk) +{ + if (p_addr->addr_type != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE) + { + return false; + } + uint8_t hash[IM_ADDR_CIPHERTEXT_LENGTH]; + uint8_t local_hash[IM_ADDR_CIPHERTEXT_LENGTH]; + uint8_t prand[IM_ADDR_CLEARTEXT_LENGTH]; + memcpy(hash, p_addr->addr, IM_ADDR_CIPHERTEXT_LENGTH); + memcpy(prand, &p_addr->addr[IM_ADDR_CIPHERTEXT_LENGTH], IM_ADDR_CLEARTEXT_LENGTH); + ah(p_irk->irk, prand, local_hash); + + return (memcmp(hash, local_hash, IM_ADDR_CIPHERTEXT_LENGTH) == 0); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h new file mode 100644 index 0000000000..27434bff3a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h @@ -0,0 +1,301 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef PEER_ID_MANAGER_H__ +#define PEER_ID_MANAGER_H__ + +#include +#include "sdk_errors.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @cond NO_DOXYGEN + * @defgroup id_manager ID Manager + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. A module for keeping track of peer identities + * (IRK and peer address). + */ + + +/**@brief Events that can come from the ID Manager module. + */ +typedef enum +{ + IM_EVT_DUPLICATE_ID, /**< The ID Manager module has detected that two stored peers represent the same peer. */ + IM_EVT_BONDED_PEER_CONNECTED, /**< A connected peer has been identified as one of the bonded peers. This can happen immediately on connection, or at a later time. */ +} im_evt_id_t; + + +typedef struct +{ + im_evt_id_t evt_id; + uint16_t conn_handle; + union + { + struct + { + pm_peer_id_t peer_id_1; + pm_peer_id_t peer_id_2; + } duplicate_id; + } params; +} im_evt_t; + + +/**@brief Event handler for events from the ID Manager module. + * + * @param[in] p_event The event that has happened. + */ +typedef void (*im_evt_handler_t)(im_evt_t const * p_event); + +/**@brief Function for registering for events from the ID Manager module. + * + * @note This will also initialize the module if needed. + * + * @param[in] evt_handler Callback for events from the ID Manager module. + * + * @retval NRF_SUCCESS Registration was successful. + * @retval NRF_ERROR_NO_MEM No more registrations possible. + * @retval NRF_ERROR_NULL evt_handler was NULL. + */ +ret_code_t im_register(im_evt_handler_t evt_handler); + + +/**@brief Function for dispatching SoftDevice events to the ID Manager module. + * + * @param[in] p_ble_evt The SoftDevice event. + */ +void im_ble_evt_handler(ble_evt_t * p_ble_evt); + + +/**@brief Function for getting the corresponding peer ID from a connection handle. + * + * @param[in] conn_handle The connection handle. + * + * @return The corresponding peer ID, or @ref PM_PEER_ID_INVALID if none could be resolved. + */ +pm_peer_id_t im_peer_id_get_by_conn_handle(uint16_t conn_handle); + + +/**@brief Function for getting the corresponding peer ID from a master ID (EDIV and rand). + * + * @param[in] p_master_id The master ID. + * + * @return The corresponding peer ID, or @ref PM_PEER_ID_INVALID if none could be resolved. + */ +pm_peer_id_t im_peer_id_get_by_master_id(ble_gap_master_id_t * p_master_id); + + +/**@brief Function for getting the corresponding peer ID from an IRK match index, see @ref + * ble_gap_evt_connected_t. + * + * @param[in] irk_match_idx The IRK match index. + * + * @return The corresponding peer ID, or @ref PM_PEER_ID_INVALID if none could be resolved. + */ +pm_peer_id_t im_peer_id_get_by_irk_match_idx(uint8_t irk_match_idx); + + +/**@brief Function for getting the corresponding connection handle from a peer ID. + * + * @param[in] peer_id The peer ID. + * + * @return The corresponding connection handle, or @ref BLE_CONN_HANDLE_INVALID if none could be + * resolved. + */ +uint16_t im_conn_handle_get(pm_peer_id_t peer_id); + + +/**@brief Function for comparing two master ids + * @note Two invalid master IDs will not match. + * + * @param[in] p_master_id1 First master id for comparison + * @param[in] p_master_id2 Second master id for comparison + * + * @return True if the input matches, false if it does not. + */ +bool im_master_ids_compare(ble_gap_master_id_t const * p_master_id1, + ble_gap_master_id_t const * p_master_id2); + + +/**@brief Function for getting the BLE address used by the peer when connecting. + * + * @param[in] conn_handle The connection handle. + * @param[out] p_ble_addr The BLE address used by the peer when the connection specified by + * conn_handle was established. + * + * @retval NRF_SUCCESS The address was found and copied. + * @retval NRF_ERROR_INVALID_STATE Module not initialized. + * @retval BLE_ERROR_CONN_HANDLE_INVALID conn_handle does not refer to an active connection. + * @retval NRF_ERROR_NULL p_ble_addr was NULL. + */ +ret_code_t im_ble_addr_get(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr); + + +/**@brief Function for checking whether a master ID is valid or invalid + * + * @param[in] p_master_id The master ID. + * + * @retval true The master id is valid. + * @retval true The master id is invalid (i.e. all zeros). + */ +bool im_master_id_is_valid(ble_gap_master_id_t const * p_master_id); + + +/**@brief Function for reporting that a new peer ID has been allocated for a specified connection. + * + * @param[in] conn_handle The connection. + * @param[in] peer_id The new peer ID. + */ +void im_new_peer_id(uint16_t conn_handle, pm_peer_id_t peer_id); + + +/**@brief Function for deleting all of a peer's data from flash and disassociating it from any + * connection handles it is associated with. + * + * @param[in] peer_id The peer to free. + * + * @return Any error code returned by @ref pdb_peer_free. + */ +ret_code_t im_peer_free(pm_peer_id_t peer_id); + + +/**@brief Function for informing this module of what whitelist will be used. + * + * @details This function is meant to be used when the app wants to use a custom whitelist. + * When using peer manager, this function must be used if a custom whitelist is used. + * Only whitelisted IRKs are of any importance for this function. + * + * @note When using a whitelist, always use the whitelist created/set by the most recent + * call to @ref im_whitelist_create or to this function, whichever happened most recently. + * @note Do not call this function while scanning with another whitelist. + * @note Do not add any irks to the whitelist that are not present in the bonding data of a peer in + * the peer database. + * @note The whitelist is not altered in any way by calling this function. Only the internal state + * of the module is changed. + * + * @param[in] p_whitelist The whitelist. + * + * @retval NRF_SUCCESS Whitelist successfully set. + * @retval NRF_ERROR_NULL p_whitelist was NULL. + * @retval NRF_ERROR_NOT_FOUND One or more of the whitelists irks was not found in the peer_database. + */ +ret_code_t im_whitelist_custom(ble_gap_whitelist_t const * p_whitelist); + + +/** + * @brief Function for constructing a whitelist for use when advertising. + * + * @note When advertising with whitelist, always use the whitelist created/set by the most recent + * call to this function or to @ref im_whitelist_custom, whichever happened most recently. + * @note Do not call this function while advertising with another whitelist. + * + * @param[in] p_peer_ids The ids of the peers to be added to the whitelist. + * @param[in] n_peer_ids The number of peer ids in p_peer_ids. + * @param[in,out] p_whitelist The constructed whitelist. Note that p_adv_whitelist->pp_addrs + * must be NULL or point to an array with size @ref + * BLE_GAP_WHITELIST_ADDR_MAX_COUNT and p_adv_whitelist->pp_irks + * must be NULL or point to an array with size @ref + * BLE_GAP_WHITELIST_IRK_MAX_COUNT. + * + * @retval NRF_SUCCESS Whitelist successfully created. + * @retval NRF_ERROR_NULL p_whitelist was NULL. + */ +ret_code_t im_whitelist_create(pm_peer_id_t * p_peer_ids, + uint8_t n_peer_ids, + ble_gap_whitelist_t * p_whitelist); + +/** + * @brief Function for resolving a resolvable address with an identity resolution key (IRK). + * + * @details This function will use the ECB peripheral to resolve a resolvable address. + * This can be used to resolve the identity of a device distributing a random + * resolvable address based on any IRKs you have received earlier. If an address is + * resolved by an IRK, the device disributing the address must also know the IRK. + * + * @param[in] p_addr A random resolvable address. + * @param[in] p_irk An identity resolution key (IRK). + * + * @retval true The irk used matched the one used to create the address. + * @retval false The irk used did not match the one used to create the address, or an argument was + * NULL. + */ +bool im_address_resolve(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk); + +/**@brief Function for calculating the ah() hash function described in Bluetooth core specification + * 4.2 section 3.H.2.2.2. + * + * @detail BLE uses a hash function to calculate the first half of a resolvable address + * from the second half of the address and an irk. This function will use the ECB + * periferal to hash these data acording to the Bluetooth core specification. + * + * @note The ECB expect little endian input and output. + * This function expect big endian and will reverse the data as necessary. + * + * @param[in] p_k The key used in the hash function. + * For address resolution this is should be the irk. + * The array must have a length of 16. + * @param[in] p_r The rand used in the hash function. For generating a new address + * this would be a random number. For resolving a resolvable address + * this would be the last half of the address being resolved. + * The array must have a length of 3. + * @param[out] p_local_hash The result of the hash operation. For address resolution this + * will match the first half of the address being resolved if and only + * if the irk used in the hash function is the same one used to generate + * the address. + * The array must have a length of 16. + * + * @note ====IMPORTANT==== + * This is a special modification to the original nRF5x SDK required by the mbed BLE API + * to be able to generate BLE private resolvable addresses. This function is used by + * the BLE API implementation for nRF5xSecurityManager::getAddressFromBondTable() in the + * ble-nrf52832 yotta module. + * ================= + */ +void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash); + +/** @} + * @endcond + */ + +#endif /* PEER_ID_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.c new file mode 100644 index 0000000000..2282cc48d3 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "peer_data.h" + +#include "peer_manager_types.h" +#include "fds.h" +#include "sdk_common.h" + + +void peer_data_parts_get(pm_peer_data_const_t const * p_peer_data, fds_record_chunk_t * p_chunks, uint16_t * p_n_chunks) +{ + if (p_n_chunks == NULL) + { + } + else if ((p_peer_data == NULL) || (p_chunks == NULL)) + { + *p_n_chunks = 0; + } + else + { + p_chunks[0].p_data = p_peer_data->p_all_data; + p_chunks[0].length_words = p_peer_data->length_words; + *p_n_chunks = 1; + } +} + + +ret_code_t peer_data_deserialize(pm_peer_data_flash_t const * p_in_data, pm_peer_data_t * p_out_data) +{ + ret_code_t err_code = NRF_SUCCESS; + + if ((p_in_data == NULL) || (p_out_data == NULL)) + { + err_code = NRF_ERROR_NULL; + } + else + { + if (p_out_data->length_words < p_in_data->length_words) + { + p_out_data->length_words = p_in_data->length_words; + err_code = NRF_ERROR_NO_MEM; + } + else + { + p_out_data->length_words = p_in_data->length_words; + p_out_data->data_id = p_in_data->data_id; + + memcpy(p_out_data->p_all_data, p_in_data->p_all_data, p_in_data->length_words * 4); + } + } + return err_code; +} + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.h new file mode 100644 index 0000000000..3c1f373087 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef PEER_DATA_H__ +#define PEER_DATA_H__ + +#include +#include "peer_manager_types.h" +#include "peer_manager_internal.h" +#include "fds.h" + + +/** + * @cond NO_DOXYGEN + * @defgroup peer_data Peer Data + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. This module defines the structure of the data + * that is managed by the @ref peer_manager. It also provides functions for parsing the data. + */ + + +/**@brief Function for enumerating the separate (non-contiguous) parts of the peer data. + * + * @param[in] p_peer_data The peer data to enumerate. + * @param[out] p_chunks The resulting chunks. This must be an array of at least 2 elements. + * @param[out] p_n_chunks The number of chunks. If this is 0, something went wrong. + */ +void peer_data_parts_get(pm_peer_data_const_t const * p_peer_data, fds_record_chunk_t * p_chunks, uint16_t * p_n_chunks); + + +/**@brief Function for converting @ref pm_peer_data_flash_t into @ref pm_peer_data_t. + * + * @param[in] p_in_data The source data. + * @param[out] p_out_data The target data structure. + * + * @retval NRF_SUCCESS Successful conversion. + * @retval NRF_ERROR_NULL A parameter was NULL. + * @retval NRF_ERROR_NO_MEM A buffer was not large enough. + */ +ret_code_t peer_data_deserialize(pm_peer_data_flash_t const * p_in_data, pm_peer_data_t * p_out_data); + +/** @} + * @endcond + */ + +#endif /* PEER_DATA_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.c new file mode 100644 index 0000000000..1f4e05dd5b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.c @@ -0,0 +1,787 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "peer_data_storage.h" + +#include +#include +#include "sdk_errors.h" +#include "peer_manager_types.h" +#include "peer_manager_internal.h" +#include "peer_id.h" +#include "peer_data.h" +#include "fds.h" +#include "sdk_common.h" + + +// The number of user that can register with the module. +#define MAX_REGISTRANTS 6 + +// Macro for verifying that param is not zero. +#define VERIFY_PARAM_NOT_ZERO(param) \ +do \ +{ \ + if (param == 0) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + +// Macro for verifying that the peer id is within a valid range. +#define VERIFY_PEER_ID_IN_RANGE(id) \ +do \ +{ \ + if (id >= PM_PEER_ID_N_AVAILABLE_IDS) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } \ +} while (0) + + +// Macro for verifying that the peer data id is withing a valid range. +#define VERIFY_PEER_DATA_ID_IN_RANGE(id) \ +do \ +{ \ + if (!PM_PEER_DATA_ID_IS_VALID(id)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } \ +} while (0) + + +// Macro for initializing the peer ID tracking system if it is not already initialized. +#define PEER_IDS_INITIALIZE() \ +do \ +{ \ + if (!m_pds.peer_ids_initialized) \ + { \ + peer_ids_init(); \ + } \ +} while (0) + + +typedef struct +{ + bool peer_ids_initialized; + pds_evt_handler_t evt_handlers[MAX_REGISTRANTS]; + uint8_t n_registrants; + bool clearing; + bool clear_queued; +} pds_t; + + +static pds_t m_pds = { .n_registrants = 0 }; + + +#define MODULE_INITIALIZED (m_pds.n_registrants > 0) /**< Expression which is true when the module is initialized. */ +#include "sdk_macros.h" + +static void internal_state_reset(pds_t * p_pds) +{ + memset(p_pds, 0, sizeof(pds_t)); +} + + +// Function for dispatching outbound events to all registered event handlers. +static void pds_evt_send(pds_evt_t * p_event) +{ + for (uint32_t i = 0; i < m_pds.n_registrants; i++) + { + m_pds.evt_handlers[i](p_event); + } +} + + +// Function to convert peer IDs to file IDs. +static uint16_t peer_id_to_file_id(pm_peer_id_t peer_id) +{ + return (uint16_t)(peer_id + PEER_ID_TO_FILE_ID); +} + + +// Function to convert peer data id to type id. +static pm_peer_id_t file_id_to_peer_id(uint16_t file_id) +{ + return (pm_peer_id_t)(file_id + FILE_ID_TO_PEER_ID); +} + + +// Function to convert peer data IDs to record keys. +static uint16_t peer_data_id_to_record_key(pm_peer_data_id_t peer_data_id) +{ + return (uint16_t)peer_data_id + (uint16_t)PEER_DATA_ID_TO_RECORD_KEY; +} + + +// Function to convert record keys to peer data IDs. +static pm_peer_data_id_t record_key_to_peer_data_id(uint16_t record_key) +{ + return (pm_peer_data_id_t)(record_key + RECORD_KEY_TO_PEER_DATA_ID); +} + + +// Function for clearing all peer data of one peer. +// These operations will be sent to FDS one at a time. +static void peer_data_clear() +{ + ret_code_t retval; + uint16_t file_id; + fds_record_desc_t desc; + fds_find_token_t token = {0}; + pm_peer_id_t peer_id = peer_id_get_next_deleted(PM_PEER_ID_INVALID); + + while ( (peer_id != PM_PEER_ID_INVALID) + && (fds_record_find_in_file(peer_id_to_file_id(peer_id), &desc, &token) + == FDS_ERR_NOT_FOUND)) + { + peer_id_free(peer_id); + peer_id = peer_id_get_next_deleted(peer_id); + } + + if (!m_pds.clearing && (peer_id != PM_PEER_ID_INVALID)) + { + file_id = peer_id_to_file_id(peer_id); + retval = fds_file_delete(file_id); + + if (retval == FDS_SUCCESS) + { + m_pds.clearing = true; + } + else if (retval == FDS_ERR_NO_SPACE_IN_QUEUES) + { + m_pds.clear_queued = true; + } + else + { + pds_evt_t pds_evt; + + pds_evt.evt_id = PDS_EVT_ERROR_UNEXPECTED; + pds_evt.peer_id = peer_id; + pds_evt.data_id = PM_PEER_DATA_ID_INVALID; + pds_evt.store_token = PM_STORE_TOKEN_INVALID; + pds_evt.result = retval; + + pds_evt_send(&pds_evt); + } + } +} + + +static ret_code_t find_fds_item(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + fds_record_desc_t * const p_desc) +{ + fds_find_token_t find_tok = {0}; + + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PEER_DATA_ID_IN_RANGE(data_id); + // pp_record verified by caller. + + uint16_t file_id = peer_id_to_file_id(peer_id); + uint16_t record_key = peer_data_id_to_record_key(data_id); + + return fds_record_find(file_id, record_key, p_desc, &find_tok); +} + + +static void peer_ids_init() +{ + fds_record_desc_t record_desc; + fds_flash_record_t record; + fds_find_token_t find_tok = {0}; + + uint16_t const record_key = peer_data_id_to_record_key(PM_PEER_DATA_ID_BONDING); + + if (!m_pds.peer_ids_initialized) + { + while(fds_record_find_by_key(record_key, &record_desc, &find_tok) == FDS_SUCCESS) + { + pm_peer_id_t peer_id; + + // It is safe to ignore the return value since we just obtained + // this descriptor and also 'record' is different from NULL. + (void)fds_record_open(&record_desc, &record); + peer_id = file_id_to_peer_id(record.p_header->ic.file_id); + (void)fds_record_close(&record_desc); + + (void)peer_id_allocate(peer_id); + } + + m_pds.peer_ids_initialized = true; + } +} + + +static void fds_evt_handler(fds_evt_t const * const p_fds_evt) +{ + pds_evt_t pds_evt; + bool send_event = true; + + pds_evt.result = (p_fds_evt->result == FDS_SUCCESS); + + switch(p_fds_evt->id) + { + case FDS_EVT_WRITE: + pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_STORED : + PDS_EVT_ERROR_STORE; + + pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->write.file_id); + pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->write.record_key); + pds_evt.result = p_fds_evt->result; + pds_evt.store_token = p_fds_evt->write.record_id; + break; + + case FDS_EVT_UPDATE: + pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_UPDATED : + PDS_EVT_ERROR_UPDATE; + + pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->write.file_id); + pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->write.record_key); + pds_evt.result = p_fds_evt->result; + pds_evt.store_token = p_fds_evt->write.record_id; + break; + + case FDS_EVT_DEL_RECORD: + pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_CLEARED : + PDS_EVT_ERROR_CLEAR; + + pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->del.file_id); + pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->del.record_key); + pds_evt.store_token = p_fds_evt->del.record_id; + break; + + case FDS_EVT_DEL_FILE: + { + if ((p_fds_evt->del.record_key == FDS_RECORD_KEY_DIRTY) && + (p_fds_evt->del.file_id != FDS_FILE_ID_INVALID)) + { + pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->del.file_id); + pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->del.record_key); + + pds_evt.data_id = PM_PEER_DATA_ID_INVALID; + if (p_fds_evt->result == FDS_SUCCESS) + { + pds_evt.evt_id = PDS_EVT_PEER_ID_CLEAR; + peer_id_free(pds_evt.peer_id); + } + else + { + pds_evt.evt_id = PDS_EVT_ERROR_PEER_ID_CLEAR; + } + m_pds.clearing = false; + m_pds.clear_queued = false; + + peer_data_clear(); + } + } + break; + + case FDS_EVT_GC: + pds_evt.evt_id = PDS_EVT_COMPRESSED; + break; + + default: + send_event = false; + break; + } + + if (send_event) + { + pds_evt_send(&pds_evt); + } + + if (m_pds.clear_queued) + { + m_pds.clear_queued = false; + peer_data_clear(); + } +} + + +ret_code_t pds_register(pds_evt_handler_t evt_handler) +{ + if (m_pds.n_registrants >= MAX_REGISTRANTS) + { + return NRF_ERROR_NO_MEM; + } + + VERIFY_PARAM_NOT_NULL(evt_handler); + + if (!MODULE_INITIALIZED) + { + ret_code_t retval; + internal_state_reset(&m_pds); + peer_id_init(); + + retval = fds_register(fds_evt_handler); + if (retval != FDS_SUCCESS) + { + return NRF_ERROR_NO_MEM; + } + + retval = fds_init(); + if (retval != FDS_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + } + + m_pds.evt_handlers[m_pds.n_registrants] = evt_handler; + m_pds.n_registrants += 1; + + return NRF_SUCCESS; +} + + +ret_code_t pds_peer_data_read_ptr_get(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_flash_t * p_data, + pm_store_token_t * p_token) +{ + ret_code_t retval; + + fds_flash_record_t record; + fds_record_desc_t record_desc; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PEER_DATA_ID_IN_RANGE(data_id); + VERIFY_PARAM_NOT_NULL(p_data); + + retval = find_fds_item(peer_id, data_id, &record_desc); + if (retval != FDS_SUCCESS) + { + return NRF_ERROR_NOT_FOUND; + } + + // Shouldn't fail, unless the record was deleted. + (void)fds_record_open(&record_desc, &record); + + if (p_data != NULL) + { + p_data->data_id = data_id; + p_data->length_words = record.p_header->tl.length_words; + p_data->p_all_data = record.p_data; + } + + if (p_token != NULL) + { + *p_token = (uint32_t)record.p_header->record_id; + } + + // Shouldn't fail, unless the record was already closed. + (void)fds_record_close(&record_desc); + + return NRF_SUCCESS; +} + + +ret_code_t pds_peer_data_lock(pm_store_token_t store_token) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_ZERO(store_token); + + // TODO: Not implemented in fds yet. + + return NRF_SUCCESS; +} + + +ret_code_t pds_peer_data_verify(pm_store_token_t store_token) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_ZERO(store_token); + + // TODO: Not implemented in fds yet. + + return NRF_SUCCESS; +} + + +ret_code_t pds_peer_data_read(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_t * p_data, + uint16_t * p_len_words) +{ + ret_code_t retval; + pm_peer_data_flash_t peer_data_flash; + + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PEER_DATA_ID_IN_RANGE(data_id); + VERIFY_PARAM_NOT_NULL(p_len_words); + VERIFY_PARAM_NOT_NULL(p_data); + + retval = pds_peer_data_read_ptr_get(peer_id, data_id, &peer_data_flash, NULL); + if (retval != NRF_SUCCESS) + { + return retval; + } + + if ((*p_len_words) == 0) + { + (*p_len_words) = peer_data_flash.length_words; + return NRF_SUCCESS; + } + else if ((*p_len_words) < peer_data_flash.length_words) + { + return NRF_ERROR_NO_MEM; + } + + VERIFY_PARAM_NOT_NULL(p_data->p_all_data); + + retval = peer_data_deserialize(&peer_data_flash, p_data); + + return retval; +} + + +ret_code_t pds_peer_data_write_prepare(pm_peer_data_const_t const * p_peer_data, + pm_prepare_token_t * p_prepare_token) +{ + ret_code_t retval; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_peer_data); + VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id); + //VERIFY_PARAM_NOT_NULL(p_prepare_token); redundant, see fds_reserve(). + + retval = fds_reserve((fds_reserve_token_t*)p_prepare_token, p_peer_data->length_words); + + switch (retval) + { + case FDS_SUCCESS: + return NRF_SUCCESS; + + case FDS_ERR_NULL_ARG: + return NRF_ERROR_NULL; + + case FDS_ERR_RECORD_TOO_LARGE: + return NRF_ERROR_INVALID_LENGTH; + + case FDS_ERR_NO_SPACE_IN_FLASH: + return NRF_ERROR_NO_MEM; + + default: + return NRF_ERROR_INTERNAL; + } +} + + +ret_code_t pds_peer_data_write_prepare_cancel(pm_prepare_token_t prepare_token) +{ + ret_code_t retval; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_ZERO(prepare_token); + + retval = fds_reserve_cancel((fds_reserve_token_t*)&prepare_token); + + switch (retval) + { + case FDS_SUCCESS: + return NRF_SUCCESS; + + case FDS_ERR_NULL_ARG: + return NRF_ERROR_NULL; + + default: + return NRF_ERROR_INTERNAL; + } +} + + +ret_code_t pds_peer_data_write_prepared(pm_peer_id_t peer_id, + pm_peer_data_const_t const * p_peer_data, + pm_prepare_token_t prepare_token, + pm_store_token_t * p_store_token) +{ + ret_code_t retval; + fds_record_t record; + fds_record_desc_t record_desc; + fds_record_chunk_t chunks[2]; + uint16_t n_chunks; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PARAM_NOT_NULL(p_peer_data); + VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id); + VERIFY_PARAM_NOT_ZERO(prepare_token); + + // Create chunks. + peer_data_parts_get(p_peer_data, chunks, &n_chunks); + + // Prepare the record to be written. + record.file_id = peer_id_to_file_id(peer_id); + record.key = peer_data_id_to_record_key(p_peer_data->data_id); + record.data.p_chunks = chunks; + record.data.num_chunks = n_chunks; + + retval = fds_record_write_reserved(&record_desc, + &record, + (fds_reserve_token_t*)&prepare_token); + + if ((retval == FDS_SUCCESS) && (p_store_token != NULL)) + { + // If fds_record_write_reserved() returned sucessfully, it is safe + // to ignore the return value from fds_record_id_from_desc() since + // the descriptor is valid, and also p_store_token is different from NULL. + (void)fds_record_id_from_desc(&record_desc, (uint32_t*)p_store_token); + } + + switch (retval) + { + case FDS_SUCCESS: + return NRF_SUCCESS; + + case FDS_ERR_BUSY: + case FDS_ERR_NO_SPACE_IN_QUEUES: + return NRF_ERROR_BUSY; + + default: + return NRF_ERROR_INTERNAL; + } +} + + +ret_code_t pds_peer_data_write(pm_peer_id_t peer_id, + pm_peer_data_const_t const * p_peer_data, + pm_store_token_t * p_store_token) +{ + ret_code_t retval; + fds_record_t record; + fds_record_desc_t record_desc; + fds_record_chunk_t chunks[2]; + uint16_t n_chunks; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PARAM_NOT_NULL(p_peer_data); + VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id); + + // Create chunks. + peer_data_parts_get(p_peer_data, chunks, &n_chunks); + + // Prepare the record to be written. + record.file_id = peer_id_to_file_id(peer_id); + record.key = peer_data_id_to_record_key(p_peer_data->data_id); + record.data.p_chunks = chunks; + record.data.num_chunks = n_chunks; + + retval = fds_record_write(&record_desc, &record); + + if ((retval == FDS_SUCCESS) && (p_store_token != NULL)) + { + // If fds_record_write() returned sucessfully, it is safe + // to ignore the return value from fds_record_id_from_desc() since + // the descriptor is valid, and also p_store_token is different from NULL. + (void)fds_record_id_from_desc(&record_desc, (uint32_t*)p_store_token); + } + + switch (retval) + { + case FDS_SUCCESS: + return NRF_SUCCESS; + + case FDS_ERR_BUSY: + case FDS_ERR_NO_SPACE_IN_QUEUES: + return NRF_ERROR_BUSY; + + case FDS_ERR_NO_SPACE_IN_FLASH: + return NRF_ERROR_NO_MEM; + + default: + return NRF_ERROR_INTERNAL; + } +} + + +ret_code_t pds_peer_data_update(pm_peer_id_t peer_id, + pm_peer_data_const_t const * p_peer_data, + pm_store_token_t old_token, + pm_store_token_t * p_store_token) +{ + ret_code_t retval; + fds_record_t record; + fds_record_desc_t record_desc; + fds_record_chunk_t chunks[2]; + uint16_t n_chunks; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PARAM_NOT_NULL(p_peer_data); + VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id); + + // Create chunks. + peer_data_parts_get(p_peer_data, chunks, &n_chunks); + + // Prepare the record to be written. + record.file_id = peer_id_to_file_id(peer_id); + record.key = peer_data_id_to_record_key(p_peer_data->data_id); + record.data.p_chunks = chunks; + record.data.num_chunks = n_chunks; + + // Obtain the descriptor of the record to be updated. + // It is safe to ignore the return value if record_desc is different from NULL. + (void)fds_descriptor_from_rec_id(&record_desc, (uint32_t)old_token); + + retval = fds_record_update(&record_desc, &record); + + if ((retval == FDS_SUCCESS) && (p_store_token != NULL)) + { + // If fds_record_update() returned sucessfully, it is safe + // to ignore the return value from fds_record_id_from_desc() since + // the descriptor is valid, and also p_store_token is different from NULL. + (void)fds_record_id_from_desc(&record_desc, (uint32_t*)p_store_token); + } + + switch (retval) + { + case FDS_SUCCESS: + return NRF_SUCCESS; + + case FDS_ERR_BUSY: + case FDS_ERR_NO_SPACE_IN_QUEUES: + return NRF_ERROR_BUSY; + + case FDS_ERR_NO_SPACE_IN_FLASH: + return NRF_ERROR_NO_MEM; + + default: + return NRF_ERROR_INTERNAL; + } +} + +ret_code_t pds_peer_data_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) +{ + ret_code_t retval; + uint16_t file_id; + uint16_t record_key; + fds_record_desc_t record_desc; + fds_find_token_t find_tok = {0}; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PEER_DATA_ID_IN_RANGE(data_id); + + file_id = peer_id_to_file_id(peer_id); + record_key = peer_data_id_to_record_key(data_id); + + retval = fds_record_find(file_id, record_key, &record_desc, &find_tok); + if(retval != FDS_SUCCESS) + { + return NRF_ERROR_NOT_FOUND; + } + + retval = fds_record_delete(&record_desc); + + switch (retval) + { + case FDS_SUCCESS: + return NRF_SUCCESS; + + case FDS_ERR_NO_SPACE_IN_QUEUES: + return NRF_ERROR_BUSY; + + default: + return NRF_ERROR_INTERNAL; + } +} + + +pm_peer_id_t pds_peer_id_allocate(void) +{ + if (!MODULE_INITIALIZED) + { + return PM_PEER_ID_INVALID; + } + PEER_IDS_INITIALIZE(); + return peer_id_allocate(PM_PEER_ID_INVALID); +} + + +ret_code_t pds_peer_id_free(pm_peer_id_t peer_id) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + PEER_IDS_INITIALIZE(); + + (void)peer_id_delete(peer_id); + peer_data_clear(); + + return NRF_SUCCESS; +} + + +bool pds_peer_id_is_allocated(pm_peer_id_t peer_id) +{ + if (!MODULE_INITIALIZED) + { + return false; + } + PEER_IDS_INITIALIZE(); + + return peer_id_is_allocated(peer_id); +} + + +pm_peer_id_t pds_next_peer_id_get(pm_peer_id_t prev_peer_id) +{ + if (!MODULE_INITIALIZED) + { + return PM_PEER_ID_INVALID; + } + PEER_IDS_INITIALIZE(); + + return peer_id_get_next_used(prev_peer_id); +} + + +uint32_t pds_n_peers(void) +{ + if (!MODULE_INITIALIZED) + { + return 0; + } + PEER_IDS_INITIALIZE(); + return peer_id_n_ids(); +} + +//lint -restore diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.h new file mode 100644 index 0000000000..42dcacd69c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.h @@ -0,0 +1,381 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef PEER_DATA_STORAGE_H__ +#define PEER_DATA_STORAGE_H__ + + +#include +#include "sdk_errors.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" +#include "peer_manager_internal.h" + + +/** + * @cond NO_DOXYGEN + * @defgroup peer_data_storage Peer Data Storage + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. This module provides a Peer Manager-specific API + * to the persistent storage. + */ + +#define PDS_PREPARE_TOKEN_INVALID 0 /**< Invalid value for prepare token. */ + +enum +{ + PEER_ID_TO_FILE_ID = 0xC000, + FILE_ID_TO_PEER_ID = -PEER_ID_TO_FILE_ID, + PEER_DATA_ID_TO_RECORD_KEY = 0xC000, + RECORD_KEY_TO_PEER_DATA_ID = -PEER_DATA_ID_TO_RECORD_KEY, +}; + + +/**@brief The types of events that can come from the peer_data_storage module. + */ +typedef enum +{ + PDS_EVT_STORED, /**< The specified data has been successfully stored. */ + PDS_EVT_UPDATED, /**< The specified data has been successfully updated. */ + PDS_EVT_CLEARED, /**< The specified data has been successfully cleared. */ + PDS_EVT_ERROR_STORE, /**< The specified data could not be stored. */ + PDS_EVT_ERROR_UPDATE, /**< The specified data could not be updated. */ + PDS_EVT_ERROR_CLEAR, /**< The specified data could not be cleared. */ + PDS_EVT_PEER_ID_CLEAR, /**< The peer id has been successfully cleared. */ + PDS_EVT_ERROR_PEER_ID_CLEAR, /**< The peer id has been successfully cleared. */ + PDS_EVT_COMPRESSED, /**< A compress procedure has finished successfully. */ + PDS_EVT_ERROR_UNEXPECTED, /**< An unexpected, possibly fatal error occurred. The unexpected error is included in the event structure. */ +} pds_evt_id_t; + + +/**@brief Events that can come from the peer_data_storage module. + */ +typedef struct +{ + pds_evt_id_t evt_id; /**< The type of event. */ + pm_peer_id_t peer_id; /**< The peer the event pertains to. */ + pm_peer_data_id_t data_id; /**< The data the event pertains to. */ + pm_store_token_t store_token; /**< A unique identifier for the operation. Can be compare to the token received when starting the operation. */ + ret_code_t result; /**< The result of the operation, or the unexpected error. */ +} pds_evt_t; + + +/**@brief Event handler for events from the peer_data_storage module. + * + * @param[in] event The event that has happened. + * @param[in] peer_id The id of the peer the event pertains to. + * @param[in] flags The data the event pertains to. + */ +typedef void (*pds_evt_handler_t)(pds_evt_t const * p_event); + + +/**@brief Function for registering for events from the peer database. + * + * @note This function will initialize the module if it is not already initialized. + * + * @param[in] evt_handler Event handler to register. + * + * @retval NRF_SUCCESS Registration successful. + * @retval NRF_ERROR_NO_MEM No more event handlers can be registered. + * @retval NRF_ERROR_NULL evt_handler was NULL. + * @retval NRF_ERROR_INTERNAL An unexpected error happened. + * @retval NRF_ERROR_INTERNAL Unexpected error. + */ +ret_code_t pds_register(pds_evt_handler_t evt_handler); + + +/**@brief Function for retrieving a direct pointer to peer data in persistent storage. + * + * @param[in] peer_id The id of the peer whose data to read. + * @param[in] data_id Which data to get. + * @param[out] p_data The peer data pointer. + * @param[out] p_token Token that can be used to lock data in flash and check data validity. + * + * @retval NRF_SUCCESS The pointer was successfully retrieved. + * @retval NRF_ERROR_INVALID_PARAM Invalid data_id. + * @retval NRF_ERROR_NOT_FOUND The requested data was not found in persistent storage. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pds_peer_data_read_ptr_get(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_flash_t * p_data, + pm_store_token_t * p_token); + + +#if 0 +// @TODO: Finish documentation +/**@brief Function to lock the flash data (to defer compression from invalidating data) + * + * @param[in] store_token The token representing the item to lock + * + * @retval NRF_SUCCESS Successfully locked + */ +ret_code_t pds_peer_data_lock(pm_store_token_t store_token); + + +/**@brief Function to verify flash data integrity + * + * @param[in] store_token The token representing the item to lock + * + * @retval NRF_SUCCESS The data integrity is valid. + * @retval NRF_ERROR_NULL The token is invalid. + * @retval NRF_ERROR_INVALID_DATA The data integrity is not valid. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pds_peer_data_verify(pm_store_token_t store_token); +#endif + + +/**@brief Function for retrieving peer data from persistent storage by making a copy. + * + * @param[in] peer_id The id of the peer whose data to read. + * @param[in] data_id Which piece of data to read. + * @param[out] p_data Pointer to the peer data. + * @param[in,out] p_len_words Length available to copy to (in words). + * If set to NULL, then no copy will be made and the + * length will be reflected in p_len_words after the call returns. + * + * @retval NRF_SUCCESS The read was successful. + * @retval NRF_ERROR_INVALID_PARAM Invalid data_id or peer_id. + * @retval NRF_ERROR_NULL Either \c p_data or \c p_len_words were \c NULL, or \c p_data + * contained a NULL pointer. + * @retval NRF_ERROR_NOT_FOUND The requested data was not found in persistent storage. + * @retval NRF_ERROR_NO_MEM The length of stored data too large to copy out. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pds_peer_data_read(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_t * p_data, + uint16_t * p_len_words); + + +/**@brief Function for preparing persistent storage for a write. + * + * @details If this call succeeds, space is reserved in persistent storage, so the write will fit. + * + * @note If space has already been prepared for this peer_id/data_id pair, no new space will be + * reserved, unless the previous reservation had too small size. + * + * @param[in] p_peer_data Data to prepare for. The data needs not be ready, but length and type + * values must. + * @param[out] p_prepare_token A token identifying the prepared memory area. + * + * @retval NRF_SUCCESS The call was successful. + * @retval NRF_ERROR_NULL Either \c p_peer_data or \c p_prepare code were \c NULL. + * @retval NRF_ERROR_INVALID_PARAM Invalid data ID. + * @retval NRF_ERROR_INVALID_LENGTH Data length exceeds the maximum length allowed. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Internal error. + */ +ret_code_t pds_peer_data_write_prepare(pm_peer_data_const_t const * p_peer_data, + pm_prepare_token_t * p_prepare_token); + + +/**@brief Function for undoing a previous call to @ref pds_peer_data_write_prepare. + * + * @param[in] prepare_token A token identifying the prepared memory area to cancel. + * + * @retval NRF_SUCCESS The call was successful. + * @retval NRF_ERROR_NULL Invalid value for \c prepare_token. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Internal error. + */ +ret_code_t pds_peer_data_write_prepare_cancel(pm_prepare_token_t prepare_token); + + +/**@brief Function for writing prepared (reserved) peer data to persistent storage. + * + * @details Writing happens asynchronously. Expect a @ref PDS_EVT_STORED or @ref PDS_EVT_ERROR_STORE + * event. + * + * @param[in] peer_id The id of the peer the data pertains to. + * @param[in] p_peer_data The peer data. + * @param[in] prepare_token A token identifying the prepared memory area to write into. If + * the prepare token is invalid, e.g. PDS_PREPARE_TOKEN_INVALID, the + * prepare/write sequence will happen atomically. + * @param[out] p_store_token A token identifying this particular store operation. The token can be + * used to identify events pertaining to this operation. + * + * @retval NRF_SUCCESS The write was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM Invalid peer ID or data ID. + * @retval NRF_ERROR_NULL \c p_peer_data was \c NULL or contained a \c NULL pointer or + * \c prepare_token was zero. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. This can only happen + * if \c p_prepare_token is \c NULL. + * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any + * more requests. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Internal error. + */ +ret_code_t pds_peer_data_write_prepared(pm_peer_id_t peer_id, + pm_peer_data_const_t const * p_peer_data, + pm_prepare_token_t prepare_token, + pm_store_token_t * p_store_token); + + +/**@brief Function for writing peer data to persistent storage. + * + * @details Writing happens asynchronously. Expect a @ref PDS_EVT_STORED or @ref PDS_EVT_ERROR_STORE + * event. + * + * @param[in] peer_id The id of the peer the data pertains to. + * @param[in] p_peer_data The peer data. + * @param[out] p_store_token A token identifying this particular store operation. The token can be + * used to identify events pertaining to this operation. + * + * @retval NRF_SUCCESS The write was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM Invalid data ID or peer ID. + * @retval NRF_ERROR_NULL \c p_peer_data was \c NULL or data contained a \c NULL pointer. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. + * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any + * more requests. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Internal error. + */ +ret_code_t pds_peer_data_write(pm_peer_id_t peer_id, + pm_peer_data_const_t const * p_peer_data, + pm_store_token_t * p_store_token); + + +/**@brief Function for updating currently stored peer data to a new version + * + * @details Updating happens asynchronously. + * Expect a @ref PDS_EVT_STORED or @ref PDS_EVT_ERROR_STORE for the store token + * and a @ref PDS_EVT_ERROR_CLEAR or @ref PDS_EVT_ERROR_CLEAR for the old token + * + * @param[in] peer_id The peer which the data is associated to. + * @param[in] p_peer_data New data. + * @param[in] old_token Store token for the old data. + * @param[out] p_store_token Store token for the new data. + * + * @retval NRF_SUCESS The update was initiated successfully + * @retval NRF_ERROR_NULL \c p_peer_data was \c NULL or data contained a \c NULL pointer. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. + * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any + * more requests at this moment. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Internal error. + */ +ret_code_t pds_peer_data_update(pm_peer_id_t peer_id, + pm_peer_data_const_t const * p_peer_data, + pm_store_token_t old_token, + pm_store_token_t * p_store_token); + + +/**@brief Function for clearing peer data from persistent storage. + * + * @details Clearing happens asynchronously. Expect a @ref PDS_EVT_CLEARED or @ref PDS_EVT_ERROR_CLEAR + * event. + * + * @param[in] peer_id The id of the peer the data pertains to. + * @param[in] data_id Which data to clear. + * + * @retval NRF_SUCCESS The clear was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM Data ID or peer ID was invalid. + * @retval NRF_ERROR_NOT_FOUND Nothing to clear for this peer ID. + * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any + * more requests at this moment. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Internal error. + */ +ret_code_t pds_peer_data_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); + + +/**@brief Function for claiming an unused peer ID. + * + * @return The first unused peer ID. + * @retval PM_PEER_ID_INVALID If no peer ID is available or module is not initialized. + */ +pm_peer_id_t pds_peer_id_allocate(void); + + +/**@brief Function for freeing a peer ID and clearing all data associated with it in persistent + * storage. + * + * @param[in] peer_id Peer ID to free. + * + * @retval NRF_SUCCESS The clear was initiated successfully. + * @retval NRF_ERROR_INVALID_STATE Module not initialized. + * @retval NRF_ERROR_INVALID_PARAM Invalid peer ID. + */ +ret_code_t pds_peer_id_free(pm_peer_id_t peer_id); + + +/**@brief Function for finding out whether a peer ID is in use. + * + * @param[in] peer_id The peer ID to inquire about. + * + * @retval true peer_id is in use. + * @retval false peer_id is free, or the module is not initialized. + */ +bool pds_peer_id_is_allocated(pm_peer_id_t peer_id); + + +/**@brief Function for getting the next peer ID in the sequence of all used peer IDs. Can be + * used to loop through all used peer IDs. + * + * @note @ref PM_PEER_ID_INVALID is considered to be before the first and after the last ordinary + * peer ID. + * + * @param[in] prev_peer_id The previous peer ID. + * + * @return The next peer ID. + * @return The first ordinary peer ID if prev_peer_id was @ref PM_PEER_ID_INVALID. + * @retval PM_PEER_ID_INVALID if prev_peer_id was the last ordinary peer ID or the module + * is not initialized. + */ +pm_peer_id_t pds_next_peer_id_get(pm_peer_id_t prev_peer_id); + + +/**@brief Function for querying the number of valid peer IDs available. I.E the number of peers + * in persistent storage. + * + * @return The number of valid peer IDs, or 0 if module is not initialized. + */ +uint32_t pds_n_peers(void); + + +/** @} + * @endcond + */ + +#endif /* PEER_DATA_STORAGE_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.c new file mode 100644 index 0000000000..fd6c30193d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.c @@ -0,0 +1,804 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "peer_database.h" + +#include +#include "app_util.h" +#include "peer_manager_types.h" +#include "peer_manager_internal.h" +#include "peer_data_storage.h" +#include "pm_buffer.h" +#include "sdk_common.h" + +#define MAX_REGISTRANTS 6 /**< The number of user that can register with the module. */ + +#define N_WRITE_BUFFERS 8 /**< The number of write buffers available. */ +#define N_WRITE_BUFFER_RECORDS (N_WRITE_BUFFERS) /**< The number of write buffer records. */ + +/**@brief Macro for verifying that the data ID is among the values eligible for using the write buffer. + * + * @param[in] data_id The data ID to verify. + */ +#define VERIFY_DATA_ID_WRITE_BUF(data_id) \ +do \ +{ \ + if (((data_id) != PM_PEER_DATA_ID_BONDING) && ((data_id) != PM_PEER_DATA_ID_GATT_LOCAL)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } \ +} while(0) + + +/**@brief Struct for keeping track of one write buffer, from allocation, until it is fully written + * or cancelled. + */ +typedef struct +{ + pm_peer_id_t peer_id; /**< The peer ID this buffer belongs to. */ + pm_peer_data_id_t data_id; /**< The data ID this buffer belongs to. */ + uint8_t buffer_block_id; /**< The index of the first (or only) buffer block containing peer data. */ + uint32_t n_bufs; /**< The number of buffer blocks containing peer data. */ + uint8_t store_busy : 1; /**< Flag indicating that the buffer was attempted written to flash, but a busy error was returned and the operation should be retried. */ + uint8_t store_flash_full : 1; /**< Flag indicating that the buffer was attempted written to flash, but a flash full error was returned and the operation should be retried after room has been made. */ + uint8_t store_requested : 1; /**< Flag indicating that the buffer is being written to flash. */ + pm_prepare_token_t prepare_token; /**< Token given by Peer Data Storage if room in flash has been reserved. */ + pm_store_token_t store_token; /**< Token given by Peer Data Storage when a flash write has been successfully requested. */ +} pdb_buffer_record_t; + +/**@brief Struct for keeping track of the state of the module. + */ +typedef struct +{ + pdb_evt_handler_t evt_handlers[MAX_REGISTRANTS]; /**< All registered event handlers. */ + uint8_t n_registrants; /**< The number of registered event handlers. */ + pm_buffer_t write_buffer; /**< The state of the write buffer. */ + pdb_buffer_record_t write_buffer_records[N_WRITE_BUFFER_RECORDS]; /**< The available write buffer records. */ + uint32_t n_writes; /**< The number of pending (Not yet successfully requested in Peer Data Storage) store operations. */ +} pdb_t; + +static pdb_t m_pdb = {.n_registrants = 0}; /**< The state of the module. */ + +#define MODULE_INITIALIZED (m_pdb.n_registrants > 0) /**< Expression which is true when the module is initialized. */ +#include "sdk_macros.h" + +/**@brief Function for invalidating a record of a write buffer allocation. + * + * @param[in] p_record The record to invalidate. + */ +static void write_buffer_record_invalidate(pdb_buffer_record_t * p_record) +{ + p_record->peer_id = PM_PEER_ID_INVALID; + p_record->data_id = PM_PEER_DATA_ID_INVALID; + p_record->buffer_block_id = BUFFER_INVALID_ID; + p_record->store_busy = false; + p_record->store_flash_full = false; + p_record->store_requested = false; + p_record->n_bufs = 0; + p_record->prepare_token = PDS_PREPARE_TOKEN_INVALID; + p_record->store_token = PM_STORE_TOKEN_INVALID; +} + + +/**@brief Function for finding a record of a write buffer allocation. + * + * @param[in] peer_id The peer ID in the record. + * @param[inout] p_index In: The starting index, out: The index of the record + * + * @return A pointer to the matching record, or NULL if none was found. + */ +static pdb_buffer_record_t * write_buffer_record_find_next(pm_peer_id_t peer_id, int * p_index) +{ + for (uint32_t i = *p_index; i < N_WRITE_BUFFER_RECORDS; i++) + { + if ((m_pdb.write_buffer_records[i].peer_id == peer_id)) + { + return &m_pdb.write_buffer_records[i]; + } + } + return NULL; +} + + +/**@brief Function for finding a record of a write buffer allocation. + * + * @param[in] peer_id The peer ID in the record. + * @param[in] data_id The data ID in the record. + * + * @return A pointer to the matching record, or NULL if none was found. + */ +static pdb_buffer_record_t * write_buffer_record_find(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id) +{ + int index = 0; + pdb_buffer_record_t * p_record = write_buffer_record_find_next(peer_id, &index); + + while ((p_record != NULL) && (p_record->data_id != data_id)) + { + index++; + p_record = write_buffer_record_find_next(peer_id, &index); + } + + return p_record; +} + + +/**@brief Function for finding an available record for write buffer allocation. + * + * @return A pointer to the available record, or NULL if none was found. + */ +static pdb_buffer_record_t * write_buffer_record_find_unused(void) +{ + return write_buffer_record_find(PM_PEER_ID_INVALID, PM_PEER_DATA_ID_INVALID); +} + + +/**@brief Function for gracefully deactivating a write buffer record. + * + * @details This function will first release any buffers, then invalidate the record. + * + * @param[inout] p_write_buffer_record The record to release. + * + * @return A pointer to the matching record, or NULL if none was found. + */ +static void write_buffer_record_release(pdb_buffer_record_t * p_write_buffer_record) +{ + for (uint32_t i = 0; i < p_write_buffer_record->n_bufs; i++) + { + pm_buffer_release(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id + i); + } + + write_buffer_record_invalidate(p_write_buffer_record); +} + + +/**@brief Function for claiming and activating a write buffer record. + * + * @param[out] pp_write_buffer_record The claimed record. + * @param[in] peer_id The peer ID this record should have. + * @param[in] data_id The data ID this record should have. + */ +static void write_buffer_record_get(pdb_buffer_record_t ** pp_write_buffer_record, pm_peer_id_t peer_id, pm_peer_data_id_t data_id) +{ + if (pp_write_buffer_record == NULL) + { + return; + } + *pp_write_buffer_record = write_buffer_record_find_unused(); + if (*pp_write_buffer_record == NULL) + { + // This also means the buffer is full. + return; + } + (*pp_write_buffer_record)->peer_id = peer_id; + (*pp_write_buffer_record)->data_id = data_id; +} + + +/**@brief Function for dispatching outbound events to all registered event handlers. + * + * @param[in] p_event The event to dispatch. + */ +static void pdb_evt_send(pdb_evt_t * p_event) +{ + for (uint32_t i = 0; i < m_pdb.n_registrants; i++) + { + m_pdb.evt_handlers[i](p_event); + } +} + + +/**@brief Function for resetting the internal state of the Peer Database module. + * + * @param[out] p_event The event to dispatch. + */ +static void internal_state_reset(pdb_t * pdb) +{ + memset(pdb, 0, sizeof(pdb_t)); + for (uint32_t i = 0; i < N_WRITE_BUFFER_RECORDS; i++) + { + write_buffer_record_invalidate(&pdb->write_buffer_records[i]); + } +} + + +/**@brief Function for handling events from the Peer Data Storage module. + * + * @param[in] p_event The event to handle. + */ +static void pds_evt_handler(pds_evt_t const * p_event) +{ + ret_code_t err_code; + pdb_buffer_record_t * p_write_buffer_record; + bool retry_flash_full = false; + pdb_evt_t event = + { + .peer_id = p_event->peer_id, + .data_id = p_event->data_id, + }; + + p_write_buffer_record = write_buffer_record_find(p_event->peer_id, p_event->data_id); + + switch (p_event->evt_id) + { + case PDS_EVT_STORED: + case PDS_EVT_UPDATED: + if ( (p_write_buffer_record != NULL) + //&& (p_write_buffer_record->store_token == p_event->store_token) + && (p_write_buffer_record->store_requested)) + { + write_buffer_record_release(p_write_buffer_record); + event.evt_id = PDB_EVT_WRITE_BUF_STORED; + event.params.write_buf_stored_evt.update = (p_event->evt_id == PDS_EVT_UPDATED); + pdb_evt_send(&event); + } + else + { + event.evt_id = PDB_EVT_RAW_STORED; + event.params.raw_stored_evt.store_token = p_event->store_token; + pdb_evt_send(&event); + } + break; + case PDS_EVT_ERROR_STORE: + case PDS_EVT_ERROR_UPDATE: + if ( (p_write_buffer_record != NULL) + && (p_write_buffer_record->store_token == p_event->store_token) + && (p_write_buffer_record->store_requested)) + { + // Retry if internal buffer. + m_pdb.n_writes++; + p_write_buffer_record->store_requested = false; + p_write_buffer_record->store_busy = true; + } + else + { + event.evt_id = PDB_EVT_RAW_STORE_FAILED; + event.params.error_raw_store_evt.err_code = p_event->result; + pdb_evt_send(&event); + } + break; + case PDS_EVT_CLEARED: + event.evt_id = PDB_EVT_CLEARED; + pdb_evt_send(&event); + break; + case PDS_EVT_ERROR_CLEAR: + event.evt_id = PDB_EVT_CLEAR_FAILED; + event.params.clear_failed_evt.err_code = p_event->result; + pdb_evt_send(&event); + break; + case PDS_EVT_PEER_ID_CLEAR: + event.evt_id = PDB_EVT_PEER_FREED; + pdb_evt_send(&event); + break; + case PDS_EVT_ERROR_PEER_ID_CLEAR: + event.evt_id = PDB_EVT_PEER_FREE_FAILED; + event.params.peer_free_failed_evt.err_code = p_event->result; + pdb_evt_send(&event); + break; + case PDS_EVT_COMPRESSED: + retry_flash_full = true; + event.evt_id = PDB_EVT_COMPRESSED; + pdb_evt_send(&event); + break; + case PDS_EVT_ERROR_UNEXPECTED: + event.params.error_unexpected.err_code = p_event->result; + break; + default: + break; + } + + if (m_pdb.n_writes > 0) + { + for (uint32_t i = 0; i < N_WRITE_BUFFER_RECORDS; i++) + { + if ((m_pdb.write_buffer_records[i].store_busy) + || (m_pdb.write_buffer_records[i].store_flash_full && retry_flash_full)) + { + err_code = pdb_write_buf_store(m_pdb.write_buffer_records[i].peer_id, + m_pdb.write_buffer_records[i].data_id); + if (err_code != NRF_SUCCESS) + { + event.peer_id = m_pdb.write_buffer_records[i].peer_id; + event.data_id = m_pdb.write_buffer_records[i].data_id; + if (err_code == NRF_ERROR_NO_MEM) + { + event.evt_id = PDB_EVT_ERROR_NO_MEM; + } + else + { + event.evt_id = PDB_EVT_ERROR_UNEXPECTED; + event.params.error_unexpected.err_code = err_code; + } + + pdb_evt_send(&event); + break; + } + } + } + } +} + + +ret_code_t pdb_register(pdb_evt_handler_t evt_handler) +{ + if (m_pdb.n_registrants >= MAX_REGISTRANTS) + { + return NRF_ERROR_NO_MEM; + } + + VERIFY_PARAM_NOT_NULL(evt_handler); + + if (!MODULE_INITIALIZED) + { + ret_code_t err_code; + + internal_state_reset(&m_pdb); + err_code = pds_register(pds_evt_handler); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + PM_BUFFER_INIT(&m_pdb.write_buffer, N_WRITE_BUFFERS, PDB_WRITE_BUF_SIZE, err_code); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + } + + m_pdb.evt_handlers[m_pdb.n_registrants] = evt_handler; + m_pdb.n_registrants += 1; + + return NRF_SUCCESS; +} + + +pm_peer_id_t pdb_peer_allocate(void) +{ + if (!MODULE_INITIALIZED) + { + return PM_PEER_ID_INVALID; + } + + return pds_peer_id_allocate(); +} + + +ret_code_t pdb_peer_free(pm_peer_id_t peer_id) +{ + VERIFY_MODULE_INITIALIZED(); + ret_code_t err_code_in = NRF_SUCCESS; + ret_code_t err_code_out = NRF_SUCCESS; + + int index = 0; + pdb_buffer_record_t * p_record = write_buffer_record_find_next(peer_id, &index); + + while (p_record != NULL) + { + err_code_in = pdb_write_buf_release(peer_id, p_record->data_id); + + if ( (err_code_in != NRF_SUCCESS) + && (err_code_in != NRF_ERROR_NOT_FOUND)) + { + err_code_out = NRF_ERROR_INTERNAL; + } + + index++; + p_record = write_buffer_record_find_next(peer_id, &index); + } + + if (err_code_out == NRF_SUCCESS) + { + err_code_in = pds_peer_id_free(peer_id); + + if (err_code_in == NRF_SUCCESS) + { + // No action needed. + } + else if (err_code_in == NRF_ERROR_INVALID_PARAM) + { + err_code_out = NRF_ERROR_INVALID_PARAM; + } + else + { + err_code_out = NRF_ERROR_INTERNAL; + } + } + + return err_code_out; +} + + +ret_code_t pdb_read_buf_get(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_flash_t * p_peer_data, + pm_store_token_t * p_token) +{ + VERIFY_MODULE_INITIALIZED(); + + return pds_peer_data_read_ptr_get(peer_id, data_id, p_peer_data, p_token); +} + + +static void peer_data_point_to_buffer(pm_peer_data_t * p_peer_data, pm_peer_data_id_t data_id, uint8_t * p_buffer_memory, uint16_t n_bufs) +{ + uint16_t n_bytes = n_bufs * PDB_WRITE_BUF_SIZE; + p_peer_data->data_id = data_id; + + p_peer_data->p_all_data = (pm_peer_data_bonding_t *)p_buffer_memory; + p_peer_data->length_words = BYTES_TO_WORDS(n_bytes); +} + + +static void peer_data_const_point_to_buffer(pm_peer_data_const_t * p_peer_data, pm_peer_data_id_t data_id, uint8_t * p_buffer_memory, uint32_t n_bufs) +{ + peer_data_point_to_buffer((pm_peer_data_t*)p_peer_data, data_id, p_buffer_memory, n_bufs); +} + + +static void write_buf_length_words_set(pm_peer_data_const_t * p_peer_data) +{ + switch (p_peer_data->data_id) + { + case PM_PEER_DATA_ID_BONDING: + p_peer_data->length_words = PM_BONDING_DATA_N_WORDS(); + break; + case PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING: + p_peer_data->length_words = PM_SC_STATE_N_WORDS(); + break; + case PM_PEER_DATA_ID_PEER_RANK: + p_peer_data->length_words = PM_USAGE_INDEX_N_WORDS(); + break; + case PM_PEER_DATA_ID_GATT_LOCAL: + p_peer_data->length_words = PM_LOCAL_DB_N_WORDS(p_peer_data->p_local_gatt_db->len); + break; + default: + // No action needed. + break; + } +} + + +ret_code_t pdb_write_buf_get(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + uint32_t n_bufs, + pm_peer_data_t * p_peer_data) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_peer_data); + VERIFY_DATA_ID_WRITE_BUF(data_id); + if ( (n_bufs == 0) + || (n_bufs > N_WRITE_BUFFERS) + || !pds_peer_id_is_allocated(peer_id)) + { + return NRF_ERROR_INVALID_PARAM; + } + + pdb_buffer_record_t * write_buffer_record; + uint8_t * p_buffer_memory; + bool new_record = false; + + write_buffer_record = write_buffer_record_find(peer_id, data_id); + + if ((write_buffer_record != NULL) && (write_buffer_record->n_bufs < n_bufs)) + { + // @TODO: Copy? + // Existing buffer is too small. + for (uint8_t i = 0; i < write_buffer_record->n_bufs; i++) + { + pm_buffer_release(&m_pdb.write_buffer, write_buffer_record->buffer_block_id + i); + } + write_buffer_record_invalidate(write_buffer_record); + write_buffer_record = NULL; + } + else if ((write_buffer_record != NULL) && write_buffer_record->n_bufs > n_bufs) + { + // Release excess blocks. + for (uint8_t i = n_bufs; i < write_buffer_record->n_bufs; i++) + { + pm_buffer_release(&m_pdb.write_buffer, write_buffer_record->buffer_block_id + i); + } + } + + if (write_buffer_record == NULL) + { + write_buffer_record_get(&write_buffer_record, peer_id, data_id); + if (write_buffer_record == NULL) + { + return NRF_ERROR_BUSY; + } + } + + if (write_buffer_record->buffer_block_id == BUFFER_INVALID_ID) + { + write_buffer_record->buffer_block_id = pm_buffer_block_acquire(&m_pdb.write_buffer, n_bufs); + + if (write_buffer_record->buffer_block_id == BUFFER_INVALID_ID) + { + write_buffer_record_invalidate(write_buffer_record); + return NRF_ERROR_BUSY; + } + + new_record = true; + } + + write_buffer_record->n_bufs = n_bufs; + + p_buffer_memory = pm_buffer_ptr_get(&m_pdb.write_buffer, write_buffer_record->buffer_block_id); + + if (p_buffer_memory == NULL) + { + return NRF_ERROR_INTERNAL; + } + + peer_data_point_to_buffer(p_peer_data, data_id, p_buffer_memory, n_bufs); + if (new_record && (data_id == PM_PEER_DATA_ID_GATT_LOCAL)) + { + p_peer_data->p_local_gatt_db->len = PM_LOCAL_DB_LEN(p_peer_data->length_words); + } + + return NRF_SUCCESS; +} + + +ret_code_t pdb_write_buf_release(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) +{ + VERIFY_MODULE_INITIALIZED(); + + ret_code_t err_code = NRF_SUCCESS; + pdb_buffer_record_t * p_write_buffer_record; + p_write_buffer_record = write_buffer_record_find(peer_id, data_id); + + if (p_write_buffer_record == NULL) + { + return NRF_ERROR_NOT_FOUND; + } + + if (p_write_buffer_record->prepare_token != PDS_PREPARE_TOKEN_INVALID) + { + err_code = pds_peer_data_write_prepare_cancel(p_write_buffer_record->prepare_token); + if (err_code != NRF_SUCCESS) + { + err_code = NRF_ERROR_INTERNAL; + } + } + + write_buffer_record_release(p_write_buffer_record); + + return err_code; +} + + +ret_code_t pdb_write_buf_store_prepare(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_DATA_ID_WRITE_BUF(data_id); + + ret_code_t err_code = NRF_SUCCESS; + pdb_buffer_record_t * p_write_buffer_record; + p_write_buffer_record = write_buffer_record_find(peer_id, data_id); + + if (p_write_buffer_record == NULL) + { + return NRF_ERROR_NOT_FOUND; + } + + if (p_write_buffer_record->prepare_token == PDS_PREPARE_TOKEN_INVALID) + { + uint8_t * p_buffer_memory = pm_buffer_ptr_get(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id); + pm_peer_data_const_t peer_data = {.data_id = data_id}; + + if (p_buffer_memory == NULL) + { + return NRF_ERROR_INTERNAL; + } + + peer_data_const_point_to_buffer(&peer_data, data_id, p_buffer_memory, p_write_buffer_record->n_bufs); + + write_buf_length_words_set(&peer_data); + + err_code = pds_peer_data_write_prepare(&peer_data, &p_write_buffer_record->prepare_token); + if (err_code == NRF_ERROR_INVALID_LENGTH) + { + return NRF_ERROR_INTERNAL; + } + } + + return err_code; +} + + +static ret_code_t write_or_update(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_const_t * p_peer_data, + pm_store_token_t * p_store_token, + pm_prepare_token_t prepare_token) +{ + pm_peer_data_flash_t old_peer_data; + pm_store_token_t old_store_token; + ret_code_t err_code = pds_peer_data_read_ptr_get(peer_id, data_id, &old_peer_data, &old_store_token); + + if (err_code == NRF_SUCCESS) + { + err_code = pds_peer_data_write_prepare_cancel(prepare_token); + if ((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NULL)) + { + err_code = pds_peer_data_update(peer_id, p_peer_data, old_store_token, p_store_token); + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + else if (err_code == NRF_ERROR_NOT_FOUND) + { + if (prepare_token == PDS_PREPARE_TOKEN_INVALID) + { + err_code = pds_peer_data_write(peer_id, p_peer_data, p_store_token); + } + else + { + err_code = pds_peer_data_write_prepared(peer_id, p_peer_data, prepare_token, p_store_token); + } + } + return err_code; +} + + +ret_code_t pdb_write_buf_store(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_DATA_ID_WRITE_BUF(data_id); + + ret_code_t err_code = NRF_SUCCESS; + pdb_buffer_record_t * p_write_buffer_record; + uint8_t * p_buffer_memory; + pm_peer_data_const_t peer_data = {.data_id = data_id}; + + + p_write_buffer_record = write_buffer_record_find(peer_id, data_id); + + if (p_write_buffer_record == NULL) + { + return NRF_ERROR_NOT_FOUND; + } + + if (p_write_buffer_record->store_requested) + { + return NRF_SUCCESS; + } + + p_buffer_memory = pm_buffer_ptr_get(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id); + + if (p_buffer_memory == NULL) + { + return NRF_ERROR_INTERNAL; + } + + peer_data_const_point_to_buffer(&peer_data, data_id, p_buffer_memory, p_write_buffer_record->n_bufs); + + write_buf_length_words_set(&peer_data); + + err_code = write_or_update(peer_id, data_id, &peer_data, &p_write_buffer_record->store_token, p_write_buffer_record->prepare_token); + + if (p_write_buffer_record->store_busy && p_write_buffer_record->store_flash_full) + { + m_pdb.n_writes--; + } + + if (err_code == NRF_SUCCESS) + { + p_write_buffer_record->store_requested = true; + p_write_buffer_record->store_busy = false; + p_write_buffer_record->store_flash_full = false; + } + else + { + if (err_code == NRF_ERROR_BUSY) + { + m_pdb.n_writes++; + p_write_buffer_record->store_busy = true; + p_write_buffer_record->store_flash_full = false; + err_code = NRF_SUCCESS; + } + else if (err_code == NRF_ERROR_NO_MEM) + { + m_pdb.n_writes++; + p_write_buffer_record->store_busy = false; + p_write_buffer_record->store_flash_full = true; + } + else if ((err_code != NRF_ERROR_NO_MEM) && (err_code != NRF_ERROR_INVALID_PARAM)) + { + err_code = NRF_ERROR_INTERNAL; + } + } + + return err_code; +} + + +ret_code_t pdb_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) +{ + VERIFY_MODULE_INITIALIZED(); + + return pds_peer_data_clear(peer_id, data_id); +} + + +uint32_t pdb_n_peers(void) +{ + if (!MODULE_INITIALIZED) + { + return 0; + } + + return pds_n_peers(); +} + + +pm_peer_id_t pdb_next_peer_id_get(pm_peer_id_t prev_peer_id) +{ + if (!MODULE_INITIALIZED) + { + return PM_PEER_ID_INVALID; + } + + return pds_next_peer_id_get(prev_peer_id); +} + + +ret_code_t pdb_raw_read(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_t * p_peer_data) +{ + VERIFY_MODULE_INITIALIZED(); + return pds_peer_data_read(peer_id, data_id, p_peer_data, &p_peer_data->length_words); +} + + +ret_code_t pdb_raw_store(pm_peer_id_t peer_id, + pm_peer_data_const_t * p_peer_data, + pm_store_token_t * p_store_token) +{ + VERIFY_MODULE_INITIALIZED(); + + return write_or_update(peer_id, p_peer_data->data_id, p_peer_data, p_store_token, PDS_PREPARE_TOKEN_INVALID); +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.h new file mode 100644 index 0000000000..c0eee65774 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.h @@ -0,0 +1,385 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef PEER_DATABASE_H__ +#define PEER_DATABASE_H__ + +#include +#include "peer_manager_types.h" +#include "peer_manager_internal.h" +#include "sdk_errors.h" + +/** + * @cond NO_DOXYGEN + * @defgroup peer_database Peer Database + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. A module for simple management of reading and + * writing of peer data into persistent storage. + * + */ + +#define PDB_WRITE_BUF_SIZE (sizeof(pm_peer_data_bonding_t)) + +/**@brief Events that can come from the peer_database module. + */ +typedef enum +{ + PDB_EVT_WRITE_BUF_STORED, /**< A @ref pdb_write_buf_store operation has completed successfully. */ + PDB_EVT_RAW_STORED, /**< A @ref pdb_raw_store operation has completed successfully. */ + PDB_EVT_RAW_STORE_FAILED, /**< A @ref pdb_raw_store operation has failed. */ + PDB_EVT_CLEARED, /**< A @ref pdb_clear operation has completed successfully. */ + PDB_EVT_CLEAR_FAILED, /**< A @ref pdb_clear operation has failed. */ + PDB_EVT_PEER_FREED, /**< A @ref pdb_peer_free operation has completed successfully. All associated data has been erased. */ + PDB_EVT_PEER_FREE_FAILED, /**< A @ref pdb_peer_free operation has failed. */ + PDB_EVT_COMPRESSED, /**< A compress procedure has completed. */ + PDB_EVT_ERROR_NO_MEM, /**< An operation is blocked because the flash is full. It will be reattempted automatically after the next compress procedure. */ + PDB_EVT_ERROR_UNEXPECTED, /**< An unexpected error occurred. This is a fatal error. */ +} pdb_evt_id_t; + +/**@brief Events that can come from the peer_database module. + */ +typedef struct +{ + pdb_evt_id_t evt_id; /**< The event that has happened. */ + pm_peer_id_t peer_id; /**< The id of the peer the event pertains to. */ + pm_peer_data_id_t data_id; /**< The data the event pertains to. */ + union + { + struct + { + bool update; /**< If true, an existing value was overwritten. */ + } write_buf_stored_evt; /**< Additional information pertaining to the @ref PDB_EVT_WRITE_BUF_STORED event. */ + struct + { + pm_store_token_t store_token; /**< A token identifying the store operation this event pertains to. */ + } raw_stored_evt; /**< Additional information pertaining to the @ref PDB_EVT_RAW_STORED event. */ + struct + { + pm_store_token_t store_token; /**< A token identifying the store operation this event pertains to. */ + ret_code_t err_code; /**< Error code specifying what went wrong. */ + } error_raw_store_evt; /**< Additional information pertaining to the @ref PDB_EVT_RAW_STORE_FAILED event. */ + struct + { + ret_code_t err_code; /**< The error that occurred. */ + } clear_failed_evt; /**< Additional information pertaining to the @ref PDB_EVT_CLEAR_FAILED event. */ + struct + { + ret_code_t err_code; /**< The error that occurred. */ + } peer_free_failed_evt; /**< Additional information pertaining to the @ref PDB_EVT_PEER_FREE_FAILED event. */ + struct + { + ret_code_t err_code; /**< The unexpected error that occurred. */ + } error_unexpected; /**< Additional information pertaining to the @ref PDB_EVT_ERROR_UNEXPECTED event. */ + } params; +} pdb_evt_t; + +/**@brief Event handler for events from the peer_data_storage module. + * + * @param[in] p_event The event that has happened. + */ +typedef void (*pdb_evt_handler_t)(pdb_evt_t const * p_event); + + +/**@brief Function for registering for events from the peer database. + * + * @note This function will initialize the module if it is not already initialized. + * + * @param[in] evt_handler Event handler to register. + * + * @retval NRF_SUCCESS Registration successful. + * @retval NRF_ERROR_NO_MEM No more event handlers can be registered. + * @retval NRF_ERROR_NULL evt_handler was NULL. + * @retval NRF_ERROR_INTERNAL An unexpected error happened. + */ +ret_code_t pdb_register(pdb_evt_handler_t evt_handler); + + +/**@brief Function for allocating persistent bond storage for a peer. + * + * @return The ID of the newly allocated storage. + * @retval PM_PEER_ID_INVALID If no peer ID is available. + */ +pm_peer_id_t pdb_peer_allocate(void); + + +/**@brief Function for freeing a peer's persistent bond storage. + * + * @note This function will call @ref pdb_write_buf_release on the data for this peer. + * + * @param[in] peer_id ID to be freed. + * + * @retval NRF_SUCCESS Peer ID was released and clear operation was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM Peer ID was invalid. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pdb_peer_free(pm_peer_id_t peer_id); + + +/**@brief Function for retrieving pointers to read-only peer data. + * + * @note Reading this pointer is not safe in the strictest sense. If a safe read is required: + * - Disable interrupts + * - Call this function. If the return code is @ref NRF_SUCCESS, the following read is safe. + * - Read memory. + * - Enable interrupts. + * @note This buffer does not need to be released. It is a pointer directly to flash. + * + * @param[in] peer_id ID of peer to retrieve data for. + * @param[in] data_id Which piece of data to get. + * @param[out] p_peer_data Pointer to immutable peer data. + * @param[out] p_token Token that can be used to lock data in flash and check data validity. + * + * @retval NRF_SUCCESS Data retrieved successfully. + * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated. + * @retval NRF_ERROR_NULL p_peer_data was NULL. + * @retval NRF_ERROR_NOT_FOUND This data was not found for this peer ID. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pdb_read_buf_get(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_flash_t * p_peer_data, + pm_store_token_t * p_token); + + +/**@brief Function for retrieving pointers to a write buffer for peer data. + * + * @details This function will provide pointers to a buffer of the data. The data buffer will not be + * written to persistent storage until @ref pdb_write_buf_store is called. The buffer is + * released by calling either @ref pdb_write_buf_release, @ref pdb_write_buf_store, or + * @ref pdb_peer_free. + * + * When the data_id refers to a variable length data type, the available size is written + * to the data, both the top-level, and any internal length fields. + * + * @note Calling this function on a peer_id/data_id pair that already has a buffer created will + * give the same buffer, not create a new one. If n_bufs was increased since last time, the + * buffer might be relocated to be able to provide additional room. In this case, the data + * will be copied. If n_bufs was increased since last time, this function might return @ref + * NRF_ERROR_BUSY. In that case, the buffer is automatically released. + * + * @param[in] peer_id ID of peer to get a write buffer for. + * @param[in] data_id Which piece of data to get. + * @param[in] n_bufs The number of contiguous buffers needed. + * @param[out] p_peer_data Pointers to mutable peer data. + * + * @retval NRF_SUCCESS Data retrieved successfully. + * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated, or n_bufs was 0 + * or more than the total available buffers. + * @retval NRF_ERROR_NULL p_peer_data was NULL. + * @retval NRF_ERROR_BUSY Not enough buffer(s) available. + * @retval NRF_ERROR_INTERNAL Unexpected internal error. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pdb_write_buf_get(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + uint32_t n_bufs, + pm_peer_data_t * p_peer_data); + + +/**@brief Function for freeing a write buffer allocated with @ref pdb_write_buf_get. + * + * @note This function will not write peer data to persistent memory. Data in released buffer will + * be lost. + * + * @note This function will undo any previous call to @ref pdb_write_buf_store_prepare for this + * piece of data. + * + * @param[in] peer_id ID of peer to release buffer for. + * @param[in] data_id Which piece of data to release buffer for. + * + * @retval NRF_SUCCESS Successfully released buffer. + * @retval NRF_ERROR_NOT_FOUND No buffer was allocated for this peer ID/data ID pair. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Unexpected internal error. + */ +ret_code_t pdb_write_buf_release(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); + + +/**@brief Function for reserving space in persistent storage for data in a buffer. + * + * @note This function only works for data which has a write buffer allocated. If the write buffer + * is released, this prepare is undone. + * + * @note If space has already been reserved for this data, nothing is done. + * + * @param[in] peer_id The peer whose data to reserve space for. + * @param[in] data_id The type of data to reserve space for. + * + * @retval NRF_SUCCESS Successfully reserved space in persistent storage. + * @retval NRF_ERROR_NO_MEM Not enough room in persistent storage. + * @retval NRF_ERROR_BUSY Could not process request at this time. Reattempt later. + * @retval NRF_ERROR_NOT_FOUND No buffer has been allocated for this peer ID/data ID pair. + * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pdb_write_buf_store_prepare(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); + + +/**@brief Function for writing data into persistent storage. Writing happens asynchronously. + * + * @note This will unlock the data after it has been written. + * + * @param[in] peer_id ID of peer to store data for. + * @param[in] data_id Which piece of data to store. + * + * @retval NRF_SUCCESS Data storing was successfully started. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. Please clear some + * space, the operation will be reattempted after the next compress + * procedure. This error will not happen if + * @ref pdb_write_buf_store_prepare is called beforehand. + * @retval NRF_ERROR_INVALID_PARAM Data ID was invalid. + * @retval NRF_ERROR_NOT_FOUND No buffer has been allocated for this peer ID/data ID pair. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Unexpected internal error. + */ +ret_code_t pdb_write_buf_store(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id); + + +/**@brief Function for clearing data from persistent storage. + * + * @param[in] peer_id ID of peer to clear data for. + * @param[in] data_id Which piece of data to clear. + * + * @retval NRF_SUCCESS The clear was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM Data ID or peer ID was invalid. + * @retval NRF_ERROR_NOT_FOUND Nothing to clear for this peer ID/data ID combination. + * @retval NRF_ERROR_BUSY Underlying modules are busy and can't take any more requests at + * this moment. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL Internal error. + */ +ret_code_t pdb_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); + + +/**@brief Function for querying the number of valid peer IDs available. I.E the number of peers + * in persistent storage. + * + * @return The number of valid peer IDs. + */ +uint32_t pdb_n_peers(void); + + +/**@brief Function for getting the next peer ID in the sequence of all used peer IDs. Can be + * used to loop through all used peer IDs. + * + * @note @ref PM_PEER_ID_INVALID is considered to be before the first and after the last ordinary + * peer ID. + * + * @param[in] prev_peer_id The previous peer ID. + * + * @return The next peer ID. + * @return The first ordinary peer ID if prev_peer_id was @ref PM_PEER_ID_INVALID. + * @retval PM_PEER_ID_INVALID if prev_peer_id was the last ordinary peer ID. + */ +pm_peer_id_t pdb_next_peer_id_get(pm_peer_id_t prev_peer_id); + + +/**@brief Function for updating currently stored peer data to a new version + * + * @details Updating happens asynchronously. + * Expect a @ref PDS_EVT_STORED or @ref PDS_EVT_ERROR_STORE for the store token + * and a @ref PDS_EVT_ERROR_CLEAR or @ref PDS_EVT_ERROR_CLEAR for the old token + * + * @param[in] peer_data New data + * @param[in] old_token Store token for the old data + * @param[out] p_store_token Store token for the new data + * + * @retval NRF_SUCESS The update was initiated successfully + * @retval NRF_ERROR_NOT_FOUND The old store token was invalid. + * @retval NRF_ERROR_NULL Data contained a NULL pointer. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. + * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any + * more requests + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pdb_peer_data_update(pm_peer_data_const_t peer_data, + pm_store_token_t old_token, + pm_store_token_t * p_store_token); + + +/**@brief Function for reading data directly from persistent storage to external memory. + * + * @param[in] peer_id ID of peer to read data for. + * @param[in] data_id Which piece of data to read. + * @param[inout] p_peer_data Where to store the data. If the data to be read has variable length, + * the appropriate length field needs to reflect the available buffer + * space. On a successful read, the length field is updated to match the + * length of the read data. + * + * @retval NRF_SUCCESS Data successfully read. + * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated. + * @retval NRF_ERROR_NULL p_peer_data contained a NULL pointer. + * @retval NRF_ERROR_NOT_FOUND This data was not found for this peer ID. + * @retval NRF_ERROR_DATA_SIZE The provided buffer was not large enough. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pdb_raw_read(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_t * p_peer_data); + + +/**@brief Function for writing data directly to persistent storage from external memory. + * + * @param[in] peer_id ID of peer to write data for. + * @param[in] p_peer_data Data to store. + * @param[out] p_store_token A token identifying this particular store operation. The token can be + * used to identify events pertaining to this operation. + * + * @retval NRF_SUCCESS Data successfully written. + * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated. + * @retval NRF_ERROR_NULL p_peer_data contained a NULL pointer. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. + * @retval NRF_ERROR_INVALID_LENGTH Data length above the maximum allowed. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_BUSY Unable to perform operation at this time. + */ +ret_code_t pdb_raw_store(pm_peer_id_t peer_id, + pm_peer_data_const_t * p_peer_data, + pm_store_token_t * p_store_token); + +/** @} + * @endcond + */ + +#endif /* PEER_DATABASE_H__ */ + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.c new file mode 100644 index 0000000000..df7ac58e2b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.c @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "peer_id.h" + +#include +#include +#include "sdk_errors.h" +#include "peer_manager_types.h" +#include "pm_mutex.h" + + +typedef struct +{ + uint8_t active_peer_ids[MUTEX_STORAGE_SIZE(PM_PEER_ID_N_AVAILABLE_IDS)]; /**< Bitmap designating which peer IDs are in use. */ + uint8_t deleted_peer_ids[MUTEX_STORAGE_SIZE(PM_PEER_ID_N_AVAILABLE_IDS)]; /**< Bitmap designating which peer IDs are marked for deletion. */ +} pi_t; + + +static pi_t m_pi = {{0}, {0}}; + + +static void internal_state_reset(pi_t * p_pi) +{ + memset(p_pi, 0, sizeof(pi_t)); +} + + +void peer_id_init(void) +{ + internal_state_reset(&m_pi); + pm_mutex_init(m_pi.active_peer_ids, PM_PEER_ID_N_AVAILABLE_IDS); + pm_mutex_init(m_pi.deleted_peer_ids, PM_PEER_ID_N_AVAILABLE_IDS); +} + + +static pm_peer_id_t claim(pm_peer_id_t peer_id, uint8_t * mutex_group) +{ + pm_peer_id_t allocated_peer_id = PM_PEER_ID_INVALID; + if (peer_id == PM_PEER_ID_INVALID) + { + allocated_peer_id = pm_mutex_lock_first_available(mutex_group, PM_PEER_ID_N_AVAILABLE_IDS); + if (allocated_peer_id == PM_PEER_ID_N_AVAILABLE_IDS) + { + allocated_peer_id = PM_PEER_ID_INVALID; + } + } + else if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS) + { + bool lock_success = pm_mutex_lock(mutex_group, peer_id); + allocated_peer_id = lock_success ? peer_id : PM_PEER_ID_INVALID; + } + return allocated_peer_id; +} + + +static void release(pm_peer_id_t peer_id, uint8_t * mutex_group) +{ + if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS) + { + pm_mutex_unlock(mutex_group, peer_id); + } +} + + +pm_peer_id_t peer_id_allocate(pm_peer_id_t peer_id) +{ + return claim(peer_id, m_pi.active_peer_ids); +} + + +bool peer_id_delete(pm_peer_id_t peer_id) +{ + if (peer_id == PM_PEER_ID_INVALID) + { + return false; + } + pm_peer_id_t deleted_id = claim(peer_id, m_pi.deleted_peer_ids); + return (deleted_id == peer_id); +} + + +void peer_id_free(pm_peer_id_t peer_id) +{ + release(peer_id, m_pi.active_peer_ids); + release(peer_id, m_pi.deleted_peer_ids); +} + + +bool peer_id_is_allocated(pm_peer_id_t peer_id) +{ + if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS) + { + return pm_mutex_lock_status_get(m_pi.active_peer_ids, peer_id); + } + return false; +} + + +bool peer_id_is_deleted(pm_peer_id_t peer_id) +{ + if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS) + { + return pm_mutex_lock_status_get(m_pi.deleted_peer_ids, peer_id); + } + return false; +} + + +pm_peer_id_t next_id_get(pm_peer_id_t prev_peer_id, uint8_t * mutex_group) +{ + pm_peer_id_t i = (prev_peer_id == PM_PEER_ID_INVALID) ? 0 : (prev_peer_id + 1); + for (; i < PM_PEER_ID_N_AVAILABLE_IDS; i++) + { + if (pm_mutex_lock_status_get(mutex_group, i)) + { + return i; + } + } + + return PM_PEER_ID_INVALID; +} + + +pm_peer_id_t peer_id_get_next_used(pm_peer_id_t prev_peer_id) +{ + return next_id_get(prev_peer_id, m_pi.active_peer_ids); +} + + +pm_peer_id_t peer_id_get_next_deleted(pm_peer_id_t prev_peer_id) +{ + return next_id_get(prev_peer_id, m_pi.deleted_peer_ids); +} + + +uint32_t peer_id_n_ids(void) +{ + uint32_t n_ids = 0; + + for (pm_peer_id_t i = 0; i < PM_PEER_ID_N_AVAILABLE_IDS; i++) + { + n_ids += pm_mutex_lock_status_get(m_pi.active_peer_ids, i); + } + + return n_ids; +} + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.h new file mode 100644 index 0000000000..ac68851451 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.h @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef PEER_ID_H__ +#define PEER_ID_H__ + + +#include +#include "sdk_errors.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @cond NO_DOXYGEN + * @defgroup peer_id Peer IDs + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. This module keeps track of which peer IDs are in + * use and which are free. + */ + + +/**@brief Function for initializing the module. + */ +void peer_id_init(void); + + +/**@brief Function for claiming an unused peer ID. + * + * @param peer_id The peer ID to allocate. If this is @ref PM_PEER_ID_INVALID, the first available + * will be allocated. + * + * @return The allocated peer ID. + * @retval PM_PEER_ID_INVALID If no peer ID could be allocated or module is not initialized. + */ +pm_peer_id_t peer_id_allocate(pm_peer_id_t peer_id); + + +/**@brief Function for marking a peer ID for deletion. + * + * @param peer_id The peer ID to delete. + * + * @retval true Deletion was successful. + * @retval false Peer ID already marked for deletion, peer_id was PM_PEER_ID_INVALID, or module is + * not initialized. + */ +bool peer_id_delete(pm_peer_id_t peer_id); + + +/**@brief Function for freeing a peer ID and clearing all data associated with it in persistent + * storage. + * + * @param[in] peer_id Peer ID to free. + */ +void peer_id_free(pm_peer_id_t peer_id); + + +/**@brief Function for finding out whether a peer ID is marked for deletion. + * + * @param[in] peer_id The peer ID to inquire about. + * + * @retval true peer_id is in marked for deletion. + * @retval false peer_id is not marked for deletion, or the module is not initialized. + */ +bool peer_id_is_deleted(pm_peer_id_t peer_id); + + +/**@brief Function for finding out whether a peer ID is in use. + * + * @param[in] peer_id The peer ID to inquire about. + * + * @retval true peer_id is in use. + * @retval false peer_id is free, or the module is not initialized. + */ +bool peer_id_is_allocated(pm_peer_id_t peer_id); + + +/**@brief Function for getting the next peer ID in the sequence of all used peer IDs. Can be + * used to loop through all used peer IDs. + * + * @note @ref PM_PEER_ID_INVALID is considered to be before the first and after the last ordinary + * peer ID. + * + * @param[in] prev_peer_id The previous peer ID. + * + * @return The next peer ID. + * @return The first used peer ID if prev_peer_id was @ref PM_PEER_ID_INVALID. + * @retval PM_PEER_ID_INVALID if prev_peer_id was the last ordinary peer ID or the module is + * not initialized. + */ +pm_peer_id_t peer_id_get_next_used(pm_peer_id_t prev_peer_id); + + +/**@brief Function for getting the next peer ID in the sequence of all peer IDs marked for deletion. + * Can be used to loop through all peer IDs marked for deletion. + * + * @note @ref PM_PEER_ID_INVALID is considered to be before the first and after the last ordinary + * peer ID. + * + * @param[in] prev_peer_id The previous peer ID. + * + * @return The next peer ID. + * @return The first used peer ID if prev_peer_id was @ref PM_PEER_ID_INVALID. + * @retval PM_PEER_ID_INVALID if prev_peer_id was the last ordinary peer ID or the module is + * not initialized. + */ +pm_peer_id_t peer_id_get_next_deleted(pm_peer_id_t prev_peer_id); + + +/**@brief Function for querying the number of valid peer IDs available. I.E the number of peers + * in persistent storage. + * + * @return The number of valid peer IDs, or 0 if module is not initialized. + */ +uint32_t peer_id_n_ids(void); + +/** @} + * @endcond + */ + +#endif /* PEER_ID_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.c new file mode 100644 index 0000000000..7d11076083 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.c @@ -0,0 +1,1039 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "peer_manager.h" +#include +#include "app_util.h" +#include "security_manager.h" +#include "gatt_cache_manager.h" +#include "peer_database.h" +#include "id_manager.h" +#include "ble_conn_state.h" +#include "sdk_common.h" +#include "peer_manager_internal.h" + +#define MODULE_INITIALIZED m_pm.initialized +#include "sdk_macros.h" + + +#define MAX_REGISTRANTS 3 /**< The number of event handlers that can be registered with the module. */ + + +/**@brief Internal state of the module. + */ +typedef struct +{ + uint8_t initialized : 1; /**< Whether or not @ref pm_init has been called successfully. */ + uint8_t peer_rank_initialized : 1; /**< Whether or not @ref rank_init has been called successfully. */ + uint8_t deleting_all : 1; /**< True from when @ref pm_peers_delete is called until all peers have been deleted. */ + pm_store_token_t peer_rank_token; /**< The store token of an ongoing peer rank update via a call to @ref pm_peer_rank_highest. If @ref PM_STORE_TOKEN_INVALID, there is no ongoing update. */ + uint32_t current_highest_peer_rank; /**< The current highest peer rank. Used by @ref pm_peer_rank_highest. */ + pm_peer_id_t highest_ranked_peer; /**< The peer with the highest peer rank. Used by @ref pm_peer_rank_highest. */ + pm_evt_handler_t evt_handlers[MAX_REGISTRANTS]; /**< The subscribers to Peer Manager events, as registered through @ref pm_register. */ + uint8_t n_registrants; /**< The number of event handlers registered through @ref pm_register. */ + ble_conn_state_user_flag_id_t pairing_flag_id; /**< The flag ID for which connections are paired. */ + ble_conn_state_user_flag_id_t bonding_flag_id; /**< The flag ID for which connections are bonded. */ +} pm_t; + + +/**@brief Instantiation of Peer Manager internal state. + */ +static pm_t m_pm = +{ + .initialized = 0, + .peer_rank_initialized = 0, +}; + +/**@brief Function for sending a Peer Manager event to all subscribers. + * + * @param[in] p_pm_evt The event to send. + */ +static void evt_send(pm_evt_t * p_pm_evt) +{ + for (int i = 0; i < m_pm.n_registrants; i++) + { + m_pm.evt_handlers[i](p_pm_evt); + } +} + + +/**@brief Event handler for events from the Peer Database module. + * + * @param[in] p_pdb_evt The incoming Peer Database event. + */ +static void pdb_evt_handler(pdb_evt_t const * p_pdb_evt) +{ + bool send_evt = true; + pm_evt_t pm_evt; + + memset(&pm_evt, 0, sizeof(pm_evt_t)); + pm_evt.peer_id = p_pdb_evt->peer_id; + pm_evt.conn_handle = im_conn_handle_get(pm_evt.peer_id); + + switch (p_pdb_evt->evt_id) + { + case PDB_EVT_WRITE_BUF_STORED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_SUCCEEDED; + pm_evt.params.peer_data_update_succeeded.data_id = p_pdb_evt->data_id; + pm_evt.params.peer_data_update_succeeded.action = PM_PEER_DATA_OP_UPDATE; + pm_evt.params.peer_data_update_succeeded.token = PM_STORE_TOKEN_INVALID; + pm_evt.params.peer_data_update_succeeded.flash_changed = true; + break; + + case PDB_EVT_RAW_STORED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_SUCCEEDED; + pm_evt.params.peer_data_update_succeeded.data_id = p_pdb_evt->data_id; + pm_evt.params.peer_data_update_succeeded.action = PM_PEER_DATA_OP_UPDATE; + pm_evt.params.peer_data_update_succeeded.token + = p_pdb_evt->params.raw_stored_evt.store_token; + pm_evt.params.peer_data_update_succeeded.flash_changed = true; + + if( (m_pm.peer_rank_token != PM_STORE_TOKEN_INVALID) + && (m_pm.peer_rank_token == p_pdb_evt->params.raw_stored_evt.store_token)) + { + m_pm.peer_rank_token = PM_STORE_TOKEN_INVALID; + m_pm.highest_ranked_peer = pm_evt.peer_id; + + pm_evt.params.peer_data_update_succeeded.token = PM_STORE_TOKEN_INVALID; + } + break; + + case PDB_EVT_RAW_STORE_FAILED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_FAILED; + pm_evt.params.peer_data_update_failed.data_id = p_pdb_evt->data_id; + pm_evt.params.peer_data_update_failed.action = PM_PEER_DATA_OP_UPDATE; + pm_evt.params.peer_data_update_failed.token + = p_pdb_evt->params.error_raw_store_evt.store_token; + pm_evt.params.peer_data_update_failed.error + = p_pdb_evt->params.error_raw_store_evt.err_code; + + if( (m_pm.peer_rank_token != PM_STORE_TOKEN_INVALID) + && (m_pm.peer_rank_token == p_pdb_evt->params.raw_stored_evt.store_token)) + { + m_pm.peer_rank_token = PM_STORE_TOKEN_INVALID; + m_pm.current_highest_peer_rank -= 1; + + pm_evt.params.peer_data_update_succeeded.token = PM_STORE_TOKEN_INVALID; + } + break; + + case PDB_EVT_CLEARED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_SUCCEEDED; + pm_evt.params.peer_data_update_succeeded.data_id = p_pdb_evt->data_id; + pm_evt.params.peer_data_update_succeeded.action = PM_PEER_DATA_OP_DELETE; + pm_evt.params.peer_data_update_succeeded.token = PM_STORE_TOKEN_INVALID; + break; + + case PDB_EVT_CLEAR_FAILED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_FAILED; + pm_evt.params.peer_data_update_failed.data_id = p_pdb_evt->data_id; + pm_evt.params.peer_data_update_failed.action = PM_PEER_DATA_OP_DELETE; + pm_evt.params.peer_data_update_failed.error + = p_pdb_evt->params.clear_failed_evt.err_code; + break; + + case PDB_EVT_PEER_FREED: + pm_evt.evt_id = PM_EVT_PEER_DELETE_SUCCEEDED; + if (m_pm.deleting_all && (pdb_next_peer_id_get(PM_PEER_ID_INVALID) == PM_PEER_ID_INVALID)) + { + // pm_peers_delete() has been called and this is the last peer to be deleted. + + m_pm.deleting_all = false; + + pm_evt_t pm_delete_all_evt; + memset(&pm_delete_all_evt, 0, sizeof(pm_evt_t)); + pm_delete_all_evt.evt_id = PM_EVT_PEERS_DELETE_SUCCEEDED; + pm_delete_all_evt.peer_id = PM_PEER_ID_INVALID; + pm_delete_all_evt.conn_handle = BLE_CONN_HANDLE_INVALID; + + evt_send(&pm_delete_all_evt); + } + break; + + case PDB_EVT_PEER_FREE_FAILED: + pm_evt.evt_id = PM_EVT_PEER_DELETE_FAILED; + pm_evt.params.peer_delete_failed.error + = p_pdb_evt->params.peer_free_failed_evt.err_code; + if (m_pm.deleting_all) + { + // pm_peers_delete() has been called and has thus failed. + + m_pm.deleting_all = false; + + pm_evt_t pm_delete_all_evt; + memset(&pm_delete_all_evt, 0, sizeof(pm_evt_t)); + pm_delete_all_evt.evt_id = PM_EVT_PEERS_DELETE_FAILED; + pm_delete_all_evt.peer_id = PM_PEER_ID_INVALID; + pm_delete_all_evt.conn_handle = BLE_CONN_HANDLE_INVALID; + pm_delete_all_evt.params.peers_delete_failed_evt.error + = p_pdb_evt->params.peer_free_failed_evt.err_code; + + evt_send(&pm_delete_all_evt); + } + break; + + case PDB_EVT_COMPRESSED: + send_evt = false; + // Do nothing + break; + + case PDB_EVT_ERROR_NO_MEM: + pm_evt.evt_id = PM_EVT_STORAGE_FULL; + break; + + case PDB_EVT_ERROR_UNEXPECTED: + pm_evt.evt_id = PM_EVT_ERROR_UNEXPECTED; + break; + + default: + send_evt = false; + break; + } + + if (send_evt) + { + evt_send(&pm_evt); + } +} + + +/**@brief Event handler for events from the Security Manager module. + * + * @param[in] p_sm_evt The incoming Security Manager event. + */ +static void sm_evt_handler(sm_evt_t const * p_sm_evt) +{ + bool find_peer_id = true; + bool send_evt = true; + pm_evt_t pm_evt; + memset(&pm_evt, 0, sizeof(pm_evt_t)); + pm_evt.conn_handle = p_sm_evt->conn_handle; + + switch (p_sm_evt->evt_id) + { + case SM_EVT_SLAVE_SECURITY_REQ: + find_peer_id = false; + send_evt = false; + break; + + case SM_EVT_SEC_PROCEDURE_START: + { + pm_evt.evt_id = PM_EVT_CONN_SEC_START; + bool pairing = p_sm_evt->params.sec_procedure_start.procedure + != PM_LINK_SECURED_PROCEDURE_ENCRYPTION; + bool bonding = p_sm_evt->params.sec_procedure_start.procedure + == PM_LINK_SECURED_PROCEDURE_BONDING; + ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_pm.pairing_flag_id, pairing); + ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_pm.bonding_flag_id, bonding); + break; + } + + case SM_EVT_PAIRING_SUCCESS: + pm_evt.evt_id = PM_EVT_CONN_SEC_SUCCEEDED; + pm_evt.params.conn_sec_succeeded.procedure = + p_sm_evt->params.pairing_success.bonded + ? PM_LINK_SECURED_PROCEDURE_BONDING + : PM_LINK_SECURED_PROCEDURE_PAIRING; + ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_pm.pairing_flag_id, true); + ble_conn_state_user_flag_set(p_sm_evt->conn_handle, + m_pm.bonding_flag_id, + p_sm_evt->params.pairing_success.bonded + ); + break; + + case SM_EVT_PAIRING_FAIL: + pm_evt.evt_id = PM_EVT_CONN_SEC_FAILED; + pm_evt.params.conn_sec_failed.procedure = + ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_pm.bonding_flag_id) + ? PM_LINK_SECURED_PROCEDURE_BONDING + : PM_LINK_SECURED_PROCEDURE_PAIRING; + pm_evt.params.conn_sec_failed.error_src + = p_sm_evt->params.pairing_failed.error_src; + pm_evt.params.conn_sec_failed.error + = p_sm_evt->params.pairing_failed.error; + break; + + case SM_EVT_LINK_ENCRYPTION_UPDATE: + if (!ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_pm.pairing_flag_id)) + { + pm_evt.evt_id = PM_EVT_CONN_SEC_SUCCEEDED; + pm_evt.params.conn_sec_succeeded.procedure = PM_LINK_SECURED_PROCEDURE_ENCRYPTION; + } + else + { + find_peer_id = false; + send_evt = false; + } + break; + + case SM_EVT_LINK_ENCRYPTION_FAILED: + pm_evt.evt_id = PM_EVT_CONN_SEC_FAILED; + pm_evt.params.conn_sec_failed.procedure + = PM_LINK_SECURED_PROCEDURE_ENCRYPTION; + pm_evt.params.conn_sec_failed.error_src + = p_sm_evt->params.link_encryption_failed.error_src; + pm_evt.params.conn_sec_failed.error + = p_sm_evt->params.link_encryption_failed.error; + break; + + case SM_EVT_BONDING_INFO_STORED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_SUCCEEDED; + pm_evt.peer_id = p_sm_evt->params.bonding_info_stored.peer_id; + pm_evt.params.peer_data_update_succeeded.data_id = PM_PEER_DATA_ID_BONDING; + pm_evt.params.peer_data_update_succeeded.action = PM_PEER_DATA_OP_UPDATE; + find_peer_id = false; + break; + + case SM_EVT_ERROR_BONDING_INFO: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_FAILED; + pm_evt.peer_id = p_sm_evt->params.error_bonding_info.peer_id; + pm_evt.params.peer_data_update_failed.data_id = PM_PEER_DATA_ID_BONDING; + pm_evt.params.peer_data_update_failed.action = PM_PEER_DATA_OP_UPDATE; + pm_evt.params.peer_data_update_failed.error + = p_sm_evt->params.error_bonding_info.error; + find_peer_id = false; + break; + + case SM_EVT_ERROR_UNEXPECTED: + pm_evt.evt_id = PM_EVT_ERROR_UNEXPECTED; + pm_evt.params.error_unexpected.error = p_sm_evt->params.error_unexpected.error; + break; + + case SM_EVT_ERROR_NO_MEM: + pm_evt.evt_id = PM_EVT_STORAGE_FULL; + break; + + case SM_EVT_ERROR_SMP_TIMEOUT: + pm_evt.evt_id = PM_EVT_CONN_SEC_FAILED; + pm_evt.params.conn_sec_failed.procedure + = ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_pm.bonding_flag_id) + ? PM_LINK_SECURED_PROCEDURE_BONDING + : PM_LINK_SECURED_PROCEDURE_PAIRING; + pm_evt.params.conn_sec_failed.error_src = BLE_GAP_SEC_STATUS_SOURCE_LOCAL; + pm_evt.params.conn_sec_failed.error = PM_CONN_SEC_ERROR_SMP_TIMEOUT; + break; + + case SM_EVT_CONN_SEC_CONFIG_REQ: + pm_evt.evt_id = PM_EVT_CONN_SEC_CONFIG_REQ; + break; + + default: + send_evt = false; + break; + } + + if (find_peer_id) + { + pm_evt.peer_id = im_peer_id_get_by_conn_handle(p_sm_evt->conn_handle); + } + + if (send_evt) + { + evt_send(&pm_evt); + } +} + + +/**@brief Event handler for events from the GATT Cache Manager module. + * + * @param[in] p_gcm_evt The incoming GATT Cache Manager event. + */ +static void gcm_evt_handler(gcm_evt_t const * p_gcm_evt) +{ + + bool send_evt = true; + pm_evt_t pm_evt; + + memset(&pm_evt, 0, sizeof(pm_evt_t)); + pm_evt.peer_id = p_gcm_evt->peer_id; + pm_evt.conn_handle = im_conn_handle_get(pm_evt.peer_id); + + switch (p_gcm_evt->evt_id) + { + case GCM_EVT_LOCAL_DB_CACHE_STORED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_SUCCEEDED; + pm_evt.params.peer_data_update_succeeded.action = PM_PEER_DATA_OP_UPDATE; + pm_evt.params.peer_data_update_succeeded.data_id = PM_PEER_DATA_ID_GATT_LOCAL; + break; + + case GCM_EVT_LOCAL_DB_CACHE_UPDATED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_SUCCEEDED; + pm_evt.params.peer_data_update_succeeded.action = PM_PEER_DATA_OP_UPDATE; + pm_evt.params.peer_data_update_succeeded.data_id = PM_PEER_DATA_ID_GATT_LOCAL; + break; + + case GCM_EVT_LOCAL_DB_CACHE_APPLIED: + pm_evt.evt_id = PM_EVT_LOCAL_DB_CACHE_APPLIED; + break; + + case GCM_EVT_ERROR_LOCAL_DB_CACHE_APPLY: + pm_evt.evt_id = PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED; + break; + + case GCM_EVT_REMOTE_DB_CACHE_UPDATED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_SUCCEEDED; + pm_evt.params.peer_data_update_succeeded.action = PM_PEER_DATA_OP_UPDATE; + pm_evt.params.peer_data_update_succeeded.data_id = PM_PEER_DATA_ID_GATT_REMOTE; + break; + + case GCM_EVT_SERVICE_CHANGED_IND_SENT: + pm_evt.evt_id = PM_EVT_SERVICE_CHANGED_IND_SENT; + break; + + case GCM_EVT_SERVICE_CHANGED_IND_CONFIRMED: + pm_evt.evt_id = PM_EVT_SERVICE_CHANGED_IND_CONFIRMED; + break; + + case GCM_EVT_ERROR_DATA_SIZE: + send_evt = false; + break; + + case GCM_EVT_ERROR_STORAGE_FULL: + pm_evt.evt_id = PM_EVT_STORAGE_FULL; + break; + + case GCM_EVT_ERROR_UNEXPECTED: + pm_evt.evt_id = PM_EVT_ERROR_UNEXPECTED; + pm_evt.params.error_unexpected.error = p_gcm_evt->params.error_unexpected.error; + pm_evt.conn_handle = p_gcm_evt->params.error_unexpected.conn_handle; + break; + } + + if (send_evt) + { + evt_send(&pm_evt); + } +} + + +/**@brief Event handler for events from the ID Manager module. + * + * @param[in] p_im_evt The incoming ID Manager event. + */ +static void im_evt_handler(im_evt_t const * p_im_evt) +{ + pm_evt_t pm_evt; + ret_code_t err_code; + + switch (p_im_evt->evt_id) + { + case IM_EVT_DUPLICATE_ID: + // Attempt to delete the duplicate data to free space and avoid finding old data when + // scanning in the future + err_code = pm_peer_delete(p_im_evt->params.duplicate_id.peer_id_2); + UNUSED_VARIABLE(err_code); + break; + + case IM_EVT_BONDED_PEER_CONNECTED: + ble_conn_state_user_flag_set(p_im_evt->conn_handle, m_pm.bonding_flag_id, true); + memset(&pm_evt, 0, sizeof(pm_evt_t)); + pm_evt.conn_handle = p_im_evt->conn_handle; + pm_evt.peer_id = im_peer_id_get_by_conn_handle(p_im_evt->conn_handle); + pm_evt.evt_id = PM_EVT_BONDED_PEER_CONNECTED; + evt_send(&pm_evt); + break; + } +} + + +void pm_on_ble_evt(ble_evt_t * p_ble_evt) +{ + VERIFY_MODULE_INITIALIZED_VOID(); + + im_ble_evt_handler(p_ble_evt); + sm_ble_evt_handler(p_ble_evt); + gcm_ble_evt_handler(p_ble_evt); +} + + +/**@brief Function for resetting the internal state of this module. + */ +static void internal_state_reset() +{ + memset(&m_pm, 0, sizeof(m_pm)); + m_pm.highest_ranked_peer = PM_PEER_ID_INVALID; + m_pm.peer_rank_token = PM_STORE_TOKEN_INVALID; + m_pm.pairing_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; + m_pm.bonding_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; +} + + +ret_code_t pm_init(void) +{ + ret_code_t err_code; + + err_code = pdb_register(pdb_evt_handler); + if (err_code != NRF_SUCCESS) + { + if (err_code != NRF_ERROR_INVALID_STATE) + { + err_code = NRF_ERROR_INTERNAL; + } + return err_code; + } + + err_code = sm_register(sm_evt_handler); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = gcm_init(gcm_evt_handler); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = im_register(im_evt_handler); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + internal_state_reset(); + + m_pm.pairing_flag_id = ble_conn_state_user_flag_acquire(); + if (m_pm.pairing_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) + { + return NRF_ERROR_INTERNAL; + } + + m_pm.bonding_flag_id = ble_conn_state_user_flag_acquire(); + if (m_pm.bonding_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) + { + return NRF_ERROR_INTERNAL; + } + + m_pm.peer_rank_initialized = false; + m_pm.initialized = true; + + return NRF_SUCCESS; +} + + +ret_code_t pm_register(pm_evt_handler_t event_handler) +{ + VERIFY_MODULE_INITIALIZED(); + + if (m_pm.n_registrants >= MAX_REGISTRANTS) + { + return NRF_ERROR_NO_MEM; + } + + m_pm.evt_handlers[m_pm.n_registrants] = event_handler; + m_pm.n_registrants += 1; + + return NRF_SUCCESS; +} + + +ret_code_t pm_sec_params_set(ble_gap_sec_params_t * p_sec_params) +{ + VERIFY_MODULE_INITIALIZED(); + + ret_code_t err_code; + + err_code = sm_sec_params_set(p_sec_params); + + if (err_code == NRF_ERROR_INVALID_STATE) + { + err_code = NRF_ERROR_INTERNAL; + } + + return err_code; +} + + +ret_code_t pm_conn_secure(uint16_t conn_handle, bool force_repairing) +{ + VERIFY_MODULE_INITIALIZED(); + + ret_code_t err_code; + + err_code = sm_link_secure(conn_handle, force_repairing); + + return err_code; +} + + +void pm_conn_sec_config_reply(uint16_t conn_handle, pm_conn_sec_config_t * p_conn_sec_config) +{ + sm_conn_sec_config_reply(conn_handle, p_conn_sec_config); +} + + +ret_code_t pm_sec_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params) +{ + VERIFY_MODULE_INITIALIZED(); + return NRF_SUCCESS; +} + + +void pm_local_database_has_changed(void) +{ + VERIFY_MODULE_INITIALIZED_VOID(); + gcm_local_database_has_changed(); +} + + +ret_code_t pm_whitelist_create(pm_peer_id_t * p_peer_ids, + uint8_t n_peer_ids, + ble_gap_whitelist_t * p_whitelist) +{ + VERIFY_MODULE_INITIALIZED(); + return im_whitelist_create(p_peer_ids, n_peer_ids, p_whitelist); +} + + +ret_code_t pm_whitelist_custom(ble_gap_whitelist_t * p_whitelist) +{ + VERIFY_MODULE_INITIALIZED(); + return im_whitelist_custom(p_whitelist); +} + + +ret_code_t pm_conn_sec_status_get(uint16_t conn_handle, pm_conn_sec_status_t * p_conn_sec_status) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_conn_sec_status); + + ble_conn_state_status_t status = ble_conn_state_status(conn_handle); + + if (status == BLE_CONN_STATUS_INVALID) + { + return BLE_ERROR_INVALID_CONN_HANDLE; + } + + p_conn_sec_status->connected = (status == BLE_CONN_STATUS_CONNECTED); + p_conn_sec_status->bonded = ble_conn_state_user_flag_get(conn_handle, m_pm.bonding_flag_id); + p_conn_sec_status->encrypted = ble_conn_state_encrypted(conn_handle); + p_conn_sec_status->mitm_protected = ble_conn_state_mitm_protected(conn_handle); + return NRF_SUCCESS; +} + + +ret_code_t pm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key) +{ + VERIFY_MODULE_INITIALIZED(); + return sm_lesc_public_key_set(p_public_key); +} + + +ret_code_t pm_conn_handle_get(pm_peer_id_t peer_id, uint16_t * p_conn_handle) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_conn_handle); + *p_conn_handle = im_conn_handle_get(peer_id); + return NRF_SUCCESS; +} + + +ret_code_t pm_peer_id_get(uint16_t conn_handle, pm_peer_id_t * p_peer_id) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_peer_id); + *p_peer_id = im_peer_id_get_by_conn_handle(conn_handle); + return NRF_SUCCESS; +} + + +uint32_t pm_peer_count(void) +{ + if (!MODULE_INITIALIZED) + { + return 0; + } + return pdb_n_peers(); +} + + +pm_peer_id_t pm_next_peer_id_get(pm_peer_id_t prev_peer_id) +{ + if (!MODULE_INITIALIZED) + { + return PM_PEER_ID_INVALID; + } + return pdb_next_peer_id_get(prev_peer_id); +} + + +ret_code_t pm_peer_data_load(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + void * p_data, + uint16_t * p_length) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_data); + VERIFY_PARAM_NOT_NULL(p_length); + if (ALIGN_NUM(4, *p_length) != *p_length) + { + return NRF_ERROR_INVALID_PARAM; + } + + pm_peer_data_t peer_data; + memset(&peer_data, 0, sizeof(peer_data)); + peer_data.length_words = BYTES_TO_WORDS(*p_length); + peer_data.data_id = data_id; + peer_data.p_all_data = p_data; + + ret_code_t err_code = pdb_raw_read(peer_id, data_id, &peer_data); + + *p_length = peer_data.length_words * BYTES_PER_WORD; + + return err_code; +} + + +ret_code_t pm_peer_data_bonding_load(pm_peer_id_t peer_id, + pm_peer_data_bonding_t * p_data) +{ + uint16_t length = sizeof(pm_peer_data_bonding_t); + return pm_peer_data_load(peer_id, + PM_PEER_DATA_ID_BONDING, + p_data, + &length); +} + + +ret_code_t pm_peer_data_remote_db_load(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_data, + uint16_t * p_length) +{ + return pm_peer_data_load(peer_id, + PM_PEER_DATA_ID_GATT_REMOTE, + p_data, + p_length); +} + + +ret_code_t pm_peer_data_app_data_load(pm_peer_id_t peer_id, + uint8_t * p_data, + uint16_t * p_length) +{ + return pm_peer_data_load(peer_id, + PM_PEER_DATA_ID_APPLICATION, + p_data, + p_length); +} + + +ret_code_t pm_peer_data_store(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + void const * p_data, + uint16_t length, + pm_store_token_t * p_token) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_data); + if (ALIGN_NUM(4, length) != length) + { + return NRF_ERROR_INVALID_PARAM; + } + + pm_peer_data_const_t peer_data; + memset(&peer_data, 0, sizeof(peer_data)); + peer_data.length_words = BYTES_TO_WORDS(length); + peer_data.data_id = data_id; + peer_data.p_all_data = p_data; + + return pdb_raw_store(peer_id, &peer_data, p_token); +} + + +ret_code_t pm_peer_data_bonding_store(pm_peer_id_t peer_id, + pm_peer_data_bonding_t const * p_data, + pm_store_token_t * p_token) +{ + return pm_peer_data_store(peer_id, + PM_PEER_DATA_ID_BONDING, + p_data, + ALIGN_NUM(4, sizeof(pm_peer_data_bonding_t)), + p_token); +} + + +ret_code_t pm_peer_data_remote_db_store(pm_peer_id_t peer_id, + ble_gatt_db_srv_t const * p_data, + uint16_t length, + pm_store_token_t * p_token) +{ + return pm_peer_data_store(peer_id, + PM_PEER_DATA_ID_GATT_REMOTE, + p_data, + length, + p_token); +} + + +ret_code_t pm_peer_data_app_data_store(pm_peer_id_t peer_id, + uint8_t const * p_data, + uint16_t length, + pm_store_token_t * p_token) +{ + return pm_peer_data_store(peer_id, + PM_PEER_DATA_ID_APPLICATION, + p_data, + length, + p_token); +} + + +ret_code_t pm_peer_data_delete(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) +{ + VERIFY_MODULE_INITIALIZED(); + + if (data_id == PM_PEER_DATA_ID_BONDING) + { + return NRF_ERROR_INVALID_PARAM; + } + + return pdb_clear(peer_id, data_id); +} + + +ret_code_t pm_peer_new(pm_peer_id_t * p_new_peer_id, + pm_peer_data_bonding_t * p_bonding_data, + pm_store_token_t * p_token) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_bonding_data); + VERIFY_PARAM_NOT_NULL(p_new_peer_id); + ret_code_t err_code; + + *p_new_peer_id = pdb_peer_allocate(); + if (*p_new_peer_id == PM_PEER_ID_INVALID) + { + return NRF_ERROR_NO_MEM; + } + + pm_peer_data_const_t peer_data; + memset(&peer_data, 0, sizeof(pm_peer_data_const_t)); + peer_data.length_words = BYTES_TO_WORDS(sizeof(pm_peer_data_bonding_t)); + peer_data.data_id = PM_PEER_DATA_ID_BONDING; + peer_data.p_bonding_data = p_bonding_data; + + err_code = pm_peer_data_bonding_store(*p_new_peer_id, p_bonding_data, p_token); + if (err_code != NRF_SUCCESS) + { + ret_code_t err_code_free = im_peer_free(*p_new_peer_id); + if (err_code_free != NRF_SUCCESS) + { + err_code = NRF_ERROR_INTERNAL; + } + } + return err_code; +} + + +ret_code_t pm_peer_delete(pm_peer_id_t peer_id) +{ + VERIFY_MODULE_INITIALIZED(); + + return im_peer_free(peer_id); +} + + +ret_code_t pm_peers_delete(void) +{ + VERIFY_MODULE_INITIALIZED(); + + m_pm.deleting_all = true; + + pm_peer_id_t current_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); + while (current_peer_id != PM_PEER_ID_INVALID) + { + ret_code_t err_code = pm_peer_delete(current_peer_id); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + current_peer_id = pdb_next_peer_id_get(current_peer_id); + } + + return NRF_SUCCESS; +} + + +ret_code_t pm_peer_ranks_get(pm_peer_id_t * p_highest_ranked_peer, + uint32_t * p_highest_rank, + pm_peer_id_t * p_lowest_ranked_peer, + uint32_t * p_lowest_rank) +{ + VERIFY_MODULE_INITIALIZED(); + + pm_peer_id_t peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); + uint32_t peer_rank = 0; + //lint -save -e65 -e64 + pm_peer_data_t peer_data = {.length_words = BYTES_TO_WORDS(sizeof(peer_rank)), + .p_peer_rank = &peer_rank}; + //lint -restore + ret_code_t err_code = pdb_raw_read(peer_id, PM_PEER_DATA_ID_PEER_RANK, &peer_data); + uint32_t highest_rank = 0; + uint32_t lowest_rank = 0xFFFFFFFF; + pm_peer_id_t highest_ranked_peer = PM_PEER_ID_INVALID; + pm_peer_id_t lowest_ranked_peer = PM_PEER_ID_INVALID; + + if (err_code == NRF_ERROR_INVALID_PARAM) + { + // No peer IDs exist. + return NRF_ERROR_NOT_FOUND; + } + + while ((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NOT_FOUND)) + { + if (err_code == NRF_ERROR_NOT_FOUND) + { + peer_rank = 0; + } + if (peer_rank >= highest_rank) + { + highest_rank = peer_rank; + highest_ranked_peer = peer_id; + } + if (peer_rank < lowest_rank) + { + lowest_rank = peer_rank; + lowest_ranked_peer = peer_id; + } + peer_id = pdb_next_peer_id_get(peer_id); + err_code = pdb_raw_read(peer_id, PM_PEER_DATA_ID_PEER_RANK, &peer_data); + } + if (peer_id == PM_PEER_ID_INVALID) + { + err_code = NRF_SUCCESS; + if (p_highest_ranked_peer != NULL) + { + *p_highest_ranked_peer = highest_ranked_peer; + } + if (p_highest_rank != NULL) + { + *p_highest_rank = highest_rank; + } + if (p_lowest_ranked_peer != NULL) + { + *p_lowest_ranked_peer = lowest_ranked_peer; + } + if (p_lowest_rank != NULL) + { + *p_lowest_rank = lowest_rank; + } + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + return err_code; +} + + +/**@brief Function for initializing peer rank statistics. + */ +static void rank_init(void) +{ + ret_code_t err_code = pm_peer_ranks_get(&m_pm.highest_ranked_peer, + &m_pm.current_highest_peer_rank, + NULL, + NULL); + if ((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NOT_FOUND)) + { + m_pm.peer_rank_initialized = true; + } +} + + +ret_code_t pm_peer_rank_highest(pm_peer_id_t peer_id) +{ + VERIFY_MODULE_INITIALIZED(); + + ret_code_t err_code; + //lint -save -e65 -e64 + pm_peer_data_const_t peer_data = {.length_words = BYTES_TO_WORDS(sizeof(m_pm.current_highest_peer_rank)), + .data_id = PM_PEER_DATA_ID_PEER_RANK, + .p_peer_rank = &m_pm.current_highest_peer_rank}; + //lint -restore + + + if (!m_pm.peer_rank_initialized) + { + rank_init(); + } + + if (!m_pm.peer_rank_initialized || (m_pm.peer_rank_token != PM_STORE_TOKEN_INVALID)) + { + err_code = NRF_ERROR_BUSY; + } + else + { + if ((peer_id == m_pm.highest_ranked_peer) && (m_pm.current_highest_peer_rank > 0)) + { + pm_evt_t pm_evt; + + // The reported peer is already regarded as highest (provided it has an index at all) + err_code = NRF_SUCCESS; + + memset(&pm_evt, 0, sizeof(pm_evt)); + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_SUCCEEDED; + pm_evt.conn_handle = im_conn_handle_get(peer_id); + pm_evt.peer_id = peer_id; + pm_evt.params.peer_data_update_succeeded.data_id = PM_PEER_DATA_ID_PEER_RANK; + pm_evt.params.peer_data_update_succeeded.action = PM_PEER_DATA_OP_UPDATE; + pm_evt.params.peer_data_update_succeeded.token = PM_STORE_TOKEN_INVALID; + pm_evt.params.peer_data_update_succeeded.flash_changed = false; + + evt_send(&pm_evt); + } + else + { + m_pm.current_highest_peer_rank += 1; + err_code = pdb_raw_store(peer_id, &peer_data, &m_pm.peer_rank_token); + if (err_code != NRF_SUCCESS) + { + m_pm.peer_rank_token = PM_STORE_TOKEN_INVALID; + m_pm.current_highest_peer_rank -= 1; + if ((err_code != NRF_ERROR_BUSY) && (err_code != NRF_ERROR_NO_MEM)) + { + err_code = NRF_ERROR_INTERNAL; + } + } + } + } + return err_code; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h new file mode 100644 index 0000000000..5618dbbd56 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h @@ -0,0 +1,726 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/** + * @file peer_manager.h + * + * @defgroup peer_manager Peer Manager + * @ingroup ble_sdk_lib + * @{ + * @brief Module for managing BLE bonding, which includes controlling encryption and pairing + * procedures as well as persistently storing different pieces of data that must be stored + * when bonded. + * + * @details The API consists of functions for configuring the pairing and encryption behavior of the + * device and functions for manipulating the stored data. + */ + + +#ifndef PEER_MANAGER_H__ +#define PEER_MANAGER_H__ + +#include +#include +#include "sdk_common.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" +#include "peer_database.h" + + + +/**@brief Security status of a connection. + */ +typedef struct +{ + uint8_t connected : 1; /**< @brief The connection is active (not disconnected). */ + uint8_t encrypted : 1; /**< @brief Communication on this link is encrypted. */ + uint8_t mitm_protected : 1; /**< @brief The encrypted communication is also protected against man-in-the-middle attacks. */ + uint8_t bonded : 1; /**< @brief The peer is bonded with us. */ +} pm_conn_sec_status_t; + + +/**@brief Types of events that can come from the @ref peer_manager module. + */ +typedef enum +{ + PM_EVT_BONDED_PEER_CONNECTED, /**< @brief A connected peer has been identified as one with which we have a bond. When performing bonding with a peer for the first time, this event will not be sent until a new connection is established with the peer. When we are central, this event is always sent when the Peer Manager receives the @ref BLE_GAP_EVT_CONNECTED event. When we are peripheral, this event might in rare cases arrive later. */ + PM_EVT_CONN_SEC_START, /**< @brief A security procedure has started on a link, initiated either locally or remotely. The security procedure is using the last parameters provided via @ref pm_sec_params_set. This event is always followed by either a @ref PM_EVT_CONN_SEC_SUCCEEDED or a @ref PM_EVT_CONN_SEC_FAILED event. This is an informational event; no action is needed for the procedure to proceed. */ + PM_EVT_CONN_SEC_SUCCEEDED, /**< @brief A link has been encrypted, either as a result of a call to @ref pm_conn_secure or a result of an action by the peer. The event structure contains more information about the circumstances. This event might contain a peer ID with the value @ref PM_PEER_ID_INVALID, which means that the peer (central) used an address that could not be identified, but it used an encryption key (LTK) that is present in the database. */ + PM_EVT_CONN_SEC_FAILED, /**< @brief A pairing or encryption procedure has failed. In some cases, this means that security is not possible on this link (temporarily or permanently). How to handle this error depends on the application. */ + PM_EVT_CONN_SEC_CONFIG_REQ, /**< @brief The peer (central) has requested pairing, but a bond already exists with that peer. Reply by calling @ref pm_conn_sec_config_reply before the event handler returns. If no reply is sent, a default is used. */ + PM_EVT_STORAGE_FULL, /**< @brief There is no more room for peer data in flash storage. To solve this problem, delete data that is not needed anymore and run a garbage collection procedure in FDS. */ + PM_EVT_ERROR_UNEXPECTED, /**< @brief An unrecoverable error happened inside Peer Manager. An operation failed with the provided error. */ + PM_EVT_PEER_DATA_UPDATE_SUCCEEDED, /**< @brief A piece of peer data was stored, updated, or cleared in flash storage. This event is sent for all successful changes to peer data, also those initiated internally in Peer Manager. To identify an operation, compare the store token in the event with the store token received during the initiating function call. Events from internally initiated changes might have invalid store tokens. */ + PM_EVT_PEER_DATA_UPDATE_FAILED, /**< @brief A piece of peer data could not be stored, updated, or cleared in flash storage. This event is sent instead of @ref PM_EVT_PEER_DATA_UPDATE_SUCCEEDED for the failed operation. */ + PM_EVT_PEER_DELETE_SUCCEEDED, /**< @brief A peer was cleared from flash storage, for example because a call to @ref pm_peer_delete succeeded. This event can also be sent as part of a call to @ref pm_peers_delete or internal cleanup. */ + PM_EVT_PEER_DELETE_FAILED, /**< @brief A peer could not be cleared from flash storage. This event is sent instead of @ref PM_EVT_PEER_DELETE_SUCCEEDED for the failed operation. */ + PM_EVT_PEERS_DELETE_SUCCEEDED, /**< @brief A call to @ref pm_peers_delete has completed successfully. Flash storage now contains no peer data. */ + PM_EVT_PEERS_DELETE_FAILED, /**< @brief A call to @ref pm_peers_delete has failed, which means that at least one of the peers could not be deleted. Other peers might have been deleted, or might still be queued to be deleted. No more @ref PM_EVT_PEERS_DELETE_SUCCEEDED or @ref PM_EVT_PEERS_DELETE_FAILED events are sent until the next time @ref pm_peers_delete is called. */ + PM_EVT_LOCAL_DB_CACHE_APPLIED, /**< @brief Local database values for a peer (taken from flash storage) have been provided to the SoftDevice. */ + PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED, /**< @brief Local database values for a peer (taken from flash storage) were rejected by the SoftDevice, which means that either the database has changed or the user has manually set the local database to an invalid value (using @ref pm_peer_data_store). */ + PM_EVT_SERVICE_CHANGED_IND_SENT, /**< @brief A service changed indication has been sent to a peer, as a result of a call to @ref pm_local_database_has_changed. This event will be followed by a @ref PM_EVT_SERVICE_CHANGED_IND_CONFIRMED event if the peer acknowledges the indication. */ + PM_EVT_SERVICE_CHANGED_IND_CONFIRMED, /**< @brief A service changed indication that was sent has been confirmed by a peer. The peer can now be considered aware that the local database has changed. */ +} pm_evt_id_t; + + +/**@brief Parameters specific to the @ref PM_EVT_CONN_SEC_SUCCEEDED event. + */ +typedef struct +{ + pm_conn_sec_procedure_t procedure; /**< @brief The procedure that led to securing the link. */ +} pm_conn_secured_evt_t; + + +/**@brief Parameters specific to the @ref PM_EVT_CONN_SEC_FAILED event. + */ +typedef struct +{ + pm_conn_sec_procedure_t procedure; /**< @brief The procedure that failed. */ + pm_sec_error_code_t error; /**< @brief An error code that describes the failure. */ + uint8_t error_src; /**< @brief The party that raised the error, see @ref BLE_GAP_SEC_STATUS_SOURCES. */ +} pm_conn_secure_failed_evt_t; + + +/**@brief Actions that can be performed to peer data in persistent storage. + */ +typedef enum +{ + PM_PEER_DATA_OP_UPDATE, /**< @brief Writing or overwriting the data. */ + PM_PEER_DATA_OP_DELETE, /**< @brief Removing the data. */ +} pm_peer_data_op_t; + + +/**@brief Parameters specific to the @ref PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event. + */ +typedef struct +{ + pm_peer_data_id_t data_id; /**< @brief The type of the data that was changed. */ + pm_peer_data_op_t action; /**< @brief What happened to the data. */ + uint8_t flash_changed : 1; /**< @brief If this is false, no operation was done in flash, because the value was already what it should be. Please note that in certain scenarios, this flag will be true even if the new value is the same as the old. */ + pm_store_token_t token; /**< @brief Token that identifies the operation. For @ref PM_PEER_DATA_OP_DELETE actions, this token can be disregarded. For @ref PM_PEER_DATA_OP_UPDATE actions, compare this token with the token that is received from a call to a @ref PM_PEER_DATA_FUNCTIONS function. */ +} pm_peer_data_update_succeeded_evt_t; + + +/**@brief Parameters specific to the @ref PM_EVT_PEER_DATA_UPDATE_FAILED event. + */ +typedef struct +{ + pm_peer_data_id_t data_id; /**< @brief The type of the data that was supposed to be changed. */ + pm_peer_data_op_t action; /**< @brief The action that failed. */ + pm_store_token_t token; /**< @brief Token that identifies the operation. For @ref PM_PEER_DATA_OP_DELETE actions, this token can be disregarded. For @ref PM_PEER_DATA_OP_UPDATE actions, compare this token with the token that is received from a call to a @ref PM_PEER_DATA_FUNCTIONS function. */ + ret_code_t error; /**< @brief An error code that describes the failure. */ +} pm_peer_data_update_failed_t; + + +/**@brief Standard parameters for failure events. + */ +typedef struct +{ + ret_code_t error; /**< @brief The error that occurred. */ +} pm_failure_evt_t; + + +/**@brief An event from the @ref peer_manager module. + * + * @details The structure contains both standard parameters and parameters that are specific to some events. + */ +typedef struct +{ + pm_evt_id_t evt_id; /**< @brief The type of the event. */ + uint16_t conn_handle; /**< @brief The connection that this event pertains to, or @ref BLE_CONN_HANDLE_INVALID. */ + pm_peer_id_t peer_id; /**< @brief The bonded peer that this event pertains to, or @ref PM_PEER_ID_INVALID. */ + union + { + pm_conn_secured_evt_t conn_sec_succeeded; /**< @brief Parameters specific to the @ref PM_EVT_CONN_SEC_SUCCEEDED event. */ + pm_conn_secure_failed_evt_t conn_sec_failed; /**< @brief Parameters specific to the @ref PM_EVT_CONN_SEC_FAILED event. */ + pm_peer_data_update_succeeded_evt_t peer_data_update_succeeded; /**< @brief Parameters specific to the @ref PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event. */ + pm_peer_data_update_failed_t peer_data_update_failed; /**< @brief Parameters specific to the @ref PM_EVT_PEER_DATA_UPDATE_FAILED event. */ + pm_failure_evt_t peer_delete_failed; /**< @brief Parameters specific to the @ref PM_EVT_PEER_DELETE_FAILED event. */ + pm_failure_evt_t peers_delete_failed_evt; /**< @brief Parameters specific to the @ref PM_EVT_PEERS_DELETE_FAILED event. */ + pm_failure_evt_t error_unexpected; /**< @brief Parameters specific to the @ref PM_EVT_PEER_DELETE_FAILED event. */ + } params; +} pm_evt_t; + + +/**@brief Event handler for events from the @ref peer_manager module. + * + * @sa pm_register + * + * @param[in] p_event The event that has occurred. + */ +typedef void (*pm_evt_handler_t)(pm_evt_t const * p_event); + + +/**@brief Function for initializing the Peer Manager. + * + * @details You must initialize the Peer Manager before you can call any other Peer Manager + * functions. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INTERNAL If another error occurred. + */ +ret_code_t pm_init(void); + + +/**@brief Function for registering an event handler with the Peer Manager. + * + * @param[in] event_handler Callback for events from the @ref peer_manager module. @p event_handler + * is called for every event that the Peer Manager sends after this + * function is called. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_NULL If @p event_handler was NULL. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_register(pm_evt_handler_t event_handler); + + +/**@brief Function for providing pairing and bonding parameters to use for pairing procedures. + * + * @details Until this function is called, all bonding procedures that are initiated by the + * peer are rejected. + * + * This function can be called multiple times with different parameters, even with NULL as + * @p p_sec_params, in which case the Peer Manager starts rejecting all procedures again. + * + * @param[in] p_sec_params Security parameters to be used for subsequent security procedures. + * + * @retval NRF_SUCCESS If the parameters were set successfully. + * @retval NRF_ERROR_INVALID_PARAM If the combination of parameters is invalid. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + * @retval NRF_ERROR_INTERNAL If another error occurred. + */ +ret_code_t pm_sec_params_set(ble_gap_sec_params_t * p_sec_params); + + +/**@brief Function for passing BLE events to the Peer Manager. + * + * @details For the module to work as expected, this function must be called with each BLE event + * from the SoftDevice. It must be called after @ref ble_conn_state_on_ble_evt, but before + * the application processes the event. + * + * Calling this function before @ref pm_init is safe, but without effect. + * + * @param[in] p_ble_evt BLE stack event that is dispatched to the function. + */ +void pm_on_ble_evt(ble_evt_t * p_ble_evt); + + +/**@brief Function for establishing encryption on a connection, and optionally establishing a bond. + * + * @details This function attempts to secure the link that is specified by @p conn_handle. It uses + * the parameters that were previously provided in a call to @ref pm_sec_params_set. + * + * If the connection is a master connection, calling this function starts a security + * procedure on the link. If we have keys from a previous bonding procedure with this peer + * and the keys meet the security requirements in the currently active sec_params, the + * function attempts to establish encryption with the existing keys. If no key exists, the + * function attempts to pair and bond according to the currently active sec_params. + * + * If the function completes successfully, a @ref PM_EVT_CONN_SEC_START event is sent. + * The procedure might be queued, in which case the @ref PM_EVT_CONN_SEC_START event is + * delayed until the procedure is initiated in the SoftDevice. + * + * If the connection is a slave connection, the function sends a security request to + * the peer (master). It is up to the peer then to initiate pairing or encryption. + * If the peer ignores the request, a @ref BLE_GAP_EVT_TIMEOUT event occurs + * with the source @ref BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST. Otherwise, the peer initiates + * security, in which case things happen as if the peer had initiated security itself. + * See @ref PM_EVT_CONN_SEC_START for information about peer-initiated security. + * + * @param[in] conn_handle Connection handle of the link as provided by the SoftDevice. + * @param[in] force_repairing Whether to force a pairing procedure even if there is an existing + * encryption key. This argument is relevant only for + * the central role. Recommended value: false. + * + * @retval NRF_SUCCESS If the operation completed successfully. + * @retval NRF_ERROR_TIMEOUT If there was an SMP time-out, so that no more SMP + * operations can be performed on this link. + * @retval BLE_ERROR_INVALID_CONN_HANDLE If the connection handle is invalid. + * @retval NRF_ERROR_NOT_FOUND If the security parameters have not been set. + * @retval NRF_ERROR_NO_MEM If there is no more space in flash. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized, or the peer is + * disconnected or in the process of disconnecting. + * @retval NRF_ERROR_INTERNAL If another error occurred. + */ +ret_code_t pm_conn_secure(uint16_t conn_handle, bool force_repairing); + + +/**@brief Function for providing security configuration for a link. + * + * @details This function is optional, and must be called in reply to a @ref + * PM_EVT_CONN_SEC_CONFIG_REQ event, before the Peer Manager event handler returns. If it + * is not called in time, a default configuration is used. See @ref pm_conn_sec_config_t + * for the value of the default. + * + * @param[in] conn_handle The connection to set the configuration for. + * @param[in] p_conn_sec_config The configuration. + */ +void pm_conn_sec_config_reply(uint16_t conn_handle, pm_conn_sec_config_t * p_conn_sec_config); + + +/**@brief Function for manually informing that the local database has changed. + * + * @details This function sends a service changed indication to all bonded and/or connected peers + * that subscribe to this indication. If a bonded peer is not connected, the indication is + * sent when it reconnects. Every time an indication is sent, a @ref + * PM_EVT_SERVICE_CHANGED_IND_SENT event occurs, followed by a @ref + * PM_EVT_SERVICE_CHANGED_IND_CONFIRMED when the peer sends its confirmation. Peers that + * are not subscribed to the service changed indication when this function is called do not + * receive an indication, and no events are sent to the user. Likewise, if the service + * changed characteristic is not present in the local database, this no indications are + * sent peers, and no events are sent to the user. + */ +void pm_local_database_has_changed(void); + + +/**@brief Function for getting the security status of a connection. + * + * @param[in] conn_handle Connection handle of the link as provided by the SoftDevice. + * @param[out] p_conn_sec_status Security status of the link. + * + * @retval NRF_SUCCESS If pairing was initiated successfully. + * @retval BLE_ERROR_INVALID_CONN_HANDLE If the connection handle is invalid. + * @retval NRF_ERROR_NULL If @p p_conn_sec_status was NULL. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_conn_sec_status_get(uint16_t conn_handle, pm_conn_sec_status_t * p_conn_sec_status); + + +/**@brief Experimental function for specifying the public key to use for LESC operations. + * + * @details This function can be called multiple times. The specified public key will be used for + * all subsequent LESC (LE Secure Connections) operations until the next time this function + * is called. + * + * @note The key must continue to reside in application memory as it is not copied by Peer Manager. + * + * @param[in] p_public_key The public key to use for all subsequent LESC operations. + * + * @retval NRF_SUCCESS Pairing initiated successfully. + * @retval NRF_ERROR_INVALID_STATE Peer Manager is not initialized. + */ +ret_code_t pm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key); + + +/** + * @brief Function for constructing a whitelist for use when advertising. + * + * @details This function constructs a whitelist that contains the addresses and IRKs of the + * provided peer IDs. If @p p_peer_ids is NULL, the first (lowest) 8 peer IDs are chosen. + * If @ref ble_gap_whitelist_t.pp_addrs in @p p_whitelist is NULL, the whitelist contains + * only IRKs, and vice versa. + * + * @note When using a whitelist, always use the whitelist that was created or set by the most recent + * call to this function or to @ref pm_whitelist_custom. + * @note Do not call this function while advertising or scanning with another whitelist. + * + * @param[in] p_peer_ids The IDs of the peers to be added to the whitelist, or NULL. + * @param[in] n_peer_ids The number of peer IDs in @p p_peer_ids. + * @param[in,out] p_whitelist The constructed whitelist. Note that @p p_whitelist->pp_addrs + * must be NULL or point to an array with size @ref + * BLE_GAP_WHITELIST_ADDR_MAX_COUNT and @p p_whitelist->pp_irks + * must be NULL or point to an array with size @ref + * BLE_GAP_WHITELIST_IRK_MAX_COUNT. + * + * @retval NRF_SUCCESS If the whitelist was created successfully. + * @retval NRF_ERROR_NULL If @p p_whitelist was NULL. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_whitelist_create(pm_peer_id_t * p_peer_ids, + uint8_t n_peer_ids, + ble_gap_whitelist_t * p_whitelist); + + +/** + * @brief Function for informing the Peer Manager of what whitelist should be used. + * + * @details This function should be used if the application wants to use a whitelist that is + * created in the application. When using Peer Manager, this function must be called to + * inform that the custom whitelist should be used instead of the one in Peer Manager. + * + * @note When using a whitelist, always use the whitelist that was created or set by the most recent + * call to this function or to @ref pm_whitelist_create. + * @note Do not call this function while advertising or scanning with another whitelist. + * @note Do not add any IRKs to the whitelist that are not present in the Peer Manager's persistent + * storage. + * + * @param[in] p_whitelist The whitelist. + * + * @retval NRF_SUCCESS If the operation completed successfully. + * @retval NRF_ERROR_NULL If @p p_whitelist was NULL. + * @retval NRF_ERROR_NOT_FOUND If one or more of the whitelist's IRKs was not found in the Peer + * Manager's persistent storage. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_whitelist_custom(ble_gap_whitelist_t * p_whitelist); + + +/** + * @brief Function for getting the connection handle of the connection with a bonded peer. + * + * @param[in] peer_id The peer ID of the bonded peer. + * @param[out] p_conn_handle Connection handle, or @ref BLE_ERROR_INVALID_CONN_HANDLE if the peer + * is not connected. + * + * @retval NRF_SUCCESS If the connection handle was determined successfully. + * @retval NRF_ERROR_NULL If @p p_conn_handle was NULL. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_conn_handle_get(pm_peer_id_t peer_id, uint16_t * p_conn_handle); + + +/**@brief Function for getting the peer ID of a connected peer. + * + * @param[in] conn_handle Connection handle. + * @param[out] p_peer_id Peer ID, or @ref PM_PEER_ID_INVALID if the peer is not bonded or + * @p conn_handle does not refer to a connection. + * + * @retval NRF_SUCCESS If the peer ID was retrieved successfully. + * @retval NRF_ERROR_NULL If @p p_peer_id was NULL. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_peer_id_get(uint16_t conn_handle, pm_peer_id_t * p_peer_id); + + +/**@brief Function for getting the next peer ID in the sequence of all used peer IDs. + * + * @details This function can be used to loop through all used peer IDs. The order in which + * peer IDs are returned should be considered unpredictable. @ref PM_PEER_ID_INVALID + * is considered to be before the first and after the last used peer ID. + * + * @details To loop through all peer IDs exactly once, use the following constuct: + * @code{c} + * pm_peer_id_t current_peer_id = pm_next_peer_id_get(PM_PEER_ID_INVALID); + * while (current_peer_id != PM_PEER_ID_INVALID) + * { + * // Do something with current_peer_id. + * current_peer_id = pm_next_peer_id_get(current_peer_id) + * } + * @endcode + * + * @param[in] prev_peer_id The previous peer ID. + * + * @return The next peer ID. If @p prev_peer_id was @ref PM_PEER_ID_INVALID, the + * next peer ID is the first used peer ID. If @p prev_peer_id was the last + * used peer ID, the function returns @ref PM_PEER_ID_INVALID. + */ +pm_peer_id_t pm_next_peer_id_get(pm_peer_id_t prev_peer_id); + + +/**@brief Function for querying the number of valid peer IDs that are available. + * + * @details This function returns the number of peers for which there is data in persistent storage. + * + * @return The number of valid peer IDs. + */ +uint32_t pm_peer_count(void); + + + + +/**@anchor PM_PEER_DATA_FUNCTIONS + * @name Functions (Peer Data) + * Functions for manipulating peer data. + * @{ + */ + +/** + * @{ + */ + +/**@brief Function for retrieving stored data of a peer. + * + * @note The length of the provided buffer must be a multiple of 4. + * + * @param[in] peer_id Peer ID to get data for. + * @param[in] data_id Which type of data to read. + * @param[out] p_data Where to put the retrieved data. + * @param[inout] p_len In: The length in bytes of @p p_data. + * Out: The length in bytes of the read data, if the read was successful. + * + * @retval NRF_SUCCESS If the data was read successfully. + * @retval NRF_ERROR_INVALID_PARAM If the the data type or the peer ID was invalid or unallocated, + * or if the length in @p p_length was not a multiple of 4. + * @retval NRF_ERROR_NULL If a pointer parameter was NULL. + * @retval NRF_ERROR_NOT_FOUND If no stored data was found for this peer ID/data ID combination. + * @retval NRF_ERROR_DATA_SIZE If the provided buffer was not large enough. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_peer_data_load(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + void * p_data, + uint16_t * p_len); + +/**@brief Function for reading a peer's bonding data (@ref PM_PEER_DATA_ID_BONDING). + * @details See @ref pm_peer_data_load for parameters and return values. */ +ret_code_t pm_peer_data_bonding_load(pm_peer_id_t peer_id, + pm_peer_data_bonding_t * p_data); + +/**@brief Function for reading a peer's remote DB values. (@ref PM_PEER_DATA_ID_GATT_REMOTE). + * @details See @ref pm_peer_data_load for parameters and return values. */ +ret_code_t pm_peer_data_remote_db_load(pm_peer_id_t peer_id, + ble_gatt_db_srv_t * p_data, + uint16_t * p_len); + +/**@brief Function for reading a peer's application data. (@ref PM_PEER_DATA_ID_APPLICATION). + * @details See @ref pm_peer_data_load for parameters and return values. */ +ret_code_t pm_peer_data_app_data_load(pm_peer_id_t peer_id, + uint8_t * p_data, + uint16_t * p_len); +/** @}*/ + + +/** + * @{ + */ + +/**@brief Function for setting or updating stored data of a peer. + * + * @note Writing the data to persistent storage happens asynchronously. Therefore, the buffer + * that contains the data must be kept alive until the operation has completed. + * + * @note The data written using this function may later be overwritten as a result of internal + * operations in the Peer Manager. A Peer Manager event is sent each time data is updated, + * regardless of whether the operation originated internally or from action by the user. + * + * @param[in] peer_id Peer ID to set data for. + * @param[in] data_id Which type of data to set. + * @param[in] p_data New value to set. + * @param[in] len The length in bytes of @p p_data. + * @param[out] p_token A token that identifies this particular store operation. The token can be + * used to identify events that pertain to this operation. This parameter can + * be NULL. + * + * @retval NRF_SUCCESS If the data is scheduled to be written to persistent storage. + * @retval NRF_ERROR_NULL If @p p_data is NULL. + * @retval NRF_ERROR_NOT_FOUND If no peer was found for the peer ID. + * @retval NRF_ERROR_BUSY If the underlying flash handler is busy with other flash + * operations. Try again after receiving a Peer Manager event. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_peer_data_store(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + void const * p_data, + uint16_t len, + pm_store_token_t * p_token); + +/**@brief Function for setting or updating a peer's bonding data (@ref PM_PEER_DATA_ID_BONDING). + * @details See @ref pm_peer_data_store for parameters and return values. */ +ret_code_t pm_peer_data_bonding_store(pm_peer_id_t peer_id, + pm_peer_data_bonding_t const * p_data, + pm_store_token_t * p_token); + +/**@brief Function for setting or updating a peer's remote DB values. (@ref PM_PEER_DATA_ID_GATT_REMOTE). + * @details See @ref pm_peer_data_store for parameters and return values. */ +ret_code_t pm_peer_data_remote_db_store(pm_peer_id_t peer_id, + ble_gatt_db_srv_t const * p_data, + uint16_t len, + pm_store_token_t * p_token); + +/**@brief Function for setting or updating a peer's application data. (@ref PM_PEER_DATA_ID_APPLICATION). + * @details See @ref pm_peer_data_store for parameters and return values. */ +ret_code_t pm_peer_data_app_data_store(pm_peer_id_t peer_id, + uint8_t const * p_data, + uint16_t len, + pm_store_token_t * p_token); +/** @}*/ + + +/** + * @{ + */ + +/**@brief Function for deleting a peer's stored pieces of data. + * + * @details This function deletes specific data that is stored for a peer. Note that bonding data + * cannot be cleared separately. + * + * To delete all data for a peer (including bonding data), use @ref pm_peer_delete. + * + * @note Clearing data in persistent storage happens asynchronously. + * + * @param[in] peer_id Peer ID to clear data for. + * @param[in] data_id Which data to clear. + * + * @retval NRF_SUCCESS If the clear procedure was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM If @p data_id was PM_PEER_DATA_ID_BONDING or invalid, or + * @p peer_id was invalid. + * @retval NRF_ERROR_NOT_FOUND If there was no data to clear for this peer ID/data ID combination. + * @retval NRF_ERROR_BUSY If the underlying flash handler is busy with other flash + * operations. Try again after receiving a Peer Manager event. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + * @retval NRF_ERROR_INTERNAL If another error occurred. + */ +ret_code_t pm_peer_data_delete(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); + + +/**@brief Function for manually adding a peer to the persistent storage. + * + * @details This function allocates a new peer ID and stores bonding data for the new peer. The + * bonding data is necessary to prevent ambiguity/inconsistency in peer data. + * + * @param[in] p_bonding_data The bonding data of the new peer (must contain a public/static + * address or a non-zero IRK). + * @param[out] p_new_peer_id Peer ID for the new peer, or an existing peer if a match was found. + * @param[out] p_token A token that identifies this particular store operation (storing the + * bonding data). The token can be used to identify events that pertain + * to this operation. This parameter can be NULL. + * + * @retval NRF_SUCCESS If the store operation for bonding data was initiated successfully. + * @retval NRF_ERROR_NULL If @p p_bonding_data or @p p_new_peer_id is NULL. + * @retval NRF_ERROR_NO_MEM If there is no more space in persistent storage, so that the new + * peer cannot be allocated. + * @retval NRF_ERROR_BUSY If the underlying flash handler is busy with other flash + * operations. Try again after receiving a Peer Manager event. + * @retval NRF_ERROR_INVALID_PARAM If the bonding data is invalid. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_peer_new(pm_peer_id_t * p_new_peer_id, + pm_peer_data_bonding_t * p_bonding_data, + pm_store_token_t * p_token); + + +/**@brief Function for freeing persistent storage for a peer. + * + * @details This function deletes every piece of data that is associated with the specified peer and + * frees the peer ID to be used for another peer. The deletion happens asynchronously, and + * the peer ID is not freed until the data is deleted. When the operation finishes, a @ref + * PM_EVT_PEER_DELETE_SUCCEEDED or @ref PM_EVT_PEER_DELETE_FAILED event is sent. + * + * @warning Use this function only when not connected to or connectable for the peer that is being + * deleted. If the peer is or becomes connected or data is manually written in flash during + * this procedure (until the success or failure event happens), the behavior is undefined. + * + * @param[in] peer_id Peer ID to be freed and have all associated data deleted. + * + * @retval NRF_SUCCESS If the operation was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM If the peer ID was not valid. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_peer_delete(pm_peer_id_t peer_id); + + +/**@brief Function for deleting all data stored for all peers. + * + * @details This function sends either a @ref PM_EVT_PEERS_DELETE_SUCCEEDED or a @ref + * PM_EVT_PEERS_DELETE_FAILED event. In addition, a @ref PM_EVT_PEER_DELETE_SUCCEEDED or + * @ref PM_EVT_PEER_DELETE_FAILED event is sent for each deleted peer. + * + * @note No event is sent when there is no peer data in flash. + * + * @warning Use this function only when not connected or connectable. If a peer is or becomes + * connected or a @ref PM_PEER_DATA_FUNCTIONS function is used during this procedure (until + * the success or failure event happens), the behavior is undefined. + * + * @retval NRF_SUCCESS If the deletion process was initiated successfully. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + * @retval NRF_ERROR_INTERNAL If another error occurred. + */ +ret_code_t pm_peers_delete(void); +/** @}*/ + + +/** + * @{ + */ + + +/**@brief Function for finding the highest and lowest ranked peers. + * + * @details The rank is saved in persistent storage under the data ID @ref PM_PEER_DATA_ID_PEER_RANK. + * + * @details The interpretation of rank is up to the user, because the rank is only updated by + * calling @ref pm_peer_rank_highest or by manipulating the value using a @ref + * PM_PEER_DATA_FUNCTIONS function. + * + * @note Any argument that is NULL is ignored. + * + * @param[out] p_highest_ranked_peer The peer ID with the highest rank of all peers, for example, + * the most recently used peer. + * @param[out] p_highest_rank The highest rank. + * @param[out] p_lowest_ranked_peer The peer ID with the lowest rank of all peers, for example, + * the least recently used peer. + * @param[out] p_lowest_rank The lowest rank. + * + * @retval NRF_SUCCESS If the operation completed successfully. + * @retval NRF_ERROR_NOT_FOUND If no peers were found. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + * @retval NRF_ERROR_INTERNAL If another error occurred. + */ +ret_code_t pm_peer_ranks_get(pm_peer_id_t * p_highest_ranked_peer, + uint32_t * p_highest_rank, + pm_peer_id_t * p_lowest_ranked_peer, + uint32_t * p_lowest_rank); + + +/**@brief Function for updating the rank of a peer to be highest among all stored peers. + * + * @details If this function returns @ref NRF_SUCCESS, either a @ref PM_EVT_PEER_DATA_UPDATE_SUCCEEDED or a + * @ref PM_EVT_PEER_DATA_UPDATE_FAILED event is sent with a @ref + * PM_STORE_TOKEN_INVALID store token when the operation is complete. Until the operation + * is complete, this function returns @ref NRF_ERROR_BUSY. + * + * When the operation is complete, the peer is the highest ranked peer as reported by + * @ref pm_peer_ranks_get. + * + * @note The @ref PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event can arrive before the function returns if the peer + * is already ranked highest. In this case, the @ref pm_peer_data_update_succeeded_evt_t::flash_changed flag + * in the event will be false. + * + * @param[in] peer_id The peer to rank highest. + * + * @retval NRF_SUCCESS If the peer's rank is, or will be updated to be highest. + * @retval NRF_ERROR_BUSY If the underlying flash handler is busy with other flash + * operations, or if a previous call to this function has not + * completed. Try again after receiving a Peer Manager event. + * @retval NRF_ERROR_INTERNAL If another error occurred. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_peer_rank_highest(pm_peer_id_t peer_id); + +/** @}*/ + +/** @} */ + +/** @} */ + +#endif // PEER_MANAGER_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h new file mode 100644 index 0000000000..df365e2e94 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef PEER_MANAGER_INTERNAL_H__ +#define PEER_MANAGER_INTERNAL_H__ + +#include +#include "sdk_errors.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @cond NO_DOXYGEN + * @file peer_manager_types.h + * + * @addtogroup peer_manager + * @brief File containing definitions used solely inside the Peer Manager's modules. + * @{ + */ + +ANON_UNIONS_ENABLE + +/**@brief One piece of data associated with a peer, together with its type. + * + * @note This type is deprecated. + */ +typedef struct +{ + uint16_t length_words; /**< @brief The length of the data in words. */ + pm_peer_data_id_t data_id; /**< @brief ID that specifies the type of data (defines which member of the union is used). */ + union + { + pm_peer_data_bonding_t * p_bonding_data; /**< @brief The exchanged bond information in addition to metadata of the bonding. */ + uint32_t * p_peer_rank; /**< @brief A value locally assigned to this peer. Its interpretation is up to the user. The rank is not set automatically by the Peer Manager, but it is assigned by the user using either @ref pm_peer_rank_highest or a @ref PM_PEER_DATA_FUNCTIONS function. */ + bool * p_service_changed_pending; /**< @brief Whether a service changed indication should be sent to the peer. */ + pm_peer_data_local_gatt_db_t * p_local_gatt_db; /**< @brief Persistent information pertaining to a peer GATT client. */ + ble_gatt_db_srv_t * p_remote_gatt_db; /**< @brief Persistent information pertaining to a peer GATT server. */ + uint8_t * p_application_data; /**< @brief Arbitrary data to associate with the peer. This data can be freely used by the application. */ + void * p_all_data; /**< @brief Generic access pointer to the data. It is used only to handle the data without regard to type. */ + }; /**< @brief The data. */ +} pm_peer_data_t; + + +/**@brief Immutable version of @ref pm_peer_data_t. + * + * @note This type is deprecated. + */ +typedef struct +{ + uint16_t length_words; /**< @brief The length of the data in words. */ + pm_peer_data_id_t data_id; /**< @brief ID that specifies the type of data (defines which member of the union is used). */ + union + { + pm_peer_data_bonding_t const * p_bonding_data; /**< @brief Immutable @ref pm_peer_data_t::p_bonding_data. */ + uint32_t const * p_peer_rank; /**< @brief Immutable @ref pm_peer_data_t::p_peer_rank. */ + bool const * p_service_changed_pending; /**< @brief Immutable @ref pm_peer_data_t::p_service_changed_pending. */ + pm_peer_data_local_gatt_db_t const * p_local_gatt_db; /**< @brief Immutable @ref pm_peer_data_t::p_local_gatt_db. */ + ble_gatt_db_srv_t const * p_remote_gatt_db; /**< @brief Immutable @ref pm_peer_data_t::p_remote_gatt_db. */ + uint8_t const * p_application_data; /**< @brief Immutable @ref pm_peer_data_t::p_application_data. */ + void const * p_all_data; /**< @brief Immutable @ref pm_peer_data_t::p_all_data. */ + }; /**< @brief The data. */ +} pm_peer_data_const_t; + +ANON_UNIONS_DISABLE + + +/**@brief Version of @ref pm_peer_data_t that reflects the structure of peer data in flash. + * + * @note This type is deprecated. + */ +typedef pm_peer_data_const_t pm_peer_data_flash_t; + + +/**@brief Macro for calculating the flash size of bonding data. + * + * @return The number of words that the data takes in flash. + */ +#define PM_BONDING_DATA_N_WORDS() BYTES_TO_WORDS(sizeof(pm_peer_data_bonding_t)) + + +/**@brief Macro for calculating the flash size of service changed pending state. + * + * @return The number of words that the data takes in flash. + */ +#define PM_SC_STATE_N_WORDS() BYTES_TO_WORDS(sizeof(bool)) + + +/**@brief Macro for calculating the flash size of local GATT database data. + * + * @param[in] local_db_len The length, in bytes, of the database as reported by the SoftDevice. + * + * @return The number of words that the data takes in flash. + */ +#define PM_LOCAL_DB_N_WORDS(local_db_len) \ + BYTES_TO_WORDS((local_db_len) + PM_LOCAL_DB_LEN_OVERHEAD_BYTES) + + +/**@brief Macro for calculating the length of a local GATT database attribute array. + * + * @param[in] n_words The number of words that the data takes in flash. + * + * @return The length of the database attribute array. + */ +#define PM_LOCAL_DB_LEN(n_words) (((n_words) * BYTES_PER_WORD) - PM_LOCAL_DB_LEN_OVERHEAD_BYTES) + + +/**@brief Macro for calculating the flash size of remote GATT database data. + * + * @param[in] service_count The number of services in the service array. + * + * @return The number of words that the data takes in flash. + */ +#define PM_REMOTE_DB_N_WORDS(service_count) BYTES_TO_WORDS(sizeof(ble_gatt_db_srv_t) * (service_count)) + + +/**@brief Macro for calculating the flash size of remote GATT database data. + * + * @param[in] n_words The length in number of words. + * + * @return The number of words that the data takes in flash. + */ +#define PM_REMOTE_DB_N_SERVICES(n_words) (((n_words) * BYTES_PER_WORD) / sizeof(ble_gatt_db_srv_t)) + + +/**@brief Function for calculating the flash size of the usage index. + * + * @return The number of words that the data takes in flash. + */ +#define PM_USAGE_INDEX_N_WORDS() BYTES_TO_WORDS(sizeof(uint32_t)) + +/** @} + * @endcond + */ + +#endif /* PEER_MANAGER_INTERNAL_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_types.h new file mode 100644 index 0000000000..37a43b316b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_types.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/** + * @file peer_manager_types.h + * + * @addtogroup peer_manager + * @{ + */ + +#ifndef PEER_MANAGER_TYPES_H__ +#define PEER_MANAGER_TYPES_H__ + +#include +#include +#include +#include "nrf.h" +#include "nrf_ble_gap.h" +#include "nrf_ble_hci.h" +#include "app_util.h" +#include "app_util_platform.h" +#include "ble_gatt_db.h" + + +/**@brief Handle to uniquely identify a peer for which we have persistently stored data. + */ +typedef uint16_t pm_peer_id_t; + +/**@brief Type that is used for write prepares (used to reserve space in flash). + */ +typedef uint32_t pm_prepare_token_t; + +/**@brief Type that is used to hold a reference to a stored item in flash. + */ +typedef uint32_t pm_store_token_t; + +/**@brief Errors from security procedures in Peer Manager. + * + * @details Possible values are defined in @ref PM_SEC_ERRORS and @ref BLE_GAP_SEC_STATUS. + */ +typedef uint16_t pm_sec_error_code_t; + + +//lint -emacro(516,PM_LOCAL_DB_LEN_OVERHEAD_BYTES) + +#define PM_PEER_ID_INVALID 0xFFFF /**< @brief Invalid value for @ref pm_peer_id_t. */ +#define PM_STORE_TOKEN_INVALID 0 /**< @brief Invalid value for store token. */ +#define PM_PEER_ID_N_AVAILABLE_IDS 256 /**< @brief The number of available peer IDs. */ +#define PM_LOCAL_DB_LEN_OVERHEAD_BYTES offsetof(pm_peer_data_local_gatt_db_t, data) /**< @brief The static-length part of the local GATT data struct. */ + + +#define PM_CONN_SEC_ERROR_BASE 0x1000 /**< @brief The base for Peer Manager defined errors. See @ref PM_SEC_ERRORS and @ref pm_sec_error_code_t. */ + + +/**@defgroup PM_SEC_ERRORS Peer Manager defined security errors + * + * @details The first 256 numbers in this range correspond to the status codes in + * @ref BLE_HCI_STATUS_CODES. + * @{ */ +#define PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING (PM_CONN_SEC_ERROR_BASE + 0x06) /**< @brief Encryption failed because the peripheral has lost the LTK for this bond. See also @ref BLE_HCI_STATUS_CODE_PIN_OR_KEY_MISSING and Table 3.7 ("Pairing Failed Reason Codes") in the Bluetooth Core Specification 4.2, section 3.H.3.5.5 (@linkBLEcore). */ +#define PM_CONN_SEC_ERROR_MIC_FAILURE (PM_CONN_SEC_ERROR_BASE + 0x3D) /**< @brief Encryption ended with disconnection because of mismatching keys or a stray packet during a procedure. See the SoftDevice GAP Message Sequence Charts on encryption (@linkBLEMSCgap), the Bluetooth Core Specification 4.2, sections 6.B.5.1.3.1 and 3.H.3.5.5 (@linkBLEcore), and @ref BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE. */ +#define PM_CONN_SEC_ERROR_DISCONNECT (PM_CONN_SEC_ERROR_BASE + 0x100) /**< @brief Pairing or encryption did not finish before the link disconnected for an unrelated reason. */ +#define PM_CONN_SEC_ERROR_SMP_TIMEOUT (PM_CONN_SEC_ERROR_BASE + 0x101) /**< @brief Pairing/bonding could not start because an SMP time-out has already happened on this link. This means that no more pairing or bonding can happen on this link. To be able to pair or bond, the link must be disconnected and then reconnected. See Bluetooth Core Specification 4.2 section 3.H.3.4 (@linkBLEcore). */ + /** @} */ + + + +/**@defgroup PM_PEER_ID_VERSIONS All versions of Peer IDs. + * @brief The data ID for each iteration of the data formats in flash. + * @details Each time the format (in flash) of a piece of peer data changes, the data ID will also + * be updated. This list of defines is a record of each data ID that has ever existed, and + * code that caters to legacy formats can find the relevant IDs here. + * @{ */ +#define PM_PEER_DATA_ID_FIRST_VX 0 /**< @brief The smallest data ID. */ +#define PM_PEER_DATA_ID_BONDING_V1 0 /**< @brief The data ID of the first version of bonding data. */ +#define PM_PEER_DATA_ID_BONDING_V2 7 /**< @brief The data ID of the second version of bonding data. */ +#define PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING_V1 1 /**< @brief The data ID of the first version of the service changed pending flag. */ +#define PM_PEER_DATA_ID_GATT_LOCAL_V1 2 /**< @brief The data ID of the first version of local GATT data. */ +#define PM_PEER_DATA_ID_GATT_LOCAL_V2 8 /**< @brief The data ID of the second version of local GATT data. */ +#define PM_PEER_DATA_ID_GATT_REMOTE_V1 3 /**< @brief The data ID of the first version of remote GATT data. */ +#define PM_PEER_DATA_ID_APPLICATION_V1 4 /**< @brief The data ID of the first version of application data. */ +#define PM_PEER_DATA_ID_GATT_REMOTE_V2 5 /**< @brief The data ID of the second version of remote GATT data. */ +#define PM_PEER_DATA_ID_PEER_RANK_V1 6 /**< @brief The data ID of the first version of the rank. */ +#define PM_PEER_DATA_ID_LAST_VX 9 /**< @brief The data ID after the last valid one. */ +#define PM_PEER_DATA_ID_INVALID_VX 0xFF /**< @brief A data ID guaranteed to be invalid. */ +/**@}*/ + + +/**@brief The different types of data associated with a peer. + */ +typedef enum +{ + PM_PEER_DATA_ID_FIRST = PM_PEER_DATA_ID_FIRST_VX, /**< @brief The smallest data ID. */ + PM_PEER_DATA_ID_BONDING = PM_PEER_DATA_ID_BONDING_V2, /**< @brief The data ID for bonding data. See @ref pm_peer_data_bonding_t. */ + PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING = PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING_V1, /**< @brief The data ID for service changed state. */ + PM_PEER_DATA_ID_GATT_LOCAL = PM_PEER_DATA_ID_GATT_LOCAL_V2, /**< @brief The data ID for local GATT data (sys attributes). See @ref pm_peer_data_local_gatt_db_t. */ + PM_PEER_DATA_ID_GATT_REMOTE = PM_PEER_DATA_ID_GATT_REMOTE_V2, /**< @brief The data ID for remote GATT data. */ + PM_PEER_DATA_ID_PEER_RANK = PM_PEER_DATA_ID_PEER_RANK_V1, /**< @brief The data ID for peer rank. See @ref pm_peer_rank_highest. */ + PM_PEER_DATA_ID_APPLICATION = PM_PEER_DATA_ID_APPLICATION_V1, /**< @brief The data ID for application data. */ + PM_PEER_DATA_ID_LAST = PM_PEER_DATA_ID_LAST_VX, /**< @brief One more than the highest data ID. */ + PM_PEER_DATA_ID_INVALID = PM_PEER_DATA_ID_INVALID_VX, /**< @brief A data ID guaranteed to be invalid. */ +} pm_peer_data_id_t; + + +/**@brief Different procedures that can lead to an encrypted link. + */ +typedef enum +{ + PM_LINK_SECURED_PROCEDURE_ENCRYPTION, /**< @brief Using an LTK that was shared during a previous bonding procedure to encrypt the link. */ + PM_LINK_SECURED_PROCEDURE_BONDING, /**< @brief A pairing procedure, followed by a bonding procedure. */ + PM_LINK_SECURED_PROCEDURE_PAIRING, /**< @brief A pairing procedure with no bonding. */ +} pm_conn_sec_procedure_t; + + +/**@brief Configuration of a security procedure. + */ +typedef struct +{ + bool allow_repairing; /** @brief Whether to allow the peer to pair if it wants to, but is already bonded. If this is false, the procedure is rejected, and no more events are sent. Default: false. */ +} pm_conn_sec_config_t; + + +/**@brief Data associated with a bond to a peer. + */ +typedef struct +{ + uint8_t own_role; /**< @brief The role of the local device during bonding. */ + ble_gap_id_key_t peer_id; /**< @brief The peer's peer address and identity resolution key. */ + ble_gap_enc_key_t peer_ltk; /**< @brief The peer's long-term encryption key. */ + ble_gap_enc_key_t own_ltk; /**< @brief Locally generated long-term encryption key, distributed to the peer. */ +} pm_peer_data_bonding_t; + + + +/**@brief Data on a local GATT database. + */ +typedef struct +{ + uint32_t flags; /**< @brief Flags that describe the database attributes. */ + uint16_t len; /**< @brief Size of the attribute array. */ + +#ifdef __ICCARM__ //IAR dosen't support "flexible array member" in c++ compilation + uint8_t data[1]; /**< @brief Array to hold the database attributes. */ +#else + uint8_t data[]; /**< @brief Array to hold the database attributes. */ +#endif +} pm_peer_data_local_gatt_db_t; + + +/**@brief Macro to check whether a data type is valid, thus one of the valid enum values. + * + * @param[in] data_id The data type to check. + */ +#define PM_PEER_DATA_ID_IS_VALID(data_id) \ + ( ((data_id) == PM_PEER_DATA_ID_BONDING) \ + || ((data_id) == PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING)\ + || ((data_id) == PM_PEER_DATA_ID_GATT_LOCAL) \ + || ((data_id) == PM_PEER_DATA_ID_GATT_REMOTE) \ + || ((data_id) == PM_PEER_DATA_ID_PEER_RANK) \ + || ((data_id) == PM_PEER_DATA_ID_APPLICATION)) + + + /** @} */ + +#endif /* PEER_MANAGER_TYPES_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.c new file mode 100644 index 0000000000..f185b5358e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.c @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "pm_buffer.h" + +#include +#include +#include "nrf_error.h" +#include "pm_mutex.h" + + +#define BUFFER_IS_VALID(p_buffer) ((p_buffer != NULL) \ + && (p_buffer->p_memory != NULL) \ + && (p_buffer->p_mutex != NULL)) + + + +ret_code_t pm_buffer_init(pm_buffer_t * p_buffer, + uint8_t * p_buffer_memory, + uint32_t buffer_memory_size, + uint8_t * p_mutex_memory, + uint32_t mutex_memory_size, + uint32_t n_blocks, + uint32_t block_size) +{ + if ( (p_buffer != NULL) + && (p_buffer_memory != NULL) + && (p_mutex_memory != NULL) + && (buffer_memory_size >= (n_blocks*block_size)) + && (mutex_memory_size >= MUTEX_STORAGE_SIZE(n_blocks)) + && (n_blocks != 0) + && (block_size != 0)) + { + p_buffer->p_memory = p_buffer_memory; + p_buffer->p_mutex = p_mutex_memory; + p_buffer->n_blocks = n_blocks; + p_buffer->block_size = block_size; + pm_mutex_init(p_buffer->p_mutex, n_blocks); + + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_INVALID_PARAM; + } +} + + +uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks) +{ + if (!BUFFER_IS_VALID(p_buffer)) + { + return ( BUFFER_INVALID_ID ); + } + + uint8_t first_locked_mutex = BUFFER_INVALID_ID; + + for (uint8_t i = 0; i < p_buffer->n_blocks; i++) + { + if (pm_mutex_lock(p_buffer->p_mutex, i)) + { + if (first_locked_mutex == BUFFER_INVALID_ID) + { + first_locked_mutex = i; + } + if ((i - first_locked_mutex + 1) >= 0 && ((uint32_t) (i - first_locked_mutex + 1)) == n_blocks) + { + return first_locked_mutex; + } + } + else if (first_locked_mutex != BUFFER_INVALID_ID) + { + for (uint8_t j = first_locked_mutex; j < i; j++) + { + pm_buffer_release(p_buffer, j); + } + first_locked_mutex = BUFFER_INVALID_ID; + } + } + + return ( BUFFER_INVALID_ID ); +} + + +uint8_t * pm_buffer_ptr_get(pm_buffer_t * p_buffer, uint8_t id) +{ + if (!BUFFER_IS_VALID(p_buffer)) + { + return ( NULL ); + } + + if ( (id != BUFFER_INVALID_ID) + && pm_mutex_lock_status_get(p_buffer->p_mutex, id) ) + { + return ( &p_buffer->p_memory[id*p_buffer->block_size] ); + } + else + { + return ( NULL ); + } +} + + +void pm_buffer_release(pm_buffer_t * p_buffer, uint8_t id) +{ + if ( BUFFER_IS_VALID(p_buffer) + && (id != BUFFER_INVALID_ID) + && pm_mutex_lock_status_get(p_buffer->p_mutex, id)) + { + pm_mutex_unlock(p_buffer->p_mutex, id); + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.h new file mode 100644 index 0000000000..55fea30d10 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef BUFFER_H__ +#define BUFFER_H__ + +#include +#include "sdk_errors.h" +#include "pm_mutex.h" + + +/** + * @cond NO_DOXYGEN + * @defgroup pm_buffer Buffer + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. This module provides a simple buffer. + */ + + +#define BUFFER_INVALID_ID 0xFF + +#define PM_BUFFER_INIT(p_buffer, n_blocks, block_size, err_code) \ +do \ +{ \ + static union { \ + uint8_t u8[(n_blocks) * (block_size)]; \ + uint32_t u32[1]; /*force allign to uint32_t*/ \ + } buffer_memory; \ + static uint8_t mutex_memory[MUTEX_STORAGE_SIZE(n_blocks)]; \ + err_code = pm_buffer_init((p_buffer), \ + buffer_memory.u8, \ + (n_blocks) * (block_size), \ + mutex_memory, \ + MUTEX_STORAGE_SIZE(n_blocks), \ + (n_blocks), \ + (block_size)); \ +} while(0) + + +typedef struct +{ + uint8_t * p_memory; /**< The storage for all buffer entries. The size of the buffer must be n_blocks*block_size. */ + uint8_t * p_mutex; /**< A mutex group with one mutex for each buffer entry. */ + uint32_t n_blocks; /**< The number of allocatable blocks in the buffer. */ + uint32_t block_size; /**< The size of each block in the buffer. */ +} pm_buffer_t; + +/**@brief Function for initializing a buffer instance. + * + * @param[out] p_buffer The buffer instance to initialize. + * @param[in] p_buffer_memory The memory this buffer will use. + * @param[in] buffer_memory_size The size of p_buffer_memory. This must be at least + * n_blocks*block_size. + * @param[in] p_mutex_memory The memory for the mutexes. This must be at least + * @ref MUTEX_STORAGE_SIZE(n_blocks). + * @param[in] mutex_memory_size The size of p_mutex_memory. + * @param[in] n_blocks The number of blocks in the buffer. + * @param[in] block_size The size of each block. + * + * @retval NRF_SUCCESS Successfully initialized buffer instance. + * @retval NRF_ERROR_INVALID_PARAM A parameter was 0 or NULL or a size was too small. + */ +ret_code_t pm_buffer_init(pm_buffer_t * p_buffer, + uint8_t * p_buffer_memory, + uint32_t buffer_memory_size, + uint8_t * p_mutex_memory, + uint32_t mutex_memory_size, + uint32_t n_blocks, + uint32_t block_size); + + +/**@brief Function for acquiring a buffer block in a buffer. + * + * @param[in] p_buffer The buffer instance acquire from. + * @param[in] n_blocks The number of contiguous blocks to acquire. + * + * @return The id of the acquired block, if successful. + * @retval BUFFER_INVALID_ID If unsuccessful. + */ +uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks); + + +/**@brief Function for getting a pointer to a specific buffer block. + * + * @param[in] p_buffer The buffer instance get from. + * @param[in] id The id of the buffer to get the pointer for. + * + * @return A pointer to the buffer for the specified id, if the id is valid. + * @retval NULL If the id is invalid. + */ +uint8_t * pm_buffer_ptr_get(pm_buffer_t * p_buffer, uint8_t id); + + +/**@brief Function for releasing a buffer block. + * + * @param[in] p_buffer The buffer instance containing the block to release. + * @param[in] id The id of the block to release. + */ +void pm_buffer_release(pm_buffer_t * p_buffer, uint8_t id); + + +#endif // BUFFER_H__ + +/** + * @} + * @endcond + */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.c new file mode 100644 index 0000000000..1758108d34 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.c @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "pm_mutex.h" + +#include +#include +#include "nrf_error.h" +#include "app_util_platform.h" + + + +/**@brief Locks the mutex defined by the mask. + * + * @param p_mutex pointer to the mutex storage. + * @param mutex_mask the mask identifying the mutex position. + * + * @retval true if the mutex could be locked. + * @retval false if the mutex was already locked. + */ +static bool lock_by_mask(uint8_t * p_mutex, uint8_t mutex_mask) +{ + bool success = false; + + if ( (*p_mutex & mutex_mask) == 0 ) + { + CRITICAL_REGION_ENTER(); + if ( (*p_mutex & mutex_mask) == 0 ) + { + *p_mutex |= mutex_mask; + + success = true; + } + CRITICAL_REGION_EXIT(); + } + + return ( success ); +} + + +void pm_mutex_init(uint8_t * p_mutex, uint16_t mutex_size) +{ + if (p_mutex != NULL) + { + memset(&p_mutex[0], 0, MUTEX_STORAGE_SIZE(mutex_size)); + } +} + + +bool pm_mutex_lock(uint8_t * p_mutex, uint16_t mutex_id) +{ + if (p_mutex != NULL) + { + return ( lock_by_mask(&(p_mutex[mutex_id >> 3]), (1 << (mutex_id & 0x07))) ); + } + else + { + return false; + } +} + + +void pm_mutex_unlock(uint8_t * p_mutex, uint16_t mutex_id) +{ + uint8_t mutex_base = mutex_id >> 3; + uint8_t mutex_mask = (1 << (mutex_id & 0x07)); + + if ((p_mutex != NULL) + && (p_mutex[mutex_base] & mutex_mask)) + { + CRITICAL_REGION_ENTER(); + p_mutex[mutex_base] &= ~mutex_mask; + CRITICAL_REGION_EXIT(); + } +} + + +uint16_t pm_mutex_lock_first_available(uint8_t * p_mutex, uint16_t mutex_size) +{ + if (p_mutex != NULL) + { + for ( uint16_t i = 0; i < mutex_size; i++ ) + { + if ( lock_by_mask(&(p_mutex[i >> 3]), 1 << (i & 0x07)) ) + { + return ( i ); + } + } + } + + return ( mutex_size ); +} + + +bool pm_mutex_lock_status_get(uint8_t * p_mutex, uint16_t mutex_id) +{ + if (p_mutex != NULL) + { + return ( (p_mutex[mutex_id >> 3] & (1 << (mutex_id & 0x07))) ); + } + else + { + return true; + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.h new file mode 100644 index 0000000000..abc2446921 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef MUTEX_H__ +#define MUTEX_H__ + + +#include +#include + +/** + * @cond NO_DOXYGEN + * @defgroup pm_mutex Mutex + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. This module provides thread-safe mutexes. + */ + + +/**@brief Defines the storage size of a specified mutex group. + * + * @param number_of_mutexes the number of mutexes in the group. + */ +#define MUTEX_STORAGE_SIZE(number_of_mutexes) ((7 + (number_of_mutexes)) >> 3) + + +/**@brief Initializes a mutex group. + * + * @param[in] p_mutex Pointer to the mutex group. See @ref MUTEX_STORAGE_SIZE(). + * @param[in] mutex_size The size of the mutex group in number of mutexes. + */ +void pm_mutex_init(uint8_t * p_mutex, uint16_t mutex_size); + + +/**@brief Locks the mutex specified by the bit id. + * + * @param[inout] p_mutex Pointer to the mutex group. + * @param[in] mutex_bit_id The bit id of the mutex. + * + * @retval true if it was possible to lock the mutex. + * @retval false otherwise. + */ +bool pm_mutex_lock(uint8_t * p_mutex, uint16_t mutex_bit_id); + + +/**@brief Locks the first unlocked mutex within the mutex group. + * + * @param[in, out] p_mutex Pointer to the mutex group. + * @param[in] mutex_size The size of the mutex group. + * + * @return The first unlocked mutex id in the group. + * @retval group-size if there was no unlocked mutex available. + */ +uint16_t pm_mutex_lock_first_available(uint8_t * p_mutex, uint16_t mutex_size); + + +/**@brief Unlocks the mutex specified by the bit id. + * + * @param[in, out] p_mutex Pointer to the mutex group. + * @param[in] mutex_bit_id The bit id of the mutex. + */ +void pm_mutex_unlock(uint8_t * p_mutex, uint16_t mutex_bit_id); + + +/**@brief Gets the locking status of the specified mutex. + * + * @param[in, out] p_mutex Pointer to the mutex group. + * @param[in] mutex_bit_id The bit id of the mutex. + * + * @retval true if the mutex was locked. + * @retval false otherwise. + */ +bool pm_mutex_lock_status_get(uint8_t * p_mutex, uint16_t mutex_bit_id); + + +#endif // MUTEX_H__ + +/** @} + * @endcond + */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c new file mode 100644 index 0000000000..f35d701e79 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c @@ -0,0 +1,910 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "security_dispatcher.h" + +#include +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_database.h" +#include "id_manager.h" +#include "sdk_common.h" + + +#define MAX_REGISTRANTS 3 /**< The number of user that can register with the module. */ + + +typedef struct +{ + smd_evt_handler_t evt_handlers[MAX_REGISTRANTS]; + uint8_t n_registrants; + ble_conn_state_user_flag_id_t flag_id_sec_proc; + ble_conn_state_user_flag_id_t flag_id_sec_proc_pairing; + ble_conn_state_user_flag_id_t flag_id_sec_proc_new_peer; + ble_gap_lesc_p256_pk_t peer_pk; +} smd_t; + + +static smd_t m_smd = +{ + .flag_id_sec_proc = BLE_CONN_STATE_USER_FLAG_INVALID, + .flag_id_sec_proc_pairing = BLE_CONN_STATE_USER_FLAG_INVALID, + .flag_id_sec_proc_new_peer = BLE_CONN_STATE_USER_FLAG_INVALID, +}; + + +#define MODULE_INITIALIZED (m_smd.n_registrants > 0) /**< Expression which is true when the module is initialized. */ +#include "sdk_macros.h" + + +static void evt_send(smd_evt_t * p_event) +{ + for (int i = 0; i < m_smd.n_registrants; i++) + { + m_smd.evt_handlers[i](p_event); + } +} + + +static void sec_start_send(uint16_t conn_handle, pm_conn_sec_procedure_t procedure) +{ + smd_evt_t evt = + { + .evt_id = SMD_EVT_SEC_PROCEDURE_START, + .conn_handle = conn_handle, + .params = {.sec_procedure_start = {.procedure = procedure}} + }; + evt_send(&evt); +} + + +/**@brief Event handler for events from the peer_database module. + * + * @param[in] p_event The event that has happened. + */ +static void pdb_evt_handler(pdb_evt_t const * p_event) +{ + if ((p_event->evt_id == PDB_EVT_WRITE_BUF_STORED) && (p_event->data_id == PM_PEER_DATA_ID_BONDING)) + { + smd_evt_t evt = + { + .evt_id = SMD_EVT_BONDING_INFO_STORED, + .conn_handle = im_conn_handle_get(p_event->peer_id), + .params = {.bonding_info_stored = + { + .peer_id = p_event->peer_id, + }} + }; + evt_send(&evt); + } +} + + +/**@brief Function for processing the @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST event from the SoftDevice. + * + * @param[in] p_gap_evt The event from the SoftDevice. + */ +static void sec_params_request_process(ble_gap_evt_t * p_gap_evt) +{ + smd_evt_t evt = + { + .evt_id = SMD_EVT_PARAMS_REQ, + .conn_handle = p_gap_evt->conn_handle + }; + evt_send(&evt); + return; +} + + +/**@brief Function for administrative actions to be taken when a security process has been attempted. + * + * @param[in] conn_handle The connection the security process was attempted on. + * @param[in] peer_id The peer ID given to the connected peer. + * @param[in] success Whether the process was started successfully. + * @param[in] pairing Whether the process was a pairing process. + * @param[in] new_peer_created Whether a new peer was created during the process attempt. + */ +static void sec_proc_start(uint16_t conn_handle, + pm_peer_id_t peer_id, + bool success, + bool pairing, + bool new_peer_created) +{ + ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc, success); + + if (success) + { + ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc_pairing, pairing); + ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc_new_peer, new_peer_created); + + if(new_peer_created) + { + im_new_peer_id(conn_handle, peer_id); + } + } + else + { + if(new_peer_created) + { + ret_code_t err_code = im_peer_free(peer_id); // Attempt to free allocated peer. + UNUSED_VARIABLE(err_code); + } + } +} + + + +/**@brief Function for processing the @ref BLE_GAP_EVT_SEC_INFO_REQUEST event from the SoftDevice. + * + * @param[in] p_gap_evt The event from the SoftDevice. + */ +static void sec_info_request_process(ble_gap_evt_t * p_gap_evt) +{ + ret_code_t err_code; + ble_gap_enc_info_t const * p_enc_info = NULL; + pm_peer_data_flash_t peer_data; + pm_peer_id_t peer_id = im_peer_id_get_by_master_id(&p_gap_evt->params.sec_info_request.master_id); + smd_evt_t evt; + + evt.conn_handle = p_gap_evt->conn_handle; + + if (peer_id == PM_PEER_ID_INVALID) + { + peer_id = im_peer_id_get_by_conn_handle(p_gap_evt->conn_handle); + } + + if (peer_id != PM_PEER_ID_INVALID) + { + err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, &peer_data, NULL); + + if (err_code == NRF_SUCCESS) + { + // There is stored bonding data for this peer. + ble_gap_enc_key_t const * p_existing_key = &peer_data.p_bonding_data->own_ltk; + + if ( p_existing_key->enc_info.lesc + || (im_master_ids_compare(&p_existing_key->master_id, + &p_gap_evt->params.sec_info_request.master_id))) + { + p_enc_info = &p_existing_key->enc_info; + } + } + } + + // All return values from the following can be safely ignored. + err_code = sd_ble_gap_sec_info_reply(p_gap_evt->conn_handle, p_enc_info, NULL, NULL); + + if (err_code != NRF_SUCCESS) + { + evt.evt_id = SMD_EVT_ERROR_UNEXPECTED; + evt.params.error_unexpected.error = err_code; + + evt_send(&evt); + } + else if (p_enc_info == NULL) + { + evt.evt_id = SMD_EVT_LINK_ENCRYPTION_FAILED; + evt.params.link_encryption_failed.error = PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING; + evt.params.link_encryption_failed.error_src = BLE_GAP_SEC_STATUS_SOURCE_LOCAL; + + evt_send(&evt); + + sec_proc_start(p_gap_evt->conn_handle, peer_id, false, false, false); + } + else + { + sec_start_send(p_gap_evt->conn_handle, PM_LINK_SECURED_PROCEDURE_ENCRYPTION); + + sec_proc_start(p_gap_evt->conn_handle, peer_id, err_code == NRF_SUCCESS, false, false); + } + + + return; +} + + +/**@brief Function for processing the @ref BLE_GAP_EVT_SEC_REQUEST event from the SoftDevice. + * + * @param[in] p_gap_evt The event from the SoftDevice. + */ +static void sec_request_process(ble_gap_evt_t * p_gap_evt) +{ + smd_evt_t evt = + { + .evt_id = SMD_EVT_SLAVE_SECURITY_REQ, + .conn_handle = p_gap_evt->conn_handle, + .params = + { + .slave_security_req = + { + .bond = p_gap_evt->params.sec_request.bond, + .mitm = p_gap_evt->params.sec_request.mitm, + } + } + }; + evt_send(&evt); + return; +} + + +/**@brief Function for processing the @ref BLE_GAP_EVT_AUTH_STATUS event from the SoftDevice, when + * the auth_status is success. + * + * @param[in] p_gap_evt The event from the SoftDevice. + */ +static void auth_status_success_process(ble_gap_evt_t * p_gap_evt) +{ + ret_code_t err_code = NRF_SUCCESS; + uint8_t role = ble_conn_state_role(p_gap_evt->conn_handle); + pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(p_gap_evt->conn_handle); + ble_gap_sec_kdist_t kdist_own = p_gap_evt->params.auth_status.kdist_own; + ble_gap_sec_kdist_t kdist_peer = p_gap_evt->params.auth_status.kdist_peer; + + ble_conn_state_user_flag_set(p_gap_evt->conn_handle, m_smd.flag_id_sec_proc, false); + + if (role == BLE_GAP_ROLE_INVALID) + { + /* Unlikely, but maybe possible? */ + return; + } + + if (p_gap_evt->params.auth_status.bonded) + { + + err_code = pdb_write_buf_store(peer_id, PM_PEER_DATA_ID_BONDING); + if (err_code != NRF_SUCCESS) + { + /* Unexpected */ + smd_evt_t error_evt; + + error_evt.evt_id = SMD_EVT_ERROR_BONDING_INFO; + error_evt.conn_handle = p_gap_evt->conn_handle; + error_evt.params.error_bonding_info.peer_id = peer_id; + error_evt.params.error_bonding_info.error = err_code; + + evt_send(&error_evt); + } + + } + else if (ble_conn_state_user_flag_get(p_gap_evt->conn_handle, m_smd.flag_id_sec_proc_new_peer)) + { + ret_code_t err_code_free = im_peer_free(peer_id); + UNUSED_VARIABLE(err_code_free); // Errors can be safely ignored. + } + + smd_evt_t pairing_success_evt; + + pairing_success_evt.evt_id = SMD_EVT_PAIRING_SUCCESS; + pairing_success_evt.conn_handle = p_gap_evt->conn_handle; + pairing_success_evt.params.pairing_success.bonded = p_gap_evt->params.auth_status.bonded; + pairing_success_evt.params.pairing_success.mitm = p_gap_evt->params.auth_status.sm1_levels.lv3; + pairing_success_evt.params.pairing_success.kdist_own = kdist_own; + pairing_success_evt.params.pairing_success.kdist_peer = kdist_peer; + + evt_send(&pairing_success_evt); + return; +} + + +/**@brief Function for cleaning up after a failed pairing procedure. + * + * @param[in] conn_handle The handle of the connection the pairing procedure happens on. + * @param[in] peer_id The peer id used in the pairing procedure. + * @param[in] error The error the procedure failed with. + * @param[in] error_src The party that raised the error. See @ref BLE_GAP_SEC_STATUS_SOURCES. + */ +static void pairing_failure(uint16_t conn_handle, + pm_peer_id_t peer_id, + pm_sec_error_code_t error, + uint8_t error_src) +{ + ret_code_t err_code = NRF_SUCCESS; + + smd_evt_t evt = + { + .evt_id = SMD_EVT_PAIRING_FAIL, + .conn_handle = conn_handle, + .params = + { + .pairing_failed = + { + .error = error, + .error_src = error_src, + } + } + }; + + if(ble_conn_state_user_flag_get(conn_handle, m_smd.flag_id_sec_proc_new_peer)) + { + // The peer_id was created during the procedure, and should be freed, because no data is + // stored under it. + err_code = im_peer_free(peer_id); // Attempt to free allocated peer. + UNUSED_VARIABLE(err_code); + } + else + { + err_code = pdb_write_buf_release(peer_id, PM_PEER_DATA_ID_BONDING); + if ((err_code != NRF_SUCCESS) && (err_code == NRF_ERROR_NOT_FOUND /* No buffer was allocated */)) + { + smd_evt_t error_evt; + error_evt.evt_id = SMD_EVT_ERROR_UNEXPECTED; + error_evt.conn_handle = conn_handle; + error_evt.params.error_unexpected.error = err_code; + evt_send(&error_evt); + } + } + + ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc, false); + + evt_send(&evt); + return; +} + + +/**@brief Function for cleaning up after a failed encryption procedure. + * + * @param[in] conn_handle The handle of the connection the encryption procedure happens on. + * @param[in] error The error the procedure failed with. + * @param[in] error_src The party that raised the error. See @ref BLE_GAP_SEC_STATUS_SOURCES. + */ +static void encryption_failure(uint16_t conn_handle, + pm_sec_error_code_t error, + uint8_t error_src) +{ + smd_evt_t evt = + { + .evt_id = SMD_EVT_LINK_ENCRYPTION_FAILED, + .conn_handle = conn_handle, + .params = + { + .link_encryption_failed = + { + .error = error, + .error_src = error_src, + } + } + }; + + ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc, false); + + evt_send(&evt); + return; +} + + +/**@brief Function for possibly cleaning up after a failed pairing or encryption procedure. + * + * @param[in] conn_handle The handle of the connection the pairing procedure happens on. + * @param[in] peer_id The peer id used in the pairing procedure. + * @param[in] error The error the procedure failed with. + * @param[in] error_src The party that raised the error. See @ref BLE_GAP_SEC_STATUS_SOURCES. + */ +static void link_secure_failure(uint16_t conn_handle, + pm_sec_error_code_t error, + uint8_t error_src) +{ + if (ble_conn_state_user_flag_get(conn_handle, m_smd.flag_id_sec_proc)) + { + pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(conn_handle); + + if (peer_id != PM_PEER_ID_INVALID) + { + if (ble_conn_state_user_flag_get(conn_handle, m_smd.flag_id_sec_proc_pairing)) + { + pairing_failure(conn_handle, peer_id, error, error_src); + } + else + { + encryption_failure(conn_handle, error, error_src); + } + } + } +} + + +/**@brief Function for processing the @ref BLE_GAP_EVT_DISCONNECT event from the SoftDevice. + * + * @param[in] p_gap_evt The event from the SoftDevice. + */ +static void disconnect_process(ble_gap_evt_t * p_gap_evt) +{ + pm_sec_error_code_t error = (p_gap_evt->params.disconnected.reason + == BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE) + ? PM_CONN_SEC_ERROR_MIC_FAILURE : PM_CONN_SEC_ERROR_DISCONNECT; + + link_secure_failure(p_gap_evt->conn_handle, error, BLE_GAP_SEC_STATUS_SOURCE_LOCAL); +} + + +/**@brief Function for processing the @ref BLE_GAP_EVT_AUTH_STATUS event from the SoftDevice, when + * the auth_status is failure. + * + * @param[in] p_gap_evt The event from the SoftDevice. + */ +static void auth_status_failure_process(ble_gap_evt_t * p_gap_evt) +{ + link_secure_failure(p_gap_evt->conn_handle, + p_gap_evt->params.auth_status.auth_status, + p_gap_evt->params.auth_status.error_src); +} + + +/**@brief Function for processing the @ref BLE_GAP_EVT_AUTH_STATUS event from the SoftDevice. + * + * @param[in] p_gap_evt The event from the SoftDevice. + */ +static void auth_status_process(ble_gap_evt_t * p_gap_evt) +{ + switch (p_gap_evt->params.auth_status.auth_status) + { + case BLE_GAP_SEC_STATUS_SUCCESS: + auth_status_success_process(p_gap_evt); + break; + + default: + auth_status_failure_process(p_gap_evt); + break; + } +} + + +/**@brief Function for processing the @ref BLE_GAP_EVT_CONN_SEC_UPDATE event from the SoftDevice. + * + * @param[in] p_gap_evt The event from the SoftDevice. + */ +static void conn_sec_update_process(ble_gap_evt_t * p_gap_evt) +{ + if (ble_conn_state_encrypted(p_gap_evt->conn_handle)) + { + if (!ble_conn_state_user_flag_get(p_gap_evt->conn_handle, m_smd.flag_id_sec_proc_pairing)) + { + ble_conn_state_user_flag_set(p_gap_evt->conn_handle, m_smd.flag_id_sec_proc, false); + } + + smd_evt_t evt; + + evt.conn_handle = p_gap_evt->conn_handle; + evt.evt_id = SMD_EVT_LINK_ENCRYPTION_UPDATE; + evt.params.link_encryption_update.mitm_protected + = ble_conn_state_mitm_protected(p_gap_evt->conn_handle); + evt_send(&evt); + } + else + { + encryption_failure(p_gap_evt->conn_handle, + PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING, + BLE_GAP_SEC_STATUS_SOURCE_REMOTE); + } +} + + +/**@brief Funtion for initializing a BLE Connection State user flag. + * + * @param[out] flag_id The flag to initialize. + */ +static void flag_id_init(ble_conn_state_user_flag_id_t * p_flag_id) +{ + if (*p_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) + { + *p_flag_id = ble_conn_state_user_flag_acquire(); + } +} + + +ret_code_t smd_register(smd_evt_handler_t evt_handler) +{ + ret_code_t err_code = NRF_SUCCESS; + if (evt_handler == NULL) + { + err_code = NRF_ERROR_NULL; + } + else + { + if (!MODULE_INITIALIZED) + { + flag_id_init(&m_smd.flag_id_sec_proc); + flag_id_init(&m_smd.flag_id_sec_proc_pairing); + flag_id_init(&m_smd.flag_id_sec_proc_new_peer); + + if (m_smd.flag_id_sec_proc_new_peer == BLE_CONN_STATE_USER_FLAG_INVALID) + { + err_code = NRF_ERROR_INTERNAL; + } + else + { + err_code = pdb_register(pdb_evt_handler); + } + } + if ((err_code == NRF_SUCCESS)) + { + if ((m_smd.n_registrants < MAX_REGISTRANTS)) + { + m_smd.evt_handlers[m_smd.n_registrants++] = evt_handler; + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + } + } + return err_code; +} + + +ret_code_t smd_params_reply(uint16_t conn_handle, + ble_gap_sec_params_t * p_sec_params, + ble_gap_lesc_p256_pk_t * p_public_key) +{ + VERIFY_MODULE_INITIALIZED(); + + uint8_t role = ble_conn_state_role(conn_handle); + pm_peer_id_t peer_id = PM_PEER_ID_INVALID; + ret_code_t err_code = NRF_SUCCESS; + uint8_t sec_status = BLE_GAP_SEC_STATUS_SUCCESS; + ble_gap_sec_keyset_t sec_keyset; + bool new_peer_created = false; + + memset(&sec_keyset, 0, sizeof(ble_gap_sec_keyset_t)); + + if (role == BLE_GAP_ROLE_INVALID) + { + return BLE_ERROR_INVALID_CONN_HANDLE; + } + + if (p_sec_params == NULL) + { + // NULL params means reject pairing. + sec_status = BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP; + } + else if (p_sec_params->bond) + { + // Bonding is to be performed, prepare to receive bonding data. + pm_peer_data_t peer_data; + + peer_id = im_peer_id_get_by_conn_handle(conn_handle); + + if (peer_id == PM_PEER_ID_INVALID) + { + // Peer is unknown to us, allocate a new peer ID for it. + peer_id = pdb_peer_allocate(); + if (peer_id != PM_PEER_ID_INVALID) + { + new_peer_created = true; + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + + if (err_code == NRF_SUCCESS) + { + // Peer ID is ready, acquire a memory buffer to receive bonding data into. + err_code = pdb_write_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, 1, &peer_data); + if (err_code == NRF_SUCCESS) + { + memset(peer_data.p_bonding_data, 0, sizeof(pm_peer_data_bonding_t)); + + peer_data.p_bonding_data->own_role = role; + + sec_keyset.keys_own.p_enc_key = &peer_data.p_bonding_data->own_ltk; + sec_keyset.keys_own.p_pk = p_public_key; + sec_keyset.keys_peer.p_enc_key = &peer_data.p_bonding_data->peer_ltk; + sec_keyset.keys_peer.p_id_key = &peer_data.p_bonding_data->peer_id; + sec_keyset.keys_peer.p_pk = &m_smd.peer_pk; + + ret_code_t err_code_addr = im_ble_addr_get(conn_handle, &peer_data.p_bonding_data->peer_id.id_addr_info); // Retrieve the address the peer used during connection establishment. This address will be overwritten if ID is shared. Should not fail. + UNUSED_VARIABLE(err_code_addr); + + // Buffer is OK, reserve room in flash for the data. + err_code = pdb_write_buf_store_prepare(peer_id, PM_PEER_DATA_ID_BONDING); + } + } + } + else + { + // Pairing only, no action needed. + } + + if (err_code == NRF_SUCCESS) + { + // Everything OK, reply to SoftDevice. If an error happened, the user is given an + // opportunity to change the parameters and retry the call. + if (role == BLE_GAP_ROLE_CENTRAL) + { + err_code = sd_ble_gap_sec_params_reply(conn_handle, sec_status, NULL, &sec_keyset); + } + else + { + err_code = sd_ble_gap_sec_params_reply(conn_handle, sec_status, p_sec_params, &sec_keyset); + + if ((p_sec_params != NULL) && (err_code == NRF_SUCCESS)) + { + pm_conn_sec_procedure_t procedure = p_sec_params->bond + ? PM_LINK_SECURED_PROCEDURE_BONDING + : PM_LINK_SECURED_PROCEDURE_PAIRING; + sec_start_send(conn_handle, procedure); + } + } + } + + sec_proc_start(conn_handle, + peer_id, + (err_code == NRF_SUCCESS) && (sec_status != BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP), + true, + new_peer_created); + + return err_code; +} + + +static ret_code_t link_secure_central_existing_peer(uint16_t conn_handle, + ble_gap_sec_params_t * p_sec_params, + bool force_repairing, + pm_peer_id_t peer_id, + pm_conn_sec_procedure_t * procedure) +{ + pm_peer_data_flash_t peer_data; + pm_peer_data_t dummy_peer_data; + ret_code_t err_code; + ble_gap_enc_key_t const * p_existing_key = NULL; + bool lesc = false; + + err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, &peer_data, NULL); + + if (err_code == NRF_SUCCESS) + { + // Use peer's key since they are peripheral. + p_existing_key = &(peer_data.p_bonding_data->peer_ltk); + + lesc = peer_data.p_bonding_data->own_ltk.enc_info.lesc; + if (lesc) // LESC was used during bonding. + { + // For LESC, always use own key. + p_existing_key = &(peer_data.p_bonding_data->own_ltk); + } + } + + if (!force_repairing + && (err_code == NRF_SUCCESS) + && (p_existing_key != NULL) + && (lesc || im_master_id_is_valid(&(p_existing_key->master_id)))) /* There is a valid LTK stored. */ + //&& (p_existing_key->enc_info.auth >= p_sec_params->mitm) /* The requested MITM security is at or below the existing level. */ + //&& (!p_sec_params->mitm || (lesc >= p_sec_params->lesc))) /* The requested LESC security is at or below the existing level. We only care about LESC if MITM is required. */ + { + err_code = sd_ble_gap_encrypt(conn_handle, &(p_existing_key->master_id), &(p_existing_key->enc_info)); + + *procedure = PM_LINK_SECURED_PROCEDURE_ENCRYPTION; + } + else if ((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NOT_FOUND)) + { + /* Re-pairing is needed, because there is no LTK available or the existing key is not + secure enough */ + err_code = NRF_SUCCESS; + + if (p_sec_params->bond) + { + err_code = pdb_write_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, 1, &dummy_peer_data); + if (err_code == NRF_SUCCESS) + { + err_code = pdb_write_buf_store_prepare(peer_id, PM_PEER_DATA_ID_BONDING); + } + } + + if (err_code == NRF_SUCCESS) + { + err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); + } + + if (err_code != NRF_SUCCESS) + { + ret_code_t err_code_release = pdb_write_buf_release(peer_id, PM_PEER_DATA_ID_BONDING); + if ((err_code_release != NRF_SUCCESS) && (err_code_release != NRF_ERROR_NOT_FOUND)) + { + err_code = NRF_ERROR_INTERNAL; + } + } + } + + sec_proc_start(conn_handle, + peer_id, + err_code == NRF_SUCCESS, + *procedure != PM_LINK_SECURED_PROCEDURE_ENCRYPTION, + false); + + return err_code; +} + + +static ret_code_t link_secure_central_new_peer(uint16_t conn_handle, + ble_gap_sec_params_t * p_sec_params) +{ + pm_peer_id_t peer_id = pdb_peer_allocate(); + pm_peer_data_t dummy_peer_data; + ret_code_t err_code; + + if (peer_id != PM_PEER_ID_INVALID) + { + err_code = pdb_write_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, 1, &dummy_peer_data); + if (err_code == NRF_SUCCESS) + { + err_code = pdb_write_buf_store_prepare(peer_id, PM_PEER_DATA_ID_BONDING); + } + + if (err_code == NRF_SUCCESS) + { + err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); + } + + if (err_code != NRF_SUCCESS) + { + ret_code_t err_code_free = pdb_write_buf_release(peer_id, PM_PEER_DATA_ID_BONDING); + if ((err_code_free != NRF_SUCCESS) && (err_code_free != NRF_ERROR_NOT_FOUND)) + { + err_code = NRF_ERROR_INTERNAL; + } + } + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + + sec_proc_start(conn_handle, + peer_id, + err_code == NRF_SUCCESS, + true, + peer_id != PM_PEER_ID_INVALID); + + return err_code; +} + + +static ret_code_t link_secure_central(uint16_t conn_handle, + ble_gap_sec_params_t * p_sec_params, + bool force_repairing) +{ + ret_code_t err_code; + pm_peer_id_t peer_id; + + if (p_sec_params == NULL) + { + return sd_ble_gap_authenticate(conn_handle, NULL); + } + + pm_conn_sec_procedure_t procedure = p_sec_params->bond ? PM_LINK_SECURED_PROCEDURE_BONDING + : PM_LINK_SECURED_PROCEDURE_PAIRING; + + peer_id = im_peer_id_get_by_conn_handle(conn_handle); + + if (peer_id != PM_PEER_ID_INVALID) + { + // There is already data in flash for this peer. + err_code = link_secure_central_existing_peer(conn_handle, + p_sec_params, + force_repairing, + peer_id, + &procedure); + } + else if (p_sec_params->bond) + { + // New peer is required. + err_code = link_secure_central_new_peer(conn_handle, p_sec_params); + } + else + { + // No bonding, only pairing. + err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); + + sec_proc_start(conn_handle, peer_id, err_code == NRF_SUCCESS, true, false); + } + + if (err_code == NRF_SUCCESS) + { + sec_start_send(conn_handle, procedure); + } + + return err_code; +} + + +static ret_code_t link_secure_peripheral(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params) +{ + VERIFY_PARAM_NOT_NULL(p_sec_params); + + ret_code_t err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); + + return err_code; +} + + +ret_code_t smd_link_secure(uint16_t conn_handle, + ble_gap_sec_params_t * p_sec_params, + bool force_repairing) +{ + VERIFY_MODULE_INITIALIZED(); + + uint8_t role = ble_conn_state_role(conn_handle); + + switch (role) + { + case BLE_GAP_ROLE_CENTRAL: + return link_secure_central(conn_handle, p_sec_params, force_repairing); + + case BLE_GAP_ROLE_PERIPH: + return link_secure_peripheral(conn_handle, p_sec_params); + + default: + return BLE_ERROR_INVALID_CONN_HANDLE; + } +} + + +void smd_ble_evt_handler(ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_DISCONNECTED: + disconnect_process(&(p_ble_evt->evt.gap_evt)); + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + sec_params_request_process(&(p_ble_evt->evt.gap_evt)); + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + sec_info_request_process(&(p_ble_evt->evt.gap_evt)); + break; + + case BLE_GAP_EVT_SEC_REQUEST: + sec_request_process(&(p_ble_evt->evt.gap_evt)); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + auth_status_process(&(p_ble_evt->evt.gap_evt)); + break; + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + conn_sec_update_process(&(p_ble_evt->evt.gap_evt)); + break; + }; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h new file mode 100644 index 0000000000..037158a9f7 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef SECURITY_DISPATCHER_H__ +#define SECURITY_DISPATCHER_H__ + +#include +#include "sdk_errors.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @cond NO_DOXYGEN + * @defgroup security_dispatcher Security Dispatcher + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. A module for streamlining pairing, bonding, and + * encryption, including flash storage of shared data. + * + */ + + +/**@brief Events that can come from the Security Dispatcher module. + */ +typedef enum +{ + SMD_EVT_PARAMS_REQ, /**< Parameters are required for a pairing procedure on the specified connection. The user must provide them using @ref smd_params_reply. */ + SMD_EVT_SLAVE_SECURITY_REQ, /**< The peer (slave) has requested link encryption. Call @ref smd_link_secure to honor the request. The data in the event structure must be used in the parameters. */ + SMD_EVT_SEC_PROCEDURE_START, /**< A security procedure has started. */ + SMD_EVT_PAIRING_SUCCESS, /**< A pairing procedure (and bonding if applicable) has completed with success. */ + SMD_EVT_PAIRING_FAIL, /**< A pairing procedure has failed which means no encryption and no bond could be established. */ + SMD_EVT_LINK_ENCRYPTION_UPDATE, /**< The security level of the link has been updated. The link is encrypted. */ + SMD_EVT_LINK_ENCRYPTION_FAILED, /**< An attempt to start encryption on an unencrypted link failed because the peripheral did not have the correct keys. If the peer is the peripheral, the force_repairing flag should be set when reattempting @ref smd_link_secure. */ + SMD_EVT_BONDING_INFO_STORED, /**< Information exchanged during bonding with a peer has been stored persistently. */ + SMD_EVT_ERROR_BONDING_INFO, /**< Information exchanged during bonding with a peer could not be stored persistently, because of an unexpected error. */ + // SMD_EVT_ERROR_NO_MEM, /**< An operation failed because there was no available storage room in persistent storage. Please free up room, and the operation will automatically continue. */ + SMD_EVT_ERROR_UNEXPECTED, /**< An operation failed with an unexpected error. The error is provided. This is possibly a fatal error. */ +} smd_evt_id_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_SLAVE_SECURITY_REQ event. + */ +typedef struct +{ + bool bond; + bool mitm; +} smd_evt_slave_security_req_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_SEC_PROCEDURE_START event. + */ +typedef struct +{ + pm_conn_sec_procedure_t procedure; /**< The procedure that has started. */ +} smd_evt_sec_procedure_start_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_PAIRING_SUCCESS event. + */ +typedef struct +{ + bool bonded; /**< Whether bonding was performed. */ + bool mitm; /**< Whether MITM protection was used during pairing. */ + ble_gap_sec_kdist_t kdist_own; /**< Which keys were distributed to the peer. Only relevant if bonding was performed. */ + ble_gap_sec_kdist_t kdist_peer; /**< Which keys were distributed by the peer. Only relevant if bonding was performed. */ +} smd_evt_pairing_success_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_PAIRING_FAIL event. + */ +typedef struct +{ + pm_sec_error_code_t error; /**< What went wrong. */ + uint8_t error_src; /**< The party that raised the error, see @ref BLE_GAP_SEC_STATUS_SOURCES. */ +} smd_evt_pairing_failed_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_LINK_ENCRYPTION_UPDATE event. + */ +typedef struct +{ + bool mitm_protected; /**< Whether the link is now MITM protected. */ +} smd_evt_link_encryption_update_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_LINK_ENCRYPTION_FAILED event. + */ +typedef struct +{ + pm_sec_error_code_t error; /**< What went wrong. */ + uint8_t error_src; /**< The party that raised the error, see @ref BLE_GAP_SEC_STATUS_SOURCES. */ +} smd_evt_link_encryption_failed_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_BONDING_INFO_STORED event. + */ +typedef struct +{ + pm_peer_id_t peer_id; /**< The peer this event pertains to. */ +} smd_evt_bonding_info_stored_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_ERROR_BONDING_INFO event. + */ +typedef struct +{ + pm_peer_id_t peer_id; /**< The peer this event pertains to, if previously bonded. @ref PM_PEER_ID_INVALID if no successful bonding has happened with the peer before. */ + ret_code_t error; /**< The unexpected error that occurred. */ +} smd_evt_error_bonding_info_t; + + +// typedef struct +// { + // pm_peer_id_t peer_id; /**< The peer this event pertains to. */ +// } smd_evt_error_no_mem_t; + + +/**@brief Events parameters specific to the @ref SMD_EVT_ERROR_UNEXPECTED event. + */ +typedef struct +{ + ret_code_t error; /**< The unexpected error that occurred. */ +} smd_evt_error_unexpected_t; + + +typedef union +{ + smd_evt_slave_security_req_t slave_security_req; + smd_evt_sec_procedure_start_t sec_procedure_start; + smd_evt_pairing_success_t pairing_success; + smd_evt_pairing_failed_t pairing_failed; + smd_evt_link_encryption_update_t link_encryption_update; + smd_evt_link_encryption_failed_t link_encryption_failed; + smd_evt_bonding_info_stored_t bonding_info_stored; + smd_evt_error_bonding_info_t error_bonding_info; + // smd_evt_error_no_mem_t error_no_mem; + smd_evt_error_unexpected_t error_unexpected; +} smd_evt_params_t; /**< Event specific parameters. Chosen based on evt_id. */ + + +/**@brief Structure describing events from the Security Dispatcher module. + */ +typedef struct +{ + smd_evt_id_t evt_id; /**< The type of event. */ + uint16_t conn_handle; /**< The connection this event pertains to. */ + smd_evt_params_t params; /**< Event specific parameters. Chosen based on evt_id. */ +} smd_evt_t; + + + +/**@brief Event handler for events from the Security Dispatcher module. + * + * @param[in] p_event The event that has happened. + */ +typedef void (*smd_evt_handler_t)(smd_evt_t const * p_event); + + +/**@brief Function for registering with the Security Dispatcher module. This function also + * initializes the module if uninitialized. + * + * @param[in] evt_handler Callback for events from the Security Dispatcher module. + * + * @retval NRF_SUCCESS Registration was successful. + * @retval NRF_ERROR_NO_MEM No more registrations possible. + * @retval NRF_ERROR_NULL evt_handler was NULL. + */ +ret_code_t smd_register(smd_evt_handler_t evt_handler); + + +/**@brief Function for dispatching SoftDevice events to the Security Dispatcher module. + * + * @param[in] ble_evt The SoftDevice event. + */ +void smd_ble_evt_handler(ble_evt_t * ble_evt); + + +/**@brief Function for providing pairing and bonding parameters to use for the current pairing + * procedure on a connection. + * + * @note If this function returns an @ref NRF_ERROR_NULL, @ref NRF_ERROR_INVALID_PARAM, @ref + * BLE_ERROR_INVALID_CONN_HANDLE, or @ref NRF_ERROR_NO_MEM, this function can be called again + * after corrective action. + * + * @note To reject a request, call this function with NULL p_sec_params. + * + * @param[in] conn_handle The connection handle of the connection the pairing is happening on. + * @param[in] p_sec_params The security parameters to use for this link. + * @param[in] p_public_key A pointer to the public key to use if using LESC, or NULL. + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized, or no parameters have been + * requested on that conn_handle, or this error originates + * from the SoftDevice. + * @retval NRF_ERROR_INVALID_PARAM Invalid combination of parameters (not including conn_handle). + * @retval NRF_ERROR_TIMEOUT There has been an SMP timeout, so no more SMP operations + * can be performed on this link. + * @retval BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. + * @retval NRF_ERROR_NO_MEM No more room in flash. Fix and reattempt later. + * @retval NRF_ERROR_BUSY No write buffer. Reattempt later. + */ +ret_code_t smd_params_reply(uint16_t conn_handle, + ble_gap_sec_params_t * p_sec_params, + ble_gap_lesc_p256_pk_t * p_public_key); + + +/**@brief Function for initiating security on the link, with the specified parameters. + * + * @note If the connection is a peripheral connection, this will send a security request to the + * master, but the master is not obligated to initiate pairing or encryption in response. + * @note If the connection is a central connection and a key is available, the parameters will be + * used to determine whether to re-pair or to encrypt using the existing key. If no key is + * available, pairing will be started. + * + * @param[in] conn_handle Handle of the connection to initiate pairing on. + * @param[in] p_sec_params The security parameters to use for this link. As a central, this can + * be NULL to reject a slave security request. + * @param[in] force_repairing Whether to force a pairing procedure to happen regardless of whether + * an encryption key already exists. This argument is only relevant for + * the central role. Recommended value: false + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_NULL p_sec_params was NULL (peripheral only). + * @retval NRF_ERROR_INVALID_STATE Module is not initialized, or this error originates from + * the SoftDevice. + * @retval NRF_ERROR_INVALID_PARAM Invalid combination of parameters (not including conn_handle). + * @retval NRF_ERROR_BUSY Unable to initiate procedure at this time. + * @retval NRF_ERROR_TIMEOUT There has been an SMP timeout, so no more SMP operations + * can be performed on this link. + * @retval BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. + * @retval NRF_ERROR_NO_MEM No more room in flash. + * @retval NRF_ERROR_INTERNAL No more available peer IDs. + */ +ret_code_t smd_link_secure(uint16_t conn_handle, + ble_gap_sec_params_t * p_sec_params, + bool force_repairing); + +/** @} + * @endcond + */ + +#endif /* SECURITY_DISPATCHER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.c new file mode 100644 index 0000000000..2bb3dc917d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.c @@ -0,0 +1,580 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "security_manager.h" +#include +#include "security_dispatcher.h" +#include "peer_database.h" +#include "ble_conn_state.h" +#include "sdk_common.h" +#include "id_manager.h" + +#define MAX_REGISTRANTS 3 /**< The number of user that can register with the module. */ + +typedef struct +{ + sm_evt_handler_t evt_handlers[MAX_REGISTRANTS]; + uint8_t n_registrants; + ble_conn_state_user_flag_id_t flag_id_link_secure_pending_busy; + ble_conn_state_user_flag_id_t flag_id_link_secure_pending_flash_full; + ble_conn_state_user_flag_id_t flag_id_link_secure_force_repairing; + ble_conn_state_user_flag_id_t flag_id_link_secure_null_params; + ble_conn_state_user_flag_id_t flag_id_params_reply_pending_busy; + ble_conn_state_user_flag_id_t flag_id_params_reply_pending_flash_full; + ble_conn_state_user_flag_id_t flag_id_reject_pairing; + bool pdb_evt_handler_registered; + bool sec_params_valid; + ble_gap_sec_params_t sec_params; + ble_gap_lesc_p256_pk_t * p_public_key; +} sm_t; + +static sm_t m_sm = {.flag_id_link_secure_pending_busy = BLE_CONN_STATE_USER_FLAG_INVALID, + .flag_id_link_secure_pending_flash_full = BLE_CONN_STATE_USER_FLAG_INVALID, + .flag_id_link_secure_force_repairing = BLE_CONN_STATE_USER_FLAG_INVALID, + .flag_id_link_secure_null_params = BLE_CONN_STATE_USER_FLAG_INVALID, + .flag_id_params_reply_pending_busy = BLE_CONN_STATE_USER_FLAG_INVALID, + .flag_id_params_reply_pending_flash_full = BLE_CONN_STATE_USER_FLAG_INVALID, + .flag_id_reject_pairing = BLE_CONN_STATE_USER_FLAG_INVALID}; + +#define MODULE_INITIALIZED (m_sm.n_registrants > 0) /**< Expression which is true when the module is initialized. */ +#include "sdk_macros.h" + +static void evt_send(sm_evt_t * p_event) +{ + for (uint32_t i = 0; i < m_sm.n_registrants; i++) + { + m_sm.evt_handlers[i](p_event); + } +} + + +static void flags_set_from_err_code(uint16_t conn_handle, ret_code_t err_code, bool params_reply) +{ + bool flag_value_flash_full = false; + bool flag_value_busy = false; + + if ( (err_code == NRF_ERROR_NO_MEM) + || (err_code == NRF_ERROR_BUSY) + || (err_code == NRF_SUCCESS)) + { + if ((err_code == NRF_ERROR_NO_MEM)) + { + flag_value_busy = false; + flag_value_flash_full = true; + } + else if (err_code == NRF_ERROR_BUSY) + { + flag_value_busy = true; + flag_value_flash_full = false; + } + else if (err_code == NRF_SUCCESS) + { + flag_value_busy = false; + flag_value_flash_full = false; + } + + if (params_reply) + { + ble_conn_state_user_flag_set(conn_handle, + m_sm.flag_id_params_reply_pending_flash_full, + flag_value_flash_full); + ble_conn_state_user_flag_set(conn_handle, + m_sm.flag_id_params_reply_pending_busy, + flag_value_busy); + ble_conn_state_user_flag_set(conn_handle, + m_sm.flag_id_link_secure_pending_flash_full, + false); + ble_conn_state_user_flag_set(conn_handle, + m_sm.flag_id_link_secure_pending_busy, + false); + } + else + { + ble_conn_state_user_flag_set(conn_handle, + m_sm.flag_id_link_secure_pending_flash_full, + flag_value_flash_full); + ble_conn_state_user_flag_set(conn_handle, + m_sm.flag_id_link_secure_pending_busy, + flag_value_busy); + } + } +} + + +static void events_send_from_err_code(uint16_t conn_handle, ret_code_t err_code) +{ + if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY)) + { + sm_evt_t evt = + { + .conn_handle = conn_handle, + .params = {.error_unexpected = { + .error = err_code + }} + }; + if (err_code == NRF_ERROR_TIMEOUT) + { + evt.evt_id = SM_EVT_ERROR_SMP_TIMEOUT; + } + else if (err_code == NRF_ERROR_NO_MEM) + { + evt.evt_id = SM_EVT_ERROR_NO_MEM; + } + else + { + evt.evt_id = SM_EVT_ERROR_UNEXPECTED; + } + evt_send(&evt); + } +} + + +static ret_code_t link_secure(uint16_t conn_handle, bool null_params, bool force_repairing, bool send_events) +{ + ret_code_t err_code; + + if (!null_params && !m_sm.sec_params_valid) + { + return NRF_ERROR_NOT_FOUND; + } + + if(null_params) + { + err_code = smd_link_secure(conn_handle, NULL, force_repairing); + } + else + { + err_code = smd_link_secure(conn_handle, &m_sm.sec_params, force_repairing); + } + + flags_set_from_err_code(conn_handle, err_code, false); + + if (send_events) + { + events_send_from_err_code(conn_handle, err_code); + } + + switch (err_code) + { + case NRF_ERROR_BUSY: + ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_link_secure_null_params, null_params); + ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_link_secure_force_repairing, force_repairing); + err_code = NRF_SUCCESS; + break; + case NRF_ERROR_NO_MEM: + ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_link_secure_null_params, null_params); + ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_link_secure_force_repairing, force_repairing); + break; + case NRF_SUCCESS: + case NRF_ERROR_TIMEOUT: + case BLE_ERROR_INVALID_CONN_HANDLE: + case NRF_ERROR_INVALID_STATE: + /* No action */ + break; + default: + err_code = NRF_ERROR_INTERNAL; + break; + } + + return err_code; +} + + +static void send_config_req(uint16_t conn_handle) +{ + sm_evt_t sm_evt; + memset(&sm_evt, 0, sizeof(sm_evt)); + + sm_evt.evt_id = SM_EVT_CONN_SEC_CONFIG_REQ; + sm_evt.conn_handle = conn_handle; + + evt_send(&sm_evt); +} + + +static void smd_params_reply_perform(uint16_t conn_handle) +{ + ret_code_t err_code; + + if ( (ble_conn_state_role(conn_handle) == BLE_GAP_ROLE_PERIPH) + && im_peer_id_get_by_conn_handle(conn_handle) != PM_PEER_ID_INVALID) + { + // Bond already exists. Reject the pairing request if the user doesn't intervene. + ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_reject_pairing, true); + send_config_req(conn_handle); + } + else + { + ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_reject_pairing, false); + } + + if ( m_sm.sec_params_valid + && !ble_conn_state_user_flag_get(conn_handle, m_sm.flag_id_reject_pairing)) + { + err_code = smd_params_reply(conn_handle, &m_sm.sec_params, m_sm.p_public_key); + } + else + { + err_code = smd_params_reply(conn_handle, NULL, NULL); + } + + flags_set_from_err_code(conn_handle, err_code, true); + events_send_from_err_code(conn_handle, err_code); +} + + +static void smd_evt_handler(smd_evt_t const * p_event) +{ + switch(p_event->evt_id) + { + case SMD_EVT_PARAMS_REQ: + smd_params_reply_perform(p_event->conn_handle); + break; + case SMD_EVT_SLAVE_SECURITY_REQ: + { + bool null_params = false; + if (!m_sm.sec_params_valid) + { + null_params = true; + } + else if ((bool)m_sm.sec_params.bond < (bool)p_event->params.slave_security_req.bond) + { + null_params = true; + } + else if ((bool)m_sm.sec_params.mitm < (bool)p_event->params.slave_security_req.mitm) + { + null_params = true; + } + ret_code_t err_code = link_secure(p_event->conn_handle, null_params, false, true); + UNUSED_VARIABLE(err_code); // It is acceptable to ignore the return code because it is + // acceptable to ignore a security request. + } + /* fallthrough */ + case SMD_EVT_PAIRING_SUCCESS: + case SMD_EVT_PAIRING_FAIL: + case SMD_EVT_LINK_ENCRYPTION_UPDATE: + case SMD_EVT_LINK_ENCRYPTION_FAILED: + case SMD_EVT_BONDING_INFO_STORED: + case SMD_EVT_ERROR_BONDING_INFO: + case SMD_EVT_ERROR_UNEXPECTED: + case SMD_EVT_SEC_PROCEDURE_START: + { + sm_evt_t evt; + evt.evt_id = (sm_evt_id_t)p_event->evt_id; + evt.conn_handle = p_event->conn_handle; + evt.params = p_event->params; + + evt_send(&evt); + } + break; + } +} + + +static void link_secure_pending_process(ble_conn_state_user_flag_id_t flag_id) +{ + sdk_mapped_flags_t flag_collection = ble_conn_state_user_flag_collection(flag_id); + if (sdk_mapped_flags_any_set(flag_collection)) + { + sdk_mapped_flags_key_list_t conn_handle_list = ble_conn_state_conn_handles(); + + for (uint32_t i = 0; i < conn_handle_list.len; i++) + { + bool pending = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], flag_id); + if (pending) + { + bool force_repairing = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_sm.flag_id_link_secure_force_repairing); + bool null_params = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_sm.flag_id_link_secure_null_params); + + ret_code_t err_code = link_secure(conn_handle_list.flag_keys[i], null_params, force_repairing, true); // If this fails, it will be automatically retried. + UNUSED_VARIABLE(err_code); + } + } + } +} + + +static void params_reply_pending_process(ble_conn_state_user_flag_id_t flag_id) +{ + sdk_mapped_flags_t flag_collection = ble_conn_state_user_flag_collection(flag_id); + if (sdk_mapped_flags_any_set(flag_collection)) + { + sdk_mapped_flags_key_list_t conn_handle_list = ble_conn_state_conn_handles(); + + for (uint32_t i = 0; i < conn_handle_list.len; i++) + { + bool pending = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], flag_id); + if (pending) + { + smd_params_reply_perform(conn_handle_list.flag_keys[i]); + } + } + } +} + + + +static void pdb_evt_handler(pdb_evt_t const * p_event) +{ + switch (p_event->evt_id) + { + case PDB_EVT_COMPRESSED: + params_reply_pending_process(m_sm.flag_id_params_reply_pending_flash_full); + link_secure_pending_process(m_sm.flag_id_link_secure_pending_flash_full); + /* fallthrough */ + case PDB_EVT_WRITE_BUF_STORED: + case PDB_EVT_RAW_STORED: + case PDB_EVT_RAW_STORE_FAILED: + case PDB_EVT_CLEARED: + case PDB_EVT_CLEAR_FAILED: + case PDB_EVT_PEER_FREED: + case PDB_EVT_PEER_FREE_FAILED: + params_reply_pending_process(m_sm.flag_id_params_reply_pending_busy); + link_secure_pending_process(m_sm.flag_id_link_secure_pending_busy); + break; + case PDB_EVT_ERROR_NO_MEM: + case PDB_EVT_ERROR_UNEXPECTED: + break; + } +} + + +/**@brief Funtion for initializing a BLE Connection State user flag. + * + * @param[out] flag_id The flag to initialize. + */ +static void flag_id_init(ble_conn_state_user_flag_id_t * p_flag_id) +{ + if (*p_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) + { + *p_flag_id = ble_conn_state_user_flag_acquire(); + } +} + + +ret_code_t sm_register(sm_evt_handler_t evt_handler) +{ + VERIFY_PARAM_NOT_NULL(evt_handler); + + ret_code_t err_code = NRF_SUCCESS; + + if (!MODULE_INITIALIZED) + { + flag_id_init(&m_sm.flag_id_link_secure_pending_busy); + flag_id_init(&m_sm.flag_id_link_secure_pending_flash_full); + flag_id_init(&m_sm.flag_id_link_secure_force_repairing); + flag_id_init(&m_sm.flag_id_link_secure_null_params); + flag_id_init(&m_sm.flag_id_params_reply_pending_busy); + flag_id_init(&m_sm.flag_id_params_reply_pending_flash_full); + flag_id_init(&m_sm.flag_id_reject_pairing); + + if (m_sm.flag_id_reject_pairing == BLE_CONN_STATE_USER_FLAG_INVALID) + { + return NRF_ERROR_INTERNAL; + } + if (!m_sm.pdb_evt_handler_registered) + { + err_code = pdb_register(pdb_evt_handler); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + m_sm.pdb_evt_handler_registered = true; + } + err_code = smd_register(smd_evt_handler); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + } + if (err_code == NRF_SUCCESS) + { + if ((m_sm.n_registrants < MAX_REGISTRANTS)) + { + m_sm.evt_handlers[m_sm.n_registrants++] = evt_handler; + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + } + return err_code; +} + + +void sm_ble_evt_handler(ble_evt_t * p_ble_evt) +{ + VERIFY_MODULE_INITIALIZED_VOID(); + + smd_ble_evt_handler(p_ble_evt); + + link_secure_pending_process(m_sm.flag_id_link_secure_pending_busy); +} + + +static bool sec_params_verify(ble_gap_sec_params_t * p_sec_params) +{ + // NULL check. + if (p_sec_params == NULL) + { + return false; + } + + // OOB not allowed unless MITM. + if (!p_sec_params->mitm && p_sec_params->oob) + { + return false; + } + + // IO Capabilities must be one of the valid values from @ref BLE_GAP_IO_CAPS. + if (p_sec_params->io_caps > BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY) + { + return false; + } + + // Must have either IO capabilities or OOB if MITM. + if (p_sec_params->mitm && (p_sec_params->io_caps == BLE_GAP_IO_CAPS_NONE) && !p_sec_params->oob) + { + return false; + } + + // Minimum key size cannot be larger than maximum key size. + if (p_sec_params->min_key_size > p_sec_params->max_key_size) + { + return false; + } + + // Key size cannot be below 7 bytes. + if (p_sec_params->min_key_size < 7) + { + return false; + } + + // Key size cannot be above 16 bytes. + if (p_sec_params->max_key_size > 16) + { + return false; + } + + // Signing is not supported. + if (p_sec_params->kdist_own.sign || p_sec_params->kdist_peer.sign) + { + return false; + } + + // link bit must be 0. + if (p_sec_params->kdist_own.link || p_sec_params->kdist_peer.link) + { + return false; + } + + // If bonding is not enabled, no keys can be distributed. + if (!p_sec_params->bond && ( p_sec_params->kdist_own.enc + || p_sec_params->kdist_own.id + || p_sec_params->kdist_peer.enc + || p_sec_params->kdist_peer.id)) + { + return false; + } + + // If bonding is enabled, one or more keys must be distributed. + if ( p_sec_params->bond + && !p_sec_params->kdist_own.enc + && !p_sec_params->kdist_own.id + && !p_sec_params->kdist_peer.enc + && !p_sec_params->kdist_peer.id) + { + return false; + } + + return true; +} + + +ret_code_t sm_sec_params_set(ble_gap_sec_params_t * p_sec_params) +{ + VERIFY_MODULE_INITIALIZED(); + + if (p_sec_params == NULL) + { + m_sm.sec_params_valid = false; + return NRF_SUCCESS; + } + else if (sec_params_verify(p_sec_params)) + { + m_sm.sec_params = *p_sec_params; + m_sm.sec_params_valid = true; + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_INVALID_PARAM; + } +} + + +void sm_conn_sec_config_reply(uint16_t conn_handle, pm_conn_sec_config_t * p_conn_sec_config) +{ + ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_reject_pairing, !p_conn_sec_config->allow_repairing); +} + + +ret_code_t sm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key) +{ + VERIFY_MODULE_INITIALIZED(); + m_sm.p_public_key = p_public_key; + return NRF_SUCCESS; +} + + +ret_code_t sm_sec_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params) +{ + VERIFY_MODULE_INITIALIZED(); + return NRF_SUCCESS; +} + + +ret_code_t sm_link_secure(uint16_t conn_handle, bool force_repairing) +{ + VERIFY_MODULE_INITIALIZED(); + ret_code_t err_code = link_secure(conn_handle, false, force_repairing, false); + return err_code; +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h new file mode 100644 index 0000000000..39b0d92ce2 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef SECURITY_MANAGER_H__ +#define SECURITY_MANAGER_H__ + +#include +#include "sdk_errors.h" +#include "nrf_ble.h" +#include "nrf_ble_gap.h" +#include "peer_manager_types.h" +#include "security_dispatcher.h" + + +/** + * @cond NO_DOXYGEN + * @defgroup security_manager Security Manager + * @ingroup peer_manager + * @{ + * @brief An internal module of @ref peer_manager. A module for streamlining pairing, bonding, and + * encryption, including flash storage of shared data. + */ + + +/**@brief Events that can come from the Security Manager module. + */ +typedef enum +{ + // SM_EVT_PARAMS_REQ = SMD_EVT_PARAMS_REQ, /**< Parameters are required for a pairing procedure on the specified connection. The user must provide them using @ref sm_sec_params_set or @ref sm_sec_params_reply (only this procedure, currently unimplemented). */ + SM_EVT_SLAVE_SECURITY_REQ = SMD_EVT_SLAVE_SECURITY_REQ, /**< The peer (peripheral) has requested link encryption, which has been enabled. */ + SM_EVT_SEC_PROCEDURE_START = SMD_EVT_SEC_PROCEDURE_START, /**< A security procedure has started. */ + SM_EVT_PAIRING_SUCCESS = SMD_EVT_PAIRING_SUCCESS, /**< A pairing procedure (and bonding if applicable) has completed with success. */ + SM_EVT_PAIRING_FAIL = SMD_EVT_PAIRING_FAIL, /**< A pairing procedure has failed which means no encryption and no bond could be established. */ + SM_EVT_LINK_ENCRYPTION_UPDATE = SMD_EVT_LINK_ENCRYPTION_UPDATE, /**< The security level of the link has been updated. The link is encrypted. */ + SM_EVT_LINK_ENCRYPTION_FAILED = SMD_EVT_LINK_ENCRYPTION_FAILED, /**< An attempt to start encryption on an unencrypted link failed because the peripheral did not have the correct keys. If the peer is the peripheral, the force_repairing flag should be set when reattempting @ref sm_link_secure. */ + SM_EVT_BONDING_INFO_STORED = SMD_EVT_BONDING_INFO_STORED, /**< Information exchanged during bonding with a peer has been stored persistently. */ + SM_EVT_ERROR_BONDING_INFO = SMD_EVT_ERROR_BONDING_INFO, /**< Information exchanged during bonding with a peer could not be stored persistently, because of an unexpected error. */ + SM_EVT_ERROR_UNEXPECTED = SMD_EVT_ERROR_UNEXPECTED, /**< An operation failed with an unexpected error. The error is provided. This is possibly a fatal error. */ + SM_EVT_ERROR_NO_MEM /*= SMD_EVT_ERROR_NO_MEM*/, /**< An operation failed because there was no available storage room in persistent storage. Please free up room and the operation will automatically continue after the next compression. */ + SM_EVT_ERROR_SMP_TIMEOUT, /**< An operation failed because there has been an SMP timeout on the link, which entails that no more security operations can be performed on it. */ + SM_EVT_CONN_SEC_CONFIG_REQ, /**< The peer (central) has requested pairing, but a bond already exists with that peer. Reply by calling @ref sm_conn_sec_config_reply before the event handler returns. If no reply is sent, a default is used. */ +} sm_evt_id_t; + + +typedef struct +{ + sm_evt_id_t evt_id; + uint16_t conn_handle; + smd_evt_params_t params; +} sm_evt_t; + + + +/**@brief Event handler for events from the Security Manager module. + * + * @param[in] event The event that has happened. + * @param[in] conn_handle The connection handle the event pertains to. + */ +typedef void (*sm_evt_handler_t)(sm_evt_t const * p_event); + + +/**@brief Function for registering with the Security Manager module. This function also + * initializes the module if uninitialized. + * + * @param[in] evt_handler Callback for events from the Security Manager module. + * + * @retval NRF_SUCCESS Registration was successful. + * @retval NRF_ERROR_NO_MEM No more registrations possible. + * @retval NRF_ERROR_NULL evt_handler was NULL. + * @retval NRF_ERROR_INTERNAL An unexpected error occurred. + */ +ret_code_t sm_register(sm_evt_handler_t evt_handler); + + +/**@brief Function for dispatching SoftDevice events to the Security Manager module. + * + * @param[in] ble_evt The SoftDevice event. + */ +void sm_ble_evt_handler(ble_evt_t * ble_evt); + + +/**@brief Function for providing pairing and bonding parameters to use for pairing procedures. + * + * @details Until this is called, all bonding procedures initiated by the peer will be rejected. + * This function can be called multiple times, even with NULL p_sec_params, in which case + * it will go back to rejecting all procedures. + * + * @param[in] p_sec_params The security parameters to use for this link. Can be NULL to reject + * all pairing procedures. + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_INVALID_PARAM Invalid combination of parameters. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t sm_sec_params_set(ble_gap_sec_params_t * p_sec_params); + + +/**@brief Function for providing security configuration for a link. + * + * @details This function is optional, and must be called in reply to a @ref + * SM_EVT_CONN_SEC_CONFIG_REQ event, before the Peer Manager event handler returns. If it + * is not called in time, a default configuration is used. See @ref pm_conn_sec_config_t + * for the value of the default. + * + * @param[in] conn_handle The connection to set the configuration for. + * @param[in] p_conn_sec_config The configuration. + */ +void sm_conn_sec_config_reply(uint16_t conn_handle, pm_conn_sec_config_t * p_conn_sec_config); + + +/**@brief Experimental function for specifying the public key to use for LESC operations. + * + * @details This function can be called multiple times. The specified public key will be used for + * all subsequent LESC (LE Secure Connections) operations until the next time this function + * is called. + * + * @note The key must continue to reside in application memory as it is not copied by Peer Manager. + * + * @param[in] p_public_key The public key to use for all subsequent LESC operations. + * + * @retval NRF_SUCCESS Pairing initiated successfully. + * @retval NRF_ERROR_INVALID_STATE Peer Manager is not initialized. + */ +ret_code_t sm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key); + + +/**@brief Function for providing pairing and bonding parameters to use for the current pairing + * procedure on a connection. + * + * @warning This function is not yet implemented. + * + * @note If this function returns an @ref NRF_ERROR_NULL, @ref NRF_ERROR_INVALID_PARAM, @ref + * BLE_ERROR_INVALID_CONN_HANDLE, or @ref NRF_ERROR_NO_MEM, this function can be called again + * after corrective action. + * + * @note To reject a request, call this function with NULL p_sec_params. + * + * @param[in] conn_handle The connection handle of the connection the pairing is happening on. + * @param[in] p_sec_params The security parameters to use for this link. + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized, or no parameters have been + * requested on that conn_handle, or this error originates + * from the SoftDevice. + * @retval NRF_ERROR_INVALID_PARAM Invalid combination of parameters (not including conn_handle). + * @retval NRF_ERROR_TIMEOUT There has been an SMP timeout, so no more SMP operations + * can be performed on this link. + * @retval BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. + * @retval NRF_ERROR_NO_MEM No more room in flash. Fix and reattempt later. + * @retval NRF_ERROR_BUSY No write buffer. Reattempt later. + */ +ret_code_t sm_sec_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params); + + +/**@brief Function for initiating security on the link, with the specified parameters. + * + * @note If the connection is a peripheral connection, this will send a security request to the + * master, but the master is not obligated to initiate pairing or encryption in response. + * @note If the connection is a central connection and a key is available, the parameters will be + * used to determine whether to re-pair or to encrypt using the existing key. If no key is + * available, pairing will be started. + * + * @param[in] conn_handle Handle of the connection to initiate pairing on. + * @param[in] force_repairing Whether to force a pairing procedure to happen regardless of whether + * an encryption key already exists. This argument is only relevant for + * the central role. Recommended value: false + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_TIMEOUT There has been an SMP timeout, so no more SMP operations + * can be performed on this link. + * @retval BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. + * @retval NRF_ERROR_NOT_FOUND Security parameters have not been set. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL An unexpected error occurred. + */ +ret_code_t sm_link_secure(uint16_t conn_handle, bool force_repairing); + +/** @} + * @endcond + */ + +#endif /* SECURITY_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/compiler_abstraction.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/compiler_abstraction.h new file mode 100644 index 0000000000..371d95b65a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/compiler_abstraction.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _COMPILER_ABSTRACTION_H +#define _COMPILER_ABSTRACTION_H + +/*lint ++flb "Enter library region" */ + +#if defined ( __CC_ARM ) + + #ifndef __ASM + #define __ASM __asm + #endif + + #ifndef __INLINE + #define __INLINE __inline + #endif + + #ifndef __WEAK + #define __WEAK __weak + #endif + + #ifndef __ALIGN + #define __ALIGN(n) __align(n) + #endif + + #define GET_SP() __current_sp() + +#elif defined ( __ICCARM__ ) + + #ifndef __ASM + #define __ASM __asm + #endif + + #ifndef __INLINE + #define __INLINE inline + #endif + + #ifndef __WEAK + #define __WEAK __weak + #endif + + /* Not defined for IAR since it requires a new line to work, and C preprocessor does not allow that. */ + #ifndef __ALIGN + #define __ALIGN(n) + #endif + + #define GET_SP() __get_SP() + +#elif defined ( __GNUC__ ) + + #ifndef __ASM + #define __ASM __asm + #endif + + #ifndef __INLINE + #define __INLINE inline + #endif + + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + + #ifndef __ALIGN + #define __ALIGN(n) __attribute__((aligned(n))) + #endif + + #define GET_SP() gcc_current_sp() + + static inline unsigned int gcc_current_sp(void) + { + register unsigned sp __ASM("sp"); + return sp; + } + +#elif defined ( __TASKING__ ) + + #ifndef __ASM + #define __ASM __asm + #endif + + #ifndef __INLINE + #define __INLINE inline + #endif + + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + + #ifndef __ALIGN + #define __ALIGN(n) __align(n) + #endif + + #define GET_SP() __get_MSP() + +#endif + +/*lint --flb "Leave library region" */ + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf.h new file mode 100644 index 0000000000..22948d7b1e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_H +#define NRF_H + +/* MDK version */ +#define MDK_MAJOR_VERSION 8 +#define MDK_MINOR_VERSION 5 +#define MDK_MICRO_VERSION 0 + +#if defined(_WIN32) + /* Do not include nrf51 specific files when building for PC host */ +#elif defined(__unix) + /* Do not include nrf51 specific files when building for PC host */ +#elif defined(__APPLE__) + /* Do not include nrf51 specific files when building for PC host */ +#else + + /* Family selection for family includes. */ + #if defined (NRF51) + #include "nrf51.h" + #include "nrf51_bitfields.h" + #include "nrf51_deprecated.h" + #elif defined (NRF52) + #include "nrf52.h" + #include "nrf52_bitfields.h" + #include "nrf51_to_nrf52.h" + #include "nrf52_name_change.h" + #else + #error "Device family must be defined. See nrf.h." + #endif /* NRF51, NRF52 */ + + #include "compiler_abstraction.h" + #include "irq_handlers_hw.h" + +#endif /* _WIN32 || __unix || __APPLE__ */ + +#endif /* NRF_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51.h new file mode 100644 index 0000000000..0fae756197 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51.h @@ -0,0 +1,1285 @@ + +/****************************************************************************************************//** + * @file nrf51.h + * + * @brief CMSIS Cortex-M0 Peripheral Access Layer Header File for + * nrf51 from Nordic Semiconductor. + * + * @version V522 + * @date 23. February 2016 + * + * @note Generated with SVDConv V2.81d + * from CMSIS SVD File 'nrf51.svd' Version 522, + * + * @par Copyright (c) 2013, Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + *******************************************************************************************************/ + + + +/** @addtogroup Nordic Semiconductor + * @{ + */ + +/** @addtogroup nrf51 + * @{ + */ + +#ifndef NRF51_H +#define NRF51_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ------------------------- Interrupt Number Definition ------------------------ */ + +typedef enum { +/* ------------------- Cortex-M0 Processor Exceptions Numbers ------------------- */ + Reset_IRQn = -15, /*!< 1 Reset Vector, invoked on Power up and warm reset */ + NonMaskableInt_IRQn = -14, /*!< 2 Non maskable Interrupt, cannot be stopped or preempted */ + HardFault_IRQn = -13, /*!< 3 Hard Fault, all classes of Fault */ + SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */ + DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor */ + PendSV_IRQn = -2, /*!< 14 Pendable request for system service */ + SysTick_IRQn = -1, /*!< 15 System Tick Timer */ +/* ---------------------- nrf51 Specific Interrupt Numbers ---------------------- */ + POWER_CLOCK_IRQn = 0, /*!< 0 POWER_CLOCK */ + RADIO_IRQn = 1, /*!< 1 RADIO */ + UART0_IRQn = 2, /*!< 2 UART0 */ + SPI0_TWI0_IRQn = 3, /*!< 3 SPI0_TWI0 */ + SPI1_TWI1_IRQn = 4, /*!< 4 SPI1_TWI1 */ + GPIOTE_IRQn = 6, /*!< 6 GPIOTE */ + ADC_IRQn = 7, /*!< 7 ADC */ + TIMER0_IRQn = 8, /*!< 8 TIMER0 */ + TIMER1_IRQn = 9, /*!< 9 TIMER1 */ + TIMER2_IRQn = 10, /*!< 10 TIMER2 */ + RTC0_IRQn = 11, /*!< 11 RTC0 */ + TEMP_IRQn = 12, /*!< 12 TEMP */ + RNG_IRQn = 13, /*!< 13 RNG */ + ECB_IRQn = 14, /*!< 14 ECB */ + CCM_AAR_IRQn = 15, /*!< 15 CCM_AAR */ + WDT_IRQn = 16, /*!< 16 WDT */ + RTC1_IRQn = 17, /*!< 17 RTC1 */ + QDEC_IRQn = 18, /*!< 18 QDEC */ + LPCOMP_IRQn = 19, /*!< 19 LPCOMP */ + SWI0_IRQn = 20, /*!< 20 SWI0 */ + SWI1_IRQn = 21, /*!< 21 SWI1 */ + SWI2_IRQn = 22, /*!< 22 SWI2 */ + SWI3_IRQn = 23, /*!< 23 SWI3 */ + SWI4_IRQn = 24, /*!< 24 SWI4 */ + SWI5_IRQn = 25 /*!< 25 SWI5 */ +} IRQn_Type; + + +/** @addtogroup Configuration_of_CMSIS + * @{ + */ + + +/* ================================================================================ */ +/* ================ Processor and Core Peripheral Section ================ */ +/* ================================================================================ */ + +/* ----------------Configuration of the Cortex-M0 Processor and Core Peripherals---------------- */ +#define __CM0_REV 0x0301 /*!< Cortex-M0 Core Revision */ +#define __MPU_PRESENT 0 /*!< MPU present or not */ +#define __NVIC_PRIO_BITS 2 /*!< Number of Bits used for Priority Levels */ +#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ +/** @} */ /* End of group Configuration_of_CMSIS */ + +#include "core_cm0.h" /*!< Cortex-M0 processor and core peripherals */ +#include "system_nrf51.h" /*!< nrf51 System */ + + +/* ================================================================================ */ +/* ================ Device Specific Peripheral Section ================ */ +/* ================================================================================ */ + + +/** @addtogroup Device_Peripheral_Registers + * @{ + */ + + +/* ------------------- Start of section using anonymous unions ------------------ */ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#elif defined(__TMS470__) +/* anonymous unions are enabled by default */ +#elif defined(__TASKING__) + #pragma warning 586 +#else + #warning Not supported compiler type +#endif + + +typedef struct { + __IO uint32_t CPU0; /*!< Configurable priority configuration register for CPU0. */ + __IO uint32_t SPIS1; /*!< Configurable priority configuration register for SPIS1. */ + __IO uint32_t RADIO; /*!< Configurable priority configuration register for RADIO. */ + __IO uint32_t ECB; /*!< Configurable priority configuration register for ECB. */ + __IO uint32_t CCM; /*!< Configurable priority configuration register for CCM. */ + __IO uint32_t AAR; /*!< Configurable priority configuration register for AAR. */ +} AMLI_RAMPRI_Type; + +typedef struct { + __IO uint32_t SCK; /*!< Pin select for SCK. */ + __IO uint32_t MOSI; /*!< Pin select for MOSI. */ + __IO uint32_t MISO; /*!< Pin select for MISO. */ +} SPIM_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer. */ + __IO uint32_t MAXCNT; /*!< Maximum number of buffer bytes to receive. */ + __I uint32_t AMOUNT; /*!< Number of bytes received in the last transaction. */ +} SPIM_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer. */ + __IO uint32_t MAXCNT; /*!< Maximum number of buffer bytes to send. */ + __I uint32_t AMOUNT; /*!< Number of bytes sent in the last transaction. */ +} SPIM_TXD_Type; + +typedef struct { + __O uint32_t EN; /*!< Enable channel group. */ + __O uint32_t DIS; /*!< Disable channel group. */ +} PPI_TASKS_CHG_Type; + +typedef struct { + __IO uint32_t EEP; /*!< Channel event end-point. */ + __IO uint32_t TEP; /*!< Channel task end-point. */ +} PPI_CH_Type; + + +/* ================================================================================ */ +/* ================ POWER ================ */ +/* ================================================================================ */ + + +/** + * @brief Power Control. (POWER) + */ + +typedef struct { /*!< POWER Structure */ + __I uint32_t RESERVED0[30]; + __O uint32_t TASKS_CONSTLAT; /*!< Enable constant latency mode. */ + __O uint32_t TASKS_LOWPWR; /*!< Enable low power mode (variable latency). */ + __I uint32_t RESERVED1[34]; + __IO uint32_t EVENTS_POFWARN; /*!< Power failure warning. */ + __I uint32_t RESERVED2[126]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED3[61]; + __IO uint32_t RESETREAS; /*!< Reset reason. */ + __I uint32_t RESERVED4[9]; + __I uint32_t RAMSTATUS; /*!< Ram status register. */ + __I uint32_t RESERVED5[53]; + __O uint32_t SYSTEMOFF; /*!< System off register. */ + __I uint32_t RESERVED6[3]; + __IO uint32_t POFCON; /*!< Power failure configuration. */ + __I uint32_t RESERVED7[2]; + __IO uint32_t GPREGRET; /*!< General purpose retention register. This register is a retained + register. */ + __I uint32_t RESERVED8; + __IO uint32_t RAMON; /*!< Ram on/off. */ + __I uint32_t RESERVED9[7]; + __IO uint32_t RESET; /*!< Pin reset functionality configuration register. This register + is a retained register. */ + __I uint32_t RESERVED10[3]; + __IO uint32_t RAMONB; /*!< Ram on/off. */ + __I uint32_t RESERVED11[8]; + __IO uint32_t DCDCEN; /*!< DCDC converter enable configuration register. */ + __I uint32_t RESERVED12[291]; + __IO uint32_t DCDCFORCE; /*!< DCDC power-up force register. */ +} NRF_POWER_Type; + + +/* ================================================================================ */ +/* ================ CLOCK ================ */ +/* ================================================================================ */ + + +/** + * @brief Clock control. (CLOCK) + */ + +typedef struct { /*!< CLOCK Structure */ + __O uint32_t TASKS_HFCLKSTART; /*!< Start HFCLK clock source. */ + __O uint32_t TASKS_HFCLKSTOP; /*!< Stop HFCLK clock source. */ + __O uint32_t TASKS_LFCLKSTART; /*!< Start LFCLK clock source. */ + __O uint32_t TASKS_LFCLKSTOP; /*!< Stop LFCLK clock source. */ + __O uint32_t TASKS_CAL; /*!< Start calibration of LFCLK RC oscillator. */ + __O uint32_t TASKS_CTSTART; /*!< Start calibration timer. */ + __O uint32_t TASKS_CTSTOP; /*!< Stop calibration timer. */ + __I uint32_t RESERVED0[57]; + __IO uint32_t EVENTS_HFCLKSTARTED; /*!< HFCLK oscillator started. */ + __IO uint32_t EVENTS_LFCLKSTARTED; /*!< LFCLK oscillator started. */ + __I uint32_t RESERVED1; + __IO uint32_t EVENTS_DONE; /*!< Calibration of LFCLK RC oscillator completed. */ + __IO uint32_t EVENTS_CTTO; /*!< Calibration timer timeout. */ + __I uint32_t RESERVED2[124]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED3[63]; + __I uint32_t HFCLKRUN; /*!< Task HFCLKSTART trigger status. */ + __I uint32_t HFCLKSTAT; /*!< High frequency clock status. */ + __I uint32_t RESERVED4; + __I uint32_t LFCLKRUN; /*!< Task LFCLKSTART triggered status. */ + __I uint32_t LFCLKSTAT; /*!< Low frequency clock status. */ + __I uint32_t LFCLKSRCCOPY; /*!< Clock source for the LFCLK clock, set when task LKCLKSTART is + triggered. */ + __I uint32_t RESERVED5[62]; + __IO uint32_t LFCLKSRC; /*!< Clock source for the LFCLK clock. */ + __I uint32_t RESERVED6[7]; + __IO uint32_t CTIV; /*!< Calibration timer interval. */ + __I uint32_t RESERVED7[5]; + __IO uint32_t XTALFREQ; /*!< Crystal frequency. */ +} NRF_CLOCK_Type; + + +/* ================================================================================ */ +/* ================ MPU ================ */ +/* ================================================================================ */ + + +/** + * @brief Memory Protection Unit. (MPU) + */ + +typedef struct { /*!< MPU Structure */ + __I uint32_t RESERVED0[330]; + __IO uint32_t PERR0; /*!< Configuration of peripherals in mpu regions. */ + __IO uint32_t RLENR0; /*!< Length of RAM region 0. */ + __I uint32_t RESERVED1[52]; + __IO uint32_t PROTENSET0; /*!< Erase and write protection bit enable set register. */ + __IO uint32_t PROTENSET1; /*!< Erase and write protection bit enable set register. */ + __IO uint32_t DISABLEINDEBUG; /*!< Disable erase and write protection mechanism in debug mode. */ + __IO uint32_t PROTBLOCKSIZE; /*!< Erase and write protection block size. */ +} NRF_MPU_Type; + + +/* ================================================================================ */ +/* ================ AMLI ================ */ +/* ================================================================================ */ + + +/** + * @brief AHB Multi-Layer Interface. (AMLI) + */ + +typedef struct { /*!< AMLI Structure */ + __I uint32_t RESERVED0[896]; + AMLI_RAMPRI_Type RAMPRI; /*!< RAM configurable priority configuration structure. */ +} NRF_AMLI_Type; + + +/* ================================================================================ */ +/* ================ RADIO ================ */ +/* ================================================================================ */ + + +/** + * @brief The radio. (RADIO) + */ + +typedef struct { /*!< RADIO Structure */ + __O uint32_t TASKS_TXEN; /*!< Enable radio in TX mode. */ + __O uint32_t TASKS_RXEN; /*!< Enable radio in RX mode. */ + __O uint32_t TASKS_START; /*!< Start radio. */ + __O uint32_t TASKS_STOP; /*!< Stop radio. */ + __O uint32_t TASKS_DISABLE; /*!< Disable radio. */ + __O uint32_t TASKS_RSSISTART; /*!< Start the RSSI and take one sample of the receive signal strength. */ + __O uint32_t TASKS_RSSISTOP; /*!< Stop the RSSI measurement. */ + __O uint32_t TASKS_BCSTART; /*!< Start the bit counter. */ + __O uint32_t TASKS_BCSTOP; /*!< Stop the bit counter. */ + __I uint32_t RESERVED0[55]; + __IO uint32_t EVENTS_READY; /*!< Ready event. */ + __IO uint32_t EVENTS_ADDRESS; /*!< Address event. */ + __IO uint32_t EVENTS_PAYLOAD; /*!< Payload event. */ + __IO uint32_t EVENTS_END; /*!< End event. */ + __IO uint32_t EVENTS_DISABLED; /*!< Disable event. */ + __IO uint32_t EVENTS_DEVMATCH; /*!< A device address match occurred on the last received packet. */ + __IO uint32_t EVENTS_DEVMISS; /*!< No device address match occurred on the last received packet. */ + __IO uint32_t EVENTS_RSSIEND; /*!< Sampling of the receive signal strength complete. A new RSSI + sample is ready for readout at the RSSISAMPLE register. */ + __I uint32_t RESERVED1[2]; + __IO uint32_t EVENTS_BCMATCH; /*!< Bit counter reached bit count value specified in BCC register. */ + __I uint32_t RESERVED2[53]; + __IO uint32_t SHORTS; /*!< Shortcuts for the radio. */ + __I uint32_t RESERVED3[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED4[61]; + __I uint32_t CRCSTATUS; /*!< CRC status of received packet. */ + __I uint32_t RESERVED5; + __I uint32_t RXMATCH; /*!< Received address. */ + __I uint32_t RXCRC; /*!< Received CRC. */ + __I uint32_t DAI; /*!< Device address match index. */ + __I uint32_t RESERVED6[60]; + __IO uint32_t PACKETPTR; /*!< Packet pointer. Decision point: START task. */ + __IO uint32_t FREQUENCY; /*!< Frequency. */ + __IO uint32_t TXPOWER; /*!< Output power. */ + __IO uint32_t MODE; /*!< Data rate and modulation. */ + __IO uint32_t PCNF0; /*!< Packet configuration 0. */ + __IO uint32_t PCNF1; /*!< Packet configuration 1. */ + __IO uint32_t BASE0; /*!< Radio base address 0. Decision point: START task. */ + __IO uint32_t BASE1; /*!< Radio base address 1. Decision point: START task. */ + __IO uint32_t PREFIX0; /*!< Prefixes bytes for logical addresses 0 to 3. */ + __IO uint32_t PREFIX1; /*!< Prefixes bytes for logical addresses 4 to 7. */ + __IO uint32_t TXADDRESS; /*!< Transmit address select. */ + __IO uint32_t RXADDRESSES; /*!< Receive address select. */ + __IO uint32_t CRCCNF; /*!< CRC configuration. */ + __IO uint32_t CRCPOLY; /*!< CRC polynomial. */ + __IO uint32_t CRCINIT; /*!< CRC initial value. */ + __IO uint32_t TEST; /*!< Test features enable register. */ + __IO uint32_t TIFS; /*!< Inter Frame Spacing in microseconds. */ + __I uint32_t RSSISAMPLE; /*!< RSSI sample. */ + __I uint32_t RESERVED7; + __I uint32_t STATE; /*!< Current radio state. */ + __IO uint32_t DATAWHITEIV; /*!< Data whitening initial value. */ + __I uint32_t RESERVED8[2]; + __IO uint32_t BCC; /*!< Bit counter compare. */ + __I uint32_t RESERVED9[39]; + __IO uint32_t DAB[8]; /*!< Device address base segment. */ + __IO uint32_t DAP[8]; /*!< Device address prefix. */ + __IO uint32_t DACNF; /*!< Device address match configuration. */ + __I uint32_t RESERVED10[56]; + __IO uint32_t OVERRIDE0; /*!< Trim value override register 0. */ + __IO uint32_t OVERRIDE1; /*!< Trim value override register 1. */ + __IO uint32_t OVERRIDE2; /*!< Trim value override register 2. */ + __IO uint32_t OVERRIDE3; /*!< Trim value override register 3. */ + __IO uint32_t OVERRIDE4; /*!< Trim value override register 4. */ + __I uint32_t RESERVED11[561]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_RADIO_Type; + + +/* ================================================================================ */ +/* ================ UART ================ */ +/* ================================================================================ */ + + +/** + * @brief Universal Asynchronous Receiver/Transmitter. (UART) + */ + +typedef struct { /*!< UART Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start UART receiver. */ + __O uint32_t TASKS_STOPRX; /*!< Stop UART receiver. */ + __O uint32_t TASKS_STARTTX; /*!< Start UART transmitter. */ + __O uint32_t TASKS_STOPTX; /*!< Stop UART transmitter. */ + __I uint32_t RESERVED0[3]; + __O uint32_t TASKS_SUSPEND; /*!< Suspend UART. */ + __I uint32_t RESERVED1[56]; + __IO uint32_t EVENTS_CTS; /*!< CTS activated. */ + __IO uint32_t EVENTS_NCTS; /*!< CTS deactivated. */ + __IO uint32_t EVENTS_RXDRDY; /*!< Data received in RXD. */ + __I uint32_t RESERVED2[4]; + __IO uint32_t EVENTS_TXDRDY; /*!< Data sent from TXD. */ + __I uint32_t RESERVED3; + __IO uint32_t EVENTS_ERROR; /*!< Error detected. */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_RXTO; /*!< Receiver timeout. */ + __I uint32_t RESERVED5[46]; + __IO uint32_t SHORTS; /*!< Shortcuts for UART. */ + __I uint32_t RESERVED6[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED7[93]; + __IO uint32_t ERRORSRC; /*!< Error source. Write error field to 1 to clear error. */ + __I uint32_t RESERVED8[31]; + __IO uint32_t ENABLE; /*!< Enable UART and acquire IOs. */ + __I uint32_t RESERVED9; + __IO uint32_t PSELRTS; /*!< Pin select for RTS. */ + __IO uint32_t PSELTXD; /*!< Pin select for TXD. */ + __IO uint32_t PSELCTS; /*!< Pin select for CTS. */ + __IO uint32_t PSELRXD; /*!< Pin select for RXD. */ + __I uint32_t RXD; /*!< RXD register. On read action the buffer pointer is displaced. + Once read the character is consumed. If read when no character + available, the UART will stop working. */ + __O uint32_t TXD; /*!< TXD register. */ + __I uint32_t RESERVED10; + __IO uint32_t BAUDRATE; /*!< UART Baudrate. */ + __I uint32_t RESERVED11[17]; + __IO uint32_t CONFIG; /*!< Configuration of parity and hardware flow control register. */ + __I uint32_t RESERVED12[675]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_UART_Type; + + +/* ================================================================================ */ +/* ================ SPI ================ */ +/* ================================================================================ */ + + +/** + * @brief SPI master 0. (SPI) + */ + +typedef struct { /*!< SPI Structure */ + __I uint32_t RESERVED0[66]; + __IO uint32_t EVENTS_READY; /*!< TXD byte sent and RXD byte received. */ + __I uint32_t RESERVED1[126]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED2[125]; + __IO uint32_t ENABLE; /*!< Enable SPI. */ + __I uint32_t RESERVED3; + __IO uint32_t PSELSCK; /*!< Pin select for SCK. */ + __IO uint32_t PSELMOSI; /*!< Pin select for MOSI. */ + __IO uint32_t PSELMISO; /*!< Pin select for MISO. */ + __I uint32_t RESERVED4; + __I uint32_t RXD; /*!< RX data. */ + __IO uint32_t TXD; /*!< TX data. */ + __I uint32_t RESERVED5; + __IO uint32_t FREQUENCY; /*!< SPI frequency */ + __I uint32_t RESERVED6[11]; + __IO uint32_t CONFIG; /*!< Configuration register. */ + __I uint32_t RESERVED7[681]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_SPI_Type; + + +/* ================================================================================ */ +/* ================ TWI ================ */ +/* ================================================================================ */ + + +/** + * @brief Two-wire interface master 0. (TWI) + */ + +typedef struct { /*!< TWI Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start 2-Wire master receive sequence. */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STARTTX; /*!< Start 2-Wire master transmit sequence. */ + __I uint32_t RESERVED1[2]; + __O uint32_t TASKS_STOP; /*!< Stop 2-Wire transaction. */ + __I uint32_t RESERVED2; + __O uint32_t TASKS_SUSPEND; /*!< Suspend 2-Wire transaction. */ + __O uint32_t TASKS_RESUME; /*!< Resume 2-Wire transaction. */ + __I uint32_t RESERVED3[56]; + __IO uint32_t EVENTS_STOPPED; /*!< Two-wire stopped. */ + __IO uint32_t EVENTS_RXDREADY; /*!< Two-wire ready to deliver new RXD byte received. */ + __I uint32_t RESERVED4[4]; + __IO uint32_t EVENTS_TXDSENT; /*!< Two-wire finished sending last TXD byte. */ + __I uint32_t RESERVED5; + __IO uint32_t EVENTS_ERROR; /*!< Two-wire error detected. */ + __I uint32_t RESERVED6[4]; + __IO uint32_t EVENTS_BB; /*!< Two-wire byte boundary. */ + __I uint32_t RESERVED7[3]; + __IO uint32_t EVENTS_SUSPENDED; /*!< Two-wire suspended. */ + __I uint32_t RESERVED8[45]; + __IO uint32_t SHORTS; /*!< Shortcuts for TWI. */ + __I uint32_t RESERVED9[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED10[110]; + __IO uint32_t ERRORSRC; /*!< Two-wire error source. Write error field to 1 to clear error. */ + __I uint32_t RESERVED11[14]; + __IO uint32_t ENABLE; /*!< Enable two-wire master. */ + __I uint32_t RESERVED12; + __IO uint32_t PSELSCL; /*!< Pin select for SCL. */ + __IO uint32_t PSELSDA; /*!< Pin select for SDA. */ + __I uint32_t RESERVED13[2]; + __I uint32_t RXD; /*!< RX data register. */ + __IO uint32_t TXD; /*!< TX data register. */ + __I uint32_t RESERVED14; + __IO uint32_t FREQUENCY; /*!< Two-wire frequency. */ + __I uint32_t RESERVED15[24]; + __IO uint32_t ADDRESS; /*!< Address used in the two-wire transfer. */ + __I uint32_t RESERVED16[668]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_TWI_Type; + + +/* ================================================================================ */ +/* ================ SPIS ================ */ +/* ================================================================================ */ + + +/** + * @brief SPI slave 1. (SPIS) + */ + +typedef struct { /*!< SPIS Structure */ + __I uint32_t RESERVED0[9]; + __O uint32_t TASKS_ACQUIRE; /*!< Acquire SPI semaphore. */ + __O uint32_t TASKS_RELEASE; /*!< Release SPI semaphore. */ + __I uint32_t RESERVED1[54]; + __IO uint32_t EVENTS_END; /*!< Granted transaction completed. */ + __I uint32_t RESERVED2[2]; + __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached */ + __I uint32_t RESERVED3[5]; + __IO uint32_t EVENTS_ACQUIRED; /*!< Semaphore acquired. */ + __I uint32_t RESERVED4[53]; + __IO uint32_t SHORTS; /*!< Shortcuts for SPIS. */ + __I uint32_t RESERVED5[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED6[61]; + __I uint32_t SEMSTAT; /*!< Semaphore status. */ + __I uint32_t RESERVED7[15]; + __IO uint32_t STATUS; /*!< Status from last transaction. */ + __I uint32_t RESERVED8[47]; + __IO uint32_t ENABLE; /*!< Enable SPIS. */ + __I uint32_t RESERVED9; + __IO uint32_t PSELSCK; /*!< Pin select for SCK. */ + __IO uint32_t PSELMISO; /*!< Pin select for MISO. */ + __IO uint32_t PSELMOSI; /*!< Pin select for MOSI. */ + __IO uint32_t PSELCSN; /*!< Pin select for CSN. */ + __I uint32_t RESERVED10[7]; + __IO uint32_t RXDPTR; /*!< RX data pointer. */ + __IO uint32_t MAXRX; /*!< Maximum number of bytes in the receive buffer. */ + __I uint32_t AMOUNTRX; /*!< Number of bytes received in last granted transaction. */ + __I uint32_t RESERVED11; + __IO uint32_t TXDPTR; /*!< TX data pointer. */ + __IO uint32_t MAXTX; /*!< Maximum number of bytes in the transmit buffer. */ + __I uint32_t AMOUNTTX; /*!< Number of bytes transmitted in last granted transaction. */ + __I uint32_t RESERVED12; + __IO uint32_t CONFIG; /*!< Configuration register. */ + __I uint32_t RESERVED13; + __IO uint32_t DEF; /*!< Default character. */ + __I uint32_t RESERVED14[24]; + __IO uint32_t ORC; /*!< Over-read character. */ + __I uint32_t RESERVED15[654]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_SPIS_Type; + + +/* ================================================================================ */ +/* ================ SPIM ================ */ +/* ================================================================================ */ + + +/** + * @brief SPI master with easyDMA 1. (SPIM) + */ + +typedef struct { /*!< SPIM Structure */ + __I uint32_t RESERVED0[4]; + __O uint32_t TASKS_START; /*!< Start SPI transaction. */ + __O uint32_t TASKS_STOP; /*!< Stop SPI transaction. */ + __I uint32_t RESERVED1; + __O uint32_t TASKS_SUSPEND; /*!< Suspend SPI transaction. */ + __O uint32_t TASKS_RESUME; /*!< Resume SPI transaction. */ + __I uint32_t RESERVED2[56]; + __IO uint32_t EVENTS_STOPPED; /*!< SPI transaction has stopped. */ + __I uint32_t RESERVED3[2]; + __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached. */ + __I uint32_t RESERVED4[3]; + __IO uint32_t EVENTS_ENDTX; /*!< End of TXD buffer reached. */ + __I uint32_t RESERVED5[10]; + __IO uint32_t EVENTS_STARTED; /*!< Transaction started. */ + __I uint32_t RESERVED6[109]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED7[125]; + __IO uint32_t ENABLE; /*!< Enable SPIM. */ + __I uint32_t RESERVED8; + SPIM_PSEL_Type PSEL; /*!< Pin select configuration. */ + __I uint32_t RESERVED9[4]; + __IO uint32_t FREQUENCY; /*!< SPI frequency. */ + __I uint32_t RESERVED10[3]; + SPIM_RXD_Type RXD; /*!< RXD EasyDMA configuration and status. */ + __I uint32_t RESERVED11; + SPIM_TXD_Type TXD; /*!< TXD EasyDMA configuration and status. */ + __I uint32_t RESERVED12; + __IO uint32_t CONFIG; /*!< Configuration register. */ + __I uint32_t RESERVED13[26]; + __IO uint32_t ORC; /*!< Over-read character. */ + __I uint32_t RESERVED14[654]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_SPIM_Type; + + +/* ================================================================================ */ +/* ================ GPIOTE ================ */ +/* ================================================================================ */ + + +/** + * @brief GPIO tasks and events. (GPIOTE) + */ + +typedef struct { /*!< GPIOTE Structure */ + __O uint32_t TASKS_OUT[4]; /*!< Tasks asssociated with GPIOTE channels. */ + __I uint32_t RESERVED0[60]; + __IO uint32_t EVENTS_IN[4]; /*!< Tasks asssociated with GPIOTE channels. */ + __I uint32_t RESERVED1[27]; + __IO uint32_t EVENTS_PORT; /*!< Event generated from multiple pins. */ + __I uint32_t RESERVED2[97]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED3[129]; + __IO uint32_t CONFIG[4]; /*!< Channel configuration registers. */ + __I uint32_t RESERVED4[695]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_GPIOTE_Type; + + +/* ================================================================================ */ +/* ================ ADC ================ */ +/* ================================================================================ */ + + +/** + * @brief Analog to digital converter. (ADC) + */ + +typedef struct { /*!< ADC Structure */ + __O uint32_t TASKS_START; /*!< Start an ADC conversion. */ + __O uint32_t TASKS_STOP; /*!< Stop ADC. */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_END; /*!< ADC conversion complete. */ + __I uint32_t RESERVED1[128]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED2[61]; + __I uint32_t BUSY; /*!< ADC busy register. */ + __I uint32_t RESERVED3[63]; + __IO uint32_t ENABLE; /*!< ADC enable. */ + __IO uint32_t CONFIG; /*!< ADC configuration register. */ + __I uint32_t RESULT; /*!< Result of ADC conversion. */ + __I uint32_t RESERVED4[700]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_ADC_Type; + + +/* ================================================================================ */ +/* ================ TIMER ================ */ +/* ================================================================================ */ + + +/** + * @brief Timer 0. (TIMER) + */ + +typedef struct { /*!< TIMER Structure */ + __O uint32_t TASKS_START; /*!< Start Timer. */ + __O uint32_t TASKS_STOP; /*!< Stop Timer. */ + __O uint32_t TASKS_COUNT; /*!< Increment Timer (In counter mode). */ + __O uint32_t TASKS_CLEAR; /*!< Clear timer. */ + __O uint32_t TASKS_SHUTDOWN; /*!< Shutdown timer. */ + __I uint32_t RESERVED0[11]; + __O uint32_t TASKS_CAPTURE[4]; /*!< Capture Timer value to CC[n] registers. */ + __I uint32_t RESERVED1[60]; + __IO uint32_t EVENTS_COMPARE[4]; /*!< Compare event on CC[n] match. */ + __I uint32_t RESERVED2[44]; + __IO uint32_t SHORTS; /*!< Shortcuts for Timer. */ + __I uint32_t RESERVED3[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED4[126]; + __IO uint32_t MODE; /*!< Timer Mode selection. */ + __IO uint32_t BITMODE; /*!< Sets timer behaviour. */ + __I uint32_t RESERVED5; + __IO uint32_t PRESCALER; /*!< 4-bit prescaler to source clock frequency (max value 9). Source + clock frequency is divided by 2^SCALE. */ + __I uint32_t RESERVED6[11]; + __IO uint32_t CC[4]; /*!< Capture/compare registers. */ + __I uint32_t RESERVED7[683]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_TIMER_Type; + + +/* ================================================================================ */ +/* ================ RTC ================ */ +/* ================================================================================ */ + + +/** + * @brief Real time counter 0. (RTC) + */ + +typedef struct { /*!< RTC Structure */ + __O uint32_t TASKS_START; /*!< Start RTC Counter. */ + __O uint32_t TASKS_STOP; /*!< Stop RTC Counter. */ + __O uint32_t TASKS_CLEAR; /*!< Clear RTC Counter. */ + __O uint32_t TASKS_TRIGOVRFLW; /*!< Set COUNTER to 0xFFFFFFF0. */ + __I uint32_t RESERVED0[60]; + __IO uint32_t EVENTS_TICK; /*!< Event on COUNTER increment. */ + __IO uint32_t EVENTS_OVRFLW; /*!< Event on COUNTER overflow. */ + __I uint32_t RESERVED1[14]; + __IO uint32_t EVENTS_COMPARE[4]; /*!< Compare event on CC[n] match. */ + __I uint32_t RESERVED2[109]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED3[13]; + __IO uint32_t EVTEN; /*!< Configures event enable routing to PPI for each RTC event. */ + __IO uint32_t EVTENSET; /*!< Enable events routing to PPI. The reading of this register gives + the value of EVTEN. */ + __IO uint32_t EVTENCLR; /*!< Disable events routing to PPI. The reading of this register + gives the value of EVTEN. */ + __I uint32_t RESERVED4[110]; + __I uint32_t COUNTER; /*!< Current COUNTER value. */ + __IO uint32_t PRESCALER; /*!< 12-bit prescaler for COUNTER frequency (32768/(PRESCALER+1)). + Must be written when RTC is STOPed. */ + __I uint32_t RESERVED5[13]; + __IO uint32_t CC[4]; /*!< Capture/compare registers. */ + __I uint32_t RESERVED6[683]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_RTC_Type; + + +/* ================================================================================ */ +/* ================ TEMP ================ */ +/* ================================================================================ */ + + +/** + * @brief Temperature Sensor. (TEMP) + */ + +typedef struct { /*!< TEMP Structure */ + __O uint32_t TASKS_START; /*!< Start temperature measurement. */ + __O uint32_t TASKS_STOP; /*!< Stop temperature measurement. */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_DATARDY; /*!< Temperature measurement complete, data ready event. */ + __I uint32_t RESERVED1[128]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED2[127]; + __I int32_t TEMP; /*!< Die temperature in degC, 2's complement format, 0.25 degC pecision. */ + __I uint32_t RESERVED3[700]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_TEMP_Type; + + +/* ================================================================================ */ +/* ================ RNG ================ */ +/* ================================================================================ */ + + +/** + * @brief Random Number Generator. (RNG) + */ + +typedef struct { /*!< RNG Structure */ + __O uint32_t TASKS_START; /*!< Start the random number generator. */ + __O uint32_t TASKS_STOP; /*!< Stop the random number generator. */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_VALRDY; /*!< New random number generated and written to VALUE register. */ + __I uint32_t RESERVED1[63]; + __IO uint32_t SHORTS; /*!< Shortcuts for the RNG. */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register */ + __I uint32_t RESERVED3[126]; + __IO uint32_t CONFIG; /*!< Configuration register. */ + __I uint32_t VALUE; /*!< RNG random number. */ + __I uint32_t RESERVED4[700]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_RNG_Type; + + +/* ================================================================================ */ +/* ================ ECB ================ */ +/* ================================================================================ */ + + +/** + * @brief AES ECB Mode Encryption. (ECB) + */ + +typedef struct { /*!< ECB Structure */ + __O uint32_t TASKS_STARTECB; /*!< Start ECB block encrypt. If a crypto operation is running, this + will not initiate a new encryption and the ERRORECB event will + be triggered. */ + __O uint32_t TASKS_STOPECB; /*!< Stop current ECB encryption. If a crypto operation is running, + this will will trigger the ERRORECB event. */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_ENDECB; /*!< ECB block encrypt complete. */ + __IO uint32_t EVENTS_ERRORECB; /*!< ECB block encrypt aborted due to a STOPECB task or due to an + error. */ + __I uint32_t RESERVED1[127]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED2[126]; + __IO uint32_t ECBDATAPTR; /*!< ECB block encrypt memory pointer. */ + __I uint32_t RESERVED3[701]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_ECB_Type; + + +/* ================================================================================ */ +/* ================ AAR ================ */ +/* ================================================================================ */ + + +/** + * @brief Accelerated Address Resolver. (AAR) + */ + +typedef struct { /*!< AAR Structure */ + __O uint32_t TASKS_START; /*!< Start resolving addresses based on IRKs specified in the IRK + data structure. */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STOP; /*!< Stop resolving addresses. */ + __I uint32_t RESERVED1[61]; + __IO uint32_t EVENTS_END; /*!< Address resolution procedure completed. */ + __IO uint32_t EVENTS_RESOLVED; /*!< Address resolved. */ + __IO uint32_t EVENTS_NOTRESOLVED; /*!< Address not resolved. */ + __I uint32_t RESERVED2[126]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED3[61]; + __I uint32_t STATUS; /*!< Resolution status. */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< Enable AAR. */ + __IO uint32_t NIRK; /*!< Number of Identity root Keys in the IRK data structure. */ + __IO uint32_t IRKPTR; /*!< Pointer to the IRK data structure. */ + __I uint32_t RESERVED5; + __IO uint32_t ADDRPTR; /*!< Pointer to the resolvable address (6 bytes). */ + __IO uint32_t SCRATCHPTR; /*!< Pointer to a scratch data area used for temporary storage during + resolution. A minimum of 3 bytes must be reserved. */ + __I uint32_t RESERVED6[697]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_AAR_Type; + + +/* ================================================================================ */ +/* ================ CCM ================ */ +/* ================================================================================ */ + + +/** + * @brief AES CCM Mode Encryption. (CCM) + */ + +typedef struct { /*!< CCM Structure */ + __O uint32_t TASKS_KSGEN; /*!< Start generation of key-stream. This operation will stop by + itself when completed. */ + __O uint32_t TASKS_CRYPT; /*!< Start encrypt/decrypt. This operation will stop by itself when + completed. */ + __O uint32_t TASKS_STOP; /*!< Stop encrypt/decrypt. */ + __I uint32_t RESERVED0[61]; + __IO uint32_t EVENTS_ENDKSGEN; /*!< Keystream generation completed. */ + __IO uint32_t EVENTS_ENDCRYPT; /*!< Encrypt/decrypt completed. */ + __IO uint32_t EVENTS_ERROR; /*!< Error happened. */ + __I uint32_t RESERVED1[61]; + __IO uint32_t SHORTS; /*!< Shortcuts for the CCM. */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED3[61]; + __I uint32_t MICSTATUS; /*!< CCM RX MIC check result. */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< CCM enable. */ + __IO uint32_t MODE; /*!< Operation mode. */ + __IO uint32_t CNFPTR; /*!< Pointer to a data structure holding AES key and NONCE vector. */ + __IO uint32_t INPTR; /*!< Pointer to the input packet. */ + __IO uint32_t OUTPTR; /*!< Pointer to the output packet. */ + __IO uint32_t SCRATCHPTR; /*!< Pointer to a scratch data area used for temporary storage during + resolution. A minimum of 43 bytes must be reserved. */ + __I uint32_t RESERVED5[697]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_CCM_Type; + + +/* ================================================================================ */ +/* ================ WDT ================ */ +/* ================================================================================ */ + + +/** + * @brief Watchdog Timer. (WDT) + */ + +typedef struct { /*!< WDT Structure */ + __O uint32_t TASKS_START; /*!< Start the watchdog. */ + __I uint32_t RESERVED0[63]; + __IO uint32_t EVENTS_TIMEOUT; /*!< Watchdog timeout. */ + __I uint32_t RESERVED1[128]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED2[61]; + __I uint32_t RUNSTATUS; /*!< Watchdog running status. */ + __I uint32_t REQSTATUS; /*!< Request status. */ + __I uint32_t RESERVED3[63]; + __IO uint32_t CRV; /*!< Counter reload value in number of 32kiHz clock cycles. */ + __IO uint32_t RREN; /*!< Reload request enable. */ + __IO uint32_t CONFIG; /*!< Configuration register. */ + __I uint32_t RESERVED4[60]; + __O uint32_t RR[8]; /*!< Reload requests registers. */ + __I uint32_t RESERVED5[631]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_WDT_Type; + + +/* ================================================================================ */ +/* ================ QDEC ================ */ +/* ================================================================================ */ + + +/** + * @brief Rotary decoder. (QDEC) + */ + +typedef struct { /*!< QDEC Structure */ + __O uint32_t TASKS_START; /*!< Start the quadrature decoder. */ + __O uint32_t TASKS_STOP; /*!< Stop the quadrature decoder. */ + __O uint32_t TASKS_READCLRACC; /*!< Transfers the content from ACC registers to ACCREAD registers, + and clears the ACC registers. */ + __I uint32_t RESERVED0[61]; + __IO uint32_t EVENTS_SAMPLERDY; /*!< A new sample is written to the sample register. */ + __IO uint32_t EVENTS_REPORTRDY; /*!< REPORTPER number of samples accumulated in ACC register, and + ACC register different than zero. */ + __IO uint32_t EVENTS_ACCOF; /*!< ACC or ACCDBL register overflow. */ + __I uint32_t RESERVED1[61]; + __IO uint32_t SHORTS; /*!< Shortcuts for the QDEC. */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED3[125]; + __IO uint32_t ENABLE; /*!< Enable the QDEC. */ + __IO uint32_t LEDPOL; /*!< LED output pin polarity. */ + __IO uint32_t SAMPLEPER; /*!< Sample period. */ + __I int32_t SAMPLE; /*!< Motion sample value. */ + __IO uint32_t REPORTPER; /*!< Number of samples to generate an EVENT_REPORTRDY. */ + __I int32_t ACC; /*!< Accumulated valid transitions register. */ + __I int32_t ACCREAD; /*!< Snapshot of ACC register. Value generated by the TASKS_READCLEACC + task. */ + __IO uint32_t PSELLED; /*!< Pin select for LED output. */ + __IO uint32_t PSELA; /*!< Pin select for phase A input. */ + __IO uint32_t PSELB; /*!< Pin select for phase B input. */ + __IO uint32_t DBFEN; /*!< Enable debouncer input filters. */ + __I uint32_t RESERVED4[5]; + __IO uint32_t LEDPRE; /*!< Time LED is switched ON before the sample. */ + __I uint32_t ACCDBL; /*!< Accumulated double (error) transitions register. */ + __I uint32_t ACCDBLREAD; /*!< Snapshot of ACCDBL register. Value generated by the TASKS_READCLEACC + task. */ + __I uint32_t RESERVED5[684]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_QDEC_Type; + + +/* ================================================================================ */ +/* ================ LPCOMP ================ */ +/* ================================================================================ */ + + +/** + * @brief Low power comparator. (LPCOMP) + */ + +typedef struct { /*!< LPCOMP Structure */ + __O uint32_t TASKS_START; /*!< Start the comparator. */ + __O uint32_t TASKS_STOP; /*!< Stop the comparator. */ + __O uint32_t TASKS_SAMPLE; /*!< Sample comparator value. */ + __I uint32_t RESERVED0[61]; + __IO uint32_t EVENTS_READY; /*!< LPCOMP is ready and output is valid. */ + __IO uint32_t EVENTS_DOWN; /*!< Input voltage crossed the threshold going down. */ + __IO uint32_t EVENTS_UP; /*!< Input voltage crossed the threshold going up. */ + __IO uint32_t EVENTS_CROSS; /*!< Input voltage crossed the threshold in any direction. */ + __I uint32_t RESERVED1[60]; + __IO uint32_t SHORTS; /*!< Shortcuts for the LPCOMP. */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ + __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ + __I uint32_t RESERVED3[61]; + __I uint32_t RESULT; /*!< Result of last compare. */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< Enable the LPCOMP. */ + __IO uint32_t PSEL; /*!< Input pin select. */ + __IO uint32_t REFSEL; /*!< Reference select. */ + __IO uint32_t EXTREFSEL; /*!< External reference select. */ + __I uint32_t RESERVED5[4]; + __IO uint32_t ANADETECT; /*!< Analog detect configuration. */ + __I uint32_t RESERVED6[694]; + __IO uint32_t POWER; /*!< Peripheral power control. */ +} NRF_LPCOMP_Type; + + +/* ================================================================================ */ +/* ================ SWI ================ */ +/* ================================================================================ */ + + +/** + * @brief SW Interrupts. (SWI) + */ + +typedef struct { /*!< SWI Structure */ + __I uint32_t UNUSED; /*!< Unused. */ +} NRF_SWI_Type; + + +/* ================================================================================ */ +/* ================ NVMC ================ */ +/* ================================================================================ */ + + +/** + * @brief Non Volatile Memory Controller. (NVMC) + */ + +typedef struct { /*!< NVMC Structure */ + __I uint32_t RESERVED0[256]; + __I uint32_t READY; /*!< Ready flag. */ + __I uint32_t RESERVED1[64]; + __IO uint32_t CONFIG; /*!< Configuration register. */ + + union { + __IO uint32_t ERASEPCR1; /*!< Register for erasing a non-protected non-volatile memory page. */ + __IO uint32_t ERASEPAGE; /*!< Register for erasing a non-protected non-volatile memory page. */ + }; + __IO uint32_t ERASEALL; /*!< Register for erasing all non-volatile user memory. */ + __IO uint32_t ERASEPCR0; /*!< Register for erasing a protected non-volatile memory page. */ + __IO uint32_t ERASEUICR; /*!< Register for start erasing User Information Congfiguration Registers. */ +} NRF_NVMC_Type; + + +/* ================================================================================ */ +/* ================ PPI ================ */ +/* ================================================================================ */ + + +/** + * @brief PPI controller. (PPI) + */ + +typedef struct { /*!< PPI Structure */ + PPI_TASKS_CHG_Type TASKS_CHG[4]; /*!< Channel group tasks. */ + __I uint32_t RESERVED0[312]; + __IO uint32_t CHEN; /*!< Channel enable. */ + __IO uint32_t CHENSET; /*!< Channel enable set. */ + __IO uint32_t CHENCLR; /*!< Channel enable clear. */ + __I uint32_t RESERVED1; + PPI_CH_Type CH[16]; /*!< PPI Channel. */ + __I uint32_t RESERVED2[156]; + __IO uint32_t CHG[4]; /*!< Channel group configuration. */ +} NRF_PPI_Type; + + +/* ================================================================================ */ +/* ================ FICR ================ */ +/* ================================================================================ */ + + +/** + * @brief Factory Information Configuration. (FICR) + */ + +typedef struct { /*!< FICR Structure */ + __I uint32_t RESERVED0[4]; + __I uint32_t CODEPAGESIZE; /*!< Code memory page size in bytes. */ + __I uint32_t CODESIZE; /*!< Code memory size in pages. */ + __I uint32_t RESERVED1[4]; + __I uint32_t CLENR0; /*!< Length of code region 0 in bytes. */ + __I uint32_t PPFC; /*!< Pre-programmed factory code present. */ + __I uint32_t RESERVED2; + __I uint32_t NUMRAMBLOCK; /*!< Number of individualy controllable RAM blocks. */ + + union { + __I uint32_t SIZERAMBLOCK[4]; /*!< Deprecated array of size of RAM block in bytes. This name is + kept for backward compatinility purposes. Use SIZERAMBLOCKS + instead. */ + __I uint32_t SIZERAMBLOCKS; /*!< Size of RAM blocks in bytes. */ + }; + __I uint32_t RESERVED3[5]; + __I uint32_t CONFIGID; /*!< Configuration identifier. */ + __I uint32_t DEVICEID[2]; /*!< Device identifier. */ + __I uint32_t RESERVED4[6]; + __I uint32_t ER[4]; /*!< Encryption root. */ + __I uint32_t IR[4]; /*!< Identity root. */ + __I uint32_t DEVICEADDRTYPE; /*!< Device address type. */ + __I uint32_t DEVICEADDR[2]; /*!< Device address. */ + __I uint32_t OVERRIDEEN; /*!< Radio calibration override enable. */ + __I uint32_t NRF_1MBIT[5]; /*!< Override values for the OVERRIDEn registers in RADIO for NRF_1Mbit + mode. */ + __I uint32_t RESERVED5[10]; + __I uint32_t BLE_1MBIT[5]; /*!< Override values for the OVERRIDEn registers in RADIO for BLE_1Mbit + mode. */ +} NRF_FICR_Type; + + +/* ================================================================================ */ +/* ================ UICR ================ */ +/* ================================================================================ */ + + +/** + * @brief User Information Configuration. (UICR) + */ + +typedef struct { /*!< UICR Structure */ + __IO uint32_t CLENR0; /*!< Length of code region 0. */ + __IO uint32_t RBPCONF; /*!< Readback protection configuration. */ + __IO uint32_t XTALFREQ; /*!< Reset value for CLOCK XTALFREQ register. */ + __I uint32_t RESERVED0; + __I uint32_t FWID; /*!< Firmware ID. */ + + union { + __IO uint32_t NRFFW[15]; /*!< Reserved for Nordic firmware design. */ + __IO uint32_t BOOTLOADERADDR; /*!< Bootloader start address. */ + }; + __IO uint32_t NRFHW[12]; /*!< Reserved for Nordic hardware design. */ + __IO uint32_t CUSTOMER[32]; /*!< Reserved for customer. */ +} NRF_UICR_Type; + + +/* ================================================================================ */ +/* ================ GPIO ================ */ +/* ================================================================================ */ + + +/** + * @brief General purpose input and output. (GPIO) + */ + +typedef struct { /*!< GPIO Structure */ + __I uint32_t RESERVED0[321]; + __IO uint32_t OUT; /*!< Write GPIO port. */ + __IO uint32_t OUTSET; /*!< Set individual bits in GPIO port. */ + __IO uint32_t OUTCLR; /*!< Clear individual bits in GPIO port. */ + __I uint32_t IN; /*!< Read GPIO port. */ + __IO uint32_t DIR; /*!< Direction of GPIO pins. */ + __IO uint32_t DIRSET; /*!< DIR set register. */ + __IO uint32_t DIRCLR; /*!< DIR clear register. */ + __I uint32_t RESERVED1[120]; + __IO uint32_t PIN_CNF[32]; /*!< Configuration of GPIO pins. */ +} NRF_GPIO_Type; + + +/* -------------------- End of section using anonymous unions ------------------- */ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + /* leave anonymous unions enabled */ +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#elif defined(__TMS470__) + /* anonymous unions are enabled by default */ +#elif defined(__TASKING__) + #pragma warning restore +#else + #warning Not supported compiler type +#endif + + + + +/* ================================================================================ */ +/* ================ Peripheral memory map ================ */ +/* ================================================================================ */ + +#define NRF_POWER_BASE 0x40000000UL +#define NRF_CLOCK_BASE 0x40000000UL +#define NRF_MPU_BASE 0x40000000UL +#define NRF_AMLI_BASE 0x40000000UL +#define NRF_RADIO_BASE 0x40001000UL +#define NRF_UART0_BASE 0x40002000UL +#define NRF_SPI0_BASE 0x40003000UL +#define NRF_TWI0_BASE 0x40003000UL +#define NRF_SPI1_BASE 0x40004000UL +#define NRF_TWI1_BASE 0x40004000UL +#define NRF_SPIS1_BASE 0x40004000UL +#define NRF_SPIM1_BASE 0x40004000UL +#define NRF_GPIOTE_BASE 0x40006000UL +#define NRF_ADC_BASE 0x40007000UL +#define NRF_TIMER0_BASE 0x40008000UL +#define NRF_TIMER1_BASE 0x40009000UL +#define NRF_TIMER2_BASE 0x4000A000UL +#define NRF_RTC0_BASE 0x4000B000UL +#define NRF_TEMP_BASE 0x4000C000UL +#define NRF_RNG_BASE 0x4000D000UL +#define NRF_ECB_BASE 0x4000E000UL +#define NRF_AAR_BASE 0x4000F000UL +#define NRF_CCM_BASE 0x4000F000UL +#define NRF_WDT_BASE 0x40010000UL +#define NRF_RTC1_BASE 0x40011000UL +#define NRF_QDEC_BASE 0x40012000UL +#define NRF_LPCOMP_BASE 0x40013000UL +#define NRF_SWI_BASE 0x40014000UL +#define NRF_NVMC_BASE 0x4001E000UL +#define NRF_PPI_BASE 0x4001F000UL +#define NRF_FICR_BASE 0x10000000UL +#define NRF_UICR_BASE 0x10001000UL +#define NRF_GPIO_BASE 0x50000000UL + + +/* ================================================================================ */ +/* ================ Peripheral declaration ================ */ +/* ================================================================================ */ + +#define NRF_POWER ((NRF_POWER_Type *) NRF_POWER_BASE) +#define NRF_CLOCK ((NRF_CLOCK_Type *) NRF_CLOCK_BASE) +#define NRF_MPU ((NRF_MPU_Type *) NRF_MPU_BASE) +#define NRF_AMLI ((NRF_AMLI_Type *) NRF_AMLI_BASE) +#define NRF_RADIO ((NRF_RADIO_Type *) NRF_RADIO_BASE) +#define NRF_UART0 ((NRF_UART_Type *) NRF_UART0_BASE) +#define NRF_SPI0 ((NRF_SPI_Type *) NRF_SPI0_BASE) +#define NRF_TWI0 ((NRF_TWI_Type *) NRF_TWI0_BASE) +#define NRF_SPI1 ((NRF_SPI_Type *) NRF_SPI1_BASE) +#define NRF_TWI1 ((NRF_TWI_Type *) NRF_TWI1_BASE) +#define NRF_SPIS1 ((NRF_SPIS_Type *) NRF_SPIS1_BASE) +#define NRF_SPIM1 ((NRF_SPIM_Type *) NRF_SPIM1_BASE) +#define NRF_GPIOTE ((NRF_GPIOTE_Type *) NRF_GPIOTE_BASE) +#define NRF_ADC ((NRF_ADC_Type *) NRF_ADC_BASE) +#define NRF_TIMER0 ((NRF_TIMER_Type *) NRF_TIMER0_BASE) +#define NRF_TIMER1 ((NRF_TIMER_Type *) NRF_TIMER1_BASE) +#define NRF_TIMER2 ((NRF_TIMER_Type *) NRF_TIMER2_BASE) +#define NRF_RTC0 ((NRF_RTC_Type *) NRF_RTC0_BASE) +#define NRF_TEMP ((NRF_TEMP_Type *) NRF_TEMP_BASE) +#define NRF_RNG ((NRF_RNG_Type *) NRF_RNG_BASE) +#define NRF_ECB ((NRF_ECB_Type *) NRF_ECB_BASE) +#define NRF_AAR ((NRF_AAR_Type *) NRF_AAR_BASE) +#define NRF_CCM ((NRF_CCM_Type *) NRF_CCM_BASE) +#define NRF_WDT ((NRF_WDT_Type *) NRF_WDT_BASE) +#define NRF_RTC1 ((NRF_RTC_Type *) NRF_RTC1_BASE) +#define NRF_QDEC ((NRF_QDEC_Type *) NRF_QDEC_BASE) +#define NRF_LPCOMP ((NRF_LPCOMP_Type *) NRF_LPCOMP_BASE) +#define NRF_SWI ((NRF_SWI_Type *) NRF_SWI_BASE) +#define NRF_NVMC ((NRF_NVMC_Type *) NRF_NVMC_BASE) +#define NRF_PPI ((NRF_PPI_Type *) NRF_PPI_BASE) +#define NRF_FICR ((NRF_FICR_Type *) NRF_FICR_BASE) +#define NRF_UICR ((NRF_UICR_Type *) NRF_UICR_BASE) +#define NRF_GPIO ((NRF_GPIO_Type *) NRF_GPIO_BASE) + + +/** @} */ /* End of group Device_Peripheral_Registers */ +/** @} */ /* End of group nrf51 */ +/** @} */ /* End of group Nordic Semiconductor */ + +#ifdef __cplusplus +} +#endif + + +#endif /* nrf51_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_bitfields.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_bitfields.h new file mode 100644 index 0000000000..f9b512fef7 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_bitfields.h @@ -0,0 +1,6901 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __NRF51_BITS_H +#define __NRF51_BITS_H + +/*lint ++flb "Enter library region" */ + +/* Peripheral: AAR */ +/* Description: Accelerated Address Resolver. */ + +/* Register: AAR_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 2 : Enable interrupt on NOTRESOLVED event. */ +#define AAR_INTENSET_NOTRESOLVED_Pos (2UL) /*!< Position of NOTRESOLVED field. */ +#define AAR_INTENSET_NOTRESOLVED_Msk (0x1UL << AAR_INTENSET_NOTRESOLVED_Pos) /*!< Bit mask of NOTRESOLVED field. */ +#define AAR_INTENSET_NOTRESOLVED_Disabled (0UL) /*!< Interrupt disabled. */ +#define AAR_INTENSET_NOTRESOLVED_Enabled (1UL) /*!< Interrupt enabled. */ +#define AAR_INTENSET_NOTRESOLVED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on RESOLVED event. */ +#define AAR_INTENSET_RESOLVED_Pos (1UL) /*!< Position of RESOLVED field. */ +#define AAR_INTENSET_RESOLVED_Msk (0x1UL << AAR_INTENSET_RESOLVED_Pos) /*!< Bit mask of RESOLVED field. */ +#define AAR_INTENSET_RESOLVED_Disabled (0UL) /*!< Interrupt disabled. */ +#define AAR_INTENSET_RESOLVED_Enabled (1UL) /*!< Interrupt enabled. */ +#define AAR_INTENSET_RESOLVED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on END event. */ +#define AAR_INTENSET_END_Pos (0UL) /*!< Position of END field. */ +#define AAR_INTENSET_END_Msk (0x1UL << AAR_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define AAR_INTENSET_END_Disabled (0UL) /*!< Interrupt disabled. */ +#define AAR_INTENSET_END_Enabled (1UL) /*!< Interrupt enabled. */ +#define AAR_INTENSET_END_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: AAR_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 2 : Disable interrupt on NOTRESOLVED event. */ +#define AAR_INTENCLR_NOTRESOLVED_Pos (2UL) /*!< Position of NOTRESOLVED field. */ +#define AAR_INTENCLR_NOTRESOLVED_Msk (0x1UL << AAR_INTENCLR_NOTRESOLVED_Pos) /*!< Bit mask of NOTRESOLVED field. */ +#define AAR_INTENCLR_NOTRESOLVED_Disabled (0UL) /*!< Interrupt disabled. */ +#define AAR_INTENCLR_NOTRESOLVED_Enabled (1UL) /*!< Interrupt enabled. */ +#define AAR_INTENCLR_NOTRESOLVED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on RESOLVED event. */ +#define AAR_INTENCLR_RESOLVED_Pos (1UL) /*!< Position of RESOLVED field. */ +#define AAR_INTENCLR_RESOLVED_Msk (0x1UL << AAR_INTENCLR_RESOLVED_Pos) /*!< Bit mask of RESOLVED field. */ +#define AAR_INTENCLR_RESOLVED_Disabled (0UL) /*!< Interrupt disabled. */ +#define AAR_INTENCLR_RESOLVED_Enabled (1UL) /*!< Interrupt enabled. */ +#define AAR_INTENCLR_RESOLVED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on ENDKSGEN event. */ +#define AAR_INTENCLR_END_Pos (0UL) /*!< Position of END field. */ +#define AAR_INTENCLR_END_Msk (0x1UL << AAR_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define AAR_INTENCLR_END_Disabled (0UL) /*!< Interrupt disabled. */ +#define AAR_INTENCLR_END_Enabled (1UL) /*!< Interrupt enabled. */ +#define AAR_INTENCLR_END_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: AAR_STATUS */ +/* Description: Resolution status. */ + +/* Bits 3..0 : The IRK used last time an address was resolved. */ +#define AAR_STATUS_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define AAR_STATUS_STATUS_Msk (0xFUL << AAR_STATUS_STATUS_Pos) /*!< Bit mask of STATUS field. */ + +/* Register: AAR_ENABLE */ +/* Description: Enable AAR. */ + +/* Bits 1..0 : Enable AAR. */ +#define AAR_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define AAR_ENABLE_ENABLE_Msk (0x3UL << AAR_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define AAR_ENABLE_ENABLE_Disabled (0x00UL) /*!< Disabled AAR. */ +#define AAR_ENABLE_ENABLE_Enabled (0x03UL) /*!< Enable AAR. */ + +/* Register: AAR_NIRK */ +/* Description: Number of Identity root Keys in the IRK data structure. */ + +/* Bits 4..0 : Number of Identity root Keys in the IRK data structure. */ +#define AAR_NIRK_NIRK_Pos (0UL) /*!< Position of NIRK field. */ +#define AAR_NIRK_NIRK_Msk (0x1FUL << AAR_NIRK_NIRK_Pos) /*!< Bit mask of NIRK field. */ + +/* Register: AAR_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define AAR_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define AAR_POWER_POWER_Msk (0x1UL << AAR_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define AAR_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define AAR_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: ADC */ +/* Description: Analog to digital converter. */ + +/* Register: ADC_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 0 : Enable interrupt on END event. */ +#define ADC_INTENSET_END_Pos (0UL) /*!< Position of END field. */ +#define ADC_INTENSET_END_Msk (0x1UL << ADC_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define ADC_INTENSET_END_Disabled (0UL) /*!< Interrupt disabled. */ +#define ADC_INTENSET_END_Enabled (1UL) /*!< Interrupt enabled. */ +#define ADC_INTENSET_END_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: ADC_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 0 : Disable interrupt on END event. */ +#define ADC_INTENCLR_END_Pos (0UL) /*!< Position of END field. */ +#define ADC_INTENCLR_END_Msk (0x1UL << ADC_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define ADC_INTENCLR_END_Disabled (0UL) /*!< Interrupt disabled. */ +#define ADC_INTENCLR_END_Enabled (1UL) /*!< Interrupt enabled. */ +#define ADC_INTENCLR_END_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: ADC_BUSY */ +/* Description: ADC busy register. */ + +/* Bit 0 : ADC busy register. */ +#define ADC_BUSY_BUSY_Pos (0UL) /*!< Position of BUSY field. */ +#define ADC_BUSY_BUSY_Msk (0x1UL << ADC_BUSY_BUSY_Pos) /*!< Bit mask of BUSY field. */ +#define ADC_BUSY_BUSY_Ready (0UL) /*!< No ongoing ADC conversion is taking place. ADC is ready. */ +#define ADC_BUSY_BUSY_Busy (1UL) /*!< An ADC conversion is taking place. ADC is busy. */ + +/* Register: ADC_ENABLE */ +/* Description: ADC enable. */ + +/* Bits 1..0 : ADC enable. */ +#define ADC_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define ADC_ENABLE_ENABLE_Msk (0x3UL << ADC_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define ADC_ENABLE_ENABLE_Disabled (0x00UL) /*!< ADC is disabled. */ +#define ADC_ENABLE_ENABLE_Enabled (0x01UL) /*!< ADC is enabled. If an analog input pin is selected as source of the conversion, the selected pin is configured as an analog input. */ + +/* Register: ADC_CONFIG */ +/* Description: ADC configuration register. */ + +/* Bits 17..16 : ADC external reference pin selection. */ +#define ADC_CONFIG_EXTREFSEL_Pos (16UL) /*!< Position of EXTREFSEL field. */ +#define ADC_CONFIG_EXTREFSEL_Msk (0x3UL << ADC_CONFIG_EXTREFSEL_Pos) /*!< Bit mask of EXTREFSEL field. */ +#define ADC_CONFIG_EXTREFSEL_None (0UL) /*!< Analog external reference inputs disabled. */ +#define ADC_CONFIG_EXTREFSEL_AnalogReference0 (1UL) /*!< Use analog reference 0 as reference. */ +#define ADC_CONFIG_EXTREFSEL_AnalogReference1 (2UL) /*!< Use analog reference 1 as reference. */ + +/* Bits 15..8 : ADC analog pin selection. */ +#define ADC_CONFIG_PSEL_Pos (8UL) /*!< Position of PSEL field. */ +#define ADC_CONFIG_PSEL_Msk (0xFFUL << ADC_CONFIG_PSEL_Pos) /*!< Bit mask of PSEL field. */ +#define ADC_CONFIG_PSEL_Disabled (0UL) /*!< Analog input pins disabled. */ +#define ADC_CONFIG_PSEL_AnalogInput0 (1UL) /*!< Use analog input 0 as analog input. */ +#define ADC_CONFIG_PSEL_AnalogInput1 (2UL) /*!< Use analog input 1 as analog input. */ +#define ADC_CONFIG_PSEL_AnalogInput2 (4UL) /*!< Use analog input 2 as analog input. */ +#define ADC_CONFIG_PSEL_AnalogInput3 (8UL) /*!< Use analog input 3 as analog input. */ +#define ADC_CONFIG_PSEL_AnalogInput4 (16UL) /*!< Use analog input 4 as analog input. */ +#define ADC_CONFIG_PSEL_AnalogInput5 (32UL) /*!< Use analog input 5 as analog input. */ +#define ADC_CONFIG_PSEL_AnalogInput6 (64UL) /*!< Use analog input 6 as analog input. */ +#define ADC_CONFIG_PSEL_AnalogInput7 (128UL) /*!< Use analog input 7 as analog input. */ + +/* Bits 6..5 : ADC reference selection. */ +#define ADC_CONFIG_REFSEL_Pos (5UL) /*!< Position of REFSEL field. */ +#define ADC_CONFIG_REFSEL_Msk (0x3UL << ADC_CONFIG_REFSEL_Pos) /*!< Bit mask of REFSEL field. */ +#define ADC_CONFIG_REFSEL_VBG (0x00UL) /*!< Use internal 1.2V bandgap voltage as reference for conversion. */ +#define ADC_CONFIG_REFSEL_External (0x01UL) /*!< Use external source configured by EXTREFSEL as reference for conversion. */ +#define ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling (0x02UL) /*!< Use supply voltage with 1/2 prescaling as reference for conversion. Only usable when supply voltage is between 1.7V and 2.6V. */ +#define ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling (0x03UL) /*!< Use supply voltage with 1/3 prescaling as reference for conversion. Only usable when supply voltage is between 2.5V and 3.6V. */ + +/* Bits 4..2 : ADC input selection. */ +#define ADC_CONFIG_INPSEL_Pos (2UL) /*!< Position of INPSEL field. */ +#define ADC_CONFIG_INPSEL_Msk (0x7UL << ADC_CONFIG_INPSEL_Pos) /*!< Bit mask of INPSEL field. */ +#define ADC_CONFIG_INPSEL_AnalogInputNoPrescaling (0x00UL) /*!< Analog input specified by PSEL with no prescaling used as input for the conversion. */ +#define ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling (0x01UL) /*!< Analog input specified by PSEL with 2/3 prescaling used as input for the conversion. */ +#define ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling (0x02UL) /*!< Analog input specified by PSEL with 1/3 prescaling used as input for the conversion. */ +#define ADC_CONFIG_INPSEL_SupplyTwoThirdsPrescaling (0x05UL) /*!< Supply voltage with 2/3 prescaling used as input for the conversion. */ +#define ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling (0x06UL) /*!< Supply voltage with 1/3 prescaling used as input for the conversion. */ + +/* Bits 1..0 : ADC resolution. */ +#define ADC_CONFIG_RES_Pos (0UL) /*!< Position of RES field. */ +#define ADC_CONFIG_RES_Msk (0x3UL << ADC_CONFIG_RES_Pos) /*!< Bit mask of RES field. */ +#define ADC_CONFIG_RES_8bit (0x00UL) /*!< 8bit ADC resolution. */ +#define ADC_CONFIG_RES_9bit (0x01UL) /*!< 9bit ADC resolution. */ +#define ADC_CONFIG_RES_10bit (0x02UL) /*!< 10bit ADC resolution. */ + +/* Register: ADC_RESULT */ +/* Description: Result of ADC conversion. */ + +/* Bits 9..0 : Result of ADC conversion. */ +#define ADC_RESULT_RESULT_Pos (0UL) /*!< Position of RESULT field. */ +#define ADC_RESULT_RESULT_Msk (0x3FFUL << ADC_RESULT_RESULT_Pos) /*!< Bit mask of RESULT field. */ + +/* Register: ADC_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define ADC_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define ADC_POWER_POWER_Msk (0x1UL << ADC_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define ADC_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define ADC_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: AMLI */ +/* Description: AHB Multi-Layer Interface. */ + +/* Register: AMLI_RAMPRI_CPU0 */ +/* Description: Configurable priority configuration register for CPU0. */ + +/* Bits 31..28 : Configuration field for RAM block 7. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_CPU0_RAM7_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 27..24 : Configuration field for RAM block 6. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_CPU0_RAM6_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 23..20 : Configuration field for RAM block 5. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_CPU0_RAM5_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 19..16 : Configuration field for RAM block 4. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_CPU0_RAM4_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 15..12 : Configuration field for RAM block 3. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_CPU0_RAM3_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 11..8 : Configuration field for RAM block 2. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_CPU0_RAM2_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 7..4 : Configuration field for RAM block 1. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_CPU0_RAM1_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 3..0 : Configuration field for RAM block 0. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_CPU0_RAM0_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Register: AMLI_RAMPRI_SPIS1 */ +/* Description: Configurable priority configuration register for SPIS1. */ + +/* Bits 31..28 : Configuration field for RAM block 7. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 27..24 : Configuration field for RAM block 6. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 23..20 : Configuration field for RAM block 5. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 19..16 : Configuration field for RAM block 4. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 15..12 : Configuration field for RAM block 3. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 11..8 : Configuration field for RAM block 2. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 7..4 : Configuration field for RAM block 1. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 3..0 : Configuration field for RAM block 0. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Register: AMLI_RAMPRI_RADIO */ +/* Description: Configurable priority configuration register for RADIO. */ + +/* Bits 31..28 : Configuration field for RAM block 7. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_RADIO_RAM7_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 27..24 : Configuration field for RAM block 6. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_RADIO_RAM6_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 23..20 : Configuration field for RAM block 5. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_RADIO_RAM5_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 19..16 : Configuration field for RAM block 4. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_RADIO_RAM4_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 15..12 : Configuration field for RAM block 3. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_RADIO_RAM3_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 11..8 : Configuration field for RAM block 2. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_RADIO_RAM2_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 7..4 : Configuration field for RAM block 1. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_RADIO_RAM1_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 3..0 : Configuration field for RAM block 0. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_RADIO_RAM0_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Register: AMLI_RAMPRI_ECB */ +/* Description: Configurable priority configuration register for ECB. */ + +/* Bits 31..28 : Configuration field for RAM block 7. */ +#define AMLI_RAMPRI_ECB_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_ECB_RAM7_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 27..24 : Configuration field for RAM block 6. */ +#define AMLI_RAMPRI_ECB_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_ECB_RAM6_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 23..20 : Configuration field for RAM block 5. */ +#define AMLI_RAMPRI_ECB_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_ECB_RAM5_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 19..16 : Configuration field for RAM block 4. */ +#define AMLI_RAMPRI_ECB_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_ECB_RAM4_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 15..12 : Configuration field for RAM block 3. */ +#define AMLI_RAMPRI_ECB_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_ECB_RAM3_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 11..8 : Configuration field for RAM block 2. */ +#define AMLI_RAMPRI_ECB_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_ECB_RAM2_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 7..4 : Configuration field for RAM block 1. */ +#define AMLI_RAMPRI_ECB_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_ECB_RAM1_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 3..0 : Configuration field for RAM block 0. */ +#define AMLI_RAMPRI_ECB_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_ECB_RAM0_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Register: AMLI_RAMPRI_CCM */ +/* Description: Configurable priority configuration register for CCM. */ + +/* Bits 31..28 : Configuration field for RAM block 7. */ +#define AMLI_RAMPRI_CCM_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_CCM_RAM7_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 27..24 : Configuration field for RAM block 6. */ +#define AMLI_RAMPRI_CCM_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_CCM_RAM6_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 23..20 : Configuration field for RAM block 5. */ +#define AMLI_RAMPRI_CCM_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_CCM_RAM5_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 19..16 : Configuration field for RAM block 4. */ +#define AMLI_RAMPRI_CCM_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_CCM_RAM4_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 15..12 : Configuration field for RAM block 3. */ +#define AMLI_RAMPRI_CCM_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_CCM_RAM3_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 11..8 : Configuration field for RAM block 2. */ +#define AMLI_RAMPRI_CCM_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_CCM_RAM2_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 7..4 : Configuration field for RAM block 1. */ +#define AMLI_RAMPRI_CCM_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_CCM_RAM1_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 3..0 : Configuration field for RAM block 0. */ +#define AMLI_RAMPRI_CCM_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_CCM_RAM0_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Register: AMLI_RAMPRI_AAR */ +/* Description: Configurable priority configuration register for AAR. */ + +/* Bits 31..28 : Configuration field for RAM block 7. */ +#define AMLI_RAMPRI_AAR_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_AAR_RAM7_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 27..24 : Configuration field for RAM block 6. */ +#define AMLI_RAMPRI_AAR_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_AAR_RAM6_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 23..20 : Configuration field for RAM block 5. */ +#define AMLI_RAMPRI_AAR_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_AAR_RAM5_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 19..16 : Configuration field for RAM block 4. */ +#define AMLI_RAMPRI_AAR_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_AAR_RAM4_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 15..12 : Configuration field for RAM block 3. */ +#define AMLI_RAMPRI_AAR_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_AAR_RAM3_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 11..8 : Configuration field for RAM block 2. */ +#define AMLI_RAMPRI_AAR_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_AAR_RAM2_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 7..4 : Configuration field for RAM block 1. */ +#define AMLI_RAMPRI_AAR_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_AAR_RAM1_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ + +/* Bits 3..0 : Configuration field for RAM block 0. */ +#define AMLI_RAMPRI_AAR_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_AAR_RAM0_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ + + +/* Peripheral: CCM */ +/* Description: AES CCM Mode Encryption. */ + +/* Register: CCM_SHORTS */ +/* Description: Shortcuts for the CCM. */ + +/* Bit 0 : Shortcut between ENDKSGEN event and CRYPT task. */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Pos (0UL) /*!< Position of ENDKSGEN_CRYPT field. */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Msk (0x1UL << CCM_SHORTS_ENDKSGEN_CRYPT_Pos) /*!< Bit mask of ENDKSGEN_CRYPT field. */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Disabled (0UL) /*!< Shortcut disabled. */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: CCM_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 2 : Enable interrupt on ERROR event. */ +#define CCM_INTENSET_ERROR_Pos (2UL) /*!< Position of ERROR field. */ +#define CCM_INTENSET_ERROR_Msk (0x1UL << CCM_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define CCM_INTENSET_ERROR_Disabled (0UL) /*!< Interrupt disabled. */ +#define CCM_INTENSET_ERROR_Enabled (1UL) /*!< Interrupt enabled. */ +#define CCM_INTENSET_ERROR_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on ENDCRYPT event. */ +#define CCM_INTENSET_ENDCRYPT_Pos (1UL) /*!< Position of ENDCRYPT field. */ +#define CCM_INTENSET_ENDCRYPT_Msk (0x1UL << CCM_INTENSET_ENDCRYPT_Pos) /*!< Bit mask of ENDCRYPT field. */ +#define CCM_INTENSET_ENDCRYPT_Disabled (0UL) /*!< Interrupt disabled. */ +#define CCM_INTENSET_ENDCRYPT_Enabled (1UL) /*!< Interrupt enabled. */ +#define CCM_INTENSET_ENDCRYPT_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on ENDKSGEN event. */ +#define CCM_INTENSET_ENDKSGEN_Pos (0UL) /*!< Position of ENDKSGEN field. */ +#define CCM_INTENSET_ENDKSGEN_Msk (0x1UL << CCM_INTENSET_ENDKSGEN_Pos) /*!< Bit mask of ENDKSGEN field. */ +#define CCM_INTENSET_ENDKSGEN_Disabled (0UL) /*!< Interrupt disabled. */ +#define CCM_INTENSET_ENDKSGEN_Enabled (1UL) /*!< Interrupt enabled. */ +#define CCM_INTENSET_ENDKSGEN_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: CCM_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 2 : Disable interrupt on ERROR event. */ +#define CCM_INTENCLR_ERROR_Pos (2UL) /*!< Position of ERROR field. */ +#define CCM_INTENCLR_ERROR_Msk (0x1UL << CCM_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define CCM_INTENCLR_ERROR_Disabled (0UL) /*!< Interrupt disabled. */ +#define CCM_INTENCLR_ERROR_Enabled (1UL) /*!< Interrupt enabled. */ +#define CCM_INTENCLR_ERROR_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on ENDCRYPT event. */ +#define CCM_INTENCLR_ENDCRYPT_Pos (1UL) /*!< Position of ENDCRYPT field. */ +#define CCM_INTENCLR_ENDCRYPT_Msk (0x1UL << CCM_INTENCLR_ENDCRYPT_Pos) /*!< Bit mask of ENDCRYPT field. */ +#define CCM_INTENCLR_ENDCRYPT_Disabled (0UL) /*!< Interrupt disabled. */ +#define CCM_INTENCLR_ENDCRYPT_Enabled (1UL) /*!< Interrupt enabled. */ +#define CCM_INTENCLR_ENDCRYPT_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on ENDKSGEN event. */ +#define CCM_INTENCLR_ENDKSGEN_Pos (0UL) /*!< Position of ENDKSGEN field. */ +#define CCM_INTENCLR_ENDKSGEN_Msk (0x1UL << CCM_INTENCLR_ENDKSGEN_Pos) /*!< Bit mask of ENDKSGEN field. */ +#define CCM_INTENCLR_ENDKSGEN_Disabled (0UL) /*!< Interrupt disabled. */ +#define CCM_INTENCLR_ENDKSGEN_Enabled (1UL) /*!< Interrupt enabled. */ +#define CCM_INTENCLR_ENDKSGEN_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: CCM_MICSTATUS */ +/* Description: CCM RX MIC check result. */ + +/* Bit 0 : Result of the MIC check performed during the previous CCM RX STARTCRYPT */ +#define CCM_MICSTATUS_MICSTATUS_Pos (0UL) /*!< Position of MICSTATUS field. */ +#define CCM_MICSTATUS_MICSTATUS_Msk (0x1UL << CCM_MICSTATUS_MICSTATUS_Pos) /*!< Bit mask of MICSTATUS field. */ +#define CCM_MICSTATUS_MICSTATUS_CheckFailed (0UL) /*!< MIC check failed. */ +#define CCM_MICSTATUS_MICSTATUS_CheckPassed (1UL) /*!< MIC check passed. */ + +/* Register: CCM_ENABLE */ +/* Description: CCM enable. */ + +/* Bits 1..0 : CCM enable. */ +#define CCM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define CCM_ENABLE_ENABLE_Msk (0x3UL << CCM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define CCM_ENABLE_ENABLE_Disabled (0x00UL) /*!< CCM is disabled. */ +#define CCM_ENABLE_ENABLE_Enabled (0x02UL) /*!< CCM is enabled. */ + +/* Register: CCM_MODE */ +/* Description: Operation mode. */ + +/* Bit 0 : CCM mode operation. */ +#define CCM_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define CCM_MODE_MODE_Msk (0x1UL << CCM_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define CCM_MODE_MODE_Encryption (0UL) /*!< CCM mode TX */ +#define CCM_MODE_MODE_Decryption (1UL) /*!< CCM mode TX */ + +/* Register: CCM_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define CCM_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define CCM_POWER_POWER_Msk (0x1UL << CCM_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define CCM_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define CCM_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: CLOCK */ +/* Description: Clock control. */ + +/* Register: CLOCK_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 4 : Enable interrupt on CTTO event. */ +#define CLOCK_INTENSET_CTTO_Pos (4UL) /*!< Position of CTTO field. */ +#define CLOCK_INTENSET_CTTO_Msk (0x1UL << CLOCK_INTENSET_CTTO_Pos) /*!< Bit mask of CTTO field. */ +#define CLOCK_INTENSET_CTTO_Disabled (0UL) /*!< Interrupt disabled. */ +#define CLOCK_INTENSET_CTTO_Enabled (1UL) /*!< Interrupt enabled. */ +#define CLOCK_INTENSET_CTTO_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 3 : Enable interrupt on DONE event. */ +#define CLOCK_INTENSET_DONE_Pos (3UL) /*!< Position of DONE field. */ +#define CLOCK_INTENSET_DONE_Msk (0x1UL << CLOCK_INTENSET_DONE_Pos) /*!< Bit mask of DONE field. */ +#define CLOCK_INTENSET_DONE_Disabled (0UL) /*!< Interrupt disabled. */ +#define CLOCK_INTENSET_DONE_Enabled (1UL) /*!< Interrupt enabled. */ +#define CLOCK_INTENSET_DONE_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on LFCLKSTARTED event. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Pos (1UL) /*!< Position of LFCLKSTARTED field. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Msk (0x1UL << CLOCK_INTENSET_LFCLKSTARTED_Pos) /*!< Bit mask of LFCLKSTARTED field. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Disabled (0UL) /*!< Interrupt disabled. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Enabled (1UL) /*!< Interrupt enabled. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on HFCLKSTARTED event. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Pos (0UL) /*!< Position of HFCLKSTARTED field. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Msk (0x1UL << CLOCK_INTENSET_HFCLKSTARTED_Pos) /*!< Bit mask of HFCLKSTARTED field. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Disabled (0UL) /*!< Interrupt disabled. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Enabled (1UL) /*!< Interrupt enabled. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: CLOCK_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 4 : Disable interrupt on CTTO event. */ +#define CLOCK_INTENCLR_CTTO_Pos (4UL) /*!< Position of CTTO field. */ +#define CLOCK_INTENCLR_CTTO_Msk (0x1UL << CLOCK_INTENCLR_CTTO_Pos) /*!< Bit mask of CTTO field. */ +#define CLOCK_INTENCLR_CTTO_Disabled (0UL) /*!< Interrupt disabled. */ +#define CLOCK_INTENCLR_CTTO_Enabled (1UL) /*!< Interrupt enabled. */ +#define CLOCK_INTENCLR_CTTO_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 3 : Disable interrupt on DONE event. */ +#define CLOCK_INTENCLR_DONE_Pos (3UL) /*!< Position of DONE field. */ +#define CLOCK_INTENCLR_DONE_Msk (0x1UL << CLOCK_INTENCLR_DONE_Pos) /*!< Bit mask of DONE field. */ +#define CLOCK_INTENCLR_DONE_Disabled (0UL) /*!< Interrupt disabled. */ +#define CLOCK_INTENCLR_DONE_Enabled (1UL) /*!< Interrupt enabled. */ +#define CLOCK_INTENCLR_DONE_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on LFCLKSTARTED event. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Pos (1UL) /*!< Position of LFCLKSTARTED field. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Msk (0x1UL << CLOCK_INTENCLR_LFCLKSTARTED_Pos) /*!< Bit mask of LFCLKSTARTED field. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Disabled (0UL) /*!< Interrupt disabled. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Enabled (1UL) /*!< Interrupt enabled. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on HFCLKSTARTED event. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Pos (0UL) /*!< Position of HFCLKSTARTED field. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Msk (0x1UL << CLOCK_INTENCLR_HFCLKSTARTED_Pos) /*!< Bit mask of HFCLKSTARTED field. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Disabled (0UL) /*!< Interrupt disabled. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Enabled (1UL) /*!< Interrupt enabled. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: CLOCK_HFCLKRUN */ +/* Description: Task HFCLKSTART trigger status. */ + +/* Bit 0 : Task HFCLKSTART trigger status. */ +#define CLOCK_HFCLKRUN_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define CLOCK_HFCLKRUN_STATUS_Msk (0x1UL << CLOCK_HFCLKRUN_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define CLOCK_HFCLKRUN_STATUS_NotTriggered (0UL) /*!< Task HFCLKSTART has not been triggered. */ +#define CLOCK_HFCLKRUN_STATUS_Triggered (1UL) /*!< Task HFCLKSTART has been triggered. */ + +/* Register: CLOCK_HFCLKSTAT */ +/* Description: High frequency clock status. */ + +/* Bit 16 : State for the HFCLK. */ +#define CLOCK_HFCLKSTAT_STATE_Pos (16UL) /*!< Position of STATE field. */ +#define CLOCK_HFCLKSTAT_STATE_Msk (0x1UL << CLOCK_HFCLKSTAT_STATE_Pos) /*!< Bit mask of STATE field. */ +#define CLOCK_HFCLKSTAT_STATE_NotRunning (0UL) /*!< HFCLK clock not running. */ +#define CLOCK_HFCLKSTAT_STATE_Running (1UL) /*!< HFCLK clock running. */ + +/* Bit 0 : Active clock source for the HF clock. */ +#define CLOCK_HFCLKSTAT_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_HFCLKSTAT_SRC_Msk (0x1UL << CLOCK_HFCLKSTAT_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_HFCLKSTAT_SRC_RC (0UL) /*!< Internal 16MHz RC oscillator running and generating the HFCLK clock. */ +#define CLOCK_HFCLKSTAT_SRC_Xtal (1UL) /*!< External 16MHz/32MHz crystal oscillator running and generating the HFCLK clock. */ + +/* Register: CLOCK_LFCLKRUN */ +/* Description: Task LFCLKSTART triggered status. */ + +/* Bit 0 : Task LFCLKSTART triggered status. */ +#define CLOCK_LFCLKRUN_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define CLOCK_LFCLKRUN_STATUS_Msk (0x1UL << CLOCK_LFCLKRUN_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define CLOCK_LFCLKRUN_STATUS_NotTriggered (0UL) /*!< Task LFCLKSTART has not been triggered. */ +#define CLOCK_LFCLKRUN_STATUS_Triggered (1UL) /*!< Task LFCLKSTART has been triggered. */ + +/* Register: CLOCK_LFCLKSTAT */ +/* Description: Low frequency clock status. */ + +/* Bit 16 : State for the LF clock. */ +#define CLOCK_LFCLKSTAT_STATE_Pos (16UL) /*!< Position of STATE field. */ +#define CLOCK_LFCLKSTAT_STATE_Msk (0x1UL << CLOCK_LFCLKSTAT_STATE_Pos) /*!< Bit mask of STATE field. */ +#define CLOCK_LFCLKSTAT_STATE_NotRunning (0UL) /*!< LFCLK clock not running. */ +#define CLOCK_LFCLKSTAT_STATE_Running (1UL) /*!< LFCLK clock running. */ + +/* Bits 1..0 : Active clock source for the LF clock. */ +#define CLOCK_LFCLKSTAT_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSTAT_SRC_Msk (0x3UL << CLOCK_LFCLKSTAT_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSTAT_SRC_RC (0UL) /*!< Internal 32KiHz RC oscillator running and generating the LFCLK clock. */ +#define CLOCK_LFCLKSTAT_SRC_Xtal (1UL) /*!< External 32KiHz crystal oscillator running and generating the LFCLK clock. */ +#define CLOCK_LFCLKSTAT_SRC_Synth (2UL) /*!< Internal 32KiHz synthesizer from the HFCLK running and generating the LFCLK clock. */ + +/* Register: CLOCK_LFCLKSRCCOPY */ +/* Description: Clock source for the LFCLK clock, set when task LKCLKSTART is triggered. */ + +/* Bits 1..0 : Clock source for the LFCLK clock, set when task LKCLKSTART is triggered. */ +#define CLOCK_LFCLKSRCCOPY_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSRCCOPY_SRC_Msk (0x3UL << CLOCK_LFCLKSRCCOPY_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSRCCOPY_SRC_RC (0UL) /*!< Internal 32KiHz RC oscillator. */ +#define CLOCK_LFCLKSRCCOPY_SRC_Xtal (1UL) /*!< External 32KiHz crystal. */ +#define CLOCK_LFCLKSRCCOPY_SRC_Synth (2UL) /*!< Internal 32KiHz synthesizer from HFCLK system clock. */ + +/* Register: CLOCK_LFCLKSRC */ +/* Description: Clock source for the LFCLK clock. */ + +/* Bits 1..0 : Clock source. */ +#define CLOCK_LFCLKSRC_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSRC_SRC_Msk (0x3UL << CLOCK_LFCLKSRC_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSRC_SRC_RC (0UL) /*!< Internal 32KiHz RC oscillator. */ +#define CLOCK_LFCLKSRC_SRC_Xtal (1UL) /*!< External 32KiHz crystal. */ +#define CLOCK_LFCLKSRC_SRC_Synth (2UL) /*!< Internal 32KiHz synthesizer from HFCLK system clock. */ + +/* Register: CLOCK_CTIV */ +/* Description: Calibration timer interval. */ + +/* Bits 6..0 : Calibration timer interval in 0.25s resolution. */ +#define CLOCK_CTIV_CTIV_Pos (0UL) /*!< Position of CTIV field. */ +#define CLOCK_CTIV_CTIV_Msk (0x7FUL << CLOCK_CTIV_CTIV_Pos) /*!< Bit mask of CTIV field. */ + +/* Register: CLOCK_XTALFREQ */ +/* Description: Crystal frequency. */ + +/* Bits 7..0 : External Xtal frequency selection. */ +#define CLOCK_XTALFREQ_XTALFREQ_Pos (0UL) /*!< Position of XTALFREQ field. */ +#define CLOCK_XTALFREQ_XTALFREQ_Msk (0xFFUL << CLOCK_XTALFREQ_XTALFREQ_Pos) /*!< Bit mask of XTALFREQ field. */ +#define CLOCK_XTALFREQ_XTALFREQ_32MHz (0x00UL) /*!< 32MHz xtal is used as source for the HFCLK oscillator. */ +#define CLOCK_XTALFREQ_XTALFREQ_16MHz (0xFFUL) /*!< 16MHz xtal is used as source for the HFCLK oscillator. */ + + +/* Peripheral: ECB */ +/* Description: AES ECB Mode Encryption. */ + +/* Register: ECB_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 1 : Enable interrupt on ERRORECB event. */ +#define ECB_INTENSET_ERRORECB_Pos (1UL) /*!< Position of ERRORECB field. */ +#define ECB_INTENSET_ERRORECB_Msk (0x1UL << ECB_INTENSET_ERRORECB_Pos) /*!< Bit mask of ERRORECB field. */ +#define ECB_INTENSET_ERRORECB_Disabled (0UL) /*!< Interrupt disabled. */ +#define ECB_INTENSET_ERRORECB_Enabled (1UL) /*!< Interrupt enabled. */ +#define ECB_INTENSET_ERRORECB_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on ENDECB event. */ +#define ECB_INTENSET_ENDECB_Pos (0UL) /*!< Position of ENDECB field. */ +#define ECB_INTENSET_ENDECB_Msk (0x1UL << ECB_INTENSET_ENDECB_Pos) /*!< Bit mask of ENDECB field. */ +#define ECB_INTENSET_ENDECB_Disabled (0UL) /*!< Interrupt disabled. */ +#define ECB_INTENSET_ENDECB_Enabled (1UL) /*!< Interrupt enabled. */ +#define ECB_INTENSET_ENDECB_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: ECB_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 1 : Disable interrupt on ERRORECB event. */ +#define ECB_INTENCLR_ERRORECB_Pos (1UL) /*!< Position of ERRORECB field. */ +#define ECB_INTENCLR_ERRORECB_Msk (0x1UL << ECB_INTENCLR_ERRORECB_Pos) /*!< Bit mask of ERRORECB field. */ +#define ECB_INTENCLR_ERRORECB_Disabled (0UL) /*!< Interrupt disabled. */ +#define ECB_INTENCLR_ERRORECB_Enabled (1UL) /*!< Interrupt enabled. */ +#define ECB_INTENCLR_ERRORECB_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on ENDECB event. */ +#define ECB_INTENCLR_ENDECB_Pos (0UL) /*!< Position of ENDECB field. */ +#define ECB_INTENCLR_ENDECB_Msk (0x1UL << ECB_INTENCLR_ENDECB_Pos) /*!< Bit mask of ENDECB field. */ +#define ECB_INTENCLR_ENDECB_Disabled (0UL) /*!< Interrupt disabled. */ +#define ECB_INTENCLR_ENDECB_Enabled (1UL) /*!< Interrupt enabled. */ +#define ECB_INTENCLR_ENDECB_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: ECB_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define ECB_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define ECB_POWER_POWER_Msk (0x1UL << ECB_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define ECB_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define ECB_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: FICR */ +/* Description: Factory Information Configuration. */ + +/* Register: FICR_PPFC */ +/* Description: Pre-programmed factory code present. */ + +/* Bits 7..0 : Pre-programmed factory code present. */ +#define FICR_PPFC_PPFC_Pos (0UL) /*!< Position of PPFC field. */ +#define FICR_PPFC_PPFC_Msk (0xFFUL << FICR_PPFC_PPFC_Pos) /*!< Bit mask of PPFC field. */ +#define FICR_PPFC_PPFC_Present (0x00UL) /*!< Present. */ +#define FICR_PPFC_PPFC_NotPresent (0xFFUL) /*!< Not present. */ + +/* Register: FICR_CONFIGID */ +/* Description: Configuration identifier. */ + +/* Bits 31..16 : Firmware Identification Number pre-loaded into the flash. */ +#define FICR_CONFIGID_FWID_Pos (16UL) /*!< Position of FWID field. */ +#define FICR_CONFIGID_FWID_Msk (0xFFFFUL << FICR_CONFIGID_FWID_Pos) /*!< Bit mask of FWID field. */ + +/* Bits 15..0 : Hardware Identification Number. */ +#define FICR_CONFIGID_HWID_Pos (0UL) /*!< Position of HWID field. */ +#define FICR_CONFIGID_HWID_Msk (0xFFFFUL << FICR_CONFIGID_HWID_Pos) /*!< Bit mask of HWID field. */ + +/* Register: FICR_DEVICEADDRTYPE */ +/* Description: Device address type. */ + +/* Bit 0 : Device address type. */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Pos (0UL) /*!< Position of DEVICEADDRTYPE field. */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Msk (0x1UL << FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Pos) /*!< Bit mask of DEVICEADDRTYPE field. */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Public (0UL) /*!< Public address. */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Random (1UL) /*!< Random address. */ + +/* Register: FICR_OVERRIDEEN */ +/* Description: Radio calibration override enable. */ + +/* Bit 3 : Override default values for BLE_1Mbit mode. */ +#define FICR_OVERRIDEEN_BLE_1MBIT_Pos (3UL) /*!< Position of BLE_1MBIT field. */ +#define FICR_OVERRIDEEN_BLE_1MBIT_Msk (0x1UL << FICR_OVERRIDEEN_BLE_1MBIT_Pos) /*!< Bit mask of BLE_1MBIT field. */ +#define FICR_OVERRIDEEN_BLE_1MBIT_Override (0UL) /*!< Override the default values for BLE_1Mbit mode. */ +#define FICR_OVERRIDEEN_BLE_1MBIT_NotOverride (1UL) /*!< Do not override the default values for BLE_1Mbit mode. */ + +/* Bit 0 : Override default values for NRF_1Mbit mode. */ +#define FICR_OVERRIDEEN_NRF_1MBIT_Pos (0UL) /*!< Position of NRF_1MBIT field. */ +#define FICR_OVERRIDEEN_NRF_1MBIT_Msk (0x1UL << FICR_OVERRIDEEN_NRF_1MBIT_Pos) /*!< Bit mask of NRF_1MBIT field. */ +#define FICR_OVERRIDEEN_NRF_1MBIT_Override (0UL) /*!< Override the default values for NRF_1Mbit mode. */ +#define FICR_OVERRIDEEN_NRF_1MBIT_NotOverride (1UL) /*!< Do not override the default values for NRF_1Mbit mode. */ + + +/* Peripheral: GPIO */ +/* Description: General purpose input and output. */ + +/* Register: GPIO_OUT */ +/* Description: Write GPIO port. */ + +/* Bit 31 : Pin 31. */ +#define GPIO_OUT_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUT_PIN31_Msk (0x1UL << GPIO_OUT_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUT_PIN31_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN31_High (1UL) /*!< Pin driver is high. */ + +/* Bit 30 : Pin 30. */ +#define GPIO_OUT_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUT_PIN30_Msk (0x1UL << GPIO_OUT_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUT_PIN30_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN30_High (1UL) /*!< Pin driver is high. */ + +/* Bit 29 : Pin 29. */ +#define GPIO_OUT_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUT_PIN29_Msk (0x1UL << GPIO_OUT_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUT_PIN29_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN29_High (1UL) /*!< Pin driver is high. */ + +/* Bit 28 : Pin 28. */ +#define GPIO_OUT_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUT_PIN28_Msk (0x1UL << GPIO_OUT_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUT_PIN28_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN28_High (1UL) /*!< Pin driver is high. */ + +/* Bit 27 : Pin 27. */ +#define GPIO_OUT_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUT_PIN27_Msk (0x1UL << GPIO_OUT_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUT_PIN27_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN27_High (1UL) /*!< Pin driver is high. */ + +/* Bit 26 : Pin 26. */ +#define GPIO_OUT_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUT_PIN26_Msk (0x1UL << GPIO_OUT_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUT_PIN26_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN26_High (1UL) /*!< Pin driver is high. */ + +/* Bit 25 : Pin 25. */ +#define GPIO_OUT_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUT_PIN25_Msk (0x1UL << GPIO_OUT_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUT_PIN25_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN25_High (1UL) /*!< Pin driver is high. */ + +/* Bit 24 : Pin 24. */ +#define GPIO_OUT_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUT_PIN24_Msk (0x1UL << GPIO_OUT_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUT_PIN24_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN24_High (1UL) /*!< Pin driver is high. */ + +/* Bit 23 : Pin 23. */ +#define GPIO_OUT_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUT_PIN23_Msk (0x1UL << GPIO_OUT_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUT_PIN23_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN23_High (1UL) /*!< Pin driver is high. */ + +/* Bit 22 : Pin 22. */ +#define GPIO_OUT_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUT_PIN22_Msk (0x1UL << GPIO_OUT_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUT_PIN22_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN22_High (1UL) /*!< Pin driver is high. */ + +/* Bit 21 : Pin 21. */ +#define GPIO_OUT_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUT_PIN21_Msk (0x1UL << GPIO_OUT_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUT_PIN21_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN21_High (1UL) /*!< Pin driver is high. */ + +/* Bit 20 : Pin 20. */ +#define GPIO_OUT_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUT_PIN20_Msk (0x1UL << GPIO_OUT_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUT_PIN20_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN20_High (1UL) /*!< Pin driver is high. */ + +/* Bit 19 : Pin 19. */ +#define GPIO_OUT_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUT_PIN19_Msk (0x1UL << GPIO_OUT_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUT_PIN19_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN19_High (1UL) /*!< Pin driver is high. */ + +/* Bit 18 : Pin 18. */ +#define GPIO_OUT_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUT_PIN18_Msk (0x1UL << GPIO_OUT_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUT_PIN18_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN18_High (1UL) /*!< Pin driver is high. */ + +/* Bit 17 : Pin 17. */ +#define GPIO_OUT_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUT_PIN17_Msk (0x1UL << GPIO_OUT_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUT_PIN17_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN17_High (1UL) /*!< Pin driver is high. */ + +/* Bit 16 : Pin 16. */ +#define GPIO_OUT_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUT_PIN16_Msk (0x1UL << GPIO_OUT_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUT_PIN16_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN16_High (1UL) /*!< Pin driver is high. */ + +/* Bit 15 : Pin 15. */ +#define GPIO_OUT_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUT_PIN15_Msk (0x1UL << GPIO_OUT_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUT_PIN15_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN15_High (1UL) /*!< Pin driver is high. */ + +/* Bit 14 : Pin 14. */ +#define GPIO_OUT_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUT_PIN14_Msk (0x1UL << GPIO_OUT_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUT_PIN14_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN14_High (1UL) /*!< Pin driver is high. */ + +/* Bit 13 : Pin 13. */ +#define GPIO_OUT_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUT_PIN13_Msk (0x1UL << GPIO_OUT_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUT_PIN13_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN13_High (1UL) /*!< Pin driver is high. */ + +/* Bit 12 : Pin 12. */ +#define GPIO_OUT_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUT_PIN12_Msk (0x1UL << GPIO_OUT_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUT_PIN12_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN12_High (1UL) /*!< Pin driver is high. */ + +/* Bit 11 : Pin 11. */ +#define GPIO_OUT_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUT_PIN11_Msk (0x1UL << GPIO_OUT_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUT_PIN11_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN11_High (1UL) /*!< Pin driver is high. */ + +/* Bit 10 : Pin 10. */ +#define GPIO_OUT_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUT_PIN10_Msk (0x1UL << GPIO_OUT_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUT_PIN10_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN10_High (1UL) /*!< Pin driver is high. */ + +/* Bit 9 : Pin 9. */ +#define GPIO_OUT_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUT_PIN9_Msk (0x1UL << GPIO_OUT_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUT_PIN9_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN9_High (1UL) /*!< Pin driver is high. */ + +/* Bit 8 : Pin 8. */ +#define GPIO_OUT_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUT_PIN8_Msk (0x1UL << GPIO_OUT_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUT_PIN8_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN8_High (1UL) /*!< Pin driver is high. */ + +/* Bit 7 : Pin 7. */ +#define GPIO_OUT_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUT_PIN7_Msk (0x1UL << GPIO_OUT_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUT_PIN7_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN7_High (1UL) /*!< Pin driver is high. */ + +/* Bit 6 : Pin 6. */ +#define GPIO_OUT_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUT_PIN6_Msk (0x1UL << GPIO_OUT_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUT_PIN6_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN6_High (1UL) /*!< Pin driver is high. */ + +/* Bit 5 : Pin 5. */ +#define GPIO_OUT_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUT_PIN5_Msk (0x1UL << GPIO_OUT_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUT_PIN5_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN5_High (1UL) /*!< Pin driver is high. */ + +/* Bit 4 : Pin 4. */ +#define GPIO_OUT_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUT_PIN4_Msk (0x1UL << GPIO_OUT_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUT_PIN4_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN4_High (1UL) /*!< Pin driver is high. */ + +/* Bit 3 : Pin 3. */ +#define GPIO_OUT_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUT_PIN3_Msk (0x1UL << GPIO_OUT_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUT_PIN3_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN3_High (1UL) /*!< Pin driver is high. */ + +/* Bit 2 : Pin 2. */ +#define GPIO_OUT_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUT_PIN2_Msk (0x1UL << GPIO_OUT_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUT_PIN2_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN2_High (1UL) /*!< Pin driver is high. */ + +/* Bit 1 : Pin 1. */ +#define GPIO_OUT_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUT_PIN1_Msk (0x1UL << GPIO_OUT_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUT_PIN1_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN1_High (1UL) /*!< Pin driver is high. */ + +/* Bit 0 : Pin 0. */ +#define GPIO_OUT_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUT_PIN0_Msk (0x1UL << GPIO_OUT_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUT_PIN0_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUT_PIN0_High (1UL) /*!< Pin driver is high. */ + +/* Register: GPIO_OUTSET */ +/* Description: Set individual bits in GPIO port. */ + +/* Bit 31 : Pin 31. */ +#define GPIO_OUTSET_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUTSET_PIN31_Msk (0x1UL << GPIO_OUTSET_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUTSET_PIN31_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN31_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN31_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 30 : Pin 30. */ +#define GPIO_OUTSET_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUTSET_PIN30_Msk (0x1UL << GPIO_OUTSET_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUTSET_PIN30_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN30_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN30_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 29 : Pin 29. */ +#define GPIO_OUTSET_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUTSET_PIN29_Msk (0x1UL << GPIO_OUTSET_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUTSET_PIN29_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN29_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN29_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 28 : Pin 28. */ +#define GPIO_OUTSET_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUTSET_PIN28_Msk (0x1UL << GPIO_OUTSET_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUTSET_PIN28_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN28_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN28_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 27 : Pin 27. */ +#define GPIO_OUTSET_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUTSET_PIN27_Msk (0x1UL << GPIO_OUTSET_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUTSET_PIN27_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN27_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN27_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 26 : Pin 26. */ +#define GPIO_OUTSET_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUTSET_PIN26_Msk (0x1UL << GPIO_OUTSET_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUTSET_PIN26_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN26_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN26_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 25 : Pin 25. */ +#define GPIO_OUTSET_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUTSET_PIN25_Msk (0x1UL << GPIO_OUTSET_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUTSET_PIN25_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN25_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN25_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 24 : Pin 24. */ +#define GPIO_OUTSET_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUTSET_PIN24_Msk (0x1UL << GPIO_OUTSET_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUTSET_PIN24_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN24_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN24_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 23 : Pin 23. */ +#define GPIO_OUTSET_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUTSET_PIN23_Msk (0x1UL << GPIO_OUTSET_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUTSET_PIN23_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN23_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN23_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 22 : Pin 22. */ +#define GPIO_OUTSET_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUTSET_PIN22_Msk (0x1UL << GPIO_OUTSET_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUTSET_PIN22_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN22_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN22_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 21 : Pin 21. */ +#define GPIO_OUTSET_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUTSET_PIN21_Msk (0x1UL << GPIO_OUTSET_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUTSET_PIN21_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN21_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN21_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 20 : Pin 20. */ +#define GPIO_OUTSET_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUTSET_PIN20_Msk (0x1UL << GPIO_OUTSET_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUTSET_PIN20_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN20_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN20_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 19 : Pin 19. */ +#define GPIO_OUTSET_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUTSET_PIN19_Msk (0x1UL << GPIO_OUTSET_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUTSET_PIN19_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN19_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN19_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 18 : Pin 18. */ +#define GPIO_OUTSET_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUTSET_PIN18_Msk (0x1UL << GPIO_OUTSET_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUTSET_PIN18_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN18_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN18_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 17 : Pin 17. */ +#define GPIO_OUTSET_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUTSET_PIN17_Msk (0x1UL << GPIO_OUTSET_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUTSET_PIN17_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN17_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN17_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 16 : Pin 16. */ +#define GPIO_OUTSET_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUTSET_PIN16_Msk (0x1UL << GPIO_OUTSET_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUTSET_PIN16_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN16_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN16_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 15 : Pin 15. */ +#define GPIO_OUTSET_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUTSET_PIN15_Msk (0x1UL << GPIO_OUTSET_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUTSET_PIN15_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN15_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN15_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 14 : Pin 14. */ +#define GPIO_OUTSET_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUTSET_PIN14_Msk (0x1UL << GPIO_OUTSET_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUTSET_PIN14_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN14_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN14_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 13 : Pin 13. */ +#define GPIO_OUTSET_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUTSET_PIN13_Msk (0x1UL << GPIO_OUTSET_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUTSET_PIN13_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN13_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN13_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 12 : Pin 12. */ +#define GPIO_OUTSET_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUTSET_PIN12_Msk (0x1UL << GPIO_OUTSET_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUTSET_PIN12_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN12_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN12_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 11 : Pin 11. */ +#define GPIO_OUTSET_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUTSET_PIN11_Msk (0x1UL << GPIO_OUTSET_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUTSET_PIN11_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN11_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN11_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 10 : Pin 10. */ +#define GPIO_OUTSET_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUTSET_PIN10_Msk (0x1UL << GPIO_OUTSET_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUTSET_PIN10_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN10_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN10_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 9 : Pin 9. */ +#define GPIO_OUTSET_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUTSET_PIN9_Msk (0x1UL << GPIO_OUTSET_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUTSET_PIN9_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN9_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN9_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 8 : Pin 8. */ +#define GPIO_OUTSET_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUTSET_PIN8_Msk (0x1UL << GPIO_OUTSET_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUTSET_PIN8_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN8_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN8_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 7 : Pin 7. */ +#define GPIO_OUTSET_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUTSET_PIN7_Msk (0x1UL << GPIO_OUTSET_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUTSET_PIN7_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN7_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN7_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 6 : Pin 6. */ +#define GPIO_OUTSET_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUTSET_PIN6_Msk (0x1UL << GPIO_OUTSET_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUTSET_PIN6_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN6_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN6_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 5 : Pin 5. */ +#define GPIO_OUTSET_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUTSET_PIN5_Msk (0x1UL << GPIO_OUTSET_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUTSET_PIN5_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN5_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN5_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 4 : Pin 4. */ +#define GPIO_OUTSET_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUTSET_PIN4_Msk (0x1UL << GPIO_OUTSET_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUTSET_PIN4_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN4_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN4_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 3 : Pin 3. */ +#define GPIO_OUTSET_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUTSET_PIN3_Msk (0x1UL << GPIO_OUTSET_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUTSET_PIN3_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN3_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN3_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 2 : Pin 2. */ +#define GPIO_OUTSET_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUTSET_PIN2_Msk (0x1UL << GPIO_OUTSET_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUTSET_PIN2_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN2_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN2_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 1 : Pin 1. */ +#define GPIO_OUTSET_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUTSET_PIN1_Msk (0x1UL << GPIO_OUTSET_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUTSET_PIN1_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN1_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN1_Set (1UL) /*!< Set pin driver high. */ + +/* Bit 0 : Pin 0. */ +#define GPIO_OUTSET_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUTSET_PIN0_Msk (0x1UL << GPIO_OUTSET_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUTSET_PIN0_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTSET_PIN0_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTSET_PIN0_Set (1UL) /*!< Set pin driver high. */ + +/* Register: GPIO_OUTCLR */ +/* Description: Clear individual bits in GPIO port. */ + +/* Bit 31 : Pin 31. */ +#define GPIO_OUTCLR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUTCLR_PIN31_Msk (0x1UL << GPIO_OUTCLR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUTCLR_PIN31_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN31_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN31_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 30 : Pin 30. */ +#define GPIO_OUTCLR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUTCLR_PIN30_Msk (0x1UL << GPIO_OUTCLR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUTCLR_PIN30_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN30_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN30_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 29 : Pin 29. */ +#define GPIO_OUTCLR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUTCLR_PIN29_Msk (0x1UL << GPIO_OUTCLR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUTCLR_PIN29_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN29_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN29_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 28 : Pin 28. */ +#define GPIO_OUTCLR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUTCLR_PIN28_Msk (0x1UL << GPIO_OUTCLR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUTCLR_PIN28_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN28_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN28_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 27 : Pin 27. */ +#define GPIO_OUTCLR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUTCLR_PIN27_Msk (0x1UL << GPIO_OUTCLR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUTCLR_PIN27_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN27_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN27_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 26 : Pin 26. */ +#define GPIO_OUTCLR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUTCLR_PIN26_Msk (0x1UL << GPIO_OUTCLR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUTCLR_PIN26_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN26_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN26_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 25 : Pin 25. */ +#define GPIO_OUTCLR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUTCLR_PIN25_Msk (0x1UL << GPIO_OUTCLR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUTCLR_PIN25_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN25_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN25_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 24 : Pin 24. */ +#define GPIO_OUTCLR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUTCLR_PIN24_Msk (0x1UL << GPIO_OUTCLR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUTCLR_PIN24_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN24_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN24_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 23 : Pin 23. */ +#define GPIO_OUTCLR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUTCLR_PIN23_Msk (0x1UL << GPIO_OUTCLR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUTCLR_PIN23_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN23_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN23_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 22 : Pin 22. */ +#define GPIO_OUTCLR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUTCLR_PIN22_Msk (0x1UL << GPIO_OUTCLR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUTCLR_PIN22_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN22_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN22_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 21 : Pin 21. */ +#define GPIO_OUTCLR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUTCLR_PIN21_Msk (0x1UL << GPIO_OUTCLR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUTCLR_PIN21_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN21_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN21_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 20 : Pin 20. */ +#define GPIO_OUTCLR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUTCLR_PIN20_Msk (0x1UL << GPIO_OUTCLR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUTCLR_PIN20_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN20_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN20_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 19 : Pin 19. */ +#define GPIO_OUTCLR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUTCLR_PIN19_Msk (0x1UL << GPIO_OUTCLR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUTCLR_PIN19_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN19_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN19_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 18 : Pin 18. */ +#define GPIO_OUTCLR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUTCLR_PIN18_Msk (0x1UL << GPIO_OUTCLR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUTCLR_PIN18_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN18_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN18_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 17 : Pin 17. */ +#define GPIO_OUTCLR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUTCLR_PIN17_Msk (0x1UL << GPIO_OUTCLR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUTCLR_PIN17_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN17_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN17_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 16 : Pin 16. */ +#define GPIO_OUTCLR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUTCLR_PIN16_Msk (0x1UL << GPIO_OUTCLR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUTCLR_PIN16_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN16_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN16_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 15 : Pin 15. */ +#define GPIO_OUTCLR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUTCLR_PIN15_Msk (0x1UL << GPIO_OUTCLR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUTCLR_PIN15_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN15_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN15_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 14 : Pin 14. */ +#define GPIO_OUTCLR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUTCLR_PIN14_Msk (0x1UL << GPIO_OUTCLR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUTCLR_PIN14_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN14_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN14_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 13 : Pin 13. */ +#define GPIO_OUTCLR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUTCLR_PIN13_Msk (0x1UL << GPIO_OUTCLR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUTCLR_PIN13_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN13_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN13_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 12 : Pin 12. */ +#define GPIO_OUTCLR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUTCLR_PIN12_Msk (0x1UL << GPIO_OUTCLR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUTCLR_PIN12_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN12_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN12_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 11 : Pin 11. */ +#define GPIO_OUTCLR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUTCLR_PIN11_Msk (0x1UL << GPIO_OUTCLR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUTCLR_PIN11_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN11_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN11_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 10 : Pin 10. */ +#define GPIO_OUTCLR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUTCLR_PIN10_Msk (0x1UL << GPIO_OUTCLR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUTCLR_PIN10_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN10_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN10_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 9 : Pin 9. */ +#define GPIO_OUTCLR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUTCLR_PIN9_Msk (0x1UL << GPIO_OUTCLR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUTCLR_PIN9_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN9_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN9_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 8 : Pin 8. */ +#define GPIO_OUTCLR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUTCLR_PIN8_Msk (0x1UL << GPIO_OUTCLR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUTCLR_PIN8_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN8_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN8_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 7 : Pin 7. */ +#define GPIO_OUTCLR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUTCLR_PIN7_Msk (0x1UL << GPIO_OUTCLR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUTCLR_PIN7_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN7_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN7_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 6 : Pin 6. */ +#define GPIO_OUTCLR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUTCLR_PIN6_Msk (0x1UL << GPIO_OUTCLR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUTCLR_PIN6_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN6_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN6_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 5 : Pin 5. */ +#define GPIO_OUTCLR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUTCLR_PIN5_Msk (0x1UL << GPIO_OUTCLR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUTCLR_PIN5_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN5_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN5_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 4 : Pin 4. */ +#define GPIO_OUTCLR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUTCLR_PIN4_Msk (0x1UL << GPIO_OUTCLR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUTCLR_PIN4_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN4_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN4_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 3 : Pin 3. */ +#define GPIO_OUTCLR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUTCLR_PIN3_Msk (0x1UL << GPIO_OUTCLR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUTCLR_PIN3_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN3_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN3_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 2 : Pin 2. */ +#define GPIO_OUTCLR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUTCLR_PIN2_Msk (0x1UL << GPIO_OUTCLR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUTCLR_PIN2_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN2_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN2_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 1 : Pin 1. */ +#define GPIO_OUTCLR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUTCLR_PIN1_Msk (0x1UL << GPIO_OUTCLR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUTCLR_PIN1_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN1_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN1_Clear (1UL) /*!< Set pin driver low. */ + +/* Bit 0 : Pin 0. */ +#define GPIO_OUTCLR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUTCLR_PIN0_Msk (0x1UL << GPIO_OUTCLR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUTCLR_PIN0_Low (0UL) /*!< Pin driver is low. */ +#define GPIO_OUTCLR_PIN0_High (1UL) /*!< Pin driver is high. */ +#define GPIO_OUTCLR_PIN0_Clear (1UL) /*!< Set pin driver low. */ + +/* Register: GPIO_IN */ +/* Description: Read GPIO port. */ + +/* Bit 31 : Pin 31. */ +#define GPIO_IN_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_IN_PIN31_Msk (0x1UL << GPIO_IN_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_IN_PIN31_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN31_High (1UL) /*!< Pin input is high. */ + +/* Bit 30 : Pin 30. */ +#define GPIO_IN_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_IN_PIN30_Msk (0x1UL << GPIO_IN_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_IN_PIN30_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN30_High (1UL) /*!< Pin input is high. */ + +/* Bit 29 : Pin 29. */ +#define GPIO_IN_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_IN_PIN29_Msk (0x1UL << GPIO_IN_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_IN_PIN29_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN29_High (1UL) /*!< Pin input is high. */ + +/* Bit 28 : Pin 28. */ +#define GPIO_IN_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_IN_PIN28_Msk (0x1UL << GPIO_IN_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_IN_PIN28_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN28_High (1UL) /*!< Pin input is high. */ + +/* Bit 27 : Pin 27. */ +#define GPIO_IN_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_IN_PIN27_Msk (0x1UL << GPIO_IN_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_IN_PIN27_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN27_High (1UL) /*!< Pin input is high. */ + +/* Bit 26 : Pin 26. */ +#define GPIO_IN_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_IN_PIN26_Msk (0x1UL << GPIO_IN_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_IN_PIN26_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN26_High (1UL) /*!< Pin input is high. */ + +/* Bit 25 : Pin 25. */ +#define GPIO_IN_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_IN_PIN25_Msk (0x1UL << GPIO_IN_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_IN_PIN25_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN25_High (1UL) /*!< Pin input is high. */ + +/* Bit 24 : Pin 24. */ +#define GPIO_IN_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_IN_PIN24_Msk (0x1UL << GPIO_IN_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_IN_PIN24_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN24_High (1UL) /*!< Pin input is high. */ + +/* Bit 23 : Pin 23. */ +#define GPIO_IN_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_IN_PIN23_Msk (0x1UL << GPIO_IN_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_IN_PIN23_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN23_High (1UL) /*!< Pin input is high. */ + +/* Bit 22 : Pin 22. */ +#define GPIO_IN_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_IN_PIN22_Msk (0x1UL << GPIO_IN_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_IN_PIN22_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN22_High (1UL) /*!< Pin input is high. */ + +/* Bit 21 : Pin 21. */ +#define GPIO_IN_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_IN_PIN21_Msk (0x1UL << GPIO_IN_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_IN_PIN21_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN21_High (1UL) /*!< Pin input is high. */ + +/* Bit 20 : Pin 20. */ +#define GPIO_IN_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_IN_PIN20_Msk (0x1UL << GPIO_IN_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_IN_PIN20_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN20_High (1UL) /*!< Pin input is high. */ + +/* Bit 19 : Pin 19. */ +#define GPIO_IN_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_IN_PIN19_Msk (0x1UL << GPIO_IN_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_IN_PIN19_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN19_High (1UL) /*!< Pin input is high. */ + +/* Bit 18 : Pin 18. */ +#define GPIO_IN_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_IN_PIN18_Msk (0x1UL << GPIO_IN_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_IN_PIN18_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN18_High (1UL) /*!< Pin input is high. */ + +/* Bit 17 : Pin 17. */ +#define GPIO_IN_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_IN_PIN17_Msk (0x1UL << GPIO_IN_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_IN_PIN17_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN17_High (1UL) /*!< Pin input is high. */ + +/* Bit 16 : Pin 16. */ +#define GPIO_IN_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_IN_PIN16_Msk (0x1UL << GPIO_IN_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_IN_PIN16_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN16_High (1UL) /*!< Pin input is high. */ + +/* Bit 15 : Pin 15. */ +#define GPIO_IN_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_IN_PIN15_Msk (0x1UL << GPIO_IN_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_IN_PIN15_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN15_High (1UL) /*!< Pin input is high. */ + +/* Bit 14 : Pin 14. */ +#define GPIO_IN_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_IN_PIN14_Msk (0x1UL << GPIO_IN_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_IN_PIN14_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN14_High (1UL) /*!< Pin input is high. */ + +/* Bit 13 : Pin 13. */ +#define GPIO_IN_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_IN_PIN13_Msk (0x1UL << GPIO_IN_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_IN_PIN13_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN13_High (1UL) /*!< Pin input is high. */ + +/* Bit 12 : Pin 12. */ +#define GPIO_IN_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_IN_PIN12_Msk (0x1UL << GPIO_IN_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_IN_PIN12_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN12_High (1UL) /*!< Pin input is high. */ + +/* Bit 11 : Pin 11. */ +#define GPIO_IN_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_IN_PIN11_Msk (0x1UL << GPIO_IN_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_IN_PIN11_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN11_High (1UL) /*!< Pin input is high. */ + +/* Bit 10 : Pin 10. */ +#define GPIO_IN_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_IN_PIN10_Msk (0x1UL << GPIO_IN_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_IN_PIN10_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN10_High (1UL) /*!< Pin input is high. */ + +/* Bit 9 : Pin 9. */ +#define GPIO_IN_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_IN_PIN9_Msk (0x1UL << GPIO_IN_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_IN_PIN9_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN9_High (1UL) /*!< Pin input is high. */ + +/* Bit 8 : Pin 8. */ +#define GPIO_IN_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_IN_PIN8_Msk (0x1UL << GPIO_IN_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_IN_PIN8_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN8_High (1UL) /*!< Pin input is high. */ + +/* Bit 7 : Pin 7. */ +#define GPIO_IN_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_IN_PIN7_Msk (0x1UL << GPIO_IN_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_IN_PIN7_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN7_High (1UL) /*!< Pin input is high. */ + +/* Bit 6 : Pin 6. */ +#define GPIO_IN_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_IN_PIN6_Msk (0x1UL << GPIO_IN_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_IN_PIN6_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN6_High (1UL) /*!< Pin input is high. */ + +/* Bit 5 : Pin 5. */ +#define GPIO_IN_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_IN_PIN5_Msk (0x1UL << GPIO_IN_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_IN_PIN5_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN5_High (1UL) /*!< Pin input is high. */ + +/* Bit 4 : Pin 4. */ +#define GPIO_IN_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_IN_PIN4_Msk (0x1UL << GPIO_IN_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_IN_PIN4_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN4_High (1UL) /*!< Pin input is high. */ + +/* Bit 3 : Pin 3. */ +#define GPIO_IN_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_IN_PIN3_Msk (0x1UL << GPIO_IN_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_IN_PIN3_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN3_High (1UL) /*!< Pin input is high. */ + +/* Bit 2 : Pin 2. */ +#define GPIO_IN_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_IN_PIN2_Msk (0x1UL << GPIO_IN_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_IN_PIN2_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN2_High (1UL) /*!< Pin input is high. */ + +/* Bit 1 : Pin 1. */ +#define GPIO_IN_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_IN_PIN1_Msk (0x1UL << GPIO_IN_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_IN_PIN1_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN1_High (1UL) /*!< Pin input is high. */ + +/* Bit 0 : Pin 0. */ +#define GPIO_IN_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_IN_PIN0_Msk (0x1UL << GPIO_IN_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_IN_PIN0_Low (0UL) /*!< Pin input is low. */ +#define GPIO_IN_PIN0_High (1UL) /*!< Pin input is high. */ + +/* Register: GPIO_DIR */ +/* Description: Direction of GPIO pins. */ + +/* Bit 31 : Pin 31. */ +#define GPIO_DIR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIR_PIN31_Msk (0x1UL << GPIO_DIR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIR_PIN31_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN31_Output (1UL) /*!< Pin set as output. */ + +/* Bit 30 : Pin 30. */ +#define GPIO_DIR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIR_PIN30_Msk (0x1UL << GPIO_DIR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIR_PIN30_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN30_Output (1UL) /*!< Pin set as output. */ + +/* Bit 29 : Pin 29. */ +#define GPIO_DIR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIR_PIN29_Msk (0x1UL << GPIO_DIR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIR_PIN29_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN29_Output (1UL) /*!< Pin set as output. */ + +/* Bit 28 : Pin 28. */ +#define GPIO_DIR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIR_PIN28_Msk (0x1UL << GPIO_DIR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIR_PIN28_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN28_Output (1UL) /*!< Pin set as output. */ + +/* Bit 27 : Pin 27. */ +#define GPIO_DIR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIR_PIN27_Msk (0x1UL << GPIO_DIR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIR_PIN27_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN27_Output (1UL) /*!< Pin set as output. */ + +/* Bit 26 : Pin 26. */ +#define GPIO_DIR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIR_PIN26_Msk (0x1UL << GPIO_DIR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIR_PIN26_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN26_Output (1UL) /*!< Pin set as output. */ + +/* Bit 25 : Pin 25. */ +#define GPIO_DIR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIR_PIN25_Msk (0x1UL << GPIO_DIR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIR_PIN25_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN25_Output (1UL) /*!< Pin set as output. */ + +/* Bit 24 : Pin 24. */ +#define GPIO_DIR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIR_PIN24_Msk (0x1UL << GPIO_DIR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIR_PIN24_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN24_Output (1UL) /*!< Pin set as output. */ + +/* Bit 23 : Pin 23. */ +#define GPIO_DIR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIR_PIN23_Msk (0x1UL << GPIO_DIR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIR_PIN23_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN23_Output (1UL) /*!< Pin set as output. */ + +/* Bit 22 : Pin 22. */ +#define GPIO_DIR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIR_PIN22_Msk (0x1UL << GPIO_DIR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIR_PIN22_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN22_Output (1UL) /*!< Pin set as output. */ + +/* Bit 21 : Pin 21. */ +#define GPIO_DIR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIR_PIN21_Msk (0x1UL << GPIO_DIR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIR_PIN21_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN21_Output (1UL) /*!< Pin set as output. */ + +/* Bit 20 : Pin 20. */ +#define GPIO_DIR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIR_PIN20_Msk (0x1UL << GPIO_DIR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIR_PIN20_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN20_Output (1UL) /*!< Pin set as output. */ + +/* Bit 19 : Pin 19. */ +#define GPIO_DIR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIR_PIN19_Msk (0x1UL << GPIO_DIR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIR_PIN19_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN19_Output (1UL) /*!< Pin set as output. */ + +/* Bit 18 : Pin 18. */ +#define GPIO_DIR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIR_PIN18_Msk (0x1UL << GPIO_DIR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIR_PIN18_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN18_Output (1UL) /*!< Pin set as output. */ + +/* Bit 17 : Pin 17. */ +#define GPIO_DIR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIR_PIN17_Msk (0x1UL << GPIO_DIR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIR_PIN17_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN17_Output (1UL) /*!< Pin set as output. */ + +/* Bit 16 : Pin 16. */ +#define GPIO_DIR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIR_PIN16_Msk (0x1UL << GPIO_DIR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIR_PIN16_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN16_Output (1UL) /*!< Pin set as output. */ + +/* Bit 15 : Pin 15. */ +#define GPIO_DIR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIR_PIN15_Msk (0x1UL << GPIO_DIR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIR_PIN15_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN15_Output (1UL) /*!< Pin set as output. */ + +/* Bit 14 : Pin 14. */ +#define GPIO_DIR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIR_PIN14_Msk (0x1UL << GPIO_DIR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIR_PIN14_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN14_Output (1UL) /*!< Pin set as output. */ + +/* Bit 13 : Pin 13. */ +#define GPIO_DIR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIR_PIN13_Msk (0x1UL << GPIO_DIR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIR_PIN13_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN13_Output (1UL) /*!< Pin set as output. */ + +/* Bit 12 : Pin 12. */ +#define GPIO_DIR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIR_PIN12_Msk (0x1UL << GPIO_DIR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIR_PIN12_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN12_Output (1UL) /*!< Pin set as output. */ + +/* Bit 11 : Pin 11. */ +#define GPIO_DIR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIR_PIN11_Msk (0x1UL << GPIO_DIR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIR_PIN11_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN11_Output (1UL) /*!< Pin set as output. */ + +/* Bit 10 : Pin 10. */ +#define GPIO_DIR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIR_PIN10_Msk (0x1UL << GPIO_DIR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIR_PIN10_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN10_Output (1UL) /*!< Pin set as output. */ + +/* Bit 9 : Pin 9. */ +#define GPIO_DIR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIR_PIN9_Msk (0x1UL << GPIO_DIR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIR_PIN9_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN9_Output (1UL) /*!< Pin set as output. */ + +/* Bit 8 : Pin 8. */ +#define GPIO_DIR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIR_PIN8_Msk (0x1UL << GPIO_DIR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIR_PIN8_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN8_Output (1UL) /*!< Pin set as output. */ + +/* Bit 7 : Pin 7. */ +#define GPIO_DIR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIR_PIN7_Msk (0x1UL << GPIO_DIR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIR_PIN7_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN7_Output (1UL) /*!< Pin set as output. */ + +/* Bit 6 : Pin 6. */ +#define GPIO_DIR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIR_PIN6_Msk (0x1UL << GPIO_DIR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIR_PIN6_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN6_Output (1UL) /*!< Pin set as output. */ + +/* Bit 5 : Pin 5. */ +#define GPIO_DIR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIR_PIN5_Msk (0x1UL << GPIO_DIR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIR_PIN5_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN5_Output (1UL) /*!< Pin set as output. */ + +/* Bit 4 : Pin 4. */ +#define GPIO_DIR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIR_PIN4_Msk (0x1UL << GPIO_DIR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIR_PIN4_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN4_Output (1UL) /*!< Pin set as output. */ + +/* Bit 3 : Pin 3. */ +#define GPIO_DIR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIR_PIN3_Msk (0x1UL << GPIO_DIR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIR_PIN3_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN3_Output (1UL) /*!< Pin set as output. */ + +/* Bit 2 : Pin 2. */ +#define GPIO_DIR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIR_PIN2_Msk (0x1UL << GPIO_DIR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIR_PIN2_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN2_Output (1UL) /*!< Pin set as output. */ + +/* Bit 1 : Pin 1. */ +#define GPIO_DIR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIR_PIN1_Msk (0x1UL << GPIO_DIR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIR_PIN1_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN1_Output (1UL) /*!< Pin set as output. */ + +/* Bit 0 : Pin 0. */ +#define GPIO_DIR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIR_PIN0_Msk (0x1UL << GPIO_DIR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIR_PIN0_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIR_PIN0_Output (1UL) /*!< Pin set as output. */ + +/* Register: GPIO_DIRSET */ +/* Description: DIR set register. */ + +/* Bit 31 : Set as output pin 31. */ +#define GPIO_DIRSET_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIRSET_PIN31_Msk (0x1UL << GPIO_DIRSET_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIRSET_PIN31_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN31_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN31_Set (1UL) /*!< Set pin as output. */ + +/* Bit 30 : Set as output pin 30. */ +#define GPIO_DIRSET_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIRSET_PIN30_Msk (0x1UL << GPIO_DIRSET_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIRSET_PIN30_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN30_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN30_Set (1UL) /*!< Set pin as output. */ + +/* Bit 29 : Set as output pin 29. */ +#define GPIO_DIRSET_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIRSET_PIN29_Msk (0x1UL << GPIO_DIRSET_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIRSET_PIN29_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN29_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN29_Set (1UL) /*!< Set pin as output. */ + +/* Bit 28 : Set as output pin 28. */ +#define GPIO_DIRSET_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIRSET_PIN28_Msk (0x1UL << GPIO_DIRSET_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIRSET_PIN28_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN28_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN28_Set (1UL) /*!< Set pin as output. */ + +/* Bit 27 : Set as output pin 27. */ +#define GPIO_DIRSET_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIRSET_PIN27_Msk (0x1UL << GPIO_DIRSET_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIRSET_PIN27_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN27_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN27_Set (1UL) /*!< Set pin as output. */ + +/* Bit 26 : Set as output pin 26. */ +#define GPIO_DIRSET_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIRSET_PIN26_Msk (0x1UL << GPIO_DIRSET_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIRSET_PIN26_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN26_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN26_Set (1UL) /*!< Set pin as output. */ + +/* Bit 25 : Set as output pin 25. */ +#define GPIO_DIRSET_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIRSET_PIN25_Msk (0x1UL << GPIO_DIRSET_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIRSET_PIN25_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN25_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN25_Set (1UL) /*!< Set pin as output. */ + +/* Bit 24 : Set as output pin 24. */ +#define GPIO_DIRSET_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIRSET_PIN24_Msk (0x1UL << GPIO_DIRSET_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIRSET_PIN24_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN24_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN24_Set (1UL) /*!< Set pin as output. */ + +/* Bit 23 : Set as output pin 23. */ +#define GPIO_DIRSET_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIRSET_PIN23_Msk (0x1UL << GPIO_DIRSET_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIRSET_PIN23_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN23_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN23_Set (1UL) /*!< Set pin as output. */ + +/* Bit 22 : Set as output pin 22. */ +#define GPIO_DIRSET_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIRSET_PIN22_Msk (0x1UL << GPIO_DIRSET_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIRSET_PIN22_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN22_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN22_Set (1UL) /*!< Set pin as output. */ + +/* Bit 21 : Set as output pin 21. */ +#define GPIO_DIRSET_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIRSET_PIN21_Msk (0x1UL << GPIO_DIRSET_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIRSET_PIN21_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN21_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN21_Set (1UL) /*!< Set pin as output. */ + +/* Bit 20 : Set as output pin 20. */ +#define GPIO_DIRSET_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIRSET_PIN20_Msk (0x1UL << GPIO_DIRSET_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIRSET_PIN20_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN20_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN20_Set (1UL) /*!< Set pin as output. */ + +/* Bit 19 : Set as output pin 19. */ +#define GPIO_DIRSET_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIRSET_PIN19_Msk (0x1UL << GPIO_DIRSET_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIRSET_PIN19_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN19_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN19_Set (1UL) /*!< Set pin as output. */ + +/* Bit 18 : Set as output pin 18. */ +#define GPIO_DIRSET_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIRSET_PIN18_Msk (0x1UL << GPIO_DIRSET_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIRSET_PIN18_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN18_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN18_Set (1UL) /*!< Set pin as output. */ + +/* Bit 17 : Set as output pin 17. */ +#define GPIO_DIRSET_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIRSET_PIN17_Msk (0x1UL << GPIO_DIRSET_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIRSET_PIN17_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN17_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN17_Set (1UL) /*!< Set pin as output. */ + +/* Bit 16 : Set as output pin 16. */ +#define GPIO_DIRSET_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIRSET_PIN16_Msk (0x1UL << GPIO_DIRSET_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIRSET_PIN16_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN16_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN16_Set (1UL) /*!< Set pin as output. */ + +/* Bit 15 : Set as output pin 15. */ +#define GPIO_DIRSET_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIRSET_PIN15_Msk (0x1UL << GPIO_DIRSET_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIRSET_PIN15_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN15_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN15_Set (1UL) /*!< Set pin as output. */ + +/* Bit 14 : Set as output pin 14. */ +#define GPIO_DIRSET_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIRSET_PIN14_Msk (0x1UL << GPIO_DIRSET_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIRSET_PIN14_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN14_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN14_Set (1UL) /*!< Set pin as output. */ + +/* Bit 13 : Set as output pin 13. */ +#define GPIO_DIRSET_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIRSET_PIN13_Msk (0x1UL << GPIO_DIRSET_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIRSET_PIN13_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN13_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN13_Set (1UL) /*!< Set pin as output. */ + +/* Bit 12 : Set as output pin 12. */ +#define GPIO_DIRSET_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIRSET_PIN12_Msk (0x1UL << GPIO_DIRSET_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIRSET_PIN12_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN12_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN12_Set (1UL) /*!< Set pin as output. */ + +/* Bit 11 : Set as output pin 11. */ +#define GPIO_DIRSET_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIRSET_PIN11_Msk (0x1UL << GPIO_DIRSET_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIRSET_PIN11_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN11_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN11_Set (1UL) /*!< Set pin as output. */ + +/* Bit 10 : Set as output pin 10. */ +#define GPIO_DIRSET_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIRSET_PIN10_Msk (0x1UL << GPIO_DIRSET_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIRSET_PIN10_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN10_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN10_Set (1UL) /*!< Set pin as output. */ + +/* Bit 9 : Set as output pin 9. */ +#define GPIO_DIRSET_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIRSET_PIN9_Msk (0x1UL << GPIO_DIRSET_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIRSET_PIN9_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN9_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN9_Set (1UL) /*!< Set pin as output. */ + +/* Bit 8 : Set as output pin 8. */ +#define GPIO_DIRSET_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIRSET_PIN8_Msk (0x1UL << GPIO_DIRSET_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIRSET_PIN8_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN8_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN8_Set (1UL) /*!< Set pin as output. */ + +/* Bit 7 : Set as output pin 7. */ +#define GPIO_DIRSET_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIRSET_PIN7_Msk (0x1UL << GPIO_DIRSET_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIRSET_PIN7_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN7_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN7_Set (1UL) /*!< Set pin as output. */ + +/* Bit 6 : Set as output pin 6. */ +#define GPIO_DIRSET_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIRSET_PIN6_Msk (0x1UL << GPIO_DIRSET_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIRSET_PIN6_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN6_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN6_Set (1UL) /*!< Set pin as output. */ + +/* Bit 5 : Set as output pin 5. */ +#define GPIO_DIRSET_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIRSET_PIN5_Msk (0x1UL << GPIO_DIRSET_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIRSET_PIN5_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN5_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN5_Set (1UL) /*!< Set pin as output. */ + +/* Bit 4 : Set as output pin 4. */ +#define GPIO_DIRSET_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIRSET_PIN4_Msk (0x1UL << GPIO_DIRSET_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIRSET_PIN4_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN4_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN4_Set (1UL) /*!< Set pin as output. */ + +/* Bit 3 : Set as output pin 3. */ +#define GPIO_DIRSET_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIRSET_PIN3_Msk (0x1UL << GPIO_DIRSET_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIRSET_PIN3_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN3_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN3_Set (1UL) /*!< Set pin as output. */ + +/* Bit 2 : Set as output pin 2. */ +#define GPIO_DIRSET_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIRSET_PIN2_Msk (0x1UL << GPIO_DIRSET_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIRSET_PIN2_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN2_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN2_Set (1UL) /*!< Set pin as output. */ + +/* Bit 1 : Set as output pin 1. */ +#define GPIO_DIRSET_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIRSET_PIN1_Msk (0x1UL << GPIO_DIRSET_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIRSET_PIN1_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN1_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN1_Set (1UL) /*!< Set pin as output. */ + +/* Bit 0 : Set as output pin 0. */ +#define GPIO_DIRSET_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIRSET_PIN0_Msk (0x1UL << GPIO_DIRSET_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIRSET_PIN0_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRSET_PIN0_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRSET_PIN0_Set (1UL) /*!< Set pin as output. */ + +/* Register: GPIO_DIRCLR */ +/* Description: DIR clear register. */ + +/* Bit 31 : Set as input pin 31. */ +#define GPIO_DIRCLR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIRCLR_PIN31_Msk (0x1UL << GPIO_DIRCLR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIRCLR_PIN31_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN31_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN31_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 30 : Set as input pin 30. */ +#define GPIO_DIRCLR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIRCLR_PIN30_Msk (0x1UL << GPIO_DIRCLR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIRCLR_PIN30_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN30_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN30_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 29 : Set as input pin 29. */ +#define GPIO_DIRCLR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIRCLR_PIN29_Msk (0x1UL << GPIO_DIRCLR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIRCLR_PIN29_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN29_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN29_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 28 : Set as input pin 28. */ +#define GPIO_DIRCLR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIRCLR_PIN28_Msk (0x1UL << GPIO_DIRCLR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIRCLR_PIN28_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN28_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN28_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 27 : Set as input pin 27. */ +#define GPIO_DIRCLR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIRCLR_PIN27_Msk (0x1UL << GPIO_DIRCLR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIRCLR_PIN27_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN27_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN27_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 26 : Set as input pin 26. */ +#define GPIO_DIRCLR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIRCLR_PIN26_Msk (0x1UL << GPIO_DIRCLR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIRCLR_PIN26_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN26_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN26_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 25 : Set as input pin 25. */ +#define GPIO_DIRCLR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIRCLR_PIN25_Msk (0x1UL << GPIO_DIRCLR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIRCLR_PIN25_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN25_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN25_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 24 : Set as input pin 24. */ +#define GPIO_DIRCLR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIRCLR_PIN24_Msk (0x1UL << GPIO_DIRCLR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIRCLR_PIN24_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN24_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN24_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 23 : Set as input pin 23. */ +#define GPIO_DIRCLR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIRCLR_PIN23_Msk (0x1UL << GPIO_DIRCLR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIRCLR_PIN23_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN23_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN23_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 22 : Set as input pin 22. */ +#define GPIO_DIRCLR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIRCLR_PIN22_Msk (0x1UL << GPIO_DIRCLR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIRCLR_PIN22_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN22_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN22_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 21 : Set as input pin 21. */ +#define GPIO_DIRCLR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIRCLR_PIN21_Msk (0x1UL << GPIO_DIRCLR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIRCLR_PIN21_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN21_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN21_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 20 : Set as input pin 20. */ +#define GPIO_DIRCLR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIRCLR_PIN20_Msk (0x1UL << GPIO_DIRCLR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIRCLR_PIN20_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN20_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN20_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 19 : Set as input pin 19. */ +#define GPIO_DIRCLR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIRCLR_PIN19_Msk (0x1UL << GPIO_DIRCLR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIRCLR_PIN19_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN19_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN19_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 18 : Set as input pin 18. */ +#define GPIO_DIRCLR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIRCLR_PIN18_Msk (0x1UL << GPIO_DIRCLR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIRCLR_PIN18_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN18_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN18_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 17 : Set as input pin 17. */ +#define GPIO_DIRCLR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIRCLR_PIN17_Msk (0x1UL << GPIO_DIRCLR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIRCLR_PIN17_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN17_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN17_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 16 : Set as input pin 16. */ +#define GPIO_DIRCLR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIRCLR_PIN16_Msk (0x1UL << GPIO_DIRCLR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIRCLR_PIN16_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN16_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN16_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 15 : Set as input pin 15. */ +#define GPIO_DIRCLR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIRCLR_PIN15_Msk (0x1UL << GPIO_DIRCLR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIRCLR_PIN15_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN15_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN15_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 14 : Set as input pin 14. */ +#define GPIO_DIRCLR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIRCLR_PIN14_Msk (0x1UL << GPIO_DIRCLR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIRCLR_PIN14_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN14_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN14_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 13 : Set as input pin 13. */ +#define GPIO_DIRCLR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIRCLR_PIN13_Msk (0x1UL << GPIO_DIRCLR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIRCLR_PIN13_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN13_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN13_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 12 : Set as input pin 12. */ +#define GPIO_DIRCLR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIRCLR_PIN12_Msk (0x1UL << GPIO_DIRCLR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIRCLR_PIN12_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN12_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN12_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 11 : Set as input pin 11. */ +#define GPIO_DIRCLR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIRCLR_PIN11_Msk (0x1UL << GPIO_DIRCLR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIRCLR_PIN11_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN11_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN11_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 10 : Set as input pin 10. */ +#define GPIO_DIRCLR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIRCLR_PIN10_Msk (0x1UL << GPIO_DIRCLR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIRCLR_PIN10_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN10_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN10_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 9 : Set as input pin 9. */ +#define GPIO_DIRCLR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIRCLR_PIN9_Msk (0x1UL << GPIO_DIRCLR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIRCLR_PIN9_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN9_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN9_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 8 : Set as input pin 8. */ +#define GPIO_DIRCLR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIRCLR_PIN8_Msk (0x1UL << GPIO_DIRCLR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIRCLR_PIN8_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN8_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN8_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 7 : Set as input pin 7. */ +#define GPIO_DIRCLR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIRCLR_PIN7_Msk (0x1UL << GPIO_DIRCLR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIRCLR_PIN7_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN7_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN7_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 6 : Set as input pin 6. */ +#define GPIO_DIRCLR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIRCLR_PIN6_Msk (0x1UL << GPIO_DIRCLR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIRCLR_PIN6_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN6_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN6_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 5 : Set as input pin 5. */ +#define GPIO_DIRCLR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIRCLR_PIN5_Msk (0x1UL << GPIO_DIRCLR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIRCLR_PIN5_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN5_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN5_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 4 : Set as input pin 4. */ +#define GPIO_DIRCLR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIRCLR_PIN4_Msk (0x1UL << GPIO_DIRCLR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIRCLR_PIN4_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN4_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN4_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 3 : Set as input pin 3. */ +#define GPIO_DIRCLR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIRCLR_PIN3_Msk (0x1UL << GPIO_DIRCLR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIRCLR_PIN3_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN3_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN3_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 2 : Set as input pin 2. */ +#define GPIO_DIRCLR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIRCLR_PIN2_Msk (0x1UL << GPIO_DIRCLR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIRCLR_PIN2_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN2_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN2_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 1 : Set as input pin 1. */ +#define GPIO_DIRCLR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIRCLR_PIN1_Msk (0x1UL << GPIO_DIRCLR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIRCLR_PIN1_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN1_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN1_Clear (1UL) /*!< Set pin as input. */ + +/* Bit 0 : Set as input pin 0. */ +#define GPIO_DIRCLR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIRCLR_PIN0_Msk (0x1UL << GPIO_DIRCLR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIRCLR_PIN0_Input (0UL) /*!< Pin set as input. */ +#define GPIO_DIRCLR_PIN0_Output (1UL) /*!< Pin set as output. */ +#define GPIO_DIRCLR_PIN0_Clear (1UL) /*!< Set pin as input. */ + +/* Register: GPIO_PIN_CNF */ +/* Description: Configuration of GPIO pins. */ + +/* Bits 17..16 : Pin sensing mechanism. */ +#define GPIO_PIN_CNF_SENSE_Pos (16UL) /*!< Position of SENSE field. */ +#define GPIO_PIN_CNF_SENSE_Msk (0x3UL << GPIO_PIN_CNF_SENSE_Pos) /*!< Bit mask of SENSE field. */ +#define GPIO_PIN_CNF_SENSE_Disabled (0x00UL) /*!< Disabled. */ +#define GPIO_PIN_CNF_SENSE_High (0x02UL) /*!< Wakeup on high level. */ +#define GPIO_PIN_CNF_SENSE_Low (0x03UL) /*!< Wakeup on low level. */ + +/* Bits 10..8 : Drive configuration. */ +#define GPIO_PIN_CNF_DRIVE_Pos (8UL) /*!< Position of DRIVE field. */ +#define GPIO_PIN_CNF_DRIVE_Msk (0x7UL << GPIO_PIN_CNF_DRIVE_Pos) /*!< Bit mask of DRIVE field. */ +#define GPIO_PIN_CNF_DRIVE_S0S1 (0x00UL) /*!< Standard '0', Standard '1'. */ +#define GPIO_PIN_CNF_DRIVE_H0S1 (0x01UL) /*!< High '0', Standard '1'. */ +#define GPIO_PIN_CNF_DRIVE_S0H1 (0x02UL) /*!< Standard '0', High '1'. */ +#define GPIO_PIN_CNF_DRIVE_H0H1 (0x03UL) /*!< High '0', High '1'. */ +#define GPIO_PIN_CNF_DRIVE_D0S1 (0x04UL) /*!< Disconnected '0', Standard '1'. */ +#define GPIO_PIN_CNF_DRIVE_D0H1 (0x05UL) /*!< Disconnected '0', High '1'. */ +#define GPIO_PIN_CNF_DRIVE_S0D1 (0x06UL) /*!< Standard '0', Disconnected '1'. */ +#define GPIO_PIN_CNF_DRIVE_H0D1 (0x07UL) /*!< High '0', Disconnected '1'. */ + +/* Bits 3..2 : Pull-up or -down configuration. */ +#define GPIO_PIN_CNF_PULL_Pos (2UL) /*!< Position of PULL field. */ +#define GPIO_PIN_CNF_PULL_Msk (0x3UL << GPIO_PIN_CNF_PULL_Pos) /*!< Bit mask of PULL field. */ +#define GPIO_PIN_CNF_PULL_Disabled (0x00UL) /*!< No pull. */ +#define GPIO_PIN_CNF_PULL_Pulldown (0x01UL) /*!< Pulldown on pin. */ +#define GPIO_PIN_CNF_PULL_Pullup (0x03UL) /*!< Pullup on pin. */ + +/* Bit 1 : Connect or disconnect input path. */ +#define GPIO_PIN_CNF_INPUT_Pos (1UL) /*!< Position of INPUT field. */ +#define GPIO_PIN_CNF_INPUT_Msk (0x1UL << GPIO_PIN_CNF_INPUT_Pos) /*!< Bit mask of INPUT field. */ +#define GPIO_PIN_CNF_INPUT_Connect (0UL) /*!< Connect input pin. */ +#define GPIO_PIN_CNF_INPUT_Disconnect (1UL) /*!< Disconnect input pin. */ + +/* Bit 0 : Pin direction. */ +#define GPIO_PIN_CNF_DIR_Pos (0UL) /*!< Position of DIR field. */ +#define GPIO_PIN_CNF_DIR_Msk (0x1UL << GPIO_PIN_CNF_DIR_Pos) /*!< Bit mask of DIR field. */ +#define GPIO_PIN_CNF_DIR_Input (0UL) /*!< Configure pin as an input pin. */ +#define GPIO_PIN_CNF_DIR_Output (1UL) /*!< Configure pin as an output pin. */ + + +/* Peripheral: GPIOTE */ +/* Description: GPIO tasks and events. */ + +/* Register: GPIOTE_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 31 : Enable interrupt on PORT event. */ +#define GPIOTE_INTENSET_PORT_Pos (31UL) /*!< Position of PORT field. */ +#define GPIOTE_INTENSET_PORT_Msk (0x1UL << GPIOTE_INTENSET_PORT_Pos) /*!< Bit mask of PORT field. */ +#define GPIOTE_INTENSET_PORT_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENSET_PORT_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENSET_PORT_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 3 : Enable interrupt on IN[3] event. */ +#define GPIOTE_INTENSET_IN3_Pos (3UL) /*!< Position of IN3 field. */ +#define GPIOTE_INTENSET_IN3_Msk (0x1UL << GPIOTE_INTENSET_IN3_Pos) /*!< Bit mask of IN3 field. */ +#define GPIOTE_INTENSET_IN3_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENSET_IN3_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENSET_IN3_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 2 : Enable interrupt on IN[2] event. */ +#define GPIOTE_INTENSET_IN2_Pos (2UL) /*!< Position of IN2 field. */ +#define GPIOTE_INTENSET_IN2_Msk (0x1UL << GPIOTE_INTENSET_IN2_Pos) /*!< Bit mask of IN2 field. */ +#define GPIOTE_INTENSET_IN2_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENSET_IN2_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENSET_IN2_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on IN[1] event. */ +#define GPIOTE_INTENSET_IN1_Pos (1UL) /*!< Position of IN1 field. */ +#define GPIOTE_INTENSET_IN1_Msk (0x1UL << GPIOTE_INTENSET_IN1_Pos) /*!< Bit mask of IN1 field. */ +#define GPIOTE_INTENSET_IN1_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENSET_IN1_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENSET_IN1_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on IN[0] event. */ +#define GPIOTE_INTENSET_IN0_Pos (0UL) /*!< Position of IN0 field. */ +#define GPIOTE_INTENSET_IN0_Msk (0x1UL << GPIOTE_INTENSET_IN0_Pos) /*!< Bit mask of IN0 field. */ +#define GPIOTE_INTENSET_IN0_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENSET_IN0_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENSET_IN0_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: GPIOTE_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 31 : Disable interrupt on PORT event. */ +#define GPIOTE_INTENCLR_PORT_Pos (31UL) /*!< Position of PORT field. */ +#define GPIOTE_INTENCLR_PORT_Msk (0x1UL << GPIOTE_INTENCLR_PORT_Pos) /*!< Bit mask of PORT field. */ +#define GPIOTE_INTENCLR_PORT_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENCLR_PORT_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENCLR_PORT_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 3 : Disable interrupt on IN[3] event. */ +#define GPIOTE_INTENCLR_IN3_Pos (3UL) /*!< Position of IN3 field. */ +#define GPIOTE_INTENCLR_IN3_Msk (0x1UL << GPIOTE_INTENCLR_IN3_Pos) /*!< Bit mask of IN3 field. */ +#define GPIOTE_INTENCLR_IN3_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENCLR_IN3_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENCLR_IN3_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 2 : Disable interrupt on IN[2] event. */ +#define GPIOTE_INTENCLR_IN2_Pos (2UL) /*!< Position of IN2 field. */ +#define GPIOTE_INTENCLR_IN2_Msk (0x1UL << GPIOTE_INTENCLR_IN2_Pos) /*!< Bit mask of IN2 field. */ +#define GPIOTE_INTENCLR_IN2_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENCLR_IN2_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENCLR_IN2_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on IN[1] event. */ +#define GPIOTE_INTENCLR_IN1_Pos (1UL) /*!< Position of IN1 field. */ +#define GPIOTE_INTENCLR_IN1_Msk (0x1UL << GPIOTE_INTENCLR_IN1_Pos) /*!< Bit mask of IN1 field. */ +#define GPIOTE_INTENCLR_IN1_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENCLR_IN1_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENCLR_IN1_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on IN[0] event. */ +#define GPIOTE_INTENCLR_IN0_Pos (0UL) /*!< Position of IN0 field. */ +#define GPIOTE_INTENCLR_IN0_Msk (0x1UL << GPIOTE_INTENCLR_IN0_Pos) /*!< Bit mask of IN0 field. */ +#define GPIOTE_INTENCLR_IN0_Disabled (0UL) /*!< Interrupt disabled. */ +#define GPIOTE_INTENCLR_IN0_Enabled (1UL) /*!< Interrupt enabled. */ +#define GPIOTE_INTENCLR_IN0_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: GPIOTE_CONFIG */ +/* Description: Channel configuration registers. */ + +/* Bit 20 : Initial value of the output when the GPIOTE channel is configured as a Task. */ +#define GPIOTE_CONFIG_OUTINIT_Pos (20UL) /*!< Position of OUTINIT field. */ +#define GPIOTE_CONFIG_OUTINIT_Msk (0x1UL << GPIOTE_CONFIG_OUTINIT_Pos) /*!< Bit mask of OUTINIT field. */ +#define GPIOTE_CONFIG_OUTINIT_Low (0UL) /*!< Initial low output when in task mode. */ +#define GPIOTE_CONFIG_OUTINIT_High (1UL) /*!< Initial high output when in task mode. */ + +/* Bits 17..16 : Effects on output when in Task mode, or events on input that generates an event. */ +#define GPIOTE_CONFIG_POLARITY_Pos (16UL) /*!< Position of POLARITY field. */ +#define GPIOTE_CONFIG_POLARITY_Msk (0x3UL << GPIOTE_CONFIG_POLARITY_Pos) /*!< Bit mask of POLARITY field. */ +#define GPIOTE_CONFIG_POLARITY_None (0x00UL) /*!< No task or event. */ +#define GPIOTE_CONFIG_POLARITY_LoToHi (0x01UL) /*!< Low to high. */ +#define GPIOTE_CONFIG_POLARITY_HiToLo (0x02UL) /*!< High to low. */ +#define GPIOTE_CONFIG_POLARITY_Toggle (0x03UL) /*!< Toggle. */ + +/* Bits 12..8 : Pin select. */ +#define GPIOTE_CONFIG_PSEL_Pos (8UL) /*!< Position of PSEL field. */ +#define GPIOTE_CONFIG_PSEL_Msk (0x1FUL << GPIOTE_CONFIG_PSEL_Pos) /*!< Bit mask of PSEL field. */ + +/* Bits 1..0 : Mode */ +#define GPIOTE_CONFIG_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define GPIOTE_CONFIG_MODE_Msk (0x3UL << GPIOTE_CONFIG_MODE_Pos) /*!< Bit mask of MODE field. */ +#define GPIOTE_CONFIG_MODE_Disabled (0x00UL) /*!< Disabled. */ +#define GPIOTE_CONFIG_MODE_Event (0x01UL) /*!< Channel configure in event mode. */ +#define GPIOTE_CONFIG_MODE_Task (0x03UL) /*!< Channel configure in task mode. */ + +/* Register: GPIOTE_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define GPIOTE_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define GPIOTE_POWER_POWER_Msk (0x1UL << GPIOTE_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define GPIOTE_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define GPIOTE_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: LPCOMP */ +/* Description: Low power comparator. */ + +/* Register: LPCOMP_SHORTS */ +/* Description: Shortcuts for the LPCOMP. */ + +/* Bit 4 : Shortcut between CROSS event and STOP task. */ +#define LPCOMP_SHORTS_CROSS_STOP_Pos (4UL) /*!< Position of CROSS_STOP field. */ +#define LPCOMP_SHORTS_CROSS_STOP_Msk (0x1UL << LPCOMP_SHORTS_CROSS_STOP_Pos) /*!< Bit mask of CROSS_STOP field. */ +#define LPCOMP_SHORTS_CROSS_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define LPCOMP_SHORTS_CROSS_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 3 : Shortcut between UP event and STOP task. */ +#define LPCOMP_SHORTS_UP_STOP_Pos (3UL) /*!< Position of UP_STOP field. */ +#define LPCOMP_SHORTS_UP_STOP_Msk (0x1UL << LPCOMP_SHORTS_UP_STOP_Pos) /*!< Bit mask of UP_STOP field. */ +#define LPCOMP_SHORTS_UP_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define LPCOMP_SHORTS_UP_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 2 : Shortcut between DOWN event and STOP task. */ +#define LPCOMP_SHORTS_DOWN_STOP_Pos (2UL) /*!< Position of DOWN_STOP field. */ +#define LPCOMP_SHORTS_DOWN_STOP_Msk (0x1UL << LPCOMP_SHORTS_DOWN_STOP_Pos) /*!< Bit mask of DOWN_STOP field. */ +#define LPCOMP_SHORTS_DOWN_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define LPCOMP_SHORTS_DOWN_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 1 : Shortcut between RADY event and STOP task. */ +#define LPCOMP_SHORTS_READY_STOP_Pos (1UL) /*!< Position of READY_STOP field. */ +#define LPCOMP_SHORTS_READY_STOP_Msk (0x1UL << LPCOMP_SHORTS_READY_STOP_Pos) /*!< Bit mask of READY_STOP field. */ +#define LPCOMP_SHORTS_READY_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define LPCOMP_SHORTS_READY_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 0 : Shortcut between READY event and SAMPLE task. */ +#define LPCOMP_SHORTS_READY_SAMPLE_Pos (0UL) /*!< Position of READY_SAMPLE field. */ +#define LPCOMP_SHORTS_READY_SAMPLE_Msk (0x1UL << LPCOMP_SHORTS_READY_SAMPLE_Pos) /*!< Bit mask of READY_SAMPLE field. */ +#define LPCOMP_SHORTS_READY_SAMPLE_Disabled (0UL) /*!< Shortcut disabled. */ +#define LPCOMP_SHORTS_READY_SAMPLE_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: LPCOMP_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 3 : Enable interrupt on CROSS event. */ +#define LPCOMP_INTENSET_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define LPCOMP_INTENSET_CROSS_Msk (0x1UL << LPCOMP_INTENSET_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define LPCOMP_INTENSET_CROSS_Disabled (0UL) /*!< Interrupt disabled. */ +#define LPCOMP_INTENSET_CROSS_Enabled (1UL) /*!< Interrupt enabled. */ +#define LPCOMP_INTENSET_CROSS_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 2 : Enable interrupt on UP event. */ +#define LPCOMP_INTENSET_UP_Pos (2UL) /*!< Position of UP field. */ +#define LPCOMP_INTENSET_UP_Msk (0x1UL << LPCOMP_INTENSET_UP_Pos) /*!< Bit mask of UP field. */ +#define LPCOMP_INTENSET_UP_Disabled (0UL) /*!< Interrupt disabled. */ +#define LPCOMP_INTENSET_UP_Enabled (1UL) /*!< Interrupt enabled. */ +#define LPCOMP_INTENSET_UP_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on DOWN event. */ +#define LPCOMP_INTENSET_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define LPCOMP_INTENSET_DOWN_Msk (0x1UL << LPCOMP_INTENSET_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define LPCOMP_INTENSET_DOWN_Disabled (0UL) /*!< Interrupt disabled. */ +#define LPCOMP_INTENSET_DOWN_Enabled (1UL) /*!< Interrupt enabled. */ +#define LPCOMP_INTENSET_DOWN_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on READY event. */ +#define LPCOMP_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define LPCOMP_INTENSET_READY_Msk (0x1UL << LPCOMP_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define LPCOMP_INTENSET_READY_Disabled (0UL) /*!< Interrupt disabled. */ +#define LPCOMP_INTENSET_READY_Enabled (1UL) /*!< Interrupt enabled. */ +#define LPCOMP_INTENSET_READY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: LPCOMP_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 3 : Disable interrupt on CROSS event. */ +#define LPCOMP_INTENCLR_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define LPCOMP_INTENCLR_CROSS_Msk (0x1UL << LPCOMP_INTENCLR_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define LPCOMP_INTENCLR_CROSS_Disabled (0UL) /*!< Interrupt disabled. */ +#define LPCOMP_INTENCLR_CROSS_Enabled (1UL) /*!< Interrupt enabled. */ +#define LPCOMP_INTENCLR_CROSS_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 2 : Disable interrupt on UP event. */ +#define LPCOMP_INTENCLR_UP_Pos (2UL) /*!< Position of UP field. */ +#define LPCOMP_INTENCLR_UP_Msk (0x1UL << LPCOMP_INTENCLR_UP_Pos) /*!< Bit mask of UP field. */ +#define LPCOMP_INTENCLR_UP_Disabled (0UL) /*!< Interrupt disabled. */ +#define LPCOMP_INTENCLR_UP_Enabled (1UL) /*!< Interrupt enabled. */ +#define LPCOMP_INTENCLR_UP_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on DOWN event. */ +#define LPCOMP_INTENCLR_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define LPCOMP_INTENCLR_DOWN_Msk (0x1UL << LPCOMP_INTENCLR_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define LPCOMP_INTENCLR_DOWN_Disabled (0UL) /*!< Interrupt disabled. */ +#define LPCOMP_INTENCLR_DOWN_Enabled (1UL) /*!< Interrupt enabled. */ +#define LPCOMP_INTENCLR_DOWN_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on READY event. */ +#define LPCOMP_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define LPCOMP_INTENCLR_READY_Msk (0x1UL << LPCOMP_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define LPCOMP_INTENCLR_READY_Disabled (0UL) /*!< Interrupt disabled. */ +#define LPCOMP_INTENCLR_READY_Enabled (1UL) /*!< Interrupt enabled. */ +#define LPCOMP_INTENCLR_READY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: LPCOMP_RESULT */ +/* Description: Result of last compare. */ + +/* Bit 0 : Result of last compare. Decision point SAMPLE task. */ +#define LPCOMP_RESULT_RESULT_Pos (0UL) /*!< Position of RESULT field. */ +#define LPCOMP_RESULT_RESULT_Msk (0x1UL << LPCOMP_RESULT_RESULT_Pos) /*!< Bit mask of RESULT field. */ +#define LPCOMP_RESULT_RESULT_Bellow (0UL) /*!< Input voltage is bellow the reference threshold. */ +#define LPCOMP_RESULT_RESULT_Above (1UL) /*!< Input voltage is above the reference threshold. */ + +/* Register: LPCOMP_ENABLE */ +/* Description: Enable the LPCOMP. */ + +/* Bits 1..0 : Enable or disable LPCOMP. */ +#define LPCOMP_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define LPCOMP_ENABLE_ENABLE_Msk (0x3UL << LPCOMP_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define LPCOMP_ENABLE_ENABLE_Disabled (0x00UL) /*!< Disabled LPCOMP. */ +#define LPCOMP_ENABLE_ENABLE_Enabled (0x01UL) /*!< Enable LPCOMP. */ + +/* Register: LPCOMP_PSEL */ +/* Description: Input pin select. */ + +/* Bits 2..0 : Analog input pin select. */ +#define LPCOMP_PSEL_PSEL_Pos (0UL) /*!< Position of PSEL field. */ +#define LPCOMP_PSEL_PSEL_Msk (0x7UL << LPCOMP_PSEL_PSEL_Pos) /*!< Bit mask of PSEL field. */ +#define LPCOMP_PSEL_PSEL_AnalogInput0 (0UL) /*!< Use analog input 0 as analog input. */ +#define LPCOMP_PSEL_PSEL_AnalogInput1 (1UL) /*!< Use analog input 1 as analog input. */ +#define LPCOMP_PSEL_PSEL_AnalogInput2 (2UL) /*!< Use analog input 2 as analog input. */ +#define LPCOMP_PSEL_PSEL_AnalogInput3 (3UL) /*!< Use analog input 3 as analog input. */ +#define LPCOMP_PSEL_PSEL_AnalogInput4 (4UL) /*!< Use analog input 4 as analog input. */ +#define LPCOMP_PSEL_PSEL_AnalogInput5 (5UL) /*!< Use analog input 5 as analog input. */ +#define LPCOMP_PSEL_PSEL_AnalogInput6 (6UL) /*!< Use analog input 6 as analog input. */ +#define LPCOMP_PSEL_PSEL_AnalogInput7 (7UL) /*!< Use analog input 7 as analog input. */ + +/* Register: LPCOMP_REFSEL */ +/* Description: Reference select. */ + +/* Bits 2..0 : Reference select. */ +#define LPCOMP_REFSEL_REFSEL_Pos (0UL) /*!< Position of REFSEL field. */ +#define LPCOMP_REFSEL_REFSEL_Msk (0x7UL << LPCOMP_REFSEL_REFSEL_Pos) /*!< Bit mask of REFSEL field. */ +#define LPCOMP_REFSEL_REFSEL_SupplyOneEighthPrescaling (0UL) /*!< Use supply with a 1/8 prescaler as reference. */ +#define LPCOMP_REFSEL_REFSEL_SupplyTwoEighthsPrescaling (1UL) /*!< Use supply with a 2/8 prescaler as reference. */ +#define LPCOMP_REFSEL_REFSEL_SupplyThreeEighthsPrescaling (2UL) /*!< Use supply with a 3/8 prescaler as reference. */ +#define LPCOMP_REFSEL_REFSEL_SupplyFourEighthsPrescaling (3UL) /*!< Use supply with a 4/8 prescaler as reference. */ +#define LPCOMP_REFSEL_REFSEL_SupplyFiveEighthsPrescaling (4UL) /*!< Use supply with a 5/8 prescaler as reference. */ +#define LPCOMP_REFSEL_REFSEL_SupplySixEighthsPrescaling (5UL) /*!< Use supply with a 6/8 prescaler as reference. */ +#define LPCOMP_REFSEL_REFSEL_SupplySevenEighthsPrescaling (6UL) /*!< Use supply with a 7/8 prescaler as reference. */ +#define LPCOMP_REFSEL_REFSEL_ARef (7UL) /*!< Use external analog reference as reference. */ + +/* Register: LPCOMP_EXTREFSEL */ +/* Description: External reference select. */ + +/* Bit 0 : External analog reference pin selection. */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_Pos (0UL) /*!< Position of EXTREFSEL field. */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_Msk (0x1UL << LPCOMP_EXTREFSEL_EXTREFSEL_Pos) /*!< Bit mask of EXTREFSEL field. */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference0 (0UL) /*!< Use analog reference 0 as reference. */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference1 (1UL) /*!< Use analog reference 1 as reference. */ + +/* Register: LPCOMP_ANADETECT */ +/* Description: Analog detect configuration. */ + +/* Bits 1..0 : Analog detect configuration. */ +#define LPCOMP_ANADETECT_ANADETECT_Pos (0UL) /*!< Position of ANADETECT field. */ +#define LPCOMP_ANADETECT_ANADETECT_Msk (0x3UL << LPCOMP_ANADETECT_ANADETECT_Pos) /*!< Bit mask of ANADETECT field. */ +#define LPCOMP_ANADETECT_ANADETECT_Cross (0UL) /*!< Generate ANADETEC on crossing, both upwards and downwards crossing. */ +#define LPCOMP_ANADETECT_ANADETECT_Up (1UL) /*!< Generate ANADETEC on upwards crossing only. */ +#define LPCOMP_ANADETECT_ANADETECT_Down (2UL) /*!< Generate ANADETEC on downwards crossing only. */ + +/* Register: LPCOMP_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define LPCOMP_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define LPCOMP_POWER_POWER_Msk (0x1UL << LPCOMP_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define LPCOMP_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define LPCOMP_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: MPU */ +/* Description: Memory Protection Unit. */ + +/* Register: MPU_PERR0 */ +/* Description: Configuration of peripherals in mpu regions. */ + +/* Bit 31 : PPI region configuration. */ +#define MPU_PERR0_PPI_Pos (31UL) /*!< Position of PPI field. */ +#define MPU_PERR0_PPI_Msk (0x1UL << MPU_PERR0_PPI_Pos) /*!< Bit mask of PPI field. */ +#define MPU_PERR0_PPI_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_PPI_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 30 : NVMC region configuration. */ +#define MPU_PERR0_NVMC_Pos (30UL) /*!< Position of NVMC field. */ +#define MPU_PERR0_NVMC_Msk (0x1UL << MPU_PERR0_NVMC_Pos) /*!< Bit mask of NVMC field. */ +#define MPU_PERR0_NVMC_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_NVMC_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 19 : LPCOMP region configuration. */ +#define MPU_PERR0_LPCOMP_Pos (19UL) /*!< Position of LPCOMP field. */ +#define MPU_PERR0_LPCOMP_Msk (0x1UL << MPU_PERR0_LPCOMP_Pos) /*!< Bit mask of LPCOMP field. */ +#define MPU_PERR0_LPCOMP_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_LPCOMP_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 18 : QDEC region configuration. */ +#define MPU_PERR0_QDEC_Pos (18UL) /*!< Position of QDEC field. */ +#define MPU_PERR0_QDEC_Msk (0x1UL << MPU_PERR0_QDEC_Pos) /*!< Bit mask of QDEC field. */ +#define MPU_PERR0_QDEC_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_QDEC_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 17 : RTC1 region configuration. */ +#define MPU_PERR0_RTC1_Pos (17UL) /*!< Position of RTC1 field. */ +#define MPU_PERR0_RTC1_Msk (0x1UL << MPU_PERR0_RTC1_Pos) /*!< Bit mask of RTC1 field. */ +#define MPU_PERR0_RTC1_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_RTC1_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 16 : WDT region configuration. */ +#define MPU_PERR0_WDT_Pos (16UL) /*!< Position of WDT field. */ +#define MPU_PERR0_WDT_Msk (0x1UL << MPU_PERR0_WDT_Pos) /*!< Bit mask of WDT field. */ +#define MPU_PERR0_WDT_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_WDT_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 15 : CCM and AAR region configuration. */ +#define MPU_PERR0_CCM_AAR_Pos (15UL) /*!< Position of CCM_AAR field. */ +#define MPU_PERR0_CCM_AAR_Msk (0x1UL << MPU_PERR0_CCM_AAR_Pos) /*!< Bit mask of CCM_AAR field. */ +#define MPU_PERR0_CCM_AAR_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_CCM_AAR_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 14 : ECB region configuration. */ +#define MPU_PERR0_ECB_Pos (14UL) /*!< Position of ECB field. */ +#define MPU_PERR0_ECB_Msk (0x1UL << MPU_PERR0_ECB_Pos) /*!< Bit mask of ECB field. */ +#define MPU_PERR0_ECB_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_ECB_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 13 : RNG region configuration. */ +#define MPU_PERR0_RNG_Pos (13UL) /*!< Position of RNG field. */ +#define MPU_PERR0_RNG_Msk (0x1UL << MPU_PERR0_RNG_Pos) /*!< Bit mask of RNG field. */ +#define MPU_PERR0_RNG_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_RNG_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 12 : TEMP region configuration. */ +#define MPU_PERR0_TEMP_Pos (12UL) /*!< Position of TEMP field. */ +#define MPU_PERR0_TEMP_Msk (0x1UL << MPU_PERR0_TEMP_Pos) /*!< Bit mask of TEMP field. */ +#define MPU_PERR0_TEMP_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_TEMP_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 11 : RTC0 region configuration. */ +#define MPU_PERR0_RTC0_Pos (11UL) /*!< Position of RTC0 field. */ +#define MPU_PERR0_RTC0_Msk (0x1UL << MPU_PERR0_RTC0_Pos) /*!< Bit mask of RTC0 field. */ +#define MPU_PERR0_RTC0_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_RTC0_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 10 : TIMER2 region configuration. */ +#define MPU_PERR0_TIMER2_Pos (10UL) /*!< Position of TIMER2 field. */ +#define MPU_PERR0_TIMER2_Msk (0x1UL << MPU_PERR0_TIMER2_Pos) /*!< Bit mask of TIMER2 field. */ +#define MPU_PERR0_TIMER2_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_TIMER2_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 9 : TIMER1 region configuration. */ +#define MPU_PERR0_TIMER1_Pos (9UL) /*!< Position of TIMER1 field. */ +#define MPU_PERR0_TIMER1_Msk (0x1UL << MPU_PERR0_TIMER1_Pos) /*!< Bit mask of TIMER1 field. */ +#define MPU_PERR0_TIMER1_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_TIMER1_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 8 : TIMER0 region configuration. */ +#define MPU_PERR0_TIMER0_Pos (8UL) /*!< Position of TIMER0 field. */ +#define MPU_PERR0_TIMER0_Msk (0x1UL << MPU_PERR0_TIMER0_Pos) /*!< Bit mask of TIMER0 field. */ +#define MPU_PERR0_TIMER0_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_TIMER0_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 7 : ADC region configuration. */ +#define MPU_PERR0_ADC_Pos (7UL) /*!< Position of ADC field. */ +#define MPU_PERR0_ADC_Msk (0x1UL << MPU_PERR0_ADC_Pos) /*!< Bit mask of ADC field. */ +#define MPU_PERR0_ADC_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_ADC_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 6 : GPIOTE region configuration. */ +#define MPU_PERR0_GPIOTE_Pos (6UL) /*!< Position of GPIOTE field. */ +#define MPU_PERR0_GPIOTE_Msk (0x1UL << MPU_PERR0_GPIOTE_Pos) /*!< Bit mask of GPIOTE field. */ +#define MPU_PERR0_GPIOTE_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_GPIOTE_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 4 : SPI1 and TWI1 region configuration. */ +#define MPU_PERR0_SPI1_TWI1_Pos (4UL) /*!< Position of SPI1_TWI1 field. */ +#define MPU_PERR0_SPI1_TWI1_Msk (0x1UL << MPU_PERR0_SPI1_TWI1_Pos) /*!< Bit mask of SPI1_TWI1 field. */ +#define MPU_PERR0_SPI1_TWI1_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_SPI1_TWI1_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 3 : SPI0 and TWI0 region configuration. */ +#define MPU_PERR0_SPI0_TWI0_Pos (3UL) /*!< Position of SPI0_TWI0 field. */ +#define MPU_PERR0_SPI0_TWI0_Msk (0x1UL << MPU_PERR0_SPI0_TWI0_Pos) /*!< Bit mask of SPI0_TWI0 field. */ +#define MPU_PERR0_SPI0_TWI0_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_SPI0_TWI0_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 2 : UART0 region configuration. */ +#define MPU_PERR0_UART0_Pos (2UL) /*!< Position of UART0 field. */ +#define MPU_PERR0_UART0_Msk (0x1UL << MPU_PERR0_UART0_Pos) /*!< Bit mask of UART0 field. */ +#define MPU_PERR0_UART0_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_UART0_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 1 : RADIO region configuration. */ +#define MPU_PERR0_RADIO_Pos (1UL) /*!< Position of RADIO field. */ +#define MPU_PERR0_RADIO_Msk (0x1UL << MPU_PERR0_RADIO_Pos) /*!< Bit mask of RADIO field. */ +#define MPU_PERR0_RADIO_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_RADIO_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Bit 0 : POWER_CLOCK region configuration. */ +#define MPU_PERR0_POWER_CLOCK_Pos (0UL) /*!< Position of POWER_CLOCK field. */ +#define MPU_PERR0_POWER_CLOCK_Msk (0x1UL << MPU_PERR0_POWER_CLOCK_Pos) /*!< Bit mask of POWER_CLOCK field. */ +#define MPU_PERR0_POWER_CLOCK_InRegion1 (0UL) /*!< Peripheral configured in region 1. */ +#define MPU_PERR0_POWER_CLOCK_InRegion0 (1UL) /*!< Peripheral configured in region 0. */ + +/* Register: MPU_PROTENSET0 */ +/* Description: Erase and write protection bit enable set register. */ + +/* Bit 31 : Protection enable for region 31. */ +#define MPU_PROTENSET0_PROTREG31_Pos (31UL) /*!< Position of PROTREG31 field. */ +#define MPU_PROTENSET0_PROTREG31_Msk (0x1UL << MPU_PROTENSET0_PROTREG31_Pos) /*!< Bit mask of PROTREG31 field. */ +#define MPU_PROTENSET0_PROTREG31_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG31_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG31_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 30 : Protection enable for region 30. */ +#define MPU_PROTENSET0_PROTREG30_Pos (30UL) /*!< Position of PROTREG30 field. */ +#define MPU_PROTENSET0_PROTREG30_Msk (0x1UL << MPU_PROTENSET0_PROTREG30_Pos) /*!< Bit mask of PROTREG30 field. */ +#define MPU_PROTENSET0_PROTREG30_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG30_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG30_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 29 : Protection enable for region 29. */ +#define MPU_PROTENSET0_PROTREG29_Pos (29UL) /*!< Position of PROTREG29 field. */ +#define MPU_PROTENSET0_PROTREG29_Msk (0x1UL << MPU_PROTENSET0_PROTREG29_Pos) /*!< Bit mask of PROTREG29 field. */ +#define MPU_PROTENSET0_PROTREG29_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG29_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG29_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 28 : Protection enable for region 28. */ +#define MPU_PROTENSET0_PROTREG28_Pos (28UL) /*!< Position of PROTREG28 field. */ +#define MPU_PROTENSET0_PROTREG28_Msk (0x1UL << MPU_PROTENSET0_PROTREG28_Pos) /*!< Bit mask of PROTREG28 field. */ +#define MPU_PROTENSET0_PROTREG28_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG28_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG28_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 27 : Protection enable for region 27. */ +#define MPU_PROTENSET0_PROTREG27_Pos (27UL) /*!< Position of PROTREG27 field. */ +#define MPU_PROTENSET0_PROTREG27_Msk (0x1UL << MPU_PROTENSET0_PROTREG27_Pos) /*!< Bit mask of PROTREG27 field. */ +#define MPU_PROTENSET0_PROTREG27_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG27_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG27_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 26 : Protection enable for region 26. */ +#define MPU_PROTENSET0_PROTREG26_Pos (26UL) /*!< Position of PROTREG26 field. */ +#define MPU_PROTENSET0_PROTREG26_Msk (0x1UL << MPU_PROTENSET0_PROTREG26_Pos) /*!< Bit mask of PROTREG26 field. */ +#define MPU_PROTENSET0_PROTREG26_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG26_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG26_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 25 : Protection enable for region 25. */ +#define MPU_PROTENSET0_PROTREG25_Pos (25UL) /*!< Position of PROTREG25 field. */ +#define MPU_PROTENSET0_PROTREG25_Msk (0x1UL << MPU_PROTENSET0_PROTREG25_Pos) /*!< Bit mask of PROTREG25 field. */ +#define MPU_PROTENSET0_PROTREG25_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG25_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG25_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 24 : Protection enable for region 24. */ +#define MPU_PROTENSET0_PROTREG24_Pos (24UL) /*!< Position of PROTREG24 field. */ +#define MPU_PROTENSET0_PROTREG24_Msk (0x1UL << MPU_PROTENSET0_PROTREG24_Pos) /*!< Bit mask of PROTREG24 field. */ +#define MPU_PROTENSET0_PROTREG24_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG24_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG24_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 23 : Protection enable for region 23. */ +#define MPU_PROTENSET0_PROTREG23_Pos (23UL) /*!< Position of PROTREG23 field. */ +#define MPU_PROTENSET0_PROTREG23_Msk (0x1UL << MPU_PROTENSET0_PROTREG23_Pos) /*!< Bit mask of PROTREG23 field. */ +#define MPU_PROTENSET0_PROTREG23_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG23_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG23_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 22 : Protection enable for region 22. */ +#define MPU_PROTENSET0_PROTREG22_Pos (22UL) /*!< Position of PROTREG22 field. */ +#define MPU_PROTENSET0_PROTREG22_Msk (0x1UL << MPU_PROTENSET0_PROTREG22_Pos) /*!< Bit mask of PROTREG22 field. */ +#define MPU_PROTENSET0_PROTREG22_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG22_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG22_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 21 : Protection enable for region 21. */ +#define MPU_PROTENSET0_PROTREG21_Pos (21UL) /*!< Position of PROTREG21 field. */ +#define MPU_PROTENSET0_PROTREG21_Msk (0x1UL << MPU_PROTENSET0_PROTREG21_Pos) /*!< Bit mask of PROTREG21 field. */ +#define MPU_PROTENSET0_PROTREG21_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG21_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG21_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 20 : Protection enable for region 20. */ +#define MPU_PROTENSET0_PROTREG20_Pos (20UL) /*!< Position of PROTREG20 field. */ +#define MPU_PROTENSET0_PROTREG20_Msk (0x1UL << MPU_PROTENSET0_PROTREG20_Pos) /*!< Bit mask of PROTREG20 field. */ +#define MPU_PROTENSET0_PROTREG20_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG20_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG20_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 19 : Protection enable for region 19. */ +#define MPU_PROTENSET0_PROTREG19_Pos (19UL) /*!< Position of PROTREG19 field. */ +#define MPU_PROTENSET0_PROTREG19_Msk (0x1UL << MPU_PROTENSET0_PROTREG19_Pos) /*!< Bit mask of PROTREG19 field. */ +#define MPU_PROTENSET0_PROTREG19_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG19_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG19_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 18 : Protection enable for region 18. */ +#define MPU_PROTENSET0_PROTREG18_Pos (18UL) /*!< Position of PROTREG18 field. */ +#define MPU_PROTENSET0_PROTREG18_Msk (0x1UL << MPU_PROTENSET0_PROTREG18_Pos) /*!< Bit mask of PROTREG18 field. */ +#define MPU_PROTENSET0_PROTREG18_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG18_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG18_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 17 : Protection enable for region 17. */ +#define MPU_PROTENSET0_PROTREG17_Pos (17UL) /*!< Position of PROTREG17 field. */ +#define MPU_PROTENSET0_PROTREG17_Msk (0x1UL << MPU_PROTENSET0_PROTREG17_Pos) /*!< Bit mask of PROTREG17 field. */ +#define MPU_PROTENSET0_PROTREG17_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG17_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG17_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 16 : Protection enable for region 16. */ +#define MPU_PROTENSET0_PROTREG16_Pos (16UL) /*!< Position of PROTREG16 field. */ +#define MPU_PROTENSET0_PROTREG16_Msk (0x1UL << MPU_PROTENSET0_PROTREG16_Pos) /*!< Bit mask of PROTREG16 field. */ +#define MPU_PROTENSET0_PROTREG16_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG16_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG16_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 15 : Protection enable for region 15. */ +#define MPU_PROTENSET0_PROTREG15_Pos (15UL) /*!< Position of PROTREG15 field. */ +#define MPU_PROTENSET0_PROTREG15_Msk (0x1UL << MPU_PROTENSET0_PROTREG15_Pos) /*!< Bit mask of PROTREG15 field. */ +#define MPU_PROTENSET0_PROTREG15_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG15_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG15_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 14 : Protection enable for region 14. */ +#define MPU_PROTENSET0_PROTREG14_Pos (14UL) /*!< Position of PROTREG14 field. */ +#define MPU_PROTENSET0_PROTREG14_Msk (0x1UL << MPU_PROTENSET0_PROTREG14_Pos) /*!< Bit mask of PROTREG14 field. */ +#define MPU_PROTENSET0_PROTREG14_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG14_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG14_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 13 : Protection enable for region 13. */ +#define MPU_PROTENSET0_PROTREG13_Pos (13UL) /*!< Position of PROTREG13 field. */ +#define MPU_PROTENSET0_PROTREG13_Msk (0x1UL << MPU_PROTENSET0_PROTREG13_Pos) /*!< Bit mask of PROTREG13 field. */ +#define MPU_PROTENSET0_PROTREG13_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG13_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG13_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 12 : Protection enable for region 12. */ +#define MPU_PROTENSET0_PROTREG12_Pos (12UL) /*!< Position of PROTREG12 field. */ +#define MPU_PROTENSET0_PROTREG12_Msk (0x1UL << MPU_PROTENSET0_PROTREG12_Pos) /*!< Bit mask of PROTREG12 field. */ +#define MPU_PROTENSET0_PROTREG12_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG12_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG12_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 11 : Protection enable for region 11. */ +#define MPU_PROTENSET0_PROTREG11_Pos (11UL) /*!< Position of PROTREG11 field. */ +#define MPU_PROTENSET0_PROTREG11_Msk (0x1UL << MPU_PROTENSET0_PROTREG11_Pos) /*!< Bit mask of PROTREG11 field. */ +#define MPU_PROTENSET0_PROTREG11_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG11_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG11_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 10 : Protection enable for region 10. */ +#define MPU_PROTENSET0_PROTREG10_Pos (10UL) /*!< Position of PROTREG10 field. */ +#define MPU_PROTENSET0_PROTREG10_Msk (0x1UL << MPU_PROTENSET0_PROTREG10_Pos) /*!< Bit mask of PROTREG10 field. */ +#define MPU_PROTENSET0_PROTREG10_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG10_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG10_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 9 : Protection enable for region 9. */ +#define MPU_PROTENSET0_PROTREG9_Pos (9UL) /*!< Position of PROTREG9 field. */ +#define MPU_PROTENSET0_PROTREG9_Msk (0x1UL << MPU_PROTENSET0_PROTREG9_Pos) /*!< Bit mask of PROTREG9 field. */ +#define MPU_PROTENSET0_PROTREG9_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG9_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG9_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 8 : Protection enable for region 8. */ +#define MPU_PROTENSET0_PROTREG8_Pos (8UL) /*!< Position of PROTREG8 field. */ +#define MPU_PROTENSET0_PROTREG8_Msk (0x1UL << MPU_PROTENSET0_PROTREG8_Pos) /*!< Bit mask of PROTREG8 field. */ +#define MPU_PROTENSET0_PROTREG8_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG8_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG8_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 7 : Protection enable for region 7. */ +#define MPU_PROTENSET0_PROTREG7_Pos (7UL) /*!< Position of PROTREG7 field. */ +#define MPU_PROTENSET0_PROTREG7_Msk (0x1UL << MPU_PROTENSET0_PROTREG7_Pos) /*!< Bit mask of PROTREG7 field. */ +#define MPU_PROTENSET0_PROTREG7_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG7_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG7_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 6 : Protection enable for region 6. */ +#define MPU_PROTENSET0_PROTREG6_Pos (6UL) /*!< Position of PROTREG6 field. */ +#define MPU_PROTENSET0_PROTREG6_Msk (0x1UL << MPU_PROTENSET0_PROTREG6_Pos) /*!< Bit mask of PROTREG6 field. */ +#define MPU_PROTENSET0_PROTREG6_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG6_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG6_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 5 : Protection enable for region 5. */ +#define MPU_PROTENSET0_PROTREG5_Pos (5UL) /*!< Position of PROTREG5 field. */ +#define MPU_PROTENSET0_PROTREG5_Msk (0x1UL << MPU_PROTENSET0_PROTREG5_Pos) /*!< Bit mask of PROTREG5 field. */ +#define MPU_PROTENSET0_PROTREG5_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG5_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG5_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 4 : Protection enable for region 4. */ +#define MPU_PROTENSET0_PROTREG4_Pos (4UL) /*!< Position of PROTREG4 field. */ +#define MPU_PROTENSET0_PROTREG4_Msk (0x1UL << MPU_PROTENSET0_PROTREG4_Pos) /*!< Bit mask of PROTREG4 field. */ +#define MPU_PROTENSET0_PROTREG4_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG4_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG4_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 3 : Protection enable for region 3. */ +#define MPU_PROTENSET0_PROTREG3_Pos (3UL) /*!< Position of PROTREG3 field. */ +#define MPU_PROTENSET0_PROTREG3_Msk (0x1UL << MPU_PROTENSET0_PROTREG3_Pos) /*!< Bit mask of PROTREG3 field. */ +#define MPU_PROTENSET0_PROTREG3_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG3_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG3_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 2 : Protection enable for region 2. */ +#define MPU_PROTENSET0_PROTREG2_Pos (2UL) /*!< Position of PROTREG2 field. */ +#define MPU_PROTENSET0_PROTREG2_Msk (0x1UL << MPU_PROTENSET0_PROTREG2_Pos) /*!< Bit mask of PROTREG2 field. */ +#define MPU_PROTENSET0_PROTREG2_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG2_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG2_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 1 : Protection enable for region 1. */ +#define MPU_PROTENSET0_PROTREG1_Pos (1UL) /*!< Position of PROTREG1 field. */ +#define MPU_PROTENSET0_PROTREG1_Msk (0x1UL << MPU_PROTENSET0_PROTREG1_Pos) /*!< Bit mask of PROTREG1 field. */ +#define MPU_PROTENSET0_PROTREG1_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG1_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG1_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 0 : Protection enable for region 0. */ +#define MPU_PROTENSET0_PROTREG0_Pos (0UL) /*!< Position of PROTREG0 field. */ +#define MPU_PROTENSET0_PROTREG0_Msk (0x1UL << MPU_PROTENSET0_PROTREG0_Pos) /*!< Bit mask of PROTREG0 field. */ +#define MPU_PROTENSET0_PROTREG0_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET0_PROTREG0_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET0_PROTREG0_Set (1UL) /*!< Enable protection on write. */ + +/* Register: MPU_PROTENSET1 */ +/* Description: Erase and write protection bit enable set register. */ + +/* Bit 31 : Protection enable for region 63. */ +#define MPU_PROTENSET1_PROTREG63_Pos (31UL) /*!< Position of PROTREG63 field. */ +#define MPU_PROTENSET1_PROTREG63_Msk (0x1UL << MPU_PROTENSET1_PROTREG63_Pos) /*!< Bit mask of PROTREG63 field. */ +#define MPU_PROTENSET1_PROTREG63_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG63_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG63_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 30 : Protection enable for region 62. */ +#define MPU_PROTENSET1_PROTREG62_Pos (30UL) /*!< Position of PROTREG62 field. */ +#define MPU_PROTENSET1_PROTREG62_Msk (0x1UL << MPU_PROTENSET1_PROTREG62_Pos) /*!< Bit mask of PROTREG62 field. */ +#define MPU_PROTENSET1_PROTREG62_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG62_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG62_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 29 : Protection enable for region 61. */ +#define MPU_PROTENSET1_PROTREG61_Pos (29UL) /*!< Position of PROTREG61 field. */ +#define MPU_PROTENSET1_PROTREG61_Msk (0x1UL << MPU_PROTENSET1_PROTREG61_Pos) /*!< Bit mask of PROTREG61 field. */ +#define MPU_PROTENSET1_PROTREG61_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG61_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG61_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 28 : Protection enable for region 60. */ +#define MPU_PROTENSET1_PROTREG60_Pos (28UL) /*!< Position of PROTREG60 field. */ +#define MPU_PROTENSET1_PROTREG60_Msk (0x1UL << MPU_PROTENSET1_PROTREG60_Pos) /*!< Bit mask of PROTREG60 field. */ +#define MPU_PROTENSET1_PROTREG60_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG60_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG60_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 27 : Protection enable for region 59. */ +#define MPU_PROTENSET1_PROTREG59_Pos (27UL) /*!< Position of PROTREG59 field. */ +#define MPU_PROTENSET1_PROTREG59_Msk (0x1UL << MPU_PROTENSET1_PROTREG59_Pos) /*!< Bit mask of PROTREG59 field. */ +#define MPU_PROTENSET1_PROTREG59_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG59_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG59_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 26 : Protection enable for region 58. */ +#define MPU_PROTENSET1_PROTREG58_Pos (26UL) /*!< Position of PROTREG58 field. */ +#define MPU_PROTENSET1_PROTREG58_Msk (0x1UL << MPU_PROTENSET1_PROTREG58_Pos) /*!< Bit mask of PROTREG58 field. */ +#define MPU_PROTENSET1_PROTREG58_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG58_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG58_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 25 : Protection enable for region 57. */ +#define MPU_PROTENSET1_PROTREG57_Pos (25UL) /*!< Position of PROTREG57 field. */ +#define MPU_PROTENSET1_PROTREG57_Msk (0x1UL << MPU_PROTENSET1_PROTREG57_Pos) /*!< Bit mask of PROTREG57 field. */ +#define MPU_PROTENSET1_PROTREG57_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG57_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG57_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 24 : Protection enable for region 56. */ +#define MPU_PROTENSET1_PROTREG56_Pos (24UL) /*!< Position of PROTREG56 field. */ +#define MPU_PROTENSET1_PROTREG56_Msk (0x1UL << MPU_PROTENSET1_PROTREG56_Pos) /*!< Bit mask of PROTREG56 field. */ +#define MPU_PROTENSET1_PROTREG56_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG56_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG56_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 23 : Protection enable for region 55. */ +#define MPU_PROTENSET1_PROTREG55_Pos (23UL) /*!< Position of PROTREG55 field. */ +#define MPU_PROTENSET1_PROTREG55_Msk (0x1UL << MPU_PROTENSET1_PROTREG55_Pos) /*!< Bit mask of PROTREG55 field. */ +#define MPU_PROTENSET1_PROTREG55_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG55_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG55_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 22 : Protection enable for region 54. */ +#define MPU_PROTENSET1_PROTREG54_Pos (22UL) /*!< Position of PROTREG54 field. */ +#define MPU_PROTENSET1_PROTREG54_Msk (0x1UL << MPU_PROTENSET1_PROTREG54_Pos) /*!< Bit mask of PROTREG54 field. */ +#define MPU_PROTENSET1_PROTREG54_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG54_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG54_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 21 : Protection enable for region 53. */ +#define MPU_PROTENSET1_PROTREG53_Pos (21UL) /*!< Position of PROTREG53 field. */ +#define MPU_PROTENSET1_PROTREG53_Msk (0x1UL << MPU_PROTENSET1_PROTREG53_Pos) /*!< Bit mask of PROTREG53 field. */ +#define MPU_PROTENSET1_PROTREG53_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG53_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG53_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 20 : Protection enable for region 52. */ +#define MPU_PROTENSET1_PROTREG52_Pos (20UL) /*!< Position of PROTREG52 field. */ +#define MPU_PROTENSET1_PROTREG52_Msk (0x1UL << MPU_PROTENSET1_PROTREG52_Pos) /*!< Bit mask of PROTREG52 field. */ +#define MPU_PROTENSET1_PROTREG52_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG52_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG52_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 19 : Protection enable for region 51. */ +#define MPU_PROTENSET1_PROTREG51_Pos (19UL) /*!< Position of PROTREG51 field. */ +#define MPU_PROTENSET1_PROTREG51_Msk (0x1UL << MPU_PROTENSET1_PROTREG51_Pos) /*!< Bit mask of PROTREG51 field. */ +#define MPU_PROTENSET1_PROTREG51_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG51_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG51_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 18 : Protection enable for region 50. */ +#define MPU_PROTENSET1_PROTREG50_Pos (18UL) /*!< Position of PROTREG50 field. */ +#define MPU_PROTENSET1_PROTREG50_Msk (0x1UL << MPU_PROTENSET1_PROTREG50_Pos) /*!< Bit mask of PROTREG50 field. */ +#define MPU_PROTENSET1_PROTREG50_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG50_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG50_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 17 : Protection enable for region 49. */ +#define MPU_PROTENSET1_PROTREG49_Pos (17UL) /*!< Position of PROTREG49 field. */ +#define MPU_PROTENSET1_PROTREG49_Msk (0x1UL << MPU_PROTENSET1_PROTREG49_Pos) /*!< Bit mask of PROTREG49 field. */ +#define MPU_PROTENSET1_PROTREG49_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG49_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG49_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 16 : Protection enable for region 48. */ +#define MPU_PROTENSET1_PROTREG48_Pos (16UL) /*!< Position of PROTREG48 field. */ +#define MPU_PROTENSET1_PROTREG48_Msk (0x1UL << MPU_PROTENSET1_PROTREG48_Pos) /*!< Bit mask of PROTREG48 field. */ +#define MPU_PROTENSET1_PROTREG48_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG48_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG48_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 15 : Protection enable for region 47. */ +#define MPU_PROTENSET1_PROTREG47_Pos (15UL) /*!< Position of PROTREG47 field. */ +#define MPU_PROTENSET1_PROTREG47_Msk (0x1UL << MPU_PROTENSET1_PROTREG47_Pos) /*!< Bit mask of PROTREG47 field. */ +#define MPU_PROTENSET1_PROTREG47_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG47_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG47_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 14 : Protection enable for region 46. */ +#define MPU_PROTENSET1_PROTREG46_Pos (14UL) /*!< Position of PROTREG46 field. */ +#define MPU_PROTENSET1_PROTREG46_Msk (0x1UL << MPU_PROTENSET1_PROTREG46_Pos) /*!< Bit mask of PROTREG46 field. */ +#define MPU_PROTENSET1_PROTREG46_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG46_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG46_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 13 : Protection enable for region 45. */ +#define MPU_PROTENSET1_PROTREG45_Pos (13UL) /*!< Position of PROTREG45 field. */ +#define MPU_PROTENSET1_PROTREG45_Msk (0x1UL << MPU_PROTENSET1_PROTREG45_Pos) /*!< Bit mask of PROTREG45 field. */ +#define MPU_PROTENSET1_PROTREG45_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG45_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG45_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 12 : Protection enable for region 44. */ +#define MPU_PROTENSET1_PROTREG44_Pos (12UL) /*!< Position of PROTREG44 field. */ +#define MPU_PROTENSET1_PROTREG44_Msk (0x1UL << MPU_PROTENSET1_PROTREG44_Pos) /*!< Bit mask of PROTREG44 field. */ +#define MPU_PROTENSET1_PROTREG44_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG44_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG44_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 11 : Protection enable for region 43. */ +#define MPU_PROTENSET1_PROTREG43_Pos (11UL) /*!< Position of PROTREG43 field. */ +#define MPU_PROTENSET1_PROTREG43_Msk (0x1UL << MPU_PROTENSET1_PROTREG43_Pos) /*!< Bit mask of PROTREG43 field. */ +#define MPU_PROTENSET1_PROTREG43_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG43_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG43_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 10 : Protection enable for region 42. */ +#define MPU_PROTENSET1_PROTREG42_Pos (10UL) /*!< Position of PROTREG42 field. */ +#define MPU_PROTENSET1_PROTREG42_Msk (0x1UL << MPU_PROTENSET1_PROTREG42_Pos) /*!< Bit mask of PROTREG42 field. */ +#define MPU_PROTENSET1_PROTREG42_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG42_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG42_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 9 : Protection enable for region 41. */ +#define MPU_PROTENSET1_PROTREG41_Pos (9UL) /*!< Position of PROTREG41 field. */ +#define MPU_PROTENSET1_PROTREG41_Msk (0x1UL << MPU_PROTENSET1_PROTREG41_Pos) /*!< Bit mask of PROTREG41 field. */ +#define MPU_PROTENSET1_PROTREG41_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG41_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG41_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 8 : Protection enable for region 40. */ +#define MPU_PROTENSET1_PROTREG40_Pos (8UL) /*!< Position of PROTREG40 field. */ +#define MPU_PROTENSET1_PROTREG40_Msk (0x1UL << MPU_PROTENSET1_PROTREG40_Pos) /*!< Bit mask of PROTREG40 field. */ +#define MPU_PROTENSET1_PROTREG40_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG40_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG40_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 7 : Protection enable for region 39. */ +#define MPU_PROTENSET1_PROTREG39_Pos (7UL) /*!< Position of PROTREG39 field. */ +#define MPU_PROTENSET1_PROTREG39_Msk (0x1UL << MPU_PROTENSET1_PROTREG39_Pos) /*!< Bit mask of PROTREG39 field. */ +#define MPU_PROTENSET1_PROTREG39_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG39_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG39_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 6 : Protection enable for region 38. */ +#define MPU_PROTENSET1_PROTREG38_Pos (6UL) /*!< Position of PROTREG38 field. */ +#define MPU_PROTENSET1_PROTREG38_Msk (0x1UL << MPU_PROTENSET1_PROTREG38_Pos) /*!< Bit mask of PROTREG38 field. */ +#define MPU_PROTENSET1_PROTREG38_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG38_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG38_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 5 : Protection enable for region 37. */ +#define MPU_PROTENSET1_PROTREG37_Pos (5UL) /*!< Position of PROTREG37 field. */ +#define MPU_PROTENSET1_PROTREG37_Msk (0x1UL << MPU_PROTENSET1_PROTREG37_Pos) /*!< Bit mask of PROTREG37 field. */ +#define MPU_PROTENSET1_PROTREG37_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG37_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG37_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 4 : Protection enable for region 36. */ +#define MPU_PROTENSET1_PROTREG36_Pos (4UL) /*!< Position of PROTREG36 field. */ +#define MPU_PROTENSET1_PROTREG36_Msk (0x1UL << MPU_PROTENSET1_PROTREG36_Pos) /*!< Bit mask of PROTREG36 field. */ +#define MPU_PROTENSET1_PROTREG36_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG36_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG36_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 3 : Protection enable for region 35. */ +#define MPU_PROTENSET1_PROTREG35_Pos (3UL) /*!< Position of PROTREG35 field. */ +#define MPU_PROTENSET1_PROTREG35_Msk (0x1UL << MPU_PROTENSET1_PROTREG35_Pos) /*!< Bit mask of PROTREG35 field. */ +#define MPU_PROTENSET1_PROTREG35_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG35_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG35_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 2 : Protection enable for region 34. */ +#define MPU_PROTENSET1_PROTREG34_Pos (2UL) /*!< Position of PROTREG34 field. */ +#define MPU_PROTENSET1_PROTREG34_Msk (0x1UL << MPU_PROTENSET1_PROTREG34_Pos) /*!< Bit mask of PROTREG34 field. */ +#define MPU_PROTENSET1_PROTREG34_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG34_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG34_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 1 : Protection enable for region 33. */ +#define MPU_PROTENSET1_PROTREG33_Pos (1UL) /*!< Position of PROTREG33 field. */ +#define MPU_PROTENSET1_PROTREG33_Msk (0x1UL << MPU_PROTENSET1_PROTREG33_Pos) /*!< Bit mask of PROTREG33 field. */ +#define MPU_PROTENSET1_PROTREG33_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG33_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG33_Set (1UL) /*!< Enable protection on write. */ + +/* Bit 0 : Protection enable for region 32. */ +#define MPU_PROTENSET1_PROTREG32_Pos (0UL) /*!< Position of PROTREG32 field. */ +#define MPU_PROTENSET1_PROTREG32_Msk (0x1UL << MPU_PROTENSET1_PROTREG32_Pos) /*!< Bit mask of PROTREG32 field. */ +#define MPU_PROTENSET1_PROTREG32_Disabled (0UL) /*!< Protection disabled. */ +#define MPU_PROTENSET1_PROTREG32_Enabled (1UL) /*!< Protection enabled. */ +#define MPU_PROTENSET1_PROTREG32_Set (1UL) /*!< Enable protection on write. */ + +/* Register: MPU_DISABLEINDEBUG */ +/* Description: Disable erase and write protection mechanism in debug mode. */ + +/* Bit 0 : Disable protection mechanism in debug mode. */ +#define MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos (0UL) /*!< Position of DISABLEINDEBUG field. */ +#define MPU_DISABLEINDEBUG_DISABLEINDEBUG_Msk (0x1UL << MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos) /*!< Bit mask of DISABLEINDEBUG field. */ +#define MPU_DISABLEINDEBUG_DISABLEINDEBUG_Enabled (0UL) /*!< Protection enabled. */ +#define MPU_DISABLEINDEBUG_DISABLEINDEBUG_Disabled (1UL) /*!< Protection disabled. */ + +/* Register: MPU_PROTBLOCKSIZE */ +/* Description: Erase and write protection block size. */ + +/* Bits 1..0 : Erase and write protection block size. */ +#define MPU_PROTBLOCKSIZE_PROTBLOCKSIZE_Pos (0UL) /*!< Position of PROTBLOCKSIZE field. */ +#define MPU_PROTBLOCKSIZE_PROTBLOCKSIZE_Msk (0x3UL << MPU_PROTBLOCKSIZE_PROTBLOCKSIZE_Pos) /*!< Bit mask of PROTBLOCKSIZE field. */ +#define MPU_PROTBLOCKSIZE_PROTBLOCKSIZE_4k (0UL) /*!< Erase and write protection block size is 4k. */ + + +/* Peripheral: NVMC */ +/* Description: Non Volatile Memory Controller. */ + +/* Register: NVMC_READY */ +/* Description: Ready flag. */ + +/* Bit 0 : NVMC ready. */ +#define NVMC_READY_READY_Pos (0UL) /*!< Position of READY field. */ +#define NVMC_READY_READY_Msk (0x1UL << NVMC_READY_READY_Pos) /*!< Bit mask of READY field. */ +#define NVMC_READY_READY_Busy (0UL) /*!< NVMC is busy (on-going write or erase operation). */ +#define NVMC_READY_READY_Ready (1UL) /*!< NVMC is ready. */ + +/* Register: NVMC_CONFIG */ +/* Description: Configuration register. */ + +/* Bits 1..0 : Program write enable. */ +#define NVMC_CONFIG_WEN_Pos (0UL) /*!< Position of WEN field. */ +#define NVMC_CONFIG_WEN_Msk (0x3UL << NVMC_CONFIG_WEN_Pos) /*!< Bit mask of WEN field. */ +#define NVMC_CONFIG_WEN_Ren (0x00UL) /*!< Read only access. */ +#define NVMC_CONFIG_WEN_Wen (0x01UL) /*!< Write enabled. */ +#define NVMC_CONFIG_WEN_Een (0x02UL) /*!< Erase enabled. */ + +/* Register: NVMC_ERASEALL */ +/* Description: Register for erasing all non-volatile user memory. */ + +/* Bit 0 : Starts the erasing of all user NVM (code region 0/1 and UICR registers). */ +#define NVMC_ERASEALL_ERASEALL_Pos (0UL) /*!< Position of ERASEALL field. */ +#define NVMC_ERASEALL_ERASEALL_Msk (0x1UL << NVMC_ERASEALL_ERASEALL_Pos) /*!< Bit mask of ERASEALL field. */ +#define NVMC_ERASEALL_ERASEALL_NoOperation (0UL) /*!< No operation. */ +#define NVMC_ERASEALL_ERASEALL_Erase (1UL) /*!< Start chip erase. */ + +/* Register: NVMC_ERASEUICR */ +/* Description: Register for start erasing User Information Congfiguration Registers. */ + +/* Bit 0 : It can only be used when all contents of code region 1 are erased. */ +#define NVMC_ERASEUICR_ERASEUICR_Pos (0UL) /*!< Position of ERASEUICR field. */ +#define NVMC_ERASEUICR_ERASEUICR_Msk (0x1UL << NVMC_ERASEUICR_ERASEUICR_Pos) /*!< Bit mask of ERASEUICR field. */ +#define NVMC_ERASEUICR_ERASEUICR_NoOperation (0UL) /*!< No operation. */ +#define NVMC_ERASEUICR_ERASEUICR_Erase (1UL) /*!< Start UICR erase. */ + + +/* Peripheral: POWER */ +/* Description: Power Control. */ + +/* Register: POWER_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 2 : Enable interrupt on POFWARN event. */ +#define POWER_INTENSET_POFWARN_Pos (2UL) /*!< Position of POFWARN field. */ +#define POWER_INTENSET_POFWARN_Msk (0x1UL << POWER_INTENSET_POFWARN_Pos) /*!< Bit mask of POFWARN field. */ +#define POWER_INTENSET_POFWARN_Disabled (0UL) /*!< Interrupt disabled. */ +#define POWER_INTENSET_POFWARN_Enabled (1UL) /*!< Interrupt enabled. */ +#define POWER_INTENSET_POFWARN_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: POWER_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 2 : Disable interrupt on POFWARN event. */ +#define POWER_INTENCLR_POFWARN_Pos (2UL) /*!< Position of POFWARN field. */ +#define POWER_INTENCLR_POFWARN_Msk (0x1UL << POWER_INTENCLR_POFWARN_Pos) /*!< Bit mask of POFWARN field. */ +#define POWER_INTENCLR_POFWARN_Disabled (0UL) /*!< Interrupt disabled. */ +#define POWER_INTENCLR_POFWARN_Enabled (1UL) /*!< Interrupt enabled. */ +#define POWER_INTENCLR_POFWARN_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: POWER_RESETREAS */ +/* Description: Reset reason. */ + +/* Bit 18 : Reset from wake-up from OFF mode detected by entering into debug interface mode. */ +#define POWER_RESETREAS_DIF_Pos (18UL) /*!< Position of DIF field. */ +#define POWER_RESETREAS_DIF_Msk (0x1UL << POWER_RESETREAS_DIF_Pos) /*!< Bit mask of DIF field. */ +#define POWER_RESETREAS_DIF_NotDetected (0UL) /*!< Reset not detected. */ +#define POWER_RESETREAS_DIF_Detected (1UL) /*!< Reset detected. */ + +/* Bit 17 : Reset from wake-up from OFF mode detected by the use of ANADETECT signal from LPCOMP. */ +#define POWER_RESETREAS_LPCOMP_Pos (17UL) /*!< Position of LPCOMP field. */ +#define POWER_RESETREAS_LPCOMP_Msk (0x1UL << POWER_RESETREAS_LPCOMP_Pos) /*!< Bit mask of LPCOMP field. */ +#define POWER_RESETREAS_LPCOMP_NotDetected (0UL) /*!< Reset not detected. */ +#define POWER_RESETREAS_LPCOMP_Detected (1UL) /*!< Reset detected. */ + +/* Bit 16 : Reset from wake-up from OFF mode detected by the use of DETECT signal from GPIO. */ +#define POWER_RESETREAS_OFF_Pos (16UL) /*!< Position of OFF field. */ +#define POWER_RESETREAS_OFF_Msk (0x1UL << POWER_RESETREAS_OFF_Pos) /*!< Bit mask of OFF field. */ +#define POWER_RESETREAS_OFF_NotDetected (0UL) /*!< Reset not detected. */ +#define POWER_RESETREAS_OFF_Detected (1UL) /*!< Reset detected. */ + +/* Bit 3 : Reset from CPU lock-up detected. */ +#define POWER_RESETREAS_LOCKUP_Pos (3UL) /*!< Position of LOCKUP field. */ +#define POWER_RESETREAS_LOCKUP_Msk (0x1UL << POWER_RESETREAS_LOCKUP_Pos) /*!< Bit mask of LOCKUP field. */ +#define POWER_RESETREAS_LOCKUP_NotDetected (0UL) /*!< Reset not detected. */ +#define POWER_RESETREAS_LOCKUP_Detected (1UL) /*!< Reset detected. */ + +/* Bit 2 : Reset from AIRCR.SYSRESETREQ detected. */ +#define POWER_RESETREAS_SREQ_Pos (2UL) /*!< Position of SREQ field. */ +#define POWER_RESETREAS_SREQ_Msk (0x1UL << POWER_RESETREAS_SREQ_Pos) /*!< Bit mask of SREQ field. */ +#define POWER_RESETREAS_SREQ_NotDetected (0UL) /*!< Reset not detected. */ +#define POWER_RESETREAS_SREQ_Detected (1UL) /*!< Reset detected. */ + +/* Bit 1 : Reset from watchdog detected. */ +#define POWER_RESETREAS_DOG_Pos (1UL) /*!< Position of DOG field. */ +#define POWER_RESETREAS_DOG_Msk (0x1UL << POWER_RESETREAS_DOG_Pos) /*!< Bit mask of DOG field. */ +#define POWER_RESETREAS_DOG_NotDetected (0UL) /*!< Reset not detected. */ +#define POWER_RESETREAS_DOG_Detected (1UL) /*!< Reset detected. */ + +/* Bit 0 : Reset from pin-reset detected. */ +#define POWER_RESETREAS_RESETPIN_Pos (0UL) /*!< Position of RESETPIN field. */ +#define POWER_RESETREAS_RESETPIN_Msk (0x1UL << POWER_RESETREAS_RESETPIN_Pos) /*!< Bit mask of RESETPIN field. */ +#define POWER_RESETREAS_RESETPIN_NotDetected (0UL) /*!< Reset not detected. */ +#define POWER_RESETREAS_RESETPIN_Detected (1UL) /*!< Reset detected. */ + +/* Register: POWER_RAMSTATUS */ +/* Description: Ram status register. */ + +/* Bit 3 : RAM block 3 status. */ +#define POWER_RAMSTATUS_RAMBLOCK3_Pos (3UL) /*!< Position of RAMBLOCK3 field. */ +#define POWER_RAMSTATUS_RAMBLOCK3_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK3_Pos) /*!< Bit mask of RAMBLOCK3 field. */ +#define POWER_RAMSTATUS_RAMBLOCK3_Off (0UL) /*!< RAM block 3 is off or powering up. */ +#define POWER_RAMSTATUS_RAMBLOCK3_On (1UL) /*!< RAM block 3 is on. */ + +/* Bit 2 : RAM block 2 status. */ +#define POWER_RAMSTATUS_RAMBLOCK2_Pos (2UL) /*!< Position of RAMBLOCK2 field. */ +#define POWER_RAMSTATUS_RAMBLOCK2_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK2_Pos) /*!< Bit mask of RAMBLOCK2 field. */ +#define POWER_RAMSTATUS_RAMBLOCK2_Off (0UL) /*!< RAM block 2 is off or powering up. */ +#define POWER_RAMSTATUS_RAMBLOCK2_On (1UL) /*!< RAM block 2 is on. */ + +/* Bit 1 : RAM block 1 status. */ +#define POWER_RAMSTATUS_RAMBLOCK1_Pos (1UL) /*!< Position of RAMBLOCK1 field. */ +#define POWER_RAMSTATUS_RAMBLOCK1_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK1_Pos) /*!< Bit mask of RAMBLOCK1 field. */ +#define POWER_RAMSTATUS_RAMBLOCK1_Off (0UL) /*!< RAM block 1 is off or powering up. */ +#define POWER_RAMSTATUS_RAMBLOCK1_On (1UL) /*!< RAM block 1 is on. */ + +/* Bit 0 : RAM block 0 status. */ +#define POWER_RAMSTATUS_RAMBLOCK0_Pos (0UL) /*!< Position of RAMBLOCK0 field. */ +#define POWER_RAMSTATUS_RAMBLOCK0_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK0_Pos) /*!< Bit mask of RAMBLOCK0 field. */ +#define POWER_RAMSTATUS_RAMBLOCK0_Off (0UL) /*!< RAM block 0 is off or powering up. */ +#define POWER_RAMSTATUS_RAMBLOCK0_On (1UL) /*!< RAM block 0 is on. */ + +/* Register: POWER_SYSTEMOFF */ +/* Description: System off register. */ + +/* Bit 0 : Enter system off mode. */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Pos (0UL) /*!< Position of SYSTEMOFF field. */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Msk (0x1UL << POWER_SYSTEMOFF_SYSTEMOFF_Pos) /*!< Bit mask of SYSTEMOFF field. */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Enter (1UL) /*!< Enter system off mode. */ + +/* Register: POWER_POFCON */ +/* Description: Power failure configuration. */ + +/* Bits 2..1 : Set threshold level. */ +#define POWER_POFCON_THRESHOLD_Pos (1UL) /*!< Position of THRESHOLD field. */ +#define POWER_POFCON_THRESHOLD_Msk (0x3UL << POWER_POFCON_THRESHOLD_Pos) /*!< Bit mask of THRESHOLD field. */ +#define POWER_POFCON_THRESHOLD_V21 (0x00UL) /*!< Set threshold to 2.1Volts. */ +#define POWER_POFCON_THRESHOLD_V23 (0x01UL) /*!< Set threshold to 2.3Volts. */ +#define POWER_POFCON_THRESHOLD_V25 (0x02UL) /*!< Set threshold to 2.5Volts. */ +#define POWER_POFCON_THRESHOLD_V27 (0x03UL) /*!< Set threshold to 2.7Volts. */ + +/* Bit 0 : Power failure comparator enable. */ +#define POWER_POFCON_POF_Pos (0UL) /*!< Position of POF field. */ +#define POWER_POFCON_POF_Msk (0x1UL << POWER_POFCON_POF_Pos) /*!< Bit mask of POF field. */ +#define POWER_POFCON_POF_Disabled (0UL) /*!< Disabled. */ +#define POWER_POFCON_POF_Enabled (1UL) /*!< Enabled. */ + +/* Register: POWER_GPREGRET */ +/* Description: General purpose retention register. This register is a retained register. */ + +/* Bits 7..0 : General purpose retention register. */ +#define POWER_GPREGRET_GPREGRET_Pos (0UL) /*!< Position of GPREGRET field. */ +#define POWER_GPREGRET_GPREGRET_Msk (0xFFUL << POWER_GPREGRET_GPREGRET_Pos) /*!< Bit mask of GPREGRET field. */ + +/* Register: POWER_RAMON */ +/* Description: Ram on/off. */ + +/* Bit 17 : RAM block 1 behaviour in OFF mode. */ +#define POWER_RAMON_OFFRAM1_Pos (17UL) /*!< Position of OFFRAM1 field. */ +#define POWER_RAMON_OFFRAM1_Msk (0x1UL << POWER_RAMON_OFFRAM1_Pos) /*!< Bit mask of OFFRAM1 field. */ +#define POWER_RAMON_OFFRAM1_RAM1Off (0UL) /*!< RAM block 1 OFF in OFF mode. */ +#define POWER_RAMON_OFFRAM1_RAM1On (1UL) /*!< RAM block 1 ON in OFF mode. */ + +/* Bit 16 : RAM block 0 behaviour in OFF mode. */ +#define POWER_RAMON_OFFRAM0_Pos (16UL) /*!< Position of OFFRAM0 field. */ +#define POWER_RAMON_OFFRAM0_Msk (0x1UL << POWER_RAMON_OFFRAM0_Pos) /*!< Bit mask of OFFRAM0 field. */ +#define POWER_RAMON_OFFRAM0_RAM0Off (0UL) /*!< RAM block 0 OFF in OFF mode. */ +#define POWER_RAMON_OFFRAM0_RAM0On (1UL) /*!< RAM block 0 ON in OFF mode. */ + +/* Bit 1 : RAM block 1 behaviour in ON mode. */ +#define POWER_RAMON_ONRAM1_Pos (1UL) /*!< Position of ONRAM1 field. */ +#define POWER_RAMON_ONRAM1_Msk (0x1UL << POWER_RAMON_ONRAM1_Pos) /*!< Bit mask of ONRAM1 field. */ +#define POWER_RAMON_ONRAM1_RAM1Off (0UL) /*!< RAM block 1 OFF in ON mode. */ +#define POWER_RAMON_ONRAM1_RAM1On (1UL) /*!< RAM block 1 ON in ON mode. */ + +/* Bit 0 : RAM block 0 behaviour in ON mode. */ +#define POWER_RAMON_ONRAM0_Pos (0UL) /*!< Position of ONRAM0 field. */ +#define POWER_RAMON_ONRAM0_Msk (0x1UL << POWER_RAMON_ONRAM0_Pos) /*!< Bit mask of ONRAM0 field. */ +#define POWER_RAMON_ONRAM0_RAM0Off (0UL) /*!< RAM block 0 OFF in ON mode. */ +#define POWER_RAMON_ONRAM0_RAM0On (1UL) /*!< RAM block 0 ON in ON mode. */ + +/* Register: POWER_RESET */ +/* Description: Pin reset functionality configuration register. This register is a retained register. */ + +/* Bit 0 : Enable or disable pin reset in debug interface mode. */ +#define POWER_RESET_RESET_Pos (0UL) /*!< Position of RESET field. */ +#define POWER_RESET_RESET_Msk (0x1UL << POWER_RESET_RESET_Pos) /*!< Bit mask of RESET field. */ +#define POWER_RESET_RESET_Disabled (0UL) /*!< Pin reset in debug interface mode disabled. */ +#define POWER_RESET_RESET_Enabled (1UL) /*!< Pin reset in debug interface mode enabled. */ + +/* Register: POWER_RAMONB */ +/* Description: Ram on/off. */ + +/* Bit 17 : RAM block 3 behaviour in OFF mode. */ +#define POWER_RAMONB_OFFRAM3_Pos (17UL) /*!< Position of OFFRAM3 field. */ +#define POWER_RAMONB_OFFRAM3_Msk (0x1UL << POWER_RAMONB_OFFRAM3_Pos) /*!< Bit mask of OFFRAM3 field. */ +#define POWER_RAMONB_OFFRAM3_RAM3Off (0UL) /*!< RAM block 3 OFF in OFF mode. */ +#define POWER_RAMONB_OFFRAM3_RAM3On (1UL) /*!< RAM block 3 ON in OFF mode. */ + +/* Bit 16 : RAM block 2 behaviour in OFF mode. */ +#define POWER_RAMONB_OFFRAM2_Pos (16UL) /*!< Position of OFFRAM2 field. */ +#define POWER_RAMONB_OFFRAM2_Msk (0x1UL << POWER_RAMONB_OFFRAM2_Pos) /*!< Bit mask of OFFRAM2 field. */ +#define POWER_RAMONB_OFFRAM2_RAM2Off (0UL) /*!< RAM block 2 OFF in OFF mode. */ +#define POWER_RAMONB_OFFRAM2_RAM2On (1UL) /*!< RAM block 2 ON in OFF mode. */ + +/* Bit 1 : RAM block 3 behaviour in ON mode. */ +#define POWER_RAMONB_ONRAM3_Pos (1UL) /*!< Position of ONRAM3 field. */ +#define POWER_RAMONB_ONRAM3_Msk (0x1UL << POWER_RAMONB_ONRAM3_Pos) /*!< Bit mask of ONRAM3 field. */ +#define POWER_RAMONB_ONRAM3_RAM3Off (0UL) /*!< RAM block 33 OFF in ON mode. */ +#define POWER_RAMONB_ONRAM3_RAM3On (1UL) /*!< RAM block 3 ON in ON mode. */ + +/* Bit 0 : RAM block 2 behaviour in ON mode. */ +#define POWER_RAMONB_ONRAM2_Pos (0UL) /*!< Position of ONRAM2 field. */ +#define POWER_RAMONB_ONRAM2_Msk (0x1UL << POWER_RAMONB_ONRAM2_Pos) /*!< Bit mask of ONRAM2 field. */ +#define POWER_RAMONB_ONRAM2_RAM2Off (0UL) /*!< RAM block 2 OFF in ON mode. */ +#define POWER_RAMONB_ONRAM2_RAM2On (1UL) /*!< RAM block 2 ON in ON mode. */ + +/* Register: POWER_DCDCEN */ +/* Description: DCDC converter enable configuration register. */ + +/* Bit 0 : Enable DCDC converter. */ +#define POWER_DCDCEN_DCDCEN_Pos (0UL) /*!< Position of DCDCEN field. */ +#define POWER_DCDCEN_DCDCEN_Msk (0x1UL << POWER_DCDCEN_DCDCEN_Pos) /*!< Bit mask of DCDCEN field. */ +#define POWER_DCDCEN_DCDCEN_Disabled (0UL) /*!< DCDC converter disabled. */ +#define POWER_DCDCEN_DCDCEN_Enabled (1UL) /*!< DCDC converter enabled. */ + +/* Register: POWER_DCDCFORCE */ +/* Description: DCDC power-up force register. */ + +/* Bit 1 : DCDC power-up force on. */ +#define POWER_DCDCFORCE_FORCEON_Pos (1UL) /*!< Position of FORCEON field. */ +#define POWER_DCDCFORCE_FORCEON_Msk (0x1UL << POWER_DCDCFORCE_FORCEON_Pos) /*!< Bit mask of FORCEON field. */ +#define POWER_DCDCFORCE_FORCEON_NoForce (0UL) /*!< No force. */ +#define POWER_DCDCFORCE_FORCEON_Force (1UL) /*!< Force. */ + +/* Bit 0 : DCDC power-up force off. */ +#define POWER_DCDCFORCE_FORCEOFF_Pos (0UL) /*!< Position of FORCEOFF field. */ +#define POWER_DCDCFORCE_FORCEOFF_Msk (0x1UL << POWER_DCDCFORCE_FORCEOFF_Pos) /*!< Bit mask of FORCEOFF field. */ +#define POWER_DCDCFORCE_FORCEOFF_NoForce (0UL) /*!< No force. */ +#define POWER_DCDCFORCE_FORCEOFF_Force (1UL) /*!< Force. */ + + +/* Peripheral: PPI */ +/* Description: PPI controller. */ + +/* Register: PPI_CHEN */ +/* Description: Channel enable. */ + +/* Bit 31 : Enable PPI channel 31. */ +#define PPI_CHEN_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHEN_CH31_Msk (0x1UL << PPI_CHEN_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHEN_CH31_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH31_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 30 : Enable PPI channel 30. */ +#define PPI_CHEN_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHEN_CH30_Msk (0x1UL << PPI_CHEN_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHEN_CH30_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH30_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 29 : Enable PPI channel 29. */ +#define PPI_CHEN_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHEN_CH29_Msk (0x1UL << PPI_CHEN_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHEN_CH29_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH29_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 28 : Enable PPI channel 28. */ +#define PPI_CHEN_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHEN_CH28_Msk (0x1UL << PPI_CHEN_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHEN_CH28_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH28_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 27 : Enable PPI channel 27. */ +#define PPI_CHEN_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHEN_CH27_Msk (0x1UL << PPI_CHEN_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHEN_CH27_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH27_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 26 : Enable PPI channel 26. */ +#define PPI_CHEN_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHEN_CH26_Msk (0x1UL << PPI_CHEN_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHEN_CH26_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH26_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 25 : Enable PPI channel 25. */ +#define PPI_CHEN_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHEN_CH25_Msk (0x1UL << PPI_CHEN_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHEN_CH25_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH25_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 24 : Enable PPI channel 24. */ +#define PPI_CHEN_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHEN_CH24_Msk (0x1UL << PPI_CHEN_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHEN_CH24_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH24_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 23 : Enable PPI channel 23. */ +#define PPI_CHEN_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHEN_CH23_Msk (0x1UL << PPI_CHEN_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHEN_CH23_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH23_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 22 : Enable PPI channel 22. */ +#define PPI_CHEN_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHEN_CH22_Msk (0x1UL << PPI_CHEN_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHEN_CH22_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH22_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 21 : Enable PPI channel 21. */ +#define PPI_CHEN_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHEN_CH21_Msk (0x1UL << PPI_CHEN_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHEN_CH21_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH21_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 20 : Enable PPI channel 20. */ +#define PPI_CHEN_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHEN_CH20_Msk (0x1UL << PPI_CHEN_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHEN_CH20_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH20_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 15 : Enable PPI channel 15. */ +#define PPI_CHEN_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHEN_CH15_Msk (0x1UL << PPI_CHEN_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHEN_CH15_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH15_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 14 : Enable PPI channel 14. */ +#define PPI_CHEN_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHEN_CH14_Msk (0x1UL << PPI_CHEN_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHEN_CH14_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH14_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 13 : Enable PPI channel 13. */ +#define PPI_CHEN_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHEN_CH13_Msk (0x1UL << PPI_CHEN_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHEN_CH13_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH13_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 12 : Enable PPI channel 12. */ +#define PPI_CHEN_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHEN_CH12_Msk (0x1UL << PPI_CHEN_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHEN_CH12_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH12_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 11 : Enable PPI channel 11. */ +#define PPI_CHEN_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHEN_CH11_Msk (0x1UL << PPI_CHEN_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHEN_CH11_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH11_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 10 : Enable PPI channel 10. */ +#define PPI_CHEN_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHEN_CH10_Msk (0x1UL << PPI_CHEN_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHEN_CH10_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH10_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 9 : Enable PPI channel 9. */ +#define PPI_CHEN_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHEN_CH9_Msk (0x1UL << PPI_CHEN_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHEN_CH9_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH9_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 8 : Enable PPI channel 8. */ +#define PPI_CHEN_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHEN_CH8_Msk (0x1UL << PPI_CHEN_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHEN_CH8_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH8_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 7 : Enable PPI channel 7. */ +#define PPI_CHEN_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHEN_CH7_Msk (0x1UL << PPI_CHEN_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHEN_CH7_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH7_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 6 : Enable PPI channel 6. */ +#define PPI_CHEN_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHEN_CH6_Msk (0x1UL << PPI_CHEN_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHEN_CH6_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH6_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 5 : Enable PPI channel 5. */ +#define PPI_CHEN_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHEN_CH5_Msk (0x1UL << PPI_CHEN_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHEN_CH5_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH5_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 4 : Enable PPI channel 4. */ +#define PPI_CHEN_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHEN_CH4_Msk (0x1UL << PPI_CHEN_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHEN_CH4_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH4_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 3 : Enable PPI channel 3. */ +#define PPI_CHEN_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHEN_CH3_Msk (0x1UL << PPI_CHEN_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHEN_CH3_Disabled (0UL) /*!< Channel disabled */ +#define PPI_CHEN_CH3_Enabled (1UL) /*!< Channel enabled */ + +/* Bit 2 : Enable PPI channel 2. */ +#define PPI_CHEN_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHEN_CH2_Msk (0x1UL << PPI_CHEN_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHEN_CH2_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH2_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 1 : Enable PPI channel 1. */ +#define PPI_CHEN_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHEN_CH1_Msk (0x1UL << PPI_CHEN_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHEN_CH1_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH1_Enabled (1UL) /*!< Channel enabled. */ + +/* Bit 0 : Enable PPI channel 0. */ +#define PPI_CHEN_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHEN_CH0_Msk (0x1UL << PPI_CHEN_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHEN_CH0_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHEN_CH0_Enabled (1UL) /*!< Channel enabled. */ + +/* Register: PPI_CHENSET */ +/* Description: Channel enable set. */ + +/* Bit 31 : Enable PPI channel 31. */ +#define PPI_CHENSET_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHENSET_CH31_Msk (0x1UL << PPI_CHENSET_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHENSET_CH31_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH31_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH31_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 30 : Enable PPI channel 30. */ +#define PPI_CHENSET_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHENSET_CH30_Msk (0x1UL << PPI_CHENSET_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHENSET_CH30_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH30_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH30_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 29 : Enable PPI channel 29. */ +#define PPI_CHENSET_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHENSET_CH29_Msk (0x1UL << PPI_CHENSET_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHENSET_CH29_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH29_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH29_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 28 : Enable PPI channel 28. */ +#define PPI_CHENSET_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHENSET_CH28_Msk (0x1UL << PPI_CHENSET_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHENSET_CH28_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH28_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH28_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 27 : Enable PPI channel 27. */ +#define PPI_CHENSET_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHENSET_CH27_Msk (0x1UL << PPI_CHENSET_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHENSET_CH27_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH27_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH27_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 26 : Enable PPI channel 26. */ +#define PPI_CHENSET_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHENSET_CH26_Msk (0x1UL << PPI_CHENSET_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHENSET_CH26_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH26_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH26_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 25 : Enable PPI channel 25. */ +#define PPI_CHENSET_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHENSET_CH25_Msk (0x1UL << PPI_CHENSET_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHENSET_CH25_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH25_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH25_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 24 : Enable PPI channel 24. */ +#define PPI_CHENSET_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHENSET_CH24_Msk (0x1UL << PPI_CHENSET_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHENSET_CH24_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH24_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH24_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 23 : Enable PPI channel 23. */ +#define PPI_CHENSET_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHENSET_CH23_Msk (0x1UL << PPI_CHENSET_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHENSET_CH23_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH23_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH23_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 22 : Enable PPI channel 22. */ +#define PPI_CHENSET_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHENSET_CH22_Msk (0x1UL << PPI_CHENSET_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHENSET_CH22_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH22_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH22_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 21 : Enable PPI channel 21. */ +#define PPI_CHENSET_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHENSET_CH21_Msk (0x1UL << PPI_CHENSET_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHENSET_CH21_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH21_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH21_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 20 : Enable PPI channel 20. */ +#define PPI_CHENSET_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHENSET_CH20_Msk (0x1UL << PPI_CHENSET_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHENSET_CH20_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH20_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH20_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 15 : Enable PPI channel 15. */ +#define PPI_CHENSET_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHENSET_CH15_Msk (0x1UL << PPI_CHENSET_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHENSET_CH15_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH15_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH15_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 14 : Enable PPI channel 14. */ +#define PPI_CHENSET_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHENSET_CH14_Msk (0x1UL << PPI_CHENSET_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHENSET_CH14_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH14_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH14_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 13 : Enable PPI channel 13. */ +#define PPI_CHENSET_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHENSET_CH13_Msk (0x1UL << PPI_CHENSET_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHENSET_CH13_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH13_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH13_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 12 : Enable PPI channel 12. */ +#define PPI_CHENSET_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHENSET_CH12_Msk (0x1UL << PPI_CHENSET_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHENSET_CH12_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH12_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH12_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 11 : Enable PPI channel 11. */ +#define PPI_CHENSET_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHENSET_CH11_Msk (0x1UL << PPI_CHENSET_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHENSET_CH11_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH11_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH11_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 10 : Enable PPI channel 10. */ +#define PPI_CHENSET_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHENSET_CH10_Msk (0x1UL << PPI_CHENSET_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHENSET_CH10_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH10_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH10_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 9 : Enable PPI channel 9. */ +#define PPI_CHENSET_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHENSET_CH9_Msk (0x1UL << PPI_CHENSET_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHENSET_CH9_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH9_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH9_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 8 : Enable PPI channel 8. */ +#define PPI_CHENSET_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHENSET_CH8_Msk (0x1UL << PPI_CHENSET_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHENSET_CH8_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH8_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH8_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 7 : Enable PPI channel 7. */ +#define PPI_CHENSET_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHENSET_CH7_Msk (0x1UL << PPI_CHENSET_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHENSET_CH7_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH7_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH7_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 6 : Enable PPI channel 6. */ +#define PPI_CHENSET_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHENSET_CH6_Msk (0x1UL << PPI_CHENSET_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHENSET_CH6_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH6_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH6_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 5 : Enable PPI channel 5. */ +#define PPI_CHENSET_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHENSET_CH5_Msk (0x1UL << PPI_CHENSET_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHENSET_CH5_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH5_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH5_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 4 : Enable PPI channel 4. */ +#define PPI_CHENSET_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHENSET_CH4_Msk (0x1UL << PPI_CHENSET_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHENSET_CH4_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH4_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH4_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 3 : Enable PPI channel 3. */ +#define PPI_CHENSET_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHENSET_CH3_Msk (0x1UL << PPI_CHENSET_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHENSET_CH3_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH3_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH3_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 2 : Enable PPI channel 2. */ +#define PPI_CHENSET_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHENSET_CH2_Msk (0x1UL << PPI_CHENSET_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHENSET_CH2_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH2_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH2_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 1 : Enable PPI channel 1. */ +#define PPI_CHENSET_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHENSET_CH1_Msk (0x1UL << PPI_CHENSET_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHENSET_CH1_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH1_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH1_Set (1UL) /*!< Enable channel on write. */ + +/* Bit 0 : Enable PPI channel 0. */ +#define PPI_CHENSET_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHENSET_CH0_Msk (0x1UL << PPI_CHENSET_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHENSET_CH0_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENSET_CH0_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENSET_CH0_Set (1UL) /*!< Enable channel on write. */ + +/* Register: PPI_CHENCLR */ +/* Description: Channel enable clear. */ + +/* Bit 31 : Disable PPI channel 31. */ +#define PPI_CHENCLR_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHENCLR_CH31_Msk (0x1UL << PPI_CHENCLR_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHENCLR_CH31_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH31_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH31_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 30 : Disable PPI channel 30. */ +#define PPI_CHENCLR_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHENCLR_CH30_Msk (0x1UL << PPI_CHENCLR_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHENCLR_CH30_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH30_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH30_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 29 : Disable PPI channel 29. */ +#define PPI_CHENCLR_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHENCLR_CH29_Msk (0x1UL << PPI_CHENCLR_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHENCLR_CH29_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH29_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH29_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 28 : Disable PPI channel 28. */ +#define PPI_CHENCLR_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHENCLR_CH28_Msk (0x1UL << PPI_CHENCLR_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHENCLR_CH28_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH28_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH28_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 27 : Disable PPI channel 27. */ +#define PPI_CHENCLR_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHENCLR_CH27_Msk (0x1UL << PPI_CHENCLR_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHENCLR_CH27_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH27_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH27_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 26 : Disable PPI channel 26. */ +#define PPI_CHENCLR_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHENCLR_CH26_Msk (0x1UL << PPI_CHENCLR_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHENCLR_CH26_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH26_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH26_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 25 : Disable PPI channel 25. */ +#define PPI_CHENCLR_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHENCLR_CH25_Msk (0x1UL << PPI_CHENCLR_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHENCLR_CH25_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH25_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH25_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 24 : Disable PPI channel 24. */ +#define PPI_CHENCLR_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHENCLR_CH24_Msk (0x1UL << PPI_CHENCLR_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHENCLR_CH24_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH24_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH24_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 23 : Disable PPI channel 23. */ +#define PPI_CHENCLR_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHENCLR_CH23_Msk (0x1UL << PPI_CHENCLR_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHENCLR_CH23_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH23_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH23_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 22 : Disable PPI channel 22. */ +#define PPI_CHENCLR_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHENCLR_CH22_Msk (0x1UL << PPI_CHENCLR_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHENCLR_CH22_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH22_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH22_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 21 : Disable PPI channel 21. */ +#define PPI_CHENCLR_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHENCLR_CH21_Msk (0x1UL << PPI_CHENCLR_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHENCLR_CH21_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH21_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH21_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 20 : Disable PPI channel 20. */ +#define PPI_CHENCLR_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHENCLR_CH20_Msk (0x1UL << PPI_CHENCLR_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHENCLR_CH20_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH20_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH20_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 15 : Disable PPI channel 15. */ +#define PPI_CHENCLR_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHENCLR_CH15_Msk (0x1UL << PPI_CHENCLR_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHENCLR_CH15_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH15_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH15_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 14 : Disable PPI channel 14. */ +#define PPI_CHENCLR_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHENCLR_CH14_Msk (0x1UL << PPI_CHENCLR_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHENCLR_CH14_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH14_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH14_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 13 : Disable PPI channel 13. */ +#define PPI_CHENCLR_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHENCLR_CH13_Msk (0x1UL << PPI_CHENCLR_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHENCLR_CH13_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH13_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH13_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 12 : Disable PPI channel 12. */ +#define PPI_CHENCLR_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHENCLR_CH12_Msk (0x1UL << PPI_CHENCLR_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHENCLR_CH12_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH12_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH12_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 11 : Disable PPI channel 11. */ +#define PPI_CHENCLR_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHENCLR_CH11_Msk (0x1UL << PPI_CHENCLR_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHENCLR_CH11_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH11_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH11_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 10 : Disable PPI channel 10. */ +#define PPI_CHENCLR_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHENCLR_CH10_Msk (0x1UL << PPI_CHENCLR_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHENCLR_CH10_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH10_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH10_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 9 : Disable PPI channel 9. */ +#define PPI_CHENCLR_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHENCLR_CH9_Msk (0x1UL << PPI_CHENCLR_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHENCLR_CH9_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH9_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH9_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 8 : Disable PPI channel 8. */ +#define PPI_CHENCLR_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHENCLR_CH8_Msk (0x1UL << PPI_CHENCLR_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHENCLR_CH8_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH8_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH8_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 7 : Disable PPI channel 7. */ +#define PPI_CHENCLR_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHENCLR_CH7_Msk (0x1UL << PPI_CHENCLR_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHENCLR_CH7_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH7_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH7_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 6 : Disable PPI channel 6. */ +#define PPI_CHENCLR_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHENCLR_CH6_Msk (0x1UL << PPI_CHENCLR_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHENCLR_CH6_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH6_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH6_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 5 : Disable PPI channel 5. */ +#define PPI_CHENCLR_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHENCLR_CH5_Msk (0x1UL << PPI_CHENCLR_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHENCLR_CH5_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH5_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH5_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 4 : Disable PPI channel 4. */ +#define PPI_CHENCLR_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHENCLR_CH4_Msk (0x1UL << PPI_CHENCLR_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHENCLR_CH4_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH4_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH4_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 3 : Disable PPI channel 3. */ +#define PPI_CHENCLR_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHENCLR_CH3_Msk (0x1UL << PPI_CHENCLR_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHENCLR_CH3_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH3_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH3_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 2 : Disable PPI channel 2. */ +#define PPI_CHENCLR_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHENCLR_CH2_Msk (0x1UL << PPI_CHENCLR_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHENCLR_CH2_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH2_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH2_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 1 : Disable PPI channel 1. */ +#define PPI_CHENCLR_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHENCLR_CH1_Msk (0x1UL << PPI_CHENCLR_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHENCLR_CH1_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH1_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH1_Clear (1UL) /*!< Disable channel on write. */ + +/* Bit 0 : Disable PPI channel 0. */ +#define PPI_CHENCLR_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHENCLR_CH0_Msk (0x1UL << PPI_CHENCLR_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHENCLR_CH0_Disabled (0UL) /*!< Channel disabled. */ +#define PPI_CHENCLR_CH0_Enabled (1UL) /*!< Channel enabled. */ +#define PPI_CHENCLR_CH0_Clear (1UL) /*!< Disable channel on write. */ + +/* Register: PPI_CHG */ +/* Description: Channel group configuration. */ + +/* Bit 31 : Include CH31 in channel group. */ +#define PPI_CHG_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHG_CH31_Msk (0x1UL << PPI_CHG_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHG_CH31_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH31_Included (1UL) /*!< Channel included. */ + +/* Bit 30 : Include CH30 in channel group. */ +#define PPI_CHG_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHG_CH30_Msk (0x1UL << PPI_CHG_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHG_CH30_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH30_Included (1UL) /*!< Channel included. */ + +/* Bit 29 : Include CH29 in channel group. */ +#define PPI_CHG_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHG_CH29_Msk (0x1UL << PPI_CHG_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHG_CH29_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH29_Included (1UL) /*!< Channel included. */ + +/* Bit 28 : Include CH28 in channel group. */ +#define PPI_CHG_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHG_CH28_Msk (0x1UL << PPI_CHG_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHG_CH28_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH28_Included (1UL) /*!< Channel included. */ + +/* Bit 27 : Include CH27 in channel group. */ +#define PPI_CHG_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHG_CH27_Msk (0x1UL << PPI_CHG_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHG_CH27_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH27_Included (1UL) /*!< Channel included. */ + +/* Bit 26 : Include CH26 in channel group. */ +#define PPI_CHG_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHG_CH26_Msk (0x1UL << PPI_CHG_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHG_CH26_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH26_Included (1UL) /*!< Channel included. */ + +/* Bit 25 : Include CH25 in channel group. */ +#define PPI_CHG_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHG_CH25_Msk (0x1UL << PPI_CHG_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHG_CH25_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH25_Included (1UL) /*!< Channel included. */ + +/* Bit 24 : Include CH24 in channel group. */ +#define PPI_CHG_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHG_CH24_Msk (0x1UL << PPI_CHG_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHG_CH24_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH24_Included (1UL) /*!< Channel included. */ + +/* Bit 23 : Include CH23 in channel group. */ +#define PPI_CHG_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHG_CH23_Msk (0x1UL << PPI_CHG_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHG_CH23_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH23_Included (1UL) /*!< Channel included. */ + +/* Bit 22 : Include CH22 in channel group. */ +#define PPI_CHG_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHG_CH22_Msk (0x1UL << PPI_CHG_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHG_CH22_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH22_Included (1UL) /*!< Channel included. */ + +/* Bit 21 : Include CH21 in channel group. */ +#define PPI_CHG_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHG_CH21_Msk (0x1UL << PPI_CHG_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHG_CH21_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH21_Included (1UL) /*!< Channel included. */ + +/* Bit 20 : Include CH20 in channel group. */ +#define PPI_CHG_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHG_CH20_Msk (0x1UL << PPI_CHG_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHG_CH20_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH20_Included (1UL) /*!< Channel included. */ + +/* Bit 15 : Include CH15 in channel group. */ +#define PPI_CHG_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHG_CH15_Msk (0x1UL << PPI_CHG_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHG_CH15_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH15_Included (1UL) /*!< Channel included. */ + +/* Bit 14 : Include CH14 in channel group. */ +#define PPI_CHG_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHG_CH14_Msk (0x1UL << PPI_CHG_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHG_CH14_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH14_Included (1UL) /*!< Channel included. */ + +/* Bit 13 : Include CH13 in channel group. */ +#define PPI_CHG_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHG_CH13_Msk (0x1UL << PPI_CHG_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHG_CH13_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH13_Included (1UL) /*!< Channel included. */ + +/* Bit 12 : Include CH12 in channel group. */ +#define PPI_CHG_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHG_CH12_Msk (0x1UL << PPI_CHG_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHG_CH12_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH12_Included (1UL) /*!< Channel included. */ + +/* Bit 11 : Include CH11 in channel group. */ +#define PPI_CHG_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHG_CH11_Msk (0x1UL << PPI_CHG_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHG_CH11_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH11_Included (1UL) /*!< Channel included. */ + +/* Bit 10 : Include CH10 in channel group. */ +#define PPI_CHG_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHG_CH10_Msk (0x1UL << PPI_CHG_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHG_CH10_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH10_Included (1UL) /*!< Channel included. */ + +/* Bit 9 : Include CH9 in channel group. */ +#define PPI_CHG_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHG_CH9_Msk (0x1UL << PPI_CHG_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHG_CH9_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH9_Included (1UL) /*!< Channel included. */ + +/* Bit 8 : Include CH8 in channel group. */ +#define PPI_CHG_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHG_CH8_Msk (0x1UL << PPI_CHG_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHG_CH8_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH8_Included (1UL) /*!< Channel included. */ + +/* Bit 7 : Include CH7 in channel group. */ +#define PPI_CHG_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHG_CH7_Msk (0x1UL << PPI_CHG_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHG_CH7_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH7_Included (1UL) /*!< Channel included. */ + +/* Bit 6 : Include CH6 in channel group. */ +#define PPI_CHG_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHG_CH6_Msk (0x1UL << PPI_CHG_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHG_CH6_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH6_Included (1UL) /*!< Channel included. */ + +/* Bit 5 : Include CH5 in channel group. */ +#define PPI_CHG_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHG_CH5_Msk (0x1UL << PPI_CHG_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHG_CH5_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH5_Included (1UL) /*!< Channel included. */ + +/* Bit 4 : Include CH4 in channel group. */ +#define PPI_CHG_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHG_CH4_Msk (0x1UL << PPI_CHG_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHG_CH4_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH4_Included (1UL) /*!< Channel included. */ + +/* Bit 3 : Include CH3 in channel group. */ +#define PPI_CHG_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHG_CH3_Msk (0x1UL << PPI_CHG_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHG_CH3_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH3_Included (1UL) /*!< Channel included. */ + +/* Bit 2 : Include CH2 in channel group. */ +#define PPI_CHG_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHG_CH2_Msk (0x1UL << PPI_CHG_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHG_CH2_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH2_Included (1UL) /*!< Channel included. */ + +/* Bit 1 : Include CH1 in channel group. */ +#define PPI_CHG_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHG_CH1_Msk (0x1UL << PPI_CHG_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHG_CH1_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH1_Included (1UL) /*!< Channel included. */ + +/* Bit 0 : Include CH0 in channel group. */ +#define PPI_CHG_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHG_CH0_Msk (0x1UL << PPI_CHG_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHG_CH0_Excluded (0UL) /*!< Channel excluded. */ +#define PPI_CHG_CH0_Included (1UL) /*!< Channel included. */ + + +/* Peripheral: QDEC */ +/* Description: Rotary decoder. */ + +/* Register: QDEC_SHORTS */ +/* Description: Shortcuts for the QDEC. */ + +/* Bit 1 : Shortcut between SAMPLERDY event and STOP task. */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Pos (1UL) /*!< Position of SAMPLERDY_STOP field. */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Msk (0x1UL << QDEC_SHORTS_SAMPLERDY_STOP_Pos) /*!< Bit mask of SAMPLERDY_STOP field. */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 0 : Shortcut between REPORTRDY event and READCLRACC task. */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Pos (0UL) /*!< Position of REPORTRDY_READCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Msk (0x1UL << QDEC_SHORTS_REPORTRDY_READCLRACC_Pos) /*!< Bit mask of REPORTRDY_READCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Disabled (0UL) /*!< Shortcut disabled. */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: QDEC_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 2 : Enable interrupt on ACCOF event. */ +#define QDEC_INTENSET_ACCOF_Pos (2UL) /*!< Position of ACCOF field. */ +#define QDEC_INTENSET_ACCOF_Msk (0x1UL << QDEC_INTENSET_ACCOF_Pos) /*!< Bit mask of ACCOF field. */ +#define QDEC_INTENSET_ACCOF_Disabled (0UL) /*!< Interrupt disabled. */ +#define QDEC_INTENSET_ACCOF_Enabled (1UL) /*!< Interrupt enabled. */ +#define QDEC_INTENSET_ACCOF_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on REPORTRDY event. */ +#define QDEC_INTENSET_REPORTRDY_Pos (1UL) /*!< Position of REPORTRDY field. */ +#define QDEC_INTENSET_REPORTRDY_Msk (0x1UL << QDEC_INTENSET_REPORTRDY_Pos) /*!< Bit mask of REPORTRDY field. */ +#define QDEC_INTENSET_REPORTRDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define QDEC_INTENSET_REPORTRDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define QDEC_INTENSET_REPORTRDY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on SAMPLERDY event. */ +#define QDEC_INTENSET_SAMPLERDY_Pos (0UL) /*!< Position of SAMPLERDY field. */ +#define QDEC_INTENSET_SAMPLERDY_Msk (0x1UL << QDEC_INTENSET_SAMPLERDY_Pos) /*!< Bit mask of SAMPLERDY field. */ +#define QDEC_INTENSET_SAMPLERDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define QDEC_INTENSET_SAMPLERDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define QDEC_INTENSET_SAMPLERDY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: QDEC_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 2 : Disable interrupt on ACCOF event. */ +#define QDEC_INTENCLR_ACCOF_Pos (2UL) /*!< Position of ACCOF field. */ +#define QDEC_INTENCLR_ACCOF_Msk (0x1UL << QDEC_INTENCLR_ACCOF_Pos) /*!< Bit mask of ACCOF field. */ +#define QDEC_INTENCLR_ACCOF_Disabled (0UL) /*!< Interrupt disabled. */ +#define QDEC_INTENCLR_ACCOF_Enabled (1UL) /*!< Interrupt enabled. */ +#define QDEC_INTENCLR_ACCOF_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on REPORTRDY event. */ +#define QDEC_INTENCLR_REPORTRDY_Pos (1UL) /*!< Position of REPORTRDY field. */ +#define QDEC_INTENCLR_REPORTRDY_Msk (0x1UL << QDEC_INTENCLR_REPORTRDY_Pos) /*!< Bit mask of REPORTRDY field. */ +#define QDEC_INTENCLR_REPORTRDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define QDEC_INTENCLR_REPORTRDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define QDEC_INTENCLR_REPORTRDY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on SAMPLERDY event. */ +#define QDEC_INTENCLR_SAMPLERDY_Pos (0UL) /*!< Position of SAMPLERDY field. */ +#define QDEC_INTENCLR_SAMPLERDY_Msk (0x1UL << QDEC_INTENCLR_SAMPLERDY_Pos) /*!< Bit mask of SAMPLERDY field. */ +#define QDEC_INTENCLR_SAMPLERDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define QDEC_INTENCLR_SAMPLERDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define QDEC_INTENCLR_SAMPLERDY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: QDEC_ENABLE */ +/* Description: Enable the QDEC. */ + +/* Bit 0 : Enable or disable QDEC. */ +#define QDEC_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define QDEC_ENABLE_ENABLE_Msk (0x1UL << QDEC_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define QDEC_ENABLE_ENABLE_Disabled (0UL) /*!< Disabled QDEC. */ +#define QDEC_ENABLE_ENABLE_Enabled (1UL) /*!< Enable QDEC. */ + +/* Register: QDEC_LEDPOL */ +/* Description: LED output pin polarity. */ + +/* Bit 0 : LED output pin polarity. */ +#define QDEC_LEDPOL_LEDPOL_Pos (0UL) /*!< Position of LEDPOL field. */ +#define QDEC_LEDPOL_LEDPOL_Msk (0x1UL << QDEC_LEDPOL_LEDPOL_Pos) /*!< Bit mask of LEDPOL field. */ +#define QDEC_LEDPOL_LEDPOL_ActiveLow (0UL) /*!< LED output is active low. */ +#define QDEC_LEDPOL_LEDPOL_ActiveHigh (1UL) /*!< LED output is active high. */ + +/* Register: QDEC_SAMPLEPER */ +/* Description: Sample period. */ + +/* Bits 2..0 : Sample period. */ +#define QDEC_SAMPLEPER_SAMPLEPER_Pos (0UL) /*!< Position of SAMPLEPER field. */ +#define QDEC_SAMPLEPER_SAMPLEPER_Msk (0x7UL << QDEC_SAMPLEPER_SAMPLEPER_Pos) /*!< Bit mask of SAMPLEPER field. */ +#define QDEC_SAMPLEPER_SAMPLEPER_128us (0x00UL) /*!< 128us sample period. */ +#define QDEC_SAMPLEPER_SAMPLEPER_256us (0x01UL) /*!< 256us sample period. */ +#define QDEC_SAMPLEPER_SAMPLEPER_512us (0x02UL) /*!< 512us sample period. */ +#define QDEC_SAMPLEPER_SAMPLEPER_1024us (0x03UL) /*!< 1024us sample period. */ +#define QDEC_SAMPLEPER_SAMPLEPER_2048us (0x04UL) /*!< 2048us sample period. */ +#define QDEC_SAMPLEPER_SAMPLEPER_4096us (0x05UL) /*!< 4096us sample period. */ +#define QDEC_SAMPLEPER_SAMPLEPER_8192us (0x06UL) /*!< 8192us sample period. */ +#define QDEC_SAMPLEPER_SAMPLEPER_16384us (0x07UL) /*!< 16384us sample period. */ + +/* Register: QDEC_SAMPLE */ +/* Description: Motion sample value. */ + +/* Bits 31..0 : Last sample taken in compliment to 2. */ +#define QDEC_SAMPLE_SAMPLE_Pos (0UL) /*!< Position of SAMPLE field. */ +#define QDEC_SAMPLE_SAMPLE_Msk (0xFFFFFFFFUL << QDEC_SAMPLE_SAMPLE_Pos) /*!< Bit mask of SAMPLE field. */ + +/* Register: QDEC_REPORTPER */ +/* Description: Number of samples to generate an EVENT_REPORTRDY. */ + +/* Bits 2..0 : Number of samples to generate an EVENT_REPORTRDY. */ +#define QDEC_REPORTPER_REPORTPER_Pos (0UL) /*!< Position of REPORTPER field. */ +#define QDEC_REPORTPER_REPORTPER_Msk (0x7UL << QDEC_REPORTPER_REPORTPER_Pos) /*!< Bit mask of REPORTPER field. */ +#define QDEC_REPORTPER_REPORTPER_10Smpl (0x00UL) /*!< 10 samples per report. */ +#define QDEC_REPORTPER_REPORTPER_40Smpl (0x01UL) /*!< 40 samples per report. */ +#define QDEC_REPORTPER_REPORTPER_80Smpl (0x02UL) /*!< 80 samples per report. */ +#define QDEC_REPORTPER_REPORTPER_120Smpl (0x03UL) /*!< 120 samples per report. */ +#define QDEC_REPORTPER_REPORTPER_160Smpl (0x04UL) /*!< 160 samples per report. */ +#define QDEC_REPORTPER_REPORTPER_200Smpl (0x05UL) /*!< 200 samples per report. */ +#define QDEC_REPORTPER_REPORTPER_240Smpl (0x06UL) /*!< 240 samples per report. */ +#define QDEC_REPORTPER_REPORTPER_280Smpl (0x07UL) /*!< 280 samples per report. */ + +/* Register: QDEC_DBFEN */ +/* Description: Enable debouncer input filters. */ + +/* Bit 0 : Enable debounce input filters. */ +#define QDEC_DBFEN_DBFEN_Pos (0UL) /*!< Position of DBFEN field. */ +#define QDEC_DBFEN_DBFEN_Msk (0x1UL << QDEC_DBFEN_DBFEN_Pos) /*!< Bit mask of DBFEN field. */ +#define QDEC_DBFEN_DBFEN_Disabled (0UL) /*!< Debounce input filters disabled. */ +#define QDEC_DBFEN_DBFEN_Enabled (1UL) /*!< Debounce input filters enabled. */ + +/* Register: QDEC_LEDPRE */ +/* Description: Time LED is switched ON before the sample. */ + +/* Bits 8..0 : Period in us the LED in switched on prior to sampling. */ +#define QDEC_LEDPRE_LEDPRE_Pos (0UL) /*!< Position of LEDPRE field. */ +#define QDEC_LEDPRE_LEDPRE_Msk (0x1FFUL << QDEC_LEDPRE_LEDPRE_Pos) /*!< Bit mask of LEDPRE field. */ + +/* Register: QDEC_ACCDBL */ +/* Description: Accumulated double (error) transitions register. */ + +/* Bits 3..0 : Accumulated double (error) transitions. */ +#define QDEC_ACCDBL_ACCDBL_Pos (0UL) /*!< Position of ACCDBL field. */ +#define QDEC_ACCDBL_ACCDBL_Msk (0xFUL << QDEC_ACCDBL_ACCDBL_Pos) /*!< Bit mask of ACCDBL field. */ + +/* Register: QDEC_ACCDBLREAD */ +/* Description: Snapshot of ACCDBL register. Value generated by the TASKS_READCLEACC task. */ + +/* Bits 3..0 : Snapshot of accumulated double (error) transitions. */ +#define QDEC_ACCDBLREAD_ACCDBLREAD_Pos (0UL) /*!< Position of ACCDBLREAD field. */ +#define QDEC_ACCDBLREAD_ACCDBLREAD_Msk (0xFUL << QDEC_ACCDBLREAD_ACCDBLREAD_Pos) /*!< Bit mask of ACCDBLREAD field. */ + +/* Register: QDEC_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define QDEC_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define QDEC_POWER_POWER_Msk (0x1UL << QDEC_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define QDEC_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define QDEC_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: RADIO */ +/* Description: The radio. */ + +/* Register: RADIO_SHORTS */ +/* Description: Shortcuts for the radio. */ + +/* Bit 8 : Shortcut between DISABLED event and RSSISTOP task. */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Pos (8UL) /*!< Position of DISABLED_RSSISTOP field. */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Msk (0x1UL << RADIO_SHORTS_DISABLED_RSSISTOP_Pos) /*!< Bit mask of DISABLED_RSSISTOP field. */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 6 : Shortcut between ADDRESS event and BCSTART task. */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Pos (6UL) /*!< Position of ADDRESS_BCSTART field. */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Msk (0x1UL << RADIO_SHORTS_ADDRESS_BCSTART_Pos) /*!< Bit mask of ADDRESS_BCSTART field. */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Disabled (0UL) /*!< Shortcut disabled. */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 5 : Shortcut between END event and START task. */ +#define RADIO_SHORTS_END_START_Pos (5UL) /*!< Position of END_START field. */ +#define RADIO_SHORTS_END_START_Msk (0x1UL << RADIO_SHORTS_END_START_Pos) /*!< Bit mask of END_START field. */ +#define RADIO_SHORTS_END_START_Disabled (0UL) /*!< Shortcut disabled. */ +#define RADIO_SHORTS_END_START_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 4 : Shortcut between ADDRESS event and RSSISTART task. */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Pos (4UL) /*!< Position of ADDRESS_RSSISTART field. */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Msk (0x1UL << RADIO_SHORTS_ADDRESS_RSSISTART_Pos) /*!< Bit mask of ADDRESS_RSSISTART field. */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Disabled (0UL) /*!< Shortcut disabled. */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 3 : Shortcut between DISABLED event and RXEN task. */ +#define RADIO_SHORTS_DISABLED_RXEN_Pos (3UL) /*!< Position of DISABLED_RXEN field. */ +#define RADIO_SHORTS_DISABLED_RXEN_Msk (0x1UL << RADIO_SHORTS_DISABLED_RXEN_Pos) /*!< Bit mask of DISABLED_RXEN field. */ +#define RADIO_SHORTS_DISABLED_RXEN_Disabled (0UL) /*!< Shortcut disabled. */ +#define RADIO_SHORTS_DISABLED_RXEN_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 2 : Shortcut between DISABLED event and TXEN task. */ +#define RADIO_SHORTS_DISABLED_TXEN_Pos (2UL) /*!< Position of DISABLED_TXEN field. */ +#define RADIO_SHORTS_DISABLED_TXEN_Msk (0x1UL << RADIO_SHORTS_DISABLED_TXEN_Pos) /*!< Bit mask of DISABLED_TXEN field. */ +#define RADIO_SHORTS_DISABLED_TXEN_Disabled (0UL) /*!< Shortcut disabled. */ +#define RADIO_SHORTS_DISABLED_TXEN_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 1 : Shortcut between END event and DISABLE task. */ +#define RADIO_SHORTS_END_DISABLE_Pos (1UL) /*!< Position of END_DISABLE field. */ +#define RADIO_SHORTS_END_DISABLE_Msk (0x1UL << RADIO_SHORTS_END_DISABLE_Pos) /*!< Bit mask of END_DISABLE field. */ +#define RADIO_SHORTS_END_DISABLE_Disabled (0UL) /*!< Shortcut disabled. */ +#define RADIO_SHORTS_END_DISABLE_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 0 : Shortcut between READY event and START task. */ +#define RADIO_SHORTS_READY_START_Pos (0UL) /*!< Position of READY_START field. */ +#define RADIO_SHORTS_READY_START_Msk (0x1UL << RADIO_SHORTS_READY_START_Pos) /*!< Bit mask of READY_START field. */ +#define RADIO_SHORTS_READY_START_Disabled (0UL) /*!< Shortcut disabled. */ +#define RADIO_SHORTS_READY_START_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: RADIO_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 10 : Enable interrupt on BCMATCH event. */ +#define RADIO_INTENSET_BCMATCH_Pos (10UL) /*!< Position of BCMATCH field. */ +#define RADIO_INTENSET_BCMATCH_Msk (0x1UL << RADIO_INTENSET_BCMATCH_Pos) /*!< Bit mask of BCMATCH field. */ +#define RADIO_INTENSET_BCMATCH_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_BCMATCH_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_BCMATCH_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 7 : Enable interrupt on RSSIEND event. */ +#define RADIO_INTENSET_RSSIEND_Pos (7UL) /*!< Position of RSSIEND field. */ +#define RADIO_INTENSET_RSSIEND_Msk (0x1UL << RADIO_INTENSET_RSSIEND_Pos) /*!< Bit mask of RSSIEND field. */ +#define RADIO_INTENSET_RSSIEND_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_RSSIEND_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_RSSIEND_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 6 : Enable interrupt on DEVMISS event. */ +#define RADIO_INTENSET_DEVMISS_Pos (6UL) /*!< Position of DEVMISS field. */ +#define RADIO_INTENSET_DEVMISS_Msk (0x1UL << RADIO_INTENSET_DEVMISS_Pos) /*!< Bit mask of DEVMISS field. */ +#define RADIO_INTENSET_DEVMISS_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_DEVMISS_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_DEVMISS_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 5 : Enable interrupt on DEVMATCH event. */ +#define RADIO_INTENSET_DEVMATCH_Pos (5UL) /*!< Position of DEVMATCH field. */ +#define RADIO_INTENSET_DEVMATCH_Msk (0x1UL << RADIO_INTENSET_DEVMATCH_Pos) /*!< Bit mask of DEVMATCH field. */ +#define RADIO_INTENSET_DEVMATCH_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_DEVMATCH_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_DEVMATCH_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 4 : Enable interrupt on DISABLED event. */ +#define RADIO_INTENSET_DISABLED_Pos (4UL) /*!< Position of DISABLED field. */ +#define RADIO_INTENSET_DISABLED_Msk (0x1UL << RADIO_INTENSET_DISABLED_Pos) /*!< Bit mask of DISABLED field. */ +#define RADIO_INTENSET_DISABLED_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_DISABLED_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_DISABLED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 3 : Enable interrupt on END event. */ +#define RADIO_INTENSET_END_Pos (3UL) /*!< Position of END field. */ +#define RADIO_INTENSET_END_Msk (0x1UL << RADIO_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define RADIO_INTENSET_END_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_END_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_END_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 2 : Enable interrupt on PAYLOAD event. */ +#define RADIO_INTENSET_PAYLOAD_Pos (2UL) /*!< Position of PAYLOAD field. */ +#define RADIO_INTENSET_PAYLOAD_Msk (0x1UL << RADIO_INTENSET_PAYLOAD_Pos) /*!< Bit mask of PAYLOAD field. */ +#define RADIO_INTENSET_PAYLOAD_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_PAYLOAD_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_PAYLOAD_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on ADDRESS event. */ +#define RADIO_INTENSET_ADDRESS_Pos (1UL) /*!< Position of ADDRESS field. */ +#define RADIO_INTENSET_ADDRESS_Msk (0x1UL << RADIO_INTENSET_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ +#define RADIO_INTENSET_ADDRESS_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_ADDRESS_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_ADDRESS_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on READY event. */ +#define RADIO_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define RADIO_INTENSET_READY_Msk (0x1UL << RADIO_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define RADIO_INTENSET_READY_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENSET_READY_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENSET_READY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: RADIO_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 10 : Disable interrupt on BCMATCH event. */ +#define RADIO_INTENCLR_BCMATCH_Pos (10UL) /*!< Position of BCMATCH field. */ +#define RADIO_INTENCLR_BCMATCH_Msk (0x1UL << RADIO_INTENCLR_BCMATCH_Pos) /*!< Bit mask of BCMATCH field. */ +#define RADIO_INTENCLR_BCMATCH_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_BCMATCH_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_BCMATCH_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 7 : Disable interrupt on RSSIEND event. */ +#define RADIO_INTENCLR_RSSIEND_Pos (7UL) /*!< Position of RSSIEND field. */ +#define RADIO_INTENCLR_RSSIEND_Msk (0x1UL << RADIO_INTENCLR_RSSIEND_Pos) /*!< Bit mask of RSSIEND field. */ +#define RADIO_INTENCLR_RSSIEND_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_RSSIEND_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_RSSIEND_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 6 : Disable interrupt on DEVMISS event. */ +#define RADIO_INTENCLR_DEVMISS_Pos (6UL) /*!< Position of DEVMISS field. */ +#define RADIO_INTENCLR_DEVMISS_Msk (0x1UL << RADIO_INTENCLR_DEVMISS_Pos) /*!< Bit mask of DEVMISS field. */ +#define RADIO_INTENCLR_DEVMISS_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_DEVMISS_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_DEVMISS_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 5 : Disable interrupt on DEVMATCH event. */ +#define RADIO_INTENCLR_DEVMATCH_Pos (5UL) /*!< Position of DEVMATCH field. */ +#define RADIO_INTENCLR_DEVMATCH_Msk (0x1UL << RADIO_INTENCLR_DEVMATCH_Pos) /*!< Bit mask of DEVMATCH field. */ +#define RADIO_INTENCLR_DEVMATCH_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_DEVMATCH_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_DEVMATCH_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 4 : Disable interrupt on DISABLED event. */ +#define RADIO_INTENCLR_DISABLED_Pos (4UL) /*!< Position of DISABLED field. */ +#define RADIO_INTENCLR_DISABLED_Msk (0x1UL << RADIO_INTENCLR_DISABLED_Pos) /*!< Bit mask of DISABLED field. */ +#define RADIO_INTENCLR_DISABLED_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_DISABLED_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_DISABLED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 3 : Disable interrupt on END event. */ +#define RADIO_INTENCLR_END_Pos (3UL) /*!< Position of END field. */ +#define RADIO_INTENCLR_END_Msk (0x1UL << RADIO_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define RADIO_INTENCLR_END_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_END_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_END_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 2 : Disable interrupt on PAYLOAD event. */ +#define RADIO_INTENCLR_PAYLOAD_Pos (2UL) /*!< Position of PAYLOAD field. */ +#define RADIO_INTENCLR_PAYLOAD_Msk (0x1UL << RADIO_INTENCLR_PAYLOAD_Pos) /*!< Bit mask of PAYLOAD field. */ +#define RADIO_INTENCLR_PAYLOAD_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_PAYLOAD_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_PAYLOAD_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on ADDRESS event. */ +#define RADIO_INTENCLR_ADDRESS_Pos (1UL) /*!< Position of ADDRESS field. */ +#define RADIO_INTENCLR_ADDRESS_Msk (0x1UL << RADIO_INTENCLR_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ +#define RADIO_INTENCLR_ADDRESS_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_ADDRESS_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_ADDRESS_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on READY event. */ +#define RADIO_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define RADIO_INTENCLR_READY_Msk (0x1UL << RADIO_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define RADIO_INTENCLR_READY_Disabled (0UL) /*!< Interrupt disabled. */ +#define RADIO_INTENCLR_READY_Enabled (1UL) /*!< Interrupt enabled. */ +#define RADIO_INTENCLR_READY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: RADIO_CRCSTATUS */ +/* Description: CRC status of received packet. */ + +/* Bit 0 : CRC status of received packet. */ +#define RADIO_CRCSTATUS_CRCSTATUS_Pos (0UL) /*!< Position of CRCSTATUS field. */ +#define RADIO_CRCSTATUS_CRCSTATUS_Msk (0x1UL << RADIO_CRCSTATUS_CRCSTATUS_Pos) /*!< Bit mask of CRCSTATUS field. */ +#define RADIO_CRCSTATUS_CRCSTATUS_CRCError (0UL) /*!< Packet received with CRC error. */ +#define RADIO_CRCSTATUS_CRCSTATUS_CRCOk (1UL) /*!< Packet received with CRC ok. */ + +/* Register: RADIO_RXMATCH */ +/* Description: Received address. */ + +/* Bits 2..0 : Logical address in which previous packet was received. */ +#define RADIO_RXMATCH_RXMATCH_Pos (0UL) /*!< Position of RXMATCH field. */ +#define RADIO_RXMATCH_RXMATCH_Msk (0x7UL << RADIO_RXMATCH_RXMATCH_Pos) /*!< Bit mask of RXMATCH field. */ + +/* Register: RADIO_RXCRC */ +/* Description: Received CRC. */ + +/* Bits 23..0 : CRC field of previously received packet. */ +#define RADIO_RXCRC_RXCRC_Pos (0UL) /*!< Position of RXCRC field. */ +#define RADIO_RXCRC_RXCRC_Msk (0xFFFFFFUL << RADIO_RXCRC_RXCRC_Pos) /*!< Bit mask of RXCRC field. */ + +/* Register: RADIO_DAI */ +/* Description: Device address match index. */ + +/* Bits 2..0 : Index (n) of device address (see DAB[n] and DAP[n]) that obtained an address match. */ +#define RADIO_DAI_DAI_Pos (0UL) /*!< Position of DAI field. */ +#define RADIO_DAI_DAI_Msk (0x7UL << RADIO_DAI_DAI_Pos) /*!< Bit mask of DAI field. */ + +/* Register: RADIO_FREQUENCY */ +/* Description: Frequency. */ + +/* Bits 6..0 : Radio channel frequency offset in MHz: RF Frequency = 2400 + FREQUENCY (MHz). Decision point: TXEN or RXEN task. */ +#define RADIO_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define RADIO_FREQUENCY_FREQUENCY_Msk (0x7FUL << RADIO_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ + +/* Register: RADIO_TXPOWER */ +/* Description: Output power. */ + +/* Bits 7..0 : Radio output power. Decision point: TXEN task. */ +#define RADIO_TXPOWER_TXPOWER_Pos (0UL) /*!< Position of TXPOWER field. */ +#define RADIO_TXPOWER_TXPOWER_Msk (0xFFUL << RADIO_TXPOWER_TXPOWER_Pos) /*!< Bit mask of TXPOWER field. */ +#define RADIO_TXPOWER_TXPOWER_0dBm (0x00UL) /*!< 0dBm. */ +#define RADIO_TXPOWER_TXPOWER_Pos4dBm (0x04UL) /*!< +4dBm. */ +#define RADIO_TXPOWER_TXPOWER_Neg30dBm (0xD8UL) /*!< -30dBm. */ +#define RADIO_TXPOWER_TXPOWER_Neg20dBm (0xECUL) /*!< -20dBm. */ +#define RADIO_TXPOWER_TXPOWER_Neg16dBm (0xF0UL) /*!< -16dBm. */ +#define RADIO_TXPOWER_TXPOWER_Neg12dBm (0xF4UL) /*!< -12dBm. */ +#define RADIO_TXPOWER_TXPOWER_Neg8dBm (0xF8UL) /*!< -8dBm. */ +#define RADIO_TXPOWER_TXPOWER_Neg4dBm (0xFCUL) /*!< -4dBm. */ + +/* Register: RADIO_MODE */ +/* Description: Data rate and modulation. */ + +/* Bits 1..0 : Radio data rate and modulation setting. Decision point: TXEN or RXEN task. */ +#define RADIO_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define RADIO_MODE_MODE_Msk (0x3UL << RADIO_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define RADIO_MODE_MODE_Nrf_1Mbit (0x00UL) /*!< 1Mbit/s Nordic propietary radio mode. */ +#define RADIO_MODE_MODE_Nrf_2Mbit (0x01UL) /*!< 2Mbit/s Nordic propietary radio mode. */ +#define RADIO_MODE_MODE_Nrf_250Kbit (0x02UL) /*!< 250kbit/s Nordic propietary radio mode. */ +#define RADIO_MODE_MODE_Ble_1Mbit (0x03UL) /*!< 1Mbit/s Bluetooth Low Energy */ + +/* Register: RADIO_PCNF0 */ +/* Description: Packet configuration 0. */ + +/* Bits 19..16 : Length of S1 field in number of bits. Decision point: START task. */ +#define RADIO_PCNF0_S1LEN_Pos (16UL) /*!< Position of S1LEN field. */ +#define RADIO_PCNF0_S1LEN_Msk (0xFUL << RADIO_PCNF0_S1LEN_Pos) /*!< Bit mask of S1LEN field. */ + +/* Bit 8 : Length of S0 field in number of bytes. Decision point: START task. */ +#define RADIO_PCNF0_S0LEN_Pos (8UL) /*!< Position of S0LEN field. */ +#define RADIO_PCNF0_S0LEN_Msk (0x1UL << RADIO_PCNF0_S0LEN_Pos) /*!< Bit mask of S0LEN field. */ + +/* Bits 3..0 : Length of length field in number of bits. Decision point: START task. */ +#define RADIO_PCNF0_LFLEN_Pos (0UL) /*!< Position of LFLEN field. */ +#define RADIO_PCNF0_LFLEN_Msk (0xFUL << RADIO_PCNF0_LFLEN_Pos) /*!< Bit mask of LFLEN field. */ + +/* Register: RADIO_PCNF1 */ +/* Description: Packet configuration 1. */ + +/* Bit 25 : Packet whitening enable. */ +#define RADIO_PCNF1_WHITEEN_Pos (25UL) /*!< Position of WHITEEN field. */ +#define RADIO_PCNF1_WHITEEN_Msk (0x1UL << RADIO_PCNF1_WHITEEN_Pos) /*!< Bit mask of WHITEEN field. */ +#define RADIO_PCNF1_WHITEEN_Disabled (0UL) /*!< Whitening disabled. */ +#define RADIO_PCNF1_WHITEEN_Enabled (1UL) /*!< Whitening enabled. */ + +/* Bit 24 : On air endianness of packet length field. Decision point: START task. */ +#define RADIO_PCNF1_ENDIAN_Pos (24UL) /*!< Position of ENDIAN field. */ +#define RADIO_PCNF1_ENDIAN_Msk (0x1UL << RADIO_PCNF1_ENDIAN_Pos) /*!< Bit mask of ENDIAN field. */ +#define RADIO_PCNF1_ENDIAN_Little (0UL) /*!< Least significant bit on air first */ +#define RADIO_PCNF1_ENDIAN_Big (1UL) /*!< Most significant bit on air first */ + +/* Bits 18..16 : Base address length in number of bytes. Decision point: START task. */ +#define RADIO_PCNF1_BALEN_Pos (16UL) /*!< Position of BALEN field. */ +#define RADIO_PCNF1_BALEN_Msk (0x7UL << RADIO_PCNF1_BALEN_Pos) /*!< Bit mask of BALEN field. */ + +/* Bits 15..8 : Static length in number of bytes. Decision point: START task. */ +#define RADIO_PCNF1_STATLEN_Pos (8UL) /*!< Position of STATLEN field. */ +#define RADIO_PCNF1_STATLEN_Msk (0xFFUL << RADIO_PCNF1_STATLEN_Pos) /*!< Bit mask of STATLEN field. */ + +/* Bits 7..0 : Maximum length of packet payload in number of bytes. */ +#define RADIO_PCNF1_MAXLEN_Pos (0UL) /*!< Position of MAXLEN field. */ +#define RADIO_PCNF1_MAXLEN_Msk (0xFFUL << RADIO_PCNF1_MAXLEN_Pos) /*!< Bit mask of MAXLEN field. */ + +/* Register: RADIO_PREFIX0 */ +/* Description: Prefixes bytes for logical addresses 0 to 3. */ + +/* Bits 31..24 : Address prefix 3. Decision point: START task. */ +#define RADIO_PREFIX0_AP3_Pos (24UL) /*!< Position of AP3 field. */ +#define RADIO_PREFIX0_AP3_Msk (0xFFUL << RADIO_PREFIX0_AP3_Pos) /*!< Bit mask of AP3 field. */ + +/* Bits 23..16 : Address prefix 2. Decision point: START task. */ +#define RADIO_PREFIX0_AP2_Pos (16UL) /*!< Position of AP2 field. */ +#define RADIO_PREFIX0_AP2_Msk (0xFFUL << RADIO_PREFIX0_AP2_Pos) /*!< Bit mask of AP2 field. */ + +/* Bits 15..8 : Address prefix 1. Decision point: START task. */ +#define RADIO_PREFIX0_AP1_Pos (8UL) /*!< Position of AP1 field. */ +#define RADIO_PREFIX0_AP1_Msk (0xFFUL << RADIO_PREFIX0_AP1_Pos) /*!< Bit mask of AP1 field. */ + +/* Bits 7..0 : Address prefix 0. Decision point: START task. */ +#define RADIO_PREFIX0_AP0_Pos (0UL) /*!< Position of AP0 field. */ +#define RADIO_PREFIX0_AP0_Msk (0xFFUL << RADIO_PREFIX0_AP0_Pos) /*!< Bit mask of AP0 field. */ + +/* Register: RADIO_PREFIX1 */ +/* Description: Prefixes bytes for logical addresses 4 to 7. */ + +/* Bits 31..24 : Address prefix 7. Decision point: START task. */ +#define RADIO_PREFIX1_AP7_Pos (24UL) /*!< Position of AP7 field. */ +#define RADIO_PREFIX1_AP7_Msk (0xFFUL << RADIO_PREFIX1_AP7_Pos) /*!< Bit mask of AP7 field. */ + +/* Bits 23..16 : Address prefix 6. Decision point: START task. */ +#define RADIO_PREFIX1_AP6_Pos (16UL) /*!< Position of AP6 field. */ +#define RADIO_PREFIX1_AP6_Msk (0xFFUL << RADIO_PREFIX1_AP6_Pos) /*!< Bit mask of AP6 field. */ + +/* Bits 15..8 : Address prefix 5. Decision point: START task. */ +#define RADIO_PREFIX1_AP5_Pos (8UL) /*!< Position of AP5 field. */ +#define RADIO_PREFIX1_AP5_Msk (0xFFUL << RADIO_PREFIX1_AP5_Pos) /*!< Bit mask of AP5 field. */ + +/* Bits 7..0 : Address prefix 4. Decision point: START task. */ +#define RADIO_PREFIX1_AP4_Pos (0UL) /*!< Position of AP4 field. */ +#define RADIO_PREFIX1_AP4_Msk (0xFFUL << RADIO_PREFIX1_AP4_Pos) /*!< Bit mask of AP4 field. */ + +/* Register: RADIO_TXADDRESS */ +/* Description: Transmit address select. */ + +/* Bits 2..0 : Logical address to be used when transmitting a packet. Decision point: START task. */ +#define RADIO_TXADDRESS_TXADDRESS_Pos (0UL) /*!< Position of TXADDRESS field. */ +#define RADIO_TXADDRESS_TXADDRESS_Msk (0x7UL << RADIO_TXADDRESS_TXADDRESS_Pos) /*!< Bit mask of TXADDRESS field. */ + +/* Register: RADIO_RXADDRESSES */ +/* Description: Receive address select. */ + +/* Bit 7 : Enable reception on logical address 7. Decision point: START task. */ +#define RADIO_RXADDRESSES_ADDR7_Pos (7UL) /*!< Position of ADDR7 field. */ +#define RADIO_RXADDRESSES_ADDR7_Msk (0x1UL << RADIO_RXADDRESSES_ADDR7_Pos) /*!< Bit mask of ADDR7 field. */ +#define RADIO_RXADDRESSES_ADDR7_Disabled (0UL) /*!< Reception disabled. */ +#define RADIO_RXADDRESSES_ADDR7_Enabled (1UL) /*!< Reception enabled. */ + +/* Bit 6 : Enable reception on logical address 6. Decision point: START task. */ +#define RADIO_RXADDRESSES_ADDR6_Pos (6UL) /*!< Position of ADDR6 field. */ +#define RADIO_RXADDRESSES_ADDR6_Msk (0x1UL << RADIO_RXADDRESSES_ADDR6_Pos) /*!< Bit mask of ADDR6 field. */ +#define RADIO_RXADDRESSES_ADDR6_Disabled (0UL) /*!< Reception disabled. */ +#define RADIO_RXADDRESSES_ADDR6_Enabled (1UL) /*!< Reception enabled. */ + +/* Bit 5 : Enable reception on logical address 5. Decision point: START task. */ +#define RADIO_RXADDRESSES_ADDR5_Pos (5UL) /*!< Position of ADDR5 field. */ +#define RADIO_RXADDRESSES_ADDR5_Msk (0x1UL << RADIO_RXADDRESSES_ADDR5_Pos) /*!< Bit mask of ADDR5 field. */ +#define RADIO_RXADDRESSES_ADDR5_Disabled (0UL) /*!< Reception disabled. */ +#define RADIO_RXADDRESSES_ADDR5_Enabled (1UL) /*!< Reception enabled. */ + +/* Bit 4 : Enable reception on logical address 4. Decision point: START task. */ +#define RADIO_RXADDRESSES_ADDR4_Pos (4UL) /*!< Position of ADDR4 field. */ +#define RADIO_RXADDRESSES_ADDR4_Msk (0x1UL << RADIO_RXADDRESSES_ADDR4_Pos) /*!< Bit mask of ADDR4 field. */ +#define RADIO_RXADDRESSES_ADDR4_Disabled (0UL) /*!< Reception disabled. */ +#define RADIO_RXADDRESSES_ADDR4_Enabled (1UL) /*!< Reception enabled. */ + +/* Bit 3 : Enable reception on logical address 3. Decision point: START task. */ +#define RADIO_RXADDRESSES_ADDR3_Pos (3UL) /*!< Position of ADDR3 field. */ +#define RADIO_RXADDRESSES_ADDR3_Msk (0x1UL << RADIO_RXADDRESSES_ADDR3_Pos) /*!< Bit mask of ADDR3 field. */ +#define RADIO_RXADDRESSES_ADDR3_Disabled (0UL) /*!< Reception disabled. */ +#define RADIO_RXADDRESSES_ADDR3_Enabled (1UL) /*!< Reception enabled. */ + +/* Bit 2 : Enable reception on logical address 2. Decision point: START task. */ +#define RADIO_RXADDRESSES_ADDR2_Pos (2UL) /*!< Position of ADDR2 field. */ +#define RADIO_RXADDRESSES_ADDR2_Msk (0x1UL << RADIO_RXADDRESSES_ADDR2_Pos) /*!< Bit mask of ADDR2 field. */ +#define RADIO_RXADDRESSES_ADDR2_Disabled (0UL) /*!< Reception disabled. */ +#define RADIO_RXADDRESSES_ADDR2_Enabled (1UL) /*!< Reception enabled. */ + +/* Bit 1 : Enable reception on logical address 1. Decision point: START task. */ +#define RADIO_RXADDRESSES_ADDR1_Pos (1UL) /*!< Position of ADDR1 field. */ +#define RADIO_RXADDRESSES_ADDR1_Msk (0x1UL << RADIO_RXADDRESSES_ADDR1_Pos) /*!< Bit mask of ADDR1 field. */ +#define RADIO_RXADDRESSES_ADDR1_Disabled (0UL) /*!< Reception disabled. */ +#define RADIO_RXADDRESSES_ADDR1_Enabled (1UL) /*!< Reception enabled. */ + +/* Bit 0 : Enable reception on logical address 0. Decision point: START task. */ +#define RADIO_RXADDRESSES_ADDR0_Pos (0UL) /*!< Position of ADDR0 field. */ +#define RADIO_RXADDRESSES_ADDR0_Msk (0x1UL << RADIO_RXADDRESSES_ADDR0_Pos) /*!< Bit mask of ADDR0 field. */ +#define RADIO_RXADDRESSES_ADDR0_Disabled (0UL) /*!< Reception disabled. */ +#define RADIO_RXADDRESSES_ADDR0_Enabled (1UL) /*!< Reception enabled. */ + +/* Register: RADIO_CRCCNF */ +/* Description: CRC configuration. */ + +/* Bit 8 : Leave packet address field out of the CRC calculation. Decision point: START task. */ +#define RADIO_CRCCNF_SKIPADDR_Pos (8UL) /*!< Position of SKIPADDR field. */ +#define RADIO_CRCCNF_SKIPADDR_Msk (0x1UL << RADIO_CRCCNF_SKIPADDR_Pos) /*!< Bit mask of SKIPADDR field. */ +#define RADIO_CRCCNF_SKIPADDR_Include (0UL) /*!< Include packet address in CRC calculation. */ +#define RADIO_CRCCNF_SKIPADDR_Skip (1UL) /*!< Packet address is skipped in CRC calculation. The CRC calculation will start at the first byte after the address. */ + +/* Bits 1..0 : CRC length. Decision point: START task. */ +#define RADIO_CRCCNF_LEN_Pos (0UL) /*!< Position of LEN field. */ +#define RADIO_CRCCNF_LEN_Msk (0x3UL << RADIO_CRCCNF_LEN_Pos) /*!< Bit mask of LEN field. */ +#define RADIO_CRCCNF_LEN_Disabled (0UL) /*!< CRC calculation disabled. */ +#define RADIO_CRCCNF_LEN_One (1UL) /*!< One byte long CRC. */ +#define RADIO_CRCCNF_LEN_Two (2UL) /*!< Two bytes long CRC. */ +#define RADIO_CRCCNF_LEN_Three (3UL) /*!< Three bytes long CRC. */ + +/* Register: RADIO_CRCPOLY */ +/* Description: CRC polynomial. */ + +/* Bits 23..0 : CRC polynomial. Decision point: START task. */ +#define RADIO_CRCPOLY_CRCPOLY_Pos (0UL) /*!< Position of CRCPOLY field. */ +#define RADIO_CRCPOLY_CRCPOLY_Msk (0xFFFFFFUL << RADIO_CRCPOLY_CRCPOLY_Pos) /*!< Bit mask of CRCPOLY field. */ + +/* Register: RADIO_CRCINIT */ +/* Description: CRC initial value. */ + +/* Bits 23..0 : Initial value for CRC calculation. Decision point: START task. */ +#define RADIO_CRCINIT_CRCINIT_Pos (0UL) /*!< Position of CRCINIT field. */ +#define RADIO_CRCINIT_CRCINIT_Msk (0xFFFFFFUL << RADIO_CRCINIT_CRCINIT_Pos) /*!< Bit mask of CRCINIT field. */ + +/* Register: RADIO_TEST */ +/* Description: Test features enable register. */ + +/* Bit 1 : PLL lock. Decision point: TXEN or RXEN task. */ +#define RADIO_TEST_PLLLOCK_Pos (1UL) /*!< Position of PLLLOCK field. */ +#define RADIO_TEST_PLLLOCK_Msk (0x1UL << RADIO_TEST_PLLLOCK_Pos) /*!< Bit mask of PLLLOCK field. */ +#define RADIO_TEST_PLLLOCK_Disabled (0UL) /*!< PLL lock disabled. */ +#define RADIO_TEST_PLLLOCK_Enabled (1UL) /*!< PLL lock enabled. */ + +/* Bit 0 : Constant carrier. Decision point: TXEN task. */ +#define RADIO_TEST_CONSTCARRIER_Pos (0UL) /*!< Position of CONSTCARRIER field. */ +#define RADIO_TEST_CONSTCARRIER_Msk (0x1UL << RADIO_TEST_CONSTCARRIER_Pos) /*!< Bit mask of CONSTCARRIER field. */ +#define RADIO_TEST_CONSTCARRIER_Disabled (0UL) /*!< Constant carrier disabled. */ +#define RADIO_TEST_CONSTCARRIER_Enabled (1UL) /*!< Constant carrier enabled. */ + +/* Register: RADIO_TIFS */ +/* Description: Inter Frame Spacing in microseconds. */ + +/* Bits 7..0 : Inter frame spacing in microseconds. Decision point: START rask */ +#define RADIO_TIFS_TIFS_Pos (0UL) /*!< Position of TIFS field. */ +#define RADIO_TIFS_TIFS_Msk (0xFFUL << RADIO_TIFS_TIFS_Pos) /*!< Bit mask of TIFS field. */ + +/* Register: RADIO_RSSISAMPLE */ +/* Description: RSSI sample. */ + +/* Bits 6..0 : RSSI sample result. The result is read as a positive value so that ReceivedSignalStrength = -RSSISAMPLE dBm */ +#define RADIO_RSSISAMPLE_RSSISAMPLE_Pos (0UL) /*!< Position of RSSISAMPLE field. */ +#define RADIO_RSSISAMPLE_RSSISAMPLE_Msk (0x7FUL << RADIO_RSSISAMPLE_RSSISAMPLE_Pos) /*!< Bit mask of RSSISAMPLE field. */ + +/* Register: RADIO_STATE */ +/* Description: Current radio state. */ + +/* Bits 3..0 : Current radio state. */ +#define RADIO_STATE_STATE_Pos (0UL) /*!< Position of STATE field. */ +#define RADIO_STATE_STATE_Msk (0xFUL << RADIO_STATE_STATE_Pos) /*!< Bit mask of STATE field. */ +#define RADIO_STATE_STATE_Disabled (0x00UL) /*!< Radio is in the Disabled state. */ +#define RADIO_STATE_STATE_RxRu (0x01UL) /*!< Radio is in the Rx Ramp Up state. */ +#define RADIO_STATE_STATE_RxIdle (0x02UL) /*!< Radio is in the Rx Idle state. */ +#define RADIO_STATE_STATE_Rx (0x03UL) /*!< Radio is in the Rx state. */ +#define RADIO_STATE_STATE_RxDisable (0x04UL) /*!< Radio is in the Rx Disable state. */ +#define RADIO_STATE_STATE_TxRu (0x09UL) /*!< Radio is in the Tx Ramp Up state. */ +#define RADIO_STATE_STATE_TxIdle (0x0AUL) /*!< Radio is in the Tx Idle state. */ +#define RADIO_STATE_STATE_Tx (0x0BUL) /*!< Radio is in the Tx state. */ +#define RADIO_STATE_STATE_TxDisable (0x0CUL) /*!< Radio is in the Tx Disable state. */ + +/* Register: RADIO_DATAWHITEIV */ +/* Description: Data whitening initial value. */ + +/* Bits 6..0 : Data whitening initial value. Bit 0 corresponds to Position 0 of the LSFR, Bit 1 to position 5... Decision point: TXEN or RXEN task. */ +#define RADIO_DATAWHITEIV_DATAWHITEIV_Pos (0UL) /*!< Position of DATAWHITEIV field. */ +#define RADIO_DATAWHITEIV_DATAWHITEIV_Msk (0x7FUL << RADIO_DATAWHITEIV_DATAWHITEIV_Pos) /*!< Bit mask of DATAWHITEIV field. */ + +/* Register: RADIO_DAP */ +/* Description: Device address prefix. */ + +/* Bits 15..0 : Device address prefix. */ +#define RADIO_DAP_DAP_Pos (0UL) /*!< Position of DAP field. */ +#define RADIO_DAP_DAP_Msk (0xFFFFUL << RADIO_DAP_DAP_Pos) /*!< Bit mask of DAP field. */ + +/* Register: RADIO_DACNF */ +/* Description: Device address match configuration. */ + +/* Bit 15 : TxAdd for device address 7. */ +#define RADIO_DACNF_TXADD7_Pos (15UL) /*!< Position of TXADD7 field. */ +#define RADIO_DACNF_TXADD7_Msk (0x1UL << RADIO_DACNF_TXADD7_Pos) /*!< Bit mask of TXADD7 field. */ + +/* Bit 14 : TxAdd for device address 6. */ +#define RADIO_DACNF_TXADD6_Pos (14UL) /*!< Position of TXADD6 field. */ +#define RADIO_DACNF_TXADD6_Msk (0x1UL << RADIO_DACNF_TXADD6_Pos) /*!< Bit mask of TXADD6 field. */ + +/* Bit 13 : TxAdd for device address 5. */ +#define RADIO_DACNF_TXADD5_Pos (13UL) /*!< Position of TXADD5 field. */ +#define RADIO_DACNF_TXADD5_Msk (0x1UL << RADIO_DACNF_TXADD5_Pos) /*!< Bit mask of TXADD5 field. */ + +/* Bit 12 : TxAdd for device address 4. */ +#define RADIO_DACNF_TXADD4_Pos (12UL) /*!< Position of TXADD4 field. */ +#define RADIO_DACNF_TXADD4_Msk (0x1UL << RADIO_DACNF_TXADD4_Pos) /*!< Bit mask of TXADD4 field. */ + +/* Bit 11 : TxAdd for device address 3. */ +#define RADIO_DACNF_TXADD3_Pos (11UL) /*!< Position of TXADD3 field. */ +#define RADIO_DACNF_TXADD3_Msk (0x1UL << RADIO_DACNF_TXADD3_Pos) /*!< Bit mask of TXADD3 field. */ + +/* Bit 10 : TxAdd for device address 2. */ +#define RADIO_DACNF_TXADD2_Pos (10UL) /*!< Position of TXADD2 field. */ +#define RADIO_DACNF_TXADD2_Msk (0x1UL << RADIO_DACNF_TXADD2_Pos) /*!< Bit mask of TXADD2 field. */ + +/* Bit 9 : TxAdd for device address 1. */ +#define RADIO_DACNF_TXADD1_Pos (9UL) /*!< Position of TXADD1 field. */ +#define RADIO_DACNF_TXADD1_Msk (0x1UL << RADIO_DACNF_TXADD1_Pos) /*!< Bit mask of TXADD1 field. */ + +/* Bit 8 : TxAdd for device address 0. */ +#define RADIO_DACNF_TXADD0_Pos (8UL) /*!< Position of TXADD0 field. */ +#define RADIO_DACNF_TXADD0_Msk (0x1UL << RADIO_DACNF_TXADD0_Pos) /*!< Bit mask of TXADD0 field. */ + +/* Bit 7 : Enable or disable device address matching using device address 7. */ +#define RADIO_DACNF_ENA7_Pos (7UL) /*!< Position of ENA7 field. */ +#define RADIO_DACNF_ENA7_Msk (0x1UL << RADIO_DACNF_ENA7_Pos) /*!< Bit mask of ENA7 field. */ +#define RADIO_DACNF_ENA7_Disabled (0UL) /*!< Disabled. */ +#define RADIO_DACNF_ENA7_Enabled (1UL) /*!< Enabled. */ + +/* Bit 6 : Enable or disable device address matching using device address 6. */ +#define RADIO_DACNF_ENA6_Pos (6UL) /*!< Position of ENA6 field. */ +#define RADIO_DACNF_ENA6_Msk (0x1UL << RADIO_DACNF_ENA6_Pos) /*!< Bit mask of ENA6 field. */ +#define RADIO_DACNF_ENA6_Disabled (0UL) /*!< Disabled. */ +#define RADIO_DACNF_ENA6_Enabled (1UL) /*!< Enabled. */ + +/* Bit 5 : Enable or disable device address matching using device address 5. */ +#define RADIO_DACNF_ENA5_Pos (5UL) /*!< Position of ENA5 field. */ +#define RADIO_DACNF_ENA5_Msk (0x1UL << RADIO_DACNF_ENA5_Pos) /*!< Bit mask of ENA5 field. */ +#define RADIO_DACNF_ENA5_Disabled (0UL) /*!< Disabled. */ +#define RADIO_DACNF_ENA5_Enabled (1UL) /*!< Enabled. */ + +/* Bit 4 : Enable or disable device address matching using device address 4. */ +#define RADIO_DACNF_ENA4_Pos (4UL) /*!< Position of ENA4 field. */ +#define RADIO_DACNF_ENA4_Msk (0x1UL << RADIO_DACNF_ENA4_Pos) /*!< Bit mask of ENA4 field. */ +#define RADIO_DACNF_ENA4_Disabled (0UL) /*!< Disabled. */ +#define RADIO_DACNF_ENA4_Enabled (1UL) /*!< Enabled. */ + +/* Bit 3 : Enable or disable device address matching using device address 3. */ +#define RADIO_DACNF_ENA3_Pos (3UL) /*!< Position of ENA3 field. */ +#define RADIO_DACNF_ENA3_Msk (0x1UL << RADIO_DACNF_ENA3_Pos) /*!< Bit mask of ENA3 field. */ +#define RADIO_DACNF_ENA3_Disabled (0UL) /*!< Disabled. */ +#define RADIO_DACNF_ENA3_Enabled (1UL) /*!< Enabled. */ + +/* Bit 2 : Enable or disable device address matching using device address 2. */ +#define RADIO_DACNF_ENA2_Pos (2UL) /*!< Position of ENA2 field. */ +#define RADIO_DACNF_ENA2_Msk (0x1UL << RADIO_DACNF_ENA2_Pos) /*!< Bit mask of ENA2 field. */ +#define RADIO_DACNF_ENA2_Disabled (0UL) /*!< Disabled. */ +#define RADIO_DACNF_ENA2_Enabled (1UL) /*!< Enabled. */ + +/* Bit 1 : Enable or disable device address matching using device address 1. */ +#define RADIO_DACNF_ENA1_Pos (1UL) /*!< Position of ENA1 field. */ +#define RADIO_DACNF_ENA1_Msk (0x1UL << RADIO_DACNF_ENA1_Pos) /*!< Bit mask of ENA1 field. */ +#define RADIO_DACNF_ENA1_Disabled (0UL) /*!< Disabled. */ +#define RADIO_DACNF_ENA1_Enabled (1UL) /*!< Enabled. */ + +/* Bit 0 : Enable or disable device address matching using device address 0. */ +#define RADIO_DACNF_ENA0_Pos (0UL) /*!< Position of ENA0 field. */ +#define RADIO_DACNF_ENA0_Msk (0x1UL << RADIO_DACNF_ENA0_Pos) /*!< Bit mask of ENA0 field. */ +#define RADIO_DACNF_ENA0_Disabled (0UL) /*!< Disabled. */ +#define RADIO_DACNF_ENA0_Enabled (1UL) /*!< Enabled. */ + +/* Register: RADIO_OVERRIDE0 */ +/* Description: Trim value override register 0. */ + +/* Bits 31..0 : Trim value override 0. */ +#define RADIO_OVERRIDE0_OVERRIDE0_Pos (0UL) /*!< Position of OVERRIDE0 field. */ +#define RADIO_OVERRIDE0_OVERRIDE0_Msk (0xFFFFFFFFUL << RADIO_OVERRIDE0_OVERRIDE0_Pos) /*!< Bit mask of OVERRIDE0 field. */ + +/* Register: RADIO_OVERRIDE1 */ +/* Description: Trim value override register 1. */ + +/* Bits 31..0 : Trim value override 1. */ +#define RADIO_OVERRIDE1_OVERRIDE1_Pos (0UL) /*!< Position of OVERRIDE1 field. */ +#define RADIO_OVERRIDE1_OVERRIDE1_Msk (0xFFFFFFFFUL << RADIO_OVERRIDE1_OVERRIDE1_Pos) /*!< Bit mask of OVERRIDE1 field. */ + +/* Register: RADIO_OVERRIDE2 */ +/* Description: Trim value override register 2. */ + +/* Bits 31..0 : Trim value override 2. */ +#define RADIO_OVERRIDE2_OVERRIDE2_Pos (0UL) /*!< Position of OVERRIDE2 field. */ +#define RADIO_OVERRIDE2_OVERRIDE2_Msk (0xFFFFFFFFUL << RADIO_OVERRIDE2_OVERRIDE2_Pos) /*!< Bit mask of OVERRIDE2 field. */ + +/* Register: RADIO_OVERRIDE3 */ +/* Description: Trim value override register 3. */ + +/* Bits 31..0 : Trim value override 3. */ +#define RADIO_OVERRIDE3_OVERRIDE3_Pos (0UL) /*!< Position of OVERRIDE3 field. */ +#define RADIO_OVERRIDE3_OVERRIDE3_Msk (0xFFFFFFFFUL << RADIO_OVERRIDE3_OVERRIDE3_Pos) /*!< Bit mask of OVERRIDE3 field. */ + +/* Register: RADIO_OVERRIDE4 */ +/* Description: Trim value override register 4. */ + +/* Bit 31 : Enable or disable override of default trim values. */ +#define RADIO_OVERRIDE4_ENABLE_Pos (31UL) /*!< Position of ENABLE field. */ +#define RADIO_OVERRIDE4_ENABLE_Msk (0x1UL << RADIO_OVERRIDE4_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define RADIO_OVERRIDE4_ENABLE_Disabled (0UL) /*!< Override trim values disabled. */ +#define RADIO_OVERRIDE4_ENABLE_Enabled (1UL) /*!< Override trim values enabled. */ + +/* Bits 27..0 : Trim value override 4. */ +#define RADIO_OVERRIDE4_OVERRIDE4_Pos (0UL) /*!< Position of OVERRIDE4 field. */ +#define RADIO_OVERRIDE4_OVERRIDE4_Msk (0xFFFFFFFUL << RADIO_OVERRIDE4_OVERRIDE4_Pos) /*!< Bit mask of OVERRIDE4 field. */ + +/* Register: RADIO_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define RADIO_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define RADIO_POWER_POWER_Msk (0x1UL << RADIO_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define RADIO_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define RADIO_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: RNG */ +/* Description: Random Number Generator. */ + +/* Register: RNG_SHORTS */ +/* Description: Shortcuts for the RNG. */ + +/* Bit 0 : Shortcut between VALRDY event and STOP task. */ +#define RNG_SHORTS_VALRDY_STOP_Pos (0UL) /*!< Position of VALRDY_STOP field. */ +#define RNG_SHORTS_VALRDY_STOP_Msk (0x1UL << RNG_SHORTS_VALRDY_STOP_Pos) /*!< Bit mask of VALRDY_STOP field. */ +#define RNG_SHORTS_VALRDY_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define RNG_SHORTS_VALRDY_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: RNG_INTENSET */ +/* Description: Interrupt enable set register */ + +/* Bit 0 : Enable interrupt on VALRDY event. */ +#define RNG_INTENSET_VALRDY_Pos (0UL) /*!< Position of VALRDY field. */ +#define RNG_INTENSET_VALRDY_Msk (0x1UL << RNG_INTENSET_VALRDY_Pos) /*!< Bit mask of VALRDY field. */ +#define RNG_INTENSET_VALRDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define RNG_INTENSET_VALRDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define RNG_INTENSET_VALRDY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: RNG_INTENCLR */ +/* Description: Interrupt enable clear register */ + +/* Bit 0 : Disable interrupt on VALRDY event. */ +#define RNG_INTENCLR_VALRDY_Pos (0UL) /*!< Position of VALRDY field. */ +#define RNG_INTENCLR_VALRDY_Msk (0x1UL << RNG_INTENCLR_VALRDY_Pos) /*!< Bit mask of VALRDY field. */ +#define RNG_INTENCLR_VALRDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define RNG_INTENCLR_VALRDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define RNG_INTENCLR_VALRDY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: RNG_CONFIG */ +/* Description: Configuration register. */ + +/* Bit 0 : Digital error correction enable. */ +#define RNG_CONFIG_DERCEN_Pos (0UL) /*!< Position of DERCEN field. */ +#define RNG_CONFIG_DERCEN_Msk (0x1UL << RNG_CONFIG_DERCEN_Pos) /*!< Bit mask of DERCEN field. */ +#define RNG_CONFIG_DERCEN_Disabled (0UL) /*!< Digital error correction disabled. */ +#define RNG_CONFIG_DERCEN_Enabled (1UL) /*!< Digital error correction enabled. */ + +/* Register: RNG_VALUE */ +/* Description: RNG random number. */ + +/* Bits 7..0 : Generated random number. */ +#define RNG_VALUE_VALUE_Pos (0UL) /*!< Position of VALUE field. */ +#define RNG_VALUE_VALUE_Msk (0xFFUL << RNG_VALUE_VALUE_Pos) /*!< Bit mask of VALUE field. */ + +/* Register: RNG_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define RNG_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define RNG_POWER_POWER_Msk (0x1UL << RNG_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define RNG_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define RNG_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: RTC */ +/* Description: Real time counter 0. */ + +/* Register: RTC_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 19 : Enable interrupt on COMPARE[3] event. */ +#define RTC_INTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_INTENSET_COMPARE3_Msk (0x1UL << RTC_INTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_INTENSET_COMPARE3_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENSET_COMPARE3_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENSET_COMPARE3_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 18 : Enable interrupt on COMPARE[2] event. */ +#define RTC_INTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_INTENSET_COMPARE2_Msk (0x1UL << RTC_INTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_INTENSET_COMPARE2_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENSET_COMPARE2_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENSET_COMPARE2_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 17 : Enable interrupt on COMPARE[1] event. */ +#define RTC_INTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_INTENSET_COMPARE1_Msk (0x1UL << RTC_INTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_INTENSET_COMPARE1_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENSET_COMPARE1_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENSET_COMPARE1_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 16 : Enable interrupt on COMPARE[0] event. */ +#define RTC_INTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_INTENSET_COMPARE0_Msk (0x1UL << RTC_INTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_INTENSET_COMPARE0_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENSET_COMPARE0_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENSET_COMPARE0_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on OVRFLW event. */ +#define RTC_INTENSET_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_INTENSET_OVRFLW_Msk (0x1UL << RTC_INTENSET_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_INTENSET_OVRFLW_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENSET_OVRFLW_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENSET_OVRFLW_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on TICK event. */ +#define RTC_INTENSET_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_INTENSET_TICK_Msk (0x1UL << RTC_INTENSET_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_INTENSET_TICK_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENSET_TICK_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENSET_TICK_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: RTC_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 19 : Disable interrupt on COMPARE[3] event. */ +#define RTC_INTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_INTENCLR_COMPARE3_Msk (0x1UL << RTC_INTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_INTENCLR_COMPARE3_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENCLR_COMPARE3_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENCLR_COMPARE3_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 18 : Disable interrupt on COMPARE[2] event. */ +#define RTC_INTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_INTENCLR_COMPARE2_Msk (0x1UL << RTC_INTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_INTENCLR_COMPARE2_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENCLR_COMPARE2_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENCLR_COMPARE2_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 17 : Disable interrupt on COMPARE[1] event. */ +#define RTC_INTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_INTENCLR_COMPARE1_Msk (0x1UL << RTC_INTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_INTENCLR_COMPARE1_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENCLR_COMPARE1_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENCLR_COMPARE1_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 16 : Disable interrupt on COMPARE[0] event. */ +#define RTC_INTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_INTENCLR_COMPARE0_Msk (0x1UL << RTC_INTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_INTENCLR_COMPARE0_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENCLR_COMPARE0_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENCLR_COMPARE0_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on OVRFLW event. */ +#define RTC_INTENCLR_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_INTENCLR_OVRFLW_Msk (0x1UL << RTC_INTENCLR_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_INTENCLR_OVRFLW_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENCLR_OVRFLW_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENCLR_OVRFLW_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on TICK event. */ +#define RTC_INTENCLR_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_INTENCLR_TICK_Msk (0x1UL << RTC_INTENCLR_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_INTENCLR_TICK_Disabled (0UL) /*!< Interrupt disabled. */ +#define RTC_INTENCLR_TICK_Enabled (1UL) /*!< Interrupt enabled. */ +#define RTC_INTENCLR_TICK_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: RTC_EVTEN */ +/* Description: Configures event enable routing to PPI for each RTC event. */ + +/* Bit 19 : COMPARE[3] event enable. */ +#define RTC_EVTEN_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTEN_COMPARE3_Msk (0x1UL << RTC_EVTEN_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTEN_COMPARE3_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTEN_COMPARE3_Enabled (1UL) /*!< Event enabled. */ + +/* Bit 18 : COMPARE[2] event enable. */ +#define RTC_EVTEN_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTEN_COMPARE2_Msk (0x1UL << RTC_EVTEN_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTEN_COMPARE2_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTEN_COMPARE2_Enabled (1UL) /*!< Event enabled. */ + +/* Bit 17 : COMPARE[1] event enable. */ +#define RTC_EVTEN_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTEN_COMPARE1_Msk (0x1UL << RTC_EVTEN_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTEN_COMPARE1_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTEN_COMPARE1_Enabled (1UL) /*!< Event enabled. */ + +/* Bit 16 : COMPARE[0] event enable. */ +#define RTC_EVTEN_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTEN_COMPARE0_Msk (0x1UL << RTC_EVTEN_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTEN_COMPARE0_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTEN_COMPARE0_Enabled (1UL) /*!< Event enabled. */ + +/* Bit 1 : OVRFLW event enable. */ +#define RTC_EVTEN_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTEN_OVRFLW_Msk (0x1UL << RTC_EVTEN_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTEN_OVRFLW_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTEN_OVRFLW_Enabled (1UL) /*!< Event enabled. */ + +/* Bit 0 : TICK event enable. */ +#define RTC_EVTEN_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTEN_TICK_Msk (0x1UL << RTC_EVTEN_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTEN_TICK_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTEN_TICK_Enabled (1UL) /*!< Event enabled. */ + +/* Register: RTC_EVTENSET */ +/* Description: Enable events routing to PPI. The reading of this register gives the value of EVTEN. */ + +/* Bit 19 : Enable routing to PPI of COMPARE[3] event. */ +#define RTC_EVTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTENSET_COMPARE3_Msk (0x1UL << RTC_EVTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTENSET_COMPARE3_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENSET_COMPARE3_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENSET_COMPARE3_Set (1UL) /*!< Enable event on write. */ + +/* Bit 18 : Enable routing to PPI of COMPARE[2] event. */ +#define RTC_EVTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTENSET_COMPARE2_Msk (0x1UL << RTC_EVTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTENSET_COMPARE2_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENSET_COMPARE2_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENSET_COMPARE2_Set (1UL) /*!< Enable event on write. */ + +/* Bit 17 : Enable routing to PPI of COMPARE[1] event. */ +#define RTC_EVTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTENSET_COMPARE1_Msk (0x1UL << RTC_EVTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTENSET_COMPARE1_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENSET_COMPARE1_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENSET_COMPARE1_Set (1UL) /*!< Enable event on write. */ + +/* Bit 16 : Enable routing to PPI of COMPARE[0] event. */ +#define RTC_EVTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTENSET_COMPARE0_Msk (0x1UL << RTC_EVTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTENSET_COMPARE0_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENSET_COMPARE0_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENSET_COMPARE0_Set (1UL) /*!< Enable event on write. */ + +/* Bit 1 : Enable routing to PPI of OVRFLW event. */ +#define RTC_EVTENSET_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTENSET_OVRFLW_Msk (0x1UL << RTC_EVTENSET_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTENSET_OVRFLW_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENSET_OVRFLW_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENSET_OVRFLW_Set (1UL) /*!< Enable event on write. */ + +/* Bit 0 : Enable routing to PPI of TICK event. */ +#define RTC_EVTENSET_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTENSET_TICK_Msk (0x1UL << RTC_EVTENSET_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTENSET_TICK_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENSET_TICK_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENSET_TICK_Set (1UL) /*!< Enable event on write. */ + +/* Register: RTC_EVTENCLR */ +/* Description: Disable events routing to PPI. The reading of this register gives the value of EVTEN. */ + +/* Bit 19 : Disable routing to PPI of COMPARE[3] event. */ +#define RTC_EVTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTENCLR_COMPARE3_Msk (0x1UL << RTC_EVTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTENCLR_COMPARE3_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENCLR_COMPARE3_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENCLR_COMPARE3_Clear (1UL) /*!< Disable event on write. */ + +/* Bit 18 : Disable routing to PPI of COMPARE[2] event. */ +#define RTC_EVTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTENCLR_COMPARE2_Msk (0x1UL << RTC_EVTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTENCLR_COMPARE2_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENCLR_COMPARE2_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENCLR_COMPARE2_Clear (1UL) /*!< Disable event on write. */ + +/* Bit 17 : Disable routing to PPI of COMPARE[1] event. */ +#define RTC_EVTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTENCLR_COMPARE1_Msk (0x1UL << RTC_EVTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTENCLR_COMPARE1_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENCLR_COMPARE1_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENCLR_COMPARE1_Clear (1UL) /*!< Disable event on write. */ + +/* Bit 16 : Disable routing to PPI of COMPARE[0] event. */ +#define RTC_EVTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTENCLR_COMPARE0_Msk (0x1UL << RTC_EVTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTENCLR_COMPARE0_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENCLR_COMPARE0_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENCLR_COMPARE0_Clear (1UL) /*!< Disable event on write. */ + +/* Bit 1 : Disable routing to PPI of OVRFLW event. */ +#define RTC_EVTENCLR_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTENCLR_OVRFLW_Msk (0x1UL << RTC_EVTENCLR_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTENCLR_OVRFLW_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENCLR_OVRFLW_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENCLR_OVRFLW_Clear (1UL) /*!< Disable event on write. */ + +/* Bit 0 : Disable routing to PPI of TICK event. */ +#define RTC_EVTENCLR_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTENCLR_TICK_Msk (0x1UL << RTC_EVTENCLR_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTENCLR_TICK_Disabled (0UL) /*!< Event disabled. */ +#define RTC_EVTENCLR_TICK_Enabled (1UL) /*!< Event enabled. */ +#define RTC_EVTENCLR_TICK_Clear (1UL) /*!< Disable event on write. */ + +/* Register: RTC_COUNTER */ +/* Description: Current COUNTER value. */ + +/* Bits 23..0 : Counter value. */ +#define RTC_COUNTER_COUNTER_Pos (0UL) /*!< Position of COUNTER field. */ +#define RTC_COUNTER_COUNTER_Msk (0xFFFFFFUL << RTC_COUNTER_COUNTER_Pos) /*!< Bit mask of COUNTER field. */ + +/* Register: RTC_PRESCALER */ +/* Description: 12-bit prescaler for COUNTER frequency (32768/(PRESCALER+1)). Must be written when RTC is STOPed. */ + +/* Bits 11..0 : RTC PRESCALER value. */ +#define RTC_PRESCALER_PRESCALER_Pos (0UL) /*!< Position of PRESCALER field. */ +#define RTC_PRESCALER_PRESCALER_Msk (0xFFFUL << RTC_PRESCALER_PRESCALER_Pos) /*!< Bit mask of PRESCALER field. */ + +/* Register: RTC_CC */ +/* Description: Capture/compare registers. */ + +/* Bits 23..0 : Compare value. */ +#define RTC_CC_COMPARE_Pos (0UL) /*!< Position of COMPARE field. */ +#define RTC_CC_COMPARE_Msk (0xFFFFFFUL << RTC_CC_COMPARE_Pos) /*!< Bit mask of COMPARE field. */ + +/* Register: RTC_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define RTC_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define RTC_POWER_POWER_Msk (0x1UL << RTC_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define RTC_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define RTC_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: SPI */ +/* Description: SPI master 0. */ + +/* Register: SPI_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 2 : Enable interrupt on READY event. */ +#define SPI_INTENSET_READY_Pos (2UL) /*!< Position of READY field. */ +#define SPI_INTENSET_READY_Msk (0x1UL << SPI_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define SPI_INTENSET_READY_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPI_INTENSET_READY_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPI_INTENSET_READY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: SPI_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 2 : Disable interrupt on READY event. */ +#define SPI_INTENCLR_READY_Pos (2UL) /*!< Position of READY field. */ +#define SPI_INTENCLR_READY_Msk (0x1UL << SPI_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define SPI_INTENCLR_READY_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPI_INTENCLR_READY_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPI_INTENCLR_READY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: SPI_ENABLE */ +/* Description: Enable SPI. */ + +/* Bits 2..0 : Enable or disable SPI. */ +#define SPI_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPI_ENABLE_ENABLE_Msk (0x7UL << SPI_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPI_ENABLE_ENABLE_Disabled (0x00UL) /*!< Disabled SPI. */ +#define SPI_ENABLE_ENABLE_Enabled (0x01UL) /*!< Enable SPI. */ + +/* Register: SPI_RXD */ +/* Description: RX data. */ + +/* Bits 7..0 : RX data from last transfer. */ +#define SPI_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define SPI_RXD_RXD_Msk (0xFFUL << SPI_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: SPI_TXD */ +/* Description: TX data. */ + +/* Bits 7..0 : TX data for next transfer. */ +#define SPI_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define SPI_TXD_TXD_Msk (0xFFUL << SPI_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: SPI_FREQUENCY */ +/* Description: SPI frequency */ + +/* Bits 31..0 : SPI data rate. */ +#define SPI_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define SPI_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << SPI_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define SPI_FREQUENCY_FREQUENCY_K125 (0x02000000UL) /*!< 125kbps. */ +#define SPI_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250kbps. */ +#define SPI_FREQUENCY_FREQUENCY_K500 (0x08000000UL) /*!< 500kbps. */ +#define SPI_FREQUENCY_FREQUENCY_M1 (0x10000000UL) /*!< 1Mbps. */ +#define SPI_FREQUENCY_FREQUENCY_M2 (0x20000000UL) /*!< 2Mbps. */ +#define SPI_FREQUENCY_FREQUENCY_M4 (0x40000000UL) /*!< 4Mbps. */ +#define SPI_FREQUENCY_FREQUENCY_M8 (0x80000000UL) /*!< 8Mbps. */ + +/* Register: SPI_CONFIG */ +/* Description: Configuration register. */ + +/* Bit 2 : Serial clock (SCK) polarity. */ +#define SPI_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPI_CONFIG_CPOL_Msk (0x1UL << SPI_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPI_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high. */ +#define SPI_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low. */ + +/* Bit 1 : Serial clock (SCK) phase. */ +#define SPI_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPI_CONFIG_CPHA_Msk (0x1UL << SPI_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPI_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of the clock. Shift serial data on trailing edge. */ +#define SPI_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of the clock. Shift serial data on leading edge. */ + +/* Bit 0 : Bit order. */ +#define SPI_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPI_CONFIG_ORDER_Msk (0x1UL << SPI_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPI_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit transmitted out first. */ +#define SPI_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit transmitted out first. */ + +/* Register: SPI_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define SPI_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define SPI_POWER_POWER_Msk (0x1UL << SPI_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define SPI_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define SPI_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: SPIM */ +/* Description: SPI master with easyDMA 1. */ + +/* Register: SPIM_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 19 : Enable interrupt on STARTED event. */ +#define SPIM_INTENSET_STARTED_Pos (19UL) /*!< Position of STARTED field. */ +#define SPIM_INTENSET_STARTED_Msk (0x1UL << SPIM_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SPIM_INTENSET_STARTED_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIM_INTENSET_STARTED_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIM_INTENSET_STARTED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 8 : Enable interrupt on ENDTX event. */ +#define SPIM_INTENSET_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define SPIM_INTENSET_ENDTX_Msk (0x1UL << SPIM_INTENSET_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define SPIM_INTENSET_ENDTX_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIM_INTENSET_ENDTX_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIM_INTENSET_ENDTX_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 4 : Enable interrupt on ENDRX event. */ +#define SPIM_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIM_INTENSET_ENDRX_Msk (0x1UL << SPIM_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIM_INTENSET_ENDRX_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIM_INTENSET_ENDRX_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIM_INTENSET_ENDRX_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on STOPPED event. */ +#define SPIM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define SPIM_INTENSET_STOPPED_Msk (0x1UL << SPIM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SPIM_INTENSET_STOPPED_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIM_INTENSET_STOPPED_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIM_INTENSET_STOPPED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: SPIM_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 19 : Disable interrupt on STARTED event. */ +#define SPIM_INTENCLR_STARTED_Pos (19UL) /*!< Position of STARTED field. */ +#define SPIM_INTENCLR_STARTED_Msk (0x1UL << SPIM_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SPIM_INTENCLR_STARTED_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIM_INTENCLR_STARTED_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIM_INTENCLR_STARTED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 8 : Disable interrupt on ENDTX event. */ +#define SPIM_INTENCLR_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define SPIM_INTENCLR_ENDTX_Msk (0x1UL << SPIM_INTENCLR_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define SPIM_INTENCLR_ENDTX_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIM_INTENCLR_ENDTX_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIM_INTENCLR_ENDTX_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 4 : Disable interrupt on ENDRX event. */ +#define SPIM_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIM_INTENCLR_ENDRX_Msk (0x1UL << SPIM_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIM_INTENCLR_ENDRX_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIM_INTENCLR_ENDRX_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIM_INTENCLR_ENDRX_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on STOPPED event. */ +#define SPIM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define SPIM_INTENCLR_STOPPED_Msk (0x1UL << SPIM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SPIM_INTENCLR_STOPPED_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIM_INTENCLR_STOPPED_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: SPIM_ENABLE */ +/* Description: Enable SPIM. */ + +/* Bits 3..0 : Enable or disable SPIM. */ +#define SPIM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPIM_ENABLE_ENABLE_Msk (0xFUL << SPIM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPIM_ENABLE_ENABLE_Disabled (0x00UL) /*!< Disabled SPIM. */ +#define SPIM_ENABLE_ENABLE_Enabled (0x07UL) /*!< Enable SPIM. */ + +/* Register: SPIM_FREQUENCY */ +/* Description: SPI frequency. */ + +/* Bits 31..0 : SPI master data rate. */ +#define SPIM_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define SPIM_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << SPIM_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define SPIM_FREQUENCY_FREQUENCY_K125 (0x02000000UL) /*!< 125 kbps. */ +#define SPIM_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps. */ +#define SPIM_FREQUENCY_FREQUENCY_K500 (0x08000000UL) /*!< 500 kbps. */ +#define SPIM_FREQUENCY_FREQUENCY_M1 (0x10000000UL) /*!< 1 Mbps. */ +#define SPIM_FREQUENCY_FREQUENCY_M2 (0x20000000UL) /*!< 2 Mbps. */ +#define SPIM_FREQUENCY_FREQUENCY_M4 (0x40000000UL) /*!< 4 Mbps. */ +#define SPIM_FREQUENCY_FREQUENCY_M8 (0x80000000UL) /*!< 8 Mbps. */ + +/* Register: SPIM_RXD_PTR */ +/* Description: Data pointer. */ + +/* Bits 31..0 : Data pointer. */ +#define SPIM_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIM_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIM_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIM_RXD_MAXCNT */ +/* Description: Maximum number of buffer bytes to receive. */ + +/* Bits 7..0 : Maximum number of buffer bytes to receive. */ +#define SPIM_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIM_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIM_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIM_RXD_AMOUNT */ +/* Description: Number of bytes received in the last transaction. */ + +/* Bits 7..0 : Number of bytes received in the last transaction. */ +#define SPIM_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIM_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIM_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIM_TXD_PTR */ +/* Description: Data pointer. */ + +/* Bits 31..0 : Data pointer. */ +#define SPIM_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIM_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIM_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIM_TXD_MAXCNT */ +/* Description: Maximum number of buffer bytes to send. */ + +/* Bits 7..0 : Maximum number of buffer bytes to send. */ +#define SPIM_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIM_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIM_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIM_TXD_AMOUNT */ +/* Description: Number of bytes sent in the last transaction. */ + +/* Bits 7..0 : Number of bytes sent in the last transaction. */ +#define SPIM_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIM_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIM_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIM_CONFIG */ +/* Description: Configuration register. */ + +/* Bit 2 : Serial clock (SCK) polarity. */ +#define SPIM_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPIM_CONFIG_CPOL_Msk (0x1UL << SPIM_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPIM_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high. */ +#define SPIM_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low. */ + +/* Bit 1 : Serial clock (SCK) phase. */ +#define SPIM_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPIM_CONFIG_CPHA_Msk (0x1UL << SPIM_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPIM_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of the clock. Shift serial data on trailing edge. */ +#define SPIM_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of the clock. Shift serial data on leading edge. */ + +/* Bit 0 : Bit order. */ +#define SPIM_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPIM_CONFIG_ORDER_Msk (0x1UL << SPIM_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPIM_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit transmitted out first. */ +#define SPIM_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit transmitted out first. */ + +/* Register: SPIM_ORC */ +/* Description: Over-read character. */ + +/* Bits 7..0 : Over-read character. */ +#define SPIM_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ +#define SPIM_ORC_ORC_Msk (0xFFUL << SPIM_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ + +/* Register: SPIM_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define SPIM_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define SPIM_POWER_POWER_Msk (0x1UL << SPIM_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define SPIM_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define SPIM_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: SPIS */ +/* Description: SPI slave 1. */ + +/* Register: SPIS_SHORTS */ +/* Description: Shortcuts for SPIS. */ + +/* Bit 2 : Shortcut between END event and the ACQUIRE task. */ +#define SPIS_SHORTS_END_ACQUIRE_Pos (2UL) /*!< Position of END_ACQUIRE field. */ +#define SPIS_SHORTS_END_ACQUIRE_Msk (0x1UL << SPIS_SHORTS_END_ACQUIRE_Pos) /*!< Bit mask of END_ACQUIRE field. */ +#define SPIS_SHORTS_END_ACQUIRE_Disabled (0UL) /*!< Shortcut disabled. */ +#define SPIS_SHORTS_END_ACQUIRE_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: SPIS_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 10 : Enable interrupt on ACQUIRED event. */ +#define SPIS_INTENSET_ACQUIRED_Pos (10UL) /*!< Position of ACQUIRED field. */ +#define SPIS_INTENSET_ACQUIRED_Msk (0x1UL << SPIS_INTENSET_ACQUIRED_Pos) /*!< Bit mask of ACQUIRED field. */ +#define SPIS_INTENSET_ACQUIRED_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIS_INTENSET_ACQUIRED_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIS_INTENSET_ACQUIRED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 4 : enable interrupt on ENDRX event. */ +#define SPIS_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIS_INTENSET_ENDRX_Msk (0x1UL << SPIS_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIS_INTENSET_ENDRX_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIS_INTENSET_ENDRX_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIS_INTENSET_ENDRX_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on END event. */ +#define SPIS_INTENSET_END_Pos (1UL) /*!< Position of END field. */ +#define SPIS_INTENSET_END_Msk (0x1UL << SPIS_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define SPIS_INTENSET_END_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIS_INTENSET_END_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIS_INTENSET_END_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: SPIS_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 10 : Disable interrupt on ACQUIRED event. */ +#define SPIS_INTENCLR_ACQUIRED_Pos (10UL) /*!< Position of ACQUIRED field. */ +#define SPIS_INTENCLR_ACQUIRED_Msk (0x1UL << SPIS_INTENCLR_ACQUIRED_Pos) /*!< Bit mask of ACQUIRED field. */ +#define SPIS_INTENCLR_ACQUIRED_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIS_INTENCLR_ACQUIRED_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIS_INTENCLR_ACQUIRED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 4 : Disable interrupt on ENDRX event. */ +#define SPIS_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIS_INTENCLR_ENDRX_Msk (0x1UL << SPIS_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIS_INTENCLR_ENDRX_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIS_INTENCLR_ENDRX_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIS_INTENCLR_ENDRX_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on END event. */ +#define SPIS_INTENCLR_END_Pos (1UL) /*!< Position of END field. */ +#define SPIS_INTENCLR_END_Msk (0x1UL << SPIS_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define SPIS_INTENCLR_END_Disabled (0UL) /*!< Interrupt disabled. */ +#define SPIS_INTENCLR_END_Enabled (1UL) /*!< Interrupt enabled. */ +#define SPIS_INTENCLR_END_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: SPIS_SEMSTAT */ +/* Description: Semaphore status. */ + +/* Bits 1..0 : Semaphore status. */ +#define SPIS_SEMSTAT_SEMSTAT_Pos (0UL) /*!< Position of SEMSTAT field. */ +#define SPIS_SEMSTAT_SEMSTAT_Msk (0x3UL << SPIS_SEMSTAT_SEMSTAT_Pos) /*!< Bit mask of SEMSTAT field. */ +#define SPIS_SEMSTAT_SEMSTAT_Free (0x00UL) /*!< Semaphore is free. */ +#define SPIS_SEMSTAT_SEMSTAT_CPU (0x01UL) /*!< Semaphore is assigned to the CPU. */ +#define SPIS_SEMSTAT_SEMSTAT_SPIS (0x02UL) /*!< Semaphore is assigned to the SPIS. */ +#define SPIS_SEMSTAT_SEMSTAT_CPUPending (0x03UL) /*!< Semaphore is assigned to the SPIS, but a handover to the CPU is pending. */ + +/* Register: SPIS_STATUS */ +/* Description: Status from last transaction. */ + +/* Bit 1 : RX buffer overflow detected, and prevented. */ +#define SPIS_STATUS_OVERFLOW_Pos (1UL) /*!< Position of OVERFLOW field. */ +#define SPIS_STATUS_OVERFLOW_Msk (0x1UL << SPIS_STATUS_OVERFLOW_Pos) /*!< Bit mask of OVERFLOW field. */ +#define SPIS_STATUS_OVERFLOW_NotPresent (0UL) /*!< Error not present. */ +#define SPIS_STATUS_OVERFLOW_Present (1UL) /*!< Error present. */ +#define SPIS_STATUS_OVERFLOW_Clear (1UL) /*!< Clear on write. */ + +/* Bit 0 : TX buffer overread detected, and prevented. */ +#define SPIS_STATUS_OVERREAD_Pos (0UL) /*!< Position of OVERREAD field. */ +#define SPIS_STATUS_OVERREAD_Msk (0x1UL << SPIS_STATUS_OVERREAD_Pos) /*!< Bit mask of OVERREAD field. */ +#define SPIS_STATUS_OVERREAD_NotPresent (0UL) /*!< Error not present. */ +#define SPIS_STATUS_OVERREAD_Present (1UL) /*!< Error present. */ +#define SPIS_STATUS_OVERREAD_Clear (1UL) /*!< Clear on write. */ + +/* Register: SPIS_ENABLE */ +/* Description: Enable SPIS. */ + +/* Bits 2..0 : Enable or disable SPIS. */ +#define SPIS_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPIS_ENABLE_ENABLE_Msk (0x7UL << SPIS_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPIS_ENABLE_ENABLE_Disabled (0x00UL) /*!< Disabled SPIS. */ +#define SPIS_ENABLE_ENABLE_Enabled (0x02UL) /*!< Enable SPIS. */ + +/* Register: SPIS_MAXRX */ +/* Description: Maximum number of bytes in the receive buffer. */ + +/* Bits 7..0 : Maximum number of bytes in the receive buffer. */ +#define SPIS_MAXRX_MAXRX_Pos (0UL) /*!< Position of MAXRX field. */ +#define SPIS_MAXRX_MAXRX_Msk (0xFFUL << SPIS_MAXRX_MAXRX_Pos) /*!< Bit mask of MAXRX field. */ + +/* Register: SPIS_AMOUNTRX */ +/* Description: Number of bytes received in last granted transaction. */ + +/* Bits 7..0 : Number of bytes received in last granted transaction. */ +#define SPIS_AMOUNTRX_AMOUNTRX_Pos (0UL) /*!< Position of AMOUNTRX field. */ +#define SPIS_AMOUNTRX_AMOUNTRX_Msk (0xFFUL << SPIS_AMOUNTRX_AMOUNTRX_Pos) /*!< Bit mask of AMOUNTRX field. */ + +/* Register: SPIS_MAXTX */ +/* Description: Maximum number of bytes in the transmit buffer. */ + +/* Bits 7..0 : Maximum number of bytes in the transmit buffer. */ +#define SPIS_MAXTX_MAXTX_Pos (0UL) /*!< Position of MAXTX field. */ +#define SPIS_MAXTX_MAXTX_Msk (0xFFUL << SPIS_MAXTX_MAXTX_Pos) /*!< Bit mask of MAXTX field. */ + +/* Register: SPIS_AMOUNTTX */ +/* Description: Number of bytes transmitted in last granted transaction. */ + +/* Bits 7..0 : Number of bytes transmitted in last granted transaction. */ +#define SPIS_AMOUNTTX_AMOUNTTX_Pos (0UL) /*!< Position of AMOUNTTX field. */ +#define SPIS_AMOUNTTX_AMOUNTTX_Msk (0xFFUL << SPIS_AMOUNTTX_AMOUNTTX_Pos) /*!< Bit mask of AMOUNTTX field. */ + +/* Register: SPIS_CONFIG */ +/* Description: Configuration register. */ + +/* Bit 2 : Serial clock (SCK) polarity. */ +#define SPIS_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPIS_CONFIG_CPOL_Msk (0x1UL << SPIS_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPIS_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high. */ +#define SPIS_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low. */ + +/* Bit 1 : Serial clock (SCK) phase. */ +#define SPIS_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPIS_CONFIG_CPHA_Msk (0x1UL << SPIS_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPIS_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of the clock. Shift serial data on trailing edge. */ +#define SPIS_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of the clock. Shift serial data on leading edge. */ + +/* Bit 0 : Bit order. */ +#define SPIS_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPIS_CONFIG_ORDER_Msk (0x1UL << SPIS_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPIS_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit transmitted out first. */ +#define SPIS_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit transmitted out first. */ + +/* Register: SPIS_DEF */ +/* Description: Default character. */ + +/* Bits 7..0 : Default character. */ +#define SPIS_DEF_DEF_Pos (0UL) /*!< Position of DEF field. */ +#define SPIS_DEF_DEF_Msk (0xFFUL << SPIS_DEF_DEF_Pos) /*!< Bit mask of DEF field. */ + +/* Register: SPIS_ORC */ +/* Description: Over-read character. */ + +/* Bits 7..0 : Over-read character. */ +#define SPIS_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ +#define SPIS_ORC_ORC_Msk (0xFFUL << SPIS_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ + +/* Register: SPIS_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define SPIS_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define SPIS_POWER_POWER_Msk (0x1UL << SPIS_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define SPIS_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define SPIS_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: TEMP */ +/* Description: Temperature Sensor. */ + +/* Register: TEMP_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 0 : Enable interrupt on DATARDY event. */ +#define TEMP_INTENSET_DATARDY_Pos (0UL) /*!< Position of DATARDY field. */ +#define TEMP_INTENSET_DATARDY_Msk (0x1UL << TEMP_INTENSET_DATARDY_Pos) /*!< Bit mask of DATARDY field. */ +#define TEMP_INTENSET_DATARDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define TEMP_INTENSET_DATARDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define TEMP_INTENSET_DATARDY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: TEMP_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 0 : Disable interrupt on DATARDY event. */ +#define TEMP_INTENCLR_DATARDY_Pos (0UL) /*!< Position of DATARDY field. */ +#define TEMP_INTENCLR_DATARDY_Msk (0x1UL << TEMP_INTENCLR_DATARDY_Pos) /*!< Bit mask of DATARDY field. */ +#define TEMP_INTENCLR_DATARDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define TEMP_INTENCLR_DATARDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define TEMP_INTENCLR_DATARDY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: TEMP_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define TEMP_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define TEMP_POWER_POWER_Msk (0x1UL << TEMP_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define TEMP_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define TEMP_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: TIMER */ +/* Description: Timer 0. */ + +/* Register: TIMER_SHORTS */ +/* Description: Shortcuts for Timer. */ + +/* Bit 11 : Shortcut between CC[3] event and the STOP task. */ +#define TIMER_SHORTS_COMPARE3_STOP_Pos (11UL) /*!< Position of COMPARE3_STOP field. */ +#define TIMER_SHORTS_COMPARE3_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE3_STOP_Pos) /*!< Bit mask of COMPARE3_STOP field. */ +#define TIMER_SHORTS_COMPARE3_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define TIMER_SHORTS_COMPARE3_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 10 : Shortcut between CC[2] event and the STOP task. */ +#define TIMER_SHORTS_COMPARE2_STOP_Pos (10UL) /*!< Position of COMPARE2_STOP field. */ +#define TIMER_SHORTS_COMPARE2_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE2_STOP_Pos) /*!< Bit mask of COMPARE2_STOP field. */ +#define TIMER_SHORTS_COMPARE2_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define TIMER_SHORTS_COMPARE2_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 9 : Shortcut between CC[1] event and the STOP task. */ +#define TIMER_SHORTS_COMPARE1_STOP_Pos (9UL) /*!< Position of COMPARE1_STOP field. */ +#define TIMER_SHORTS_COMPARE1_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE1_STOP_Pos) /*!< Bit mask of COMPARE1_STOP field. */ +#define TIMER_SHORTS_COMPARE1_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define TIMER_SHORTS_COMPARE1_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 8 : Shortcut between CC[0] event and the STOP task. */ +#define TIMER_SHORTS_COMPARE0_STOP_Pos (8UL) /*!< Position of COMPARE0_STOP field. */ +#define TIMER_SHORTS_COMPARE0_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE0_STOP_Pos) /*!< Bit mask of COMPARE0_STOP field. */ +#define TIMER_SHORTS_COMPARE0_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define TIMER_SHORTS_COMPARE0_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 3 : Shortcut between CC[3] event and the CLEAR task. */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Pos (3UL) /*!< Position of COMPARE3_CLEAR field. */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE3_CLEAR_Pos) /*!< Bit mask of COMPARE3_CLEAR field. */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Disabled (0UL) /*!< Shortcut disabled. */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 2 : Shortcut between CC[2] event and the CLEAR task. */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Pos (2UL) /*!< Position of COMPARE2_CLEAR field. */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE2_CLEAR_Pos) /*!< Bit mask of COMPARE2_CLEAR field. */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Disabled (0UL) /*!< Shortcut disabled. */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 1 : Shortcut between CC[1] event and the CLEAR task. */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Pos (1UL) /*!< Position of COMPARE1_CLEAR field. */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE1_CLEAR_Pos) /*!< Bit mask of COMPARE1_CLEAR field. */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Disabled (0UL) /*!< Shortcut disabled. */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 0 : Shortcut between CC[0] event and the CLEAR task. */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Pos (0UL) /*!< Position of COMPARE0_CLEAR field. */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE0_CLEAR_Pos) /*!< Bit mask of COMPARE0_CLEAR field. */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Disabled (0UL) /*!< Shortcut disabled. */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: TIMER_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 19 : Enable interrupt on COMPARE[3] */ +#define TIMER_INTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define TIMER_INTENSET_COMPARE3_Msk (0x1UL << TIMER_INTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define TIMER_INTENSET_COMPARE3_Disabled (0UL) /*!< Interrupt disabled. */ +#define TIMER_INTENSET_COMPARE3_Enabled (1UL) /*!< Interrupt enabled. */ +#define TIMER_INTENSET_COMPARE3_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 18 : Enable interrupt on COMPARE[2] */ +#define TIMER_INTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define TIMER_INTENSET_COMPARE2_Msk (0x1UL << TIMER_INTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define TIMER_INTENSET_COMPARE2_Disabled (0UL) /*!< Interrupt disabled. */ +#define TIMER_INTENSET_COMPARE2_Enabled (1UL) /*!< Interrupt enabled. */ +#define TIMER_INTENSET_COMPARE2_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 17 : Enable interrupt on COMPARE[1] */ +#define TIMER_INTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define TIMER_INTENSET_COMPARE1_Msk (0x1UL << TIMER_INTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define TIMER_INTENSET_COMPARE1_Disabled (0UL) /*!< Interrupt disabled. */ +#define TIMER_INTENSET_COMPARE1_Enabled (1UL) /*!< Interrupt enabled. */ +#define TIMER_INTENSET_COMPARE1_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 16 : Enable interrupt on COMPARE[0] */ +#define TIMER_INTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define TIMER_INTENSET_COMPARE0_Msk (0x1UL << TIMER_INTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define TIMER_INTENSET_COMPARE0_Disabled (0UL) /*!< Interrupt disabled. */ +#define TIMER_INTENSET_COMPARE0_Enabled (1UL) /*!< Interrupt enabled. */ +#define TIMER_INTENSET_COMPARE0_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: TIMER_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 19 : Disable interrupt on COMPARE[3] */ +#define TIMER_INTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define TIMER_INTENCLR_COMPARE3_Msk (0x1UL << TIMER_INTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define TIMER_INTENCLR_COMPARE3_Disabled (0UL) /*!< Interrupt disabled. */ +#define TIMER_INTENCLR_COMPARE3_Enabled (1UL) /*!< Interrupt enabled. */ +#define TIMER_INTENCLR_COMPARE3_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 18 : Disable interrupt on COMPARE[2] */ +#define TIMER_INTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define TIMER_INTENCLR_COMPARE2_Msk (0x1UL << TIMER_INTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define TIMER_INTENCLR_COMPARE2_Disabled (0UL) /*!< Interrupt disabled. */ +#define TIMER_INTENCLR_COMPARE2_Enabled (1UL) /*!< Interrupt enabled. */ +#define TIMER_INTENCLR_COMPARE2_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 17 : Disable interrupt on COMPARE[1] */ +#define TIMER_INTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define TIMER_INTENCLR_COMPARE1_Msk (0x1UL << TIMER_INTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define TIMER_INTENCLR_COMPARE1_Disabled (0UL) /*!< Interrupt disabled. */ +#define TIMER_INTENCLR_COMPARE1_Enabled (1UL) /*!< Interrupt enabled. */ +#define TIMER_INTENCLR_COMPARE1_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 16 : Disable interrupt on COMPARE[0] */ +#define TIMER_INTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define TIMER_INTENCLR_COMPARE0_Msk (0x1UL << TIMER_INTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define TIMER_INTENCLR_COMPARE0_Disabled (0UL) /*!< Interrupt disabled. */ +#define TIMER_INTENCLR_COMPARE0_Enabled (1UL) /*!< Interrupt enabled. */ +#define TIMER_INTENCLR_COMPARE0_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: TIMER_MODE */ +/* Description: Timer Mode selection. */ + +/* Bit 0 : Select Normal or Counter mode. */ +#define TIMER_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define TIMER_MODE_MODE_Msk (0x1UL << TIMER_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define TIMER_MODE_MODE_Timer (0UL) /*!< Timer in Normal mode. */ +#define TIMER_MODE_MODE_Counter (1UL) /*!< Timer in Counter mode. */ + +/* Register: TIMER_BITMODE */ +/* Description: Sets timer behaviour. */ + +/* Bits 1..0 : Sets timer behaviour ro be like the implementation of a timer with width as indicated. */ +#define TIMER_BITMODE_BITMODE_Pos (0UL) /*!< Position of BITMODE field. */ +#define TIMER_BITMODE_BITMODE_Msk (0x3UL << TIMER_BITMODE_BITMODE_Pos) /*!< Bit mask of BITMODE field. */ +#define TIMER_BITMODE_BITMODE_16Bit (0x00UL) /*!< 16-bit timer behaviour. */ +#define TIMER_BITMODE_BITMODE_08Bit (0x01UL) /*!< 8-bit timer behaviour. */ +#define TIMER_BITMODE_BITMODE_24Bit (0x02UL) /*!< 24-bit timer behaviour. */ +#define TIMER_BITMODE_BITMODE_32Bit (0x03UL) /*!< 32-bit timer behaviour. */ + +/* Register: TIMER_PRESCALER */ +/* Description: 4-bit prescaler to source clock frequency (max value 9). Source clock frequency is divided by 2^SCALE. */ + +/* Bits 3..0 : Timer PRESCALER value. Max value is 9. */ +#define TIMER_PRESCALER_PRESCALER_Pos (0UL) /*!< Position of PRESCALER field. */ +#define TIMER_PRESCALER_PRESCALER_Msk (0xFUL << TIMER_PRESCALER_PRESCALER_Pos) /*!< Bit mask of PRESCALER field. */ + +/* Register: TIMER_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define TIMER_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define TIMER_POWER_POWER_Msk (0x1UL << TIMER_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define TIMER_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define TIMER_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: TWI */ +/* Description: Two-wire interface master 0. */ + +/* Register: TWI_SHORTS */ +/* Description: Shortcuts for TWI. */ + +/* Bit 1 : Shortcut between BB event and the STOP task. */ +#define TWI_SHORTS_BB_STOP_Pos (1UL) /*!< Position of BB_STOP field. */ +#define TWI_SHORTS_BB_STOP_Msk (0x1UL << TWI_SHORTS_BB_STOP_Pos) /*!< Bit mask of BB_STOP field. */ +#define TWI_SHORTS_BB_STOP_Disabled (0UL) /*!< Shortcut disabled. */ +#define TWI_SHORTS_BB_STOP_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 0 : Shortcut between BB event and the SUSPEND task. */ +#define TWI_SHORTS_BB_SUSPEND_Pos (0UL) /*!< Position of BB_SUSPEND field. */ +#define TWI_SHORTS_BB_SUSPEND_Msk (0x1UL << TWI_SHORTS_BB_SUSPEND_Pos) /*!< Bit mask of BB_SUSPEND field. */ +#define TWI_SHORTS_BB_SUSPEND_Disabled (0UL) /*!< Shortcut disabled. */ +#define TWI_SHORTS_BB_SUSPEND_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: TWI_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 18 : Enable interrupt on SUSPENDED event. */ +#define TWI_INTENSET_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWI_INTENSET_SUSPENDED_Msk (0x1UL << TWI_INTENSET_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWI_INTENSET_SUSPENDED_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENSET_SUSPENDED_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENSET_SUSPENDED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 14 : Enable interrupt on BB event. */ +#define TWI_INTENSET_BB_Pos (14UL) /*!< Position of BB field. */ +#define TWI_INTENSET_BB_Msk (0x1UL << TWI_INTENSET_BB_Pos) /*!< Bit mask of BB field. */ +#define TWI_INTENSET_BB_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENSET_BB_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENSET_BB_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 9 : Enable interrupt on ERROR event. */ +#define TWI_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWI_INTENSET_ERROR_Msk (0x1UL << TWI_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWI_INTENSET_ERROR_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENSET_ERROR_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENSET_ERROR_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 7 : Enable interrupt on TXDSENT event. */ +#define TWI_INTENSET_TXDSENT_Pos (7UL) /*!< Position of TXDSENT field. */ +#define TWI_INTENSET_TXDSENT_Msk (0x1UL << TWI_INTENSET_TXDSENT_Pos) /*!< Bit mask of TXDSENT field. */ +#define TWI_INTENSET_TXDSENT_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENSET_TXDSENT_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENSET_TXDSENT_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 2 : Enable interrupt on READY event. */ +#define TWI_INTENSET_RXDREADY_Pos (2UL) /*!< Position of RXDREADY field. */ +#define TWI_INTENSET_RXDREADY_Msk (0x1UL << TWI_INTENSET_RXDREADY_Pos) /*!< Bit mask of RXDREADY field. */ +#define TWI_INTENSET_RXDREADY_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENSET_RXDREADY_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENSET_RXDREADY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on STOPPED event. */ +#define TWI_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWI_INTENSET_STOPPED_Msk (0x1UL << TWI_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWI_INTENSET_STOPPED_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENSET_STOPPED_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENSET_STOPPED_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: TWI_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 18 : Disable interrupt on SUSPENDED event. */ +#define TWI_INTENCLR_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWI_INTENCLR_SUSPENDED_Msk (0x1UL << TWI_INTENCLR_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWI_INTENCLR_SUSPENDED_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENCLR_SUSPENDED_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENCLR_SUSPENDED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 14 : Disable interrupt on BB event. */ +#define TWI_INTENCLR_BB_Pos (14UL) /*!< Position of BB field. */ +#define TWI_INTENCLR_BB_Msk (0x1UL << TWI_INTENCLR_BB_Pos) /*!< Bit mask of BB field. */ +#define TWI_INTENCLR_BB_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENCLR_BB_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENCLR_BB_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 9 : Disable interrupt on ERROR event. */ +#define TWI_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWI_INTENCLR_ERROR_Msk (0x1UL << TWI_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWI_INTENCLR_ERROR_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENCLR_ERROR_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENCLR_ERROR_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 7 : Disable interrupt on TXDSENT event. */ +#define TWI_INTENCLR_TXDSENT_Pos (7UL) /*!< Position of TXDSENT field. */ +#define TWI_INTENCLR_TXDSENT_Msk (0x1UL << TWI_INTENCLR_TXDSENT_Pos) /*!< Bit mask of TXDSENT field. */ +#define TWI_INTENCLR_TXDSENT_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENCLR_TXDSENT_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENCLR_TXDSENT_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 2 : Disable interrupt on RXDREADY event. */ +#define TWI_INTENCLR_RXDREADY_Pos (2UL) /*!< Position of RXDREADY field. */ +#define TWI_INTENCLR_RXDREADY_Msk (0x1UL << TWI_INTENCLR_RXDREADY_Pos) /*!< Bit mask of RXDREADY field. */ +#define TWI_INTENCLR_RXDREADY_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENCLR_RXDREADY_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENCLR_RXDREADY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on STOPPED event. */ +#define TWI_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWI_INTENCLR_STOPPED_Msk (0x1UL << TWI_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWI_INTENCLR_STOPPED_Disabled (0UL) /*!< Interrupt disabled. */ +#define TWI_INTENCLR_STOPPED_Enabled (1UL) /*!< Interrupt enabled. */ +#define TWI_INTENCLR_STOPPED_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: TWI_ERRORSRC */ +/* Description: Two-wire error source. Write error field to 1 to clear error. */ + +/* Bit 2 : NACK received after sending a data byte. */ +#define TWI_ERRORSRC_DNACK_Pos (2UL) /*!< Position of DNACK field. */ +#define TWI_ERRORSRC_DNACK_Msk (0x1UL << TWI_ERRORSRC_DNACK_Pos) /*!< Bit mask of DNACK field. */ +#define TWI_ERRORSRC_DNACK_NotPresent (0UL) /*!< Error not present. */ +#define TWI_ERRORSRC_DNACK_Present (1UL) /*!< Error present. */ +#define TWI_ERRORSRC_DNACK_Clear (1UL) /*!< Clear error on write. */ + +/* Bit 1 : NACK received after sending the address. */ +#define TWI_ERRORSRC_ANACK_Pos (1UL) /*!< Position of ANACK field. */ +#define TWI_ERRORSRC_ANACK_Msk (0x1UL << TWI_ERRORSRC_ANACK_Pos) /*!< Bit mask of ANACK field. */ +#define TWI_ERRORSRC_ANACK_NotPresent (0UL) /*!< Error not present. */ +#define TWI_ERRORSRC_ANACK_Present (1UL) /*!< Error present. */ +#define TWI_ERRORSRC_ANACK_Clear (1UL) /*!< Clear error on write. */ + +/* Bit 0 : Byte received in RXD register before read of the last received byte (data loss). */ +#define TWI_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define TWI_ERRORSRC_OVERRUN_Msk (0x1UL << TWI_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define TWI_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Error not present. */ +#define TWI_ERRORSRC_OVERRUN_Present (1UL) /*!< Error present. */ +#define TWI_ERRORSRC_OVERRUN_Clear (1UL) /*!< Clear error on write. */ + +/* Register: TWI_ENABLE */ +/* Description: Enable two-wire master. */ + +/* Bits 2..0 : Enable or disable W2M */ +#define TWI_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define TWI_ENABLE_ENABLE_Msk (0x7UL << TWI_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define TWI_ENABLE_ENABLE_Disabled (0x00UL) /*!< Disabled. */ +#define TWI_ENABLE_ENABLE_Enabled (0x05UL) /*!< Enabled. */ + +/* Register: TWI_RXD */ +/* Description: RX data register. */ + +/* Bits 7..0 : RX data from last transfer. */ +#define TWI_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define TWI_RXD_RXD_Msk (0xFFUL << TWI_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: TWI_TXD */ +/* Description: TX data register. */ + +/* Bits 7..0 : TX data for next transfer. */ +#define TWI_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define TWI_TXD_TXD_Msk (0xFFUL << TWI_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: TWI_FREQUENCY */ +/* Description: Two-wire frequency. */ + +/* Bits 31..0 : Two-wire master clock frequency. */ +#define TWI_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define TWI_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << TWI_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define TWI_FREQUENCY_FREQUENCY_K100 (0x01980000UL) /*!< 100 kbps. */ +#define TWI_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps. */ +#define TWI_FREQUENCY_FREQUENCY_K400 (0x06680000UL) /*!< 400 kbps. */ + +/* Register: TWI_ADDRESS */ +/* Description: Address used in the two-wire transfer. */ + +/* Bits 6..0 : Two-wire address. */ +#define TWI_ADDRESS_ADDRESS_Pos (0UL) /*!< Position of ADDRESS field. */ +#define TWI_ADDRESS_ADDRESS_Msk (0x7FUL << TWI_ADDRESS_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ + +/* Register: TWI_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define TWI_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define TWI_POWER_POWER_Msk (0x1UL << TWI_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define TWI_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define TWI_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: UART */ +/* Description: Universal Asynchronous Receiver/Transmitter. */ + +/* Register: UART_SHORTS */ +/* Description: Shortcuts for UART. */ + +/* Bit 4 : Shortcut between NCTS event and STOPRX task. */ +#define UART_SHORTS_NCTS_STOPRX_Pos (4UL) /*!< Position of NCTS_STOPRX field. */ +#define UART_SHORTS_NCTS_STOPRX_Msk (0x1UL << UART_SHORTS_NCTS_STOPRX_Pos) /*!< Bit mask of NCTS_STOPRX field. */ +#define UART_SHORTS_NCTS_STOPRX_Disabled (0UL) /*!< Shortcut disabled. */ +#define UART_SHORTS_NCTS_STOPRX_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Bit 3 : Shortcut between CTS event and STARTRX task. */ +#define UART_SHORTS_CTS_STARTRX_Pos (3UL) /*!< Position of CTS_STARTRX field. */ +#define UART_SHORTS_CTS_STARTRX_Msk (0x1UL << UART_SHORTS_CTS_STARTRX_Pos) /*!< Bit mask of CTS_STARTRX field. */ +#define UART_SHORTS_CTS_STARTRX_Disabled (0UL) /*!< Shortcut disabled. */ +#define UART_SHORTS_CTS_STARTRX_Enabled (1UL) /*!< Shortcut enabled. */ + +/* Register: UART_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 17 : Enable interrupt on RXTO event. */ +#define UART_INTENSET_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UART_INTENSET_RXTO_Msk (0x1UL << UART_INTENSET_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UART_INTENSET_RXTO_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENSET_RXTO_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENSET_RXTO_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 9 : Enable interrupt on ERROR event. */ +#define UART_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UART_INTENSET_ERROR_Msk (0x1UL << UART_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UART_INTENSET_ERROR_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENSET_ERROR_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENSET_ERROR_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 7 : Enable interrupt on TXRDY event. */ +#define UART_INTENSET_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UART_INTENSET_TXDRDY_Msk (0x1UL << UART_INTENSET_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UART_INTENSET_TXDRDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENSET_TXDRDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENSET_TXDRDY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 2 : Enable interrupt on RXRDY event. */ +#define UART_INTENSET_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UART_INTENSET_RXDRDY_Msk (0x1UL << UART_INTENSET_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UART_INTENSET_RXDRDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENSET_RXDRDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENSET_RXDRDY_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 1 : Enable interrupt on NCTS event. */ +#define UART_INTENSET_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UART_INTENSET_NCTS_Msk (0x1UL << UART_INTENSET_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UART_INTENSET_NCTS_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENSET_NCTS_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENSET_NCTS_Set (1UL) /*!< Enable interrupt on write. */ + +/* Bit 0 : Enable interrupt on CTS event. */ +#define UART_INTENSET_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UART_INTENSET_CTS_Msk (0x1UL << UART_INTENSET_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UART_INTENSET_CTS_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENSET_CTS_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENSET_CTS_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: UART_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 17 : Disable interrupt on RXTO event. */ +#define UART_INTENCLR_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UART_INTENCLR_RXTO_Msk (0x1UL << UART_INTENCLR_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UART_INTENCLR_RXTO_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENCLR_RXTO_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENCLR_RXTO_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 9 : Disable interrupt on ERROR event. */ +#define UART_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UART_INTENCLR_ERROR_Msk (0x1UL << UART_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UART_INTENCLR_ERROR_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENCLR_ERROR_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENCLR_ERROR_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 7 : Disable interrupt on TXRDY event. */ +#define UART_INTENCLR_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UART_INTENCLR_TXDRDY_Msk (0x1UL << UART_INTENCLR_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UART_INTENCLR_TXDRDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENCLR_TXDRDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENCLR_TXDRDY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 2 : Disable interrupt on RXRDY event. */ +#define UART_INTENCLR_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UART_INTENCLR_RXDRDY_Msk (0x1UL << UART_INTENCLR_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UART_INTENCLR_RXDRDY_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENCLR_RXDRDY_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENCLR_RXDRDY_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 1 : Disable interrupt on NCTS event. */ +#define UART_INTENCLR_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UART_INTENCLR_NCTS_Msk (0x1UL << UART_INTENCLR_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UART_INTENCLR_NCTS_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENCLR_NCTS_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENCLR_NCTS_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Bit 0 : Disable interrupt on CTS event. */ +#define UART_INTENCLR_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UART_INTENCLR_CTS_Msk (0x1UL << UART_INTENCLR_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UART_INTENCLR_CTS_Disabled (0UL) /*!< Interrupt disabled. */ +#define UART_INTENCLR_CTS_Enabled (1UL) /*!< Interrupt enabled. */ +#define UART_INTENCLR_CTS_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: UART_ERRORSRC */ +/* Description: Error source. Write error field to 1 to clear error. */ + +/* Bit 3 : The serial data input is '0' for longer than the length of a data frame. */ +#define UART_ERRORSRC_BREAK_Pos (3UL) /*!< Position of BREAK field. */ +#define UART_ERRORSRC_BREAK_Msk (0x1UL << UART_ERRORSRC_BREAK_Pos) /*!< Bit mask of BREAK field. */ +#define UART_ERRORSRC_BREAK_NotPresent (0UL) /*!< Error not present. */ +#define UART_ERRORSRC_BREAK_Present (1UL) /*!< Error present. */ +#define UART_ERRORSRC_BREAK_Clear (1UL) /*!< Clear error on write. */ + +/* Bit 2 : A valid stop bit is not detected on the serial data input after all bits in a character have been received. */ +#define UART_ERRORSRC_FRAMING_Pos (2UL) /*!< Position of FRAMING field. */ +#define UART_ERRORSRC_FRAMING_Msk (0x1UL << UART_ERRORSRC_FRAMING_Pos) /*!< Bit mask of FRAMING field. */ +#define UART_ERRORSRC_FRAMING_NotPresent (0UL) /*!< Error not present. */ +#define UART_ERRORSRC_FRAMING_Present (1UL) /*!< Error present. */ +#define UART_ERRORSRC_FRAMING_Clear (1UL) /*!< Clear error on write. */ + +/* Bit 1 : A character with bad parity is received. Only checked if HW parity control is enabled. */ +#define UART_ERRORSRC_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UART_ERRORSRC_PARITY_Msk (0x1UL << UART_ERRORSRC_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UART_ERRORSRC_PARITY_NotPresent (0UL) /*!< Error not present. */ +#define UART_ERRORSRC_PARITY_Present (1UL) /*!< Error present. */ +#define UART_ERRORSRC_PARITY_Clear (1UL) /*!< Clear error on write. */ + +/* Bit 0 : A start bit is received while the previous data still lies in RXD. (Data loss). */ +#define UART_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define UART_ERRORSRC_OVERRUN_Msk (0x1UL << UART_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define UART_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Error not present. */ +#define UART_ERRORSRC_OVERRUN_Present (1UL) /*!< Error present. */ +#define UART_ERRORSRC_OVERRUN_Clear (1UL) /*!< Clear error on write. */ + +/* Register: UART_ENABLE */ +/* Description: Enable UART and acquire IOs. */ + +/* Bits 2..0 : Enable or disable UART and acquire IOs. */ +#define UART_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define UART_ENABLE_ENABLE_Msk (0x7UL << UART_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define UART_ENABLE_ENABLE_Disabled (0x00UL) /*!< UART disabled. */ +#define UART_ENABLE_ENABLE_Enabled (0x04UL) /*!< UART enabled. */ + +/* Register: UART_RXD */ +/* Description: RXD register. On read action the buffer pointer is displaced. Once read the character is consumed. If read when no character available, the UART will stop working. */ + +/* Bits 7..0 : RX data from previous transfer. Double buffered. */ +#define UART_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define UART_RXD_RXD_Msk (0xFFUL << UART_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: UART_TXD */ +/* Description: TXD register. */ + +/* Bits 7..0 : TX data for transfer. */ +#define UART_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define UART_TXD_TXD_Msk (0xFFUL << UART_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: UART_BAUDRATE */ +/* Description: UART Baudrate. */ + +/* Bits 31..0 : UART baudrate. */ +#define UART_BAUDRATE_BAUDRATE_Pos (0UL) /*!< Position of BAUDRATE field. */ +#define UART_BAUDRATE_BAUDRATE_Msk (0xFFFFFFFFUL << UART_BAUDRATE_BAUDRATE_Pos) /*!< Bit mask of BAUDRATE field. */ +#define UART_BAUDRATE_BAUDRATE_Baud1200 (0x0004F000UL) /*!< 1200 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud2400 (0x0009D000UL) /*!< 2400 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud4800 (0x0013B000UL) /*!< 4800 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud9600 (0x00275000UL) /*!< 9600 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud14400 (0x003B0000UL) /*!< 14400 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud19200 (0x004EA000UL) /*!< 19200 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud28800 (0x0075F000UL) /*!< 28800 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud38400 (0x009D5000UL) /*!< 38400 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud57600 (0x00EBF000UL) /*!< 57600 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud76800 (0x013A9000UL) /*!< 76800 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud115200 (0x01D7E000UL) /*!< 115200 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud230400 (0x03AFB000UL) /*!< 230400 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud250000 (0x04000000UL) /*!< 250000 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud460800 (0x075F7000UL) /*!< 460800 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud921600 (0x0EBED000UL) /*!< 921600 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud1M (0x10000000UL) /*!< 1M baud. */ + +/* Register: UART_CONFIG */ +/* Description: Configuration of parity and hardware flow control register. */ + +/* Bits 3..1 : Include parity bit. */ +#define UART_CONFIG_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UART_CONFIG_PARITY_Msk (0x7UL << UART_CONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UART_CONFIG_PARITY_Excluded (0UL) /*!< Parity bit excluded. */ +#define UART_CONFIG_PARITY_Included (7UL) /*!< Parity bit included. */ + +/* Bit 0 : Hardware flow control. */ +#define UART_CONFIG_HWFC_Pos (0UL) /*!< Position of HWFC field. */ +#define UART_CONFIG_HWFC_Msk (0x1UL << UART_CONFIG_HWFC_Pos) /*!< Bit mask of HWFC field. */ +#define UART_CONFIG_HWFC_Disabled (0UL) /*!< Hardware flow control disabled. */ +#define UART_CONFIG_HWFC_Enabled (1UL) /*!< Hardware flow control enabled. */ + +/* Register: UART_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define UART_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define UART_POWER_POWER_Msk (0x1UL << UART_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define UART_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define UART_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/* Peripheral: UICR */ +/* Description: User Information Configuration. */ + +/* Register: UICR_RBPCONF */ +/* Description: Readback protection configuration. */ + +/* Bits 15..8 : Readback protect all code in the device. */ +#define UICR_RBPCONF_PALL_Pos (8UL) /*!< Position of PALL field. */ +#define UICR_RBPCONF_PALL_Msk (0xFFUL << UICR_RBPCONF_PALL_Pos) /*!< Bit mask of PALL field. */ +#define UICR_RBPCONF_PALL_Enabled (0x00UL) /*!< Enabled. */ +#define UICR_RBPCONF_PALL_Disabled (0xFFUL) /*!< Disabled. */ + +/* Bits 7..0 : Readback protect region 0. Will be ignored if pre-programmed factory code is present on the chip. */ +#define UICR_RBPCONF_PR0_Pos (0UL) /*!< Position of PR0 field. */ +#define UICR_RBPCONF_PR0_Msk (0xFFUL << UICR_RBPCONF_PR0_Pos) /*!< Bit mask of PR0 field. */ +#define UICR_RBPCONF_PR0_Enabled (0x00UL) /*!< Enabled. */ +#define UICR_RBPCONF_PR0_Disabled (0xFFUL) /*!< Disabled. */ + +/* Register: UICR_XTALFREQ */ +/* Description: Reset value for CLOCK XTALFREQ register. */ + +/* Bits 7..0 : Reset value for CLOCK XTALFREQ register. */ +#define UICR_XTALFREQ_XTALFREQ_Pos (0UL) /*!< Position of XTALFREQ field. */ +#define UICR_XTALFREQ_XTALFREQ_Msk (0xFFUL << UICR_XTALFREQ_XTALFREQ_Pos) /*!< Bit mask of XTALFREQ field. */ +#define UICR_XTALFREQ_XTALFREQ_32MHz (0x00UL) /*!< 32MHz Xtal is used. */ +#define UICR_XTALFREQ_XTALFREQ_16MHz (0xFFUL) /*!< 16MHz Xtal is used. */ + +/* Register: UICR_FWID */ +/* Description: Firmware ID. */ + +/* Bits 15..0 : Identification number for the firmware loaded into the chip. */ +#define UICR_FWID_FWID_Pos (0UL) /*!< Position of FWID field. */ +#define UICR_FWID_FWID_Msk (0xFFFFUL << UICR_FWID_FWID_Pos) /*!< Bit mask of FWID field. */ + + +/* Peripheral: WDT */ +/* Description: Watchdog Timer. */ + +/* Register: WDT_INTENSET */ +/* Description: Interrupt enable set register. */ + +/* Bit 0 : Enable interrupt on TIMEOUT event. */ +#define WDT_INTENSET_TIMEOUT_Pos (0UL) /*!< Position of TIMEOUT field. */ +#define WDT_INTENSET_TIMEOUT_Msk (0x1UL << WDT_INTENSET_TIMEOUT_Pos) /*!< Bit mask of TIMEOUT field. */ +#define WDT_INTENSET_TIMEOUT_Disabled (0UL) /*!< Interrupt disabled. */ +#define WDT_INTENSET_TIMEOUT_Enabled (1UL) /*!< Interrupt enabled. */ +#define WDT_INTENSET_TIMEOUT_Set (1UL) /*!< Enable interrupt on write. */ + +/* Register: WDT_INTENCLR */ +/* Description: Interrupt enable clear register. */ + +/* Bit 0 : Disable interrupt on TIMEOUT event. */ +#define WDT_INTENCLR_TIMEOUT_Pos (0UL) /*!< Position of TIMEOUT field. */ +#define WDT_INTENCLR_TIMEOUT_Msk (0x1UL << WDT_INTENCLR_TIMEOUT_Pos) /*!< Bit mask of TIMEOUT field. */ +#define WDT_INTENCLR_TIMEOUT_Disabled (0UL) /*!< Interrupt disabled. */ +#define WDT_INTENCLR_TIMEOUT_Enabled (1UL) /*!< Interrupt enabled. */ +#define WDT_INTENCLR_TIMEOUT_Clear (1UL) /*!< Disable interrupt on write. */ + +/* Register: WDT_RUNSTATUS */ +/* Description: Watchdog running status. */ + +/* Bit 0 : Watchdog running status. */ +#define WDT_RUNSTATUS_RUNSTATUS_Pos (0UL) /*!< Position of RUNSTATUS field. */ +#define WDT_RUNSTATUS_RUNSTATUS_Msk (0x1UL << WDT_RUNSTATUS_RUNSTATUS_Pos) /*!< Bit mask of RUNSTATUS field. */ +#define WDT_RUNSTATUS_RUNSTATUS_NotRunning (0UL) /*!< Watchdog timer is not running. */ +#define WDT_RUNSTATUS_RUNSTATUS_Running (1UL) /*!< Watchdog timer is running. */ + +/* Register: WDT_REQSTATUS */ +/* Description: Request status. */ + +/* Bit 7 : Request status for RR[7]. */ +#define WDT_REQSTATUS_RR7_Pos (7UL) /*!< Position of RR7 field. */ +#define WDT_REQSTATUS_RR7_Msk (0x1UL << WDT_REQSTATUS_RR7_Pos) /*!< Bit mask of RR7 field. */ +#define WDT_REQSTATUS_RR7_DisabledOrRequested (0UL) /*!< RR[7] register is not enabled or has already requested reload. */ +#define WDT_REQSTATUS_RR7_EnabledAndUnrequested (1UL) /*!< RR[7] register is enabled and has not jet requested. */ + +/* Bit 6 : Request status for RR[6]. */ +#define WDT_REQSTATUS_RR6_Pos (6UL) /*!< Position of RR6 field. */ +#define WDT_REQSTATUS_RR6_Msk (0x1UL << WDT_REQSTATUS_RR6_Pos) /*!< Bit mask of RR6 field. */ +#define WDT_REQSTATUS_RR6_DisabledOrRequested (0UL) /*!< RR[6] register is not enabled or has already requested reload. */ +#define WDT_REQSTATUS_RR6_EnabledAndUnrequested (1UL) /*!< RR[6] register is enabled and has not jet requested. */ + +/* Bit 5 : Request status for RR[5]. */ +#define WDT_REQSTATUS_RR5_Pos (5UL) /*!< Position of RR5 field. */ +#define WDT_REQSTATUS_RR5_Msk (0x1UL << WDT_REQSTATUS_RR5_Pos) /*!< Bit mask of RR5 field. */ +#define WDT_REQSTATUS_RR5_DisabledOrRequested (0UL) /*!< RR[5] register is not enabled or has already requested reload. */ +#define WDT_REQSTATUS_RR5_EnabledAndUnrequested (1UL) /*!< RR[5] register is enabled and has not jet requested. */ + +/* Bit 4 : Request status for RR[4]. */ +#define WDT_REQSTATUS_RR4_Pos (4UL) /*!< Position of RR4 field. */ +#define WDT_REQSTATUS_RR4_Msk (0x1UL << WDT_REQSTATUS_RR4_Pos) /*!< Bit mask of RR4 field. */ +#define WDT_REQSTATUS_RR4_DisabledOrRequested (0UL) /*!< RR[4] register is not enabled or has already requested reload. */ +#define WDT_REQSTATUS_RR4_EnabledAndUnrequested (1UL) /*!< RR[4] register is enabled and has not jet requested. */ + +/* Bit 3 : Request status for RR[3]. */ +#define WDT_REQSTATUS_RR3_Pos (3UL) /*!< Position of RR3 field. */ +#define WDT_REQSTATUS_RR3_Msk (0x1UL << WDT_REQSTATUS_RR3_Pos) /*!< Bit mask of RR3 field. */ +#define WDT_REQSTATUS_RR3_DisabledOrRequested (0UL) /*!< RR[3] register is not enabled or has already requested reload. */ +#define WDT_REQSTATUS_RR3_EnabledAndUnrequested (1UL) /*!< RR[3] register is enabled and has not jet requested. */ + +/* Bit 2 : Request status for RR[2]. */ +#define WDT_REQSTATUS_RR2_Pos (2UL) /*!< Position of RR2 field. */ +#define WDT_REQSTATUS_RR2_Msk (0x1UL << WDT_REQSTATUS_RR2_Pos) /*!< Bit mask of RR2 field. */ +#define WDT_REQSTATUS_RR2_DisabledOrRequested (0UL) /*!< RR[2] register is not enabled or has already requested reload. */ +#define WDT_REQSTATUS_RR2_EnabledAndUnrequested (1UL) /*!< RR[2] register is enabled and has not jet requested. */ + +/* Bit 1 : Request status for RR[1]. */ +#define WDT_REQSTATUS_RR1_Pos (1UL) /*!< Position of RR1 field. */ +#define WDT_REQSTATUS_RR1_Msk (0x1UL << WDT_REQSTATUS_RR1_Pos) /*!< Bit mask of RR1 field. */ +#define WDT_REQSTATUS_RR1_DisabledOrRequested (0UL) /*!< RR[1] register is not enabled or has already requested reload. */ +#define WDT_REQSTATUS_RR1_EnabledAndUnrequested (1UL) /*!< RR[1] register is enabled and has not jet requested. */ + +/* Bit 0 : Request status for RR[0]. */ +#define WDT_REQSTATUS_RR0_Pos (0UL) /*!< Position of RR0 field. */ +#define WDT_REQSTATUS_RR0_Msk (0x1UL << WDT_REQSTATUS_RR0_Pos) /*!< Bit mask of RR0 field. */ +#define WDT_REQSTATUS_RR0_DisabledOrRequested (0UL) /*!< RR[0] register is not enabled or has already requested reload. */ +#define WDT_REQSTATUS_RR0_EnabledAndUnrequested (1UL) /*!< RR[0] register is enabled and has not jet requested. */ + +/* Register: WDT_RREN */ +/* Description: Reload request enable. */ + +/* Bit 7 : Enable or disable RR[7] register. */ +#define WDT_RREN_RR7_Pos (7UL) /*!< Position of RR7 field. */ +#define WDT_RREN_RR7_Msk (0x1UL << WDT_RREN_RR7_Pos) /*!< Bit mask of RR7 field. */ +#define WDT_RREN_RR7_Disabled (0UL) /*!< RR[7] register is disabled. */ +#define WDT_RREN_RR7_Enabled (1UL) /*!< RR[7] register is enabled. */ + +/* Bit 6 : Enable or disable RR[6] register. */ +#define WDT_RREN_RR6_Pos (6UL) /*!< Position of RR6 field. */ +#define WDT_RREN_RR6_Msk (0x1UL << WDT_RREN_RR6_Pos) /*!< Bit mask of RR6 field. */ +#define WDT_RREN_RR6_Disabled (0UL) /*!< RR[6] register is disabled. */ +#define WDT_RREN_RR6_Enabled (1UL) /*!< RR[6] register is enabled. */ + +/* Bit 5 : Enable or disable RR[5] register. */ +#define WDT_RREN_RR5_Pos (5UL) /*!< Position of RR5 field. */ +#define WDT_RREN_RR5_Msk (0x1UL << WDT_RREN_RR5_Pos) /*!< Bit mask of RR5 field. */ +#define WDT_RREN_RR5_Disabled (0UL) /*!< RR[5] register is disabled. */ +#define WDT_RREN_RR5_Enabled (1UL) /*!< RR[5] register is enabled. */ + +/* Bit 4 : Enable or disable RR[4] register. */ +#define WDT_RREN_RR4_Pos (4UL) /*!< Position of RR4 field. */ +#define WDT_RREN_RR4_Msk (0x1UL << WDT_RREN_RR4_Pos) /*!< Bit mask of RR4 field. */ +#define WDT_RREN_RR4_Disabled (0UL) /*!< RR[4] register is disabled. */ +#define WDT_RREN_RR4_Enabled (1UL) /*!< RR[4] register is enabled. */ + +/* Bit 3 : Enable or disable RR[3] register. */ +#define WDT_RREN_RR3_Pos (3UL) /*!< Position of RR3 field. */ +#define WDT_RREN_RR3_Msk (0x1UL << WDT_RREN_RR3_Pos) /*!< Bit mask of RR3 field. */ +#define WDT_RREN_RR3_Disabled (0UL) /*!< RR[3] register is disabled. */ +#define WDT_RREN_RR3_Enabled (1UL) /*!< RR[3] register is enabled. */ + +/* Bit 2 : Enable or disable RR[2] register. */ +#define WDT_RREN_RR2_Pos (2UL) /*!< Position of RR2 field. */ +#define WDT_RREN_RR2_Msk (0x1UL << WDT_RREN_RR2_Pos) /*!< Bit mask of RR2 field. */ +#define WDT_RREN_RR2_Disabled (0UL) /*!< RR[2] register is disabled. */ +#define WDT_RREN_RR2_Enabled (1UL) /*!< RR[2] register is enabled. */ + +/* Bit 1 : Enable or disable RR[1] register. */ +#define WDT_RREN_RR1_Pos (1UL) /*!< Position of RR1 field. */ +#define WDT_RREN_RR1_Msk (0x1UL << WDT_RREN_RR1_Pos) /*!< Bit mask of RR1 field. */ +#define WDT_RREN_RR1_Disabled (0UL) /*!< RR[1] register is disabled. */ +#define WDT_RREN_RR1_Enabled (1UL) /*!< RR[1] register is enabled. */ + +/* Bit 0 : Enable or disable RR[0] register. */ +#define WDT_RREN_RR0_Pos (0UL) /*!< Position of RR0 field. */ +#define WDT_RREN_RR0_Msk (0x1UL << WDT_RREN_RR0_Pos) /*!< Bit mask of RR0 field. */ +#define WDT_RREN_RR0_Disabled (0UL) /*!< RR[0] register is disabled. */ +#define WDT_RREN_RR0_Enabled (1UL) /*!< RR[0] register is enabled. */ + +/* Register: WDT_CONFIG */ +/* Description: Configuration register. */ + +/* Bit 3 : Configure the watchdog to pause or not while the CPU is halted by the debugger. */ +#define WDT_CONFIG_HALT_Pos (3UL) /*!< Position of HALT field. */ +#define WDT_CONFIG_HALT_Msk (0x1UL << WDT_CONFIG_HALT_Pos) /*!< Bit mask of HALT field. */ +#define WDT_CONFIG_HALT_Pause (0UL) /*!< Pause watchdog while the CPU is halted by the debugger. */ +#define WDT_CONFIG_HALT_Run (1UL) /*!< Do not pause watchdog while the CPU is halted by the debugger. */ + +/* Bit 0 : Configure the watchdog to pause or not while the CPU is sleeping. */ +#define WDT_CONFIG_SLEEP_Pos (0UL) /*!< Position of SLEEP field. */ +#define WDT_CONFIG_SLEEP_Msk (0x1UL << WDT_CONFIG_SLEEP_Pos) /*!< Bit mask of SLEEP field. */ +#define WDT_CONFIG_SLEEP_Pause (0UL) /*!< Pause watchdog while the CPU is asleep. */ +#define WDT_CONFIG_SLEEP_Run (1UL) /*!< Do not pause watchdog while the CPU is asleep. */ + +/* Register: WDT_RR */ +/* Description: Reload requests registers. */ + +/* Bits 31..0 : Reload register. */ +#define WDT_RR_RR_Pos (0UL) /*!< Position of RR field. */ +#define WDT_RR_RR_Msk (0xFFFFFFFFUL << WDT_RR_RR_Pos) /*!< Bit mask of RR field. */ +#define WDT_RR_RR_Reload (0x6E524635UL) /*!< Value to request a reload of the watchdog timer. */ + +/* Register: WDT_POWER */ +/* Description: Peripheral power control. */ + +/* Bit 0 : Peripheral power control. */ +#define WDT_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define WDT_POWER_POWER_Msk (0x1UL << WDT_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define WDT_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ +#define WDT_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ + + +/*lint --flb "Leave library region" */ +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_deprecated.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_deprecated.h new file mode 100644 index 0000000000..81bd149663 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_deprecated.h @@ -0,0 +1,447 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF51_DEPRECATED_H +#define NRF51_DEPRECATED_H + +/*lint ++flb "Enter library region */ + +/* This file is given to prevent your SW from not compiling with the updates made to nrf51.h and + * nrf51_bitfields.h. The macros defined in this file were available previously. Do not use these + * macros on purpose. Use the ones defined in nrf51.h and nrf51_bitfields.h instead. + */ + +/* NVMC */ +/* The register ERASEPROTECTEDPAGE is called ERASEPCR0 in the documentation. */ +#define ERASEPROTECTEDPAGE ERASEPCR0 + + +/* LPCOMP */ +/* The interrupt ISR was renamed. Adding old name to the macros. */ +#define LPCOMP_COMP_IRQHandler LPCOMP_IRQHandler +#define LPCOMP_COMP_IRQn LPCOMP_IRQn + + +/* MPU */ +/* The field MPU.PERR0.LPCOMP_COMP was renamed. Added into deprecated in case somebody was using the macros defined for it. */ +#define MPU_PERR0_LPCOMP_COMP_Pos MPU_PERR0_LPCOMP_Pos +#define MPU_PERR0_LPCOMP_COMP_Msk MPU_PERR0_LPCOMP_Msk +#define MPU_PERR0_LPCOMP_COMP_InRegion1 MPU_PERR0_LPCOMP_InRegion1 +#define MPU_PERR0_LPCOMP_COMP_InRegion0 MPU_PERR0_LPCOMP_InRegion0 + + +/* POWER */ +/* The field POWER.RAMON.OFFRAM3 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */ +#define POWER_RAMON_OFFRAM3_Pos (19UL) +#define POWER_RAMON_OFFRAM3_Msk (0x1UL << POWER_RAMON_OFFRAM3_Pos) +#define POWER_RAMON_OFFRAM3_RAM3Off (0UL) +#define POWER_RAMON_OFFRAM3_RAM3On (1UL) +/* The field POWER.RAMON.OFFRAM2 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */ +#define POWER_RAMON_OFFRAM2_Pos (18UL) +#define POWER_RAMON_OFFRAM2_Msk (0x1UL << POWER_RAMON_OFFRAM2_Pos) +#define POWER_RAMON_OFFRAM2_RAM2Off (0UL) +#define POWER_RAMON_OFFRAM2_RAM2On (1UL) +/* The field POWER.RAMON.ONRAM3 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */ +#define POWER_RAMON_ONRAM3_Pos (3UL) +#define POWER_RAMON_ONRAM3_Msk (0x1UL << POWER_RAMON_ONRAM3_Pos) +#define POWER_RAMON_ONRAM3_RAM3Off (0UL) +#define POWER_RAMON_ONRAM3_RAM3On (1UL) +/* The field POWER.RAMON.ONRAM2 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */ +#define POWER_RAMON_ONRAM2_Pos (2UL) +#define POWER_RAMON_ONRAM2_Msk (0x1UL << POWER_RAMON_ONRAM2_Pos) +#define POWER_RAMON_ONRAM2_RAM2Off (0UL) +#define POWER_RAMON_ONRAM2_RAM2On (1UL) + + +/* RADIO */ +/* The enumerated value RADIO.TXPOWER.TXPOWER.Neg40dBm was renamed. Added into deprecated with the new macro name. */ +#define RADIO_TXPOWER_TXPOWER_Neg40dBm RADIO_TXPOWER_TXPOWER_Neg30dBm +/* The name of the field SKIPADDR was corrected. Old macros added for compatibility. */ +#define RADIO_CRCCNF_SKIP_ADDR_Pos RADIO_CRCCNF_SKIPADDR_Pos +#define RADIO_CRCCNF_SKIP_ADDR_Msk RADIO_CRCCNF_SKIPADDR_Msk +#define RADIO_CRCCNF_SKIP_ADDR_Include RADIO_CRCCNF_SKIPADDR_Include +#define RADIO_CRCCNF_SKIP_ADDR_Skip RADIO_CRCCNF_SKIPADDR_Skip +/* The name of the field PLLLOCK was corrected. Old macros added for compatibility. */ +#define RADIO_TEST_PLL_LOCK_Pos RADIO_TEST_PLLLOCK_Pos +#define RADIO_TEST_PLL_LOCK_Msk RADIO_TEST_PLLLOCK_Msk +#define RADIO_TEST_PLL_LOCK_Disabled RADIO_TEST_PLLLOCK_Disabled +#define RADIO_TEST_PLL_LOCK_Enabled RADIO_TEST_PLLLOCK_Enabled +/* The name of the field CONSTCARRIER was corrected. Old macros added for compatibility. */ +#define RADIO_TEST_CONST_CARRIER_Pos RADIO_TEST_CONSTCARRIER_Pos +#define RADIO_TEST_CONST_CARRIER_Msk RADIO_TEST_CONSTCARRIER_Msk +#define RADIO_TEST_CONST_CARRIER_Disabled RADIO_TEST_CONSTCARRIER_Disabled +#define RADIO_TEST_CONST_CARRIER_Enabled RADIO_TEST_CONSTCARRIER_Enabled + + +/* FICR */ +/* The registers FICR.SIZERAMBLOCK0, FICR.SIZERAMBLOCK1, FICR.SIZERAMBLOCK2 and FICR.SIZERAMBLOCK3 were renamed into an array. */ +#define SIZERAMBLOCK0 SIZERAMBLOCKS +#define SIZERAMBLOCK1 SIZERAMBLOCKS +#define SIZERAMBLOCK2 SIZERAMBLOCK[2] /*!< Note that this macro will disapear when SIZERAMBLOCK array is eliminated. SIZERAMBLOCK is a deprecated array. */ +#define SIZERAMBLOCK3 SIZERAMBLOCK[3] /*!< Note that this macro will disapear when SIZERAMBLOCK array is eliminated. SIZERAMBLOCK is a deprecated array. */ +/* The registers FICR.DEVICEID0 and FICR.DEVICEID1 were renamed into an array. */ +#define DEVICEID0 DEVICEID[0] +#define DEVICEID1 DEVICEID[1] +/* The registers FICR.ER0, FICR.ER1, FICR.ER2 and FICR.ER3 were renamed into an array. */ +#define ER0 ER[0] +#define ER1 ER[1] +#define ER2 ER[2] +#define ER3 ER[3] +/* The registers FICR.IR0, FICR.IR1, FICR.IR2 and FICR.IR3 were renamed into an array. */ +#define IR0 IR[0] +#define IR1 IR[1] +#define IR2 IR[2] +#define IR3 IR[3] +/* The registers FICR.DEVICEADDR0 and FICR.DEVICEADDR1 were renamed into an array. */ +#define DEVICEADDR0 DEVICEADDR[0] +#define DEVICEADDR1 DEVICEADDR[1] + + +/* PPI */ +/* The tasks PPI.TASKS_CHGxEN and PPI.TASKS_CHGxDIS were renamed into an array of structs. */ +#define TASKS_CHG0EN TASKS_CHG[0].EN +#define TASKS_CHG0DIS TASKS_CHG[0].DIS +#define TASKS_CHG1EN TASKS_CHG[1].EN +#define TASKS_CHG1DIS TASKS_CHG[1].DIS +#define TASKS_CHG2EN TASKS_CHG[2].EN +#define TASKS_CHG2DIS TASKS_CHG[2].DIS +#define TASKS_CHG3EN TASKS_CHG[3].EN +#define TASKS_CHG3DIS TASKS_CHG[3].DIS +/* The registers PPI.CHx_EEP and PPI.CHx_TEP were renamed into an array of structs. */ +#define CH0_EEP CH[0].EEP +#define CH0_TEP CH[0].TEP +#define CH1_EEP CH[1].EEP +#define CH1_TEP CH[1].TEP +#define CH2_EEP CH[2].EEP +#define CH2_TEP CH[2].TEP +#define CH3_EEP CH[3].EEP +#define CH3_TEP CH[3].TEP +#define CH4_EEP CH[4].EEP +#define CH4_TEP CH[4].TEP +#define CH5_EEP CH[5].EEP +#define CH5_TEP CH[5].TEP +#define CH6_EEP CH[6].EEP +#define CH6_TEP CH[6].TEP +#define CH7_EEP CH[7].EEP +#define CH7_TEP CH[7].TEP +#define CH8_EEP CH[8].EEP +#define CH8_TEP CH[8].TEP +#define CH9_EEP CH[9].EEP +#define CH9_TEP CH[9].TEP +#define CH10_EEP CH[10].EEP +#define CH10_TEP CH[10].TEP +#define CH11_EEP CH[11].EEP +#define CH11_TEP CH[11].TEP +#define CH12_EEP CH[12].EEP +#define CH12_TEP CH[12].TEP +#define CH13_EEP CH[13].EEP +#define CH13_TEP CH[13].TEP +#define CH14_EEP CH[14].EEP +#define CH14_TEP CH[14].TEP +#define CH15_EEP CH[15].EEP +#define CH15_TEP CH[15].TEP +/* The registers PPI.CHG0, PPI.CHG1, PPI.CHG2 and PPI.CHG3 were renamed into an array. */ +#define CHG0 CHG[0] +#define CHG1 CHG[1] +#define CHG2 CHG[2] +#define CHG3 CHG[3] +/* All bitfield macros for the CHGx registers therefore changed name. */ +#define PPI_CHG0_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG0_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG0_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG0_CH15_Included PPI_CHG_CH15_Included +#define PPI_CHG0_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG0_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG0_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG0_CH14_Included PPI_CHG_CH14_Included +#define PPI_CHG0_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG0_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG0_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG0_CH13_Included PPI_CHG_CH13_Included +#define PPI_CHG0_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG0_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG0_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG0_CH12_Included PPI_CHG_CH12_Included +#define PPI_CHG0_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG0_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG0_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG0_CH11_Included PPI_CHG_CH11_Included +#define PPI_CHG0_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG0_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG0_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG0_CH10_Included PPI_CHG_CH10_Included +#define PPI_CHG0_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG0_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG0_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG0_CH9_Included PPI_CHG_CH9_Included +#define PPI_CHG0_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG0_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG0_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG0_CH8_Included PPI_CHG_CH8_Included +#define PPI_CHG0_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG0_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG0_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG0_CH7_Included PPI_CHG_CH7_Included +#define PPI_CHG0_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG0_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG0_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG0_CH6_Included PPI_CHG_CH6_Included +#define PPI_CHG0_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG0_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG0_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG0_CH5_Included PPI_CHG_CH5_Included +#define PPI_CHG0_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG0_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG0_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG0_CH4_Included PPI_CHG_CH4_Included +#define PPI_CHG0_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG0_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG0_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG0_CH3_Included PPI_CHG_CH3_Included +#define PPI_CHG0_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG0_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG0_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG0_CH2_Included PPI_CHG_CH2_Included +#define PPI_CHG0_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG0_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG0_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG0_CH1_Included PPI_CHG_CH1_Included +#define PPI_CHG0_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG0_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG0_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG0_CH0_Included PPI_CHG_CH0_Included +#define PPI_CHG1_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG1_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG1_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG1_CH15_Included PPI_CHG_CH15_Included +#define PPI_CHG1_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG1_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG1_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG1_CH14_Included PPI_CHG_CH14_Included +#define PPI_CHG1_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG1_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG1_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG1_CH13_Included PPI_CHG_CH13_Included +#define PPI_CHG1_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG1_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG1_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG1_CH12_Included PPI_CHG_CH12_Included +#define PPI_CHG1_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG1_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG1_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG1_CH11_Included PPI_CHG_CH11_Included +#define PPI_CHG1_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG1_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG1_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG1_CH10_Included PPI_CHG_CH10_Included +#define PPI_CHG1_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG1_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG1_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG1_CH9_Included PPI_CHG_CH9_Included +#define PPI_CHG1_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG1_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG1_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG1_CH8_Included PPI_CHG_CH8_Included +#define PPI_CHG1_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG1_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG1_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG1_CH7_Included PPI_CHG_CH7_Included +#define PPI_CHG1_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG1_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG1_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG1_CH6_Included PPI_CHG_CH6_Included +#define PPI_CHG1_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG1_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG1_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG1_CH5_Included PPI_CHG_CH5_Included +#define PPI_CHG1_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG1_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG1_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG1_CH4_Included PPI_CHG_CH4_Included +#define PPI_CHG1_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG1_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG1_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG1_CH3_Included PPI_CHG_CH3_Included +#define PPI_CHG1_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG1_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG1_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG1_CH2_Included PPI_CHG_CH2_Included +#define PPI_CHG1_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG1_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG1_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG1_CH1_Included PPI_CHG_CH1_Included +#define PPI_CHG1_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG1_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG1_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG1_CH0_Included PPI_CHG_CH0_Included +#define PPI_CHG2_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG2_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG2_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG2_CH15_Included PPI_CHG_CH15_Included +#define PPI_CHG2_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG2_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG2_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG2_CH14_Included PPI_CHG_CH14_Included +#define PPI_CHG2_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG2_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG2_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG2_CH13_Included PPI_CHG_CH13_Included +#define PPI_CHG2_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG2_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG2_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG2_CH12_Included PPI_CHG_CH12_Included +#define PPI_CHG2_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG2_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG2_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG2_CH11_Included PPI_CHG_CH11_Included +#define PPI_CHG2_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG2_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG2_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG2_CH10_Included PPI_CHG_CH10_Included +#define PPI_CHG2_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG2_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG2_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG2_CH9_Included PPI_CHG_CH9_Included +#define PPI_CHG2_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG2_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG2_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG2_CH8_Included PPI_CHG_CH8_Included +#define PPI_CHG2_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG2_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG2_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG2_CH7_Included PPI_CHG_CH7_Included +#define PPI_CHG2_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG2_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG2_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG2_CH6_Included PPI_CHG_CH6_Included +#define PPI_CHG2_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG2_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG2_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG2_CH5_Included PPI_CHG_CH5_Included +#define PPI_CHG2_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG2_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG2_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG2_CH4_Included PPI_CHG_CH4_Included +#define PPI_CHG2_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG2_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG2_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG2_CH3_Included PPI_CHG_CH3_Included +#define PPI_CHG2_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG2_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG2_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG2_CH2_Included PPI_CHG_CH2_Included +#define PPI_CHG2_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG2_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG2_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG2_CH1_Included PPI_CHG_CH1_Included +#define PPI_CHG2_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG2_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG2_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG2_CH0_Included PPI_CHG_CH0_Included +#define PPI_CHG3_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG3_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG3_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG3_CH15_Included PPI_CHG_CH15_Included +#define PPI_CHG3_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG3_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG3_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG3_CH14_Included PPI_CHG_CH14_Included +#define PPI_CHG3_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG3_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG3_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG3_CH13_Included PPI_CHG_CH13_Included +#define PPI_CHG3_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG3_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG3_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG3_CH12_Included PPI_CHG_CH12_Included +#define PPI_CHG3_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG3_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG3_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG3_CH11_Included PPI_CHG_CH11_Included +#define PPI_CHG3_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG3_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG3_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG3_CH10_Included PPI_CHG_CH10_Included +#define PPI_CHG3_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG3_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG3_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG3_CH9_Included PPI_CHG_CH9_Included +#define PPI_CHG3_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG3_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG3_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG3_CH8_Included PPI_CHG_CH8_Included +#define PPI_CHG3_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG3_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG3_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG3_CH7_Included PPI_CHG_CH7_Included +#define PPI_CHG3_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG3_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG3_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG3_CH6_Included PPI_CHG_CH6_Included +#define PPI_CHG3_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG3_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG3_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG3_CH5_Included PPI_CHG_CH5_Included +#define PPI_CHG3_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG3_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG3_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG3_CH4_Included PPI_CHG_CH4_Included +#define PPI_CHG3_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG3_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG3_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG3_CH3_Included PPI_CHG_CH3_Included +#define PPI_CHG3_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG3_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG3_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG3_CH2_Included PPI_CHG_CH2_Included +#define PPI_CHG3_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG3_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG3_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG3_CH1_Included PPI_CHG_CH1_Included +#define PPI_CHG3_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG3_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG3_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG3_CH0_Included PPI_CHG_CH0_Included + + + +/*lint --flb "Leave library region" */ + +#endif /* NRF51_DEPRECATED_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52.h new file mode 100644 index 0000000000..a74b165a2b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52.h @@ -0,0 +1,944 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF51_TO_NRF52_H +#define NRF51_TO_NRF52_H + +/*lint ++flb "Enter library region */ + +/* This file is given to prevent your SW from not compiling with the name changes between nRF51 and nRF52 devices. + * It redefines the old nRF51 names into the new ones as long as the functionality is still supported. If the + * functionality is gone, there old names are not define, so compilation will fail. Note that also includes macros + * from the nrf51_deprecated.h file. */ + + +/* IRQ */ +/* Several peripherals have been added to several indexes. Names of IRQ handlers and IRQ numbers have changed. */ +#define UART0_IRQHandler UARTE0_UART0_IRQHandler +#define SPI0_TWI0_IRQHandler SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler +#define SPI1_TWI1_IRQHandler SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler +#define ADC_IRQHandler SAADC_IRQHandler +#define LPCOMP_IRQHandler COMP_LPCOMP_IRQHandler +#define SWI0_IRQHandler SWI0_EGU0_IRQHandler +#define SWI1_IRQHandler SWI1_EGU1_IRQHandler +#define SWI2_IRQHandler SWI2_EGU2_IRQHandler +#define SWI3_IRQHandler SWI3_EGU3_IRQHandler +#define SWI4_IRQHandler SWI4_EGU4_IRQHandler +#define SWI5_IRQHandler SWI5_EGU5_IRQHandler + +#define UART0_IRQn UARTE0_UART0_IRQn +#define SPI0_TWI0_IRQn SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn +#define SPI1_TWI1_IRQn SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn +#define ADC_IRQn SAADC_IRQn +#define LPCOMP_IRQn COMP_LPCOMP_IRQn +#define SWI0_IRQn SWI0_EGU0_IRQn +#define SWI1_IRQn SWI1_EGU1_IRQn +#define SWI2_IRQn SWI2_EGU2_IRQn +#define SWI3_IRQn SWI3_EGU3_IRQn +#define SWI4_IRQn SWI4_EGU4_IRQn +#define SWI5_IRQn SWI5_EGU5_IRQn + + +/* UICR */ +/* Register RBPCONF was renamed to APPROTECT. */ +#define RBPCONF APPROTECT + +#define UICR_RBPCONF_PALL_Pos UICR_APPROTECT_PALL_Pos +#define UICR_RBPCONF_PALL_Msk UICR_APPROTECT_PALL_Msk +#define UICR_RBPCONF_PALL_Enabled UICR_APPROTECT_PALL_Enabled +#define UICR_RBPCONF_PALL_Disabled UICR_APPROTECT_PALL_Disabled + + +/* GPIO */ +/* GPIO port was renamed to P0. */ +#define NRF_GPIO NRF_P0 +#define NRF_GPIO_BASE NRF_P0_BASE + + +/* SPIS */ +/* The registers PSELSCK, PSELMISO, PSELMOSI, PSELCSN were restructured into a struct. */ +#define PSELSCK PSEL.SCK +#define PSELMISO PSEL.MISO +#define PSELMOSI PSEL.MOSI +#define PSELCSN PSEL.CSN + +/* The registers RXDPTR, MAXRX, AMOUNTRX were restructured into a struct */ +#define RXDPTR RXD.PTR +#define MAXRX RXD.MAXCNT +#define AMOUNTRX RXD.AMOUNT + +#define SPIS_MAXRX_MAXRX_Pos SPIS_RXD_MAXCNT_MAXCNT_Pos +#define SPIS_MAXRX_MAXRX_Msk SPIS_RXD_MAXCNT_MAXCNT_Msk + +#define SPIS_AMOUNTRX_AMOUNTRX_Pos SPIS_RXD_AMOUNT_AMOUNT_Pos +#define SPIS_AMOUNTRX_AMOUNTRX_Msk SPIS_RXD_AMOUNT_AMOUNT_Msk + +/* The registers TXDPTR, MAXTX, AMOUNTTX were restructured into a struct */ +#define TXDPTR TXD.PTR +#define MAXTX TXD.MAXCNT +#define AMOUNTTX TXD.AMOUNT + +#define SPIS_MAXTX_MAXTX_Pos SPIS_TXD_MAXCNT_MAXCNT_Pos +#define SPIS_MAXTX_MAXTX_Msk SPIS_TXD_MAXCNT_MAXCNT_Msk + +#define SPIS_AMOUNTTX_AMOUNTTX_Pos SPIS_TXD_AMOUNT_AMOUNT_Pos +#define SPIS_AMOUNTTX_AMOUNTTX_Msk SPIS_TXD_AMOUNT_AMOUNT_Msk + + +/* MPU */ +/* Part of MPU module was renamed BPROT, while the rest was eliminated. */ +#define NRF_MPU NRF_BPROT + +/* Register DISABLEINDEBUG macros were affected. */ +#define MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Pos +#define MPU_DISABLEINDEBUG_DISABLEINDEBUG_Msk BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Msk +#define MPU_DISABLEINDEBUG_DISABLEINDEBUG_Enabled BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Enabled +#define MPU_DISABLEINDEBUG_DISABLEINDEBUG_Disabled BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Disabled + +/* Registers PROTENSET0 and PROTENSET1 were affected and renamed as CONFIG0 and CONFIG1. */ +#define PROTENSET0 CONFIG0 +#define PROTENSET1 CONFIG1 + +#define MPU_PROTENSET1_PROTREG63_Pos BPROT_CONFIG1_REGION63_Pos +#define MPU_PROTENSET1_PROTREG63_Msk BPROT_CONFIG1_REGION63_Msk +#define MPU_PROTENSET1_PROTREG63_Disabled BPROT_CONFIG1_REGION63_Disabled +#define MPU_PROTENSET1_PROTREG63_Enabled BPROT_CONFIG1_REGION63_Enabled +#define MPU_PROTENSET1_PROTREG63_Set BPROT_CONFIG1_REGION63_Enabled + +#define MPU_PROTENSET1_PROTREG62_Pos BPROT_CONFIG1_REGION62_Pos +#define MPU_PROTENSET1_PROTREG62_Msk BPROT_CONFIG1_REGION62_Msk +#define MPU_PROTENSET1_PROTREG62_Disabled BPROT_CONFIG1_REGION62_Disabled +#define MPU_PROTENSET1_PROTREG62_Enabled BPROT_CONFIG1_REGION62_Enabled +#define MPU_PROTENSET1_PROTREG62_Set BPROT_CONFIG1_REGION62_Enabled + +#define MPU_PROTENSET1_PROTREG61_Pos BPROT_CONFIG1_REGION61_Pos +#define MPU_PROTENSET1_PROTREG61_Msk BPROT_CONFIG1_REGION61_Msk +#define MPU_PROTENSET1_PROTREG61_Disabled BPROT_CONFIG1_REGION61_Disabled +#define MPU_PROTENSET1_PROTREG61_Enabled BPROT_CONFIG1_REGION61_Enabled +#define MPU_PROTENSET1_PROTREG61_Set BPROT_CONFIG1_REGION61_Enabled + +#define MPU_PROTENSET1_PROTREG60_Pos BPROT_CONFIG1_REGION60_Pos +#define MPU_PROTENSET1_PROTREG60_Msk BPROT_CONFIG1_REGION60_Msk +#define MPU_PROTENSET1_PROTREG60_Disabled BPROT_CONFIG1_REGION60_Disabled +#define MPU_PROTENSET1_PROTREG60_Enabled BPROT_CONFIG1_REGION60_Enabled +#define MPU_PROTENSET1_PROTREG60_Set BPROT_CONFIG1_REGION60_Enabled + +#define MPU_PROTENSET1_PROTREG59_Pos BPROT_CONFIG1_REGION59_Pos +#define MPU_PROTENSET1_PROTREG59_Msk BPROT_CONFIG1_REGION59_Msk +#define MPU_PROTENSET1_PROTREG59_Disabled BPROT_CONFIG1_REGION59_Disabled +#define MPU_PROTENSET1_PROTREG59_Enabled BPROT_CONFIG1_REGION59_Enabled +#define MPU_PROTENSET1_PROTREG59_Set BPROT_CONFIG1_REGION59_Enabled + +#define MPU_PROTENSET1_PROTREG58_Pos BPROT_CONFIG1_REGION58_Pos +#define MPU_PROTENSET1_PROTREG58_Msk BPROT_CONFIG1_REGION58_Msk +#define MPU_PROTENSET1_PROTREG58_Disabled BPROT_CONFIG1_REGION58_Disabled +#define MPU_PROTENSET1_PROTREG58_Enabled BPROT_CONFIG1_REGION58_Enabled +#define MPU_PROTENSET1_PROTREG58_Set BPROT_CONFIG1_REGION58_Enabled + +#define MPU_PROTENSET1_PROTREG57_Pos BPROT_CONFIG1_REGION57_Pos +#define MPU_PROTENSET1_PROTREG57_Msk BPROT_CONFIG1_REGION57_Msk +#define MPU_PROTENSET1_PROTREG57_Disabled BPROT_CONFIG1_REGION57_Disabled +#define MPU_PROTENSET1_PROTREG57_Enabled BPROT_CONFIG1_REGION57_Enabled +#define MPU_PROTENSET1_PROTREG57_Set BPROT_CONFIG1_REGION57_Enabled + +#define MPU_PROTENSET1_PROTREG56_Pos BPROT_CONFIG1_REGION56_Pos +#define MPU_PROTENSET1_PROTREG56_Msk BPROT_CONFIG1_REGION56_Msk +#define MPU_PROTENSET1_PROTREG56_Disabled BPROT_CONFIG1_REGION56_Disabled +#define MPU_PROTENSET1_PROTREG56_Enabled BPROT_CONFIG1_REGION56_Enabled +#define MPU_PROTENSET1_PROTREG56_Set BPROT_CONFIG1_REGION56_Enabled + +#define MPU_PROTENSET1_PROTREG55_Pos BPROT_CONFIG1_REGION55_Pos +#define MPU_PROTENSET1_PROTREG55_Msk BPROT_CONFIG1_REGION55_Msk +#define MPU_PROTENSET1_PROTREG55_Disabled BPROT_CONFIG1_REGION55_Disabled +#define MPU_PROTENSET1_PROTREG55_Enabled BPROT_CONFIG1_REGION55_Enabled +#define MPU_PROTENSET1_PROTREG55_Set BPROT_CONFIG1_REGION55_Enabled + +#define MPU_PROTENSET1_PROTREG54_Pos BPROT_CONFIG1_REGION54_Pos +#define MPU_PROTENSET1_PROTREG54_Msk BPROT_CONFIG1_REGION54_Msk +#define MPU_PROTENSET1_PROTREG54_Disabled BPROT_CONFIG1_REGION54_Disabled +#define MPU_PROTENSET1_PROTREG54_Enabled BPROT_CONFIG1_REGION54_Enabled +#define MPU_PROTENSET1_PROTREG54_Set BPROT_CONFIG1_REGION54_Enabled + +#define MPU_PROTENSET1_PROTREG53_Pos BPROT_CONFIG1_REGION53_Pos +#define MPU_PROTENSET1_PROTREG53_Msk BPROT_CONFIG1_REGION53_Msk +#define MPU_PROTENSET1_PROTREG53_Disabled BPROT_CONFIG1_REGION53_Disabled +#define MPU_PROTENSET1_PROTREG53_Enabled BPROT_CONFIG1_REGION53_Enabled +#define MPU_PROTENSET1_PROTREG53_Set BPROT_CONFIG1_REGION53_Enabled + +#define MPU_PROTENSET1_PROTREG52_Pos BPROT_CONFIG1_REGION52_Pos +#define MPU_PROTENSET1_PROTREG52_Msk BPROT_CONFIG1_REGION52_Msk +#define MPU_PROTENSET1_PROTREG52_Disabled BPROT_CONFIG1_REGION52_Disabled +#define MPU_PROTENSET1_PROTREG52_Enabled BPROT_CONFIG1_REGION52_Enabled +#define MPU_PROTENSET1_PROTREG52_Set BPROT_CONFIG1_REGION52_Enabled + +#define MPU_PROTENSET1_PROTREG51_Pos BPROT_CONFIG1_REGION51_Pos +#define MPU_PROTENSET1_PROTREG51_Msk BPROT_CONFIG1_REGION51_Msk +#define MPU_PROTENSET1_PROTREG51_Disabled BPROT_CONFIG1_REGION51_Disabled +#define MPU_PROTENSET1_PROTREG51_Enabled BPROT_CONFIG1_REGION51_Enabled +#define MPU_PROTENSET1_PROTREG51_Set BPROT_CONFIG1_REGION51_Enabled + +#define MPU_PROTENSET1_PROTREG50_Pos BPROT_CONFIG1_REGION50_Pos +#define MPU_PROTENSET1_PROTREG50_Msk BPROT_CONFIG1_REGION50_Msk +#define MPU_PROTENSET1_PROTREG50_Disabled BPROT_CONFIG1_REGION50_Disabled +#define MPU_PROTENSET1_PROTREG50_Enabled BPROT_CONFIG1_REGION50_Enabled +#define MPU_PROTENSET1_PROTREG50_Set BPROT_CONFIG1_REGION50_Enabled + +#define MPU_PROTENSET1_PROTREG49_Pos BPROT_CONFIG1_REGION49_Pos +#define MPU_PROTENSET1_PROTREG49_Msk BPROT_CONFIG1_REGION49_Msk +#define MPU_PROTENSET1_PROTREG49_Disabled BPROT_CONFIG1_REGION49_Disabled +#define MPU_PROTENSET1_PROTREG49_Enabled BPROT_CONFIG1_REGION49_Enabled +#define MPU_PROTENSET1_PROTREG49_Set BPROT_CONFIG1_REGION49_Enabled + +#define MPU_PROTENSET1_PROTREG48_Pos BPROT_CONFIG1_REGION48_Pos +#define MPU_PROTENSET1_PROTREG48_Msk BPROT_CONFIG1_REGION48_Msk +#define MPU_PROTENSET1_PROTREG48_Disabled BPROT_CONFIG1_REGION48_Disabled +#define MPU_PROTENSET1_PROTREG48_Enabled BPROT_CONFIG1_REGION48_Enabled +#define MPU_PROTENSET1_PROTREG48_Set BPROT_CONFIG1_REGION48_Enabled + +#define MPU_PROTENSET1_PROTREG47_Pos BPROT_CONFIG1_REGION47_Pos +#define MPU_PROTENSET1_PROTREG47_Msk BPROT_CONFIG1_REGION47_Msk +#define MPU_PROTENSET1_PROTREG47_Disabled BPROT_CONFIG1_REGION47_Disabled +#define MPU_PROTENSET1_PROTREG47_Enabled BPROT_CONFIG1_REGION47_Enabled +#define MPU_PROTENSET1_PROTREG47_Set BPROT_CONFIG1_REGION47_Enabled + +#define MPU_PROTENSET1_PROTREG46_Pos BPROT_CONFIG1_REGION46_Pos +#define MPU_PROTENSET1_PROTREG46_Msk BPROT_CONFIG1_REGION46_Msk +#define MPU_PROTENSET1_PROTREG46_Disabled BPROT_CONFIG1_REGION46_Disabled +#define MPU_PROTENSET1_PROTREG46_Enabled BPROT_CONFIG1_REGION46_Enabled +#define MPU_PROTENSET1_PROTREG46_Set BPROT_CONFIG1_REGION46_Enabled + +#define MPU_PROTENSET1_PROTREG45_Pos BPROT_CONFIG1_REGION45_Pos +#define MPU_PROTENSET1_PROTREG45_Msk BPROT_CONFIG1_REGION45_Msk +#define MPU_PROTENSET1_PROTREG45_Disabled BPROT_CONFIG1_REGION45_Disabled +#define MPU_PROTENSET1_PROTREG45_Enabled BPROT_CONFIG1_REGION45_Enabled +#define MPU_PROTENSET1_PROTREG45_Set BPROT_CONFIG1_REGION45_Enabled + +#define MPU_PROTENSET1_PROTREG44_Pos BPROT_CONFIG1_REGION44_Pos +#define MPU_PROTENSET1_PROTREG44_Msk BPROT_CONFIG1_REGION44_Msk +#define MPU_PROTENSET1_PROTREG44_Disabled BPROT_CONFIG1_REGION44_Disabled +#define MPU_PROTENSET1_PROTREG44_Enabled BPROT_CONFIG1_REGION44_Enabled +#define MPU_PROTENSET1_PROTREG44_Set BPROT_CONFIG1_REGION44_Enabled + +#define MPU_PROTENSET1_PROTREG43_Pos BPROT_CONFIG1_REGION43_Pos +#define MPU_PROTENSET1_PROTREG43_Msk BPROT_CONFIG1_REGION43_Msk +#define MPU_PROTENSET1_PROTREG43_Disabled BPROT_CONFIG1_REGION43_Disabled +#define MPU_PROTENSET1_PROTREG43_Enabled BPROT_CONFIG1_REGION43_Enabled +#define MPU_PROTENSET1_PROTREG43_Set BPROT_CONFIG1_REGION43_Enabled + +#define MPU_PROTENSET1_PROTREG42_Pos BPROT_CONFIG1_REGION42_Pos +#define MPU_PROTENSET1_PROTREG42_Msk BPROT_CONFIG1_REGION42_Msk +#define MPU_PROTENSET1_PROTREG42_Disabled BPROT_CONFIG1_REGION42_Disabled +#define MPU_PROTENSET1_PROTREG42_Enabled BPROT_CONFIG1_REGION42_Enabled +#define MPU_PROTENSET1_PROTREG42_Set BPROT_CONFIG1_REGION42_Enabled + +#define MPU_PROTENSET1_PROTREG41_Pos BPROT_CONFIG1_REGION41_Pos +#define MPU_PROTENSET1_PROTREG41_Msk BPROT_CONFIG1_REGION41_Msk +#define MPU_PROTENSET1_PROTREG41_Disabled BPROT_CONFIG1_REGION41_Disabled +#define MPU_PROTENSET1_PROTREG41_Enabled BPROT_CONFIG1_REGION41_Enabled +#define MPU_PROTENSET1_PROTREG41_Set BPROT_CONFIG1_REGION41_Enabled + +#define MPU_PROTENSET1_PROTREG40_Pos BPROT_CONFIG1_REGION40_Pos +#define MPU_PROTENSET1_PROTREG40_Msk BPROT_CONFIG1_REGION40_Msk +#define MPU_PROTENSET1_PROTREG40_Disabled BPROT_CONFIG1_REGION40_Disabled +#define MPU_PROTENSET1_PROTREG40_Enabled BPROT_CONFIG1_REGION40_Enabled +#define MPU_PROTENSET1_PROTREG40_Set BPROT_CONFIG1_REGION40_Enabled + +#define MPU_PROTENSET1_PROTREG39_Pos BPROT_CONFIG1_REGION39_Pos +#define MPU_PROTENSET1_PROTREG39_Msk BPROT_CONFIG1_REGION39_Msk +#define MPU_PROTENSET1_PROTREG39_Disabled BPROT_CONFIG1_REGION39_Disabled +#define MPU_PROTENSET1_PROTREG39_Enabled BPROT_CONFIG1_REGION39_Enabled +#define MPU_PROTENSET1_PROTREG39_Set BPROT_CONFIG1_REGION39_Enabled + +#define MPU_PROTENSET1_PROTREG38_Pos BPROT_CONFIG1_REGION38_Pos +#define MPU_PROTENSET1_PROTREG38_Msk BPROT_CONFIG1_REGION38_Msk +#define MPU_PROTENSET1_PROTREG38_Disabled BPROT_CONFIG1_REGION38_Disabled +#define MPU_PROTENSET1_PROTREG38_Enabled BPROT_CONFIG1_REGION38_Enabled +#define MPU_PROTENSET1_PROTREG38_Set BPROT_CONFIG1_REGION38_Enabled + +#define MPU_PROTENSET1_PROTREG37_Pos BPROT_CONFIG1_REGION37_Pos +#define MPU_PROTENSET1_PROTREG37_Msk BPROT_CONFIG1_REGION37_Msk +#define MPU_PROTENSET1_PROTREG37_Disabled BPROT_CONFIG1_REGION37_Disabled +#define MPU_PROTENSET1_PROTREG37_Enabled BPROT_CONFIG1_REGION37_Enabled +#define MPU_PROTENSET1_PROTREG37_Set BPROT_CONFIG1_REGION37_Enabled + +#define MPU_PROTENSET1_PROTREG36_Pos BPROT_CONFIG1_REGION36_Pos +#define MPU_PROTENSET1_PROTREG36_Msk BPROT_CONFIG1_REGION36_Msk +#define MPU_PROTENSET1_PROTREG36_Disabled BPROT_CONFIG1_REGION36_Disabled +#define MPU_PROTENSET1_PROTREG36_Enabled BPROT_CONFIG1_REGION36_Enabled +#define MPU_PROTENSET1_PROTREG36_Set BPROT_CONFIG1_REGION36_Enabled + +#define MPU_PROTENSET1_PROTREG35_Pos BPROT_CONFIG1_REGION35_Pos +#define MPU_PROTENSET1_PROTREG35_Msk BPROT_CONFIG1_REGION35_Msk +#define MPU_PROTENSET1_PROTREG35_Disabled BPROT_CONFIG1_REGION35_Disabled +#define MPU_PROTENSET1_PROTREG35_Enabled BPROT_CONFIG1_REGION35_Enabled +#define MPU_PROTENSET1_PROTREG35_Set BPROT_CONFIG1_REGION35_Enabled + +#define MPU_PROTENSET1_PROTREG34_Pos BPROT_CONFIG1_REGION34_Pos +#define MPU_PROTENSET1_PROTREG34_Msk BPROT_CONFIG1_REGION34_Msk +#define MPU_PROTENSET1_PROTREG34_Disabled BPROT_CONFIG1_REGION34_Disabled +#define MPU_PROTENSET1_PROTREG34_Enabled BPROT_CONFIG1_REGION34_Enabled +#define MPU_PROTENSET1_PROTREG34_Set BPROT_CONFIG1_REGION34_Enabled + +#define MPU_PROTENSET1_PROTREG33_Pos BPROT_CONFIG1_REGION33_Pos +#define MPU_PROTENSET1_PROTREG33_Msk BPROT_CONFIG1_REGION33_Msk +#define MPU_PROTENSET1_PROTREG33_Disabled BPROT_CONFIG1_REGION33_Disabled +#define MPU_PROTENSET1_PROTREG33_Enabled BPROT_CONFIG1_REGION33_Enabled +#define MPU_PROTENSET1_PROTREG33_Set BPROT_CONFIG1_REGION33_Enabled + +#define MPU_PROTENSET1_PROTREG32_Pos BPROT_CONFIG1_REGION32_Pos +#define MPU_PROTENSET1_PROTREG32_Msk BPROT_CONFIG1_REGION32_Msk +#define MPU_PROTENSET1_PROTREG32_Disabled BPROT_CONFIG1_REGION32_Disabled +#define MPU_PROTENSET1_PROTREG32_Enabled BPROT_CONFIG1_REGION32_Enabled +#define MPU_PROTENSET1_PROTREG32_Set BPROT_CONFIG1_REGION32_Enabled + +#define MPU_PROTENSET0_PROTREG31_Pos BPROT_CONFIG0_REGION31_Pos +#define MPU_PROTENSET0_PROTREG31_Msk BPROT_CONFIG0_REGION31_Msk +#define MPU_PROTENSET0_PROTREG31_Disabled BPROT_CONFIG0_REGION31_Disabled +#define MPU_PROTENSET0_PROTREG31_Enabled BPROT_CONFIG0_REGION31_Enabled +#define MPU_PROTENSET0_PROTREG31_Set BPROT_CONFIG0_REGION31_Enabled + +#define MPU_PROTENSET0_PROTREG30_Pos BPROT_CONFIG0_REGION30_Pos +#define MPU_PROTENSET0_PROTREG30_Msk BPROT_CONFIG0_REGION30_Msk +#define MPU_PROTENSET0_PROTREG30_Disabled BPROT_CONFIG0_REGION30_Disabled +#define MPU_PROTENSET0_PROTREG30_Enabled BPROT_CONFIG0_REGION30_Enabled +#define MPU_PROTENSET0_PROTREG30_Set BPROT_CONFIG0_REGION30_Enabled + +#define MPU_PROTENSET0_PROTREG29_Pos BPROT_CONFIG0_REGION29_Pos +#define MPU_PROTENSET0_PROTREG29_Msk BPROT_CONFIG0_REGION29_Msk +#define MPU_PROTENSET0_PROTREG29_Disabled BPROT_CONFIG0_REGION29_Disabled +#define MPU_PROTENSET0_PROTREG29_Enabled BPROT_CONFIG0_REGION29_Enabled +#define MPU_PROTENSET0_PROTREG29_Set BPROT_CONFIG0_REGION29_Enabled + +#define MPU_PROTENSET0_PROTREG28_Pos BPROT_CONFIG0_REGION28_Pos +#define MPU_PROTENSET0_PROTREG28_Msk BPROT_CONFIG0_REGION28_Msk +#define MPU_PROTENSET0_PROTREG28_Disabled BPROT_CONFIG0_REGION28_Disabled +#define MPU_PROTENSET0_PROTREG28_Enabled BPROT_CONFIG0_REGION28_Enabled +#define MPU_PROTENSET0_PROTREG28_Set BPROT_CONFIG0_REGION28_Enabled + +#define MPU_PROTENSET0_PROTREG27_Pos BPROT_CONFIG0_REGION27_Pos +#define MPU_PROTENSET0_PROTREG27_Msk BPROT_CONFIG0_REGION27_Msk +#define MPU_PROTENSET0_PROTREG27_Disabled BPROT_CONFIG0_REGION27_Disabled +#define MPU_PROTENSET0_PROTREG27_Enabled BPROT_CONFIG0_REGION27_Enabled +#define MPU_PROTENSET0_PROTREG27_Set BPROT_CONFIG0_REGION27_Enabled + +#define MPU_PROTENSET0_PROTREG26_Pos BPROT_CONFIG0_REGION26_Pos +#define MPU_PROTENSET0_PROTREG26_Msk BPROT_CONFIG0_REGION26_Msk +#define MPU_PROTENSET0_PROTREG26_Disabled BPROT_CONFIG0_REGION26_Disabled +#define MPU_PROTENSET0_PROTREG26_Enabled BPROT_CONFIG0_REGION26_Enabled +#define MPU_PROTENSET0_PROTREG26_Set BPROT_CONFIG0_REGION26_Enabled + +#define MPU_PROTENSET0_PROTREG25_Pos BPROT_CONFIG0_REGION25_Pos +#define MPU_PROTENSET0_PROTREG25_Msk BPROT_CONFIG0_REGION25_Msk +#define MPU_PROTENSET0_PROTREG25_Disabled BPROT_CONFIG0_REGION25_Disabled +#define MPU_PROTENSET0_PROTREG25_Enabled BPROT_CONFIG0_REGION25_Enabled +#define MPU_PROTENSET0_PROTREG25_Set BPROT_CONFIG0_REGION25_Enabled + +#define MPU_PROTENSET0_PROTREG24_Pos BPROT_CONFIG0_REGION24_Pos +#define MPU_PROTENSET0_PROTREG24_Msk BPROT_CONFIG0_REGION24_Msk +#define MPU_PROTENSET0_PROTREG24_Disabled BPROT_CONFIG0_REGION24_Disabled +#define MPU_PROTENSET0_PROTREG24_Enabled BPROT_CONFIG0_REGION24_Enabled +#define MPU_PROTENSET0_PROTREG24_Set BPROT_CONFIG0_REGION24_Enabled + +#define MPU_PROTENSET0_PROTREG23_Pos BPROT_CONFIG0_REGION23_Pos +#define MPU_PROTENSET0_PROTREG23_Msk BPROT_CONFIG0_REGION23_Msk +#define MPU_PROTENSET0_PROTREG23_Disabled BPROT_CONFIG0_REGION23_Disabled +#define MPU_PROTENSET0_PROTREG23_Enabled BPROT_CONFIG0_REGION23_Enabled +#define MPU_PROTENSET0_PROTREG23_Set BPROT_CONFIG0_REGION23_Enabled + +#define MPU_PROTENSET0_PROTREG22_Pos BPROT_CONFIG0_REGION22_Pos +#define MPU_PROTENSET0_PROTREG22_Msk BPROT_CONFIG0_REGION22_Msk +#define MPU_PROTENSET0_PROTREG22_Disabled BPROT_CONFIG0_REGION22_Disabled +#define MPU_PROTENSET0_PROTREG22_Enabled BPROT_CONFIG0_REGION22_Enabled +#define MPU_PROTENSET0_PROTREG22_Set BPROT_CONFIG0_REGION22_Enabled + +#define MPU_PROTENSET0_PROTREG21_Pos BPROT_CONFIG0_REGION21_Pos +#define MPU_PROTENSET0_PROTREG21_Msk BPROT_CONFIG0_REGION21_Msk +#define MPU_PROTENSET0_PROTREG21_Disabled BPROT_CONFIG0_REGION21_Disabled +#define MPU_PROTENSET0_PROTREG21_Enabled BPROT_CONFIG0_REGION21_Enabled +#define MPU_PROTENSET0_PROTREG21_Set BPROT_CONFIG0_REGION21_Enabled + +#define MPU_PROTENSET0_PROTREG20_Pos BPROT_CONFIG0_REGION20_Pos +#define MPU_PROTENSET0_PROTREG20_Msk BPROT_CONFIG0_REGION20_Msk +#define MPU_PROTENSET0_PROTREG20_Disabled BPROT_CONFIG0_REGION20_Disabled +#define MPU_PROTENSET0_PROTREG20_Enabled BPROT_CONFIG0_REGION20_Enabled +#define MPU_PROTENSET0_PROTREG20_Set BPROT_CONFIG0_REGION20_Enabled + +#define MPU_PROTENSET0_PROTREG19_Pos BPROT_CONFIG0_REGION19_Pos +#define MPU_PROTENSET0_PROTREG19_Msk BPROT_CONFIG0_REGION19_Msk +#define MPU_PROTENSET0_PROTREG19_Disabled BPROT_CONFIG0_REGION19_Disabled +#define MPU_PROTENSET0_PROTREG19_Enabled BPROT_CONFIG0_REGION19_Enabled +#define MPU_PROTENSET0_PROTREG19_Set BPROT_CONFIG0_REGION19_Enabled + +#define MPU_PROTENSET0_PROTREG18_Pos BPROT_CONFIG0_REGION18_Pos +#define MPU_PROTENSET0_PROTREG18_Msk BPROT_CONFIG0_REGION18_Msk +#define MPU_PROTENSET0_PROTREG18_Disabled BPROT_CONFIG0_REGION18_Disabled +#define MPU_PROTENSET0_PROTREG18_Enabled BPROT_CONFIG0_REGION18_Enabled +#define MPU_PROTENSET0_PROTREG18_Set BPROT_CONFIG0_REGION18_Enabled + +#define MPU_PROTENSET0_PROTREG17_Pos BPROT_CONFIG0_REGION17_Pos +#define MPU_PROTENSET0_PROTREG17_Msk BPROT_CONFIG0_REGION17_Msk +#define MPU_PROTENSET0_PROTREG17_Disabled BPROT_CONFIG0_REGION17_Disabled +#define MPU_PROTENSET0_PROTREG17_Enabled BPROT_CONFIG0_REGION17_Enabled +#define MPU_PROTENSET0_PROTREG17_Set BPROT_CONFIG0_REGION17_Enabled + +#define MPU_PROTENSET0_PROTREG16_Pos BPROT_CONFIG0_REGION16_Pos +#define MPU_PROTENSET0_PROTREG16_Msk BPROT_CONFIG0_REGION16_Msk +#define MPU_PROTENSET0_PROTREG16_Disabled BPROT_CONFIG0_REGION16_Disabled +#define MPU_PROTENSET0_PROTREG16_Enabled BPROT_CONFIG0_REGION16_Enabled +#define MPU_PROTENSET0_PROTREG16_Set BPROT_CONFIG0_REGION16_Enabled + +#define MPU_PROTENSET0_PROTREG15_Pos BPROT_CONFIG0_REGION15_Pos +#define MPU_PROTENSET0_PROTREG15_Msk BPROT_CONFIG0_REGION15_Msk +#define MPU_PROTENSET0_PROTREG15_Disabled BPROT_CONFIG0_REGION15_Disabled +#define MPU_PROTENSET0_PROTREG15_Enabled BPROT_CONFIG0_REGION15_Enabled +#define MPU_PROTENSET0_PROTREG15_Set BPROT_CONFIG0_REGION15_Enabled + +#define MPU_PROTENSET0_PROTREG14_Pos BPROT_CONFIG0_REGION14_Pos +#define MPU_PROTENSET0_PROTREG14_Msk BPROT_CONFIG0_REGION14_Msk +#define MPU_PROTENSET0_PROTREG14_Disabled BPROT_CONFIG0_REGION14_Disabled +#define MPU_PROTENSET0_PROTREG14_Enabled BPROT_CONFIG0_REGION14_Enabled +#define MPU_PROTENSET0_PROTREG14_Set BPROT_CONFIG0_REGION14_Enabled + +#define MPU_PROTENSET0_PROTREG13_Pos BPROT_CONFIG0_REGION13_Pos +#define MPU_PROTENSET0_PROTREG13_Msk BPROT_CONFIG0_REGION13_Msk +#define MPU_PROTENSET0_PROTREG13_Disabled BPROT_CONFIG0_REGION13_Disabled +#define MPU_PROTENSET0_PROTREG13_Enabled BPROT_CONFIG0_REGION13_Enabled +#define MPU_PROTENSET0_PROTREG13_Set BPROT_CONFIG0_REGION13_Enabled + +#define MPU_PROTENSET0_PROTREG12_Pos BPROT_CONFIG0_REGION12_Pos +#define MPU_PROTENSET0_PROTREG12_Msk BPROT_CONFIG0_REGION12_Msk +#define MPU_PROTENSET0_PROTREG12_Disabled BPROT_CONFIG0_REGION12_Disabled +#define MPU_PROTENSET0_PROTREG12_Enabled BPROT_CONFIG0_REGION12_Enabled +#define MPU_PROTENSET0_PROTREG12_Set BPROT_CONFIG0_REGION12_Enabled + +#define MPU_PROTENSET0_PROTREG11_Pos BPROT_CONFIG0_REGION11_Pos +#define MPU_PROTENSET0_PROTREG11_Msk BPROT_CONFIG0_REGION11_Msk +#define MPU_PROTENSET0_PROTREG11_Disabled BPROT_CONFIG0_REGION11_Disabled +#define MPU_PROTENSET0_PROTREG11_Enabled BPROT_CONFIG0_REGION11_Enabled +#define MPU_PROTENSET0_PROTREG11_Set BPROT_CONFIG0_REGION11_Enabled + +#define MPU_PROTENSET0_PROTREG10_Pos BPROT_CONFIG0_REGION10_Pos +#define MPU_PROTENSET0_PROTREG10_Msk BPROT_CONFIG0_REGION10_Msk +#define MPU_PROTENSET0_PROTREG10_Disabled BPROT_CONFIG0_REGION10_Disabled +#define MPU_PROTENSET0_PROTREG10_Enabled BPROT_CONFIG0_REGION10_Enabled +#define MPU_PROTENSET0_PROTREG10_Set BPROT_CONFIG0_REGION10_Enabled + +#define MPU_PROTENSET0_PROTREG9_Pos BPROT_CONFIG0_REGION9_Pos +#define MPU_PROTENSET0_PROTREG9_Msk BPROT_CONFIG0_REGION9_Msk +#define MPU_PROTENSET0_PROTREG9_Disabled BPROT_CONFIG0_REGION9_Disabled +#define MPU_PROTENSET0_PROTREG9_Enabled BPROT_CONFIG0_REGION9_Enabled +#define MPU_PROTENSET0_PROTREG9_Set BPROT_CONFIG0_REGION9_Enabled + +#define MPU_PROTENSET0_PROTREG8_Pos BPROT_CONFIG0_REGION8_Pos +#define MPU_PROTENSET0_PROTREG8_Msk BPROT_CONFIG0_REGION8_Msk +#define MPU_PROTENSET0_PROTREG8_Disabled BPROT_CONFIG0_REGION8_Disabled +#define MPU_PROTENSET0_PROTREG8_Enabled BPROT_CONFIG0_REGION8_Enabled +#define MPU_PROTENSET0_PROTREG8_Set BPROT_CONFIG0_REGION8_Enabled + +#define MPU_PROTENSET0_PROTREG7_Pos BPROT_CONFIG0_REGION7_Pos +#define MPU_PROTENSET0_PROTREG7_Msk BPROT_CONFIG0_REGION7_Msk +#define MPU_PROTENSET0_PROTREG7_Disabled BPROT_CONFIG0_REGION7_Disabled +#define MPU_PROTENSET0_PROTREG7_Enabled BPROT_CONFIG0_REGION7_Enabled +#define MPU_PROTENSET0_PROTREG7_Set BPROT_CONFIG0_REGION7_Enabled + +#define MPU_PROTENSET0_PROTREG6_Pos BPROT_CONFIG0_REGION6_Pos +#define MPU_PROTENSET0_PROTREG6_Msk BPROT_CONFIG0_REGION6_Msk +#define MPU_PROTENSET0_PROTREG6_Disabled BPROT_CONFIG0_REGION6_Disabled +#define MPU_PROTENSET0_PROTREG6_Enabled BPROT_CONFIG0_REGION6_Enabled +#define MPU_PROTENSET0_PROTREG6_Set BPROT_CONFIG0_REGION6_Enabled + +#define MPU_PROTENSET0_PROTREG5_Pos BPROT_CONFIG0_REGION5_Pos +#define MPU_PROTENSET0_PROTREG5_Msk BPROT_CONFIG0_REGION5_Msk +#define MPU_PROTENSET0_PROTREG5_Disabled BPROT_CONFIG0_REGION5_Disabled +#define MPU_PROTENSET0_PROTREG5_Enabled BPROT_CONFIG0_REGION5_Enabled +#define MPU_PROTENSET0_PROTREG5_Set BPROT_CONFIG0_REGION5_Enabled + +#define MPU_PROTENSET0_PROTREG4_Pos BPROT_CONFIG0_REGION4_Pos +#define MPU_PROTENSET0_PROTREG4_Msk BPROT_CONFIG0_REGION4_Msk +#define MPU_PROTENSET0_PROTREG4_Disabled BPROT_CONFIG0_REGION4_Disabled +#define MPU_PROTENSET0_PROTREG4_Enabled BPROT_CONFIG0_REGION4_Enabled +#define MPU_PROTENSET0_PROTREG4_Set BPROT_CONFIG0_REGION4_Enabled + +#define MPU_PROTENSET0_PROTREG3_Pos BPROT_CONFIG0_REGION3_Pos +#define MPU_PROTENSET0_PROTREG3_Msk BPROT_CONFIG0_REGION3_Msk +#define MPU_PROTENSET0_PROTREG3_Disabled BPROT_CONFIG0_REGION3_Disabled +#define MPU_PROTENSET0_PROTREG3_Enabled BPROT_CONFIG0_REGION3_Enabled +#define MPU_PROTENSET0_PROTREG3_Set BPROT_CONFIG0_REGION3_Enabled + +#define MPU_PROTENSET0_PROTREG2_Pos BPROT_CONFIG0_REGION2_Pos +#define MPU_PROTENSET0_PROTREG2_Msk BPROT_CONFIG0_REGION2_Msk +#define MPU_PROTENSET0_PROTREG2_Disabled BPROT_CONFIG0_REGION2_Disabled +#define MPU_PROTENSET0_PROTREG2_Enabled BPROT_CONFIG0_REGION2_Enabled +#define MPU_PROTENSET0_PROTREG2_Set BPROT_CONFIG0_REGION2_Enabled + +#define MPU_PROTENSET0_PROTREG1_Pos BPROT_CONFIG0_REGION1_Pos +#define MPU_PROTENSET0_PROTREG1_Msk BPROT_CONFIG0_REGION1_Msk +#define MPU_PROTENSET0_PROTREG1_Disabled BPROT_CONFIG0_REGION1_Disabled +#define MPU_PROTENSET0_PROTREG1_Enabled BPROT_CONFIG0_REGION1_Enabled +#define MPU_PROTENSET0_PROTREG1_Set BPROT_CONFIG0_REGION1_Enabled + +#define MPU_PROTENSET0_PROTREG0_Pos BPROT_CONFIG0_REGION0_Pos +#define MPU_PROTENSET0_PROTREG0_Msk BPROT_CONFIG0_REGION0_Msk +#define MPU_PROTENSET0_PROTREG0_Disabled BPROT_CONFIG0_REGION0_Disabled +#define MPU_PROTENSET0_PROTREG0_Enabled BPROT_CONFIG0_REGION0_Enabled +#define MPU_PROTENSET0_PROTREG0_Set BPROT_CONFIG0_REGION0_Enabled + + +/* From nrf51_deprecated.h */ + +/* NVMC */ +/* The register ERASEPROTECTEDPAGE changed name to ERASEPCR0 in the documentation. */ +#define ERASEPROTECTEDPAGE ERASEPCR0 + + +/* IRQ */ +/* COMP module was eliminated. Adapted to nrf52 headers. */ +#define LPCOMP_COMP_IRQHandler COMP_LPCOMP_IRQHandler +#define LPCOMP_COMP_IRQn COMP_LPCOMP_IRQn + + +/* RADIO */ +/* The name of the field SKIPADDR was corrected. Old macros added for compatibility. */ +#define RADIO_CRCCNF_SKIP_ADDR_Pos RADIO_CRCCNF_SKIPADDR_Pos +#define RADIO_CRCCNF_SKIP_ADDR_Msk RADIO_CRCCNF_SKIPADDR_Msk +#define RADIO_CRCCNF_SKIP_ADDR_Include RADIO_CRCCNF_SKIPADDR_Include +#define RADIO_CRCCNF_SKIP_ADDR_Skip RADIO_CRCCNF_SKIPADDR_Skip + + +/* FICR */ +/* The registers FICR.DEVICEID0 and FICR.DEVICEID1 were renamed into an array. */ +#define DEVICEID0 DEVICEID[0] +#define DEVICEID1 DEVICEID[1] + +/* The registers FICR.ER0, FICR.ER1, FICR.ER2 and FICR.ER3 were renamed into an array. */ +#define ER0 ER[0] +#define ER1 ER[1] +#define ER2 ER[2] +#define ER3 ER[3] + +/* The registers FICR.IR0, FICR.IR1, FICR.IR2 and FICR.IR3 were renamed into an array. */ +#define IR0 IR[0] +#define IR1 IR[1] +#define IR2 IR[2] +#define IR3 IR[3] + +/* The registers FICR.DEVICEADDR0 and FICR.DEVICEADDR1 were renamed into an array. */ +#define DEVICEADDR0 DEVICEADDR[0] +#define DEVICEADDR1 DEVICEADDR[1] + + +/* PPI */ +/* The tasks PPI.TASKS_CHGxEN and PPI.TASKS_CHGxDIS were renamed into an array of structs. */ +#define TASKS_CHG0EN TASKS_CHG[0].EN +#define TASKS_CHG0DIS TASKS_CHG[0].DIS +#define TASKS_CHG1EN TASKS_CHG[1].EN +#define TASKS_CHG1DIS TASKS_CHG[1].DIS +#define TASKS_CHG2EN TASKS_CHG[2].EN +#define TASKS_CHG2DIS TASKS_CHG[2].DIS +#define TASKS_CHG3EN TASKS_CHG[3].EN +#define TASKS_CHG3DIS TASKS_CHG[3].DIS + +/* The registers PPI.CHx_EEP and PPI.CHx_TEP were renamed into an array of structs. */ +#define CH0_EEP CH[0].EEP +#define CH0_TEP CH[0].TEP +#define CH1_EEP CH[1].EEP +#define CH1_TEP CH[1].TEP +#define CH2_EEP CH[2].EEP +#define CH2_TEP CH[2].TEP +#define CH3_EEP CH[3].EEP +#define CH3_TEP CH[3].TEP +#define CH4_EEP CH[4].EEP +#define CH4_TEP CH[4].TEP +#define CH5_EEP CH[5].EEP +#define CH5_TEP CH[5].TEP +#define CH6_EEP CH[6].EEP +#define CH6_TEP CH[6].TEP +#define CH7_EEP CH[7].EEP +#define CH7_TEP CH[7].TEP +#define CH8_EEP CH[8].EEP +#define CH8_TEP CH[8].TEP +#define CH9_EEP CH[9].EEP +#define CH9_TEP CH[9].TEP +#define CH10_EEP CH[10].EEP +#define CH10_TEP CH[10].TEP +#define CH11_EEP CH[11].EEP +#define CH11_TEP CH[11].TEP +#define CH12_EEP CH[12].EEP +#define CH12_TEP CH[12].TEP +#define CH13_EEP CH[13].EEP +#define CH13_TEP CH[13].TEP +#define CH14_EEP CH[14].EEP +#define CH14_TEP CH[14].TEP +#define CH15_EEP CH[15].EEP +#define CH15_TEP CH[15].TEP + +/* The registers PPI.CHG0, PPI.CHG1, PPI.CHG2 and PPI.CHG3 were renamed into an array. */ +#define CHG0 CHG[0] +#define CHG1 CHG[1] +#define CHG2 CHG[2] +#define CHG3 CHG[3] + +/* All bitfield macros for the CHGx registers therefore changed name. */ +#define PPI_CHG0_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG0_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG0_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG0_CH15_Included PPI_CHG_CH15_Included + +#define PPI_CHG0_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG0_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG0_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG0_CH14_Included PPI_CHG_CH14_Included + +#define PPI_CHG0_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG0_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG0_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG0_CH13_Included PPI_CHG_CH13_Included + +#define PPI_CHG0_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG0_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG0_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG0_CH12_Included PPI_CHG_CH12_Included + +#define PPI_CHG0_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG0_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG0_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG0_CH11_Included PPI_CHG_CH11_Included + +#define PPI_CHG0_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG0_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG0_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG0_CH10_Included PPI_CHG_CH10_Included + +#define PPI_CHG0_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG0_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG0_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG0_CH9_Included PPI_CHG_CH9_Included + +#define PPI_CHG0_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG0_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG0_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG0_CH8_Included PPI_CHG_CH8_Included + +#define PPI_CHG0_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG0_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG0_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG0_CH7_Included PPI_CHG_CH7_Included + +#define PPI_CHG0_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG0_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG0_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG0_CH6_Included PPI_CHG_CH6_Included + +#define PPI_CHG0_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG0_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG0_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG0_CH5_Included PPI_CHG_CH5_Included + +#define PPI_CHG0_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG0_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG0_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG0_CH4_Included PPI_CHG_CH4_Included + +#define PPI_CHG0_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG0_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG0_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG0_CH3_Included PPI_CHG_CH3_Included + +#define PPI_CHG0_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG0_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG0_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG0_CH2_Included PPI_CHG_CH2_Included + +#define PPI_CHG0_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG0_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG0_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG0_CH1_Included PPI_CHG_CH1_Included + +#define PPI_CHG0_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG0_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG0_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG0_CH0_Included PPI_CHG_CH0_Included + +#define PPI_CHG1_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG1_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG1_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG1_CH15_Included PPI_CHG_CH15_Included + +#define PPI_CHG1_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG1_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG1_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG1_CH14_Included PPI_CHG_CH14_Included + +#define PPI_CHG1_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG1_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG1_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG1_CH13_Included PPI_CHG_CH13_Included + +#define PPI_CHG1_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG1_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG1_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG1_CH12_Included PPI_CHG_CH12_Included + +#define PPI_CHG1_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG1_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG1_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG1_CH11_Included PPI_CHG_CH11_Included + +#define PPI_CHG1_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG1_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG1_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG1_CH10_Included PPI_CHG_CH10_Included + +#define PPI_CHG1_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG1_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG1_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG1_CH9_Included PPI_CHG_CH9_Included + +#define PPI_CHG1_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG1_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG1_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG1_CH8_Included PPI_CHG_CH8_Included + +#define PPI_CHG1_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG1_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG1_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG1_CH7_Included PPI_CHG_CH7_Included + +#define PPI_CHG1_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG1_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG1_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG1_CH6_Included PPI_CHG_CH6_Included + +#define PPI_CHG1_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG1_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG1_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG1_CH5_Included PPI_CHG_CH5_Included + +#define PPI_CHG1_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG1_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG1_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG1_CH4_Included PPI_CHG_CH4_Included + +#define PPI_CHG1_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG1_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG1_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG1_CH3_Included PPI_CHG_CH3_Included + +#define PPI_CHG1_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG1_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG1_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG1_CH2_Included PPI_CHG_CH2_Included + +#define PPI_CHG1_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG1_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG1_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG1_CH1_Included PPI_CHG_CH1_Included + +#define PPI_CHG1_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG1_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG1_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG1_CH0_Included PPI_CHG_CH0_Included + +#define PPI_CHG2_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG2_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG2_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG2_CH15_Included PPI_CHG_CH15_Included + +#define PPI_CHG2_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG2_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG2_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG2_CH14_Included PPI_CHG_CH14_Included + +#define PPI_CHG2_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG2_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG2_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG2_CH13_Included PPI_CHG_CH13_Included + +#define PPI_CHG2_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG2_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG2_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG2_CH12_Included PPI_CHG_CH12_Included + +#define PPI_CHG2_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG2_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG2_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG2_CH11_Included PPI_CHG_CH11_Included + +#define PPI_CHG2_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG2_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG2_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG2_CH10_Included PPI_CHG_CH10_Included + +#define PPI_CHG2_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG2_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG2_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG2_CH9_Included PPI_CHG_CH9_Included + +#define PPI_CHG2_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG2_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG2_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG2_CH8_Included PPI_CHG_CH8_Included + +#define PPI_CHG2_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG2_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG2_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG2_CH7_Included PPI_CHG_CH7_Included + +#define PPI_CHG2_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG2_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG2_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG2_CH6_Included PPI_CHG_CH6_Included + +#define PPI_CHG2_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG2_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG2_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG2_CH5_Included PPI_CHG_CH5_Included + +#define PPI_CHG2_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG2_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG2_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG2_CH4_Included PPI_CHG_CH4_Included + +#define PPI_CHG2_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG2_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG2_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG2_CH3_Included PPI_CHG_CH3_Included + +#define PPI_CHG2_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG2_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG2_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG2_CH2_Included PPI_CHG_CH2_Included + +#define PPI_CHG2_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG2_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG2_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG2_CH1_Included PPI_CHG_CH1_Included + +#define PPI_CHG2_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG2_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG2_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG2_CH0_Included PPI_CHG_CH0_Included + +#define PPI_CHG3_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG3_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG3_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG3_CH15_Included PPI_CHG_CH15_Included + +#define PPI_CHG3_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG3_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG3_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG3_CH14_Included PPI_CHG_CH14_Included + +#define PPI_CHG3_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG3_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG3_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG3_CH13_Included PPI_CHG_CH13_Included + +#define PPI_CHG3_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG3_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG3_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG3_CH12_Included PPI_CHG_CH12_Included + +#define PPI_CHG3_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG3_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG3_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG3_CH11_Included PPI_CHG_CH11_Included + +#define PPI_CHG3_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG3_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG3_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG3_CH10_Included PPI_CHG_CH10_Included + +#define PPI_CHG3_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG3_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG3_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG3_CH9_Included PPI_CHG_CH9_Included + +#define PPI_CHG3_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG3_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG3_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG3_CH8_Included PPI_CHG_CH8_Included + +#define PPI_CHG3_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG3_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG3_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG3_CH7_Included PPI_CHG_CH7_Included + +#define PPI_CHG3_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG3_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG3_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG3_CH6_Included PPI_CHG_CH6_Included + +#define PPI_CHG3_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG3_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG3_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG3_CH5_Included PPI_CHG_CH5_Included + +#define PPI_CHG3_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG3_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG3_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG3_CH4_Included PPI_CHG_CH4_Included + +#define PPI_CHG3_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG3_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG3_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG3_CH3_Included PPI_CHG_CH3_Included + +#define PPI_CHG3_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG3_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG3_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG3_CH2_Included PPI_CHG_CH2_Included + +#define PPI_CHG3_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG3_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG3_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG3_CH1_Included PPI_CHG_CH1_Included + +#define PPI_CHG3_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG3_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG3_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG3_CH0_Included PPI_CHG_CH0_Included + + + + +/*lint --flb "Leave library region" */ + +#endif /* NRF51_TO_NRF52_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52.h new file mode 100644 index 0000000000..bf7c165a0e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52.h @@ -0,0 +1,2125 @@ + +/****************************************************************************************************//** + * @file nrf52.h + * + * @brief CMSIS Cortex-M4 Peripheral Access Layer Header File for + * nrf52 from Nordic Semiconductor. + * + * @version V1 + * @date 23. February 2016 + * + * @note Generated with SVDConv V2.81d + * from CMSIS SVD File 'nrf52.svd' Version 1, + * + * @par Copyright (c) 2015, Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + *******************************************************************************************************/ + + + +/** @addtogroup Nordic Semiconductor + * @{ + */ + +/** @addtogroup nrf52 + * @{ + */ + +#ifndef NRF52_H +#define NRF52_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ------------------------- Interrupt Number Definition ------------------------ */ + +typedef enum { +/* ------------------- Cortex-M4 Processor Exceptions Numbers ------------------- */ + Reset_IRQn = -15, /*!< 1 Reset Vector, invoked on Power up and warm reset */ + NonMaskableInt_IRQn = -14, /*!< 2 Non maskable Interrupt, cannot be stopped or preempted */ + HardFault_IRQn = -13, /*!< 3 Hard Fault, all classes of Fault */ + MemoryManagement_IRQn = -12, /*!< 4 Memory Management, MPU mismatch, including Access Violation + and No Match */ + BusFault_IRQn = -11, /*!< 5 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory + related Fault */ + UsageFault_IRQn = -10, /*!< 6 Usage Fault, i.e. Undef Instruction, Illegal State Transition */ + SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */ + DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor */ + PendSV_IRQn = -2, /*!< 14 Pendable request for system service */ + SysTick_IRQn = -1, /*!< 15 System Tick Timer */ +/* ---------------------- nrf52 Specific Interrupt Numbers ---------------------- */ + POWER_CLOCK_IRQn = 0, /*!< 0 POWER_CLOCK */ + RADIO_IRQn = 1, /*!< 1 RADIO */ + UARTE0_UART0_IRQn = 2, /*!< 2 UARTE0_UART0 */ + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn= 3, /*!< 3 SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 */ + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn= 4, /*!< 4 SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 */ + NFCT_IRQn = 5, /*!< 5 NFCT */ + GPIOTE_IRQn = 6, /*!< 6 GPIOTE */ + SAADC_IRQn = 7, /*!< 7 SAADC */ + TIMER0_IRQn = 8, /*!< 8 TIMER0 */ + TIMER1_IRQn = 9, /*!< 9 TIMER1 */ + TIMER2_IRQn = 10, /*!< 10 TIMER2 */ + RTC0_IRQn = 11, /*!< 11 RTC0 */ + TEMP_IRQn = 12, /*!< 12 TEMP */ + RNG_IRQn = 13, /*!< 13 RNG */ + ECB_IRQn = 14, /*!< 14 ECB */ + CCM_AAR_IRQn = 15, /*!< 15 CCM_AAR */ + WDT_IRQn = 16, /*!< 16 WDT */ + RTC1_IRQn = 17, /*!< 17 RTC1 */ + QDEC_IRQn = 18, /*!< 18 QDEC */ + COMP_LPCOMP_IRQn = 19, /*!< 19 COMP_LPCOMP */ + SWI0_EGU0_IRQn = 20, /*!< 20 SWI0_EGU0 */ + SWI1_EGU1_IRQn = 21, /*!< 21 SWI1_EGU1 */ + SWI2_EGU2_IRQn = 22, /*!< 22 SWI2_EGU2 */ + SWI3_EGU3_IRQn = 23, /*!< 23 SWI3_EGU3 */ + SWI4_EGU4_IRQn = 24, /*!< 24 SWI4_EGU4 */ + SWI5_EGU5_IRQn = 25, /*!< 25 SWI5_EGU5 */ + TIMER3_IRQn = 26, /*!< 26 TIMER3 */ + TIMER4_IRQn = 27, /*!< 27 TIMER4 */ + PWM0_IRQn = 28, /*!< 28 PWM0 */ + PDM_IRQn = 29, /*!< 29 PDM */ + MWU_IRQn = 32, /*!< 32 MWU */ + PWM1_IRQn = 33, /*!< 33 PWM1 */ + PWM2_IRQn = 34, /*!< 34 PWM2 */ + SPIM2_SPIS2_SPI2_IRQn = 35, /*!< 35 SPIM2_SPIS2_SPI2 */ + RTC2_IRQn = 36, /*!< 36 RTC2 */ + I2S_IRQn = 37, /*!< 37 I2S */ + FPU_IRQn = 38 /*!< 38 FPU */ +} IRQn_Type; + + +/** @addtogroup Configuration_of_CMSIS + * @{ + */ + + +/* ================================================================================ */ +/* ================ Processor and Core Peripheral Section ================ */ +/* ================================================================================ */ + +/* ----------------Configuration of the Cortex-M4 Processor and Core Peripherals---------------- */ +#define __CM4_REV 0x0001 /*!< Cortex-M4 Core Revision */ +#define __MPU_PRESENT 1 /*!< MPU present or not */ +#define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */ +#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ +#define __FPU_PRESENT 1 /*!< FPU present or not */ +/** @} */ /* End of group Configuration_of_CMSIS */ + +#include "core_cm4.h" /*!< Cortex-M4 processor and core peripherals */ +#include "system_nrf52.h" /*!< nrf52 System */ + + +/* ================================================================================ */ +/* ================ Device Specific Peripheral Section ================ */ +/* ================================================================================ */ + + +/** @addtogroup Device_Peripheral_Registers + * @{ + */ + + +/* ------------------- Start of section using anonymous unions ------------------ */ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#elif defined(__TMS470__) +/* anonymous unions are enabled by default */ +#elif defined(__TASKING__) + #pragma warning 586 +#else + #warning Not supported compiler type +#endif + + +typedef struct { + __I uint32_t PART; /*!< Part code */ + __I uint32_t VARIANT; /*!< Part Variant, Hardware version and Production configuration */ + __I uint32_t PACKAGE; /*!< Package option */ + __I uint32_t RAM; /*!< RAM variant */ + __I uint32_t FLASH; /*!< Flash variant */ + __IO uint32_t UNUSED0[3]; /*!< Description collection[0]: Unspecified */ +} FICR_INFO_Type; + +typedef struct { + __I uint32_t A0; /*!< Slope definition A0. */ + __I uint32_t A1; /*!< Slope definition A1. */ + __I uint32_t A2; /*!< Slope definition A2. */ + __I uint32_t A3; /*!< Slope definition A3. */ + __I uint32_t A4; /*!< Slope definition A4. */ + __I uint32_t A5; /*!< Slope definition A5. */ + __I uint32_t B0; /*!< y-intercept B0. */ + __I uint32_t B1; /*!< y-intercept B1. */ + __I uint32_t B2; /*!< y-intercept B2. */ + __I uint32_t B3; /*!< y-intercept B3. */ + __I uint32_t B4; /*!< y-intercept B4. */ + __I uint32_t B5; /*!< y-intercept B5. */ + __I uint32_t T0; /*!< Segment end T0. */ + __I uint32_t T1; /*!< Segment end T1. */ + __I uint32_t T2; /*!< Segment end T2. */ + __I uint32_t T3; /*!< Segment end T3. */ + __I uint32_t T4; /*!< Segment end T4. */ +} FICR_TEMP_Type; + +typedef struct { + __I uint32_t TAGHEADER0; /*!< Default header for NFC Tag. Software can read these values to + populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + __I uint32_t TAGHEADER1; /*!< Default header for NFC Tag. Software can read these values to + populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + __I uint32_t TAGHEADER2; /*!< Default header for NFC Tag. Software can read these values to + populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + __I uint32_t TAGHEADER3; /*!< Default header for NFC Tag. Software can read these values to + populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ +} FICR_NFC_Type; + +typedef struct { + __IO uint32_t POWER; /*!< Description cluster[0]: RAM0 power control register */ + __O uint32_t POWERSET; /*!< Description cluster[0]: RAM0 power control set register */ + __O uint32_t POWERCLR; /*!< Description cluster[0]: RAM0 power control clear register */ + __I uint32_t RESERVED0; +} POWER_RAM_Type; + +typedef struct { + __IO uint32_t CPU0; /*!< AHB bus master priority register for CPU0 */ + __IO uint32_t SPIS1; /*!< AHB bus master priority register for SPIM1, SPIS1, TWIM1 and + TWIS1 */ + __IO uint32_t RADIO; /*!< AHB bus master priority register for RADIO */ + __IO uint32_t ECB; /*!< AHB bus master priority register for ECB */ + __IO uint32_t CCM; /*!< AHB bus master priority register for CCM */ + __IO uint32_t AAR; /*!< AHB bus master priority register for AAR */ + __IO uint32_t SAADC; /*!< AHB bus master priority register for SAADC */ + __IO uint32_t UARTE; /*!< AHB bus master priority register for UARTE */ + __IO uint32_t SERIAL0; /*!< AHB bus master priority register for SPIM0, SPIS0, TWIM0 and + TWIS0 */ + __IO uint32_t SERIAL2; /*!< AHB bus master priority register for SPIM2 and SPIS2 */ + __IO uint32_t NFCT; /*!< AHB bus master priority register for NFCT */ + __IO uint32_t I2S; /*!< AHB bus master priority register for I2S */ + __IO uint32_t PDM; /*!< AHB bus master priority register for PDM */ + __IO uint32_t PWM; /*!< AHB bus master priority register for PWM0, PWM1 and PWM2 */ +} AMLI_RAMPRI_Type; + +typedef struct { + __IO uint32_t RTS; /*!< Pin select for RTS signal */ + __IO uint32_t TXD; /*!< Pin select for TXD signal */ + __IO uint32_t CTS; /*!< Pin select for CTS signal */ + __IO uint32_t RXD; /*!< Pin select for RXD signal */ +} UARTE_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in receive buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ +} UARTE_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in transmit buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ +} UARTE_TXD_Type; + +typedef struct { + __IO uint32_t SCK; /*!< Pin select for SCK */ + __IO uint32_t MOSI; /*!< Pin select for MOSI signal */ + __IO uint32_t MISO; /*!< Pin select for MISO signal */ +} SPIM_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in receive buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ + __IO uint32_t LIST; /*!< EasyDMA list type */ +} SPIM_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in transmit buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ + __IO uint32_t LIST; /*!< EasyDMA list type */ +} SPIM_TXD_Type; + +typedef struct { + __IO uint32_t SCK; /*!< Pin select for SCK */ + __IO uint32_t MISO; /*!< Pin select for MISO signal */ + __IO uint32_t MOSI; /*!< Pin select for MOSI signal */ + __IO uint32_t CSN; /*!< Pin select for CSN signal */ +} SPIS_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< RXD data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in receive buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes received in last granted transaction */ +} SPIS_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< TXD data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in transmit buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transmitted in last granted transaction */ +} SPIS_TXD_Type; + +typedef struct { + __IO uint32_t SCL; /*!< Pin select for SCL signal */ + __IO uint32_t SDA; /*!< Pin select for SDA signal */ +} TWIM_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in receive buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ + __IO uint32_t LIST; /*!< EasyDMA list type */ +} TWIM_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in transmit buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ + __IO uint32_t LIST; /*!< EasyDMA list type */ +} TWIM_TXD_Type; + +typedef struct { + __IO uint32_t SCL; /*!< Pin select for SCL signal */ + __IO uint32_t SDA; /*!< Pin select for SDA signal */ +} TWIS_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< RXD Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in RXD buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last RXD transaction */ +} TWIS_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< TXD Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in TXD buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last TXD transaction */ +} TWIS_TXD_Type; + +typedef struct { + __IO uint32_t SCK; /*!< Pin select for SCK */ + __IO uint32_t MOSI; /*!< Pin select for MOSI */ + __IO uint32_t MISO; /*!< Pin select for MISO */ +} SPI_PSEL_Type; + +typedef struct { + __IO uint32_t RX; /*!< Result of last incoming frames */ +} NFCT_FRAMESTATUS_Type; + +typedef struct { + __IO uint32_t FRAMECONFIG; /*!< Configuration of outgoing frames */ + __IO uint32_t AMOUNT; /*!< Size of outgoing frame */ +} NFCT_TXD_Type; + +typedef struct { + __IO uint32_t FRAMECONFIG; /*!< Configuration of incoming frames */ + __I uint32_t AMOUNT; /*!< Size of last incoming frame */ +} NFCT_RXD_Type; + +typedef struct { + __IO uint32_t LIMITH; /*!< Description cluster[0]: Last results is equal or above CH[0].LIMIT.HIGH */ + __IO uint32_t LIMITL; /*!< Description cluster[0]: Last results is equal or below CH[0].LIMIT.LOW */ +} SAADC_EVENTS_CH_Type; + +typedef struct { + __IO uint32_t PSELP; /*!< Description cluster[0]: Input positive pin selection for CH[0] */ + __IO uint32_t PSELN; /*!< Description cluster[0]: Input negative pin selection for CH[0] */ + __IO uint32_t CONFIG; /*!< Description cluster[0]: Input configuration for CH[0] */ + __IO uint32_t LIMIT; /*!< Description cluster[0]: High/low limits for event monitoring + a channel */ +} SAADC_CH_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of buffer words to transfer */ + __I uint32_t AMOUNT; /*!< Number of buffer words transferred since last START */ +} SAADC_RESULT_Type; + +typedef struct { + __IO uint32_t LED; /*!< Pin select for LED signal */ + __IO uint32_t A; /*!< Pin select for A signal */ + __IO uint32_t B; /*!< Pin select for B signal */ +} QDEC_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Description cluster[0]: Beginning address in Data RAM of sequence + A */ + __IO uint32_t CNT; /*!< Description cluster[0]: Amount of values (duty cycles) in sequence + A */ + __IO uint32_t REFRESH; /*!< Description cluster[0]: Amount of additional PWM periods between + samples loaded to compare register (load every CNT+1 PWM periods) */ + __IO uint32_t ENDDELAY; /*!< Description cluster[0]: Time added after the sequence */ + __I uint32_t RESERVED1[4]; +} PWM_SEQ_Type; + +typedef struct { + __IO uint32_t OUT[4]; /*!< Description collection[0]: Output pin select for PWM channel + 0 */ +} PWM_PSEL_Type; + +typedef struct { + __IO uint32_t CLK; /*!< Pin number configuration for PDM CLK signal */ + __IO uint32_t DIN; /*!< Pin number configuration for PDM DIN signal */ +} PDM_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< RAM address pointer to write samples to with EasyDMA */ + __IO uint32_t MAXCNT; /*!< Number of samples to allocate memory for in EasyDMA mode */ +} PDM_SAMPLE_Type; + +typedef struct { + __O uint32_t EN; /*!< Description cluster[0]: Enable channel group 0 */ + __O uint32_t DIS; /*!< Description cluster[0]: Disable channel group 0 */ +} PPI_TASKS_CHG_Type; + +typedef struct { + __IO uint32_t EEP; /*!< Description cluster[0]: Channel 0 event end-point */ + __IO uint32_t TEP; /*!< Description cluster[0]: Channel 0 task end-point */ +} PPI_CH_Type; + +typedef struct { + __IO uint32_t TEP; /*!< Description cluster[0]: Channel 0 task end-point */ +} PPI_FORK_Type; + +typedef struct { + __IO uint32_t WA; /*!< Description cluster[0]: Write access to region 0 detected */ + __IO uint32_t RA; /*!< Description cluster[0]: Read access to region 0 detected */ +} MWU_EVENTS_REGION_Type; + +typedef struct { + __IO uint32_t WA; /*!< Description cluster[0]: Write access to peripheral region 0 + detected */ + __IO uint32_t RA; /*!< Description cluster[0]: Read access to peripheral region 0 detected */ +} MWU_EVENTS_PREGION_Type; + +typedef struct { + __IO uint32_t SUBSTATWA; /*!< Description cluster[0]: Source of event/interrupt in region + 0, write access detected while corresponding subregion was enabled + for watching */ + __IO uint32_t SUBSTATRA; /*!< Description cluster[0]: Source of event/interrupt in region + 0, read access detected while corresponding subregion was enabled + for watching */ +} MWU_PERREGION_Type; + +typedef struct { + __IO uint32_t START; /*!< Description cluster[0]: Start address for region 0 */ + __IO uint32_t END; /*!< Description cluster[0]: End address of region 0 */ + __I uint32_t RESERVED2[2]; +} MWU_REGION_Type; + +typedef struct { + __I uint32_t START; /*!< Description cluster[0]: Reserved for future use */ + __I uint32_t END; /*!< Description cluster[0]: Reserved for future use */ + __IO uint32_t SUBS; /*!< Description cluster[0]: Subregions of region 0 */ + __I uint32_t RESERVED3; +} MWU_PREGION_Type; + +typedef struct { + __IO uint32_t MODE; /*!< I2S mode. */ + __IO uint32_t RXEN; /*!< Reception (RX) enable. */ + __IO uint32_t TXEN; /*!< Transmission (TX) enable. */ + __IO uint32_t MCKEN; /*!< Master clock generator enable. */ + __IO uint32_t MCKFREQ; /*!< Master clock generator frequency. */ + __IO uint32_t RATIO; /*!< MCK / LRCK ratio. */ + __IO uint32_t SWIDTH; /*!< Sample width. */ + __IO uint32_t ALIGN; /*!< Alignment of sample within a frame. */ + __IO uint32_t FORMAT; /*!< Frame format. */ + __IO uint32_t CHANNELS; /*!< Enable channels. */ +} I2S_CONFIG_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Receive buffer RAM start address. */ +} I2S_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Transmit buffer RAM start address. */ +} I2S_TXD_Type; + +typedef struct { + __IO uint32_t MAXCNT; /*!< Size of RXD and TXD buffers. */ +} I2S_RXTXD_Type; + +typedef struct { + __IO uint32_t MCK; /*!< Pin select for MCK signal. */ + __IO uint32_t SCK; /*!< Pin select for SCK signal. */ + __IO uint32_t LRCK; /*!< Pin select for LRCK signal. */ + __IO uint32_t SDIN; /*!< Pin select for SDIN signal. */ + __IO uint32_t SDOUT; /*!< Pin select for SDOUT signal. */ +} I2S_PSEL_Type; + + +/* ================================================================================ */ +/* ================ FICR ================ */ +/* ================================================================================ */ + + +/** + * @brief Factory Information Configuration Registers (FICR) + */ + +typedef struct { /*!< FICR Structure */ + __I uint32_t RESERVED0[4]; + __I uint32_t CODEPAGESIZE; /*!< Code memory page size */ + __I uint32_t CODESIZE; /*!< Code memory size */ + __I uint32_t RESERVED1[18]; + __I uint32_t DEVICEID[2]; /*!< Description collection[0]: Device identifier */ + __I uint32_t RESERVED2[6]; + __I uint32_t ER[4]; /*!< Description collection[0]: Encryption Root, word 0 */ + __I uint32_t IR[4]; /*!< Description collection[0]: Identity Root, word 0 */ + __I uint32_t DEVICEADDRTYPE; /*!< Device address type */ + __I uint32_t DEVICEADDR[2]; /*!< Description collection[0]: Device address 0 */ + __I uint32_t RESERVED3[21]; + FICR_INFO_Type INFO; /*!< Device info */ + __I uint32_t RESERVED4[185]; + FICR_TEMP_Type TEMP; /*!< Registers storing factory TEMP module linearization coefficients */ + __I uint32_t RESERVED5[2]; + FICR_NFC_Type NFC; /*!< Unspecified */ +} NRF_FICR_Type; + + +/* ================================================================================ */ +/* ================ UICR ================ */ +/* ================================================================================ */ + + +/** + * @brief User Information Configuration Registers (UICR) + */ + +typedef struct { /*!< UICR Structure */ + __IO uint32_t UNUSED0; /*!< Unspecified */ + __IO uint32_t UNUSED1; /*!< Unspecified */ + __IO uint32_t UNUSED2; /*!< Unspecified */ + __I uint32_t RESERVED0; + __IO uint32_t UNUSED3; /*!< Unspecified */ + __IO uint32_t NRFFW[15]; /*!< Description collection[0]: Reserved for Nordic firmware design */ + __IO uint32_t NRFHW[12]; /*!< Description collection[0]: Reserved for Nordic hardware design */ + __IO uint32_t CUSTOMER[32]; /*!< Description collection[0]: Reserved for customer */ + __I uint32_t RESERVED1[64]; + __IO uint32_t PSELRESET[2]; /*!< Description collection[0]: Mapping of the nRESET function (see + POWER chapter for details) */ + __IO uint32_t APPROTECT; /*!< Access Port protection */ + __IO uint32_t NFCPINS; /*!< Setting of pins dedicated to NFC functionality: NFC antenna + or GPIO */ +} NRF_UICR_Type; + + +/* ================================================================================ */ +/* ================ BPROT ================ */ +/* ================================================================================ */ + + +/** + * @brief Block Protect (BPROT) + */ + +typedef struct { /*!< BPROT Structure */ + __I uint32_t RESERVED0[384]; + __IO uint32_t CONFIG0; /*!< Block protect configuration register 0 */ + __IO uint32_t CONFIG1; /*!< Block protect configuration register 1 */ + __IO uint32_t DISABLEINDEBUG; /*!< Disable protection mechanism in debug interface mode */ + __IO uint32_t UNUSED0; /*!< Unspecified */ + __IO uint32_t CONFIG2; /*!< Block protect configuration register 2 */ + __IO uint32_t CONFIG3; /*!< Block protect configuration register 3 */ +} NRF_BPROT_Type; + + +/* ================================================================================ */ +/* ================ POWER ================ */ +/* ================================================================================ */ + + +/** + * @brief Power control (POWER) + */ + +typedef struct { /*!< POWER Structure */ + __I uint32_t RESERVED0[30]; + __O uint32_t TASKS_CONSTLAT; /*!< Enable constant latency mode */ + __O uint32_t TASKS_LOWPWR; /*!< Enable low power mode (variable latency) */ + __I uint32_t RESERVED1[34]; + __IO uint32_t EVENTS_POFWARN; /*!< Power failure warning */ + __I uint32_t RESERVED2[2]; + __IO uint32_t EVENTS_SLEEPENTER; /*!< CPU entered WFI/WFE sleep */ + __IO uint32_t EVENTS_SLEEPEXIT; /*!< CPU exited WFI/WFE sleep */ + __I uint32_t RESERVED3[122]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED4[61]; + __IO uint32_t RESETREAS; /*!< Reset reason */ + __I uint32_t RESERVED5[9]; + __I uint32_t RAMSTATUS; /*!< Deprecated register - RAM status register */ + __I uint32_t RESERVED6[53]; + __O uint32_t SYSTEMOFF; /*!< System OFF register */ + __I uint32_t RESERVED7[3]; + __IO uint32_t POFCON; /*!< Power failure comparator configuration */ + __I uint32_t RESERVED8[2]; + __IO uint32_t GPREGRET; /*!< General purpose retention register */ + __IO uint32_t GPREGRET2; /*!< General purpose retention register */ + __IO uint32_t RAMON; /*!< Deprecated register - RAM on/off register (this register is + retained) */ + __I uint32_t RESERVED9[11]; + __IO uint32_t RAMONB; /*!< Deprecated register - RAM on/off register (this register is + retained) */ + __I uint32_t RESERVED10[8]; + __IO uint32_t DCDCEN; /*!< DC/DC enable register */ + __I uint32_t RESERVED11[225]; + POWER_RAM_Type RAM[8]; /*!< Unspecified */ +} NRF_POWER_Type; + + +/* ================================================================================ */ +/* ================ CLOCK ================ */ +/* ================================================================================ */ + + +/** + * @brief Clock control (CLOCK) + */ + +typedef struct { /*!< CLOCK Structure */ + __O uint32_t TASKS_HFCLKSTART; /*!< Start HFCLK crystal oscillator */ + __O uint32_t TASKS_HFCLKSTOP; /*!< Stop HFCLK crystal oscillator */ + __O uint32_t TASKS_LFCLKSTART; /*!< Start LFCLK source */ + __O uint32_t TASKS_LFCLKSTOP; /*!< Stop LFCLK source */ + __O uint32_t TASKS_CAL; /*!< Start calibration of LFRC oscillator */ + __O uint32_t TASKS_CTSTART; /*!< Start calibration timer */ + __O uint32_t TASKS_CTSTOP; /*!< Stop calibration timer */ + __I uint32_t RESERVED0[57]; + __IO uint32_t EVENTS_HFCLKSTARTED; /*!< HFCLK oscillator started */ + __IO uint32_t EVENTS_LFCLKSTARTED; /*!< LFCLK started */ + __I uint32_t RESERVED1; + __IO uint32_t EVENTS_DONE; /*!< Calibration of LFCLK RC oscillator complete event */ + __IO uint32_t EVENTS_CTTO; /*!< Calibration timer timeout */ + __I uint32_t RESERVED2[124]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[63]; + __I uint32_t HFCLKRUN; /*!< Status indicating that HFCLKSTART task has been triggered */ + __I uint32_t HFCLKSTAT; /*!< HFCLK status */ + __I uint32_t RESERVED4; + __I uint32_t LFCLKRUN; /*!< Status indicating that LFCLKSTART task has been triggered */ + __I uint32_t LFCLKSTAT; /*!< LFCLK status */ + __I uint32_t LFCLKSRCCOPY; /*!< Copy of LFCLKSRC register, set when LFCLKSTART task was triggered */ + __I uint32_t RESERVED5[62]; + __IO uint32_t LFCLKSRC; /*!< Clock source for the LFCLK */ + __I uint32_t RESERVED6[7]; + __IO uint32_t CTIV; /*!< Calibration timer interval (retained register, same reset behaviour + as RESETREAS) */ + __I uint32_t RESERVED7[8]; + __IO uint32_t TRACECONFIG; /*!< Clocking options for the Trace Port debug interface */ +} NRF_CLOCK_Type; + + +/* ================================================================================ */ +/* ================ AMLI ================ */ +/* ================================================================================ */ + + +/** + * @brief AHB Multi-Layer Interface (AMLI) + */ + +typedef struct { /*!< AMLI Structure */ + __I uint32_t RESERVED0[896]; + AMLI_RAMPRI_Type RAMPRI; /*!< RAM configurable priority configuration structure */ +} NRF_AMLI_Type; + + +/* ================================================================================ */ +/* ================ RADIO ================ */ +/* ================================================================================ */ + + +/** + * @brief 2.4 GHz Radio (RADIO) + */ + +typedef struct { /*!< RADIO Structure */ + __O uint32_t TASKS_TXEN; /*!< Enable RADIO in TX mode */ + __O uint32_t TASKS_RXEN; /*!< Enable RADIO in RX mode */ + __O uint32_t TASKS_START; /*!< Start RADIO */ + __O uint32_t TASKS_STOP; /*!< Stop RADIO */ + __O uint32_t TASKS_DISABLE; /*!< Disable RADIO */ + __O uint32_t TASKS_RSSISTART; /*!< Start the RSSI and take one single sample of the receive signal + strength. */ + __O uint32_t TASKS_RSSISTOP; /*!< Stop the RSSI measurement */ + __O uint32_t TASKS_BCSTART; /*!< Start the bit counter */ + __O uint32_t TASKS_BCSTOP; /*!< Stop the bit counter */ + __I uint32_t RESERVED0[55]; + __IO uint32_t EVENTS_READY; /*!< RADIO has ramped up and is ready to be started */ + __IO uint32_t EVENTS_ADDRESS; /*!< Address sent or received */ + __IO uint32_t EVENTS_PAYLOAD; /*!< Packet payload sent or received */ + __IO uint32_t EVENTS_END; /*!< Packet sent or received */ + __IO uint32_t EVENTS_DISABLED; /*!< RADIO has been disabled */ + __IO uint32_t EVENTS_DEVMATCH; /*!< A device address match occurred on the last received packet */ + __IO uint32_t EVENTS_DEVMISS; /*!< No device address match occurred on the last received packet */ + __IO uint32_t EVENTS_RSSIEND; /*!< Sampling of receive signal strength complete. */ + __I uint32_t RESERVED1[2]; + __IO uint32_t EVENTS_BCMATCH; /*!< Bit counter reached bit count value. */ + __I uint32_t RESERVED2; + __IO uint32_t EVENTS_CRCOK; /*!< Packet received with CRC ok */ + __IO uint32_t EVENTS_CRCERROR; /*!< Packet received with CRC error */ + __I uint32_t RESERVED3[50]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED4[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED5[61]; + __I uint32_t CRCSTATUS; /*!< CRC status */ + __I uint32_t RESERVED6; + __I uint32_t RXMATCH; /*!< Received address */ + __I uint32_t RXCRC; /*!< CRC field of previously received packet */ + __I uint32_t DAI; /*!< Device address match index */ + __I uint32_t RESERVED7[60]; + __IO uint32_t PACKETPTR; /*!< Packet pointer */ + __IO uint32_t FREQUENCY; /*!< Frequency */ + __IO uint32_t TXPOWER; /*!< Output power */ + __IO uint32_t MODE; /*!< Data rate and modulation */ + __IO uint32_t PCNF0; /*!< Packet configuration register 0 */ + __IO uint32_t PCNF1; /*!< Packet configuration register 1 */ + __IO uint32_t BASE0; /*!< Base address 0 */ + __IO uint32_t BASE1; /*!< Base address 1 */ + __IO uint32_t PREFIX0; /*!< Prefixes bytes for logical addresses 0-3 */ + __IO uint32_t PREFIX1; /*!< Prefixes bytes for logical addresses 4-7 */ + __IO uint32_t TXADDRESS; /*!< Transmit address select */ + __IO uint32_t RXADDRESSES; /*!< Receive address select */ + __IO uint32_t CRCCNF; /*!< CRC configuration */ + __IO uint32_t CRCPOLY; /*!< CRC polynomial */ + __IO uint32_t CRCINIT; /*!< CRC initial value */ + __IO uint32_t UNUSED0; /*!< Unspecified */ + __IO uint32_t TIFS; /*!< Inter Frame Spacing in us */ + __I uint32_t RSSISAMPLE; /*!< RSSI sample */ + __I uint32_t RESERVED8; + __I uint32_t STATE; /*!< Current radio state */ + __IO uint32_t DATAWHITEIV; /*!< Data whitening initial value */ + __I uint32_t RESERVED9[2]; + __IO uint32_t BCC; /*!< Bit counter compare */ + __I uint32_t RESERVED10[39]; + __IO uint32_t DAB[8]; /*!< Description collection[0]: Device address base segment 0 */ + __IO uint32_t DAP[8]; /*!< Description collection[0]: Device address prefix 0 */ + __IO uint32_t DACNF; /*!< Device address match configuration */ + __I uint32_t RESERVED11[3]; + __IO uint32_t MODECNF0; /*!< Radio mode configuration register 0 */ + __I uint32_t RESERVED12[618]; + __IO uint32_t POWER; /*!< Peripheral power control */ +} NRF_RADIO_Type; + + +/* ================================================================================ */ +/* ================ UARTE ================ */ +/* ================================================================================ */ + + +/** + * @brief UART with EasyDMA (UARTE) + */ + +typedef struct { /*!< UARTE Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start UART receiver */ + __O uint32_t TASKS_STOPRX; /*!< Stop UART receiver */ + __O uint32_t TASKS_STARTTX; /*!< Start UART transmitter */ + __O uint32_t TASKS_STOPTX; /*!< Stop UART transmitter */ + __I uint32_t RESERVED0[7]; + __O uint32_t TASKS_FLUSHRX; /*!< Flush RX FIFO into RX buffer */ + __I uint32_t RESERVED1[52]; + __IO uint32_t EVENTS_CTS; /*!< CTS is activated (set low). Clear To Send. */ + __IO uint32_t EVENTS_NCTS; /*!< CTS is deactivated (set high). Not Clear To Send. */ + __I uint32_t RESERVED2[2]; + __IO uint32_t EVENTS_ENDRX; /*!< Receive buffer is filled up */ + __I uint32_t RESERVED3[3]; + __IO uint32_t EVENTS_ENDTX; /*!< Last TX byte transmitted */ + __IO uint32_t EVENTS_ERROR; /*!< Error detected */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_RXTO; /*!< Receiver timeout */ + __I uint32_t RESERVED5; + __IO uint32_t EVENTS_RXSTARTED; /*!< UART receiver has started */ + __IO uint32_t EVENTS_TXSTARTED; /*!< UART transmitter has started */ + __I uint32_t RESERVED6; + __IO uint32_t EVENTS_TXSTOPPED; /*!< Transmitter stopped */ + __I uint32_t RESERVED7[41]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED8[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED9[93]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t RESERVED10[31]; + __IO uint32_t ENABLE; /*!< Enable UART */ + __I uint32_t RESERVED11; + UARTE_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED12[3]; + __IO uint32_t BAUDRATE; /*!< Baud rate */ + __I uint32_t RESERVED13[3]; + UARTE_RXD_Type RXD; /*!< RXD EasyDMA channel */ + __I uint32_t RESERVED14; + UARTE_TXD_Type TXD; /*!< TXD EasyDMA channel */ + __I uint32_t RESERVED15[7]; + __IO uint32_t CONFIG; /*!< Configuration of parity and hardware flow control */ +} NRF_UARTE_Type; + + +/* ================================================================================ */ +/* ================ UART ================ */ +/* ================================================================================ */ + + +/** + * @brief Universal Asynchronous Receiver/Transmitter (UART) + */ + +typedef struct { /*!< UART Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start UART receiver */ + __O uint32_t TASKS_STOPRX; /*!< Stop UART receiver */ + __O uint32_t TASKS_STARTTX; /*!< Start UART transmitter */ + __O uint32_t TASKS_STOPTX; /*!< Stop UART transmitter */ + __I uint32_t RESERVED0[3]; + __O uint32_t TASKS_SUSPEND; /*!< Suspend UART */ + __I uint32_t RESERVED1[56]; + __IO uint32_t EVENTS_CTS; /*!< CTS is activated (set low). Clear To Send. */ + __IO uint32_t EVENTS_NCTS; /*!< CTS is deactivated (set high). Not Clear To Send. */ + __IO uint32_t EVENTS_RXDRDY; /*!< Data received in RXD */ + __I uint32_t RESERVED2[4]; + __IO uint32_t EVENTS_TXDRDY; /*!< Data sent from TXD */ + __I uint32_t RESERVED3; + __IO uint32_t EVENTS_ERROR; /*!< Error detected */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_RXTO; /*!< Receiver timeout */ + __I uint32_t RESERVED5[46]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED6[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED7[93]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t RESERVED8[31]; + __IO uint32_t ENABLE; /*!< Enable UART */ + __I uint32_t RESERVED9; + __IO uint32_t PSELRTS; /*!< Pin select for RTS */ + __IO uint32_t PSELTXD; /*!< Pin select for TXD */ + __IO uint32_t PSELCTS; /*!< Pin select for CTS */ + __IO uint32_t PSELRXD; /*!< Pin select for RXD */ + __I uint32_t RXD; /*!< RXD register */ + __O uint32_t TXD; /*!< TXD register */ + __I uint32_t RESERVED10; + __IO uint32_t BAUDRATE; /*!< Baud rate */ + __I uint32_t RESERVED11[17]; + __IO uint32_t CONFIG; /*!< Configuration of parity and hardware flow control */ +} NRF_UART_Type; + + +/* ================================================================================ */ +/* ================ SPIM ================ */ +/* ================================================================================ */ + + +/** + * @brief Serial Peripheral Interface Master with EasyDMA 0 (SPIM) + */ + +typedef struct { /*!< SPIM Structure */ + __I uint32_t RESERVED0[4]; + __O uint32_t TASKS_START; /*!< Start SPI transaction */ + __O uint32_t TASKS_STOP; /*!< Stop SPI transaction */ + __I uint32_t RESERVED1; + __O uint32_t TASKS_SUSPEND; /*!< Suspend SPI transaction */ + __O uint32_t TASKS_RESUME; /*!< Resume SPI transaction */ + __I uint32_t RESERVED2[56]; + __IO uint32_t EVENTS_STOPPED; /*!< SPI transaction has stopped */ + __I uint32_t RESERVED3[2]; + __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached */ + __I uint32_t RESERVED4; + __IO uint32_t EVENTS_END; /*!< End of RXD buffer and TXD buffer reached */ + __I uint32_t RESERVED5; + __IO uint32_t EVENTS_ENDTX; /*!< End of TXD buffer reached */ + __I uint32_t RESERVED6[10]; + __IO uint32_t EVENTS_STARTED; /*!< Transaction started */ + __I uint32_t RESERVED7[44]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED8[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED9[125]; + __IO uint32_t ENABLE; /*!< Enable SPIM */ + __I uint32_t RESERVED10; + SPIM_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED11[4]; + __IO uint32_t FREQUENCY; /*!< SPI frequency */ + __I uint32_t RESERVED12[3]; + SPIM_RXD_Type RXD; /*!< RXD EasyDMA channel */ + SPIM_TXD_Type TXD; /*!< TXD EasyDMA channel */ + __IO uint32_t CONFIG; /*!< Configuration register */ + __I uint32_t RESERVED13[26]; + __IO uint32_t ORC; /*!< Over-read character. Character clocked out in case and over-read + of the TXD buffer. */ +} NRF_SPIM_Type; + + +/* ================================================================================ */ +/* ================ SPIS ================ */ +/* ================================================================================ */ + + +/** + * @brief SPI Slave 0 (SPIS) + */ + +typedef struct { /*!< SPIS Structure */ + __I uint32_t RESERVED0[9]; + __O uint32_t TASKS_ACQUIRE; /*!< Acquire SPI semaphore */ + __O uint32_t TASKS_RELEASE; /*!< Release SPI semaphore, enabling the SPI slave to acquire it */ + __I uint32_t RESERVED1[54]; + __IO uint32_t EVENTS_END; /*!< Granted transaction completed */ + __I uint32_t RESERVED2[2]; + __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached */ + __I uint32_t RESERVED3[5]; + __IO uint32_t EVENTS_ACQUIRED; /*!< Semaphore acquired */ + __I uint32_t RESERVED4[53]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED5[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED6[61]; + __I uint32_t SEMSTAT; /*!< Semaphore status register */ + __I uint32_t RESERVED7[15]; + __IO uint32_t STATUS; /*!< Status from last transaction */ + __I uint32_t RESERVED8[47]; + __IO uint32_t ENABLE; /*!< Enable SPI slave */ + __I uint32_t RESERVED9; + SPIS_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED10[7]; + SPIS_RXD_Type RXD; /*!< Unspecified */ + __I uint32_t RESERVED11; + SPIS_TXD_Type TXD; /*!< Unspecified */ + __I uint32_t RESERVED12; + __IO uint32_t CONFIG; /*!< Configuration register */ + __I uint32_t RESERVED13; + __IO uint32_t DEF; /*!< Default character. Character clocked out in case of an ignored + transaction. */ + __I uint32_t RESERVED14[24]; + __IO uint32_t ORC; /*!< Over-read character */ +} NRF_SPIS_Type; + + +/* ================================================================================ */ +/* ================ TWIM ================ */ +/* ================================================================================ */ + + +/** + * @brief I2C compatible Two-Wire Master Interface with EasyDMA 0 (TWIM) + */ + +typedef struct { /*!< TWIM Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start TWI receive sequence */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STARTTX; /*!< Start TWI transmit sequence */ + __I uint32_t RESERVED1[2]; + __O uint32_t TASKS_STOP; /*!< Stop TWI transaction. Must be issued while the TWI master is + not suspended. */ + __I uint32_t RESERVED2; + __O uint32_t TASKS_SUSPEND; /*!< Suspend TWI transaction */ + __O uint32_t TASKS_RESUME; /*!< Resume TWI transaction */ + __I uint32_t RESERVED3[56]; + __IO uint32_t EVENTS_STOPPED; /*!< TWI stopped */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_ERROR; /*!< TWI error */ + __I uint32_t RESERVED5[8]; + __IO uint32_t EVENTS_SUSPENDED; /*!< Last byte has been sent out after the SUSPEND task has been + issued, TWI traffic is now suspended. */ + __IO uint32_t EVENTS_RXSTARTED; /*!< Receive sequence started */ + __IO uint32_t EVENTS_TXSTARTED; /*!< Transmit sequence started */ + __I uint32_t RESERVED6[2]; + __IO uint32_t EVENTS_LASTRX; /*!< Byte boundary, starting to receive the last byte */ + __IO uint32_t EVENTS_LASTTX; /*!< Byte boundary, starting to transmit the last byte */ + __I uint32_t RESERVED7[39]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED8[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED9[110]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t RESERVED10[14]; + __IO uint32_t ENABLE; /*!< Enable TWIM */ + __I uint32_t RESERVED11; + TWIM_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED12[5]; + __IO uint32_t FREQUENCY; /*!< TWI frequency */ + __I uint32_t RESERVED13[3]; + TWIM_RXD_Type RXD; /*!< RXD EasyDMA channel */ + TWIM_TXD_Type TXD; /*!< TXD EasyDMA channel */ + __I uint32_t RESERVED14[13]; + __IO uint32_t ADDRESS; /*!< Address used in the TWI transfer */ +} NRF_TWIM_Type; + + +/* ================================================================================ */ +/* ================ TWIS ================ */ +/* ================================================================================ */ + + +/** + * @brief I2C compatible Two-Wire Slave Interface with EasyDMA 0 (TWIS) + */ + +typedef struct { /*!< TWIS Structure */ + __I uint32_t RESERVED0[5]; + __O uint32_t TASKS_STOP; /*!< Stop TWI transaction */ + __I uint32_t RESERVED1; + __O uint32_t TASKS_SUSPEND; /*!< Suspend TWI transaction */ + __O uint32_t TASKS_RESUME; /*!< Resume TWI transaction */ + __I uint32_t RESERVED2[3]; + __O uint32_t TASKS_PREPARERX; /*!< Prepare the TWI slave to respond to a write command */ + __O uint32_t TASKS_PREPARETX; /*!< Prepare the TWI slave to respond to a read command */ + __I uint32_t RESERVED3[51]; + __IO uint32_t EVENTS_STOPPED; /*!< TWI stopped */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_ERROR; /*!< TWI error */ + __I uint32_t RESERVED5[9]; + __IO uint32_t EVENTS_RXSTARTED; /*!< Receive sequence started */ + __IO uint32_t EVENTS_TXSTARTED; /*!< Transmit sequence started */ + __I uint32_t RESERVED6[4]; + __IO uint32_t EVENTS_WRITE; /*!< Write command received */ + __IO uint32_t EVENTS_READ; /*!< Read command received */ + __I uint32_t RESERVED7[37]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED8[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED9[113]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t MATCH; /*!< Status register indicating which address had a match */ + __I uint32_t RESERVED10[10]; + __IO uint32_t ENABLE; /*!< Enable TWIS */ + __I uint32_t RESERVED11; + TWIS_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED12[9]; + TWIS_RXD_Type RXD; /*!< RXD EasyDMA channel */ + __I uint32_t RESERVED13; + TWIS_TXD_Type TXD; /*!< TXD EasyDMA channel */ + __I uint32_t RESERVED14[14]; + __IO uint32_t ADDRESS[2]; /*!< Description collection[0]: TWI slave address 0 */ + __I uint32_t RESERVED15; + __IO uint32_t CONFIG; /*!< Configuration register for the address match mechanism */ + __I uint32_t RESERVED16[10]; + __IO uint32_t ORC; /*!< Over-read character. Character sent out in case of an over-read + of the transmit buffer. */ +} NRF_TWIS_Type; + + +/* ================================================================================ */ +/* ================ SPI ================ */ +/* ================================================================================ */ + + +/** + * @brief Serial Peripheral Interface 0 (SPI) + */ + +typedef struct { /*!< SPI Structure */ + __I uint32_t RESERVED0[66]; + __IO uint32_t EVENTS_READY; /*!< TXD byte sent and RXD byte received */ + __I uint32_t RESERVED1[126]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[125]; + __IO uint32_t ENABLE; /*!< Enable SPI */ + __I uint32_t RESERVED3; + SPI_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED4; + __I uint32_t RXD; /*!< RXD register */ + __IO uint32_t TXD; /*!< TXD register */ + __I uint32_t RESERVED5; + __IO uint32_t FREQUENCY; /*!< SPI frequency */ + __I uint32_t RESERVED6[11]; + __IO uint32_t CONFIG; /*!< Configuration register */ +} NRF_SPI_Type; + + +/* ================================================================================ */ +/* ================ TWI ================ */ +/* ================================================================================ */ + + +/** + * @brief I2C compatible Two-Wire Interface 0 (TWI) + */ + +typedef struct { /*!< TWI Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start TWI receive sequence */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STARTTX; /*!< Start TWI transmit sequence */ + __I uint32_t RESERVED1[2]; + __O uint32_t TASKS_STOP; /*!< Stop TWI transaction */ + __I uint32_t RESERVED2; + __O uint32_t TASKS_SUSPEND; /*!< Suspend TWI transaction */ + __O uint32_t TASKS_RESUME; /*!< Resume TWI transaction */ + __I uint32_t RESERVED3[56]; + __IO uint32_t EVENTS_STOPPED; /*!< TWI stopped */ + __IO uint32_t EVENTS_RXDREADY; /*!< TWI RXD byte received */ + __I uint32_t RESERVED4[4]; + __IO uint32_t EVENTS_TXDSENT; /*!< TWI TXD byte sent */ + __I uint32_t RESERVED5; + __IO uint32_t EVENTS_ERROR; /*!< TWI error */ + __I uint32_t RESERVED6[4]; + __IO uint32_t EVENTS_BB; /*!< TWI byte boundary, generated before each byte that is sent or + received */ + __I uint32_t RESERVED7[3]; + __IO uint32_t EVENTS_SUSPENDED; /*!< TWI entered the suspended state */ + __I uint32_t RESERVED8[45]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED9[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED10[110]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t RESERVED11[14]; + __IO uint32_t ENABLE; /*!< Enable TWI */ + __I uint32_t RESERVED12; + __IO uint32_t PSELSCL; /*!< Pin select for SCL */ + __IO uint32_t PSELSDA; /*!< Pin select for SDA */ + __I uint32_t RESERVED13[2]; + __I uint32_t RXD; /*!< RXD register */ + __IO uint32_t TXD; /*!< TXD register */ + __I uint32_t RESERVED14; + __IO uint32_t FREQUENCY; /*!< TWI frequency */ + __I uint32_t RESERVED15[24]; + __IO uint32_t ADDRESS; /*!< Address used in the TWI transfer */ +} NRF_TWI_Type; + + +/* ================================================================================ */ +/* ================ NFCT ================ */ +/* ================================================================================ */ + + +/** + * @brief NFC-A compatible radio (NFCT) + */ + +typedef struct { /*!< NFCT Structure */ + __O uint32_t TASKS_ACTIVATE; /*!< Activate NFC peripheral for incoming and outgoing frames, change + state to activated */ + __O uint32_t TASKS_DISABLE; /*!< Disable NFC peripheral */ + __O uint32_t TASKS_SENSE; /*!< Enable NFC sense field mode, change state to sense mode */ + __O uint32_t TASKS_STARTTX; /*!< Start transmission of a outgoing frame, change state to transmit */ + __I uint32_t RESERVED0[3]; + __O uint32_t TASKS_ENABLERXDATA; /*!< Initializes the EasyDMA for receive. */ + __I uint32_t RESERVED1; + __O uint32_t TASKS_GOIDLE; /*!< Force state machine to IDLE state */ + __O uint32_t TASKS_GOSLEEP; /*!< Force state machine to SLEEP_A state */ + __I uint32_t RESERVED2[53]; + __IO uint32_t EVENTS_READY; /*!< The NFC peripheral is ready to receive and send frames */ + __IO uint32_t EVENTS_FIELDDETECTED; /*!< Remote NFC field detected */ + __IO uint32_t EVENTS_FIELDLOST; /*!< Remote NFC field lost */ + __IO uint32_t EVENTS_TXFRAMESTART; /*!< Marks the start of the first symbol of a transmitted frame */ + __IO uint32_t EVENTS_TXFRAMEEND; /*!< Marks the end of the last transmitted on-air symbol of a frame */ + __IO uint32_t EVENTS_RXFRAMESTART; /*!< Marks the end of the first symbol of a received frame */ + __IO uint32_t EVENTS_RXFRAMEEND; /*!< Received data have been checked (CRC, parity) and transferred + to RAM, and EasyDMA has ended accessing the RX buffer */ + __IO uint32_t EVENTS_ERROR; /*!< NFC error reported. The ERRORSTATUS register contains details + on the source of the error. */ + __I uint32_t RESERVED3[2]; + __IO uint32_t EVENTS_RXERROR; /*!< NFC RX frame error reported. The FRAMESTATUS.RX register contains + details on the source of the error. */ + __IO uint32_t EVENTS_ENDRX; /*!< RX buffer (as defined by PACKETPTR and MAXLEN) in Data RAM full. */ + __IO uint32_t EVENTS_ENDTX; /*!< Transmission of data in RAM has ended, and EasyDMA has ended + accessing the TX buffer */ + __I uint32_t RESERVED4; + __IO uint32_t EVENTS_AUTOCOLRESSTARTED; /*!< Auto collision resolution process has started */ + __I uint32_t RESERVED5[3]; + __IO uint32_t EVENTS_COLLISION; /*!< NFC Auto collision resolution error reported. */ + __IO uint32_t EVENTS_SELECTED; /*!< NFC Auto collision resolution successfully completed */ + __IO uint32_t EVENTS_STARTED; /*!< EasyDMA is ready to receive or send frames. */ + __I uint32_t RESERVED6[43]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED7[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED8[62]; + __IO uint32_t ERRORSTATUS; /*!< NFC Error Status register */ + __I uint32_t RESERVED9; + NFCT_FRAMESTATUS_Type FRAMESTATUS; /*!< Unspecified */ + __I uint32_t RESERVED10[8]; + __I uint32_t CURRENTLOADCTRL; /*!< Current value driven to the NFC Load Control */ + __I uint32_t RESERVED11[2]; + __I uint32_t FIELDPRESENT; /*!< Indicates the presence or not of a valid field */ + __I uint32_t RESERVED12[49]; + __IO uint32_t FRAMEDELAYMIN; /*!< Minimum frame delay */ + __IO uint32_t FRAMEDELAYMAX; /*!< Maximum frame delay */ + __IO uint32_t FRAMEDELAYMODE; /*!< Configuration register for the Frame Delay Timer */ + __IO uint32_t PACKETPTR; /*!< Packet pointer for TXD and RXD data storage in Data RAM */ + __IO uint32_t MAXLEN; /*!< Size of allocated for TXD and RXD data storage buffer in Data + RAM */ + NFCT_TXD_Type TXD; /*!< Unspecified */ + NFCT_RXD_Type RXD; /*!< Unspecified */ + __I uint32_t RESERVED13[26]; + __IO uint32_t NFCID1_LAST; /*!< Last NFCID1 part (4, 7 or 10 bytes ID) */ + __IO uint32_t NFCID1_2ND_LAST; /*!< Second last NFCID1 part (7 or 10 bytes ID) */ + __IO uint32_t NFCID1_3RD_LAST; /*!< Third last NFCID1 part (10 bytes ID) */ + __I uint32_t RESERVED14; + __IO uint32_t SENSRES; /*!< NFC-A SENS_RES auto-response settings */ + __IO uint32_t SELRES; /*!< NFC-A SEL_RES auto-response settings */ +} NRF_NFCT_Type; + + +/* ================================================================================ */ +/* ================ GPIOTE ================ */ +/* ================================================================================ */ + + +/** + * @brief GPIO Tasks and Events (GPIOTE) + */ + +typedef struct { /*!< GPIOTE Structure */ + __O uint32_t TASKS_OUT[8]; /*!< Description collection[0]: Task for writing to pin specified + in CONFIG[0].PSEL. Action on pin is configured in CONFIG[0].POLARITY. */ + __I uint32_t RESERVED0[4]; + __O uint32_t TASKS_SET[8]; /*!< Description collection[0]: Task for writing to pin specified + in CONFIG[0].PSEL. Action on pin is to set it high. */ + __I uint32_t RESERVED1[4]; + __O uint32_t TASKS_CLR[8]; /*!< Description collection[0]: Task for writing to pin specified + in CONFIG[0].PSEL. Action on pin is to set it low. */ + __I uint32_t RESERVED2[32]; + __IO uint32_t EVENTS_IN[8]; /*!< Description collection[0]: Event generated from pin specified + in CONFIG[0].PSEL */ + __I uint32_t RESERVED3[23]; + __IO uint32_t EVENTS_PORT; /*!< Event generated from multiple input GPIO pins with SENSE mechanism + enabled */ + __I uint32_t RESERVED4[97]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED5[129]; + __IO uint32_t CONFIG[8]; /*!< Description collection[0]: Configuration for OUT[n], SET[n] + and CLR[n] tasks and IN[n] event */ +} NRF_GPIOTE_Type; + + +/* ================================================================================ */ +/* ================ SAADC ================ */ +/* ================================================================================ */ + + +/** + * @brief Analog to Digital Converter (SAADC) + */ + +typedef struct { /*!< SAADC Structure */ + __O uint32_t TASKS_START; /*!< Start the ADC and prepare the result buffer in RAM */ + __O uint32_t TASKS_SAMPLE; /*!< Take one ADC sample, if scan is enabled all channels are sampled */ + __O uint32_t TASKS_STOP; /*!< Stop the ADC and terminate any on-going conversion */ + __O uint32_t TASKS_CALIBRATEOFFSET; /*!< Starts offset auto-calibration */ + __I uint32_t RESERVED0[60]; + __IO uint32_t EVENTS_STARTED; /*!< The ADC has started */ + __IO uint32_t EVENTS_END; /*!< The ADC has filled up the Result buffer */ + __IO uint32_t EVENTS_DONE; /*!< A conversion task has been completed. Depending on the mode, + multiple conversions might be needed for a result to be transferred + to RAM. */ + __IO uint32_t EVENTS_RESULTDONE; /*!< A result is ready to get transferred to RAM. */ + __IO uint32_t EVENTS_CALIBRATEDONE; /*!< Calibration is complete */ + __IO uint32_t EVENTS_STOPPED; /*!< The ADC has stopped */ + SAADC_EVENTS_CH_Type EVENTS_CH[8]; /*!< Unspecified */ + __I uint32_t RESERVED1[106]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[61]; + __I uint32_t STATUS; /*!< Status */ + __I uint32_t RESERVED3[63]; + __IO uint32_t ENABLE; /*!< Enable or disable ADC */ + __I uint32_t RESERVED4[3]; + SAADC_CH_Type CH[8]; /*!< Unspecified */ + __I uint32_t RESERVED5[24]; + __IO uint32_t RESOLUTION; /*!< Resolution configuration */ + __IO uint32_t OVERSAMPLE; /*!< Oversampling configuration. OVERSAMPLE should not be combined + with SCAN. The RESOLUTION is applied before averaging, thus + for high OVERSAMPLE a higher RESOLUTION should be used. */ + __IO uint32_t SAMPLERATE; /*!< Controls normal or continuous sample rate */ + __I uint32_t RESERVED6[12]; + SAADC_RESULT_Type RESULT; /*!< RESULT EasyDMA channel */ +} NRF_SAADC_Type; + + +/* ================================================================================ */ +/* ================ TIMER ================ */ +/* ================================================================================ */ + + +/** + * @brief Timer/Counter 0 (TIMER) + */ + +typedef struct { /*!< TIMER Structure */ + __O uint32_t TASKS_START; /*!< Start Timer */ + __O uint32_t TASKS_STOP; /*!< Stop Timer */ + __O uint32_t TASKS_COUNT; /*!< Increment Timer (Counter mode only) */ + __O uint32_t TASKS_CLEAR; /*!< Clear time */ + __O uint32_t TASKS_SHUTDOWN; /*!< Deprecated register - Shut down timer */ + __I uint32_t RESERVED0[11]; + __O uint32_t TASKS_CAPTURE[6]; /*!< Description collection[0]: Capture Timer value to CC[0] register */ + __I uint32_t RESERVED1[58]; + __IO uint32_t EVENTS_COMPARE[6]; /*!< Description collection[0]: Compare event on CC[0] match */ + __I uint32_t RESERVED2[42]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED3[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED4[126]; + __IO uint32_t MODE; /*!< Timer mode selection */ + __IO uint32_t BITMODE; /*!< Configure the number of bits used by the TIMER */ + __I uint32_t RESERVED5; + __IO uint32_t PRESCALER; /*!< Timer prescaler register */ + __I uint32_t RESERVED6[11]; + __IO uint32_t CC[6]; /*!< Description collection[0]: Capture/Compare register 0 */ +} NRF_TIMER_Type; + + +/* ================================================================================ */ +/* ================ RTC ================ */ +/* ================================================================================ */ + + +/** + * @brief Real time counter 0 (RTC) + */ + +typedef struct { /*!< RTC Structure */ + __O uint32_t TASKS_START; /*!< Start RTC COUNTER */ + __O uint32_t TASKS_STOP; /*!< Stop RTC COUNTER */ + __O uint32_t TASKS_CLEAR; /*!< Clear RTC COUNTER */ + __O uint32_t TASKS_TRIGOVRFLW; /*!< Set COUNTER to 0xFFFFF0 */ + __I uint32_t RESERVED0[60]; + __IO uint32_t EVENTS_TICK; /*!< Event on COUNTER increment */ + __IO uint32_t EVENTS_OVRFLW; /*!< Event on COUNTER overflow */ + __I uint32_t RESERVED1[14]; + __IO uint32_t EVENTS_COMPARE[4]; /*!< Description collection[0]: Compare event on CC[0] match */ + __I uint32_t RESERVED2[109]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[13]; + __IO uint32_t EVTEN; /*!< Enable or disable event routing */ + __IO uint32_t EVTENSET; /*!< Enable event routing */ + __IO uint32_t EVTENCLR; /*!< Disable event routing */ + __I uint32_t RESERVED4[110]; + __I uint32_t COUNTER; /*!< Current COUNTER value */ + __IO uint32_t PRESCALER; /*!< 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must + be written when RTC is stopped */ + __I uint32_t RESERVED5[13]; + __IO uint32_t CC[4]; /*!< Description collection[0]: Compare register 0 */ +} NRF_RTC_Type; + + +/* ================================================================================ */ +/* ================ TEMP ================ */ +/* ================================================================================ */ + + +/** + * @brief Temperature Sensor (TEMP) + */ + +typedef struct { /*!< TEMP Structure */ + __O uint32_t TASKS_START; /*!< Start temperature measurement */ + __O uint32_t TASKS_STOP; /*!< Stop temperature measurement */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_DATARDY; /*!< Temperature measurement complete, data ready */ + __I uint32_t RESERVED1[128]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[127]; + __I int32_t TEMP; /*!< Temperature in degC (0.25deg steps) */ + __I uint32_t RESERVED3[5]; + __IO uint32_t A0; /*!< Slope of 1st piece wise linear function */ + __IO uint32_t A1; /*!< Slope of 2nd piece wise linear function */ + __IO uint32_t A2; /*!< Slope of 3rd piece wise linear function */ + __IO uint32_t A3; /*!< Slope of 4th piece wise linear function */ + __IO uint32_t A4; /*!< Slope of 5th piece wise linear function */ + __IO uint32_t A5; /*!< Slope of 6th piece wise linear function */ + __I uint32_t RESERVED4[2]; + __IO uint32_t B0; /*!< y-intercept of 1st piece wise linear function */ + __IO uint32_t B1; /*!< y-intercept of 2nd piece wise linear function */ + __IO uint32_t B2; /*!< y-intercept of 3rd piece wise linear function */ + __IO uint32_t B3; /*!< y-intercept of 4th piece wise linear function */ + __IO uint32_t B4; /*!< y-intercept of 5th piece wise linear function */ + __IO uint32_t B5; /*!< y-intercept of 6th piece wise linear function */ + __I uint32_t RESERVED5[2]; + __IO uint32_t T0; /*!< End point of 1st piece wise linear function */ + __IO uint32_t T1; /*!< End point of 2nd piece wise linear function */ + __IO uint32_t T2; /*!< End point of 3rd piece wise linear function */ + __IO uint32_t T3; /*!< End point of 4th piece wise linear function */ + __IO uint32_t T4; /*!< End point of 5th piece wise linear function */ +} NRF_TEMP_Type; + + +/* ================================================================================ */ +/* ================ RNG ================ */ +/* ================================================================================ */ + + +/** + * @brief Random Number Generator (RNG) + */ + +typedef struct { /*!< RNG Structure */ + __O uint32_t TASKS_START; /*!< Task starting the random number generator */ + __O uint32_t TASKS_STOP; /*!< Task stopping the random number generator */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_VALRDY; /*!< Event being generated for every new random number written to + the VALUE register */ + __I uint32_t RESERVED1[63]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[126]; + __IO uint32_t CONFIG; /*!< Configuration register */ + __I uint32_t VALUE; /*!< Output random number */ +} NRF_RNG_Type; + + +/* ================================================================================ */ +/* ================ ECB ================ */ +/* ================================================================================ */ + + +/** + * @brief AES ECB Mode Encryption (ECB) + */ + +typedef struct { /*!< ECB Structure */ + __O uint32_t TASKS_STARTECB; /*!< Start ECB block encrypt */ + __O uint32_t TASKS_STOPECB; /*!< Abort a possible executing ECB operation */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_ENDECB; /*!< ECB block encrypt complete */ + __IO uint32_t EVENTS_ERRORECB; /*!< ECB block encrypt aborted because of a STOPECB task or due to + an error */ + __I uint32_t RESERVED1[127]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[126]; + __IO uint32_t ECBDATAPTR; /*!< ECB block encrypt memory pointers */ +} NRF_ECB_Type; + + +/* ================================================================================ */ +/* ================ CCM ================ */ +/* ================================================================================ */ + + +/** + * @brief AES CCM Mode Encryption (CCM) + */ + +typedef struct { /*!< CCM Structure */ + __O uint32_t TASKS_KSGEN; /*!< Start generation of key-stream. This operation will stop by + itself when completed. */ + __O uint32_t TASKS_CRYPT; /*!< Start encryption/decryption. This operation will stop by itself + when completed. */ + __O uint32_t TASKS_STOP; /*!< Stop encryption/decryption */ + __I uint32_t RESERVED0[61]; + __IO uint32_t EVENTS_ENDKSGEN; /*!< Key-stream generation complete */ + __IO uint32_t EVENTS_ENDCRYPT; /*!< Encrypt/decrypt complete */ + __IO uint32_t EVENTS_ERROR; /*!< CCM error event */ + __I uint32_t RESERVED1[61]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[61]; + __I uint32_t MICSTATUS; /*!< MIC check result */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< Enable */ + __IO uint32_t MODE; /*!< Operation mode */ + __IO uint32_t CNFPTR; /*!< Pointer to data structure holding AES key and NONCE vector */ + __IO uint32_t INPTR; /*!< Input pointer */ + __IO uint32_t OUTPTR; /*!< Output pointer */ + __IO uint32_t SCRATCHPTR; /*!< Pointer to data area used for temporary storage */ +} NRF_CCM_Type; + + +/* ================================================================================ */ +/* ================ AAR ================ */ +/* ================================================================================ */ + + +/** + * @brief Accelerated Address Resolver (AAR) + */ + +typedef struct { /*!< AAR Structure */ + __O uint32_t TASKS_START; /*!< Start resolving addresses based on IRKs specified in the IRK + data structure */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STOP; /*!< Stop resolving addresses */ + __I uint32_t RESERVED1[61]; + __IO uint32_t EVENTS_END; /*!< Address resolution procedure complete */ + __IO uint32_t EVENTS_RESOLVED; /*!< Address resolved */ + __IO uint32_t EVENTS_NOTRESOLVED; /*!< Address not resolved */ + __I uint32_t RESERVED2[126]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[61]; + __I uint32_t STATUS; /*!< Resolution status */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< Enable AAR */ + __IO uint32_t NIRK; /*!< Number of IRKs */ + __IO uint32_t IRKPTR; /*!< Pointer to IRK data structure */ + __I uint32_t RESERVED5; + __IO uint32_t ADDRPTR; /*!< Pointer to the resolvable address */ + __IO uint32_t SCRATCHPTR; /*!< Pointer to data area used for temporary storage */ +} NRF_AAR_Type; + + +/* ================================================================================ */ +/* ================ WDT ================ */ +/* ================================================================================ */ + + +/** + * @brief Watchdog Timer (WDT) + */ + +typedef struct { /*!< WDT Structure */ + __O uint32_t TASKS_START; /*!< Start the watchdog */ + __I uint32_t RESERVED0[63]; + __IO uint32_t EVENTS_TIMEOUT; /*!< Watchdog timeout */ + __I uint32_t RESERVED1[128]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[61]; + __I uint32_t RUNSTATUS; /*!< Run status */ + __I uint32_t REQSTATUS; /*!< Request status */ + __I uint32_t RESERVED3[63]; + __IO uint32_t CRV; /*!< Counter reload value */ + __IO uint32_t RREN; /*!< Enable register for reload request registers */ + __IO uint32_t CONFIG; /*!< Configuration register */ + __I uint32_t RESERVED4[60]; + __O uint32_t RR[8]; /*!< Description collection[0]: Reload request 0 */ +} NRF_WDT_Type; + + +/* ================================================================================ */ +/* ================ QDEC ================ */ +/* ================================================================================ */ + + +/** + * @brief Quadrature Decoder (QDEC) + */ + +typedef struct { /*!< QDEC Structure */ + __O uint32_t TASKS_START; /*!< Task starting the quadrature decoder */ + __O uint32_t TASKS_STOP; /*!< Task stopping the quadrature decoder */ + __O uint32_t TASKS_READCLRACC; /*!< Read and clear ACC and ACCDBL */ + __O uint32_t TASKS_RDCLRACC; /*!< Read and clear ACC */ + __O uint32_t TASKS_RDCLRDBL; /*!< Read and clear ACCDBL */ + __I uint32_t RESERVED0[59]; + __IO uint32_t EVENTS_SAMPLERDY; /*!< Event being generated for every new sample value written to + the SAMPLE register */ + __IO uint32_t EVENTS_REPORTRDY; /*!< Non-null report ready */ + __IO uint32_t EVENTS_ACCOF; /*!< ACC or ACCDBL register overflow */ + __IO uint32_t EVENTS_DBLRDY; /*!< Double displacement(s) detected */ + __IO uint32_t EVENTS_STOPPED; /*!< QDEC has been stopped */ + __I uint32_t RESERVED1[59]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[125]; + __IO uint32_t ENABLE; /*!< Enable the quadrature decoder */ + __IO uint32_t LEDPOL; /*!< LED output pin polarity */ + __IO uint32_t SAMPLEPER; /*!< Sample period */ + __I int32_t SAMPLE; /*!< Motion sample value */ + __IO uint32_t REPORTPER; /*!< Number of samples to be taken before REPORTRDY and DBLRDY events + can be generated */ + __I int32_t ACC; /*!< Register accumulating the valid transitions */ + __I int32_t ACCREAD; /*!< Snapshot of the ACC register, updated by the READCLRACC or RDCLRACC + task */ + QDEC_PSEL_Type PSEL; /*!< Unspecified */ + __IO uint32_t DBFEN; /*!< Enable input debounce filters */ + __I uint32_t RESERVED4[5]; + __IO uint32_t LEDPRE; /*!< Time period the LED is switched ON prior to sampling */ + __I uint32_t ACCDBL; /*!< Register accumulating the number of detected double transitions */ + __I uint32_t ACCDBLREAD; /*!< Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL + task */ +} NRF_QDEC_Type; + + +/* ================================================================================ */ +/* ================ COMP ================ */ +/* ================================================================================ */ + + +/** + * @brief Comparator (COMP) + */ + +typedef struct { /*!< COMP Structure */ + __O uint32_t TASKS_START; /*!< Start comparator */ + __O uint32_t TASKS_STOP; /*!< Stop comparator */ + __O uint32_t TASKS_SAMPLE; /*!< Sample comparator value */ + __I uint32_t RESERVED0[61]; + __IO uint32_t EVENTS_READY; /*!< COMP is ready and output is valid */ + __IO uint32_t EVENTS_DOWN; /*!< Downward crossing */ + __IO uint32_t EVENTS_UP; /*!< Upward crossing */ + __IO uint32_t EVENTS_CROSS; /*!< Downward or upward crossing */ + __I uint32_t RESERVED1[60]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[61]; + __I uint32_t RESULT; /*!< Compare result */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< COMP enable */ + __IO uint32_t PSEL; /*!< Pin select */ + __IO uint32_t REFSEL; /*!< Reference source select */ + __IO uint32_t EXTREFSEL; /*!< External reference select */ + __I uint32_t RESERVED5[8]; + __IO uint32_t TH; /*!< Threshold configuration for hysteresis unit */ + __IO uint32_t MODE; /*!< Mode configuration */ + __IO uint32_t HYST; /*!< Comparator hysteresis enable */ + __IO uint32_t ISOURCE; /*!< Current source select on analog input */ +} NRF_COMP_Type; + + +/* ================================================================================ */ +/* ================ LPCOMP ================ */ +/* ================================================================================ */ + + +/** + * @brief Low Power Comparator (LPCOMP) + */ + +typedef struct { /*!< LPCOMP Structure */ + __O uint32_t TASKS_START; /*!< Start comparator */ + __O uint32_t TASKS_STOP; /*!< Stop comparator */ + __O uint32_t TASKS_SAMPLE; /*!< Sample comparator value */ + __I uint32_t RESERVED0[61]; + __IO uint32_t EVENTS_READY; /*!< LPCOMP is ready and output is valid */ + __IO uint32_t EVENTS_DOWN; /*!< Downward crossing */ + __IO uint32_t EVENTS_UP; /*!< Upward crossing */ + __IO uint32_t EVENTS_CROSS; /*!< Downward or upward crossing */ + __I uint32_t RESERVED1[60]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[61]; + __I uint32_t RESULT; /*!< Compare result */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< Enable LPCOMP */ + __IO uint32_t PSEL; /*!< Input pin select */ + __IO uint32_t REFSEL; /*!< Reference select */ + __IO uint32_t EXTREFSEL; /*!< External reference select */ + __I uint32_t RESERVED5[4]; + __IO uint32_t ANADETECT; /*!< Analog detect configuration */ + __I uint32_t RESERVED6[5]; + __IO uint32_t HYST; /*!< Comparator hysteresis enable */ +} NRF_LPCOMP_Type; + + +/* ================================================================================ */ +/* ================ SWI ================ */ +/* ================================================================================ */ + + +/** + * @brief Software interrupt 0 (SWI) + */ + +typedef struct { /*!< SWI Structure */ + __I uint32_t UNUSED; /*!< Unused. */ +} NRF_SWI_Type; + + +/* ================================================================================ */ +/* ================ EGU ================ */ +/* ================================================================================ */ + + +/** + * @brief Event Generator Unit 0 (EGU) + */ + +typedef struct { /*!< EGU Structure */ + __O uint32_t TASKS_TRIGGER[16]; /*!< Description collection[0]: Trigger 0 for triggering the corresponding + TRIGGERED[0] event */ + __I uint32_t RESERVED0[48]; + __IO uint32_t EVENTS_TRIGGERED[16]; /*!< Description collection[0]: Event number 0 generated by triggering + the corresponding TRIGGER[0] task */ + __I uint32_t RESERVED1[112]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ +} NRF_EGU_Type; + + +/* ================================================================================ */ +/* ================ PWM ================ */ +/* ================================================================================ */ + + +/** + * @brief Pulse Width Modulation Unit 0 (PWM) + */ + +typedef struct { /*!< PWM Structure */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STOP; /*!< Stops PWM pulse generation on all channels at the end of current + PWM period, and stops sequence playback */ + __O uint32_t TASKS_SEQSTART[2]; /*!< Description collection[0]: Loads the first PWM value on all + enabled channels from sequence 0, and starts playing that sequence + at the rate defined in SEQ[0]REFRESH and/or DECODER.MODE. Causes + PWM generation to start it was not running. */ + __O uint32_t TASKS_NEXTSTEP; /*!< Steps by one value in the current sequence on all enabled channels + if DECODER.MODE=NextStep. Does not cause PWM generation to start + it was not running. */ + __I uint32_t RESERVED1[60]; + __IO uint32_t EVENTS_STOPPED; /*!< Response to STOP task, emitted when PWM pulses are no longer + generated */ + __IO uint32_t EVENTS_SEQSTARTED[2]; /*!< Description collection[0]: First PWM period started on sequence + 0 */ + __IO uint32_t EVENTS_SEQEND[2]; /*!< Description collection[0]: Emitted at end of every sequence + 0, when last value from RAM has been applied to wave counter */ + __IO uint32_t EVENTS_PWMPERIODEND; /*!< Emitted at the end of each PWM period */ + __IO uint32_t EVENTS_LOOPSDONE; /*!< Concatenated sequences have been played the amount of times + defined in LOOP.CNT */ + __I uint32_t RESERVED2[56]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED3[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED4[125]; + __IO uint32_t ENABLE; /*!< PWM module enable register */ + __IO uint32_t MODE; /*!< Selects operating mode of the wave counter */ + __IO uint32_t COUNTERTOP; /*!< Value up to which the pulse generator counter counts */ + __IO uint32_t PRESCALER; /*!< Configuration for PWM_CLK */ + __IO uint32_t DECODER; /*!< Configuration of the decoder */ + __IO uint32_t LOOP; /*!< Amount of playback of a loop */ + __I uint32_t RESERVED5[2]; + PWM_SEQ_Type SEQ[2]; /*!< Unspecified */ + PWM_PSEL_Type PSEL; /*!< Unspecified */ +} NRF_PWM_Type; + + +/* ================================================================================ */ +/* ================ PDM ================ */ +/* ================================================================================ */ + + +/** + * @brief Pulse Density Modulation (Digital Microphone) Interface (PDM) + */ + +typedef struct { /*!< PDM Structure */ + __O uint32_t TASKS_START; /*!< Starts continuous PDM transfer */ + __O uint32_t TASKS_STOP; /*!< Stops PDM transfer */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_STARTED; /*!< PDM transfer has started */ + __IO uint32_t EVENTS_STOPPED; /*!< PDM transfer has finished */ + __IO uint32_t EVENTS_END; /*!< The PDM has written the last sample specified by SAMPLE.MAXCNT + (or the last sample after a STOP task has been received) to + Data RAM */ + __I uint32_t RESERVED1[125]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[125]; + __IO uint32_t ENABLE; /*!< PDM module enable register */ + __IO uint32_t PDMCLKCTRL; /*!< PDM clock generator control */ + __IO uint32_t MODE; /*!< Defines the routing of the connected PDM microphones' signals */ + __I uint32_t RESERVED3[3]; + __IO uint32_t GAINL; /*!< Left output gain adjustment */ + __IO uint32_t GAINR; /*!< Right output gain adjustment */ + __I uint32_t RESERVED4[8]; + PDM_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED5[6]; + PDM_SAMPLE_Type SAMPLE; /*!< Unspecified */ +} NRF_PDM_Type; + + +/* ================================================================================ */ +/* ================ NVMC ================ */ +/* ================================================================================ */ + + +/** + * @brief Non Volatile Memory Controller (NVMC) + */ + +typedef struct { /*!< NVMC Structure */ + __I uint32_t RESERVED0[256]; + __I uint32_t READY; /*!< Ready flag */ + __I uint32_t RESERVED1[64]; + __IO uint32_t CONFIG; /*!< Configuration register */ + + union { + __IO uint32_t ERASEPCR1; /*!< Deprecated register - Register for erasing a page in Code area. + Equivalent to ERASEPAGE. */ + __IO uint32_t ERASEPAGE; /*!< Register for erasing a page in Code area */ + }; + __IO uint32_t ERASEALL; /*!< Register for erasing all non-volatile user memory */ + __IO uint32_t ERASEPCR0; /*!< Deprecated register - Register for erasing a page in Code area. + Equivalent to ERASEPAGE. */ + __IO uint32_t ERASEUICR; /*!< Register for erasing User Information Configuration Registers */ + __I uint32_t RESERVED2[10]; + __IO uint32_t ICACHECNF; /*!< I-Code cache configuration register. */ + __I uint32_t RESERVED3; + __IO uint32_t IHIT; /*!< I-Code cache hit counter. */ + __IO uint32_t IMISS; /*!< I-Code cache miss counter. */ +} NRF_NVMC_Type; + + +/* ================================================================================ */ +/* ================ PPI ================ */ +/* ================================================================================ */ + + +/** + * @brief Programmable Peripheral Interconnect (PPI) + */ + +typedef struct { /*!< PPI Structure */ + PPI_TASKS_CHG_Type TASKS_CHG[6]; /*!< Channel group tasks */ + __I uint32_t RESERVED0[308]; + __IO uint32_t CHEN; /*!< Channel enable register */ + __IO uint32_t CHENSET; /*!< Channel enable set register */ + __IO uint32_t CHENCLR; /*!< Channel enable clear register */ + __I uint32_t RESERVED1; + PPI_CH_Type CH[20]; /*!< PPI Channel */ + __I uint32_t RESERVED2[148]; + __IO uint32_t CHG[6]; /*!< Description collection[0]: Channel group 0 */ + __I uint32_t RESERVED3[62]; + PPI_FORK_Type FORK[32]; /*!< Fork */ +} NRF_PPI_Type; + + +/* ================================================================================ */ +/* ================ MWU ================ */ +/* ================================================================================ */ + + +/** + * @brief Memory Watch Unit (MWU) + */ + +typedef struct { /*!< MWU Structure */ + __I uint32_t RESERVED0[64]; + MWU_EVENTS_REGION_Type EVENTS_REGION[4]; /*!< Unspecified */ + __I uint32_t RESERVED1[16]; + MWU_EVENTS_PREGION_Type EVENTS_PREGION[2]; /*!< Unspecified */ + __I uint32_t RESERVED2[100]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[5]; + __IO uint32_t NMIEN; /*!< Enable or disable non-maskable interrupt */ + __IO uint32_t NMIENSET; /*!< Enable non-maskable interrupt */ + __IO uint32_t NMIENCLR; /*!< Disable non-maskable interrupt */ + __I uint32_t RESERVED4[53]; + MWU_PERREGION_Type PERREGION[2]; /*!< Unspecified */ + __I uint32_t RESERVED5[64]; + __IO uint32_t REGIONEN; /*!< Enable/disable regions watch */ + __IO uint32_t REGIONENSET; /*!< Enable regions watch */ + __IO uint32_t REGIONENCLR; /*!< Disable regions watch */ + __I uint32_t RESERVED6[57]; + MWU_REGION_Type REGION[4]; /*!< Unspecified */ + __I uint32_t RESERVED7[32]; + MWU_PREGION_Type PREGION[2]; /*!< Unspecified */ +} NRF_MWU_Type; + + +/* ================================================================================ */ +/* ================ I2S ================ */ +/* ================================================================================ */ + + +/** + * @brief Inter-IC Sound (I2S) + */ + +typedef struct { /*!< I2S Structure */ + __O uint32_t TASKS_START; /*!< Starts continuous I2S transfer. Also starts MCK generator when + this is enabled. */ + __O uint32_t TASKS_STOP; /*!< Stops I2S transfer. Also stops MCK generator. Triggering this + task will cause the {event:STOPPED} event to be generated. */ + __I uint32_t RESERVED0[63]; + __IO uint32_t EVENTS_RXPTRUPD; /*!< The RXD.PTR register has been copied to internal double-buffers. + When the I2S module is started and RX is enabled, this event + will be generated for every RXTXD.MAXCNT words that are received + on the SDIN pin. */ + __IO uint32_t EVENTS_STOPPED; /*!< I2S transfer stopped. */ + __I uint32_t RESERVED1[2]; + __IO uint32_t EVENTS_TXPTRUPD; /*!< The TDX.PTR register has been copied to internal double-buffers. + When the I2S module is started and TX is enabled, this event + will be generated for every RXTXD.MAXCNT words that are sent + on the SDOUT pin. */ + __I uint32_t RESERVED2[122]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[125]; + __IO uint32_t ENABLE; /*!< Enable I2S module. */ + I2S_CONFIG_Type CONFIG; /*!< Unspecified */ + __I uint32_t RESERVED4[3]; + I2S_RXD_Type RXD; /*!< Unspecified */ + __I uint32_t RESERVED5; + I2S_TXD_Type TXD; /*!< Unspecified */ + __I uint32_t RESERVED6[3]; + I2S_RXTXD_Type RXTXD; /*!< Unspecified */ + __I uint32_t RESERVED7[3]; + I2S_PSEL_Type PSEL; /*!< Unspecified */ +} NRF_I2S_Type; + + +/* ================================================================================ */ +/* ================ FPU ================ */ +/* ================================================================================ */ + + +/** + * @brief FPU (FPU) + */ + +typedef struct { /*!< FPU Structure */ + __I uint32_t UNUSED; /*!< Unused. */ +} NRF_FPU_Type; + + +/* ================================================================================ */ +/* ================ GPIO ================ */ +/* ================================================================================ */ + + +/** + * @brief GPIO Port 1 (GPIO) + */ + +typedef struct { /*!< GPIO Structure */ + __I uint32_t RESERVED0[321]; + __IO uint32_t OUT; /*!< Write GPIO port */ + __IO uint32_t OUTSET; /*!< Set individual bits in GPIO port */ + __IO uint32_t OUTCLR; /*!< Clear individual bits in GPIO port */ + __I uint32_t IN; /*!< Read GPIO port */ + __IO uint32_t DIR; /*!< Direction of GPIO pins */ + __IO uint32_t DIRSET; /*!< DIR set register */ + __IO uint32_t DIRCLR; /*!< DIR clear register */ + __IO uint32_t LATCH; /*!< Latch register indicating what GPIO pins that have met the criteria + set in the PIN_CNF[n].SENSE registers */ + __IO uint32_t DETECTMODE; /*!< Select between default DETECT signal behaviour and LDETECT mode */ + __I uint32_t RESERVED1[118]; + __IO uint32_t PIN_CNF[32]; /*!< Description collection[0]: Configuration of GPIO pins */ +} NRF_GPIO_Type; + + +/* -------------------- End of section using anonymous unions ------------------- */ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + /* leave anonymous unions enabled */ +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#elif defined(__TMS470__) + /* anonymous unions are enabled by default */ +#elif defined(__TASKING__) + #pragma warning restore +#else + #warning Not supported compiler type +#endif + + + + +/* ================================================================================ */ +/* ================ Peripheral memory map ================ */ +/* ================================================================================ */ + +#define NRF_FICR_BASE 0x10000000UL +#define NRF_UICR_BASE 0x10001000UL +#define NRF_BPROT_BASE 0x40000000UL +#define NRF_POWER_BASE 0x40000000UL +#define NRF_CLOCK_BASE 0x40000000UL +#define NRF_AMLI_BASE 0x40000000UL +#define NRF_RADIO_BASE 0x40001000UL +#define NRF_UARTE0_BASE 0x40002000UL +#define NRF_UART0_BASE 0x40002000UL +#define NRF_SPIM0_BASE 0x40003000UL +#define NRF_SPIS0_BASE 0x40003000UL +#define NRF_TWIM0_BASE 0x40003000UL +#define NRF_TWIS0_BASE 0x40003000UL +#define NRF_SPI0_BASE 0x40003000UL +#define NRF_TWI0_BASE 0x40003000UL +#define NRF_SPIM1_BASE 0x40004000UL +#define NRF_SPIS1_BASE 0x40004000UL +#define NRF_TWIM1_BASE 0x40004000UL +#define NRF_TWIS1_BASE 0x40004000UL +#define NRF_SPI1_BASE 0x40004000UL +#define NRF_TWI1_BASE 0x40004000UL +#define NRF_NFCT_BASE 0x40005000UL +#define NRF_GPIOTE_BASE 0x40006000UL +#define NRF_SAADC_BASE 0x40007000UL +#define NRF_TIMER0_BASE 0x40008000UL +#define NRF_TIMER1_BASE 0x40009000UL +#define NRF_TIMER2_BASE 0x4000A000UL +#define NRF_RTC0_BASE 0x4000B000UL +#define NRF_TEMP_BASE 0x4000C000UL +#define NRF_RNG_BASE 0x4000D000UL +#define NRF_ECB_BASE 0x4000E000UL +#define NRF_CCM_BASE 0x4000F000UL +#define NRF_AAR_BASE 0x4000F000UL +#define NRF_WDT_BASE 0x40010000UL +#define NRF_RTC1_BASE 0x40011000UL +#define NRF_QDEC_BASE 0x40012000UL +#define NRF_COMP_BASE 0x40013000UL +#define NRF_LPCOMP_BASE 0x40013000UL +#define NRF_SWI0_BASE 0x40014000UL +#define NRF_EGU0_BASE 0x40014000UL +#define NRF_SWI1_BASE 0x40015000UL +#define NRF_EGU1_BASE 0x40015000UL +#define NRF_SWI2_BASE 0x40016000UL +#define NRF_EGU2_BASE 0x40016000UL +#define NRF_SWI3_BASE 0x40017000UL +#define NRF_EGU3_BASE 0x40017000UL +#define NRF_SWI4_BASE 0x40018000UL +#define NRF_EGU4_BASE 0x40018000UL +#define NRF_SWI5_BASE 0x40019000UL +#define NRF_EGU5_BASE 0x40019000UL +#define NRF_TIMER3_BASE 0x4001A000UL +#define NRF_TIMER4_BASE 0x4001B000UL +#define NRF_PWM0_BASE 0x4001C000UL +#define NRF_PDM_BASE 0x4001D000UL +#define NRF_NVMC_BASE 0x4001E000UL +#define NRF_PPI_BASE 0x4001F000UL +#define NRF_MWU_BASE 0x40020000UL +#define NRF_PWM1_BASE 0x40021000UL +#define NRF_PWM2_BASE 0x40022000UL +#define NRF_SPIM2_BASE 0x40023000UL +#define NRF_SPIS2_BASE 0x40023000UL +#define NRF_SPI2_BASE 0x40023000UL +#define NRF_RTC2_BASE 0x40024000UL +#define NRF_I2S_BASE 0x40025000UL +#define NRF_FPU_BASE 0x40026000UL +#define NRF_P0_BASE 0x50000000UL + + +/* ================================================================================ */ +/* ================ Peripheral declaration ================ */ +/* ================================================================================ */ + +#define NRF_FICR ((NRF_FICR_Type *) NRF_FICR_BASE) +#define NRF_UICR ((NRF_UICR_Type *) NRF_UICR_BASE) +#define NRF_BPROT ((NRF_BPROT_Type *) NRF_BPROT_BASE) +#define NRF_POWER ((NRF_POWER_Type *) NRF_POWER_BASE) +#define NRF_CLOCK ((NRF_CLOCK_Type *) NRF_CLOCK_BASE) +#define NRF_AMLI ((NRF_AMLI_Type *) NRF_AMLI_BASE) +#define NRF_RADIO ((NRF_RADIO_Type *) NRF_RADIO_BASE) +#define NRF_UARTE0 ((NRF_UARTE_Type *) NRF_UARTE0_BASE) +#define NRF_UART0 ((NRF_UART_Type *) NRF_UART0_BASE) +#define NRF_SPIM0 ((NRF_SPIM_Type *) NRF_SPIM0_BASE) +#define NRF_SPIS0 ((NRF_SPIS_Type *) NRF_SPIS0_BASE) +#define NRF_TWIM0 ((NRF_TWIM_Type *) NRF_TWIM0_BASE) +#define NRF_TWIS0 ((NRF_TWIS_Type *) NRF_TWIS0_BASE) +#define NRF_SPI0 ((NRF_SPI_Type *) NRF_SPI0_BASE) +#define NRF_TWI0 ((NRF_TWI_Type *) NRF_TWI0_BASE) +#define NRF_SPIM1 ((NRF_SPIM_Type *) NRF_SPIM1_BASE) +#define NRF_SPIS1 ((NRF_SPIS_Type *) NRF_SPIS1_BASE) +#define NRF_TWIM1 ((NRF_TWIM_Type *) NRF_TWIM1_BASE) +#define NRF_TWIS1 ((NRF_TWIS_Type *) NRF_TWIS1_BASE) +#define NRF_SPI1 ((NRF_SPI_Type *) NRF_SPI1_BASE) +#define NRF_TWI1 ((NRF_TWI_Type *) NRF_TWI1_BASE) +#define NRF_NFCT ((NRF_NFCT_Type *) NRF_NFCT_BASE) +#define NRF_GPIOTE ((NRF_GPIOTE_Type *) NRF_GPIOTE_BASE) +#define NRF_SAADC ((NRF_SAADC_Type *) NRF_SAADC_BASE) +#define NRF_TIMER0 ((NRF_TIMER_Type *) NRF_TIMER0_BASE) +#define NRF_TIMER1 ((NRF_TIMER_Type *) NRF_TIMER1_BASE) +#define NRF_TIMER2 ((NRF_TIMER_Type *) NRF_TIMER2_BASE) +#define NRF_RTC0 ((NRF_RTC_Type *) NRF_RTC0_BASE) +#define NRF_TEMP ((NRF_TEMP_Type *) NRF_TEMP_BASE) +#define NRF_RNG ((NRF_RNG_Type *) NRF_RNG_BASE) +#define NRF_ECB ((NRF_ECB_Type *) NRF_ECB_BASE) +#define NRF_CCM ((NRF_CCM_Type *) NRF_CCM_BASE) +#define NRF_AAR ((NRF_AAR_Type *) NRF_AAR_BASE) +#define NRF_WDT ((NRF_WDT_Type *) NRF_WDT_BASE) +#define NRF_RTC1 ((NRF_RTC_Type *) NRF_RTC1_BASE) +#define NRF_QDEC ((NRF_QDEC_Type *) NRF_QDEC_BASE) +#define NRF_COMP ((NRF_COMP_Type *) NRF_COMP_BASE) +#define NRF_LPCOMP ((NRF_LPCOMP_Type *) NRF_LPCOMP_BASE) +#define NRF_SWI0 ((NRF_SWI_Type *) NRF_SWI0_BASE) +#define NRF_EGU0 ((NRF_EGU_Type *) NRF_EGU0_BASE) +#define NRF_SWI1 ((NRF_SWI_Type *) NRF_SWI1_BASE) +#define NRF_EGU1 ((NRF_EGU_Type *) NRF_EGU1_BASE) +#define NRF_SWI2 ((NRF_SWI_Type *) NRF_SWI2_BASE) +#define NRF_EGU2 ((NRF_EGU_Type *) NRF_EGU2_BASE) +#define NRF_SWI3 ((NRF_SWI_Type *) NRF_SWI3_BASE) +#define NRF_EGU3 ((NRF_EGU_Type *) NRF_EGU3_BASE) +#define NRF_SWI4 ((NRF_SWI_Type *) NRF_SWI4_BASE) +#define NRF_EGU4 ((NRF_EGU_Type *) NRF_EGU4_BASE) +#define NRF_SWI5 ((NRF_SWI_Type *) NRF_SWI5_BASE) +#define NRF_EGU5 ((NRF_EGU_Type *) NRF_EGU5_BASE) +#define NRF_TIMER3 ((NRF_TIMER_Type *) NRF_TIMER3_BASE) +#define NRF_TIMER4 ((NRF_TIMER_Type *) NRF_TIMER4_BASE) +#define NRF_PWM0 ((NRF_PWM_Type *) NRF_PWM0_BASE) +#define NRF_PDM ((NRF_PDM_Type *) NRF_PDM_BASE) +#define NRF_NVMC ((NRF_NVMC_Type *) NRF_NVMC_BASE) +#define NRF_PPI ((NRF_PPI_Type *) NRF_PPI_BASE) +#define NRF_MWU ((NRF_MWU_Type *) NRF_MWU_BASE) +#define NRF_PWM1 ((NRF_PWM_Type *) NRF_PWM1_BASE) +#define NRF_PWM2 ((NRF_PWM_Type *) NRF_PWM2_BASE) +#define NRF_SPIM2 ((NRF_SPIM_Type *) NRF_SPIM2_BASE) +#define NRF_SPIS2 ((NRF_SPIS_Type *) NRF_SPIS2_BASE) +#define NRF_SPI2 ((NRF_SPI_Type *) NRF_SPI2_BASE) +#define NRF_RTC2 ((NRF_RTC_Type *) NRF_RTC2_BASE) +#define NRF_I2S ((NRF_I2S_Type *) NRF_I2S_BASE) +#define NRF_FPU ((NRF_FPU_Type *) NRF_FPU_BASE) +#define NRF_P0 ((NRF_GPIO_Type *) NRF_P0_BASE) + + +/** @} */ /* End of group Device_Peripheral_Registers */ +/** @} */ /* End of group nrf52 */ +/** @} */ /* End of group Nordic Semiconductor */ + +#ifdef __cplusplus +} +#endif + + +#endif /* nrf52_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_bitfields.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_bitfields.h new file mode 100644 index 0000000000..c7802c46a3 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_bitfields.h @@ -0,0 +1,14870 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __NRF52_BITS_H +#define __NRF52_BITS_H + +/*lint ++flb "Enter library region" */ + +/* Peripheral: AAR */ +/* Description: Accelerated Address Resolver */ + +/* Register: AAR_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 2 : Write '1' to Enable interrupt for NOTRESOLVED event */ +#define AAR_INTENSET_NOTRESOLVED_Pos (2UL) /*!< Position of NOTRESOLVED field. */ +#define AAR_INTENSET_NOTRESOLVED_Msk (0x1UL << AAR_INTENSET_NOTRESOLVED_Pos) /*!< Bit mask of NOTRESOLVED field. */ +#define AAR_INTENSET_NOTRESOLVED_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENSET_NOTRESOLVED_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENSET_NOTRESOLVED_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for RESOLVED event */ +#define AAR_INTENSET_RESOLVED_Pos (1UL) /*!< Position of RESOLVED field. */ +#define AAR_INTENSET_RESOLVED_Msk (0x1UL << AAR_INTENSET_RESOLVED_Pos) /*!< Bit mask of RESOLVED field. */ +#define AAR_INTENSET_RESOLVED_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENSET_RESOLVED_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENSET_RESOLVED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for END event */ +#define AAR_INTENSET_END_Pos (0UL) /*!< Position of END field. */ +#define AAR_INTENSET_END_Msk (0x1UL << AAR_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define AAR_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Register: AAR_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 2 : Write '1' to Disable interrupt for NOTRESOLVED event */ +#define AAR_INTENCLR_NOTRESOLVED_Pos (2UL) /*!< Position of NOTRESOLVED field. */ +#define AAR_INTENCLR_NOTRESOLVED_Msk (0x1UL << AAR_INTENCLR_NOTRESOLVED_Pos) /*!< Bit mask of NOTRESOLVED field. */ +#define AAR_INTENCLR_NOTRESOLVED_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENCLR_NOTRESOLVED_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENCLR_NOTRESOLVED_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for RESOLVED event */ +#define AAR_INTENCLR_RESOLVED_Pos (1UL) /*!< Position of RESOLVED field. */ +#define AAR_INTENCLR_RESOLVED_Msk (0x1UL << AAR_INTENCLR_RESOLVED_Pos) /*!< Bit mask of RESOLVED field. */ +#define AAR_INTENCLR_RESOLVED_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENCLR_RESOLVED_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENCLR_RESOLVED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for END event */ +#define AAR_INTENCLR_END_Pos (0UL) /*!< Position of END field. */ +#define AAR_INTENCLR_END_Msk (0x1UL << AAR_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define AAR_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Register: AAR_STATUS */ +/* Description: Resolution status */ + +/* Bits 3..0 : The IRK that was used last time an address was resolved */ +#define AAR_STATUS_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define AAR_STATUS_STATUS_Msk (0xFUL << AAR_STATUS_STATUS_Pos) /*!< Bit mask of STATUS field. */ + +/* Register: AAR_ENABLE */ +/* Description: Enable AAR */ + +/* Bits 1..0 : Enable or disable AAR */ +#define AAR_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define AAR_ENABLE_ENABLE_Msk (0x3UL << AAR_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define AAR_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define AAR_ENABLE_ENABLE_Enabled (3UL) /*!< Enable */ + +/* Register: AAR_NIRK */ +/* Description: Number of IRKs */ + +/* Bits 4..0 : Number of Identity root keys available in the IRK data structure */ +#define AAR_NIRK_NIRK_Pos (0UL) /*!< Position of NIRK field. */ +#define AAR_NIRK_NIRK_Msk (0x1FUL << AAR_NIRK_NIRK_Pos) /*!< Bit mask of NIRK field. */ + +/* Register: AAR_IRKPTR */ +/* Description: Pointer to IRK data structure */ + +/* Bits 31..0 : Pointer to the IRK data structure */ +#define AAR_IRKPTR_IRKPTR_Pos (0UL) /*!< Position of IRKPTR field. */ +#define AAR_IRKPTR_IRKPTR_Msk (0xFFFFFFFFUL << AAR_IRKPTR_IRKPTR_Pos) /*!< Bit mask of IRKPTR field. */ + +/* Register: AAR_ADDRPTR */ +/* Description: Pointer to the resolvable address */ + +/* Bits 31..0 : Pointer to the resolvable address (6-bytes) */ +#define AAR_ADDRPTR_ADDRPTR_Pos (0UL) /*!< Position of ADDRPTR field. */ +#define AAR_ADDRPTR_ADDRPTR_Msk (0xFFFFFFFFUL << AAR_ADDRPTR_ADDRPTR_Pos) /*!< Bit mask of ADDRPTR field. */ + +/* Register: AAR_SCRATCHPTR */ +/* Description: Pointer to data area used for temporary storage */ + +/* Bits 31..0 : Pointer to a scratch data area used for temporary storage during resolution.A space of minimum 3 bytes must be reserved. */ +#define AAR_SCRATCHPTR_SCRATCHPTR_Pos (0UL) /*!< Position of SCRATCHPTR field. */ +#define AAR_SCRATCHPTR_SCRATCHPTR_Msk (0xFFFFFFFFUL << AAR_SCRATCHPTR_SCRATCHPTR_Pos) /*!< Bit mask of SCRATCHPTR field. */ + + +/* Peripheral: AMLI */ +/* Description: AHB Multi-Layer Interface */ + +/* Register: AMLI_RAMPRI_CPU0 */ +/* Description: AHB bus master priority register for CPU0 */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_CPU0_RAM7_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CPU0_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_CPU0_RAM6_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CPU0_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_CPU0_RAM5_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CPU0_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_CPU0_RAM4_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CPU0_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_CPU0_RAM3_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CPU0_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_CPU0_RAM2_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CPU0_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_CPU0_RAM1_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CPU0_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_CPU0_RAM0_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CPU0_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_SPIS1 */ +/* Description: AHB bus master priority register for SPIM1, SPIS1, TWIM1 and TWIS1 */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SPIS1_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SPIS1_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SPIS1_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SPIS1_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SPIS1_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SPIS1_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SPIS1_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SPIS1_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_RADIO */ +/* Description: AHB bus master priority register for RADIO */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_RADIO_RAM7_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_RADIO_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_RADIO_RAM6_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_RADIO_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_RADIO_RAM5_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_RADIO_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_RADIO_RAM4_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_RADIO_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_RADIO_RAM3_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_RADIO_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_RADIO_RAM2_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_RADIO_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_RADIO_RAM1_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_RADIO_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_RADIO_RAM0_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_RADIO_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_ECB */ +/* Description: AHB bus master priority register for ECB */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_ECB_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_ECB_RAM7_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_ECB_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_ECB_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_ECB_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_ECB_RAM6_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_ECB_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_ECB_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_ECB_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_ECB_RAM5_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_ECB_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_ECB_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_ECB_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_ECB_RAM4_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_ECB_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_ECB_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_ECB_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_ECB_RAM3_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_ECB_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_ECB_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_ECB_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_ECB_RAM2_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_ECB_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_ECB_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_ECB_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_ECB_RAM1_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_ECB_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_ECB_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_ECB_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_ECB_RAM0_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_ECB_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_ECB_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_CCM */ +/* Description: AHB bus master priority register for CCM */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_CCM_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_CCM_RAM7_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_CCM_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CCM_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_CCM_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_CCM_RAM6_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_CCM_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CCM_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_CCM_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_CCM_RAM5_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_CCM_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CCM_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_CCM_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_CCM_RAM4_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_CCM_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CCM_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_CCM_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_CCM_RAM3_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_CCM_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CCM_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_CCM_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_CCM_RAM2_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_CCM_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CCM_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_CCM_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_CCM_RAM1_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_CCM_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CCM_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_CCM_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_CCM_RAM0_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_CCM_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_CCM_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_AAR */ +/* Description: AHB bus master priority register for AAR */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_AAR_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_AAR_RAM7_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_AAR_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_AAR_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_AAR_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_AAR_RAM6_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_AAR_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_AAR_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_AAR_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_AAR_RAM5_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_AAR_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_AAR_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_AAR_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_AAR_RAM4_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_AAR_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_AAR_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_AAR_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_AAR_RAM3_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_AAR_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_AAR_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_AAR_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_AAR_RAM2_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_AAR_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_AAR_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_AAR_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_AAR_RAM1_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_AAR_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_AAR_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_AAR_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_AAR_RAM0_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_AAR_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_AAR_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_SAADC */ +/* Description: AHB bus master priority register for SAADC */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_SAADC_RAM7_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SAADC_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_SAADC_RAM6_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SAADC_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_SAADC_RAM5_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SAADC_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_SAADC_RAM4_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SAADC_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_SAADC_RAM3_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SAADC_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_SAADC_RAM2_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SAADC_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_SAADC_RAM1_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SAADC_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_SAADC_RAM0_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SAADC_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_UARTE */ +/* Description: AHB bus master priority register for UARTE */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_UARTE_RAM7_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_UARTE_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_UARTE_RAM6_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_UARTE_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_UARTE_RAM5_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_UARTE_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_UARTE_RAM4_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_UARTE_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_UARTE_RAM3_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_UARTE_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_UARTE_RAM2_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_UARTE_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_UARTE_RAM1_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_UARTE_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_UARTE_RAM0_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_UARTE_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_SERIAL0 */ +/* Description: AHB bus master priority register for SPIM0, SPIS0, TWIM0 and TWIS0 */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL0_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL0_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL0_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL0_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL0_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL0_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL0_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL0_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_SERIAL2 */ +/* Description: AHB bus master priority register for SPIM2 and SPIS2 */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL2_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL2_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL2_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL2_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL2_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL2_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL2_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_SERIAL2_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_NFCT */ +/* Description: AHB bus master priority register for NFCT */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_NFCT_RAM7_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_NFCT_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_NFCT_RAM6_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_NFCT_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_NFCT_RAM5_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_NFCT_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_NFCT_RAM4_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_NFCT_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_NFCT_RAM3_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_NFCT_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_NFCT_RAM2_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_NFCT_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_NFCT_RAM1_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_NFCT_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_NFCT_RAM0_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_NFCT_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_I2S */ +/* Description: AHB bus master priority register for I2S */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_I2S_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_I2S_RAM7_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_I2S_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_I2S_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_I2S_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_I2S_RAM6_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_I2S_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_I2S_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_I2S_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_I2S_RAM5_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_I2S_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_I2S_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_I2S_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_I2S_RAM4_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_I2S_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_I2S_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_I2S_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_I2S_RAM3_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_I2S_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_I2S_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_I2S_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_I2S_RAM2_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_I2S_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_I2S_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_I2S_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_I2S_RAM1_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_I2S_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_I2S_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_I2S_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_I2S_RAM0_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_I2S_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_I2S_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_PDM */ +/* Description: AHB bus master priority register for PDM */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_PDM_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_PDM_RAM7_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_PDM_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PDM_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_PDM_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_PDM_RAM6_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_PDM_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PDM_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_PDM_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_PDM_RAM5_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_PDM_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PDM_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_PDM_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_PDM_RAM4_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_PDM_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PDM_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_PDM_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_PDM_RAM3_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_PDM_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PDM_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_PDM_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_PDM_RAM2_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_PDM_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PDM_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_PDM_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_PDM_RAM1_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_PDM_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PDM_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_PDM_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_PDM_RAM0_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_PDM_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PDM_RAM0_Pri15 (15UL) /*!< Priority 15 */ + +/* Register: AMLI_RAMPRI_PWM */ +/* Description: AHB bus master priority register for PWM0, PWM1 and PWM2 */ + +/* Bits 31..28 : Priority register for RAM AHB slave 7 */ +#define AMLI_RAMPRI_PWM_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ +#define AMLI_RAMPRI_PWM_RAM7_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM7_Pos) /*!< Bit mask of RAM7 field. */ +#define AMLI_RAMPRI_PWM_RAM7_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PWM_RAM7_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 27..24 : Priority register for RAM AHB slave 6 */ +#define AMLI_RAMPRI_PWM_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ +#define AMLI_RAMPRI_PWM_RAM6_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM6_Pos) /*!< Bit mask of RAM6 field. */ +#define AMLI_RAMPRI_PWM_RAM6_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PWM_RAM6_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 23..20 : Priority register for RAM AHB slave 5 */ +#define AMLI_RAMPRI_PWM_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ +#define AMLI_RAMPRI_PWM_RAM5_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM5_Pos) /*!< Bit mask of RAM5 field. */ +#define AMLI_RAMPRI_PWM_RAM5_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PWM_RAM5_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 19..16 : Priority register for RAM AHB slave 4 */ +#define AMLI_RAMPRI_PWM_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ +#define AMLI_RAMPRI_PWM_RAM4_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM4_Pos) /*!< Bit mask of RAM4 field. */ +#define AMLI_RAMPRI_PWM_RAM4_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PWM_RAM4_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 15..12 : Priority register for RAM AHB slave 3 */ +#define AMLI_RAMPRI_PWM_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ +#define AMLI_RAMPRI_PWM_RAM3_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM3_Pos) /*!< Bit mask of RAM3 field. */ +#define AMLI_RAMPRI_PWM_RAM3_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PWM_RAM3_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 11..8 : Priority register for RAM AHB slave 2 */ +#define AMLI_RAMPRI_PWM_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ +#define AMLI_RAMPRI_PWM_RAM2_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM2_Pos) /*!< Bit mask of RAM2 field. */ +#define AMLI_RAMPRI_PWM_RAM2_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PWM_RAM2_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 7..4 : Priority register for RAM AHB slave 1 */ +#define AMLI_RAMPRI_PWM_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ +#define AMLI_RAMPRI_PWM_RAM1_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM1_Pos) /*!< Bit mask of RAM1 field. */ +#define AMLI_RAMPRI_PWM_RAM1_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PWM_RAM1_Pri15 (15UL) /*!< Priority 15 */ + +/* Bits 3..0 : Priority register for RAM AHB slave 0 */ +#define AMLI_RAMPRI_PWM_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ +#define AMLI_RAMPRI_PWM_RAM0_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM0_Pos) /*!< Bit mask of RAM0 field. */ +#define AMLI_RAMPRI_PWM_RAM0_Pri0 (0UL) /*!< Priority 0 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri1 (1UL) /*!< Priority 1 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri2 (2UL) /*!< Priority 2 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri3 (3UL) /*!< Priority 3 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri4 (4UL) /*!< Priority 4 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri5 (5UL) /*!< Priority 5 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri6 (6UL) /*!< Priority 6 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri7 (7UL) /*!< Priority 7 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri8 (8UL) /*!< Priority 8 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri9 (9UL) /*!< Priority 9 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri10 (10UL) /*!< Priority 10 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri11 (11UL) /*!< Priority 11 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri12 (12UL) /*!< Priority 12 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri13 (13UL) /*!< Priority 13 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri14 (14UL) /*!< Priority 14 */ +#define AMLI_RAMPRI_PWM_RAM0_Pri15 (15UL) /*!< Priority 15 */ + + +/* Peripheral: BPROT */ +/* Description: Block Protect */ + +/* Register: BPROT_CONFIG0 */ +/* Description: Block protect configuration register 0 */ + +/* Bit 31 : Enable protection for region 31. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION31_Pos (31UL) /*!< Position of REGION31 field. */ +#define BPROT_CONFIG0_REGION31_Msk (0x1UL << BPROT_CONFIG0_REGION31_Pos) /*!< Bit mask of REGION31 field. */ +#define BPROT_CONFIG0_REGION31_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION31_Enabled (1UL) /*!< Protection enable */ + +/* Bit 30 : Enable protection for region 30. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION30_Pos (30UL) /*!< Position of REGION30 field. */ +#define BPROT_CONFIG0_REGION30_Msk (0x1UL << BPROT_CONFIG0_REGION30_Pos) /*!< Bit mask of REGION30 field. */ +#define BPROT_CONFIG0_REGION30_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION30_Enabled (1UL) /*!< Protection enable */ + +/* Bit 29 : Enable protection for region 29. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION29_Pos (29UL) /*!< Position of REGION29 field. */ +#define BPROT_CONFIG0_REGION29_Msk (0x1UL << BPROT_CONFIG0_REGION29_Pos) /*!< Bit mask of REGION29 field. */ +#define BPROT_CONFIG0_REGION29_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION29_Enabled (1UL) /*!< Protection enable */ + +/* Bit 28 : Enable protection for region 28. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION28_Pos (28UL) /*!< Position of REGION28 field. */ +#define BPROT_CONFIG0_REGION28_Msk (0x1UL << BPROT_CONFIG0_REGION28_Pos) /*!< Bit mask of REGION28 field. */ +#define BPROT_CONFIG0_REGION28_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION28_Enabled (1UL) /*!< Protection enable */ + +/* Bit 27 : Enable protection for region 27. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION27_Pos (27UL) /*!< Position of REGION27 field. */ +#define BPROT_CONFIG0_REGION27_Msk (0x1UL << BPROT_CONFIG0_REGION27_Pos) /*!< Bit mask of REGION27 field. */ +#define BPROT_CONFIG0_REGION27_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION27_Enabled (1UL) /*!< Protection enable */ + +/* Bit 26 : Enable protection for region 26. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION26_Pos (26UL) /*!< Position of REGION26 field. */ +#define BPROT_CONFIG0_REGION26_Msk (0x1UL << BPROT_CONFIG0_REGION26_Pos) /*!< Bit mask of REGION26 field. */ +#define BPROT_CONFIG0_REGION26_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION26_Enabled (1UL) /*!< Protection enable */ + +/* Bit 25 : Enable protection for region 25. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION25_Pos (25UL) /*!< Position of REGION25 field. */ +#define BPROT_CONFIG0_REGION25_Msk (0x1UL << BPROT_CONFIG0_REGION25_Pos) /*!< Bit mask of REGION25 field. */ +#define BPROT_CONFIG0_REGION25_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION25_Enabled (1UL) /*!< Protection enable */ + +/* Bit 24 : Enable protection for region 24. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION24_Pos (24UL) /*!< Position of REGION24 field. */ +#define BPROT_CONFIG0_REGION24_Msk (0x1UL << BPROT_CONFIG0_REGION24_Pos) /*!< Bit mask of REGION24 field. */ +#define BPROT_CONFIG0_REGION24_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION24_Enabled (1UL) /*!< Protection enable */ + +/* Bit 23 : Enable protection for region 23. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION23_Pos (23UL) /*!< Position of REGION23 field. */ +#define BPROT_CONFIG0_REGION23_Msk (0x1UL << BPROT_CONFIG0_REGION23_Pos) /*!< Bit mask of REGION23 field. */ +#define BPROT_CONFIG0_REGION23_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION23_Enabled (1UL) /*!< Protection enable */ + +/* Bit 22 : Enable protection for region 22. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION22_Pos (22UL) /*!< Position of REGION22 field. */ +#define BPROT_CONFIG0_REGION22_Msk (0x1UL << BPROT_CONFIG0_REGION22_Pos) /*!< Bit mask of REGION22 field. */ +#define BPROT_CONFIG0_REGION22_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION22_Enabled (1UL) /*!< Protection enable */ + +/* Bit 21 : Enable protection for region 21. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION21_Pos (21UL) /*!< Position of REGION21 field. */ +#define BPROT_CONFIG0_REGION21_Msk (0x1UL << BPROT_CONFIG0_REGION21_Pos) /*!< Bit mask of REGION21 field. */ +#define BPROT_CONFIG0_REGION21_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION21_Enabled (1UL) /*!< Protection enable */ + +/* Bit 20 : Enable protection for region 20. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION20_Pos (20UL) /*!< Position of REGION20 field. */ +#define BPROT_CONFIG0_REGION20_Msk (0x1UL << BPROT_CONFIG0_REGION20_Pos) /*!< Bit mask of REGION20 field. */ +#define BPROT_CONFIG0_REGION20_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION20_Enabled (1UL) /*!< Protection enable */ + +/* Bit 19 : Enable protection for region 19. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION19_Pos (19UL) /*!< Position of REGION19 field. */ +#define BPROT_CONFIG0_REGION19_Msk (0x1UL << BPROT_CONFIG0_REGION19_Pos) /*!< Bit mask of REGION19 field. */ +#define BPROT_CONFIG0_REGION19_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION19_Enabled (1UL) /*!< Protection enable */ + +/* Bit 18 : Enable protection for region 18. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION18_Pos (18UL) /*!< Position of REGION18 field. */ +#define BPROT_CONFIG0_REGION18_Msk (0x1UL << BPROT_CONFIG0_REGION18_Pos) /*!< Bit mask of REGION18 field. */ +#define BPROT_CONFIG0_REGION18_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION18_Enabled (1UL) /*!< Protection enable */ + +/* Bit 17 : Enable protection for region 17. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION17_Pos (17UL) /*!< Position of REGION17 field. */ +#define BPROT_CONFIG0_REGION17_Msk (0x1UL << BPROT_CONFIG0_REGION17_Pos) /*!< Bit mask of REGION17 field. */ +#define BPROT_CONFIG0_REGION17_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION17_Enabled (1UL) /*!< Protection enable */ + +/* Bit 16 : Enable protection for region 16. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION16_Pos (16UL) /*!< Position of REGION16 field. */ +#define BPROT_CONFIG0_REGION16_Msk (0x1UL << BPROT_CONFIG0_REGION16_Pos) /*!< Bit mask of REGION16 field. */ +#define BPROT_CONFIG0_REGION16_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION16_Enabled (1UL) /*!< Protection enable */ + +/* Bit 15 : Enable protection for region 15. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION15_Pos (15UL) /*!< Position of REGION15 field. */ +#define BPROT_CONFIG0_REGION15_Msk (0x1UL << BPROT_CONFIG0_REGION15_Pos) /*!< Bit mask of REGION15 field. */ +#define BPROT_CONFIG0_REGION15_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION15_Enabled (1UL) /*!< Protection enable */ + +/* Bit 14 : Enable protection for region 14. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION14_Pos (14UL) /*!< Position of REGION14 field. */ +#define BPROT_CONFIG0_REGION14_Msk (0x1UL << BPROT_CONFIG0_REGION14_Pos) /*!< Bit mask of REGION14 field. */ +#define BPROT_CONFIG0_REGION14_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION14_Enabled (1UL) /*!< Protection enable */ + +/* Bit 13 : Enable protection for region 13. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION13_Pos (13UL) /*!< Position of REGION13 field. */ +#define BPROT_CONFIG0_REGION13_Msk (0x1UL << BPROT_CONFIG0_REGION13_Pos) /*!< Bit mask of REGION13 field. */ +#define BPROT_CONFIG0_REGION13_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION13_Enabled (1UL) /*!< Protection enable */ + +/* Bit 12 : Enable protection for region 12. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION12_Pos (12UL) /*!< Position of REGION12 field. */ +#define BPROT_CONFIG0_REGION12_Msk (0x1UL << BPROT_CONFIG0_REGION12_Pos) /*!< Bit mask of REGION12 field. */ +#define BPROT_CONFIG0_REGION12_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION12_Enabled (1UL) /*!< Protection enable */ + +/* Bit 11 : Enable protection for region 11. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION11_Pos (11UL) /*!< Position of REGION11 field. */ +#define BPROT_CONFIG0_REGION11_Msk (0x1UL << BPROT_CONFIG0_REGION11_Pos) /*!< Bit mask of REGION11 field. */ +#define BPROT_CONFIG0_REGION11_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION11_Enabled (1UL) /*!< Protection enable */ + +/* Bit 10 : Enable protection for region 10. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION10_Pos (10UL) /*!< Position of REGION10 field. */ +#define BPROT_CONFIG0_REGION10_Msk (0x1UL << BPROT_CONFIG0_REGION10_Pos) /*!< Bit mask of REGION10 field. */ +#define BPROT_CONFIG0_REGION10_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION10_Enabled (1UL) /*!< Protection enable */ + +/* Bit 9 : Enable protection for region 9. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION9_Pos (9UL) /*!< Position of REGION9 field. */ +#define BPROT_CONFIG0_REGION9_Msk (0x1UL << BPROT_CONFIG0_REGION9_Pos) /*!< Bit mask of REGION9 field. */ +#define BPROT_CONFIG0_REGION9_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION9_Enabled (1UL) /*!< Protection enable */ + +/* Bit 8 : Enable protection for region 8. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION8_Pos (8UL) /*!< Position of REGION8 field. */ +#define BPROT_CONFIG0_REGION8_Msk (0x1UL << BPROT_CONFIG0_REGION8_Pos) /*!< Bit mask of REGION8 field. */ +#define BPROT_CONFIG0_REGION8_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION8_Enabled (1UL) /*!< Protection enable */ + +/* Bit 7 : Enable protection for region 7. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION7_Pos (7UL) /*!< Position of REGION7 field. */ +#define BPROT_CONFIG0_REGION7_Msk (0x1UL << BPROT_CONFIG0_REGION7_Pos) /*!< Bit mask of REGION7 field. */ +#define BPROT_CONFIG0_REGION7_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION7_Enabled (1UL) /*!< Protection enable */ + +/* Bit 6 : Enable protection for region 6. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION6_Pos (6UL) /*!< Position of REGION6 field. */ +#define BPROT_CONFIG0_REGION6_Msk (0x1UL << BPROT_CONFIG0_REGION6_Pos) /*!< Bit mask of REGION6 field. */ +#define BPROT_CONFIG0_REGION6_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION6_Enabled (1UL) /*!< Protection enable */ + +/* Bit 5 : Enable protection for region 5. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION5_Pos (5UL) /*!< Position of REGION5 field. */ +#define BPROT_CONFIG0_REGION5_Msk (0x1UL << BPROT_CONFIG0_REGION5_Pos) /*!< Bit mask of REGION5 field. */ +#define BPROT_CONFIG0_REGION5_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION5_Enabled (1UL) /*!< Protection enable */ + +/* Bit 4 : Enable protection for region 4. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION4_Pos (4UL) /*!< Position of REGION4 field. */ +#define BPROT_CONFIG0_REGION4_Msk (0x1UL << BPROT_CONFIG0_REGION4_Pos) /*!< Bit mask of REGION4 field. */ +#define BPROT_CONFIG0_REGION4_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION4_Enabled (1UL) /*!< Protection enable */ + +/* Bit 3 : Enable protection for region 3. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION3_Pos (3UL) /*!< Position of REGION3 field. */ +#define BPROT_CONFIG0_REGION3_Msk (0x1UL << BPROT_CONFIG0_REGION3_Pos) /*!< Bit mask of REGION3 field. */ +#define BPROT_CONFIG0_REGION3_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION3_Enabled (1UL) /*!< Protection enable */ + +/* Bit 2 : Enable protection for region 2. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION2_Pos (2UL) /*!< Position of REGION2 field. */ +#define BPROT_CONFIG0_REGION2_Msk (0x1UL << BPROT_CONFIG0_REGION2_Pos) /*!< Bit mask of REGION2 field. */ +#define BPROT_CONFIG0_REGION2_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION2_Enabled (1UL) /*!< Protection enable */ + +/* Bit 1 : Enable protection for region 1. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION1_Pos (1UL) /*!< Position of REGION1 field. */ +#define BPROT_CONFIG0_REGION1_Msk (0x1UL << BPROT_CONFIG0_REGION1_Pos) /*!< Bit mask of REGION1 field. */ +#define BPROT_CONFIG0_REGION1_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION1_Enabled (1UL) /*!< Protection enable */ + +/* Bit 0 : Enable protection for region 0. Write '0' has no effect. */ +#define BPROT_CONFIG0_REGION0_Pos (0UL) /*!< Position of REGION0 field. */ +#define BPROT_CONFIG0_REGION0_Msk (0x1UL << BPROT_CONFIG0_REGION0_Pos) /*!< Bit mask of REGION0 field. */ +#define BPROT_CONFIG0_REGION0_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG0_REGION0_Enabled (1UL) /*!< Protection enable */ + +/* Register: BPROT_CONFIG1 */ +/* Description: Block protect configuration register 1 */ + +/* Bit 31 : Enable protection for region 63. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION63_Pos (31UL) /*!< Position of REGION63 field. */ +#define BPROT_CONFIG1_REGION63_Msk (0x1UL << BPROT_CONFIG1_REGION63_Pos) /*!< Bit mask of REGION63 field. */ +#define BPROT_CONFIG1_REGION63_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION63_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 30 : Enable protection for region 62. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION62_Pos (30UL) /*!< Position of REGION62 field. */ +#define BPROT_CONFIG1_REGION62_Msk (0x1UL << BPROT_CONFIG1_REGION62_Pos) /*!< Bit mask of REGION62 field. */ +#define BPROT_CONFIG1_REGION62_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION62_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 29 : Enable protection for region 61. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION61_Pos (29UL) /*!< Position of REGION61 field. */ +#define BPROT_CONFIG1_REGION61_Msk (0x1UL << BPROT_CONFIG1_REGION61_Pos) /*!< Bit mask of REGION61 field. */ +#define BPROT_CONFIG1_REGION61_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION61_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 28 : Enable protection for region 60. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION60_Pos (28UL) /*!< Position of REGION60 field. */ +#define BPROT_CONFIG1_REGION60_Msk (0x1UL << BPROT_CONFIG1_REGION60_Pos) /*!< Bit mask of REGION60 field. */ +#define BPROT_CONFIG1_REGION60_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION60_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 27 : Enable protection for region 59. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION59_Pos (27UL) /*!< Position of REGION59 field. */ +#define BPROT_CONFIG1_REGION59_Msk (0x1UL << BPROT_CONFIG1_REGION59_Pos) /*!< Bit mask of REGION59 field. */ +#define BPROT_CONFIG1_REGION59_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION59_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 26 : Enable protection for region 58. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION58_Pos (26UL) /*!< Position of REGION58 field. */ +#define BPROT_CONFIG1_REGION58_Msk (0x1UL << BPROT_CONFIG1_REGION58_Pos) /*!< Bit mask of REGION58 field. */ +#define BPROT_CONFIG1_REGION58_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION58_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 25 : Enable protection for region 57. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION57_Pos (25UL) /*!< Position of REGION57 field. */ +#define BPROT_CONFIG1_REGION57_Msk (0x1UL << BPROT_CONFIG1_REGION57_Pos) /*!< Bit mask of REGION57 field. */ +#define BPROT_CONFIG1_REGION57_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION57_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 24 : Enable protection for region 56. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION56_Pos (24UL) /*!< Position of REGION56 field. */ +#define BPROT_CONFIG1_REGION56_Msk (0x1UL << BPROT_CONFIG1_REGION56_Pos) /*!< Bit mask of REGION56 field. */ +#define BPROT_CONFIG1_REGION56_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION56_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 23 : Enable protection for region 55. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION55_Pos (23UL) /*!< Position of REGION55 field. */ +#define BPROT_CONFIG1_REGION55_Msk (0x1UL << BPROT_CONFIG1_REGION55_Pos) /*!< Bit mask of REGION55 field. */ +#define BPROT_CONFIG1_REGION55_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION55_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 22 : Enable protection for region 54. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION54_Pos (22UL) /*!< Position of REGION54 field. */ +#define BPROT_CONFIG1_REGION54_Msk (0x1UL << BPROT_CONFIG1_REGION54_Pos) /*!< Bit mask of REGION54 field. */ +#define BPROT_CONFIG1_REGION54_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION54_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 21 : Enable protection for region 53. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION53_Pos (21UL) /*!< Position of REGION53 field. */ +#define BPROT_CONFIG1_REGION53_Msk (0x1UL << BPROT_CONFIG1_REGION53_Pos) /*!< Bit mask of REGION53 field. */ +#define BPROT_CONFIG1_REGION53_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION53_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 20 : Enable protection for region 52. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION52_Pos (20UL) /*!< Position of REGION52 field. */ +#define BPROT_CONFIG1_REGION52_Msk (0x1UL << BPROT_CONFIG1_REGION52_Pos) /*!< Bit mask of REGION52 field. */ +#define BPROT_CONFIG1_REGION52_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION52_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 19 : Enable protection for region 51. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION51_Pos (19UL) /*!< Position of REGION51 field. */ +#define BPROT_CONFIG1_REGION51_Msk (0x1UL << BPROT_CONFIG1_REGION51_Pos) /*!< Bit mask of REGION51 field. */ +#define BPROT_CONFIG1_REGION51_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION51_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 18 : Enable protection for region 50. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION50_Pos (18UL) /*!< Position of REGION50 field. */ +#define BPROT_CONFIG1_REGION50_Msk (0x1UL << BPROT_CONFIG1_REGION50_Pos) /*!< Bit mask of REGION50 field. */ +#define BPROT_CONFIG1_REGION50_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION50_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 17 : Enable protection for region 49. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION49_Pos (17UL) /*!< Position of REGION49 field. */ +#define BPROT_CONFIG1_REGION49_Msk (0x1UL << BPROT_CONFIG1_REGION49_Pos) /*!< Bit mask of REGION49 field. */ +#define BPROT_CONFIG1_REGION49_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION49_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 16 : Enable protection for region 48. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION48_Pos (16UL) /*!< Position of REGION48 field. */ +#define BPROT_CONFIG1_REGION48_Msk (0x1UL << BPROT_CONFIG1_REGION48_Pos) /*!< Bit mask of REGION48 field. */ +#define BPROT_CONFIG1_REGION48_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION48_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 15 : Enable protection for region 47. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION47_Pos (15UL) /*!< Position of REGION47 field. */ +#define BPROT_CONFIG1_REGION47_Msk (0x1UL << BPROT_CONFIG1_REGION47_Pos) /*!< Bit mask of REGION47 field. */ +#define BPROT_CONFIG1_REGION47_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION47_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 14 : Enable protection for region 46. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION46_Pos (14UL) /*!< Position of REGION46 field. */ +#define BPROT_CONFIG1_REGION46_Msk (0x1UL << BPROT_CONFIG1_REGION46_Pos) /*!< Bit mask of REGION46 field. */ +#define BPROT_CONFIG1_REGION46_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION46_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 13 : Enable protection for region 45. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION45_Pos (13UL) /*!< Position of REGION45 field. */ +#define BPROT_CONFIG1_REGION45_Msk (0x1UL << BPROT_CONFIG1_REGION45_Pos) /*!< Bit mask of REGION45 field. */ +#define BPROT_CONFIG1_REGION45_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION45_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 12 : Enable protection for region 44. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION44_Pos (12UL) /*!< Position of REGION44 field. */ +#define BPROT_CONFIG1_REGION44_Msk (0x1UL << BPROT_CONFIG1_REGION44_Pos) /*!< Bit mask of REGION44 field. */ +#define BPROT_CONFIG1_REGION44_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION44_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 11 : Enable protection for region 43. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION43_Pos (11UL) /*!< Position of REGION43 field. */ +#define BPROT_CONFIG1_REGION43_Msk (0x1UL << BPROT_CONFIG1_REGION43_Pos) /*!< Bit mask of REGION43 field. */ +#define BPROT_CONFIG1_REGION43_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION43_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 10 : Enable protection for region 42. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION42_Pos (10UL) /*!< Position of REGION42 field. */ +#define BPROT_CONFIG1_REGION42_Msk (0x1UL << BPROT_CONFIG1_REGION42_Pos) /*!< Bit mask of REGION42 field. */ +#define BPROT_CONFIG1_REGION42_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION42_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 9 : Enable protection for region 41. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION41_Pos (9UL) /*!< Position of REGION41 field. */ +#define BPROT_CONFIG1_REGION41_Msk (0x1UL << BPROT_CONFIG1_REGION41_Pos) /*!< Bit mask of REGION41 field. */ +#define BPROT_CONFIG1_REGION41_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION41_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 8 : Enable protection for region 40. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION40_Pos (8UL) /*!< Position of REGION40 field. */ +#define BPROT_CONFIG1_REGION40_Msk (0x1UL << BPROT_CONFIG1_REGION40_Pos) /*!< Bit mask of REGION40 field. */ +#define BPROT_CONFIG1_REGION40_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION40_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 7 : Enable protection for region 39. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION39_Pos (7UL) /*!< Position of REGION39 field. */ +#define BPROT_CONFIG1_REGION39_Msk (0x1UL << BPROT_CONFIG1_REGION39_Pos) /*!< Bit mask of REGION39 field. */ +#define BPROT_CONFIG1_REGION39_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION39_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 6 : Enable protection for region 38. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION38_Pos (6UL) /*!< Position of REGION38 field. */ +#define BPROT_CONFIG1_REGION38_Msk (0x1UL << BPROT_CONFIG1_REGION38_Pos) /*!< Bit mask of REGION38 field. */ +#define BPROT_CONFIG1_REGION38_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION38_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 5 : Enable protection for region 37. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION37_Pos (5UL) /*!< Position of REGION37 field. */ +#define BPROT_CONFIG1_REGION37_Msk (0x1UL << BPROT_CONFIG1_REGION37_Pos) /*!< Bit mask of REGION37 field. */ +#define BPROT_CONFIG1_REGION37_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION37_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 4 : Enable protection for region 36. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION36_Pos (4UL) /*!< Position of REGION36 field. */ +#define BPROT_CONFIG1_REGION36_Msk (0x1UL << BPROT_CONFIG1_REGION36_Pos) /*!< Bit mask of REGION36 field. */ +#define BPROT_CONFIG1_REGION36_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION36_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 3 : Enable protection for region 35. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION35_Pos (3UL) /*!< Position of REGION35 field. */ +#define BPROT_CONFIG1_REGION35_Msk (0x1UL << BPROT_CONFIG1_REGION35_Pos) /*!< Bit mask of REGION35 field. */ +#define BPROT_CONFIG1_REGION35_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION35_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 2 : Enable protection for region 34. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION34_Pos (2UL) /*!< Position of REGION34 field. */ +#define BPROT_CONFIG1_REGION34_Msk (0x1UL << BPROT_CONFIG1_REGION34_Pos) /*!< Bit mask of REGION34 field. */ +#define BPROT_CONFIG1_REGION34_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION34_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 1 : Enable protection for region 33. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION33_Pos (1UL) /*!< Position of REGION33 field. */ +#define BPROT_CONFIG1_REGION33_Msk (0x1UL << BPROT_CONFIG1_REGION33_Pos) /*!< Bit mask of REGION33 field. */ +#define BPROT_CONFIG1_REGION33_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION33_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 0 : Enable protection for region 32. Write '0' has no effect. */ +#define BPROT_CONFIG1_REGION32_Pos (0UL) /*!< Position of REGION32 field. */ +#define BPROT_CONFIG1_REGION32_Msk (0x1UL << BPROT_CONFIG1_REGION32_Pos) /*!< Bit mask of REGION32 field. */ +#define BPROT_CONFIG1_REGION32_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG1_REGION32_Enabled (1UL) /*!< Protection enabled */ + +/* Register: BPROT_DISABLEINDEBUG */ +/* Description: Disable protection mechanism in debug interface mode */ + +/* Bit 0 : Disable the protection mechanism for NVM regions while in debug interface mode. This register will only disable the protection mechanism if the device is in debug interface mode. */ +#define BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Pos (0UL) /*!< Position of DISABLEINDEBUG field. */ +#define BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Msk (0x1UL << BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Pos) /*!< Bit mask of DISABLEINDEBUG field. */ +#define BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Enabled (0UL) /*!< Enable in debug */ +#define BPROT_DISABLEINDEBUG_DISABLEINDEBUG_Disabled (1UL) /*!< Disable in debug */ + +/* Register: BPROT_CONFIG2 */ +/* Description: Block protect configuration register 2 */ + +/* Bit 31 : Enable protection for region 95. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION95_Pos (31UL) /*!< Position of REGION95 field. */ +#define BPROT_CONFIG2_REGION95_Msk (0x1UL << BPROT_CONFIG2_REGION95_Pos) /*!< Bit mask of REGION95 field. */ +#define BPROT_CONFIG2_REGION95_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION95_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 30 : Enable protection for region 94. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION94_Pos (30UL) /*!< Position of REGION94 field. */ +#define BPROT_CONFIG2_REGION94_Msk (0x1UL << BPROT_CONFIG2_REGION94_Pos) /*!< Bit mask of REGION94 field. */ +#define BPROT_CONFIG2_REGION94_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION94_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 29 : Enable protection for region 93. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION93_Pos (29UL) /*!< Position of REGION93 field. */ +#define BPROT_CONFIG2_REGION93_Msk (0x1UL << BPROT_CONFIG2_REGION93_Pos) /*!< Bit mask of REGION93 field. */ +#define BPROT_CONFIG2_REGION93_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION93_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 28 : Enable protection for region 92. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION92_Pos (28UL) /*!< Position of REGION92 field. */ +#define BPROT_CONFIG2_REGION92_Msk (0x1UL << BPROT_CONFIG2_REGION92_Pos) /*!< Bit mask of REGION92 field. */ +#define BPROT_CONFIG2_REGION92_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION92_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 27 : Enable protection for region 91. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION91_Pos (27UL) /*!< Position of REGION91 field. */ +#define BPROT_CONFIG2_REGION91_Msk (0x1UL << BPROT_CONFIG2_REGION91_Pos) /*!< Bit mask of REGION91 field. */ +#define BPROT_CONFIG2_REGION91_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION91_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 26 : Enable protection for region 90. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION90_Pos (26UL) /*!< Position of REGION90 field. */ +#define BPROT_CONFIG2_REGION90_Msk (0x1UL << BPROT_CONFIG2_REGION90_Pos) /*!< Bit mask of REGION90 field. */ +#define BPROT_CONFIG2_REGION90_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION90_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 25 : Enable protection for region 89. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION89_Pos (25UL) /*!< Position of REGION89 field. */ +#define BPROT_CONFIG2_REGION89_Msk (0x1UL << BPROT_CONFIG2_REGION89_Pos) /*!< Bit mask of REGION89 field. */ +#define BPROT_CONFIG2_REGION89_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION89_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 24 : Enable protection for region 88. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION88_Pos (24UL) /*!< Position of REGION88 field. */ +#define BPROT_CONFIG2_REGION88_Msk (0x1UL << BPROT_CONFIG2_REGION88_Pos) /*!< Bit mask of REGION88 field. */ +#define BPROT_CONFIG2_REGION88_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION88_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 23 : Enable protection for region 87. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION87_Pos (23UL) /*!< Position of REGION87 field. */ +#define BPROT_CONFIG2_REGION87_Msk (0x1UL << BPROT_CONFIG2_REGION87_Pos) /*!< Bit mask of REGION87 field. */ +#define BPROT_CONFIG2_REGION87_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION87_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 22 : Enable protection for region 86. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION86_Pos (22UL) /*!< Position of REGION86 field. */ +#define BPROT_CONFIG2_REGION86_Msk (0x1UL << BPROT_CONFIG2_REGION86_Pos) /*!< Bit mask of REGION86 field. */ +#define BPROT_CONFIG2_REGION86_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION86_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 21 : Enable protection for region 85. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION85_Pos (21UL) /*!< Position of REGION85 field. */ +#define BPROT_CONFIG2_REGION85_Msk (0x1UL << BPROT_CONFIG2_REGION85_Pos) /*!< Bit mask of REGION85 field. */ +#define BPROT_CONFIG2_REGION85_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION85_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 20 : Enable protection for region 84. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION84_Pos (20UL) /*!< Position of REGION84 field. */ +#define BPROT_CONFIG2_REGION84_Msk (0x1UL << BPROT_CONFIG2_REGION84_Pos) /*!< Bit mask of REGION84 field. */ +#define BPROT_CONFIG2_REGION84_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION84_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 19 : Enable protection for region 83. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION83_Pos (19UL) /*!< Position of REGION83 field. */ +#define BPROT_CONFIG2_REGION83_Msk (0x1UL << BPROT_CONFIG2_REGION83_Pos) /*!< Bit mask of REGION83 field. */ +#define BPROT_CONFIG2_REGION83_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION83_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 18 : Enable protection for region 82. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION82_Pos (18UL) /*!< Position of REGION82 field. */ +#define BPROT_CONFIG2_REGION82_Msk (0x1UL << BPROT_CONFIG2_REGION82_Pos) /*!< Bit mask of REGION82 field. */ +#define BPROT_CONFIG2_REGION82_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION82_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 17 : Enable protection for region 81. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION81_Pos (17UL) /*!< Position of REGION81 field. */ +#define BPROT_CONFIG2_REGION81_Msk (0x1UL << BPROT_CONFIG2_REGION81_Pos) /*!< Bit mask of REGION81 field. */ +#define BPROT_CONFIG2_REGION81_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION81_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 16 : Enable protection for region 80. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION80_Pos (16UL) /*!< Position of REGION80 field. */ +#define BPROT_CONFIG2_REGION80_Msk (0x1UL << BPROT_CONFIG2_REGION80_Pos) /*!< Bit mask of REGION80 field. */ +#define BPROT_CONFIG2_REGION80_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION80_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 15 : Enable protection for region 79. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION79_Pos (15UL) /*!< Position of REGION79 field. */ +#define BPROT_CONFIG2_REGION79_Msk (0x1UL << BPROT_CONFIG2_REGION79_Pos) /*!< Bit mask of REGION79 field. */ +#define BPROT_CONFIG2_REGION79_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION79_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 14 : Enable protection for region 78. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION78_Pos (14UL) /*!< Position of REGION78 field. */ +#define BPROT_CONFIG2_REGION78_Msk (0x1UL << BPROT_CONFIG2_REGION78_Pos) /*!< Bit mask of REGION78 field. */ +#define BPROT_CONFIG2_REGION78_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION78_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 13 : Enable protection for region 77. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION77_Pos (13UL) /*!< Position of REGION77 field. */ +#define BPROT_CONFIG2_REGION77_Msk (0x1UL << BPROT_CONFIG2_REGION77_Pos) /*!< Bit mask of REGION77 field. */ +#define BPROT_CONFIG2_REGION77_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION77_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 12 : Enable protection for region 76. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION76_Pos (12UL) /*!< Position of REGION76 field. */ +#define BPROT_CONFIG2_REGION76_Msk (0x1UL << BPROT_CONFIG2_REGION76_Pos) /*!< Bit mask of REGION76 field. */ +#define BPROT_CONFIG2_REGION76_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION76_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 11 : Enable protection for region 75. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION75_Pos (11UL) /*!< Position of REGION75 field. */ +#define BPROT_CONFIG2_REGION75_Msk (0x1UL << BPROT_CONFIG2_REGION75_Pos) /*!< Bit mask of REGION75 field. */ +#define BPROT_CONFIG2_REGION75_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION75_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 10 : Enable protection for region 74. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION74_Pos (10UL) /*!< Position of REGION74 field. */ +#define BPROT_CONFIG2_REGION74_Msk (0x1UL << BPROT_CONFIG2_REGION74_Pos) /*!< Bit mask of REGION74 field. */ +#define BPROT_CONFIG2_REGION74_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION74_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 9 : Enable protection for region 73. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION73_Pos (9UL) /*!< Position of REGION73 field. */ +#define BPROT_CONFIG2_REGION73_Msk (0x1UL << BPROT_CONFIG2_REGION73_Pos) /*!< Bit mask of REGION73 field. */ +#define BPROT_CONFIG2_REGION73_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION73_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 8 : Enable protection for region 72. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION72_Pos (8UL) /*!< Position of REGION72 field. */ +#define BPROT_CONFIG2_REGION72_Msk (0x1UL << BPROT_CONFIG2_REGION72_Pos) /*!< Bit mask of REGION72 field. */ +#define BPROT_CONFIG2_REGION72_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION72_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 7 : Enable protection for region 71. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION71_Pos (7UL) /*!< Position of REGION71 field. */ +#define BPROT_CONFIG2_REGION71_Msk (0x1UL << BPROT_CONFIG2_REGION71_Pos) /*!< Bit mask of REGION71 field. */ +#define BPROT_CONFIG2_REGION71_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION71_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 6 : Enable protection for region 70. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION70_Pos (6UL) /*!< Position of REGION70 field. */ +#define BPROT_CONFIG2_REGION70_Msk (0x1UL << BPROT_CONFIG2_REGION70_Pos) /*!< Bit mask of REGION70 field. */ +#define BPROT_CONFIG2_REGION70_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION70_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 5 : Enable protection for region 69. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION69_Pos (5UL) /*!< Position of REGION69 field. */ +#define BPROT_CONFIG2_REGION69_Msk (0x1UL << BPROT_CONFIG2_REGION69_Pos) /*!< Bit mask of REGION69 field. */ +#define BPROT_CONFIG2_REGION69_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION69_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 4 : Enable protection for region 68. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION68_Pos (4UL) /*!< Position of REGION68 field. */ +#define BPROT_CONFIG2_REGION68_Msk (0x1UL << BPROT_CONFIG2_REGION68_Pos) /*!< Bit mask of REGION68 field. */ +#define BPROT_CONFIG2_REGION68_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION68_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 3 : Enable protection for region 67. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION67_Pos (3UL) /*!< Position of REGION67 field. */ +#define BPROT_CONFIG2_REGION67_Msk (0x1UL << BPROT_CONFIG2_REGION67_Pos) /*!< Bit mask of REGION67 field. */ +#define BPROT_CONFIG2_REGION67_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION67_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 2 : Enable protection for region 66. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION66_Pos (2UL) /*!< Position of REGION66 field. */ +#define BPROT_CONFIG2_REGION66_Msk (0x1UL << BPROT_CONFIG2_REGION66_Pos) /*!< Bit mask of REGION66 field. */ +#define BPROT_CONFIG2_REGION66_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION66_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 1 : Enable protection for region 65. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION65_Pos (1UL) /*!< Position of REGION65 field. */ +#define BPROT_CONFIG2_REGION65_Msk (0x1UL << BPROT_CONFIG2_REGION65_Pos) /*!< Bit mask of REGION65 field. */ +#define BPROT_CONFIG2_REGION65_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION65_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 0 : Enable protection for region 64. Write '0' has no effect. */ +#define BPROT_CONFIG2_REGION64_Pos (0UL) /*!< Position of REGION64 field. */ +#define BPROT_CONFIG2_REGION64_Msk (0x1UL << BPROT_CONFIG2_REGION64_Pos) /*!< Bit mask of REGION64 field. */ +#define BPROT_CONFIG2_REGION64_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG2_REGION64_Enabled (1UL) /*!< Protection enabled */ + +/* Register: BPROT_CONFIG3 */ +/* Description: Block protect configuration register 3 */ + +/* Bit 31 : Enable protection for region 127. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION127_Pos (31UL) /*!< Position of REGION127 field. */ +#define BPROT_CONFIG3_REGION127_Msk (0x1UL << BPROT_CONFIG3_REGION127_Pos) /*!< Bit mask of REGION127 field. */ +#define BPROT_CONFIG3_REGION127_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION127_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 30 : Enable protection for region 126. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION126_Pos (30UL) /*!< Position of REGION126 field. */ +#define BPROT_CONFIG3_REGION126_Msk (0x1UL << BPROT_CONFIG3_REGION126_Pos) /*!< Bit mask of REGION126 field. */ +#define BPROT_CONFIG3_REGION126_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION126_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 29 : Enable protection for region 125. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION125_Pos (29UL) /*!< Position of REGION125 field. */ +#define BPROT_CONFIG3_REGION125_Msk (0x1UL << BPROT_CONFIG3_REGION125_Pos) /*!< Bit mask of REGION125 field. */ +#define BPROT_CONFIG3_REGION125_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION125_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 28 : Enable protection for region 124. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION124_Pos (28UL) /*!< Position of REGION124 field. */ +#define BPROT_CONFIG3_REGION124_Msk (0x1UL << BPROT_CONFIG3_REGION124_Pos) /*!< Bit mask of REGION124 field. */ +#define BPROT_CONFIG3_REGION124_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION124_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 27 : Enable protection for region 123. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION123_Pos (27UL) /*!< Position of REGION123 field. */ +#define BPROT_CONFIG3_REGION123_Msk (0x1UL << BPROT_CONFIG3_REGION123_Pos) /*!< Bit mask of REGION123 field. */ +#define BPROT_CONFIG3_REGION123_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION123_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 26 : Enable protection for region 122. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION122_Pos (26UL) /*!< Position of REGION122 field. */ +#define BPROT_CONFIG3_REGION122_Msk (0x1UL << BPROT_CONFIG3_REGION122_Pos) /*!< Bit mask of REGION122 field. */ +#define BPROT_CONFIG3_REGION122_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION122_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 25 : Enable protection for region 121. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION121_Pos (25UL) /*!< Position of REGION121 field. */ +#define BPROT_CONFIG3_REGION121_Msk (0x1UL << BPROT_CONFIG3_REGION121_Pos) /*!< Bit mask of REGION121 field. */ +#define BPROT_CONFIG3_REGION121_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION121_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 24 : Enable protection for region 120. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION120_Pos (24UL) /*!< Position of REGION120 field. */ +#define BPROT_CONFIG3_REGION120_Msk (0x1UL << BPROT_CONFIG3_REGION120_Pos) /*!< Bit mask of REGION120 field. */ +#define BPROT_CONFIG3_REGION120_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION120_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 23 : Enable protection for region 119. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION119_Pos (23UL) /*!< Position of REGION119 field. */ +#define BPROT_CONFIG3_REGION119_Msk (0x1UL << BPROT_CONFIG3_REGION119_Pos) /*!< Bit mask of REGION119 field. */ +#define BPROT_CONFIG3_REGION119_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION119_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 22 : Enable protection for region 118. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION118_Pos (22UL) /*!< Position of REGION118 field. */ +#define BPROT_CONFIG3_REGION118_Msk (0x1UL << BPROT_CONFIG3_REGION118_Pos) /*!< Bit mask of REGION118 field. */ +#define BPROT_CONFIG3_REGION118_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION118_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 21 : Enable protection for region 117. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION117_Pos (21UL) /*!< Position of REGION117 field. */ +#define BPROT_CONFIG3_REGION117_Msk (0x1UL << BPROT_CONFIG3_REGION117_Pos) /*!< Bit mask of REGION117 field. */ +#define BPROT_CONFIG3_REGION117_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION117_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 20 : Enable protection for region 116. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION116_Pos (20UL) /*!< Position of REGION116 field. */ +#define BPROT_CONFIG3_REGION116_Msk (0x1UL << BPROT_CONFIG3_REGION116_Pos) /*!< Bit mask of REGION116 field. */ +#define BPROT_CONFIG3_REGION116_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION116_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 19 : Enable protection for region 115. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION115_Pos (19UL) /*!< Position of REGION115 field. */ +#define BPROT_CONFIG3_REGION115_Msk (0x1UL << BPROT_CONFIG3_REGION115_Pos) /*!< Bit mask of REGION115 field. */ +#define BPROT_CONFIG3_REGION115_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION115_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 18 : Enable protection for region 114. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION114_Pos (18UL) /*!< Position of REGION114 field. */ +#define BPROT_CONFIG3_REGION114_Msk (0x1UL << BPROT_CONFIG3_REGION114_Pos) /*!< Bit mask of REGION114 field. */ +#define BPROT_CONFIG3_REGION114_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION114_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 17 : Enable protection for region 113. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION113_Pos (17UL) /*!< Position of REGION113 field. */ +#define BPROT_CONFIG3_REGION113_Msk (0x1UL << BPROT_CONFIG3_REGION113_Pos) /*!< Bit mask of REGION113 field. */ +#define BPROT_CONFIG3_REGION113_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION113_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 16 : Enable protection for region 112. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION112_Pos (16UL) /*!< Position of REGION112 field. */ +#define BPROT_CONFIG3_REGION112_Msk (0x1UL << BPROT_CONFIG3_REGION112_Pos) /*!< Bit mask of REGION112 field. */ +#define BPROT_CONFIG3_REGION112_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION112_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 15 : Enable protection for region 111. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION111_Pos (15UL) /*!< Position of REGION111 field. */ +#define BPROT_CONFIG3_REGION111_Msk (0x1UL << BPROT_CONFIG3_REGION111_Pos) /*!< Bit mask of REGION111 field. */ +#define BPROT_CONFIG3_REGION111_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION111_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 14 : Enable protection for region 110. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION110_Pos (14UL) /*!< Position of REGION110 field. */ +#define BPROT_CONFIG3_REGION110_Msk (0x1UL << BPROT_CONFIG3_REGION110_Pos) /*!< Bit mask of REGION110 field. */ +#define BPROT_CONFIG3_REGION110_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION110_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 13 : Enable protection for region 109. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION109_Pos (13UL) /*!< Position of REGION109 field. */ +#define BPROT_CONFIG3_REGION109_Msk (0x1UL << BPROT_CONFIG3_REGION109_Pos) /*!< Bit mask of REGION109 field. */ +#define BPROT_CONFIG3_REGION109_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION109_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 12 : Enable protection for region 108. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION108_Pos (12UL) /*!< Position of REGION108 field. */ +#define BPROT_CONFIG3_REGION108_Msk (0x1UL << BPROT_CONFIG3_REGION108_Pos) /*!< Bit mask of REGION108 field. */ +#define BPROT_CONFIG3_REGION108_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION108_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 11 : Enable protection for region 107. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION107_Pos (11UL) /*!< Position of REGION107 field. */ +#define BPROT_CONFIG3_REGION107_Msk (0x1UL << BPROT_CONFIG3_REGION107_Pos) /*!< Bit mask of REGION107 field. */ +#define BPROT_CONFIG3_REGION107_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION107_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 10 : Enable protection for region 106. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION106_Pos (10UL) /*!< Position of REGION106 field. */ +#define BPROT_CONFIG3_REGION106_Msk (0x1UL << BPROT_CONFIG3_REGION106_Pos) /*!< Bit mask of REGION106 field. */ +#define BPROT_CONFIG3_REGION106_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION106_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 9 : Enable protection for region 105. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION105_Pos (9UL) /*!< Position of REGION105 field. */ +#define BPROT_CONFIG3_REGION105_Msk (0x1UL << BPROT_CONFIG3_REGION105_Pos) /*!< Bit mask of REGION105 field. */ +#define BPROT_CONFIG3_REGION105_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION105_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 8 : Enable protection for region 104. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION104_Pos (8UL) /*!< Position of REGION104 field. */ +#define BPROT_CONFIG3_REGION104_Msk (0x1UL << BPROT_CONFIG3_REGION104_Pos) /*!< Bit mask of REGION104 field. */ +#define BPROT_CONFIG3_REGION104_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION104_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 7 : Enable protection for region 103. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION103_Pos (7UL) /*!< Position of REGION103 field. */ +#define BPROT_CONFIG3_REGION103_Msk (0x1UL << BPROT_CONFIG3_REGION103_Pos) /*!< Bit mask of REGION103 field. */ +#define BPROT_CONFIG3_REGION103_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION103_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 6 : Enable protection for region 102. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION102_Pos (6UL) /*!< Position of REGION102 field. */ +#define BPROT_CONFIG3_REGION102_Msk (0x1UL << BPROT_CONFIG3_REGION102_Pos) /*!< Bit mask of REGION102 field. */ +#define BPROT_CONFIG3_REGION102_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION102_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 5 : Enable protection for region 101. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION101_Pos (5UL) /*!< Position of REGION101 field. */ +#define BPROT_CONFIG3_REGION101_Msk (0x1UL << BPROT_CONFIG3_REGION101_Pos) /*!< Bit mask of REGION101 field. */ +#define BPROT_CONFIG3_REGION101_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION101_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 4 : Enable protection for region 100. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION100_Pos (4UL) /*!< Position of REGION100 field. */ +#define BPROT_CONFIG3_REGION100_Msk (0x1UL << BPROT_CONFIG3_REGION100_Pos) /*!< Bit mask of REGION100 field. */ +#define BPROT_CONFIG3_REGION100_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION100_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 3 : Enable protection for region 99. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION99_Pos (3UL) /*!< Position of REGION99 field. */ +#define BPROT_CONFIG3_REGION99_Msk (0x1UL << BPROT_CONFIG3_REGION99_Pos) /*!< Bit mask of REGION99 field. */ +#define BPROT_CONFIG3_REGION99_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION99_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 2 : Enable protection for region 98. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION98_Pos (2UL) /*!< Position of REGION98 field. */ +#define BPROT_CONFIG3_REGION98_Msk (0x1UL << BPROT_CONFIG3_REGION98_Pos) /*!< Bit mask of REGION98 field. */ +#define BPROT_CONFIG3_REGION98_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION98_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 1 : Enable protection for region 97. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION97_Pos (1UL) /*!< Position of REGION97 field. */ +#define BPROT_CONFIG3_REGION97_Msk (0x1UL << BPROT_CONFIG3_REGION97_Pos) /*!< Bit mask of REGION97 field. */ +#define BPROT_CONFIG3_REGION97_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION97_Enabled (1UL) /*!< Protection enabled */ + +/* Bit 0 : Enable protection for region 96. Write '0' has no effect. */ +#define BPROT_CONFIG3_REGION96_Pos (0UL) /*!< Position of REGION96 field. */ +#define BPROT_CONFIG3_REGION96_Msk (0x1UL << BPROT_CONFIG3_REGION96_Pos) /*!< Bit mask of REGION96 field. */ +#define BPROT_CONFIG3_REGION96_Disabled (0UL) /*!< Protection disabled */ +#define BPROT_CONFIG3_REGION96_Enabled (1UL) /*!< Protection enabled */ + + +/* Peripheral: CCM */ +/* Description: AES CCM Mode Encryption */ + +/* Register: CCM_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 0 : Shortcut between ENDKSGEN event and CRYPT task */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Pos (0UL) /*!< Position of ENDKSGEN_CRYPT field. */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Msk (0x1UL << CCM_SHORTS_ENDKSGEN_CRYPT_Pos) /*!< Bit mask of ENDKSGEN_CRYPT field. */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Disabled (0UL) /*!< Disable shortcut */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: CCM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 2 : Write '1' to Enable interrupt for ERROR event */ +#define CCM_INTENSET_ERROR_Pos (2UL) /*!< Position of ERROR field. */ +#define CCM_INTENSET_ERROR_Msk (0x1UL << CCM_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define CCM_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for ENDCRYPT event */ +#define CCM_INTENSET_ENDCRYPT_Pos (1UL) /*!< Position of ENDCRYPT field. */ +#define CCM_INTENSET_ENDCRYPT_Msk (0x1UL << CCM_INTENSET_ENDCRYPT_Pos) /*!< Bit mask of ENDCRYPT field. */ +#define CCM_INTENSET_ENDCRYPT_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENSET_ENDCRYPT_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENSET_ENDCRYPT_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for ENDKSGEN event */ +#define CCM_INTENSET_ENDKSGEN_Pos (0UL) /*!< Position of ENDKSGEN field. */ +#define CCM_INTENSET_ENDKSGEN_Msk (0x1UL << CCM_INTENSET_ENDKSGEN_Pos) /*!< Bit mask of ENDKSGEN field. */ +#define CCM_INTENSET_ENDKSGEN_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENSET_ENDKSGEN_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENSET_ENDKSGEN_Set (1UL) /*!< Enable */ + +/* Register: CCM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 2 : Write '1' to Disable interrupt for ERROR event */ +#define CCM_INTENCLR_ERROR_Pos (2UL) /*!< Position of ERROR field. */ +#define CCM_INTENCLR_ERROR_Msk (0x1UL << CCM_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define CCM_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for ENDCRYPT event */ +#define CCM_INTENCLR_ENDCRYPT_Pos (1UL) /*!< Position of ENDCRYPT field. */ +#define CCM_INTENCLR_ENDCRYPT_Msk (0x1UL << CCM_INTENCLR_ENDCRYPT_Pos) /*!< Bit mask of ENDCRYPT field. */ +#define CCM_INTENCLR_ENDCRYPT_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENCLR_ENDCRYPT_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENCLR_ENDCRYPT_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for ENDKSGEN event */ +#define CCM_INTENCLR_ENDKSGEN_Pos (0UL) /*!< Position of ENDKSGEN field. */ +#define CCM_INTENCLR_ENDKSGEN_Msk (0x1UL << CCM_INTENCLR_ENDKSGEN_Pos) /*!< Bit mask of ENDKSGEN field. */ +#define CCM_INTENCLR_ENDKSGEN_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENCLR_ENDKSGEN_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENCLR_ENDKSGEN_Clear (1UL) /*!< Disable */ + +/* Register: CCM_MICSTATUS */ +/* Description: MIC check result */ + +/* Bit 0 : The result of the MIC check performed during the previous decryption operation */ +#define CCM_MICSTATUS_MICSTATUS_Pos (0UL) /*!< Position of MICSTATUS field. */ +#define CCM_MICSTATUS_MICSTATUS_Msk (0x1UL << CCM_MICSTATUS_MICSTATUS_Pos) /*!< Bit mask of MICSTATUS field. */ +#define CCM_MICSTATUS_MICSTATUS_CheckFailed (0UL) /*!< MIC check failed */ +#define CCM_MICSTATUS_MICSTATUS_CheckPassed (1UL) /*!< MIC check passed */ + +/* Register: CCM_ENABLE */ +/* Description: Enable */ + +/* Bits 1..0 : Enable or disable CCM */ +#define CCM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define CCM_ENABLE_ENABLE_Msk (0x3UL << CCM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define CCM_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define CCM_ENABLE_ENABLE_Enabled (2UL) /*!< Enable */ + +/* Register: CCM_MODE */ +/* Description: Operation mode */ + +/* Bit 24 : Packet length configuration */ +#define CCM_MODE_LENGTH_Pos (24UL) /*!< Position of LENGTH field. */ +#define CCM_MODE_LENGTH_Msk (0x1UL << CCM_MODE_LENGTH_Pos) /*!< Bit mask of LENGTH field. */ +#define CCM_MODE_LENGTH_Default (0UL) /*!< Default length. Effective length of LENGTH field is 5-bit */ +#define CCM_MODE_LENGTH_Extended (1UL) /*!< Extended length. Effective length of LENGTH field is 8-bit */ + +/* Bit 16 : Data rate that the CCM shall run in synch with */ +#define CCM_MODE_DATARATE_Pos (16UL) /*!< Position of DATARATE field. */ +#define CCM_MODE_DATARATE_Msk (0x1UL << CCM_MODE_DATARATE_Pos) /*!< Bit mask of DATARATE field. */ +#define CCM_MODE_DATARATE_1Mbit (0UL) /*!< In synch with 1 Mbit data rate */ +#define CCM_MODE_DATARATE_2Mbit (1UL) /*!< In synch with 2 Mbit data rate */ + +/* Bit 0 : The mode of operation to be used */ +#define CCM_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define CCM_MODE_MODE_Msk (0x1UL << CCM_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define CCM_MODE_MODE_Encryption (0UL) /*!< AES CCM packet encryption mode */ +#define CCM_MODE_MODE_Decryption (1UL) /*!< AES CCM packet decryption mode */ + +/* Register: CCM_CNFPTR */ +/* Description: Pointer to data structure holding AES key and NONCE vector */ + +/* Bits 31..0 : Pointer to the data structure holding the AES key and the CCM NONCE vector (see Table 1 CCM data structure overview) */ +#define CCM_CNFPTR_CNFPTR_Pos (0UL) /*!< Position of CNFPTR field. */ +#define CCM_CNFPTR_CNFPTR_Msk (0xFFFFFFFFUL << CCM_CNFPTR_CNFPTR_Pos) /*!< Bit mask of CNFPTR field. */ + +/* Register: CCM_INPTR */ +/* Description: Input pointer */ + +/* Bits 31..0 : Input pointer */ +#define CCM_INPTR_INPTR_Pos (0UL) /*!< Position of INPTR field. */ +#define CCM_INPTR_INPTR_Msk (0xFFFFFFFFUL << CCM_INPTR_INPTR_Pos) /*!< Bit mask of INPTR field. */ + +/* Register: CCM_OUTPTR */ +/* Description: Output pointer */ + +/* Bits 31..0 : Output pointer */ +#define CCM_OUTPTR_OUTPTR_Pos (0UL) /*!< Position of OUTPTR field. */ +#define CCM_OUTPTR_OUTPTR_Msk (0xFFFFFFFFUL << CCM_OUTPTR_OUTPTR_Pos) /*!< Bit mask of OUTPTR field. */ + +/* Register: CCM_SCRATCHPTR */ +/* Description: Pointer to data area used for temporary storage */ + +/* Bits 31..0 : Pointer to a scratch data area used for temporary storage during key-stream generation, MIC generation and encryption/decryption. */ +#define CCM_SCRATCHPTR_SCRATCHPTR_Pos (0UL) /*!< Position of SCRATCHPTR field. */ +#define CCM_SCRATCHPTR_SCRATCHPTR_Msk (0xFFFFFFFFUL << CCM_SCRATCHPTR_SCRATCHPTR_Pos) /*!< Bit mask of SCRATCHPTR field. */ + + +/* Peripheral: CLOCK */ +/* Description: Clock control */ + +/* Register: CLOCK_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 4 : Write '1' to Enable interrupt for CTTO event */ +#define CLOCK_INTENSET_CTTO_Pos (4UL) /*!< Position of CTTO field. */ +#define CLOCK_INTENSET_CTTO_Msk (0x1UL << CLOCK_INTENSET_CTTO_Pos) /*!< Bit mask of CTTO field. */ +#define CLOCK_INTENSET_CTTO_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENSET_CTTO_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENSET_CTTO_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for DONE event */ +#define CLOCK_INTENSET_DONE_Pos (3UL) /*!< Position of DONE field. */ +#define CLOCK_INTENSET_DONE_Msk (0x1UL << CLOCK_INTENSET_DONE_Pos) /*!< Bit mask of DONE field. */ +#define CLOCK_INTENSET_DONE_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENSET_DONE_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENSET_DONE_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for LFCLKSTARTED event */ +#define CLOCK_INTENSET_LFCLKSTARTED_Pos (1UL) /*!< Position of LFCLKSTARTED field. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Msk (0x1UL << CLOCK_INTENSET_LFCLKSTARTED_Pos) /*!< Bit mask of LFCLKSTARTED field. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENSET_LFCLKSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENSET_LFCLKSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for HFCLKSTARTED event */ +#define CLOCK_INTENSET_HFCLKSTARTED_Pos (0UL) /*!< Position of HFCLKSTARTED field. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Msk (0x1UL << CLOCK_INTENSET_HFCLKSTARTED_Pos) /*!< Bit mask of HFCLKSTARTED field. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENSET_HFCLKSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENSET_HFCLKSTARTED_Set (1UL) /*!< Enable */ + +/* Register: CLOCK_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 4 : Write '1' to Disable interrupt for CTTO event */ +#define CLOCK_INTENCLR_CTTO_Pos (4UL) /*!< Position of CTTO field. */ +#define CLOCK_INTENCLR_CTTO_Msk (0x1UL << CLOCK_INTENCLR_CTTO_Pos) /*!< Bit mask of CTTO field. */ +#define CLOCK_INTENCLR_CTTO_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENCLR_CTTO_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENCLR_CTTO_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for DONE event */ +#define CLOCK_INTENCLR_DONE_Pos (3UL) /*!< Position of DONE field. */ +#define CLOCK_INTENCLR_DONE_Msk (0x1UL << CLOCK_INTENCLR_DONE_Pos) /*!< Bit mask of DONE field. */ +#define CLOCK_INTENCLR_DONE_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENCLR_DONE_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENCLR_DONE_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for LFCLKSTARTED event */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Pos (1UL) /*!< Position of LFCLKSTARTED field. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Msk (0x1UL << CLOCK_INTENCLR_LFCLKSTARTED_Pos) /*!< Bit mask of LFCLKSTARTED field. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for HFCLKSTARTED event */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Pos (0UL) /*!< Position of HFCLKSTARTED field. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Msk (0x1UL << CLOCK_INTENCLR_HFCLKSTARTED_Pos) /*!< Bit mask of HFCLKSTARTED field. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Clear (1UL) /*!< Disable */ + +/* Register: CLOCK_HFCLKRUN */ +/* Description: Status indicating that HFCLKSTART task has been triggered */ + +/* Bit 0 : HFCLKSTART task triggered or not */ +#define CLOCK_HFCLKRUN_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define CLOCK_HFCLKRUN_STATUS_Msk (0x1UL << CLOCK_HFCLKRUN_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define CLOCK_HFCLKRUN_STATUS_NotTriggered (0UL) /*!< Task not triggered */ +#define CLOCK_HFCLKRUN_STATUS_Triggered (1UL) /*!< Task triggered */ + +/* Register: CLOCK_HFCLKSTAT */ +/* Description: HFCLK status */ + +/* Bit 16 : HFCLK state */ +#define CLOCK_HFCLKSTAT_STATE_Pos (16UL) /*!< Position of STATE field. */ +#define CLOCK_HFCLKSTAT_STATE_Msk (0x1UL << CLOCK_HFCLKSTAT_STATE_Pos) /*!< Bit mask of STATE field. */ +#define CLOCK_HFCLKSTAT_STATE_NotRunning (0UL) /*!< HFCLK not running */ +#define CLOCK_HFCLKSTAT_STATE_Running (1UL) /*!< HFCLK running */ + +/* Bit 0 : Source of HFCLK */ +#define CLOCK_HFCLKSTAT_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_HFCLKSTAT_SRC_Msk (0x1UL << CLOCK_HFCLKSTAT_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_HFCLKSTAT_SRC_RC (0UL) /*!< 64 MHz internal oscillator (HFINT) */ +#define CLOCK_HFCLKSTAT_SRC_Xtal (1UL) /*!< 64 MHz crystal oscillator (HFXO) */ + +/* Register: CLOCK_LFCLKRUN */ +/* Description: Status indicating that LFCLKSTART task has been triggered */ + +/* Bit 0 : LFCLKSTART task triggered or not */ +#define CLOCK_LFCLKRUN_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define CLOCK_LFCLKRUN_STATUS_Msk (0x1UL << CLOCK_LFCLKRUN_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define CLOCK_LFCLKRUN_STATUS_NotTriggered (0UL) /*!< Task not triggered */ +#define CLOCK_LFCLKRUN_STATUS_Triggered (1UL) /*!< Task triggered */ + +/* Register: CLOCK_LFCLKSTAT */ +/* Description: LFCLK status */ + +/* Bit 16 : LFCLK state */ +#define CLOCK_LFCLKSTAT_STATE_Pos (16UL) /*!< Position of STATE field. */ +#define CLOCK_LFCLKSTAT_STATE_Msk (0x1UL << CLOCK_LFCLKSTAT_STATE_Pos) /*!< Bit mask of STATE field. */ +#define CLOCK_LFCLKSTAT_STATE_NotRunning (0UL) /*!< LFCLK not running */ +#define CLOCK_LFCLKSTAT_STATE_Running (1UL) /*!< LFCLK running */ + +/* Bits 1..0 : Source of LFCLK */ +#define CLOCK_LFCLKSTAT_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSTAT_SRC_Msk (0x3UL << CLOCK_LFCLKSTAT_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSTAT_SRC_RC (0UL) /*!< 32.768 kHz RC oscillator */ +#define CLOCK_LFCLKSTAT_SRC_Xtal (1UL) /*!< 32.768 kHz crystal oscillator */ +#define CLOCK_LFCLKSTAT_SRC_Synth (2UL) /*!< 32.768 kHz synthesized from HFCLK */ + +/* Register: CLOCK_LFCLKSRCCOPY */ +/* Description: Copy of LFCLKSRC register, set when LFCLKSTART task was triggered */ + +/* Bits 1..0 : Clock source */ +#define CLOCK_LFCLKSRCCOPY_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSRCCOPY_SRC_Msk (0x3UL << CLOCK_LFCLKSRCCOPY_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSRCCOPY_SRC_RC (0UL) /*!< 32.768 kHz RC oscillator */ +#define CLOCK_LFCLKSRCCOPY_SRC_Xtal (1UL) /*!< 32.768 kHz crystal oscillator */ +#define CLOCK_LFCLKSRCCOPY_SRC_Synth (2UL) /*!< 32.768 kHz synthesized from HFCLK */ + +/* Register: CLOCK_LFCLKSRC */ +/* Description: Clock source for the LFCLK */ + +/* Bits 1..0 : Clock source */ +#define CLOCK_LFCLKSRC_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSRC_SRC_Msk (0x3UL << CLOCK_LFCLKSRC_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSRC_SRC_RC (0UL) /*!< 32.768 kHz RC oscillator */ +#define CLOCK_LFCLKSRC_SRC_Xtal (1UL) /*!< 32.768 kHz crystal oscillator */ +#define CLOCK_LFCLKSRC_SRC_Synth (2UL) /*!< 32.768 kHz synthesized from HFCLK */ + +/* Register: CLOCK_CTIV */ +/* Description: Calibration timer interval (retained register, same reset behaviour as RESETREAS) */ + +/* Bits 6..0 : Calibration timer interval in multiple of 0.25 seconds. Range: 0.25 seconds to 31.75 seconds. */ +#define CLOCK_CTIV_CTIV_Pos (0UL) /*!< Position of CTIV field. */ +#define CLOCK_CTIV_CTIV_Msk (0x7FUL << CLOCK_CTIV_CTIV_Pos) /*!< Bit mask of CTIV field. */ + +/* Register: CLOCK_TRACECONFIG */ +/* Description: Clocking options for the Trace Port debug interface */ + +/* Bits 17..16 : Pin multiplexing of trace signals. */ +#define CLOCK_TRACECONFIG_TRACEMUX_Pos (16UL) /*!< Position of TRACEMUX field. */ +#define CLOCK_TRACECONFIG_TRACEMUX_Msk (0x3UL << CLOCK_TRACECONFIG_TRACEMUX_Pos) /*!< Bit mask of TRACEMUX field. */ +#define CLOCK_TRACECONFIG_TRACEMUX_GPIO (0UL) /*!< GPIOs multiplexed onto all trace-pins */ +#define CLOCK_TRACECONFIG_TRACEMUX_Serial (1UL) /*!< SWO multiplexed onto P0.18, GPIO multiplexed onto other trace pins */ +#define CLOCK_TRACECONFIG_TRACEMUX_Parallel (2UL) /*!< TRACECLK and TRACEDATA multiplexed onto P0.20, P0.18, P0.16, P0.15 and P0.14. */ + +/* Bits 1..0 : Speed of Trace Port clock. Note that the TRACECLK pin will output this clock divided by two. */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_Pos (0UL) /*!< Position of TRACEPORTSPEED field. */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_Msk (0x3UL << CLOCK_TRACECONFIG_TRACEPORTSPEED_Pos) /*!< Bit mask of TRACEPORTSPEED field. */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_32MHz (0UL) /*!< 32 MHz Trace Port clock (TRACECLK = 16 MHz) */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_16MHz (1UL) /*!< 16 MHz Trace Port clock (TRACECLK = 8 MHz) */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_8MHz (2UL) /*!< 8 MHz Trace Port clock (TRACECLK = 4 MHz) */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_4MHz (3UL) /*!< 4 MHz Trace Port clock (TRACECLK = 2 MHz) */ + + +/* Peripheral: COMP */ +/* Description: Comparator */ + +/* Register: COMP_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between CROSS event and STOP task */ +#define COMP_SHORTS_CROSS_STOP_Pos (4UL) /*!< Position of CROSS_STOP field. */ +#define COMP_SHORTS_CROSS_STOP_Msk (0x1UL << COMP_SHORTS_CROSS_STOP_Pos) /*!< Bit mask of CROSS_STOP field. */ +#define COMP_SHORTS_CROSS_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_CROSS_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between UP event and STOP task */ +#define COMP_SHORTS_UP_STOP_Pos (3UL) /*!< Position of UP_STOP field. */ +#define COMP_SHORTS_UP_STOP_Msk (0x1UL << COMP_SHORTS_UP_STOP_Pos) /*!< Bit mask of UP_STOP field. */ +#define COMP_SHORTS_UP_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_UP_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between DOWN event and STOP task */ +#define COMP_SHORTS_DOWN_STOP_Pos (2UL) /*!< Position of DOWN_STOP field. */ +#define COMP_SHORTS_DOWN_STOP_Msk (0x1UL << COMP_SHORTS_DOWN_STOP_Pos) /*!< Bit mask of DOWN_STOP field. */ +#define COMP_SHORTS_DOWN_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_DOWN_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between READY event and STOP task */ +#define COMP_SHORTS_READY_STOP_Pos (1UL) /*!< Position of READY_STOP field. */ +#define COMP_SHORTS_READY_STOP_Msk (0x1UL << COMP_SHORTS_READY_STOP_Pos) /*!< Bit mask of READY_STOP field. */ +#define COMP_SHORTS_READY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_READY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between READY event and SAMPLE task */ +#define COMP_SHORTS_READY_SAMPLE_Pos (0UL) /*!< Position of READY_SAMPLE field. */ +#define COMP_SHORTS_READY_SAMPLE_Msk (0x1UL << COMP_SHORTS_READY_SAMPLE_Pos) /*!< Bit mask of READY_SAMPLE field. */ +#define COMP_SHORTS_READY_SAMPLE_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_READY_SAMPLE_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: COMP_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 3 : Enable or disable interrupt for CROSS event */ +#define COMP_INTEN_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define COMP_INTEN_CROSS_Msk (0x1UL << COMP_INTEN_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define COMP_INTEN_CROSS_Disabled (0UL) /*!< Disable */ +#define COMP_INTEN_CROSS_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for UP event */ +#define COMP_INTEN_UP_Pos (2UL) /*!< Position of UP field. */ +#define COMP_INTEN_UP_Msk (0x1UL << COMP_INTEN_UP_Pos) /*!< Bit mask of UP field. */ +#define COMP_INTEN_UP_Disabled (0UL) /*!< Disable */ +#define COMP_INTEN_UP_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for DOWN event */ +#define COMP_INTEN_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define COMP_INTEN_DOWN_Msk (0x1UL << COMP_INTEN_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define COMP_INTEN_DOWN_Disabled (0UL) /*!< Disable */ +#define COMP_INTEN_DOWN_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for READY event */ +#define COMP_INTEN_READY_Pos (0UL) /*!< Position of READY field. */ +#define COMP_INTEN_READY_Msk (0x1UL << COMP_INTEN_READY_Pos) /*!< Bit mask of READY field. */ +#define COMP_INTEN_READY_Disabled (0UL) /*!< Disable */ +#define COMP_INTEN_READY_Enabled (1UL) /*!< Enable */ + +/* Register: COMP_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 3 : Write '1' to Enable interrupt for CROSS event */ +#define COMP_INTENSET_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define COMP_INTENSET_CROSS_Msk (0x1UL << COMP_INTENSET_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define COMP_INTENSET_CROSS_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENSET_CROSS_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENSET_CROSS_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for UP event */ +#define COMP_INTENSET_UP_Pos (2UL) /*!< Position of UP field. */ +#define COMP_INTENSET_UP_Msk (0x1UL << COMP_INTENSET_UP_Pos) /*!< Bit mask of UP field. */ +#define COMP_INTENSET_UP_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENSET_UP_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENSET_UP_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for DOWN event */ +#define COMP_INTENSET_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define COMP_INTENSET_DOWN_Msk (0x1UL << COMP_INTENSET_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define COMP_INTENSET_DOWN_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENSET_DOWN_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENSET_DOWN_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define COMP_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define COMP_INTENSET_READY_Msk (0x1UL << COMP_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define COMP_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: COMP_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 3 : Write '1' to Disable interrupt for CROSS event */ +#define COMP_INTENCLR_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define COMP_INTENCLR_CROSS_Msk (0x1UL << COMP_INTENCLR_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define COMP_INTENCLR_CROSS_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENCLR_CROSS_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENCLR_CROSS_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for UP event */ +#define COMP_INTENCLR_UP_Pos (2UL) /*!< Position of UP field. */ +#define COMP_INTENCLR_UP_Msk (0x1UL << COMP_INTENCLR_UP_Pos) /*!< Bit mask of UP field. */ +#define COMP_INTENCLR_UP_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENCLR_UP_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENCLR_UP_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for DOWN event */ +#define COMP_INTENCLR_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define COMP_INTENCLR_DOWN_Msk (0x1UL << COMP_INTENCLR_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define COMP_INTENCLR_DOWN_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENCLR_DOWN_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENCLR_DOWN_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define COMP_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define COMP_INTENCLR_READY_Msk (0x1UL << COMP_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define COMP_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: COMP_RESULT */ +/* Description: Compare result */ + +/* Bit 0 : Result of last compare. Decision point SAMPLE task. */ +#define COMP_RESULT_RESULT_Pos (0UL) /*!< Position of RESULT field. */ +#define COMP_RESULT_RESULT_Msk (0x1UL << COMP_RESULT_RESULT_Pos) /*!< Bit mask of RESULT field. */ +#define COMP_RESULT_RESULT_Below (0UL) /*!< Input voltage is below the threshold (VIN+ < VIN-) */ +#define COMP_RESULT_RESULT_Above (1UL) /*!< Input voltage is above the threshold (VIN+ > VIN-) */ + +/* Register: COMP_ENABLE */ +/* Description: COMP enable */ + +/* Bits 1..0 : Enable or disable COMP */ +#define COMP_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define COMP_ENABLE_ENABLE_Msk (0x3UL << COMP_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define COMP_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define COMP_ENABLE_ENABLE_Enabled (2UL) /*!< Enable */ + +/* Register: COMP_PSEL */ +/* Description: Pin select */ + +/* Bits 2..0 : Analog pin select */ +#define COMP_PSEL_PSEL_Pos (0UL) /*!< Position of PSEL field. */ +#define COMP_PSEL_PSEL_Msk (0x7UL << COMP_PSEL_PSEL_Pos) /*!< Bit mask of PSEL field. */ +#define COMP_PSEL_PSEL_AnalogInput0 (0UL) /*!< AIN0 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput1 (1UL) /*!< AIN1 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput2 (2UL) /*!< AIN2 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput3 (3UL) /*!< AIN3 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput4 (4UL) /*!< AIN4 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput5 (5UL) /*!< AIN5 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput6 (6UL) /*!< AIN6 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput7 (7UL) /*!< AIN7 selected as analog input */ + +/* Register: COMP_REFSEL */ +/* Description: Reference source select */ + +/* Bits 2..0 : Reference select */ +#define COMP_REFSEL_REFSEL_Pos (0UL) /*!< Position of REFSEL field. */ +#define COMP_REFSEL_REFSEL_Msk (0x7UL << COMP_REFSEL_REFSEL_Pos) /*!< Bit mask of REFSEL field. */ +#define COMP_REFSEL_REFSEL_Int1V2 (0UL) /*!< VREF = internal 1.2 V reference (VDD >= 1.7 V) */ +#define COMP_REFSEL_REFSEL_Int1V8 (1UL) /*!< VREF = internal 1.8 V reference (VDD >= VREF + 0.2 V) */ +#define COMP_REFSEL_REFSEL_Int2V4 (2UL) /*!< VREF = internal 2.4 V reference (VDD >= VREF + 0.2 V) */ +#define COMP_REFSEL_REFSEL_VDD (4UL) /*!< VREF = VDD */ +#define COMP_REFSEL_REFSEL_ARef (7UL) /*!< VREF = AREF (VDD >= VREF >= AREFMIN) */ + +/* Register: COMP_EXTREFSEL */ +/* Description: External reference select */ + +/* Bit 0 : External analog reference select */ +#define COMP_EXTREFSEL_EXTREFSEL_Pos (0UL) /*!< Position of EXTREFSEL field. */ +#define COMP_EXTREFSEL_EXTREFSEL_Msk (0x1UL << COMP_EXTREFSEL_EXTREFSEL_Pos) /*!< Bit mask of EXTREFSEL field. */ +#define COMP_EXTREFSEL_EXTREFSEL_AnalogReference0 (0UL) /*!< Use AIN0 as external analog reference */ +#define COMP_EXTREFSEL_EXTREFSEL_AnalogReference1 (1UL) /*!< Use AIN1 as external analog reference */ + +/* Register: COMP_TH */ +/* Description: Threshold configuration for hysteresis unit */ + +/* Bits 13..8 : VUP = (THUP+1)/64*VREF */ +#define COMP_TH_THUP_Pos (8UL) /*!< Position of THUP field. */ +#define COMP_TH_THUP_Msk (0x3FUL << COMP_TH_THUP_Pos) /*!< Bit mask of THUP field. */ + +/* Bits 5..0 : VDOWN = (THDOWN+1)/64*VREF */ +#define COMP_TH_THDOWN_Pos (0UL) /*!< Position of THDOWN field. */ +#define COMP_TH_THDOWN_Msk (0x3FUL << COMP_TH_THDOWN_Pos) /*!< Bit mask of THDOWN field. */ + +/* Register: COMP_MODE */ +/* Description: Mode configuration */ + +/* Bit 8 : Main operation mode */ +#define COMP_MODE_MAIN_Pos (8UL) /*!< Position of MAIN field. */ +#define COMP_MODE_MAIN_Msk (0x1UL << COMP_MODE_MAIN_Pos) /*!< Bit mask of MAIN field. */ +#define COMP_MODE_MAIN_SE (0UL) /*!< Single ended mode */ +#define COMP_MODE_MAIN_Diff (1UL) /*!< Differential mode */ + +/* Bits 1..0 : Speed and power mode */ +#define COMP_MODE_SP_Pos (0UL) /*!< Position of SP field. */ +#define COMP_MODE_SP_Msk (0x3UL << COMP_MODE_SP_Pos) /*!< Bit mask of SP field. */ +#define COMP_MODE_SP_Low (0UL) /*!< Low power mode */ +#define COMP_MODE_SP_Normal (1UL) /*!< Normal mode */ +#define COMP_MODE_SP_High (2UL) /*!< High speed mode */ + +/* Register: COMP_HYST */ +/* Description: Comparator hysteresis enable */ + +/* Bit 0 : Comparator hysteresis */ +#define COMP_HYST_HYST_Pos (0UL) /*!< Position of HYST field. */ +#define COMP_HYST_HYST_Msk (0x1UL << COMP_HYST_HYST_Pos) /*!< Bit mask of HYST field. */ +#define COMP_HYST_HYST_NoHyst (0UL) /*!< Comparator hysteresis disabled */ +#define COMP_HYST_HYST_Hyst50mV (1UL) /*!< Comparator hysteresis enabled */ + +/* Register: COMP_ISOURCE */ +/* Description: Current source select on analog input */ + +/* Bits 1..0 : Comparator hysteresis */ +#define COMP_ISOURCE_ISOURCE_Pos (0UL) /*!< Position of ISOURCE field. */ +#define COMP_ISOURCE_ISOURCE_Msk (0x3UL << COMP_ISOURCE_ISOURCE_Pos) /*!< Bit mask of ISOURCE field. */ +#define COMP_ISOURCE_ISOURCE_Off (0UL) /*!< Current source disabled */ +#define COMP_ISOURCE_ISOURCE_Ien2mA5 (1UL) /*!< Current source enabled (+/- 2.5 uA) */ +#define COMP_ISOURCE_ISOURCE_Ien5mA (2UL) /*!< Current source enabled (+/- 5 uA) */ +#define COMP_ISOURCE_ISOURCE_Ien10mA (3UL) /*!< Current source enabled (+/- 10 uA) */ + + +/* Peripheral: ECB */ +/* Description: AES ECB Mode Encryption */ + +/* Register: ECB_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 1 : Write '1' to Enable interrupt for ERRORECB event */ +#define ECB_INTENSET_ERRORECB_Pos (1UL) /*!< Position of ERRORECB field. */ +#define ECB_INTENSET_ERRORECB_Msk (0x1UL << ECB_INTENSET_ERRORECB_Pos) /*!< Bit mask of ERRORECB field. */ +#define ECB_INTENSET_ERRORECB_Disabled (0UL) /*!< Read: Disabled */ +#define ECB_INTENSET_ERRORECB_Enabled (1UL) /*!< Read: Enabled */ +#define ECB_INTENSET_ERRORECB_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for ENDECB event */ +#define ECB_INTENSET_ENDECB_Pos (0UL) /*!< Position of ENDECB field. */ +#define ECB_INTENSET_ENDECB_Msk (0x1UL << ECB_INTENSET_ENDECB_Pos) /*!< Bit mask of ENDECB field. */ +#define ECB_INTENSET_ENDECB_Disabled (0UL) /*!< Read: Disabled */ +#define ECB_INTENSET_ENDECB_Enabled (1UL) /*!< Read: Enabled */ +#define ECB_INTENSET_ENDECB_Set (1UL) /*!< Enable */ + +/* Register: ECB_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 1 : Write '1' to Disable interrupt for ERRORECB event */ +#define ECB_INTENCLR_ERRORECB_Pos (1UL) /*!< Position of ERRORECB field. */ +#define ECB_INTENCLR_ERRORECB_Msk (0x1UL << ECB_INTENCLR_ERRORECB_Pos) /*!< Bit mask of ERRORECB field. */ +#define ECB_INTENCLR_ERRORECB_Disabled (0UL) /*!< Read: Disabled */ +#define ECB_INTENCLR_ERRORECB_Enabled (1UL) /*!< Read: Enabled */ +#define ECB_INTENCLR_ERRORECB_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for ENDECB event */ +#define ECB_INTENCLR_ENDECB_Pos (0UL) /*!< Position of ENDECB field. */ +#define ECB_INTENCLR_ENDECB_Msk (0x1UL << ECB_INTENCLR_ENDECB_Pos) /*!< Bit mask of ENDECB field. */ +#define ECB_INTENCLR_ENDECB_Disabled (0UL) /*!< Read: Disabled */ +#define ECB_INTENCLR_ENDECB_Enabled (1UL) /*!< Read: Enabled */ +#define ECB_INTENCLR_ENDECB_Clear (1UL) /*!< Disable */ + +/* Register: ECB_ECBDATAPTR */ +/* Description: ECB block encrypt memory pointers */ + +/* Bits 31..0 : Pointer to the ECB data structure (see Table 1 ECB data structure overview) */ +#define ECB_ECBDATAPTR_ECBDATAPTR_Pos (0UL) /*!< Position of ECBDATAPTR field. */ +#define ECB_ECBDATAPTR_ECBDATAPTR_Msk (0xFFFFFFFFUL << ECB_ECBDATAPTR_ECBDATAPTR_Pos) /*!< Bit mask of ECBDATAPTR field. */ + + +/* Peripheral: EGU */ +/* Description: Event Generator Unit 0 */ + +/* Register: EGU_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 15 : Enable or disable interrupt for TRIGGERED[15] event */ +#define EGU_INTEN_TRIGGERED15_Pos (15UL) /*!< Position of TRIGGERED15 field. */ +#define EGU_INTEN_TRIGGERED15_Msk (0x1UL << EGU_INTEN_TRIGGERED15_Pos) /*!< Bit mask of TRIGGERED15 field. */ +#define EGU_INTEN_TRIGGERED15_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED15_Enabled (1UL) /*!< Enable */ + +/* Bit 14 : Enable or disable interrupt for TRIGGERED[14] event */ +#define EGU_INTEN_TRIGGERED14_Pos (14UL) /*!< Position of TRIGGERED14 field. */ +#define EGU_INTEN_TRIGGERED14_Msk (0x1UL << EGU_INTEN_TRIGGERED14_Pos) /*!< Bit mask of TRIGGERED14 field. */ +#define EGU_INTEN_TRIGGERED14_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED14_Enabled (1UL) /*!< Enable */ + +/* Bit 13 : Enable or disable interrupt for TRIGGERED[13] event */ +#define EGU_INTEN_TRIGGERED13_Pos (13UL) /*!< Position of TRIGGERED13 field. */ +#define EGU_INTEN_TRIGGERED13_Msk (0x1UL << EGU_INTEN_TRIGGERED13_Pos) /*!< Bit mask of TRIGGERED13 field. */ +#define EGU_INTEN_TRIGGERED13_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED13_Enabled (1UL) /*!< Enable */ + +/* Bit 12 : Enable or disable interrupt for TRIGGERED[12] event */ +#define EGU_INTEN_TRIGGERED12_Pos (12UL) /*!< Position of TRIGGERED12 field. */ +#define EGU_INTEN_TRIGGERED12_Msk (0x1UL << EGU_INTEN_TRIGGERED12_Pos) /*!< Bit mask of TRIGGERED12 field. */ +#define EGU_INTEN_TRIGGERED12_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED12_Enabled (1UL) /*!< Enable */ + +/* Bit 11 : Enable or disable interrupt for TRIGGERED[11] event */ +#define EGU_INTEN_TRIGGERED11_Pos (11UL) /*!< Position of TRIGGERED11 field. */ +#define EGU_INTEN_TRIGGERED11_Msk (0x1UL << EGU_INTEN_TRIGGERED11_Pos) /*!< Bit mask of TRIGGERED11 field. */ +#define EGU_INTEN_TRIGGERED11_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED11_Enabled (1UL) /*!< Enable */ + +/* Bit 10 : Enable or disable interrupt for TRIGGERED[10] event */ +#define EGU_INTEN_TRIGGERED10_Pos (10UL) /*!< Position of TRIGGERED10 field. */ +#define EGU_INTEN_TRIGGERED10_Msk (0x1UL << EGU_INTEN_TRIGGERED10_Pos) /*!< Bit mask of TRIGGERED10 field. */ +#define EGU_INTEN_TRIGGERED10_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED10_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for TRIGGERED[9] event */ +#define EGU_INTEN_TRIGGERED9_Pos (9UL) /*!< Position of TRIGGERED9 field. */ +#define EGU_INTEN_TRIGGERED9_Msk (0x1UL << EGU_INTEN_TRIGGERED9_Pos) /*!< Bit mask of TRIGGERED9 field. */ +#define EGU_INTEN_TRIGGERED9_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED9_Enabled (1UL) /*!< Enable */ + +/* Bit 8 : Enable or disable interrupt for TRIGGERED[8] event */ +#define EGU_INTEN_TRIGGERED8_Pos (8UL) /*!< Position of TRIGGERED8 field. */ +#define EGU_INTEN_TRIGGERED8_Msk (0x1UL << EGU_INTEN_TRIGGERED8_Pos) /*!< Bit mask of TRIGGERED8 field. */ +#define EGU_INTEN_TRIGGERED8_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED8_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for TRIGGERED[7] event */ +#define EGU_INTEN_TRIGGERED7_Pos (7UL) /*!< Position of TRIGGERED7 field. */ +#define EGU_INTEN_TRIGGERED7_Msk (0x1UL << EGU_INTEN_TRIGGERED7_Pos) /*!< Bit mask of TRIGGERED7 field. */ +#define EGU_INTEN_TRIGGERED7_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED7_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for TRIGGERED[6] event */ +#define EGU_INTEN_TRIGGERED6_Pos (6UL) /*!< Position of TRIGGERED6 field. */ +#define EGU_INTEN_TRIGGERED6_Msk (0x1UL << EGU_INTEN_TRIGGERED6_Pos) /*!< Bit mask of TRIGGERED6 field. */ +#define EGU_INTEN_TRIGGERED6_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED6_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for TRIGGERED[5] event */ +#define EGU_INTEN_TRIGGERED5_Pos (5UL) /*!< Position of TRIGGERED5 field. */ +#define EGU_INTEN_TRIGGERED5_Msk (0x1UL << EGU_INTEN_TRIGGERED5_Pos) /*!< Bit mask of TRIGGERED5 field. */ +#define EGU_INTEN_TRIGGERED5_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED5_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for TRIGGERED[4] event */ +#define EGU_INTEN_TRIGGERED4_Pos (4UL) /*!< Position of TRIGGERED4 field. */ +#define EGU_INTEN_TRIGGERED4_Msk (0x1UL << EGU_INTEN_TRIGGERED4_Pos) /*!< Bit mask of TRIGGERED4 field. */ +#define EGU_INTEN_TRIGGERED4_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED4_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for TRIGGERED[3] event */ +#define EGU_INTEN_TRIGGERED3_Pos (3UL) /*!< Position of TRIGGERED3 field. */ +#define EGU_INTEN_TRIGGERED3_Msk (0x1UL << EGU_INTEN_TRIGGERED3_Pos) /*!< Bit mask of TRIGGERED3 field. */ +#define EGU_INTEN_TRIGGERED3_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED3_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for TRIGGERED[2] event */ +#define EGU_INTEN_TRIGGERED2_Pos (2UL) /*!< Position of TRIGGERED2 field. */ +#define EGU_INTEN_TRIGGERED2_Msk (0x1UL << EGU_INTEN_TRIGGERED2_Pos) /*!< Bit mask of TRIGGERED2 field. */ +#define EGU_INTEN_TRIGGERED2_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED2_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for TRIGGERED[1] event */ +#define EGU_INTEN_TRIGGERED1_Pos (1UL) /*!< Position of TRIGGERED1 field. */ +#define EGU_INTEN_TRIGGERED1_Msk (0x1UL << EGU_INTEN_TRIGGERED1_Pos) /*!< Bit mask of TRIGGERED1 field. */ +#define EGU_INTEN_TRIGGERED1_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED1_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for TRIGGERED[0] event */ +#define EGU_INTEN_TRIGGERED0_Pos (0UL) /*!< Position of TRIGGERED0 field. */ +#define EGU_INTEN_TRIGGERED0_Msk (0x1UL << EGU_INTEN_TRIGGERED0_Pos) /*!< Bit mask of TRIGGERED0 field. */ +#define EGU_INTEN_TRIGGERED0_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED0_Enabled (1UL) /*!< Enable */ + +/* Register: EGU_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 15 : Write '1' to Enable interrupt for TRIGGERED[15] event */ +#define EGU_INTENSET_TRIGGERED15_Pos (15UL) /*!< Position of TRIGGERED15 field. */ +#define EGU_INTENSET_TRIGGERED15_Msk (0x1UL << EGU_INTENSET_TRIGGERED15_Pos) /*!< Bit mask of TRIGGERED15 field. */ +#define EGU_INTENSET_TRIGGERED15_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED15_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED15_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for TRIGGERED[14] event */ +#define EGU_INTENSET_TRIGGERED14_Pos (14UL) /*!< Position of TRIGGERED14 field. */ +#define EGU_INTENSET_TRIGGERED14_Msk (0x1UL << EGU_INTENSET_TRIGGERED14_Pos) /*!< Bit mask of TRIGGERED14 field. */ +#define EGU_INTENSET_TRIGGERED14_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED14_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED14_Set (1UL) /*!< Enable */ + +/* Bit 13 : Write '1' to Enable interrupt for TRIGGERED[13] event */ +#define EGU_INTENSET_TRIGGERED13_Pos (13UL) /*!< Position of TRIGGERED13 field. */ +#define EGU_INTENSET_TRIGGERED13_Msk (0x1UL << EGU_INTENSET_TRIGGERED13_Pos) /*!< Bit mask of TRIGGERED13 field. */ +#define EGU_INTENSET_TRIGGERED13_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED13_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED13_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for TRIGGERED[12] event */ +#define EGU_INTENSET_TRIGGERED12_Pos (12UL) /*!< Position of TRIGGERED12 field. */ +#define EGU_INTENSET_TRIGGERED12_Msk (0x1UL << EGU_INTENSET_TRIGGERED12_Pos) /*!< Bit mask of TRIGGERED12 field. */ +#define EGU_INTENSET_TRIGGERED12_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED12_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED12_Set (1UL) /*!< Enable */ + +/* Bit 11 : Write '1' to Enable interrupt for TRIGGERED[11] event */ +#define EGU_INTENSET_TRIGGERED11_Pos (11UL) /*!< Position of TRIGGERED11 field. */ +#define EGU_INTENSET_TRIGGERED11_Msk (0x1UL << EGU_INTENSET_TRIGGERED11_Pos) /*!< Bit mask of TRIGGERED11 field. */ +#define EGU_INTENSET_TRIGGERED11_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED11_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED11_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for TRIGGERED[10] event */ +#define EGU_INTENSET_TRIGGERED10_Pos (10UL) /*!< Position of TRIGGERED10 field. */ +#define EGU_INTENSET_TRIGGERED10_Msk (0x1UL << EGU_INTENSET_TRIGGERED10_Pos) /*!< Bit mask of TRIGGERED10 field. */ +#define EGU_INTENSET_TRIGGERED10_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED10_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED10_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for TRIGGERED[9] event */ +#define EGU_INTENSET_TRIGGERED9_Pos (9UL) /*!< Position of TRIGGERED9 field. */ +#define EGU_INTENSET_TRIGGERED9_Msk (0x1UL << EGU_INTENSET_TRIGGERED9_Pos) /*!< Bit mask of TRIGGERED9 field. */ +#define EGU_INTENSET_TRIGGERED9_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED9_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED9_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for TRIGGERED[8] event */ +#define EGU_INTENSET_TRIGGERED8_Pos (8UL) /*!< Position of TRIGGERED8 field. */ +#define EGU_INTENSET_TRIGGERED8_Msk (0x1UL << EGU_INTENSET_TRIGGERED8_Pos) /*!< Bit mask of TRIGGERED8 field. */ +#define EGU_INTENSET_TRIGGERED8_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED8_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED8_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for TRIGGERED[7] event */ +#define EGU_INTENSET_TRIGGERED7_Pos (7UL) /*!< Position of TRIGGERED7 field. */ +#define EGU_INTENSET_TRIGGERED7_Msk (0x1UL << EGU_INTENSET_TRIGGERED7_Pos) /*!< Bit mask of TRIGGERED7 field. */ +#define EGU_INTENSET_TRIGGERED7_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED7_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED7_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for TRIGGERED[6] event */ +#define EGU_INTENSET_TRIGGERED6_Pos (6UL) /*!< Position of TRIGGERED6 field. */ +#define EGU_INTENSET_TRIGGERED6_Msk (0x1UL << EGU_INTENSET_TRIGGERED6_Pos) /*!< Bit mask of TRIGGERED6 field. */ +#define EGU_INTENSET_TRIGGERED6_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED6_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED6_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for TRIGGERED[5] event */ +#define EGU_INTENSET_TRIGGERED5_Pos (5UL) /*!< Position of TRIGGERED5 field. */ +#define EGU_INTENSET_TRIGGERED5_Msk (0x1UL << EGU_INTENSET_TRIGGERED5_Pos) /*!< Bit mask of TRIGGERED5 field. */ +#define EGU_INTENSET_TRIGGERED5_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED5_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED5_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for TRIGGERED[4] event */ +#define EGU_INTENSET_TRIGGERED4_Pos (4UL) /*!< Position of TRIGGERED4 field. */ +#define EGU_INTENSET_TRIGGERED4_Msk (0x1UL << EGU_INTENSET_TRIGGERED4_Pos) /*!< Bit mask of TRIGGERED4 field. */ +#define EGU_INTENSET_TRIGGERED4_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED4_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED4_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for TRIGGERED[3] event */ +#define EGU_INTENSET_TRIGGERED3_Pos (3UL) /*!< Position of TRIGGERED3 field. */ +#define EGU_INTENSET_TRIGGERED3_Msk (0x1UL << EGU_INTENSET_TRIGGERED3_Pos) /*!< Bit mask of TRIGGERED3 field. */ +#define EGU_INTENSET_TRIGGERED3_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED3_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED3_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for TRIGGERED[2] event */ +#define EGU_INTENSET_TRIGGERED2_Pos (2UL) /*!< Position of TRIGGERED2 field. */ +#define EGU_INTENSET_TRIGGERED2_Msk (0x1UL << EGU_INTENSET_TRIGGERED2_Pos) /*!< Bit mask of TRIGGERED2 field. */ +#define EGU_INTENSET_TRIGGERED2_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED2_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED2_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for TRIGGERED[1] event */ +#define EGU_INTENSET_TRIGGERED1_Pos (1UL) /*!< Position of TRIGGERED1 field. */ +#define EGU_INTENSET_TRIGGERED1_Msk (0x1UL << EGU_INTENSET_TRIGGERED1_Pos) /*!< Bit mask of TRIGGERED1 field. */ +#define EGU_INTENSET_TRIGGERED1_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED1_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED1_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for TRIGGERED[0] event */ +#define EGU_INTENSET_TRIGGERED0_Pos (0UL) /*!< Position of TRIGGERED0 field. */ +#define EGU_INTENSET_TRIGGERED0_Msk (0x1UL << EGU_INTENSET_TRIGGERED0_Pos) /*!< Bit mask of TRIGGERED0 field. */ +#define EGU_INTENSET_TRIGGERED0_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED0_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED0_Set (1UL) /*!< Enable */ + +/* Register: EGU_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 15 : Write '1' to Disable interrupt for TRIGGERED[15] event */ +#define EGU_INTENCLR_TRIGGERED15_Pos (15UL) /*!< Position of TRIGGERED15 field. */ +#define EGU_INTENCLR_TRIGGERED15_Msk (0x1UL << EGU_INTENCLR_TRIGGERED15_Pos) /*!< Bit mask of TRIGGERED15 field. */ +#define EGU_INTENCLR_TRIGGERED15_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED15_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED15_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for TRIGGERED[14] event */ +#define EGU_INTENCLR_TRIGGERED14_Pos (14UL) /*!< Position of TRIGGERED14 field. */ +#define EGU_INTENCLR_TRIGGERED14_Msk (0x1UL << EGU_INTENCLR_TRIGGERED14_Pos) /*!< Bit mask of TRIGGERED14 field. */ +#define EGU_INTENCLR_TRIGGERED14_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED14_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED14_Clear (1UL) /*!< Disable */ + +/* Bit 13 : Write '1' to Disable interrupt for TRIGGERED[13] event */ +#define EGU_INTENCLR_TRIGGERED13_Pos (13UL) /*!< Position of TRIGGERED13 field. */ +#define EGU_INTENCLR_TRIGGERED13_Msk (0x1UL << EGU_INTENCLR_TRIGGERED13_Pos) /*!< Bit mask of TRIGGERED13 field. */ +#define EGU_INTENCLR_TRIGGERED13_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED13_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED13_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for TRIGGERED[12] event */ +#define EGU_INTENCLR_TRIGGERED12_Pos (12UL) /*!< Position of TRIGGERED12 field. */ +#define EGU_INTENCLR_TRIGGERED12_Msk (0x1UL << EGU_INTENCLR_TRIGGERED12_Pos) /*!< Bit mask of TRIGGERED12 field. */ +#define EGU_INTENCLR_TRIGGERED12_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED12_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED12_Clear (1UL) /*!< Disable */ + +/* Bit 11 : Write '1' to Disable interrupt for TRIGGERED[11] event */ +#define EGU_INTENCLR_TRIGGERED11_Pos (11UL) /*!< Position of TRIGGERED11 field. */ +#define EGU_INTENCLR_TRIGGERED11_Msk (0x1UL << EGU_INTENCLR_TRIGGERED11_Pos) /*!< Bit mask of TRIGGERED11 field. */ +#define EGU_INTENCLR_TRIGGERED11_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED11_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED11_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for TRIGGERED[10] event */ +#define EGU_INTENCLR_TRIGGERED10_Pos (10UL) /*!< Position of TRIGGERED10 field. */ +#define EGU_INTENCLR_TRIGGERED10_Msk (0x1UL << EGU_INTENCLR_TRIGGERED10_Pos) /*!< Bit mask of TRIGGERED10 field. */ +#define EGU_INTENCLR_TRIGGERED10_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED10_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED10_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for TRIGGERED[9] event */ +#define EGU_INTENCLR_TRIGGERED9_Pos (9UL) /*!< Position of TRIGGERED9 field. */ +#define EGU_INTENCLR_TRIGGERED9_Msk (0x1UL << EGU_INTENCLR_TRIGGERED9_Pos) /*!< Bit mask of TRIGGERED9 field. */ +#define EGU_INTENCLR_TRIGGERED9_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED9_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED9_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for TRIGGERED[8] event */ +#define EGU_INTENCLR_TRIGGERED8_Pos (8UL) /*!< Position of TRIGGERED8 field. */ +#define EGU_INTENCLR_TRIGGERED8_Msk (0x1UL << EGU_INTENCLR_TRIGGERED8_Pos) /*!< Bit mask of TRIGGERED8 field. */ +#define EGU_INTENCLR_TRIGGERED8_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED8_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED8_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for TRIGGERED[7] event */ +#define EGU_INTENCLR_TRIGGERED7_Pos (7UL) /*!< Position of TRIGGERED7 field. */ +#define EGU_INTENCLR_TRIGGERED7_Msk (0x1UL << EGU_INTENCLR_TRIGGERED7_Pos) /*!< Bit mask of TRIGGERED7 field. */ +#define EGU_INTENCLR_TRIGGERED7_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED7_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED7_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for TRIGGERED[6] event */ +#define EGU_INTENCLR_TRIGGERED6_Pos (6UL) /*!< Position of TRIGGERED6 field. */ +#define EGU_INTENCLR_TRIGGERED6_Msk (0x1UL << EGU_INTENCLR_TRIGGERED6_Pos) /*!< Bit mask of TRIGGERED6 field. */ +#define EGU_INTENCLR_TRIGGERED6_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED6_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED6_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for TRIGGERED[5] event */ +#define EGU_INTENCLR_TRIGGERED5_Pos (5UL) /*!< Position of TRIGGERED5 field. */ +#define EGU_INTENCLR_TRIGGERED5_Msk (0x1UL << EGU_INTENCLR_TRIGGERED5_Pos) /*!< Bit mask of TRIGGERED5 field. */ +#define EGU_INTENCLR_TRIGGERED5_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED5_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED5_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for TRIGGERED[4] event */ +#define EGU_INTENCLR_TRIGGERED4_Pos (4UL) /*!< Position of TRIGGERED4 field. */ +#define EGU_INTENCLR_TRIGGERED4_Msk (0x1UL << EGU_INTENCLR_TRIGGERED4_Pos) /*!< Bit mask of TRIGGERED4 field. */ +#define EGU_INTENCLR_TRIGGERED4_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED4_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED4_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for TRIGGERED[3] event */ +#define EGU_INTENCLR_TRIGGERED3_Pos (3UL) /*!< Position of TRIGGERED3 field. */ +#define EGU_INTENCLR_TRIGGERED3_Msk (0x1UL << EGU_INTENCLR_TRIGGERED3_Pos) /*!< Bit mask of TRIGGERED3 field. */ +#define EGU_INTENCLR_TRIGGERED3_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED3_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED3_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for TRIGGERED[2] event */ +#define EGU_INTENCLR_TRIGGERED2_Pos (2UL) /*!< Position of TRIGGERED2 field. */ +#define EGU_INTENCLR_TRIGGERED2_Msk (0x1UL << EGU_INTENCLR_TRIGGERED2_Pos) /*!< Bit mask of TRIGGERED2 field. */ +#define EGU_INTENCLR_TRIGGERED2_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED2_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED2_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for TRIGGERED[1] event */ +#define EGU_INTENCLR_TRIGGERED1_Pos (1UL) /*!< Position of TRIGGERED1 field. */ +#define EGU_INTENCLR_TRIGGERED1_Msk (0x1UL << EGU_INTENCLR_TRIGGERED1_Pos) /*!< Bit mask of TRIGGERED1 field. */ +#define EGU_INTENCLR_TRIGGERED1_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED1_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED1_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for TRIGGERED[0] event */ +#define EGU_INTENCLR_TRIGGERED0_Pos (0UL) /*!< Position of TRIGGERED0 field. */ +#define EGU_INTENCLR_TRIGGERED0_Msk (0x1UL << EGU_INTENCLR_TRIGGERED0_Pos) /*!< Bit mask of TRIGGERED0 field. */ +#define EGU_INTENCLR_TRIGGERED0_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED0_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED0_Clear (1UL) /*!< Disable */ + + +/* Peripheral: FICR */ +/* Description: Factory Information Configuration Registers */ + +/* Register: FICR_CODEPAGESIZE */ +/* Description: Code memory page size */ + +/* Bits 31..0 : Code memory page size */ +#define FICR_CODEPAGESIZE_CODEPAGESIZE_Pos (0UL) /*!< Position of CODEPAGESIZE field. */ +#define FICR_CODEPAGESIZE_CODEPAGESIZE_Msk (0xFFFFFFFFUL << FICR_CODEPAGESIZE_CODEPAGESIZE_Pos) /*!< Bit mask of CODEPAGESIZE field. */ + +/* Register: FICR_CODESIZE */ +/* Description: Code memory size */ + +/* Bits 31..0 : Code memory size in number of pages */ +#define FICR_CODESIZE_CODESIZE_Pos (0UL) /*!< Position of CODESIZE field. */ +#define FICR_CODESIZE_CODESIZE_Msk (0xFFFFFFFFUL << FICR_CODESIZE_CODESIZE_Pos) /*!< Bit mask of CODESIZE field. */ + +/* Register: FICR_DEVICEID */ +/* Description: Description collection[0]: Device identifier */ + +/* Bits 31..0 : 64 bit unique device identifier */ +#define FICR_DEVICEID_DEVICEID_Pos (0UL) /*!< Position of DEVICEID field. */ +#define FICR_DEVICEID_DEVICEID_Msk (0xFFFFFFFFUL << FICR_DEVICEID_DEVICEID_Pos) /*!< Bit mask of DEVICEID field. */ + +/* Register: FICR_ER */ +/* Description: Description collection[0]: Encryption Root, word 0 */ + +/* Bits 31..0 : Encryption Root, word n */ +#define FICR_ER_ER_Pos (0UL) /*!< Position of ER field. */ +#define FICR_ER_ER_Msk (0xFFFFFFFFUL << FICR_ER_ER_Pos) /*!< Bit mask of ER field. */ + +/* Register: FICR_IR */ +/* Description: Description collection[0]: Identity Root, word 0 */ + +/* Bits 31..0 : Identity Root, word n */ +#define FICR_IR_IR_Pos (0UL) /*!< Position of IR field. */ +#define FICR_IR_IR_Msk (0xFFFFFFFFUL << FICR_IR_IR_Pos) /*!< Bit mask of IR field. */ + +/* Register: FICR_DEVICEADDRTYPE */ +/* Description: Device address type */ + +/* Bit 0 : Device address type */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Pos (0UL) /*!< Position of DEVICEADDRTYPE field. */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Msk (0x1UL << FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Pos) /*!< Bit mask of DEVICEADDRTYPE field. */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Public (0UL) /*!< Public address */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Random (1UL) /*!< Random address */ + +/* Register: FICR_DEVICEADDR */ +/* Description: Description collection[0]: Device address 0 */ + +/* Bits 31..0 : 48 bit device address */ +#define FICR_DEVICEADDR_DEVICEADDR_Pos (0UL) /*!< Position of DEVICEADDR field. */ +#define FICR_DEVICEADDR_DEVICEADDR_Msk (0xFFFFFFFFUL << FICR_DEVICEADDR_DEVICEADDR_Pos) /*!< Bit mask of DEVICEADDR field. */ + +/* Register: FICR_INFO_PART */ +/* Description: Part code */ + +/* Bits 31..0 : Part code */ +#define FICR_INFO_PART_PART_Pos (0UL) /*!< Position of PART field. */ +#define FICR_INFO_PART_PART_Msk (0xFFFFFFFFUL << FICR_INFO_PART_PART_Pos) /*!< Bit mask of PART field. */ +#define FICR_INFO_PART_PART_N52832 (0x52832UL) /*!< nRF52832 */ +#define FICR_INFO_PART_PART_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_INFO_VARIANT */ +/* Description: Part Variant, Hardware version and Production configuration */ + +/* Bits 31..0 : Part Variant, Hardware version and Production configuration, encoded as ASCII */ +#define FICR_INFO_VARIANT_VARIANT_Pos (0UL) /*!< Position of VARIANT field. */ +#define FICR_INFO_VARIANT_VARIANT_Msk (0xFFFFFFFFUL << FICR_INFO_VARIANT_VARIANT_Pos) /*!< Bit mask of VARIANT field. */ +#define FICR_INFO_VARIANT_VARIANT_AAAA (0x41414141UL) /*!< AAAA */ +#define FICR_INFO_VARIANT_VARIANT_AAAB (0x41414142UL) /*!< AAAB */ +#define FICR_INFO_VARIANT_VARIANT_AABA (0x41414241UL) /*!< AABA */ +#define FICR_INFO_VARIANT_VARIANT_AABB (0x41414242UL) /*!< AABB */ +#define FICR_INFO_VARIANT_VARIANT_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_INFO_PACKAGE */ +/* Description: Package option */ + +/* Bits 31..0 : Package option */ +#define FICR_INFO_PACKAGE_PACKAGE_Pos (0UL) /*!< Position of PACKAGE field. */ +#define FICR_INFO_PACKAGE_PACKAGE_Msk (0xFFFFFFFFUL << FICR_INFO_PACKAGE_PACKAGE_Pos) /*!< Bit mask of PACKAGE field. */ +#define FICR_INFO_PACKAGE_PACKAGE_QF (0x2000UL) /*!< QFxx - 48-pin QFN */ +#define FICR_INFO_PACKAGE_PACKAGE_CH (0x2001UL) /*!< CHxx - 7x8 WLCSP 56 balls */ +#define FICR_INFO_PACKAGE_PACKAGE_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_INFO_RAM */ +/* Description: RAM variant */ + +/* Bits 31..0 : RAM variant */ +#define FICR_INFO_RAM_RAM_Pos (0UL) /*!< Position of RAM field. */ +#define FICR_INFO_RAM_RAM_Msk (0xFFFFFFFFUL << FICR_INFO_RAM_RAM_Pos) /*!< Bit mask of RAM field. */ +#define FICR_INFO_RAM_RAM_K16 (0x10UL) /*!< 16 kByte RAM */ +#define FICR_INFO_RAM_RAM_K32 (0x20UL) /*!< 32 kByte RAM */ +#define FICR_INFO_RAM_RAM_K64 (0x40UL) /*!< 64 kByte RAM */ +#define FICR_INFO_RAM_RAM_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_INFO_FLASH */ +/* Description: Flash variant */ + +/* Bits 31..0 : Flash variant */ +#define FICR_INFO_FLASH_FLASH_Pos (0UL) /*!< Position of FLASH field. */ +#define FICR_INFO_FLASH_FLASH_Msk (0xFFFFFFFFUL << FICR_INFO_FLASH_FLASH_Pos) /*!< Bit mask of FLASH field. */ +#define FICR_INFO_FLASH_FLASH_K128 (0x80UL) /*!< 128 kByte FLASH */ +#define FICR_INFO_FLASH_FLASH_K256 (0x100UL) /*!< 256 kByte FLASH */ +#define FICR_INFO_FLASH_FLASH_K512 (0x200UL) /*!< 512 kByte FLASH */ +#define FICR_INFO_FLASH_FLASH_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_TEMP_A0 */ +/* Description: Slope definition A0. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A0_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A0_A_Msk (0xFFFUL << FICR_TEMP_A0_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A1 */ +/* Description: Slope definition A1. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A1_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A1_A_Msk (0xFFFUL << FICR_TEMP_A1_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A2 */ +/* Description: Slope definition A2. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A2_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A2_A_Msk (0xFFFUL << FICR_TEMP_A2_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A3 */ +/* Description: Slope definition A3. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A3_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A3_A_Msk (0xFFFUL << FICR_TEMP_A3_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A4 */ +/* Description: Slope definition A4. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A4_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A4_A_Msk (0xFFFUL << FICR_TEMP_A4_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A5 */ +/* Description: Slope definition A5. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A5_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A5_A_Msk (0xFFFUL << FICR_TEMP_A5_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_B0 */ +/* Description: y-intercept B0. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B0_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B0_B_Msk (0x3FFFUL << FICR_TEMP_B0_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B1 */ +/* Description: y-intercept B1. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B1_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B1_B_Msk (0x3FFFUL << FICR_TEMP_B1_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B2 */ +/* Description: y-intercept B2. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B2_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B2_B_Msk (0x3FFFUL << FICR_TEMP_B2_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B3 */ +/* Description: y-intercept B3. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B3_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B3_B_Msk (0x3FFFUL << FICR_TEMP_B3_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B4 */ +/* Description: y-intercept B4. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B4_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B4_B_Msk (0x3FFFUL << FICR_TEMP_B4_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B5 */ +/* Description: y-intercept B5. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B5_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B5_B_Msk (0x3FFFUL << FICR_TEMP_B5_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_T0 */ +/* Description: Segment end T0. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T0_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T0_T_Msk (0xFFUL << FICR_TEMP_T0_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_TEMP_T1 */ +/* Description: Segment end T1. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T1_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T1_T_Msk (0xFFUL << FICR_TEMP_T1_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_TEMP_T2 */ +/* Description: Segment end T2. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T2_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T2_T_Msk (0xFFUL << FICR_TEMP_T2_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_TEMP_T3 */ +/* Description: Segment end T3. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T3_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T3_T_Msk (0xFFUL << FICR_TEMP_T3_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_TEMP_T4 */ +/* Description: Segment end T4. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T4_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T4_T_Msk (0xFFUL << FICR_TEMP_T4_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_NFC_TAGHEADER0 */ +/* Description: Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + +/* Bits 31..24 : Unique identifier byte 3 */ +#define FICR_NFC_TAGHEADER0_UD3_Pos (24UL) /*!< Position of UD3 field. */ +#define FICR_NFC_TAGHEADER0_UD3_Msk (0xFFUL << FICR_NFC_TAGHEADER0_UD3_Pos) /*!< Bit mask of UD3 field. */ + +/* Bits 23..16 : Unique identifier byte 2 */ +#define FICR_NFC_TAGHEADER0_UD2_Pos (16UL) /*!< Position of UD2 field. */ +#define FICR_NFC_TAGHEADER0_UD2_Msk (0xFFUL << FICR_NFC_TAGHEADER0_UD2_Pos) /*!< Bit mask of UD2 field. */ + +/* Bits 15..8 : Unique identifier byte 1 */ +#define FICR_NFC_TAGHEADER0_UD1_Pos (8UL) /*!< Position of UD1 field. */ +#define FICR_NFC_TAGHEADER0_UD1_Msk (0xFFUL << FICR_NFC_TAGHEADER0_UD1_Pos) /*!< Bit mask of UD1 field. */ + +/* Bits 7..0 : Default Manufacturer ID: Nordic Semiconductor ASA has ICM 0x5F */ +#define FICR_NFC_TAGHEADER0_MFGID_Pos (0UL) /*!< Position of MFGID field. */ +#define FICR_NFC_TAGHEADER0_MFGID_Msk (0xFFUL << FICR_NFC_TAGHEADER0_MFGID_Pos) /*!< Bit mask of MFGID field. */ + +/* Register: FICR_NFC_TAGHEADER1 */ +/* Description: Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + +/* Bits 31..24 : Unique identifier byte 7 */ +#define FICR_NFC_TAGHEADER1_UD7_Pos (24UL) /*!< Position of UD7 field. */ +#define FICR_NFC_TAGHEADER1_UD7_Msk (0xFFUL << FICR_NFC_TAGHEADER1_UD7_Pos) /*!< Bit mask of UD7 field. */ + +/* Bits 23..16 : Unique identifier byte 6 */ +#define FICR_NFC_TAGHEADER1_UD6_Pos (16UL) /*!< Position of UD6 field. */ +#define FICR_NFC_TAGHEADER1_UD6_Msk (0xFFUL << FICR_NFC_TAGHEADER1_UD6_Pos) /*!< Bit mask of UD6 field. */ + +/* Bits 15..8 : Unique identifier byte 5 */ +#define FICR_NFC_TAGHEADER1_UD5_Pos (8UL) /*!< Position of UD5 field. */ +#define FICR_NFC_TAGHEADER1_UD5_Msk (0xFFUL << FICR_NFC_TAGHEADER1_UD5_Pos) /*!< Bit mask of UD5 field. */ + +/* Bits 7..0 : Unique identifier byte 4 */ +#define FICR_NFC_TAGHEADER1_UD4_Pos (0UL) /*!< Position of UD4 field. */ +#define FICR_NFC_TAGHEADER1_UD4_Msk (0xFFUL << FICR_NFC_TAGHEADER1_UD4_Pos) /*!< Bit mask of UD4 field. */ + +/* Register: FICR_NFC_TAGHEADER2 */ +/* Description: Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + +/* Bits 31..24 : Unique identifier byte 11 */ +#define FICR_NFC_TAGHEADER2_UD11_Pos (24UL) /*!< Position of UD11 field. */ +#define FICR_NFC_TAGHEADER2_UD11_Msk (0xFFUL << FICR_NFC_TAGHEADER2_UD11_Pos) /*!< Bit mask of UD11 field. */ + +/* Bits 23..16 : Unique identifier byte 10 */ +#define FICR_NFC_TAGHEADER2_UD10_Pos (16UL) /*!< Position of UD10 field. */ +#define FICR_NFC_TAGHEADER2_UD10_Msk (0xFFUL << FICR_NFC_TAGHEADER2_UD10_Pos) /*!< Bit mask of UD10 field. */ + +/* Bits 15..8 : Unique identifier byte 9 */ +#define FICR_NFC_TAGHEADER2_UD9_Pos (8UL) /*!< Position of UD9 field. */ +#define FICR_NFC_TAGHEADER2_UD9_Msk (0xFFUL << FICR_NFC_TAGHEADER2_UD9_Pos) /*!< Bit mask of UD9 field. */ + +/* Bits 7..0 : Unique identifier byte 8 */ +#define FICR_NFC_TAGHEADER2_UD8_Pos (0UL) /*!< Position of UD8 field. */ +#define FICR_NFC_TAGHEADER2_UD8_Msk (0xFFUL << FICR_NFC_TAGHEADER2_UD8_Pos) /*!< Bit mask of UD8 field. */ + +/* Register: FICR_NFC_TAGHEADER3 */ +/* Description: Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + +/* Bits 31..24 : Unique identifier byte 15 */ +#define FICR_NFC_TAGHEADER3_UD15_Pos (24UL) /*!< Position of UD15 field. */ +#define FICR_NFC_TAGHEADER3_UD15_Msk (0xFFUL << FICR_NFC_TAGHEADER3_UD15_Pos) /*!< Bit mask of UD15 field. */ + +/* Bits 23..16 : Unique identifier byte 14 */ +#define FICR_NFC_TAGHEADER3_UD14_Pos (16UL) /*!< Position of UD14 field. */ +#define FICR_NFC_TAGHEADER3_UD14_Msk (0xFFUL << FICR_NFC_TAGHEADER3_UD14_Pos) /*!< Bit mask of UD14 field. */ + +/* Bits 15..8 : Unique identifier byte 13 */ +#define FICR_NFC_TAGHEADER3_UD13_Pos (8UL) /*!< Position of UD13 field. */ +#define FICR_NFC_TAGHEADER3_UD13_Msk (0xFFUL << FICR_NFC_TAGHEADER3_UD13_Pos) /*!< Bit mask of UD13 field. */ + +/* Bits 7..0 : Unique identifier byte 12 */ +#define FICR_NFC_TAGHEADER3_UD12_Pos (0UL) /*!< Position of UD12 field. */ +#define FICR_NFC_TAGHEADER3_UD12_Msk (0xFFUL << FICR_NFC_TAGHEADER3_UD12_Pos) /*!< Bit mask of UD12 field. */ + + +/* Peripheral: GPIOTE */ +/* Description: GPIO Tasks and Events */ + +/* Register: GPIOTE_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 31 : Write '1' to Enable interrupt for PORT event */ +#define GPIOTE_INTENSET_PORT_Pos (31UL) /*!< Position of PORT field. */ +#define GPIOTE_INTENSET_PORT_Msk (0x1UL << GPIOTE_INTENSET_PORT_Pos) /*!< Bit mask of PORT field. */ +#define GPIOTE_INTENSET_PORT_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_PORT_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_PORT_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for IN[7] event */ +#define GPIOTE_INTENSET_IN7_Pos (7UL) /*!< Position of IN7 field. */ +#define GPIOTE_INTENSET_IN7_Msk (0x1UL << GPIOTE_INTENSET_IN7_Pos) /*!< Bit mask of IN7 field. */ +#define GPIOTE_INTENSET_IN7_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN7_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN7_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for IN[6] event */ +#define GPIOTE_INTENSET_IN6_Pos (6UL) /*!< Position of IN6 field. */ +#define GPIOTE_INTENSET_IN6_Msk (0x1UL << GPIOTE_INTENSET_IN6_Pos) /*!< Bit mask of IN6 field. */ +#define GPIOTE_INTENSET_IN6_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN6_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN6_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for IN[5] event */ +#define GPIOTE_INTENSET_IN5_Pos (5UL) /*!< Position of IN5 field. */ +#define GPIOTE_INTENSET_IN5_Msk (0x1UL << GPIOTE_INTENSET_IN5_Pos) /*!< Bit mask of IN5 field. */ +#define GPIOTE_INTENSET_IN5_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN5_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN5_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for IN[4] event */ +#define GPIOTE_INTENSET_IN4_Pos (4UL) /*!< Position of IN4 field. */ +#define GPIOTE_INTENSET_IN4_Msk (0x1UL << GPIOTE_INTENSET_IN4_Pos) /*!< Bit mask of IN4 field. */ +#define GPIOTE_INTENSET_IN4_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN4_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN4_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for IN[3] event */ +#define GPIOTE_INTENSET_IN3_Pos (3UL) /*!< Position of IN3 field. */ +#define GPIOTE_INTENSET_IN3_Msk (0x1UL << GPIOTE_INTENSET_IN3_Pos) /*!< Bit mask of IN3 field. */ +#define GPIOTE_INTENSET_IN3_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN3_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN3_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for IN[2] event */ +#define GPIOTE_INTENSET_IN2_Pos (2UL) /*!< Position of IN2 field. */ +#define GPIOTE_INTENSET_IN2_Msk (0x1UL << GPIOTE_INTENSET_IN2_Pos) /*!< Bit mask of IN2 field. */ +#define GPIOTE_INTENSET_IN2_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN2_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN2_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for IN[1] event */ +#define GPIOTE_INTENSET_IN1_Pos (1UL) /*!< Position of IN1 field. */ +#define GPIOTE_INTENSET_IN1_Msk (0x1UL << GPIOTE_INTENSET_IN1_Pos) /*!< Bit mask of IN1 field. */ +#define GPIOTE_INTENSET_IN1_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN1_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN1_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for IN[0] event */ +#define GPIOTE_INTENSET_IN0_Pos (0UL) /*!< Position of IN0 field. */ +#define GPIOTE_INTENSET_IN0_Msk (0x1UL << GPIOTE_INTENSET_IN0_Pos) /*!< Bit mask of IN0 field. */ +#define GPIOTE_INTENSET_IN0_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN0_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN0_Set (1UL) /*!< Enable */ + +/* Register: GPIOTE_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 31 : Write '1' to Disable interrupt for PORT event */ +#define GPIOTE_INTENCLR_PORT_Pos (31UL) /*!< Position of PORT field. */ +#define GPIOTE_INTENCLR_PORT_Msk (0x1UL << GPIOTE_INTENCLR_PORT_Pos) /*!< Bit mask of PORT field. */ +#define GPIOTE_INTENCLR_PORT_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_PORT_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_PORT_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for IN[7] event */ +#define GPIOTE_INTENCLR_IN7_Pos (7UL) /*!< Position of IN7 field. */ +#define GPIOTE_INTENCLR_IN7_Msk (0x1UL << GPIOTE_INTENCLR_IN7_Pos) /*!< Bit mask of IN7 field. */ +#define GPIOTE_INTENCLR_IN7_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN7_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN7_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for IN[6] event */ +#define GPIOTE_INTENCLR_IN6_Pos (6UL) /*!< Position of IN6 field. */ +#define GPIOTE_INTENCLR_IN6_Msk (0x1UL << GPIOTE_INTENCLR_IN6_Pos) /*!< Bit mask of IN6 field. */ +#define GPIOTE_INTENCLR_IN6_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN6_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN6_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for IN[5] event */ +#define GPIOTE_INTENCLR_IN5_Pos (5UL) /*!< Position of IN5 field. */ +#define GPIOTE_INTENCLR_IN5_Msk (0x1UL << GPIOTE_INTENCLR_IN5_Pos) /*!< Bit mask of IN5 field. */ +#define GPIOTE_INTENCLR_IN5_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN5_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN5_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for IN[4] event */ +#define GPIOTE_INTENCLR_IN4_Pos (4UL) /*!< Position of IN4 field. */ +#define GPIOTE_INTENCLR_IN4_Msk (0x1UL << GPIOTE_INTENCLR_IN4_Pos) /*!< Bit mask of IN4 field. */ +#define GPIOTE_INTENCLR_IN4_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN4_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN4_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for IN[3] event */ +#define GPIOTE_INTENCLR_IN3_Pos (3UL) /*!< Position of IN3 field. */ +#define GPIOTE_INTENCLR_IN3_Msk (0x1UL << GPIOTE_INTENCLR_IN3_Pos) /*!< Bit mask of IN3 field. */ +#define GPIOTE_INTENCLR_IN3_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN3_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN3_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for IN[2] event */ +#define GPIOTE_INTENCLR_IN2_Pos (2UL) /*!< Position of IN2 field. */ +#define GPIOTE_INTENCLR_IN2_Msk (0x1UL << GPIOTE_INTENCLR_IN2_Pos) /*!< Bit mask of IN2 field. */ +#define GPIOTE_INTENCLR_IN2_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN2_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN2_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for IN[1] event */ +#define GPIOTE_INTENCLR_IN1_Pos (1UL) /*!< Position of IN1 field. */ +#define GPIOTE_INTENCLR_IN1_Msk (0x1UL << GPIOTE_INTENCLR_IN1_Pos) /*!< Bit mask of IN1 field. */ +#define GPIOTE_INTENCLR_IN1_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN1_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN1_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for IN[0] event */ +#define GPIOTE_INTENCLR_IN0_Pos (0UL) /*!< Position of IN0 field. */ +#define GPIOTE_INTENCLR_IN0_Msk (0x1UL << GPIOTE_INTENCLR_IN0_Pos) /*!< Bit mask of IN0 field. */ +#define GPIOTE_INTENCLR_IN0_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN0_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN0_Clear (1UL) /*!< Disable */ + +/* Register: GPIOTE_CONFIG */ +/* Description: Description collection[0]: Configuration for OUT[n], SET[n] and CLR[n] tasks and IN[n] event */ + +/* Bit 20 : When in task mode: Initial value of the output when the GPIOTE channel is configured. When in event mode: No effect. */ +#define GPIOTE_CONFIG_OUTINIT_Pos (20UL) /*!< Position of OUTINIT field. */ +#define GPIOTE_CONFIG_OUTINIT_Msk (0x1UL << GPIOTE_CONFIG_OUTINIT_Pos) /*!< Bit mask of OUTINIT field. */ +#define GPIOTE_CONFIG_OUTINIT_Low (0UL) /*!< Task mode: Initial value of pin before task triggering is low */ +#define GPIOTE_CONFIG_OUTINIT_High (1UL) /*!< Task mode: Initial value of pin before task triggering is high */ + +/* Bits 17..16 : When In task mode: Operation to be performed on output when OUT[n] task is triggered. When In event mode: Operation on input that shall trigger IN[n] event. */ +#define GPIOTE_CONFIG_POLARITY_Pos (16UL) /*!< Position of POLARITY field. */ +#define GPIOTE_CONFIG_POLARITY_Msk (0x3UL << GPIOTE_CONFIG_POLARITY_Pos) /*!< Bit mask of POLARITY field. */ +#define GPIOTE_CONFIG_POLARITY_None (0UL) /*!< Task mode: No effect on pin from OUT[n] task. Event mode: no IN[n] event generated on pin activity. */ +#define GPIOTE_CONFIG_POLARITY_LoToHi (1UL) /*!< Task mode: Set pin from OUT[n] task. Event mode: Generate IN[n] event when rising edge on pin. */ +#define GPIOTE_CONFIG_POLARITY_HiToLo (2UL) /*!< Task mode: Clear pin from OUT[n] task. Event mode: Generate IN[n] event when falling edge on pin. */ +#define GPIOTE_CONFIG_POLARITY_Toggle (3UL) /*!< Task mode: Toggle pin from OUT[n]. Event mode: Generate IN[n] when any change on pin. */ + +/* Bits 12..8 : GPIO number associated with SET[n], CLR[n] and OUT[n] tasks and IN[n] event */ +#define GPIOTE_CONFIG_PSEL_Pos (8UL) /*!< Position of PSEL field. */ +#define GPIOTE_CONFIG_PSEL_Msk (0x1FUL << GPIOTE_CONFIG_PSEL_Pos) /*!< Bit mask of PSEL field. */ + +/* Bits 1..0 : Mode */ +#define GPIOTE_CONFIG_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define GPIOTE_CONFIG_MODE_Msk (0x3UL << GPIOTE_CONFIG_MODE_Pos) /*!< Bit mask of MODE field. */ +#define GPIOTE_CONFIG_MODE_Disabled (0UL) /*!< Disabled. Pin specified by PSEL will not be acquired by the GPIOTE module. */ +#define GPIOTE_CONFIG_MODE_Event (1UL) /*!< Event mode */ +#define GPIOTE_CONFIG_MODE_Task (3UL) /*!< Task mode */ + + +/* Peripheral: I2S */ +/* Description: Inter-IC Sound */ + +/* Register: I2S_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 5 : Enable or disable interrupt for TXPTRUPD event */ +#define I2S_INTEN_TXPTRUPD_Pos (5UL) /*!< Position of TXPTRUPD field. */ +#define I2S_INTEN_TXPTRUPD_Msk (0x1UL << I2S_INTEN_TXPTRUPD_Pos) /*!< Bit mask of TXPTRUPD field. */ +#define I2S_INTEN_TXPTRUPD_Disabled (0UL) /*!< Disable */ +#define I2S_INTEN_TXPTRUPD_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for STOPPED event */ +#define I2S_INTEN_STOPPED_Pos (2UL) /*!< Position of STOPPED field. */ +#define I2S_INTEN_STOPPED_Msk (0x1UL << I2S_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define I2S_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define I2S_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for RXPTRUPD event */ +#define I2S_INTEN_RXPTRUPD_Pos (1UL) /*!< Position of RXPTRUPD field. */ +#define I2S_INTEN_RXPTRUPD_Msk (0x1UL << I2S_INTEN_RXPTRUPD_Pos) /*!< Bit mask of RXPTRUPD field. */ +#define I2S_INTEN_RXPTRUPD_Disabled (0UL) /*!< Disable */ +#define I2S_INTEN_RXPTRUPD_Enabled (1UL) /*!< Enable */ + +/* Register: I2S_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 5 : Write '1' to Enable interrupt for TXPTRUPD event */ +#define I2S_INTENSET_TXPTRUPD_Pos (5UL) /*!< Position of TXPTRUPD field. */ +#define I2S_INTENSET_TXPTRUPD_Msk (0x1UL << I2S_INTENSET_TXPTRUPD_Pos) /*!< Bit mask of TXPTRUPD field. */ +#define I2S_INTENSET_TXPTRUPD_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENSET_TXPTRUPD_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENSET_TXPTRUPD_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for STOPPED event */ +#define I2S_INTENSET_STOPPED_Pos (2UL) /*!< Position of STOPPED field. */ +#define I2S_INTENSET_STOPPED_Msk (0x1UL << I2S_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define I2S_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for RXPTRUPD event */ +#define I2S_INTENSET_RXPTRUPD_Pos (1UL) /*!< Position of RXPTRUPD field. */ +#define I2S_INTENSET_RXPTRUPD_Msk (0x1UL << I2S_INTENSET_RXPTRUPD_Pos) /*!< Bit mask of RXPTRUPD field. */ +#define I2S_INTENSET_RXPTRUPD_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENSET_RXPTRUPD_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENSET_RXPTRUPD_Set (1UL) /*!< Enable */ + +/* Register: I2S_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 5 : Write '1' to Disable interrupt for TXPTRUPD event */ +#define I2S_INTENCLR_TXPTRUPD_Pos (5UL) /*!< Position of TXPTRUPD field. */ +#define I2S_INTENCLR_TXPTRUPD_Msk (0x1UL << I2S_INTENCLR_TXPTRUPD_Pos) /*!< Bit mask of TXPTRUPD field. */ +#define I2S_INTENCLR_TXPTRUPD_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENCLR_TXPTRUPD_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENCLR_TXPTRUPD_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for STOPPED event */ +#define I2S_INTENCLR_STOPPED_Pos (2UL) /*!< Position of STOPPED field. */ +#define I2S_INTENCLR_STOPPED_Msk (0x1UL << I2S_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define I2S_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for RXPTRUPD event */ +#define I2S_INTENCLR_RXPTRUPD_Pos (1UL) /*!< Position of RXPTRUPD field. */ +#define I2S_INTENCLR_RXPTRUPD_Msk (0x1UL << I2S_INTENCLR_RXPTRUPD_Pos) /*!< Bit mask of RXPTRUPD field. */ +#define I2S_INTENCLR_RXPTRUPD_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENCLR_RXPTRUPD_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENCLR_RXPTRUPD_Clear (1UL) /*!< Disable */ + +/* Register: I2S_ENABLE */ +/* Description: Enable I2S module. */ + +/* Bit 0 : Enable I2S module. */ +#define I2S_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define I2S_ENABLE_ENABLE_Msk (0x1UL << I2S_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define I2S_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define I2S_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: I2S_CONFIG_MODE */ +/* Description: I2S mode. */ + +/* Bit 0 : I2S mode. */ +#define I2S_CONFIG_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define I2S_CONFIG_MODE_MODE_Msk (0x1UL << I2S_CONFIG_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define I2S_CONFIG_MODE_MODE_Master (0UL) /*!< Master mode. SCK and LRCK generated from internal master clcok (MCK) and output on pins defined by PSEL.xxx. */ +#define I2S_CONFIG_MODE_MODE_Slave (1UL) /*!< Slave mode. SCK and LRCK generated by external master and received on pins defined by PSEL.xxx */ + +/* Register: I2S_CONFIG_RXEN */ +/* Description: Reception (RX) enable. */ + +/* Bit 0 : Reception (RX) enable. */ +#define I2S_CONFIG_RXEN_RXEN_Pos (0UL) /*!< Position of RXEN field. */ +#define I2S_CONFIG_RXEN_RXEN_Msk (0x1UL << I2S_CONFIG_RXEN_RXEN_Pos) /*!< Bit mask of RXEN field. */ +#define I2S_CONFIG_RXEN_RXEN_Disabled (0UL) /*!< Reception disabled and now data will be written to the RXD.PTR address. */ +#define I2S_CONFIG_RXEN_RXEN_Enabled (1UL) /*!< Reception enabled. */ + +/* Register: I2S_CONFIG_TXEN */ +/* Description: Transmission (TX) enable. */ + +/* Bit 0 : Transmission (TX) enable. */ +#define I2S_CONFIG_TXEN_TXEN_Pos (0UL) /*!< Position of TXEN field. */ +#define I2S_CONFIG_TXEN_TXEN_Msk (0x1UL << I2S_CONFIG_TXEN_TXEN_Pos) /*!< Bit mask of TXEN field. */ +#define I2S_CONFIG_TXEN_TXEN_Disabled (0UL) /*!< Transmission disabled and now data will be read from the RXD.TXD address. */ +#define I2S_CONFIG_TXEN_TXEN_Enabled (1UL) /*!< Transmission enabled. */ + +/* Register: I2S_CONFIG_MCKEN */ +/* Description: Master clock generator enable. */ + +/* Bit 0 : Master clock generator enable. */ +#define I2S_CONFIG_MCKEN_MCKEN_Pos (0UL) /*!< Position of MCKEN field. */ +#define I2S_CONFIG_MCKEN_MCKEN_Msk (0x1UL << I2S_CONFIG_MCKEN_MCKEN_Pos) /*!< Bit mask of MCKEN field. */ +#define I2S_CONFIG_MCKEN_MCKEN_Disabled (0UL) /*!< Master clock generator disabled and PSEL.MCK not connected(available as GPIO). */ +#define I2S_CONFIG_MCKEN_MCKEN_Enabled (1UL) /*!< Master clock generator running and MCK output on PSEL.MCK. */ + +/* Register: I2S_CONFIG_MCKFREQ */ +/* Description: Master clock generator frequency. */ + +/* Bits 31..0 : Master clock generator frequency. */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_Pos (0UL) /*!< Position of MCKFREQ field. */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_Msk (0xFFFFFFFFUL << I2S_CONFIG_MCKFREQ_MCKFREQ_Pos) /*!< Bit mask of MCKFREQ field. */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV125 (0x020C0000UL) /*!< 32 MHz / 125 = 0.256 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV63 (0x04100000UL) /*!< 32 MHz / 63 = 0.5079365 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV42 (0x06000000UL) /*!< 32 MHz / 42 = 0.7619048 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV32 (0x08000000UL) /*!< 32 MHz / 32 = 1.0 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV31 (0x08400000UL) /*!< 32 MHz / 31 = 1.0322581 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV30 (0x08800000UL) /*!< 32 MHz / 30 = 1.0666667 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV23 (0x0B000000UL) /*!< 32 MHz / 23 = 1.3913043 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV21 (0x0C000000UL) /*!< 32 MHz / 21 = 1.5238095 */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV16 (0x10000000UL) /*!< 32 MHz / 16 = 2.0 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV15 (0x11000000UL) /*!< 32 MHz / 15 = 2.1333333 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV11 (0x16000000UL) /*!< 32 MHz / 11 = 2.9090909 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV10 (0x18000000UL) /*!< 32 MHz / 10 = 3.2 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV8 (0x20000000UL) /*!< 32 MHz / 8 = 4.0 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV6 (0x28000000UL) /*!< 32 MHz / 6 = 5.3333333 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV5 (0x30000000UL) /*!< 32 MHz / 5 = 6.4 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV4 (0x40000000UL) /*!< 32 MHz / 4 = 8.0 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV3 (0x50000000UL) /*!< 32 MHz / 3 = 10.6666667 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2 (0x80000000UL) /*!< 32 MHz / 2 = 16.0 MHz */ + +/* Register: I2S_CONFIG_RATIO */ +/* Description: MCK / LRCK ratio. */ + +/* Bits 3..0 : MCK / LRCK ratio. */ +#define I2S_CONFIG_RATIO_RATIO_Pos (0UL) /*!< Position of RATIO field. */ +#define I2S_CONFIG_RATIO_RATIO_Msk (0xFUL << I2S_CONFIG_RATIO_RATIO_Pos) /*!< Bit mask of RATIO field. */ +#define I2S_CONFIG_RATIO_RATIO_32X (0UL) /*!< LRCK = MCK / 32 */ +#define I2S_CONFIG_RATIO_RATIO_48X (1UL) /*!< LRCK = MCK / 48 */ +#define I2S_CONFIG_RATIO_RATIO_64X (2UL) /*!< LRCK = MCK / 64 */ +#define I2S_CONFIG_RATIO_RATIO_96X (3UL) /*!< LRCK = MCK / 96 */ +#define I2S_CONFIG_RATIO_RATIO_128X (4UL) /*!< LRCK = MCK / 128 */ +#define I2S_CONFIG_RATIO_RATIO_192X (5UL) /*!< LRCK = MCK / 192 */ +#define I2S_CONFIG_RATIO_RATIO_256X (6UL) /*!< LRCK = MCK / 256 */ +#define I2S_CONFIG_RATIO_RATIO_384X (7UL) /*!< LRCK = MCK / 384 */ +#define I2S_CONFIG_RATIO_RATIO_512X (8UL) /*!< LRCK = MCK / 512 */ + +/* Register: I2S_CONFIG_SWIDTH */ +/* Description: Sample width. */ + +/* Bits 1..0 : Sample width. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_Pos (0UL) /*!< Position of SWIDTH field. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_Msk (0x3UL << I2S_CONFIG_SWIDTH_SWIDTH_Pos) /*!< Bit mask of SWIDTH field. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_8Bit (0UL) /*!< 8 bit. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_16Bit (1UL) /*!< 16 bit. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_24Bit (2UL) /*!< 24 bit. */ + +/* Register: I2S_CONFIG_ALIGN */ +/* Description: Alignment of sample within a frame. */ + +/* Bit 0 : Alignment of sample within a frame. */ +#define I2S_CONFIG_ALIGN_ALIGN_Pos (0UL) /*!< Position of ALIGN field. */ +#define I2S_CONFIG_ALIGN_ALIGN_Msk (0x1UL << I2S_CONFIG_ALIGN_ALIGN_Pos) /*!< Bit mask of ALIGN field. */ +#define I2S_CONFIG_ALIGN_ALIGN_Left (0UL) /*!< Left-aligned. */ +#define I2S_CONFIG_ALIGN_ALIGN_Right (1UL) /*!< Right-aligned. */ + +/* Register: I2S_CONFIG_FORMAT */ +/* Description: Frame format. */ + +/* Bit 0 : Frame format. */ +#define I2S_CONFIG_FORMAT_FORMAT_Pos (0UL) /*!< Position of FORMAT field. */ +#define I2S_CONFIG_FORMAT_FORMAT_Msk (0x1UL << I2S_CONFIG_FORMAT_FORMAT_Pos) /*!< Bit mask of FORMAT field. */ +#define I2S_CONFIG_FORMAT_FORMAT_I2S (0UL) /*!< Original I2S format. */ +#define I2S_CONFIG_FORMAT_FORMAT_Aligned (1UL) /*!< Alternate (left- or right-aligned) format. */ + +/* Register: I2S_CONFIG_CHANNELS */ +/* Description: Enable channels. */ + +/* Bits 1..0 : Enable channels. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Pos (0UL) /*!< Position of CHANNELS field. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Msk (0x3UL << I2S_CONFIG_CHANNELS_CHANNELS_Pos) /*!< Bit mask of CHANNELS field. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Stereo (0UL) /*!< Stereo. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Left (1UL) /*!< Left only. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Right (2UL) /*!< Right only. */ + +/* Register: I2S_RXD_PTR */ +/* Description: Receive buffer RAM start address. */ + +/* Bits 31..0 : Receive buffer Data RAM start address. When receiving, words containing samples will be written to this address. This address is a word aligned Data RAM address. */ +#define I2S_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define I2S_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << I2S_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: I2S_TXD_PTR */ +/* Description: Transmit buffer RAM start address. */ + +/* Bits 31..0 : Transmit buffer Data RAM start address. When transmitting, words containing samples will be fetched from this address. This address is a word aligned Data RAM address. */ +#define I2S_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define I2S_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << I2S_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: I2S_RXTXD_MAXCNT */ +/* Description: Size of RXD and TXD buffers. */ + +/* Bits 13..0 : Size of RXD and TXD buffers in number of 32 bit words. */ +#define I2S_RXTXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define I2S_RXTXD_MAXCNT_MAXCNT_Msk (0x3FFFUL << I2S_RXTXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: I2S_PSEL_MCK */ +/* Description: Pin select for MCK signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_MCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_MCK_CONNECT_Msk (0x1UL << I2S_PSEL_MCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_MCK_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_MCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_MCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_MCK_PIN_Msk (0x1FUL << I2S_PSEL_MCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: I2S_PSEL_SCK */ +/* Description: Pin select for SCK signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_SCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_SCK_CONNECT_Msk (0x1UL << I2S_PSEL_SCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_SCK_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_SCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_SCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_SCK_PIN_Msk (0x1FUL << I2S_PSEL_SCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: I2S_PSEL_LRCK */ +/* Description: Pin select for LRCK signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_LRCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_LRCK_CONNECT_Msk (0x1UL << I2S_PSEL_LRCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_LRCK_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_LRCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_LRCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_LRCK_PIN_Msk (0x1FUL << I2S_PSEL_LRCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: I2S_PSEL_SDIN */ +/* Description: Pin select for SDIN signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_SDIN_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_SDIN_CONNECT_Msk (0x1UL << I2S_PSEL_SDIN_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_SDIN_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_SDIN_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_SDIN_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_SDIN_PIN_Msk (0x1FUL << I2S_PSEL_SDIN_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: I2S_PSEL_SDOUT */ +/* Description: Pin select for SDOUT signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_SDOUT_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_SDOUT_CONNECT_Msk (0x1UL << I2S_PSEL_SDOUT_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_SDOUT_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_SDOUT_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_SDOUT_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_SDOUT_PIN_Msk (0x1FUL << I2S_PSEL_SDOUT_PIN_Pos) /*!< Bit mask of PIN field. */ + + +/* Peripheral: LPCOMP */ +/* Description: Low Power Comparator */ + +/* Register: LPCOMP_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between CROSS event and STOP task */ +#define LPCOMP_SHORTS_CROSS_STOP_Pos (4UL) /*!< Position of CROSS_STOP field. */ +#define LPCOMP_SHORTS_CROSS_STOP_Msk (0x1UL << LPCOMP_SHORTS_CROSS_STOP_Pos) /*!< Bit mask of CROSS_STOP field. */ +#define LPCOMP_SHORTS_CROSS_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_CROSS_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between UP event and STOP task */ +#define LPCOMP_SHORTS_UP_STOP_Pos (3UL) /*!< Position of UP_STOP field. */ +#define LPCOMP_SHORTS_UP_STOP_Msk (0x1UL << LPCOMP_SHORTS_UP_STOP_Pos) /*!< Bit mask of UP_STOP field. */ +#define LPCOMP_SHORTS_UP_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_UP_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between DOWN event and STOP task */ +#define LPCOMP_SHORTS_DOWN_STOP_Pos (2UL) /*!< Position of DOWN_STOP field. */ +#define LPCOMP_SHORTS_DOWN_STOP_Msk (0x1UL << LPCOMP_SHORTS_DOWN_STOP_Pos) /*!< Bit mask of DOWN_STOP field. */ +#define LPCOMP_SHORTS_DOWN_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_DOWN_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between READY event and STOP task */ +#define LPCOMP_SHORTS_READY_STOP_Pos (1UL) /*!< Position of READY_STOP field. */ +#define LPCOMP_SHORTS_READY_STOP_Msk (0x1UL << LPCOMP_SHORTS_READY_STOP_Pos) /*!< Bit mask of READY_STOP field. */ +#define LPCOMP_SHORTS_READY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_READY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between READY event and SAMPLE task */ +#define LPCOMP_SHORTS_READY_SAMPLE_Pos (0UL) /*!< Position of READY_SAMPLE field. */ +#define LPCOMP_SHORTS_READY_SAMPLE_Msk (0x1UL << LPCOMP_SHORTS_READY_SAMPLE_Pos) /*!< Bit mask of READY_SAMPLE field. */ +#define LPCOMP_SHORTS_READY_SAMPLE_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_READY_SAMPLE_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: LPCOMP_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 3 : Write '1' to Enable interrupt for CROSS event */ +#define LPCOMP_INTENSET_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define LPCOMP_INTENSET_CROSS_Msk (0x1UL << LPCOMP_INTENSET_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define LPCOMP_INTENSET_CROSS_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENSET_CROSS_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENSET_CROSS_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for UP event */ +#define LPCOMP_INTENSET_UP_Pos (2UL) /*!< Position of UP field. */ +#define LPCOMP_INTENSET_UP_Msk (0x1UL << LPCOMP_INTENSET_UP_Pos) /*!< Bit mask of UP field. */ +#define LPCOMP_INTENSET_UP_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENSET_UP_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENSET_UP_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for DOWN event */ +#define LPCOMP_INTENSET_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define LPCOMP_INTENSET_DOWN_Msk (0x1UL << LPCOMP_INTENSET_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define LPCOMP_INTENSET_DOWN_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENSET_DOWN_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENSET_DOWN_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define LPCOMP_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define LPCOMP_INTENSET_READY_Msk (0x1UL << LPCOMP_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define LPCOMP_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: LPCOMP_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 3 : Write '1' to Disable interrupt for CROSS event */ +#define LPCOMP_INTENCLR_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define LPCOMP_INTENCLR_CROSS_Msk (0x1UL << LPCOMP_INTENCLR_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define LPCOMP_INTENCLR_CROSS_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENCLR_CROSS_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENCLR_CROSS_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for UP event */ +#define LPCOMP_INTENCLR_UP_Pos (2UL) /*!< Position of UP field. */ +#define LPCOMP_INTENCLR_UP_Msk (0x1UL << LPCOMP_INTENCLR_UP_Pos) /*!< Bit mask of UP field. */ +#define LPCOMP_INTENCLR_UP_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENCLR_UP_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENCLR_UP_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for DOWN event */ +#define LPCOMP_INTENCLR_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define LPCOMP_INTENCLR_DOWN_Msk (0x1UL << LPCOMP_INTENCLR_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define LPCOMP_INTENCLR_DOWN_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENCLR_DOWN_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENCLR_DOWN_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define LPCOMP_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define LPCOMP_INTENCLR_READY_Msk (0x1UL << LPCOMP_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define LPCOMP_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: LPCOMP_RESULT */ +/* Description: Compare result */ + +/* Bit 0 : Result of last compare. Decision point SAMPLE task. */ +#define LPCOMP_RESULT_RESULT_Pos (0UL) /*!< Position of RESULT field. */ +#define LPCOMP_RESULT_RESULT_Msk (0x1UL << LPCOMP_RESULT_RESULT_Pos) /*!< Bit mask of RESULT field. */ +#define LPCOMP_RESULT_RESULT_Bellow (0UL) /*!< Input voltage is below the reference threshold (VIN+ < VIN-). */ +#define LPCOMP_RESULT_RESULT_Above (1UL) /*!< Input voltage is above the reference threshold (VIN+ > VIN-). */ + +/* Register: LPCOMP_ENABLE */ +/* Description: Enable LPCOMP */ + +/* Bits 1..0 : Enable or disable LPCOMP */ +#define LPCOMP_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define LPCOMP_ENABLE_ENABLE_Msk (0x3UL << LPCOMP_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define LPCOMP_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define LPCOMP_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: LPCOMP_PSEL */ +/* Description: Input pin select */ + +/* Bits 2..0 : Analog pin select */ +#define LPCOMP_PSEL_PSEL_Pos (0UL) /*!< Position of PSEL field. */ +#define LPCOMP_PSEL_PSEL_Msk (0x7UL << LPCOMP_PSEL_PSEL_Pos) /*!< Bit mask of PSEL field. */ +#define LPCOMP_PSEL_PSEL_AnalogInput0 (0UL) /*!< AIN0 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput1 (1UL) /*!< AIN1 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput2 (2UL) /*!< AIN2 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput3 (3UL) /*!< AIN3 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput4 (4UL) /*!< AIN4 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput5 (5UL) /*!< AIN5 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput6 (6UL) /*!< AIN6 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput7 (7UL) /*!< AIN7 selected as analog input */ + +/* Register: LPCOMP_REFSEL */ +/* Description: Reference select */ + +/* Bits 3..0 : Reference select */ +#define LPCOMP_REFSEL_REFSEL_Pos (0UL) /*!< Position of REFSEL field. */ +#define LPCOMP_REFSEL_REFSEL_Msk (0xFUL << LPCOMP_REFSEL_REFSEL_Pos) /*!< Bit mask of REFSEL field. */ +#define LPCOMP_REFSEL_REFSEL_Ref1_8Vdd (0UL) /*!< VDD * 1/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref2_8Vdd (1UL) /*!< VDD * 2/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref3_8Vdd (2UL) /*!< VDD * 3/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref4_8Vdd (3UL) /*!< VDD * 4/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref5_8Vdd (4UL) /*!< VDD * 5/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref6_8Vdd (5UL) /*!< VDD * 6/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref7_8Vdd (6UL) /*!< VDD * 7/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_ARef (7UL) /*!< External analog reference selected */ +#define LPCOMP_REFSEL_REFSEL_Ref1_16Vdd (8UL) /*!< VDD * 1/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref3_16Vdd (9UL) /*!< VDD * 3/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref5_16Vdd (10UL) /*!< VDD * 5/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref7_16Vdd (11UL) /*!< VDD * 7/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref9_16Vdd (12UL) /*!< VDD * 9/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref11_16Vdd (13UL) /*!< VDD * 11/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref13_16Vdd (14UL) /*!< VDD * 13/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref15_16Vdd (15UL) /*!< VDD * 15/16 selected as reference */ + +/* Register: LPCOMP_EXTREFSEL */ +/* Description: External reference select */ + +/* Bit 0 : External analog reference select */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_Pos (0UL) /*!< Position of EXTREFSEL field. */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_Msk (0x1UL << LPCOMP_EXTREFSEL_EXTREFSEL_Pos) /*!< Bit mask of EXTREFSEL field. */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference0 (0UL) /*!< Use AIN0 as external analog reference */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference1 (1UL) /*!< Use AIN1 as external analog reference */ + +/* Register: LPCOMP_ANADETECT */ +/* Description: Analog detect configuration */ + +/* Bits 1..0 : Analog detect configuration */ +#define LPCOMP_ANADETECT_ANADETECT_Pos (0UL) /*!< Position of ANADETECT field. */ +#define LPCOMP_ANADETECT_ANADETECT_Msk (0x3UL << LPCOMP_ANADETECT_ANADETECT_Pos) /*!< Bit mask of ANADETECT field. */ +#define LPCOMP_ANADETECT_ANADETECT_Cross (0UL) /*!< Generate ANADETECT on crossing, both upward crossing and downward crossing */ +#define LPCOMP_ANADETECT_ANADETECT_Up (1UL) /*!< Generate ANADETECT on upward crossing only */ +#define LPCOMP_ANADETECT_ANADETECT_Down (2UL) /*!< Generate ANADETECT on downward crossing only */ + +/* Register: LPCOMP_HYST */ +/* Description: Comparator hysteresis enable */ + +/* Bit 0 : Comparator hysteresis enable */ +#define LPCOMP_HYST_HYST_Pos (0UL) /*!< Position of HYST field. */ +#define LPCOMP_HYST_HYST_Msk (0x1UL << LPCOMP_HYST_HYST_Pos) /*!< Bit mask of HYST field. */ +#define LPCOMP_HYST_HYST_NoHyst (0UL) /*!< Comparator hysteresis disabled */ +#define LPCOMP_HYST_HYST_Hyst50mV (1UL) /*!< Comparator hysteresis disabled (typ. 50 mV) */ + + +/* Peripheral: MWU */ +/* Description: Memory Watch Unit */ + +/* Register: MWU_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 27 : Enable or disable interrupt for PREGION[1].RA event */ +#define MWU_INTEN_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_INTEN_PREGION1RA_Msk (0x1UL << MWU_INTEN_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_INTEN_PREGION1RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_PREGION1RA_Enabled (1UL) /*!< Enable */ + +/* Bit 26 : Enable or disable interrupt for PREGION[1].WA event */ +#define MWU_INTEN_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_INTEN_PREGION1WA_Msk (0x1UL << MWU_INTEN_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_INTEN_PREGION1WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_PREGION1WA_Enabled (1UL) /*!< Enable */ + +/* Bit 25 : Enable or disable interrupt for PREGION[0].RA event */ +#define MWU_INTEN_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_INTEN_PREGION0RA_Msk (0x1UL << MWU_INTEN_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_INTEN_PREGION0RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_PREGION0RA_Enabled (1UL) /*!< Enable */ + +/* Bit 24 : Enable or disable interrupt for PREGION[0].WA event */ +#define MWU_INTEN_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_INTEN_PREGION0WA_Msk (0x1UL << MWU_INTEN_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_INTEN_PREGION0WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_PREGION0WA_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for REGION[3].RA event */ +#define MWU_INTEN_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_INTEN_REGION3RA_Msk (0x1UL << MWU_INTEN_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_INTEN_REGION3RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION3RA_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for REGION[3].WA event */ +#define MWU_INTEN_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_INTEN_REGION3WA_Msk (0x1UL << MWU_INTEN_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_INTEN_REGION3WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION3WA_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for REGION[2].RA event */ +#define MWU_INTEN_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_INTEN_REGION2RA_Msk (0x1UL << MWU_INTEN_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_INTEN_REGION2RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION2RA_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for REGION[2].WA event */ +#define MWU_INTEN_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_INTEN_REGION2WA_Msk (0x1UL << MWU_INTEN_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_INTEN_REGION2WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION2WA_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for REGION[1].RA event */ +#define MWU_INTEN_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_INTEN_REGION1RA_Msk (0x1UL << MWU_INTEN_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_INTEN_REGION1RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION1RA_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for REGION[1].WA event */ +#define MWU_INTEN_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_INTEN_REGION1WA_Msk (0x1UL << MWU_INTEN_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_INTEN_REGION1WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION1WA_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for REGION[0].RA event */ +#define MWU_INTEN_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_INTEN_REGION0RA_Msk (0x1UL << MWU_INTEN_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_INTEN_REGION0RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION0RA_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for REGION[0].WA event */ +#define MWU_INTEN_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_INTEN_REGION0WA_Msk (0x1UL << MWU_INTEN_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_INTEN_REGION0WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION0WA_Enabled (1UL) /*!< Enable */ + +/* Register: MWU_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 27 : Write '1' to Enable interrupt for PREGION[1].RA event */ +#define MWU_INTENSET_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_INTENSET_PREGION1RA_Msk (0x1UL << MWU_INTENSET_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_INTENSET_PREGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_PREGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_PREGION1RA_Set (1UL) /*!< Enable */ + +/* Bit 26 : Write '1' to Enable interrupt for PREGION[1].WA event */ +#define MWU_INTENSET_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_INTENSET_PREGION1WA_Msk (0x1UL << MWU_INTENSET_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_INTENSET_PREGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_PREGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_PREGION1WA_Set (1UL) /*!< Enable */ + +/* Bit 25 : Write '1' to Enable interrupt for PREGION[0].RA event */ +#define MWU_INTENSET_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_INTENSET_PREGION0RA_Msk (0x1UL << MWU_INTENSET_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_INTENSET_PREGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_PREGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_PREGION0RA_Set (1UL) /*!< Enable */ + +/* Bit 24 : Write '1' to Enable interrupt for PREGION[0].WA event */ +#define MWU_INTENSET_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_INTENSET_PREGION0WA_Msk (0x1UL << MWU_INTENSET_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_INTENSET_PREGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_PREGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_PREGION0WA_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for REGION[3].RA event */ +#define MWU_INTENSET_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_INTENSET_REGION3RA_Msk (0x1UL << MWU_INTENSET_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_INTENSET_REGION3RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION3RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION3RA_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for REGION[3].WA event */ +#define MWU_INTENSET_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_INTENSET_REGION3WA_Msk (0x1UL << MWU_INTENSET_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_INTENSET_REGION3WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION3WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION3WA_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for REGION[2].RA event */ +#define MWU_INTENSET_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_INTENSET_REGION2RA_Msk (0x1UL << MWU_INTENSET_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_INTENSET_REGION2RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION2RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION2RA_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for REGION[2].WA event */ +#define MWU_INTENSET_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_INTENSET_REGION2WA_Msk (0x1UL << MWU_INTENSET_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_INTENSET_REGION2WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION2WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION2WA_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for REGION[1].RA event */ +#define MWU_INTENSET_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_INTENSET_REGION1RA_Msk (0x1UL << MWU_INTENSET_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_INTENSET_REGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION1RA_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for REGION[1].WA event */ +#define MWU_INTENSET_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_INTENSET_REGION1WA_Msk (0x1UL << MWU_INTENSET_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_INTENSET_REGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION1WA_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for REGION[0].RA event */ +#define MWU_INTENSET_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_INTENSET_REGION0RA_Msk (0x1UL << MWU_INTENSET_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_INTENSET_REGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION0RA_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for REGION[0].WA event */ +#define MWU_INTENSET_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_INTENSET_REGION0WA_Msk (0x1UL << MWU_INTENSET_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_INTENSET_REGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION0WA_Set (1UL) /*!< Enable */ + +/* Register: MWU_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 27 : Write '1' to Disable interrupt for PREGION[1].RA event */ +#define MWU_INTENCLR_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_INTENCLR_PREGION1RA_Msk (0x1UL << MWU_INTENCLR_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_INTENCLR_PREGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_PREGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_PREGION1RA_Clear (1UL) /*!< Disable */ + +/* Bit 26 : Write '1' to Disable interrupt for PREGION[1].WA event */ +#define MWU_INTENCLR_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_INTENCLR_PREGION1WA_Msk (0x1UL << MWU_INTENCLR_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_INTENCLR_PREGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_PREGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_PREGION1WA_Clear (1UL) /*!< Disable */ + +/* Bit 25 : Write '1' to Disable interrupt for PREGION[0].RA event */ +#define MWU_INTENCLR_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_INTENCLR_PREGION0RA_Msk (0x1UL << MWU_INTENCLR_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_INTENCLR_PREGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_PREGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_PREGION0RA_Clear (1UL) /*!< Disable */ + +/* Bit 24 : Write '1' to Disable interrupt for PREGION[0].WA event */ +#define MWU_INTENCLR_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_INTENCLR_PREGION0WA_Msk (0x1UL << MWU_INTENCLR_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_INTENCLR_PREGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_PREGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_PREGION0WA_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for REGION[3].RA event */ +#define MWU_INTENCLR_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_INTENCLR_REGION3RA_Msk (0x1UL << MWU_INTENCLR_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_INTENCLR_REGION3RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION3RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION3RA_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for REGION[3].WA event */ +#define MWU_INTENCLR_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_INTENCLR_REGION3WA_Msk (0x1UL << MWU_INTENCLR_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_INTENCLR_REGION3WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION3WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION3WA_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for REGION[2].RA event */ +#define MWU_INTENCLR_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_INTENCLR_REGION2RA_Msk (0x1UL << MWU_INTENCLR_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_INTENCLR_REGION2RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION2RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION2RA_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for REGION[2].WA event */ +#define MWU_INTENCLR_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_INTENCLR_REGION2WA_Msk (0x1UL << MWU_INTENCLR_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_INTENCLR_REGION2WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION2WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION2WA_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for REGION[1].RA event */ +#define MWU_INTENCLR_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_INTENCLR_REGION1RA_Msk (0x1UL << MWU_INTENCLR_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_INTENCLR_REGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION1RA_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for REGION[1].WA event */ +#define MWU_INTENCLR_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_INTENCLR_REGION1WA_Msk (0x1UL << MWU_INTENCLR_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_INTENCLR_REGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION1WA_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for REGION[0].RA event */ +#define MWU_INTENCLR_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_INTENCLR_REGION0RA_Msk (0x1UL << MWU_INTENCLR_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_INTENCLR_REGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION0RA_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for REGION[0].WA event */ +#define MWU_INTENCLR_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_INTENCLR_REGION0WA_Msk (0x1UL << MWU_INTENCLR_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_INTENCLR_REGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION0WA_Clear (1UL) /*!< Disable */ + +/* Register: MWU_NMIEN */ +/* Description: Enable or disable non-maskable interrupt */ + +/* Bit 27 : Enable or disable non-maskable interrupt for PREGION[1].RA event */ +#define MWU_NMIEN_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_NMIEN_PREGION1RA_Msk (0x1UL << MWU_NMIEN_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_NMIEN_PREGION1RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_PREGION1RA_Enabled (1UL) /*!< Enable */ + +/* Bit 26 : Enable or disable non-maskable interrupt for PREGION[1].WA event */ +#define MWU_NMIEN_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_NMIEN_PREGION1WA_Msk (0x1UL << MWU_NMIEN_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_NMIEN_PREGION1WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_PREGION1WA_Enabled (1UL) /*!< Enable */ + +/* Bit 25 : Enable or disable non-maskable interrupt for PREGION[0].RA event */ +#define MWU_NMIEN_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_NMIEN_PREGION0RA_Msk (0x1UL << MWU_NMIEN_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_NMIEN_PREGION0RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_PREGION0RA_Enabled (1UL) /*!< Enable */ + +/* Bit 24 : Enable or disable non-maskable interrupt for PREGION[0].WA event */ +#define MWU_NMIEN_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_NMIEN_PREGION0WA_Msk (0x1UL << MWU_NMIEN_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_NMIEN_PREGION0WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_PREGION0WA_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable non-maskable interrupt for REGION[3].RA event */ +#define MWU_NMIEN_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_NMIEN_REGION3RA_Msk (0x1UL << MWU_NMIEN_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_NMIEN_REGION3RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION3RA_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable non-maskable interrupt for REGION[3].WA event */ +#define MWU_NMIEN_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_NMIEN_REGION3WA_Msk (0x1UL << MWU_NMIEN_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_NMIEN_REGION3WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION3WA_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable non-maskable interrupt for REGION[2].RA event */ +#define MWU_NMIEN_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_NMIEN_REGION2RA_Msk (0x1UL << MWU_NMIEN_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_NMIEN_REGION2RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION2RA_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable non-maskable interrupt for REGION[2].WA event */ +#define MWU_NMIEN_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_NMIEN_REGION2WA_Msk (0x1UL << MWU_NMIEN_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_NMIEN_REGION2WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION2WA_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable non-maskable interrupt for REGION[1].RA event */ +#define MWU_NMIEN_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_NMIEN_REGION1RA_Msk (0x1UL << MWU_NMIEN_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_NMIEN_REGION1RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION1RA_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable non-maskable interrupt for REGION[1].WA event */ +#define MWU_NMIEN_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_NMIEN_REGION1WA_Msk (0x1UL << MWU_NMIEN_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_NMIEN_REGION1WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION1WA_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable non-maskable interrupt for REGION[0].RA event */ +#define MWU_NMIEN_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_NMIEN_REGION0RA_Msk (0x1UL << MWU_NMIEN_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_NMIEN_REGION0RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION0RA_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable non-maskable interrupt for REGION[0].WA event */ +#define MWU_NMIEN_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_NMIEN_REGION0WA_Msk (0x1UL << MWU_NMIEN_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_NMIEN_REGION0WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION0WA_Enabled (1UL) /*!< Enable */ + +/* Register: MWU_NMIENSET */ +/* Description: Enable non-maskable interrupt */ + +/* Bit 27 : Write '1' to Enable non-maskable interrupt for PREGION[1].RA event */ +#define MWU_NMIENSET_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_NMIENSET_PREGION1RA_Msk (0x1UL << MWU_NMIENSET_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_NMIENSET_PREGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_PREGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_PREGION1RA_Set (1UL) /*!< Enable */ + +/* Bit 26 : Write '1' to Enable non-maskable interrupt for PREGION[1].WA event */ +#define MWU_NMIENSET_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_NMIENSET_PREGION1WA_Msk (0x1UL << MWU_NMIENSET_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_NMIENSET_PREGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_PREGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_PREGION1WA_Set (1UL) /*!< Enable */ + +/* Bit 25 : Write '1' to Enable non-maskable interrupt for PREGION[0].RA event */ +#define MWU_NMIENSET_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_NMIENSET_PREGION0RA_Msk (0x1UL << MWU_NMIENSET_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_NMIENSET_PREGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_PREGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_PREGION0RA_Set (1UL) /*!< Enable */ + +/* Bit 24 : Write '1' to Enable non-maskable interrupt for PREGION[0].WA event */ +#define MWU_NMIENSET_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_NMIENSET_PREGION0WA_Msk (0x1UL << MWU_NMIENSET_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_NMIENSET_PREGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_PREGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_PREGION0WA_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable non-maskable interrupt for REGION[3].RA event */ +#define MWU_NMIENSET_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_NMIENSET_REGION3RA_Msk (0x1UL << MWU_NMIENSET_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_NMIENSET_REGION3RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION3RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION3RA_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable non-maskable interrupt for REGION[3].WA event */ +#define MWU_NMIENSET_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_NMIENSET_REGION3WA_Msk (0x1UL << MWU_NMIENSET_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_NMIENSET_REGION3WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION3WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION3WA_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable non-maskable interrupt for REGION[2].RA event */ +#define MWU_NMIENSET_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_NMIENSET_REGION2RA_Msk (0x1UL << MWU_NMIENSET_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_NMIENSET_REGION2RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION2RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION2RA_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable non-maskable interrupt for REGION[2].WA event */ +#define MWU_NMIENSET_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_NMIENSET_REGION2WA_Msk (0x1UL << MWU_NMIENSET_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_NMIENSET_REGION2WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION2WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION2WA_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable non-maskable interrupt for REGION[1].RA event */ +#define MWU_NMIENSET_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_NMIENSET_REGION1RA_Msk (0x1UL << MWU_NMIENSET_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_NMIENSET_REGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION1RA_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable non-maskable interrupt for REGION[1].WA event */ +#define MWU_NMIENSET_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_NMIENSET_REGION1WA_Msk (0x1UL << MWU_NMIENSET_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_NMIENSET_REGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION1WA_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable non-maskable interrupt for REGION[0].RA event */ +#define MWU_NMIENSET_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_NMIENSET_REGION0RA_Msk (0x1UL << MWU_NMIENSET_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_NMIENSET_REGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION0RA_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable non-maskable interrupt for REGION[0].WA event */ +#define MWU_NMIENSET_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_NMIENSET_REGION0WA_Msk (0x1UL << MWU_NMIENSET_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_NMIENSET_REGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION0WA_Set (1UL) /*!< Enable */ + +/* Register: MWU_NMIENCLR */ +/* Description: Disable non-maskable interrupt */ + +/* Bit 27 : Write '1' to Disable non-maskable interrupt for PREGION[1].RA event */ +#define MWU_NMIENCLR_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_NMIENCLR_PREGION1RA_Msk (0x1UL << MWU_NMIENCLR_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_NMIENCLR_PREGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_PREGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_PREGION1RA_Clear (1UL) /*!< Disable */ + +/* Bit 26 : Write '1' to Disable non-maskable interrupt for PREGION[1].WA event */ +#define MWU_NMIENCLR_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_NMIENCLR_PREGION1WA_Msk (0x1UL << MWU_NMIENCLR_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_NMIENCLR_PREGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_PREGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_PREGION1WA_Clear (1UL) /*!< Disable */ + +/* Bit 25 : Write '1' to Disable non-maskable interrupt for PREGION[0].RA event */ +#define MWU_NMIENCLR_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_NMIENCLR_PREGION0RA_Msk (0x1UL << MWU_NMIENCLR_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_NMIENCLR_PREGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_PREGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_PREGION0RA_Clear (1UL) /*!< Disable */ + +/* Bit 24 : Write '1' to Disable non-maskable interrupt for PREGION[0].WA event */ +#define MWU_NMIENCLR_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_NMIENCLR_PREGION0WA_Msk (0x1UL << MWU_NMIENCLR_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_NMIENCLR_PREGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_PREGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_PREGION0WA_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable non-maskable interrupt for REGION[3].RA event */ +#define MWU_NMIENCLR_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_NMIENCLR_REGION3RA_Msk (0x1UL << MWU_NMIENCLR_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_NMIENCLR_REGION3RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION3RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION3RA_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable non-maskable interrupt for REGION[3].WA event */ +#define MWU_NMIENCLR_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_NMIENCLR_REGION3WA_Msk (0x1UL << MWU_NMIENCLR_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_NMIENCLR_REGION3WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION3WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION3WA_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable non-maskable interrupt for REGION[2].RA event */ +#define MWU_NMIENCLR_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_NMIENCLR_REGION2RA_Msk (0x1UL << MWU_NMIENCLR_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_NMIENCLR_REGION2RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION2RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION2RA_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable non-maskable interrupt for REGION[2].WA event */ +#define MWU_NMIENCLR_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_NMIENCLR_REGION2WA_Msk (0x1UL << MWU_NMIENCLR_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_NMIENCLR_REGION2WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION2WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION2WA_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable non-maskable interrupt for REGION[1].RA event */ +#define MWU_NMIENCLR_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_NMIENCLR_REGION1RA_Msk (0x1UL << MWU_NMIENCLR_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_NMIENCLR_REGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION1RA_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable non-maskable interrupt for REGION[1].WA event */ +#define MWU_NMIENCLR_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_NMIENCLR_REGION1WA_Msk (0x1UL << MWU_NMIENCLR_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_NMIENCLR_REGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION1WA_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable non-maskable interrupt for REGION[0].RA event */ +#define MWU_NMIENCLR_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_NMIENCLR_REGION0RA_Msk (0x1UL << MWU_NMIENCLR_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_NMIENCLR_REGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION0RA_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable non-maskable interrupt for REGION[0].WA event */ +#define MWU_NMIENCLR_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_NMIENCLR_REGION0WA_Msk (0x1UL << MWU_NMIENCLR_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_NMIENCLR_REGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION0WA_Clear (1UL) /*!< Disable */ + +/* Register: MWU_PERREGION_SUBSTATWA */ +/* Description: Description cluster[0]: Source of event/interrupt in region 0, write access detected while corresponding subregion was enabled for watching */ + +/* Bit 31 : Subregion 31 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR31_Pos (31UL) /*!< Position of SR31 field. */ +#define MWU_PERREGION_SUBSTATWA_SR31_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR31_Pos) /*!< Bit mask of SR31 field. */ +#define MWU_PERREGION_SUBSTATWA_SR31_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR31_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 30 : Subregion 30 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR30_Pos (30UL) /*!< Position of SR30 field. */ +#define MWU_PERREGION_SUBSTATWA_SR30_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR30_Pos) /*!< Bit mask of SR30 field. */ +#define MWU_PERREGION_SUBSTATWA_SR30_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR30_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 29 : Subregion 29 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR29_Pos (29UL) /*!< Position of SR29 field. */ +#define MWU_PERREGION_SUBSTATWA_SR29_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR29_Pos) /*!< Bit mask of SR29 field. */ +#define MWU_PERREGION_SUBSTATWA_SR29_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR29_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 28 : Subregion 28 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR28_Pos (28UL) /*!< Position of SR28 field. */ +#define MWU_PERREGION_SUBSTATWA_SR28_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR28_Pos) /*!< Bit mask of SR28 field. */ +#define MWU_PERREGION_SUBSTATWA_SR28_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR28_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 27 : Subregion 27 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR27_Pos (27UL) /*!< Position of SR27 field. */ +#define MWU_PERREGION_SUBSTATWA_SR27_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR27_Pos) /*!< Bit mask of SR27 field. */ +#define MWU_PERREGION_SUBSTATWA_SR27_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR27_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 26 : Subregion 26 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR26_Pos (26UL) /*!< Position of SR26 field. */ +#define MWU_PERREGION_SUBSTATWA_SR26_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR26_Pos) /*!< Bit mask of SR26 field. */ +#define MWU_PERREGION_SUBSTATWA_SR26_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR26_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 25 : Subregion 25 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR25_Pos (25UL) /*!< Position of SR25 field. */ +#define MWU_PERREGION_SUBSTATWA_SR25_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR25_Pos) /*!< Bit mask of SR25 field. */ +#define MWU_PERREGION_SUBSTATWA_SR25_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR25_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 24 : Subregion 24 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR24_Pos (24UL) /*!< Position of SR24 field. */ +#define MWU_PERREGION_SUBSTATWA_SR24_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR24_Pos) /*!< Bit mask of SR24 field. */ +#define MWU_PERREGION_SUBSTATWA_SR24_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR24_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 23 : Subregion 23 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR23_Pos (23UL) /*!< Position of SR23 field. */ +#define MWU_PERREGION_SUBSTATWA_SR23_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR23_Pos) /*!< Bit mask of SR23 field. */ +#define MWU_PERREGION_SUBSTATWA_SR23_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR23_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 22 : Subregion 22 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR22_Pos (22UL) /*!< Position of SR22 field. */ +#define MWU_PERREGION_SUBSTATWA_SR22_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR22_Pos) /*!< Bit mask of SR22 field. */ +#define MWU_PERREGION_SUBSTATWA_SR22_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR22_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 21 : Subregion 21 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR21_Pos (21UL) /*!< Position of SR21 field. */ +#define MWU_PERREGION_SUBSTATWA_SR21_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR21_Pos) /*!< Bit mask of SR21 field. */ +#define MWU_PERREGION_SUBSTATWA_SR21_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR21_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 20 : Subregion 20 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR20_Pos (20UL) /*!< Position of SR20 field. */ +#define MWU_PERREGION_SUBSTATWA_SR20_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR20_Pos) /*!< Bit mask of SR20 field. */ +#define MWU_PERREGION_SUBSTATWA_SR20_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR20_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 19 : Subregion 19 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR19_Pos (19UL) /*!< Position of SR19 field. */ +#define MWU_PERREGION_SUBSTATWA_SR19_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR19_Pos) /*!< Bit mask of SR19 field. */ +#define MWU_PERREGION_SUBSTATWA_SR19_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR19_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 18 : Subregion 18 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR18_Pos (18UL) /*!< Position of SR18 field. */ +#define MWU_PERREGION_SUBSTATWA_SR18_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR18_Pos) /*!< Bit mask of SR18 field. */ +#define MWU_PERREGION_SUBSTATWA_SR18_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR18_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 17 : Subregion 17 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR17_Pos (17UL) /*!< Position of SR17 field. */ +#define MWU_PERREGION_SUBSTATWA_SR17_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR17_Pos) /*!< Bit mask of SR17 field. */ +#define MWU_PERREGION_SUBSTATWA_SR17_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR17_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 16 : Subregion 16 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR16_Pos (16UL) /*!< Position of SR16 field. */ +#define MWU_PERREGION_SUBSTATWA_SR16_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR16_Pos) /*!< Bit mask of SR16 field. */ +#define MWU_PERREGION_SUBSTATWA_SR16_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR16_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 15 : Subregion 15 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR15_Pos (15UL) /*!< Position of SR15 field. */ +#define MWU_PERREGION_SUBSTATWA_SR15_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR15_Pos) /*!< Bit mask of SR15 field. */ +#define MWU_PERREGION_SUBSTATWA_SR15_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR15_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 14 : Subregion 14 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR14_Pos (14UL) /*!< Position of SR14 field. */ +#define MWU_PERREGION_SUBSTATWA_SR14_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR14_Pos) /*!< Bit mask of SR14 field. */ +#define MWU_PERREGION_SUBSTATWA_SR14_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR14_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 13 : Subregion 13 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR13_Pos (13UL) /*!< Position of SR13 field. */ +#define MWU_PERREGION_SUBSTATWA_SR13_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR13_Pos) /*!< Bit mask of SR13 field. */ +#define MWU_PERREGION_SUBSTATWA_SR13_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR13_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 12 : Subregion 12 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR12_Pos (12UL) /*!< Position of SR12 field. */ +#define MWU_PERREGION_SUBSTATWA_SR12_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR12_Pos) /*!< Bit mask of SR12 field. */ +#define MWU_PERREGION_SUBSTATWA_SR12_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR12_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 11 : Subregion 11 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR11_Pos (11UL) /*!< Position of SR11 field. */ +#define MWU_PERREGION_SUBSTATWA_SR11_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR11_Pos) /*!< Bit mask of SR11 field. */ +#define MWU_PERREGION_SUBSTATWA_SR11_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR11_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 10 : Subregion 10 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR10_Pos (10UL) /*!< Position of SR10 field. */ +#define MWU_PERREGION_SUBSTATWA_SR10_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR10_Pos) /*!< Bit mask of SR10 field. */ +#define MWU_PERREGION_SUBSTATWA_SR10_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR10_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 9 : Subregion 9 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR9_Pos (9UL) /*!< Position of SR9 field. */ +#define MWU_PERREGION_SUBSTATWA_SR9_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR9_Pos) /*!< Bit mask of SR9 field. */ +#define MWU_PERREGION_SUBSTATWA_SR9_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR9_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 8 : Subregion 8 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR8_Pos (8UL) /*!< Position of SR8 field. */ +#define MWU_PERREGION_SUBSTATWA_SR8_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR8_Pos) /*!< Bit mask of SR8 field. */ +#define MWU_PERREGION_SUBSTATWA_SR8_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR8_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 7 : Subregion 7 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR7_Pos (7UL) /*!< Position of SR7 field. */ +#define MWU_PERREGION_SUBSTATWA_SR7_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR7_Pos) /*!< Bit mask of SR7 field. */ +#define MWU_PERREGION_SUBSTATWA_SR7_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR7_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 6 : Subregion 6 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR6_Pos (6UL) /*!< Position of SR6 field. */ +#define MWU_PERREGION_SUBSTATWA_SR6_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR6_Pos) /*!< Bit mask of SR6 field. */ +#define MWU_PERREGION_SUBSTATWA_SR6_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR6_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 5 : Subregion 5 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR5_Pos (5UL) /*!< Position of SR5 field. */ +#define MWU_PERREGION_SUBSTATWA_SR5_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR5_Pos) /*!< Bit mask of SR5 field. */ +#define MWU_PERREGION_SUBSTATWA_SR5_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR5_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 4 : Subregion 4 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR4_Pos (4UL) /*!< Position of SR4 field. */ +#define MWU_PERREGION_SUBSTATWA_SR4_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR4_Pos) /*!< Bit mask of SR4 field. */ +#define MWU_PERREGION_SUBSTATWA_SR4_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR4_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 3 : Subregion 3 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR3_Pos (3UL) /*!< Position of SR3 field. */ +#define MWU_PERREGION_SUBSTATWA_SR3_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR3_Pos) /*!< Bit mask of SR3 field. */ +#define MWU_PERREGION_SUBSTATWA_SR3_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR3_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 2 : Subregion 2 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR2_Pos (2UL) /*!< Position of SR2 field. */ +#define MWU_PERREGION_SUBSTATWA_SR2_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR2_Pos) /*!< Bit mask of SR2 field. */ +#define MWU_PERREGION_SUBSTATWA_SR2_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR2_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 1 : Subregion 1 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR1_Pos (1UL) /*!< Position of SR1 field. */ +#define MWU_PERREGION_SUBSTATWA_SR1_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR1_Pos) /*!< Bit mask of SR1 field. */ +#define MWU_PERREGION_SUBSTATWA_SR1_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR1_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 0 : Subregion 0 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR0_Pos (0UL) /*!< Position of SR0 field. */ +#define MWU_PERREGION_SUBSTATWA_SR0_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR0_Pos) /*!< Bit mask of SR0 field. */ +#define MWU_PERREGION_SUBSTATWA_SR0_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR0_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Register: MWU_PERREGION_SUBSTATRA */ +/* Description: Description cluster[0]: Source of event/interrupt in region 0, read access detected while corresponding subregion was enabled for watching */ + +/* Bit 31 : Subregion 31 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR31_Pos (31UL) /*!< Position of SR31 field. */ +#define MWU_PERREGION_SUBSTATRA_SR31_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR31_Pos) /*!< Bit mask of SR31 field. */ +#define MWU_PERREGION_SUBSTATRA_SR31_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR31_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 30 : Subregion 30 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR30_Pos (30UL) /*!< Position of SR30 field. */ +#define MWU_PERREGION_SUBSTATRA_SR30_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR30_Pos) /*!< Bit mask of SR30 field. */ +#define MWU_PERREGION_SUBSTATRA_SR30_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR30_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 29 : Subregion 29 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR29_Pos (29UL) /*!< Position of SR29 field. */ +#define MWU_PERREGION_SUBSTATRA_SR29_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR29_Pos) /*!< Bit mask of SR29 field. */ +#define MWU_PERREGION_SUBSTATRA_SR29_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR29_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 28 : Subregion 28 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR28_Pos (28UL) /*!< Position of SR28 field. */ +#define MWU_PERREGION_SUBSTATRA_SR28_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR28_Pos) /*!< Bit mask of SR28 field. */ +#define MWU_PERREGION_SUBSTATRA_SR28_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR28_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 27 : Subregion 27 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR27_Pos (27UL) /*!< Position of SR27 field. */ +#define MWU_PERREGION_SUBSTATRA_SR27_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR27_Pos) /*!< Bit mask of SR27 field. */ +#define MWU_PERREGION_SUBSTATRA_SR27_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR27_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 26 : Subregion 26 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR26_Pos (26UL) /*!< Position of SR26 field. */ +#define MWU_PERREGION_SUBSTATRA_SR26_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR26_Pos) /*!< Bit mask of SR26 field. */ +#define MWU_PERREGION_SUBSTATRA_SR26_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR26_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 25 : Subregion 25 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR25_Pos (25UL) /*!< Position of SR25 field. */ +#define MWU_PERREGION_SUBSTATRA_SR25_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR25_Pos) /*!< Bit mask of SR25 field. */ +#define MWU_PERREGION_SUBSTATRA_SR25_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR25_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 24 : Subregion 24 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR24_Pos (24UL) /*!< Position of SR24 field. */ +#define MWU_PERREGION_SUBSTATRA_SR24_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR24_Pos) /*!< Bit mask of SR24 field. */ +#define MWU_PERREGION_SUBSTATRA_SR24_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR24_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 23 : Subregion 23 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR23_Pos (23UL) /*!< Position of SR23 field. */ +#define MWU_PERREGION_SUBSTATRA_SR23_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR23_Pos) /*!< Bit mask of SR23 field. */ +#define MWU_PERREGION_SUBSTATRA_SR23_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR23_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 22 : Subregion 22 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR22_Pos (22UL) /*!< Position of SR22 field. */ +#define MWU_PERREGION_SUBSTATRA_SR22_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR22_Pos) /*!< Bit mask of SR22 field. */ +#define MWU_PERREGION_SUBSTATRA_SR22_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR22_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 21 : Subregion 21 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR21_Pos (21UL) /*!< Position of SR21 field. */ +#define MWU_PERREGION_SUBSTATRA_SR21_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR21_Pos) /*!< Bit mask of SR21 field. */ +#define MWU_PERREGION_SUBSTATRA_SR21_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR21_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 20 : Subregion 20 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR20_Pos (20UL) /*!< Position of SR20 field. */ +#define MWU_PERREGION_SUBSTATRA_SR20_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR20_Pos) /*!< Bit mask of SR20 field. */ +#define MWU_PERREGION_SUBSTATRA_SR20_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR20_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 19 : Subregion 19 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR19_Pos (19UL) /*!< Position of SR19 field. */ +#define MWU_PERREGION_SUBSTATRA_SR19_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR19_Pos) /*!< Bit mask of SR19 field. */ +#define MWU_PERREGION_SUBSTATRA_SR19_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR19_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 18 : Subregion 18 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR18_Pos (18UL) /*!< Position of SR18 field. */ +#define MWU_PERREGION_SUBSTATRA_SR18_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR18_Pos) /*!< Bit mask of SR18 field. */ +#define MWU_PERREGION_SUBSTATRA_SR18_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR18_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 17 : Subregion 17 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR17_Pos (17UL) /*!< Position of SR17 field. */ +#define MWU_PERREGION_SUBSTATRA_SR17_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR17_Pos) /*!< Bit mask of SR17 field. */ +#define MWU_PERREGION_SUBSTATRA_SR17_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR17_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 16 : Subregion 16 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR16_Pos (16UL) /*!< Position of SR16 field. */ +#define MWU_PERREGION_SUBSTATRA_SR16_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR16_Pos) /*!< Bit mask of SR16 field. */ +#define MWU_PERREGION_SUBSTATRA_SR16_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR16_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 15 : Subregion 15 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR15_Pos (15UL) /*!< Position of SR15 field. */ +#define MWU_PERREGION_SUBSTATRA_SR15_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR15_Pos) /*!< Bit mask of SR15 field. */ +#define MWU_PERREGION_SUBSTATRA_SR15_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR15_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 14 : Subregion 14 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR14_Pos (14UL) /*!< Position of SR14 field. */ +#define MWU_PERREGION_SUBSTATRA_SR14_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR14_Pos) /*!< Bit mask of SR14 field. */ +#define MWU_PERREGION_SUBSTATRA_SR14_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR14_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 13 : Subregion 13 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR13_Pos (13UL) /*!< Position of SR13 field. */ +#define MWU_PERREGION_SUBSTATRA_SR13_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR13_Pos) /*!< Bit mask of SR13 field. */ +#define MWU_PERREGION_SUBSTATRA_SR13_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR13_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 12 : Subregion 12 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR12_Pos (12UL) /*!< Position of SR12 field. */ +#define MWU_PERREGION_SUBSTATRA_SR12_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR12_Pos) /*!< Bit mask of SR12 field. */ +#define MWU_PERREGION_SUBSTATRA_SR12_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR12_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 11 : Subregion 11 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR11_Pos (11UL) /*!< Position of SR11 field. */ +#define MWU_PERREGION_SUBSTATRA_SR11_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR11_Pos) /*!< Bit mask of SR11 field. */ +#define MWU_PERREGION_SUBSTATRA_SR11_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR11_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 10 : Subregion 10 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR10_Pos (10UL) /*!< Position of SR10 field. */ +#define MWU_PERREGION_SUBSTATRA_SR10_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR10_Pos) /*!< Bit mask of SR10 field. */ +#define MWU_PERREGION_SUBSTATRA_SR10_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR10_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 9 : Subregion 9 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR9_Pos (9UL) /*!< Position of SR9 field. */ +#define MWU_PERREGION_SUBSTATRA_SR9_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR9_Pos) /*!< Bit mask of SR9 field. */ +#define MWU_PERREGION_SUBSTATRA_SR9_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR9_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 8 : Subregion 8 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR8_Pos (8UL) /*!< Position of SR8 field. */ +#define MWU_PERREGION_SUBSTATRA_SR8_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR8_Pos) /*!< Bit mask of SR8 field. */ +#define MWU_PERREGION_SUBSTATRA_SR8_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR8_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 7 : Subregion 7 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR7_Pos (7UL) /*!< Position of SR7 field. */ +#define MWU_PERREGION_SUBSTATRA_SR7_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR7_Pos) /*!< Bit mask of SR7 field. */ +#define MWU_PERREGION_SUBSTATRA_SR7_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR7_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 6 : Subregion 6 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR6_Pos (6UL) /*!< Position of SR6 field. */ +#define MWU_PERREGION_SUBSTATRA_SR6_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR6_Pos) /*!< Bit mask of SR6 field. */ +#define MWU_PERREGION_SUBSTATRA_SR6_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR6_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 5 : Subregion 5 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR5_Pos (5UL) /*!< Position of SR5 field. */ +#define MWU_PERREGION_SUBSTATRA_SR5_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR5_Pos) /*!< Bit mask of SR5 field. */ +#define MWU_PERREGION_SUBSTATRA_SR5_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR5_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 4 : Subregion 4 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR4_Pos (4UL) /*!< Position of SR4 field. */ +#define MWU_PERREGION_SUBSTATRA_SR4_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR4_Pos) /*!< Bit mask of SR4 field. */ +#define MWU_PERREGION_SUBSTATRA_SR4_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR4_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 3 : Subregion 3 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR3_Pos (3UL) /*!< Position of SR3 field. */ +#define MWU_PERREGION_SUBSTATRA_SR3_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR3_Pos) /*!< Bit mask of SR3 field. */ +#define MWU_PERREGION_SUBSTATRA_SR3_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR3_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 2 : Subregion 2 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR2_Pos (2UL) /*!< Position of SR2 field. */ +#define MWU_PERREGION_SUBSTATRA_SR2_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR2_Pos) /*!< Bit mask of SR2 field. */ +#define MWU_PERREGION_SUBSTATRA_SR2_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR2_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 1 : Subregion 1 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR1_Pos (1UL) /*!< Position of SR1 field. */ +#define MWU_PERREGION_SUBSTATRA_SR1_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR1_Pos) /*!< Bit mask of SR1 field. */ +#define MWU_PERREGION_SUBSTATRA_SR1_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR1_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 0 : Subregion 0 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR0_Pos (0UL) /*!< Position of SR0 field. */ +#define MWU_PERREGION_SUBSTATRA_SR0_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR0_Pos) /*!< Bit mask of SR0 field. */ +#define MWU_PERREGION_SUBSTATRA_SR0_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR0_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Register: MWU_REGIONEN */ +/* Description: Enable/disable regions watch */ + +/* Bit 27 : Enable/disable read access watch in PREGION[1] */ +#define MWU_REGIONEN_PRGN1RA_Pos (27UL) /*!< Position of PRGN1RA field. */ +#define MWU_REGIONEN_PRGN1RA_Msk (0x1UL << MWU_REGIONEN_PRGN1RA_Pos) /*!< Bit mask of PRGN1RA field. */ +#define MWU_REGIONEN_PRGN1RA_Disable (0UL) /*!< Disable read access watch in this PREGION */ +#define MWU_REGIONEN_PRGN1RA_Enable (1UL) /*!< Enable read access watch in this PREGION */ + +/* Bit 26 : Enable/disable write access watch in PREGION[1] */ +#define MWU_REGIONEN_PRGN1WA_Pos (26UL) /*!< Position of PRGN1WA field. */ +#define MWU_REGIONEN_PRGN1WA_Msk (0x1UL << MWU_REGIONEN_PRGN1WA_Pos) /*!< Bit mask of PRGN1WA field. */ +#define MWU_REGIONEN_PRGN1WA_Disable (0UL) /*!< Disable write access watch in this PREGION */ +#define MWU_REGIONEN_PRGN1WA_Enable (1UL) /*!< Enable write access watch in this PREGION */ + +/* Bit 25 : Enable/disable read access watch in PREGION[0] */ +#define MWU_REGIONEN_PRGN0RA_Pos (25UL) /*!< Position of PRGN0RA field. */ +#define MWU_REGIONEN_PRGN0RA_Msk (0x1UL << MWU_REGIONEN_PRGN0RA_Pos) /*!< Bit mask of PRGN0RA field. */ +#define MWU_REGIONEN_PRGN0RA_Disable (0UL) /*!< Disable read access watch in this PREGION */ +#define MWU_REGIONEN_PRGN0RA_Enable (1UL) /*!< Enable read access watch in this PREGION */ + +/* Bit 24 : Enable/disable write access watch in PREGION[0] */ +#define MWU_REGIONEN_PRGN0WA_Pos (24UL) /*!< Position of PRGN0WA field. */ +#define MWU_REGIONEN_PRGN0WA_Msk (0x1UL << MWU_REGIONEN_PRGN0WA_Pos) /*!< Bit mask of PRGN0WA field. */ +#define MWU_REGIONEN_PRGN0WA_Disable (0UL) /*!< Disable write access watch in this PREGION */ +#define MWU_REGIONEN_PRGN0WA_Enable (1UL) /*!< Enable write access watch in this PREGION */ + +/* Bit 7 : Enable/disable read access watch in region[3] */ +#define MWU_REGIONEN_RGN3RA_Pos (7UL) /*!< Position of RGN3RA field. */ +#define MWU_REGIONEN_RGN3RA_Msk (0x1UL << MWU_REGIONEN_RGN3RA_Pos) /*!< Bit mask of RGN3RA field. */ +#define MWU_REGIONEN_RGN3RA_Disable (0UL) /*!< Disable read access watch in this region */ +#define MWU_REGIONEN_RGN3RA_Enable (1UL) /*!< Enable read access watch in this region */ + +/* Bit 6 : Enable/disable write access watch in region[3] */ +#define MWU_REGIONEN_RGN3WA_Pos (6UL) /*!< Position of RGN3WA field. */ +#define MWU_REGIONEN_RGN3WA_Msk (0x1UL << MWU_REGIONEN_RGN3WA_Pos) /*!< Bit mask of RGN3WA field. */ +#define MWU_REGIONEN_RGN3WA_Disable (0UL) /*!< Disable write access watch in this region */ +#define MWU_REGIONEN_RGN3WA_Enable (1UL) /*!< Enable write access watch in this region */ + +/* Bit 5 : Enable/disable read access watch in region[2] */ +#define MWU_REGIONEN_RGN2RA_Pos (5UL) /*!< Position of RGN2RA field. */ +#define MWU_REGIONEN_RGN2RA_Msk (0x1UL << MWU_REGIONEN_RGN2RA_Pos) /*!< Bit mask of RGN2RA field. */ +#define MWU_REGIONEN_RGN2RA_Disable (0UL) /*!< Disable read access watch in this region */ +#define MWU_REGIONEN_RGN2RA_Enable (1UL) /*!< Enable read access watch in this region */ + +/* Bit 4 : Enable/disable write access watch in region[2] */ +#define MWU_REGIONEN_RGN2WA_Pos (4UL) /*!< Position of RGN2WA field. */ +#define MWU_REGIONEN_RGN2WA_Msk (0x1UL << MWU_REGIONEN_RGN2WA_Pos) /*!< Bit mask of RGN2WA field. */ +#define MWU_REGIONEN_RGN2WA_Disable (0UL) /*!< Disable write access watch in this region */ +#define MWU_REGIONEN_RGN2WA_Enable (1UL) /*!< Enable write access watch in this region */ + +/* Bit 3 : Enable/disable read access watch in region[1] */ +#define MWU_REGIONEN_RGN1RA_Pos (3UL) /*!< Position of RGN1RA field. */ +#define MWU_REGIONEN_RGN1RA_Msk (0x1UL << MWU_REGIONEN_RGN1RA_Pos) /*!< Bit mask of RGN1RA field. */ +#define MWU_REGIONEN_RGN1RA_Disable (0UL) /*!< Disable read access watch in this region */ +#define MWU_REGIONEN_RGN1RA_Enable (1UL) /*!< Enable read access watch in this region */ + +/* Bit 2 : Enable/disable write access watch in region[1] */ +#define MWU_REGIONEN_RGN1WA_Pos (2UL) /*!< Position of RGN1WA field. */ +#define MWU_REGIONEN_RGN1WA_Msk (0x1UL << MWU_REGIONEN_RGN1WA_Pos) /*!< Bit mask of RGN1WA field. */ +#define MWU_REGIONEN_RGN1WA_Disable (0UL) /*!< Disable write access watch in this region */ +#define MWU_REGIONEN_RGN1WA_Enable (1UL) /*!< Enable write access watch in this region */ + +/* Bit 1 : Enable/disable read access watch in region[0] */ +#define MWU_REGIONEN_RGN0RA_Pos (1UL) /*!< Position of RGN0RA field. */ +#define MWU_REGIONEN_RGN0RA_Msk (0x1UL << MWU_REGIONEN_RGN0RA_Pos) /*!< Bit mask of RGN0RA field. */ +#define MWU_REGIONEN_RGN0RA_Disable (0UL) /*!< Disable read access watch in this region */ +#define MWU_REGIONEN_RGN0RA_Enable (1UL) /*!< Enable read access watch in this region */ + +/* Bit 0 : Enable/disable write access watch in region[0] */ +#define MWU_REGIONEN_RGN0WA_Pos (0UL) /*!< Position of RGN0WA field. */ +#define MWU_REGIONEN_RGN0WA_Msk (0x1UL << MWU_REGIONEN_RGN0WA_Pos) /*!< Bit mask of RGN0WA field. */ +#define MWU_REGIONEN_RGN0WA_Disable (0UL) /*!< Disable write access watch in this region */ +#define MWU_REGIONEN_RGN0WA_Enable (1UL) /*!< Enable write access watch in this region */ + +/* Register: MWU_REGIONENSET */ +/* Description: Enable regions watch */ + +/* Bit 27 : Enable read access watch in PREGION[1] */ +#define MWU_REGIONENSET_PRGN1RA_Pos (27UL) /*!< Position of PRGN1RA field. */ +#define MWU_REGIONENSET_PRGN1RA_Msk (0x1UL << MWU_REGIONENSET_PRGN1RA_Pos) /*!< Bit mask of PRGN1RA field. */ +#define MWU_REGIONENSET_PRGN1RA_Disabled (0UL) /*!< Read access watch in this PREGION is disabled */ +#define MWU_REGIONENSET_PRGN1RA_Enabled (1UL) /*!< Read access watch in this PREGION is enabled */ +#define MWU_REGIONENSET_PRGN1RA_Set (1UL) /*!< Enable read access watch in this PREGION */ + +/* Bit 26 : Enable write access watch in PREGION[1] */ +#define MWU_REGIONENSET_PRGN1WA_Pos (26UL) /*!< Position of PRGN1WA field. */ +#define MWU_REGIONENSET_PRGN1WA_Msk (0x1UL << MWU_REGIONENSET_PRGN1WA_Pos) /*!< Bit mask of PRGN1WA field. */ +#define MWU_REGIONENSET_PRGN1WA_Disabled (0UL) /*!< Write access watch in this PREGION is disabled */ +#define MWU_REGIONENSET_PRGN1WA_Enabled (1UL) /*!< Write access watch in this PREGION is enabled */ +#define MWU_REGIONENSET_PRGN1WA_Set (1UL) /*!< Enable write access watch in this PREGION */ + +/* Bit 25 : Enable read access watch in PREGION[0] */ +#define MWU_REGIONENSET_PRGN0RA_Pos (25UL) /*!< Position of PRGN0RA field. */ +#define MWU_REGIONENSET_PRGN0RA_Msk (0x1UL << MWU_REGIONENSET_PRGN0RA_Pos) /*!< Bit mask of PRGN0RA field. */ +#define MWU_REGIONENSET_PRGN0RA_Disabled (0UL) /*!< Read access watch in this PREGION is disabled */ +#define MWU_REGIONENSET_PRGN0RA_Enabled (1UL) /*!< Read access watch in this PREGION is enabled */ +#define MWU_REGIONENSET_PRGN0RA_Set (1UL) /*!< Enable read access watch in this PREGION */ + +/* Bit 24 : Enable write access watch in PREGION[0] */ +#define MWU_REGIONENSET_PRGN0WA_Pos (24UL) /*!< Position of PRGN0WA field. */ +#define MWU_REGIONENSET_PRGN0WA_Msk (0x1UL << MWU_REGIONENSET_PRGN0WA_Pos) /*!< Bit mask of PRGN0WA field. */ +#define MWU_REGIONENSET_PRGN0WA_Disabled (0UL) /*!< Write access watch in this PREGION is disabled */ +#define MWU_REGIONENSET_PRGN0WA_Enabled (1UL) /*!< Write access watch in this PREGION is enabled */ +#define MWU_REGIONENSET_PRGN0WA_Set (1UL) /*!< Enable write access watch in this PREGION */ + +/* Bit 7 : Enable read access watch in region[3] */ +#define MWU_REGIONENSET_RGN3RA_Pos (7UL) /*!< Position of RGN3RA field. */ +#define MWU_REGIONENSET_RGN3RA_Msk (0x1UL << MWU_REGIONENSET_RGN3RA_Pos) /*!< Bit mask of RGN3RA field. */ +#define MWU_REGIONENSET_RGN3RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN3RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN3RA_Set (1UL) /*!< Enable read access watch in this region */ + +/* Bit 6 : Enable write access watch in region[3] */ +#define MWU_REGIONENSET_RGN3WA_Pos (6UL) /*!< Position of RGN3WA field. */ +#define MWU_REGIONENSET_RGN3WA_Msk (0x1UL << MWU_REGIONENSET_RGN3WA_Pos) /*!< Bit mask of RGN3WA field. */ +#define MWU_REGIONENSET_RGN3WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN3WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN3WA_Set (1UL) /*!< Enable write access watch in this region */ + +/* Bit 5 : Enable read access watch in region[2] */ +#define MWU_REGIONENSET_RGN2RA_Pos (5UL) /*!< Position of RGN2RA field. */ +#define MWU_REGIONENSET_RGN2RA_Msk (0x1UL << MWU_REGIONENSET_RGN2RA_Pos) /*!< Bit mask of RGN2RA field. */ +#define MWU_REGIONENSET_RGN2RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN2RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN2RA_Set (1UL) /*!< Enable read access watch in this region */ + +/* Bit 4 : Enable write access watch in region[2] */ +#define MWU_REGIONENSET_RGN2WA_Pos (4UL) /*!< Position of RGN2WA field. */ +#define MWU_REGIONENSET_RGN2WA_Msk (0x1UL << MWU_REGIONENSET_RGN2WA_Pos) /*!< Bit mask of RGN2WA field. */ +#define MWU_REGIONENSET_RGN2WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN2WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN2WA_Set (1UL) /*!< Enable write access watch in this region */ + +/* Bit 3 : Enable read access watch in region[1] */ +#define MWU_REGIONENSET_RGN1RA_Pos (3UL) /*!< Position of RGN1RA field. */ +#define MWU_REGIONENSET_RGN1RA_Msk (0x1UL << MWU_REGIONENSET_RGN1RA_Pos) /*!< Bit mask of RGN1RA field. */ +#define MWU_REGIONENSET_RGN1RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN1RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN1RA_Set (1UL) /*!< Enable read access watch in this region */ + +/* Bit 2 : Enable write access watch in region[1] */ +#define MWU_REGIONENSET_RGN1WA_Pos (2UL) /*!< Position of RGN1WA field. */ +#define MWU_REGIONENSET_RGN1WA_Msk (0x1UL << MWU_REGIONENSET_RGN1WA_Pos) /*!< Bit mask of RGN1WA field. */ +#define MWU_REGIONENSET_RGN1WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN1WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN1WA_Set (1UL) /*!< Enable write access watch in this region */ + +/* Bit 1 : Enable read access watch in region[0] */ +#define MWU_REGIONENSET_RGN0RA_Pos (1UL) /*!< Position of RGN0RA field. */ +#define MWU_REGIONENSET_RGN0RA_Msk (0x1UL << MWU_REGIONENSET_RGN0RA_Pos) /*!< Bit mask of RGN0RA field. */ +#define MWU_REGIONENSET_RGN0RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN0RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN0RA_Set (1UL) /*!< Enable read access watch in this region */ + +/* Bit 0 : Enable write access watch in region[0] */ +#define MWU_REGIONENSET_RGN0WA_Pos (0UL) /*!< Position of RGN0WA field. */ +#define MWU_REGIONENSET_RGN0WA_Msk (0x1UL << MWU_REGIONENSET_RGN0WA_Pos) /*!< Bit mask of RGN0WA field. */ +#define MWU_REGIONENSET_RGN0WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN0WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN0WA_Set (1UL) /*!< Enable write access watch in this region */ + +/* Register: MWU_REGIONENCLR */ +/* Description: Disable regions watch */ + +/* Bit 27 : Disable read access watch in PREGION[1] */ +#define MWU_REGIONENCLR_PRGN1RA_Pos (27UL) /*!< Position of PRGN1RA field. */ +#define MWU_REGIONENCLR_PRGN1RA_Msk (0x1UL << MWU_REGIONENCLR_PRGN1RA_Pos) /*!< Bit mask of PRGN1RA field. */ +#define MWU_REGIONENCLR_PRGN1RA_Disabled (0UL) /*!< Read access watch in this PREGION is disabled */ +#define MWU_REGIONENCLR_PRGN1RA_Enabled (1UL) /*!< Read access watch in this PREGION is enabled */ +#define MWU_REGIONENCLR_PRGN1RA_Clear (1UL) /*!< Disable read access watch in this PREGION */ + +/* Bit 26 : Disable write access watch in PREGION[1] */ +#define MWU_REGIONENCLR_PRGN1WA_Pos (26UL) /*!< Position of PRGN1WA field. */ +#define MWU_REGIONENCLR_PRGN1WA_Msk (0x1UL << MWU_REGIONENCLR_PRGN1WA_Pos) /*!< Bit mask of PRGN1WA field. */ +#define MWU_REGIONENCLR_PRGN1WA_Disabled (0UL) /*!< Write access watch in this PREGION is disabled */ +#define MWU_REGIONENCLR_PRGN1WA_Enabled (1UL) /*!< Write access watch in this PREGION is enabled */ +#define MWU_REGIONENCLR_PRGN1WA_Clear (1UL) /*!< Disable write access watch in this PREGION */ + +/* Bit 25 : Disable read access watch in PREGION[0] */ +#define MWU_REGIONENCLR_PRGN0RA_Pos (25UL) /*!< Position of PRGN0RA field. */ +#define MWU_REGIONENCLR_PRGN0RA_Msk (0x1UL << MWU_REGIONENCLR_PRGN0RA_Pos) /*!< Bit mask of PRGN0RA field. */ +#define MWU_REGIONENCLR_PRGN0RA_Disabled (0UL) /*!< Read access watch in this PREGION is disabled */ +#define MWU_REGIONENCLR_PRGN0RA_Enabled (1UL) /*!< Read access watch in this PREGION is enabled */ +#define MWU_REGIONENCLR_PRGN0RA_Clear (1UL) /*!< Disable read access watch in this PREGION */ + +/* Bit 24 : Disable write access watch in PREGION[0] */ +#define MWU_REGIONENCLR_PRGN0WA_Pos (24UL) /*!< Position of PRGN0WA field. */ +#define MWU_REGIONENCLR_PRGN0WA_Msk (0x1UL << MWU_REGIONENCLR_PRGN0WA_Pos) /*!< Bit mask of PRGN0WA field. */ +#define MWU_REGIONENCLR_PRGN0WA_Disabled (0UL) /*!< Write access watch in this PREGION is disabled */ +#define MWU_REGIONENCLR_PRGN0WA_Enabled (1UL) /*!< Write access watch in this PREGION is enabled */ +#define MWU_REGIONENCLR_PRGN0WA_Clear (1UL) /*!< Disable write access watch in this PREGION */ + +/* Bit 7 : Disable read access watch in region[3] */ +#define MWU_REGIONENCLR_RGN3RA_Pos (7UL) /*!< Position of RGN3RA field. */ +#define MWU_REGIONENCLR_RGN3RA_Msk (0x1UL << MWU_REGIONENCLR_RGN3RA_Pos) /*!< Bit mask of RGN3RA field. */ +#define MWU_REGIONENCLR_RGN3RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN3RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN3RA_Clear (1UL) /*!< Disable read access watch in this region */ + +/* Bit 6 : Disable write access watch in region[3] */ +#define MWU_REGIONENCLR_RGN3WA_Pos (6UL) /*!< Position of RGN3WA field. */ +#define MWU_REGIONENCLR_RGN3WA_Msk (0x1UL << MWU_REGIONENCLR_RGN3WA_Pos) /*!< Bit mask of RGN3WA field. */ +#define MWU_REGIONENCLR_RGN3WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN3WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN3WA_Clear (1UL) /*!< Disable write access watch in this region */ + +/* Bit 5 : Disable read access watch in region[2] */ +#define MWU_REGIONENCLR_RGN2RA_Pos (5UL) /*!< Position of RGN2RA field. */ +#define MWU_REGIONENCLR_RGN2RA_Msk (0x1UL << MWU_REGIONENCLR_RGN2RA_Pos) /*!< Bit mask of RGN2RA field. */ +#define MWU_REGIONENCLR_RGN2RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN2RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN2RA_Clear (1UL) /*!< Disable read access watch in this region */ + +/* Bit 4 : Disable write access watch in region[2] */ +#define MWU_REGIONENCLR_RGN2WA_Pos (4UL) /*!< Position of RGN2WA field. */ +#define MWU_REGIONENCLR_RGN2WA_Msk (0x1UL << MWU_REGIONENCLR_RGN2WA_Pos) /*!< Bit mask of RGN2WA field. */ +#define MWU_REGIONENCLR_RGN2WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN2WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN2WA_Clear (1UL) /*!< Disable write access watch in this region */ + +/* Bit 3 : Disable read access watch in region[1] */ +#define MWU_REGIONENCLR_RGN1RA_Pos (3UL) /*!< Position of RGN1RA field. */ +#define MWU_REGIONENCLR_RGN1RA_Msk (0x1UL << MWU_REGIONENCLR_RGN1RA_Pos) /*!< Bit mask of RGN1RA field. */ +#define MWU_REGIONENCLR_RGN1RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN1RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN1RA_Clear (1UL) /*!< Disable read access watch in this region */ + +/* Bit 2 : Disable write access watch in region[1] */ +#define MWU_REGIONENCLR_RGN1WA_Pos (2UL) /*!< Position of RGN1WA field. */ +#define MWU_REGIONENCLR_RGN1WA_Msk (0x1UL << MWU_REGIONENCLR_RGN1WA_Pos) /*!< Bit mask of RGN1WA field. */ +#define MWU_REGIONENCLR_RGN1WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN1WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN1WA_Clear (1UL) /*!< Disable write access watch in this region */ + +/* Bit 1 : Disable read access watch in region[0] */ +#define MWU_REGIONENCLR_RGN0RA_Pos (1UL) /*!< Position of RGN0RA field. */ +#define MWU_REGIONENCLR_RGN0RA_Msk (0x1UL << MWU_REGIONENCLR_RGN0RA_Pos) /*!< Bit mask of RGN0RA field. */ +#define MWU_REGIONENCLR_RGN0RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN0RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN0RA_Clear (1UL) /*!< Disable read access watch in this region */ + +/* Bit 0 : Disable write access watch in region[0] */ +#define MWU_REGIONENCLR_RGN0WA_Pos (0UL) /*!< Position of RGN0WA field. */ +#define MWU_REGIONENCLR_RGN0WA_Msk (0x1UL << MWU_REGIONENCLR_RGN0WA_Pos) /*!< Bit mask of RGN0WA field. */ +#define MWU_REGIONENCLR_RGN0WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN0WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN0WA_Clear (1UL) /*!< Disable write access watch in this region */ + +/* Register: MWU_REGION_START */ +/* Description: Description cluster[0]: Start address for region 0 */ + +/* Bits 31..0 : Start address for region */ +#define MWU_REGION_START_START_Pos (0UL) /*!< Position of START field. */ +#define MWU_REGION_START_START_Msk (0xFFFFFFFFUL << MWU_REGION_START_START_Pos) /*!< Bit mask of START field. */ + +/* Register: MWU_REGION_END */ +/* Description: Description cluster[0]: End address of region 0 */ + +/* Bits 31..0 : End address of region. */ +#define MWU_REGION_END_END_Pos (0UL) /*!< Position of END field. */ +#define MWU_REGION_END_END_Msk (0xFFFFFFFFUL << MWU_REGION_END_END_Pos) /*!< Bit mask of END field. */ + +/* Register: MWU_PREGION_START */ +/* Description: Description cluster[0]: Reserved for future use */ + +/* Bits 31..0 : Reserved for future use */ +#define MWU_PREGION_START_START_Pos (0UL) /*!< Position of START field. */ +#define MWU_PREGION_START_START_Msk (0xFFFFFFFFUL << MWU_PREGION_START_START_Pos) /*!< Bit mask of START field. */ + +/* Register: MWU_PREGION_END */ +/* Description: Description cluster[0]: Reserved for future use */ + +/* Bits 31..0 : Reserved for future use */ +#define MWU_PREGION_END_END_Pos (0UL) /*!< Position of END field. */ +#define MWU_PREGION_END_END_Msk (0xFFFFFFFFUL << MWU_PREGION_END_END_Pos) /*!< Bit mask of END field. */ + +/* Register: MWU_PREGION_SUBS */ +/* Description: Description cluster[0]: Subregions of region 0 */ + +/* Bit 31 : Include or exclude subregion 31 in region */ +#define MWU_PREGION_SUBS_SR31_Pos (31UL) /*!< Position of SR31 field. */ +#define MWU_PREGION_SUBS_SR31_Msk (0x1UL << MWU_PREGION_SUBS_SR31_Pos) /*!< Bit mask of SR31 field. */ +#define MWU_PREGION_SUBS_SR31_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR31_Include (1UL) /*!< Include */ + +/* Bit 30 : Include or exclude subregion 30 in region */ +#define MWU_PREGION_SUBS_SR30_Pos (30UL) /*!< Position of SR30 field. */ +#define MWU_PREGION_SUBS_SR30_Msk (0x1UL << MWU_PREGION_SUBS_SR30_Pos) /*!< Bit mask of SR30 field. */ +#define MWU_PREGION_SUBS_SR30_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR30_Include (1UL) /*!< Include */ + +/* Bit 29 : Include or exclude subregion 29 in region */ +#define MWU_PREGION_SUBS_SR29_Pos (29UL) /*!< Position of SR29 field. */ +#define MWU_PREGION_SUBS_SR29_Msk (0x1UL << MWU_PREGION_SUBS_SR29_Pos) /*!< Bit mask of SR29 field. */ +#define MWU_PREGION_SUBS_SR29_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR29_Include (1UL) /*!< Include */ + +/* Bit 28 : Include or exclude subregion 28 in region */ +#define MWU_PREGION_SUBS_SR28_Pos (28UL) /*!< Position of SR28 field. */ +#define MWU_PREGION_SUBS_SR28_Msk (0x1UL << MWU_PREGION_SUBS_SR28_Pos) /*!< Bit mask of SR28 field. */ +#define MWU_PREGION_SUBS_SR28_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR28_Include (1UL) /*!< Include */ + +/* Bit 27 : Include or exclude subregion 27 in region */ +#define MWU_PREGION_SUBS_SR27_Pos (27UL) /*!< Position of SR27 field. */ +#define MWU_PREGION_SUBS_SR27_Msk (0x1UL << MWU_PREGION_SUBS_SR27_Pos) /*!< Bit mask of SR27 field. */ +#define MWU_PREGION_SUBS_SR27_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR27_Include (1UL) /*!< Include */ + +/* Bit 26 : Include or exclude subregion 26 in region */ +#define MWU_PREGION_SUBS_SR26_Pos (26UL) /*!< Position of SR26 field. */ +#define MWU_PREGION_SUBS_SR26_Msk (0x1UL << MWU_PREGION_SUBS_SR26_Pos) /*!< Bit mask of SR26 field. */ +#define MWU_PREGION_SUBS_SR26_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR26_Include (1UL) /*!< Include */ + +/* Bit 25 : Include or exclude subregion 25 in region */ +#define MWU_PREGION_SUBS_SR25_Pos (25UL) /*!< Position of SR25 field. */ +#define MWU_PREGION_SUBS_SR25_Msk (0x1UL << MWU_PREGION_SUBS_SR25_Pos) /*!< Bit mask of SR25 field. */ +#define MWU_PREGION_SUBS_SR25_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR25_Include (1UL) /*!< Include */ + +/* Bit 24 : Include or exclude subregion 24 in region */ +#define MWU_PREGION_SUBS_SR24_Pos (24UL) /*!< Position of SR24 field. */ +#define MWU_PREGION_SUBS_SR24_Msk (0x1UL << MWU_PREGION_SUBS_SR24_Pos) /*!< Bit mask of SR24 field. */ +#define MWU_PREGION_SUBS_SR24_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR24_Include (1UL) /*!< Include */ + +/* Bit 23 : Include or exclude subregion 23 in region */ +#define MWU_PREGION_SUBS_SR23_Pos (23UL) /*!< Position of SR23 field. */ +#define MWU_PREGION_SUBS_SR23_Msk (0x1UL << MWU_PREGION_SUBS_SR23_Pos) /*!< Bit mask of SR23 field. */ +#define MWU_PREGION_SUBS_SR23_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR23_Include (1UL) /*!< Include */ + +/* Bit 22 : Include or exclude subregion 22 in region */ +#define MWU_PREGION_SUBS_SR22_Pos (22UL) /*!< Position of SR22 field. */ +#define MWU_PREGION_SUBS_SR22_Msk (0x1UL << MWU_PREGION_SUBS_SR22_Pos) /*!< Bit mask of SR22 field. */ +#define MWU_PREGION_SUBS_SR22_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR22_Include (1UL) /*!< Include */ + +/* Bit 21 : Include or exclude subregion 21 in region */ +#define MWU_PREGION_SUBS_SR21_Pos (21UL) /*!< Position of SR21 field. */ +#define MWU_PREGION_SUBS_SR21_Msk (0x1UL << MWU_PREGION_SUBS_SR21_Pos) /*!< Bit mask of SR21 field. */ +#define MWU_PREGION_SUBS_SR21_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR21_Include (1UL) /*!< Include */ + +/* Bit 20 : Include or exclude subregion 20 in region */ +#define MWU_PREGION_SUBS_SR20_Pos (20UL) /*!< Position of SR20 field. */ +#define MWU_PREGION_SUBS_SR20_Msk (0x1UL << MWU_PREGION_SUBS_SR20_Pos) /*!< Bit mask of SR20 field. */ +#define MWU_PREGION_SUBS_SR20_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR20_Include (1UL) /*!< Include */ + +/* Bit 19 : Include or exclude subregion 19 in region */ +#define MWU_PREGION_SUBS_SR19_Pos (19UL) /*!< Position of SR19 field. */ +#define MWU_PREGION_SUBS_SR19_Msk (0x1UL << MWU_PREGION_SUBS_SR19_Pos) /*!< Bit mask of SR19 field. */ +#define MWU_PREGION_SUBS_SR19_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR19_Include (1UL) /*!< Include */ + +/* Bit 18 : Include or exclude subregion 18 in region */ +#define MWU_PREGION_SUBS_SR18_Pos (18UL) /*!< Position of SR18 field. */ +#define MWU_PREGION_SUBS_SR18_Msk (0x1UL << MWU_PREGION_SUBS_SR18_Pos) /*!< Bit mask of SR18 field. */ +#define MWU_PREGION_SUBS_SR18_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR18_Include (1UL) /*!< Include */ + +/* Bit 17 : Include or exclude subregion 17 in region */ +#define MWU_PREGION_SUBS_SR17_Pos (17UL) /*!< Position of SR17 field. */ +#define MWU_PREGION_SUBS_SR17_Msk (0x1UL << MWU_PREGION_SUBS_SR17_Pos) /*!< Bit mask of SR17 field. */ +#define MWU_PREGION_SUBS_SR17_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR17_Include (1UL) /*!< Include */ + +/* Bit 16 : Include or exclude subregion 16 in region */ +#define MWU_PREGION_SUBS_SR16_Pos (16UL) /*!< Position of SR16 field. */ +#define MWU_PREGION_SUBS_SR16_Msk (0x1UL << MWU_PREGION_SUBS_SR16_Pos) /*!< Bit mask of SR16 field. */ +#define MWU_PREGION_SUBS_SR16_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR16_Include (1UL) /*!< Include */ + +/* Bit 15 : Include or exclude subregion 15 in region */ +#define MWU_PREGION_SUBS_SR15_Pos (15UL) /*!< Position of SR15 field. */ +#define MWU_PREGION_SUBS_SR15_Msk (0x1UL << MWU_PREGION_SUBS_SR15_Pos) /*!< Bit mask of SR15 field. */ +#define MWU_PREGION_SUBS_SR15_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR15_Include (1UL) /*!< Include */ + +/* Bit 14 : Include or exclude subregion 14 in region */ +#define MWU_PREGION_SUBS_SR14_Pos (14UL) /*!< Position of SR14 field. */ +#define MWU_PREGION_SUBS_SR14_Msk (0x1UL << MWU_PREGION_SUBS_SR14_Pos) /*!< Bit mask of SR14 field. */ +#define MWU_PREGION_SUBS_SR14_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR14_Include (1UL) /*!< Include */ + +/* Bit 13 : Include or exclude subregion 13 in region */ +#define MWU_PREGION_SUBS_SR13_Pos (13UL) /*!< Position of SR13 field. */ +#define MWU_PREGION_SUBS_SR13_Msk (0x1UL << MWU_PREGION_SUBS_SR13_Pos) /*!< Bit mask of SR13 field. */ +#define MWU_PREGION_SUBS_SR13_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR13_Include (1UL) /*!< Include */ + +/* Bit 12 : Include or exclude subregion 12 in region */ +#define MWU_PREGION_SUBS_SR12_Pos (12UL) /*!< Position of SR12 field. */ +#define MWU_PREGION_SUBS_SR12_Msk (0x1UL << MWU_PREGION_SUBS_SR12_Pos) /*!< Bit mask of SR12 field. */ +#define MWU_PREGION_SUBS_SR12_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR12_Include (1UL) /*!< Include */ + +/* Bit 11 : Include or exclude subregion 11 in region */ +#define MWU_PREGION_SUBS_SR11_Pos (11UL) /*!< Position of SR11 field. */ +#define MWU_PREGION_SUBS_SR11_Msk (0x1UL << MWU_PREGION_SUBS_SR11_Pos) /*!< Bit mask of SR11 field. */ +#define MWU_PREGION_SUBS_SR11_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR11_Include (1UL) /*!< Include */ + +/* Bit 10 : Include or exclude subregion 10 in region */ +#define MWU_PREGION_SUBS_SR10_Pos (10UL) /*!< Position of SR10 field. */ +#define MWU_PREGION_SUBS_SR10_Msk (0x1UL << MWU_PREGION_SUBS_SR10_Pos) /*!< Bit mask of SR10 field. */ +#define MWU_PREGION_SUBS_SR10_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR10_Include (1UL) /*!< Include */ + +/* Bit 9 : Include or exclude subregion 9 in region */ +#define MWU_PREGION_SUBS_SR9_Pos (9UL) /*!< Position of SR9 field. */ +#define MWU_PREGION_SUBS_SR9_Msk (0x1UL << MWU_PREGION_SUBS_SR9_Pos) /*!< Bit mask of SR9 field. */ +#define MWU_PREGION_SUBS_SR9_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR9_Include (1UL) /*!< Include */ + +/* Bit 8 : Include or exclude subregion 8 in region */ +#define MWU_PREGION_SUBS_SR8_Pos (8UL) /*!< Position of SR8 field. */ +#define MWU_PREGION_SUBS_SR8_Msk (0x1UL << MWU_PREGION_SUBS_SR8_Pos) /*!< Bit mask of SR8 field. */ +#define MWU_PREGION_SUBS_SR8_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR8_Include (1UL) /*!< Include */ + +/* Bit 7 : Include or exclude subregion 7 in region */ +#define MWU_PREGION_SUBS_SR7_Pos (7UL) /*!< Position of SR7 field. */ +#define MWU_PREGION_SUBS_SR7_Msk (0x1UL << MWU_PREGION_SUBS_SR7_Pos) /*!< Bit mask of SR7 field. */ +#define MWU_PREGION_SUBS_SR7_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR7_Include (1UL) /*!< Include */ + +/* Bit 6 : Include or exclude subregion 6 in region */ +#define MWU_PREGION_SUBS_SR6_Pos (6UL) /*!< Position of SR6 field. */ +#define MWU_PREGION_SUBS_SR6_Msk (0x1UL << MWU_PREGION_SUBS_SR6_Pos) /*!< Bit mask of SR6 field. */ +#define MWU_PREGION_SUBS_SR6_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR6_Include (1UL) /*!< Include */ + +/* Bit 5 : Include or exclude subregion 5 in region */ +#define MWU_PREGION_SUBS_SR5_Pos (5UL) /*!< Position of SR5 field. */ +#define MWU_PREGION_SUBS_SR5_Msk (0x1UL << MWU_PREGION_SUBS_SR5_Pos) /*!< Bit mask of SR5 field. */ +#define MWU_PREGION_SUBS_SR5_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR5_Include (1UL) /*!< Include */ + +/* Bit 4 : Include or exclude subregion 4 in region */ +#define MWU_PREGION_SUBS_SR4_Pos (4UL) /*!< Position of SR4 field. */ +#define MWU_PREGION_SUBS_SR4_Msk (0x1UL << MWU_PREGION_SUBS_SR4_Pos) /*!< Bit mask of SR4 field. */ +#define MWU_PREGION_SUBS_SR4_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR4_Include (1UL) /*!< Include */ + +/* Bit 3 : Include or exclude subregion 3 in region */ +#define MWU_PREGION_SUBS_SR3_Pos (3UL) /*!< Position of SR3 field. */ +#define MWU_PREGION_SUBS_SR3_Msk (0x1UL << MWU_PREGION_SUBS_SR3_Pos) /*!< Bit mask of SR3 field. */ +#define MWU_PREGION_SUBS_SR3_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR3_Include (1UL) /*!< Include */ + +/* Bit 2 : Include or exclude subregion 2 in region */ +#define MWU_PREGION_SUBS_SR2_Pos (2UL) /*!< Position of SR2 field. */ +#define MWU_PREGION_SUBS_SR2_Msk (0x1UL << MWU_PREGION_SUBS_SR2_Pos) /*!< Bit mask of SR2 field. */ +#define MWU_PREGION_SUBS_SR2_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR2_Include (1UL) /*!< Include */ + +/* Bit 1 : Include or exclude subregion 1 in region */ +#define MWU_PREGION_SUBS_SR1_Pos (1UL) /*!< Position of SR1 field. */ +#define MWU_PREGION_SUBS_SR1_Msk (0x1UL << MWU_PREGION_SUBS_SR1_Pos) /*!< Bit mask of SR1 field. */ +#define MWU_PREGION_SUBS_SR1_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR1_Include (1UL) /*!< Include */ + +/* Bit 0 : Include or exclude subregion 0 in region */ +#define MWU_PREGION_SUBS_SR0_Pos (0UL) /*!< Position of SR0 field. */ +#define MWU_PREGION_SUBS_SR0_Msk (0x1UL << MWU_PREGION_SUBS_SR0_Pos) /*!< Bit mask of SR0 field. */ +#define MWU_PREGION_SUBS_SR0_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR0_Include (1UL) /*!< Include */ + + +/* Peripheral: NFCT */ +/* Description: NFC-A compatible radio */ + +/* Register: NFCT_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 1 : Shortcut between FIELDLOST event and SENSE task */ +#define NFCT_SHORTS_FIELDLOST_SENSE_Pos (1UL) /*!< Position of FIELDLOST_SENSE field. */ +#define NFCT_SHORTS_FIELDLOST_SENSE_Msk (0x1UL << NFCT_SHORTS_FIELDLOST_SENSE_Pos) /*!< Bit mask of FIELDLOST_SENSE field. */ +#define NFCT_SHORTS_FIELDLOST_SENSE_Disabled (0UL) /*!< Disable shortcut */ +#define NFCT_SHORTS_FIELDLOST_SENSE_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between FIELDDETECTED event and ACTIVATE task */ +#define NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Pos (0UL) /*!< Position of FIELDDETECTED_ACTIVATE field. */ +#define NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Msk (0x1UL << NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Pos) /*!< Bit mask of FIELDDETECTED_ACTIVATE field. */ +#define NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Disabled (0UL) /*!< Disable shortcut */ +#define NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: NFCT_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 20 : Enable or disable interrupt for STARTED event */ +#define NFCT_INTEN_STARTED_Pos (20UL) /*!< Position of STARTED field. */ +#define NFCT_INTEN_STARTED_Msk (0x1UL << NFCT_INTEN_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define NFCT_INTEN_STARTED_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_STARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for SELECTED event */ +#define NFCT_INTEN_SELECTED_Pos (19UL) /*!< Position of SELECTED field. */ +#define NFCT_INTEN_SELECTED_Msk (0x1UL << NFCT_INTEN_SELECTED_Pos) /*!< Bit mask of SELECTED field. */ +#define NFCT_INTEN_SELECTED_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_SELECTED_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable interrupt for COLLISION event */ +#define NFCT_INTEN_COLLISION_Pos (18UL) /*!< Position of COLLISION field. */ +#define NFCT_INTEN_COLLISION_Msk (0x1UL << NFCT_INTEN_COLLISION_Pos) /*!< Bit mask of COLLISION field. */ +#define NFCT_INTEN_COLLISION_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_COLLISION_Enabled (1UL) /*!< Enable */ + +/* Bit 14 : Enable or disable interrupt for AUTOCOLRESSTARTED event */ +#define NFCT_INTEN_AUTOCOLRESSTARTED_Pos (14UL) /*!< Position of AUTOCOLRESSTARTED field. */ +#define NFCT_INTEN_AUTOCOLRESSTARTED_Msk (0x1UL << NFCT_INTEN_AUTOCOLRESSTARTED_Pos) /*!< Bit mask of AUTOCOLRESSTARTED field. */ +#define NFCT_INTEN_AUTOCOLRESSTARTED_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_AUTOCOLRESSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 12 : Enable or disable interrupt for ENDTX event */ +#define NFCT_INTEN_ENDTX_Pos (12UL) /*!< Position of ENDTX field. */ +#define NFCT_INTEN_ENDTX_Msk (0x1UL << NFCT_INTEN_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define NFCT_INTEN_ENDTX_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_ENDTX_Enabled (1UL) /*!< Enable */ + +/* Bit 11 : Enable or disable interrupt for ENDRX event */ +#define NFCT_INTEN_ENDRX_Pos (11UL) /*!< Position of ENDRX field. */ +#define NFCT_INTEN_ENDRX_Msk (0x1UL << NFCT_INTEN_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define NFCT_INTEN_ENDRX_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_ENDRX_Enabled (1UL) /*!< Enable */ + +/* Bit 10 : Enable or disable interrupt for RXERROR event */ +#define NFCT_INTEN_RXERROR_Pos (10UL) /*!< Position of RXERROR field. */ +#define NFCT_INTEN_RXERROR_Msk (0x1UL << NFCT_INTEN_RXERROR_Pos) /*!< Bit mask of RXERROR field. */ +#define NFCT_INTEN_RXERROR_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_RXERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for ERROR event */ +#define NFCT_INTEN_ERROR_Pos (7UL) /*!< Position of ERROR field. */ +#define NFCT_INTEN_ERROR_Msk (0x1UL << NFCT_INTEN_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define NFCT_INTEN_ERROR_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_ERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for RXFRAMEEND event */ +#define NFCT_INTEN_RXFRAMEEND_Pos (6UL) /*!< Position of RXFRAMEEND field. */ +#define NFCT_INTEN_RXFRAMEEND_Msk (0x1UL << NFCT_INTEN_RXFRAMEEND_Pos) /*!< Bit mask of RXFRAMEEND field. */ +#define NFCT_INTEN_RXFRAMEEND_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_RXFRAMEEND_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for RXFRAMESTART event */ +#define NFCT_INTEN_RXFRAMESTART_Pos (5UL) /*!< Position of RXFRAMESTART field. */ +#define NFCT_INTEN_RXFRAMESTART_Msk (0x1UL << NFCT_INTEN_RXFRAMESTART_Pos) /*!< Bit mask of RXFRAMESTART field. */ +#define NFCT_INTEN_RXFRAMESTART_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_RXFRAMESTART_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for TXFRAMEEND event */ +#define NFCT_INTEN_TXFRAMEEND_Pos (4UL) /*!< Position of TXFRAMEEND field. */ +#define NFCT_INTEN_TXFRAMEEND_Msk (0x1UL << NFCT_INTEN_TXFRAMEEND_Pos) /*!< Bit mask of TXFRAMEEND field. */ +#define NFCT_INTEN_TXFRAMEEND_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_TXFRAMEEND_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for TXFRAMESTART event */ +#define NFCT_INTEN_TXFRAMESTART_Pos (3UL) /*!< Position of TXFRAMESTART field. */ +#define NFCT_INTEN_TXFRAMESTART_Msk (0x1UL << NFCT_INTEN_TXFRAMESTART_Pos) /*!< Bit mask of TXFRAMESTART field. */ +#define NFCT_INTEN_TXFRAMESTART_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_TXFRAMESTART_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for FIELDLOST event */ +#define NFCT_INTEN_FIELDLOST_Pos (2UL) /*!< Position of FIELDLOST field. */ +#define NFCT_INTEN_FIELDLOST_Msk (0x1UL << NFCT_INTEN_FIELDLOST_Pos) /*!< Bit mask of FIELDLOST field. */ +#define NFCT_INTEN_FIELDLOST_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_FIELDLOST_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for FIELDDETECTED event */ +#define NFCT_INTEN_FIELDDETECTED_Pos (1UL) /*!< Position of FIELDDETECTED field. */ +#define NFCT_INTEN_FIELDDETECTED_Msk (0x1UL << NFCT_INTEN_FIELDDETECTED_Pos) /*!< Bit mask of FIELDDETECTED field. */ +#define NFCT_INTEN_FIELDDETECTED_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_FIELDDETECTED_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for READY event */ +#define NFCT_INTEN_READY_Pos (0UL) /*!< Position of READY field. */ +#define NFCT_INTEN_READY_Msk (0x1UL << NFCT_INTEN_READY_Pos) /*!< Bit mask of READY field. */ +#define NFCT_INTEN_READY_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_READY_Enabled (1UL) /*!< Enable */ + +/* Register: NFCT_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 20 : Write '1' to Enable interrupt for STARTED event */ +#define NFCT_INTENSET_STARTED_Pos (20UL) /*!< Position of STARTED field. */ +#define NFCT_INTENSET_STARTED_Msk (0x1UL << NFCT_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define NFCT_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for SELECTED event */ +#define NFCT_INTENSET_SELECTED_Pos (19UL) /*!< Position of SELECTED field. */ +#define NFCT_INTENSET_SELECTED_Msk (0x1UL << NFCT_INTENSET_SELECTED_Pos) /*!< Bit mask of SELECTED field. */ +#define NFCT_INTENSET_SELECTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_SELECTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_SELECTED_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for COLLISION event */ +#define NFCT_INTENSET_COLLISION_Pos (18UL) /*!< Position of COLLISION field. */ +#define NFCT_INTENSET_COLLISION_Msk (0x1UL << NFCT_INTENSET_COLLISION_Pos) /*!< Bit mask of COLLISION field. */ +#define NFCT_INTENSET_COLLISION_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_COLLISION_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_COLLISION_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for AUTOCOLRESSTARTED event */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Pos (14UL) /*!< Position of AUTOCOLRESSTARTED field. */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Msk (0x1UL << NFCT_INTENSET_AUTOCOLRESSTARTED_Pos) /*!< Bit mask of AUTOCOLRESSTARTED field. */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for ENDTX event */ +#define NFCT_INTENSET_ENDTX_Pos (12UL) /*!< Position of ENDTX field. */ +#define NFCT_INTENSET_ENDTX_Msk (0x1UL << NFCT_INTENSET_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define NFCT_INTENSET_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_ENDTX_Set (1UL) /*!< Enable */ + +/* Bit 11 : Write '1' to Enable interrupt for ENDRX event */ +#define NFCT_INTENSET_ENDRX_Pos (11UL) /*!< Position of ENDRX field. */ +#define NFCT_INTENSET_ENDRX_Msk (0x1UL << NFCT_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define NFCT_INTENSET_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_ENDRX_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for RXERROR event */ +#define NFCT_INTENSET_RXERROR_Pos (10UL) /*!< Position of RXERROR field. */ +#define NFCT_INTENSET_RXERROR_Msk (0x1UL << NFCT_INTENSET_RXERROR_Pos) /*!< Bit mask of RXERROR field. */ +#define NFCT_INTENSET_RXERROR_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_RXERROR_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_RXERROR_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for ERROR event */ +#define NFCT_INTENSET_ERROR_Pos (7UL) /*!< Position of ERROR field. */ +#define NFCT_INTENSET_ERROR_Msk (0x1UL << NFCT_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define NFCT_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for RXFRAMEEND event */ +#define NFCT_INTENSET_RXFRAMEEND_Pos (6UL) /*!< Position of RXFRAMEEND field. */ +#define NFCT_INTENSET_RXFRAMEEND_Msk (0x1UL << NFCT_INTENSET_RXFRAMEEND_Pos) /*!< Bit mask of RXFRAMEEND field. */ +#define NFCT_INTENSET_RXFRAMEEND_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_RXFRAMEEND_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_RXFRAMEEND_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for RXFRAMESTART event */ +#define NFCT_INTENSET_RXFRAMESTART_Pos (5UL) /*!< Position of RXFRAMESTART field. */ +#define NFCT_INTENSET_RXFRAMESTART_Msk (0x1UL << NFCT_INTENSET_RXFRAMESTART_Pos) /*!< Bit mask of RXFRAMESTART field. */ +#define NFCT_INTENSET_RXFRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_RXFRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_RXFRAMESTART_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for TXFRAMEEND event */ +#define NFCT_INTENSET_TXFRAMEEND_Pos (4UL) /*!< Position of TXFRAMEEND field. */ +#define NFCT_INTENSET_TXFRAMEEND_Msk (0x1UL << NFCT_INTENSET_TXFRAMEEND_Pos) /*!< Bit mask of TXFRAMEEND field. */ +#define NFCT_INTENSET_TXFRAMEEND_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_TXFRAMEEND_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_TXFRAMEEND_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for TXFRAMESTART event */ +#define NFCT_INTENSET_TXFRAMESTART_Pos (3UL) /*!< Position of TXFRAMESTART field. */ +#define NFCT_INTENSET_TXFRAMESTART_Msk (0x1UL << NFCT_INTENSET_TXFRAMESTART_Pos) /*!< Bit mask of TXFRAMESTART field. */ +#define NFCT_INTENSET_TXFRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_TXFRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_TXFRAMESTART_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for FIELDLOST event */ +#define NFCT_INTENSET_FIELDLOST_Pos (2UL) /*!< Position of FIELDLOST field. */ +#define NFCT_INTENSET_FIELDLOST_Msk (0x1UL << NFCT_INTENSET_FIELDLOST_Pos) /*!< Bit mask of FIELDLOST field. */ +#define NFCT_INTENSET_FIELDLOST_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_FIELDLOST_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_FIELDLOST_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for FIELDDETECTED event */ +#define NFCT_INTENSET_FIELDDETECTED_Pos (1UL) /*!< Position of FIELDDETECTED field. */ +#define NFCT_INTENSET_FIELDDETECTED_Msk (0x1UL << NFCT_INTENSET_FIELDDETECTED_Pos) /*!< Bit mask of FIELDDETECTED field. */ +#define NFCT_INTENSET_FIELDDETECTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_FIELDDETECTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_FIELDDETECTED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define NFCT_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define NFCT_INTENSET_READY_Msk (0x1UL << NFCT_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define NFCT_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: NFCT_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 20 : Write '1' to Disable interrupt for STARTED event */ +#define NFCT_INTENCLR_STARTED_Pos (20UL) /*!< Position of STARTED field. */ +#define NFCT_INTENCLR_STARTED_Msk (0x1UL << NFCT_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define NFCT_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for SELECTED event */ +#define NFCT_INTENCLR_SELECTED_Pos (19UL) /*!< Position of SELECTED field. */ +#define NFCT_INTENCLR_SELECTED_Msk (0x1UL << NFCT_INTENCLR_SELECTED_Pos) /*!< Bit mask of SELECTED field. */ +#define NFCT_INTENCLR_SELECTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_SELECTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_SELECTED_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for COLLISION event */ +#define NFCT_INTENCLR_COLLISION_Pos (18UL) /*!< Position of COLLISION field. */ +#define NFCT_INTENCLR_COLLISION_Msk (0x1UL << NFCT_INTENCLR_COLLISION_Pos) /*!< Bit mask of COLLISION field. */ +#define NFCT_INTENCLR_COLLISION_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_COLLISION_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_COLLISION_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for AUTOCOLRESSTARTED event */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Pos (14UL) /*!< Position of AUTOCOLRESSTARTED field. */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Msk (0x1UL << NFCT_INTENCLR_AUTOCOLRESSTARTED_Pos) /*!< Bit mask of AUTOCOLRESSTARTED field. */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for ENDTX event */ +#define NFCT_INTENCLR_ENDTX_Pos (12UL) /*!< Position of ENDTX field. */ +#define NFCT_INTENCLR_ENDTX_Msk (0x1UL << NFCT_INTENCLR_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define NFCT_INTENCLR_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_ENDTX_Clear (1UL) /*!< Disable */ + +/* Bit 11 : Write '1' to Disable interrupt for ENDRX event */ +#define NFCT_INTENCLR_ENDRX_Pos (11UL) /*!< Position of ENDRX field. */ +#define NFCT_INTENCLR_ENDRX_Msk (0x1UL << NFCT_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define NFCT_INTENCLR_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for RXERROR event */ +#define NFCT_INTENCLR_RXERROR_Pos (10UL) /*!< Position of RXERROR field. */ +#define NFCT_INTENCLR_RXERROR_Msk (0x1UL << NFCT_INTENCLR_RXERROR_Pos) /*!< Bit mask of RXERROR field. */ +#define NFCT_INTENCLR_RXERROR_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_RXERROR_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_RXERROR_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for ERROR event */ +#define NFCT_INTENCLR_ERROR_Pos (7UL) /*!< Position of ERROR field. */ +#define NFCT_INTENCLR_ERROR_Msk (0x1UL << NFCT_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define NFCT_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for RXFRAMEEND event */ +#define NFCT_INTENCLR_RXFRAMEEND_Pos (6UL) /*!< Position of RXFRAMEEND field. */ +#define NFCT_INTENCLR_RXFRAMEEND_Msk (0x1UL << NFCT_INTENCLR_RXFRAMEEND_Pos) /*!< Bit mask of RXFRAMEEND field. */ +#define NFCT_INTENCLR_RXFRAMEEND_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_RXFRAMEEND_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_RXFRAMEEND_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for RXFRAMESTART event */ +#define NFCT_INTENCLR_RXFRAMESTART_Pos (5UL) /*!< Position of RXFRAMESTART field. */ +#define NFCT_INTENCLR_RXFRAMESTART_Msk (0x1UL << NFCT_INTENCLR_RXFRAMESTART_Pos) /*!< Bit mask of RXFRAMESTART field. */ +#define NFCT_INTENCLR_RXFRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_RXFRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_RXFRAMESTART_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for TXFRAMEEND event */ +#define NFCT_INTENCLR_TXFRAMEEND_Pos (4UL) /*!< Position of TXFRAMEEND field. */ +#define NFCT_INTENCLR_TXFRAMEEND_Msk (0x1UL << NFCT_INTENCLR_TXFRAMEEND_Pos) /*!< Bit mask of TXFRAMEEND field. */ +#define NFCT_INTENCLR_TXFRAMEEND_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_TXFRAMEEND_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_TXFRAMEEND_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for TXFRAMESTART event */ +#define NFCT_INTENCLR_TXFRAMESTART_Pos (3UL) /*!< Position of TXFRAMESTART field. */ +#define NFCT_INTENCLR_TXFRAMESTART_Msk (0x1UL << NFCT_INTENCLR_TXFRAMESTART_Pos) /*!< Bit mask of TXFRAMESTART field. */ +#define NFCT_INTENCLR_TXFRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_TXFRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_TXFRAMESTART_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for FIELDLOST event */ +#define NFCT_INTENCLR_FIELDLOST_Pos (2UL) /*!< Position of FIELDLOST field. */ +#define NFCT_INTENCLR_FIELDLOST_Msk (0x1UL << NFCT_INTENCLR_FIELDLOST_Pos) /*!< Bit mask of FIELDLOST field. */ +#define NFCT_INTENCLR_FIELDLOST_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_FIELDLOST_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_FIELDLOST_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for FIELDDETECTED event */ +#define NFCT_INTENCLR_FIELDDETECTED_Pos (1UL) /*!< Position of FIELDDETECTED field. */ +#define NFCT_INTENCLR_FIELDDETECTED_Msk (0x1UL << NFCT_INTENCLR_FIELDDETECTED_Pos) /*!< Bit mask of FIELDDETECTED field. */ +#define NFCT_INTENCLR_FIELDDETECTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_FIELDDETECTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_FIELDDETECTED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define NFCT_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define NFCT_INTENCLR_READY_Msk (0x1UL << NFCT_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define NFCT_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: NFCT_ERRORSTATUS */ +/* Description: NFC Error Status register */ + +/* Bit 3 : Field level is too low at min load resistance */ +#define NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Pos (3UL) /*!< Position of NFCFIELDTOOWEAK field. */ +#define NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk (0x1UL << NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Pos) /*!< Bit mask of NFCFIELDTOOWEAK field. */ + +/* Bit 2 : Field level is too high at max load resistance */ +#define NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Pos (2UL) /*!< Position of NFCFIELDTOOSTRONG field. */ +#define NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk (0x1UL << NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Pos) /*!< Bit mask of NFCFIELDTOOSTRONG field. */ + +/* Bit 0 : No STARTTX task triggered before expiration of the time set in FRAMEDELAYMAX */ +#define NFCT_ERRORSTATUS_FRAMEDELAYTIMEOUT_Pos (0UL) /*!< Position of FRAMEDELAYTIMEOUT field. */ +#define NFCT_ERRORSTATUS_FRAMEDELAYTIMEOUT_Msk (0x1UL << NFCT_ERRORSTATUS_FRAMEDELAYTIMEOUT_Pos) /*!< Bit mask of FRAMEDELAYTIMEOUT field. */ + +/* Register: NFCT_FRAMESTATUS_RX */ +/* Description: Result of last incoming frames */ + +/* Bit 3 : Overrun detected */ +#define NFCT_FRAMESTATUS_RX_OVERRUN_Pos (3UL) /*!< Position of OVERRUN field. */ +#define NFCT_FRAMESTATUS_RX_OVERRUN_Msk (0x1UL << NFCT_FRAMESTATUS_RX_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define NFCT_FRAMESTATUS_RX_OVERRUN_NoOverrun (0UL) /*!< No overrun detected */ +#define NFCT_FRAMESTATUS_RX_OVERRUN_Overrun (1UL) /*!< Overrun error */ + +/* Bit 2 : Parity status of received frame */ +#define NFCT_FRAMESTATUS_RX_PARITYSTATUS_Pos (2UL) /*!< Position of PARITYSTATUS field. */ +#define NFCT_FRAMESTATUS_RX_PARITYSTATUS_Msk (0x1UL << NFCT_FRAMESTATUS_RX_PARITYSTATUS_Pos) /*!< Bit mask of PARITYSTATUS field. */ +#define NFCT_FRAMESTATUS_RX_PARITYSTATUS_ParityOK (0UL) /*!< Frame received with parity OK */ +#define NFCT_FRAMESTATUS_RX_PARITYSTATUS_ParityError (1UL) /*!< Frame received with parity error */ + +/* Bit 0 : No valid End of Frame detected */ +#define NFCT_FRAMESTATUS_RX_CRCERROR_Pos (0UL) /*!< Position of CRCERROR field. */ +#define NFCT_FRAMESTATUS_RX_CRCERROR_Msk (0x1UL << NFCT_FRAMESTATUS_RX_CRCERROR_Pos) /*!< Bit mask of CRCERROR field. */ +#define NFCT_FRAMESTATUS_RX_CRCERROR_CRCCorrect (0UL) /*!< Valid CRC detected */ +#define NFCT_FRAMESTATUS_RX_CRCERROR_CRCError (1UL) /*!< CRC received does not match local check */ + +/* Register: NFCT_CURRENTLOADCTRL */ +/* Description: Current value driven to the NFC Load Control */ + +/* Bits 5..0 : Current value driven to the NFC Load Control */ +#define NFCT_CURRENTLOADCTRL_CURRENTLOADCTRL_Pos (0UL) /*!< Position of CURRENTLOADCTRL field. */ +#define NFCT_CURRENTLOADCTRL_CURRENTLOADCTRL_Msk (0x3FUL << NFCT_CURRENTLOADCTRL_CURRENTLOADCTRL_Pos) /*!< Bit mask of CURRENTLOADCTRL field. */ + +/* Register: NFCT_FIELDPRESENT */ +/* Description: Indicates the presence or not of a valid field */ + +/* Bit 1 : Indicates if the low level has locked to the field */ +#define NFCT_FIELDPRESENT_LOCKDETECT_Pos (1UL) /*!< Position of LOCKDETECT field. */ +#define NFCT_FIELDPRESENT_LOCKDETECT_Msk (0x1UL << NFCT_FIELDPRESENT_LOCKDETECT_Pos) /*!< Bit mask of LOCKDETECT field. */ +#define NFCT_FIELDPRESENT_LOCKDETECT_NotLocked (0UL) /*!< Not locked to field */ +#define NFCT_FIELDPRESENT_LOCKDETECT_Locked (1UL) /*!< Locked to field */ + +/* Bit 0 : Indicates the presence or not of a valid field. Available only in the activated state. */ +#define NFCT_FIELDPRESENT_FIELDPRESENT_Pos (0UL) /*!< Position of FIELDPRESENT field. */ +#define NFCT_FIELDPRESENT_FIELDPRESENT_Msk (0x1UL << NFCT_FIELDPRESENT_FIELDPRESENT_Pos) /*!< Bit mask of FIELDPRESENT field. */ +#define NFCT_FIELDPRESENT_FIELDPRESENT_NoField (0UL) /*!< No valid field detected */ +#define NFCT_FIELDPRESENT_FIELDPRESENT_FieldPresent (1UL) /*!< Valid field detected */ + +/* Register: NFCT_FRAMEDELAYMIN */ +/* Description: Minimum frame delay */ + +/* Bits 15..0 : Minimum frame delay in number of 13.56 MHz clocks */ +#define NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Pos (0UL) /*!< Position of FRAMEDELAYMIN field. */ +#define NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Msk (0xFFFFUL << NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Pos) /*!< Bit mask of FRAMEDELAYMIN field. */ + +/* Register: NFCT_FRAMEDELAYMAX */ +/* Description: Maximum frame delay */ + +/* Bits 15..0 : Maximum frame delay in number of 13.56 MHz clocks */ +#define NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Pos (0UL) /*!< Position of FRAMEDELAYMAX field. */ +#define NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Msk (0xFFFFUL << NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Pos) /*!< Bit mask of FRAMEDELAYMAX field. */ + +/* Register: NFCT_FRAMEDELAYMODE */ +/* Description: Configuration register for the Frame Delay Timer */ + +/* Bits 1..0 : Configuration register for the Frame Delay Timer */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Pos (0UL) /*!< Position of FRAMEDELAYMODE field. */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Msk (0x3UL << NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Pos) /*!< Bit mask of FRAMEDELAYMODE field. */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_FreeRun (0UL) /*!< Transmission is independent of frame timer and will start when the STARTTX task is triggered. No timeout. */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Window (1UL) /*!< Frame is transmitted between FRAMEDELAYMIN and FRAMEDELAYMAX */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_ExactVal (2UL) /*!< Frame is transmitted exactly at FRAMEDELAYMAX */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_WindowGrid (3UL) /*!< Frame is transmitted on a bit grid between FRAMEDELAYMIN and FRAMEDELAYMAX */ + +/* Register: NFCT_PACKETPTR */ +/* Description: Packet pointer for TXD and RXD data storage in Data RAM */ + +/* Bits 31..0 : Packet pointer for TXD and RXD data storage in Data RAM. This address is a byte aligned RAM address. */ +#define NFCT_PACKETPTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define NFCT_PACKETPTR_PTR_Msk (0xFFFFFFFFUL << NFCT_PACKETPTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: NFCT_MAXLEN */ +/* Description: Size of allocated for TXD and RXD data storage buffer in Data RAM */ + +/* Bits 8..0 : Size of allocated for TXD and RXD data storage buffer in Data RAM */ +#define NFCT_MAXLEN_MAXLEN_Pos (0UL) /*!< Position of MAXLEN field. */ +#define NFCT_MAXLEN_MAXLEN_Msk (0x1FFUL << NFCT_MAXLEN_MAXLEN_Pos) /*!< Bit mask of MAXLEN field. */ + +/* Register: NFCT_TXD_FRAMECONFIG */ +/* Description: Configuration of outgoing frames */ + +/* Bit 4 : CRC mode for outgoing frames */ +#define NFCT_TXD_FRAMECONFIG_CRCMODETX_Pos (4UL) /*!< Position of CRCMODETX field. */ +#define NFCT_TXD_FRAMECONFIG_CRCMODETX_Msk (0x1UL << NFCT_TXD_FRAMECONFIG_CRCMODETX_Pos) /*!< Bit mask of CRCMODETX field. */ +#define NFCT_TXD_FRAMECONFIG_CRCMODETX_NoCRCTX (0UL) /*!< CRC is not added to the frame */ +#define NFCT_TXD_FRAMECONFIG_CRCMODETX_CRC16TX (1UL) /*!< 16 bit CRC added to the frame based on all the data read from RAM that is used in the frame */ + +/* Bit 2 : Adding SoF or not in TX frames */ +#define NFCT_TXD_FRAMECONFIG_SOF_Pos (2UL) /*!< Position of SOF field. */ +#define NFCT_TXD_FRAMECONFIG_SOF_Msk (0x1UL << NFCT_TXD_FRAMECONFIG_SOF_Pos) /*!< Bit mask of SOF field. */ +#define NFCT_TXD_FRAMECONFIG_SOF_NoSoF (0UL) /*!< Start of Frame symbol not added */ +#define NFCT_TXD_FRAMECONFIG_SOF_SoF (1UL) /*!< Start of Frame symbol added */ + +/* Bit 1 : Discarding unused bits in start or at end of a Frame */ +#define NFCT_TXD_FRAMECONFIG_DISCARDMODE_Pos (1UL) /*!< Position of DISCARDMODE field. */ +#define NFCT_TXD_FRAMECONFIG_DISCARDMODE_Msk (0x1UL << NFCT_TXD_FRAMECONFIG_DISCARDMODE_Pos) /*!< Bit mask of DISCARDMODE field. */ +#define NFCT_TXD_FRAMECONFIG_DISCARDMODE_DiscardEnd (0UL) /*!< Unused bits is discarded at end of frame */ +#define NFCT_TXD_FRAMECONFIG_DISCARDMODE_DiscardStart (1UL) /*!< Unused bits is discarded at start of frame */ + +/* Bit 0 : Adding parity or not in the frame */ +#define NFCT_TXD_FRAMECONFIG_PARITY_Pos (0UL) /*!< Position of PARITY field. */ +#define NFCT_TXD_FRAMECONFIG_PARITY_Msk (0x1UL << NFCT_TXD_FRAMECONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define NFCT_TXD_FRAMECONFIG_PARITY_NoParity (0UL) /*!< Parity is not added in TX frames */ +#define NFCT_TXD_FRAMECONFIG_PARITY_Parity (1UL) /*!< Parity is added TX frames */ + +/* Register: NFCT_TXD_AMOUNT */ +/* Description: Size of outgoing frame */ + +/* Bits 11..3 : Number of complete bytes that shall be included in the frame, excluding CRC, parity and framing */ +#define NFCT_TXD_AMOUNT_TXDATABYTES_Pos (3UL) /*!< Position of TXDATABYTES field. */ +#define NFCT_TXD_AMOUNT_TXDATABYTES_Msk (0x1FFUL << NFCT_TXD_AMOUNT_TXDATABYTES_Pos) /*!< Bit mask of TXDATABYTES field. */ + +/* Bits 2..0 : Number of bits in the last or first byte read from RAM that shall be included in the frame (excluding parity bit). */ +#define NFCT_TXD_AMOUNT_TXDATABITS_Pos (0UL) /*!< Position of TXDATABITS field. */ +#define NFCT_TXD_AMOUNT_TXDATABITS_Msk (0x7UL << NFCT_TXD_AMOUNT_TXDATABITS_Pos) /*!< Bit mask of TXDATABITS field. */ + +/* Register: NFCT_RXD_FRAMECONFIG */ +/* Description: Configuration of incoming frames */ + +/* Bit 4 : CRC mode for incoming frames */ +#define NFCT_RXD_FRAMECONFIG_CRCMODERX_Pos (4UL) /*!< Position of CRCMODERX field. */ +#define NFCT_RXD_FRAMECONFIG_CRCMODERX_Msk (0x1UL << NFCT_RXD_FRAMECONFIG_CRCMODERX_Pos) /*!< Bit mask of CRCMODERX field. */ +#define NFCT_RXD_FRAMECONFIG_CRCMODERX_NoCRCRX (0UL) /*!< CRC is not expected in RX frames */ +#define NFCT_RXD_FRAMECONFIG_CRCMODERX_CRC16RX (1UL) /*!< Last 16 bits in RX frame is CRC, CRC is checked and CRCSTATUS updated */ + +/* Bit 2 : SoF expected or not in RX frames */ +#define NFCT_RXD_FRAMECONFIG_SOF_Pos (2UL) /*!< Position of SOF field. */ +#define NFCT_RXD_FRAMECONFIG_SOF_Msk (0x1UL << NFCT_RXD_FRAMECONFIG_SOF_Pos) /*!< Bit mask of SOF field. */ +#define NFCT_RXD_FRAMECONFIG_SOF_NoSoF (0UL) /*!< Start of Frame symbol is not expected in RX frames */ +#define NFCT_RXD_FRAMECONFIG_SOF_SoF (1UL) /*!< Start of Frame symbol is expected in RX frames */ + +/* Bit 0 : Parity expected or not in RX frame */ +#define NFCT_RXD_FRAMECONFIG_PARITY_Pos (0UL) /*!< Position of PARITY field. */ +#define NFCT_RXD_FRAMECONFIG_PARITY_Msk (0x1UL << NFCT_RXD_FRAMECONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define NFCT_RXD_FRAMECONFIG_PARITY_NoParity (0UL) /*!< Parity is not expected in RX frames */ +#define NFCT_RXD_FRAMECONFIG_PARITY_Parity (1UL) /*!< Parity is expected in RX frames */ + +/* Register: NFCT_RXD_AMOUNT */ +/* Description: Size of last incoming frame */ + +/* Bits 11..3 : Number of complete bytes received in the frame (including CRC, but excluding parity and SoF/EoF framing) */ +#define NFCT_RXD_AMOUNT_RXDATABYTES_Pos (3UL) /*!< Position of RXDATABYTES field. */ +#define NFCT_RXD_AMOUNT_RXDATABYTES_Msk (0x1FFUL << NFCT_RXD_AMOUNT_RXDATABYTES_Pos) /*!< Bit mask of RXDATABYTES field. */ + +/* Bits 2..0 : Number of bits in the last byte in the frame, if less than 8 (including CRC, but excluding parity and SoF/EoF framing). */ +#define NFCT_RXD_AMOUNT_RXDATABITS_Pos (0UL) /*!< Position of RXDATABITS field. */ +#define NFCT_RXD_AMOUNT_RXDATABITS_Msk (0x7UL << NFCT_RXD_AMOUNT_RXDATABITS_Pos) /*!< Bit mask of RXDATABITS field. */ + +/* Register: NFCT_NFCID1_LAST */ +/* Description: Last NFCID1 part (4, 7 or 10 bytes ID) */ + +/* Bits 31..24 : NFCID1 byte W */ +#define NFCT_NFCID1_LAST_NFCID1_W_Pos (24UL) /*!< Position of NFCID1_W field. */ +#define NFCT_NFCID1_LAST_NFCID1_W_Msk (0xFFUL << NFCT_NFCID1_LAST_NFCID1_W_Pos) /*!< Bit mask of NFCID1_W field. */ + +/* Bits 23..16 : NFCID1 byte X */ +#define NFCT_NFCID1_LAST_NFCID1_X_Pos (16UL) /*!< Position of NFCID1_X field. */ +#define NFCT_NFCID1_LAST_NFCID1_X_Msk (0xFFUL << NFCT_NFCID1_LAST_NFCID1_X_Pos) /*!< Bit mask of NFCID1_X field. */ + +/* Bits 15..8 : NFCID1 byte Y */ +#define NFCT_NFCID1_LAST_NFCID1_Y_Pos (8UL) /*!< Position of NFCID1_Y field. */ +#define NFCT_NFCID1_LAST_NFCID1_Y_Msk (0xFFUL << NFCT_NFCID1_LAST_NFCID1_Y_Pos) /*!< Bit mask of NFCID1_Y field. */ + +/* Bits 7..0 : NFCID1 byte Z (very last byte sent) */ +#define NFCT_NFCID1_LAST_NFCID1_Z_Pos (0UL) /*!< Position of NFCID1_Z field. */ +#define NFCT_NFCID1_LAST_NFCID1_Z_Msk (0xFFUL << NFCT_NFCID1_LAST_NFCID1_Z_Pos) /*!< Bit mask of NFCID1_Z field. */ + +/* Register: NFCT_NFCID1_2ND_LAST */ +/* Description: Second last NFCID1 part (7 or 10 bytes ID) */ + +/* Bits 23..16 : NFCID1 byte T */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_T_Pos (16UL) /*!< Position of NFCID1_T field. */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_T_Msk (0xFFUL << NFCT_NFCID1_2ND_LAST_NFCID1_T_Pos) /*!< Bit mask of NFCID1_T field. */ + +/* Bits 15..8 : NFCID1 byte U */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_U_Pos (8UL) /*!< Position of NFCID1_U field. */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_U_Msk (0xFFUL << NFCT_NFCID1_2ND_LAST_NFCID1_U_Pos) /*!< Bit mask of NFCID1_U field. */ + +/* Bits 7..0 : NFCID1 byte V */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_V_Pos (0UL) /*!< Position of NFCID1_V field. */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_V_Msk (0xFFUL << NFCT_NFCID1_2ND_LAST_NFCID1_V_Pos) /*!< Bit mask of NFCID1_V field. */ + +/* Register: NFCT_NFCID1_3RD_LAST */ +/* Description: Third last NFCID1 part (10 bytes ID) */ + +/* Bits 23..16 : NFCID1 byte Q */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_Q_Pos (16UL) /*!< Position of NFCID1_Q field. */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_Q_Msk (0xFFUL << NFCT_NFCID1_3RD_LAST_NFCID1_Q_Pos) /*!< Bit mask of NFCID1_Q field. */ + +/* Bits 15..8 : NFCID1 byte R */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_R_Pos (8UL) /*!< Position of NFCID1_R field. */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_R_Msk (0xFFUL << NFCT_NFCID1_3RD_LAST_NFCID1_R_Pos) /*!< Bit mask of NFCID1_R field. */ + +/* Bits 7..0 : NFCID1 byte S */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_S_Pos (0UL) /*!< Position of NFCID1_S field. */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_S_Msk (0xFFUL << NFCT_NFCID1_3RD_LAST_NFCID1_S_Pos) /*!< Bit mask of NFCID1_S field. */ + +/* Register: NFCT_SENSRES */ +/* Description: NFC-A SENS_RES auto-response settings */ + +/* Bits 15..12 : Reserved for future use. Shall be 0. */ +#define NFCT_SENSRES_RFU74_Pos (12UL) /*!< Position of RFU74 field. */ +#define NFCT_SENSRES_RFU74_Msk (0xFUL << NFCT_SENSRES_RFU74_Pos) /*!< Bit mask of RFU74 field. */ + +/* Bits 11..8 : Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification */ +#define NFCT_SENSRES_PLATFCONFIG_Pos (8UL) /*!< Position of PLATFCONFIG field. */ +#define NFCT_SENSRES_PLATFCONFIG_Msk (0xFUL << NFCT_SENSRES_PLATFCONFIG_Pos) /*!< Bit mask of PLATFCONFIG field. */ + +/* Bits 7..6 : NFCID1 size. This value is used by the Auto collision resolution engine. */ +#define NFCT_SENSRES_NFCIDSIZE_Pos (6UL) /*!< Position of NFCIDSIZE field. */ +#define NFCT_SENSRES_NFCIDSIZE_Msk (0x3UL << NFCT_SENSRES_NFCIDSIZE_Pos) /*!< Bit mask of NFCIDSIZE field. */ +#define NFCT_SENSRES_NFCIDSIZE_NFCID1Single (0UL) /*!< NFCID1 size: single (4 bytes) */ +#define NFCT_SENSRES_NFCIDSIZE_NFCID1Double (1UL) /*!< NFCID1 size: double (7 bytes) */ +#define NFCT_SENSRES_NFCIDSIZE_NFCID1Triple (2UL) /*!< NFCID1 size: triple (10 bytes) */ + +/* Bit 5 : Reserved for future use. Shall be 0. */ +#define NFCT_SENSRES_RFU5_Pos (5UL) /*!< Position of RFU5 field. */ +#define NFCT_SENSRES_RFU5_Msk (0x1UL << NFCT_SENSRES_RFU5_Pos) /*!< Bit mask of RFU5 field. */ + +/* Bits 4..0 : Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification */ +#define NFCT_SENSRES_BITFRAMESDD_Pos (0UL) /*!< Position of BITFRAMESDD field. */ +#define NFCT_SENSRES_BITFRAMESDD_Msk (0x1FUL << NFCT_SENSRES_BITFRAMESDD_Pos) /*!< Bit mask of BITFRAMESDD field. */ +#define NFCT_SENSRES_BITFRAMESDD_SDD00000 (0UL) /*!< SDD pattern 00000 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD00001 (1UL) /*!< SDD pattern 00001 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD00010 (2UL) /*!< SDD pattern 00010 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD00100 (4UL) /*!< SDD pattern 00100 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD01000 (8UL) /*!< SDD pattern 01000 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD10000 (16UL) /*!< SDD pattern 10000 */ + +/* Register: NFCT_SELRES */ +/* Description: NFC-A SEL_RES auto-response settings */ + +/* Bit 7 : Reserved for future use. Shall be 0. */ +#define NFCT_SELRES_RFU7_Pos (7UL) /*!< Position of RFU7 field. */ +#define NFCT_SELRES_RFU7_Msk (0x1UL << NFCT_SELRES_RFU7_Pos) /*!< Bit mask of RFU7 field. */ + +/* Bits 6..5 : Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification */ +#define NFCT_SELRES_PROTOCOL_Pos (5UL) /*!< Position of PROTOCOL field. */ +#define NFCT_SELRES_PROTOCOL_Msk (0x3UL << NFCT_SELRES_PROTOCOL_Pos) /*!< Bit mask of PROTOCOL field. */ + +/* Bits 4..3 : Reserved for future use. Shall be 0. */ +#define NFCT_SELRES_RFU43_Pos (3UL) /*!< Position of RFU43 field. */ +#define NFCT_SELRES_RFU43_Msk (0x3UL << NFCT_SELRES_RFU43_Pos) /*!< Bit mask of RFU43 field. */ + +/* Bit 2 : Cascade bit (controlled by hardware, write has no effect) */ +#define NFCT_SELRES_CASCADE_Pos (2UL) /*!< Position of CASCADE field. */ +#define NFCT_SELRES_CASCADE_Msk (0x1UL << NFCT_SELRES_CASCADE_Pos) /*!< Bit mask of CASCADE field. */ +#define NFCT_SELRES_CASCADE_Complete (0UL) /*!< NFCID1 complete */ +#define NFCT_SELRES_CASCADE_NotComplete (1UL) /*!< NFCID1 not complete */ + +/* Bits 1..0 : Reserved for future use. Shall be 0. */ +#define NFCT_SELRES_RFU10_Pos (0UL) /*!< Position of RFU10 field. */ +#define NFCT_SELRES_RFU10_Msk (0x3UL << NFCT_SELRES_RFU10_Pos) /*!< Bit mask of RFU10 field. */ + + +/* Peripheral: NVMC */ +/* Description: Non Volatile Memory Controller */ + +/* Register: NVMC_READY */ +/* Description: Ready flag */ + +/* Bit 0 : NVMC is ready or busy */ +#define NVMC_READY_READY_Pos (0UL) /*!< Position of READY field. */ +#define NVMC_READY_READY_Msk (0x1UL << NVMC_READY_READY_Pos) /*!< Bit mask of READY field. */ +#define NVMC_READY_READY_Busy (0UL) /*!< NVMC is busy (on-going write or erase operation) */ +#define NVMC_READY_READY_Ready (1UL) /*!< NVMC is ready */ + +/* Register: NVMC_CONFIG */ +/* Description: Configuration register */ + +/* Bits 1..0 : Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used. Enabling write or erase will invalidate the cache and keep it invalidated. */ +#define NVMC_CONFIG_WEN_Pos (0UL) /*!< Position of WEN field. */ +#define NVMC_CONFIG_WEN_Msk (0x3UL << NVMC_CONFIG_WEN_Pos) /*!< Bit mask of WEN field. */ +#define NVMC_CONFIG_WEN_Ren (0UL) /*!< Read only access */ +#define NVMC_CONFIG_WEN_Wen (1UL) /*!< Write Enabled */ +#define NVMC_CONFIG_WEN_Een (2UL) /*!< Erase enabled */ + +/* Register: NVMC_ERASEPAGE */ +/* Description: Register for erasing a page in Code area */ + +/* Bits 31..0 : Register for starting erase of a page in Code area */ +#define NVMC_ERASEPAGE_ERASEPAGE_Pos (0UL) /*!< Position of ERASEPAGE field. */ +#define NVMC_ERASEPAGE_ERASEPAGE_Msk (0xFFFFFFFFUL << NVMC_ERASEPAGE_ERASEPAGE_Pos) /*!< Bit mask of ERASEPAGE field. */ + +/* Register: NVMC_ERASEPCR1 */ +/* Description: Deprecated register - Register for erasing a page in Code area. Equivalent to ERASEPAGE. */ + +/* Bits 31..0 : Register for erasing a page in Code area. Equivalent to ERASEPAGE. */ +#define NVMC_ERASEPCR1_ERASEPCR1_Pos (0UL) /*!< Position of ERASEPCR1 field. */ +#define NVMC_ERASEPCR1_ERASEPCR1_Msk (0xFFFFFFFFUL << NVMC_ERASEPCR1_ERASEPCR1_Pos) /*!< Bit mask of ERASEPCR1 field. */ + +/* Register: NVMC_ERASEALL */ +/* Description: Register for erasing all non-volatile user memory */ + +/* Bit 0 : Erase all non-volatile memory including UICR registers. Note that code erase has to be enabled by CONFIG.EEN before the UICR can be erased. */ +#define NVMC_ERASEALL_ERASEALL_Pos (0UL) /*!< Position of ERASEALL field. */ +#define NVMC_ERASEALL_ERASEALL_Msk (0x1UL << NVMC_ERASEALL_ERASEALL_Pos) /*!< Bit mask of ERASEALL field. */ +#define NVMC_ERASEALL_ERASEALL_NoOperation (0UL) /*!< No operation */ +#define NVMC_ERASEALL_ERASEALL_Erase (1UL) /*!< Start chip erase */ + +/* Register: NVMC_ERASEPCR0 */ +/* Description: Deprecated register - Register for erasing a page in Code area. Equivalent to ERASEPAGE. */ + +/* Bits 31..0 : Register for starting erase of a page in Code area. Equivalent to ERASEPAGE. */ +#define NVMC_ERASEPCR0_ERASEPCR0_Pos (0UL) /*!< Position of ERASEPCR0 field. */ +#define NVMC_ERASEPCR0_ERASEPCR0_Msk (0xFFFFFFFFUL << NVMC_ERASEPCR0_ERASEPCR0_Pos) /*!< Bit mask of ERASEPCR0 field. */ + +/* Register: NVMC_ERASEUICR */ +/* Description: Register for erasing User Information Configuration Registers */ + +/* Bit 0 : Register starting erase of all User Information Configuration Registers. Note that code erase has to be enabled by CONFIG.EEN before the UICR can be erased. */ +#define NVMC_ERASEUICR_ERASEUICR_Pos (0UL) /*!< Position of ERASEUICR field. */ +#define NVMC_ERASEUICR_ERASEUICR_Msk (0x1UL << NVMC_ERASEUICR_ERASEUICR_Pos) /*!< Bit mask of ERASEUICR field. */ +#define NVMC_ERASEUICR_ERASEUICR_NoOperation (0UL) /*!< No operation */ +#define NVMC_ERASEUICR_ERASEUICR_Erase (1UL) /*!< Start erase of UICR */ + +/* Register: NVMC_ICACHECNF */ +/* Description: I-Code cache configuration register. */ + +/* Bit 8 : Cache profiling enable */ +#define NVMC_ICACHECNF_CACHEPROFEN_Pos (8UL) /*!< Position of CACHEPROFEN field. */ +#define NVMC_ICACHECNF_CACHEPROFEN_Msk (0x1UL << NVMC_ICACHECNF_CACHEPROFEN_Pos) /*!< Bit mask of CACHEPROFEN field. */ +#define NVMC_ICACHECNF_CACHEPROFEN_Disabled (0UL) /*!< Disable cache profiling */ +#define NVMC_ICACHECNF_CACHEPROFEN_Enabled (1UL) /*!< Enable cache profiling */ + +/* Bit 0 : Cache enable */ +#define NVMC_ICACHECNF_CACHEEN_Pos (0UL) /*!< Position of CACHEEN field. */ +#define NVMC_ICACHECNF_CACHEEN_Msk (0x1UL << NVMC_ICACHECNF_CACHEEN_Pos) /*!< Bit mask of CACHEEN field. */ +#define NVMC_ICACHECNF_CACHEEN_Disabled (0UL) /*!< Disable cache. Invalidates all cache entries. */ +#define NVMC_ICACHECNF_CACHEEN_Enabled (1UL) /*!< Enable cache */ + +/* Register: NVMC_IHIT */ +/* Description: I-Code cache hit counter. */ + +/* Bits 31..0 : Number of cache hits */ +#define NVMC_IHIT_HITS_Pos (0UL) /*!< Position of HITS field. */ +#define NVMC_IHIT_HITS_Msk (0xFFFFFFFFUL << NVMC_IHIT_HITS_Pos) /*!< Bit mask of HITS field. */ + +/* Register: NVMC_IMISS */ +/* Description: I-Code cache miss counter. */ + +/* Bits 31..0 : Number of cache misses */ +#define NVMC_IMISS_MISSES_Pos (0UL) /*!< Position of MISSES field. */ +#define NVMC_IMISS_MISSES_Msk (0xFFFFFFFFUL << NVMC_IMISS_MISSES_Pos) /*!< Bit mask of MISSES field. */ + + +/* Peripheral: GPIO */ +/* Description: GPIO Port 1 */ + +/* Register: GPIO_OUT */ +/* Description: Write GPIO port */ + +/* Bit 31 : P0.31 pin */ +#define GPIO_OUT_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUT_PIN31_Msk (0x1UL << GPIO_OUT_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUT_PIN31_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN31_High (1UL) /*!< Pin driver is high */ + +/* Bit 30 : P0.30 pin */ +#define GPIO_OUT_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUT_PIN30_Msk (0x1UL << GPIO_OUT_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUT_PIN30_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN30_High (1UL) /*!< Pin driver is high */ + +/* Bit 29 : P0.29 pin */ +#define GPIO_OUT_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUT_PIN29_Msk (0x1UL << GPIO_OUT_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUT_PIN29_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN29_High (1UL) /*!< Pin driver is high */ + +/* Bit 28 : P0.28 pin */ +#define GPIO_OUT_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUT_PIN28_Msk (0x1UL << GPIO_OUT_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUT_PIN28_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN28_High (1UL) /*!< Pin driver is high */ + +/* Bit 27 : P0.27 pin */ +#define GPIO_OUT_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUT_PIN27_Msk (0x1UL << GPIO_OUT_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUT_PIN27_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN27_High (1UL) /*!< Pin driver is high */ + +/* Bit 26 : P0.26 pin */ +#define GPIO_OUT_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUT_PIN26_Msk (0x1UL << GPIO_OUT_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUT_PIN26_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN26_High (1UL) /*!< Pin driver is high */ + +/* Bit 25 : P0.25 pin */ +#define GPIO_OUT_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUT_PIN25_Msk (0x1UL << GPIO_OUT_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUT_PIN25_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN25_High (1UL) /*!< Pin driver is high */ + +/* Bit 24 : P0.24 pin */ +#define GPIO_OUT_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUT_PIN24_Msk (0x1UL << GPIO_OUT_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUT_PIN24_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN24_High (1UL) /*!< Pin driver is high */ + +/* Bit 23 : P0.23 pin */ +#define GPIO_OUT_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUT_PIN23_Msk (0x1UL << GPIO_OUT_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUT_PIN23_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN23_High (1UL) /*!< Pin driver is high */ + +/* Bit 22 : P0.22 pin */ +#define GPIO_OUT_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUT_PIN22_Msk (0x1UL << GPIO_OUT_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUT_PIN22_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN22_High (1UL) /*!< Pin driver is high */ + +/* Bit 21 : P0.21 pin */ +#define GPIO_OUT_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUT_PIN21_Msk (0x1UL << GPIO_OUT_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUT_PIN21_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN21_High (1UL) /*!< Pin driver is high */ + +/* Bit 20 : P0.20 pin */ +#define GPIO_OUT_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUT_PIN20_Msk (0x1UL << GPIO_OUT_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUT_PIN20_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN20_High (1UL) /*!< Pin driver is high */ + +/* Bit 19 : P0.19 pin */ +#define GPIO_OUT_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUT_PIN19_Msk (0x1UL << GPIO_OUT_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUT_PIN19_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN19_High (1UL) /*!< Pin driver is high */ + +/* Bit 18 : P0.18 pin */ +#define GPIO_OUT_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUT_PIN18_Msk (0x1UL << GPIO_OUT_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUT_PIN18_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN18_High (1UL) /*!< Pin driver is high */ + +/* Bit 17 : P0.17 pin */ +#define GPIO_OUT_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUT_PIN17_Msk (0x1UL << GPIO_OUT_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUT_PIN17_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN17_High (1UL) /*!< Pin driver is high */ + +/* Bit 16 : P0.16 pin */ +#define GPIO_OUT_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUT_PIN16_Msk (0x1UL << GPIO_OUT_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUT_PIN16_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN16_High (1UL) /*!< Pin driver is high */ + +/* Bit 15 : P0.15 pin */ +#define GPIO_OUT_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUT_PIN15_Msk (0x1UL << GPIO_OUT_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUT_PIN15_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN15_High (1UL) /*!< Pin driver is high */ + +/* Bit 14 : P0.14 pin */ +#define GPIO_OUT_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUT_PIN14_Msk (0x1UL << GPIO_OUT_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUT_PIN14_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN14_High (1UL) /*!< Pin driver is high */ + +/* Bit 13 : P0.13 pin */ +#define GPIO_OUT_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUT_PIN13_Msk (0x1UL << GPIO_OUT_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUT_PIN13_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN13_High (1UL) /*!< Pin driver is high */ + +/* Bit 12 : P0.12 pin */ +#define GPIO_OUT_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUT_PIN12_Msk (0x1UL << GPIO_OUT_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUT_PIN12_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN12_High (1UL) /*!< Pin driver is high */ + +/* Bit 11 : P0.11 pin */ +#define GPIO_OUT_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUT_PIN11_Msk (0x1UL << GPIO_OUT_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUT_PIN11_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN11_High (1UL) /*!< Pin driver is high */ + +/* Bit 10 : P0.10 pin */ +#define GPIO_OUT_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUT_PIN10_Msk (0x1UL << GPIO_OUT_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUT_PIN10_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN10_High (1UL) /*!< Pin driver is high */ + +/* Bit 9 : P0.9 pin */ +#define GPIO_OUT_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUT_PIN9_Msk (0x1UL << GPIO_OUT_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUT_PIN9_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN9_High (1UL) /*!< Pin driver is high */ + +/* Bit 8 : P0.8 pin */ +#define GPIO_OUT_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUT_PIN8_Msk (0x1UL << GPIO_OUT_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUT_PIN8_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN8_High (1UL) /*!< Pin driver is high */ + +/* Bit 7 : P0.7 pin */ +#define GPIO_OUT_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUT_PIN7_Msk (0x1UL << GPIO_OUT_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUT_PIN7_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN7_High (1UL) /*!< Pin driver is high */ + +/* Bit 6 : P0.6 pin */ +#define GPIO_OUT_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUT_PIN6_Msk (0x1UL << GPIO_OUT_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUT_PIN6_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN6_High (1UL) /*!< Pin driver is high */ + +/* Bit 5 : P0.5 pin */ +#define GPIO_OUT_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUT_PIN5_Msk (0x1UL << GPIO_OUT_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUT_PIN5_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN5_High (1UL) /*!< Pin driver is high */ + +/* Bit 4 : P0.4 pin */ +#define GPIO_OUT_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUT_PIN4_Msk (0x1UL << GPIO_OUT_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUT_PIN4_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN4_High (1UL) /*!< Pin driver is high */ + +/* Bit 3 : P0.3 pin */ +#define GPIO_OUT_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUT_PIN3_Msk (0x1UL << GPIO_OUT_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUT_PIN3_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN3_High (1UL) /*!< Pin driver is high */ + +/* Bit 2 : P0.2 pin */ +#define GPIO_OUT_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUT_PIN2_Msk (0x1UL << GPIO_OUT_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUT_PIN2_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN2_High (1UL) /*!< Pin driver is high */ + +/* Bit 1 : P0.1 pin */ +#define GPIO_OUT_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUT_PIN1_Msk (0x1UL << GPIO_OUT_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUT_PIN1_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN1_High (1UL) /*!< Pin driver is high */ + +/* Bit 0 : P0.0 pin */ +#define GPIO_OUT_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUT_PIN0_Msk (0x1UL << GPIO_OUT_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUT_PIN0_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN0_High (1UL) /*!< Pin driver is high */ + +/* Register: GPIO_OUTSET */ +/* Description: Set individual bits in GPIO port */ + +/* Bit 31 : P0.31 pin */ +#define GPIO_OUTSET_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUTSET_PIN31_Msk (0x1UL << GPIO_OUTSET_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUTSET_PIN31_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN31_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN31_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 30 : P0.30 pin */ +#define GPIO_OUTSET_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUTSET_PIN30_Msk (0x1UL << GPIO_OUTSET_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUTSET_PIN30_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN30_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN30_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 29 : P0.29 pin */ +#define GPIO_OUTSET_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUTSET_PIN29_Msk (0x1UL << GPIO_OUTSET_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUTSET_PIN29_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN29_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN29_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 28 : P0.28 pin */ +#define GPIO_OUTSET_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUTSET_PIN28_Msk (0x1UL << GPIO_OUTSET_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUTSET_PIN28_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN28_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN28_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 27 : P0.27 pin */ +#define GPIO_OUTSET_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUTSET_PIN27_Msk (0x1UL << GPIO_OUTSET_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUTSET_PIN27_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN27_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN27_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 26 : P0.26 pin */ +#define GPIO_OUTSET_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUTSET_PIN26_Msk (0x1UL << GPIO_OUTSET_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUTSET_PIN26_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN26_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN26_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 25 : P0.25 pin */ +#define GPIO_OUTSET_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUTSET_PIN25_Msk (0x1UL << GPIO_OUTSET_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUTSET_PIN25_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN25_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN25_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 24 : P0.24 pin */ +#define GPIO_OUTSET_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUTSET_PIN24_Msk (0x1UL << GPIO_OUTSET_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUTSET_PIN24_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN24_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN24_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 23 : P0.23 pin */ +#define GPIO_OUTSET_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUTSET_PIN23_Msk (0x1UL << GPIO_OUTSET_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUTSET_PIN23_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN23_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN23_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 22 : P0.22 pin */ +#define GPIO_OUTSET_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUTSET_PIN22_Msk (0x1UL << GPIO_OUTSET_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUTSET_PIN22_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN22_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN22_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 21 : P0.21 pin */ +#define GPIO_OUTSET_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUTSET_PIN21_Msk (0x1UL << GPIO_OUTSET_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUTSET_PIN21_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN21_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN21_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 20 : P0.20 pin */ +#define GPIO_OUTSET_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUTSET_PIN20_Msk (0x1UL << GPIO_OUTSET_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUTSET_PIN20_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN20_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN20_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 19 : P0.19 pin */ +#define GPIO_OUTSET_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUTSET_PIN19_Msk (0x1UL << GPIO_OUTSET_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUTSET_PIN19_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN19_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN19_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 18 : P0.18 pin */ +#define GPIO_OUTSET_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUTSET_PIN18_Msk (0x1UL << GPIO_OUTSET_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUTSET_PIN18_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN18_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN18_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 17 : P0.17 pin */ +#define GPIO_OUTSET_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUTSET_PIN17_Msk (0x1UL << GPIO_OUTSET_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUTSET_PIN17_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN17_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN17_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 16 : P0.16 pin */ +#define GPIO_OUTSET_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUTSET_PIN16_Msk (0x1UL << GPIO_OUTSET_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUTSET_PIN16_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN16_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN16_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 15 : P0.15 pin */ +#define GPIO_OUTSET_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUTSET_PIN15_Msk (0x1UL << GPIO_OUTSET_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUTSET_PIN15_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN15_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN15_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 14 : P0.14 pin */ +#define GPIO_OUTSET_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUTSET_PIN14_Msk (0x1UL << GPIO_OUTSET_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUTSET_PIN14_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN14_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN14_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 13 : P0.13 pin */ +#define GPIO_OUTSET_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUTSET_PIN13_Msk (0x1UL << GPIO_OUTSET_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUTSET_PIN13_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN13_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN13_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 12 : P0.12 pin */ +#define GPIO_OUTSET_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUTSET_PIN12_Msk (0x1UL << GPIO_OUTSET_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUTSET_PIN12_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN12_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN12_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 11 : P0.11 pin */ +#define GPIO_OUTSET_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUTSET_PIN11_Msk (0x1UL << GPIO_OUTSET_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUTSET_PIN11_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN11_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN11_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 10 : P0.10 pin */ +#define GPIO_OUTSET_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUTSET_PIN10_Msk (0x1UL << GPIO_OUTSET_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUTSET_PIN10_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN10_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN10_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 9 : P0.9 pin */ +#define GPIO_OUTSET_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUTSET_PIN9_Msk (0x1UL << GPIO_OUTSET_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUTSET_PIN9_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN9_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN9_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 8 : P0.8 pin */ +#define GPIO_OUTSET_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUTSET_PIN8_Msk (0x1UL << GPIO_OUTSET_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUTSET_PIN8_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN8_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN8_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 7 : P0.7 pin */ +#define GPIO_OUTSET_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUTSET_PIN7_Msk (0x1UL << GPIO_OUTSET_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUTSET_PIN7_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN7_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN7_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 6 : P0.6 pin */ +#define GPIO_OUTSET_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUTSET_PIN6_Msk (0x1UL << GPIO_OUTSET_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUTSET_PIN6_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN6_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN6_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 5 : P0.5 pin */ +#define GPIO_OUTSET_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUTSET_PIN5_Msk (0x1UL << GPIO_OUTSET_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUTSET_PIN5_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN5_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN5_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 4 : P0.4 pin */ +#define GPIO_OUTSET_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUTSET_PIN4_Msk (0x1UL << GPIO_OUTSET_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUTSET_PIN4_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN4_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN4_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 3 : P0.3 pin */ +#define GPIO_OUTSET_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUTSET_PIN3_Msk (0x1UL << GPIO_OUTSET_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUTSET_PIN3_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN3_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN3_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 2 : P0.2 pin */ +#define GPIO_OUTSET_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUTSET_PIN2_Msk (0x1UL << GPIO_OUTSET_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUTSET_PIN2_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN2_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN2_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 1 : P0.1 pin */ +#define GPIO_OUTSET_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUTSET_PIN1_Msk (0x1UL << GPIO_OUTSET_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUTSET_PIN1_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN1_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN1_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 0 : P0.0 pin */ +#define GPIO_OUTSET_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUTSET_PIN0_Msk (0x1UL << GPIO_OUTSET_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUTSET_PIN0_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN0_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN0_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Register: GPIO_OUTCLR */ +/* Description: Clear individual bits in GPIO port */ + +/* Bit 31 : P0.31 pin */ +#define GPIO_OUTCLR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUTCLR_PIN31_Msk (0x1UL << GPIO_OUTCLR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUTCLR_PIN31_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN31_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN31_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 30 : P0.30 pin */ +#define GPIO_OUTCLR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUTCLR_PIN30_Msk (0x1UL << GPIO_OUTCLR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUTCLR_PIN30_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN30_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN30_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 29 : P0.29 pin */ +#define GPIO_OUTCLR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUTCLR_PIN29_Msk (0x1UL << GPIO_OUTCLR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUTCLR_PIN29_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN29_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN29_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 28 : P0.28 pin */ +#define GPIO_OUTCLR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUTCLR_PIN28_Msk (0x1UL << GPIO_OUTCLR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUTCLR_PIN28_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN28_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN28_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 27 : P0.27 pin */ +#define GPIO_OUTCLR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUTCLR_PIN27_Msk (0x1UL << GPIO_OUTCLR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUTCLR_PIN27_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN27_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN27_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 26 : P0.26 pin */ +#define GPIO_OUTCLR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUTCLR_PIN26_Msk (0x1UL << GPIO_OUTCLR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUTCLR_PIN26_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN26_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN26_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 25 : P0.25 pin */ +#define GPIO_OUTCLR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUTCLR_PIN25_Msk (0x1UL << GPIO_OUTCLR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUTCLR_PIN25_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN25_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN25_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 24 : P0.24 pin */ +#define GPIO_OUTCLR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUTCLR_PIN24_Msk (0x1UL << GPIO_OUTCLR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUTCLR_PIN24_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN24_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN24_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 23 : P0.23 pin */ +#define GPIO_OUTCLR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUTCLR_PIN23_Msk (0x1UL << GPIO_OUTCLR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUTCLR_PIN23_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN23_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN23_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 22 : P0.22 pin */ +#define GPIO_OUTCLR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUTCLR_PIN22_Msk (0x1UL << GPIO_OUTCLR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUTCLR_PIN22_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN22_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN22_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 21 : P0.21 pin */ +#define GPIO_OUTCLR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUTCLR_PIN21_Msk (0x1UL << GPIO_OUTCLR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUTCLR_PIN21_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN21_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN21_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 20 : P0.20 pin */ +#define GPIO_OUTCLR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUTCLR_PIN20_Msk (0x1UL << GPIO_OUTCLR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUTCLR_PIN20_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN20_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN20_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 19 : P0.19 pin */ +#define GPIO_OUTCLR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUTCLR_PIN19_Msk (0x1UL << GPIO_OUTCLR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUTCLR_PIN19_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN19_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN19_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 18 : P0.18 pin */ +#define GPIO_OUTCLR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUTCLR_PIN18_Msk (0x1UL << GPIO_OUTCLR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUTCLR_PIN18_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN18_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN18_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 17 : P0.17 pin */ +#define GPIO_OUTCLR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUTCLR_PIN17_Msk (0x1UL << GPIO_OUTCLR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUTCLR_PIN17_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN17_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN17_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 16 : P0.16 pin */ +#define GPIO_OUTCLR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUTCLR_PIN16_Msk (0x1UL << GPIO_OUTCLR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUTCLR_PIN16_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN16_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN16_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 15 : P0.15 pin */ +#define GPIO_OUTCLR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUTCLR_PIN15_Msk (0x1UL << GPIO_OUTCLR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUTCLR_PIN15_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN15_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN15_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 14 : P0.14 pin */ +#define GPIO_OUTCLR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUTCLR_PIN14_Msk (0x1UL << GPIO_OUTCLR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUTCLR_PIN14_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN14_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN14_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 13 : P0.13 pin */ +#define GPIO_OUTCLR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUTCLR_PIN13_Msk (0x1UL << GPIO_OUTCLR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUTCLR_PIN13_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN13_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN13_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 12 : P0.12 pin */ +#define GPIO_OUTCLR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUTCLR_PIN12_Msk (0x1UL << GPIO_OUTCLR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUTCLR_PIN12_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN12_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN12_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 11 : P0.11 pin */ +#define GPIO_OUTCLR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUTCLR_PIN11_Msk (0x1UL << GPIO_OUTCLR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUTCLR_PIN11_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN11_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN11_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 10 : P0.10 pin */ +#define GPIO_OUTCLR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUTCLR_PIN10_Msk (0x1UL << GPIO_OUTCLR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUTCLR_PIN10_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN10_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN10_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 9 : P0.9 pin */ +#define GPIO_OUTCLR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUTCLR_PIN9_Msk (0x1UL << GPIO_OUTCLR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUTCLR_PIN9_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN9_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN9_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 8 : P0.8 pin */ +#define GPIO_OUTCLR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUTCLR_PIN8_Msk (0x1UL << GPIO_OUTCLR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUTCLR_PIN8_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN8_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN8_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 7 : P0.7 pin */ +#define GPIO_OUTCLR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUTCLR_PIN7_Msk (0x1UL << GPIO_OUTCLR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUTCLR_PIN7_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN7_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN7_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 6 : P0.6 pin */ +#define GPIO_OUTCLR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUTCLR_PIN6_Msk (0x1UL << GPIO_OUTCLR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUTCLR_PIN6_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN6_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN6_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 5 : P0.5 pin */ +#define GPIO_OUTCLR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUTCLR_PIN5_Msk (0x1UL << GPIO_OUTCLR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUTCLR_PIN5_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN5_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN5_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 4 : P0.4 pin */ +#define GPIO_OUTCLR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUTCLR_PIN4_Msk (0x1UL << GPIO_OUTCLR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUTCLR_PIN4_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN4_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN4_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 3 : P0.3 pin */ +#define GPIO_OUTCLR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUTCLR_PIN3_Msk (0x1UL << GPIO_OUTCLR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUTCLR_PIN3_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN3_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN3_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 2 : P0.2 pin */ +#define GPIO_OUTCLR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUTCLR_PIN2_Msk (0x1UL << GPIO_OUTCLR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUTCLR_PIN2_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN2_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN2_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 1 : P0.1 pin */ +#define GPIO_OUTCLR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUTCLR_PIN1_Msk (0x1UL << GPIO_OUTCLR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUTCLR_PIN1_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN1_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN1_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 0 : P0.0 pin */ +#define GPIO_OUTCLR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUTCLR_PIN0_Msk (0x1UL << GPIO_OUTCLR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUTCLR_PIN0_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN0_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN0_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Register: GPIO_IN */ +/* Description: Read GPIO port */ + +/* Bit 31 : P0.31 pin */ +#define GPIO_IN_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_IN_PIN31_Msk (0x1UL << GPIO_IN_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_IN_PIN31_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN31_High (1UL) /*!< Pin input is high */ + +/* Bit 30 : P0.30 pin */ +#define GPIO_IN_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_IN_PIN30_Msk (0x1UL << GPIO_IN_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_IN_PIN30_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN30_High (1UL) /*!< Pin input is high */ + +/* Bit 29 : P0.29 pin */ +#define GPIO_IN_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_IN_PIN29_Msk (0x1UL << GPIO_IN_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_IN_PIN29_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN29_High (1UL) /*!< Pin input is high */ + +/* Bit 28 : P0.28 pin */ +#define GPIO_IN_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_IN_PIN28_Msk (0x1UL << GPIO_IN_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_IN_PIN28_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN28_High (1UL) /*!< Pin input is high */ + +/* Bit 27 : P0.27 pin */ +#define GPIO_IN_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_IN_PIN27_Msk (0x1UL << GPIO_IN_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_IN_PIN27_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN27_High (1UL) /*!< Pin input is high */ + +/* Bit 26 : P0.26 pin */ +#define GPIO_IN_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_IN_PIN26_Msk (0x1UL << GPIO_IN_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_IN_PIN26_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN26_High (1UL) /*!< Pin input is high */ + +/* Bit 25 : P0.25 pin */ +#define GPIO_IN_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_IN_PIN25_Msk (0x1UL << GPIO_IN_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_IN_PIN25_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN25_High (1UL) /*!< Pin input is high */ + +/* Bit 24 : P0.24 pin */ +#define GPIO_IN_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_IN_PIN24_Msk (0x1UL << GPIO_IN_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_IN_PIN24_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN24_High (1UL) /*!< Pin input is high */ + +/* Bit 23 : P0.23 pin */ +#define GPIO_IN_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_IN_PIN23_Msk (0x1UL << GPIO_IN_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_IN_PIN23_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN23_High (1UL) /*!< Pin input is high */ + +/* Bit 22 : P0.22 pin */ +#define GPIO_IN_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_IN_PIN22_Msk (0x1UL << GPIO_IN_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_IN_PIN22_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN22_High (1UL) /*!< Pin input is high */ + +/* Bit 21 : P0.21 pin */ +#define GPIO_IN_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_IN_PIN21_Msk (0x1UL << GPIO_IN_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_IN_PIN21_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN21_High (1UL) /*!< Pin input is high */ + +/* Bit 20 : P0.20 pin */ +#define GPIO_IN_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_IN_PIN20_Msk (0x1UL << GPIO_IN_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_IN_PIN20_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN20_High (1UL) /*!< Pin input is high */ + +/* Bit 19 : P0.19 pin */ +#define GPIO_IN_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_IN_PIN19_Msk (0x1UL << GPIO_IN_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_IN_PIN19_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN19_High (1UL) /*!< Pin input is high */ + +/* Bit 18 : P0.18 pin */ +#define GPIO_IN_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_IN_PIN18_Msk (0x1UL << GPIO_IN_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_IN_PIN18_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN18_High (1UL) /*!< Pin input is high */ + +/* Bit 17 : P0.17 pin */ +#define GPIO_IN_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_IN_PIN17_Msk (0x1UL << GPIO_IN_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_IN_PIN17_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN17_High (1UL) /*!< Pin input is high */ + +/* Bit 16 : P0.16 pin */ +#define GPIO_IN_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_IN_PIN16_Msk (0x1UL << GPIO_IN_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_IN_PIN16_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN16_High (1UL) /*!< Pin input is high */ + +/* Bit 15 : P0.15 pin */ +#define GPIO_IN_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_IN_PIN15_Msk (0x1UL << GPIO_IN_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_IN_PIN15_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN15_High (1UL) /*!< Pin input is high */ + +/* Bit 14 : P0.14 pin */ +#define GPIO_IN_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_IN_PIN14_Msk (0x1UL << GPIO_IN_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_IN_PIN14_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN14_High (1UL) /*!< Pin input is high */ + +/* Bit 13 : P0.13 pin */ +#define GPIO_IN_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_IN_PIN13_Msk (0x1UL << GPIO_IN_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_IN_PIN13_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN13_High (1UL) /*!< Pin input is high */ + +/* Bit 12 : P0.12 pin */ +#define GPIO_IN_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_IN_PIN12_Msk (0x1UL << GPIO_IN_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_IN_PIN12_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN12_High (1UL) /*!< Pin input is high */ + +/* Bit 11 : P0.11 pin */ +#define GPIO_IN_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_IN_PIN11_Msk (0x1UL << GPIO_IN_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_IN_PIN11_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN11_High (1UL) /*!< Pin input is high */ + +/* Bit 10 : P0.10 pin */ +#define GPIO_IN_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_IN_PIN10_Msk (0x1UL << GPIO_IN_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_IN_PIN10_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN10_High (1UL) /*!< Pin input is high */ + +/* Bit 9 : P0.9 pin */ +#define GPIO_IN_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_IN_PIN9_Msk (0x1UL << GPIO_IN_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_IN_PIN9_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN9_High (1UL) /*!< Pin input is high */ + +/* Bit 8 : P0.8 pin */ +#define GPIO_IN_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_IN_PIN8_Msk (0x1UL << GPIO_IN_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_IN_PIN8_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN8_High (1UL) /*!< Pin input is high */ + +/* Bit 7 : P0.7 pin */ +#define GPIO_IN_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_IN_PIN7_Msk (0x1UL << GPIO_IN_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_IN_PIN7_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN7_High (1UL) /*!< Pin input is high */ + +/* Bit 6 : P0.6 pin */ +#define GPIO_IN_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_IN_PIN6_Msk (0x1UL << GPIO_IN_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_IN_PIN6_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN6_High (1UL) /*!< Pin input is high */ + +/* Bit 5 : P0.5 pin */ +#define GPIO_IN_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_IN_PIN5_Msk (0x1UL << GPIO_IN_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_IN_PIN5_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN5_High (1UL) /*!< Pin input is high */ + +/* Bit 4 : P0.4 pin */ +#define GPIO_IN_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_IN_PIN4_Msk (0x1UL << GPIO_IN_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_IN_PIN4_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN4_High (1UL) /*!< Pin input is high */ + +/* Bit 3 : P0.3 pin */ +#define GPIO_IN_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_IN_PIN3_Msk (0x1UL << GPIO_IN_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_IN_PIN3_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN3_High (1UL) /*!< Pin input is high */ + +/* Bit 2 : P0.2 pin */ +#define GPIO_IN_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_IN_PIN2_Msk (0x1UL << GPIO_IN_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_IN_PIN2_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN2_High (1UL) /*!< Pin input is high */ + +/* Bit 1 : P0.1 pin */ +#define GPIO_IN_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_IN_PIN1_Msk (0x1UL << GPIO_IN_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_IN_PIN1_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN1_High (1UL) /*!< Pin input is high */ + +/* Bit 0 : P0.0 pin */ +#define GPIO_IN_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_IN_PIN0_Msk (0x1UL << GPIO_IN_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_IN_PIN0_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN0_High (1UL) /*!< Pin input is high */ + +/* Register: GPIO_DIR */ +/* Description: Direction of GPIO pins */ + +/* Bit 31 : P0.31 pin */ +#define GPIO_DIR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIR_PIN31_Msk (0x1UL << GPIO_DIR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIR_PIN31_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN31_Output (1UL) /*!< Pin set as output */ + +/* Bit 30 : P0.30 pin */ +#define GPIO_DIR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIR_PIN30_Msk (0x1UL << GPIO_DIR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIR_PIN30_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN30_Output (1UL) /*!< Pin set as output */ + +/* Bit 29 : P0.29 pin */ +#define GPIO_DIR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIR_PIN29_Msk (0x1UL << GPIO_DIR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIR_PIN29_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN29_Output (1UL) /*!< Pin set as output */ + +/* Bit 28 : P0.28 pin */ +#define GPIO_DIR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIR_PIN28_Msk (0x1UL << GPIO_DIR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIR_PIN28_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN28_Output (1UL) /*!< Pin set as output */ + +/* Bit 27 : P0.27 pin */ +#define GPIO_DIR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIR_PIN27_Msk (0x1UL << GPIO_DIR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIR_PIN27_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN27_Output (1UL) /*!< Pin set as output */ + +/* Bit 26 : P0.26 pin */ +#define GPIO_DIR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIR_PIN26_Msk (0x1UL << GPIO_DIR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIR_PIN26_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN26_Output (1UL) /*!< Pin set as output */ + +/* Bit 25 : P0.25 pin */ +#define GPIO_DIR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIR_PIN25_Msk (0x1UL << GPIO_DIR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIR_PIN25_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN25_Output (1UL) /*!< Pin set as output */ + +/* Bit 24 : P0.24 pin */ +#define GPIO_DIR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIR_PIN24_Msk (0x1UL << GPIO_DIR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIR_PIN24_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN24_Output (1UL) /*!< Pin set as output */ + +/* Bit 23 : P0.23 pin */ +#define GPIO_DIR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIR_PIN23_Msk (0x1UL << GPIO_DIR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIR_PIN23_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN23_Output (1UL) /*!< Pin set as output */ + +/* Bit 22 : P0.22 pin */ +#define GPIO_DIR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIR_PIN22_Msk (0x1UL << GPIO_DIR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIR_PIN22_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN22_Output (1UL) /*!< Pin set as output */ + +/* Bit 21 : P0.21 pin */ +#define GPIO_DIR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIR_PIN21_Msk (0x1UL << GPIO_DIR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIR_PIN21_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN21_Output (1UL) /*!< Pin set as output */ + +/* Bit 20 : P0.20 pin */ +#define GPIO_DIR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIR_PIN20_Msk (0x1UL << GPIO_DIR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIR_PIN20_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN20_Output (1UL) /*!< Pin set as output */ + +/* Bit 19 : P0.19 pin */ +#define GPIO_DIR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIR_PIN19_Msk (0x1UL << GPIO_DIR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIR_PIN19_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN19_Output (1UL) /*!< Pin set as output */ + +/* Bit 18 : P0.18 pin */ +#define GPIO_DIR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIR_PIN18_Msk (0x1UL << GPIO_DIR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIR_PIN18_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN18_Output (1UL) /*!< Pin set as output */ + +/* Bit 17 : P0.17 pin */ +#define GPIO_DIR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIR_PIN17_Msk (0x1UL << GPIO_DIR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIR_PIN17_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN17_Output (1UL) /*!< Pin set as output */ + +/* Bit 16 : P0.16 pin */ +#define GPIO_DIR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIR_PIN16_Msk (0x1UL << GPIO_DIR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIR_PIN16_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN16_Output (1UL) /*!< Pin set as output */ + +/* Bit 15 : P0.15 pin */ +#define GPIO_DIR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIR_PIN15_Msk (0x1UL << GPIO_DIR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIR_PIN15_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN15_Output (1UL) /*!< Pin set as output */ + +/* Bit 14 : P0.14 pin */ +#define GPIO_DIR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIR_PIN14_Msk (0x1UL << GPIO_DIR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIR_PIN14_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN14_Output (1UL) /*!< Pin set as output */ + +/* Bit 13 : P0.13 pin */ +#define GPIO_DIR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIR_PIN13_Msk (0x1UL << GPIO_DIR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIR_PIN13_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN13_Output (1UL) /*!< Pin set as output */ + +/* Bit 12 : P0.12 pin */ +#define GPIO_DIR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIR_PIN12_Msk (0x1UL << GPIO_DIR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIR_PIN12_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN12_Output (1UL) /*!< Pin set as output */ + +/* Bit 11 : P0.11 pin */ +#define GPIO_DIR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIR_PIN11_Msk (0x1UL << GPIO_DIR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIR_PIN11_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN11_Output (1UL) /*!< Pin set as output */ + +/* Bit 10 : P0.10 pin */ +#define GPIO_DIR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIR_PIN10_Msk (0x1UL << GPIO_DIR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIR_PIN10_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN10_Output (1UL) /*!< Pin set as output */ + +/* Bit 9 : P0.9 pin */ +#define GPIO_DIR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIR_PIN9_Msk (0x1UL << GPIO_DIR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIR_PIN9_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN9_Output (1UL) /*!< Pin set as output */ + +/* Bit 8 : P0.8 pin */ +#define GPIO_DIR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIR_PIN8_Msk (0x1UL << GPIO_DIR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIR_PIN8_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN8_Output (1UL) /*!< Pin set as output */ + +/* Bit 7 : P0.7 pin */ +#define GPIO_DIR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIR_PIN7_Msk (0x1UL << GPIO_DIR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIR_PIN7_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN7_Output (1UL) /*!< Pin set as output */ + +/* Bit 6 : P0.6 pin */ +#define GPIO_DIR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIR_PIN6_Msk (0x1UL << GPIO_DIR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIR_PIN6_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN6_Output (1UL) /*!< Pin set as output */ + +/* Bit 5 : P0.5 pin */ +#define GPIO_DIR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIR_PIN5_Msk (0x1UL << GPIO_DIR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIR_PIN5_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN5_Output (1UL) /*!< Pin set as output */ + +/* Bit 4 : P0.4 pin */ +#define GPIO_DIR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIR_PIN4_Msk (0x1UL << GPIO_DIR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIR_PIN4_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN4_Output (1UL) /*!< Pin set as output */ + +/* Bit 3 : P0.3 pin */ +#define GPIO_DIR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIR_PIN3_Msk (0x1UL << GPIO_DIR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIR_PIN3_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN3_Output (1UL) /*!< Pin set as output */ + +/* Bit 2 : P0.2 pin */ +#define GPIO_DIR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIR_PIN2_Msk (0x1UL << GPIO_DIR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIR_PIN2_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN2_Output (1UL) /*!< Pin set as output */ + +/* Bit 1 : P0.1 pin */ +#define GPIO_DIR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIR_PIN1_Msk (0x1UL << GPIO_DIR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIR_PIN1_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN1_Output (1UL) /*!< Pin set as output */ + +/* Bit 0 : P0.0 pin */ +#define GPIO_DIR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIR_PIN0_Msk (0x1UL << GPIO_DIR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIR_PIN0_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN0_Output (1UL) /*!< Pin set as output */ + +/* Register: GPIO_DIRSET */ +/* Description: DIR set register */ + +/* Bit 31 : Set as output pin 31 */ +#define GPIO_DIRSET_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIRSET_PIN31_Msk (0x1UL << GPIO_DIRSET_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIRSET_PIN31_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN31_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN31_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 30 : Set as output pin 30 */ +#define GPIO_DIRSET_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIRSET_PIN30_Msk (0x1UL << GPIO_DIRSET_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIRSET_PIN30_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN30_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN30_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 29 : Set as output pin 29 */ +#define GPIO_DIRSET_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIRSET_PIN29_Msk (0x1UL << GPIO_DIRSET_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIRSET_PIN29_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN29_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN29_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 28 : Set as output pin 28 */ +#define GPIO_DIRSET_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIRSET_PIN28_Msk (0x1UL << GPIO_DIRSET_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIRSET_PIN28_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN28_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN28_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 27 : Set as output pin 27 */ +#define GPIO_DIRSET_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIRSET_PIN27_Msk (0x1UL << GPIO_DIRSET_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIRSET_PIN27_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN27_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN27_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 26 : Set as output pin 26 */ +#define GPIO_DIRSET_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIRSET_PIN26_Msk (0x1UL << GPIO_DIRSET_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIRSET_PIN26_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN26_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN26_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 25 : Set as output pin 25 */ +#define GPIO_DIRSET_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIRSET_PIN25_Msk (0x1UL << GPIO_DIRSET_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIRSET_PIN25_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN25_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN25_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 24 : Set as output pin 24 */ +#define GPIO_DIRSET_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIRSET_PIN24_Msk (0x1UL << GPIO_DIRSET_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIRSET_PIN24_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN24_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN24_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 23 : Set as output pin 23 */ +#define GPIO_DIRSET_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIRSET_PIN23_Msk (0x1UL << GPIO_DIRSET_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIRSET_PIN23_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN23_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN23_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 22 : Set as output pin 22 */ +#define GPIO_DIRSET_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIRSET_PIN22_Msk (0x1UL << GPIO_DIRSET_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIRSET_PIN22_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN22_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN22_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 21 : Set as output pin 21 */ +#define GPIO_DIRSET_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIRSET_PIN21_Msk (0x1UL << GPIO_DIRSET_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIRSET_PIN21_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN21_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN21_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 20 : Set as output pin 20 */ +#define GPIO_DIRSET_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIRSET_PIN20_Msk (0x1UL << GPIO_DIRSET_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIRSET_PIN20_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN20_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN20_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 19 : Set as output pin 19 */ +#define GPIO_DIRSET_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIRSET_PIN19_Msk (0x1UL << GPIO_DIRSET_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIRSET_PIN19_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN19_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN19_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 18 : Set as output pin 18 */ +#define GPIO_DIRSET_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIRSET_PIN18_Msk (0x1UL << GPIO_DIRSET_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIRSET_PIN18_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN18_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN18_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 17 : Set as output pin 17 */ +#define GPIO_DIRSET_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIRSET_PIN17_Msk (0x1UL << GPIO_DIRSET_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIRSET_PIN17_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN17_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN17_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 16 : Set as output pin 16 */ +#define GPIO_DIRSET_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIRSET_PIN16_Msk (0x1UL << GPIO_DIRSET_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIRSET_PIN16_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN16_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN16_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 15 : Set as output pin 15 */ +#define GPIO_DIRSET_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIRSET_PIN15_Msk (0x1UL << GPIO_DIRSET_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIRSET_PIN15_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN15_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN15_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 14 : Set as output pin 14 */ +#define GPIO_DIRSET_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIRSET_PIN14_Msk (0x1UL << GPIO_DIRSET_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIRSET_PIN14_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN14_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN14_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 13 : Set as output pin 13 */ +#define GPIO_DIRSET_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIRSET_PIN13_Msk (0x1UL << GPIO_DIRSET_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIRSET_PIN13_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN13_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN13_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 12 : Set as output pin 12 */ +#define GPIO_DIRSET_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIRSET_PIN12_Msk (0x1UL << GPIO_DIRSET_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIRSET_PIN12_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN12_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN12_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 11 : Set as output pin 11 */ +#define GPIO_DIRSET_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIRSET_PIN11_Msk (0x1UL << GPIO_DIRSET_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIRSET_PIN11_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN11_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN11_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 10 : Set as output pin 10 */ +#define GPIO_DIRSET_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIRSET_PIN10_Msk (0x1UL << GPIO_DIRSET_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIRSET_PIN10_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN10_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN10_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 9 : Set as output pin 9 */ +#define GPIO_DIRSET_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIRSET_PIN9_Msk (0x1UL << GPIO_DIRSET_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIRSET_PIN9_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN9_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN9_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 8 : Set as output pin 8 */ +#define GPIO_DIRSET_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIRSET_PIN8_Msk (0x1UL << GPIO_DIRSET_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIRSET_PIN8_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN8_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN8_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 7 : Set as output pin 7 */ +#define GPIO_DIRSET_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIRSET_PIN7_Msk (0x1UL << GPIO_DIRSET_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIRSET_PIN7_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN7_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN7_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 6 : Set as output pin 6 */ +#define GPIO_DIRSET_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIRSET_PIN6_Msk (0x1UL << GPIO_DIRSET_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIRSET_PIN6_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN6_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN6_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 5 : Set as output pin 5 */ +#define GPIO_DIRSET_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIRSET_PIN5_Msk (0x1UL << GPIO_DIRSET_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIRSET_PIN5_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN5_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN5_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 4 : Set as output pin 4 */ +#define GPIO_DIRSET_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIRSET_PIN4_Msk (0x1UL << GPIO_DIRSET_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIRSET_PIN4_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN4_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN4_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 3 : Set as output pin 3 */ +#define GPIO_DIRSET_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIRSET_PIN3_Msk (0x1UL << GPIO_DIRSET_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIRSET_PIN3_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN3_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN3_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 2 : Set as output pin 2 */ +#define GPIO_DIRSET_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIRSET_PIN2_Msk (0x1UL << GPIO_DIRSET_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIRSET_PIN2_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN2_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN2_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 1 : Set as output pin 1 */ +#define GPIO_DIRSET_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIRSET_PIN1_Msk (0x1UL << GPIO_DIRSET_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIRSET_PIN1_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN1_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN1_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 0 : Set as output pin 0 */ +#define GPIO_DIRSET_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIRSET_PIN0_Msk (0x1UL << GPIO_DIRSET_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIRSET_PIN0_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN0_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN0_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Register: GPIO_DIRCLR */ +/* Description: DIR clear register */ + +/* Bit 31 : Set as input pin 31 */ +#define GPIO_DIRCLR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIRCLR_PIN31_Msk (0x1UL << GPIO_DIRCLR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIRCLR_PIN31_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN31_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN31_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 30 : Set as input pin 30 */ +#define GPIO_DIRCLR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIRCLR_PIN30_Msk (0x1UL << GPIO_DIRCLR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIRCLR_PIN30_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN30_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN30_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 29 : Set as input pin 29 */ +#define GPIO_DIRCLR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIRCLR_PIN29_Msk (0x1UL << GPIO_DIRCLR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIRCLR_PIN29_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN29_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN29_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 28 : Set as input pin 28 */ +#define GPIO_DIRCLR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIRCLR_PIN28_Msk (0x1UL << GPIO_DIRCLR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIRCLR_PIN28_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN28_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN28_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 27 : Set as input pin 27 */ +#define GPIO_DIRCLR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIRCLR_PIN27_Msk (0x1UL << GPIO_DIRCLR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIRCLR_PIN27_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN27_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN27_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 26 : Set as input pin 26 */ +#define GPIO_DIRCLR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIRCLR_PIN26_Msk (0x1UL << GPIO_DIRCLR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIRCLR_PIN26_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN26_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN26_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 25 : Set as input pin 25 */ +#define GPIO_DIRCLR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIRCLR_PIN25_Msk (0x1UL << GPIO_DIRCLR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIRCLR_PIN25_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN25_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN25_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 24 : Set as input pin 24 */ +#define GPIO_DIRCLR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIRCLR_PIN24_Msk (0x1UL << GPIO_DIRCLR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIRCLR_PIN24_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN24_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN24_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 23 : Set as input pin 23 */ +#define GPIO_DIRCLR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIRCLR_PIN23_Msk (0x1UL << GPIO_DIRCLR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIRCLR_PIN23_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN23_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN23_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 22 : Set as input pin 22 */ +#define GPIO_DIRCLR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIRCLR_PIN22_Msk (0x1UL << GPIO_DIRCLR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIRCLR_PIN22_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN22_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN22_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 21 : Set as input pin 21 */ +#define GPIO_DIRCLR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIRCLR_PIN21_Msk (0x1UL << GPIO_DIRCLR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIRCLR_PIN21_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN21_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN21_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 20 : Set as input pin 20 */ +#define GPIO_DIRCLR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIRCLR_PIN20_Msk (0x1UL << GPIO_DIRCLR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIRCLR_PIN20_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN20_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN20_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 19 : Set as input pin 19 */ +#define GPIO_DIRCLR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIRCLR_PIN19_Msk (0x1UL << GPIO_DIRCLR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIRCLR_PIN19_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN19_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN19_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 18 : Set as input pin 18 */ +#define GPIO_DIRCLR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIRCLR_PIN18_Msk (0x1UL << GPIO_DIRCLR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIRCLR_PIN18_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN18_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN18_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 17 : Set as input pin 17 */ +#define GPIO_DIRCLR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIRCLR_PIN17_Msk (0x1UL << GPIO_DIRCLR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIRCLR_PIN17_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN17_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN17_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 16 : Set as input pin 16 */ +#define GPIO_DIRCLR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIRCLR_PIN16_Msk (0x1UL << GPIO_DIRCLR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIRCLR_PIN16_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN16_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN16_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 15 : Set as input pin 15 */ +#define GPIO_DIRCLR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIRCLR_PIN15_Msk (0x1UL << GPIO_DIRCLR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIRCLR_PIN15_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN15_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN15_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 14 : Set as input pin 14 */ +#define GPIO_DIRCLR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIRCLR_PIN14_Msk (0x1UL << GPIO_DIRCLR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIRCLR_PIN14_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN14_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN14_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 13 : Set as input pin 13 */ +#define GPIO_DIRCLR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIRCLR_PIN13_Msk (0x1UL << GPIO_DIRCLR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIRCLR_PIN13_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN13_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN13_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 12 : Set as input pin 12 */ +#define GPIO_DIRCLR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIRCLR_PIN12_Msk (0x1UL << GPIO_DIRCLR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIRCLR_PIN12_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN12_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN12_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 11 : Set as input pin 11 */ +#define GPIO_DIRCLR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIRCLR_PIN11_Msk (0x1UL << GPIO_DIRCLR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIRCLR_PIN11_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN11_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN11_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 10 : Set as input pin 10 */ +#define GPIO_DIRCLR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIRCLR_PIN10_Msk (0x1UL << GPIO_DIRCLR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIRCLR_PIN10_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN10_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN10_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 9 : Set as input pin 9 */ +#define GPIO_DIRCLR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIRCLR_PIN9_Msk (0x1UL << GPIO_DIRCLR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIRCLR_PIN9_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN9_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN9_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 8 : Set as input pin 8 */ +#define GPIO_DIRCLR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIRCLR_PIN8_Msk (0x1UL << GPIO_DIRCLR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIRCLR_PIN8_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN8_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN8_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 7 : Set as input pin 7 */ +#define GPIO_DIRCLR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIRCLR_PIN7_Msk (0x1UL << GPIO_DIRCLR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIRCLR_PIN7_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN7_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN7_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 6 : Set as input pin 6 */ +#define GPIO_DIRCLR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIRCLR_PIN6_Msk (0x1UL << GPIO_DIRCLR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIRCLR_PIN6_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN6_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN6_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 5 : Set as input pin 5 */ +#define GPIO_DIRCLR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIRCLR_PIN5_Msk (0x1UL << GPIO_DIRCLR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIRCLR_PIN5_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN5_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN5_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 4 : Set as input pin 4 */ +#define GPIO_DIRCLR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIRCLR_PIN4_Msk (0x1UL << GPIO_DIRCLR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIRCLR_PIN4_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN4_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN4_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 3 : Set as input pin 3 */ +#define GPIO_DIRCLR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIRCLR_PIN3_Msk (0x1UL << GPIO_DIRCLR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIRCLR_PIN3_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN3_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN3_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 2 : Set as input pin 2 */ +#define GPIO_DIRCLR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIRCLR_PIN2_Msk (0x1UL << GPIO_DIRCLR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIRCLR_PIN2_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN2_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN2_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 1 : Set as input pin 1 */ +#define GPIO_DIRCLR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIRCLR_PIN1_Msk (0x1UL << GPIO_DIRCLR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIRCLR_PIN1_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN1_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN1_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 0 : Set as input pin 0 */ +#define GPIO_DIRCLR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIRCLR_PIN0_Msk (0x1UL << GPIO_DIRCLR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIRCLR_PIN0_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN0_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN0_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Register: GPIO_LATCH */ +/* Description: Latch register indicating what GPIO pins that have met the criteria set in the PIN_CNF[n].SENSE registers */ + +/* Bit 31 : Status on whether PIN31 has met criteria set in PIN_CNF31.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_LATCH_PIN31_Msk (0x1UL << GPIO_LATCH_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_LATCH_PIN31_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN31_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 30 : Status on whether PIN30 has met criteria set in PIN_CNF30.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_LATCH_PIN30_Msk (0x1UL << GPIO_LATCH_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_LATCH_PIN30_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN30_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 29 : Status on whether PIN29 has met criteria set in PIN_CNF29.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_LATCH_PIN29_Msk (0x1UL << GPIO_LATCH_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_LATCH_PIN29_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN29_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 28 : Status on whether PIN28 has met criteria set in PIN_CNF28.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_LATCH_PIN28_Msk (0x1UL << GPIO_LATCH_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_LATCH_PIN28_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN28_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 27 : Status on whether PIN27 has met criteria set in PIN_CNF27.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_LATCH_PIN27_Msk (0x1UL << GPIO_LATCH_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_LATCH_PIN27_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN27_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 26 : Status on whether PIN26 has met criteria set in PIN_CNF26.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_LATCH_PIN26_Msk (0x1UL << GPIO_LATCH_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_LATCH_PIN26_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN26_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 25 : Status on whether PIN25 has met criteria set in PIN_CNF25.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_LATCH_PIN25_Msk (0x1UL << GPIO_LATCH_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_LATCH_PIN25_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN25_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 24 : Status on whether PIN24 has met criteria set in PIN_CNF24.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_LATCH_PIN24_Msk (0x1UL << GPIO_LATCH_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_LATCH_PIN24_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN24_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 23 : Status on whether PIN23 has met criteria set in PIN_CNF23.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_LATCH_PIN23_Msk (0x1UL << GPIO_LATCH_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_LATCH_PIN23_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN23_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 22 : Status on whether PIN22 has met criteria set in PIN_CNF22.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_LATCH_PIN22_Msk (0x1UL << GPIO_LATCH_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_LATCH_PIN22_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN22_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 21 : Status on whether PIN21 has met criteria set in PIN_CNF21.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_LATCH_PIN21_Msk (0x1UL << GPIO_LATCH_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_LATCH_PIN21_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN21_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 20 : Status on whether PIN20 has met criteria set in PIN_CNF20.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_LATCH_PIN20_Msk (0x1UL << GPIO_LATCH_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_LATCH_PIN20_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN20_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 19 : Status on whether PIN19 has met criteria set in PIN_CNF19.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_LATCH_PIN19_Msk (0x1UL << GPIO_LATCH_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_LATCH_PIN19_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN19_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 18 : Status on whether PIN18 has met criteria set in PIN_CNF18.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_LATCH_PIN18_Msk (0x1UL << GPIO_LATCH_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_LATCH_PIN18_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN18_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 17 : Status on whether PIN17 has met criteria set in PIN_CNF17.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_LATCH_PIN17_Msk (0x1UL << GPIO_LATCH_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_LATCH_PIN17_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN17_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 16 : Status on whether PIN16 has met criteria set in PIN_CNF16.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_LATCH_PIN16_Msk (0x1UL << GPIO_LATCH_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_LATCH_PIN16_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN16_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 15 : Status on whether PIN15 has met criteria set in PIN_CNF15.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_LATCH_PIN15_Msk (0x1UL << GPIO_LATCH_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_LATCH_PIN15_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN15_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 14 : Status on whether PIN14 has met criteria set in PIN_CNF14.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_LATCH_PIN14_Msk (0x1UL << GPIO_LATCH_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_LATCH_PIN14_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN14_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 13 : Status on whether PIN13 has met criteria set in PIN_CNF13.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_LATCH_PIN13_Msk (0x1UL << GPIO_LATCH_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_LATCH_PIN13_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN13_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 12 : Status on whether PIN12 has met criteria set in PIN_CNF12.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_LATCH_PIN12_Msk (0x1UL << GPIO_LATCH_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_LATCH_PIN12_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN12_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 11 : Status on whether PIN11 has met criteria set in PIN_CNF11.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_LATCH_PIN11_Msk (0x1UL << GPIO_LATCH_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_LATCH_PIN11_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN11_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 10 : Status on whether PIN10 has met criteria set in PIN_CNF10.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_LATCH_PIN10_Msk (0x1UL << GPIO_LATCH_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_LATCH_PIN10_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN10_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 9 : Status on whether PIN9 has met criteria set in PIN_CNF9.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_LATCH_PIN9_Msk (0x1UL << GPIO_LATCH_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_LATCH_PIN9_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN9_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 8 : Status on whether PIN8 has met criteria set in PIN_CNF8.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_LATCH_PIN8_Msk (0x1UL << GPIO_LATCH_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_LATCH_PIN8_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN8_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 7 : Status on whether PIN7 has met criteria set in PIN_CNF7.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_LATCH_PIN7_Msk (0x1UL << GPIO_LATCH_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_LATCH_PIN7_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN7_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 6 : Status on whether PIN6 has met criteria set in PIN_CNF6.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_LATCH_PIN6_Msk (0x1UL << GPIO_LATCH_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_LATCH_PIN6_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN6_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 5 : Status on whether PIN5 has met criteria set in PIN_CNF5.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_LATCH_PIN5_Msk (0x1UL << GPIO_LATCH_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_LATCH_PIN5_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN5_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 4 : Status on whether PIN4 has met criteria set in PIN_CNF4.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_LATCH_PIN4_Msk (0x1UL << GPIO_LATCH_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_LATCH_PIN4_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN4_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 3 : Status on whether PIN3 has met criteria set in PIN_CNF3.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_LATCH_PIN3_Msk (0x1UL << GPIO_LATCH_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_LATCH_PIN3_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN3_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 2 : Status on whether PIN2 has met criteria set in PIN_CNF2.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_LATCH_PIN2_Msk (0x1UL << GPIO_LATCH_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_LATCH_PIN2_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN2_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 1 : Status on whether PIN1 has met criteria set in PIN_CNF1.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_LATCH_PIN1_Msk (0x1UL << GPIO_LATCH_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_LATCH_PIN1_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN1_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 0 : Status on whether PIN0 has met criteria set in PIN_CNF0.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_LATCH_PIN0_Msk (0x1UL << GPIO_LATCH_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_LATCH_PIN0_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN0_Latched (1UL) /*!< Criteria has been met */ + +/* Register: GPIO_DETECTMODE */ +/* Description: Select between default DETECT signal behaviour and LDETECT mode */ + +/* Bit 0 : Select between default DETECT signal behaviour and LDETECT mode */ +#define GPIO_DETECTMODE_DETECTMODE_Pos (0UL) /*!< Position of DETECTMODE field. */ +#define GPIO_DETECTMODE_DETECTMODE_Msk (0x1UL << GPIO_DETECTMODE_DETECTMODE_Pos) /*!< Bit mask of DETECTMODE field. */ +#define GPIO_DETECTMODE_DETECTMODE_Default (0UL) /*!< DETECT directly connected to PIN DETECT signals */ +#define GPIO_DETECTMODE_DETECTMODE_LDETECT (1UL) /*!< Use the latched LDETECT behaviour */ + +/* Register: GPIO_PIN_CNF */ +/* Description: Description collection[0]: Configuration of GPIO pins */ + +/* Bits 17..16 : Pin sensing mechanism */ +#define GPIO_PIN_CNF_SENSE_Pos (16UL) /*!< Position of SENSE field. */ +#define GPIO_PIN_CNF_SENSE_Msk (0x3UL << GPIO_PIN_CNF_SENSE_Pos) /*!< Bit mask of SENSE field. */ +#define GPIO_PIN_CNF_SENSE_Disabled (0UL) /*!< Disabled */ +#define GPIO_PIN_CNF_SENSE_High (2UL) /*!< Sense for high level */ +#define GPIO_PIN_CNF_SENSE_Low (3UL) /*!< Sense for low level */ + +/* Bits 10..8 : Drive configuration */ +#define GPIO_PIN_CNF_DRIVE_Pos (8UL) /*!< Position of DRIVE field. */ +#define GPIO_PIN_CNF_DRIVE_Msk (0x7UL << GPIO_PIN_CNF_DRIVE_Pos) /*!< Bit mask of DRIVE field. */ +#define GPIO_PIN_CNF_DRIVE_S0S1 (0UL) /*!< Standard '0', standard '1' */ +#define GPIO_PIN_CNF_DRIVE_H0S1 (1UL) /*!< High drive '0', standard '1' */ +#define GPIO_PIN_CNF_DRIVE_S0H1 (2UL) /*!< Standard '0', high drive '1' */ +#define GPIO_PIN_CNF_DRIVE_H0H1 (3UL) /*!< High drive '0', high 'drive '1'' */ +#define GPIO_PIN_CNF_DRIVE_D0S1 (4UL) /*!< Disconnect '0' standard '1' (normally used for wired-or connections) */ +#define GPIO_PIN_CNF_DRIVE_D0H1 (5UL) /*!< Disconnect '0', high drive '1' (normally used for wired-or connections) */ +#define GPIO_PIN_CNF_DRIVE_S0D1 (6UL) /*!< Standard '0'. disconnect '1' (normally used for wired-and connections) */ +#define GPIO_PIN_CNF_DRIVE_H0D1 (7UL) /*!< High drive '0', disconnect '1' (normally used for wired-and connections) */ + +/* Bits 3..2 : Pull configuration */ +#define GPIO_PIN_CNF_PULL_Pos (2UL) /*!< Position of PULL field. */ +#define GPIO_PIN_CNF_PULL_Msk (0x3UL << GPIO_PIN_CNF_PULL_Pos) /*!< Bit mask of PULL field. */ +#define GPIO_PIN_CNF_PULL_Disabled (0UL) /*!< No pull */ +#define GPIO_PIN_CNF_PULL_Pulldown (1UL) /*!< Pull down on pin */ +#define GPIO_PIN_CNF_PULL_Pullup (3UL) /*!< Pull up on pin */ + +/* Bit 1 : Connect or disconnect input buffer */ +#define GPIO_PIN_CNF_INPUT_Pos (1UL) /*!< Position of INPUT field. */ +#define GPIO_PIN_CNF_INPUT_Msk (0x1UL << GPIO_PIN_CNF_INPUT_Pos) /*!< Bit mask of INPUT field. */ +#define GPIO_PIN_CNF_INPUT_Connect (0UL) /*!< Connect input buffer */ +#define GPIO_PIN_CNF_INPUT_Disconnect (1UL) /*!< Disconnect input buffer */ + +/* Bit 0 : Pin direction. Same physical register as DIR register */ +#define GPIO_PIN_CNF_DIR_Pos (0UL) /*!< Position of DIR field. */ +#define GPIO_PIN_CNF_DIR_Msk (0x1UL << GPIO_PIN_CNF_DIR_Pos) /*!< Bit mask of DIR field. */ +#define GPIO_PIN_CNF_DIR_Input (0UL) /*!< Configure pin as an input pin */ +#define GPIO_PIN_CNF_DIR_Output (1UL) /*!< Configure pin as an output pin */ + + +/* Peripheral: PDM */ +/* Description: Pulse Density Modulation (Digital Microphone) Interface */ + +/* Register: PDM_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 2 : Enable or disable interrupt for END event */ +#define PDM_INTEN_END_Pos (2UL) /*!< Position of END field. */ +#define PDM_INTEN_END_Msk (0x1UL << PDM_INTEN_END_Pos) /*!< Bit mask of END field. */ +#define PDM_INTEN_END_Disabled (0UL) /*!< Disable */ +#define PDM_INTEN_END_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STOPPED event */ +#define PDM_INTEN_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PDM_INTEN_STOPPED_Msk (0x1UL << PDM_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PDM_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define PDM_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for STARTED event */ +#define PDM_INTEN_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define PDM_INTEN_STARTED_Msk (0x1UL << PDM_INTEN_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define PDM_INTEN_STARTED_Disabled (0UL) /*!< Disable */ +#define PDM_INTEN_STARTED_Enabled (1UL) /*!< Enable */ + +/* Register: PDM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 2 : Write '1' to Enable interrupt for END event */ +#define PDM_INTENSET_END_Pos (2UL) /*!< Position of END field. */ +#define PDM_INTENSET_END_Msk (0x1UL << PDM_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define PDM_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define PDM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PDM_INTENSET_STOPPED_Msk (0x1UL << PDM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PDM_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for STARTED event */ +#define PDM_INTENSET_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define PDM_INTENSET_STARTED_Msk (0x1UL << PDM_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define PDM_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Register: PDM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 2 : Write '1' to Disable interrupt for END event */ +#define PDM_INTENCLR_END_Pos (2UL) /*!< Position of END field. */ +#define PDM_INTENCLR_END_Msk (0x1UL << PDM_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define PDM_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define PDM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PDM_INTENCLR_STOPPED_Msk (0x1UL << PDM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PDM_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for STARTED event */ +#define PDM_INTENCLR_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define PDM_INTENCLR_STARTED_Msk (0x1UL << PDM_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define PDM_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Register: PDM_ENABLE */ +/* Description: PDM module enable register */ + +/* Bit 0 : Enable or disable PDM module */ +#define PDM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define PDM_ENABLE_ENABLE_Msk (0x1UL << PDM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define PDM_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define PDM_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: PDM_PDMCLKCTRL */ +/* Description: PDM clock generator control */ + +/* Bits 31..0 : PDM_CLK frequency */ +#define PDM_PDMCLKCTRL_FREQ_Pos (0UL) /*!< Position of FREQ field. */ +#define PDM_PDMCLKCTRL_FREQ_Msk (0xFFFFFFFFUL << PDM_PDMCLKCTRL_FREQ_Pos) /*!< Bit mask of FREQ field. */ +#define PDM_PDMCLKCTRL_FREQ_1000K (0x08000000UL) /*!< PDM_CLK = 32 MHz / 32 = 1.000 MHz */ +#define PDM_PDMCLKCTRL_FREQ_Default (0x08400000UL) /*!< PDM_CLK = 32 MHz / 31 = 1.032 MHz */ +#define PDM_PDMCLKCTRL_FREQ_1067K (0x08800000UL) /*!< PDM_CLK = 32 MHz / 30 = 1.067 MHz */ + +/* Register: PDM_MODE */ +/* Description: Defines the routing of the connected PDM microphones' signals */ + +/* Bit 1 : Defines on which PDM_CLK edge Left (or mono) is sampled */ +#define PDM_MODE_EDGE_Pos (1UL) /*!< Position of EDGE field. */ +#define PDM_MODE_EDGE_Msk (0x1UL << PDM_MODE_EDGE_Pos) /*!< Bit mask of EDGE field. */ +#define PDM_MODE_EDGE_LeftFalling (0UL) /*!< Left (or mono) is sampled on falling edge of PDM_CLK */ +#define PDM_MODE_EDGE_LeftRising (1UL) /*!< Left (or mono) is sampled on rising edge of PDM_CLK */ + +/* Bit 0 : Mono or stereo operation */ +#define PDM_MODE_OPERATION_Pos (0UL) /*!< Position of OPERATION field. */ +#define PDM_MODE_OPERATION_Msk (0x1UL << PDM_MODE_OPERATION_Pos) /*!< Bit mask of OPERATION field. */ +#define PDM_MODE_OPERATION_Stereo (0UL) /*!< Sample and store one pair (Left + Right) of 16bit samples per RAM word R=[31:16]; L=[15:0] */ +#define PDM_MODE_OPERATION_Mono (1UL) /*!< Sample and store two successive Left samples (16 bit each) per RAM word L1=[31:16]; L0=[15:0] */ + +/* Register: PDM_GAINL */ +/* Description: Left output gain adjustment */ + +/* Bits 6..0 : Left output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) 0x00 -20 dB gain adjust 0x01 -19.5 dB gain adjust (...) 0x27 -0.5 dB gain adjust 0x28 0 dB gain adjust 0x29 +0.5 dB gain adjust (...) 0x4F +19.5 dB gain adjust 0x50 +20 dB gain adjust */ +#define PDM_GAINL_GAINL_Pos (0UL) /*!< Position of GAINL field. */ +#define PDM_GAINL_GAINL_Msk (0x7FUL << PDM_GAINL_GAINL_Pos) /*!< Bit mask of GAINL field. */ +#define PDM_GAINL_GAINL_MinGain (0x00UL) /*!< -20dB gain adjustment (minimum) */ +#define PDM_GAINL_GAINL_DefaultGain (0x28UL) /*!< 0dB gain adjustment ('2500 RMS' requirement) */ +#define PDM_GAINL_GAINL_MaxGain (0x50UL) /*!< +20dB gain adjustment (maximum) */ + +/* Register: PDM_GAINR */ +/* Description: Right output gain adjustment */ + +/* Bits 7..0 : Right output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) */ +#define PDM_GAINR_GAINR_Pos (0UL) /*!< Position of GAINR field. */ +#define PDM_GAINR_GAINR_Msk (0xFFUL << PDM_GAINR_GAINR_Pos) /*!< Bit mask of GAINR field. */ +#define PDM_GAINR_GAINR_MinGain (0x00UL) /*!< -20dB gain adjustment (minimum) */ +#define PDM_GAINR_GAINR_DefaultGain (0x28UL) /*!< 0dB gain adjustment ('2500 RMS' requirement) */ +#define PDM_GAINR_GAINR_MaxGain (0x50UL) /*!< +20dB gain adjustment (maximum) */ + +/* Register: PDM_PSEL_CLK */ +/* Description: Pin number configuration for PDM CLK signal */ + +/* Bit 31 : Connection */ +#define PDM_PSEL_CLK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define PDM_PSEL_CLK_CONNECT_Msk (0x1UL << PDM_PSEL_CLK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define PDM_PSEL_CLK_CONNECT_Connected (0UL) /*!< Connect */ +#define PDM_PSEL_CLK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define PDM_PSEL_CLK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define PDM_PSEL_CLK_PIN_Msk (0x1FUL << PDM_PSEL_CLK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: PDM_PSEL_DIN */ +/* Description: Pin number configuration for PDM DIN signal */ + +/* Bit 31 : Connection */ +#define PDM_PSEL_DIN_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define PDM_PSEL_DIN_CONNECT_Msk (0x1UL << PDM_PSEL_DIN_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define PDM_PSEL_DIN_CONNECT_Connected (0UL) /*!< Connect */ +#define PDM_PSEL_DIN_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define PDM_PSEL_DIN_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define PDM_PSEL_DIN_PIN_Msk (0x1FUL << PDM_PSEL_DIN_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: PDM_SAMPLE_PTR */ +/* Description: RAM address pointer to write samples to with EasyDMA */ + +/* Bits 31..0 : Address to write PDM samples to over DMA */ +#define PDM_SAMPLE_PTR_SAMPLEPTR_Pos (0UL) /*!< Position of SAMPLEPTR field. */ +#define PDM_SAMPLE_PTR_SAMPLEPTR_Msk (0xFFFFFFFFUL << PDM_SAMPLE_PTR_SAMPLEPTR_Pos) /*!< Bit mask of SAMPLEPTR field. */ + +/* Register: PDM_SAMPLE_MAXCNT */ +/* Description: Number of samples to allocate memory for in EasyDMA mode */ + +/* Bits 14..0 : Length of DMA RAM allocation in number of samples */ +#define PDM_SAMPLE_MAXCNT_BUFFSIZE_Pos (0UL) /*!< Position of BUFFSIZE field. */ +#define PDM_SAMPLE_MAXCNT_BUFFSIZE_Msk (0x7FFFUL << PDM_SAMPLE_MAXCNT_BUFFSIZE_Pos) /*!< Bit mask of BUFFSIZE field. */ + + +/* Peripheral: POWER */ +/* Description: Power control */ + +/* Register: POWER_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 6 : Write '1' to Enable interrupt for SLEEPEXIT event */ +#define POWER_INTENSET_SLEEPEXIT_Pos (6UL) /*!< Position of SLEEPEXIT field. */ +#define POWER_INTENSET_SLEEPEXIT_Msk (0x1UL << POWER_INTENSET_SLEEPEXIT_Pos) /*!< Bit mask of SLEEPEXIT field. */ +#define POWER_INTENSET_SLEEPEXIT_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_SLEEPEXIT_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_SLEEPEXIT_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for SLEEPENTER event */ +#define POWER_INTENSET_SLEEPENTER_Pos (5UL) /*!< Position of SLEEPENTER field. */ +#define POWER_INTENSET_SLEEPENTER_Msk (0x1UL << POWER_INTENSET_SLEEPENTER_Pos) /*!< Bit mask of SLEEPENTER field. */ +#define POWER_INTENSET_SLEEPENTER_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_SLEEPENTER_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_SLEEPENTER_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for POFWARN event */ +#define POWER_INTENSET_POFWARN_Pos (2UL) /*!< Position of POFWARN field. */ +#define POWER_INTENSET_POFWARN_Msk (0x1UL << POWER_INTENSET_POFWARN_Pos) /*!< Bit mask of POFWARN field. */ +#define POWER_INTENSET_POFWARN_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_POFWARN_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_POFWARN_Set (1UL) /*!< Enable */ + +/* Register: POWER_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 6 : Write '1' to Disable interrupt for SLEEPEXIT event */ +#define POWER_INTENCLR_SLEEPEXIT_Pos (6UL) /*!< Position of SLEEPEXIT field. */ +#define POWER_INTENCLR_SLEEPEXIT_Msk (0x1UL << POWER_INTENCLR_SLEEPEXIT_Pos) /*!< Bit mask of SLEEPEXIT field. */ +#define POWER_INTENCLR_SLEEPEXIT_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_SLEEPEXIT_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_SLEEPEXIT_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for SLEEPENTER event */ +#define POWER_INTENCLR_SLEEPENTER_Pos (5UL) /*!< Position of SLEEPENTER field. */ +#define POWER_INTENCLR_SLEEPENTER_Msk (0x1UL << POWER_INTENCLR_SLEEPENTER_Pos) /*!< Bit mask of SLEEPENTER field. */ +#define POWER_INTENCLR_SLEEPENTER_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_SLEEPENTER_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_SLEEPENTER_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for POFWARN event */ +#define POWER_INTENCLR_POFWARN_Pos (2UL) /*!< Position of POFWARN field. */ +#define POWER_INTENCLR_POFWARN_Msk (0x1UL << POWER_INTENCLR_POFWARN_Pos) /*!< Bit mask of POFWARN field. */ +#define POWER_INTENCLR_POFWARN_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_POFWARN_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_POFWARN_Clear (1UL) /*!< Disable */ + +/* Register: POWER_RESETREAS */ +/* Description: Reset reason */ + +/* Bit 19 : Reset due to wake up from System OFF mode by NFC field detect */ +#define POWER_RESETREAS_NFC_Pos (19UL) /*!< Position of NFC field. */ +#define POWER_RESETREAS_NFC_Msk (0x1UL << POWER_RESETREAS_NFC_Pos) /*!< Bit mask of NFC field. */ +#define POWER_RESETREAS_NFC_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_NFC_Detected (1UL) /*!< Detected */ + +/* Bit 18 : Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode */ +#define POWER_RESETREAS_DIF_Pos (18UL) /*!< Position of DIF field. */ +#define POWER_RESETREAS_DIF_Msk (0x1UL << POWER_RESETREAS_DIF_Pos) /*!< Bit mask of DIF field. */ +#define POWER_RESETREAS_DIF_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_DIF_Detected (1UL) /*!< Detected */ + +/* Bit 17 : Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP */ +#define POWER_RESETREAS_LPCOMP_Pos (17UL) /*!< Position of LPCOMP field. */ +#define POWER_RESETREAS_LPCOMP_Msk (0x1UL << POWER_RESETREAS_LPCOMP_Pos) /*!< Bit mask of LPCOMP field. */ +#define POWER_RESETREAS_LPCOMP_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_LPCOMP_Detected (1UL) /*!< Detected */ + +/* Bit 16 : Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO */ +#define POWER_RESETREAS_OFF_Pos (16UL) /*!< Position of OFF field. */ +#define POWER_RESETREAS_OFF_Msk (0x1UL << POWER_RESETREAS_OFF_Pos) /*!< Bit mask of OFF field. */ +#define POWER_RESETREAS_OFF_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_OFF_Detected (1UL) /*!< Detected */ + +/* Bit 3 : Reset from CPU lock-up detected */ +#define POWER_RESETREAS_LOCKUP_Pos (3UL) /*!< Position of LOCKUP field. */ +#define POWER_RESETREAS_LOCKUP_Msk (0x1UL << POWER_RESETREAS_LOCKUP_Pos) /*!< Bit mask of LOCKUP field. */ +#define POWER_RESETREAS_LOCKUP_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_LOCKUP_Detected (1UL) /*!< Detected */ + +/* Bit 2 : Reset from soft reset detected */ +#define POWER_RESETREAS_SREQ_Pos (2UL) /*!< Position of SREQ field. */ +#define POWER_RESETREAS_SREQ_Msk (0x1UL << POWER_RESETREAS_SREQ_Pos) /*!< Bit mask of SREQ field. */ +#define POWER_RESETREAS_SREQ_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_SREQ_Detected (1UL) /*!< Detected */ + +/* Bit 1 : Reset from watchdog detected */ +#define POWER_RESETREAS_DOG_Pos (1UL) /*!< Position of DOG field. */ +#define POWER_RESETREAS_DOG_Msk (0x1UL << POWER_RESETREAS_DOG_Pos) /*!< Bit mask of DOG field. */ +#define POWER_RESETREAS_DOG_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_DOG_Detected (1UL) /*!< Detected */ + +/* Bit 0 : Reset from pin-reset detected */ +#define POWER_RESETREAS_RESETPIN_Pos (0UL) /*!< Position of RESETPIN field. */ +#define POWER_RESETREAS_RESETPIN_Msk (0x1UL << POWER_RESETREAS_RESETPIN_Pos) /*!< Bit mask of RESETPIN field. */ +#define POWER_RESETREAS_RESETPIN_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_RESETPIN_Detected (1UL) /*!< Detected */ + +/* Register: POWER_RAMSTATUS */ +/* Description: Deprecated register - RAM status register */ + +/* Bit 3 : RAM block 3 is on or off/powering up */ +#define POWER_RAMSTATUS_RAMBLOCK3_Pos (3UL) /*!< Position of RAMBLOCK3 field. */ +#define POWER_RAMSTATUS_RAMBLOCK3_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK3_Pos) /*!< Bit mask of RAMBLOCK3 field. */ +#define POWER_RAMSTATUS_RAMBLOCK3_Off (0UL) /*!< Off */ +#define POWER_RAMSTATUS_RAMBLOCK3_On (1UL) /*!< On */ + +/* Bit 2 : RAM block 2 is on or off/powering up */ +#define POWER_RAMSTATUS_RAMBLOCK2_Pos (2UL) /*!< Position of RAMBLOCK2 field. */ +#define POWER_RAMSTATUS_RAMBLOCK2_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK2_Pos) /*!< Bit mask of RAMBLOCK2 field. */ +#define POWER_RAMSTATUS_RAMBLOCK2_Off (0UL) /*!< Off */ +#define POWER_RAMSTATUS_RAMBLOCK2_On (1UL) /*!< On */ + +/* Bit 1 : RAM block 1 is on or off/powering up */ +#define POWER_RAMSTATUS_RAMBLOCK1_Pos (1UL) /*!< Position of RAMBLOCK1 field. */ +#define POWER_RAMSTATUS_RAMBLOCK1_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK1_Pos) /*!< Bit mask of RAMBLOCK1 field. */ +#define POWER_RAMSTATUS_RAMBLOCK1_Off (0UL) /*!< Off */ +#define POWER_RAMSTATUS_RAMBLOCK1_On (1UL) /*!< On */ + +/* Bit 0 : RAM block 0 is on or off/powering up */ +#define POWER_RAMSTATUS_RAMBLOCK0_Pos (0UL) /*!< Position of RAMBLOCK0 field. */ +#define POWER_RAMSTATUS_RAMBLOCK0_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK0_Pos) /*!< Bit mask of RAMBLOCK0 field. */ +#define POWER_RAMSTATUS_RAMBLOCK0_Off (0UL) /*!< Off */ +#define POWER_RAMSTATUS_RAMBLOCK0_On (1UL) /*!< On */ + +/* Register: POWER_SYSTEMOFF */ +/* Description: System OFF register */ + +/* Bit 0 : Enable System OFF mode */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Pos (0UL) /*!< Position of SYSTEMOFF field. */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Msk (0x1UL << POWER_SYSTEMOFF_SYSTEMOFF_Pos) /*!< Bit mask of SYSTEMOFF field. */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Enter (1UL) /*!< Enable System OFF mode */ + +/* Register: POWER_POFCON */ +/* Description: Power failure comparator configuration */ + +/* Bits 4..1 : Power failure comparator threshold setting */ +#define POWER_POFCON_THRESHOLD_Pos (1UL) /*!< Position of THRESHOLD field. */ +#define POWER_POFCON_THRESHOLD_Msk (0xFUL << POWER_POFCON_THRESHOLD_Pos) /*!< Bit mask of THRESHOLD field. */ +#define POWER_POFCON_THRESHOLD_V17 (4UL) /*!< Set threshold to 1.7 V */ +#define POWER_POFCON_THRESHOLD_V18 (5UL) /*!< Set threshold to 1.8 V */ +#define POWER_POFCON_THRESHOLD_V19 (6UL) /*!< Set threshold to 1.9 V */ +#define POWER_POFCON_THRESHOLD_V20 (7UL) /*!< Set threshold to 2.0 V */ +#define POWER_POFCON_THRESHOLD_V21 (8UL) /*!< Set threshold to 2.1 V */ +#define POWER_POFCON_THRESHOLD_V22 (9UL) /*!< Set threshold to 2.2 V */ +#define POWER_POFCON_THRESHOLD_V23 (10UL) /*!< Set threshold to 2.3 V */ +#define POWER_POFCON_THRESHOLD_V24 (11UL) /*!< Set threshold to 2.4 V */ +#define POWER_POFCON_THRESHOLD_V25 (12UL) /*!< Set threshold to 2.5 V */ +#define POWER_POFCON_THRESHOLD_V26 (13UL) /*!< Set threshold to 2.6 V */ +#define POWER_POFCON_THRESHOLD_V27 (14UL) /*!< Set threshold to 2.7 V */ +#define POWER_POFCON_THRESHOLD_V28 (15UL) /*!< Set threshold to 2.8 V */ + +/* Bit 0 : Enable or disable power failure comparator */ +#define POWER_POFCON_POF_Pos (0UL) /*!< Position of POF field. */ +#define POWER_POFCON_POF_Msk (0x1UL << POWER_POFCON_POF_Pos) /*!< Bit mask of POF field. */ +#define POWER_POFCON_POF_Disabled (0UL) /*!< Disable */ +#define POWER_POFCON_POF_Enabled (1UL) /*!< Enable */ + +/* Register: POWER_GPREGRET */ +/* Description: General purpose retention register */ + +/* Bits 7..0 : General purpose retention register */ +#define POWER_GPREGRET_GPREGRET_Pos (0UL) /*!< Position of GPREGRET field. */ +#define POWER_GPREGRET_GPREGRET_Msk (0xFFUL << POWER_GPREGRET_GPREGRET_Pos) /*!< Bit mask of GPREGRET field. */ + +/* Register: POWER_GPREGRET2 */ +/* Description: General purpose retention register */ + +/* Bits 7..0 : General purpose retention register */ +#define POWER_GPREGRET2_GPREGRET_Pos (0UL) /*!< Position of GPREGRET field. */ +#define POWER_GPREGRET2_GPREGRET_Msk (0xFFUL << POWER_GPREGRET2_GPREGRET_Pos) /*!< Bit mask of GPREGRET field. */ + +/* Register: POWER_RAMON */ +/* Description: Deprecated register - RAM on/off register (this register is retained) */ + +/* Bit 17 : Keep retention on RAM block 1 when RAM block is switched off */ +#define POWER_RAMON_OFFRAM1_Pos (17UL) /*!< Position of OFFRAM1 field. */ +#define POWER_RAMON_OFFRAM1_Msk (0x1UL << POWER_RAMON_OFFRAM1_Pos) /*!< Bit mask of OFFRAM1 field. */ +#define POWER_RAMON_OFFRAM1_RAM1Off (0UL) /*!< Off */ +#define POWER_RAMON_OFFRAM1_RAM1On (1UL) /*!< On */ + +/* Bit 16 : Keep retention on RAM block 0 when RAM block is switched off */ +#define POWER_RAMON_OFFRAM0_Pos (16UL) /*!< Position of OFFRAM0 field. */ +#define POWER_RAMON_OFFRAM0_Msk (0x1UL << POWER_RAMON_OFFRAM0_Pos) /*!< Bit mask of OFFRAM0 field. */ +#define POWER_RAMON_OFFRAM0_RAM0Off (0UL) /*!< Off */ +#define POWER_RAMON_OFFRAM0_RAM0On (1UL) /*!< On */ + +/* Bit 1 : Keep RAM block 1 on or off in system ON Mode */ +#define POWER_RAMON_ONRAM1_Pos (1UL) /*!< Position of ONRAM1 field. */ +#define POWER_RAMON_ONRAM1_Msk (0x1UL << POWER_RAMON_ONRAM1_Pos) /*!< Bit mask of ONRAM1 field. */ +#define POWER_RAMON_ONRAM1_RAM1Off (0UL) /*!< Off */ +#define POWER_RAMON_ONRAM1_RAM1On (1UL) /*!< On */ + +/* Bit 0 : Keep RAM block 0 on or off in system ON Mode */ +#define POWER_RAMON_ONRAM0_Pos (0UL) /*!< Position of ONRAM0 field. */ +#define POWER_RAMON_ONRAM0_Msk (0x1UL << POWER_RAMON_ONRAM0_Pos) /*!< Bit mask of ONRAM0 field. */ +#define POWER_RAMON_ONRAM0_RAM0Off (0UL) /*!< Off */ +#define POWER_RAMON_ONRAM0_RAM0On (1UL) /*!< On */ + +/* Register: POWER_RAMONB */ +/* Description: Deprecated register - RAM on/off register (this register is retained) */ + +/* Bit 17 : Keep retention on RAM block 3 when RAM block is switched off */ +#define POWER_RAMONB_OFFRAM3_Pos (17UL) /*!< Position of OFFRAM3 field. */ +#define POWER_RAMONB_OFFRAM3_Msk (0x1UL << POWER_RAMONB_OFFRAM3_Pos) /*!< Bit mask of OFFRAM3 field. */ +#define POWER_RAMONB_OFFRAM3_RAM3Off (0UL) /*!< Off */ +#define POWER_RAMONB_OFFRAM3_RAM3On (1UL) /*!< On */ + +/* Bit 16 : Keep retention on RAM block 2 when RAM block is switched off */ +#define POWER_RAMONB_OFFRAM2_Pos (16UL) /*!< Position of OFFRAM2 field. */ +#define POWER_RAMONB_OFFRAM2_Msk (0x1UL << POWER_RAMONB_OFFRAM2_Pos) /*!< Bit mask of OFFRAM2 field. */ +#define POWER_RAMONB_OFFRAM2_RAM2Off (0UL) /*!< Off */ +#define POWER_RAMONB_OFFRAM2_RAM2On (1UL) /*!< On */ + +/* Bit 1 : Keep RAM block 3 on or off in system ON Mode */ +#define POWER_RAMONB_ONRAM3_Pos (1UL) /*!< Position of ONRAM3 field. */ +#define POWER_RAMONB_ONRAM3_Msk (0x1UL << POWER_RAMONB_ONRAM3_Pos) /*!< Bit mask of ONRAM3 field. */ +#define POWER_RAMONB_ONRAM3_RAM3Off (0UL) /*!< Off */ +#define POWER_RAMONB_ONRAM3_RAM3On (1UL) /*!< On */ + +/* Bit 0 : Keep RAM block 2 on or off in system ON Mode */ +#define POWER_RAMONB_ONRAM2_Pos (0UL) /*!< Position of ONRAM2 field. */ +#define POWER_RAMONB_ONRAM2_Msk (0x1UL << POWER_RAMONB_ONRAM2_Pos) /*!< Bit mask of ONRAM2 field. */ +#define POWER_RAMONB_ONRAM2_RAM2Off (0UL) /*!< Off */ +#define POWER_RAMONB_ONRAM2_RAM2On (1UL) /*!< On */ + +/* Register: POWER_DCDCEN */ +/* Description: DC/DC enable register */ + +/* Bit 0 : Enable or disable DC/DC converter */ +#define POWER_DCDCEN_DCDCEN_Pos (0UL) /*!< Position of DCDCEN field. */ +#define POWER_DCDCEN_DCDCEN_Msk (0x1UL << POWER_DCDCEN_DCDCEN_Pos) /*!< Bit mask of DCDCEN field. */ +#define POWER_DCDCEN_DCDCEN_Disabled (0UL) /*!< Disable */ +#define POWER_DCDCEN_DCDCEN_Enabled (1UL) /*!< Enable */ + +/* Register: POWER_RAM_POWER */ +/* Description: Description cluster[0]: RAM0 power control register */ + +/* Bit 17 : Keep retention on RAM section S1 when RAM section is in OFF */ +#define POWER_RAM_POWER_S1RETENTION_Pos (17UL) /*!< Position of S1RETENTION field. */ +#define POWER_RAM_POWER_S1RETENTION_Msk (0x1UL << POWER_RAM_POWER_S1RETENTION_Pos) /*!< Bit mask of S1RETENTION field. */ +#define POWER_RAM_POWER_S1RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S1RETENTION_On (1UL) /*!< On */ + +/* Bit 16 : Keep retention on RAM section S0 when RAM section is in OFF */ +#define POWER_RAM_POWER_S0RETENTION_Pos (16UL) /*!< Position of S0RETENTION field. */ +#define POWER_RAM_POWER_S0RETENTION_Msk (0x1UL << POWER_RAM_POWER_S0RETENTION_Pos) /*!< Bit mask of S0RETENTION field. */ +#define POWER_RAM_POWER_S0RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S0RETENTION_On (1UL) /*!< On */ + +/* Bit 1 : Keep RAM section S1 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S1POWER_Pos (1UL) /*!< Position of S1POWER field. */ +#define POWER_RAM_POWER_S1POWER_Msk (0x1UL << POWER_RAM_POWER_S1POWER_Pos) /*!< Bit mask of S1POWER field. */ +#define POWER_RAM_POWER_S1POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S1POWER_On (1UL) /*!< On */ + +/* Bit 0 : Keep RAM section S0 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S0POWER_Pos (0UL) /*!< Position of S0POWER field. */ +#define POWER_RAM_POWER_S0POWER_Msk (0x1UL << POWER_RAM_POWER_S0POWER_Pos) /*!< Bit mask of S0POWER field. */ +#define POWER_RAM_POWER_S0POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S0POWER_On (1UL) /*!< On */ + +/* Register: POWER_RAM_POWERSET */ +/* Description: Description cluster[0]: RAM0 power control set register */ + +/* Bit 17 : Keep retention on RAM section S1 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S1RETENTION_Pos (17UL) /*!< Position of S1RETENTION field. */ +#define POWER_RAM_POWERSET_S1RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S1RETENTION_Pos) /*!< Bit mask of S1RETENTION field. */ +#define POWER_RAM_POWERSET_S1RETENTION_On (1UL) /*!< On */ + +/* Bit 16 : Keep retention on RAM section S0 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S0RETENTION_Pos (16UL) /*!< Position of S0RETENTION field. */ +#define POWER_RAM_POWERSET_S0RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S0RETENTION_Pos) /*!< Bit mask of S0RETENTION field. */ +#define POWER_RAM_POWERSET_S0RETENTION_On (1UL) /*!< On */ + +/* Bit 1 : Keep RAM section S1 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S1POWER_Pos (1UL) /*!< Position of S1POWER field. */ +#define POWER_RAM_POWERSET_S1POWER_Msk (0x1UL << POWER_RAM_POWERSET_S1POWER_Pos) /*!< Bit mask of S1POWER field. */ +#define POWER_RAM_POWERSET_S1POWER_On (1UL) /*!< On */ + +/* Bit 0 : Keep RAM section S0 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S0POWER_Pos (0UL) /*!< Position of S0POWER field. */ +#define POWER_RAM_POWERSET_S0POWER_Msk (0x1UL << POWER_RAM_POWERSET_S0POWER_Pos) /*!< Bit mask of S0POWER field. */ +#define POWER_RAM_POWERSET_S0POWER_On (1UL) /*!< On */ + +/* Register: POWER_RAM_POWERCLR */ +/* Description: Description cluster[0]: RAM0 power control clear register */ + +/* Bit 17 : Keep retention on RAM section S1 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S1RETENTION_Pos (17UL) /*!< Position of S1RETENTION field. */ +#define POWER_RAM_POWERCLR_S1RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S1RETENTION_Pos) /*!< Bit mask of S1RETENTION field. */ +#define POWER_RAM_POWERCLR_S1RETENTION_Off (1UL) /*!< Off */ + +/* Bit 16 : Keep retention on RAM section S0 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S0RETENTION_Pos (16UL) /*!< Position of S0RETENTION field. */ +#define POWER_RAM_POWERCLR_S0RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S0RETENTION_Pos) /*!< Bit mask of S0RETENTION field. */ +#define POWER_RAM_POWERCLR_S0RETENTION_Off (1UL) /*!< Off */ + +/* Bit 1 : Keep RAM section S1 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S1POWER_Pos (1UL) /*!< Position of S1POWER field. */ +#define POWER_RAM_POWERCLR_S1POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S1POWER_Pos) /*!< Bit mask of S1POWER field. */ +#define POWER_RAM_POWERCLR_S1POWER_Off (1UL) /*!< Off */ + +/* Bit 0 : Keep RAM section S0 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S0POWER_Pos (0UL) /*!< Position of S0POWER field. */ +#define POWER_RAM_POWERCLR_S0POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S0POWER_Pos) /*!< Bit mask of S0POWER field. */ +#define POWER_RAM_POWERCLR_S0POWER_Off (1UL) /*!< Off */ + + +/* Peripheral: PPI */ +/* Description: Programmable Peripheral Interconnect */ + +/* Register: PPI_CHEN */ +/* Description: Channel enable register */ + +/* Bit 31 : Enable or disable channel 31 */ +#define PPI_CHEN_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHEN_CH31_Msk (0x1UL << PPI_CHEN_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHEN_CH31_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH31_Enabled (1UL) /*!< Enable channel */ + +/* Bit 30 : Enable or disable channel 30 */ +#define PPI_CHEN_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHEN_CH30_Msk (0x1UL << PPI_CHEN_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHEN_CH30_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH30_Enabled (1UL) /*!< Enable channel */ + +/* Bit 29 : Enable or disable channel 29 */ +#define PPI_CHEN_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHEN_CH29_Msk (0x1UL << PPI_CHEN_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHEN_CH29_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH29_Enabled (1UL) /*!< Enable channel */ + +/* Bit 28 : Enable or disable channel 28 */ +#define PPI_CHEN_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHEN_CH28_Msk (0x1UL << PPI_CHEN_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHEN_CH28_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH28_Enabled (1UL) /*!< Enable channel */ + +/* Bit 27 : Enable or disable channel 27 */ +#define PPI_CHEN_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHEN_CH27_Msk (0x1UL << PPI_CHEN_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHEN_CH27_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH27_Enabled (1UL) /*!< Enable channel */ + +/* Bit 26 : Enable or disable channel 26 */ +#define PPI_CHEN_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHEN_CH26_Msk (0x1UL << PPI_CHEN_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHEN_CH26_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH26_Enabled (1UL) /*!< Enable channel */ + +/* Bit 25 : Enable or disable channel 25 */ +#define PPI_CHEN_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHEN_CH25_Msk (0x1UL << PPI_CHEN_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHEN_CH25_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH25_Enabled (1UL) /*!< Enable channel */ + +/* Bit 24 : Enable or disable channel 24 */ +#define PPI_CHEN_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHEN_CH24_Msk (0x1UL << PPI_CHEN_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHEN_CH24_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH24_Enabled (1UL) /*!< Enable channel */ + +/* Bit 23 : Enable or disable channel 23 */ +#define PPI_CHEN_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHEN_CH23_Msk (0x1UL << PPI_CHEN_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHEN_CH23_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH23_Enabled (1UL) /*!< Enable channel */ + +/* Bit 22 : Enable or disable channel 22 */ +#define PPI_CHEN_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHEN_CH22_Msk (0x1UL << PPI_CHEN_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHEN_CH22_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH22_Enabled (1UL) /*!< Enable channel */ + +/* Bit 21 : Enable or disable channel 21 */ +#define PPI_CHEN_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHEN_CH21_Msk (0x1UL << PPI_CHEN_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHEN_CH21_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH21_Enabled (1UL) /*!< Enable channel */ + +/* Bit 20 : Enable or disable channel 20 */ +#define PPI_CHEN_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHEN_CH20_Msk (0x1UL << PPI_CHEN_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHEN_CH20_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH20_Enabled (1UL) /*!< Enable channel */ + +/* Bit 19 : Enable or disable channel 19 */ +#define PPI_CHEN_CH19_Pos (19UL) /*!< Position of CH19 field. */ +#define PPI_CHEN_CH19_Msk (0x1UL << PPI_CHEN_CH19_Pos) /*!< Bit mask of CH19 field. */ +#define PPI_CHEN_CH19_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH19_Enabled (1UL) /*!< Enable channel */ + +/* Bit 18 : Enable or disable channel 18 */ +#define PPI_CHEN_CH18_Pos (18UL) /*!< Position of CH18 field. */ +#define PPI_CHEN_CH18_Msk (0x1UL << PPI_CHEN_CH18_Pos) /*!< Bit mask of CH18 field. */ +#define PPI_CHEN_CH18_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH18_Enabled (1UL) /*!< Enable channel */ + +/* Bit 17 : Enable or disable channel 17 */ +#define PPI_CHEN_CH17_Pos (17UL) /*!< Position of CH17 field. */ +#define PPI_CHEN_CH17_Msk (0x1UL << PPI_CHEN_CH17_Pos) /*!< Bit mask of CH17 field. */ +#define PPI_CHEN_CH17_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH17_Enabled (1UL) /*!< Enable channel */ + +/* Bit 16 : Enable or disable channel 16 */ +#define PPI_CHEN_CH16_Pos (16UL) /*!< Position of CH16 field. */ +#define PPI_CHEN_CH16_Msk (0x1UL << PPI_CHEN_CH16_Pos) /*!< Bit mask of CH16 field. */ +#define PPI_CHEN_CH16_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH16_Enabled (1UL) /*!< Enable channel */ + +/* Bit 15 : Enable or disable channel 15 */ +#define PPI_CHEN_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHEN_CH15_Msk (0x1UL << PPI_CHEN_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHEN_CH15_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH15_Enabled (1UL) /*!< Enable channel */ + +/* Bit 14 : Enable or disable channel 14 */ +#define PPI_CHEN_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHEN_CH14_Msk (0x1UL << PPI_CHEN_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHEN_CH14_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH14_Enabled (1UL) /*!< Enable channel */ + +/* Bit 13 : Enable or disable channel 13 */ +#define PPI_CHEN_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHEN_CH13_Msk (0x1UL << PPI_CHEN_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHEN_CH13_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH13_Enabled (1UL) /*!< Enable channel */ + +/* Bit 12 : Enable or disable channel 12 */ +#define PPI_CHEN_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHEN_CH12_Msk (0x1UL << PPI_CHEN_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHEN_CH12_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH12_Enabled (1UL) /*!< Enable channel */ + +/* Bit 11 : Enable or disable channel 11 */ +#define PPI_CHEN_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHEN_CH11_Msk (0x1UL << PPI_CHEN_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHEN_CH11_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH11_Enabled (1UL) /*!< Enable channel */ + +/* Bit 10 : Enable or disable channel 10 */ +#define PPI_CHEN_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHEN_CH10_Msk (0x1UL << PPI_CHEN_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHEN_CH10_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH10_Enabled (1UL) /*!< Enable channel */ + +/* Bit 9 : Enable or disable channel 9 */ +#define PPI_CHEN_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHEN_CH9_Msk (0x1UL << PPI_CHEN_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHEN_CH9_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH9_Enabled (1UL) /*!< Enable channel */ + +/* Bit 8 : Enable or disable channel 8 */ +#define PPI_CHEN_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHEN_CH8_Msk (0x1UL << PPI_CHEN_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHEN_CH8_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH8_Enabled (1UL) /*!< Enable channel */ + +/* Bit 7 : Enable or disable channel 7 */ +#define PPI_CHEN_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHEN_CH7_Msk (0x1UL << PPI_CHEN_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHEN_CH7_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH7_Enabled (1UL) /*!< Enable channel */ + +/* Bit 6 : Enable or disable channel 6 */ +#define PPI_CHEN_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHEN_CH6_Msk (0x1UL << PPI_CHEN_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHEN_CH6_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH6_Enabled (1UL) /*!< Enable channel */ + +/* Bit 5 : Enable or disable channel 5 */ +#define PPI_CHEN_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHEN_CH5_Msk (0x1UL << PPI_CHEN_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHEN_CH5_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH5_Enabled (1UL) /*!< Enable channel */ + +/* Bit 4 : Enable or disable channel 4 */ +#define PPI_CHEN_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHEN_CH4_Msk (0x1UL << PPI_CHEN_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHEN_CH4_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH4_Enabled (1UL) /*!< Enable channel */ + +/* Bit 3 : Enable or disable channel 3 */ +#define PPI_CHEN_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHEN_CH3_Msk (0x1UL << PPI_CHEN_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHEN_CH3_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH3_Enabled (1UL) /*!< Enable channel */ + +/* Bit 2 : Enable or disable channel 2 */ +#define PPI_CHEN_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHEN_CH2_Msk (0x1UL << PPI_CHEN_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHEN_CH2_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH2_Enabled (1UL) /*!< Enable channel */ + +/* Bit 1 : Enable or disable channel 1 */ +#define PPI_CHEN_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHEN_CH1_Msk (0x1UL << PPI_CHEN_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHEN_CH1_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH1_Enabled (1UL) /*!< Enable channel */ + +/* Bit 0 : Enable or disable channel 0 */ +#define PPI_CHEN_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHEN_CH0_Msk (0x1UL << PPI_CHEN_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHEN_CH0_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH0_Enabled (1UL) /*!< Enable channel */ + +/* Register: PPI_CHENSET */ +/* Description: Channel enable set register */ + +/* Bit 31 : Channel 31 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHENSET_CH31_Msk (0x1UL << PPI_CHENSET_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHENSET_CH31_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH31_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH31_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 30 : Channel 30 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHENSET_CH30_Msk (0x1UL << PPI_CHENSET_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHENSET_CH30_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH30_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH30_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 29 : Channel 29 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHENSET_CH29_Msk (0x1UL << PPI_CHENSET_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHENSET_CH29_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH29_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH29_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 28 : Channel 28 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHENSET_CH28_Msk (0x1UL << PPI_CHENSET_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHENSET_CH28_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH28_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH28_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 27 : Channel 27 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHENSET_CH27_Msk (0x1UL << PPI_CHENSET_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHENSET_CH27_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH27_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH27_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 26 : Channel 26 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHENSET_CH26_Msk (0x1UL << PPI_CHENSET_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHENSET_CH26_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH26_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH26_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 25 : Channel 25 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHENSET_CH25_Msk (0x1UL << PPI_CHENSET_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHENSET_CH25_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH25_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH25_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 24 : Channel 24 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHENSET_CH24_Msk (0x1UL << PPI_CHENSET_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHENSET_CH24_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH24_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH24_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 23 : Channel 23 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHENSET_CH23_Msk (0x1UL << PPI_CHENSET_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHENSET_CH23_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH23_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH23_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 22 : Channel 22 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHENSET_CH22_Msk (0x1UL << PPI_CHENSET_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHENSET_CH22_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH22_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH22_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 21 : Channel 21 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHENSET_CH21_Msk (0x1UL << PPI_CHENSET_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHENSET_CH21_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH21_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH21_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 20 : Channel 20 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHENSET_CH20_Msk (0x1UL << PPI_CHENSET_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHENSET_CH20_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH20_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH20_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 19 : Channel 19 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH19_Pos (19UL) /*!< Position of CH19 field. */ +#define PPI_CHENSET_CH19_Msk (0x1UL << PPI_CHENSET_CH19_Pos) /*!< Bit mask of CH19 field. */ +#define PPI_CHENSET_CH19_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH19_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH19_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 18 : Channel 18 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH18_Pos (18UL) /*!< Position of CH18 field. */ +#define PPI_CHENSET_CH18_Msk (0x1UL << PPI_CHENSET_CH18_Pos) /*!< Bit mask of CH18 field. */ +#define PPI_CHENSET_CH18_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH18_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH18_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 17 : Channel 17 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH17_Pos (17UL) /*!< Position of CH17 field. */ +#define PPI_CHENSET_CH17_Msk (0x1UL << PPI_CHENSET_CH17_Pos) /*!< Bit mask of CH17 field. */ +#define PPI_CHENSET_CH17_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH17_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH17_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 16 : Channel 16 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH16_Pos (16UL) /*!< Position of CH16 field. */ +#define PPI_CHENSET_CH16_Msk (0x1UL << PPI_CHENSET_CH16_Pos) /*!< Bit mask of CH16 field. */ +#define PPI_CHENSET_CH16_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH16_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH16_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 15 : Channel 15 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHENSET_CH15_Msk (0x1UL << PPI_CHENSET_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHENSET_CH15_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH15_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH15_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 14 : Channel 14 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHENSET_CH14_Msk (0x1UL << PPI_CHENSET_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHENSET_CH14_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH14_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH14_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 13 : Channel 13 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHENSET_CH13_Msk (0x1UL << PPI_CHENSET_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHENSET_CH13_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH13_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH13_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 12 : Channel 12 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHENSET_CH12_Msk (0x1UL << PPI_CHENSET_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHENSET_CH12_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH12_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH12_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 11 : Channel 11 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHENSET_CH11_Msk (0x1UL << PPI_CHENSET_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHENSET_CH11_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH11_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH11_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 10 : Channel 10 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHENSET_CH10_Msk (0x1UL << PPI_CHENSET_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHENSET_CH10_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH10_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH10_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 9 : Channel 9 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHENSET_CH9_Msk (0x1UL << PPI_CHENSET_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHENSET_CH9_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH9_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH9_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 8 : Channel 8 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHENSET_CH8_Msk (0x1UL << PPI_CHENSET_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHENSET_CH8_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH8_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH8_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 7 : Channel 7 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHENSET_CH7_Msk (0x1UL << PPI_CHENSET_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHENSET_CH7_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH7_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH7_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 6 : Channel 6 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHENSET_CH6_Msk (0x1UL << PPI_CHENSET_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHENSET_CH6_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH6_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH6_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 5 : Channel 5 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHENSET_CH5_Msk (0x1UL << PPI_CHENSET_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHENSET_CH5_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH5_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH5_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 4 : Channel 4 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHENSET_CH4_Msk (0x1UL << PPI_CHENSET_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHENSET_CH4_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH4_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH4_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 3 : Channel 3 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHENSET_CH3_Msk (0x1UL << PPI_CHENSET_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHENSET_CH3_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH3_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH3_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 2 : Channel 2 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHENSET_CH2_Msk (0x1UL << PPI_CHENSET_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHENSET_CH2_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH2_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH2_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 1 : Channel 1 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHENSET_CH1_Msk (0x1UL << PPI_CHENSET_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHENSET_CH1_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH1_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH1_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 0 : Channel 0 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHENSET_CH0_Msk (0x1UL << PPI_CHENSET_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHENSET_CH0_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH0_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH0_Set (1UL) /*!< Write: Enable channel */ + +/* Register: PPI_CHENCLR */ +/* Description: Channel enable clear register */ + +/* Bit 31 : Channel 31 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHENCLR_CH31_Msk (0x1UL << PPI_CHENCLR_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHENCLR_CH31_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH31_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH31_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 30 : Channel 30 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHENCLR_CH30_Msk (0x1UL << PPI_CHENCLR_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHENCLR_CH30_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH30_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH30_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 29 : Channel 29 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHENCLR_CH29_Msk (0x1UL << PPI_CHENCLR_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHENCLR_CH29_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH29_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH29_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 28 : Channel 28 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHENCLR_CH28_Msk (0x1UL << PPI_CHENCLR_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHENCLR_CH28_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH28_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH28_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 27 : Channel 27 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHENCLR_CH27_Msk (0x1UL << PPI_CHENCLR_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHENCLR_CH27_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH27_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH27_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 26 : Channel 26 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHENCLR_CH26_Msk (0x1UL << PPI_CHENCLR_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHENCLR_CH26_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH26_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH26_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 25 : Channel 25 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHENCLR_CH25_Msk (0x1UL << PPI_CHENCLR_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHENCLR_CH25_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH25_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH25_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 24 : Channel 24 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHENCLR_CH24_Msk (0x1UL << PPI_CHENCLR_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHENCLR_CH24_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH24_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH24_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 23 : Channel 23 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHENCLR_CH23_Msk (0x1UL << PPI_CHENCLR_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHENCLR_CH23_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH23_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH23_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 22 : Channel 22 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHENCLR_CH22_Msk (0x1UL << PPI_CHENCLR_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHENCLR_CH22_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH22_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH22_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 21 : Channel 21 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHENCLR_CH21_Msk (0x1UL << PPI_CHENCLR_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHENCLR_CH21_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH21_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH21_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 20 : Channel 20 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHENCLR_CH20_Msk (0x1UL << PPI_CHENCLR_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHENCLR_CH20_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH20_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH20_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 19 : Channel 19 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH19_Pos (19UL) /*!< Position of CH19 field. */ +#define PPI_CHENCLR_CH19_Msk (0x1UL << PPI_CHENCLR_CH19_Pos) /*!< Bit mask of CH19 field. */ +#define PPI_CHENCLR_CH19_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH19_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH19_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 18 : Channel 18 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH18_Pos (18UL) /*!< Position of CH18 field. */ +#define PPI_CHENCLR_CH18_Msk (0x1UL << PPI_CHENCLR_CH18_Pos) /*!< Bit mask of CH18 field. */ +#define PPI_CHENCLR_CH18_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH18_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH18_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 17 : Channel 17 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH17_Pos (17UL) /*!< Position of CH17 field. */ +#define PPI_CHENCLR_CH17_Msk (0x1UL << PPI_CHENCLR_CH17_Pos) /*!< Bit mask of CH17 field. */ +#define PPI_CHENCLR_CH17_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH17_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH17_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 16 : Channel 16 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH16_Pos (16UL) /*!< Position of CH16 field. */ +#define PPI_CHENCLR_CH16_Msk (0x1UL << PPI_CHENCLR_CH16_Pos) /*!< Bit mask of CH16 field. */ +#define PPI_CHENCLR_CH16_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH16_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH16_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 15 : Channel 15 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHENCLR_CH15_Msk (0x1UL << PPI_CHENCLR_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHENCLR_CH15_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH15_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH15_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 14 : Channel 14 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHENCLR_CH14_Msk (0x1UL << PPI_CHENCLR_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHENCLR_CH14_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH14_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH14_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 13 : Channel 13 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHENCLR_CH13_Msk (0x1UL << PPI_CHENCLR_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHENCLR_CH13_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH13_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH13_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 12 : Channel 12 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHENCLR_CH12_Msk (0x1UL << PPI_CHENCLR_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHENCLR_CH12_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH12_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH12_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 11 : Channel 11 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHENCLR_CH11_Msk (0x1UL << PPI_CHENCLR_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHENCLR_CH11_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH11_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH11_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 10 : Channel 10 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHENCLR_CH10_Msk (0x1UL << PPI_CHENCLR_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHENCLR_CH10_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH10_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH10_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 9 : Channel 9 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHENCLR_CH9_Msk (0x1UL << PPI_CHENCLR_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHENCLR_CH9_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH9_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH9_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 8 : Channel 8 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHENCLR_CH8_Msk (0x1UL << PPI_CHENCLR_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHENCLR_CH8_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH8_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH8_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 7 : Channel 7 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHENCLR_CH7_Msk (0x1UL << PPI_CHENCLR_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHENCLR_CH7_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH7_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH7_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 6 : Channel 6 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHENCLR_CH6_Msk (0x1UL << PPI_CHENCLR_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHENCLR_CH6_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH6_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH6_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 5 : Channel 5 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHENCLR_CH5_Msk (0x1UL << PPI_CHENCLR_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHENCLR_CH5_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH5_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH5_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 4 : Channel 4 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHENCLR_CH4_Msk (0x1UL << PPI_CHENCLR_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHENCLR_CH4_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH4_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH4_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 3 : Channel 3 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHENCLR_CH3_Msk (0x1UL << PPI_CHENCLR_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHENCLR_CH3_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH3_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH3_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 2 : Channel 2 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHENCLR_CH2_Msk (0x1UL << PPI_CHENCLR_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHENCLR_CH2_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH2_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH2_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 1 : Channel 1 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHENCLR_CH1_Msk (0x1UL << PPI_CHENCLR_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHENCLR_CH1_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH1_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH1_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 0 : Channel 0 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHENCLR_CH0_Msk (0x1UL << PPI_CHENCLR_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHENCLR_CH0_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH0_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH0_Clear (1UL) /*!< Write: disable channel */ + +/* Register: PPI_CH_EEP */ +/* Description: Description cluster[0]: Channel 0 event end-point */ + +/* Bits 31..0 : Pointer to event register. Accepts only addresses to registers from the Event group. */ +#define PPI_CH_EEP_EEP_Pos (0UL) /*!< Position of EEP field. */ +#define PPI_CH_EEP_EEP_Msk (0xFFFFFFFFUL << PPI_CH_EEP_EEP_Pos) /*!< Bit mask of EEP field. */ + +/* Register: PPI_CH_TEP */ +/* Description: Description cluster[0]: Channel 0 task end-point */ + +/* Bits 31..0 : Pointer to task register. Accepts only addresses to registers from the Task group. */ +#define PPI_CH_TEP_TEP_Pos (0UL) /*!< Position of TEP field. */ +#define PPI_CH_TEP_TEP_Msk (0xFFFFFFFFUL << PPI_CH_TEP_TEP_Pos) /*!< Bit mask of TEP field. */ + +/* Register: PPI_CHG */ +/* Description: Description collection[0]: Channel group 0 */ + +/* Bit 31 : Include or exclude channel 31 */ +#define PPI_CHG_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHG_CH31_Msk (0x1UL << PPI_CHG_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHG_CH31_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH31_Included (1UL) /*!< Include */ + +/* Bit 30 : Include or exclude channel 30 */ +#define PPI_CHG_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHG_CH30_Msk (0x1UL << PPI_CHG_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHG_CH30_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH30_Included (1UL) /*!< Include */ + +/* Bit 29 : Include or exclude channel 29 */ +#define PPI_CHG_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHG_CH29_Msk (0x1UL << PPI_CHG_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHG_CH29_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH29_Included (1UL) /*!< Include */ + +/* Bit 28 : Include or exclude channel 28 */ +#define PPI_CHG_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHG_CH28_Msk (0x1UL << PPI_CHG_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHG_CH28_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH28_Included (1UL) /*!< Include */ + +/* Bit 27 : Include or exclude channel 27 */ +#define PPI_CHG_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHG_CH27_Msk (0x1UL << PPI_CHG_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHG_CH27_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH27_Included (1UL) /*!< Include */ + +/* Bit 26 : Include or exclude channel 26 */ +#define PPI_CHG_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHG_CH26_Msk (0x1UL << PPI_CHG_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHG_CH26_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH26_Included (1UL) /*!< Include */ + +/* Bit 25 : Include or exclude channel 25 */ +#define PPI_CHG_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHG_CH25_Msk (0x1UL << PPI_CHG_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHG_CH25_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH25_Included (1UL) /*!< Include */ + +/* Bit 24 : Include or exclude channel 24 */ +#define PPI_CHG_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHG_CH24_Msk (0x1UL << PPI_CHG_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHG_CH24_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH24_Included (1UL) /*!< Include */ + +/* Bit 23 : Include or exclude channel 23 */ +#define PPI_CHG_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHG_CH23_Msk (0x1UL << PPI_CHG_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHG_CH23_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH23_Included (1UL) /*!< Include */ + +/* Bit 22 : Include or exclude channel 22 */ +#define PPI_CHG_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHG_CH22_Msk (0x1UL << PPI_CHG_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHG_CH22_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH22_Included (1UL) /*!< Include */ + +/* Bit 21 : Include or exclude channel 21 */ +#define PPI_CHG_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHG_CH21_Msk (0x1UL << PPI_CHG_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHG_CH21_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH21_Included (1UL) /*!< Include */ + +/* Bit 20 : Include or exclude channel 20 */ +#define PPI_CHG_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHG_CH20_Msk (0x1UL << PPI_CHG_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHG_CH20_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH20_Included (1UL) /*!< Include */ + +/* Bit 19 : Include or exclude channel 19 */ +#define PPI_CHG_CH19_Pos (19UL) /*!< Position of CH19 field. */ +#define PPI_CHG_CH19_Msk (0x1UL << PPI_CHG_CH19_Pos) /*!< Bit mask of CH19 field. */ +#define PPI_CHG_CH19_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH19_Included (1UL) /*!< Include */ + +/* Bit 18 : Include or exclude channel 18 */ +#define PPI_CHG_CH18_Pos (18UL) /*!< Position of CH18 field. */ +#define PPI_CHG_CH18_Msk (0x1UL << PPI_CHG_CH18_Pos) /*!< Bit mask of CH18 field. */ +#define PPI_CHG_CH18_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH18_Included (1UL) /*!< Include */ + +/* Bit 17 : Include or exclude channel 17 */ +#define PPI_CHG_CH17_Pos (17UL) /*!< Position of CH17 field. */ +#define PPI_CHG_CH17_Msk (0x1UL << PPI_CHG_CH17_Pos) /*!< Bit mask of CH17 field. */ +#define PPI_CHG_CH17_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH17_Included (1UL) /*!< Include */ + +/* Bit 16 : Include or exclude channel 16 */ +#define PPI_CHG_CH16_Pos (16UL) /*!< Position of CH16 field. */ +#define PPI_CHG_CH16_Msk (0x1UL << PPI_CHG_CH16_Pos) /*!< Bit mask of CH16 field. */ +#define PPI_CHG_CH16_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH16_Included (1UL) /*!< Include */ + +/* Bit 15 : Include or exclude channel 15 */ +#define PPI_CHG_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHG_CH15_Msk (0x1UL << PPI_CHG_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHG_CH15_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH15_Included (1UL) /*!< Include */ + +/* Bit 14 : Include or exclude channel 14 */ +#define PPI_CHG_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHG_CH14_Msk (0x1UL << PPI_CHG_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHG_CH14_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH14_Included (1UL) /*!< Include */ + +/* Bit 13 : Include or exclude channel 13 */ +#define PPI_CHG_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHG_CH13_Msk (0x1UL << PPI_CHG_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHG_CH13_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH13_Included (1UL) /*!< Include */ + +/* Bit 12 : Include or exclude channel 12 */ +#define PPI_CHG_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHG_CH12_Msk (0x1UL << PPI_CHG_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHG_CH12_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH12_Included (1UL) /*!< Include */ + +/* Bit 11 : Include or exclude channel 11 */ +#define PPI_CHG_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHG_CH11_Msk (0x1UL << PPI_CHG_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHG_CH11_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH11_Included (1UL) /*!< Include */ + +/* Bit 10 : Include or exclude channel 10 */ +#define PPI_CHG_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHG_CH10_Msk (0x1UL << PPI_CHG_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHG_CH10_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH10_Included (1UL) /*!< Include */ + +/* Bit 9 : Include or exclude channel 9 */ +#define PPI_CHG_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHG_CH9_Msk (0x1UL << PPI_CHG_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHG_CH9_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH9_Included (1UL) /*!< Include */ + +/* Bit 8 : Include or exclude channel 8 */ +#define PPI_CHG_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHG_CH8_Msk (0x1UL << PPI_CHG_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHG_CH8_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH8_Included (1UL) /*!< Include */ + +/* Bit 7 : Include or exclude channel 7 */ +#define PPI_CHG_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHG_CH7_Msk (0x1UL << PPI_CHG_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHG_CH7_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH7_Included (1UL) /*!< Include */ + +/* Bit 6 : Include or exclude channel 6 */ +#define PPI_CHG_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHG_CH6_Msk (0x1UL << PPI_CHG_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHG_CH6_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH6_Included (1UL) /*!< Include */ + +/* Bit 5 : Include or exclude channel 5 */ +#define PPI_CHG_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHG_CH5_Msk (0x1UL << PPI_CHG_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHG_CH5_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH5_Included (1UL) /*!< Include */ + +/* Bit 4 : Include or exclude channel 4 */ +#define PPI_CHG_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHG_CH4_Msk (0x1UL << PPI_CHG_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHG_CH4_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH4_Included (1UL) /*!< Include */ + +/* Bit 3 : Include or exclude channel 3 */ +#define PPI_CHG_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHG_CH3_Msk (0x1UL << PPI_CHG_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHG_CH3_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH3_Included (1UL) /*!< Include */ + +/* Bit 2 : Include or exclude channel 2 */ +#define PPI_CHG_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHG_CH2_Msk (0x1UL << PPI_CHG_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHG_CH2_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH2_Included (1UL) /*!< Include */ + +/* Bit 1 : Include or exclude channel 1 */ +#define PPI_CHG_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHG_CH1_Msk (0x1UL << PPI_CHG_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHG_CH1_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH1_Included (1UL) /*!< Include */ + +/* Bit 0 : Include or exclude channel 0 */ +#define PPI_CHG_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHG_CH0_Msk (0x1UL << PPI_CHG_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHG_CH0_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH0_Included (1UL) /*!< Include */ + +/* Register: PPI_FORK_TEP */ +/* Description: Description cluster[0]: Channel 0 task end-point */ + +/* Bits 31..0 : Pointer to task register */ +#define PPI_FORK_TEP_TEP_Pos (0UL) /*!< Position of TEP field. */ +#define PPI_FORK_TEP_TEP_Msk (0xFFFFFFFFUL << PPI_FORK_TEP_TEP_Pos) /*!< Bit mask of TEP field. */ + + +/* Peripheral: PWM */ +/* Description: Pulse Width Modulation Unit 0 */ + +/* Register: PWM_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between LOOPSDONE event and STOP task */ +#define PWM_SHORTS_LOOPSDONE_STOP_Pos (4UL) /*!< Position of LOOPSDONE_STOP field. */ +#define PWM_SHORTS_LOOPSDONE_STOP_Msk (0x1UL << PWM_SHORTS_LOOPSDONE_STOP_Pos) /*!< Bit mask of LOOPSDONE_STOP field. */ +#define PWM_SHORTS_LOOPSDONE_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_LOOPSDONE_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between LOOPSDONE event and SEQSTART[1] task */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART1_Pos (3UL) /*!< Position of LOOPSDONE_SEQSTART1 field. */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART1_Msk (0x1UL << PWM_SHORTS_LOOPSDONE_SEQSTART1_Pos) /*!< Bit mask of LOOPSDONE_SEQSTART1 field. */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART1_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART1_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between LOOPSDONE event and SEQSTART[0] task */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Pos (2UL) /*!< Position of LOOPSDONE_SEQSTART0 field. */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk (0x1UL << PWM_SHORTS_LOOPSDONE_SEQSTART0_Pos) /*!< Bit mask of LOOPSDONE_SEQSTART0 field. */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between SEQEND[1] event and STOP task */ +#define PWM_SHORTS_SEQEND1_STOP_Pos (1UL) /*!< Position of SEQEND1_STOP field. */ +#define PWM_SHORTS_SEQEND1_STOP_Msk (0x1UL << PWM_SHORTS_SEQEND1_STOP_Pos) /*!< Bit mask of SEQEND1_STOP field. */ +#define PWM_SHORTS_SEQEND1_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_SEQEND1_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between SEQEND[0] event and STOP task */ +#define PWM_SHORTS_SEQEND0_STOP_Pos (0UL) /*!< Position of SEQEND0_STOP field. */ +#define PWM_SHORTS_SEQEND0_STOP_Msk (0x1UL << PWM_SHORTS_SEQEND0_STOP_Pos) /*!< Bit mask of SEQEND0_STOP field. */ +#define PWM_SHORTS_SEQEND0_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_SEQEND0_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: PWM_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 7 : Enable or disable interrupt for LOOPSDONE event */ +#define PWM_INTEN_LOOPSDONE_Pos (7UL) /*!< Position of LOOPSDONE field. */ +#define PWM_INTEN_LOOPSDONE_Msk (0x1UL << PWM_INTEN_LOOPSDONE_Pos) /*!< Bit mask of LOOPSDONE field. */ +#define PWM_INTEN_LOOPSDONE_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_LOOPSDONE_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for PWMPERIODEND event */ +#define PWM_INTEN_PWMPERIODEND_Pos (6UL) /*!< Position of PWMPERIODEND field. */ +#define PWM_INTEN_PWMPERIODEND_Msk (0x1UL << PWM_INTEN_PWMPERIODEND_Pos) /*!< Bit mask of PWMPERIODEND field. */ +#define PWM_INTEN_PWMPERIODEND_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_PWMPERIODEND_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for SEQEND[1] event */ +#define PWM_INTEN_SEQEND1_Pos (5UL) /*!< Position of SEQEND1 field. */ +#define PWM_INTEN_SEQEND1_Msk (0x1UL << PWM_INTEN_SEQEND1_Pos) /*!< Bit mask of SEQEND1 field. */ +#define PWM_INTEN_SEQEND1_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_SEQEND1_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for SEQEND[0] event */ +#define PWM_INTEN_SEQEND0_Pos (4UL) /*!< Position of SEQEND0 field. */ +#define PWM_INTEN_SEQEND0_Msk (0x1UL << PWM_INTEN_SEQEND0_Pos) /*!< Bit mask of SEQEND0 field. */ +#define PWM_INTEN_SEQEND0_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_SEQEND0_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for SEQSTARTED[1] event */ +#define PWM_INTEN_SEQSTARTED1_Pos (3UL) /*!< Position of SEQSTARTED1 field. */ +#define PWM_INTEN_SEQSTARTED1_Msk (0x1UL << PWM_INTEN_SEQSTARTED1_Pos) /*!< Bit mask of SEQSTARTED1 field. */ +#define PWM_INTEN_SEQSTARTED1_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_SEQSTARTED1_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for SEQSTARTED[0] event */ +#define PWM_INTEN_SEQSTARTED0_Pos (2UL) /*!< Position of SEQSTARTED0 field. */ +#define PWM_INTEN_SEQSTARTED0_Msk (0x1UL << PWM_INTEN_SEQSTARTED0_Pos) /*!< Bit mask of SEQSTARTED0 field. */ +#define PWM_INTEN_SEQSTARTED0_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_SEQSTARTED0_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STOPPED event */ +#define PWM_INTEN_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PWM_INTEN_STOPPED_Msk (0x1UL << PWM_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PWM_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Register: PWM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 7 : Write '1' to Enable interrupt for LOOPSDONE event */ +#define PWM_INTENSET_LOOPSDONE_Pos (7UL) /*!< Position of LOOPSDONE field. */ +#define PWM_INTENSET_LOOPSDONE_Msk (0x1UL << PWM_INTENSET_LOOPSDONE_Pos) /*!< Bit mask of LOOPSDONE field. */ +#define PWM_INTENSET_LOOPSDONE_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_LOOPSDONE_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_LOOPSDONE_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for PWMPERIODEND event */ +#define PWM_INTENSET_PWMPERIODEND_Pos (6UL) /*!< Position of PWMPERIODEND field. */ +#define PWM_INTENSET_PWMPERIODEND_Msk (0x1UL << PWM_INTENSET_PWMPERIODEND_Pos) /*!< Bit mask of PWMPERIODEND field. */ +#define PWM_INTENSET_PWMPERIODEND_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_PWMPERIODEND_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_PWMPERIODEND_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for SEQEND[1] event */ +#define PWM_INTENSET_SEQEND1_Pos (5UL) /*!< Position of SEQEND1 field. */ +#define PWM_INTENSET_SEQEND1_Msk (0x1UL << PWM_INTENSET_SEQEND1_Pos) /*!< Bit mask of SEQEND1 field. */ +#define PWM_INTENSET_SEQEND1_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_SEQEND1_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_SEQEND1_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for SEQEND[0] event */ +#define PWM_INTENSET_SEQEND0_Pos (4UL) /*!< Position of SEQEND0 field. */ +#define PWM_INTENSET_SEQEND0_Msk (0x1UL << PWM_INTENSET_SEQEND0_Pos) /*!< Bit mask of SEQEND0 field. */ +#define PWM_INTENSET_SEQEND0_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_SEQEND0_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_SEQEND0_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for SEQSTARTED[1] event */ +#define PWM_INTENSET_SEQSTARTED1_Pos (3UL) /*!< Position of SEQSTARTED1 field. */ +#define PWM_INTENSET_SEQSTARTED1_Msk (0x1UL << PWM_INTENSET_SEQSTARTED1_Pos) /*!< Bit mask of SEQSTARTED1 field. */ +#define PWM_INTENSET_SEQSTARTED1_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_SEQSTARTED1_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_SEQSTARTED1_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for SEQSTARTED[0] event */ +#define PWM_INTENSET_SEQSTARTED0_Pos (2UL) /*!< Position of SEQSTARTED0 field. */ +#define PWM_INTENSET_SEQSTARTED0_Msk (0x1UL << PWM_INTENSET_SEQSTARTED0_Pos) /*!< Bit mask of SEQSTARTED0 field. */ +#define PWM_INTENSET_SEQSTARTED0_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_SEQSTARTED0_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_SEQSTARTED0_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define PWM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PWM_INTENSET_STOPPED_Msk (0x1UL << PWM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PWM_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: PWM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 7 : Write '1' to Disable interrupt for LOOPSDONE event */ +#define PWM_INTENCLR_LOOPSDONE_Pos (7UL) /*!< Position of LOOPSDONE field. */ +#define PWM_INTENCLR_LOOPSDONE_Msk (0x1UL << PWM_INTENCLR_LOOPSDONE_Pos) /*!< Bit mask of LOOPSDONE field. */ +#define PWM_INTENCLR_LOOPSDONE_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_LOOPSDONE_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_LOOPSDONE_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for PWMPERIODEND event */ +#define PWM_INTENCLR_PWMPERIODEND_Pos (6UL) /*!< Position of PWMPERIODEND field. */ +#define PWM_INTENCLR_PWMPERIODEND_Msk (0x1UL << PWM_INTENCLR_PWMPERIODEND_Pos) /*!< Bit mask of PWMPERIODEND field. */ +#define PWM_INTENCLR_PWMPERIODEND_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_PWMPERIODEND_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_PWMPERIODEND_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for SEQEND[1] event */ +#define PWM_INTENCLR_SEQEND1_Pos (5UL) /*!< Position of SEQEND1 field. */ +#define PWM_INTENCLR_SEQEND1_Msk (0x1UL << PWM_INTENCLR_SEQEND1_Pos) /*!< Bit mask of SEQEND1 field. */ +#define PWM_INTENCLR_SEQEND1_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_SEQEND1_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_SEQEND1_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for SEQEND[0] event */ +#define PWM_INTENCLR_SEQEND0_Pos (4UL) /*!< Position of SEQEND0 field. */ +#define PWM_INTENCLR_SEQEND0_Msk (0x1UL << PWM_INTENCLR_SEQEND0_Pos) /*!< Bit mask of SEQEND0 field. */ +#define PWM_INTENCLR_SEQEND0_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_SEQEND0_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_SEQEND0_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for SEQSTARTED[1] event */ +#define PWM_INTENCLR_SEQSTARTED1_Pos (3UL) /*!< Position of SEQSTARTED1 field. */ +#define PWM_INTENCLR_SEQSTARTED1_Msk (0x1UL << PWM_INTENCLR_SEQSTARTED1_Pos) /*!< Bit mask of SEQSTARTED1 field. */ +#define PWM_INTENCLR_SEQSTARTED1_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_SEQSTARTED1_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_SEQSTARTED1_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for SEQSTARTED[0] event */ +#define PWM_INTENCLR_SEQSTARTED0_Pos (2UL) /*!< Position of SEQSTARTED0 field. */ +#define PWM_INTENCLR_SEQSTARTED0_Msk (0x1UL << PWM_INTENCLR_SEQSTARTED0_Pos) /*!< Bit mask of SEQSTARTED0 field. */ +#define PWM_INTENCLR_SEQSTARTED0_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_SEQSTARTED0_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_SEQSTARTED0_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define PWM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PWM_INTENCLR_STOPPED_Msk (0x1UL << PWM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PWM_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: PWM_ENABLE */ +/* Description: PWM module enable register */ + +/* Bit 0 : Enable or disable PWM module */ +#define PWM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define PWM_ENABLE_ENABLE_Msk (0x1UL << PWM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define PWM_ENABLE_ENABLE_Disabled (0UL) /*!< Disabled */ +#define PWM_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: PWM_MODE */ +/* Description: Selects operating mode of the wave counter */ + +/* Bit 0 : Selects up or up and down as wave counter mode */ +#define PWM_MODE_UPDOWN_Pos (0UL) /*!< Position of UPDOWN field. */ +#define PWM_MODE_UPDOWN_Msk (0x1UL << PWM_MODE_UPDOWN_Pos) /*!< Bit mask of UPDOWN field. */ +#define PWM_MODE_UPDOWN_Up (0UL) /*!< Up counter - edge aligned PWM duty-cycle */ +#define PWM_MODE_UPDOWN_UpAndDown (1UL) /*!< Up and down counter - center aligned PWM duty cycle */ + +/* Register: PWM_COUNTERTOP */ +/* Description: Value up to which the pulse generator counter counts */ + +/* Bits 14..0 : Value up to which the pulse generator counter counts. This register is ignored when DECODER.MODE=WaveForm and only values from RAM will be used. */ +#define PWM_COUNTERTOP_COUNTERTOP_Pos (0UL) /*!< Position of COUNTERTOP field. */ +#define PWM_COUNTERTOP_COUNTERTOP_Msk (0x7FFFUL << PWM_COUNTERTOP_COUNTERTOP_Pos) /*!< Bit mask of COUNTERTOP field. */ + +/* Register: PWM_PRESCALER */ +/* Description: Configuration for PWM_CLK */ + +/* Bits 2..0 : Pre-scaler of PWM_CLK */ +#define PWM_PRESCALER_PRESCALER_Pos (0UL) /*!< Position of PRESCALER field. */ +#define PWM_PRESCALER_PRESCALER_Msk (0x7UL << PWM_PRESCALER_PRESCALER_Pos) /*!< Bit mask of PRESCALER field. */ +#define PWM_PRESCALER_PRESCALER_DIV_1 (0UL) /*!< Divide by 1 (16MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_2 (1UL) /*!< Divide by 2 ( 8MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_4 (2UL) /*!< Divide by 4 ( 4MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_8 (3UL) /*!< Divide by 8 ( 2MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_16 (4UL) /*!< Divide by 16 ( 1MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_32 (5UL) /*!< Divide by 32 ( 500kHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_64 (6UL) /*!< Divide by 64 ( 250kHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_128 (7UL) /*!< Divide by 128 ( 125kHz) */ + +/* Register: PWM_DECODER */ +/* Description: Configuration of the decoder */ + +/* Bit 8 : Selects source for advancing the active sequence */ +#define PWM_DECODER_MODE_Pos (8UL) /*!< Position of MODE field. */ +#define PWM_DECODER_MODE_Msk (0x1UL << PWM_DECODER_MODE_Pos) /*!< Bit mask of MODE field. */ +#define PWM_DECODER_MODE_RefreshCount (0UL) /*!< SEQ[n].REFRESH is used to determine loading internal compare registers */ +#define PWM_DECODER_MODE_NextStep (1UL) /*!< NEXTSTEP task causes a new value to be loaded to internal compare registers */ + +/* Bits 2..0 : How a sequence is read from RAM and spread to the compare register */ +#define PWM_DECODER_LOAD_Pos (0UL) /*!< Position of LOAD field. */ +#define PWM_DECODER_LOAD_Msk (0x7UL << PWM_DECODER_LOAD_Pos) /*!< Bit mask of LOAD field. */ +#define PWM_DECODER_LOAD_Common (0UL) /*!< 1st half word (16-bit) used in all PWM channels 0..3 */ +#define PWM_DECODER_LOAD_Grouped (1UL) /*!< 1st half word (16-bit) used in channel 0..1; 2nd word in channel 2..3 */ +#define PWM_DECODER_LOAD_Individual (2UL) /*!< 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in ch.3 */ +#define PWM_DECODER_LOAD_WaveForm (3UL) /*!< 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in COUNTERTOP */ + +/* Register: PWM_LOOP */ +/* Description: Amount of playback of a loop */ + +/* Bits 15..0 : Amount of playback of pattern cycles */ +#define PWM_LOOP_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define PWM_LOOP_CNT_Msk (0xFFFFUL << PWM_LOOP_CNT_Pos) /*!< Bit mask of CNT field. */ +#define PWM_LOOP_CNT_Disabled (0UL) /*!< Looping disabled (stop at the end of the sequence) */ + +/* Register: PWM_SEQ_PTR */ +/* Description: Description cluster[0]: Beginning address in Data RAM of sequence A */ + +/* Bits 31..0 : Beginning address in Data RAM of sequence A */ +#define PWM_SEQ_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define PWM_SEQ_PTR_PTR_Msk (0xFFFFFFFFUL << PWM_SEQ_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: PWM_SEQ_CNT */ +/* Description: Description cluster[0]: Amount of values (duty cycles) in sequence A */ + +/* Bits 14..0 : Amount of values (duty cycles) in sequence A */ +#define PWM_SEQ_CNT_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define PWM_SEQ_CNT_CNT_Msk (0x7FFFUL << PWM_SEQ_CNT_CNT_Pos) /*!< Bit mask of CNT field. */ +#define PWM_SEQ_CNT_CNT_Disabled (0UL) /*!< Sequence is disabled, and shall not be started as it is empty */ + +/* Register: PWM_SEQ_REFRESH */ +/* Description: Description cluster[0]: Amount of additional PWM periods between samples loaded to compare register (load every CNT+1 PWM periods) */ + +/* Bits 23..0 : Amount of additional PWM periods between samples loaded to compare register (load every CNT+1 PWM periods) */ +#define PWM_SEQ_REFRESH_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define PWM_SEQ_REFRESH_CNT_Msk (0xFFFFFFUL << PWM_SEQ_REFRESH_CNT_Pos) /*!< Bit mask of CNT field. */ +#define PWM_SEQ_REFRESH_CNT_Continuous (0UL) /*!< Update every PWM period */ + +/* Register: PWM_SEQ_ENDDELAY */ +/* Description: Description cluster[0]: Time added after the sequence */ + +/* Bits 23..0 : Time added after the sequence in PWM periods */ +#define PWM_SEQ_ENDDELAY_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define PWM_SEQ_ENDDELAY_CNT_Msk (0xFFFFFFUL << PWM_SEQ_ENDDELAY_CNT_Pos) /*!< Bit mask of CNT field. */ + +/* Register: PWM_PSEL_OUT */ +/* Description: Description collection[0]: Output pin select for PWM channel 0 */ + +/* Bit 31 : Connection */ +#define PWM_PSEL_OUT_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define PWM_PSEL_OUT_CONNECT_Msk (0x1UL << PWM_PSEL_OUT_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define PWM_PSEL_OUT_CONNECT_Connected (0UL) /*!< Connect */ +#define PWM_PSEL_OUT_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define PWM_PSEL_OUT_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define PWM_PSEL_OUT_PIN_Msk (0x1FUL << PWM_PSEL_OUT_PIN_Pos) /*!< Bit mask of PIN field. */ + + +/* Peripheral: QDEC */ +/* Description: Quadrature Decoder */ + +/* Register: QDEC_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 6 : Shortcut between SAMPLERDY event and READCLRACC task */ +#define QDEC_SHORTS_SAMPLERDY_READCLRACC_Pos (6UL) /*!< Position of SAMPLERDY_READCLRACC field. */ +#define QDEC_SHORTS_SAMPLERDY_READCLRACC_Msk (0x1UL << QDEC_SHORTS_SAMPLERDY_READCLRACC_Pos) /*!< Bit mask of SAMPLERDY_READCLRACC field. */ +#define QDEC_SHORTS_SAMPLERDY_READCLRACC_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_SAMPLERDY_READCLRACC_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 5 : Shortcut between DBLRDY event and STOP task */ +#define QDEC_SHORTS_DBLRDY_STOP_Pos (5UL) /*!< Position of DBLRDY_STOP field. */ +#define QDEC_SHORTS_DBLRDY_STOP_Msk (0x1UL << QDEC_SHORTS_DBLRDY_STOP_Pos) /*!< Bit mask of DBLRDY_STOP field. */ +#define QDEC_SHORTS_DBLRDY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_DBLRDY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 4 : Shortcut between DBLRDY event and RDCLRDBL task */ +#define QDEC_SHORTS_DBLRDY_RDCLRDBL_Pos (4UL) /*!< Position of DBLRDY_RDCLRDBL field. */ +#define QDEC_SHORTS_DBLRDY_RDCLRDBL_Msk (0x1UL << QDEC_SHORTS_DBLRDY_RDCLRDBL_Pos) /*!< Bit mask of DBLRDY_RDCLRDBL field. */ +#define QDEC_SHORTS_DBLRDY_RDCLRDBL_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_DBLRDY_RDCLRDBL_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between REPORTRDY event and STOP task */ +#define QDEC_SHORTS_REPORTRDY_STOP_Pos (3UL) /*!< Position of REPORTRDY_STOP field. */ +#define QDEC_SHORTS_REPORTRDY_STOP_Msk (0x1UL << QDEC_SHORTS_REPORTRDY_STOP_Pos) /*!< Bit mask of REPORTRDY_STOP field. */ +#define QDEC_SHORTS_REPORTRDY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_REPORTRDY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between REPORTRDY event and RDCLRACC task */ +#define QDEC_SHORTS_REPORTRDY_RDCLRACC_Pos (2UL) /*!< Position of REPORTRDY_RDCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_RDCLRACC_Msk (0x1UL << QDEC_SHORTS_REPORTRDY_RDCLRACC_Pos) /*!< Bit mask of REPORTRDY_RDCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_RDCLRACC_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_REPORTRDY_RDCLRACC_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between SAMPLERDY event and STOP task */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Pos (1UL) /*!< Position of SAMPLERDY_STOP field. */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Msk (0x1UL << QDEC_SHORTS_SAMPLERDY_STOP_Pos) /*!< Bit mask of SAMPLERDY_STOP field. */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between REPORTRDY event and READCLRACC task */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Pos (0UL) /*!< Position of REPORTRDY_READCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Msk (0x1UL << QDEC_SHORTS_REPORTRDY_READCLRACC_Pos) /*!< Bit mask of REPORTRDY_READCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: QDEC_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 4 : Write '1' to Enable interrupt for STOPPED event */ +#define QDEC_INTENSET_STOPPED_Pos (4UL) /*!< Position of STOPPED field. */ +#define QDEC_INTENSET_STOPPED_Msk (0x1UL << QDEC_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define QDEC_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for DBLRDY event */ +#define QDEC_INTENSET_DBLRDY_Pos (3UL) /*!< Position of DBLRDY field. */ +#define QDEC_INTENSET_DBLRDY_Msk (0x1UL << QDEC_INTENSET_DBLRDY_Pos) /*!< Bit mask of DBLRDY field. */ +#define QDEC_INTENSET_DBLRDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_DBLRDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_DBLRDY_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for ACCOF event */ +#define QDEC_INTENSET_ACCOF_Pos (2UL) /*!< Position of ACCOF field. */ +#define QDEC_INTENSET_ACCOF_Msk (0x1UL << QDEC_INTENSET_ACCOF_Pos) /*!< Bit mask of ACCOF field. */ +#define QDEC_INTENSET_ACCOF_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_ACCOF_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_ACCOF_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for REPORTRDY event */ +#define QDEC_INTENSET_REPORTRDY_Pos (1UL) /*!< Position of REPORTRDY field. */ +#define QDEC_INTENSET_REPORTRDY_Msk (0x1UL << QDEC_INTENSET_REPORTRDY_Pos) /*!< Bit mask of REPORTRDY field. */ +#define QDEC_INTENSET_REPORTRDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_REPORTRDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_REPORTRDY_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for SAMPLERDY event */ +#define QDEC_INTENSET_SAMPLERDY_Pos (0UL) /*!< Position of SAMPLERDY field. */ +#define QDEC_INTENSET_SAMPLERDY_Msk (0x1UL << QDEC_INTENSET_SAMPLERDY_Pos) /*!< Bit mask of SAMPLERDY field. */ +#define QDEC_INTENSET_SAMPLERDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_SAMPLERDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_SAMPLERDY_Set (1UL) /*!< Enable */ + +/* Register: QDEC_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 4 : Write '1' to Disable interrupt for STOPPED event */ +#define QDEC_INTENCLR_STOPPED_Pos (4UL) /*!< Position of STOPPED field. */ +#define QDEC_INTENCLR_STOPPED_Msk (0x1UL << QDEC_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define QDEC_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for DBLRDY event */ +#define QDEC_INTENCLR_DBLRDY_Pos (3UL) /*!< Position of DBLRDY field. */ +#define QDEC_INTENCLR_DBLRDY_Msk (0x1UL << QDEC_INTENCLR_DBLRDY_Pos) /*!< Bit mask of DBLRDY field. */ +#define QDEC_INTENCLR_DBLRDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_DBLRDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_DBLRDY_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for ACCOF event */ +#define QDEC_INTENCLR_ACCOF_Pos (2UL) /*!< Position of ACCOF field. */ +#define QDEC_INTENCLR_ACCOF_Msk (0x1UL << QDEC_INTENCLR_ACCOF_Pos) /*!< Bit mask of ACCOF field. */ +#define QDEC_INTENCLR_ACCOF_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_ACCOF_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_ACCOF_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for REPORTRDY event */ +#define QDEC_INTENCLR_REPORTRDY_Pos (1UL) /*!< Position of REPORTRDY field. */ +#define QDEC_INTENCLR_REPORTRDY_Msk (0x1UL << QDEC_INTENCLR_REPORTRDY_Pos) /*!< Bit mask of REPORTRDY field. */ +#define QDEC_INTENCLR_REPORTRDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_REPORTRDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_REPORTRDY_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for SAMPLERDY event */ +#define QDEC_INTENCLR_SAMPLERDY_Pos (0UL) /*!< Position of SAMPLERDY field. */ +#define QDEC_INTENCLR_SAMPLERDY_Msk (0x1UL << QDEC_INTENCLR_SAMPLERDY_Pos) /*!< Bit mask of SAMPLERDY field. */ +#define QDEC_INTENCLR_SAMPLERDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_SAMPLERDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_SAMPLERDY_Clear (1UL) /*!< Disable */ + +/* Register: QDEC_ENABLE */ +/* Description: Enable the quadrature decoder */ + +/* Bit 0 : Enable or disable the quadrature decoder */ +#define QDEC_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define QDEC_ENABLE_ENABLE_Msk (0x1UL << QDEC_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define QDEC_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define QDEC_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: QDEC_LEDPOL */ +/* Description: LED output pin polarity */ + +/* Bit 0 : LED output pin polarity */ +#define QDEC_LEDPOL_LEDPOL_Pos (0UL) /*!< Position of LEDPOL field. */ +#define QDEC_LEDPOL_LEDPOL_Msk (0x1UL << QDEC_LEDPOL_LEDPOL_Pos) /*!< Bit mask of LEDPOL field. */ +#define QDEC_LEDPOL_LEDPOL_ActiveLow (0UL) /*!< Led active on output pin low */ +#define QDEC_LEDPOL_LEDPOL_ActiveHigh (1UL) /*!< Led active on output pin high */ + +/* Register: QDEC_SAMPLEPER */ +/* Description: Sample period */ + +/* Bits 3..0 : Sample period. The SAMPLE register will be updated for every new sample */ +#define QDEC_SAMPLEPER_SAMPLEPER_Pos (0UL) /*!< Position of SAMPLEPER field. */ +#define QDEC_SAMPLEPER_SAMPLEPER_Msk (0xFUL << QDEC_SAMPLEPER_SAMPLEPER_Pos) /*!< Bit mask of SAMPLEPER field. */ +#define QDEC_SAMPLEPER_SAMPLEPER_128us (0UL) /*!< 128 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_256us (1UL) /*!< 256 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_512us (2UL) /*!< 512 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_1024us (3UL) /*!< 1024 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_2048us (4UL) /*!< 2048 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_4096us (5UL) /*!< 4096 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_8192us (6UL) /*!< 8192 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_16384us (7UL) /*!< 16384 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_32ms (8UL) /*!< 32768 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_65ms (9UL) /*!< 65536 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_131ms (10UL) /*!< 131072 us */ + +/* Register: QDEC_SAMPLE */ +/* Description: Motion sample value */ + +/* Bits 31..0 : Last motion sample */ +#define QDEC_SAMPLE_SAMPLE_Pos (0UL) /*!< Position of SAMPLE field. */ +#define QDEC_SAMPLE_SAMPLE_Msk (0xFFFFFFFFUL << QDEC_SAMPLE_SAMPLE_Pos) /*!< Bit mask of SAMPLE field. */ + +/* Register: QDEC_REPORTPER */ +/* Description: Number of samples to be taken before REPORTRDY and DBLRDY events can be generated */ + +/* Bits 3..0 : Specifies the number of samples to be accumulated in the ACC register before the REPORTRDY and DBLRDY events can be generated */ +#define QDEC_REPORTPER_REPORTPER_Pos (0UL) /*!< Position of REPORTPER field. */ +#define QDEC_REPORTPER_REPORTPER_Msk (0xFUL << QDEC_REPORTPER_REPORTPER_Pos) /*!< Bit mask of REPORTPER field. */ +#define QDEC_REPORTPER_REPORTPER_10Smpl (0UL) /*!< 10 samples / report */ +#define QDEC_REPORTPER_REPORTPER_40Smpl (1UL) /*!< 40 samples / report */ +#define QDEC_REPORTPER_REPORTPER_80Smpl (2UL) /*!< 80 samples / report */ +#define QDEC_REPORTPER_REPORTPER_120Smpl (3UL) /*!< 120 samples / report */ +#define QDEC_REPORTPER_REPORTPER_160Smpl (4UL) /*!< 160 samples / report */ +#define QDEC_REPORTPER_REPORTPER_200Smpl (5UL) /*!< 200 samples / report */ +#define QDEC_REPORTPER_REPORTPER_240Smpl (6UL) /*!< 240 samples / report */ +#define QDEC_REPORTPER_REPORTPER_280Smpl (7UL) /*!< 280 samples / report */ +#define QDEC_REPORTPER_REPORTPER_1Smpl (8UL) /*!< 1 sample / report */ + +/* Register: QDEC_ACC */ +/* Description: Register accumulating the valid transitions */ + +/* Bits 31..0 : Register accumulating all valid samples (not double transition) read from the SAMPLE register */ +#define QDEC_ACC_ACC_Pos (0UL) /*!< Position of ACC field. */ +#define QDEC_ACC_ACC_Msk (0xFFFFFFFFUL << QDEC_ACC_ACC_Pos) /*!< Bit mask of ACC field. */ + +/* Register: QDEC_ACCREAD */ +/* Description: Snapshot of the ACC register, updated by the READCLRACC or RDCLRACC task */ + +/* Bits 31..0 : Snapshot of the ACC register. */ +#define QDEC_ACCREAD_ACCREAD_Pos (0UL) /*!< Position of ACCREAD field. */ +#define QDEC_ACCREAD_ACCREAD_Msk (0xFFFFFFFFUL << QDEC_ACCREAD_ACCREAD_Pos) /*!< Bit mask of ACCREAD field. */ + +/* Register: QDEC_PSEL_LED */ +/* Description: Pin select for LED signal */ + +/* Bit 31 : Connection */ +#define QDEC_PSEL_LED_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QDEC_PSEL_LED_CONNECT_Msk (0x1UL << QDEC_PSEL_LED_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QDEC_PSEL_LED_CONNECT_Connected (0UL) /*!< Connect */ +#define QDEC_PSEL_LED_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define QDEC_PSEL_LED_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QDEC_PSEL_LED_PIN_Msk (0x1FUL << QDEC_PSEL_LED_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QDEC_PSEL_A */ +/* Description: Pin select for A signal */ + +/* Bit 31 : Connection */ +#define QDEC_PSEL_A_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QDEC_PSEL_A_CONNECT_Msk (0x1UL << QDEC_PSEL_A_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QDEC_PSEL_A_CONNECT_Connected (0UL) /*!< Connect */ +#define QDEC_PSEL_A_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define QDEC_PSEL_A_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QDEC_PSEL_A_PIN_Msk (0x1FUL << QDEC_PSEL_A_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QDEC_PSEL_B */ +/* Description: Pin select for B signal */ + +/* Bit 31 : Connection */ +#define QDEC_PSEL_B_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QDEC_PSEL_B_CONNECT_Msk (0x1UL << QDEC_PSEL_B_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QDEC_PSEL_B_CONNECT_Connected (0UL) /*!< Connect */ +#define QDEC_PSEL_B_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define QDEC_PSEL_B_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QDEC_PSEL_B_PIN_Msk (0x1FUL << QDEC_PSEL_B_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QDEC_DBFEN */ +/* Description: Enable input debounce filters */ + +/* Bit 0 : Enable input debounce filters */ +#define QDEC_DBFEN_DBFEN_Pos (0UL) /*!< Position of DBFEN field. */ +#define QDEC_DBFEN_DBFEN_Msk (0x1UL << QDEC_DBFEN_DBFEN_Pos) /*!< Bit mask of DBFEN field. */ +#define QDEC_DBFEN_DBFEN_Disabled (0UL) /*!< Debounce input filters disabled */ +#define QDEC_DBFEN_DBFEN_Enabled (1UL) /*!< Debounce input filters enabled */ + +/* Register: QDEC_LEDPRE */ +/* Description: Time period the LED is switched ON prior to sampling */ + +/* Bits 8..0 : Period in us the LED is switched on prior to sampling */ +#define QDEC_LEDPRE_LEDPRE_Pos (0UL) /*!< Position of LEDPRE field. */ +#define QDEC_LEDPRE_LEDPRE_Msk (0x1FFUL << QDEC_LEDPRE_LEDPRE_Pos) /*!< Bit mask of LEDPRE field. */ + +/* Register: QDEC_ACCDBL */ +/* Description: Register accumulating the number of detected double transitions */ + +/* Bits 3..0 : Register accumulating the number of detected double or illegal transitions. ( SAMPLE = 2 ). */ +#define QDEC_ACCDBL_ACCDBL_Pos (0UL) /*!< Position of ACCDBL field. */ +#define QDEC_ACCDBL_ACCDBL_Msk (0xFUL << QDEC_ACCDBL_ACCDBL_Pos) /*!< Bit mask of ACCDBL field. */ + +/* Register: QDEC_ACCDBLREAD */ +/* Description: Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL task */ + +/* Bits 3..0 : Snapshot of the ACCDBL register. This field is updated when the READCLRACC or RDCLRDBL task is triggered. */ +#define QDEC_ACCDBLREAD_ACCDBLREAD_Pos (0UL) /*!< Position of ACCDBLREAD field. */ +#define QDEC_ACCDBLREAD_ACCDBLREAD_Msk (0xFUL << QDEC_ACCDBLREAD_ACCDBLREAD_Pos) /*!< Bit mask of ACCDBLREAD field. */ + + +/* Peripheral: RADIO */ +/* Description: 2.4 GHz Radio */ + +/* Register: RADIO_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 8 : Shortcut between DISABLED event and RSSISTOP task */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Pos (8UL) /*!< Position of DISABLED_RSSISTOP field. */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Msk (0x1UL << RADIO_SHORTS_DISABLED_RSSISTOP_Pos) /*!< Bit mask of DISABLED_RSSISTOP field. */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 6 : Shortcut between ADDRESS event and BCSTART task */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Pos (6UL) /*!< Position of ADDRESS_BCSTART field. */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Msk (0x1UL << RADIO_SHORTS_ADDRESS_BCSTART_Pos) /*!< Bit mask of ADDRESS_BCSTART field. */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 5 : Shortcut between END event and START task */ +#define RADIO_SHORTS_END_START_Pos (5UL) /*!< Position of END_START field. */ +#define RADIO_SHORTS_END_START_Msk (0x1UL << RADIO_SHORTS_END_START_Pos) /*!< Bit mask of END_START field. */ +#define RADIO_SHORTS_END_START_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_END_START_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 4 : Shortcut between ADDRESS event and RSSISTART task */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Pos (4UL) /*!< Position of ADDRESS_RSSISTART field. */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Msk (0x1UL << RADIO_SHORTS_ADDRESS_RSSISTART_Pos) /*!< Bit mask of ADDRESS_RSSISTART field. */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between DISABLED event and RXEN task */ +#define RADIO_SHORTS_DISABLED_RXEN_Pos (3UL) /*!< Position of DISABLED_RXEN field. */ +#define RADIO_SHORTS_DISABLED_RXEN_Msk (0x1UL << RADIO_SHORTS_DISABLED_RXEN_Pos) /*!< Bit mask of DISABLED_RXEN field. */ +#define RADIO_SHORTS_DISABLED_RXEN_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_DISABLED_RXEN_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between DISABLED event and TXEN task */ +#define RADIO_SHORTS_DISABLED_TXEN_Pos (2UL) /*!< Position of DISABLED_TXEN field. */ +#define RADIO_SHORTS_DISABLED_TXEN_Msk (0x1UL << RADIO_SHORTS_DISABLED_TXEN_Pos) /*!< Bit mask of DISABLED_TXEN field. */ +#define RADIO_SHORTS_DISABLED_TXEN_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_DISABLED_TXEN_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between END event and DISABLE task */ +#define RADIO_SHORTS_END_DISABLE_Pos (1UL) /*!< Position of END_DISABLE field. */ +#define RADIO_SHORTS_END_DISABLE_Msk (0x1UL << RADIO_SHORTS_END_DISABLE_Pos) /*!< Bit mask of END_DISABLE field. */ +#define RADIO_SHORTS_END_DISABLE_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_END_DISABLE_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between READY event and START task */ +#define RADIO_SHORTS_READY_START_Pos (0UL) /*!< Position of READY_START field. */ +#define RADIO_SHORTS_READY_START_Msk (0x1UL << RADIO_SHORTS_READY_START_Pos) /*!< Bit mask of READY_START field. */ +#define RADIO_SHORTS_READY_START_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_READY_START_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: RADIO_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 13 : Write '1' to Enable interrupt for CRCERROR event */ +#define RADIO_INTENSET_CRCERROR_Pos (13UL) /*!< Position of CRCERROR field. */ +#define RADIO_INTENSET_CRCERROR_Msk (0x1UL << RADIO_INTENSET_CRCERROR_Pos) /*!< Bit mask of CRCERROR field. */ +#define RADIO_INTENSET_CRCERROR_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_CRCERROR_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_CRCERROR_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for CRCOK event */ +#define RADIO_INTENSET_CRCOK_Pos (12UL) /*!< Position of CRCOK field. */ +#define RADIO_INTENSET_CRCOK_Msk (0x1UL << RADIO_INTENSET_CRCOK_Pos) /*!< Bit mask of CRCOK field. */ +#define RADIO_INTENSET_CRCOK_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_CRCOK_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_CRCOK_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for BCMATCH event */ +#define RADIO_INTENSET_BCMATCH_Pos (10UL) /*!< Position of BCMATCH field. */ +#define RADIO_INTENSET_BCMATCH_Msk (0x1UL << RADIO_INTENSET_BCMATCH_Pos) /*!< Bit mask of BCMATCH field. */ +#define RADIO_INTENSET_BCMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_BCMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_BCMATCH_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for RSSIEND event */ +#define RADIO_INTENSET_RSSIEND_Pos (7UL) /*!< Position of RSSIEND field. */ +#define RADIO_INTENSET_RSSIEND_Msk (0x1UL << RADIO_INTENSET_RSSIEND_Pos) /*!< Bit mask of RSSIEND field. */ +#define RADIO_INTENSET_RSSIEND_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_RSSIEND_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_RSSIEND_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for DEVMISS event */ +#define RADIO_INTENSET_DEVMISS_Pos (6UL) /*!< Position of DEVMISS field. */ +#define RADIO_INTENSET_DEVMISS_Msk (0x1UL << RADIO_INTENSET_DEVMISS_Pos) /*!< Bit mask of DEVMISS field. */ +#define RADIO_INTENSET_DEVMISS_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_DEVMISS_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_DEVMISS_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for DEVMATCH event */ +#define RADIO_INTENSET_DEVMATCH_Pos (5UL) /*!< Position of DEVMATCH field. */ +#define RADIO_INTENSET_DEVMATCH_Msk (0x1UL << RADIO_INTENSET_DEVMATCH_Pos) /*!< Bit mask of DEVMATCH field. */ +#define RADIO_INTENSET_DEVMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_DEVMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_DEVMATCH_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for DISABLED event */ +#define RADIO_INTENSET_DISABLED_Pos (4UL) /*!< Position of DISABLED field. */ +#define RADIO_INTENSET_DISABLED_Msk (0x1UL << RADIO_INTENSET_DISABLED_Pos) /*!< Bit mask of DISABLED field. */ +#define RADIO_INTENSET_DISABLED_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_DISABLED_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_DISABLED_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for END event */ +#define RADIO_INTENSET_END_Pos (3UL) /*!< Position of END field. */ +#define RADIO_INTENSET_END_Msk (0x1UL << RADIO_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define RADIO_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for PAYLOAD event */ +#define RADIO_INTENSET_PAYLOAD_Pos (2UL) /*!< Position of PAYLOAD field. */ +#define RADIO_INTENSET_PAYLOAD_Msk (0x1UL << RADIO_INTENSET_PAYLOAD_Pos) /*!< Bit mask of PAYLOAD field. */ +#define RADIO_INTENSET_PAYLOAD_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_PAYLOAD_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_PAYLOAD_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for ADDRESS event */ +#define RADIO_INTENSET_ADDRESS_Pos (1UL) /*!< Position of ADDRESS field. */ +#define RADIO_INTENSET_ADDRESS_Msk (0x1UL << RADIO_INTENSET_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ +#define RADIO_INTENSET_ADDRESS_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_ADDRESS_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_ADDRESS_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define RADIO_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define RADIO_INTENSET_READY_Msk (0x1UL << RADIO_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define RADIO_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: RADIO_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 13 : Write '1' to Disable interrupt for CRCERROR event */ +#define RADIO_INTENCLR_CRCERROR_Pos (13UL) /*!< Position of CRCERROR field. */ +#define RADIO_INTENCLR_CRCERROR_Msk (0x1UL << RADIO_INTENCLR_CRCERROR_Pos) /*!< Bit mask of CRCERROR field. */ +#define RADIO_INTENCLR_CRCERROR_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_CRCERROR_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_CRCERROR_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for CRCOK event */ +#define RADIO_INTENCLR_CRCOK_Pos (12UL) /*!< Position of CRCOK field. */ +#define RADIO_INTENCLR_CRCOK_Msk (0x1UL << RADIO_INTENCLR_CRCOK_Pos) /*!< Bit mask of CRCOK field. */ +#define RADIO_INTENCLR_CRCOK_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_CRCOK_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_CRCOK_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for BCMATCH event */ +#define RADIO_INTENCLR_BCMATCH_Pos (10UL) /*!< Position of BCMATCH field. */ +#define RADIO_INTENCLR_BCMATCH_Msk (0x1UL << RADIO_INTENCLR_BCMATCH_Pos) /*!< Bit mask of BCMATCH field. */ +#define RADIO_INTENCLR_BCMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_BCMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_BCMATCH_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for RSSIEND event */ +#define RADIO_INTENCLR_RSSIEND_Pos (7UL) /*!< Position of RSSIEND field. */ +#define RADIO_INTENCLR_RSSIEND_Msk (0x1UL << RADIO_INTENCLR_RSSIEND_Pos) /*!< Bit mask of RSSIEND field. */ +#define RADIO_INTENCLR_RSSIEND_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_RSSIEND_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_RSSIEND_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for DEVMISS event */ +#define RADIO_INTENCLR_DEVMISS_Pos (6UL) /*!< Position of DEVMISS field. */ +#define RADIO_INTENCLR_DEVMISS_Msk (0x1UL << RADIO_INTENCLR_DEVMISS_Pos) /*!< Bit mask of DEVMISS field. */ +#define RADIO_INTENCLR_DEVMISS_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_DEVMISS_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_DEVMISS_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for DEVMATCH event */ +#define RADIO_INTENCLR_DEVMATCH_Pos (5UL) /*!< Position of DEVMATCH field. */ +#define RADIO_INTENCLR_DEVMATCH_Msk (0x1UL << RADIO_INTENCLR_DEVMATCH_Pos) /*!< Bit mask of DEVMATCH field. */ +#define RADIO_INTENCLR_DEVMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_DEVMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_DEVMATCH_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for DISABLED event */ +#define RADIO_INTENCLR_DISABLED_Pos (4UL) /*!< Position of DISABLED field. */ +#define RADIO_INTENCLR_DISABLED_Msk (0x1UL << RADIO_INTENCLR_DISABLED_Pos) /*!< Bit mask of DISABLED field. */ +#define RADIO_INTENCLR_DISABLED_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_DISABLED_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_DISABLED_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for END event */ +#define RADIO_INTENCLR_END_Pos (3UL) /*!< Position of END field. */ +#define RADIO_INTENCLR_END_Msk (0x1UL << RADIO_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define RADIO_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for PAYLOAD event */ +#define RADIO_INTENCLR_PAYLOAD_Pos (2UL) /*!< Position of PAYLOAD field. */ +#define RADIO_INTENCLR_PAYLOAD_Msk (0x1UL << RADIO_INTENCLR_PAYLOAD_Pos) /*!< Bit mask of PAYLOAD field. */ +#define RADIO_INTENCLR_PAYLOAD_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_PAYLOAD_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_PAYLOAD_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for ADDRESS event */ +#define RADIO_INTENCLR_ADDRESS_Pos (1UL) /*!< Position of ADDRESS field. */ +#define RADIO_INTENCLR_ADDRESS_Msk (0x1UL << RADIO_INTENCLR_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ +#define RADIO_INTENCLR_ADDRESS_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_ADDRESS_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_ADDRESS_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define RADIO_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define RADIO_INTENCLR_READY_Msk (0x1UL << RADIO_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define RADIO_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: RADIO_CRCSTATUS */ +/* Description: CRC status */ + +/* Bit 0 : CRC status of packet received */ +#define RADIO_CRCSTATUS_CRCSTATUS_Pos (0UL) /*!< Position of CRCSTATUS field. */ +#define RADIO_CRCSTATUS_CRCSTATUS_Msk (0x1UL << RADIO_CRCSTATUS_CRCSTATUS_Pos) /*!< Bit mask of CRCSTATUS field. */ +#define RADIO_CRCSTATUS_CRCSTATUS_CRCError (0UL) /*!< Packet received with CRC error */ +#define RADIO_CRCSTATUS_CRCSTATUS_CRCOk (1UL) /*!< Packet received with CRC ok */ + +/* Register: RADIO_RXMATCH */ +/* Description: Received address */ + +/* Bits 2..0 : Received address */ +#define RADIO_RXMATCH_RXMATCH_Pos (0UL) /*!< Position of RXMATCH field. */ +#define RADIO_RXMATCH_RXMATCH_Msk (0x7UL << RADIO_RXMATCH_RXMATCH_Pos) /*!< Bit mask of RXMATCH field. */ + +/* Register: RADIO_RXCRC */ +/* Description: CRC field of previously received packet */ + +/* Bits 23..0 : CRC field of previously received packet */ +#define RADIO_RXCRC_RXCRC_Pos (0UL) /*!< Position of RXCRC field. */ +#define RADIO_RXCRC_RXCRC_Msk (0xFFFFFFUL << RADIO_RXCRC_RXCRC_Pos) /*!< Bit mask of RXCRC field. */ + +/* Register: RADIO_DAI */ +/* Description: Device address match index */ + +/* Bits 2..0 : Device address match index */ +#define RADIO_DAI_DAI_Pos (0UL) /*!< Position of DAI field. */ +#define RADIO_DAI_DAI_Msk (0x7UL << RADIO_DAI_DAI_Pos) /*!< Bit mask of DAI field. */ + +/* Register: RADIO_PACKETPTR */ +/* Description: Packet pointer */ + +/* Bits 31..0 : Packet pointer */ +#define RADIO_PACKETPTR_PACKETPTR_Pos (0UL) /*!< Position of PACKETPTR field. */ +#define RADIO_PACKETPTR_PACKETPTR_Msk (0xFFFFFFFFUL << RADIO_PACKETPTR_PACKETPTR_Pos) /*!< Bit mask of PACKETPTR field. */ + +/* Register: RADIO_FREQUENCY */ +/* Description: Frequency */ + +/* Bit 8 : Channel map selection. */ +#define RADIO_FREQUENCY_MAP_Pos (8UL) /*!< Position of MAP field. */ +#define RADIO_FREQUENCY_MAP_Msk (0x1UL << RADIO_FREQUENCY_MAP_Pos) /*!< Bit mask of MAP field. */ +#define RADIO_FREQUENCY_MAP_Default (0UL) /*!< Channel map between 2400 MHZ .. 2500 MHz */ +#define RADIO_FREQUENCY_MAP_Low (1UL) /*!< Channel map between 2360 MHZ .. 2460 MHz */ + +/* Bits 6..0 : Radio channel frequency */ +#define RADIO_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define RADIO_FREQUENCY_FREQUENCY_Msk (0x7FUL << RADIO_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ + +/* Register: RADIO_TXPOWER */ +/* Description: Output power */ + +/* Bits 7..0 : RADIO output power. */ +#define RADIO_TXPOWER_TXPOWER_Pos (0UL) /*!< Position of TXPOWER field. */ +#define RADIO_TXPOWER_TXPOWER_Msk (0xFFUL << RADIO_TXPOWER_TXPOWER_Pos) /*!< Bit mask of TXPOWER field. */ +#define RADIO_TXPOWER_TXPOWER_0dBm (0x00UL) /*!< 0 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos3dBm (0x03UL) /*!< +3 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos4dBm (0x04UL) /*!< +4 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg30dBm (0xD8UL) /*!< Deprecated enumerator - -40 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg40dBm (0xD8UL) /*!< -40 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg20dBm (0xECUL) /*!< -20 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg16dBm (0xF0UL) /*!< -16 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg12dBm (0xF4UL) /*!< -12 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg8dBm (0xF8UL) /*!< -8 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg4dBm (0xFCUL) /*!< -4 dBm */ + +/* Register: RADIO_MODE */ +/* Description: Data rate and modulation */ + +/* Bits 3..0 : Radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation. */ +#define RADIO_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define RADIO_MODE_MODE_Msk (0xFUL << RADIO_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define RADIO_MODE_MODE_Nrf_1Mbit (0UL) /*!< 1 Mbit/s Nordic proprietary radio mode */ +#define RADIO_MODE_MODE_Nrf_2Mbit (1UL) /*!< 2 Mbit/s Nordic proprietary radio mode */ +#define RADIO_MODE_MODE_Nrf_250Kbit (2UL) /*!< Deprecated enumerator - 250 kbit/s Nordic proprietary radio mode */ +#define RADIO_MODE_MODE_Ble_1Mbit (3UL) /*!< 1 Mbit/s Bluetooth Low Energy */ + +/* Register: RADIO_PCNF0 */ +/* Description: Packet configuration register 0 */ + +/* Bit 24 : Length of preamble on air. Decision point: TASKS_START task */ +#define RADIO_PCNF0_PLEN_Pos (24UL) /*!< Position of PLEN field. */ +#define RADIO_PCNF0_PLEN_Msk (0x1UL << RADIO_PCNF0_PLEN_Pos) /*!< Bit mask of PLEN field. */ +#define RADIO_PCNF0_PLEN_8bit (0UL) /*!< 8-bit preamble */ +#define RADIO_PCNF0_PLEN_16bit (1UL) /*!< 16-bit preamble */ + +/* Bit 20 : Include or exclude S1 field in RAM */ +#define RADIO_PCNF0_S1INCL_Pos (20UL) /*!< Position of S1INCL field. */ +#define RADIO_PCNF0_S1INCL_Msk (0x1UL << RADIO_PCNF0_S1INCL_Pos) /*!< Bit mask of S1INCL field. */ +#define RADIO_PCNF0_S1INCL_Automatic (0UL) /*!< Include S1 field in RAM only if S1LEN > 0 */ +#define RADIO_PCNF0_S1INCL_Include (1UL) /*!< Always include S1 field in RAM independent of S1LEN */ + +/* Bits 19..16 : Length on air of S1 field in number of bits. */ +#define RADIO_PCNF0_S1LEN_Pos (16UL) /*!< Position of S1LEN field. */ +#define RADIO_PCNF0_S1LEN_Msk (0xFUL << RADIO_PCNF0_S1LEN_Pos) /*!< Bit mask of S1LEN field. */ + +/* Bit 8 : Length on air of S0 field in number of bytes. */ +#define RADIO_PCNF0_S0LEN_Pos (8UL) /*!< Position of S0LEN field. */ +#define RADIO_PCNF0_S0LEN_Msk (0x1UL << RADIO_PCNF0_S0LEN_Pos) /*!< Bit mask of S0LEN field. */ + +/* Bits 3..0 : Length on air of LENGTH field in number of bits. */ +#define RADIO_PCNF0_LFLEN_Pos (0UL) /*!< Position of LFLEN field. */ +#define RADIO_PCNF0_LFLEN_Msk (0xFUL << RADIO_PCNF0_LFLEN_Pos) /*!< Bit mask of LFLEN field. */ + +/* Register: RADIO_PCNF1 */ +/* Description: Packet configuration register 1 */ + +/* Bit 25 : Enable or disable packet whitening */ +#define RADIO_PCNF1_WHITEEN_Pos (25UL) /*!< Position of WHITEEN field. */ +#define RADIO_PCNF1_WHITEEN_Msk (0x1UL << RADIO_PCNF1_WHITEEN_Pos) /*!< Bit mask of WHITEEN field. */ +#define RADIO_PCNF1_WHITEEN_Disabled (0UL) /*!< Disable */ +#define RADIO_PCNF1_WHITEEN_Enabled (1UL) /*!< Enable */ + +/* Bit 24 : On air endianness of packet, this applies to the S0, LENGTH, S1 and the PAYLOAD fields. */ +#define RADIO_PCNF1_ENDIAN_Pos (24UL) /*!< Position of ENDIAN field. */ +#define RADIO_PCNF1_ENDIAN_Msk (0x1UL << RADIO_PCNF1_ENDIAN_Pos) /*!< Bit mask of ENDIAN field. */ +#define RADIO_PCNF1_ENDIAN_Little (0UL) /*!< Least Significant bit on air first */ +#define RADIO_PCNF1_ENDIAN_Big (1UL) /*!< Most significant bit on air first */ + +/* Bits 18..16 : Base address length in number of bytes */ +#define RADIO_PCNF1_BALEN_Pos (16UL) /*!< Position of BALEN field. */ +#define RADIO_PCNF1_BALEN_Msk (0x7UL << RADIO_PCNF1_BALEN_Pos) /*!< Bit mask of BALEN field. */ + +/* Bits 15..8 : Static length in number of bytes */ +#define RADIO_PCNF1_STATLEN_Pos (8UL) /*!< Position of STATLEN field. */ +#define RADIO_PCNF1_STATLEN_Msk (0xFFUL << RADIO_PCNF1_STATLEN_Pos) /*!< Bit mask of STATLEN field. */ + +/* Bits 7..0 : Maximum length of packet payload. If the packet payload is larger than MAXLEN, the radio will truncate the payload to MAXLEN. */ +#define RADIO_PCNF1_MAXLEN_Pos (0UL) /*!< Position of MAXLEN field. */ +#define RADIO_PCNF1_MAXLEN_Msk (0xFFUL << RADIO_PCNF1_MAXLEN_Pos) /*!< Bit mask of MAXLEN field. */ + +/* Register: RADIO_BASE0 */ +/* Description: Base address 0 */ + +/* Bits 31..0 : Base address 0 */ +#define RADIO_BASE0_BASE0_Pos (0UL) /*!< Position of BASE0 field. */ +#define RADIO_BASE0_BASE0_Msk (0xFFFFFFFFUL << RADIO_BASE0_BASE0_Pos) /*!< Bit mask of BASE0 field. */ + +/* Register: RADIO_BASE1 */ +/* Description: Base address 1 */ + +/* Bits 31..0 : Base address 1 */ +#define RADIO_BASE1_BASE1_Pos (0UL) /*!< Position of BASE1 field. */ +#define RADIO_BASE1_BASE1_Msk (0xFFFFFFFFUL << RADIO_BASE1_BASE1_Pos) /*!< Bit mask of BASE1 field. */ + +/* Register: RADIO_PREFIX0 */ +/* Description: Prefixes bytes for logical addresses 0-3 */ + +/* Bits 31..24 : Address prefix 3. */ +#define RADIO_PREFIX0_AP3_Pos (24UL) /*!< Position of AP3 field. */ +#define RADIO_PREFIX0_AP3_Msk (0xFFUL << RADIO_PREFIX0_AP3_Pos) /*!< Bit mask of AP3 field. */ + +/* Bits 23..16 : Address prefix 2. */ +#define RADIO_PREFIX0_AP2_Pos (16UL) /*!< Position of AP2 field. */ +#define RADIO_PREFIX0_AP2_Msk (0xFFUL << RADIO_PREFIX0_AP2_Pos) /*!< Bit mask of AP2 field. */ + +/* Bits 15..8 : Address prefix 1. */ +#define RADIO_PREFIX0_AP1_Pos (8UL) /*!< Position of AP1 field. */ +#define RADIO_PREFIX0_AP1_Msk (0xFFUL << RADIO_PREFIX0_AP1_Pos) /*!< Bit mask of AP1 field. */ + +/* Bits 7..0 : Address prefix 0. */ +#define RADIO_PREFIX0_AP0_Pos (0UL) /*!< Position of AP0 field. */ +#define RADIO_PREFIX0_AP0_Msk (0xFFUL << RADIO_PREFIX0_AP0_Pos) /*!< Bit mask of AP0 field. */ + +/* Register: RADIO_PREFIX1 */ +/* Description: Prefixes bytes for logical addresses 4-7 */ + +/* Bits 31..24 : Address prefix 7. */ +#define RADIO_PREFIX1_AP7_Pos (24UL) /*!< Position of AP7 field. */ +#define RADIO_PREFIX1_AP7_Msk (0xFFUL << RADIO_PREFIX1_AP7_Pos) /*!< Bit mask of AP7 field. */ + +/* Bits 23..16 : Address prefix 6. */ +#define RADIO_PREFIX1_AP6_Pos (16UL) /*!< Position of AP6 field. */ +#define RADIO_PREFIX1_AP6_Msk (0xFFUL << RADIO_PREFIX1_AP6_Pos) /*!< Bit mask of AP6 field. */ + +/* Bits 15..8 : Address prefix 5. */ +#define RADIO_PREFIX1_AP5_Pos (8UL) /*!< Position of AP5 field. */ +#define RADIO_PREFIX1_AP5_Msk (0xFFUL << RADIO_PREFIX1_AP5_Pos) /*!< Bit mask of AP5 field. */ + +/* Bits 7..0 : Address prefix 4. */ +#define RADIO_PREFIX1_AP4_Pos (0UL) /*!< Position of AP4 field. */ +#define RADIO_PREFIX1_AP4_Msk (0xFFUL << RADIO_PREFIX1_AP4_Pos) /*!< Bit mask of AP4 field. */ + +/* Register: RADIO_TXADDRESS */ +/* Description: Transmit address select */ + +/* Bits 2..0 : Transmit address select */ +#define RADIO_TXADDRESS_TXADDRESS_Pos (0UL) /*!< Position of TXADDRESS field. */ +#define RADIO_TXADDRESS_TXADDRESS_Msk (0x7UL << RADIO_TXADDRESS_TXADDRESS_Pos) /*!< Bit mask of TXADDRESS field. */ + +/* Register: RADIO_RXADDRESSES */ +/* Description: Receive address select */ + +/* Bit 7 : Enable or disable reception on logical address 7. */ +#define RADIO_RXADDRESSES_ADDR7_Pos (7UL) /*!< Position of ADDR7 field. */ +#define RADIO_RXADDRESSES_ADDR7_Msk (0x1UL << RADIO_RXADDRESSES_ADDR7_Pos) /*!< Bit mask of ADDR7 field. */ +#define RADIO_RXADDRESSES_ADDR7_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR7_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable reception on logical address 6. */ +#define RADIO_RXADDRESSES_ADDR6_Pos (6UL) /*!< Position of ADDR6 field. */ +#define RADIO_RXADDRESSES_ADDR6_Msk (0x1UL << RADIO_RXADDRESSES_ADDR6_Pos) /*!< Bit mask of ADDR6 field. */ +#define RADIO_RXADDRESSES_ADDR6_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR6_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable reception on logical address 5. */ +#define RADIO_RXADDRESSES_ADDR5_Pos (5UL) /*!< Position of ADDR5 field. */ +#define RADIO_RXADDRESSES_ADDR5_Msk (0x1UL << RADIO_RXADDRESSES_ADDR5_Pos) /*!< Bit mask of ADDR5 field. */ +#define RADIO_RXADDRESSES_ADDR5_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR5_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable reception on logical address 4. */ +#define RADIO_RXADDRESSES_ADDR4_Pos (4UL) /*!< Position of ADDR4 field. */ +#define RADIO_RXADDRESSES_ADDR4_Msk (0x1UL << RADIO_RXADDRESSES_ADDR4_Pos) /*!< Bit mask of ADDR4 field. */ +#define RADIO_RXADDRESSES_ADDR4_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR4_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable reception on logical address 3. */ +#define RADIO_RXADDRESSES_ADDR3_Pos (3UL) /*!< Position of ADDR3 field. */ +#define RADIO_RXADDRESSES_ADDR3_Msk (0x1UL << RADIO_RXADDRESSES_ADDR3_Pos) /*!< Bit mask of ADDR3 field. */ +#define RADIO_RXADDRESSES_ADDR3_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR3_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable reception on logical address 2. */ +#define RADIO_RXADDRESSES_ADDR2_Pos (2UL) /*!< Position of ADDR2 field. */ +#define RADIO_RXADDRESSES_ADDR2_Msk (0x1UL << RADIO_RXADDRESSES_ADDR2_Pos) /*!< Bit mask of ADDR2 field. */ +#define RADIO_RXADDRESSES_ADDR2_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR2_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable reception on logical address 1. */ +#define RADIO_RXADDRESSES_ADDR1_Pos (1UL) /*!< Position of ADDR1 field. */ +#define RADIO_RXADDRESSES_ADDR1_Msk (0x1UL << RADIO_RXADDRESSES_ADDR1_Pos) /*!< Bit mask of ADDR1 field. */ +#define RADIO_RXADDRESSES_ADDR1_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR1_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable reception on logical address 0. */ +#define RADIO_RXADDRESSES_ADDR0_Pos (0UL) /*!< Position of ADDR0 field. */ +#define RADIO_RXADDRESSES_ADDR0_Msk (0x1UL << RADIO_RXADDRESSES_ADDR0_Pos) /*!< Bit mask of ADDR0 field. */ +#define RADIO_RXADDRESSES_ADDR0_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR0_Enabled (1UL) /*!< Enable */ + +/* Register: RADIO_CRCCNF */ +/* Description: CRC configuration */ + +/* Bit 8 : Include or exclude packet address field out of CRC calculation. */ +#define RADIO_CRCCNF_SKIPADDR_Pos (8UL) /*!< Position of SKIPADDR field. */ +#define RADIO_CRCCNF_SKIPADDR_Msk (0x1UL << RADIO_CRCCNF_SKIPADDR_Pos) /*!< Bit mask of SKIPADDR field. */ +#define RADIO_CRCCNF_SKIPADDR_Include (0UL) /*!< CRC calculation includes address field */ +#define RADIO_CRCCNF_SKIPADDR_Skip (1UL) /*!< CRC calculation does not include address field. The CRC calculation will start at the first byte after the address. */ + +/* Bits 1..0 : CRC length in number of bytes. */ +#define RADIO_CRCCNF_LEN_Pos (0UL) /*!< Position of LEN field. */ +#define RADIO_CRCCNF_LEN_Msk (0x3UL << RADIO_CRCCNF_LEN_Pos) /*!< Bit mask of LEN field. */ +#define RADIO_CRCCNF_LEN_Disabled (0UL) /*!< CRC length is zero and CRC calculation is disabled */ +#define RADIO_CRCCNF_LEN_One (1UL) /*!< CRC length is one byte and CRC calculation is enabled */ +#define RADIO_CRCCNF_LEN_Two (2UL) /*!< CRC length is two bytes and CRC calculation is enabled */ +#define RADIO_CRCCNF_LEN_Three (3UL) /*!< CRC length is three bytes and CRC calculation is enabled */ + +/* Register: RADIO_CRCPOLY */ +/* Description: CRC polynomial */ + +/* Bits 23..0 : CRC polynomial */ +#define RADIO_CRCPOLY_CRCPOLY_Pos (0UL) /*!< Position of CRCPOLY field. */ +#define RADIO_CRCPOLY_CRCPOLY_Msk (0xFFFFFFUL << RADIO_CRCPOLY_CRCPOLY_Pos) /*!< Bit mask of CRCPOLY field. */ + +/* Register: RADIO_CRCINIT */ +/* Description: CRC initial value */ + +/* Bits 23..0 : CRC initial value */ +#define RADIO_CRCINIT_CRCINIT_Pos (0UL) /*!< Position of CRCINIT field. */ +#define RADIO_CRCINIT_CRCINIT_Msk (0xFFFFFFUL << RADIO_CRCINIT_CRCINIT_Pos) /*!< Bit mask of CRCINIT field. */ + +/* Register: RADIO_TIFS */ +/* Description: Inter Frame Spacing in us */ + +/* Bits 7..0 : Inter Frame Spacing in us */ +#define RADIO_TIFS_TIFS_Pos (0UL) /*!< Position of TIFS field. */ +#define RADIO_TIFS_TIFS_Msk (0xFFUL << RADIO_TIFS_TIFS_Pos) /*!< Bit mask of TIFS field. */ + +/* Register: RADIO_RSSISAMPLE */ +/* Description: RSSI sample */ + +/* Bits 6..0 : RSSI sample */ +#define RADIO_RSSISAMPLE_RSSISAMPLE_Pos (0UL) /*!< Position of RSSISAMPLE field. */ +#define RADIO_RSSISAMPLE_RSSISAMPLE_Msk (0x7FUL << RADIO_RSSISAMPLE_RSSISAMPLE_Pos) /*!< Bit mask of RSSISAMPLE field. */ + +/* Register: RADIO_STATE */ +/* Description: Current radio state */ + +/* Bits 3..0 : Current radio state */ +#define RADIO_STATE_STATE_Pos (0UL) /*!< Position of STATE field. */ +#define RADIO_STATE_STATE_Msk (0xFUL << RADIO_STATE_STATE_Pos) /*!< Bit mask of STATE field. */ +#define RADIO_STATE_STATE_Disabled (0UL) /*!< RADIO is in the Disabled state */ +#define RADIO_STATE_STATE_RxRu (1UL) /*!< RADIO is in the RXRU state */ +#define RADIO_STATE_STATE_RxIdle (2UL) /*!< RADIO is in the RXIDLE state */ +#define RADIO_STATE_STATE_Rx (3UL) /*!< RADIO is in the RX state */ +#define RADIO_STATE_STATE_RxDisable (4UL) /*!< RADIO is in the RXDISABLED state */ +#define RADIO_STATE_STATE_TxRu (9UL) /*!< RADIO is in the TXRU state */ +#define RADIO_STATE_STATE_TxIdle (10UL) /*!< RADIO is in the TXIDLE state */ +#define RADIO_STATE_STATE_Tx (11UL) /*!< RADIO is in the TX state */ +#define RADIO_STATE_STATE_TxDisable (12UL) /*!< RADIO is in the TXDISABLED state */ + +/* Register: RADIO_DATAWHITEIV */ +/* Description: Data whitening initial value */ + +/* Bits 6..0 : Data whitening initial value. Bit 6 is hard-wired to '1', writing '0' to it has no effect, and it will always be read back and used by the device as '1'. */ +#define RADIO_DATAWHITEIV_DATAWHITEIV_Pos (0UL) /*!< Position of DATAWHITEIV field. */ +#define RADIO_DATAWHITEIV_DATAWHITEIV_Msk (0x7FUL << RADIO_DATAWHITEIV_DATAWHITEIV_Pos) /*!< Bit mask of DATAWHITEIV field. */ + +/* Register: RADIO_BCC */ +/* Description: Bit counter compare */ + +/* Bits 31..0 : Bit counter compare */ +#define RADIO_BCC_BCC_Pos (0UL) /*!< Position of BCC field. */ +#define RADIO_BCC_BCC_Msk (0xFFFFFFFFUL << RADIO_BCC_BCC_Pos) /*!< Bit mask of BCC field. */ + +/* Register: RADIO_DAB */ +/* Description: Description collection[0]: Device address base segment 0 */ + +/* Bits 31..0 : Device address base segment 0 */ +#define RADIO_DAB_DAB_Pos (0UL) /*!< Position of DAB field. */ +#define RADIO_DAB_DAB_Msk (0xFFFFFFFFUL << RADIO_DAB_DAB_Pos) /*!< Bit mask of DAB field. */ + +/* Register: RADIO_DAP */ +/* Description: Description collection[0]: Device address prefix 0 */ + +/* Bits 15..0 : Device address prefix 0 */ +#define RADIO_DAP_DAP_Pos (0UL) /*!< Position of DAP field. */ +#define RADIO_DAP_DAP_Msk (0xFFFFUL << RADIO_DAP_DAP_Pos) /*!< Bit mask of DAP field. */ + +/* Register: RADIO_DACNF */ +/* Description: Device address match configuration */ + +/* Bit 15 : TxAdd for device address 7 */ +#define RADIO_DACNF_TXADD7_Pos (15UL) /*!< Position of TXADD7 field. */ +#define RADIO_DACNF_TXADD7_Msk (0x1UL << RADIO_DACNF_TXADD7_Pos) /*!< Bit mask of TXADD7 field. */ + +/* Bit 14 : TxAdd for device address 6 */ +#define RADIO_DACNF_TXADD6_Pos (14UL) /*!< Position of TXADD6 field. */ +#define RADIO_DACNF_TXADD6_Msk (0x1UL << RADIO_DACNF_TXADD6_Pos) /*!< Bit mask of TXADD6 field. */ + +/* Bit 13 : TxAdd for device address 5 */ +#define RADIO_DACNF_TXADD5_Pos (13UL) /*!< Position of TXADD5 field. */ +#define RADIO_DACNF_TXADD5_Msk (0x1UL << RADIO_DACNF_TXADD5_Pos) /*!< Bit mask of TXADD5 field. */ + +/* Bit 12 : TxAdd for device address 4 */ +#define RADIO_DACNF_TXADD4_Pos (12UL) /*!< Position of TXADD4 field. */ +#define RADIO_DACNF_TXADD4_Msk (0x1UL << RADIO_DACNF_TXADD4_Pos) /*!< Bit mask of TXADD4 field. */ + +/* Bit 11 : TxAdd for device address 3 */ +#define RADIO_DACNF_TXADD3_Pos (11UL) /*!< Position of TXADD3 field. */ +#define RADIO_DACNF_TXADD3_Msk (0x1UL << RADIO_DACNF_TXADD3_Pos) /*!< Bit mask of TXADD3 field. */ + +/* Bit 10 : TxAdd for device address 2 */ +#define RADIO_DACNF_TXADD2_Pos (10UL) /*!< Position of TXADD2 field. */ +#define RADIO_DACNF_TXADD2_Msk (0x1UL << RADIO_DACNF_TXADD2_Pos) /*!< Bit mask of TXADD2 field. */ + +/* Bit 9 : TxAdd for device address 1 */ +#define RADIO_DACNF_TXADD1_Pos (9UL) /*!< Position of TXADD1 field. */ +#define RADIO_DACNF_TXADD1_Msk (0x1UL << RADIO_DACNF_TXADD1_Pos) /*!< Bit mask of TXADD1 field. */ + +/* Bit 8 : TxAdd for device address 0 */ +#define RADIO_DACNF_TXADD0_Pos (8UL) /*!< Position of TXADD0 field. */ +#define RADIO_DACNF_TXADD0_Msk (0x1UL << RADIO_DACNF_TXADD0_Pos) /*!< Bit mask of TXADD0 field. */ + +/* Bit 7 : Enable or disable device address matching using device address 7 */ +#define RADIO_DACNF_ENA7_Pos (7UL) /*!< Position of ENA7 field. */ +#define RADIO_DACNF_ENA7_Msk (0x1UL << RADIO_DACNF_ENA7_Pos) /*!< Bit mask of ENA7 field. */ +#define RADIO_DACNF_ENA7_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA7_Enabled (1UL) /*!< Enabled */ + +/* Bit 6 : Enable or disable device address matching using device address 6 */ +#define RADIO_DACNF_ENA6_Pos (6UL) /*!< Position of ENA6 field. */ +#define RADIO_DACNF_ENA6_Msk (0x1UL << RADIO_DACNF_ENA6_Pos) /*!< Bit mask of ENA6 field. */ +#define RADIO_DACNF_ENA6_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA6_Enabled (1UL) /*!< Enabled */ + +/* Bit 5 : Enable or disable device address matching using device address 5 */ +#define RADIO_DACNF_ENA5_Pos (5UL) /*!< Position of ENA5 field. */ +#define RADIO_DACNF_ENA5_Msk (0x1UL << RADIO_DACNF_ENA5_Pos) /*!< Bit mask of ENA5 field. */ +#define RADIO_DACNF_ENA5_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA5_Enabled (1UL) /*!< Enabled */ + +/* Bit 4 : Enable or disable device address matching using device address 4 */ +#define RADIO_DACNF_ENA4_Pos (4UL) /*!< Position of ENA4 field. */ +#define RADIO_DACNF_ENA4_Msk (0x1UL << RADIO_DACNF_ENA4_Pos) /*!< Bit mask of ENA4 field. */ +#define RADIO_DACNF_ENA4_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA4_Enabled (1UL) /*!< Enabled */ + +/* Bit 3 : Enable or disable device address matching using device address 3 */ +#define RADIO_DACNF_ENA3_Pos (3UL) /*!< Position of ENA3 field. */ +#define RADIO_DACNF_ENA3_Msk (0x1UL << RADIO_DACNF_ENA3_Pos) /*!< Bit mask of ENA3 field. */ +#define RADIO_DACNF_ENA3_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA3_Enabled (1UL) /*!< Enabled */ + +/* Bit 2 : Enable or disable device address matching using device address 2 */ +#define RADIO_DACNF_ENA2_Pos (2UL) /*!< Position of ENA2 field. */ +#define RADIO_DACNF_ENA2_Msk (0x1UL << RADIO_DACNF_ENA2_Pos) /*!< Bit mask of ENA2 field. */ +#define RADIO_DACNF_ENA2_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA2_Enabled (1UL) /*!< Enabled */ + +/* Bit 1 : Enable or disable device address matching using device address 1 */ +#define RADIO_DACNF_ENA1_Pos (1UL) /*!< Position of ENA1 field. */ +#define RADIO_DACNF_ENA1_Msk (0x1UL << RADIO_DACNF_ENA1_Pos) /*!< Bit mask of ENA1 field. */ +#define RADIO_DACNF_ENA1_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA1_Enabled (1UL) /*!< Enabled */ + +/* Bit 0 : Enable or disable device address matching using device address 0 */ +#define RADIO_DACNF_ENA0_Pos (0UL) /*!< Position of ENA0 field. */ +#define RADIO_DACNF_ENA0_Msk (0x1UL << RADIO_DACNF_ENA0_Pos) /*!< Bit mask of ENA0 field. */ +#define RADIO_DACNF_ENA0_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA0_Enabled (1UL) /*!< Enabled */ + +/* Register: RADIO_MODECNF0 */ +/* Description: Radio mode configuration register 0 */ + +/* Bits 9..8 : Default TX value */ +#define RADIO_MODECNF0_DTX_Pos (8UL) /*!< Position of DTX field. */ +#define RADIO_MODECNF0_DTX_Msk (0x3UL << RADIO_MODECNF0_DTX_Pos) /*!< Bit mask of DTX field. */ +#define RADIO_MODECNF0_DTX_B1 (0UL) /*!< Transmit '1' */ +#define RADIO_MODECNF0_DTX_B0 (1UL) /*!< Transmit '0' */ +#define RADIO_MODECNF0_DTX_Center (2UL) /*!< Transmit center frequency */ + +/* Bit 0 : Radio ramp-up time */ +#define RADIO_MODECNF0_RU_Pos (0UL) /*!< Position of RU field. */ +#define RADIO_MODECNF0_RU_Msk (0x1UL << RADIO_MODECNF0_RU_Pos) /*!< Bit mask of RU field. */ +#define RADIO_MODECNF0_RU_Default (0UL) /*!< Default ramp-up time (tRXEN), compatible with firmware written for nRF51 */ +#define RADIO_MODECNF0_RU_Fast (1UL) /*!< Fast ramp-up (tRXEN,FAST), see electrical specification for more information */ + +/* Register: RADIO_POWER */ +/* Description: Peripheral power control */ + +/* Bit 0 : Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again. */ +#define RADIO_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define RADIO_POWER_POWER_Msk (0x1UL << RADIO_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define RADIO_POWER_POWER_Disabled (0UL) /*!< Peripheral is powered off */ +#define RADIO_POWER_POWER_Enabled (1UL) /*!< Peripheral is powered on */ + + +/* Peripheral: RNG */ +/* Description: Random Number Generator */ + +/* Register: RNG_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 0 : Shortcut between VALRDY event and STOP task */ +#define RNG_SHORTS_VALRDY_STOP_Pos (0UL) /*!< Position of VALRDY_STOP field. */ +#define RNG_SHORTS_VALRDY_STOP_Msk (0x1UL << RNG_SHORTS_VALRDY_STOP_Pos) /*!< Bit mask of VALRDY_STOP field. */ +#define RNG_SHORTS_VALRDY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define RNG_SHORTS_VALRDY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: RNG_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 0 : Write '1' to Enable interrupt for VALRDY event */ +#define RNG_INTENSET_VALRDY_Pos (0UL) /*!< Position of VALRDY field. */ +#define RNG_INTENSET_VALRDY_Msk (0x1UL << RNG_INTENSET_VALRDY_Pos) /*!< Bit mask of VALRDY field. */ +#define RNG_INTENSET_VALRDY_Disabled (0UL) /*!< Read: Disabled */ +#define RNG_INTENSET_VALRDY_Enabled (1UL) /*!< Read: Enabled */ +#define RNG_INTENSET_VALRDY_Set (1UL) /*!< Enable */ + +/* Register: RNG_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 0 : Write '1' to Disable interrupt for VALRDY event */ +#define RNG_INTENCLR_VALRDY_Pos (0UL) /*!< Position of VALRDY field. */ +#define RNG_INTENCLR_VALRDY_Msk (0x1UL << RNG_INTENCLR_VALRDY_Pos) /*!< Bit mask of VALRDY field. */ +#define RNG_INTENCLR_VALRDY_Disabled (0UL) /*!< Read: Disabled */ +#define RNG_INTENCLR_VALRDY_Enabled (1UL) /*!< Read: Enabled */ +#define RNG_INTENCLR_VALRDY_Clear (1UL) /*!< Disable */ + +/* Register: RNG_CONFIG */ +/* Description: Configuration register */ + +/* Bit 0 : Bias correction */ +#define RNG_CONFIG_DERCEN_Pos (0UL) /*!< Position of DERCEN field. */ +#define RNG_CONFIG_DERCEN_Msk (0x1UL << RNG_CONFIG_DERCEN_Pos) /*!< Bit mask of DERCEN field. */ +#define RNG_CONFIG_DERCEN_Disabled (0UL) /*!< Disabled */ +#define RNG_CONFIG_DERCEN_Enabled (1UL) /*!< Enabled */ + +/* Register: RNG_VALUE */ +/* Description: Output random number */ + +/* Bits 7..0 : Generated random number */ +#define RNG_VALUE_VALUE_Pos (0UL) /*!< Position of VALUE field. */ +#define RNG_VALUE_VALUE_Msk (0xFFUL << RNG_VALUE_VALUE_Pos) /*!< Bit mask of VALUE field. */ + + +/* Peripheral: RTC */ +/* Description: Real time counter 0 */ + +/* Register: RTC_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 19 : Write '1' to Enable interrupt for COMPARE[3] event */ +#define RTC_INTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_INTENSET_COMPARE3_Msk (0x1UL << RTC_INTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_INTENSET_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_COMPARE3_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for COMPARE[2] event */ +#define RTC_INTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_INTENSET_COMPARE2_Msk (0x1UL << RTC_INTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_INTENSET_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_COMPARE2_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for COMPARE[1] event */ +#define RTC_INTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_INTENSET_COMPARE1_Msk (0x1UL << RTC_INTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_INTENSET_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_COMPARE1_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable interrupt for COMPARE[0] event */ +#define RTC_INTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_INTENSET_COMPARE0_Msk (0x1UL << RTC_INTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_INTENSET_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_COMPARE0_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for OVRFLW event */ +#define RTC_INTENSET_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_INTENSET_OVRFLW_Msk (0x1UL << RTC_INTENSET_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_INTENSET_OVRFLW_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_OVRFLW_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_OVRFLW_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for TICK event */ +#define RTC_INTENSET_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_INTENSET_TICK_Msk (0x1UL << RTC_INTENSET_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_INTENSET_TICK_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_TICK_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_TICK_Set (1UL) /*!< Enable */ + +/* Register: RTC_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 19 : Write '1' to Disable interrupt for COMPARE[3] event */ +#define RTC_INTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_INTENCLR_COMPARE3_Msk (0x1UL << RTC_INTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_INTENCLR_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_COMPARE3_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for COMPARE[2] event */ +#define RTC_INTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_INTENCLR_COMPARE2_Msk (0x1UL << RTC_INTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_INTENCLR_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_COMPARE2_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for COMPARE[1] event */ +#define RTC_INTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_INTENCLR_COMPARE1_Msk (0x1UL << RTC_INTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_INTENCLR_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_COMPARE1_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable interrupt for COMPARE[0] event */ +#define RTC_INTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_INTENCLR_COMPARE0_Msk (0x1UL << RTC_INTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_INTENCLR_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_COMPARE0_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for OVRFLW event */ +#define RTC_INTENCLR_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_INTENCLR_OVRFLW_Msk (0x1UL << RTC_INTENCLR_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_INTENCLR_OVRFLW_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_OVRFLW_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_OVRFLW_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for TICK event */ +#define RTC_INTENCLR_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_INTENCLR_TICK_Msk (0x1UL << RTC_INTENCLR_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_INTENCLR_TICK_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_TICK_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_TICK_Clear (1UL) /*!< Disable */ + +/* Register: RTC_EVTEN */ +/* Description: Enable or disable event routing */ + +/* Bit 19 : Enable or disable event routing for COMPARE[3] event */ +#define RTC_EVTEN_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTEN_COMPARE3_Msk (0x1UL << RTC_EVTEN_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTEN_COMPARE3_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_COMPARE3_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable event routing for COMPARE[2] event */ +#define RTC_EVTEN_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTEN_COMPARE2_Msk (0x1UL << RTC_EVTEN_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTEN_COMPARE2_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_COMPARE2_Enabled (1UL) /*!< Enable */ + +/* Bit 17 : Enable or disable event routing for COMPARE[1] event */ +#define RTC_EVTEN_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTEN_COMPARE1_Msk (0x1UL << RTC_EVTEN_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTEN_COMPARE1_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_COMPARE1_Enabled (1UL) /*!< Enable */ + +/* Bit 16 : Enable or disable event routing for COMPARE[0] event */ +#define RTC_EVTEN_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTEN_COMPARE0_Msk (0x1UL << RTC_EVTEN_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTEN_COMPARE0_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_COMPARE0_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable event routing for OVRFLW event */ +#define RTC_EVTEN_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTEN_OVRFLW_Msk (0x1UL << RTC_EVTEN_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTEN_OVRFLW_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_OVRFLW_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable event routing for TICK event */ +#define RTC_EVTEN_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTEN_TICK_Msk (0x1UL << RTC_EVTEN_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTEN_TICK_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_TICK_Enabled (1UL) /*!< Enable */ + +/* Register: RTC_EVTENSET */ +/* Description: Enable event routing */ + +/* Bit 19 : Write '1' to Enable event routing for COMPARE[3] event */ +#define RTC_EVTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTENSET_COMPARE3_Msk (0x1UL << RTC_EVTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTENSET_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_COMPARE3_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable event routing for COMPARE[2] event */ +#define RTC_EVTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTENSET_COMPARE2_Msk (0x1UL << RTC_EVTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTENSET_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_COMPARE2_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable event routing for COMPARE[1] event */ +#define RTC_EVTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTENSET_COMPARE1_Msk (0x1UL << RTC_EVTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTENSET_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_COMPARE1_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable event routing for COMPARE[0] event */ +#define RTC_EVTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTENSET_COMPARE0_Msk (0x1UL << RTC_EVTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTENSET_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_COMPARE0_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable event routing for OVRFLW event */ +#define RTC_EVTENSET_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTENSET_OVRFLW_Msk (0x1UL << RTC_EVTENSET_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTENSET_OVRFLW_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_OVRFLW_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_OVRFLW_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable event routing for TICK event */ +#define RTC_EVTENSET_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTENSET_TICK_Msk (0x1UL << RTC_EVTENSET_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTENSET_TICK_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_TICK_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_TICK_Set (1UL) /*!< Enable */ + +/* Register: RTC_EVTENCLR */ +/* Description: Disable event routing */ + +/* Bit 19 : Write '1' to Disable event routing for COMPARE[3] event */ +#define RTC_EVTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTENCLR_COMPARE3_Msk (0x1UL << RTC_EVTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTENCLR_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_COMPARE3_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable event routing for COMPARE[2] event */ +#define RTC_EVTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTENCLR_COMPARE2_Msk (0x1UL << RTC_EVTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTENCLR_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_COMPARE2_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable event routing for COMPARE[1] event */ +#define RTC_EVTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTENCLR_COMPARE1_Msk (0x1UL << RTC_EVTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTENCLR_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_COMPARE1_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable event routing for COMPARE[0] event */ +#define RTC_EVTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTENCLR_COMPARE0_Msk (0x1UL << RTC_EVTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTENCLR_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_COMPARE0_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable event routing for OVRFLW event */ +#define RTC_EVTENCLR_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTENCLR_OVRFLW_Msk (0x1UL << RTC_EVTENCLR_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTENCLR_OVRFLW_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_OVRFLW_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_OVRFLW_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable event routing for TICK event */ +#define RTC_EVTENCLR_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTENCLR_TICK_Msk (0x1UL << RTC_EVTENCLR_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTENCLR_TICK_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_TICK_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_TICK_Clear (1UL) /*!< Disable */ + +/* Register: RTC_COUNTER */ +/* Description: Current COUNTER value */ + +/* Bits 23..0 : Counter value */ +#define RTC_COUNTER_COUNTER_Pos (0UL) /*!< Position of COUNTER field. */ +#define RTC_COUNTER_COUNTER_Msk (0xFFFFFFUL << RTC_COUNTER_COUNTER_Pos) /*!< Bit mask of COUNTER field. */ + +/* Register: RTC_PRESCALER */ +/* Description: 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must be written when RTC is stopped */ + +/* Bits 11..0 : Prescaler value */ +#define RTC_PRESCALER_PRESCALER_Pos (0UL) /*!< Position of PRESCALER field. */ +#define RTC_PRESCALER_PRESCALER_Msk (0xFFFUL << RTC_PRESCALER_PRESCALER_Pos) /*!< Bit mask of PRESCALER field. */ + +/* Register: RTC_CC */ +/* Description: Description collection[0]: Compare register 0 */ + +/* Bits 23..0 : Compare value */ +#define RTC_CC_COMPARE_Pos (0UL) /*!< Position of COMPARE field. */ +#define RTC_CC_COMPARE_Msk (0xFFFFFFUL << RTC_CC_COMPARE_Pos) /*!< Bit mask of COMPARE field. */ + + +/* Peripheral: SAADC */ +/* Description: Analog to Digital Converter */ + +/* Register: SAADC_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 21 : Enable or disable interrupt for CH[7].LIMITL event */ +#define SAADC_INTEN_CH7LIMITL_Pos (21UL) /*!< Position of CH7LIMITL field. */ +#define SAADC_INTEN_CH7LIMITL_Msk (0x1UL << SAADC_INTEN_CH7LIMITL_Pos) /*!< Bit mask of CH7LIMITL field. */ +#define SAADC_INTEN_CH7LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH7LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for CH[7].LIMITH event */ +#define SAADC_INTEN_CH7LIMITH_Pos (20UL) /*!< Position of CH7LIMITH field. */ +#define SAADC_INTEN_CH7LIMITH_Msk (0x1UL << SAADC_INTEN_CH7LIMITH_Pos) /*!< Bit mask of CH7LIMITH field. */ +#define SAADC_INTEN_CH7LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH7LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for CH[6].LIMITL event */ +#define SAADC_INTEN_CH6LIMITL_Pos (19UL) /*!< Position of CH6LIMITL field. */ +#define SAADC_INTEN_CH6LIMITL_Msk (0x1UL << SAADC_INTEN_CH6LIMITL_Pos) /*!< Bit mask of CH6LIMITL field. */ +#define SAADC_INTEN_CH6LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH6LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable interrupt for CH[6].LIMITH event */ +#define SAADC_INTEN_CH6LIMITH_Pos (18UL) /*!< Position of CH6LIMITH field. */ +#define SAADC_INTEN_CH6LIMITH_Msk (0x1UL << SAADC_INTEN_CH6LIMITH_Pos) /*!< Bit mask of CH6LIMITH field. */ +#define SAADC_INTEN_CH6LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH6LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 17 : Enable or disable interrupt for CH[5].LIMITL event */ +#define SAADC_INTEN_CH5LIMITL_Pos (17UL) /*!< Position of CH5LIMITL field. */ +#define SAADC_INTEN_CH5LIMITL_Msk (0x1UL << SAADC_INTEN_CH5LIMITL_Pos) /*!< Bit mask of CH5LIMITL field. */ +#define SAADC_INTEN_CH5LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH5LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 16 : Enable or disable interrupt for CH[5].LIMITH event */ +#define SAADC_INTEN_CH5LIMITH_Pos (16UL) /*!< Position of CH5LIMITH field. */ +#define SAADC_INTEN_CH5LIMITH_Msk (0x1UL << SAADC_INTEN_CH5LIMITH_Pos) /*!< Bit mask of CH5LIMITH field. */ +#define SAADC_INTEN_CH5LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH5LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 15 : Enable or disable interrupt for CH[4].LIMITL event */ +#define SAADC_INTEN_CH4LIMITL_Pos (15UL) /*!< Position of CH4LIMITL field. */ +#define SAADC_INTEN_CH4LIMITL_Msk (0x1UL << SAADC_INTEN_CH4LIMITL_Pos) /*!< Bit mask of CH4LIMITL field. */ +#define SAADC_INTEN_CH4LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH4LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 14 : Enable or disable interrupt for CH[4].LIMITH event */ +#define SAADC_INTEN_CH4LIMITH_Pos (14UL) /*!< Position of CH4LIMITH field. */ +#define SAADC_INTEN_CH4LIMITH_Msk (0x1UL << SAADC_INTEN_CH4LIMITH_Pos) /*!< Bit mask of CH4LIMITH field. */ +#define SAADC_INTEN_CH4LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH4LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 13 : Enable or disable interrupt for CH[3].LIMITL event */ +#define SAADC_INTEN_CH3LIMITL_Pos (13UL) /*!< Position of CH3LIMITL field. */ +#define SAADC_INTEN_CH3LIMITL_Msk (0x1UL << SAADC_INTEN_CH3LIMITL_Pos) /*!< Bit mask of CH3LIMITL field. */ +#define SAADC_INTEN_CH3LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH3LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 12 : Enable or disable interrupt for CH[3].LIMITH event */ +#define SAADC_INTEN_CH3LIMITH_Pos (12UL) /*!< Position of CH3LIMITH field. */ +#define SAADC_INTEN_CH3LIMITH_Msk (0x1UL << SAADC_INTEN_CH3LIMITH_Pos) /*!< Bit mask of CH3LIMITH field. */ +#define SAADC_INTEN_CH3LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH3LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 11 : Enable or disable interrupt for CH[2].LIMITL event */ +#define SAADC_INTEN_CH2LIMITL_Pos (11UL) /*!< Position of CH2LIMITL field. */ +#define SAADC_INTEN_CH2LIMITL_Msk (0x1UL << SAADC_INTEN_CH2LIMITL_Pos) /*!< Bit mask of CH2LIMITL field. */ +#define SAADC_INTEN_CH2LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH2LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 10 : Enable or disable interrupt for CH[2].LIMITH event */ +#define SAADC_INTEN_CH2LIMITH_Pos (10UL) /*!< Position of CH2LIMITH field. */ +#define SAADC_INTEN_CH2LIMITH_Msk (0x1UL << SAADC_INTEN_CH2LIMITH_Pos) /*!< Bit mask of CH2LIMITH field. */ +#define SAADC_INTEN_CH2LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH2LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for CH[1].LIMITL event */ +#define SAADC_INTEN_CH1LIMITL_Pos (9UL) /*!< Position of CH1LIMITL field. */ +#define SAADC_INTEN_CH1LIMITL_Msk (0x1UL << SAADC_INTEN_CH1LIMITL_Pos) /*!< Bit mask of CH1LIMITL field. */ +#define SAADC_INTEN_CH1LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH1LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 8 : Enable or disable interrupt for CH[1].LIMITH event */ +#define SAADC_INTEN_CH1LIMITH_Pos (8UL) /*!< Position of CH1LIMITH field. */ +#define SAADC_INTEN_CH1LIMITH_Msk (0x1UL << SAADC_INTEN_CH1LIMITH_Pos) /*!< Bit mask of CH1LIMITH field. */ +#define SAADC_INTEN_CH1LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH1LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for CH[0].LIMITL event */ +#define SAADC_INTEN_CH0LIMITL_Pos (7UL) /*!< Position of CH0LIMITL field. */ +#define SAADC_INTEN_CH0LIMITL_Msk (0x1UL << SAADC_INTEN_CH0LIMITL_Pos) /*!< Bit mask of CH0LIMITL field. */ +#define SAADC_INTEN_CH0LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH0LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for CH[0].LIMITH event */ +#define SAADC_INTEN_CH0LIMITH_Pos (6UL) /*!< Position of CH0LIMITH field. */ +#define SAADC_INTEN_CH0LIMITH_Msk (0x1UL << SAADC_INTEN_CH0LIMITH_Pos) /*!< Bit mask of CH0LIMITH field. */ +#define SAADC_INTEN_CH0LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH0LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for STOPPED event */ +#define SAADC_INTEN_STOPPED_Pos (5UL) /*!< Position of STOPPED field. */ +#define SAADC_INTEN_STOPPED_Msk (0x1UL << SAADC_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SAADC_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for CALIBRATEDONE event */ +#define SAADC_INTEN_CALIBRATEDONE_Pos (4UL) /*!< Position of CALIBRATEDONE field. */ +#define SAADC_INTEN_CALIBRATEDONE_Msk (0x1UL << SAADC_INTEN_CALIBRATEDONE_Pos) /*!< Bit mask of CALIBRATEDONE field. */ +#define SAADC_INTEN_CALIBRATEDONE_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CALIBRATEDONE_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for RESULTDONE event */ +#define SAADC_INTEN_RESULTDONE_Pos (3UL) /*!< Position of RESULTDONE field. */ +#define SAADC_INTEN_RESULTDONE_Msk (0x1UL << SAADC_INTEN_RESULTDONE_Pos) /*!< Bit mask of RESULTDONE field. */ +#define SAADC_INTEN_RESULTDONE_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_RESULTDONE_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for DONE event */ +#define SAADC_INTEN_DONE_Pos (2UL) /*!< Position of DONE field. */ +#define SAADC_INTEN_DONE_Msk (0x1UL << SAADC_INTEN_DONE_Pos) /*!< Bit mask of DONE field. */ +#define SAADC_INTEN_DONE_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_DONE_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for END event */ +#define SAADC_INTEN_END_Pos (1UL) /*!< Position of END field. */ +#define SAADC_INTEN_END_Msk (0x1UL << SAADC_INTEN_END_Pos) /*!< Bit mask of END field. */ +#define SAADC_INTEN_END_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_END_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for STARTED event */ +#define SAADC_INTEN_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define SAADC_INTEN_STARTED_Msk (0x1UL << SAADC_INTEN_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SAADC_INTEN_STARTED_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_STARTED_Enabled (1UL) /*!< Enable */ + +/* Register: SAADC_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 21 : Write '1' to Enable interrupt for CH[7].LIMITL event */ +#define SAADC_INTENSET_CH7LIMITL_Pos (21UL) /*!< Position of CH7LIMITL field. */ +#define SAADC_INTENSET_CH7LIMITL_Msk (0x1UL << SAADC_INTENSET_CH7LIMITL_Pos) /*!< Bit mask of CH7LIMITL field. */ +#define SAADC_INTENSET_CH7LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH7LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH7LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for CH[7].LIMITH event */ +#define SAADC_INTENSET_CH7LIMITH_Pos (20UL) /*!< Position of CH7LIMITH field. */ +#define SAADC_INTENSET_CH7LIMITH_Msk (0x1UL << SAADC_INTENSET_CH7LIMITH_Pos) /*!< Bit mask of CH7LIMITH field. */ +#define SAADC_INTENSET_CH7LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH7LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH7LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for CH[6].LIMITL event */ +#define SAADC_INTENSET_CH6LIMITL_Pos (19UL) /*!< Position of CH6LIMITL field. */ +#define SAADC_INTENSET_CH6LIMITL_Msk (0x1UL << SAADC_INTENSET_CH6LIMITL_Pos) /*!< Bit mask of CH6LIMITL field. */ +#define SAADC_INTENSET_CH6LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH6LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH6LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for CH[6].LIMITH event */ +#define SAADC_INTENSET_CH6LIMITH_Pos (18UL) /*!< Position of CH6LIMITH field. */ +#define SAADC_INTENSET_CH6LIMITH_Msk (0x1UL << SAADC_INTENSET_CH6LIMITH_Pos) /*!< Bit mask of CH6LIMITH field. */ +#define SAADC_INTENSET_CH6LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH6LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH6LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for CH[5].LIMITL event */ +#define SAADC_INTENSET_CH5LIMITL_Pos (17UL) /*!< Position of CH5LIMITL field. */ +#define SAADC_INTENSET_CH5LIMITL_Msk (0x1UL << SAADC_INTENSET_CH5LIMITL_Pos) /*!< Bit mask of CH5LIMITL field. */ +#define SAADC_INTENSET_CH5LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH5LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH5LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable interrupt for CH[5].LIMITH event */ +#define SAADC_INTENSET_CH5LIMITH_Pos (16UL) /*!< Position of CH5LIMITH field. */ +#define SAADC_INTENSET_CH5LIMITH_Msk (0x1UL << SAADC_INTENSET_CH5LIMITH_Pos) /*!< Bit mask of CH5LIMITH field. */ +#define SAADC_INTENSET_CH5LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH5LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH5LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 15 : Write '1' to Enable interrupt for CH[4].LIMITL event */ +#define SAADC_INTENSET_CH4LIMITL_Pos (15UL) /*!< Position of CH4LIMITL field. */ +#define SAADC_INTENSET_CH4LIMITL_Msk (0x1UL << SAADC_INTENSET_CH4LIMITL_Pos) /*!< Bit mask of CH4LIMITL field. */ +#define SAADC_INTENSET_CH4LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH4LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH4LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for CH[4].LIMITH event */ +#define SAADC_INTENSET_CH4LIMITH_Pos (14UL) /*!< Position of CH4LIMITH field. */ +#define SAADC_INTENSET_CH4LIMITH_Msk (0x1UL << SAADC_INTENSET_CH4LIMITH_Pos) /*!< Bit mask of CH4LIMITH field. */ +#define SAADC_INTENSET_CH4LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH4LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH4LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 13 : Write '1' to Enable interrupt for CH[3].LIMITL event */ +#define SAADC_INTENSET_CH3LIMITL_Pos (13UL) /*!< Position of CH3LIMITL field. */ +#define SAADC_INTENSET_CH3LIMITL_Msk (0x1UL << SAADC_INTENSET_CH3LIMITL_Pos) /*!< Bit mask of CH3LIMITL field. */ +#define SAADC_INTENSET_CH3LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH3LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH3LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for CH[3].LIMITH event */ +#define SAADC_INTENSET_CH3LIMITH_Pos (12UL) /*!< Position of CH3LIMITH field. */ +#define SAADC_INTENSET_CH3LIMITH_Msk (0x1UL << SAADC_INTENSET_CH3LIMITH_Pos) /*!< Bit mask of CH3LIMITH field. */ +#define SAADC_INTENSET_CH3LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH3LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH3LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 11 : Write '1' to Enable interrupt for CH[2].LIMITL event */ +#define SAADC_INTENSET_CH2LIMITL_Pos (11UL) /*!< Position of CH2LIMITL field. */ +#define SAADC_INTENSET_CH2LIMITL_Msk (0x1UL << SAADC_INTENSET_CH2LIMITL_Pos) /*!< Bit mask of CH2LIMITL field. */ +#define SAADC_INTENSET_CH2LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH2LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH2LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for CH[2].LIMITH event */ +#define SAADC_INTENSET_CH2LIMITH_Pos (10UL) /*!< Position of CH2LIMITH field. */ +#define SAADC_INTENSET_CH2LIMITH_Msk (0x1UL << SAADC_INTENSET_CH2LIMITH_Pos) /*!< Bit mask of CH2LIMITH field. */ +#define SAADC_INTENSET_CH2LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH2LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH2LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for CH[1].LIMITL event */ +#define SAADC_INTENSET_CH1LIMITL_Pos (9UL) /*!< Position of CH1LIMITL field. */ +#define SAADC_INTENSET_CH1LIMITL_Msk (0x1UL << SAADC_INTENSET_CH1LIMITL_Pos) /*!< Bit mask of CH1LIMITL field. */ +#define SAADC_INTENSET_CH1LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH1LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH1LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for CH[1].LIMITH event */ +#define SAADC_INTENSET_CH1LIMITH_Pos (8UL) /*!< Position of CH1LIMITH field. */ +#define SAADC_INTENSET_CH1LIMITH_Msk (0x1UL << SAADC_INTENSET_CH1LIMITH_Pos) /*!< Bit mask of CH1LIMITH field. */ +#define SAADC_INTENSET_CH1LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH1LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH1LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for CH[0].LIMITL event */ +#define SAADC_INTENSET_CH0LIMITL_Pos (7UL) /*!< Position of CH0LIMITL field. */ +#define SAADC_INTENSET_CH0LIMITL_Msk (0x1UL << SAADC_INTENSET_CH0LIMITL_Pos) /*!< Bit mask of CH0LIMITL field. */ +#define SAADC_INTENSET_CH0LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH0LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH0LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for CH[0].LIMITH event */ +#define SAADC_INTENSET_CH0LIMITH_Pos (6UL) /*!< Position of CH0LIMITH field. */ +#define SAADC_INTENSET_CH0LIMITH_Msk (0x1UL << SAADC_INTENSET_CH0LIMITH_Pos) /*!< Bit mask of CH0LIMITH field. */ +#define SAADC_INTENSET_CH0LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH0LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH0LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for STOPPED event */ +#define SAADC_INTENSET_STOPPED_Pos (5UL) /*!< Position of STOPPED field. */ +#define SAADC_INTENSET_STOPPED_Msk (0x1UL << SAADC_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SAADC_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for CALIBRATEDONE event */ +#define SAADC_INTENSET_CALIBRATEDONE_Pos (4UL) /*!< Position of CALIBRATEDONE field. */ +#define SAADC_INTENSET_CALIBRATEDONE_Msk (0x1UL << SAADC_INTENSET_CALIBRATEDONE_Pos) /*!< Bit mask of CALIBRATEDONE field. */ +#define SAADC_INTENSET_CALIBRATEDONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CALIBRATEDONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CALIBRATEDONE_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for RESULTDONE event */ +#define SAADC_INTENSET_RESULTDONE_Pos (3UL) /*!< Position of RESULTDONE field. */ +#define SAADC_INTENSET_RESULTDONE_Msk (0x1UL << SAADC_INTENSET_RESULTDONE_Pos) /*!< Bit mask of RESULTDONE field. */ +#define SAADC_INTENSET_RESULTDONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_RESULTDONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_RESULTDONE_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for DONE event */ +#define SAADC_INTENSET_DONE_Pos (2UL) /*!< Position of DONE field. */ +#define SAADC_INTENSET_DONE_Msk (0x1UL << SAADC_INTENSET_DONE_Pos) /*!< Bit mask of DONE field. */ +#define SAADC_INTENSET_DONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_DONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_DONE_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for END event */ +#define SAADC_INTENSET_END_Pos (1UL) /*!< Position of END field. */ +#define SAADC_INTENSET_END_Msk (0x1UL << SAADC_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define SAADC_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for STARTED event */ +#define SAADC_INTENSET_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define SAADC_INTENSET_STARTED_Msk (0x1UL << SAADC_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SAADC_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Register: SAADC_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 21 : Write '1' to Disable interrupt for CH[7].LIMITL event */ +#define SAADC_INTENCLR_CH7LIMITL_Pos (21UL) /*!< Position of CH7LIMITL field. */ +#define SAADC_INTENCLR_CH7LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH7LIMITL_Pos) /*!< Bit mask of CH7LIMITL field. */ +#define SAADC_INTENCLR_CH7LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH7LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH7LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for CH[7].LIMITH event */ +#define SAADC_INTENCLR_CH7LIMITH_Pos (20UL) /*!< Position of CH7LIMITH field. */ +#define SAADC_INTENCLR_CH7LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH7LIMITH_Pos) /*!< Bit mask of CH7LIMITH field. */ +#define SAADC_INTENCLR_CH7LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH7LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH7LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for CH[6].LIMITL event */ +#define SAADC_INTENCLR_CH6LIMITL_Pos (19UL) /*!< Position of CH6LIMITL field. */ +#define SAADC_INTENCLR_CH6LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH6LIMITL_Pos) /*!< Bit mask of CH6LIMITL field. */ +#define SAADC_INTENCLR_CH6LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH6LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH6LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for CH[6].LIMITH event */ +#define SAADC_INTENCLR_CH6LIMITH_Pos (18UL) /*!< Position of CH6LIMITH field. */ +#define SAADC_INTENCLR_CH6LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH6LIMITH_Pos) /*!< Bit mask of CH6LIMITH field. */ +#define SAADC_INTENCLR_CH6LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH6LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH6LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for CH[5].LIMITL event */ +#define SAADC_INTENCLR_CH5LIMITL_Pos (17UL) /*!< Position of CH5LIMITL field. */ +#define SAADC_INTENCLR_CH5LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH5LIMITL_Pos) /*!< Bit mask of CH5LIMITL field. */ +#define SAADC_INTENCLR_CH5LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH5LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH5LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable interrupt for CH[5].LIMITH event */ +#define SAADC_INTENCLR_CH5LIMITH_Pos (16UL) /*!< Position of CH5LIMITH field. */ +#define SAADC_INTENCLR_CH5LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH5LIMITH_Pos) /*!< Bit mask of CH5LIMITH field. */ +#define SAADC_INTENCLR_CH5LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH5LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH5LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 15 : Write '1' to Disable interrupt for CH[4].LIMITL event */ +#define SAADC_INTENCLR_CH4LIMITL_Pos (15UL) /*!< Position of CH4LIMITL field. */ +#define SAADC_INTENCLR_CH4LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH4LIMITL_Pos) /*!< Bit mask of CH4LIMITL field. */ +#define SAADC_INTENCLR_CH4LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH4LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH4LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for CH[4].LIMITH event */ +#define SAADC_INTENCLR_CH4LIMITH_Pos (14UL) /*!< Position of CH4LIMITH field. */ +#define SAADC_INTENCLR_CH4LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH4LIMITH_Pos) /*!< Bit mask of CH4LIMITH field. */ +#define SAADC_INTENCLR_CH4LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH4LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH4LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 13 : Write '1' to Disable interrupt for CH[3].LIMITL event */ +#define SAADC_INTENCLR_CH3LIMITL_Pos (13UL) /*!< Position of CH3LIMITL field. */ +#define SAADC_INTENCLR_CH3LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH3LIMITL_Pos) /*!< Bit mask of CH3LIMITL field. */ +#define SAADC_INTENCLR_CH3LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH3LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH3LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for CH[3].LIMITH event */ +#define SAADC_INTENCLR_CH3LIMITH_Pos (12UL) /*!< Position of CH3LIMITH field. */ +#define SAADC_INTENCLR_CH3LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH3LIMITH_Pos) /*!< Bit mask of CH3LIMITH field. */ +#define SAADC_INTENCLR_CH3LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH3LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH3LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 11 : Write '1' to Disable interrupt for CH[2].LIMITL event */ +#define SAADC_INTENCLR_CH2LIMITL_Pos (11UL) /*!< Position of CH2LIMITL field. */ +#define SAADC_INTENCLR_CH2LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH2LIMITL_Pos) /*!< Bit mask of CH2LIMITL field. */ +#define SAADC_INTENCLR_CH2LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH2LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH2LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for CH[2].LIMITH event */ +#define SAADC_INTENCLR_CH2LIMITH_Pos (10UL) /*!< Position of CH2LIMITH field. */ +#define SAADC_INTENCLR_CH2LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH2LIMITH_Pos) /*!< Bit mask of CH2LIMITH field. */ +#define SAADC_INTENCLR_CH2LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH2LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH2LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for CH[1].LIMITL event */ +#define SAADC_INTENCLR_CH1LIMITL_Pos (9UL) /*!< Position of CH1LIMITL field. */ +#define SAADC_INTENCLR_CH1LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH1LIMITL_Pos) /*!< Bit mask of CH1LIMITL field. */ +#define SAADC_INTENCLR_CH1LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH1LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH1LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for CH[1].LIMITH event */ +#define SAADC_INTENCLR_CH1LIMITH_Pos (8UL) /*!< Position of CH1LIMITH field. */ +#define SAADC_INTENCLR_CH1LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH1LIMITH_Pos) /*!< Bit mask of CH1LIMITH field. */ +#define SAADC_INTENCLR_CH1LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH1LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH1LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for CH[0].LIMITL event */ +#define SAADC_INTENCLR_CH0LIMITL_Pos (7UL) /*!< Position of CH0LIMITL field. */ +#define SAADC_INTENCLR_CH0LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH0LIMITL_Pos) /*!< Bit mask of CH0LIMITL field. */ +#define SAADC_INTENCLR_CH0LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH0LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH0LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for CH[0].LIMITH event */ +#define SAADC_INTENCLR_CH0LIMITH_Pos (6UL) /*!< Position of CH0LIMITH field. */ +#define SAADC_INTENCLR_CH0LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH0LIMITH_Pos) /*!< Bit mask of CH0LIMITH field. */ +#define SAADC_INTENCLR_CH0LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH0LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH0LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for STOPPED event */ +#define SAADC_INTENCLR_STOPPED_Pos (5UL) /*!< Position of STOPPED field. */ +#define SAADC_INTENCLR_STOPPED_Msk (0x1UL << SAADC_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SAADC_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for CALIBRATEDONE event */ +#define SAADC_INTENCLR_CALIBRATEDONE_Pos (4UL) /*!< Position of CALIBRATEDONE field. */ +#define SAADC_INTENCLR_CALIBRATEDONE_Msk (0x1UL << SAADC_INTENCLR_CALIBRATEDONE_Pos) /*!< Bit mask of CALIBRATEDONE field. */ +#define SAADC_INTENCLR_CALIBRATEDONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CALIBRATEDONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CALIBRATEDONE_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for RESULTDONE event */ +#define SAADC_INTENCLR_RESULTDONE_Pos (3UL) /*!< Position of RESULTDONE field. */ +#define SAADC_INTENCLR_RESULTDONE_Msk (0x1UL << SAADC_INTENCLR_RESULTDONE_Pos) /*!< Bit mask of RESULTDONE field. */ +#define SAADC_INTENCLR_RESULTDONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_RESULTDONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_RESULTDONE_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for DONE event */ +#define SAADC_INTENCLR_DONE_Pos (2UL) /*!< Position of DONE field. */ +#define SAADC_INTENCLR_DONE_Msk (0x1UL << SAADC_INTENCLR_DONE_Pos) /*!< Bit mask of DONE field. */ +#define SAADC_INTENCLR_DONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_DONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_DONE_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for END event */ +#define SAADC_INTENCLR_END_Pos (1UL) /*!< Position of END field. */ +#define SAADC_INTENCLR_END_Msk (0x1UL << SAADC_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define SAADC_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for STARTED event */ +#define SAADC_INTENCLR_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define SAADC_INTENCLR_STARTED_Msk (0x1UL << SAADC_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SAADC_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Register: SAADC_STATUS */ +/* Description: Status */ + +/* Bit 0 : Status */ +#define SAADC_STATUS_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define SAADC_STATUS_STATUS_Msk (0x1UL << SAADC_STATUS_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define SAADC_STATUS_STATUS_Ready (0UL) /*!< ADC is ready. No on-going conversion. */ +#define SAADC_STATUS_STATUS_Busy (1UL) /*!< ADC is busy. Conversion in progress. */ + +/* Register: SAADC_ENABLE */ +/* Description: Enable or disable ADC */ + +/* Bit 0 : Enable or disable ADC */ +#define SAADC_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SAADC_ENABLE_ENABLE_Msk (0x1UL << SAADC_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SAADC_ENABLE_ENABLE_Disabled (0UL) /*!< Disable ADC */ +#define SAADC_ENABLE_ENABLE_Enabled (1UL) /*!< Enable ADC */ + +/* Register: SAADC_CH_PSELP */ +/* Description: Description cluster[0]: Input positive pin selection for CH[0] */ + +/* Bits 4..0 : Analog positive input channel */ +#define SAADC_CH_PSELP_PSELP_Pos (0UL) /*!< Position of PSELP field. */ +#define SAADC_CH_PSELP_PSELP_Msk (0x1FUL << SAADC_CH_PSELP_PSELP_Pos) /*!< Bit mask of PSELP field. */ +#define SAADC_CH_PSELP_PSELP_NC (0UL) /*!< Not connected */ +#define SAADC_CH_PSELP_PSELP_AnalogInput0 (1UL) /*!< AIN0 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput1 (2UL) /*!< AIN1 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput2 (3UL) /*!< AIN2 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput3 (4UL) /*!< AIN3 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput4 (5UL) /*!< AIN4 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput5 (6UL) /*!< AIN5 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput6 (7UL) /*!< AIN6 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput7 (8UL) /*!< AIN7 */ +#define SAADC_CH_PSELP_PSELP_VDD (9UL) /*!< VDD */ + +/* Register: SAADC_CH_PSELN */ +/* Description: Description cluster[0]: Input negative pin selection for CH[0] */ + +/* Bits 4..0 : Analog negative input, enables differential channel */ +#define SAADC_CH_PSELN_PSELN_Pos (0UL) /*!< Position of PSELN field. */ +#define SAADC_CH_PSELN_PSELN_Msk (0x1FUL << SAADC_CH_PSELN_PSELN_Pos) /*!< Bit mask of PSELN field. */ +#define SAADC_CH_PSELN_PSELN_NC (0UL) /*!< Not connected */ +#define SAADC_CH_PSELN_PSELN_AnalogInput0 (1UL) /*!< AIN0 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput1 (2UL) /*!< AIN1 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput2 (3UL) /*!< AIN2 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput3 (4UL) /*!< AIN3 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput4 (5UL) /*!< AIN4 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput5 (6UL) /*!< AIN5 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput6 (7UL) /*!< AIN6 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput7 (8UL) /*!< AIN7 */ +#define SAADC_CH_PSELN_PSELN_VDD (9UL) /*!< VDD */ + +/* Register: SAADC_CH_CONFIG */ +/* Description: Description cluster[0]: Input configuration for CH[0] */ + +/* Bit 24 : Enable burst mode */ +#define SAADC_CH_CONFIG_BURST_Pos (24UL) /*!< Position of BURST field. */ +#define SAADC_CH_CONFIG_BURST_Msk (0x1UL << SAADC_CH_CONFIG_BURST_Pos) /*!< Bit mask of BURST field. */ +#define SAADC_CH_CONFIG_BURST_Disabled (0UL) /*!< Burst mode is disabled (normal operation) */ +#define SAADC_CH_CONFIG_BURST_Enabled (1UL) /*!< Burst mode is enabled. SAADC takes 2^OVERSAMPLE number of samples as fast as it can, and sends the average to Data RAM. */ + +/* Bit 20 : Enable differential mode */ +#define SAADC_CH_CONFIG_MODE_Pos (20UL) /*!< Position of MODE field. */ +#define SAADC_CH_CONFIG_MODE_Msk (0x1UL << SAADC_CH_CONFIG_MODE_Pos) /*!< Bit mask of MODE field. */ +#define SAADC_CH_CONFIG_MODE_SE (0UL) /*!< Single ended, PSELN will be ignored, negative input to ADC shorted to GND */ +#define SAADC_CH_CONFIG_MODE_Diff (1UL) /*!< Differential */ + +/* Bits 18..16 : Acquisition time, the time the ADC uses to sample the input voltage */ +#define SAADC_CH_CONFIG_TACQ_Pos (16UL) /*!< Position of TACQ field. */ +#define SAADC_CH_CONFIG_TACQ_Msk (0x7UL << SAADC_CH_CONFIG_TACQ_Pos) /*!< Bit mask of TACQ field. */ +#define SAADC_CH_CONFIG_TACQ_3us (0UL) /*!< 3 us */ +#define SAADC_CH_CONFIG_TACQ_5us (1UL) /*!< 5 us */ +#define SAADC_CH_CONFIG_TACQ_10us (2UL) /*!< 10 us */ +#define SAADC_CH_CONFIG_TACQ_15us (3UL) /*!< 15 us */ +#define SAADC_CH_CONFIG_TACQ_20us (4UL) /*!< 20 us */ +#define SAADC_CH_CONFIG_TACQ_40us (5UL) /*!< 40 us */ + +/* Bit 12 : Reference control */ +#define SAADC_CH_CONFIG_REFSEL_Pos (12UL) /*!< Position of REFSEL field. */ +#define SAADC_CH_CONFIG_REFSEL_Msk (0x1UL << SAADC_CH_CONFIG_REFSEL_Pos) /*!< Bit mask of REFSEL field. */ +#define SAADC_CH_CONFIG_REFSEL_Internal (0UL) /*!< Internal reference (0.6 V) */ +#define SAADC_CH_CONFIG_REFSEL_VDD1_4 (1UL) /*!< VDD/4 as reference */ + +/* Bits 10..8 : Gain control */ +#define SAADC_CH_CONFIG_GAIN_Pos (8UL) /*!< Position of GAIN field. */ +#define SAADC_CH_CONFIG_GAIN_Msk (0x7UL << SAADC_CH_CONFIG_GAIN_Pos) /*!< Bit mask of GAIN field. */ +#define SAADC_CH_CONFIG_GAIN_Gain1_6 (0UL) /*!< 1/6 */ +#define SAADC_CH_CONFIG_GAIN_Gain1_5 (1UL) /*!< 1/5 */ +#define SAADC_CH_CONFIG_GAIN_Gain1_4 (2UL) /*!< 1/4 */ +#define SAADC_CH_CONFIG_GAIN_Gain1_3 (3UL) /*!< 1/3 */ +#define SAADC_CH_CONFIG_GAIN_Gain1_2 (4UL) /*!< 1/2 */ +#define SAADC_CH_CONFIG_GAIN_Gain1 (5UL) /*!< 1 */ +#define SAADC_CH_CONFIG_GAIN_Gain2 (6UL) /*!< 2 */ +#define SAADC_CH_CONFIG_GAIN_Gain4 (7UL) /*!< 4 */ + +/* Bits 5..4 : Negative channel resistor control */ +#define SAADC_CH_CONFIG_RESN_Pos (4UL) /*!< Position of RESN field. */ +#define SAADC_CH_CONFIG_RESN_Msk (0x3UL << SAADC_CH_CONFIG_RESN_Pos) /*!< Bit mask of RESN field. */ +#define SAADC_CH_CONFIG_RESN_Bypass (0UL) /*!< Bypass resistor ladder */ +#define SAADC_CH_CONFIG_RESN_Pulldown (1UL) /*!< Pull-down to GND */ +#define SAADC_CH_CONFIG_RESN_Pullup (2UL) /*!< Pull-up to VDD */ +#define SAADC_CH_CONFIG_RESN_VDD1_2 (3UL) /*!< Set input at VDD/2 */ + +/* Bits 1..0 : Positive channel resistor control */ +#define SAADC_CH_CONFIG_RESP_Pos (0UL) /*!< Position of RESP field. */ +#define SAADC_CH_CONFIG_RESP_Msk (0x3UL << SAADC_CH_CONFIG_RESP_Pos) /*!< Bit mask of RESP field. */ +#define SAADC_CH_CONFIG_RESP_Bypass (0UL) /*!< Bypass resistor ladder */ +#define SAADC_CH_CONFIG_RESP_Pulldown (1UL) /*!< Pull-down to GND */ +#define SAADC_CH_CONFIG_RESP_Pullup (2UL) /*!< Pull-up to VDD */ +#define SAADC_CH_CONFIG_RESP_VDD1_2 (3UL) /*!< Set input at VDD/2 */ + +/* Register: SAADC_CH_LIMIT */ +/* Description: Description cluster[0]: High/low limits for event monitoring a channel */ + +/* Bits 31..16 : High level limit */ +#define SAADC_CH_LIMIT_HIGH_Pos (16UL) /*!< Position of HIGH field. */ +#define SAADC_CH_LIMIT_HIGH_Msk (0xFFFFUL << SAADC_CH_LIMIT_HIGH_Pos) /*!< Bit mask of HIGH field. */ + +/* Bits 15..0 : Low level limit */ +#define SAADC_CH_LIMIT_LOW_Pos (0UL) /*!< Position of LOW field. */ +#define SAADC_CH_LIMIT_LOW_Msk (0xFFFFUL << SAADC_CH_LIMIT_LOW_Pos) /*!< Bit mask of LOW field. */ + +/* Register: SAADC_RESOLUTION */ +/* Description: Resolution configuration */ + +/* Bits 2..0 : Set the resolution */ +#define SAADC_RESOLUTION_VAL_Pos (0UL) /*!< Position of VAL field. */ +#define SAADC_RESOLUTION_VAL_Msk (0x7UL << SAADC_RESOLUTION_VAL_Pos) /*!< Bit mask of VAL field. */ +#define SAADC_RESOLUTION_VAL_8bit (0UL) /*!< 8 bit */ +#define SAADC_RESOLUTION_VAL_10bit (1UL) /*!< 10 bit */ +#define SAADC_RESOLUTION_VAL_12bit (2UL) /*!< 12 bit */ +#define SAADC_RESOLUTION_VAL_14bit (3UL) /*!< 14 bit */ + +/* Register: SAADC_OVERSAMPLE */ +/* Description: Oversampling configuration. OVERSAMPLE should not be combined with SCAN. The RESOLUTION is applied before averaging, thus for high OVERSAMPLE a higher RESOLUTION should be used. */ + +/* Bits 3..0 : Oversample control */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Pos (0UL) /*!< Position of OVERSAMPLE field. */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Msk (0xFUL << SAADC_OVERSAMPLE_OVERSAMPLE_Pos) /*!< Bit mask of OVERSAMPLE field. */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Bypass (0UL) /*!< Bypass oversampling */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over2x (1UL) /*!< Oversample 2x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over4x (2UL) /*!< Oversample 4x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over8x (3UL) /*!< Oversample 8x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over16x (4UL) /*!< Oversample 16x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over32x (5UL) /*!< Oversample 32x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over64x (6UL) /*!< Oversample 64x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over128x (7UL) /*!< Oversample 128x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over256x (8UL) /*!< Oversample 256x */ + +/* Register: SAADC_SAMPLERATE */ +/* Description: Controls normal or continuous sample rate */ + +/* Bit 12 : Select mode for sample rate control */ +#define SAADC_SAMPLERATE_MODE_Pos (12UL) /*!< Position of MODE field. */ +#define SAADC_SAMPLERATE_MODE_Msk (0x1UL << SAADC_SAMPLERATE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define SAADC_SAMPLERATE_MODE_Task (0UL) /*!< Rate is controlled from SAMPLE task */ +#define SAADC_SAMPLERATE_MODE_Timers (1UL) /*!< Rate is controlled from local timer (use CC to control the rate) */ + +/* Bits 10..0 : Capture and compare value. Sample rate is 16 MHz/CC */ +#define SAADC_SAMPLERATE_CC_Pos (0UL) /*!< Position of CC field. */ +#define SAADC_SAMPLERATE_CC_Msk (0x7FFUL << SAADC_SAMPLERATE_CC_Pos) /*!< Bit mask of CC field. */ + +/* Register: SAADC_RESULT_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define SAADC_RESULT_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SAADC_RESULT_PTR_PTR_Msk (0xFFFFFFFFUL << SAADC_RESULT_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SAADC_RESULT_MAXCNT */ +/* Description: Maximum number of buffer words to transfer */ + +/* Bits 14..0 : Maximum number of buffer words to transfer */ +#define SAADC_RESULT_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SAADC_RESULT_MAXCNT_MAXCNT_Msk (0x7FFFUL << SAADC_RESULT_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SAADC_RESULT_AMOUNT */ +/* Description: Number of buffer words transferred since last START */ + +/* Bits 14..0 : Number of buffer words transferred since last START. This register can be read after an END or STOPPED event. */ +#define SAADC_RESULT_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SAADC_RESULT_AMOUNT_AMOUNT_Msk (0x7FFFUL << SAADC_RESULT_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + + +/* Peripheral: SPI */ +/* Description: Serial Peripheral Interface 0 */ + +/* Register: SPI_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 2 : Write '1' to Enable interrupt for READY event */ +#define SPI_INTENSET_READY_Pos (2UL) /*!< Position of READY field. */ +#define SPI_INTENSET_READY_Msk (0x1UL << SPI_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define SPI_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define SPI_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define SPI_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: SPI_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 2 : Write '1' to Disable interrupt for READY event */ +#define SPI_INTENCLR_READY_Pos (2UL) /*!< Position of READY field. */ +#define SPI_INTENCLR_READY_Msk (0x1UL << SPI_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define SPI_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define SPI_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define SPI_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: SPI_ENABLE */ +/* Description: Enable SPI */ + +/* Bits 3..0 : Enable or disable SPI */ +#define SPI_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPI_ENABLE_ENABLE_Msk (0xFUL << SPI_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPI_ENABLE_ENABLE_Disabled (0UL) /*!< Disable SPI */ +#define SPI_ENABLE_ENABLE_Enabled (1UL) /*!< Enable SPI */ + +/* Register: SPI_PSEL_SCK */ +/* Description: Pin select for SCK */ + +/* Bits 31..0 : Pin number configuration for SPI SCK signal */ +#define SPI_PSEL_SCK_PSELSCK_Pos (0UL) /*!< Position of PSELSCK field. */ +#define SPI_PSEL_SCK_PSELSCK_Msk (0xFFFFFFFFUL << SPI_PSEL_SCK_PSELSCK_Pos) /*!< Bit mask of PSELSCK field. */ +#define SPI_PSEL_SCK_PSELSCK_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: SPI_PSEL_MOSI */ +/* Description: Pin select for MOSI */ + +/* Bits 31..0 : Pin number configuration for SPI MOSI signal */ +#define SPI_PSEL_MOSI_PSELMOSI_Pos (0UL) /*!< Position of PSELMOSI field. */ +#define SPI_PSEL_MOSI_PSELMOSI_Msk (0xFFFFFFFFUL << SPI_PSEL_MOSI_PSELMOSI_Pos) /*!< Bit mask of PSELMOSI field. */ +#define SPI_PSEL_MOSI_PSELMOSI_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: SPI_PSEL_MISO */ +/* Description: Pin select for MISO */ + +/* Bits 31..0 : Pin number configuration for SPI MISO signal */ +#define SPI_PSEL_MISO_PSELMISO_Pos (0UL) /*!< Position of PSELMISO field. */ +#define SPI_PSEL_MISO_PSELMISO_Msk (0xFFFFFFFFUL << SPI_PSEL_MISO_PSELMISO_Pos) /*!< Bit mask of PSELMISO field. */ +#define SPI_PSEL_MISO_PSELMISO_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: SPI_RXD */ +/* Description: RXD register */ + +/* Bits 7..0 : RX data received. Double buffered */ +#define SPI_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define SPI_RXD_RXD_Msk (0xFFUL << SPI_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: SPI_TXD */ +/* Description: TXD register */ + +/* Bits 7..0 : TX data to send. Double buffered */ +#define SPI_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define SPI_TXD_TXD_Msk (0xFFUL << SPI_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: SPI_FREQUENCY */ +/* Description: SPI frequency */ + +/* Bits 31..0 : SPI master data rate */ +#define SPI_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define SPI_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << SPI_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define SPI_FREQUENCY_FREQUENCY_K125 (0x02000000UL) /*!< 125 kbps */ +#define SPI_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps */ +#define SPI_FREQUENCY_FREQUENCY_K500 (0x08000000UL) /*!< 500 kbps */ +#define SPI_FREQUENCY_FREQUENCY_M1 (0x10000000UL) /*!< 1 Mbps */ +#define SPI_FREQUENCY_FREQUENCY_M2 (0x20000000UL) /*!< 2 Mbps */ +#define SPI_FREQUENCY_FREQUENCY_M4 (0x40000000UL) /*!< 4 Mbps */ +#define SPI_FREQUENCY_FREQUENCY_M8 (0x80000000UL) /*!< 8 Mbps */ + +/* Register: SPI_CONFIG */ +/* Description: Configuration register */ + +/* Bit 2 : Serial clock (SCK) polarity */ +#define SPI_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPI_CONFIG_CPOL_Msk (0x1UL << SPI_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPI_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high */ +#define SPI_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low */ + +/* Bit 1 : Serial clock (SCK) phase */ +#define SPI_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPI_CONFIG_CPHA_Msk (0x1UL << SPI_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPI_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of clock, shift serial data on trailing edge */ +#define SPI_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of clock, shift serial data on leading edge */ + +/* Bit 0 : Bit order */ +#define SPI_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPI_CONFIG_ORDER_Msk (0x1UL << SPI_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPI_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit shifted out first */ +#define SPI_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit shifted out first */ + + +/* Peripheral: SPIM */ +/* Description: Serial Peripheral Interface Master with EasyDMA 0 */ + +/* Register: SPIM_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 17 : Shortcut between END event and START task */ +#define SPIM_SHORTS_END_START_Pos (17UL) /*!< Position of END_START field. */ +#define SPIM_SHORTS_END_START_Msk (0x1UL << SPIM_SHORTS_END_START_Pos) /*!< Bit mask of END_START field. */ +#define SPIM_SHORTS_END_START_Disabled (0UL) /*!< Disable shortcut */ +#define SPIM_SHORTS_END_START_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: SPIM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 19 : Write '1' to Enable interrupt for STARTED event */ +#define SPIM_INTENSET_STARTED_Pos (19UL) /*!< Position of STARTED field. */ +#define SPIM_INTENSET_STARTED_Msk (0x1UL << SPIM_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SPIM_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for ENDTX event */ +#define SPIM_INTENSET_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define SPIM_INTENSET_ENDTX_Msk (0x1UL << SPIM_INTENSET_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define SPIM_INTENSET_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_ENDTX_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for END event */ +#define SPIM_INTENSET_END_Pos (6UL) /*!< Position of END field. */ +#define SPIM_INTENSET_END_Msk (0x1UL << SPIM_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define SPIM_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for ENDRX event */ +#define SPIM_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIM_INTENSET_ENDRX_Msk (0x1UL << SPIM_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIM_INTENSET_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_ENDRX_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define SPIM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define SPIM_INTENSET_STOPPED_Msk (0x1UL << SPIM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SPIM_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: SPIM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 19 : Write '1' to Disable interrupt for STARTED event */ +#define SPIM_INTENCLR_STARTED_Pos (19UL) /*!< Position of STARTED field. */ +#define SPIM_INTENCLR_STARTED_Msk (0x1UL << SPIM_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SPIM_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for ENDTX event */ +#define SPIM_INTENCLR_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define SPIM_INTENCLR_ENDTX_Msk (0x1UL << SPIM_INTENCLR_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define SPIM_INTENCLR_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_ENDTX_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for END event */ +#define SPIM_INTENCLR_END_Pos (6UL) /*!< Position of END field. */ +#define SPIM_INTENCLR_END_Msk (0x1UL << SPIM_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define SPIM_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for ENDRX event */ +#define SPIM_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIM_INTENCLR_ENDRX_Msk (0x1UL << SPIM_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIM_INTENCLR_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define SPIM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define SPIM_INTENCLR_STOPPED_Msk (0x1UL << SPIM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SPIM_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: SPIM_ENABLE */ +/* Description: Enable SPIM */ + +/* Bits 3..0 : Enable or disable SPIM */ +#define SPIM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPIM_ENABLE_ENABLE_Msk (0xFUL << SPIM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPIM_ENABLE_ENABLE_Disabled (0UL) /*!< Disable SPIM */ +#define SPIM_ENABLE_ENABLE_Enabled (7UL) /*!< Enable SPIM */ + +/* Register: SPIM_PSEL_SCK */ +/* Description: Pin select for SCK */ + +/* Bit 31 : Connection */ +#define SPIM_PSEL_SCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIM_PSEL_SCK_CONNECT_Msk (0x1UL << SPIM_PSEL_SCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIM_PSEL_SCK_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIM_PSEL_SCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define SPIM_PSEL_SCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIM_PSEL_SCK_PIN_Msk (0x1FUL << SPIM_PSEL_SCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIM_PSEL_MOSI */ +/* Description: Pin select for MOSI signal */ + +/* Bit 31 : Connection */ +#define SPIM_PSEL_MOSI_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIM_PSEL_MOSI_CONNECT_Msk (0x1UL << SPIM_PSEL_MOSI_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIM_PSEL_MOSI_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIM_PSEL_MOSI_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define SPIM_PSEL_MOSI_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIM_PSEL_MOSI_PIN_Msk (0x1FUL << SPIM_PSEL_MOSI_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIM_PSEL_MISO */ +/* Description: Pin select for MISO signal */ + +/* Bit 31 : Connection */ +#define SPIM_PSEL_MISO_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIM_PSEL_MISO_CONNECT_Msk (0x1UL << SPIM_PSEL_MISO_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIM_PSEL_MISO_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIM_PSEL_MISO_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define SPIM_PSEL_MISO_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIM_PSEL_MISO_PIN_Msk (0x1FUL << SPIM_PSEL_MISO_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIM_FREQUENCY */ +/* Description: SPI frequency */ + +/* Bits 31..0 : SPI master data rate */ +#define SPIM_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define SPIM_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << SPIM_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define SPIM_FREQUENCY_FREQUENCY_K125 (0x02000000UL) /*!< 125 kbps */ +#define SPIM_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps */ +#define SPIM_FREQUENCY_FREQUENCY_K500 (0x08000000UL) /*!< 500 kbps */ +#define SPIM_FREQUENCY_FREQUENCY_M1 (0x10000000UL) /*!< 1 Mbps */ +#define SPIM_FREQUENCY_FREQUENCY_M2 (0x20000000UL) /*!< 2 Mbps */ +#define SPIM_FREQUENCY_FREQUENCY_M4 (0x40000000UL) /*!< 4 Mbps */ +#define SPIM_FREQUENCY_FREQUENCY_M8 (0x80000000UL) /*!< 8 Mbps */ + +/* Register: SPIM_RXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define SPIM_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIM_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIM_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIM_RXD_MAXCNT */ +/* Description: Maximum number of bytes in receive buffer */ + +/* Bits 7..0 : Maximum number of bytes in receive buffer */ +#define SPIM_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIM_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIM_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIM_RXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last transaction */ +#define SPIM_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIM_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIM_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIM_RXD_LIST */ +/* Description: EasyDMA list type */ + +/* Bits 2..0 : List type */ +#define SPIM_RXD_LIST_LIST_Pos (0UL) /*!< Position of LIST field. */ +#define SPIM_RXD_LIST_LIST_Msk (0x7UL << SPIM_RXD_LIST_LIST_Pos) /*!< Bit mask of LIST field. */ +#define SPIM_RXD_LIST_LIST_Disabled (0UL) /*!< Disable EasyDMA list */ +#define SPIM_RXD_LIST_LIST_ArrayList (1UL) /*!< Use array list */ + +/* Register: SPIM_TXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define SPIM_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIM_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIM_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIM_TXD_MAXCNT */ +/* Description: Maximum number of bytes in transmit buffer */ + +/* Bits 7..0 : Maximum number of bytes in transmit buffer */ +#define SPIM_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIM_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIM_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIM_TXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last transaction */ +#define SPIM_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIM_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIM_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIM_TXD_LIST */ +/* Description: EasyDMA list type */ + +/* Bits 2..0 : List type */ +#define SPIM_TXD_LIST_LIST_Pos (0UL) /*!< Position of LIST field. */ +#define SPIM_TXD_LIST_LIST_Msk (0x7UL << SPIM_TXD_LIST_LIST_Pos) /*!< Bit mask of LIST field. */ +#define SPIM_TXD_LIST_LIST_Disabled (0UL) /*!< Disable EasyDMA list */ +#define SPIM_TXD_LIST_LIST_ArrayList (1UL) /*!< Use array list */ + +/* Register: SPIM_CONFIG */ +/* Description: Configuration register */ + +/* Bit 2 : Serial clock (SCK) polarity */ +#define SPIM_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPIM_CONFIG_CPOL_Msk (0x1UL << SPIM_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPIM_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high */ +#define SPIM_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low */ + +/* Bit 1 : Serial clock (SCK) phase */ +#define SPIM_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPIM_CONFIG_CPHA_Msk (0x1UL << SPIM_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPIM_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of clock, shift serial data on trailing edge */ +#define SPIM_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of clock, shift serial data on leading edge */ + +/* Bit 0 : Bit order */ +#define SPIM_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPIM_CONFIG_ORDER_Msk (0x1UL << SPIM_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPIM_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit shifted out first */ +#define SPIM_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit shifted out first */ + +/* Register: SPIM_ORC */ +/* Description: Over-read character. Character clocked out in case and over-read of the TXD buffer. */ + +/* Bits 7..0 : Over-read character. Character clocked out in case and over-read of the TXD buffer. */ +#define SPIM_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ +#define SPIM_ORC_ORC_Msk (0xFFUL << SPIM_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ + + +/* Peripheral: SPIS */ +/* Description: SPI Slave 0 */ + +/* Register: SPIS_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 2 : Shortcut between END event and ACQUIRE task */ +#define SPIS_SHORTS_END_ACQUIRE_Pos (2UL) /*!< Position of END_ACQUIRE field. */ +#define SPIS_SHORTS_END_ACQUIRE_Msk (0x1UL << SPIS_SHORTS_END_ACQUIRE_Pos) /*!< Bit mask of END_ACQUIRE field. */ +#define SPIS_SHORTS_END_ACQUIRE_Disabled (0UL) /*!< Disable shortcut */ +#define SPIS_SHORTS_END_ACQUIRE_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: SPIS_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 10 : Write '1' to Enable interrupt for ACQUIRED event */ +#define SPIS_INTENSET_ACQUIRED_Pos (10UL) /*!< Position of ACQUIRED field. */ +#define SPIS_INTENSET_ACQUIRED_Msk (0x1UL << SPIS_INTENSET_ACQUIRED_Pos) /*!< Bit mask of ACQUIRED field. */ +#define SPIS_INTENSET_ACQUIRED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENSET_ACQUIRED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENSET_ACQUIRED_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for ENDRX event */ +#define SPIS_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIS_INTENSET_ENDRX_Msk (0x1UL << SPIS_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIS_INTENSET_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENSET_ENDRX_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for END event */ +#define SPIS_INTENSET_END_Pos (1UL) /*!< Position of END field. */ +#define SPIS_INTENSET_END_Msk (0x1UL << SPIS_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define SPIS_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Register: SPIS_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 10 : Write '1' to Disable interrupt for ACQUIRED event */ +#define SPIS_INTENCLR_ACQUIRED_Pos (10UL) /*!< Position of ACQUIRED field. */ +#define SPIS_INTENCLR_ACQUIRED_Msk (0x1UL << SPIS_INTENCLR_ACQUIRED_Pos) /*!< Bit mask of ACQUIRED field. */ +#define SPIS_INTENCLR_ACQUIRED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENCLR_ACQUIRED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENCLR_ACQUIRED_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for ENDRX event */ +#define SPIS_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIS_INTENCLR_ENDRX_Msk (0x1UL << SPIS_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIS_INTENCLR_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for END event */ +#define SPIS_INTENCLR_END_Pos (1UL) /*!< Position of END field. */ +#define SPIS_INTENCLR_END_Msk (0x1UL << SPIS_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define SPIS_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Register: SPIS_SEMSTAT */ +/* Description: Semaphore status register */ + +/* Bits 1..0 : Semaphore status */ +#define SPIS_SEMSTAT_SEMSTAT_Pos (0UL) /*!< Position of SEMSTAT field. */ +#define SPIS_SEMSTAT_SEMSTAT_Msk (0x3UL << SPIS_SEMSTAT_SEMSTAT_Pos) /*!< Bit mask of SEMSTAT field. */ +#define SPIS_SEMSTAT_SEMSTAT_Free (0UL) /*!< Semaphore is free */ +#define SPIS_SEMSTAT_SEMSTAT_CPU (1UL) /*!< Semaphore is assigned to CPU */ +#define SPIS_SEMSTAT_SEMSTAT_SPIS (2UL) /*!< Semaphore is assigned to SPI slave */ +#define SPIS_SEMSTAT_SEMSTAT_CPUPending (3UL) /*!< Semaphore is assigned to SPI but a handover to the CPU is pending */ + +/* Register: SPIS_STATUS */ +/* Description: Status from last transaction */ + +/* Bit 1 : RX buffer overflow detected, and prevented */ +#define SPIS_STATUS_OVERFLOW_Pos (1UL) /*!< Position of OVERFLOW field. */ +#define SPIS_STATUS_OVERFLOW_Msk (0x1UL << SPIS_STATUS_OVERFLOW_Pos) /*!< Bit mask of OVERFLOW field. */ +#define SPIS_STATUS_OVERFLOW_NotPresent (0UL) /*!< Read: error not present */ +#define SPIS_STATUS_OVERFLOW_Present (1UL) /*!< Read: error present */ +#define SPIS_STATUS_OVERFLOW_Clear (1UL) /*!< Write: clear error on writing '1' */ + +/* Bit 0 : TX buffer over-read detected, and prevented */ +#define SPIS_STATUS_OVERREAD_Pos (0UL) /*!< Position of OVERREAD field. */ +#define SPIS_STATUS_OVERREAD_Msk (0x1UL << SPIS_STATUS_OVERREAD_Pos) /*!< Bit mask of OVERREAD field. */ +#define SPIS_STATUS_OVERREAD_NotPresent (0UL) /*!< Read: error not present */ +#define SPIS_STATUS_OVERREAD_Present (1UL) /*!< Read: error present */ +#define SPIS_STATUS_OVERREAD_Clear (1UL) /*!< Write: clear error on writing '1' */ + +/* Register: SPIS_ENABLE */ +/* Description: Enable SPI slave */ + +/* Bits 3..0 : Enable or disable SPI slave */ +#define SPIS_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPIS_ENABLE_ENABLE_Msk (0xFUL << SPIS_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPIS_ENABLE_ENABLE_Disabled (0UL) /*!< Disable SPI slave */ +#define SPIS_ENABLE_ENABLE_Enabled (2UL) /*!< Enable SPI slave */ + +/* Register: SPIS_PSEL_SCK */ +/* Description: Pin select for SCK */ + +/* Bit 31 : Connection */ +#define SPIS_PSEL_SCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIS_PSEL_SCK_CONNECT_Msk (0x1UL << SPIS_PSEL_SCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIS_PSEL_SCK_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIS_PSEL_SCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define SPIS_PSEL_SCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIS_PSEL_SCK_PIN_Msk (0x1FUL << SPIS_PSEL_SCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIS_PSEL_MISO */ +/* Description: Pin select for MISO signal */ + +/* Bit 31 : Connection */ +#define SPIS_PSEL_MISO_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIS_PSEL_MISO_CONNECT_Msk (0x1UL << SPIS_PSEL_MISO_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIS_PSEL_MISO_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIS_PSEL_MISO_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define SPIS_PSEL_MISO_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIS_PSEL_MISO_PIN_Msk (0x1FUL << SPIS_PSEL_MISO_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIS_PSEL_MOSI */ +/* Description: Pin select for MOSI signal */ + +/* Bit 31 : Connection */ +#define SPIS_PSEL_MOSI_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIS_PSEL_MOSI_CONNECT_Msk (0x1UL << SPIS_PSEL_MOSI_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIS_PSEL_MOSI_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIS_PSEL_MOSI_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define SPIS_PSEL_MOSI_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIS_PSEL_MOSI_PIN_Msk (0x1FUL << SPIS_PSEL_MOSI_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIS_PSEL_CSN */ +/* Description: Pin select for CSN signal */ + +/* Bit 31 : Connection */ +#define SPIS_PSEL_CSN_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIS_PSEL_CSN_CONNECT_Msk (0x1UL << SPIS_PSEL_CSN_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIS_PSEL_CSN_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIS_PSEL_CSN_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define SPIS_PSEL_CSN_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIS_PSEL_CSN_PIN_Msk (0x1FUL << SPIS_PSEL_CSN_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIS_RXD_PTR */ +/* Description: RXD data pointer */ + +/* Bits 31..0 : RXD data pointer */ +#define SPIS_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIS_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIS_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIS_RXD_MAXCNT */ +/* Description: Maximum number of bytes in receive buffer */ + +/* Bits 7..0 : Maximum number of bytes in receive buffer */ +#define SPIS_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIS_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIS_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIS_RXD_AMOUNT */ +/* Description: Number of bytes received in last granted transaction */ + +/* Bits 7..0 : Number of bytes received in the last granted transaction */ +#define SPIS_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIS_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIS_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIS_TXD_PTR */ +/* Description: TXD data pointer */ + +/* Bits 31..0 : TXD data pointer */ +#define SPIS_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIS_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIS_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIS_TXD_MAXCNT */ +/* Description: Maximum number of bytes in transmit buffer */ + +/* Bits 7..0 : Maximum number of bytes in transmit buffer */ +#define SPIS_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIS_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIS_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIS_TXD_AMOUNT */ +/* Description: Number of bytes transmitted in last granted transaction */ + +/* Bits 7..0 : Number of bytes transmitted in last granted transaction */ +#define SPIS_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIS_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIS_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIS_CONFIG */ +/* Description: Configuration register */ + +/* Bit 2 : Serial clock (SCK) polarity */ +#define SPIS_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPIS_CONFIG_CPOL_Msk (0x1UL << SPIS_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPIS_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high */ +#define SPIS_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low */ + +/* Bit 1 : Serial clock (SCK) phase */ +#define SPIS_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPIS_CONFIG_CPHA_Msk (0x1UL << SPIS_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPIS_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of clock, shift serial data on trailing edge */ +#define SPIS_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of clock, shift serial data on leading edge */ + +/* Bit 0 : Bit order */ +#define SPIS_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPIS_CONFIG_ORDER_Msk (0x1UL << SPIS_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPIS_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit shifted out first */ +#define SPIS_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit shifted out first */ + +/* Register: SPIS_DEF */ +/* Description: Default character. Character clocked out in case of an ignored transaction. */ + +/* Bits 7..0 : Default character. Character clocked out in case of an ignored transaction. */ +#define SPIS_DEF_DEF_Pos (0UL) /*!< Position of DEF field. */ +#define SPIS_DEF_DEF_Msk (0xFFUL << SPIS_DEF_DEF_Pos) /*!< Bit mask of DEF field. */ + +/* Register: SPIS_ORC */ +/* Description: Over-read character */ + +/* Bits 7..0 : Over-read character. Character clocked out after an over-read of the transmit buffer. */ +#define SPIS_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ +#define SPIS_ORC_ORC_Msk (0xFFUL << SPIS_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ + + +/* Peripheral: TEMP */ +/* Description: Temperature Sensor */ + +/* Register: TEMP_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 0 : Write '1' to Enable interrupt for DATARDY event */ +#define TEMP_INTENSET_DATARDY_Pos (0UL) /*!< Position of DATARDY field. */ +#define TEMP_INTENSET_DATARDY_Msk (0x1UL << TEMP_INTENSET_DATARDY_Pos) /*!< Bit mask of DATARDY field. */ +#define TEMP_INTENSET_DATARDY_Disabled (0UL) /*!< Read: Disabled */ +#define TEMP_INTENSET_DATARDY_Enabled (1UL) /*!< Read: Enabled */ +#define TEMP_INTENSET_DATARDY_Set (1UL) /*!< Enable */ + +/* Register: TEMP_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 0 : Write '1' to Disable interrupt for DATARDY event */ +#define TEMP_INTENCLR_DATARDY_Pos (0UL) /*!< Position of DATARDY field. */ +#define TEMP_INTENCLR_DATARDY_Msk (0x1UL << TEMP_INTENCLR_DATARDY_Pos) /*!< Bit mask of DATARDY field. */ +#define TEMP_INTENCLR_DATARDY_Disabled (0UL) /*!< Read: Disabled */ +#define TEMP_INTENCLR_DATARDY_Enabled (1UL) /*!< Read: Enabled */ +#define TEMP_INTENCLR_DATARDY_Clear (1UL) /*!< Disable */ + +/* Register: TEMP_TEMP */ +/* Description: Temperature in degC (0.25deg steps) */ + +/* Bits 31..0 : Temperature in degC (0.25deg steps) */ +#define TEMP_TEMP_TEMP_Pos (0UL) /*!< Position of TEMP field. */ +#define TEMP_TEMP_TEMP_Msk (0xFFFFFFFFUL << TEMP_TEMP_TEMP_Pos) /*!< Bit mask of TEMP field. */ + +/* Register: TEMP_A0 */ +/* Description: Slope of 1st piece wise linear function */ + +/* Bits 11..0 : Slope of 1st piece wise linear function */ +#define TEMP_A0_A0_Pos (0UL) /*!< Position of A0 field. */ +#define TEMP_A0_A0_Msk (0xFFFUL << TEMP_A0_A0_Pos) /*!< Bit mask of A0 field. */ + +/* Register: TEMP_A1 */ +/* Description: Slope of 2nd piece wise linear function */ + +/* Bits 11..0 : Slope of 2nd piece wise linear function */ +#define TEMP_A1_A1_Pos (0UL) /*!< Position of A1 field. */ +#define TEMP_A1_A1_Msk (0xFFFUL << TEMP_A1_A1_Pos) /*!< Bit mask of A1 field. */ + +/* Register: TEMP_A2 */ +/* Description: Slope of 3rd piece wise linear function */ + +/* Bits 11..0 : Slope of 3rd piece wise linear function */ +#define TEMP_A2_A2_Pos (0UL) /*!< Position of A2 field. */ +#define TEMP_A2_A2_Msk (0xFFFUL << TEMP_A2_A2_Pos) /*!< Bit mask of A2 field. */ + +/* Register: TEMP_A3 */ +/* Description: Slope of 4th piece wise linear function */ + +/* Bits 11..0 : Slope of 4th piece wise linear function */ +#define TEMP_A3_A3_Pos (0UL) /*!< Position of A3 field. */ +#define TEMP_A3_A3_Msk (0xFFFUL << TEMP_A3_A3_Pos) /*!< Bit mask of A3 field. */ + +/* Register: TEMP_A4 */ +/* Description: Slope of 5th piece wise linear function */ + +/* Bits 11..0 : Slope of 5th piece wise linear function */ +#define TEMP_A4_A4_Pos (0UL) /*!< Position of A4 field. */ +#define TEMP_A4_A4_Msk (0xFFFUL << TEMP_A4_A4_Pos) /*!< Bit mask of A4 field. */ + +/* Register: TEMP_A5 */ +/* Description: Slope of 6th piece wise linear function */ + +/* Bits 11..0 : Slope of 6th piece wise linear function */ +#define TEMP_A5_A5_Pos (0UL) /*!< Position of A5 field. */ +#define TEMP_A5_A5_Msk (0xFFFUL << TEMP_A5_A5_Pos) /*!< Bit mask of A5 field. */ + +/* Register: TEMP_B0 */ +/* Description: y-intercept of 1st piece wise linear function */ + +/* Bits 13..0 : y-intercept of 1st piece wise linear function */ +#define TEMP_B0_B0_Pos (0UL) /*!< Position of B0 field. */ +#define TEMP_B0_B0_Msk (0x3FFFUL << TEMP_B0_B0_Pos) /*!< Bit mask of B0 field. */ + +/* Register: TEMP_B1 */ +/* Description: y-intercept of 2nd piece wise linear function */ + +/* Bits 13..0 : y-intercept of 2nd piece wise linear function */ +#define TEMP_B1_B1_Pos (0UL) /*!< Position of B1 field. */ +#define TEMP_B1_B1_Msk (0x3FFFUL << TEMP_B1_B1_Pos) /*!< Bit mask of B1 field. */ + +/* Register: TEMP_B2 */ +/* Description: y-intercept of 3rd piece wise linear function */ + +/* Bits 13..0 : y-intercept of 3rd piece wise linear function */ +#define TEMP_B2_B2_Pos (0UL) /*!< Position of B2 field. */ +#define TEMP_B2_B2_Msk (0x3FFFUL << TEMP_B2_B2_Pos) /*!< Bit mask of B2 field. */ + +/* Register: TEMP_B3 */ +/* Description: y-intercept of 4th piece wise linear function */ + +/* Bits 13..0 : y-intercept of 4th piece wise linear function */ +#define TEMP_B3_B3_Pos (0UL) /*!< Position of B3 field. */ +#define TEMP_B3_B3_Msk (0x3FFFUL << TEMP_B3_B3_Pos) /*!< Bit mask of B3 field. */ + +/* Register: TEMP_B4 */ +/* Description: y-intercept of 5th piece wise linear function */ + +/* Bits 13..0 : y-intercept of 5th piece wise linear function */ +#define TEMP_B4_B4_Pos (0UL) /*!< Position of B4 field. */ +#define TEMP_B4_B4_Msk (0x3FFFUL << TEMP_B4_B4_Pos) /*!< Bit mask of B4 field. */ + +/* Register: TEMP_B5 */ +/* Description: y-intercept of 6th piece wise linear function */ + +/* Bits 13..0 : y-intercept of 6th piece wise linear function */ +#define TEMP_B5_B5_Pos (0UL) /*!< Position of B5 field. */ +#define TEMP_B5_B5_Msk (0x3FFFUL << TEMP_B5_B5_Pos) /*!< Bit mask of B5 field. */ + +/* Register: TEMP_T0 */ +/* Description: End point of 1st piece wise linear function */ + +/* Bits 7..0 : End point of 1st piece wise linear function */ +#define TEMP_T0_T0_Pos (0UL) /*!< Position of T0 field. */ +#define TEMP_T0_T0_Msk (0xFFUL << TEMP_T0_T0_Pos) /*!< Bit mask of T0 field. */ + +/* Register: TEMP_T1 */ +/* Description: End point of 2nd piece wise linear function */ + +/* Bits 7..0 : End point of 2nd piece wise linear function */ +#define TEMP_T1_T1_Pos (0UL) /*!< Position of T1 field. */ +#define TEMP_T1_T1_Msk (0xFFUL << TEMP_T1_T1_Pos) /*!< Bit mask of T1 field. */ + +/* Register: TEMP_T2 */ +/* Description: End point of 3rd piece wise linear function */ + +/* Bits 7..0 : End point of 3rd piece wise linear function */ +#define TEMP_T2_T2_Pos (0UL) /*!< Position of T2 field. */ +#define TEMP_T2_T2_Msk (0xFFUL << TEMP_T2_T2_Pos) /*!< Bit mask of T2 field. */ + +/* Register: TEMP_T3 */ +/* Description: End point of 4th piece wise linear function */ + +/* Bits 7..0 : End point of 4th piece wise linear function */ +#define TEMP_T3_T3_Pos (0UL) /*!< Position of T3 field. */ +#define TEMP_T3_T3_Msk (0xFFUL << TEMP_T3_T3_Pos) /*!< Bit mask of T3 field. */ + +/* Register: TEMP_T4 */ +/* Description: End point of 5th piece wise linear function */ + +/* Bits 7..0 : End point of 5th piece wise linear function */ +#define TEMP_T4_T4_Pos (0UL) /*!< Position of T4 field. */ +#define TEMP_T4_T4_Msk (0xFFUL << TEMP_T4_T4_Pos) /*!< Bit mask of T4 field. */ + + +/* Peripheral: TIMER */ +/* Description: Timer/Counter 0 */ + +/* Register: TIMER_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 13 : Shortcut between COMPARE[5] event and STOP task */ +#define TIMER_SHORTS_COMPARE5_STOP_Pos (13UL) /*!< Position of COMPARE5_STOP field. */ +#define TIMER_SHORTS_COMPARE5_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE5_STOP_Pos) /*!< Bit mask of COMPARE5_STOP field. */ +#define TIMER_SHORTS_COMPARE5_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE5_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 12 : Shortcut between COMPARE[4] event and STOP task */ +#define TIMER_SHORTS_COMPARE4_STOP_Pos (12UL) /*!< Position of COMPARE4_STOP field. */ +#define TIMER_SHORTS_COMPARE4_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE4_STOP_Pos) /*!< Bit mask of COMPARE4_STOP field. */ +#define TIMER_SHORTS_COMPARE4_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE4_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 11 : Shortcut between COMPARE[3] event and STOP task */ +#define TIMER_SHORTS_COMPARE3_STOP_Pos (11UL) /*!< Position of COMPARE3_STOP field. */ +#define TIMER_SHORTS_COMPARE3_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE3_STOP_Pos) /*!< Bit mask of COMPARE3_STOP field. */ +#define TIMER_SHORTS_COMPARE3_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE3_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 10 : Shortcut between COMPARE[2] event and STOP task */ +#define TIMER_SHORTS_COMPARE2_STOP_Pos (10UL) /*!< Position of COMPARE2_STOP field. */ +#define TIMER_SHORTS_COMPARE2_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE2_STOP_Pos) /*!< Bit mask of COMPARE2_STOP field. */ +#define TIMER_SHORTS_COMPARE2_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE2_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 9 : Shortcut between COMPARE[1] event and STOP task */ +#define TIMER_SHORTS_COMPARE1_STOP_Pos (9UL) /*!< Position of COMPARE1_STOP field. */ +#define TIMER_SHORTS_COMPARE1_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE1_STOP_Pos) /*!< Bit mask of COMPARE1_STOP field. */ +#define TIMER_SHORTS_COMPARE1_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE1_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 8 : Shortcut between COMPARE[0] event and STOP task */ +#define TIMER_SHORTS_COMPARE0_STOP_Pos (8UL) /*!< Position of COMPARE0_STOP field. */ +#define TIMER_SHORTS_COMPARE0_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE0_STOP_Pos) /*!< Bit mask of COMPARE0_STOP field. */ +#define TIMER_SHORTS_COMPARE0_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE0_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 5 : Shortcut between COMPARE[5] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE5_CLEAR_Pos (5UL) /*!< Position of COMPARE5_CLEAR field. */ +#define TIMER_SHORTS_COMPARE5_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE5_CLEAR_Pos) /*!< Bit mask of COMPARE5_CLEAR field. */ +#define TIMER_SHORTS_COMPARE5_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE5_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 4 : Shortcut between COMPARE[4] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE4_CLEAR_Pos (4UL) /*!< Position of COMPARE4_CLEAR field. */ +#define TIMER_SHORTS_COMPARE4_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE4_CLEAR_Pos) /*!< Bit mask of COMPARE4_CLEAR field. */ +#define TIMER_SHORTS_COMPARE4_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE4_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between COMPARE[3] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Pos (3UL) /*!< Position of COMPARE3_CLEAR field. */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE3_CLEAR_Pos) /*!< Bit mask of COMPARE3_CLEAR field. */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between COMPARE[2] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Pos (2UL) /*!< Position of COMPARE2_CLEAR field. */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE2_CLEAR_Pos) /*!< Bit mask of COMPARE2_CLEAR field. */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between COMPARE[1] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Pos (1UL) /*!< Position of COMPARE1_CLEAR field. */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE1_CLEAR_Pos) /*!< Bit mask of COMPARE1_CLEAR field. */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between COMPARE[0] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Pos (0UL) /*!< Position of COMPARE0_CLEAR field. */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE0_CLEAR_Pos) /*!< Bit mask of COMPARE0_CLEAR field. */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: TIMER_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 21 : Write '1' to Enable interrupt for COMPARE[5] event */ +#define TIMER_INTENSET_COMPARE5_Pos (21UL) /*!< Position of COMPARE5 field. */ +#define TIMER_INTENSET_COMPARE5_Msk (0x1UL << TIMER_INTENSET_COMPARE5_Pos) /*!< Bit mask of COMPARE5 field. */ +#define TIMER_INTENSET_COMPARE5_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE5_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE5_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for COMPARE[4] event */ +#define TIMER_INTENSET_COMPARE4_Pos (20UL) /*!< Position of COMPARE4 field. */ +#define TIMER_INTENSET_COMPARE4_Msk (0x1UL << TIMER_INTENSET_COMPARE4_Pos) /*!< Bit mask of COMPARE4 field. */ +#define TIMER_INTENSET_COMPARE4_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE4_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE4_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for COMPARE[3] event */ +#define TIMER_INTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define TIMER_INTENSET_COMPARE3_Msk (0x1UL << TIMER_INTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define TIMER_INTENSET_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE3_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for COMPARE[2] event */ +#define TIMER_INTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define TIMER_INTENSET_COMPARE2_Msk (0x1UL << TIMER_INTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define TIMER_INTENSET_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE2_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for COMPARE[1] event */ +#define TIMER_INTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define TIMER_INTENSET_COMPARE1_Msk (0x1UL << TIMER_INTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define TIMER_INTENSET_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE1_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable interrupt for COMPARE[0] event */ +#define TIMER_INTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define TIMER_INTENSET_COMPARE0_Msk (0x1UL << TIMER_INTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define TIMER_INTENSET_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE0_Set (1UL) /*!< Enable */ + +/* Register: TIMER_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 21 : Write '1' to Disable interrupt for COMPARE[5] event */ +#define TIMER_INTENCLR_COMPARE5_Pos (21UL) /*!< Position of COMPARE5 field. */ +#define TIMER_INTENCLR_COMPARE5_Msk (0x1UL << TIMER_INTENCLR_COMPARE5_Pos) /*!< Bit mask of COMPARE5 field. */ +#define TIMER_INTENCLR_COMPARE5_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE5_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE5_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for COMPARE[4] event */ +#define TIMER_INTENCLR_COMPARE4_Pos (20UL) /*!< Position of COMPARE4 field. */ +#define TIMER_INTENCLR_COMPARE4_Msk (0x1UL << TIMER_INTENCLR_COMPARE4_Pos) /*!< Bit mask of COMPARE4 field. */ +#define TIMER_INTENCLR_COMPARE4_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE4_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE4_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for COMPARE[3] event */ +#define TIMER_INTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define TIMER_INTENCLR_COMPARE3_Msk (0x1UL << TIMER_INTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define TIMER_INTENCLR_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE3_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for COMPARE[2] event */ +#define TIMER_INTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define TIMER_INTENCLR_COMPARE2_Msk (0x1UL << TIMER_INTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define TIMER_INTENCLR_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE2_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for COMPARE[1] event */ +#define TIMER_INTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define TIMER_INTENCLR_COMPARE1_Msk (0x1UL << TIMER_INTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define TIMER_INTENCLR_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE1_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable interrupt for COMPARE[0] event */ +#define TIMER_INTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define TIMER_INTENCLR_COMPARE0_Msk (0x1UL << TIMER_INTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define TIMER_INTENCLR_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE0_Clear (1UL) /*!< Disable */ + +/* Register: TIMER_MODE */ +/* Description: Timer mode selection */ + +/* Bits 1..0 : Timer mode */ +#define TIMER_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define TIMER_MODE_MODE_Msk (0x3UL << TIMER_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define TIMER_MODE_MODE_Timer (0UL) /*!< Select Timer mode */ +#define TIMER_MODE_MODE_Counter (1UL) /*!< Deprecated enumerator - Select Counter mode */ +#define TIMER_MODE_MODE_LowPowerCounter (2UL) /*!< Select Low Power Counter mode */ + +/* Register: TIMER_BITMODE */ +/* Description: Configure the number of bits used by the TIMER */ + +/* Bits 1..0 : Timer bit width */ +#define TIMER_BITMODE_BITMODE_Pos (0UL) /*!< Position of BITMODE field. */ +#define TIMER_BITMODE_BITMODE_Msk (0x3UL << TIMER_BITMODE_BITMODE_Pos) /*!< Bit mask of BITMODE field. */ +#define TIMER_BITMODE_BITMODE_16Bit (0UL) /*!< 16 bit timer bit width */ +#define TIMER_BITMODE_BITMODE_08Bit (1UL) /*!< 8 bit timer bit width */ +#define TIMER_BITMODE_BITMODE_24Bit (2UL) /*!< 24 bit timer bit width */ +#define TIMER_BITMODE_BITMODE_32Bit (3UL) /*!< 32 bit timer bit width */ + +/* Register: TIMER_PRESCALER */ +/* Description: Timer prescaler register */ + +/* Bits 3..0 : Prescaler value */ +#define TIMER_PRESCALER_PRESCALER_Pos (0UL) /*!< Position of PRESCALER field. */ +#define TIMER_PRESCALER_PRESCALER_Msk (0xFUL << TIMER_PRESCALER_PRESCALER_Pos) /*!< Bit mask of PRESCALER field. */ + +/* Register: TIMER_CC */ +/* Description: Description collection[0]: Capture/Compare register 0 */ + +/* Bits 31..0 : Capture/Compare value */ +#define TIMER_CC_CC_Pos (0UL) /*!< Position of CC field. */ +#define TIMER_CC_CC_Msk (0xFFFFFFFFUL << TIMER_CC_CC_Pos) /*!< Bit mask of CC field. */ + + +/* Peripheral: TWI */ +/* Description: I2C compatible Two-Wire Interface 0 */ + +/* Register: TWI_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 1 : Shortcut between BB event and STOP task */ +#define TWI_SHORTS_BB_STOP_Pos (1UL) /*!< Position of BB_STOP field. */ +#define TWI_SHORTS_BB_STOP_Msk (0x1UL << TWI_SHORTS_BB_STOP_Pos) /*!< Bit mask of BB_STOP field. */ +#define TWI_SHORTS_BB_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TWI_SHORTS_BB_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between BB event and SUSPEND task */ +#define TWI_SHORTS_BB_SUSPEND_Pos (0UL) /*!< Position of BB_SUSPEND field. */ +#define TWI_SHORTS_BB_SUSPEND_Msk (0x1UL << TWI_SHORTS_BB_SUSPEND_Pos) /*!< Bit mask of BB_SUSPEND field. */ +#define TWI_SHORTS_BB_SUSPEND_Disabled (0UL) /*!< Disable shortcut */ +#define TWI_SHORTS_BB_SUSPEND_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: TWI_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 18 : Write '1' to Enable interrupt for SUSPENDED event */ +#define TWI_INTENSET_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWI_INTENSET_SUSPENDED_Msk (0x1UL << TWI_INTENSET_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWI_INTENSET_SUSPENDED_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_SUSPENDED_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_SUSPENDED_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for BB event */ +#define TWI_INTENSET_BB_Pos (14UL) /*!< Position of BB field. */ +#define TWI_INTENSET_BB_Msk (0x1UL << TWI_INTENSET_BB_Pos) /*!< Bit mask of BB field. */ +#define TWI_INTENSET_BB_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_BB_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_BB_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define TWI_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWI_INTENSET_ERROR_Msk (0x1UL << TWI_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWI_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for TXDSENT event */ +#define TWI_INTENSET_TXDSENT_Pos (7UL) /*!< Position of TXDSENT field. */ +#define TWI_INTENSET_TXDSENT_Msk (0x1UL << TWI_INTENSET_TXDSENT_Pos) /*!< Bit mask of TXDSENT field. */ +#define TWI_INTENSET_TXDSENT_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_TXDSENT_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_TXDSENT_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for RXDREADY event */ +#define TWI_INTENSET_RXDREADY_Pos (2UL) /*!< Position of RXDREADY field. */ +#define TWI_INTENSET_RXDREADY_Msk (0x1UL << TWI_INTENSET_RXDREADY_Pos) /*!< Bit mask of RXDREADY field. */ +#define TWI_INTENSET_RXDREADY_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_RXDREADY_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_RXDREADY_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define TWI_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWI_INTENSET_STOPPED_Msk (0x1UL << TWI_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWI_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: TWI_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 18 : Write '1' to Disable interrupt for SUSPENDED event */ +#define TWI_INTENCLR_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWI_INTENCLR_SUSPENDED_Msk (0x1UL << TWI_INTENCLR_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWI_INTENCLR_SUSPENDED_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_SUSPENDED_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_SUSPENDED_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for BB event */ +#define TWI_INTENCLR_BB_Pos (14UL) /*!< Position of BB field. */ +#define TWI_INTENCLR_BB_Msk (0x1UL << TWI_INTENCLR_BB_Pos) /*!< Bit mask of BB field. */ +#define TWI_INTENCLR_BB_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_BB_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_BB_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define TWI_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWI_INTENCLR_ERROR_Msk (0x1UL << TWI_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWI_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for TXDSENT event */ +#define TWI_INTENCLR_TXDSENT_Pos (7UL) /*!< Position of TXDSENT field. */ +#define TWI_INTENCLR_TXDSENT_Msk (0x1UL << TWI_INTENCLR_TXDSENT_Pos) /*!< Bit mask of TXDSENT field. */ +#define TWI_INTENCLR_TXDSENT_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_TXDSENT_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_TXDSENT_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for RXDREADY event */ +#define TWI_INTENCLR_RXDREADY_Pos (2UL) /*!< Position of RXDREADY field. */ +#define TWI_INTENCLR_RXDREADY_Msk (0x1UL << TWI_INTENCLR_RXDREADY_Pos) /*!< Bit mask of RXDREADY field. */ +#define TWI_INTENCLR_RXDREADY_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_RXDREADY_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_RXDREADY_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define TWI_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWI_INTENCLR_STOPPED_Msk (0x1UL << TWI_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWI_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: TWI_ERRORSRC */ +/* Description: Error source */ + +/* Bit 2 : NACK received after sending a data byte (write '1' to clear) */ +#define TWI_ERRORSRC_DNACK_Pos (2UL) /*!< Position of DNACK field. */ +#define TWI_ERRORSRC_DNACK_Msk (0x1UL << TWI_ERRORSRC_DNACK_Pos) /*!< Bit mask of DNACK field. */ +#define TWI_ERRORSRC_DNACK_NotPresent (0UL) /*!< Read: error not present */ +#define TWI_ERRORSRC_DNACK_Present (1UL) /*!< Read: error present */ + +/* Bit 1 : NACK received after sending the address (write '1' to clear) */ +#define TWI_ERRORSRC_ANACK_Pos (1UL) /*!< Position of ANACK field. */ +#define TWI_ERRORSRC_ANACK_Msk (0x1UL << TWI_ERRORSRC_ANACK_Pos) /*!< Bit mask of ANACK field. */ +#define TWI_ERRORSRC_ANACK_NotPresent (0UL) /*!< Read: error not present */ +#define TWI_ERRORSRC_ANACK_Present (1UL) /*!< Read: error present */ + +/* Bit 0 : Overrun error */ +#define TWI_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define TWI_ERRORSRC_OVERRUN_Msk (0x1UL << TWI_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define TWI_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Read: no overrun occured */ +#define TWI_ERRORSRC_OVERRUN_Present (1UL) /*!< Read: overrun occured */ + +/* Register: TWI_ENABLE */ +/* Description: Enable TWI */ + +/* Bits 3..0 : Enable or disable TWI */ +#define TWI_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define TWI_ENABLE_ENABLE_Msk (0xFUL << TWI_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define TWI_ENABLE_ENABLE_Disabled (0UL) /*!< Disable TWI */ +#define TWI_ENABLE_ENABLE_Enabled (5UL) /*!< Enable TWI */ + +/* Register: TWI_PSELSCL */ +/* Description: Pin select for SCL */ + +/* Bits 31..0 : Pin number configuration for TWI SCL signal */ +#define TWI_PSELSCL_PSELSCL_Pos (0UL) /*!< Position of PSELSCL field. */ +#define TWI_PSELSCL_PSELSCL_Msk (0xFFFFFFFFUL << TWI_PSELSCL_PSELSCL_Pos) /*!< Bit mask of PSELSCL field. */ +#define TWI_PSELSCL_PSELSCL_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: TWI_PSELSDA */ +/* Description: Pin select for SDA */ + +/* Bits 31..0 : Pin number configuration for TWI SDA signal */ +#define TWI_PSELSDA_PSELSDA_Pos (0UL) /*!< Position of PSELSDA field. */ +#define TWI_PSELSDA_PSELSDA_Msk (0xFFFFFFFFUL << TWI_PSELSDA_PSELSDA_Pos) /*!< Bit mask of PSELSDA field. */ +#define TWI_PSELSDA_PSELSDA_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: TWI_RXD */ +/* Description: RXD register */ + +/* Bits 7..0 : RXD register */ +#define TWI_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define TWI_RXD_RXD_Msk (0xFFUL << TWI_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: TWI_TXD */ +/* Description: TXD register */ + +/* Bits 7..0 : TXD register */ +#define TWI_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define TWI_TXD_TXD_Msk (0xFFUL << TWI_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: TWI_FREQUENCY */ +/* Description: TWI frequency */ + +/* Bits 31..0 : TWI master clock frequency */ +#define TWI_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define TWI_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << TWI_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define TWI_FREQUENCY_FREQUENCY_K100 (0x01980000UL) /*!< 100 kbps */ +#define TWI_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps */ +#define TWI_FREQUENCY_FREQUENCY_K400 (0x06680000UL) /*!< 400 kbps (actual rate 410.256 kbps) */ + +/* Register: TWI_ADDRESS */ +/* Description: Address used in the TWI transfer */ + +/* Bits 6..0 : Address used in the TWI transfer */ +#define TWI_ADDRESS_ADDRESS_Pos (0UL) /*!< Position of ADDRESS field. */ +#define TWI_ADDRESS_ADDRESS_Msk (0x7FUL << TWI_ADDRESS_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ + + +/* Peripheral: TWIM */ +/* Description: I2C compatible Two-Wire Master Interface with EasyDMA 0 */ + +/* Register: TWIM_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 12 : Shortcut between LASTRX event and STOP task */ +#define TWIM_SHORTS_LASTRX_STOP_Pos (12UL) /*!< Position of LASTRX_STOP field. */ +#define TWIM_SHORTS_LASTRX_STOP_Msk (0x1UL << TWIM_SHORTS_LASTRX_STOP_Pos) /*!< Bit mask of LASTRX_STOP field. */ +#define TWIM_SHORTS_LASTRX_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTRX_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 10 : Shortcut between LASTRX event and STARTTX task */ +#define TWIM_SHORTS_LASTRX_STARTTX_Pos (10UL) /*!< Position of LASTRX_STARTTX field. */ +#define TWIM_SHORTS_LASTRX_STARTTX_Msk (0x1UL << TWIM_SHORTS_LASTRX_STARTTX_Pos) /*!< Bit mask of LASTRX_STARTTX field. */ +#define TWIM_SHORTS_LASTRX_STARTTX_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTRX_STARTTX_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 9 : Shortcut between LASTTX event and STOP task */ +#define TWIM_SHORTS_LASTTX_STOP_Pos (9UL) /*!< Position of LASTTX_STOP field. */ +#define TWIM_SHORTS_LASTTX_STOP_Msk (0x1UL << TWIM_SHORTS_LASTTX_STOP_Pos) /*!< Bit mask of LASTTX_STOP field. */ +#define TWIM_SHORTS_LASTTX_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTTX_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 8 : Shortcut between LASTTX event and SUSPEND task */ +#define TWIM_SHORTS_LASTTX_SUSPEND_Pos (8UL) /*!< Position of LASTTX_SUSPEND field. */ +#define TWIM_SHORTS_LASTTX_SUSPEND_Msk (0x1UL << TWIM_SHORTS_LASTTX_SUSPEND_Pos) /*!< Bit mask of LASTTX_SUSPEND field. */ +#define TWIM_SHORTS_LASTTX_SUSPEND_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTTX_SUSPEND_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 7 : Shortcut between LASTTX event and STARTRX task */ +#define TWIM_SHORTS_LASTTX_STARTRX_Pos (7UL) /*!< Position of LASTTX_STARTRX field. */ +#define TWIM_SHORTS_LASTTX_STARTRX_Msk (0x1UL << TWIM_SHORTS_LASTTX_STARTRX_Pos) /*!< Bit mask of LASTTX_STARTRX field. */ +#define TWIM_SHORTS_LASTTX_STARTRX_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTTX_STARTRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: TWIM_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 24 : Enable or disable interrupt for LASTTX event */ +#define TWIM_INTEN_LASTTX_Pos (24UL) /*!< Position of LASTTX field. */ +#define TWIM_INTEN_LASTTX_Msk (0x1UL << TWIM_INTEN_LASTTX_Pos) /*!< Bit mask of LASTTX field. */ +#define TWIM_INTEN_LASTTX_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_LASTTX_Enabled (1UL) /*!< Enable */ + +/* Bit 23 : Enable or disable interrupt for LASTRX event */ +#define TWIM_INTEN_LASTRX_Pos (23UL) /*!< Position of LASTRX field. */ +#define TWIM_INTEN_LASTRX_Msk (0x1UL << TWIM_INTEN_LASTRX_Pos) /*!< Bit mask of LASTRX field. */ +#define TWIM_INTEN_LASTRX_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_LASTRX_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for TXSTARTED event */ +#define TWIM_INTEN_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIM_INTEN_TXSTARTED_Msk (0x1UL << TWIM_INTEN_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIM_INTEN_TXSTARTED_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_TXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for RXSTARTED event */ +#define TWIM_INTEN_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIM_INTEN_RXSTARTED_Msk (0x1UL << TWIM_INTEN_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIM_INTEN_RXSTARTED_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_RXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable interrupt for SUSPENDED event */ +#define TWIM_INTEN_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWIM_INTEN_SUSPENDED_Msk (0x1UL << TWIM_INTEN_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWIM_INTEN_SUSPENDED_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_SUSPENDED_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for ERROR event */ +#define TWIM_INTEN_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIM_INTEN_ERROR_Msk (0x1UL << TWIM_INTEN_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIM_INTEN_ERROR_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_ERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STOPPED event */ +#define TWIM_INTEN_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIM_INTEN_STOPPED_Msk (0x1UL << TWIM_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIM_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Register: TWIM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 24 : Write '1' to Enable interrupt for LASTTX event */ +#define TWIM_INTENSET_LASTTX_Pos (24UL) /*!< Position of LASTTX field. */ +#define TWIM_INTENSET_LASTTX_Msk (0x1UL << TWIM_INTENSET_LASTTX_Pos) /*!< Bit mask of LASTTX field. */ +#define TWIM_INTENSET_LASTTX_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_LASTTX_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_LASTTX_Set (1UL) /*!< Enable */ + +/* Bit 23 : Write '1' to Enable interrupt for LASTRX event */ +#define TWIM_INTENSET_LASTRX_Pos (23UL) /*!< Position of LASTRX field. */ +#define TWIM_INTENSET_LASTRX_Msk (0x1UL << TWIM_INTENSET_LASTRX_Pos) /*!< Bit mask of LASTRX field. */ +#define TWIM_INTENSET_LASTRX_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_LASTRX_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_LASTRX_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for TXSTARTED event */ +#define TWIM_INTENSET_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIM_INTENSET_TXSTARTED_Msk (0x1UL << TWIM_INTENSET_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIM_INTENSET_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_TXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for RXSTARTED event */ +#define TWIM_INTENSET_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIM_INTENSET_RXSTARTED_Msk (0x1UL << TWIM_INTENSET_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIM_INTENSET_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_RXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for SUSPENDED event */ +#define TWIM_INTENSET_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWIM_INTENSET_SUSPENDED_Msk (0x1UL << TWIM_INTENSET_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWIM_INTENSET_SUSPENDED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_SUSPENDED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_SUSPENDED_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define TWIM_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIM_INTENSET_ERROR_Msk (0x1UL << TWIM_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIM_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define TWIM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIM_INTENSET_STOPPED_Msk (0x1UL << TWIM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIM_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: TWIM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 24 : Write '1' to Disable interrupt for LASTTX event */ +#define TWIM_INTENCLR_LASTTX_Pos (24UL) /*!< Position of LASTTX field. */ +#define TWIM_INTENCLR_LASTTX_Msk (0x1UL << TWIM_INTENCLR_LASTTX_Pos) /*!< Bit mask of LASTTX field. */ +#define TWIM_INTENCLR_LASTTX_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_LASTTX_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_LASTTX_Clear (1UL) /*!< Disable */ + +/* Bit 23 : Write '1' to Disable interrupt for LASTRX event */ +#define TWIM_INTENCLR_LASTRX_Pos (23UL) /*!< Position of LASTRX field. */ +#define TWIM_INTENCLR_LASTRX_Msk (0x1UL << TWIM_INTENCLR_LASTRX_Pos) /*!< Bit mask of LASTRX field. */ +#define TWIM_INTENCLR_LASTRX_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_LASTRX_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_LASTRX_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for TXSTARTED event */ +#define TWIM_INTENCLR_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIM_INTENCLR_TXSTARTED_Msk (0x1UL << TWIM_INTENCLR_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIM_INTENCLR_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_TXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for RXSTARTED event */ +#define TWIM_INTENCLR_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIM_INTENCLR_RXSTARTED_Msk (0x1UL << TWIM_INTENCLR_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIM_INTENCLR_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_RXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for SUSPENDED event */ +#define TWIM_INTENCLR_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWIM_INTENCLR_SUSPENDED_Msk (0x1UL << TWIM_INTENCLR_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWIM_INTENCLR_SUSPENDED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_SUSPENDED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_SUSPENDED_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define TWIM_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIM_INTENCLR_ERROR_Msk (0x1UL << TWIM_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIM_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define TWIM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIM_INTENCLR_STOPPED_Msk (0x1UL << TWIM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIM_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: TWIM_ERRORSRC */ +/* Description: Error source */ + +/* Bit 2 : NACK received after sending a data byte (write '1' to clear) */ +#define TWIM_ERRORSRC_DNACK_Pos (2UL) /*!< Position of DNACK field. */ +#define TWIM_ERRORSRC_DNACK_Msk (0x1UL << TWIM_ERRORSRC_DNACK_Pos) /*!< Bit mask of DNACK field. */ +#define TWIM_ERRORSRC_DNACK_NotReceived (0UL) /*!< Error did not occur */ +#define TWIM_ERRORSRC_DNACK_Received (1UL) /*!< Error occurred */ + +/* Bit 1 : NACK received after sending the address (write '1' to clear) */ +#define TWIM_ERRORSRC_ANACK_Pos (1UL) /*!< Position of ANACK field. */ +#define TWIM_ERRORSRC_ANACK_Msk (0x1UL << TWIM_ERRORSRC_ANACK_Pos) /*!< Bit mask of ANACK field. */ +#define TWIM_ERRORSRC_ANACK_NotReceived (0UL) /*!< Error did not occur */ +#define TWIM_ERRORSRC_ANACK_Received (1UL) /*!< Error occurred */ + +/* Register: TWIM_ENABLE */ +/* Description: Enable TWIM */ + +/* Bits 3..0 : Enable or disable TWIM */ +#define TWIM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define TWIM_ENABLE_ENABLE_Msk (0xFUL << TWIM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define TWIM_ENABLE_ENABLE_Disabled (0UL) /*!< Disable TWIM */ +#define TWIM_ENABLE_ENABLE_Enabled (6UL) /*!< Enable TWIM */ + +/* Register: TWIM_PSEL_SCL */ +/* Description: Pin select for SCL signal */ + +/* Bit 31 : Connection */ +#define TWIM_PSEL_SCL_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWIM_PSEL_SCL_CONNECT_Msk (0x1UL << TWIM_PSEL_SCL_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWIM_PSEL_SCL_CONNECT_Connected (0UL) /*!< Connect */ +#define TWIM_PSEL_SCL_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define TWIM_PSEL_SCL_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWIM_PSEL_SCL_PIN_Msk (0x1FUL << TWIM_PSEL_SCL_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWIM_PSEL_SDA */ +/* Description: Pin select for SDA signal */ + +/* Bit 31 : Connection */ +#define TWIM_PSEL_SDA_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWIM_PSEL_SDA_CONNECT_Msk (0x1UL << TWIM_PSEL_SDA_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWIM_PSEL_SDA_CONNECT_Connected (0UL) /*!< Connect */ +#define TWIM_PSEL_SDA_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define TWIM_PSEL_SDA_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWIM_PSEL_SDA_PIN_Msk (0x1FUL << TWIM_PSEL_SDA_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWIM_FREQUENCY */ +/* Description: TWI frequency */ + +/* Bits 31..0 : TWI master clock frequency */ +#define TWIM_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define TWIM_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << TWIM_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define TWIM_FREQUENCY_FREQUENCY_K100 (0x01980000UL) /*!< 100 kbps */ +#define TWIM_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps */ +#define TWIM_FREQUENCY_FREQUENCY_K400 (0x06400000UL) /*!< 400 kbps */ + +/* Register: TWIM_RXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define TWIM_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define TWIM_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << TWIM_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: TWIM_RXD_MAXCNT */ +/* Description: Maximum number of bytes in receive buffer */ + +/* Bits 7..0 : Maximum number of bytes in receive buffer */ +#define TWIM_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define TWIM_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << TWIM_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: TWIM_RXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. */ +#define TWIM_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define TWIM_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << TWIM_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: TWIM_RXD_LIST */ +/* Description: EasyDMA list type */ + +/* Bits 2..0 : List type */ +#define TWIM_RXD_LIST_LIST_Pos (0UL) /*!< Position of LIST field. */ +#define TWIM_RXD_LIST_LIST_Msk (0x7UL << TWIM_RXD_LIST_LIST_Pos) /*!< Bit mask of LIST field. */ +#define TWIM_RXD_LIST_LIST_Disabled (0UL) /*!< Disable EasyDMA list */ +#define TWIM_RXD_LIST_LIST_ArrayList (1UL) /*!< Use array list */ + +/* Register: TWIM_TXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define TWIM_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define TWIM_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << TWIM_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: TWIM_TXD_MAXCNT */ +/* Description: Maximum number of bytes in transmit buffer */ + +/* Bits 7..0 : Maximum number of bytes in transmit buffer */ +#define TWIM_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define TWIM_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << TWIM_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: TWIM_TXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. */ +#define TWIM_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define TWIM_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << TWIM_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: TWIM_TXD_LIST */ +/* Description: EasyDMA list type */ + +/* Bits 2..0 : List type */ +#define TWIM_TXD_LIST_LIST_Pos (0UL) /*!< Position of LIST field. */ +#define TWIM_TXD_LIST_LIST_Msk (0x7UL << TWIM_TXD_LIST_LIST_Pos) /*!< Bit mask of LIST field. */ +#define TWIM_TXD_LIST_LIST_Disabled (0UL) /*!< Disable EasyDMA list */ +#define TWIM_TXD_LIST_LIST_ArrayList (1UL) /*!< Use array list */ + +/* Register: TWIM_ADDRESS */ +/* Description: Address used in the TWI transfer */ + +/* Bits 6..0 : Address used in the TWI transfer */ +#define TWIM_ADDRESS_ADDRESS_Pos (0UL) /*!< Position of ADDRESS field. */ +#define TWIM_ADDRESS_ADDRESS_Msk (0x7FUL << TWIM_ADDRESS_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ + + +/* Peripheral: TWIS */ +/* Description: I2C compatible Two-Wire Slave Interface with EasyDMA 0 */ + +/* Register: TWIS_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 14 : Shortcut between READ event and SUSPEND task */ +#define TWIS_SHORTS_READ_SUSPEND_Pos (14UL) /*!< Position of READ_SUSPEND field. */ +#define TWIS_SHORTS_READ_SUSPEND_Msk (0x1UL << TWIS_SHORTS_READ_SUSPEND_Pos) /*!< Bit mask of READ_SUSPEND field. */ +#define TWIS_SHORTS_READ_SUSPEND_Disabled (0UL) /*!< Disable shortcut */ +#define TWIS_SHORTS_READ_SUSPEND_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 13 : Shortcut between WRITE event and SUSPEND task */ +#define TWIS_SHORTS_WRITE_SUSPEND_Pos (13UL) /*!< Position of WRITE_SUSPEND field. */ +#define TWIS_SHORTS_WRITE_SUSPEND_Msk (0x1UL << TWIS_SHORTS_WRITE_SUSPEND_Pos) /*!< Bit mask of WRITE_SUSPEND field. */ +#define TWIS_SHORTS_WRITE_SUSPEND_Disabled (0UL) /*!< Disable shortcut */ +#define TWIS_SHORTS_WRITE_SUSPEND_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: TWIS_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 26 : Enable or disable interrupt for READ event */ +#define TWIS_INTEN_READ_Pos (26UL) /*!< Position of READ field. */ +#define TWIS_INTEN_READ_Msk (0x1UL << TWIS_INTEN_READ_Pos) /*!< Bit mask of READ field. */ +#define TWIS_INTEN_READ_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_READ_Enabled (1UL) /*!< Enable */ + +/* Bit 25 : Enable or disable interrupt for WRITE event */ +#define TWIS_INTEN_WRITE_Pos (25UL) /*!< Position of WRITE field. */ +#define TWIS_INTEN_WRITE_Msk (0x1UL << TWIS_INTEN_WRITE_Pos) /*!< Bit mask of WRITE field. */ +#define TWIS_INTEN_WRITE_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_WRITE_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for TXSTARTED event */ +#define TWIS_INTEN_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIS_INTEN_TXSTARTED_Msk (0x1UL << TWIS_INTEN_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIS_INTEN_TXSTARTED_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_TXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for RXSTARTED event */ +#define TWIS_INTEN_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIS_INTEN_RXSTARTED_Msk (0x1UL << TWIS_INTEN_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIS_INTEN_RXSTARTED_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_RXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for ERROR event */ +#define TWIS_INTEN_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIS_INTEN_ERROR_Msk (0x1UL << TWIS_INTEN_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIS_INTEN_ERROR_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_ERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STOPPED event */ +#define TWIS_INTEN_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIS_INTEN_STOPPED_Msk (0x1UL << TWIS_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIS_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Register: TWIS_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 26 : Write '1' to Enable interrupt for READ event */ +#define TWIS_INTENSET_READ_Pos (26UL) /*!< Position of READ field. */ +#define TWIS_INTENSET_READ_Msk (0x1UL << TWIS_INTENSET_READ_Pos) /*!< Bit mask of READ field. */ +#define TWIS_INTENSET_READ_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_READ_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_READ_Set (1UL) /*!< Enable */ + +/* Bit 25 : Write '1' to Enable interrupt for WRITE event */ +#define TWIS_INTENSET_WRITE_Pos (25UL) /*!< Position of WRITE field. */ +#define TWIS_INTENSET_WRITE_Msk (0x1UL << TWIS_INTENSET_WRITE_Pos) /*!< Bit mask of WRITE field. */ +#define TWIS_INTENSET_WRITE_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_WRITE_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_WRITE_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for TXSTARTED event */ +#define TWIS_INTENSET_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIS_INTENSET_TXSTARTED_Msk (0x1UL << TWIS_INTENSET_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIS_INTENSET_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_TXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for RXSTARTED event */ +#define TWIS_INTENSET_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIS_INTENSET_RXSTARTED_Msk (0x1UL << TWIS_INTENSET_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIS_INTENSET_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_RXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define TWIS_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIS_INTENSET_ERROR_Msk (0x1UL << TWIS_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIS_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define TWIS_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIS_INTENSET_STOPPED_Msk (0x1UL << TWIS_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIS_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: TWIS_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 26 : Write '1' to Disable interrupt for READ event */ +#define TWIS_INTENCLR_READ_Pos (26UL) /*!< Position of READ field. */ +#define TWIS_INTENCLR_READ_Msk (0x1UL << TWIS_INTENCLR_READ_Pos) /*!< Bit mask of READ field. */ +#define TWIS_INTENCLR_READ_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_READ_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_READ_Clear (1UL) /*!< Disable */ + +/* Bit 25 : Write '1' to Disable interrupt for WRITE event */ +#define TWIS_INTENCLR_WRITE_Pos (25UL) /*!< Position of WRITE field. */ +#define TWIS_INTENCLR_WRITE_Msk (0x1UL << TWIS_INTENCLR_WRITE_Pos) /*!< Bit mask of WRITE field. */ +#define TWIS_INTENCLR_WRITE_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_WRITE_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_WRITE_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for TXSTARTED event */ +#define TWIS_INTENCLR_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIS_INTENCLR_TXSTARTED_Msk (0x1UL << TWIS_INTENCLR_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIS_INTENCLR_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_TXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for RXSTARTED event */ +#define TWIS_INTENCLR_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIS_INTENCLR_RXSTARTED_Msk (0x1UL << TWIS_INTENCLR_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIS_INTENCLR_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_RXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define TWIS_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIS_INTENCLR_ERROR_Msk (0x1UL << TWIS_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIS_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define TWIS_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIS_INTENCLR_STOPPED_Msk (0x1UL << TWIS_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIS_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: TWIS_ERRORSRC */ +/* Description: Error source */ + +/* Bit 3 : TX buffer over-read detected, and prevented */ +#define TWIS_ERRORSRC_OVERREAD_Pos (3UL) /*!< Position of OVERREAD field. */ +#define TWIS_ERRORSRC_OVERREAD_Msk (0x1UL << TWIS_ERRORSRC_OVERREAD_Pos) /*!< Bit mask of OVERREAD field. */ +#define TWIS_ERRORSRC_OVERREAD_NotDetected (0UL) /*!< Error did not occur */ +#define TWIS_ERRORSRC_OVERREAD_Detected (1UL) /*!< Error occurred */ + +/* Bit 2 : NACK sent after receiving a data byte */ +#define TWIS_ERRORSRC_DNACK_Pos (2UL) /*!< Position of DNACK field. */ +#define TWIS_ERRORSRC_DNACK_Msk (0x1UL << TWIS_ERRORSRC_DNACK_Pos) /*!< Bit mask of DNACK field. */ +#define TWIS_ERRORSRC_DNACK_NotReceived (0UL) /*!< Error did not occur */ +#define TWIS_ERRORSRC_DNACK_Received (1UL) /*!< Error occurred */ + +/* Bit 0 : RX buffer overflow detected, and prevented */ +#define TWIS_ERRORSRC_OVERFLOW_Pos (0UL) /*!< Position of OVERFLOW field. */ +#define TWIS_ERRORSRC_OVERFLOW_Msk (0x1UL << TWIS_ERRORSRC_OVERFLOW_Pos) /*!< Bit mask of OVERFLOW field. */ +#define TWIS_ERRORSRC_OVERFLOW_NotDetected (0UL) /*!< Error did not occur */ +#define TWIS_ERRORSRC_OVERFLOW_Detected (1UL) /*!< Error occurred */ + +/* Register: TWIS_MATCH */ +/* Description: Status register indicating which address had a match */ + +/* Bit 0 : Which of the addresses in {ADDRESS} matched the incoming address */ +#define TWIS_MATCH_MATCH_Pos (0UL) /*!< Position of MATCH field. */ +#define TWIS_MATCH_MATCH_Msk (0x1UL << TWIS_MATCH_MATCH_Pos) /*!< Bit mask of MATCH field. */ + +/* Register: TWIS_ENABLE */ +/* Description: Enable TWIS */ + +/* Bits 3..0 : Enable or disable TWIS */ +#define TWIS_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define TWIS_ENABLE_ENABLE_Msk (0xFUL << TWIS_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define TWIS_ENABLE_ENABLE_Disabled (0UL) /*!< Disable TWIS */ +#define TWIS_ENABLE_ENABLE_Enabled (9UL) /*!< Enable TWIS */ + +/* Register: TWIS_PSEL_SCL */ +/* Description: Pin select for SCL signal */ + +/* Bit 31 : Connection */ +#define TWIS_PSEL_SCL_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWIS_PSEL_SCL_CONNECT_Msk (0x1UL << TWIS_PSEL_SCL_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWIS_PSEL_SCL_CONNECT_Connected (0UL) /*!< Connect */ +#define TWIS_PSEL_SCL_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define TWIS_PSEL_SCL_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWIS_PSEL_SCL_PIN_Msk (0x1FUL << TWIS_PSEL_SCL_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWIS_PSEL_SDA */ +/* Description: Pin select for SDA signal */ + +/* Bit 31 : Connection */ +#define TWIS_PSEL_SDA_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWIS_PSEL_SDA_CONNECT_Msk (0x1UL << TWIS_PSEL_SDA_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWIS_PSEL_SDA_CONNECT_Connected (0UL) /*!< Connect */ +#define TWIS_PSEL_SDA_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define TWIS_PSEL_SDA_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWIS_PSEL_SDA_PIN_Msk (0x1FUL << TWIS_PSEL_SDA_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWIS_RXD_PTR */ +/* Description: RXD Data pointer */ + +/* Bits 31..0 : RXD Data pointer */ +#define TWIS_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define TWIS_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << TWIS_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: TWIS_RXD_MAXCNT */ +/* Description: Maximum number of bytes in RXD buffer */ + +/* Bits 7..0 : Maximum number of bytes in RXD buffer */ +#define TWIS_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define TWIS_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << TWIS_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: TWIS_RXD_AMOUNT */ +/* Description: Number of bytes transferred in the last RXD transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last RXD transaction */ +#define TWIS_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define TWIS_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << TWIS_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: TWIS_TXD_PTR */ +/* Description: TXD Data pointer */ + +/* Bits 31..0 : TXD Data pointer */ +#define TWIS_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define TWIS_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << TWIS_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: TWIS_TXD_MAXCNT */ +/* Description: Maximum number of bytes in TXD buffer */ + +/* Bits 7..0 : Maximum number of bytes in TXD buffer */ +#define TWIS_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define TWIS_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << TWIS_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: TWIS_TXD_AMOUNT */ +/* Description: Number of bytes transferred in the last TXD transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last TXD transaction */ +#define TWIS_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define TWIS_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << TWIS_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: TWIS_ADDRESS */ +/* Description: Description collection[0]: TWI slave address 0 */ + +/* Bits 6..0 : TWI slave address */ +#define TWIS_ADDRESS_ADDRESS_Pos (0UL) /*!< Position of ADDRESS field. */ +#define TWIS_ADDRESS_ADDRESS_Msk (0x7FUL << TWIS_ADDRESS_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ + +/* Register: TWIS_CONFIG */ +/* Description: Configuration register for the address match mechanism */ + +/* Bit 1 : Enable or disable address matching on ADDRESS[1] */ +#define TWIS_CONFIG_ADDRESS1_Pos (1UL) /*!< Position of ADDRESS1 field. */ +#define TWIS_CONFIG_ADDRESS1_Msk (0x1UL << TWIS_CONFIG_ADDRESS1_Pos) /*!< Bit mask of ADDRESS1 field. */ +#define TWIS_CONFIG_ADDRESS1_Disabled (0UL) /*!< Disabled */ +#define TWIS_CONFIG_ADDRESS1_Enabled (1UL) /*!< Enabled */ + +/* Bit 0 : Enable or disable address matching on ADDRESS[0] */ +#define TWIS_CONFIG_ADDRESS0_Pos (0UL) /*!< Position of ADDRESS0 field. */ +#define TWIS_CONFIG_ADDRESS0_Msk (0x1UL << TWIS_CONFIG_ADDRESS0_Pos) /*!< Bit mask of ADDRESS0 field. */ +#define TWIS_CONFIG_ADDRESS0_Disabled (0UL) /*!< Disabled */ +#define TWIS_CONFIG_ADDRESS0_Enabled (1UL) /*!< Enabled */ + +/* Register: TWIS_ORC */ +/* Description: Over-read character. Character sent out in case of an over-read of the transmit buffer. */ + +/* Bits 7..0 : Over-read character. Character sent out in case of an over-read of the transmit buffer. */ +#define TWIS_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ +#define TWIS_ORC_ORC_Msk (0xFFUL << TWIS_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ + + +/* Peripheral: UART */ +/* Description: Universal Asynchronous Receiver/Transmitter */ + +/* Register: UART_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between NCTS event and STOPRX task */ +#define UART_SHORTS_NCTS_STOPRX_Pos (4UL) /*!< Position of NCTS_STOPRX field. */ +#define UART_SHORTS_NCTS_STOPRX_Msk (0x1UL << UART_SHORTS_NCTS_STOPRX_Pos) /*!< Bit mask of NCTS_STOPRX field. */ +#define UART_SHORTS_NCTS_STOPRX_Disabled (0UL) /*!< Disable shortcut */ +#define UART_SHORTS_NCTS_STOPRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between CTS event and STARTRX task */ +#define UART_SHORTS_CTS_STARTRX_Pos (3UL) /*!< Position of CTS_STARTRX field. */ +#define UART_SHORTS_CTS_STARTRX_Msk (0x1UL << UART_SHORTS_CTS_STARTRX_Pos) /*!< Bit mask of CTS_STARTRX field. */ +#define UART_SHORTS_CTS_STARTRX_Disabled (0UL) /*!< Disable shortcut */ +#define UART_SHORTS_CTS_STARTRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: UART_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 17 : Write '1' to Enable interrupt for RXTO event */ +#define UART_INTENSET_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UART_INTENSET_RXTO_Msk (0x1UL << UART_INTENSET_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UART_INTENSET_RXTO_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_RXTO_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_RXTO_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define UART_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UART_INTENSET_ERROR_Msk (0x1UL << UART_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UART_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for TXDRDY event */ +#define UART_INTENSET_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UART_INTENSET_TXDRDY_Msk (0x1UL << UART_INTENSET_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UART_INTENSET_TXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_TXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_TXDRDY_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for RXDRDY event */ +#define UART_INTENSET_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UART_INTENSET_RXDRDY_Msk (0x1UL << UART_INTENSET_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UART_INTENSET_RXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_RXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_RXDRDY_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for NCTS event */ +#define UART_INTENSET_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UART_INTENSET_NCTS_Msk (0x1UL << UART_INTENSET_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UART_INTENSET_NCTS_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_NCTS_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_NCTS_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for CTS event */ +#define UART_INTENSET_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UART_INTENSET_CTS_Msk (0x1UL << UART_INTENSET_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UART_INTENSET_CTS_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_CTS_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_CTS_Set (1UL) /*!< Enable */ + +/* Register: UART_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 17 : Write '1' to Disable interrupt for RXTO event */ +#define UART_INTENCLR_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UART_INTENCLR_RXTO_Msk (0x1UL << UART_INTENCLR_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UART_INTENCLR_RXTO_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_RXTO_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_RXTO_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define UART_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UART_INTENCLR_ERROR_Msk (0x1UL << UART_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UART_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for TXDRDY event */ +#define UART_INTENCLR_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UART_INTENCLR_TXDRDY_Msk (0x1UL << UART_INTENCLR_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UART_INTENCLR_TXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_TXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_TXDRDY_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for RXDRDY event */ +#define UART_INTENCLR_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UART_INTENCLR_RXDRDY_Msk (0x1UL << UART_INTENCLR_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UART_INTENCLR_RXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_RXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_RXDRDY_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for NCTS event */ +#define UART_INTENCLR_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UART_INTENCLR_NCTS_Msk (0x1UL << UART_INTENCLR_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UART_INTENCLR_NCTS_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_NCTS_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_NCTS_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for CTS event */ +#define UART_INTENCLR_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UART_INTENCLR_CTS_Msk (0x1UL << UART_INTENCLR_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UART_INTENCLR_CTS_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_CTS_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_CTS_Clear (1UL) /*!< Disable */ + +/* Register: UART_ERRORSRC */ +/* Description: Error source */ + +/* Bit 3 : Break condition */ +#define UART_ERRORSRC_BREAK_Pos (3UL) /*!< Position of BREAK field. */ +#define UART_ERRORSRC_BREAK_Msk (0x1UL << UART_ERRORSRC_BREAK_Pos) /*!< Bit mask of BREAK field. */ +#define UART_ERRORSRC_BREAK_NotPresent (0UL) /*!< Read: error not present */ +#define UART_ERRORSRC_BREAK_Present (1UL) /*!< Read: error present */ + +/* Bit 2 : Framing error occurred */ +#define UART_ERRORSRC_FRAMING_Pos (2UL) /*!< Position of FRAMING field. */ +#define UART_ERRORSRC_FRAMING_Msk (0x1UL << UART_ERRORSRC_FRAMING_Pos) /*!< Bit mask of FRAMING field. */ +#define UART_ERRORSRC_FRAMING_NotPresent (0UL) /*!< Read: error not present */ +#define UART_ERRORSRC_FRAMING_Present (1UL) /*!< Read: error present */ + +/* Bit 1 : Parity error */ +#define UART_ERRORSRC_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UART_ERRORSRC_PARITY_Msk (0x1UL << UART_ERRORSRC_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UART_ERRORSRC_PARITY_NotPresent (0UL) /*!< Read: error not present */ +#define UART_ERRORSRC_PARITY_Present (1UL) /*!< Read: error present */ + +/* Bit 0 : Overrun error */ +#define UART_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define UART_ERRORSRC_OVERRUN_Msk (0x1UL << UART_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define UART_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Read: error not present */ +#define UART_ERRORSRC_OVERRUN_Present (1UL) /*!< Read: error present */ + +/* Register: UART_ENABLE */ +/* Description: Enable UART */ + +/* Bits 3..0 : Enable or disable UART */ +#define UART_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define UART_ENABLE_ENABLE_Msk (0xFUL << UART_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define UART_ENABLE_ENABLE_Disabled (0UL) /*!< Disable UART */ +#define UART_ENABLE_ENABLE_Enabled (4UL) /*!< Enable UART */ + +/* Register: UART_PSELRTS */ +/* Description: Pin select for RTS */ + +/* Bits 31..0 : Pin number configuration for UART RTS signal */ +#define UART_PSELRTS_PSELRTS_Pos (0UL) /*!< Position of PSELRTS field. */ +#define UART_PSELRTS_PSELRTS_Msk (0xFFFFFFFFUL << UART_PSELRTS_PSELRTS_Pos) /*!< Bit mask of PSELRTS field. */ +#define UART_PSELRTS_PSELRTS_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: UART_PSELTXD */ +/* Description: Pin select for TXD */ + +/* Bits 31..0 : Pin number configuration for UART TXD signal */ +#define UART_PSELTXD_PSELTXD_Pos (0UL) /*!< Position of PSELTXD field. */ +#define UART_PSELTXD_PSELTXD_Msk (0xFFFFFFFFUL << UART_PSELTXD_PSELTXD_Pos) /*!< Bit mask of PSELTXD field. */ +#define UART_PSELTXD_PSELTXD_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: UART_PSELCTS */ +/* Description: Pin select for CTS */ + +/* Bits 31..0 : Pin number configuration for UART CTS signal */ +#define UART_PSELCTS_PSELCTS_Pos (0UL) /*!< Position of PSELCTS field. */ +#define UART_PSELCTS_PSELCTS_Msk (0xFFFFFFFFUL << UART_PSELCTS_PSELCTS_Pos) /*!< Bit mask of PSELCTS field. */ +#define UART_PSELCTS_PSELCTS_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: UART_PSELRXD */ +/* Description: Pin select for RXD */ + +/* Bits 31..0 : Pin number configuration for UART RXD signal */ +#define UART_PSELRXD_PSELRXD_Pos (0UL) /*!< Position of PSELRXD field. */ +#define UART_PSELRXD_PSELRXD_Msk (0xFFFFFFFFUL << UART_PSELRXD_PSELRXD_Pos) /*!< Bit mask of PSELRXD field. */ +#define UART_PSELRXD_PSELRXD_Disconnected (0xFFFFFFFFUL) /*!< Disconnect */ + +/* Register: UART_RXD */ +/* Description: RXD register */ + +/* Bits 7..0 : RX data received in previous transfers, double buffered */ +#define UART_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define UART_RXD_RXD_Msk (0xFFUL << UART_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: UART_TXD */ +/* Description: TXD register */ + +/* Bits 7..0 : TX data to be transferred */ +#define UART_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define UART_TXD_TXD_Msk (0xFFUL << UART_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: UART_BAUDRATE */ +/* Description: Baud rate */ + +/* Bits 31..0 : Baud-rate */ +#define UART_BAUDRATE_BAUDRATE_Pos (0UL) /*!< Position of BAUDRATE field. */ +#define UART_BAUDRATE_BAUDRATE_Msk (0xFFFFFFFFUL << UART_BAUDRATE_BAUDRATE_Pos) /*!< Bit mask of BAUDRATE field. */ +#define UART_BAUDRATE_BAUDRATE_Baud1200 (0x0004F000UL) /*!< 1200 baud (actual rate: 1205) */ +#define UART_BAUDRATE_BAUDRATE_Baud2400 (0x0009D000UL) /*!< 2400 baud (actual rate: 2396) */ +#define UART_BAUDRATE_BAUDRATE_Baud4800 (0x0013B000UL) /*!< 4800 baud (actual rate: 4808) */ +#define UART_BAUDRATE_BAUDRATE_Baud9600 (0x00275000UL) /*!< 9600 baud (actual rate: 9598) */ +#define UART_BAUDRATE_BAUDRATE_Baud14400 (0x003B0000UL) /*!< 14400 baud (actual rate: 14414) */ +#define UART_BAUDRATE_BAUDRATE_Baud19200 (0x004EA000UL) /*!< 19200 baud (actual rate: 19208) */ +#define UART_BAUDRATE_BAUDRATE_Baud28800 (0x0075F000UL) /*!< 28800 baud (actual rate: 28829) */ +#define UART_BAUDRATE_BAUDRATE_Baud38400 (0x009D5000UL) /*!< 38400 baud (actual rate: 38462) */ +#define UART_BAUDRATE_BAUDRATE_Baud57600 (0x00EBF000UL) /*!< 57600 baud (actual rate: 57762) */ +#define UART_BAUDRATE_BAUDRATE_Baud76800 (0x013A9000UL) /*!< 76800 baud (actual rate: 76923) */ +#define UART_BAUDRATE_BAUDRATE_Baud115200 (0x01D7E000UL) /*!< 115200 baud (actual rate: 115942) */ +#define UART_BAUDRATE_BAUDRATE_Baud230400 (0x03AFB000UL) /*!< 230400 baud (actual rate: 231884) */ +#define UART_BAUDRATE_BAUDRATE_Baud250000 (0x04000000UL) /*!< 250000 baud */ +#define UART_BAUDRATE_BAUDRATE_Baud460800 (0x075F7000UL) /*!< 460800 baud (actual rate: 470588) */ +#define UART_BAUDRATE_BAUDRATE_Baud921600 (0x0EBED000UL) /*!< 921600 baud (actual rate: 941176) */ +#define UART_BAUDRATE_BAUDRATE_Baud1M (0x10000000UL) /*!< 1Mega baud */ + +/* Register: UART_CONFIG */ +/* Description: Configuration of parity and hardware flow control */ + +/* Bits 3..1 : Parity */ +#define UART_CONFIG_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UART_CONFIG_PARITY_Msk (0x7UL << UART_CONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UART_CONFIG_PARITY_Excluded (0x0UL) /*!< Exclude parity bit */ +#define UART_CONFIG_PARITY_Included (0x7UL) /*!< Include parity bit */ + +/* Bit 0 : Hardware flow control */ +#define UART_CONFIG_HWFC_Pos (0UL) /*!< Position of HWFC field. */ +#define UART_CONFIG_HWFC_Msk (0x1UL << UART_CONFIG_HWFC_Pos) /*!< Bit mask of HWFC field. */ +#define UART_CONFIG_HWFC_Disabled (0UL) /*!< Disabled */ +#define UART_CONFIG_HWFC_Enabled (1UL) /*!< Enabled */ + + +/* Peripheral: UARTE */ +/* Description: UART with EasyDMA */ + +/* Register: UARTE_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 6 : Shortcut between ENDRX event and STOPRX task */ +#define UARTE_SHORTS_ENDRX_STOPRX_Pos (6UL) /*!< Position of ENDRX_STOPRX field. */ +#define UARTE_SHORTS_ENDRX_STOPRX_Msk (0x1UL << UARTE_SHORTS_ENDRX_STOPRX_Pos) /*!< Bit mask of ENDRX_STOPRX field. */ +#define UARTE_SHORTS_ENDRX_STOPRX_Disabled (0UL) /*!< Disable shortcut */ +#define UARTE_SHORTS_ENDRX_STOPRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 5 : Shortcut between ENDRX event and STARTRX task */ +#define UARTE_SHORTS_ENDRX_STARTRX_Pos (5UL) /*!< Position of ENDRX_STARTRX field. */ +#define UARTE_SHORTS_ENDRX_STARTRX_Msk (0x1UL << UARTE_SHORTS_ENDRX_STARTRX_Pos) /*!< Bit mask of ENDRX_STARTRX field. */ +#define UARTE_SHORTS_ENDRX_STARTRX_Disabled (0UL) /*!< Disable shortcut */ +#define UARTE_SHORTS_ENDRX_STARTRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: UARTE_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 22 : Enable or disable interrupt for TXSTOPPED event */ +#define UARTE_INTEN_TXSTOPPED_Pos (22UL) /*!< Position of TXSTOPPED field. */ +#define UARTE_INTEN_TXSTOPPED_Msk (0x1UL << UARTE_INTEN_TXSTOPPED_Pos) /*!< Bit mask of TXSTOPPED field. */ +#define UARTE_INTEN_TXSTOPPED_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_TXSTOPPED_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for TXSTARTED event */ +#define UARTE_INTEN_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define UARTE_INTEN_TXSTARTED_Msk (0x1UL << UARTE_INTEN_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define UARTE_INTEN_TXSTARTED_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_TXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for RXSTARTED event */ +#define UARTE_INTEN_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define UARTE_INTEN_RXSTARTED_Msk (0x1UL << UARTE_INTEN_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define UARTE_INTEN_RXSTARTED_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_RXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 17 : Enable or disable interrupt for RXTO event */ +#define UARTE_INTEN_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UARTE_INTEN_RXTO_Msk (0x1UL << UARTE_INTEN_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UARTE_INTEN_RXTO_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_RXTO_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for ERROR event */ +#define UARTE_INTEN_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UARTE_INTEN_ERROR_Msk (0x1UL << UARTE_INTEN_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UARTE_INTEN_ERROR_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_ERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 8 : Enable or disable interrupt for ENDTX event */ +#define UARTE_INTEN_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define UARTE_INTEN_ENDTX_Msk (0x1UL << UARTE_INTEN_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define UARTE_INTEN_ENDTX_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_ENDTX_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for ENDRX event */ +#define UARTE_INTEN_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define UARTE_INTEN_ENDRX_Msk (0x1UL << UARTE_INTEN_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define UARTE_INTEN_ENDRX_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_ENDRX_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for NCTS event */ +#define UARTE_INTEN_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UARTE_INTEN_NCTS_Msk (0x1UL << UARTE_INTEN_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UARTE_INTEN_NCTS_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_NCTS_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for CTS event */ +#define UARTE_INTEN_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UARTE_INTEN_CTS_Msk (0x1UL << UARTE_INTEN_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UARTE_INTEN_CTS_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_CTS_Enabled (1UL) /*!< Enable */ + +/* Register: UARTE_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 22 : Write '1' to Enable interrupt for TXSTOPPED event */ +#define UARTE_INTENSET_TXSTOPPED_Pos (22UL) /*!< Position of TXSTOPPED field. */ +#define UARTE_INTENSET_TXSTOPPED_Msk (0x1UL << UARTE_INTENSET_TXSTOPPED_Pos) /*!< Bit mask of TXSTOPPED field. */ +#define UARTE_INTENSET_TXSTOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_TXSTOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_TXSTOPPED_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for TXSTARTED event */ +#define UARTE_INTENSET_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define UARTE_INTENSET_TXSTARTED_Msk (0x1UL << UARTE_INTENSET_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define UARTE_INTENSET_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_TXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for RXSTARTED event */ +#define UARTE_INTENSET_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define UARTE_INTENSET_RXSTARTED_Msk (0x1UL << UARTE_INTENSET_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define UARTE_INTENSET_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_RXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for RXTO event */ +#define UARTE_INTENSET_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UARTE_INTENSET_RXTO_Msk (0x1UL << UARTE_INTENSET_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UARTE_INTENSET_RXTO_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_RXTO_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_RXTO_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define UARTE_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UARTE_INTENSET_ERROR_Msk (0x1UL << UARTE_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UARTE_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for ENDTX event */ +#define UARTE_INTENSET_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define UARTE_INTENSET_ENDTX_Msk (0x1UL << UARTE_INTENSET_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define UARTE_INTENSET_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_ENDTX_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for ENDRX event */ +#define UARTE_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define UARTE_INTENSET_ENDRX_Msk (0x1UL << UARTE_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define UARTE_INTENSET_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_ENDRX_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for NCTS event */ +#define UARTE_INTENSET_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UARTE_INTENSET_NCTS_Msk (0x1UL << UARTE_INTENSET_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UARTE_INTENSET_NCTS_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_NCTS_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_NCTS_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for CTS event */ +#define UARTE_INTENSET_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UARTE_INTENSET_CTS_Msk (0x1UL << UARTE_INTENSET_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UARTE_INTENSET_CTS_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_CTS_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_CTS_Set (1UL) /*!< Enable */ + +/* Register: UARTE_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 22 : Write '1' to Disable interrupt for TXSTOPPED event */ +#define UARTE_INTENCLR_TXSTOPPED_Pos (22UL) /*!< Position of TXSTOPPED field. */ +#define UARTE_INTENCLR_TXSTOPPED_Msk (0x1UL << UARTE_INTENCLR_TXSTOPPED_Pos) /*!< Bit mask of TXSTOPPED field. */ +#define UARTE_INTENCLR_TXSTOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_TXSTOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_TXSTOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for TXSTARTED event */ +#define UARTE_INTENCLR_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define UARTE_INTENCLR_TXSTARTED_Msk (0x1UL << UARTE_INTENCLR_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define UARTE_INTENCLR_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_TXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for RXSTARTED event */ +#define UARTE_INTENCLR_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define UARTE_INTENCLR_RXSTARTED_Msk (0x1UL << UARTE_INTENCLR_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define UARTE_INTENCLR_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_RXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for RXTO event */ +#define UARTE_INTENCLR_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UARTE_INTENCLR_RXTO_Msk (0x1UL << UARTE_INTENCLR_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UARTE_INTENCLR_RXTO_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_RXTO_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_RXTO_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define UARTE_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UARTE_INTENCLR_ERROR_Msk (0x1UL << UARTE_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UARTE_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for ENDTX event */ +#define UARTE_INTENCLR_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define UARTE_INTENCLR_ENDTX_Msk (0x1UL << UARTE_INTENCLR_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define UARTE_INTENCLR_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_ENDTX_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for ENDRX event */ +#define UARTE_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define UARTE_INTENCLR_ENDRX_Msk (0x1UL << UARTE_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define UARTE_INTENCLR_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for NCTS event */ +#define UARTE_INTENCLR_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UARTE_INTENCLR_NCTS_Msk (0x1UL << UARTE_INTENCLR_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UARTE_INTENCLR_NCTS_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_NCTS_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_NCTS_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for CTS event */ +#define UARTE_INTENCLR_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UARTE_INTENCLR_CTS_Msk (0x1UL << UARTE_INTENCLR_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UARTE_INTENCLR_CTS_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_CTS_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_CTS_Clear (1UL) /*!< Disable */ + +/* Register: UARTE_ERRORSRC */ +/* Description: Error source */ + +/* Bit 3 : Break condition */ +#define UARTE_ERRORSRC_BREAK_Pos (3UL) /*!< Position of BREAK field. */ +#define UARTE_ERRORSRC_BREAK_Msk (0x1UL << UARTE_ERRORSRC_BREAK_Pos) /*!< Bit mask of BREAK field. */ +#define UARTE_ERRORSRC_BREAK_NotPresent (0UL) /*!< Read: error not present */ +#define UARTE_ERRORSRC_BREAK_Present (1UL) /*!< Read: error present */ + +/* Bit 2 : Framing error occurred */ +#define UARTE_ERRORSRC_FRAMING_Pos (2UL) /*!< Position of FRAMING field. */ +#define UARTE_ERRORSRC_FRAMING_Msk (0x1UL << UARTE_ERRORSRC_FRAMING_Pos) /*!< Bit mask of FRAMING field. */ +#define UARTE_ERRORSRC_FRAMING_NotPresent (0UL) /*!< Read: error not present */ +#define UARTE_ERRORSRC_FRAMING_Present (1UL) /*!< Read: error present */ + +/* Bit 1 : Parity error */ +#define UARTE_ERRORSRC_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UARTE_ERRORSRC_PARITY_Msk (0x1UL << UARTE_ERRORSRC_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UARTE_ERRORSRC_PARITY_NotPresent (0UL) /*!< Read: error not present */ +#define UARTE_ERRORSRC_PARITY_Present (1UL) /*!< Read: error present */ + +/* Bit 0 : Overrun error */ +#define UARTE_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define UARTE_ERRORSRC_OVERRUN_Msk (0x1UL << UARTE_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define UARTE_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Read: error not present */ +#define UARTE_ERRORSRC_OVERRUN_Present (1UL) /*!< Read: error present */ + +/* Register: UARTE_ENABLE */ +/* Description: Enable UART */ + +/* Bits 3..0 : Enable or disable UARTE */ +#define UARTE_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define UARTE_ENABLE_ENABLE_Msk (0xFUL << UARTE_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define UARTE_ENABLE_ENABLE_Disabled (0UL) /*!< Disable UARTE */ +#define UARTE_ENABLE_ENABLE_Enabled (8UL) /*!< Enable UARTE */ + +/* Register: UARTE_PSEL_RTS */ +/* Description: Pin select for RTS signal */ + +/* Bit 31 : Connection */ +#define UARTE_PSEL_RTS_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UARTE_PSEL_RTS_CONNECT_Msk (0x1UL << UARTE_PSEL_RTS_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UARTE_PSEL_RTS_CONNECT_Connected (0UL) /*!< Connect */ +#define UARTE_PSEL_RTS_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define UARTE_PSEL_RTS_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UARTE_PSEL_RTS_PIN_Msk (0x1FUL << UARTE_PSEL_RTS_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UARTE_PSEL_TXD */ +/* Description: Pin select for TXD signal */ + +/* Bit 31 : Connection */ +#define UARTE_PSEL_TXD_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UARTE_PSEL_TXD_CONNECT_Msk (0x1UL << UARTE_PSEL_TXD_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UARTE_PSEL_TXD_CONNECT_Connected (0UL) /*!< Connect */ +#define UARTE_PSEL_TXD_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define UARTE_PSEL_TXD_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UARTE_PSEL_TXD_PIN_Msk (0x1FUL << UARTE_PSEL_TXD_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UARTE_PSEL_CTS */ +/* Description: Pin select for CTS signal */ + +/* Bit 31 : Connection */ +#define UARTE_PSEL_CTS_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UARTE_PSEL_CTS_CONNECT_Msk (0x1UL << UARTE_PSEL_CTS_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UARTE_PSEL_CTS_CONNECT_Connected (0UL) /*!< Connect */ +#define UARTE_PSEL_CTS_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define UARTE_PSEL_CTS_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UARTE_PSEL_CTS_PIN_Msk (0x1FUL << UARTE_PSEL_CTS_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UARTE_PSEL_RXD */ +/* Description: Pin select for RXD signal */ + +/* Bit 31 : Connection */ +#define UARTE_PSEL_RXD_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UARTE_PSEL_RXD_CONNECT_Msk (0x1UL << UARTE_PSEL_RXD_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UARTE_PSEL_RXD_CONNECT_Connected (0UL) /*!< Connect */ +#define UARTE_PSEL_RXD_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : Pin number */ +#define UARTE_PSEL_RXD_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UARTE_PSEL_RXD_PIN_Msk (0x1FUL << UARTE_PSEL_RXD_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UARTE_BAUDRATE */ +/* Description: Baud rate */ + +/* Bits 31..0 : Baud-rate */ +#define UARTE_BAUDRATE_BAUDRATE_Pos (0UL) /*!< Position of BAUDRATE field. */ +#define UARTE_BAUDRATE_BAUDRATE_Msk (0xFFFFFFFFUL << UARTE_BAUDRATE_BAUDRATE_Pos) /*!< Bit mask of BAUDRATE field. */ +#define UARTE_BAUDRATE_BAUDRATE_Baud1200 (0x0004F000UL) /*!< 1200 baud (actual rate: 1205) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud2400 (0x0009D000UL) /*!< 2400 baud (actual rate: 2396) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud4800 (0x0013B000UL) /*!< 4800 baud (actual rate: 4808) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud9600 (0x00275000UL) /*!< 9600 baud (actual rate: 9598) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud14400 (0x003AF000UL) /*!< 14400 baud (actual rate: 14401) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud19200 (0x004EA000UL) /*!< 19200 baud (actual rate: 19208) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud28800 (0x0075C000UL) /*!< 28800 baud (actual rate: 28777) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud38400 (0x009D0000UL) /*!< 38400 baud (actual rate: 38369) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud57600 (0x00EB0000UL) /*!< 57600 baud (actual rate: 57554) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud76800 (0x013A9000UL) /*!< 76800 baud (actual rate: 76923) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud115200 (0x01D60000UL) /*!< 115200 baud (actual rate: 115108) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud230400 (0x03B00000UL) /*!< 230400 baud (actual rate: 231884) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud250000 (0x04000000UL) /*!< 250000 baud */ +#define UARTE_BAUDRATE_BAUDRATE_Baud460800 (0x07400000UL) /*!< 460800 baud (actual rate: 457143) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud921600 (0x0F000000UL) /*!< 921600 baud (actual rate: 941176) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud1M (0x10000000UL) /*!< 1Mega baud */ + +/* Register: UARTE_RXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define UARTE_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define UARTE_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << UARTE_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: UARTE_RXD_MAXCNT */ +/* Description: Maximum number of bytes in receive buffer */ + +/* Bits 7..0 : Maximum number of bytes in receive buffer */ +#define UARTE_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define UARTE_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << UARTE_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: UARTE_RXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last transaction */ +#define UARTE_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define UARTE_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << UARTE_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: UARTE_TXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define UARTE_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define UARTE_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << UARTE_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: UARTE_TXD_MAXCNT */ +/* Description: Maximum number of bytes in transmit buffer */ + +/* Bits 7..0 : Maximum number of bytes in transmit buffer */ +#define UARTE_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define UARTE_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << UARTE_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: UARTE_TXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last transaction */ +#define UARTE_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define UARTE_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << UARTE_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: UARTE_CONFIG */ +/* Description: Configuration of parity and hardware flow control */ + +/* Bits 3..1 : Parity */ +#define UARTE_CONFIG_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UARTE_CONFIG_PARITY_Msk (0x7UL << UARTE_CONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UARTE_CONFIG_PARITY_Excluded (0x0UL) /*!< Exclude parity bit */ +#define UARTE_CONFIG_PARITY_Included (0x7UL) /*!< Include parity bit */ + +/* Bit 0 : Hardware flow control */ +#define UARTE_CONFIG_HWFC_Pos (0UL) /*!< Position of HWFC field. */ +#define UARTE_CONFIG_HWFC_Msk (0x1UL << UARTE_CONFIG_HWFC_Pos) /*!< Bit mask of HWFC field. */ +#define UARTE_CONFIG_HWFC_Disabled (0UL) /*!< Disabled */ +#define UARTE_CONFIG_HWFC_Enabled (1UL) /*!< Enabled */ + + +/* Peripheral: UICR */ +/* Description: User Information Configuration Registers */ + +/* Register: UICR_NRFFW */ +/* Description: Description collection[0]: Reserved for Nordic firmware design */ + +/* Bits 31..0 : Reserved for Nordic firmware design */ +#define UICR_NRFFW_NRFFW_Pos (0UL) /*!< Position of NRFFW field. */ +#define UICR_NRFFW_NRFFW_Msk (0xFFFFFFFFUL << UICR_NRFFW_NRFFW_Pos) /*!< Bit mask of NRFFW field. */ + +/* Register: UICR_NRFHW */ +/* Description: Description collection[0]: Reserved for Nordic hardware design */ + +/* Bits 31..0 : Reserved for Nordic hardware design */ +#define UICR_NRFHW_NRFHW_Pos (0UL) /*!< Position of NRFHW field. */ +#define UICR_NRFHW_NRFHW_Msk (0xFFFFFFFFUL << UICR_NRFHW_NRFHW_Pos) /*!< Bit mask of NRFHW field. */ + +/* Register: UICR_CUSTOMER */ +/* Description: Description collection[0]: Reserved for customer */ + +/* Bits 31..0 : Reserved for customer */ +#define UICR_CUSTOMER_CUSTOMER_Pos (0UL) /*!< Position of CUSTOMER field. */ +#define UICR_CUSTOMER_CUSTOMER_Msk (0xFFFFFFFFUL << UICR_CUSTOMER_CUSTOMER_Pos) /*!< Bit mask of CUSTOMER field. */ + +/* Register: UICR_PSELRESET */ +/* Description: Description collection[0]: Mapping of the nRESET function (see POWER chapter for details) */ + +/* Bit 31 : Connection */ +#define UICR_PSELRESET_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UICR_PSELRESET_CONNECT_Msk (0x1UL << UICR_PSELRESET_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UICR_PSELRESET_CONNECT_Connected (0UL) /*!< Connect */ +#define UICR_PSELRESET_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 4..0 : GPIO number P0.n onto which Reset is exposed */ +#define UICR_PSELRESET_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UICR_PSELRESET_PIN_Msk (0x1FUL << UICR_PSELRESET_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UICR_APPROTECT */ +/* Description: Access Port protection */ + +/* Bits 7..0 : Enable or disable Access Port protection. */ +#define UICR_APPROTECT_PALL_Pos (0UL) /*!< Position of PALL field. */ +#define UICR_APPROTECT_PALL_Msk (0xFFUL << UICR_APPROTECT_PALL_Pos) /*!< Bit mask of PALL field. */ +#define UICR_APPROTECT_PALL_Enabled (0x00UL) /*!< Enable */ +#define UICR_APPROTECT_PALL_Disabled (0xFFUL) /*!< Disable */ + +/* Register: UICR_NFCPINS */ +/* Description: Setting of pins dedicated to NFC functionality: NFC antenna or GPIO */ + +/* Bit 0 : Setting of pins dedicated to NFC functionality */ +#define UICR_NFCPINS_PROTECT_Pos (0UL) /*!< Position of PROTECT field. */ +#define UICR_NFCPINS_PROTECT_Msk (0x1UL << UICR_NFCPINS_PROTECT_Pos) /*!< Bit mask of PROTECT field. */ +#define UICR_NFCPINS_PROTECT_Disabled (0UL) /*!< Operation as GPIO pins. Same protection as normal GPIO pins */ +#define UICR_NFCPINS_PROTECT_NFC (1UL) /*!< Operation as NFC antenna pins. Configures the protection for NFC operation */ + + +/* Peripheral: WDT */ +/* Description: Watchdog Timer */ + +/* Register: WDT_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 0 : Write '1' to Enable interrupt for TIMEOUT event */ +#define WDT_INTENSET_TIMEOUT_Pos (0UL) /*!< Position of TIMEOUT field. */ +#define WDT_INTENSET_TIMEOUT_Msk (0x1UL << WDT_INTENSET_TIMEOUT_Pos) /*!< Bit mask of TIMEOUT field. */ +#define WDT_INTENSET_TIMEOUT_Disabled (0UL) /*!< Read: Disabled */ +#define WDT_INTENSET_TIMEOUT_Enabled (1UL) /*!< Read: Enabled */ +#define WDT_INTENSET_TIMEOUT_Set (1UL) /*!< Enable */ + +/* Register: WDT_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 0 : Write '1' to Disable interrupt for TIMEOUT event */ +#define WDT_INTENCLR_TIMEOUT_Pos (0UL) /*!< Position of TIMEOUT field. */ +#define WDT_INTENCLR_TIMEOUT_Msk (0x1UL << WDT_INTENCLR_TIMEOUT_Pos) /*!< Bit mask of TIMEOUT field. */ +#define WDT_INTENCLR_TIMEOUT_Disabled (0UL) /*!< Read: Disabled */ +#define WDT_INTENCLR_TIMEOUT_Enabled (1UL) /*!< Read: Enabled */ +#define WDT_INTENCLR_TIMEOUT_Clear (1UL) /*!< Disable */ + +/* Register: WDT_RUNSTATUS */ +/* Description: Run status */ + +/* Bit 0 : Indicates whether or not the watchdog is running */ +#define WDT_RUNSTATUS_RUNSTATUS_Pos (0UL) /*!< Position of RUNSTATUS field. */ +#define WDT_RUNSTATUS_RUNSTATUS_Msk (0x1UL << WDT_RUNSTATUS_RUNSTATUS_Pos) /*!< Bit mask of RUNSTATUS field. */ +#define WDT_RUNSTATUS_RUNSTATUS_NotRunning (0UL) /*!< Watchdog not running */ +#define WDT_RUNSTATUS_RUNSTATUS_Running (1UL) /*!< Watchdog is running */ + +/* Register: WDT_REQSTATUS */ +/* Description: Request status */ + +/* Bit 7 : Request status for RR[7] register */ +#define WDT_REQSTATUS_RR7_Pos (7UL) /*!< Position of RR7 field. */ +#define WDT_REQSTATUS_RR7_Msk (0x1UL << WDT_REQSTATUS_RR7_Pos) /*!< Bit mask of RR7 field. */ +#define WDT_REQSTATUS_RR7_DisabledOrRequested (0UL) /*!< RR[7] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR7_EnabledAndUnrequested (1UL) /*!< RR[7] register is enabled, and are not yet requesting reload */ + +/* Bit 6 : Request status for RR[6] register */ +#define WDT_REQSTATUS_RR6_Pos (6UL) /*!< Position of RR6 field. */ +#define WDT_REQSTATUS_RR6_Msk (0x1UL << WDT_REQSTATUS_RR6_Pos) /*!< Bit mask of RR6 field. */ +#define WDT_REQSTATUS_RR6_DisabledOrRequested (0UL) /*!< RR[6] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR6_EnabledAndUnrequested (1UL) /*!< RR[6] register is enabled, and are not yet requesting reload */ + +/* Bit 5 : Request status for RR[5] register */ +#define WDT_REQSTATUS_RR5_Pos (5UL) /*!< Position of RR5 field. */ +#define WDT_REQSTATUS_RR5_Msk (0x1UL << WDT_REQSTATUS_RR5_Pos) /*!< Bit mask of RR5 field. */ +#define WDT_REQSTATUS_RR5_DisabledOrRequested (0UL) /*!< RR[5] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR5_EnabledAndUnrequested (1UL) /*!< RR[5] register is enabled, and are not yet requesting reload */ + +/* Bit 4 : Request status for RR[4] register */ +#define WDT_REQSTATUS_RR4_Pos (4UL) /*!< Position of RR4 field. */ +#define WDT_REQSTATUS_RR4_Msk (0x1UL << WDT_REQSTATUS_RR4_Pos) /*!< Bit mask of RR4 field. */ +#define WDT_REQSTATUS_RR4_DisabledOrRequested (0UL) /*!< RR[4] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR4_EnabledAndUnrequested (1UL) /*!< RR[4] register is enabled, and are not yet requesting reload */ + +/* Bit 3 : Request status for RR[3] register */ +#define WDT_REQSTATUS_RR3_Pos (3UL) /*!< Position of RR3 field. */ +#define WDT_REQSTATUS_RR3_Msk (0x1UL << WDT_REQSTATUS_RR3_Pos) /*!< Bit mask of RR3 field. */ +#define WDT_REQSTATUS_RR3_DisabledOrRequested (0UL) /*!< RR[3] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR3_EnabledAndUnrequested (1UL) /*!< RR[3] register is enabled, and are not yet requesting reload */ + +/* Bit 2 : Request status for RR[2] register */ +#define WDT_REQSTATUS_RR2_Pos (2UL) /*!< Position of RR2 field. */ +#define WDT_REQSTATUS_RR2_Msk (0x1UL << WDT_REQSTATUS_RR2_Pos) /*!< Bit mask of RR2 field. */ +#define WDT_REQSTATUS_RR2_DisabledOrRequested (0UL) /*!< RR[2] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR2_EnabledAndUnrequested (1UL) /*!< RR[2] register is enabled, and are not yet requesting reload */ + +/* Bit 1 : Request status for RR[1] register */ +#define WDT_REQSTATUS_RR1_Pos (1UL) /*!< Position of RR1 field. */ +#define WDT_REQSTATUS_RR1_Msk (0x1UL << WDT_REQSTATUS_RR1_Pos) /*!< Bit mask of RR1 field. */ +#define WDT_REQSTATUS_RR1_DisabledOrRequested (0UL) /*!< RR[1] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR1_EnabledAndUnrequested (1UL) /*!< RR[1] register is enabled, and are not yet requesting reload */ + +/* Bit 0 : Request status for RR[0] register */ +#define WDT_REQSTATUS_RR0_Pos (0UL) /*!< Position of RR0 field. */ +#define WDT_REQSTATUS_RR0_Msk (0x1UL << WDT_REQSTATUS_RR0_Pos) /*!< Bit mask of RR0 field. */ +#define WDT_REQSTATUS_RR0_DisabledOrRequested (0UL) /*!< RR[0] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR0_EnabledAndUnrequested (1UL) /*!< RR[0] register is enabled, and are not yet requesting reload */ + +/* Register: WDT_CRV */ +/* Description: Counter reload value */ + +/* Bits 31..0 : Counter reload value in number of cycles of the 32.768 kHz clock */ +#define WDT_CRV_CRV_Pos (0UL) /*!< Position of CRV field. */ +#define WDT_CRV_CRV_Msk (0xFFFFFFFFUL << WDT_CRV_CRV_Pos) /*!< Bit mask of CRV field. */ + +/* Register: WDT_RREN */ +/* Description: Enable register for reload request registers */ + +/* Bit 7 : Enable or disable RR[7] register */ +#define WDT_RREN_RR7_Pos (7UL) /*!< Position of RR7 field. */ +#define WDT_RREN_RR7_Msk (0x1UL << WDT_RREN_RR7_Pos) /*!< Bit mask of RR7 field. */ +#define WDT_RREN_RR7_Disabled (0UL) /*!< Disable RR[7] register */ +#define WDT_RREN_RR7_Enabled (1UL) /*!< Enable RR[7] register */ + +/* Bit 6 : Enable or disable RR[6] register */ +#define WDT_RREN_RR6_Pos (6UL) /*!< Position of RR6 field. */ +#define WDT_RREN_RR6_Msk (0x1UL << WDT_RREN_RR6_Pos) /*!< Bit mask of RR6 field. */ +#define WDT_RREN_RR6_Disabled (0UL) /*!< Disable RR[6] register */ +#define WDT_RREN_RR6_Enabled (1UL) /*!< Enable RR[6] register */ + +/* Bit 5 : Enable or disable RR[5] register */ +#define WDT_RREN_RR5_Pos (5UL) /*!< Position of RR5 field. */ +#define WDT_RREN_RR5_Msk (0x1UL << WDT_RREN_RR5_Pos) /*!< Bit mask of RR5 field. */ +#define WDT_RREN_RR5_Disabled (0UL) /*!< Disable RR[5] register */ +#define WDT_RREN_RR5_Enabled (1UL) /*!< Enable RR[5] register */ + +/* Bit 4 : Enable or disable RR[4] register */ +#define WDT_RREN_RR4_Pos (4UL) /*!< Position of RR4 field. */ +#define WDT_RREN_RR4_Msk (0x1UL << WDT_RREN_RR4_Pos) /*!< Bit mask of RR4 field. */ +#define WDT_RREN_RR4_Disabled (0UL) /*!< Disable RR[4] register */ +#define WDT_RREN_RR4_Enabled (1UL) /*!< Enable RR[4] register */ + +/* Bit 3 : Enable or disable RR[3] register */ +#define WDT_RREN_RR3_Pos (3UL) /*!< Position of RR3 field. */ +#define WDT_RREN_RR3_Msk (0x1UL << WDT_RREN_RR3_Pos) /*!< Bit mask of RR3 field. */ +#define WDT_RREN_RR3_Disabled (0UL) /*!< Disable RR[3] register */ +#define WDT_RREN_RR3_Enabled (1UL) /*!< Enable RR[3] register */ + +/* Bit 2 : Enable or disable RR[2] register */ +#define WDT_RREN_RR2_Pos (2UL) /*!< Position of RR2 field. */ +#define WDT_RREN_RR2_Msk (0x1UL << WDT_RREN_RR2_Pos) /*!< Bit mask of RR2 field. */ +#define WDT_RREN_RR2_Disabled (0UL) /*!< Disable RR[2] register */ +#define WDT_RREN_RR2_Enabled (1UL) /*!< Enable RR[2] register */ + +/* Bit 1 : Enable or disable RR[1] register */ +#define WDT_RREN_RR1_Pos (1UL) /*!< Position of RR1 field. */ +#define WDT_RREN_RR1_Msk (0x1UL << WDT_RREN_RR1_Pos) /*!< Bit mask of RR1 field. */ +#define WDT_RREN_RR1_Disabled (0UL) /*!< Disable RR[1] register */ +#define WDT_RREN_RR1_Enabled (1UL) /*!< Enable RR[1] register */ + +/* Bit 0 : Enable or disable RR[0] register */ +#define WDT_RREN_RR0_Pos (0UL) /*!< Position of RR0 field. */ +#define WDT_RREN_RR0_Msk (0x1UL << WDT_RREN_RR0_Pos) /*!< Bit mask of RR0 field. */ +#define WDT_RREN_RR0_Disabled (0UL) /*!< Disable RR[0] register */ +#define WDT_RREN_RR0_Enabled (1UL) /*!< Enable RR[0] register */ + +/* Register: WDT_CONFIG */ +/* Description: Configuration register */ + +/* Bit 3 : Configure the watchdog to either be paused, or kept running, while the CPU is halted by the debugger */ +#define WDT_CONFIG_HALT_Pos (3UL) /*!< Position of HALT field. */ +#define WDT_CONFIG_HALT_Msk (0x1UL << WDT_CONFIG_HALT_Pos) /*!< Bit mask of HALT field. */ +#define WDT_CONFIG_HALT_Pause (0UL) /*!< Pause watchdog while the CPU is halted by the debugger */ +#define WDT_CONFIG_HALT_Run (1UL) /*!< Keep the watchdog running while the CPU is halted by the debugger */ + +/* Bit 0 : Configure the watchdog to either be paused, or kept running, while the CPU is sleeping */ +#define WDT_CONFIG_SLEEP_Pos (0UL) /*!< Position of SLEEP field. */ +#define WDT_CONFIG_SLEEP_Msk (0x1UL << WDT_CONFIG_SLEEP_Pos) /*!< Bit mask of SLEEP field. */ +#define WDT_CONFIG_SLEEP_Pause (0UL) /*!< Pause watchdog while the CPU is sleeping */ +#define WDT_CONFIG_SLEEP_Run (1UL) /*!< Keep the watchdog running while the CPU is sleeping */ + +/* Register: WDT_RR */ +/* Description: Description collection[0]: Reload request 0 */ + +/* Bits 31..0 : Reload request register */ +#define WDT_RR_RR_Pos (0UL) /*!< Position of RR field. */ +#define WDT_RR_RR_Msk (0xFFFFFFFFUL << WDT_RR_RR_Pos) /*!< Bit mask of RR field. */ +#define WDT_RR_RR_Reload (0x6E524635UL) /*!< Value to request a reload of the watchdog timer */ + + +/*lint --flb "Leave library region" */ +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_name_change.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_name_change.h new file mode 100644 index 0000000000..7f362a8fd9 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_name_change.h @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF52_NAME_CHANGE_H +#define NRF52_NAME_CHANGE_H + +/*lint ++flb "Enter library region */ + +/* This file is given to prevent your SW from not compiling with the updates made to nrf52.h and + * nrf52_bitfields.h. The macros defined in this file were available previously. Do not use these + * macros on purpose. Use the ones defined in nrf52.h and nrf52_bitfields.h instead. + */ + +/* I2S */ +/* Several enumerations changed case. Adding old macros to keep compilation compatibility. */ +#define I2S_ENABLE_ENABLE_DISABLE I2S_ENABLE_ENABLE_Disabled +#define I2S_ENABLE_ENABLE_ENABLE I2S_ENABLE_ENABLE_Enabled +#define I2S_CONFIG_MODE_MODE_MASTER I2S_CONFIG_MODE_MODE_Master +#define I2S_CONFIG_MODE_MODE_SLAVE I2S_CONFIG_MODE_MODE_Slave +#define I2S_CONFIG_RXEN_RXEN_DISABLE I2S_CONFIG_RXEN_RXEN_Disabled +#define I2S_CONFIG_RXEN_RXEN_ENABLE I2S_CONFIG_RXEN_RXEN_Enabled +#define I2S_CONFIG_TXEN_TXEN_DISABLE I2S_CONFIG_TXEN_TXEN_Disabled +#define I2S_CONFIG_TXEN_TXEN_ENABLE I2S_CONFIG_TXEN_TXEN_Enabled +#define I2S_CONFIG_MCKEN_MCKEN_DISABLE I2S_CONFIG_MCKEN_MCKEN_Disabled +#define I2S_CONFIG_MCKEN_MCKEN_ENABLE I2S_CONFIG_MCKEN_MCKEN_Enabled +#define I2S_CONFIG_SWIDTH_SWIDTH_8BIT I2S_CONFIG_SWIDTH_SWIDTH_8Bit +#define I2S_CONFIG_SWIDTH_SWIDTH_16BIT I2S_CONFIG_SWIDTH_SWIDTH_16Bit +#define I2S_CONFIG_SWIDTH_SWIDTH_24BIT I2S_CONFIG_SWIDTH_SWIDTH_24Bit +#define I2S_CONFIG_ALIGN_ALIGN_LEFT I2S_CONFIG_ALIGN_ALIGN_Left +#define I2S_CONFIG_ALIGN_ALIGN_RIGHT I2S_CONFIG_ALIGN_ALIGN_Right +#define I2S_CONFIG_FORMAT_FORMAT_ALIGNED I2S_CONFIG_FORMAT_FORMAT_Aligned +#define I2S_CONFIG_CHANNELS_CHANNELS_STEREO I2S_CONFIG_CHANNELS_CHANNELS_Stereo +#define I2S_CONFIG_CHANNELS_CHANNELS_LEFT I2S_CONFIG_CHANNELS_CHANNELS_Left +#define I2S_CONFIG_CHANNELS_CHANNELS_RIGHT I2S_CONFIG_CHANNELS_CHANNELS_Right + + + + + +/*lint --flb "Leave library region" */ + +#endif /* NRF52_NAME_CHANGE_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.c new file mode 100644 index 0000000000..5d5c843f8d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.c @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ble_flash.h" +#include +#include +#include +#include "nrf_soc.h" +#include "nordic_common.h" +#include "nrf_error.h" +#include "nrf.h" +#include "app_util.h" + + +static volatile bool m_radio_active = false; /**< TRUE if radio is active (or about to become active), FALSE otherwise. */ + + +uint16_t ble_flash_crc16_compute(uint8_t * p_data, uint16_t size, uint16_t * p_crc) +{ + uint16_t i; + uint16_t crc = (p_crc == NULL) ? 0xffff : *p_crc; + + for (i = 0; i < size; i++) + { + crc = (unsigned char)(crc >> 8) | (crc << 8); + crc ^= p_data[i]; + crc ^= (unsigned char)(crc & 0xff) >> 4; + crc ^= (crc << 8) << 4; + crc ^= ((crc & 0xff) << 4) << 1; + } + return crc; +} + + +/**@brief Function for erasing a page in flash. + * + * @param[in] p_page Pointer to first word in page to be erased. + */ +static void flash_page_erase(uint32_t * p_page) +{ + // Turn on flash erase enable and wait until the NVMC is ready. + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing. + } + + // Erase page. + NRF_NVMC->ERASEPAGE = (uint32_t)p_page; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing. + } + + // Turn off flash erase enable and wait until the NVMC is ready. + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing + } +} + + +/**@brief Function for writing one word to flash. Unprotected write, which can interfere with radio communication. + * + * @details This function DOES NOT use the m_radio_active variable, but will force the write even + * when the radio is active. To be used only from @ref ble_flash_page_write. + * + * @note Flash location to be written must have been erased previously. + * + * @param[in] p_address Pointer to flash location to be written. + * @param[in] value Value to write to flash. + */ +static void flash_word_unprotected_write(uint32_t * p_address, uint32_t value) +{ + // Turn on flash write enable and wait until the NVMC is ready. + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing. + } + *p_address = value; + + // Wait flash write to finish + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing. + } + + // Turn off flash write enable and wait until the NVMC is ready. + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing. + } +} + + +/**@brief Function for writing one word to flash. + * + * @note Flash location to be written must have been erased previously. + * + * @param[in] p_address Pointer to flash location to be written. + * @param[in] value Value to write to flash. + */ +static void flash_word_write(uint32_t * p_address, uint32_t value) +{ + // If radio is active, wait for it to become inactive. + while (m_radio_active) + { + // Do nothing (just wait for radio to become inactive). + (void) sd_app_evt_wait(); + } + + // Turn on flash write enable and wait until the NVMC is ready. + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing. + } + + *p_address = value; + // Wait flash write to finish + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing. + } + // Turn off flash write enable and wait until the NVMC is ready. + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + // Do nothing + } +} + + +uint32_t ble_flash_word_write(uint32_t * p_address, uint32_t value) +{ + flash_word_write(p_address, value); + return NRF_SUCCESS; +} + + +uint32_t ble_flash_block_write(uint32_t * p_address, uint32_t * p_in_array, uint16_t word_count) +{ + uint16_t i; + + for (i = 0; i < word_count; i++) + { + flash_word_write(p_address, p_in_array[i]); + p_address++; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_flash_page_erase(uint8_t page_num) +{ + uint32_t * p_page = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num); + flash_page_erase(p_page); + + return NRF_SUCCESS; +} + + +uint32_t ble_flash_page_write(uint8_t page_num, uint32_t * p_in_array, uint8_t word_count) +{ + int i; + uint32_t * p_page; + uint32_t * p_curr_addr; + uint16_t in_data_crc; + uint16_t flash_crc; + uint32_t flash_header; + + p_page = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num); + p_curr_addr = p_page; + + // Calculate CRC of the data to write. + in_data_crc = ble_flash_crc16_compute((uint8_t *)p_in_array, + word_count * sizeof(uint32_t), + NULL); + + // Compare the calculated to the one in flash. + flash_header = *p_curr_addr; + flash_crc = (uint16_t)flash_header; + + if (flash_crc == in_data_crc) + { + // Data is the same as the data already stored in flash, return without modifying flash. + return NRF_SUCCESS; + } + + // Erase flash page + flash_page_erase(p_page); + + // Reserve space for magic number (for detecting if flash content is valid). + p_curr_addr++; + + // Reserve space for saving word_count. + p_curr_addr++; + + // Write data + for (i = 0; i < word_count; i++) + { + flash_word_unprotected_write(p_curr_addr, p_in_array[i]); + p_curr_addr++; + } + + // Write number of elements. + flash_word_write(p_page + 1, (uint32_t)(word_count)); + + // Write magic number and CRC to indicate that flash content is valid. + flash_header = BLE_FLASH_MAGIC_NUMBER | (uint32_t)in_data_crc; + flash_word_write(p_page, flash_header); + + return NRF_SUCCESS; +} + + +uint32_t ble_flash_page_read(uint8_t page_num, uint32_t * p_out_array, uint8_t * p_word_count) +{ + int byte_count; + uint32_t * p_page; + uint32_t * p_curr_addr; + uint32_t flash_header; + uint32_t calc_header; + uint16_t calc_crc; + uint32_t tmp; + + p_page = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num); + p_curr_addr = p_page; + + // Check if block is valid + flash_header = *p_curr_addr; + tmp = flash_header & 0xFFFF0000; + if (tmp != BLE_FLASH_MAGIC_NUMBER) + { + *p_word_count = 0; + return NRF_ERROR_NOT_FOUND; + } + p_curr_addr++; + + // Read number of elements + *p_word_count = (uint8_t)(*(p_curr_addr)); + p_curr_addr++; + + // Read data + byte_count = (*p_word_count) * sizeof(uint32_t); + memcpy(p_out_array, p_curr_addr, byte_count); + + // Check CRC + calc_crc = ble_flash_crc16_compute((uint8_t *)p_out_array, + (*p_word_count) * sizeof(uint32_t), + NULL); + calc_header = BLE_FLASH_MAGIC_NUMBER | (uint32_t)calc_crc; + + if (calc_header != flash_header) + { + return NRF_ERROR_NOT_FOUND; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_flash_page_addr(uint8_t page_num, uint32_t ** pp_page_addr) +{ + *pp_page_addr = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num); + return NRF_SUCCESS; +} + + +void ble_flash_on_radio_active_evt(bool radio_active) +{ + m_radio_active = radio_active; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.h new file mode 100644 index 0000000000..c3943438c1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.h @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup ble_flash_module Flash Manager + * @{ + * @ingroup ble_sdk_lib + * @brief Module for accessing flash memory. + * + * @details It contains functions for reading, writing and erasing one page in flash. + * + * The module uses the first 32 bits of the flash page to write a magic number in order to + * determine if the page has been written or not. + * + * @note Be careful not to use a page number in the SoftDevice area (which currently occupies the + * range 0 to 127), or in your application space! In both cases, this would end up + * with a hard fault. + */ + +#ifndef BLE_FLASH_H__ +#define BLE_FLASH_H__ + +#include +#include +#include "nrf.h" + +#define BLE_FLASH_PAGE_SIZE ((uint16_t)NRF_FICR->CODEPAGESIZE) /**< Size of one flash page. */ +#define BLE_FLASH_MAGIC_NUMBER 0x45DE0000 /**< Magic value to identify if flash contains valid data. */ +#define BLE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */ + + +/**@brief Macro for getting the end of the flash available for application. + * + * @details The result flash page number indicates the end boundary of the flash available + * to the application. If a bootloader is used, the end will be the start of the + * bootloader region. Otherwise, the end will be the size of the flash. + */ +#define BLE_FLASH_PAGE_END \ + ((NRF_UICR->NRFFW[0] != BLE_FLASH_EMPTY_MASK) \ + ? (NRF_UICR->NRFFW[0] / BLE_FLASH_PAGE_SIZE) \ + : NRF_FICR->CODESIZE) + +/**@brief Function for erasing the specified flash page, and then writes the given data to this page. + * + * @warning This operation blocks the CPU. DO NOT use while in a connection! + * + * @param[in] page_num Page number to update. + * @param[in] p_in_array Pointer to a RAM area containing the elements to write in flash. + * This area has to be 32 bits aligned. + * @param[in] word_count Number of 32 bits words to write in flash. + * + * @return NRF_SUCCESS on successful flash write, otherwise an error code. + */ +uint32_t ble_flash_page_write(uint8_t page_num, uint32_t * p_in_array, uint8_t word_count); + +/**@brief Function for reading data from flash to RAM. + * + * @param[in] page_num Page number to read. + * @param[out] p_out_array Pointer to a RAM area where the found data will be written. + * This area has to be 32 bits aligned. + * @param[out] p_word_count Number of 32 bits words read. + * + * @return NRF_SUCCESS on successful upload, NRF_ERROR_NOT_FOUND if no valid data has been found + * in flash (first 32 bits not equal to the MAGIC_NUMBER+CRC). + */ +uint32_t ble_flash_page_read(uint8_t page_num, uint32_t * p_out_array, uint8_t * p_word_count); + +/**@brief Function for erasing a flash page. + * + * @note This operation blocks the CPU, so it should not be done while the radio is running! + * + * @param[in] page_num Page number to erase. + * + * @return NRF_SUCCESS on success, an error_code otherwise. + */ +uint32_t ble_flash_page_erase(uint8_t page_num); + +/**@brief Function for writing one word to flash. + * + * @note Flash location to be written must have been erased previously. + * + * @param[in] p_address Pointer to flash location to be written. + * @param[in] value Value to write to flash. + * + * @return NRF_SUCCESS. + */ +uint32_t ble_flash_word_write(uint32_t * p_address, uint32_t value); + +/**@brief Function for writing a data block to flash. + * + * @note Flash locations to be written must have been erased previously. + * + * @param[in] p_address Pointer to start of flash location to be written. + * @param[in] p_in_array Pointer to start of flash block to be written. + * @param[in] word_count Number of words to be written. + * + * @return NRF_SUCCESS. + */ +uint32_t ble_flash_block_write(uint32_t * p_address, uint32_t * p_in_array, uint16_t word_count); + +/**@brief Function for computing pointer to start of specified flash page. + * + * @param[in] page_num Page number. + * @param[out] pp_page_addr Pointer to start of flash page. + * + * @return NRF_SUCCESS. + */ +uint32_t ble_flash_page_addr(uint8_t page_num, uint32_t ** pp_page_addr); + +/**@brief Function for calculating a 16 bit CRC using the CRC-16-CCITT scheme. + * + * @param[in] p_data Pointer to data on which the CRC is to be calulated. + * @param[in] size Number of bytes on which the CRC is to be calulated. + * @param[in] p_crc Initial CRC value (if NULL, a preset value is used as the initial value). + * + * @return Calculated CRC. + */ +uint16_t ble_flash_crc16_compute(uint8_t * p_data, uint16_t size, uint16_t * p_crc); + +/**@brief Function for handling flashing module Radio Notification event. + * + * @note For flash writing to work safely while in a connection or while advertising, this function + * MUST be called from the Radio Notification module's event handler (see + * @ref ble_radio_notification for details). + * + * @param[in] radio_active TRUE if radio is active (or about to become active), FALSE otherwise. + */ +void ble_flash_on_radio_active_evt(bool radio_active); + +#endif // BLE_FLASH_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.c new file mode 100644 index 0000000000..00265d60b0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.c @@ -0,0 +1,506 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "nrf_drv_clock.h" +#include "nrf_error.h" +#include "nordic_common.h" + +#ifdef SOFTDEVICE_PRESENT +#include "nrf_sdm.h" +#include "nrf_soc.h" +#include "app_util_platform.h" +#else +#include "app_util_platform.h" +#endif // SOFTDEVICE_PRESENT + +/*lint -save -e652 */ +#define NRF_CLOCK_LFCLK_RC CLOCK_LFCLKSRC_SRC_RC +#define NRF_CLOCK_LFCLK_Xtal CLOCK_LFCLKSRC_SRC_Xtal +#define NRF_CLOCK_LFCLK_Synth CLOCK_LFCLKSRC_SRC_Synth +/*lint -restore */ + +#define INT_MAX 0xFFFFFFFF + +#if (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LFCLK_RC) && !defined(SOFTDEVICE_PRESENT) +#define CALIBRATION_SUPPORT 1 +#else +#define CALIBRATION_SUPPORT 0 +#endif +typedef enum +{ + CAL_STATE_IDLE, + CAL_STATE_CT, + CAL_STATE_HFCLK_REQ, + CAL_STATE_CAL, + CAL_STATE_ABORT, +} nrf_drv_clock_cal_state_t; + +/**@brief CLOCK control block. */ +typedef struct +{ + volatile uint32_t hfclk_requests; /*< High-frequency clock request counter. */ + volatile nrf_drv_clock_handler_item_t * p_hf_head; + bool module_initialized; /*< Indicate the state of module */ + volatile bool hfclk_on; /*< High-frequency clock state. */ +#ifndef SOFTDEVICE_PRESENT + volatile bool lfclk_on; /*< Low-frequency clock state. */ + uint32_t lfclk_requests; /*< Low-frequency clock request counter. */ + volatile nrf_drv_clock_handler_item_t * p_lf_head; +#if CALIBRATION_SUPPORT + nrf_drv_clock_handler_item_t cal_hfclk_started_handler_item; + nrf_drv_clock_event_handler_t cal_done_handler; + volatile nrf_drv_clock_cal_state_t cal_state; +#endif //CALIBRATION_SUPPORT +#endif //SOFTDEVICE_PRESENT +}nrf_drv_clock_cb_t; + +static nrf_drv_clock_cb_t m_clock_cb; + +#ifndef SOFTDEVICE_PRESENT +/**@brief Function for starting LFCLK. This function will return immediately without waiting for start. + */ +static void lfclk_start(void) +{ + nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED); + nrf_clock_int_enable(NRF_CLOCK_INT_LF_STARTED_MASK); + nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART); +} + +/**@brief Function for stopping LFCLK and calibration (if it was set up). + */ +static void lfclk_stop(void) +{ +#if CALIBRATION_SUPPORT + (void)nrf_drv_clock_calibration_abort(); +#endif //CALIBRATION_SUPPORT + + nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTOP); + while (nrf_clock_lf_is_running()) + {} +} +#endif +static void hfclk_start(void) +{ +#ifndef SOFTDEVICE_PRESENT + nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED); + nrf_clock_int_enable(NRF_CLOCK_INT_HF_STARTED_MASK); + nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTART); +#else + UNUSED_VARIABLE(sd_clock_hfclk_request()); +#endif +} + +static void hfclk_stop(void) +{ +#ifndef SOFTDEVICE_PRESENT + nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTOP); + while (nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY)) + {} +#else + UNUSED_VARIABLE(sd_clock_hfclk_release()); +#endif +} + +ret_code_t nrf_drv_clock_init(void) +{ + uint32_t result = NRF_SUCCESS; + + if (m_clock_cb.module_initialized) + { + return MODULE_ALREADY_INITIALIZED; + } + + m_clock_cb.p_hf_head = NULL; + m_clock_cb.hfclk_requests = 0; +#ifndef SOFTDEVICE_PRESENT + m_clock_cb.p_lf_head = NULL; + m_clock_cb.lfclk_requests = 0; + nrf_clock_xtalfreq_set(CLOCK_CONFIG_XTAL_FREQ); + nrf_clock_lf_src_set((nrf_clock_lfclk_t)CLOCK_CONFIG_LF_SRC); + nrf_drv_common_irq_enable(POWER_CLOCK_IRQn, CLOCK_CONFIG_IRQ_PRIORITY); +#if CALIBRATION_SUPPORT + m_clock_cb.cal_state = CAL_STATE_IDLE; +#endif // CALIBRATION_SUPPORT +#else // SOFTDEVICE_PRESENT + uint8_t is_enabled; + result = sd_softdevice_is_enabled(&is_enabled); + if((result == NRF_SUCCESS) && !is_enabled) + { + result = NRF_ERROR_SOFTDEVICE_NOT_ENABLED; + } +#endif // SOFTDEVICE_PRESENT + m_clock_cb.module_initialized = true; + return result; +} + +void nrf_drv_clock_uninit(void) +{ + ASSERT(m_clock_cb.module_initialized); +#ifndef SOFTDEVICE_PRESENT + nrf_drv_common_irq_disable(POWER_CLOCK_IRQn); + nrf_clock_int_disable(0xFFFFFFFF); + lfclk_stop(); +#endif + hfclk_stop(); + m_clock_cb.module_initialized = false; +} + +static void item_enqueue(nrf_drv_clock_handler_item_t ** p_head, + nrf_drv_clock_handler_item_t * p_item) +{ + if (*p_head) + { + p_item->p_next = *p_head; + *p_head = p_item; + } + else + { + p_item->p_next = NULL; + *p_head = p_item; + } +} + +static nrf_drv_clock_handler_item_t * item_dequeue(nrf_drv_clock_handler_item_t ** p_head) +{ + nrf_drv_clock_handler_item_t * p_item = *p_head; + if (p_item) + { + *p_head = p_item->p_next; + } + + return p_item; +} + +void nrf_drv_clock_lfclk_request(nrf_drv_clock_handler_item_t * p_handler_item) +{ + ASSERT(m_clock_cb.module_initialized); +#ifndef SOFTDEVICE_PRESENT + ASSERT(m_clock_cb.lfclk_requests != INT_MAX); + CRITICAL_REGION_ENTER(); + if (m_clock_cb.lfclk_on) + { + if (p_handler_item) + { + p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_LFCLK_STARTED); + } + } + else + { + + if (p_handler_item) + { + item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head, p_handler_item); + } + if (m_clock_cb.lfclk_requests == 0) + { + lfclk_start(); + } + } + m_clock_cb.lfclk_requests++; + CRITICAL_REGION_EXIT(); +#else + if (p_handler_item) + { + p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_LFCLK_STARTED); + } +#endif // SOFTDEVICE_PRESENT +} + + +void nrf_drv_clock_lfclk_release(void) +{ + ASSERT(m_clock_cb.module_initialized); +#ifndef SOFTDEVICE_PRESENT + ASSERT(m_clock_cb.lfclk_requests > 0); + + CRITICAL_REGION_ENTER(); + m_clock_cb.lfclk_requests--; + if (m_clock_cb.lfclk_requests == 0) + { + lfclk_stop(); + m_clock_cb.lfclk_on = false; + m_clock_cb.p_lf_head = NULL; + } + CRITICAL_REGION_EXIT(); +#endif // SOFTDEVICE_PRESENT +} + + +bool nrf_drv_clock_lfclk_is_running(void) +{ + ASSERT(m_clock_cb.module_initialized); + bool result; +#ifndef SOFTDEVICE_PRESENT + result = nrf_clock_lf_is_running(); +#else + result = true; +#endif + return result; +} + +void nrf_drv_clock_hfclk_request(nrf_drv_clock_handler_item_t * p_handler_item) +{ + ASSERT(m_clock_cb.module_initialized); + ASSERT(m_clock_cb.hfclk_requests != INT_MAX); + + CRITICAL_REGION_ENTER(); + if (m_clock_cb.hfclk_on) + { + if (p_handler_item) + { + p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_HFCLK_STARTED); + } + } + else + { + if (p_handler_item) + { + item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, p_handler_item); + } + if (m_clock_cb.hfclk_requests == 0) + { + hfclk_start(); + } + } + m_clock_cb.hfclk_requests++; + CRITICAL_REGION_EXIT(); +} + +void nrf_drv_clock_hfclk_release(void) +{ + ASSERT(m_clock_cb.module_initialized); + ASSERT(m_clock_cb.hfclk_requests > 0); + + //disable interrupts CLOCK or SoftDevice events + CRITICAL_REGION_ENTER(); + m_clock_cb.hfclk_requests--; + if (m_clock_cb.hfclk_requests == 0) + { + hfclk_stop(); + m_clock_cb.hfclk_on = false; + m_clock_cb.p_hf_head = NULL; + } + CRITICAL_REGION_EXIT(); + //enable interrupts CLOCK or SoftDevice events +} + +bool nrf_drv_clock_hfclk_is_running(void) +{ + bool result; + ASSERT(m_clock_cb.module_initialized); +#ifndef SOFTDEVICE_PRESENT + result = nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY); +#else + uint32_t is_running; + UNUSED_VARIABLE(sd_clock_hfclk_is_running(&is_running)); + result = is_running ? true : false; +#endif + return result; +} + +#if CALIBRATION_SUPPORT +static void clock_calibration_hf_started(nrf_drv_clock_evt_type_t event) +{ + if (m_clock_cb.cal_state == CAL_STATE_ABORT) + { + nrf_drv_clock_hfclk_release(); + m_clock_cb.cal_state = CAL_STATE_IDLE; + if (m_clock_cb.cal_done_handler) + { + m_clock_cb.cal_done_handler(NRF_DRV_CLOCK_EVT_CAL_ABORTED); + } + } + else + { + nrf_clock_int_enable(NRF_CLOCK_INT_DONE_MASK); + m_clock_cb.cal_state = CAL_STATE_CAL; + nrf_clock_task_trigger(NRF_CLOCK_TASK_CAL); + } +} +#endif + +ret_code_t nrf_drv_clock_calibration_start(uint8_t interval, nrf_drv_clock_event_handler_t handler) +{ +#if CALIBRATION_SUPPORT + ASSERT(m_clock_cb.cal_state == CAL_STATE_IDLE); + ret_code_t ret = NRF_SUCCESS; + if (m_clock_cb.lfclk_on == false) + { + ret = NRF_ERROR_INVALID_STATE; + } + else if (m_clock_cb.cal_state == CAL_STATE_IDLE) + { + m_clock_cb.cal_done_handler = handler; + m_clock_cb.cal_hfclk_started_handler_item.event_handler = clock_calibration_hf_started; + if (interval == 0) + { + m_clock_cb.cal_state = CAL_STATE_HFCLK_REQ; + nrf_drv_clock_hfclk_request(&m_clock_cb.cal_hfclk_started_handler_item); + } + else + { + m_clock_cb.cal_state = CAL_STATE_CT; + nrf_clock_cal_timer_timeout_set(interval); + nrf_clock_int_enable(NRF_CLOCK_INT_CTTO_MASK); + nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTART); + } + } + else + { + ret = NRF_ERROR_BUSY; + } + return ret; +#else //CALIBRATION_SUPPORT + return NRF_ERROR_FORBIDDEN; +#endif +} + + +ret_code_t nrf_drv_clock_calibration_abort(void) +{ +#if CALIBRATION_SUPPORT + CRITICAL_REGION_ENTER(); + switch(m_clock_cb.cal_state) + { + case CAL_STATE_CT: + nrf_clock_int_disable(NRF_CLOCK_INT_CTTO_MASK); + nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTOP); + m_clock_cb.cal_state = CAL_STATE_IDLE; + if (m_clock_cb.cal_done_handler) + { + m_clock_cb.cal_done_handler(NRF_DRV_CLOCK_EVT_CAL_ABORTED); + } + break; + case CAL_STATE_HFCLK_REQ: + /* fall through. */ + case CAL_STATE_CAL: + m_clock_cb.cal_state = CAL_STATE_ABORT; + break; + default: + break; + } + CRITICAL_REGION_EXIT(); + return NRF_SUCCESS; +#else //CALIBRATION_SUPPORT + return NRF_ERROR_FORBIDDEN; +#endif +} + +ret_code_t nrf_drv_clock_is_calibrating(bool * p_is_calibrating) +{ +#if CALIBRATION_SUPPORT + ASSERT(m_clock_cb.module_initialized); + *p_is_calibrating = (m_clock_cb.cal_state != CAL_STATE_IDLE); + return NRF_SUCCESS; +#else //CALIBRATION_SUPPORT + return NRF_ERROR_FORBIDDEN; +#endif +} + +static __INLINE void clock_clk_started_notify(nrf_drv_clock_handler_item_t **p_head, + nrf_drv_clock_evt_type_t evt_type) +{ + while(1) + { + nrf_drv_clock_handler_item_t * p_item = item_dequeue(p_head); + if (p_item) + { + p_item->event_handler(evt_type); + } + else + { + break; + } + } +} + +#ifndef SOFTDEVICE_PRESENT +void POWER_CLOCK_IRQHandler(void) +{ + if (nrf_clock_event_check(NRF_CLOCK_EVENT_HFCLKSTARTED)) + { + nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED); + nrf_clock_int_disable(NRF_CLOCK_INT_HF_STARTED_MASK); + m_clock_cb.hfclk_on = true; + clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, NRF_DRV_CLOCK_EVT_HFCLK_STARTED); + } + if (nrf_clock_event_check(NRF_CLOCK_EVENT_LFCLKSTARTED)) + { + nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED); + nrf_clock_int_disable(NRF_CLOCK_INT_LF_STARTED_MASK); + m_clock_cb.lfclk_on = true; + clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head, NRF_DRV_CLOCK_EVT_LFCLK_STARTED); + } +#if CALIBRATION_SUPPORT + if (nrf_clock_event_check(NRF_CLOCK_EVENT_CTTO)) + { + nrf_clock_event_clear(NRF_CLOCK_EVENT_CTTO); + nrf_clock_int_disable(NRF_CLOCK_INT_CTTO_MASK); + nrf_drv_clock_hfclk_request(&m_clock_cb.cal_hfclk_started_handler_item); + } + + if (nrf_clock_event_check(NRF_CLOCK_EVENT_DONE)) + { + nrf_clock_event_clear(NRF_CLOCK_EVENT_DONE); + nrf_clock_int_disable(NRF_CLOCK_INT_DONE_MASK); + + nrf_drv_clock_hfclk_release(); + nrf_drv_clock_evt_type_t evt_type = (m_clock_cb.cal_state == CAL_STATE_ABORT) ? + NRF_DRV_CLOCK_EVT_CAL_ABORTED : NRF_DRV_CLOCK_EVT_CAL_DONE; + m_clock_cb.cal_state = CAL_STATE_IDLE; + if (m_clock_cb.cal_done_handler) + { + m_clock_cb.cal_done_handler(evt_type); + } + } +#endif //CALIBRATION_SUPPORT +} +#else +void nrf_drv_clock_on_soc_event(uint32_t evt_id) +{ + if (evt_id == NRF_EVT_HFCLKSTARTED) + { + clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, NRF_DRV_CLOCK_EVT_HFCLK_STARTED); + } +} +#endif // SOFTDEVICE_PRESENT + +#undef NRF_CLOCK_LFCLK_RC +#undef NRF_CLOCK_LFCLK_Xtal +#undef NRF_CLOCK_LFCLK_Synth diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.h new file mode 100644 index 0000000000..583902e4d8 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.h @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_DRV_CLOCK_H__ +#define NRF_DRV_CLOCK_H__ + +#include +#include +#include "sdk_errors.h" +#include "nrf_assert.h" +#include "nrf_clock.h" +#include "nrf_drv_config.h" +#include "nrf_drv_common.h" + +/** + * + * @addtogroup nrf_clock Clock HAL and driver + * @ingroup nrf_drivers + * @brief Clock APIs. + * @details The clock HAL provides basic APIs for accessing the registers of the clock. + * The clock driver provides APIs on a higher level. + * + * @defgroup nrf_clock_drv Clock driver + * @{ + * @ingroup nrf_clock + * @brief Driver for managing the low-frequency clock (LFCLK) and the high-frequency clock (HFCLK). + */ + +/** + * @brief Clock events. + */ +typedef enum +{ + NRF_DRV_CLOCK_EVT_HFCLK_STARTED, ///< HFCLK has been started. + NRF_DRV_CLOCK_EVT_LFCLK_STARTED, ///< LFCLK has been started. + NRF_DRV_CLOCK_EVT_CAL_DONE, ///< Calibration is done. + NRF_DRV_CLOCK_EVT_CAL_ABORTED, ///< Calibration has been aborted. +} nrf_drv_clock_evt_type_t; + +/** + * @brief Clock event handler. + * + * @param[in] event Event. + */ +typedef void (*nrf_drv_clock_event_handler_t)(nrf_drv_clock_evt_type_t event); + +// Forward declaration of the nrf_drv_clock_handler_item_t type. +typedef struct nrf_drv_clock_handler_item_s nrf_drv_clock_handler_item_t; + +struct nrf_drv_clock_handler_item_s +{ + nrf_drv_clock_handler_item_t * p_next; ///< A pointer to the next handler that should be called when the clock is started. + nrf_drv_clock_event_handler_t event_handler; ///< Function to be called when the clock is started. +}; + +/** + * @brief Function for initializing the nrf_drv_clock module. + * + * After initialization, the module is in power off state (clocks are not requested). + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval MODULE_ALREADY_INITIALIZED If the driver was already initialized. + * @retval NRF_ERROR_SOFTDEVICE_NOT_ENABLED If the SoftDevice was not enabled. + */ +ret_code_t nrf_drv_clock_init(void); + +/** + * @brief Function for uninitializing the clock module. + * + */ +void nrf_drv_clock_uninit(void); + +/** + * @brief Function for requesting the LFCLK. + * + * The low-frequency clock can be requested by different modules + * or contexts. The driver ensures that the clock will be started only when it is requested + * the first time. If the clock is not ready but it was already started, the handler item that is + * provided as an input parameter is added to the list of handlers that will be notified + * when the clock is started. If the clock is already enabled, user callback is called from the + * current context. + * + * The first request will start the selected LFCLK source. If an event handler is + * provided, it will be called once the LFCLK is started. If the LFCLK was already started at this + * time, the event handler will be called from the context of this function. Additionally, + * the @ref nrf_drv_clock_lfclk_is_running function can be polled to check if the clock has started. + * + * @note When a SoftDevice is enabled, the LFCLK is always running and the driver cannot control it. + * + * @note The handler item provided by the user cannot be an automatic variable. + * + * @param[in] p_handler_item A pointer to the event handler structure. + */ +void nrf_drv_clock_lfclk_request(nrf_drv_clock_handler_item_t * p_handler_item); + +/** + * @brief Function for releasing the LFCLK. + * + * If there are no more requests, the LFCLK source will be stopped. + * + * @note When a SoftDevice is enabled, the LFCLK is always running. + */ +void nrf_drv_clock_lfclk_release(void); + +/** + * @brief Function for checking the LFCLK state. + * + * @retval true If the LFCLK is running. + * @retval false If the LFCLK is not running. + */ +bool nrf_drv_clock_lfclk_is_running(void); + +/** + * @brief Function for requesting the high-accuracy source HFCLK. + * + * The high-accuracy source + * can be requested by different modules or contexts. The driver ensures that the high-accuracy + * clock will be started only when it is requested the first time. If the clock is not ready + * but it was already started, the handler item that is provided as an input parameter is added + * to the list of handlers that will be notified when the clock is started. + * + * If an event handler is provided, it will be called once the clock is started. If the clock was already + * started at this time, the event handler will be called from the context of this function. Additionally, + * the @ref nrf_drv_clock_hfclk_is_running function can be polled to check if the clock has started. + * + * @note If a SoftDevice is running, the clock is managed by the SoftDevice and all requests are handled by + * the SoftDevice. This function cannot be called from all interrupt priority levels in that case. + * @note The handler item provided by the user cannot be an automatic variable. + * + * @param[in] p_handler_item A pointer to the event handler structure. + */ +void nrf_drv_clock_hfclk_request(nrf_drv_clock_handler_item_t * p_handler_item); + +/** + * @brief Function for releasing the high-accuracy source HFCLK. + * + * If there are no more requests, the high-accuracy source will be released. + */ +void nrf_drv_clock_hfclk_release(void); + +/** + * @brief Function for checking the HFCLK state. + * + * @retval true If the HFCLK is running (for \nRFXX XTAL source). + * @retval false If the HFCLK is not running. + */ +bool nrf_drv_clock_hfclk_is_running(void); + +/** + * @brief Function for starting a single calibration process. + * + * This function can also delay the start of calibration by a user-specified value. The delay will use + * a low-power timer that is part of the CLOCK module. @ref nrf_drv_clock_is_calibrating can be called to + * check if calibration is still in progress. If a handler is provided, the user can be notified when + * calibration is completed. The ext calibration can be started from the handler context. + * + * The calibration process consists of three phases: + * - Delay (optional) + * - Requesting the high-accuracy HFCLK + * - Hardware-supported calibration + * + * @param[in] delay Time after which the calibration will be started (in 0.25 s units). + * @param[in] handler NULL or user function to be called when calibration is completed or aborted. + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_FORBIDDEN If a SoftDevice is present or the selected LFCLK source is not an RC oscillator. + * @retval NRF_ERROR_INVALID_STATE If the low-frequency clock is off. + * @retval NRF_ERROR_BUSY If calibration is in progress. + */ +ret_code_t nrf_drv_clock_calibration_start(uint8_t delay, nrf_drv_clock_event_handler_t handler); + +/** + * @brief Function for aborting calibration. + * + * This function aborts on-going calibration. If calibration was started, it cannot be stopped. If a handler + * was provided by @ref nrf_drv_clock_calibration_start, this handler will be called once + * aborted calibration is completed. @ref nrf_drv_clock_is_calibrating can also be used to check + * if the system is calibrating. + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_FORBIDDEN If a SoftDevice is present or the selected LFCLK source is not an RC oscillator. + */ +ret_code_t nrf_drv_clock_calibration_abort(void); + +/** + * @brief Function for checking if calibration is in progress. + * + * This function indicates that the system is + * in calibration if it is in any of the calibration process phases (see @ref nrf_drv_clock_calibration_start). + * + * @param[out] p_is_calibrating True if calibration is in progress, false if not. + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_FORBIDDEN If a SoftDevice is present or the selected LFCLK source is not an RC oscillator. + */ +ret_code_t nrf_drv_clock_is_calibrating(bool * p_is_calibrating); + +/**@brief Function for returning a requested task address for the clock driver module. + * + * @param[in] task One of the peripheral tasks. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_clock_ppi_task_addr(nrf_clock_task_t task); + +/**@brief Function for returning a requested event address for the clock driver module. + * + * @param[in] event One of the peripheral events. + * + * @return Event address. + */ +__STATIC_INLINE uint32_t nrf_drv_clock_ppi_event_addr(nrf_clock_event_t event); + +/** + * @brief Function called by the SoftDevice handler if an @ref nrf_soc event is received from the SoftDevice. + */ +#ifdef SOFTDEVICE_PRESENT +void nrf_drv_clock_on_soc_event(uint32_t evt_id); +#endif +/** + *@} + **/ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE uint32_t nrf_drv_clock_ppi_task_addr(nrf_clock_task_t task) +{ + return nrf_clock_task_address_get(task); +} + +__STATIC_INLINE uint32_t nrf_drv_clock_ppi_event_addr(nrf_clock_event_t event) +{ + return nrf_clock_event_address_get(event); +} +#endif //SUPPRESS_INLINE_IMPLEMENTATION + +/*lint --flb "Leave library region" */ +#endif // NRF_CLOCK_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.c new file mode 100644 index 0000000000..2150af0569 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.c @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include "nrf_drv_common.h" +#include "nrf_assert.h" +#include "app_util_platform.h" + +#ifdef SOFTDEVICE_PRESENT +#include "nrf_soc.h" +#endif + + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + +typedef struct { + nrf_drv_irq_handler_t handler; + bool acquired; +} shared_resource_t; + +// SPIM0, SPIS0, SPI0, TWIM0, TWIS0, TWI0 +#if (SPI0_ENABLED || SPIS0_ENABLED || TWI0_ENABLED || TWIS0_ENABLED) + #define SERIAL_BOX_0_IN_USE + // [this checking may need a different form in unit tests, hence macro] + #ifndef IS_SERIAL_BOX_0 + #define IS_SERIAL_BOX_0(p_per_base) (p_per_base == NRF_SPI0) + #endif + + static shared_resource_t m_serial_box_0 = { .acquired = false }; + void SPI0_TWI0_IRQHandler(void) + { + ASSERT(m_serial_box_0.handler); + m_serial_box_0.handler(); + } +#endif // (SPI0_ENABLED || SPIS0_ENABLED || TWI0_ENABLED || TWIS0_ENABLED) + +// SPIM1, SPIS1, SPI1, TWIM1, TWIS1, TWI1 +#if (SPI1_ENABLED || SPIS1_ENABLED || TWI1_ENABLED || TWIS1_ENABLED) + #define SERIAL_BOX_1_IN_USE + // [this checking may need a different form in unit tests, hence macro] + #ifndef IS_SERIAL_BOX_1 + #define IS_SERIAL_BOX_1(p_per_base) (p_per_base == NRF_SPI1) + #endif + + static shared_resource_t m_serial_box_1 = { .acquired = false }; + void SPI1_TWI1_IRQHandler(void) + { + ASSERT(m_serial_box_1.handler); + m_serial_box_1.handler(); + } +#endif // (SPI1_ENABLED || SPIS1_ENABLED || TWI1_ENABLED || TWIS1_ENABLED) + +// SPIM2, SPIS2, SPI2 +#if (SPI2_ENABLED || SPIS2_ENABLED) + #define SERIAL_BOX_2_IN_USE + // [this checking may need a different form in unit tests, hence macro] + #ifndef IS_SERIAL_BOX_2 + #define IS_SERIAL_BOX_2(p_per_base) (p_per_base == NRF_SPI2) + #endif + + static shared_resource_t m_serial_box_2 = { .acquired = false }; + void SPIM2_SPIS2_SPI2_IRQHandler(void) + { + ASSERT(m_serial_box_2.handler); + m_serial_box_2.handler(); + } +#endif // (SPI2_ENABLED || SPIS2_ENABLED) + +// COMP, LPCOMP +#if (COMP_ENABLED || LPCOMP_ENABLED) + #define COMP_LPCOMP_IN_USE + + #ifndef IS_COMP_LPCOMP + #define IS_COMP_LPCOMP(p_per_base) ((p_per_base) == NRF_LPCOMP) + #endif + + static shared_resource_t m_comp_lpcomp = { .acquired = false }; + void LPCOMP_IRQHandler(void) + { + ASSERT(m_comp_lpcomp.handler); + m_comp_lpcomp.handler(); + } +#endif // (COMP_ENABLED || LPCOMP_ENABLED) + +#if defined(SERIAL_BOX_0_IN_USE) || \ + defined(SERIAL_BOX_1_IN_USE) || \ + defined(SERIAL_BOX_2_IN_USE) || \ + defined(COMP_LPCOMP_IN_USE) +static ret_code_t acquire_shared_resource(shared_resource_t * p_resource, + nrf_drv_irq_handler_t handler) +{ + bool busy = false; + + CRITICAL_REGION_ENTER(); + if (p_resource->acquired) + { + busy = true; + } + else + { + p_resource->acquired = true; + } + CRITICAL_REGION_EXIT(); + + if (busy) + { + return NRF_ERROR_BUSY; + } + + p_resource->handler = handler; + return NRF_SUCCESS; +} +#endif + +ret_code_t nrf_drv_common_per_res_acquire(void const * p_per_base, + nrf_drv_irq_handler_t handler) +{ +#ifdef SERIAL_BOX_0_IN_USE + if (IS_SERIAL_BOX_0(p_per_base)) + { + return acquire_shared_resource(&m_serial_box_0, handler); + } +#endif + +#ifdef SERIAL_BOX_1_IN_USE + if (IS_SERIAL_BOX_1(p_per_base)) + { + return acquire_shared_resource(&m_serial_box_1, handler); + } +#endif + +#ifdef SERIAL_BOX_2_IN_USE + if (IS_SERIAL_BOX_2(p_per_base)) + { + return acquire_shared_resource(&m_serial_box_2, handler); + } +#endif + +#ifdef COMP_LPCOMP_IN_USE + if (IS_COMP_LPCOMP(p_per_base)) + { + return acquire_shared_resource(&m_comp_lpcomp, handler); + } +#endif + + return NRF_ERROR_INVALID_PARAM; +} + +void nrf_drv_common_per_res_release(void const * p_per_base) +{ +#ifdef SERIAL_BOX_0_IN_USE + if (IS_SERIAL_BOX_0(p_per_base)) + { + m_serial_box_0.acquired = false; + } + else +#endif + +#ifdef SERIAL_BOX_1_IN_USE + if (IS_SERIAL_BOX_1(p_per_base)) + { + m_serial_box_1.acquired = false; + } + else +#endif + +#ifdef SERIAL_BOX_2_IN_USE + if (IS_SERIAL_BOX_2(p_per_base)) + { + m_serial_box_2.acquired = false; + } + else +#endif + +#ifdef COMP_LPCOMP_IN_USE + if (IS_COMP_LPCOMP(p_per_base)) + { + m_comp_lpcomp.acquired = false; + } + else +#endif + + {} +} + +#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED + + +void nrf_drv_common_irq_enable(IRQn_Type IRQn, uint8_t priority) +{ + +#ifdef SOFTDEVICE_PRESENT + #ifdef NRF51 + ASSERT((priority == APP_IRQ_PRIORITY_LOW) || (priority == APP_IRQ_PRIORITY_HIGH)); + #elif defined(NRF52) + ASSERT((priority == APP_IRQ_PRIORITY_LOWEST) || (priority == APP_IRQ_PRIORITY_HIGH)); + #endif +#endif + + NVIC_SetPriority(IRQn, priority); + NVIC_ClearPendingIRQ(IRQn); + NVIC_EnableIRQ(IRQn); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.h new file mode 100644 index 0000000000..1d211eaf9b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.h @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_DRV_COMMON_H__ +#define NRF_DRV_COMMON_H__ + +#include +#include +#include "nrf.h" +#include "sdk_errors.h" +#include "nrf_drv_config.h" + + +/** + * @brief Offset of event registers in every peripheral instance + * + * This is the offset where event registers start in the every peripheral. + */ +#define NRF_DRV_COMMON_EVREGS_OFFSET 0x100U + +/** + * @brief Driver state. + */ +typedef enum +{ + NRF_DRV_STATE_UNINITIALIZED, /**< Uninitialized. */ + NRF_DRV_STATE_INITIALIZED, /**< Initialized but powered off. */ + NRF_DRV_STATE_POWERED_ON +} nrf_drv_state_t; + +/** + * @brief Driver power state selection. + */ +typedef enum +{ + NRF_DRV_PWR_CTRL_ON, /**< Power on request. */ + NRF_DRV_PWR_CTRL_OFF /**< Power off request. */ +} nrf_drv_pwr_ctrl_t; + +/** + * @brief IRQ handler type. + */ +typedef void (*nrf_drv_irq_handler_t)(void); + + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + +/** + * @brief Function for acquiring shared peripheral resources associated with + * the specified peripheral. + * + * Certain resources and registers are shared among peripherals that have + * the same ID (for example: SPI0, SPIM0, SPIS0, TWI0, TWIM0, and TWIS0). + * Only one of them can be utilized at a given time. This function reserves + * proper resources to be used by the specified peripheral. + * If PERIPHERAL_RESOURCE_SHARING_ENABLED is set to a non-zero value, IRQ + * handlers for peripherals that are sharing resources with others are + * implemented by the nrf_drv_common module instead of individual drivers. + * The drivers must then specify their interrupt handling routines and + * register them by using this function. + * + * @param[in] p_per_base Requested peripheral base pointer. + * @param[in] handler Interrupt handler to register. May be NULL + * if interrupts are not used for the peripheral. + * + * @retval NRF_SUCCESS If resources were acquired successfully. + * @retval NRF_ERROR_BUSY If resources were already acquired. + * @retval NRF_ERROR_INVALID_PARAM If the specified peripheral is not enabled + * or the peripheral does not share resources + * with other peripherals. + */ +ret_code_t nrf_drv_common_per_res_acquire(void const * p_per_base, + nrf_drv_irq_handler_t handler); + +/** + * @brief Function for releasing shared resources reserved previously by + * @ref nrf_drv_common_per_res_acquire() for the specified peripheral. + * + * @param[in] p_per_base Requested peripheral base pointer. + */ +void nrf_drv_common_per_res_release(void const * p_per_base); + +#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED + + +/** + * @brief Function sets priority and enables NVIC interrupt + * + * @note Function checks if correct priority is used when softdevice is present + * + * @param[in] IRQn Interrupt id + * @param[in] priority Interrupt priority + */ +void nrf_drv_common_irq_enable(IRQn_Type IRQn, uint8_t priority); + +/** + * @brief Function disables NVIC interrupt + * + * @param[in] IRQn Interrupt id + */ +__STATIC_INLINE void nrf_drv_common_irq_disable(IRQn_Type IRQn); + +/** + * @brief Convert bit position to event code + * + * Function for converting the bit position in INTEN register to event code + * that is equivalent to the offset of the event register from the beginning + * of peripheral instance. + * + * For example the result of this function can be casted directly to + * the types like @ref nrf_twis_event_t or @ref nrf_rng_events_t... + * + * @param bit Bit position in INTEN register + * @return Event code to be casted to the right enum type or to be used in functions like + * @ref nrf_rng_event_get + * + * @sa nrf_drv_event_to_bitpos + */ +__STATIC_INLINE uint32_t nrf_drv_bitpos_to_event(uint32_t bit); + +/** + * @brief Convert event code to bit position + * + * This function can be used to get bit position in INTEN register from event code. + * + * @param event Event code that may be casted from enum values from types like + * @ref nrf_twis_event_t or @ref nrf_rng_events_t + * @return Bit position in INTEN register that corresponds to the given code. + * + * @sa nrf_drv_bitpos_to_event + */ +__STATIC_INLINE uint32_t nrf_drv_event_to_bitpos(uint32_t event); + +/** + * @brief Get interrupt number connected with given instance + * + * Function returns interrupt number for a given instance of any peripheral. + * @param[in] pinst Pointer to peripheral registry + * @return Interrupt number + */ +__STATIC_INLINE IRQn_Type nrf_drv_get_IRQn(void const * const pinst); + +/** + * @brief Check if given object is in RAM + * + * Function for analyzing if given location is placed in RAM. + * This function is used to determine if we have address that can be supported by EasyDMA. + * @param[in] ptr Pointer to the object + * @retval true Object is located in RAM + * @retval false Object is not located in RAM + */ +__STATIC_INLINE bool nrf_drv_is_in_RAM(void const * const ptr); + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_drv_common_irq_disable(IRQn_Type IRQn) +{ + NVIC_DisableIRQ(IRQn); +} + +__STATIC_INLINE uint32_t nrf_drv_bitpos_to_event(uint32_t bit) +{ + return NRF_DRV_COMMON_EVREGS_OFFSET + bit * sizeof(uint32_t); +} + +__STATIC_INLINE uint32_t nrf_drv_event_to_bitpos(uint32_t event) +{ + return (event - NRF_DRV_COMMON_EVREGS_OFFSET) / sizeof(uint32_t); +} + +__STATIC_INLINE IRQn_Type nrf_drv_get_IRQn(void const * const pinst) +{ + uint8_t ret = (uint8_t)((uint32_t)pinst>>12U); + return (IRQn_Type) ret; +} + +__STATIC_INLINE bool nrf_drv_is_in_RAM(void const * const ptr) +{ + return ((((uintptr_t)ptr) & 0xE0000000u) == 0x20000000u); +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_DRV_COMMON_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/config/nrf_drv_config_validation.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/config/nrf_drv_config_validation.h new file mode 100644 index 0000000000..aab66c7de2 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/config/nrf_drv_config_validation.h @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_DRV_CONFIG_VALIDATION_H +#define NRF_DRV_CONFIG_VALIDATION_H + +#ifdef NRF52 + +#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ + ((SPI0_ENABLED + SPIS0_ENABLED + TWI0_ENABLED + TWIS0_ENABLED) > 1) +#error "Peripherals overlap. SPI0, SPIS0, TWI0, TWIS0 - only one of these can be enabled." +#endif + +#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ + ((SPI1_ENABLED + SPIS1_ENABLED + TWI1_ENABLED + TWIS1_ENABLED) > 1) +#error "Peripherals overlap. SPI1, SPIS1, TWI1, TWIS1 - only one of these can be enabled." +#endif + +#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ + ((SPI2_ENABLED + SPIS2_ENABLED) > 1) +#error "Peripherals overlap. SPI2, SPIS2 - only one of these can be enabled." +#endif + +#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ + ((COMP_ENABLED + LPCOMP_ENABLED) > 1) +#error "COMP and LPCOMP cannot be enabled together. Peripherals overlap." +#endif + +#else //NRF51 + +#if (TWIS0_ENABLED + TWIS1_ENABLED) > 0 +#error "TWIS not present in nRF51." +#endif + +#if SPIS0_ENABLED > 0 +#error "SPIS0 instance not present in nRF51." +#endif + +#if (SPI2_ENABLED + SPIS2_ENABLED) > 0 +#error "SPI2/SPIS2 instance not present in nRF51." +#endif + +#if RTC2_ENABLED +#error "RTC2 not present in NRF51." +#endif + +#if (TIMER3_ENABLED + TIMER4_ENABLED) > 0 +#error "TIMER3 and TIMER4 not present in nRF51." +#endif + +#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ + ((SPI0_ENABLED + TWI0_ENABLED) > 1) +#error "Peripherals overlap. SPI0, TWI0 - only one of these can be enabled." +#endif + +#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ + ((SPI1_ENABLED + SPIS1_ENABLED + TWI1_ENABLED) > 1) +#error "Peripherals overlap. SPI1, SPIS1, TWI1 - only one of these can be enabled." +#endif + +#if SAADC_ENABLED > 0 +#error "SAADC not present in nRF51." +#endif + +#if I2S_ENABLED > 0 +#error "I2S not present in nRF51." +#endif +#if COMP_ENABLED > 0 +#error "COMP not present in nRF51." +#endif + +#endif //NRF51 + +#endif // NRF_DRV_CONFIG_VALIDATION_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.c new file mode 100644 index 0000000000..28cfa1322e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include "compiler_abstraction.h" +#include "nrf.h" +#include "nrf_delay.h" + +/*lint --e{438} "Variable not used" */ +void nrf_delay_ms(uint32_t volatile number_of_ms) +{ + while(number_of_ms != 0) + { + number_of_ms--; + nrf_delay_us(999); + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.h new file mode 100644 index 0000000000..a9b110b092 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.h @@ -0,0 +1,242 @@ +#ifndef _NRF_DELAY_H +#define _NRF_DELAY_H + +#include "nrf.h" + +/** + * @brief Function for delaying execution for number of microseconds. + * + * @note NRF52 has instruction cache and because of that delay is not precise. + * + * @param number_of_ms + */ +/*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */ +#if defined ( __CC_ARM ) + +static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us) +{ +loop + SUBS R0, R0, #1 + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP +#ifdef NRF52 + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP +#endif + BNE loop + BX LR +} + +#elif defined ( __ICCARM__ ) + +static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) +{ +__ASM ( +"loop:\n\t" + " SUBS R0, R0, #1\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" +#ifdef NRF52 + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" + " NOP\n\t" +#endif + " BNE.n loop\n\t"); +} + +#elif defined ( _WIN32 ) || defined ( __unix ) || defined( __APPLE__ ) + +__STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us); + +#ifndef CUSTOM_NRF_DELAY_US +__STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us) +{} +#endif + +#elif defined ( __GNUC__ ) + +static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline)); +static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) +{ +register uint32_t delay __ASM ("r0") = number_of_us; +__ASM volatile ( +#ifdef NRF51 + ".syntax unified\n" +#endif + "1:\n" + " SUBS %0, %0, #1\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" +#ifdef NRF52 + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" +#endif + " BNE 1b\n" +#ifdef NRF51 + ".syntax divided\n" +#endif + : "+r" (delay)); +} +#endif + +void nrf_delay_ms(uint32_t volatile number_of_ms); + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c new file mode 100644 index 0000000000..752c89c9a7 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c @@ -0,0 +1,607 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "nrf_drv_gpiote.h" +#include "nrf_drv_common.h" +#include "nrf_drv_config.h" +#include "app_util_platform.h" +#include "nrf_assert.h" + +#define FORBIDDEN_HANDLER_ADDRESS ((nrf_drv_gpiote_evt_handler_t)UINT32_MAX) +#define PIN_NOT_USED (-1) +#define PIN_USED (-2) +#define NO_CHANNELS (-1) +#define SENSE_FIELD_POS (6) +#define SENSE_FIELD_MASK (0xC0) + +/** + * @brief Macro for conveting task-event index to an address of an event register. + * + * Macro utilizes the fact that registers are grouped together in ascending order. + */ +#define TE_IDX_TO_EVENT_ADDR(idx) (nrf_gpiote_events_t)((uint32_t)NRF_GPIOTE_EVENTS_IN_0+(sizeof(uint32_t)*(idx))) + +/** + * @brief Macro for conveting task-event index to an address of a task register. + * + * Macro utilizes the fact that registers are grouped together in ascending order. + */ +#define TE_IDX_TO_TASK_ADDR(idx) (nrf_gpiote_tasks_t)((uint32_t)NRF_GPIOTE_TASKS_OUT_0+(sizeof(uint32_t)*(idx))) + +//lint -save -e661 +typedef struct +{ + nrf_drv_gpiote_evt_handler_t handlers[NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS]; + int8_t pin_assignments[NUMBER_OF_PINS]; + int8_t port_handlers_pins[GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS]; + nrf_drv_state_t state; +} gpiote_control_block_t; + +static gpiote_control_block_t m_cb; + +__STATIC_INLINE bool pin_in_use(uint32_t pin) +{ + return (m_cb.pin_assignments[pin] != PIN_NOT_USED); +} + +__STATIC_INLINE bool pin_in_use_as_non_task_out(uint32_t pin) +{ + return (m_cb.pin_assignments[pin] == PIN_USED); +} + +__STATIC_INLINE bool pin_in_use_by_te(uint32_t pin) +{ + return (m_cb.pin_assignments[pin] >= 0 && m_cb.pin_assignments[pin] < NUMBER_OF_GPIO_TE) ? true : false; +} + +__STATIC_INLINE bool pin_in_use_by_port(uint32_t pin) +{ + return (m_cb.pin_assignments[pin] >= NUMBER_OF_GPIO_TE); +} + +__STATIC_INLINE bool pin_in_use_by_gpiote(uint32_t pin) +{ + return (m_cb.pin_assignments[pin] >= 0); +} + +__STATIC_INLINE void pin_in_use_by_te_set(uint32_t pin, + uint32_t channel_id, + nrf_drv_gpiote_evt_handler_t handler, + bool is_channel) +{ + m_cb.pin_assignments[pin] = channel_id; + m_cb.handlers[channel_id] = handler; + if (!is_channel) + { + m_cb.port_handlers_pins[channel_id-NUMBER_OF_GPIO_TE] = (int8_t)pin; + } +} + +__STATIC_INLINE void pin_in_use_set(uint32_t pin) +{ + m_cb.pin_assignments[pin] = PIN_USED; +} + +__STATIC_INLINE void pin_in_use_clear(uint32_t pin) +{ + m_cb.pin_assignments[pin] = PIN_NOT_USED; +} + +__STATIC_INLINE int8_t channel_port_get(uint32_t pin) +{ + return m_cb.pin_assignments[pin]; +} + +__STATIC_INLINE nrf_drv_gpiote_evt_handler_t channel_handler_get(uint32_t channel) +{ + return m_cb.handlers[channel]; +} + +static int8_t channel_port_alloc(uint32_t pin,nrf_drv_gpiote_evt_handler_t handler, bool channel) +{ + int8_t channel_id = NO_CHANNELS; + uint32_t i; + + uint32_t start_idx = channel ? 0 : NUMBER_OF_GPIO_TE; + uint32_t end_idx = channel ? NUMBER_OF_GPIO_TE : (NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS); + //critical section + + for (i = start_idx; i < end_idx; i++) + { + if (m_cb.handlers[i] == FORBIDDEN_HANDLER_ADDRESS) + { + pin_in_use_by_te_set(pin, i, handler, channel); + channel_id = i; + break; + } + } + //critical section + return channel_id; +} + +static void channel_free(uint8_t channel_id) +{ + m_cb.handlers[channel_id] = FORBIDDEN_HANDLER_ADDRESS; + if (channel_id >= NUMBER_OF_GPIO_TE) + { + m_cb.port_handlers_pins[channel_id-NUMBER_OF_GPIO_TE] = (int8_t)PIN_NOT_USED; + } +} + +ret_code_t nrf_drv_gpiote_init(void) +{ + if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + uint8_t i; + for (i = 0; i < NUMBER_OF_PINS; i++) + { + pin_in_use_clear(i); + } + for (i = 0; i < (NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS); i++) + { + channel_free(i); + } + + nrf_drv_common_irq_enable(GPIOTE_IRQn, GPIOTE_CONFIG_IRQ_PRIORITY); + nrf_gpiote_int_enable(GPIOTE_INTENSET_PORT_Msk); + m_cb.state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + +bool nrf_drv_gpiote_is_init(void) +{ + return (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) ? true : false; +} + +void nrf_drv_gpiote_uninit(void) +{ + ASSERT(m_cb.state!=NRF_DRV_STATE_UNINITIALIZED); + + uint32_t i; + for (i = 0; i < NUMBER_OF_PINS; i++) + { + if (pin_in_use_as_non_task_out(i)) + { + nrf_drv_gpiote_out_uninit(i); + } + else if( pin_in_use_by_gpiote(i)) + { + /* Disable gpiote_in is having the same effect on out pin as gpiote_out_uninit on + * so it can be called on all pins used by GPIOTE. + */ + nrf_drv_gpiote_in_uninit(i); + } + } + m_cb.state = NRF_DRV_STATE_UNINITIALIZED; +} + +ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, + nrf_drv_gpiote_out_config_t const * p_config) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(m_cb.state == NRF_DRV_STATE_INITIALIZED); + ASSERT(p_config); + + ret_code_t result = NRF_SUCCESS; + + if (pin_in_use(pin)) + { + result = NRF_ERROR_INVALID_STATE; + } + else + { + if (p_config->task_pin) + { + int8_t channel = channel_port_alloc(pin, NULL, true); + + if (channel != NO_CHANNELS) + { + nrf_gpiote_task_configure(channel, pin, p_config->action, p_config->init_state); + } + else + { + result = NRF_ERROR_NO_MEM; + } + } + else + { + pin_in_use_set(pin); + } + + if (result == NRF_SUCCESS) + { + if (p_config->init_state == NRF_GPIOTE_INITIAL_VALUE_HIGH) + { + nrf_gpio_pin_set(pin); + } + else + { + nrf_gpio_pin_clear(pin); + } + + nrf_gpio_cfg_output(pin); + } + } + + return result; +} + +void nrf_drv_gpiote_out_uninit(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + + if (pin_in_use_by_te(pin)) + { + channel_free((uint8_t)channel_port_get(pin)); + nrf_gpiote_te_default(channel_port_get(pin)); + } + pin_in_use_clear(pin); + + nrf_gpio_cfg_default(pin); +} + +void nrf_drv_gpiote_out_set(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + ASSERT(!pin_in_use_by_te(pin)) + + nrf_gpio_pin_set(pin); +} + +void nrf_drv_gpiote_out_clear(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + ASSERT(!pin_in_use_by_te(pin)) + + nrf_gpio_pin_clear(pin); +} + +void nrf_drv_gpiote_out_toggle(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + ASSERT(!pin_in_use_by_te(pin)) + + nrf_gpio_pin_toggle(pin); +} + +void nrf_drv_gpiote_out_task_enable(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + ASSERT(pin_in_use_by_te(pin)) + + nrf_gpiote_task_enable(m_cb.pin_assignments[pin]); +} + +void nrf_drv_gpiote_out_task_disable(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + ASSERT(pin_in_use_by_te(pin)) + + nrf_gpiote_task_disable(m_cb.pin_assignments[pin]); +} + +uint32_t nrf_drv_gpiote_out_task_addr_get(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use_by_te(pin)); + + nrf_gpiote_tasks_t task = TE_IDX_TO_TASK_ADDR(channel_port_get(pin)); + return nrf_gpiote_task_addr_get(task); +} + +void nrf_drv_gpiote_out_task_force(nrf_drv_gpiote_pin_t pin, uint8_t state) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + ASSERT(pin_in_use_by_te(pin)); + + nrf_gpiote_outinit_t init_val = state ? NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW; + nrf_gpiote_task_force(m_cb.pin_assignments[pin], init_val); +} + +void nrf_drv_gpiote_out_task_trigger(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + ASSERT(pin_in_use_by_te(pin)); + + nrf_gpiote_tasks_t task = TE_IDX_TO_TASK_ADDR(channel_port_get(pin));; + nrf_gpiote_task_set(task); +} + +ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, + nrf_drv_gpiote_in_config_t const * p_config, + nrf_drv_gpiote_evt_handler_t evt_handler) +{ + ASSERT(pin < NUMBER_OF_PINS); + ret_code_t result = NRF_SUCCESS; + /* Only one GPIOTE channel can be assigned to one physical pin. */ + if (pin_in_use_by_gpiote(pin)) + { + result = NRF_ERROR_INVALID_STATE; + } + else + { + int8_t channel = channel_port_alloc(pin, evt_handler, p_config->hi_accuracy); + if (channel != NO_CHANNELS) + { + if (p_config->is_watcher) + { + nrf_gpio_cfg_watcher(pin); + } + else + { + nrf_gpio_cfg_input(pin,p_config->pull); + } + + if (p_config->hi_accuracy) + { + nrf_gpiote_event_configure(channel, pin,p_config->sense); + } + else + { + m_cb.port_handlers_pins[channel-NUMBER_OF_GPIO_TE] |= (p_config->sense)<< SENSE_FIELD_POS; + } + } + else + { + result = NRF_ERROR_NO_MEM; + } + } + return result; +} + +void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use_by_gpiote(pin)); + if (pin_in_use_by_port(pin)) + { + uint8_t pin_and_sense = m_cb.port_handlers_pins[channel_port_get(pin)-NUMBER_OF_GPIO_TE]; + nrf_gpiote_polarity_t polarity = (nrf_gpiote_polarity_t)(pin_and_sense >> SENSE_FIELD_POS); + nrf_gpio_pin_sense_t sense; + if (polarity == NRF_GPIOTE_POLARITY_TOGGLE) + { + /* read current pin state and set for next sense to oposit */ + sense = (nrf_gpio_pins_read() & (1 << pin)) ? + NRF_GPIO_PIN_SENSE_LOW : NRF_GPIO_PIN_SENSE_HIGH; + } + else + { + sense = (polarity == NRF_GPIOTE_POLARITY_LOTOHI) ? + NRF_GPIO_PIN_SENSE_HIGH : NRF_GPIO_PIN_SENSE_LOW; + } + nrf_gpio_cfg_sense_set(pin,sense); + } + else if(pin_in_use_by_te(pin)) + { + int32_t channel = (int32_t)channel_port_get(pin); + nrf_gpiote_events_t event = TE_IDX_TO_EVENT_ADDR(channel); + + nrf_gpiote_event_enable(channel); + + nrf_gpiote_event_clear(event); + if (int_enable) + { + nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(channel_port_get(pin)); + // Enable the interrupt only if event handler was provided. + if (handler) + { + nrf_gpiote_int_enable(1 << channel); + } + } + } +} + +void nrf_drv_gpiote_in_event_disable(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use_by_gpiote(pin)); + if (pin_in_use_by_port(pin)) + { + nrf_gpio_cfg_sense_set(pin,NRF_GPIO_PIN_NOSENSE); + } + else if(pin_in_use_by_te(pin)) + { + int32_t channel = (int32_t)channel_port_get(pin); + nrf_gpiote_event_disable(channel); + nrf_gpiote_int_disable(1 << channel); + } +} + +void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use_by_gpiote(pin)); + nrf_drv_gpiote_in_event_disable(pin); + if(pin_in_use_by_te(pin)) + { + nrf_gpiote_te_default(channel_port_get(pin)); + } + nrf_gpio_cfg_default(pin); + channel_free((uint8_t)channel_port_get(pin)); + pin_in_use_clear(pin); +} + +bool nrf_drv_gpiote_in_is_set(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + return nrf_gpio_pin_read(pin) ? true : false; +} + +uint32_t nrf_drv_gpiote_in_event_addr_get(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use_by_te(pin)); + + nrf_gpiote_events_t event = TE_IDX_TO_EVENT_ADDR(channel_port_get(pin)); + return nrf_gpiote_event_addr_get(event); +} + +void GPIOTE_IRQHandler(void) +{ + uint32_t status = 0; + uint32_t input = 0; + + /* collect status of all GPIOTE pin events. Processing is done once all are collected and cleared.*/ + uint32_t i; + nrf_gpiote_events_t event = NRF_GPIOTE_EVENTS_IN_0; + uint32_t mask = (uint32_t)NRF_GPIOTE_INT_IN0_MASK; + for (i = 0; i < NUMBER_OF_GPIO_TE; i++) + { + if (nrf_gpiote_event_is_set(event) && nrf_gpiote_int_is_enabled(mask)) + { + nrf_gpiote_event_clear(event); + status |= mask; + } + mask <<= 1; + /* Incrementing to next event, utilizing the fact that events are grouped together + * in ascending order. */ + event = (nrf_gpiote_events_t)((uint32_t)event + sizeof(uint32_t)); + } + + /* collect PORT status event, if event is set read pins state. Processing is postponed to the + * end of interrupt. */ + if (nrf_gpiote_event_is_set(NRF_GPIOTE_EVENTS_PORT)) + { + nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_PORT); + status |= (uint32_t)NRF_GPIOTE_INT_PORT_MASK; + input = nrf_gpio_pins_read(); + } + + /* Process pin events. */ + if (status & NRF_GPIOTE_INT_IN_MASK) + { + mask = (uint32_t)NRF_GPIOTE_INT_IN0_MASK; + for (i = 0; i < NUMBER_OF_GPIO_TE; i++) + { + if (mask & status) + { + nrf_drv_gpiote_pin_t pin = nrf_gpiote_event_pin_get(i); + nrf_gpiote_polarity_t polarity = nrf_gpiote_event_polarity_get(i); + nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(i); + handler(pin,polarity); + } + mask <<= 1; + } + } + + if (status & (uint32_t)NRF_GPIOTE_INT_PORT_MASK) + { + /* Process port event. */ + uint8_t repeat = 0; + uint32_t toggle_mask = 0; + uint32_t pins_to_check = 0xFFFFFFFFuL; + + do + { + repeat = 0; + for (i = 0; i < GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS; i++) + { + uint8_t pin_and_sense = m_cb.port_handlers_pins[i]; + nrf_drv_gpiote_pin_t pin = (pin_and_sense & ~SENSE_FIELD_MASK); + + if ((m_cb.port_handlers_pins[i] != PIN_NOT_USED) + && ((1UL << pin) & pins_to_check)) + { + nrf_gpiote_polarity_t polarity = + (nrf_gpiote_polarity_t)((pin_and_sense & SENSE_FIELD_MASK) >> SENSE_FIELD_POS); + nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(channel_port_get(pin)); + if (handler || polarity == NRF_GPIOTE_POLARITY_TOGGLE) + { + mask = 1 << pin; + if (polarity == NRF_GPIOTE_POLARITY_TOGGLE) + { + toggle_mask |= mask; + } + nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(pin); + + if (((mask & input) && (sense==NRF_GPIO_PIN_SENSE_HIGH)) || + (!(mask & input) && (sense==NRF_GPIO_PIN_SENSE_LOW)) ) + { + if (polarity == NRF_GPIOTE_POLARITY_TOGGLE) + { + nrf_gpio_pin_sense_t next_sense = (sense == NRF_GPIO_PIN_SENSE_HIGH) ? + NRF_GPIO_PIN_SENSE_LOW : NRF_GPIO_PIN_SENSE_HIGH; + nrf_gpio_cfg_sense_set(pin, next_sense); + ++repeat; + } + if (handler) + { + handler(pin, polarity); + } + } + } + } + } + + if (repeat) + { + // When one of the pins in low-accuracy and toggle mode becomes active, + // it's sense mode is inverted to clear the internal SENSE signal. + // State of any other enabled low-accuracy input in toggle mode must be checked + // explicitly, because it does not trigger the interrput when SENSE signal is active. + // For more information about SENSE functionality, refer to Product Specification. + uint32_t new_input = nrf_gpio_pins_read(); + if (new_input == input) + { + //No change. + repeat = 0; + } + else + { + input = new_input; + pins_to_check = toggle_mask; + } + } + } + while (repeat); + } +} +//lint -restore diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h new file mode 100644 index 0000000000..2af99b056e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_DRV_GPIOTE__ +#define NRF_DRV_GPIOTE__ + +/** + * @addtogroup nrf_gpiote GPIOTE abstraction and driver + * @ingroup nrf_drivers + * @brief GPIOTE APIs. + * @defgroup nrf_drv_gpiote GPIOTE driver + * @{ + * @ingroup nrf_gpiote + * @brief GPIOTE driver for managing input and output pins. + */ + +#include "nrf_gpiote.h" +#include "nrf_gpio.h" +#include "nrf_drv_config.h" +#include "sdk_errors.h" +#include +#include + +/**@brief Input pin configuration. */ +typedef struct +{ + nrf_gpiote_polarity_t sense; /**< Transition that triggers interrupt. */ + nrf_gpio_pin_pull_t pull; /**< Pulling mode. */ + bool is_watcher; /**< True when the input pin is tracking an output pin. */ + bool hi_accuracy;/**< True when high accuracy (IN_EVENT) is used. */ +} nrf_drv_gpiote_in_config_t; + +/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect low-to-high transition. + * @details Set hi_accu to true to use IN_EVENT. */ +#define GPIOTE_CONFIG_IN_SENSE_LOTOHI(hi_accu) \ + { \ + .is_watcher = false, \ + .hi_accuracy = hi_accu, \ + .pull = NRF_GPIO_PIN_NOPULL, \ + .sense = NRF_GPIOTE_POLARITY_LOTOHI, \ + } + +/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect high-to-low transition. + * @details Set hi_accu to true to use IN_EVENT. */ +#define GPIOTE_CONFIG_IN_SENSE_HITOLO(hi_accu) \ + { \ + .is_watcher = false, \ + .hi_accuracy = hi_accu, \ + .pull = NRF_GPIO_PIN_NOPULL, \ + .sense = NRF_GPIOTE_POLARITY_HITOLO, \ + } + +/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect any change on the pin. + * @details Set hi_accu to true to use IN_EVENT.*/ +#define GPIOTE_CONFIG_IN_SENSE_TOGGLE(hi_accu) \ + { \ + .is_watcher = false, \ + .hi_accuracy = hi_accu, \ + .pull = NRF_GPIO_PIN_NOPULL, \ + .sense = NRF_GPIOTE_POLARITY_TOGGLE, \ + } + +/**@brief Output pin configuration. */ +typedef struct +{ + nrf_gpiote_polarity_t action; /**< Configuration of the pin task. */ + nrf_gpiote_outinit_t init_state; /**< Initial state of the output pin. */ + bool task_pin; /**< True if the pin is controlled by a GPIOTE task. */ +} nrf_drv_gpiote_out_config_t; + +/**@brief Macro for configuring a pin to use as output. GPIOTE is not used for the pin. */ +#define GPIOTE_CONFIG_OUT_SIMPLE(init_high) \ + { \ + .init_state = init_high ? NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW, \ + .task_pin = false, \ + } + +/**@brief Macro for configuring a pin to use the GPIO OUT TASK to change the state from high to low. + * @details The task will clear the pin. Therefore, the pin is set initially. */ +#define GPIOTE_CONFIG_OUT_TASK_LOW \ + { \ + .init_state = NRF_GPIOTE_INITIAL_VALUE_HIGH, \ + .task_pin = true, \ + .action = NRF_GPIOTE_POLARITY_HITOLO, \ + } + +/**@brief Macro for configuring a pin to use the GPIO OUT TASK to change the state from low to high. + * @details The task will set the pin. Therefore, the pin is cleared initially. */ +#define GPIOTE_CONFIG_OUT_TASK_HIGH \ + { \ + .init_state = NRF_GPIOTE_INITIAL_VALUE_LOW, \ + .task_pin = true, \ + .action = NRF_GPIOTE_POLARITY_LOTOHI, \ + } + +/**@brief Macro for configuring a pin to use the GPIO OUT TASK to toggle the pin state. + * @details The initial pin state must be provided. */ +#define GPIOTE_CONFIG_OUT_TASK_TOGGLE(init_high) \ + { \ + .init_state = init_high ? NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW, \ + .task_pin = true, \ + .action = NRF_GPIOTE_POLARITY_TOGGLE, \ + } + +/** @brief Pin. */ +typedef uint32_t nrf_drv_gpiote_pin_t; + +/** + * @brief Pin event handler prototype. + * @param pin Pin that triggered this event. + * @param action Action that lead to triggering this event. + */ +typedef void (*nrf_drv_gpiote_evt_handler_t)(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action); + +/** + * @brief Function for initializing the GPIOTE module. + * + * @details Only static configuration is supported to prevent the shared + * resource being customized by the initiator. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver was already initialized. + */ +ret_code_t nrf_drv_gpiote_init(void); + +/** + * @brief Function for checking if the GPIOTE module is initialized. + * + * @details The GPIOTE module is a shared module. Therefore, you should check if + * the module is already initialized and skip initialization if it is. + * + * @retval true If the module is already initialized. + * @retval false If the module is not initialized. + */ +bool nrf_drv_gpiote_is_init(void); + +/** + * @brief Function for uninitializing the GPIOTE module. + */ +void nrf_drv_gpiote_uninit(void); + +/** + * @brief Function for initializing a GPIOTE output pin. + * @details The output pin can be controlled by the CPU or by PPI. The initial + * configuration specifies which mode is used. If PPI mode is used, the driver + * attempts to allocate one of the available GPIOTE channels. If no channel is + * available, an error is returned. + * + * @param[in] pin Pin. + * @param[in] p_config Initial configuration. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver is not initialized or the pin is already used. + * @retval NRF_ERROR_NO_MEM If no GPIOTE channel is available. + */ +ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, + nrf_drv_gpiote_out_config_t const * p_config); + +/** + * @brief Function for uninitializing a GPIOTE output pin. + * @details The driver frees the GPIOTE channel if the output pin was using one. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_out_uninit(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for setting a GPIOTE output pin. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_out_set(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for clearing a GPIOTE output pin. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_out_clear(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for toggling a GPIOTE output pin. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_out_toggle(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for enabling a GPIOTE output pin task. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_out_task_enable(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for disabling a GPIOTE output pin task. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_out_task_disable(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for getting the address of a configurable GPIOTE task. + * + * @param[in] pin Pin. + */ +uint32_t nrf_drv_gpiote_out_task_addr_get(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for initializing a GPIOTE input pin. + * @details The input pin can act in two ways: + * - lower accuracy but low power (high frequency clock not needed) + * - higher accuracy (high frequency clock required) + * + * The initial configuration specifies which mode is used. + * If high-accuracy mode is used, the driver attempts to allocate one + * of the available GPIOTE channels. If no channel is + * available, an error is returned. + * In low accuracy mode SENSE feature is used. In this case only one active pin + * can be detected at a time. It can be worked around by setting all of the used + * low accuracy pins to toggle mode. + * For more information about SENSE functionality, refer to Product Specification. + * + * @param[in] pin Pin. + * @param[in] p_config Initial configuration. + * @param[in] evt_handler User function to be called when the configured transition occurs. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver is not initialized or the pin is already used. + * @retval NRF_ERROR_NO_MEM If no GPIOTE channel is available. + */ +ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, + nrf_drv_gpiote_in_config_t const * p_config, + nrf_drv_gpiote_evt_handler_t evt_handler); + +/** + * @brief Function for uninitializing a GPIOTE input pin. + * @details The driver frees the GPIOTE channel if the input pin was using one. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for enabling sensing of a GPIOTE input pin. + * + * @details If the input pin is configured as high-accuracy pin, the function + * enables an IN_EVENT. Otherwise, the function enables the GPIO sense mechanism. + * Note that a PORT event is shared between multiple pins, therefore the + * interrupt is always enabled. + * + * @param[in] pin Pin. + * @param[in] int_enable True to enable the interrupt. Always valid for a high-accuracy pin. + */ +void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable); + +/** + * @brief Function for disabling a GPIOTE input pin. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_in_event_disable(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for checking if a GPIOTE input pin is set. + * + * @param[in] pin Pin. + * @retval true If the input pin is set. + * @retval false If the input pin is not set. + */ +bool nrf_drv_gpiote_in_is_set(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for getting the address of a GPIOTE input pin event. + * @details If the pin is configured to use low-accuracy mode, the address of the PORT event is returned. + * + * @param[in] pin Pin. + */ +uint32_t nrf_drv_gpiote_in_event_addr_get(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for forcing a specific state on the pin configured as task. + * + * @param[in] pin Pin. + * @param[in] state Pin state. + */ +void nrf_drv_gpiote_out_task_force(nrf_drv_gpiote_pin_t pin, uint8_t state); + +/** + * @brief Function for triggering the task manually. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_out_task_trigger(nrf_drv_gpiote_pin_t pin); + +/** + *@} + **/ + +#endif //NRF_DRV_GPIOTE__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.c new file mode 100644 index 0000000000..188ac506c8 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.c @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file + * @brief ADC HAL implementation + */ + +#include "nrf_adc.h" + +#ifndef NRF52 + +/** + * @brief Function for configuring ADC. + * + * This function powers on ADC and configures it. ADC is in DISABLE state after configuration, + * so it should be enabled before using it. + * + * @param[in] config Requested configuration. + */ +void nrf_adc_configure(nrf_adc_config_t * config) +{ + uint32_t config_reg = 0; + + config_reg |= ((uint32_t)config->resolution << ADC_CONFIG_RES_Pos) & ADC_CONFIG_RES_Msk; + config_reg |= ((uint32_t)config->scaling << ADC_CONFIG_INPSEL_Pos) & ADC_CONFIG_INPSEL_Msk; + config_reg |= ((uint32_t)config->reference << ADC_CONFIG_REFSEL_Pos) & ADC_CONFIG_REFSEL_Msk; + + if (config->reference & ADC_CONFIG_EXTREFSEL_Msk) + { + config_reg |= config->reference & ADC_CONFIG_EXTREFSEL_Msk; + } + + /* select input */ + nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_DISABLED); + + /* set new configuration keeping selected input */ + NRF_ADC->CONFIG = config_reg | (NRF_ADC->CONFIG & ADC_CONFIG_PSEL_Msk); +} + + +/** + * @brief Blocking function for executing single ADC conversion. + * + * This function selects the desired input, starts a single conversion, + * waits for it to finish, and returns the result. + * ADC is left in STOP state, the given input is selected. + * This function does not check if ADC is initialized and powered. + * + * @param[in] input Requested input to be selected. + * + * @return Conversion result + */ +int32_t nrf_adc_convert_single(nrf_adc_config_input_t input) +{ + int32_t val; + + nrf_adc_input_select(input); + nrf_adc_start(); + + while (!nrf_adc_conversion_finished()) + { + } + nrf_adc_conversion_event_clean(); + val = nrf_adc_result_get(); + nrf_adc_stop(); + return val; +} +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.h new file mode 100644 index 0000000000..ea4e094cfa --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.h @@ -0,0 +1,443 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_ADC_H_ +#define NRF_ADC_H_ + +/** + * @defgroup nrf_adc_hal ADC HAL + * @{ + * @ingroup nrf_adc + * @brief @tagAPI51 Hardware access layer for managing the analog-to-digital converter (ADC). + */ + +#include +#include + +#include "nrf.h" + +#ifndef NRF52 +/** + * @enum nrf_adc_config_resolution_t + * @brief Resolution of the analog-to-digital converter. + */ + +/** + * @brief ADC interrupts. + */ +typedef enum +{ + NRF_ADC_INT_END_MASK = ADC_INTENSET_END_Msk, /**< ADC interrupt on END event. */ +} nrf_adc_int_mask_t; + +typedef enum +{ + NRF_ADC_CONFIG_RES_8BIT = ADC_CONFIG_RES_8bit, /**< 8 bit resolution. */ + NRF_ADC_CONFIG_RES_9BIT = ADC_CONFIG_RES_9bit, /**< 9 bit resolution. */ + NRF_ADC_CONFIG_RES_10BIT = ADC_CONFIG_RES_10bit, /**< 10 bit resolution. */ +} nrf_adc_config_resolution_t; + + +/** + * @enum nrf_adc_config_scaling_t + * @brief Scaling factor of the analog-to-digital conversion. + */ +typedef enum +{ + NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE = ADC_CONFIG_INPSEL_AnalogInputNoPrescaling, /**< Full scale input. */ + NRF_ADC_CONFIG_SCALING_INPUT_TWO_THIRDS = ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling, /**< 2/3 scale input. */ + NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD = ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling, /**< 1/3 scale input. */ + NRF_ADC_CONFIG_SCALING_SUPPLY_TWO_THIRDS = ADC_CONFIG_INPSEL_SupplyTwoThirdsPrescaling, /**< 2/3 of supply. */ + NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD = ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling /**< 1/3 of supply. */ +} nrf_adc_config_scaling_t; + +/** + * @enum nrf_adc_config_reference_t + * @brief Reference selection of the analog-to-digital converter. + */ +typedef enum +{ + NRF_ADC_CONFIG_REF_VBG = ADC_CONFIG_REFSEL_VBG, /**< 1.2 V reference. */ + NRF_ADC_CONFIG_REF_SUPPLY_ONE_HALF = ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling, /**< 1/2 of power supply. */ + NRF_ADC_CONFIG_REF_SUPPLY_ONE_THIRD = ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling, /**< 1/3 of power supply. */ + NRF_ADC_CONFIG_REF_EXT_REF0 = ADC_CONFIG_REFSEL_External | + ADC_CONFIG_EXTREFSEL_AnalogReference0 << + ADC_CONFIG_EXTREFSEL_Pos, /**< External reference 0. */ + NRF_ADC_CONFIG_REF_EXT_REF1 = ADC_CONFIG_REFSEL_External | + ADC_CONFIG_EXTREFSEL_AnalogReference1 << ADC_CONFIG_EXTREFSEL_Pos, /**< External reference 0. */ +} nrf_adc_config_reference_t; + +/** + * @enum nrf_adc_config_input_t + * @brief Input selection of the analog-to-digital converter. + */ +typedef enum +{ + NRF_ADC_CONFIG_INPUT_DISABLED = ADC_CONFIG_PSEL_Disabled, /**< No input selected. */ + NRF_ADC_CONFIG_INPUT_0 = ADC_CONFIG_PSEL_AnalogInput0, /**< Input 0. */ + NRF_ADC_CONFIG_INPUT_1 = ADC_CONFIG_PSEL_AnalogInput1, /**< Input 1. */ + NRF_ADC_CONFIG_INPUT_2 = ADC_CONFIG_PSEL_AnalogInput2, /**< Input 2. */ + NRF_ADC_CONFIG_INPUT_3 = ADC_CONFIG_PSEL_AnalogInput3, /**< Input 3. */ + NRF_ADC_CONFIG_INPUT_4 = ADC_CONFIG_PSEL_AnalogInput4, /**< Input 4. */ + NRF_ADC_CONFIG_INPUT_5 = ADC_CONFIG_PSEL_AnalogInput5, /**< Input 5. */ + NRF_ADC_CONFIG_INPUT_6 = ADC_CONFIG_PSEL_AnalogInput6, /**< Input 6. */ + NRF_ADC_CONFIG_INPUT_7 = ADC_CONFIG_PSEL_AnalogInput7, /**< Input 7. */ +} nrf_adc_config_input_t; + +/** + * @enum nrf_adc_task_t + * @brief Analog-to-digital converter tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_ADC_TASK_START = offsetof(NRF_ADC_Type, TASKS_START), /**< ADC start sampling task. */ + NRF_ADC_TASK_STOP = offsetof(NRF_ADC_Type, TASKS_STOP) /**< ADC stop sampling task. */ + /*lint -restore*/ +} nrf_adc_task_t; + +/** + * @enum nrf_adc_event_t + * @brief Analog-to-digital converter events. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + /*lint -save -e30*/ + NRF_ADC_EVENT_END = offsetof(NRF_ADC_Type, EVENTS_END) /**< End of conversion event. */ + /*lint -restore*/ +} nrf_adc_event_t; + +/**@brief Analog-to-digital converter configuration. */ +typedef struct +{ + nrf_adc_config_resolution_t resolution; /**< ADC resolution. */ + nrf_adc_config_scaling_t scaling; /**< ADC scaling factor. */ + nrf_adc_config_reference_t reference; /**< ADC reference. */ +} nrf_adc_config_t; + +/** Default ADC configuration. */ +#define NRF_ADC_CONFIG_DEFAULT { NRF_ADC_CONFIG_RES_10BIT, \ + NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD, \ + NRF_ADC_CONFIG_REF_VBG } + +/** + * @brief Function for configuring ADC. + * + * This function powers on the analog-to-digital converter and configures it. + * After the configuration, the ADC is in DISABLE state and must be + * enabled before using it. + * + * @param[in] config Configuration parameters. + */ +void nrf_adc_configure(nrf_adc_config_t * config); + +/** + * @brief Blocking function for executing a single ADC conversion. + * + * This function selects the desired input, starts a single conversion, + * waits for it to finish, and returns the result. + * After the input is selected, the analog-to-digital converter + * is left in STOP state. + * The function does not check if the ADC is initialized and powered. + * + * @param[in] input Input to be selected. + * + * @return Conversion result. + */ +int32_t nrf_adc_convert_single(nrf_adc_config_input_t input); + +/** + * @brief Function for selecting ADC input. + * + * This function selects the active input of ADC. Ensure that + * the ADC is powered on and in IDLE state before calling this function. + * + * @param[in] input Input to be selected. + */ +__STATIC_INLINE void nrf_adc_input_select(nrf_adc_config_input_t input) +{ + NRF_ADC->CONFIG = + ((uint32_t)input << ADC_CONFIG_PSEL_Pos) | (NRF_ADC->CONFIG & ~ADC_CONFIG_PSEL_Msk); + + if (input != NRF_ADC_CONFIG_INPUT_DISABLED) + { + NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled << ADC_ENABLE_ENABLE_Pos; + } + else + { + NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Disabled << ADC_ENABLE_ENABLE_Pos; + } +} + + +/** + * @brief Function for retrieving the ADC conversion result. + * + * This function retrieves and returns the last analog-to-digital conversion result. + * + * @return Last conversion result. + */ +__STATIC_INLINE int32_t nrf_adc_result_get(void) +{ + return (int32_t)NRF_ADC->RESULT; +} + + +/** + * @brief Function for checking whether the ADC is busy. + * + * This function checks whether the analog-to-digital converter is busy with a conversion. + * + * @retval true If the ADC is busy. + * @retval false If the ADC is not busy. + */ +__STATIC_INLINE bool nrf_adc_is_busy(void) +{ + return ( (NRF_ADC->BUSY & ADC_BUSY_BUSY_Msk) == ADC_BUSY_BUSY_Msk); +} + +/** + * @brief Function for getting the ADC's enabled interrupts. + * + * @param[in] mask Mask of interrupts to check. + * + * @return State of the interrupts selected by the mask. + * + * @sa nrf_adc_int_enable() + * @sa nrf_adc_int_disable() + */ +__STATIC_INLINE uint32_t nrf_adc_int_get(uint32_t mask) +{ + return (NRF_ADC->INTENSET & mask); // when read this register will return the value of INTEN. +} + + +/** + * @brief Function for starting conversion. + * + * @sa nrf_adc_stop() + * + */ +__STATIC_INLINE void nrf_adc_start(void) +{ + NRF_ADC->TASKS_START = 1; +} + + +/** + * @brief Function for stopping conversion. + * + * If the analog-to-digital converter is in inactive state, power consumption is reduced. + * + * @sa nrf_adc_start() + * + */ +__STATIC_INLINE void nrf_adc_stop(void) +{ + NRF_ADC->TASKS_STOP = 1; +} + + +/** + * @brief Function for checking if the requested ADC conversion has ended. + * + * @retval true If the task has finished. + * @retval false If the task is still running. + */ +__STATIC_INLINE bool nrf_adc_conversion_finished(void) +{ + return ((bool)NRF_ADC->EVENTS_END); +} + +/** + * @brief Function for clearing the conversion END event. + */ +__STATIC_INLINE void nrf_adc_conversion_event_clean(void) +{ + NRF_ADC->EVENTS_END = 0; +} + +/** + * @brief Function for getting the address of an ADC task register. + * + * @param[in] adc_task ADC task. + * + * @return Address of the specified ADC task. + */ +__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task); + +/** + * @brief Function for getting the address of a specific ADC event register. + * + * @param[in] adc_event ADC event. + * + * @return Address of the specified ADC event. + */ +__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event); + +/** + * @brief Function for setting the CONFIG register in ADC. + * + * @param[in] configuration Value to be written to the CONFIG register. + */ +__STATIC_INLINE void nrf_adc_config_set(uint32_t configuration); + +/** + * @brief Function for clearing an ADC event. + * + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event); + +/** + * @brief Function for checking state of an ADC event. + * + * @param[in] event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event); + +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_adc_int_enable(uint32_t int_mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_adc_int_disable(uint32_t int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param[in] int_mask Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_adc_int_enable_check(nrf_adc_int_mask_t int_mask); + +/** + * @brief Function for activating a specific ADC task. + * + * @param[in] task Task to activate. + */ +__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task); + +/** + * @brief Function for enabling ADC. + * + */ +__STATIC_INLINE void nrf_adc_enable(void); + +/** + * @brief Function for disabling ADC. + * + */ +__STATIC_INLINE void nrf_adc_disable(void); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task) +{ + return (uint32_t)((uint8_t *)NRF_ADC + adc_task); +} + +__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event) +{ + return (uint32_t)((uint8_t *)NRF_ADC + adc_event); +} + +__STATIC_INLINE void nrf_adc_config_set(uint32_t configuration) +{ + NRF_ADC->CONFIG = configuration; +} + +__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event)) = 0x0UL; +} + +__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event); +} + +__STATIC_INLINE void nrf_adc_int_enable(uint32_t int_mask) +{ + NRF_ADC->INTENSET = int_mask; +} + +__STATIC_INLINE void nrf_adc_int_disable(uint32_t int_mask) +{ + NRF_ADC->INTENCLR = int_mask; +} + +__STATIC_INLINE bool nrf_adc_int_enable_check(nrf_adc_int_mask_t int_mask) +{ + return (bool)(NRF_ADC->INTENSET & int_mask); +} + +__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)task)) = 0x1UL; +} + +__STATIC_INLINE void nrf_adc_enable(void) +{ + NRF_ADC->ENABLE = 1; +} + +__STATIC_INLINE void nrf_adc_disable(void) +{ + NRF_ADC->ENABLE = 0; +} +#endif +#endif /* NRF52 */ +/** + *@} + **/ + +#endif /* NRF_ADC_H_ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_clock.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_clock.h new file mode 100644 index 0000000000..2471a317f6 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_clock.h @@ -0,0 +1,441 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_CLOCK_H__ +#define NRF_CLOCK_H__ + +#include +#include + +#include "nrf.h" + +/** + * @defgroup nrf_clock_hal Clock HAL + * @{ + * @ingroup nrf_clock + * @brief Hardware access layer for managing the low-frequency clock (LFCLK) and the high-frequency clock (HFCLK). + */ + +#define NRF_CLOCK_TASK_TRIGGER (1UL) +#define NRF_CLOCK_EVENT_CLEAR (0UL) + +/** + * @brief Low-frequency clock sources. + * @details Used by LFCLKSRC, LFCLKSTAT, and LFCLKSRCCOPY registers. + */ +typedef enum +{ + NRF_CLOCK_LFCLK_RC = CLOCK_LFCLKSRC_SRC_RC, /**< Internal 32 kHz RC oscillator. */ + NRF_CLOCK_LFCLK_Xtal = CLOCK_LFCLKSRC_SRC_Xtal, /**< External 32 kHz crystal. */ + NRF_CLOCK_LFCLK_Synth = CLOCK_LFCLKSRC_SRC_Synth /**< Internal 32 kHz synthesizer from HFCLK system clock. */ +} nrf_clock_lfclk_t; + +/** + * @brief High-frequency clock sources. + */ +typedef enum +{ + NRF_CLOCK_HFCLK_LOW_ACCURACY = CLOCK_HFCLKSTAT_SRC_RC, /**< Internal 16 MHz RC oscillator. */ + NRF_CLOCK_HFCLK_HIGH_ACCURACY = CLOCK_HFCLKSTAT_SRC_Xtal /**< External 16 MHz/32 MHz crystal oscillator. */ +} nrf_clock_hfclk_t; + +/** + * @brief Trigger status of task LFCLKSTART/HFCLKSTART. + * @details Used by LFCLKRUN and HFCLKRUN registers. + */ +typedef enum +{ + NRF_CLOCK_START_TASK_NOT_TRIGGERED = CLOCK_LFCLKRUN_STATUS_NotTriggered, /**< Task LFCLKSTART/HFCLKSTART has not been triggered. */ + NRF_CLOCK_START_TASK_TRIGGERED = CLOCK_LFCLKRUN_STATUS_Triggered /**< Task LFCLKSTART/HFCLKSTART has been triggered. */ +} nrf_clock_start_task_status_t; + +/** + * @brief Crystal frequency selection. + */ +typedef enum +{ +#ifdef NRF51 + NRF_CLOCK_XTALFREQ_Default = CLOCK_XTALFREQ_XTALFREQ_16MHz, /**< Default. 32 MHz. */ + NRF_CLOCK_XTALFREQ_16MHz = CLOCK_XTALFREQ_XTALFREQ_16MHz, /**< 16 MHz crystal. */ + NRF_CLOCK_XTALFREQ_32MHz = CLOCK_XTALFREQ_XTALFREQ_32MHz /**< 32 MHz crystal. */ +#elif defined NRF52 + NRF_CLOCK_XTALFREQ_Default, /**< Default. 64MHz. */ +#endif +} nrf_clock_xtalfreq_t; + +/** + * @brief Interrupts. + */ +typedef enum +{ + NRF_CLOCK_INT_HF_STARTED_MASK = CLOCK_INTENSET_HFCLKSTARTED_Msk, /**< Interrupt on HFCLKSTARTED event. */ + NRF_CLOCK_INT_LF_STARTED_MASK = CLOCK_INTENSET_LFCLKSTARTED_Msk, /**< Interrupt on LFCLKSTARTED event. */ + NRF_CLOCK_INT_DONE_MASK = CLOCK_INTENSET_DONE_Msk, /**< Interrupt on DONE event. */ + NRF_CLOCK_INT_CTTO_MASK = CLOCK_INTENSET_CTTO_Msk /**< Interrupt on CTTO event. */ +} nrf_clock_int_mask_t; + +/** + * @brief Tasks. + * + * @details The NRF_CLOCK_TASK_LFCLKSTOP task cannot be set when the low-frequency clock is not running. + * The NRF_CLOCK_TASK_HFCLKSTOP task cannot be set when the high-frequency clock is not running. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_CLOCK_TASK_HFCLKSTART = offsetof(NRF_CLOCK_Type, TASKS_HFCLKSTART), /**< Start HFCLK clock source.*/ + NRF_CLOCK_TASK_HFCLKSTOP = offsetof(NRF_CLOCK_Type, TASKS_HFCLKSTOP), /**< Stop HFCLK clock source.*/ + NRF_CLOCK_TASK_LFCLKSTART = offsetof(NRF_CLOCK_Type, TASKS_LFCLKSTART), /**< Start LFCLK clock source.*/ + NRF_CLOCK_TASK_LFCLKSTOP = offsetof(NRF_CLOCK_Type, TASKS_LFCLKSTOP), /**< Stop LFCLK clock source.*/ + NRF_CLOCK_TASK_CAL = offsetof(NRF_CLOCK_Type, TASKS_CAL), /**< Start calibration of LFCLK RC oscillator.*/ + NRF_CLOCK_TASK_CTSTART = offsetof(NRF_CLOCK_Type, TASKS_CTSTART), /**< Start calibration timer.*/ + NRF_CLOCK_TASK_CTSTOP = offsetof(NRF_CLOCK_Type, TASKS_CTSTOP) /**< Stop calibration timer.*/ +} nrf_clock_task_t; /*lint -restore */ + +/** + * @brief Events. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_CLOCK_EVENT_HFCLKSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_HFCLKSTARTED), /**< HFCLK oscillator started.*/ + NRF_CLOCK_EVENT_LFCLKSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_LFCLKSTARTED), /**< LFCLK oscillator started.*/ + NRF_CLOCK_EVENT_DONE = offsetof(NRF_CLOCK_Type, EVENTS_DONE), /**< Calibration of LFCLK RC oscillator completed.*/ + NRF_CLOCK_EVENT_CTTO = offsetof(NRF_CLOCK_Type, EVENTS_CTTO) /**< Calibration timer time-out.*/ +} nrf_clock_event_t; /*lint -restore */ + +/** + * @brief Function for enabling a specific interrupt. + * + * @param[in] int_mask Interrupt. + */ +__STATIC_INLINE void nrf_clock_int_enable(uint32_t int_mask); + +/** + * @brief Function for disabling a specific interrupt. + * + * @param[in] int_mask Interrupt. + */ +__STATIC_INLINE void nrf_clock_int_disable(uint32_t int_mask); + +/** + * @brief Function for retrieving the state of a specific interrupt. + * + * @param[in] int_mask Interrupt. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_clock_int_enable_check(nrf_clock_int_mask_t int_mask); + +/** + * @brief Function for retrieving the address of a specific task. + * @details This function can be used by the PPI module. + * + * @param[in] task Task. + * + * @return Address of the requested task register. + */ +__STATIC_INLINE uint32_t nrf_clock_task_address_get(nrf_clock_task_t task); + +/** + * @brief Function for setting a specific task. + * + * @param[in] task Task. + */ +__STATIC_INLINE void nrf_clock_task_trigger(nrf_clock_task_t task); + +/** + * @brief Function for retrieving the address of a specific event. + * @details This function can be used by the PPI module. + * + * @param[in] event Event. + * + * @return Address of the requested event register. + */ +__STATIC_INLINE uint32_t nrf_clock_event_address_get(nrf_clock_event_t event); + +/** + * @brief Function for clearing a specific event. + * + * @param[in] event Event. + */ +__STATIC_INLINE void nrf_clock_event_clear(nrf_clock_event_t event); + +/** + * @brief Function for retrieving the state of a specific event. + * + * @param[in] event Event. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_clock_event_check(nrf_clock_event_t event); + +/** + * @brief Function for changing the low-frequency clock source. + * @details This function cannot be called when the low-frequency clock is running. + * + * @param[in] source New low-frequency clock source. + * + */ +__STATIC_INLINE void nrf_clock_lf_src_set(nrf_clock_lfclk_t source); + +/** + * @brief Function for retrieving the selected source for the low-frequency clock. + * + * @retval NRF_CLOCK_LFCLK_RC If the internal 32 kHz RC oscillator is the selected source for the low-frequency clock. + * @retval NRF_CLOCK_LFCLK_Xtal If an external 32 kHz crystal oscillator is the selected source for the low-frequency clock. + * @retval NRF_CLOCK_LFCLK_Synth If the internal 32 kHz synthesizer from the HFCLK is the selected source for the low-frequency clock. + */ +__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_src_get(void); + +/** + * @brief Function for retrieving the active source of the low-frequency clock. + * + * @retval NRF_CLOCK_LFCLK_RC If the internal 32 kHz RC oscillator is the active source of the low-frequency clock. + * @retval NRF_CLOCK_LFCLK_Xtal If an external 32 kHz crystal oscillator is the active source of the low-frequency clock. + * @retval NRF_CLOCK_LFCLK_Synth If the internal 32 kHz synthesizer from the HFCLK is the active source of the low-frequency clock. + */ +__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_actv_src_get(void); + +/** + * @brief Function for retrieving the clock source for the LFCLK clock when the task LKCLKSTART is triggered. + * + * @retval NRF_CLOCK_LFCLK_RC If the internal 32 kHz RC oscillator is running and generating the LFCLK clock. + * @retval NRF_CLOCK_LFCLK_Xtal If an external 32 kHz crystal oscillator is running and generating the LFCLK clock. + * @retval NRF_CLOCK_LFCLK_Synth If the internal 32 kHz synthesizer from the HFCLK is running and generating the LFCLK clock. + */ +__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_srccopy_get(void); + +/** + * @brief Function for retrieving the state of the LFCLK clock. + * + * @retval false If the LFCLK clock is not running. + * @retval true If the LFCLK clock is running. + */ +__STATIC_INLINE bool nrf_clock_lf_is_running(void); + +/** + * @brief Function for retrieving the trigger status of the task LFCLKSTART. + * + * @retval NRF_CLOCK_START_TASK_NOT_TRIGGERED If the task LFCLKSTART has not been triggered. + * @retval NRF_CLOCK_START_TASK_TRIGGERED If the task LFCLKSTART has been triggered. + */ +__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_lf_start_task_status_get(void); + +/** + * @brief Function for retrieving the active source of the high-frequency clock. + * + * @retval NRF_CLOCK_HFCLK_LOW_ACCURACY If the internal 16 MHz RC oscillator is the active source of the high-frequency clock. + * @retval NRF_CLOCK_HFCLK_HIGH_ACCURACY If an external 16 MHz/32 MHz crystal oscillator is the active source of the high-frequency clock. + */ +__STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hf_src_get(void); + +/** + * @brief Function for retrieving the state of the HFCLK clock. + * + * @param[in] clk_src Clock source to be checked. + * + * @retval false If the HFCLK clock is not running. + * @retval true If the HFCLK clock is running. + */ +__STATIC_INLINE bool nrf_clock_hf_is_running(nrf_clock_hfclk_t clk_src); + +/** + * @brief Function for retrieving the trigger status of the task HFCLKSTART. + * + * @retval NRF_CLOCK_START_TASK_NOT_TRIGGERED If the task HFCLKSTART has not been triggered. + * @retval NRF_CLOCK_START_TASK_TRIGGERED If the task HFCLKSTART has been triggered. + */ +__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get(void); + +/** + * @brief Function for retrieving the frequency selection of the external crystal. + * + * @retval NRF_CLOCK_XTALFREQ_16MHz If a 16 MHz crystal is used as source for the HFCLK oscillator. + * @retval NRF_CLOCK_XTALFREQ_32MHz If a 32 MHz crystal is used as source for the HFCLK oscillator. + */ +__STATIC_INLINE nrf_clock_xtalfreq_t nrf_clock_xtalfreq_get(void); + +/** + * @brief Function for changing the frequency selection of the external crystal. + * + * @param[in] xtalfreq New frequency selection for the external crystal. + */ +__STATIC_INLINE void nrf_clock_xtalfreq_set(nrf_clock_xtalfreq_t xtalfreq); + +/** + * @brief Function for changing the calibration timer interval. + * + * @param[in] interval New calibration timer interval in 0.25 s resolution (range: 0.25 seconds to 31.75 seconds). + */ +__STATIC_INLINE void nrf_clock_cal_timer_timeout_set(uint32_t interval); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_clock_int_enable(uint32_t int_mask) +{ + NRF_CLOCK->INTENSET = int_mask; +} + +__STATIC_INLINE void nrf_clock_int_disable(uint32_t int_mask) +{ + NRF_CLOCK->INTENCLR = int_mask; +} + +__STATIC_INLINE bool nrf_clock_int_enable_check(nrf_clock_int_mask_t int_mask) +{ + return (bool)(NRF_CLOCK->INTENCLR & int_mask); +} + +__STATIC_INLINE uint32_t nrf_clock_task_address_get(nrf_clock_task_t task) +{ + return ((uint32_t )NRF_CLOCK + task); +} + +__STATIC_INLINE void nrf_clock_task_trigger(nrf_clock_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + task)) = NRF_CLOCK_TASK_TRIGGER; +} + +__STATIC_INLINE uint32_t nrf_clock_event_address_get(nrf_clock_event_t event) +{ + return ((uint32_t)NRF_CLOCK + event); +} + +__STATIC_INLINE void nrf_clock_event_clear(nrf_clock_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + event)) = NRF_CLOCK_EVENT_CLEAR; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + event)); + (void)dummy; +#endif +} + +__STATIC_INLINE bool nrf_clock_event_check(nrf_clock_event_t event) +{ + return (bool)*((volatile uint32_t *)((uint8_t *)NRF_CLOCK + event)); +} + +__STATIC_INLINE void nrf_clock_lf_src_set(nrf_clock_lfclk_t source) +{ + NRF_CLOCK->LFCLKSRC = + (uint32_t)((source << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk); +} + +__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_src_get(void) +{ + return (nrf_clock_lfclk_t)((NRF_CLOCK->LFCLKSRC & + CLOCK_LFCLKSRC_SRC_Msk) >> CLOCK_LFCLKSRC_SRC_Pos); +} + +__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_actv_src_get(void) +{ + return (nrf_clock_lfclk_t)((NRF_CLOCK->LFCLKSTAT & + CLOCK_LFCLKSTAT_SRC_Msk) >> CLOCK_LFCLKSTAT_SRC_Pos); +} + +__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_srccopy_get(void) +{ + return (nrf_clock_lfclk_t)((NRF_CLOCK->LFCLKSRCCOPY & + CLOCK_LFCLKSRCCOPY_SRC_Msk) >> CLOCK_LFCLKSRCCOPY_SRC_Pos); +} + +__STATIC_INLINE bool nrf_clock_lf_is_running(void) +{ + return ((NRF_CLOCK->LFCLKSTAT & + CLOCK_LFCLKSTAT_STATE_Msk) >> CLOCK_LFCLKSTAT_STATE_Pos); +} + +__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_lf_start_task_status_get(void) +{ + return (nrf_clock_start_task_status_t)((NRF_CLOCK->LFCLKRUN & + CLOCK_LFCLKRUN_STATUS_Msk) >> + CLOCK_LFCLKRUN_STATUS_Pos); +} + +__STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hf_src_get(void) +{ + return (nrf_clock_hfclk_t)((NRF_CLOCK->HFCLKSTAT & + CLOCK_HFCLKSTAT_SRC_Msk) >> CLOCK_HFCLKSTAT_SRC_Pos); +} + +__STATIC_INLINE bool nrf_clock_hf_is_running(nrf_clock_hfclk_t clk_src) +{ + return (NRF_CLOCK->HFCLKSTAT & (CLOCK_HFCLKSTAT_STATE_Msk | CLOCK_HFCLKSTAT_SRC_Msk)) == + (CLOCK_HFCLKSTAT_STATE_Msk | (clk_src << CLOCK_HFCLKSTAT_SRC_Pos)); +} + +__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get(void) +{ + return (nrf_clock_start_task_status_t)((NRF_CLOCK->HFCLKRUN & + CLOCK_HFCLKRUN_STATUS_Msk) >> + CLOCK_HFCLKRUN_STATUS_Pos); +} + +__STATIC_INLINE nrf_clock_xtalfreq_t nrf_clock_xtalfreq_get(void) +{ +#ifdef NRF51 + return (nrf_clock_xtalfreq_t)((NRF_CLOCK->XTALFREQ & + CLOCK_XTALFREQ_XTALFREQ_Msk) >> CLOCK_XTALFREQ_XTALFREQ_Pos); +#elif defined NRF52 + return NRF_CLOCK_XTALFREQ_Default; +#endif +} + +__STATIC_INLINE void nrf_clock_xtalfreq_set(nrf_clock_xtalfreq_t xtalfreq) +{ +#ifdef NRF51 + NRF_CLOCK->XTALFREQ = + (uint32_t)((xtalfreq << CLOCK_XTALFREQ_XTALFREQ_Pos) & CLOCK_XTALFREQ_XTALFREQ_Msk); +#elif defined NRF52 + return; +#endif +} + +__STATIC_INLINE void nrf_clock_cal_timer_timeout_set(uint32_t interval) +{ + NRF_CLOCK->CTIV = ((interval << CLOCK_CTIV_CTIV_Pos) & CLOCK_CTIV_CTIV_Msk); +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +/** + *@} + **/ +#endif // NRF_CLOCK_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.c new file mode 100644 index 0000000000..e66f63f07d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file + * @brief Implementation of AES ECB driver + */ + + +//lint -e438 + +#include +#include +#include +#include "nrf.h" +#include "nrf_ecb.h" + +static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. +static uint8_t* ecb_key; ///< Key: Starts at ecb_data +static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. +static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. + +bool nrf_ecb_init(void) +{ + ecb_key = ecb_data; + ecb_cleartext = ecb_data + 16; + ecb_ciphertext = ecb_data + 32; + + NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; + return true; +} + + +bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) +{ + uint32_t counter = 0x1000000; + if(src_buf != ecb_cleartext) + { + memcpy(ecb_cleartext,src_buf,16); + } + NRF_ECB->EVENTS_ENDECB = 0; + NRF_ECB->TASKS_STARTECB = 1; + while(NRF_ECB->EVENTS_ENDECB == 0) + { + counter--; + if(counter == 0) + { + return false; + } + } + NRF_ECB->EVENTS_ENDECB = 0; + if(dest_buf != ecb_ciphertext) + { + memcpy(dest_buf,ecb_ciphertext,16); + } + return true; +} + +void nrf_ecb_set_key(const uint8_t * key) +{ + memcpy(ecb_key,key,16); +} + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.h new file mode 100644 index 0000000000..7b4cbf1e4b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file + * @brief ECB driver API. + */ + +#ifndef NRF_ECB_H__ +#define NRF_ECB_H__ + +/** + * @defgroup nrf_ecb AES ECB encryption + * @{ + * @ingroup nrf_drivers + * @brief Driver for the AES Electronic Code Book (ECB) peripheral. + * + * To encrypt and decrypt data, the peripheral must first be powered on + * using @ref nrf_ecb_init. Next, the key must be set using @ref nrf_ecb_set_key. + */ + +#include + +/** + * @brief Function for initializing and powering on the ECB peripheral. + * + * This function allocates memory for the ECBDATAPTR. + * @retval true If initialization was successful. + * @retval false If powering on failed. + */ +bool nrf_ecb_init(void); + +/** + * @brief Function for encrypting and decrypting 16-byte data using current key. + * + * This function avoids unnecessary copying of data if the parameters point to the + * correct locations in the ECB data structure. + * + * @param dst Result of encryption/decryption. 16 bytes will be written. + * @param src Source with 16-byte data to be encrypted/decrypted. + * + * @retval true If the encryption operation completed. + * @retval false If the encryption operation did not complete. + */ +bool nrf_ecb_crypt(uint8_t * dst, const uint8_t * src); + +/** + * @brief Function for setting the key to be used for encryption and decryption. + * + * @param key Pointer to the key. 16 bytes will be read. + */ +void nrf_ecb_set_key(const uint8_t * key); + +#endif // NRF_ECB_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpio.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpio.h new file mode 100644 index 0000000000..3127568fb5 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpio.h @@ -0,0 +1,674 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_GPIO_H__ +#define NRF_GPIO_H__ + +#include "nrf.h" +#include + +/** + * @defgroup nrf_gpio GPIO abstraction + * @{ + * @ingroup nrf_drivers + * @brief GPIO pin abstraction and port abstraction for reading and writing byte-wise to GPIO ports. + * + * Here, the GPIO ports are defined as follows: + * - Port 0 -> pin 0-7 + * - Port 1 -> pin 8-15 + * - Port 2 -> pin 16-23 + * - Port 3 -> pin 24-31 + */ + +#define NUMBER_OF_PINS 32 + +/** + * @brief Enumerator used for selecting between port 0 - 3. + */ +typedef enum +{ + NRF_GPIO_PORT_SELECT_PORT0 = 0, ///< Port 0 (GPIO pin 0-7) + NRF_GPIO_PORT_SELECT_PORT1, ///< Port 1 (GPIO pin 8-15) + NRF_GPIO_PORT_SELECT_PORT2, ///< Port 2 (GPIO pin 16-23) + NRF_GPIO_PORT_SELECT_PORT3, ///< Port 3 (GPIO pin 24-31) +} nrf_gpio_port_select_t; + +/** + * @brief Enumerator used for setting the direction of a GPIO port. + */ +typedef enum +{ + NRF_GPIO_PORT_DIR_OUTPUT, ///< Output + NRF_GPIO_PORT_DIR_INPUT ///< Input +} nrf_gpio_port_dir_t; + +/** + * @brief Pin direction definitions. + */ +typedef enum +{ + NRF_GPIO_PIN_DIR_INPUT = GPIO_PIN_CNF_DIR_Input, ///< Input + NRF_GPIO_PIN_DIR_OUTPUT = GPIO_PIN_CNF_DIR_Output ///< Output +} nrf_gpio_pin_dir_t; + +/** + * @brief Connection of input buffer + */ +typedef enum +{ + NRF_GPIO_PIN_INPUT_CONNECT = GPIO_PIN_CNF_INPUT_Connect, ///< Connect input buffer + NRF_GPIO_PIN_INPUT_DISCONNECT = GPIO_PIN_CNF_INPUT_Disconnect ///< Disconnect input buffer +} nrf_gpio_pin_input_t; + +/** + * @brief Enumerator used for selecting the pin to be pulled down or up at the time of pin configuration + */ +typedef enum +{ + NRF_GPIO_PIN_NOPULL = GPIO_PIN_CNF_PULL_Disabled, ///< Pin pullup resistor disabled + NRF_GPIO_PIN_PULLDOWN = GPIO_PIN_CNF_PULL_Pulldown, ///< Pin pulldown resistor enabled + NRF_GPIO_PIN_PULLUP = GPIO_PIN_CNF_PULL_Pullup, ///< Pin pullup resistor enabled +} nrf_gpio_pin_pull_t; + +/** + * @brief Enumerator used for selecting output drive mode + */ +typedef enum +{ + NRF_GPIO_PIN_S0S1 = GPIO_PIN_CNF_DRIVE_S0S1, ///< !< Standard '0', standard '1' + NRF_GPIO_PIN_H0S1 = GPIO_PIN_CNF_DRIVE_H0S1, ///< !< High drive '0', standard '1' + NRF_GPIO_PIN_S0H1 = GPIO_PIN_CNF_DRIVE_S0H1, ///< !< Standard '0', high drive '1' + NRF_GPIO_PIN_H0H1 = GPIO_PIN_CNF_DRIVE_H0H1, ///< !< High drive '0', high 'drive '1'' + NRF_GPIO_PIN_D0S1 = GPIO_PIN_CNF_DRIVE_D0S1, ///< !< Disconnect '0' standard '1' + NRF_GPIO_PIN_D0H1 = GPIO_PIN_CNF_DRIVE_D0H1, ///< !< Disconnect '0', high drive '1' + NRF_GPIO_PIN_S0D1 = GPIO_PIN_CNF_DRIVE_S0D1, ///< !< Standard '0'. disconnect '1' + NRF_GPIO_PIN_H0D1 = GPIO_PIN_CNF_DRIVE_H0D1, ///< !< High drive '0', disconnect '1' +} nrf_gpio_pin_drive_t; + +/** + * @brief Enumerator used for selecting the pin to sense high or low level on the pin input. + */ +typedef enum +{ + NRF_GPIO_PIN_NOSENSE = GPIO_PIN_CNF_SENSE_Disabled, ///< Pin sense level disabled. + NRF_GPIO_PIN_SENSE_LOW = GPIO_PIN_CNF_SENSE_Low, ///< Pin sense low level. + NRF_GPIO_PIN_SENSE_HIGH = GPIO_PIN_CNF_SENSE_High, ///< Pin sense high level. +} nrf_gpio_pin_sense_t; + + +/** + * @brief Function for configuring the GPIO pin range as outputs with normal drive strength. + * This function can be used to configure pin range as simple output with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). + * + * @param pin_range_start specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) + * + * @param pin_range_end specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) + * + * @note For configuring only one pin as output use @ref nrf_gpio_cfg_output + * Sense capability on the pin is disabled, and input is disconnected from the buffer as the pins are configured as output. + */ +__STATIC_INLINE void nrf_gpio_range_cfg_output(uint32_t pin_range_start, uint32_t pin_range_end); + +/** + * @brief Function for configuring the GPIO pin range as inputs with given initial value set, hiding inner details. + * This function can be used to configure pin range as simple input. + * + * @param pin_range_start specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) + * + * @param pin_range_end specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) + * + * @param pull_config State of the pin range pull resistor (no pull, pulled down or pulled high) + * + * @note For configuring only one pin as input use @ref nrf_gpio_cfg_input + * Sense capability on the pin is disabled, and input is connected to buffer so that the GPIO->IN register is readable + */ +__STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, uint32_t pin_range_end, nrf_gpio_pin_pull_t pull_config); + +/** + * @brief Pin configuration function + * + * The main pin configuration function. + * This function allows to set any aspect in PIN_CNF register. + * @param pin_number Specifies the pin number (allowed values 0-31). + * @param dir Pin direction + * @param input Connect or disconnect input buffer + * @param pull Pull configuration + * @param drive Drive configuration + * @param sense Pin sensing mechanism + */ +__STATIC_INLINE void nrf_gpio_cfg( + uint32_t pin_number, + nrf_gpio_pin_dir_t dir, + nrf_gpio_pin_input_t input, + nrf_gpio_pin_pull_t pull, + nrf_gpio_pin_drive_t drive, + nrf_gpio_pin_sense_t sense); + +/** + * @brief Function for configuring the given GPIO pin number as output with given initial value set, hiding inner details. + * This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). + * + * @param pin_number specifies the pin number (allowed values 0-31) + * + * @note Sense capability on the pin is disabled, and input is disconnected from the buffer as the pins are configured as output. + */ +__STATIC_INLINE void nrf_gpio_cfg_output(uint32_t pin_number); + +/** + * @brief Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. + * This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). + * + * @param pin_number Specifies the pin number (allowed values 0-30). + * @param pull_config State of the pin range pull resistor (no pull, pulled down or pulled high). + * + * @note Sense capability on the pin is disabled, and input is connected to buffer so that the GPIO->IN register is readable + */ +__STATIC_INLINE void nrf_gpio_cfg_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config); + +/** + * @brief Function for reseting pin configuration to its default state. + * + * @param pin_number Specifies the pin number (allowed values 0-31). + */ +__STATIC_INLINE void nrf_gpio_cfg_default(uint32_t pin_number); + +/** + * @brief Function for configuring the given GPIO pin number as a watcher. Only input is connected. + * + * @param pin_number Specifies the pin number (allowed values 0-31). + * + */ +__STATIC_INLINE void nrf_gpio_cfg_watcher(uint32_t pin_number); + +/** + * @brief Function for disconnecting input for the given GPIO. + * + * @param pin_number Specifies the pin number (allowed values 0-31). + * + */ +__STATIC_INLINE void nrf_gpio_input_disconnect(uint32_t pin_number); + +/** + * @brief Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. + * This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). + * Sense capability on the pin is configurable, and input is connected to buffer so that the GPIO->IN register is readable. + * + * @param pin_number Specifies the pin number (allowed values 0-30). + * @param pull_config State of the pin pull resistor (no pull, pulled down or pulled high). + * @param sense_config Sense level of the pin (no sense, sense low or sense high). + */ +__STATIC_INLINE void nrf_gpio_cfg_sense_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config, nrf_gpio_pin_sense_t sense_config); + +/** + * @brief Function for configuring sense level for the given GPIO. + * + * @param pin_number Specifies the pin number of gpio pin numbers to be configured (allowed values 0-30). + * @param sense_config Sense configuration. + * + */ +__STATIC_INLINE void nrf_gpio_cfg_sense_set(uint32_t pin_number, nrf_gpio_pin_sense_t sense_config); + +/** + * @brief Function for setting the direction for a GPIO pin. + * + * @param pin_number specifies the pin number (0-31) for which to + * set the direction. + * + * @param direction specifies the direction + */ +__STATIC_INLINE void nrf_gpio_pin_dir_set(uint32_t pin_number, nrf_gpio_pin_dir_t direction); + +/** + * @brief Function for setting a GPIO pin. + * + * Note that the pin must be configured as an output for this + * function to have any effect. + * + * @param pin_number Specifies the pin number (0-31) to set. + */ +__STATIC_INLINE void nrf_gpio_pin_set(uint32_t pin_number); + +/** + * @brief Function for setting GPIO pins. + * + * Note that the pins must be configured as outputs for this + * function to have any effect. + * + * @param pin_mask Specifies the pins to set. + */ +__STATIC_INLINE void nrf_gpio_pins_set(uint32_t pin_mask); + +/** + * @brief Function for clearing a GPIO pin. + * + * Note that the pin must be configured as an output for this + * function to have any effect. + * + * @param pin_number Specifies the pin number (0-31) to clear. + */ +__STATIC_INLINE void nrf_gpio_pin_clear(uint32_t pin_number); + +/** + * @brief Function for clearing GPIO pins. + * + * Note that the pins must be configured as outputs for this + * function to have any effect. + * + * @param pin_mask Specifies the pins to clear. + */ +__STATIC_INLINE void nrf_gpio_pins_clear(uint32_t pin_mask); + +/** + * @brief Function for toggling a GPIO pin. + * + * Note that the pin must be configured as an output for this + * function to have any effect. + * + * @param pin_number Specifies the pin number (0-31) to toggle. + */ +__STATIC_INLINE void nrf_gpio_pin_toggle(uint32_t pin_number); + +/** + * @brief Function for toggling GPIO pins. + * + * Note that the pins must be configured as outputs for this + * function to have any effect. + * + * @param pin_mask Specifies the pins to toggle. + */ +__STATIC_INLINE void nrf_gpio_pins_toggle(uint32_t pin_mask); + +/** + * @brief Function for writing a value to a GPIO pin. + * + * Note that the pin must be configured as an output for this + * function to have any effect. + * + * @param pin_number specifies the pin number (0-31) to + * write. + * + * @param value specifies the value to be written to the pin. + * @arg 0 clears the pin + * @arg >=1 sets the pin. + */ +__STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value); + +/** + * @brief Function for reading the input level of a GPIO pin. + * + * Note that the pin must have input connected for the value + * returned from this function to be valid. + * + * @param pin_number specifies the pin number (0-31) to + * read. + * + * @return + * @retval 0 if the pin input level is low. + * @retval 1 if the pin input level is high. + * @retval > 1 should never occur. + */ +__STATIC_INLINE uint32_t nrf_gpio_pin_read(uint32_t pin_number); + +/** + * @brief Function for reading the input level of all GPIO pins. + * + * Note that the pin must have input connected for the value + * returned from this function to be valid. + * + * @retval Status of input of all pins + */ +__STATIC_INLINE uint32_t nrf_gpio_pins_read(void); + +/** + * @brief Function for reading the sense configuration of a GPIO pin. + * + * @param pin_number specifies the pin number (0-31) to + * read. + * + * @retval Sense configuration + */ +__STATIC_INLINE nrf_gpio_pin_sense_t nrf_gpio_pin_sense_get(uint32_t pin_number); + +/** + * @brief Generic function for writing a single byte of a 32 bit word at a given + * address. + * + * This function should not be called from outside the nrf_gpio + * abstraction layer. + * + * @param word_address is the address of the word to be written. + * + * @param byte_no is the word byte number (0-3) to be written. + * + * @param value is the value to be written to byte "byte_no" of word + * at address "word_address" + */ +__STATIC_INLINE void nrf_gpio_word_byte_write(volatile uint32_t * word_address, uint8_t byte_no, uint8_t value); + +/** + * @brief Generic function for reading a single byte of a 32 bit word at a given + * address. + * + * This function should not be called from outside the nrf_gpio + * abstraction layer. + * + * @param word_address is the address of the word to be read. + * + * @param byte_no is the byte number (0-3) of the word to be read. + * + * @return byte "byte_no" of word at address "word_address". + */ +__STATIC_INLINE uint8_t nrf_gpio_word_byte_read(const volatile uint32_t* word_address, uint8_t byte_no); + +/** + * @brief Function for setting the direction of a port. + * + * @param port is the port for which to set the direction. + * + * @param dir direction to be set for this port. + */ +__STATIC_INLINE void nrf_gpio_port_dir_set(nrf_gpio_port_select_t port, nrf_gpio_port_dir_t dir); + +/** + * @brief Function for reading a GPIO port. + * + * @param port is the port to read. + * + * @return the input value on this port. + */ +__STATIC_INLINE uint8_t nrf_gpio_port_read(nrf_gpio_port_select_t port); + +/** + * @brief Function for writing to a GPIO port. + * + * @param port is the port to write. + * + * @param value is the value to write to this port. + * + * @sa nrf_gpio_port_dir_set() + */ +__STATIC_INLINE void nrf_gpio_port_write(nrf_gpio_port_select_t port, uint8_t value); + +/** + * @brief Function for setting individual pins on GPIO port. + * + * @param port is the port for which to set the pins. + * + * @param set_mask is a mask specifying which pins to set. A bit + * set to 1 indicates that the corresponding port pin shall be + * set. + * + * @sa nrf_gpio_port_dir_set() + */ +__STATIC_INLINE void nrf_gpio_port_set(nrf_gpio_port_select_t port, uint8_t set_mask); + +/** + * @brief Function for clearing individual pins on GPIO port. + * + * @param port is the port for which to clear the pins. + * + * @param clr_mask is a mask specifying which pins to clear. A bit + * set to 1 indicates that the corresponding port pin shall be + * cleared. + * + * @sa nrf_gpio_port_dir_set() + */ +__STATIC_INLINE void nrf_gpio_port_clear(nrf_gpio_port_select_t port, uint8_t clr_mask); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE void nrf_gpio_range_cfg_output(uint32_t pin_range_start, uint32_t pin_range_end) +{ + /*lint -e{845} // A zero has been given as right argument to operator '|'" */ + for (; pin_range_start <= pin_range_end; pin_range_start++) + { + nrf_gpio_cfg_output(pin_range_start); + } +} + +__STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, uint32_t pin_range_end, nrf_gpio_pin_pull_t pull_config) +{ + /*lint -e{845} // A zero has been given as right argument to operator '|'" */ + for (; pin_range_start <= pin_range_end; pin_range_start++) + { + nrf_gpio_cfg_input(pin_range_start, pull_config); + } +} + +__STATIC_INLINE void nrf_gpio_cfg( + uint32_t pin_number, + nrf_gpio_pin_dir_t dir, + nrf_gpio_pin_input_t input, + nrf_gpio_pin_pull_t pull, + nrf_gpio_pin_drive_t drive, + nrf_gpio_pin_sense_t sense) +{ + NRF_GPIO->PIN_CNF[pin_number] = ((uint32_t)dir << GPIO_PIN_CNF_DIR_Pos) + | ((uint32_t)input << GPIO_PIN_CNF_INPUT_Pos) + | ((uint32_t)pull << GPIO_PIN_CNF_PULL_Pos) + | ((uint32_t)drive << GPIO_PIN_CNF_DRIVE_Pos) + | ((uint32_t)sense << GPIO_PIN_CNF_SENSE_Pos); +} + +__STATIC_INLINE void nrf_gpio_cfg_output(uint32_t pin_number) +{ + nrf_gpio_cfg( + pin_number, + NRF_GPIO_PIN_DIR_OUTPUT, + NRF_GPIO_PIN_INPUT_DISCONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); +} + +__STATIC_INLINE void nrf_gpio_cfg_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config) +{ + nrf_gpio_cfg( + pin_number, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + pull_config, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); +} + +__STATIC_INLINE void nrf_gpio_cfg_default(uint32_t pin_number) +{ + nrf_gpio_cfg( + pin_number, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_DISCONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); +} + +__STATIC_INLINE void nrf_gpio_cfg_watcher(uint32_t pin_number) +{ + /*lint -e{845} // A zero has been given as right argument to operator '|'" */ + uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_INPUT_Msk; + NRF_GPIO->PIN_CNF[pin_number] = cnf | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos); +} + +__STATIC_INLINE void nrf_gpio_input_disconnect(uint32_t pin_number) +{ + /*lint -e{845} // A zero has been given as right argument to operator '|'" */ + uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_INPUT_Msk; + NRF_GPIO->PIN_CNF[pin_number] = cnf | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos); +} + +__STATIC_INLINE void nrf_gpio_cfg_sense_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config, nrf_gpio_pin_sense_t sense_config) +{ + nrf_gpio_cfg( + pin_number, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + pull_config, + NRF_GPIO_PIN_S0S1, + sense_config); +} + +__STATIC_INLINE void nrf_gpio_cfg_sense_set(uint32_t pin_number, nrf_gpio_pin_sense_t sense_config) +{ + /*lint -e{845} // A zero has been given as right argument to operator '|'" */ + //uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_SENSE_Msk; + NRF_GPIO->PIN_CNF[pin_number] &= ~GPIO_PIN_CNF_SENSE_Msk; + NRF_GPIO->PIN_CNF[pin_number] |= (sense_config << GPIO_PIN_CNF_SENSE_Pos); +} + +__STATIC_INLINE void nrf_gpio_pin_dir_set(uint32_t pin_number, nrf_gpio_pin_dir_t direction) +{ + if(direction == NRF_GPIO_PIN_DIR_INPUT) + { + nrf_gpio_cfg( + pin_number, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); + } + else + { + NRF_GPIO->DIRSET = (1UL << pin_number); + } +} + +__STATIC_INLINE void nrf_gpio_pin_set(uint32_t pin_number) +{ + NRF_GPIO->OUTSET = (1UL << pin_number); +} + +__STATIC_INLINE void nrf_gpio_pins_set(uint32_t pin_mask) +{ + NRF_GPIO->OUTSET = pin_mask; +} + +__STATIC_INLINE void nrf_gpio_pin_clear(uint32_t pin_number) +{ + NRF_GPIO->OUTCLR = (1UL << pin_number); +} + +__STATIC_INLINE void nrf_gpio_pins_clear(uint32_t pin_mask) +{ + NRF_GPIO->OUTCLR = pin_mask; +} + +__STATIC_INLINE void nrf_gpio_pin_toggle(uint32_t pin_number) +{ + nrf_gpio_pins_toggle(1UL << pin_number); +} + +__STATIC_INLINE void nrf_gpio_pins_toggle(uint32_t pin_mask) +{ + uint32_t pins_state = NRF_GPIO->OUT; + NRF_GPIO->OUTSET = (~pins_state & pin_mask); + NRF_GPIO->OUTCLR = ( pins_state & pin_mask); +} + +__STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value) +{ + if (value == 0) + { + nrf_gpio_pin_clear(pin_number); + } + else + { + nrf_gpio_pin_set(pin_number); + } +} + +__STATIC_INLINE uint32_t nrf_gpio_pin_read(uint32_t pin_number) +{ + return ((NRF_GPIO->IN >> pin_number) & 1UL); +} + +__STATIC_INLINE uint32_t nrf_gpio_pins_read(void) +{ + return NRF_GPIO->IN; +} + +__STATIC_INLINE nrf_gpio_pin_sense_t nrf_gpio_pin_sense_get(uint32_t pin_number) +{ + return (nrf_gpio_pin_sense_t)((NRF_GPIO->PIN_CNF[pin_number] & GPIO_PIN_CNF_SENSE_Msk) >> GPIO_PIN_CNF_SENSE_Pos); +} + +__STATIC_INLINE void nrf_gpio_word_byte_write(volatile uint32_t * word_address, uint8_t byte_no, uint8_t value) +{ + *((volatile uint8_t*)(word_address) + byte_no) = value; +} + +__STATIC_INLINE uint8_t nrf_gpio_word_byte_read(const volatile uint32_t* word_address, uint8_t byte_no) +{ + return (*((const volatile uint8_t*)(word_address) + byte_no)); +} + +__STATIC_INLINE void nrf_gpio_port_dir_set(nrf_gpio_port_select_t port, nrf_gpio_port_dir_t dir) +{ + if (dir == NRF_GPIO_PORT_DIR_OUTPUT) + { + nrf_gpio_word_byte_write(&NRF_GPIO->DIRSET, port, 0xFF); + } + else + { + nrf_gpio_range_cfg_input(port*8, (port+1)*8-1, NRF_GPIO_PIN_NOPULL); + } +} + +__STATIC_INLINE uint8_t nrf_gpio_port_read(nrf_gpio_port_select_t port) +{ + return nrf_gpio_word_byte_read(&NRF_GPIO->IN, port); +} + +__STATIC_INLINE void nrf_gpio_port_write(nrf_gpio_port_select_t port, uint8_t value) +{ + nrf_gpio_word_byte_write(&NRF_GPIO->OUT, port, value); +} + +__STATIC_INLINE void nrf_gpio_port_set(nrf_gpio_port_select_t port, uint8_t set_mask) +{ + nrf_gpio_word_byte_write(&NRF_GPIO->OUTSET, port, set_mask); +} + +__STATIC_INLINE void nrf_gpio_port_clear(nrf_gpio_port_select_t port, uint8_t clr_mask) +{ + nrf_gpio_word_byte_write(&NRF_GPIO->OUTCLR, port, clr_mask); +} +#endif //SUPPRESS_INLINE_IMPLEMENTATION +/** @} */ + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpiote.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpiote.h new file mode 100644 index 0000000000..7ad15e6398 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpiote.h @@ -0,0 +1,418 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_GPIOTE_H__ +#define NRF_GPIOTE_H__ + +#include "nrf.h" +#include +#include +#include + +/** +* @defgroup nrf_gpiote_abs GPIOTE abstraction +* @{ +* @ingroup nrf_gpiote +* @brief GPIOTE abstraction for configuration of channels. +*/ +#ifdef NRF51 +#define NUMBER_OF_GPIO_TE 4 +#elif defined(NRF52) +#define NUMBER_OF_GPIO_TE 8 +#else +#error "Chip family not specified" +#endif + + /** + * @enum nrf_gpiote_polarity_t + * @brief Polarity for the GPIOTE channel. + */ +typedef enum +{ + NRF_GPIOTE_POLARITY_LOTOHI = GPIOTE_CONFIG_POLARITY_LoToHi, ///< Low to high. + NRF_GPIOTE_POLARITY_HITOLO = GPIOTE_CONFIG_POLARITY_HiToLo, ///< High to low. + NRF_GPIOTE_POLARITY_TOGGLE = GPIOTE_CONFIG_POLARITY_Toggle ///< Toggle. +} nrf_gpiote_polarity_t; + + + /** + * @enum nrf_gpiote_outinit_t + * @brief Initial output value for the GPIOTE channel. + */ +typedef enum +{ + NRF_GPIOTE_INITIAL_VALUE_LOW = GPIOTE_CONFIG_OUTINIT_Low, ///< Low to high. + NRF_GPIOTE_INITIAL_VALUE_HIGH = GPIOTE_CONFIG_OUTINIT_High ///< High to low. +} nrf_gpiote_outinit_t; + +/** + * @brief Tasks. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_GPIOTE_TASKS_OUT_0 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[0]), /**< Out task 0.*/ + NRF_GPIOTE_TASKS_OUT_1 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[1]), /**< Out task 1.*/ + NRF_GPIOTE_TASKS_OUT_2 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[2]), /**< Out task 2.*/ + NRF_GPIOTE_TASKS_OUT_3 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[3]), /**< Out task 3.*/ +#if (NUMBER_OF_GPIO_TE == 8) + NRF_GPIOTE_TASKS_OUT_4 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[4]), /**< Out task 4.*/ + NRF_GPIOTE_TASKS_OUT_5 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[5]), /**< Out task 5.*/ + NRF_GPIOTE_TASKS_OUT_6 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[6]), /**< Out task 6.*/ + NRF_GPIOTE_TASKS_OUT_7 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[7]), /**< Out task 7.*/ +#endif +#ifdef NRF52 + NRF_GPIOTE_TASKS_SET_0 = offsetof(NRF_GPIOTE_Type, TASKS_SET[0]), /**< Set task 0.*/ + NRF_GPIOTE_TASKS_SET_1 = offsetof(NRF_GPIOTE_Type, TASKS_SET[1]), /**< Set task 1.*/ + NRF_GPIOTE_TASKS_SET_2 = offsetof(NRF_GPIOTE_Type, TASKS_SET[2]), /**< Set task 2.*/ + NRF_GPIOTE_TASKS_SET_3 = offsetof(NRF_GPIOTE_Type, TASKS_SET[3]), /**< Set task 3.*/ + NRF_GPIOTE_TASKS_SET_4 = offsetof(NRF_GPIOTE_Type, TASKS_SET[4]), /**< Set task 4.*/ + NRF_GPIOTE_TASKS_SET_5 = offsetof(NRF_GPIOTE_Type, TASKS_SET[5]), /**< Set task 5.*/ + NRF_GPIOTE_TASKS_SET_6 = offsetof(NRF_GPIOTE_Type, TASKS_SET[6]), /**< Set task 6.*/ + NRF_GPIOTE_TASKS_SET_7 = offsetof(NRF_GPIOTE_Type, TASKS_SET[7]), /**< Set task 7.*/ + NRF_GPIOTE_TASKS_CLR_0 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[0]), /**< Clear task 0.*/ + NRF_GPIOTE_TASKS_CLR_1 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[1]), /**< Clear task 1.*/ + NRF_GPIOTE_TASKS_CLR_2 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[2]), /**< Clear task 2.*/ + NRF_GPIOTE_TASKS_CLR_3 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[3]), /**< Clear task 3.*/ + NRF_GPIOTE_TASKS_CLR_4 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[4]), /**< Clear task 4.*/ + NRF_GPIOTE_TASKS_CLR_5 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[5]), /**< Clear task 5.*/ + NRF_GPIOTE_TASKS_CLR_6 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[6]), /**< Clear task 6.*/ + NRF_GPIOTE_TASKS_CLR_7 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[7]), /**< Clear task 7.*/ +#endif + /*lint -restore*/ +} nrf_gpiote_tasks_t; + +/** + * @brief Events. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_GPIOTE_EVENTS_IN_0 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[0]), /**< In event 0.*/ + NRF_GPIOTE_EVENTS_IN_1 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[1]), /**< In event 1.*/ + NRF_GPIOTE_EVENTS_IN_2 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[2]), /**< In event 2.*/ + NRF_GPIOTE_EVENTS_IN_3 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[3]), /**< In event 3.*/ +#if (NUMBER_OF_GPIO_TE == 8) + NRF_GPIOTE_EVENTS_IN_4 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[4]), /**< In event 4.*/ + NRF_GPIOTE_EVENTS_IN_5 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[5]), /**< In event 5.*/ + NRF_GPIOTE_EVENTS_IN_6 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[6]), /**< In event 6.*/ + NRF_GPIOTE_EVENTS_IN_7 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[7]), /**< In event 7.*/ +#endif + NRF_GPIOTE_EVENTS_PORT = offsetof(NRF_GPIOTE_Type, EVENTS_PORT), /**< Port event.*/ + /*lint -restore*/ +} nrf_gpiote_events_t; + +/** + * @enum nrf_gpiote_int_t + * @brief GPIOTE interrupts. + */ +typedef enum +{ + NRF_GPIOTE_INT_IN0_MASK = GPIOTE_INTENSET_IN0_Msk, /**< GPIOTE interrupt from IN0. */ + NRF_GPIOTE_INT_IN1_MASK = GPIOTE_INTENSET_IN1_Msk, /**< GPIOTE interrupt from IN1. */ + NRF_GPIOTE_INT_IN2_MASK = GPIOTE_INTENSET_IN2_Msk, /**< GPIOTE interrupt from IN2. */ + NRF_GPIOTE_INT_IN3_MASK = GPIOTE_INTENSET_IN3_Msk, /**< GPIOTE interrupt from IN3. */ +#if (NUMBER_OF_GPIO_TE == 8) + NRF_GPIOTE_INT_IN4_MASK = GPIOTE_INTENSET_IN4_Msk, /**< GPIOTE interrupt from IN4. */ + NRF_GPIOTE_INT_IN5_MASK = GPIOTE_INTENSET_IN5_Msk, /**< GPIOTE interrupt from IN5. */ + NRF_GPIOTE_INT_IN6_MASK = GPIOTE_INTENSET_IN6_Msk, /**< GPIOTE interrupt from IN6. */ + NRF_GPIOTE_INT_IN7_MASK = GPIOTE_INTENSET_IN7_Msk, /**< GPIOTE interrupt from IN7. */ +#endif + NRF_GPIOTE_INT_PORT_MASK = (int)GPIOTE_INTENSET_PORT_Msk, /**< GPIOTE interrupt from PORT event. */ +} nrf_gpiote_int_t; + +#if (NUMBER_OF_GPIO_TE == 4) +#define NRF_GPIOTE_INT_IN_MASK (NRF_GPIOTE_INT_IN0_MASK | NRF_GPIOTE_INT_IN1_MASK |\ + NRF_GPIOTE_INT_IN2_MASK | NRF_GPIOTE_INT_IN3_MASK) +#elif (NUMBER_OF_GPIO_TE == 8) +#define NRF_GPIOTE_INT_IN_MASK (NRF_GPIOTE_INT_IN0_MASK | NRF_GPIOTE_INT_IN1_MASK |\ + NRF_GPIOTE_INT_IN2_MASK | NRF_GPIOTE_INT_IN3_MASK |\ + NRF_GPIOTE_INT_IN4_MASK | NRF_GPIOTE_INT_IN5_MASK |\ + NRF_GPIOTE_INT_IN6_MASK | NRF_GPIOTE_INT_IN7_MASK) +#else +#error "Unexpected number of GPIO Tasks and Events" +#endif +/** + * @brief Function for activating a specific GPIOTE task. + * + * @param[in] task Task. + */ +__STATIC_INLINE void nrf_gpiote_task_set(nrf_gpiote_tasks_t task); + +/** + * @brief Function for getting the address of a specific GPIOTE task. + * + * @param[in] task Task. + * + * @returns Address. + */ +__STATIC_INLINE uint32_t nrf_gpiote_task_addr_get(nrf_gpiote_tasks_t task); + +/** + * @brief Function for getting the state of a specific GPIOTE event. + * + * @param[in] event Event. + */ +__STATIC_INLINE bool nrf_gpiote_event_is_set(nrf_gpiote_events_t event); + +/** + * @brief Function for clearing a specific GPIOTE event. + * + * @param[in] event Event. + */ +__STATIC_INLINE void nrf_gpiote_event_clear(nrf_gpiote_events_t event); + +/** + * @brief Function for getting the address of a specific GPIOTE event. + * + * @param[in] event Event. + * + * @return Address + */ +__STATIC_INLINE uint32_t nrf_gpiote_event_addr_get(nrf_gpiote_events_t event); + +/**@brief Function for enabling interrupts. + * + * @param[in] mask Interrupt mask to be enabled. + */ +__STATIC_INLINE void nrf_gpiote_int_enable(uint32_t mask); + +/**@brief Function for disabling interrupts. + * + * @param[in] mask Interrupt mask to be disabled. + */ +__STATIC_INLINE void nrf_gpiote_int_disable(uint32_t mask); + +/**@brief Function for checking if interrupts are enabled. + * + * @param[in] mask Mask of interrupt flags to check. + * + * @return Mask with enabled interrupts. + */ +__STATIC_INLINE uint32_t nrf_gpiote_int_is_enabled(uint32_t mask); + +/**@brief Function for enabling a GPIOTE event. + * + * @param[in] idx Task-Event index. + */ +__STATIC_INLINE void nrf_gpiote_event_enable(uint32_t idx); + +/**@brief Function for disabling a GPIOTE event. + * + * @param[in] idx Task-Event index. + */ +__STATIC_INLINE void nrf_gpiote_event_disable(uint32_t idx); + +/**@brief Function for configuring a GPIOTE event. + * + * @param[in] idx Task-Event index. + * @param[in] pin Pin associated with event. + * @param[in] polarity Transition that should generate an event. + */ +__STATIC_INLINE void nrf_gpiote_event_configure(uint32_t idx, uint32_t pin, + nrf_gpiote_polarity_t polarity); + +/**@brief Function for getting the pin associated with a GPIOTE event. + * + * @param[in] idx Task-Event index. + * + * @return Pin number. + */ +__STATIC_INLINE uint32_t nrf_gpiote_event_pin_get(uint32_t idx); + +/**@brief Function for getting the polarity associated with a GPIOTE event. + * + * @param[in] idx Task-Event index. + * + * @return Polarity. + */ +__STATIC_INLINE nrf_gpiote_polarity_t nrf_gpiote_event_polarity_get(uint32_t idx); + +/**@brief Function for enabling a GPIOTE task. + * + * @param[in] idx Task-Event index. + */ +__STATIC_INLINE void nrf_gpiote_task_enable(uint32_t idx); + +/**@brief Function for disabling a GPIOTE task. + * + * @param[in] idx Task-Event index. + */ +__STATIC_INLINE void nrf_gpiote_task_disable(uint32_t idx); + +/**@brief Function for configuring a GPIOTE task. + * @note Function is not configuring mode field so task is disabled after this function is called. + * + * @param[in] idx Task-Event index. + * @param[in] pin Pin associated with event. + * @param[in] polarity Transition that should generate an event. + * @param[in] init_val Initial value of pin. + */ +__STATIC_INLINE void nrf_gpiote_task_configure(uint32_t idx, uint32_t pin, + nrf_gpiote_polarity_t polarity, + nrf_gpiote_outinit_t init_val); + +/**@brief Function for forcing a specific state on the pin connected to GPIOTE. + * + * @param[in] idx Task-Event index. + * @param[in] init_val Pin state. + */ +__STATIC_INLINE void nrf_gpiote_task_force(uint32_t idx, nrf_gpiote_outinit_t init_val); + +/**@brief Function for resetting a GPIOTE task event configuration to the default state. + * + * @param[in] idx Task-Event index. + */ +__STATIC_INLINE void nrf_gpiote_te_default(uint32_t idx); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE void nrf_gpiote_task_set(nrf_gpiote_tasks_t task) +{ + *(__IO uint32_t *)((uint32_t)NRF_GPIOTE + task) = 0x1UL; +} + +__STATIC_INLINE uint32_t nrf_gpiote_task_addr_get(nrf_gpiote_tasks_t task) +{ + return ((uint32_t)NRF_GPIOTE + task); +} + +__STATIC_INLINE bool nrf_gpiote_event_is_set(nrf_gpiote_events_t event) +{ + return (*(uint32_t *)nrf_gpiote_event_addr_get(event) == 0x1UL) ? true : false; +} + +__STATIC_INLINE void nrf_gpiote_event_clear(nrf_gpiote_events_t event) +{ + *(uint32_t *)nrf_gpiote_event_addr_get(event) = 0; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)nrf_gpiote_event_addr_get(event)); + (void)dummy; +#endif +} + +__STATIC_INLINE uint32_t nrf_gpiote_event_addr_get(nrf_gpiote_events_t event) +{ + return ((uint32_t)NRF_GPIOTE + event); +} + +__STATIC_INLINE void nrf_gpiote_int_enable(uint32_t mask) +{ + NRF_GPIOTE->INTENSET = mask; +} + +__STATIC_INLINE void nrf_gpiote_int_disable(uint32_t mask) +{ + NRF_GPIOTE->INTENCLR = mask; +} + +__STATIC_INLINE uint32_t nrf_gpiote_int_is_enabled(uint32_t mask) +{ + return (NRF_GPIOTE->INTENSET & mask); +} + +__STATIC_INLINE void nrf_gpiote_event_enable(uint32_t idx) +{ + NRF_GPIOTE->CONFIG[idx] |= GPIOTE_CONFIG_MODE_Event; +} + +__STATIC_INLINE void nrf_gpiote_event_disable(uint32_t idx) +{ + NRF_GPIOTE->CONFIG[idx] &= ~GPIOTE_CONFIG_MODE_Event; +} + +__STATIC_INLINE void nrf_gpiote_event_configure(uint32_t idx, uint32_t pin, nrf_gpiote_polarity_t polarity) +{ + NRF_GPIOTE->CONFIG[idx] &= ~(GPIOTE_CONFIG_PSEL_Msk | GPIOTE_CONFIG_POLARITY_Msk); + NRF_GPIOTE->CONFIG[idx] |= ((pin << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk) | + ((polarity << GPIOTE_CONFIG_POLARITY_Pos) & GPIOTE_CONFIG_POLARITY_Msk); +} + +__STATIC_INLINE uint32_t nrf_gpiote_event_pin_get(uint32_t idx) +{ + return ((NRF_GPIOTE->CONFIG[idx] & GPIOTE_CONFIG_PSEL_Msk) >> GPIOTE_CONFIG_PSEL_Pos); +} + +__STATIC_INLINE nrf_gpiote_polarity_t nrf_gpiote_event_polarity_get(uint32_t idx) +{ + return (nrf_gpiote_polarity_t)((NRF_GPIOTE->CONFIG[idx] & GPIOTE_CONFIG_POLARITY_Msk) >> GPIOTE_CONFIG_POLARITY_Pos); +} + +__STATIC_INLINE void nrf_gpiote_task_enable(uint32_t idx) +{ + uint32_t final_config = NRF_GPIOTE->CONFIG[idx] | GPIOTE_CONFIG_MODE_Task; + /* Workaround for the OUTINIT PAN. When nrf_gpiote_task_config() is called a glitch happens + on the GPIO if the GPIO in question is already assigned to GPIOTE and the pin is in the + correct state in GPIOTE but not in the OUT register. */ + /* Configure channel to Pin31, not connected to the pin, and configure as a tasks that will set it to proper level */ + NRF_GPIOTE->CONFIG[idx] = final_config | ((31 << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk); + __NOP(); + __NOP(); + __NOP(); + NRF_GPIOTE->CONFIG[idx] = final_config; +} + +__STATIC_INLINE void nrf_gpiote_task_disable(uint32_t idx) +{ + NRF_GPIOTE->CONFIG[idx] &= ~GPIOTE_CONFIG_MODE_Task; +} + +__STATIC_INLINE void nrf_gpiote_task_configure(uint32_t idx, uint32_t pin, + nrf_gpiote_polarity_t polarity, + nrf_gpiote_outinit_t init_val) +{ + NRF_GPIOTE->CONFIG[idx] &= ~(GPIOTE_CONFIG_PSEL_Msk | + GPIOTE_CONFIG_POLARITY_Msk | + GPIOTE_CONFIG_OUTINIT_Msk); + + NRF_GPIOTE->CONFIG[idx] |= ((pin << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk) | + ((polarity << GPIOTE_CONFIG_POLARITY_Pos) & GPIOTE_CONFIG_POLARITY_Msk) | + ((init_val << GPIOTE_CONFIG_OUTINIT_Pos) & GPIOTE_CONFIG_OUTINIT_Msk); +} + +__STATIC_INLINE void nrf_gpiote_task_force(uint32_t idx, nrf_gpiote_outinit_t init_val) +{ + NRF_GPIOTE->CONFIG[idx] = (NRF_GPIOTE->CONFIG[idx] & ~GPIOTE_CONFIG_OUTINIT_Msk) + | ((init_val << GPIOTE_CONFIG_OUTINIT_Pos) & GPIOTE_CONFIG_OUTINIT_Msk); +} + +__STATIC_INLINE void nrf_gpiote_te_default(uint32_t idx) +{ + NRF_GPIOTE->CONFIG[idx] = 0; +} +#endif //SUPPRESS_INLINE_IMPLEMENTATION +/** @} */ + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.c new file mode 100644 index 0000000000..de2a52db8c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.c @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + *@file + *@brief NMVC driver implementation + */ + +#include +#include "nrf.h" +#include "nrf_nvmc.h" + + +void nrf_nvmc_page_erase(uint32_t address) +{ + // Enable erase. + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } + + // Erase the page + NRF_NVMC->ERASEPAGE = address; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } + + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } +} + + +void nrf_nvmc_write_byte(uint32_t address, uint8_t value) +{ + uint32_t byte_shift = address & (uint32_t)0x03; + uint32_t address32 = address & ~byte_shift; // Address to the word this byte is in. + uint32_t value32 = (*(uint32_t*)address32 & ~((uint32_t)0xFF << (byte_shift << (uint32_t)3))); + value32 = value32 + ((uint32_t)value << (byte_shift << 3)); + + // Enable write. + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } + + *(uint32_t*)address32 = value32; + while(NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } + + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); + { + } +} + +void nrf_nvmc_write_word(uint32_t address, uint32_t value) +{ + // Enable write. + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ + } + + *(uint32_t*)address = value; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ + } + + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } +} + +void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes) +{ + uint32_t i; + for(i=0;iCONFIG = NVMC_CONFIG_WEN_Wen; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } + + for(i=0;iREADY == NVMC_READY_READY_Busy) + { + } + } + + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.h new file mode 100644 index 0000000000..59b23f1845 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file + * @brief NMVC driver API. + */ + +#ifndef NRF_NVMC_H__ +#define NRF_NVMC_H__ + +#include + + +/** + * @defgroup nrf_nvmc Non-volatile memory controller + * @{ + * @ingroup nrf_drivers + * @brief Driver for the NVMC peripheral. + * + * This driver allows writing to the non-volatile memory (NVM) regions + * of the chip. In order to write to NVM the controller must be powered + * on and the relevant page must be erased. + * + */ + + +/** + * @brief Erase a page in flash. This is required before writing to any + * address in the page. + * + * @param address Start address of the page. + */ +void nrf_nvmc_page_erase(uint32_t address); + + +/** + * @brief Write a single byte to flash. + * + * The function reads the word containing the byte, and then + * rewrites the entire word. + * + * @param address Address to write to. + * @param value Value to write. + */ +void nrf_nvmc_write_byte(uint32_t address , uint8_t value); + + +/** + * @brief Write a 32-bit word to flash. + * @param address Address to write to. + * @param value Value to write. + */ +void nrf_nvmc_write_word(uint32_t address, uint32_t value); + + +/** + * @brief Write consecutive bytes to flash. + * + * @param address Address to write to. + * @param src Pointer to data to copy from. + * @param num_bytes Number of bytes in src to write. + */ +void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes); + + +/** + * @brief Write consecutive words to flash. + * + * @param address Address to write to. + * @param src Pointer to data to copy from. + * @param num_words Number of bytes in src to write. + */ +void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words); + + +#endif // NRF_NVMC_H__ +/** @} */ + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pdm.h new file mode 100644 index 0000000000..be41fdfae0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pdm.h @@ -0,0 +1,386 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef NRF_PDM_H_ +#define NRF_PDM_H_ + +/** + * @defgroup nrf_pdm_hal PDM HAL + * @{ + * @ingroup nrf_pdm + * + * @brief @tagAPI52 Hardware abstraction layer for accessing the pulse density modulation (PDM) peripheral. + */ + +#include +#include +#include "nrf.h" +#include "nrf_assert.h" + + +#define NRF_PDM_GAIN_MINIMUM 0x00 +#define NRF_PDM_GAIN_DEFAULT 0x28 +#define NRF_PDM_GAIN_MAXIMUM 0x50 + +typedef uint8_t nrf_pdm_gain_t; + + +/** + * @brief PDM tasks. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_PDM_TASK_START = offsetof(NRF_PDM_Type, TASKS_START), ///< Starts continuous PDM transfer. + NRF_PDM_TASK_STOP = offsetof(NRF_PDM_Type, TASKS_STOP) ///< Stops PDM transfer. +} nrf_pdm_task_t; + + +/** + * @brief PDM events. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_PDM_EVENT_STARTED = offsetof(NRF_PDM_Type, EVENTS_STARTED), ///< PDM transfer has started. + NRF_PDM_EVENT_STOPPED = offsetof(NRF_PDM_Type, EVENTS_STOPPED), ///< PDM transfer has finished. + NRF_PDM_EVENT_END = offsetof(NRF_PDM_Type, EVENTS_END) ///< The PDM has written the last sample specified by SAMPLE.MAXCNT (or the last sample after a STOP task has been received) to Data RAM. +} nrf_pdm_event_t; + + +/** + * @brief PDM interrupt masks. + */ +typedef enum +{ + NRF_PDM_INT_STARTED = PDM_INTENSET_STARTED_Msk, ///< Interrupt on EVENTS_STARTED event. + NRF_PDM_INT_STOPPED = PDM_INTENSET_STOPPED_Msk, ///< Interrupt on EVENTS_STOPPED event. + NRF_PDM_INT_END = PDM_INTENSET_END_Msk ///< Interrupt on EVENTS_END event. +} nrf_pdm_int_mask_t; + +/** + * @brief PDM clock frequency. + */ +typedef enum +{ + NRF_PDM_FREQ_1000K = PDM_PDMCLKCTRL_FREQ_1000K, ///< PDM_CLK = 1.000 MHz. + NRF_PDM_FREQ_1032K = PDM_PDMCLKCTRL_FREQ_Default, ///< PDM_CLK = 1.032 MHz. + NRF_PDM_FREQ_1067K = PDM_PDMCLKCTRL_FREQ_1067K ///< PDM_CLK = 1.067 MHz. +} nrf_pdm_freq_t; + + +/** + * @brief PDM operation mode. + */ +typedef enum +{ + NRF_PDM_MODE_STEREO = PDM_MODE_OPERATION_Stereo, ///< Sample and store one pair (Left + Right) of 16-bit samples per RAM word. + NRF_PDM_MODE_MONO = PDM_MODE_OPERATION_Mono ///< Sample and store two successive Left samples (16 bit each) per RAM word. +} nrf_pdm_mode_t; + + +/** + * @brief PDM sampling mode. + */ +typedef enum +{ + NRF_PDM_EDGE_LEFTFALLING = PDM_MODE_EDGE_LeftFalling, ///< Left (or mono) is sampled on falling edge of PDM_CLK. + NRF_PDM_EDGE_LEFTRISING = PDM_MODE_EDGE_LeftRising ///< Left (or mono) is sampled on rising edge of PDM_CLK. +} nrf_pdm_edge_t; + + +/** + * @brief Function for triggering a PDM task. + * + * @param[in] pdm_task PDM task. + */ +__STATIC_INLINE void nrf_pdm_task_trigger(nrf_pdm_task_t pdm_task) +{ + *((volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_task)) = 0x1UL; +} + + +/** + * @brief Function for getting the address of a PDM task register. + * + * @param[in] pdm_task PDM task. + * + * @return Address of the specified PDM task. + */ +__STATIC_INLINE uint32_t nrf_pdm_task_address_get(nrf_pdm_task_t pdm_task) +{ + return (uint32_t)((uint8_t *)NRF_PDM + (uint32_t)pdm_task); +} + + +/** + * @brief Function for getting the state of a PDM event. + * + * @param[in] pdm_event PDM event. + * + * @return State of the specified PDM event. + */ +__STATIC_INLINE bool nrf_pdm_event_check(nrf_pdm_event_t pdm_event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_event); +} + + +/** + * @brief Function for clearing a PDM event. + * + * @param[in] pdm_event PDM event. + */ +__STATIC_INLINE void nrf_pdm_event_clear(nrf_pdm_event_t pdm_event) +{ + *((volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_event)) = 0x0UL; +} + + +/** + * @brief Function for getting the address of a PDM event register. + * + * @param[in] pdm_event PDM event. + * + * @return Address of the specified PDM event. + */ +__STATIC_INLINE volatile uint32_t * nrf_pdm_event_address_get(nrf_pdm_event_t pdm_event) +{ + return (volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_event); +} + + +/** + * @brief Function for enabling PDM interrupts. + * + * @param[in] pdm_int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_pdm_int_enable(uint32_t pdm_int_mask) +{ + NRF_PDM->INTENSET = pdm_int_mask; +} + + +/** + * @brief Function for retrieving the state of PDM interrupts. + * + * @param[in] pdm_int_mask Interrupts to check. + * + * @retval true If all specified interrupts are enabled. + * @retval false If at least one of the given interrupts is not enabled. + */ +__STATIC_INLINE bool nrf_pdm_int_enable_check(uint32_t pdm_int_mask) +{ + return (bool)(NRF_PDM->INTENSET & pdm_int_mask); +} + + +/** + * @brief Function for disabling interrupts. + * + * @param pdm_int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_pdm_int_disable(uint32_t pdm_int_mask) +{ + NRF_PDM->INTENCLR = pdm_int_mask; +} + + +/** + * @brief Function for enabling the PDM peripheral. + * + * The PDM peripheral must be enabled before use. + */ +__STATIC_INLINE void nrf_pdm_enable(void) +{ + NRF_PDM->ENABLE = (PDM_ENABLE_ENABLE_Enabled << PDM_ENABLE_ENABLE_Pos); +} + + +/** + * @brief Function for disabling the PDM peripheral. + */ +__STATIC_INLINE void nrf_pdm_disable(void) +{ + NRF_PDM->ENABLE = (PDM_ENABLE_ENABLE_Disabled << PDM_ENABLE_ENABLE_Pos); +} + + +/** + * @brief Function for checking if the PDM peripheral is enabled. + * + * @retval true If the PDM peripheral is enabled. + * @retval false If the PDM peripheral is not enabled. + */ +__STATIC_INLINE bool nrf_pdm_enable_check(void) +{ + return (NRF_PDM->ENABLE == (PDM_ENABLE_ENABLE_Enabled << PDM_ENABLE_ENABLE_Pos)); +} + + +/** + * @brief Function for setting the PDM operation mode. + * + * @param[in] pdm_mode PDM operation mode. + * @param[in] pdm_edge PDM sampling mode. + */ +__STATIC_INLINE void nrf_pdm_mode_set(nrf_pdm_mode_t pdm_mode, nrf_pdm_edge_t pdm_edge) +{ + NRF_PDM->MODE = ((pdm_mode << PDM_MODE_OPERATION_Pos) & PDM_MODE_OPERATION_Msk) + | ((pdm_edge << PDM_MODE_EDGE_Pos) & PDM_MODE_EDGE_Msk); +} + + +/** + * @brief Function for getting the PDM operation mode. + * + * @param[out] p_pdm_mode PDM operation mode. + * @param[out] p_pdm_edge PDM sampling mode. + */ +__STATIC_INLINE void nrf_pdm_mode_get(nrf_pdm_mode_t * p_pdm_mode, nrf_pdm_edge_t * p_pdm_edge) +{ + uint32_t mode = NRF_PDM->MODE; + *p_pdm_mode = (nrf_pdm_mode_t)((mode & PDM_MODE_OPERATION_Msk ) >> PDM_MODE_OPERATION_Pos); + *p_pdm_edge = (nrf_pdm_edge_t)((mode & PDM_MODE_EDGE_Msk ) >> PDM_MODE_EDGE_Pos); +} + + +/** + * @brief Function for setting the PDM clock frequency. + * + * @param[in] pdm_freq PDM clock frequency. + */ +__STATIC_INLINE void nrf_pdm_clock_set(nrf_pdm_freq_t pdm_freq) +{ + NRF_PDM->PDMCLKCTRL = ((pdm_freq << PDM_PDMCLKCTRL_FREQ_Pos) & PDM_PDMCLKCTRL_FREQ_Msk); +} + + +/** + * @brief Function for getting the PDM clock frequency. + */ +__STATIC_INLINE nrf_pdm_freq_t nrf_pdm_clock_get(void) +{ + return (nrf_pdm_freq_t) ((NRF_PDM->PDMCLKCTRL << PDM_PDMCLKCTRL_FREQ_Pos) & PDM_PDMCLKCTRL_FREQ_Msk); +} + + +/** + * @brief Function for setting up the PDM pins. + * + * @param[in] psel_clk CLK pin number. + * @param[in] psel_din DIN pin number. + */ +__STATIC_INLINE void nrf_pdm_psel_connect(uint32_t psel_clk, uint32_t psel_din) +{ + NRF_PDM->PSEL.CLK = ((psel_clk << PDM_PSEL_CLK_PIN_Pos) & PDM_PSEL_CLK_PIN_Msk) + | ((PDM_PSEL_CLK_CONNECT_Connected << PDM_PSEL_CLK_CONNECT_Pos) & PDM_PSEL_CLK_CONNECT_Msk); + NRF_PDM->PSEL.DIN = ((psel_din << PDM_PSEL_DIN_PIN_Pos) & PDM_PSEL_DIN_PIN_Msk) + | ((PDM_PSEL_DIN_CONNECT_Connected << PDM_PSEL_CLK_CONNECT_Pos) & PDM_PSEL_DIN_CONNECT_Msk); +} + +/** + * @brief Function for disconnecting the PDM pins. + */ +__STATIC_INLINE void nrf_pdm_psel_disconnect() +{ + NRF_PDM->PSEL.CLK = ((PDM_PSEL_CLK_CONNECT_Disconnected << PDM_PSEL_CLK_CONNECT_Pos) + & PDM_PSEL_CLK_CONNECT_Msk); + NRF_PDM->PSEL.DIN = ((PDM_PSEL_DIN_CONNECT_Disconnected << PDM_PSEL_DIN_CONNECT_Pos) + & PDM_PSEL_DIN_CONNECT_Msk); +} + + +/** + * @brief Function for setting the PDM gain. + * + * @param[in] gain_l Left channel gain. + * @param[in] gain_r Right channel gain. + */ +__STATIC_INLINE void nrf_pdm_gain_set(nrf_pdm_gain_t gain_l, nrf_pdm_gain_t gain_r) +{ + NRF_PDM->GAINL = gain_l; + NRF_PDM->GAINR = gain_r; +} + + +/** + * @brief Function for getting the PDM gain. + * + * @param[out] p_gain_l Left channel gain. + * @param[out] p_gain_r Right channel gain. + */ +__STATIC_INLINE void nrf_pdm_gain_get(nrf_pdm_gain_t * p_gain_l, nrf_pdm_gain_t * p_gain_r) +{ + *p_gain_l = NRF_PDM->GAINL; + *p_gain_r = NRF_PDM->GAINR; +} + + +/** + * @brief Function for setting the PDM sample buffer. + * + * @param[in] p_buffer Pointer to the RAM address where samples should be written with EasyDMA. + * @param[in] num Number of samples to allocate memory for in EasyDMA mode. + * + * The amount of allocated RAM depends on the operation mode. + * - For stereo mode: N 32-bit words. + * - For mono mode: Ceil(N/2) 32-bit words. + */ +__STATIC_INLINE void nrf_pdm_buffer_set(uint32_t * p_buffer, uint32_t num) +{ + NRF_PDM->SAMPLE.PTR = (uint32_t)p_buffer; + NRF_PDM->SAMPLE.MAXCNT = num; +} + +/** + * @brief Function for getting the current PDM sample buffer address. + * + * @return Pointer to the current sample buffer. + */ +__STATIC_INLINE uint32_t * nrf_pdm_buffer_get() +{ + return (uint32_t *)NRF_PDM->SAMPLE.PTR; +} + + +/** + *@} + **/ + +#endif /* NRF_PDM_H_ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ppi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ppi.h new file mode 100644 index 0000000000..b501240fef --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ppi.h @@ -0,0 +1,429 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_PPI_H__ +#define NRF_PPI_H__ + +#include +#include "nrf.h" + +/** + * @defgroup nrf_ppi_hal PPI HAL + * @{ + * @ingroup nrf_ppi + * @brief Hardware access layer for setting up Programmable Peripheral Interconnect (PPI) channels. + */ + +#define NRF_PPI_TASK_SET (1UL) + +/** + * @enum nrf_ppi_channel_t + * @brief PPI channels. + */ +typedef enum +{ + NRF_PPI_CHANNEL0 = PPI_CHEN_CH0_Pos, /**< Channel 0. */ + NRF_PPI_CHANNEL1 = PPI_CHEN_CH1_Pos, /**< Channel 1. */ + NRF_PPI_CHANNEL2 = PPI_CHEN_CH2_Pos, /**< Channel 2. */ + NRF_PPI_CHANNEL3 = PPI_CHEN_CH3_Pos, /**< Channel 3. */ + NRF_PPI_CHANNEL4 = PPI_CHEN_CH4_Pos, /**< Channel 4. */ + NRF_PPI_CHANNEL5 = PPI_CHEN_CH5_Pos, /**< Channel 5. */ + NRF_PPI_CHANNEL6 = PPI_CHEN_CH6_Pos, /**< Channel 6. */ + NRF_PPI_CHANNEL7 = PPI_CHEN_CH7_Pos, /**< Channel 7. */ + NRF_PPI_CHANNEL8 = PPI_CHEN_CH8_Pos, /**< Channel 8. */ + NRF_PPI_CHANNEL9 = PPI_CHEN_CH9_Pos, /**< Channel 9. */ + NRF_PPI_CHANNEL10 = PPI_CHEN_CH10_Pos, /**< Channel 10. */ + NRF_PPI_CHANNEL11 = PPI_CHEN_CH11_Pos, /**< Channel 11. */ + NRF_PPI_CHANNEL12 = PPI_CHEN_CH12_Pos, /**< Channel 12. */ + NRF_PPI_CHANNEL13 = PPI_CHEN_CH13_Pos, /**< Channel 13. */ + NRF_PPI_CHANNEL14 = PPI_CHEN_CH14_Pos, /**< Channel 14. */ + NRF_PPI_CHANNEL15 = PPI_CHEN_CH15_Pos, /**< Channel 15. */ +#ifdef NRF52 + NRF_PPI_CHANNEL16 = PPI_CHEN_CH16_Pos, /**< Channel 16. */ + NRF_PPI_CHANNEL17 = PPI_CHEN_CH17_Pos, /**< Channel 17. */ + NRF_PPI_CHANNEL18 = PPI_CHEN_CH18_Pos, /**< Channel 18. */ + NRF_PPI_CHANNEL19 = PPI_CHEN_CH19_Pos, /**< Channel 19. */ +#endif + NRF_PPI_CHANNEL20 = PPI_CHEN_CH20_Pos, /**< Channel 20. */ + NRF_PPI_CHANNEL21 = PPI_CHEN_CH21_Pos, /**< Channel 21. */ + NRF_PPI_CHANNEL22 = PPI_CHEN_CH22_Pos, /**< Channel 22. */ + NRF_PPI_CHANNEL23 = PPI_CHEN_CH23_Pos, /**< Channel 23. */ + NRF_PPI_CHANNEL24 = PPI_CHEN_CH24_Pos, /**< Channel 24. */ + NRF_PPI_CHANNEL25 = PPI_CHEN_CH25_Pos, /**< Channel 25. */ + NRF_PPI_CHANNEL26 = PPI_CHEN_CH26_Pos, /**< Channel 26. */ + NRF_PPI_CHANNEL27 = PPI_CHEN_CH27_Pos, /**< Channel 27. */ + NRF_PPI_CHANNEL28 = PPI_CHEN_CH28_Pos, /**< Channel 28. */ + NRF_PPI_CHANNEL29 = PPI_CHEN_CH29_Pos, /**< Channel 29. */ + NRF_PPI_CHANNEL30 = PPI_CHEN_CH30_Pos, /**< Channel 30. */ + NRF_PPI_CHANNEL31 = PPI_CHEN_CH31_Pos /**< Channel 31. */ +} nrf_ppi_channel_t; + +/** + * @enum nrf_ppi_channel_group_t + * @brief PPI channel groups. + */ +typedef enum +{ + NRF_PPI_CHANNEL_GROUP0 = 0, /**< Channel group 0. */ + NRF_PPI_CHANNEL_GROUP1 = 1, /**< Channel group 1. */ + NRF_PPI_CHANNEL_GROUP2 = 2, /**< Channel group 2. */ + NRF_PPI_CHANNEL_GROUP3 = 3, /**< Channel group 3. */ +#ifdef NRF52 + NRF_PPI_CHANNEL_GROUP4 = 4, /**< Channel group 4. */ + NRF_PPI_CHANNEL_GROUP5 = 5 /**< Channel group 5. */ +#endif +} nrf_ppi_channel_group_t; + +/** + * @enum nrf_ppi_channel_include_t + * @brief Definition of which PPI channels belong to a group. + */ +typedef enum +{ + NRF_PPI_CHANNEL_EXCLUDE = PPI_CHG_CH0_Excluded, /**< Channel excluded from a group. */ + NRF_PPI_CHANNEL_INCLUDE = PPI_CHG_CH0_Included /**< Channel included in a group. */ +} nrf_ppi_channel_include_t; + +/** + * @enum nrf_ppi_channel_enable_t + * @brief Definition if a PPI channel is enabled. + */ +typedef enum +{ + NRF_PPI_CHANNEL_DISABLED = PPI_CHEN_CH0_Disabled, /**< Channel disabled. */ + NRF_PPI_CHANNEL_ENABLED = PPI_CHEN_CH0_Enabled /**< Channel enabled. */ +} nrf_ppi_channel_enable_t; + +/** + * @enum nrf_ppi_task_t + * @brief PPI tasks. + */ +typedef enum +{ + /*lint -save -e30 -esym(628,__INTADDR__)*/ + NRF_PPI_TASK_CHG0_EN = offsetof(NRF_PPI_Type, TASKS_CHG[0].EN), /**< Task for enabling channel group 0 */ + NRF_PPI_TASK_CHG0_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[0].DIS), /**< Task for disabling channel group 0 */ + NRF_PPI_TASK_CHG1_EN = offsetof(NRF_PPI_Type, TASKS_CHG[1].EN), /**< Task for enabling channel group 1 */ + NRF_PPI_TASK_CHG1_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[1].DIS), /**< Task for disabling channel group 1 */ + NRF_PPI_TASK_CHG2_EN = offsetof(NRF_PPI_Type, TASKS_CHG[2].EN), /**< Task for enabling channel group 2 */ + NRF_PPI_TASK_CHG2_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[2].DIS), /**< Task for disabling channel group 2 */ + NRF_PPI_TASK_CHG3_EN = offsetof(NRF_PPI_Type, TASKS_CHG[3].EN), /**< Task for enabling channel group 3 */ + NRF_PPI_TASK_CHG3_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[3].DIS), /**< Task for disabling channel group 3 */ +#ifdef NRF52 + NRF_PPI_TASK_CHG4_EN = offsetof(NRF_PPI_Type, TASKS_CHG[4].EN), /**< Task for enabling channel group 4 */ + NRF_PPI_TASK_CHG4_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[4].DIS), /**< Task for disabling channel group 4 */ + NRF_PPI_TASK_CHG5_EN = offsetof(NRF_PPI_Type, TASKS_CHG[5].EN), /**< Task for enabling channel group 5 */ + NRF_PPI_TASK_CHG5_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[5].DIS) /**< Task for disabling channel group 5 */ +#endif + /*lint -restore*/ +} nrf_ppi_task_t; + +/** + * @brief Function for enabling a given PPI channel. + * + * @details This function enables only one channel. + * + * @param[in] channel Channel to enable. + * + * */ +__STATIC_INLINE void nrf_ppi_channel_enable(nrf_ppi_channel_t channel) +{ + NRF_PPI->CHENSET = PPI_CHENSET_CH0_Set << ((uint32_t) channel); +} + + +/** + * @brief Function for disabling a given PPI channel. + * + * @details This function disables only one channel. + * + * @param[in] channel Channel to disable. + */ +__STATIC_INLINE void nrf_ppi_channel_disable(nrf_ppi_channel_t channel) +{ + NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Clear << ((uint32_t) channel); +} + + +/** + * @brief Function for checking if a given PPI channel is enabled. + * + * @details This function checks only one channel. + * + * @param[in] channel Channel to check. + * + * @retval NRF_PPI_CHANNEL_ENABLED If the channel is enabled. + * @retval NRF_PPI_CHANNEL_DISABLED If the channel is not enabled. + * + */ +__STATIC_INLINE nrf_ppi_channel_enable_t nrf_ppi_channel_enable_get(nrf_ppi_channel_t channel) +{ + if (NRF_PPI->CHEN & (PPI_CHEN_CH0_Msk << ((uint32_t) channel))) + { + return NRF_PPI_CHANNEL_ENABLED; + } + else + { + return NRF_PPI_CHANNEL_DISABLED; + } +} + + +/** + * @brief Function for disabling all PPI channels. + */ +__STATIC_INLINE void nrf_ppi_channel_disable_all(void) +{ + NRF_PPI->CHENCLR = ((uint32_t)0xFFFFFFFFuL); +} + +/** + * @brief Function for disabling multiple PPI channels. + * + * @param[in] mask Channel mask. + */ +__STATIC_INLINE void nrf_ppi_channels_disable(uint32_t mask) +{ + NRF_PPI->CHENCLR = mask; +} + +/** + * @brief Function for setting up event and task endpoints for a given PPI channel. + * + * @param[in] eep Event register address. + * + * @param[in] tep Task register address. + * + * @param[in] channel Channel to which the given endpoints are assigned. + */ +__STATIC_INLINE void nrf_ppi_channel_endpoint_setup(nrf_ppi_channel_t channel, + uint32_t eep, + uint32_t tep) +{ + NRF_PPI->CH[(uint32_t) channel].EEP = eep; + NRF_PPI->CH[(uint32_t) channel].TEP = tep; +} + +#ifdef NRF52 +/** + * @brief Function for setting up task endpoint for a given PPI fork. + * + * @param[in] fork_tep Task register address. + * + * @param[in] channel Channel to which the given fork endpoint is assigned. + */ +__STATIC_INLINE void nrf_ppi_fork_endpoint_setup(nrf_ppi_channel_t channel, + uint32_t fork_tep) +{ + NRF_PPI->FORK[(uint32_t) channel].TEP = fork_tep; +} + +/** + * @brief Function for setting up event and task endpoints for a given PPI channel and fork. + * + * @param[in] eep Event register address. + * + * @param[in] tep Task register address. + * + * @param[in] fork_tep Fork task register address (register value). + * + * @param[in] channel Channel to which the given endpoints are assigned. + */ +__STATIC_INLINE void nrf_ppi_channel_and_fork_endpoint_setup(nrf_ppi_channel_t channel, + uint32_t eep, + uint32_t tep, + uint32_t fork_tep) +{ + nrf_ppi_channel_endpoint_setup(channel, eep, tep); + nrf_ppi_fork_endpoint_setup(channel, fork_tep); +} +#endif + +/** + * @brief Function for including a PPI channel in a channel group. + * + * @details This function adds only one channel to the group. + * + * @param[in] channel Channel to be included in the group. + * + * @param[in] channel_group Channel group. + * + */ +__STATIC_INLINE void nrf_ppi_channel_include_in_group(nrf_ppi_channel_t channel, + nrf_ppi_channel_group_t channel_group) +{ + NRF_PPI->CHG[(uint32_t) channel_group] = + NRF_PPI->CHG[(uint32_t) channel_group] | (PPI_CHG_CH0_Included << ((uint32_t) channel)); +} + +/** + * @brief Function for including multiple PPI channels in a channel group. + * + * @details This function adds all specified channels to the group. + * + * @param[in] channel_mask Channels to be included in the group. + * + * @param[in] channel_group Channel group. + * + */ +__STATIC_INLINE void nrf_ppi_channels_include_in_group(uint32_t channel_mask, + nrf_ppi_channel_group_t channel_group) +{ + NRF_PPI->CHG[(uint32_t) channel_group] = + NRF_PPI->CHG[(uint32_t) channel_group] | (channel_mask); +} + + +/** + * @brief Function for removing a PPI channel from a channel group. + * + * @details This function removes only one channel from the group. + * + * @param[in] channel Channel to be removed from the group. + * + * @param[in] channel_group Channel group. + */ +__STATIC_INLINE void nrf_ppi_channel_remove_from_group(nrf_ppi_channel_t channel, + nrf_ppi_channel_group_t channel_group) +{ + NRF_PPI->CHG[(uint32_t) channel_group] = + NRF_PPI->CHG[(uint32_t) channel_group] & ~(PPI_CHG_CH0_Included << ((uint32_t) channel)); +} + +/** + * @brief Function for removing multiple PPI channels from a channel group. + * + * @details This function removes all specified channels from the group. + * + * @param[in] channel_mask Channels to be removed from the group. + * + * @param[in] channel_group Channel group. + */ +__STATIC_INLINE void nrf_ppi_channels_remove_from_group(uint32_t channel_mask, + nrf_ppi_channel_group_t channel_group) +{ + NRF_PPI->CHG[(uint32_t) channel_group] = + NRF_PPI->CHG[(uint32_t) channel_group] & ~(channel_mask); +} + + +/** + * @brief Function for removing all PPI channels from a channel group. + * + * @param[in] group Channel group. + * + */ +__STATIC_INLINE void nrf_ppi_channel_group_clear(nrf_ppi_channel_group_t group) +{ + NRF_PPI->CHG[(uint32_t) group] = 0; +} + + +/** + * @brief Function for enabling a channel group. + * + * @param[in] group Channel group. + * + */ +__STATIC_INLINE void nrf_ppi_group_enable(nrf_ppi_channel_group_t group) +{ + NRF_PPI->TASKS_CHG[(uint32_t) group].EN = NRF_PPI_TASK_SET; +} + + +/** + * @brief Function for disabling a channel group. + * + * @param[in] group Channel group. + * + */ +__STATIC_INLINE void nrf_ppi_group_disable(nrf_ppi_channel_group_t group) +{ + NRF_PPI->TASKS_CHG[(uint32_t) group].DIS = NRF_PPI_TASK_SET; +} + + +/** + * @brief Function for setting a PPI task. + * + * @param[in] ppi_task PPI task to set. + */ +__STATIC_INLINE void nrf_ppi_task_trigger(nrf_ppi_task_t ppi_task) +{ + *((volatile uint32_t *) ((uint8_t *) NRF_PPI_BASE + (uint32_t) ppi_task)) = NRF_PPI_TASK_SET; +} + + +/** + * @brief Function for returning the address of a specific PPI task register. + * + * @param[in] ppi_task PPI task. + */ +__STATIC_INLINE uint32_t * nrf_ppi_task_address_get(nrf_ppi_task_t ppi_task) +{ + return (uint32_t *) ((uint8_t *) NRF_PPI_BASE + (uint32_t) ppi_task); +} + +/** + * @brief Function for returning the PPI enable task address of a specific group. + * + * @param[in] group PPI group. + */ +__STATIC_INLINE uint32_t * nrf_ppi_task_group_enable_address_get(nrf_ppi_channel_group_t group) +{ + return (uint32_t *) &NRF_PPI->TASKS_CHG[(uint32_t) group].EN; +} + +/** + * @brief Function for returning the PPI disable task address of a specific group. + * + * @param[in] group PPI group. + */ +__STATIC_INLINE uint32_t * nrf_ppi_task_group_disable_address_get(nrf_ppi_channel_group_t group) +{ + return (uint32_t *) &NRF_PPI->TASKS_CHG[(uint32_t) group].DIS; +} + + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ +#endif // NRF_PPI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pwm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pwm.h new file mode 100644 index 0000000000..2dce14fd44 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pwm.h @@ -0,0 +1,665 @@ +/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + +/** + * @defgroup nrf_pwm_hal PWM HAL + * @{ + * @ingroup nrf_pwm + * + * @brief @tagAPI52 Hardware access layer for managing the Pulse Width Modulation (PWM) + * peripheral. + */ + +#ifndef NRF_PWM_H__ +#define NRF_PWM_H__ + +#ifdef NRF52 + +#include +#include +#include + +#include "nrf.h" +#include "nrf_assert.h" + + +/** + * @brief This value can be provided as a parameter for the @ref nrf_pwm_pins_set + * function call to specify that a given output channel shall not be + * connected to a physical pin. + */ +#define NRF_PWM_PIN_NOT_CONNECTED 0xFFFFFFFF + +/** + * @brief Number of channels in each PWM instance. + */ +#define NRF_PWM_CHANNEL_COUNT 4 + + +/** + * @brief PWM tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_PWM_TASK_STOP = offsetof(NRF_PWM_Type, TASKS_STOP), ///< Stops PWM pulse generation on all channels at the end of the current PWM period, and stops the sequence playback. + NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]), ///< Starts playback of sequence 0. + NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]), ///< Starts playback of sequence 1. + NRF_PWM_TASK_NEXTSTEP = offsetof(NRF_PWM_Type, TASKS_NEXTSTEP) ///< Steps by one value in the current sequence if the decoder is set to @ref NRF_PWM_STEP_TRIGGERED mode. + /*lint -restore*/ +} nrf_pwm_task_t; + +/** + * @brief PWM events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_PWM_EVENT_STOPPED = offsetof(NRF_PWM_Type, EVENTS_STOPPED), ///< Response to STOP task, emitted when PWM pulses are no longer generated. + NRF_PWM_EVENT_SEQSTARTED0 = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[0]), ///< First PWM period started on sequence 0. + NRF_PWM_EVENT_SEQSTARTED1 = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[1]), ///< First PWM period started on sequence 1. + NRF_PWM_EVENT_SEQEND0 = offsetof(NRF_PWM_Type, EVENTS_SEQEND[0]), ///< Emitted at the end of every sequence 0 when its last value has been read from RAM. + NRF_PWM_EVENT_SEQEND1 = offsetof(NRF_PWM_Type, EVENTS_SEQEND[1]), ///< Emitted at the end of every sequence 1 when its last value has been read from RAM. + NRF_PWM_EVENT_PWMPERIODEND = offsetof(NRF_PWM_Type, EVENTS_PWMPERIODEND), ///< Emitted at the end of each PWM period. + NRF_PWM_EVENT_LOOPSDONE = offsetof(NRF_PWM_Type, EVENTS_LOOPSDONE) ///< Concatenated sequences have been played the requested number of times. + /*lint -restore*/ +} nrf_pwm_event_t; + +/** + * @brief PWM interrupts. + */ +typedef enum +{ + NRF_PWM_INT_STOPPED_MASK = PWM_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event. + NRF_PWM_INT_SEQSTARTED0_MASK = PWM_INTENSET_SEQSTARTED0_Msk, ///< Interrupt on SEQSTARTED[0] event. + NRF_PWM_INT_SEQSTARTED1_MASK = PWM_INTENSET_SEQSTARTED1_Msk, ///< Interrupt on SEQSTARTED[1] event. + NRF_PWM_INT_SEQEND0_MASK = PWM_INTENSET_SEQEND0_Msk, ///< Interrupt on SEQEND[0] event. + NRF_PWM_INT_SEQEND1_MASK = PWM_INTENSET_SEQEND1_Msk, ///< Interrupt on SEQEND[1] event. + NRF_PWM_INT_PWMPERIODEND_MASK = PWM_INTENSET_PWMPERIODEND_Msk, ///< Interrupt on PWMPERIODEND event. + NRF_PWM_INT_LOOPSDONE_MASK = PWM_INTENSET_LOOPSDONE_Msk ///< Interrupt on LOOPSDONE event. +} nrf_pwm_int_mask_t; + +/** + * @brief PWM shortcuts. + */ +typedef enum +{ + NRF_PWM_SHORT_SEQEND0_STOP_MASK = PWM_SHORTS_SEQEND0_STOP_Msk, ///< Shortcut between SEQEND[0] event and STOP task. + NRF_PWM_SHORT_SEQEND1_STOP_MASK = PWM_SHORTS_SEQEND1_STOP_Msk, ///< Shortcut between SEQEND[1] event and STOP task. + NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk, ///< Shortcut between LOOPSDONE event and SEQSTART[0] task. + NRF_PWM_SHORT_LOOPSDONE_SEQSTART1_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART1_Msk, ///< Shortcut between LOOPSDONE event and SEQSTART[1] task. + NRF_PWM_SHORT_LOOPSDONE_STOP_MASK = PWM_SHORTS_LOOPSDONE_STOP_Msk ///< Shortcut between LOOPSDONE event and STOP task. +} nrf_pwm_short_mask_t; + +/** + * @brief PWM modes of operation. + */ +typedef enum +{ + NRF_PWM_MODE_UP = PWM_MODE_UPDOWN_Up, ///< Up counter (edge-aligned PWM duty cycle). + NRF_PWM_MODE_UP_AND_DOWN = PWM_MODE_UPDOWN_UpAndDown, ///< Up and down counter (center-aligned PWM duty cycle). +} nrf_pwm_mode_t; + +/** + * @brief PWM base clock frequencies. + */ +typedef enum +{ + NRF_PWM_CLK_16MHz = PWM_PRESCALER_PRESCALER_DIV_1, ///< 16 MHz / 1 = 16 MHz. + NRF_PWM_CLK_8MHz = PWM_PRESCALER_PRESCALER_DIV_2, ///< 16 MHz / 2 = 8 MHz. + NRF_PWM_CLK_4MHz = PWM_PRESCALER_PRESCALER_DIV_4, ///< 16 MHz / 4 = 4 MHz. + NRF_PWM_CLK_2MHz = PWM_PRESCALER_PRESCALER_DIV_8, ///< 16 MHz / 8 = 2 MHz. + NRF_PWM_CLK_1MHz = PWM_PRESCALER_PRESCALER_DIV_16, ///< 16 MHz / 16 = 1 MHz. + NRF_PWM_CLK_500kHz = PWM_PRESCALER_PRESCALER_DIV_32, ///< 16 MHz / 32 = 500 kHz. + NRF_PWM_CLK_250kHz = PWM_PRESCALER_PRESCALER_DIV_64, ///< 16 MHz / 64 = 250 kHz. + NRF_PWM_CLK_125kHz = PWM_PRESCALER_PRESCALER_DIV_128 ///< 16 MHz / 128 = 125 kHz. +} nrf_pwm_clk_t; + +/** + * @brief PWM decoder load modes. + * + * The selected mode determines how the sequence data is read from RAM and + * spread to the compare registers. + */ +typedef enum +{ + NRF_PWM_LOAD_COMMON = PWM_DECODER_LOAD_Common, ///< 1st half word (16-bit) used in all PWM channels (0-3). + NRF_PWM_LOAD_GROUPED = PWM_DECODER_LOAD_Grouped, ///< 1st half word (16-bit) used in channels 0 and 1; 2nd word in channels 2 and 3. + NRF_PWM_LOAD_INDIVIDUAL = PWM_DECODER_LOAD_Individual, ///< 1st half word (16-bit) used in channel 0; 2nd in channel 1; 3rd in channel 2; 4th in channel 3. + NRF_PWM_LOAD_WAVE_FORM = PWM_DECODER_LOAD_WaveForm ///< 1st half word (16-bit) used in channel 0; 2nd in channel 1; ... ; 4th as the top value for the pulse generator counter. +} nrf_pwm_dec_load_t; + +/** + * @brief PWM decoder next step modes. + * + * The selected mode determines when the next value from the active sequence + * is loaded. + */ +typedef enum +{ + NRF_PWM_STEP_AUTO = PWM_DECODER_MODE_RefreshCount, ///< Automatically after the current value is played and repeated the requested number of times. + NRF_PWM_STEP_TRIGGERED = PWM_DECODER_MODE_NextStep ///< When the @ref NRF_PWM_TASK_NEXTSTEP task is triggered. +} nrf_pwm_dec_step_t; + + +/** + * @brief Type used for defining duty cycle values for a sequence + * loaded in @ref NRF_PWM_LOAD_COMMON mode. + */ +typedef uint16_t nrf_pwm_values_common_t; + +/** + * @brief Structure for defining duty cycle values for a sequence + * loaded in @ref NRF_PWM_LOAD_GROUPED mode. + */ +typedef struct { + uint16_t group_0; ///< Duty cycle value for group 0 (channels 0 and 1). + uint16_t group_1; ///< Duty cycle value for group 1 (channels 2 and 3). +} nrf_pwm_values_grouped_t; + +/** + * @brief Structure for defining duty cycle values for a sequence + * loaded in @ref NRF_PWM_LOAD_INDIVIDUAL mode. + */ +typedef struct +{ + uint16_t channel_0; ///< Duty cycle value for channel 0. + uint16_t channel_1; ///< Duty cycle value for channel 1. + uint16_t channel_2; ///< Duty cycle value for channel 2. + uint16_t channel_3; ///< Duty cycle value for channel 3. +} nrf_pwm_values_individual_t; + +/** + * @brief Structure for defining duty cycle values for a sequence + * loaded in @ref NRF_PWM_LOAD_WAVE_FORM mode. + */ +typedef struct { + uint16_t channel_0; ///< Duty cycle value for channel 0. + uint16_t channel_1; ///< Duty cycle value for channel 1. + uint16_t channel_2; ///< Duty cycle value for channel 2. + uint16_t counter_top; ///< Top value for the pulse generator counter. +} nrf_pwm_values_wave_form_t; + +/** + * @brief Union grouping pointers to arrays of duty cycle values applicable to + * various loading modes. + */ +typedef union { + nrf_pwm_values_common_t const * p_common; ///< Pointer to be used in @ref NRF_PWM_LOAD_COMMON mode. + nrf_pwm_values_grouped_t const * p_grouped; ///< Pointer to be used in @ref NRF_PWM_LOAD_GROUPED mode. + nrf_pwm_values_individual_t const * p_individual; ///< Pointer to be used in @ref NRF_PWM_LOAD_INDIVIDUAL mode. + nrf_pwm_values_wave_form_t const * p_wave_form; ///< Pointer to be used in @ref NRF_PWM_LOAD_WAVE_FORM mode. + uint16_t const * p_raw; ///< Pointer providing raw access to the values. +} nrf_pwm_values_t; + +/** + * @brief Structure for defining a sequence of PWM duty cycles. + * + * When the sequence is set (by a call to @ref nrf_pwm_sequence_set), the + * provided duty cycle values are not copied. The @p values pointer is stored + * in the peripheral's internal register, and the values are loaded from RAM + * during the sequence playback. Therefore, you must ensure that the values + * do not change before and during the sequence playback (for example, + * the values cannot be placed in a local variable that is allocated on stack). + * If the sequence is played in a loop and the values should be updated + * before the next iteration, it is safe to modify them when the corresponding + * event signaling the end of sequence occurs (@ref NRF_PWM_EVENT_SEQEND0 + * or @ref NRF_PWM_EVENT_SEQEND1, respectively). + * + * @note The @p repeats and @p end_delay values (which are written to the + * SEQ[n].REFRESH and SEQ[n].ENDDELAY registers in the peripheral, + * respectively) are ignored at the end of a complex sequence + * playback, indicated by the LOOPSDONE event. + * See the @linkProductSpecification52 for more information. + */ +typedef struct +{ + nrf_pwm_values_t values; ///< Pointer to an array with duty cycle values. This array must be in Data RAM. + /**< This field is defined as an union of pointers + * to provide a convenient way to define duty + * cycle values in various loading modes + * (see @ref nrf_pwm_dec_load_t). + * In each value, the most significant bit (15) + * determines the polarity of the output and the + * others (14-0) compose the 15-bit value to be + * compared with the pulse generator counter. */ + uint16_t length; ///< Number of 16-bit values in the array pointed by @p values. + uint32_t repeats; ///< Number of times that each duty cycle should be repeated (after being played once). Ignored in @ref NRF_PWM_STEP_TRIGGERED mode. + uint32_t end_delay; ///< Additional time (in PWM periods) that the last duty cycle is to be kept after the sequence is played. Ignored in @ref NRF_PWM_STEP_TRIGGERED mode. +} nrf_pwm_sequence_t; + +/** + * @brief Helper macro for calculating the number of 16-bit values in specified + * array of duty cycle values. + */ +#define NRF_PWM_VALUES_LENGTH(array) (sizeof(array)/sizeof(uint16_t)) + + +/** + * @brief Function for activating a specific PWM task. + * + * @param[in] p_pwm PWM instance. + * @param[in] task Task to activate. + */ +__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_pwm, + nrf_pwm_task_t task); + +/** + * @brief Function for getting the address of a specific PWM task register. + * + * @param[in] p_pwm PWM instance. + * @param[in] task Requested task. + * + * @return Address of the specified task register. + */ +__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_pwm, + nrf_pwm_task_t task); + +/** + * @brief Function for clearing a specific PWM event. + * + * @param[in] p_pwm PWM instance. + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_pwm, + nrf_pwm_event_t event); + +/** + * @brief Function for checking the state of a specific PWM event. + * + * @param[in] p_pwm PWM instance. + * @param[in] event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_pwm, + nrf_pwm_event_t event); + +/** + * @brief Function for getting the address of a specific PWM event register. + * + * @param[in] p_pwm PWM instance. + * @param[in] event Requested event. + * + * @return Address of the specified event register. + */ +__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_pwm, + nrf_pwm_event_t event); + +/** + * @brief Function for enabling specified shortcuts. + * + * @param[in] p_pwm PWM instance. + * @param[in] pwm_shorts_mask Shortcuts to enable. + */ +__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_pwm, + uint32_t pwm_shorts_mask); + +/** + * @brief Function for disabling specified shortcuts. + * + * @param[in] p_pwm PWM instance. + * @param[in] pwm_shorts_mask Shortcuts to disable. + */ +__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_pwm, + uint32_t pwm_shorts_mask); + +/** + * @brief Function for setting the configuration of PWM shortcuts. + * + * @param[in] p_pwm PWM instance. + * @param[in] pwm_shorts_mask Shortcuts configuration to set. + */ +__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_pwm, + uint32_t pwm_shorts_mask); + +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] p_pwm PWM instance. + * @param[in] pwm_int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_pwm, + uint32_t pwm_int_mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] p_pwm PWM instance. + * @param[in] pwm_int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_pwm, + uint32_t pwm_int_mask); + +/** + * @brief Function for setting the configuration of PWM interrupts. + * + * @param[in] p_pwm PWM instance. + * @param[in] pwm_int_mask Interrupts configuration to set. + */ +__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_pwm, + uint32_t pwm_int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param[in] p_pwm PWM instance. + * @param[in] pwm_int Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_pwm, + nrf_pwm_int_mask_t pwm_int); + +/** + * @brief Function for enabling the PWM peripheral. + * + * @param[in] p_pwm PWM instance. + */ +__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_pwm); + +/** + * @brief Function for disabling the PWM peripheral. + * + * @param[in] p_pwm PWM instance. + */ +__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm); + +/** + * @brief Function for assigning pins to PWM output channels. + * + * Usage of all PWM output channels is optional. If a given channel is not + * needed, pass the @ref NRF_PWM_PIN_NOT_CONNECTED value instead of its pin + * number. + * + * @param[in] p_pwm PWM instance. + * @param[in] out_pins Array with pin numbers for individual PWM output channels. + */ +__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_pwm, + uint32_t out_pins[NRF_PWM_CHANNEL_COUNT]); + +/** + * @brief Function for configuring the PWM peripheral. + * + * @param[in] p_pwm PWM instance. + * @param[in] base_clock Base clock frequency. + * @param[in] mode Operating mode of the pulse generator counter. + * @param[in] top_value Value up to which the pulse generator counter counts. + */ +__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm, + nrf_pwm_clk_t base_clock, + nrf_pwm_mode_t mode, + uint16_t top_value); + +/** + * @brief Function for defining a sequence of PWM duty cycles. + * + * @param[in] p_pwm PWM instance. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] p_seq Pointer to the sequence definition. + */ +__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + nrf_pwm_sequence_t const * p_seq); + +/** + * @brief Function for modifying the pointer to the duty cycle values + * in the specified sequence. + * + * @param[in] p_pwm PWM instance. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] p_values Pointer to an array with duty cycle values. + */ +__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + uint16_t const * p_values); + +/** + * @brief Function for modifying the total number of duty cycle values + * in the specified sequence. + * + * @param[in] p_pwm PWM instance. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] length Number of duty cycle values. + */ +__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + uint16_t length); + +/** + * @brief Function for modifying the additional number of PWM periods spent + * on each duty cycle value in the specified sequence. + * + * @param[in] p_pwm PWM instance. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] refresh Number of additional PWM periods for each duty cycle value. + */ +__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + uint32_t refresh); + +/** + * @brief Function for modifying the additional time added after the sequence + * is played. + * + * @param[in] p_pwm PWM instance. + * @param[in] seq_id Identifier of the sequence (0 or 1). + * @param[in] end_delay Number of PWM periods added at the end of the sequence. + */ +__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + uint32_t end_delay); + +/** + * @brief Function for setting the mode of loading sequence data from RAM + * and advancing the sequence. + * + * @param[in] p_pwm PWM instance. + * @param[in] dec_load Mode of loading sequence data from RAM. + * @param[in] dec_step Mode of advancing the active sequence. + */ +__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm, + nrf_pwm_dec_load_t dec_load, + nrf_pwm_dec_step_t dec_step); + +/** + * @brief Function for setting the number of times the sequence playback + * should be performed. + * + * This function applies to two-sequence playback (concatenated sequence 0 and 1). + * A single sequence can be played back only once. + * + * @param[in] p_pwm PWM instance. + * @param[in] loop_count Number of times to perform the sequence playback. + */ +__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_pwm, + uint16_t loop_count); + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_pwm, + nrf_pwm_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_pwm, + nrf_pwm_task_t task) +{ + return ((uint32_t)p_pwm + (uint32_t)task); +} + +__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_pwm, + nrf_pwm_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)event)) = 0x0UL; +} + +__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_pwm, + nrf_pwm_event_t event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)event); +} + +__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_pwm, + nrf_pwm_event_t event) +{ + return ((uint32_t)p_pwm + (uint32_t)event); +} + +__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_pwm, + uint32_t pwm_shorts_mask) +{ + p_pwm->SHORTS |= pwm_shorts_mask; +} + +__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_pwm, + uint32_t pwm_shorts_mask) +{ + p_pwm->SHORTS &= ~(pwm_shorts_mask); +} + +__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_pwm, + uint32_t pwm_shorts_mask) +{ + p_pwm->SHORTS = pwm_shorts_mask; +} + +__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_pwm, + uint32_t pwm_int_mask) +{ + p_pwm->INTENSET = pwm_int_mask; +} + +__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_pwm, + uint32_t pwm_int_mask) +{ + p_pwm->INTENCLR = pwm_int_mask; +} + +__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_pwm, + uint32_t pwm_int_mask) +{ + p_pwm->INTEN = pwm_int_mask; +} + +__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_pwm, + nrf_pwm_int_mask_t pwm_int) +{ + return (bool)(p_pwm->INTENSET & pwm_int); +} + +__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_pwm) +{ + p_pwm->ENABLE = (PWM_ENABLE_ENABLE_Enabled << PWM_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm) +{ + p_pwm->ENABLE = (PWM_ENABLE_ENABLE_Disabled << PWM_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_pwm, + uint32_t out_pins[NRF_PWM_CHANNEL_COUNT]) +{ + uint8_t i; + for (i = 0; i < NRF_PWM_CHANNEL_COUNT; ++i) + { + p_pwm->PSEL.OUT[i] = out_pins[i]; + } +} + +__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm, + nrf_pwm_clk_t base_clock, + nrf_pwm_mode_t mode, + uint16_t top_value) +{ + ASSERT(top_value <= PWM_COUNTERTOP_COUNTERTOP_Msk); + + p_pwm->PRESCALER = base_clock; + p_pwm->MODE = mode; + p_pwm->COUNTERTOP = top_value; +} + +__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + nrf_pwm_sequence_t const * p_seq) +{ + ASSERT(p_seq != NULL); + + nrf_pwm_seq_ptr_set( p_pwm, seq_id, p_seq->values.p_raw); + nrf_pwm_seq_cnt_set( p_pwm, seq_id, p_seq->length); + nrf_pwm_seq_refresh_set( p_pwm, seq_id, p_seq->repeats); + nrf_pwm_seq_end_delay_set(p_pwm, seq_id, p_seq->end_delay); +} + +__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + uint16_t const * p_values) +{ + ASSERT(seq_id <= 1); + ASSERT(p_values != NULL); + p_pwm->SEQ[seq_id].PTR = (uint32_t)p_values; +} + +__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + uint16_t length) +{ + ASSERT(seq_id <= 1); + ASSERT(length != 0); + ASSERT(length <= PWM_SEQ_CNT_CNT_Msk); + p_pwm->SEQ[seq_id].CNT = length; +} + +__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + uint32_t refresh) +{ + ASSERT(seq_id <= 1); + ASSERT(refresh <= PWM_SEQ_REFRESH_CNT_Msk); + p_pwm->SEQ[seq_id].REFRESH = refresh; +} + +__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm, + uint8_t seq_id, + uint32_t end_delay) +{ + ASSERT(seq_id <= 1); + ASSERT(end_delay <= PWM_SEQ_ENDDELAY_CNT_Msk); + p_pwm->SEQ[seq_id].ENDDELAY = end_delay; +} + +__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm, + nrf_pwm_dec_load_t dec_load, + nrf_pwm_dec_step_t dec_step) +{ + p_pwm->DECODER = ((uint32_t)dec_load << PWM_DECODER_LOAD_Pos) | + ((uint32_t)dec_step << PWM_DECODER_MODE_Pos); +} + +__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_pwm, + uint16_t loop_count) +{ + p_pwm->LOOP = loop_count; +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF52 + +#endif // NRF_PWM_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rtc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rtc.h new file mode 100644 index 0000000000..39e7f57281 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rtc.h @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file + * @brief RTC HAL API. + */ + +#ifndef NRF_RTC_H +#define NRF_RTC_H + +/** + * @defgroup nrf_rtc_hal RTC HAL + * @{ + * @ingroup nrf_rtc + * @brief Hardware access layer for managing the real time counter (RTC). + */ + +#include +#include +#include +#include "nrf.h" +#include "nrf_assert.h" + +/** + * @brief Macro for getting the number of compare channels available + * in a given RTC instance. + */ +#ifdef NRF51 + #define NRF_RTC_CC_CHANNEL_COUNT(id) 4 +#else + #define NRF_RTC_CC_CHANNEL_COUNT(id) ((id) == 0 ? 3 : 4) +#endif + +#define RTC_INPUT_FREQ 32768 /**< Input frequency of the RTC instance. */ + +/**< Macro for wrapping values to RTC capacity. */ +#define RTC_WRAP(val) (val & RTC_COUNTER_COUNTER_Msk) + +#define RTC_CHANNEL_INT_MASK(ch) ((uint32_t)NRF_RTC_INT_COMPARE0_MASK << ch) +#define RTC_CHANNEL_EVENT_ADDR(ch) (nrf_rtc_event_t)(NRF_RTC_EVENT_COMPARE_0 + ch*sizeof(uint32_t)) +/** + * @enum nrf_rtc_task_t + * @brief RTC tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_RTC_TASK_START = offsetof(NRF_RTC_Type,TASKS_START), /**< Start. */ + NRF_RTC_TASK_STOP = offsetof(NRF_RTC_Type,TASKS_STOP), /**< Stop. */ + NRF_RTC_TASK_CLEAR = offsetof(NRF_RTC_Type,TASKS_CLEAR), /**< Clear. */ + NRF_RTC_TASK_TRIGGER_OVERFLOW = offsetof(NRF_RTC_Type,TASKS_TRIGOVRFLW),/**< Trigger overflow. */ + /*lint -restore*/ +} nrf_rtc_task_t; + +/** + * @enum nrf_rtc_event_t + * @brief RTC events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_RTC_EVENT_TICK = offsetof(NRF_RTC_Type,EVENTS_TICK), /**< Tick event. */ + NRF_RTC_EVENT_OVERFLOW = offsetof(NRF_RTC_Type,EVENTS_OVRFLW), /**< Overflow event. */ + NRF_RTC_EVENT_COMPARE_0 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[0]), /**< Compare 0 event. */ + NRF_RTC_EVENT_COMPARE_1 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[1]), /**< Compare 1 event. */ + NRF_RTC_EVENT_COMPARE_2 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[2]), /**< Compare 2 event. */ + NRF_RTC_EVENT_COMPARE_3 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[3]) /**< Compare 3 event. */ + /*lint -restore*/ +} nrf_rtc_event_t; + +/** + * @enum nrf_rtc_int_t + * @brief RTC interrupts. + */ +typedef enum +{ + NRF_RTC_INT_TICK_MASK = RTC_INTENSET_TICK_Msk, /**< RTC interrupt from tick event. */ + NRF_RTC_INT_OVERFLOW_MASK = RTC_INTENSET_OVRFLW_Msk, /**< RTC interrupt from overflow event. */ + NRF_RTC_INT_COMPARE0_MASK = RTC_INTENSET_COMPARE0_Msk, /**< RTC interrupt from compare event on channel 0. */ + NRF_RTC_INT_COMPARE1_MASK = RTC_INTENSET_COMPARE1_Msk, /**< RTC interrupt from compare event on channel 1. */ + NRF_RTC_INT_COMPARE2_MASK = RTC_INTENSET_COMPARE2_Msk, /**< RTC interrupt from compare event on channel 2. */ + NRF_RTC_INT_COMPARE3_MASK = RTC_INTENSET_COMPARE3_Msk /**< RTC interrupt from compare event on channel 3. */ +} nrf_rtc_int_t; + +/**@brief Function for setting a compare value for a channel. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] ch Channel. + * @param[in] cc_val Compare value to set. + */ +__STATIC_INLINE void nrf_rtc_cc_set(NRF_RTC_Type * p_rtc, uint32_t ch, uint32_t cc_val); + +/**@brief Function for returning the compare value for a channel. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] ch Channel. + * + * @return COMPARE[ch] value. + */ +__STATIC_INLINE uint32_t nrf_rtc_cc_get(NRF_RTC_Type * p_rtc, uint32_t ch); + +/**@brief Function for enabling interrupts. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] mask Interrupt mask to be enabled. + */ +__STATIC_INLINE void nrf_rtc_int_enable(NRF_RTC_Type * p_rtc, uint32_t mask); + +/**@brief Function for disabling interrupts. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] mask Interrupt mask to be disabled. + */ +__STATIC_INLINE void nrf_rtc_int_disable(NRF_RTC_Type * p_rtc, uint32_t mask); + +/**@brief Function for checking if interrupts are enabled. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] mask Mask of interrupt flags to check. + * + * @return Mask with enabled interrupts. + */ +__STATIC_INLINE uint32_t nrf_rtc_int_is_enabled(NRF_RTC_Type * p_rtc, uint32_t mask); + +/**@brief Function for returning the status of currently enabled interrupts. + * + * @param[in] p_rtc Pointer to the instance register structure. + * + * @return Value in INTEN register. + */ +__STATIC_INLINE uint32_t nrf_rtc_int_get(NRF_RTC_Type * p_rtc); + +/**@brief Function for checking if an event is pending. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] event Address of the event. + * + * @return Mask of pending events. + */ +__STATIC_INLINE uint32_t nrf_rtc_event_pending(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event); + +/**@brief Function for clearing an event. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_rtc_event_clear(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event); + +/**@brief Function for returning a counter value. + * + * @param[in] p_rtc Pointer to the instance register structure. + * + * @return Counter value. + */ +__STATIC_INLINE uint32_t nrf_rtc_counter_get(NRF_RTC_Type * p_rtc); + +/**@brief Function for setting a prescaler value. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] val Value to set the prescaler to. + */ +__STATIC_INLINE void nrf_rtc_prescaler_set(NRF_RTC_Type * p_rtc, uint32_t val); + +/**@brief Function for returning the address of an event. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] event Requested event. + * + * @return Address of the requested event register. + */ +__STATIC_INLINE uint32_t nrf_rtc_event_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event); + +/**@brief Function for returning the address of a task. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] task Requested task. + * + * @return Address of the requested task register. + */ +__STATIC_INLINE uint32_t nrf_rtc_task_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task); + +/**@brief Function for starting a task. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] task Requested task. + */ +__STATIC_INLINE void nrf_rtc_task_trigger(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task); + +/**@brief Function for enabling events. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] mask Mask of event flags to enable. + */ +__STATIC_INLINE void nrf_rtc_event_enable(NRF_RTC_Type * p_rtc, uint32_t mask); + +/**@brief Function for disabling an event. + * + * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] event Requested event. + */ +__STATIC_INLINE void nrf_rtc_event_disable(NRF_RTC_Type * p_rtc, uint32_t event); + +/** + *@} + **/ + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_rtc_cc_set(NRF_RTC_Type * p_rtc, uint32_t ch, uint32_t cc_val) +{ + p_rtc->CC[ch] = cc_val; +} + +__STATIC_INLINE uint32_t nrf_rtc_cc_get(NRF_RTC_Type * p_rtc, uint32_t ch) +{ + return p_rtc->CC[ch]; +} + +__STATIC_INLINE void nrf_rtc_int_enable(NRF_RTC_Type * p_rtc, uint32_t mask) +{ + p_rtc->INTENSET = mask; +} + +__STATIC_INLINE void nrf_rtc_int_disable(NRF_RTC_Type * p_rtc, uint32_t mask) +{ + p_rtc->INTENCLR = mask; +} + +__STATIC_INLINE uint32_t nrf_rtc_int_is_enabled(NRF_RTC_Type * p_rtc, uint32_t mask) +{ + return (p_rtc->INTENSET & mask); +} + +__STATIC_INLINE uint32_t nrf_rtc_int_get(NRF_RTC_Type * p_rtc) +{ + return p_rtc->INTENSET; +} + +__STATIC_INLINE uint32_t nrf_rtc_event_pending(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event) +{ + return *(volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event); +} + +__STATIC_INLINE void nrf_rtc_event_clear(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event)) = 0; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event)); + (void)dummy; +#endif +} + +__STATIC_INLINE uint32_t nrf_rtc_counter_get(NRF_RTC_Type * p_rtc) +{ + return p_rtc->COUNTER; +} + +__STATIC_INLINE void nrf_rtc_prescaler_set(NRF_RTC_Type * p_rtc, uint32_t val) +{ + ASSERT(val <= (RTC_PRESCALER_PRESCALER_Msk >> RTC_PRESCALER_PRESCALER_Pos)); + p_rtc->PRESCALER = val; +} +__STATIC_INLINE uint32_t rtc_prescaler_get(NRF_RTC_Type * p_rtc) +{ + return p_rtc->PRESCALER; +} + +__STATIC_INLINE uint32_t nrf_rtc_event_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event) +{ + return (uint32_t)p_rtc + event; +} + +__STATIC_INLINE uint32_t nrf_rtc_task_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task) +{ + return (uint32_t)p_rtc + task; +} + +__STATIC_INLINE void nrf_rtc_task_trigger(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task) +{ + *(__IO uint32_t *)((uint32_t)p_rtc + task) = 1; +} + +__STATIC_INLINE void nrf_rtc_event_enable(NRF_RTC_Type * p_rtc, uint32_t mask) +{ + p_rtc->EVTENSET = mask; +} +__STATIC_INLINE void nrf_rtc_event_disable(NRF_RTC_Type * p_rtc, uint32_t mask) +{ + p_rtc->EVTENCLR = mask; +} +#endif + +#endif /* NRF_RTC_H */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.c new file mode 100644 index 0000000000..c5b88ea077 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifdef NRF52 +/** + * @file + * @brief SAADC HAL implementation + */ + +#include "nrf_saadc.h" + +void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) +{ + NRF_SAADC->CH[channel].CONFIG = + ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) + | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) + | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) + | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) + | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) + | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); + nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); + return; +} + +#endif //NRF52 + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.h new file mode 100644 index 0000000000..b3ea9d7ef7 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.h @@ -0,0 +1,587 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef NRF_SAADC_H_ +#define NRF_SAADC_H_ + +#ifdef NRF52 + +/** + * @defgroup nrf_saadc_hal SAADC HAL + * @{ + * @ingroup nrf_saadc + * + * @brief @tagAPI52 Hardware access layer for accessing the SAADC peripheral. + */ + +#include +#include +#include "nrf.h" +#include "nrf_assert.h" + + + +#define NRF_SAADC_CHANNEL_COUNT 8 + +/** + * @brief Resolution of the analog-to-digital converter. + */ +typedef enum +{ + NRF_SAADC_RESOLUTION_8BIT = SAADC_RESOLUTION_VAL_8bit, ///< 8 bit resolution. + NRF_SAADC_RESOLUTION_10BIT = SAADC_RESOLUTION_VAL_10bit, ///< 10 bit resolution. + NRF_SAADC_RESOLUTION_12BIT = SAADC_RESOLUTION_VAL_12bit, ///< 12 bit resolution. + NRF_SAADC_RESOLUTION_14BIT = SAADC_RESOLUTION_VAL_14bit ///< 14 bit resolution. +} nrf_saadc_resolution_t; + + +/** + * @brief Input selection for the analog-to-digital converter. + */ +typedef enum +{ + NRF_SAADC_INPUT_DISABLED = SAADC_CH_PSELP_PSELP_NC, ///< Not connected. + NRF_SAADC_INPUT_AIN0 = SAADC_CH_PSELP_PSELP_AnalogInput0, ///< Analog input 0 (AIN0). + NRF_SAADC_INPUT_AIN1 = SAADC_CH_PSELP_PSELP_AnalogInput1, ///< Analog input 1 (AIN1). + NRF_SAADC_INPUT_AIN2 = SAADC_CH_PSELP_PSELP_AnalogInput2, ///< Analog input 2 (AIN2). + NRF_SAADC_INPUT_AIN3 = SAADC_CH_PSELP_PSELP_AnalogInput3, ///< Analog input 3 (AIN3). + NRF_SAADC_INPUT_AIN4 = SAADC_CH_PSELP_PSELP_AnalogInput4, ///< Analog input 4 (AIN4). + NRF_SAADC_INPUT_AIN5 = SAADC_CH_PSELP_PSELP_AnalogInput5, ///< Analog input 5 (AIN5). + NRF_SAADC_INPUT_AIN6 = SAADC_CH_PSELP_PSELP_AnalogInput6, ///< Analog input 6 (AIN6). + NRF_SAADC_INPUT_AIN7 = SAADC_CH_PSELP_PSELP_AnalogInput7, ///< Analog input 7 (AIN7). + NRF_SAADC_INPUT_VDD = SAADC_CH_PSELP_PSELP_VDD ///< VDD as input. +} nrf_saadc_input_t; + + +/** + * @brief Analog-to-digital converter oversampling mode. + */ +typedef enum +{ + NRF_SAADC_OVERSAMPLE_DISABLED = SAADC_OVERSAMPLE_OVERSAMPLE_Bypass, ///< No oversampling. + NRF_SAADC_OVERSAMPLE_2X = SAADC_OVERSAMPLE_OVERSAMPLE_Over2x, ///< Oversample 2x. + NRF_SAADC_OVERSAMPLE_4X = SAADC_OVERSAMPLE_OVERSAMPLE_Over4x, ///< Oversample 4x. + NRF_SAADC_OVERSAMPLE_8X = SAADC_OVERSAMPLE_OVERSAMPLE_Over8x, ///< Oversample 8x. + NRF_SAADC_OVERSAMPLE_16X = SAADC_OVERSAMPLE_OVERSAMPLE_Over16x, ///< Oversample 16x. + NRF_SAADC_OVERSAMPLE_32X = SAADC_OVERSAMPLE_OVERSAMPLE_Over32x, ///< Oversample 32x. + NRF_SAADC_OVERSAMPLE_64X = SAADC_OVERSAMPLE_OVERSAMPLE_Over64x, ///< Oversample 64x. + NRF_SAADC_OVERSAMPLE_128X = SAADC_OVERSAMPLE_OVERSAMPLE_Over128x, ///< Oversample 128x. + NRF_SAADC_OVERSAMPLE_256X = SAADC_OVERSAMPLE_OVERSAMPLE_Over256x ///< Oversample 256x. +} nrf_saadc_oversample_t; + + +/** + * @brief Analog-to-digital converter channel resistor control. + */ +typedef enum +{ + NRF_SAADC_RESISTOR_DISABLED = SAADC_CH_CONFIG_RESP_Bypass, ///< Bypass resistor ladder. + NRF_SAADC_RESISTOR_PULLDOWN = SAADC_CH_CONFIG_RESP_Pulldown, ///< Pull-down to GND. + NRF_SAADC_RESISTOR_PULLUP = SAADC_CH_CONFIG_RESP_Pullup, ///< Pull-up to VDD. + NRF_SAADC_RESISTOR_VDD1_2 = SAADC_CH_CONFIG_RESP_VDD1_2 ///< Set input at VDD/2. +} nrf_saadc_resistor_t; + + +/** + * @brief Gain factor of the analog-to-digital converter input. + */ +typedef enum +{ + NRF_SAADC_GAIN1_6 = SAADC_CH_CONFIG_GAIN_Gain1_6, ///< Gain factor 1/6. + NRF_SAADC_GAIN1_5 = SAADC_CH_CONFIG_GAIN_Gain1_5, ///< Gain factor 1/5. + NRF_SAADC_GAIN1_4 = SAADC_CH_CONFIG_GAIN_Gain1_4, ///< Gain factor 1/4. + NRF_SAADC_GAIN1_3 = SAADC_CH_CONFIG_GAIN_Gain1_3, ///< Gain factor 1/3. + NRF_SAADC_GAIN1_2 = SAADC_CH_CONFIG_GAIN_Gain1_2, ///< Gain factor 1/2. + NRF_SAADC_GAIN1 = SAADC_CH_CONFIG_GAIN_Gain1, ///< Gain factor 1. + NRF_SAADC_GAIN2 = SAADC_CH_CONFIG_GAIN_Gain2, ///< Gain factor 2. + NRF_SAADC_GAIN4 = SAADC_CH_CONFIG_GAIN_Gain4, ///< Gain factor 4. +} nrf_saadc_gain_t; + + +/** + * @brief Reference selection for the analog-to-digital converter. + */ +typedef enum +{ + NRF_SAADC_REFERENCE_INTERNAL = SAADC_CH_CONFIG_REFSEL_Internal, ///< Internal reference (0.6 V). + NRF_SAADC_REFERENCE_VDD4 = SAADC_CH_CONFIG_REFSEL_VDD1_4 ///< VDD/4 as reference. +} nrf_saadc_reference_t; + + +/** + * @brief Analog-to-digital converter acquisition time. + */ +typedef enum +{ + NRF_SAADC_ACQTIME_3US = SAADC_CH_CONFIG_TACQ_3us, ///< 3 us. + NRF_SAADC_ACQTIME_5US = SAADC_CH_CONFIG_TACQ_5us, ///< 5 us. + NRF_SAADC_ACQTIME_10US = SAADC_CH_CONFIG_TACQ_10us, ///< 10 us. + NRF_SAADC_ACQTIME_15US = SAADC_CH_CONFIG_TACQ_15us, ///< 15 us. + NRF_SAADC_ACQTIME_20US = SAADC_CH_CONFIG_TACQ_20us, ///< 20 us. + NRF_SAADC_ACQTIME_40US = SAADC_CH_CONFIG_TACQ_40us ///< 40 us. +} nrf_saadc_acqtime_t; + + +/** + * @brief Analog-to-digital converter channel mode. + */ +typedef enum +{ + NRF_SAADC_MODE_SINGLE_ENDED = SAADC_CH_CONFIG_MODE_SE, ///< Single ended, PSELN will be ignored, negative input to ADC shorted to GND. + NRF_SAADC_MODE_DIFFERENTIAL = SAADC_CH_CONFIG_MODE_Diff ///< Differential mode. +} nrf_saadc_mode_t; + + +/** + * @brief Analog-to-digital converter tasks. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_SAADC_TASK_START = offsetof(NRF_SAADC_Type, TASKS_START), ///< Start the ADC and prepare the result buffer in RAM. + NRF_SAADC_TASK_SAMPLE = offsetof(NRF_SAADC_Type, TASKS_SAMPLE), ///< Take one ADC sample. If scan is enabled, all channels are sampled. + NRF_SAADC_TASK_STOP = offsetof(NRF_SAADC_Type, TASKS_STOP), ///< Stop the ADC and terminate any on-going conversion. + NRF_SAADC_TASK_CALIBRATEOFFSET = offsetof(NRF_SAADC_Type, TASKS_CALIBRATEOFFSET), ///< Starts offset auto-calibration. +} nrf_saadc_task_t; + + +/** + * @brief Analog-to-digital converter events. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_SAADC_EVENT_STARTED = offsetof(NRF_SAADC_Type, EVENTS_STARTED), ///< The ADC has started. + NRF_SAADC_EVENT_END = offsetof(NRF_SAADC_Type, EVENTS_END), ///< The ADC has filled up the result buffer. + NRF_SAADC_EVENT_CALIBRATEDONE = offsetof(NRF_SAADC_Type, EVENTS_CALIBRATEDONE), ///< Calibration is complete. + NRF_SAADC_EVENT_STOPPED = offsetof(NRF_SAADC_Type, EVENTS_STOPPED), ///< The ADC has stopped. + NRF_SAADC_EVENT_CH0_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITH), ///< Last result is equal or above CH[0].LIMIT.HIGH. + NRF_SAADC_EVENT_CH0_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITL), ///< Last result is equal or below CH[0].LIMIT.LOW. + NRF_SAADC_EVENT_CH1_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[1].LIMITH), ///< Last result is equal or above CH[1].LIMIT.HIGH. + NRF_SAADC_EVENT_CH1_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[1].LIMITL), ///< Last result is equal or below CH[1].LIMIT.LOW. + NRF_SAADC_EVENT_CH2_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[2].LIMITH), ///< Last result is equal or above CH[2].LIMIT.HIGH. + NRF_SAADC_EVENT_CH2_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[2].LIMITL), ///< Last result is equal or below CH[2].LIMIT.LOW. + NRF_SAADC_EVENT_CH3_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[3].LIMITH), ///< Last result is equal or above CH[3].LIMIT.HIGH. + NRF_SAADC_EVENT_CH3_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[3].LIMITL), ///< Last result is equal or below CH[3].LIMIT.LOW. + NRF_SAADC_EVENT_CH4_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[4].LIMITH), ///< Last result is equal or above CH[4].LIMIT.HIGH. + NRF_SAADC_EVENT_CH4_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[4].LIMITL), ///< Last result is equal or below CH[4].LIMIT.LOW. + NRF_SAADC_EVENT_CH5_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[5].LIMITH), ///< Last result is equal or above CH[5].LIMIT.HIGH. + NRF_SAADC_EVENT_CH5_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[5].LIMITL), ///< Last result is equal or below CH[5].LIMIT.LOW. + NRF_SAADC_EVENT_CH6_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[6].LIMITH), ///< Last result is equal or above CH[6].LIMIT.HIGH. + NRF_SAADC_EVENT_CH6_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[6].LIMITL), ///< Last result is equal or below CH[6].LIMIT.LOW. + NRF_SAADC_EVENT_CH7_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[7].LIMITH), ///< Last result is equal or above CH[7].LIMIT.HIGH. + NRF_SAADC_EVENT_CH7_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[7].LIMITL) ///< Last result is equal or below CH[7].LIMIT.LOW. +} nrf_saadc_event_t; + + +/** + * @brief Analog-to-digital converter interrupt masks. + */ +typedef enum +{ + NRF_SAADC_INT_STARTED = SAADC_INTENSET_STARTED_Msk, ///< Interrupt on EVENTS_STARTED event. + NRF_SAADC_INT_END = SAADC_INTENSET_END_Msk, ///< Interrupt on EVENTS_END event. + NRF_SAADC_INT_STOPPED = SAADC_INTENSET_STOPPED_Msk, ///< Interrupt on EVENTS_STOPPED event. + NRF_SAADC_INT_CH0LIMITH = SAADC_INTENSET_CH0LIMITH_Msk, ///< Interrupt on EVENTS_CH[0].LIMITH event. + NRF_SAADC_INT_CH0LIMITL = SAADC_INTENSET_CH0LIMITL_Msk, ///< Interrupt on EVENTS_CH[0].LIMITL event. + NRF_SAADC_INT_CH1LIMITH = SAADC_INTENSET_CH1LIMITH_Msk, ///< Interrupt on EVENTS_CH[1].LIMITH event. + NRF_SAADC_INT_CH1LIMITL = SAADC_INTENSET_CH1LIMITL_Msk, ///< Interrupt on EVENTS_CH[1].LIMITL event. + NRF_SAADC_INT_CH2LIMITH = SAADC_INTENSET_CH2LIMITH_Msk, ///< Interrupt on EVENTS_CH[2].LIMITH event. + NRF_SAADC_INT_CH2LIMITL = SAADC_INTENSET_CH2LIMITL_Msk, ///< Interrupt on EVENTS_CH[2].LIMITL event. + NRF_SAADC_INT_CH3LIMITH = SAADC_INTENSET_CH3LIMITH_Msk, ///< Interrupt on EVENTS_CH[3].LIMITH event. + NRF_SAADC_INT_CH3LIMITL = SAADC_INTENSET_CH3LIMITL_Msk, ///< Interrupt on EVENTS_CH[3].LIMITL event. + NRF_SAADC_INT_CH4LIMITH = SAADC_INTENSET_CH4LIMITH_Msk, ///< Interrupt on EVENTS_CH[4].LIMITH event. + NRF_SAADC_INT_CH4LIMITL = SAADC_INTENSET_CH4LIMITL_Msk, ///< Interrupt on EVENTS_CH[4].LIMITL event. + NRF_SAADC_INT_CH5LIMITH = SAADC_INTENSET_CH5LIMITH_Msk, ///< Interrupt on EVENTS_CH[5].LIMITH event. + NRF_SAADC_INT_CH5LIMITL = SAADC_INTENSET_CH5LIMITL_Msk, ///< Interrupt on EVENTS_CH[5].LIMITL event. + NRF_SAADC_INT_CH6LIMITH = SAADC_INTENSET_CH6LIMITH_Msk, ///< Interrupt on EVENTS_CH[6].LIMITH event. + NRF_SAADC_INT_CH6LIMITL = SAADC_INTENSET_CH6LIMITL_Msk, ///< Interrupt on EVENTS_CH[6].LIMITL event. + NRF_SAADC_INT_CH7LIMITH = SAADC_INTENSET_CH7LIMITH_Msk, ///< Interrupt on EVENTS_CH[7].LIMITH event. + NRF_SAADC_INT_CH7LIMITL = SAADC_INTENSET_CH7LIMITL_Msk, ///< Interrupt on EVENTS_CH[7].LIMITL event. + NRF_SAADC_INT_ALL = 0x7FFFFFFFUL ///< Mask of all interrupts. +} nrf_saadc_int_mask_t; + + +/** + * @brief Analog-to-digital converter value limit type. + */ +typedef enum +{ + NRF_SAADC_LIMIT_LOW = 0, + NRF_SAADC_LIMIT_HIGH = 1 +} nrf_saadc_limit_t; + + +typedef int16_t nrf_saadc_value_t; ///< Type of a single ADC conversion result. + + +/** + * @brief Analog-to-digital converter configuration structure. + */ +typedef struct +{ + nrf_saadc_resolution_t resolution; + nrf_saadc_oversample_t oversample; + nrf_saadc_value_t * buffer; + uint32_t buffer_size; +} nrf_saadc_config_t; + + +/** + * @brief Analog-to-digital converter channel configuration structure. + */ +typedef struct +{ + nrf_saadc_resistor_t resistor_p; + nrf_saadc_resistor_t resistor_n; + nrf_saadc_gain_t gain; + nrf_saadc_reference_t reference; + nrf_saadc_acqtime_t acq_time; + nrf_saadc_mode_t mode; + nrf_saadc_input_t pin_p; + nrf_saadc_input_t pin_n; +} nrf_saadc_channel_config_t; + + +/** + * @brief Function for triggering a specific SAADC task. + * + * @param[in] saadc_task SAADC task. + */ +__STATIC_INLINE void nrf_saadc_task_trigger(nrf_saadc_task_t saadc_task) +{ + *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_task)) = 0x1UL; +} + + +/** + * @brief Function for getting the address of a specific SAADC task register. + * + * @param[in] saadc_task SAADC task. + * + * @return Address of the specified SAADC task. + */ +__STATIC_INLINE uint32_t nrf_saadc_task_address_get(nrf_saadc_task_t saadc_task) +{ + return (uint32_t)((uint8_t *)NRF_SAADC + (uint32_t)saadc_task); +} + + +/** + * @brief Function for getting the state of a specific SAADC event. + * + * @param[in] saadc_event SAADC event. + * + * @return State of the specified SAADC event. + */ +__STATIC_INLINE bool nrf_saadc_event_check(nrf_saadc_event_t saadc_event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event); +} + + +/** + * @brief Function for clearing the specific SAADC event. + * + * @param[in] saadc_event SAADC event. + */ +__STATIC_INLINE void nrf_saadc_event_clear(nrf_saadc_event_t saadc_event) +{ + *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event)) = 0x0UL; +} + + +/** + * @brief Function for getting the address of a specific SAADC event register. + * + * @param[in] saadc_event SAADC event. + * + * @return Address of the specified SAADC event. + */ +__STATIC_INLINE volatile uint32_t * nrf_saadc_event_address_get(nrf_saadc_event_t saadc_event) +{ + return (volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event); +} + + +/** + * @brief Function for getting the address of a specific SAADC limit event register. + * + * @param[in] channel Channel number. + * @param[in] limit_type Low limit or high limit. + * + * @return Address of the specified SAADC limit event. + */ +__STATIC_INLINE volatile uint32_t * nrf_saadc_event_limit_address_get(uint8_t channel, nrf_saadc_limit_t limit_type) +{ + ASSERT(channel < NRF_SAADC_CHANNEL_COUNT); + if (limit_type == NRF_SAADC_LIMIT_HIGH) + { + return &NRF_SAADC->EVENTS_CH[channel].LIMITH; + } + else + { + return &NRF_SAADC->EVENTS_CH[channel].LIMITL; + } +} + + +/** + * @brief Function for getting the SAADC channel monitoring limit events. + * + * @param[in] channel Channel number. + * @param[in] limit_type Low limit or high limit. + */ +__STATIC_INLINE nrf_saadc_event_t nrf_saadc_event_limit_get(uint8_t channel, nrf_saadc_limit_t limit_type) +{ + if (limit_type == NRF_SAADC_LIMIT_HIGH) + { + return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITH + + (uint32_t) (NRF_SAADC_EVENT_CH1_LIMITH - NRF_SAADC_EVENT_CH0_LIMITH) + * (uint32_t) channel ); + } + else + { + return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITL + + (uint32_t) (NRF_SAADC_EVENT_CH1_LIMITL - NRF_SAADC_EVENT_CH0_LIMITL) + * (uint32_t) channel ); + } +} + + +/** + * @brief Function for configuring the input pins for a specific SAADC channel. + * + * @param[in] channel Channel number. + * @param[in] pselp Positive input. + * @param[in] pseln Negative input. Set to NRF_SAADC_INPUT_DISABLED in single ended mode. + */ +__STATIC_INLINE void nrf_saadc_channel_input_set(uint8_t channel, + nrf_saadc_input_t pselp, + nrf_saadc_input_t pseln) +{ + NRF_SAADC->CH[channel].PSELN = pseln; + NRF_SAADC->CH[channel].PSELP = pselp; +} + + +/** + * @brief Function for setting the SAADC channel monitoring limits. + * + * @param[in] channel Channel number. + * @param[in] low Low limit. + * @param[in] high High limit. + */ +__STATIC_INLINE void nrf_saadc_channel_limits_set(uint8_t channel, int16_t low, int16_t high) +{ + NRF_SAADC->CH[channel].LIMIT = ( + (((uint32_t) low << SAADC_CH_LIMIT_LOW_Pos) & SAADC_CH_LIMIT_LOW_Msk) + | (((uint32_t) high << SAADC_CH_LIMIT_HIGH_Pos) & SAADC_CH_LIMIT_HIGH_Msk)); +} + + +/** + * @brief Function for enabling specified SAADC interrupts. + * + * @param[in] saadc_int_mask Interrupt(s) to enable. + */ +__STATIC_INLINE void nrf_saadc_int_enable(uint32_t saadc_int_mask) +{ + NRF_SAADC->INTENSET = saadc_int_mask; +} + + +/** + * @brief Function for retrieving the state of specified SAADC interrupts. + * + * @param[in] saadc_int_mask Interrupt(s) to check. + * + * @retval true If all specified interrupts are enabled. + * @retval false If at least one of the given interrupts is not enabled. + */ +__STATIC_INLINE bool nrf_saadc_int_enable_check(uint32_t saadc_int_mask) +{ + return (bool)(NRF_SAADC->INTENSET & saadc_int_mask); +} + + +/** + * @brief Function for disabling specified interrupts. + * + * @param saadc_int_mask Interrupt(s) to disable. + */ +__STATIC_INLINE void nrf_saadc_int_disable(uint32_t saadc_int_mask) +{ + NRF_SAADC->INTENCLR = saadc_int_mask; +} + + +/** + * @brief Function for generating masks for SAADC channel limit interrupts. + * + * @param[in] channel SAADC channel number. + * @param[in] limit_type Limit type. + * + * @returns Interrupt mask. + */ +__STATIC_INLINE uint32_t nrf_saadc_limit_int_get(uint8_t channel, nrf_saadc_limit_t limit_type) +{ + ASSERT(channel < NRF_SAADC_CHANNEL_COUNT); + uint32_t mask = (limit_type == NRF_SAADC_LIMIT_LOW) ? NRF_SAADC_INT_CH0LIMITL : NRF_SAADC_INT_CH0LIMITH; + return mask << (channel * 2); +} + + +/** + * @brief Function for checking whether the SAADC is busy. + * + * This function checks whether the analog-to-digital converter is busy with a conversion. + * + * @retval true If the SAADC is busy. + * @retval false If the SAADC is not busy. + */ +__STATIC_INLINE bool nrf_saadc_busy_check(void) +{ + //return ((NRF_SAADC->STATUS & SAADC_STATUS_STATUS_Msk) == SAADC_STATUS_STATUS_Msk); + //simplified for performance + return NRF_SAADC->STATUS; +} + + +/** + * @brief Function for enabling the SAADC. + * + * The analog-to-digital converter must be enabled before use. + */ +__STATIC_INLINE void nrf_saadc_enable(void) +{ + NRF_SAADC->ENABLE = (SAADC_ENABLE_ENABLE_Enabled << SAADC_ENABLE_ENABLE_Pos); +} + + +/** + * @brief Function for disabling the SAADC. + */ +__STATIC_INLINE void nrf_saadc_disable(void) +{ + NRF_SAADC->ENABLE = (SAADC_ENABLE_ENABLE_Disabled << SAADC_ENABLE_ENABLE_Pos); +} + + +/** + * @brief Function for checking if the SAADC is enabled. + * + * @retval true If the SAADC is enabled. + * @retval false If the SAADC is not enabled. + */ +__STATIC_INLINE bool nrf_saadc_enable_check(void) +{ + //simplified for performance + return NRF_SAADC->ENABLE; +} + + +/** + * @brief Function for initializing the SAADC result buffer. + * + * @param[in] buffer Pointer to the result buffer. + * @param[in] num Size of buffer in words. + */ +__STATIC_INLINE void nrf_saadc_buffer_init(nrf_saadc_value_t * buffer, uint32_t num) +{ + NRF_SAADC->RESULT.PTR = (uint32_t)buffer; + NRF_SAADC->RESULT.MAXCNT = num; +} + +/** + * @brief Function for getting the number of buffer words transferred since last START operation. + * + * @returns Number of words transferred. + */ +__STATIC_INLINE uint16_t nrf_saadc_amount_get(void) +{ + return NRF_SAADC->RESULT.AMOUNT; +} + + +/** + * @brief Function for setting the SAADC sample resolution. + * + * @param[in] resolution Bit resolution. + */ +__STATIC_INLINE void nrf_saadc_resolution_set(nrf_saadc_resolution_t resolution) +{ + NRF_SAADC->RESOLUTION = resolution; +} + + +/** + * @brief Function for configuring the oversampling feature. + * + * @param[in] oversample Oversampling mode. + */ +__STATIC_INLINE void nrf_saadc_oversample_set(nrf_saadc_oversample_t oversample) +{ + NRF_SAADC->OVERSAMPLE = oversample; +} + +/** + * @brief Function for getting the oversampling feature configuration. + * + * @return Oversampling configuration. + */ +__STATIC_INLINE nrf_saadc_oversample_t nrf_saadc_oversample_get(void) +{ + return (nrf_saadc_oversample_t)NRF_SAADC->OVERSAMPLE; +} + +/** + * @brief Function for initializing the SAADC channel. + * + * @param[in] channel Channel number. + * @param[in] config Pointer to the channel configuration structure. + */ +void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config); + +/** + *@} + **/ + +#endif // NRF52 + +#endif /* NRF_SAADC_H_ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spi.h new file mode 100644 index 0000000000..20dba2d598 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spi.h @@ -0,0 +1,361 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @defgroup nrf_spi_hal SPI HAL + * @{ + * @ingroup nrf_spi_master + * + * @brief Hardware access layer for accessing the SPI peripheral. + */ + +#ifndef NRF_SPI_H__ +#define NRF_SPI_H__ + +#include +#include +#include + +#include "nrf.h" + + +/** + * @brief This value can be used as a parameter for the @ref nrf_spi_pins_set + * function to specify that a given SPI signal (SCK, MOSI, or MISO) + * shall not be connected to a physical pin. + */ +#define NRF_SPI_PIN_NOT_CONNECTED 0xFFFFFFFF + + +/** + * @brief SPI events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_SPI_EVENT_READY = offsetof(NRF_SPI_Type, EVENTS_READY) ///< TXD byte sent and RXD byte received. + /*lint -restore*/ +} nrf_spi_event_t; + +/** + * @brief SPI interrupts. + */ +typedef enum +{ + NRF_SPI_INT_READY_MASK = SPI_INTENSET_READY_Msk ///< Interrupt on READY event. +} nrf_spi_int_mask_t; + +/** + * @brief SPI data rates. + */ +typedef enum +{ + NRF_SPI_FREQ_125K = SPI_FREQUENCY_FREQUENCY_K125, ///< 125 kbps. + NRF_SPI_FREQ_250K = SPI_FREQUENCY_FREQUENCY_K250, ///< 250 kbps. + NRF_SPI_FREQ_500K = SPI_FREQUENCY_FREQUENCY_K500, ///< 500 kbps. + NRF_SPI_FREQ_1M = SPI_FREQUENCY_FREQUENCY_M1, ///< 1 Mbps. + NRF_SPI_FREQ_2M = SPI_FREQUENCY_FREQUENCY_M2, ///< 2 Mbps. + NRF_SPI_FREQ_4M = SPI_FREQUENCY_FREQUENCY_M4, ///< 4 Mbps. + // [conversion to 'int' needed to prevent compilers from complaining + // that the provided value (0x80000000UL) is out of range of "int"] + NRF_SPI_FREQ_8M = (int)SPI_FREQUENCY_FREQUENCY_M8 ///< 8 Mbps. +} nrf_spi_frequency_t; + +/** + * @brief SPI modes. + */ +typedef enum +{ + NRF_SPI_MODE_0, ///< SCK active high, sample on leading edge of clock. + NRF_SPI_MODE_1, ///< SCK active high, sample on trailing edge of clock. + NRF_SPI_MODE_2, ///< SCK active low, sample on leading edge of clock. + NRF_SPI_MODE_3 ///< SCK active low, sample on trailing edge of clock. +} nrf_spi_mode_t; + +/** + * @brief SPI bit orders. + */ +typedef enum +{ + NRF_SPI_BIT_ORDER_MSB_FIRST = SPI_CONFIG_ORDER_MsbFirst, ///< Most significant bit shifted out first. + NRF_SPI_BIT_ORDER_LSB_FIRST = SPI_CONFIG_ORDER_LsbFirst ///< Least significant bit shifted out first. +} nrf_spi_bit_order_t; + + +/** + * @brief Function for clearing a specific SPI event. + * + * @param[in] p_spi SPI instance. + * @param[in] spi_event Event to clear. + */ +__STATIC_INLINE void nrf_spi_event_clear(NRF_SPI_Type * p_spi, + nrf_spi_event_t spi_event); + +/** + * @brief Function for checking the state of a specific SPI event. + * + * @param[in] p_spi SPI instance. + * @param[in] spi_event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_spi_event_check(NRF_SPI_Type * p_spi, + nrf_spi_event_t spi_event); + +/** + * @brief Function for getting the address of a specific SPI event register. + * + * @param[in] p_spi SPI instance. + * @param[in] spi_event Requested event. + * + * @return Address of the specified event register. + */ +__STATIC_INLINE uint32_t * nrf_spi_event_address_get(NRF_SPI_Type * p_spi, + nrf_spi_event_t spi_event); + +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] p_spi SPI instance. + * @param[in] spi_int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_spi_int_enable(NRF_SPI_Type * p_spi, + uint32_t spi_int_mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] p_spi SPI instance. + * @param[in] spi_int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_spi_int_disable(NRF_SPI_Type * p_spi, + uint32_t spi_int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param[in] p_spi SPI instance. + * @param[in] spi_int Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_spi_int_enable_check(NRF_SPI_Type * p_spi, + nrf_spi_int_mask_t spi_int); + +/** + * @brief Function for enabling the SPI peripheral. + * + * @param[in] p_spi SPI instance. + */ +__STATIC_INLINE void nrf_spi_enable(NRF_SPI_Type * p_spi); + +/** + * @brief Function for disabling the SPI peripheral. + * + * @param[in] p_spi SPI instance. + */ +__STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_spi); + +/** + * @brief Function for configuring SPI pins. + * + * If a given signal is not needed, pass the @ref NRF_SPI_PIN_NOT_CONNECTED + * value instead of its pin number. + * + * @param[in] p_spi SPI instance. + * @param[in] sck_pin SCK pin number. + * @param[in] mosi_pin MOSI pin number. + * @param[in] miso_pin MISO pin number. + */ +__STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_spi, + uint32_t sck_pin, + uint32_t mosi_pin, + uint32_t miso_pin); + +/** + * @brief Function for writing data to the SPI transmitter register. + * + * @param[in] p_spi SPI instance. + * @param[in] data TX data to send. + */ +__STATIC_INLINE void nrf_spi_txd_set(NRF_SPI_Type * p_spi, uint8_t data); + +/** + * @brief Function for reading data from the SPI receiver register. + * + * @param[in] p_spi SPI instance. + * + * @return RX data received. + */ +__STATIC_INLINE uint8_t nrf_spi_rxd_get(NRF_SPI_Type * p_spi); + +/** + * @brief Function for setting the SPI master data rate. + * + * @param[in] p_spi SPI instance. + * @param[in] frequency SPI frequency. + */ +__STATIC_INLINE void nrf_spi_frequency_set(NRF_SPI_Type * p_spi, + nrf_spi_frequency_t frequency); + +/** + * @brief Function for setting the SPI configuration. + * + * @param[in] p_spi SPI instance. + * @param[in] spi_mode SPI mode. + * @param[in] spi_bit_order SPI bit order. + */ +__STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_spi, + nrf_spi_mode_t spi_mode, + nrf_spi_bit_order_t spi_bit_order); + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_spi_event_clear(NRF_SPI_Type * p_spi, + nrf_spi_event_t spi_event) +{ + *((volatile uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event)) = 0x0UL; +} + +__STATIC_INLINE bool nrf_spi_event_check(NRF_SPI_Type * p_spi, + nrf_spi_event_t spi_event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event); +} + +__STATIC_INLINE uint32_t * nrf_spi_event_address_get(NRF_SPI_Type * p_spi, + nrf_spi_event_t spi_event) +{ + return (uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event); +} + +__STATIC_INLINE void nrf_spi_int_enable(NRF_SPI_Type * p_spi, + uint32_t spi_int_mask) +{ + p_spi->INTENSET = spi_int_mask; +} + +__STATIC_INLINE void nrf_spi_int_disable(NRF_SPI_Type * p_spi, + uint32_t spi_int_mask) +{ + p_spi->INTENCLR = spi_int_mask; +} + +__STATIC_INLINE bool nrf_spi_int_enable_check(NRF_SPI_Type * p_spi, + nrf_spi_int_mask_t spi_int) +{ + return (bool)(p_spi->INTENSET & spi_int); +} + +__STATIC_INLINE void nrf_spi_enable(NRF_SPI_Type * p_spi) +{ + p_spi->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_spi) +{ + p_spi->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_spi, + uint32_t sck_pin, + uint32_t mosi_pin, + uint32_t miso_pin) +{ + p_spi->PSELSCK = sck_pin; + p_spi->PSELMOSI = mosi_pin; + p_spi->PSELMISO = miso_pin; +} + +__STATIC_INLINE void nrf_spi_txd_set(NRF_SPI_Type * p_spi, uint8_t data) +{ + p_spi->TXD = data; +} + +__STATIC_INLINE uint8_t nrf_spi_rxd_get(NRF_SPI_Type * p_spi) +{ + return p_spi->RXD; +} + +__STATIC_INLINE void nrf_spi_frequency_set(NRF_SPI_Type * p_spi, + nrf_spi_frequency_t frequency) +{ + p_spi->FREQUENCY = frequency; +} + +__STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_spi, + nrf_spi_mode_t spi_mode, + nrf_spi_bit_order_t spi_bit_order) +{ + uint32_t config = (spi_bit_order == NRF_SPI_BIT_ORDER_MSB_FIRST ? + SPI_CONFIG_ORDER_MsbFirst : SPI_CONFIG_ORDER_LsbFirst); + switch (spi_mode) + { + default: + case NRF_SPI_MODE_0: + config |= (SPI_CONFIG_CPOL_ActiveHigh << SPI_CONFIG_CPOL_Pos) | + (SPI_CONFIG_CPHA_Leading << SPI_CONFIG_CPHA_Pos); + break; + + case NRF_SPI_MODE_1: + config |= (SPI_CONFIG_CPOL_ActiveHigh << SPI_CONFIG_CPOL_Pos) | + (SPI_CONFIG_CPHA_Trailing << SPI_CONFIG_CPHA_Pos); + break; + + case NRF_SPI_MODE_2: + config |= (SPI_CONFIG_CPOL_ActiveLow << SPI_CONFIG_CPOL_Pos) | + (SPI_CONFIG_CPHA_Leading << SPI_CONFIG_CPHA_Pos); + break; + + case NRF_SPI_MODE_3: + config |= (SPI_CONFIG_CPOL_ActiveLow << SPI_CONFIG_CPOL_Pos) | + (SPI_CONFIG_CPHA_Trailing << SPI_CONFIG_CPHA_Pos); + break; + } + p_spi->CONFIG = config; +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_SPI_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spim.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spim.h new file mode 100644 index 0000000000..495b4dd316 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spim.h @@ -0,0 +1,547 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @defgroup nrf_spim_hal SPIM HAL + * @{ + * @ingroup nrf_spi_master + * + * @brief Hardware access layer for accessing the SPIM peripheral. + */ + +#ifndef NRF_SPIM_H__ +#define NRF_SPIM_H__ + +#include +#include +#include + +#include "nrf.h" + + +/** + * @brief This value can be used as a parameter for the @ref nrf_spim_pins_set + * function to specify that a given SPI signal (SCK, MOSI, or MISO) + * shall not be connected to a physical pin. + */ +#define NRF_SPIM_PIN_NOT_CONNECTED 0xFFFFFFFF + + +/** + * @brief SPIM tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_SPIM_TASK_START = offsetof(NRF_SPIM_Type, TASKS_START), ///< Start SPI transaction. + NRF_SPIM_TASK_STOP = offsetof(NRF_SPIM_Type, TASKS_STOP), ///< Stop SPI transaction. + NRF_SPIM_TASK_SUSPEND = offsetof(NRF_SPIM_Type, TASKS_SUSPEND), ///< Suspend SPI transaction. + NRF_SPIM_TASK_RESUME = offsetof(NRF_SPIM_Type, TASKS_RESUME) ///< Resume SPI transaction. + /*lint -restore*/ +} nrf_spim_task_t; + +/** + * @brief SPIM events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_SPIM_EVENT_STOPPED = offsetof(NRF_SPIM_Type, EVENTS_STOPPED), ///< SPI transaction has stopped. + NRF_SPIM_EVENT_ENDRX = offsetof(NRF_SPIM_Type, EVENTS_ENDRX), ///< End of RXD buffer reached. +#ifdef NRF52 + NRF_SPIM_EVENT_END = offsetof(NRF_SPIM_Type, EVENTS_END), ///< End of RXD buffer and TXD buffer reached. +#endif + NRF_SPIM_EVENT_ENDTX = offsetof(NRF_SPIM_Type, EVENTS_ENDTX), ///< End of TXD buffer reached. + NRF_SPIM_EVENT_STARTED = offsetof(NRF_SPIM_Type, EVENTS_STARTED) ///< Transaction started. + /*lint -restore*/ +} nrf_spim_event_t; + +#ifdef NRF52 +/** + * @brief SPIM shortcuts. + */ +typedef enum +{ + NRF_SPIM_SHORT_END_START_MASK = SPIM_SHORTS_END_START_Msk ///< Shortcut between END event and START task. +} nrf_spim_short_mask_t; +#endif + +/** + * @brief SPIM interrupts. + */ +typedef enum +{ + NRF_SPIM_INT_STOPPED_MASK = SPIM_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event. + NRF_SPIM_INT_ENDRX_MASK = SPIM_INTENSET_ENDRX_Msk, ///< Interrupt on ENDRX event. +#ifdef NRF52 + NRF_SPIM_INT_END_MASK = SPIM_INTENSET_END_Msk, ///< Interrupt on END event. +#endif + NRF_SPIM_INT_ENDTX_MASK = SPIM_INTENSET_ENDTX_Msk, ///< Interrupt on ENDTX event. + NRF_SPIM_INT_STARTED_MASK = SPIM_INTENSET_STARTED_Msk ///< Interrupt on STARTED event. +} nrf_spim_int_mask_t; + +/** + * @brief SPI master data rates. + */ +typedef enum +{ + NRF_SPIM_FREQ_125K = SPIM_FREQUENCY_FREQUENCY_K125, ///< 125 kbps. + NRF_SPIM_FREQ_250K = SPIM_FREQUENCY_FREQUENCY_K250, ///< 250 kbps. + NRF_SPIM_FREQ_500K = SPIM_FREQUENCY_FREQUENCY_K500, ///< 500 kbps. + NRF_SPIM_FREQ_1M = SPIM_FREQUENCY_FREQUENCY_M1, ///< 1 Mbps. + NRF_SPIM_FREQ_2M = SPIM_FREQUENCY_FREQUENCY_M2, ///< 2 Mbps. + NRF_SPIM_FREQ_4M = SPIM_FREQUENCY_FREQUENCY_M4, ///< 4 Mbps. + // [conversion to 'int' needed to prevent compilers from complaining + // that the provided value (0x80000000UL) is out of range of "int"] + NRF_SPIM_FREQ_8M = (int)SPIM_FREQUENCY_FREQUENCY_M8 ///< 8 Mbps. +} nrf_spim_frequency_t; + +/** + * @brief SPI modes. + */ +typedef enum +{ + NRF_SPIM_MODE_0, ///< SCK active high, sample on leading edge of clock. + NRF_SPIM_MODE_1, ///< SCK active high, sample on trailing edge of clock. + NRF_SPIM_MODE_2, ///< SCK active low, sample on leading edge of clock. + NRF_SPIM_MODE_3 ///< SCK active low, sample on trailing edge of clock. +} nrf_spim_mode_t; + +/** + * @brief SPI bit orders. + */ +typedef enum +{ + NRF_SPIM_BIT_ORDER_MSB_FIRST = SPIM_CONFIG_ORDER_MsbFirst, ///< Most significant bit shifted out first. + NRF_SPIM_BIT_ORDER_LSB_FIRST = SPIM_CONFIG_ORDER_LsbFirst ///< Least significant bit shifted out first. +} nrf_spim_bit_order_t; + + +/** + * @brief Function for activating a specific SPIM task. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_task Task to activate. + */ +__STATIC_INLINE void nrf_spim_task_trigger(NRF_SPIM_Type * p_spim, + nrf_spim_task_t spim_task); + +/** + * @brief Function for getting the address of a specific SPIM task register. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_task Requested task. + * + * @return Address of the specified task register. + */ +__STATIC_INLINE uint32_t nrf_spim_task_address_get(NRF_SPIM_Type * p_spim, + nrf_spim_task_t spim_task); + +/** + * @brief Function for clearing a specific SPIM event. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_event Event to clear. + */ +__STATIC_INLINE void nrf_spim_event_clear(NRF_SPIM_Type * p_spim, + nrf_spim_event_t spim_event); + +/** + * @brief Function for checking the state of a specific SPIM event. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_spim, + nrf_spim_event_t spim_event); + +/** + * @brief Function for getting the address of a specific SPIM event register. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_event Requested event. + * + * @return Address of the specified event register. + */ +__STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type * p_spim, + nrf_spim_event_t spim_event); +#ifdef NRF52 +/** + * @brief Function for enabling specified shortcuts. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_shorts_mask Shortcuts to enable. + */ +__STATIC_INLINE void nrf_spim_shorts_enable(NRF_SPIM_Type * p_spim, + uint32_t spim_shorts_mask); + +/** + * @brief Function for disabling specified shortcuts. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_shorts_mask Shortcuts to disable. + */ +__STATIC_INLINE void nrf_spim_shorts_disable(NRF_SPIM_Type * p_spim, + uint32_t spim_shorts_mask); + +/** + * @brief Function for getting shorts setting. + * + * @param[in] p_spim SPIM instance. + */ +__STATIC_INLINE uint32_t nrf_spim_shorts_get(NRF_SPIM_Type * p_spim); +#endif +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_spim_int_enable(NRF_SPIM_Type * p_spim, + uint32_t spim_int_mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_spim_int_disable(NRF_SPIM_Type * p_spim, + uint32_t spim_int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param[in] p_spim SPIM instance. + * @param[in] spim_int Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_spim_int_enable_check(NRF_SPIM_Type * p_spim, + nrf_spim_int_mask_t spim_int); + +/** + * @brief Function for enabling the SPIM peripheral. + * + * @param[in] p_spim SPIM instance. + */ +__STATIC_INLINE void nrf_spim_enable(NRF_SPIM_Type * p_spim); + +/** + * @brief Function for disabling the SPIM peripheral. + * + * @param[in] p_spim SPIM instance. + */ +__STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_spim); + +/** + * @brief Function for configuring SPIM pins. + * + * If a given signal is not needed, pass the @ref NRF_SPIM_PIN_NOT_CONNECTED + * value instead of its pin number. + * + * @param[in] p_spim SPIM instance. + * @param[in] sck_pin SCK pin number. + * @param[in] mosi_pin MOSI pin number. + * @param[in] miso_pin MISO pin number. + */ +__STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_spim, + uint32_t sck_pin, + uint32_t mosi_pin, + uint32_t miso_pin); + +/** + * @brief Function for setting the SPI master data rate. + * + * @param[in] p_spim SPIM instance. + * @param[in] frequency SPI frequency. + */ +__STATIC_INLINE void nrf_spim_frequency_set(NRF_SPIM_Type * p_spim, + nrf_spim_frequency_t frequency); + +/** + * @brief Function for setting the transmit buffer. + * + * @param[in] p_spim SPIM instance. + * @param[in] p_buffer Pointer to the buffer with data to send. + * @param[in] length Maximum number of data bytes to transmit. + */ +__STATIC_INLINE void nrf_spim_tx_buffer_set(NRF_SPIM_Type * p_spim, + uint8_t const * p_buffer, + uint8_t length); + +/** + * @brief Function for setting the receive buffer. + * + * @param[in] p_spim SPIM instance. + * @param[in] p_buffer Pointer to the buffer for received data. + * @param[in] length Maximum number of data bytes to receive. + */ +__STATIC_INLINE void nrf_spim_rx_buffer_set(NRF_SPIM_Type * p_spim, + uint8_t * p_buffer, + uint8_t length); + +/** + * @brief Function for setting the SPI configuration. + * + * @param[in] p_spim SPIM instance. + * @param[in] spi_mode SPI mode. + * @param[in] spi_bit_order SPI bit order. + */ +__STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_spim, + nrf_spim_mode_t spi_mode, + nrf_spim_bit_order_t spi_bit_order); + +/** + * @brief Function for setting the over-read character. + * + * @param[in] p_spim SPIM instance. + * @param[in] orc Over-read character that is clocked out in case of + * an over-read of the TXD buffer. + */ +__STATIC_INLINE void nrf_spim_orc_set(NRF_SPIM_Type * p_spim, + uint8_t orc); + +#ifdef NRF52 +/** + * @brief Function for enabling the TX list feature. + * + * @param[in] p_spim SPIM instance. + */ +__STATIC_INLINE void nrf_spim_tx_list_enable(NRF_SPIM_Type * p_spim); + +/** + * @brief Function for disabling the TX list feature. + * + * @param[in] p_spim SPIM instance. + */ +__STATIC_INLINE void nrf_spim_tx_list_disable(NRF_SPIM_Type * p_spim); + +/** + * @brief Function for enabling the RX list feature. + * + * @param[in] p_spim SPIM instance. + */ +__STATIC_INLINE void nrf_spim_rx_list_enable(NRF_SPIM_Type * p_spim); + +/** + * @brief Function for disabling the RX list feature. + * + * @param[in] p_spim SPIM instance. + */ +__STATIC_INLINE void nrf_spim_rx_list_disable(NRF_SPIM_Type * p_spim); +#endif +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_spim_task_trigger(NRF_SPIM_Type * p_spim, + nrf_spim_task_t spim_task) +{ + *((volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t nrf_spim_task_address_get(NRF_SPIM_Type * p_spim, + nrf_spim_task_t spim_task) +{ + return (uint32_t)((uint8_t *)p_spim + (uint32_t)spim_task); +} + +__STATIC_INLINE void nrf_spim_event_clear(NRF_SPIM_Type * p_spim, + nrf_spim_event_t spim_event) +{ + *((volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_event)) = 0x0UL; +} + +__STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_spim, + nrf_spim_event_t spim_event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_event); +} + +__STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type * p_spim, + nrf_spim_event_t spim_event) +{ + return (uint32_t)((uint8_t *)p_spim + (uint32_t)spim_event); +} + +#ifdef NRF52 +__STATIC_INLINE void nrf_spim_shorts_enable(NRF_SPIM_Type * p_spim, + uint32_t spim_shorts_mask) +{ + p_spim->SHORTS |= spim_shorts_mask; +} + +__STATIC_INLINE void nrf_spim_shorts_disable(NRF_SPIM_Type * p_spim, + uint32_t spim_shorts_mask) +{ + p_spim->SHORTS &= ~(spim_shorts_mask); +} + +__STATIC_INLINE uint32_t nrf_spim_shorts_get(NRF_SPIM_Type * p_spim) +{ + return p_spim->SHORTS; +} +#endif +__STATIC_INLINE void nrf_spim_int_enable(NRF_SPIM_Type * p_spim, + uint32_t spim_int_mask) +{ + p_spim->INTENSET = spim_int_mask; +} + +__STATIC_INLINE void nrf_spim_int_disable(NRF_SPIM_Type * p_spim, + uint32_t spim_int_mask) +{ + p_spim->INTENCLR = spim_int_mask; +} + +__STATIC_INLINE bool nrf_spim_int_enable_check(NRF_SPIM_Type * p_spim, + nrf_spim_int_mask_t spim_int) +{ + return (bool)(p_spim->INTENSET & spim_int); +} + +__STATIC_INLINE void nrf_spim_enable(NRF_SPIM_Type * p_spim) +{ + p_spim->ENABLE = (SPIM_ENABLE_ENABLE_Enabled << SPIM_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_spim) +{ + p_spim->ENABLE = (SPIM_ENABLE_ENABLE_Disabled << SPIM_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_spim, + uint32_t sck_pin, + uint32_t mosi_pin, + uint32_t miso_pin) +{ + p_spim->PSEL.SCK = sck_pin; + p_spim->PSEL.MOSI = mosi_pin; + p_spim->PSEL.MISO = miso_pin; +} + +__STATIC_INLINE void nrf_spim_frequency_set(NRF_SPIM_Type * p_spim, + nrf_spim_frequency_t frequency) +{ + p_spim->FREQUENCY = frequency; +} + +__STATIC_INLINE void nrf_spim_tx_buffer_set(NRF_SPIM_Type * p_spim, + uint8_t const * p_buffer, + uint8_t length) +{ + p_spim->TXD.PTR = (uint32_t)p_buffer; + p_spim->TXD.MAXCNT = length; +} + +__STATIC_INLINE void nrf_spim_rx_buffer_set(NRF_SPIM_Type * p_spim, + uint8_t * p_buffer, + uint8_t length) +{ + p_spim->RXD.PTR = (uint32_t)p_buffer; + p_spim->RXD.MAXCNT = length; +} + +__STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_spim, + nrf_spim_mode_t spi_mode, + nrf_spim_bit_order_t spi_bit_order) +{ + uint32_t config = (spi_bit_order == NRF_SPIM_BIT_ORDER_MSB_FIRST ? + SPIM_CONFIG_ORDER_MsbFirst : SPIM_CONFIG_ORDER_LsbFirst); + switch (spi_mode) + { + default: + case NRF_SPIM_MODE_0: + config |= (SPIM_CONFIG_CPOL_ActiveHigh << SPIM_CONFIG_CPOL_Pos) | + (SPIM_CONFIG_CPHA_Leading << SPIM_CONFIG_CPHA_Pos); + break; + + case NRF_SPIM_MODE_1: + config |= (SPIM_CONFIG_CPOL_ActiveHigh << SPIM_CONFIG_CPOL_Pos) | + (SPIM_CONFIG_CPHA_Trailing << SPIM_CONFIG_CPHA_Pos); + break; + + case NRF_SPIM_MODE_2: + config |= (SPIM_CONFIG_CPOL_ActiveLow << SPIM_CONFIG_CPOL_Pos) | + (SPIM_CONFIG_CPHA_Leading << SPIM_CONFIG_CPHA_Pos); + break; + + case NRF_SPIM_MODE_3: + config |= (SPIM_CONFIG_CPOL_ActiveLow << SPIM_CONFIG_CPOL_Pos) | + (SPIM_CONFIG_CPHA_Trailing << SPIM_CONFIG_CPHA_Pos); + break; + } + p_spim->CONFIG = config; +} + +__STATIC_INLINE void nrf_spim_orc_set(NRF_SPIM_Type * p_spim, + uint8_t orc) +{ + p_spim->ORC = orc; +} + +#ifdef NRF52 +__STATIC_INLINE void nrf_spim_tx_list_enable(NRF_SPIM_Type * p_spim) +{ + p_spim->TXD.LIST = 1; +} + +__STATIC_INLINE void nrf_spim_tx_list_disable(NRF_SPIM_Type * p_spim) +{ + p_spim->TXD.LIST = 0; +} + +__STATIC_INLINE void nrf_spim_rx_list_enable(NRF_SPIM_Type * p_spim) +{ + p_spim->RXD.LIST = 1; +} + +__STATIC_INLINE void nrf_spim_rx_list_disable(NRF_SPIM_Type * p_spim) +{ + p_spim->RXD.LIST = 0; +} +#endif +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_SPIM_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spis.h new file mode 100644 index 0000000000..6312ce131c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spis.h @@ -0,0 +1,539 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @defgroup nrf_spis_hal SPIS HAL + * @{ + * @ingroup nrf_spis + * + * @brief Hardware access layer for accessing the SPIS peripheral. + */ + +#ifndef NRF_SPIS_H__ +#define NRF_SPIS_H__ + +#include +#include +#include + +#include "nrf.h" + + +/** + * @brief This value can be used as a parameter for the @ref nrf_spis_pins_set + * function to specify that a given SPI signal (SCK, MOSI, or MISO) + * shall not be connected to a physical pin. + */ +#define NRF_SPIS_PIN_NOT_CONNECTED 0xFFFFFFFF + + +/** + * @brief SPIS tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_SPIS_TASK_ACQUIRE = offsetof(NRF_SPIS_Type, TASKS_ACQUIRE), ///< Acquire SPI semaphore. + NRF_SPIS_TASK_RELEASE = offsetof(NRF_SPIS_Type, TASKS_RELEASE), ///< Release SPI semaphore, enabling the SPI slave to acquire it. + /*lint -restore*/ +} nrf_spis_task_t; + +/** + * @brief SPIS events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_SPIS_EVENT_END = offsetof(NRF_SPIS_Type, EVENTS_END), ///< Granted transaction completed. + NRF_SPIS_EVENT_ACQUIRED = offsetof(NRF_SPIS_Type, EVENTS_ACQUIRED) ///< Semaphore acquired. + /*lint -restore*/ +} nrf_spis_event_t; + +/** + * @brief SPIS shortcuts. + */ +typedef enum +{ + NRF_SPIS_SHORT_END_ACQUIRE = SPIS_SHORTS_END_ACQUIRE_Msk ///< Shortcut between END event and ACQUIRE task. +} nrf_spis_short_mask_t; + +/** + * @brief SPIS interrupts. + */ +typedef enum +{ + NRF_SPIS_INT_END_MASK = SPIS_INTENSET_END_Msk, ///< Interrupt on END event. + NRF_SPIS_INT_ACQUIRED_MASK = SPIS_INTENSET_ACQUIRED_Msk ///< Interrupt on ACQUIRED event. +} nrf_spis_int_mask_t; + +/** + * @brief SPI modes. + */ +typedef enum +{ + NRF_SPIS_MODE_0, ///< SCK active high, sample on leading edge of clock. + NRF_SPIS_MODE_1, ///< SCK active high, sample on trailing edge of clock. + NRF_SPIS_MODE_2, ///< SCK active low, sample on leading edge of clock. + NRF_SPIS_MODE_3 ///< SCK active low, sample on trailing edge of clock. +} nrf_spis_mode_t; + +/** + * @brief SPI bit orders. + */ +typedef enum +{ + NRF_SPIS_BIT_ORDER_MSB_FIRST = SPIS_CONFIG_ORDER_MsbFirst, ///< Most significant bit shifted out first. + NRF_SPIS_BIT_ORDER_LSB_FIRST = SPIS_CONFIG_ORDER_LsbFirst ///< Least significant bit shifted out first. +} nrf_spis_bit_order_t; + +/** + * @brief SPI semaphore status. + */ +typedef enum +{ + NRF_SPIS_SEMSTAT_FREE = 0, ///< Semaphore is free. + NRF_SPIS_SEMSTAT_CPU = 1, ///< Semaphore is assigned to the CPU. + NRF_SPIS_SEMSTAT_SPIS = 2, ///< Semaphore is assigned to the SPI slave. + NRF_SPIS_SEMSTAT_CPUPENDING = 3 ///< Semaphore is assigned to the SPI, but a handover to the CPU is pending. +} nrf_spis_semstat_t; + +/** + * @brief SPIS status. + */ +typedef enum +{ + NRF_SPIS_STATUS_OVERREAD = SPIS_STATUS_OVERREAD_Msk, ///< TX buffer over-read detected and prevented. + NRF_SPIS_STATUS_OVERFLOW = SPIS_STATUS_OVERFLOW_Msk ///< RX buffer overflow detected and prevented. +} nrf_spis_status_mask_t; + +/** + * @brief Function for activating a specific SPIS task. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_task Task to activate. + */ +__STATIC_INLINE void nrf_spis_task_trigger(NRF_SPIS_Type * p_spis, + nrf_spis_task_t spis_task); + +/** + * @brief Function for getting the address of a specific SPIS task register. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_task Requested task. + * + * @return Address of the specified task register. + */ +__STATIC_INLINE uint32_t nrf_spis_task_address_get(NRF_SPIS_Type const * p_spis, + nrf_spis_task_t spis_task); + +/** + * @brief Function for clearing a specific SPIS event. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_event Event to clear. + */ +__STATIC_INLINE void nrf_spis_event_clear(NRF_SPIS_Type * p_spis, + nrf_spis_event_t spis_event); + +/** + * @brief Function for checking the state of a specific SPIS event. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_spis_event_check(NRF_SPIS_Type const * p_spis, + nrf_spis_event_t spis_event); + +/** + * @brief Function for getting the address of a specific SPIS event register. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_event Requested event. + * + * @return Address of the specified event register. + */ +__STATIC_INLINE uint32_t nrf_spis_event_address_get(NRF_SPIS_Type const * p_spis, + nrf_spis_event_t spis_event); + +/** + * @brief Function for enabling specified shortcuts. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_shorts_mask Shortcuts to enable. + */ +__STATIC_INLINE void nrf_spis_shorts_enable(NRF_SPIS_Type * p_spis, + uint32_t spis_shorts_mask); + +/** + * @brief Function for disabling specified shortcuts. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_shorts_mask Shortcuts to disable. + */ +__STATIC_INLINE void nrf_spis_shorts_disable(NRF_SPIS_Type * p_spis, + uint32_t spis_shorts_mask); + +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_spis_int_enable(NRF_SPIS_Type * p_spis, + uint32_t spis_int_mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_spis_int_disable(NRF_SPIS_Type * p_spis, + uint32_t spis_int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param[in] p_spis SPIS instance. + * @param[in] spis_int Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_spis_int_enable_check(NRF_SPIS_Type const * p_spis, + nrf_spis_int_mask_t spis_int); + +/** + * @brief Function for enabling the SPIS peripheral. + * + * @param[in] p_spis SPIS instance. + */ +__STATIC_INLINE void nrf_spis_enable(NRF_SPIS_Type * p_spis); + +/** + * @brief Function for disabling the SPIS peripheral. + * + * @param[in] p_spis SPIS instance. + */ +__STATIC_INLINE void nrf_spis_disable(NRF_SPIS_Type * p_spis); + +/** + * @brief Function for retrieving the SPIS semaphore status. + * + * @param[in] p_spis SPIS instance. + * + * @returns Current semaphore status. + */ +__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get(NRF_SPIS_Type * p_spis); + +/** + * @brief Function for retrieving the SPIS status. + * + * @param[in] p_spis SPIS instance. + * + * @returns Current SPIS status. + */ +__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_spis); + +/** + * @brief Function for configuring SPIS pins. + * + * If a given signal is not needed, pass the @ref NRF_SPIS_PIN_NOT_CONNECTED + * value instead of its pin number. + * + * @param[in] p_spis SPIS instance. + * @param[in] sck_pin SCK pin number. + * @param[in] mosi_pin MOSI pin number. + * @param[in] miso_pin MISO pin number. + * @param[in] csn_pin CSN pin number. + */ +__STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_spis, + uint32_t sck_pin, + uint32_t mosi_pin, + uint32_t miso_pin, + uint32_t csn_pin); + +/** + * @brief Function for setting the transmit buffer. + * + * @param[in] p_spis SPIS instance. + * @param[in] p_buffer Pointer to the buffer that contains the data to send. + * @param[in] length Maximum number of data bytes to transmit. + */ +__STATIC_INLINE void nrf_spis_tx_buffer_set(NRF_SPIS_Type * p_spis, + uint8_t const * p_buffer, + uint8_t length); + +/** + * @brief Function for setting the receive buffer. + * + * @param[in] p_spis SPIS instance. + * @param[in] p_buffer Pointer to the buffer for received data. + * @param[in] length Maximum number of data bytes to receive. + */ +__STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_spis, + uint8_t * p_buffer, + uint8_t length); + +/** + * @brief Function for getting the number of bytes transmitted + * in the last granted transaction. + * + * @param[in] p_spis SPIS instance. + * + * @returns Number of bytes transmitted. + */ +__STATIC_INLINE uint8_t nrf_spis_tx_amount_get(NRF_SPIS_Type const * p_spis); + +/** + * @brief Function for getting the number of bytes received + * in the last granted transaction. + * + * @param[in] p_spis SPIS instance. + * + * @returns Number of bytes received. + */ +__STATIC_INLINE uint8_t nrf_spis_rx_amount_get(NRF_SPIS_Type const * p_spis); + +/** + * @brief Function for setting the SPI configuration. + * + * @param[in] p_spis SPIS instance. + * @param[in] spi_mode SPI mode. + * @param[in] spi_bit_order SPI bit order. + */ +__STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_spis, + nrf_spis_mode_t spi_mode, + nrf_spis_bit_order_t spi_bit_order); + +/** + * @brief Function for setting the default character. + * + * @param[in] p_spis SPIS instance. + * @param[in] def Default character that is clocked out in case of + * an overflow of the RXD buffer. + */ +__STATIC_INLINE void nrf_spis_def_set(NRF_SPIS_Type * p_spis, + uint8_t def); + +/** + * @brief Function for setting the over-read character. + * + * @param[in] p_spis SPIS instance. + * @param[in] orc Over-read character that is clocked out in case of + * an over-read of the TXD buffer. + */ +__STATIC_INLINE void nrf_spis_orc_set(NRF_SPIS_Type * p_spis, + uint8_t orc); + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_spis_task_trigger(NRF_SPIS_Type * p_spis, + nrf_spis_task_t spis_task) +{ + *((volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t nrf_spis_task_address_get(NRF_SPIS_Type const * p_spis, + nrf_spis_task_t spis_task) +{ + return (uint32_t)p_spis + (uint32_t)spis_task; +} + +__STATIC_INLINE void nrf_spis_event_clear(NRF_SPIS_Type * p_spis, + nrf_spis_event_t spis_event) +{ + *((volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_event)) = 0x0UL; +} + +__STATIC_INLINE bool nrf_spis_event_check(NRF_SPIS_Type const * p_spis, + nrf_spis_event_t spis_event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_event); +} + +__STATIC_INLINE uint32_t nrf_spis_event_address_get(NRF_SPIS_Type const * p_spis, + nrf_spis_event_t spis_event) +{ + return (uint32_t)p_spis + (uint32_t)spis_event; +} + +__STATIC_INLINE void nrf_spis_shorts_enable(NRF_SPIS_Type * p_spis, + uint32_t spis_shorts_mask) +{ + p_spis->SHORTS |= spis_shorts_mask; +} + +__STATIC_INLINE void nrf_spis_shorts_disable(NRF_SPIS_Type * p_spis, + uint32_t spis_shorts_mask) +{ + p_spis->SHORTS &= ~(spis_shorts_mask); +} + +__STATIC_INLINE void nrf_spis_int_enable(NRF_SPIS_Type * p_spis, + uint32_t spis_int_mask) +{ + p_spis->INTENSET = spis_int_mask; +} + +__STATIC_INLINE void nrf_spis_int_disable(NRF_SPIS_Type * p_spis, + uint32_t spis_int_mask) +{ + p_spis->INTENCLR = spis_int_mask; +} + +__STATIC_INLINE bool nrf_spis_int_enable_check(NRF_SPIS_Type const * p_spis, + nrf_spis_int_mask_t spis_int) +{ + return (bool)(p_spis->INTENSET & spis_int); +} + +__STATIC_INLINE void nrf_spis_enable(NRF_SPIS_Type * p_spis) +{ + p_spis->ENABLE = (SPIS_ENABLE_ENABLE_Enabled << SPIS_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_spis_disable(NRF_SPIS_Type * p_spis) +{ + p_spis->ENABLE = (SPIS_ENABLE_ENABLE_Disabled << SPIS_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get(NRF_SPIS_Type * p_spis) +{ + return (nrf_spis_semstat_t) ((p_spis->SEMSTAT & SPIS_SEMSTAT_SEMSTAT_Msk) + >> SPIS_SEMSTAT_SEMSTAT_Pos); +} + +__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_spis) +{ + return (nrf_spis_status_mask_t) p_spis->STATUS; +} + +__STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_spis, + uint32_t sck_pin, + uint32_t mosi_pin, + uint32_t miso_pin, + uint32_t csn_pin) +{ + p_spis->PSELSCK = sck_pin; + p_spis->PSELMOSI = mosi_pin; + p_spis->PSELMISO = miso_pin; + p_spis->PSELCSN = csn_pin; +} + +__STATIC_INLINE void nrf_spis_tx_buffer_set(NRF_SPIS_Type * p_spis, + uint8_t const * p_buffer, + uint8_t length) +{ + p_spis->TXDPTR = (uint32_t)p_buffer; + p_spis->MAXTX = length; +} + +__STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_spis, + uint8_t * p_buffer, + uint8_t length) +{ + p_spis->RXDPTR = (uint32_t)p_buffer; + p_spis->MAXRX = length; +} + +__STATIC_INLINE uint8_t nrf_spis_tx_amount_get(NRF_SPIS_Type const * p_spis) +{ + return (uint8_t) p_spis->AMOUNTRX; +} + +__STATIC_INLINE uint8_t nrf_spis_rx_amount_get(NRF_SPIS_Type const * p_spis) +{ + return (uint8_t) p_spis->AMOUNTTX; +} + +__STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_spis, + nrf_spis_mode_t spi_mode, + nrf_spis_bit_order_t spi_bit_order) +{ + uint32_t config = (spi_bit_order == NRF_SPIS_BIT_ORDER_MSB_FIRST ? + SPIS_CONFIG_ORDER_MsbFirst : SPIS_CONFIG_ORDER_LsbFirst); + + switch (spi_mode) + { + default: + case NRF_SPIS_MODE_0: + config |= (SPIS_CONFIG_CPOL_ActiveHigh << SPIS_CONFIG_CPOL_Pos) | + (SPIS_CONFIG_CPHA_Leading << SPIS_CONFIG_CPHA_Pos); + break; + + case NRF_SPIS_MODE_1: + config |= (SPIS_CONFIG_CPOL_ActiveHigh << SPIS_CONFIG_CPOL_Pos) | + (SPIS_CONFIG_CPHA_Trailing << SPIS_CONFIG_CPHA_Pos); + break; + + case NRF_SPIS_MODE_2: + config |= (SPIS_CONFIG_CPOL_ActiveLow << SPIS_CONFIG_CPOL_Pos) | + (SPIS_CONFIG_CPHA_Leading << SPIS_CONFIG_CPHA_Pos); + break; + + case NRF_SPIS_MODE_3: + config |= (SPIS_CONFIG_CPOL_ActiveLow << SPIS_CONFIG_CPOL_Pos) | + (SPIS_CONFIG_CPHA_Trailing << SPIS_CONFIG_CPHA_Pos); + break; + } + p_spis->CONFIG = config; +} + +__STATIC_INLINE void nrf_spis_orc_set(NRF_SPIS_Type * p_spis, + uint8_t orc) +{ + p_spis->ORC = orc; +} + +__STATIC_INLINE void nrf_spis_def_set(NRF_SPIS_Type * p_spis, + uint8_t def) +{ + p_spis->DEF = def; +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_SPIS_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_temp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_temp.h new file mode 100644 index 0000000000..001f7f0bc9 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_temp.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_TEMP_H__ +#define NRF_TEMP_H__ + +#include "nrf.h" + +/** +* @defgroup nrf_temperature TEMP (temperature) abstraction +* @{ +* @ingroup nrf_drivers temperature_example +* @brief Temperature module init and read functions. +* +*/ + +/**@cond NO_DOXYGEN */ +#define MASK_SIGN (0x00000200UL) +#define MASK_SIGN_EXTENSION (0xFFFFFC00UL) + +/** + * @brief Function for preparing the temp module for temperature measurement. + * + * This function initializes the TEMP module and writes to the hidden configuration register. + */ +static __INLINE void nrf_temp_init(void) +{ + /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ + *(uint32_t *) 0x4000C504 = 0; +} + +/** + * @brief Function for reading temperature measurement. + * + * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. + */ +static __INLINE int32_t nrf_temp_read(void) +{ + /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ + return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); +} +/**@endcond */ + +/** @} */ + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_timer.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_timer.h new file mode 100644 index 0000000000..85d4ac5a1b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_timer.h @@ -0,0 +1,603 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @defgroup nrf_timer_hal Timer HAL + * @{ + * @ingroup nrf_timer + * + * @brief Hardware access layer for accessing the timer peripheral. + */ + +#ifndef NRF_TIMER_H__ +#define NRF_TIMER_H__ + +#include +#include +#include + +#include "nrf.h" +#include "nrf_assert.h" + + +/** + * @brief Macro for validating the correctness of the BIT_WIDTH setting. + */ +#ifdef NRF51 + /** + * In the nRF51 Series, timer instance 0 supports all available bit widths. + * The other two instances support only 8 and 16 bits. + */ + #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_timer, bit_width) \ + ((p_timer == NRF_TIMER0) || (bit_width <= NRF_TIMER_BIT_WIDTH_16)) +#else + /** + * In the nRF52 Series, all timer instances support all available bit widths. + */ + #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_timer, bit_width) true +#endif + +/** + * @brief Macro for getting the number of capture/compare channels available + * in a given timer instance. + */ +#ifdef NRF51 + #define NRF_TIMER_CC_CHANNEL_COUNT(id) 4 +#else + #define NRF_TIMER_CC_CHANNEL_COUNT(id) ((id) <= 2 ? 4 : 6) +#endif + + +/** + * @brief Timer tasks. + */ +typedef enum +{ + /*lint -save -e30 -esym(628,__INTADDR__)*/ + NRF_TIMER_TASK_START = offsetof(NRF_TIMER_Type, TASKS_START), ///< Task for starting the timer. + NRF_TIMER_TASK_STOP = offsetof(NRF_TIMER_Type, TASKS_STOP), ///< Task for stopping the timer. + NRF_TIMER_TASK_COUNT = offsetof(NRF_TIMER_Type, TASKS_COUNT), ///< Task for incrementing the timer (in counter mode). + NRF_TIMER_TASK_CLEAR = offsetof(NRF_TIMER_Type, TASKS_CLEAR), ///< Task for resetting the timer value. + NRF_TIMER_TASK_SHUTDOWN = offsetof(NRF_TIMER_Type, TASKS_SHUTDOWN), ///< Task for powering off the timer. + NRF_TIMER_TASK_CAPTURE0 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[0]), ///< Task for capturing the timer value on channel 0. + NRF_TIMER_TASK_CAPTURE1 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[1]), ///< Task for capturing the timer value on channel 1. + NRF_TIMER_TASK_CAPTURE2 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[2]), ///< Task for capturing the timer value on channel 2. + NRF_TIMER_TASK_CAPTURE3 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[3]), ///< Task for capturing the timer value on channel 3. +#ifdef NRF52 + NRF_TIMER_TASK_CAPTURE4 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[4]), ///< Task for capturing the timer value on channel 4. + NRF_TIMER_TASK_CAPTURE5 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[5]), ///< Task for capturing the timer value on channel 5. +#endif + /*lint -restore*/ +} nrf_timer_task_t; + +/** + * @brief Timer events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_TIMER_EVENT_COMPARE0 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[0]), ///< Event from compare channel 0. + NRF_TIMER_EVENT_COMPARE1 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[1]), ///< Event from compare channel 1. + NRF_TIMER_EVENT_COMPARE2 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[2]), ///< Event from compare channel 2. + NRF_TIMER_EVENT_COMPARE3 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[3]), ///< Event from compare channel 3. +#ifdef NRF52 + NRF_TIMER_EVENT_COMPARE4 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[4]), ///< Event from compare channel 4. + NRF_TIMER_EVENT_COMPARE5 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[5]), ///< Event from compare channel 5. +#endif + /*lint -restore*/ +} nrf_timer_event_t; + +/** + * @brief Types of timer shortcuts. + */ +typedef enum +{ + NRF_TIMER_SHORT_COMPARE0_STOP_MASK = TIMER_SHORTS_COMPARE0_STOP_Msk, ///< Shortcut for stopping the timer based on compare 0. + NRF_TIMER_SHORT_COMPARE1_STOP_MASK = TIMER_SHORTS_COMPARE1_STOP_Msk, ///< Shortcut for stopping the timer based on compare 1. + NRF_TIMER_SHORT_COMPARE2_STOP_MASK = TIMER_SHORTS_COMPARE2_STOP_Msk, ///< Shortcut for stopping the timer based on compare 2. + NRF_TIMER_SHORT_COMPARE3_STOP_MASK = TIMER_SHORTS_COMPARE3_STOP_Msk, ///< Shortcut for stopping the timer based on compare 3. +#ifdef NRF52 + NRF_TIMER_SHORT_COMPARE4_STOP_MASK = TIMER_SHORTS_COMPARE4_STOP_Msk, ///< Shortcut for stopping the timer based on compare 4. + NRF_TIMER_SHORT_COMPARE5_STOP_MASK = TIMER_SHORTS_COMPARE5_STOP_Msk, ///< Shortcut for stopping the timer based on compare 5. +#endif + NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK = TIMER_SHORTS_COMPARE0_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 0. + NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK = TIMER_SHORTS_COMPARE1_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 1. + NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK = TIMER_SHORTS_COMPARE2_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 2. + NRF_TIMER_SHORT_COMPARE3_CLEAR_MASK = TIMER_SHORTS_COMPARE3_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 3. +#ifdef NRF52 + NRF_TIMER_SHORT_COMPARE4_CLEAR_MASK = TIMER_SHORTS_COMPARE4_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 4. + NRF_TIMER_SHORT_COMPARE5_CLEAR_MASK = TIMER_SHORTS_COMPARE5_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 5. +#endif +} nrf_timer_short_mask_t; + +/** + * @brief Timer modes. + */ +typedef enum +{ + NRF_TIMER_MODE_TIMER = TIMER_MODE_MODE_Timer, ///< Timer mode: timer. + NRF_TIMER_MODE_COUNTER = TIMER_MODE_MODE_Counter, ///< Timer mode: counter. +#ifdef NRF52 + NRF_TIMER_MODE_LOW_POWER_COUNTER = TIMER_MODE_MODE_LowPowerCounter, ///< Timer mode: low-power counter. +#endif +} nrf_timer_mode_t; + +/** + * @brief Timer bit width. + */ +typedef enum +{ + NRF_TIMER_BIT_WIDTH_8 = TIMER_BITMODE_BITMODE_08Bit, ///< Timer bit width 8 bit. + NRF_TIMER_BIT_WIDTH_16 = TIMER_BITMODE_BITMODE_16Bit, ///< Timer bit width 16 bit. + NRF_TIMER_BIT_WIDTH_24 = TIMER_BITMODE_BITMODE_24Bit, ///< Timer bit width 24 bit. + NRF_TIMER_BIT_WIDTH_32 = TIMER_BITMODE_BITMODE_32Bit ///< Timer bit width 32 bit. +} nrf_timer_bit_width_t; + +/** + * @brief Timer prescalers. + */ +typedef enum +{ + NRF_TIMER_FREQ_16MHz = 0, ///< Timer frequency 16 MHz. + NRF_TIMER_FREQ_8MHz, ///< Timer frequency 8 MHz. + NRF_TIMER_FREQ_4MHz, ///< Timer frequency 4 MHz. + NRF_TIMER_FREQ_2MHz, ///< Timer frequency 2 MHz. + NRF_TIMER_FREQ_1MHz, ///< Timer frequency 1 MHz. + NRF_TIMER_FREQ_500kHz, ///< Timer frequency 500 kHz. + NRF_TIMER_FREQ_250kHz, ///< Timer frequency 250 kHz. + NRF_TIMER_FREQ_125kHz, ///< Timer frequency 125 kHz. + NRF_TIMER_FREQ_62500Hz, ///< Timer frequency 62500 Hz. + NRF_TIMER_FREQ_31250Hz ///< Timer frequency 31250 Hz. +} nrf_timer_frequency_t; + +/** + * @brief Timer capture/compare channels. + */ +typedef enum +{ + NRF_TIMER_CC_CHANNEL0 = 0, ///< Timer capture/compare channel 0. + NRF_TIMER_CC_CHANNEL1, ///< Timer capture/compare channel 1. + NRF_TIMER_CC_CHANNEL2, ///< Timer capture/compare channel 2. + NRF_TIMER_CC_CHANNEL3, ///< Timer capture/compare channel 3. +#ifdef NRF52 + NRF_TIMER_CC_CHANNEL4, ///< Timer capture/compare channel 4. + NRF_TIMER_CC_CHANNEL5, ///< Timer capture/compare channel 5. +#endif +} nrf_timer_cc_channel_t; + +/** + * @brief Timer interrupts. + */ +typedef enum +{ + NRF_TIMER_INT_COMPARE0_MASK = TIMER_INTENSET_COMPARE0_Msk, ///< Timer interrupt from compare event on channel 0. + NRF_TIMER_INT_COMPARE1_MASK = TIMER_INTENSET_COMPARE1_Msk, ///< Timer interrupt from compare event on channel 1. + NRF_TIMER_INT_COMPARE2_MASK = TIMER_INTENSET_COMPARE2_Msk, ///< Timer interrupt from compare event on channel 2. + NRF_TIMER_INT_COMPARE3_MASK = TIMER_INTENSET_COMPARE3_Msk, ///< Timer interrupt from compare event on channel 3. +#ifdef NRF52 + NRF_TIMER_INT_COMPARE4_MASK = TIMER_INTENSET_COMPARE4_Msk, ///< Timer interrupt from compare event on channel 4. + NRF_TIMER_INT_COMPARE5_MASK = TIMER_INTENSET_COMPARE5_Msk, ///< Timer interrupt from compare event on channel 5. +#endif +} nrf_timer_int_mask_t; + + +/** + * @brief Function for activating a specific timer task. + * + * @param[in] p_timer Timer instance. + * @param[in] task Task to activate. + */ +__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_timer, + nrf_timer_task_t task); + +/** + * @brief Function for getting the address of a specific timer task register. + * + * @param[in] p_timer Timer instance. + * @param[in] task Requested task. + * + * @return Address of the specified task register. + */ +__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_timer, + nrf_timer_task_t task); + +/** + * @brief Function for clearing a specific timer event. + * + * @param[in] p_timer Timer instance. + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_timer, + nrf_timer_event_t event); + +/** + * @brief Function for checking the state of a specific timer event. + * + * @param[in] p_timer Timer instance. + * @param[in] event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_timer, + nrf_timer_event_t event); + +/** + * @brief Function for getting the address of a specific timer event register. + * + * @param[in] p_timer Timer instance. + * @param[in] event Requested event. + * + * @return Address of the specified event register. + */ +__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_timer, + nrf_timer_event_t event); + +/** + * @brief Function for enabling specified shortcuts. + * + * @param[in] p_timer Timer instance. + * @param[in] timer_shorts_mask Shortcuts to enable. + */ +__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_timer, + uint32_t timer_shorts_mask); + +/** + * @brief Function for disabling specified shortcuts. + * + * @param[in] p_timer Timer instance. + * @param[in] timer_shorts_mask Shortcuts to disable. + */ +__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_timer, + uint32_t timer_shorts_mask); + +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] p_timer Timer instance. + * @param[in] timer_int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_timer, + uint32_t timer_int_mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] p_timer Timer instance. + * @param[in] timer_int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_timer, + uint32_t timer_int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param[in] p_timer Timer instance. + * @param[in] timer_int Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_timer, + uint32_t timer_int); + +/** + * @brief Function for setting the timer mode. + * + * @param[in] p_timer Timer instance. + * @param[in] mode Timer mode. + */ +__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_timer, + nrf_timer_mode_t mode); + +/** + * @brief Function for retrieving the timer mode. + * + * @param[in] p_timer Timer instance. + * + * @return Timer mode. + */ +__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_timer); + +/** + * @brief Function for setting the timer bit width. + * + * @param[in] p_timer Timer instance. + * @param[in] bit_width Timer bit width. + */ +__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_timer, + nrf_timer_bit_width_t bit_width); + +/** + * @brief Function for retrieving the timer bit width. + * + * @param[in] p_timer Timer instance. + * + * @return Timer bit width. + */ +__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_timer); + +/** + * @brief Function for setting the timer frequency. + * + * @param[in] p_timer Timer instance. + * @param[in] frequency Timer frequency. + */ +__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_timer, + nrf_timer_frequency_t frequency); + +/** + * @brief Function for retrieving the timer frequency. + * + * @param[in] p_timer Timer instance. + * + * @return Timer frequency. + */ +__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_timer); + +/** + * @brief Function for writing the capture/compare register for a specified channel. + * + * @param[in] p_timer Timer instance. + * @param[in] cc_channel Requested capture/compare channel. + * @param[in] cc_value Value to write to the capture/compare register. + */ +__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_timer, + nrf_timer_cc_channel_t cc_channel, + uint32_t cc_value); + +/** + * @brief Function for retrieving the capture/compare value for a specified channel. + * + * @param[in] p_timer Timer instance. + * @param[in] cc_channel Requested capture/compare channel. + * + * @return Value from the requested capture/compare register. + */ +__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_timer, + nrf_timer_cc_channel_t cc_channel); + +/** + * @brief Function for getting a specific timer capture task. + * + * @param[in] channel Capture channel. + * + * @return Capture task. + */ +__STATIC_INLINE nrf_timer_task_t nrf_timer_capture_task_get(uint32_t channel); + +/** + * @brief Function for getting a specific timer compare event. + * + * @param[in] channel Compare channel. + * + * @return Compare event. + */ +__STATIC_INLINE nrf_timer_event_t nrf_timer_compare_event_get(uint32_t channel); + +/** + * @brief Function for getting a specific timer compare interrupt. + * + * @param[in] channel Compare channel. + * + * @return Compare interrupt. + */ +__STATIC_INLINE nrf_timer_int_mask_t nrf_timer_compare_int_get(uint32_t channel); + +/** + * @brief Function for calculating the number of timer ticks for a given time + * (in microseconds) and timer frequency. + * + * @param[in] time_us Time in microseconds. + * @param[in] frequency Timer frequency. + * + * @return Number of timer ticks. + */ +__STATIC_INLINE uint32_t nrf_timer_us_to_ticks(uint32_t time_us, + nrf_timer_frequency_t frequency); + +/** + * @brief Function for calculating the number of timer ticks for a given time + * (in milliseconds) and timer frequency. + * + * @param[in] time_ms Time in milliseconds. + * @param[in] frequency Timer frequency. + * + * @return Number of timer ticks. + */ +__STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms, + nrf_timer_frequency_t frequency); + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_timer, + nrf_timer_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_timer, + nrf_timer_task_t task) +{ + return (uint32_t *)((uint8_t *)p_timer + (uint32_t)task); +} + +__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_timer, + nrf_timer_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)event)) = 0x0UL; +} + +__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_timer, + nrf_timer_event_t event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)event); +} + +__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_timer, + nrf_timer_event_t event) +{ + return (uint32_t *)((uint8_t *)p_timer + (uint32_t)event); +} + +__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_timer, + uint32_t timer_shorts_mask) +{ + p_timer->SHORTS |= timer_shorts_mask; +} + +__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_timer, + uint32_t timer_shorts_mask) +{ + p_timer->SHORTS &= ~(timer_shorts_mask); +} + +__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_timer, + uint32_t timer_int_mask) +{ + p_timer->INTENSET = timer_int_mask; +} + +__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_timer, + uint32_t timer_int_mask) +{ + p_timer->INTENCLR = timer_int_mask; +} + +__STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_timer, + uint32_t timer_int) +{ + return (bool)(p_timer->INTENSET & timer_int); +} + +__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_timer, + nrf_timer_mode_t mode) +{ + p_timer->MODE = (p_timer->MODE & ~TIMER_MODE_MODE_Msk) | + ((mode << TIMER_MODE_MODE_Pos) & TIMER_MODE_MODE_Msk); +} + +__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_timer) +{ + return (nrf_timer_mode_t)(p_timer->MODE); +} + +__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_timer, + nrf_timer_bit_width_t bit_width) +{ + p_timer->BITMODE = (p_timer->BITMODE & ~TIMER_BITMODE_BITMODE_Msk) | + ((bit_width << TIMER_BITMODE_BITMODE_Pos) & + TIMER_BITMODE_BITMODE_Msk); +} + +__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_timer) +{ + return (nrf_timer_bit_width_t)(p_timer->BITMODE); +} + +__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_timer, + nrf_timer_frequency_t frequency) +{ + p_timer->PRESCALER = (p_timer->PRESCALER & ~TIMER_PRESCALER_PRESCALER_Msk) | + ((frequency << TIMER_PRESCALER_PRESCALER_Pos) & + TIMER_PRESCALER_PRESCALER_Msk); +} + +__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_timer) +{ + return (nrf_timer_frequency_t)(p_timer->PRESCALER); +} + +__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_timer, + nrf_timer_cc_channel_t cc_channel, + uint32_t cc_value) +{ + p_timer->CC[cc_channel] = cc_value; +} + +__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_timer, + nrf_timer_cc_channel_t cc_channel) +{ + return (uint32_t)p_timer->CC[cc_channel]; +} + +__STATIC_INLINE nrf_timer_task_t nrf_timer_capture_task_get(uint32_t channel) +{ + return (nrf_timer_task_t) + ((uint32_t)NRF_TIMER_TASK_CAPTURE0 + (channel * sizeof(uint32_t))); +} + +__STATIC_INLINE nrf_timer_event_t nrf_timer_compare_event_get(uint32_t channel) +{ + return (nrf_timer_event_t) + ((uint32_t)NRF_TIMER_EVENT_COMPARE0 + (channel * sizeof(uint32_t))); +} + +__STATIC_INLINE nrf_timer_int_mask_t nrf_timer_compare_int_get(uint32_t channel) +{ + return (nrf_timer_int_mask_t) + ((uint32_t)NRF_TIMER_INT_COMPARE0_MASK << channel); +} + +__STATIC_INLINE uint32_t nrf_timer_us_to_ticks(uint32_t time_us, + nrf_timer_frequency_t frequency) +{ + // The "frequency" parameter here is actually the prescaler value, and the + // timer runs at the following frequency: f = 16 MHz / 2^prescaler. + uint32_t prescaler = (uint32_t)frequency; + ASSERT(time_us <= (UINT32_MAX / 16UL)); + return ((time_us * 16UL) >> prescaler); +} + +__STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms, + nrf_timer_frequency_t frequency) +{ + // The "frequency" parameter here is actually the prescaler value, and the + // timer runs at the following frequency: f = 16000 kHz / 2^prescaler. + uint32_t prescaler = (uint32_t)frequency; + ASSERT(time_ms <= (UINT32_MAX / 16000UL)); + return ((time_ms * 16000UL) >> prescaler); +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_TIMER_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twi.h new file mode 100644 index 0000000000..bd2198082a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twi.h @@ -0,0 +1,429 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_TWI_H__ +#define NRF_TWI_H__ + +/** + * @defgroup nrf_twi_hal TWI HAL + * @{ + * @ingroup nrf_twi_master + * + * @brief Hardware access layer for managing the TWI peripheral. + */ + +#include +#include +#include + +#include "nrf.h" + +/** + * @brief TWI tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_TWI_TASK_STARTRX = offsetof(NRF_TWI_Type, TASKS_STARTRX), ///< Start TWI receive sequence. + NRF_TWI_TASK_STARTTX = offsetof(NRF_TWI_Type, TASKS_STARTTX), ///< Start TWI transmit sequence. + NRF_TWI_TASK_STOP = offsetof(NRF_TWI_Type, TASKS_STOP), ///< Stop TWI transaction. + NRF_TWI_TASK_SUSPEND = offsetof(NRF_TWI_Type, TASKS_SUSPEND), ///< Suspend TWI transaction. + NRF_TWI_TASK_RESUME = offsetof(NRF_TWI_Type, TASKS_RESUME) ///< Resume TWI transaction. + /*lint -restore*/ +} nrf_twi_task_t; + +/** + * @brief TWI events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_TWI_EVENT_STOPPED = offsetof(NRF_TWI_Type, EVENTS_STOPPED), ///< TWI stopped. + NRF_TWI_EVENT_RXDREADY = offsetof(NRF_TWI_Type, EVENTS_RXDREADY), ///< TWI RXD byte received. + NRF_TWI_EVENT_TXDSENT = offsetof(NRF_TWI_Type, EVENTS_TXDSENT), ///< TWI TXD byte sent. + NRF_TWI_EVENT_ERROR = offsetof(NRF_TWI_Type, EVENTS_ERROR), ///< TWI error. + NRF_TWI_EVENT_BB = offsetof(NRF_TWI_Type, EVENTS_BB), ///< TWI byte boundary, generated before each byte that is sent or received. + NRF_TWI_EVENT_SUSPENDED = offsetof(NRF_TWI_Type, EVENTS_SUSPENDED) ///< TWI entered the suspended state. + /*lint -restore*/ +} nrf_twi_event_t; + +/** + * @brief TWI shortcuts. + */ +typedef enum +{ + NRF_TWI_SHORT_BB_SUSPEND_MASK = TWI_SHORTS_BB_SUSPEND_Msk, ///< Shortcut between BB event and SUSPEND task. + NRF_TWI_SHORT_BB_STOP_MASK = TWI_SHORTS_BB_STOP_Msk, ///< Shortcut between BB event and STOP task. +} nrf_twi_short_mask_t; + +/** + * @brief TWI interrupts. + */ +typedef enum +{ + NRF_TWI_INT_STOPPED_MASK = TWI_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event. + NRF_TWI_INT_RXDREADY_MASK = TWI_INTENSET_RXDREADY_Msk, ///< Interrupt on RXDREADY event. + NRF_TWI_INT_TXDSENT_MASK = TWI_INTENSET_TXDSENT_Msk, ///< Interrupt on TXDSENT event. + NRF_TWI_INT_ERROR_MASK = TWI_INTENSET_ERROR_Msk, ///< Interrupt on ERROR event. + NRF_TWI_INT_BB_MASK = TWI_INTENSET_BB_Msk, ///< Interrupt on BB event. + NRF_TWI_INT_SUSPENDED_MASK = TWI_INTENSET_SUSPENDED_Msk ///< Interrupt on SUSPENDED event. +} nrf_twi_int_mask_t; + +/** + * @brief TWI error source. + */ +typedef enum +{ + NRF_TWI_ERROR_ADDRESS_NACK = TWI_ERRORSRC_ANACK_Msk, ///< NACK received after sending the address. + NRF_TWI_ERROR_DATA_NACK = TWI_ERRORSRC_DNACK_Msk, ///< NACK received after sending a data byte. + NRF_TWI_ERROR_OVERRUN = TWI_ERRORSRC_OVERRUN_Msk ///< Overrun error. + /**< A new byte was received before the previous byte was read + * from the RXD register (previous data is lost). */ +} nrf_twi_error_t; + +/** + * @brief TWI master clock frequency. + */ +typedef enum +{ + NRF_TWI_FREQ_100K = TWI_FREQUENCY_FREQUENCY_K100, ///< 100 kbps. + NRF_TWI_FREQ_250K = TWI_FREQUENCY_FREQUENCY_K250, ///< 250 kbps. + NRF_TWI_FREQ_400K = TWI_FREQUENCY_FREQUENCY_K400 ///< 400 kbps. +} nrf_twi_frequency_t; + + +/** + * @brief Function for activating a specific TWI task. + * + * @param[in] p_twi TWI instance. + * @param[in] task Task to activate. + */ +__STATIC_INLINE void nrf_twi_task_trigger(NRF_TWI_Type * p_twi, + nrf_twi_task_t task); + +/** + * @brief Function for getting the address of a specific TWI task register. + * + * @param[in] p_twi TWI instance. + * @param[in] task Requested task. + * + * @return Address of the specified task register. + */ +__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_twi, + nrf_twi_task_t task); + +/** + * @brief Function for clearing a specific TWI event. + * + * @param[in] p_twi TWI instance. + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type * p_twi, + nrf_twi_event_t event); + +/** + * @brief Function for checking the state of a specific event. + * + * @param[in] p_twi TWI instance. + * @param[in] event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_twi_event_check(NRF_TWI_Type * p_twi, + nrf_twi_event_t event); + +/** + * @brief Function for getting the address of a specific TWI event register. + * + * @param[in] p_twi TWI instance. + * @param[in] event Requested event. + * + * @return Address of the specified event register. + */ +__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type * p_twi, + nrf_twi_event_t event); + +/** + * @brief Function for enabling specified shortcuts. + * + * @param[in] p_twi TWI instance. + * @param[in] shorts_mask Shortcuts to enable. + */ +__STATIC_INLINE void nrf_twi_shorts_enable(NRF_TWI_Type * p_twi, + uint32_t shorts_mask); + +/** + * @brief Function for disabling specified shortcuts. + * + * @param[in] p_twi TWI instance. + * @param[in] shorts_mask Shortcuts to disable. + */ +__STATIC_INLINE void nrf_twi_shorts_disable(NRF_TWI_Type * p_twi, + uint32_t shorts_mask); + +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] p_twi TWI instance. + * @param[in] int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_twi, + uint32_t int_mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] p_twi TWI instance. + * @param[in] int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_twi, + uint32_t int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param[in] p_twi TWI instance. + * @param[in] int_mask Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_twi, + nrf_twi_int_mask_t int_mask); + +/** + * @brief Function for enabling the TWI peripheral. + * + * @param[in] p_twi TWI instance. + */ +__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_twi); + +/** + * @brief Function for disabling the TWI peripheral. + * + * @param[in] p_twi TWI instance. + */ +__STATIC_INLINE void nrf_twi_disable(NRF_TWI_Type * p_twi); + +/** + * @brief Function for configuring TWI pins. + * + * + * @param[in] p_twi TWI instance. + * @param[in] scl_pin SCL pin number. + * @param[in] sda_pin SDA pin number. + */ +__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_twi, + uint32_t scl_pin, + uint32_t sda_pin); + +/** + * @brief Function for setting the TWI master clock frequency. + * + * @param[in] p_twi TWI instance. + * @param[in] frequency TWI frequency. + */ +__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_twi, + nrf_twi_frequency_t frequency); + +/** + * @brief Function for checking the TWI error source. + * + * The error flags are cleared after reading. + * + * @param[in] p_twi TWI instance. + * + * @return Mask with error source flags. + */ +__STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear(NRF_TWI_Type * p_twi); + +/** + * @brief Function for setting the address to be used in TWI transfers. + * + * @param[in] p_twi TWI instance. + * @param[in] address Address to be used in transfers. + */ +__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_twi, uint8_t address); + +/** + * @brief Function for reading data received by TWI. + * + * @param[in] p_twi TWI instance. + * + * @return Received data. + */ +__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_twi); + +/** + * @brief Function for writing data to be transmitted by TWI. + * + * @param[in] p_twi TWI instance. + * @param[in] data Data to be transmitted. + */ +__STATIC_INLINE void nrf_twi_txd_set(NRF_TWI_Type * p_twi, uint8_t data); + +__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi, + uint32_t shorts_mask); + +/** + * @} + */ + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_twi_task_trigger(NRF_TWI_Type * p_twi, + nrf_twi_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_twi, + nrf_twi_task_t task) +{ + return (uint32_t *)((uint8_t *)p_twi + (uint32_t)task); +} + +__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type * p_twi, + nrf_twi_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)event)) = 0x0UL; +} + +__STATIC_INLINE bool nrf_twi_event_check(NRF_TWI_Type * p_twi, + nrf_twi_event_t event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)event); +} + +__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type * p_twi, + nrf_twi_event_t event) +{ + return (uint32_t *)((uint8_t *)p_twi + (uint32_t)event); +} + +__STATIC_INLINE void nrf_twi_shorts_enable(NRF_TWI_Type * p_twi, + uint32_t shorts_mask) +{ + p_twi->SHORTS |= shorts_mask; +} + +__STATIC_INLINE void nrf_twi_shorts_disable(NRF_TWI_Type * p_twi, + uint32_t shorts_mask) +{ + p_twi->SHORTS &= ~(shorts_mask); +} + +__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_twi, + uint32_t int_mask) +{ + p_twi->INTENSET = int_mask; +} + +__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_twi, + uint32_t int_mask) +{ + p_twi->INTENCLR = int_mask; +} + +__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_twi, + nrf_twi_int_mask_t int_mask) +{ + return (bool)(p_twi->INTENSET & int_mask); +} + +__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_twi) +{ + p_twi->ENABLE = (TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_twi_disable(NRF_TWI_Type * p_twi) +{ + p_twi->ENABLE = (TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_twi, + uint32_t scl_pin, + uint32_t sda_pin) +{ + p_twi->PSELSCL = scl_pin; + p_twi->PSELSDA = sda_pin; +} + +__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_twi, + nrf_twi_frequency_t frequency) +{ + p_twi->FREQUENCY = frequency; +} + +__STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear(NRF_TWI_Type * p_twi) +{ + uint32_t error_source = p_twi->ERRORSRC; + + // [error flags are cleared by writing '1' on their position] + p_twi->ERRORSRC = error_source; + + return error_source; +} + +__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_twi, uint8_t address) +{ + p_twi->ADDRESS = address; +} + +__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_twi) +{ + return (uint8_t)p_twi->RXD; +} + +__STATIC_INLINE void nrf_twi_txd_set(NRF_TWI_Type * p_twi, uint8_t data) +{ + p_twi->TXD = data; +} + +__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi, + uint32_t shorts_mask) +{ + p_twi->SHORTS = shorts_mask; +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_TWI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uart.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uart.h new file mode 100644 index 0000000000..1d09fe3846 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uart.h @@ -0,0 +1,498 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_UART_H__ +#define NRF_UART_H__ + +#include "nrf.h" +#include +#include +#include + +/** + * @defgroup nrf_uart_hal UART HAL + * @{ + * @ingroup nrf_uart + * + * @brief Hardware access layer for accessing the UART peripheral. + */ + +#define NRF_UART_PSEL_DISCONNECTED 0xFFFFFFFF + +/** + * @enum nrf_uart_task_t + * @brief UART tasks. + */ +typedef enum +{ + /*lint -save -e30 -esym(628,__INTADDR__)*/ + NRF_UART_TASK_STARTRX = offsetof(NRF_UART_Type, TASKS_STARTRX), /**< Task for starting reception. */ + NRF_UART_TASK_STOPRX = offsetof(NRF_UART_Type, TASKS_STOPRX), /**< Task for stopping reception. */ + NRF_UART_TASK_STARTTX = offsetof(NRF_UART_Type, TASKS_STARTTX), /**< Task for starting transmission. */ + NRF_UART_TASK_STOPTX = offsetof(NRF_UART_Type, TASKS_STOPTX), /**< Task for stopping transmission. */ + NRF_UART_TASK_SUSPEND = offsetof(NRF_UART_Type, TASKS_SUSPEND), /**< Task for suspending UART. */ + /*lint -restore*/ +} nrf_uart_task_t; + +/** + * @enum nrf_uart_event_t + * @brief UART events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_UART_EVENT_CTS = offsetof(NRF_UART_Type, EVENTS_CTS), /**< Event from CTS line activation. */ + NRF_UART_EVENT_NCTS = offsetof(NRF_UART_Type, EVENTS_NCTS), /**< Event from CTS line deactivation. */ + NRF_UART_EVENT_RXDRDY = offsetof(NRF_UART_Type, EVENTS_RXDRDY),/**< Event from data ready in RXD. */ + NRF_UART_EVENT_TXDRDY = offsetof(NRF_UART_Type, EVENTS_TXDRDY),/**< Event from data sent from TXD. */ + NRF_UART_EVENT_ERROR = offsetof(NRF_UART_Type, EVENTS_ERROR), /**< Event from error detection. */ + NRF_UART_EVENT_RXTO = offsetof(NRF_UART_Type, EVENTS_RXTO) /**< Event from receiver timeout. */ + /*lint -restore*/ +} nrf_uart_event_t; + +/** + * @enum nrf_uart_int_mask_t + * @brief UART interrupts. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_UART_INT_MASK_CTS = UART_INTENCLR_CTS_Msk, /**< CTS line activation interrupt. */ + NRF_UART_INT_MASK_NCTS = UART_INTENCLR_NCTS_Msk, /**< CTS line deactivation interrupt. */ + NRF_UART_INT_MASK_RXDRDY = UART_INTENCLR_RXDRDY_Msk, /**< Data ready in RXD interrupt. */ + NRF_UART_INT_MASK_TXDRDY = UART_INTENCLR_TXDRDY_Msk, /**< Data sent from TXD interrupt. */ + NRF_UART_INT_MASK_ERROR = UART_INTENCLR_ERROR_Msk, /**< Error detection interrupt. */ + NRF_UART_INT_MASK_RXTO = UART_INTENCLR_RXTO_Msk /**< Receiver timeout interrupt. */ + /*lint -restore*/ +} nrf_uart_int_mask_t; + +/** + * @enum nrf_uart_baudrate_t + * @brief Baudrates supported by UART. + */ +typedef enum +{ +#ifdef NRF52 + NRF_UART_BAUDRATE_1200 = UARTE_BAUDRATE_BAUDRATE_Baud1200, /**< 1200 baud. */ + NRF_UART_BAUDRATE_2400 = UARTE_BAUDRATE_BAUDRATE_Baud2400, /**< 2400 baud. */ + NRF_UART_BAUDRATE_4800 = UARTE_BAUDRATE_BAUDRATE_Baud4800, /**< 4800 baud. */ + NRF_UART_BAUDRATE_9600 = UARTE_BAUDRATE_BAUDRATE_Baud9600, /**< 9600 baud. */ + NRF_UART_BAUDRATE_14400 = UARTE_BAUDRATE_BAUDRATE_Baud14400, /**< 14400 baud. */ + NRF_UART_BAUDRATE_19200 = UARTE_BAUDRATE_BAUDRATE_Baud19200, /**< 19200 baud. */ + NRF_UART_BAUDRATE_28800 = UARTE_BAUDRATE_BAUDRATE_Baud28800, /**< 28800 baud. */ + NRF_UART_BAUDRATE_38400 = UARTE_BAUDRATE_BAUDRATE_Baud38400, /**< 38400 baud. */ + NRF_UART_BAUDRATE_57600 = UARTE_BAUDRATE_BAUDRATE_Baud57600, /**< 57600 baud. */ + NRF_UART_BAUDRATE_76800 = UARTE_BAUDRATE_BAUDRATE_Baud76800, /**< 76800 baud. */ + NRF_UART_BAUDRATE_115200 = UARTE_BAUDRATE_BAUDRATE_Baud115200, /**< 115200 baud. */ + NRF_UART_BAUDRATE_230400 = UARTE_BAUDRATE_BAUDRATE_Baud230400, /**< 230400 baud. */ + NRF_UART_BAUDRATE_250000 = UARTE_BAUDRATE_BAUDRATE_Baud250000, /**< 250000 baud. */ + NRF_UART_BAUDRATE_460800 = UARTE_BAUDRATE_BAUDRATE_Baud460800, /**< 460800 baud. */ + NRF_UART_BAUDRATE_921600 = UARTE_BAUDRATE_BAUDRATE_Baud921600, /**< 921600 baud. */ + NRF_UART_BAUDRATE_1000000 = UARTE_BAUDRATE_BAUDRATE_Baud1M, /**< 1000000 baud. */ +#else + NRF_UART_BAUDRATE_1200 = UART_BAUDRATE_BAUDRATE_Baud1200, /**< 1200 baud. */ + NRF_UART_BAUDRATE_2400 = UART_BAUDRATE_BAUDRATE_Baud2400, /**< 2400 baud. */ + NRF_UART_BAUDRATE_4800 = UART_BAUDRATE_BAUDRATE_Baud4800, /**< 4800 baud. */ + NRF_UART_BAUDRATE_9600 = UART_BAUDRATE_BAUDRATE_Baud9600, /**< 9600 baud. */ + NRF_UART_BAUDRATE_14400 = UART_BAUDRATE_BAUDRATE_Baud14400, /**< 14400 baud. */ + NRF_UART_BAUDRATE_19200 = UART_BAUDRATE_BAUDRATE_Baud19200, /**< 19200 baud. */ + NRF_UART_BAUDRATE_28800 = UART_BAUDRATE_BAUDRATE_Baud28800, /**< 28800 baud. */ + NRF_UART_BAUDRATE_38400 = UART_BAUDRATE_BAUDRATE_Baud38400, /**< 38400 baud. */ + NRF_UART_BAUDRATE_57600 = UART_BAUDRATE_BAUDRATE_Baud57600, /**< 57600 baud. */ + NRF_UART_BAUDRATE_76800 = UART_BAUDRATE_BAUDRATE_Baud76800, /**< 76800 baud. */ + NRF_UART_BAUDRATE_115200 = UART_BAUDRATE_BAUDRATE_Baud115200, /**< 115200 baud. */ + NRF_UART_BAUDRATE_230400 = UART_BAUDRATE_BAUDRATE_Baud230400, /**< 230400 baud. */ + NRF_UART_BAUDRATE_250000 = UART_BAUDRATE_BAUDRATE_Baud250000, /**< 250000 baud. */ + NRF_UART_BAUDRATE_460800 = UART_BAUDRATE_BAUDRATE_Baud460800, /**< 460800 baud. */ + NRF_UART_BAUDRATE_921600 = UART_BAUDRATE_BAUDRATE_Baud921600, /**< 921600 baud. */ + NRF_UART_BAUDRATE_1000000 = UART_BAUDRATE_BAUDRATE_Baud1M, /**< 1000000 baud. */ +#endif +} nrf_uart_baudrate_t; + +/** + * @enum nrf_uart_error_mask_t + * @brief Types of UART error masks. + */ +typedef enum +{ + NRF_UART_ERROR_OVERRUN_MASK = UART_ERRORSRC_OVERRUN_Msk, /**< Overrun error. */ + NRF_UART_ERROR_PARITY_MASK = UART_ERRORSRC_PARITY_Msk, /**< Parity error. */ + NRF_UART_ERROR_FRAMING_MASK = UART_ERRORSRC_FRAMING_Msk, /**< Framing error. */ + NRF_UART_ERROR_BREAK_MASK = UART_ERRORSRC_BREAK_Msk, /**< Break error. */ +} nrf_uart_error_mask_t; + +/** + * @enum nrf_uart_parity_t + * @brief Types of UART parity modes. + */ +typedef enum +{ + NRF_UART_PARITY_EXCLUDED = UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos, /**< Parity excluded. */ + NRF_UART_PARITY_INCLUDED = UART_CONFIG_PARITY_Included << UART_CONFIG_PARITY_Pos, /**< Parity included. */ +} nrf_uart_parity_t; + +/** + * @enum nrf_uart_hwfc_t + * @brief Types of UART flow control modes. + */ +typedef enum +{ + NRF_UART_HWFC_DISABLED = UART_CONFIG_HWFC_Disabled, /**< HW flow control disabled. */ + NRF_UART_HWFC_ENABLED = UART_CONFIG_HWFC_Enabled, /**< HW flow control enabled. */ +} nrf_uart_hwfc_t; + +/** + * @brief Function for clearing a specific UART event. + * + * @param[in] p_reg UART instance. + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_t event); + +/** + * @brief Function for checking the state of a specific UART event. + * + * @param[in] p_reg UART instance. + * @param[in] event Event to check. + * + * @retval True if event is set, False otherwise. + */ +__STATIC_INLINE bool nrf_uart_event_check(NRF_UART_Type * p_reg, nrf_uart_event_t event); + +/** + * @brief Function for returning the address of a specific UART event register. + * + * @param[in] p_reg UART instance. + * @param[in] event Desired event. + * + * @retval Address of specified event register. + */ +__STATIC_INLINE uint32_t nrf_uart_event_address_get(NRF_UART_Type * p_reg, + nrf_uart_event_t event); + +/** + * @brief Function for enabling a specific interrupt. + * + * @param p_reg Instance. + * @param int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_uart_int_enable(NRF_UART_Type * p_reg, uint32_t int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param p_reg Instance. + * @param int_mask Mask of interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_uart_int_enable_check(NRF_UART_Type * p_reg, uint32_t int_mask); + +/** + * @brief Function for disabling specific interrupts. + * + * @param p_reg Instance. + * @param int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_uart_int_disable(NRF_UART_Type * p_reg, uint32_t int_mask); + +/** + * @brief Function for getting error source mask. Function is clearing error source flags after reading. + * + * @param p_reg Instance. + * @return Mask with error source flags. + */ +__STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear(NRF_UART_Type * p_reg); + +/** + * @brief Function for enabling UART. + * + * @param p_reg Instance. + */ +__STATIC_INLINE void nrf_uart_enable(NRF_UART_Type * p_reg); + +/** + * @brief Function for disabling UART. + * + * @param p_reg Instance. + */ +__STATIC_INLINE void nrf_uart_disable(NRF_UART_Type * p_reg); + +/** + * @brief Function for configuring TX/RX pins. + * + * @param p_reg Instance. + * @param pseltxd TXD pin number. + * @param pselrxd RXD pin number. + */ +__STATIC_INLINE void nrf_uart_txrx_pins_set(NRF_UART_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd); + +/** + * @brief Function for disconnecting TX/RX pins. + * + * @param p_reg Instance. + */ +__STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg); + +/** + * @brief Function for getting TX pin. + * + * @param p_reg Instance. + */ +__STATIC_INLINE uint32_t nrf_uart_tx_pin_get(NRF_UART_Type * p_reg); + +/** + * @brief Function for getting RX pin. + * + * @param p_reg Instance. + */ +__STATIC_INLINE uint32_t nrf_uart_rx_pin_get(NRF_UART_Type * p_reg); + +/** + * @brief Function for getting RTS pin. + * + * @param p_reg Instance. + */ +__STATIC_INLINE uint32_t nrf_uart_rts_pin_get(NRF_UART_Type * p_reg); + +/** + * @brief Function for getting CTS pin. + * + * @param p_reg Instance. + */ +__STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg); + + +/** + * @brief Function for configuring flow control pins. + * + * @param p_reg Instance. + * @param pselrts RTS pin number. + * @param pselcts CTS pin number. + */ +__STATIC_INLINE void nrf_uart_hwfc_pins_set(NRF_UART_Type * p_reg, + uint32_t pselrts, + uint32_t pselcts); + +/** + * @brief Function for disconnecting flow control pins. + * + * @param p_reg Instance. + */ +__STATIC_INLINE void nrf_uart_hwfc_pins_disconnect(NRF_UART_Type * p_reg); + +/** + * @brief Function for reading RX data. + * + * @param p_reg Instance. + * @return Received byte. + */ +__STATIC_INLINE uint8_t nrf_uart_rxd_get(NRF_UART_Type * p_reg); + +/** + * @brief Function for setting Tx data. + * + * @param p_reg Instance. + * @param txd Byte. + */ +__STATIC_INLINE void nrf_uart_txd_set(NRF_UART_Type * p_reg, uint8_t txd); + +/** + * @brief Function for starting an UART task. + * + * @param p_reg Instance. + * @param task Task. + */ +__STATIC_INLINE void nrf_uart_task_trigger(NRF_UART_Type * p_reg, nrf_uart_task_t task); + +/** + * @brief Function for returning the address of a specific task register. + * + * @param p_reg Instance. + * @param task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_uart_task_address_get(NRF_UART_Type * p_reg, nrf_uart_task_t task); + +/** + * @brief Function for configuring UART. + * + * @param p_reg Instance. + * @param hwfc Hardware flow control. Enabled if true. + * @param parity Parity. Included if true. + */ +__STATIC_INLINE void nrf_uart_configure(NRF_UART_Type * p_reg, + nrf_uart_parity_t parity, + nrf_uart_hwfc_t hwfc); + +/** + * @brief Function for setting UART baudrate. + * + * @param p_reg Instance. + * @param baudrate Baudrate. + */ +__STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type * p_reg, nrf_uart_baudrate_t baudrate); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL; + +} + +__STATIC_INLINE bool nrf_uart_event_check(NRF_UART_Type * p_reg, nrf_uart_event_t event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event); +} + +__STATIC_INLINE uint32_t nrf_uart_event_address_get(NRF_UART_Type * p_reg, + nrf_uart_event_t event) +{ + return (uint32_t)((uint8_t *)p_reg + (uint32_t)event); +} + +__STATIC_INLINE void nrf_uart_int_enable(NRF_UART_Type * p_reg, uint32_t int_mask) +{ + p_reg->INTENSET = int_mask; +} + +__STATIC_INLINE bool nrf_uart_int_enable_check(NRF_UART_Type * p_reg, uint32_t int_mask) +{ + return (bool)(p_reg->INTENSET & int_mask); +} + +__STATIC_INLINE void nrf_uart_int_disable(NRF_UART_Type * p_reg, uint32_t int_mask) +{ + p_reg->INTENCLR = int_mask; +} + +__STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear(NRF_UART_Type * p_reg) +{ + uint32_t errsrc_mask = p_reg->ERRORSRC; + p_reg->ERRORSRC = errsrc_mask; + return errsrc_mask; +} + +__STATIC_INLINE void nrf_uart_enable(NRF_UART_Type * p_reg) +{ + p_reg->ENABLE = UART_ENABLE_ENABLE_Enabled; +} + +__STATIC_INLINE void nrf_uart_disable(NRF_UART_Type * p_reg) +{ + p_reg->ENABLE = UART_ENABLE_ENABLE_Disabled; +} + +__STATIC_INLINE void nrf_uart_txrx_pins_set(NRF_UART_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd) +{ + p_reg->PSELTXD = pseltxd; + p_reg->PSELRXD = pselrxd; +} + +__STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg) +{ + nrf_uart_txrx_pins_set(p_reg, NRF_UART_PSEL_DISCONNECTED, NRF_UART_PSEL_DISCONNECTED); +} + +__STATIC_INLINE uint32_t nrf_uart_tx_pin_get(NRF_UART_Type * p_reg) +{ + return p_reg->PSELTXD; +} + +__STATIC_INLINE uint32_t nrf_uart_rx_pin_get(NRF_UART_Type * p_reg) +{ + return p_reg->PSELRXD; +} + +__STATIC_INLINE uint32_t nrf_uart_rts_pin_get(NRF_UART_Type * p_reg) +{ + return p_reg->PSELRTS; +} + +__STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg) +{ + return p_reg->PSELCTS; +} + +__STATIC_INLINE void nrf_uart_hwfc_pins_set(NRF_UART_Type * p_reg, uint32_t pselrts, uint32_t pselcts) +{ + p_reg->PSELRTS = pselrts; + p_reg->PSELCTS = pselcts; +} + +__STATIC_INLINE void nrf_uart_hwfc_pins_disconnect(NRF_UART_Type * p_reg) +{ + nrf_uart_hwfc_pins_set(p_reg, NRF_UART_PSEL_DISCONNECTED, NRF_UART_PSEL_DISCONNECTED); +} + +__STATIC_INLINE uint8_t nrf_uart_rxd_get(NRF_UART_Type * p_reg) +{ + return p_reg->RXD; +} + +__STATIC_INLINE void nrf_uart_txd_set(NRF_UART_Type * p_reg, uint8_t txd) +{ + p_reg->TXD = txd; +} + +__STATIC_INLINE void nrf_uart_task_trigger(NRF_UART_Type * p_reg, nrf_uart_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t nrf_uart_task_address_get(NRF_UART_Type * p_reg, nrf_uart_task_t task) +{ + return (uint32_t)p_reg + (uint32_t)task; +} + +__STATIC_INLINE void nrf_uart_configure(NRF_UART_Type * p_reg, + nrf_uart_parity_t parity, + nrf_uart_hwfc_t hwfc) +{ + p_reg->CONFIG = (uint32_t)parity | (uint32_t)hwfc; +} + +__STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type * p_reg, nrf_uart_baudrate_t baudrate) +{ + p_reg->BAUDRATE = baudrate; +} +#endif //SUPPRESS_INLINE_IMPLEMENTATION +/** @} */ +#endif //NRF_UART_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_wdt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_wdt.h new file mode 100644 index 0000000000..4b6f9a5609 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_wdt.h @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @defgroup nrf_wdt_hal WDT HAL + * @{ + * @ingroup nrf_wdt + * + * @brief Hardware access layer for accessing the watchdog timer (WDT) peripheral. + */ + +#ifndef NRF_WDT_H__ +#define NRF_WDT_H__ + +#include +#include +#include + +#include "nrf.h" + +#define NRF_WDT_CHANNEL_NUMBER 0x8UL +#define NRF_WDT_RR_VALUE 0x6E524635UL /* Fixed value, shouldn't be modified.*/ + +#define NRF_WDT_TASK_SET 1UL +#define NRF_WDT_EVENT_CLEAR 0UL + +/** + * @enum nrf_wdt_task_t + * @brief WDT tasks. + */ +typedef enum +{ + /*lint -save -e30 -esym(628,__INTADDR__)*/ + NRF_WDT_TASK_START = offsetof(NRF_WDT_Type, TASKS_START), /**< Task for starting WDT. */ + /*lint -restore*/ +} nrf_wdt_task_t; + +/** + * @enum nrf_wdt_event_t + * @brief WDT events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_WDT_EVENT_TIMEOUT = offsetof(NRF_WDT_Type, EVENTS_TIMEOUT), /**< Event from WDT time-out. */ + /*lint -restore*/ +} nrf_wdt_event_t; + +/** + * @enum nrf_wdt_behaviour_t + * @brief WDT behavior in CPU SLEEP or HALT mode. + */ +typedef enum +{ + NRF_WDT_BEHAVIOUR_RUN_SLEEP = WDT_CONFIG_SLEEP_Msk, /**< WDT will run when CPU is in SLEEP mode. */ + NRF_WDT_BEHAVIOUR_RUN_HALT = WDT_CONFIG_HALT_Msk, /**< WDT will run when CPU is in HALT mode. */ + NRF_WDT_BEHAVIOUR_RUN_SLEEP_HALT = WDT_CONFIG_SLEEP_Msk | WDT_CONFIG_HALT_Msk, /**< WDT will run when CPU is in SLEEP or HALT mode. */ + NRF_WDT_BEHAVIOUR_PAUSE_SLEEP_HALT = 0, /**< WDT will be paused when CPU is in SLEEP or HALT mode. */ +} nrf_wdt_behaviour_t; + +/** + * @enum nrf_wdt_rr_register_t + * @brief WDT reload request registers. + */ +typedef enum +{ + NRF_WDT_RR0 = 0, /**< Reload request register 0. */ + NRF_WDT_RR1, /**< Reload request register 1. */ + NRF_WDT_RR2, /**< Reload request register 2. */ + NRF_WDT_RR3, /**< Reload request register 3. */ + NRF_WDT_RR4, /**< Reload request register 4. */ + NRF_WDT_RR5, /**< Reload request register 5. */ + NRF_WDT_RR6, /**< Reload request register 6. */ + NRF_WDT_RR7 /**< Reload request register 7. */ +} nrf_wdt_rr_register_t; + +/** + * @enum nrf_wdt_int_mask_t + * @brief WDT interrupts. + */ +typedef enum +{ + NRF_WDT_INT_TIMEOUT_MASK = WDT_INTENSET_TIMEOUT_Msk, /**< WDT interrupt from time-out event. */ +} nrf_wdt_int_mask_t; + +/** + * @brief Function for configuring the watchdog behavior when the CPU is sleeping or halted. + * + * @param behaviour Watchdog behavior when CPU is in SLEEP or HALT mode. + */ +__STATIC_INLINE void nrf_wdt_behaviour_set(nrf_wdt_behaviour_t behaviour) +{ + NRF_WDT->CONFIG = behaviour; +} + + +/** + * @brief Function for starting the watchdog. + * + * @param[in] task Task. + */ +__STATIC_INLINE void nrf_wdt_task_trigger(nrf_wdt_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)NRF_WDT + task)) = NRF_WDT_TASK_SET; +} + + +/** + * @brief Function for clearing the WDT event. + * + * @param[in] event Event. + */ +__STATIC_INLINE void nrf_wdt_event_clear(nrf_wdt_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)NRF_WDT + (uint32_t)event)) = NRF_WDT_EVENT_CLEAR; +} + + +/** + * @brief Function for retrieving the state of the WDT event. + * + * @param[in] event Event. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_wdt_event_check(nrf_wdt_event_t event) +{ + return (bool)*((volatile uint32_t *)((uint8_t *)NRF_WDT + event)); +} + + +/** + * @brief Function for enabling a specific interrupt. + * + * @param[in] int_mask Interrupt. + */ +__STATIC_INLINE void nrf_wdt_int_enable(uint32_t int_mask) +{ + NRF_WDT->INTENSET = int_mask; +} + + +/** + * @brief Function for retrieving the state of given interrupt. + * + * @param[in] int_mask Interrupt. + * + * @retval true Interrupt is enabled. + * @retval false Interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_wdt_int_enable_check(uint32_t int_mask) +{ + return (bool)(NRF_WDT->INTENSET & int_mask); +} + + +/** + * @brief Function for disabling a specific interrupt. + * + * @param[in] int_mask Interrupt. + */ +__STATIC_INLINE void nrf_wdt_int_disable(uint32_t int_mask) +{ + NRF_WDT->INTENCLR = int_mask; +} + + +/** + * @brief Function for returning the address of a specific WDT task register. + * + * @param[in] task Task. + */ +__STATIC_INLINE uint32_t nrf_wdt_task_address_get(nrf_wdt_task_t task) +{ + return ((uint32_t)NRF_WDT + task); +} + + +/** + * @brief Function for returning the address of a specific WDT event register. + * + * @param[in] event Event. + * + * @retval address of requested event register + */ +__STATIC_INLINE uint32_t nrf_wdt_event_address_get(nrf_wdt_event_t event) +{ + return ((uint32_t)NRF_WDT + event); +} + + +/** + * @brief Function for retrieving the watchdog status. + * + * @retval true If the watchdog is started. + * @retval false If the watchdog is not started. + */ +__STATIC_INLINE bool nrf_wdt_started(void) +{ + return (bool)(NRF_WDT->RUNSTATUS); +} + + +/** + * @brief Function for retrieving the watchdog reload request status. + * + * @param[in] rr_register Reload request register to check. + * + * @retval true If a reload request is running. + * @retval false If no reload request is running. + */ +__STATIC_INLINE bool nrf_wdt_request_status(nrf_wdt_rr_register_t rr_register) +{ + return (bool)(((NRF_WDT->REQSTATUS) >> rr_register) & 0x1UL); +} + + +/** + * @brief Function for setting the watchdog reload value. + * + * @param[in] reload_value Watchdog counter initial value. + */ +__STATIC_INLINE void nrf_wdt_reload_value_set(uint32_t reload_value) +{ + NRF_WDT->CRV = reload_value; +} + + +/** + * @brief Function for retrieving the watchdog reload value. + * + * @retval Reload value. + */ +__STATIC_INLINE uint32_t nrf_wdt_reload_value_get(void) +{ + return (uint32_t)NRF_WDT->CRV; +} + + +/** + * @brief Function for enabling a specific reload request register. + * + * @param[in] rr_register Reload request register to enable. + */ +__STATIC_INLINE void nrf_wdt_reload_request_enable(nrf_wdt_rr_register_t rr_register) +{ + NRF_WDT->RREN |= 0x1UL << rr_register; +} + + +/** + * @brief Function for disabling a specific reload request register. + * + * @param[in] rr_register Reload request register to disable. + */ +__STATIC_INLINE void nrf_wdt_reload_request_disable(nrf_wdt_rr_register_t rr_register) +{ + NRF_WDT->RREN &= ~(0x1UL << rr_register); +} + + +/** + * @brief Function for retrieving the status of a specific reload request register. + * + * @param[in] rr_register Reload request register to check. + * + * @retval true If the reload request register is enabled. + * @retval false If the reload request register is not enabled. + */ +__STATIC_INLINE bool nrf_wdt_reload_request_is_enabled(nrf_wdt_rr_register_t rr_register) +{ + return (bool)(NRF_WDT->RREN & (0x1UL << rr_register)); +} + + +/** + * @brief Function for setting a specific reload request register. + * + * @param[in] rr_register Reload request register to set. + */ +__STATIC_INLINE void nrf_wdt_reload_request_set(nrf_wdt_rr_register_t rr_register) +{ + NRF_WDT->RR[rr_register] = NRF_WDT_RR_VALUE; +} + + +#endif + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.c new file mode 100644 index 0000000000..12b36d1acb --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.c @@ -0,0 +1,454 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include + +#include "nrf.h" +#include "nrf_drv_ppi.h" +#include "nrf_drv_common.h" +#include "nrf_ppi.h" +#include "app_util_platform.h" +#include "sdk_common.h" + + +static nrf_drv_state_t m_drv_state; /**< Driver state */ +static uint32_t m_channels_allocated; /**< Bitmap representing channels availability. 1 when a channel is allocated, 0 otherwise. */ +static uint8_t m_groups_allocated; /**< Bitmap representing groups availability. 1 when a group is allocated, 0 otherwise.*/ + + +/**@brief Compute a group mask (needed for driver internals, not used for NRF_PPI registers). + * @param[in] group Group number to transform to a mask. + * @retval Group mask. + */ +__STATIC_INLINE uint32_t group_to_mask(nrf_ppi_channel_group_t group) +{ + return (1uL << (uint32_t) group); +} + + +/**@brief Check whether a channel is a programmable channel and can be used by an application. + * @param[in] channel Channel to check. + * @retval true The channel is a programmable application channel. + * false The channel is used by a SoftDevice or is preprogrammed. + */ +__STATIC_INLINE bool is_programmable_app_channel(nrf_ppi_channel_t channel) +{ + return ((NRF_PPI_PROG_APP_CHANNELS_MASK & nrf_drv_ppi_channel_to_mask(channel)) != 0); +} + + +/**@brief Check whether a channels can be used by an application. + * @param[in] channel Channel mask to check. + * @retval true All specified channels can be used by an application. + * false At least one specified channel is used by a SoftDevice. + */ +__STATIC_INLINE bool are_app_channels(uint32_t channel_mask) +{ + //lint -e(587) + return ((~(NRF_PPI_ALL_APP_CHANNELS_MASK) & channel_mask) == 0); +} + + +/**@brief Check whether a channel can be used by an application. + * @param[in] channel Channel to check. + * @retval true The channel can be used by an application. + * false The channel is used by a SoftDevice. + */ +__STATIC_INLINE bool is_app_channel(nrf_ppi_channel_t channel) +{ + return are_app_channels(nrf_drv_ppi_channel_to_mask(channel)); +} + + +/**@brief Check whether a channel group can be used by an application. + * @param[in] group Group to check. + * @retval true The group is an application group. + * false The group is not an application group (this group either does not exist or + * it is used by a SoftDevice). + */ +__STATIC_INLINE bool is_app_group(nrf_ppi_channel_group_t group) +{ + return ((NRF_PPI_ALL_APP_GROUPS_MASK & group_to_mask(group)) != 0); +} + + +/**@brief Check whether a channel is allocated. + * @param[in] channel_num Channel number to check. + * @retval true The channel is allocated. + * false The channel is not allocated. + */ +__STATIC_INLINE bool is_allocated_channel(nrf_ppi_channel_t channel) +{ + return ((m_channels_allocated & nrf_drv_ppi_channel_to_mask(channel)) != 0); +} + + +/**@brief Set channel allocated indication. + * @param[in] channel_num Specifies the channel to set the "allocated" indication. + */ +__STATIC_INLINE void channel_allocated_set(nrf_ppi_channel_t channel) +{ + m_channels_allocated |= nrf_drv_ppi_channel_to_mask(channel); +} + + +/**@brief Clear channel allocated indication. + * @param[in] channel_num Specifies the channel to clear the "allocated" indication. + */ +__STATIC_INLINE void channel_allocated_clr(nrf_ppi_channel_t channel) +{ + m_channels_allocated &= ~nrf_drv_ppi_channel_to_mask(channel); +} + + +/**@brief Clear all allocated channels. + */ +__STATIC_INLINE void channel_allocated_clr_all(void) +{ + m_channels_allocated &= ~NRF_PPI_ALL_APP_CHANNELS_MASK; +} + + +/**@brief Check whether a group is allocated. + * @param[in] group_num Group number to check. + * @retval true The group is allocated. + * false The group is not allocated. + */ +__STATIC_INLINE bool is_allocated_group(nrf_ppi_channel_group_t group) +{ + return ((m_groups_allocated & group_to_mask(group)) != 0); +} + + +/**@brief Set group allocated indication. + * @param[in] group_num Specifies the group to set the "allocated" indication. + */ +__STATIC_INLINE void group_allocated_set(nrf_ppi_channel_group_t group) +{ + m_groups_allocated |= group_to_mask(group); +} + + +/**@brief Clear group allocated indication. + * @param[in] group_num Specifies the group to clear the "allocated" indication. + */ +__STATIC_INLINE void group_allocated_clr(nrf_ppi_channel_group_t group) +{ + m_groups_allocated &= ~group_to_mask(group); +} + + +/**@brief Clear all allocated groups. + */ +__STATIC_INLINE void group_allocated_clr_all() +{ + m_groups_allocated &= ~NRF_PPI_ALL_APP_GROUPS_MASK; +} + + +uint32_t nrf_drv_ppi_init(void) +{ + uint32_t err_code; + + if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED) + { + m_drv_state = NRF_DRV_STATE_INITIALIZED; + err_code = NRF_SUCCESS; + } + else + { + err_code = MODULE_ALREADY_INITIALIZED; + } + + return err_code; +} + + +uint32_t nrf_drv_ppi_uninit(void) +{ + uint32_t mask = NRF_PPI_ALL_APP_GROUPS_MASK; + nrf_ppi_channel_group_t group; + + if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + m_drv_state = NRF_DRV_STATE_UNINITIALIZED; + + // Disable all channels and groups + nrf_ppi_channels_disable(NRF_PPI_ALL_APP_CHANNELS_MASK); + + for (group = NRF_PPI_CHANNEL_GROUP0; mask != 0; mask &= ~group_to_mask(group), group++) + { + if(mask & group_to_mask(group)) + { + nrf_ppi_channel_group_clear(group); + } + } + channel_allocated_clr_all(); + group_allocated_clr_all(); + return NRF_SUCCESS; +} + + +uint32_t nrf_drv_ppi_channel_alloc(nrf_ppi_channel_t * p_channel) +{ + uint32_t err_code; + nrf_ppi_channel_t channel; + uint32_t mask = 0; + + err_code = NRF_ERROR_NO_MEM; + + mask = NRF_PPI_PROG_APP_CHANNELS_MASK; + for (channel = NRF_PPI_CHANNEL0; mask != 0; mask &= ~nrf_drv_ppi_channel_to_mask(channel), channel++) + { + CRITICAL_REGION_ENTER(); + if ((mask & nrf_drv_ppi_channel_to_mask(channel)) && (!is_allocated_channel(channel))) + { + channel_allocated_set(channel); + *p_channel = channel; + err_code = NRF_SUCCESS; + } + CRITICAL_REGION_EXIT(); + if (err_code == NRF_SUCCESS) + { + break; + } + } + + return err_code; +} + + +uint32_t nrf_drv_ppi_channel_free(nrf_ppi_channel_t channel) +{ + if (!is_programmable_app_channel(channel)) + { + return NRF_ERROR_INVALID_PARAM; + } + // First disable this channel + nrf_ppi_channel_disable(channel); + CRITICAL_REGION_ENTER(); + channel_allocated_clr(channel); + CRITICAL_REGION_EXIT(); + return NRF_SUCCESS; +} + + +uint32_t nrf_drv_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep) +{ + VERIFY_PARAM_NOT_NULL((uint32_t *)eep); + VERIFY_PARAM_NOT_NULL((uint32_t *)tep); + + if (!is_programmable_app_channel(channel)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (!is_allocated_channel(channel)) + { + return NRF_ERROR_INVALID_STATE; + } + + nrf_ppi_channel_endpoint_setup(channel, eep, tep); + return NRF_SUCCESS; +} + +uint32_t nrf_drv_ppi_channel_fork_assign(nrf_ppi_channel_t channel, uint32_t fork_tep) +{ +#ifdef NRF51 + return NRF_ERROR_NOT_SUPPORTED; +#else + if (!is_programmable_app_channel(channel)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (!is_allocated_channel(channel)) + { + return NRF_ERROR_INVALID_STATE; + } + nrf_ppi_fork_endpoint_setup(channel, fork_tep); + return NRF_SUCCESS; +#endif +} + +uint32_t nrf_drv_ppi_channel_enable(nrf_ppi_channel_t channel) +{ + if (!is_app_channel(channel)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (is_programmable_app_channel(channel) && !is_allocated_channel(channel)) + { + return NRF_ERROR_INVALID_STATE; + } + nrf_ppi_channel_enable(channel); + return NRF_SUCCESS; +} + + +uint32_t nrf_drv_ppi_channel_disable(nrf_ppi_channel_t channel) +{ + if (!is_app_channel(channel)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (is_programmable_app_channel(channel) && !is_allocated_channel(channel)) + { + return NRF_ERROR_INVALID_STATE; + } + nrf_ppi_channel_disable(channel); + return NRF_SUCCESS; +} + + +uint32_t nrf_drv_ppi_group_alloc(nrf_ppi_channel_group_t * p_group) +{ + uint32_t err_code; + uint32_t mask = 0; + nrf_ppi_channel_group_t group; + + err_code = NRF_ERROR_NO_MEM; + + mask = NRF_PPI_ALL_APP_GROUPS_MASK; + for (group = NRF_PPI_CHANNEL_GROUP0; mask != 0; mask &= ~group_to_mask(group), group++) + { + CRITICAL_REGION_ENTER(); + if ((mask & group_to_mask(group)) && (!is_allocated_group(group))) + { + group_allocated_set(group); + *p_group = group; + err_code = NRF_SUCCESS; + } + CRITICAL_REGION_EXIT(); + if (err_code == NRF_SUCCESS) + { + break; + } + } + + return err_code; +} + + +uint32_t nrf_drv_ppi_group_free(nrf_ppi_channel_group_t group) +{ + if (!is_app_group(group)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (!is_allocated_group(group)) + { + return NRF_ERROR_INVALID_STATE; + } + else + nrf_ppi_group_disable(group); + CRITICAL_REGION_ENTER(); + group_allocated_clr(group); + CRITICAL_REGION_EXIT(); + return NRF_SUCCESS; +} + + +uint32_t nrf_drv_ppi_group_enable(nrf_ppi_channel_group_t group) +{ + if (!is_app_group(group)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (!is_allocated_group(group)) + { + return NRF_ERROR_INVALID_STATE; + } + nrf_ppi_group_enable(group); + return NRF_SUCCESS; +} + + +uint32_t nrf_drv_ppi_group_disable(nrf_ppi_channel_group_t group) +{ + if (!is_app_group(group)) + { + return NRF_ERROR_INVALID_PARAM; + } + nrf_ppi_group_disable(group); + return NRF_SUCCESS; +} + +uint32_t nrf_drv_ppi_channels_remove_from_group(uint32_t channel_mask, + nrf_ppi_channel_group_t group) +{ + if (!is_app_group(group)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (!is_allocated_group(group)) + { + return NRF_ERROR_INVALID_STATE; + } + if (!are_app_channels(channel_mask)) + { + return NRF_ERROR_INVALID_PARAM; + } + CRITICAL_REGION_ENTER(); + nrf_ppi_channels_remove_from_group(channel_mask, group); + CRITICAL_REGION_EXIT(); + return NRF_SUCCESS; +} + +uint32_t nrf_drv_ppi_channels_include_in_group(uint32_t channel_mask, + nrf_ppi_channel_group_t group) +{ + if (!is_app_group(group)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (!is_allocated_group(group)) + { + return NRF_ERROR_INVALID_STATE; + } + if (!are_app_channels(channel_mask)) + { + return NRF_ERROR_INVALID_PARAM; + } + CRITICAL_REGION_ENTER(); + nrf_ppi_channels_include_in_group(channel_mask, group); + CRITICAL_REGION_EXIT(); + return NRF_SUCCESS; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.h new file mode 100644 index 0000000000..55cd93346c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.h @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_DRV_PPI_H +#define NRF_DRV_PPI_H + +/*lint ++flb "Enter library region" */ +#include "sdk_errors.h" +#include "nrf_ppi.h" +#include +#include + +/** @file + * + * @addtogroup nrf_ppi PPI HAL and driver + * @ingroup nrf_drivers + * @brief Programmable Peripheral Interconnect (PPI) APIs. + * + * @details The PPI HAL provides basic APIs for accessing the registers of the PPI. + * The PPI driver provides APIs on a higher level. + * + * @defgroup lib_driver_ppi PPI driver + * @{ + * @ingroup nrf_ppi + * + * @brief Programmable Peripheral Interconnect (PPI) driver. + */ + +#include "sdk_resources.h" + +#ifdef NRF52 + + #define NRF_PPI_ALL_APP_CHANNELS_MASK ((uint32_t)0xFFFFFFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< All PPI channels available to the application. */ + #define NRF_PPI_PROG_APP_CHANNELS_MASK ((uint32_t)0x000FFFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< Programmable PPI channels available to the application. */ + #define NRF_PPI_ALL_APP_GROUPS_MASK ((uint32_t)0x0000003FuL & ~(NRF_PPI_GROUPS_USED)) /**< All PPI groups available to the application. */ + +#else + + #define NRF_PPI_ALL_APP_CHANNELS_MASK ((uint32_t)0xFFF0FFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< All PPI channels available to the application. */ + #define NRF_PPI_PROG_APP_CHANNELS_MASK ((uint32_t)0x0000FFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< Programmable PPI channels available to the application. */ + #define NRF_PPI_ALL_APP_GROUPS_MASK ((uint32_t)0x0000000FuL & ~(NRF_PPI_GROUPS_USED)) /**< All PPI groups available to the application. */ + +#endif + + +/**@brief Function for initializing PPI module. + * + * @retval NRF_SUCCESS If the module was successfully initialized. + * @retval MODULE_ALREADY_INITIALIZED If the module has already been initialized. + */ +uint32_t nrf_drv_ppi_init(void); + +/**@brief Function for uninitializing the PPI module. + * + * This function also disables all channels and clears the channel groups. + * + * @retval NRF_SUCCESS If the module was successfully uninitialized. + * @retval NRF_ERROR_INVALID_STATE If the module has not been initialized yet. + * @retval NRF_ERROR_INTERNAL If the channels or groups could not be disabled. + */ +uint32_t nrf_drv_ppi_uninit(void); + +/**@brief Function for allocating a PPI channel. + * @details This function allocates the first unused PPI channel. + * + * @param[out] p_channel Pointer to the PPI channel that has been allocated. + * + * @retval NRF_SUCCESS If the channel was successfully allocated. + * @retval NRF_ERROR_NO_MEM If there is no available channel to be used. + */ +uint32_t nrf_drv_ppi_channel_alloc(nrf_ppi_channel_t * p_channel); + +/**@brief Function for freeing a PPI channel. + * @details This function also disables the chosen channel. + * + * @param[in] channel PPI channel to be freed. + * + * @retval NRF_SUCCESS If the channel was successfully freed. + * @retval NRF_ERROR_INVALID_PARAM If the channel is not user-configurable. + */ +uint32_t nrf_drv_ppi_channel_free(nrf_ppi_channel_t channel); + +/**@brief Function for assigning task and event endpoints to the PPI channel. + * + * @param[in] channel PPI channel to be assigned endpoints. + * + * @param[in] eep Event endpoint address. + * + * @param[in] tep Task endpoint address. + * + * @retval NRF_SUCCESS If the channel was successfully assigned. + * @retval NRF_ERROR_INVALID_STATE If the channel is not allocated for the user. + * @retval NRF_ERROR_INVALID_PARAM If the channel is not user-configurable. + */ +uint32_t nrf_drv_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep); + +/**@brief Function for assigning or clearing fork endpoint to the PPI channel. + * + * @param[in] channel PPI channel to be assigned endpoints. + * + * @param[in] fork_tep Fork task endpoint address or 0 to clear. + * + * @retval NRF_SUCCESS If the channel was successfully assigned. + * @retval NRF_ERROR_INVALID_STATE If the channel is not allocated for the user. + * @retval NRF_ERROR_INVALID_PARAM If the channel is not user-configurable. + * @retval NRF_ERROR_NOT_SUPPORTED If function is not supported. + */ +uint32_t nrf_drv_ppi_channel_fork_assign(nrf_ppi_channel_t channel, uint32_t fork_tep); + +/**@brief Function for enabling a PPI channel. + * + * @param[in] channel PPI channel to be enabled. + * + * @retval NRF_SUCCESS If the channel was successfully enabled. + * @retval NRF_ERROR_INVALID_STATE If the user-configurable channel is not allocated. + * @retval NRF_ERROR_INVALID_PARAM If the channel cannot be enabled by the user. + */ +uint32_t nrf_drv_ppi_channel_enable(nrf_ppi_channel_t channel); + +/**@brief Function for disabling a PPI channel. + * + * @param[in] channel PPI channel to be disabled. + * + * @retval NRF_SUCCESS If the channel was successfully disabled. + * @retval NRF_ERROR_INVALID_STATE If the user-configurable channel is not allocated. + * @retval NRF_ERROR_INVALID_PARAM If the channel cannot be disabled by the user. + */ +uint32_t nrf_drv_ppi_channel_disable(nrf_ppi_channel_t channel); + +/**@brief Function for allocating a PPI channel group. + * @details This function allocates the first unused PPI group. + * + * @param[out] p_group Pointer to the PPI channel group that has been allocated. + * + * @retval NRF_SUCCESS If the channel group was successfully allocated. + * @retval NRF_ERROR_NO_MEM If there is no available channel group to be used. + */ +uint32_t nrf_drv_ppi_group_alloc(nrf_ppi_channel_group_t * p_group); + +/**@brief Function for freeing a PPI channel group. + * @details This function also disables the chosen group. + * + * @param[in] group PPI channel group to be freed. + * + * @retval NRF_SUCCESS If the channel group was successfully freed. + * @retval NRF_ERROR_INVALID_PARAM If the channel group is not user-configurable. + */ +uint32_t nrf_drv_ppi_group_free(nrf_ppi_channel_group_t group); + +/**@brief Compute a channel mask for NRF_PPI registers. + * + * @param[in] channel Channel number to transform to a mask. + * + * @retval Channel mask. + */ +__STATIC_INLINE uint32_t nrf_drv_ppi_channel_to_mask(nrf_ppi_channel_t channel) +{ + return (1uL << (uint32_t) channel); +} + +/**@brief Function for including multiple PPI channels in a channel group. + * + * @param[in] channel_mask PPI channels to be added. + * @param[in] group Channel group in which to include the channels. + * + * @retval NRF_SUCCESS If the channels was successfully included. + */ +uint32_t nrf_drv_ppi_channels_include_in_group(uint32_t channel_mask, + nrf_ppi_channel_group_t group); + +/**@brief Function for including a PPI channel in a channel group. + * + * @param[in] channel PPI channel to be added. + * @param[in] group Channel group in which to include the channel. + * + * @retval NRF_SUCCESS If the channel was successfully included. + */ +__STATIC_INLINE uint32_t nrf_drv_ppi_channel_include_in_group(nrf_ppi_channel_t channel, + nrf_ppi_channel_group_t group) +{ + return nrf_drv_ppi_channels_include_in_group(nrf_drv_ppi_channel_to_mask(channel), group); +} + +/**@brief Function for removing multiple PPI channels from a channel group. + * + * @param[in] channel_mask PPI channels to be removed. + * @param[in] group Channel group from which to remove the channels. + * + * @retval NRF_SUCCESS If the channel was successfully removed. + */ +uint32_t nrf_drv_ppi_channels_remove_from_group(uint32_t channel_mask, + nrf_ppi_channel_group_t group); + +/**@brief Function for removing a PPI channel from a channel group. + * + * @param[in] channel PPI channel to be removed. + * @param[in] group Channel group from which to remove the channel. + * + * @retval NRF_SUCCESS If the channel was successfully removed. + */ +__STATIC_INLINE uint32_t nrf_drv_ppi_channel_remove_from_group(nrf_ppi_channel_t channel, + nrf_ppi_channel_group_t group) +{ + return nrf_drv_ppi_channels_remove_from_group(nrf_drv_ppi_channel_to_mask(channel), group); +} + +/**@brief Function for clearing a PPI channel group. + * + * @param[in] group Channel group to be cleared. + * + * @retval NRF_SUCCESS If the group was successfully cleared. + */ +__STATIC_INLINE uint32_t nrf_drv_ppi_group_clear(nrf_ppi_channel_group_t group) +{ + return nrf_drv_ppi_channels_remove_from_group(NRF_PPI_ALL_APP_CHANNELS_MASK, group); +} + +/**@brief Function for enabling a PPI channel group. + * + * @param[in] group Channel group to be enabled. + * + * @retval NRF_SUCCESS If the group was successfully enabled. + */ +uint32_t nrf_drv_ppi_group_enable(nrf_ppi_channel_group_t group); + +/**@brief Function for disabling a PPI channel group. + * + * @param[in] group Channel group to be disabled. + * + * @retval NRF_SUCCESS If the group was successfully disabled. + */ +uint32_t nrf_drv_ppi_group_disable(nrf_ppi_channel_group_t group); + +/** + * @brief Function for getting the address of a PPI task. + * + * @param[in] task Task. + * + * @retval Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_ppi_task_addr_get(nrf_ppi_task_t task) +{ + return (uint32_t) nrf_ppi_task_address_get(task); +} + +/** + * @brief Function for getting the address of a PPI group enable task. + * + * @param[in] group PPI channel group + * + * @retval Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_ppi_task_addr_group_enable_get(nrf_ppi_channel_group_t group) +{ + return (uint32_t) nrf_ppi_task_group_enable_address_get(group); +} + +/** + * @brief Function for getting the address of a PPI group enable task. + * + * @param[in] group PPI channel group + * + * @retval Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_ppi_task_addr_group_disable_get(nrf_ppi_channel_group_t group) +{ + return (uint32_t) nrf_ppi_task_group_disable_address_get(group); +} + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ +#endif // NRF_DRV_PPI_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/config/pstorage_platform.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/config/pstorage_platform.h new file mode 100644 index 0000000000..113fd637fc --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/config/pstorage_platform.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + /** @cond To make doxygen skip this file */ + +/** @file + * This header contains defines with respect persistent storage that are specific to + * persistent storage implementation and application use case. + */ +#ifndef PSTORAGE_PL_H__ +#define PSTORAGE_PL_H__ + +#include +#include "nrf.h" + +static __INLINE uint16_t pstorage_flash_page_size() +{ + return (uint16_t)NRF_FICR->CODEPAGESIZE; +} + +#define PSTORAGE_FLASH_PAGE_SIZE pstorage_flash_page_size() /**< Size of one flash page. */ +#define PSTORAGE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */ + +static __INLINE uint32_t pstorage_flash_page_end() +{ + uint32_t bootloader_addr = NRF_UICR->NRFFW[0]; + + return ((bootloader_addr != PSTORAGE_FLASH_EMPTY_MASK) ? + (bootloader_addr/ PSTORAGE_FLASH_PAGE_SIZE) : NRF_FICR->CODESIZE); +} + +#define PSTORAGE_FLASH_PAGE_END pstorage_flash_page_end() + +#define PSTORAGE_NUM_OF_PAGES 1 /**< Number of flash pages allocated for the pstorage module excluding the swap page, configurable based on system requirements. */ +#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. */ + +#define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \ + * PSTORAGE_FLASH_PAGE_SIZE) /**< Start address for persistent data, configurable according to system requirements. */ +#define PSTORAGE_DATA_END_ADDR ((PSTORAGE_FLASH_PAGE_END - 1) * PSTORAGE_FLASH_PAGE_SIZE) /**< End address for persistent data, configurable according to system requirements. */ +#define PSTORAGE_SWAP_ADDR PSTORAGE_DATA_END_ADDR /**< Top-most page is used as swap area for clear and update. */ + +#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. */ +#define PSTORAGE_CMD_QUEUE_SIZE 10 /**< Maximum number of flash access commands that can be maintained by the module for all applications. Configurable. */ + + +/** Abstracts persistently memory block identifier. */ +typedef uint32_t pstorage_block_t; + +typedef struct +{ + uint32_t module_id; /**< Module ID.*/ + pstorage_block_t block_id; /**< Block ID.*/ +} pstorage_handle_t; + +typedef uint16_t pstorage_size_t; /** Size of length and offset fields. */ + +/**@brief Handles Flash Access Result Events. To be called in the system event dispatcher of the application. */ +void pstorage_sys_event_handler (uint32_t sys_evt); + +#endif // PSTORAGE_PL_H__ + +/** @} */ +/** @endcond */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.c new file mode 100644 index 0000000000..f39fe2c1e7 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.c @@ -0,0 +1,1599 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "pstorage.h" +#include +#include +#include +#include "nordic_common.h" +#include "nrf_error.h" +#include "nrf_assert.h" +#include "nrf.h" +#include "nrf_soc.h" +#include "app_util.h" +#include "app_error.h" + +#define INVALID_OPCODE 0x00 /**< Invalid op code identifier. */ +#define SOC_MAX_WRITE_SIZE PSTORAGE_FLASH_PAGE_SIZE /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API. */ +#define RAW_MODE_APP_ID (PSTORAGE_NUM_OF_PAGES + 1) /**< Application id for raw mode. */ + +#if defined(NRF52) +#define SD_CMD_MAX_TRIES 1000 /**< Number of times to try a softdevice flash operatoion, specific for nRF52 to account for longest time of flash page erase*/ +#else +#define SD_CMD_MAX_TRIES 3 /**< Number of times to try a softdevice flash operation when the @ref NRF_EVT_FLASH_OPERATION_ERROR sys_evt is received. */ +#endif /* defined(NRF52) */ + +#define MASK_TAIL_SWAP_DONE (1 << 0) /**< Flag for checking if the tail restore area has been written to swap page. */ +#define MASK_SINGLE_PAGE_OPERATION (1 << 1) /**< Flag for checking if command is a single flash page operation. */ +#define MASK_MODULE_INITIALIZED (1 << 2) /**< Flag for checking if the module has been initialized. */ +#define MASK_FLASH_API_ERR_BUSY (1 << 3) /**< Flag for checking if flash API returned NRF_ERROR_BUSY. */ + +/** + * @defgroup api_param_check API Parameters check macros. + * + * @details Macros that verify parameters passed to the module in the APIs. These macros + * could be mapped to nothing in final code versions to save execution and size. + * + * @{ + */ + +/**@brief Check if the input pointer is NULL, if so it returns NRF_ERROR_NULL. + */ +#define NULL_PARAM_CHECK(PARAM) \ + if ((PARAM) == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } + +/**@brief Verifies that the module identifier supplied by the application is within permissible + * range. + */ +#define MODULE_ID_RANGE_CHECK(ID) \ + if ((((ID)->module_id) >= PSTORAGE_NUM_OF_PAGES) || \ + (m_app_table[(ID)->module_id].cb == NULL)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief Verifies that the block identifier supplied by the application is within the permissible + * range. + */ +#define BLOCK_ID_RANGE_CHECK(ID) \ + if (((ID)->block_id) >= (m_app_table[(ID)->module_id].base_id + \ + (m_app_table[(ID)->module_id].block_count * MODULE_BLOCK_SIZE(ID)))) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief Verifies that the block size requested by the application can be supported by the module. + */ +#define BLOCK_SIZE_CHECK(X) \ + if (((X) > PSTORAGE_MAX_BLOCK_SIZE) || ((X) < PSTORAGE_MIN_BLOCK_SIZE)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief Verifies the block size requested by the application in registration API. + */ +#define BLOCK_COUNT_CHECK(COUNT, SIZE) \ + if (((COUNT) == 0) || \ + ((m_next_page_addr + ((COUNT) *(SIZE)) > PSTORAGE_SWAP_ADDR))) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief Verifies the size parameter provided by the application in API. + */ +#define SIZE_CHECK(ID, SIZE) \ + if(((SIZE) == 0) || ((SIZE) > MODULE_BLOCK_SIZE(ID))) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief Verifies the offset parameter provided by the application in API. + */ +#define OFFSET_CHECK(ID, OFFSET, SIZE) \ + if(((SIZE) + (OFFSET)) > MODULE_BLOCK_SIZE(ID)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +#ifdef PSTORAGE_RAW_MODE_ENABLE + +/**@brief Verifies the module identifier supplied by the application. + */ +#define MODULE_RAW_HANDLE_CHECK(ID) \ + if ((((ID)->module_id) != RAW_MODE_APP_ID)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +#endif // PSTORAGE_RAW_MODE_ENABLE + +/**@} */ + + +/**@brief Verify module's initialization status. + * + * @details Verify module's initialization status. Returns NRF_ERROR_INVALID_STATE when a + * module API is called without initializing the module. + */ +#define VERIFY_MODULE_INITIALIZED() \ + do \ + { \ + if (!(m_flags & MASK_MODULE_INITIALIZED)) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ + } while(0) + +/**@brief Macro to fetch the block size registered for the module. */ +#define MODULE_BLOCK_SIZE(ID) (m_app_table[(ID)->module_id].block_size) + +/**@brief Main state machine of the component. */ +typedef enum +{ + STATE_IDLE, /**< State for being idle (no command execution in progress). */ + STATE_STORE, /**< State for storing data when using store/update API. */ + STATE_DATA_ERASE_WITH_SWAP, /**< State for erasing the data page when using update/clear API when use of swap page is required. */ + STATE_DATA_ERASE, /**< State for erasing the data page when using update/clear API without the need to use the swap page. */ + STATE_ERROR /**< State entered when command processing is terminated abnormally. */ +} pstorage_state_t; + +/**@brief Sub state machine contained by @ref STATE_DATA_ERASE_WITH_SWAP super state machine. */ +typedef enum +{ + STATE_ERASE_SWAP, /**< State for erasing the swap page when using the update/clear API. */ + STATE_WRITE_DATA_TO_SWAP, /**< State for writing the data page into the swap page when using update/clear API. */ + STATE_ERASE_DATA_PAGE, /**< State for erasing data page when using update/clear API. */ + STATE_RESTORE_TAIL, /**< State for restoring tail (end) of backed up data from swap to data page when using update/clear API. */ + STATE_RESTORE_HEAD, /**< State for restoring head (beginning) of backed up data from swap to data page when using update/clear API. */ + SWAP_SUB_STATE_MAX /**< Enumeration upper bound. */ +} flash_swap_sub_state_t; + +/**@brief Application registration information. + * + * @details Defines application specific information that the application needs to maintain to be able + * to process requests from each one of them. + */ +typedef struct +{ + pstorage_ntf_cb_t cb; /**< Callback registered with the module to be notified of result of flash access. */ + pstorage_block_t base_id; /**< Base block ID assigned to the module. */ + pstorage_size_t block_size; /**< Size of block for the module. */ + pstorage_size_t block_count; /**< Number of blocks requested by the application. */ +} pstorage_module_table_t; + + +#ifdef PSTORAGE_RAW_MODE_ENABLE +/**@brief Application registration information. + * + * @details Defines application specific information that the application registered for raw mode. + */ +typedef struct +{ + pstorage_ntf_cb_t cb; /**< Callback registered with the module to be notified of the result of flash access. */ +} pstorage_raw_module_table_t; +#endif // PSTORAGE_RAW_MODE_ENABLE + + +/**@brief Defines command queue element. + * + * @details Defines command queue element. Each element encapsulates needed information to process + * a flash access command. + */ +typedef struct +{ + uint8_t op_code; /**< Identifies the flash access operation being queued. Element is free if op-code is INVALID_OPCODE. */ + pstorage_size_t size; /**< Identifies the size in bytes requested for the operation. */ + pstorage_size_t offset; /**< Offset requested by the application for the access operation. */ + pstorage_handle_t storage_addr; /**< Address/Identifier for persistent memory. */ + uint8_t * p_data_addr; /**< Address/Identifier for data memory. This is assumed to be resident memory. */ +} cmd_queue_element_t; + + +/**@brief Defines command queue, an element is free if the op_code field is not invalid. + * + * @details Defines commands enqueued for flash access. At any point in time, this queue has one or + * more flash access operations pending if the count field is not zero. When the queue is + * not empty, the rp (read pointer) field points to the flash access command in progress + * or, if none is in progress, the command to be requested next. The queue implements a + * simple first in first out algorithm. Data addresses are assumed to be resident. + */ +typedef struct +{ + uint8_t rp; /**< Read pointer, pointing to flash access that is ongoing or to be requested next. */ + uint8_t count; /**< Number of elements in the queue. */ + cmd_queue_element_t cmd[PSTORAGE_CMD_QUEUE_SIZE]; /**< Array to maintain flash access operation details. */ +} cmd_queue_t; + +static cmd_queue_t m_cmd_queue; /**< Flash operation request queue. */ +static pstorage_size_t m_next_app_instance; /**< Points to the application module instance that can be allocated next. */ +static uint32_t m_next_page_addr; /**< Points to the flash address that can be allocated to a module next. This is needed as blocks of a module that can span across flash pages. */ +static pstorage_state_t m_state; /**< Main state tracking variable. */ +static flash_swap_sub_state_t m_swap_sub_state; /**< Flash swap erase when swap used state tracking variable. */ +static uint32_t m_head_word_size; /**< Head restore area size in words. */ +static uint32_t m_tail_word_size; /**< Tail restore area size in words. */ +static uint32_t m_current_page_id; /**< Variable for tracking the flash page being processed. */ +static uint32_t m_num_of_command_retries; /**< Variable for tracking flash operation retries upon flash operation failures. */ +static pstorage_module_table_t m_app_table[PSTORAGE_NUM_OF_PAGES]; /**< Registered application information table. */ +static uint32_t m_num_of_bytes_written; /**< Variable for tracking the number of bytes written by the store operation. */ +static uint32_t m_app_data_size; /**< Variable for storing the application command size parameter internally. */ +static uint32_t m_flags = 0; /**< Storage for boolean flags for state tracking. */ + +#ifdef PSTORAGE_RAW_MODE_ENABLE +static pstorage_raw_module_table_t m_raw_app_table; /**< Registered application information table for raw mode. */ +#endif // PSTORAGE_RAW_MODE_ENABLE + +// Required forward declarations. +static void cmd_process(void); +static void store_operation_execute(void); +static void app_notify(uint32_t result, cmd_queue_element_t * p_elem); +static void cmd_queue_element_init(uint32_t index); +static void cmd_queue_dequeue(void); +static void sm_state_change(pstorage_state_t new_state); +static void swap_sub_state_state_change(flash_swap_sub_state_t new_state); + +/**@brief Function for consuming a command queue element. + * + * @details Function for consuming a command queue element, which has been fully processed. + */ +static void command_queue_element_consume(void) +{ + // Initialize/free the element as it is now processed. + cmd_queue_element_init(m_cmd_queue.rp); + + // Adjust command queue state tracking variables. + --(m_cmd_queue.count); + if (++(m_cmd_queue.rp) == PSTORAGE_CMD_QUEUE_SIZE) + { + m_cmd_queue.rp = 0; + } +} + + +/**@brief Function for executing the finalization procedure for the command executed. + * + * @details Function for executing the finalization procedure for command executed, which includes + * notifying the application of command completion, consuming the command queue element, + * and changing the internal state. + */ +static void command_end_procedure_run(void) +{ + app_notify(NRF_SUCCESS, &m_cmd_queue.cmd[m_cmd_queue.rp]); + + command_queue_element_consume(); + + sm_state_change(STATE_IDLE); +} + + +/**@brief Function for idle state entry actions. + * + * @details Function for idle state entry actions, which include resetting relevant state data and + * scheduling any possible queued flash access operation. + */ +static void state_idle_entry_run(void) +{ + m_num_of_command_retries = 0; + m_num_of_bytes_written = 0; + + // Schedule any possible queued flash access operation. + cmd_queue_dequeue(); +} + + +/**@brief Function for notifying an application of command completion and transitioning to an error + * state. + * + * @param[in] result Result code of the operation for the application. + */ +static void app_notify_error_state_transit(uint32_t result) +{ + app_notify(result, &m_cmd_queue.cmd[m_cmd_queue.rp]); + sm_state_change(STATE_ERROR); +} + + +/**@brief Function for processing flash API error code. + * + * @param[in] err_code Error code from the flash API. + */ +static void flash_api_err_code_process(uint32_t err_code) +{ + switch (err_code) + { + case NRF_SUCCESS: + break; + + case NRF_ERROR_BUSY: + // Flash access operation was not accepted and must be reissued upon flash operation + // complete event. + m_flags |= MASK_FLASH_API_ERR_BUSY; + break; + + default: + // Complete the operation with appropriate result code and transit to an error state. + app_notify_error_state_transit(err_code); + break; + } +} + +/**@brief Function for writing data to flash. + * + * @param[in] p_dst Pointer to start of flash location to be written. + * @param[in] p_src Pointer to buffer with data to be written. + * @param[in] size_in_words Number of 32-bit words to write. + */ +static void flash_write(uint32_t * const p_dst, + uint32_t const * const p_src, + uint32_t size_in_words) +{ + flash_api_err_code_process(sd_flash_write(p_dst, p_src, size_in_words)); +} + + +/**@brief Function for writing data to flash upon store command. + * + * @details Function for writing data to flash upon executing store command. Data is written to + * flash in reverse order, meaning starting at the end. If the data that is to be written + * is greater than the flash page size, it will be fragmented to fit the flash page size. + */ +static void store_cmd_flash_write_execute(void) +{ + const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + + if (p_cmd->size > SOC_MAX_WRITE_SIZE) + { + const uint32_t offset = p_cmd->size - PSTORAGE_FLASH_PAGE_SIZE; + flash_write((uint32_t *)(p_cmd->storage_addr.block_id + p_cmd->offset + offset), + (uint32_t *)(p_cmd->p_data_addr + offset), + PSTORAGE_FLASH_PAGE_SIZE / sizeof(uint32_t)); + + m_num_of_bytes_written = PSTORAGE_FLASH_PAGE_SIZE; + } + else + { + flash_write((uint32_t *)(p_cmd->storage_addr.block_id + p_cmd->offset), + (uint32_t *)(p_cmd->p_data_addr), + p_cmd->size / sizeof(uint32_t)); + + m_num_of_bytes_written = p_cmd->size; + } +} + + +/**@brief Function for store state entry action. + * + * @details Function for store state entry action, which includes writing data to a flash page. + */ +static void state_store_entry_run(void) +{ + store_cmd_flash_write_execute(); +} + + +/**@brief Function for data erase with swap state entry actions. + * + * @details Function for data erase with swap state entry actions. This includes adjusting relevant + * state and data variables and transitioning to the correct sub state. + */ +static void state_data_erase_swap_entry_run(void) +{ + m_flags &= ~MASK_TAIL_SWAP_DONE; + + const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; + + const uint32_t clear_start_page_id = cmd_block_id / PSTORAGE_FLASH_PAGE_SIZE; + m_current_page_id = clear_start_page_id; + + // @note: No need to include p_cmd->offset when calculating clear_end_page_id as: + // - clear API does not include offset parameter + // - update and store APIs are limited to operate on single block boundary thus the boolean + // clause ((m_head_word_size == 0) && is_more_than_one_page) below in this function will never + // evaluate as true as if is_more_than_one_page == true m_head_word_size is always != 0 + const uint32_t clear_end_page_id = (cmd_block_id + p_cmd->size - 1u) / + PSTORAGE_FLASH_PAGE_SIZE; + + if (clear_start_page_id == clear_end_page_id) + { + m_flags |= MASK_SINGLE_PAGE_OPERATION; + } + else + { + m_flags &= ~MASK_SINGLE_PAGE_OPERATION; + } + + if ((m_head_word_size == 0) && !(m_flags & MASK_SINGLE_PAGE_OPERATION)) + { + // No head restore required and clear/update area is shared by multiple flash pages, which + // means the current flash page does not have any tail area to restore. You can proceed with + // data page erase directly as no swap is needed for the current flash page. + swap_sub_state_state_change(STATE_ERASE_DATA_PAGE); + } + else + { + swap_sub_state_state_change(STATE_ERASE_SWAP); + } +} + + +/**@brief Function for erasing flash page. + * + * @param[in] page_number Page number of the page to be erased. + */ +static void flash_page_erase(uint32_t page_number) +{ + flash_api_err_code_process(sd_flash_page_erase(page_number)); +} + + +/**@brief Function for data erase state entry action. + * + * @details Function for data erase state entry action, which includes erasing the data flash page. + */ +static void state_data_erase_entry_run(void) +{ + flash_page_erase(m_current_page_id); +} + + +/**@brief Function for dispatching the correct application main state entry action. + */ +static void state_entry_action_run(void) +{ + switch (m_state) + { + case STATE_IDLE: + state_idle_entry_run(); + break; + + case STATE_STORE: + state_store_entry_run(); + break; + + case STATE_DATA_ERASE_WITH_SWAP: + state_data_erase_swap_entry_run(); + break; + + case STATE_DATA_ERASE: + state_data_erase_entry_run(); + break; + + default: + // No action needed. + break; + } +} + + +/**@brief Function for changing application main state and dispatching state entry action. + * + * @param[in] new_state New application main state to transit to. + */ +static void sm_state_change(pstorage_state_t new_state) +{ + m_state = new_state; + state_entry_action_run(); +} + + +/**@brief Function for swap erase state entry action. + * + * @details Function for swap erase state entry action, which includes erasing swap flash + * page. + */ +static void state_swap_erase_entry_run(void) +{ + flash_page_erase(PSTORAGE_SWAP_ADDR / PSTORAGE_FLASH_PAGE_SIZE); +} + + +/**@brief Function for write data to the swap state entry action. + * + * @details Function for write data to the swap state entry action, which includes writing the + * current data page to the swap flash page. + */ +static void state_write_data_swap_entry_run(void) +{ + // @note: There is room for further optimization here as there is only need to write the + // whole flash page to swap area if there is both head and tail area to be restored. In any + // other case we can omit some data from the head or end of the page as that is the clear area. + flash_write((uint32_t *)(PSTORAGE_SWAP_ADDR), + (uint32_t *)(m_current_page_id * PSTORAGE_FLASH_PAGE_SIZE), + PSTORAGE_FLASH_PAGE_SIZE / sizeof(uint32_t)); +} + + +/**@brief Function for erase data page state entry action. + * + * @details Function for erase data page state entry action, which includes erasing the data flash + * page. + */ +static void state_erase_data_page_entry_run(void) +{ + flash_page_erase(m_current_page_id); +} + + +/**@brief Function for restore tail state entry action. + * + * @details Function for restore tail state entry action, which includes writing the tail section + * back from swap to the data page. + */ +static void state_restore_tail_entry_run(void) +{ + const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; + + const uint32_t tail_offset = (cmd_block_id + p_cmd->size + p_cmd->offset) % + PSTORAGE_FLASH_PAGE_SIZE; + + flash_write((uint32_t *)(cmd_block_id + p_cmd->size + p_cmd->offset), + (uint32_t *)(PSTORAGE_SWAP_ADDR + tail_offset), + m_tail_word_size); +} + + +/**@brief Function for restore head state entry action. + * + * @details Function for restore head state entry action, which includes writing the head section + * back from swap to the data page. + */ +static void state_restore_head_entry_run(void) +{ + flash_write((uint32_t *)((m_current_page_id - 1u) * PSTORAGE_FLASH_PAGE_SIZE), + (uint32_t *)PSTORAGE_SWAP_ADDR, + m_head_word_size); +} + + +/**@brief Function for dispatching the correct swap sub state entry action. + */ +static void swap_sub_state_entry_action_run(void) +{ + static void (* const swap_sub_state_sm_lut[SWAP_SUB_STATE_MAX])(void) = + { + state_swap_erase_entry_run, + state_write_data_swap_entry_run, + state_erase_data_page_entry_run, + state_restore_tail_entry_run, + state_restore_head_entry_run + }; + + swap_sub_state_sm_lut[m_swap_sub_state](); +} + + +/**@brief Function for changing the swap sub state and dispatching state entry action. + * + * @param[in] new_state New swap sub state to transit to. + */ +static void swap_sub_state_state_change(flash_swap_sub_state_t new_state) +{ + m_swap_sub_state = new_state; + swap_sub_state_entry_action_run(); +} + + +/**@brief Function for initializing the command queue element. + * + * @param[in] index Index of the element to be initialized. + */ +static void cmd_queue_element_init(uint32_t index) +{ + // Internal function and checks on range of index can be avoided. + m_cmd_queue.cmd[index].op_code = INVALID_OPCODE; + m_cmd_queue.cmd[index].size = 0; + m_cmd_queue.cmd[index].storage_addr.module_id = PSTORAGE_NUM_OF_PAGES; + m_cmd_queue.cmd[index].storage_addr.block_id = 0; + m_cmd_queue.cmd[index].p_data_addr = NULL; + m_cmd_queue.cmd[index].offset = 0; +} + + +/**@brief Function for initializing the command queue. + */ +static void cmd_queue_init(void) +{ + m_cmd_queue.rp = 0; + m_cmd_queue.count = 0; + + for (uint32_t cmd_index = 0; cmd_index < PSTORAGE_CMD_QUEUE_SIZE; ++cmd_index) + { + cmd_queue_element_init(cmd_index); + } +} + + +/**@brief Function for enqueuing, and possibly dispatching, a flash access operation. + * + * @param[in] opcode Identifies the operation requested to be enqueued. + * @param[in] p_storage_addr Identifies the module and flash address on which the operation is + * requested. + * @param[in] p_data_addr Identifies the data address for flash access. + * @param[in] size Size in bytes of data requested for the access operation. + * @param[in] offset Offset within the flash memory block at which operation is requested. + * + * @retval NRF_SUCCESS Upon success. + * @retval NRF_ERROR_NO_MEM Upon failure, when no space is available in the command queue. + */ +static uint32_t cmd_queue_enqueue(uint8_t opcode, + pstorage_handle_t * p_storage_addr, + uint8_t * p_data_addr, + pstorage_size_t size, + pstorage_size_t offset) +{ + uint32_t err_code; + + if (m_cmd_queue.count != PSTORAGE_CMD_QUEUE_SIZE) + { + // Enqueue the command if it the queue is not full. + uint32_t write_index = m_cmd_queue.rp + m_cmd_queue.count; + + if (write_index >= PSTORAGE_CMD_QUEUE_SIZE) + { + write_index -= PSTORAGE_CMD_QUEUE_SIZE; + } + + m_cmd_queue.cmd[write_index].op_code = opcode; + m_cmd_queue.cmd[write_index].p_data_addr = p_data_addr; + m_cmd_queue.cmd[write_index].storage_addr = (*p_storage_addr); + m_cmd_queue.cmd[write_index].size = size; + m_cmd_queue.cmd[write_index].offset = offset; + + m_cmd_queue.count++; + + if (m_state == STATE_IDLE) + { + cmd_process(); + } + + err_code = NRF_SUCCESS; + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + + return err_code; +} + + +/**@brief Function for dequeing a possible pending flash access operation. + */ +static void cmd_queue_dequeue(void) +{ + if ((m_cmd_queue.count != 0)) + { + cmd_process(); + } +} + + +/**@brief Function for notifying an application of command completion. + * + * @param[in] result Result code of the operation for the application. + * @param[in] p_elem Pointer to the command queue element for which this result was received. + */ +static void app_notify(uint32_t result, cmd_queue_element_t * p_elem) +{ + pstorage_ntf_cb_t ntf_cb; + const uint8_t op_code = p_elem->op_code; + +#ifdef PSTORAGE_RAW_MODE_ENABLE + if (p_elem->storage_addr.module_id == RAW_MODE_APP_ID) + { + ntf_cb = m_raw_app_table.cb; + } + else +#endif // PSTORAGE_RAW_MODE_ENABLE + { + ntf_cb = m_app_table[p_elem->storage_addr.module_id].cb; + } + + ntf_cb(&p_elem->storage_addr, op_code, result, p_elem->p_data_addr, m_app_data_size); +} + + +/**@brief Function for evaluating if a data page swap is required for the tail section on the + * current page. + * + * @retval true If data page swap is required. + * @retval false If data page swap is not required. + */ +static bool is_tail_data_page_swap_required(void) +{ + bool ret_value; + + // Extract id of the last page command is executed upon. + const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; + const uint32_t last_page_id = (cmd_block_id + p_cmd->size + p_cmd->offset - 1u) / + PSTORAGE_FLASH_PAGE_SIZE; + + // If tail section area exists and the current page is the last page then tail data page swap is + // required. + if ((m_tail_word_size != 0) && (m_current_page_id == last_page_id)) + { + ret_value = true; + } + else + { + ret_value = false; + } + + return ret_value; +} + + +/**@brief Function for performing post processing for the update and clear commands. + * + * @details Function for performing post processing for the update and clear commands, which implies + * executing the correct execution path depending on the command. + */ +static void clear_post_processing_run(void) +{ + const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + + if (p_cmd->op_code != PSTORAGE_UPDATE_OP_CODE) + { + command_end_procedure_run(); + } + else + { + store_operation_execute(); + } +} + + +/**@brief Function for doing swap sub state exit action. + */ +static void swap_sub_sm_exit_action_run(void) +{ + clear_post_processing_run(); +} + + +/**@brief Function for evaluating if the page erase operation is required for the current page. + * + * @retval true If page erase is required. + * @retval false If page erase is not required. + */ +static bool is_page_erase_required(void) +{ + bool ret; + + const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; + const uint32_t id_last_page_to_be_cleared = (cmd_block_id + p_cmd->size + + p_cmd->offset - 1u) / + PSTORAGE_FLASH_PAGE_SIZE; + + // True if: + // - current page is not the last page OR + // - current page is the last page AND no tail exists + if ((m_current_page_id < id_last_page_to_be_cleared) || + ((m_current_page_id == id_last_page_to_be_cleared) && (m_tail_word_size == 0))) + { + ret = true; + } + else + { + ret = false; + } + + return ret; +} + + +/**@brief Function for reissuing the last flash operation request, which was rejected by the flash + * API, in swap sub sate. + */ +static void swap_sub_state_err_busy_process(void) +{ + // Reissue the request by doing a self transition to the current state. + m_flags &= ~MASK_FLASH_API_ERR_BUSY; + swap_sub_state_state_change(m_swap_sub_state); +} + + +/**@brief Function for doing restore head state action upon flash operation success event. + * + * @details Function for doing restore head state action upon flash operation success event, which + * includes making a state transition depending on the current state. + */ +static void head_restore_state_run(void) +{ + if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) + { + if (is_tail_data_page_swap_required()) + { + // Additional data page needs to be swapped for tail section as we are clearing a block, + // which is shared between 2 flash pages. + + // Adjust variables to ensure correct state transition path is taken after the tail + // section swap has completed. + m_head_word_size = 0; + m_flags |= MASK_TAIL_SWAP_DONE; + + swap_sub_state_state_change(STATE_ERASE_SWAP); + } + else if (is_page_erase_required()) + { + // Additional page erase operation is required. + + // Adjust variable to ensure correct state transition path is taken after the additional + // page erase operation has completed. + m_head_word_size = 0; + swap_sub_state_state_change(STATE_ERASE_DATA_PAGE); + } + else if (m_tail_word_size != 0) + { + // Proceed with restoring tail from swap to data page. + swap_sub_state_state_change(STATE_RESTORE_TAIL); + } + else + { + // Swap statemachine execution end reached. + swap_sub_sm_exit_action_run(); + } + } + else + { + // As operation request was rejected by the flash API reissue the request. + swap_sub_state_err_busy_process(); + } +} + + +/**@brief Function for doing restore tail state action upon flash operation success event. + */ +static void tail_restore_state_run(void) +{ + if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) + { + swap_sub_sm_exit_action_run(); + } + else + { + // As operation request was rejected by the flash API reissue the request. + swap_sub_state_err_busy_process(); + } +} + + +/**@brief Function for doing data page erase state action upon a flash operation success event. + * + * @details Function for doing data page erase state action upon a flash operation success event, + * which includes making a state transit to a new state depending on the current state. + */ +static void data_page_erase_state_run(void) +{ + if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) + { + ++m_current_page_id; + + if (m_head_word_size != 0) + { + swap_sub_state_state_change(STATE_RESTORE_HEAD); + } + else if (is_page_erase_required()) + { + // Additional page erase operation is required. + swap_sub_state_state_change(STATE_ERASE_DATA_PAGE); + } + else if (m_tail_word_size != 0) + { + if (!(m_flags & MASK_TAIL_SWAP_DONE)) + { + // Tail area restore is required and we have not yet written the relevant data page + // to swap area. Start the process of writing the data page to swap. + m_flags |= MASK_TAIL_SWAP_DONE; + + swap_sub_state_state_change(STATE_ERASE_SWAP); + } + else + { + // Tail area restore is required and we have already written the relevant data page + // to swap area. Proceed by restoring the tail area. + swap_sub_state_state_change(STATE_RESTORE_TAIL); + } + } + else + { + swap_sub_sm_exit_action_run(); + } + } + else + { + // As operation request was rejected by the flash API reissue the request. + swap_sub_state_err_busy_process(); + } +} + + +/**@brief Function for doing data to swap write state action upon flash operation success event. + */ +static void data_to_swap_write_state_run(void) +{ + if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) + { + // If the operation is executed only on 1 single flash page it automatically means that tail + // area is written to the swap, which we store to flags. + if (m_flags & MASK_SINGLE_PAGE_OPERATION) + { + m_flags |= MASK_TAIL_SWAP_DONE; + } + + swap_sub_state_state_change(STATE_ERASE_DATA_PAGE); + } + else + { + // As operation request was rejected by the flash API reissue the request. + swap_sub_state_err_busy_process(); + } +} + + +/**@brief Function for doing swap erase state action upon flash operation success event. + */ +static void swap_erase_state_run(void) +{ + if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) + { + swap_sub_state_state_change(STATE_WRITE_DATA_TO_SWAP); + } + else + { + // As operation request was rejected by the flash API reissue the request. + swap_sub_state_err_busy_process(); + } +} + + +/**@brief Function for dispatching the correct state action for data erase with a swap composite +* state upon a flash operation success event. + */ +static void swap_sub_state_sm_run(void) +{ + static void (* const swap_sub_state_sm_lut[SWAP_SUB_STATE_MAX])(void) = + { + swap_erase_state_run, + data_to_swap_write_state_run, + data_page_erase_state_run, + tail_restore_state_run, + head_restore_state_run + }; + + swap_sub_state_sm_lut[m_swap_sub_state](); +} + + +/**@brief Function for reissuing the last flash operation request, which was rejected by the flash + * API, in main sate. + */ +static void main_state_err_busy_process(void) +{ + // Reissue the request by doing a self transition to the current state. + m_flags &= ~MASK_FLASH_API_ERR_BUSY; + sm_state_change(m_state); +} + + +/**@brief Function for doing erase state action upon flash operation success event. + * + * @details Function for doing erase state action upon flash operation success event, which includes + * making a state transition depending on the current state. + */ +static void erase_sub_state_sm_run(void) +{ + if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) + { + // Clear operation request has succeeded. + ++m_current_page_id; + + if (!is_page_erase_required()) + { + clear_post_processing_run(); + } + else + { + // All required flash pages have not yet been erased, issue erase by doing a self + // transit. + sm_state_change(m_state); + } + } + else + { + // As operation request was rejected by the flash API reissue the request. + main_state_err_busy_process(); + } +} + + +/**@brief Function for doing store state action upon flash operation success event. + */ +static void store_sub_state_sm_run(void) +{ + if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) + { + // As write operation request has succeeded, adjust the size tracking state information + // accordingly. + cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + p_cmd->size -= m_num_of_bytes_written; + + if (p_cmd->size == 0) + { + command_end_procedure_run(); + } + else + { + store_cmd_flash_write_execute(); + } + } + else + { + // As operation request was rejected by the flash API reissue the request. + main_state_err_busy_process(); + } +} + + +/**@brief Function for doing action upon flash operation success event. + */ +static void flash_operation_success_run(void) +{ + switch (m_state) + { + case STATE_STORE: + store_sub_state_sm_run(); + break; + + case STATE_DATA_ERASE: + erase_sub_state_sm_run(); + break; + + case STATE_DATA_ERASE_WITH_SWAP: + swap_sub_state_sm_run(); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for doing action upon flash operation failure event. + * + * @details Function for doing action upon flash operation failure event, which includes retrying + * the last operation or if retry count has been reached completing the operation with + * appropriate result code and transitioning to an error state. + * + * @note The command is not removed from the command queue, which will result to stalling of the + * command pipeline and the appropriate application recovery procedure for this is to reset + * the system by issuing @ref pstorage_init which will also result to flushing of the + * command queue. + */ +static void flash_operation_failure_run(void) +{ + if (++m_num_of_command_retries != SD_CMD_MAX_TRIES) + { + // Retry the last operation by doing a self transition to the current state. + + if (m_state != STATE_DATA_ERASE_WITH_SWAP) + { + sm_state_change(m_state); + } + else + { + swap_sub_state_state_change(m_swap_sub_state); + } + } + else + { + // Complete the operation with appropriate result code and transit to an error state. + app_notify_error_state_transit(NRF_ERROR_TIMEOUT); + } +} + + +/**@brief Function for handling flash access result events. + * + * @param[in] sys_evt System event to be handled. + */ +void pstorage_sys_event_handler(uint32_t sys_evt) +{ + if (m_state != STATE_IDLE && m_state != STATE_ERROR) + { + switch (sys_evt) + { + case NRF_EVT_FLASH_OPERATION_SUCCESS: + flash_operation_success_run(); + break; + + case NRF_EVT_FLASH_OPERATION_ERROR: + if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) + { + flash_operation_failure_run(); + } + else + { + // As our last flash operation request was rejected by the flash API reissue the + // request by doing same code execution path as for flash operation sucess + // event. This will promote code reuse in the implementation. + flash_operation_success_run(); + } + break; + + default: + // No implementation needed. + break; + } + + } +} + + +/**@brief Function for calculating the tail area size in number of 32-bit words. + * + * @param[in] cmd_end_of_storage_address End of storage area within the scope of the command. + * @param[in] end_of_storage_address End of allocated storage area for the application. + */ +static void tail_word_size_calculate(pstorage_size_t cmd_end_of_storage_address, + pstorage_size_t end_of_storage_address) +{ + // Two different cases to resolve when calculating correct size for restore tail section: + // 1) End of storage area and command end area are in the same page. + // 2) End of storage area and command end area are not in the same page. + + const uint32_t end_of_storage_area_page = end_of_storage_address / + PSTORAGE_FLASH_PAGE_SIZE; + const uint32_t command_end_of_storage_area_page = cmd_end_of_storage_address / + PSTORAGE_FLASH_PAGE_SIZE; + + if (end_of_storage_area_page == command_end_of_storage_area_page) + { + //lint -e{573} suppress "Signed-unsigned mix with divide". + m_tail_word_size = (end_of_storage_address - cmd_end_of_storage_address) / sizeof(uint32_t); + } + else + { + //lint -e{573} suppress "Signed-unsigned mix with divide". + m_tail_word_size = (PSTORAGE_FLASH_PAGE_SIZE - + (cmd_end_of_storage_address % PSTORAGE_FLASH_PAGE_SIZE)) / + sizeof(uint32_t); + } +} + + +/**@brief Function for executing the clear operation. + */ +static void clear_operation_execute(void) +{ + const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; + + const pstorage_size_t block_size = m_app_table[p_cmd->storage_addr.module_id].block_size; + const pstorage_size_t block_count = m_app_table[p_cmd->storage_addr.module_id].block_count; + const pstorage_block_t block_base_id = m_app_table[p_cmd->storage_addr.module_id].base_id; + + const bool is_start_address_page_aligned = (cmd_block_id % PSTORAGE_FLASH_PAGE_SIZE) == 0; + + // Calculate the end (1 beyond allocated area) for complete storage area and to the area only + // within scope of this command. + const pstorage_block_t end_of_storage_address = block_base_id + (block_size * block_count); + const pstorage_block_t cmd_end_of_storage_address = cmd_block_id + p_cmd->size + p_cmd->offset; + + // Zero tail to make sure no extra erase is done erroneously. + m_tail_word_size = 0; + + // If the following is true no swap access is needed: + // - 1st logical test covers the case of: clear/update 1 complete single page. + // - 2nd logical test covers the case of: + // 1) Clear/update last allocated page and page is not full (page can't be shared between + // multiple clients so the end of the page is unused area). + // 2) Clear/update all allocated storage. + if ((is_start_address_page_aligned && (p_cmd->size == PSTORAGE_FLASH_PAGE_SIZE)) || + (is_start_address_page_aligned && (cmd_end_of_storage_address == end_of_storage_address) && + (p_cmd->offset == 0)) || (p_cmd->storage_addr.module_id == RAW_MODE_APP_ID)) + { + // Nothing to put to the swap and we can just erase the pages(s). + + m_current_page_id = cmd_block_id / PSTORAGE_FLASH_PAGE_SIZE; + + sm_state_change(STATE_DATA_ERASE); + } + else + { + // Not all the blocks for the module can be cleared, we need to use swap page for storing + // data temporarily. + + m_head_word_size = ((cmd_block_id + p_cmd->offset) % PSTORAGE_FLASH_PAGE_SIZE) / + sizeof(uint32_t); + + const bool is_cmd_end_address_page_aligned = ((cmd_end_of_storage_address % + PSTORAGE_FLASH_PAGE_SIZE) == 0); + if ((cmd_end_of_storage_address != end_of_storage_address) && + !is_cmd_end_address_page_aligned) + { + // When command area is not equal to end of the storage allocation area and not ending + // to page boundary there is a need to restore the tail area. + tail_word_size_calculate(cmd_end_of_storage_address, end_of_storage_address); + } + + sm_state_change(STATE_DATA_ERASE_WITH_SWAP); + } +} + + +/**@brief Function for executing the store operation. + */ +static void store_operation_execute(void) +{ + sm_state_change(STATE_STORE); +} + + +/**@brief Function for executing the update operation. + */ +static void update_operation_execute(void) +{ + clear_operation_execute(); +} + + +/**@brief Function for dispatching the flash access operation. + */ +static void cmd_process(void) +{ + const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + m_app_data_size = p_cmd->size; + + switch (p_cmd->op_code) + { + case PSTORAGE_STORE_OP_CODE: + store_operation_execute(); + break; + + case PSTORAGE_CLEAR_OP_CODE: + clear_operation_execute(); + break; + + case PSTORAGE_UPDATE_OP_CODE: + update_operation_execute(); + break; + + default: + // No action required. + break; + } +} + + +uint32_t pstorage_init(void) +{ + cmd_queue_init(); + + m_next_app_instance = 0; + m_next_page_addr = PSTORAGE_DATA_START_ADDR; + m_current_page_id = 0; + + for (uint32_t index = 0; index < PSTORAGE_NUM_OF_PAGES; index++) + { + m_app_table[index].cb = NULL; + m_app_table[index].block_size = 0; + m_app_table[index].block_count = 0; + } + +#ifdef PSTORAGE_RAW_MODE_ENABLE + m_raw_app_table.cb = NULL; +#endif //PSTORAGE_RAW_MODE_ENABLE + + m_state = STATE_IDLE; + m_num_of_command_retries = 0; + m_flags = 0; + m_num_of_bytes_written = 0; + m_flags |= MASK_MODULE_INITIALIZED; + + return NRF_SUCCESS; +} + + +uint32_t pstorage_register(pstorage_module_param_t * p_module_param, + pstorage_handle_t * p_block_id) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_module_param); + NULL_PARAM_CHECK(p_block_id); + NULL_PARAM_CHECK(p_module_param->cb); + BLOCK_SIZE_CHECK(p_module_param->block_size); + BLOCK_COUNT_CHECK(p_module_param->block_count, p_module_param->block_size); + + if (!((p_module_param->block_size % sizeof(uint32_t)) == 0)) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (m_next_app_instance == PSTORAGE_NUM_OF_PAGES) + { + return NRF_ERROR_NO_MEM; + } + + p_block_id->module_id = m_next_app_instance; + p_block_id->block_id = m_next_page_addr; + + m_app_table[m_next_app_instance].base_id = p_block_id->block_id; + m_app_table[m_next_app_instance].cb = p_module_param->cb; + m_app_table[m_next_app_instance].block_size = p_module_param->block_size; + m_app_table[m_next_app_instance].block_count = p_module_param->block_count; + + // Calculate number of flash pages allocated for the device and adjust next free page address. + /*lint -save -e666 */ + const uint32_t page_count = CEIL_DIV((p_module_param->block_size * p_module_param->block_count), + PSTORAGE_FLASH_PAGE_SIZE); + /*lint -restore */ + m_next_page_addr += page_count * PSTORAGE_FLASH_PAGE_SIZE; + + ++m_next_app_instance; + + return NRF_SUCCESS; +} + + +uint32_t pstorage_block_identifier_get(pstorage_handle_t * p_base_id, + pstorage_size_t block_num, + pstorage_handle_t * p_block_id) +{ + pstorage_handle_t temp_id; + + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_base_id); + NULL_PARAM_CHECK(p_block_id); + MODULE_ID_RANGE_CHECK(p_base_id); + + temp_id = (*p_base_id); + temp_id.block_id += (block_num * MODULE_BLOCK_SIZE(p_base_id)); + + BLOCK_ID_RANGE_CHECK(&temp_id); + + (*p_block_id) = temp_id; + + return NRF_SUCCESS; +} + + +uint32_t pstorage_store(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_src); + NULL_PARAM_CHECK(p_dest); + MODULE_ID_RANGE_CHECK(p_dest); + BLOCK_ID_RANGE_CHECK(p_dest); + SIZE_CHECK(p_dest, size); + OFFSET_CHECK(p_dest, offset, size); + + if ((!is_word_aligned(p_src)) || + (!is_word_aligned((void *)(uint32_t)offset)) || + (!is_word_aligned((uint32_t *)p_dest->block_id))) + { + return NRF_ERROR_INVALID_ADDR; + } + + return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset); +} + + +uint32_t pstorage_update(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_src); + NULL_PARAM_CHECK(p_dest); + MODULE_ID_RANGE_CHECK(p_dest); + BLOCK_ID_RANGE_CHECK(p_dest); + SIZE_CHECK(p_dest, size); + OFFSET_CHECK(p_dest, offset, size); + + if ((!is_word_aligned(p_src)) || + (!is_word_aligned((void *)(uint32_t)offset)) || + (!is_word_aligned((uint32_t *)p_dest->block_id))) + { + return NRF_ERROR_INVALID_ADDR; + } + + return cmd_queue_enqueue(PSTORAGE_UPDATE_OP_CODE, p_dest, p_src, size, offset); +} + + +uint32_t pstorage_load(uint8_t * p_dest, + pstorage_handle_t * p_src, + pstorage_size_t size, + pstorage_size_t offset) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_src); + NULL_PARAM_CHECK(p_dest); + MODULE_ID_RANGE_CHECK(p_src); + BLOCK_ID_RANGE_CHECK(p_src); + SIZE_CHECK(p_src, size); + OFFSET_CHECK(p_src, offset, size); + + if ((!is_word_aligned(p_dest)) || + (!is_word_aligned((void *)(uint32_t)offset)) || + (!is_word_aligned((uint32_t *)p_src->block_id))) + { + return NRF_ERROR_INVALID_ADDR; + } + + memcpy(p_dest, (((uint8_t *)p_src->block_id) + offset), size); + + m_app_table[p_src->module_id].cb(p_src, PSTORAGE_LOAD_OP_CODE, NRF_SUCCESS, p_dest, size); + + return NRF_SUCCESS; +} + + +uint32_t pstorage_clear(pstorage_handle_t * p_dest, pstorage_size_t size) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_dest); + MODULE_ID_RANGE_CHECK(p_dest); + BLOCK_ID_RANGE_CHECK(p_dest); + + if ((!is_word_aligned((uint32_t *)p_dest->block_id))) + { + return NRF_ERROR_INVALID_ADDR; + } + + // Check is the area starting from block_id multiple of block_size. + if ( + !( + ((p_dest->block_id - m_app_table[p_dest->module_id].base_id) % + m_app_table[p_dest->module_id].block_size) == 0 + ) + ) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Check is requested size multiple of registered block size or 0. + if (((size % m_app_table[p_dest->module_id].block_size) != 0) || (size == 0)) + { + return NRF_ERROR_INVALID_PARAM; + } + + const uint32_t registered_allocation_size = m_app_table[p_dest->module_id].block_size * + m_app_table[p_dest->module_id].block_count; + + const pstorage_block_t clear_request_end_address = p_dest->block_id + size; + const pstorage_block_t allocation_end_address = m_app_table[p_dest->module_id].base_id + + registered_allocation_size; + // Check if request would lead to a buffer overrun. + if (clear_request_end_address > allocation_end_address) + { + return NRF_ERROR_INVALID_PARAM; + } + + return cmd_queue_enqueue(PSTORAGE_CLEAR_OP_CODE, p_dest, NULL, size, 0); +} + + +uint32_t pstorage_access_status_get(uint32_t * p_count) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_count); + + (*p_count) = m_cmd_queue.count; + + return NRF_SUCCESS; +} + +#ifdef PSTORAGE_RAW_MODE_ENABLE + +uint32_t pstorage_raw_register(pstorage_module_param_t * p_module_param, + pstorage_handle_t * p_block_id) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_module_param); + NULL_PARAM_CHECK(p_block_id); + NULL_PARAM_CHECK(p_module_param->cb); + + if (m_raw_app_table.cb != NULL) + { + return NRF_ERROR_NO_MEM; + } + + p_block_id->module_id = RAW_MODE_APP_ID; + m_raw_app_table.cb = p_module_param->cb; + + return NRF_SUCCESS; +} + + +uint32_t pstorage_raw_store(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_src); + NULL_PARAM_CHECK(p_dest); + MODULE_RAW_HANDLE_CHECK(p_dest); + + if (size == 0) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Verify word alignment. + if ((!is_word_aligned(p_src)) || + (!is_word_aligned((void *)(uint32_t)size)) || + (!is_word_aligned((void *)(uint32_t)offset)) || + (!is_word_aligned((void *)(p_dest->block_id)))) + { + return NRF_ERROR_INVALID_ADDR; + } + + return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset); +} + + +uint32_t pstorage_raw_clear(pstorage_handle_t * p_dest, pstorage_size_t size) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_dest); + MODULE_RAW_HANDLE_CHECK(p_dest); + + if ((!is_word_aligned((uint32_t *)p_dest->block_id))) + { + return NRF_ERROR_INVALID_ADDR; + } + + return cmd_queue_enqueue(PSTORAGE_CLEAR_OP_CODE, p_dest, NULL, size, 0); +} + +#endif // PSTORAGE_RAW_MODE_ENABLE diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.h new file mode 100644 index 0000000000..0a5884cd52 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.h @@ -0,0 +1,408 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup persistent_storage Persistent Storage Interface + * @{ + * @ingroup app_common + * @brief Abstracted flash interface. + * + * @details An abstracted interface is provided by the module to easily port the application and + * SDK modules to an alternate option. This ensures that the SDK and application are moved + * to alternate persistent storage instead of the one provided by default. + */ + +#ifndef PSTORAGE_H__ +#define PSTORAGE_H__ + +#include "pstorage_platform.h" + + +/**@defgroup ps_opcode Persistent Storage Access Operation Codes + * @{ + * @brief Persistent Storage Access Operation Codes. + * + * @details Persistent Storage Access Operation Codes are used by Persistent storage operation + * completion callback @ref pstorage_ntf_cb_t to identify the operation type requested by + * the application. + */ +#define PSTORAGE_STORE_OP_CODE 0x01 /**< Store Operation type. */ +#define PSTORAGE_LOAD_OP_CODE 0x02 /**< Load Operation type. */ +#define PSTORAGE_CLEAR_OP_CODE 0x03 /**< Clear Operation type. */ +#define PSTORAGE_UPDATE_OP_CODE 0x04 /**< Update Operation type. */ + +/**@} */ + +/**@defgroup pstorage_data_types Persistent Memory Interface Data Types + * @{ + * @brief Data Types needed for interfacing with persistent memory. + * + * @details Data Types needed for interfacing with persistent memory. + */ + +/**@brief Persistent storage operation completion callback function type. + * + * @details The persistent storage operation completion callback is used by the interface to report + * success or failure of a flash operation. Since data is not copied for a store operation, + * a callback is an indication that the resident memory can now be reused or freed. + * + * @param[in] handle Identifies the module and block for the callback that is received. + * @param[in] op_code Identifies the operation for the event that is notified. + * @param[in] result Identifies the result of a flash access operation. NRF_SUCCESS implies + * operation succeeded. + * + * @note Unmanaged (abnormal behaviour) error codes from the SoftDevice flash + * access API are forwarded as is and are expected to be handled by the + * application. For details refer to the implementation file and corresponding + * SoftDevice flash API documentation. + * + * @param[in] p_data Identifies the application data pointer. For a store operation, this points + * to the resident source of application memory that the application can now + * free or reuse. When there is a clear operation, this is NULL since no + * application pointer is needed for this operation. + * @param[in] data_len Length data the application provided for the operation. + */ +typedef void (*pstorage_ntf_cb_t)(pstorage_handle_t * p_handle, + uint8_t op_code, + uint32_t result, + uint8_t * p_data, + uint32_t data_len); + +/**@brief Struct containing module registration context. */ +typedef struct +{ + pstorage_ntf_cb_t cb; /**< Persistent storage operation completion callback function @ref pstorage_ntf_cb_t. */ + pstorage_size_t block_size; /**< Desired block size for persistent memory storage. For example, if a module has a table with 10 entries, and each entry is 64 bytes in size, + * it can request 10 blocks with a block size of 64 bytes. The module can also request one block that is 640 bytes depending + * on how it would like to access or alter the memory in persistent memory. + * The first option is preferred when it is a single entry that needs to be updated often and doesn't impact the other entries. + * The second option is preferred when table entries are not changed individually but have a common point of loading and storing + * data. */ + pstorage_size_t block_count; /** Number of blocks requested by the module; minimum values is 1. */ +} pstorage_module_param_t; + +/**@} */ + +/**@defgroup pstorage_routines Persistent Storage Access Routines + * @{ + * @brief Functions/Interface SDK modules used to persistently store data. + * + * @details Interface for the Application and SDK modules to load/store information persistently. + * Note: While implementation of each of the persistent storage access functions + * depends on the system and is specific to system/solution, the signature of the + * interface routines should not be altered. + */ + +/**@brief Function for initializing the module. + * + * @details Function for initializing the module. This function is called once before any other APIs + * of the module are used. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t pstorage_init(void); + +/**@brief Function for registering with persistent storage interface. + * + * @param[in] p_module_param Module registration parameter. + * @param[out] p_block_id Block identifier to identify persistent memory blocks when + * registration succeeds. Application is expected to use the block IDs + * for subsequent operations on requested persistent memory. Maximum + * registrations permitted is determined by the configuration of the + * parameter PSTORAGE_NUM_OF_PAGES. If more than one memory block is + * requested, the identifier provided here is the base identifier for the + * first block and used to identify the subsequent block. The application + * uses \@ref pstorage_block_identifier_get with this base identifier and + * block number. Therefore if 10 blocks of size 64 are requested and the + * application wishes to store memory in the 6th block, it shall use + * \@ref pstorage_block_identifier_get with the base ID and provide a + * block number of 5. This way the application is only expected to + * remember the base block identifier. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + * @retval NRF_ERROR_NO_MEM Operation failure. Additional registrations can't be + * supported. + */ +uint32_t pstorage_register(pstorage_module_param_t * p_module_param, + pstorage_handle_t * p_block_id); + +/**@brief Function for getting block ID with reference to base block identifier provided at the time + * of registration. + * + * @details Function to get the block ID with reference to base block identifier provided at the + * time of registration. + * If more than one memory block was requested when registering, the identifier provided + * here is the base identifier for the first block which is used to identify subsequent + * blocks. The application shall use this routine to get the block identifier, providing + * input as base identifier and block number. Therefore, if 10 blocks of size 64 are + * requested and the application wishes to store memory in the 6th block, it shall use + * \@ref pstorage_block_identifier_get with the base ID and provide a block number of 5. + * This way the application is only expected to remember the base block identifier. + * + * @param[in] p_base_id Base block ID received at the time of registration. + * @param[in] block_num Block Number, with first block numbered zero. + * @param[out] p_block_id Block identifier for the block number requested when the API succeeds. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + */ +uint32_t pstorage_block_identifier_get(pstorage_handle_t * p_base_id, + pstorage_size_t block_num, + pstorage_handle_t * p_block_id); + +/**@brief Function for persistently storing data of length 'size' contained in the 'p_src' address + * in the storage module at 'p_dest' address. Equivalent to Storage Write. + * + * @param[in] p_dest Destination address where data is to be stored persistently. + * @param[in] p_src Source address containing data to be stored. API assumes this to be resident + * memory and no intermediate copy of data is made by the API. Must be word + * aligned. + * @param[in] size Size of data to be stored expressed in bytes. Must be word aligned and size + + * offset must be <= block size. + * @param[in] offset Offset in bytes to be applied when writing to the block. + * For example, if within a block of 100 bytes, the application wishes to + * write 20 bytes at an offset of 12, then this field should be set to 12. + * Must be word aligned. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. + * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. + * + * @warning No copy of the data is made, meaning memory provided for the data source that is to + * be written to flash cannot be freed or reused by the application until this procedure + * is complete. The application is notified when the procedure is finished using the + * notification callback registered by the application. + */ +uint32_t pstorage_store(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset); + +/**@brief Function for updating persistently stored data of length 'size' contained in the 'p_src' + * address in the storage module at 'p_dest' address. + * + * @param[in] p_dest Destination address where data is to be updated. + * @param[in] p_src Source address containing data to be stored. API assumes this to be resident + * memory and no intermediate copy of data is made by the API. + * @param[in] size Size of data to be stored expressed in bytes. Must be word aligned and size + + * offset must be <= block size. + * @param[in] offset Offset in bytes to be applied when writing to the block. + * For example, if within a block of 100 bytes, the application wishes to + * write 20 bytes at an offset of 12 bytes, then this field should be set to 12. + * Must be word aligned. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. + * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. + * + * @warning No copy of the data is made, meaning memory provided for the data source that is to + * be written to flash cannot be freed or reused by the application until this procedure + * is complete. The application is notified when the procedure is finished using the + * notification callback registered by the application. + */ +uint32_t pstorage_update(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset); + +/**@brief Function for loading persistently stored data of length 'size' from 'p_src' address + * to 'p_dest' address. Equivalent to Storage Read. + * + * @param[in] p_dest Destination address where persistently stored data is to be loaded. + * @param[in] p_src Source where data is loaded from persistent memory. + * @param[in] size Size of data to be loaded from persistent memory expressed in bytes. + * Should be word aligned. + * @param[in] offset Offset in bytes, to be applied when loading from the block. + * For example, if within a block of 100 bytes, the application wishes to + * load 20 bytes from offset of 12 bytes, then this field should be set to 12. + * Should be word aligned. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. + * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. + */ +uint32_t pstorage_load(uint8_t * p_dest, + pstorage_handle_t * p_src, + pstorage_size_t size, + pstorage_size_t offset); + +/**@brief Function for clearing data in persistent memory. + * + * @param[in] p_base_id Base block identifier in persistent memory that needs to be cleared; + * equivalent to an Erase Operation. + * @param[in] size Size of data to be cleared from persistent memory expressed in bytes. + * This parameter is to provision for clearing of certain blocks + * of memory, or all memory blocks in a registered module. If the total size + * of the application module is used (blocks * block size) in combination with + * the identifier for the first block in the module, all blocks in the + * module will be erased. Must be multiple of block size. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. + * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. + * + * @note Clear operations may take time. This API however, does not block until the clear + * procedure is complete. The application is notified of procedure completion using + * a notification callback registered by the application. The 'result' parameter of the + * callback indicates if the procedure was successful or not. + */ +uint32_t pstorage_clear(pstorage_handle_t * p_base_id, pstorage_size_t size); + +/**@brief Function for getting the number of pending operations with the module. + * + * @param[out] p_count Number of storage operations pending with the module. If 0, there are no + * outstanding requests. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + */ +uint32_t pstorage_access_status_get(uint32_t * p_count); + +#ifdef PSTORAGE_RAW_MODE_ENABLE + +/**@brief Function for registering with the persistent storage interface. + * + * @param[in] p_module_param Module registration parameter. + * @param[out] p_block_id Block identifier used to identify persistent memory blocks upon + * successful registration. The application is expected to use the block + * IDs for subsequent operations on requested persistent memory. When + * more than one memory block is requested, this identifier is the base + * identifier for the first block and used to identify subsequent blocks. + * The application shall use \@ref pstorage_block_identifier_get with + * this base identifier and block number. Therefore if 10 blocks of size + * 64 are requested and the application wishes to store memory in the 6th + * block, it shall use \@ref pstorage_block_identifier_get with the base + * ID and provide a block number of 5. Therefore, the application is only + * expected to remember the base block identifier. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. + */ +uint32_t pstorage_raw_register(pstorage_module_param_t * p_module_param, + pstorage_handle_t * p_block_id); + +/**@brief Function for persistently storing data of length 'size' contained in 'p_src' address in + * storage module at 'p_dest' address. Equivalent to Storage Write. + * + * @param[in] p_dest Destination address where data is to be stored persistently. + * @param[in] p_src Source address containing data to be stored. The API assumes this is resident + * memory and no intermediate copy of data is made by the API. Must be word + * aligned. + * @param[in] size Size of data to be stored expressed in bytes. Must be word aligned. + * @param[in] offset Offset in bytes to be applied when writing to the block. + * For example, if within a block of 100 bytes, the application wishes to + * write 20 bytes at an offset of 12 bytes, this field should be set to 12. + * Must be word aligned. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. + * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. + * + * @warning No copy of the data is made, meaning memory provided for data source that is to be + * written to flash cannot be freed or reused by the application until this procedure + * is complete. The application is notified when the procedure is finished using the + * notification callback registered by the application. + */ +uint32_t pstorage_raw_store(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset); + +/**@brief Function for clearing data in persistent memory in raw mode. + * + * @param[in] p_dest Base block identifier in persistent memory that needs to be cleared. + * Equivalent to an Erase Operation. + * @param[in] size Size of data to be cleared from persistent memory expressed in bytes. + * Not used. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module + * initialization. + * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. + * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. + * + * @note Clear operations may take time. This API, however, does not block until the clear + * procedure is complete. The application is notified of procedure completion using + * a notification callback registered by the application. The 'result' parameter of the + * callback indicates if the procedure was successful or not. + */ +uint32_t pstorage_raw_clear(pstorage_handle_t * p_dest, pstorage_size_t size); + +#endif // PSTORAGE_RAW_MODE_ENABLE + +/**@} */ +/**@} */ + +#endif // PSTORAGE_H__ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c new file mode 100644 index 0000000000..de1f287232 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c @@ -0,0 +1,715 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "nrf_drv_spi.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" +#include "nrf_assert.h" +#include "app_util_platform.h" + + +#ifndef NRF52 + // Make sure SPIx_USE_EASY_DMA is 0 for nRF51 (if a common + // "nrf_drv_config.h" file is provided for nRF51 and nRF52). + #undef SPI0_USE_EASY_DMA + #define SPI0_USE_EASY_DMA 0 + #undef SPI1_USE_EASY_DMA + #define SPI1_USE_EASY_DMA 0 + #undef SPI2_USE_EASY_DMA + #define SPI2_USE_EASY_DMA 0 +#endif + +// This set of macros makes it possible to exclude parts of code when one type +// of supported peripherals is not used. +#if ((SPI0_ENABLED && SPI0_USE_EASY_DMA) || \ + (SPI1_ENABLED && SPI1_USE_EASY_DMA) || \ + (SPI2_ENABLED && SPI2_USE_EASY_DMA)) + #define SPIM_IN_USE +#endif +#if ((SPI0_ENABLED && !SPI0_USE_EASY_DMA) || \ + (SPI1_ENABLED && !SPI1_USE_EASY_DMA) || \ + (SPI2_ENABLED && !SPI2_USE_EASY_DMA)) + #define SPI_IN_USE +#endif +#if defined(SPIM_IN_USE) && defined(SPI_IN_USE) + // SPIM and SPI combined + #define CODE_FOR_SPIM(code) if (p_instance->use_easy_dma) { code } + #define CODE_FOR_SPI(code) else { code } +#elif defined(SPIM_IN_USE) && !defined(SPI_IN_USE) + // SPIM only + #define CODE_FOR_SPIM(code) { code } + #define CODE_FOR_SPI(code) +#elif !defined(SPIM_IN_USE) && defined(SPI_IN_USE) + // SPI only + #define CODE_FOR_SPIM(code) + #define CODE_FOR_SPI(code) { code } +#else + #error "Wrong configuration." +#endif + +#ifdef SPIM_IN_USE +#ifdef NRF52_PAN_23 +#define END_INT_MASK (NRF_SPIM_INT_ENDTX_MASK | NRF_SPIM_INT_ENDRX_MASK) +#else +#define END_INT_MASK NRF_SPIM_INT_END_MASK +#endif +#endif + +// Control block - driver instance local data. +typedef struct +{ + nrf_drv_spi_handler_t handler; + nrf_drv_spi_evt_t evt; // Keep the struct that is ready for event handler. Less memcpy. + nrf_drv_state_t state; + volatile bool transfer_in_progress; + + // [no need for 'volatile' attribute for the following members, as they + // are not concurrently used in IRQ handlers and main line code] + uint8_t ss_pin; + uint8_t orc; + uint8_t bytes_transferred; + + bool tx_done : 1; + bool rx_done : 1; + bool abort : 1; +} spi_control_block_t; +static spi_control_block_t m_cb[SPI_COUNT]; + +static nrf_drv_spi_config_t const m_default_config[SPI_COUNT] = { +#if SPI0_ENABLED + NRF_DRV_SPI_DEFAULT_CONFIG(0), +#endif +#if SPI1_ENABLED + NRF_DRV_SPI_DEFAULT_CONFIG(1), +#endif +#if SPI2_ENABLED + NRF_DRV_SPI_DEFAULT_CONFIG(2), +#endif +}; + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n + #define IRQ_HANDLER(n) static void IRQ_HANDLER_NAME(n)(void) + + #if SPI0_ENABLED + IRQ_HANDLER(0); + #endif + #if SPI1_ENABLED + IRQ_HANDLER(1); + #endif + #if SPI2_ENABLED + IRQ_HANDLER(2); + #endif + static nrf_drv_irq_handler_t const m_irq_handlers[SPI_COUNT] = { + #if SPI0_ENABLED + IRQ_HANDLER_NAME(0), + #endif + #if SPI1_ENABLED + IRQ_HANDLER_NAME(1), + #endif + #if SPI2_ENABLED + IRQ_HANDLER_NAME(2), + #endif + }; +#else + #define IRQ_HANDLER(n) void SPI##n##_IRQ_HANDLER(void) +#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED + + +ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance, + nrf_drv_spi_config_t const * p_config, + nrf_drv_spi_handler_t handler) +{ + spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + if (nrf_drv_common_per_res_acquire(p_instance->p_registers, + m_irq_handlers[p_instance->drv_inst_idx]) != NRF_SUCCESS) + { + return NRF_ERROR_BUSY; + } +#endif + + if (p_config == NULL) + { + p_config = &m_default_config[p_instance->drv_inst_idx]; + } + + p_cb->handler = handler; + + uint32_t mosi_pin; + uint32_t miso_pin; + // Configure pins used by the peripheral: + // - SCK - output with initial value corresponding with the SPI mode used: + // 0 - for modes 0 and 1 (CPOL = 0), 1 - for modes 2 and 3 (CPOL = 1); + // according to the reference manual guidelines this pin and its input + // buffer must always be connected for the SPI to work. + if (p_config->mode <= NRF_DRV_SPI_MODE_1) + { + nrf_gpio_pin_clear(p_config->sck_pin); + } + else + { + nrf_gpio_pin_set(p_config->sck_pin); + } + NRF_GPIO->PIN_CNF[p_config->sck_pin] = + (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos) + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) + | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) + | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) + | (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); + // - MOSI (optional) - output with initial value 0, + if (p_config->mosi_pin != NRF_DRV_SPI_PIN_NOT_USED) + { + mosi_pin = p_config->mosi_pin; + nrf_gpio_pin_clear(mosi_pin); + nrf_gpio_cfg_output(mosi_pin); + } + else + { + mosi_pin = NRF_SPI_PIN_NOT_CONNECTED; + } + // - MISO (optional) - input, + if (p_config->miso_pin != NRF_DRV_SPI_PIN_NOT_USED) + { + miso_pin = p_config->miso_pin; + nrf_gpio_cfg_input(miso_pin, NRF_GPIO_PIN_NOPULL); + } + else + { + miso_pin = NRF_SPI_PIN_NOT_CONNECTED; + } + // - Slave Select (optional) - output with initial value 1 (inactive). + if (p_config->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) + { + nrf_gpio_pin_set(p_config->ss_pin); + nrf_gpio_cfg_output(p_config->ss_pin); + } + m_cb[p_instance->drv_inst_idx].ss_pin = p_config->ss_pin; + + CODE_FOR_SPIM + ( + NRF_SPIM_Type * p_spim = (NRF_SPIM_Type * ) p_instance->p_registers; + nrf_spim_pins_set(p_spim, p_config->sck_pin, mosi_pin, miso_pin); + nrf_spim_frequency_set(p_spim, + (nrf_spim_frequency_t)p_config->frequency); + nrf_spim_configure(p_spim, + (nrf_spim_mode_t)p_config->mode, + (nrf_spim_bit_order_t)p_config->bit_order); + + nrf_spim_orc_set(p_spim, p_config->orc); + + if (p_cb->handler) + { + nrf_spim_int_enable(p_spim, END_INT_MASK | NRF_SPIM_INT_STOPPED_MASK); + } + + nrf_spim_enable(p_spim); + ) + CODE_FOR_SPI + ( + NRF_SPI_Type * p_spi = (NRF_SPI_Type * ) p_instance->p_registers; + nrf_spi_pins_set(p_spi, p_config->sck_pin, mosi_pin, miso_pin); + nrf_spi_frequency_set(p_spi, + (nrf_spi_frequency_t)p_config->frequency); + nrf_spi_configure(p_spi, + (nrf_spi_mode_t)p_config->mode, + (nrf_spi_bit_order_t)p_config->bit_order); + + m_cb[p_instance->drv_inst_idx].orc = p_config->orc; + + if (p_cb->handler) + { + nrf_spi_int_enable(p_spi, NRF_SPI_INT_READY_MASK); + } + + nrf_spi_enable(p_spi); + ) + + if (p_cb->handler) + { + nrf_drv_common_irq_enable(p_instance->irq, p_config->irq_priority); + } + + p_cb->transfer_in_progress = false; + p_cb->state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + +void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance) +{ + spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + if (p_cb->handler) + { + nrf_drv_common_irq_disable(p_instance->irq); + } + + #define DISABLE_ALL 0xFFFFFFFF + + CODE_FOR_SPIM + ( + NRF_SPIM_Type * p_spim = (NRF_SPIM_Type * ) p_instance->p_registers; + if (p_cb->handler) + { + nrf_spim_int_disable(p_spim, DISABLE_ALL); + if (p_cb->transfer_in_progress) + { + // Ensure that SPI is not performing any transfer. + nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP); + while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) {} + p_cb->transfer_in_progress = false; + } + } + nrf_spim_disable(p_spim); + ) + CODE_FOR_SPI + ( + NRF_SPI_Type * p_spi = (NRF_SPI_Type * ) p_instance->p_registers; + if (p_cb->handler) + { + nrf_spi_int_disable(p_spi, DISABLE_ALL); + } + nrf_spi_disable(p_spi); + ) + #undef DISABLE_ALL + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + nrf_drv_common_per_res_release(p_instance->p_registers); +#endif + + p_cb->state = NRF_DRV_STATE_UNINITIALIZED; +} + +ret_code_t nrf_drv_spi_transfer(nrf_drv_spi_t const * const p_instance, + uint8_t const * p_tx_buffer, + uint8_t tx_buffer_length, + uint8_t * p_rx_buffer, + uint8_t rx_buffer_length) +{ + nrf_drv_spi_xfer_desc_t xfer_desc; + xfer_desc.p_tx_buffer = p_tx_buffer; + xfer_desc.p_rx_buffer = p_rx_buffer; + xfer_desc.tx_length = tx_buffer_length; + xfer_desc.rx_length = rx_buffer_length; + + return nrf_drv_spi_xfer(p_instance, &xfer_desc, 0); +} + +static void finish_transfer(spi_control_block_t * p_cb) +{ + // If Slave Select signal is used, this is the time to deactivate it. + if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) + { + nrf_gpio_pin_set(p_cb->ss_pin); + } + + // By clearing this flag before calling the handler we allow subsequent + // transfers to be started directly from the handler function. + p_cb->transfer_in_progress = false; + p_cb->evt.type = NRF_DRV_SPI_EVENT_DONE; + p_cb->handler(&p_cb->evt); +} + +#ifdef SPI_IN_USE +// This function is called from IRQ handler or, in blocking mode, directly +// from the 'nrf_drv_spi_transfer' function. +// It returns true as long as the transfer should be continued, otherwise (when +// there is nothing more to send/receive) it returns false. +static bool transfer_byte(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb) +{ + // Read the data byte received in this transfer and store it in RX buffer, + // if needed. + volatile uint8_t rx_data = nrf_spi_rxd_get(p_spi); + if (p_cb->bytes_transferred < p_cb->evt.data.done.rx_length) + { + p_cb->evt.data.done.p_rx_buffer[p_cb->bytes_transferred] = rx_data; + } + + ++p_cb->bytes_transferred; + + // Check if there are more bytes to send or receive and write proper data + // byte (next one from TX buffer or over-run character) to the TXD register + // when needed. + // NOTE - we've already used 'p_cb->bytes_transferred + 1' bytes from our + // buffers, because we take advantage of double buffering of TXD + // register (so in effect one byte is still being transmitted now); + // see how the transfer is started in the 'nrf_drv_spi_transfer' + // function. + uint16_t bytes_used = p_cb->bytes_transferred + 1; + + if (p_cb->abort) + { + if (bytes_used < p_cb->evt.data.done.tx_length) + { + p_cb->evt.data.done.tx_length = bytes_used; + } + if (bytes_used < p_cb->evt.data.done.rx_length) + { + p_cb->evt.data.done.rx_length = bytes_used; + } + } + + if (bytes_used < p_cb->evt.data.done.tx_length) + { + nrf_spi_txd_set(p_spi, p_cb->evt.data.done.p_tx_buffer[bytes_used]); + return true; + } + else if (bytes_used < p_cb->evt.data.done.rx_length) + { + nrf_spi_txd_set(p_spi, p_cb->orc); + return true; + } + + return (p_cb->bytes_transferred < p_cb->evt.data.done.tx_length || + p_cb->bytes_transferred < p_cb->evt.data.done.rx_length); +} + +static void spi_xfer(NRF_SPI_Type * p_spi, + spi_control_block_t * p_cb, + nrf_drv_spi_xfer_desc_t const * p_xfer_desc) +{ + nrf_spi_int_disable(p_spi, NRF_SPI_INT_READY_MASK); + p_cb->bytes_transferred = 0; + + nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY); + + // Start the transfer by writing some byte to the TXD register; + // if TX buffer is not empty, take the first byte from this buffer, + // otherwise - use over-run character. + nrf_spi_txd_set(p_spi, + (p_xfer_desc->tx_length > 0 ? p_xfer_desc->p_tx_buffer[0] : p_cb->orc)); + + // TXD register is double buffered, so next byte to be transmitted can + // be written immediately, if needed, i.e. if TX or RX transfer is to + // be more that 1 byte long. Again - if there is something more in TX + // buffer send it, otherwise use over-run character. + if (p_xfer_desc->tx_length > 1) + { + nrf_spi_txd_set(p_spi, p_xfer_desc->p_tx_buffer[1]); + } + else if (p_xfer_desc->rx_length > 1) + { + nrf_spi_txd_set(p_spi, p_cb->orc); + } + + // For blocking mode (user handler not provided) wait here for READY + // events (indicating that the byte from TXD register was transmitted + // and a new incoming byte was moved to the RXD register) and continue + // transaction until all requested bytes are transferred. + // In non-blocking mode - IRQ service routine will do this stuff. + if (p_cb->handler) + { + nrf_spi_int_enable(p_spi, NRF_SPI_INT_READY_MASK); + } + else + { + do { + while (!nrf_spi_event_check(p_spi, NRF_SPI_EVENT_READY)) {} + nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY); + } while (transfer_byte(p_spi, p_cb)); + if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) + { + nrf_gpio_pin_set(p_cb->ss_pin); + } + } +} +#endif // SPI_IN_USE + +#ifdef SPIM_IN_USE +__STATIC_INLINE void spim_int_enable(NRF_SPIM_Type * p_spim, bool enable) +{ + if (!enable) + { + nrf_spim_int_disable(p_spim, END_INT_MASK | NRF_SPIM_INT_STOPPED_MASK); + } + else + { + nrf_spim_int_enable(p_spim, END_INT_MASK | NRF_SPIM_INT_STOPPED_MASK); + } +} + +__STATIC_INLINE void spim_list_enable_handle(NRF_SPIM_Type * p_spim, uint32_t flags) +{ +#ifndef NRF52_PAN_46 + if (NRF_DRV_SPI_FLAG_TX_POSTINC & flags) + { + nrf_spim_tx_list_enable(p_spim); + } + else + { + nrf_spim_tx_list_disable(p_spim); + } + + if (NRF_DRV_SPI_FLAG_RX_POSTINC & flags) + { + nrf_spim_rx_list_enable(p_spim); + } + else + { + nrf_spim_rx_list_disable(p_spim); + } +#endif +} + +static ret_code_t spim_xfer(NRF_SPIM_Type * p_spim, + spi_control_block_t * p_cb, + nrf_drv_spi_xfer_desc_t const * p_xfer_desc, + uint32_t flags) +{ + // EasyDMA requires that transfer buffers are placed in Data RAM region; + // signal error if they are not. + if ((p_xfer_desc->p_tx_buffer != NULL && !nrf_drv_is_in_RAM(p_xfer_desc->p_tx_buffer)) || + (p_xfer_desc->p_rx_buffer != NULL && !nrf_drv_is_in_RAM(p_xfer_desc->p_rx_buffer))) + { + p_cb->transfer_in_progress = false; + return NRF_ERROR_INVALID_ADDR; + } + + nrf_spim_tx_buffer_set(p_spim, p_xfer_desc->p_tx_buffer, p_xfer_desc->tx_length); + nrf_spim_rx_buffer_set(p_spim, p_xfer_desc->p_rx_buffer, p_xfer_desc->rx_length); + +#ifdef NRF52_PAN_23 + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDTX); + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDRX); +#else + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_END); +#endif + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_STOPPED); + + spim_list_enable_handle(p_spim, flags); + + if (!(flags & NRF_DRV_SPI_FLAG_HOLD_XFER)) + { + nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_START); + } + + if (!p_cb->handler) + { +#ifdef NRF52_PAN_23 + while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDTX) || + !nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDRX)) {} +#else + while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){} +#endif + // Stop the peripheral after transaction is finished. + nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP); + while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) {} + if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) + { + nrf_gpio_pin_set(p_cb->ss_pin); + } + } + else + { + spim_int_enable(p_spim, !(flags & NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER)); + } + return NRF_SUCCESS; +} +#endif + +ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t const * const p_instance, + nrf_drv_spi_xfer_desc_t const * p_xfer_desc, + uint32_t flags) +{ + spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(p_xfer_desc->p_tx_buffer != NULL || p_xfer_desc->tx_length == 0); + ASSERT(p_xfer_desc->p_rx_buffer != NULL || p_xfer_desc->rx_length == 0); + + if (p_cb->transfer_in_progress) + { + return NRF_ERROR_BUSY; + } + else + { + if (p_cb->handler && !(flags & (NRF_DRV_SPI_FLAG_REPEATED_XFER | NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER))) + { + p_cb->transfer_in_progress = true; + } + } + + p_cb->evt.data.done = *p_xfer_desc; + p_cb->tx_done = false; + p_cb->rx_done = false; + p_cb->abort = false; + + if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) + { + nrf_gpio_pin_clear(p_cb->ss_pin); + } + CODE_FOR_SPIM + ( + return spim_xfer((NRF_SPIM_Type * ) p_instance->p_registers, p_cb, p_xfer_desc, flags); + ) + CODE_FOR_SPI + ( + if (flags) + { + p_cb->transfer_in_progress = false; + return NRF_ERROR_NOT_SUPPORTED; + } + spi_xfer((NRF_SPI_Type * ) p_instance->p_registers, p_cb, p_xfer_desc); + return NRF_SUCCESS; + ) +} + +void nrf_drv_spi_abort(nrf_drv_spi_t const * p_instance) +{ + spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + CODE_FOR_SPIM + ( + nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP); + while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) {} + p_cb->transfer_in_progress = false; + ) + CODE_FOR_SPI + ( + p_cb->abort = true; + ) +} + +#ifdef SPIM_IN_USE +static void irq_handler_spim(NRF_SPIM_Type * p_spim, spi_control_block_t * p_cb) +{ + ASSERT(p_cb->handler); + +#ifdef NRF52_PAN_23 + if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) + { + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_STOPPED); + finish_transfer(p_cb); + } + else + { + if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDTX)) + { + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDTX); + p_cb->tx_done = true; + } + if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDRX)) + { + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDRX); + p_cb->rx_done = true; + } + if (p_cb->tx_done && p_cb->rx_done) + { + nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP); + } + } +#else + if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)) + { + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_END); + finish_transfer(p_cb); + } +#endif +} + +uint32_t nrf_drv_spi_start_task_get(nrf_drv_spi_t const * p_instance) +{ + NRF_SPIM_Type * p_spim = (NRF_SPIM_Type *)p_instance->p_registers; + return nrf_spim_task_address_get(p_spim, NRF_SPIM_TASK_START); +} + +uint32_t nrf_drv_spi_end_event_get(nrf_drv_spi_t const * p_instance) +{ + NRF_SPIM_Type * p_spim = (NRF_SPIM_Type *)p_instance->p_registers; + return nrf_spim_event_address_get(p_spim, NRF_SPIM_EVENT_END); +} +#endif // SPIM_IN_USE + +#ifdef SPI_IN_USE +static void irq_handler_spi(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb) +{ + ASSERT(p_cb->handler); + + nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY); + + if (!transfer_byte(p_spi, p_cb)) + { + finish_transfer(p_cb); + } +} +#endif // SPI_IN_USE + +#if SPI0_ENABLED +IRQ_HANDLER(0) +{ + spi_control_block_t * p_cb = &m_cb[SPI0_INSTANCE_INDEX]; + #if SPI0_USE_EASY_DMA + irq_handler_spim(NRF_SPIM0, p_cb); + #else + irq_handler_spi(NRF_SPI0, p_cb); + #endif +} +#endif // SPI0_ENABLED + +#if SPI1_ENABLED +IRQ_HANDLER(1) +{ + spi_control_block_t * p_cb = &m_cb[SPI1_INSTANCE_INDEX]; + #if SPI1_USE_EASY_DMA + irq_handler_spim(NRF_SPIM1, p_cb); + #else + irq_handler_spi(NRF_SPI1, p_cb); + #endif +} +#endif // SPI1_ENABLED + +#if SPI2_ENABLED +IRQ_HANDLER(2) +{ + spi_control_block_t * p_cb = &m_cb[SPI2_INSTANCE_INDEX]; + #if SPI2_USE_EASY_DMA + irq_handler_spim(NRF_SPIM2, p_cb); + #else + irq_handler_spi(NRF_SPI2, p_cb); + #endif +} +#endif // SPI2_ENABLED diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h new file mode 100644 index 0000000000..17ae6536f4 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h @@ -0,0 +1,398 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * @addtogroup nrf_spi Serial peripheral interface (SPI) + * @ingroup nrf_drivers + * @brief Serial peripheral interface (SPI) APIs. + * + * + * @addtogroup nrf_spi_master SPI master HAL and driver + * @ingroup nrf_spi + * @brief SPI master APIs. + */ + +#ifndef NRF_DRV_SPI_H__ +#define NRF_DRV_SPI_H__ + +#include "nordic_common.h" +#include "nrf_drv_config.h" +#include "nrf_spi.h" +#include "nrf_spim.h" +#include "sdk_errors.h" + +#if defined(NRF52) + #define NRF_DRV_SPI_PERIPHERAL(id) \ + (CONCAT_3(SPI, id, _USE_EASY_DMA) == 1 ? \ + (void *)CONCAT_2(NRF_SPIM, id) \ + : (void *)CONCAT_2(NRF_SPI, id)) + #define SPI2_IRQ SPIM2_SPIS2_SPI2_IRQn + #define SPI2_IRQ_HANDLER SPIM2_SPIS2_SPI2_IRQHandler +#else + #define NRF_DRV_SPI_PERIPHERAL(id) (void *)CONCAT_2(NRF_SPI, id) +#endif +#define SPI0_IRQ SPI0_TWI0_IRQn +#define SPI0_IRQ_HANDLER SPI0_TWI0_IRQHandler +#define SPI1_IRQ SPI1_TWI1_IRQn +#define SPI1_IRQ_HANDLER SPI1_TWI1_IRQHandler + + +/** + * @defgroup nrf_drv_spi_master SPI master driver + * @{ + * @ingroup nrf_spi_master + * + * @brief Multi-instance SPI master driver. + */ + +/** + * @brief SPI master driver instance data structure. + */ +typedef struct +{ + void * p_registers; ///< Pointer to the structure with SPI/SPIM peripheral instance registers. + IRQn_Type irq; ///< SPI/SPIM peripheral instance IRQ number. + uint8_t drv_inst_idx; ///< Driver instance index. + bool use_easy_dma; ///< True if the peripheral with EasyDMA (SPIM) shall be used. +} nrf_drv_spi_t; + +/** + * @brief Macro for creating an SPI master driver instance. + */ +#define NRF_DRV_SPI_INSTANCE(id) \ +{ \ + .p_registers = NRF_DRV_SPI_PERIPHERAL(id), \ + .irq = CONCAT_3(SPI, id, _IRQ), \ + .drv_inst_idx = CONCAT_3(SPI, id, _INSTANCE_INDEX), \ + .use_easy_dma = CONCAT_3(SPI, id, _USE_EASY_DMA) \ +} + +/** + * @brief This value can be provided instead of a pin number for signals MOSI, + * MISO, and Slave Select to specify that the given signal is not used and + * therefore does not need to be connected to a pin. + */ +#define NRF_DRV_SPI_PIN_NOT_USED 0xFF + +/** + * @brief SPI data rates. + */ +typedef enum +{ + NRF_DRV_SPI_FREQ_125K = NRF_SPI_FREQ_125K, ///< 125 kbps. + NRF_DRV_SPI_FREQ_250K = NRF_SPI_FREQ_250K, ///< 250 kbps. + NRF_DRV_SPI_FREQ_500K = NRF_SPI_FREQ_500K, ///< 500 kbps. + NRF_DRV_SPI_FREQ_1M = NRF_SPI_FREQ_1M, ///< 1 Mbps. + NRF_DRV_SPI_FREQ_2M = NRF_SPI_FREQ_2M, ///< 2 Mbps. + NRF_DRV_SPI_FREQ_4M = NRF_SPI_FREQ_4M, ///< 4 Mbps. + NRF_DRV_SPI_FREQ_8M = NRF_SPI_FREQ_8M ///< 8 Mbps. +} nrf_drv_spi_frequency_t; + +/** + * @brief SPI modes. + */ +typedef enum +{ + NRF_DRV_SPI_MODE_0 = NRF_SPI_MODE_0, ///< SCK active high, sample on leading edge of clock. + NRF_DRV_SPI_MODE_1 = NRF_SPI_MODE_1, ///< SCK active high, sample on trailing edge of clock. + NRF_DRV_SPI_MODE_2 = NRF_SPI_MODE_2, ///< SCK active low, sample on leading edge of clock. + NRF_DRV_SPI_MODE_3 = NRF_SPI_MODE_3 ///< SCK active low, sample on trailing edge of clock. +} nrf_drv_spi_mode_t; + +/** + * @brief SPI bit orders. + */ +typedef enum +{ + NRF_DRV_SPI_BIT_ORDER_MSB_FIRST = NRF_SPI_BIT_ORDER_MSB_FIRST, ///< Most significant bit shifted out first. + NRF_DRV_SPI_BIT_ORDER_LSB_FIRST = NRF_SPI_BIT_ORDER_LSB_FIRST ///< Least significant bit shifted out first. +} nrf_drv_spi_bit_order_t; + +/** + * @brief SPI master driver instance configuration structure. + */ +typedef struct +{ + uint8_t sck_pin; ///< SCK pin number. + uint8_t mosi_pin; ///< MOSI pin number (optional). + /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED + * if this signal is not needed. */ + uint8_t miso_pin; ///< MISO pin number (optional). + /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED + * if this signal is not needed. */ + uint8_t ss_pin; ///< Slave Select pin number (optional). + /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED + * if this signal is not needed. The driver + * supports only active low for this signal. + * If the signal should be active high, + * it must be controlled externally. */ + uint8_t irq_priority; ///< Interrupt priority. + uint8_t orc; ///< Over-run character. + /**< This character is used when all bytes from the TX buffer are sent, + but the transfer continues due to RX. */ + nrf_drv_spi_frequency_t frequency; ///< SPI frequency. + nrf_drv_spi_mode_t mode; ///< SPI mode. + nrf_drv_spi_bit_order_t bit_order; ///< SPI bit order. +} nrf_drv_spi_config_t; + +/** + * @brief SPI master instance default configuration. + */ +#define NRF_DRV_SPI_DEFAULT_CONFIG(id) \ +{ \ + .sck_pin = CONCAT_3(SPI, id, _CONFIG_SCK_PIN), \ + .mosi_pin = CONCAT_3(SPI, id, _CONFIG_MOSI_PIN), \ + .miso_pin = CONCAT_3(SPI, id, _CONFIG_MISO_PIN), \ + .ss_pin = NRF_DRV_SPI_PIN_NOT_USED, \ + .irq_priority = CONCAT_3(SPI, id, _CONFIG_IRQ_PRIORITY), \ + .orc = 0xFF, \ + .frequency = NRF_DRV_SPI_FREQ_4M, \ + .mode = NRF_DRV_SPI_MODE_0, \ + .bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST, \ +} + +#define NRF_DRV_SPI_FLAG_TX_POSTINC (1UL << 0) /**< TX buffer address incremented after transfer. */ +#define NRF_DRV_SPI_FLAG_RX_POSTINC (1UL << 1) /**< RX buffer address incremented after transfer. */ +#define NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER (1UL << 2) /**< Interrupt after each transfer is suppressed, and the event handler is not called. */ +#define NRF_DRV_SPI_FLAG_HOLD_XFER (1UL << 3) /**< Set up the transfer but do not start it. */ +#define NRF_DRV_SPI_FLAG_REPEATED_XFER (1UL << 4) /**< Flag indicating that the transfer will be executed multiple times. */ + +/** + * @brief Single transfer descriptor structure. + */ +typedef struct +{ + uint8_t const * p_tx_buffer; ///< Pointer to TX buffer. + uint8_t tx_length; ///< TX buffer length. + uint8_t * p_rx_buffer; ///< Pointer to RX buffer. + uint8_t rx_length; ///< RX buffer length. +}nrf_drv_spi_xfer_desc_t; + + +/** + * @brief Macro for setting up single transfer descriptor. + * + * This macro is for internal use only. + */ +#define NRF_DRV_SPI_SINGLE_XFER(p_tx, tx_len, p_rx, rx_len) \ + { \ + .p_tx_buffer = (uint8_t const *)(p_tx), \ + .tx_length = (tx_len), \ + .p_rx_buffer = (p_rx), \ + .rx_length = (rx_len), \ + } + +/** + * @brief Macro for setting duplex TX RX transfer. + */ +#define NRF_DRV_SPI_XFER_TRX(p_tx_buf, tx_length, p_rx_buf, rx_length) \ + NRF_DRV_SPI_SINGLE_XFER(p_tx_buf, tx_length, p_rx_buf, rx_length) + +/** + * @brief Macro for setting TX transfer. + */ +#define NRF_DRV_SPI_XFER_TX(p_buf, length) \ + NRF_DRV_SPI_SINGLE_XFER(p_buf, length, NULL, 0) + +/** + * @brief Macro for setting RX transfer. + */ +#define NRF_DRV_SPI_XFER_RX(p_buf, length) \ + NRF_DRV_SPI_SINGLE_XFER(NULL, 0, p_buf, length) + +/** + * @brief SPI master driver event types, passed to the handler routine provided + * during initialization. + */ +typedef enum +{ + NRF_DRV_SPI_EVENT_DONE, ///< Transfer done. +} nrf_drv_spi_evt_type_t; + +typedef struct +{ + nrf_drv_spi_evt_type_t type; ///< Event type. + union + { + nrf_drv_spi_xfer_desc_t done; ///< Event data for DONE event. + } data; +} nrf_drv_spi_evt_t; + +/** + * @brief SPI master driver event handler type. + */ +typedef void (*nrf_drv_spi_handler_t)(nrf_drv_spi_evt_t const * p_event); + + +/** + * @brief Function for initializing the SPI master driver instance. + * + * This function configures and enables the specified peripheral. + * + * @param[in] p_instance Pointer to the instance structure. + * @param[in] p_config Pointer to the structure with the initial configuration. + * If NULL, the default configuration is used. + * @param handler Event handler provided by the user. If NULL, transfers + * will be performed in blocking mode. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver was already initialized. + * @retval NRF_ERROR_BUSY If some other peripheral with the same + * instance ID is already in use. This is + * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED + * is set to a value other than zero. + */ +ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance, + nrf_drv_spi_config_t const * p_config, + nrf_drv_spi_handler_t handler); + +/** + * @brief Function for uninitializing the SPI master driver instance. + * + * @param[in] p_instance Pointer to the instance structure. + */ +void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance); + +/** + * @brief Function for starting the SPI data transfer. + * + * If an event handler was provided in the @ref nrf_drv_spi_init call, this function + * returns immediately and the handler is called when the transfer is done. + * Otherwise, the transfer is performed in blocking mode, which means that this function + * returns when the transfer is finished. + * + * @note Peripherals using EasyDMA (for example, SPIM) require the transfer buffers + * to be placed in the Data RAM region. If they are not and an SPIM instance is + * used, this function will fail with the error code NRF_ERROR_INVALID_ADDR. + * + * @param[in] p_instance Pointer to the instance structure. + * @param[in] p_tx_buffer Pointer to the transmit buffer. Can be NULL + * if there is nothing to send. + * @param tx_buffer_length Length of the transmit buffer. + * @param[in] p_rx_buffer Pointer to the receive buffer. Can be NULL + * if there is nothing to receive. + * @param rx_buffer_length Length of the receive buffer. + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_BUSY If a previously started transfer has not finished + * yet. + * @retval NRF_ERROR_INVALID_ADDR If the provided buffers are not placed in the Data + * RAM region. + */ +ret_code_t nrf_drv_spi_transfer(nrf_drv_spi_t const * const p_instance, + uint8_t const * p_tx_buffer, + uint8_t tx_buffer_length, + uint8_t * p_rx_buffer, + uint8_t rx_buffer_length); + + +/** + * @brief Function for starting the SPI data transfer with additional option flags. + * + * Function enables customizing the transfer by using option flags. + * + * Additional options are provided using the flags parameter: + * + * - @ref NRF_DRV_SPI_FLAG_TX_POSTINC and @ref NRF_DRV_SPI_FLAG_RX_POSTINC: + * Post-incrementation of buffer addresses. Supported only by SPIM. + * - @ref NRF_DRV_SPI_FLAG_HOLD_XFER: Driver is not starting the transfer. Use this + * flag if the transfer is triggered externally by PPI. Supported only by SPIM. Use + * @ref nrf_drv_twi_start_task_get to get the address of the start task. + * - @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER: No user event handler after transfer + * completion. This also means no interrupt at the end of the transfer. Supported only by SPIM. + * If @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER is used, the driver does not set the instance into + * busy state, so you must ensure that the next transfers are set up when SPIM is not active. + * @ref nrf_drv_spi_end_event_get function can be used to detect end of transfer. Option can be used + * together with @ref NRF_DRV_SPI_FLAG_REPEATED_XFER to prepare a sequence of SPI transfers + * without interruptions. + * - @ref NRF_DRV_SPI_FLAG_REPEATED_XFER: Prepare for repeated transfers. You can set + * up a number of transfers that will be triggered externally (for example by PPI). An example is + * a TXRX transfer with the options @ref NRF_DRV_SPI_FLAG_RX_POSTINC, + * @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER, and @ref NRF_DRV_SPI_FLAG_REPEATED_XFER. After the + * transfer is set up, a set of transfers can be triggered by PPI that will read, for example, + * the same register of an external component and put it into a RAM buffer without any interrupts. + * @ref nrf_drv_spi_end_event_get can be used to get the address of the END event, which can be + * used to count the number of transfers. If @ref NRF_DRV_SPI_FLAG_REPEATED_XFER is used, + * the driver does not set the instance into busy state, so you must ensure that the next + * transfers are set up when SPIM is not active. Supported only by SPIM. + * @note Function is intended to be used only in non-blocking mode. + * + * @param p_instance SPI instance. + * @param p_xfer_desc Pointer to the transfer descriptor. + * @param flags Transfer options (0 for default settings). + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. + * @retval NRF_ERROR_NOT_SUPPORTED If the provided parameters are not supported. + * @retval NRF_ERROR_INVALID_ADDR If the provided buffers are not placed in the Data + * RAM region. + */ +ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t const * const p_instance, + nrf_drv_spi_xfer_desc_t const * p_xfer_desc, + uint32_t flags); + +/** + * @brief Function for returning the address of a SPIM start task. + * + * This function should be used if @ref nrf_drv_spi_xfer was called with the flag @ref NRF_DRV_SPI_FLAG_HOLD_XFER. + * In that case, the transfer is not started by the driver, but it must be started externally by PPI. + * + * @param[in] p_instance SPI instance. + * + * @return Start task address. + */ +uint32_t nrf_drv_spi_start_task_get(nrf_drv_spi_t const * p_instance); + +/** + * @brief Function for returning the address of a END SPIM event. + * + * A END event can be used to detect the end of a transfer if the @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER + * option is used. + * + * @param[in] p_instance SPI instance. + * + * @return END event address. + */ +uint32_t nrf_drv_spi_end_event_get(nrf_drv_spi_t const * p_instance); + +void nrf_drv_spi_abort(nrf_drv_spi_t const * p_instance); + +#endif // NRF_DRV_SPI_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.c new file mode 100644 index 0000000000..75d261b69f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.c @@ -0,0 +1,423 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "nrf_drv_spis.h" +#include +#include +#include "nrf.h" +#include "nrf_gpio.h" +#include "app_error.h" +#include "app_util_platform.h" +#include "nrf_drv_config.h" +#include "nrf_drv_common.h" +#include "nordic_common.h" +#include "sdk_common.h" +#include "nrf_assert.h" + +#if !SPIS_COUNT + #warning No SPIS instances enabled. +#else + +/**@brief States of the SPI transaction state machine. */ +typedef enum +{ + SPIS_STATE_INIT, /**< Initialization state. In this state the module waits for a call to @ref spi_slave_buffers_set. */ + SPIS_BUFFER_RESOURCE_REQUESTED, /**< State where the configuration of the memory buffers, which are to be used in SPI transaction, has started. */ + SPIS_BUFFER_RESOURCE_CONFIGURED, /**< State where the configuration of the memory buffers, which are to be used in SPI transaction, has completed. */ + SPIS_XFER_COMPLETED /**< State where SPI transaction has been completed. */ +} nrf_drv_spis_state_t; + + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n + #define IRQ_HANDLER(n) static void IRQ_HANDLER_NAME(n)(void) + + #if SPIS0_ENABLED + IRQ_HANDLER(0); + #endif + #if SPIS1_ENABLED + IRQ_HANDLER(1); + #endif + #if SPIS2_ENABLED + IRQ_HANDLER(2); + #endif + static nrf_drv_irq_handler_t const m_irq_handlers[SPIS_COUNT] = { + #if SPIS0_ENABLED + IRQ_HANDLER_NAME(0), + #endif + #if SPIS1_ENABLED + IRQ_HANDLER_NAME(1), + #endif + #if SPIS2_ENABLED + IRQ_HANDLER_NAME(2), + #endif + }; +#else + #define IRQ_HANDLER(n) void SPIS##n##_IRQ_HANDLER(void) +#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED + +#define SPIS_IRQHANDLER_TEMPLATE(NUM) \ + IRQ_HANDLER(NUM) \ + { \ + spis_irq_handler(NRF_SPIS##NUM, &m_cb[SPIS##NUM##_INSTANCE_INDEX]); \ + } + + +/**@brief SPIS control block - driver instance local data. */ +typedef struct +{ + volatile uint32_t tx_buffer_size; //!< SPI slave TX buffer size in bytes. + volatile uint32_t rx_buffer_size; //!< SPI slave RX buffer size in bytes. + nrf_drv_spis_event_handler_t handler; //!< SPI event handler. + volatile const uint8_t * tx_buffer; //!< SPI slave TX buffer. + volatile uint8_t * rx_buffer; //!< SPI slave RX buffer. + nrf_drv_state_t state; //!< driver initialization state. + volatile nrf_drv_spis_state_t spi_state; //!< SPI slave state. +} spis_cb_t; + +static spis_cb_t m_cb[SPIS_COUNT]; + +static nrf_drv_spis_config_t const m_default_config[SPIS_COUNT] = { +#if SPIS0_ENABLED + NRF_DRV_SPIS_DEFAULT_CONFIG(0), +#endif +#if SPIS1_ENABLED + NRF_DRV_SPIS_DEFAULT_CONFIG(1), +#endif +#if SPIS2_ENABLED + NRF_DRV_SPIS_DEFAULT_CONFIG(2), +#endif +}; + + +ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance, + nrf_drv_spis_config_t const * p_config, + nrf_drv_spis_event_handler_t event_handler) +{ + spis_cb_t * p_cb = &m_cb[p_instance->instance_id]; + + NRF_SPIS_Type * p_spis = p_instance->p_reg; + + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + if (p_config == NULL) + { + p_config = &m_default_config[p_instance->instance_id]; + } + if ((uint32_t)p_config->mode > (uint32_t)NRF_DRV_SPIS_MODE_3) + { + return NRF_ERROR_INVALID_PARAM; + } + if (!event_handler) + { + return NRF_ERROR_NULL; + } +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + if (nrf_drv_common_per_res_acquire(p_spis, + m_irq_handlers[p_instance->instance_id]) != NRF_SUCCESS) + { + return NRF_ERROR_BUSY; + } +#endif + + // Configure the SPI pins for input. + uint32_t mosi_pin; + uint32_t miso_pin; + + if (p_config->miso_pin != NRF_DRV_SPIS_PIN_NOT_USED) + { + nrf_gpio_cfg(p_config->miso_pin, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + NRF_GPIO_PIN_NOPULL, + p_config->miso_drive, + NRF_GPIO_PIN_NOSENSE); + miso_pin = p_config->miso_pin; + } + else + { + miso_pin = NRF_SPIS_PIN_NOT_CONNECTED; + } + + if (p_config->mosi_pin != NRF_DRV_SPIS_PIN_NOT_USED) + { + nrf_gpio_cfg(p_config->mosi_pin, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); + mosi_pin = p_config->mosi_pin; + } + else + { + mosi_pin = NRF_SPIS_PIN_NOT_CONNECTED; + } + + nrf_gpio_cfg(p_config->csn_pin, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + p_config->csn_pullup, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); + + nrf_gpio_cfg(p_config->sck_pin, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); + + nrf_spis_pins_set(p_spis, p_config->sck_pin, mosi_pin, miso_pin, p_config->csn_pin); + + nrf_spis_rx_buffer_set(p_spis, NULL, 0); + nrf_spis_tx_buffer_set(p_spis, NULL, 0); + + // Configure SPI mode. + nrf_spis_configure(p_spis, (nrf_spis_mode_t) p_config->mode, + (nrf_spis_bit_order_t) p_config->bit_order); + + // Configure DEF and ORC characters. + nrf_spis_def_set(p_spis, p_config->def); + nrf_spis_orc_set(p_spis, p_config->orc); + + // Clear possible pending events. + nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_END); + nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_ACQUIRED); + + // Enable END_ACQUIRE shortcut. + nrf_spis_shorts_enable(p_spis, NRF_SPIS_SHORT_END_ACQUIRE); + + m_cb[p_instance->instance_id].spi_state = SPIS_STATE_INIT; + m_cb[p_instance->instance_id].handler = event_handler; + + + // Enable IRQ. + nrf_spis_int_enable(p_spis, NRF_SPIS_INT_ACQUIRED_MASK | NRF_SPIS_INT_END_MASK); + nrf_drv_common_irq_enable(p_instance->irq, p_config->irq_priority); + + p_cb->state = NRF_DRV_STATE_INITIALIZED; + + // Enable SPI slave device. + nrf_spis_enable(p_spis); + + return NRF_SUCCESS; +} + + +void nrf_drv_spis_uninit(nrf_drv_spis_t const * const p_instance) +{ + spis_cb_t * p_cb = &m_cb[p_instance->instance_id]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + NRF_SPIS_Type * p_spis = p_instance->p_reg; + + #define DISABLE_ALL 0xFFFFFFFF + nrf_spis_disable(p_spis); + nrf_drv_common_irq_disable(p_instance->irq); + nrf_spis_int_disable(p_spis, DISABLE_ALL); + #undef DISABLE_ALL + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + nrf_drv_common_per_res_release(p_spis); +#endif + + p_cb->state = NRF_DRV_STATE_UNINITIALIZED; +} + + +/**@brief Function for executing the state entry action. */ +static void spis_state_entry_action_execute(NRF_SPIS_Type * p_spis, + spis_cb_t * p_cb) +{ + nrf_drv_spis_event_t event; + + switch (p_cb->spi_state) + { + case SPIS_BUFFER_RESOURCE_REQUESTED: + nrf_spis_task_trigger(p_spis, NRF_SPIS_TASK_ACQUIRE); + break; + + case SPIS_BUFFER_RESOURCE_CONFIGURED: + event.evt_type = NRF_DRV_SPIS_BUFFERS_SET_DONE; + event.rx_amount = 0; + event.tx_amount = 0; + + APP_ERROR_CHECK_BOOL(p_cb->handler != NULL); + p_cb->handler(event); + break; + + case SPIS_XFER_COMPLETED: + event.evt_type = NRF_DRV_SPIS_XFER_DONE; + event.rx_amount = nrf_spis_rx_amount_get(p_spis); + event.tx_amount = nrf_spis_tx_amount_get(p_spis); + APP_ERROR_CHECK_BOOL(p_cb->handler != NULL); + p_cb->handler(event); + break; + + default: + // No implementation required. + break; + } +} + +/**@brief Function for changing the state of the SPI state machine. + * + * @param[in] p_spis SPIS instance register. + * @param[in] p_cb SPIS instance control block. + * @param[in] new_state State where the state machine transits to. + */ +static void spis_state_change(NRF_SPIS_Type * p_spis, + spis_cb_t * p_cb, + nrf_drv_spis_state_t new_state) +{ + p_cb->spi_state = new_state; + spis_state_entry_action_execute(p_spis, p_cb); +} + + +ret_code_t nrf_drv_spis_buffers_set(nrf_drv_spis_t const * const p_instance, + const uint8_t * p_tx_buffer, + uint8_t tx_buffer_length, + uint8_t * p_rx_buffer, + uint8_t rx_buffer_length) +{ + spis_cb_t * p_cb = &m_cb[p_instance->instance_id]; + uint32_t err_code; + + VERIFY_PARAM_NOT_NULL(p_rx_buffer); + VERIFY_PARAM_NOT_NULL(p_tx_buffer); + + // EasyDMA requires that transfer buffers are placed in Data RAM region; + // signal error if they are not. + if ((p_tx_buffer != NULL && !nrf_drv_is_in_RAM(p_tx_buffer)) || + (p_rx_buffer != NULL && !nrf_drv_is_in_RAM(p_rx_buffer))) + { + return NRF_ERROR_INVALID_ADDR; + } + + switch (p_cb->spi_state) + { + case SPIS_STATE_INIT: + case SPIS_XFER_COMPLETED: + case SPIS_BUFFER_RESOURCE_CONFIGURED: + p_cb->tx_buffer = p_tx_buffer; + p_cb->rx_buffer = p_rx_buffer; + p_cb->tx_buffer_size = tx_buffer_length; + p_cb->rx_buffer_size = rx_buffer_length; + err_code = NRF_SUCCESS; + + spis_state_change(p_instance->p_reg, p_cb, SPIS_BUFFER_RESOURCE_REQUESTED); + break; + + case SPIS_BUFFER_RESOURCE_REQUESTED: + err_code = NRF_ERROR_INVALID_STATE; + break; + + default: + // @note: execution of this code path would imply internal error in the design. + err_code = NRF_ERROR_INTERNAL; + break; + } + + return err_code; +} + +static void spis_irq_handler(NRF_SPIS_Type * p_spis, spis_cb_t * p_cb) +{ + // @note: as multiple events can be pending for processing, the correct event processing order + // is as follows: + // - SPI semaphore acquired event. + // - SPI transaction complete event. + + // Check for SPI semaphore acquired event. + if (nrf_spis_event_check(p_spis, NRF_SPIS_EVENT_ACQUIRED)) + { + nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_ACQUIRED); + + switch (p_cb->spi_state) + { + case SPIS_BUFFER_RESOURCE_REQUESTED: + nrf_spis_tx_buffer_set(p_spis, (uint8_t *)p_cb->tx_buffer, p_cb->tx_buffer_size); + nrf_spis_rx_buffer_set(p_spis, (uint8_t *)p_cb->rx_buffer, p_cb->rx_buffer_size); + + nrf_spis_task_trigger(p_spis, NRF_SPIS_TASK_RELEASE); + + spis_state_change(p_spis, p_cb, SPIS_BUFFER_RESOURCE_CONFIGURED); + break; + + default: + // No implementation required. + break; + } + } + + // Check for SPI transaction complete event. + if (nrf_spis_event_check(p_spis, NRF_SPIS_EVENT_END)) + { + nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_END); + + switch (p_cb->spi_state) + { + case SPIS_BUFFER_RESOURCE_CONFIGURED: + spis_state_change(p_spis, p_cb, SPIS_XFER_COMPLETED); + break; + + default: + // No implementation required. + break; + } + } +} + +#if SPIS0_ENABLED + SPIS_IRQHANDLER_TEMPLATE(0) +#endif + +#if SPIS1_ENABLED + SPIS_IRQHANDLER_TEMPLATE(1) +#endif + +#if SPIS2_ENABLED + SPIS_IRQHANDLER_TEMPLATE(2) +#endif + +#endif // SPI_COUNT > 0 diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.h new file mode 100644 index 0000000000..a761f66717 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.h @@ -0,0 +1,250 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * @defgroup nrf_spis SPI slave HAL and driver + * @ingroup nrf_spi + * @brief SPI slave API. + * @details The SPIS HAL provides basic APIs for accessing the registers + * of the SPIS. The SPIS driver provides APIs on a higher level. + **/ + +#ifndef SPI_SLAVE_H__ +#define SPI_SLAVE_H__ + +#include +#include "nrf.h" +#include "nrf_error.h" +#include "nrf_drv_config.h" +#include "nrf_spis.h" +#include "nrf_gpio.h" +#include "sdk_common.h" +#include "app_util_platform.h" + +#if defined(NRF52) + #define SPIS2_IRQ SPIM2_SPIS2_SPI2_IRQn + #define SPIS2_IRQ_HANDLER SPIM2_SPIS2_SPI2_IRQHandler + #define SPIS0_IRQ SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn + #define SPIS0_IRQ_HANDLER SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler + #define SPIS1_IRQ SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn + #define SPIS1_IRQ_HANDLER SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler +#else + #define SPIS0_IRQ SPI0_TWI0_IRQn + #define SPIS0_IRQ_HANDLER SPI0_TWI0_IRQHandler + #define SPIS1_IRQ SPI1_TWI1_IRQn + #define SPIS1_IRQ_HANDLER SPI1_TWI1_IRQHandler +#endif + +/** + * @defgroup nrf_drv_spi_slave SPI slave driver + * @{ + * @ingroup nrf_spis + * + * @brief Multi-instance SPI slave driver. + */ + +#define NRF_DRV_SPIS_DEFAULT_CSN_PULLUP NRF_GPIO_PIN_NOPULL /**< Default pull-up configuration of the SPI CS. */ +#define NRF_DRV_SPIS_DEFAULT_MISO_DRIVE NRF_GPIO_PIN_S0S1 /**< Default drive configuration of the SPI MISO. */ +#define NRF_DRV_SPIS_DEFAULT_DEF 0xFF /**< Default DEF character. */ +#define NRF_DRV_SPIS_DEFAULT_ORC 0xFF /**< Default ORC character. */ + +/** +* @brief This value can be provided instead of a pin number for the signals MOSI +* and MISO to specify that the given signal is not used and therefore +* does not need to be connected to a pin. +*/ +#define NRF_DRV_SPIS_PIN_NOT_USED 0xFF + +/** @brief SPIS transaction bit order definitions. */ +typedef enum +{ + NRF_DRV_SPIS_BIT_ORDER_LSB_FIRST = NRF_SPIS_BIT_ORDER_LSB_FIRST, /**< Least significant bit shifted out first. */ + NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST = NRF_SPIS_BIT_ORDER_MSB_FIRST /**< Most significant bit shifted out first. */ +} nrf_drv_spis_endian_t; + +/** @brief SPIS mode definitions for clock polarity and phase. */ +typedef enum +{ + NRF_DRV_SPIS_MODE_0 = NRF_SPIS_MODE_0, /**< (CPOL = 0, CPHA = 0). */ + NRF_DRV_SPIS_MODE_1 = NRF_SPIS_MODE_1, /**< (CPOL = 0, CPHA = 1). */ + NRF_DRV_SPIS_MODE_2 = NRF_SPIS_MODE_2, /**< (CPOL = 1, CPHA = 0). */ + NRF_DRV_SPIS_MODE_3 = NRF_SPIS_MODE_3 /**< (CPOL = 1, CPHA = 1). */ +} nrf_drv_spis_mode_t; + +/** @brief Event callback function event definitions. */ +typedef enum +{ + NRF_DRV_SPIS_BUFFERS_SET_DONE, /**< Memory buffer set event. Memory buffers have been set successfully to the SPI slave device, and SPI transactions can be done. */ + NRF_DRV_SPIS_XFER_DONE, /**< SPI transaction event. SPI transaction has been completed. */ + NRF_DRV_SPIS_EVT_TYPE_MAX /**< Enumeration upper bound. */ +} nrf_drv_spis_event_type_t; + +/** @brief Structure containing the event context from the SPI slave driver. */ +typedef struct +{ + nrf_drv_spis_event_type_t evt_type; //!< Type of event. + uint32_t rx_amount; //!< Number of bytes received in last transaction. This parameter is only valid for @ref NRF_DRV_SPIS_XFER_DONE events. + uint32_t tx_amount; //!< Number of bytes transmitted in last transaction. This parameter is only valid for @ref NRF_DRV_SPIS_XFER_DONE events. +} nrf_drv_spis_event_t; + +/** @brief SPI slave driver instance data structure. */ +typedef struct +{ + NRF_SPIS_Type * p_reg; //!< SPIS instance register. + uint8_t instance_id; //!< SPIS instance ID. + IRQn_Type irq; //!< IRQ of the specific instance. +} nrf_drv_spis_t; + +/** @brief Macro for creating an SPI slave driver instance. */ +#define NRF_DRV_SPIS_INSTANCE(id) \ +{ \ + .p_reg = CONCAT_2(NRF_SPIS, id), \ + .irq = CONCAT_3(SPIS, id, _IRQ), \ + .instance_id = CONCAT_3(SPIS, id, _INSTANCE_INDEX), \ +} + +/** @brief SPI slave instance default configuration. */ +#define NRF_DRV_SPIS_DEFAULT_CONFIG(id) \ +{ \ + .sck_pin = CONCAT_3(SPIS, id, _CONFIG_SCK_PIN), \ + .mosi_pin = CONCAT_3(SPIS, id, _CONFIG_MOSI_PIN), \ + .miso_pin = CONCAT_3(SPIS, id, _CONFIG_MISO_PIN), \ + .csn_pin = NRF_DRV_SPIS_PIN_NOT_USED, \ + .miso_drive = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE, \ + .csn_pullup = NRF_DRV_SPIS_DEFAULT_CSN_PULLUP, \ + .orc = NRF_DRV_SPIS_DEFAULT_ORC, \ + .def = NRF_DRV_SPIS_DEFAULT_DEF, \ + .mode = NRF_DRV_SPIS_MODE_0, \ + .bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST, \ + .irq_priority = CONCAT_3(SPIS, id, _CONFIG_IRQ_PRIORITY), \ +} + +/** @brief SPI peripheral device configuration data. */ +typedef struct +{ + uint32_t miso_pin; //!< SPI MISO pin (optional). + /**< Set @ref NRF_DRV_SPIS_PIN_NOT_USED + * if this signal is not needed. */ + uint32_t mosi_pin; //!< SPI MOSI pin (optional). + /**< Set @ref NRF_DRV_SPIS_PIN_NOT_USED + * if this signal is not needed. */ + uint32_t sck_pin; //!< SPI SCK pin. + uint32_t csn_pin; //!< SPI CSN pin. + nrf_drv_spis_mode_t mode; //!< SPI mode. + nrf_drv_spis_endian_t bit_order; //!< SPI transaction bit order. + nrf_gpio_pin_pull_t csn_pullup; //!< CSN pin pull-up configuration. + nrf_gpio_pin_drive_t miso_drive; //!< MISO pin drive configuration. + uint8_t def; //!< Character clocked out in case of an ignored transaction. + uint8_t orc; //!< Character clocked out after an over-read of the transmit buffer. + uint8_t irq_priority; //!< Interrupt priority. +} nrf_drv_spis_config_t; + + +/** @brief SPI slave event callback function type. + * + * @param[in] event SPI slave driver event. + */ +typedef void (*nrf_drv_spis_event_handler_t)(nrf_drv_spis_event_t event); + +/** @brief Function for initializing the SPI slave driver instance. + * + * @param[in] p_instance Pointer to the instance structure. + * @param[in] p_config Pointer to the structure with the initial configuration. + * If NULL, the default configuration will be used. + * @param[in] event_handler Function to be called by the SPI slave driver upon event. + * + * @retval NRF_SUCCESS If the initialization was successful. + * @retval NRF_ERROR_INVALID_PARAM If an invalid parameter is supplied. + * @retval NRF_ERROR_BUSY If some other peripheral with the same + * instance ID is already in use. This is + * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED + * is set to a value other than zero. + */ +ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance, + nrf_drv_spis_config_t const * p_config, + nrf_drv_spis_event_handler_t event_handler); + +/** + * @brief Function for uninitializing the SPI slave driver instance. + * + * @param[in] p_instance Pointer to the instance structure. + */ +void nrf_drv_spis_uninit(nrf_drv_spis_t const * const p_instance); + +/** @brief Function for preparing the SPI slave instance for a single SPI transaction. + * + * This function prepares the SPI slave device to be ready for a single SPI transaction. It configures + * the SPI slave device to use the memory supplied with the function call in SPI transactions. + * + * When either the memory buffer configuration or the SPI transaction has been + * completed, the event callback function will be called with the appropriate event + * @ref nrf_drv_spis_event_type_t. Note that the callback function can be called before returning from + * this function, because it is called from the SPI slave interrupt context. + * + * @note This function can be called from the callback function context. + * + * @note Client applications must call this function after every @ref NRF_DRV_SPIS_XFER_DONE event if + * the SPI slave driver should be prepared for a possible new SPI transaction. + * + * @note Peripherals that are using EasyDMA (for example, SPIS) require the transfer buffers + * to be placed in the Data RAM region. Otherwise, this function will fail + * with the error code NRF_ERROR_INVALID_ADDR. + * + * @param[in] p_instance SPIS instance. + * @param[in] p_tx_buffer Pointer to the TX buffer. + * @param[in] p_rx_buffer Pointer to the RX buffer. + * @param[in] tx_buffer_length Length of the TX buffer in bytes. + * @param[in] rx_buffer_length Length of the RX buffer in bytes. + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_NULL If the operation failed because a NULL pointer was supplied. + * @retval NRF_ERROR_INVALID_STATE If the operation failed because the SPI slave device is in an incorrect state. + * @retval NRF_ERROR_INVALID_ADDR If the provided buffers are not placed in the Data + * RAM region. + * @retval NRF_ERROR_INTERNAL If the operation failed because of an internal error. + */ +ret_code_t nrf_drv_spis_buffers_set(nrf_drv_spis_t const * const p_instance, + const uint8_t * p_tx_buffer, + uint8_t tx_buffer_length, + uint8_t * p_rx_buffer, + uint8_t rx_buffer_length); + +#endif // SPI_SLAVE_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.c new file mode 100644 index 0000000000..2ffdd36d6c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.c @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "nrf_drv_timer.h" +#include "nrf_drv_common.h" +#include "app_util_platform.h" + +#if (TIMER_COUNT == 0) + #error "No TIMER instances enabled in the driver configuration file." +#endif + + +/**@brief Timer control block. */ +typedef struct +{ + nrf_timer_event_handler_t handler; + void * context; + nrf_drv_state_t state; +} timer_control_block_t; + +static timer_control_block_t m_cb[TIMER_COUNT]; + +static const nrf_drv_timer_config_t m_default_config[TIMER_COUNT] = { +#if TIMER0_ENABLED + NRF_DRV_TIMER_DEFAULT_CONFIG(0), +#endif +#if TIMER1_ENABLED + NRF_DRV_TIMER_DEFAULT_CONFIG(1), +#endif +#if TIMER2_ENABLED + NRF_DRV_TIMER_DEFAULT_CONFIG(2), +#endif +#if TIMER3_ENABLED + NRF_DRV_TIMER_DEFAULT_CONFIG(3), +#endif +#if TIMER4_ENABLED + NRF_DRV_TIMER_DEFAULT_CONFIG(4), +#endif +}; + + +ret_code_t nrf_drv_timer_init(nrf_drv_timer_t const * const p_instance, + nrf_drv_timer_config_t const * p_config, + nrf_timer_event_handler_t timer_event_handler) +{ + timer_control_block_t * p_cb = &m_cb[p_instance->instance_id]; + +#ifdef SOFTDEVICE_PRESENT + ASSERT(p_instance->p_reg != NRF_TIMER0); +#endif + ASSERT(NRF_TIMER_IS_BIT_WIDTH_VALID(p_instance->p_reg, p_config->bit_width)); + + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + if (timer_event_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_config == NULL) + { + p_config = &m_default_config[p_instance->instance_id]; + } + + p_cb->handler = timer_event_handler; + p_cb->context = p_config->p_context; + + uint8_t i; + for (i = 0; i < p_instance->cc_channel_count; ++i) + { + nrf_timer_event_clear(p_instance->p_reg, + nrf_timer_compare_event_get(i)); + } + + nrf_drv_common_irq_enable(nrf_drv_get_IRQn(p_instance->p_reg), + p_config->interrupt_priority); + + nrf_timer_mode_set(p_instance->p_reg, p_config->mode); + nrf_timer_bit_width_set(p_instance->p_reg, p_config->bit_width); + nrf_timer_frequency_set(p_instance->p_reg, p_config->frequency); + + p_cb->state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + +void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance) +{ + nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_instance->p_reg)); + + #define DISABLE_ALL UINT32_MAX + nrf_timer_shorts_disable(p_instance->p_reg, DISABLE_ALL); + nrf_timer_int_disable(p_instance->p_reg, DISABLE_ALL); + #undef DISABLE_ALL + + nrf_drv_timer_disable(p_instance); + + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED; +} + +void nrf_drv_timer_enable(nrf_drv_timer_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_INITIALIZED); + nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_START); + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_POWERED_ON; +} + +void nrf_drv_timer_disable(nrf_drv_timer_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); + nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_SHUTDOWN); + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED; +} + +void nrf_drv_timer_resume(nrf_drv_timer_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); + nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_START); +} + +void nrf_drv_timer_pause(nrf_drv_timer_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); + nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_STOP); +} + +void nrf_drv_timer_clear(nrf_drv_timer_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_CLEAR); +} + +void nrf_drv_timer_increment(nrf_drv_timer_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); + ASSERT(nrf_timer_mode_get(p_instance->p_reg) != NRF_TIMER_MODE_TIMER); + + nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_COUNT); +} + +uint32_t nrf_drv_timer_capture(nrf_drv_timer_t const * const p_instance, + nrf_timer_cc_channel_t cc_channel) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); + ASSERT(cc_channel < p_instance->cc_channel_count); + + nrf_timer_task_trigger(p_instance->p_reg, + nrf_timer_capture_task_get(cc_channel)); + return nrf_timer_cc_read(p_instance->p_reg, cc_channel); +} + +void nrf_drv_timer_compare(nrf_drv_timer_t const * const p_instance, + nrf_timer_cc_channel_t cc_channel, + uint32_t cc_value, + bool enable_int) +{ + nrf_timer_int_mask_t timer_int = nrf_timer_compare_int_get(cc_channel); + + if (enable_int) + { + nrf_timer_int_enable(p_instance->p_reg, timer_int); + } + else + { + nrf_timer_int_disable(p_instance->p_reg, timer_int); + } + + nrf_timer_cc_write(p_instance->p_reg, cc_channel, cc_value); +} + +void nrf_drv_timer_extended_compare(nrf_drv_timer_t const * const p_instance, + nrf_timer_cc_channel_t cc_channel, + uint32_t cc_value, + nrf_timer_short_mask_t timer_short_mask, + bool enable_int) +{ + nrf_timer_shorts_disable(p_instance->p_reg, + (TIMER_SHORTS_COMPARE0_STOP_Msk << cc_channel) | + (TIMER_SHORTS_COMPARE0_CLEAR_Msk << cc_channel)); + + nrf_timer_shorts_enable(p_instance->p_reg, timer_short_mask); + + (void)nrf_drv_timer_compare(p_instance, + cc_channel, + cc_value, + enable_int); +} + +void nrf_drv_timer_compare_int_enable(nrf_drv_timer_t const * const p_instance, + uint32_t channel) +{ + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(channel < p_instance->cc_channel_count); + + nrf_timer_event_clear(p_instance->p_reg, + nrf_timer_compare_event_get(channel)); + nrf_timer_int_enable(p_instance->p_reg, + nrf_timer_compare_int_get(channel)); +} + +void nrf_drv_timer_compare_int_disable(nrf_drv_timer_t const * const p_instance, + uint32_t channel) +{ + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(channel < p_instance->cc_channel_count); + + nrf_timer_int_disable(p_instance->p_reg, + nrf_timer_compare_int_get(channel)); +} + +static void irq_handler(NRF_TIMER_Type * p_reg, + timer_control_block_t * p_cb, + uint8_t channel_count) +{ + uint8_t i; + for (i = 0; i < channel_count; ++i) + { + nrf_timer_event_t event = nrf_timer_compare_event_get(i); + nrf_timer_int_mask_t int_mask = nrf_timer_compare_int_get(i); + + if (nrf_timer_event_check(p_reg, event) && + nrf_timer_int_enable_check(p_reg, int_mask)) + { + nrf_timer_event_clear(p_reg, event); + p_cb->handler(event, p_cb->context); + } + } +} + +#if TIMER0_ENABLED +void TIMER0_IRQHandler(void) +{ + irq_handler(NRF_TIMER0, &m_cb[TIMER0_INSTANCE_INDEX], + NRF_TIMER_CC_CHANNEL_COUNT(0)); +} +#endif + +#if TIMER1_ENABLED +void TIMER1_IRQHandler(void) +{ + irq_handler(NRF_TIMER1, &m_cb[TIMER1_INSTANCE_INDEX], + NRF_TIMER_CC_CHANNEL_COUNT(1)); +} +#endif + +#if TIMER2_ENABLED +void TIMER2_IRQHandler(void) +{ + irq_handler(NRF_TIMER2, &m_cb[TIMER2_INSTANCE_INDEX], + NRF_TIMER_CC_CHANNEL_COUNT(2)); +} +#endif + +#if TIMER3_ENABLED +void TIMER3_IRQHandler(void) +{ + irq_handler(NRF_TIMER3, &m_cb[TIMER3_INSTANCE_INDEX], + NRF_TIMER_CC_CHANNEL_COUNT(3)); +} +#endif + +#if TIMER4_ENABLED +void TIMER4_IRQHandler(void) +{ + irq_handler(NRF_TIMER4, &m_cb[TIMER4_INSTANCE_INDEX], + NRF_TIMER_CC_CHANNEL_COUNT(4)); +} +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.h new file mode 100644 index 0000000000..bc6385c84c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.h @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * @addtogroup nrf_timer Timer HAL and driver + * @ingroup nrf_drivers + * @brief Timer APIs. + * @details The timer HAL provides basic APIs for accessing the registers + * of the timer. The timer driver provides APIs on a higher level. + * + * @defgroup lib_driver_timer Timer driver + * @{ + * @ingroup nrf_timer + * @brief Multi-instance timer driver. + */ + +#ifndef NRF_DRV_TIMER_H__ +#define NRF_DRV_TIMER_H__ + +#include "nordic_common.h" +#include "nrf_drv_config.h" +#include "nrf_timer.h" +#include "sdk_errors.h" +#include "nrf_assert.h" + +/** + * @brief Timer driver instance data structure. + */ +typedef struct +{ + NRF_TIMER_Type * p_reg; ///< Pointer to the structure with TIMER peripheral instance registers. + uint8_t instance_id; ///< Driver instance index. + uint8_t cc_channel_count; ///< Number of capture/compare channels. +} nrf_drv_timer_t; + +/** + * @brief Macro for creating a timer driver instance. + */ +#define NRF_DRV_TIMER_INSTANCE(id) \ +{ \ + .p_reg = CONCAT_2(NRF_TIMER, id), \ + .instance_id = CONCAT_3(TIMER, id, _INSTANCE_INDEX), \ + .cc_channel_count = NRF_TIMER_CC_CHANNEL_COUNT(id), \ +} + +/** + * @brief Timer driver instance configuration structure. + */ +typedef struct +{ + nrf_timer_frequency_t frequency; ///< Frequency. + nrf_timer_mode_t mode; ///< Mode of operation. + nrf_timer_bit_width_t bit_width; ///< Bit width. + uint8_t interrupt_priority; ///< Interrupt priority. + void * p_context; ///< Context passed to interrupt handler. +} nrf_drv_timer_config_t; + +#define TIMER_CONFIG_FREQUENCY(id) CONCAT_3(TIMER, id, _CONFIG_FREQUENCY) +#define TIMER_CONFIG_MODE(id) CONCAT_3(TIMER, id, _CONFIG_MODE) +#define TIMER_CONFIG_BIT_WIDTH(id) CONCAT_3(TIMER, id, _CONFIG_BIT_WIDTH) +#define TIMER_CONFIG_IRQ_PRIORITY(id) CONCAT_3(TIMER, id, _CONFIG_IRQ_PRIORITY) + +/** + * @brief Timer driver instance default configuration. + */ +#define NRF_DRV_TIMER_DEFAULT_CONFIG(id) \ +{ \ + .frequency = TIMER_CONFIG_FREQUENCY(id), \ + .mode = (nrf_timer_mode_t)TIMER_CONFIG_MODE(id), \ + .bit_width = (nrf_timer_bit_width_t)TIMER_CONFIG_BIT_WIDTH(id), \ + .interrupt_priority = TIMER_CONFIG_IRQ_PRIORITY(id), \ + .p_context = NULL \ +} + +/** + * @brief Timer driver event handler type. + * + * @param[in] event_type Timer event. + * @param[in] p_context General purpose parameter set during initialization of + * the timer. This parameter can be used to pass + * additional information to the handler function, for + * example, the timer ID. + */ +typedef void (* nrf_timer_event_handler_t)(nrf_timer_event_t event_type, + void * p_context); + +/** + * @brief Function for initializing the timer. + * + * @param[in] p_instance Timer instance. + * @param[in] p_config Initial configuration. + * If NULL, the default configuration is used. + * @param[in] timer_event_handler Event handler provided by the user. + * Must not be NULL. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the instance is already initialized. + * @retval NRF_ERROR_INVALID_PARAM If no handler was provided. + */ +ret_code_t nrf_drv_timer_init(nrf_drv_timer_t const * const p_instance, + nrf_drv_timer_config_t const * p_config, + nrf_timer_event_handler_t timer_event_handler); + +/** + * @brief Function for uninitializing the timer. + * + * @param[in] p_instance Timer instance. + */ +void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance); + +/** + * @brief Function for turning on the timer. + * + * @param[in] p_instance Timer instance. + */ +void nrf_drv_timer_enable(nrf_drv_timer_t const * const p_instance); + +/** + * @brief Function for turning off the timer. + * + * Note that the timer will allow to enter the lowest possible SYSTEM_ON state + * only after this function is called. + * + * @param[in] p_instance Timer instance. + */ +void nrf_drv_timer_disable(nrf_drv_timer_t const * const p_instance); + +/** + * @brief Function for pausing the timer. + * + * @param[in] p_instance Timer instance. + */ +void nrf_drv_timer_pause(nrf_drv_timer_t const * const p_instance); + +/** + * @brief Function for resuming the timer. + * + * @param[in] p_instance Timer instance. + */ +void nrf_drv_timer_resume(nrf_drv_timer_t const * const p_instance); + +/** + * @brief Function for clearing the timer. + * + * @param[in] p_instance Timer instance. + */ +void nrf_drv_timer_clear(nrf_drv_timer_t const * const p_instance); + +/** + * @brief Function for incrementing the timer. + * + * @param[in] p_instance Timer instance. + */ +void nrf_drv_timer_increment(nrf_drv_timer_t const * const p_instance); + +/** + * @brief Function for returning the address of a specific timer task. + * + * @param[in] p_instance Timer instance. + * @param[in] timer_task Timer task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_timer_task_address_get( + nrf_drv_timer_t const * const p_instance, + nrf_timer_task_t timer_task); + +/** + * @brief Function for returning the address of a specific timer capture task. + * + * @param[in] p_instance Timer instance. + * @param[in] channel Capture channel number. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_timer_capture_task_address_get( + nrf_drv_timer_t const * const p_instance, + uint32_t channel); + +/** + * @brief Function for returning the address of a specific timer event. + * + * @param[in] p_instance Timer instance. + * @param[in] timer_event Timer event. + * + * @return Event address. + */ +__STATIC_INLINE uint32_t nrf_drv_timer_event_address_get( + nrf_drv_timer_t const * const p_instance, + nrf_timer_event_t timer_event); + +/** + * @brief Function for returning the address of a specific timer compare event. + * + * @param[in] p_instance Timer instance. + * @param[in] channel Compare channel number. + * + * @return Event address. + */ +__STATIC_INLINE uint32_t nrf_drv_timer_compare_event_address_get( + nrf_drv_timer_t const * const p_instance, + uint32_t channel); + +/** + * @brief Function for capturing the timer value. + * + * @param[in] p_instance Timer instance. + * @param[in] cc_channel Capture channel number. + * + * @return Captured value. + */ +uint32_t nrf_drv_timer_capture(nrf_drv_timer_t const * const p_instance, + nrf_timer_cc_channel_t cc_channel); + +/** + * @brief Function for returning the capture value from a specific channel. + * + * Use this function to read channel values when PPI is used for capturing. + * + * @param[in] p_instance Timer instance. + * @param[in] cc_channel Capture channel number. + * + * @return Captured value. + */ +__STATIC_INLINE uint32_t nrf_drv_timer_capture_get( + nrf_drv_timer_t const * const p_instance, + nrf_timer_cc_channel_t cc_channel); + +/** + * @brief Function for setting the timer channel in compare mode. + * + * @param[in] p_instance Timer instance. + * @param[in] cc_channel Compare channel number. + * @param[in] cc_value Compare value. + * @param[in] enable_int Enable or disable the interrupt for the compare channel. + */ +void nrf_drv_timer_compare(nrf_drv_timer_t const * const p_instance, + nrf_timer_cc_channel_t cc_channel, + uint32_t cc_value, + bool enable_int); + +/** + * @brief Function for setting the timer channel in extended compare mode. + * + * @param[in] p_instance Timer instance. + * @param[in] cc_channel Compare channel number. + * @param[in] cc_value Compare value. + * @param[in] timer_short_mask Shortcut between the compare event on the channel + * and the timer task (STOP or CLEAR). + * @param[in] enable_int Enable or disable the interrupt for the compare + * channel. + */ +void nrf_drv_timer_extended_compare(nrf_drv_timer_t const * const p_instance, + nrf_timer_cc_channel_t cc_channel, + uint32_t cc_value, + nrf_timer_short_mask_t timer_short_mask, + bool enable_int); + +/** + * @brief Function for converting time in microseconds to timer ticks. + * + * @param[in] p_instance Timer instance. + * @param[in] time_us Time in microseconds. + * + * @return Number of ticks. + */ +__STATIC_INLINE uint32_t nrf_drv_timer_us_to_ticks( + nrf_drv_timer_t const * const p_instance, + uint32_t time_us); + +/** + * @brief Function for converting time in milliseconds to timer ticks. + * + * @param[in] p_instance Timer instance. + * @param[in] time_ms Time in milliseconds. + * + * @return Number of ticks. + */ +__STATIC_INLINE uint32_t nrf_drv_timer_ms_to_ticks( + nrf_drv_timer_t const * const p_instance, + uint32_t time_ms); + +/** + * @brief Function for enabling timer compare interrupt. + * + * @param[in] p_instance Timer instance. + * @param[in] channel Compare channel. + */ +void nrf_drv_timer_compare_int_enable(nrf_drv_timer_t const * const p_instance, + uint32_t channel); + +/** + * @brief Function for disabling timer compare interrupt. + * + * @param[in] p_instance Timer instance. + * @param[in] channel Compare channel. + */ +void nrf_drv_timer_compare_int_disable(nrf_drv_timer_t const * const p_instance, + uint32_t channel); + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE uint32_t nrf_drv_timer_task_address_get( + nrf_drv_timer_t const * const p_instance, + nrf_timer_task_t timer_task) +{ + return (uint32_t)nrf_timer_task_address_get(p_instance->p_reg, timer_task); +} + +__STATIC_INLINE uint32_t nrf_drv_timer_capture_task_address_get( + nrf_drv_timer_t const * const p_instance, + uint32_t channel) +{ + ASSERT(channel < p_instance->cc_channel_count); + return (uint32_t)nrf_timer_task_address_get(p_instance->p_reg, + nrf_timer_capture_task_get(channel)); +} + +__STATIC_INLINE uint32_t nrf_drv_timer_event_address_get( + nrf_drv_timer_t const * const p_instance, + nrf_timer_event_t timer_event) +{ + return (uint32_t)nrf_timer_event_address_get(p_instance->p_reg, timer_event); +} + +__STATIC_INLINE uint32_t nrf_drv_timer_compare_event_address_get( + nrf_drv_timer_t const * const p_instance, + uint32_t channel) +{ + ASSERT(channel < p_instance->cc_channel_count); + return (uint32_t)nrf_timer_event_address_get(p_instance->p_reg, + nrf_timer_compare_event_get(channel)); +} + +__STATIC_INLINE uint32_t nrf_drv_timer_capture_get( + nrf_drv_timer_t const * const p_instance, + nrf_timer_cc_channel_t cc_channel) +{ + return nrf_timer_cc_read(p_instance->p_reg, cc_channel); +} + +__STATIC_INLINE uint32_t nrf_drv_timer_us_to_ticks( + nrf_drv_timer_t const * const p_instance, + uint32_t timer_us) +{ + return nrf_timer_us_to_ticks(timer_us, + nrf_timer_frequency_get(p_instance->p_reg)); +} + +__STATIC_INLINE uint32_t nrf_drv_timer_ms_to_ticks( + nrf_drv_timer_t const * const p_instance, + uint32_t timer_ms) +{ + return nrf_timer_ms_to_ticks(timer_ms, + nrf_timer_frequency_get(p_instance->p_reg)); +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_DRV_TIMER_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c new file mode 100644 index 0000000000..a70c39e73d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c @@ -0,0 +1,1005 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "nrf_drv_twi.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" +#include "nrf_assert.h" +#include "app_util_platform.h" +#include "nrf_delay.h" + +#include + +#define TWI0_IRQ_HANDLER SPI0_TWI0_IRQHandler +#define TWI1_IRQ_HANDLER SPI1_TWI1_IRQHandler + +#if (defined(TWIM_IN_USE) && defined(TWI_IN_USE)) + // TWIM and TWI combined + #define CODE_FOR_TWIM(code) if (p_instance->use_easy_dma) { code } + #define CODE_FOR_TWI(code) else { code } +#elif (defined(TWIM_IN_USE) && !defined(TWI_IN_USE)) + // TWIM only + #define CODE_FOR_TWIM(code) { code } + #define CODE_FOR_TWI(code) +#elif (!defined(TWIM_IN_USE) && defined(TWI_IN_USE)) + // TWI only + #define CODE_FOR_TWIM(code) + #define CODE_FOR_TWI(code) { code } +#else + #error "Wrong configuration." +#endif + +// All interrupt flags +#define DISABLE_ALL 0xFFFFFFFF + +#define SCL_PIN_CONF ((GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \ + | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) \ + | (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) \ + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \ + | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)) + +#define SDA_PIN_CONF SCL_PIN_CONF + +#define SCL_PIN_CONF_CLR ((GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \ + | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) \ + | (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) \ + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \ + | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos)) + +#define SDA_PIN_CONF_CLR SCL_PIN_CONF_CLR + +// Control block - driver instance local data. +typedef struct +{ + nrf_drv_twi_evt_handler_t handler; + void * p_context; + volatile uint32_t int_mask; + nrf_drv_twi_xfer_desc_t xfer_desc; + uint32_t flags; + uint8_t * p_curr_buf; + uint8_t curr_length; + bool curr_no_stop; + nrf_drv_state_t state; + bool error; + volatile bool busy; + bool repeated; + uint8_t bytes_transferred; +} twi_control_block_t; + +static twi_control_block_t m_cb[TWI_COUNT]; + +static nrf_drv_twi_config_t const m_default_config[TWI_COUNT] = { +#if TWI0_ENABLED + NRF_DRV_TWI_DEFAULT_CONFIG(0), +#endif +#if TWI1_ENABLED + NRF_DRV_TWI_DEFAULT_CONFIG(1), +#endif +}; + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n + #define IRQ_HANDLER(n) static void IRQ_HANDLER_NAME(n)(void) + + #if TWI0_ENABLED + IRQ_HANDLER(0); + #endif + #if TWI1_ENABLED + IRQ_HANDLER(1); + #endif + static nrf_drv_irq_handler_t const m_irq_handlers[TWI_COUNT] = { + #if TWI0_ENABLED + IRQ_HANDLER_NAME(0), + #endif + #if TWI1_ENABLED + IRQ_HANDLER_NAME(1), + #endif + }; +#else + #define IRQ_HANDLER(n) void SPI##n##_TWI##n##_IRQHandler(void) +#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED + +static void twi_clear_bus(nrf_drv_twi_t const * const p_instance, + nrf_drv_twi_config_t const * p_config) +{ + NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF; + NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF; + + nrf_gpio_pin_set(p_config->scl); + nrf_gpio_pin_set(p_config->sda); + + NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF_CLR; + NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF_CLR; + + nrf_delay_us(4); + + for(int i = 0; i < 9; i++) + { + if (nrf_gpio_pin_read(p_config->sda)) + { + if(i == 0) + { + return; + } + else + { + break; + } + } + nrf_gpio_pin_clear(p_config->scl); + nrf_delay_us(4); + nrf_gpio_pin_set(p_config->scl); + nrf_delay_us(4); + } + nrf_gpio_pin_clear(p_config->sda); + nrf_delay_us(4); + nrf_gpio_pin_set(p_config->sda); +} + +ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * p_instance, + nrf_drv_twi_config_t const * p_config, + nrf_drv_twi_evt_handler_t event_handler, + void * p_context) +{ + twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_config == NULL) + { + p_config = &m_default_config[p_instance->drv_inst_idx]; + } + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + if (nrf_drv_common_per_res_acquire(p_instance->reg.p_twi, + m_irq_handlers[p_instance->drv_inst_idx]) != NRF_SUCCESS) + { + return NRF_ERROR_BUSY; + } +#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED + + p_cb->handler = event_handler; + p_cb->p_context = p_context; + p_cb->int_mask = 0; + p_cb->repeated = false; + p_cb->busy = false; + + twi_clear_bus(p_instance, p_config); + + /* To secure correct signal levels on the pins used by the TWI + master when the system is in OFF mode, and when the TWI master is + disabled, these pins must be configured in the GPIO peripheral. + */ + NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF; + NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF; + + CODE_FOR_TWIM + ( + NRF_TWIM_Type * p_twim = p_instance->reg.p_twim; + nrf_twim_pins_set(p_twim, p_config->scl, p_config->sda); + nrf_twim_frequency_set(p_twim, + (nrf_twim_frequency_t)p_config->frequency); + ) + CODE_FOR_TWI + ( + NRF_TWI_Type * p_twi = p_instance->reg.p_twi; + nrf_twi_pins_set(p_twi, p_config->scl, p_config->sda); + nrf_twi_frequency_set(p_twi, + (nrf_twi_frequency_t)p_config->frequency); + ) + + if (p_cb->handler) + { + CODE_FOR_TWIM + ( + nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_twim), + p_config->interrupt_priority); + ) + CODE_FOR_TWI + ( + nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_twi), + p_config->interrupt_priority); + ) + } + + p_cb->state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + +void nrf_drv_twi_uninit(nrf_drv_twi_t const * p_instance) +{ + twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + if (p_cb->handler) + { + CODE_FOR_TWIM + ( + nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_twim)); + ) + CODE_FOR_TWI + ( + nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_twi)); + ) + } + nrf_drv_twi_disable(p_instance); + +#if PERIPHERAL_RESOURCE_SHARING_ENABLED + nrf_drv_common_per_res_release(p_instance->reg.p_twi); +#endif + + p_cb->state = NRF_DRV_STATE_UNINITIALIZED; +} + +void nrf_drv_twi_enable(nrf_drv_twi_t const * p_instance) +{ + twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state == NRF_DRV_STATE_INITIALIZED); + + CODE_FOR_TWIM + ( + NRF_TWIM_Type * p_twim = p_instance->reg.p_twim; + + nrf_twim_enable(p_twim); + ) + CODE_FOR_TWI + ( + NRF_TWI_Type * p_twi = p_instance->reg.p_twi; + + nrf_twi_enable(p_twi); + ) + + p_cb->state = NRF_DRV_STATE_POWERED_ON; +} + +void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance) +{ + twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + CODE_FOR_TWIM + ( + NRF_TWIM_Type * p_twim = p_instance->reg.p_twim; + p_cb->int_mask = 0; + nrf_twim_int_disable(p_twim, DISABLE_ALL); + nrf_twim_shorts_disable(p_twim, DISABLE_ALL); + nrf_twim_disable(p_twim); + ) + CODE_FOR_TWI + ( + NRF_TWI_Type * p_twi = p_instance->reg.p_twi; + nrf_twi_int_disable(p_twi, DISABLE_ALL); + nrf_twi_shorts_disable(p_twi, DISABLE_ALL); + nrf_twi_disable(p_twi); + ) + + p_cb->state = NRF_DRV_STATE_INITIALIZED; +} + +#ifdef TWI_IN_USE +static bool twi_send_byte(NRF_TWI_Type * p_twi, + uint8_t const * p_data, + uint8_t length, + uint8_t * p_bytes_transferred, + bool no_stop) +{ + if (*p_bytes_transferred < length) + { + nrf_twi_txd_set(p_twi, p_data[*p_bytes_transferred]); + ++(*p_bytes_transferred); + } + else + { + if (no_stop) + { + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_SUSPEND); + return false; + } + else + { + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP); + } + } + return true; +} + +static void twi_receive_byte(NRF_TWI_Type * p_twi, + uint8_t * p_data, + uint8_t length, + uint8_t * p_bytes_transferred) +{ + if (*p_bytes_transferred < length) + { + p_data[*p_bytes_transferred] = nrf_twi_rxd_get(p_twi); + + ++(*p_bytes_transferred); + + if (*p_bytes_transferred == length-1) + { + nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_STOP_MASK); + } + else if (*p_bytes_transferred == length) + { + return; + } + + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME); + } +} + +static bool twi_transfer(NRF_TWI_Type * p_twi, + bool * p_error, + uint8_t * p_bytes_transferred, + uint8_t * p_data, + uint8_t length, + bool no_stop) +{ + bool do_stop_check; + + if ((*p_error == true) || (*p_bytes_transferred == length)) + { + do_stop_check = true; + } + else + { + do_stop_check = false; + } + + if (*p_error) + { + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT); + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY); + } + else if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR)) + { + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP); + *p_error = true; + } + else + { + if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_TXDSENT)) + { + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT); + if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR)) + { + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP); + *p_error = true; + } + else + { + if (!twi_send_byte(p_twi, p_data, length, p_bytes_transferred, no_stop)) + { + return false; + } + } + } + else if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_RXDREADY)) + { + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY); + if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR)) + { + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP); + *p_error = true; + } + else + { + twi_receive_byte(p_twi, p_data, length, p_bytes_transferred); + } + } + } + + if (do_stop_check && nrf_twi_event_check(p_twi, NRF_TWI_EVENT_STOPPED)) + { + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED); + return false; + } + + return true; +} + +static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb, + NRF_TWI_Type * p_twi, + uint8_t const * p_data, + uint8_t length, + bool no_stop) +{ + ret_code_t ret_code = NRF_SUCCESS; + + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED); + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT); + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY); + nrf_twi_shorts_set(p_twi, 0); + + p_cb->bytes_transferred = 0; + p_cb->error = false; + + // In case TWI is suspended resume its operation. + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME); + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STARTTX); + + (void)twi_send_byte(p_twi, p_data, length, &p_cb->bytes_transferred, no_stop); + + if (p_cb->handler) + { + p_cb->int_mask = NRF_TWI_INT_STOPPED_MASK | + NRF_TWI_INT_ERROR_MASK | + NRF_TWI_INT_TXDSENT_MASK | + NRF_TWI_INT_RXDREADY_MASK; + nrf_twi_int_enable(p_twi, p_cb->int_mask); + } + else + { + while (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, (uint8_t *)p_data, length, no_stop)) + {} + + if (p_cb->error) + { + ret_code = NRF_ERROR_INTERNAL; + } + } + return ret_code; +} + +static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb, + NRF_TWI_Type * p_twi, + uint8_t const * p_data, + uint8_t length) +{ + ret_code_t ret_code = NRF_SUCCESS; + + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED); + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT); + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY); + + p_cb->bytes_transferred = 0; + p_cb->error = false; + + if (length == 1) + { + nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_STOP_MASK); + } + else + { + nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_SUSPEND_MASK); + } + // In case TWI is suspended resume its operation. + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME); + nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STARTRX); + + if (p_cb->handler) + { + p_cb->int_mask = NRF_TWI_INT_STOPPED_MASK | + NRF_TWI_INT_ERROR_MASK | + NRF_TWI_INT_TXDSENT_MASK | + NRF_TWI_INT_RXDREADY_MASK; + nrf_twi_int_enable(p_twi, p_cb->int_mask); + } + else + { + while (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, (uint8_t*)p_data, length, false)) + {} + + if (p_cb->error) + { + ret_code = NRF_ERROR_INTERNAL; + } + } + return ret_code; +} + +__STATIC_INLINE ret_code_t twi_xfer(twi_control_block_t * p_cb, + NRF_TWI_Type * p_twi, + nrf_drv_twi_xfer_desc_t const * p_xfer_desc, + uint32_t flags) +{ + ret_code_t ret = NRF_SUCCESS; + + /* Block TWI interrupts to ensure that function is not interrupted by TWI interrupt. */ + nrf_twi_int_disable(p_twi, DISABLE_ALL); + + if (p_cb->busy) + { + nrf_twi_int_enable(p_twi, p_cb->int_mask); + return NRF_ERROR_BUSY; + } + else + { + p_cb->busy = (NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER & flags) ? false : true; + } + + if (flags & NRF_DRV_TWI_FLAG_HOLD_XFER) + { + return NRF_ERROR_NOT_SUPPORTED; + } + + p_cb->flags = flags; + p_cb->xfer_desc = *p_xfer_desc; + p_cb->curr_length = p_xfer_desc->primary_length; + p_cb->p_curr_buf = p_xfer_desc->p_primary_buf; + nrf_twi_address_set(p_twi, p_xfer_desc->address); + + if (p_xfer_desc->type != NRF_DRV_TWI_XFER_RX) + { + p_cb->curr_no_stop = ((p_xfer_desc->type == NRF_DRV_TWI_XFER_TX) && + !(flags & NRF_DRV_TWI_FLAG_TX_NO_STOP)) ? false : true; + ret = twi_tx_start_transfer(p_cb, p_twi, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length, p_cb->curr_no_stop); + } + else + { + p_cb->curr_no_stop = false; + ret = twi_rx_start_transfer(p_cb, p_twi, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); + } + if (p_cb->handler == NULL) + { + p_cb->busy = false; + } + return ret; +} +#endif + +#ifdef TWIM_IN_USE +__STATIC_INLINE void twim_list_enable_handle(NRF_TWIM_Type * p_twim, uint32_t flags) +{ + if (NRF_DRV_TWI_FLAG_TX_POSTINC & flags) + { + nrf_twim_tx_list_enable(p_twim); + } + else + { + nrf_twim_tx_list_disable(p_twim); + } + + if (NRF_DRV_TWI_FLAG_RX_POSTINC & flags) + { + nrf_twim_rx_list_enable(p_twim); + } + else + { + nrf_twim_rx_list_disable(p_twim); + } +#ifndef NRF52_PAN_46 +#endif +} +__STATIC_INLINE ret_code_t twim_xfer(twi_control_block_t * p_cb, + NRF_TWIM_Type * p_twim, + nrf_drv_twi_xfer_desc_t const * p_xfer_desc, + uint32_t flags) +{ + ret_code_t ret = NRF_SUCCESS; + nrf_twim_task_t start_task = NRF_TWIM_TASK_STARTTX; + nrf_twim_event_t evt_to_wait = NRF_TWIM_EVENT_STOPPED; + + if (!nrf_drv_is_in_RAM(p_xfer_desc->p_primary_buf)) + { + return NRF_ERROR_INVALID_ADDR; + } + /* Block TWI interrupts to ensure that function is not interrupted by TWI interrupt. */ + nrf_twim_int_disable(p_twim, DISABLE_ALL); + if (p_cb->busy) + { + nrf_twim_int_enable(p_twim, p_cb->int_mask); + return NRF_ERROR_BUSY; + } + else + { + + p_cb->busy = ((NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER & flags) || + (NRF_DRV_TWI_FLAG_REPEATED_XFER & flags)) ? false: true; + } + + p_cb->xfer_desc = *p_xfer_desc; + p_cb->repeated = (flags & NRF_DRV_TWI_FLAG_REPEATED_XFER) ? true : false; + nrf_twim_address_set(p_twim, p_xfer_desc->address); + + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_STOPPED); + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR); + + twim_list_enable_handle(p_twim, flags); + switch (p_xfer_desc->type) + { + case NRF_DRV_TWI_XFER_TXTX: + ASSERT(!(flags & NRF_DRV_TWI_FLAG_REPEATED_XFER)); + ASSERT(!(flags & NRF_DRV_TWI_FLAG_HOLD_XFER)); + ASSERT(!(flags & NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER)); + if (!nrf_drv_is_in_RAM(p_xfer_desc->p_secondary_buf)) + { + return NRF_ERROR_INVALID_ADDR; + } + nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK); + nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_TXSTARTED); + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_LASTTX); + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_SUSPENDED); + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STARTTX); + while(!nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_TXSTARTED)) + {} + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_TXSTARTED); + nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_secondary_buf, p_xfer_desc->secondary_length); + p_cb->int_mask = NRF_TWIM_INT_SUSPENDED_MASK | NRF_TWIM_INT_ERROR_MASK; + break; + case NRF_DRV_TWI_XFER_TXRX: + nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); + nrf_twim_rx_buffer_set(p_twim, p_xfer_desc->p_secondary_buf, p_xfer_desc->secondary_length); + nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_STARTRX_MASK | + NRF_TWIM_SHORT_LASTRX_STOP_MASK); + p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK; + break; + case NRF_DRV_TWI_XFER_TX: + nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); + if (NRF_DRV_TWI_FLAG_TX_NO_STOP & flags) + { + nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK); + p_cb->int_mask = NRF_TWIM_INT_SUSPENDED_MASK | NRF_TWIM_INT_ERROR_MASK; + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_SUSPENDED); + evt_to_wait = NRF_TWIM_EVENT_SUSPENDED; + } + else + { + nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_STOP_MASK); + p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK; + } + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); + break; + case NRF_DRV_TWI_XFER_RX: + nrf_twim_rx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); + nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTRX_STOP_MASK); + p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK; + start_task = NRF_TWIM_TASK_STARTRX; + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); + break; + default: + ret = NRF_ERROR_INVALID_PARAM; + break; + } + + if (!(flags & NRF_DRV_TWI_FLAG_HOLD_XFER) && (p_xfer_desc->type != NRF_DRV_TWI_XFER_TXTX)) + { + nrf_twim_task_trigger(p_twim, start_task); + } + + if (p_cb->handler) + { + if (flags & NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER) + { + p_cb->int_mask = NRF_TWIM_INT_ERROR_MASK; + } + nrf_twim_int_enable(p_twim, p_cb->int_mask); + } + else + { + while (!nrf_twim_event_check(p_twim, evt_to_wait)) + { + if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_ERROR)) + { + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR); + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STOP); + evt_to_wait = NRF_TWIM_EVENT_STOPPED; + } + } + + uint32_t errorsrc = nrf_twim_errorsrc_get_and_clear(p_twim); + + p_cb->busy = false; + + if (errorsrc) + { + ret = NRF_ERROR_INTERNAL; + } + } + return ret; +} +#endif + +ret_code_t nrf_drv_twi_xfer(nrf_drv_twi_t const * p_instance, + nrf_drv_twi_xfer_desc_t const * p_xfer_desc, + uint32_t flags) +{ + ret_code_t ret = NRF_SUCCESS; + twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + + // TXRX and TXTX transfers are support only in non-blocking mode. + ASSERT( !((p_cb->handler == NULL) && (p_xfer_desc->type == NRF_DRV_TWI_XFER_TXRX))); + ASSERT( !((p_cb->handler == NULL) && (p_xfer_desc->type == NRF_DRV_TWI_XFER_TXTX))); + + CODE_FOR_TWIM + ( + ret = twim_xfer(p_cb, (NRF_TWIM_Type *)p_instance->reg.p_twim, p_xfer_desc, flags); + ) + CODE_FOR_TWI + ( + if ( (NRF_DRV_TWI_FLAG_TX_POSTINC | NRF_DRV_TWI_FLAG_RX_POSTINC) & flags) + { + return NRF_ERROR_NOT_SUPPORTED; + } + ret = twi_xfer(p_cb, (NRF_TWI_Type *)p_instance->reg.p_twi, p_xfer_desc, flags); + ) + return ret; +} + +bool nrf_drv_twi_is_busy(nrf_drv_twi_t const * p_instance) +{ + twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + return p_cb->busy; +} + +ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance, + uint8_t address, + uint8_t const * p_data, + uint8_t length, + bool no_stop) +{ + nrf_drv_twi_xfer_desc_t xfer = NRF_DRV_TWI_XFER_DESC_TX(address, (uint8_t*)p_data, length); + + return nrf_drv_twi_xfer(p_instance, &xfer, no_stop ? NRF_DRV_TWI_FLAG_TX_NO_STOP : 0); +} + +ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * p_instance, + uint8_t address, + uint8_t * p_data, + uint8_t length) +{ + nrf_drv_twi_xfer_desc_t xfer = NRF_DRV_TWI_XFER_DESC_RX(address, p_data, length); + return nrf_drv_twi_xfer(p_instance, &xfer, 0); +} + +uint32_t nrf_drv_twi_data_count_get(nrf_drv_twi_t const * const p_instance) +{ + CODE_FOR_TWIM + ( + ASSERT(false); + return 0; + ) + CODE_FOR_TWI + ( + return m_cb[p_instance->drv_inst_idx].bytes_transferred; + ) +} +uint32_t nrf_drv_twi_start_task_get(nrf_drv_twi_t const * p_instance, nrf_drv_twi_xfer_type_t xfer_type) +{ + CODE_FOR_TWIM + ( + return (uint32_t)nrf_twim_task_address_get(p_instance->reg.p_twim, + (xfer_type != NRF_DRV_TWI_XFER_RX) ? NRF_TWIM_TASK_STARTTX : NRF_TWIM_TASK_STARTRX); + ) + CODE_FOR_TWI + ( + return (uint32_t)nrf_twi_task_address_get(p_instance->reg.p_twi, + (xfer_type != NRF_DRV_TWI_XFER_RX) ? NRF_TWI_TASK_STARTTX : NRF_TWI_TASK_STARTRX); + ) +} + +uint32_t nrf_drv_twi_stopped_event_get(nrf_drv_twi_t const * p_instance) +{ + CODE_FOR_TWIM + ( + return (uint32_t)nrf_twim_event_address_get(p_instance->reg.p_twim, NRF_TWIM_EVENT_STOPPED); + ) + CODE_FOR_TWI + ( + return (uint32_t)nrf_twi_event_address_get(p_instance->reg.p_twi, NRF_TWI_EVENT_STOPPED); + ) +} + +#ifdef TWIM_IN_USE +static void irq_handler_twim(NRF_TWIM_Type * p_twim, twi_control_block_t * p_cb) +{ + ASSERT(p_cb->handler); + + if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_ERROR)) + { + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR); + if (!nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_STOPPED)) + { + nrf_twim_int_disable(p_twim, p_cb->int_mask); + p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK; + nrf_twim_int_enable(p_twim, p_cb->int_mask); + + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STOP); + return; + } + } + + nrf_drv_twi_evt_t event; + + if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_STOPPED)) + { + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_STOPPED); + event.xfer_desc = p_cb->xfer_desc; + if (p_cb->error) + { + + event.xfer_desc.primary_length = (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_RX) ? + (uint8_t)nrf_twim_rxd_amount_get(p_twim) : (uint8_t)nrf_twim_txd_amount_get(p_twim); + event.xfer_desc.secondary_length = (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TXRX) ? + (uint8_t)nrf_twim_rxd_amount_get(p_twim) : (uint8_t)nrf_twim_txd_amount_get(p_twim); + + } + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_LASTTX); + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_LASTRX); + if (!p_cb->repeated || p_cb->error) + { + nrf_twim_shorts_set(p_twim, 0); + p_cb->int_mask = 0; + nrf_twim_int_disable(p_twim, DISABLE_ALL); + } + } + else + { + nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_SUSPENDED); + if (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TX) + { + event.xfer_desc = p_cb->xfer_desc; + if (!p_cb->repeated) + { + nrf_twim_shorts_set(p_twim, 0); + p_cb->int_mask = 0; + nrf_twim_int_disable(p_twim, DISABLE_ALL); + } + } + else + { + nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_STOP_MASK); + p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK; + nrf_twim_int_disable(p_twim, DISABLE_ALL); + nrf_twim_int_enable(p_twim, p_cb->int_mask); + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STARTTX); + nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); + return; + } + } + + uint32_t errorsrc = nrf_twim_errorsrc_get_and_clear(p_twim); + if (errorsrc & NRF_TWIM_ERROR_ADDRESS_NACK) + { + event.type = NRF_DRV_TWI_EVT_ADDRESS_NACK; + } + else if (errorsrc & NRF_TWIM_ERROR_DATA_NACK) + { + event.type = NRF_DRV_TWI_EVT_DATA_NACK; + } + else + { + event.type = NRF_DRV_TWI_EVT_DONE; + } + + if (!p_cb->repeated) + { + p_cb->busy = false; + } + p_cb->handler(&event, p_cb->p_context); +} +#endif // TWIM_IN_USE + +#ifdef TWI_IN_USE +static void irq_handler_twi(NRF_TWI_Type * p_twi, twi_control_block_t * p_cb) +{ + ASSERT(p_cb->handler); + + if (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, p_cb->p_curr_buf, p_cb->curr_length, p_cb->curr_no_stop )) + { + return; + } + + if (!p_cb->error && + ((p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TXRX) || + (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TXTX)) && + p_cb->p_curr_buf == p_cb->xfer_desc.p_primary_buf) + { + p_cb->p_curr_buf = p_cb->xfer_desc.p_secondary_buf; + p_cb->curr_length = p_cb->xfer_desc.secondary_length; + p_cb->curr_no_stop = (p_cb->flags & NRF_DRV_TWI_FLAG_TX_NO_STOP); + + if (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TXTX) + { + (void)twi_tx_start_transfer(p_cb, p_twi, p_cb->p_curr_buf, p_cb->curr_length, p_cb->curr_no_stop); + } + else + { + (void)twi_rx_start_transfer(p_cb, p_twi, p_cb->p_curr_buf, p_cb->curr_length); + } + } + else + { + nrf_drv_twi_evt_t event; + event.xfer_desc = p_cb->xfer_desc; + + if (p_cb->error) + { + uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(p_twi); + if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) + { + event.type = NRF_DRV_TWI_EVT_ADDRESS_NACK; + } + else if (errorsrc & NRF_TWI_ERROR_DATA_NACK) + { + event.type = NRF_DRV_TWI_EVT_DATA_NACK; + } + } + else + { + event.type = NRF_DRV_TWI_EVT_DONE; + } + + p_cb->busy = false; + + if (!(NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER & p_cb->flags)) + { + p_cb->handler(&event, p_cb->p_context); + } + } + +} +#endif // TWI_IN_USE + +#if TWI0_ENABLED +IRQ_HANDLER(0) +{ + #if (TWI0_USE_EASY_DMA == 1) && defined(NRF52) + irq_handler_twim(NRF_TWIM0, + #else + irq_handler_twi(NRF_TWI0, + #endif + &m_cb[TWI0_INSTANCE_INDEX]); +} +#endif // TWI0_ENABLED + +#if TWI1_ENABLED +IRQ_HANDLER(1) +{ + #if (TWI1_USE_EASY_DMA == 1) + irq_handler_twim(NRF_TWIM1, + #else + irq_handler_twi(NRF_TWI1, + #endif + &m_cb[TWI1_INSTANCE_INDEX]); +} +#endif // TWI1_ENABLED diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h new file mode 100644 index 0000000000..83f37ea4be --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h @@ -0,0 +1,421 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * + * @defgroup nrf_twi Two-wire interface (TWI) + * @ingroup nrf_drivers + * @brief Two-wire interface (TWI) APIs. + * + * @defgroup nrf_twi_master TWI master HAL and driver + * @ingroup nrf_twi + * @brief TWI master APIs. + * @details The TWI and TWIM HALs provide basic APIs for accessing the registers of the TWI and TWIM peripherals, respectively. + * + * The TWI master driver provides APIs on a higher level. + * + */ + +#ifndef NRF_DRV_TWI_H__ +#define NRF_DRV_TWI_H__ + +#include "nordic_common.h" +#include "nrf_drv_config.h" + +// This set of macros makes it possible to exclude parts of code when one type +// of supported peripherals is not used. +#if ((TWI0_ENABLED == 1 && TWI0_USE_EASY_DMA == 1) || \ + (TWI1_ENABLED == 1 && TWI1_USE_EASY_DMA == 1)) + #define TWIM_IN_USE +#endif +#if ((TWI0_ENABLED == 1 && TWI0_USE_EASY_DMA != 1) || \ + (TWI1_ENABLED == 1 && TWI1_USE_EASY_DMA != 1)) + #define TWI_IN_USE +#endif + +#include "nrf_twi.h" +#ifdef TWIM_IN_USE + #include "nrf_twim.h" +#endif +#include "sdk_errors.h" + +#if defined(NRF52) + #define NRF_DRV_TWI_PERIPHERAL(id) \ + (CONCAT_3(TWI, id, _USE_EASY_DMA) == 1 ? \ + (void *)CONCAT_2(NRF_TWIM, id) \ + : (void *)CONCAT_2(NRF_TWI, id)) +#else + #define NRF_DRV_TWI_PERIPHERAL(id) (void *)CONCAT_2(NRF_TWI, id) +#endif + +/** + * @defgroup nrf_drv_twi TWI master driver + * @{ + * @ingroup nrf_twi_master + * @brief Multi-instance TWI master driver. + */ + +/** + * @brief Structure for the TWI master driver instance. + */ +typedef struct +{ + union + { +#ifdef TWIM_IN_USE + NRF_TWIM_Type * p_twim; ///< Pointer to a structure with TWIM registers. +#endif + NRF_TWI_Type * p_twi; ///< Pointer to a structure with TWI registers. + } reg; + uint8_t drv_inst_idx; ///< Driver instance index. + bool use_easy_dma; ///< True if the peripheral with EasyDMA (TWIM) shall be used. +} nrf_drv_twi_t; + +/** + * @brief Macro for creating a TWI master driver instance. + */ +#define NRF_DRV_TWI_INSTANCE(id) \ +{ \ + .reg = {NRF_DRV_TWI_PERIPHERAL(id)}, \ + .drv_inst_idx = CONCAT_3(TWI, id, _INSTANCE_INDEX), \ + .use_easy_dma = CONCAT_3(TWI, id, _USE_EASY_DMA) \ +} + +/** + * @brief Structure for the TWI master driver instance configuration. + */ +typedef struct +{ + uint32_t scl; ///< SCL pin number. + uint32_t sda; ///< SDA pin number. + nrf_twi_frequency_t frequency; ///< TWI frequency. + uint8_t interrupt_priority; ///< Interrupt priority. +} nrf_drv_twi_config_t; + +/** + * @brief TWI master driver instance default configuration. + */ +#define NRF_DRV_TWI_DEFAULT_CONFIG(id) \ +{ \ + .frequency = CONCAT_3(TWI, id, _CONFIG_FREQUENCY), \ + .scl = CONCAT_3(TWI, id, _CONFIG_SCL), \ + .sda = CONCAT_3(TWI, id, _CONFIG_SDA), \ + .interrupt_priority = CONCAT_3(TWI, id, _CONFIG_IRQ_PRIORITY) \ +} + +#define NRF_DRV_TWI_FLAG_TX_POSTINC (1UL << 0) /**< TX buffer address incremented after transfer. */ +#define NRF_DRV_TWI_FLAG_RX_POSTINC (1UL << 1) /**< RX buffer address incremented after transfer. */ +#define NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER (1UL << 2) /**< Interrupt after each transfer is suppressed, and the event handler is not called. */ +#define NRF_DRV_TWI_FLAG_HOLD_XFER (1UL << 3) /**< Set up the transfer but do not start it. */ +#define NRF_DRV_TWI_FLAG_REPEATED_XFER (1UL << 4) /**< Flag indicating that the transfer will be executed multiple times. */ +#define NRF_DRV_TWI_FLAG_TX_NO_STOP (1UL << 5) /**< Flag indicating that the TX transfer will not end with a stop condition. */ + +/** + * @brief TWI master driver event types. + */ +typedef enum +{ + NRF_DRV_TWI_EVT_DONE, ///< Transfer completed event. + NRF_DRV_TWI_EVT_ADDRESS_NACK, ///< Error event: NACK received after sending the address. + NRF_DRV_TWI_EVT_DATA_NACK ///< Error event: NACK received after sending a data byte. +} nrf_drv_twi_evt_type_t; + +/** + * @brief TWI master driver transfer types. + */ +typedef enum +{ + NRF_DRV_TWI_XFER_TX, ///< TX transfer. + NRF_DRV_TWI_XFER_RX, ///< RX transfer. + NRF_DRV_TWI_XFER_TXRX, ///< TX transfer followed by RX transfer with repeated start. + NRF_DRV_TWI_XFER_TXTX ///< TX transfer followed by TX transfer with repeated start. +} nrf_drv_twi_xfer_type_t; + +/** + * @brief Structure for a TWI transfer descriptor. + */ +typedef struct +{ + nrf_drv_twi_xfer_type_t type; ///< Type of transfer. + uint8_t address; ///< Slave address. + uint8_t primary_length; ///< Number of bytes transferred. + uint8_t secondary_length; ///< Number of bytes transferred. + uint8_t * p_primary_buf; ///< Pointer to transferred data. + uint8_t * p_secondary_buf; ///< Pointer to transferred data. +} nrf_drv_twi_xfer_desc_t; + + +/**@brief Macro for setting the TX transfer descriptor. */ +#define NRF_DRV_TWI_XFER_DESC_TX(addr, p_data, length) \ + { \ + .type = NRF_DRV_TWI_XFER_TX, \ + .address = addr, \ + .primary_length = length, \ + .p_primary_buf = p_data, \ + } + +/**@brief Macro for setting the RX transfer descriptor. */ +#define NRF_DRV_TWI_XFER_DESC_RX(addr, p_data, length) \ + { \ + .type = NRF_DRV_TWI_XFER_RX, \ + .address = addr, \ + .primary_length = length, \ + .p_primary_buf = p_data, \ + } + +/**@brief Macro for setting the TXRX transfer descriptor. */ +#define NRF_DRV_TWI_XFER_DESC_TXRX(addr, p_tx, tx_len, p_rx, rx_len) \ + { \ + .type = NRF_DRV_TWI_XFER_TXRX, \ + .address = addr, \ + .primary_length = tx_len, \ + .secondary_length = rx_len, \ + .p_primary_buf = p_tx, \ + .p_secondary_buf = p_rx, \ + } + +/**@brief Macro for setting the TXTX transfer descriptor. */ +#define NRF_DRV_TWI_XFER_DESC_TXTX(addr, p_tx, tx_len, p_tx2, tx_len2) \ + { \ + .type = NRF_DRV_TWI_XFER_TXTX, \ + .address = addr, \ + .primary_length = tx_len, \ + .secondary_length = tx_len2, \ + .p_primary_buf = p_tx, \ + .p_secondary_buf = p_tx2, \ + } + +/** + * @brief Structure for a TWI event. + */ +typedef struct +{ + nrf_drv_twi_evt_type_t type; ///< Event type. + nrf_drv_twi_xfer_desc_t xfer_desc; ///< Transfer details. +} nrf_drv_twi_evt_t; + +/** + * @brief TWI event handler prototype. + */ +typedef void (* nrf_drv_twi_evt_handler_t)(nrf_drv_twi_evt_t const * p_event, + void * p_context); + +/** + * @brief Function for initializing the TWI instance. + * + * @param[in] p_instance TWI instance. + * @param[in] p_config Initial configuration. If NULL, the default configuration is used. + * @param[in] event_handler Event handler provided by the user. If NULL, blocking mode is enabled. + * @param[in] p_context Context passed to event handler. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver is in invalid state. + * @retval NRF_ERROR_BUSY If some other peripheral with the same + * instance ID is already in use. This is + * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED + * is set to a value other than zero. + */ +ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * p_instance, + nrf_drv_twi_config_t const * p_config, + nrf_drv_twi_evt_handler_t event_handler, + void * p_context); + +/** + * @brief Function for uninitializing the TWI instance. + * + * @param[in] p_instance TWI instance. + */ +void nrf_drv_twi_uninit(nrf_drv_twi_t const * p_instance); + +/** + * @brief Function for enabling the TWI instance. + * + * @param[in] p_instance TWI instance. + */ +void nrf_drv_twi_enable(nrf_drv_twi_t const * p_instance); + +/** + * @brief Function for disabling the TWI instance. + * + * @param[in] p_instance TWI instance. + */ +void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance); + +/** + * @brief Function for sending data to a TWI slave. + * + * The transmission will be stopped when an error occurs. If a transfer is ongoing, + * the function returns the error code @ref NRF_ERROR_BUSY. + * + * @param[in] p_instance TWI instance. + * @param[in] address Address of a specific slave device (only 7 LSB). + * @param[in] p_data Pointer to a transmit buffer. + * @param[in] length Number of bytes to send. + * @param[in] no_stop If set, the stop condition is not generated on the bus + * after the transfer has completed successfully (allowing + * for a repeated start in the next transfer). + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. + * @retval NRF_ERROR_INTERNAL If an error was detected by hardware. + */ +ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance, + uint8_t address, + uint8_t const * p_data, + uint8_t length, + bool no_stop); + +/** + * @brief Function for reading data from a TWI slave. + * + * The transmission will be stopped when an error occurs. If a transfer is ongoing, + * the function returns the error code @ref NRF_ERROR_BUSY. + * + * @param[in] p_instance TWI instance. + * @param[in] address Address of a specific slave device (only 7 LSB). + * @param[in] p_data Pointer to a receive buffer. + * @param[in] length Number of bytes to be received. + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. + * @retval NRF_ERROR_INTERNAL If an error was detected by hardware. + */ +ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * p_instance, + uint8_t address, + uint8_t * p_data, + uint8_t length); + +/** + * @brief Function for preparing a TWI transfer. + * + * The following transfer types can be configured (@ref nrf_drv_twi_xfer_desc_t::type): + * - @ref NRF_DRV_TWI_XFER_TXRX: Write operation followed by a read operation (without STOP condition in between). + * - @ref NRF_DRV_TWI_XFER_TXTX: Write operation followed by a write operation (without STOP condition in between). + * - @ref NRF_DRV_TWI_XFER_TX: Write operation (with or without STOP condition). + * - @ref NRF_DRV_TWI_XFER_RX: Read operation (with STOP condition). + * + * Additional options are provided using the flags parameter: + * - @ref NRF_DRV_TWI_FLAG_TX_POSTINC and @ref NRF_DRV_TWI_FLAG_RX_POSTINC: Post-incrementation of buffer addresses. Supported only by TWIM. + * - @ref NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER: No user event handler after transfer completion. In most cases, this also means no interrupt at the end of the transfer. + * - @ref NRF_DRV_TWI_FLAG_HOLD_XFER: Driver is not starting the transfer. Use this flag if the transfer is triggered externally by PPI. Supported only by TWIM. + * Use @ref nrf_drv_twi_start_task_get to get the address of the start task. + * - @ref NRF_DRV_TWI_FLAG_REPEATED_XFER: Prepare for repeated transfers. You can set up a number of transfers that will be triggered externally (for example by PPI). + * An example is a TXRX transfer with the options @ref NRF_DRV_TWI_FLAG_RX_POSTINC, @ref NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER, and @ref NRF_DRV_TWI_FLAG_REPEATED_XFER. + * After the transfer is set up, a set of transfers can be triggered by PPI that will read, for example, the same register of an + * external component and put it into a RAM buffer without any interrupts. @ref nrf_drv_twi_stopped_event_get can be used to get the + * address of the STOPPED event, which can be used to count the number of transfers. If @ref NRF_DRV_TWI_FLAG_REPEATED_XFER is used, + * the driver does not set the instance into busy state, so you must ensure that the next transfers are set up + * when TWIM is not active. Supported only by TWIM. + * - @ref NRF_DRV_TWI_FLAG_TX_NO_STOP: No stop condition after TX transfer. + * + * @note + * Some flag combinations are invalid: + * - @ref NRF_DRV_TWI_FLAG_TX_NO_STOP with @ref nrf_drv_twi_xfer_desc_t::type different than @ref NRF_DRV_TWI_XFER_TX + * - @ref NRF_DRV_TWI_FLAG_REPEATED_XFER with @ref nrf_drv_twi_xfer_desc_t::type set to @ref NRF_DRV_TWI_XFER_TXTX + * + * If @ref nrf_drv_twi_xfer_desc_t::type is set to @ref NRF_DRV_TWI_XFER_TX and the @ref NRF_DRV_TWI_FLAG_TX_NO_STOP and @ref NRF_DRV_TWI_FLAG_REPEATED_XFER + * flags are set, two tasks must be used to trigger a transfer: TASKS_RESUME followed by TASKS_STARTTX. If no stop condition is generated, + * TWIM is in SUSPENDED state. Therefore, it must be resumed before the transfer can be started. + * + * @note + * This function should be used only if the instance is configured to work in non-blocking mode. If the function is used in blocking mode, the driver asserts. + * @note If you are using this function with TWI, the only supported flag is @ref NRF_DRV_TWI_FLAG_TX_NO_STOP. All other flags require TWIM. + * + * @param[in] p_instance TWI instance. + * @param[in] p_xfer_desc Pointer to the transfer descriptor. + * @param[in] flags Transfer options (0 for default settings). + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. + * @retval NRF_ERROR_NOT_SUPPORTED If the provided parameters are not supported. + */ +ret_code_t nrf_drv_twi_xfer(nrf_drv_twi_t const * p_instance, + nrf_drv_twi_xfer_desc_t const * p_xfer_desc, + uint32_t flags); + +/** + * @brief Function for checking the TWI driver state. + * + * @param[in] p_instance TWI instance. + * + * @retval true If the TWI driver is currently busy performing a transfer. + * @retval false If the TWI driver is ready for a new transfer. + */ +bool nrf_drv_twi_is_busy(nrf_drv_twi_t const * p_instance); + +/** + * @brief Function for getting the transferred data count. + * + * This function provides valid results only in legacy mode. + * + * @param[in] p_instance TWI instance. + * + * @return Data count. + */ +uint32_t nrf_drv_twi_data_count_get(nrf_drv_twi_t const * const p_instance); + +/** + * @brief Function for returning the address of a TWI/TWIM start task. + * + * This function should be used if @ref nrf_drv_twi_xfer was called with the flag @ref NRF_DRV_TWI_FLAG_HOLD_XFER. + * In that case, the transfer is not started by the driver, but it must be started externally by PPI. + * + * @param[in] p_instance TWI instance. + * @param[in] xfer_type Transfer type used in the last call of the @ref nrf_drv_twi_xfer function. + * + * @return Start task address (TX or RX) depending on the value of xfer_type. + */ +uint32_t nrf_drv_twi_start_task_get(nrf_drv_twi_t const * p_instance, nrf_drv_twi_xfer_type_t xfer_type); + +/** + * @brief Function for returning the address of a STOPPED TWI/TWIM event. + * + * A STOPPED event can be used to detect the end of a transfer if the @ref NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER + * option is used. + * + * @param[in] p_instance TWI instance. + * + * @return STOPPED event address. + */ +uint32_t nrf_drv_twi_stopped_event_get(nrf_drv_twi_t const * p_instance); +/** + *@} + **/ + +#endif // NRF_DRV_TWI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader.h new file mode 100644 index 0000000000..f2f35bee60 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup nrf_bootloader Bootloader API. + * @{ + * + * @brief Bootloader module interface. + */ + +#ifndef BOOTLOADER_H__ +#define BOOTLOADER_H__ + +#include +#include +#include "bootloader_types.h" +#include + +/**@brief Function for initializing the Bootloader. + * + * @retval NRF_SUCCESS If bootloader was succesfully initialized. + */ +uint32_t bootloader_init(void); + +/**@brief Function for validating application region in flash. + * + * @param[in] app_addr Address to the region in flash where the application is stored. + * + * @retval true If Application region is valid. + * @retval false If Application region is not valid. + */ +bool bootloader_app_is_valid(uint32_t app_addr); + +/**@brief Function for starting the Device Firmware Update. + * + * @retval NRF_SUCCESS If new application image was successfully transferred. + */ +uint32_t bootloader_dfu_start(void); + +/**@brief Function for exiting bootloader and booting into application. + * + * @details This function will disable SoftDevice and all interrupts before jumping to application. + * The SoftDevice vector table base for interrupt forwarding will be set the application + * address. + * + * @param[in] app_addr Address to the region where the application is stored. + */ +void bootloader_app_start(uint32_t app_addr); + +/**@brief Function for retrieving the bootloader settings. + * + * @param[out] p_settings A copy of the current bootloader settings is returned in the structure + * provided. + */ +void bootloader_settings_get(bootloader_settings_t * const p_settings); + +/**@brief Function for processing DFU status update. + * + * @param[in] update_status DFU update status. + */ +void bootloader_dfu_update_process(dfu_update_status_t update_status); + +/**@brief Function getting state of SoftDevice update in progress. + * After a successfull SoftDevice transfer the system restarts in orderto disable SoftDevice + * and complete the update. + * + * @retval true A SoftDevice update is in progress. This indicates that second stage + * of a SoftDevice update procedure can be initiated. + * @retval false No SoftDevice update is in progress. + */ +bool bootloader_dfu_sd_in_progress(void); + +/**@brief Function for continuing the Device Firmware Update of a SoftDevice. + * + * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful. + */ +uint32_t bootloader_dfu_sd_update_continue(void); + +/**@brief Function for finalizing the Device Firmware Update of a SoftDevice. + * + * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful. + */ +uint32_t bootloader_dfu_sd_update_finalize(void); + +#endif // BOOTLOADER_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_settings.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_settings.h new file mode 100644 index 0000000000..c8964f42dc --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_settings.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + /**@file + * + * @defgroup nrf_bootloader_settings Bootloader settings API. + * @{ + * + * @brief Bootloader settings module interface. + */ + +#ifndef BOOTLOADER_SETTINGS_H__ +#define BOOTLOADER_SETTINGS_H__ + +#include +#include "bootloader_types.h" + +/**@brief Function for getting the bootloader settings. + * + * @param[out] pp_bootloader_settings Bootloader settings. + */ +void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings); + +#endif // BOOTLOADER_SETTINGS_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_types.h new file mode 100644 index 0000000000..5d342b0ade --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_types.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup nrf_bootloader_types Types and definitions. + * @{ + * + * @ingroup nrf_bootloader + * + * @brief Bootloader module type and definitions. + */ + +#ifndef BOOTLOADER_TYPES_H__ +#define BOOTLOADER_TYPES_H__ + +#include + +#define BOOTLOADER_DFU_START 0xB1 + +#define BOOTLOADER_SVC_APP_DATA_PTR_GET 0x02 + +/**@brief DFU Bank state code, which indicates wether the bank contains: A valid image, invalid image, or an erased flash. + */ +typedef enum +{ + BANK_VALID_APP = 0x01, + BANK_VALID_SD = 0xA5, + BANK_VALID_BOOT = 0xAA, + BANK_ERASED = 0xFE, + BANK_INVALID_APP = 0xFF, +} bootloader_bank_code_t; + +/**@brief Structure holding bootloader settings for application and bank data. + */ +typedef struct +{ + bootloader_bank_code_t bank_0; /**< Variable to store if bank 0 contains a valid application. */ + uint16_t bank_0_crc; /**< If bank is valid, this field will contain a valid CRC of the total image. */ + bootloader_bank_code_t bank_1; /**< Variable to store if bank 1 has been erased/prepared for new image. Bank 1 is only used in Banked Update scenario. */ + uint32_t bank_0_size; /**< Size of active image in bank0 if present, otherwise 0. */ + uint32_t sd_image_size; /**< Size of SoftDevice image in bank0 if bank_0 code is BANK_VALID_SD. */ + uint32_t bl_image_size; /**< Size of Bootloader image in bank0 if bank_0 code is BANK_VALID_SD. */ + uint32_t app_image_size; /**< Size of Application image in bank0 if bank_0 code is BANK_VALID_SD. */ + uint32_t sd_image_start; /**< Location in flash where SoftDevice image is stored for SoftDevice update. */ +} bootloader_settings_t; + +#endif // BOOTLOADER_TYPES_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.c new file mode 100644 index 0000000000..39eb64efbc --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.c @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "bootloader_util.h" +#include +#include + + +/** + * @brief Function for aborting current application/bootloader jump to to other app/bootloader. + * + * @details This functions will use the address provide to swap the stack pointer and then load + * the address of the reset handler to be executed. It will check current system mode + * (thread/handler) and if in thread mode it will reset into other application. + * If in handler mode \ref isr_abort will be executed to ensure correct exit of handler + * mode and jump into reset handler of other application. + * + * @param[in] start_addr Start address of other application. This address must point to the + initial stack pointer of the application. + * + * @note This function will never return but issue a reset into provided application. + */ +#if defined ( __CC_ARM ) +__asm static void bootloader_util_reset(uint32_t start_addr) +{ + LDR R5, [R0] ; Get App initial MSP for bootloader. + MSR MSP, R5 ; Set the main stack pointer to the applications MSP. + LDR R0, [R0, #0x04] ; Load Reset handler into R0. This will be first argument to branch instruction (BX). + + MOVS R4, #0xFF ; Load ones to R4. + SXTB R4, R4 ; Sign extend R4 to obtain 0xFFFFFFFF instead of 0xFF. + MRS R5, IPSR ; Load IPSR to R5 to check for handler or thread mode. + CMP R5, #0x00 ; Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader. + BNE isr_abort ; If not zero we need to exit current ISR and jump to reset handler of bootloader. + + MOV LR, R4 ; Clear the link register and set to ones to ensure no return, R4 = 0xFFFFFFFF. + BX R0 ; Branch to reset handler of bootloader. + +isr_abort + ; R4 contains ones from line above. Will be popped as R12 when exiting ISR (Cleaning up the registers). + MOV R5, R4 ; Fill with ones before jumping to reset handling. We be popped as LR when exiting ISR. Ensures no return to application. + MOV R6, R0 ; Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR. + MOVS r7, #0x21 ; Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21. + REV r7, r7 ; Reverse byte order to put 0x21 as MSB. + PUSH {r4-r7} ; Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR. + + MOVS R4, #0x00 ; Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers). + MOVS R5, #0x00 ; Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers). + MOVS R6, #0x00 ; Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers). + MOVS R7, #0x00 ; Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers). + PUSH {r4-r7} ; Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine. + + MOVS R0, #0xF9 ; Move the execution return command into register, 0xFFFFFFF9. + SXTB R0, R0 ; Sign extend R0 to obtain 0xFFFFFFF9 instead of 0xF9. + BX R0 ; No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application. + ALIGN +} +#elif defined ( __GNUC__ ) +static inline void bootloader_util_reset(uint32_t start_addr) +{ + __asm volatile( + "ldr r0, [%0]\t\n" // Get App initial MSP for bootloader. + "msr msp, r0\t\n" // Set the main stack pointer to the applications MSP. + "ldr r0, [%0, #0x04]\t\n" // Load Reset handler into R0. + + "movs r4, #0xFF\t\n" // Move ones to R4. + "sxtb r4, r4\t\n" // Sign extend R4 to obtain 0xFFFFFFFF instead of 0xFF. + + "mrs r5, IPSR\t\n" // Load IPSR to R5 to check for handler or thread mode. + "cmp r5, #0x00\t\n" // Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader. + "bne isr_abort\t\n" // If not zero we need to exit current ISR and jump to reset handler of bootloader. + + "mov lr, r4\t\n" // Clear the link register and set to ones to ensure no return. + "bx r0\t\n" // Branch to reset handler of bootloader. + + "isr_abort: \t\n" + + "mov r5, r4\t\n" // Fill with ones before jumping to reset handling. Will be popped as LR when exiting ISR. Ensures no return to application. + "mov r6, r0\t\n" // Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR. + "movs r7, #0x21\t\n" // Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21. + "rev r7, r7\t\n" // Reverse byte order to put 0x21 as MSB. + "push {r4-r7}\t\n" // Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR. + + "movs r4, #0x00\t\n" // Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers). + "movs r5, #0x00\t\n" // Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers). + "movs r6, #0x00\t\n" // Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers). + "movs r7, #0x00\t\n" // Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers). + "push {r4-r7}\t\n" // Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine. + + "movs r0, #0xF9\t\n" // Move the execution return command into register, 0xFFFFFFF9. + "sxtb r0, r0\t\n" // Sign extend R0 to obtain 0xFFFFFFF9 instead of 0xF9. + "bx r0\t\n" // No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application. + ".align\t\n" + :: "r" (start_addr) // Argument list for the gcc assembly. start_addr is %0. + : "r0", "r4", "r5", "r6", "r7" // List of register maintained manually. + ); +} +#elif defined ( __ICCARM__ ) +static inline void bootloader_util_reset(uint32_t start_addr) +{ + asm("ldr r5, [%0]\n" // Get App initial MSP for bootloader. + "msr msp, r5\n" // Set the main stack pointer to the applications MSP. + "ldr r0, [%0, #0x04]\n" // Load Reset handler into R0. + + "movs r4, #0x00\n" // Load zero into R4. + "mvns r4, r4\n" // Invert R4 to ensure it contain ones. + + "mrs r5, IPSR\n" // Load IPSR to R5 to check for handler or thread mode + "cmp r5, #0x00\n" // Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader. + "bne.n isr_abort\n" // If not zero we need to exit current ISR and jump to reset handler of bootloader. + + "mov lr, r4\n" // Clear the link register and set to ones to ensure no return. + "bx r0\n" // Branch to reset handler of bootloader. + + "isr_abort: \n" + // R4 contains ones from line above. We be popped as R12 when exiting ISR (Cleaning up the registers). + "mov r5, r4\n" // Fill with ones before jumping to reset handling. Will be popped as LR when exiting ISR. Ensures no return to application. + "mov r6, r0\n" // Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR. + "movs r7, #0x21\n" // Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21. + "rev r7, r7\n" // Reverse byte order to put 0x21 as MSB. + "push {r4-r7}\n" // Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR. + + "movs r4, #0x00\n" // Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers). + "movs r5, #0x00\n" // Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers). + "movs r6, #0x00\n" // Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers). + "movs r7, #0x00\n" // Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers). + "push {r4-r7}\n" // Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine. + + "movs r0, #0x06\n" // Load 0x06 into R6 to prepare for exec return command. + "mvns r0, r0\n" // Invert 0x06 to obtain EXEC_RETURN, 0xFFFFFFF9. + "bx r0\n" // No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application. + :: "r" (start_addr) // Argument list for the IAR assembly. start_addr is %0. + : "r0", "r4", "r5", "r6", "r7"); // List of register maintained manually. +} +#else +#error Compiler not supported. +#endif + + +void bootloader_util_app_start(uint32_t start_addr) +{ + bootloader_util_reset(start_addr); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.h new file mode 100644 index 0000000000..a1d3f4e47d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + /**@file + * + * @defgroup nrf_bootloader_util Bootloader util API. + * @{ + * + * @brief Bootloader util module interface. + */ + +#ifndef BOOTLOADER_UTIL_H__ +#define BOOTLOADER_UTIL_H__ + +#include +#include "bootloader_types.h" + +/**@brief Function for starting the application (or bootloader) at the provided address. + * + * @param[in] start_addr Start address. + * + * @note This function will never retrun. Instead it will reset into the application of the + * provided address. + */ +void bootloader_util_app_start(uint32_t start_addr); + +#endif // BOOTLOADER_UTIL_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu.h new file mode 100644 index 0000000000..e0dda11040 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup nrf_dfu Device Firmware Update API. + * @{ + * + * @brief Device Firmware Update module interface. + */ + +#ifndef DFU_H__ +#define DFU_H__ + +#include +#include +#include + + +/**@brief DFU event callback for asynchronous calls. + * + * @param[in] packet Packet type for which this callback is related. START_PACKET, DATA_PACKET. + * @param[in] result Operation result code. NRF_SUCCESS when a queued operation was successful. + * @param[in] p_data Pointer to the data to which the operation is related. + */ +typedef void (*dfu_callback_t)(uint32_t packet, uint32_t result, uint8_t * p_data); + +/**@brief Function for initializing the Device Firmware Update module. + * + * @return NRF_SUCCESS on success, an error_code otherwise. + */ +uint32_t dfu_init(void); + +/**@brief Function for registering a callback listener for \ref dfu_data_pkt_handle callbacks. + * + * @param[in] callback_handler Callback handler for receiving DFU events on completed operations + * of DFU packets. + */ +void dfu_register_callback(dfu_callback_t callback_handler); + +/**@brief Function for setting the DFU image size. + * + * @details Function sets the DFU image size. This function must be called when an update is started + * in order to notify the DFU of the new image size. If multiple images are to be + * transferred within the same update context then this function must be called with size + * information for each image being transfered. + * If an image type is not being transfered, e.g. SoftDevice but no Application , then the + * image size for application must be zero. + * + * @param[in] p_packet Pointer to the DFU packet containing information on DFU update process to + * be started. + * + * @return NRF_SUCCESS on success, an error_code otherwise. + */ +uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet); + +/**@brief Function for handling DFU data packets. + * + * @param[in] p_packet Pointer to the DFU packet. + * + * @return NRF_SUCCESS on success, an error_code otherwise. + */ +uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet); + +/**@brief Function for handling DFU init packets. + * + * @return NRF_SUCCESS on success, an error_code otherwise. + */ +uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet); + +/**@brief Function for validating a transferred image after the transfer has completed. + * + * @return NRF_SUCCESS on success, an error_code otherwise. + */ +uint32_t dfu_image_validate(void); + +/**@brief Function for activating the transfered image after validation has successfully completed. + * + * @return NRF_SUCCESS on success, an error_code otherwise. + */ +uint32_t dfu_image_activate(void); + +/**@brief Function for reseting the current update procedure and return to initial state. + * + * @details This function call will result in a system reset to ensure correct system behavior. + * The reset will might be scheduled to execute at a later point in time to ensure pending + * flash operations has completed. + */ +void dfu_reset(void); + +/**@brief Function for validating that new bootloader has been correctly installed. + * + * @return NRF_SUCCESS if install was successful. NRF_ERROR_NULL if the images differs. + */ +uint32_t dfu_bl_image_validate(void); + +/**@brief Function for validating that new SoftDevicehas been correctly installed. + * + * @return NRF_SUCCESS if install was successful. NRF_ERROR_NULL if the images differs. + */ +uint32_t dfu_sd_image_validate(void); + +/**@brief Function for swapping existing bootloader with newly received. + * + * @return NRF_SUCCESS on succesfull swapping. For error code please refer to + * \ref sd_mbr_command_copy_bl_t. + */ +uint32_t dfu_bl_image_swap(void); + +/**@brief Function for swapping existing SoftDevice with newly received. + * + * @return NRF_SUCCESS on succesfull swapping. For error code please refer to + * \ref sd_mbr_command_copy_sd_t. + */ +uint32_t dfu_sd_image_swap(void); + +/**@brief Function for handling DFU init packet complete. + * + * @return NRF_SUCCESS on success, an error_code otherwise. + */ +uint32_t dfu_init_pkt_complete(void); + +#endif // DFU_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.c new file mode 100644 index 0000000000..38b3ca4770 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.c @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "dfu_app_handler.h" +#include +#include "bootloader_util.h" +#include "nrf.h" +#include "nrf_sdm.h" +#include "nrf_ble_gatt.h" +#include "nrf_ble_gatts.h" +#include "app_error.h" +#include "dfu_ble_svc.h" +#include "device_manager.h" +#include "nrf_delay.h" + +#define IRQ_ENABLED 0x01 /**< Field that identifies if an interrupt is enabled. */ +#define MAX_NUMBER_INTERRUPTS 32 /**< Maximum number of interrupts available. */ + +static void dfu_app_reset_prepare(void); /**< Forward declaration of default reset handler. */ +static dfu_app_reset_prepare_t m_reset_prepare = dfu_app_reset_prepare; /**< Callback function to application to prepare for system reset. Allows application to clean up service and memory before reset. */ +static dfu_ble_peer_data_t m_peer_data; /**< Peer data to be used for data exchange when resetting into DFU mode. */ +static dm_handle_t m_dm_handle; /**< Device Manager handle with instance IDs of current BLE connection. */ + + +/**@brief Function for reset_prepare handler if the application has not registered a handler. + */ +static void dfu_app_reset_prepare(void) +{ + // Reset prepare should be handled by application. + // This function can be extended to include default handling if application does not implement + // own handler. +} + + +/**@brief Function for disabling all interrupts before jumping from bootloader to application. + */ +static void interrupts_disable(void) +{ + uint32_t interrupt_setting_mask; + uint32_t irq; + + // Fetch the current interrupt settings. + interrupt_setting_mask = NVIC->ISER[0]; + + // Loop from interrupt 0 for disabling of all interrupts. + for (irq = 0; irq < MAX_NUMBER_INTERRUPTS; irq++) + { + if (interrupt_setting_mask & (IRQ_ENABLED << irq)) + { + // The interrupt was enabled, hence disable it. + NVIC_DisableIRQ((IRQn_Type)irq); + } + } +} + + +/**@brief Function for providing peer information to DFU for re-establishing a bonded connection in + * DFU mode. + * + * @param[in] conn_handle Connection handle for the connection requesting DFU mode. + */ +static void dfu_app_peer_data_set(uint16_t conn_handle) +{ + uint32_t err_code; + dm_sec_keyset_t key_set; + uint32_t app_context_data = 0; + dm_application_context_t app_context; + + +/** [DFU bond sharing] */ + err_code = dm_handle_get(conn_handle, &m_dm_handle); + if (err_code == NRF_SUCCESS) + { + err_code = dm_distributed_keys_get(&m_dm_handle, &key_set); + if (err_code == NRF_SUCCESS) + { + APP_ERROR_CHECK(err_code); + + m_peer_data.addr = key_set.keys_central.p_id_key->id_addr_info; + m_peer_data.irk = key_set.keys_central.p_id_key->id_info; + m_peer_data.enc_key.enc_info = key_set.keys_periph.enc_key.p_enc_key->enc_info; + m_peer_data.enc_key.master_id = key_set.keys_periph.enc_key.p_enc_key->master_id; + + err_code = dfu_ble_svc_peer_data_set(&m_peer_data); + APP_ERROR_CHECK(err_code); + + app_context_data = (DFU_APP_ATT_TABLE_CHANGED << DFU_APP_ATT_TABLE_POS); + app_context.len = sizeof(app_context_data); + app_context.p_data = (uint8_t *)&app_context_data; + app_context.flags = 0; + + err_code = dm_application_context_set(&m_dm_handle, &app_context); + APP_ERROR_CHECK(err_code); + } + else + { + // Keys were not available, thus we have a non-encrypted connection. + err_code = dm_peer_addr_get(&m_dm_handle, &m_peer_data.addr); + APP_ERROR_CHECK(err_code); + + err_code = dfu_ble_svc_peer_data_set(&m_peer_data); + APP_ERROR_CHECK(err_code); + } + } +/** [DFU bond sharing] */ +} + + +/**@brief Function for preparing the reset, disabling SoftDevice, and jumping to the bootloader. + * + * @param[in] conn_handle Connection handle for peer requesting to enter DFU mode. + */ +static void bootloader_start(uint16_t conn_handle) +{ + uint32_t err_code; + uint16_t sys_serv_attr_len = sizeof(m_peer_data.sys_serv_attr); + + err_code = sd_ble_gatts_sys_attr_get(conn_handle, + m_peer_data.sys_serv_attr, + &sys_serv_attr_len, + BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS); + if (err_code != NRF_SUCCESS) + { + // Any error at this stage means the system service attributes could not be fetched. + // This means the service changed indication cannot be sent in DFU mode, but connection + // is still possible to establish. + } + + m_reset_prepare(); + + err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START); + APP_ERROR_CHECK(err_code); + + err_code = sd_softdevice_disable(); + APP_ERROR_CHECK(err_code); + + err_code = sd_softdevice_vector_table_base_set(NRF_UICR->NRFFW[0]); + APP_ERROR_CHECK(err_code); + + dfu_app_peer_data_set(conn_handle); + + NVIC_ClearPendingIRQ(SWI2_IRQn); + interrupts_disable(); + bootloader_util_app_start(NRF_UICR->NRFFW[0]); +} + + +void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt) +{ + switch (p_evt->ble_dfu_evt_type) + { + case BLE_DFU_START: + // Starting the bootloader - will cause reset. + bootloader_start(p_dfu->conn_handle); + break; + + default: + { + // Unsupported event received from DFU Service. + // Send back BLE_DFU_RESP_VAL_NOT_SUPPORTED message to peer. + uint32_t err_code = ble_dfu_response_send(p_dfu, + BLE_DFU_START_PROCEDURE, + BLE_DFU_RESP_VAL_NOT_SUPPORTED); + APP_ERROR_CHECK(err_code); + } + break; + } +} + + +void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func) +{ + m_reset_prepare = reset_prepare_func; +} + + +void dfu_app_dm_appl_instance_set(dm_application_instance_t app_instance) +{ + uint32_t err_code; + + err_code = dm_application_instance_set(&app_instance, &m_dm_handle); + APP_ERROR_CHECK(err_code); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.h new file mode 100644 index 0000000000..6f208f1d43 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup nrf_dfu_app_handler DFU BLE packet handling in application + * @{ + * + * @brief Handling of DFU BLE packets in the application. + * + * @details This module implements the handling of DFU packets for switching + * from an application to the bootloader and start DFU mode. The DFU + * packets are transmitted over BLE. + * This module handles only the StartDFU packet, which allows a BLE + * application to expose support for the DFU Service. + * The actual DFU Service runs in a dedicated environment after a BLE + * disconnect and reset of the \nRFXX device. + * The host must reconnect and continue the update procedure with + * access to the full DFU Service. + * + * @note The application must propagate DFU events to this module by calling + * @ref dfu_app_on_dfu_evt from the @ref ble_dfu_evt_handler_t callback. + */ + +#ifndef DFU_APP_HANDLER_H__ +#define DFU_APP_HANDLER_H__ + +#include "ble_dfu.h" +#include "nrf_svc.h" +#include "bootloader_types.h" +#include "device_manager.h" + +#define DFU_APP_ATT_TABLE_POS 0 /**< Position for the ATT table changed setting. */ +#define DFU_APP_ATT_TABLE_CHANGED 1 /**< Value indicating that the ATT table might have changed. This value will be set in the application-specific context in Device Manager when entering DFU mode. */ + +/**@brief DFU application reset_prepare function. This function is a callback that allows the + * application to prepare for an upcoming application reset. + */ +typedef void (*dfu_app_reset_prepare_t)(void); + +/**@brief Function for handling events from the DFU Service. + * + * @details The application must inject this function into the DFU Service or propagate DFU events + * to the dfu_app_handler module by calling this function in the application-specific DFU event + * handler. + * + * @param[in] p_dfu Pointer to the DFU Service structure to which the include event relates. + * @param[in] p_evt Pointer to the DFU event. + */ +void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt); + +/**@brief Function for registering a function to prepare a reset. + * + * @details The provided function is executed before resetting the system into bootloader/DFU + * mode. By registering this function, the caller is notified before the reset and can + * thus prepare the application for reset. For example, the application can gracefully + * disconnect any peers on BLE, turn of LEDS, ensure that all pending flash operations + * have completed, and so on. + * + * @param[in] reset_prepare_func Function to be executed before a reset. + */ +void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func); + +/**@brief Function for setting the Device Manager application instance. + * + * @details This function allows to set the @ref dm_application_instance_t value that is returned by the + * Device Manager when the application registers using @ref dm_register. + * If this function is not called, it is not be possible to share bonding information + * from the application to the bootloader/DFU when entering DFU mode. + * + * @param[in] app_instance Value for the application instance in use. + */ +void dfu_app_dm_appl_instance_set(dm_application_instance_t app_instance); + +#endif // DFU_APP_HANDLER_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_bank_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_bank_internal.h new file mode 100644 index 0000000000..a2dbb80b09 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_bank_internal.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup dfu_bank_internal Device Firmware Update internal header for bank handling in DFU. + * @{ + * + * @brief Device Firmware Update Bank handling module interface. + * + * @details This header is intended for shared definition and functions between single and dual bank + * implementations used for DFU support. It is not supposed to be used for external access + * to the DFU module. + * + */ +#ifndef DFU_BANK_INTERNAL_H__ +#define DFU_BANK_INTERNAL_H__ + +#include + +/**@brief States of the DFU state machine. */ +typedef enum +{ + DFU_STATE_INIT_ERROR, /**< State for: dfu_init(...) error. */ + DFU_STATE_IDLE, /**< State for: idle. */ + DFU_STATE_PREPARING, /**< State for: preparing, indicates that the flash is being erased and no data packets can be processed. */ + DFU_STATE_RDY, /**< State for: ready. */ + DFU_STATE_RX_INIT_PKT, /**< State for: receiving initialization packet. */ + DFU_STATE_RX_DATA_PKT, /**< State for: receiving data packet. */ + DFU_STATE_VALIDATE, /**< State for: validate. */ + DFU_STATE_WAIT_4_ACTIVATE /**< State for: waiting for dfu_image_activate(). */ +} dfu_state_t; + +#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ +#define DFU_TIMEOUT_INTERVAL APP_TIMER_TICKS(120000, APP_TIMER_PRESCALER) /**< DFU timeout interval in units of timer ticks. */ + +#define IS_UPDATING_SD(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_SD) /**< Macro for determining if a SoftDevice update is ongoing. */ +#define IS_UPDATING_BL(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_BL) /**< Macro for determining if a Bootloader update is ongoing. */ +#define IS_UPDATING_APP(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_APP) /**< Macro for determining if a Application update is ongoing. */ +#define IMAGE_WRITE_IN_PROGRESS() (m_data_received > 0) /**< Macro for determining if an image write is in progress. */ +#define IS_WORD_SIZED(SIZE) ((SIZE & (sizeof(uint32_t) - 1)) == 0) /**< Macro for checking that the provided is word sized. */ + +/**@cond NO_DOXYGEN */ +static uint32_t m_data_received; /**< Amount of received data. */ +/**@endcond */ + +/**@brief Type definition of function used for preparing of the bank before receiving of a + * software image. + * + * @param[in] image_size Size of software image being received. + */ +typedef void (*dfu_bank_prepare_t)(uint32_t image_size); + +/**@brief Type definition of function used for handling clear complete of the bank before + * receiving of a software image. + */ +typedef void (*dfu_bank_cleared_t)(void); + +/**@brief Type definition of function used for activating of the software image received. + * + * @return NRF_SUCCESS If the image has been successfully activated any other NRF_ERROR code in + * case of a failure. + */ +typedef uint32_t (*dfu_bank_activate_t)(void); + +/**@brief Structure for holding of function pointers for needed prepare and activate procedure for + * the requested update procedure. + */ +typedef struct +{ + dfu_bank_prepare_t prepare; /**< Function pointer to the prepare function called on start of update procedure. */ + dfu_bank_cleared_t cleared; /**< Function pointer to the cleared function called after prepare function completes. */ + dfu_bank_activate_t activate; /**< Function pointer to the activate function called on finalizing the update procedure. */ +} dfu_bank_func_t; + +#endif // DFU_BANK_INTERNAL_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc.h new file mode 100644 index 0000000000..fe44c98e1a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc.h @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup nrf_dfu_ble_svc DFU BLE SVC + * @{ + * + * @brief DFU BLE SVC in bootloader. The DFU BLE SuperVisor Calls allow an application to execute + * functions in the installed bootloader. + * + * @details This module implements handling of SuperVisor Calls in the bootloader. + * SuperVisor Calls allow for an application to execute calls into the bootloader. + * Currently, it is possible to exchange bonding information (like keys) from the + * application to a bootloader supporting DFU OTA using BLE, so the update process can be + * done through an already existing bond. + * + * @note The application must make sure that all SuperVisor Calls (SVC) are forwarded to the + * bootloader to ensure correct behavior. Forwarding of SVCs to the bootloader is + * done using the SoftDevice SVC @ref sd_softdevice_vector_table_base_set with the value + * present in @c NRF_UICR->NRFFW[0]. + */ + +#ifndef DFU_BLE_SVC_H__ +#define DFU_BLE_SVC_H__ + +#include "nrf_svc.h" +#include +#include "nrf_ble_gap.h" +#include "nrf.h" +#include "nrf_soc.h" +#include "nrf_error_sdm.h" + +#define BOOTLOADER_SVC_BASE 0x0 /**< The number of the lowest SVC number reserved for the bootloader. */ +#define SYSTEM_SERVICE_ATT_SIZE 8 /**< Size of the system service attribute length including CRC-16 at the end. */ + +/**@brief The SVC numbers used by the SVC functions in the SoC library. */ +enum BOOTLOADER_SVCS +{ + DFU_BLE_SVC_PEER_DATA_SET = BOOTLOADER_SVC_BASE, /**< SVC number for the setting of peer data call. */ + BOOTLOADER_SVC_LAST +}; + +/**@brief DFU Peer data structure. + * + * @details This structure contains peer data needed for connection to a bonded device during DFU. + * The peer data must be provided by the application to the bootloader during buttonless + * update. See @ref dfu_ble_svc_peer_data_set. It contains bond information about the + * desired DFU peer. + */ +typedef struct +{ + ble_gap_addr_t addr; /**< BLE GAP address of the device that initiated the DFU process. */ + ble_gap_irk_t irk; /**< IRK of the device that initiated the DFU process if this device uses Private Resolvable Addresses. */ + ble_gap_enc_key_t enc_key; /**< Encryption key structure containing encrypted diversifier and LTK for re-establishing the bond. */ + uint8_t sys_serv_attr[SYSTEM_SERVICE_ATT_SIZE]; /**< System service attributes for restoring of Service Changed Indication setting in DFU mode. */ +} dfu_ble_peer_data_t; + +/**@brief SVC Function for setting peer data containing address, IRK, and LTK to establish bonded + * connection in DFU mode. + * + * @param[in] p_peer_data Pointer to the peer data containing keys for the connection. + * + * @retval NRF_ERROR_NULL If a NULL pointer was provided as argument. + * @retval NRF_SUCCESS If the function completed successfully. + */ +SVCALL(DFU_BLE_SVC_PEER_DATA_SET, uint32_t, dfu_ble_svc_peer_data_set(dfu_ble_peer_data_t * p_peer_data)); + +#endif // DFU_BLE_SVC_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc_internal.h new file mode 100644 index 0000000000..e737a2ef1e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc_internal.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup nrf_dfu_ble_svc_internal DFU BLE SVC internal + * @{ + * + * @brief DFU BLE SVC internal functions in bootloader. The DFU BLE SuperVisor Calls allow an + * application to execute functions in the installed bootloader. This interface provides + * internal Bootloader DFU functions for retrieving data exchanged through SuperVisor Calls. + * + */ + +#ifndef DFU_BLE_SVC_INTERNAL_H__ +#define DFU_BLE_SVC_INTERNAL_H__ + +#include +#include "dfu_ble_svc.h" +#include "ble_gap.h" + +/**@brief Internal bootloader/DFU function for retrieving peer data provided from application. + * + * @param[out] p_peer_data Peer data set by application to be used for DFU connection. + * + * @retval NRF_SUCCESS If peer data is valid and can be used for connection. + * @retval NRF_ERROR_NULL If p_peer_data is a NULL pointer. + * @retval NRF_ERROR_INVALID_DATA If peer data is not available or invalid. + */ +uint32_t dfu_ble_peer_data_get(dfu_ble_peer_data_t * p_peer_data); + +#endif // DFU_BLE_SVC_INTERNAL_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init.h new file mode 100644 index 0000000000..a567576d4e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup nrf_dfu_init Init packet handling in DFU + * @{ + * + * @brief Device Firmware Update module type and function declaration for init packet handling. + * + * @details This header contains basic functionality for performing safety checks on software + * updates for \nRFXX based devices. It provides a skeleton for pre-checking an init packet + * to ensure the following image is compatible with this device. A safety check should + * always be performed to prevent accidental flashing of unsupported applications or a + * wrong combination of application and SoftDevice. + * The device information contains information such as: + * - Device type (2 bytes), for example Heart Rate. The device type is a number defined by + * the customer. It can be located in UICR or FICR. + * - Device revision (2 bytes), for example major revision 1, minor revision 0. The device + * revision is a number defined by the customer. It can be located in UICR or FICR. + * - List of SoftDevices supported by this application, for example + * 0x0049 = S110v6_0_0 + * 0xFFFE = S110 development (any SoftDevice accepted), + * - CRC or hash of firmware image + * + * @note This module does not support security features such as image signing, but the corresponding + * implementation allows for such extensions. + * If the init packet is signed by a trusted source, it must be decrypted before it can be + * processed. + */ + +#ifndef DFU_INIT_H__ +#define DFU_INIT_H__ + +#include +#include "nrf.h" + +/**@brief Structure contained in an init packet. Contains information on device type, revision, and + * supported SoftDevices. + */ +typedef struct +{ + uint16_t device_type; /**< Device type (2 bytes), for example Heart Rate. This number must be defined by the customer before production. It can be located in UICR or FICR. */ + uint16_t device_rev; /**< Device revision (2 bytes), for example major revision 1, minor revision 0. This number must be defined by the customer before production. It can be located in UICR or FICR. */ + uint32_t app_version; /**< Application version for the image software. This field allows for additional checking, for example ensuring that a downgrade is not allowed. */ + uint16_t softdevice_len; /**< Number of different SoftDevice revisions compatible with this application. The list of SoftDevice firmware IDs is defined in @ref softdevice. */ + uint16_t softdevice[1]; /**< Variable length array of SoftDevices compatible with this application. The length of the array is specified in the length field. SoftDevice firmware id 0xFFFE indicates any SoftDevice. */ +} dfu_init_packet_t; + +/**@brief Structure holding basic device information settings. + */ +typedef struct +{ + uint16_t device_type; /**< Device type (2 bytes), for example Heart Rate. This number must be defined by the customer before production. It can be located in UICR or FICR. */ + uint16_t device_rev; /**< Device revision (2 bytes), for example major revision 1, minor revision 0. This number must be defined by the customer before production. It can be located in UICR or FICR. */ +} dfu_device_info_t; + +/** The device info offset can be modified to place the device info settings at a different location. + * If the customer reserved UICR location is used for other application specific data, the offset + * must be updated to avoid collision with that data. + */ +/** [DFU UICR DEV offset] */ +#define UICR_CUSTOMER_DEVICE_INFO_OFFSET 0x0 /**< Device info offset inside the customer UICR reserved area. Customers may change this value to place the device information in a user-preferred location. */ +/** [DFU UICR DEV offset] */ + +#define UICR_CUSTOMER_RESERVED_OFFSET 0x80 /**< Customer reserved area in the UICR. The area from UICR + 0x80 is reserved for customer usage. */ +#define DFU_DEVICE_INFO_BASE (NRF_UICR_BASE + \ + UICR_CUSTOMER_RESERVED_OFFSET + \ + UICR_CUSTOMER_DEVICE_INFO_OFFSET) /**< The device information base address inside of UICR. */ +#define DFU_DEVICE_INFO ((dfu_device_info_t *)DFU_DEVICE_INFO_BASE) /**< The memory mapped structure for device information data. */ + +#define DFU_DEVICE_TYPE_EMPTY ((uint16_t)0xFFFF) /**< Mask indicating no device type is present in UICR. 0xFFFF is default flash pattern when not written with data. */ +#define DFU_DEVICE_REVISION_EMPTY ((uint16_t)0xFFFF) /**< Mask indicating no device revision is present in UICR. 0xFFFF is default flash pattern when not written with data. */ +#define DFU_SOFTDEVICE_ANY ((uint16_t)0xFFFE) /**< Mask indicating that any SoftDevice is allowed for updating this application. Allows for easy development. Not to be used in production images. */ + + +/**@brief DFU prevalidate call for pre-checking the received init packet. + * + * @details Pre-validation will safety check the firmware image to be transfered in second stage. + * The function currently checks the device type, device revision, application firmware + * version, and supported SoftDevices. More checks should be added according to + * customer-specific requirements. + * + * @param[in] p_init_data Pointer to the init packet. If the init packet is encrypted or signed, + * it must first be decrypted before being checked. + * @param[in] init_data_len Length of the init data. + * + * @retval NRF_SUCCESS If the pre-validation succeeded, that means the image is + * supported by the device and it is considered to come from a + * trusted source (signing). + * @retval NRF_ERROR_INVALID_DATA If the pre-validation failed, that means the image is not + * supported by the device or comes from an un-trusted source + * (signing). + * @retval NRF_ERROR_INVALID_LENGTH If the size of the init packet is not within the limits of + * the init packet handler. + */ +uint32_t dfu_init_prevalidate(uint8_t * p_init_data, uint32_t init_data_len); + +/**@brief DFU postvalidate call for post-checking the received image using the init packet. + * + * @details Post-validation can verify the integrity check the firmware image received before + * activating the image. + * Checks performed can be: + * - A simple CRC as shown in the corresponding implementation of this API in the file + * dfu_init_template.c + * - A hash for better verification of the image. + * - A signature to ensure the image originates from a trusted source. + * Checks are intended to be expanded for customer-specific requirements. + * + * @param[in] p_image Pointer to the received image. The init data provided in the call + * \ref dfu_init_prevalidate will be used for validating the image. + * @param[in] image_len Length of the image data. + * + * @retval NRF_SUCCESS If the post-validation succeeded, that meant the integrity of the + * image has been verified and the image originates from a trusted + * source (signing). + * @retval NRF_ERROR_INVALID_DATA If the post-validation failed, that meant the post check of the + * image failed such as the CRC is not matching the image transfered + * or the verification of the image fails (signing). + */ +uint32_t dfu_init_postvalidate(uint8_t * p_image, uint32_t image_len); + +#endif // DFU_INIT_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init_template.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init_template.c new file mode 100644 index 0000000000..cb9e145455 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init_template.c @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup nrf_dfu_init_template Template file with an DFU init packet handling example. + * @{ + * + * @ingroup nrf_dfu + * + * @brief This file contains a template on how to implement DFU init packet handling. + * + * @details The template shows how device type and revision can be used for a safety check of the + * received image. It shows how validation can be performed in two stages: + * - Stage 1: Pre-check of firmware image before transfer to ensure the firmware matches: + * - Device Type. + * - Device Revision. + * Installed SoftDevice. + * This template can be extended with additional checks according to needs. + * For example, such a check could be the origin of the image (trusted source) + * based on a signature scheme. + * - Stage 2: Post-check of the image after image transfer but before installing firmware. + * For example, such a check could be an integrity check in form of hashing or + * verification of a signature. + * In this template, a simple CRC check is carried out. + * The CRC check can be replaced with other mechanisms, like signing. + * + * @note This module does not support security features such as image signing, but the + * implementation allows for such extension. + * If the init packet is signed by a trusted source, it must be decrypted before it can be + * processed. + */ + +#include "dfu_init.h" +#include +#include +#include +#include "nrf_error.h" +#include "crc16.h" + +#define DFU_INIT_PACKET_EXT_LENGTH_MIN 2 //< Minimum length of the extended init packet. The extended init packet may contain a CRC, a HASH, or other data. This value must be changed according to the requirements of the system. The template uses a minimum value of two in order to hold a CRC. */ +#define DFU_INIT_PACKET_EXT_LENGTH_MAX 10 //< Maximum length of the extended init packet. The extended init packet may contain a CRC, a HASH, or other data. This value must be changed according to the requirements of the system. The template uses a maximum value of 10 in order to hold a CRC and any padded data on transport layer without overflow. */ + +static uint8_t m_extended_packet[DFU_INIT_PACKET_EXT_LENGTH_MAX]; //< Data array for storage of the extended data received. The extended data follows the normal init data of type \ref dfu_init_packet_t. Extended data can be used for a CRC, hash, signature, or other data. */ +static uint8_t m_extended_packet_length; //< Length of the extended data received with init packet. */ + + +uint32_t dfu_init_prevalidate(uint8_t * p_init_data, uint32_t init_data_len) +{ + uint32_t i = 0; + + // In order to support signing or encryption then any init packet decryption function / library + // should be called from here or implemented at this location. + + // Length check to ensure valid data are parsed. + if (init_data_len < sizeof(dfu_init_packet_t)) + { + return NRF_ERROR_INVALID_LENGTH; + } + + // Current template uses clear text data so they can be casted for pre-check. + dfu_init_packet_t * p_init_packet = (dfu_init_packet_t *)p_init_data; + + m_extended_packet_length = ((uint32_t)p_init_data + init_data_len) - + (uint32_t)&p_init_packet->softdevice[p_init_packet->softdevice_len]; + if (m_extended_packet_length < DFU_INIT_PACKET_EXT_LENGTH_MIN) + { + return NRF_ERROR_INVALID_LENGTH; + } + + if (((uint32_t)p_init_data + init_data_len) < + (uint32_t)&p_init_packet->softdevice[p_init_packet->softdevice_len]) + { + return NRF_ERROR_INVALID_LENGTH; + } + + memcpy(m_extended_packet, + &p_init_packet->softdevice[p_init_packet->softdevice_len], + m_extended_packet_length); + +/** [DFU init application version] */ + // To support application versioning, this check should be updated. + // This template allows for any application to be installed. However, + // customers can place a revision number at the bottom of the application + // to be verified by the bootloader. This can be done at a location + // relative to the application, for example the application start + // address + 0x0100. +/** [DFU init application version] */ + + // First check to verify the image to be transfered matches the device type. + // If no Device type is present in DFU_DEVICE_INFO then any image will be accepted. + if ((DFU_DEVICE_INFO->device_type != DFU_DEVICE_TYPE_EMPTY) && + (p_init_packet->device_type != DFU_DEVICE_INFO->device_type)) + { + return NRF_ERROR_INVALID_DATA; + } + + // Second check to verify the image to be transfered matches the device revision. + // If no Device revision is present in DFU_DEVICE_INFO then any image will be accepted. + if ((DFU_DEVICE_INFO->device_rev != DFU_DEVICE_REVISION_EMPTY) && + (p_init_packet->device_rev != DFU_DEVICE_INFO->device_rev)) + { + return NRF_ERROR_INVALID_DATA; + } + + // Third check: Check the array of supported SoftDevices by this application. + // If the installed SoftDevice does not match any SoftDevice in the list then an + // error is returned. + while (i < p_init_packet->softdevice_len) + { + if (p_init_packet->softdevice[i] == DFU_SOFTDEVICE_ANY || + p_init_packet->softdevice[i++] == SD_FWID_GET(MBR_SIZE)) + { + return NRF_SUCCESS; + } + } + + // No matching SoftDevice found - Return NRF_ERROR_INVALID_DATA. + return NRF_ERROR_INVALID_DATA; +} + + +uint32_t dfu_init_postvalidate(uint8_t * p_image, uint32_t image_len) +{ + uint16_t image_crc; + uint16_t received_crc; + + // In order to support hashing (and signing) then the (decrypted) hash should be fetched and + // the corresponding hash should be calculated over the image at this location. + // If hashing (or signing) is added to the system then the CRC validation should be removed. + + // calculate CRC from active block. + image_crc = crc16_compute(p_image, image_len, NULL); + + // Decode the received CRC from extended data. + received_crc = uint16_decode((uint8_t *)&m_extended_packet[0]); + + // Compare the received and calculated CRC. + if (image_crc != received_crc) + { + return NRF_ERROR_INVALID_DATA; + } + + return NRF_SUCCESS; +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_transport.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_transport.h new file mode 100644 index 0000000000..20fe4c81ba --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_transport.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup nrf_dfu_transport DFU transport API. + * @{ + * + * @brief DFU transport module interface. + */ + +#ifndef DFU_TRANSPORT_H__ +#define DFU_TRANSPORT_H__ + +#include + +/**@brief Function for starting the update of Device Firmware. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t dfu_transport_update_start(void); + +/**@brief Function for closing the transport layer. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t dfu_transport_close(void); + +#endif // DFU_TRANSPORT_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_types.h new file mode 100644 index 0000000000..7a7421d878 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_types.h @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup nrf_dfu_types Types and definitions. + * @{ + * + * @ingroup nrf_dfu + * + * @brief Device Firmware Update module type and definitions. + */ + +#ifndef DFU_TYPES_H__ +#define DFU_TYPES_H__ + +#include +#include "nrf_sdm.h" +#include "nrf_mbr.h" +#include "nrf.h" +#include "app_util.h" + +#define NRF_UICR_BOOT_START_ADDRESS (NRF_UICR_BASE + 0x14) /**< Register where the bootloader start address is stored in the UICR register. */ + +#if defined(NRF52) +#define NRF_UICR_MBR_PARAMS_PAGE_ADDRESS (NRF_UICR_BASE + 0x18) /**< Register where the mbr params page is stored in the UICR register. (Only in use in nRF52 MBR).*/ +#endif + +#define CODE_REGION_1_START SD_SIZE_GET(MBR_SIZE) /**< This field should correspond to the size of Code Region 0, (which is identical to Start of Code Region 1), found in UICR.CLEN0 register. This value is used for compile safety, as the linker will fail if application expands into bootloader. Runtime, the bootloader will use the value found in UICR.CLEN0. */ +#define SOFTDEVICE_REGION_START MBR_SIZE /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */ + +#ifdef NRF51 + +#define CODE_PAGE_SIZE 0x0400 /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */ + +#ifdef SIGNING + +#define BOOTLOADER_REGION_START 0x00039C00 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */ +#define BOOTLOADER_SETTINGS_ADDRESS 0x0003D800 /**< The field specifies the page location of the bootloader settings address. */ + +#else + +#define BOOTLOADER_REGION_START 0x0003C000 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */ +#define BOOTLOADER_SETTINGS_ADDRESS 0x0003FC00 /**< The field specifies the page location of the bootloader settings address. */ + +#endif + + + +#elif NRF52 + +#define BOOTLOADER_REGION_START 0x0007A000 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */ +#define BOOTLOADER_SETTINGS_ADDRESS 0x0007F000 /**< The field specifies the page location of the bootloader settings address. */ +#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x0007E000 /**< The field specifies the page location of the mbr params page address. */ + +#define CODE_PAGE_SIZE 0x1000 /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */ + +#else + +#error No target defined + +#endif + +#define DFU_REGION_TOTAL_SIZE (BOOTLOADER_REGION_START - CODE_REGION_1_START) /**< Total size of the region between SD and Bootloader. */ + +#ifndef DFU_APP_DATA_RESERVED +#define DFU_APP_DATA_RESERVED CODE_PAGE_SIZE * 0 /**< Size of Application Data that must be preserved between application updates. This value must be a multiple of page size. Page size is 0x400 (1024d) bytes, thus this value must be 0x0000, 0x0400, 0x0800, 0x0C00, 0x1000, etc. */ +#endif + +#define DFU_IMAGE_MAX_SIZE_FULL (DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED) /**< Maximum size of an application, excluding save data from the application. */ + +#define DFU_IMAGE_MAX_SIZE_BANKED (((DFU_IMAGE_MAX_SIZE_FULL) - \ + (DFU_IMAGE_MAX_SIZE_FULL % (2 * CODE_PAGE_SIZE)))/2) /**< Maximum size of an application, excluding save data from the application. */ + +#define DFU_BL_IMAGE_MAX_SIZE (BOOTLOADER_SETTINGS_ADDRESS - BOOTLOADER_REGION_START) /**< Maximum size of a bootloader, excluding save data from the current bootloader. */ + +#define DFU_BANK_0_REGION_START CODE_REGION_1_START /**< Bank 0 region start. */ +#define DFU_BANK_1_REGION_START (DFU_BANK_0_REGION_START + DFU_IMAGE_MAX_SIZE_BANKED) /**< Bank 1 region start. */ + +#define EMPTY_FLASH_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */ + +#define INVALID_PACKET 0x00 /**< Invalid packet identifies. */ +#define INIT_PACKET 0x01 /**< Packet identifies for initialization packet. */ +#define STOP_INIT_PACKET 0x02 /**< Packet identifies for stop initialization packet. Used when complete init packet has been received so that the init packet can be used for pre validaiton. */ +#define START_PACKET 0x03 /**< Packet identifies for the Data Start Packet. */ +#define DATA_PACKET 0x04 /**< Packet identifies for a Data Packet. */ +#define STOP_DATA_PACKET 0x05 /**< Packet identifies for the Data Stop Packet. */ + +#define DFU_UPDATE_SD 0x01 /**< Bit field indicating update of SoftDevice is ongoing. */ +#define DFU_UPDATE_BL 0x02 /**< Bit field indicating update of bootloader is ongoing. */ +#define DFU_UPDATE_APP 0x04 /**< Bit field indicating update of application is ongoing. */ + +#define DFU_INIT_RX 0x00 /**< Op Code identifies for receiving init packet. */ +#define DFU_INIT_COMPLETE 0x01 /**< Op Code identifies for transmission complete of init packet. */ + +// Safe guard to ensure during compile time that the DFU_APP_DATA_RESERVED is a multiple of page size. +STATIC_ASSERT((((DFU_APP_DATA_RESERVED) & (CODE_PAGE_SIZE - 1)) == 0x00)); + +/**@brief Structure holding a start packet containing update mode and image sizes. + */ +typedef struct +{ + uint8_t dfu_update_mode; /**< Packet type, used to identify the content of the received packet referenced by data packet. */ + uint32_t sd_image_size; /**< Size of the SoftDevice image to be transferred. Zero if no SoftDevice image will be transfered. */ + uint32_t bl_image_size; /**< Size of the Bootloader image to be transferred. Zero if no Bootloader image will be transfered. */ + uint32_t app_image_size; /**< Size of the application image to be transmitted. Zero if no Bootloader image will be transfered. */ +} dfu_start_packet_t; + +/**@brief Structure holding a bootloader init/data packet received. + */ +typedef struct +{ + uint32_t packet_length; /**< Packet length of the data packet. Each data is word size, meaning length of 4 is 4 words, not bytes. */ + uint32_t * p_data_packet; /**< Data Packet received. Each data is a word size entry. */ +} dfu_data_packet_t; + +/**@brief Structure for holding dfu update packet. Packet type indicate the type of packet. + */ +typedef struct +{ + uint32_t packet_type; /**< Packet type, used to identify the content of the received packet referenced by data packet. */ + union + { + dfu_data_packet_t data_packet; /**< Used when packet type is INIT_PACKET or DATA_PACKET. Packet contains data received for init or data. */ + dfu_start_packet_t * start_packet; /**< Used when packet type is START_DATA_PACKET. Will contain information on software to be updtaed, i.e. SoftDevice, Bootloader and/or Application along with image sizes. */ + } params; +} dfu_update_packet_t; + +/**@brief DFU status error codes. +*/ +typedef enum +{ + DFU_UPDATE_APP_COMPLETE, /**< Status update of application complete.*/ + DFU_UPDATE_SD_COMPLETE, /**< Status update of SoftDevice update complete. Note that this solely indicates that a new SoftDevice has been received and stored in bank 0 and 1. */ + DFU_UPDATE_SD_SWAPPED, /**< Status update of SoftDevice update complete. Note that this solely indicates that a new SoftDevice has been received and stored in bank 0 and 1. */ + DFU_UPDATE_BOOT_COMPLETE, /**< Status update complete.*/ + DFU_BANK_0_ERASED, /**< Status bank 0 erased.*/ + DFU_TIMEOUT, /**< Status timeout.*/ + DFU_RESET /**< Status Reset to indicate current update procedure has been aborted and system should reset. */ +} dfu_update_status_code_t; + +/**@brief Structure holding DFU complete event. +*/ +typedef struct +{ + dfu_update_status_code_t status_code; /**< Device Firmware Update status. */ + uint16_t app_crc; /**< CRC of the recieved application. */ + uint32_t sd_size; /**< Size of the recieved SoftDevice. */ + uint32_t bl_size; /**< Size of the recieved BootLoader. */ + uint32_t app_size; /**< Size of the recieved Application. */ + uint32_t sd_image_start; /**< Location in flash where the received SoftDevice image is stored. */ +} dfu_update_status_t; + +/**@brief Update complete handler type. */ +typedef void (*dfu_complete_handler_t)(dfu_update_status_t dfu_update_status); + +#endif // DFU_TYPES_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h new file mode 100644 index 0000000000..8f5d83ba0c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup memory_pool_internal Memory Pool Internal + * @{ + * @ingroup memory_pool + * + * @brief Memory pool internal definitions + */ + +#ifndef MEM_POOL_INTERNAL_H__ +#define MEM_POOL_INTERNAL_H__ + +#define TX_BUF_SIZE 32u /**< TX buffer size in bytes. */ +#define RX_BUF_SIZE 600u /**< RX buffer size in bytes. */ + +#define RX_BUF_QUEUE_SIZE 2u /**< RX buffer element size. */ + +#endif // MEM_POOL_INTERNAL_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_transport_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_transport_config.h new file mode 100644 index 0000000000..8b7a4f41c2 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_transport_config.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup ble_sdk_bootloader_hci_congfig HCI Transport Layer Configuration + * @{ + * @ingroup dfu_bootloader_api + * @brief Definition of HCI Transport Layer configurable parameters + */ + +#ifndef HCI_TRANSPORT_CONFIG_H__ +#define HCI_TRANSPORT_CONFIG_H__ + +#include "boards.h" /**< Default include for boards.h which means that default pin numbers will be used for RX, TX, CTS, and RTS on the UART. Other pin number can be used if desired. */ + +/** This section covers configurable parameters for the HCI Transport SLIP layer. */ +#define HCI_SLIP_UART_RX_PIN_NUMBER RX_PIN_NUMBER /**< Defines the UART RX pin number. The default pin for the board is chosen, but can be overwritten. */ + +#define HCI_SLIP_UART_TX_PIN_NUMBER TX_PIN_NUMBER /**< Defines the UART TX pin number. The default pin for the board is chosen, but can be overwritten. */ + +#define HCI_SLIP_UART_RTS_PIN_NUMBER RTS_PIN_NUMBER /**< Defines the UART RTS pin number. The default pin for the board is chosen, but can be overwritten. */ + +#define HCI_SLIP_UART_CTS_PIN_NUMBER CTS_PIN_NUMBER /**< Defines the UART CTS pin number. The default pin for the board is chosen, but can be overwritten. */ + +#define HCI_SLIP_UART_MODE APP_UART_FLOW_CONTROL_DISABLED /**< Defines the UART mode to be used. Use UART Low Power with Flow Control - Valid values are defined in \ref app_uart_flow_control_t. For further information on the UART Low Power mode, please refer to: \ref app_uart . */ + +#define HCI_SLIP_UART_BAUDRATE UART_BAUDRATE_BAUDRATE_Baud38400 /**< Defines the UART Baud rate. Default is 38400 baud. */ + +/** This section covers configurable parameters for the HCI Transport layer that are used for calculating correct value for the retransmission timer timeout. */ +#define MAX_PACKET_SIZE_IN_BITS 8000u /**< Maximum size of a single application packet in bits. */ +#define USED_BAUD_RATE 38400u /**< The used uart baudrate. */ + +#endif // HCI_TRANSPORT_CONFIG_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.c new file mode 100644 index 0000000000..76180a86e8 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "crc16.h" + +#include + +uint16_t crc16_compute(uint8_t const * p_data, uint32_t size, uint16_t const * p_crc) +{ + uint16_t crc = (p_crc == NULL) ? 0xFFFF : *p_crc; + + for (uint32_t i = 0; i < size; i++) + { + crc = (uint8_t)(crc >> 8) | (crc << 8); + crc ^= p_data[i]; + crc ^= (uint8_t)(crc & 0xFF) >> 4; + crc ^= (crc << 8) << 4; + crc ^= ((crc & 0xFF) << 4) << 1; + } + + return crc; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.h new file mode 100644 index 0000000000..d57197ed9c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup crc_compute CRC compute + * @{ + * @ingroup hci_transport + * + * @brief This module implements CRC-16-CCITT (polynomial 0x1021) with 0xFFFF initial value. + * The data can be passed in multiple blocks. + */ + +#ifndef CRC16_H__ +#define CRC16_H__ + +#include + +/**@brief Function for calculating CRC-16 in blocks. + * + * Feed each consecutive data block into this function, along with the current value of p_crc as + * returned by the previous call of this function. The first call of this function should pass NULL + * as the initial value of the crc in p_crc. + * + * @param[in] p_data The input data block for computation. + * @param[in] size The size of the input data block in bytes. + * @param[in] p_crc The previous calculated CRC-16 value or NULL if first call. + * + * @return The updated CRC-16 value, based on the input supplied. + */ +uint16_t crc16_compute(uint8_t const * p_data, uint32_t size, uint16_t const * p_crc); + +#endif // CRC16_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/experimental_section_vars/section_vars.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/experimental_section_vars/section_vars.h new file mode 100644 index 0000000000..abd489b06c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/experimental_section_vars/section_vars.h @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef SECTION_VARS_H__ +#define SECTION_VARS_H__ + + +/** + * @defgroup section_vars Section variables + * @ingroup app_common + * @{ + * + * @brief Section variables. + */ + +#if defined(__ICCARM__) +// Enable IAR language extensions +#pragma language=extended +#endif + + +// Macro to delay macro expansion. +#define NRF_PRAGMA(x) _Pragma(#x) + + +/**@brief Macro to register a named section. + * + * @param[in] section_name Name of the section to register. + */ +#if defined(__CC_ARM) + +// Not required by this compiler. +#define NRF_SECTION_VARS_REGISTER_SECTION(section_name) + +#elif defined(__GNUC__) + +// Not required by this compiler. +#define NRF_SECTION_VARS_REGISTER_SECTION(section_name) + +#elif defined(__ICCARM__) + +#define NRF_SECTION_VARS_REGISTER_SECTION(section_name) NRF_PRAGMA(section = #section_name) + +#endif + + +/*lint -save -e27 */ + +/**@brief Macro to obtain the linker symbol for the beginning of a given section. + * + * @details The symbol that this macro resolves to is used to obtain a section start address. + * + * @param[in] section_name Name of the section. + */ +#if defined(__CC_ARM) + +#define NRF_SECTION_VARS_START_SYMBOL(section_name) section_name ## $$Base + +#elif defined(__GNUC__) + +#define NRF_SECTION_VARS_START_SYMBOL(section_name) __start_ ## section_name + +#elif defined(__ICCARM__) + +#define NRF_SECTION_VARS_START_SYMBOL(section_name) __section_begin(#section_name) + +#endif + + +/**@brief Macro to obtain the linker symbol for the end of a given section. + * + * @details The symbol that this macro resolves to is used to obtain a section end address. + * + * @param[in] section_name Name of the section. + */ +#if defined(__CC_ARM) + +#define NRF_SECTION_VARS_END_SYMBOL(section_name) section_name ## $$Limit + +#elif defined(__GNUC__) + +#define NRF_SECTION_VARS_END_SYMBOL(section_name) __stop_ ## section_name + +#elif defined(__ICCARM__) + +#define NRF_SECTION_VARS_END_SYMBOL(section_name) __section_end(#section_name) + +#endif + +/*lint -restore */ + + +/**@brief Macro for retrieving the length of a given section, in bytes. + * + * @param[in] section_name Name of the section. + */ +#if defined(__CC_ARM) + +#define NRF_SECTION_VARS_LENGTH(section_name) \ + ((uint32_t)&NRF_SECTION_VARS_END_SYMBOL(section_name) - (uint32_t)&NRF_SECTION_VARS_START_SYMBOL(section_name)) + +#elif defined(__GNUC__) + + #define NRF_SECTION_VARS_LENGTH(section_name) \ + ((uint32_t)&NRF_SECTION_VARS_END_SYMBOL(section_name) - (uint32_t)&NRF_SECTION_VARS_START_SYMBOL(section_name)) + +#elif defined(__ICCARM__) + + #define NRF_SECTION_VARS_LENGTH(section_name) \ + ((uint32_t)NRF_SECTION_VARS_END_SYMBOL(section_name) - (uint32_t)NRF_SECTION_VARS_START_SYMBOL(section_name)) + +#endif + + +/**@brief Macro to obtain the start address of a named section. + * + * param[in] section_name Name of the section. + */ +#if defined(__CC_ARM) + +#define NRF_SECTION_VARS_START_ADDR(section_name) (uint32_t)&NRF_SECTION_VARS_START_SYMBOL(section_name) + +#elif defined(__GNUC__) + +#define NRF_SECTION_VARS_START_ADDR(section_name) (uint32_t)&NRF_SECTION_VARS_START_SYMBOL(section_name) + +#elif defined(__ICCARM__) + +#define NRF_SECTION_VARS_START_ADDR(section_name) (uint32_t)iar_ ## section_name ## _start + +#endif + + +/*@brief Macro to obtain the end address of a named section. + * + * @param[in] section_name Name of the section. + */ +#if defined(__CC_ARM) + +#define NRF_SECTION_VARS_END_ADDR(section_name) (uint32_t)&NRF_SECTION_VARS_END_SYMBOL(section_name) + +#elif defined(__GNUC__) + +#define NRF_SECTION_VARS_END_ADDR(section_name) (uint32_t)&NRF_SECTION_VARS_END_SYMBOL(section_name) + +#elif defined(__ICCARM__) + +#define NRF_SECTION_VARS_END_ADDR(section_name) (uint32_t)iar_ ## section_name ## _end + +#endif + + +/**@brief Macro to extern a named section start and stop symbols. + * + * @note These declarations are required for GCC and Keil linkers (but not for IAR's). + * + * @param[in] type_name Name of the type stored in the section. + * @param[in] section_name Name of the section. + */ +#if defined(__CC_ARM) + +#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name) \ + extern type_name * NRF_SECTION_VARS_START_SYMBOL(section_name); \ + extern void * NRF_SECTION_VARS_END_SYMBOL(section_name) + +#elif defined(__GNUC__) + +#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name) \ + extern type_name * NRF_SECTION_VARS_START_SYMBOL(section_name); \ + extern void * NRF_SECTION_VARS_END_SYMBOL(section_name) + +#elif defined(__ICCARM__) + +// No symbol registration required for IAR. +#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name) \ + extern void * iar_ ## section_name ## _start = __section_begin(#section_name); \ + extern void * iar_ ## section_name ## _end = __section_end(#section_name) + +#endif + + +/**@brief Macro to declare a variable to be placed in a named section. + * + * @details Declares a variable to be placed in a named section. This macro ensures that its symbol + * is not stripped by the linker because of optimizations. + * + * @warning The order with which variables are placed in a section is implementation dependant. + * Generally, variables are placed in a section depending on the order with which they + * are found by the linker. + * + * @warning The symbols added in the named section must be word aligned to prevent padding. + * + * @param[in] section_name Name of the section. + * @param[in] type_def Datatype of the variable to place in the given section. + */ +#if defined(__CC_ARM) + +#define NRF_SECTION_VARS_ADD(section_name, type_def) \ + static type_def __attribute__ ((section(#section_name))) __attribute__((used)) + +#elif defined(__GNUC__) + +#define NRF_SECTION_VARS_ADD(section_name, type_def) \ + static type_def __attribute__ ((section("."#section_name))) __attribute__((used)) + +#elif defined(__ICCARM__) + +#define NRF_SECTION_VARS_ADD(section_name, type_def) \ + __root type_def @ #section_name + +#endif + + +/**@brief Macro to get symbol from named section. + * + * @warning The stored symbol can only be resolved using this macro if the + * type of the data is word aligned. The operation of acquiring + * the stored symbol relies on sizeof of the stored type, no + * padding can exist in the named section in between individual + * stored items or this macro will fail. + * + * @param[in] i Index of item in section. + * @param[in] type_name Type name of item in section. + * @param[in] section_name Name of the section. + */ +#if defined(__CC_ARM) + +#define NRF_SECTION_VARS_GET(i, type_name, section_name) \ + (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name)) + +#elif defined(__GNUC__) + +#define NRF_SECTION_VARS_GET(i, type_name, section_name) \ + (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name)) + +#elif defined(__ICCARM__) + +#define NRF_SECTION_VARS_GET(i, type_name, section_name) \ + (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name)) + +#endif + + +/**@brief Macro to get number of items in named section. + * + * @param[in] type_name Type name of item in section. + * @param[in] section_name Name of the section. + */ +#define NRF_SECTION_VARS_COUNT(type_name, section_name) \ + NRF_SECTION_VARS_LENGTH(section_name) / sizeof(type_name) + +/** @} */ + +#endif // SECTION_VARS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/config/fds_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/config/fds_config.h new file mode 100644 index 0000000000..dbcf872748 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/config/fds_config.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef FDS_CONFIG_H__ +#define FDS_CONFIG_H__ + + /** + * @file fds_config.h + * + * @defgroup flash_data_storage_config Configuration options + * @ingroup flash_data_storage + * @{ + * @brief Configuration options for FDS. + */ + +/**@brief Configures the size of the internal queue. */ +#define FDS_OP_QUEUE_SIZE (4) + +/**@brief Determines how many @ref fds_record_chunk_t structures can be buffered at any time. */ +#define FDS_CHUNK_QUEUE_SIZE (8) + +/**@brief Configures the maximum number of callbacks that can be registered. */ +#define FDS_MAX_USERS (3) + +/**@brief Configures the number of virtual flash pages to use. + * + * The total amount of flash memory that is used by FDS amounts to + * @ref FDS_VIRTUAL_PAGES * @ref FDS_VIRTUAL_PAGE_SIZE * 4 bytes. + * On nRF51 ICs, this defaults to 3 * 256 * 4 bytes = 3072 bytes. + * On nRF52 ICs, it defaults to 3 * 1024 * 4 bytes = 12288 bytes. + * + * One of the virtual pages is reserved by the system for garbage collection. Therefore, the + * minimum is two virtual pages: one page to store data and one page to be used by the system for + * garbage collection. + */ +#define FDS_VIRTUAL_PAGES (3) + +/**@brief Configures the size of a virtual page of flash memory, expressed in number of + * 4-byte words. + * + * By default, a virtual page is the same size as a physical page. Therefore, the default size + * is 1024 bytes for nRF51 ICs and 4096 bytes for nRF52 ICs. + * + * The size of a virtual page must be a multiple of the size of a physical page. + */ +#if defined(NRF51) + #define FDS_VIRTUAL_PAGE_SIZE (256) +#elif defined(NRF52) + #define FDS_VIRTUAL_PAGE_SIZE (1024) +#endif + +/** @} */ + +#endif // FDS_CONFIG_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c new file mode 100644 index 0000000000..309a306d0d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c @@ -0,0 +1,2085 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "fds.h" +#include "fds_config.h" +#include "fds_internal_defs.h" + +#include +#include +#include +#include "fstorage.h" +#include "app_util.h" +#include "nrf_error.h" + +#if defined(FDS_CRC_ENABLED) + #include "crc16.h" +#endif + + +static void fs_event_handler(fs_evt_t const * const evt, fs_ret_t result); + +// Our fstorage configuration. +FS_REGISTER_CFG(fs_config_t fs_config) = +{ + .callback = fs_event_handler, + .num_pages = FDS_PHY_PAGES, + // We register with the highest priority in order to be assigned + // the pages with the highest memory address (closest to the bootloader). + .priority = 0xFF +}; + +// Used to flag a record as dirty, i.e. ready for garbage collection. +static fds_tl_t const m_fds_tl_dirty = +{ + .record_key = FDS_RECORD_KEY_DIRTY, + .length_words = 0xFFFF // Leave the record length field unchanged in flash. +}; + +// Internal status flags. +static uint8_t m_flags; + +// The number of registered users and their callback functions. +static uint8_t m_users; +static fds_cb_t m_cb_table[FDS_MAX_USERS]; + +// The latest (largest) record ID written so far. +static uint32_t m_latest_rec_id; + +// The internal queues. +static fds_op_queue_t m_op_queue; +static fds_chunk_queue_t m_chunk_queue; + +// Structures used to hold informations about virtual pages. +static fds_page_t m_pages[FDS_MAX_PAGES]; +static fds_swap_page_t m_swap_page; + +// Garbage collection data. +static fds_gc_data_t m_gc; + + +static void flag_set(fds_flags_t flag) +{ + CRITICAL_SECTION_ENTER(); + m_flags |= flag; + CRITICAL_SECTION_EXIT(); +} + + +static void flag_clear(fds_flags_t flag) +{ + CRITICAL_SECTION_ENTER(); + m_flags &= ~(flag); + CRITICAL_SECTION_EXIT(); +} + + +static bool flag_is_set(fds_flags_t flag) +{ + return (m_flags & flag); +} + + +static void event_send(fds_evt_t const * const p_evt) +{ + for (uint32_t user = 0; user < FDS_MAX_USERS; user++) + { + if (m_cb_table[user] != NULL) + { + m_cb_table[user](p_evt); + } + } +} + + +static void event_prepare(fds_op_t const * const p_op, fds_evt_t * const p_evt) +{ + switch (p_op->op_code) + { + case FDS_OP_INIT: + p_evt->id = FDS_EVT_INIT; + break; + + case FDS_OP_WRITE: + p_evt->id = FDS_EVT_WRITE; + p_evt->write.file_id = p_op->write.header.ic.file_id; + p_evt->write.record_key = p_op->write.header.tl.record_key; + p_evt->write.record_id = p_op->write.header.record_id; + break; + + case FDS_OP_UPDATE: + p_evt->id = FDS_EVT_UPDATE; + p_evt->write.file_id = p_op->write.header.ic.file_id; + p_evt->write.record_key = p_op->write.header.tl.record_key; + p_evt->write.record_id = p_op->write.header.record_id; + p_evt->write.is_record_updated = (p_op->write.step == FDS_OP_WRITE_DONE); + break; + + case FDS_OP_DEL_RECORD: + p_evt->id = FDS_EVT_DEL_RECORD; + p_evt->del.file_id = p_op->del.file_id; + p_evt->del.record_key = p_op->del.record_key; + p_evt->del.record_id = p_op->del.record_to_delete; + break; + + case FDS_OP_DEL_FILE: + p_evt->id = FDS_EVT_DEL_FILE; + p_evt->del.file_id = p_op->del.file_id; + p_evt->del.record_key = FDS_RECORD_KEY_DIRTY; + break; + + case FDS_OP_GC: + p_evt->id = FDS_EVT_GC; + break; + + default: + // Should not happen. + break; + } +} + + +static bool header_is_valid(fds_header_t const * const p_header) +{ + return ((p_header->ic.file_id != FDS_FILE_ID_INVALID) && + (p_header->tl.record_key != FDS_RECORD_KEY_DIRTY)); +} + + +static bool address_is_valid(uint32_t const * const p_addr) +{ + return ((p_addr != NULL) && + (p_addr >= fs_config.p_start_addr) && + (p_addr <= fs_config.p_end_addr) && + (is_word_aligned(p_addr))); +} + + +static bool chunk_is_aligned(fds_record_chunk_t const * const p_chunk, uint32_t num_chunks) +{ + for (uint32_t i = 0; i < num_chunks; i++) + { + if (!is_word_aligned(p_chunk[i].p_data)) + { + return false; + } + } + return true; +} + + +// Reads a page tag, and determines if the page is used to store data or as swap. +static fds_page_type_t page_identify(uint32_t const * const p_page_addr) +{ + if (p_page_addr[FDS_PAGE_TAG_WORD_0] != FDS_PAGE_TAG_MAGIC) + { + return FDS_PAGE_UNDEFINED; + } + + switch (p_page_addr[FDS_PAGE_TAG_WORD_1]) + { + case FDS_PAGE_TAG_SWAP: + return FDS_PAGE_SWAP; + + case FDS_PAGE_TAG_DATA: + return FDS_PAGE_DATA; + + default: + return FDS_PAGE_UNDEFINED; + } +} + + +static bool page_is_erased(uint32_t const * const p_page_addr) +{ + for (uint32_t i = 0; i < FDS_PAGE_SIZE; i++) + { + if (*(p_page_addr + i) != FDS_ERASED_WORD) + { + return false; + } + } + + return true; +} + + +// NOTE: Must be called from within a critical section. +static bool page_has_space(uint16_t page, uint16_t length_words) +{ + length_words += m_pages[page].write_offset; + length_words += m_pages[page].words_reserved; + return (length_words < FDS_PAGE_SIZE); +} + + +// Given a pointer to a record, find the index of the page on which it is stored. +// Returns FDS_SUCCESS if the page is found, FDS_ERR_NOT_FOUND otherwise. +static ret_code_t page_from_record(uint16_t * const p_page, uint32_t const * const p_rec) +{ + ret_code_t ret = FDS_ERR_NOT_FOUND; + + CRITICAL_SECTION_ENTER(); + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + if ((p_rec > m_pages[i].p_addr) && + (p_rec < m_pages[i].p_addr + FDS_PAGE_SIZE)) + { + ret = FDS_SUCCESS; + *p_page = i; + break; + } + } + CRITICAL_SECTION_EXIT(); + + return ret; +} + + +// Scan a page to determine how many words have been written to it. +// This information is used to set the page write offset during initialization. +// Additionally, this function updates the latest record ID as it proceeds. +// If an invalid record header is found, the can_gc argument is set to true. +static void page_scan(uint32_t const * p_addr, + uint16_t * const words_written, + bool * const can_gc) +{ + uint32_t const * const p_end_addr = p_addr + FDS_PAGE_SIZE; + bool dirty_record_found = false; + + p_addr += FDS_PAGE_TAG_SIZE; + *words_written = FDS_PAGE_TAG_SIZE; + + while ((p_addr < p_end_addr) && (*p_addr != FDS_ERASED_WORD)) + { + // NOTE: Skip records with a dirty key or with a missing file ID. + fds_header_t const * const p_header = (fds_header_t*)p_addr; + + if (!header_is_valid(p_header)) + { + dirty_record_found = true; + } + else + { + // Update the latest (largest) record ID. + if (p_header->record_id > m_latest_rec_id) + { + m_latest_rec_id = p_header->record_id; + } + } + + // Jump to the next record. + p_addr += (FDS_HEADER_SIZE + p_header->tl.length_words); + *words_written += (FDS_HEADER_SIZE + p_header->tl.length_words); + } + + if (can_gc != NULL) + { + *can_gc = dirty_record_found; + } +} + + +static void page_offsets_update(fds_page_t * const p_page, uint16_t length_words) +{ + p_page->write_offset += (FDS_HEADER_SIZE + length_words); + p_page->words_reserved -= (FDS_HEADER_SIZE + length_words); +} + + +// Tags a page as swap, i.e., reserved for GC. +static ret_code_t page_tag_write_swap() +{ + // Needs to be statically allocated since it will be written to flash. + static uint32_t const page_tag_swap[] = {FDS_PAGE_TAG_MAGIC, FDS_PAGE_TAG_SWAP}; + return fs_store(&fs_config, m_swap_page.p_addr, page_tag_swap, FDS_PAGE_TAG_SIZE); +} + + +// Tags a page as data, i.e, ready for storage. +static ret_code_t page_tag_write_data(uint32_t const * const p_page_addr) +{ + // Needs to be statically allocated since it will be written to flash. + static uint32_t const page_tag_data[] = {FDS_PAGE_TAG_MAGIC, FDS_PAGE_TAG_DATA}; + return fs_store(&fs_config, p_page_addr, page_tag_data, FDS_PAGE_TAG_SIZE); +} + + +// Reserve space on a page. +// NOTE: this function takes into the account the space required for the record header. +static ret_code_t write_space_reserve(uint16_t length_words, uint16_t * p_page) +{ + bool space_reserved = false; + uint16_t const total_len_words = length_words + FDS_HEADER_SIZE; + + if (total_len_words >= FDS_PAGE_SIZE - FDS_PAGE_TAG_SIZE) + { + return FDS_ERR_RECORD_TOO_LARGE; + } + + CRITICAL_SECTION_ENTER(); + for (uint16_t page = 0; page < FDS_MAX_PAGES; page++) + { + if ((m_pages[page].page_type == FDS_PAGE_DATA) && + (page_has_space(page, total_len_words))) + { + space_reserved = true; + *p_page = page; + + m_pages[page].words_reserved += total_len_words; + break; + } + } + CRITICAL_SECTION_EXIT(); + + return (space_reserved) ? FDS_SUCCESS : FDS_ERR_NO_SPACE_IN_FLASH; +} + + +// Undo a write_space_reserve() call. +// NOTE: Must be called within a critical section. +static void write_space_free(uint16_t length_words, uint16_t page) +{ + m_pages[page].words_reserved -= (length_words + FDS_HEADER_SIZE); +} + + +static uint32_t record_id_new(void) +{ + CRITICAL_SECTION_ENTER(); + m_latest_rec_id++; + CRITICAL_SECTION_EXIT(); + return m_latest_rec_id; +} + + +// Given a page and a record, finds the next valid record on that page. If p_record is NULL, +// search from the beginning of the page, otherwise, resume searching from the address +// pointed by p_record. Returns true if a record is found, returns false otherwise. +// If no record is found, p_record is unchanged. +static bool record_find_next(uint16_t page, uint32_t const ** p_record) +{ + fds_header_t const * p_header; + uint32_t const * p_next_rec = (*p_record); + + // If this is not the first invocation on this page, then jump to the next record. + // Otherwise, start searching from the beginning of the page. + if (p_next_rec != NULL) + { + p_header = ((fds_header_t*)p_next_rec); + p_next_rec += (FDS_HEADER_SIZE + p_header->tl.length_words); + } + else + { + p_next_rec = m_pages[page].p_addr + FDS_PAGE_TAG_SIZE; + } + + // Read records from the page, until a valid record is found or the end of the page is + // reached. The argument p_record is only updated if a valid record is found. + while ((p_next_rec < (m_pages[page].p_addr + FDS_PAGE_SIZE) && + *p_next_rec != FDS_ERASED_WORD)) + { + p_header = (fds_header_t*)p_next_rec; + + if (header_is_valid(p_header)) + { + *p_record = p_next_rec; + return true; + } + else + { + // The record is not valid, jump to the next. + p_next_rec += (FDS_HEADER_SIZE + (p_header->tl.length_words)); + } + } + + // No more valid records on this page. + return false; +} + + +// Find a record given its descriptor and retrive the page in which the record is stored. +// NOTE: Do not pass NULL as an argument for p_page. +static bool record_find_by_desc(fds_record_desc_t * const p_desc, uint16_t * const p_page) +{ + // If the gc_run_count field in the descriptor matches our counter, then the record has + // not been moved. If the address is valid, and the record ID matches, there is no need + // to find the record again. Only lookup the page in which the record is stored. + + if ((address_is_valid(p_desc->p_record)) && + (p_desc->gc_run_count == m_gc.run_count) && + (p_desc->record_id == ((fds_header_t*)p_desc->p_record)->record_id)) + { + return (page_from_record(p_page, p_desc->p_record) == FDS_SUCCESS); + } + + // Otherwise, find the record in flash. + for (*p_page = 0; *p_page < FDS_MAX_PAGES; (*p_page)++) + { + // Set p_record to NULL to make record_find_next() search from the beginning of the page. + uint32_t const * p_record = NULL; + + while (record_find_next(*p_page, &p_record)) + { + fds_header_t const * const p_header = (fds_header_t*)p_record; + if (p_header->record_id == p_desc->record_id) + { + p_desc->p_record = p_record; + p_desc->gc_run_count = m_gc.run_count; + return true; + } + } + } + + return false; +} + + +// Search for a record and return its descriptor. +// If p_file_id is NULL, only the record key will be used for matching. +// If p_record_key is NULL, only the file ID will be used for matching. +// If both are NULL, it will iterate through all records. +static ret_code_t record_find(uint16_t const * const p_file_id, + uint16_t const * const p_record_key, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return FDS_ERR_NOT_INITIALIZED; + } + + if (p_desc == NULL || p_token == NULL) + { + return FDS_ERR_NULL_ARG; + } + + // Begin (or resume) searching for a record. + for (; p_token->page < FDS_MAX_PAGES; p_token->page++) + { + if (m_pages[p_token->page].page_type != FDS_PAGE_DATA) + { + // Skip this page. + continue; + } + + while (record_find_next(p_token->page, &p_token->p_addr)) + { + fds_header_t const * const p_header = (fds_header_t*)p_token->p_addr; + + // A valid record was found, check its header for a match. + if ((p_file_id != NULL) && + (p_header->ic.file_id != *p_file_id)) + { + continue; + } + + if ((p_record_key != NULL) && + (p_header->tl.record_key != *p_record_key)) + { + continue; + } + + // Record found; update the descriptor. + p_desc->record_id = p_header->record_id; + p_desc->p_record = p_token->p_addr; + p_desc->gc_run_count = m_gc.run_count; + + return FDS_SUCCESS; + } + + // We have scanned an entire page. Set the address in the token to NULL + // so that it will be updated in the next iteration. + p_token->p_addr = NULL; + } + + return FDS_ERR_NOT_FOUND; +} + + +// Retrieve basic statistics about dirty records on a page. +static void dirty_records_stat(uint16_t page, + uint16_t * const p_dirty_records, + uint16_t * const p_word_count) +{ + fds_header_t const * p_header; + uint32_t const * p_rec; + + p_rec = m_pages[page].p_addr + FDS_PAGE_TAG_SIZE; + + while ((p_rec < (m_pages[page].p_addr + FDS_PAGE_SIZE)) && + (*p_rec != FDS_ERASED_WORD)) + { + p_header = (fds_header_t*)p_rec; + + if (!header_is_valid(p_header)) + { + (*p_dirty_records) += 1; + (*p_word_count) += p_header->tl.length_words; + } + else + { + p_rec += (FDS_HEADER_SIZE + (p_header->tl.length_words)); + } + } +} + + +// Advances one position in the queue. +// Returns true if the queue is not empty. +static bool queue_advance(void) +{ + // Reset the current element. + memset(&m_op_queue.op[m_op_queue.rp], 0x00, sizeof(fds_op_t)); + + if (m_op_queue.count != 0) + { + // Advance in the queue, wrapping around if necessary. + m_op_queue.rp = (m_op_queue.rp + 1) % FDS_OP_QUEUE_SIZE; + m_op_queue.count--; + } + + return (m_op_queue.count != 0); +} + + +// Given a pointer to an element in the chunk queue, computes the pointer to +// the next element in the queue. Handles wrap around. +void chunk_queue_next(fds_record_chunk_t ** pp_chunk) +{ + if ((*pp_chunk) != &m_chunk_queue.chunk[FDS_CHUNK_QUEUE_SIZE - 1]) + { + (*pp_chunk)++; + return; + } + + *pp_chunk = &m_chunk_queue.chunk[0]; +} + + +// Retrieve the current chunk, and advance the queue. +static void chunk_queue_get_and_advance(fds_record_chunk_t ** pp_chunk) +{ + if (m_chunk_queue.count != 0) + { + // Point to the current chunk and advance the queue. + *pp_chunk = &m_chunk_queue.chunk[m_chunk_queue.rp]; + + m_chunk_queue.rp = (m_chunk_queue.rp + 1) % FDS_CHUNK_QUEUE_SIZE; + m_chunk_queue.count--; + } +} + + +static void chunk_queue_skip(fds_op_t const * const p_op) +{ + if ((p_op->op_code == FDS_OP_WRITE) || + (p_op->op_code == FDS_OP_UPDATE)) + { + m_chunk_queue.rp += p_op->write.chunk_count; + m_chunk_queue.count -= p_op->write.chunk_count; + } +} + + +// Enqueue an operation. +static bool op_enqueue(fds_op_t const * const p_op, + uint32_t num_chunks, + fds_record_chunk_t const * const p_chunk) +{ + uint32_t idx; + bool ret = false; + + CRITICAL_SECTION_ENTER(); + if ((m_op_queue.count <= FDS_OP_QUEUE_SIZE - 1) && + (m_chunk_queue.count <= FDS_CHUNK_QUEUE_SIZE - num_chunks)) + { + idx = (m_op_queue.count + m_op_queue.rp) % FDS_OP_QUEUE_SIZE; + + m_op_queue.op[idx] = *p_op; + m_op_queue.count++; + + if (num_chunks != 0) + { + idx = (m_chunk_queue.count + m_chunk_queue.rp) % FDS_CHUNK_QUEUE_SIZE; + + fds_record_chunk_t * p_chunk_dst; + p_chunk_dst = &m_chunk_queue.chunk[idx]; + + for (uint32_t i = 0; i < num_chunks; i++) + { + *p_chunk_dst = p_chunk[i]; + chunk_queue_next(&p_chunk_dst); + } + + m_chunk_queue.count += num_chunks; + } + + ret = true; + } + CRITICAL_SECTION_EXIT(); + + return ret; +} + + +// This function is called during initialization to setup the page structure (m_pages) and +// provide additional information regarding eventual further initialization steps. +static fds_init_opts_t pages_init() +{ + uint32_t ret = NO_PAGES; + // The index of the page being initialized in m_pages[]. + uint16_t page = 0; + + for (uint16_t i = 0; i < FDS_VIRTUAL_PAGES; i++) + { + uint32_t const * const p_page_addr = fs_config.p_start_addr + (i * FDS_PAGE_SIZE); + fds_page_type_t const page_type = page_identify(p_page_addr); + + switch (page_type) + { + case FDS_PAGE_UNDEFINED: + if (page_is_erased(p_page_addr)) + { + if (m_swap_page.p_addr != NULL) + { + // If a swap page is already set, flag the page as erased (in m_pages) + // and try to tag it as data (in flash) later on during initialization. + m_pages[page].page_type = FDS_PAGE_ERASED; + m_pages[page].p_addr = p_page_addr; + m_pages[page].write_offset = FDS_PAGE_TAG_SIZE; + + // This is a candidate for a potential new swap page, in case the + // current swap is going to be promoted to complete a GC instance. + m_gc.cur_page = page; + page++; + } + else + { + // If there is no swap page yet, use this one. + m_swap_page.p_addr = p_page_addr; + m_swap_page.write_offset = FDS_PAGE_TAG_SIZE; + } + + ret |= PAGE_ERASED; + } + break; + + case FDS_PAGE_DATA: + m_pages[page].page_type = FDS_PAGE_DATA; + m_pages[page].p_addr = p_page_addr; + // Scan the page to compute its write offset and determine whether or not the page + // can be garbage collected. Additionally, update the latest kwown record ID. + page_scan(p_page_addr, &m_pages[page].write_offset, &m_pages[page].can_gc); + + ret |= PAGE_DATA; + page++; + + break; + + case FDS_PAGE_SWAP: + m_swap_page.p_addr = p_page_addr; + // If the swap is promoted, this offset should be kept, otherwise, + // it should be set to FDS_PAGE_TAG_SIZE. + page_scan(p_page_addr, &m_swap_page.write_offset, NULL); + + ret |= (m_swap_page.write_offset == FDS_PAGE_TAG_SIZE) ? + SWAP_EMPTY : SWAP_DIRTY; + break; + + default: + // Shouldn't happen. + break; + } + } + + return (fds_init_opts_t)ret; +} + + +// Write the first part of a record header (the key and length). +static ret_code_t record_header_write_begin(fds_op_t * const p_op, uint32_t * const p_addr) +{ + ret_code_t ret; + ret = fs_store(&fs_config, p_addr + FDS_OFFSET_TL, + (uint32_t*)&p_op->write.header.tl, FDS_HEADER_SIZE_TL); + + // Write the record ID next. + p_op->write.step = FDS_OP_WRITE_RECORD_ID; + + return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY; +} + + +static ret_code_t record_header_write_id(fds_op_t * const p_op, uint32_t * const p_addr) +{ + ret_code_t ret; + ret = fs_store(&fs_config, p_addr + FDS_OFFSET_ID, + (uint32_t*)&p_op->write.header.record_id, FDS_HEADER_SIZE_ID); + + // If this record has zero chunk, write the last part of the header directly. + // Otherwise, write the record chunks next. + p_op->write.step = (p_op->write.chunk_count != 0) ? FDS_OP_WRITE_CHUNKS : + FDS_OP_WRITE_HEADER_FINALIZE; + + return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY; +} + + +static ret_code_t record_header_write_finalize(fds_op_t * const p_op, uint32_t * const p_addr) +{ + ret_code_t ret; + ret = fs_store(&fs_config, p_addr + FDS_OFFSET_IC, + (uint32_t*)&p_op->write.header.ic, FDS_HEADER_SIZE_IC); + + // If this is a simple write operation, then this is the last step. + // If this is an update instead, delete the old record next. + p_op->write.step = (p_op->op_code == FDS_OP_UPDATE) ? FDS_OP_WRITE_FLAG_DIRTY : + FDS_OP_WRITE_DONE; + + return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY; +} + + +static ret_code_t record_header_flag_dirty(uint32_t * const p_record) +{ + // Flag the record as dirty. + fs_ret_t ret = fs_store(&fs_config, p_record, + (uint32_t*)&m_fds_tl_dirty, FDS_HEADER_SIZE_TL); + + return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY; +} + + +static ret_code_t record_find_and_delete(fds_op_t * const p_op) +{ + ret_code_t ret; + uint16_t page; + fds_record_desc_t desc = {0}; + + desc.record_id = p_op->del.record_to_delete; + + if (record_find_by_desc(&desc, &page)) + { + fds_header_t const * const p_header = (fds_header_t const *)desc.p_record; + + // Copy the record key and file ID, so that they can be returned in the event. + // In case this function is run as part of an update, there is no need to copy + // the file ID and record key since they are present in the header stored + // in the queue element. + + p_op->del.file_id = p_header->ic.file_id; + p_op->del.record_key = p_header->tl.record_key; + + // Flag the record as dirty. + ret = record_header_flag_dirty((uint32_t*)desc.p_record); + + // This page can now be garbage collected. + m_pages[page].can_gc = true; + } + else + { + // The record never existed, or it has already been deleted. + ret = FDS_ERR_NOT_FOUND; + } + + return ret; +} + + +// Finds a record within a file and flags it as dirty. +static ret_code_t file_find_and_delete(fds_op_t * const p_op) +{ + ret_code_t ret; + fds_record_desc_t desc; + + // This token must persist across calls. + static fds_find_token_t tok = {0}; + + // Pass NULL to ignore the record key. + ret = record_find(&p_op->del.file_id, NULL, &desc, &tok); + + if (ret == FDS_SUCCESS) + { + // A record was found: flag it as dirty. + ret = record_header_flag_dirty((uint32_t*)desc.p_record); + + // This page can now be garbage collected. + m_pages[tok.page].can_gc = true; + } + else // FDS_ERR_NOT_FOUND + { + // No more records were found. Zero the token, so that it can be reused. + memset(&tok, 0x00, sizeof(fds_find_token_t)); + } + + return ret; +} + + +// Writes a record chunk to flash and advances the chunk queue. Additionally, decrements +// the number of chunks left to write for this operation and accumulates the offset. +static ret_code_t record_write_chunk(fds_op_t * const p_op, uint32_t * const p_addr) +{ + ret_code_t ret; + fds_record_chunk_t * p_chunk = NULL; + + // Retrieve the next chunk to be written. + chunk_queue_get_and_advance(&p_chunk); + + ret = fs_store(&fs_config, p_addr + p_op->write.chunk_offset, + p_chunk->p_data, p_chunk->length_words); + + // Accumulate the offset. + p_op->write.chunk_offset += p_chunk->length_words; + + // Decrement the number of chunks left to write. + // NOTE: If chunk_count is initially zero, this function is not called + // because this step is skipped entirely. See record_header_write_id(). + p_op->write.chunk_count--; + + if (p_op->write.chunk_count == 0) + { + // All record chunks have been written; write the last part of + // the record header to finalize the write operation. + p_op->write.step = FDS_OP_WRITE_HEADER_FINALIZE; + } + + return (ret == NRF_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY; +} + + +#if defined(FDS_CRC_ENABLED) + +static bool crc_verify_success(uint16_t crc, uint16_t len_words, uint32_t const * const p_data) +{ + uint16_t computed_crc; + + // The CRC is computed on the entire record, except the CRC field itself. + // The record header is 12 bytes, out of these we have to skip bytes 6 to 8 where the + // CRC itself is stored. Then we compute the CRC for the rest of the record, from byte 8 of + // the header (where the record ID begins) to the end of the record data. + computed_crc = crc16_compute((uint8_t const *)p_data, 6, NULL); + computed_crc = crc16_compute((uint8_t const *)p_data + 8, + (FDS_HEADER_SIZE_ID + len_words) * sizeof(uint32_t), + &computed_crc); + + return (computed_crc == crc); +} + +#endif + + +static void gc_init(void) +{ + m_gc.run_count++; + m_gc.cur_page = 0; + m_gc.resume = false; + + // Setup which pages to GC. Defer checking for open records and the can_gc flag, + // as other operations might change those while GC is running. + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + m_gc.do_gc_page[i] = (m_pages[i].page_type == FDS_PAGE_DATA); + } +} + + +// Obtain the next page to be garbage collected. +// Returns true if there are pages left to garbage collect, returns false otherwise. +static bool gc_page_next(uint16_t * const p_next_page) +{ + bool ret = false; + + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + if (m_gc.do_gc_page[i]) + { + // Do not attempt to GC this page again. + m_gc.do_gc_page[i] = false; + + // Only GC pages with no open records and with some records which have been deleted. + if ((m_pages[i].records_open == 0) && (m_pages[i].can_gc == true)) + { + *p_next_page = i; + ret = true; + break; + } + } + } + + return ret; +} + + +static ret_code_t gc_swap_erase(void) +{ + m_gc.state = GC_DISCARD_SWAP; + m_swap_page.write_offset = FDS_PAGE_TAG_SIZE; + + return fs_erase(&fs_config, m_swap_page.p_addr, FDS_PHY_PAGES_IN_VPAGE); +} + + +// Erase the page being garbage collected, or erase the swap in case there are any open +// records on the page being garbage collected. +static ret_code_t gc_page_erase(void) +{ + uint32_t ret; + uint16_t const gc = m_gc.cur_page; + + if (m_pages[gc].records_open == 0) + { + ret = fs_erase(&fs_config, m_pages[gc].p_addr, FDS_PHY_PAGES_IN_VPAGE); + m_gc.state = GC_ERASE_PAGE; + } + else + { + // If there are open records, stop garbage collection on this page. + // Discard the swap and try to garbage collect another page. + ret = gc_swap_erase(); + } + + return ret; +} + + +// Copy the current record to swap. +static ret_code_t gc_record_copy(void) +{ + fds_header_t const * const p_header = (fds_header_t*)m_gc.p_record_src; + uint32_t const * const p_dest = m_swap_page.p_addr + m_swap_page.write_offset; + uint16_t const record_len = FDS_HEADER_SIZE + p_header->tl.length_words; + + m_gc.state = GC_COPY_RECORD; + + // Copy the record to swap; it is guaranteed to fit in the destination page, + // so there is no need to check its size. This will either succeed or timeout. + return fs_store(&fs_config, p_dest, m_gc.p_record_src, record_len); +} + + +static ret_code_t gc_record_find_next(void) +{ + ret_code_t ret; + + // Find the next valid record to copy. + if (record_find_next(m_gc.cur_page, &m_gc.p_record_src)) + { + ret = gc_record_copy(); + } + else + { + // No more records left to copy on this page; swap pages. + ret = gc_page_erase(); + } + + return ret; +} + + +// Promote the swap by tagging it as a data page. +static ret_code_t gc_swap_promote(void) +{ + m_gc.state = GC_PROMOTE_SWAP; + return page_tag_write_data(m_pages[m_gc.cur_page].p_addr); +} + + +// Tag the page just garbage collected as swap. +static ret_code_t gc_tag_new_swap(void) +{ + m_gc.state = GC_TAG_NEW_SWAP; + m_gc.p_record_src = NULL; + return page_tag_write_swap(); +} + + +static ret_code_t gc_next_page(void) +{ + if (!gc_page_next(&m_gc.cur_page)) + { + // No pages left to GC; GC has terminated. Reset the state. + m_gc.state = GC_BEGIN; + m_gc.cur_page = 0; + m_gc.p_record_src = NULL; + + return FDS_OP_COMPLETED; + } + + return gc_record_find_next(); +} + + +// Update the swap page offeset after a record has been successfully copied to it. +static void gc_update_swap_offset(void) +{ + fds_header_t const * const p_header = (fds_header_t*)m_gc.p_record_src; + uint16_t const record_len = FDS_HEADER_SIZE + p_header->tl.length_words; + + m_swap_page.write_offset += record_len; +} + + +static void gc_swap_pages(void) +{ + // The page being garbage collected will be the new swap page, + // and the current swap will be used as a data page (promoted). + uint32_t const * const p_addr = m_swap_page.p_addr; + + m_swap_page.p_addr = m_pages[m_gc.cur_page].p_addr; + m_pages[m_gc.cur_page].p_addr = p_addr; + + // Keep the offset for this page, but reset it for the swap. + m_pages[m_gc.cur_page].write_offset = m_swap_page.write_offset; + m_swap_page.write_offset = FDS_PAGE_TAG_SIZE; +} + + +static void gc_state_advance(void) +{ + switch (m_gc.state) + { + case GC_BEGIN: + gc_init(); + m_gc.state = GC_NEXT_PAGE; + break; + + // A record was successfully copied. + case GC_COPY_RECORD: + gc_update_swap_offset(); + m_gc.state = GC_FIND_NEXT_RECORD; + break; + + // A page was successfully erased. Prepare to promote the swap. + case GC_ERASE_PAGE: + gc_swap_pages(); + m_gc.state = GC_PROMOTE_SWAP; + break; + + // Swap was discarded because the page being GC'ed had open records. + case GC_DISCARD_SWAP: + // Swap was sucessfully promoted. + case GC_PROMOTE_SWAP: + // Prepare to tag the page just GC'ed as swap. + m_gc.state = GC_TAG_NEW_SWAP; + break; + + case GC_TAG_NEW_SWAP: + m_gc.state = GC_NEXT_PAGE; + break; + + default: + // Should not happen. + break; + } +} + + +// Initialize the filesystem. +static ret_code_t init_execute(uint32_t prev_ret, fds_op_t * const p_op) +{ + ret_code_t ret = FDS_ERR_INTERNAL; + + if (prev_ret != FS_SUCCESS) + { + // A previous operation has timed out. + flag_clear(FDS_FLAG_INITIALIZING); + return FDS_ERR_OPERATION_TIMEOUT; + } + + switch (p_op->init.step) + { + case FDS_OP_INIT_TAG_SWAP: + // The page write offset was determined previously by pages_init(). + ret = page_tag_write_swap(); + p_op->init.step = FDS_OP_INIT_TAG_DATA; + break; + + case FDS_OP_INIT_TAG_DATA: + { + // Tag remaining erased pages as data. + bool write_reqd = false; + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + if (m_pages[i].page_type == FDS_PAGE_ERASED) + { + ret = page_tag_write_data(m_pages[i].p_addr); + m_pages[i].page_type = FDS_PAGE_DATA; + write_reqd = true; + break; + } + } + if (!write_reqd) + { + flag_set(FDS_FLAG_INITIALIZED); + flag_clear(FDS_FLAG_INITIALIZING); + return FDS_OP_COMPLETED; + } + } + break; + + case FDS_OP_INIT_ERASE_SWAP: + ret = fs_erase(&fs_config, m_swap_page.p_addr, FDS_PHY_PAGES_IN_VPAGE); + // If the swap is going to be discarded then reset its write_offset. + m_swap_page.write_offset = FDS_PAGE_TAG_SIZE; + p_op->init.step = FDS_OP_INIT_TAG_SWAP; + break; + + case FDS_OP_INIT_PROMOTE_SWAP: + { + // When promoting the swap, keep the write_offset set by pages_init(). + ret = page_tag_write_data(m_swap_page.p_addr); + + uint16_t const gc = m_gc.cur_page; + uint32_t const * const p_old_swap = m_swap_page.p_addr; + + // Execute the swap. + m_swap_page.p_addr = m_pages[gc].p_addr; + m_pages[gc].p_addr = p_old_swap; + + // Copy the offset from the swap to the new page. + m_pages[gc].write_offset = m_swap_page.write_offset; + m_swap_page.write_offset = FDS_PAGE_TAG_SIZE; + + m_pages[gc].page_type = FDS_PAGE_DATA; + p_op->init.step = FDS_OP_INIT_TAG_SWAP; + } + break; + + default: + // Should not happen. + break; + } + + if (ret != FDS_SUCCESS) + { + // fstorage queue was full. + flag_clear(FDS_FLAG_INITIALIZING); + return FDS_ERR_BUSY; + } + + return FDS_OP_EXECUTING; +} + + +// Executes write and update operations. +static ret_code_t write_execute(uint32_t prev_ret, fds_op_t * const p_op) +{ + ret_code_t ret; + uint32_t * p_write_addr; + fds_page_t * const p_page = &m_pages[p_op->write.page]; + + // This must persist across calls. + static fds_record_desc_t desc = {0}; + + if (prev_ret != FS_SUCCESS) + { + // The previous operation has timed out, update offsets. + page_offsets_update(p_page, p_op->write.header.tl.length_words); + return FDS_ERR_OPERATION_TIMEOUT; + } + + // Compute the address where to write data. + p_write_addr = (uint32_t*)(p_page->p_addr + p_page->write_offset); + + // Execute the current step of the operation, and set one to be executed next. + switch (p_op->write.step) + { + case FDS_OP_WRITE_FIND_RECORD: + { + // The first step of updating a record constists of locating the copy to be deleted. + // If the old copy couldn't be found for any reason then the update should fail. + // This prevents duplicates when queuing multiple updates of the same record. + + uint16_t page; + desc.p_record = NULL; + desc.record_id = p_op->write.record_to_delete; + + if (!record_find_by_desc(&desc, &page)) + { + return FDS_ERR_NOT_FOUND; + } + // Setting the step is redundant since we are falling through. + } + // Fallthrough to FDS_OP_WRITE_HEADER_BEGIN. + + case FDS_OP_WRITE_HEADER_BEGIN: + ret = record_header_write_begin(p_op, p_write_addr); + break; + + case FDS_OP_WRITE_RECORD_ID: + ret = record_header_write_id(p_op, p_write_addr); + break; + + case FDS_OP_WRITE_CHUNKS: + ret = record_write_chunk(p_op, p_write_addr); + break; + + case FDS_OP_WRITE_HEADER_FINALIZE: + ret = record_header_write_finalize(p_op, p_write_addr); + break; + + case FDS_OP_WRITE_FLAG_DIRTY: + ret = record_header_flag_dirty((uint32_t*)desc.p_record); + p_op->write.step = FDS_OP_WRITE_DONE; + break; + + case FDS_OP_WRITE_DONE: + ret = FDS_OP_COMPLETED; + +#if defined(FDS_CRC_ENABLED) + if (flag_is_set(FDS_FLAG_VERIFY_CRC)) + { + if (!crc_verify_success(p_op->write.header.ic.crc16, + p_op->write.header.tl.length_words, + p_write_addr)) + { + ret = FDS_ERR_CRC_CHECK_FAILED; + } + } +#endif + break; + + default: + ret = FDS_ERR_INTERNAL; + break; + } + + // An operation has either completed or failed. It may have failed because fstorage + // ran out of memory, or because the user tried to delete a record which did not exist. + if (ret != FDS_OP_EXECUTING) + { + // There won't be another callback for this operation, so update the page offset now. + page_offsets_update(p_page, p_op->write.header.tl.length_words); + } + + return ret; +} + + +static ret_code_t delete_execute(uint32_t prev_ret, fds_op_t * const p_op) +{ + ret_code_t ret; + + if (prev_ret != FS_SUCCESS) + { + return FDS_ERR_OPERATION_TIMEOUT; + } + + switch (p_op->del.step) + { + case FDS_OP_DEL_RECORD_FLAG_DIRTY: + ret = record_find_and_delete(p_op); + p_op->del.step = FDS_OP_DEL_DONE; + break; + + case FDS_OP_DEL_FILE_FLAG_DIRTY: + ret = file_find_and_delete(p_op); + if (ret == FDS_ERR_NOT_FOUND) + { + // No more records could be found. + // There won't be another callback for this operation, so return now. + ret = FDS_OP_COMPLETED; + } + break; + + case FDS_OP_DEL_DONE: + ret = FDS_OP_COMPLETED; + break; + + default: + ret = FDS_ERR_INTERNAL; + break; + } + + return ret; +} + + +static ret_code_t gc_execute(uint32_t prev_ret) +{ + ret_code_t ret; + + if (prev_ret != FS_SUCCESS) + { + return FDS_ERR_OPERATION_TIMEOUT; + } + + if (m_gc.resume) + { + m_gc.resume = false; + } + else + { + gc_state_advance(); + } + + switch (m_gc.state) + { + case GC_NEXT_PAGE: + ret = gc_next_page(); + break; + + case GC_FIND_NEXT_RECORD: + ret = gc_record_find_next(); + break; + + case GC_COPY_RECORD: + ret = gc_record_copy(); + break; + + case GC_ERASE_PAGE: + ret = gc_page_erase(); + break; + + case GC_PROMOTE_SWAP: + ret = gc_swap_promote(); + break; + + case GC_TAG_NEW_SWAP: + ret = gc_tag_new_swap(); + break; + + default: + // Should not happen. + ret = FDS_ERR_INTERNAL; + break; + } + + // Either FDS_OP_EXECUTING, FDS_OP_COMPLETED, FDS_ERR_BUSY or FDS_ERR_INTERNAL. + return ret; +} + + +static void queue_process(fs_ret_t result) +{ + ret_code_t ret; + fds_op_t * const p_op = &m_op_queue.op[m_op_queue.rp]; + + switch (p_op->op_code) + { + case FDS_OP_INIT: + ret = init_execute(result, p_op); + break; + + case FDS_OP_WRITE: + case FDS_OP_UPDATE: + ret = write_execute(result, p_op); + break; + + case FDS_OP_DEL_RECORD: + case FDS_OP_DEL_FILE: + ret = delete_execute(result, p_op); + break; + + case FDS_OP_GC: + ret = gc_execute(result); + break; + + default: + ret = FDS_ERR_INTERNAL; + break; + } + + if (ret != FDS_OP_EXECUTING) + { + fds_evt_t evt; + + if (ret == FDS_OP_COMPLETED) + { + evt.result = FDS_SUCCESS; + } + else + { + // Either FDS_ERR_BUSY, FDS_ERR_OPERATION_TIMEOUT, + // FDS_ERR_CRC_CHECK_FAILED or FDS_ERR_NOT_FOUND. + evt.result = ret; + + // If this operation had any chunks in the queue, skip them. + chunk_queue_skip(p_op); + } + + event_prepare(p_op, &evt); + event_send(&evt); + + // Advance the queue, and if there are any queued operations, process them. + if (queue_advance()) + { + queue_process(FS_SUCCESS); + } + else + { + // No more elements in the queue. Clear the FDS_FLAG_PROCESSING flag, + // so that new operation can start processing the queue. + flag_clear(FDS_FLAG_PROCESSING); + } + } +} + + +static void queue_start(void) +{ + if (!flag_is_set(FDS_FLAG_PROCESSING)) + { + flag_set(FDS_FLAG_PROCESSING); + queue_process(FS_SUCCESS); + } +} + + +static void fs_event_handler(fs_evt_t const * const p_evt, fs_ret_t result) +{ + queue_process(result); +} + + +// Enqueues write and update operations. +static ret_code_t write_enqueue(fds_record_desc_t * const p_desc, + fds_record_t const * const p_record, + fds_reserve_token_t const * const p_tok, + fds_op_code_t op_code) +{ + ret_code_t ret; + fds_op_t op; + uint16_t page; + uint16_t crc = 0; + uint16_t length_words = 0; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return FDS_ERR_NOT_INITIALIZED; + } + + if (p_record == NULL) + { + return FDS_ERR_NULL_ARG; + } + + if ((p_record->file_id == FDS_FILE_ID_INVALID) || + (p_record->key == FDS_RECORD_KEY_DIRTY)) + { + return FDS_ERR_INVALID_ARG; + } + + if (!chunk_is_aligned(p_record->data.p_chunks, + p_record->data.num_chunks)) + { + return FDS_ERR_UNALIGNED_ADDR; + } + + // No space was previously reserved for this operation. + if (p_tok == NULL) + { + // Compute the total length of the record. + for (uint32_t i = 0; i < p_record->data.num_chunks; i++) + { + length_words += p_record->data.p_chunks[i].length_words; + } + + // Find a page where to write data. + ret = write_space_reserve(length_words, &page); + + if (ret != FDS_SUCCESS) + { + // There is either not enough flash space available (FDS_ERR_NO_SPACE_IN_FLASH) or + // the record exceeds the virtual page size (FDS_ERR_RECORD_TOO_LARGE). + return ret; + } + } + else + { + page = p_tok->page; + length_words = p_tok->length_words; + } + + // Initialize the operation. + op.op_code = op_code; + op.write.step = FDS_OP_WRITE_HEADER_BEGIN; + op.write.page = page; + op.write.chunk_count = p_record->data.num_chunks; + op.write.chunk_offset = FDS_OFFSET_DATA; + op.write.header.record_id = record_id_new(); + op.write.header.ic.file_id = p_record->file_id; + op.write.header.tl.record_key = p_record->key; + op.write.header.tl.length_words = length_words; + + if (op_code == FDS_OP_UPDATE) + { + op.write.step = FDS_OP_WRITE_FIND_RECORD; + // Save the record ID of the record to be updated. + op.write.record_to_delete = p_desc->record_id; + } + +#if defined (FDS_CRC_ENABLED) + // First, compute the CRC for the first 6 bytes of the header which contain the + // record key, length and file ID, then, compute the CRC of the record ID (4 bytes). + crc = crc16_compute((uint8_t*)&op.write.header, 6, NULL); + crc = crc16_compute((uint8_t*)&op.write.header.record_id, 4, &crc); + + for (uint32_t i = 0; i < p_record->data.num_chunks; i++) + { + // Compute the CRC for the record data. + crc = crc16_compute((uint8_t*)p_record->data.p_chunks[i].p_data, + p_record->data.p_chunks[i].length_words * sizeof(uint32_t), &crc); + } +#endif + + op.write.header.ic.crc16 = crc; + + // Attempt to enqueue the operation. + if (!op_enqueue(&op, p_record->data.num_chunks, p_record->data.p_chunks)) + { + // No space availble in the queues. Cancel the reservation of flash space. + CRITICAL_SECTION_ENTER(); + write_space_free(length_words, page); + CRITICAL_SECTION_EXIT(); + + return FDS_ERR_NO_SPACE_IN_QUEUES; + } + + // Initialize the record descriptor, if provided. + if (p_desc != NULL) + { + p_desc->p_record = NULL; + // Don't invoke record_id_new() again ! + p_desc->record_id = op.write.header.record_id; + p_desc->record_is_open = false; + p_desc->gc_run_count = m_gc.run_count; + } + + // Start processing the queue, if necessary. + queue_start(); + + return FDS_SUCCESS; +} + + +ret_code_t fds_register(fds_cb_t cb) +{ + ret_code_t ret; + + CRITICAL_SECTION_ENTER(); + if (m_users == FDS_MAX_USERS) + { + ret = FDS_ERR_USER_LIMIT_REACHED; + } + else + { + m_cb_table[m_users] = cb; + m_users++; + + ret = FDS_SUCCESS; + } + CRITICAL_SECTION_EXIT(); + + return ret; +} + + +ret_code_t fds_init(void) +{ + fds_evt_t const evt_success = { .id = FDS_EVT_INIT, .result = FDS_SUCCESS }; + + // No initialization is necessary. Notify the application immediately. + if (flag_is_set(FDS_FLAG_INITIALIZED)) + { + event_send(&evt_success); + return FDS_SUCCESS; + } + + if (flag_is_set(FDS_FLAG_INITIALIZING)) + { + return FDS_SUCCESS; + } + + flag_set(FDS_FLAG_INITIALIZING); + + (void)fs_init(); + + // Initialize the page structure (m_pages), and determine which + // initialization steps are required given the current state of the filesystem. + fds_init_opts_t init_opts = pages_init(); + + if (init_opts == NO_PAGES) + { + return FDS_ERR_NO_PAGES; + } + + if (init_opts == ALREADY_INSTALLED) + { + // No initialization is necessary. Notify the application immediately. + flag_set(FDS_FLAG_INITIALIZED); + flag_clear(FDS_FLAG_INITIALIZING); + + event_send(&evt_success); + return FDS_SUCCESS; + } + + fds_op_t op; + op.op_code = FDS_OP_INIT; + + switch (init_opts) + { + case FRESH_INSTALL: + case TAG_SWAP: + op.init.step = FDS_OP_INIT_TAG_SWAP; + break; + + case PROMOTE_SWAP: + case PROMOTE_SWAP_INST: + op.init.step = FDS_OP_INIT_PROMOTE_SWAP; + break; + + case DISCARD_SWAP: + op.init.step = FDS_OP_INIT_ERASE_SWAP; + break; + + case TAG_DATA: + case TAG_DATA_INST: + op.init.step = FDS_OP_INIT_TAG_DATA; + break; + + default: + // Should not happen. + break; + } + + // This cannot fail since it will be the first operation in the queue. + (void)op_enqueue(&op, 0, NULL); + + queue_start(); + + return FDS_SUCCESS; +} + + +ret_code_t fds_record_open(fds_record_desc_t * const p_desc, + fds_flash_record_t * const p_flash_rec) +{ + uint16_t page; + + if ((p_desc == NULL) || (p_flash_rec == NULL)) + { + return FDS_ERR_NULL_ARG; + } + + // Find the record if necessary. + if (record_find_by_desc(p_desc, &page)) + { + fds_header_t const * const p_header = (fds_header_t*)p_desc->p_record; + +#if defined(FDS_CRC_ENABLED) + if (!crc_verify_success(p_header->ic.crc16, + p_header->tl.length_words, + p_desc->p_record)) + { + return FDS_ERR_CRC_CHECK_FAILED; + } +#endif + + CRITICAL_SECTION_ENTER(); + m_pages[page].records_open++; + CRITICAL_SECTION_EXIT(); + + // Initialize p_flash_rec. + p_flash_rec->p_header = p_header; + p_flash_rec->p_data = (p_desc->p_record + FDS_HEADER_SIZE); + + // Set the record as open in the descriptor. + p_desc->record_is_open = true; + + return FDS_SUCCESS; + } + + // The record could not be found. + // It either never existed or it has been deleted. + return FDS_ERR_NOT_FOUND; +} + + +ret_code_t fds_record_close(fds_record_desc_t * const p_desc) +{ + ret_code_t ret; + uint16_t page; + + if (p_desc == NULL) + { + return FDS_ERR_NULL_ARG; + } + + if (record_find_by_desc((fds_record_desc_t*)p_desc, &page)) + { + CRITICAL_SECTION_ENTER(); + if ((m_pages[page].records_open > 0) && (p_desc->record_is_open)) + { + + m_pages[page].records_open--; + p_desc->record_is_open = false; + + ret = FDS_SUCCESS; + } + else + { + ret = FDS_ERR_NO_OPEN_RECORDS; + } + CRITICAL_SECTION_EXIT(); + } + else + { + ret = FDS_ERR_NOT_FOUND; + } + + return ret; +} + + +ret_code_t fds_reserve(fds_reserve_token_t * const p_tok, uint16_t length_words) +{ + ret_code_t ret; + uint16_t page; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return FDS_ERR_NOT_INITIALIZED; + } + + if (p_tok == NULL) + { + return FDS_ERR_NULL_ARG; + } + + ret = write_space_reserve(length_words, &page); + + if (ret == FDS_SUCCESS) + { + p_tok->page = page; + p_tok->length_words = length_words; + } + + return ret; +} + + +ret_code_t fds_reserve_cancel(fds_reserve_token_t * const p_tok) +{ + ret_code_t ret; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return FDS_ERR_NOT_INITIALIZED; + } + + if (p_tok == NULL) + { + return FDS_ERR_NULL_ARG; + } + + if (p_tok->page > FDS_MAX_PAGES) + { + // The page does not exist. This shouldn't happen. + return FDS_ERR_INVALID_ARG; + } + + fds_page_t const * const p_page = &m_pages[p_tok->page]; + + CRITICAL_SECTION_ENTER(); + if (p_page->words_reserved - (FDS_HEADER_SIZE + p_tok->length_words) >= 0) + { + // Free reserved space. + write_space_free(p_tok->length_words, p_tok->page); + + // Clean the token. + p_tok->page = 0; + p_tok->length_words = 0; + ret = FDS_SUCCESS; + } + else + { + // We are trying to cancel a reservation of more words than how many are + // currently reserved on the page. Clearly, this shouldn't happen. + ret = FDS_ERR_INVALID_ARG; + } + CRITICAL_SECTION_EXIT(); + + return ret; +} + + +ret_code_t fds_record_write(fds_record_desc_t * const p_desc, + fds_record_t const * const p_record) +{ + return write_enqueue(p_desc, p_record, NULL, FDS_OP_WRITE); +} + + +ret_code_t fds_record_write_reserved(fds_record_desc_t * const p_desc, + fds_record_t const * const p_record, + fds_reserve_token_t const * const p_tok) +{ + // A NULL token is not allowed when writing to a reserved space. + if (p_tok == NULL) + { + return FDS_ERR_NULL_ARG; + } + + return write_enqueue(p_desc, p_record, p_tok, FDS_OP_WRITE); +} + + +ret_code_t fds_record_update(fds_record_desc_t * const p_desc, + fds_record_t const * const p_record) +{ + // A NULL descriptor is not allowed when updating a record. + if (p_desc == NULL) + { + return FDS_ERR_NULL_ARG; + } + + return write_enqueue(p_desc, p_record, NULL, FDS_OP_UPDATE); +} + + +ret_code_t fds_record_delete(fds_record_desc_t * const p_desc) +{ + fds_op_t op; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return FDS_ERR_NOT_INITIALIZED; + } + + if (p_desc == NULL) + { + return FDS_ERR_NULL_ARG; + } + + op.op_code = FDS_OP_DEL_RECORD; + op.del.step = FDS_OP_DEL_RECORD_FLAG_DIRTY; + op.del.record_to_delete = p_desc->record_id; + + if (op_enqueue(&op, 0, NULL)) + { + queue_start(); + return FDS_SUCCESS; + } + + return FDS_ERR_NO_SPACE_IN_QUEUES; +} + + +ret_code_t fds_file_delete(uint16_t file_id) +{ + fds_op_t op; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return FDS_ERR_NOT_INITIALIZED; + } + + if (file_id == FDS_FILE_ID_INVALID) + { + return FDS_ERR_INVALID_ARG; + } + + op.op_code = FDS_OP_DEL_FILE; + op.del.step = FDS_OP_DEL_FILE_FLAG_DIRTY; + op.del.file_id = file_id; + + if (op_enqueue(&op, 0, NULL)) + { + queue_start(); + return FDS_SUCCESS; + } + + return FDS_ERR_NO_SPACE_IN_QUEUES; +} + + +ret_code_t fds_gc(void) +{ + fds_op_t op; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return FDS_ERR_NOT_INITIALIZED; + } + + op.op_code = FDS_OP_GC; + + if (op_enqueue(&op, 0, NULL)) + { + if (m_gc.state != GC_BEGIN) + { + // Resume GC by retrying the last step. + m_gc.resume = true; + } + + queue_start(); + return FDS_SUCCESS; + } + + return FDS_ERR_NO_SPACE_IN_QUEUES; +} + + +ret_code_t fds_record_iterate(fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + return record_find(NULL, NULL, p_desc, p_token); +} + + +ret_code_t fds_record_find(uint16_t file_id, + uint16_t record_key, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + return record_find(&file_id, &record_key, p_desc, p_token); +} + + +ret_code_t fds_record_find_by_key(uint16_t record_key, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + return record_find(NULL, &record_key, p_desc, p_token); +} + + +ret_code_t fds_record_find_in_file(uint16_t file_id, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + return record_find(&file_id, NULL, p_desc, p_token); +} + + +ret_code_t fds_descriptor_from_rec_id(fds_record_desc_t * const p_desc, + uint32_t record_id) +{ + if (p_desc == NULL) + { + return FDS_ERR_NULL_ARG; + } + + // Zero the descriptor and set the record_id field. + memset(p_desc, 0x00, sizeof(fds_record_desc_t)); + p_desc->record_id = record_id; + + return FDS_SUCCESS; +} + + +ret_code_t fds_record_id_from_desc(fds_record_desc_t const * const p_desc, + uint32_t * const p_record_id) +{ + if ((p_desc == NULL) || (p_record_id == NULL)) + { + return FDS_ERR_NULL_ARG; + } + + *p_record_id = p_desc->record_id; + + return FDS_SUCCESS; +} + + +ret_code_t fds_stat(fds_stat_t * const p_stat) +{ + uint16_t const words_in_page = FDS_PAGE_SIZE - FDS_PAGE_TAG_SIZE; + // The largest number of free contiguous words on any page. + uint16_t contig_words = 0; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return FDS_ERR_NOT_INITIALIZED; + } + + if (p_stat == NULL) + { + return FDS_ERR_NULL_ARG; + } + + memset(p_stat, 0x00, sizeof(fds_stat_t)); + + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + uint32_t const * p_record = NULL; + uint16_t const words_used = m_pages[i].write_offset + m_pages[i].words_reserved; + + p_stat->open_records += m_pages[i].records_open; + p_stat->words_used += words_used; + contig_words = (words_in_page - words_used); + + if (contig_words > p_stat->largest_contig) + { + p_stat->largest_contig = contig_words; + } + + while (record_find_next(i, &p_record)) + { + p_stat->valid_records++; + } + + dirty_records_stat(i, &p_stat->dirty_records, &p_stat->freeable_words); + } + + return FDS_SUCCESS; +} + + +#if defined(FDS_CRC_ENABLED) + +ret_code_t fds_verify_crc_on_writes(bool enable) +{ + if (enable) + { + flag_set(FDS_FLAG_VERIFY_CRC); + } + else + { + flag_clear(FDS_FLAG_VERIFY_CRC); + } + + return FDS_SUCCESS; +} + +#endif + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h new file mode 100644 index 0000000000..b655566fab --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h @@ -0,0 +1,760 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef FDS_H__ +#define FDS_H__ + +/** + * @defgroup flash_data_storage Flash Data Storage + * @ingroup app_common + * @{ + * + * @brief Flash Data Storage (FDS). + * + * @details Flash Data Storage is a minimalistic, record-oriented file system for the on-chip + * flash. Files are stored as a collection of records of variable length. FDS supports + * synchronous read operations and asynchronous write operations (write, update, + * and delete). FDS can be used from multiple threads. + */ + +#include +#include +#include "sdk_errors.h" + + +/**@brief Invalid file ID. + * + * This value must not be used as a file ID by the application. + */ +#define FDS_FILE_ID_INVALID (0xFFFF) + + +/**@brief Record key for deleted records. + * + * This key is used to flag a record as "dirty", which means that it should be removed during + * the next garbage collection. This value must not be used as a record key by the application. + */ +#define FDS_RECORD_KEY_DIRTY (0x0000) + + +/**@brief FDS return values. + */ +enum +{ + FDS_SUCCESS = NRF_SUCCESS, //!< The operation completed successfully. + FDS_ERR_OPERATION_TIMEOUT, //!< Error. The operation timed out. + FDS_ERR_NOT_INITIALIZED, //!< Error. The module has not been initialized. + FDS_ERR_UNALIGNED_ADDR, //!< Error. The input data is not aligned to a word boundary. + FDS_ERR_INVALID_ARG, //!< Error. The parameter contains invalid data. + FDS_ERR_NULL_ARG, //!< Error. The parameter is NULL. + FDS_ERR_NO_OPEN_RECORDS, //!< Error. The record is not open, so it cannot be closed. + FDS_ERR_NO_SPACE_IN_FLASH, //!< Error. There is no space in flash memory. + FDS_ERR_NO_SPACE_IN_QUEUES, //!< Error. There is no space in the internal queues. + FDS_ERR_RECORD_TOO_LARGE, //!< Error. The record exceeds the maximum allowed size. + FDS_ERR_NOT_FOUND, //!< Error. The record was not found. + FDS_ERR_NO_PAGES, //!< Error. No flash pages are available. + FDS_ERR_USER_LIMIT_REACHED, //!< Error. The maximum number of users has been reached. + FDS_ERR_CRC_CHECK_FAILED, //!< Error. The CRC check failed. + FDS_ERR_BUSY, //!< Error. The underlying flash subsystem was busy. + FDS_ERR_INTERNAL, //!< Error. An internal error occurred. +}; + + +/**@brief Part of the record metadata. + * + * Contains the record key and the length of the record data. + */ +typedef struct +{ + uint16_t record_key; //!< The record key (must be in the range 0x0001 - 0xBFFF). + uint16_t length_words; //!< The length of the record data (in 4-byte words). +} fds_tl_t; + + +/**@brief Part of the record metadata. + * + * Contains the ID of the file that the record belongs to and the CRC16 check value of the record. + */ +typedef struct +{ + uint16_t file_id; //!< The ID of the file that the record belongs to. + + /**@brief CRC16 check value. + * + * The CRC is calculated over the entire record as stored in flash (including the record + * metadata except the CRC field itself). The CRC standard employed is CRC-16-CCITT. + */ + uint16_t crc16; +} fds_ic_t; + + +/**@brief The record metadata as stored in flash. + */ +typedef struct +{ + fds_tl_t tl; //!< See @ref fds_tl_t. + fds_ic_t ic; //!< See @ref fds_ic_t. + uint32_t record_id; //!< The unique record ID (32 bits). +} fds_header_t; + + +/**@brief The record descriptor structure that is used to manipulate records. + * + * This structure is used by the FDS module. You must provide the descriptor to the module when + * you manipulate existing records. However, you should never modify it or use any of its fields. + * + * @note Never reuse the same descriptor for different records. + */ +typedef struct +{ + uint32_t record_id; //!< The unique record ID. + uint32_t const * p_record; //!< The last known location of the record in flash. + uint16_t gc_run_count; //!< Number of times garbage collection has been run. + bool record_is_open; //!< Whether the record is currently open. +} fds_record_desc_t; + + +/**@brief Structure that can be used to read the contents of a record stored in flash. + * + * This structure does not reflect the physical layout of a record in flash, but it points + * to the locations where the record header (metadata) and the record data are stored. + */ +typedef struct +{ + fds_header_t const * p_header; //!< Location of the record header in flash. + void const * p_data; //!< Location of the record data in flash. +} fds_flash_record_t; + + +/**@brief A chunk of record data to be written to flash. + * + * @p p_data must be aligned to a word boundary. Make sure to keep it in + * memory until the operation has completed, which is indicated by the respective FDS event. + */ +typedef struct +{ + void const * p_data; //!< Pointer to the data to store. Must be word-aligned. + uint16_t length_words; //!< Length of data pointed to by @p p_data (in 4-byte words). +} fds_record_chunk_t; + + +/**@brief A record to be written to flash. + */ +typedef struct +{ + uint16_t file_id; //!< The ID of the file that the record belongs to. + uint16_t key; //!< The record key. + struct + { + fds_record_chunk_t const * p_chunks; //!< The chunks that make up the record data. + uint16_t num_chunks; //!< The number of chunks that make up the data. + } data; +} fds_record_t; + + +/**@brief A token to a reserved space in flash, created by @ref fds_reserve. + * + * This token can be used to write the record in the reserved space (@ref fds_record_write_reserved) + * or to cancel the reservation (@ref fds_reserve_cancel). + */ +typedef struct +{ + uint16_t page; //!< The logical ID of the page where space was reserved. + uint16_t length_words; //!< The amount of space reserved (in 4-byte words). +} fds_reserve_token_t; + + +/**@brief A token to keep information about the progress of @ref fds_record_find, + * @ref fds_record_find_by_key, and @ref fds_record_find_in_file. + * + * @note Always zero-initialize the token before using it for the first time. + * @note Never reuse the same token to search for different records. + */ +typedef struct +{ + uint32_t const * p_addr; + uint16_t page; +} fds_find_token_t; + + +/**@brief FDS event IDs. + */ +typedef enum +{ + FDS_EVT_INIT, //!< Event for @ref fds_init. + FDS_EVT_WRITE, //!< Event for @ref fds_record_write and @ref fds_record_write_reserved. + FDS_EVT_UPDATE, //!< Event for @ref fds_record_update. + FDS_EVT_DEL_RECORD, //!< Event for @ref fds_record_delete. + FDS_EVT_DEL_FILE, //!< Event for @ref fds_file_delete. + FDS_EVT_GC //!< Event for @ref fds_gc. +} fds_evt_id_t; + + +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#endif + +/**@brief An FDS event. + */ +typedef struct +{ + fds_evt_id_t id; //!< The event ID. See @ref fds_evt_id_t. + ret_code_t result; //!< The result of the operation related to this event. + union + { + struct + { + /* Currently not used. */ + uint16_t pages_not_mounted; + } init; + struct + { + uint32_t record_id; + uint16_t file_id; + uint16_t record_key; + bool is_record_updated; + } write; //!< Information for @ref FDS_EVT_WRITE and @ref FDS_EVT_UPDATE events. + struct + { + uint32_t record_id; + uint16_t file_id; + uint16_t record_key; + uint16_t records_deleted_count; + } del; //!< Information for @ref FDS_EVT_DEL_RECORD and @ref FDS_EVT_DEL_FILE events. + struct + { + /* Currently not used. */ + uint16_t pages_skipped; + uint16_t space_reclaimed; + } gc; + }; +} fds_evt_t; + +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + /* leave anonymous unions enabled */ +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#endif + + +/**@brief File system statistics. */ +typedef struct +{ + uint16_t open_records; //!< The number of open records. + uint16_t valid_records; //!< The number of valid records. + uint16_t dirty_records; //!< The number of deleted ("dirty") records. + uint16_t words_reserved; //!< The number of words reserved by @ref fds_reserve(). + + /**@brief The number of words written to flash, including those reserved for future writes. + */ + uint16_t words_used; + + /**@brief The largest number of free contiguous words in the file system. + * + * This number determines the largest record that can be stored by FDS. + * It takes into account all reservations for future writes. + */ + uint16_t largest_contig; + + /**@brief The largest number of words that can be reclaimed by garbage collection. + * + * The actual amount of space freed by garbage collection might be less than this value if + * records are open while garbage collection is run. + */ + uint16_t freeable_words; +} fds_stat_t; + + +/**@brief FDS event handler function prototype. + * + * @param p_evt The event. + */ +typedef void (*fds_cb_t)(fds_evt_t const * const p_evt); + + +/**@brief Function for registering an FDS event handler. + * + * The maximum amount of handlers that can be registered can be configured by changing the value + * of @ref FDS_MAX_USERS in fds_config.h. + * + * @param[in] cb The event handler function. + * + * @retval FDS_SUCCESS If the event handler was registered successfully. + * @retval FDS_ERR_USER_LIMIT_REACHED If the maximum number of registered callbacks is reached. + */ +ret_code_t fds_register(fds_cb_t cb); + + +/**@brief Function for initializing the module. + * + * This function initializes the module and installs the file system (unless it is installed + * already). + * + * This function is asynchronous. Completion is reported through an event. Make sure to call + * @ref fds_register before calling @ref fds_init so that you receive the completion event. + * + * @retval FDS_SUCCESS If the operation was queued successfully. + * @retval FDS_ERR_NO_PAGES If there is no space available in flash memory to install the + * file system. + */ +ret_code_t fds_init(void); + + +/**@brief Function for writing a record to flash. + * + * There are no restrictions on the file ID and the record key, except that the record key must be + * different from @ref FDS_RECORD_KEY_DIRTY and the file ID must be different from + * @ref FDS_FILE_ID_INVALID. In particular, no restrictions are made regarding the uniqueness of + * the file ID or the record key. All records with the same file ID are grouped into one file. + * If no file with the specified ID exists, it is created. There can be multiple records with the + * same record key in a file. + * + * Record data can consist of multiple chunks. The data must be aligned to a 4 byte boundary, and + * because it is not buffered internally, it must be kept in memory until the callback for the + * operation has been received. The length of the data must not exceed @ref FDS_VIRTUAL_PAGE_SIZE + * words minus 14 bytes. + * + * This function is asynchronous. Completion is reported through an event that is sent to + * the registered event handler function. + * + * @param[out] p_desc The descriptor of the record that was written. Pass NULL if you do not + * need the descriptor. + * @param[in] p_record The record to be written to flash. + * + * @retval FDS_SUCCESS If the operation was queued successfully. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_record is NULL. + * @retval FDS_ERR_INVALID_ARG If the file ID or the record key is invalid. + * @retval FDS_ERR_UNALIGNED_ADDR If the record data is not aligned to a 4 byte boundary. + * @retval FDS_ERR_RECORD_TOO_LARGE If the record data exceeds the maximum length. + * @retval FDS_ERR_NO_SPACE_IN_QUEUES If the operation queue is full or there are more record + * chunks than can be buffered. + * @retval FDS_ERR_NO_SPACE_IN_FLASH If there is not enough free space in flash to store the + * record. + */ +ret_code_t fds_record_write(fds_record_desc_t * const p_desc, + fds_record_t const * const p_record); + + +/**@brief Function for reserving space in flash. + * + * This function can be used to reserve space in flash memory. To write a record into the reserved + * space, use @ref fds_record_write_reserved. Alternatively, use @ref fds_reserve_cancel to cancel + * a reservation. + * + * Note that this function does not write any data to flash. + * + * @param[out] p_token A token that can be used to write a record in the reserved space or + * cancel the reservation. + * @param[in] length_words The length of the record data (in 4-byte words). + * + * @retval FDS_SUCCESS If the flash space was reserved successfully. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_token is NULL instead of a valid token address. + * @retval FDS_ERR_RECORD_TOO_LARGE If the record length exceeds the maximum length. + * @retval FDS_ERR_NO_SPACE_IN_FLASH If there is not enough free space in flash to store the + * record. + */ +ret_code_t fds_reserve(fds_reserve_token_t * const p_token, uint16_t length_words); + + +/**@brief Function for canceling an @ref fds_reserve operation. + * + * @param[in] p_token The token that identifies the reservation, produced by @ref fds_reserve. + * + * @retval FDS_SUCCESS If the reservation was canceled. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_token is NULL instead of a valid token address. + * @retval FDS_ERR_INVALID_ARG If @p p_token contains invalid data. + */ +ret_code_t fds_reserve_cancel(fds_reserve_token_t * const p_token); + + +/**@brief Function for writing a record to a space in flash that was reserved using + * @ref fds_reserve. + * + * There are no restrictions on the file ID and the record key, except that the record key must be + * different from @ref FDS_RECORD_KEY_DIRTY and the file ID must be different from + * @ref FDS_FILE_ID_INVALID. In particular, no restrictions are made regarding the uniqueness of + * the file ID or the record key. All records with the same file ID are grouped into one file. + * If no file with the specified ID exists, it is created. There can be multiple records with the + * same record key in a file. + * + * Record data can consist of multiple chunks. The data must be aligned to a 4 byte boundary, and + * because it is not buffered internally, it must be kept in memory until the callback for the + * operation has been received. The length of the data must not exceed @ref FDS_VIRTUAL_PAGE_SIZE + * words minus 14 bytes. + * + * This function is asynchronous. Completion is reported through an event that is sent to the + * registered event handler function. + * + * @note + * This function behaves similarly to @ref fds_record_write, with the exception that it never + * fails with the error @ref FDS_ERR_NO_SPACE_IN_FLASH. + * + * @param[out] p_desc The descriptor of the record that was written. Pass NULL if you do not + * need the descriptor. + * @param[in] p_record The record to be written to flash. + * @param[in] p_token The token that identifies the space reserved in flash. + * + * @retval FDS_SUCCESS If the operation was queued successfully. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_token is NULL instead of a valid token address. + * @retval FDS_ERR_INVALID_ARG If the file ID or the record key is invalid. + * @retval FDS_ERR_UNALIGNED_ADDR If the record data is not aligned to a 4 byte boundary. + * @retval FDS_ERR_RECORD_TOO_LARGE If the record data exceeds the maximum length. + * @retval FDS_ERR_NO_SPACE_IN_QUEUES If the operation queue is full or there are more record + * chunks than can be buffered. + */ +ret_code_t fds_record_write_reserved(fds_record_desc_t * const p_desc, + fds_record_t const * const p_record, + fds_reserve_token_t const * const p_token); + + +/**@brief Function for deleting a record. + * + * Deleted records cannot be located using @ref fds_record_find, @ref fds_record_find_by_key, or + * @ref fds_record_find_in_file. Additionally, they can no longer be opened using + * @ref fds_record_open. + * + * Note that deleting a record does not free the space it occupies in flash memory. + * To reclaim flash space used by deleted records, call @ref fds_gc to run garbage collection. + * + * This function is asynchronous. Completion is reported through an event that is sent to the + * registered event handler function. + * + * @param[in] p_desc The descriptor of the record that should be deleted. + * + * @retval FDS_SUCCESS If the operation was queued successfully. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If the specified record descriptor @p p_desc is NULL. + * @retval FDS_ERR_NO_SPACE_IN_QUEUES If the operation queue is full. + */ +ret_code_t fds_record_delete(fds_record_desc_t * const p_desc); + + +/**@brief Function for deleting all records in a file. + * + * This function deletes a file, including all its records. Deleted records cannot be located + * using @ref fds_record_find, @ref fds_record_find_by_key, or @ref fds_record_find_in_file. + * Additionally, they can no longer be opened using @ref fds_record_open. + * + * Note that deleting records does not free the space they occupy in flash memory. + * To reclaim flash space used by deleted records, call @ref fds_gc to run garbage collection. + * + * This function is asynchronous. Completion is reported through an event that is sent to the + * registered event handler function. + * + * @param[in] file_id The ID of the file to be deleted. + * + * @retval FDS_SUCCESS If the operation was queued successfully. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_INVALID_ARG If the specified @p file_id is invalid. + * @retval FDS_ERR_NO_SPACE_IN_QUEUES If the operation queue is full. + */ +ret_code_t fds_file_delete(uint16_t file_id); + + +/**@brief Function for updating a record. + * + * Updating a record first writes a new record (@p p_record) to flash and then deletes the + * old record (identified by @p p_desc). + * + * There are no restrictions on the file ID and the record key, except that the record key must be + * different from @ref FDS_RECORD_KEY_DIRTY and the file ID must be different from + * @ref FDS_FILE_ID_INVALID. In particular, no restrictions are made regarding the uniqueness of + * the file ID or the record key. All records with the same file ID are grouped into one file. + * If no file with the specified ID exists, it is created. There can be multiple records with the + * same record key in a file. + * + * Record data can consist of multiple chunks. The data must be aligned to a 4 byte boundary, and + * because it is not buffered internally, it must be kept in memory until the callback for the + * operation has been received. The length of the data must not exceed @ref FDS_VIRTUAL_PAGE_SIZE + * words minus 14 bytes. + * + * This function is asynchronous. Completion is reported through an event that is sent to the + * registered event handler function. + * + * @param[in, out] p_desc The descriptor of the record to update. When the function + * returns with FDS_SUCCESS, this parameter contains the + * descriptor of the newly written record. + * @param[in] p_record The updated record to be written to flash. + * + * @retval FDS_SUCCESS If the operation was queued successfully. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_INVALID_ARG If the file ID or the record key is invalid. + * @retval FDS_ERR_UNALIGNED_ADDR If the record data is not aligned to a 4 byte boundary. + * @retval FDS_ERR_RECORD_TOO_LARGE If the record data exceeds the maximum length. + * @retval FDS_ERR_NO_SPACE_IN_QUEUES If the operation queue is full or there are more record + * chunks than can be buffered. + * @retval FDS_ERR_NO_SPACE_IN_FLASH If there is not enough free space in flash to store the + * updated record. + */ +ret_code_t fds_record_update(fds_record_desc_t * const p_desc, + fds_record_t const * const p_record); + + +/**@brief Function for iterating through all records in flash. + * + * To search for the next record, call the function again and supply the same @ref fds_find_token_t + * structure to resume searching from the last record that was found. + * + * Note that the order with which records are iterated is not defined. + * + * @param[out] p_desc The descriptor of the record that was found. + * @param[out] p_token A token containing information about the progress of the operation. + * + * @retval FDS_SUCCESS If a record was found. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_desc or @p p_token is NULL. + * @retval FDS_ERR_NOT_FOUND If no matching record was found. + */ +ret_code_t fds_record_iterate(fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token); + + +/**@brief Function for searching for records with a given record key in a file. + * + * This function finds the first record in a file that has the given record key. To search for the + * next record with the same key in the file, call the function again and supply the same + * @ref fds_find_token_t structure to resume searching from the last record that was found. + * + * @param[in] file_id The file ID. + * @param[in] record_key The record key. + * @param[out] p_desc The descriptor of the record that was found. + * @param[out] p_token A token containing information about the progress of the operation. + * + * @retval FDS_SUCCESS If a record was found. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_desc or @p p_token is NULL. + * @retval FDS_ERR_NOT_FOUND If no matching record was found. + */ +ret_code_t fds_record_find(uint16_t file_id, + uint16_t record_key, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token); + + +/**@brief Function for searching for records with a given record key. + * + * This function finds the first record with a given record key, independent of the file it + * belongs to. To search for the next record with the same key, call the function again and supply + * the same @ref fds_find_token_t structure to resume searching from the last record that was found. + * + * @param[in] record_key The record key. + * @param[out] p_desc The descriptor of the record that was found. + * @param[out] p_token A token containing information about the progress of the operation. + * + * @retval FDS_SUCCESS If a record was found. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_desc or @p p_token is NULL. + * @retval FDS_ERR_NOT_FOUND If no record with the given key was found. + */ +ret_code_t fds_record_find_by_key(uint16_t record_key, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token); + + +/**@brief Function for searching for any record in a file. + * + * This function finds the first record in a file, independent of its record key. + * To search for the next record in the same file, call the function again and supply the same + * @ref fds_find_token_t structure to resume searching from the last record that was found. + * + * @param[in] file_id The file ID. + * @param[out] p_desc The descriptor of the record that was found. + * @param[out] p_token A token containing information about the progress of the operation. + * + * @retval FDS_SUCCESS If a record was found. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_desc or @p p_token is NULL. + * @retval FDS_ERR_NOT_FOUND If no matching record was found. + */ +ret_code_t fds_record_find_in_file(uint16_t file_id, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token); + + +/**@brief Function for opening a record for reading. + * + * This function opens a record that is stored in flash, so that it can be read. The function + * initializes an @ref fds_flash_record_t structure, which can be used to access the record data as + * well as its associated metadata. The pointers provided in the @ref fds_flash_record_t structure + * are pointers to flash memory. + * + * Opening a record with @ref fds_record_open prevents garbage collection to run on the virtual + * flash page in which record is stored, so that the contents of the memory pointed by fields in + * @ref fds_flash_record_t are guaranteed to remain unmodified as long as the record is kept open. + * + * When you are done reading a record, call @ref fds_record_close to close it. Garbage collection + * can then reclaim space on the virtual page where the record is stored. Note that you must + * provide the same descriptor for @ref fds_record_close as you did for this function. + * + * @param[in] p_desc The descriptor of the record to open. + * @param[out] p_flash_record The record, as stored in flash. + * + * @retval FDS_SUCCESS If the record was opened successfully. + * @retval FDS_ERR_NULL_ARG If @p p_desc or @p p_flash_record is NULL. + * @retval FDS_ERR_NOT_FOUND If the record was not found. It might have been deleted, or + * it might not have been written yet. + * @retval FDS_ERR_CRC_CHECK_FAILED If the CRC check for the record failed. + */ +ret_code_t fds_record_open(fds_record_desc_t * const p_desc, + fds_flash_record_t * const p_flash_record); + + +/**@brief Function for closing a record. + * + * Closing a record allows garbage collection to run on the virtual page in which the record is + * stored (if no other records remain open on that page). The descriptor passed as an argument + * must be the same as the one used to open the record using @ref fds_record_open. + * + * Note that closing a record does not invalidate its descriptor. You can still supply the + * descriptor to all functions that accept a record descriptor as a parameter. + * + * @param[in] p_desc The descriptor of the record to close. + * + * @retval FDS_SUCCESS If the record was closed successfully. + * @retval FDS_ERR_NULL_ARG If @p p_desc is NULL. + * @retval FDS_ERR_NO_OPEN_RECORDS If the record is not open. + * @retval FDS_ERR_NOT_FOUND If the record could not be found. + */ +ret_code_t fds_record_close(fds_record_desc_t * const p_desc); + + +/**@brief Function for running garbage collection. + * + * Garbage collection reclaims the flash space that is occupied by records that have been deleted, + * or that failed to be completely written due to, for example, a power loss. + * + * This function is asynchronous. Completion is reported through an event that is sent to the + * registered event handler function. + * + * @retval FDS_SUCCESS If the operation was queued successfully. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NO_SPACE_IN_QUEUES If the operation queue is full. + */ +ret_code_t fds_gc(void); + + +/**@brief Function for obtaining a descriptor from a record ID. + * + * This function can be used to reconstruct a descriptor from a record ID, like the one that is + * passed to the callback function. + * + * @note + * This function does not check whether a record with the given record ID exists. + * If a non-existing record ID is supplied, the resulting descriptor is invalid and will cause + * other functions to fail when it is supplied as parameter. + * + * @param[out] p_desc The descriptor of the record with the given record ID. + * @param[in] record_id The record ID for which a descriptor should be returned. + * + * @retval FDS_SUCCESS If a descriptor was returned. + * @retval FDS_ERR_NULL_ARG If @p p_desc is NULL. + */ +ret_code_t fds_descriptor_from_rec_id(fds_record_desc_t * const p_desc, + uint32_t record_id); + + +/**@brief Function for obtaining a record ID from a record descriptor. + * + * This function can be used to extract a record ID from a descriptor. For example, you could use + * it in the callback function to compare the record ID of an event to the record IDs of the + * records for which you have a descriptor. + * + * @warning + * This function does not check whether the record descriptor is valid. If the descriptor is not + * initialized or has been tampered with, the resulting record ID might be invalid. + * + * @param[in] p_desc The descriptor from which the record ID should be extracted. + * @param[out] p_record_id The record ID that is contained in the given descriptor. + * + * @retval FDS_SUCCESS If a record ID was returned. + * @retval FDS_ERR_NULL_ARG If @p p_desc or @p p_record_id is NULL. + */ +ret_code_t fds_record_id_from_desc(fds_record_desc_t const * const p_desc, + uint32_t * const p_record_id); + + +/**@brief Function for retrieving file system statistics. + * + * This function retrieves file system statistics, such as the number of open records, the space + * that can be reclaimed by garbage collection, and others. + * + * @param[out] p_stat File system statistics. + * + * @retval FDS_SUCCESS If the statistics were returned successfully. + * @retval FDS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FDS_ERR_NULL_ARG If @p p_stat is NULL. + */ +ret_code_t fds_stat(fds_stat_t * const p_stat); + + +#if defined(FDS_CRC_ENABLED) + +/**@brief Function for enabling and disabling CRC verification for write operations. + * + * CRC verification ensures that data that is queued for writing does not change before the write + * actually happens. Use this function to enable or disable CRC verification. If verification is + * enabled, the error @ref FDS_ERR_CRC_CHECK_FAILED is returned in the event for + * @ref fds_record_write, @ref fds_record_write_reserved, or @ref fds_record_update if + * verification fails. + * + * @note + * CRC verification is enabled or disabled globally, thus for all users of the FDS module. + * + * @param[in] enabled 1 to enable CRC verification. 0 to disable CRC verification. + * + * @retval FDS_SUCCESS If CRC verification was enabled or disabled successfully. + */ +ret_code_t fds_verify_crc_on_writes(bool enabled); + +#endif + +/** @} */ + +#endif // FDS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds_internal_defs.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds_internal_defs.h new file mode 100644 index 0000000000..b7c2e3a3d5 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds_internal_defs.h @@ -0,0 +1,332 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef FDS_INTERNAL_DEFS_H__ +#define FDS_INTERNAL_DEFS_H__ + +#include +#include +#include "fds_config.h" + +#if defined (FDS_THREADS) + #include "nrf_soc.h" + #include "app_util_platform.h" +#endif + +#define FDS_PAGE_TAG_SIZE (2) // Page tag size, in 4-byte words. +#define FDS_PAGE_TAG_WORD_0 (0) // Offset of the first word in the page tag from the page address. +#define FDS_PAGE_TAG_WORD_1 (1) // Offset of the second word in the page tag from the page address. + +// Page tag constants +#define FDS_PAGE_TAG_MAGIC (0xDEADC0DE) +#define FDS_PAGE_TAG_SWAP (0xF11E01FF) +#define FDS_PAGE_TAG_DATA (0xF11E01FE) + +#define FDS_ERASED_WORD (0xFFFFFFFF) + +#define FDS_OFFSET_TL (0) // Offset of TL from the record base address, in 4-byte words. +#define FDS_OFFSET_IC (1) // Offset of IC from the record base address, in 4-byte words. +#define FDS_OFFSET_ID (2) // Offset of ID from the record base address, in 4-byte words. +#define FDS_OFFSET_DATA (3) // Offset of the data (chunks) from the record base address, in 4-byte words. + +#define FDS_HEADER_SIZE_TL (1) // Size of the TL part of the header, in 4-byte words. +#define FDS_HEADER_SIZE_IC (1) // Size of the IC part of the header, in 4-byte words. +#define FDS_HEADER_SIZE_ID (1) // Size of the record ID in the header, in 4-byte words. +#define FDS_HEADER_SIZE (3) // Size of the whole header, in 4-byte words. + +#define FDS_OP_EXECUTING (FS_SUCCESS) +#define FDS_OP_COMPLETED (0x1D1D) + +// The size of a physical page, in 4-byte words. +#if defined(NRF51) + #define FDS_PHY_PAGE_SIZE (256) +#elif defined(NRF52) + #define FDS_PHY_PAGE_SIZE (1024) +#endif + +// The number of physical pages to be used. This value is configured indirectly. +#define FDS_PHY_PAGES ((FDS_VIRTUAL_PAGES * FDS_VIRTUAL_PAGE_SIZE) / FDS_PHY_PAGE_SIZE) + +// The size of a virtual page, in number of physical pages. +#define FDS_PHY_PAGES_IN_VPAGE (FDS_VIRTUAL_PAGE_SIZE / FDS_PHY_PAGE_SIZE) + +// The number of pages available to store data; which is the total minus one (the swap). +#define FDS_MAX_PAGES (FDS_VIRTUAL_PAGES - 1) + + // Just a shorter name for the size, in words, of a virtual page. +#define FDS_PAGE_SIZE (FDS_VIRTUAL_PAGE_SIZE) + + +#if (FDS_VIRTUAL_PAGE_SIZE % FDS_PHY_PAGE_SIZE != 0) + #error "FDS_VIRTUAL_PAGE_SIZE must be a multiple of the size of a physical page." +#endif + +#if (FDS_VIRTUAL_PAGES < 2) + #error "FDS requires at least two virtual pages." +#endif + + +// FDS internal status flags. +typedef enum +{ + FDS_FLAG_INITIALIZING = (1 << 0), // The module is initializing. + FDS_FLAG_INITIALIZED = (1 << 1), // The module is initialized. + FDS_FLAG_PROCESSING = (1 << 2), // The queue is being processed. + FDS_FLAG_VERIFY_CRC = (1 << 3), // Verify CRC upon writing a record. +} fds_flags_t; + + +// Page types. +typedef enum +{ + FDS_PAGE_DATA, // Page is ready for storage. + FDS_PAGE_SWAP, // Page is reserved for garbage collection. + FDS_PAGE_ERASED, // Page is erased. + FDS_PAGE_UNDEFINED, // Undefined page type. +} fds_page_type_t; + + +typedef struct +{ + fds_page_type_t page_type; // The page type. + uint32_t const * p_addr; // The address of the page. + uint16_t write_offset; // The page write offset, in 4-byte words. + uint16_t words_reserved; // The amount of words reserved by fds_write_reserve(). + uint16_t records_open; // The number of records opened using fds_open(). + bool can_gc; // Indicates that there are some records that have been deleted. +} fds_page_t; + + +typedef struct +{ + uint32_t const * p_addr; + uint16_t write_offset; +} fds_swap_page_t; + + +// FDS op-codes. +typedef enum +{ + FDS_OP_NONE, + FDS_OP_INIT, // Initialize the module. + FDS_OP_WRITE, // Write a record to flash. + FDS_OP_UPDATE, // Update a record. + FDS_OP_DEL_RECORD, // Delete a record. + FDS_OP_DEL_FILE, // Delete a file. + FDS_OP_GC // Run garbage collection. +} fds_op_code_t; + + +typedef enum +{ + FDS_OP_INIT_TAG_SWAP, + FDS_OP_INIT_TAG_DATA, + FDS_OP_INIT_ERASE_SWAP, + FDS_OP_INIT_PROMOTE_SWAP, +} fds_init_step_t; + + +typedef enum +{ + FDS_OP_WRITE_HEADER_BEGIN, // Write the record key and length. + FDS_OP_WRITE_HEADER_FINALIZE, // Write the file ID and CRC. + FDS_OP_WRITE_RECORD_ID, // Write the record ID. + FDS_OP_WRITE_CHUNKS, // Write the record data. + FDS_OP_WRITE_FIND_RECORD, + FDS_OP_WRITE_FLAG_DIRTY, // Flag a record as dirty (as part of an update operation). + FDS_OP_WRITE_DONE, +} fds_write_step_t; + + +typedef enum +{ + FDS_OP_DEL_RECORD_FLAG_DIRTY, // Flag a record as dirty. + FDS_OP_DEL_FILE_FLAG_DIRTY, // Flag multiple records as dirty. + FDS_OP_DEL_DONE, +} fds_delete_step_t; + + +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + // anonymous unions are enabled by default +#endif + +typedef struct +{ + fds_op_code_t op_code; // The opcode for the operation. + union + { + struct + { + fds_init_step_t step; // The current step the operation is at. + } init; + struct + { + fds_header_t header; + fds_write_step_t step; // The current step the operation is at. + uint16_t page; // The page the flash space for this command was reserved. + uint16_t chunk_offset; // Offset used for writing record chunks, in 4-byte words. + uint8_t chunk_count; // Number of chunks to be written. + uint32_t record_to_delete; // The record to delete in case this is an update. + } write; + struct + { + fds_delete_step_t step; + uint16_t file_id; + uint16_t record_key; + uint32_t record_to_delete; + } del; + }; +} fds_op_t; + +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + // leave anonymous unions enabled +#elif defined(__GNUC__) + // anonymous unions are enabled by default +#endif + + +typedef struct +{ + fds_op_t op[FDS_OP_QUEUE_SIZE]; // Queued flash operations. + uint32_t rp; // The index of the command being executed. + uint32_t count; // Number of elements in the queue. +} fds_op_queue_t; + + +typedef struct +{ + fds_record_chunk_t chunk[FDS_CHUNK_QUEUE_SIZE]; + uint32_t rp; + uint32_t count; +} fds_chunk_queue_t; + + +enum +{ + PAGE_ERASED = 0x1, + PAGE_DATA = 0x2, + SWAP_EMPTY = 0x4, + SWAP_DIRTY = 0x8, +}; + + +typedef enum +{ + // This is a fatal error. + NO_PAGES, + + // All pages are erased. Perform a fresh installation. + FRESH_INSTALL = (PAGE_ERASED), + + // Swap is missing. Tag an erased page as swap. + TAG_SWAP = (PAGE_ERASED | PAGE_DATA), + + // Swap is empty. Tag all erased pages as data. + TAG_DATA = (PAGE_ERASED | SWAP_EMPTY), + + // Swap is empty. Tag all remaining erased pages as data. + TAG_DATA_INST = (PAGE_ERASED | PAGE_DATA | SWAP_EMPTY), + + // The swap is dirty. This indicates that the device powered off during GC. However, since there + // is also an erased page, it is possible to assume that that page had been entirely garbage + // collected. Hence, tag the swap as data, one erased page as swap and any remaining pages as data. + PROMOTE_SWAP = (PAGE_ERASED | SWAP_DIRTY), + + // Similar to the above. Tag the swap as data, one erased page as swap, and any remain + // pages as data. + PROMOTE_SWAP_INST = (PAGE_ERASED | PAGE_DATA | SWAP_DIRTY), + + // The swap is dirty (written) and there are no erased pages. This indicates that the device + // was powered off during GC. It is safe to discard (erase) the swap, since data that was + // swapped out lies in one of the valid pages. + DISCARD_SWAP = (PAGE_DATA | SWAP_DIRTY), + + // Do nothing. + ALREADY_INSTALLED = (PAGE_DATA | SWAP_EMPTY), + +} fds_init_opts_t; + + +typedef enum +{ + GC_BEGIN, // Begin GC. + GC_NEXT_PAGE, // GC a page. + GC_FIND_NEXT_RECORD, // Find a valid record to copy. + GC_COPY_RECORD, // Copy a valid record to swap. + GC_ERASE_PAGE, // Erase the page being garbage collected. + GC_DISCARD_SWAP, // Erase (discard) the swap page. + GC_PROMOTE_SWAP, // Tag the swap as valid. + GC_TAG_NEW_SWAP // Tag a freshly erased (GCed) page as swap. +} fds_gc_state_t; + + +// Holds garbage collection status and related data. +typedef struct +{ + fds_gc_state_t state; // The current GC step. + uint16_t cur_page; // The current page being garbage collected. + uint32_t const * p_record_src; // The current record being copied to swap. + uint16_t run_count; // Total number of times GC was run. + bool do_gc_page[FDS_MAX_PAGES]; // Controls which pages to garbage collect. + bool resume; // Whether or not GC should be resumed. +} fds_gc_data_t; + + +// Macros to enable and disable application interrupts. +#if defined (FDS_THREADS) + + #define CRITICAL_SECTION_ENTER() CRITICAL_REGION_ENTER() + #define CRITICAL_SECTION_EXIT() CRITICAL_REGION_EXIT() + +#else + + #define CRITICAL_SECTION_ENTER() + #define CRITICAL_SECTION_EXIT() + +#endif + + +#endif // FDS_INTERNAL_DEFS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/config/fstorage_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/config/fstorage_config.h new file mode 100644 index 0000000000..9ff7550997 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/config/fstorage_config.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef FS_CONFIG_H__ +#define FS_CONFIG_H__ + +/** + * @defgroup fstorage_config fstorage configuration + * @ingroup fstorage + * @{ + * + * @brief fstorage configuration options. + */ + + +/**@brief Configures the size of fstorage internal queue. + * @details Increase this if there are many users, or if it is likely that many operation will be + * queued at once without waiting for the previous operations to complete. In general, + * increase the queue size if you frequently receive @ref FS_ERR_QUEUE_FULL errors when + * calling @ref fs_store or @ref fs_erase. + */ +#define FS_QUEUE_SIZE (4) + +/**@brief Configures how many times should fstorage attempt to execute an operation if + * the SoftDevice fails to schedule flash access due to high BLE activity. + * @details Increase this value if fstorage events return the @ref FS_ERR_OPERATION_TIMEOUT error + * often. + */ +#define FS_OP_MAX_RETRIES (3) + + +/**@brief Configures the maximum number of words to be written to flash in a single operation. + * If data length exceeds this value, the data will be written down in several chunks, + * as necessary. + * + * @details Tweaking this value can increase the chances of the SoftDevice being able to fit + * flash operations in between radio activity. This value is bound by the maximum number + * of words which the SoftDevice can write to flash in a single call to + * @ref sd_flash_write, which is 256 words for nRF51 ICs and 1024 words for nRF52 ICs. + */ +#if defined (NRF51) + #define FS_MAX_WRITE_SIZE_WORDS (256) +#elif defined (NRF52) + #define FS_MAX_WRITE_SIZE_WORDS (1024) +#endif + +/** @} */ + +#endif // FS_CONFIG_H__ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.c new file mode 100644 index 0000000000..5cf3d8d426 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.c @@ -0,0 +1,521 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "fstorage.h" +#include "fstorage_config.h" +#include "fstorage_internal_defs.h" + +#include +#include +#include +#include "nrf_error.h" +#include "nrf_soc.h" + + +static uint8_t m_flags; // fstorage status flags. +static fs_op_queue_t m_queue; // Queue of requested operations. +static uint8_t m_retry_count; // Number of times the last flash operation was retried. + + +// Sends events to the application. +static void send_event(fs_op_t const * const p_op, fs_ret_t result) +{ + fs_evt_t evt; + memset(&evt, 0x00, sizeof(fs_evt_t)); + + switch (p_op->op_code) + { + case FS_OP_STORE: + evt.id = FS_EVT_STORE; + evt.store.p_data = p_op->store.p_dest; + evt.store.length_words = p_op->store.length_words; + break; + + case FS_OP_ERASE: + evt.id = FS_EVT_ERASE; + evt.erase.first_page = p_op->erase.page - p_op->erase.pages_erased; + evt.erase.last_page = p_op->erase.page; + break; + + default: + // Should not happen. + break; + } + + p_op->p_config->callback(&evt, result); +} + + +// Checks that a configuration is non-NULL and within section variable bounds. +static bool check_config(fs_config_t const * const config) +{ + if ((config != NULL) && + (FS_SECTION_VARS_START_ADDR <= (uint32_t)config) && + (FS_SECTION_VARS_END_ADDR > (uint32_t)config)) + { + return true; + } + + return false; +} + + +// Executes a store operation. +static uint32_t store_execute(fs_op_t const * const p_op) +{ + uint16_t chunk_len; + + if ((p_op->store.length_words - p_op->store.offset) < FS_MAX_WRITE_SIZE_WORDS) + { + chunk_len = p_op->store.length_words - p_op->store.offset; + } + else + { + chunk_len = FS_MAX_WRITE_SIZE_WORDS; + } + + return sd_flash_write((uint32_t*)p_op->store.p_dest + p_op->store.offset, + (uint32_t*)p_op->store.p_src + p_op->store.offset, + chunk_len); +} + + +// Executes an erase operation. +static uint32_t erase_execute(fs_op_t const * const p_op) +{ + return sd_flash_page_erase(p_op->erase.page); +} + + +// Advances the queue, wrapping around if necessary. +// If no elements are left in the queue, clears the FS_FLAG_PROCESSING flag. +static void queue_advance(void) +{ + if (--m_queue.count == 0) + { + m_flags &= ~FS_FLAG_PROCESSING; + } + + if (++m_queue.rp == FS_QUEUE_SIZE) + { + m_queue.rp = 0; + } +} + + +// Processes the current element in the queue. If the queue is empty, does nothing. +static void queue_process(void) +{ + uint32_t ret; + fs_op_t * const p_op = &m_queue.op[m_queue.rp]; + + if (m_queue.count > 0) + { + switch (p_op->op_code) + { + case FS_OP_STORE: + ret = store_execute(p_op); + break; + + case FS_OP_ERASE: + ret = erase_execute(p_op); + break; + + default: + ret = FS_ERR_INTERNAL; + break; + } + + // There is a pending flash operation which was not initiated by this module. + // Stop processing the queue and wait for a system event. + if (ret == NRF_ERROR_BUSY) + { + m_flags &= ~FS_FLAG_PROCESSING; + m_flags |= FS_FLAG_FLASH_REQ_PENDING; + } + else if (ret != NRF_SUCCESS) + { + // An error has occurred. + send_event(p_op, FS_ERR_INTERNAL); + } + else + { + // Operation is executing. + } + } +} + + +// Starts processing the queue if there are no pending flash operations, both inside and +// outside this module. Returns immediately otherwise. +static void queue_start(void) +{ + if (!(m_flags & FS_FLAG_PROCESSING) && + !(m_flags & FS_FLAG_FLASH_REQ_PENDING)) + { + m_flags |= FS_FLAG_PROCESSING; + queue_process(); + } +} + + +// Flash operation success callback handler. Keeps track of the progress of an operation. +// If it has finished, advances the queue and notifies the application. +static void on_operation_success(fs_op_t * const p_op) +{ + m_retry_count = 0; + + switch (p_op->op_code) + { + case FS_OP_STORE: + { + uint16_t chunk_len; + + if ((p_op->store.length_words - p_op->store.offset) < FS_MAX_WRITE_SIZE_WORDS) + { + chunk_len = p_op->store.length_words - p_op->store.offset; + } + else + { + chunk_len = FS_MAX_WRITE_SIZE_WORDS; + } + + p_op->store.offset += chunk_len; + + if (p_op->store.offset == p_op->store.length_words) + { + // The operation has finished. + send_event(p_op, FS_SUCCESS); + queue_advance(); + } + } + break; + + case FS_OP_ERASE: + { + p_op->erase.page++; + p_op->erase.pages_erased++; + + if (p_op->erase.pages_erased == p_op->erase.pages_to_erase) + { + send_event(p_op, FS_SUCCESS); + queue_advance(); + } + } + break; + + default: + // Should not happen. + break; + } +} + + +// Flash operation failure callback handler. If the maximum number of retries has +// been reached, notifies the application and advances the queue. +static void on_operation_failure(fs_op_t const * const p_op) +{ + if (++m_retry_count > FS_OP_MAX_RETRIES) + { + m_retry_count = 0; + + send_event(p_op, FS_ERR_OPERATION_TIMEOUT); + queue_advance(); + } +} + + +// Retrieves a pointer to the next free element in the queue. +// Additionally, increases the number of elements stored in the queue. +static bool queue_get_next_free(fs_op_t ** p_op) +{ + uint32_t idx; + + if (m_queue.count == FS_QUEUE_SIZE) + { + return false; + } + + idx = ((m_queue.rp + m_queue.count) < FS_QUEUE_SIZE) ? + (m_queue.rp + m_queue.count) : 0; + + m_queue.count++; + + // Zero the element so that unassigned fields will be zero. + memset(&m_queue.op[idx], 0x00, sizeof(fs_op_t)); + + *p_op = &m_queue.op[idx]; + + return true; +} + + +fs_ret_t fs_init(void) +{ + uint32_t const users = FS_SECTION_VARS_COUNT; + uint32_t const * p_current_end = FS_PAGE_END_ADDR; + uint32_t index_max = 0x00; + uint32_t index_last = 0xFFFFFFFF; + + if (m_flags & FS_FLAG_INITIALIZED) + { + return FS_SUCCESS; + } + + #if 0 + // Check for configurations with duplicate priority. + for (uint32_t i = 0; i < users; i++) + { + for (uint32_t j = i + 1; j < users; j++) + { + fs_config_t const * const p_config_i = FS_SECTION_VARS_GET(i); + fs_config_t const * const p_config_j = FS_SECTION_VARS_GET(j); + + if (p_config_i->page_order == p_config_j->page_order) + { + // Error. + return FS_ERR_INVALID_CFG; + } + } + } + #endif + + // Assign pages to registered users, beginning with the ones with the highest + // priority, which will be assigned pages with the highest memory address. + + for (uint32_t i = 0; i < users; i++) + { + uint8_t max_priority = 0x00; + + for (uint32_t j = 0; j < users; j++) + { + fs_config_t * const p_config = FS_SECTION_VARS_GET(j); + + // Skip the one assigned during last iteration. + if (j == index_last) + { + continue; + } + + if (p_config->priority >= max_priority) + { + max_priority = p_config->priority; + index_max = j; + } + } + + fs_config_t * const p_config = FS_SECTION_VARS_GET(index_max); + + p_config->p_end_addr = p_current_end; + p_config->p_start_addr = p_current_end - (p_config->num_pages * FS_PAGE_SIZE_WORDS); + + p_current_end = p_config->p_start_addr; + + index_last = index_max; + } + + m_flags |= FS_FLAG_INITIALIZED; + + return FS_SUCCESS; +} + + +fs_ret_t fs_store(fs_config_t const * const p_config, + uint32_t const * const p_dest, + uint32_t const * const p_src, + uint16_t const length_words) +{ + fs_op_t * p_op; + + if (!(m_flags & FS_FLAG_INITIALIZED)) + { + return FS_ERR_NOT_INITIALIZED; + } + + if (!check_config(p_config)) + { + return FS_ERR_INVALID_CFG; + } + + if ((p_src == NULL) || (p_dest == NULL)) + { + return FS_ERR_NULL_ARG; + } + + // Check that both pointers are word aligned. + if (((uint32_t)p_src & 0x03) || + ((uint32_t)p_dest & 0x03)) + { + return FS_ERR_UNALIGNED_ADDR; + } + + // Check that the operation doesn't go outside the client's memory boundaries. + if ((p_config->p_start_addr > p_dest) || + (p_config->p_end_addr < (p_dest + length_words))) + { + return FS_ERR_INVALID_ADDR; + } + + if (length_words == 0) + { + return FS_ERR_INVALID_ARG; + } + + if (!queue_get_next_free(&p_op)) + { + return FS_ERR_QUEUE_FULL; + } + + // Initialize the operation. + p_op->p_config = p_config; + p_op->op_code = FS_OP_STORE; + p_op->store.p_src = p_src; + p_op->store.p_dest = p_dest; + p_op->store.length_words = length_words; + + queue_start(); + + return FS_SUCCESS; +} + + +fs_ret_t fs_erase(fs_config_t const * const p_config, + uint32_t const * const p_page_addr, + uint16_t const num_pages) +{ + fs_op_t * p_op; + + if (!(m_flags & FS_FLAG_INITIALIZED)) + { + return FS_ERR_NOT_INITIALIZED; + } + + if (!check_config(p_config)) + { + return FS_ERR_INVALID_CFG; + } + + if (p_page_addr == NULL) + { + return FS_ERR_NULL_ARG; + } + + // Check that the page is aligned to a page boundary. + if (((uint32_t)p_page_addr % FS_PAGE_SIZE) != 0) + { + return FS_ERR_UNALIGNED_ADDR; + } + + // Check that the operation doesn't go outside the client's memory boundaries. + if ((p_page_addr < p_config->p_start_addr) || + (p_page_addr + (FS_PAGE_SIZE_WORDS * num_pages) > p_config->p_end_addr)) + { + return FS_ERR_INVALID_ADDR; + } + + if (num_pages == 0) + { + return FS_ERR_INVALID_ARG; + } + + if (!queue_get_next_free(&p_op)) + { + return FS_ERR_QUEUE_FULL; + } + + // Initialize the operation. + p_op->p_config = p_config; + p_op->op_code = FS_OP_ERASE; + p_op->erase.page = ((uint32_t)p_page_addr / FS_PAGE_SIZE); + p_op->erase.pages_to_erase = num_pages; + + queue_start(); + + return FS_SUCCESS; +} + + +fs_ret_t fs_queued_op_count_get(uint32_t * const p_op_count) +{ + if (p_op_count == NULL) + { + return FS_ERR_NULL_ARG; + } + + *p_op_count = m_queue.count; + + return FS_SUCCESS; +} + + +void fs_sys_event_handler(uint32_t sys_evt) +{ + fs_op_t * const p_op = &m_queue.op[m_queue.rp]; + + if (m_flags & FS_FLAG_PROCESSING) + { + // A flash operation was initiated by this module. Handle the result. + switch (sys_evt) + { + case NRF_EVT_FLASH_OPERATION_SUCCESS: + on_operation_success(p_op); + break; + + case NRF_EVT_FLASH_OPERATION_ERROR: + on_operation_failure(p_op); + break; + } + } + else if ((m_flags & FS_FLAG_FLASH_REQ_PENDING)) + { + // A flash operation was initiated outside this module. + // A callback which indicates that it has finished was received. + m_flags &= ~FS_FLAG_FLASH_REQ_PENDING; + + // If there are any elements left in the queue, set FS_FLAG_PROCESSING. + if (m_queue.count > 0) + { + m_flags |= FS_FLAG_PROCESSING; + } + } + + // Resume processing the queue, if necessary. + queue_process(); +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.h new file mode 100644 index 0000000000..718406abf0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.h @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef FSTORAGE_H__ +#define FSTORAGE_H__ + +/** + * @defgroup fstorage fstorage + * @ingroup app_common + * @{ + * + * @brief Module which provides functionality to store data to flash and erase flash pages. + */ + +#include +#include "section_vars.h" + + +/**@brief fstorage return values. */ +typedef enum +{ + FS_SUCCESS, + FS_ERR_NOT_INITIALIZED, //!< Error. The module is not initialized. + FS_ERR_INVALID_CFG, //!< Error. Invalid fstorage configuration. + FS_ERR_NULL_ARG, //!< Error. Argument is NULL. + FS_ERR_INVALID_ARG, //!< Error. Argument contains invalid data. + FS_ERR_INVALID_ADDR, //!< Error. Address out of bounds. + FS_ERR_UNALIGNED_ADDR, //!< Error. Unaligned address. + FS_ERR_QUEUE_FULL, //!< Error. Queue is full. + FS_ERR_OPERATION_TIMEOUT, //!< Error. The operation has timed out. + FS_ERR_INTERNAL, //!< Error. Internal error. +} fs_ret_t; + + +/**@brief fstorage event IDs. */ +typedef enum +{ + FS_EVT_STORE, //!< Event for @ref fs_store. + FS_EVT_ERASE //!< Event for @ref fs_erase. +} fs_evt_id_t; + + +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#endif + +/**@brief An fstorage event. */ +typedef struct +{ + fs_evt_id_t id; //!< The event ID. + union + { + struct + { + uint32_t const * p_data; //!< Pointer to the data stored in flash. + uint16_t length_words; //!< Length of the data, in 4-byte words. + } store; + struct + { + uint16_t first_page; //!< First page erased. + uint16_t last_page; //!< Last page erased. + } erase; + }; +} fs_evt_t; + +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + /* leave anonymous unions enabled */ +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#endif + + +/**@brief fstorage event handler function prototype. + * + * @param[in] evt The event. + * @param[in] result The result of the operation. + */ +typedef void (*fs_cb_t)(fs_evt_t const * const evt, fs_ret_t result); + + +/**@brief fstorage application-specific configuration. + * + * @details Specifies the callback to invoke when an operation completes, the number of flash pages + * requested by the application and the priority with which these are to be assigned, with + * respect to other applications. Additionally, the configuration specifies the boundaries + * of the flash space assigned to an application. The configuration must be provided as an + * argument when invoking @ref fs_store and @ref fs_erase. + * + * @note The fields @p p_start_addr and @p p_end_address are set by @ref fs_init, based on the + * value of the field @p priority. + */ +typedef struct +{ + /**@brief The beginning of the flash space assigned to the application which registered this + * configuration. This field is set by @ref fs_init. + */ + uint32_t const * p_start_addr; + + /**@brief The end of the flash space assigned to the application which registered this + * configuration. This field is set by @ref fs_init. + */ + uint32_t const * p_end_addr; + + fs_cb_t const callback; //!< Callback to run when a flash operation has completed. + uint8_t const num_pages; //!< The number of flash pages requested. + + /**@brief The priority with which fstorage should assign flash pages to this application, + * with respect to other applications. Applications with higher priority will be + * assigned flash pages with a higher memory address. The highest priority is + * reserved. Must be unique among configurations. + */ + uint8_t const priority; +} fs_config_t; + + +/**@brief Macro for registering with an fstorage configuration. + * Applications which use fstorage must register with the module using this macro. + * Registering involves defining a variable which holds the configuration of fstorage + * specific to the application which invokes the macro. + * + * @details This macro places the configuration variable in a section named "fs_data" that + * fstorage uses during initialization and regular operation. + * + * @param[in] cfg_var A @e definition of a @ref fs_config_t variable. + */ +#define FS_REGISTER_CFG(cfg_var) NRF_SECTION_VARS_ADD(fs_data, cfg_var) + + +/**@brief Function for initializing the module. + * + * @details This functions assigns pages in flash according to all registered configurations. + * + * @retval FS_SUCCESS If the module was successfully initialized. + */ +fs_ret_t fs_init(void); + + +/**@brief Function for storing data in flash. + * + * @details Copies @p length_words words from @p p_src to the location pointed by @p p_dest. + * If the length of the data exceeds @ref FS_MAX_WRITE_SIZE_WORDS, the data will be + * written down in several chunks, as necessary. Only one event will be sent to the + * application upon completion. Both the source and the destination of the data must be + * word aligned. This function is asynchronous, completion is reported via an event sent + * the the callback function specified in the supplied configuration. + * + * @warning The data to be written to flash has to be kept in memory until the operation has + * terminated, i.e., an event is received. + * + * @param[in] p_config fstorage configuration registered by the application. + * @param[in] p_dest The address in flash memory where to store the data. + * @param[in] p_src Pointer to the data to store in flash. + * @param[in] length_words Length of the data to store, in words. + * + * @retval FS_SUCCESS If the operation was queued successfully. + * @retval FS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FS_ERR_INVALID_CFG If @p p_config is NULL or contains invalid data. + * @retval FS_ERR_NULL_ARG If @p p_dest or @p p_src are NULL. + * @retval FS_ERR_INVALID_ARG If @p length_words is zero. + * @retval FS_ERR_INVALID_ADDR If @p p_dest or @p p_src are outside of the flash memory + * boundaries specified in @p p_config. + * @retval FS_ERR_UNALIGNED_ADDR If @p p_dest or @p p_src are not aligned to a word boundary. + * @retval FS_ERR_QUEUE_FULL If the internal operation queue is full. + */ +fs_ret_t fs_store(fs_config_t const * const p_config, + uint32_t const * const p_dest, + uint32_t const * const p_src, + uint16_t length_words); + + +/**@brief Function for erasing flash pages. + * + * @details Starting from the page at @p p_page_addr, erases @p num_pages flash pages. + * @p p_page_addr must be aligned to a page boundary. All pages to be erased must be + * within the bounds specified in the supplied fstorage configuration. + * This function is asynchronous. Completion is reported via an event. + * + * @param[in] p_config fstorage configuration registered by the application. + * @param[in] p_page_addr Address of the page to erase. Must be aligned to a page boundary. + * @param[in] num_pages Number of pages to erase. May not be zero. + * + * @retval FS_SUCCESS If the operation was queued successfully. + * @retval FS_ERR_NOT_INITIALIZED If the module is not initialized. + * @retval FS_ERR_INVALID_CFG If @p p_config is NULL or contains invalid data. + * @retval FS_ERR_NULL_ARG If @p p_page_addr is NULL. + * @retval FS_ERR_INVALID_ARG If @p num_pages is zero. + * @retval FS_ERR_INVALID_ADDR If the operation would go beyond the flash memory boundaries + * specified in @p p_config. + * @retval FS_ERR_UNALIGNED_ADDR If @p p_page_addr is not aligned to a page boundary. + * @retval FS_ERR_QUEUE_FULL If the internal operation queue is full. + */ +fs_ret_t fs_erase(fs_config_t const * const p_config, + uint32_t const * const p_page_addr, + uint16_t num_pages); + + +/**@brief Function for retrieving the number of queued flash operations. + * + * @param[out] p_op_count The number of queued flash operations. + * + * @retval FS_SUCCESS If the number of queued operations was retrieved successfully. + * @retval FS_ERR_NULL_ARG If @p p_op_count is NULL. + */ +fs_ret_t fs_queued_op_count_get(uint32_t * const p_op_count); + + +/**@brief Function for handling system events from the SoftDevice. + * + * @details If any of the modules used by the application rely on fstorage, the application should + * dispatch system events to fstorage using this function. + * + * @param[in] sys_evt System event from the SoftDevice. + */ +void fs_sys_event_handler(uint32_t sys_evt); + + +/** @} */ + +#endif // FSTORAGE_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_internal_defs.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_internal_defs.h new file mode 100644 index 0000000000..8f8e4bbea2 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_internal_defs.h @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef FSTORAGE_INTERNAL_DEFS_H__ +#define FSTORAGE_INTERNAL_DEFS_H__ + +#include "nrf.h" + + +#define FS_FLAG_INITIALIZED (1 << 0) // The module has been initialized. +#define FS_FLAG_PROCESSING (1 << 1) // The module is processing flash operations. +// The module is waiting for a flash operation initiated by another module to complete. +#define FS_FLAG_FLASH_REQ_PENDING (1 << 2) + +#define FS_ERASED_WORD (0xFFFFFFFF) + +// Helper macros for section variables. +#define FS_SECTION_VARS_GET(i) NRF_SECTION_VARS_GET((i), fs_config_t, fs_data) +#define FS_SECTION_VARS_COUNT NRF_SECTION_VARS_COUNT(fs_config_t, fs_data) +#define FS_SECTION_VARS_START_ADDR NRF_SECTION_VARS_START_ADDR(fs_data) +#define FS_SECTION_VARS_END_ADDR NRF_SECTION_VARS_END_ADDR(fs_data) + + +// Register the section 'fs_data'. +//lint -save -e19 +NRF_SECTION_VARS_REGISTER_SECTION(fs_data); +//lint -restore + +// Declare symbols into the 'fs_data' section. +NRF_SECTION_VARS_REGISTER_SYMBOLS(fs_config_t, fs_data); +//lint -esym(526,fs_dataBase) +//lint -esym(526,fs_dataLimit) + + +// fstorage op-codes. +typedef enum +{ + FS_OP_NONE, // No operation. + FS_OP_STORE, // Store data. + FS_OP_ERASE // Erase one or more flash pages. +} fs_op_code_t; + + +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + // anonymous unions are enabled by default. +#endif + +// fstorage operation. +// Encapsulates details of a flash operation to be executed by this module. +typedef struct +{ + fs_config_t const * p_config; // Application-specific fstorage configuration. + fs_op_code_t op_code; // ID of the operation. + union + { + struct + { + uint32_t const * p_src; // Pointer to the data to be written to flash. + uint32_t const * p_dest; // Destination of the data in flash. + uint16_t length_words; // Length of the data to be written, in words. + uint16_t offset; // Write offset. + } store; + struct + { + uint16_t page; + uint16_t pages_erased; + uint16_t pages_to_erase; + } erase; + }; +} fs_op_t; + +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + // leave anonymous unions enabled. +#elif defined(__GNUC__) + // anonymous unions are enabled by default. +#endif + + +// Queue of requested operations. +// This queue holds flash operations requested to the module. +// The data to be written to flash must be kept in memory until the write operation +// is completed, i.e., an event indicating completion is received. +typedef struct +{ + fs_op_t op[FS_QUEUE_SIZE]; // Queue elements. + uint32_t rp; // Index of the operation being processed. + uint32_t count; // Number of elements in the queue. +} fs_op_queue_t; + + +// Size of a flash page in bytes. +#if defined (NRF51) + #define FS_PAGE_SIZE (1024) +#elif defined (NRF52) + #define FS_PAGE_SIZE (4096) +#endif + + +// Size of a flash page in words. +#define FS_PAGE_SIZE_WORDS (FS_PAGE_SIZE / sizeof(uint32_t)) + + +// Function to obtain the end of the flash space available to fstorage. +static uint32_t const * fs_flash_page_end_addr() +{ + uint32_t const bootloader_addr = NRF_UICR->NRFFW[0]; + + return (uint32_t*)((bootloader_addr != FS_ERASED_WORD) ? bootloader_addr : + NRF_FICR->CODESIZE * FS_PAGE_SIZE); +} + + +// Macro to obtain the address of the last page. +// If there is a bootloader present the bootloader address read from UICR +// will act as the page beyond the end of the available flash storage. +#define FS_PAGE_END_ADDR (fs_flash_page_end_addr()) + + +#endif //__FSTORAGE_INTERNAL_DEFS_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_nosd.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_nosd.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_mem_pool_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_mem_pool_internal.h new file mode 100644 index 0000000000..92594915ac --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_mem_pool_internal.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup memory_pool_internal Memory Pool Internal + * @{ + * @ingroup memory_pool + * + * @brief Memory pool internal definitions + */ + +#ifndef MEM_POOL_INTERNAL_H__ +#define MEM_POOL_INTERNAL_H__ + +#define TX_BUF_SIZE 600u /**< TX buffer size in bytes. */ +#define RX_BUF_SIZE TX_BUF_SIZE /**< RX buffer size in bytes. */ + +#define RX_BUF_QUEUE_SIZE 4u /**< RX buffer element size. */ + +#endif // MEM_POOL_INTERNAL_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_transport_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_transport_config.h new file mode 100644 index 0000000000..fdff490056 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_transport_config.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @brief Definition of HCI Transport Layer configurable parameters + */ + +#ifndef HCI_TRANSPORT_CFG_H__ +#define HCI_TRANSPORT_CFG_H__ + +/** This section covers configurable parameters for the HCI Transport SLIP layer. */ +#define HCI_SLIP_UART_RX_PIN_NUMBER 1 /**< Defines the UART RX pin number. The default pin for the board is chosen, but can be overwritten. */ + +#define HCI_SLIP_UART_TX_PIN_NUMBER 2 /**< Defines the UART TX pin number. The default pin for the board is chosen, but can be overwritten. */ + +#define HCI_SLIP_UART_RTS_PIN_NUMBER 3 /**< Defines the UART RTS pin number. The default pin for the board is chosen, but can be overwritten. */ + +#define HCI_SLIP_UART_CTS_PIN_NUMBER 4 /**< Defines the UART CTS pin number. The default pin for the board is chosen, but can be overwritten. */ + +#define HCI_SLIP_UART_MODE APP_UART_FLOW_CONTROL_ENABLED /**< Defines the UART mode to be used. Use UART Low Power with Flow Control - Valid values are defined in \ref app_uart_flow_control_t. For further information on the UART Low Power mode, please refer to: \ref app_uart . */ + +#define HCI_SLIP_UART_BAUDRATE UART_BAUDRATE_BAUDRATE_Baud38400 /**< Defines the UART Baud rate. Default is 38400 baud. */ + +/** This section covers configurable parameters for the HCI Transport layer that are used for calculating correct value for the retransmission timer timeout. */ +#define MAX_PACKET_SIZE_IN_BITS 8000u /**< Maximum size of a single application packet in bits. */ +#define USED_BAUD_RATE 38400u /**< The used uart baudrate. */ + +#endif // HCI_TRANSPORT_CFG_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.c new file mode 100644 index 0000000000..cefb91eb2f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.c @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "hci_mem_pool.h" +#include "hci_mem_pool_internal.h" +#include +#include + +/**@brief RX buffer element instance structure. + */ +typedef struct +{ + uint8_t rx_buffer[RX_BUF_SIZE]; /**< RX buffer memory array. */ + uint32_t length; /**< Length of the RX buffer memory array. */ +} rx_buffer_elem_t; + +/**@brief RX buffer queue element instance structure. + */ +typedef struct +{ + rx_buffer_elem_t * p_buffer; /**< Pointer to RX buffer element. */ + uint32_t free_window_count; /**< Free space element count. */ + uint32_t free_available_count; /**< Free area element count. */ + uint32_t read_available_count; /**< Read area element count. */ + uint32_t write_index; /**< Write position index. */ + uint32_t read_index; /**< Read position index. */ + uint32_t free_index; /**< Free position index. */ +} rx_buffer_queue_t; + +static bool m_is_tx_allocated; /**< Boolean value to determine if the TX buffer is allocated. */ +static rx_buffer_elem_t m_rx_buffer_elem_queue[RX_BUF_QUEUE_SIZE]; /**< RX buffer element instances. */ +static rx_buffer_queue_t m_rx_buffer_queue; /**< RX buffer queue element instance. */ + + +uint32_t hci_mem_pool_open(void) +{ + m_is_tx_allocated = false; + m_rx_buffer_queue.p_buffer = m_rx_buffer_elem_queue; + m_rx_buffer_queue.free_window_count = RX_BUF_QUEUE_SIZE; + m_rx_buffer_queue.free_available_count = 0; + m_rx_buffer_queue.read_available_count = 0; + m_rx_buffer_queue.write_index = 0; + m_rx_buffer_queue.read_index = 0; + m_rx_buffer_queue.free_index = 0; + + return NRF_SUCCESS; +} + + +uint32_t hci_mem_pool_close(void) +{ + return NRF_SUCCESS; +} + + +uint32_t hci_mem_pool_tx_alloc(void ** pp_buffer) +{ + static uint8_t tx_buffer[TX_BUF_SIZE]; + + uint32_t err_code; + + if (pp_buffer == NULL) + { + return NRF_ERROR_NULL; + } + + if (!m_is_tx_allocated) + { + m_is_tx_allocated = true; + *pp_buffer = tx_buffer; + err_code = NRF_SUCCESS; + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + + return err_code; +} + + +uint32_t hci_mem_pool_tx_free(void) +{ + m_is_tx_allocated = false; + + return NRF_SUCCESS; +} + + +uint32_t hci_mem_pool_rx_produce(uint32_t length, void ** pp_buffer) +{ + uint32_t err_code; + + if (pp_buffer == NULL) + { + return NRF_ERROR_NULL; + } + *pp_buffer = NULL; + + if (m_rx_buffer_queue.free_window_count != 0) + { + if (length <= RX_BUF_SIZE) + { + --(m_rx_buffer_queue.free_window_count); + ++(m_rx_buffer_queue.read_available_count); + + *pp_buffer = + m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.write_index].rx_buffer; + + m_rx_buffer_queue.free_index |= (1u << m_rx_buffer_queue.write_index); + + // @note: Adjust the write_index making use of the fact that the buffer size is of + // power of two and two's complement arithmetic. For details refer example to book + // "Making embedded systems: Elicia White". + m_rx_buffer_queue.write_index = + (m_rx_buffer_queue.write_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); + + err_code = NRF_SUCCESS; + } + else + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + + return err_code; +} + + +uint32_t hci_mem_pool_rx_consume(uint8_t * p_buffer) +{ + uint32_t err_code; + uint32_t consume_index; + uint32_t start_index; + + if (m_rx_buffer_queue.free_available_count != 0) + { + // Find the buffer that has been freed - + // Start at read_index minus free_available_count and then increment until read index. + err_code = NRF_ERROR_INVALID_ADDR; + consume_index = (m_rx_buffer_queue.read_index - m_rx_buffer_queue.free_available_count) & + (RX_BUF_QUEUE_SIZE - 1u); + start_index = consume_index; + + do + { + if (m_rx_buffer_queue.p_buffer[consume_index].rx_buffer == p_buffer) + { + m_rx_buffer_queue.free_index ^= (1u << consume_index); + err_code = NRF_SUCCESS; + break; + } + else + { + consume_index = (consume_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); + } + } + while (consume_index != m_rx_buffer_queue.read_index); + + while (!(m_rx_buffer_queue.free_index & (1 << start_index)) && + (m_rx_buffer_queue.free_available_count != 0)) + { + --(m_rx_buffer_queue.free_available_count); + ++(m_rx_buffer_queue.free_window_count); + start_index = (consume_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); + } + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + + return err_code; +} + + +uint32_t hci_mem_pool_rx_data_size_set(uint32_t length) +{ + // @note: Adjust the write_index making use of the fact that the buffer size is of power + // of two and two's complement arithmetic. For details refer example to book + // "Making embedded systems: Elicia White". + const uint32_t index = (m_rx_buffer_queue.write_index - 1u) & (RX_BUF_QUEUE_SIZE - 1u); + m_rx_buffer_queue.p_buffer[index].length = length; + + return NRF_SUCCESS; +} + + +uint32_t hci_mem_pool_rx_extract(uint8_t ** pp_buffer, uint32_t * p_length) +{ + uint32_t err_code; + + if ((pp_buffer == NULL) || (p_length == NULL)) + { + return NRF_ERROR_NULL; + } + + if (m_rx_buffer_queue.read_available_count != 0) + { + --(m_rx_buffer_queue.read_available_count); + ++(m_rx_buffer_queue.free_available_count); + + *pp_buffer = + m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.read_index].rx_buffer; + *p_length = + m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.read_index].length; + + // @note: Adjust the write_index making use of the fact that the buffer size is of power + // of two and two's complement arithmetic. For details refer example to book + // "Making embedded systems: Elicia White". + m_rx_buffer_queue.read_index = + (m_rx_buffer_queue.read_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); + + err_code = NRF_SUCCESS; + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + + return err_code; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.h new file mode 100644 index 0000000000..e4f7358b8f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.h @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup memory_pool Memory pool + * @{ + * @ingroup app_common + * + * @brief Memory pool implementation + * + * Memory pool implementation, based on circular buffer data structure, which supports asynchronous + * processing of RX data. The current default implementation supports 1 TX buffer and 4 RX buffers. + * The memory managed by the pool is allocated from static storage instead of heap. The internal + * design of the circular buffer implementing the RX memory layout is illustrated in the picture + * below. + * + * @image html memory_pool.png "Circular buffer design" + * + * The expected call order for the RX APIs is as follows: + * - hci_mem_pool_rx_produce + * - hci_mem_pool_rx_data_size_set + * - hci_mem_pool_rx_extract + * - hci_mem_pool_rx_consume + * + * @warning If the above mentioned expected call order is violated the end result can be undefined. + * + * \par Component specific configuration options + * + * The following compile time configuration options are available to suit various implementations: + * - TX_BUF_SIZE TX buffer size in bytes. + * - RX_BUF_SIZE RX buffer size in bytes. + * - RX_BUF_QUEUE_SIZE RX buffer element size. + */ + +#ifndef HCI_MEM_POOL_H__ +#define HCI_MEM_POOL_H__ + +#include +#include "nrf_error.h" + +/**@brief Function for opening the module. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t hci_mem_pool_open(void); + +/**@brief Function for closing the module. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t hci_mem_pool_close(void); + +/**@brief Function for allocating requested amount of TX memory. + * + * @param[out] pp_buffer Pointer to the allocated memory. + * + * @retval NRF_SUCCESS Operation success. Memory was allocated. + * @retval NRF_ERROR_NO_MEM Operation failure. No memory available for allocation. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t hci_mem_pool_tx_alloc(void ** pp_buffer); + +/**@brief Function for freeing previously allocated TX memory. + * + * @note Memory management follows the FIFO principle meaning that free() order must match the + * alloc(...) order, which is the reason for omitting exact memory block identifier as an + * input parameter. + * + * @retval NRF_SUCCESS Operation success. Memory was freed. + */ +uint32_t hci_mem_pool_tx_free(void); + +/**@brief Function for producing a free RX memory block for usage. + * + * @note Upon produce request amount being 0, NRF_SUCCESS is returned. + * + * @param[in] length Amount, in bytes, of free memory to be produced. + * @param[out] pp_buffer Pointer to the allocated memory. + * + * @retval NRF_SUCCESS Operation success. Free RX memory block produced. + * @retval NRF_ERROR_NO_MEM Operation failure. No suitable memory available for allocation. + * @retval NRF_ERROR_DATA_SIZE Operation failure. Request size exceeds limit. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t hci_mem_pool_rx_produce(uint32_t length, void ** pp_buffer); + +/**@brief Function for setting the length of the last produced RX memory block. + * + * @warning If call to this API is omitted the end result is that the following call to + * mem_pool_rx_extract will return incorrect data in the p_length output parameter. + * + * @param[in] length Amount, in bytes, of actual memory used. + * + * @retval NRF_SUCCESS Operation success. Length was set. + */ +uint32_t hci_mem_pool_rx_data_size_set(uint32_t length); + +/**@brief Function for extracting a packet, which has been filled with read data, for further + * processing. + * + * @param[out] pp_buffer Pointer to the packet data. + * @param[out] p_length Length of packet data in bytes. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NO_MEM Operation failure. No packet available to extract. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t hci_mem_pool_rx_extract(uint8_t ** pp_buffer, uint32_t * p_length); + +/**@brief Function for freeing previously extracted packet, which has been filled with read data. + * + * @param[in] p_buffer Pointer to consumed buffer. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NO_MEM Operation failure. No packet available to free. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer. + */ +uint32_t hci_mem_pool_rx_consume(uint8_t * p_buffer); + +#endif // HCI_MEM_POOL_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.c new file mode 100644 index 0000000000..0a090efc65 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.c @@ -0,0 +1,907 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "app_pwm.h" +#include "nrf_drv_timer.h" +#include "nrf_drv_ppi.h" +#include "nrf_drv_common.h" +#include "nrf_drv_gpiote.h" +#include "nrf_gpiote.h" +#include "nrf_gpio.h" +#include "app_util.h" +#include "app_util_platform.h" +#include "nrf_assert.h" + +#define APP_PWM_CHANNEL_INITIALIZED 1 +#define APP_PWM_CHANNEL_UNINITIALIZED 0 + +#define APP_PWM_CHANNEL_ENABLED 1 +#define APP_PWM_CHANNEL_DISABLED 0 + +#define TIMER_PRESCALER_MAX 9 +#define TIMER_MAX_PULSEWIDTH_US_ON_16M 4095 + +#define APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE 2 +#define APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL 2 + +#define UNALLOCATED 0xFFFFFFFFUL +#define BUSY_STATE_CHANGING 0xFE +#define BUSY_STATE_IDLE 0xFF + +#define PWM_MAIN_CC_CHANNEL 2 +#define PWM_SECONDARY_CC_CHANNEL 3 + +#ifdef NRF52 + static bool m_use_ppi_delay_workaround; +#endif + + +/** + * @brief PWM busy status + * + * Stores the number of a channel being currently updated. + * + */ +static volatile uint8_t m_pwm_busy[TIMER_COUNT]; + + +/** + * @brief New duty cycle value + * + * When the channel duty cycle reaches this value, the update process is complete. + */ +static volatile uint32_t m_pwm_target_value[TIMER_COUNT]; + + +/** + * @brief PWM ready counter + * + * The value in this counter is decremented in every PWM cycle after initiating the update. + * If an event handler function was specified by the user, it is being called + * after two cycle events (at least one full PWM cycle). + */ +volatile uint8_t m_pwm_ready_counter[TIMER_COUNT][APP_PWM_CHANNELS_PER_INSTANCE]; + +/** + * @brief Pointers to instances + * + * This array connects any active timer instance number with the pointer to the PWM instance. + * It is used by the interrupt runtime. + */ +static const app_pwm_t * m_instances[TIMER_COUNT]; + +// Macros for getting the polarity of given instance/channel. +#define POLARITY_ACTIVE(INST,CH) (( ((INST)->p_cb)->channels_cb[(CH)].polarity == \ + APP_PWM_POLARITY_ACTIVE_LOW)?(0):(1)) +#define POLARITY_INACTIVE(INST,CH) (( ((INST)->p_cb)->channels_cb[(CH)].polarity == \ + APP_PWM_POLARITY_ACTIVE_LOW)?(1):(0)) + +//lint -save -e534 + +/** + * @brief Workaround for PAN-73. + * + * @param[in] timer Timer. + * @param[in] enable Enable or disable. + */ +static void pan73_workaround(NRF_TIMER_Type * p_timer, bool enable) +{ +#ifdef NRF51 + if (p_timer == NRF_TIMER0) + { + *(uint32_t *)0x40008C0C = (enable ? 1 : 0); + } + else if (p_timer == NRF_TIMER1) + { + *(uint32_t *)0x40009C0C = (enable ? 1 : 0); + } + else if (p_timer == NRF_TIMER2) + { + *(uint32_t *)0x4000AC0C = (enable ? 1 : 0); + } +#endif + return; +} + +bool app_pwm_busy_check(app_pwm_t const * const p_instance) +{ + uint8_t busy_state = (m_pwm_busy[p_instance->p_timer->instance_id]); + bool busy = true; + if (busy_state != BUSY_STATE_IDLE) + { + if (busy_state != BUSY_STATE_CHANGING) + { + if (nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) busy_state) + == m_pwm_target_value[p_instance->p_timer->instance_id]) + { + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; + busy = false; + } + } + } + else + { + busy = false; + } + return busy; +} + + +/** + * @brief Function for enabling the IRQ for a given PWM instance. + * + * @param[in] p_instance PWM instance. + */ +__STATIC_INLINE void pwm_irq_enable(app_pwm_t const * const p_instance) +{ + nrf_drv_timer_compare_int_enable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL); +} + + +/** + * @brief Function for disabling the IRQ for a given PWM instance. + * + * @param[in] p_instance PWM instance. + */ +__STATIC_INLINE void pwm_irq_disable(app_pwm_t const * const p_instance) +{ + nrf_drv_timer_compare_int_disable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL); +} + + +/** + * @brief Function for disabling PWM channel PPI. + * + * @param[in] p_instance PWM instance. + */ +__STATIC_INLINE void pwm_channel_ppi_disable(app_pwm_t const * const p_instance, uint8_t channel) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + + nrf_drv_ppi_channel_disable(p_cb->channels_cb[channel].ppi_channels[0]); + nrf_drv_ppi_channel_disable(p_cb->channels_cb[channel].ppi_channels[1]); +} + + +/** + * @brief Function for disabling PWM PPI. + * + * @param[in] p_instance PWM instance. + */ +__STATIC_INLINE void pwm_ppi_disable(app_pwm_t const * const p_instance) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + + nrf_drv_ppi_channel_disable(p_cb->ppi_channels[0]); + nrf_drv_ppi_channel_disable(p_cb->ppi_channels[1]); +} + + +/** + * @brief This function is called on interrupt after duty set. + * + * @param[in] timer Timer used by PWM. + * @param[in] timer_instance_id Timer index. + */ +void pwm_ready_tick(nrf_timer_event_t event_type, void * p_context) +{ + uint32_t timer_instance_id = (uint32_t)p_context; + uint8_t disable = 1; + + for (uint8_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel) + { + if (m_pwm_ready_counter[timer_instance_id][channel]) + { + --m_pwm_ready_counter[timer_instance_id][channel]; + if (!m_pwm_ready_counter[timer_instance_id][channel]) + { + app_pwm_cb_t * p_cb = m_instances[timer_instance_id]->p_cb; + p_cb->p_ready_callback(timer_instance_id); + } + else + { + disable = 0; + } + } + } + + if (disable) + { + pwm_irq_disable(m_instances[timer_instance_id]); + } +} + + +/** + * @brief Function for resource de-allocation. + * + * @param[in] p_instance PWM instance. + */ +//lint -e{650} +static void pwm_dealloc(app_pwm_t const * const p_instance) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + + for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++i) + { + if (p_cb->ppi_channels[i] != (nrf_ppi_channel_t)(uint8_t)(UNALLOCATED)) + { + nrf_drv_ppi_channel_free(p_cb->ppi_channels[i]); + } + } + if (p_cb->ppi_group != (nrf_ppi_channel_group_t)UNALLOCATED) + { + nrf_drv_ppi_group_free(p_cb->ppi_group); + } + + for (uint8_t ch = 0; ch < APP_PWM_CHANNELS_PER_INSTANCE; ++ch) + { + for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL; ++i) + { + if (p_cb->channels_cb[ch].ppi_channels[i] != (nrf_ppi_channel_t)UNALLOCATED) + { + nrf_drv_ppi_channel_free(p_cb->channels_cb[ch].ppi_channels[i]); + p_cb->channels_cb[ch].ppi_channels[i] = (nrf_ppi_channel_t)UNALLOCATED; + } + } + if (p_cb->channels_cb[ch].gpio_pin != UNALLOCATED) + { + nrf_drv_gpiote_out_uninit(p_cb->channels_cb[ch].gpio_pin); + p_cb->channels_cb[ch].gpio_pin = UNALLOCATED; + } + p_cb->channels_cb[ch].initialized = APP_PWM_CHANNEL_UNINITIALIZED; + } + nrf_drv_timer_uninit(p_instance->p_timer); + return; +} + + +/** + * @brief PWM state transition from (0%, 100%) to 0% or 100%. + * + * @param[in] p_instance PWM instance. + * @param[in] channel PWM channel number. + * @param[in] ticks Number of clock ticks. + */ +static void pwm_transition_n_to_0or100(app_pwm_t const * const p_instance, + uint8_t channel, uint16_t ticks) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + nrf_ppi_channel_group_t p_ppigrp = p_cb->ppi_group; + + pwm_ppi_disable(p_instance); + nrf_drv_ppi_group_clear(p_ppigrp); + nrf_drv_ppi_channels_include_in_group( + nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[0]) | + nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[1]), + p_ppigrp); + + if (!ticks) + { + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), + nrf_drv_ppi_task_addr_group_disable_get(p_ppigrp)); + nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 0, false); + m_pwm_target_value[p_instance->p_timer->instance_id] = + nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) channel); + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), + nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL)); + } + else + { + ticks = p_cb->period; + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL), + nrf_drv_ppi_task_addr_group_disable_get(p_ppigrp)); + // Set secondary CC channel to non-zero value: + nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 1, false); + m_pwm_target_value[p_instance->p_timer->instance_id] = 0; + // The captured value will be equal to 0, because timer clear on main PWM CC channel compare is enabled. + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL), + nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL)); + } + + nrf_drv_ppi_channel_enable(p_cb->ppi_channels[0]); + nrf_drv_ppi_channel_enable(p_cb->ppi_channels[1]); + + p_ch_cb->pulsewidth = ticks; + m_pwm_busy[p_instance->p_timer->instance_id] = PWM_SECONDARY_CC_CHANNEL; +} + + +/** + * @brief PWM state transition from (0%, 100%) to (0%, 100%). + * + * @param[in] p_instance PWM instance. + * @param[in] channel PWM channel number. + * @param[in] ticks Number of clock ticks. + */ +static void pwm_transition_n_to_m(app_pwm_t const * const p_instance, + uint8_t channel, uint16_t ticks) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + nrf_ppi_channel_group_t p_ppigrp = p_cb->ppi_group; + + pwm_ppi_disable(p_instance); + nrf_drv_ppi_group_clear(p_ppigrp); + nrf_drv_ppi_channels_include_in_group( + nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[0]) | + nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[1]), + p_ppigrp); + + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL), + nrf_drv_timer_capture_task_address_get(p_instance->p_timer, channel)); + +#ifdef NRF52 + if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == + (m_use_ppi_delay_workaround ? NRF_TIMER_FREQ_8MHz : NRF_TIMER_FREQ_16MHz) ) ? 1U : 0U) + < p_ch_cb->pulsewidth) +#else + if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == NRF_TIMER_FREQ_16MHz) ? 1U : 0U) + < p_ch_cb->pulsewidth) +#endif + { + // For lower value, we need one more transition. Timer task delay is included. + // If prescaler is disabled, one tick must be added because of 1 PCLK16M clock cycle delay. + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL), + nrf_drv_gpiote_out_task_addr_get(p_ch_cb->gpio_pin)); + } + else + { + nrf_drv_ppi_channel_remove_from_group(p_cb->ppi_channels[1], p_ppigrp); + } + p_ch_cb->pulsewidth = ticks; + nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, ticks, false); + nrf_drv_ppi_group_enable(p_ppigrp); + + m_pwm_target_value[p_instance->p_timer->instance_id] = ticks; + m_pwm_busy[p_instance->p_timer->instance_id] = channel; +} + + +/** + * @brief PWM state transition from 0% or 100% to (0%, 100%). + * + * @param[in] p_instance PWM instance. + * @param[in] channel PWM channel number. + * @param[in] ticks Number of clock ticks. + */ +static void pwm_transition_0or100_to_n(app_pwm_t const * const p_instance, + uint8_t channel, uint16_t ticks) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + nrf_ppi_channel_group_t p_ppigrp = p_cb->ppi_group; + nrf_timer_cc_channel_t pwm_ch_cc = (nrf_timer_cc_channel_t)(channel); + + pwm_ppi_disable(p_instance); + pwm_channel_ppi_disable(p_instance, channel); + + nrf_drv_timer_compare(p_instance->p_timer, pwm_ch_cc, ticks, false); + nrf_drv_ppi_group_clear(p_ppigrp); + nrf_drv_ppi_channels_include_in_group( + nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[0])| + nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[1]), + p_ppigrp); + + if (!p_ch_cb->pulsewidth) + { + // Channel is at 0%. + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), + nrf_drv_ppi_task_addr_group_enable_get(p_ppigrp)); + nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 0, false); + m_pwm_target_value[p_instance->p_timer->instance_id] = + nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) channel); + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), + nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL)); + + } + else + { + // Channel is at 100%. + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL), + nrf_drv_ppi_task_addr_group_enable_get(p_ppigrp)); + // Set secondary CC channel to non-zero value: + nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 1, false); + m_pwm_target_value[p_instance->p_timer->instance_id] = 0; + // The captured value will be equal to 0, because timer clear on main PWM CC channel compare is enabled. + nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL), + nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL)); + } + nrf_drv_ppi_channel_enable(p_cb->ppi_channels[0]); + nrf_drv_ppi_channel_enable(p_cb->ppi_channels[1]); + + p_ch_cb->pulsewidth = ticks; + m_pwm_busy[p_instance->p_timer->instance_id] = PWM_SECONDARY_CC_CHANNEL; +} + + +/** + * @brief PWM state transition from 0% or 100% to 0% or 100%. + * + * @param[in] p_instance PWM instance. + * @param[in] channel PWM channel number. + * @param[in] ticks Number of clock ticks. + */ +static void pwm_transition_0or100_to_0or100(app_pwm_t const * const p_instance, + uint8_t channel, uint16_t ticks) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + nrf_timer_cc_channel_t pwm_ch_cc = (nrf_timer_cc_channel_t)(channel); + + pwm_ppi_disable(p_instance); + pwm_channel_ppi_disable(p_instance, channel); + if (!ticks) + { + // Set to 0%. + nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_INACTIVE(p_instance, channel)); + } + else if (ticks >= p_cb->period) + { + // Set to 100%. + ticks = p_cb->period; + nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_ACTIVE(p_instance, channel)); + } + nrf_drv_timer_compare(p_instance->p_timer, pwm_ch_cc, ticks, false); + p_ch_cb->pulsewidth = ticks; + + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; + return; +} + + +ret_code_t app_pwm_channel_duty_ticks_set(app_pwm_t const * const p_instance, + uint8_t channel, + uint16_t ticks) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + + ASSERT(channel < APP_PWM_CHANNELS_PER_INSTANCE); + ASSERT(p_ch_cb->initialized == APP_PWM_CHANNEL_INITIALIZED); + + if (p_cb->state != NRF_DRV_STATE_POWERED_ON) + { + return NRF_ERROR_INVALID_STATE; + } + if (ticks == p_ch_cb->pulsewidth) + { + if (p_cb->p_ready_callback) + { + p_cb->p_ready_callback(p_instance->p_timer->instance_id); + } + return NRF_SUCCESS; // No action required. + } + if (app_pwm_busy_check(p_instance)) + { + return NRF_ERROR_BUSY; // PPI channels for synchronization are still in use. + } + + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_CHANGING; + + // Pulse width change sequence: + if (!p_ch_cb->pulsewidth || p_ch_cb->pulsewidth >= p_cb->period) + { + // Channel is disabled (0%) or at 100%. + if (!ticks || ticks >= p_cb->period) + { + // Set to 0 or 100%. + pwm_transition_0or100_to_0or100(p_instance, channel, ticks); + } + else + { + // Other value. + pwm_transition_0or100_to_n(p_instance, channel, ticks); + } + } + else + { + // Channel is at other value. + if (!ticks || ticks >= p_cb->period) + { + // Disable channel (set to 0%) or set to 100%. + pwm_transition_n_to_0or100(p_instance, channel, ticks); + } + else + { + // Set to any other value. + pwm_transition_n_to_m(p_instance, channel, ticks); + } + } + if (p_instance->p_cb->p_ready_callback) + { + //PWM ready interrupt handler will be called after one full period. + m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 2; + pwm_irq_enable(p_instance); + } + return NRF_SUCCESS; +} + +uint16_t app_pwm_channel_duty_ticks_get(app_pwm_t const * const p_instance, uint8_t channel) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + + return p_ch_cb->pulsewidth; +} + +uint16_t app_pwm_cycle_ticks_get(app_pwm_t const * const p_instance) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + + return (uint16_t)p_cb->period; +} + +ret_code_t app_pwm_channel_duty_set(app_pwm_t const * const p_instance, + uint8_t channel, app_pwm_duty_t duty) +{ + uint32_t ticks = ((uint32_t)app_pwm_cycle_ticks_get(p_instance) * (uint32_t)duty) / 100UL; + return app_pwm_channel_duty_ticks_set(p_instance, channel, ticks); +} + + +app_pwm_duty_t app_pwm_channel_duty_get(app_pwm_t const * const p_instance, uint8_t channel) +{ + uint32_t value = ((uint32_t)app_pwm_channel_duty_ticks_get(p_instance, channel) * 100UL) \ + / (uint32_t)app_pwm_cycle_ticks_get(p_instance); + + return (app_pwm_duty_t)value; +} + + +/** + * @brief Function for initializing the PWM channel. + * + * @param[in] p_instance PWM instance. + * @param[in] channel Channel number. + * @param[in] pin GPIO pin number. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_NO_MEM If there were not enough free resources. + * @retval NRF_ERROR_INVALID_STATE If the timer is already in use or initialization failed. + */ +static ret_code_t app_pwm_channel_init(app_pwm_t const * const p_instance, uint8_t channel, + uint32_t pin, app_pwm_polarity_t polarity) +{ + ASSERT(channel < APP_PWM_CHANNELS_PER_INSTANCE); + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_channel_cb = &p_cb->channels_cb[channel]; + + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + p_channel_cb->pulsewidth = 0; + p_channel_cb->polarity = polarity; + ret_code_t err_code; + + /* GPIOTE setup: */ + nrf_drv_gpiote_out_config_t out_cfg = GPIOTE_CONFIG_OUT_TASK_TOGGLE( POLARITY_INACTIVE(p_instance, channel) ); + err_code = nrf_drv_gpiote_out_init((nrf_drv_gpiote_pin_t)pin,&out_cfg); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_NO_MEM; + } + p_cb->channels_cb[channel].gpio_pin = pin; + + // Set output to inactive state. + if (polarity) + { + nrf_gpio_pin_clear(pin); + } + else + { + nrf_gpio_pin_set(pin); + } + + /* PPI setup: */ + for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL; ++i) + { + if (nrf_drv_ppi_channel_alloc(&p_channel_cb->ppi_channels[i]) != NRF_SUCCESS) + { + return NRF_ERROR_NO_MEM; // Resource de-allocation is done by callee. + } + } + + nrf_drv_ppi_channel_disable(p_channel_cb->ppi_channels[0]); + nrf_drv_ppi_channel_disable(p_channel_cb->ppi_channels[1]); + nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[0], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), + nrf_drv_gpiote_out_task_addr_get(p_channel_cb->gpio_pin)); + nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[1], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL), + nrf_drv_gpiote_out_task_addr_get(p_channel_cb->gpio_pin)); + + p_channel_cb->initialized = APP_PWM_CHANNEL_INITIALIZED; + m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 0; + + return NRF_SUCCESS; +} + + +/** + * @brief Function for calculating target timer frequency, which will allow to set given period length. + * + * @param[in] period_us Desired period in microseconds. + * + * @retval Timer frequency. + */ +__STATIC_INLINE nrf_timer_frequency_t pwm_calculate_timer_frequency(uint32_t period_us) +{ + uint32_t f = (uint32_t) NRF_TIMER_FREQ_16MHz; + uint32_t min = (uint32_t) NRF_TIMER_FREQ_31250Hz; + + while ((period_us > TIMER_MAX_PULSEWIDTH_US_ON_16M) && (f < min)) + { + period_us >>= 1; + ++f; + } + +#ifdef NRF52 + if ((m_use_ppi_delay_workaround) && (f == (uint32_t) NRF_TIMER_FREQ_16MHz)) + { + f = (uint32_t) NRF_TIMER_FREQ_8MHz; + } +#endif + + return (nrf_timer_frequency_t) f; +} + + +ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t const * const p_config, + app_pwm_callback_t p_ready_callback) +{ + ASSERT(p_instance); + + if (!p_config) + { + return NRF_ERROR_INVALID_DATA; + } + + app_pwm_cb_t * p_cb = p_instance->p_cb; + + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + uint32_t err_code = nrf_drv_ppi_init(); + if ((err_code != NRF_SUCCESS) && (err_code != MODULE_ALREADY_INITIALIZED)) + { + return NRF_ERROR_NO_MEM; + } + + + if (!nrf_drv_gpiote_is_init()) + { + err_code = nrf_drv_gpiote_init(); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + } + +#ifdef NRF52 + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + m_use_ppi_delay_workaround = false; + } + else + { + m_use_ppi_delay_workaround = true; + } +#endif + + // Innitialize resource status: + p_cb->ppi_channels[0] = (nrf_ppi_channel_t)UNALLOCATED; + p_cb->ppi_channels[1] = (nrf_ppi_channel_t)UNALLOCATED; + p_cb->ppi_group = (nrf_ppi_channel_group_t)UNALLOCATED; + + for (uint8_t i = 0; i < APP_PWM_CHANNELS_PER_INSTANCE; ++i) + { + p_cb->channels_cb[i].initialized = APP_PWM_CHANNEL_UNINITIALIZED; + p_cb->channels_cb[i].ppi_channels[0] = (nrf_ppi_channel_t)UNALLOCATED; + p_cb->channels_cb[i].ppi_channels[1] = (nrf_ppi_channel_t)UNALLOCATED; + p_cb->channels_cb[i].gpio_pin = UNALLOCATED; + } + + // Allocate PPI channels and groups: + for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++i) + { + if (nrf_drv_ppi_channel_alloc(&p_cb->ppi_channels[i]) != NRF_SUCCESS) + { + pwm_dealloc(p_instance); + return NRF_ERROR_NO_MEM; + } + } + if (nrf_drv_ppi_group_alloc(&p_cb->ppi_group) != NRF_SUCCESS) + { + pwm_dealloc(p_instance); + return NRF_ERROR_NO_MEM; + } + + // Initialize channels: + for (uint8_t i = 0; i < APP_PWM_CHANNELS_PER_INSTANCE; ++i) + { + if (p_config->pins[i] != APP_PWM_NOPIN) + { + err_code = app_pwm_channel_init(p_instance, i, p_config->pins[i], p_config->pin_polarity[i]); + if (err_code != NRF_SUCCESS) + { + pwm_dealloc(p_instance); + return err_code; + } + app_pwm_channel_duty_ticks_set(p_instance, i, 0); + } + } + + // Initialize timer: + nrf_timer_frequency_t timer_freq = pwm_calculate_timer_frequency(p_config->period_us); + nrf_drv_timer_config_t timer_cfg = { + .frequency = timer_freq, + .mode = NRF_TIMER_MODE_TIMER, + .bit_width = NRF_TIMER_BIT_WIDTH_16, +#ifdef NRF51 + .interrupt_priority = APP_IRQ_PRIORITY_LOW, +#elif defined(NRF52) + .interrupt_priority = APP_IRQ_PRIORITY_LOWEST, +#endif + .p_context = (void *) (uint32_t) p_instance->p_timer->instance_id + }; + err_code = nrf_drv_timer_init(p_instance->p_timer, &timer_cfg, + pwm_ready_tick); + if (err_code != NRF_SUCCESS) + { + pwm_dealloc(p_instance); + return err_code; + } + + uint32_t ticks = nrf_drv_timer_us_to_ticks(p_instance->p_timer, p_config->period_us); + p_cb->period = ticks; + nrf_drv_timer_clear(p_instance->p_timer); + nrf_drv_timer_extended_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_MAIN_CC_CHANNEL, + ticks, NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK, true); + nrf_drv_timer_compare_int_disable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL); + + p_cb->p_ready_callback = p_ready_callback; + m_instances[p_instance->p_timer->instance_id] = p_instance; + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; + p_cb->state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + + +void app_pwm_enable(app_pwm_t const * const p_instance) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + for (uint32_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel) + { + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 0; + if (p_ch_cb->initialized) + { + nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_INACTIVE(p_instance, channel)); + nrf_drv_gpiote_out_task_enable(p_ch_cb->gpio_pin); + p_ch_cb->pulsewidth = 0; + } + } + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; + pan73_workaround(p_instance->p_timer->p_reg, true); + nrf_drv_timer_clear(p_instance->p_timer); + nrf_drv_timer_enable(p_instance->p_timer); + + p_cb->state = NRF_DRV_STATE_POWERED_ON; + return; +} + + +void app_pwm_disable(app_pwm_t const * const p_instance) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_drv_timer_disable(p_instance->p_timer); + pwm_irq_disable(p_instance); + for (uint8_t ppi_channel = 0; ppi_channel < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++ppi_channel) + { + nrf_drv_ppi_channel_disable(p_cb->ppi_channels[ppi_channel]); + } + for (uint8_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel) + { + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + if (p_ch_cb->initialized) + { + uint8_t polarity = POLARITY_INACTIVE(p_instance, channel); + if (polarity) + { + nrf_gpio_pin_set(p_ch_cb->gpio_pin); + } + else + { + nrf_gpio_pin_clear(p_ch_cb->gpio_pin); + } + nrf_drv_gpiote_out_task_disable(p_ch_cb->gpio_pin); + nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[0]); + nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[1]); + } + } + pan73_workaround(p_instance->p_timer->p_reg, false); + + p_cb->state = NRF_DRV_STATE_INITIALIZED; + return; +} + + +ret_code_t app_pwm_uninit(app_pwm_t const * const p_instance) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + + if (p_cb->state == NRF_DRV_STATE_POWERED_ON) + { + app_pwm_disable(p_instance); + } + else if (p_cb->state == NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + pwm_dealloc(p_instance); + + p_cb->state = NRF_DRV_STATE_UNINITIALIZED; + return NRF_SUCCESS; +} + + +//lint -restore diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.h new file mode 100644 index 0000000000..de9c8e0fad --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.h @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup app_pwm Pulse-width modulation (PWM) + * @{ + * @ingroup app_common + * + * @brief Module for generating a pulse-width modulated output signal. + * + * @details This module provides a PWM implementation using timers, GPIOTE, and PPI. + * + * Resource usage: + * - 2 PPI channels per instance + 2 PPI channels per PWM channel. + * - 1 PPI group per instance. + * - 1 GPIOTE channel per PWM channel. + * + * For example, a PWM instance with two channels will consume 2+4 PPI channels, 1 PPI group, and 2 GPIOTE channels. + * + * The maximum number of PWM channels per instance is 2. + */ + +#ifndef APP_PWM_H__ +#define APP_PWM_H__ + +#include +#include "sdk_errors.h" +#include "nrf_drv_timer.h" +#include "nrf_drv_common.h" +#include "nrf_drv_ppi.h" + + +#define APP_PWM_NOPIN 0xFFFFFFFF + +/** @brief Number of channels for one timer instance (fixed to 2 due to timer properties).*/ +#define APP_PWM_CHANNELS_PER_INSTANCE 2 + +/**@brief Macro for creating a PWM instance. */ +#define APP_PWM_INSTANCE(name, num) \ + const nrf_drv_timer_t m_pwm_##name##_timer = NRF_DRV_TIMER_INSTANCE(num); \ + app_pwm_cb_t m_pwm_##name##_cb; \ + /*lint -e{545}*/ \ + const app_pwm_t name = { \ + .p_cb = &m_pwm_##name##_cb, \ + .p_timer = &m_pwm_##name##_timer, \ + } + + +/**@brief PWM instance default configuration (1 channel). */ +#define APP_PWM_DEFAULT_CONFIG_1CH(period_in_us, pin) \ + { \ + .pins = {pin, APP_PWM_NOPIN}, \ + .pin_polarity = {APP_PWM_POLARITY_ACTIVE_LOW, APP_PWM_POLARITY_ACTIVE_LOW}, \ + .num_of_channels = 1, \ + .period_us = period_in_us \ + } + +/**@brief PWM instance default configuration (2 channels). */ +#define APP_PWM_DEFAULT_CONFIG_2CH(period_in_us, pin0, pin1) \ + { \ + .pins = {pin0, pin1}, \ + .pin_polarity = {APP_PWM_POLARITY_ACTIVE_LOW, APP_PWM_POLARITY_ACTIVE_LOW}, \ + .num_of_channels = 2, \ + .period_us = period_in_us \ + } + +typedef uint16_t app_pwm_duty_t; + +/** + * @brief PWM callback that is executed when a PWM duty change has been completed. + * + * @param[in] pwm_id PWM instance ID. + */ +typedef void (* app_pwm_callback_t)(uint32_t); + +/** + * @brief Channel polarity. + */ +typedef enum +{ + APP_PWM_POLARITY_ACTIVE_LOW = 0, + APP_PWM_POLARITY_ACTIVE_HIGH = 1 +} app_pwm_polarity_t; + +/**@brief PWM configuration structure used for initialization. */ +typedef struct +{ + uint32_t pins[APP_PWM_CHANNELS_PER_INSTANCE]; //!< Pins configured as PWM output. + app_pwm_polarity_t pin_polarity[APP_PWM_CHANNELS_PER_INSTANCE]; //!< Polarity of active state on pin. + uint32_t num_of_channels; //!< Number of channels that can be used. + uint32_t period_us; //!< PWM signal output period to configure (in microseconds). +} app_pwm_config_t; + + +/** + * @cond (NODOX) + * @defgroup app_pwm_internal Auxiliary internal types declarations + * @{ + * @internal + * + * @brief Module for internal usage inside the library only + * + * There are some definitions that must be included in the header file because + * of the way the library is set up. In this way, the are accessible to the user. + * However, any functions and variables defined here may change at any time + * without a warning, so you should not access them directly. + */ + + /** + * @brief PWM channel instance + * + * This structure holds all data needed by a single PWM channel. + */ + typedef struct + { + uint32_t gpio_pin; //!< Pin that is used by this PWM channel. + uint32_t pulsewidth; //!< The copy of duty currently set (in ticks). + nrf_ppi_channel_t ppi_channels[2]; //!< PPI channels used by the PWM channel to clear and set the output. + app_pwm_polarity_t polarity; //!< The active state of the pin. + uint8_t initialized; //!< The internal information if the selected channel was initialized. + } app_pwm_channel_cb_t; + + /** + * @brief Variable part of PWM instance + * + * This structure holds instance data that may change. + */ + typedef struct + { + app_pwm_channel_cb_t channels_cb[APP_PWM_CHANNELS_PER_INSTANCE]; //!< Channels data + uint32_t period; //!< Selected period in ticks + app_pwm_callback_t p_ready_callback; //!< Callback function called on PWM readiness + nrf_ppi_channel_t ppi_channels[2]; //!< PPI channels used temporary while changing duty + nrf_ppi_channel_group_t ppi_group; //!< PPI group used to synchronize changes on channels + nrf_drv_state_t state; //!< Current driver status + } app_pwm_cb_t; +/** @} + * @endcond + */ + + +/**@brief PWM instance structure. */ +typedef struct +{ + app_pwm_cb_t *p_cb; //!< Pointer to control block internals. + nrf_drv_timer_t const * const p_timer; //!< Timer used by this PWM instance. +} app_pwm_t; + +/** + * @brief Function for checking if the PWM instance is busy updating the duty cycle. + * + * @param[in] p_instance PWM instance. + * + * @retval True If the PWM instance is ready for duty cycle changes. + * @retval False If a change operation is in progress. + */ +bool app_pwm_busy_check(app_pwm_t const * const p_instance); + +/** + * @brief Function for initializing a PWM instance. + * + * @param[in] p_instance PWM instance. + * @param[in] p_config Initial configuration. + * @param[in] p_ready_callback Pointer to ready callback function (or NULL to disable). + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_NO_MEM If there were not enough free resources. + * @retval NRF_ERROR_INVALID_PARAM If an invalid configuration structure was passed. + * @retval NRF_ERROR_INVALID_STATE If the timer/PWM is already in use or if initialization failed. + */ +ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t const * const p_config, + app_pwm_callback_t p_ready_callback); + + +/** + * @brief Function for uninitializing a PWM instance and releasing the allocated resources. + * + * @param[in] p_instance PWM instance. + * + * @retval NRF_SUCCESS If uninitialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the given instance was not initialized. + */ +ret_code_t app_pwm_uninit(app_pwm_t const * const p_instance); + +/** + * @brief Function for enabling a PWM instance after initialization. + * + * @param[in] p_instance PWM instance. + */ +void app_pwm_enable(app_pwm_t const * const p_instance); + +/** + * @brief Function for disabling a PWM instance after initialization. + * + * @param[in] p_instance PWM instance. + */ +void app_pwm_disable(app_pwm_t const * const p_instance); + +/** + * @brief Function for setting the PWM channel duty cycle in percents. + * + * A duty cycle change requires one full PWM clock period to finish. + * If another change is attempted for any channel of given instance before + * the current change is complete, the new attempt will result in the error + * NRF_ERROR_BUSY. + * + * @param[in] p_instance PWM instance. + * @param[in] channel Channel number. + * @param[in] duty Duty cycle (0 - 100). + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_BUSY If the PWM is not ready yet. + * @retval NRF_ERROR_INVALID_STATE If the given instance was not initialized. + * + */ +ret_code_t app_pwm_channel_duty_set(app_pwm_t const * const p_instance, + uint8_t channel, app_pwm_duty_t duty); + +/** + * @brief Function for retrieving the PWM channel duty cycle in percents. + * + * @param[in] p_instance PWM instance. + * @param[in] channel Channel number. + * + * @return Duty cycle value. + */ +app_pwm_duty_t app_pwm_channel_duty_get(app_pwm_t const * const p_instance, uint8_t channel); + + +/** + * @name Functions accessing values in ticks + * + * Auxiliary functions that allow to get values in actual timer ticks. + * @{ + */ + + /** + * @brief Function for setting PWM channel duty cycle in clock ticks. + * + * @note Duty cycle changes require one full PWM clock period to finish. + * Until that, the next change attempt (for any channel of given instance) + * will result in an NRF_ERROR_BUSY error. + * + * @param[in] p_instance PWM instance. + * @param[in] channel Channel number. + * @param[in] ticks Number of PWM clock ticks. + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_BUSY If PWM is not ready yet. + * @retval NRF_ERROR_INVALID_STATE If the given instance was not initialized. + */ + ret_code_t app_pwm_channel_duty_ticks_set(app_pwm_t const * const p_instance, + uint8_t channel, + uint16_t ticks); + + + /** + * @brief Function for retrieving the PWM channel duty cycle in ticks. + * + * This function retrieves the real, currently set duty cycle in ticks. + * For one full PWM cycle the value might be different than the value set by the last + * @ref app_pwm_channel_duty_ticks_set function call. + * + * @param[in] p_instance PWM instance. + * @param[in] channel Channel number. + * + * @return Number of ticks set for selected channel. + * + */ + uint16_t app_pwm_channel_duty_ticks_get(app_pwm_t const * const p_instance, uint8_t channel); + + /** + * @brief Function for returning the number of ticks in a whole cycle. + * + * @param[in] p_instance PWM instance. + * + * @return Number of ticks that corresponds to 100% of the duty cycle. + */ + uint16_t app_pwm_cycle_ticks_get(app_pwm_t const * const p_instance); +/** @} */ + + +#endif + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.c new file mode 100644 index 0000000000..d927ead696 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.c @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "app_scheduler.h" +#include +#include +#include +#include "nrf_soc.h" +#include "nrf_assert.h" +#include "app_util.h" +#include "app_util_platform.h" + +/**@brief Structure for holding a scheduled event header. */ +typedef struct +{ + app_sched_event_handler_t handler; /**< Pointer to event handler to receive the event. */ + uint16_t event_data_size; /**< Size of event data. */ +} event_header_t; + +STATIC_ASSERT(sizeof(event_header_t) <= APP_SCHED_EVENT_HEADER_SIZE); + +static event_header_t * m_queue_event_headers; /**< Array for holding the queue event headers. */ +static uint8_t * m_queue_event_data; /**< Array for holding the queue event data. */ +static volatile uint8_t m_queue_start_index; /**< Index of queue entry at the start of the queue. */ +static volatile uint8_t m_queue_end_index; /**< Index of queue entry at the end of the queue. */ +static uint16_t m_queue_event_size; /**< Maximum event size in queue. */ +static uint16_t m_queue_size; /**< Number of queue entries. */ + +#ifdef APP_SCHEDULER_WITH_PROFILER +static uint16_t m_max_queue_utilization; /**< Maximum observed queue utilization. */ +#endif + +/**@brief Function for incrementing a queue index, and handle wrap-around. + * + * @param[in] index Old index. + * + * @return New (incremented) index. + */ +static __INLINE uint8_t next_index(uint8_t index) +{ + return (index < m_queue_size) ? (index + 1) : 0; +} + + +static __INLINE uint8_t app_sched_queue_full() +{ + uint8_t tmp = m_queue_start_index; + return next_index(m_queue_end_index) == tmp; +} + +/**@brief Macro for checking if a queue is full. */ +#define APP_SCHED_QUEUE_FULL() app_sched_queue_full() + + +static __INLINE uint8_t app_sched_queue_empty() +{ + uint8_t tmp = m_queue_start_index; + return m_queue_end_index == tmp; +} + +/**@brief Macro for checking if a queue is empty. */ +#define APP_SCHED_QUEUE_EMPTY() app_sched_queue_empty() + + +uint32_t app_sched_init(uint16_t event_size, uint16_t queue_size, void * p_event_buffer) +{ + uint16_t data_start_index = (queue_size + 1) * sizeof(event_header_t); + + // Check that buffer is correctly aligned + if (!is_word_aligned(p_event_buffer)) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Initialize event scheduler + m_queue_event_headers = p_event_buffer; + m_queue_event_data = &((uint8_t *)p_event_buffer)[data_start_index]; + m_queue_end_index = 0; + m_queue_start_index = 0; + m_queue_event_size = event_size; + m_queue_size = queue_size; + +#ifdef APP_SCHEDULER_WITH_PROFILER + m_max_queue_utilization = 0; +#endif + + return NRF_SUCCESS; +} + + +#ifdef APP_SCHEDULER_WITH_PROFILER +static void queue_utilization_check(void) +{ + uint16_t start = m_queue_start_index; + uint16_t end = m_queue_end_index; + uint16_t queue_utilization = (end >= start) ? (end - start) : + (m_queue_size + 1 - start + end); + + if (queue_utilization > m_max_queue_utilization) + { + m_max_queue_utilization = queue_utilization; + } +} + +uint16_t app_sched_queue_utilization_get(void) +{ + return m_max_queue_utilization; +} +#endif + + +uint32_t app_sched_event_put(void * p_event_data, + uint16_t event_data_size, + app_sched_event_handler_t handler) +{ + uint32_t err_code; + + if (event_data_size <= m_queue_event_size) + { + uint16_t event_index = 0xFFFF; + + CRITICAL_REGION_ENTER(); + + if (!APP_SCHED_QUEUE_FULL()) + { + event_index = m_queue_end_index; + m_queue_end_index = next_index(m_queue_end_index); + + #ifdef APP_SCHEDULER_WITH_PROFILER + // This function call must be protected with critical region because + // it modifies 'm_max_queue_utilization'. + queue_utilization_check(); + #endif + } + + CRITICAL_REGION_EXIT(); + + if (event_index != 0xFFFF) + { + // NOTE: This can be done outside the critical region since the event consumer will + // always be called from the main loop, and will thus never interrupt this code. + m_queue_event_headers[event_index].handler = handler; + if ((p_event_data != NULL) && (event_data_size > 0)) + { + memcpy(&m_queue_event_data[event_index * m_queue_event_size], + p_event_data, + event_data_size); + m_queue_event_headers[event_index].event_data_size = event_data_size; + } + else + { + m_queue_event_headers[event_index].event_data_size = 0; + } + + err_code = NRF_SUCCESS; + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + } + else + { + err_code = NRF_ERROR_INVALID_LENGTH; + } + + return err_code; +} + + +/**@brief Function for reading the next event from specified event queue. + * + * @param[out] pp_event_data Pointer to pointer to event data. + * @param[out] p_event_data_size Pointer to size of event data. + * @param[out] p_event_handler Pointer to event handler function pointer. + * + * @return NRF_SUCCESS if new event, NRF_ERROR_NOT_FOUND if event queue is empty. + */ +static uint32_t app_sched_event_get(void ** pp_event_data, + uint16_t * p_event_data_size, + app_sched_event_handler_t * p_event_handler) +{ + uint32_t err_code = NRF_ERROR_NOT_FOUND; + + if (!APP_SCHED_QUEUE_EMPTY()) + { + uint16_t event_index; + + // NOTE: There is no need for a critical region here, as this function will only be called + // from app_sched_execute() from inside the main loop, so it will never interrupt + // app_sched_event_put(). Also, updating of (i.e. writing to) the start index will be + // an atomic operation. + event_index = m_queue_start_index; + m_queue_start_index = next_index(m_queue_start_index); + + *pp_event_data = &m_queue_event_data[event_index * m_queue_event_size]; + *p_event_data_size = m_queue_event_headers[event_index].event_data_size; + *p_event_handler = m_queue_event_headers[event_index].handler; + + err_code = NRF_SUCCESS; + } + + return err_code; +} + + +void app_sched_execute(void) +{ + void * p_event_data; + uint16_t event_data_size; + app_sched_event_handler_t event_handler; + + // Get next event (if any), and execute handler + while ((app_sched_event_get(&p_event_data, &event_data_size, &event_handler) == NRF_SUCCESS)) + { + event_handler(p_event_data, event_data_size); + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.h new file mode 100644 index 0000000000..82c90b9180 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.h @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup app_scheduler Scheduler + * @{ + * @ingroup app_common + * + * @brief The scheduler is used for transferring execution from the interrupt context to the main + * context. + * + * @details See @ref seq_diagrams_sched for sequence diagrams illustrating the flow of events + * when using the Scheduler. + * + * @section app_scheduler_req Requirements: + * + * @subsection main_context_logic Logic in main context: + * + * - Define an event handler for each type of event expected. + * - Initialize the scheduler by calling the APP_SCHED_INIT() macro before entering the + * application main loop. + * - Call app_sched_execute() from the main loop each time the application wakes up because of an + * event (typically when sd_app_evt_wait() returns). + * + * @subsection int_context_logic Logic in interrupt context: + * + * - In the interrupt handler, call app_sched_event_put() + * with the appropriate data and event handler. This will insert an event into the + * scheduler's queue. The app_sched_execute() function will pull this event and call its + * handler in the main context. + * + * @if (PERIPHERAL) + * For an example usage of the scheduler, see the implementations of + * @ref ble_sdk_app_hids_mouse and @ref ble_sdk_app_hids_keyboard. + * @endif + * + * @image html scheduler_working.jpg The high level design of the scheduler + */ + +#ifndef APP_SCHEDULER_H__ +#define APP_SCHEDULER_H__ + +#include +#include "app_error.h" +#include "app_util.h" + +#define APP_SCHED_EVENT_HEADER_SIZE 8 /**< Size of app_scheduler.event_header_t (only for use inside APP_SCHED_BUF_SIZE()). */ + +/**@brief Compute number of bytes required to hold the scheduler buffer. + * + * @param[in] EVENT_SIZE Maximum size of events to be passed through the scheduler. + * @param[in] QUEUE_SIZE Number of entries in scheduler queue (i.e. the maximum number of events + * that can be scheduled for execution). + * + * @return Required scheduler buffer size (in bytes). + */ +#define APP_SCHED_BUF_SIZE(EVENT_SIZE, QUEUE_SIZE) \ + (((EVENT_SIZE) + APP_SCHED_EVENT_HEADER_SIZE) * ((QUEUE_SIZE) + 1)) + +/**@brief Scheduler event handler type. */ +typedef void (*app_sched_event_handler_t)(void * p_event_data, uint16_t event_size); + +/**@brief Macro for initializing the event scheduler. + * + * @details It will also handle dimensioning and allocation of the memory buffer required by the + * scheduler, making sure the buffer is correctly aligned. + * + * @param[in] EVENT_SIZE Maximum size of events to be passed through the scheduler. + * @param[in] QUEUE_SIZE Number of entries in scheduler queue (i.e. the maximum number of events + * that can be scheduled for execution). + * + * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it + * several times as long as it is from the same location, e.g. to do a reinitialization). + */ +#define APP_SCHED_INIT(EVENT_SIZE, QUEUE_SIZE) \ + do \ + { \ + static uint32_t APP_SCHED_BUF[CEIL_DIV(APP_SCHED_BUF_SIZE((EVENT_SIZE), (QUEUE_SIZE)), \ + sizeof(uint32_t))]; \ + uint32_t ERR_CODE = app_sched_init((EVENT_SIZE), (QUEUE_SIZE), APP_SCHED_BUF); \ + APP_ERROR_CHECK(ERR_CODE); \ + } while (0) + +/**@brief Function for initializing the Scheduler. + * + * @details It must be called before entering the main loop. + * + * @param[in] max_event_size Maximum size of events to be passed through the scheduler. + * @param[in] queue_size Number of entries in scheduler queue (i.e. the maximum number of + * events that can be scheduled for execution). + * @param[in] p_evt_buffer Pointer to memory buffer for holding the scheduler queue. It must + * be dimensioned using the APP_SCHED_BUFFER_SIZE() macro. The buffer + * must be aligned to a 4 byte boundary. + * + * @note Normally initialization should be done using the APP_SCHED_INIT() macro, as that will both + * allocate the scheduler buffer, and also align the buffer correctly. + * + * @retval NRF_SUCCESS Successful initialization. + * @retval NRF_ERROR_INVALID_PARAM Invalid parameter (buffer not aligned to a 4 byte + * boundary). + */ +uint32_t app_sched_init(uint16_t max_event_size, uint16_t queue_size, void * p_evt_buffer); + +/**@brief Function for executing all scheduled events. + * + * @details This function must be called from within the main loop. It will execute all events + * scheduled since the last time it was called. + */ +void app_sched_execute(void); + +/**@brief Function for scheduling an event. + * + * @details Puts an event into the event queue. + * + * @param[in] p_event_data Pointer to event data to be scheduled. + * @param[in] event_size Size of event data to be scheduled. + * @param[in] handler Event handler to receive the event. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t app_sched_event_put(void * p_event_data, + uint16_t event_size, + app_sched_event_handler_t handler); + +#ifdef APP_SCHEDULER_WITH_PROFILER +/**@brief Function for getting the maximum observed queue utilization. + * + * Function for tuning the module and determining QUEUE_SIZE value and thus module RAM usage. + * + * @return Maximum number of events in queue observed so far. + */ +uint16_t app_sched_queue_utilization_get(void); +#endif + +#ifdef APP_SCHEDULER_WITH_PAUSE +/**@brief A function to pause the scheduler. + * + * @details When the scheduler is paused events are not pulled from the scheduler queue for + * processing. The function can be called multiple times. To unblock the scheduler the + * function @ref app_sched_resume has to be called the same number of times. + */ +void app_sched_pause(void); + +/**@brief A function to resume a scheduler. + * + * @details To unblock the scheduler this function has to be called the same number of times as + * @ref app_sched_pause function. + */ +void app_sched_resume(void); +#endif +#endif // APP_SCHEDULER_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.c new file mode 100644 index 0000000000..d4804f5348 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include +#include + + +#ifdef ENABLE_DEBUG_LOG_SUPPORT +#include "app_trace.h" +#include "nrf_log.h" + +void app_trace_init(void) +{ + (void)NRF_LOG_INIT(); +} + +void app_trace_dump(uint8_t * p_buffer, uint32_t len) +{ + app_trace_log("\r\n"); + for (uint32_t index = 0; index < len; index++) + { + app_trace_log("0x%02X ", p_buffer[index]); + } + app_trace_log("\r\n"); +} + +#endif // ENABLE_DEBUG_LOG_SUPPORT + +/** + *@} + **/ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.h new file mode 100644 index 0000000000..bdf439ab36 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.h @@ -0,0 +1,56 @@ +#ifndef __DEBUG_H_ +#define __DEBUG_H_ + +#include +#include + +/** + * @defgroup app_trace Debug Logger + * @ingroup app_common + * @{ + * @brief Enables debug logs/ trace over UART. + * @details Enables debug logs/ trace over UART. Tracing is enabled only if + * ENABLE_DEBUG_LOG_SUPPORT is defined in the project. + */ +#ifdef ENABLE_DEBUG_LOG_SUPPORT +#include "nrf_log.h" +/** + * @brief Module Initialization. + * + * @details Initializes the module to use UART as trace output. + * + * @warning This function will configure UART using default board configuration. + * Do not call this function if UART is configured from a higher level in the application. + */ +void app_trace_init(void); + +/** + * @brief Log debug messages. + * + * @details This API logs messages over UART. The module must be initialized before using this API. + * + * @note Though this is currently a macro, it should be used used and treated as function. + */ +#define app_trace_log NRF_LOG_PRINTF + +/** + * @brief Dump auxiliary byte buffer to the debug trace. + * + * @details This API logs messages over UART. The module must be initialized before using this API. + * + * @param[in] p_buffer Buffer to be dumped on the debug trace. + * @param[in] len Size of the buffer. + */ +void app_trace_dump(uint8_t * p_buffer, uint32_t len); + +#else // ENABLE_DEBUG_LOG_SUPPORT + +#define app_trace_init(...) +#define app_trace_log(...) +#define app_trace_dump(...) + +#endif // ENABLE_DEBUG_LOG_SUPPORT + +/** @} */ + +#endif //__DEBUG_H_ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c new file mode 100644 index 0000000000..986e711fbd --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup app_error Common application error handler + * @{ + * @ingroup app_common + * + * @brief Common application error handler. + */ + +#include "nrf.h" +#include +#include "app_error.h" +#include "nordic_common.h" +#include "sdk_errors.h" +#include "nrf_log.h" + +#ifdef DEBUG +#include "bsp.h" +#endif + + + +/**@brief Function for error handling, which is called when an error has occurred. + * + * @warning This handler is an example only and does not fit a final product. You need to analyze + * how your product is supposed to react in case of error. + * + * @param[in] error_code Error code supplied to the handler. + * @param[in] line_num Line number where the handler is called. + * @param[in] p_file_name Pointer to the file name. + */ + +/*lint -save -e14 */ +#if 0 +void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name) +{ + error_info_t error_info = + { + .line_num = line_num, + .p_file_name = p_file_name, + .err_code = error_code, + }; + app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info)); + + UNUSED_VARIABLE(error_info); +} +#endif + +/*lint -save -e14 */ +void app_error_handler_bare(ret_code_t error_code) +{ + error_info_t error_info = + { + .line_num = 0, + .p_file_name = NULL, + .err_code = error_code, + }; + app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info)); + + UNUSED_VARIABLE(error_info); +} + + +void app_error_save_and_stop(uint32_t id, uint32_t pc, uint32_t info) +{ + /* static error variables - in order to prevent removal by optimizers */ + static volatile struct + { + uint32_t fault_id; + uint32_t pc; + uint32_t error_info; + assert_info_t * p_assert_info; + error_info_t * p_error_info; + ret_code_t err_code; + uint32_t line_num; + const uint8_t * p_file_name; + } m_error_data = {0}; + + // The following variable helps Keil keep the call stack visible, in addition, it can be set to + // 0 in the debugger to continue executing code after the error check. + volatile bool loop = true; + UNUSED_VARIABLE(loop); + + m_error_data.fault_id = id; + m_error_data.pc = pc; + m_error_data.error_info = info; + + switch (id) + { + case NRF_FAULT_ID_SDK_ASSERT: + m_error_data.p_assert_info = (assert_info_t *)info; + m_error_data.line_num = m_error_data.p_assert_info->line_num; + m_error_data.p_file_name = m_error_data.p_assert_info->p_file_name; + break; + + case NRF_FAULT_ID_SDK_ERROR: + m_error_data.p_error_info = (error_info_t *)info; + m_error_data.err_code = m_error_data.p_error_info->err_code; + m_error_data.line_num = m_error_data.p_error_info->line_num; + m_error_data.p_file_name = m_error_data.p_error_info->p_file_name; + break; + } + + UNUSED_VARIABLE(m_error_data); + + // If printing is disrupted, remove the irq calls, or set the loop variable to 0 in the debugger. + __disable_irq(); + + while(loop); + + __enable_irq(); +} + +/*lint -restore */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.h new file mode 100644 index 0000000000..66cd551d53 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.h @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup app_error Common application error handler + * @{ + * @ingroup app_common + * + * @brief Common application error handler and macros for utilizing a common error handler. + */ + +#ifndef APP_ERROR_H__ +#define APP_ERROR_H__ + +#include +#include +#include +#include "nrf.h" +#include "sdk_errors.h" +#include "nordic_common.h" +#include "nrf_log.h" +#include "app_error_weak.h" + +#define NRF_FAULT_ID_SDK_RANGE_START 0x00004000 /**< The start of the range of error IDs defined in the SDK. */ + +/**@defgroup APP_ERROR_FAULT_IDS Fault ID types + * @{ */ +#define NRF_FAULT_ID_SDK_ERROR NRF_FAULT_ID_SDK_RANGE_START + 1 /**< An error stemming from a call to @ref APP_ERROR_CHECK or @ref APP_ERROR_CHECK_BOOL. The info parameter is a pointer to an @ref error_info_t variable. */ +#define NRF_FAULT_ID_SDK_ASSERT NRF_FAULT_ID_SDK_RANGE_START + 2 /**< An error stemming from a call to ASSERT (nrf_assert.h). The info parameter is a pointer to an @ref assert_info_t variable. */ +/**@} */ + +/**@brief Structure containing info about an error of the type @ref NRF_FAULT_ID_SDK_ERROR. + */ +typedef struct +{ + uint16_t line_num; /**< The line number where the error occurred. */ + uint8_t const * p_file_name; /**< The file in which the error occurred. */ + uint32_t err_code; /**< The error code representing the error that occurred. */ +} error_info_t; + +/**@brief Structure containing info about an error of the type @ref NRF_FAULT_ID_SDK_ASSERT. + */ +typedef struct +{ + uint16_t line_num; /**< The line number where the error occurred. */ + uint8_t const * p_file_name; /**< The file in which the error occurred. */ +} assert_info_t; + +/**@brief Function for error handling, which is called when an error has occurred. + * + * @param[in] error_code Error code supplied to the handler. + * @param[in] line_num Line number where the handler is called. + * @param[in] p_file_name Pointer to the file name. + */ +void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name); + +/**@brief Function for error handling, which is called when an error has occurred. + * + * @param[in] error_code Error code supplied to the handler. + */ +void app_error_handler_bare(ret_code_t error_code); + +/**@brief Function for saving the parameters and entering an eternal loop, for debug purposes. + * + * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. + * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if + * unavailable. + * @param[in] info Optional additional information regarding the fault. Refer to each fault + * identifier for details. + */ +void app_error_save_and_stop(uint32_t id, uint32_t pc, uint32_t info); + +/**@brief Function for printing all error info (using nrf_log). + * + * @details Nrf_log library must be initialized using NRF_LOG_INIT macro before calling + * this function. + * + * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. + * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if + * unavailable. + * @param[in] info Optional additional information regarding the fault. Refer to each fault + * identifier for details. + */ +static __INLINE void app_error_log(uint32_t id, uint32_t pc, uint32_t info) +{ + switch (id) + { + case NRF_FAULT_ID_SDK_ASSERT: + NRF_LOG(NRF_LOG_COLOR_RED "\n*** ASSERTION FAILED ***\n"); + if (((assert_info_t *)(info))->p_file_name) + { + NRF_LOG_PRINTF(NRF_LOG_COLOR_WHITE "Line Number: %u\n", (unsigned int) ((assert_info_t *)(info))->line_num); + NRF_LOG_PRINTF("File Name: %s\n", ((assert_info_t *)(info))->p_file_name); + } + NRF_LOG_PRINTF(NRF_LOG_COLOR_DEFAULT "\n"); + break; + + case NRF_FAULT_ID_SDK_ERROR: + NRF_LOG(NRF_LOG_COLOR_RED "\n*** APPLICATION ERROR *** \n" NRF_LOG_COLOR_WHITE); + if (((error_info_t *)(info))->p_file_name) + { + NRF_LOG_PRINTF("Line Number: %u\n", (unsigned int) ((error_info_t *)(info))->line_num); + NRF_LOG_PRINTF("File Name: %s\n", ((error_info_t *)(info))->p_file_name); + } + NRF_LOG_PRINTF("Error Code: 0x%X\n" NRF_LOG_COLOR_DEFAULT "\n", (unsigned int) ((error_info_t *)(info))->err_code); + break; + } +} + +/**@brief Function for printing all error info (using printf). + * + * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. + * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if + * unavailable. + * @param[in] info Optional additional information regarding the fault. Refer to each fault + * identifier for details. + */ +//lint -save -e438 +static __INLINE void app_error_print(uint32_t id, uint32_t pc, uint32_t info) +{ + unsigned int tmp = id; + printf("app_error_print():\r\n"); + printf("Fault identifier: 0x%X\r\n", tmp); + printf("Program counter: 0x%X\r\n", tmp = pc); + printf("Fault information: 0x%X\r\n", tmp = info); + + switch (id) + { + case NRF_FAULT_ID_SDK_ASSERT: + printf("Line Number: %u\r\n", tmp = ((assert_info_t *)(info))->line_num); + printf("File Name: %s\r\n", ((assert_info_t *)(info))->p_file_name); + break; + + case NRF_FAULT_ID_SDK_ERROR: + printf("Line Number: %u\r\n", tmp = ((error_info_t *)(info))->line_num); + printf("File Name: %s\r\n", ((error_info_t *)(info))->p_file_name); + printf("Error Code: 0x%X\r\n", tmp = ((error_info_t *)(info))->err_code); + break; + } +} +//lint -restore + + +/**@brief Macro for calling error handler function. + * + * @param[in] ERR_CODE Error code supplied to the error handler. + */ +#ifdef DEBUG +#define APP_ERROR_HANDLER(ERR_CODE) \ + do \ + { \ + app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__); \ + } while (0) +#else +#define APP_ERROR_HANDLER(ERR_CODE) \ + do \ + { \ + app_error_handler_bare((ERR_CODE)); \ + } while (0) +#endif +/**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS. + * + * @param[in] ERR_CODE Error code supplied to the error handler. + */ +#define APP_ERROR_CHECK(ERR_CODE) \ + do \ + { \ + const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \ + if (LOCAL_ERR_CODE != NRF_SUCCESS) \ + { \ + APP_ERROR_HANDLER(LOCAL_ERR_CODE); \ + } \ + } while (0) + +/**@brief Macro for calling error handler function if supplied boolean value is false. + * + * @param[in] BOOLEAN_VALUE Boolean value to be evaluated. + */ +#define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \ + do \ + { \ + const uint32_t LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \ + if (!LOCAL_BOOLEAN_VALUE) \ + { \ + APP_ERROR_HANDLER(0); \ + } \ + } while (0) + +#endif // APP_ERROR_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.c new file mode 100644 index 0000000000..65351d9e65 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.c @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "app_error.h" + +#ifdef DEBUG +#include "bsp.h" +#endif + +/*lint -save -e14 */ + +/** + * Function is implemented as weak so that it can be overwritten by custom application error handler + * when needed. + */ +__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info) +{ + // On assert, the system can only recover with a reset. +#ifndef DEBUG + NVIC_SystemReset(); +#else + +#ifdef BSP_DEFINES_ONLY + LEDS_ON(LEDS_MASK); +#else + UNUSED_VARIABLE(bsp_indication_set(BSP_INDICATE_FATAL_ERROR)); + // This call can be used for debug purposes during application development. + // @note CAUTION: Activating this code will write the stack to flash on an error. + // This function should NOT be used in a final product. + // It is intended STRICTLY for development/debugging purposes. + // The flash write will happen EVEN if the radio is active, thus interrupting + // any communication. + // Use with care. Uncomment the line below to use. + //ble_debug_assert_handler(error_code, line_num, p_file_name); +#endif // BSP_DEFINES_ONLY + + app_error_save_and_stop(id, pc, info); + +#endif // DEBUG +} + +/*lint -restore */ + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.h new file mode 100644 index 0000000000..1bc784acde --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef APP_ERROR_WEAK_H__ +#define APP_ERROR_WEAK_H__ + +/** @file + * + * @defgroup app_error Common application error handler + * @{ + * @ingroup app_common + * + * @brief Common application error handler. + */ + +/**@brief Callback function for asserts in the SoftDevice. + * + * @details A pointer to this function will be passed to the SoftDevice. This function will be + * called by the SoftDevice if certain unrecoverable errors occur within the + * application or SoftDevice. + * + * See @ref nrf_fault_handler_t for more details. + * + * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. + * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if + * unavailable. + * @param[in] info Optional additional information regarding the fault. Refer to each fault + * identifier for details. + * + * @remarks Function is implemented as weak so that it can be overwritten by custom application + * error handler when needed. + */ +#ifdef __CC_ARM + void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); +#else +__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); +#endif + + +/** @} */ + +#endif // APP_ERROR_WEAK_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util.h new file mode 100644 index 0000000000..146bff37a6 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util.h @@ -0,0 +1,520 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup app_util Utility Functions and Definitions + * @{ + * @ingroup app_common + * + * @brief Various types and definitions available to all applications. + */ + +#ifndef APP_UTIL_H__ +#define APP_UTIL_H__ + +#include +#include +#include "compiler_abstraction.h" +#include "nrf.h" + +//lint -save -e27 -e10 -e19 +#if defined ( __CC_ARM ) +extern char STACK$$Base; +extern char STACK$$Length; +#define STACK_BASE &STACK$$Base +#define STACK_TOP ((void*)((uint32_t)STACK_BASE + (uint32_t)&STACK$$Length)) +#elif defined ( __ICCARM__ ) +extern char CSTACK$$Base; +extern char CSTACK$$Length; +#define STACK_BASE &CSTACK$$Base +#define STACK_TOP ((void*)((uint32_t)STACK_BASE + (uint32_t)&CSTACK$$Length)) +#elif defined ( __GNUC__ ) +extern uint32_t __StackTop; +extern uint32_t __StackLimit; +#define STACK_BASE &__StackLimit +#define STACK_TOP &__StackTop +#endif +//lint -restore + +enum +{ + UNIT_0_625_MS = 625, /**< Number of microseconds in 0.625 milliseconds. */ + UNIT_1_25_MS = 1250, /**< Number of microseconds in 1.25 milliseconds. */ + UNIT_10_MS = 10000 /**< Number of microseconds in 10 milliseconds. */ +}; + + +/**@brief Implementation specific macro for delayed macro expansion used in string concatenation +* +* @param[in] lhs Left hand side in concatenation +* @param[in] rhs Right hand side in concatenation +*/ +#define STRING_CONCATENATE_IMPL(lhs, rhs) lhs ## rhs + + +/**@brief Macro used to concatenate string using delayed macro expansion +* +* @note This macro will delay concatenation until the expressions have been resolved +* +* @param[in] lhs Left hand side in concatenation +* @param[in] rhs Right hand side in concatenation +*/ +#define STRING_CONCATENATE(lhs, rhs) STRING_CONCATENATE_IMPL(lhs, rhs) + + +// Disable lint-warnings/errors for STATIC_ASSERT +//lint --emacro(10,STATIC_ASSERT) +//lint --emacro(18,STATIC_ASSERT) +//lint --emacro(19,STATIC_ASSERT) +//lint --emacro(30,STATIC_ASSERT) +//lint --emacro(37,STATIC_ASSERT) +//lint --emacro(42,STATIC_ASSERT) +//lint --emacro(26,STATIC_ASSERT) +//lint --emacro(102,STATIC_ASSERT) +//lint --emacro(533,STATIC_ASSERT) +//lint --emacro(534,STATIC_ASSERT) +//lint --emacro(132,STATIC_ASSERT) +//lint --emacro(414,STATIC_ASSERT) +//lint --emacro(578,STATIC_ASSERT) +//lint --emacro(628,STATIC_ASSERT) +//lint --emacro(648,STATIC_ASSERT) +//lint --emacro(830,STATIC_ASSERT) + + +/**@brief Macro for doing static (i.e. compile time) assertion. +* +* @note If the EXPR isn't resolvable, then the error message won't be shown. +* +* @note The output of STATIC_ASSERT will be different across different compilers. +* +* @param[in] EXPR Constant expression to be verified. +*/ +#if defined ( __COUNTER__ ) + +#define STATIC_ASSERT(EXPR) \ + ;enum { STRING_CONCATENATE(static_assert_, __COUNTER__) = 1/(!!(EXPR)) } + +#else + +#define STATIC_ASSERT(EXPR) \ + ;enum { STRING_CONCATENATE(assert_line_, __LINE__) = 1/(!!(EXPR)) } + +#endif + + +/**@brief Implementation details for NUM_VAR_ARGS */ +#define NUM_VA_ARGS_IMPL( \ + _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \ + _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \ + _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \ + _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \ + _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \ + _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \ + _61, _62, N, ...) N + + +/**@brief Macro to get the number of arguments in a call variadic macro call + * + * param[in] ... List of arguments + * + * @retval Number of variadic arguments in the argument list + */ +#define NUM_VA_ARGS(...) NUM_VA_ARGS_IMPL(__VA_ARGS__, 63, 62, 61, \ + 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \ + 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \ + 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \ + 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \ + 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \ + 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) + + +/**@brief type for holding an encoded (i.e. little endian) 16 bit unsigned integer. */ +typedef uint8_t uint16_le_t[2]; + +/**@brief Type for holding an encoded (i.e. little endian) 32 bit unsigned integer. */ +typedef uint8_t uint32_le_t[4]; + +/**@brief Byte array type. */ +typedef struct +{ + uint16_t size; /**< Number of array entries. */ + uint8_t * p_data; /**< Pointer to array entries. */ +} uint8_array_t; + + +/**@brief Macro for performing rounded integer division (as opposed to truncating the result). + * + * @param[in] A Numerator. + * @param[in] B Denominator. + * + * @return Rounded (integer) result of dividing A by B. + */ +#define ROUNDED_DIV(A, B) (((A) + ((B) / 2)) / (B)) + + +/**@brief Macro for checking if an integer is a power of two. + * + * @param[in] A Number to be tested. + * + * @return true if value is power of two. + * @return false if value not power of two. + */ +#define IS_POWER_OF_TWO(A) ( ((A) != 0) && ((((A) - 1) & (A)) == 0) ) + + +/**@brief Macro for converting milliseconds to ticks. + * + * @param[in] TIME Number of milliseconds to convert. + * @param[in] RESOLUTION Unit to be converted to in [us/ticks]. + */ +#define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION)) + + +/**@brief Macro for performing integer division, making sure the result is rounded up. + * + * @details One typical use for this is to compute the number of objects with size B is needed to + * hold A number of bytes. + * + * @param[in] A Numerator. + * @param[in] B Denominator. + * + * @return Integer result of dividing A by B, rounded up. + */ +#define CEIL_DIV(A, B) \ + (((A) + (B) - 1) / (B)) + + +/**@brief Macro for creating a buffer aligned to 4 bytes. + * + * @param[in] NAME Name of the buffor. + * @param[in] MIN_SIZE Size of this buffor (it will be rounded up to multiples of 4 bytes). + */ +#define WORD_ALIGNED_MEM_BUFF(NAME, MIN_SIZE) static uint32_t NAME[CEIL_DIV(MIN_SIZE, sizeof(uint32_t))] + + +/**@brief Macro for calculating the number of words that are needed to hold a number of bytes. + * + * @details Adds 3 and divides by 4. + * + * @param[in] n_bytes The number of bytes. + * + * @return The number of words that @p n_bytes take up (rounded up). + */ +#define BYTES_TO_WORDS(n_bytes) (((n_bytes) + 3) >> 2) + + +/**@brief The number of bytes in a word. + */ +#define BYTES_PER_WORD (4) + + +/**@brief Macro for increasing a number to the nearest (larger) multiple of another number. + * + * @param[in] alignment The number to align to. + * @param[in] number The number to align (increase). + * + * @return The aligned (increased) @p number. + */ +#define ALIGN_NUM(alignment, number) ((number - 1) + alignment - ((number - 1) % alignment)) + + +/**@brief Function for changing the value unit. + * + * @param[in] value Value to be rescaled. + * @param[in] old_unit_reversal Reversal of the incoming unit. + * @param[in] new_unit_reversal Reversal of the desired unit. + * + * @return Number of bytes written. + */ +static __INLINE uint64_t value_rescale(uint32_t value, uint32_t old_unit_reversal, uint16_t new_unit_reversal) +{ + return (uint64_t)ROUNDED_DIV((uint64_t)value * new_unit_reversal, old_unit_reversal); +} + +/**@brief Function for encoding a uint16 value. + * + * @param[in] value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t uint16_encode(uint16_t value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) ((value & 0x00FF) >> 0); + p_encoded_data[1] = (uint8_t) ((value & 0xFF00) >> 8); + return sizeof(uint16_t); +} + +/**@brief Function for encoding a three-byte value. + * + * @param[in] value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t uint24_encode(uint32_t value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) ((value & 0x000000FF) >> 0); + p_encoded_data[1] = (uint8_t) ((value & 0x0000FF00) >> 8); + p_encoded_data[2] = (uint8_t) ((value & 0x00FF0000) >> 16); + return 3; +} + +/**@brief Function for encoding a uint32 value. + * + * @param[in] value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t uint32_encode(uint32_t value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) ((value & 0x000000FF) >> 0); + p_encoded_data[1] = (uint8_t) ((value & 0x0000FF00) >> 8); + p_encoded_data[2] = (uint8_t) ((value & 0x00FF0000) >> 16); + p_encoded_data[3] = (uint8_t) ((value & 0xFF000000) >> 24); + return sizeof(uint32_t); +} + +/**@brief Function for encoding a uint48 value. + * + * @param[in] value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t uint48_encode(uint64_t value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) ((value & 0x0000000000FF) >> 0); + p_encoded_data[1] = (uint8_t) ((value & 0x00000000FF00) >> 8); + p_encoded_data[2] = (uint8_t) ((value & 0x000000FF0000) >> 16); + p_encoded_data[3] = (uint8_t) ((value & 0x0000FF000000) >> 24); + p_encoded_data[4] = (uint8_t) ((value & 0x00FF00000000) >> 32); + p_encoded_data[5] = (uint8_t) ((value & 0xFF0000000000) >> 40); + return 6; +} + +/**@brief Function for decoding a uint16 value. + * + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * + * @return Decoded value. + */ +static __INLINE uint16_t uint16_decode(const uint8_t * p_encoded_data) +{ + return ( (((uint16_t)((uint8_t *)p_encoded_data)[0])) | + (((uint16_t)((uint8_t *)p_encoded_data)[1]) << 8 )); +} + +/**@brief Function for decoding a uint16 value in big-endian format. + * + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * + * @return Decoded value. + */ +static __INLINE uint16_t uint16_big_decode(const uint8_t * p_encoded_data) +{ + return ( (((uint16_t)((uint8_t *)p_encoded_data)[0]) << 8 ) | + (((uint16_t)((uint8_t *)p_encoded_data)[1])) ); +} + +/**@brief Function for decoding a three-byte value. + * + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * + * @return Decoded value (uint32_t). + */ +static __INLINE uint32_t uint24_decode(const uint8_t * p_encoded_data) +{ + return ( (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 0) | + (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 8) | + (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 16)); +} + +/**@brief Function for decoding a uint32 value. + * + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * + * @return Decoded value. + */ +static __INLINE uint32_t uint32_decode(const uint8_t * p_encoded_data) +{ + return ( (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 0) | + (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 8) | + (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 16) | + (((uint32_t)((uint8_t *)p_encoded_data)[3]) << 24 )); +} + +/**@brief Function for decoding a uint32 value in big-endian format. + * + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * + * @return Decoded value. + */ +static __INLINE uint32_t uint32_big_decode(const uint8_t * p_encoded_data) +{ + return ( (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 24) | + (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 16) | + (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 8) | + (((uint32_t)((uint8_t *)p_encoded_data)[3]) << 0) ); +} + +/**@brief Function for encoding a uint32 value in big-endian format. + * + * @param[in] value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data will be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t uint32_big_encode(uint32_t value, uint8_t * p_encoded_data) +{ +#ifdef NRF51 + p_encoded_data[0] = (uint8_t) ((value & 0xFF000000) >> 24); + p_encoded_data[1] = (uint8_t) ((value & 0x00FF0000) >> 16); + p_encoded_data[2] = (uint8_t) ((value & 0x0000FF00) >> 8); + p_encoded_data[3] = (uint8_t) ((value & 0x000000FF) >> 0); +#elif NRF52 + *(uint32_t *)p_encoded_data = __REV(value); +#endif + return sizeof(uint32_t); +} + +/**@brief Function for decoding a uint48 value. + * + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * + * @return Decoded value. (uint64_t) + */ +static __INLINE uint64_t uint48_decode(const uint8_t * p_encoded_data) +{ + return ( (((uint64_t)((uint8_t *)p_encoded_data)[0]) << 0) | + (((uint64_t)((uint8_t *)p_encoded_data)[1]) << 8) | + (((uint64_t)((uint8_t *)p_encoded_data)[2]) << 16) | + (((uint64_t)((uint8_t *)p_encoded_data)[3]) << 24) | + (((uint64_t)((uint8_t *)p_encoded_data)[4]) << 32) | + (((uint64_t)((uint8_t *)p_encoded_data)[5]) << 40 )); +} + +/** @brief Function for converting the input voltage (in milli volts) into percentage of 3.0 Volts. + * + * @details The calculation is based on a linearized version of the battery's discharge + * curve. 3.0V returns 100% battery level. The limit for power failure is 2.1V and + * is considered to be the lower boundary. + * + * The discharge curve for CR2032 is non-linear. In this model it is split into + * 4 linear sections: + * - Section 1: 3.0V - 2.9V = 100% - 42% (58% drop on 100 mV) + * - Section 2: 2.9V - 2.74V = 42% - 18% (24% drop on 160 mV) + * - Section 3: 2.74V - 2.44V = 18% - 6% (12% drop on 300 mV) + * - Section 4: 2.44V - 2.1V = 6% - 0% (6% drop on 340 mV) + * + * These numbers are by no means accurate. Temperature and + * load in the actual application is not accounted for! + * + * @param[in] mvolts The voltage in mV + * + * @return Battery level in percent. +*/ +static __INLINE uint8_t battery_level_in_percent(const uint16_t mvolts) +{ + uint8_t battery_level; + + if (mvolts >= 3000) + { + battery_level = 100; + } + else if (mvolts > 2900) + { + battery_level = 100 - ((3000 - mvolts) * 58) / 100; + } + else if (mvolts > 2740) + { + battery_level = 42 - ((2900 - mvolts) * 24) / 160; + } + else if (mvolts > 2440) + { + battery_level = 18 - ((2740 - mvolts) * 12) / 300; + } + else if (mvolts > 2100) + { + battery_level = 6 - ((2440 - mvolts) * 6) / 340; + } + else + { + battery_level = 0; + } + + return battery_level; +} + +/**@brief Function for checking if a pointer value is aligned to a 4 byte boundary. + * + * @param[in] p Pointer value to be checked. + * + * @return TRUE if pointer is aligned to a 4 byte boundary, FALSE otherwise. + */ +static __INLINE bool is_word_aligned(void const* p) +{ + return (((uintptr_t)p & 0x03) == 0); +} + +/** + * @brief Function for checking if provided address is located in stack space. + * + * @param[in] ptr Pointer to be checked. + * + * @return true if address is in stack space, false otherwise. + */ +static __INLINE bool is_address_from_stack(void * ptr) +{ + if (((uint32_t)ptr >= (uint32_t)STACK_BASE) && + ((uint32_t)ptr < (uint32_t)STACK_TOP) ) + { + return true; + } + else + { + return false; + } +} + +#endif // APP_UTIL_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_bds.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_bds.h new file mode 100644 index 0000000000..96467e3d89 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_bds.h @@ -0,0 +1,440 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup app_util Utility Functions and Definitions + * @{ + * @ingroup app_common + * + * @brief Various types and definitions available to all applications. + */ + +#ifndef APP_UTIL_BDS_H__ +#define APP_UTIL_BDS_H__ + +#include +#include +#include +#include "compiler_abstraction.h" +#include "app_util.h" +#include "ble_srv_common.h" +#include "nordic_common.h" + +typedef uint8_t nibble_t; +typedef uint32_t uint24_t; +typedef uint64_t uint40_t; + +/**@brief IEEE 11073-20601 Regulatory Certification Data List Structure */ +typedef struct +{ + uint8_t * p_list; /**< Pointer the byte array containing the encoded opaque structure based on IEEE 11073-20601 specification. */ + uint8_t list_len; /**< Length of the byte array. */ +} regcertdatalist_t; + +/**@brief SFLOAT format (IEEE-11073 16-bit FLOAT, meaning 4 bits for exponent (base 10) and 12 bits mantissa) */ +typedef struct +{ + int8_t exponent; /**< Base 10 exponent, should be using only 4 bits */ + int16_t mantissa; /**< Mantissa, should be using only 12 bits */ +} sfloat_t; + +/**@brief Date and Time structure. */ +typedef struct +{ + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hours; + uint8_t minutes; + uint8_t seconds; +} ble_date_time_t; + + +/**@brief Function for encoding a uint16 value. + * + * @param[in] p_value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t bds_uint16_encode(const uint16_t * p_value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) ((*p_value & 0x00FF) >> 0); + p_encoded_data[1] = (uint8_t) ((*p_value & 0xFF00) >> 8); + return sizeof(uint16_t); +} + +static __INLINE uint8_t bds_int16_encode(const int16_t * p_value, uint8_t * p_encoded_data) +{ + uint16_t tmp = *p_value; + return bds_uint16_encode(&tmp, p_encoded_data); +} + +/**@brief Function for encoding a uint24 value. + * + * @param[in] p_value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t bds_uint24_encode(const uint32_t * p_value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) ((*p_value & 0x000000FF) >> 0); + p_encoded_data[1] = (uint8_t) ((*p_value & 0x0000FF00) >> 8); + p_encoded_data[2] = (uint8_t) ((*p_value & 0x00FF0000) >> 16); + return (3); +} + + +/**@brief Function for encoding a uint32 value. + * + * @param[in] p_value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t bds_uint32_encode(const uint32_t * p_value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) ((*p_value & 0x000000FF) >> 0); + p_encoded_data[1] = (uint8_t) ((*p_value & 0x0000FF00) >> 8); + p_encoded_data[2] = (uint8_t) ((*p_value & 0x00FF0000) >> 16); + p_encoded_data[3] = (uint8_t) ((*p_value & 0xFF000000) >> 24); + return sizeof(uint32_t); +} + + +/**@brief Function for encoding a uint40 value. + * + * @param[in] p_value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t bds_uint40_encode(const uint64_t * p_value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) ((*p_value & 0x00000000000000FF) >> 0); + p_encoded_data[1] = (uint8_t) ((*p_value & 0x000000000000FF00) >> 8); + p_encoded_data[2] = (uint8_t) ((*p_value & 0x0000000000FF0000) >> 16); + p_encoded_data[3] = (uint8_t) ((*p_value & 0x00000000FF000000) >> 24); + p_encoded_data[4] = (uint8_t) ((*p_value & 0x000000FF00000000) >> 32); + return 5; +} + +/**@brief Function for encoding a sfloat value. + * + * @param[in] p_value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t bds_sfloat_encode(const sfloat_t * p_value, uint8_t * p_encoded_data) +{ + uint16_t encoded_val; + + encoded_val = ((p_value->exponent << 12) & 0xF000) | + ((p_value->mantissa << 0) & 0x0FFF); + + return(bds_uint16_encode(&encoded_val, p_encoded_data)); +} + + +/**@brief Function for encoding a uint8_array value. + * + * @param[in] p_value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + */ +static __INLINE uint8_t bds_uint8_array_encode(const uint8_array_t * p_value, + uint8_t * p_encoded_data) +{ + memcpy(p_encoded_data, p_value->p_data, p_value->size); + return p_value->size; +} + + +/**@brief Function for encoding a utf8_str value. + * + * @param[in] p_value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + + */ +static __INLINE uint8_t bds_ble_srv_utf8_str_encode(const ble_srv_utf8_str_t * p_value, + uint8_t * p_encoded_data) +{ + memcpy(p_encoded_data, p_value->p_str, p_value->length); + return p_value->length; +} + +/**@brief Function for encoding a regcertdatalist value. + * + * @param[in] p_value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data is to be written. + + */ +static __INLINE uint8_t bds_regcertdatalist_encode(const regcertdatalist_t * p_value, + uint8_t * p_encoded_data) +{ + memcpy(p_encoded_data, p_value->p_list, p_value->list_len); + return p_value->list_len; +} + + +/**@brief Function for decoding a date_time value. + * + * @param[in] p_date_time pointer to the date_time structure to encode. + * @param[in] p_encoded_data pointer to the encoded data + * @return length of the encoded field. + */ +static __INLINE uint8_t bds_ble_date_time_encode(const ble_date_time_t * p_date_time, + uint8_t * p_encoded_data) +{ + uint8_t len = bds_uint16_encode(&p_date_time->year, &p_encoded_data[0]); + + p_encoded_data[len++] = p_date_time->month; + p_encoded_data[len++] = p_date_time->day; + p_encoded_data[len++] = p_date_time->hours; + p_encoded_data[len++] = p_date_time->minutes; + p_encoded_data[len++] = p_date_time->seconds; + + return len; +} + + +/**@brief Function for decoding a uint16 value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_uint16_decode(const uint8_t len, + const uint8_t * p_encoded_data, + uint16_t * p_decoded_val) +{ + UNUSED_VARIABLE(len); + *p_decoded_val = (((uint16_t)((uint8_t *)p_encoded_data)[0])) | + (((uint16_t)((uint8_t *)p_encoded_data)[1]) << 8 ); + return (sizeof(uint16_t)); +} + + +/**@brief Function for decoding a int16 value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_int16_decode(const uint8_t len, + const uint8_t * p_encoded_data, + int16_t * p_decoded_val) +{ + UNUSED_VARIABLE(len); + uint16_t tmp = 0; + uint8_t retval = bds_uint16_decode(len, p_encoded_data, &tmp); + *p_decoded_val = (int16_t)tmp; + return retval; +} + + +/**@brief Function for decoding a uint24 value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_uint24_decode(const uint8_t len, + const uint8_t * p_encoded_data, + uint32_t * p_decoded_val) +{ + UNUSED_VARIABLE(len); + *p_decoded_val = (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 0) | + (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 8) | + (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 16); + return (3); +} + + +/**@brief Function for decoding a uint32 value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_uint32_decode(const uint8_t len, + const uint8_t * p_encoded_data, + uint32_t * p_decoded_val) +{ + UNUSED_VARIABLE(len); + *p_decoded_val = (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 0) | + (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 8) | + (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 16) | + (((uint32_t)((uint8_t *)p_encoded_data)[3]) << 24 ); + return (sizeof(uint32_t)); +} + + +/**@brief Function for decoding a uint40 value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_uint40_decode(const uint8_t len, + const uint8_t * p_encoded_data, + uint64_t * p_decoded_val) +{ + UNUSED_VARIABLE(len); + *p_decoded_val = (((uint64_t)((uint8_t *)p_encoded_data)[0]) << 0) | + (((uint64_t)((uint8_t *)p_encoded_data)[1]) << 8) | + (((uint64_t)((uint8_t *)p_encoded_data)[2]) << 16) | + (((uint64_t)((uint8_t *)p_encoded_data)[3]) << 24 )| + (((uint64_t)((uint8_t *)p_encoded_data)[4]) << 32 ); + return (40); +} + + +/**@brief Function for decoding a sfloat value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * + * @return length of the decoded field. + + */ +static __INLINE uint8_t bds_sfloat_decode(const uint8_t len, + const uint8_t * p_encoded_data, + sfloat_t * p_decoded_val) +{ + + p_decoded_val->exponent = 0; + bds_uint16_decode(len, p_encoded_data, (uint16_t*)&p_decoded_val->mantissa); + p_decoded_val->exponent = (uint8_t)((p_decoded_val->mantissa & 0xF000) >> 12); + p_decoded_val->mantissa &= 0x0FFF; + return len; +} + + +/**@brief Function for decoding a uint8_array value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_uint8_array_decode(const uint8_t len, + const uint8_t * p_encoded_data, + uint8_array_t * p_decoded_val) +{ + memcpy(p_decoded_val->p_data, p_encoded_data, len); + p_decoded_val->size = len; + return p_decoded_val->size; +} + + +/**@brief Function for decoding a utf8_str value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_ble_srv_utf8_str_decode(const uint8_t len, + const uint8_t * p_encoded_data, + ble_srv_utf8_str_t * p_decoded_val) +{ + p_decoded_val->p_str = (uint8_t*)p_encoded_data; + p_decoded_val->length = len; + return p_decoded_val->length; +} + + +/**@brief Function for decoding a regcertdatalist value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_decoded_val pointer to the decoded value + * + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_regcertdatalist_decode(const uint8_t len, + const uint8_t * p_encoded_data, + regcertdatalist_t * p_decoded_val) +{ + memcpy(p_decoded_val->p_list, p_encoded_data, len); + p_decoded_val->list_len = len; + return p_decoded_val->list_len; +} + + +/**@brief Function for decoding a date_time value. + * + * @param[in] len length of the field to be decoded. + * @param[in] p_encoded_data Buffer where the encoded data is stored. + * @param[in] p_date_time pointer to the decoded value + * + * @return length of the decoded field. + */ +static __INLINE uint8_t bds_ble_date_time_decode(const uint8_t len, + const uint8_t * p_encoded_data, + ble_date_time_t * p_date_time) +{ + UNUSED_VARIABLE(len); + uint8_t pos = bds_uint16_decode(len, &p_encoded_data[0], &p_date_time->year); + p_date_time->month = p_encoded_data[pos++]; + p_date_time->day = p_encoded_data[pos++]; + p_date_time->hours = p_encoded_data[pos++]; + p_date_time->minutes = p_encoded_data[pos++]; + p_date_time->seconds = p_encoded_data[pos++]; + + return pos; +} + +#endif // APP_UTIL_BDS_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.c new file mode 100644 index 0000000000..8683b50efc --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "app_util_platform.h" + +static uint32_t m_in_critical_region = 0; + +void app_util_disable_irq(void) +{ + __disable_irq(); + m_in_critical_region++; +} + +void app_util_enable_irq(void) +{ + m_in_critical_region--; + if (m_in_critical_region == 0) + { + __enable_irq(); + } +} + +void app_util_critical_region_enter(uint8_t *p_nested) +{ +#ifdef NRF52 + ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) +#endif + +#if defined(SOFTDEVICE_PRESENT) + /* return value can be safely ignored */ + (void) sd_nvic_critical_region_enter(p_nested); +#else + app_util_disable_irq(); +#endif +} + +void app_util_critical_region_exit(uint8_t nested) +{ +#ifdef NRF52 + ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) +#endif + +#if defined(SOFTDEVICE_PRESENT) + /* return value can be safely ignored */ + (void) sd_nvic_critical_region_exit(nested); +#else + app_util_enable_irq(); +#endif +} + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h new file mode 100644 index 0000000000..0d082e2e65 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup app_util_platform Utility Functions and Definitions (Platform) + * @{ + * @ingroup app_common + * + * @brief Various types and definitions available to all applications when using SoftDevice. + */ + +#ifndef APP_UTIL_PLATFORM_H__ +#define APP_UTIL_PLATFORM_H__ + +#include +#include "compiler_abstraction.h" +#include "nrf.h" +#ifdef SOFTDEVICE_PRESENT +#include "nrf_soc.h" +#include "nrf_nvic.h" +#endif +#include "nrf_assert.h" +#include "app_error.h" + +#if defined(NRF51) +#define _PRIO_SD_HIGH 0 +#define _PRIO_APP_HIGH 1 +#define _PRIO_APP_MID 1 +#define _PRIO_SD_LOW 2 +#define _PRIO_APP_LOW 3 +#define _PRIO_APP_LOWEST 3 +#define _PRIO_THREAD 4 +#elif defined(NRF52) +#define _PRIO_SD_HIGH 0 +#define _PRIO_SD_MID 1 +#define _PRIO_APP_HIGH 2 +#define _PRIO_APP_MID 3 +#define _PRIO_SD_LOW 4 +#define _PRIO_SD_LOWEST 5 +#define _PRIO_APP_LOW 6 +#define _PRIO_APP_LOWEST 7 +#define _PRIO_THREAD 15 +#else + #error "No platform defined" +#endif + +/**@brief The interrupt priorities available to the application while the SoftDevice is active. */ +typedef enum +{ +#ifdef SOFTDEVICE_PRESENT + APP_IRQ_PRIORITY_HIGHEST = _PRIO_SD_HIGH, +#else + APP_IRQ_PRIORITY_HIGHEST = _PRIO_APP_HIGH, +#endif + APP_IRQ_PRIORITY_HIGH = _PRIO_APP_HIGH, +#ifndef SOFTDEVICE_PRESENT + APP_IRQ_PRIORITY_MID = _PRIO_SD_LOW, +#else + APP_IRQ_PRIORITY_MID = _PRIO_APP_MID, +#endif + APP_IRQ_PRIORITY_LOW = _PRIO_APP_LOW, + APP_IRQ_PRIORITY_LOWEST = _PRIO_APP_LOWEST, + APP_IRQ_PRIORITY_THREAD = _PRIO_THREAD /**< "Interrupt level" when running in Thread Mode. */ +} app_irq_priority_t; + +/*@brief The privilege levels available to applications in Thread Mode */ +typedef enum +{ + APP_LEVEL_UNPRIVILEGED, + APP_LEVEL_PRIVILEGED +} app_level_t; + +/**@cond NO_DOXYGEN */ +#define EXTERNAL_INT_VECTOR_OFFSET 16 +/**@endcond */ + +void app_util_critical_region_enter (uint8_t *p_nested); +void app_util_critical_region_exit (uint8_t nested); + +/**@brief Macro for entering a critical region. + * + * @note Due to implementation details, there must exist one and only one call to + * CRITICAL_REGION_EXIT() for each call to CRITICAL_REGION_ENTER(), and they must be located + * in the same scope. + */ +#ifdef SOFTDEVICE_PRESENT +#define CRITICAL_REGION_ENTER() \ + { \ + uint8_t __CR_NESTED = 0; \ + app_util_critical_region_enter(&__CR_NESTED); +#else +#define CRITICAL_REGION_ENTER() app_util_critical_region_enter(NULL) +#endif + +/**@brief Macro for leaving a critical region. + * + * @note Due to implementation details, there must exist one and only one call to + * CRITICAL_REGION_EXIT() for each call to CRITICAL_REGION_ENTER(), and they must be located + * in the same scope. + */ +#ifdef SOFTDEVICE_PRESENT +#define CRITICAL_REGION_EXIT() \ + app_util_critical_region_exit(__CR_NESTED); \ + } +#else +#define CRITICAL_REGION_EXIT() app_util_critical_region_exit(0) +#endif + +/* Workaround for Keil 4 */ +#ifndef IPSR_ISR_Msk +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ +#endif + + + +/**@brief Macro to enable anonymous unions from a certain point in the code. + */ +#if defined(__CC_ARM) + #define ANON_UNIONS_ENABLE _Pragma("push") \ + _Pragma("anon_unions") +#elif defined(__ICCARM__) + #define ANON_UNIONS_ENABLE _Pragma("language=extended") +#else + #define ANON_UNIONS_ENABLE + // No action will be taken. + // For GCC anonymous unions are enabled by default. +#endif + +/**@brief Macro to disable anonymous unions from a certain point in the code. + * @note Call only after first calling @ref ANON_UNIONS_ENABLE. + */ +#if defined(__CC_ARM) + #define ANON_UNIONS_DISABLE _Pragma("pop") +#elif defined(__ICCARM__) + #define ANON_UNIONS_DISABLE + // for IAR leave anonymous unions enabled +#else + #define ANON_UNIONS_DISABLE + // No action will be taken. + // For GCC anonymous unions are enabled by default. +#endif + + +/* Workaround for Keil 4 */ +#ifndef CONTROL_nPRIV_Msk +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ +#endif + +/**@brief Function for finding the current interrupt level. + * + * @return Current interrupt level. + * @retval APP_IRQ_PRIORITY_HIGH We are running in Application High interrupt level. + * @retval APP_IRQ_PRIORITY_LOW We are running in Application Low interrupt level. + * @retval APP_IRQ_PRIORITY_THREAD We are running in Thread Mode. + */ +static __INLINE uint8_t current_int_priority_get(void) +{ + uint32_t isr_vector_num = __get_IPSR() & IPSR_ISR_Msk ; + if (isr_vector_num > 0) + { + int32_t irq_type = ((int32_t)isr_vector_num - EXTERNAL_INT_VECTOR_OFFSET); + return (NVIC_GetPriority((IRQn_Type)irq_type) & 0xFF); + } + else + { + return APP_IRQ_PRIORITY_THREAD; + } +} + +/**@brief Function for finding out the current privilege level. + * + * @return Current privilege level. + * @retval APP_LEVEL_UNPRIVILEGED We are running in unprivileged level. + * @retval APP_LEVEL_PRIVILEGED We are running in privileged level. + */ +static __INLINE uint8_t privilege_level_get(void) +{ +#if defined(NRF51) + /* the Cortex-M0 has no concept of privilege */ + return APP_LEVEL_PRIVILEGED; +#elif defined(NRF52) + uint32_t isr_vector_num = __get_IPSR() & IPSR_ISR_Msk ; + if (0 == isr_vector_num) + { + /* Thread Mode, check nPRIV */ + int32_t control = __get_CONTROL(); + return control & CONTROL_nPRIV_Msk ? APP_LEVEL_UNPRIVILEGED : APP_LEVEL_PRIVILEGED; + } + else + { + /* Handler Mode, always privileged */ + return APP_LEVEL_PRIVILEGED; + } +#endif +} + +#endif // APP_UTIL_PLATFORM_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/common.h new file mode 100644 index 0000000000..acd5a9c5df --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/common.h @@ -0,0 +1,65 @@ + /* + * Copyright (c) 2009 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef COMMON_H +#define COMMON_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +/* @file +* @brief Common header file for generic macros and definitions + * + */ + +/* + * GPIO glue macros, this can be used to define a pin number in source/header file and use that macro for pin + * configuration using this expansion. + * example: + * #define RESET_PIN 8 + * NRF_GPIO->PINCNF(RESET_PIN) = XXX ; // Expanded NRF_GPIO->PIN_CNF[8] = XXX + */ +#define PINX_GLUE(x, y, z) x##y##_##z /*!< first level glue for pin macros */ +#define PINCNF(p) PINX_GLUE(PIN,p,CNF) /*!< gpio configure pin number 'p' */ +#define PINOUT(p) PINX_GLUE(PIN,p,OUT) /*!< gpio out pin number 'p' */ + +/*lint --flb "Leave library region" */ +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nordic_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nordic_common.h new file mode 100644 index 0000000000..f0e725bc06 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nordic_common.h @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2008 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * @brief Common defines and macros for firmware developed by Nordic Semiconductor. + */ + +#ifndef NORDIC_COMMON_H__ +#define NORDIC_COMMON_H__ + +/** The upper 8 bits of a 32 bit value */ +//lint -emacro(572,MSB) // Suppress warning 572 "Excessive shift value" +#define MSB_32(a) (((a) & 0xFF000000) >> 24) +/** The lower 8 bits (of a 32 bit value) */ +#define LSB_32(a) ((a) & 0x000000FF) + +/** The upper 8 bits of a 16 bit value */ +//lint -emacro(572,MSB_16) // Suppress warning 572 "Excessive shift value" +#define MSB_16(a) (((a) & 0xFF00) >> 8) +/** The lower 8 bits (of a 16 bit value) */ +#define LSB_16(a) ((a) & 0x00FF) + +/** Leaves the minimum of the two 32-bit arguments */ +/*lint -emacro(506, MIN) */ /* Suppress "Constant value Boolean */ +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +/** Leaves the maximum of the two 32-bit arguments */ +/*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */ +#define MAX(a, b) ((a) < (b) ? (b) : (a)) + +/** Concatenates two parameters. Useful as a second level of indirection, + * when a parameter can be macro itself. */ +#define CONCAT_2(p1, p2) p1##p2 +/** Concatenates three parameters. Useful as a second level of indirection, + * when a parameter can be macro itself. */ +#define CONCAT_3(p1, p2, p3) p1##p2##p3 + +/**@brief Set a bit in the uint32 word. + * + * @param[in] W Word whose bit is being set. + * @param[in] B Bit number in the word to be set. + */ +#define SET_BIT(W,B) ((W) |= (uint32_t)(1U << (B))) + + +/**@brief Clears a bit in the uint32 word. + * + * @param[in] W Word whose bit is to be cleared. + * @param[in] B Bit number in the word to be cleared. + */ +#define CLR_BIT(W, B) ((W) &= (~((uint32_t)1 << (B)))) + + +/**@brief Checks if a bit is set. + * + * @param[in] W Word whose bit is to be checked. + * @param[in] B Bit number in the word to be checked. + * + * @retval 1 if bit is set. + * @retval 0 if bit is not set. + */ +#define IS_SET(W,B) (((W) >> (B)) & 1) + +#define BIT_0 0x01 /**< The value of bit 0 */ +#define BIT_1 0x02 /**< The value of bit 1 */ +#define BIT_2 0x04 /**< The value of bit 2 */ +#define BIT_3 0x08 /**< The value of bit 3 */ +#define BIT_4 0x10 /**< The value of bit 4 */ +#define BIT_5 0x20 /**< The value of bit 5 */ +#define BIT_6 0x40 /**< The value of bit 6 */ +#define BIT_7 0x80 /**< The value of bit 7 */ +#define BIT_8 0x0100 /**< The value of bit 8 */ +#define BIT_9 0x0200 /**< The value of bit 9 */ +#define BIT_10 0x0400 /**< The value of bit 10 */ +#define BIT_11 0x0800 /**< The value of bit 11 */ +#define BIT_12 0x1000 /**< The value of bit 12 */ +#define BIT_13 0x2000 /**< The value of bit 13 */ +#define BIT_14 0x4000 /**< The value of bit 14 */ +#define BIT_15 0x8000 /**< The value of bit 15 */ +#define BIT_16 0x00010000 /**< The value of bit 16 */ +#define BIT_17 0x00020000 /**< The value of bit 17 */ +#define BIT_18 0x00040000 /**< The value of bit 18 */ +#define BIT_19 0x00080000 /**< The value of bit 19 */ +#define BIT_20 0x00100000 /**< The value of bit 20 */ +#define BIT_21 0x00200000 /**< The value of bit 21 */ +#define BIT_22 0x00400000 /**< The value of bit 22 */ +#define BIT_23 0x00800000 /**< The value of bit 23 */ +#define BIT_24 0x01000000 /**< The value of bit 24 */ +#define BIT_25 0x02000000 /**< The value of bit 25 */ +#define BIT_26 0x04000000 /**< The value of bit 26 */ +#define BIT_27 0x08000000 /**< The value of bit 27 */ +#define BIT_28 0x10000000 /**< The value of bit 28 */ +#define BIT_29 0x20000000 /**< The value of bit 29 */ +#define BIT_30 0x40000000 /**< The value of bit 30 */ +#define BIT_31 0x80000000 /**< The value of bit 31 */ + +#define UNUSED_VARIABLE(X) ((void)(X)) +#define UNUSED_PARAMETER(X) UNUSED_VARIABLE(X) +#define UNUSED_RETURN_VALUE(X) UNUSED_VARIABLE(X) + +#endif // NORDIC_COMMON_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.c new file mode 100644 index 0000000000..23ba8f76cb --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2006 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_assert.h" +#include "app_error.h" +#include "nordic_common.h" + +#if defined(DEBUG_NRF) +void assert_nrf_callback(uint16_t line_num, const uint8_t * file_name) +{ + assert_info_t assert_info = + { + .line_num = line_num, + .p_file_name = file_name, + }; + app_error_fault_handler(NRF_FAULT_ID_SDK_ASSERT, 0, (uint32_t)(&assert_info)); + + UNUSED_VARIABLE(assert_info); +} +#endif /* DEBUG_NRF */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.h new file mode 100644 index 0000000000..8ef5a5d501 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2006 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * @brief Utilities for verifying program logic + */ + +#ifndef NRF_ASSERT_H_ +#define NRF_ASSERT_H_ + +#include +#include "nrf.h" +#include "app_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) + +/** @brief Function for handling assertions. + * + * + * @note + * This function is called when an assertion has triggered. + * + * + * @post + * All hardware is put into an idle non-emitting state (in particular the radio is highly + * important to switch off since the radio might be in a state that makes it send + * packets continiously while a typical final infinit ASSERT loop is executing). + * + * + * @param line_num The line number where the assertion is called + * @param file_name Pointer to the file name + */ +void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); + +/*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ +/*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \ + +/** @brief Function for checking intended for production code. + * + * Check passes if "expr" evaluates to true. */ +#define ASSERT(expr) \ +if (expr) \ +{ \ +} \ +else \ +{ \ + assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ +} +#else +#ifndef ASSERT +#define ASSERT(expr) //!< Assert empty when disabled +__WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); +#endif +#endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */ + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_ASSERT_H_ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.c new file mode 100644 index 0000000000..3c26bf540e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.c @@ -0,0 +1,429 @@ +#include "nrf.h" +#include "nrf_log.h" +#include "nrf_error.h" +#include +#include +#include + +#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 + +#include +#include + +static char buf_normal_up[BUFFER_SIZE_UP]; +static char buf_down[BUFFER_SIZE_DOWN]; + +uint32_t log_rtt_init(void) +{ + static bool initialized = false; + if (initialized) + { + return NRF_SUCCESS; + } + + if (SEGGER_RTT_ConfigUpBuffer(LOG_TERMINAL_NORMAL, + "Normal", + buf_normal_up, + BUFFER_SIZE_UP, + SEGGER_RTT_MODE_NO_BLOCK_TRIM + ) + != 0) + { + return NRF_ERROR_INVALID_STATE; + } + + if (SEGGER_RTT_ConfigDownBuffer(LOG_TERMINAL_INPUT, + "Input", + buf_down, + BUFFER_SIZE_DOWN, + SEGGER_RTT_MODE_NO_BLOCK_SKIP + ) + != 0) + { + return NRF_ERROR_INVALID_STATE; + } + + initialized = true; + + return NRF_SUCCESS; +} + +// Forward declaration of SEGGER RTT vprintf function +int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList); + +void log_rtt_printf(int terminal_index, char * format_msg, ...) +{ + //lint -save -e526 -e628 -e530 + va_list p_args; + va_start(p_args, format_msg); + (void)SEGGER_RTT_vprintf(terminal_index, format_msg, &p_args); + va_end(p_args); + //lint -restore +} + +__INLINE void log_rtt_write_string(int terminal_index, int num_args, ...) +{ + const char* msg; + //lint -save -e516 -e530 + va_list p_args; + va_start(p_args, num_args); + //lint -restore + + for (int i = 0; i < num_args; i++) + { + //lint -save -e26 -e10 -e64 -e526 -e628 -e530 + msg = va_arg(p_args, const char*); + //lint -restore + (void)SEGGER_RTT_WriteString(terminal_index, msg); + } + va_end(p_args); +} + +void log_rtt_write_hex(int terminal_index, uint32_t value) +{ + char temp[11]; + temp[0] = '0'; + temp[1] = 'x'; + temp[10] = 0; // Null termination + uint8_t nibble; + uint8_t i = 8; + + while(i-- != 0) + { + nibble = (value >> (4 * i)) & 0x0F; + temp[9-i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); + } + + (void)SEGGER_RTT_WriteString(terminal_index, temp); +} + +void log_rtt_write_hex_char(int terminal_index, uint8_t value) +{ + char temp[3]; + temp[2] = 0; // Null termination + uint8_t nibble; + uint8_t i = 2; + + while(i-- != 0) + { + nibble = (value >> (4 * i)) & 0x0F; + temp[1-i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); + } + + (void)SEGGER_RTT_WriteString(terminal_index, temp); +} + +__INLINE int log_rtt_has_input() +{ + return SEGGER_RTT_HasKey(); +} + +uint32_t log_rtt_read_input(char * c) +{ + int r; + + r = SEGGER_RTT_Read(LOG_TERMINAL_INPUT, c, 1); + if (r == 1) + return NRF_SUCCESS; + else + return NRF_ERROR_NULL; +} + +#elif defined(NRF_LOG_USES_UART) && NRF_LOG_USES_UART == 1 + +#include "app_uart.h" +#include "app_error.h" +#include +#include +#include "nrf.h" +#include "bsp.h" + +#define MAX_TEST_DATA_BYTES (15U) /**< max number of test bytes to be used for tx and rx. */ +#define UART_TX_BUF_SIZE 512 /**< UART TX buffer size. */ +#define UART_RX_BUF_SIZE 1 /**< UART RX buffer size. */ + +static uint8_t m_uart_data; +static bool m_uart_has_input; + +void uart_error_cb(app_uart_evt_t * p_event) +{ + if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR) + { + APP_ERROR_HANDLER(p_event->data.error_communication); + } + else if (p_event->evt_type == APP_UART_FIFO_ERROR) + { + APP_ERROR_HANDLER(p_event->data.error_code); + } +} + +uint32_t log_uart_init() +{ + static bool initialized = false; + if (initialized) + { + return NRF_SUCCESS; + } + + uint32_t err_code; + const app_uart_comm_params_t comm_params = + { + RX_PIN_NUMBER, + TX_PIN_NUMBER, + RTS_PIN_NUMBER, + CTS_PIN_NUMBER, + APP_UART_FLOW_CONTROL_ENABLED, + false, + UART_BAUDRATE_BAUDRATE_Baud115200 + }; + + APP_UART_FIFO_INIT(&comm_params, + UART_RX_BUF_SIZE, + UART_TX_BUF_SIZE, + uart_error_cb, +#ifdef NRF51 + APP_IRQ_PRIORITY_LOW +#elif defined(NRF52) + APP_IRQ_PRIORITY_LOWEST +#endif + err_code); + + initialized = true; + + return err_code; +} + +//lint -save -e530 -e64 +void log_uart_printf(const char * format_msg, ...) +{ + va_list p_args; + va_start(p_args, format_msg); + (void)vprintf(format_msg, p_args); + va_end(p_args); +} + +__INLINE void log_uart_write_string_many(int num_args, ...) +{ + const char* msg; + va_list p_args; + va_start(p_args, num_args); + + for (int i = 0; i < num_args; i++) + { + msg = va_arg(p_args, const char*); + log_uart_write_string(msg); + } + va_end(p_args); +} + +__INLINE void log_uart_write_string(const char* msg) +{ + while( *msg ) + { + (void)app_uart_put(*msg++); + } +} +//lint -restore + +void log_uart_write_hex(uint32_t value) +{ + uint8_t nibble; + uint8_t i = 8; + + (void)app_uart_put('0'); + (void)app_uart_put('x'); + while( i-- != 0 ) + { + nibble = (value >> (4 * i)) & 0x0F; + (void)app_uart_put( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); + } +} + +void log_uart_write_hex_char(uint8_t c) +{ + uint8_t nibble; + uint8_t i = 2; + + while( i-- != 0 ) + { + nibble = (c >> (4 * i)) & 0x0F; + (void)app_uart_put( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); + } +} + +__INLINE int log_uart_has_input() +{ + if (m_uart_has_input) return 1; + if (app_uart_get(&m_uart_data) == NRF_SUCCESS) + { + m_uart_has_input = true; + return 1; + } + return 0; +} + +uint32_t log_uart_read_input(char * c) +{ + if (m_uart_has_input) + { + *c = (char)m_uart_data; + m_uart_has_input = false; + return NRF_SUCCESS; + } + if (app_uart_get((uint8_t *)c) == NRF_SUCCESS) + { + return NRF_SUCCESS; + } + return NRF_ERROR_NULL; +} + +#elif defined(NRF_LOG_USES_RAW_UART) && NRF_LOG_USES_RAW_UART == 1 + +#include "app_uart.h" +#include +#include +#include "bsp.h" + +uint32_t log_raw_uart_init() +{ + // Disable UART + NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Disabled; + + // Configure RX/TX pins + nrf_gpio_cfg_output( TX_PIN_NUMBER ); + nrf_gpio_cfg_input(RX_PIN_NUMBER, NRF_GPIO_PIN_NOPULL); + + // Set a default baud rate of UART0_CONFIG_BAUDRATE + NRF_UART0->PSELTXD = TX_PIN_NUMBER; + NRF_UART0->BAUDRATE = UART0_CONFIG_BAUDRATE; + + NRF_UART0->PSELRTS = 0xFFFFFFFF; + NRF_UART0->PSELCTS = 0xFFFFFFFF; + + // Disable parity and interrupt + NRF_UART0->CONFIG = (UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos ); + NRF_UART0->CONFIG |= (UART_CONFIG_HWFC_Disabled << UART_CONFIG_HWFC_Pos ); + + // Re-enable the UART + NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Enabled; + NRF_UART0->INTENSET = 0; + NRF_UART0->TASKS_STARTTX = 1; + NRF_UART0->TASKS_STARTRX = 1; + + return NRF_SUCCESS; +} + +void log_raw_uart_printf(const char * format_msg, ...) +{ + static char buffer[256]; + + va_list p_args; + va_start(p_args, format_msg); + sprintf(buffer, format_msg, p_args); + va_end(p_args); + + log_raw_uart_write_string(buffer); +} + +__INLINE void log_raw_uart_write_char(const char c) +{ + NRF_UART0->TXD = c; + while( NRF_UART0->EVENTS_TXDRDY != 1 ); + NRF_UART0->EVENTS_TXDRDY = 0; +} + +__INLINE void log_raw_uart_write_string_many(int num_args, ...) +{ + + const char* msg; + va_list p_args; + va_start(p_args, num_args); + + for (int i = 0; i < num_args; i++) + { + msg = va_arg(p_args, const char*); + log_raw_uart_write_string(msg); + } + va_end(p_args); +} + +__INLINE void log_raw_uart_write_string(const char* msg) +{ + while( *msg ) + { + NRF_UART0->TXD = *msg++; + while( NRF_UART0->EVENTS_TXDRDY != 1 ); + NRF_UART0->EVENTS_TXDRDY = 0; + } +} + +void log_raw_uart_write_hex(uint32_t value) +{ + uint8_t nibble; + uint8_t i = 8; + + log_raw_uart_write_string( "0x" ); + while( i-- != 0 ) + { + nibble = (value >> (4 * i)) & 0x0F; + log_raw_uart_write_char( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); + } +} + +void log_raw_uart_write_hex_char(uint8_t c) +{ + uint8_t nibble; + uint8_t i = 2; + + while( i-- != 0 ) + { + nibble = (c >> (4 * i)) & 0x0F; + log_raw_uart_write_hex( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); + } +} + +__INLINE int log_raw_uart_has_input() +{ + return 0; +} + +uint32_t log_raw_uart_read_input(char * c) +{ + return NRF_ERROR_NULL; +} + +#endif // NRF_LOG_USES_RAW_UART == 1 + + +const char* log_hex_char(const char c) +{ + static volatile char hex_string[3]; + hex_string[2] = 0; // Null termination + uint8_t nibble; + uint8_t i = 2; + while(i-- != 0) + { + nibble = (c >> (4 * i)) & 0x0F; + hex_string[1-i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); + } + return (const char*) hex_string; +} + +const char* log_hex(uint32_t value) +{ + static volatile char hex_string[11]; + hex_string[0] = '0'; + hex_string[1] = 'x'; + hex_string[10] = 0; + uint8_t nibble; + uint8_t i = 8; + + while(i-- != 0) + { + nibble = (value >> (4 * i)) & 0x0F; + hex_string[9-i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); + } + + return (const char*)hex_string; +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.h new file mode 100644 index 0000000000..2019e81b3b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.h @@ -0,0 +1,699 @@ +#ifndef NRF_LOG_H_ +#define NRF_LOG_H_ + +#ifndef DOXYGEN + +#include +#include +#include + +#ifndef NRF_LOG_USES_RTT +#define NRF_LOG_USES_RTT 0 +#endif + +#ifndef NRF_LOG_USES_UART +#define NRF_LOG_USES_UART 0 +#endif + +#ifndef NRF_LOG_USES_RAW_UART +#define NRF_LOG_USES_RAW_UART 0 +#endif + +#ifndef NRF_LOG_USES_COLORS + #define NRF_LOG_USES_COLORS 1 +#endif + +#if NRF_LOG_USES_COLORS == 1 + #define NRF_LOG_COLOR_DEFAULT "\x1B[0m" + #define NRF_LOG_COLOR_BLACK "\x1B[1;30m" + #define NRF_LOG_COLOR_RED "\x1B[1;31m" + #define NRF_LOG_COLOR_GREEN "\x1B[1;32m" + #define NRF_LOG_COLOR_YELLOW "\x1B[1;33m" + #define NRF_LOG_COLOR_BLUE "\x1B[1;34m" + #define NRF_LOG_COLOR_MAGENTA "\x1B[1;35m" + #define NRF_LOG_COLOR_CYAN "\x1B[1;36m" + #define NRF_LOG_COLOR_WHITE "\x1B[1;37m" +#else + #define NRF_LOG_COLOR_DEFAULT + #define NRF_LOG_COLOR_BLACK + #define NRF_LOG_COLOR_RED + #define NRF_LOG_COLOR_GREEN + #define NRF_LOG_COLOR_YELLOW + #define NRF_LOG_COLOR_BLUE + #define NRF_LOG_COLOR_MAGENTA + #define NRF_LOG_COLOR_CYAN + #define NRF_LOG_COLOR_WHITE +#endif + +#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 + +#define LOG_TERMINAL_NORMAL (0) +#define LOG_TERMINAL_ERROR (1) +#define LOG_TERMINAL_INPUT (0) + +/**@brief Function for initializing the SEGGER RTT logger. + * + * @details See segger.com + * for information about SEGGER Real Time Transfer (RTT). + * + * This function is available only when NRF_LOG_USES_RTT is defined as 1. + * + * @note Do not call this function directly. Use the macro @ref NRF_LOG_INIT instead. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR Otherwise. + */ +uint32_t log_rtt_init(void); + +/**@brief Function for writing a printf string using RTT. + * + * @details The printf implementation in SEGGER's RTT is more efficient than + * the standard implementation. However, printf requires more processor time + * than other logging functions. Therefore, applications that require logging + * but need it to interfere as little as possible with the execution, should + * avoid using printf. + * + * This function is available only when NRF_LOG_USES_RTT is defined as 1. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_PRINTF + * - @ref NRF_LOG_PRINTF_DEBUG + * - @ref NRF_LOG_PRINTF_ERROR + * + * @param terminal_index Segger RTT terminal index to use as output. + * @param format_msg Printf format string. + */ +void log_rtt_printf(int terminal_index, char * format_msg, ...); + +/**@brief Function for writing a string using RTT. + * + * @details The string to write must be null-terminated, but the null termination will not be stored + * in the ring buffer. + * The impact of running this function should be very low compared to writing to UART. + * + * This function is available only when NRF_LOG_USES_RTT is defined as 1. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG + * - @ref NRF_LOG_DEBUG + * - @ref NRF_LOG_ERROR + * + * @param terminal_index Segger RTT terminal index to use as output. + * @param num_args Number of arguments. + */ +void log_rtt_write_string(int terminal_index, int num_args, ...); + +/**@brief Function for writing an integer as HEX using RTT. + * + * The output data is formatted as, for example, 0x89ABCDEF. + * + * This function is available only when NRF_LOG_USES_RTT is defined as 1. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_HEX + * - @ref NRF_LOG_HEX_DEBUG + * - @ref NRF_LOG_HEX_ERROR + * + * @param terminal_index Segger RTT terminal index to use as output. + * @param value Integer value to be printed as HEX. + */ +void log_rtt_write_hex(int terminal_index, uint32_t value); + +/**@brief Function for writing a single character as HEX using RTT. + * + * The output string is formatted as, for example, AA. + * + * This function is available only when NRF_LOG_USES_RTT is defined as 1. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_HEX_CHAR + * - @ref NRF_LOG_HEX_CHAR_DEBUG + * - @ref NRF_LOG_HEX_CHAR_ERROR + * + * @param terminal_index Segger RTT terminal index to use as output. + * @param value Character to print as HEX. + */ +void log_rtt_write_hex_char(int terminal_index, uint8_t value); + +/**@brief Function for checking if data is available in the input buffer. + * + * This function is available only when NRF_LOG_USES_RTT is defined as 1. + * + * @note Do not call this function directly. Use @ref NRF_LOG_HAS_INPUT instead. + * + * @retval 1 If characters are available to read. + * @retval 0 If no characters are available. + */ +int log_rtt_has_input(void); + +/**@brief Function for reading one character from the input buffer. + * + * @param[out] p_char Pointer where to store the character. + * + * This function is available only when NRF_LOG_USES_RTT is defined as 1. + * + * @note Do not call this function directly. Use @ref NRF_LOG_READ_INPUT instead. + * + * @retval NRF_SUCCESS If the character was read out. + * @retval NRF_ERROR_INVALID_DATA If no character could be read. + */ +uint32_t log_rtt_read_input(char* p_char); + +#define NRF_LOG_INIT() log_rtt_init() /*!< Initialize the module. */ + +#define NRF_LOG_PRINTF(...) log_rtt_printf(LOG_TERMINAL_NORMAL, ##__VA_ARGS__) /*!< Print a log message using printf. */ +#define NRF_LOG_PRINTF_DEBUG(...) log_rtt_printf(LOG_TERMINAL_NORMAL, ##__VA_ARGS__) /*!< If DEBUG is set, print a log message using printf. */ +#define NRF_LOG_PRINTF_ERROR(...) log_rtt_printf(LOG_TERMINAL_ERROR, ##__VA_ARGS__) /*!< Print a log message using printf to the error stream. */ + +#define NRF_LOG(...) log_rtt_write_string(LOG_TERMINAL_NORMAL, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message. The input string must be null-terminated. */ +#define NRF_LOG_DEBUG(...) log_rtt_write_string(LOG_TERMINAL_NORMAL, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< If DEBUG is set, print a log message. The input string must be null-terminated. */ +#define NRF_LOG_ERROR(...) log_rtt_write_string(LOG_TERMINAL_ERROR, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message to the error stream. The input string must be null-terminated. */ + +#define NRF_LOG_HEX(val) log_rtt_write_hex(LOG_TERMINAL_NORMAL, val) /*!< Log an integer as HEX value (example output: 0x89ABCDEF). */ +#define NRF_LOG_HEX_DEBUG(val) log_rtt_write_hex(LOG_TERMINAL_NORMAL, val) /*!< If DEBUG is set, log an integer as HEX value (example output: 0x89ABCDEF). */ +#define NRF_LOG_HEX_ERROR(val) log_rtt_write_hex(LOG_TERMINAL_ERROR, val) /*!< Log an integer as HEX value to the error stream (example output: 0x89ABCDEF). */ + +#define NRF_LOG_HEX_CHAR(val) log_rtt_write_hex_char(LOG_TERMINAL_NORMAL, val) /*!< Log a character as HEX value (example output: AA). */ +#define NRF_LOG_HEX_CHAR_DEBUG(val) log_rtt_write_hex_char(LOG_TERMINAL_NORMAL, val) /*!< If DEBUG is set, log a character as HEX value (example output: AA). */ +#define NRF_LOG_HEX_CHAR_ERROR(val) log_rtt_write_hex_char(LOG_TERMINAL_ERROR, val) /*!< Log a character as HEX value to the error stream (example output: AA). */ + +#define NRF_LOG_HAS_INPUT() log_rtt_has_input() /*!< Check if the input buffer has unconsumed characters. */ +#define NRF_LOG_READ_INPUT(p_char) log_rtt_read_input(p_char) /*!< Consume a character from the input buffer. */ + +#if !defined(DEBUG) && !defined(DOXYGEN) + +#undef NRF_LOG_DEBUG +#define NRF_LOG_DEBUG(...) + +#undef NRF_LOG_STR_DEBUG +#define NRF_LOG_STR_DEBUG(...) + +#undef NRF_LOG_HEX_DEBUG +#define NRF_LOG_HEX_DEBUG(...) + +#undef NRF_LOG_HEX_CHAR_DEBUG +#define NRF_LOG_HEX_CHAR_DEBUG(...) + +#endif // !defined(DEBUG) && !defined(DOXYGEN) + +#elif defined(NRF_LOG_USES_UART) && NRF_LOG_USES_UART == 1 + +/**@brief Function for initializing the UART logger. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @note Do not call this function directly. Use the macro @ref NRF_LOG_INIT instead. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR Otherwise. + */ +uint32_t log_uart_init(void); + +/**@brief Function for logging a printf string to UART. + * + * @details Printf requires more processor time + * than other logging functions. Therefore, applications that require logging + * but need it to interfere as little as possible with the execution, should + * avoid using printf. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @note This function is non-blocking. If too much data is sent to the UART, + * some characters might be skipped. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_PRINTF + * - @ref NRF_LOG_PRINTF_DEBUG + * - @ref NRF_LOG_PRINTF_ERROR + * + * @param format_msg Printf format string. + */ +void log_uart_printf(const char * format_msg, ...); + +/**@brief Function for logging a single character to UART. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @param c Character. + */ +void log_uart_write_char(const char c); + +/**@brief Function for logging null-terminated strings to UART. + * + * @details This function is more efficient than using printf. + * The null termination will not be logged. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG + * - @ref NRF_LOG_DEBUG + * - @ref NRF_LOG_ERROR + * + * @param num_args Number of arguments. + */ +void log_uart_write_string_many(int num_args, ...); + + +/**@brief Function for logging a null-terminated string to UART. + * + * @details This function is more efficient than using printf. + * The null termination will not be logged. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG + * - @ref NRF_LOG_DEBUG + * - @ref NRF_LOG_ERROR + * + * @param msg Null-terminated string. + */ +void log_uart_write_string(const char* msg); + + +/**@brief Function for logging an integer value as HEX to UART. + * + * @details The output data is formatted as, for example, 0x89ABCDEF. + * This function is more efficient than printf. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @note This function is non-blocking. If too much data is sent to the UART, + * some characters might be skipped. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_HEX + * - @ref NRF_LOG_HEX_DEBUG + * - @ref NRF_LOG_HEX_ERROR + * + * @param value Integer value to be printed as HEX. + */ +void log_uart_write_hex(uint32_t value); + +/**@brief Function for logging a single character as HEX to UART. + * + * @details The output string is formatted as, for example, AA. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @note This function is non-blocking. If too much data is sent to the UART, + * some characters might be skipped. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_HEX_CHAR + * - @ref NRF_LOG_HEX_CHAR_DEBUG + * - @ref NRF_LOG_HEX_CHAR_ERROR + * + * @param c Character. + */ +void log_uart_write_hex_char(uint8_t c); + +/**@brief Function for checking if data is available in the input buffer. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @note Do not call this function directly. Use @ref NRF_LOG_HAS_INPUT instead. + * + * @retval 1 If characters are available to read. + * @retval 0 If no characters are available. + */ +int log_uart_has_input(void); + +/**@brief Function for reading one character from the input buffer. + * + * @param[out] p_char Pointer where to store the character. + * + * This function is available only when NRF_LOG_USES_UART is defined as 1. + * + * @note Do not call this function directly. Use NRF_LOG_READ_INPUT instead. + * + * @retval NRF_SUCCESS If the character was read out. + * @retval NRF_ERROR_INVALID_DATA If no character could be read. + */ +uint32_t log_uart_read_input(char* p_char); + + +#define NRF_LOG_INIT() log_uart_init() /*!< Initialize the module. */ + +#define NRF_LOG_PRINTF(...) log_uart_printf(__VA_ARGS__) /*!< Print a log message using printf. */ +#define NRF_LOG_PRINTF_DEBUG(...) log_uart_printf(__VA_ARGS__) /*!< If DEBUG is set, print a log message using printf. */ +#define NRF_LOG_PRINTF_ERROR(...) log_uart_printf(__VA_ARGS__) /*!< Print a log message using printf to the error stream. */ + +#define NRF_LOG(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message. The input string must be null-terminated. */ +#define NRF_LOG_DEBUG(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< If DEBUG is set, print a log message. The input string must be null-terminated. */ +#define NRF_LOG_ERROR(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message to the error stream. The input string must be null-terminated. */ + +#define NRF_LOG_HEX(val) log_uart_write_hex(val) /*!< Log an integer as HEX value (example output: 0x89ABCDEF). */ +#define NRF_LOG_HEX_DEBUG(val) log_uart_write_hex(val) /*!< If DEBUG is set, log an integer as HEX value (example output: 0x89ABCDEF). */ +#define NRF_LOG_HEX_ERROR(val) log_uart_write_hex(val) /*!< Log an integer as HEX value to the error stream (example output: 0x89ABCDEF). */ + +#define NRF_LOG_HEX_CHAR(val) log_uart_write_hex_char(val) /*!< Log a character as HEX value (example output: AA). */ +#define NRF_LOG_HEX_CHAR_DEBUG(val) log_uart_write_hex_char(val) /*!< If DEBUG is set, log a character as HEX value (example output: AA). */ +#define NRF_LOG_HEX_CHAR_ERROR(val) log_uart_write_hex_char(val) /*!< Log a character as HEX value to the error stream (example output: AA). */ + +#define NRF_LOG_HAS_INPUT() log_uart_has_input() /*!< Check if the input buffer has unconsumed characters. */ +#define NRF_LOG_READ_INPUT(p_char) log_uart_read_input(p_char) /*!< Consume a character from the input buffer. */ + +#if !defined(DEBUG) && !defined(DOXYGEN) + +#undef NRF_LOG_DEBUG +#define NRF_LOG_DEBUG(...) + +#undef NRF_LOG_PRINTF_DEBUG +#define NRF_LOG_PRINTF_DEBUG(...) + +#undef NRF_LOG_STR_DEBUG +#define NRF_LOG_STR_DEBUG(...) + +#undef NRF_LOG_HEX_DEBUG +#define NRF_LOG_HEX_DEBUG(...) + +#undef NRF_LOG_HEX_CHAR_DEBUG +#define NRF_LOG_HEX_CHAR_DEBUG(...) + +#endif // !defined(DEBUG) && !defined(DOXYGEN) + +#elif defined(NRF_LOG_USES_RAW_UART) && NRF_LOG_USES_RAW_UART == 1 + +/**@brief Function for initializing the raw UART logger. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @note Do not call this function directly. Use the macro @ref NRF_LOG_INIT instead. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR Otherwise. + */ +uint32_t log_raw_uart_init(void); + +/**@brief Function for logging a printf string to raw UART. + * + * @details Printf requires more processor time + * than other logging functions. Therefore, applications that require logging + * but need it to interfere as little as possible with the execution, should + * avoid using printf. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @note This function is non-blocking. If too much data is sent to the UART, + * some characters might be skipped. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_PRINTF + * - @ref NRF_LOG_PRINTF_DEBUG + * - @ref NRF_LOG_PRINTF_ERROR + * + * @param format_msg Printf format string. + */ +void log_raw_uart_printf(const char * format_msg, ...); + +/**@brief Function for logging a single character to raw UART. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @param c Character. + */ +void log_raw_uart_write_char(const char c); + +/**@brief Function for logging null-terminated strings to raw UART. + * + * @details This function is more efficient than using printf. + * The null termination will not be logged. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG + * - @ref NRF_LOG_DEBUG + * - @ref NRF_LOG_ERROR + * + * @param num_args Number of arguments. + */ +void log_raw_uart_write_string_many(int num_args, ...); + + +/**@brief Function for logging a null-terminated string to raw UART. + * + * @details This function is more efficient than using printf. + * The null termination will not be logged. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG + * - @ref NRF_LOG_DEBUG + * - @ref NRF_LOG_ERROR + * + * @param str Null-terminated string. + */ +void log_raw_uart_write_string(const char * str); + +/**@brief Function for logging an integer value as HEX to raw UART. + * + * @details The output data is formatted as, for example, 0x89ABCDEF. + * This function is more efficient than printf. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @note This function is non-blocking. If too much data is sent to the UART, + * some characters might be skipped. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_HEX + * - @ref NRF_LOG_HEX_DEBUG + * - @ref NRF_LOG_HEX_ERROR + * + * @param value Integer value to be printed as HEX. + */ +void log_raw_uart_write_hex(uint32_t value); + +/**@brief Function for logging a single character as HEX to raw UART. + * + * @details The output string is formatted as, for example, AA. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @note This function is non-blocking. If too much data is sent to the UART, + * some characters might be skipped. + * + * @note Do not call this function directly. Use one of the following macros instead: + * - @ref NRF_LOG_HEX_CHAR + * - @ref NRF_LOG_HEX_CHAR_DEBUG + * - @ref NRF_LOG_HEX_CHAR_ERROR + * + * @param c Character. + */ +void log_raw_uart_write_hex_char(uint8_t c); + +/**@brief Function for checking if data is available in the input buffer. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @note Do not call this function directly. Use @ref NRF_LOG_HAS_INPUT instead. + * + * @retval 1 If characters are available to read. + * @retval 0 If no characters are available. + */ +int log_raw_uart_has_input(void); + +/**@brief Function for reading one character from the input buffer. + * + * @param[out] p_char Pointer where to store the character. + * + * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. + * + * @note Do not call this function directly. Use NRF_LOG_READ_INPUT instead. + * + * @retval NRF_SUCCESS If the character was read out. + * @retval NRF_ERROR_INVALID_DATA If no character could be read. + */ + +uint32_t log_raw_uart_read_input(char* p_char); + +#define NRF_LOG_INIT() log_raw_uart_init() /*!< nitialize the module. */ + +#define NRF_LOG_PRINTF(...) log_raw_uart_printf(__VA_ARGS__) /*!< Print a log message using printf. */ +#define NRF_LOG_PRINTF_DEBUG(...) log_raw_uart_printf(__VA_ARGS__) /*!< If DEBUG is set, print a log message using printf. */ +#define NRF_LOG_PRINTF_ERROR(...) log_raw_uart_printf(__VA_ARGS__) /*!< Print a log message using printf to the error stream. */ + +#define NRF_LOG(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message. The input string must be null-terminated. */ +#define NRF_LOG_DEBUG(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< If DEBUG is set, print a log message. The input string must be null-terminated. */ +#define NRF_LOG_ERROR(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message to the error stream. The input string must be null-terminated. */ + +#define NRF_LOG_HEX(val) log_raw_uart_write_hex(val) /*!< Log an integer as HEX value (example output: 0x89ABCDEF). */ +#define NRF_LOG_HEX_DEBUG(val) log_raw_uart_write_hex(val) /*!< If DEBUG is set, log an integer as HEX value (example output: 0x89ABCDEF). */ +#define NRF_LOG_HEX_ERROR(val) log_raw_uart_write_hex(val) /*!< Log an integer as HEX value to the error stream (example output: 0x89ABCDEF). */ + +#define NRF_LOG_HEX_CHAR(val) log_raw_uart_write_hex_char(val) /*!< Log a character as HEX value (example output: AA). */ +#define NRF_LOG_HEX_CHAR_DEBUG(val) log_raw_uart_write_hex_char(val) /*!< If DEBUG is set, log a character as HEX value (example output: AA). */ +#define NRF_LOG_HEX_CHAR_ERROR(val) log_raw_uart_write_hex_char(val) /*!< Log a character as HEX value to the error stream (example output: AA). */ + +#define NRF_LOG_HAS_INPUT() log_raw_uart_has_input() /*!< Check if the input buffer has unconsumed characters. */ +#define NRF_LOG_READ_INPUT(p_char) log_raw_uart_read_input(p_char) /*!< Consume a character from the input buffer. */ + +#if !defined(DEBUG) && !defined(DOXYGEN) + +#undef NRF_LOG_DEBUG +#define NRF_LOG_DEBUG(...) + +#undef NRF_LOG_PRINTF_DEBUG +#define NRF_LOG_PRINTF_DEBUG(...) + +#undef NRF_LOG_STR_DEBUG +#define NRF_LOG_STR_DEBUG(...) + +#undef NRF_LOG_HEX_DEBUG +#define NRF_LOG_HEX_DEBUG(...) + +#undef NRF_LOG_HEX_CHAR_DEBUG +#define NRF_LOG_HEX_CHAR_DEBUG(...) + +#endif // !defined(DEBUG) && !defined(DOXYGEN) + +#else + +#include "nrf_error.h" +#include "nordic_common.h" + +// Empty definitions + +#define NRF_LOG_INIT() NRF_SUCCESS +#define NRF_LOG(...) +#define NRF_LOG_DEBUG(...) +#define NRF_LOG_ERROR(...) + +#define NRF_LOG_PRINTF(...) +#define NRF_LOG_PRINTF_DEBUG(...) +#define NRF_LOG_PRINTF_ERROR(...) + +#define NRF_LOG_HEX(val) +#define NRF_LOG_HEX_DEBUG(val) +#define NRF_LOG_HEX_ERROR(val) + +#define NRF_LOG_HEX_CHAR(val) +#define NRF_LOG_HEX_CHAR_DEBUG(val) +#define NRF_LOG_HEX_CHAR_ERROR(val) + +#define NRF_LOG_HAS_INPUT() 0 +#define NRF_LOG_READ_INPUT(ignore) NRF_SUCCESS + +#endif + +/**@brief Function for writing HEX values. + * + * @note This function not thread-safe. It is written for convenience. + * If you log from different application contexts, you might get different results. + * + * @retval NULL By default. + */ +const char* log_hex(uint32_t value); + +/**@brief Function for writing HEX characters. + * + * @note This function not thread-safe. It is written for convenience. + * If you log from different application contexts, you might get different results. + * + * @retval NULL By default. + */ +const char* log_hex_char(const char value); + + + + +#else // DOXYGEN + +/** @defgroup nrf_log UART/RTT logging + * @{ + * @ingroup app_common + * + * @brief Library to output logging information over SEGGER's Real Time Transfer + * (RTT), UART, or raw UART. + * + * This library provides macros that call the respective functions depending on + * which protocol is used. Define LOG_USES_RTT=1 to enable logging over RTT, + * NRF_LOG_USES_UART=1 to enable logging over UART, or NRF_LOG_USES_RAW_UART=1 + * to enable logging over raw UART. One of these defines must be set for any of + * the macros to have effect. If you choose to not output information, all + * logging macros can be left in the code without any cost; they will just be + * ignored. + */ + + + +/**@brief Macro for initializing the logger. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR Otherwise. + */ +uint32_t NRF_LOG_INIT(void); + +/**@brief Macro for logging null-terminated strings. + * + * @details This function is more efficient than using printf. + * The null termination will not be logged. + * + * @param msg Null-terminated string. + */ +void NRF_LOG(const char* msg); + +/**@brief Macro for logging a printf string. + * + * @details Printf requires more processor time + * than other logging functions. Therefore, applications that require logging + * but need it to interfere as little as possible with the execution, should + * avoid using printf. + * + * @note When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. + * If too much data is sent, some characters might be skipped. + * + * @param format_msg Printf format string. + * @param ... Additional arguments replacing format specifiers in format_msg. + */ +void NRF_LOG_PRINTF(const char * format_msg, ...); + +/**@brief Macro for logging an integer value as HEX. + * + * @details The output data is formatted as, for example, 0x89ABCDEF. + * This function is more efficient than printf. + * + * @note When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. + * If too much data is sent, some characters might be skipped. + * + * @param value Integer value to be printed as HEX. + */ +void NRF_LOG_HEX(uint32_t value); + +/**@brief Macro for logging a single character as HEX. + * + * @details The output string is formatted as, for example, AA. + * + * @note When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. + * If too much data is sent, some characters might be skipped. + * + * @param c Character. + */ +void NRF_LOG_HEX_CHAR(uint8_t c); + +/**@brief Macro for checking if data is available in the input buffer. + * + * @note When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. + * If too much data is sent, some characters might be skipped. + * + * @retval 1 If characters are available to read. + * @retval 0 If no characters are available. + */ +int NRF_LOG_HAS_INPUT(void); + +/**@brief Macro for reading one character from the input buffer. + * + * @param[out] p_char Pointer where to store the character. + * + * @retval NRF_SUCCESS If the character was read out. + * @retval NRF_ERROR_INVALID_DATA If no character could be read. + */ +uint32_t NRF_LOG_READ_INPUT(char* p_char); + +/** @} */ +#endif // DOXYGEN +#endif // NRF_LOG_H_ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_common.h new file mode 100644 index 0000000000..f7e8302973 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_common.h @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @cond */ +/**@file + * + * @ingroup experimental_api + * @defgroup sdk_common SDK Common Header + * @breif All common headers needed for SDK examples will be included here so that application + * developer does not have to include headers on him/herself. + * @{ + */ + +#ifndef SDK_COMMON_H__ +#define SDK_COMMON_H__ + +#include +#include +#include +#include "nordic_common.h" +#include "compiler_abstraction.h" +#include "sdk_os.h" +#include "sdk_errors.h" +#include "app_util.h" + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * if not. + * + * @param[in] param The variable to check if is NULL. + */ +#ifndef DISABLE_PARAM_CHECK +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) +#else +#define VERIFY_PARAM_NOT_NULL() +#endif /* DISABLE_PARAM_CHECK */ + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * if not. + * + * @param[in] param The variable to check if is NULL. + */ +#ifndef DISABLE_PARAM_CHECK +#define VERIFY_PARAM_NOT_NULL_VOID(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return; \ + } \ +} while(0) +#else +#define VERIFY_PARAM_NOT_NULL_VOID() +#endif /* DISABLE_PARAM_CHECK */ + + +/**@brief Macro for verifying that a function returned NRF_SUCCESS. Will return the err code + * if not. + * + * @param[in] err_code The error code to check. + */ +#ifndef DISABLE_PARAM_CHECK +#define VERIFY_SUCCESS(err_code) \ +do \ +{ \ + if (err_code != NRF_SUCCESS) \ + { \ + return err_code; \ + } \ +} while(0) +#else +#define VERIFY_SUCCESS() +#endif /* DISABLE_PARAM_CHECK */ + + +/**@brief Macro for verifying that a function returned NRF_SUCCESS. Will return if not. + * + * @param[in] err_code The error code to check. + */ +#ifndef DISABLE_PARAM_CHECK +#define VERIFY_SUCCESS_VOID(err_code) \ +do \ +{ \ + if (err_code != NRF_SUCCESS) \ + { \ + return; \ + } \ +} while(0) +#else +#define VERIFY_SUCCESS_VOID() +#endif /* DISABLE_PARAM_CHECK */ + + +/**@brief Macro for verifying statement to be true. Will return err_code if not. +* +* @param[in] statement Statement to test. +* @param[in] err_code Error value to return if test was invalid. +* +* @retval err_code if test fails. +*/ +#define VERIFY_TRUE(statement, err_code) \ +do \ +{ \ + if (!(statement)) \ + { \ + return err_code; \ + } \ +} while(0) + + +/**@brief Macro for verifying statement to be true. Will return if not. +* +* @param[in] statement Statement to test. +*/ +#define VERIFY_TRUE_VOID(statement) \ +do \ +{ \ + if (!(statement)) \ + { \ + return; \ + } \ +} while(0) + + +/**@brief Macro for verifying statement to be false. Will return err_code if not. +* +* @param[in] statement Statement to test. +* @param[in] err_code Error value to return if test was invalid. +* +* @retval err_code if test fails. +*/ +#define VERIFY_FALSE(statement, err_code) \ +do \ +{ \ + if ((statement)) \ + { \ + return err_code; \ + } \ +} while(0) + + +/**@brief Macro for verifying statement to be false. Will return if not. +* +* @param[in] statement Statement to test. +*/ +#define VERIFY_FALSE_VOID(statement) \ +do \ +{ \ + if ((statement)) \ + { \ + return; \ + } \ +} while(0) + +/** @} */ +/** @endcond */ +#endif // SDK_COMMON_H__ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_errors.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_errors.h new file mode 100644 index 0000000000..dc7ef99ae4 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_errors.h @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup sdk_error SDK Error codes + * @{ + * @ingroup app_common + * @{ + * @details Error codes are 32-bit unsigned integers with the most significant 16-bit reserved for + * identifying the module where the error occurred while the least least significant LSB + * are used to provide the cause or nature of error. Each module is assigned a 16-bit + * unsigned integer. Which it will use to identify all errors that occurred in it. 16-bit + * LSB range is with module id as the MSB in the 32-bit error code is reserved for the + * module. As an example, if 0x8800 identifies a certain SDK module, all values from + * 0x88000000 - 0x8800FFFF are reserved for this module. + * It should be noted that common error reasons have been assigned values to make it + * possible to decode error reason easily. As an example, lets module uninitialized has + * been assigned an error code 0x000A0. Then, if application encounters an error code + * 0xZZZZ00A0, it knows that it accessing a certain module without initializing it. + * Apart from this, each module is allowed to define error codes that are not covered by + * the common ones, however, these values are defined in a range that does not conflict + * with common error values. For module, specific error however, it is possible that the + * same error value is used by two different modules to indicated errors of very different + * nature. If error is already defined by the NRF common error codes, these are reused. + * A range is reserved for application as well, it can use this range for defining + * application specific errors. + * + * @note Success code, NRF_SUCCESS, does not include any module identifier. + + */ + +#ifndef SDK_ERRORS_H__ +#define SDK_ERRORS_H__ + +#include +#include "nrf_error.h" + +/** + * @defgroup sdk_err_base Base defined for SDK Modules + * @{ + */ +#define SDK_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x8000) /**< Base value defined for SDK module identifiers. */ +#define SDK_COMMON_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x0080) /**< Base error value to be used for SDK error values. */ +/* @} */ + +/** + * @defgroup sdk_module_codes Codes reserved as identification for module where the error occurred. + * @{ + */ +#define DEVICE_MANAGER_ERR_BASE (0x8000) +#define MEMORY_MANAGER_ERR_BASE (0x8100) +/* @} */ + + +/** + * @defgroup sdk_iot_errors Codes reserved as identification for IoT errors. + * @{ + */ +#define IOT_ERR_BASE_START (0xA000) +#define IOT_ERR_BASE_STOP (0xAFFF) +/* @} */ + + +/** + * @defgroup sdk_common_errors Codes reserved as identification for common errors. + * @{ + */ +#define MODULE_NOT_INITIALZED (SDK_COMMON_ERROR_BASE + 0x0000) +#define MUTEX_INIT_FAILED (SDK_COMMON_ERROR_BASE + 0x0001) +#define MUTEX_LOCK_FAILED (SDK_COMMON_ERROR_BASE + 0x0002) +#define MUTEX_UNLOCK_FAILED (SDK_COMMON_ERROR_BASE + 0x0003) +#define MUTEX_COND_INIT_FAILED (SDK_COMMON_ERROR_BASE + 0x0004) +#define MODULE_ALREADY_INITIALIZED (SDK_COMMON_ERROR_BASE + 0x0005) +#define API_NOT_IMPLEMENTED (SDK_COMMON_ERROR_BASE + 0x0010) +#define FEATURE_NOT_ENABLED (SDK_COMMON_ERROR_BASE + 0x0011) +/* @} */ + + +/** + * @defgroup dm_specific_errors Error / status codes specific to device manager. + * @{ + */ +#define DM_NO_APP_CONTEXT (DEVICE_MANAGER_ERR_BASE + 0x0040) +#define DM_SERVICE_CONTEXT_NOT_APPLIED (DEVICE_MANAGER_ERR_BASE + 0x0041) +#define DM_CONTEXT_INFO_LOST (DEVICE_MANAGER_ERR_BASE + 0x0042) +#define DM_DEVICE_CONTEXT_FULL (DEVICE_MANAGER_ERR_BASE + 0x0043) +/* @} */ + +/** + * @brief API Result. + * + * @details Indicates success or failure of an API procedure. In case of failure, a comprehensive + * error code indicating cause or reason for failure is provided. + * + * Though called an API result, it could used in Asynchronous notifications callback along + * with asynchronous callback as event result. This mechanism is employed when an event + * marks the end of procedure initiated using API. API result, in this case, will only be + * an indicative of whether the procedure has been requested successfully. + */ +typedef uint32_t ret_code_t; +/** @} */ +/** @} */ + +#endif // SDK_ERRORS_H__ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_macros.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_macros.h new file mode 100644 index 0000000000..166073e579 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_macros.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @cond */ +/**@file + * + * @ingroup sdk_util + * @defgroup sdk_common_macros SDK Common Header + * @breif Macros for parameter checking and similar tasks + * @{ + */ + +#ifndef SDK_MACROS_H__ +#define SDK_MACROS_H__ + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * @ref NRF_ERROR_INVALID_STATE if not. + */ +#ifdef DISABLE_PARAM_CHECK +#define VERIFY_MODULE_INITIALIZED() +#else +#ifdef MODULE_INITIALIZED +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) +#else +#define VERIFY_MODULE_INITIALIZED() +#endif /* MODULE_INITIALIZED */ +#endif /* DISABLE_PARAM_CHECK */ + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * if not. + */ +#ifdef DISABLE_PARAM_CHECK +#define VERIFY_MODULE_INITIALIZED_VOID() +#else +#ifdef MODULE_INITIALIZED +#define VERIFY_MODULE_INITIALIZED_VOID() \ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return; \ + } \ +} while(0) +#else +#define VERIFY_MODULE_INITIALIZED_VOID() +#endif /* MODULE_INITIALIZED */ +#endif /* DISABLE_PARAM_CHECK */ + + + + +/** @} */ +/** @endcond */ +#endif // SDK_MACROS_H__ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.c new file mode 100644 index 0000000000..c92dbc973f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.c @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sdk_mapped_flags.h" +#include +#include +#include +#include "compiler_abstraction.h" + + +/**@brief Function for setting the state of a flag to true. + * + * @note This function does not check whether the index is valid. + * + * @param[in] p_flags The collection of flags to modify. + * @param[in] index The index of the flag to modify. + */ +static __INLINE void sdk_mapped_flags_set_by_index(sdk_mapped_flags_t * p_flags, uint16_t index) +{ + *p_flags |= (1U << index); +} + + +/**@brief Function for setting the state of a flag to false. + * + * @note This function does not check whether the index is valid. + * + * @param[in] p_flags The collection of flags to modify. + * @param[in] index The index of the flag to modify. + */ +static __INLINE void sdk_mapped_flags_clear_by_index(sdk_mapped_flags_t * p_flags, uint16_t index) +{ + *p_flags &= ~(1U << index); +} + + +/**@brief Function for getting the state of a flag. + * + * @note This function does not check whether the index is valid. + * + * @param[in] p_flags The collection of flags to read. + * @param[in] index The index of the flag to get. + */ +static __INLINE bool sdk_mapped_flags_get_by_index(sdk_mapped_flags_t flags, uint16_t index) +{ + return ((flags & (1 << index)) != 0); +} + + + +uint16_t sdk_mapped_flags_first_key_index_get(sdk_mapped_flags_t flags) +{ + for (uint16_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++) + { + if (sdk_mapped_flags_get_by_index(flags, i)) + { + return i; + } + } + return SDK_MAPPED_FLAGS_INVALID_INDEX; +} + + +void sdk_mapped_flags_update_by_key(uint16_t * p_keys, + sdk_mapped_flags_t * p_flags, + uint16_t key, + bool value) +{ + sdk_mapped_flags_bulk_update_by_key(p_keys, p_flags, 1, key, value); +} + + +void sdk_mapped_flags_bulk_update_by_key(uint16_t * p_keys, + sdk_mapped_flags_t * p_flags, + uint32_t n_flag_collections, + uint16_t key, + bool value) +{ + if ((p_keys != NULL) && (p_flags != NULL) && (n_flag_collections > 0)) + { + for (uint32_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++) + { + if (p_keys[i] == key) + { + for (uint32_t j = 0; j < n_flag_collections; j++) + { + if (value) + { + sdk_mapped_flags_set_by_index(&p_flags[j], i); + } + else + { + sdk_mapped_flags_clear_by_index(&p_flags[j], i); + } + } + return; + } + } + } +} + + +bool sdk_mapped_flags_get_by_key(uint16_t * p_keys, sdk_mapped_flags_t flags, uint16_t key) +{ + if (p_keys != NULL) + { + for (uint32_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++) + { + if (p_keys[i] == key) + { + return sdk_mapped_flags_get_by_index(flags, i); + } + } + } + return false; +} + + +sdk_mapped_flags_key_list_t sdk_mapped_flags_key_list_get(uint16_t * p_keys, + sdk_mapped_flags_t flags) +{ + sdk_mapped_flags_key_list_t key_list; + key_list.len = 0; + + if (p_keys != NULL) + { + for (uint32_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++) + { + if (sdk_mapped_flags_get_by_index(flags, i)) + { + key_list.flag_keys[key_list.len++] = p_keys[i]; + } + } + } + + return key_list; +} + + +uint32_t sdk_mapped_flags_n_flags_set(sdk_mapped_flags_t flags) +{ + uint32_t n_flags_set = 0; + + for (uint32_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++) + { + if (sdk_mapped_flags_get_by_index(flags, i)) + { + n_flags_set += 1; + } + } + return n_flags_set; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.h new file mode 100644 index 0000000000..780a9b61e3 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.h @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef SDK_MAPPED_FLAGS_H__ +#define SDK_MAPPED_FLAGS_H__ + +#include +#include +#include "app_util.h" +#include "compiler_abstraction.h" + +/** + * @file + * @defgroup sdk_mapped_flags Mapped flags + * @ingroup app_common + * @{ + * @brief Module for writing and reading flags that are associated + * with keys. + * + * @details The flags are represented as bits in a bitmap called a flag collection. The keys + * are uint16_t. Each flag collection contains all flags of the same type, one flag for + * each key. + * + * The mapped flags module does not keep the flag states, nor the list of keys. These are + * provided in the API calls. A key's index in the key list determines which bit in the + * flag collection is associated with it. This module does not ever edit the key list, and + * does not edit flags except in function calls that take the flag collection as a pointer. + * + */ + +#define SDK_MAPPED_FLAGS_N_KEYS 8 /**< The number of keys to keep flags for. This is also the number of flags in a flag collection. If changing this value, you might also need change the width of the sdk_mapped_flags_t type. */ +#define SDK_MAPPED_FLAGS_N_KEYS_PER_BYTE 8 /**< The number of flags that fit in one byte. */ +#define SDK_MAPPED_FLAGS_INVALID_INDEX 0xFFFF /**< A flag index guaranteed to be invalid. */ + +typedef uint8_t sdk_mapped_flags_t; /**< The bitmap to hold flags. Each flag is one bit, and each bit represents the flag state associated with one key. */ + + +// Test whether the flag collection type is large enough to hold all the flags. If this fails, +// reduce SDK_MAPPED_FLAGS_N_KEYS or increase the size of sdk_mapped_flags_t. +STATIC_ASSERT(( + sizeof(sdk_mapped_flags_t)*SDK_MAPPED_FLAGS_N_KEYS_PER_BYTE) >= SDK_MAPPED_FLAGS_N_KEYS); + + +/**@brief Type used to present a subset of the registered keys. + */ +typedef struct +{ + uint32_t len; /**< The length of the list. */ + uint16_t flag_keys[SDK_MAPPED_FLAGS_N_KEYS]; /**< The list of keys. */ +} sdk_mapped_flags_key_list_t; + + +/**@brief Function for getting the first index at which the flag is true in the provided + * collection. + * + * @param[in] flags The flag collection to search for a flag set to true. + * + * @return The first index that has its flag set to true. If none were found, the + * function returns @ref SDK_MAPPED_FLAGS_INVALID_INDEX. + */ +uint16_t sdk_mapped_flags_first_key_index_get(sdk_mapped_flags_t flags); + + +/**@brief Function for updating the state of a flag. + * + * @param[in] p_keys The list of associated keys (assumed to have a length of + * @ref SDK_MAPPED_FLAGS_N_KEYS). + * @param[out] p_flags The flag collection to modify. + * @param[in] key The key to modify the flag of. + * @param[in] value The state to set the flag to. + */ +void sdk_mapped_flags_update_by_key(uint16_t * p_keys, + sdk_mapped_flags_t * p_flags, + uint16_t key, + bool value); + + +/**@brief Function for updating the state of the same flag in multiple flag collections. + * + * @details The key and value are the same for all flag collections in the p_flags array. + * + * @param[in] p_keys The list of associated keys (assumed to have a length of + * @ref SDK_MAPPED_FLAGS_N_KEYS). + * @param[out] p_flags The flag collections to modify. + * @param[out] n_flag_collections The number of flag collections in p_flags. + * @param[in] key The key to modify the flag of. + * @param[in] value The state to set the flag to. + */ +void sdk_mapped_flags_bulk_update_by_key(uint16_t * p_keys, + sdk_mapped_flags_t * p_flags, + uint32_t n_flag_collections, + uint16_t key, + bool value); + + +/**@brief Function for getting the state of a specific flag. + * + * @param[in] p_keys The list of associated keys (assumed to have a length of + * @ref SDK_MAPPED_FLAGS_N_KEYS). + * @param[in] flags The flag collection to read from. + * @param[in] key The key to get the flag for. + * + * @return The state of the flag. + */ +bool sdk_mapped_flags_get_by_key(uint16_t * p_keys, sdk_mapped_flags_t flags, uint16_t key); + + +/**@brief Function for getting a list of all keys that have a specific flag set to true. + * + * @param[in] p_keys The list of associated keys (assumed to have a length of + * @ref SDK_MAPPED_FLAGS_N_KEYS). + * @param[in] flags The flag collection to search. + * + * @return The list of keys. + */ +sdk_mapped_flags_key_list_t sdk_mapped_flags_key_list_get(uint16_t * p_keys, + sdk_mapped_flags_t flags); + + +/**@brief Function for getting the number of keys that have a specific flag set to true. + * + * @param[in] flags The flag collection to search. + * + * @return The number of keys. + */ +uint32_t sdk_mapped_flags_n_flags_set(sdk_mapped_flags_t flags); + + +/**@brief Function for querying whether any flags in the collection are set. + * + * @param[in] flags The flag collection to query. + * + * @retval true If one or more flags are set to true. + * @retval false Otherwise. + */ +static __INLINE bool sdk_mapped_flags_any_set(sdk_mapped_flags_t flags) +{ + return (flags != 0); +} + + +/** @} */ + +#endif /* SDK_MAPPED_FLAGS_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_os.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_os.h new file mode 100644 index 0000000000..760822ff35 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_os.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + /** @cond */ +/**@file + * + * @defgroup sdk_os SDK OS Abstraction + * @ingroup experimental_api + * @details In order to made SDK modules independent of use of an embedded OS, and permit + * application with varied task architecture, SDK abstracts the OS specific + * elements here in order to make all other modules agnostic to the OS or task + * architecture. + * @{ + */ + +#ifndef SDK_OS_H__ +#define SDK_OS_H__ + +#define SDK_MUTEX_DEFINE(X) +#define SDK_MUTEX_INIT(X) +#define SDK_MUTEX_LOCK(X) +#define SDK_MUTEX_UNLOCK(X) + +/** + * @defgroup os_data_type Data types. + */ + +/** @} */ +/** @endcond */ +#endif // SDK_OS_H__ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_resources.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_resources.h new file mode 100644 index 0000000000..27b0863856 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_resources.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * @brief Definition file for resource usage by SoftDevice, ESB and Gazell. + */ + +#ifndef APP_RESOURCES_H__ +#define APP_RESOURCES_H__ + +#ifdef SOFTDEVICE_PRESENT + #include "nrf_sd_def.h" +#else + #define SD_PPI_RESTRICTED 0uL /**< 1 if PPI peripheral is restricted, 0 otherwise. */ + #define SD_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by SotfDevice (not available to th spplication). */ + #define SD_PPI_GROUPS_USED 0uL /**< PPI groups utilized by SotfDevice (not available to th spplication). */ + #define SD_TIMERS_USED 0uL /**< Timers used by SoftDevice. */ + #define SD_SWI_USED 0uL /**< Software interrupts used by SoftDevice. */ +#endif + +#ifdef GAZELL_PRESENT + #include "nrf_gzll_resources.h" +#else + #define GZLL_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by Gazell (not available to th spplication). */ + #define GZLL_TIMERS_USED 0uL /**< Timers used by Gazell. */ + #define GZLL_SWI_USED 0uL /**< Software interrupts used by Gazell */ +#endif + +#ifdef ESB_PRESENT + #include "nrf_esb_resources.h" +#else + #define ESB_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by ESB (not available to th spplication). */ + #define ESB_TIMERS_USED 0uL /**< Timers used by ESB. */ + #define ESB_SWI_USED 0uL /**< Software interrupts used by ESB */ +#endif + +#define NRF_PPI_CHANNELS_USED (SD_PPI_CHANNELS_USED | GZLL_PPI_CHANNELS_USED | ESB_PPI_CHANNELS_USED) +#define NRF_PPI_GROUPS_USED (SD_PPI_GROUPS_USED) +#define NRF_SWI_USED (SD_SWI_USED | GZLL_SWI_USED | ESB_SWI_USED) +#define NRF_TIMERS_USED (SD_TIMERS_USED | GZLL_TIMERS_USED | ESB_TIMERS_USED) + +#endif // APP_RESOURCES_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ant_stack_handler_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ant_stack_handler_types.h new file mode 100644 index 0000000000..a74ed1800d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ant_stack_handler_types.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup ant_stack_handler_types Types definitions for ANT support in SoftDevice handler. + * @{ + * @ingroup softdevice_handler + * @brief This file contains the declarations of types required for ANT stack support. These + * types will be defined when the preprocessor define ANT_STACK_SUPPORT_REQD is defined. + */ + +#ifndef ANT_STACK_HANDLER_TYPES_H__ +#define ANT_STACK_HANDLER_TYPES_H__ + +#ifdef ANT_STACK_SUPPORT_REQD + +#include + +#define ANT_STACK_EVT_MSG_BUF_SIZE 32 /**< Size of ANT event message buffer. This will be provided to the SoftDevice while fetching an event. */ +#define ANT_STACK_EVT_STRUCT_SIZE (sizeof(ant_evt_t)) /**< Size of the @ref ant_evt_t structure. This will be used by the @ref softdevice_handler to internal event buffer size needed. */ + +/**@brief ANT stack event type. */ +typedef struct +{ + union + { + uint32_t ulForceAlign; ///< force the evt_buffer to be 4-byte aligned, required for some casting to ANT_MESSAGE. + uint8_t evt_buffer[ANT_STACK_EVT_MSG_BUF_SIZE]; ///< Event message buffer. + } msg; + uint8_t channel; ///< Channel number. + uint8_t event; ///< Event code. +} ant_evt_t; + +/**@brief Application ANT stack event handler type. */ +typedef void (*ant_evt_handler_t) (ant_evt_t * p_ant_evt); + +/**@brief Function for registering for ANT events. + * + * @details The application should use this function to register for receiving ANT events from + * the SoftDevice. If the application does not call this function, then any ANT event + * that may be generated by the SoftDevice will NOT be fetched. Once the application has + * registered for the events, it is not possible to possible to cancel the registration. + * However, it is possible to register a different function for handling the events at + * any point of time. + * + * @param[in] ant_evt_handler Function to be called for each received ANT event. + * + * @retval NRF_SUCCESS Successful registration. + * @retval NRF_ERROR_NULL Null pointer provided as input. + */ +uint32_t softdevice_ant_evt_handler_set(ant_evt_handler_t ant_evt_handler); + +#else + +// The ANT Stack support is not required. + +#define ANT_STACK_EVT_STRUCT_SIZE 0 /**< Since the ANT stack support is not required, this is equated to 0, so that the @ref softdevice_handler.h can compute the internal event buffer size without having to care for ANT events.*/ + +#endif // ANT_STACK_SUPPORT_REQD + +#endif // ANT_STACK_HANDLER_TYPES_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/app_ram_base.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/app_ram_base.h new file mode 100644 index 0000000000..5722bfd97b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/app_ram_base.h @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// ble_enable param app_ram_base + +#define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20001870 +#define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20001870 +#define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20001fe8 +#define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20001fe8 +#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20001ce0 +#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20001c98 +#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20001eb0 +#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20001e68 +#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20002418 +#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x200023d0 +#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x200025e0 +#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x200025a0 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20002110 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20002080 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x200022d8 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20002250 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x200024a8 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20002418 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20002840 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x200027b8 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20002a10 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20002980 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20002bd8 +#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20002b50 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20002538 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20002468 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20002708 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20002638 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x200028d0 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20002800 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20002aa0 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x200029d0 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20002c70 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20002ba0 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20002e40 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20002d68 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003008 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20002f38 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x200031d8 +#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x20003100 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20002968 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20002850 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20002b30 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20002a18 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20002d00 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20002be8 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20002ec8 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20002db0 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x20003098 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20002f80 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x200030a0 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20002f88 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003268 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20003150 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003438 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20003320 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x20003600 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x200034e8 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x200037d0 +#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_4_LOW_BW 0x200036b8 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20002d98 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20002c38 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20002f60 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20002e00 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20003130 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20002fd0 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x200032f8 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20003198 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x200034c8 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20003368 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_5_MID_BW 0x20003690 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_5_LOW_BW 0x20003530 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x200034c8 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20003370 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003698 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20003538 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003860 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20003708 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x20003a30 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x200038d0 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x20003bf8 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_4_LOW_BW 0x20003aa0 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_5_MID_BW 0x20003dc8 +#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_5_LOW_BW 0x20003c68 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x200031c0 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20003020 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20003390 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x200031e8 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20003558 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x200033b8 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20003728 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20003580 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x200038f0 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20003750 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_5_MID_BW 0x20003ac0 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_5_LOW_BW 0x20003918 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_6_MID_BW 0x20003c88 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_6_LOW_BW 0x20003ae8 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x200038f8 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20003750 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003ac0 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20003920 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003c90 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20003ae8 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x20003e58 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x20003cb8 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x20004028 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_4_LOW_BW 0x20003e80 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_5_MID_BW 0x200041f0 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_5_LOW_BW 0x20004050 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_6_MID_BW 0x200043c0 +#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_6_LOW_BW 0x20004218 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x200035f0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20003408 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x200037b8 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x200035d0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20003988 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x200037a0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20003b50 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20003968 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x20003d20 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20003b38 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_5_MID_BW 0x20003ee8 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_5_LOW_BW 0x20003d00 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_6_MID_BW 0x200040b8 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_6_LOW_BW 0x20003ed0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_7_MID_BW 0x20004280 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_7_LOW_BW 0x20004098 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20003d28 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20003b38 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003ef0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20003d08 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x200040c0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20003ed0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x20004288 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x200040a0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x20004458 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_4_LOW_BW 0x20004268 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_5_MID_BW 0x20004620 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_5_LOW_BW 0x20004438 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_6_MID_BW 0x200047f0 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_6_LOW_BW 0x20004600 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_7_MID_BW 0x200049b8 +#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_7_LOW_BW 0x200047d0 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20003a18 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x200037e8 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20003be8 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x200039b8 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20003db0 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20003b80 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20003f80 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20003d50 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x20004148 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20003f18 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_5_MID_BW 0x20004318 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_5_LOW_BW 0x200040e8 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_6_MID_BW 0x200044e0 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_6_LOW_BW 0x200042b0 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_7_MID_BW 0x200046b0 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_7_LOW_BW 0x20004480 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_8_MID_BW 0x20004878 +#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_8_LOW_BW 0x20004648 diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h new file mode 100644 index 0000000000..f40e4576e2 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/**@file + * + * @defgroup ble_stack_handler_types Types definitions for BLE support in SoftDevice handler. + * @{ + * @ingroup softdevice_handler + * @brief This file contains the declarations of types required for BLE stack support. These + * types will be defined when the preprocessor define BLE_STACK_SUPPORT_REQD is defined. + */ + +#ifndef BLE_STACK_HANDLER_TYPES_H__ +#define BLE_STACK_HANDLER_TYPES_H__ + +#ifdef BLE_STACK_SUPPORT_REQD + +#include +#include "nrf_ble.h" +#include "nrf_sdm.h" +#include "app_error.h" +#include "app_util.h" + +#define BLE_STACK_EVT_MSG_BUF_SIZE (sizeof(ble_evt_t) + (GATT_MTU_SIZE_DEFAULT)) /**< Size of BLE event message buffer. This will be provided to the SoftDevice while fetching an event. */ +#define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0 /**< The size of the scheduler event used by SoftDevice handler when passing BLE events using the @ref app_scheduler. */ + +/**@brief Application stack event handler type. */ +typedef void (*ble_evt_handler_t) (ble_evt_t * p_ble_evt); + +/**@brief Function for registering for BLE events. + * + * @details The application should use this function to register for receiving BLE events from + * the SoftDevice. If the application does not call this function, then any BLE event + * that may be generated by the SoftDevice will NOT be fetched. Once the application has + * registered for the events, it is not possible to cancel the registration. + * However, it is possible to register a different function for handling the events at + * any point of time. + * + * @param[in] ble_evt_handler Function to be called for each received BLE event. + * + * @retval NRF_SUCCESS Successful registration. + * @retval NRF_ERROR_NULL Null pointer provided as input. + */ +uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler); + +#else + +#define BLE_STACK_EVT_MSG_BUF_SIZE 0 /**< Since the BLE stack support is not required, this is equated to 0, so that the @ref softdevice_handler.h can compute the internal event buffer size without having to care for BLE events.*/ +#define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0 + +#endif // BLE_STACK_SUPPORT_REQD + +#endif // BLE_STACK_HANDLER_TYPES_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c new file mode 100644 index 0000000000..5534ae6dae --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c @@ -0,0 +1,517 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "softdevice_handler.h" +#include +#include +#include +#include +#include "nordic_common.h" +#include "app_error.h" +#include "nrf_assert.h" +#include "nrf_nvic.h" +#include "nrf.h" +#include "nrf_log.h" +#include "sdk_common.h" +#include "nrf_drv_config.h" +#if CLOCK_ENABLED +#include "nrf_drv_clock.h" +#endif + +#if defined(ANT_STACK_SUPPORT_REQD) && defined(BLE_STACK_SUPPORT_REQD) + #include "ant_interface.h" +#elif defined(ANT_STACK_SUPPORT_REQD) + #include "ant_interface.h" +#elif defined(BLE_STACK_SUPPORT_REQD) + #include "nrf_ble.h" +#endif + + +#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 +#define SD_HANDLER_LOG(...) NRF_LOG_PRINTF(__VA_ARGS__) +#else +#define SD_HANDLER_LOG(...) +#endif + +#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 +#define SD_HANDLER_LOG_INIT() NRF_LOG_INIT() +#else +#define SD_HANDLER_LOG_INIT() +#endif + + + +#define RAM_START_ADDRESS 0x20000000 +#define SOFTDEVICE_EVT_IRQ SD_EVT_IRQn /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ +#define SOFTDEVICE_EVT_IRQHandler SD_EVT_IRQHandler +#define RAM_TOTAL_SIZE ((NRF_FICR->INFO.RAM)*1024) +#define RAM_END_ADDRESS (RAM_START_ADDRESS + RAM_TOTAL_SIZE) + + +#define SOFTDEVICE_VS_UUID_COUNT 0 +#define SOFTDEVICE_GATTS_ATTR_TAB_SIZE BLE_GATTS_ATTR_TAB_SIZE_DEFAULT +#define SOFTDEVICE_GATTS_SRV_CHANGED 0 +#define SOFTDEVICE_PERIPH_CONN_COUNT 1 +#define SOFTDEVICE_CENTRAL_CONN_COUNT 4 +#define SOFTDEVICE_CENTRAL_SEC_COUNT 1 + +/* Global nvic state instance, required by nrf_nvic.h */ +nrf_nvic_state_t nrf_nvic_state; + +static softdevice_evt_schedule_func_t m_evt_schedule_func; /**< Pointer to function for propagating SoftDevice events to the scheduler. */ + +static volatile bool m_softdevice_enabled = false; /**< Variable to indicate whether the SoftDevice is enabled. */ + +#ifdef BLE_STACK_SUPPORT_REQD +// The following three definitions is needed only if BLE events are needed to be pulled from the stack. +static uint8_t * mp_ble_evt_buffer; /**< Buffer for receiving BLE events from the SoftDevice. */ +static uint16_t m_ble_evt_buffer_size; /**< Size of BLE event buffer. */ +static ble_evt_handler_t m_ble_evt_handler; /**< Application event handler for handling BLE events. */ +#endif + +#ifdef ANT_STACK_SUPPORT_REQD +// The following two definition is needed only if ANT events are needed to be pulled from the stack. +static ant_evt_t m_ant_evt_buffer; /**< Buffer for receiving ANT events from the SoftDevice. */ +static ant_evt_handler_t m_ant_evt_handler; /**< Application event handler for handling ANT events. */ +#endif + +static sys_evt_handler_t m_sys_evt_handler; /**< Application event handler for handling System (SOC) events. */ + + +/**@brief Callback function for asserts in the SoftDevice. + * + * @details A pointer to this function will be passed to the SoftDevice. This function will be + * called by the SoftDevice if certain unrecoverable errors occur within the + * application or SoftDevice. + * + * See @ref nrf_fault_handler_t for more details. + * + * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. + * @param[in] pc The program counter of the instruction that triggered the fault. + * @param[in] info Optional additional information regarding the fault. Refer to each fault + * identifier for details. + */ +void softdevice_fault_handler(uint32_t id, uint32_t pc, uint32_t info) +{ + app_error_fault_handler(id, pc, info); +} + + +void intern_softdevice_events_execute(void) +{ + if (!m_softdevice_enabled) + { + // SoftDevice not enabled. This can be possible if the SoftDevice was enabled by the + // application without using this module's API (i.e softdevice_handler_init) + + return; + } +#if CLOCK_ENABLED + bool no_more_soc_evts = false; +#else + bool no_more_soc_evts = (m_sys_evt_handler == NULL); +#endif +#ifdef BLE_STACK_SUPPORT_REQD + bool no_more_ble_evts = (m_ble_evt_handler == NULL); +#endif +#ifdef ANT_STACK_SUPPORT_REQD + bool no_more_ant_evts = (m_ant_evt_handler == NULL); +#endif + + for (;;) + { + uint32_t err_code; + + if (!no_more_soc_evts) + { + uint32_t evt_id; + + // Pull event from SOC. + err_code = sd_evt_get(&evt_id); + + if (err_code == NRF_ERROR_NOT_FOUND) + { + no_more_soc_evts = true; + } + else if (err_code != NRF_SUCCESS) + { + APP_ERROR_HANDLER(err_code); + } + else + { + // Call application's SOC event handler. +#if CLOCK_ENABLED + nrf_drv_clock_on_soc_event(evt_id); + if (m_sys_evt_handler) + { + m_sys_evt_handler(evt_id); + } +#else + m_sys_evt_handler(evt_id); +#endif + } + } + +#ifdef BLE_STACK_SUPPORT_REQD + // Fetch BLE Events. + if (!no_more_ble_evts) + { + // Pull event from stack + uint16_t evt_len = m_ble_evt_buffer_size; + + err_code = sd_ble_evt_get(mp_ble_evt_buffer, &evt_len); + if (err_code == NRF_ERROR_NOT_FOUND) + { + no_more_ble_evts = true; + } + else if (err_code != NRF_SUCCESS) + { + APP_ERROR_HANDLER(err_code); + } + else + { + // Call application's BLE stack event handler. + m_ble_evt_handler((ble_evt_t *)mp_ble_evt_buffer); + } + } +#endif + +#ifdef ANT_STACK_SUPPORT_REQD + // Fetch ANT Events. + if (!no_more_ant_evts) + { + // Pull event from stack + err_code = sd_ant_event_get(&m_ant_evt_buffer.channel, + &m_ant_evt_buffer.event, + m_ant_evt_buffer.msg.evt_buffer); + if (err_code == NRF_ERROR_NOT_FOUND) + { + no_more_ant_evts = true; + } + else if (err_code != NRF_SUCCESS) + { + APP_ERROR_HANDLER(err_code); + } + else + { + // Call application's ANT stack event handler. + m_ant_evt_handler(&m_ant_evt_buffer); + } + } +#endif + + if (no_more_soc_evts) + { + // There are no remaining System (SOC) events to be fetched from the SoftDevice. +#if defined(ANT_STACK_SUPPORT_REQD) && defined(BLE_STACK_SUPPORT_REQD) + // Check if there are any remaining BLE and ANT events. + if (no_more_ble_evts && no_more_ant_evts) + { + break; + } +#elif defined(BLE_STACK_SUPPORT_REQD) + // Check if there are any remaining BLE events. + if (no_more_ble_evts) + { + break; + } +#elif defined(ANT_STACK_SUPPORT_REQD) + // Check if there are any remaining ANT events. + if (no_more_ant_evts) + { + break; + } +#else + // No need to check for BLE or ANT events since there is no support for BLE and ANT + // required. + break; +#endif + } + } +} + +bool softdevice_handler_isEnabled(void) +{ + return m_softdevice_enabled; +} + +uint32_t softdevice_handler_init(nrf_clock_lf_cfg_t * p_clock_lf_cfg, + void * p_ble_evt_buffer, + uint16_t ble_evt_buffer_size, + softdevice_evt_schedule_func_t evt_schedule_func) +{ + uint32_t err_code; + + SD_HANDLER_LOG_INIT(); + + // Save configuration. +#if defined (BLE_STACK_SUPPORT_REQD) + // Check that buffer is not NULL. + if (p_ble_evt_buffer == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Check that buffer is correctly aligned. + if (!is_word_aligned(p_ble_evt_buffer)) + { + return NRF_ERROR_INVALID_PARAM; + } + + mp_ble_evt_buffer = (uint8_t *)p_ble_evt_buffer; + m_ble_evt_buffer_size = ble_evt_buffer_size; +#else + // The variables p_ble_evt_buffer and ble_evt_buffer_size is not needed if BLE Stack support + // is not required. + UNUSED_PARAMETER(p_ble_evt_buffer); + UNUSED_PARAMETER(ble_evt_buffer_size); +#endif + + m_evt_schedule_func = evt_schedule_func; + + // Initialize SoftDevice. +#if defined(S212) || defined(S332) + err_code = sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler, ANT_LICENSE_KEY); +#else + err_code = sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler); +#endif + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + m_softdevice_enabled = true; + + // Enable BLE event interrupt (interrupt priority has already been set by the stack). +#ifdef SOFTDEVICE_PRESENT + return sd_nvic_EnableIRQ((IRQn_Type)SOFTDEVICE_EVT_IRQ); +#else + //In case of Serialization NVIC must be accessed directly. + NVIC_EnableIRQ(SOFTDEVICE_EVT_IRQ); + return NRF_SUCCESS; +#endif +} + + +uint32_t softdevice_handler_sd_disable(void) +{ + uint32_t err_code = sd_softdevice_disable(); + + m_softdevice_enabled = !(err_code == NRF_SUCCESS); + + return err_code; +} + + +#ifdef BLE_STACK_SUPPORT_REQD +uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler) +{ + VERIFY_PARAM_NOT_NULL(ble_evt_handler); + + m_ble_evt_handler = ble_evt_handler; + + return NRF_SUCCESS; +} +#endif + + +#ifdef ANT_STACK_SUPPORT_REQD +uint32_t softdevice_ant_evt_handler_set(ant_evt_handler_t ant_evt_handler) +{ + VERIFY_PARAM_NOT_NULL(ant_evt_handler); + + m_ant_evt_handler = ant_evt_handler; + + return NRF_SUCCESS; +} +#endif + + +uint32_t softdevice_sys_evt_handler_set(sys_evt_handler_t sys_evt_handler) +{ + VERIFY_PARAM_NOT_NULL(sys_evt_handler); + + m_sys_evt_handler = sys_evt_handler; + + return NRF_SUCCESS; +} + + +/**@brief Function for handling the Application's BLE Stack events interrupt. + * + * @details This function is called whenever an event is ready to be pulled. + */ +void SOFTDEVICE_EVT_IRQHandler(void) +{ + if (m_evt_schedule_func != NULL) + { + uint32_t err_code = m_evt_schedule_func(); + APP_ERROR_CHECK(err_code); + } + else + { + intern_softdevice_events_execute(); + } +} + +#if defined(BLE_STACK_SUPPORT_REQD) +uint32_t softdevice_enable_get_default_config(uint8_t central_links_count, + uint8_t periph_links_count, + ble_enable_params_t * p_ble_enable_params) +{ + memset(p_ble_enable_params, 0, sizeof(ble_enable_params_t)); + p_ble_enable_params->common_enable_params.vs_uuid_count = 1; + p_ble_enable_params->gatts_enable_params.attr_tab_size = SOFTDEVICE_GATTS_ATTR_TAB_SIZE; + p_ble_enable_params->gatts_enable_params.service_changed = SOFTDEVICE_GATTS_SRV_CHANGED; + p_ble_enable_params->gap_enable_params.periph_conn_count = periph_links_count; + p_ble_enable_params->gap_enable_params.central_conn_count = central_links_count; + if (p_ble_enable_params->gap_enable_params.central_conn_count != 0) + { + p_ble_enable_params->gap_enable_params.central_sec_count = SOFTDEVICE_CENTRAL_SEC_COUNT; + } + + return NRF_SUCCESS; +} + + +#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 +static inline uint32_t ram_total_size_get(void) +{ +#ifdef NRF51 + uint32_t size_ram_blocks = (uint32_t)NRF_FICR->SIZERAMBLOCKS; + uint32_t total_ram_size = size_ram_blocks; + total_ram_size = total_ram_size*(NRF_FICR->NUMRAMBLOCK); + return total_ram_size; +#elif defined (NRF52) + return RAM_TOTAL_SIZE; +#endif /* NRF51 */ +} + +/*lint --e{528} -save suppress 528: symbol not referenced */ +/**@brief Function for finding the end address of the RAM. + * + * @retval ram_end_address Address of the end of the RAM. + */ +static inline uint32_t ram_end_address_get(void) +{ + uint32_t ram_end_address = (uint32_t)RAM_START_ADDRESS; + ram_end_address+= ram_total_size_get(); + return ram_end_address; +} +/*lint -restore*/ +#endif //ENABLE_DEBUG_LOG_SUPPORT + +/*lint --e{10} --e{19} --e{27} --e{40} --e{529} -save suppress Error 27: Illegal character */ +uint32_t sd_check_ram_start(uint32_t sd_req_ram_start) +{ +#if (defined(S130) || defined(S132) || defined(S332)) +#if defined ( __CC_ARM ) + extern uint32_t Image$$RW_IRAM1$$Base; + const volatile uint32_t ram_start = (uint32_t) &Image$$RW_IRAM1$$Base; +#elif defined ( __ICCARM__ ) + extern uint32_t __ICFEDIT_region_RAM_start__; + volatile uint32_t ram_start = (uint32_t) &__ICFEDIT_region_RAM_start__; +#elif defined ( __GNUC__ ) + extern uint32_t __data_start__; + volatile uint32_t ram_start = (uint32_t) &__data_start__; +#endif//__CC_ARM + if (ram_start != sd_req_ram_start) + { +#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 + uint32_t app_ram_size= ram_end_address_get(); + SD_HANDLER_LOG("RAM START ADDR 0x%x should be adjusted to 0x%x\r\n", + ram_start, + sd_req_ram_start); + app_ram_size -= sd_req_ram_start; + SD_HANDLER_LOG("RAM SIZE should be adjusted to 0x%x \r\n", + app_ram_size); +#endif //NRF_LOG_USES_RTT + return NRF_SUCCESS; + } +#endif//defined(S130) || defined(S132) || defined(S332) + return NRF_SUCCESS; +} + +uint32_t softdevice_enable(ble_enable_params_t * p_ble_enable_params) +{ +#if (defined(S130) || defined(S132) || defined(S332)) + uint32_t err_code; + uint32_t app_ram_base; + +#if defined ( __CC_ARM ) + extern uint32_t Image$$RW_IRAM1$$Base; + const volatile uint32_t ram_start = (uint32_t) &Image$$RW_IRAM1$$Base; +#elif defined ( __ICCARM__ ) + extern uint32_t __ICFEDIT_region_RAM_start__; + volatile uint32_t ram_start = (uint32_t) &__ICFEDIT_region_RAM_start__; +#elif defined ( __GNUC__ ) + extern uint32_t __data_start__; + volatile uint32_t ram_start = (uint32_t) &__data_start__; +#endif + + app_ram_base = ram_start; + SD_HANDLER_LOG("sd_ble_enable: RAM START at 0x%x\r\n", + app_ram_base); + err_code = sd_ble_enable(p_ble_enable_params, &app_ram_base); + +#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 + if (app_ram_base != ram_start) + { + uint32_t app_ram_size= ram_end_address_get(); + SD_HANDLER_LOG("sd_ble_enable: app_ram_base should be adjusted to 0x%x\r\n", + app_ram_base); + app_ram_size -= app_ram_base; + SD_HANDLER_LOG("ram size should be adjusted to 0x%x \r\n", + app_ram_size); + } + else if (err_code != NRF_SUCCESS) + { + SD_HANDLER_LOG("sd_ble_enable: error 0x%x\r\n", err_code); + while(1); + } +#endif // NRF_LOG_USES_RTT + return err_code; +#else + return NRF_SUCCESS; +#endif //defined(S130) || defined(S132) || defined(S332) + +} +/*lint -restore*/ + +#endif //BLE_STACK_SUPPORT_REQD diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h new file mode 100644 index 0000000000..588ce1626a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @file + * + * @defgroup softdevice_handler SoftDevice Event Handler + * @{ + * @ingroup app_common + * @brief API for initializing and disabling the SoftDevice + * + * @details This API contains the functions and defines exposed by the @ref lib_softdevice_handler. + * For more information on the library and how the application should use it, please refer + * @ref lib_softdevice_handler. + * + * @note Use the USE_SCHEDULER parameter of the SOFTDEVICE_HANDLER_INIT() macro to select if + * the @ref app_scheduler is to be used or not. + * + * @note Even if the scheduler is not used, softdevice_handler.h will include app_scheduler.h. + * So when compiling, app_scheduler.h must be available in one of the compiler include + * paths. + */ + +#ifndef SOFTDEVICE_HANDLER_H__ +#define SOFTDEVICE_HANDLER_H__ + +#include +#include "nordic_common.h" +#include "nrf_sdm.h" +#include "app_error.h" +#include "app_util.h" +#include "ble_stack_handler_types.h" +#include "ant_stack_handler_types.h" +#if defined(BLE_STACK_SUPPORT_REQD) + #include "nrf_ble.h" +#endif +#include "app_ram_base.h" +#define SOFTDEVICE_SCHED_EVT_SIZE 0 /**< Size of button events being passed through the scheduler (is to be used for computing the maximum size of scheduler events). For SoftDevice events, this size is 0, since the events are being pulled in the event handler. */ +#define SYS_EVT_MSG_BUF_SIZE sizeof(uint32_t) /**< Size of System (SOC) event message buffer. */ + + +#define CHECK_RAM_START_ADDR_INTERN(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT) \ + do{ \ + uint32_t app_ram_start_addr = APP_RAM_BASE_CENTRAL_LINKS_##CENTRAL_LINK_COUNT##_PERIPH_LINKS_##PERIPHERAL_LINK_COUNT##_SEC_COUNT_0_MID_BW; \ + err_code = sd_check_ram_start(app_ram_start_addr); \ + APP_ERROR_CHECK(err_code); \ + } while (0) + +/** @brief Macro for checking the RAM requirement of the SoftDevice */ +#define CHECK_RAM_START_ADDR(C_LINK_CNT, P_LINK_CNT) CHECK_RAM_START_ADDR_INTERN(C_LINK_CNT, P_LINK_CNT) + + +/**@brief Function for checking the RAM requirement of the SoftDevice. + * + * @details Call this function to check if the project settings have the correct RAM start address in respect to what the SoftDevice requires. + * + * @note This function is called using the CHECK_RAM_START_ADDR_INTERN macro and should not be called directly. + */ +uint32_t sd_check_ram_start(uint32_t sd_req_ram_start); + +/**@brief Type of function for passing events from the stack handler module to the scheduler. */ +typedef uint32_t (*softdevice_evt_schedule_func_t) (void); + +/**@brief Application System (SOC) event handler type. */ +typedef void (*sys_evt_handler_t) (uint32_t evt_id); + + +/**@brief Macro for initializing the stack event handler. + * + * @details It will handle dimensioning and allocation of the memory buffer required for reading + * events from the stack, making sure the buffer is correctly aligned. It will also + * connect the stack event handler to the scheduler/RTOS (if specified). + * + * @param[in] CLOCK_SOURCE Low frequency clock source and accuracy (type nrf_clock_lf_cfg_t_t, + * see sd_softdevice_enable() for details). + * @param[in] EVT_HANDLER scheduler/RTOS event handler function. + * + * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it + * several times as long as it is from the same location, that is to do a + * reinitialization). + */ +/*lint -emacro(506, SOFTDEVICE_HANDLER_INIT) */ /* Suppress "Constant value Boolean */ +#define SOFTDEVICE_HANDLER_INIT(CLOCK_SOURCE, \ + EVT_HANDLER) \ + do \ + { \ + static uint32_t BLE_EVT_BUFFER[CEIL_DIV(BLE_STACK_EVT_MSG_BUF_SIZE, sizeof(uint32_t))]; \ + uint32_t ERR_CODE; \ + ERR_CODE = softdevice_handler_init((CLOCK_SOURCE), \ + BLE_EVT_BUFFER, \ + sizeof(BLE_EVT_BUFFER), \ + EVT_HANDLER); \ + APP_ERROR_CHECK(ERR_CODE); \ + } while (0) + +/** + * @brief Function for retrieving the information about SD state + * + * The information about current state of softdevice. + * @retval false SD is not initialized and SD commands should not be called. + * @retval true SD is already initialized + */ +bool softdevice_handler_isEnabled(void); + +/**@brief Function for initializing the stack handler module. + * + * @details Enables the SoftDevice and the stack event interrupt handler. + * + * @note This function must be called before calling any function in the SoftDevice API. + * + * @note Normally initialization should be done using the SOFTDEVICE_HANDLER_INIT() macro, + * as that will both allocate the event buffer, and also align the buffer correctly. + * + * @param[in] p_clock_lf_cfg Low frequency clock source to be used by the SoftDevice. + * @param[in] p_ble_evt_buffer Buffer for holding one BLE stack event. Since heap is not being + * used, this buffer must be provided by the application. The + * buffer must be large enough to hold the biggest stack event the + * application is supposed to handle. The buffer must be aligned to + * a 4 byte boundary. This parameter is unused if BLE stack support + * is not required. + * @param[in] ble_evt_buffer_size Size of SoftDevice BLE event buffer. This parameter is unused if + * BLE stack support is not required. + * @param[in] evt_schedule_func Function for passing events to the scheduler. Point to + * ble_ant_stack_evt_schedule() to connect to the scheduler. + * Set to NULL to make the stack handler module call the event + * handler directly from the stack event interrupt handler. + * + * @retval NRF_SUCCESS Successful initialization. + * @retval NRF_ERROR_INVALID_PARAM Invalid parameter (buffer not aligned to a 4 byte + * boundary) or NULL. + */ +uint32_t softdevice_handler_init(nrf_clock_lf_cfg_t * p_clock_lf_cfg, + void * p_ble_evt_buffer, + uint16_t ble_evt_buffer_size, + softdevice_evt_schedule_func_t evt_schedule_func); + + +/**@brief Function for disabling the SoftDevice. + * + * @details This function will disable the SoftDevice. It will also update the internal state + * of this module. + */ +uint32_t softdevice_handler_sd_disable(void); + + +/**@brief Function for registering for System (SOC) events. + * + * @details The application should use this function to register for receiving System (SOC) + * events from the SoftDevice. If the application does not call this function, then any + * System (SOC) events that may be generated by the SoftDevice will NOT be fetched. Once + * the application has registered for the events, it is not possible to possible to + * cancel the registration. However, it is possible to register a different function for + * handling the events at any point of time. + * + * @param[in] sys_evt_handler Function to be called for each received System (SOC) event. + * + * @retval NRF_SUCCESS Successful registration. + * @retval NRF_ERROR_NULL Null pointer provided as input. + */ +uint32_t softdevice_sys_evt_handler_set(sys_evt_handler_t sys_evt_handler); + +#if defined(BLE_STACK_SUPPORT_REQD) +/**@brief Function for fetching the default enable parameters for the SoftDevice. + * + * @details The default enable parameters will work for most projects in the SDK. + * They are not optimized with regards to RAM use. This function is meant as a way to abstract the + * details of p_ble_enable_params needed by @ref softdevice_enable. You might want to tweak + * the struct returned by this function or fill in the entire ble_enable_params_t + * instead of fetching it from this function. + * + * @param[in] central_links_count Number of central links used by the application. + * @param[in] periph_links_count Number of peripheral links used by the application. + * @param[out] p_ble_enable_params Default ble_enable_params_t to be used by @ref softdevice_enable. + * + * @retval NRF_SUCCESS If the operation was successful. + */ +uint32_t softdevice_enable_get_default_config(uint8_t central_links_count, + uint8_t periph_links_count, + ble_enable_params_t * p_ble_enable_params); + +/**@brief Function for enabling the SoftDevice. + * + * @details This function calls the @ref sd_ble_enable SVC call. It has been abstracted to give + * feedback on the app_ram_base. If the app_ram_base is too low, this function will + * return an error. Using a app_ram_base that is too high will not fail, but will + * result in RAM that is never used. If the DEBUG macro is enabled, this + * function will provide the correct app_ram_base as mandated by the SoftDevice. + * This is useful to tweak the RAM use of your application. + * + * @param[in] p_ble_enable_params Parameters for configuring links and bandwidths. + * + * @retval NRF_SUCCESS If the operation was successful. + */ +uint32_t softdevice_enable(ble_enable_params_t * p_ble_enable_params); +#endif //BLE_STACK_SUPPORT_REQD +// Functions for connecting the Stack Event Handler to the scheduler: +/**@cond NO_DOXYGEN */ +void intern_softdevice_events_execute(void); + + +/**@endcond */ + +#endif // SOFTDEVICE_HANDLER_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.c new file mode 100644 index 0000000000..bb4c2f95d4 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "softdevice_handler_appsh.h" +#include "app_scheduler.h" +#include + +void softdevice_evt_get(void * p_event_data, uint16_t event_size) +{ + APP_ERROR_CHECK_BOOL(event_size == 0); + intern_softdevice_events_execute(); +} + +uint32_t softdevice_evt_schedule(void) +{ + return app_sched_event_put(NULL, 0, softdevice_evt_get); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.h new file mode 100644 index 0000000000..dcde1c9b96 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef SOFTDEVICE_HANDLER_APPSH_H +#define SOFTDEVICE_HANDLER_APPSH_H + +#include "softdevice_handler.h" +#include + +#define SOFTDEVICE_HANDLER_APPSH_INIT(CLOCK_SOURCE,USE_SCHEDULER) \ + SOFTDEVICE_HANDLER_INIT(CLOCK_SOURCE,(USE_SCHEDULER) ? softdevice_evt_schedule : NULL) + +uint32_t softdevice_evt_schedule(void); + +#endif //SOFTDEVICE_HANDLER_APPSH_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c new file mode 100644 index 0000000000..c52fac72c3 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c @@ -0,0 +1,664 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "serial_api.h" + +#if DEVICE_SERIAL + +#include +#include "mbed_assert.h" +#include "mbed_error.h" +#include "nrf_uart.h" +#include "nrf_drv_common.h" +#include "nrf_drv_config.h" +#include "app_util_platform.h" +#include "nrf_gpio.h" + +#define UART_INSTANCE_COUNT 1 +#define UART_INSTANCE NRF_UART0 +#define UART_IRQn UART0_IRQn +#define UART_IRQ_HANDLER UART0_IRQHandler +#define UART_INSTANCE_ID 0 +#define UART_CB uart_cb[UART_INSTANCE_ID] + +#define UART_DEFAULT_BAUDRATE UART0_CONFIG_BAUDRATE +#define UART_DEFAULT_PARITY UART0_CONFIG_PARITY + +// expected the macro from mbed configuration system +#ifndef MBED_CONF_NORDIC_UART_HWFC + #define MBED_CONF_NORDIC_UART_HWFC 1 + #warning None of UART flow control configuration (expected macro MBED_CONF_NORDIC_UART_HWFC). The RTSCTS flow control is used by default . +#endif + +#if MBED_CONF_NORDIC_UART_HWFC == 1 + #define UART_DEFAULT_HWFC UART0_CONFIG_HWFC +#else + #define UART_DEFAULT_HWFC NRF_UART_HWFC_DISABLED +#endif + +#define UART_DEFAULT_CTS UART0_CONFIG_PSEL_CTS +#define UART_DEFAULT_RTS UART0_CONFIG_PSEL_RTS + +#ifdef NRF51 + #define NRFx_MBED_UART_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW +#elif defined(NRF52) + #define NRFx_MBED_UART_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +// Required by "retarget.cpp". +int stdio_uart_inited = 0; +serial_t stdio_uart; + +typedef struct { + bool initialized; + uint32_t irq_context; + uart_irq_handler irq_handler; + + uint32_t pselrxd; + uint32_t pseltxd; + uint32_t pselcts; + uint32_t pselrts; + nrf_uart_hwfc_t hwfc; + nrf_uart_parity_t parity; + nrf_uart_baudrate_t baudrate; + +#if DEVICE_SERIAL_ASYNCH + bool volatile rx_active; + uint8_t *rx_buffer; + size_t rx_length; + size_t rx_pos; + void (*rx_asynch_handler)(); + uint8_t char_match; + + bool volatile tx_active; + const uint8_t *tx_buffer; + size_t tx_length; + size_t tx_pos; + void (*tx_asynch_handler)(); + + uint32_t events_wanted; + uint32_t events_occured; + + #define UART_IRQ_TX 1 + #define UART_IRQ_RX 2 + uint8_t irq_enabled; +#endif // DEVICE_SERIAL_ASYNCH +} uart_ctlblock_t; + +static uart_ctlblock_t uart_cb[UART_INSTANCE_COUNT]; + +static void internal_set_hwfc(FlowControl type, + PinName rxflow, PinName txflow); + + +#if DEVICE_SERIAL_ASYNCH +static void end_asynch_rx(void) +{ + // If RX interrupt is activated for synchronous operations, + // don't disable it, just stop handling it here. + if (!(UART_CB.irq_enabled & UART_IRQ_RX)) { + nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY); + } + UART_CB.rx_active = false; +} +static void end_asynch_tx(void) +{ + // If TX interrupt is activated for synchronous operations, + // don't disable it, just stop handling it here. + if (!(UART_CB.irq_enabled & UART_IRQ_TX)) { + nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_TXDRDY); + } + UART_CB.tx_active = false; +} +#endif // DEVICE_SERIAL_ASYNCH + +void UART_IRQ_HANDLER(void) +{ + if (nrf_uart_int_enable_check(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY) && + nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_RXDRDY)) { + + #if DEVICE_SERIAL_ASYNCH + if (UART_CB.rx_active) { + nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_RXDRDY); + + uint8_t rx_data = nrf_uart_rxd_get(UART_INSTANCE); + UART_CB.rx_buffer[UART_CB.rx_pos] = rx_data; + + bool end_rx = false; + // If character matching should be performed, check if the current + // data matches the given one. + if (UART_CB.char_match != SERIAL_RESERVED_CHAR_MATCH && + rx_data == UART_CB.char_match) { + // If it does, report the match and abort further receiving. + UART_CB.events_occured |= SERIAL_EVENT_RX_CHARACTER_MATCH; + if (UART_CB.events_wanted & SERIAL_EVENT_RX_CHARACTER_MATCH) { + end_rx = true; + } + } + if (++UART_CB.rx_pos >= UART_CB.rx_length) { + UART_CB.events_occured |= SERIAL_EVENT_RX_COMPLETE; + end_rx = true; + } + if (end_rx) { + end_asynch_rx(); + + if (UART_CB.rx_asynch_handler) { + // Use local variable to make it possible to start a next + // transfer from callback routine. + void (*handler)() = UART_CB.rx_asynch_handler; + UART_CB.rx_asynch_handler = NULL; + handler(); + } + } + } + else + #endif + + if (UART_CB.irq_handler) { + UART_CB.irq_handler(UART_CB.irq_context, RxIrq); + } + } + + if (nrf_uart_int_enable_check(UART_INSTANCE, NRF_UART_INT_MASK_TXDRDY) && + nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_TXDRDY)) { + + #if DEVICE_SERIAL_ASYNCH + if (UART_CB.tx_active) { + if (++UART_CB.tx_pos <= UART_CB.tx_length) { + // When there is still something to send, clear the TXDRDY event + // and put next byte to transmitter. + nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_TXDRDY); + nrf_uart_txd_set(UART_INSTANCE, + UART_CB.tx_buffer[UART_CB.tx_pos]); + } + else { + // When the TXDRDY event is set after the last byte to be sent + // has been passed to the transmitter, the job is done and TX + // complete can be indicated. + // Don't clear the TXDRDY event, it needs to remain set for the + // 'serial_writable' function to work properly. + end_asynch_tx(); + + UART_CB.events_occured |= SERIAL_EVENT_TX_COMPLETE; + if (UART_CB.tx_asynch_handler) { + // Use local variable to make it possible to start a next + // transfer from callback routine. + void (*handler)() = UART_CB.tx_asynch_handler; + UART_CB.tx_asynch_handler = NULL; + handler(); + } + } + } + else + #endif + + if (UART_CB.irq_handler) { + UART_CB.irq_handler(UART_CB.irq_context, TxIrq); + } + } + +#if DEVICE_SERIAL_ASYNCH + if (nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_ERROR)) { + nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_ERROR); + + uint8_t errorsrc = nrf_uart_errorsrc_get_and_clear(UART_INSTANCE); + if (UART_CB.rx_asynch_handler) { + UART_CB.events_occured |= SERIAL_EVENT_ERROR; + if (errorsrc & NRF_UART_ERROR_PARITY_MASK) { + UART_CB.events_occured |= SERIAL_EVENT_RX_PARITY_ERROR; + } + if (errorsrc & NRF_UART_ERROR_FRAMING_MASK) { + UART_CB.events_occured |= SERIAL_EVENT_RX_FRAMING_ERROR; + } + if (errorsrc & NRF_UART_ERROR_OVERRUN_MASK) { + UART_CB.events_occured |= SERIAL_EVENT_RX_OVERRUN_ERROR; + } + UART_CB.rx_asynch_handler(); + } + } +#endif // DEVICE_SERIAL_ASYNCH +} + +void serial_init(serial_t *obj, PinName tx, PinName rx) { + + NVIC_SetVector(UART0_IRQn, (uint32_t) UART0_IRQHandler); + + + UART_CB.pseltxd = + (tx == NC) ? NRF_UART_PSEL_DISCONNECTED : (uint32_t)tx; + UART_CB.pselrxd = + (rx == NC) ? NRF_UART_PSEL_DISCONNECTED : (uint32_t)rx; + if (UART_CB.pseltxd != NRF_UART_PSEL_DISCONNECTED) { + nrf_gpio_pin_set(UART_CB.pseltxd); + nrf_gpio_cfg_output(UART_CB.pseltxd); + } + if (UART_CB.pselrxd != NRF_UART_PSEL_DISCONNECTED) { + nrf_gpio_cfg_input(UART_CB.pselrxd, NRF_GPIO_PIN_NOPULL); + } + + if (UART_CB.initialized) { + // For already initialized peripheral it is sufficient to reconfigure + // RX/TX pins only. + + // Ensure that there is no unfinished TX transfer. + while (!serial_writable(obj)) { + } + // UART pins can be configured only when the peripheral is disabled. + nrf_uart_disable(UART_INSTANCE); + nrf_uart_txrx_pins_set(UART_INSTANCE, UART_CB.pseltxd, UART_CB.pselrxd); + nrf_uart_enable(UART_INSTANCE); + } + else { + UART_CB.baudrate = UART_DEFAULT_BAUDRATE; + UART_CB.parity = UART_DEFAULT_PARITY; + UART_CB.hwfc = UART_DEFAULT_HWFC; + UART_CB.pselcts = UART_DEFAULT_CTS; + UART_CB.pselrts = UART_DEFAULT_RTS; + + nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_RXDRDY); + nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_TXDRDY); + nrf_uart_task_trigger(UART_INSTANCE, NRF_UART_TASK_STARTRX); + nrf_uart_task_trigger(UART_INSTANCE, NRF_UART_TASK_STARTTX); + + nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY | + NRF_UART_INT_MASK_TXDRDY); + #if DEVICE_SERIAL_ASYNCH + nrf_uart_int_enable(UART_INSTANCE, NRF_UART_INT_MASK_ERROR); + #endif + nrf_drv_common_irq_enable(UART_IRQn, NRFx_MBED_UART_IRQ_PRIORITY); + + // TX interrupt needs to be signaled when transmitter buffer is empty, + // so a dummy transmission is needed to get the TXDRDY event initially + // set. + nrf_uart_configure(UART_INSTANCE, + NRF_UART_PARITY_EXCLUDED, NRF_UART_HWFC_DISABLED); + // Use maximum baud rate, so this dummy transmission takes as little + // time as possible. + nrf_uart_baudrate_set(UART_INSTANCE, NRF_UART_BAUDRATE_1000000); + // Perform it with disconnected TX pin, so nothing actually comes out + // of the device. + nrf_uart_txrx_pins_disconnect(UART_INSTANCE); + nrf_uart_hwfc_pins_disconnect(UART_INSTANCE); + nrf_uart_enable(UART_INSTANCE); + nrf_uart_txd_set(UART_INSTANCE, 0); + while (!nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_TXDRDY)) { + } + nrf_uart_disable(UART_INSTANCE); + + // Now everything is prepared to set the default configuration and + // connect the peripheral to actual pins. + nrf_uart_txrx_pins_set(UART_INSTANCE, UART_CB.pseltxd, UART_CB.pselrxd); + nrf_uart_baudrate_set(UART_INSTANCE, UART_CB.baudrate); + nrf_uart_configure(UART_INSTANCE, UART_CB.parity, UART_CB.hwfc); + if (UART_CB.hwfc == NRF_UART_HWFC_ENABLED) { + internal_set_hwfc(FlowControlRTSCTS, + (PinName) UART_CB.pselrts, (PinName) UART_CB.pselcts); + } + + nrf_uart_enable(UART_INSTANCE); + + UART_CB.initialized = true; + } + + if (tx == STDIO_UART_TX && rx == STDIO_UART_RX) { + stdio_uart_inited = 1; + memcpy(&stdio_uart, obj, sizeof(serial_t)); + } + else { + stdio_uart_inited = 0; + } +} + +void serial_free(serial_t *obj) +{ + (void)obj; + + if (UART_CB.initialized) { + nrf_uart_disable(UART_INSTANCE); + nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY | + NRF_UART_INT_MASK_TXDRDY | + NRF_UART_INT_MASK_ERROR); + nrf_drv_common_irq_disable(UART_IRQn); + UART_CB.initialized = false; + + // There is only one UART instance, thus at this point the stdio UART + // can no longer be initialized. + stdio_uart_inited = 0; + } +} + +void serial_baud(serial_t *obj, int baudrate) +{ + // nrf_uart_baudrate_set() is not used here (registers are accessed + // directly) to make it possible to set special baud rates like 56000 + // or 31250. + + static uint32_t const acceptedSpeeds[][2] = { + { 1200, UART_BAUDRATE_BAUDRATE_Baud1200 }, + { 2400, UART_BAUDRATE_BAUDRATE_Baud2400 }, + { 4800, UART_BAUDRATE_BAUDRATE_Baud4800 }, + { 9600, UART_BAUDRATE_BAUDRATE_Baud9600 }, + { 14400, UART_BAUDRATE_BAUDRATE_Baud14400 }, + { 19200, UART_BAUDRATE_BAUDRATE_Baud19200 }, + { 28800, UART_BAUDRATE_BAUDRATE_Baud28800 }, + { 31250, (0x00800000UL) /* 31250 baud */ }, + { 38400, UART_BAUDRATE_BAUDRATE_Baud38400 }, + { 56000, (0x00E51000UL) /* 56000 baud */ }, + { 57600, UART_BAUDRATE_BAUDRATE_Baud57600 }, + { 76800, UART_BAUDRATE_BAUDRATE_Baud76800 }, + { 115200, UART_BAUDRATE_BAUDRATE_Baud115200 }, + { 230400, UART_BAUDRATE_BAUDRATE_Baud230400 }, + { 250000, UART_BAUDRATE_BAUDRATE_Baud250000 }, + { 460800, UART_BAUDRATE_BAUDRATE_Baud460800 }, + { 921600, UART_BAUDRATE_BAUDRATE_Baud921600 }, + { 1000000, UART_BAUDRATE_BAUDRATE_Baud1M } + }; + + if (baudrate <= 1200) { + UART_INSTANCE->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1200; + return; + } + + int const item_cnt = sizeof(acceptedSpeeds)/sizeof(acceptedSpeeds[0]); + for (int i = 1; i < item_cnt; i++) { + if ((uint32_t)baudrate < acceptedSpeeds[i][0]) { + UART_INSTANCE->BAUDRATE = acceptedSpeeds[i - 1][1]; + return; + } + } + + UART_INSTANCE->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1M; +} + +void serial_format(serial_t *obj, + int data_bits, SerialParity parity, int stop_bits) +{ + (void)obj; + + if (data_bits != 8) { + error("UART supports only 8 data bits.\r\n"); + } + if (stop_bits != 1) { + error("UART supports only 1 stop bits.\r\n"); + } + if (parity == ParityNone) { + UART_CB.parity = NRF_UART_PARITY_EXCLUDED; + } else if (parity == ParityEven) { + UART_CB.parity = NRF_UART_PARITY_INCLUDED; + } else { + error("UART supports only even parity.\r\n"); + } + + // Reconfigure UART peripheral. + nrf_uart_configure(UART_INSTANCE, UART_CB.parity, UART_CB.hwfc); +} + +void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) +{ + (void)obj; + UART_CB.irq_handler = handler; + UART_CB.irq_context = id; +} + +void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) +{ + (void)obj; + if (enable) { + switch (irq) { + case RxIrq: + #if DEVICE_SERIAL_ASYNCH + UART_CB.irq_enabled |= UART_IRQ_RX; + #endif + nrf_uart_int_enable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY); + break; + + case TxIrq: + #if DEVICE_SERIAL_ASYNCH + UART_CB.irq_enabled |= UART_IRQ_TX; + #endif + nrf_uart_int_enable(UART_INSTANCE, NRF_UART_INT_MASK_TXDRDY); + break; + } + } else { + switch (irq) { + case RxIrq: + #if DEVICE_SERIAL_ASYNCH + UART_CB.irq_enabled &= ~UART_IRQ_RX; + if (!UART_CB.rx_active) + #endif + { + nrf_uart_int_disable(UART_INSTANCE, + NRF_UART_INT_MASK_RXDRDY); + } + break; + + case TxIrq: + #if DEVICE_SERIAL_ASYNCH + UART_CB.irq_enabled &= ~UART_IRQ_TX; + if (!UART_CB.tx_active) + #endif + { + nrf_uart_int_disable(UART_INSTANCE, + NRF_UART_INT_MASK_TXDRDY); + } + break; + } + } +} + +int serial_getc(serial_t *obj) +{ + while (!serial_readable(obj)) { + } + + nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_RXDRDY); + return nrf_uart_rxd_get(UART_INSTANCE); +} + +void serial_putc(serial_t *obj, int c) +{ + while (!serial_writable(obj)) { + } + + nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_TXDRDY); + nrf_uart_txd_set(UART_INSTANCE, (uint8_t)c); +} + +int serial_readable(serial_t *obj) +{ + (void)obj; +#if DEVICE_SERIAL_ASYNCH + if (UART_CB.rx_active) { + return 0; + } +#endif + return (nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_RXDRDY)); +} + +int serial_writable(serial_t *obj) +{ + (void)obj; +#if DEVICE_SERIAL_ASYNCH + if (UART_CB.tx_active) { + return 0; + } +#endif + return (nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_TXDRDY)); +} + +void serial_break_set(serial_t *obj) +{ + (void)obj; + nrf_uart_task_trigger(UART_INSTANCE, NRF_UART_TASK_SUSPEND); + nrf_uart_txrx_pins_disconnect(UART_INSTANCE); + nrf_gpio_pin_clear(UART_CB.pseltxd); +} + +void serial_break_clear(serial_t *obj) +{ + (void)obj; + nrf_gpio_pin_set(UART_CB.pseltxd); + nrf_uart_txrx_pins_set(UART_INSTANCE, UART_CB.pseltxd, UART_CB.pselrxd); + nrf_uart_task_trigger(UART_INSTANCE, NRF_UART_TASK_STARTRX); + nrf_uart_task_trigger(UART_INSTANCE, NRF_UART_TASK_STARTTX); +} + + +static void internal_set_hwfc(FlowControl type, + PinName rxflow, PinName txflow) +{ + UART_CB.pselrts = + ((rxflow == NC) || (type == FlowControlCTS)) ? NRF_UART_PSEL_DISCONNECTED : (uint32_t)rxflow; + UART_CB.pselcts = + ((txflow == NC) || (type == FlowControlRTS)) ? NRF_UART_PSEL_DISCONNECTED : (uint32_t)txflow; + + if (UART_CB.pselrts != NRF_UART_PSEL_DISCONNECTED) { + nrf_gpio_pin_set(UART_CB.pselrts); + nrf_gpio_cfg_output(UART_CB.pselrts); + } + if (UART_CB.pselcts != NRF_UART_PSEL_DISCONNECTED) { + nrf_gpio_cfg_input(UART_CB.pselcts, NRF_GPIO_PIN_NOPULL); + } + + UART_CB.hwfc = (type == FlowControlNone)? NRF_UART_HWFC_DISABLED : UART0_CONFIG_HWFC; + + nrf_uart_configure(UART_INSTANCE, UART_CB.parity, UART_CB.hwfc); + nrf_uart_hwfc_pins_set(UART_INSTANCE, UART_CB.pselrts, UART_CB.pselcts); +} + +void serial_set_flow_control(serial_t *obj, FlowControl type, + PinName rxflow, PinName txflow) +{ + (void)obj; + + nrf_uart_disable(UART_INSTANCE); + internal_set_hwfc(type, rxflow, txflow); + nrf_uart_enable(UART_INSTANCE); +} + + +void serial_clear(serial_t *obj) { + (void)obj; +} + +#if DEVICE_SERIAL_ASYNCH + +int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, + uint8_t tx_width, uint32_t handler, uint32_t event, + DMAUsage hint) +{ + (void)obj; + (void)tx_width; + (void)hint; + if (UART_CB.tx_active || !tx_length) { + return 0; + } + + UART_CB.tx_buffer = tx; + UART_CB.tx_length = tx_length; + UART_CB.tx_pos = 0; + UART_CB.tx_asynch_handler = (void(*)())handler; + UART_CB.events_wanted &= ~SERIAL_EVENT_TX_ALL; + UART_CB.events_wanted |= event; + + UART_CB.tx_active = true; + nrf_uart_int_enable(UART_INSTANCE, NRF_UART_INT_MASK_TXDRDY); + + return 0; +} + +void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, + uint8_t rx_width, uint32_t handler, uint32_t event, + uint8_t char_match, DMAUsage hint) +{ + (void)obj; + (void)rx_width; + (void)hint; + if (UART_CB.rx_active || !rx_length) { + return; + } + + UART_CB.rx_buffer = rx; + UART_CB.rx_length = rx_length; + UART_CB.rx_pos = 0; + UART_CB.rx_asynch_handler = (void(*)())handler; + UART_CB.events_wanted &= ~SERIAL_EVENT_RX_ALL; + UART_CB.events_wanted |= event; + UART_CB.char_match = char_match; + + UART_CB.rx_active = true; + nrf_uart_int_enable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY); +} + +uint8_t serial_tx_active(serial_t *obj) +{ + (void)obj; + return UART_CB.tx_active; +} + +uint8_t serial_rx_active(serial_t *obj) +{ + (void)obj; + return UART_CB.rx_active; +} + +int serial_irq_handler_asynch(serial_t *obj) +{ + (void)obj; + uint32_t events_to_report = UART_CB.events_wanted & UART_CB.events_occured; + UART_CB.events_occured &= (~events_to_report); + return events_to_report; +} + +void serial_tx_abort_asynch(serial_t *obj) +{ + (void)obj; + end_asynch_tx(); + UART_CB.tx_asynch_handler = NULL; +} + +void serial_rx_abort_asynch(serial_t *obj) +{ + (void)obj; + end_asynch_rx(); + UART_CB.rx_asynch_handler = NULL; +} + +#endif // DEVICE_SERIAL_ASYNCH + +#endif // DEVICE_SERIAL diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c new file mode 100644 index 0000000000..cb677400d1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c @@ -0,0 +1,80 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "sleep_api.h" +#include "cmsis.h" +#include "mbed_interface.h" +#include "softdevice_handler.h" +#include "nrf_soc.h" + +// Mask of reserved bits of the register ICSR in the System Control Block peripheral +// In this case, bits which are equal to 0 are the bits reserved in this register +#define SCB_ICSR_RESERVED_BITS_MASK 0x9E43F03F + +#define FPU_EXCEPTION_MASK 0x0000009F + +void sleep(void) +{ + // ensure debug is disconnected if semihost is enabled.... + + // Trigger an event when an interrupt is pending. This allows to wake up + // the processor from disabled interrupts. + SCB->SCR |= SCB_SCR_SEVONPEND_Msk; + +#ifdef NRF52 + /* Clear exceptions and PendingIRQ from the FPU unit */ + __set_FPSCR(__get_FPSCR() & ~(FPU_EXCEPTION_MASK)); + (void) __get_FPSCR(); + NVIC_ClearPendingIRQ(FPU_IRQn); +#endif + + // If the SoftDevice is enabled, its API must be used to go to sleep. + if (softdevice_handler_isEnabled()) { + sd_power_mode_set(NRF_POWER_MODE_LOWPWR); + sd_app_evt_wait(); + } else { + NRF_POWER->TASKS_LOWPWR = 1; + + // Note: it is not sufficient to just use WFE here, since the internal + // event register may be already set from an event that occurred in the + // past (like an SVC call to the SoftDevice) and in such case WFE will + // just clear the register and continue execution. + // Therefore, the strategy here is to first clear the event register + // by using SEV/WFE pair, and then execute WFE again, unless there is + // a pending interrupt. + + // Set an event and wake up whatsoever, this will clear the event + // register from all previous events set (SVC call included) + __SEV(); + __WFE(); + + // Test if there is an interrupt pending (mask reserved regions) + if (SCB->ICSR & (SCB_ICSR_RESERVED_BITS_MASK)) { + // Ok, there is an interrut pending, no need to go to sleep + return; + } else { + // next event will wakeup the CPU + // If an interrupt occured between the test of SCB->ICSR and this + // instruction, WFE will just not put the CPU to sleep + __WFE(); + } + } +} + +void deepsleep(void) +{ + sleep(); + // NRF_POWER->SYSTEMOFF=1; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c new file mode 100644 index 0000000000..985d24fcc6 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c @@ -0,0 +1,537 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "spi_api.h" + +#if DEVICE_SPI + +#include "cmsis.h" +#include "pinmap.h" +#include "mbed_assert.h" +#include "mbed_error.h" +#include "nrf_drv_spi.h" +#include "nrf_drv_spis.h" +#include "app_util_platform.h" + +#if DEVICE_SPI_ASYNCH + #define SPI_IDX(obj) ((obj)->spi.spi_idx) +#else + #define SPI_IDX(obj) ((obj)->spi_idx) +#endif +#define SPI_INFO(obj) (&m_spi_info[SPI_IDX(obj)]) +#define MASTER_INST(obj) (&m_instances[SPI_IDX(obj)].master) +#define SLAVE_INST(obj) (&m_instances[SPI_IDX(obj)].slave) + +typedef struct { + bool initialized; + bool master; + uint8_t sck_pin; + uint8_t mosi_pin; + uint8_t miso_pin; + uint8_t ss_pin; + uint8_t spi_mode; + nrf_drv_spi_frequency_t frequency; + volatile union { + bool busy; // master + bool readable; // slave + } flag; + volatile uint8_t tx_buf; + volatile uint8_t rx_buf; + +#if DEVICE_SPI_ASYNCH + uint32_t handler; + uint32_t event; +#endif +} spi_info_t; +static spi_info_t m_spi_info[SPI_COUNT]; + +typedef struct { + nrf_drv_spi_t master; + nrf_drv_spis_t slave; +} sdk_driver_instances_t; + +void SPI0_TWI0_IRQHandler(void); +void SPI1_TWI1_IRQHandler(void); +void SPIM2_SPIS2_SPI2_IRQHandler(void); + +static const peripheral_handler_desc_t spi_hanlder_desc[SPI_COUNT] = { +#if SPI0_ENABLED + { + SPIS0_IRQ, + (uint32_t) SPI0_TWI0_IRQHandler + }, +#endif +#if SPI1_ENABLED + { + SPIS1_IRQ, + (uint32_t) SPI1_TWI1_IRQHandler + }, +#endif +#if SPI2_ENABLED + { + SPIS2_IRQ, + (uint32_t) SPIM2_SPIS2_SPI2_IRQHandler + }, +#endif +}; + + +static sdk_driver_instances_t m_instances[SPI_COUNT] = { +#if SPI0_ENABLED + { + NRF_DRV_SPI_INSTANCE(0), + NRF_DRV_SPIS_INSTANCE(0) + }, +#endif +#if SPI1_ENABLED + { + NRF_DRV_SPI_INSTANCE(1), + NRF_DRV_SPIS_INSTANCE(1) + }, +#endif +#if SPI2_ENABLED + { + NRF_DRV_SPI_INSTANCE(2), + NRF_DRV_SPIS_INSTANCE(2) + }, +#endif +}; + +static void master_event_handler(uint8_t spi_idx, + nrf_drv_spi_evt_t const *p_event) +{ + spi_info_t *p_spi_info = &m_spi_info[spi_idx]; + + if (p_event->type == NRF_DRV_SPI_EVENT_DONE) { + p_spi_info->flag.busy = false; + if (p_spi_info->handler) { + void (*handler)(void) = (void (*)(void))p_spi_info->handler; + p_spi_info->handler = 0; + handler(); + } + } +} +#define MASTER_EVENT_HANDLER(idx) \ + static void master_event_handler_##idx(nrf_drv_spi_evt_t const *p_event) { \ + master_event_handler(SPI##idx##_INSTANCE_INDEX, p_event); \ + } +#if SPI0_ENABLED + MASTER_EVENT_HANDLER(0) +#endif +#if SPI1_ENABLED + MASTER_EVENT_HANDLER(1) +#endif +#if SPI2_ENABLED + MASTER_EVENT_HANDLER(2) +#endif + +static nrf_drv_spi_handler_t const m_master_event_handlers[SPI_COUNT] = { +#if SPI0_ENABLED + master_event_handler_0, +#endif +#if SPI1_ENABLED + master_event_handler_1, +#endif +#if SPI2_ENABLED + master_event_handler_2, +#endif +}; + + +static void slave_event_handler(uint8_t spi_idx, + nrf_drv_spis_event_t event) +{ + spi_info_t *p_spi_info = &m_spi_info[spi_idx]; + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) { + // Signal that there is some data received that could be read. + p_spi_info->flag.readable = true; + + // And prepare for the next transfer. + // Previous data set in 'spi_slave_write' (if any) has been transmitted, + // now use the default one, until some new is set by 'spi_slave_write'. + p_spi_info->tx_buf = NRF_DRV_SPIS_DEFAULT_ORC; + nrf_drv_spis_buffers_set(&m_instances[spi_idx].slave, + (uint8_t const *)&p_spi_info->tx_buf, 1, + (uint8_t *)&p_spi_info->rx_buf, 1); + } +} +#define SLAVE_EVENT_HANDLER(idx) \ + static void slave_event_handler_##idx(nrf_drv_spis_event_t event) { \ + slave_event_handler(SPIS##idx##_INSTANCE_INDEX, event); \ + } +#if SPIS0_ENABLED + SLAVE_EVENT_HANDLER(0) +#endif +#if SPIS1_ENABLED + SLAVE_EVENT_HANDLER(1) +#endif +#if SPIS2_ENABLED + SLAVE_EVENT_HANDLER(2) +#endif + +static nrf_drv_spis_event_handler_t const m_slave_event_handlers[SPIS_COUNT] = { +#if SPIS0_ENABLED + slave_event_handler_0, +#endif +#if SPIS1_ENABLED + slave_event_handler_1, +#endif +#if SPIS2_ENABLED + slave_event_handler_2, +#endif +}; + +static void prepare_master_config(nrf_drv_spi_config_t *p_config, + spi_info_t const *p_spi_info) +{ + p_config->sck_pin = p_spi_info->sck_pin; + p_config->mosi_pin = p_spi_info->mosi_pin; + p_config->miso_pin = p_spi_info->miso_pin; + p_config->ss_pin = p_spi_info->ss_pin; + p_config->frequency = p_spi_info->frequency; + p_config->mode = (nrf_drv_spi_mode_t)p_spi_info->spi_mode; + + p_config->irq_priority = SPI1_CONFIG_IRQ_PRIORITY; + p_config->orc = 0xFF; + p_config->bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST; +} + +static void prepare_slave_config(nrf_drv_spis_config_t *p_config, + spi_info_t const *p_spi_info) +{ + p_config->sck_pin = p_spi_info->sck_pin; + p_config->mosi_pin = p_spi_info->mosi_pin; + p_config->miso_pin = p_spi_info->miso_pin; + p_config->csn_pin = p_spi_info->ss_pin; + p_config->mode = (nrf_drv_spis_mode_t)p_spi_info->spi_mode; + + p_config->irq_priority = SPIS1_CONFIG_IRQ_PRIORITY; + p_config->orc = NRF_DRV_SPIS_DEFAULT_ORC; + p_config->def = NRF_DRV_SPIS_DEFAULT_DEF; + p_config->bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST; + p_config->csn_pullup = NRF_DRV_SPIS_DEFAULT_CSN_PULLUP; + p_config->miso_drive = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE; +} + +void spi_init(spi_t *obj, + PinName mosi, PinName miso, PinName sclk, PinName ssel) +{ + int i; + for (i = 0; i < SPI_COUNT; ++i) { + spi_info_t *p_spi_info = &m_spi_info[i]; + if (!p_spi_info->initialized) { + + NVIC_SetVector(spi_hanlder_desc[i].IRQn, spi_hanlder_desc[i].vector); + + p_spi_info->sck_pin = (uint8_t)sclk; + p_spi_info->mosi_pin = (mosi != NC) ? + (uint8_t)mosi : NRF_DRV_SPI_PIN_NOT_USED; + p_spi_info->miso_pin = (miso != NC) ? + (uint8_t)miso : NRF_DRV_SPI_PIN_NOT_USED; + p_spi_info->ss_pin = (ssel != NC) ? + (uint8_t)ssel : NRF_DRV_SPI_PIN_NOT_USED; + p_spi_info->spi_mode = (uint8_t)NRF_DRV_SPI_MODE_0; + p_spi_info->frequency = NRF_DRV_SPI_FREQ_1M; + + // By default each SPI instance is initialized to work as a master. + // Should the slave mode be used, the instance will be reconfigured + // appropriately in 'spi_format'. + nrf_drv_spi_config_t config; + prepare_master_config(&config, p_spi_info); + + nrf_drv_spi_t const *p_spi = &m_instances[i].master; + ret_code_t ret_code = nrf_drv_spi_init(p_spi, + &config, m_master_event_handlers[i]); + if (ret_code == NRF_SUCCESS) { + p_spi_info->initialized = true; + p_spi_info->master = true; + p_spi_info->flag.busy = false; + #if DEVICE_SPI_ASYNCH + p_spi_info->handler = 0; + #endif + SPI_IDX(obj) = i; + + return; + } + } + } + + // No available peripheral + error("No available SPI peripheral\r\n"); +} + +void spi_free(spi_t *obj) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + if (p_spi_info->master) { + nrf_drv_spi_uninit(MASTER_INST(obj)); + } + else { + nrf_drv_spis_uninit(SLAVE_INST(obj)); + } + p_spi_info->initialized = false; +} + +int spi_busy(spi_t *obj) +{ + return (int)(SPI_INFO(obj)->flag.busy); +} + +void spi_format(spi_t *obj, int bits, int mode, int slave) +{ + if (bits != 8) { + error("Only 8-bits SPI is supported\r\n"); + } + if (mode > 3) { + error("SPI format error\r\n"); + } + + spi_info_t *p_spi_info = SPI_INFO(obj); + + if (slave) + { + nrf_drv_spis_mode_t spi_modes[4] = { + NRF_DRV_SPIS_MODE_0, + NRF_DRV_SPIS_MODE_1, + NRF_DRV_SPIS_MODE_2, + NRF_DRV_SPIS_MODE_3, + }; + nrf_drv_spis_mode_t new_mode = spi_modes[mode]; + + // If the peripheral is currently working as a master, the SDK driver + // it uses needs to be switched from SPI to SPIS. + if (p_spi_info->master) { + nrf_drv_spi_uninit(MASTER_INST(obj)); + } + // I the SPI mode has to be changed, the SDK's SPIS driver needs to be + // re-initialized (there is no other way to change its configuration). + else if (p_spi_info->spi_mode != (uint8_t)new_mode) { + nrf_drv_spis_uninit(SLAVE_INST(obj)); + } + else { + return; + } + + p_spi_info->spi_mode = (uint8_t)new_mode; + p_spi_info->master = false; + p_spi_info->flag.readable = false; + + // Initialize SDK's SPIS driver with the new configuration. + nrf_drv_spis_config_t config; + prepare_slave_config(&config, p_spi_info); + (void)nrf_drv_spis_init(SLAVE_INST(obj), &config, + m_slave_event_handlers[SPI_IDX(obj)]); + + // Prepare the slave for transfer. + p_spi_info->tx_buf = NRF_DRV_SPIS_DEFAULT_ORC; + nrf_drv_spis_buffers_set(SLAVE_INST(obj), + (uint8_t const *)&p_spi_info->tx_buf, 1, + (uint8_t *)&p_spi_info->rx_buf, 1); + } + else // master + { + nrf_drv_spi_mode_t spi_modes[4] = { + NRF_DRV_SPI_MODE_0, + NRF_DRV_SPI_MODE_1, + NRF_DRV_SPI_MODE_2, + NRF_DRV_SPI_MODE_3, + }; + nrf_drv_spi_mode_t new_mode = spi_modes[mode]; + + // If the peripheral is currently working as a slave, the SDK driver + // it uses needs to be switched from SPIS to SPI. + if (!p_spi_info->master) { + nrf_drv_spis_uninit(SLAVE_INST(obj)); + } + // I the SPI mode has to be changed, the SDK's SPI driver needs to be + // re-initialized (there is no other way to change its configuration). + else if (p_spi_info->spi_mode != (uint8_t)new_mode) { + nrf_drv_spi_uninit(MASTER_INST(obj)); + } + else { + return; + } + + p_spi_info->spi_mode = (uint8_t)new_mode; + p_spi_info->master = true; + p_spi_info->flag.busy = false; + + // Initialize SDK's SPI driver with the new configuration. + nrf_drv_spi_config_t config; + prepare_master_config(&config, p_spi_info); + (void)nrf_drv_spi_init(MASTER_INST(obj), &config, + m_master_event_handlers[SPI_IDX(obj)]); + } +} + +static nrf_drv_spi_frequency_t freq_translate(int hz) +{ + nrf_drv_spi_frequency_t frequency; + if (hz<250000) { //125Kbps + frequency = NRF_DRV_SPI_FREQ_125K; + } else if (hz<500000) { //250Kbps + frequency = NRF_DRV_SPI_FREQ_250K; + } else if (hz<1000000) { //500Kbps + frequency = NRF_DRV_SPI_FREQ_500K; + } else if (hz<2000000) { //1Mbps + frequency = NRF_DRV_SPI_FREQ_1M; + } else if (hz<4000000) { //2Mbps + frequency = NRF_DRV_SPI_FREQ_2M; + } else if (hz<8000000) { //4Mbps + frequency = NRF_DRV_SPI_FREQ_4M; + } else { //8Mbps + frequency = NRF_DRV_SPI_FREQ_8M; + } + return frequency; +} + +void spi_frequency(spi_t *obj, int hz) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + nrf_drv_spi_frequency_t new_frequency = freq_translate(hz); + + if (p_spi_info->master) + { + if (p_spi_info->frequency != new_frequency) { + p_spi_info->frequency = new_frequency; + + nrf_drv_spi_config_t config; + prepare_master_config(&config, p_spi_info); + + nrf_drv_spi_t const *p_spi = MASTER_INST(obj); + nrf_drv_spi_uninit(p_spi); + (void)nrf_drv_spi_init(p_spi, &config, + m_master_event_handlers[SPI_IDX(obj)]); + } + } + // There is no need to set anything in slaves when it comes to frequency, + // since slaves just synchronize with the clock provided by a master. +} + +int spi_master_write(spi_t *obj, int value) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + +#if DEVICE_SPI_ASYNCH + while (p_spi_info->flag.busy) { + } +#endif + + p_spi_info->tx_buf = value; + p_spi_info->flag.busy = true; + (void)nrf_drv_spi_transfer(MASTER_INST(obj), + (uint8_t const *)&p_spi_info->tx_buf, 1, + (uint8_t *)&p_spi_info->rx_buf, 1); + while (p_spi_info->flag.busy) { + } + + return p_spi_info->rx_buf; +} + +int spi_slave_receive(spi_t *obj) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + MBED_ASSERT(!p_spi_info->master); + return p_spi_info->flag.readable; +; +} + +int spi_slave_read(spi_t *obj) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + MBED_ASSERT(!p_spi_info->master); + while (!p_spi_info->flag.readable) { + } + p_spi_info->flag.readable = false; + return p_spi_info->rx_buf; +} + +void spi_slave_write(spi_t *obj, int value) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + MBED_ASSERT(!p_spi_info->master); + + p_spi_info->tx_buf = (uint8_t)value; +} + +#if DEVICE_SPI_ASYNCH + +void spi_master_transfer(spi_t *obj, + const void *tx, size_t tx_length, + void *rx, size_t rx_length, uint8_t bit_width, + uint32_t handler, uint32_t event, DMAUsage hint) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + MBED_ASSERT(p_spi_info->master); + (void)hint; + (void)bit_width; + + p_spi_info->handler = handler; + p_spi_info->event = event; + + p_spi_info->flag.busy = true; + (void)nrf_drv_spi_transfer(MASTER_INST(obj), + (uint8_t const *)tx, tx_length, + (uint8_t *)rx, rx_length); +} + +uint32_t spi_irq_handler_asynch(spi_t *obj) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + MBED_ASSERT(p_spi_info->master); + return p_spi_info->event & SPI_EVENT_COMPLETE; +} + +uint8_t spi_active(spi_t *obj) +{ + spi_info_t *p_spi_info = SPI_INFO(obj); + MBED_ASSERT(p_spi_info->master); + return p_spi_info->flag.busy; +} + +void spi_abort_asynch(spi_t *obj) +{ + MBED_ASSERT(SPI_INFO(obj)->master); + nrf_drv_spi_abort(MASTER_INST(obj)); +} + +#endif // DEVICE_SPI_ASYNCH + +#endif // DEVICE_SPI diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c new file mode 100644 index 0000000000..d3a9c9d63e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c @@ -0,0 +1,573 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "us_ticker_api.h" +#include "common_rtc.h" +#include "app_util.h" +#include "nrf_drv_common.h" +#include "nrf_drv_config.h" +#include "lp_ticker_api.h" + + +//------------------------------------------------------------------------------ +// Common stuff used also by lp_ticker and rtc_api (see "common_rtc.h"). +// +#include "app_util_platform.h" + +bool m_common_rtc_enabled = false; +uint32_t volatile m_common_rtc_overflows = 0; + +#if defined(TARGET_MCU_NRF51822) +void common_rtc_irq_handler(void) +#else +void COMMON_RTC_IRQ_HANDLER(void) +#endif +{ + if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, US_TICKER_EVENT)) { + us_ticker_irq_handler(); + } + +#if DEVICE_LOWPOWERTIMER + if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, LP_TICKER_EVENT)) { + + lp_ticker_irq_handler(); + } +#endif + + if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, NRF_RTC_EVENT_OVERFLOW)) { + nrf_rtc_event_clear(COMMON_RTC_INSTANCE, NRF_RTC_EVENT_OVERFLOW); + // Don't disable this event. It shall occur periodically. + + ++m_common_rtc_overflows; + } +} + +#if (defined (__ICCARM__)) && defined(TARGET_MCU_NRF51822)//IAR +__stackless __task +#endif +void RTC1_IRQHandler(void); + +void common_rtc_init(void) +{ + if (m_common_rtc_enabled) { + return; + } + + NVIC_SetVector(RTC1_IRQn, (uint32_t)RTC1_IRQHandler); + + // RTC is driven by the low frequency (32.768 kHz) clock, a proper request + // must be made to have it running. + // Currently this clock is started in 'SystemInit' (see "system_nrf51.c" + // or "system_nrf52.c", respectively). + + nrf_rtc_prescaler_set(COMMON_RTC_INSTANCE, 0); + + nrf_rtc_event_clear(COMMON_RTC_INSTANCE, US_TICKER_EVENT); +#if defined(TARGET_MCU_NRF51822) + nrf_rtc_event_clear(COMMON_RTC_INSTANCE, OS_TICK_EVENT); +#endif +#if DEVICE_LOWPOWERTIMER + nrf_rtc_event_clear(COMMON_RTC_INSTANCE, LP_TICKER_EVENT); +#endif + nrf_rtc_event_clear(COMMON_RTC_INSTANCE, NRF_RTC_EVENT_OVERFLOW); + + // Interrupts on all related events are enabled permanently. Particular + // events will be enabled or disabled as needed (such approach is more + // energy efficient). + nrf_rtc_int_enable(COMMON_RTC_INSTANCE, + #if DEVICE_LOWPOWERTIMER + LP_TICKER_INT_MASK | + #endif + US_TICKER_INT_MASK | + NRF_RTC_INT_OVERFLOW_MASK); + + // This event is enabled permanently, since overflow indications are needed + // continuously. + nrf_rtc_event_enable(COMMON_RTC_INSTANCE, NRF_RTC_INT_OVERFLOW_MASK); + // All other relevant events are initially disabled. + nrf_rtc_event_disable(COMMON_RTC_INSTANCE, + #if defined(TARGET_MCU_NRF51822) + OS_TICK_INT_MASK | + #endif + #if DEVICE_LOWPOWERTIMER + LP_TICKER_INT_MASK | + #endif + US_TICKER_INT_MASK); + + nrf_drv_common_irq_enable(nrf_drv_get_IRQn(COMMON_RTC_INSTANCE), +#ifdef NRF51 + APP_IRQ_PRIORITY_LOW +#elif defined(NRF52) + APP_IRQ_PRIORITY_LOWEST +#endif + ); + + nrf_rtc_task_trigger(COMMON_RTC_INSTANCE, NRF_RTC_TASK_START); + + m_common_rtc_enabled = true; +} + +uint32_t common_rtc_32bit_ticks_get(void) +{ + uint32_t ticks = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); + // The counter used for time measurements is less than 32 bit wide, + // so its value is complemented with the number of registered overflows + // of the counter. + ticks += (m_common_rtc_overflows << RTC_COUNTER_BITS); + return ticks; +} + +uint64_t common_rtc_64bit_us_get(void) +{ + uint32_t ticks = common_rtc_32bit_ticks_get(); + // [ticks -> microseconds] + return ROUNDED_DIV(((uint64_t)ticks) * 1000000, RTC_INPUT_FREQ); +} + +void common_rtc_set_interrupt(uint32_t us_timestamp, uint32_t cc_channel, + uint32_t int_mask) +{ + // The internal counter is clocked with a frequency that cannot be easily + // multiplied to 1 MHz, therefore besides the translation of values + // (microsecond <-> ticks) a special care of overflows handling must be + // taken. Here the 32-bit timestamp value is complemented with information + // about current the system up time of (ticks + number of overflows of tick + // counter on upper bits, converted to microseconds), and such 64-bit value + // is then translated to counter ticks. Finally, the lower 24 bits of thus + // calculated value is written to the counter compare register to prepare + // the interrupt generation. + uint64_t current_time64 = common_rtc_64bit_us_get(); + // [add upper 32 bits from the current time to the timestamp value] + uint64_t timestamp64 = us_timestamp + + (current_time64 & ~(uint64_t)0xFFFFFFFF); + // [if the original timestamp value happens to be after the 32 bit counter + // of microsends overflows, correct the upper 32 bits accordingly] + if (us_timestamp < (uint32_t)(current_time64 & 0xFFFFFFFF)) { + timestamp64 += ((uint64_t)1 << 32); + } + // [microseconds -> ticks, always round the result up to avoid too early + // interrupt generation] + uint32_t compare_value = + (uint32_t)CEIL_DIV((timestamp64) * RTC_INPUT_FREQ, 1000000); + + // The COMPARE event occurs when the value in compare register is N and + // the counter value changes from N-1 to N. Therefore, the minimal safe + // difference between the compare value to be set and the current counter + // value is 2 ticks. This guarantees that the compare trigger is properly + // setup before the compare condition occurs. + uint32_t closest_safe_compare = common_rtc_32bit_ticks_get() + 2; + if ((int)(compare_value - closest_safe_compare) <= 0) { + compare_value = closest_safe_compare; + } + + nrf_rtc_cc_set(COMMON_RTC_INSTANCE, cc_channel, RTC_WRAP(compare_value)); + nrf_rtc_event_enable(COMMON_RTC_INSTANCE, int_mask); +} +//------------------------------------------------------------------------------ + + +void us_ticker_init(void) +{ + common_rtc_init(); +} + +uint32_t us_ticker_read() +{ + us_ticker_init(); + return (uint32_t)common_rtc_64bit_us_get(); +} + +void us_ticker_set_interrupt(timestamp_t timestamp) +{ + common_rtc_set_interrupt(timestamp, + US_TICKER_CC_CHANNEL, US_TICKER_INT_MASK); +} + +void us_ticker_disable_interrupt(void) +{ + nrf_rtc_event_disable(COMMON_RTC_INSTANCE, US_TICKER_INT_MASK); +} + +void us_ticker_clear_interrupt(void) +{ + nrf_rtc_event_clear(COMMON_RTC_INSTANCE, US_TICKER_EVENT); +} + + +// Since there is no SysTick on NRF51, the RTC1 channel 1 is used as an +// alternative source of RTOS ticks. +#if defined(TARGET_MCU_NRF51822) + +#include "toolchain.h" + + +#define MAX_RTC_COUNTER_VAL ((1uL << RTC_COUNTER_BITS) - 1) + +/** + * The value previously set in the capture compare register of channel 1 + */ +static uint32_t previous_tick_cc_value = 0; + +/* + RTX provide the following definitions which are used by the tick code: + * os_trv: The number (minus 1) of clock cycle between two tick. + * os_clockrate: Time duration between two ticks (in us). + * OS_Tick_Handler: The function which handle a tick event. + This function is special because it never returns. + Those definitions are used by the code which handle the os tick. + To allow compilation of us_ticker programs without RTOS, those symbols are + exported from this module as weak ones. + */ +MBED_WEAK uint32_t const os_trv; +MBED_WEAK uint32_t const os_clockrate; +MBED_WEAK void OS_Tick_Handler() { } + + +#if defined (__CC_ARM) /* ARMCC Compiler */ + +__asm void COMMON_RTC_IRQ_HANDLER(void) +{ + IMPORT OS_Tick_Handler + IMPORT common_rtc_irq_handler + + /** + * Chanel 1 of RTC1 is used by RTX as a systick. + * If the compare event on channel 1 is set, then branch to OS_Tick_Handler. + * Otherwise, just execute common_rtc_irq_handler. + * This function has to be written in assembly and tagged as naked because OS_Tick_Handler + * will never return. + * A c function would put lr on the stack before calling OS_Tick_Handler and this value + * would never been dequeued. + * + * \code + * void COMMON_RTC_IRQ_HANDLER(void) { + if(NRF_RTC1->EVENTS_COMPARE[1]) { + // never return... + OS_Tick_Handler(); + } else { + common_rtc_irq_handler(); + } + } + * \endcode + */ + ldr r0,=0x40011144 + ldr r1, [r0, #0] + cmp r1, #0 + beq US_TICKER_HANDLER + bl OS_Tick_Handler +US_TICKER_HANDLER + push {r3, lr} + bl common_rtc_irq_handler + pop {r3, pc} + ; ALIGN ; +} + +#elif defined (__GNUC__) /* GNU Compiler */ + +__attribute__((naked)) void COMMON_RTC_IRQ_HANDLER(void) +{ + /** + * Chanel 1 of RTC1 is used by RTX as a systick. + * If the compare event on channel 1 is set, then branch to OS_Tick_Handler. + * Otherwise, just execute common_rtc_irq_handler. + * This function has to be written in assembly and tagged as naked because OS_Tick_Handler + * will never return. + * A c function would put lr on the stack before calling OS_Tick_Handler and this value + * would never been dequeued. + * + * \code + * void COMMON_RTC_IRQ_HANDLER(void) { + if(NRF_RTC1->EVENTS_COMPARE[1]) { + // never return... + OS_Tick_Handler(); + } else { + common_rtc_irq_handler(); + } + } + * \endcode + */ + __asm__ ( + "ldr r0,=0x40011144\n" + "ldr r1, [r0, #0]\n" + "cmp r1, #0\n" + "beq US_TICKER_HANDLER\n" + "bl OS_Tick_Handler\n" + "US_TICKER_HANDLER:\n" + "push {r3, lr}\n" + "bl common_rtc_irq_handler\n" + "pop {r3, pc}\n" + "nop" + ); +} + +#elif defined (__ICCARM__)//IAR +void common_rtc_irq_handler(void); + +__stackless __task void COMMON_RTC_IRQ_HANDLER(void) +{ + uint32_t temp; + + __asm volatile( + " ldr %[temp], [%[reg2check]] \n" + " cmp %[temp], #0 \n" + " beq 1f \n" + " bl.w OS_Tick_Handler \n" + "1: \n" + " push {r3, lr}\n" + " blx %[rtc_irq] \n" + " pop {r3, pc}\n" + + : /* Outputs */ + [temp] "=&r"(temp) + : /* Inputs */ + [reg2check] "r"(0x40011144), + [rtc_irq] "r"(common_rtc_irq_handler) + : /* Clobbers */ + "cc" + ); + (void)temp; +} + + +#else + +#error Compiler not supported. +#error Provide a definition of COMMON_RTC_IRQ_HANDLER. + +/* + * Chanel 1 of RTC1 is used by RTX as a systick. + * If the compare event on channel 1 is set, then branch to OS_Tick_Handler. + * Otherwise, just execute common_rtc_irq_handler. + * This function has to be written in assembly and tagged as naked because OS_Tick_Handler + * will never return. + * A c function would put lr on the stack before calling OS_Tick_Handler and this value + * will never been dequeued. After a certain time a stack overflow will happen. + * + * \code + * void COMMON_RTC_IRQ_HANDLER(void) { + if(NRF_RTC1->EVENTS_COMPARE[1]) { + // never return... + OS_Tick_Handler(); + } else { + common_rtc_irq_handler(); + } + } + * \endcode + */ + +#endif + +/** + * Return the next number of clock cycle needed for the next tick. + * @note This function has been carrefuly optimized for a systick occuring every 1000us. + */ +static uint32_t get_next_tick_cc_delta() { + uint32_t delta = 0; + + if (os_clockrate != 1000) { + // In RTX, by default SYSTICK is is used. + // A tick event is generated every os_trv + 1 clock cycles of the system timer. + delta = os_trv + 1; + } else { + // If the clockrate is set to 1000us then 1000 tick should happen every second. + // Unfortunatelly, when clockrate is set to 1000, os_trv is equal to 31. + // If (os_trv + 1) is used as the delta value between two ticks, 1000 ticks will be + // generated in 32000 clock cycle instead of 32768 clock cycles. + // As a result, if a user schedule an OS timer to start in 100s, the timer will start + // instead after 97.656s + // The code below fix this issue, a clock rate of 1000s will generate 1000 ticks in 32768 + // clock cycles. + // The strategy is simple, for 1000 ticks: + // * 768 ticks will occur 33 clock cycles after the previous tick + // * 232 ticks will occur 32 clock cycles after the previous tick + // By default every delta is equal to 33. + // Every five ticks (20%, 200 delta in one second), the delta is equal to 32 + // The remaining (32) deltas equal to 32 are distributed using primes numbers. + static uint32_t counter = 0; + if ((counter % 5) == 0 || (counter % 31) == 0 || (counter % 139) == 0 || (counter == 503)) { + delta = 32; + } else { + delta = 33; + } + ++counter; + if (counter == 1000) { + counter = 0; + } + } + return delta; +} + +static inline void clear_tick_interrupt() { + nrf_rtc_event_clear(COMMON_RTC_INSTANCE, OS_TICK_EVENT); + nrf_rtc_event_disable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK); +} + +/** + * Indicate if a value is included in a range which can be wrapped. + * @param begin start of the range + * @param end end of the range + * @param val value to check + * @return true if the value is included in the range and false otherwise. + */ +static inline bool is_in_wrapped_range(uint32_t begin, uint32_t end, uint32_t val) { + // regular case, begin < end + // return true if begin <= val < end + if (begin < end) { + if (begin <= val && val < end) { + return true; + } else { + return false; + } + } else { + // In this case end < begin because it has wrap around the limits + // return false if end < val < begin + if (end < val && val < begin) { + return false; + } else { + return true; + } + } + +} + +/** + * Register the next tick. + */ +static void register_next_tick() { + previous_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); + uint32_t delta = get_next_tick_cc_delta(); + uint32_t new_compare_value = (previous_tick_cc_value + delta) & MAX_RTC_COUNTER_VAL; + + // Disable irq directly for few cycles, + // Validation of the new CC value against the COUNTER, + // Setting the new CC value and enabling CC IRQ should be an atomic operation + // Otherwise, there is a possibility to set an invalid CC value because + // the RTC1 keeps running. + // This code is very short 20-38 cycles in the worst case, it shouldn't + // disturb softdevice. + __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 + if (is_in_wrapped_range(previous_tick_cc_value, new_compare_value, current_counter + 1) == false) { + new_compare_value = current_counter + delta; + } + nrf_rtc_cc_set(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL, new_compare_value); + // 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); + __enable_irq(); +} + +/** + * Initialize alternative hardware timer as RTX kernel timer + * This function is directly called by RTX. + * @note this function shouldn't be called directly. + * @return IRQ number of the alternative hardware timer + */ +int os_tick_init (void) +{ + common_rtc_init(); + nrf_rtc_int_enable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK); + + nrf_rtc_cc_set(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL, 0); + register_next_tick(); + + return nrf_drv_get_IRQn(COMMON_RTC_INSTANCE); +} + +/** + * Acknowledge the tick interrupt. + * This function is called by the function OS_Tick_Handler of RTX. + * @note this function shouldn't be called directly. + */ +void os_tick_irqack(void) +{ + clear_tick_interrupt(); + register_next_tick(); +} + +/** + * Returns the overflow flag of the alternative hardware timer. + * @note This function is exposed by RTX kernel. + * @return 1 if the timer has overflowed and 0 otherwise. + */ +uint32_t os_tick_ovf(void) { + uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); + uint32_t next_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); + + return is_in_wrapped_range(previous_tick_cc_value, next_tick_cc_value, current_counter) ? 0 : 1; +} + +/** + * Return the value of the alternative hardware timer. + * @note The documentation is not very clear about what is expected as a result, + * is it an ascending counter, a descending one ? + * None of this is specified. + * The default systick is a descending counter and this function return values in + * descending order, even if the internal counter used is an ascending one. + * @return the value of the alternative hardware timer. + */ +uint32_t os_tick_val(void) { + uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); + uint32_t next_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); + + // do not use os_tick_ovf because its counter value can be different + if(is_in_wrapped_range(previous_tick_cc_value, next_tick_cc_value, current_counter)) { + if (next_tick_cc_value > previous_tick_cc_value) { + return next_tick_cc_value - current_counter; + } else if(current_counter <= next_tick_cc_value) { + return next_tick_cc_value - current_counter; + } else { + return next_tick_cc_value + (MAX_RTC_COUNTER_VAL - current_counter); + } + } else { + // use (os_trv + 1) has the base step, can be totally inacurate ... + uint32_t clock_cycles_by_tick = os_trv + 1; + + // if current counter has wrap arround, add the limit to it. + if (current_counter < next_tick_cc_value) { + current_counter = current_counter + MAX_RTC_COUNTER_VAL; + } + + return clock_cycles_by_tick - ((current_counter - next_tick_cc_value) % clock_cycles_by_tick); + } + +} + +#endif // defined(TARGET_MCU_NRF51822) From ad5b64b4dd2400bf74c8f4311ed51ab32429a491 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 9 Dec 2016 13:14:33 +0100 Subject: [PATCH 02/31] merge nRF528xx sdk sources into one directory --- .../TARGET_MCU_NRF52832/PeripheralNames.h | 81 +++ .../TARGET_MCU_NRF52832/PortNames.h | 53 ++ .../TARGET_DELTA_DFBM_NQ620/PinNames.h | 202 +++++++ .../TARGET_DELTA_DFBM_NQ620/device.h | 38 ++ .../TARGET_DELTA_DFBM_NQ620/mbed_overrides.c | 21 + .../TARGET_NRF52_DK/PinNames.h | 203 +++++++ .../TARGET_NRF52_DK/device.h | 38 ++ .../TARGET_UBLOX_EVA_NINA/PinNames.h | 106 ++++ .../TARGET_UBLOX_EVA_NINA/device.h | 23 + .../TARGET_MCU_NRF52832/analogin_api.c | 91 ++++ .../device/TOOLCHAIN_ARM_STD/nRF52832.sct | 27 + .../TOOLCHAIN_ARM_STD/startup_nrf52832.s | 245 +++++++++ .../device/TOOLCHAIN_ARM_STD/sys.cpp | 31 ++ .../device/TOOLCHAIN_GCC_ARM/NRF52832.ld | 190 +++++++ .../TOOLCHAIN_GCC_ARM/startup_NRF52832.S | 270 ++++++++++ .../device/TOOLCHAIN_IAR/nRF52832.icf | 46 ++ .../TOOLCHAIN_IAR/startup_NRF52832_IAR.s | 381 ++++++++++++++ .../TARGET_MCU_NRF52832/device/cmsis.h | 24 + .../TARGET_MCU_NRF52832/device/cmsis_nvic.c | 43 ++ .../TARGET_MCU_NRF52832/device/cmsis_nvic.h | 53 ++ .../TARGET_MCU_NRF52832/device/system_nrf52.c | 321 ++++++++++++ .../TARGET_MCU_NRF52832/device/system_nrf52.h | 78 +++ .../TARGET_MCU_NRF52832/pwmout_api.c | 399 ++++++++++++++ .../TARGET_MCU_NRF52832/sdk/nrf_drv_config.h | 495 ++++++++++++++++++ .../softdevice/s132/headers/nrf52/nrf_mbr.h | 0 .../sdk/softdevice/s132/headers/nrf_ble.h | 0 .../sdk/softdevice/s132/headers/nrf_ble_err.h | 0 .../sdk/softdevice/s132/headers/nrf_ble_gap.h | 0 .../softdevice/s132/headers/nrf_ble_gatt.h | 0 .../softdevice/s132/headers/nrf_ble_gattc.h | 0 .../softdevice/s132/headers/nrf_ble_gatts.h | 0 .../sdk/softdevice/s132/headers/nrf_ble_hci.h | 0 .../softdevice/s132/headers/nrf_ble_l2cap.h | 0 .../softdevice/s132/headers/nrf_ble_ranges.h | 0 .../softdevice/s132/headers/nrf_ble_types.h | 0 .../sdk/softdevice/s132/headers/nrf_error.h | 0 .../softdevice/s132/headers/nrf_error_sdm.h | 0 .../softdevice/s132/headers/nrf_error_soc.h | 0 .../sdk/softdevice/s132/headers/nrf_nvic.h | 0 .../sdk/softdevice/s132/headers/nrf_sd_def.h | 0 .../sdk/softdevice/s132/headers/nrf_sdm.h | 0 .../sdk/softdevice/s132/headers/nrf_soc.h | 0 .../sdk/softdevice/s132/headers/nrf_svc.h | 0 .../s132/hex/s132_nrf52_2.0.0_softdevice.hex | 0 .../drivers_nrf}/pwm/nrf_drv_pwm.c | 0 .../drivers_nrf}/pwm/nrf_drv_pwm.h | 0 .../drivers_nrf}/saadc/nrf_drv_saadc.c | 0 .../drivers_nrf}/saadc/nrf_drv_saadc.h | 0 .../TARGET_NRF5_SDK13/sdk_update.py | 259 +++++++++ .../TARGET_NRF5_SDK13/update_desc.json | 120 +++++ 50 files changed, 3838 insertions(+) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PeripheralNames.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PortNames.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/device.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/device.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/device.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/analogin_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/sys.cpp create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/pwmout_api.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/nrf_drv_config.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_err.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_gap.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_gatt.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_gattc.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_gatts.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_hci.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_l2cap.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_ranges.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_ble_types.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_error.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_error_sdm.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_error_soc.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_nvic.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_sd_def.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_sdm.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_soc.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/headers/nrf_svc.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => TARGET_MCU_NRF52832}/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840/sdk/driver_nrf => sdk/drivers_nrf}/pwm/nrf_drv_pwm.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840/sdk/driver_nrf => sdk/drivers_nrf}/pwm/nrf_drv_pwm.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840/sdk/driver_nrf => sdk/drivers_nrf}/saadc/nrf_drv_saadc.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840/sdk/driver_nrf => sdk/drivers_nrf}/saadc/nrf_drv_saadc.h (100%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk_update.py create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/update_desc.json diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PeripheralNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PeripheralNames.h new file mode 100644 index 0000000000..0fe6da592e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PeripheralNames.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MBED_PERIPHERALNAMES_H +#define MBED_PERIPHERALNAMES_H + +#include "cmsis.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define STDIO_UART_TX TX_PIN_NUMBER +#define STDIO_UART_RX RX_PIN_NUMBER +#define STDIO_UART UART_0 + +typedef enum { + UART_0 = (int)NRF_UART0_BASE +} UARTName; + + +typedef enum { + SPI_0 = (int)NRF_SPI0_BASE, + SPI_1 = (int)NRF_SPI1_BASE, + SPIS = (int)NRF_SPIS1_BASE +} SPIName; + +typedef enum { + PWM_1 = 0, + PWM_2 +} PWMName; + +typedef enum { + I2C_0 = (int)NRF_TWI0_BASE, + I2C_1 = (int)NRF_TWI1_BASE +} I2CName; + +typedef enum { + ADC0_0 = (int)0 +} ADCName; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PortNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PortNames.h new file mode 100644 index 0000000000..c63624639b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PortNames.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MBED_PORTNAMES_H +#define MBED_PORTNAMES_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + Port0 = 0 //GPIO pins 0-31 +} PortName; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h new file mode 100644 index 0000000000..c9cb931707 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MBED_PINNAMES_H +#define MBED_PINNAMES_H + +#include "cmsis.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PIN_INPUT, + PIN_OUTPUT +} PinDirection; + +#define PORT_SHIFT 3 + +typedef enum { + p0 = 0, + p1 = 1, + p2 = 2, + p3 = 3, + p4 = 4, + p5 = 5, + p6 = 6, + p7 = 7, + p8 = 8, + p9 = 9, + p10 = 10, + p11 = 11, + p12 = 12, + p13 = 13, + p14 = 14, + p15 = 15, + p16 = 16, + p17 = 17, + p18 = 18, + p19 = 19, + p20 = 20, + p21 = 21, + p22 = 22, + p23 = 23, + p24 = 24, + p25 = 25, + p26 = 26, + p27 = 27, + p28 = 28, + p29 = 29, + p30 = 30, + p31 = 31, + + P0_0 = p0, + P0_1 = p1, + P0_2 = p2, + P0_3 = p3, + P0_4 = p4, + P0_5 = p5, + P0_6 = p6, + P0_7 = p7, + + P0_8 = p8, + P0_9 = p9, + P0_10 = p10, + P0_11 = p11, + P0_12 = p12, + P0_13 = p13, + P0_14 = p14, + P0_15 = p15, + + P0_16 = p16, + P0_17 = p17, + P0_18 = p18, + P0_19 = p19, + P0_20 = p20, + P0_21 = p21, + P0_22 = p22, + P0_23 = p23, + + P0_24 = p24, + P0_25 = p25, + P0_26 = p26, + P0_27 = p27, + P0_28 = p28, + P0_29 = p29, + P0_30 = p30, + + LED1 = p17, + LED2 = p18, + LED3 = p19, + LED4 = p20, + + BUTTON1 = p13, + BUTTON2 = p14, + BUTTON3 = p15, + BUTTON4 = p16, + + RX_PIN_NUMBER = p11, + TX_PIN_NUMBER = p12, + CTS_PIN_NUMBER = p13, + RTS_PIN_NUMBER = p14, + + // mBed interface Pins + USBTX = TX_PIN_NUMBER, + USBRX = RX_PIN_NUMBER, + + SPI_PSELMOSI0 = p23, + SPI_PSELMISO0 = p24, + SPI_PSELSS0 = p22, + SPI_PSELSCK0 = p25, + + SPI_PSELMOSI1 = p12, + SPI_PSELMISO1 = p13, + SPI_PSELSS1 = p11, + SPI_PSELSCK1 = p14, + + SPIS_PSELMOSI = p12, + SPIS_PSELMISO = p13, + SPIS_PSELSS = p11, + SPIS_PSELSCK = p14, + + I2C_SDA0 = p26, + I2C_SCL0 = p27, + + D0 = p11, + D1 = p12, + D2 = p13, + D3 = p14, + D4 = p15, + D5 = p16, + D6 = p17, + D7 = p18, + + D8 = p19, + D9 = p20, + D10 = p22, + D11 = p23, + D12 = p24, + D13 = p25, + + D14 = p26, + D15 = p27, + + A0 = p3, + A1 = p4, + A2 = p28, + A3 = p29, + A4 = p30, + A5 = p31, + + // Not connected + NC = (int)0xFFFFFFFF +} PinName; + +typedef enum { + PullNone = 0, + PullDown = 1, + PullUp = 3, + PullDefault = PullUp +} PinMode; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/device.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/device.h new file mode 100644 index 0000000000..2427e752ea --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/device.h @@ -0,0 +1,38 @@ +// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches. +// Check the 'features' section of the target description in 'targets.json' for more details. +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MBED_DEVICE_H +#define MBED_DEVICE_H + + + + + + + + + + + + + + + + +#include "objects.h" + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c new file mode 100644 index 0000000000..b1ff3e2fde --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c @@ -0,0 +1,21 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2016 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +void mbed_sdk_init() +{ + printf("", __TIME__, __DATE__); + +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h new file mode 100644 index 0000000000..2b86eca485 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MBED_PINNAMES_H +#define MBED_PINNAMES_H + +#include "cmsis.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PIN_INPUT, + PIN_OUTPUT +} PinDirection; + +#define PORT_SHIFT 3 + +typedef enum { + p0 = 0, + p1 = 1, + p2 = 2, + p3 = 3, + p4 = 4, + p5 = 5, + p6 = 6, + p7 = 7, + p8 = 8, + p9 = 9, + p10 = 10, + p11 = 11, + p12 = 12, + p13 = 13, + p14 = 14, + p15 = 15, + p16 = 16, + p17 = 17, + p18 = 18, + p19 = 19, + p20 = 20, + p21 = 21, + p22 = 22, + p23 = 23, + p24 = 24, + p25 = 25, + p26 = 26, + p27 = 27, + p28 = 28, + p29 = 29, + p30 = 30, + p31 = 31, + + P0_0 = p0, + P0_1 = p1, + P0_2 = p2, + P0_3 = p3, + P0_4 = p4, + P0_5 = p5, + P0_6 = p6, + P0_7 = p7, + + P0_8 = p8, + P0_9 = p9, + P0_10 = p10, + P0_11 = p11, + P0_12 = p12, + P0_13 = p13, + P0_14 = p14, + P0_15 = p15, + + P0_16 = p16, + P0_17 = p17, + P0_18 = p18, + P0_19 = p19, + P0_20 = p20, + P0_21 = p21, + P0_22 = p22, + P0_23 = p23, + + P0_24 = p24, + P0_25 = p25, + P0_26 = p26, + P0_27 = p27, + P0_28 = p28, + P0_29 = p29, + P0_30 = p30, + P0_31 = p31, + + LED1 = p17, + LED2 = p18, + LED3 = p19, + LED4 = p20, + + BUTTON1 = p13, + BUTTON2 = p14, + BUTTON3 = p15, + BUTTON4 = p16, + + RX_PIN_NUMBER = p8, + TX_PIN_NUMBER = p6, + CTS_PIN_NUMBER = p7, + RTS_PIN_NUMBER = p5, + + // mBed interface Pins + USBTX = TX_PIN_NUMBER, + USBRX = RX_PIN_NUMBER, + + SPI_PSELMOSI0 = p23, + SPI_PSELMISO0 = p24, + SPI_PSELSS0 = p22, + SPI_PSELSCK0 = p25, + + SPI_PSELMOSI1 = p12, + SPI_PSELMISO1 = p13, + SPI_PSELSS1 = p11, + SPI_PSELSCK1 = p14, + + SPIS_PSELMOSI = p12, + SPIS_PSELMISO = p13, + SPIS_PSELSS = p11, + SPIS_PSELSCK = p14, + + I2C_SDA0 = p26, + I2C_SCL0 = p27, + + D0 = p11, + D1 = p12, + D2 = p13, + D3 = p14, + D4 = p15, + D5 = p16, + D6 = p17, + D7 = p18, + + D8 = p19, + D9 = p20, + D10 = p22, + D11 = p23, + D12 = p24, + D13 = p25, + + D14 = p26, + D15 = p27, + + A0 = p3, + A1 = p4, + A2 = p28, + A3 = p29, + A4 = p30, + A5 = p31, + + // Not connected + NC = (int)0xFFFFFFFF +} PinName; + +typedef enum { + PullNone = 0, + PullDown = 1, + PullUp = 3, + PullDefault = PullUp +} PinMode; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/device.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/device.h new file mode 100644 index 0000000000..2427e752ea --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/device.h @@ -0,0 +1,38 @@ +// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches. +// Check the 'features' section of the target description in 'targets.json' for more details. +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MBED_DEVICE_H +#define MBED_DEVICE_H + + + + + + + + + + + + + + + + +#include "objects.h" + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h new file mode 100644 index 0000000000..e29473888f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h @@ -0,0 +1,106 @@ +#ifndef MBED_PINNAMES_H +#define MBED_PINNAMES_H + +#include "cmsis.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PIN_INPUT, + PIN_OUTPUT +} PinDirection; + +#define PORT_SHIFT 3 + +typedef enum { + // nRF52 pin names + p0 = 0, + p1 = 1, + p2 = 2, + p3 = 3, + p4 = 4, + p5 = 5, + p6 = 6, + p7 = 7, + p8 = 8, + p9 = 9, + p10 = 10, + p11 = 11, + p12 = 12, + p13 = 13, + p14 = 14, + p15 = 15, + p16 = 16, + p17 = 17, + p18 = 18, + p19 = 19, + p20 = 20, + p21 = 21, + p22 = 22, + p23 = 23, + p24 = 24, + p25 = 25, + p26 = 26, + p27 = 27, + p28 = 28, + p29 = 29, + p30 = 30, + p31 = 31, + NC = (int)0xFFFFFFFF, // Not connected + + //NINA-B1 module pin names + NINA_B1_GPIO_1 = p8, + NINA_B1_GPIO_2 = p11, + NINA_B1_GPIO_3 = p12, + NINA_B1_GPIO_4 = p13, + NINA_B1_GPIO_5 = p14, + NINA_B1_GPIO_7 = p16, + NINA_B1_GPIO_8 = p18, + + NINA_B1_GPIO_16 = p28, + NINA_B1_GPIO_17 = p29, + NINA_B1_GPIO_18 = p30, + + NINA_B1_GPIO_20 = p31, + NINA_B1_GPIO_21 = p7, + NINA_B1_GPIO_22 = p6, + NINA_B1_GPIO_23 = p5, + NINA_B1_GPIO_24 = p2, + NINA_B1_GPIO_25 = p3, + NINA_B1_GPIO_27 = p4, + NINA_B1_GPIO_28 = p9, + NINA_B1_GPIO_29 = p10, + + // Board pins + LED1 = NINA_B1_GPIO_7, // ORANGE + LED2 = NC, + LED3 = NC, + LED4 = NC, + + // Nordic SDK pin names + RX_PIN_NUMBER = p5, + TX_PIN_NUMBER = p6, + CTS_PIN_NUMBER = p7, + RTS_PIN_NUMBER = p31, + I2C_SDA0 = p2, + I2C_SCL0 = p3, + + // mBed interface pins + USBTX = TX_PIN_NUMBER, + USBRX = RX_PIN_NUMBER +} PinName; + +typedef enum { + PullNone = 0, + PullDown = 1, + PullUp = 3, + PullDefault = PullUp +} PinMode; + +#ifdef __cplusplus +} + +#endif +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/device.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/device.h new file mode 100644 index 0000000000..493844b801 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/device.h @@ -0,0 +1,23 @@ +// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches. +// Check the 'features' section of the target description in 'targets.json' for more details. +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MBED_DEVICE_H +#define MBED_DEVICE_H + +#include "objects.h" + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/analogin_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/analogin_api.c new file mode 100644 index 0000000000..d33effecdf --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/analogin_api.c @@ -0,0 +1,91 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mbed_assert.h" +#include "analogin_api.h" +#include "cmsis.h" +#include "pinmap.h" +#include "app_util_platform.h" +#include "nrf_drv_saadc.h" + +#ifdef DEVICE_ANALOGIN + +#define ADC_12BIT_RANGE 0xFFF +#define ADC_RANGE ADC_12BIT_RANGE + +static void analog_in_event_handler(nrf_drv_saadc_evt_t const *p_event)// type of nrf_drv_saadc_event_handler_t +{ + (void) p_event; +} + +static const nrf_drv_saadc_config_t saadc_config = +{ + .resolution = NRF_SAADC_RESOLUTION_12BIT, + .oversample = NRF_SAADC_OVERSAMPLE_DISABLED, + .interrupt_priority = SAADC_CONFIG_IRQ_PRIORITY +}; + +void SAADC_IRQHandler(void); + +void analogin_init(analogin_t *obj, PinName pin) +{ + ret_code_t ret_code; + + NVIC_SetVector(SAADC_IRQn, (uint32_t)SAADC_IRQHandler); + + ret_code = nrf_drv_saadc_init(&saadc_config, analog_in_event_handler); + MBED_ASSERT(((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_INVALID_STATE))); //NRF_ERROR_INVALID_STATE expected for multiple channels used. + + uint8_t saadcIn = nrf_drv_saadc_gpio_to_ain(pin); + MBED_ASSERT(saadcIn != NRF_SAADC_INPUT_DISABLED); + + obj->adc = ADC0_0; // only one instance of ADC in nRF52 SoC + obj->adc_pin = saadcIn - 1; + + nrf_saadc_channel_config_t channel_config = + NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(saadcIn); //Single ended, negative input to ADC shorted to GND. + + ret_code = nrf_drv_saadc_channel_init(obj->adc_pin, &channel_config); + MBED_ASSERT(ret_code == NRF_SUCCESS); +} + + +uint16_t analogin_read_u16(analogin_t *obj) +{ + int16_t adc_value; + ret_code_t ret_code; + + ret_code = nrf_drv_saadc_sample_convert(obj->adc_pin, &adc_value); + MBED_ASSERT(ret_code == NRF_SUCCESS); + + if (adc_value < 0) + { + // Even in the single ended mode measured value can be {-0}. Saturation for avoid casting to a big integer. + return 0; + } + else + { + return (uint16_t) adc_value; + } +} + +float analogin_read(analogin_t *obj) +{ + uint16_t value = analogin_read_u16(obj); + return (float)value * (1.0f / (float)ADC_RANGE); +} + +#endif // DEVICE_ANALOGIN diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct new file mode 100644 index 0000000000..3bb13ec74a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct @@ -0,0 +1,27 @@ +;WITHOUT SOFTDEVICE: +;LR_IROM1 0x00000000 0x00040000 { +; ER_IROM1 0x00000000 0x00040000 { +; *.o (RESET, +First) +; *(InRoot$$Sections) +; .ANY (+RO) +; } +; RW_IRAM1 0x20000000 0x00004000 { +; .ANY (+RW +ZI) +; } +;} +; +;WITH SOFTDEVICE: + +LR_IROM1 0x1C000 0x0064000 { + ER_IROM1 0x1C000 0x0064000 { + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM0 0x20002EF8 UNINIT 0x000000D8 { ;no init section + *(noinit) + } + RW_IRAM1 0x20002FD0 0x0000D030 { + .ANY (+RW +ZI) + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s new file mode 100644 index 0000000000..aac3e2c28f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s @@ -0,0 +1,245 @@ +;/* Copyright (c) 2012 ARM LIMITED +; +; All rights reserved. +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; - Neither the name of ARM nor the names of its contributors may be used +; to endorse or promote products derived from this software without +; specific prior written permission. +; * +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; ---------------------------------------------------------------------------*/ + +__initial_sp EQU 0x20010000 + + PRESERVE8 + THUMB + +; Vector Table Mapped to Address 0 at Reset + + AREA RESET, DATA, READONLY + EXPORT __Vectors + EXPORT __Vectors_End + EXPORT __Vectors_Size + +__Vectors DCD __initial_sp ; Top of Stack + DCD Reset_Handler + DCD NMI_Handler + DCD HardFault_Handler + DCD MemoryManagement_Handler + DCD BusFault_Handler + DCD UsageFault_Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler + DCD DebugMonitor_Handler + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UARTE0_UART0_IRQHandler_v + DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + DCD NFCT_IRQHandler_v + DCD GPIOTE_IRQHandler_v + DCD SAADC_IRQHandler_v + DCD TIMER0_IRQHandler_v + DCD TIMER1_IRQHandler_v + DCD TIMER2_IRQHandler_v + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler_v + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler_v + DCD RTC1_IRQHandler_v + DCD QDEC_IRQHandler_v + DCD COMP_LPCOMP_IRQHandler_v + DCD SWI0_EGU0_IRQHandler_v + DCD SWI1_EGU1_IRQHandler_v + DCD SWI2_EGU2_IRQHandler_v + DCD SWI3_EGU3_IRQHandler_v + DCD SWI4_EGU4_IRQHandler + DCD SWI5_EGU5_IRQHandler + DCD TIMER3_IRQHandler_v + DCD TIMER4_IRQHandler_v + DCD PWM0_IRQHandler_v + DCD PDM_IRQHandler_v + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD MWU_IRQHandler + DCD PWM1_IRQHandler_v + DCD PWM2_IRQHandler_v + DCD SPIM2_SPIS2_SPI2_IRQHandler_v + DCD RTC2_IRQHandler_v + DCD I2S_IRQHandler_v + DCD FPU_IRQHandler_v + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset Handler + + +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + IMPORT nrf_reloc_vector_table + + + LDR R0, =SystemInit + BLX R0 + LDR R0, =nrf_reloc_vector_table + BLX R0 + LDR R0, =__main + BX R0 + ENDP + +; Dummy Exception Handlers (infinite loops which can be modified) + +NMI_Handler PROC + EXPORT NMI_Handler [WEAK] + B . + ENDP +HardFault_Handler\ + PROC + EXPORT HardFault_Handler [WEAK] + B . + ENDP +MemoryManagement_Handler\ + PROC + EXPORT MemoryManagement_Handler [WEAK] + B . + ENDP +BusFault_Handler\ + PROC + EXPORT BusFault_Handler [WEAK] + B . + ENDP +UsageFault_Handler\ + PROC + EXPORT UsageFault_Handler [WEAK] + B . + ENDP +SVC_Handler PROC + EXPORT SVC_Handler [WEAK] + B . + ENDP +DebugMonitor_Handler\ + PROC + EXPORT DebugMonitor_Handler [WEAK] + B . + ENDP +PendSV_Handler PROC + EXPORT PendSV_Handler [WEAK] + B . + ENDP +SysTick_Handler PROC + EXPORT SysTick_Handler [WEAK] + B . + ENDP + +Default_Handler PROC + + EXPORT POWER_CLOCK_IRQHandler [WEAK] + EXPORT RADIO_IRQHandler [WEAK] + EXPORT UARTE0_UART0_IRQHandler_v [WEAK] + EXPORT SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v [WEAK] + EXPORT SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v [WEAK] + EXPORT NFCT_IRQHandler_v [WEAK] + EXPORT GPIOTE_IRQHandler_v [WEAK] + EXPORT SAADC_IRQHandler_v [WEAK] + EXPORT TIMER0_IRQHandler_v [WEAK] + EXPORT TIMER1_IRQHandler_v [WEAK] + EXPORT TIMER2_IRQHandler_v [WEAK] + EXPORT RTC0_IRQHandler [WEAK] + EXPORT TEMP_IRQHandler_v [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT ECB_IRQHandler [WEAK] + EXPORT CCM_AAR_IRQHandler [WEAK] + EXPORT WDT_IRQHandler_v [WEAK] + EXPORT RTC1_IRQHandler_v [WEAK] + EXPORT QDEC_IRQHandler_v [WEAK] + EXPORT COMP_LPCOMP_IRQHandler_v [WEAK] + EXPORT SWI0_EGU0_IRQHandler_v [WEAK] + EXPORT SWI1_EGU1_IRQHandler_v [WEAK] + EXPORT SWI2_EGU2_IRQHandler_v [WEAK] + EXPORT SWI3_EGU3_IRQHandler_v [WEAK] + EXPORT SWI4_EGU4_IRQHandler [WEAK] + EXPORT SWI5_EGU5_IRQHandler [WEAK] + EXPORT TIMER3_IRQHandler_v [WEAK] + EXPORT TIMER4_IRQHandler_v [WEAK] + EXPORT PWM0_IRQHandler_v [WEAK] + EXPORT PDM_IRQHandler_v [WEAK] + EXPORT MWU_IRQHandler [WEAK] + EXPORT PWM1_IRQHandler_v [WEAK] + EXPORT PWM2_IRQHandler_v [WEAK] + EXPORT SPIM2_SPIS2_SPI2_IRQHandler_v [WEAK] + EXPORT RTC2_IRQHandler_v [WEAK] + EXPORT I2S_IRQHandler_v [WEAK] + EXPORT FPU_IRQHandler_v [WEAK] +POWER_CLOCK_IRQHandler +RADIO_IRQHandler +UARTE0_UART0_IRQHandler_v +SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v +SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v +NFCT_IRQHandler_v +GPIOTE_IRQHandler_v +SAADC_IRQHandler_v +TIMER0_IRQHandler_v +TIMER1_IRQHandler_v +TIMER2_IRQHandler_v +RTC0_IRQHandler +TEMP_IRQHandler_v +RNG_IRQHandler +ECB_IRQHandler +CCM_AAR_IRQHandler +WDT_IRQHandler_v +RTC1_IRQHandler_v +QDEC_IRQHandler_v +COMP_LPCOMP_IRQHandler_v +SWI0_EGU0_IRQHandler_v +SWI1_EGU1_IRQHandler_v +SWI2_EGU2_IRQHandler_v +SWI3_EGU3_IRQHandler_v +SWI4_EGU4_IRQHandler +SWI5_EGU5_IRQHandler +TIMER3_IRQHandler_v +TIMER4_IRQHandler_v +PWM0_IRQHandler_v +PDM_IRQHandler_v +MWU_IRQHandler +PWM1_IRQHandler_v +PWM2_IRQHandler_v +SPIM2_SPIS2_SPI2_IRQHandler_v +RTC2_IRQHandler_v +I2S_IRQHandler_v +FPU_IRQHandler_v + B . + ENDP + ALIGN + END diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/sys.cpp b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/sys.cpp new file mode 100644 index 0000000000..2f1024ace8 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/sys.cpp @@ -0,0 +1,31 @@ +/* mbed Microcontroller Library - stackheap + * Copyright (C) 2009-2011 ARM Limited. All rights reserved. + * + * Setup a fixed single stack/heap memory model, + * between the top of the RW/ZI region and the stackpointer + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +extern char Image$$RW_IRAM1$$ZI$$Limit[]; + +extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { + uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; + uint32_t sp_limit = __current_sp(); + + zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned + + struct __initial_stackheap r; + r.heap_base = zi_limit; + r.heap_limit = sp_limit; + return r; +} + +#ifdef __cplusplus +} +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld new file mode 100644 index 0000000000..d049cd8818 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2015 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Linker script to configure memory regions. */ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1C000, LENGTH = 0x64000 + RAM (rwx) : ORIGIN = 0x20002ef8, LENGTH = 0xd108 +} + + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +/* Linker script to place sections and symbol values. Should be used together + * with the other linker script that defines memory regions FLASH and RAM. + * It references the following symbols that must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines the following symbols that the code can use without definition: + * __exidx_start + * __exidx_end + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + + +SECTIONS +{ + .text : + { + KEEP(*(.Vectors)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + . = ALIGN(4); + } > FLASH + __exidx_end = .; + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + . = ALIGN(4); + PROVIDE(__start_fs_data = .); + KEEP(*(.fs_data)) + PROVIDE(__stop_fs_data = .); + + *(.jcr) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + __edata = .; + + .noinit : + { + PROVIDE(__start_noinit = .); + KEEP(*(.noinit)) + PROVIDE(__stop_noinit = .); + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (NOLOAD): + { + __end__ = .; + end = __end__; + *(.heap*); + + /* Expand the heap to reach the stack boundary. */ + ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - 0x800), "heap region overflowed into stack"); + . += (ORIGIN(RAM) + LENGTH(RAM) - 0x800) - .; + } > RAM + PROVIDE(__heap_start = ADDR(.heap)); + PROVIDE(__heap_size = SIZEOF(.heap)); + PROVIDE(__mbed_sbrk_start = ADDR(.heap)); + PROVIDE(__mbed_krbs_start = ADDR(.heap) + SIZEOF(.heap)); + + /* .stack_dummy section does not contain any symbols. It is only + * used for the linker script to calculate the size of stack sections + * and assign values to stack symbols later. */ + .stack (NOLOAD): + { + __StackLimit = .; + *(.stack*) + . += (ORIGIN(RAM) + LENGTH(RAM) - .); + } > RAM + + /* Set the stack top to the end of RAM and move down the stack limit by + * the size of the stack_dummy section. */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack); + PROVIDE(__stack = __StackTop); +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S new file mode 100644 index 0000000000..1c6631e7dd --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* +NOTE: Template files (including this one) are application specific and therefore +expected to be copied into the application project folder prior to its use! +*/ + + .syntax unified + .arch armv7e-m + + .section .Vectors + .align 2 + .globl __Vectors +__Vectors: + .long __StackTop /* Top of Stack */ + .long Reset_Handler + .long NMI_Handler + .long HardFault_Handler + .long MemoryManagement_Handler + .long BusFault_Handler + .long UsageFault_Handler + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long SVC_Handler + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long PendSV_Handler + .long SysTick_Handler + + /* External Interrupts */ + .long POWER_CLOCK_IRQHandler + .long RADIO_IRQHandler + .long UARTE0_UART0_IRQHandler_v + .long SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + .long SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + .long NFCT_IRQHandler_v + .long GPIOTE_IRQHandler_v + .long SAADC_IRQHandler_v + .long TIMER0_IRQHandler_v + .long TIMER1_IRQHandler_v + .long TIMER2_IRQHandler_v + .long RTC0_IRQHandler + .long TEMP_IRQHandler_v + .long RNG_IRQHandler + .long ECB_IRQHandler + .long CCM_AAR_IRQHandler + .long WDT_IRQHandler_v + .long RTC1_IRQHandler_v + .long QDEC_IRQHandler_v + .long COMP_LPCOMP_IRQHandler_v + .long SWI0_EGU0_IRQHandler_v + .long SWI1_EGU1_IRQHandler_v + .long SWI2_EGU2_IRQHandler_v + .long SWI3_EGU3_IRQHandler_v + .long SWI4_EGU4_IRQHandler + .long SWI5_EGU5_IRQHandler + .long TIMER3_IRQHandler_v + .long TIMER4_IRQHandler_v + .long PWM0_IRQHandler_v + .long PDM_IRQHandler_v + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long MWU_IRQHandler + .long PWM1_IRQHandler_v + .long PWM2_IRQHandler_v + .long SPIM2_SPIS2_SPI2_IRQHandler_v + .long RTC2_IRQHandler_v + .long I2S_IRQHandler_v + .long FPU_IRQHandler_v + + + .size __Vectors, . - __Vectors + +/* Reset Handler */ + + .text + .thumb + .thumb_func + .align 1 + .globl Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + .fnstart + + +/* Loop to copy data from read only memory to RAM. The ranges + * of copy from/to are specified by following symbols evaluated in + * linker script. + * __etext: End of code section, i.e., begin of data sections to copy from. + * __data_start__/__data_end__: RAM address range that data should be + * copied to. Both must be aligned to 4 bytes boundary. */ + + ldr r1, =__etext + ldr r2, =__data_start__ + ldr r3, =__data_end__ + + subs r3, r2 + ble .LC0 + +.LC1: + subs r3, 4 + ldr r0, [r1,r3] + str r0, [r2,r3] + bgt .LC1 +.LC0: + + LDR R0, =SystemInit + BLX R0 + LDR R0, =nrf_reloc_vector_table + BLX R0 + LDR R0, =_start + BX R0 + + .pool + .cantunwind + .fnend + .size Reset_Handler,.-Reset_Handler + + .section ".text" + + +/* Dummy Exception Handlers (infinite loops which can be modified) */ + + .weak NMI_Handler + .type NMI_Handler, %function +NMI_Handler: + B . + .size NMI_Handler, . - NMI_Handler + + + .weak HardFault_Handler + .type HardFault_Handler, %function +HardFault_Handler: + B . + .size HardFault_Handler, . - HardFault_Handler + + + .weak MemoryManagement_Handler + .type MemoryManagement_Handler, %function +MemoryManagement_Handler: + B . + .size MemoryManagement_Handler, . - MemoryManagement_Handler + + + .weak BusFault_Handler + .type BusFault_Handler, %function +BusFault_Handler: + B . + .size BusFault_Handler, . - BusFault_Handler + + + .weak UsageFault_Handler + .type UsageFault_Handler, %function +UsageFault_Handler: + B . + .size UsageFault_Handler, . - UsageFault_Handler + + + .weak SVC_Handler + .type SVC_Handler, %function +SVC_Handler: + B . + .size SVC_Handler, . - SVC_Handler + + + .weak PendSV_Handler + .type PendSV_Handler, %function +PendSV_Handler: + B . + .size PendSV_Handler, . - PendSV_Handler + + + .weak SysTick_Handler + .type SysTick_Handler, %function +SysTick_Handler: + B . + .size SysTick_Handler, . - SysTick_Handler + + +/* IRQ Handlers */ + + .globl Default_Handler + .type Default_Handler, %function +Default_Handler: + B . + .size Default_Handler, . - Default_Handler + + .macro IRQ handler + .weak \handler + .set \handler, Default_Handler + .endm + + IRQ POWER_CLOCK_IRQHandler /* restricted */ + IRQ RADIO_IRQHandler /* blocked */ + IRQ UARTE0_UART0_IRQHandler_v + IRQ SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + IRQ SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + IRQ NFCT_IRQHandler_v + IRQ GPIOTE_IRQHandler_v + IRQ SAADC_IRQHandler_v + IRQ TIMER0_IRQHandler_v + IRQ TIMER1_IRQHandler_v + IRQ TIMER2_IRQHandler_v + IRQ RTC0_IRQHandler /* blocked */ + IRQ TEMP_IRQHandler_v + IRQ RNG_IRQHandler /* restricted */ + IRQ ECB_IRQHandler /* restricted */ + IRQ CCM_AAR_IRQHandler /* blocked */ + IRQ WDT_IRQHandler_v + IRQ RTC1_IRQHandler_v + IRQ QDEC_IRQHandler_v + IRQ COMP_LPCOMP_IRQHandler_v + IRQ SWI0_EGU0_IRQHandler_v + IRQ SWI1_EGU1_IRQHandler_v /* restricted for Radio Notification */ + IRQ SWI2_EGU2_IRQHandler_v /* blocked for SoftDevice Event */ + IRQ SWI3_EGU3_IRQHandler_v + IRQ SWI4_EGU4_IRQHandler /* blocked */ + IRQ SWI5_EGU5_IRQHandler /* blocked */ + IRQ TIMER3_IRQHandler_v + IRQ TIMER4_IRQHandler_v + IRQ PWM0_IRQHandler_v + IRQ PDM_IRQHandler_v + IRQ MWU_IRQHandler /* restricted */ + IRQ PWM1_IRQHandler_v + IRQ PWM2_IRQHandler_v + IRQ SPIM2_SPIS2_SPI2_IRQHandler_v + IRQ RTC2_IRQHandler_v + IRQ I2S_IRQHandler_v + IRQ FPU_IRQHandler_v + + .end diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf new file mode 100644 index 0000000000..d8dee15e57 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf @@ -0,0 +1,46 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x1c000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x1c000; +define symbol __ICFEDIT_region_ROM_end__ = 0x7ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002ef8; +define symbol __ICFEDIT_region_RAM_end__ = 0x2000ffff; +export symbol __ICFEDIT_region_RAM_start__; +export symbol __ICFEDIT_region_RAM_end__; +/*-Sizes-*/ +/*Heap 1/4 of ram and stack 1/8*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x1800; +/**** End of ICF editor section. ###ICF###*/ + +define symbol __code_start_soft_device__ = 0x0; + +define memory mem with size = 4G; +define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +keep { section .intvec }; +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; +place in ROM_region { readonly }; +place in RAM_region { readwrite, + block HEAP, + block CSTACK }; + +/*This is used for mbed applications build inside the Embedded workbench +Applications build with the python scritps use a hex merge so need to merge it +inside the linker. The linker can only use binary files so the hex merge is not possible +through the linker. That is why a binary is used instead of a hex image for the embedded project. +*/ +if(isdefinedsymbol(SOFT_DEVICE_BIN)) +{ + place at address mem:__code_start_soft_device__ { section .noinit_softdevice }; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s new file mode 100644 index 0000000000..b27d189e7d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s @@ -0,0 +1,381 @@ +;/* Copyright (c) 2012 ARM LIMITED +; +; All rights reserved. +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are met: +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; - Neither the name of ARM nor the names of its contributors may be used +; to endorse or promote products derived from this software without +; specific prior written permission. +; * +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE +; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +; POSSIBILITY OF SUCH DAMAGE. +; ---------------------------------------------------------------------------*/ + + +; The modules in this file are included in the libraries, and may be replaced +; by any user-defined modules that define the PUBLIC symbol _program_start or +; a user defined start symbol. +; To override the cstartup defined in the library, simply add your modified +; version to the workbench project. +; +; The vector table is normally located at address 0. +; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. +; The name "__vector_table" has special meaning for C-SPY: +; it is where the SP start value is found, and the NVIC vector +; table register (VTOR) is initialized to this address if != 0. + + + + MODULE ?cstartup + + ;; Stack size default : Defined in *.icf (linker file). Can be modified inside EW. + ;; Heap size default : Defined in *.icf (linker file). Can be modified inside EW. + + ;; Forward declaration of sections. + SECTION CSTACK:DATA:NOROOT(3) + + SECTION .intvec:CODE:NOROOT(2) + + EXTERN __iar_program_start + EXTERN SystemInit + EXTERN nrf_reloc_vector_table + PUBLIC __vector_table + PUBLIC __Vectors + PUBLIC __Vectors_End + PUBLIC __Vectors_Size + + DATA + +__vector_table + DCD sfe(CSTACK) + DCD Reset_Handler + DCD NMI_Handler + DCD HardFault_Handler + DCD MemoryManagement_Handler + DCD BusFault_Handler + DCD UsageFault_Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler + DCD DebugMonitor_Handler + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UARTE0_UART0_IRQHandler_v + DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + DCD NFCT_IRQHandler_v + DCD GPIOTE_IRQHandler_v + DCD SAADC_IRQHandler_v + DCD TIMER0_IRQHandler_v + DCD TIMER1_IRQHandler_v + DCD TIMER2_IRQHandler_v + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler_v + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler_v + DCD RTC1_IRQHandler_v + DCD QDEC_IRQHandler_v + DCD COMP_LPCOMP_IRQHandler_v + DCD SWI0_EGU0_IRQHandler_v + DCD SWI1_EGU1_IRQHandler_v + DCD SWI2_EGU2_IRQHandler_v + DCD SWI3_EGU3_IRQHandler_v + DCD SWI4_EGU4_IRQHandler + DCD SWI5_EGU5_IRQHandler + DCD TIMER3_IRQHandler_v + DCD TIMER4_IRQHandler_v + DCD PWM0_IRQHandler_v + DCD PDM_IRQHandler_v + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD MWU_IRQHandler + DCD PWM1_IRQHandler_v + DCD PWM2_IRQHandler_v + DCD SPIM2_SPIS2_SPI2_IRQHandler_v + DCD RTC2_IRQHandler_v + DCD I2S_IRQHandler_v + DCD FPU_IRQHandler_v + + +__Vectors_End +__Vectors EQU __vector_table +__Vectors_Size EQU __Vectors_End - __Vectors + + +; Default handlers. + THUMB + + PUBWEAK Reset_Handler + SECTION .text:CODE:NOROOT(2) +Reset_Handler + + LDR R0, =SystemInit + BLX R0 + LDR R0, =nrf_reloc_vector_table + BLX R0 + LDR R0, =__iar_program_start + BX R0 + + ; Dummy exception handlers + + + PUBWEAK NMI_Handler + SECTION .text:CODE:NOROOT(1) +NMI_Handler + B . + + PUBWEAK HardFault_Handler + SECTION .text:CODE:NOROOT(1) +HardFault_Handler + B . + + PUBWEAK MemoryManagement_Handler + SECTION .text:CODE:NOROOT(1) +MemoryManagement_Handler + B . + + PUBWEAK BusFault_Handler + SECTION .text:CODE:NOROOT(1) +BusFault_Handler + B . + + PUBWEAK UsageFault_Handler + SECTION .text:CODE:NOROOT(1) +UsageFault_Handler + B . + + PUBWEAK SVC_Handler + SECTION .text:CODE:NOROOT(1) +SVC_Handler + B . + + PUBWEAK DebugMonitor_Handler + SECTION .text:CODE:NOROOT(1) +DebugMonitor_Handler + B . + + PUBWEAK PendSV_Handler + SECTION .text:CODE:NOROOT(1) +PendSV_Handler + B . + + PUBWEAK SysTick_Handler + SECTION .text:CODE:NOROOT(1) +SysTick_Handler + B . + + + ; Dummy interrupt handlers + + PUBWEAK POWER_CLOCK_IRQHandler + SECTION .text:CODE:NOROOT(1) +POWER_CLOCK_IRQHandler + B . + + PUBWEAK RADIO_IRQHandler + SECTION .text:CODE:NOROOT(1) +RADIO_IRQHandler + B . + + PUBWEAK UARTE0_UART0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +UARTE0_UART0_IRQHandler_v + B . + + PUBWEAK SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v + B . + + PUBWEAK SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v + B . + + PUBWEAK NFCT_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +NFCT_IRQHandler_v + B . + + PUBWEAK GPIOTE_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +GPIOTE_IRQHandler_v + B . + + PUBWEAK SAADC_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SAADC_IRQHandler_v + B . + + PUBWEAK TIMER0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER0_IRQHandler_v + B . + + PUBWEAK TIMER1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER1_IRQHandler_v + B . + + PUBWEAK TIMER2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER2_IRQHandler_v + B . + + PUBWEAK RTC0_IRQHandler + SECTION .text:CODE:NOROOT(1) +RTC0_IRQHandler + B . + + PUBWEAK TEMP_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TEMP_IRQHandler_v + B . + + PUBWEAK RNG_IRQHandler + SECTION .text:CODE:NOROOT(1) +RNG_IRQHandler + B . + + PUBWEAK ECB_IRQHandler + SECTION .text:CODE:NOROOT(1) +ECB_IRQHandler + B . + + PUBWEAK CCM_AAR_IRQHandler + SECTION .text:CODE:NOROOT(1) +CCM_AAR_IRQHandler + B . + + PUBWEAK WDT_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +WDT_IRQHandler_v + B . + + PUBWEAK RTC1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +RTC1_IRQHandler_v + B . + + PUBWEAK QDEC_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +QDEC_IRQHandler_v + B . + + PUBWEAK COMP_LPCOMP_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +COMP_LPCOMP_IRQHandler_v + B . + + PUBWEAK SWI0_EGU0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SWI0_EGU0_IRQHandler_v + B . + + PUBWEAK SWI1_EGU1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SWI1_EGU1_IRQHandler_v + B . + + PUBWEAK SWI2_EGU2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SWI2_EGU2_IRQHandler_v + B . + + PUBWEAK SWI3_EGU3_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SWI3_EGU3_IRQHandler_v + B . + + PUBWEAK SWI4_EGU4_IRQHandler + SECTION .text:CODE:NOROOT(1) +SWI4_EGU4_IRQHandler + B . + + PUBWEAK SWI5_EGU5_IRQHandler + SECTION .text:CODE:NOROOT(1) +SWI5_EGU5_IRQHandler + B . + + PUBWEAK TIMER3_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER3_IRQHandler_v + B . + + PUBWEAK TIMER4_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +TIMER4_IRQHandler_v + B . + + PUBWEAK PWM0_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PWM0_IRQHandler_v + B . + + PUBWEAK PDM_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PDM_IRQHandler_v + B . + + PUBWEAK MWU_IRQHandler + SECTION .text:CODE:NOROOT(1) +MWU_IRQHandler + B . + + PUBWEAK PWM1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PWM1_IRQHandler_v + B . + + PUBWEAK PWM2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PWM2_IRQHandler_v + B . + + PUBWEAK SPIM2_SPIS2_SPI2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SPIM2_SPIS2_SPI2_IRQHandler_v + B . + + PUBWEAK RTC2_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +RTC2_IRQHandler_v + B . + + PUBWEAK I2S_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +I2S_IRQHandler_v + B . + + PUBWEAK FPU_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +FPU_IRQHandler_v + B . + + + END + + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis.h new file mode 100644 index 0000000000..214885742d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis.h @@ -0,0 +1,24 @@ +/* + * PackageLicenseDeclared: Apache-2.0 + * Copyright (c) 2016 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MBED_CMSIS_H +#define MBED_CMSIS_H + +#include "nrf.h" +#include "cmsis_nvic.h" + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.c new file mode 100644 index 0000000000..2efb6da48c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.c @@ -0,0 +1,43 @@ +/* mbed Microcontroller Library + * CMSIS-style functionality to support dynamic vectors + ******************************************************************************* + * Copyright (c) 2016 ARM Limited. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of ARM Limited nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#include "cmsis_nvic.h" + +extern uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS]; + +void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + nrf_dispatch_vector[IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + +uint32_t NVIC_GetVector(IRQn_Type IRQn) +{ + return nrf_dispatch_vector[IRQn + NVIC_USER_IRQ_OFFSET]; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.h new file mode 100644 index 0000000000..0837075c40 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.h @@ -0,0 +1,53 @@ +/* mbed Microcontroller Library + * CMSIS-style functionality to support dynamic vectors + ******************************************************************************* + * Copyright (c) 2016 ARM Limited. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of ARM Limited nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ + +#ifndef MBED_CMSIS_NVIC_H +#define MBED_CMSIS_NVIC_H + +#define NVIC_NUM_VECTORS (16 + 38) // CORE + MCU Peripherals +#define NVIC_USER_IRQ_OFFSET 16 + +#include "nrf52.h" +#include "cmsis.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); +uint32_t NVIC_GetVector(IRQn_Type IRQn); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.c new file mode 100644 index 0000000000..89d125a37d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.c @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "nrf.h" +#include "system_nrf52.h" +#include "nrf5x_lf_clk_helper.h" + +/*lint ++flb "Enter library region" */ + +#define __SYSTEM_CLOCK_64M (64000000UL) + +static bool errata_16(void); +static bool errata_31(void); +static bool errata_32(void); +static bool errata_36(void); +static bool errata_37(void); +static bool errata_57(void); +static bool errata_66(void); + + +#if defined ( __CC_ARM ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; +#elif defined ( __ICCARM__ ) + __root uint32_t SystemCoreClock = __SYSTEM_CLOCK_64M; +#elif defined ( __GNUC__ ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; +#endif + +void SystemCoreClockUpdate(void) +{ + SystemCoreClock = __SYSTEM_CLOCK_64M; +} + +void SystemInit(void) +{ + /* Workaround for Errata 16 "System: RAM may be corrupt on wakeup from CPU IDLE" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_16()){ + *(volatile uint32_t *)0x4007C074 = 3131961357ul; + } + + /* Workaround for Errata 31 "CLOCK: Calibration values are not correctly loaded from FICR at reset" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_31()){ + *(volatile uint32_t *)0x4000053C = ((*(volatile uint32_t *)0x10000244) & 0x0000E000) >> 13; + } + + /* Workaround for Errata 32 "DIF: Debug session automatically enables TracePort pins" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_32()){ + CoreDebug->DEMCR &= ~CoreDebug_DEMCR_TRCENA_Msk; + } + + /* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_36()){ + NRF_CLOCK->EVENTS_DONE = 0; + NRF_CLOCK->EVENTS_CTTO = 0; + NRF_CLOCK->CTIV = 0; + } + + /* Workaround for Errata 37 "RADIO: Encryption engine is slow by default" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_37()){ + *(volatile uint32_t *)0x400005A0 = 0x3; + } + + /* Workaround for Errata 57 "NFCT: NFC Modulation amplitude" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_57()){ + *(volatile uint32_t *)0x40005610 = 0x00000005; + *(volatile uint32_t *)0x40005688 = 0x00000001; + *(volatile uint32_t *)0x40005618 = 0x00000000; + *(volatile uint32_t *)0x40005614 = 0x0000003F; + } + + /* Workaround for Errata 66 "TEMP: Linearity specification not met with default settings" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_66()){ + NRF_TEMP->A0 = NRF_FICR->TEMP.A0; + NRF_TEMP->A1 = NRF_FICR->TEMP.A1; + NRF_TEMP->A2 = NRF_FICR->TEMP.A2; + NRF_TEMP->A3 = NRF_FICR->TEMP.A3; + NRF_TEMP->A4 = NRF_FICR->TEMP.A4; + NRF_TEMP->A5 = NRF_FICR->TEMP.A5; + NRF_TEMP->B0 = NRF_FICR->TEMP.B0; + NRF_TEMP->B1 = NRF_FICR->TEMP.B1; + NRF_TEMP->B2 = NRF_FICR->TEMP.B2; + NRF_TEMP->B3 = NRF_FICR->TEMP.B3; + NRF_TEMP->B4 = NRF_FICR->TEMP.B4; + NRF_TEMP->B5 = NRF_FICR->TEMP.B5; + NRF_TEMP->T0 = NRF_FICR->TEMP.T0; + NRF_TEMP->T1 = NRF_FICR->TEMP.T1; + NRF_TEMP->T2 = NRF_FICR->TEMP.T2; + NRF_TEMP->T3 = NRF_FICR->TEMP.T3; + NRF_TEMP->T4 = NRF_FICR->TEMP.T4; + } + + /* Enable the FPU if the compiler used floating point unit instructions. __FPU_USED is a MACRO defined by the + * compiler. Since the FPU consumes energy, remember to disable FPU use in the compiler if floating point unit + * operations are not used in your code. */ + #if (__FPU_USED == 1) + SCB->CPACR |= (3UL << 20) | (3UL << 22); + __DSB(); + __ISB(); + #endif + + /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined, + two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as + normal GPIOs. */ + #if defined (CONFIG_NFCT_PINS_AS_GPIOS) + if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){ + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NVIC_SystemReset(); + } + #endif + + /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not + defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be + reserved for PinReset and not available as normal GPIO. */ + #if defined (CONFIG_GPIO_AS_PINRESET) + if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) || + ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){ + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->PSELRESET[0] = 21; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->PSELRESET[1] = 21; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NVIC_SystemReset(); + } + #endif + + /* Enable SWO trace functionality. If ENABLE_SWO is not defined, SWO pin will be used as GPIO (see Product + Specification to see which one). */ + #if defined (ENABLE_SWO) + CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; + NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos; + NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + #endif + + /* Enable Trace functionality. If ENABLE_TRACE is not defined, TRACE pins will be used as GPIOs (see Product + Specification to see which ones). */ + #if defined (ENABLE_TRACE) + CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; + NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Parallel << CLOCK_TRACECONFIG_TRACEMUX_Pos; + NRF_P0->PIN_CNF[14] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[15] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[16] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[20] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + #endif + + SystemCoreClockUpdate(); + + // Start the LF oscilator according to the mbed configuration (over the nrf5x_lf_clk_helper.h file) + NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_TO_USE << CLOCK_LFCLKSRC_SRC_Pos); + NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; + NRF_CLOCK->TASKS_LFCLKSTART = 1; + + // Wait for the external oscillator to start up. + while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) { + // Do nothing. + } +} + + +static bool errata_16(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + } + + return false; +} + +static bool errata_31(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) + { + return true; + } + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) + { + return true; + } + } + + return false; +} + +static bool errata_32(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + } + + return false; +} + +static bool errata_36(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) + { + return true; + } + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) + { + return true; + } + } + + return false; +} + +static bool errata_37(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + } + + return false; +} + +static bool errata_57(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) + { + return true; + } + } + + return false; +} + +static bool errata_66(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) + { + return true; + } + } + + return false; +} + + +/*lint --flb "Leave library region" */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.h new file mode 100644 index 0000000000..5ecc271059 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef SYSTEM_NRF52_H +#define SYSTEM_NRF52_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + + +extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ + +/** + * Initialize the system + * + * @param none + * @return none + * + * @brief Setup the microcontroller system. + * Initialize the System and update the SystemCoreClock variable. + */ +extern void SystemInit (void); + +/** + * Update SystemCoreClock variable + * + * @param none + * @return none + * + * @brief Updates the SystemCoreClock with current core Clock + * retrieved from cpu registers. + */ +extern void SystemCoreClockUpdate (void); + +#ifdef __cplusplus +} +#endif + +#endif /* SYSTEM_NRF52_H */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/pwmout_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/pwmout_api.c new file mode 100644 index 0000000000..97e29f256d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/pwmout_api.c @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "mbed_assert.h" +#include "mbed_error.h" +#include "pwmout_api.h" +#include "cmsis.h" +#include "pinmap.h" + +#if DEVICE_PWMOUT + +#include "app_util_platform.h" +#include "nrf_drv_pwm.h" + +#define MAX_PWM_COUNTERTOP (0x7FFF) // 0x7FFF is the max of COUNTERTOP value for the PWM peripherial of the nRF52. +#define MAX_PWM_PERIOD_US (MAX_PWM_COUNTERTOP * 8) // PWM hw is driven by 16 MHz clock, hence the tick is 1_us/16, + // and 128 is the max prescaler value. +#define MAX_PWM_PERIOD_MS ((MAX_PWM_PERIOD_US / 1000) + 1) // approximations advance +#define MAX_PWM_PERIOD_S ((MAX_PWM_PERIOD_US / 1000000) + 1) // approximations advance + + +#define PWM_INSTANCE_COUNT (PWM_COUNT) // import from the nrf_drv_config.h file + +///> instances of nRF52 PWM driver +static const nrf_drv_pwm_t m_pwm_driver[PWM_INSTANCE_COUNT] = +{ +#if PWM0_ENABLED + NRF_DRV_PWM_INSTANCE(0), +#endif +#if PWM1_ENABLED + NRF_DRV_PWM_INSTANCE(1), +#endif +#if PWM2_ENABLED + NRF_DRV_PWM_INSTANCE(2) +#endif +}; + +typedef struct +{ + uint32_t period_us; + uint32_t duty_us; + float duty; +} pwm_signal_t; /// PWM signal description type + +typedef struct +{ + nrf_drv_pwm_t * p_pwm_driver; + pwm_signal_t signal; + volatile nrf_pwm_values_common_t seq_values[1]; +} pwm_t; /// internal PWM instance support type + +static pwm_t m_pwm[PWM_INSTANCE_COUNT] = +{ +#if PWM0_ENABLED + {.p_pwm_driver = NULL}, +#endif +#if PWM1_ENABLED + {.p_pwm_driver = NULL}, +#endif +#if PWM2_ENABLED + {.p_pwm_driver = NULL} +#endif +}; /// Array of internal PWM instances. + +typedef struct +{ + uint16_t period_hwu; // unit related to pwm_clk + uint16_t duty_hwu; // unit related to pwm_clk + nrf_pwm_clk_t pwm_clk; +} pulsewidth_set_t; /// helper type for timing calculations + + +static void internal_pwmout_exe(pwmout_t *obj, bool new_period, bool initialization); + +// extern PWM nIRQ handler implementations +void PWM0_IRQHandler(void); +void PWM1_IRQHandler(void); +void PWM2_IRQHandler(void); + +static const peripheral_handler_desc_t pwm_handlers[PWM_INSTANCE_COUNT] = +{ + { + PWM0_IRQn, + (uint32_t)PWM0_IRQHandler + }, + { + PWM1_IRQn, + (uint32_t)PWM1_IRQHandler + }, + { + PWM2_IRQn, + (uint32_t)PWM2_IRQHandler + } +}; + +void pwmout_init(pwmout_t *obj, PinName pin) +{ + uint32_t i; + + for (i = 0; PWM_INSTANCE_COUNT; i++) + { + if (m_pwm[i].p_pwm_driver == NULL) // a driver instance not assigned to the obj? + { + NVIC_SetVector(pwm_handlers[i].IRQn, pwm_handlers[i].vector); + + obj->pin = pin; + + obj->pwm_channel = i; + + m_pwm[i].p_pwm_driver = (nrf_drv_pwm_t *) &m_pwm_driver[i]; + m_pwm[i].signal.period_us = 200000; // 0.02 s + m_pwm[i].signal.duty_us = 100000; + m_pwm[i].signal.duty = 0.5f; + + obj->pwm_struct = &m_pwm[i]; + + internal_pwmout_exe(obj, true, true); + + break; + } + } + + MBED_ASSERT(i != PWM_INSTANCE_COUNT); // assert if free instance was not found. +} + +void pwmout_free(pwmout_t *obj) +{ + nrf_drv_pwm_uninit( (nrf_drv_pwm_t*) obj->pwm_struct ); + + m_pwm[obj->pwm_channel].p_pwm_driver = NULL; +} + +void pwmout_write(pwmout_t *obj, float percent) +{ + + if (percent < 0) + { + percent = 0; + } + else if (percent > 1) + { + percent = 1; + } + + pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + p_pwm_signal->duty = percent; + + int us = (((int)p_pwm_signal->period_us) * percent); + + pwmout_pulsewidth_us(obj, us); +} + +float pwmout_read(pwmout_t *obj) +{ + pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + return (float)p_pwm_signal->duty_us / (float)p_pwm_signal->period_us; +} + +void pwmout_period(pwmout_t *obj, float seconds) +{ + // raught saturation < 0, quasi-max> + if (seconds > MAX_PWM_PERIOD_S) + { + seconds = MAX_PWM_PERIOD_S; + } + else if (seconds < 0) + { + seconds = 0; // f. pwmout_period_us will set period to min. value + } + + int us = seconds * 1000000; + + pwmout_period_us(obj, us); +} + +void pwmout_period_ms(pwmout_t *obj, int ms) +{ + // reught saturation < 0, quasi-max> + if (ms > MAX_PWM_PERIOD_MS) + { + ms = MAX_PWM_PERIOD_MS; + } + else if (ms < 0) + { + ms = 0; // f. pwmout_period_us will set period to min. value + } + + int us = ms * 1000; + + pwmout_period_us(obj, us); +} + + +void pwmout_period_us(pwmout_t *obj, int us) +{ + pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + // saturation <1, real-max> + if (us > MAX_PWM_PERIOD_US) + { + us = MAX_PWM_PERIOD_US; + } + else if (us < 1) + { + us = 1; + } + + p_pwm_signal->duty_us = (int)((float)us * p_pwm_signal->duty); + + p_pwm_signal->period_us = us; + + internal_pwmout_exe(obj, true, false); +} + +void pwmout_pulsewidth(pwmout_t *obj, float seconds) +{ + // raught saturation < 0, quasi-max> + if (seconds > MAX_PWM_PERIOD_S) + { + seconds = MAX_PWM_PERIOD_S; + } + else if (seconds < 0) + { + seconds = 0; + } + + int us = seconds * 1000000; + + pwmout_pulsewidth_us(obj,us); +} + +void pwmout_pulsewidth_ms(pwmout_t *obj, int ms) +{ + // raught saturation < 0, quasi-max> + if (ms > MAX_PWM_PERIOD_MS) + { + ms = MAX_PWM_PERIOD_MS; + } + else if (ms < 0) + { + ms = 0; + } + + int us = ms * 1000; + + pwmout_pulsewidth_us(obj, us); +} + +void pwmout_pulsewidth_us(pwmout_t *obj, int us) +{ + // saturation <0, real-max> + if (us > MAX_PWM_PERIOD_US) + { + us = MAX_PWM_PERIOD_US; + } + else if (us < 0) + { + us = 0; + } + + pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + p_pwm_signal->duty_us = us; + p_pwm_signal->duty = us / p_pwm_signal->period_us; + + internal_pwmout_exe(obj, false, false); +} + + + + + + +static ret_code_t pulsewidth_us_set_get(int period_hwu, int duty_hwu, pulsewidth_set_t * p_settings) +{ + uint16_t div; + nrf_pwm_clk_t pwm_clk = NRF_PWM_CLK_16MHz; + + for(div = 1; div <= 128 ; div <<= 1) // 128 is the maximum of clock prescaler for PWM peripherial + { + if (MAX_PWM_COUNTERTOP >= period_hwu) + { + p_settings->period_hwu = period_hwu; // unit [us/16 * div] + p_settings->duty_hwu = duty_hwu; // unit [us/16 * div] + p_settings->pwm_clk = pwm_clk; + + return NRF_SUCCESS; + } + + period_hwu >>= 1; + duty_hwu >>= 1; + pwm_clk++; + } + + return NRF_ERROR_INVALID_PARAM; +} + + +static void internal_pwmout_exe(pwmout_t *obj, bool new_period, bool initialization) +{ + pulsewidth_set_t pulsewidth_set; + pwm_signal_t * p_pwm_signal; + nrf_drv_pwm_t * p_pwm_driver; + ret_code_t ret_code; + + p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); + + if (NRF_SUCCESS == pulsewidth_us_set_get(p_pwm_signal->period_us * 16, // base clk for PWM is 16 MHz + p_pwm_signal->duty_us * 16, // base clk for PWM is 16 MHz + &pulsewidth_set)) + { + p_pwm_driver = (((pwm_t*)obj->pwm_struct)->p_pwm_driver); + + const nrf_pwm_sequence_t seq = + { + .values.p_common = (nrf_pwm_values_common_t*) (((pwm_t*)obj->pwm_struct)->seq_values), + .length = 1, + .repeats = 0, + .end_delay = 0 + }; + + (((pwm_t*)obj->pwm_struct)->seq_values)[0] = pulsewidth_set.duty_hwu | 0x8000; + + if (new_period) + { + nrf_drv_pwm_config_t config0 = + { + .output_pins = + { + obj->pin | NRF_DRV_PWM_PIN_INVERTED, // channel 0 + NRF_DRV_PWM_PIN_NOT_USED, // channel 1 + NRF_DRV_PWM_PIN_NOT_USED, // channel 2 + NRF_DRV_PWM_PIN_NOT_USED, // channel 3 + }, + .irq_priority = PWM0_CONFIG_IRQ_PRIORITY, + .base_clock = pulsewidth_set.pwm_clk, + .count_mode = NRF_PWM_MODE_UP, + .top_value = pulsewidth_set.period_hwu, + .load_mode = NRF_PWM_LOAD_COMMON, + .step_mode = NRF_PWM_STEP_AUTO + }; + + if (!initialization) + { + nrf_drv_pwm_uninit(p_pwm_driver); + } + + ret_code = nrf_drv_pwm_init( p_pwm_driver, &config0, NULL); + + MBED_ASSERT(ret_code == NRF_SUCCESS); // assert if free instance was not found. + } + + nrf_drv_pwm_simple_playback(p_pwm_driver, &seq, 0, NRF_DRV_PWM_FLAG_LOOP); + } + else + { + MBED_ASSERT(0); // force assertion + } + +} + +#endif // DEVICE_PWMOUT diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/nrf_drv_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/nrf_drv_config.h new file mode 100644 index 0000000000..4443e68e64 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/nrf_drv_config.h @@ -0,0 +1,495 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NRF_DRV_CONFIG_H +#define NRF_DRV_CONFIG_H + +/** + * Provide a non-zero value here in applications that need to use several + * peripherals with the same ID that are sharing certain resources + * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used + * simultaneously. Therefore, this definition allows to initialize the driver + * for another peripheral from a given group only after the previously used one + * is uninitialized. Normally, this is not possible, because interrupt handlers + * are implemented in individual drivers. + * This functionality requires a more complicated interrupt handling and driver + * initialization, hence it is not always desirable to use it. + */ +#define PERIPHERAL_RESOURCE_SHARING_ENABLED 1 + +/* CLOCK */ +#define CLOCK_ENABLED 1 + +#if (CLOCK_ENABLED == 1) +#define CLOCK_CONFIG_XTAL_FREQ NRF_CLOCK_XTALFREQ_Default +#define CLOCK_CONFIG_LF_SRC NRF_CLOCK_LFCLK_Xtal +#define CLOCK_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +/* GPIOTE */ +#define GPIOTE_ENABLED 1 + +#if (GPIOTE_ENABLED == 1) +#define GPIOTE_CONFIG_USE_SWI_EGU false +#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 8 +#endif + +/* TIMER */ +#ifdef SOFTDEVICE_PRESENT +#define TIMER0_ENABLED 0 +#else +#define TIMER0_ENABLED 1 +#endif + +#if (TIMER0_ENABLED == 1) +#define TIMER0_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER0_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER0_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_32Bit +#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER0_INSTANCE_INDEX 0 +#endif + +#define TIMER1_ENABLED 1 + +#if (TIMER1_ENABLED == 1) +#define TIMER1_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER1_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER1_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit +#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER1_INSTANCE_INDEX (TIMER0_ENABLED) +#endif + +#define TIMER2_ENABLED 1 + +#if (TIMER2_ENABLED == 1) +#define TIMER2_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER2_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER2_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit +#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER2_INSTANCE_INDEX (TIMER1_ENABLED+TIMER0_ENABLED) +#endif + +#define TIMER3_ENABLED 0 + +#if (TIMER3_ENABLED == 1) +#define TIMER3_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER3_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER3_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit +#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER3_INSTANCE_INDEX (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED) +#endif + +#define TIMER4_ENABLED 0 + +#if (TIMER4_ENABLED == 1) +#define TIMER4_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz +#define TIMER4_CONFIG_MODE TIMER_MODE_MODE_Timer +#define TIMER4_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit +#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TIMER4_INSTANCE_INDEX (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED) +#endif + + +#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED) + +/* RTC */ +#define RTC0_ENABLED 0 + +#if (RTC0_ENABLED == 1) +#define RTC0_CONFIG_FREQUENCY 32678 +#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define RTC0_CONFIG_RELIABLE false + +#define RTC0_INSTANCE_INDEX 0 +#endif + +#define RTC1_ENABLED 0 + +#if (RTC1_ENABLED == 1) +#define RTC1_CONFIG_FREQUENCY 32768 +#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define RTC1_CONFIG_RELIABLE false + +#define RTC1_INSTANCE_INDEX (RTC0_ENABLED) +#endif + +#define RTC2_ENABLED 0 + +#if (RTC2_ENABLED == 1) +#define RTC2_CONFIG_FREQUENCY 32768 +#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define RTC2_CONFIG_RELIABLE false + +#define RTC2_INSTANCE_INDEX (RTC0_ENABLED+RTC1_ENABLED) +#endif + + +#define RTC_COUNT (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED) + +#define NRF_MAXIMUM_LATENCY_US 2000 + +/* RNG */ +#define RNG_ENABLED 0 + +#if (RNG_ENABLED == 1) +#define RNG_CONFIG_ERROR_CORRECTION true +#define RNG_CONFIG_POOL_SIZE 8 +#define RNG_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +/* PWM */ + +#define PWM0_ENABLED 1 + +#if (PWM0_ENABLED == 1) +#define PWM0_CONFIG_OUT0_PIN 2 +#define PWM0_CONFIG_OUT1_PIN 3 +#define PWM0_CONFIG_OUT2_PIN 4 +#define PWM0_CONFIG_OUT3_PIN 5 +#define PWM0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define PWM0_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz +#define PWM0_CONFIG_COUNT_MODE NRF_PWM_MODE_UP +#define PWM0_CONFIG_TOP_VALUE 1000 +#define PWM0_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON +#define PWM0_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO + +#define PWM0_INSTANCE_INDEX 0 +#endif + +#define PWM1_ENABLED 1 + +#if (PWM1_ENABLED == 1) +#define PWM1_CONFIG_OUT0_PIN 2 +#define PWM1_CONFIG_OUT1_PIN 3 +#define PWM1_CONFIG_OUT2_PIN 4 +#define PWM1_CONFIG_OUT3_PIN 5 +#define PWM1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define PWM1_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz +#define PWM1_CONFIG_COUNT_MODE NRF_PWM_MODE_UP +#define PWM1_CONFIG_TOP_VALUE 1000 +#define PWM1_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON +#define PWM1_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO + +#define PWM1_INSTANCE_INDEX (PWM0_ENABLED) +#endif + +#define PWM2_ENABLED 1 + +#if (PWM2_ENABLED == 1) +#define PWM2_CONFIG_OUT0_PIN 2 +#define PWM2_CONFIG_OUT1_PIN 3 +#define PWM2_CONFIG_OUT2_PIN 4 +#define PWM2_CONFIG_OUT3_PIN 5 +#define PWM2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define PWM2_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz +#define PWM2_CONFIG_COUNT_MODE NRF_PWM_MODE_UP +#define PWM2_CONFIG_TOP_VALUE 1000 +#define PWM2_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON +#define PWM2_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO + +#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED) +#endif + +#define PWM_COUNT (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED) + +/* SPI */ +#define SPI0_ENABLED 1 + +#if (SPI0_ENABLED == 1) +#define SPI0_USE_EASY_DMA 0 + +#define SPI0_CONFIG_SCK_PIN 2 +#define SPI0_CONFIG_MOSI_PIN 3 +#define SPI0_CONFIG_MISO_PIN 4 +#define SPI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPI0_INSTANCE_INDEX 0 +#endif + +#define SPI1_ENABLED 1 + +#if (SPI1_ENABLED == 1) +#define SPI1_USE_EASY_DMA 0 + +#define SPI1_CONFIG_SCK_PIN 2 +#define SPI1_CONFIG_MOSI_PIN 3 +#define SPI1_CONFIG_MISO_PIN 4 +#define SPI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPI1_INSTANCE_INDEX (SPI0_ENABLED) +#endif + +#define SPI2_ENABLED 1 + +#if (SPI2_ENABLED == 1) +#define SPI2_USE_EASY_DMA 0 + +#define SPI2_CONFIG_SCK_PIN 2 +#define SPI2_CONFIG_MOSI_PIN 3 +#define SPI2_CONFIG_MISO_PIN 4 +#define SPI2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED) +#endif + +#define SPI_COUNT (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED) + +/* SPIS */ +#define SPIS0_ENABLED 1 + +#if (SPIS0_ENABLED == 1) +#define SPIS0_CONFIG_SCK_PIN 2 +#define SPIS0_CONFIG_MOSI_PIN 3 +#define SPIS0_CONFIG_MISO_PIN 4 +#define SPIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPIS0_INSTANCE_INDEX 0 +#endif + +#define SPIS1_ENABLED 1 + +#if (SPIS1_ENABLED == 1) +#define SPIS1_CONFIG_SCK_PIN 2 +#define SPIS1_CONFIG_MOSI_PIN 3 +#define SPIS1_CONFIG_MISO_PIN 4 +#define SPIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED +#endif + +#define SPIS2_ENABLED 1 + +#if (SPIS2_ENABLED == 1) +#define SPIS2_CONFIG_SCK_PIN 2 +#define SPIS2_CONFIG_MOSI_PIN 3 +#define SPIS2_CONFIG_MISO_PIN 4 +#define SPIS2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED) +#endif + +#define SPIS_COUNT (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED) + +/* UART */ +#define UART0_ENABLED 1 + +#if (UART0_ENABLED == 1) +#define UART0_CONFIG_HWFC NRF_UART_HWFC_ENABLED +#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED +#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_9600 +#define UART0_CONFIG_PSEL_TXD 6 +#define UART0_CONFIG_PSEL_RXD 8 +#define UART0_CONFIG_PSEL_CTS 7 +#define UART0_CONFIG_PSEL_RTS 5 +#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH +#ifdef NRF52 +#define UART0_CONFIG_USE_EASY_DMA false +//Compile time flag +#define UART_EASY_DMA_SUPPORT 1 +#define UART_LEGACY_SUPPORT 1 +#endif //NRF52 +#endif + +#define TWI0_ENABLED 1 + +#if (TWI0_ENABLED == 1) +#define TWI0_USE_EASY_DMA 0 + +#define TWI0_CONFIG_FREQUENCY NRF_TWI_FREQ_100K +#define TWI0_CONFIG_SCL 0 +#define TWI0_CONFIG_SDA 1 +#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TWI0_INSTANCE_INDEX 0 +#endif + +#define TWI1_ENABLED 1 + +#if (TWI1_ENABLED == 1) +#define TWI1_USE_EASY_DMA 0 + +#define TWI1_CONFIG_FREQUENCY NRF_TWI_FREQ_100K +#define TWI1_CONFIG_SCL 0 +#define TWI1_CONFIG_SDA 1 +#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + +#define TWI1_INSTANCE_INDEX (TWI0_ENABLED) +#endif + +#define TWI_COUNT (TWI0_ENABLED + TWI1_ENABLED) + +/* TWIS */ +#define TWIS0_ENABLED 0 + +#if (TWIS0_ENABLED == 1) + #define TWIS0_CONFIG_ADDR0 0 + #define TWIS0_CONFIG_ADDR1 0 /* 0: Disabled */ + #define TWIS0_CONFIG_SCL 0 + #define TWIS0_CONFIG_SDA 1 + #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + + #define TWIS0_INSTANCE_INDEX 0 +#endif + +#define TWIS1_ENABLED 0 + +#if (TWIS1_ENABLED == 1) + #define TWIS1_CONFIG_ADDR0 0 + #define TWIS1_CONFIG_ADDR1 0 /* 0: Disabled */ + #define TWIS1_CONFIG_SCL 0 + #define TWIS1_CONFIG_SDA 1 + #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST + + #define TWIS1_INSTANCE_INDEX (TWIS0_ENABLED) +#endif + +#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED) +/* For more documentation see nrf_drv_twis.h file */ +#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 +/* For more documentation see nrf_drv_twis.h file */ +#define TWIS_NO_SYNC_MODE 0 + +/* QDEC */ +#define QDEC_ENABLED 0 + +#if (QDEC_ENABLED == 1) +#define QDEC_CONFIG_REPORTPER NRF_QDEC_REPORTPER_10 +#define QDEC_CONFIG_SAMPLEPER NRF_QDEC_SAMPLEPER_16384us +#define QDEC_CONFIG_PIO_A 1 +#define QDEC_CONFIG_PIO_B 2 +#define QDEC_CONFIG_PIO_LED 3 +#define QDEC_CONFIG_LEDPRE 511 +#define QDEC_CONFIG_LEDPOL NRF_QDEC_LEPOL_ACTIVE_HIGH +#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define QDEC_CONFIG_DBFEN false +#define QDEC_CONFIG_SAMPLE_INTEN false +#endif + +/* ADC */ +#define ADC_ENABLED 0 + +#if (ADC_ENABLED == 1) +#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + + +/* SAADC */ +#define SAADC_ENABLED 1 + +#if (SAADC_ENABLED == 1) +#define SAADC_CONFIG_RESOLUTION NRF_SAADC_RESOLUTION_10BIT +#define SAADC_CONFIG_OVERSAMPLE NRF_SAADC_OVERSAMPLE_DISABLED +#define SAADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +/* PDM */ +#define PDM_ENABLED 0 + +#if (PDM_ENABLED == 1) +#define PDM_CONFIG_MODE NRF_PDM_MODE_MONO +#define PDM_CONFIG_EDGE NRF_PDM_EDGE_LEFTFALLING +#define PDM_CONFIG_CLOCK_FREQ NRF_PDM_FREQ_1032K +#define PDM_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + +/* COMP */ +#define COMP_ENABLED 0 + +#if (COMP_ENABLED == 1) +#define COMP_CONFIG_REF NRF_COMP_REF_Int1V8 +#define COMP_CONFIG_MAIN_MODE NRF_COMP_MAIN_MODE_SE +#define COMP_CONFIG_SPEED_MODE NRF_COMP_SP_MODE_High +#define COMP_CONFIG_HYST NRF_COMP_HYST_NoHyst +#define COMP_CONFIG_ISOURCE NRF_COMP_ISOURCE_Off +#define COMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define COMP_CONFIG_INPUT NRF_COMP_INPUT_0 +#endif + +/* LPCOMP */ +#define LPCOMP_ENABLED 0 + +#if (LPCOMP_ENABLED == 1) +#define LPCOMP_CONFIG_REFERENCE NRF_LPCOMP_REF_SUPPLY_4_8 +#define LPCOMP_CONFIG_DETECTION NRF_LPCOMP_DETECT_DOWN +#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#define LPCOMP_CONFIG_INPUT NRF_LPCOMP_INPUT_0 +#endif + +/* WDT */ +#define WDT_ENABLED 0 + +#if (WDT_ENABLED == 1) +#define WDT_CONFIG_BEHAVIOUR NRF_WDT_BEHAVIOUR_RUN_SLEEP +#define WDT_CONFIG_RELOAD_VALUE 2000 +#define WDT_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH +#endif + +/* SWI EGU */ +#ifdef NRF52 + #define EGU_ENABLED 0 +#endif + +/* I2S */ +#define I2S_ENABLED 0 + +#if (I2S_ENABLED == 1) +#define I2S_CONFIG_SCK_PIN 22 +#define I2S_CONFIG_LRCK_PIN 23 +#define I2S_CONFIG_MCK_PIN NRF_DRV_I2S_PIN_NOT_USED +#define I2S_CONFIG_SDOUT_PIN 24 +#define I2S_CONFIG_SDIN_PIN 25 +#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH +#define I2S_CONFIG_MASTER NRF_I2S_MODE_MASTER +#define I2S_CONFIG_FORMAT NRF_I2S_FORMAT_I2S +#define I2S_CONFIG_ALIGN NRF_I2S_ALIGN_LEFT +#define I2S_CONFIG_SWIDTH NRF_I2S_SWIDTH_16BIT +#define I2S_CONFIG_CHANNELS NRF_I2S_CHANNELS_STEREO +#define I2S_CONFIG_MCK_SETUP NRF_I2S_MCK_32MDIV8 +#define I2S_CONFIG_RATIO NRF_I2S_RATIO_256X +#endif + +#include "nrf_drv_config_validation.h" + +#endif // NRF_DRV_CONFIG_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_err.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_err.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_err.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_err.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gap.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gap.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gap.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatt.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatt.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatt.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gattc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gattc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gattc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gattc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatts.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatts.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_gatts.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatts.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_hci.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_hci.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_hci.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_hci.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_l2cap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_l2cap.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_l2cap.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_l2cap.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_ranges.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_ranges.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_ranges.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_ranges.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_types.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_ble_types.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_types.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_sdm.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_error_soc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_nvic.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sd_def.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sd_def.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_sdm.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_soc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_svc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/headers/nrf_svc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/pwm/nrf_drv_pwm.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/driver_nrf/saadc/nrf_drv_saadc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk_update.py b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk_update.py new file mode 100644 index 0000000000..c37d0e68e4 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk_update.py @@ -0,0 +1,259 @@ +#!python3 +import os, shutil, json, pprint, sys, string, json, argparse +from collections import OrderedDict +from shutil import copyfile, copytree + +def rename_sdk_old_dirs(path, dry_run = False): + # I make assumption that all old sdk dirs have "sdk" names. + sdk_dir_name = "sdk" + path = "." + + for root, dirs, files in os.walk(path): + for name in dirs: + if name == "sdk": + full_path = root + "\\" + name + new_full_path = root + "\\_old_" + name + print("rename " + full_path + " ---> " + new_full_path) + if not dry_run: + os.rename(full_path, new_full_path) + os.mkdir(full_path) + +def rename_dirs(sdk_dirs_in_mbed, new_name, dry_run=False): + + for dir_path in sdk_dirs_in_mbed: + xdir_path = os.path.join('.',dir_path) + new_dir_path = os.path.join(os.path.dirname(xdir_path), new_name) + print("rename " + xdir_path + " ---> " + new_dir_path) + if not dry_run: + os.rename(xdir_path, new_dir_path) + +def get_file_pathes_couples(path_sdk_componets, skip_dirs = [], skip_files = [], verbose = False): + mbed_list = [] + cutted_roots = [] + cutted_files = [] + + path_sdk_componets = path_sdk_componets + '\\' + + for root, dirs, files in os.walk(path_sdk_componets): + procced = True + cutted_root = root[len(path_sdk_componets):] + + for skip_d in skip_dirs: + if 0 == string.find(cutted_root, skip_d): + cutted_roots.append(cutted_root) + procced = False + + if procced: + for file_name in files: + + procced = True + for skip_f in skip_files: + if (-1) != string.find(file_name, skip_f): + cutted_files.append(file_name) + procced = False + + if procced: + if file_name.endswith((".c", ".h")): + #cutted_path = cutted_root + "\\" + file_name + cutted_path = os.path.join(cutted_root, file_name) + #full_path = root + "\\" + file_name + full_path = os.path.join(root, file_name) + item = {"full_path": full_path, "id": cutted_path, "cutted_root": cutted_root} + #mbed_list.append([full_path, cutted_path]) + mbed_list.append(item) + + if verbose: + print("\r\nskipped directories: {0:#d}".format(len(cutted_roots))) + + for xitem in cutted_roots: + print(xitem) + + print("\r\nskipped files: {0:#d}".format(len(cutted_files))) + + for kitem in cutted_files: + print(kitem) + + return mbed_list + +def apply_replacement_id(mbed_list, replacemet_couples): + for item in mbed_list: + splited = os.path.split(item["id"]) + result = string.find(splited[1], replacemet_couples["old"]) + if result != -1: + new_tail = replacemet_couples["new"] + splited[1][len(replacemet_couples["old"]):] + item["id"] = os.path.join(splited[0],new_tail) + #print('bingo!') + #print(item) + + return mbed_list + + +def get_copying_automatic_list(list_mbed, list_sdk, mbed_port_path = '', verbose = False): + copy_list = [] #list of copy items + orphan_list = [] + + licz = 0 + for pathes_mbed in list_mbed: + empty = True + for pathes_sdk in list_sdk: + if pathes_mbed["id"] == pathes_sdk["id"]: + dest_path = pathes_mbed["full_path"] + + dest_path = dest_path[ (len(mbed_port_path)):] + + item = {"id" : pathes_mbed["id"], "src_path": pathes_sdk["full_path"], "dest_path": dest_path, "old_path": pathes_mbed["full_path"]} + copy_list.append(item) + + empty = False; + + + if empty: + orphan_list.append(pathes_mbed["full_path"]) + + print("\r\nfitted files: {0:#d}".format(len(copy_list))) + + if verbose: + for item in copy_list: + str_verbose = "{0} --> {1}" + print(str_verbose.format(item["id"], item["dest_path"])) + + + print("\r\norphaned files: {0:#d}".format(len(orphan_list))) + + if verbose: + for xitem in orphan_list: + print(xitem) + + return copy_list + +def is_in_copying_list(copy_list, file_id): + for pathes_copy in copy_list: + if pathes_copy["id"] == file_id: + + return False + + return True + + +def upgrade_copying_list(copy_list, pathes_sdk, dest_mbed_dir_path, print_list): + splited = os.path.split(pathes_sdk["id"]) + dest_path = os.path.join(dest_mbed_dir_path, splited[1]) + item = {"id" : pathes_sdk["id"], "src_path": pathes_sdk["full_path"], "dest_path": dest_path} #, "old_path": pathes_mbed["full_path"]} + copy_list.append(item) + print_list.append(item) + + + + +def upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, verbose = False): + print_list = [] + + for pathes_sdk in list_sdk: + if is_in_copying_list(copy_list, pathes_sdk["id"]): + + make_hard_copy = False + + for hard_copy_dir in force_copy_dirs_list: + + if 0 == string.find(pathes_sdk["cutted_root"], hard_copy_dir["sdk_dir"]): + + make_hard_copy = True + upgrade_copying_list(copy_list, pathes_sdk, hard_copy_dir["mbed_dir"], print_list) + break + + + print("\r\nforced copy of files by directories: {0:#d}".format(len(print_list))) + + if verbose: + for item in print_list: + str_verbose = "{0} --> {1}" + print(str_verbose.format(item["id"], item["dest_path"])) + +def upgrade_copying_list_by_files(copy_list, list_sdk, force_copy_files_list, verbose = False): + print_list = [] + + for pathes_sdk in list_sdk: + if is_in_copying_list(copy_list, pathes_sdk["id"]): + + make_hard_copy = False + + for hard_copy_file in force_copy_files_list: + if pathes_sdk["id"] == hard_copy_file["sdk_file"]: + make_hard_copy = True + upgrade_copying_list(copy_list, pathes_sdk, hard_copy_file["mbed_dir"], print_list) + break + + print("\r\nforced copy of files by files: {0:#d}".format(len(print_list))) + + if verbose: + for item in print_list: + str_verbose = "{0} --> {1}" + print(str_verbose.format(item["id"], item["dest_path"])) + +def copy_one_file(src, dest, verbose=False): + dirs_to_created = os.path.dirname(dest) + + if not os.path.exists(dirs_to_created): + os.makedirs(dirs_to_created) + print('makerdirs: {0}'.format(dirs_to_created)) + + shutil.copyfile(src, dest) + print('copy: {0} --> {1}'.format(src, dest)) + + + + +if __name__ == '__main__': + argument_parser = argparse.ArgumentParser() + argument_parser.add_argument('-n', '--dry_run', help='Dry run', action='store_true') + argument_parser.add_argument('-v', '--verbose', help='Verbose mode', action='store_true') + #argument_parser.add_argument('-r', '--rename_only', help='rename only', action='store_true') + + parser_args = vars(argument_parser.parse_args()) + + verbose = False + + if parser_args['verbose'] or parser_args['dry_run']: + verbose = True + + with open('update_desc.json') as data_file: + update_desc = json.load(data_file) + + + #if not parser_args ['rename_only']: + ignore_file_list = update_desc['ignore_file_list'] + ignore_dirs_list = update_desc['ignore_dirs_list'] + id_replacements = update_desc['id_replacements'] + force_copy_files_list = update_desc['force_copy_files_list'] + force_copy_dirs_list = update_desc['force_copy_dirs_list'] + sdk_dirs_in_mbed = update_desc['sdk_dirs_in_mbed'] + sdk_component_path = update_desc['sdk_component_path'] + + list_sdk = get_file_pathes_couples(sdk_component_path, + ignore_dirs_list, + ignore_file_list, + verbose) + list_mbed = [] + for directory in sdk_dirs_in_mbed: + list_mbed.extend(get_file_pathes_couples(directory)) + + list_mbed = apply_replacement_id(list_mbed, id_replacements) + + mbed_port_path = '' + + copy_list = get_copying_automatic_list(list_mbed, list_sdk, mbed_port_path, verbose) + + upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, verbose) + upgrade_copying_list_by_files(copy_list, list_sdk, force_copy_files_list, verbose) + + rename_dirs(sdk_dirs_in_mbed, '_old_sdk', parser_args['dry_run']) + + if not parser_args['dry_run']: + for copy_item in copy_list: + src = os.path.join('.',copy_item["src_path"]) + dest = os.path.join('.',copy_item["dest_path"]) + + copy_one_file(src, dest, verbose) + + with open('sdk_update_result.json', 'w') as fp: + json.dump(copy_list, fp) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/update_desc.json b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/update_desc.json new file mode 100644 index 0000000000..526a608671 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/update_desc.json @@ -0,0 +1,120 @@ +{ + "id_replacements" : {"old": "nrf_ble", "new": "ble"}, + "ignore_dirs_list" : [ "ant", + "nfc", + "proprietary_rf", + "serialization", + "toolchain", + "ble\\ble_services\\ble_ancs_c", + "ble\\ble_services\\ble_ans_c", + "ble\\ble_services\\ble_bas", + "ble\\ble_services\\ble_bas_c", + "ble\\ble_services\\ble_bps", + "ble\\ble_services\\ble_cscs", + "ble\\ble_services\\ble_cts_c", + "ble\\ble_services\\ble_dis", + "ble\\ble_services\\ble_escs", + "ble\\ble_services\\ble_gls", + "ble\\ble_services\\ble_hids", + "ble\\ble_services\\ble_hrs", + "ble\\ble_services\\ble_hrs_c", + "ble\\ble_services\\ble_hts", + "ble\\ble_services\\ble_ias", + "ble\\ble_services\\ble_ias_c", + "ble\\ble_services\\ble_lbs", + "ble\\ble_services\\ble_lbs_c", + "ble\\ble_services\\ble_lls", + "ble\\ble_services\\ble_nus", + "ble\\ble_services\\ble_nus_c", + "ble\\ble_services\\ble_rscs", + "ble\\ble_services\\ble_rscs_c", + "ble\\ble_services\\ble_tps", + "ble\\ble_services\\experimental_ble_lns", + "ble\\ble_services\\experimental_nrf_ble_bms", + "ble\\ble_services\\experimental_nrf_ble_cgms", + "drivers_ext", + "softdevice\\s212", + "softdevice\\s332", + "ble\\nrf_ble_qwr", + "libraries\\button", + "libraries\\crc32", + "libraries\\crypto", + "libraries\\csense", + "libraries\\ecc", + "libraries\\fifo", + "libraries\\gpiote", + "libraries\\hardfault", + "libraries\\ic_info", + "libraries\\led_softblink", + "libraries\\low_power_pwm", + "libraries\\mailbox", + "libraries\\mem_manager", + "libraries\\sensorsim", + "libraries\\sha256", + "libraries\\simple_timer", + "libraries\\slip", + "libraries\\timer", + "libraries\\twi", + "libraries\\uart", + "drivers_nrf\\twi_master\\deprecated" + ], + + "ignore_file_list": [ + "dox_config.h", + "ble_error_log.c", + "ble_conn_params.c", + "app_error_weak_cmock.c", + "hci_slip.c", + "hci_slip.h", + "hci_transport.c", + "hci_transport.h", + "spi_5W_master.c", + "spi_5W_master.h", + "app_scheduler_serconn.c" + ], + + "force_copy_files_list" : [{"sdk_file": "sdk_validation.h", "mbed_dir": "sdk"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_comp.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_egu.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_i2s.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_lpcomp.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_peripherals.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_qdec.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_rng.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_twim.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_twis.h", "mbed_dir": "sdk\\drivers_nrf\\hal"}, + {"sdk_file": "drivers_nrf\\hal\\nrf_uarte.h", "mbed_dir": "sdk\\drivers_nrf\\hal"} + ], + + "force_copy_dirs_list" : [{"sdk_dir": "device", "mbed_dir": "sdk\\device"}, + {"sdk_dir": "ble\\ble_dtm", "mbed_dir": "sdk\\ble\\ble_dtm"}, + {"sdk_dir": "drivers_nrf\\comp", "mbed_dir": "sdk\\drivers_nrf\\comp"}, + {"sdk_dir": "drivers_nrf\\i2s", "mbed_dir": "sdk\\drivers_nrf\\i2s"}, + {"sdk_dir": "drivers_nrf\\lpcomp", "mbed_dir": "sdk\\drivers_nrf\\lpcomp"}, + {"sdk_dir": "drivers_nrf\\nrf_soc_nosd", "mbed_dir": "sdk\\drivers_nrf\\nrf_soc_nosd"}, + {"sdk_dir": "drivers_nrf\\pdm", "mbed_dir": "sdk\\drivers_nrf\\pdm"}, + {"sdk_dir": "drivers_nrf\\qdec", "mbed_dir": "sdk\\drivers_nrf\\qdec"}, + {"sdk_dir": "drivers_nrf\\radio_config", "mbed_dir": "sdk\\drivers_nrf\\radio_config"}, + {"sdk_dir": "drivers_nrf\\rng", "mbed_dir": "sdk\\drivers_nrf\\rng"}, + {"sdk_dir": "drivers_nrf\\rtc", "mbed_dir": "sdk\\drivers_nrf\\rtc"}, + {"sdk_dir": "drivers_nrf\\sdio", "mbed_dir": "sdk\\drivers_nrf\\sdio"}, + {"sdk_dir": "drivers_nrf\\swi", "mbed_dir": "sdk\\drivers_nrf\\swi"}, + {"sdk_dir": "drivers_nrf\\twis_slave", "mbed_dir": "sdk\\drivers_nrf\\twis_slave"}, + {"sdk_dir": "drivers_nrf\\uart", "mbed_dir": "sdk\\drivers_nrf\\uart"}, + {"sdk_dir": "drivers_nrf\\wdt", "mbed_dir": "sdk\\drivers_nrf\\wdt"}, + {"sdk_dir": "libraries\\log", "mbed_dir": "sdk\\libraries\\log"}, + {"sdk_dir": "libraries\\bootloader", "mbed_dir": "sdk\\libraries\\bootloader"}, + {"sdk_dir": "libraries\\svc", "mbed_dir": "sdk\\libraries\\svc"}, + {"sdk_dir": "ble\\ble_services\\ble_dfu", "mbed_dir": "ble\\ble_services\\ble_dfu"}, + {"sdk_dir": "libraries\\bootloader", "mbed_dir": "libraries\\bootloader"}, + {"sdk_dir": "softdevice\\s140", "mbed_dir": "TARGET_MCU_NRF52840\\sdk\\softdevice\\s140"} + ], + + "sdk_dirs_in_mbed" : [ + "sdk", + ""TARGET_MCU_NRF52832\\sdk" + + ], + + "sdk_component_path": "C:\\nRF5_SDK_13.0.0-1.alpha_055eef3\\components" +} \ No newline at end of file From 9fa7a61212202fb546ef66d8e7cd4d810045bf60 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 14 Dec 2016 14:26:28 +0100 Subject: [PATCH 03/31] Update nRF5 SDK sources from version v11 to the version nRF5_SDK_13.0.0-1.alpha_055eef3 using .\targets\TARGET_NORDIC\TARGET_NRF5_SDK13\porting_tools\sdk_update.py and .\targets\TARGET_NORDIC\TARGET_NRF5_SDK13\porting_tools\replace_headers.py files .\targets\TARGET_NORDIC\TARGET_NRF5_SDK13\TARGET_MCU_NRF52832\sdk\softdevice\s132\headers\nrf_ble*.h renamed to .\targets\TARGET_NORDIC\TARGET_NRF5_SDK13\TARGET_MCU_NRF52832\sdk\softdevice\s132\headers\ble*.h by hand. --- .../TARGET_MCU_NRF52832/sdk/nrf_drv_config.h | 495 - .../s132/headers/{nrf_ble.h => ble.h} | 154 +- .../s132/headers/{nrf_ble_err.h => ble_err.h} | 1 - .../s132/headers/{nrf_ble_gap.h => ble_gap.h} | 639 +- .../headers/{nrf_ble_gatt.h => ble_gatt.h} | 47 +- .../headers/{nrf_ble_gattc.h => ble_gattc.h} | 161 +- .../headers/{nrf_ble_gatts.h => ble_gatts.h} | 115 +- .../s132/headers/{nrf_ble_hci.h => ble_hci.h} | 11 +- .../headers/{nrf_ble_l2cap.h => ble_l2cap.h} | 13 +- .../{nrf_ble_ranges.h => ble_ranges.h} | 57 +- .../headers/{nrf_ble_types.h => ble_types.h} | 11 +- .../softdevice/s132/headers/nrf52/nrf_mbr.h | 1 - .../sdk/softdevice/s132/headers/nrf_error.h | 3 +- .../softdevice/s132/headers/nrf_error_sdm.h | 1 - .../softdevice/s132/headers/nrf_error_soc.h | 1 - .../sdk/softdevice/s132/headers/nrf_nvic.h | 301 +- .../sdk/softdevice/s132/headers/nrf_sd_def.h | 12 +- .../sdk/softdevice/s132/headers/nrf_sdm.h | 109 +- .../sdk/softdevice/s132/headers/nrf_soc.h | 47 +- .../sdk/softdevice/s132/headers/nrf_svc.h | 1 - .../s132/hex/s132_nrf52_2.0.0_softdevice.hex | 6918 -------- .../sdk/softdevice/s140/ble.h | 689 + .../sdk/softdevice/s140/ble_err.h} | 100 +- .../sdk/softdevice/s140/ble_gap.h | 2027 +++ .../sdk/softdevice/s140/ble_gatt.h | 222 + .../sdk/softdevice/s140/ble_gattc.h | 669 + .../sdk/softdevice/s140/ble_gatts.h | 778 + .../sdk/softdevice/s140/ble_hci.h | 133 + .../sdk/softdevice/s140/ble_l2cap.h | 204 + .../sdk/softdevice/s140/ble_ranges.h | 140 + .../sdk/softdevice/s140/ble_types.h | 207 + .../sdk/softdevice/s140/nrf52/nrf_mbr.h | 219 + .../sdk/softdevice/s140/nrf_error.h | 89 + .../sdk/softdevice/s140/nrf_error_sdm.h} | 54 +- .../sdk/softdevice/s140/nrf_error_soc.h | 84 + .../sdk/softdevice/s140/nrf_mbr.h | 219 + .../sdk/softdevice/s140/nrf_nvic.h | 521 + .../sdk/softdevice/s140/nrf_sd_def.h} | 39 +- .../sdk/softdevice/s140/nrf_sdm.h | 335 + .../sdk/softdevice/s140/nrf_soc.h | 908 + .../sdk/softdevice/s140/nrf_svc.h | 90 + .../porting_tools/copyright_header.txt | 37 + .../porting_tools/replace_headers.py | 48 + .../{ => porting_tools}/sdk_update.py | 0 .../{ => porting_tools}/update_desc.json | 8 +- .../sdk/ble/ble_advertising/ble_advertising.c | 807 +- .../sdk/ble/ble_advertising/ble_advertising.h | 86 +- .../ble/ble_db_discovery/ble_db_discovery.c | 78 +- .../ble/ble_db_discovery/ble_db_discovery.h | 22 +- .../ble_debug_assert_handler.c | 3 +- .../ble_debug_assert_handler.h | 24 +- .../sdk/ble/ble_dtm/ble_dtm.c | 241 +- .../sdk/ble/ble_dtm/ble_dtm.h | 65 +- .../ble_dtm/ble_dtm_hw.h} | 98 +- .../sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c | 119 + .../sdk/ble/ble_dtm/ble_dtm_hw_nrf52.c | 117 + .../sdk/ble/ble_error_log/ble_error_log.h | 12 +- .../sdk/ble/ble_racp/ble_racp.c | 7 +- .../sdk/ble/ble_racp/ble_racp.h | 57 +- .../ble_radio_notification.c | 2 - .../ble_radio_notification.h | 9 +- .../sdk/ble/ble_services/ble_dfu/ble_dfu.c | 830 +- .../sdk/ble/ble_services/ble_dfu/ble_dfu.h | 278 +- .../sdk/ble/common/ble_advdata.c | 138 +- .../sdk/ble/common/ble_advdata.h | 34 +- .../sdk/ble/common/ble_conn_params.h | 12 +- .../sdk/ble/common/ble_conn_state.c | 3 +- .../sdk/ble/common/ble_conn_state.h | 12 +- .../sdk/ble/common/ble_date_time.h | 24 +- .../sdk/ble/common/ble_gatt_db.h | 23 +- .../sdk/ble/common/ble_sensor_location.h | 12 +- .../sdk/ble/common/ble_srv_common.c | 20 +- .../sdk/ble/common/ble_srv_common.h | 33 +- .../config/device_manager_cnfg.h | 126 - .../sdk/ble/device_manager/device_manager.h | 915 - .../device_manager_peripheral.c | 2971 ---- .../sdk/ble/peer_manager/gatt_cache_manager.c | 223 +- .../sdk/ble/peer_manager/gatt_cache_manager.h | 26 +- .../ble/peer_manager/gattc_cache_manager.c | 139 - .../ble/peer_manager/gattc_cache_manager.h | 132 - .../ble/peer_manager/gatts_cache_manager.c | 149 +- .../ble/peer_manager/gatts_cache_manager.h | 24 +- .../sdk/ble/peer_manager/id_manager.c | 1009 +- .../sdk/ble/peer_manager/id_manager.h | 208 +- .../sdk/ble/peer_manager/peer_data.c | 8 +- .../sdk/ble/peer_manager/peer_data.h | 12 +- .../sdk/ble/peer_manager/peer_data_storage.c | 774 +- .../sdk/ble/peer_manager/peer_data_storage.h | 345 +- .../sdk/ble/peer_manager/peer_database.c | 290 +- .../sdk/ble/peer_manager/peer_database.h | 114 +- .../sdk/ble/peer_manager/peer_id.c | 43 +- .../sdk/ble/peer_manager/peer_id.h | 12 +- .../sdk/ble/peer_manager/peer_manager.c | 338 +- .../sdk/ble/peer_manager/peer_manager.h | 272 +- .../ble/peer_manager/peer_manager_internal.h | 30 +- .../sdk/ble/peer_manager/peer_manager_types.h | 81 +- .../sdk/ble/peer_manager/pm_buffer.c | 27 +- .../sdk/ble/peer_manager/pm_buffer.h | 52 +- .../sdk/ble/peer_manager/pm_mutex.c | 5 +- .../sdk/ble/peer_manager/pm_mutex.h | 14 +- .../ble/peer_manager/security_dispatcher.c | 173 +- .../ble/peer_manager/security_dispatcher.h | 29 +- .../sdk/ble/peer_manager/security_manager.c | 233 +- .../sdk/ble/peer_manager/security_manager.h | 34 +- .../sdk/device/compiler_abstraction.h | 25 +- .../TARGET_NRF5_SDK13/sdk/device/nrf.h | 42 +- .../TARGET_NRF5_SDK13/sdk/device/nrf51.h | 96 +- .../sdk/device/nrf51422_peripherals.h | 152 + .../sdk/device/nrf51802_peripherals.h | 152 + .../sdk/device/nrf51822_peripherals.h | 152 + .../sdk/device/nrf51_bitfields.h | 776 +- .../sdk/device/nrf51_deprecated.h | 11 +- .../sdk/device/nrf51_to_nrf52.h | 24 +- .../sdk/device/nrf51_to_nrf52840.h | 575 + .../TARGET_NRF5_SDK13/sdk/device/nrf52.h | 62 +- .../sdk/device/nrf52832_peripherals.h | 226 + .../TARGET_NRF5_SDK13/sdk/device/nrf52840.h | 2417 +++ .../sdk/device/nrf52840_bitfields.h | 14641 ++++++++++++++++ .../sdk/device/nrf52840_peripherals.h | 248 + .../sdk/device/nrf52_bitfields.h | 2700 +-- .../sdk/device/nrf52_name_change.h | 11 +- .../sdk/device/nrf52_to_nrf52840.h | 96 + .../sdk/drivers_nrf/ble_flash/ble_flash.c | 7 +- .../sdk/drivers_nrf/ble_flash/ble_flash.h | 24 +- .../sdk/drivers_nrf/clock/nrf_drv_clock.c | 385 +- .../sdk/drivers_nrf/clock/nrf_drv_clock.h | 74 +- .../sdk/drivers_nrf/common/nrf_drv_common.c | 122 +- .../sdk/drivers_nrf/common/nrf_drv_common.h | 167 +- .../sdk/drivers_nrf/comp/nrf_drv_comp.c | 236 + .../sdk/drivers_nrf/comp/nrf_drv_comp.h | 242 + .../config/nrf_drv_config_validation.h | 110 - .../sdk/drivers_nrf/delay/nrf_delay.h | 394 +- .../sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c | 392 +- .../sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h | 106 +- .../sdk/drivers_nrf/hal/nrf_adc.h | 443 - .../sdk/drivers_nrf/hal/nrf_clock.h | 65 +- .../sdk/drivers_nrf/hal/nrf_comp.h | 508 + .../sdk/drivers_nrf/hal/nrf_ecb.c | 15 +- .../sdk/drivers_nrf/hal/nrf_ecb.h | 22 +- .../sdk/drivers_nrf/hal/nrf_egu.h | 350 + .../sdk/drivers_nrf/hal/nrf_gpio.h | 711 +- .../sdk/drivers_nrf/hal/nrf_gpiote.h | 60 +- .../sdk/drivers_nrf/hal/nrf_i2s.h | 562 + .../sdk/drivers_nrf/hal/nrf_lpcomp.h | 424 + .../sdk/drivers_nrf/hal/nrf_nvmc.c | 131 +- .../sdk/drivers_nrf/hal/nrf_nvmc.h | 16 +- .../sdk/drivers_nrf/hal/nrf_pdm.h | 24 +- .../hal/nrf_peripherals.h} | 49 +- .../sdk/drivers_nrf/hal/nrf_ppi.h | 19 +- .../sdk/drivers_nrf/hal/nrf_pwm.h | 253 +- .../sdk/drivers_nrf/hal/nrf_qdec.h | 502 + .../sdk/drivers_nrf/hal/nrf_rng.h | 281 + .../sdk/drivers_nrf/hal/nrf_rtc.h | 55 +- .../sdk/drivers_nrf/hal/nrf_saadc.c | 13 +- .../sdk/drivers_nrf/hal/nrf_saadc.h | 86 +- .../sdk/drivers_nrf/hal/nrf_spi.h | 124 +- .../sdk/drivers_nrf/hal/nrf_spim.h | 227 +- .../sdk/drivers_nrf/hal/nrf_spis.h | 209 +- .../sdk/drivers_nrf/hal/nrf_temp.h | 14 +- .../sdk/drivers_nrf/hal/nrf_timer.h | 220 +- .../sdk/drivers_nrf/hal/nrf_twi.h | 182 +- .../sdk/drivers_nrf/hal/nrf_twim.h | 517 + .../sdk/drivers_nrf/hal/nrf_twis.h | 705 + .../sdk/drivers_nrf/hal/nrf_uart.h | 101 +- .../sdk/drivers_nrf/hal/nrf_uarte.h | 573 + .../sdk/drivers_nrf/hal/nrf_wdt.h | 14 +- .../sdk/drivers_nrf/i2s/nrf_drv_i2s.c | 436 + .../sdk/drivers_nrf/i2s/nrf_drv_i2s.h | 254 + .../sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.c | 203 + .../sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.h | 152 + .../sdk/drivers_nrf/nrf_soc_nosd/nrf_error.h | 86 + .../sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.c | 122 + .../sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.h | 165 + .../nrf_soc_nosd/nrf_soc.c} | 37 +- .../nrf_soc_nosd/nrf_soc.h} | 53 +- .../sdk/drivers_nrf/pdm/nrf_drv_pdm.c | 247 + .../sdk/drivers_nrf/pdm/nrf_drv_pdm.h | 202 + .../sdk/drivers_nrf/ppi/nrf_drv_ppi.c | 230 +- .../sdk/drivers_nrf/ppi/nrf_drv_ppi.h | 40 +- .../pstorage/config/pstorage_platform.h | 99 - .../sdk/drivers_nrf/pstorage/pstorage.c | 1599 -- .../sdk/drivers_nrf/pstorage/pstorage.h | 408 - .../sdk/drivers_nrf/pwm/nrf_drv_pwm.c | 158 +- .../sdk/drivers_nrf/pwm/nrf_drv_pwm.h | 95 +- .../sdk/drivers_nrf/qdec/nrf_drv_qdec.c | 233 + .../sdk/drivers_nrf/qdec/nrf_drv_qdec.h | 184 + .../drivers_nrf/radio_config/radio_config.c | 186 + .../radio_config/radio_config.h} | 35 +- .../sdk/drivers_nrf/rng/nrf_drv_rng.c | 295 + .../sdk/drivers_nrf/rng/nrf_drv_rng.h | 146 + .../sdk/drivers_nrf/rtc/nrf_drv_rtc.c | 355 + .../sdk/drivers_nrf/rtc/nrf_drv_rtc.h | 364 + .../sdk/drivers_nrf/saadc/nrf_drv_saadc.c | 476 +- .../sdk/drivers_nrf/saadc/nrf_drv_saadc.h | 147 +- .../sdk/drivers_nrf/sdio/sdio.c | 243 + .../sdk/drivers_nrf/sdio/sdio.h | 104 + .../{delay/nrf_delay.c => sdio/sdio_config.h} | 26 +- .../sdk/drivers_nrf/spi_master/nrf_drv_spi.c | 252 +- .../sdk/drivers_nrf/spi_master/nrf_drv_spi.h | 62 +- .../sdk/drivers_nrf/spi_slave/nrf_drv_spis.c | 215 +- .../sdk/drivers_nrf/spi_slave/nrf_drv_spis.h | 122 +- .../sdk/drivers_nrf/swi/nrf_drv_swi.c | 407 + .../sdk/drivers_nrf/swi/nrf_drv_swi.h | 191 + .../sdk/drivers_nrf/timer/nrf_drv_timer.c | 101 +- .../sdk/drivers_nrf/timer/nrf_drv_timer.h | 87 +- .../sdk/drivers_nrf/twi_master/nrf_drv_twi.c | 355 +- .../sdk/drivers_nrf/twi_master/nrf_drv_twi.h | 136 +- .../sdk/drivers_nrf/twis_slave/nrf_drv_twis.c | 940 + .../sdk/drivers_nrf/twis_slave/nrf_drv_twis.h | 394 + .../sdk/drivers_nrf/uart/nrf_drv_uart.c | 972 + .../sdk/drivers_nrf/uart/nrf_drv_uart.h | 429 + .../sdk/drivers_nrf/wdt/nrf_drv_wdt.c | 174 + .../sdk/drivers_nrf/wdt/nrf_drv_wdt.h | 159 + .../sdk/libraries/bootloader/nrf_ble_dfu.c | 1037 ++ .../sdk/libraries/bootloader/nrf_ble_dfu.h | 120 + .../sdk/libraries/bootloader/nrf_bootloader.c | 99 + .../sdk/libraries/bootloader/nrf_bootloader.h | 91 + .../nrf_bootloader_app_start.c} | 84 +- .../nrf_bootloader_app_start.h} | 40 +- .../bootloader/nrf_bootloader_info.c | 58 + .../bootloader/nrf_bootloader_info.h | 135 + .../sdk/libraries/bootloader/nrf_dfu.c | 177 + .../sdk/libraries/bootloader/nrf_dfu.h | 105 + .../sdk/libraries/bootloader/nrf_dfu_flash.c | 315 + .../sdk/libraries/bootloader/nrf_dfu_flash.h | 155 + .../sdk/libraries/bootloader/nrf_dfu_mbr.c | 133 + .../sdk/libraries/bootloader/nrf_dfu_mbr.h | 118 + .../bootloader/nrf_dfu_req_handler.h | 202 + .../libraries/bootloader/nrf_dfu_settings.c | 260 + .../nrf_dfu_settings.h} | 56 +- .../libraries/bootloader/nrf_dfu_transport.c | 97 + .../libraries/bootloader/nrf_dfu_transport.h | 124 + .../sdk/libraries/bootloader/nrf_dfu_types.h | 245 + .../sdk/libraries/bootloader/nrf_dfu_utils.c | 572 + .../sdk/libraries/bootloader/nrf_dfu_utils.h | 118 + .../sdk/libraries/bootloader_dfu/bootloader.h | 124 - .../bootloader_dfu/bootloader_types.h | 86 - .../sdk/libraries/bootloader_dfu/dfu.h | 161 - .../bootloader_dfu/dfu_app_handler.c | 219 - .../bootloader_dfu/dfu_app_handler.h | 113 - .../bootloader_dfu/dfu_bank_internal.h | 114 - .../libraries/bootloader_dfu/dfu_ble_svc.h | 107 - .../sdk/libraries/bootloader_dfu/dfu_init.h | 161 - .../bootloader_dfu/dfu_init_template.c | 182 - .../sdk/libraries/bootloader_dfu/dfu_types.h | 195 - .../hci_transport/hci_transport_config.h | 72 - .../sdk/libraries/crc16/crc16.c | 5 +- .../sdk/libraries/crc16/crc16.h | 16 +- .../experimental_section_vars/section_vars.h | 142 +- .../TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c | 96 +- .../TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h | 43 +- .../sdk/libraries/fds/fds_internal_defs.h | 17 +- .../sdk/libraries/fstorage/fstorage.c | 128 +- .../sdk/libraries/fstorage/fstorage.h | 48 +- .../fstorage/fstorage_internal_defs.h | 26 +- .../hci/config/hci_transport_config.h | 67 - .../sdk/libraries/hci/hci_mem_pool.c | 144 +- .../sdk/libraries/hci/hci_mem_pool.h | 72 +- .../sdk/libraries/log/nrf_log.h | 212 + .../sdk/libraries/log/nrf_log_backend.h | 89 + .../libraries/log/nrf_log_backend_serial.c | 494 + .../sdk/libraries/log/nrf_log_ctrl.h | 235 + .../nrf_log_ctrl_internal.h} | 95 +- .../sdk/libraries/log/nrf_log_frontend.c | 824 + .../sdk/libraries/log/nrf_log_internal.h | 307 + .../sdk/libraries/pwm/app_pwm.c | 255 +- .../sdk/libraries/pwm/app_pwm.h | 24 +- .../sdk/libraries/scheduler/app_scheduler.c | 116 +- .../sdk/libraries/scheduler/app_scheduler.h | 34 +- .../sdk/libraries/svc/nrf_svc_function.h | 86 + .../sdk/libraries/svc/nrf_svc_handler.c | 180 + .../sdk/libraries/svc/nrf_svci.h | 158 + .../sdk/libraries/trace/app_trace.h | 56 - .../sdk/libraries/util/app_error.c | 15 +- .../sdk/libraries/util/app_error.h | 30 +- .../sdk/libraries/util/app_error_weak.c | 27 +- .../sdk/libraries/util/app_error_weak.h | 40 +- .../sdk/libraries/util/app_util.h | 568 +- .../sdk/libraries/util/app_util_bds.h | 78 +- .../sdk/libraries/util/app_util_platform.c | 51 +- .../sdk/libraries/util/app_util_platform.h | 94 +- .../sdk/libraries/util/nordic_common.h | 88 +- .../sdk/libraries/util/nrf_assert.c | 5 +- .../sdk/libraries/util/nrf_assert.h | 39 +- .../sdk/libraries/util/nrf_log.c | 429 - .../sdk/libraries/util/nrf_log.h | 699 - .../sdk/libraries/util/sdk_common.h | 147 +- .../sdk/libraries/util/sdk_errors.h | 86 +- .../sdk/libraries/util/sdk_macros.h | 153 +- .../sdk/libraries/util/sdk_mapped_flags.c | 1 - .../sdk/libraries/util/sdk_mapped_flags.h | 12 +- .../sdk/libraries/util/sdk_os.h | 12 +- .../sdk/libraries/util/sdk_resources.h | 38 +- .../TARGET_NRF5_SDK13/sdk/sdk_validation.h | 304 + .../ant_stack_handler_types.h | 11 +- .../common/softdevice_handler/app_ram_base.h | 309 +- .../ble_stack_handler_types.h | 29 +- .../softdevice_handler/softdevice_handler.c | 230 +- .../softdevice_handler/softdevice_handler.h | 46 +- .../softdevice_handler_appsh.c | 1 - .../softdevice_handler_appsh.h | 10 +- 301 files changed, 58003 insertions(+), 28801 deletions(-) delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/nrf_drv_config.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble.h => ble.h} (80%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_err.h => ble_err.h} (99%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_gap.h => ble_gap.h} (74%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_gatt.h => ble_gatt.h} (91%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_gattc.h => ble_gattc.h} (79%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_gatts.h => ble_gatts.h} (87%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_hci.h => ble_hci.h} (96%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_l2cap.h => ble_l2cap.h} (97%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_ranges.h => ble_ranges.h} (75%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/{nrf_ble_types.h => ble_types.h} (98%) delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{sdk/drivers_nrf/hal/nrf_adc.c => TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_err.h} (52%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gap.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatt.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gattc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatts.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_hci.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_l2cap.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_ranges.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_types.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf52/nrf_mbr.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{sdk/libraries/util/common.h => TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_sdm.h} (69%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_soc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_mbr.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_nvic.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{sdk/libraries/bootloader_dfu/dfu_transport.h => TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sd_def.h} (76%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sdm.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_soc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_svc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/copyright_header.txt create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/replace_headers.py rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{ => porting_tools}/sdk_update.py (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{ => porting_tools}/update_desc.json (96%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/{libraries/fstorage/config/fstorage_config.h => ble/ble_dtm/ble_dtm_hw.h} (54%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf52.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/config/device_manager_cnfg.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager_peripheral.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51422_peripherals.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51802_peripherals.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51822_peripherals.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52840.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52832_peripherals.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840_bitfields.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840_peripherals.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_to_nrf52840.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/comp/nrf_drv_comp.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/comp/nrf_drv_comp.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/config/nrf_drv_config_validation.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_comp.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_egu.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_i2s.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_lpcomp.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/{libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h => drivers_nrf/hal/nrf_peripherals.h} (79%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_qdec.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rng.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twim.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twis.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uarte.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/i2s/nrf_drv_i2s.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/i2s/nrf_drv_i2s.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_error.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/{libraries/trace/app_trace.c => drivers_nrf/nrf_soc_nosd/nrf_soc.c} (80%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/{libraries/bootloader_dfu/bootloader_settings.h => drivers_nrf/nrf_soc_nosd/nrf_soc.h} (58%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pdm/nrf_drv_pdm.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pdm/nrf_drv_pdm.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/config/pstorage_platform.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/qdec/nrf_drv_qdec.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/qdec/nrf_drv_qdec.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/radio_config/radio_config.c rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/{libraries/hci/config/hci_mem_pool_internal.h => drivers_nrf/radio_config/radio_config.h} (79%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rng/nrf_drv_rng.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rng/nrf_drv_rng.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rtc/nrf_drv_rtc.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rtc/nrf_drv_rtc.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/{delay/nrf_delay.c => sdio/sdio_config.h} (88%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/wdt/nrf_drv_wdt.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/wdt/nrf_drv_wdt.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/{bootloader_dfu/bootloader_util.c => bootloader/nrf_bootloader_app_start.c} (87%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/{bootloader_dfu/dfu_ble_svc_internal.h => bootloader/nrf_bootloader_app_start.h} (65%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_req_handler.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.c rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/{bootloader_dfu/bootloader_util.h => bootloader/nrf_dfu_settings.h} (67%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_types.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_types.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_bank_internal.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init_template.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_types.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_transport_config.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_transport_config.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend_serial.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl.h rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/{fds/config/fds_config.h => log/nrf_log_ctrl_internal.h} (54%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_frontend.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_internal.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_function.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_handler.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svci.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/sdk_validation.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/nrf_drv_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/nrf_drv_config.h deleted file mode 100644 index 4443e68e64..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/nrf_drv_config.h +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef NRF_DRV_CONFIG_H -#define NRF_DRV_CONFIG_H - -/** - * Provide a non-zero value here in applications that need to use several - * peripherals with the same ID that are sharing certain resources - * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used - * simultaneously. Therefore, this definition allows to initialize the driver - * for another peripheral from a given group only after the previously used one - * is uninitialized. Normally, this is not possible, because interrupt handlers - * are implemented in individual drivers. - * This functionality requires a more complicated interrupt handling and driver - * initialization, hence it is not always desirable to use it. - */ -#define PERIPHERAL_RESOURCE_SHARING_ENABLED 1 - -/* CLOCK */ -#define CLOCK_ENABLED 1 - -#if (CLOCK_ENABLED == 1) -#define CLOCK_CONFIG_XTAL_FREQ NRF_CLOCK_XTALFREQ_Default -#define CLOCK_CONFIG_LF_SRC NRF_CLOCK_LFCLK_Xtal -#define CLOCK_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - -/* GPIOTE */ -#define GPIOTE_ENABLED 1 - -#if (GPIOTE_ENABLED == 1) -#define GPIOTE_CONFIG_USE_SWI_EGU false -#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 8 -#endif - -/* TIMER */ -#ifdef SOFTDEVICE_PRESENT -#define TIMER0_ENABLED 0 -#else -#define TIMER0_ENABLED 1 -#endif - -#if (TIMER0_ENABLED == 1) -#define TIMER0_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER0_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER0_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_32Bit -#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER0_INSTANCE_INDEX 0 -#endif - -#define TIMER1_ENABLED 1 - -#if (TIMER1_ENABLED == 1) -#define TIMER1_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER1_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER1_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER1_INSTANCE_INDEX (TIMER0_ENABLED) -#endif - -#define TIMER2_ENABLED 1 - -#if (TIMER2_ENABLED == 1) -#define TIMER2_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER2_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER2_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER2_INSTANCE_INDEX (TIMER1_ENABLED+TIMER0_ENABLED) -#endif - -#define TIMER3_ENABLED 0 - -#if (TIMER3_ENABLED == 1) -#define TIMER3_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER3_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER3_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER3_INSTANCE_INDEX (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED) -#endif - -#define TIMER4_ENABLED 0 - -#if (TIMER4_ENABLED == 1) -#define TIMER4_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER4_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER4_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER4_INSTANCE_INDEX (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED) -#endif - - -#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED) - -/* RTC */ -#define RTC0_ENABLED 0 - -#if (RTC0_ENABLED == 1) -#define RTC0_CONFIG_FREQUENCY 32678 -#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define RTC0_CONFIG_RELIABLE false - -#define RTC0_INSTANCE_INDEX 0 -#endif - -#define RTC1_ENABLED 0 - -#if (RTC1_ENABLED == 1) -#define RTC1_CONFIG_FREQUENCY 32768 -#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define RTC1_CONFIG_RELIABLE false - -#define RTC1_INSTANCE_INDEX (RTC0_ENABLED) -#endif - -#define RTC2_ENABLED 0 - -#if (RTC2_ENABLED == 1) -#define RTC2_CONFIG_FREQUENCY 32768 -#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define RTC2_CONFIG_RELIABLE false - -#define RTC2_INSTANCE_INDEX (RTC0_ENABLED+RTC1_ENABLED) -#endif - - -#define RTC_COUNT (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED) - -#define NRF_MAXIMUM_LATENCY_US 2000 - -/* RNG */ -#define RNG_ENABLED 0 - -#if (RNG_ENABLED == 1) -#define RNG_CONFIG_ERROR_CORRECTION true -#define RNG_CONFIG_POOL_SIZE 8 -#define RNG_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - -/* PWM */ - -#define PWM0_ENABLED 1 - -#if (PWM0_ENABLED == 1) -#define PWM0_CONFIG_OUT0_PIN 2 -#define PWM0_CONFIG_OUT1_PIN 3 -#define PWM0_CONFIG_OUT2_PIN 4 -#define PWM0_CONFIG_OUT3_PIN 5 -#define PWM0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define PWM0_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz -#define PWM0_CONFIG_COUNT_MODE NRF_PWM_MODE_UP -#define PWM0_CONFIG_TOP_VALUE 1000 -#define PWM0_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON -#define PWM0_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO - -#define PWM0_INSTANCE_INDEX 0 -#endif - -#define PWM1_ENABLED 1 - -#if (PWM1_ENABLED == 1) -#define PWM1_CONFIG_OUT0_PIN 2 -#define PWM1_CONFIG_OUT1_PIN 3 -#define PWM1_CONFIG_OUT2_PIN 4 -#define PWM1_CONFIG_OUT3_PIN 5 -#define PWM1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define PWM1_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz -#define PWM1_CONFIG_COUNT_MODE NRF_PWM_MODE_UP -#define PWM1_CONFIG_TOP_VALUE 1000 -#define PWM1_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON -#define PWM1_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO - -#define PWM1_INSTANCE_INDEX (PWM0_ENABLED) -#endif - -#define PWM2_ENABLED 1 - -#if (PWM2_ENABLED == 1) -#define PWM2_CONFIG_OUT0_PIN 2 -#define PWM2_CONFIG_OUT1_PIN 3 -#define PWM2_CONFIG_OUT2_PIN 4 -#define PWM2_CONFIG_OUT3_PIN 5 -#define PWM2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define PWM2_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz -#define PWM2_CONFIG_COUNT_MODE NRF_PWM_MODE_UP -#define PWM2_CONFIG_TOP_VALUE 1000 -#define PWM2_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON -#define PWM2_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO - -#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED) -#endif - -#define PWM_COUNT (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED) - -/* SPI */ -#define SPI0_ENABLED 1 - -#if (SPI0_ENABLED == 1) -#define SPI0_USE_EASY_DMA 0 - -#define SPI0_CONFIG_SCK_PIN 2 -#define SPI0_CONFIG_MOSI_PIN 3 -#define SPI0_CONFIG_MISO_PIN 4 -#define SPI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPI0_INSTANCE_INDEX 0 -#endif - -#define SPI1_ENABLED 1 - -#if (SPI1_ENABLED == 1) -#define SPI1_USE_EASY_DMA 0 - -#define SPI1_CONFIG_SCK_PIN 2 -#define SPI1_CONFIG_MOSI_PIN 3 -#define SPI1_CONFIG_MISO_PIN 4 -#define SPI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPI1_INSTANCE_INDEX (SPI0_ENABLED) -#endif - -#define SPI2_ENABLED 1 - -#if (SPI2_ENABLED == 1) -#define SPI2_USE_EASY_DMA 0 - -#define SPI2_CONFIG_SCK_PIN 2 -#define SPI2_CONFIG_MOSI_PIN 3 -#define SPI2_CONFIG_MISO_PIN 4 -#define SPI2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED) -#endif - -#define SPI_COUNT (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED) - -/* SPIS */ -#define SPIS0_ENABLED 1 - -#if (SPIS0_ENABLED == 1) -#define SPIS0_CONFIG_SCK_PIN 2 -#define SPIS0_CONFIG_MOSI_PIN 3 -#define SPIS0_CONFIG_MISO_PIN 4 -#define SPIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPIS0_INSTANCE_INDEX 0 -#endif - -#define SPIS1_ENABLED 1 - -#if (SPIS1_ENABLED == 1) -#define SPIS1_CONFIG_SCK_PIN 2 -#define SPIS1_CONFIG_MOSI_PIN 3 -#define SPIS1_CONFIG_MISO_PIN 4 -#define SPIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED -#endif - -#define SPIS2_ENABLED 1 - -#if (SPIS2_ENABLED == 1) -#define SPIS2_CONFIG_SCK_PIN 2 -#define SPIS2_CONFIG_MOSI_PIN 3 -#define SPIS2_CONFIG_MISO_PIN 4 -#define SPIS2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED) -#endif - -#define SPIS_COUNT (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED) - -/* UART */ -#define UART0_ENABLED 1 - -#if (UART0_ENABLED == 1) -#define UART0_CONFIG_HWFC NRF_UART_HWFC_ENABLED -#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED -#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_9600 -#define UART0_CONFIG_PSEL_TXD 6 -#define UART0_CONFIG_PSEL_RXD 8 -#define UART0_CONFIG_PSEL_CTS 7 -#define UART0_CONFIG_PSEL_RTS 5 -#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH -#ifdef NRF52 -#define UART0_CONFIG_USE_EASY_DMA false -//Compile time flag -#define UART_EASY_DMA_SUPPORT 1 -#define UART_LEGACY_SUPPORT 1 -#endif //NRF52 -#endif - -#define TWI0_ENABLED 1 - -#if (TWI0_ENABLED == 1) -#define TWI0_USE_EASY_DMA 0 - -#define TWI0_CONFIG_FREQUENCY NRF_TWI_FREQ_100K -#define TWI0_CONFIG_SCL 0 -#define TWI0_CONFIG_SDA 1 -#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TWI0_INSTANCE_INDEX 0 -#endif - -#define TWI1_ENABLED 1 - -#if (TWI1_ENABLED == 1) -#define TWI1_USE_EASY_DMA 0 - -#define TWI1_CONFIG_FREQUENCY NRF_TWI_FREQ_100K -#define TWI1_CONFIG_SCL 0 -#define TWI1_CONFIG_SDA 1 -#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TWI1_INSTANCE_INDEX (TWI0_ENABLED) -#endif - -#define TWI_COUNT (TWI0_ENABLED + TWI1_ENABLED) - -/* TWIS */ -#define TWIS0_ENABLED 0 - -#if (TWIS0_ENABLED == 1) - #define TWIS0_CONFIG_ADDR0 0 - #define TWIS0_CONFIG_ADDR1 0 /* 0: Disabled */ - #define TWIS0_CONFIG_SCL 0 - #define TWIS0_CONFIG_SDA 1 - #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - - #define TWIS0_INSTANCE_INDEX 0 -#endif - -#define TWIS1_ENABLED 0 - -#if (TWIS1_ENABLED == 1) - #define TWIS1_CONFIG_ADDR0 0 - #define TWIS1_CONFIG_ADDR1 0 /* 0: Disabled */ - #define TWIS1_CONFIG_SCL 0 - #define TWIS1_CONFIG_SDA 1 - #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - - #define TWIS1_INSTANCE_INDEX (TWIS0_ENABLED) -#endif - -#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED) -/* For more documentation see nrf_drv_twis.h file */ -#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 -/* For more documentation see nrf_drv_twis.h file */ -#define TWIS_NO_SYNC_MODE 0 - -/* QDEC */ -#define QDEC_ENABLED 0 - -#if (QDEC_ENABLED == 1) -#define QDEC_CONFIG_REPORTPER NRF_QDEC_REPORTPER_10 -#define QDEC_CONFIG_SAMPLEPER NRF_QDEC_SAMPLEPER_16384us -#define QDEC_CONFIG_PIO_A 1 -#define QDEC_CONFIG_PIO_B 2 -#define QDEC_CONFIG_PIO_LED 3 -#define QDEC_CONFIG_LEDPRE 511 -#define QDEC_CONFIG_LEDPOL NRF_QDEC_LEPOL_ACTIVE_HIGH -#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define QDEC_CONFIG_DBFEN false -#define QDEC_CONFIG_SAMPLE_INTEN false -#endif - -/* ADC */ -#define ADC_ENABLED 0 - -#if (ADC_ENABLED == 1) -#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - - -/* SAADC */ -#define SAADC_ENABLED 1 - -#if (SAADC_ENABLED == 1) -#define SAADC_CONFIG_RESOLUTION NRF_SAADC_RESOLUTION_10BIT -#define SAADC_CONFIG_OVERSAMPLE NRF_SAADC_OVERSAMPLE_DISABLED -#define SAADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - -/* PDM */ -#define PDM_ENABLED 0 - -#if (PDM_ENABLED == 1) -#define PDM_CONFIG_MODE NRF_PDM_MODE_MONO -#define PDM_CONFIG_EDGE NRF_PDM_EDGE_LEFTFALLING -#define PDM_CONFIG_CLOCK_FREQ NRF_PDM_FREQ_1032K -#define PDM_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - -/* COMP */ -#define COMP_ENABLED 0 - -#if (COMP_ENABLED == 1) -#define COMP_CONFIG_REF NRF_COMP_REF_Int1V8 -#define COMP_CONFIG_MAIN_MODE NRF_COMP_MAIN_MODE_SE -#define COMP_CONFIG_SPEED_MODE NRF_COMP_SP_MODE_High -#define COMP_CONFIG_HYST NRF_COMP_HYST_NoHyst -#define COMP_CONFIG_ISOURCE NRF_COMP_ISOURCE_Off -#define COMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define COMP_CONFIG_INPUT NRF_COMP_INPUT_0 -#endif - -/* LPCOMP */ -#define LPCOMP_ENABLED 0 - -#if (LPCOMP_ENABLED == 1) -#define LPCOMP_CONFIG_REFERENCE NRF_LPCOMP_REF_SUPPLY_4_8 -#define LPCOMP_CONFIG_DETECTION NRF_LPCOMP_DETECT_DOWN -#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define LPCOMP_CONFIG_INPUT NRF_LPCOMP_INPUT_0 -#endif - -/* WDT */ -#define WDT_ENABLED 0 - -#if (WDT_ENABLED == 1) -#define WDT_CONFIG_BEHAVIOUR NRF_WDT_BEHAVIOUR_RUN_SLEEP -#define WDT_CONFIG_RELOAD_VALUE 2000 -#define WDT_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH -#endif - -/* SWI EGU */ -#ifdef NRF52 - #define EGU_ENABLED 0 -#endif - -/* I2S */ -#define I2S_ENABLED 0 - -#if (I2S_ENABLED == 1) -#define I2S_CONFIG_SCK_PIN 22 -#define I2S_CONFIG_LRCK_PIN 23 -#define I2S_CONFIG_MCK_PIN NRF_DRV_I2S_PIN_NOT_USED -#define I2S_CONFIG_SDOUT_PIN 24 -#define I2S_CONFIG_SDIN_PIN 25 -#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH -#define I2S_CONFIG_MASTER NRF_I2S_MODE_MASTER -#define I2S_CONFIG_FORMAT NRF_I2S_FORMAT_I2S -#define I2S_CONFIG_ALIGN NRF_I2S_ALIGN_LEFT -#define I2S_CONFIG_SWIDTH NRF_I2S_SWIDTH_16BIT -#define I2S_CONFIG_CHANNELS NRF_I2S_CHANNELS_STEREO -#define I2S_CONFIG_MCK_SETUP NRF_I2S_MCK_32MDIV8 -#define I2S_CONFIG_RATIO NRF_I2S_RATIO_256X -#endif - -#include "nrf_drv_config_validation.h" - -#endif // NRF_DRV_CONFIG_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble.h similarity index 80% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble.h index 71e3984776..86d4d9adff 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble.h @@ -36,7 +36,6 @@ * */ - /** @addtogroup BLE_COMMON BLE SoftDevice Common @{ @@ -47,16 +46,16 @@ */ -#ifndef NRF_BLE_H__ -#define NRF_BLE_H__ +#ifndef BLE_H__ +#define BLE_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" +#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" #ifdef __cplusplus extern "C" { @@ -89,18 +88,19 @@ enum BLE_COMMON_EVTS { BLE_EVT_TX_COMPLETE = BLE_EVT_BASE, /**< Transmission Complete. @ref ble_evt_tx_complete_t */ BLE_EVT_USER_MEM_REQUEST, /**< User Memory request. @ref ble_evt_user_mem_request_t */ - BLE_EVT_USER_MEM_RELEASE /**< User Memory release. @ref ble_evt_user_mem_release_t */ + BLE_EVT_USER_MEM_RELEASE, /**< User Memory release. @ref ble_evt_user_mem_release_t */ + BLE_EVT_DATA_LENGTH_CHANGED /**< Link layer PDU length changed. @ref ble_evt_data_length_changed_t. */ }; /**@brief BLE connection bandwidth types. - * Bandwidth types supported by the SoftDevice in packets per connection interval. + * Bandwidth types supported by the SoftDevice. The bandwidth type dictates the maximum number of full length packets per connection interval. */ enum BLE_CONN_BWS { - BLE_CONN_BW_NONE = 0, - BLE_CONN_BW_LOW, - BLE_CONN_BW_MID, - BLE_CONN_BW_HIGH + BLE_CONN_BW_INVALID = 0, /**< Invalid connection bandwidth. */ + BLE_CONN_BW_LOW, /**< Low connection bandwidth. */ + BLE_CONN_BW_MID, /**< Medium connection bandwidth. */ + BLE_CONN_BW_HIGH /**< High connection bandwidth. */ }; /**@brief Common Option IDs. @@ -109,7 +109,8 @@ enum BLE_CONN_BWS enum BLE_COMMON_OPTS { BLE_COMMON_OPT_CONN_BW = BLE_OPT_BASE, /**< Bandwidth configuration @ref ble_common_opt_conn_bw_t */ - BLE_COMMON_OPT_PA_LNA /**< PA and LNA options */ + BLE_COMMON_OPT_PA_LNA, /**< PA and LNA options */ + BLE_COMMON_OPT_CONN_EVT_EXT, /**< Extended connection events option */ }; /** @} */ @@ -119,7 +120,23 @@ enum BLE_COMMON_OPTS /** @brief Required pointer alignment for BLE Events. */ -#define BLE_EVTS_PTR_ALIGNMENT 4 +#define BLE_EVT_PTR_ALIGNMENT 4 + +/** @brief Leaves the maximum of the two arguments. +*/ +#define BLE_MAX(a, b) ((a) < (b) ? (b) : (a)) + +/** @brief Maximum possible length for BLE Events. + * @note Value of @ref ble_gatt_enable_params_t::att_mtu shall be used as a parameter. + * If that value is set to 0 then @ref BLE_GATT_MTU_SIZE_DEFAULT must be used instead. +*/ +#define BLE_EVT_LEN_MAX(ATT_MTU) (BLE_MAX( \ + sizeof(ble_evt_t), \ + BLE_MAX( \ + offsetof(ble_evt_t, evt.gattc_evt.params.rel_disc_rsp.includes) + ((ATT_MTU) - 2) / 6 * sizeof(ble_gattc_include_t), \ + offsetof(ble_evt_t, evt.gattc_evt.params.attr_info_disc_rsp.info.attr_info16) + ((ATT_MTU) - 2) / 4 * sizeof(ble_gattc_attr_info16_t) \ + ) \ +)) /** @defgroup BLE_USER_MEM_TYPES User Memory Types * @{ */ @@ -167,17 +184,26 @@ typedef struct ble_user_mem_block_t mem_block; /**< User memory block */ } ble_evt_user_mem_release_t; +/**@brief Event structure for @ref BLE_EVT_DATA_LENGTH_CHANGED. */ +typedef struct +{ + uint16_t max_tx_octets; /**< The maximum number of payload octets in a Link Layer Data Channel PDU that the local Controller will send. Range: 27-251 */ + uint16_t max_tx_time; /**< The maximum time (in microseconds) that the local Controller will take to send a Link Layer Data Channel PDU. Range: 328-2120 */ + uint16_t max_rx_octets; /**< The maximum number of payload octets in a Link Layer Data Channel PDU that the local controller expects to receive. Range: 27-251 */ + uint16_t max_rx_time; /**< The maximum time (in microseconds) that the local Controller expects to take to receive a Link Layer Data Channel PDU. Range: 328-2120 */ +} ble_evt_data_length_changed_t; /**@brief Event structure for events not associated with a specific function module. */ typedef struct { - uint16_t conn_handle; /**< Connection Handle on which this event occurred. */ + uint16_t conn_handle; /**< Connection Handle on which this event occurred. */ union { - ble_evt_tx_complete_t tx_complete; /**< Transmission Complete. */ - ble_evt_user_mem_request_t user_mem_request; /**< User Memory Request Event Parameters. */ - ble_evt_user_mem_release_t user_mem_release; /**< User Memory Release Event Parameters. */ - } params; + ble_evt_tx_complete_t tx_complete; /**< Transmission Complete. */ + ble_evt_user_mem_request_t user_mem_request; /**< User Memory Request Event Parameters. */ + ble_evt_user_mem_release_t user_mem_release; /**< User Memory Release Event Parameters. */ + ble_evt_data_length_changed_t data_length_changed; /**< Data Length Changed Event Parameters. */ + } params; /**< Event parameter union. */ } ble_common_evt_t; /**@brief BLE Event header. */ @@ -198,7 +224,7 @@ typedef struct ble_l2cap_evt_t l2cap_evt; /**< L2CAP originated event, evt_id in BLE_L2CAP_EVT* series. */ ble_gattc_evt_t gattc_evt; /**< GATT client originated event, evt_id in BLE_GATTC_EVT* series. */ ble_gatts_evt_t gatts_evt; /**< GATT server originated event, evt_id in BLE_GATTS_EVT* series. */ - } evt; + } evt; /**< Event union. */ } ble_evt_t; @@ -212,7 +238,9 @@ typedef struct uint16_t subversion_number; /**< Link Layer Sub Version number, corresponds to the SoftDevice Config ID or Firmware ID (FWID). */ } ble_version_t; -/* @brief: Configuration parameters for the PA and LNA. */ +/** + * @brief Configuration parameters for the PA and LNA. + */ typedef struct { uint8_t enable :1; /**< Enable toggling for this amplifier */ @@ -220,7 +248,7 @@ typedef struct uint8_t gpio_pin :6; /**< The GPIO pin to toggle for this amplifier */ } ble_pa_lna_cfg_t; -/* +/** * @brief PA & LNA GPIO toggle configuration * * This option configures the SoftDevice to toggle pins when the radio is active for use with a power amplifier and/or @@ -233,7 +261,6 @@ typedef struct * @note This feature is only supported for nRF52, on nRF51 @ref NRF_ERROR_NOT_SUPPORTED will always be returned. * @note Setting this option while the radio is in use (i.e. any of the roles are active) may have undefined consequences * and must be avoided by the application. - * */ typedef struct { @@ -272,6 +299,7 @@ typedef struct * @note The global memory pool configuration can be set with the @ref ble_conn_bw_counts_t configuration parameter, which * is provided to @ref sd_ble_enable. * + * @note @ref sd_ble_opt_get is not supported for this option. * @note Please refer to SoftDevice Specification for more information on bandwidth configuration. * * @mscs @@ -289,11 +317,28 @@ typedef struct ble_conn_bw_t conn_bw; /**< Bandwidth configuration parameters. */ } ble_common_opt_conn_bw_t; +/** + * @brief Configuration of extended BLE connection events. + * + * When enabled the SoftDevice will dynamically extend the connection event when possible. + * + * The connection event length is controlled by the bandwidth configuration as set by @ref ble_common_opt_conn_bw_t. + * The connection event can be extended if there is time to send another packet pair before the start of the next connection interval, + * and if there are no conflicts with other BLE roles requesting radio time. + * + * @note @ref sd_ble_opt_get is not supported for this option. + */ +typedef struct +{ + uint8_t enable : 1; /**< Enable extended BLE connection events, disabled by default. */ +} ble_common_opt_conn_evt_ext_t; + /**@brief Option structure for common options. */ typedef union { - ble_common_opt_conn_bw_t conn_bw; /**< Parameters for the connection bandwidth option. */ - ble_common_opt_pa_lna_t pa_lna; /**< Parameters for controlling PA and LNA pin toggling. */ + ble_common_opt_conn_bw_t conn_bw; /**< Parameters for the connection bandwidth option. */ + ble_common_opt_pa_lna_t pa_lna; /**< Parameters for controlling PA and LNA pin toggling. */ + ble_common_opt_conn_evt_ext_t conn_evt_ext; /**< Parameters for enabling extended connection events. */ } ble_common_opt_t; /**@brief Common BLE Option type, wrapping the module specific options. */ @@ -360,8 +405,9 @@ typedef struct typedef struct { ble_common_enable_params_t common_enable_params; /**< Common init parameters @ref ble_common_enable_params_t. */ - ble_gap_enable_params_t gap_enable_params; /**< GAP init parameters @ref ble_gap_enable_params_t. */ - ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init parameters @ref ble_gatts_enable_params_t. */ + ble_gap_enable_params_t gap_enable_params; /**< GAP init parameters @ref ble_gap_enable_params_t. */ + ble_gatt_enable_params_t gatt_enable_params; /**< GATT init parameters @ref ble_gatt_enable_params_t. */ + ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init parameters @ref ble_gatts_enable_params_t. */ } ble_enable_params_t; /** @} */ @@ -392,9 +438,19 @@ typedef struct * @retval ::NRF_SUCCESS The BLE stack has been initialized successfully. * @retval ::NRF_ERROR_INVALID_STATE The BLE stack had already been initialized and cannot be reinitialized. * @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. - * @retval ::NRF_ERROR_INVALID_LENGTH The specified Attribute Table size is either too small or not a multiple of 4. - * The minimum acceptable size is defined by @ref BLE_GATTS_ATTR_TAB_SIZE_MIN. - * @retval ::NRF_ERROR_INVALID_PARAM Incorrectly configured VS UUID count or connection count parameters. + * @retval ::NRF_ERROR_INVALID_LENGTH One or more of the following is true: + * - The specified Attribute Table size is too small. + * The minimum acceptable size is defined by @ref BLE_GATTS_ATTR_TAB_SIZE_MIN. + * - The specified Attribute Table size is not a multiple of 4. + * - The device name length is invalid (must be between 0 and @ref BLE_GAP_DEVNAME_MAX_LEN). + * - The device name length is too long for the given Attribute Table. + * @retval ::NRF_ERROR_INVALID_PARAM One or more of the following is true: + * - Incorrectly configured VS UUID count. + * - Invalid connection count parameters. + * - Invalid device name location (vloc). + * - Invalid device name security mode. + * - Invalid maximum ATT_MTU size, see @ref ble_gatt_enable_params_t::att_mtu. + * @retval ::NRF_ERROR_NOT_SUPPORTED Device name security mode is not supported. * @retval ::NRF_ERROR_NO_MEM The amount of memory assigned to the SoftDevice by *p_app_ram_base is not * large enough to fit this configuration's memory requirement. Check *p_app_ram_base * and set the start address of the application RAM region accordingly. @@ -406,7 +462,8 @@ SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable /**@brief Get an event from the pending events queue. * * @param[out] p_dest Pointer to buffer to be filled in with an event, or NULL to retrieve the event length. - * This buffer must be 4-byte aligned in memory. + * This buffer must be aligned to the extend defined by @ref BLE_EVT_PTR_ALIGNMENT. + * The buffer should be interpreted as a @ref ble_evt_t struct. * @param[in, out] p_len Pointer the length of the buffer, on return it is filled with the event length. * * @details This call allows the application to pull a BLE event from the BLE stack. The application is signaled that @@ -415,22 +472,19 @@ SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable * Interrupt Service Routine that maps to SD_EVT_IRQn. In any case however, and because the BLE stack runs at a higher * priority than the application, this function should be called in a loop (until @ref NRF_ERROR_NOT_FOUND is returned) * every time SD_EVT_IRQn is raised to ensure that all available events are pulled from the BLE stack. Failure to do so - * could potentially leave events in the internal queue without the application being aware of this fact. Sizing the - * p_dest buffer is equally important, since the application needs to provide all the memory necessary for the event to + * could potentially leave events in the internal queue without the application being aware of this fact. + * + * Sizing the p_dest buffer is equally important, since the application needs to provide all the memory necessary for the event to * be copied into application memory. If the buffer provided is not large enough to fit the entire contents of the event, * @ref NRF_ERROR_DATA_SIZE will be returned and the application can then call again with a larger buffer size. - * Please note that because of the variable length nature of some events, sizeof(ble_evt_t) will not always be large - * enough to fit certain events, and so it is the application's responsibility to provide an amount of memory large - * enough so that the relevant event is copied in full. The application may "peek" the event length by providing p_dest - * as a NULL pointer and inspecting the value of *p_len upon return: + * The maximum possible event length is defined by @ref BLE_EVT_LEN_MAX. The application may also "peek" the event length + * by providing p_dest as a NULL pointer and inspecting the value of *p_len upon return: * * \code * uint16_t len; * errcode = sd_ble_evt_get(NULL, &len); * \endcode * - * @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT - * * @mscs * @mmsc{@ref BLE_COMMON_IRQ_EVT_MSC} * @mmsc{@ref BLE_COMMON_THREAD_EVT_MSC} @@ -482,13 +536,13 @@ SVCALL(SD_BLE_EVT_GET, uint32_t, sd_ble_evt_get(uint8_t *p_dest, uint16_t *p_len SVCALL(SD_BLE_TX_PACKET_COUNT_GET, uint32_t, sd_ble_tx_packet_count_get(uint16_t conn_handle, uint8_t *p_count)); -/**@brief Add a Vendor Specific UUID. +/**@brief Add a Vendor Specific base UUID. * - * @details This call enables the application to add a vendor specific UUID to the BLE stack's table, for later use - * all other modules and APIs. This then allows the application to use the shorter, 24-bit @ref ble_uuid_t format - * when dealing with both 16-bit and 128-bit UUIDs without having to check for lengths and having split code paths. - * The way that this is accomplished is by extending the grouping mechanism that the Bluetooth SIG standard base - * UUID uses for all other 128-bit UUIDs. The type field in the @ref ble_uuid_t structure is an index (relative to + * @details This call enables the application to add a vendor specific base UUID to the BLE stack's table, for later + * use with all other modules and APIs. This then allows the application to use the shorter, 24-bit @ref ble_uuid_t + * format when dealing with both 16-bit and 128-bit UUIDs without having to check for lengths and having split code + * paths. This is accomplished by extending the grouping mechanism that the Bluetooth SIG standard base UUID uses + * for all other 128-bit UUIDs. The type field in the @ref ble_uuid_t structure is an index (relative to * @ref BLE_UUID_TYPE_VENDOR_BEGIN) to the table populated by multiple calls to this function, and the uuid field * in the same structure contains the 2 bytes at indices 12 and 13. The number of possible 128-bit UUIDs available to * the application is therefore the number of Vendor Specific UUIDs added with the help of this function times 65536, @@ -627,7 +681,7 @@ SVCALL(SD_BLE_OPT_GET, uint32_t, sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_op #ifdef __cplusplus } #endif -#endif /* NRF_BLE_H__ */ +#endif /* BLE_H__ */ /** @} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_err.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_err.h similarity index 99% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_err.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_err.h index 7eaf23d125..cfbcd503c9 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_err.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_err.h @@ -36,7 +36,6 @@ * */ - /** @addtogroup BLE_COMMON @{ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gap.h similarity index 74% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gap.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gap.h index 926714ed36..34946746fe 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gap.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gap.h @@ -36,18 +36,17 @@ * */ - /** @addtogroup BLE_GAP Generic Access Profile (GAP) @{ @brief Definitions and prototypes for the GAP interface. */ -#ifndef NRF_BLE_GAP_H__ -#define NRF_BLE_GAP_H__ +#ifndef BLE_GAP_H__ +#define BLE_GAP_H__ -#include "nrf_ble_types.h" -#include "nrf_ble_ranges.h" +#include "ble_types.h" +#include "ble_ranges.h" #include "nrf_svc.h" #ifdef __cplusplus @@ -61,37 +60,42 @@ extern "C" { */ enum BLE_GAP_SVCS { - SD_BLE_GAP_ADDRESS_SET = BLE_GAP_SVC_BASE, /**< Set own Bluetooth Address. */ - SD_BLE_GAP_ADDRESS_GET, /**< Get own Bluetooth Address. */ - SD_BLE_GAP_ADV_DATA_SET, /**< Set Advertising Data. */ - SD_BLE_GAP_ADV_START, /**< Start Advertising. */ - SD_BLE_GAP_ADV_STOP, /**< Stop Advertising. */ - SD_BLE_GAP_CONN_PARAM_UPDATE, /**< Connection Parameter Update. */ - SD_BLE_GAP_DISCONNECT, /**< Disconnect. */ - SD_BLE_GAP_TX_POWER_SET, /**< Set TX Power. */ - SD_BLE_GAP_APPEARANCE_SET, /**< Set Appearance. */ - SD_BLE_GAP_APPEARANCE_GET, /**< Get Appearance. */ - SD_BLE_GAP_PPCP_SET, /**< Set PPCP. */ - SD_BLE_GAP_PPCP_GET, /**< Get PPCP. */ - SD_BLE_GAP_DEVICE_NAME_SET, /**< Set Device Name. */ - SD_BLE_GAP_DEVICE_NAME_GET, /**< Get Device Name. */ - SD_BLE_GAP_AUTHENTICATE, /**< Initiate Pairing/Bonding. */ - SD_BLE_GAP_SEC_PARAMS_REPLY, /**< Reply with Security Parameters. */ - SD_BLE_GAP_AUTH_KEY_REPLY, /**< Reply with an authentication key. */ - SD_BLE_GAP_LESC_DHKEY_REPLY, /**< Reply with an LE Secure Connections DHKey. */ - SD_BLE_GAP_KEYPRESS_NOTIFY, /**< Notify of a keypress during an authentication procedure. */ - SD_BLE_GAP_LESC_OOB_DATA_GET, /**< Get the local LE Secure Connections OOB data. */ - SD_BLE_GAP_LESC_OOB_DATA_SET, /**< Set the remote LE Secure Connections OOB data. */ - SD_BLE_GAP_ENCRYPT, /**< Initiate encryption procedure. */ - SD_BLE_GAP_SEC_INFO_REPLY, /**< Reply with Security Information. */ - SD_BLE_GAP_CONN_SEC_GET, /**< Obtain connection security level. */ - SD_BLE_GAP_RSSI_START, /**< Start reporting of changes in RSSI. */ - SD_BLE_GAP_RSSI_STOP, /**< Stop reporting of changes in RSSI. */ - SD_BLE_GAP_SCAN_START, /**< Start Scanning. */ - SD_BLE_GAP_SCAN_STOP, /**< Stop Scanning. */ - SD_BLE_GAP_CONNECT, /**< Connect. */ - SD_BLE_GAP_CONNECT_CANCEL, /**< Cancel ongoing connection procedure. */ - SD_BLE_GAP_RSSI_GET, /**< Get the last RSSI sample. */ + SD_BLE_GAP_ADDR_SET = BLE_GAP_SVC_BASE, /**< Set own Bluetooth Address. */ + SD_BLE_GAP_ADDR_GET, /**< Get own Bluetooth Address. */ + SD_BLE_GAP_WHITELIST_SET, /**< Set active whitelist. */ + SD_BLE_GAP_DEVICE_IDENTITIES_SET, /**< Set device identity list. */ + SD_BLE_GAP_PRIVACY_SET, /**< Set Privacy settings*/ + SD_BLE_GAP_PRIVACY_GET, /**< Get Privacy settings*/ + SD_BLE_GAP_ADV_DATA_SET, /**< Set Advertising Data. */ + SD_BLE_GAP_ADV_START, /**< Start Advertising. */ + SD_BLE_GAP_ADV_STOP, /**< Stop Advertising. */ + SD_BLE_GAP_CONN_PARAM_UPDATE, /**< Connection Parameter Update. */ + SD_BLE_GAP_DISCONNECT, /**< Disconnect. */ + SD_BLE_GAP_TX_POWER_SET, /**< Set TX Power. */ + SD_BLE_GAP_APPEARANCE_SET, /**< Set Appearance. */ + SD_BLE_GAP_APPEARANCE_GET, /**< Get Appearance. */ + SD_BLE_GAP_PPCP_SET, /**< Set PPCP. */ + SD_BLE_GAP_PPCP_GET, /**< Get PPCP. */ + SD_BLE_GAP_DEVICE_NAME_SET, /**< Set Device Name. */ + SD_BLE_GAP_DEVICE_NAME_GET, /**< Get Device Name. */ + SD_BLE_GAP_AUTHENTICATE, /**< Initiate Pairing/Bonding. */ + SD_BLE_GAP_SEC_PARAMS_REPLY, /**< Reply with Security Parameters. */ + SD_BLE_GAP_AUTH_KEY_REPLY, /**< Reply with an authentication key. */ + SD_BLE_GAP_LESC_DHKEY_REPLY, /**< Reply with an LE Secure Connections DHKey. */ + SD_BLE_GAP_KEYPRESS_NOTIFY, /**< Notify of a keypress during an authentication procedure. */ + SD_BLE_GAP_LESC_OOB_DATA_GET, /**< Get the local LE Secure Connections OOB data. */ + SD_BLE_GAP_LESC_OOB_DATA_SET, /**< Set the remote LE Secure Connections OOB data. */ + SD_BLE_GAP_ENCRYPT, /**< Initiate encryption procedure. */ + SD_BLE_GAP_SEC_INFO_REPLY, /**< Reply with Security Information. */ + SD_BLE_GAP_CONN_SEC_GET, /**< Obtain connection security level. */ + SD_BLE_GAP_RSSI_START, /**< Start reporting of changes in RSSI. */ + SD_BLE_GAP_RSSI_STOP, /**< Stop reporting of changes in RSSI. */ + SD_BLE_GAP_SCAN_START, /**< Start Scanning. */ + SD_BLE_GAP_SCAN_STOP, /**< Stop Scanning. */ + SD_BLE_GAP_CONNECT, /**< Connect. */ + SD_BLE_GAP_CONNECT_CANCEL, /**< Cancel ongoing connection procedure. */ + SD_BLE_GAP_RSSI_GET, /**< Get the last RSSI sample. */ + SD_BLE_GAP_PHY_REQUEST, /**< Initiate PHY Update procedure. */ }; /**@brief GAP Event IDs. @@ -116,6 +120,7 @@ enum BLE_GAP_EVTS BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. \n See @ref ble_gap_evt_sec_request_t. */ BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. \n Reply with @ref sd_ble_gap_conn_param_update. \n See @ref ble_gap_evt_conn_param_update_request_t. */ BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. \n See @ref ble_gap_evt_scan_req_report_t. */ + BLE_GAP_EVT_PHY_UPDATE, /**< PHY have been updated \n See @ref ble_gap_evt_phy_update_t. */ }; /**@brief GAP Option IDs. @@ -126,9 +131,11 @@ enum BLE_GAP_OPTS BLE_GAP_OPT_CH_MAP = BLE_GAP_OPT_BASE, /**< Channel Map. @ref ble_gap_opt_ch_map_t */ BLE_GAP_OPT_LOCAL_CONN_LATENCY, /**< Local connection latency. @ref ble_gap_opt_local_conn_latency_t */ BLE_GAP_OPT_PASSKEY, /**< Set passkey. @ref ble_gap_opt_passkey_t */ - BLE_GAP_OPT_PRIVACY, /**< Custom privacy. @ref ble_gap_opt_privacy_t */ BLE_GAP_OPT_SCAN_REQ_REPORT, /**< Scan request report. @ref ble_gap_opt_scan_req_report_t */ - BLE_GAP_OPT_COMPAT_MODE /**< Compatibility mode. @ref ble_gap_opt_compat_mode_t */ + BLE_GAP_OPT_COMPAT_MODE, /**< Compatibility mode. @ref ble_gap_opt_compat_mode_t */ + BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT, /**< Set Authenticated payload timeout. @ref ble_gap_opt_auth_payload_timeout_t */ + BLE_GAP_OPT_EXT_LEN, /**< Extended length packets. @ref ble_gap_opt_ext_len_t */ + BLE_GAP_OPT_PREFERRED_PHYS_SET, /**< Set the preferred PHYs for all new connections. @ref ble_gap_opt_preferred_phys_t */ }; /** @} */ @@ -141,7 +148,9 @@ enum BLE_GAP_OPTS #define BLE_ERROR_GAP_UUID_LIST_MISMATCH (NRF_GAP_ERR_BASE + 0x000) /**< UUID list does not contain an integral number of UUIDs. */ #define BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST (NRF_GAP_ERR_BASE + 0x001) /**< Use of Whitelist not permitted with discoverable advertising. */ #define BLE_ERROR_GAP_INVALID_BLE_ADDR (NRF_GAP_ERR_BASE + 0x002) /**< The upper two bits of the address do not correspond to the specified address type. */ -#define BLE_ERROR_GAP_WHITELIST_IN_USE (NRF_GAP_ERR_BASE + 0x003) /**< Attempt to overwrite the whitelist while already in use by another operation. */ +#define BLE_ERROR_GAP_WHITELIST_IN_USE (NRF_GAP_ERR_BASE + 0x003) /**< Attempt to modify the whitelist while already in use by another operation. */ +#define BLE_ERROR_GAP_DEVICE_IDENTITIES_IN_USE (NRF_GAP_ERR_BASE + 0x004) /**< Attempt to modify the device identity list while already in use by another operation. */ +#define BLE_ERROR_GAP_DEVICE_IDENTITIES_DUPLICATE (NRF_GAP_ERR_BASE + 0x005) /**< The device identity list contains entries with duplicate identity addresses. */ /**@} */ @@ -160,28 +169,34 @@ enum BLE_GAP_OPTS #define BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST 0x01 /**< Security request timeout. */ #define BLE_GAP_TIMEOUT_SRC_SCAN 0x02 /**< Scanning timeout. */ #define BLE_GAP_TIMEOUT_SRC_CONN 0x03 /**< Connection timeout. */ +#define BLE_GAP_TIMEOUT_SRC_AUTH_PAYLOAD 0x04 /**< Authenticated payload timeout. */ /**@} */ /**@defgroup BLE_GAP_ADDR_TYPES GAP Address types * @{ */ #define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public address. */ -#define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random Static address. */ -#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE 0x02 /**< Private Resolvable address. */ -#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**< Private Non-Resolvable address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random static address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE 0x02 /**< Random private resolvable address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**< Random private non-resolvable address. */ /**@} */ -/**@defgroup BLE_GAP_ADDR_CYCLE_MODES GAP Address cycle modes - * @{ */ -#define BLE_GAP_ADDR_CYCLE_MODE_NONE 0x00 /**< Set addresses directly, no automatic address cycling. */ -#define BLE_GAP_ADDR_CYCLE_MODE_AUTO 0x01 /**< Automatically generate and update private addresses. */ -/** @} */ -/**@brief The default interval in seconds at which a private address is refreshed when address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO. */ -#define BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S (60 * 15) +/**@brief The default interval in seconds at which a private address is refreshed. */ +#define BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S (900) /* 15 minutes. */ +/**@brief The maximum interval in seconds at which a private address can be refreshed. */ +#define BLE_GAP_MAX_PRIVATE_ADDR_CYCLE_INTERVAL_S (41400) /* 11 hours 30 minutes. */ + /** @brief BLE address length. */ -#define BLE_GAP_ADDR_LEN 6 +#define BLE_GAP_ADDR_LEN (6) + + +/**@defgroup BLE_GAP_PRIVACY_MODES Privacy modes + * @{ */ +#define BLE_GAP_PRIVACY_MODE_OFF 0x00 /**< Device will send and accept its identity address for its own address. */ +#define BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY 0x01 /**< Device will send and accept only private addresses for its own address. */ +/**@} */ /**@defgroup BLE_GAP_AD_TYPE_DEFINITIONS GAP Advertising and Scan Response Data format @@ -264,7 +279,7 @@ enum BLE_GAP_OPTS /**@brief Maximum size of advertising data in octets. */ -#define BLE_GAP_ADV_MAX_SIZE 31 +#define BLE_GAP_ADV_MAX_SIZE (31) /**@defgroup BLE_GAP_ADV_TYPES GAP Advertising types @@ -287,8 +302,8 @@ enum BLE_GAP_OPTS /**@defgroup BLE_GAP_ADV_TIMEOUT_VALUES GAP Advertising timeout values * @{ */ -#define BLE_GAP_ADV_TIMEOUT_LIMITED_MAX 180 /**< Maximum advertising time in limited discoverable mode (TGAP(lim_adv_timeout) = 180s). */ -#define BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED 0 /**< Unlimited advertising in general discoverable mode. */ +#define BLE_GAP_ADV_TIMEOUT_LIMITED_MAX (180) /**< Maximum advertising time in limited discoverable mode (TGAP(lim_adv_timeout) = 180s). */ +#define BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED (0) /**< Unlimited advertising in general discoverable mode. */ /**@} */ @@ -299,6 +314,7 @@ enum BLE_GAP_OPTS #define BLE_GAP_DISC_MODE_GENERAL 0x02 /**< General Discovery Mode. */ /**@} */ + /**@defgroup BLE_GAP_IO_CAPS GAP IO Capabilities * @{ */ #define BLE_GAP_IO_CAPS_DISPLAY_ONLY 0x00 /**< Display Only. */ @@ -308,6 +324,7 @@ enum BLE_GAP_OPTS #define BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY 0x04 /**< Keyboard and Display. */ /**@} */ + /**@defgroup BLE_GAP_AUTH_KEY_TYPES GAP Authentication Key Types * @{ */ #define BLE_GAP_AUTH_KEY_TYPE_NONE 0x00 /**< No key (may be used to reject). */ @@ -315,6 +332,7 @@ enum BLE_GAP_OPTS #define BLE_GAP_AUTH_KEY_TYPE_OOB 0x02 /**< Out Of Band data. */ /**@} */ + /**@defgroup BLE_GAP_KP_NOT_TYPES GAP Keypress Notification Types * @{ */ #define BLE_GAP_KP_NOT_TYPE_PASSKEY_START 0x00 /**< Passkey entry started. */ @@ -324,6 +342,7 @@ enum BLE_GAP_OPTS #define BLE_GAP_KP_NOT_TYPE_PASSKEY_END 0x04 /**< Passkey entry completed. */ /**@} */ + /**@defgroup BLE_GAP_SEC_STATUS GAP Security status * @{ */ #define BLE_GAP_SEC_STATUS_SUCCESS 0x00 /**< Procedure completed with success. */ @@ -349,12 +368,14 @@ enum BLE_GAP_OPTS #define BLE_GAP_SEC_STATUS_RFU_RANGE2_END 0xFF /**< Reserved for Future Use range #2 end. */ /**@} */ + /**@defgroup BLE_GAP_SEC_STATUS_SOURCES GAP Security status sources * @{ */ #define BLE_GAP_SEC_STATUS_SOURCE_LOCAL 0x00 /**< Local failure. */ #define BLE_GAP_SEC_STATUS_SOURCE_REMOTE 0x01 /**< Remote failure. */ /**@} */ + /**@defgroup BLE_GAP_CP_LIMITS GAP Connection Parameters Limits * @{ */ #define BLE_GAP_CP_MIN_CONN_INTVL_NONE 0xFFFF /**< No new minimum connection interval specified in connect parameters. */ @@ -370,11 +391,20 @@ enum BLE_GAP_OPTS /**@} */ -/**@brief GAP device name maximum length. */ -#define BLE_GAP_DEVNAME_MAX_LEN 31 +/**@brief GAP device name defines. */ +#define BLE_GAP_DEVNAME_DEFAULT "nRF5x" /**< Default device name value. */ +#define BLE_GAP_DEVNAME_DEFAULT_LEN 31 /**< Default number of octets in device name. */ +#define BLE_GAP_DEVNAME_MAX_LEN 248 /**< Maximum number of octets in device name. */ + /**@brief Disable RSSI events for connections */ -#define BLE_GAP_RSSI_THRESHOLD_INVALID 0xFF +#define BLE_GAP_RSSI_THRESHOLD_INVALID 0xFF + +/**@defgroup BLE_GAP_PHYS GAP PHYs + * @{ */ +#define BLE_GAP_PHY_1MBPS 0x01 /**< 1 Mbps PHY. */ +#define BLE_GAP_PHY_2MBPS 0x02 /**< 2 Mbps PHY. */ +/**@} */ /**@defgroup BLE_GAP_CONN_SEC_MODE_SET_MACROS GAP attribute security requirement setters * @@ -400,25 +430,30 @@ enum BLE_GAP_OPTS /**@brief GAP Security Random Number Length. */ #define BLE_GAP_SEC_RAND_LEN 8 + /**@brief GAP Security Key Length. */ #define BLE_GAP_SEC_KEY_LEN 16 + /**@brief GAP LE Secure Connections Elliptic Curve Diffie-Hellman P-256 Public Key Length. */ #define BLE_GAP_LESC_P256_PK_LEN 64 + /**@brief GAP LE Secure Connections Elliptic Curve Diffie-Hellman DHKey Length. */ #define BLE_GAP_LESC_DHKEY_LEN 32 + /**@brief GAP Passkey Length. */ #define BLE_GAP_PASSKEY_LEN 6 -/**@brief Maximum amount of addresses in a whitelist. */ + +/**@brief Maximum amount of addresses in the whitelist. */ #define BLE_GAP_WHITELIST_ADDR_MAX_COUNT (8) -/**@brief Maximum amount of IRKs in a whitelist. - * @note The number of IRKs is limited to 8, even if the hardware supports more. - */ -#define BLE_GAP_WHITELIST_IRK_MAX_COUNT (8) + +/**@brief Maximum amount of identities in the device identities list. */ +#define BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT (8) + /**@defgroup GAP_SEC_MODES GAP Security Modes * @{ */ @@ -426,24 +461,17 @@ enum BLE_GAP_OPTS /**@} */ /** @} */ + /**@addtogroup BLE_GAP_STRUCTURES Structures * @{ */ -/** - * @brief BLE GAP initialization parameters. - */ -typedef struct -{ - uint8_t periph_conn_count; /**< Number of connections acting as a peripheral */ - uint8_t central_conn_count; /**< Number of connections acting as a central */ - uint8_t central_sec_count; /**< Number of SMP instances for all connections acting as a central. */ -} ble_gap_enable_params_t; - /**@brief Bluetooth Low Energy address. */ typedef struct { - uint8_t addr_type; /**< See @ref BLE_GAP_ADDR_TYPES. */ - uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */ + uint8_t addr_id_peer : 1; /**< Only valid for peer addresses. + Reference to peer in device identities list (as set with @ref sd_ble_gap_device_identities_set) when peer is using privacy. */ + uint8_t addr_type : 7; /**< See @ref BLE_GAP_ADDR_TYPES. */ + uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */ } ble_gap_addr_t; @@ -493,6 +521,32 @@ typedef struct } ble_gap_conn_sec_t; +/** + * @brief Device name and its properties + * @note If @ref max_len is more than @ref BLE_GAP_DEVNAME_DEFAULT_LEN and vloc is set to @ref BLE_GATTS_VLOC_STACK, the attribute table size must be increased to have room for the longer device name (see @ref ble_gatts_enable_params_t). + */ +typedef struct +{ + ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */ + uint8_t vloc:2; /**< Value location, see @ref BLE_GATTS_VLOCS.*/ + uint8_t *p_value; /**< Pointer to where the value (device name) is stored or will be stored.*/ + uint16_t current_len; /**< Current length in bytes of the memory pointed to by p_value.*/ + uint16_t max_len; /**< Maximum length in bytes of the memory pointed to by p_value.*/ +} ble_gap_device_name_t; + + +/** + * @brief BLE GAP initialization parameters. + */ +typedef struct +{ + uint8_t periph_conn_count; /**< Number of connections acting as a peripheral */ + uint8_t central_conn_count; /**< Number of connections acting as a central */ + uint8_t central_sec_count; /**< Number of SMP instances for all connections acting as a central. */ + ble_gap_device_name_t const *p_device_name; /**< Pointer to device name instance. If NULL, @ref sd_ble_enable() will set the device name to @ref BLE_GAP_DEVNAME_DEFAULT. */ +} ble_gap_enable_params_t; + + /**@brief Identity Resolving Key. */ typedef struct { @@ -500,15 +554,6 @@ typedef struct } ble_gap_irk_t; -/**@brief Whitelist structure. */ -typedef struct -{ - ble_gap_addr_t **pp_addrs; /**< Pointer to an array of device address pointers, pointing to addresses to be used in whitelist. NULL if none are given. */ - uint8_t addr_count; /**< Count of device addresses in array, up to @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. */ - ble_gap_irk_t **pp_irks; /**< Pointer to an array of Identity Resolving Key (IRK) pointers, each pointing to an IRK in the whitelist. NULL if none are given. */ - uint8_t irk_count; /**< Count of IRKs in array, up to @ref BLE_GAP_WHITELIST_IRK_MAX_COUNT. */ -} ble_gap_whitelist_t; - /**@brief Channel mask for RF channels used in advertising. */ typedef struct { @@ -517,13 +562,17 @@ typedef struct uint8_t ch_39_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 39 */ } ble_gap_adv_ch_mask_t; -/**@brief GAP advertising parameters.*/ + +/**@brief GAP advertising parameters. */ typedef struct { uint8_t type; /**< See @ref BLE_GAP_ADV_TYPES. */ - ble_gap_addr_t *p_peer_addr; /**< For @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND mode only, known peer address. */ + ble_gap_addr_t const *p_peer_addr; /**< Address of a known peer. + - When privacy is enabled and the local device use @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE addresses, the device identity list is searched for a matching + entry. If the local IRK for that device identity is set, the local IRK for that device will be used to generate the advertiser address field in the advertise packet. + - If type is @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this must be set to the targeted initiator. If the initiator is in the device identity list, + the peer IRK for that device will be used to generate the initiator address field in the ADV_DIRECT_IND packet. */ uint8_t fp; /**< Filter Policy, see @ref BLE_GAP_ADV_FILTER_POLICIES. */ - ble_gap_whitelist_t *p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */ uint16_t interval; /**< Advertising interval between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s), see @ref BLE_GAP_ADV_INTERVALS. - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for high duty cycle directed advertising. - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, set @ref BLE_GAP_ADV_INTERVAL_MIN <= interval <= @ref BLE_GAP_ADV_INTERVAL_MAX for low duty cycle advertising.*/ @@ -535,15 +584,56 @@ typedef struct /**@brief GAP scanning parameters. */ typedef struct { - uint8_t active : 1; /**< If 1, perform active scanning (scan requests). */ - uint8_t selective : 1; /**< If 1, ignore unknown devices (non whitelisted). */ - ble_gap_whitelist_t * p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */ - uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ - uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ - uint16_t timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ + uint8_t active : 1; /**< If 1, perform active scanning (scan requests). */ + uint8_t use_whitelist : 1; /**< If 1, filter advertisers using current active whitelist. */ + uint8_t adv_dir_report : 1; /**< If 1, also report directed advertisements where the initiator field is set to a private resolvable address, + even if the address did not resolve to an entry in the device identity list. A report will be generated + even if the peer is not in the whitelist. */ + uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + uint16_t timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ } ble_gap_scan_params_t; +/**@brief Device Privacy. + * + * The privacy feature provides a way for the device to avoid being tracked over a period of time. + * The privacy feature, when enabled, hides the local device identity and replaces it with a private address + * that is automatically refreshed at a specified interval. + * + * If a device still wants to be recognized by other peers, it needs to share it's Identity Resolving Key (IRK). + * With this key, a device can generate a random private address that can only be recognized by peers in possession of that key, + * and devices can establish connections without revealing their real identities. + * + * @note If the device IRK is updated, the new IRK becomes the one to be distributed in all + * bonding procedures performed after @ref sd_ble_gap_privacy_set returns. + * The IRK distributed during bonding procedure is the device IRK that is active when @ref sd_ble_gap_sec_params_reply is called. + */ +typedef struct +{ + uint8_t privacy_mode; /**< Privacy mode, see @ref BLE_GAP_PRIVACY_MODES. Default is @ref BLE_GAP_PRIVACY_MODE_OFF. */ + uint8_t private_addr_type; /**< The private address type must be either @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. */ + uint16_t private_addr_cycle_s; /**< Private address cycle interval in seconds. Providing an address cycle value of 0 will use the default value defined by @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S. */ + ble_gap_irk_t *p_device_irk; /**< When used as input, pointer to IRK structure that will be used as the default IRK. If NULL, the device default IRK will be used. + When used as output, pointer to IRK structure where the current default IRK will be written to. If NULL, this argument is ignored. + By default, the default IRK is used to generate random private resolvable addresses for the local device unless instructed otherwise. */ +} ble_gap_privacy_params_t; + + +/**@brief Physical Layer configuration + * @note tx_phys and rx_phys are bitfields, to indicate multiple preferred PHYs for each direction they can be ORed together. + * @code + * p_gap_phys->tx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; + * p_gap_phys->rx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; + * @endcode + * + */ +typedef struct +{ + uint8_t tx_phys; /**< Preferred transmit PHYs, see @ref BLE_GAP_PHYS. */ + uint8_t rx_phys; /**< Preferred receive PHYs, see @ref BLE_GAP_PHYS. */ +} ble_gap_phys_t; + /** @brief Keys that can be exchanged during a bonding procedure. */ typedef struct { @@ -562,7 +652,11 @@ typedef struct uint8_t lesc : 1; /**< Enable LE Secure Connection pairing. */ uint8_t keypress : 1; /**< Enable generation of keypress notifications. */ uint8_t io_caps : 3; /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */ - uint8_t oob : 1; /**< Out Of Band data available. */ + uint8_t oob : 1; /**< The OOB data flag. + - In LE legacy pairing, this flag is set if a device has out of band authentication data. + The OOB method is used if both of the devices have out of band authentication data. + - In LE Secure Connections pairing, this flag is set if a device has the peer device's out of band authentication data. + The OOB method is used if at least one device has the peer device's OOB data available. */ uint8_t min_key_size; /**< Minimum encryption key size in octets between 7 and 16. If 0 then not applicable in this instance. */ uint8_t max_key_size; /**< Maximum encryption key size in octets between min_key_size and 16. */ ble_gap_sec_kdist_t kdist_own; /**< Key distribution bitmap: keys that the local device will distribute. */ @@ -594,18 +688,21 @@ typedef struct uint8_t csrk[BLE_GAP_SEC_KEY_LEN]; /**< Connection Signature Resolving Key. */ } ble_gap_sign_info_t; + /**@brief GAP LE Secure Connections P-256 Public Key. */ typedef struct { uint8_t pk[BLE_GAP_LESC_P256_PK_LEN]; /**< LE Secure Connections Elliptic Curve Diffie-Hellman P-256 Public Key. Stored in the standard SMP protocol format: {X,Y} both in little-endian. */ } ble_gap_lesc_p256_pk_t; + /**@brief GAP LE Secure Connections DHKey. */ typedef struct { uint8_t key[BLE_GAP_LESC_DHKEY_LEN]; /**< LE Secure Connections Elliptic Curve Diffie-Hellman Key. Stored in little-endian. */ } ble_gap_lesc_dhkey_t; + /**@brief GAP LE Secure Connections OOB data. */ typedef struct { @@ -614,14 +711,13 @@ typedef struct uint8_t c[BLE_GAP_SEC_KEY_LEN]; /**< Confirm Value. */ } ble_gap_lesc_oob_data_t; + /**@brief Event structure for @ref BLE_GAP_EVT_CONNECTED. */ typedef struct { - ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ - ble_gap_addr_t own_addr; /**< Bluetooth address of the local device used during connection setup. */ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 + and the address is the device's identity address. */ uint8_t role; /**< BLE role for this connection, see @ref BLE_GAP_ROLES */ - uint8_t irk_match :1; /**< If 1, peer device's address resolved using an IRK. */ - uint8_t irk_match_idx :7; /**< Index in IRK list where the address was matched. */ ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ } ble_gap_evt_connected_t; @@ -639,6 +735,13 @@ typedef struct ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ } ble_gap_evt_conn_param_update_t; +/**@brief Event Structure for @ref BLE_GAP_EVT_PHY_UPDATE. */ +typedef struct +{ + uint8_t status; /**< Status of the procedure, see @ref BLE_HCI_STATUS_CODES */ + uint8_t tx_phy; /**< TX PHY for this connection, see @ref BLE_GAP_PHYS. */ + uint8_t rx_phy; /**< RX PHY for this connection, see @ref BLE_GAP_PHYS. */ +} ble_gap_evt_phy_update_t; /**@brief Event structure for @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. */ typedef struct @@ -712,8 +815,8 @@ typedef struct /**@brief Identity Key. */ typedef struct { - ble_gap_irk_t id_info; /**< Identity Information. */ - ble_gap_addr_t id_addr_info; /**< Identity Address Information. */ + ble_gap_irk_t id_info; /**< Identity Resolving Key. */ + ble_gap_addr_t id_addr_info; /**< Identity Address. */ } ble_gap_id_key_t; @@ -773,7 +876,10 @@ typedef struct /**@brief Event structure for @ref BLE_GAP_EVT_ADV_REPORT. */ typedef struct { - ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 + and the address is the device's identity address. */ + ble_gap_addr_t direct_addr; /**< Set when the scanner is unable to resolve the private resolvable address of the initiator + field of a directed advertisement packet and the scanner has been enabled to report this in @ref ble_gap_scan_params_t::adv_dir_report. */ int8_t rssi; /**< Received Signal Strength Indication in dBm. */ uint8_t scan_rsp : 1; /**< If 1, the report corresponds to a scan response and the type field may be ignored. */ uint8_t type : 2; /**< See @ref BLE_GAP_ADV_TYPES. Only valid if the scan_rsp field is 0. */ @@ -803,11 +909,11 @@ typedef struct typedef struct { int8_t rssi; /**< Received Signal Strength Indication in dBm. */ - ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 + and the address is the device's identity address. */ } ble_gap_evt_scan_req_report_t; - /**@brief GAP event structure. */ typedef struct { @@ -826,13 +932,13 @@ typedef struct ble_gap_evt_auth_status_t auth_status; /**< Authentication Status Event Parameters. */ ble_gap_evt_conn_sec_update_t conn_sec_update; /**< Connection Security Update Event Parameters. */ ble_gap_evt_timeout_t timeout; /**< Timeout Event Parameters. */ - ble_gap_evt_rssi_changed_t rssi_changed; /**< RSSI Event parameters. */ + ble_gap_evt_rssi_changed_t rssi_changed; /**< RSSI Event Parameters. */ ble_gap_evt_adv_report_t adv_report; /**< Advertising Report Event Parameters. */ ble_gap_evt_sec_request_t sec_request; /**< Security Request Event Parameters. */ ble_gap_evt_conn_param_update_request_t conn_param_update_request; /**< Connection Parameter Update Parameters. */ - ble_gap_evt_scan_req_report_t scan_req_report; /**< Scan Request Report parameters. */ + ble_gap_evt_scan_req_report_t scan_req_report; /**< Scan Request Report Parameters. */ + ble_gap_evt_phy_update_t phy_update; /**< PHY Update Parameters. */ } params; /**< Event Parameters. */ - } ble_gap_evt_t; @@ -900,6 +1006,8 @@ typedef struct * sd_ble_opt_set to make the SoftDevice use a pre-programmed passkey for authentication * instead of generating a random one. * + * @note Repeated pairing attempts using the same pre-programmed passkey makes pairing vulnerable to MITM attacks. + * * @note @ref sd_ble_opt_get is not supported for this option. * */ @@ -909,36 +1017,6 @@ typedef struct } ble_gap_opt_passkey_t; -/**@brief Custom Privacy Option. - * - * This structure is used with both @ref sd_ble_opt_set (as input) and with - * @ref sd_ble_opt_get (as output). - * - * Structure containing: - * - A pointer to an IRK to set (if input), or a place to store a read IRK (if output). - * - A private address refresh cycle. - * - * @note The specified address cycle interval is used when the address cycle mode is - * @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO. If 0 is given, the address will not be automatically - * refreshed at all. The default interval is @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S. - * - * @note If the current address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address will immediately be - * refreshed when a custom privacy option is set. A new address can be generated manually by calling - * @ref sd_ble_gap_address_set with the same type again. - * - * @note If the IRK is updated, the new IRK becomes the one to be distributed in all - * bonding procedures performed after @ref sd_ble_opt_set returns. - * - * @retval ::NRF_SUCCESS Set or read successfully. - * @retval ::NRF_ERROR_INVALID_ADDR The pointer to IRK storage is invalid. - */ -typedef struct -{ - ble_gap_irk_t * p_irk; /**< When input: Pointer to custom IRK, or NULL to use/reset to the device's default IRK. When output: Pointer to where the current IRK is to be stored, or NULL to not read out the IRK. */ - uint16_t interval_s; /**< When input: Custom private address cycle interval in seconds. When output: The current private address cycle interval. */ -} ble_gap_opt_privacy_t; - - /**@brief Scan request report option. * * This can be used with @ref sd_ble_opt_set to make the SoftDevice send @@ -957,6 +1035,7 @@ typedef struct uint8_t enable : 1; /**< Enable scan request reports. */ } ble_gap_opt_scan_req_report_t; + /**@brief Compatibility mode option. * * This can be used with @ref sd_ble_opt_set to enable and disable @@ -973,15 +1052,96 @@ typedef struct uint8_t mode_1_enable : 1; /**< Enable compatibility mode 1.*/ } ble_gap_opt_compat_mode_t; +/**@brief Data length extension option. + * + * This can be used with @ref sd_ble_opt_set to enable longer data packets. + * + * @note An rxtx_max_pdu_payload_size of 0 will result in the default minimum payload size of 27. + * @note Not supported by SoftDevices for nRF51 Series devices. + * @note The parameters for a connection are applied when a connection complete + * event is generated for the host. + * + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_PARAM If the payload size is not 0 or a valid link layer PDU payload size. + * @retval ::NRF_ERROR_NOT_SUPPORTED If called on a SoftDevice designed for nRF51 (e.g. s130). + */ +typedef struct +{ + uint8_t rxtx_max_pdu_payload_size; /**< Max PDU payload size (in octets). */ +} ble_gap_opt_ext_len_t; + + + +/**@brief Authenticated payload timeout option. + * + * This can be used with @ref sd_ble_opt_set to change the Authenticated payload timeout to a value other than the default of 8 minutes. + * + * @note The authenticated payload timeout event ::BLE_GAP_TIMEOUT_SRC_AUTH_PAYLOAD will be generated + * if auth_payload_timeout time has elapsed without receiving a packet with a valid MIC on an encrypted + * link. + * + * @note The LE ping procedure will be initiated before the timer expires to give the peer a chance + * to reset the timer. In addition the stack will try to prioritize running of LE ping over other + * activities to increase chances of finishing LE ping before timer expires. To avoid side-effects + * on other activities, it is recommended to use high timeout values. + * Recommended timeout > 2*(connInterval * (6 + connSlaveLatency)). + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. auth_payload_timeout was outside of allowed range. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle */ + uint16_t auth_payload_timeout; /**< Requested timeout in 10 ms unit. Maximum is 48 000 (=480 000 ms =8 min). Minimum is 1 (=10ms). */ +} ble_gap_opt_auth_payload_timeout_t; + +/**@brief Preferred PHY option + * + * @details This can be used with @ref sd_ble_opt_set to change the preferred PHYs. Before this function is called the PHYs + * for peer initiated PHY Update procedure is @ref BLE_GAP_PHY_1MBPS. If @ref ble_gap_opt_preferred_phys_t::tx_phys or + * @ref ble_gap_opt_preferred_phys_t::rx_phys is 0, then the stack will select PHYs based on the peer requirements on that specific direction. + * + * @note The preferred PHYs are only valid for newly created connections after this option is called. If the PHYs should be + * changed for an existing link the @ref sd_ble_gap_phy_request would have to be called, and that would try to update the + * PHYs for the given link. + * + * @note tx_phys and rx_phys are bitfields, to indicate multiple preferred PHYs for each direction they can be ORed together. + * @code + * tx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; + * rx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; + * @endcode + * + * @events + * @event{@ref BLE_GAP_EVT_PHY_UPDATE, Result of the PHY Update if initiated by peer.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_PHY_REQUEST} + * @mmsc{@ref BLE_GAP_PERIPHERAL_PHY_REQUEST} + * @endmscs + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + */ +typedef struct +{ + uint8_t tx_phys; /**< Preferred transmit PHYs, see @ref BLE_GAP_PHYS. */ + uint8_t rx_phys; /**< Preferred receive PHYs, see @ref BLE_GAP_PHYS. */ +} ble_gap_opt_preferred_phys_t; + /**@brief Option structure for GAP options. */ typedef union { ble_gap_opt_ch_map_t ch_map; /**< Parameters for the Channel Map option. */ ble_gap_opt_local_conn_latency_t local_conn_latency; /**< Parameters for the Local connection latency option */ ble_gap_opt_passkey_t passkey; /**< Parameters for the Passkey option.*/ - ble_gap_opt_privacy_t privacy; /**< Parameters for the Custom privacy option. */ ble_gap_opt_scan_req_report_t scan_req_report; /**< Parameters for the scan request report option.*/ ble_gap_opt_compat_mode_t compat_mode; /**< Parameters for the compatibility mode option.*/ + ble_gap_opt_ext_len_t ext_len; /**< Parameters for the extended length option. */ + ble_gap_opt_auth_payload_timeout_t auth_payload_timeout; /**< Parameters for the authenticated payload timeout option.*/ + ble_gap_opt_preferred_phys_t preferred_phys; /**< Parameters for the preferred PHYs option. */ } ble_gap_opt_t; /**@} */ @@ -989,63 +1149,139 @@ typedef union /**@addtogroup BLE_GAP_FUNCTIONS Functions * @{ */ -/**@brief Set local Bluetooth address. +/**@brief Set the local Bluetooth identity address. * - * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address type is required to - * be @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or - * @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. The given address is ignored and the - * SoftDevice will generate a new private address automatically every - * @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S seconds. If this API - * call is used again with the same parameters, the SoftDevice will immediately - * generate a new private address to replace the current address. + * The local Bluetooth identity address is the address that identifies this device to other peers. + * The address type must be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC. + * The identity address cannot be changed while roles are running. * - * @note If the application wishes to use a @ref BLE_GAP_ADDR_TYPE_PUBLIC or - * @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC address, the cycle mode must be - * @ref BLE_GAP_ADDR_CYCLE_MODE_NONE. + * @note This address will be distributed to the peer during bonding. + * If the address changes, the address stored in the peer device will not be valid and the ability to + * reconnect using the old address will be lost. * * @note By default the SoftDevice will set an address of type @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC upon being * enabled. The address is a random number populated during the IC manufacturing process and remains unchanged * for the lifetime of each IC. * - * @note If this API function is called while advertising or scanning, the softdevice will immediately update the - * advertising or scanning address without the need to stop the procedure in the following cases: - * - If the previously set address is of type @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address - * is also of type @ref BLE_GAP_ADDR_TYPE_PUBLIC - * - If the previously set address is not @ref BLE_GAP_ADDR_TYPE_PUBLIC and the new address is - * also not @ref BLE_GAP_ADDR_TYPE_PUBLIC. - * If the address is changed from a @ref BLE_GAP_ADDR_TYPE_PUBLIC address to another type or from - * another type to a @ref BLE_GAP_ADDR_TYPE_PUBLIC address, the change will take effect the next - * time an advertising or scanning procedure is started. - * - * @note If the address cycle mode is @ref BLE_GAP_ADDR_CYCLE_MODE_NONE and the application is - * using privacy, the application must take care to generate and set new private addresses - * periodically to comply with the Privacy specification in Bluetooth Core Spec. - * * @mscs * @mmsc{@ref BLE_GAP_ADV_MSC} * @endmscs * - * @param[in] addr_cycle_mode Address cycle mode, see @ref BLE_GAP_ADDR_CYCLE_MODES. - * @param[in] p_addr Pointer to address structure. + * @param[in] p_addr Pointer to address structure. * * @retval ::NRF_SUCCESS Address successfully set. * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameters. * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address. * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_INVALID_STATE The identity address cannot be changed while the roles are running. */ -SVCALL(SD_BLE_GAP_ADDRESS_SET, uint32_t, sd_ble_gap_address_set(uint8_t addr_cycle_mode, ble_gap_addr_t const *p_addr)); +SVCALL(SD_BLE_GAP_ADDR_SET, uint32_t, sd_ble_gap_addr_set(ble_gap_addr_t const *p_addr)); -/**@brief Get local Bluetooth address. +/**@brief Get local Bluetooth identity address. + * + * @note This will always return the identity address irrespective of the privacy settings, + * i.e. the address type will always be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC. * * @param[out] p_addr Pointer to address structure to be filled in. * * @retval ::NRF_SUCCESS Address successfully retrieved. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid or NULL pointer supplied. */ -SVCALL(SD_BLE_GAP_ADDRESS_GET, uint32_t, sd_ble_gap_address_get(ble_gap_addr_t *p_addr)); +SVCALL(SD_BLE_GAP_ADDR_GET, uint32_t, sd_ble_gap_addr_get(ble_gap_addr_t *p_addr)); + + +/**@brief Set the active whitelist in the SoftDevice. + * + * @note Only one whitelist can be used at a time and the whitelist is shared between the BLE roles. + * The whitelist cannot be set if a BLE role is using the whitelist. + * + * @note If an address is resolved using the information in the device identity list, then the whitelist + * filter policy applies to the peer identity address and not the resolvable address sent on air. + * + * @mscs + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_PRIVATE_SCAN_MSC} + * @endmscs + * + * @param[in] pp_wl_addrs Pointer to a whitelist of peer addresses, if NULL the whitelist will be cleared. + * @param[in] len Length of the whitelist, maximum @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. + * + * @retval ::NRF_SUCCESS The whitelist is successfully set/cleared. + * @retval ::NRF_ERROR_INVALID_ADDR The whitelist (or one of its entries) provided is invalid. + * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE The whitelist is in use by a BLE role and cannot be set or cleared. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. + * @retval ::NRF_ERROR_DATA_SIZE The given whitelist size is invalid (zero or too large); this can only return when + * pp_wl_addrs is not NULL. + */ +SVCALL(SD_BLE_GAP_WHITELIST_SET, uint32_t, sd_ble_gap_whitelist_set(ble_gap_addr_t const * const * pp_wl_addrs, uint8_t len)); + + +/**@brief Set device identity list. + * + * @note Only one device identity list can be used at a time and the list is shared between the BLE roles. + * The device identity list cannot be set if a BLE role is using the list. + * + * @param[in] pp_id_keys Pointer to an array of peer identity addresses and peer IRKs, if NULL the device identity list will be cleared. + * @param[in] pp_local_irks Pointer to an array of local IRKs. Each entry in the array maps to the entry in pp_id_keys at the same index. + * To fill in the list with the currently set device IRK for all peers, set to NULL. + * @param[in] len Length of the device identity list, maximum @ref BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT. + * + * @mscs + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_PRIVATE_SCAN_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_CONN_PRIV_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_CONN_PRIV_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS The device identity list successfully set/cleared. + * @retval ::NRF_ERROR_INVALID_ADDR The device identity list (or one of its entries) provided is invalid. + This code may be returned if the local IRK list also has an invalid entry. + * @retval ::BLE_ERROR_GAP_DEVICE_IDENTITIES_IN_USE The device identity list is in use and cannot be set or cleared. + * @retval ::BLE_ERROR_GAP_DEVICE_IDENTITIES_DUPLICATE The device identity list contains multiple entries with the same identity address. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. + * @retval ::NRF_ERROR_DATA_SIZE The given device identity list size invalid (zero or too large); this can + * only return when pp_id_keys is not NULL. + */ +SVCALL(SD_BLE_GAP_DEVICE_IDENTITIES_SET, uint32_t, sd_ble_gap_device_identities_set(ble_gap_id_key_t const * const * pp_id_keys, ble_gap_irk_t const * const * pp_local_irks, uint8_t len)); + + +/**@brief Set privacy settings. + * + * @note Privacy settings cannot be set while BLE roles are running. + * + * @param[in] p_privacy_params Privacy settings. + * + * @mscs + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. + * @retval ::NRF_ERROR_INVALID_ADDR The pointer to privacy settings is NULL or invalid. + Otherwise, the p_device_irk pointer in privacy parameter is an invalid pointer. + * @retval ::NRF_ERROR_INVALID_PARAM Out of range parameters are provided. + * @retval ::NRF_ERROR_INVALID_STATE Privacy settings cannot be changed while BLE roles using privacy are enabled. + */ +SVCALL(SD_BLE_GAP_PRIVACY_SET, uint32_t, sd_ble_gap_privacy_set(ble_gap_privacy_params_t const *p_privacy_params)); + + +/**@brief Get privacy settings. + * + * @note The privacy settings returned include the current device irk as well. + * + * @param[in] p_privacy_params Privacy settings. + * + * @retval ::NRF_SUCCESS Privacy settings read. + * @retval ::NRF_ERROR_INVALID_ADDR The pointer given for returning the privacy settings may be NULL or invalid. + Otherwise, the p_device_irk pointer in privacy parameter is an invalid pointer. + */ +SVCALL(SD_BLE_GAP_PRIVACY_GET, uint32_t, sd_ble_gap_privacy_get(ble_gap_privacy_params_t *p_privacy_params)); /**@brief Set, clear or update advertising and scan response data. @@ -1089,8 +1325,6 @@ SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const * cannot however be connectable (it must be of type @ref BLE_GAP_ADV_TYPE_ADV_SCAN_IND or * @ref BLE_GAP_ADV_TYPE_ADV_NONCONN_IND). @note Only one advertiser may be active at any time. * - * @note To use the currently active whitelist set p_adv_params->p_whitelist to NULL. - * * @events * @event{@ref BLE_GAP_EVT_CONNECTED, Generated after connection has been established through connectable advertising.} * @event{@ref BLE_GAP_EVT_TIMEOUT, Advertisement has timed out.} @@ -1098,6 +1332,8 @@ SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const * * @mscs * @mmsc{@ref BLE_GAP_ADV_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_CONN_PRIV_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} * @endmscs * @@ -1113,7 +1349,6 @@ SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Bluetooth address supplied. * @retval ::BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible. * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. - * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. * Stop one or more currently active roles (Central, Peripheral or Observer) and try again */ @@ -1196,8 +1431,9 @@ SVCALL(SD_BLE_GAP_DISCONNECT, uint32_t, sd_ble_gap_disconnect(uint16_t conn_hand /**@brief Set the radio's transmit power. * - * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm). + * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, 3, and 4 dBm). * + * @note The +3dBm setting is only available on nRF52 series ICs. * @note The -30dBm setting is only available on nRF51 series ICs. * @note The -40dBm setting is only available on nRF52 series ICs. * @@ -1254,10 +1490,13 @@ SVCALL(SD_BLE_GAP_PPCP_GET, uint32_t, sd_ble_gap_ppcp_get(ble_gap_conn_params_t * @param[in] p_dev_name Pointer to a UTF-8 encoded, non NULL-terminated string. * @param[in] len Length of the UTF-8, non NULL-terminated string pointed to by p_dev_name in octets (must be smaller or equal than @ref BLE_GAP_DEVNAME_MAX_LEN). * + * @note If the device name is located in application flash memory (see @ref ble_gap_device_name_t), it cannot be changed. Then @ref NRF_ERROR_FORBIDDEN will be returned. + * * @retval ::NRF_SUCCESS GAP device name and permissions set successfully. * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + * @retval ::NRF_ERROR_FORBIDDEN Device name is not writable. */ SVCALL(SD_BLE_GAP_DEVICE_NAME_SET, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len)); @@ -1496,7 +1735,6 @@ SVCALL(SD_BLE_GAP_LESC_OOB_DATA_GET, uint32_t, sd_ble_gap_lesc_oob_data_get(uint /**@brief Provide the OOB data sent/received out of band. * - * @note At least one of the 2 pointers provided must be different from NULL. * @note An authentication procedure with OOB selected as an algorithm must be in progress when calling this function. * @note A @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST event with the oobd_req set to 1 must have been received prior to calling this function. * @@ -1510,8 +1748,11 @@ SVCALL(SD_BLE_GAP_LESC_OOB_DATA_GET, uint32_t, sd_ble_gap_lesc_oob_data_get(uint * @endmscs * * @param[in] conn_handle Connection handle. - * @param[in] p_oobd_own The OOB data sent out of band to a peer or NULL if none sent. + * @param[in] p_oobd_own The OOB data sent out of band to a peer or NULL if the peer has not received OOB data. + * Must correspond to @ref ble_gap_sec_params_t::oob flag in @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. * @param[in] p_oobd_peer The OOB data received out of band from a peer or NULL if none received. + * Must correspond to @ref ble_gap_sec_params_t::oob flag in @ref sd_ble_gap_authenticate in the central role + * or @ref sd_ble_gap_sec_params_reply in the peripheral role. * * @retval ::NRF_SUCCESS OOB data accepted. * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. @@ -1652,7 +1893,6 @@ SVCALL(SD_BLE_GAP_RSSI_GET, uint32_t, sd_ble_gap_rssi_get(uint16_t conn_handle, /**@brief Start scanning (GAP Discovery procedure, Observer Procedure). * - * @note To use the currently active whitelist set p_scan_params->p_whitelist to NULL. * * @events * @event{@ref BLE_GAP_EVT_ADV_REPORT, An advertising or scan response packet has been received.} @@ -1671,7 +1911,6 @@ SVCALL(SD_BLE_GAP_RSSI_GET, uint32_t, sd_ble_gap_rssi_get(uint16_t conn_handle, * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. - * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. * Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again */ @@ -1693,29 +1932,34 @@ SVCALL(SD_BLE_GAP_SCAN_STOP, uint32_t, sd_ble_gap_scan_stop(void)); /**@brief Create a connection (GAP Link Establishment). * - * @note To use the currently active whitelist set p_scan_params->p_whitelist to NULL. * @note If a scanning procedure is currently in progress it will be automatically stopped when calling this function. * * @mscs * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_CONN_PRIV_MSC} * @mmsc{@ref BLE_GAP_CENTRAL_CONN_MSC} * @endmscs * - * @param[in] p_peer_addr Pointer to peer address. If the selective bit is set in @ref ble_gap_scan_params_t, then this must be NULL. + * @param[in] p_peer_addr Pointer to peer address. If the use_whitelist bit is set in @ref ble_gap_scan_params_t, then this is ignored. + * If @ref ble_gap_addr_t::addr_id_peer is set then p_peer_addr must be present in the device identity list + * see @ref sd_ble_gap_device_identities_set. * @param[in] p_scan_params Pointer to scan parameters structure. * @param[in] p_conn_params Pointer to desired connection parameters. * * @retval ::NRF_SUCCESS Successfully initiated connection procedure. * @retval ::NRF_ERROR_INVALID_ADDR Invalid parameter(s) pointer supplied. * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + - Invalid parameter(s) in p_scan_params or p_conn_params. + - Use of whitelist requested but whitelist has not been set, see @ref sd_ble_gap_whitelist_set. + - Peer address was not present in the device identity list, see @ref sd_ble_gap_device_identities_set. + * @retval ::NRF_ERROR_INVALID_STATE The SoftDevice is in an invalid state to perform this operation. This may be due to an + * existing locally initiated connect procedure, which must complete before initiating again. * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Peer address. * @retval ::NRF_ERROR_CONN_COUNT The limit of available connections has been reached. * @retval ::NRF_ERROR_NO_MEM The configured memory pool (see @ref ble_conn_bw_counts_t) is not large enough for the * bandwidth selected for this connection. * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. If another connection is being established * wait for the corresponding @ref BLE_GAP_EVT_CONNECTED event before calling again. - * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE Unable to replace the whitelist while another operation is using it. * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. * Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again */ @@ -1733,12 +1977,45 @@ SVCALL(SD_BLE_GAP_CONNECT, uint32_t, sd_ble_gap_connect(ble_gap_addr_t const *p_ */ SVCALL(SD_BLE_GAP_CONNECT_CANCEL, uint32_t, sd_ble_gap_connect_cancel(void)); + +/**@brief PHY Update Request + * + * @details This function is used to request a new PHY configuration for a central or a peripheral connection. It will always generate a + * @ref BLE_GAP_EVT_PHY_UPDATE event if successfully executed. If @ref ble_gap_phys_t::tx_phys or @ref ble_gap_phys_t::rx_phys + * is 0, then the stack will select PHYs based on the peer requirements on that specific direction. If the peer does not support + * the PHY Update procedure, then the resulting @ref BLE_GAP_EVT_PHY_UPDATE event will have a status different from + * @ref BLE_HCI_STATUS_CODE_SUCCESS. + * + * @note The requested PHYs does not have to be within the set of the preferred PHYs. + * + * @events + * @event{@ref BLE_GAP_EVT_PHY_UPDATE, Result of the PHY Update procedure procedure.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_PHY_REQUEST} + * @mmsc{@ref BLE_GAP_PERIPHERAL_PHY_REQUEST} + * @endmscs + * + * @param[in] conn_handle Connection handle to indicate the connection for which the PHY Update is requested. + * @param[in] p_gap_phys Pointer to PHY structure. + * + * @retval ::NRF_SUCCESS Successfully requested a PHY Update. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Unsupported PHYs supplied to the call. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_BUSY Procedure is already in progress or not allowed at this time. Process pending events and wait for the pending procedure to complete and retry. + * + */ +SVCALL(SD_BLE_GAP_PHY_REQUEST, uint32_t, sd_ble_gap_phy_request(uint16_t conn_handle, ble_gap_phys_t const *p_gap_phys)); + /** @} */ #ifdef __cplusplus } #endif -#endif // NRF_BLE_GAP_H__ +#endif // BLE_GAP_H__ /** @} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatt.h similarity index 91% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatt.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatt.h index c7023502bd..cfa3860b5f 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatt.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatt.h @@ -36,18 +36,17 @@ * */ - /** @addtogroup BLE_GATT Generic Attribute Profile (GATT) Common @{ @brief Common definitions and prototypes for the GATT interfaces. */ -#ifndef NRF_BLE_GATT_H__ -#define NRF_BLE_GATT_H__ +#ifndef BLE_GATT_H__ +#define BLE_GATT_H__ -#include "nrf_ble_types.h" -#include "nrf_ble_ranges.h" +#include "ble_types.h" +#include "ble_ranges.h" #ifdef __cplusplus extern "C" { @@ -56,12 +55,8 @@ extern "C" { /** @addtogroup BLE_GATT_DEFINES Defines * @{ */ -/** @brief Default MTU size. */ -#define GATT_MTU_SIZE_DEFAULT 23 - -/** @brief Only the default MTU size of 23 is currently supported. */ -#define GATT_RX_MTU 23 - +/** @brief Default MTU size, in bytes. */ +#define BLE_GATT_MTU_SIZE_DEFAULT 23 /**@brief Invalid Attribute Handle. */ #define BLE_GATT_HANDLE_INVALID 0x0000 @@ -74,7 +69,7 @@ extern "C" { /** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources * @{ */ -#define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */ +#define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */ /** @} */ /** @defgroup BLE_GATT_WRITE_OPS GATT Write operations @@ -89,8 +84,8 @@ extern "C" { /** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags * @{ */ -#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00 -#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01 +#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00 /**< Cancel prepared write. */ +#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01 /**< Execute prepared write. */ /** @} */ /** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations @@ -181,6 +176,21 @@ extern "C" { /** @addtogroup BLE_GATT_STRUCTURES Structures * @{ */ +/** + * @brief BLE GATT initialization parameters. + */ +typedef struct +{ + uint16_t att_mtu; /**< Maximum size of ATT packet the SoftDevice can send or receive. + If it is 0 then @ref BLE_GATT_MTU_SIZE_DEFAULT will be used. + Otherwise @ref BLE_GATT_MTU_SIZE_DEFAULT is the minimum value. + @mscs + @mmsc{@ref BLE_GATTC_MTU_EXCHANGE} + @mmsc{@ref BLE_GATTS_MTU_EXCHANGE} + @endmscs + */ +} ble_gatt_enable_params_t; + /**@brief GATT Characteristic Properties. */ typedef struct { @@ -202,14 +212,11 @@ typedef struct uint8_t wr_aux :1; /**< Writing the Characteristic User Description descriptor permitted. */ } ble_gatt_char_ext_props_t; +/** @} */ + #ifdef __cplusplus } #endif -#endif // NRF_BLE_GATT_H__ +#endif // BLE_GATT_H__ /** @} */ - -/** - @} - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gattc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gattc.h similarity index 79% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gattc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gattc.h index 5aa20fe430..c36a4d7e34 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gattc.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gattc.h @@ -36,20 +36,21 @@ * */ - /** @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client @{ @brief Definitions and prototypes for the GATT Client interface. */ -#ifndef NRF_BLE_GATTC_H__ -#define NRF_BLE_GATTC_H__ +#ifndef BLE_GATTC_H__ +#define BLE_GATTC_H__ -#include "nrf_ble_gatt.h" -#include "nrf_ble_types.h" -#include "nrf_ble_ranges.h" +#include "ble_gatt.h" +#include "ble_types.h" +#include "ble_ranges.h" #include "nrf_svc.h" +#include "nrf_error.h" +#include "nrf.h" #ifdef __cplusplus extern "C" { @@ -71,6 +72,7 @@ enum BLE_GATTC_SVCS SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */ SD_BLE_GATTC_WRITE, /**< Generic write. */ SD_BLE_GATTC_HV_CONFIRM, /**< Handle Value Confirmation. */ + SD_BLE_GATTC_EXCHANGE_MTU_REQUEST, /**< Exchange MTU Request. */ }; /** @@ -88,6 +90,7 @@ enum BLE_GATTC_EVTS BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. \n See @ref ble_gattc_evt_char_vals_read_rsp_t. */ BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. \n See @ref ble_gattc_evt_write_rsp_t. */ BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. \n Confirm indication with @ref sd_ble_gattc_hv_confirm. \n See @ref ble_gattc_evt_hvx_t. */ + BLE_GATTC_EVT_EXCHANGE_MTU_RSP, /**< Exchange MTU Response event. \n See @ref ble_gattc_evt_exchange_mtu_rsp_t. */ BLE_GATTC_EVT_TIMEOUT /**< Timeout event. \n See @ref ble_gattc_evt_timeout_t. */ }; @@ -158,23 +161,27 @@ typedef struct /**@brief Write Parameters. */ typedef struct { - uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ - uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ - uint16_t handle; /**< Handle to the attribute to be written. */ - uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ - uint16_t len; /**< Length of data in bytes. */ - uint8_t *p_value; /**< Pointer to the value data. */ + uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ + uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ + uint16_t handle; /**< Handle to the attribute to be written. */ + uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ + uint16_t len; /**< Length of data in bytes. */ + uint8_t const *p_value; /**< Pointer to the value data. */ } ble_gattc_write_params_t; -/**@brief Attribute Information. */ +/**@brief Attribute Information for 16-bit Attribute UUID. */ typedef struct { - uint16_t handle; /**< Attribute handle. */ - union { - ble_uuid_t uuid16; /**< 16-bit Attribute UUID. */ - ble_uuid128_t uuid128; /**< 128-bit Attribute UUID. */ - } info; -} ble_gattc_attr_info_t; + uint16_t handle; /**< Attribute handle. */ + ble_uuid_t uuid; /**< 16-bit Attribute UUID. */ +} ble_gattc_attr_info16_t; + +/**@brief Attribute Information for 128-bit Attribute UUID. */ +typedef struct +{ + uint16_t handle; /**< Attribute handle. */ + ble_uuid128_t uuid; /**< 128-bit Attribute UUID. */ +} ble_gattc_attr_info128_t; /**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */ typedef struct @@ -211,19 +218,23 @@ typedef struct /**@brief Event structure for @ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP. */ typedef struct { - uint16_t count; /**< Attribute count. */ - uint8_t format; /**< Attribute information format, see @ref BLE_GATTC_ATTR_INFO_FORMAT. */ - ble_gattc_attr_info_t attr_info[1]; /**< Attribute information. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ + uint16_t count; /**< Attribute count. */ + uint8_t format; /**< Attribute information format, see @ref BLE_GATTC_ATTR_INFO_FORMAT. */ + union { + ble_gattc_attr_info16_t attr_info16[1]; /**< Attribute information for 16-bit Attribute UUID. + @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ + ble_gattc_attr_info128_t attr_info128[1]; /**< Attribute information for 128-bit Attribute UUID. + @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ + } info; /**< Attribute information union. */ } ble_gattc_evt_attr_info_disc_rsp_t; /**@brief GATT read by UUID handle value pair. */ typedef struct { uint16_t handle; /**< Attribute Handle. */ - uint8_t *p_value; /**< Pointer to value, variable length (length available as value_len in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t). - Please note that this pointer is absolute to the memory provided by the user when retrieving the event, - so it will effectively point to a location inside the handle_value array. */ + uint8_t *p_value; /**< Pointer to the Attribute Value, length is available in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t::value_len. */ } ble_gattc_handle_value_t; /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */ @@ -231,7 +242,8 @@ typedef struct { uint16_t count; /**< Handle-Value Pair Count. */ uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */ - ble_gattc_handle_value_t handle_value[1]; /**< Handle-Value(s) list. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + uint8_t handle_value[1]; /**< Handle-Value(s) list. To iterate through the list use @ref sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter. + @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ } ble_gattc_evt_char_val_by_uuid_read_rsp_t; @@ -274,6 +286,12 @@ typedef struct See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ } ble_gattc_evt_hvx_t; +/**@brief Event structure for @ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP. */ +typedef struct +{ + uint16_t server_rx_mtu; /**< Server RX MTU size. */ +} ble_gattc_evt_exchange_mtu_rsp_t; + /**@brief Event structure for @ref BLE_GATTC_EVT_TIMEOUT. */ typedef struct { @@ -297,6 +315,7 @@ typedef struct ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */ ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */ ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */ + ble_gattc_evt_exchange_mtu_rsp_t exchange_mtu_rsp; /**< Exchange MTU Response Event Parameters. */ ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */ ble_gattc_evt_attr_info_disc_rsp_t attr_info_disc_rsp; /**< Attribute Information Discovery Event Parameters. */ } params; /**< Event Parameters. @note Only valid if @ref gatt_status == @ref BLE_GATT_STATUS_SUCCESS. */ @@ -395,7 +414,7 @@ SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteris * this must be called again with an updated handle range to continue the discovery. * * @events - * @event{BLE_GATTC_EVT_DESC_DISC_RSP} + * @event{@ref BLE_GATTC_EVT_DESC_DISC_RSP} * @endevents * * @mscs @@ -420,7 +439,7 @@ SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_dis * this must be called again with an updated handle range to continue the discovery. * * @events - * @event{BLE_GATTC_EVT_DESC_DISC_RSP} + * @event{@ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP} * @endevents * * @mscs @@ -447,7 +466,7 @@ SVCALL(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, uint32_t, sd_ble_gattc_char_value_b * complete value. * * @events - * @event{@ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP} + * @event{@ref BLE_GATTC_EVT_READ_RSP} * @endevents * * @mscs @@ -559,14 +578,92 @@ SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_ */ SVCALL(SD_BLE_GATTC_ATTR_INFO_DISCOVER, uint32_t, sd_ble_gattc_attr_info_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * p_handle_range)); +/**@brief Start an ATT_MTU exchange by sending an Exchange MTU Request to the server. + * + * @details The SoftDevice sets ATT_MTU to the minimum of: + * - The Client RX MTU value, and + * - The Server RX MTU value from @ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP. + * + * However, the SoftDevice never sets ATT_MTU lower than @ref BLE_GATT_MTU_SIZE_DEFAULT. + * + * @events + * @event{@ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP} + * @event{@ref BLE_EVT_DATA_LENGTH_CHANGED, Generated if a data length update procedure is performed after the ATT_MTU exchange.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_MTU_EXCHANGE} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] client_rx_mtu Client RX MTU size. + * - The minimum value is @ref BLE_GATT_MTU_SIZE_DEFAULT. + * - The maximum value is @ref ble_gatt_enable_params_t::att_mtu. + * - The value must be equal to Server RX MTU size given in @ref sd_ble_gatts_exchange_mtu_reply + * if an ATT_MTU exchange has already been performed in the other direction. + * + * @retval ::NRF_SUCCESS Successfully sent request to the server. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid connection state or an ATT_MTU exchange was already requested once. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid Client RX MTU size supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_EXCHANGE_MTU_REQUEST, uint32_t, sd_ble_gattc_exchange_mtu_request(uint16_t conn_handle, uint16_t client_rx_mtu)); + +/**@brief Iterate through Handle-Value(s) list in @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event. + * + * @param[in] p_gattc_evt Pointer to event buffer containing @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event. + * @note If the buffer contains different event, behavior is undefined. + * @param[in,out] p_iter Iterator, points to @ref ble_gattc_handle_value_t structure that will be filled in with + * the next Handle-Value pair in each iteration. If the function returns other than + * @ref NRF_SUCCESS, it will not be changed. + * - To start iteration, initialize the structure to zero. + * - To continue, pass the value from previous iteration. + * + * \code + * ble_gattc_handle_value_t iter; + * memset(&iter, 0, sizeof(ble_gattc_handle_value_t)); + * while (sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(&ble_evt.evt.gattc_evt, &iter) == NRF_SUCCESS) + * { + * app_handle = iter.handle; + * memcpy(app_value, iter.p_value, ble_evt.evt.gattc_evt.params.char_val_by_uuid_read_rsp.value_len); + * } + * \endcode + * + * @retval ::NRF_SUCCESS Successfully retrieved the next Handle-Value pair. + * @retval ::NRF_ERROR_NOT_FOUND No more Handle-Value pairs available in the list. + */ +__STATIC_INLINE uint32_t sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(ble_gattc_evt_t *p_gattc_evt, ble_gattc_handle_value_t *p_iter); + /** @} */ +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE uint32_t sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(ble_gattc_evt_t *p_gattc_evt, ble_gattc_handle_value_t *p_iter) +{ + uint32_t value_len = p_gattc_evt->params.char_val_by_uuid_read_rsp.value_len; + uint8_t *p_first = p_gattc_evt->params.char_val_by_uuid_read_rsp.handle_value; + uint8_t *p_next = p_iter->p_value ? p_iter->p_value + value_len : p_first; + + if ((p_next - p_first) / (sizeof(uint16_t) + value_len) < p_gattc_evt->params.char_val_by_uuid_read_rsp.count) + { + p_iter->handle = (uint16_t)p_next[1] << 8 | p_next[0]; + p_iter->p_value = p_next + sizeof(uint16_t); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_NOT_FOUND; + } +} + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + #ifdef __cplusplus } #endif -#endif /* NRF_BLE_GATTC_H__ */ +#endif /* BLE_GATTC_H__ */ /** @} - @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatts.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatts.h similarity index 87% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatts.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatts.h index 147d1a8fbf..b85735ec31 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_gatts.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatts.h @@ -36,21 +36,20 @@ * */ - /** @addtogroup BLE_GATTS Generic Attribute Profile (GATT) Server @{ @brief Definitions and prototypes for the GATTS interface. */ -#ifndef NRF_BLE_GATTS_H__ -#define NRF_BLE_GATTS_H__ +#ifndef BLE_GATTS_H__ +#define BLE_GATTS_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 "ble_types.h" +#include "ble_ranges.h" +#include "ble_l2cap.h" +#include "ble_gap.h" +#include "ble_gatt.h" #include "nrf_svc.h" #ifdef __cplusplus @@ -77,7 +76,8 @@ enum BLE_GATTS_SVCS SD_BLE_GATTS_SYS_ATTR_SET, /**< Set the persistent system attributes for a connection. */ SD_BLE_GATTS_SYS_ATTR_GET, /**< Retrieve the persistent system attributes. */ SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, /**< Retrieve the first valid user handle. */ - SD_BLE_GATTS_ATTR_GET /**< Retrieve the UUID and/or metadata of an attribute. */ + SD_BLE_GATTS_ATTR_GET, /**< Retrieve the UUID and/or metadata of an attribute. */ + SD_BLE_GATTS_EXCHANGE_MTU_REPLY /**< Reply to Exchange MTU Request. */ }; /** @@ -90,6 +90,7 @@ enum BLE_GATTS_EVTS BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending. \n Respond with @ref sd_ble_gatts_sys_attr_set. \n See @ref ble_gatts_evt_sys_attr_missing_t. */ BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. \n See @ref ble_gatts_evt_hvc_t. */ BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. No additional event structure applies. */ + BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST, /**< Exchange MTU Request. \n Reply with @ref sd_ble_gatts_exchange_mtu_reply. \n See @ref ble_gatts_evt_exchange_mtu_request_t. */ BLE_GATTS_EVT_TIMEOUT /**< Peer failed to resonpond to an ATT request in time. \n See @ref ble_gatts_evt_timeout_t. */ }; /** @} */ @@ -165,7 +166,7 @@ enum BLE_GATTS_EVTS /** @defgroup BLE_GATTS_ATTR_TAB_SIZE Attribute Table size * @{ */ -#define BLE_GATTS_ATTR_TAB_SIZE_MIN 216 /**< Minimum Attribute Table size */ +#define BLE_GATTS_ATTR_TAB_SIZE_MIN 248 /**< Minimum Attribute Table size */ #define BLE_GATTS_ATTR_TAB_SIZE_DEFAULT 0x0000 /**< Default Attribute Table size (0x580 bytes for this version of the SoftDevice). */ /** @} */ @@ -179,8 +180,8 @@ enum BLE_GATTS_EVTS */ typedef struct { - uint8_t service_changed:1; /**< Include the Service Changed characteristic in the Attribute Table. */ - uint32_t attr_tab_size; /**< Attribute Table size in bytes. The size must be a multiple of 4. @ref BLE_GATTS_ATTR_TAB_SIZE_DEFAULT is used to set the default size. */ + uint8_t service_changed:1; /**< Include the Service Changed characteristic in the Attribute Table. */ + uint32_t attr_tab_size; /**< Attribute Table size in bytes. The size must be a multiple of 4. @ref BLE_GATTS_ATTR_TAB_SIZE_DEFAULT is used to set the default size. */ } ble_gatts_enable_params_t; /**@brief Attribute metadata. */ @@ -270,7 +271,7 @@ typedef struct { uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ uint8_t update : 1; /**< If set, data supplied in p_data will be used to update the attribute value. - Please note that for @ref BLE_GATTS_OP_WRITE_REQ operations this bit must always be set, + Please note that for @ref BLE_GATTS_AUTHORIZE_TYPE_WRITE operations this bit must always be set, as the data to be written needs to be stored and later provided by the application. */ uint16_t offset; /**< Offset of the attribute value being updated. */ uint16_t len; /**< Length in bytes of the value in p_data pointer, see @ref BLE_GATTS_ATTR_LENS_MAX. */ @@ -333,6 +334,12 @@ typedef struct uint16_t handle; /**< Attribute Handle. */ } ble_gatts_evt_hvc_t; +/**@brief Event structure for @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST. */ +typedef struct +{ + uint16_t client_rx_mtu; /**< Client RX MTU size. */ +} ble_gatts_evt_exchange_mtu_request_t; + /**@brief Event structure for @ref BLE_GATTS_EVT_TIMEOUT. */ typedef struct { @@ -340,18 +347,19 @@ typedef struct } ble_gatts_evt_timeout_t; -/**@brief GATT Server event callback event structure. */ +/**@brief GATTS event structure. */ typedef struct { uint16_t conn_handle; /**< Connection Handle on which the event occurred. */ union { - ble_gatts_evt_write_t write; /**< Write Event Parameters. */ - ble_gatts_evt_rw_authorize_request_t authorize_request; /**< Read or Write Authorize Request Parameters. */ - ble_gatts_evt_sys_attr_missing_t sys_attr_missing; /**< System attributes missing. */ - ble_gatts_evt_hvc_t hvc; /**< Handle Value Confirmation Event Parameters. */ - ble_gatts_evt_timeout_t timeout; /**< Timeout Event. */ - } params; /**< Event Parameters. */ + ble_gatts_evt_write_t write; /**< Write Event Parameters. */ + ble_gatts_evt_rw_authorize_request_t authorize_request; /**< Read or Write Authorize Request Parameters. */ + ble_gatts_evt_sys_attr_missing_t sys_attr_missing; /**< System attributes missing. */ + ble_gatts_evt_hvc_t hvc; /**< Handle Value Confirmation Event Parameters. */ + ble_gatts_evt_exchange_mtu_request_t exchange_mtu_request; /**< Exchange MTU Request Event Parameters. */ + ble_gatts_evt_timeout_t timeout; /**< Timeout Event. */ + } params; /**< Event Parameters. */ } ble_gatts_evt_t; /** @} */ @@ -399,6 +407,7 @@ SVCALL(SD_BLE_GATTS_SERVICE_ADD, uint32_t, sd_ble_gatts_service_add(uint8_t type * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, handle values need to match previously added services. * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_NOT_SUPPORTED Feature is not supported, service_handle must be that of the last added service. * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, self inclusions are not allowed. * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. @@ -466,7 +475,7 @@ SVCALL(SD_BLE_GATTS_DESCRIPTOR_ADD, uint32_t, sd_ble_gatts_descriptor_add(uint16 * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} * @endmscs * - * @param[in] conn_handle Connection handle. If the value does not belong to a system attribute then @ref BLE_CONN_HANDLE_INVALID can be used. + * @param[in] conn_handle Connection handle. Ignored if the value does not belong to a system attribute. * @param[in] handle Attribute handle. * @param[in,out] p_value Attribute value information. * @@ -476,8 +485,7 @@ SVCALL(SD_BLE_GATTS_DESCRIPTOR_ADD, uint32_t, sd_ble_gatts_descriptor_add(uint16 * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. * @retval ::NRF_ERROR_FORBIDDEN Forbidden handle supplied, certain attributes are not modifiable by the application. * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE @ref BLE_CONN_HANDLE_INVALID supplied on a system attribute. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied on a system attribute. */ SVCALL(SD_BLE_GATTS_VALUE_SET, uint32_t, sd_ble_gatts_value_set(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)); @@ -492,7 +500,7 @@ SVCALL(SD_BLE_GATTS_VALUE_SET, uint32_t, sd_ble_gatts_value_set(uint16_t conn_ha * may refer to an already disconnected connection. Refer to the documentation of * @ref sd_ble_gatts_sys_attr_get for further information. * - * @param[in] conn_handle Connection handle. If the value does not belong to a system attribute then @ref BLE_CONN_HANDLE_INVALID can be used. + * @param[in] conn_handle Connection handle. Ignored if the value does not belong to a system attribute. * @param[in] handle Attribute handle. * @param[in,out] p_value Attribute value information. * @@ -500,8 +508,8 @@ SVCALL(SD_BLE_GATTS_VALUE_SET, uint32_t, sd_ble_gatts_value_set(uint16_t conn_ha * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. * @retval ::NRF_ERROR_INVALID_PARAM Invalid attribute offset supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE @ref BLE_CONN_HANDLE_INVALID supplied on a system attribute. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied on a system attribute. + * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. */ SVCALL(SD_BLE_GATTS_VALUE_GET, uint32_t, sd_ble_gatts_value_get(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)); @@ -514,8 +522,8 @@ SVCALL(SD_BLE_GATTS_VALUE_GET, uint32_t, sd_ble_gatts_value_get(uint16_t conn_ha * the peer. * * @note The local attribute value may be updated even if an outgoing packet is not sent to the peer due to an error during execution. - * When receiveing the error codes @ref NRF_ERROR_INVALID_STATE, @ref NRF_ERROR_BUSY, @ref BLE_ERROR_GATTS_SYS_ATTR_MISSING and - * @ref BLE_ERROR_NO_TX_PACKETS the Attribute Table has been updated. + * The Attribute Table has been updated if one of the following error codes is returned: @ref NRF_ERROR_INVALID_STATE, @ref NRF_ERROR_BUSY, + * @ref NRF_ERROR_FORBIDDEN, @ref BLE_ERROR_GATTS_SYS_ATTR_MISSING and @ref BLE_ERROR_NO_TX_PACKETS. * The caller can check whether the value has been updated by looking at the contents of *(p_hvx_params->p_len). * * @note It is important to note that a notification will consume an application buffer, and will therefore @@ -542,12 +550,16 @@ SVCALL(SD_BLE_GATTS_VALUE_GET, uint32_t, sd_ble_gatts_value_get(uint16_t conn_ha * * @retval ::NRF_SUCCESS Successfully queued a notification or indication for transmission, and optionally updated the attribute value. * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or notifications and/or indications not enabled in the CCCD. + * @retval ::NRF_ERROR_INVALID_STATE One or more of the following is true: + * - Invalid Connection State + * - Notifications and/or indications not enabled in the CCCD + * - An ATT_MTU exchange is ongoing * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied. Only attributes added directly by the application are available to notify and indicate. * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE Invalid attribute type(s) supplied, only characteristic values may be notified and indicated. * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + * @retval ::NRF_ERROR_FORBIDDEN The connection's current security level is lower than the one required by the write permissions of the CCCD associated with this characteristic. * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. * @retval ::NRF_ERROR_BUSY Procedure already in progress. * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. @@ -578,7 +590,10 @@ SVCALL(SD_BLE_GATTS_HVX, uint32_t, sd_ble_gatts_hvx(uint16_t conn_handle, ble_ga * @retval ::NRF_SUCCESS Successfully queued the Service Changed indication for transmission. * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. * @retval ::NRF_ERROR_NOT_SUPPORTED Service Changed not enabled at initialization. See @ref sd_ble_enable and @ref ble_gatts_enable_params_t. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or notifications and/or indications not enabled in the CCCD. + * @retval ::NRF_ERROR_INVALID_STATE One or more of the following is true: + * - Invalid Connection State + * - Notifications and/or indications not enabled in the CCCD + * - An ATT_MTU exchange is ongoing * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied, handles must be in the range populated by the application. * @retval ::NRF_ERROR_BUSY Procedure already in progress. @@ -603,6 +618,10 @@ SVCALL(SD_BLE_GATTS_SERVICE_CHANGED, uint32_t, sd_ble_gatts_service_changed(uint * @param[in] conn_handle Connection handle. * @param[in] p_rw_authorize_reply_params Pointer to a structure with the attribute provided by the application. * + * @note @ref ble_gatts_authorize_params_t::p_data is ignored when this function is used to respond + * to a @ref BLE_GATTS_AUTHORIZE_TYPE_READ event if @ref ble_gatts_authorize_params_t::update + * is set to 0. + * * @retval ::NRF_SUCCESS Successfully queued a response to the peer, and in the case of a write operation, Attribute Table updated. * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. @@ -652,6 +671,7 @@ SVCALL(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, uint32_t, sd_ble_gatts_rw_authorize_repl * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid flags supplied. * @retval ::NRF_ERROR_INVALID_DATA Invalid data supplied, the data should be exactly the same as retrieved with @ref sd_ble_gatts_sys_attr_get. * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. @@ -685,6 +705,7 @@ SVCALL(SD_BLE_GATTS_SYS_ATTR_SET, uint32_t, sd_ble_gatts_sys_attr_set(uint16_t c * @retval ::NRF_SUCCESS Successfully retrieved the system attribute information. * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid flags supplied. * @retval ::NRF_ERROR_DATA_SIZE The system attribute information did not fit into the provided buffer. * @retval ::NRF_ERROR_NOT_FOUND No system attributes found. */ @@ -713,12 +734,44 @@ SVCALL(SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, uint32_t, sd_ble_gatts_initial_user */ SVCALL(SD_BLE_GATTS_ATTR_GET, uint32_t, sd_ble_gatts_attr_get(uint16_t handle, ble_uuid_t * p_uuid, ble_gatts_attr_md_t * p_md)); +/**@brief Reply to an ATT_MTU exchange request by sending an Exchange MTU Response to the client. + * + * @details This function is only used to reply to a @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST event. + * + * @details The SoftDevice sets ATT_MTU to the minimum of: + * - The Client RX MTU value from @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST, and + * - The Server RX MTU value. + * + * However, the SoftDevice never sets ATT_MTU lower than @ref BLE_GATT_MTU_SIZE_DEFAULT. + * + * @events + * @event{@ref BLE_EVT_DATA_LENGTH_CHANGED, Generated if a data length update procedure is performed after the ATT_MTU exchange.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTS_MTU_EXCHANGE} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] server_rx_mtu Server RX MTU size. + * - The minimum value is @ref BLE_GATT_MTU_SIZE_DEFAULT. + * - The maximum value is @ref ble_gatt_enable_params_t::att_mtu. + * - The value must be equal to Client RX MTU size given in @ref sd_ble_gattc_exchange_mtu_request + * if an ATT_MTU exchange has already been performed in the other direction. + * + * @retval ::NRF_SUCCESS Successfully sent response to the client. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no ATT_MTU exchange request pending. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid Server RX MTU size supplied. + * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_GATTS_EXCHANGE_MTU_REPLY, uint32_t, sd_ble_gatts_exchange_mtu_reply(uint16_t conn_handle, uint16_t server_rx_mtu)); /** @} */ #ifdef __cplusplus } #endif -#endif // NRF_BLE_GATTS_H__ +#endif // BLE_GATTS_H__ /** @} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_hci.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_hci.h similarity index 96% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_hci.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_hci.h index a709c0a60f..fd619b52c8 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_hci.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_hci.h @@ -36,15 +36,14 @@ * */ - /** - @addtogroup BLE_COMMON + @addtogroup BLE_COMMON @{ */ -#ifndef NRF_BLE_HCI_H__ -#define NRF_BLE_HCI_H__ +#ifndef BLE_HCI_H__ +#define BLE_HCI_H__ #ifdef __cplusplus extern "C" { #endif @@ -92,7 +91,7 @@ extern "C" { 0x21 Role Change Not Allowed */ #define BLE_HCI_STATUS_CODE_LMP_RESPONSE_TIMEOUT 0x22 /**< LMP Response Timeout. */ -/*0x23 LMP Error Transaction Collision*/ +#define BLE_HCI_STATUS_CODE_LMP_ERROR_TRANSACTION_COLLISION 0x23 /**< LMP Error Transaction Collision/LL Procedure Collision. */ #define BLE_HCI_STATUS_CODE_LMP_PDU_NOT_ALLOWED 0x24 /**< LMP PDU Not Allowed. */ /*0x25 Encryption Mode Not Acceptable 0x26 Link Key Can Not be Changed @@ -129,6 +128,6 @@ extern "C" { #ifdef __cplusplus } #endif -#endif // NRF_BLE_HCI_H__ +#endif // BLE_HCI_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_l2cap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_l2cap.h similarity index 97% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_l2cap.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_l2cap.h index 57d3592969..eaad7e50fc 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_l2cap.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_l2cap.h @@ -36,19 +36,18 @@ * */ - /** @addtogroup BLE_L2CAP Logical Link Control and Adaptation Protocol (L2CAP) @{ @brief Definitions and prototypes for the L2CAP interface. */ -#ifndef NRF_BLE_L2CAP_H__ -#define NRF_BLE_L2CAP_H__ +#ifndef BLE_L2CAP_H__ +#define BLE_L2CAP_H__ -#include "nrf_ble_types.h" -#include "nrf_ble_ranges.h" -#include "nrf_ble_err.h" +#include "ble_types.h" +#include "ble_ranges.h" +#include "ble_err.h" #include "nrf_svc.h" #ifdef __cplusplus @@ -198,7 +197,7 @@ SVCALL(SD_BLE_L2CAP_TX, uint32_t, sd_ble_l2cap_tx(uint16_t conn_handle, ble_l2ca #ifdef __cplusplus } #endif -#endif // NRF_BLE_L2CAP_H__ +#endif // BLE_L2CAP_H__ /** @} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_ranges.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_ranges.h similarity index 75% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_ranges.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_ranges.h index 7476d488c0..051d1438d1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_ranges.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_ranges.h @@ -36,7 +36,6 @@ * */ - /** @addtogroup BLE_COMMON @{ @@ -57,71 +56,83 @@ which defines names of each individual SVC code based on the range start value. */ -#ifndef NRF_BLE_RANGES_H__ -#define NRF_BLE_RANGES_H__ +#ifndef BLE_RANGES_H__ +#define BLE_RANGES_H__ #ifdef __cplusplus extern "C" { #endif #define BLE_SVC_BASE 0x60 /**< Common BLE SVC base. */ -#define BLE_SVC_LAST 0x6B /**< Total: 12. */ +#define BLE_SVC_LAST 0x6B /**< Common BLE SVC last. */ -#define BLE_RESERVED_SVC_BASE 0x6C /**< Reserved BLE SVC base. */ -#define BLE_RESERVED_SVC_LAST 0x6F /**< Total: 4. */ -#define BLE_GAP_SVC_BASE 0x70 /**< GAP BLE SVC base. */ -#define BLE_GAP_SVC_LAST 0x8F /**< Total: 32. */ +#define BLE_GAP_SVC_BASE 0x6C /**< GAP BLE SVC base. */ +#define BLE_GAP_SVC_LAST 0x93 /**< GAP BLE SVC last. */ + + +#define BLE_GATTC_SVC_BASE 0x94 /**< GATTC BLE SVC base. */ +#define BLE_GATTC_SVC_LAST 0x9F /**< GATTC BLE SVC last. */ -#define BLE_GATTC_SVC_BASE 0x90 /**< GATTC BLE SVC base. */ -#define BLE_GATTC_SVC_LAST 0x9F /**< Total: 32. */ #define BLE_GATTS_SVC_BASE 0xA0 /**< GATTS BLE SVC base. */ -#define BLE_GATTS_SVC_LAST 0xAF /**< Total: 16. */ +#define BLE_GATTS_SVC_LAST 0xAF /**< GATTS BLE SVC last. */ + #define BLE_L2CAP_SVC_BASE 0xB0 /**< L2CAP BLE SVC base. */ -#define BLE_L2CAP_SVC_LAST 0xBF /**< Total: 16. */ +#define BLE_L2CAP_SVC_LAST 0xBF /**< L2CAP BLE SVC last. */ #define BLE_EVT_INVALID 0x00 /**< Invalid BLE Event. */ + #define BLE_EVT_BASE 0x01 /**< Common BLE Event base. */ -#define BLE_EVT_LAST 0x0F /**< Total: 15. */ +#define BLE_EVT_LAST 0x0F /**< Common BLE Event last. */ + #define BLE_GAP_EVT_BASE 0x10 /**< GAP BLE Event base. */ -#define BLE_GAP_EVT_LAST 0x2F /**< Total: 32. */ +#define BLE_GAP_EVT_LAST 0x2F /**< GAP BLE Event last. */ + #define BLE_GATTC_EVT_BASE 0x30 /**< GATTC BLE Event base. */ -#define BLE_GATTC_EVT_LAST 0x4F /**< Total: 32. */ +#define BLE_GATTC_EVT_LAST 0x4F /**< GATTC BLE Event last. */ + #define BLE_GATTS_EVT_BASE 0x50 /**< GATTS BLE Event base. */ -#define BLE_GATTS_EVT_LAST 0x6F /**< Total: 32. */ +#define BLE_GATTS_EVT_LAST 0x6F /**< GATTS BLE Event last. */ + #define BLE_L2CAP_EVT_BASE 0x70 /**< L2CAP BLE Event base. */ -#define BLE_L2CAP_EVT_LAST 0x8F /**< Total: 32. */ +#define BLE_L2CAP_EVT_LAST 0x8F /**< L2CAP BLE Event last. */ #define BLE_OPT_INVALID 0x00 /**< Invalid BLE Option. */ + #define BLE_OPT_BASE 0x01 /**< Common BLE Option base. */ -#define BLE_OPT_LAST 0x1F /**< Total: 31. */ +#define BLE_OPT_LAST 0x1F /**< Common BLE Option last. */ + #define BLE_GAP_OPT_BASE 0x20 /**< GAP BLE Option base. */ -#define BLE_GAP_OPT_LAST 0x3F /**< Total: 32. */ +#define BLE_GAP_OPT_LAST 0x3F /**< GAP BLE Option last. */ + #define BLE_GATTC_OPT_BASE 0x40 /**< GATTC BLE Option base. */ -#define BLE_GATTC_OPT_LAST 0x5F /**< Total: 32. */ +#define BLE_GATTC_OPT_LAST 0x5F /**< GATTC BLE Option last. */ + #define BLE_GATTS_OPT_BASE 0x60 /**< GATTS BLE Option base. */ -#define BLE_GATTS_OPT_LAST 0x7F /**< Total: 32. */ +#define BLE_GATTS_OPT_LAST 0x7F /**< GATTS BLE Option last. */ + #define BLE_L2CAP_OPT_BASE 0x80 /**< L2CAP BLE Option base. */ -#define BLE_L2CAP_OPT_LAST 0x9F /**< Total: 32. */ +#define BLE_L2CAP_OPT_LAST 0x9F /**< L2CAP BLE Option last. */ + #ifdef __cplusplus } #endif -#endif /* NRF_BLE_RANGES_H__ */ +#endif /* BLE_RANGES_H__ */ /** @} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_types.h similarity index 98% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_types.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_types.h index 0ef31dd83a..a85332a4c3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_ble_types.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_types.h @@ -36,7 +36,6 @@ * */ - /** @addtogroup BLE_COMMON @{ @@ -46,8 +45,8 @@ @brief Common types and macro definitions for the BLE SoftDevice. */ -#ifndef NRF_BLE_TYPES_H__ -#define NRF_BLE_TYPES_H__ +#ifndef BLE_TYPES_H__ +#define BLE_TYPES_H__ #include @@ -86,9 +85,9 @@ extern "C" { #define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */ #define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */ #define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_PPF 0x2A02 /**< Peripheral Privacy Flag Characteristic. */ #define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */ #define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_CAR 0x2AA6 /**< Central Address Resolution Characteristic. */ /** @} */ @@ -184,7 +183,7 @@ extern "C" { /** @brief 128 bit UUID values. */ typedef struct -{ +{ uint8_t uuid128[16]; /**< Little-Endian UUID bytes. */ } ble_uuid128_t; @@ -200,7 +199,7 @@ typedef struct } #endif -#endif /* NRF_BLE_TYPES_H__ */ +#endif /* BLE_TYPES_H__ */ /** @} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h index 9506d327d3..22d0834da1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h @@ -35,7 +35,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - /** @defgroup nrf_mbr_api Master Boot Record API @{ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h index e4f90fd54c..26486f93c0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h @@ -34,8 +34,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - */ - + */ /** @defgroup nrf_error SoftDevice Global Error Codes @{ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h index 575829c7f9..fc4728ddf5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h @@ -35,7 +35,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - /** @addtogroup nrf_sdm_api @{ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h index 28989ee4e1..e1c5f272aa 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h @@ -35,7 +35,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - /** @addtogroup nrf_soc_api @{ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h index 8b49061c72..77f1e77e4d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h @@ -35,14 +35,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - /** * @defgroup nrf_nvic_api SoftDevice NVIC API * @{ * * @note In order to use this module, the following code has to be added to a .c file: * \code - * nrf_nvic_state_t nrf_nvic_state; + * nrf_nvic_state_t nrf_nvic_state = {0}; * \endcode * * @note Definitions and declarations starting with __ (double underscore) in this header file are @@ -144,26 +143,169 @@ extern nrf_nvic_state_t nrf_nvic_state; * * @retval The value of PRIMASK prior to disabling the interrupts. */ -static inline int __sd_nvic_irq_disable(void) -{ - int pm = __get_PRIMASK(); - __disable_irq(); - return pm; -} +__STATIC_INLINE int __sd_nvic_irq_disable(void); /**@brief Enables IRQ interrupts globally, including the SoftDevice's interrupts. */ -static inline void __sd_nvic_irq_enable(void) -{ - __enable_irq(); -} +__STATIC_INLINE void __sd_nvic_irq_enable(void); /**@brief Checks if IRQn is available to application * @param[in] IRQn irq to check * * @retval 1 (true) if the irq to check is available to the application */ -static inline uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn) +__STATIC_INLINE uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn); + +/**@brief Checks if priority is available to application + * @param[in] priority priority to check + * + * @retval 1 (true) if the priority to check is available to the application + */ +__STATIC_INLINE uint32_t __sd_nvic_is_app_accessible_priority(uint32_t priority); + +/**@} */ + +/**@addtogroup NRF_NVIC_FUNCTIONS SoftDevice NVIC public functions + * @{ */ + +/**@brief Enable External Interrupt. + * @note Corresponds to NVIC_EnableIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt was enabled. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt has a priority not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn); + +/**@brief Disable External Interrupt. + * @note Corresponds to NVIC_DisableIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt was disabled. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn); + +/**@brief Get Pending Interrupt. + * @note Corresponds to NVIC_GetPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_GetPendingIRQ documentation in CMSIS. + * @param[out] p_pending_irq Return value from NVIC_GetPendingIRQ. + * + * @retval ::NRF_SUCCESS The interrupt is available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq); + +/**@brief Set Pending Interrupt. + * @note Corresponds to NVIC_SetPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt is set pending. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn); + +/**@brief Clear Pending Interrupt. + * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt pending flag is cleared. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn); + +/**@brief Set Interrupt Priority. + * @note Corresponds to NVIC_SetPriority in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * @pre Priority is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_SetPriority documentation in CMSIS. + * @param[in] priority A valid IRQ priority for use by the application. + * + * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt priority is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority); + +/**@brief Get Interrupt Priority. + * @note Corresponds to NVIC_GetPriority in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_GetPriority documentation in CMSIS. + * @param[out] p_priority Return value from NVIC_GetPriority. + * + * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE - IRQn is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority); + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +__STATIC_INLINE uint32_t sd_nvic_SystemReset(void); + +/**@brief Enter critical region. + * + * @post Application interrupts will be disabled. + * @note sd_nvic_critical_region_enter() and ::sd_nvic_critical_region_exit() must be called in matching pairs inside each + * execution context + * @sa sd_nvic_critical_region_exit + * + * @param[out] p_is_nested_critical_region If 1, the application is now in a nested critical region. + * + * @retval ::NRF_SUCCESS + */ +__STATIC_INLINE uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region); + +/**@brief Exit critical region. + * + * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter. + * @post If not in a nested critical region, the application interrupts will restored to the state before ::sd_nvic_critical_region_enter was called. + * + * @param[in] is_nested_critical_region If this is set to 1, the critical region won't be exited. @sa sd_nvic_critical_region_enter. + * + * @retval ::NRF_SUCCESS + */ +__STATIC_INLINE uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region); + +/**@} */ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE int __sd_nvic_irq_disable(void) +{ + int pm = __get_PRIMASK(); + __disable_irq(); + return pm; +} + +__STATIC_INLINE void __sd_nvic_irq_enable(void) +{ + __enable_irq(); +} + +__STATIC_INLINE uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn) { if (IRQn < 32) { @@ -181,12 +323,7 @@ static inline uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn) } } -/**@brief Checks if IRQn is available to application - * @param[in] priority priority to check - * - * @retval 1 (true) if the priority to check is available to the application - */ -static inline uint32_t __sd_nvic_is_app_accessible_priority(uint32_t priority) +__STATIC_INLINE uint32_t __sd_nvic_is_app_accessible_priority(uint32_t priority) { if(priority >= (1 << __NVIC_PRIO_BITS)) { @@ -213,23 +350,8 @@ static inline uint32_t __sd_nvic_is_app_accessible_priority(uint32_t priority) return 1; } -/**@} */ -/**@addtogroup NRF_NVIC_FUNCTIONS SoftDevice NVIC public functions - * @{ */ - -/**@brief Enable External Interrupt. - * @note Corresponds to NVIC_EnableIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS. - * - * @retval ::NRF_SUCCESS The interrupt was enabled. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt has a priority not available for the application. - */ -static inline uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn) +__STATIC_INLINE uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn) { if (!__sd_nvic_app_accessible_irq(IRQn)) { @@ -251,17 +373,7 @@ static inline uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn) return NRF_SUCCESS; } -/**@brief Disable External Interrupt. - * @note Corresponds to NVIC_DisableIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS. - * - * @retval ::NRF_SUCCESS The interrupt was disabled. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. - */ -static inline uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn) +__STATIC_INLINE uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn) { if (!__sd_nvic_app_accessible_irq(IRQn)) { @@ -280,18 +392,7 @@ static inline uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn) return NRF_SUCCESS; } -/**@brief Get Pending Interrupt. - * @note Corresponds to NVIC_GetPendingIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_GetPendingIRQ documentation in CMSIS. - * @param[out] p_pending_irq Return value from NVIC_GetPendingIRQ. - * - * @retval ::NRF_SUCCESS The interrupt is available for the application. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. - */ -static inline uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq) +__STATIC_INLINE uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq) { if (__sd_nvic_app_accessible_irq(IRQn)) { @@ -304,17 +405,7 @@ static inline uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pendin } } -/**@brief Set Pending Interrupt. - * @note Corresponds to NVIC_SetPendingIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS. - * - * @retval ::NRF_SUCCESS The interrupt is set pending. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. - */ -static inline uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn) +__STATIC_INLINE uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn) { if (__sd_nvic_app_accessible_irq(IRQn)) { @@ -327,17 +418,7 @@ static inline uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn) } } -/**@brief Clear Pending Interrupt. - * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS. - * - * @retval ::NRF_SUCCESS The interrupt pending flag is cleared. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. - */ -static inline uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn) +__STATIC_INLINE uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn) { if (__sd_nvic_app_accessible_irq(IRQn)) { @@ -350,20 +431,7 @@ static inline uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn) } } -/**@brief Set Interrupt Priority. - * @note Corresponds to NVIC_SetPriority in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * @pre Priority is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_SetPriority documentation in CMSIS. - * @param[in] priority A valid IRQ priority for use by the application. - * - * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt priority is not available for the application. - */ -static inline uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority) +__STATIC_INLINE uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority) { if (!__sd_nvic_app_accessible_irq(IRQn)) { @@ -379,18 +447,7 @@ static inline uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority) return NRF_SUCCESS; } -/**@brief Get Interrupt Priority. - * @note Corresponds to NVIC_GetPriority in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_GetPriority documentation in CMSIS. - * @param[out] p_priority Return value from NVIC_GetPriority. - * - * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE - IRQn is not available for the application. - */ -static inline uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority) +__STATIC_INLINE uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority) { if (__sd_nvic_app_accessible_irq(IRQn)) { @@ -403,27 +460,13 @@ static inline uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority } } -/**@brief System Reset. - * @note Corresponds to NVIC_SystemReset in CMSIS. - * - * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN - */ -static inline uint32_t sd_nvic_SystemReset(void) +__STATIC_INLINE uint32_t sd_nvic_SystemReset(void) { NVIC_SystemReset(); return NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN; } -/**@brief Enters critical region. - * - * @post Application interrupts will be disabled. - * @note sd_nvic_critical_region_enter() and ::sd_nvic_critical_region_exit() must be called in matching pairs inside each - * execution context - * @sa sd_nvic_critical_region_exit - * - * @retval ::NRF_SUCCESS - */ -static inline uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region) +__STATIC_INLINE uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region) { int was_masked = __sd_nvic_irq_disable(); if (!nrf_nvic_state.__cr_flag) @@ -448,16 +491,7 @@ static inline uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_criti return NRF_SUCCESS; } -/**@brief Exit critical region. - * - * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter. - * @post If not in a nested critical region, the application interrupts will restored to the state before ::sd_nvic_critical_region_enter was called. - * - * @param[in] is_nested_critical_region If this is set to 1, the critical region won't be exited. @sa sd_nvic_critical_region_enter. - * - * @retval ::NRF_SUCCESS - */ -static inline uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region) +__STATIC_INLINE uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region) { if (nrf_nvic_state.__cr_flag && (is_nested_critical_region == 0)) { @@ -475,7 +509,8 @@ static inline uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_r return NRF_SUCCESS; } -/**@} */ + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ #ifdef __cplusplus } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h index 1af95f1dc6..9cb516acde 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h @@ -36,15 +36,23 @@ * */ - #ifndef NRF_SD_DEF_H__ #define NRF_SD_DEF_H__ #include -#define SD_PPI_CHANNELS_USED 0xFFF0C000uL /**< PPI channels utilized by SotfDevice (not available to the application). */ +#ifdef __cplusplus +extern "C" { +#endif + +#define SD_PPI_CHANNELS_USED 0xFFFE0000uL /**< PPI channels utilized by SotfDevice (not available to the application). */ #define SD_PPI_GROUPS_USED 0x0000000CuL /**< PPI groups utilized by SoftDevice (not available to the application). */ #define SD_TIMERS_USED 0x00000001uL /**< Timers used by SoftDevice. */ #define SD_SWI_USED 0x0000003CuL /**< Software interrupts used by SoftDevice */ + +#ifdef __cplusplus +} +#endif + #endif /* NRF_SD_DEF_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h index bb370abffe..b7fbe0e746 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h @@ -35,7 +35,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - /** @defgroup nrf_sdm_api SoftDevice Manager API @{ @@ -44,7 +43,6 @@ */ -/* Header guard */ #ifndef NRF_SDM_H__ #define NRF_SDM_H__ @@ -60,34 +58,87 @@ extern "C" { /** @addtogroup NRF_SDM_DEFINES Defines * @{ */ #ifdef NRFSOC_DOXYGEN -//Stuff defined elsewere, to satisfy doxygen +/// Declared in nrf_mbr.h #define MBR_SIZE 0 #warning test #endif +/** @brief The major version for the SoftDevice binary distributed with this header file. */ +#define SD_MAJOR_VERSION (5) + +/** @brief The minor version for the SoftDevice binary distributed with this header file. */ +#define SD_MINOR_VERSION (0) + +/** @brief The bugfix version for the SoftDevice binary distributed with this header file. */ +#define SD_BUGFIX_VERSION (0) + +/** @brief The full version number for the SoftDevice binary this header file was distributed + * with, as a decimal number in the form Mmmmbbb, where: + * - M is major version (one or more digits) + * - mmm is minor version (three digits) + * - bbb is bugfix version (three digits). */ +#define SD_VERSION (SD_MAJOR_VERSION * 1000000 + SD_MINOR_VERSION * 1000 + SD_BUGFIX_VERSION) + /** @brief SoftDevice Manager SVC Base number. */ #define SDM_SVC_BASE 0x10 +/** @brief Invalid info field. Returned when an info field does not exist. */ +#define SDM_INFO_FIELD_INVALID (0) + /** @brief Defines the SoftDevice Information Structure location (address) as an offset from the start of the softdevice (without MBR)*/ #define SOFTDEVICE_INFO_STRUCT_OFFSET (0x2000) -/** @brief Defines the absolute Softdevice information structure location (address)*/ +/** @brief Defines the absolute SoftDevice Information Structure location (address) when the + * SoftDevice is installed just above the MBR (the usual case). */ #define SOFTDEVICE_INFO_STRUCT_ADDRESS (SOFTDEVICE_INFO_STRUCT_OFFSET + MBR_SIZE) -/** @brief Defines the offset for Softdevice size value relative to Softdevice base address*/ +/** @brief Defines the offset for the SoftDevice Information Structure size value relative to the + * SoftDevice base address. The size value is of type uint8_t. */ +#define SD_INFO_STRUCT_SIZE_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET) + +/** @brief Defines the offset for the SoftDevice size value relative to the SoftDevice base address. + * The size value is of type uint32_t. */ #define SD_SIZE_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x08) -/** @brief Defines the offset for FWID value relative to Softdevice base address*/ +/** @brief Defines the offset for FWID value relative to the SoftDevice base address. The FWID value + * is of type uint16_t. */ #define SD_FWID_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x0C) -/** @brief Defines a macro for retreiving the actual Softdevice size value from a given base address - use @ref MBR_SIZE when Softdevice is installed just above the MBR (the usual case)*/ +/** @brief Defines the offset for the SoftDevice ID relative to the SoftDevice base address. The ID + * is of type uint32_t. */ +#define SD_ID_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x10) + +/** @brief Defines the offset for the SoftDevice version relative to the SoftDevice base address in + * the same format as @ref SD_VERSION, stored as an uint32_t. */ +#define SD_VERSION_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x14) + +/** @brief Defines a macro for retreiving the actual SoftDevice Information Structure size value + * from a given base address. Use @ref MBR_SIZE as the argument when the SoftDevice is + * installed just above the MBR (the usual case). */ +#define SD_INFO_STRUCT_SIZE_GET(baseaddr) (*((uint8_t *) ((baseaddr) + SD_INFO_STRUCT_SIZE_OFFSET))) + +/** @brief Defines a macro for retreiving the actual SoftDevice size value from a given base + * address. Use @ref MBR_SIZE as the argument when the SoftDevice is installed just above + * the MBR (the usual case). */ #define SD_SIZE_GET(baseaddr) (*((uint32_t *) ((baseaddr) + SD_SIZE_OFFSET))) -/** @brief Defines a macro for retreiving the actual FWID value from a given base address - use @ref MBR_SIZE when Softdevice is installed just above the MBR (the usual case)*/ -#define SD_FWID_GET(baseaddr) ((*((uint32_t *) ((baseaddr) + SD_FWID_OFFSET))) & 0xFFFF) +/** @brief Defines a macro for retreiving the actual FWID value from a given base address. Use @ref + * MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the usual + * case). */ +#define SD_FWID_GET(baseaddr) (*((uint16_t *) ((baseaddr) + SD_FWID_OFFSET))) + +/** @brief Defines a macro for retreiving the actual SoftDevice ID from a given base address. Use + * @ref MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the + * usual case). */ +#define SD_ID_GET(baseaddr) ((SD_INFO_STRUCT_SIZE_GET(baseaddr) > (SD_ID_OFFSET - SOFTDEVICE_INFO_STRUCT_OFFSET)) \ + ? (*((uint32_t *) ((baseaddr) + SD_ID_OFFSET))) : SDM_INFO_FIELD_INVALID) + +/** @brief Defines a macro for retreiving the actual FWID value from a given base address. Use @ref + * MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the usual + * case). */ +#define SD_VERSION_GET(baseaddr) ((SD_INFO_STRUCT_SIZE_GET(baseaddr) > (SD_VERSION_OFFSET - SOFTDEVICE_INFO_STRUCT_OFFSET)) \ + ? (*((uint32_t *) ((baseaddr) + SD_VERSION_OFFSET))) : SDM_INFO_FIELD_INVALID) /**@defgroup NRF_FAULT_ID_RANGES Fault ID ranges * @{ */ @@ -97,8 +148,10 @@ the start of the softdevice (without MBR)*/ /**@defgroup NRF_FAULT_IDS Fault ID types * @{ */ -#define NRF_FAULT_ID_SD_ASSERT (NRF_FAULT_ID_SD_RANGE_START + 1) /**< SoftDevice assertion. The info parameter will be set to 0x00000000. */ -#define NRF_FAULT_ID_APP_MEMACC (NRF_FAULT_ID_APP_RANGE_START + 1) /**< Application invalid memory access. The info parameter will contain the address in memory that was accessed. */ +#define NRF_FAULT_ID_SD_ASSERT (NRF_FAULT_ID_SD_RANGE_START + 1) /**< SoftDevice assertion. The info parameter is reserved for future used. */ +#define NRF_FAULT_ID_APP_MEMACC (NRF_FAULT_ID_APP_RANGE_START + 1) /**< Application invalid memory access (nRF52 only). The info parameter will contain 0x00000000, in case of SoftDevice RAM + access violation. In case of SoftDevice peripheral register violation the info parameter will contain the sub-region number of PREGION[0], on whose address range the unallowed + write access caused the memory access fault. */ /**@} */ /** @} */ @@ -121,26 +174,29 @@ enum NRF_SD_SVCS /** @addtogroup NRF_SDM_DEFINES Defines * @{ */ -/**@defgroup NRF_CLOCK_LF_XTAL_ACCURACY Clock accuracy * @{ */ +/**@defgroup NRF_CLOCK_LF_XTAL_ACCURACY Clock accuracy + * @{ */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM (0) /* Default */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM (1) -#define NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM (2) -#define NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM (3) -#define NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM (4) -#define NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM (5) -#define NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM (6) -#define NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM (7) +#define NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM (0) /**< Default: 250 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM (1) /**< 500 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM (2) /**< 150 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM (3) /**< 100 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM (4) /**< 75 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM (5) /**< 50 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM (6) /**< 30 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM (7) /**< 20 ppm */ /** @} */ -/**@defgroup NRF_CLOCK_LF_SRC Possible lfclk oscillator sources * @{ */ +/**@defgroup NRF_CLOCK_LF_SRC Possible lfclk oscillator sources + * @{ */ #define NRF_CLOCK_LF_SRC_RC (0) /**< LFCLK RC oscillator. */ #define NRF_CLOCK_LF_SRC_XTAL (1) /**< LFCLK crystal oscillator. */ #define NRF_CLOCK_LF_SRC_SYNTH (2) /**< LFCLK Synthesized from HFCLK. */ /** @} */ + /** @} */ /** @addtogroup NRF_SDM_TYPES Types @@ -185,12 +241,16 @@ typedef struct * When certain unrecoverable errors occur within the application or SoftDevice the fault handler will be called back. * The protocol stack will be in an undefined state when this happens and the only way to recover will be to * perform a reset, using e.g. CMSIS NVIC_SystemReset(). + * If the application returns from the fault handler the SoftDevice will call NVIC_SystemReset(). * * @note This callback is executed in HardFault context, thus SVC functions cannot be called from the fault callback. * * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. * @param[in] pc The program counter of the instruction that triggered the fault. * @param[in] info Optional additional information regarding the fault. Refer to each Fault identifier for details. + * + * @note When id is set to NRF_FAULT_ID_APP_MEMACC, pc will contain the address of the instruction being executed at the time when + * the fault is detected by the CPU. The CPU program counter may have advanced up to 2 instructions (no branching) after the one that triggered the fault. */ typedef void (*nrf_fault_handler_t)(uint32_t id, uint32_t pc, uint32_t info); @@ -219,9 +279,10 @@ typedef void (*nrf_fault_handler_t)(uint32_t id, uint32_t pc, uint32_t info); * @param p_clock_lf_cfg Low frequency clock source and accuracy. If NULL the clock will be configured as an rc source with rc_ctiv = 16 and .rc_temp_ctiv = 2 In the case of XTAL source, the PPM accuracy of the chosen clock source must be greater than or equal to the actual characteristics of your XTAL clock. - * @param fault_handler Callback to be invoked in case of fault. + * @param fault_handler Callback to be invoked in case of fault, cannot be NULL. * * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_ADDR Invalid or NULL pointer supplied. * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and fault handler cannot be updated. * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level. * @retval ::NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN Unknown low frequency clock source selected. diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h index e1fbb2236a..3340f1417b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h @@ -34,8 +34,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - */ - + */ /** * @defgroup nrf_soc_api SoC Library API * @{ @@ -62,8 +61,8 @@ extern "C" { * @{ */ /**@brief The number of the lowest SVC number reserved for the SoC library. */ -#define SOC_SVC_BASE (0x20) -#define SOC_SVC_BASE_NOT_AVAILABLE (0x2B) +#define SOC_SVC_BASE (0x20) /**< Base value for SVCs that are available when the SoftDevice is disabled. */ +#define SOC_SVC_BASE_NOT_AVAILABLE (0x2B) /**< Base value for SVCs that are not available when the SoftDevice is disabled. */ /**@brief Guranteed time for application to process radio inactive notification. */ #define NRF_RADIO_NOTIFICATION_INACTIVE_GUARANTEED_TIME_US (62) @@ -119,16 +118,6 @@ enum NRF_SOC_SVCS SD_MUTEX_NEW = SOC_SVC_BASE_NOT_AVAILABLE, SD_MUTEX_ACQUIRE, SD_MUTEX_RELEASE, - SD_RFU_1, - SD_RFU_2, - SD_RFU_3, - SD_RFU_4, - SD_RFU_5, - SD_RFU_6, - SD_RFU_7, - SD_RFU_8, - SD_RFU_9, - SD_RFU_10, SD_RAND_APPLICATION_POOL_CAPACITY_GET, SD_RAND_APPLICATION_BYTES_AVAILABLE_GET, SD_RAND_APPLICATION_VECTOR_GET, @@ -316,7 +305,7 @@ typedef struct { nrf_radio_request_earliest_t earliest; /**< Parameters for requesting a radio timeslot as early as possible. */ nrf_radio_request_normal_t normal; /**< Parameters for requesting a normal radio timeslot. */ - } params; + } params; /**< Parameter union. */ } nrf_radio_request_t; /**@brief Return parameters of the radio timeslot signal callback. */ @@ -333,7 +322,7 @@ typedef struct { uint32_t length_us; /**< Requested extension of the radio timeslot duration (microseconds) (for minimum time see @ref NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US). */ } extend; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND. */ - } params; + } params; /**< Parameter union. */ } nrf_radio_signal_callback_return_param_t; /**@brief The radio timeslot signal callback type. @@ -351,9 +340,9 @@ typedef struct typedef nrf_radio_signal_callback_return_param_t * (*nrf_radio_signal_callback_t) (uint8_t signal_type); /**@brief AES ECB parameter typedefs */ -typedef uint8_t soc_ecb_key_t[SOC_ECB_KEY_LENGTH]; -typedef uint8_t soc_ecb_cleartext_t[SOC_ECB_CLEARTEXT_LENGTH]; -typedef uint8_t soc_ecb_ciphertext_t[SOC_ECB_CIPHERTEXT_LENGTH]; +typedef uint8_t soc_ecb_key_t[SOC_ECB_KEY_LENGTH]; /**< Encryption key type. */ +typedef uint8_t soc_ecb_cleartext_t[SOC_ECB_CLEARTEXT_LENGTH]; /**< Cleartext data type. */ +typedef uint8_t soc_ecb_ciphertext_t[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Ciphertext data type. */ /**@brief AES ECB data structure */ typedef struct @@ -503,29 +492,35 @@ SVCALL(SD_POWER_RAMON_CLR, uint32_t, sd_power_ramon_clr(uint32_t ramon)); */ SVCALL(SD_POWER_RAMON_GET, uint32_t, sd_power_ramon_get(uint32_t * p_ramon)); -/**@brief Set bits in the NRF_POWER->GPREGRET register. +/**@brief Set bits in the general purpose retention registers (NRF_POWER->GPREGRET*). * + * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. * @param[in] gpregret_msk Bits to be set in the GPREGRET register. * + * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. * @retval ::NRF_SUCCESS */ -SVCALL(SD_POWER_GPREGRET_SET, uint32_t, sd_power_gpregret_set(uint32_t gpregret_msk)); +SVCALL(SD_POWER_GPREGRET_SET, uint32_t, sd_power_gpregret_set(uint32_t gpregret_id, uint32_t gpregret_msk)); -/**@brief Clear bits in the NRF_POWER->GPREGRET register. +/**@brief Clear bits in the general purpose retention registers (NRF_POWER->GPREGRET*). * + * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. * @param[in] gpregret_msk Bits to be clear in the GPREGRET register. * + * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. * @retval ::NRF_SUCCESS */ -SVCALL(SD_POWER_GPREGRET_CLR, uint32_t, sd_power_gpregret_clr(uint32_t gpregret_msk)); +SVCALL(SD_POWER_GPREGRET_CLR, uint32_t, sd_power_gpregret_clr(uint32_t gpregret_id, uint32_t gpregret_msk)); -/**@brief Get contents of the NRF_POWER->GPREGRET register. +/**@brief Get contents of the general purpose retention registers (NRF_POWER->GPREGRET*). * + * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. * @param[out] p_gpregret Contents of the GPREGRET register. * + * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. * @retval ::NRF_SUCCESS */ -SVCALL(SD_POWER_GPREGRET_GET, uint32_t, sd_power_gpregret_get(uint32_t *p_gpregret)); +SVCALL(SD_POWER_GPREGRET_GET, uint32_t, sd_power_gpregret_get(uint32_t gpregret_id, uint32_t *p_gpregret)); /**@brief Sets the DCDC mode. * @@ -772,6 +767,8 @@ SVCALL(SD_TEMP_GET, uint32_t, sd_temp_get(int32_t * p_temp)); * they will not interfere with the flash access. This means that all interrupts will be blocked * for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual * and the command parameters). +* - The data in the p_src buffer should not be modified before the @ref NRF_EVT_FLASH_OPERATION_SUCCESS +* or the @ref NRF_EVT_FLASH_OPERATION_ERROR have been received if the SoftDevice is enabled. * * * @param[in] p_dst Pointer to start of flash location to be written. diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h index aa91e5d35e..9d62a02581 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h @@ -36,7 +36,6 @@ * */ - #ifndef NRF_SVC__ #define NRF_SVC__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex deleted file mode 100644 index a61b7c914c..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex +++ /dev/null @@ -1,6918 +0,0 @@ -:020000040000FA -:1000000000040020E508000079050000C508000094 -:10001000830500008D05000097050000000000002A -:1000200000000000000000000000000009090000BE -:10003000A105000000000000AB050000B5050000B0 -:10004000BF050000C9050000D3050000DD05000064 -:10005000E7050000F1050000FB05000005060000B3 -:100060000F06000019060000230600002D06000000 -:1000700037060000410600004B0600005506000050 -:100080005F06000069060000730600007D060000A0 -:1000900087060000910600009B060000A5060000F0 -:1000A000AF060000B9060000C3060000CD06000040 -:1000B000D7060000E1060000EB060000F506000090 -:1000C000FF06000009070000130700001D070000DD -:1000D00027070000310700003B070000450700002C -:1000E0004F07000059070000630700006D0700007C -:1000F00077070000810700008B07000095070000CC -:100100009F0700001FB500F003F88DE80F001FBD2A -:1001100000F0DEBB1FB56FF00100009040100390AF -:10012000029001904FF010208069000B420900F00E -:100130001F045DF822300120A04083434DF8223097 -:10014000684600F044F91FBDF0B54FF6FF734FF459 -:10015000B4751A466E1E11E0A94201D3344600E080 -:100160000C46091B30F8027B641E3B441A44F9D14B -:100170009CB204EB134394B204EB12420029EBD17E -:1001800098B200EB134002EB124140EA0140F0BD8F -:10019000DD4992B00446D1E90001CDE91001FF220A -:1001A0004021684600F03AFB94E80F008DE80F000C -:1001B000684610A902E004C841F8042D8842FAD12B -:1001C00010216846FFF7C0FF1090AA208DF8440068 -:1001D000FFF7A0FF00F0F2F84FF01024A069102202 -:1001E0006946803000F001F9A069082210A900F0EA -:1001F000FCF800F0D7F84FF080510A6949690068AF -:100200004A43824201D8102070470020704710B541 -:10021000D0E900214FF0805002EB8103026944696C -:100220006243934209D84FF01022536903EB8103D4 -:100230000169406941438B4201D9092010BD5069D1 -:10024000401C01D0002010BD0F2010BD70B501680A -:100250000446AE4D4FF01020062951D2DFE801F0E0 -:10026000320318283B1DD4E90265646829463046EC -:1002700000F0CDF82A462146304600F0B6F8AA0034 -:100280002146304600F09EFA002800D0032070BDC1 -:1002900000F050FB4FF4805007E0201DFFF7ABFF4C -:1002A0000028F4D100F046FB60682860002070BD93 -:1002B000241D94E80700920000F084FA0028F6D08C -:1002C0000E2070BD8069401C12D0201DFFF79FFFDB -:1002D0000028F6D109E08069401C09D0201DFFF7F5 -:1002E0008AFF0028EDD1606820B12046FFF750FF5B -:1002F000042070BDFFF70EFF00F060F800F052F828 -:10030000072070BD10B50C46182802D001200860E7 -:1003100010BD2068FFF79AFF206010BD4FF0102439 -:10032000A069401C05D0A569A66980353079AA2846 -:1003300008D06069401C2DD060690068401C29D03D -:1003400060692CE010212846FFF7FEFE31688142EB -:100350001CD1A16901F18002C03105E030B108CAA9 -:1003600051F8040D984201D1012000E000208A429A -:10037000F4D158B1286810B1042803D0FEE728460C -:1003800000F057F861496868086008E000F016F866 -:1003900000F008F84FF480500168491C01D000F0CB -:1003A000A3FAFEE7BFF34F8F59480168594A01F499 -:1003B000E06111430160BFF34F8FFEE74FF0102063 -:1003C0008169491C02D0806900F0ADB87047524A7B -:1003D00001681160121D416811604F4A8168103236 -:1003E0001160111DC068086070472DE9F041174683 -:1003F0000D460646002406E03046296800F0A6F8BF -:10040000641C2D1D361DBC42F6D3BDE8F08170B5CD -:100410000C4605464FF4806608E0284600F083F855 -:10042000B44205D3A4F5806405F58055002CF4D1C1 -:1004300070BD4168044609B1012500E000254FF078 -:1004400010267069A268920000F0BCF9C8B120467D -:1004500000F01AF89DB17669A56864684FF4002031 -:1004600084420AD2854208D229463046FFF7CFFFA0 -:100470002A4621463046FFF7B8FFFFF79FFFFFF7F8 -:1004800091FFFFF747FEF8E72DE9FF414FF01024F9 -:10049000616980680D0B01EB800000F6FF70010BB5 -:1004A00000200090019002900246039068460123CC -:1004B0000BE0560902F01F0C50F8267003FA0CFCF2 -:1004C00047EA0C0740F82670521CAA42F1D30AE012 -:1004D0004A0901F01F0650F8225003FA06F6354388 -:1004E00040F82250491C8029F2D3A169090B4A091E -:1004F00001F01F0150F822408B409C4340F82240FD -:10050000FFF765FFBDE8FF815809000000000020EB -:100510000CED00E00400FA050006004014480168F4 -:100520000029FCD07047134A0221116010490B6862 -:10053000002BFCD00F4B1B1D186008680028FCD056 -:100540000020106008680028FCD07047094B10B5E7 -:1005500001221A60064A1468002CFCD00160106861 -:100560000028FCD00020186010680028FCD010BDC6 -:1005700000E4014004E5014008208F49096809585A -:10058000084710208C4909680958084714208A49EF -:100590000968095808471820874909680958084711 -:1005A0003020854909680958084738208249096878 -:1005B000095808473C2080490968095808474020E5 -:1005C0007D4909680958084744207B49096809584A -:1005D0000847482078490968095808474C20764957 -:1005E000096809580847502073490968095808479D -:1005F0005420714909680958084758206E4909680C -:10060000095808475C206C49096809580847602068 -:100610006949096809580847642067490968095801 -:100620000847682064490968095808476C206249EE -:1006300009680958084770205F4909680958084740 -:1006400074205D4909680958084778205A490968A3 -:10065000095808477C2058490968095808478020EC -:1006600055490968095808478420534909680958B9 -:100670000847882050490968095808478C204E4986 -:1006800009680958084790204B49096809580847E4 -:10069000942049490968095808479820464909683B -:1006A000095808479C204449096809580847A02070 -:1006B0004149096809580847A4203F490968095871 -:1006C0000847A8203C49096809580847AC203A491E -:1006D000096809580847B020374909680958084788 -:1006E000B4203549096809580847B82032490968D3 -:1006F00009580847BC203049096809580847C020F4 -:100700002D49096809580847C4202B490968095828 -:100710000847C8202849096809580847CC202649B5 -:10072000096809580847D02023490968095808472B -:10073000D4202149096809580847D8201E4909686A -:1007400009580847DC201C49096809580847E02077 -:100750001949096809580847E420174909680958E0 -:100760000847E8201449096809580847EC2012494D -:10077000096809580847F0200F49096809580847CF -:10078000F4200D49096809580847F8200A49096802 -:1007900009580847FC2008490968095808475FF4C8 -:1007A0008070054909680958084700000348044952 -:1007B000024A034B70470000000000206809000057 -:1007C0006809000040EA010310B59B070FD1042A15 -:1007D0000DD310C808C9121F9C42F8D020BA19BA0C -:1007E000884201D9012010BD4FF0FF3010BD1AB171 -:1007F000D30703D0521C07E0002010BD10F8013BC6 -:1008000011F8014B1B1B07D110F8013B11F8014BEC -:100810001B1B01D1921EF1D1184610BD02F0FF033F -:1008200043EA032242EA024200F005B870477047EB -:1008300070474FF000020429C0F0128010F0030C42 -:1008400000F01B80CCF1040CBCF1020F18BF00F8C3 -:10085000012BA8BF20F8022BA1EB0C0100F00DB872 -:100860005FEAC17C24BF00F8012B00F8012B48BFD0 -:1008700000F8012B70474FF0000200B51346944674 -:100880009646203922BFA0E80C50A0E80C50B1F1E8 -:100890002001BFF4F7AF090728BFA0E80C5048BFFC -:1008A0000CC05DF804EB890028BF40F8042B08BF9A -:1008B000704748BF20F8022B11F0804F18BF00F896 -:1008C000012B7047014B1B68DB68184700000020B4 -:1008D00009480A497047FFF7FBFFFFF713FC00BD0B -:1008E00020BFFDE7064B1847064A1060016881F3F8 -:1008F0000888406800470000680900006809000097 -:100900001D030000000000201EF0040F0CBFEFF3D9 -:100910000881EFF30981886902380078182803D12B -:1009200000E00000074A1047074A12682C3212689C -:100930001047000000B5054B1B68054A9B589847B7 -:1009400000BD000005030000000000205409000065 -:1009500004000000001000000000000000FFFFFF86 -:040960000090D00330 -:10100000881100207DB0010079960000CDAF01006D -:1010100079960000799600007996000000000000A3 -:10102000000000000000000000000000D9B0010036 -:101030007996000000000000799600007996000083 -:1010400041B1010047B10100799600007996000096 -:101050007996000079960000799600007996000054 -:101060004DB10100799600007996000053B101005E -:101070007996000059B101005FB1010065B101002E -:101080007996000079960000799600007996000024 -:101090007996000079960000799600007996000014 -:1010A0006BB1010071B101007996000079960000E2 -:1010B00079960000799600007996000079960000F4 -:1010C00077B10100799600007996000079960000CA -:1010D00079960000799600007996000079960000D4 -:1010E00079960000799600007996000079960000C4 -:1010F00079960000799600007996000079960000B4 -:10110000799600007996000000F002F819F093FF3C -:101110000AA090E8000C82448344AAF10107DA4552 -:1011200001D119F088FFAFF2090EBAE80F0013F0F1 -:10113000010F18BFFB1A43F00103184734A5010043 -:1011400054A501000A4410F8014B14F00F0508BF24 -:1011500010F8015B240908BF10F8014B6D1E05D083 -:1011600010F8013B6D1E01F8013BF9D1641E03D05C -:10117000641E01F8015BFBD19142E4D3704700008B -:101180000023002400250026103A28BF78C1FBD890 -:10119000520728BF30C148BF0B6070471FB500F031 -:1011A0003DF88DE80F001FBD1EF0040F0CBFEFF3DC -:1011B0000880EFF30980014A10470000CB9400003B -:1011C0008269034981614FF00100104470470000BB -:1011D000D511000001B41EB400B510F085F901B4BA -:1011E0000198864601BC01B01EBD0000F0B4404627 -:1011F000494652465B460FB402A0013001B506488D -:10120000004700BF01BC86460FBC80468946924617 -:101210009B46F0BC704700000911000019F008BFA0 -:1012200070B51C4C054608202070A01C00F065F825 -:101230005920A08029462046BDE8704006F067BBD3 -:1012400010B506F06FFB13490020891E087010BD11 -:1012500070B50C460F49891E097829B1A0F16001CB -:10126000532906D3012011E0602802D043F2010087 -:101270000CE020CC084E94E80E0006EB8000A0F5B0 -:101280008050241FD0F8806E2846B047206070BD83 -:10129000012070470A000020BCB1010010B50446CF -:1012A0000021012000F03FF80021182000F03BF859 -:1012B00000210B2000F037F80421192000F033F84A -:1012C00004210D2000F02FF804210E2000F02BF84F -:1012D00004210F2000F027F80421C84300F023F870 -:1012E0000721162000F01FF80721152000F01BF839 -:1012F0002046FFF795FF002010BD81210180704737 -:10130000FFF79EBF10487047104A10B514680F4B86 -:101310000F4A08331A60FFF79BFF0C48001D04605A -:1013200010BD704770474907090E002806DA00F023 -:101330000F0000F1E02080F8141D704700F1E0205C -:1013400080F800147047000003F9004310050240C4 -:101350000100000130B5FB4D044610280AD0112CC5 -:1013600006D02846122C817806D0132C08D0FFDF37 -:10137000AC7030BDFFDFFBE71129F9D0FFDFF7E7E5 -:101380001129F5D0FFDFF3E770B50EF03CF9044604 -:101390000FF072FE201AC4B206200CF0F9FA0546CE -:1013A00006200CF0FDFA2E1A07200CF0F1FA054683 -:1013B00007200CF0F5FAE349281A32188878122829 -:1013C0000DD000231A4413280BD0002002440878C3 -:1013D000022808D000201044201AC0B270BD01239A -:1013E000F0E70120F2E70120F5E7D64810B5C17813 -:1013F00094B0A9B15FF017018DF800104168CDF8E5 -:1014000002100089ADF8060009A968460AF0D1F873 -:101410000446112801D004B1FFDF14B0204610BDEE -:101420003221E9E702210CF008BB2DE9F04194B02C -:101430001D4690460E460746FFF7F4FF04000BD00A -:101440002078222804D3A07FC0F34010A84206D100 -:10145000082014B0BDE8F08143F20200F9E737201C -:101460008DF80000ADF802703DB101208DF8040048 -:101470008DF805608DF8068002E000208DF80400EC -:1014800009A968460AF095F8A07F65F34510A07792 -:101490000020DEE730B50446A1F120000D460A2801 -:1014A0004AD2DFE800F005070C1C2328353A3F44F8 -:1014B000FFDF42E0207820283FD1FFDF3DE0A14858 -:1014C0000178032939D08078132836D02078242851 -:1014D00033D0252831D023282FD0FFDF2DE02078EE -:1014E00022282AD0232828D8FFDF26E020782228A7 -:1014F00023D0FFDF21E0207822281ED024281CD012 -:1015000026281AD0272818D0292816D0FFDF14E063 -:101510002078252811D0FFDF0FE0207825280CD077 -:10152000FFDF0AE02078252807D0FFDF05E02078DC -:10153000282802D0FFDF00E0FFDF257030BD30B586 -:101540000B8840F67B444FF6FF72022801D093428D -:1015500004D09D1FA54224D2022802D04D88954276 -:1015600003D04D88AD1FA5421BD24C88A34218D88A -:101570008B88B3F5FA7F14D2022802D0C888904233 -:1015800005D0C88840F677450A38A84209D2C888ED -:10159000904208D0944206D05B1C6343B3EB800FAB -:1015A00001DB072030BD002030BD70B5044610F0CF -:1015B00003FA60BB207930B1082802D8217B0829C2 -:1015C00005D9072070BD217B0029FAD0F6E718B1B4 -:1015D000206810F0F1F9D0B9207B18B1A06810F0A4 -:1015E000EBF9A0B9002507E0206850F8250010F0BD -:1015F000E3F960B96D1CEDB22079A842F4D800255A -:1016000009E0A06850F8250010F0D6F908B11020C4 -:1016100070BD6D1CEDB2207BA842F2D8002070BDD9 -:1016200010B5028943F6FD73111F994212D2418908 -:1016300004290FD3B1F5804F0CD891420AD8017814 -:10164000890705D5406818B1FFF7AFFF002800D122 -:10165000002010BD072010BDF0B50024059D10B17D -:10166000A94203D851E009B90020F0BD0920F0BD1E -:10167000055D8DB107197E78112E3FD00FDC0A2E43 -:101680003CD2DFE806F03B1624242A2A2C2C3333E4 -:10169000025D72BB641CE4B28C42F9D3E4E71D2EF8 -:1016A0002CDAA6F11206042E28D2DFE806F027274E -:1016B0001018022DDAD1BD781D70072D01D26D07EB -:1016C00001D40A20F0BD157845F0010515E0EE4380 -:1016D000F60707E0012D07D010E00620F0BD2E0729 -:1016E000A6F18056002EF5D06046F0BD1578AE0705 -:1016F00001D50B20F0BD45F002051570055D641C99 -:101700002C44E4B28C4202D9B0E74FF4485C8C42DE -:10171000AED3A9E710B504784CB1012243F20223FD -:10172000012C07D0022C0FD0032C17D112E000227D -:101730000A7015E00A7082790324B4EB921F0DD170 -:101740000EE00000A80100200A708479B2EB941F1B -:1017500004D105E00A708279920901D0184610BDC3 -:1017600050F8012F41F8012F80888880002010BD9B -:1017700008B538B1FEA06B4600680090487903EBCD -:10178000901000781070086842F8010F88889080E7 -:1017900008BD30B50C46097895B0222902D2082040 -:1017A00015B030BD28218DF80010ADF80200132AC5 -:1017B00003D03B2A01D00720F2E78DF8042009A9C5 -:1017C000684609F0F6FE050003D121212046FFF707 -:1017D00061FE2846E4E700B595B023218DF800109E -:1017E000ADF802001088ADF804005088ADF806008E -:1017F000D088ADF80A009088ADF808000020ADF858 -:101800000C00ADF80E0009A9684609F0D2FE15B02B -:1018100000BD70B50E46050003D00021092010F070 -:1018200088F8D44C0120022EE0701CD0032E00D08A -:10183000FFDF0621201D0FF071FD607A20F0C0004F -:1018400084F80900FFF7D1FD608A00280AD0002D36 -:1018500008D083000122002109200FF0CDFF0928C4 -:1018600000D0FFDF70BD0321E01D0FF057FD607A4F -:1018700020F0C00040F040006072E01C02F03BFC31 -:10188000E0E72DE9FF410220BA4E8DF80400002761 -:10189000F08AADF80600B84655E001A80CF037F81C -:1018A000050006D0F08AB0B3A6F81680ADF8068021 -:1018B00047E0039C2078212843D0A07F01072BD547 -:1018C00004F123000090A28EBDF80800214604F127 -:1018D000360301F02BFD050003D011282AD0FFDFCD -:1018E00028E0A07F20F00800A077E07F810861F366 -:1018F0000000C10861F34100E07794F8210000F096 -:101900001F0084F820002078282824D1292120468F -:10191000FFF7C0FD1FE01CE0400712D5BDF808002E -:10192000214604F10E02FFF756FF050004D01128EE -:1019300000D0FFDF00250EE0A07F20F00400A0779C -:1019400009E07F1CFFB202200CF022F8401CB842D4 -:10195000A3D8052D07D0BDF80600F082052D04D0D0 -:10196000284604B076E5A6F816800020F9E72DE9B0 -:10197000F047040000D1FFDF20787E4E20F00F00FA -:10198000801C20F0F0007030207060680178091F22 -:1019900011290BD2DFE801F0F1090A4FF00A0CF02F -:1019A000F0360A0A0A0AF174F100FFDFBDE8F08799 -:1019B00087883846FFF736FD050000D1FFDF6078E5 -:1019C000212140F008006070307D40F00400307547 -:1019D0002846FFF75FFD384606F089FD384603F0DC -:1019E00021FC384604F03BFC394602200FF0A1FFF1 -:1019F000A87F20F01000A877FFF743FF0028D5D07C -:101A0000FFDFD3E785882846FFF70CFD00B9FFDF2D -:101A100060688078012800D0FFDF606881792846FF -:101A200006F0D8FE0028C1D0617841F0080161704D -:101A30006168C880BAE786883046FFF7F3FC050086 -:101A400000D1FFDF6078314640F0080060706068C8 -:101A5000C088288160680089688160684089A881A1 -:101A600002200FF066FF0020A875A87F00F0030099 -:101A700002289BD1FFF705FF002897D0FFDF95E7ED -:101A800080783C2803D0002502280AD000E00125F8 -:101A9000002720B13C2802D0022800D0FFDF17B178 -:101AA0007EE00127F5E7607840F008006070307D47 -:101AB00040F008003075EDBB606802218788384629 -:101AC0000BF0B2FF0546032138460BF0ADFF82460E -:101AD000052138460BF0A8FF8146042138460BF05B -:101AE000A3FF804605B9FFDFBAF1000F00D1FFDF89 -:101AF000B9F1000F00D1FFDFB8F1000F00D1FFDF17 -:101B000022212846FFF7C6FC60688079012837D07B -:101B10004FF00208A87F68F30100A8776068C08AC8 -:101B200028816068008B68816068408BA88160684C -:101B3000C07900E027E0E87560688168A961808964 -:101B4000A8836068807B6870606850F80F1FC5F8D4 -:101B500002108088E880A87F00F00301384606F074 -:101B6000B8FCB8F1010F0ED0B8F1020F18D005E0A3 -:101B70000302FF01A80100201FE023E0FFDF15E7BB -:101B80004FF00108C6E73078032800D0FFDF0021BE -:101B900008460FF0CEFEBDE8F047012000F087BFF9 -:101BA000B078132800D0FFDF002107200FF0C1FE1E -:101BB000BDE8F0471120FFF7CDBB2046BDE8F04758 -:101BC00001F08CBE607840F008006070EEE62DE910 -:101BD000F0470546007800270009DFF894A69146F3 -:101BE0000C463E46012871D0BC464FF6FF710228D4 -:101BF0006DD0072809D00A286AD0FFDFA9F8006055 -:101C00000CB1278066800020D0E6686804F10802E5 -:101C100003780D2B40D006DC042B7DD0072B44D05D -:101C20000A2B7AD106E0122B46D0132B51D0142B5D -:101C3000F7D1C0E011270926002C6FD0B0F804803E -:101C4000A4F804806868807920729AF814104046DD -:101C500021F004018AF8141004210BF000FF052183 -:101C600040460BF0FCFE002140460BF0F8FE01213F -:101C700040460BF0F4FE032140460BF0F0FE02213B -:101C800040460BF0ECFE062140460BF0E8FE072133 -:101C900040460BF0E4FEB1E701270926002CCCD02A -:101CA0008088A080686880790EE0122710268088DE -:101CB000214600F01EFFA1E71C270926002CBCD0FE -:101CC0004088A08068680079207297E78AE0B3E0D6 -:101CD00082E081783C2938D010272026002CACD017 -:101CE0008088A0806868C08A60836868C08A208312 -:101CF0006868008BA0836868408BE0836868417FD8 -:101D0000E07D61F30000E0756968497F490861F38F -:101D10004700E075696802E022E05CE08BE0C8798A -:101D20000831FFF725FD696804F10F0201F10F008A -:101D30008B7B01461846FFF71BFD6868807910B160 -:101D40000120A07507E00220FBE71B270926002CD5 -:101D500071D084F808C09AF8141021F008018CE0C2 -:101D60001D273026002C66D0A1806868411D0079AF -:101D7000FFF7FEFC686890F82B00E0736868C07895 -:101D80000428207C14D020F00100207469681F22F0 -:101D9000C97861F3420020746968C97A61F3C700A9 -:101DA0002074696804F111000C3119F043F825E73B -:101DB00040F00100E9E720271026E4B3A18068681D -:101DC00004F10902407A20726968CB1C88781946B0 -:101DD000FFF7CEFC12E74A4621462846BDE8F04709 -:101DE00001F001BF287E012803D0022813D0FFDFB5 -:101DF00004E71F271026F4B16888A080688B208133 -:101E0000A88B6081E88BA081288CE0819AF814105F -:101E100021F0200131E012271026688800F069FEC9 -:101E20004CB1687800F007000328C0D19AF814106C -:101E300021F0020121E027E0287E062822D2DFE8F7 -:101E400000F0040F0F030303C5E71B270926DCB1CD -:101E5000A18084F808C09AF8141021F001010CE068 -:101E60001B27092684B1A180287E012808D00320E1 -:101E700020729AF8141021F010018AF81410BDE6AF -:101E80000220F5E7FFDFB9E6A9F80060BBE610B570 -:101E9000F74894B08078132802D0082014B010BD01 -:101EA00022208DF8000009A9684609F082FB04464B -:101EB000002107200FF03DFD2046EFE700B5EC487C -:101EC00095B08078122801D00820A0E41E208DF85B -:101ED000000000208DF802008DF8030009A9684673 -:101EE00009F067FB0028F0D1002107200FF021FD49 -:101EF0001120FFF72FFA002089E400B5DC4895B0E7 -:101F00000078022803D0032801D008207FE41B209A -:101F10008DF8000000208DF8020009A9684609F03C -:101F200048FB0028F2D1002108460FF002FD0120F5 -:101F300000F0BDFD00206AE42DE9F0410027CC4C03 -:101F40000A287CD2DFE800F0057B1C7B7B7B7B448E -:101F50003B6AFFF7D2FF002831D105F01FFC0028B3 -:101F60002DD0017821F00F01891C21F0F0012031E2 -:101F70000170077605F0F0FB207D40F001001DE0C8 -:101F80008EB23046FFF74EFA050000D1FFDF287809 -:101F9000212814D005F002FC98B1017821F00F013E -:101FA000891C21F0F0011031017002210176468078 -:101FB000AF7505F0D1FB207D40F002002075BDE833 -:101FC000F08129463046BDE8F0411322FFF7E1BB1E -:101FD000A578122D03D0132D04D0FFDFEFE7FFF714 -:101FE0006DFF01E0FFF753FF0028E8D105F0D6FBB5 -:101FF0000028E4D0017821F00F01891C21F0F001C4 -:1020000020310170122D07D00221017605F0A4FBCA -:10201000207D40F01000D1E70121F6E7607A012130 -:10202000B1EB901F02D1022104E008E0800900D04A -:10203000FFDF0321BDE8F0410020FFF7EABBFFDF2F -:10204000BDE72DE9F04114460D00074600D1FFDF42 -:102050002878012803D0022821D0FFDFAFE73846D7 -:10206000FFF7E0F9060000D1FFDF0220B07520780D -:1020700020F00F00801C20F0F000103020706078FD -:1020800040F0080060702868A0616868E0612889F5 -:1020900020847748017D41F0200101758FE73846A3 -:1020A000FFF7C0F9060000D1FFDF69884FF6FF7027 -:1020B000814209D1AA88824206D131463846BDE81C -:1020C000F0411322FFF765BB814201D1A88898B186 -:1020D000207820F00F00801C20F0F00010302070DD -:1020E000607840F0080060702868A0616868E0616E -:1020F00028892084002006E0782300223946022027 -:102100000FF07AFB0120B07559E730B5054695B060 -:102110000C4608460FF050FC78BB00200121203D02 -:10212000062D5FD2DFE805F0032540444A57002121 -:1021300008200FF0D7FB10B1112015B030BD2420BE -:102140008DF80000D4F80200CDF80200A0798DF8D7 -:10215000060009A9684609F02CFA05002CD10823CD -:102160000022114618460FF047FB082824D0FFDF55 -:1021700022E060680FF062FC08B11020DDE73C202F -:102180008DF800002088ADF802006088ADF80400EA -:1021900009A9684609F00DFA05000DD1606858B12B -:1021A000BDF82810018007E0206801F0E2FF02E09E -:1021B000204600F0B1FC05462846BEE73D220BE074 -:1021C0008DF8021002E000BF8DF8020009A96846F0 -:1021D00009F0EFF9EFE734228DF800202278D207DA -:1021E000F2D0EDE70720A8E730B5054695B00C46DC -:1021F00008460FF005FC70BB203D052D35D2DFE809 -:1022000005F00323232523002088FFF70BF920B1D5 -:102210000078222804D208208FE743F202008CE7DE -:1022200025208DF800002088ADF8020009A9684635 -:1022300009F0BFF9002880D1DDF82A10C4F8021097 -:102240009DF82E10A17178E7062076E7206838B156 -:102250000FF0F4FB08B110206FE7206801F07DFF5C -:102260000348408AA080002067E7072065E7000058 -:10227000A8010020FE487047FD4810B518210A3813 -:1022800018F04FFE012000F012FC1120FFF762F859 -:10229000F74C00200A3C211D60744FF4617060828D -:1022A000E01C05F043FBD4F80300C4F80A00B4F8BE -:1022B0000700E081607A2074FFF797F800B1FFDF34 -:1022C00000F09CFCBDE8104001F0C2BA10B50C460D -:1022D0003E21204618F025FEA07F20F00300A077C5 -:1022E000202020700020A07584F8220010BD7047C7 -:1022F0002DE9FC4105460E4608460FF05DFB10B186 -:102300001020BDE8FC81DA4C0A3C15B1012D38D112 -:102310002CE0D4F803000090B4F80700ADF80400F6 -:102320008046677A8DF80670E11C3046FFF7F2F9B7 -:102330000028E6D1FFF759F830B10099C4F803102E -:10234000A4F807806772DCE7307808B1012808D16B -:10235000D4F80300C4F80A00B4F80700E081607AFA -:102360002074002109200FF0E4FA0FE0317841B128 -:10237000012906D0022906D0032904D043F2022005 -:10238000BFE70720BDE70120FFF743FA657400208F -:10239000B7E710B504460FF033FB08B1102010BDAD -:1023A000B34922460A39C878091DFFF7E1F9002030 -:1023B00010BD2DE9F0419AB0054600208DF85C0073 -:1023C0008DF858008DF828008DF860001E461446E0 -:1023D000884628460FF03BFB18B920460FF037FB24 -:1023E00010B110201AB0EAE555EA040018D01F27F2 -:1023F0000AAB17AA414628460097FFF72DF9002897 -:10240000F0D118AB16AA314620460097FFF724F901 -:102410000028E7D19DF85800C00703D00A20E1E763 -:102420000720DFE701AF7DB11A208DF804008DF899 -:10243000068042462946F81C18F0FCFC0BA901A8AE -:1024400009F0B7F80028CDD17CB120208DF8040028 -:102450008DF8066032462146F81C18F0EBFC0BA9FB -:1024600001A809F0A6F80028BCD181499DF82800F0 -:102470000A3948700020B5E770B506460A200C46B8 -:10248000087015461146204609F093F830B93821F6 -:1024900021702046294609F08CF820B1082801D186 -:1024A00043F2032070BD2A462146304600F05BFB14 -:1024B0000446082800D1FFDF204670BD2DE9F04119 -:1024C0006CA196B00446D1E90001CDE914010027C2 -:1024D00020460FF071FA30B92078012806D16068E3 -:1024E0000FF06AFA10B1102016B068E5604D0A3D91 -:1024F0002878012801D00820F6E707200BF050FAD1 -:1025000018B9207848B1012807D0FEF73DFF30B157 -:10251000287D10F00C0F09D103E01220E4E713200E -:10252000E2E7C10702D1A846800701D51120DBE709 -:10253000208A43F6E172A0F120019142217807D36D -:10254000012942D1002840D1618A00293DD10FE004 -:10255000022901D0032901D1A02836D3012907D0AF -:1025600098F80110C90703D0618A71B3B4292CD837 -:10257000217831B1012908D0022904D0032924D1BE -:1025800015E0002516E0022514E008B9608A60B164 -:1025900004256068007868B101280AD0022808D0B4 -:1025A000032806D043F202209EE70125F1E7032528 -:1025B00000E00127207A30B1012807D0022807D097 -:1025C00003286AD106E0002605E066E0012602E065 -:1025D000022600E003260DB1022D13D196B1E0686A -:1025E00018B1FEF7E2FF002886D198F801008007B5 -:1025F00002D043F2012077E7022D03D1022E4CD006 -:10260000032E4AD018208DF82C00208AADF82E0019 -:10261000208AADF830008DF8325098F80310002071 -:102620004FF0010811B1012968D102E08DF83300A3 -:1026300001E08DF833808DF834702178012925D0A0 -:10264000CDF83500ADF839008DF83C60207DC0F341 -:102650004002014662F35F01C0F3800041EA80005E -:1026600014A9085C8DF83B00B8B169460BA805E0D9 -:10267000B2010020070605040302010008F099FFDB -:10268000002891D15DB1022D09D011E0606850F8A9 -:10269000011FCDF835108088D4E7072024E73EB12C -:1026A000E06828B16A460BA9FFF7E6FE0028A2D130 -:1026B0001B208DF82C008DF82E8069460BA808F0A1 -:1026C00078FF002897D19DF801001B2816D1052D11 -:1026D00009D2DFE805F0030305050300032000E04D -:1026E000022000F0E4F9012D0AD0608A40B10022F6 -:1026F0008300114610460FF07FF808B10320F3E67F -:102700000020F1E62DE9FC4107460D460326084668 -:102710000FF09DF9002863D13846FEF783FE0400D0 -:1027200004D02078222804D20820EAE543F20200EF -:10273000E7E5A07F00F0030C2DB129466046FEF7C7 -:10274000FEFE0600F1D1F948BCF1010F05D0BCF145 -:10275000020F17D0FFDF3046D3E5A27D2946012ABC -:1027600002D0007D800701D51120CAE529B968464D -:1027700000F0FDFA0028D8D16946384605F0A7FFD9 -:102780000646E8E7A17D022914D1007D800611D418 -:1027900025B1A07F40070BD4002100E0012138467D -:1027A00005F0E0FF0600D6D1A075002DD3D002E0E1 -:1027B0001126D0E7A5B12A4621463846FFF70BF887 -:1027C00006461128C7D1A07F4107C4D4296844F820 -:1027D0000E1F6968616040F0040020740026BAE7AB -:1027E00010208EE570B50C460546FEF71BFE010075 -:1027F00005D022462846BDE87040FEF7CABF43F226 -:10280000020070BD00B595B031218DF800108DF833 -:10281000020009A9684608F0CCFE15B000BD0123EE -:10282000FEF703BE00231A461946FEF7FEBD70B53B -:1028300094B004460FF0C0F810B1102014B070BD71 -:102840002046FEF7EDFE0028F8D1B84DA8781128F3 -:1028500001D00820F2E7FEF797FD20B1287DC006E1 -:1028600003D51120EAE71320E8E71D208DF80000CA -:10287000207800F001008DF802002089ADF80400F6 -:102880006089ADF806002078C0F340008DF809009B -:10289000E8780025012618B1012804D00320CDE7EF -:1028A0008DF8085001E08DF8086009A9684608F025 -:1028B00080FE0028C2D12078800707D5606828B143 -:1028C00009AA6946FFF7D8FD0028B7D11E208DF868 -:1028D00000008DF802608DF8035009A9684608F0E1 -:1028E00068FE0028AAD1A08900F0F5F80400A5D15F -:1028F0001220FEF72FFD2046A0E7F0B595B0154653 -:102900000C4607460FF0A3F838B920460FF054F8EC -:1029100018B928460FF050F810B1102015B0F0BDCE -:10292000824E307D10F0180F01D1400701D51120E3 -:10293000F4E72046FEF774FE0028EFD12078C0F3BC -:102940004001394302D0800702D50FB10720E5E7E7 -:1029500029460220FEF7F3FD0028DFD1B0781128C8 -:1029600003D0122801D00820D8E706200BF018F871 -:1029700018B1B078122802D005E01220CEE7FFF798 -:102980009DFA0028CAD1FEF7FFFC022801D21320CD -:10299000C4E72078800707D5606828B109AA69468E -:1029A000FFF76AFD0028B9D121208DF800002089A9 -:1029B000ADF802006089ADF8040020784FF0010105 -:1029C000C0F340008DF80600207882074FF0000029 -:1029D00015D43A7842B1012A09D0022A07D0032A35 -:1029E00005D043F2022099E78DF8070001E08DF849 -:1029F000071057F8012F0292BA88ADF80C20F27830 -:102A00001AB1012A04D0032088E78DF80E0001E0F6 -:102A10008DF80E102988ADF810106988ADF81210E5 -:102A2000A988ADF81410E988ADF81800ADF81610B3 -:102A3000ADF81A0009A9684608F0BBFD002886D148 -:102A4000A08900F048F804008ED11320FEF782FC24 -:102A5000204663E730B5054695B00C4608460EF0B3 -:102A6000CFFF10B1102015B030BD2846FEF7DAFCBC -:102A700038B10178222902D3807F800604D408204F -:102A8000F1E743F20200EEE713208DF80000ADF805 -:102A9000025009A9684608F08CFD0028E3D19DF991 -:102AA0002A107F2901D02170DDE70520DBE730B552 -:102AB0001E4D040008D0012C04D0022C06D0032C9B -:102AC00004D0FFDF2C7030BDFFDFFBE72878012842 -:102AD000F8D0FFDFF6E710B548B1830000221146B9 -:102AE00007200EF089FE072801D0032010BD00202A -:102AF00010BD70B50C0006460DD0FEF793FC050026 -:102B000000D1FFDFA680288920812889608168891B -:102B1000A081A889E08170BD10B50446006840B16D -:102B20000EF095FF20B1102010BD0000A80100207C -:102B3000206801F005FBA0882F4C6082607C012892 -:102B40000FD1002109200EF0CDFE00B10120617AE5 -:102B50000122B2EB911F01D1022100E00321FEF717 -:102B600058FE0020E0E72DE9F047002592460C468C -:102B70000646A8464FF001090B2721E0306850F8BF -:102B80002500007820B1012805D00720BDE8F08796 -:102B900084F8028001E084F80290306850F8250043 -:102BA00050F8011FC4F803108088A4F807002770AC -:102BB0005146204608F0FDFC0028E7D16D1CEDB21F -:102BC0003079A842DAD8002539270FE0B068102202 -:102BD00050F82510A01C18F02DF9277051462046FA -:102BE00008F0E7FC0028D1D16D1CEDB2307BA84283 -:102BF000ECD80020CAE70000A8010020E848002126 -:102C00000160818070472DE9FF41804692B01C46EB -:102C10000E4618460EF0D0FE18B1102016B0BDE8D2 -:102C2000F08121460120FEF78AFC0028F6D101251B -:102C30008DF842504FF4C050ADF84000002210A96A -:102C4000284603F0AAFD0028E8D18DF842504FF441 -:102C50002850ADF8400000271C216846099718F05D -:102C600082F99DF82400ADF8346020F00F00401C7C -:102C700020F0F00010308DF824009DF82500ADF80C -:102C8000367020F0FF008DF825009DF8260007AA79 -:102C900020F00600801C40F001008DF826009DF811 -:102CA00000000BA940F002008DF800001F20ADF8D5 -:102CB000380009A80C9010A80B90CDF83C8068460D -:102CC00003F06EFB0028A9D1B54EBDF81C0007AA81 -:102CD00030808DF8425042F60120ADF840009DF85A -:102CE00026000BA920F00600801C20F001008DF8C2 -:102CF00026000220ADF83400ADF8380014A80F907B -:102D0000684603F04DFB002888D1BDF81C00708098 -:102D1000311D204600F0ECF880E73EB5044608205F -:102D2000ADF8000020460EF047FE08B110203EBD71 -:102D300021460120FEF703FC0028F8D12088ADF8D9 -:102D400004006088ADF80600A088ADF80800E088AF -:102D5000ADF80A00924801AB6A468088002103F072 -:102D600009FFBDF800100829E1D003203EBD1FB5C2 -:102D70000446002002900820ADF80800CDF80CD0E1 -:102D800020460EF019FE10B1102004B010BD84488A -:102D900002AA81884FF6FF7004F07BF80028F4D176 -:102DA000BDF80810082901D00320EEE7BDF8001097 -:102DB0002180BDF802106180BDF80410A180BDF82B -:102DC0000610E180E1E701B582B00220ADF8000015 -:102DD000734802AB6A464088002103F0CBFEBDF881 -:102DE0000010022900D003200EBD1CB50021009167 -:102DF0000221ADF8001001900EF002FE08B1102083 -:102E00001CBD67486A4641884FF6FF7004F041F8E0 -:102E1000BDF800100229F3D003201CBDFEB5074603 -:102E200014460E4608460EF0C7FD08B11020FEBD40 -:102E30001F2C01D90C20FEBD38460EF0BDFD584DAB -:102E400018BB288801A903F021F80028F3D13878AD -:102E50008DF80500288801A903F06DFE0028EAD14D -:102E600000909DF800009DF8051040F002008DF8DC -:102E70000000090703D040F008008DF80000288802 -:102E8000694603F0FBFD0028D5D1ADF8084028883D -:102E9000334602AA002103F06DFEBDF80810A142DE -:102EA000C9D00320FEBD7CB50546002000900190EE -:102EB0000888ADF800000C46284601950EF0BEFDCE -:102EC00018B920460EF09CFD08B110207CBD15B14C -:102ED000BDF8000050B132486A4601884FF6FF70D5 -:102EE00003F0D7FFBDF8001021807CBD0C207CBD15 -:102EF00030B593B0044600200D460090142101A87F -:102F000018F031F81C2108A818F02DF89DF80000E1 -:102F1000CDF808D020F00F00401C20F0F000103059 -:102F20008DF800009DF8010006AA20F0FF008DF842 -:102F300001009DF8200001A940F002008DF820005A -:102F400001208DF8460042F60420ADF8440011A897 -:102F500001902088ADF83C006088ADF83E00A08864 -:102F6000ADF84000E088ADF842009DF8020020F086 -:102F70000600801C20F001008DF802000820ADF84A -:102F80000C00ADF810000FA8059008A803F008FA8F -:102F9000002803D1BDF818002880002013B030BDF0 -:102FA00010000020094810B504680A490848086064 -:102FB0000DF08AFB0848046010BD08490020086035 -:102FC0004FF0E0210220C1F8800270471005024056 -:102FD000010000011805024014050240FC1F0040DA -:102FE00070B50C46054606F0BFFE21462846BDE8F2 -:102FF000704007F09CBE704770477047704770473D -:1030000010FFFFFFDBE5B15100C001008100FFFFB1 -:1030100010B504460EF0D0FC08B1102010BD207889 -:10302000C0F30210042807D86078072804D3A178D9 -:10303000102901D8814201D2072010BDE078410754 -:1030400006D421794A0703D4000701D4080701D523 -:10305000062010BD002010BD10B513785C08C37F9A -:1030600064F30003C3771478A40864F34103C377BF -:103070001078C309887863F34100887013781C09BD -:103080004B7864F347134B701378DB0863F300004D -:1030900088705078487110BD10B5C4780B7864F30F -:1030A00000030B70C478640864F341030B70C478A8 -:1030B000A40864F382030B70C478E40864F3C303C8 -:1030C0000B700379117863F30001117003795B08C9 -:1030D00063F34101117003799B0863F3820111705E -:1030E0000079C00860F3C301117010BD70B51446BB -:1030F0000D46064604F052FB80B10178142221F0FF -:103100000F01891C21F0F001A03100F8181B2146A5 -:1031100017F0D5FEBDE8704004F01EBB29463046CE -:10312000BDE870401322FEF734BB70B514460E465E -:10313000054604F033FB70B1017821F00F01891CC2 -:1031400021F0F00120310170458021688161BDE8E6 -:10315000704004F001BB31462846BDE870401322A0 -:10316000FEF717BB10B5FE4C94F8300000280CD1C8 -:1031700004F120014FF6FF72A1F110000CF0B9F834 -:1031800000B1FFDF012084F8300010BD2DE9F047C9 -:10319000064608A8894690E830041F469046142148 -:1031A000284617F0E0FE0021CAF80010B8F1000F21 -:1031B00003D0B9F1000F03D114E03878C00711D063 -:1031C00020680EF01DFCE8BBB8F1000F07D12068A5 -:1031D000123028602068143068602068A860216878 -:1031E000CAF800103878800727D560680EF026FCF2 -:1031F00040BBB9F1000F2CD0FFF73CF80168C6F8CE -:10320000B4118188A6F8B811807986F8BA01FFF761 -:10321000A9FFDFF84C8308F12008C5F80C8062682C -:103220005AB196F8B40106F2B5111032FEF7A0FAC1 -:1032300010224146606817F0FDFD3878400712D52E -:10324000A06800E002E00EF0DBFB50B11020BDE80A -:10325000F08760680028F9D0E8606068C6F8B001BF -:10326000EBE7A06828610020F1E730B50546087853 -:103270000C4620F00F00401C20F0F00110312170AE -:103280000020607095F8220030B104280FD0052886 -:1032900011D0062814D0FFDF20780121B1EB101FD8 -:1032A00004D295F8200000F01F00607030BD21F0BE -:1032B000F000203002E021F0F00030302070EBE729 -:1032C00021F0F0004030F9E710B510B190F8A940B6 -:1032D00044B1A34890F8354000205CB1086010600C -:1032E000186010BD00F1A8040C6000F1D001F830A6 -:1032F0001160F5E79A4C34340C60F0E700B58BB000 -:103300000823CDE902128DF8013001919449002380 -:1033100064310591099301468DF8103068460BF031 -:10332000C0FF002800D0FFDF0BB000BD30B595B066 -:103330000C462C2518998DF80050ADF80200B3B159 -:103340001868019058680290ADF80C2010220DF119 -:103350000E0017F06FFD09A9684608F02AF9002849 -:1033600003D1A17F41F01001A17715B030BD00203D -:103370000190E8E72DE9F0470646008A8AB080B25E -:103380000D468146FEF74EF80446754F3078283FCB -:10339000DFF8CC814FF0000A122873D2DFE800F08A -:1033A00072E9350936777E98A8F3E7E6E5E4DF5B56 -:1033B000DFDFA07F00F00300012806D0002148468F -:1033C0000AF03BFB050003D101E00121F7E7FFDF35 -:1033D00098F85C10090602D5D8F860000BE00321CC -:1033E00005F121000DF09AFFD5F821005D49B0FBF1 -:1033F000F1F201FB1200C5F8210070686866B06840 -:10340000A8662078252800D0FFDFECE0A07F00F040 -:103410000300012806D0002148460AF00EFB0600F2 -:1034200003D101E00121F7E7FFDF7078810702D5C2 -:103430002178252904D040F0010070700AB006E719 -:103440000220287096F82000287106F121003136FC -:10345000C5E90206F2E7A07F00F00300012806D0CC -:10346000002148460AF0E9FA040003D101E00121F5 -:10347000F7E7FFDF6078C10605D5142028704134D6 -:103480006C60DBE7E2E140F008006070D6E73448AA -:10349000082128380DF042FF032016E02A208DF87D -:1034A000000010220DF10200716817F0C3FC102219 -:1034B0000DF11200B16817F0BDFC294968462C399E -:1034C00008F077F800B1FFDF042028706F60B5E7DF -:1034D000E07FC00600D5FFDFB0680090B388062209 -:1034E0000321484605F063F80028A7D0FFDFA5E7D1 -:1034F00004B9FFDF716821B1102204F1230017F035 -:1035000099FC28212046FDF7C5FFA07F00F00300AD -:1035100002280ED104F12300002300901A46214610 -:103520004846FFF703FF112807D029212046FDF761 -:10353000B1FF307A84F8200080E7A07F000700D533 -:10354000FFDF14F81E0F40F008002070A4F816A04A -:10355000C4F818A0C4F81CA0617808460AE034E05A -:103560005C02002040420F006CE19AE090E062E0D3 -:1035700009E03FE061F38200410861F3C30060703D -:10358000307AE0705AE7A07F00F00300012806D0EF -:10359000002148460AF051FA040003D101E001215C -:1035A000F7E7FFDF022104F175000DF0B7FE1120EF -:1035B000287004F5DA706860B4F875002882FD4858 -:1035C0006C346C61C5E9028038E7A07F00F003002D -:1035D000012805D0002148460AF02FFA18B901E069 -:1035E0000121F8E7FFDF0AB0324621464846BDE830 -:1035F000F0477BE504B9FFDF207821289CD930799A -:10360000012802D002280AD103E0E07F40F0100038 -:10361000E07798F85C1041F0010188F85C103246C0 -:1036200021464846FFF762FD0AB02046BDE8F04754 -:103630002321FDF72FBF327901230321484604F0EF -:10364000B7FD98B1122005F8040B327925F8042B48 -:10365000281DA91E0095CDE901100023032148462D -:1036600004F023FE00288DD0FFDFE7E6A07F00F006 -:103670000300012806D0002148460AF0DEF90400C4 -:1036800003D101E00121F7E7FFDF30792070D5E6B3 -:103690000321484605F02DF9002895D11320287004 -:1036A000CCE6A07F00F00300012806D000214846A8 -:1036B0000AF0C3F9050003D101E00121F7E7FFDFBC -:1036C00095F8740000F00300012878D1A07F00F085 -:1036D0000307E07FC0F3400616B1012F04D02BE0B2 -:1036E00095F89000C0072AD0D5F8AC0118B395F82A -:1036F0007320017C62F387010174E27FD5F8AC018D -:1037000062F341010174D5F8AC0166F30001017464 -:10371000AEB1D5F8AC01102204F12301783517F0D1 -:1037200089FB287E40F001002876287820F00100EF -:1037300005F8780900E016B1022F04D02CE095F8C6 -:103740007800C00726D0D5F8A80118B395F87320E3 -:10375000017C62F387010174E27FD5F8A80162F36E -:1037600041010174D5F8A80166F3000101748EB11E -:10377000D5F8A801102204F12301783517F05AFB7F -:10378000287840F0010005F8180B287820F0010097 -:1037900005F89009022F51D05FF0000000EB4000C7 -:1037A00005EBC00090F87800800708D5D5F8B02167 -:1037B00095F86C0005F16D011032FDF7D9FF052079 -:1037C00060F3070815F8740F00F0030060F30F288A -:1037D000287960F31748287F60F31F687548AC3874 -:1037E000027822F00F02921C22F0F00220320270C6 -:1037F000427822F00702D21C4270A0F80290C0F872 -:10380000188004F033F92078252805D0212807D026 -:10381000FFDF2078222803D922212046FDF73AFE37 -:10382000A07F00F0030001280AD0002148460AF0DA -:1038300016F900283FF40EAEFFDFFFE50120ADE7EB -:103840000121F3E7716881F801A0F7E5FFDFF5E5F5 -:1038500070B5584C0025103C14F85C0F20F0800027 -:10386000207065600BF0E7FC5249A1F1100004F0F4 -:103870008FF804F82C5C072060724E487C30206181 -:103880005030A0611030E06170BD70B50D46FDF79D -:10389000C9FD040000D1FFDF4FF4DE71284617F0A8 -:1038A00062FB44485430686104F123002861A07F22 -:1038B00000F00300012809D05FF0020105F59070C7 -:1038C0000BF0BAFC002800D0FFDF70BD0121F5E746 -:1038D0000A46014602F590700BF0CCBC70B5054667 -:1038E00040689AB0017808290DD00B2903D00C2923 -:1038F00036D101218171686886883046FDF792FDD6 -:10390000040035D133E046883046FDF78BFD0400D6 -:1039100000D1FFDF2078212822D0282822D1686812 -:1039200002210C3001F09CF9E0B168680821001D0B -:1039300001F096F9B0B12D208DF80000ADF80260CD -:10394000102204F1230101A817F074FA09A96846AE -:1039500007F02FFE00B1FFDF29212046FDF79AFD79 -:103960001AB070BD687840F008006870F8E7FFDFB3 -:10397000A07F00F00301022902D120F01000A077FF -:10398000207821280AD06868817909B1807898B1B7 -:10399000A07F00F0030002285BD0FFDFA07F00F0D3 -:1039A00003000228DCD1FDF76CFF0028D8D0FFDF30 -:1039B000D6E700006C020020687840F008006870CC -:1039C000E07FC10720D0800701D5062000E0052058 -:1039D00084F822002078292818D02428DED1314606 -:1039E00006200DF0A6FF22212046FDF753FDA07F03 -:1039F00000F0030001282AD0002130460AF02FF8F9 -:103A00000028CBD0FFDFC9E70420E1E7A07F00F06A -:103A10000300012806D0002130460AF00EF8050008 -:103A200003D101E00121F7E7FFDF25212046FDF763 -:103A300031FD10208DF8500014A905F590700BF0A1 -:103A400010FC0228AAD00028A8D0FFDFA6E7012199 -:103A5000D3E7687840F0080068709FE72DE9F047E9 -:103A60008CB01D46904689460646DDF850A0FDF70D -:103A7000D9FC040052D0207822284FD323284DD0DF -:103A8000E07FC0064AD4A07F00F00300012806D0E2 -:103A90000021304609F0D1FF070002D00BE00121E0 -:103AA000F7E7A07F00F00300012804D10121304690 -:103AB00009F0BAFF074601AB02AA03A93846FFF78F -:103AC00003FC039800B9FFDF4FB1039807F5907727 -:103AD00087612078222806D0242804D007E00399A3 -:103AE0000020886103E025212046FDF7D3FC0398E0 -:103AF0000C2141704662A0F80480C0F80890A0F83C -:103B000006A0C560029901610199416104A90BF009 -:103B1000C8FB022802D0002800D0FFDF0CB0BDE8AF -:103B2000F08730B589B00546FDF77CFC0178222985 -:103B300033D9807F00F00300012806D000212846F9 -:103B400009F07BFF040003D101E00121F7E7FFDF6B -:103B5000227801230321284604F02AFB00281CD0E8 -:103B600012208DF80C00227806A8811F05ABCDE944 -:103B700000310290ADF8102000230321284604F004 -:103B800094FB00B1FFDF03A904F590700BF069FB13 -:103B9000022802D0002800D0FFDF09B030BD10B5E8 -:103BA00086B00446FDF73EFC0178222919D9807FB2 -:103BB00000F00300012806D00021204609F03DFF57 -:103BC000040003D101E00121F7E7FFDF13208DF8A6 -:103BD0000000694604F590700BF043FB002800D00C -:103BE000FFDF06B010BD2DE9F05F05460C4600274B -:103BF0000078904601093E46BB4604F1080A0229B6 -:103C00007ED0072902D00A2909D141E068680178ED -:103C1000082905D00B292BD00C2929D0FFDFC5E1BD -:103C200014271C26002C6CD04088A080FDF7FAFBDE -:103C30005FEA000900D1FFDF99F81700524609F149 -:103C40001801FDF795FD68688089208269684868D9 -:103C5000C4F812008868C4F81600A07E20F00600A0 -:103C600040F00100A07699F81E0040F040014DE0C0 -:103C70001A270A26002CD6D08088A080FDF7D2FB18 -:103C8000050000D1FFDF51462846FFF7EEFA8DE12F -:103C90000CB1288DA080287E0E287CD006DC01285F -:103CA0007AD0022808D0032804D135E0102874D037 -:103CB000112873D0FFDF79E11E270926002CB2D02E -:103CC000A088FDF7AFFB5FEA000900D1FFDF287F86 -:103CD00000F003000128207A1BD020F001002072A0 -:103CE000297F890861F341002072297FC90861F3A7 -:103CF00082002072297F090961F3C300207201E06C -:103D000049E116E199F81E0040F0800189F81E1083 -:103D10004CE140F00100E2E713270D26002CAAD069 -:103D2000A088FDF77FFB8146807F00F0030001281B -:103D300006D00021A08809F080FE050003D101E033 -:103D40000121F7E7FFDF99F81E0000F00302012AC6 -:103D500059D0A86E817801F003010129217A54D04D -:103D600021F00101217283789B0863F341012172E4 -:103D70008378DB0863F38201217283781B0963F384 -:103D8000C3012172037863F306112172437863F350 -:103D9000C711217203E060E0A6E08EE09EE084F8A7 -:103DA00009B0C178A172012A32D04279E17A62F376 -:103DB0000001E1724279520862F34101E1724279F5 -:103DC000920862F38201E1724279D20862F3C30180 -:103DD000E1720279217B62F30001217302795208BA -:103DE00062F3410121730279920862F38201217327 -:103DF0000079C00860F3C301217399F800002328FB -:103E00005AD9262168E0686EA4E741F00101A9E7CC -:103E10000279E17A62F30001E1720279520862F3F9 -:103E20004101E1720279920862F38201E172027942 -:103E3000D20862F3C301E1724279217B62F300018F -:103E400021734279520862F3410121734279920849 -:103E500062F3820121734079CBE718271026002CEA -:103E600067D0A088FDF7DEFA8246807F00F003006D -:103E7000012807D00021A08809F0DFFD5FEA0009D2 -:103E800003D101E00121F6E7FFDFE869A06099F8BE -:103E9000010040F0040189F8011099F80200800740 -:103EA00008D5012020739AF8000023287ED9272105 -:103EB000504663E084F80CB078E015270F26C4B3B1 -:103EC000A088FDF7AFFA814606225146E86907F05F -:103ED000D6FB0120A073AEE048464FE01627092626 -:103EE0003CB3287F207261E0287FFE4902280CD075 -:103EF00019270E26ECB101280DD003281AD004286A -:103F00001BD0052819D0FFDF23E01B270926BCB3EF -:103F10000120207205E001202072607A20F0030069 -:103F2000607211F85C0F4208520062F306000870DC -:103F30000FE02BE00220207207E0697F052801F0E6 -:103F40000F0141F0800121721BD0607A20F0030044 -:103F50006072A088FDF766FA05460078212825D012 -:103F6000232800D0FFDFA87F00F00300012810D035 -:103F70000021A08809F073FD22212846FDF78AFA66 -:103F800014E0607A20F00300401CE1E7A8F800602C -:103F900011E00121EDE70CB16888A080287E03289C -:103FA0002BD004280AD005284BD0FFDFA8F80060EA -:103FB0000CB1278066800020BDE8F09F15270F26F2 -:103FC000002CE3D0A088FDF72DFA807F00F00300DD -:103FD000012806D00021A08809F02FFD050003D19B -:103FE00001E00121F7E7FFDFD5F821000622514665 -:103FF00007F045FB84F80EB0D8E717270926002CF8 -:10400000C4D0A088FDF70EFA8146807F00F003003F -:10401000012806D00021A08809F00FFD050003D17A -:1040200001E00121F7E7FFDFA878800701D5022032 -:1040300000E00120207299F800002328B6D927213A -:104040004AE719270E26002CA0D0A088FDF7EAF930 -:104050005FEA000900D1FFDFC4F808B0A4F80CB093 -:1040600084F808B0A07A40F00300A07299F81F10FD -:1040700061F38200A07299F81F1001EA510161F307 -:10408000C300A072687E00F0030001288ED1607A20 -:1040900040F00400607299F81E0000F0030001284F -:1040A00014D0E97E607B61F300006073AA7E217BFF -:1040B00062F300012173EA7E520862F341006073EB -:1040C000A87E400860F3410121736FE7E87E217B01 -:1040D00060F300012173AA7E607B62F300006073CD -:1040E000EA7E520862F341012173A97E490861F317 -:1040F000410060735AE730B504468079012591B0DC -:10410000B5EB901F00D0FFDFFFF72CF84FF6FF70E4 -:10411000099074488DF8015020300190201D0290C4 -:10412000601C0B900AA968460BF0BBF800B1FFDFDA -:104130000B980188A4F801108078E07011B030BDB0 -:1041400010B5684C30B10146102204F1200016F081 -:1041500071FE012084F8300010BD10B50446FFF751 -:1041600001F8604920461022BDE81040203116F0C9 -:1041700061BE70B55B4C06004FF0000514D00DF029 -:104180001BFC08B110250DE00621304607F05EFA51 -:10419000411C06D0206614F85C0F40F080002070AF -:1041A00000E00725284670BD14F85C0F20F0800061 -:1041B000F5E72DE9F041804688B00D460027084616 -:1041C0000DF045FCA8B94046FDF72CF9040003D0DA -:1041D0002078222815D104E043F2020008B0BDE89F -:1041E000F08145B9A07F010603D500F00300022845 -:1041F00001D01020F2E7A07FC10601D4010702D54B -:104200000DB10820EAE7374991F85C10C90701D0E1 -:104210001120E3E7E17FC90601D50D20DEE700F0BC -:104220000300022805D125B12846FEF7F1FE07005C -:10423000D4D1A07F00F00300012806D00021404621 -:1042400009F0FBFB060002D00CE00121F7E7A07F9C -:1042500000F0030001280BD00021404609F0E4FBE8 -:10426000060007D0A07F00F00300022804D009E078 -:104270000121F2E70420B1E725B12A463146204664 -:10428000FEF7EAFE07AB1A4669463046FFF71CF810 -:10429000009800B9FFDF00990D20487006F5907076 -:1042A000C1F82480486100200881A07F00F003004D -:1042B00001282BD0F5B302200871301D8861707879 -:1042C00040090877B078C0F340004877287800F0BC -:1042D0000102887F62F301008877E27F62F3820047 -:1042E000887701E05C020020E27F520862F3C3009D -:1042F0008877B27862F304108877A878C87701F1DC -:10430000210228462031FEF7C7FE22E00120087175 -:10431000287800F00102087E62F3010008762A780E -:10432000520862F3820008762A78920862F3C3008A -:10433000087600E009E02A78D20862F304100876D3 -:1043400024212046FDF7A6F80BE003200871052084 -:10435000087625212046FDF79DF8A07F20F08000FB -:10436000A07701A900980AF09CFF022801D000B1B3 -:10437000FFDF384632E72DE9FF4FF94A0D4699B085 -:104380009A4607CA14AB002783E807001998FDF77F -:1043900049F8060006D03078262806D008201DB03F -:1043A000BDE8F08F43F20200F9E7B07F00F00309A7 -:1043B000B9F1010F03D0B9F1020F07D008E03DB900 -:1043C0001B98FEF725FE0028E9D101E01B9878BB79 -:1043D000B07F00F00300012806D00021199809F0F1 -:1043E0002CFB040003D101E00121F7E7FFDF852D5D -:1043F00025D007DCD5B1812D1BD0822D1BD0832D7C -:1044000008D11AE0862D1CD0882D1CD0892D1CD0F7 -:104410008A2D1CD00F2020710F281AD001208DF872 -:104420003400201D0E902079A8B158E10020F2E759 -:104430000FE00120EFE70220EDE70320EBE7052086 -:10444000E9E70620E7E70820E5E70920E3E70A2097 -:10445000E1E70720A3E7B9F1010F17D0D4E919501C -:1044600080460220019001200090A87898F8021060 -:10447000C0F3C000C1F3C00108405FEA000B5DD08B -:1044800050460DF099FA00286CD12DE0D4E9198539 -:104490000120019002200090214630461B9AFEF731 -:1044A000DBFD1B98007800F00101A87861F30100A2 -:1044B000A870F17F61F38200A870F17F490861F371 -:1044C000C300A870A17861F30410A8706078400957 -:1044D0002870A078C0F3400068701B988078E8705E -:1044E000002068712871C0E7DAF80C000DF064FA5A -:1044F000C0BBDAF81C000DF05FFA98BBDAF80C00CC -:10450000A060DAF81C00E06098F80100A17800F0E3 -:10451000010041EA4000A07098F80210C0B2C1F357 -:104520000011891E0840A070002084F82000009926 -:1045300006F1170002290BD001210AE098F80110BA -:10454000A07801F00101FD2242EA41010840E2E7C2 -:10455000002104EB810188610199701C022902D0BD -:10456000012101E028E0002104EB81018861A878A5 -:1045700000F00300012849D198F8020000F0030080 -:10458000012843D1B9F1010F04D12A1D691D1B98DF -:10459000FEF782FD297998F8040001408DF82C106F -:1045A000687998F8052010408DF8300001432DD02F -:1045B00050460DF001FA08B11020F0E60AF11000A3 -:1045C00004F5D47104F17C020490B9F1020F3CD0DF -:1045D0000090CDE9012100210BAB5A462046FEF7A1 -:1045E000D5FD0028E9D104F5D67104F19402B9F1A2 -:1045F000010F30D004980090CDE9012100210CABCF -:104600005A462046FEF7C2FD0028D6D1A078800782 -:1046100040D4A87898F80210C0F38000C1F380015C -:10462000084337D0297898F8000014AAB9F1010F8F -:1046300017D032F810204B00DA4012F0030718D0E0 -:10464000012F1ED0022F12D11DE0CDF800A0CDE920 -:1046500001210121C0E7CDF800A0CDE90121012110 -:10466000CDE732F811204300DA4002F00307032FB0 -:1046700007D0BBF1000F0DD0012906D0042904D0CA -:1046800008E00227F5E70127F3E7012801D0042815 -:1046900000D10427F07F40F001006BF34100F07778 -:1046A000A07881074FF003000CD5A071BBF1000F7B -:1046B00015D100BF8DF85C0017AA31461998FEF796 -:1046C00034FD0CE00221022F18D0012F18D0042F46 -:1046D00022D00020A071F07F20F00100F07725218A -:1046E0003046FCF7D7FE0DA904F590700AF0B9FD2D -:1046F00010B1022800D0FFDF002050E6A171D9E7F9 -:10470000A1710D2104F1240016F02DFC607840F019 -:10471000020060700420CDE70120A071DFE72DE9E1 -:10472000F04387B0914688460446FCF77BFE0700BD -:1047300006D03878272806D0082007B0BDE8F083D7 -:1047400043F20200F9E7B87F00F00300012809D026 -:104750000021204609F071F9040006D104E00000B0 -:1047600008B301000121F4E7FFDFA679012E08D08C -:10477000B8F1000F0FD048460DF01EF9B8B1102067 -:10478000DBE7B9F1000F25D1B8F1000F09D0B8F17E -:10479000010F1FD120E0022E05D0032E05D0FFDF30 -:1047A00028E00C2526E0012524E0022522E0B8F1CE -:1047B000020F03D0B8F1010F0AD00BE0032E09D18C -:1047C00000251022494604F1210016F033FB11E0C8 -:1047D000022E01D00720B0E70025102104F12100AE -:1047E00016F09FFB5FEA090004D0062106F02EFFB9 -:1047F000C4F82100607840F002006070C10713D057 -:1048000020F00100607002208DF8000004F121000A -:1048100002908DF804506946FF300AF022FD02280C -:1048200004D018B1FFDF01E084F82050252138467C -:10483000FCF730FE002080E730B587B00D46044617 -:10484000FCF7F0FD88B1807F00F0030001280FD055 -:104850000021204609F0F1F804000ED028460DF0A2 -:10486000ABF838B1102007B030BD43F20200FAE7D0 -:104870000121EEE76078400701D40820F3E72946DC -:1048800004F141002022054616F0D4FA607840F089 -:104890001000607001070FD520F008006070142030 -:1048A0008DF80000694604F5907001950AF0D9FC76 -:1048B000022801D000B1FFDF0020D4E770B594B02A -:1048C0000D460646FCF7AEFD18B10178272944D104 -:1048D00003E043F2020014B070BD807F00F00300DB -:1048E000012806D00021304609F0A7F8040003D1C2 -:1048F00001E00121F7E7FFDFA07902282DD1A078A0 -:10490000C0072AD0002302220321304603F050FCC6 -:1049100028B30D208DF80D0007A80222811FADF8E5 -:10492000142006ABCDE900310C9604F5907402908A -:10493000089400230321304603F0B7FC00B1FFDFE9 -:1049400004208DF810008DF824500DA903A80AF05A -:10495000A8FC00B1FFDF0020BDE70820BBE7112065 -:10496000B9E770B5064686B014460D4608460DF008 -:1049700023F818B920460DF043F810B1102006B006 -:1049800070BDA6F57F40FF380DD03046FCF74AFDDC -:1049900030B14378811C22461846FCF7E9FE07E057 -:1049A00043F20200EBE72046FDF7F3FC0028E6D1D6 -:1049B0001021E01D0CF0B2FCE21D29466846FEF70E -:1049C0009DFC102204F11700019916F033FA002023 -:1049D000D5E72DE9F04104468CB0154688460027FE -:1049E00008460DF034F818B928460DF030F818B123 -:1049F00010200CB0BDE8F0812046FCF713FD060046 -:104A000003D03078272818D102E043F20200F0E703 -:104A1000B07F00F00300012806D00021204609F0F5 -:104A20000CF8040003D101E00121F7E7FFDF607813 -:104A3000400702D5A078800701D40820D9E7B07FCD -:104A400000F00300012818D0D4E91901407800B122 -:104A5000B5B1487810B1B8F1000F11D0C5B1EA1D59 -:104A600006A8E168FEF74AFC102205F11700079935 -:104A700016F0B4F930B104270AE0D4E91910E5E7DB -:104A80000720B6E71022E91D04F1310016F0D2F933 -:104A9000B8F1000F06D0102208F1070104F121003F -:104AA00016F0C8F9607840F002006070C10715D0B8 -:104AB00020F00100607002208DF8000004F1210058 -:104AC0000290103003908DF804706946EF300AF0C0 -:104AD000C8FB022804D018B1FFDF01E084F8207081 -:104AE00025213046FCF7D6FC002082E7F8B51546B4 -:104AF0000E460746FCF796FC040004D020782228D6 -:104B000004D00820F8BD43F20200F8BDA07F00F0F9 -:104B10000300022802D043F20500F8BD30460CF035 -:104B20004BFF18B928460CF047FF08B11020F8BD1C -:104B300000953288B31C21463846FEF7F7FB112852 -:104B400014D00028F3D1297C4A08E17F62F30001E8 -:104B5000E1772A7C62F34101E177297C890884F8B6 -:104B60002010A17F21F08001A177F8BDA17F090766 -:104B7000FBD4D6F80200C4F83600D6F80600C4F814 -:104B80003A003088A0861022294604F1230016F04E -:104B900051F9287C4108E07F61F38200E077297CAD -:104BA00061F3C300E077287C800884F82100A07FAF -:104BB00040F00800A0770020D3E770B594B00D4610 -:104BC00006460BB1072086E6FCF72CFC040007D054 -:104BD0002078222802D3A07F400604D408207AE659 -:104BE00043F2020077E6C5B12D208DF80000ADF844 -:104BF00002601022294601A816F01CF9287C410801 -:104C0000E07F61F30000E077297C61F34100E07709 -:104C1000287C800884F8200004E02E208DF8000015 -:104C2000ADF8026009A9684606F0C3FCA17F21F037 -:104C30004001A1774FE670B50D46FCF7F3FB040089 -:104C400005D028460CF0DCFE20B1102070BD43F2E8 -:104C5000020070BD29462046FEF707FB002070BD0C -:104C600005E000BF10F8012B0AB100207047491E73 -:104C700089B2F7D20120704770B50D4600780499CB -:104C80001446042803D0052832D0FFDF70BDA88B5E -:104C90000E2200EB400002EB400018803320088019 -:104CA000002CF3D0A88BA081002613E0A87F012858 -:104CB00014D006EBC60005EB400106EB460204EB00 -:104CC0004202088CD0811020223110320AF08AFB77 -:104CD000761CB6B2A089B042E8D870BD05EB86015B -:104CE00006EB460204EB4202088CD0810220EBE77F -:104CF000A88B102200EBC00002EB4000188034208B -:104D00000880A87F012808D0022806D0FFDF002CE9 -:104D1000E3D0A88BA081002613E0A073F7E7A87F5B -:104D2000012812D006EBC60005EB400104EB400061 -:104D30000A8C028210221230223116F07BF8761C87 -:104D4000B6B2A089B042EAD870BD05EB860106EB89 -:104D5000C602088C04EB4202223110820220123279 -:104D60000AF040FBEBE72DE9F04105780E20DDF875 -:104D700018C001F1200402F10E074FF00008022DC7 -:104D800006D0032D2DD0062D6AD0FFDFBDE8F081BF -:104D9000CD8B05EB850600EB460018803120ACF882 -:104DA0000000002AF2D0087F9581801FC6B214E06F -:104DB00061682088388031F8020BF88031F8020BE6 -:104DC0003881BA1C30460AF00DFB06B118B187F8DD -:104DD0000480A7F8028008340A376D1EADB2E7D20E -:104DE000D4E7CD8B05EB850600EB4600188032201A -:104DF000ACF80000002AC9D0087F9581401FC6B2D8 -:104E00002AE06168228811F8010BFA803A79430898 -:104E100060F3000263F34102830863F38202C30874 -:104E200063F3C302030963F30412430963F34512F6 -:104E3000830963F386123A71C009787131F8020B65 -:104E400038813A4630460AF0CDFA18B187F8028028 -:104E5000A7F8008008340A376D1EADB2D1D295E7AD -:104E6000087FCD8B801E86B206F1080068431030A3 -:104E700018803520ACF80000002A87D0958102F117 -:104E80001007D68107EBC5080BE020883880C7F8EB -:104E9000048032464046616815F0CCFF0834B044C7 -:104EA00008376D1EADB2F0D270E72DE9F0471D4610 -:104EB000089E0C4681462AB1607E00F58070D08045 -:104EC000E08B108199F800000E274FF000084FF09A -:104ED000100A0C287ED2DFE800F096061521293151 -:104EE0003F4E636B6B6B207F9146082802D00328EE -:104EF00000D0FFDF2F8030200BE000BFA9F80C802E -:104F0000BDE8F087207F9146042800D0FFDF2F8086 -:104F100031203080B9F1000FF0D1F1E7207F9146C8 -:104F2000042800D0FFDF2F803220F2E7207F914657 -:104F3000022800D0FFDF2F803320EAE7207F1746CA -:104F4000022800D0FFDF3420A5F800A03080002F19 -:104F5000D6D0A7F80C80D3E7207F1746042800D0CE -:104F6000FFDF3520A5F800A03080002FC8D04046D4 -:104F7000A7F80C8012E0207F1746052802D00628EB -:104F800000D0FFDF1220288036203080002FB7D0DD -:104F9000E08BB881A7F81080B9F80200F881AFE77C -:104FA000207F9146072800D0FFDF2F803720B0E711 -:104FB0004FF0140018804FF03800170030809FD059 -:104FC000E08BB881A7F8128099F80000092807D073 -:104FD0000A2800E017E009D00B280DD0FFDF8FE78B -:104FE000207F0C2800D0FFDF01200AE0207F0D2861 -:104FF00000D0FFDF042004E0207F0E2800D0FFDF78 -:105000000520B8737CE7FFDF7AE770B50C460546EC -:10501000FCF708FA20B10078222804D2082070BDDD -:1050200043F2020070BD0521284608F006FD20600D -:1050300008B1002070BD032070BDFFB585B00746E4 -:105040001720ADF80C00089814460D46022628B922 -:1050500008A93846FFF7D9FF00283ED15DB10023EB -:10506000BDF80C203146384603F0A2F8B8B30898D2 -:105070000078A0BB05E02078092822D00F282FD087 -:10508000FFDF002004A9CDE9001003460290BDF81F -:105090000C203146384603F008F900281DD1089845 -:1050A00003A9801DC4E901072046049A04F017FBF8 -:1050B00060B3072828D2DFE800F01E1C2727252030 -:1050C000220007260023BDF80C203146384603F0A5 -:1050D0006FF80028D5D143F2040009B0F0BD08E014 -:1050E0000023BDF80C203146384603F061F8002853 -:1050F000C7D11120F1E70020EFE70820EDE743F2E8 -:105100000300EAE70720E8E70320E6E704980090B9 -:10511000BDF80C3004223146384603F048FA002826 -:10512000DBD1002DD9D008990D70D6E710B588B025 -:105130001C46AAB104238DF800301388ADF80C305A -:105140005288ADF80E208A788DF812200988ADF8C3 -:10515000101000236A462146FFF76FFF08B010BD0C -:105160001020FBE72DE9F041074600780C46122895 -:1051700039D2DFE800F0383434141036090909094F -:10518000090909090909090904B9FFDF607840F034 -:105190000800607028E0002CF8D1FFDFF6E7B8883F -:1051A000052186B2304608F048FC054604B1FFDF11 -:1051B00005B9FFDF3146A81D04F08AFA02F0EEFAC5 -:1051C000040007D0607840F008006070668002F04C -:1051D000C3FA0AE013213046FDF704FB16E0FFDFB7 -:1051E00002E0FFDF00E0FFDF84B1607800070DD54B -:1051F0002078582220F00F00C01C20F0F0009030E2 -:105200002070394604F1180015F059FE0020BDE564 -:1052100000200870881D04F058BA0A460146901D07 -:1052200004F05CBA70B50546052108F006FC0400E0 -:1052300000D1FFDF2946A01DBDE8704004F048BA48 -:105240002DE9FE4F4FF00009ADF80890ADF804903D -:1052500047880C46054693460521384608F0EDFB85 -:10526000060000D1FFDF24B1A780A4F80690A4F8BF -:105270000890297E04F112003827C91E4FF001085A -:105280004FF0360A00900F2970D2DFE801F0F9FAEA -:105290006F6108AD6A70812CB6C9E59595003078CC -:1052A000012800D0FFDFA88B0E2101EBC001ADF873 -:1052B00004103021ADF80810002C13D0A08100207C -:1052C0000DE004EBC00132790A747288CA8105EBE3 -:1052D0008002401CD38B4B82128C8A8280B2A189BF -:1052E0008142EED8E8E03078012800D0FFDFE88B7B -:1052F0000E2101EBC001ADF804103021ADF808100B -:10530000297F091FC9B20091002CEBD0A081002792 -:105310001AE000BF05EBC70A04EBC70808F10E024C -:10532000DAF8241000980AF05DF818B188F81090A7 -:10533000A8F80E90BAF82010A8F81210BAF82210A7 -:105340007F1CA8F81410BFB2A089B842E2D8B3E01D -:1053500002A8009001AB224629463046FFF78CFC9C -:10536000AAE03078072806D0FFDF04E0A3E0307819 -:10537000072800D0FFDFE88BADF808A01230ADF8A9 -:105380000400002C38D0A98BA1817188E18123E031 -:105390003078082800D0FFDFA88B00F10E01ADF8AF -:1053A00004103721ADF80810002C25D0A081AA8B5D -:1053B00004F10E00296A4CE0E88B123080B23921EA -:1053C000ADF80400ADF80810F4B3A98BA181287ED4 -:1053D000102807D00221A173E98B2182EA8B296A68 -:1053E000009836E00121F6E702A8009001AB2246C2 -:1053F00029463046FFF7B7FC5EE03078092800D038 -:10540000FFDF1420ADF80400ADF808701CB3A98BC1 -:10541000A181A4F81290A4F8109084F80E804BE0BB -:1054200030780A2800D0FFDF288CADF808701430DF -:10543000ADF804007CB10421A173A98BA181E98B93 -:105440002182298C618200E032E02A8C04F1140070 -:10545000696A15F0EFFC2FE030780B2800D0FFDFF1 -:105460001420ADF80400ADF8087004B30521A17351 -:10547000A4F80C90A4F81090A4F812901CE000E09E -:1054800008E002A8009001AB224629463046FFF70B -:105490000CFD11E00D203A21ADF80400ADF8081024 -:1054A00034B1A4F80680A4F8089084F80C9003E0C6 -:1054B000ABF8000014E0FFDFBDF80400ABF800001B -:1054C00074B1BDF808002080BDF804006080287E1B -:1054D000032805D0102803D0112801D086F80090A9 -:1054E0000020BDE8FE8F2DE9F84356880F46804620 -:1054F00015460521304608F0A0FA040000D1FFDF70 -:10550000A41D33462A4639464046009404F064FA06 -:10551000BDE8F8832DE9F0438DB00D461446814671 -:1055200007A9FFF772FD002814D14FF6FF76012777 -:105530004FF420588CB103208DF800001020ADF8F6 -:10554000140008A802460690204605A909F069FF44 -:1055500078B107200DB0BDE8F0830820ADF80C50FD -:105560008DF812708DF80000ADF80E60ADF8108067 -:105570000CE00798A1780171218841808DF81270A4 -:10558000ADF80C50ADF81080ADF80E606A46012100 -:105590004846079BFFF751FDDCE708B501228DF86F -:1055A000022042F60202ADF800200A4602236946B4 -:1055B000FFF7BCFD08BD08B501228DF8022042F6B8 -:1055C0000302ADF800200A4603236946FFF7AEFD4B -:1055D00008BD00B587B079B102228DF800200A8895 -:1055E000ADF80C204988ADF80E1000236A4604215E -:1055F000FFF723FD07B000BD1020FBE709B106232C -:1056000094E50720704770B588B00D4614460646ED -:1056100007A9FFF7FAFC00280ED17CB10620ADF8EF -:105620000C508DF80000ADF80E40079B6A4607212C -:105630005C803046FFF701FD08B070BD05208DF895 -:105640000000ADF80C50F0E700B587B059B1072362 -:105650008DF80030ADF80C20049100236A46082133 -:10566000FFF7EBFCC6E71020C4E770B5002488B054 -:10567000172391B10A78062A20D2DFE802F01F042E -:10568000041503171523DB1E9DB2CB880BB18E6862 -:105690001EB1AB4203D90C20CEE71020CCE7042A80 -:1056A00004D08B8853B901E00620C5E7012A13D046 -:1056B000022A05D0042A1CD0052A2AD00720BBE7DD -:1056C00009228DF800204A88ADF80C20CA88ADF870 -:1056D0000E208968049123E00C228DF800204A886E -:1056E000ADF80C20CA88ADF80E2089680924049111 -:1056F00016E00D228DF800204A88ADF80C208A882B -:10570000ADF80E20CA88ADF8102089680A240591EA -:1057100006E00E228DF8002049788DF80C100B243D -:1057200000236A462146FFF788FC85E700B587B06D -:105730000F228DF80020ADF80C1000236A461946A0 -:10574000FFF77BFC56E700B587B071B102228DF8F8 -:1057500000200A88ADF80C204988ADF80E1000230F -:105760006A460521FFF769FC44E7102042E7000084 -:1057700018B1817801293CD101E0102070470188DF -:1057800042F60213C81A4FF48072994233D01CDCDF -:1057900042F60103A1EB030099422CD00CDCF9B1D5 -:1057A000B1F5C05F27D06FF4C050081823D0A0F522 -:1057B0007060FF381DD11EE001281CD002281AD0CD -:1057C000FF2818D0904214D115E0904213D008DC85 -:1057D000012810D002280ED0FE280CD0FF2808D1B6 -:1057E00009E0A0F58070013805D0012803D0022817 -:1057F00001D0002070470F2070470B2826D008DC0E -:105800001BD2DFE800F01C2025251A252923252797 -:105810001E0011281CD008DC0C2817D00D281DD024 -:105820000F2815D0102808D110E0822809D084282C -:1058300010D0852810D0872812D003207047002070 -:1058400070470520704743F20300704707207047F8 -:105850000F20704704207047062070470C207047C7 -:105860004FF45050704707280DD2DFE800F00406CF -:10587000040C0C080A000020704711207047072014 -:1058800070470820704703207047007810F00F021F -:1058900004D0012A05D0022A0CD110E0000909D158 -:1058A0000AE00009012807D0022805D0032803D008 -:1058B000042801D007207047087000207047062098 -:1058C000704705282AD2DFE800F003070F171F00F2 -:1058D000087820F0FF001EE0087820F00F00401C40 -:1058E00020F0F000103016E0087820F00F00401C87 -:1058F00020F0F00020300EE0087820F00F00401C6F -:1059000020F0F000303006E0087820F00F00401C56 -:1059100020F0F000403008700020704707207047EA -:1059200038B50C46050041D06946FFF7AEFF0028A8 -:1059300019D19DF80010607861F30200607069462B -:10594000681CFFF7A2FF00280DD19DF800106078B9 -:1059500061F3C5006070A978C1F34101012903D04A -:10596000022905D0072038BD217821F0200102E06E -:10597000217841F020012170410704D0A978C9089D -:1059800061F386106070607810F0380F07D0A97846 -:10599000090961F3C710607010F0380F02D1607808 -:1059A000400603D5207840F040002070002038BD2C -:1059B00070B504460020088015466068FFF7B0FF08 -:1059C000002816D12089A189884211D86068807882 -:1059D000C0070AD0B1F5007F0AD840F20120B1FB20 -:1059E000F0F200FB1210288007E0B1F5FF7F01D92B -:1059F0000C2070BD01F201212980002070BD10B57E -:105A00000478137864F3000313700478640864F373 -:105A1000410313700478A40864F3820313700478BC -:105A2000E40864F3C30313700478240964F30413D3 -:105A300013700478640964F34513137000788009C7 -:105A400060F38613137031B10878C10701D1800764 -:105A500001D5012000E0002060F3C713137010BDD2 -:105A60004278530702D002F0070306E012F0380F25 -:105A700002D0C2F3C20300E001234A7863F30202BA -:105A80004A70407810F0380F02D0C0F3C20005E031 -:105A9000430702D000F0070000E0012060F3C502D8 -:105AA0004A7070472DE9F04792B00D00804613D040 -:105AB000B8F1000F14D01221284615F032FA03AACB -:105AC000FF21012005F0D3FB0024264637464FF482 -:105AD00020596FF4205A6DE0102012B0BDE8F08715 -:105AE0000720FAE79DF8160001280AD1BDF8140036 -:105AF00048450BD010EB0A000AD001280CD0022830 -:105B00000CD0042C0ED0052C0FD10DE0012400E0A8 -:105B10000224BDF8126008E0032406E00424BDF866 -:105B2000127002E0052400E00624BDF81210414581 -:105B300040D12C7486B34FF007090DF134080EAA3A -:105B4000CDF80090CDE9012810230022FF21304636 -:105B500005F029FCF0B9BDF834002A46C0B20EA900 -:105B600009F040FCB0B9AE81B7B108AECDF80090F5 -:105B7000CDE9016813230022FF21384605F013FC0C -:105B800040B9BDF83400F11CC01EC0B22A1D09F096 -:105B900029FC10B10320A0E70AE0BDF82100E8814C -:105BA000062C05D19DF81600A872BDF814002881B6 -:105BB000002092E703A805F062FB002892D0FFF7CF -:105BC0001CFE8AE72DE9F0438BB00E46DDE9129802 -:105BD00005461C461746142103A815F0C4F90120F8 -:105BE0008DF810008DF80C008DF81180ADF8147050 -:105BF00064B1A178C90709D08DF81600E088ADF826 -:105C00001A00A088ADF81800A068079001F0C6FD42 -:105C1000040025D06580002009A9CDE900101722D5 -:105C2000034601460290ADF82020284602F03DFBD5 -:105C3000002812D108368DE8700008AA494603A84A -:105C4000099B04F042FE06466078000701D501F08A -:105C500083FD5EB13046FFF706FE0BB0BDE8F08372 -:105C600013212846FCF7BEFD0320F6E709980090B3 -:105C7000BDF8203004220021284602F098FCECE711 -:105C800070B506468AB000200D46059007240490A2 -:105C9000069003A900940790CDE901010246102364 -:105CA0002946304605F07FFB68B904A9009108A891 -:105CB000CDE90140BDF80C3000222946304605F000 -:105CC00081F9002801D0FFF798FD0AB070BD05F0FA -:105CD0003CB82DE9FC470546002700780C46B8463D -:105CE000B9460C2873D2DFE800F0B8060D2FCE5F5E -:105CF0005F7F96B49AA504B1FFDF288980B201F0D6 -:105D0000BFFEABE0A888042180B2814607F095FE73 -:105D1000064604B1FFDF06B9FFDF494606F1080079 -:105D200004F03CFA01F03AFD040008D0607840F03D -:105D300008006070A4F8029001F00EFD8FE01321BE -:105D40004846FCF74FFD9EE004B9FFDF6088042160 -:105D500007F073FE060000D1FFDFA6F800900020D8 -:105D600029791EE005EBC0029268D3B25FEA037C9A -:105D700007D5DB0605D505EBC10030F8020C3080F5 -:105D800007E0120A52060AD5307105EBC000C08840 -:105D900070806078022740F0080060705EE0401C70 -:105DA000C0B28142DED859E0E888ADF8000004B9FD -:105DB000FFDF9DF80100000604D52878062807D0EB -:105DC00005282AD0607840F00800607046E044E082 -:105DD0006088042107F031FE060000D1FFDF86F85D -:105DE0000490A888708018E004B9FFDF608804215F -:105DF00007F023FE060000D1FFDF06F1080004F0E3 -:105E0000F8FF90F0010F02D1E879000626D56088EE -:105E10000227F080D6E704B9FFDF0227D2E704B9F2 -:105E2000FFDF022761880122204601F06DFE4FF05E -:105E30000108C7E7A88986B204B1FFDF686800904F -:105E40002889ADF8040001226946304601F077FE4A -:105E500004E0002CB6D1FFDFB4E7FFDF9CB160782F -:105E6000000710D5B8F1000F0DD12078582220F08E -:105E70000F00001D20F0F00080302070294604F152 -:105E8000180015F01CF83846BDE8FC873EB50C003C -:105E900008D06B4601AA002105F0F2FA20B1FFF705 -:105EA000ACFC3EBD10203EBD00202080A0709DF8BF -:105EB000050002A900F00700FFF703FD50B99DF8A7 -:105EC000080020709DF8050002A9C0F3C200FFF78A -:105ED000F8FC08B103203EBD9DF8080060709DF8F5 -:105EE0000500C109A07861F30410A0709DF80510A9 -:105EF000890961F3C300A0709DF80410890601D5DB -:105F0000022100E0012161F342009DF8001061F3DD -:105F10000000A07000203EBD70B5144606460D4638 -:105F200051EA040005D075B108460BF087FD78B939 -:105F300001E0072070BD2946304605F0FCFA10B19B -:105F4000BDE8704059E454B120460BF077FD08B12C -:105F5000102070BD21463046BDE8704096E7002015 -:105F600070BD2DE9FE4F05460C46007E0A310091BA -:105F700004F108010027029190460C31821E3E4632 -:105F8000BB464FF0010A0191082A7CD2DFE802F0FB -:105F9000F7047B32327EBCF86888042107F04DFD9F -:105FA0005FEA000900D1FFDFB9F8000010B1522705 -:105FB0000726ECE051271026002C7CD06888A080B2 -:105FC00084F806A099F80400002205EBC0000099AF -:105FD000C08BFFF7A1FF00286ED199F8040005EBF4 -:105FE000C000C08B208199F8040005EBC000408CF4 -:105FF000E081E6E0B5F82290062822D1E87F00068D -:106000001FD5512709F1140086B2002CD5D0A88BDA -:1060100000220099FFF780FF002873D16888A080D4 -:106020000220A071A88B208184F80EA0288C2082E9 -:10603000A4F812904A46696ADDF8040014F0FAFEEA -:10604000BFE0502709F1120086B2002C33D0A88B94 -:1060500000220299FFF760FF002853D16888A080D2 -:10606000A88BE080287E06280ED002202073288C82 -:10607000E081E87F4A46C0096073A4F8109004F1FB -:106080001200696ADAE79BE00120EFE768880421E3 -:1060900007F0D3FCB5F822A05FEA000900D1FFDFCA -:1060A00009F1080004F0A5FE90F0010F02D1E87F8D -:1060B000000626D501E076E024E00AF1140051271D -:1060C00086B2002C70D06888A080A88B002200992E -:1060D000FFF722FF002815D10220A071A88B208194 -:1060E0000420A073288C2082A4F812A05246696A6A -:1060F000019814F09FFE89F804B0A98BA9F802104A -:106100005FE00320BDE8FE8F6888FBF78BF98246CD -:106110006888042107F091FC8146BAF1000F00D194 -:10612000FFDFB9F1000F00D1FFDFB9F80600A0F5DD -:106130007F41FF3902D05127142601E05027122653 -:106140008CB36888A080502F06D00220A071287FD1 -:10615000029901F016F934E0287FA11D01F011F930 -:106160009AF82210CDE9001BB9F8022068880023B4 -:106170004946FFF727FD0028C4D122E000E016E0E1 -:10618000FE49A88BC988814205D15427062654B1FF -:106190006888A08015E05327082624B16888A0806D -:1061A000A88BE0800DE0FFE7A8F800600EE055271F -:1061B0000726002CF8D0A88BA08084F806B000E059 -:1061C000FFDFA8F800600CB127806680002099E707 -:1061D000EA4900200870704730B587B00C4607F0D8 -:1061E000F5FB0546FF2800D1FFDF0020208020714D -:1061F00060804FF6FF70E080294604F1080003F04C -:10620000BFFF02AA2946012005F031F81AE000BFBD -:106210009DF80B00000715D5BDF80E002946FFF7C5 -:106220002FFD9DF80B00FF2340F010008DF80B00B0 -:10623000BDF80B00ADF80400BDF80E002946019A28 -:1062400005F047F902A805F01AF80028E0D007B0D9 -:1062500030BD0A46014602F1080003F0A5BF70B543 -:106260000546042107F0E9FB040000D1FFDF2946C1 -:1062700004F10800BDE8704003F090BF2DE9F04143 -:106280008AB00D468046FBF7CDF8060006D0307880 -:10629000222806D208200AB0BDE8F08143F20200AD -:1062A000F9E70421404607F0C8FB07460DB1A8886E -:1062B00078B101208DF8140002208DF81800002418 -:1062C0008DF819403DB1A888ADF8200028680790E6 -:1062D00004E00920DFE7ADF82040079401F05EFA02 -:1062E000050026D0A5F8028004A8CDE900041722F5 -:1062F0000023ADF80C2019464046029401F0D5FF6A -:106300000028C8D107F108000095CDE9018096F872 -:10631000221003AA05A8049B04F0D7FA0446687863 -:10632000000701D501F018FA4CB12046FFF79BFA9F -:10633000B1E713214046FCF755FA0320ABE7049878 -:106340000090BDF80C3004220021404602F02FF9E5 -:106350004FF6FF71F9809EE72DE9FF5F83460E9EA1 -:106360009846914677888A463846FBF75BF805469B -:106370000421384607F061FB044605B9FFDF04B984 -:10638000FFDF0834CDE90274CDE9008695F82210CC -:106390004B465246584603F037FF04B0BDE8F09F25 -:1063A0002DE9F04F99B004464FF000087348ADF85E -:1063B0004C80ADF82480ADF84880A0F80480ADF89A -:1063C0000C80ADF81080ADF81880ADF8148000781E -:1063D00016460D464746012809D0022807D0032853 -:1063E00005D0042803D0082019B0BDE8F08F20465E -:1063F0000BF0E2FAD0BB28460BF0DEFAB0BB6068C7 -:106400000BF025FB90BB606848B160892189884208 -:1064100002D8B1F5007F01D90C20E5E7804608AA33 -:1064200004A92846FFF7C4FA0028DDD168688078FF -:10643000C0F34100022808D19DF8110010F0380F78 -:1064400003D028690BF0FAFA80B903A92069FFF795 -:1064500067FA0028C8D1206950B1607880079DF89C -:106460000D0000F0380002D5E8B301E011E0D0BB28 -:106470009DF80C0080060ED59DF80D0010F0380F29 -:1064800003D060680BF0DAFA18B960680BF0DFFA35 -:1064900008B11020A8E705A96069FFF741FA0028B4 -:1064A000A2D1606940B19DF8150000F007010129F3 -:1064B0003BD110F0380F38D006A9A069FFF730FAA9 -:1064C000002891D19DF8140080062ED49DF8180064 -:1064D00080062AD4A06950B19DF8190000F0070188 -:1064E000012922D100E020E010F0380F1DD0E06833 -:1064F00018B10078C8B11C2817D20CAA611C20461C -:10650000FFF77DFA0120B94660F30F27BA46074628 -:106510008DF8460042F60300ADF844000DF1330259 -:1065200015A9286808F07DFF08B107205CE79DF8F1 -:10653000540014A9CDF80090C01CCDE9019100F0E1 -:10654000FF0B00230BF20122514611A804F0D7FDE6 -:10655000E8BBBDF850000B9008492A892869091D3D -:106560000092CDE901016B89BDF8202028680499CB -:1065700004F0C5FD01007CD1207801E05803002023 -:10658000C1064FF0020A01D480062BD5ADF81C904D -:10659000606950B905A904A8FFF762FA9DF81500D3 -:1065A00020F00700401C8DF815009DF814008DF8B0 -:1065B000467040F0C8008DF8140042F60210ADF8A5 -:1065C000440009A907AA0023CDF800A000E01CE0C0 -:1065D000CDE9012140F2032211A8059904F08FFDB5 -:1065E000010046D1F8484D464FF007098088ADF8C4 -:1065F00031000CA9CDE900195B4600220295FF216C -:10660000BDF8500004F0DEFC10B1FFF7F6F8EBE641 -:106610009DF83000000625D52946012060F30F21A2 -:106620008DF846704FF42450ADF84400ADF8285072 -:1066300062789DF82800002362F300008DF828009E -:106640006278520862F341008DF828000AAACDF85A -:1066500000A0CDE9012540F2032211A804F04FFD6E -:10666000010006D1606850B3206970B903A904A87D -:1066700000E07DE0FFF7F4F96078800705D49DF82D -:106680000D0020F038008DF80D008DF8467042F6B0 -:106690000110ADF84400208940F20121B0FBF1F275 -:1066A00001FB1202606812ABCDF80080CDE9010356 -:1066B000002311A8039904F022FD010058D120788D -:1066C000C00729D0ADF81C50A06950B906A904A88C -:1066D000FFF7C6F99DF8190020F00700401C8DF85F -:1066E00019009DF818008DF8467040F040008DF8B4 -:1066F000180042F60310ADF8440013A907AACDF81C -:1067000000A0CDE90121002340F2032211A806993F -:1067100004F0F5FC01002BD1E06868B329460120A4 -:1067200060F30F218DF8467042F60410ADF8440076 -:10673000E068002302788DF8582040788DF85900E1 -:10674000E06816AA4088ADF85A00E06800798DF834 -:106750005C00E068C088ADF85D00CDF80090CDE940 -:1067600001254FF4027211A804F0C9FC010003D006 -:106770000B9800F019FE37E693480321017056B1DB -:1067800080883080BDF848007080BDF82400B0805B -:10679000BDF84C00F080002026E670B501258AB0D7 -:1067A00016460B46012802D0022816D104E08DF8C7 -:1067B0000E504FF4205003E08DF80E5042F60100C9 -:1067C000ADF80C0063B10024601C60F30F2404AA30 -:1067D00008A9184608F025FE20B107200AB070BDB0 -:1067E0001020FBE704A99DF820207748CDE900217F -:1067F000801C02900023214603A802F2012204F02B -:106800007EFC10B1FEF7F9FFE8E76F480EB1418852 -:10681000318005700020E1E770B594B00446012690 -:106820008DF83E6041F60100ADF83C0012AA0FA9B8 -:106830003046FFF7B2FF002848D12078624CC007ED -:106840004FF0000544D01C2102A814F08CFB9DF8E9 -:1068500008008DF83E6040F020008DF8080042F6F8 -:106860000520ADF83C000E959DF83A00119520F0FA -:106870000600801C8DF83A009DF838006A4620F02A -:10688000FF008DF838009DF8390009A920F0FF00BD -:106890008DF839000420ADF82C00ADF830000EA8BA -:1068A0000A9011A80D900FA80990ADF82E5002A8DB -:1068B000FFF776FD002809D1BDF80000E080BDF8A3 -:1068C00004002081401C60812570002014B070BD40 -:1068D000E5802581BDF84800F4E72DE9F74F8B46A8 -:1068E000394900269EB00A78012A04D0022A02D033 -:1068F000082021B079E54A88824201D00620F8E7D5 -:1069000089465A4501D10720F3E701214FF00008DD -:106910008DF86610ADF8401042464FF6FF71531CDB -:1069200063F30F220492ADF84210ADF84A10FF2035 -:1069300042F6020A8DF86A801AAA8DF84800ADF86E -:1069400064A0ADF868801192CDF84C8010A804F0D6 -:10695000BDFC0024254627460BAA072110A804F0F9 -:10696000B8FC78B1822857D184B37DB3ADF85C40D0 -:106970009DF85600ADF85E508DF80C8017AC0128DC -:106980005ED065E09DF832000FB3012853D1BDF809 -:10699000301051451DD116AA07A907208DE8070020 -:1069A000BDF82E0010230022FF2104F0FCFC98BB50 -:1069B000BDF85800042801D0062847D1BDF81C10A6 -:1069C000594538D10F2094E75803002036E00128BC -:1069D00031D1BDF83000B0F5205F03D042F601019F -:1069E000884228D1B9F80210BDF82E00814201D1A9 -:1069F000012700E0002704B17DB158451BD116AB3B -:106A000007AA07218DE80E00044610230022FF216B -:106A100004F0C9FC00B902E02DE035460BE0BDF8FA -:106A20005800022801D0102810D1C0B215AA07A919 -:106A300008F0D8FC50B9BDF82E608DE7052058E766 -:106A400003A915A8221D08F0ECFC08B1032050E7AB -:106A50009DF80C000023001DC2B220988DF80C2078 -:106A60000092CDE9014019A8049904F048FB10B93F -:106A7000022289F80020FEF7C0FE3AE710B50B4667 -:106A8000401E86B084B203AA00211846FEF7B7FF65 -:106A900004AA072103A88DE8070001230022FF2193 -:106AA000204604F08FFA0446BDF81000012800D0FB -:106AB000FFDF2046FEF7A1FE06B010BDF0B5FC4F8B -:106AC000044687B038780E46032804D0042802D044 -:106AD000082007B0F0BD04AA03A92046FEF768FF0E -:106AE0000500F6D160688078C0F3410002280AD121 -:106AF0009DF80D0010F0380F05D020690AF09EFFB8 -:106B000008B11020E5E7208905AA21698DE8070072 -:106B10006389BDF810202068039904F0F0FA10B1E1 -:106B2000FEF76BFED5E716B1BDF8140030800420E7 -:106B300038702846CDE738B50C00054609D000234B -:106B40006A46FF2104F09CFC28B100BFFEF755FE09 -:106B500038BD102038BD69462046FEF7E1FE00280A -:106B6000F8D1A078FF2100F001032846009A04F034 -:106B7000B0FCEBE77FB5144603AA07250292CDE9E6 -:106B800000350A462388FF2104F01CFABDF80C10DA -:106B90002180FEF732FE04B070BD2DE9F04192B0C5 -:106BA0004FF000050C000746ADF8105019D0E06812 -:106BB00028B1A068A8B10188ADF81010058038464A -:106BC000FAF730FC88B1007822286AD3384606F0FC -:106BD000FDFE80460421384606F02FFF060008D14E -:106BE00006E0102012B0BDE8F08143F20200F9E7A0 -:106BF000FFDFA078012803D0022801D00720F1E7A9 -:106C0000208838B1401C80B206AA414604F02FFB10 -:106C100038BB02E043F20300E4E706A804F02FFBD0 -:106C20009DF822204FF45051012A09D1BDF82020AF -:106C3000A2F52453023B03D1822801D088B901E098 -:106C40000846CFE7E06898B1072204A9CDE9000221 -:106C50000291A2882088BDF81030FF2104F0B2F91B -:106C600010B1FEF7CAFDBDE7A168BDF810000880AD -:106C70009DF81B00C00602D543F20140B2E70A9816 -:106C800018B1BDF82400022801D00320AAE717227A -:106C90000A98ADF80C20A1780078012903D080076C -:106CA00010D408209EE7C007FBD0002307213846F8 -:106CB00001F07EFA18B14FF00708022005E043F218 -:106CC00004008FE74FF0010803208DF83000208882 -:106CD000ADF834000BA8CDE9000500230295BDF8FE -:106CE0000C204146384601F0E0FA002887D1CDE972 -:106CF00000570836029603AA07210CA80B9B03F045 -:106D0000E4FD10B1FEF7AFFD6CE70B980090BDF805 -:106D10000C3004224146384601F049FC62E770B568 -:106D2000064615460C460846FEF722FD002805D10A -:106D30002A4621463046BDE870402EE570BDCCE5C0 -:106D400070B51E4614460D0009D044B1616831B1DA -:106D500038B157494988814203D0072070BD1020BF -:106D600070BD2068FEF704FD0028F9D132462146A7 -:106D70002846BDE87040FFF713BB70B515460C0000 -:106D800006D038B14A498988814203D0072070BDB6 -:106D9000102070BD2068FEF7EBFC0028F9D12946D1 -:106DA0002046BDE8704089E670B5054686B00E46BF -:106DB000144610460AF024FEF0BB60680AF047FE55 -:106DC000D0BBA5F57F40FF3803D02846FAF72AFB51 -:106DD000A0B1284606F0FAFD054630466946FEF7A2 -:106DE00061FE00280CD19DF810100F20082936D222 -:106DF000DFE801F008060606060A0A0843F2020068 -:106E000006B070BD0320FBE79DF80210012908D1F0 -:106E1000BDF80010B1F5C05FF2D06FF4C052D1429E -:106E2000EED09DF80610012905D1BDF80410A1F59A -:106E300028510529E4D900E022E09DF80A10012933 -:106E40000ED1BDF80810B1F5245FD9D0A1F52451B9 -:106E50000239D5D00129D3D0022901D1D0E7FFDFF3 -:106E6000606878B9002305AA2946304604F008FB7B -:106E700010B1FEF7C2FCC3E79DF81400800601D4F0 -:106E80001020BDE76188224630466368FFF772FE36 -:106E9000B6E72DE9F043074685B08946144610460B -:106EA0000AF0AEFD30B1102005B0BDE8F08300005F -:106EB00058030020384606F089FD4FF6FF76054658 -:106EC000B74201D0FF2D0AD00146002304AA48464C -:106ED00004F0D6FA30B100BFFEF78FFCE4E743F2CE -:106EE0000200E1E79DF81000C00602D543F2014020 -:106EF000DAE74FF0070803A90027CDF80080CDE9B5 -:106F00000171628833462946484604F04CFA06006F -:106F100012D160680AF074FD58B96068CDF800803D -:106F2000CDE90107238862882946484604F03BFAE8 -:106F30000646BDF80C0020803046CDE739B1FD4B48 -:106F40000A881B899A4202D843F20300704724E65C -:106F500010B586B0F74C0423ADF81430E3883BB18C -:106F600024898C4201D2914204D943F20300A3E563 -:106F70000620A1E5ADF81010002100910191ADF8B7 -:106F8000003002218DF8021005A9029104A9039195 -:106F9000ADF812206946FFF700FE8DE52DE9FC47AC -:106FA00081460F4608460AF007FDD0BB4846FAF76F -:106FB00039FA5FEA000811D098F80000222832D38D -:106FC000002317221946484601F0F2F850B1042177 -:106FD000484606F032FD060007D105E043F2020004 -:106FE000BDE8FC871120FBE7FFDF06F1080003F096 -:106FF000F1F805463878012803D0022804D007208C -:10700000EEE7A8070FD502E015F0340F0BD0B879E2 -:107010003C1DC00709D0E08838B1A0680AF0CCFC5C -:1070200018B11020DCE70820DAE73A782088002140 -:1070300028B3A0F201130721112B18D20CD2DFE8DC -:1070400003F00B090D0B1D0B121D100B0B1D1D1D4D -:107050001D0B1D00022A11D10846C1E7012AFBD0F1 -:107060000CE0EA0600E0AA06002AF5DA06E0A0F540 -:10707000C0721F2A02D97D3A022AEDD8C1B298F80F -:107080002200CDE900017288234631464846FEF7CA -:1070900099FDA5E72DE9FF4F89B01E4615460C4620 -:1070A0004FF000080F460998FAF7BCF930B10078A4 -:1070B000222806D208200DB0BDE8F08F43F202006E -:1070C000F9E7B00801D00720F5E7032E00D100262C -:1070D000099806F07BFC83464FF6FF7ACCB1022D6F -:1070E0006AD320460AF0B3FC30B904EB0509A9F1D4 -:1070F00001000AF0ACFC08B11020DCE7AD1EAAB21A -:107100002146504604F0CCFA39F8021C884253D18B -:10711000ADB28848B10702D50189491C00E00121C0 -:107120001FFA81F9F10701D0068900E0564603AA4B -:107130005946484604F09BF84FF0070A0BE0788860 -:10714000102839D808F1040108441FFA80F8A8452E -:1071500032D804EB08078FB339884945EFD34DE0A7 -:107160009DF80F100A0749D54CB304EB080908F144 -:107170000402B9F8023097B2102B1DD8DA19AA42CE -:107180001AD8B9F80020904216D1C80618D5E119CE -:10719000CDE9001A08AA0292B9F800000022594667 -:1071A00003F010FF10B1FEF728FB84E7B9F80200E6 -:1071B000BDF82010884203D00B207CE71EE005E0DC -:1071C000B9F8020038441FFA80F806E0C90604D571 -:1071D0005946FEF755FD00288FD19DF80F00FF237B -:1071E00020F010008DF80F00BDF80F00ADF8000082 -:1071F000BDF812005946009A04F06BF903A804F098 -:107200003EF818B9BDF81200B042A9D90421099876 -:1072100006F013FC040000D1FFDF22885AB10025DC -:10722000CDE900A52B4621460998FEF7CBFC0028A6 -:10723000BBD125803FE700203DE72DE9F04F89B025 -:107240001E4617000D464FF000041BD0B10802D0B7 -:10725000072009B030E7032E00D1002606F0B6FB68 -:107260008046FF2805D07DB128460AF0E7FB48B9E3 -:1072700002E043F20200ECE73988681E08440AF095 -:10728000DDFB08B11020E4E72A49B00701D54889A1 -:1072900000E00120F2074FF6FF7902D04989491E2C -:1072A00000E049468EB204AA414603F0E0FF4FF0E9 -:1072B000070A0DF10C0B33E09DF8131009072FD5C9 -:1072C0000023CDE900A3CDF808B04B46002241468B -:1072D00004F069F8E8B9F5B1BDF80C103A8821441A -:1072E0002819091D8A4231D3BDF8162020F8022B37 -:1072F000BDF80C2020F8022BCDE900A0CDF808B095 -:10730000BDF81600BDF80C300022414604F04BF8E1 -:1073100008B103209DE7BDF80C002044001D84B295 -:1073200004A803F0ACFF38B1822809D0FEF765FA53 -:107330008FE7000058030020BDF81600B042BBD90B -:1073400034B175B13988A01C814203D20C2080E78A -:1073500005207EE722462946484604F0A1F929196E -:107360000880A41C3C80002073E710B504460AF096 -:1073700047FB08B1102010BD114840892080002033 -:1073800010BD70B50C4605460E21204613F0C9FD10 -:10739000002020802DB1012D01D0FFDF70BD06201F -:1073A00000E00520A07170BD10B50C4603F02EFF63 -:1073B00000B1FFDF2046BDE81040FEF71EBA000016 -:1073C000580300204FF0E0224FF400410020C2F8A3 -:1073D000801120490870204990020860704730B53C -:1073E0001C4D04462878A04218BF002C02D000286B -:1073F00018BFFFDF2878A04208BF30BD2C701749A6 -:10740000154A0020ECB1164DDFF858C0131F012CAF -:107410000DD0022C1CBFFFDF30BD086003200860C8 -:10742000CCF800504FF400001060186030BD0860C8 -:1074300002200860CCF800504FF0407010601860D7 -:1074400030BD086008604FF06070106030BD00B55E -:10745000FFDF00BD1600002008F5014000F50040E8 -:107460006403002014F5004010B50446007894B081 -:10747000022805D0012803D043F2050014B010BD46 -:10748000A07828B1032803D8607808B1032801D96F -:107490000720F3E73F208DF800002078022801D074 -:1074A000012000E000208DF80200607800F095FDDA -:1074B000C01D8DF80300A078012800D1022000F043 -:1074C0008CFD8DF80400607800F087FD8DF80500D4 -:1074D000A07800F082FD8DF806002078012804D104 -:1074E0009DF80300401C8DF8030009A9684604F0CC -:1074F00060F800B1FFDF0020C0E72DE9FF4F8DB03D -:10750000FA49DDE91AB90600D1E902010396CDE98D -:107510000901507A117A9A4608441546C7B20DD02F -:107520000024F01D20F00700B04200D0FFDF2888C3 -:107530000399401C1FFA80F814B107E00124F0E71A -:1075400008F0FF0007F0F4FE00B1FFDF03993A46B0 -:1075500001EB0810C01C20F00301D5F81080039146 -:107560003CB9002008701FFA88F003F0F2FC00B16B -:10757000FFDF0399234601EB08000390A87A297ADC -:107580003A460844C1B203A800F071FD0398C01C3C -:1075900020F003000390697A00912B7AAA7A04B153 -:1075A000002001A906F025F900B1FFDFBDF80410A5 -:1075B0000398CDE900B90844C01C20F003001C99D1 -:1075C000CDE902103A4604B10020534605A906F061 -:1075D0009BFA00B1FFDFBDF8141003980844C01DEA -:1075E00020F007000E99821B03900A60002C35D111 -:1075F000C04ABF491160111D401E086001232C22A2 -:107600000BA9BD4806F076F800F0F1FC00211E221F -:10761000084602F053F8FAF72FFE00F034FFFEF7A9 -:10762000D7FD09AB00220521B4A0FBF7ECFA00B1AD -:10763000FFDF05F10C00FFF7EFF800B1FFDF4FF4BB -:107640007F71B04813F08FFCAE48012180F8F91328 -:10765000022180F8FA13062180F8FB1311B0BDE86F -:10766000F08F10B5A74CA078092800D3FFDF207851 -:10767000C0EBC00004EB001010F8041F21F0FF0164 -:107680000170417821F00701C91C21F018014170F7 -:107690000121E17010BD2DE9F04105460C4600279F -:1076A0000078052190463E46B1EB101F00D0FFDF69 -:1076B000287E58B1012810D0FFDF00BFA8F8006075 -:1076C0000CB1278066800020BDE8F08102270926E2 -:1076D0007CB1A88BA080A87F09E00327142644B1C1 -:1076E0006888A080286AE060A88C2082287F2072A9 -:1076F000E4E7A8F80060E6E700B5017895B001F08E -:1077000001018DF80210417801F001018DF803109C -:107710000178C1F340018DF804104178C1F34001B4 -:107720008DF80510017889088DF8061041788908D0 -:107730008DF8071081788DF80810C1788DF8091040 -:1077400000798DF80A003E208DF8000009A96846EE -:1077500003F02FFF15B000BD70B56A4CE07800282B -:107760001BD020780025C0EBC00004EB001040794E -:1077700000F00700011991F8F803401E81F8F803A2 -:107780002078401CC0B22070092800D12570A07854 -:10779000401CA07009F0B1FCE57070BD594890F82C -:1077A000FB03002800D05CE770472DE9F043554DFE -:1077B0009BB00026D5F8F40368B1FFF7EFFF00286F -:1077C00075D07022D5F8F41313F079FBFFF7C4FFDE -:1077D000C5F8F463EEE795F8F903002867D0FFF7E2 -:1077E00040FF0446444805F0B6FF606000B9FFDF83 -:1077F000606803F029FF88B12046FAF7B8F860788E -:10780000010706D520F00700401C6070FFF7A4FFB9 -:10781000D0E73948616805F0A7FFCBE736486168D3 -:1078200005F0A2FF01A800F05BFC00286CD1032149 -:10783000BDF8040006F001F98046BDF8040006F02A -:1078400062FA0746B8F1000F00D1FFDFD8F8040054 -:1078500010B10078FF2857D0FFF703FF04463846E1 -:10786000211D05F0B0FE00B9FFDFD4F8049089F8BF -:107870000060BDF804006080204600F0EAFE384653 -:1078800005F0CDFE00B9FFDF3B208DF81000BDF8FC -:107890000400ADF8120004A805F050FB0EA804F097 -:1078A0003CF96078010703D4C00607D409E02BE057 -:1078B00020F00700801C6070FFF74EFFC8F80490AE -:1078C00078E7D8F8040038B10178491C11F0FF01BD -:1078D00001709DD1FFDF6DE700221146384600F0B0 -:1078E0007AFB002894D1FFDF64E7000014B30100A5 -:1078F0000000002000060240B40700206E5246350A -:1079000078000000B80300201BB0BDE8F08310B57C -:10791000FC4CA0600868E060AFF2711001F031FE2D -:10792000607010BDF74900200870704730B50546FB -:107930004FF080500C46D0F8A41095B0491C05D1EA -:10794000D0F8A810C9430904090C08D050F8A01FAA -:1079500001F0010129704168216080680EE02B2050 -:107960008DF8000009A9684603F023FE00B1FFDF8F -:10797000012028700A982060BDF82C00A08028788B -:10798000002803D0607940F0C000607115B030BDB0 -:10799000F0B54FF080540746D4F8800095B00D46FE -:1079A0002B26401C0BD1D4F88400401C07D1D4F8FE -:1079B0008800401C03D1D4F88C00401C0BD0D4F8B4 -:1079C00080003860D4F884007860D4F88800B8600B -:1079D000D4F88C0016E08DF82C6069460BA803F0F3 -:1079E000E8FD00B1FFDF01983860029878608DF8FB -:1079F0002C6069460BA803F0DCFD00B1FFDF0198A5 -:107A0000B8600298F860D4F89000401C0BD1D4F80C -:107A10009400401C07D1D4F89800401C03D1D4F83E -:107A20009C00401C08D054F8900F28606068686083 -:107A3000A068A860E06816E08DF8006009A96846B3 -:107A400003F0B7FD00B1FFDF0A9828600B9868606B -:107A50008DF8006009A9684603F0ABFD00B1FFDFB7 -:107A60000A98A8600B98E86015B0F0BD30B5A64C38 -:107A70000546D4F8F40300B1FFDFC4F8F45330BD79 -:107A80003EB50546032105F0D8FF0446284606F01A -:107A90003AF9054604B9FFDF606818B10078FF289D -:107AA00000D1FFDF01AA6946284600F094FA60B9C8 -:107AB000FFDF0AE0002202A9284600F08CFA00B994 -:107AC000FFDF9DF8080000B1FFDF9DF80000411EB8 -:107AD0008DF80010EED260680199884201D1002033 -:107AE0006060894C94F8FA03022800D3FFDF94F811 -:107AF000FA03401CC0B284F8FA03012803D181487C -:107B0000407801F05DFD3EBD70B50446A1F57F40B3 -:107B100016460D46FF3800D1FFDF012E01D0FFDFF2 -:107B200070BD207820F00F00401D20F0F000503094 -:107B3000207000202076A5830120A07770BD70B54D -:107B400015460C460646FFF729FE90B1017821F054 -:107B50000F01491D21F0F0015031017046800121D3 -:107B6000017621680162A18881840577BDE87040B3 -:107B7000F2E53046BDE870401321FAF733BE70B528 -:107B800005460C46084609F03BFF08B1102070BDC1 -:107B90002846F9F747FC28B1284600F09DFE2070E2 -:107BA000002070BD43F2020070BD2DE9F04F87B098 -:107BB00005460020059053488946017811B10820F8 -:107BC00007B04CE54F4851494160284609F018FF7D -:107BD000002868D1484609F013FF002863D16F7A66 -:107BE0002B7AF818FF2870D82888FE286DD800B99D -:107BF0000A202880296909B94FF4B06129616A68AF -:107C0000B2B15478907804EB440420441478167987 -:107C100004EB440400EB44005479D27804EB4404B0 -:107C200006EB4606344402EB420204EB420406E053 -:107C300007EB470003EB430200EB42042046C7EB8F -:107C4000C7021044C3EBC3021044184486B206EBCB -:107C5000C60000EB400A04EBC40000EB40000090BB -:107C6000D82901D20920ABE7A87AB8422DD84FF025 -:107C70001208082F0DD8012B0BD807F0C4FC0746BB -:107C800009F0FAF93A1A297A687A521E0B189A42C0 -:107C900001DA404694E76F6883468846BFB13846AC -:107CA00009F0D5FE08B110208AE7B9787878014448 -:107CB00038780A180BEB0800904206D179793A79A6 -:107CC0001144FA781144884201D0072078E70098DF -:107CD0001FFA8AF387B20097CDE901642A4603A907 -:107CE0000020FFF70AFCDFF81C800399D9F8002078 -:107CF000D8F80400014491420AD90420C9F80010C0 -:107D00005EE7000018000020B80300208812002061 -:107D10000097CDE901641FFA8AF32A4604A9FFF708 -:107D2000ECFBDDE90301884200D0FFDF0498D8F8BE -:107D300004100844C8F80400C9F80000FF490120F5 -:107D400088F80000087005983AE72DE9F0470746E3 -:107D50000C46084609F054FE40B9384609F06EFE5C -:107D600020B9F81C20F00300B84202D01020BDE872 -:107D7000F087F3484FF00008817899B14178824646 -:107D8000C1EBC10100EB0115B4F8009015F8040F28 -:107D9000234600F00F000022294600F0F0F906000B -:107DA00004D013E0A4F800800520E0E797B1218813 -:107DB000494501D90C260DE02878234600F00F0034 -:107DC0003A46294600F0DBF9060005D00C2E01D01A -:107DD000A4F800803046CAE79AF801005446401CD7 -:107DE000C0B28AF80100092801D184F80180A07886 -:107DF000401EA070687800F0070101290BD002290D -:107E000003D0032918D0FFDFE4E7C006E2D4688876 -:107E1000FFF736FEDEE7CB48696805F0A5FC94F86D -:107E2000F903401CC0B284F8F9030128D2D1C64836 -:107E3000407801F0C5FBCDE794F8FB03401C8AF8BD -:107E4000FB03C7E770B50D46044609F0B5FD18B948 -:107E5000284609F0D5FD08B1102070BD29462046FE -:107E6000BDE8704007F09BBA70B5044615460E4653 -:107E7000084609F0A1FD18B9284609F0C1FD08B16E -:107E8000102070BD022C03D0102C01D0092070BD31 -:107E90002A463146204607F0A5FA0028F7D00520EB -:107EA00070BD70B514460D46064609F085FD38B91B -:107EB000284609F0A5FD18B9204609F0BFFD08B114 -:107EC000102070BD22462946304607F0AAFA002845 -:107ED000F7D0072070BD10B594B0044609F090FDAE -:107EE00010B1102014B010BD0F208DF8000009A9AA -:107EF000684603F05EFB0028F4D19DF82C0020704A -:107F0000BDF82E006080BDF83000A0800020E9E7B9 -:107F100070B505460C46084609F090FD20B93CB105 -:107F2000206809F06DFD08B1102070BDA08828B14F -:107F300021462846BDE87040FEF7A0B9092070BD73 -:107F400070B504460D46084609F036FD30B9601E8E -:107F50001E2814D8284609F02FFD08B1102070BD46 -:107F6000022C01D9072070BD04B9FFDF774800EB70 -:107F7000840050F8041C2846BDE870400847A4F16E -:107F800020001F28EED829462046BDE87040FAF7A9 -:107F9000BCB870B504460D46084609F031FD30B94D -:107FA000601E1E280DD8284609F006FD08B11020D5 -:107FB00070BD012C01D0022C01D1062070BD07201C -:107FC00070BDA4F120001F28F9D829462046BDE83D -:107FD0007040FAF709B905F099B9032803D00228CF -:107FE00003D001207047062070470320704710B56A -:107FF00094B003F0CFFA54484178806803F0C0FC95 -:10800000514801240C300178012916D130218DF816 -:108010000010C0788DF8020010B1012803D005E0EF -:108020008DF8024002E000208DF80200684604F05E -:1080300085FF10B109A803F070FD02208DF824001F -:108040008DF825008DF8260009A8FFF70DFA00B17C -:10805000FFDF8DF8244003208DF825008DF82600E1 -:1080600009A8FFF701FA002800D0FFDF3AE72DE961 -:10807000F0410646022012B101EB4200401DC7B29A -:108080003068C01C20F0030232601BBB2C483B460A -:108090000A21283809F081FB002408E00A2C11D2BB -:1080A000DFE804F005070509090B0B05050528485D -:1080B00004E0284802E0284800E0284809F08CFB4A -:1080C000054600E0FFDFA54200D0FFDF641CE4B2FC -:1080D0000A2CE3D3306800EB07103060BDE8F08174 -:1080E0002DE9F04395B081463A208DF82C00694681 -:1080F0000BA803F05EFA00B1FFDF43F20406002490 -:108100006D46DFF83C8032E02F19B87DC10706D0FC -:10811000400704D405EB4400C08800F0CEFB98F87B -:10812000FA0310B3B87D80071FD505EB4400C08863 -:1081300000F055FAC8B105EB440011E0080000203A -:10814000B8030020B40700201800002014B3010079 -:10815000391F0000F7840000E12F0000E9F0000063 -:10816000C188A9F80010002605E0641CE4B29DF85F -:108170000400A042C8D815B03046BDE8F0832DE910 -:10818000F041044600201880601E1D4616460F462A -:10819000052800D3FFDF05482A4600EB840031465E -:1081A00050F8043C3846BDE8F041184724B30100BC -:1081B0002DE9F0478A46984615460646032105F004 -:1081C0003CFC0446304605F0B0FD0C35AFB200254E -:1081D00081462E4604B9FFDFB9F1000F00D1FFDF61 -:1081E00004EB8A000189B94200D30125218CB942F0 -:1081F00002D2BAF1060F00D3012638EA050104D0F5 -:10820000817A41F0020181720BE038EA060108D060 -:10821000817A41F00401817214F8220F40F00400C9 -:10822000207005EA0600BDE8F0872DE9F047824698 -:10823000DDE90854174605F10C0099460E461FFA71 -:1082400080F800232A4639465046FFF7B1FF60B157 -:10825000B07800061BD424F8045C24F8029C504635 -:1082600005F063FD040008D106E0072F01D01120BE -:10827000D9E743F20400D6E7FFDF2D1D2046A9B25F -:1082800004F047FF00B9FFDF504603F0E5FA06EBC4 -:108290008700062F0289A2EB0801018103D2318CED -:1082A000A1EB080030840020BDE72DE9F04385B044 -:1082B0001E46DDE90D5491460F46DDF8308005F08D -:1082C00034FD60B309F10402694692B204F0BBFECA -:1082D00050B300980770BDF80800042800D2FFDFF3 -:1082E000002701983A46394607808770019803F0C5 -:1082F00075FB1EB1BDF80800001F3080B8F1000FFB -:1083000003D00198C01DC8F8000015B1BDF81000D9 -:1083100028808CB1288870B1039820600CE043F26B -:10832000020005B0BDE8F083072F01D01120F8E767 -:1083300043F20400F5E727600020F2E72DE9F04F53 -:108340000F46054687B016465088032105F075FB99 -:10835000040000D1FFDF4FF000098DF80C90A078E9 -:10836000400600D1FFDF042F53D3297841F30000EA -:10837000401C06D162786B789A424AD12278120763 -:1083800047D04FF0010B4FF00208142939DA4FF6AD -:10839000FF7A012933D0122902D0132931D11CE0F0 -:1083A0000C2F2ED1A17801F07F01012929D020784E -:1083B00020F00F00401C2070687860708DF80CB0C1 -:1083C000A888ADF80E00E888ADF810002889ADF84F -:1083D00012006889ADF8140016E0062F11D120783C -:1083E00020F00F0020707188012009F0A2FA8DF8AA -:1083F0000C80ADF80EA0A888ADF8100004E0062FA0 -:108400000AD09DF80C10B9B17088324603A9F9F76B -:1084100018FE07B0BDE8F08F207820F00F00207024 -:108420007188012009F085FA8DF80C80A888ADF8D4 -:108430000E00ADF810A0E7E70028EAD0768806A87D -:10844000CDE9000927464C46002306220421304688 -:10845000CDF80890FFF729FF00B1FFDF069805234C -:10846000042280F800B069784170A0F8028084800E -:108470000621CDE9001039463046FFF7D6FE002828 -:10848000C7D0FFDFC5E70020FE49024621F81020D3 -:10849000401C0828FAD3704770B50C46897821F043 -:1084A000FF01A170217821F00F012170012161707D -:1084B0000021616005F039FC050000D1FFDF28468E -:1084C00004F0BFFDF53820852046BDE8704000F07F -:1084D00010BB70B50D46032105F0AFFA040000D1C2 -:1084E000FFDFA07865F30600A07070BD70470146FD -:1084F000012009F01EBA3EB58DB20321284605F0D1 -:108500009CFA040000D1FFDF2078002220F00F0049 -:10851000207002208DF800004FF6FF70ADF80200C9 -:10852000ADF8040069462846F9F78BFD3EBD2DE9FC -:10853000F04705460C4600784FF0000901219246AD -:108540004F46B1EB101F00D0FFDF287E032809D073 -:10855000FFDF00BFAAF8007014B1A4F80090678094 -:10856000002060E6AE8B4FF0700906F10A0087B27A -:10857000D4B16888A080688B2081E680A889A9682A -:10858000001F80B28046024604F10A00C91D12F0A5 -:1085900051FC4645DED904EB0800A6EB08020A3080 -:1085A000296912F047FCD5E7AAF80070D8E72DE951 -:1085B000FC410F461C46164680460321089D05F0E7 -:1085C0003CFA010008D033463A464046CDE9004522 -:1085D000FFF72BFEBDE8FC8143F20200FAE770B51D -:1085E0000546A0F57F4086B0FF3811D0284605F03B -:1085F0008AFB040000D1FFDF2046694604F0E3FF58 -:1086000000B9FFDF019CB4F80500E41C052802D086 -:10861000012006B070BD2E460321284605F00DFA54 -:10862000050000D1FFDF2079122807D120880C280F -:1086300004D1A87800F07F00022806D0002306228B -:1086400004213046FFF7B4FDE3E7002306220521AD -:10865000F7E7F8B5024680689489938A30F8031FDB -:108660001C444588241F8C421ED1042D1DD0052D8D -:1086700029D0062D1ED0402D16D30E46144628466E -:1086800000F0D7F908280FD0207820F00F00401C08 -:1086900020F0F00010302070032020766583A68340 -:1086A000607840F008006070F8BDBDE8F840001D3B -:1086B00000F0CBB90093548813690A46011D204687 -:1086C000FBF7CCF9F8BDBDE8F840001D36E67FB5F4 -:1086D0000D460646032105F0B0F904003DD0207890 -:1086E00000F00F0001283BD0002003A9CDE90010C5 -:1086F000034602900C2205213046FFF7D6FD0028E4 -:1087000029D1039812210523017061781A46891C2A -:10871000417008214180298881806988C180A988A9 -:108720000181E98841810C21CDE9001021463046C4 -:10873000FFF77BFD00B1FFDFF0230022314601206F -:1087400009F05AF8207820F00F00401C2070607863 -:10875000801C6070002004B070BD43F20200FAE794 -:108760001120F8E77FB50D460646032105F065F9AF -:10877000040006D0207800F00F00012804D0082063 -:10878000E9E743F20200E6E7002003A9CDE9001083 -:1087900003460290062205213046FFF786FD002899 -:1087A000D9D103981321052301706178417002210A -:1087B000418085800621CDE900101A4621463046C9 -:1087C000FFF733FD00B1FFDF207820F00F002070AD -:1087D0000020C0E72DE9F84F0F468346032105F03E -:1087E0002CF90546584605F0A0FA80464FF0000ADD -:1087F00005B9FFDFB8F1000F56D1FFDF54E0404666 -:108800006946002204F082FD9DF800408146082C54 -:1088100000D3FFDF05EB840609F108003189062C3F -:108820000144318102D2298C08442884072C03D1C9 -:108830000AF1010000F0FF0AB07AC0070CD021460F -:10884000284600F0DDF838B9B07A032C20F001009A -:10885000B07258462ED0FFDFB07A810706D520F0DF -:108860000200B0722146584600F0DAF8062C1BD8F8 -:1088700095F82200410717D520F0040085F8220062 -:10888000002401E0E407002005EB8401887A420718 -:1088900006D520F0040088722146584600F0C0F842 -:1088A000641CE4B2062CECD37F1EFFB2A7D2504664 -:1088B000BDE8F88FFBF773F9CEE710B5032105F09B -:1088C000BCF8040000D1FFDF204600F012F9A078C8 -:1088D00040F08000A07010BD10B5032105F0ADF888 -:1088E000040000D1FFDF208D2321B0FBF1F0C0B2E6 -:1088F00010BD70B50D46032105F09FF8040000D1AE -:10890000FFDF062D00D9FFDF2946204600F078F86A -:10891000002805D004EB85018A7A42F001028A72B0 -:1089200070BD10B50446402801D2072010BD00F0EC -:1089300080F8082802D04FF4445010BD0021774839 -:1089400002E0491C082903D230F81120002AF8D18E -:10895000082903D020F81140002010BD042010BDCC -:1089600010B5402801D2072010BD00F062F8082899 -:1089700005D06A4A002122F81010084610BD0520D3 -:1089800010BD70B588B015460C00064606D02DB156 -:108990006088402804D2072008B070BD1020FBE793 -:1089A000218849B300F045F8082827D003AA06A972 -:1089B00005A88DE80700228804AB07213046FFF7A1 -:1089C00074FC0028E8D1BDF810202946059812F063 -:1089D00031FA2088BDF81010884204D9421A29447F -:1089E000039812F027FA05980090238862880721DF -:1089F0003046FFF7DCFDCFE70C20CDE70520CBE7C5 -:108A0000072903D0464A32F8112000E0028D00EB1E -:108A100081000089904201D20120704700207047F8 -:108A200010B5032901D0FFDF10BDBDE81040FBF7F2 -:108A300078B801460020394A02E0401C082803D2D9 -:108A400032F810308B42F8D170472DE9F0410F46D3 -:108A50008046014686B014463846FCF744FDC0B255 -:108A600008283CD10025ADF81450039560880321F7 -:108A700004F0E3FF060000D1FFDF00213046FFF7DE -:108A8000BFFF68B91722ADF8142003A8CDE900058F -:108A90000295002360881946FFF707FC00B1FFDF4D -:108AA000009405AA41463846039BFDF755FCC0B229 -:108AB00005281CD2DFE800F0031B13161300BDF8D5 -:108AC000140000280BD003990423CDE9000160882D -:108AD00000223146FFF7A9FB002800D0FFDF06B0D7 -:108AE000BDE8F081607840F010006070F7E7FFDFCC -:108AF000F5E710B504462021083012F034FA084892 -:108B0000002100BF30F8112004EB8103491C1A81B9 -:108B10000629F7D9208DA08410BD0000E4070020AD -:108B20003CB3010030B44FF0E02001234FF4006C5F -:108B30000021C0F880C11D02C0F880511C06C0F899 -:108B40008041E54A82F80014D21E82F80014E34AFC -:108B500082F80014E24A53609360C2F84011C2F8F0 -:108B60004411C2F84811C0F880C2C0F88052C0F861 -:108B70008042C0F800C1C0F80041136030BC7047AB -:108B800070B401204FF0E023C6024FF0000CC3F890 -:108B900080610402C3F880410506C3F88051D04AC1 -:108BA00050609060CF4801680029FCD1C2F840C1F4 -:108BB000C2F844C1C2F848C1C3F88062C3F8804219 -:108BC000C3F8805270BC70474FF0E0204FF4006152 -:108BD000C0F88012C910C0F880127047002804BF86 -:108BE000C1487047012804BFC0487047022804BF2D -:108BF000BF48704700B5FFDF002000BD08B5B84989 -:108C0000002298B101282FD002281CBFFFDF08BD29 -:108C10004FF48020C1F80803C1F84803B54802604A -:108C2000C1F84821B2480068009008BD4FF4803078 -:108C3000C1F80803C1F84803AF4B1A60C1F84021DE -:108C4000AE4BC1031960AE49C1F808034FF0E023F1 -:108C50000012C3F88001AB480260C1F84021C1F89E -:108C60000022A948027008BD4FF40030C1F8080383 -:108C7000C1F84803A5480260C1F844219B48006838 -:108C8000009008BD70B5DFF858C204260024012505 -:108C900058B1012840D002281CBFFFDF70BD9C4A9C -:108CA0004FF48020012B3CD144E0881E20F07F410E -:108CB0004FF48030CCF80803CCF84041CCF84403A2 -:108CC000CCF84015012B14BF002101218E4B5970A7 -:108CD0008B490D61DFF83CC2CCF800408E4C4FF060 -:108CE000020CC4F800C0DFF834C2CCF80060DFF832 -:108CF00014C23D32CCF80020C1F800524FF0E02CF5 -:108D00008A15CCF88022C1F80403CCF800210804AD -:108D1000834908601D7070BD824A4FF40030012BFA -:108D200008D0CCF80803C2F84041CCF84403C2F89C -:108D3000401570BDC2F84041CCF80403CCF84403A0 -:108D4000C2F8401570BD67480068704770B5764836 -:108D50000568774975480860614CD4F840010026E1 -:108D600001280AD1D4F8080310F4803F05D04FF44D -:108D70008030C4F80803C4F84061D4F844010128E5 -:108D80000DD1D4F8080310F4003F08D04FF40030A0 -:108D9000C4F80803C4F84461012007F0BEFBD4F80E -:108DA000480101280DD1D4F8080310F4802F08D011 -:108DB0004FF48020C4F80803C4F84861022007F08B -:108DC000ACFB5C48056070BD574810B50468584955 -:108DD000564808604C490878002808BF03201AD07C -:108DE000464A4FF000401060454AC00BC2F80803E5 -:108DF00003124FF0E02C0020CCF88031414B18607A -:108E0000C2F84001C2F8000208704A78002A1CBF6C -:108E10004870002001D007F080FB4648046010BD78 -:108E20004FF0E0214FF08070C1F8000270474FF022 -:108E3000E0214FF08070C1F8800270474FF0E021D0 -:108E40004FF40010C1F8000270474FF0E0214FF4DA -:108E50000010C1F8800270472949012008614FF0D5 -:108E6000E0210002C1F880027047410A43F609522E -:108E70005143C0F3080010FB02F000F5807001EBD5 -:108E800050207047430B48F2376C03FB0CF31B0C6C -:108E90004FEA432CC1F800C0DFF89CC003FB0C0371 -:108EA00026484CF2F72C5843400D10FB0CFC0CEB01 -:108EB000432303F580735B1213700A681044086043 -:108EC0007047194810B5046819491848086007F038 -:108ED00011FC1848046010BD0BE000E018E000E051 -:108EE00000B0004004B500404081004044B1004063 -:108EF00048B1004048B5004040B5004008F5014089 -:108F000000800040408500402800002044B500401B -:108F100008B00040048500400885004010850040EE -:108F200004F5014004B000401005024001000001BA -:108F30001805024014050240F7C2FFFF6F0C010044 -:108F400010B5EFF3108000F0010472B6EC484178E0 -:108F5000491C41704078012801D108F0EDF8002C3F -:108F600000D162B610BD70B5E54CE07848B9012576 -:108F7000E570FFF7E5FF08F0E7F820B1002008F002 -:108F8000C3F8002070BD4FF080406571C0F80453F5 -:108F9000F7E770B5EFF3108000F0010572B6D84C1A -:108FA000607800B9FFDF6078401E6070607808B9B3 -:108FB00008F0C6F8002D00D162B670BDD04810B5DB -:108FC000C17821B100214171C170FFF7E2FF00209B -:108FD00010BD10B5044608F0B7F8C949C978084073 -:108FE00000D001202060002010BD2DE9F05FDFF8E7 -:108FF00010934278817889F80620002589F80710B7 -:10900000064689F8085000782F4620B101280FD075 -:1090100002280FD0FFDF08F0A4F898B108F0A8F8F4 -:10902000A8420FD1284608F0A7F80028FAD047E058 -:109030000125F0E7FFF784FF08F086F80028FBD051 -:109040000225E8E701208407E060C4F80471AD4917 -:109050000D600107D1F84412AA4AC1F3423124320B -:109060001160A8494FF0020B34310860C4F804B312 -:10907000A060DFF894A2DAF80010C94341F30011B0 -:1090800001F10108DAF8001041F01001CAF80010EF -:1090900000E020BFD4F804010028FAD0284608F0E8 -:1090A0006BF80028FAD0B8F1000F05D1DAF80010FB -:1090B00021F01001CAF80010C4F808B3C4F8047114 -:1090C00099F807004C4670B1307860B908F03CF868 -:1090D000064608F027FA6FF0004116B1C4E9031004 -:1090E00001E0C4E9030115B12771BDE8F09F01203B -:1090F0002071BDE8F05F00F0E1B810B5040000D1C8 -:10910000FFDF4FF080414FF0FF30C1F8080300222D -:10911000C1F80021C1F80421C1F80C21C1F81021C7 -:1091200008F018F828B176490120C8704878401C2A -:1091300048702046BDE8104057E72DE9F041012571 -:10914000AF077D616E4CE079F0B1012803D0217A40 -:10915000401E814218DA07F0F7FF064608F0E2F9F0 -:10916000E179012902D9217A491C21720EB12169C4 -:1091700000E0E168411A022902DA11F1020F0EDC67 -:109180000EB1206100E0E060FFF7DAFE07F0DCFFDF -:1091900010B13D61A57000E0257000202072BDE88F -:1091A000F0812DE9F05F5948D0F800B0574A58498E -:1091B000083211608406D4F8080110B14FF001089C -:1091C00001E04FF00008D4F8000100B10120814611 -:1091D000D4F8040108B1012600E00026D4F80C01FF -:1091E00000B101208246D4F8100108B1012700E047 -:1091F000002748EA090126EA010020EA0A00B843EC -:1092000000D0FFDF0025B8F1000F04D0C4F80851EA -:10921000012007F079FFDFF8E880B9F1000F13D0E3 -:10922000C4F8005198F8050020B188F805500020D6 -:1092300007F06AFF98F8000030B107F085FF18B119 -:10924000012088F8020020610EB1C4F80451BAF17F -:10925000000F0AD0C4F80C5198F80200464600B935 -:10926000FFDFB5703570FFF794FE37B1C4F81051C9 -:1092700098F8040008B1FFF760FF2449091DC1F800 -:1092800000B032E770B51E4DE87808B907F058FF16 -:1092900001208407A061A87858B100BFD4F80C0160 -:1092A00020B9002007F068FF0028F7D10020C4F89B -:1092B0000C014FF0FF30C4F8080370BD2DE9F041F8 -:1092C0001926B507C5F808630124AC610020C5F86C -:1092D0000001C5F80C01C5F8100107F035FF084F73 -:1092E00010B1BC702C6100E03C70FFF729FE05490D -:1092F000B87920310860C5F804636C614FE700005D -:109300002C0000201805004010ED00E01005024080 -:109310000100000110B50D2000F06FF8C4B26FF02D -:10932000040000F06AF8C0B2844200D0FFDF3A497E -:109330000120086010BD70B50D2000F048F8374CD2 -:109340000020C4F800010125C4F804530D2000F0EA -:1093500049F825604FF0E0216014C1F8000170BDAC -:1093600010B50D2000F033F82C4801214160002198 -:10937000C0F80011BDE810400D2000F033B82848B7 -:1093800010B5046826492748083108602349D1F8F8 -:109390000001012804D0FFDF2148001D046010BD3A -:1093A0001D48001D00680022C0B2C1F8002107F06E -:1093B000D4FFF1E710B51948D0F800110029FBD00F -:1093C000FFF7DDFFBDE810400D2000F00BB800F006 -:1093D0001F02012191404009800000F1E020C0F807 -:1093E0008011704700F01F02012191404009800068 -:1093F00000F1E020C0F880127047002806DA00F083 -:109400000F0000F1E02090F8140D03E000F1E020DF -:1094100090F800044009704704D5004000D0004097 -:10942000100502400100000110B5202000F075F881 -:10943000202000F07DF84449202081F800044349B1 -:1094400000060860091D42480860F7F75BFF3F49C6 -:10945000C83108603F48D0F8041341F00101C0F85A -:109460000413D0F8041341F08071C0F80413364996 -:1094700001201C39C1F8000110BD10B5202000F0FA -:109480004CF8324800210160001D01602F4A481E3F -:10949000E83A10602F4AC2F808032C4BC833196011 -:1094A000C2F80001C2F860012B490860BDE8104015 -:1094B000202000F03DB825492848EC390860704765 -:1094C00022492648E8390860704770B51F4A80690C -:1094D000E83A224911601F49D1F800610023204D6C -:1094E0001D4A5C1E1EB1A84206D300210FE0D1F830 -:1094F000606186B1A84209D2C1F80031C1F860317B -:109500001460BDE87040202000F012B81168BDE87A -:10951000704011F05ABDFFDF70BD00F01F02012145 -:1095200091404009800000F1E020C0F880117047B0 -:1095300000F01F02012191404009800000F1E0206D -:10954000C0F880127047000020E000E000060240F2 -:1095500084120020000002400004024001000001CB -:1095600000C001004FF0E0214FF00070C1F8800111 -:10957000C1F88002384B802283F80024C1F8000132 -:10958000704700B502460420344903E001EBC003F4 -:109590001B792BB1401EC0B2F8D2FFDFFF2000BD07 -:1095A00041F8302001EBC00100224A718A7101228A -:1095B0000A7100BD294A002102EBC0000171704709 -:1095C00010B50446042800D3FFDF244800EBC40490 -:1095D0002079012800D0FFDF6079A179401CC0B25A -:1095E000814200D060714FF0E0214FF00070C1F86F -:1095F000000210BD2DE9F0411948056818491948C5 -:10960000083108601448042690F80004134F4009FC -:10961000154C042818D0FFDF16E0217807EBC100B5 -:109620000279012A08D1427983799A4204D0427999 -:10963000827157F8310080472078401CC0B22070FA -:10964000042801D300202070761EF6B2E5D204482B -:10965000001D0560BDE8F08119E000E0F40700207E -:109660001005024001000001400000200F4A12686E -:109670000D498A420CD118470C4A12680A4B9A428B -:1096800006D101B507F022FFFFF715FFBDE8014045 -:10969000074909680958084706480749054A064B1B -:1096A0007047000000000000BEBAFECA980000200B -:1096B000040000208811002088110020F84B586019 -:1096C00019721A80C90011F04EBC00210180704748 -:1096D0004FF6FF720280032008F02BB970472DE986 -:1096E000F04F0E46017804464FF0010A0AFA01F0E5 -:1096F00047F2FF1100EA01086168154697B0088833 -:10970000A0F57F42FF3A06D0B8F1000F07D047F22C -:10971000FE12104203D0012017B0BDE8F08F40EADE -:10972000080008804FF00009A5B185F80090237863 -:109730000027052003220221DFF864B3102B75D225 -:10974000DFE803F0740D131C2F4A515A31A5A1759F -:10975000A9F1F0EF20780B28E9D00420DCE729708C -:10976000A089A5F8010032801DE104212970A1899A -:10977000A5F80110E189A5F8031082E00620287001 -:10978000A089A5F80100E089A5F80300208AA5F8C2 -:109790000500A28AE81DA16911F04CFBA08AC01D3A -:1097A0006FE0082129702178082901D11021297042 -:1097B000A189A5F80110E189A5F8031030806A1D80 -:1097C000694604F1100005F02CFE00287ED1308897 -:1097D0009DF80010084454E00A202870A089A5F8DC -:1097E00001003280AAE00C212970A189A5F801109E -:1097F000E189A5F80310B7E0A2890AEB420081B223 -:109800003088884262D3052960D30E20287000205A -:1098100008E0236905EB400C33F81030401CACF82D -:10982000013080B29042F4D33180BCE0CAE09BF8B2 -:1098300009005A46002873D0401E5072227BDBF884 -:109840000400236900EBC205AA882868D3F800C089 -:109850000244A2F1080042F808CC5A6842608DF830 -:1098600000108DF8019028680290A888ADF80400D7 -:1098700000216846FBF776FCA5F80490002E01D085 -:10988000484630808FE0287840F0800129702878A1 -:1098900040F040012970287820F03F0012302870F5 -:1098A000A189A5F80110E289E81C216911F0C2FA2A -:1098B000E089C01C3080287841063FD5000672D56B -:1098C0008DF800A08DF80190308800E026E0001DA2 -:1098D000ADF804000295E189E81C08440390001DDE -:1098E00004909BF808008DF8140000216846FBF7EF -:1098F00039FC074630880C303080022F01D007B386 -:1099000063E09DF81420DBF804109BF808305846FB -:1099100001EBC2019A4201D28A882AB1042754E09D -:1099200030E02BE022E00DE0427A521C8BF8092057 -:109930000D6030888880A6F8009046E06168A089B4 -:10994000888030E0287820F03F0016302870A08909 -:10995000A5F80100E089A5F80300228A681D616965 -:1099600011F068FA208A401D3080E7E7287820F05F -:109970003F0018302870207B687055E760680188C8 -:10998000090401D4052720E0C088A189884201D0BC -:1099900006271AE01E202870A6F800A0606801883B -:1099A00021F400410180B8F1000F0ED0BBF8000097 -:1099B000002283000320A16807F01EFF6168207861 -:1099C000887007E0A6F8009003276068018821EA04 -:1099D0000801018038469FE62DE9FF4F97B00C46FD -:1099E000249E70B117280CD83288A2F57F43FF3B24 -:1099F00007D02278530601D4120604D508201BB0E4 -:109A00008BE60720FBE74FF000098DF800908DF8FA -:109A100001902278831E02F03F0CA0F1010A611C24 -:109A20004D461FFA8AF702AABCF1200F79D2DFE86F -:109A30000CF089107861786C78AA78CD78F778FC8A -:109A400078F478F378F2787878F178F078EF78EE47 -:109A50007889052876D104208DF80000B0788DF83B -:109A600004006088ADF8060020798DF80100607868 -:109A700000F03F000C282BD00ADCA0F102000928DE -:109A800060D2DFE800F0145F175F1C5F1F5F2200E9 -:109A9000122826D006DC0E281DD01028DAD11DE0B1 -:109AA0001408002016281FD01828D3D11FE03078C2 -:109AB000800701E030784007002843DA37E130784A -:109AC0000007F9E73078C006F6E730788006F3E75C -:109AD00030784006F0E730780006EDE73088C005C2 -:109AE000EAE73088C004E7E730888004E4E730889C -:109AF0004004E1E73178890724D50328AAD105205D -:109B00008DF80000B4F80100D2E031784907F3D5B0 -:109B1000062817D3617898B2012903D0022999D178 -:109B200002E01FE1022700E0102706218DF8001057 -:109B300061788DF80610ADF80490A11C904607F1ED -:109B400002091BE097E000BF31F8022BA0F1020AE6 -:109B5000A8F800208B463A4608F1020011F06AF995 -:109B600008EB070202F10208BDF80420AAEB070087 -:109B7000521C0BEB070180B2ADF804208145E3D9FC -:109B8000002878D1D3E03078000774D507208DF80D -:109B900000001FFA8AF1ADF80490601C0DF1060276 -:109BA0000FE000BF30F8023B22F8023B30F8023BE6 -:109BB00022F8023B091FBDF8043089B25B1CADF8E6 -:109BC00004300429EED2002955D1B0E03178C9061D -:109BD00051D502284FD308208DF80000ADF806902B -:109BE00061789BB28DF80410A01C0CE0078822F865 -:109BF000047B871C80C25B1ABDF8067008447F1C7A -:109C00009BB2ADF806709942F0D9A3BB8FE070E02B -:109C100075E065E04FE042E01DE012E005E0FFE79F -:109C20003078800627D5092003E03078400622D519 -:109C30000A208DF80000B088ADF80400ADF8067079 -:109C400007E03078000616D50B208DF80000ADF83F -:109C5000047002916BE03188C9050CD502287FD3CE -:109C60000C208DF8000099B2ADF8069063788DF85D -:109C70000430A01C10E073E0078822F8027B4788BC -:109C800022F8027B071D80C2C91ABDF8067018446D -:109C90007F1C89B2ADF806708B42EDD993E731880D -:109CA000C9045DD501285BD10D208DF80000B08876 -:109CB000ADF804003BE03188890451D505284FD325 -:109CC0000E218DF80010B188ADF80410B4F803101F -:109CD000401FADF80800601DADF80610039026E0A7 -:109CE000318849043CD501283AD10F208DF8000075 -:109CF0001DE03188090433D4B4F80110F180032841 -:109D00002ED3217801F03F011B2925D011218DF898 -:109D10000010318841F40041A6F80010B4F8011099 -:109D2000ADF80410C01EADF80600E01C02902078CB -:109D300000F03F001B2809D01D2807D003201A99E6 -:109D400007F0F7FD308800F400403080684619992C -:109D5000FBF708FA284652E610218DF80010DDE7DF -:109D60000725F7E70825F5E700B597B0032806D1E2 -:109D70008DF80000019100216846FBF7F3F917B058 -:109D800000BD00002DE9FF4F8DB09346DDE91A5666 -:109D9000DDF8749004464FF0000A082A06D0E06906 -:109DA00001F02CF858B110203070BCE0288809214F -:109DB00040F01000288089F80010022717E0E169C0 -:109DC00001208871E2694FF420519180E169887225 -:109DD000E06942F601010181E16900208873288869 -:109DE00040F020002880112089F8000004273078F6 -:109DF00009900A20307004F1180009F102080225C8 -:109E00000B9001F063FA002066E000BFBBF1100F79 -:109E100006D1022D04D0A8EB0A00BDF80C20428028 -:109E2000BDF80E001099884203D9F649097A0E91BF -:109E300004E003D1099909B131701FE0A8F80000CE -:109E40001C980088A0EB0500A0EB070083B2C7F1C7 -:109E5000FF00984200D203460E980AAA08EB0701B9 -:109E60008DE8070094F82010BDF80E00002201F0E4 -:109E70009AFA307030B1C0B2832858D0BDF80E00C5 -:109E800020833DE0089828B1DE48006800790A2860 -:109E90002BD335E0BDF82800C11901F0FF0A022DCF -:109EA0000ED099F80110514503D1BDF81820824217 -:109EB00008D0D4488A4600680178032908D021E0F8 -:109EC00089F801A0CF4800680178042906D008E08D -:109ED00000790A2816D20120089006E0BDF80E107D -:109EE000818005EB0A00D04485B203AA0E990B9835 -:109EF00001F0EFF920B91C980088401BB84285DAC0 -:109F0000022D0BD0BBF1100F04D1A8EB0A01BDF854 -:109F10000C0048801C98058000203070B94800680B -:109F20000078032803D0002011B0BDE8F08F022094 -:109F3000FAE72DE9F0410546406B1346002758B378 -:109F4000491F8EB2698FA1F57F42FF3A05D04218B2 -:109F500092881144891D8CB200E00024A1192A8F37 -:109F60000831914216D82044B3F8011020F8021BA2 -:109F7000B3F8031020F8021B324620F8026B591D7B -:109F800010F058FF6C87696B00202144B61D3144E6 -:109F9000088002E0092700E083273846BDE8F08109 -:109FA00010B50B88048F9C420CD9446BE0180488D0 -:109FB00044B1848824F40044A41D23440B80106021 -:109FC000002010BD822010BD2DE9F04788B000258B -:109FD000904689468246ADF81050072745E0039821 -:109FE00006888088000440D4A8F8006005A800977F -:109FF000CDE901504FF4007300224946304601F08C -:10A00000D2F9040038D1BDF81000ADF8180003985B -:10A0100004888188B44214D10A0412D4CDE90057CF -:10A0200021F40041029541F480434288494620468C -:10A0300000F0C8FF04000BD10398818841F400416F -:10A04000818003AA06A95046FFF7AAFF0400DED0CC -:10A05000CDE9005703980295BDF81430008800221E -:10A06000494600F0AFFF822C06D103AA04A950464E -:10A07000FFF796FF0400B2D0ADF8105004E003984B -:10A08000818821F40041818003AA04A95046FFF78A -:10A0900087FF0028F3D0822C03D0204608B0BDE80B -:10A0A000F0870020FAE730B50446406B97B00025F2 -:10A0B00070B10B208DF80000208FADF80800606BA8 -:10A0C0000391019000216846FBF703FE8DF80050D4 -:10A0D0004FF6FF7065636087258717B030BD2DE9A7 -:10A0E000F041044686B00E46616B00200C9D174679 -:10A0F00000292AD0012B28D12A4631462046FFF7D5 -:10A1000063FF002821D1002F1FD0A046344600262F -:10A11000ADF8106007270EE00398008828800398A8 -:10A120000296811DCDE90017838842880088214668 -:10A1300000F048FF30B903AA04A94046FFF730FFFA -:10A140000028E9D0822800D1002006B026E72DE9BA -:10A15000F0411546DDE906644A1D378892B2974200 -:10A1600001D206201AE73280172204F8012B0A4692 -:10A17000208065801946201D10F05CFE00200DE750 -:10A1800000220280C262831D0263C36142634FF6F4 -:10A19000FF734387028780F8201070474FF6FF72E5 -:10A1A0000280042007F0C5BB30B597B00D460446C9 -:10A1B000FFF779FF208E48B101208DF80000E06A9A -:10A1C000CDE9010500216846FBF783FD0020E06230 -:10A1D000206382E70146002009880A0700D5012094 -:10A1E00011F0F00F01D040F00200CA0501D540F097 -:10A1F00004008A0501D540F01000490501D540F062 -:10A2000020007047200800202DE9FF4FA7B01F460F -:10A21000349E299D379C5FEA000817D028784106B4 -:10A2200010D400F03F011E290AD0218811F4FE6FDE -:10A230000CD13A88172A09D3A1F57F42FF3A05D0FD -:10A24000010606D500F03F00122802D004202BB0F2 -:10A250006BE6FE4928984FF0000908728DF81090BF -:10A260008DF834900DAA0A60359A4A60ADF81490C2 -:10A27000ADF890902878032200F03F038646711CC9 -:10A2800004F1180CCB464FF0040AA8F10500CDF8F4 -:10A2900098C01F2B7DD2DFE803F07C7C107C1C7CF7 -:10A2A000867CEF7CEE7CED7CEC7CEF7CEB7C7C7C3C -:10A2B000EA7CE97C7C7C7C7CE800B8F1030F02D06E -:10A2C0008DF810A0EFE232701720A6F801003A8056 -:10A2D000BEE2B8F1050FF3D1B5F801002083ADF867 -:10A2E0001400B5F80310618300287DD088427BD824 -:10A2F00084F808B0A4F806B04FF6FF706084269882 -:10A3000000F0E4FF05203070B01C00904FF0020A0E -:10A3100008AA2899269800F0DCFF00287ED19DF835 -:10A320002600012803D002207070102002E00120D6 -:10A33000707002208346002201A909A805F071F877 -:10A3400030BB9DF80400834522D13A88801CA2EBE3 -:10A350000A0181421CDB0098BDF822100AF1020AB2 -:10A360000180009909A8891C0A46009101A905F0FD -:10A3700058F89DF80400009908AA014450441FFAB7 -:10A3800080FA00912899269800F0A3FF0028D2D0E7 -:10A3900000E069E2BAF1020F40D0A7F800A057E24E -:10A3A0008DF8100054E2B8F1070F89D3B5F8010019 -:10A3B0002083ADF81400B5F803106183A0B1884282 -:10A3C00012D84FF0010A84F808A0B5F80500E08023 -:10A3D00000202073E06900F011FD90B9E16981F877 -:10A3E00006A04FF4205100E078E0E26942F6010057 -:10A3F0009180E16981F80AA0E1690881E1690020A2 -:10A400008873A8F107006084E81D6062269800F058 -:10A410005DFF0720307006F1010A00E06FE00020C8 -:10A420004FF0010BADF8220018E000BFBBF1010FA7 -:10A430000CD0E069807901281FD03AF8021C00BFD7 -:10A440000BF102002AF8021B1FFA80FBBDF8221054 -:10A450000BF102002AF8021B1FFA80FB08AA2899B8 -:10A46000269800F036FF58B10FE0DAE16BE10AE11F -:10A47000AEE0D2E17BE05AE01EE0BDF82010DFE75D -:10A480003988A1EB0B000428D0DABBF1010F36D0DC -:10A49000E069807901280CD0BDF82010A1F57F403B -:10A4A000FF3806D03AF8021CAAF800100BF102009F -:10A4B000B1E1BDF82010F7E7B8F1070F03D0B8F10C -:10A4C000150F7FF4FDAEB5F801102183ADF814101F -:10A4D000B5F80320628309B1914201D901205FE7F9 -:10A4E00001212172A4F806B084F80CB0B8F1050F70 -:10A4F00007D0C0B2691DE26904F074FF08B10A20F8 -:10A500004EE74FF6FF70608404A824A9CDE900103F -:10A51000CDE902762878002300F03F0220462899F2 -:10A52000FFF730FC8146208BADF8140090E1B8F1C4 -:10A53000030FC6D14020ADF89000B5F8010020838C -:10A54000ADF81400289ACDE900210AAB02933988AE -:10A550000022491E8BB294F8201000F024FF8DF8E1 -:10A56000100058BB0B203070BDF828002EE0B8F169 -:10A57000050FA6D18020ADF89000B5F8010020832A -:10A58000B5F803206284ADF81400B2F5007F01D95C -:10A59000072005E742F47C426284289BCDE9003124 -:10A5A0000DF12C0CCDF808C03988491E8BB294F8F7 -:10A5B000201000F0F8FE8DF8100018B18328B5D1F6 -:10A5C0000220BEE00D203070BDF82C00401C22E1BE -:10A5D0004FEADE1000EB400002EB8000404505D959 -:10A5E0005FEA4E607FF56CAE584614E1B5F801C0E5 -:10A5F000ADF814C02978490608D505218DF8341026 -:10A600002978090605D58DF834B031E106218DF899 -:10A610003410E91C289BA8EB000ACDE90013CDF803 -:10A6200008B009911FFA8AF394F8201000226046BE -:10A6300000F0C8FC8DF810008DF834B02978490678 -:10A6400010D52088C00509D5208B01E02008002006 -:10A65000BDF81410884201D1C4F824B058468DF8D2 -:10A6600010B0D8E0832801D14FF002094FF4807078 -:10A67000ADF89000BDF814002083A4F822A009983A -:10A6800060621320C5E0B8F1050FFFF419AEB5F80C -:10A6900001C0ADF814C0218F41B3A1F57F42FE3A4D -:10A6A00024D007218DF83410289A6B1DCDE9003293 -:10A6B00080B2CDF808B040F40043DA46B5F8032084 -:10A6C00094F82010604600F07DFC4FF400718DF886 -:10A6D00010008DF834A0ADF89010832810D0E8B1A8 -:10A6E000218FA1F57F40FE3807D0DCE00A218DF8EC -:10A6F00034104FF6FE712187D6E7A4F838A0A7E002 -:10A700002A4641462046FFF714FC8DF8100008B198 -:10A71000832848D1BDF81400208351E72A464146DA -:10A720002046FFF706FC8DF81000E0BB618F606BE0 -:10A73000CDE9007643185A88998833F8060BFFF75D -:10A7400006FD814684E095F801A0B8F1020F7CD1A6 -:10A750005FEA0A0002D0BAF1010F76D108208DF825 -:10A76000340005A800908DF838A094F820105346C6 -:10A7700000222046FFF7B3FC8DF839008DF83AB07F -:10A7800050B9BAF1010F12D0BAF1000F04D1218FE4 -:10A79000A1F57F40FF380AD0208F40B18DF834B04A -:10A7A0004FF4806000E053E0ADF890000DE00DA89C -:10A7B0003599FBF78EFA81464FF480608DF834B0FE -:10A7C000ADF89000B9F1020F06D0FD48006880791D -:10A7D00028B18DF8100043E0A4F818A038E0B9F1D2 -:10A7E000000F03D081208DF8100043E005A80090F1 -:10A7F00094F82010534601222046FFF770FC8DF894 -:10A80000100020463699FFF74EFC9DF81000F8B96D -:10A8100019203070012038801AE006208DF81000D1 -:10A8200041E02078000723D5B8F1010F20D109209D -:10A830008DF83400A088ADF838000420369907F070 -:10A8400078F80820ADF8900000E011E0A7F800B01B -:10A850009DF8340020B10DA83599FBF73AFA8146EE -:10A86000B9F1000F1CD005E05FEA4E607FF528AD1E -:10A870004FF004092088BDF8901008432080BDF8EF -:10A88000900080050AD5218FA1F57F40FE3805D1C3 -:10A890002998E062A4F830804FF003094846D6E4D6 -:10A8A0009DF8100058B10120307028787070BDF804 -:10A8B000140070809DF810003071052038802088C9 -:10A8C000BDF8901088432080E8E72DE9FF4F01781C -:10A8D000A5B080464FF0010B0BFA01F04FF60901CD -:10A8E000349C0840ADF86C0021884FF00009A1F5B8 -:10A8F0007F42FF3A02D028B1080703D5012029B0D2 -:10A90000BDE8F08F289F4FF0000A04A887F800A048 -:10A910002799269A55460988ADF87C10A8498DF8E4 -:10A9200068A00A728DF810A008603298486098F804 -:10A930000000012830D0022809D0032876D13878C9 -:10A9400020F03F001D303870B8F80400A08098F85F -:10A950000000022804D1387820F03F001B30387006 -:10A9600021AAF91C07208DE80700BDF87C0094F8A7 -:10A970002010C01E83B2B8F80400002200F013FDBE -:10A980000028DBD1B8F80400A7F80100BDF8840066 -:10A99000C01CADF87C005FE198F805108DF86810D8 -:10A9A00098F804004FF40079012802D00228C5D19C -:10A9B00033E1208808F1080600F4FE60ADF86C0071 -:10A9C00010F0F00F1BD010F0C00F05D03088228B94 -:10A9D000904201D005257DE189B9B078C0070ED03D -:10A9E000B2680720CDE90020CDF808A0F388B2882E -:10A9F00094F82010308800F0E5FA00286FD12899EB -:10AA0000BDF86C00491C802845D006DC10280ED00B -:10AA100020280CD0402891D122E0B0F5807F5FD073 -:10AA200048457DD0B0F5806F88D1CBE029E1C006E4 -:10AA300001D5082000E0102081460420ADF814A0C4 -:10AA40001BAA8DF8100000921FA81AA90397CDE940 -:10AA5000011033884A4607212046FFF793F992E018 -:10AA60009DF868004FF00A09002894D121AA072018 -:10AA70008DE80700BDF87C0094F82010401E83B2DA -:10AA8000208B002200F08FFC8DF868000B203870BE -:10AA9000BDF8840019E09DF868004FF00C0900280B -:10AAA0001CD123AA07208DE80700BDF87C00628C2A -:10AAB000401E83B294F82010208B00F074FC8DF8B7 -:10AAC00068000D203870BDF88C00401CADF87C008B -:10AAD00004208DF81000208BADF81400BCE057E086 -:10AAE0003188208B814253D19DF868104FF01209B4 -:10AAF000002918D1616A81B1B178C90748D0B3681B -:10AB00000722CDE90032CDF808A0F388B28894F886 -:10AB1000201000F057FA8DF868001320387000E01C -:10AB200002E0ADF87CB097E0B6F800C0208B844519 -:10AB30002ED19DF868004FF016090028606B08D0F0 -:10AB4000E0B34FF6FF7000215646ADF808A0019023 -:10AB500027E060B1B178C9071AD1618F43181FA8E7 -:10AB6000CDE900075A88998833F8060B09E0B078D8 -:10AB7000C0070DD01FA8CDE90007B288F188604654 -:10AB8000B368FFF7E4FA050066D0062D7AD03FE0FF -:10AB900005253DE0019021AA02A92046FFF700FA11 -:10ABA0000146628FBDF80800824201D00029F1D031 -:10ABB000608F616B08440680019860874CE000005C -:10ABC000200800209DF868004FF0180940B1208B44 -:10ABD000C8B13088208320463399FFF764FA3BE000 -:10ABE00004F118000090237E94F8201001222046E2 -:10ABF000FFF775FA8DF868000028ECD1192038703D -:10AC0000ADF87CB0E7E7052520463399FFF74BFA0E -:10AC10009DF81000032857D05CE0208800F40070F5 -:10AC2000ADF86C0048452CD1208FA0F57F41FE394E -:10AC30007FF4D0AED8F808004FF0160948B1606331 -:10AC4000B8F80C1021874FF6FF716187A0F800A0BB -:10AC500002E04FF6FF702087BDF86C0030F4FE6113 -:10AC600016D0782300220420339906F0C5FD98F809 -:10AC70000000A0702088BDF86C10084320800AE016 -:10AC800000E006252088BDF86C108843208021E074 -:10AC90002188814321809DF8100028B15F484168D8 -:10ACA00004A8FBF716F805469DF8680090B187F8F0 -:10ACB000019087F800B0208B78809DF8680038718B -:10ACC0000520ADF87C0005E05448416804A8FBF776 -:10ACD00000F80546208810F4FE6F22D1208E00B3C4 -:10ACE0002799289B01AD0988ADF87C10DDE9321267 -:10ACF000009385E816001FABE26A2699FFF784FAF5 -:10AD0000054603280DD08DF810B0E06A0590339801 -:10AD10000690002104A8FAF7DCFF00B10546A4F86C -:10AD200030A02798BDF87C1001802846E7E500B5E3 -:10AD300097B0042807D102208DF80000019100216E -:10AD40006846FAF7C6FF17B000BD70B5334C0378FC -:10AD500000222168012B02D0022B44D129E00B787C -:10AD60000BB1042B03D10A712268032111702168F1 -:10AD7000062582880B7905EBC303CA522168082394 -:10AD80000A250A7903EBC2021144C2880A802168AD -:10AD900002890B7905EBC303CA52418920680C2351 -:10ADA000027903EBC202815220680179491C0171CA -:10ADB0001DE00A7482888A802168C288CA8022685D -:10ADC00001891181226841895181C1682068C1606F -:10ADD0006168FAF77EFF0146022806D02068007CF1 -:10ADE000002801D119B1812070BD832070BD0020E1 -:10ADF00070BD406B002800D0012070478178012988 -:10AE000009D10088B0F5205F03D042F601018842E5 -:10AE100001D1002070470620704700002008002064 -:10AE200010B58B7883B102789A4205D10B885BB15B -:10AE300002E08B79091D4BB18B789A42F9D1B0F8B9 -:10AE400001300C88A342F4D1002010BD812010BD38 -:10AE500007282BD012B1012A2CD103E0497801F048 -:10AE6000070102E04978C1F3C201052922D2DFE8D7 -:10AE700001F0031D081017000AB1032070470220DB -:10AE80007047042812D0052810D006280ED058B1DB -:10AE90000EE005280AD0062808D0022808D003E0D2 -:10AEA000062803D0032803D00520704700207047F0 -:10AEB0000F2070478120704710B513880B800B78E6 -:10AEC0001C061FD5FE4CA47A844204D843F010001F -:10AED0000870002010BD94682478C44064F3041303 -:10AEE0000B701378D17803F0030341EA032140F299 -:10AEF0000123B1FBF3F403FB1411926800FB012062 -:10AF0000401C10BD906810BD37B5BDF8041011800D -:10AF10009DF8045029061BD5E94901239468897AD4 -:10AF2000814209D8FE280FD1E80602D58B405B1E6E -:10AF300000E00023237007E0217883409943C5F3A4 -:10AF40000013834019432170107820F01000107016 -:10AF50003EBD2DE9F0410746C81C0E4620F0030017 -:10AF6000B04202D08620BDE8F081082A01D90E2027 -:10AF7000F9E7D34D002034462E60AF802881AA72B5 -:10AF8000E8801AE0E988491CE980810614D4E17858 -:10AF900000F0030041EA002040F20121B0FBF1F291 -:10AFA00001FB1201206800F0E3FA2989084480B20D -:10AFB0002881381A3044A0600C3420784107E1D44D -:10AFC0000020D0E72DE9FF4F85B01546DDE912B628 -:10AFD0008046994623F4404700F0BAFA04000BD0AB -:10AFE000207800060AD5B648817A0698814205D8AD -:10AFF000872009B0BDE8F08F0120FAE722466946B4 -:10B000000698FFF759FF824600208DF80400072EAE -:10B0100018D0012221463046FFF71AFF0028E8D158 -:10B02000207840060ED502208DF80400ADF8088087 -:10B03000BDF80000ADF80C50ADF80A00ADF80E7088 -:10B04000CDF810B05FEA094004D500273D46B84668 -:10B0500001260CE02178E07801F0030140EA0120AC -:10B0600040F20121B0FBF1F2804601FB12865FEA5B -:10B07000494009D5B04507D1A178207901F00301F5 -:10B0800040EA0120A84201D3B54201D90720B0E728 -:10B0900078191FFA80F9B14501D90D20A9E79DF86B -:10B0A000040020B101A8FAF712FE0028A1D1B04592 -:10B0B00007D1A0784FEA192161F30100A07084F84C -:10B0C0000490149800B10780BBF1000F15D00AEB73 -:10B0D00005003A4659460FF0ADFE224669460698ED -:10B0E000FFF7EAFE9DF80000224620F010008DF8E0 -:10B0F000000000990698FFF707FF002079E72DE987 -:10B10000FF4FDFF8BC9182461746B9F80610D9F810 -:10B11000000001EB410100EB810440F20120B2FB91 -:10B12000F0F183B000FB11764D46DDF844803146E6 -:10B13000049800F01DFA29682A898B46611A0C319F -:10B1400001441144AB8889B28B4202D8842007B0F5 -:10B1500050E70499CDB2290603D5A90601D585206B -:10B16000F5E7B9F806C00CF1010C1FFA8CFCA9F840 -:10B1700006C0129909B1A1F800C0A90602D5C4F809 -:10B18000088007E0104480B2A9F80800191A01EB02 -:10B190000B00A0602246FE200499FFF7B5FEE77081 -:10B1A00026712078390A61F30100320AA17840F053 -:10B1B000040062F30101A17020709AF8020060712E -:10B1C000BAF80000E08000262673280602D599F818 -:10B1D0000A7000E00127A80601D54FF000084D468F -:10B1E00000244FF007090DE0CDF80080CDE901966D -:10B1F000E8882146109B069AFFF7E4FE0028A6D1B6 -:10B20000641CE4B2BC42EFD30020A0E72DE9F04774 -:10B21000804600F09DF9070005D000264446284DE1 -:10B2200040F2012916E00120BDE8F087204600F039 -:10B230008FF90278C17802F0030241EA0222B2FBE0 -:10B24000F9F309FB1321006800F092F93044641C03 -:10B2500086B2A4B2E988601E8142E7DCA8F1010051 -:10B26000E8802889801B288100203870DCE720B125 -:10B27000401E10809170002070470120704710B56B -:10B280000F4904460088CA88904201D3822010BD2D -:10B29000096800EB400001EB80025079A072D08871 -:10B2A00020819178107901F0030140EA0120A0810A -:10B2B000A078E11CFFF700FE20612088401C01E01F -:10B2C0002C0800202080E080002010BD0121018298 -:10B2D00070472DE9FC474FF6FF780546A2F800803D -:10B2E000406817468A4680788DF8020068680088B2 -:10B2F000ADF8000000208DF80600288A2C88A042B6 -:10B3000000D304462C822DE0288A401C2882701D20 -:10B310006968FFF785FD18BB3988414501D1601E7A -:10B3200038806888A04222D3B178307901F00301D7 -:10B3300040EA01296946701DFFF772FD80B96989ED -:10B34000414519D0002231465046FFF781FD38B9FA -:10B350006A894A4504D1E968B0680FF03FFD58B1E9 -:10B36000641CA4B2204600F0F3F80600CCD1641EA1 -:10B370002C828220BDE8FC877C807079B871F088CF -:10B38000B8803178F07801F0030140EA012078813B -:10B39000A7F80C90287A324607F10801FFF78CFDD8 -:10B3A00038610020E6E72DE9F04F85B01D46904654 -:10B3B0000F468346DDF838A0DDF8409000F0C8F86D -:10B3C000040009D02078000608D57148807AB84278 -:10B3D00004D8872005B00DE60120FBE7C8F3090675 -:10B3E000224669463846FFF767FD07465046BAF1E0 -:10B3F000070F1AD000222146FFF72AFD0028E9D1C5 -:10B400002078400611D501208DF80400ADF808B071 -:10B41000BDF80000ADF80A00ADF80C60ADF80E50B4 -:10B4200001A8FAF754FC0028D4D12178E07801F083 -:10B43000030140EA0121A278207902F0030240EAE8 -:10B440000220464507D0B1F5007F04D9691E81422C -:10B4500001DD0B20BEE7864201D90720BAE7801B39 -:10B4600082B2AA4200D92A46B9F1000F01D0A9F848 -:10B4700000200F9810B1B9190FF0DCFC0020A9E7EB -:10B480002DE9F0411D4617460E4600F061F8040014 -:10B4900008D02078000607D53D48807AB04203D80E -:10B4A000872060E501205EE5224639463046FFF7F9 -:10B4B00003FD65B12178E07801F0030140EA012045 -:10B4C000B0F5007F01D8012000E0002028700020A6 -:10B4D00049E52DE9F0411D4617460E4600F038F8C3 -:10B4E000040008D02078000607D52948807AB042A9 -:10B4F00003D8872037E5012035E522463946304616 -:10B50000FFF702FDFF2D14D02178E07801F003024F -:10B5100040EA022040F20122B0FBF2F302FB1300EA -:10B5200015B900F2012080B2E070000A60F3010159 -:10B530002170002017E510B50C4600F009F828B17D -:10B54000C18821804079A070002010BD012010BD6D -:10B550000F49CA88824209D340B1096800EB400014 -:10B560006FF00B0202EB8000084470470020704728 -:10B57000C0B2820609D4000605D50548807A484342 -:10B58000401C80B27047084670470020704700009A -:10B590002C08002010B506F08BFB05F026FEFBF70B -:10B5A00011FF0EF04FFB06F083FABDE8104006F0E5 -:10B5B0000FBB10B50C4601F0C1FC80B3204600F073 -:10B5C000ACFA68B322780E2A09D00F2A07D0022AD3 -:10B5D00005D0032A03D0102A2ED0FFDF1DE0A0786B -:10B5E0001E282BD00FDC0C2824D008DC092825D2FB -:10B5F000DFE800F013241724241E1E1A1C00122852 -:10B600001CD1072010BD302818DDA0F13A00032816 -:10B6100014D2DFE800F011130B00002010BD11E080 -:10B620000EE043F20200F9E70420F7E70D20F5E70A -:10B630000F20F3E70820F1E71120EFE70320EDE703 -:10B64000FFDFEAE7FFDFE8E700F067BA70B503461F -:10B65000002002466FF02F050EE09C5CA4F130063E -:10B660000A2E02D34FF0FF3070BD00EB800005EBD7 -:10B670004000521C2044D2B28A42EED370BD30B595 -:10B680000A240AE0B0FBF4F304FB13008D183030F9 -:10B6900005F8010C521E1846D2B2002AF2D130BD74 -:10B6A00030B500234FF6FF7510E0040A44EA00208D -:10B6B00084B2C85C6040C0F30314604005EA003403 -:10B6C0004440E0B25B1C84EA40109BB29342ECD34E -:10B6D00030BD000010B509F0DBFB042803D009F0F1 -:10B6E000D7FB052802D108F0D4F950B909F05CFC69 -:10B6F000032803D009F05EFC032804D107F0AEFA5A -:10B7000008B1012010BD002010BD70B50C460546E3 -:10B71000062102F092F9606008B1002006E00721DE -:10B72000284602F08AF9606018B1012020700020DC -:10B7300070BD022070BD2DE9FC470C4606466946E7 -:10B74000FFF7E3FF00287DD19DF8000058B107F016 -:10B75000E7F9B0427ED00022214630460BF0F9FCDA -:10B76000002874D116E007F042FFB04272D00022E8 -:10B77000214630460BF0E0F8002868D1019D95F88D -:10B780009800303518B9687E08B1012000E000202B -:10B79000804603E0019D95F8498030354FF0010A5D -:10B7A00095F82D004FF00009A0B195F82E00800704 -:10B7B00010D584F8019084F800A084F80290A68047 -:10B7C00095F82F10A171298E2181698E618185F8EC -:10B7D0002D903CE0304602F0A8FA070000D1FFDFD0 -:10B7E000384601F049FD10F0FF0008D084F80190C0 -:10B7F0000D212170A680E08084F802A027E0304669 -:10B8000002F081FA070000D1FFDFB8F1000F21D06C -:10B81000384601F0BCFDA8B19DF8000038B9019888 -:10B82000D0F8BC004188B14201D180F80090304688 -:10B8300007F0DBF884F801900A21217084F8029067 -:10B84000A68000E006E0A97EA17185F8199001208C -:10B85000BDE8FC870020FBE71CB56946FFF755FFF4 -:10B8600000B1FFDF684601F0B1FBFD4900208968A7 -:10B87000A1F89A001CBD2DE9FC4104460E460620A5 -:10B8800002F086F80546072002F082F82844C7B285 -:10B890000025A8463E4417E02088401C80B2208046 -:10B8A000B04202D34046A4F8008080B2B84204D32C -:10B8B000B04202D20020BDE8FC816946FFF725FFB7 -:10B8C0000028F8D06D1CEDB2AE42E5D84FF6FF70FF -:10B8D00020801220EFE738B54FF6FF70ADF800007A -:10B8E0000DE00621BDF8000002F0B9F8044607217A -:10B8F000BDF8000002F0B3F80CB100B1FFDF002189 -:10B900006846FFF7B8FF0028EBD038BD2DE9F041BD -:10B91000D4A0D64C06790025076884F8425001F07F -:10B920004EFB84F8435004202087102060874FF698 -:10B93000FF70A4F80A0184F80C51A4F80E0184F8F1 -:10B94000315004F8EE5BC94804F8C05C04F8BA5CF6 -:10B950008030A57340F87D7FC4490671FD31481ED3 -:10B960000BF095F80A20207503206075A075E0752E -:10B970000E20207606206076A076E076BDE8F08185 -:10B980002DE9F041B64C0D466060217007F015F8C6 -:10B99000FFF7A1FFFFF7BAFF207809F01CF8B349C1 -:10B9A000C431A1F181000F46064607F041FF6068EF -:10B9B0000BF038F820780CF0C9FB284609F0C1FEDE -:10B9C0003946304607F0E8F860680BF04DFC01F0AE -:10B9D000F6FAA649002081F84300CFE710B501240C -:10B9E0000AB1002010BD21B1012903D00024204656 -:10B9F00010BD02210DF096FBF9E72DE9F047040098 -:10BA000000D1FFDF994D002695F8310058B16670DE -:10BA10001020207095F83200A07095F83300E07087 -:10BA200085F831606AE0287840B12C22A91C2046B4 -:10BA30000FF000FA0E2020702E705FE095F82E00B7 -:10BA400060B10120E07095F82F00A07095F83000EB -:10BA500060700F20207085F82E604FE0844802212E -:10BA60008246FFF708FF00B1FFDFB5F80E91062010 -:10BA700001F08EFF0746072001F08AFF3844C7B265 -:10BA8000781C00F0FF0800BFB5F80E01B84213D1D2 -:10BA90000021204607F05EFD58BB95F8340080B3C6 -:10BAA0006670132020701C21A01C0FF03AFA0220AF -:10BAB000A07085F8346021E040451BD1002120466C -:10BAC00007F000F8E8B12078132817D1A0783C28B7 -:10BAD00014D1A088072101F0B0FF050000D1FFDFDD -:10BAE000288806F082FFA088072101F0B8FF00B186 -:10BAF000FFDF03E02146FFF71EFE10B10120BDE885 -:10BB0000F087FFE702215046FFF7B5FE18B9B5F8F8 -:10BB10000E114945B8D10020F1E76EE710B508F0E5 -:10BB2000C8FE00B1FFDF0AF07BFF00B1FFDF07F0C6 -:10BB300035FE09F0EFFD00B1FFDF0BF093FB00B124 -:10BB4000FFDF06F0F7FF00B1FFDF0CF0F9FA00B1FC -:10BB5000FFDFFFF7C0FEFFF7D9FE06F017FF02F088 -:10BB6000C1F801F02CFA4148002180F8431001711E -:10BB7000012141710222C270017010BD10B53B4C11 -:10BB8000207828B10A21BDE810400E2001F0E4B968 -:10BB9000FFF7A0FD08B10C2002E001F010FA002030 -:10BBA0002071012060710A21E170207010BD70B514 -:10BBB0002E4C0546207828B1BDE8704039210E2072 -:10BBC00001F0CAB9FFF786FD08B10C2012E094F825 -:10BBD000430008280DD204EB0010102229464430FF -:10BBE00001F0C7F994F84300401C84F8430000209A -:10BBF00000E007202071012060713921E170207080 -:10BC000070BD70B5194C0546207828B1BDE870406C -:10BC10000B210E2001F0A0B9287818B1012801D01D -:10BC2000122016E094F8C400082823D2FFF752FD32 -:10BC300008B10C200DE00E482B7894F8C4106A1C53 -:10BC4000463806F01AF994F8C400401C84F8C40081 -:10BC500000202071012060710B21E170207070BD07 -:10BC600044000020FFFFFFFF1F00000038080020F5 -:10BC7000460900200720ECE710B5FE4C207828B1DB -:10BC80003821BDE810400E2001F066B9FFF722FD13 -:10BC900008B10C2002E0002084F84300207101204C -:10BCA00060713821E170207010BDF248017819B13F -:10BCB0000F210E2001F050B9002101710E21817079 -:10BCC0000F21C170FF2181714FF6FF710181EA4997 -:10BCD00049680A7882728A8882814988C1810121F3 -:10BCE000417101707047E3490A781AB13B210E2077 -:10BCF00001F032B90088A1F80A01012081F80C0195 -:10BD000000220A7148713B22CA700870704710B552 -:10BD1000D84C207828B12B21BDE810400E2001F02E -:10BD20001BB90821A01D05F0F9FA0020207101209F -:10BD300060712B21E170207010BD70B5CD4C217861 -:10BD400029B1BDE8704031210E2001F005B990F90C -:10BD50000000042814D098B1011D11D010F1080F73 -:10BD60000ED010F10C0F0BD010F1100F08D010F105 -:10BD7000140F05D010F1280F02D01220207103E01B -:10BD8000002506F0BBF825713120E07001206071BC -:10BD9000207064E730B5B74D04468DB0287828B1DF -:10BDA0002A210E2001F0D8F80DB030BD1022214616 -:10BDB000684601F0DEF8102204F1100104A801F039 -:10BDC000D8F868460DF0D6FF10222C46A81D08A909 -:10BDD00001F0CFF8002020710E20A0702A20E07022 -:10BDE000012060712070DFE72DE9FF41A14C207830 -:10BDF00028B13A210E2001F0AFF8BDE8FF814FF0E5 -:10BE0000000884F80680B4F80A01ADF8040002A91D -:10BE1000FFF77BFC20B1002101A8FFF72CFDE8BB58 -:10BE2000BDF80400ADF8000002A980B2FFF76DFC78 -:10BE300000B1FFDFBDF8000001F077FF050000D181 -:10BE4000FFDF2846039F01F0A9FA80F0010697F86A -:10BE50004950BDF8000001F056FF070000D1FFDF98 -:10BE6000384601F094FA80F0010255EA020019D038 -:10BE7000A179BDF8000004EB410108817D49A37957 -:10BE80001831585C65F300005854A37962F34100FF -:10BE90005854A27966F38200505400E00DE0A07976 -:10BEA000401CA07100216846FFF7E5FC28B9BDF8E9 -:10BEB0000000BDF804108842B6D1012084F8048047 -:10BEC00060713A21E170207097E770B5694C0546C2 -:10BED000207828B1BDE8704034210E2001F03CB834 -:10BEE00008F0D6FF052804D0284608F061FD0020A0 -:10BEF00000E00C202071012060713421E17020707D -:10BF0000ADE65C48017819B10E21084601F024B86D -:10BF10005949CA68C0F80620098A41810021017187 -:10BF2000012141710E22C2700170704770B5514CF1 -:10BF30000646251D207828B1BDE8704032210E202C -:10BF400001F00AB83146002006F00EFF287058B9FB -:10BF500000213246084607F053FD287020B94648B4 -:10BF60003168C160B1880182012060713221E170C5 -:10BF7000207074E670B53F4C0546207828B1BDE8C6 -:10BF8000704030210E2000F0E7BF08F0C4FD10B96A -:10BF900009F064FE68B1287809F034FC287807F0CD -:10BFA000A7FD00202071012060713021E170207018 -:10BFB00055E60C20F6E72DE9F0412E4C0646251DEE -:10BFC000207828B1BDE8F04117210E2000F0C4BF51 -:10BFD0003146012006F0C8FE2870012768B93246B4 -:10BFE0000121002007F00CFD287030B93068E063B3 -:10BFF000B088A4F8400084F8427067711720E070A0 -:10C000002770BBE438B51B4D0446287828B1BDE83D -:10C01000384030210E2000F09FBF227961798A429A -:10C0200015D0A079E379984211D01F2A0FD81F2983 -:10C030000DD8002211460EF03DF940B90022E079FA -:10C0400011460EF037F910B9207A072801D91220CD -:10C050001BE04FF6FF70ADF8000008F0A5FFD8B95F -:10C0600008F0A8FFC0B908F013FFA8B9002168467E -:10C0700004E000003808002044000020FFF7FBFB2C -:10C0800050B1204605F032FE002028710120687171 -:10C090003E21E970287038BD0C20F6E72DE9FC47F9 -:10C0A000FE4C054694F82E0028B128210F2000F000 -:10C0B00053FFBDE8FC87282084F83000012184F874 -:10C0C0002E10A8784FF000091A2825D00EDC16286B -:10C0D00031D2DFE800F030303030302130303030D5 -:10C0E0003030303030303030302121212A2822D0F9 -:10C0F0000BDCA0F11E000C281DD2DFE800F01C1C98 -:10C100001C1C1C1C1C1C1C1C1C0D3A38042812D2A4 -:10C11000DFE800F0110211022888B0F5706F0AD232 -:10C120001F20884684F82F0028886946FFF7EDFA1B -:10C1300018B1022019E0122017E09DF80000019FBD -:10C14000002806D007F1CE07019E05D106F1B506FD -:10C1500004E007F1B407F7E706F1CF06684600F000 -:10C1600023FF08B1387818B10C2084F82F00A0E71D -:10C1700087F80080A878307084F82F90684600F027 -:10C1800025FF96E77CB5C54C0546207820B12521D2 -:10C190000E2000F0E1FE7CBD28886946FFF7B5FA65 -:10C1A000002168B102202071BC4881600173E180E8 -:10C1B0000E20A0702520E0700120607120707CBDF1 -:10C1C000019A104612F1300282F836108368A3609B -:10C1D000037B237392F83630002BF5D12888E0805A -:10C1E000E6E72DE9FC41AD4C064694F82E0028B157 -:10C1F00010210F2000F0B0FEBDE8FC811F2084F864 -:10C200002F00102084F83000012784F82E70308829 -:10C210006946FFF77AFA70B9684600F0C5FE50B17A -:10C22000019D9DF8000030350028019805D0E230CE -:10C23000017841B904E0022006E0D0F8BC00F7E73D -:10C2400095F82D1019B13A2084F82F00D4E795F80D -:10C250002E1089070CD1042101709DF8000020B92F -:10C2600001993088D1F8BC104880684600F0AEFED5 -:10C27000002084F82F0085F82D70BDE72DE9F047E8 -:10C28000864D0646287828B1BDE8F0471D210E20CE -:10C2900000F062BE4FF01F0985F80490012068711C -:10C2A0001D21E970287008F0F3FD0C2704284ED0FA -:10C2B00005284CD0B0791224012800D0E8B9307894 -:10C2C00008B1012819D1F07908B1012815D1708879 -:10C2D00043F6FD71021F30248A420ED2B288121F2B -:10C2E0008A420AD22887B0886887B0794FF0000860 -:10C2F0004446012803D050B111E02C710CE495F8AC -:10C30000420020B3654A3C320121084602E0644AFB -:10C310000021012007F074FB040000D0FFDFF0795A -:10C32000012800D010B907F093FB044614B185F83A -:10C330000490E3E73078012801D018B109E000212A -:10C34000022001E00021012007F097FB08B12F71C6 -:10C35000D4E785F80480D1E770B5504C217829B135 -:10C36000BDE870401E210E2000F0F6BD1F21217196 -:10C37000012161711E22E270217002781221012ACE -:10C3800000D01AB9407818B1012801D0217166E4B3 -:10C3900000260C25012A08D008F07AFD052802D0D5 -:10C3A00008F034FA30B1257159E4618F208F08F01C -:10C3B000BFFBF7E7267152E42DE9FE4F0546AFF2C9 -:10C3C0005C71D1E90001354E01908A4696F82E0045 -:10C3D00030B103B02121BDE8F04F0F2000F0BCBD0B -:10C3E0001F2086F82F00212086F830004FF001082A -:10C3F00086F82E80298843F6FD730A1F30209A4262 -:10C400007ED26A88141F9C42FAD28A4278D8EA897E -:10C4100040F67B43911F9942F2D2298A8C1F9C429D -:10C42000EED28A42F2D86A8AB2F5FA7FE8D2AA8AB4 -:10C4300040F67744A2F10A03A342E1D2B2EBD10F56 -:10C440005ED9E98A2A8B9142E0D82979122011B16C -:10C45000012955D102E069790029F9D1297B09B177 -:10C460000129F6D108F014FD4FF00C0905286ED013 -:10C4700008F00EFD0428FAD096F83400002866D1A2 -:10C4800007F0B5F8A0F57F41FF39F8D1062102A8E1 -:10C4900001F0A4FA040050D0032103E03808002082 -:10C4A000500000200CF02CFB96F8030100901B229A -:10C4B00096F802312088114601F070FB04283ED026 -:10C4C00000B1FFDF208806F08FFA04F10D07B4F801 -:10C4D00000B00421384604F021FF594638460CF0DC -:10C4E00004FCFDA03F1D006800900321684604F095 -:10C4F000A0FE002069460A5C3A54401CC0B200E02D -:10C500006FE00328F7D3288A6080688AA080A88A11 -:10C51000E08096F8051196F8040108F0C8FA014683 -:10C52000204608F0F0FA002784F8367084F8377057 -:10C53000687968B101280FD10CE0092051E020880A -:10C54000062101F08CFA00B1FFDF072049E071E01D -:10C55000677601E084F81980D5F80600C4F81A005F -:10C560006889E0830198A06084F80CA084F8C480F6 -:10C570008DF800700121684604F05BFE9DF8000014 -:10C5800000F00701C0F3C1021144C0F34010084499 -:10C590008DF80000401D2076092801D20830207651 -:10C5A000002120460CF0ACFA287B18B1012805D0F8 -:10C5B000FFDF24E00021C94A012005E096F842008F -:10C5C00098B10121C64A084607F01AFAB8B1208886 -:10C5D00006F00BFA2088062101F041FA00B1FFDFD6 -:10C5E0001F2086F82F00BDE8FE8F208806F0FDF999 -:10C5F0002088062101F033FAE0B1FFDF1AE0287944 -:10C60000012800D010B907F023FA50B921460320C1 -:10C6100007F033FA28B96A882988204608F005FA15 -:10C6200058B1208806F0E1F92088062101F017FAB8 -:10C6300000B1FFDF86F82F90D5E784F8B87086F850 -:10C640002F70D0E738B5A64C3C3C207820B1222191 -:10C650000E2000F081FC38BD1F202071012565717E -:10C660002220E070257008F013FC052802D00C2071 -:10C67000207138BD00202071684608F090FA00282B -:10C68000F7D10098008806F0B0F9009806210088DC -:10C6900001F0E5F900B1FFDF904884F834500C3820 -:10C6A0000078FCF78DFF38BD2DE9F0418C4D044634 -:10C6B0003C3D95F82E0028B1BDE8F04123210F2024 -:10C6C00000F04ABC1F2085F82F00232085F8300099 -:10C6D000012085F82E00618840F67B438A1F3020B8 -:10C6E0009A4251D2A288961F9E424DD291424BD877 -:10C6F000E188B1F5FA7F47D2218940F67746A1F16A -:10C700000A03B34240D2B1EBD20F3DD96189A2896D -:10C71000914239D84FF000082088062101F08DF9A8 -:10C7200006004FF0020707D000F030FC20B1D6F829 -:10C73000BC00017839B902E085F82F7061E4D6F8C1 -:10C74000D010097809B13A201EE005218171D6F890 -:10C75000BC004146A0F80880D6F8BC20A0885081D3 -:10C76000D6F8BC20E0889081D6F8BC202089D08102 -:10C77000D6F8BC00028943899A4204D88279082AF3 -:10C7800001D89A4203D3122085F82F0039E4228879 -:10C790004280D6F8BC00077085F82F1031E42DE9EF -:10C7A000FE434F4C06463C3C207830B103B0242178 -:10C7B000BDE8F0430E2000F0CFBB012565712420B9 -:10C7C000E070257030460CF0B2FA08B1002000E0AD -:10C7D0001220207100282DD1414884F8FC504430AB -:10C7E000316840F87D1F317901714FF0000884F8FD -:10C7F000FC806946062001F0ACF800B1FFDF684616 -:10C8000001F085F8A0B9BDF8047000BFBDF80400C0 -:10C81000062101F012F9060000D1FFDF86F8C450AE -:10C82000684601F074F818B9BDF80400B842EDD1BB -:10C8300084F80480BDE8FE8370B5294D06463C3D72 -:10C8400095F82E0028B1BDE8704026210F2000F099 -:10C8500083BB1F2085F82F00262085F8300001209B -:10C8600085F82E003088062101F0E7F8040007D093 -:10C8700000F08CFB20B1D4F8BC00017831B901E0A4 -:10C8800002200CE0D4F8D010097809B13A2006E073 -:10C8900005210170D4F8BC1030884880002085F84C -:10C8A0002F0074E50E483C38017819B106210E209E -:10C8B00000F052BB002101710E2282700622C2706C -:10C8C000C0F80610C0F80A10817941F001018171A9 -:10C8D0000121417101707047112233005000002086 -:10C8E0007408002070B5F84E054696F82E0028B161 -:10C8F000BDE870402C210F2000F02EBB1F2086F8D1 -:10C900002F002C2086F83000012086F82E00288881 -:10C91000062101F092F8040007D000F037FB20B1A7 -:10C92000D4F8BC00017831B901E0022020E0D4F84D -:10C93000D010097809B13A201AE094F86410D1B106 -:10C94000D5F802104160D5F80610816054F8BC0F8C -:10C95000698910228181206805F10C010E300EF0EA -:10C9600069FA21680320087021682888488000201F -:10C9700086F82F000BE50C20FAE770B5D24E04467E -:10C980000C25307828B1BDE8704018210E2000F049 -:10C99000E3BA08F009FB032852D008F00BFB032888 -:10C9A0004ED0607908B1012829D1A07908B10128B9 -:10C9B00025D1A07B28B1012803D0022801D003286B -:10C9C0001DD1607BD8B1C00819D162884FF4804076 -:10C9D000824202D82188814203D9207901280ED1D0 -:10C9E00018E0207930B1012814D0022805D003289E -:10C9F00005D102E0202A0BD30CE0A0290AD220792D -:10CA0000042805D12088202802D36188884201D9D2 -:10CA1000122515E0207986F83600607910B10128DA -:10CA200004D00DE0A94A0021204606E096F8420015 -:10CA300030B1A54A01213C32204606F016F90546E0 -:10CA40000120357170711821F17030709FE410B5BC -:10CA50009D4C217829B11A21BDE810400E2000F02C -:10CA60007BBA01781F2902D91220207106E000212B -:10CA700021710278411C104606F0A8F9012060716E -:10CA80001A21E170207010BD10B58F4C217829B1AA -:10CA90002021BDE810400E2000F05EBA01781F2969 -:10CAA00002D91220207106E0002121710278411C78 -:10CAB000104606F07AF9012060712021E1702070A3 -:10CAC00010BD2DE9FC41804C217829B1BDE8FC4125 -:10CAD0001B210E2000F040BA012767710C21217143 -:10CAE00000780026012803D000286AD012205CE0DC -:10CAF00006F085F800287ED094F83600A0B1012811 -:10CB000012D0042810D008F055FA002873D108F08C -:10CB10004BFA18B108F048FA02286CD1002008F04E -:10CB200074FEE0B3FFDF4AE008F03EFA002862D16D -:10CB300008F040FA00285ED105F0F2FFA0F57F4131 -:10CB4000FF3958D1072101A800F048FF5F49054689 -:10CB50000C398860280000D1FFDF032128460BF044 -:10CB60001DFF284606F0FCF994F8091194F8080115 -:10CB700008F023FA0146284608F04BFA94F807011A -:10CB800000901B2294F806312888114601F006F81F -:10CB900068B1042800D0FFDF2888072100E00EE0FC -:10CBA00000F05DFF00B1FFDF0720207123E028883F -:10CBB00005F01AFF284608F028FE00B1FFDF2671B5 -:10CBC00019E008F0F1F9032803D008F0F3F903287D -:10CBD00011D108F0ECF90546002008F027FD50B906 -:10CBE000267145B1288805F000FF2888072100F04C -:10CBF00036FF00B1FFDF1B20E0702770BDE8FC812D -:10CC00002DE9F041304C0646207828B1BDE8F041CE -:10CC10002D210E2000F0A0B93088072100F00DFF73 -:10CC200005004FF0010720D095F8D10040B995F8E4 -:10CC30003C000F2801D0102802D195F8040150B112 -:10CC40000C2020710E20A0702D20E0703088E08034 -:10CC50006771277072E51022B11C05F1D2000EF049 -:10CC6000E9F885F8D1700020EBE70220E9E770B51C -:10CC7000154C0546207828B1BDE870402E210E20C5 -:10CC800000F06AB92888072100F0D7FE022178B1A8 -:10CC900090F8D1202AB990F83C200F2A04D0102A0D -:10CCA00002D00C20207104E080F8D1100020F9E7B8 -:10CCB00021710E20A0702E20E0702888E0800120D5 -:10CCC00060712070EDE50000380800205000002061 -:10CCD0007CB5C54C0546207820B137210E2000F0E8 -:10CCE0003BF97CBD28886946FEF70FFD38B102206C -:10CCF0002071012060713721E17020707CBD0198A6 -:10CD00007F22014680F8382080F83920002280F800 -:10CD10003A20A87801F8280FE878487028798870B8 -:10CD20002271E6E71CB5B04C217821B113210E2009 -:10CD300000F012F91CBD00886946FEF7E6FC08B158 -:10CD4000022005E0019890F82810012902D00C205B -:10CD5000207106E0382100222271095C21720088CE -:10CD6000E080012060711321E1700E21A17020701C -:10CD70001CBD2DE9F0419C4C0546207828B1BDE84A -:10CD8000F04135210E2000F0E7B8A87808B101285D -:10CD900003D1A888B0F5FA7F01D912202071288824 -:10CDA000072100F04AFE0126A0B1002780F8C870D4 -:10CDB000A988A0F8CA1080F8A460A978012900D039 -:10CDC000002180F8C81090F8A50008B108F01CFEFA -:10CDD000277101E00220207166713520E070267015 -:10CDE000ACE42DE9F041804C0546207828B1BDE83F -:10CDF000F0413C210E2000F0AFB82888072100F058 -:10CE00001CFE012358B382886D88C688418803EBD5 -:10CE10004207BD4217D342F210777E43BF107943D9 -:10CE2000B6FBF1F1491E89B24FF4FA76B14200D94E -:10CE300031468D4200D22946491C521CB1FBF2F109 -:10CE40005143491E8AB290F8F01001B90284E28081 -:10CE50000020207163713C20E07023706EE402209A -:10CE6000F7E770B5604C0546207828B1BDE8704002 -:10CE700033210E2000F070B808F096F808B10C20AD -:10CE800017E0297889B10A290FD014290DD01E295D -:10CE90000BD0282909D0322907D04B2905D0642985 -:10CEA00003D0FF2901D0122003E0284608F04FFDEF -:10CEB00000202071012060713321E1702070F0E4C6 -:10CEC00049490A781AB13F210E2000F045B80022E6 -:10CED0000A710278454B4AB1012A0CD01220087120 -:10CEE000012048713F22CA700870F4E4D0F80100B4 -:10CEF000C3F80200F4E7D0F80100C3F80600EFE73A -:10CF000070B5394C0546207828B1BDE870403D2108 -:10CF10000E2000F021B808F047F810B908F04AF8E0 -:10CF200008B10C2003E0287805F060FF0020207194 -:10CF3000012060713D21E1702070B2E410B50178EC -:10CF4000402907D22A4A52F8211019B1801C88477B -:10CF5000012010BD002010BD234A92F83130002B73 -:10CF600006D182F8320082F83310012082F83100B5 -:10CF7000B1E430B5134606E0CC18D51A14F8014CCC -:10CF80005B1E4455DBB2002BF6D130BD90F8491042 -:10CF900041B990F8981029B190F89800042801D070 -:10CFA000012098E4002096E40178406821B190F8CF -:10CFB000490010B100208EE4E8E701208BE40A4824 -:10CFC0000021C0F8F81080F8C41084E40178012929 -:10CFD00009D1406890F8A510002904D0002180F8FC -:10CFE000A51008F011BD76E43808002038090020AB -:10CFF0004CB301003D3070470844C01D424301F16D -:10D000003D00104480B2704770B51C460546A0181C -:10D01000049BC01D00FB03F204F13D00104486B2E6 -:10D02000B14238BFFFDF1C2128460DF07AFFA6F180 -:10D030001C0080B22C752880B0F5004F88BFFFDF40 -:10D0400070BD008870472DE9F04F0E468188044678 -:10D0500000F11C0AC088154620F4004221F4004368 -:10D06000002721F4004820F400499A4208D100F436 -:10D07000004001F4004188421CBF0020BDE8F08F51 -:10D08000C14517D9207DA9EB0801091AC91F8D4296 -:10D0900027DCC11D0AEB08000144C91E71603581FF -:10D0A000F7603782011D3160058047800120A07440 -:10D0B000BDE8F08F2088217DA0EB0800401AB0F178 -:10D0C000070B0ED4BBF11B0FB8BFFFDF5D45D4BF0C -:10D0D00028461FFA8BF0291A0A04120C18BF4A4579 -:10D0E00003DDA7740020BDE8F08F217DCB1D0AEB86 -:10D0F00008010B44DB1E7360308104F11C03F360F4 -:10D1000032820B1D336008804A800120A074BDE884 -:10D11000F08F2DE9F041044600F11C02808820F4D4 -:10D120000043A07C002808BFBDE8F081D018028829 -:10D13000438813448B423CBF0020BDE8F0810027A8 -:10D1400091429CBF0180478013D9891A0D042D0C90 -:10D1500045800ED0A088261D20F40040854288BF5F -:10D16000FFDF30884FF4004121EA0000284330807F -:10D1700008E0217D0088CB1D184481B22288201D43 -:10D1800000F09AFAA7740120BDE8F08130B4B0F83D -:10D1900002C08488034600F11C052CF4004028449A -:10D1A000A44503D10020D88130BC7047B3F80AC031 -:10D1B0000488A44509D34088ACEB040CA0EB0C0018 -:10D1C00084B20CEB0500C01E06E0A4EB0C041D7D30 -:10D1D000A4B2AC446044001DB1F800C0A44588BFAF -:10D1E0000C80B3F80AC0BCF1000F0CBF4FF0010C6B -:10D1F0004FF0000C82F800C00988D98130BC70471C -:10D200002DE9F041044600F11C01408820F4004063 -:10D210004518E089002808BFBDE8F081618908440D -:10D2200080B2608129886A881144814238BFFFDF5B -:10D2300028886D88628941190027914218D175B1FB -:10D240006088A61C20F40040A84238BFFFDF308869 -:10D250004FF4004121EA00002843308007E0217D9F -:10D260002288CB1D184481B2A01C00F025FA6781EA -:10D27000E7810120BDE8F0812DE9F0470189B0F890 -:10D2800002800027044600F11C0A414518BF4FF4F4 -:10D29000004938D021F400400AEB00014E886EB1FD -:10D2A000208904F1080520F40040B04238BFFFDFB8 -:10D2B000288829EA0000304328801FE0207D238948 -:10D2C000C21D088823F4004510442188284480B2F8 -:10D2D00004F1080C88420AD2091A89B21B32914221 -:10D2E0002CBF03F4004129EA030004D204E0401AF1 -:10D2F00080B229EA03010843ACF80000781C2189B8 -:10D3000087B24145C6D13846BDE8F0872DE9F047E0 -:10D31000B0F806800B46044600F11C01B0F80890F6 -:10D32000408828F4004C01EB0C05804504BF002028 -:10D33000BDE8F087002A1CBF281D106023B1227DA4 -:10D34000291D18460DF076FD2F886D8885B1E819E6 -:10D3500087B2E088A61D20F40040A84238BFFFDF56 -:10D3600030884FF4004121EA00002843308007E074 -:10D37000207D2288C31DD81981B2A01D00F09CF920 -:10D38000C84504BFE08820813846BDE8F087418861 -:10D39000808881420CBF0120002070474188C088EE -:10D3A00088420CBF01200020704730B44488828836 -:10D3B00000F11C0324F4004C22F400416344944225 -:10D3C0001BD04289C48915191C885A88A3189D420C -:10D3D00016D312B18A4210D212E0037D0CF1070C71 -:10D3E0001A196244008892B2801A80B2223398429D -:10D3F00001D211B104E08A4202D130BC0020704752 -:10D4000030BC012070472DE9F0078588C48800F101 -:10D410001C06024625F4004C24F4004925F4004A79 -:10D42000002024F4004306EB0C074FF00108D1451F -:10D430000AD104F4004405F40045AC4204D0108243 -:10D44000BDE8F00700207047634506D9147DA3EBC3 -:10D450000C031B1BDD1F002305E01488157DA4EBC6 -:10D460000C04641BE51F002DE9DB94895CB13C884A -:10D470007F8847B1DB1BD0748B42E0DB908930445E -:10D48000001BC01E12E02D1BD0748D4206DB107DE8 -:10D490009389C01D60443344184406E08B42CEDBC0 -:10D4A00082F8138090893044001BC01E1182BDE8B1 -:10D4B000F00770472DE9F05F044600F11C088088F2 -:10D4C000924620F4004B208A894608EB0B0608B1EF -:10D4D000484502D20020BDE8F09FA089002804BF83 -:10D4E00000273D4605D0378875887919884218BFCE -:10D4F000FFDFE07C50EA050101D078B338E0A08975 -:10D5000050B1217D4044C91D59440844B4F8151058 -:10D5100020F8031DE17D8170A18907EB09004944D2 -:10D52000A181308000257580207DBAF1000F09D0DF -:10D53000C31D30882288184481B2201D00F0BCF839 -:10D54000A5813AE0A189C01D58444144084430F8FF -:10D55000031DA4F815108078E0752EE0FFE7A08980 -:10D56000B4F815104044C01B20F8031DE17D817004 -:10D5700005EB090085B2A089BAF1000F4844A081EB -:10D580003780758010D0A088261D20F40040A84266 -:10D5900038BFFFDF30884FF4004121EA0000284304 -:10D5A00030800020A08108E0A0894044C01B30F8F2 -:10D5B000031DA4F815108078E07500202082A07467 -:10D5C0000120BDE8F09F10B4B0F802C0848800F1DB -:10D5D0001C022CF400431344A44504D0B0F80AC044 -:10D5E000BCF1000F02D010BC0020704703F1040C06 -:10D5F000C1F800C0007D00F1070C0CEB0300C01E59 -:10D60000486018880881CA605B880B8220B9D01EE8 -:10D6100048600B810020088210BC0120704770B563 -:10D62000044600F11C018288408820F4004319441C -:10D63000904205D06289002A04BFE289002A01D005 -:10D64000002070BD0A884D8885B1A61C20F40040DA -:10D65000A84238BFFFDF30884FF4004121EA0000C4 -:10D66000284330800020E081012070BD207DC31D53 -:10D67000981881B22288A01C00F01EF8F2E7002161 -:10D680008181C1740182817470478289002A04BF3C -:10D6900000207047828800F11C0322F400421A44E3 -:10D6A000B2F800C0BCF1000F1DBF037D121D1A446B -:10D6B000DA1E4A608089704710B4B0F800C02CF4BC -:10D6C0000044214489B24FF4004491420AD2521AD4 -:10D6D00092B21B339A422CBF0CF4004224EA0C0194 -:10D6E00004D204E0891A89B224EA0C0211430180B1 -:10D6F00010BC70472DE9F04188464FF6FC7102F1ED -:10D7000003021E46040002EA010509D00027E01CBE -:10D7100020F00300A04200D0FFDF201D01210CE01B -:10D720000127F4E7024628442FB9B14201D203464B -:10D7300000E000231360491CC9B2B142F2D9011BB9 -:10D74000C8F80010002F04D10EB1201D00E0002009 -:10D750002060BDE8F081024600201168002902D057 -:10D76000084609681160704702680A6001607047E6 -:10D770004FF6FC73C91C1940101A001F90FBF1F002 -:10D78000C0B270474FF6FC73C91C1940001D01FB65 -:10D7900002007047F8B5D24D04460E46A878A04264 -:10D7A00000D8FFDF05EB8607B86A50F8240000B107 -:10D7B000FFDFB868FFF7CFFF05000DD0B86A062E6F -:10D7C00040F824500AD0082E00D3FFDFC548294670 -:10D7D00050F82620204690472846F8BDC048C24B46 -:10D7E0007A30A0F12E0200902946204609F08FF8E9 -:10D7F000F2E72DE9F84F8046DDF828901E4603EB4E -:10D80000090093468A46C4B25FEA080707D000259C -:10D81000FF2800D9FFDFBAF1000F03D101E0012595 -:10D82000F6E7FFDF08F1030020F00301414500D0D7 -:10D83000FFDFCB4500D9FFDF65B9A94A00204C3294 -:10D840004FF6FF7110705180A74A1070A44A7A32C7 -:10D8500010705180A24880F800B046708470C47087 -:10D860000471447180F80690DFF878B2C671002622 -:10D870000BF1400B8146FF1C27F003000746002DEB -:10D8800002D109EB860188603BF8162019F80630B2 -:10D8900001D04FF000006946FFF72CFF0098761C7E -:10D8A000F6B20744082EE6D3FF1C27F003002346F8 -:10D8B000064675B1002002226946FFF71BFF00985B -:10D8C0003118002003464E46C91C21F003021DB149 -:10D8D00010E0C9F84800EEE706EB80070021BA62C5 -:10D8E00006E000BFD7F828C04CF82130491CC9B267 -:10D8F000A142F7D3401CC0B202EB84010828E3D355 -:10D90000A1EB0800AAF800000020BDE8F88F10B5D0 -:10D91000044604F075F808B1102010BD2078704A54 -:10D92000618802EB800092780EE0836A53F8213020 -:10D9300043B14A1C6280A180806A50F82100A06037 -:10D94000002010BD491C89B28A42EED861800520B2 -:10D9500010BD70B505460C46084604F051F808B1F4 -:10D96000102070BD082D01D3072070BD2570002048 -:10D97000608070BD0EB56946FFF7EBFF00B1FFDFB9 -:10D980006846FFF7C4FF08B100200EBD01200EBDA0 -:10D9900010B50446082800D3FFDF5148005D10BDD4 -:10D9A0003EB5054600246946FFF7D3FF18B1FFDFF7 -:10D9B00001E0641CE4B26846FFF7A9FF0028F8D034 -:10D9C0002846FFF7E5FF001BC0B23EBD44498978F9 -:10D9D000814201D9C0B27047FF2070472DE9F04164 -:10D9E0000C460546062901D0072C10D13C4FB86CD7 -:10D9F000FFF7B1FE02004FF6FF7604D00221B86CAB -:10DA0000FFF7B6FE00E030462880B04202D1002089 -:10DA1000BDE8F0812146FFF7BDFE040002D1288851 -:10DA200000F050F82046F3E7A0F57F42FF3A01D01E -:10DA3000082901D300207047ACE6A0F57F42FF3AE9 -:10DA40000BD0082909D2264A9378834205D902EBE4 -:10DA50008101896A51F820007047002070472DE944 -:10DA6000F04104460D46A4F57F4143F20200FF3920 -:10DA7000CED0082D01D30720CAE719494FF000087E -:10DA80008A78A242C4D901EB85072146BA6A52F8C6 -:10DA90002460002EBCD0134A08462032314652F88A -:10DAA00025209047B96A062D41F8248001D0072D22 -:10DAB00002D1204600F006F83146B868FFF754FE60 -:10DAC0000020A5E710B5064CC2B20221A06CFFF7FA -:10DAD00059FE0146A06CBDE81040FFF745BE0000AE -:10DAE000480900204CB40100560000200146A0481F -:10DAF000002200680260037A00EB830040F80C2FDC -:10DB00008180114600F025B92DE9F05F9846DDF8D7 -:10DB100030B0DDF828A01546894604004FF0000615 -:10DB200025D00027E01C20F00300A04200D0FFDF3A -:10DB30007DB30120FFF75EFA00FB05620AEBCB0024 -:10DB4000104486B20120FFF755FA00FB05620B99DD -:10DB500008EBC100104405EB450100EB4100143017 -:10DB600000EB850000EB850086B217B111E00127BC -:10DB7000D8E7A6EB85000C3887B27D48A900046081 -:10DB8000257204F10C0060600DF0EDF93846FFF7E6 -:10DB9000ADFFA9F800600020BDE8F09F2DE9FF4F20 -:10DBA000734C814681B020689A468B4600B9FFDFEE -:10DBB0002068027A4A4503D9426852F8291021B1F7 -:10DBC00043F2020005B0BDE8F08F006800B9FFDF46 -:10DBD00001210E9A0398FFF70FFAC61C4FF6FC7549 -:10DBE0002E40584601215246FFF706FAC01C00EAB3 -:10DBF000050808EB0600001D85B25D480027006897 -:10DC0000046801E027460446206838B1A188A9428B -:10DC1000F8D13946204600F0A4F813E005F10800D9 -:10DC2000A18880B2814229D33946204600F099F874 -:10DC3000A0880022411B601902608180394600F0F3 -:10DC400088F8A580A08860802680251D0E9F01236E -:10DC5000039A314628460097FFF7D6F920884146B7 -:10DC600028445A460123CDF800A0FFF7CDF94048DB -:10DC700000684168002041F82940A3E70420A1E79B -:10DC800070B53B4C0546206800B9FFDF2068017A7B -:10DC9000A94210D9426852F8250060B1418800239A -:10DCA00042F8253003608180194600F052F821685F -:10DCB00000200A7A08E043F2020070BD4B6853F876 -:10DCC00020306BB9401CC0B28242F7D8002002E07D -:10DCD0008A88104480B209680029F9D1FFF706FF4D -:10DCE000002070BD70B5224D286800280AD000249D -:10DCF00004E02046FFF7C4FF641CE4B22868007A01 -:10DD0000A042F6D870BD70B5194E054600243068A3 -:10DD100000B9FFDF3068017AA94204D9406850F8A1 -:10DD2000250000B1041D204670BD70B5104E05469B -:10DD30000024306800B9FFDF3068017AA94206D9B3 -:10DD4000406850F8251011B131F8040B44182046F2 -:10DD500070BD19B10A68026008607047044909681B -:10DD6000F8E7006809B10860704701490968FAE7F7 -:10DD70005C00002070B5044600780E4601281AD0D9 -:10DD8000072802D00C281AD115E0A068216905786F -:10DD90000B2D0CD0052003F0CCFD052D0FD07823E2 -:10DDA00000220520D4F8101003F026FD07E07823A8 -:10DDB00000220620F8E70520216903F0BAFD31466C -:10DDC0002046BDE8704001F0BDB910B500F1390240 -:10DDD000C3799478411D64F003042340C371DB07C9 -:10DDE0000DD04B79547923404B710B791279134044 -:10DDF0000B718278C9788A4200D9817010BD0022E7 -:10DE00004A710A71F5E74178012900D00C210170AF -:10DE100070472DE9F74F86B000208C698DF800001F -:10DE20000878012617460D464FF0070B4FF01109F1 -:10DE30004FF00A0A2A2878D2DFE810F02A001A03E5 -:10DE400058036D03A703B603D203FF03160440046F -:10DE500068048704A004DD04EE04110519053905E2 -:10DE60005E058905AC05D705F505FF0521063206D7 -:10DE7000440676069806EA0621072F075A077A070E -:10DE80008E079F07D80710083C08F807FC07020810 -:10DE900014B120781D2829D0D5F808805FEA080041 -:10DEA00043D001208DF80000686A049003208DF8AB -:10DEB00004008DF805A0286A0290A8880028EFD0F9 -:10DEC00098F8001091B10F2910D27DD2DFE801F04F -:10DED0007C144BDCFEFDFCFBFAF9F8089EF7F6001B -:10DEE000022822D124B120780C2801D0002676E324 -:10DEF00002208DF80000B7E10620696A03F019FDE1 -:10DF0000A8880728EDD1204601F017F9022809D08A -:10DF1000204601F012F9032808D9204601F00DF936 -:10DF2000072803D20120207005E016E2002CB7D0AC -:10DF300020780128D5D198F80400C11F0A2902D3FE -:10DF400085F81CA093E2A070D8F80010A163B8F87F -:10DF50000410A18798F8060084F83E00012028707C -:10DF60000320207046E00728BBD1002C98D02078F1 -:10DF70000D28B6D198F8031094F83B20C1F3C000E7 -:10DF8000C2F3C002104201D00E2000E00F2089072A -:10DF900007D198F805100142D2D198F80610014235 -:10DFA000CED194F83D2098F8051020EA02021142E3 -:10DFB000C6D194F83E2098F8061090430142BFD194 -:10DFC00098F80400C11F00E04FE20A29B8D2617F2F -:10DFD000814201D90620C9E3D8F800106160B8F881 -:10DFE0000410218198F80600A072012028700E20EC -:10DFF000207003208DF80000686A049004F1390055 -:10E000000190601D029017300390E1E0B5F806B072 -:10E0100041288FD1204601F090F8042802D1E07801 -:10E02000C00704D1204601F088F80F289CD1CBF11D -:10E030004002164608F10101606A0CF0FBFE606ABE -:10E040005A463044E9680CF0F5FE0E208DF80000C9 -:10E05000686A0490606A019000216846FFF78AFEB2 -:10E060002078042808D0A07F48B1012807D00328D1 -:10E0700008D010202070A2E00520207015E284F85E -:10E08000009033E71220F5E71128C2D1204601F0B5 -:10E0900054F8042802D1E078C00719D0204601F0D6 -:10E0A0004CF8062805D1E078C00711D1A07F0228DE -:10E0B0000ED0204601F041F8112808E0B9E089E0CF -:10E0C000A1E178E158E110E1EFE0D5E01DE0A0D159 -:10E0D000102208F1010104F148000CF0ABFE607859 -:10E0E000012809D012202070E078C0076BD0A07FF3 -:10E0F000A0B3012863D066E0607FA17888423FF634 -:10E1000069AF00BF84F800B059E011288ED12046D5 -:10E1100001F013F8082804D0204601F00EF8132867 -:10E1200084D12869D8B16869C8B104F17800102297 -:10E1300008F1010106460CF07DFE2078082812D077 -:10E1400014202070E078C0070FD0A07F022818D0DC -:10E150006178022912D0032831D034E02FE000206A -:10E160008DF80000F9E00920EBE70B202870296901 -:10E1700002204870206CC1E9010695E208B101282F -:10E1800079D10B202870296908204870606A48609E -:10E19000206AC1E902067BE2206CE2780068C2F3E3 -:10E1A0004402521ED04000F0010040F0800000E028 -:10E1B00000200874E06A48617FE20646FEE304201E -:10E1C00028700520EBE185F800A08DF800A0B9E3E8 -:10E1D0003946F4E31128C5D1204600F0AEFF0A28E5 -:10E1E00002D1E078C00704D1204600F0A6FF152830 -:10E1F000B8D1102208F1010104F148000CF01AFE18 -:10E2000020780A2810D01620207012202870296942 -:10E2100004F1580081F801A048602030886010386F -:10E22000C860206C0861AFE30B202070E1E2287029 -:10E23000D4E1022896D1204600F07FFF042804D3C1 -:10E24000204600F07AFF082809D3204600F075FF29 -:10E250000E2887D3204600F070FF12287DD2A07FC1 -:10E260000228B8D18DF80090686A049098F80100EF -:10E270008DF80400FEE367E20228ACD1204600F0EE -:10E280005CFF002869D0204600F057FF0128F9D034 -:10E29000204600F052FF0C28F4D005208DF8040031 -:10E2A00098F801008DF805005CE71128FCD1002CDE -:10E2B000FAD020781728F7D16178E06A022912D0C5 -:10E2C0005FF0000101EB4101182606EBC1011022AD -:10E2D000405808F101010CF0ADFD0520696A00F01D -:10E2E0001FFF267002E60121ECE70B28DCD1002C91 -:10E2F000DAD020781828D7D16178E06A02292DD0A9 -:10E300005FF0000101EB4101102202EBC101415815 -:10E31000B8F8010008806078E16A022821D0002066 -:10E3200000EB4002142000EBC2000958404650F8B0 -:10E33000032F0A60406848600520696A00F0F0FE1B -:10E340006078022810D04FF000002044407A20F07E -:10E3500001010CD14FF001000BE0D3E14FF00101BE -:10E36000D0E74FF00100DBE74FF00100EDE74FF0A1 -:10E3700000002044417281E3112895D1002C93D0F4 -:10E380002078192890D16178E06A022911D0002103 -:10E3900001EB41011C2202EBC1011022405808F19F -:10E3A00001010CF047FD0520696A00F0B9FE1A2052 -:10E3B000E9E00121ECE7082898D1002C98D02078DA -:10E3C0001A2893D1E16A98F801000870E16AD8F838 -:10E3D000022041F8012FB8F8060088800520696AFC -:10E3E00000F09EFE6078022807D04FF00000204425 -:10E3F000407A20F002002CD034E04FF00100F6E724 -:10E40000214448723AE31128B7D1002CB7D02078C4 -:10E410001B28B2D16178E06A02291DD05FF00001AB -:10E4200001EB4101202202EBC1011022405808F10A -:10E4300001010CF0FFFC0520696A00F071FE6078B4 -:10E4400002280CD04FF000002044407A20F0040055 -:10E4500008D14FF00101D3E74FF00101E0E74FF0A1 -:10E460000100F1E74FF00001CAE785F81CB0F4E3C2 -:10E470003878012886D11C2204F11C0079680CF040 -:10E480001EFDE079C10894F83B0001EAD001E07874 -:10E4900061F30000E070217F09B1297732E1217832 -:10E4A00003290AD0C0073FF4E6AD032028708DF899 -:10E4B00000A0686A04904120A7E302262671E17952 -:10E4C000204621F0E001E171617A21F0F0016172F2 -:10E4D000A17A21F0F001A172FFF777FC2E708DF880 -:10E4E00000A0686A04908DF804B071E638781228AC -:10E4F000D4D18DF800B0696A049191680291ADF8A9 -:10E5000004B008466168016021898180A17A817127 -:10E5100004202070AEE23878B7F806801228BDD10A -:10E520008DF800B0686A0490381D01AB07C883E815 -:10E5300007004120ADF8040008460C2100F8011B3B -:10E54000C8F140063246216A0CF074FC206A42464B -:10E550008119F8680CF06EFC00216846FFF70AFC90 -:10E56000E07820F03E00801CE0702078052801D083 -:10E570000F2008E0A07F00283FF4C4AD0128FBD0A5 -:10E58000032870D108202070B0E43878032885D1A2 -:10E5900078680168A1664068E066052028708DF8FB -:10E5A0000000686A049013E638780328A0D17868E0 -:10E5B0000168216740686067206C68B9A07F28B156 -:10E5C000012803D0062028700420E8E785F800B071 -:10E5D000FE482064606401E085F800B00326F0E3A3 -:10E5E0003878022884D13879E0BBA07F02280BD08C -:10E5F0000328F1D1607801280BD0A07994F83A1063 -:10E6000001280AD0F1480BE0B86800287AD02064CD -:10E6100011E0A17994F83A00F2E7B8680028F5D043 -:10E620002064E078C00701D0012901D0E74802E06A -:10E63000F8680028EAD06064CEE78DF800A0696A27 -:10E640000491E1785046C90709D06178022903D1C5 -:10E65000A17F29B1012903D0A17F032900D008207F -:10E66000287046E101E1BFE0387812288FD1B86800 -:10E67000286209202870E0782969C0070DD0082099 -:10E680004870206A4860606A886004F16800C86069 -:10E69000A07F02287FF48CAD7EE502204870206CBC -:10E6A000486004F16800886004F13800C860201DEB -:10E6B0000861206B4861606B88612EE2E1783878F0 -:10E6C000C90701D0072100E00B2188428AD12078B8 -:10E6D000072818D084F800908DF800B0686A04907C -:10E6E000286A0290ADF80490032100F8011B5168DC -:10E6F00010220CF09FFB00216846FFF73BFB002037 -:10E700002862BEE44CE208202070E5E73878122841 -:10E71000ACD18DF800B0686A049090680290ADF8B2 -:10E720000490042100F8011B102204F168010CF090 -:10E7300081FB00216846FFF71DFB2078092801D0E6 -:10E74000132020E784F800A016E0E1783878C907A4 -:10E7500001D0072100E00B21884287D1102204F16B -:10E76000480079680CF03AFB10B104202877B1E337 -:10E77000207809283FF4BFAC0C2058E5E078C107A9 -:10E7800037D0A17F012902D002291BD02EE00D2015 -:10E79000287029690B2048706078012809D0206A08 -:10E7A0004860606A886004F16800C86010300861E1 -:10E7B00000E5606A4860206A886004F17800C860FB -:10E7C0001038F4E7C0F3440114290FD24FF0006170 -:10E7D00001EBB0104FEAB060E0706078012803D020 -:10E7E00010202070042061E10620CCE6607801282A -:10E7F00087D00E201BE538780A2889D185F800A03B -:10E8000010208DF80000686A049050680190002183 -:10E810006846FFF7AFFAE9E7E078C0070AD0A07FC3 -:10E82000012803D10F202870042041E11020287016 -:10E830000F203DE115202870296903204870206CC5 -:10E8400048606078012805D004F1780088601038AD -:10E85000C86062E104F1680088601030F8E7387839 -:10E860000228CAD138790028E0D0287730E33878F8 -:10E870001428FBD185F80090296909204870786830 -:10E880004860607801280DD004F16800886010307D -:10E89000C860206B0861606B486104F158008861B2 -:10E8A000A06A22E004F1780088601038F0E7387838 -:10E8B0000828DBD16078012801D0132043E2A17839 -:10E8C000A06A0844C1F110010CF02BFB1220287043 -:10E8D000296904F1580081F801A04860203088605F -:10E8E0001038C860206C086147E0C861E06A0862BF -:10E8F00013E18DF80490DFE038780928B6D11022B2 -:10E9000004F1480079680CF069FA08B10B202DE792 -:10E9100020780B2812D02046FFF757FAA178A06A7A -:10E920000844C1F110010CF0FCFA162028700820F0 -:10E930008DF80000686A049000206FE013202870B2 -:10E940008DF800A0686A04908DF8049040E438784F -:10E9500012288BD1B868286214202870296904F124 -:10E96000580081F801A04860103088601030C860FD -:10E97000606C08616078012806D004F139004861B4 -:10E98000206B8861606BB0E7601D4861606B8861D7 -:10E99000206BAAE7387809288BD18DF800B0686A17 -:10E9A0000490286A0290ADF804900D2100F8011B34 -:10E9B000102279680CF03EFA002101E077E27CE059 -:10E9C0006846FFF7D7F90020286201E06AB5010028 -:10E9D0006178012901D01520D5E51621297008217B -:10E9E0008DF80010696A049118E038780C2885D1F8 -:10E9F000162028706078022802D12046FFF7E5F93A -:10EA0000A07879680A18C0F1100110460CF089FA54 -:10EA100008208DF80000686A049078680190A0785A -:10EA20008DF8080061E53878102892D1E079C007A8 -:10EA300079D01720287009203AE03878112888D139 -:10EA40001422391D04F11C000CF039FAE16A208D02 -:10EA5000A1F80900E16AA078C871E179E26A01F0E1 -:10EA600003011172E16A627A0A73E16AA07A81F89D -:10EA7000240000E045E26078012876D0B4E16078B7 -:10EA8000022801D0012000E000202044407AC00785 -:10EA900004D0E078C00701D1192054E11E206CE6B3 -:10EAA000387812287CD1B86828621A20287005208E -:10EAB0008DF80000686A049011466846FFF75AF91D -:10EAC000FFF77BBB387803286AD16078E16A0228B7 -:10EAD00001D0012000E0002000EB4002142000EBF8 -:10EAE000C20289587A6813680B6052684A601B2119 -:10EAF0002970D5E9041206234B70636A4B6066786F -:10EB0000E36A022E01D0012600E0002606EB46064D -:10EB100000EBC6001858C1E90202686A486206980C -:10EB200000F027FBCCE788E138780F2838D16078EF -:10EB3000E26A022801D0012000E0002000EB400042 -:10EB4000102101EBC00002231058093279680AF045 -:10EB50006DFC1C202870296905204870206A4860D7 -:10EB6000E06A09308860FA4872E65BE138780E287E -:10EB700016D16178E06A022901D0012100E000216C -:10EB800001EB4101182606EBC101A27840587968D3 -:10EB90000CF050F96178E06A022902D0012101E00D -:10EBA000B8E0002101EB410106EBC1014158A0781A -:10EBB0000A18C0F1100110460CF0B3F98DF800B03E -:10EBC000686A0490286A0290ADF8049006210170EA -:10EBD0006278E16A022A01D0012200E0002202EB01 -:10EBE000420206EBC202401C895810220CF022F9A6 -:10EBF00000216846FFF7BEF8002028621D2028701B -:10EC00008DF800A0686A04900B208DF804006CE475 -:10EC1000387812287ED18DF800B0686A0490906828 -:10EC200002900B20ADF80400029880F800B06278E2 -:10EC3000E16A022A01D0012200E0002202EB420236 -:10EC4000102303EBC20289580988A0F801106178EB -:10EC5000E26A022902D0012101E03BE1002101EB3F -:10EC60004103142101EBC30151580A6840F8032FF6 -:10EC70004968416000216846FFF77CF80EE760783C -:10EC8000022801D0012000E000202044407A8007C3 -:10EC900001D51F2057E021206FE53878122839D19F -:10ECA0008DF800B0686A0490B8680290ADF80490DE -:10ECB000082606706278E16A022A01D0012200E08B -:10ECC000002202EB42021C2303EBC202401C8958C3 -:10ECD00010220CF0AFF800216846FFF74BF8202017 -:10ECE00028708DF800A0686A04908DF804605AE4DA -:10ECF000387812280ED18DF800B0686A04909068B8 -:10ED000002900820ADF80400029809210170E16921 -:10ED1000097800E093E04170E16951F8012FC0F8F3 -:10ED200002208988C18000216846FFF723F8B2E7F6 -:10ED30006078022801D0012100E000212144497AB5 -:10ED4000490706D5222028708DF800A0686A049033 -:10ED5000CFE5012848D067E0387812286FD1B8682D -:10ED6000286223202870296905204870206A48609D -:10ED7000E06A0930886077486AE538780E285ED105 -:10ED80006178E06A022901D0012100E0002101EB55 -:10ED90004101202606EBC1014058516810220CF0B9 -:10EDA00049F88DF800B0686A0490286A0290ADF8BE -:10EDB000049080F800A06278E16A022A02D0012261 -:10EDC00001E0A4E0002202EB420206EBC202401C7A -:10EDD000895810220CF02EF800216846FEF7CAFF71 -:10EDE000002028626078B4E72420C6E46078022816 -:10EDF0000BD000202044407AC10702D0E178C90737 -:10EE000005D0810705D519209BE40120F2E71720E2 -:10EE100097E4400701D51B2093E41C202070607804 -:10EE2000012801D01820A8E42720A6E42820287073 -:10EE30000B203DE6387813284AD129209DE40CE0C8 -:10EE40002078012844D00C2842D02046FEF7DBFF72 -:10EE50000C208DF80000686A049039E038784FF093 -:10EE60002608122805D013201070032685F800808C -:10EE70004DE08DF800B0686A0490B86802900220F6 -:10EE8000ADF80400029805210170297F417000212E -:10EE90006846FEF76FFF0B208DF80000686A04904B -:10EEA00039466846FEF766FF064685F80080012E63 -:10EEB0000ED02CE001208DF80000686A0490042038 -:10EEC0008DF80400287F8DF805000020287712E0D7 -:10EED000287F80B11D202070252028708DF800A08B -:10EEE000686A049002208DF8040039466846FEF7EF -:10EEF00041FF06460BE00CB1FE2020709DF800009B -:10EF000028B100216846FEF735FFFEF7EFBF09B0D4 -:10EF10003046BDE8F08F2DE9F04F0C4601274E69D1 -:10EF2000097885B09046BA464FF00209072021B112 -:10EF300001294FD0022920D1C9E0217901290BD024 -:10EF4000022916D0032911D0042916D11CE0000093 -:10EF500062B501009CB40100707801280CD1062034 -:10EF6000616A02F0BFFC002807D11AE01D20307052 -:10EF700017E07178022901D0052796E031780C2935 -:10EF800027D18DF804000EE03078011F042902D348 -:10EF90000E3803281DD2B07F02281AD120890228FA -:10EFA00017D38DF8049084F800A020899DF80410F0 -:10EFB000884203D20A208DF800003FE01221083475 -:10EFC00088F8001094E80E00C8E901120327C8F879 -:10EFD0000C306AE098F80010122966D18DF8000014 -:10EFE000616A0491D8F80850029521794FF00B0B13 -:10EFF000012906D0022929D0032911D0042954D18E -:10F000005AE0ADF8049085F800B0207E4F4600F03D -:10F010001F00687000216846FEF7ACFE377043E0C1 -:10F02000ADF8049005202870207E68704E460021BF -:10F030006846FEF79FFE26708DF800B0606A049067 -:10F0400041466846FEF796FE07462EE0ADF80400FE -:10F0500085F800A0207F6870607F00F00100A87034 -:10F06000A07F00F01F00E870E17F2971C0071FD06A -:10F0700094F8200000F00F00687194F8210000F06F -:10F080000F00A87100216846FEF774FE2868B0637F -:10F09000A888B087A87986F83E00A0694078707784 -:10F0A0002879B0700D2030700027384605B030E761 -:10F0B0000020A8716871E5E7ADF804900E20287073 -:10F0C000207E687000216846FEF754FEECE7FE20C3 -:10F0D00030708DF800A0606A049004208DF8040060 -:10F0E000207E8DF80500EDE700B50023012285B0F4 -:10F0F00005280FD006280BD102208DF8002004919E -:10F100008DF804008DF8053000216846FEF732FEC8 -:10F1100005B000BD8DF8002004918DF80420F1E7C2 -:10F1200070B50C46054602F004FC21462846BDE8B1 -:10F1300070407823002202F05FBB08B1007870476E -:10F140000C20704770B50C0005784FF000010CD012 -:10F1500021702146F4F70EF973482178405D88420A -:10F1600001D1032070BD022070BDF4F703F9002027 -:10F1700070BD027B032A05D000220A704B780C2B4D -:10F1800002D003E0042070470A770A62027B9300F2 -:10F19000521C0273C15003207047F0B585B00F4672 -:10F1A00005460124287B05EB800050F8046C70783C -:10F1B000411E0D290AD25C493A46123101EB80000A -:10F1C000314650F8043C2846984704460CB1012CBF -:10F1D00011D1287B401E10F0FF00287301D00324BA -:10F1E000E0E70D208DF80000706A04900021019680 -:10F1F0006846FFF7A7FF032CD4D005B02046F0BD2A -:10F2000070B515460A46044629461046FFF7C5FF65 -:10F21000064674B12078FE280BD1207E30B1002044 -:10F220002870294604F10C00FFF7B7FF2046FEF7CF -:10F23000EAFD304670BD704770B50D460446882122 -:10F240000BF091FE012D03D0022D03D0052070BDDF -:10F25000012000E0022060702046FEF7D4FD00206F -:10F2600070BD28B1027E1AB10A4600F10C01C7E751 -:10F270000120704730B5044687B00D46062002F0E5 -:10F2800058FB2946052002F054FB2078FE2806D0C2 -:10F2900000208DF8000069462046FFF7E2FF07B026 -:10F2A00030BD7FB50E4600218DF80C1041780C2939 -:10F2B00003D00D2903D0002405E0846900E04469EF -:10F2C0000CB1217E91B16D4601462846FFF751FFF2 -:10F2D000032809D1324629462046FFF791FF9DF8C1 -:10F2E0000C10002900D0042004B070BD04F10C05FE -:10F2F000EAE710B590B00C4607900B480521801E38 -:10F3000008900A488DF8191009900F92694606A8CE -:10F31000FFF7C7FF002805D11022204601990BF006 -:10F3200089FD002010B010BDA2B4010062B501003B -:10F3300070B50D46040011D085B1210128460BF0AF -:10F34000F0FD10224E4928460BF074FD4C48012177 -:10F350000838018044804560002070BD012070BDE8 -:10F3600070B5474E00240546083E10E07068AA7B41 -:10F3700000EB0410817B914208D1C17BEA7B914272 -:10F3800004D10C2229460BF029FD30B1641C3088D1 -:10F390008442EBDB4FF0FF3070BD204670BD70B58E -:10F3A0000D46060006D02DB1FFF7DAFF002803DB7B -:10F3B000401C14E0102070BD314C083C208862884D -:10F3C000411C914201D9042070BD6168102201EBFB -:10F3D000001031460BF02EFD2088401C2080287044 -:10F3E000002070BD70B514460D0018D0BCB10021CE -:10F3F000A170022802D0102811D105E0288870B130 -:10F400000121A170108008E02846FFF7A9FF00281D -:10F4100005DB401CA070A8892080002070BD012061 -:10F4200070BD70B5054614460E000BD0002030703C -:10F43000A878012808D005D91149A1F108010A8846 -:10F4400090420AD9012070BD24B128782070288804 -:10F45000000A5070022008700FE064B14968102261 -:10F4600001EB0011204610390BF0E4FC28782073E2 -:10F470002888000A607310203070002070BD0000E2 -:10F48000680000202DE9F041FE4C207EE17D88429D -:10F4900008BFBDE8F0810126FB4D0027E07D215C1F -:10F4A00001EB810205EB8200037C052B10D0037C6D -:10F4B000062B1BD0037C072B27D0437C012B18BFC6 -:10F4C000FFDF30D0207EE17D8842E7D1BDE8F081CA -:10F4D0000674E07D16281ABFE07D401C0020E07510 -:10F4E000481CC0B255F8222002210CE00674E07DD1 -:10F4F00016281ABFE07D401C0020E075481C55F816 -:10F500002220C0B203219047DCE70674E07D162874 -:10F510001ABFE07D401C0020E075481CC0B255F8C1 -:10F5200022200821EFE74774E07D16280EBF002057 -:10F53000E07D401CE075481CC0B255F82220072130 -:10F54000E1E770B5D14E00240C2086F82900A6F51D -:10F550003B70254680F8CD4180F8CC4100F5F47031 -:10F560000476C47506F12C000AF0B2FDA6F58E7083 -:10F57000057586F82B50601EB06086F8255086F819 -:10F58000225086F8235086F8245086F82150C0482F -:10F5900005704570A6F1E80004EB840100EB8101E1 -:10F5A0000D74611CCCB20B2CF6D30120F9F726FBAD -:10F5B0000020F9F723FB012086F82600F9F7D2FF97 -:10F5C000B448F9F7DEFFB44C2070B448F9F7D9FF1E -:10F5D0006070BDE87040F9F7A5BA10B5F9F7D0FA38 -:10F5E000AD4C2078F9F7E6FF6078F9F7E3FFA74C18 -:10F5F00094F82800002808BF10BDF9F7CAFC0020C5 -:10F6000084F8280010BD0B20704770B5F9F79BFBFC -:10F610009E4C054694F8260000281CBFFFDF70BDF5 -:10F6200094F82B00002808BFFFDF6FF07F4260696D -:10F630000026291AB1F5800F24BF431BB3F5800FB4 -:10F640000DD38A4203D2101A2844411C07E09A4283 -:10F6500028BFFFDF05D2511B0844401C414200294E -:10F6600000DBFFDF012584F8265084F82B6094F836 -:10F6700029100420844A01EB810102EB8101087406 -:10F68000A068B0F1FF3F04D0A81EA0600120F9F7E8 -:10F69000B5FA0020F9F7B2FAF9F796FA0AF0A6FEE1 -:10F6A000F9F7DAFB7E48066006604FF0E0214FF480 -:10F6B0000040C1F88002F3F780FC7548007802280A -:10F6C00004D0032805D194F8230010B184F8225007 -:10F6D00001E084F82260BDE87040F9F7A1BB034661 -:10F6E00069490B2000EB800201EB820212F8042C26 -:10F6F00022B1401E10F0FF00F4D1704700EB8002F1 -:10F7000001EB8201012241F8143C01F8042C7047FE -:10F71000012804D0032808BF002926D000E021B327 -:10F720005A4B4FF0000C83F821C0594A00289070C2 -:10F7300014BF022882F803C00BD0072915D2DFE8D6 -:10F7400001F01404060C0E1012001B2000E03A20F9 -:10F75000D070012083F8210070475820F8E7772007 -:10F76000F6E79620F4E7B520F2E700207047484816 -:10F7700010B54078F9F779FB80B210BD421E10B584 -:10F78000414900EB800001EB80040A2A02D814F8FA -:10F79000040C00B9FFDF14F8040C012818BFFFDFC8 -:10F7A000002004F8040C10BD70B53E4C94F8CD0157 -:10F7B00094F8CC1188420CBF01250025F9F7C3FA53 -:10F7C000F9F753FB94F8CD1194F8CC2191420CBF7A -:10F7D00001210021A942E9D170BD2DE9F05F8046E9 -:10F7E0004B1E1746DCB2284804EB840200EB82056E -:10F7F0002E1D287CDFF88C9007282DD199F8170052 -:10F80000002299F818C0844524D000BF19F800C020 -:10F81000A44508BF012200D04AB116280CBF4FF002 -:10F82000000C00F1010C19F80CC009F800C01628F2 -:10F830000CBF0020401CC0B299F818C08445E5D127 -:10F8400042B199F818204846002A0EBF1622027EBF -:10F85000521E0276012028740A2B10D80A4801EBA8 -:10F86000810100EB810010F8040C40B1287C0128D4 -:10F8700006D0287C012802D0B87A012816D0FFDFF4 -:10F88000B87A11E0BC0B0020D80B0020C00C00207F -:10F890007A000020A51601007800002085F4000001 -:10F8A00000F50040D409002001284AD1FE49287CF7 -:10F8B000022816D099F8180016284AD099F818008E -:10F8C00099F81710401C884200D1FFDF01206874AE -:10F8D00099F8180009F8004099F8180016283DD04A -:10F8E0003EE0DFF8C8C39CF829000246A04207D0DA -:10F8F000024600EB820001EB8000807CA042F7D141 -:10F900009CF8293083420CD19CF8292002EB82021A -:10F9100001EB8202927C8CF8292001228CF82A20AB -:10F9200009E000EB800301EB830302EB820201EBB1 -:10F9300082029B7C937400EB800001EB80000C2220 -:10F940008274387A062825D2DFE800F012211E1BC7 -:10F95000181599F817000028B8D1B6E7002002E082 -:10F9600099F81800401C89F818000020BDE8F09FA5 -:10F970004FF0000A11E04FF0B40A0EE04FF0730AA6 -:10F980000BE04FF0320A08E04FF00A0A05E04FF0B2 -:10F99000060A02E0FFDF4FF0000A3868A0EB0A0019 -:10F9A0003060397A00290CBF04210221401A20F06E -:10F9B0007F423260D7E90001084420F07F40706048 -:10F9C000B87A022818BF387B7ED1387A00280CBF5D -:10F9D0000420022000EB0A037868591D00EB010B9C -:10F9E000B3484078504503D9B04991F8231011B17C -:10F9F0000BF1060003E0A0EB0A005844801DAB4960 -:10FA000091F829C0BCF10C0F24D08E4691F8291032 -:10FA100001EB810CA44901EB8C0CDCF804C06245BD -:10FA200018D0DFF890C29EF8292002EB820201EB89 -:10FA300082014A688968A2EB080222F07F42A1EBAA -:10FA4000080121F07F41904298BFB2F5800F49D262 -:10FA50008C4547D34044A0EB0B0020F07F41316040 -:10FA60001944F86821F07F410A1A6FF07F43B2F51C -:10FA7000800F24BFA0EB010CBCF5800F0DD3934287 -:10FA800003D2181A0844421C07E0634528BFFFDF71 -:10FA90001FD2591A0844401C4242002A19DD052091 -:10FAA000287499F8180016282DD099F8180099F89C -:10FAB0001710401C884200D1FFDF99F8180009F8A0 -:10FAC000004099F8180000E00BE016287FF448AFDA -:10FAD00044E73068ABF10501084420F07F407060D6 -:10FAE000002030727068401D20F07F407060787A8E -:10FAF000B072387A0627707203280DD260B101F017 -:10FB000023FB28B108E099F817000028D5D1D3E7E6 -:10FB1000CAF138074FF0320A65480178012918BF49 -:10FB200003290AD14078504507D9604991F823103C -:10FB3000002904BFA0EB0A0007445E4B3068A0EB2D -:10FB40000802706822F07F41A0EB080020F07F4C93 -:10FB50008F4298BFB1F5800F1CD263451AD3534929 -:10FB600091F829300C2B32D091F829704FF00C0B02 -:10FB70004FEA0B0A4C4907EB870301EB8303D3F8E9 -:10FB800008C0ACEB080C944531D8BB469F7C0C2FC9 -:10FB9000F0D199E00520287499F81800162811D0A2 -:10FBA00099F8180099F81710401C884200D1FFDF1F -:10FBB00099F8180009F8004099F8180016287FF401 -:10FBC000CFAECBE699F817000028F1D1EFE702207D -:10FBD000287491F829000C2818BF91F82900A874FE -:10FBE00081F82940012081F82A00BDE8F09F0C2F00 -:10FBF0001CBFBA46002267D00AEB8A0301EB8303DD -:10FC0000D3F804C0ACEB080C844528D29A7B96F854 -:10FC10000AC094451CD30520287499F818001628AA -:10FC200011D099F8180099F81710401C884200D19B -:10FC3000FFDF99F8180009F8004099F81800162815 -:10FC40007FF48EAE8AE699F817000028F1D1EFE72D -:10FC500093F812A00122BAF10C0FCDD103E0002AD3 -:10FC600008BFBA4630D03E460F4806EB860200EB8E -:10FC70008208062188F8101099F81800162836D046 -:10FC800099F8180099F81710401C884200D1FFDF3E -:10FC900099F8180009F8006099F8180016280CBFA8 -:10FCA000002099F8180007E0D80B0020C00C0020B5 -:10FCB0007A000020FFFF3F0018BF401C89F81800A1 -:10FCC00098F81260B245CFD10220FE4E287406F19A -:10FCD000E80090F82910B9420ED185F812A080F8FA -:10FCE0002940012180F82A100120BDE8F09F99F8F1 -:10FCF00017000028CCD1CAE70C2F0BD0BBF10C0F9A -:10FD000008BFFFDF0BEB8B0006EB8000847485F8E7 -:10FD100012A0E9E7BBF10C0F08BFFFDF0BEB8B0074 -:10FD200006EB800084740C20A874DDE730B50D4626 -:10FD3000E54A44190021101A71EB010038BFFFDFBA -:10FD4000E2488542C8BFFFDFE1488542B8BFFFDF18 -:10FD5000E0488442A8BFE04804DA002CAABF20464D -:10FD6000DC4830BD201830BD401E70B5C0B200EB7D -:10FD70008001D44800EB8104607B062810D2DFE8C4 -:10FD800000F0030D0B090705002033E0B4200BE061 -:10FD9000732009E0322007E00A2005E0062003E096 -:10FDA000FFDF617B002029B3022108446168084419 -:10FDB00020F07F40F9F759F894F90C50C24A4419E1 -:10FDC0000021101A71EB010038BFFFDFBF488542E8 -:10FDD000C8BFFFDFBE488542B8BFFFDFBD488442D1 -:10FDE000A8BFBD4804DA002CAABF2046B94870BDA0 -:10FDF000201870BD0421D8E72DE9F04F0646B7481A -:10FE000085B00068C005C00D11D0103840B2002880 -:10FE1000B8BF00F00F0000F1E020B4BF90F8140D5F -:10FE200090F80004400908BF4FF0010A01D04FF0DC -:10FE3000000A3078002817BF01283079002005B06B -:10FE400018BFBDE8F08F062810D2DFE800F0030DE0 -:10FE50000B090705002015E0B4200BE0732009E032 -:10FE6000322007E00A2005E0062003E0FFDF3179B9 -:10FE7000002039B15FF0020100EB0109BAF1000F77 -:10FE800006D101E00421F7E79549002081F8270019 -:10FE90006C4602AA2146B068F8F7F4FF9DF90820E5 -:10FEA000F068211D10440122C01C1F28B8BF019218 -:10FEB00008DB03AAF8F7E6FF9DF80C0010B10198E3 -:10FEC000401C0190DDE900100844401D20F07F40F7 -:10FED0000190A1EB090020F07F40009070798DF82F -:10FEE0000A0000980390F8F72EFF0099019B091A69 -:10FEF000181A7C4A21F07F4120F07F40B1F5800F35 -:10FF000010D282420ED3764890F82950009CAB461E -:10FF1000191B21F07F486FF07F41091BA0F1E80712 -:10FF2000049101E0002080E00C2D26D005EB850037 -:10FF300007EB80026FF07F435068011BB1F5800F23 -:10FF400010D3A4EB000CBCF5800F0BD38B4203D273 -:10FF500004990844411C05E063450DD2181A204459 -:10FF6000401C4142002908DA5D48AB46957C90F878 -:10FF700027000028D8D04CE0FFDF5D4525D00BEBF3 -:10FF80008B0007EB80036FF07F429968081BB0F588 -:10FF9000800F12D3A4EB010CBCF5800F0DD382426D -:10FFA00003D204980844401C07E0624528BFFFDFE5 -:10FFB0000BD2521A1019401C4042002805DD9DF852 -:10FFC0000A009A7B904228BF0C460C2D1CBF9DF85E -:10FFD0000A10434A14D000BF05EB850007EB8000F0 -:10FFE00043681B1B23F07F43434509D2837B99421F -:10FFF00028BF8468857C92F8270050B90C2DEBD17E -:020000040001F9 -:100000000098A04205D004EB080020F07F40009447 -:10001000019000990398814206D001EB090020F07D -:100020007F40F8F722FFB06001202D4991F827109A -:10003000002904BF05B0BDE8F08FBAF1000F3FF40E -:1000400023AF05B0BDE8F08F2DE9F04F814687B0B2 -:100050000C4625480AF044F8244901274FF00008CF -:1000600001EB090500287DD0A1F5887898F81400E7 -:10007000002818BFFFDF2078012800F0238200BF8E -:1000800088F810902078022808BFFFDF184E2079EA -:1000900006F10C023072607970723146A068F8F790 -:1000A000F1FE96F90C000F2804DD1F38307330681C -:1000B000401C306096F90C00E168351D0844C01CF6 -:1000C0001F2817E0D80B0020FF7F841E0020A10707 -:1000D00000E05EF80080841E00807BE104ED00E01B -:1000E000C00C0020FFFF3F00EC0C0020B40C0020EF -:1000F000A40B0020B8BF2F6009DB6A462946F8F739 -:10010000C1FE9DF8000010B12868401C28602078CE -:10011000B07288F81470F64D95F8CD0195F8CC11B1 -:10012000884204BF07B0BDE8F08FF24890F829403C -:100130000C2C00F0CF81F8F706FEEF4904EB8402A7 -:1001400001EB82010A7C042A19BF0A7C032A07B04A -:10015000BDE8F08FE94B4A688968121A22F07F42A5 -:10016000081A00E01BE020F07F40062A3CBF07B0E1 -:10017000BDE8F08FB2F5800F24BF07B0BDE8F08F67 -:1001800083423CBF07B0BDE8F08F95F8CD0195F8EC -:10019000CC11884240F0A78107B0BDE8F08FD44E63 -:1001A00096F8CD01162855D096F8CD0196F8CC11C9 -:1001B000401C884200D1FFDF207801284FD0CC4876 -:1001C00090F8CD1101EB810100EB810080F81090D7 -:1001D000207802284BD0C64890F8CD1101EB810160 -:1001E00000EB8105207928726079687205F10C02B4 -:1001F0002946A068F8F746FE95F90C000F2804DDA3 -:100200001F3828732868401C286095F90C00E168A5 -:100210002E1D0844C01C1F28B8BF376009DB6A4682 -:100220003146F8F72FFE9DF8000010B13068401CF1 -:1002300030602078A872AE4991F8CD0116280EBF23 -:10024000002091F8CD01401C81F8CD01AC4809F0A7 -:100250005DFF60E796F8CC010028ADD1ABE715F85B -:10026000010C002818BFFFDF05F8017CA7E7A548AF -:100270000068C005C00D0FD0103840B20028B8BFCC -:1002800000F00F0000F1E020ACBF90F8000490F8FF -:10029000140D400908BFFFDF954890F8CD1101AA61 -:1002A00001EB810100EB8106E068CDF800808DF85C -:1002B00004806946F8F7E6FD9DF904000F28CCBFDD -:1002C000012000200099351D084401900220B072E1 -:1002D0002079307260797072A068C01C1F28B8BF86 -:1002E0002F6009DB6A462946F8F7CCFD9DF800002F -:1002F00010B12868401C2860307A062810D2DFE848 -:1003000000F0030D0B09070500200BE0B42009E005 -:10031000732007E0322005E00A2003E0062001E018 -:10032000FFDF0020217900290CBF042102210844AD -:1003300002907168401D08440199009001440298A0 -:10034000081A05906B4C002084F82700F8F7FBFC96 -:10035000804630600198404420F07F40F06094F87F -:1003600029000C287ED0204690F8291001EB81024C -:10037000A0F1E80101EB82025468009A274622446A -:1003800022F07F42039296F809B090F82950121B90 -:1003900022F07F4A6FF07F42121BA94604920C2D77 -:1003A00027D0554805EB850100EB81036FF07F42B4 -:1003B0005868011BB1F5800F24BFA4EB000CBCF5FD -:1003C000800F0BD38A4203D204990844411C05E0F4 -:1003D00062450DD2111A0819401C4142002908DA61 -:1003E0004448A9469D7C90F827000028D7D04DE0CE -:1003F000FFDF4D4525D0404809EB890100EB810125 -:100400006FF07F438868021B8146B2F5800F24BFDE -:10041000A4EB000CBCF5800F0DD3934203D2049AD9 -:100420001044421C07E0634528BFFFDF09D21A1AB7 -:100430001019401C4242002A03DD887B834528BFF7 -:100440004C460C2D1CBF2B4BA3F1E80116D000BF6E -:1004500005EB850001EB80025068001B20F07F4017 -:10046000504500E026E009D2907B834528BF946880 -:10047000957C93F8270048B90C2DE9D1A74205D007 -:1004800004EB0A0020F07F4027460390039AA7EB75 -:10049000080121F07F41A2EB0802059822F07F427B -:1004A000B1F5800F06D2904204D30298384420F070 -:1004B0007F4030600F4890F8270000287FF442AF5B -:1004C000B9E600BF15F8010C002818BFFFDF05F8DA -:1004D000017CD5E595F8CD0195F8CC11884204BF93 -:1004E00007B0BDE8F08F07B0BDE8F04FF8F798BC53 -:1004F000D4090020C00C0020D80B0020FFFF3F00D3 -:10050000EC0C002004ED00E00020F8F767BB0120B0 -:10051000F8F764BBFD48007870472DE9F0410546C7 -:1005200002282DD0FA4C94F829000C2808BFFFDFD0 -:10053000002784F82670012684F82B6094F829108F -:100540000320DFF8D08301EB810108EB81010874FF -:10055000F8F76DFCD5B1012D39D0032D1CBFFFDF9D -:10056000BDE8F08194F8290094F82910401CC0B22D -:1005700001EB810158F82120BDE8F0410521104729 -:10058000E2480078BDE8F041F9F71AB8207F00286A -:1005900018BFFFDF84F8256000202760F8F72EFBE6 -:1005A000A168B1F1FF3F04D0012300221846F8F7FB -:1005B00069FB94F8290094F82910401CC0B201EBA3 -:1005C000810158F82120BDE8F041012110470120A8 -:1005D000F8F714FB94F8250000281CBFA068B0F1C0 -:1005E000FF3F0DD094F8290094F82910401CC0B2A8 -:1005F00001EB810158F82120BDE8F04106211047A8 -:10060000207F012815D002281FD0032833D00428CA -:100610001CBFFFDFBDE8F08194F820106068012363 -:10062000411A00221846F8F72DFB94F82800B8BBB1 -:1006300037E094F8240028B184F82470F8F7FEFB22 -:1006400084F823602777BDE8F08194F8280018B972 -:10065000F8F776FC84F8286094F8290094F82910BB -:10066000401CC0B201EB810158F8212000219047C5 -:100670002777BDE8F081217B60680123411A0022C1 -:100680001846F8F7FFFA94F8240028B184F824708B -:10069000F8F7D4FB84F8236002202077BDE8F081CE -:1006A00003E0F8F74DFC84F8286094F8290094F8EA -:1006B0002910401CC0B201EB810158F82120002113 -:1006C00090472677BDE8F08110B5914C94F8290049 -:1006D0000C2808BFFFDF94F8290094F82910401C6B -:1006E000C0B28C4A01EB810152F82120BDE81040D4 -:1006F000042110472DE9F05FF8F725FB844C814673 -:100700004FF00C0B94F829000026A4F1E8084FF0F4 -:10071000010A0C282CD094F82910204601EB810105 -:1007200008EB8101097C042922D090F8291001EB03 -:10073000810108EB8101097C032908BFBDE8F09F16 -:10074000754922696069A2EB090222F07F42A0EBA1 -:10075000090020F07F40062A38BFBDE8F09FB2F5BF -:10076000800F28BFBDE8F09F814238BFBDE8F09FF1 -:10077000A068B0F1FF3F18BFFFDF84F8256094F850 -:100780002900664F0C2806D194F8210018B1F8789A -:100790007870B87838705E4890F829000C281ED020 -:1007A0005B4890F8291001EB810108EB8101097C7D -:1007B000042914D190F829B090F8291001EB810197 -:1007C00008EB810181F810A090F8291001EB81015C -:1007D00008EB8101897C80F8291080F82AA0504C10 -:1007E00094F8CD0194F8CC1104F2DF2588424ED064 -:1007F00094F8CC0100EB800004EB8000007C405DAD -:10080000012894F8CC0100EB800004EB800004D0B8 -:10081000007C405D022878D018E0807A01280DD055 -:1008200094F8CC11022001EB810104EB8101097CD9 -:10083000485594F8CC01162820D01BE094F8CC0140 -:1008400000EB800004EB8000007C465594F8CC015E -:1008500000EB800004EB800294F8CC0100EB8000F8 -:1008600004EB8000017C4846FEF7B7FF94F8CC010A -:10087000162803D094F8CC01401C00E0002084F836 -:10088000CC0194F8CD0194F8CC118842B0D1254C1C -:10089000207D70B1207C415D012966D0405D022839 -:1008A0006BD0207D28B1217C1E4A4846FEF795FF7B -:1008B0002675BBF10C0F06D00BEB8B0008EB80000C -:1008C000017C012961D0124C94F829000C2800F019 -:1008D000388194F82A00002800F0428184F82A60C8 -:1008E00094F8290000EB800008EB8003A4F53B702E -:1008F000D3E90112DB68C0F80433C0E9BF12607E9F -:1009000000280CBF042502250EE01CE07800002022 -:10091000C00C0020D80B0020FFFF3F007A00002011 -:10092000D4090020A40B002094F82900C34600EB52 -:10093000800108EB8100407B06284DD2DFE800F003 -:10094000404A4846444294F8CC0100EB800004EB56 -:100950008000807A012818BFFFDF94F8CC0100EBFB -:10096000800004EB8000867268E7A17A01291DBF30 -:10097000022141552675465593E7A07A012818BFF4 -:10098000FFDFA672207C46558BE707210174FE4CE1 -:10099000207E162810D0207EE17D401C884200D1A8 -:1009A000FFDF207E04F800B0207E16280EBF002056 -:1009B000207E401C207686E7E07D0028F1D1EFE71D -:1009C00000200BE0B42009E0732007E0322005E0AE -:1009D0000A2003E0062001E0FFDF00202073617E93 -:1009E000022918BF012911D121690144A1EB090293 -:1009F00022F07F42382A09D903206076A1F1320023 -:100A000020F07F4020613220207309E0322807D295 -:100A100094F8280058B9F8F793FA84F828A006E06B -:100A200094F8280018B1F8F7B4FA84F828607978B7 -:100A300084F8201038780622012818BF032806D130 -:100A400084F824A0207B814284BF081A821D94F878 -:100A50002230002B18BF921C94F82400002808BFF5 -:100A6000002B6AD0D4F810806069A8EB0908DFF881 -:100A70001CC328F07F48A0EB090020F07F404245CE -:100A800098BFB8F5800F41D284453FD3207B884280 -:100A900015D22369A1EB0002A3EB020222F07F42F0 -:100AA0001144294421F07F412261616000280CBF7C -:100AB00001200320207710F0FF0F36D114E00AD96F -:100AC000226900291044284420F07F4060600CBF58 -:100AD00002200420EEE7002B08BFFFDF2069284436 -:100AE00020F07F40606026770120F8F787F800BF8C -:100AF00094F82900012300EB80010BEB8100616871 -:100B000090F90C200020F8F7BDF829E084F8246063 -:100B100084F82260207B0028E0D021690844284422 -:100B200020F07F4060600220207720690123411976 -:100B300000221846F8F7A6F8DAE7207B0028ECD167 -:100B4000CCE70120F8F75AF80020F8F757F8F8F743 -:100B50003BF894F8280018B1F8F71BFA84F82860DD -:100B600094F8220028B1F8F769F984F8236084F832 -:100B7000226094F8210018B1F8787870B87838704D -:100B800094F8240030B184F823603878002808BF36 -:100B900084F824607C48017EC07D814203D07C487B -:100BA0004078F8F70DFD84F827A0BDE8F09F70B5F8 -:100BB000784C054682B094F829000C2808BFFFDF66 -:100BC00094F8290000EB8000734E06EB8000007C57 -:100BD000032818BFFFDFA068B0F1FF3F18BFFFDF99 -:100BE00094F82900002100EB800006EB800001AAA8 -:100BF00090F90C0000918DF8041028446946F8F72C -:100C000041F99DF904000F28CCBF01200020009974 -:100C100008446168084420F07F41A16094F82500F1 -:100C2000002804BF02B070BD012302B00022BDE85D -:100C300070401846F8F726B8584A0B1A02F1010C12 -:100C4000B3EB9C0F3CBF1846704710B5441AB4EB89 -:100C50009C0F3CBF184610BD9A4203D2101A08449C -:100C6000401C10BD94429EBFFFDF002010BD511AF2 -:100C70000844401C404210BD0123002201460220CE -:100C8000F8F700B80220F7F7B9BFF8F75CB8F0B58D -:100C9000404C054683B094F82B00002808BFFFDFC6 -:100CA000642D50D33E490020491B80414BD33D4821 -:100CB00090F8CD1190F8CC01814244D13A48007DA2 -:100CC000002840D194F82900334F00EB800007EB57 -:100CD0008006206801AA28446946F8F7D3F89DF9F0 -:100CE0000400002802DD0098401C0090B2680099C2 -:100CF00073685018C01A20F07F40B0F5800F22D2E0 -:100D0000B07C0C2809D000EB800007EB8000406825 -:100D1000801A20F07F40884215D3A068B0F1FF3FD1 -:100D200005D00120F7F76AFF4FF0FF30A060206880 -:100D300028442060B0680099084420F07F4060613A -:100D400003B00120F0BD03B00020F0BD2DE9F0415B -:100D50000646401EC5B2104805EB850100EB810434 -:100D6000207C002808BFFFDF0E4A92F8CC1192F8D1 -:100D7000CD01814221D000BF01EB810302EB83034F -:100D80001B7CB34220D011E0BC0B0020FFFF3F00D2 -:100D900078000020C00C0020D80B0020FF7F841EAC -:100DA000FF1FA107D4090020A40B002016290CBFA7 -:100DB0000021491CC9B28142DED13A48017D002997 -:100DC00062D0007CB0425FD10020BDE8F081217C80 -:100DD00005291FBF217C0629217C07292CD12774D6 -:100DE000C27D0023017E914218BF014624D000BF7E -:100DF00011F80280A84508BF012300D04BB1162A84 -:100E00000CBF4FF0000802F1010811F8088001F84A -:100E10000280162A0CBF0022521CD2B291F8188010 -:100E20009045E5D143B10A7E002A08BF81F818C079 -:100E300002D00A7E521E0A76617C21B36674C27D9E -:100E40000021037E934224D0835CAB4208BF012182 -:100E500000D029B1162A0CBF0023531CC35C835455 -:100E6000162A0CBF0022521CD2B2037E9342EBD151 -:100E700049B1027E0146002A08BF81F818C008D097 -:100E80000A7E521E0A7604E00127074800264FF02A -:100E9000160C217C012904BF617C002997D1012017 -:100EA000BDE8F081A40B0020BC0B0020F0B5734A14 -:100EB000D2F80032724D002401212E7856B9714EBD -:100EC0003460704F03263F1D3E606E4F04260C3782 -:100ED0003E602970C2F80042D1601160694C48340C -:100EE000D16425688542FBD35160D160C2F80032DD -:100EF000F0BD2DE9F041044680074FF000054FF0AA -:100F0000010604D560480560066024F00204E00490 -:100F10004FF0FF3705D55D484660C0F8087324F4EC -:100F20008054600003D55A48056024F08044E005F1 -:100F30000FD55248C0F80052C0F8087351490D60EF -:100F4000091D0D604F4A04210C321160066124F422 -:100F50008074A00409D54F484660C0F80052C0F81C -:100F600008734D48056024F40054C4F38030C4F382 -:100F7000C031884200D0FFDF14F4404F14D04748FE -:100F80004660C0F8087346488660C0F80052C0F852 -:100F9000087344490D600A1D16608660C0F8087326 -:100FA0000D60166024F4404420050AD53E48466092 -:100FB0008660C0F80873C0F848733C48056024F4A4 -:100FC000006409F0EDF93A48044200D0FFDFBDE8C3 -:100FD000F08170B5202500224FEA020320FA02F1C9 -:100FE000C90719D051B201F01F060124B4404E09BF -:100FF000B60006F1E026C6F88041C6F88042002916 -:1010000006DA01F00F0101F1E02181F8143D03E05F -:1010100001F1E02181F80034521CAA42DED370BDF8 -:1010200070B5174C0D466060FFF763FF6068FFF70F -:10103000D0FF2846F8F761F808F004FE00F0D5F874 -:1010400009F0AEF909F0FBF8F8F78CFABDE870404A -:1010500008F09ABE10B50A4C6068FFF74AFF606856 -:10106000FFF7B7FF09F09CF9F8F70CF90020606072 -:1010700010BD034840687047022070470080004060 -:101080008000002004850040FC1F004000C000409C -:1010900004E5014000D0004004D5004000E00040DD -:1010A00000F0004000F5004000B0004008B50040EE -:1010B000FEFF0FFC70B51F490A68BAB100231D4638 -:1010C00001244A68521C4A60092A00D34D600E79F7 -:1010D00004FA06F20E6816420AD072B60B68934301 -:1010E0000B6062B649680160002070BD052070BDCC -:1010F0005B1C092BE5D3FFDFF8E74FF0E0214FF44D -:101100008000C1F800027047EFF3108111F0010F69 -:1011100072B64FF0010202FA00F20648036842EA92 -:101120000302026000D162B6E7E7024800210160D5 -:1011300041607047880000200120810708607047E7 -:10114000012081074860704712480068C00700D03E -:10115000012070470F48001F0068C00700D0012021 -:1011600070470C4808300068C00700D00120704765 -:10117000084810300068704706490C310A68D203ED -:1011800006D5096801F00301814201D101207047B1 -:10119000002070470C040040C84911F8210F49781D -:1011A000884201D3401A02E0C1F121010844C0B2D3 -:1011B0007047C249233111F8210F4978884201D381 -:1011C000401A02E0C1F121010844C0B27047BB4996 -:1011D000463111F8210F4978884201D3401A02E0C4 -:1011E000C1F121010844C0B27047B54910B5802053 -:1011F00081F80004B1490020233101F8210F487023 -:10120000AE4901F8210F4870AC49463101F8210F71 -:101210004870AC4808F05CFFAA48401C08F058FF32 -:10122000F8F778F8BDE8104000F03DB9202070478D -:10123000B2E770B50C4605460026FFF7ADFF014644 -:101240009E48A14212D30022641EE4B20DD390F84E -:101250002210435C491CC9B205F8013B80F82210FA -:101260002129F1D180F82220EEE7012600F01BF9B8 -:10127000304670BD202070479BE770B50C46054690 -:101280000026FFF796FF01468C482330A14212D377 -:101290000022641EE4B20DD390F82210435C491C76 -:1012A000C9B205F8013B80F822102129F1D180F85C -:1012B0002220EEE7012600F0F6F8304670BD20212E -:1012C00001700020704710B50446FFF780FF2070C2 -:1012D000002010BD70B50C460546FFF778FF0146AB -:1012E00076484630A14213D30022641EE4B20DD3E7 -:1012F00090F82210435C491CC9B205F8013B80F804 -:1013000022102129F1D180F82220EEE7002401E00B -:1013100042F2070400F0C7F8204670BD70B50C46D5 -:101320000546212900D9FFDF67480068103840B220 -:1013300000F0A0F8C6B20D2000F09CF8C0B28642C2 -:1013400004D2FFDF02E000BFF8F734F82146284658 -:10135000FFF76FFF0028F7D070BD2DE9F047DFF8E9 -:101360006481564CA8F101080746233498F8000020 -:10137000DFF84891002604F1230A38B994F82210C6 -:1013800094F82100212200F084F890B14D4699F89C -:10139000221099F82100212200F07BF8B8B15546BF -:1013A0009AF822109AF82100212200F072F848B32E -:1013B00035E094F82100275494F82100401CC0B275 -:1013C00084F8210021282AD184F8216027E095F8AB -:1013D00021002F5495F82100401CC0B285F821004F -:1013E000212801D185F8216098F800004746B0B166 -:1013F00095F8221095F82100212200F04AF870B1EA -:101400003E700CE095F821002F5495F82100401C07 -:10141000C0B285F82100212801D185F8216094F817 -:10142000221094F82100212200F033F800281FD068 -:1014300099F8221099F82100212200F02AF80028BA -:1014400016D09AF822109AF82100212200F021F8F3 -:1014500000280DD0F7F784FF1A4808F041FEB0F5D8 -:10146000005F00D0FFDFBDE8F047164808F04EBE31 -:10147000BDE8F087002806DA00F00F0000F1E02058 -:1014800090F8140D03E000F1E02090F8000440090A -:101490007047401C884204D0904200D109B100201E -:1014A00070470120704710B5064808F019FE002863 -:1014B00003D1BDE81040F7F73EBF10BDF00C00208F -:1014C0000DE000E09100002004ED00E013490878F1 -:1014D0004A78401CC0B2904205D0114B01221A60DC -:1014E000BFF34F8F0870704770B54FF0E0250B4C7D -:1014F000F7F7E6FF20BF40BF20BF6078217861701A -:10150000D5F8001229B9D5F8041211B92178814211 -:10151000EED0F7F7D0FF002070BD00009300002050 -:10152000180502402DE9F041012528034FF0E02184 -:101530000026C1F880011E4CC4F800610C2000F0A8 -:101540002CF81C4801680268C94341F3001142F0BD -:1015500010020260C4F804532560491C00E020BF5B -:10156000D4F80021002AFAD019B9016821F010013D -:101570000160114807686560C4F80853C4F8006149 -:101580000C2000F00AF83846BDE8F08110B504469A -:10159000FFF7C8FF2060002010BD00F01F020121EE -:1015A00091404009800000F1E020C0F880127047AF -:1015B00000C0004010ED00E008C500402DE9F047F4 -:1015C000F84C0646FF21606800EB06121170217886 -:1015D000FF2916D04FF0080909EB011109EB061796 -:1015E0004158C059491E21F07F4100F0DDF918B182 -:1015F00094F80080454614E06168207801EB0611FC -:1016000008702670BDE8F087626809EB0510D159B3 -:10161000105800F0C9F930B96068A84600EB08100E -:101620000578FF2DF0D1606800EB061100EB081083 -:101630000D700670E6E7F0B5DA4B04460020012590 -:101640005A680C261B7A0BE005EB0017D75DA74202 -:1016500004D106EB0017D7598F4204D0401CC0B20A -:101660008342F1D8FF20F0BD70B5FFF70EFBCD4CE3 -:10167000014608252278606805EB0212805800F0C8 -:1016800093F9012808D92178606805EB01114058C9 -:10169000BDE87040FFF7F0BAFEF73CFFBDE87040D0 -:1016A000F7F78EBF2DE9F041BE4C2578FFF7EDFA34 -:1016B0000146FF2D6FD04FF00808626808EB051651 -:1016C000905900F071F90228606801D980595EE0F4 -:1016D00000EB051109782170022101EB0511425C34 -:1016E0005AB1521E4254815901F5000121F07F4147 -:1016F00081512846FFF762FF34E00423012203EB07 -:10170000051302EB051250F803C0875CBCF1000F13 -:1017100010D0BCF5806F10D9CCF3090250F806C088 -:101720000CEB423C2CF07F4C40F806C0C3589A1A90 -:10173000920A09E0FF2181540AE0825902EB4C32FF -:1017400022F07F428251002242542846FFF736FFA2 -:101750000C21606801EB05114158E06850F8272022 -:10176000384690472078FF2815D0FFF78EFA0146BB -:101770002278606808EB02124546805800F014F9A0 -:10178000012891D92178606805EB01114058BDE826 -:10179000F041FFF771BABDE8F081F0B51D4614467F -:1017A0000E460746FF2B00D3FFDFA00700D0FFDF68 -:1017B0007C48FF210022C7604460057206740170F6 -:1017C00042701046012204E002EB0013401CE15479 -:1017D000C0B2A842F8D3F0BD70B5724C0646657829 -:1017E000207C854200D3FFDFE06840F82560607808 -:1017F000401C6070284670BD2DE9FF5F1D468B467A -:101800000746FF24FFF741FADFF89891064699F85A -:101810000100B84200D8FFDF00214FF001084FF06F -:101820000C0A99F80820D9F804000EE008EB01131F -:10183000C35CFF2B27D0BB4205D10AEB011350F844 -:1018400003C0DC4521D0491CC9B28A42EED8FF2C26 -:101850001BD008EB04110AEB0412475440F802B005 -:101860000421029B0022012B01EB041111D04250F4 -:101870004FF4806808234FF0020C454519D9A9059B -:10188000890D08D008E00C46DDE7FF2004B0BDE874 -:10189000F09F4550ECE7414606EB413203EB041361 -:1018A00022F07F42C250691A0CEB0412890A81545B -:1018B0000BE005B9012506EB453103EB041321F0DC -:1018C0007F41C1500CEB0411425499F8005020465E -:1018D000FFF774FE99F80000A84201D0FFF7C4FE9C -:1018E0003846D3E770B50C460546FFF7CEF90646F5 -:1018F00021462846FFF79FFE0446FF2817D0294DB2 -:10190000082101EB041168684058314600F04CF89A -:1019100000F58050400B02216A6801EB0411515C14 -:1019200009B100EB8120002800D1012070BD00200A -:1019300070BD2DE9F0410F468046FFF77CFEFF2881 -:101940001BD0184E357871682A462C4605E0844233 -:1019500006D0254601EB05131C78FF2CF7D10CE0CF -:10196000FF2C0AD0A5420CD101EB02100078307098 -:10197000FF2804D0FFF778FE03E000200BE7FFF715 -:1019800081F939464046FFF7ADFFFF220123716818 -:1019900003EB0413CA5401EB041201EB0511127896 -:1019A0000A70F8E65C0D0020401A20F07F40B0F588 -:1019B000000F00D90020704770B50446A0F5000064 -:1019C0002C4EB0F1786F02D23444A4F500042A48BA -:1019D000844201D2012500E0002500F041F830B139 -:1019E000B4420BD32548006804E0284370BDB442DC -:1019F00004D32348844201D20120F6E70020F4E713 -:101A000010B50446A0F50000B0F1786F03D2194874 -:101A10000444A4F5000400F023F84FF0804130B1F5 -:101A20001648006804E08C4204D2012003E0144808 -:101A30008442F8D2002080F0010010BD10B520B122 -:101A4000FFF7DEFF08B1012010BD002010BD10B56A -:101A500020B1FFF7B1FF08B1012010BD002010BD7B -:101A6000084809490068884201D1012070470020D8 -:101A7000704700000000002000C001001C00002092 -:101A80000800002098000020BEBAFECA0548064A99 -:101A90000168914201D100210160044901200860E0 -:101AA0007047000098000020BEBAFECA40E5014021 -:101AB000404800210170417010218170704770B55D -:101AC000054616460C460220F5F789FC39490120E7 -:101AD00008703949F01E086038480560001F04602E -:101AE00070BD10B50220F5F77AFC3249012008706C -:101AF00033480021C0F80011C0F80411C0F80811E3 -:101B000030494FF40000086010BD2A480178C9B17F -:101B10002D4A4FF4000111602949D1F8003100220B -:101B2000002B1CBFD1F80431002B02D0D1F80811D2 -:101B300011B14270102103E001214170234909686D -:101B4000817002700020F5F74ABC1A48017800291C -:101B500004BF407870471A48D0F80011002904BF2C -:101B600002207047D0F8001100291CBFD0F80411E2 -:101B7000002905D0D0F80801002804BF01207047D3 -:101B8000002070470B480178002904BF8078704717 -:101B90000B48D0F8001100291CBFD0F8041100290F -:101BA00002D0D0F8080108B110207047074800683B -:101BB000C0B270479C00002010F5004008F50040BE -:101BC00000F0004004F5014008F5014000F4004039 -:101BD0003148002101704170704770B506461446C7 -:101BE0000D460120F5F7FBFB2B49012008702B481F -:101BF0000660001D0460001D056070BD2DE9F04108 -:101C000004460120F5F7EBFB234901200870244925 -:101C10000C60244D0026C5F8046123494FF040773D -:101C20000F60A1F1040844B1012C18BFFFDFC5F813 -:101C30000062C8F80070BDE8F081C5F800024FF0FE -:101C40008070C8F80000BDE8F0811348017879B1D0 -:101C5000154A4FF0407111601249D1F8042100215A -:101C6000002A08BF417002D0104A12684270017009 -:101C70000020F5F7B4BB08480178002904BF40787C -:101C800070470848D0F80401002808BF704707488B -:101C90000068C0B2704700009F00002008F50040B7 -:101CA00004F5004000F0004008F5014000F4004059 -:101CB00070B5FE4C002501266570257025626572A1 -:101CC000A572E67284F82950256304F13C00A563EF -:101CD00008F0FEF9002818BFFFDF84F82450F4480C -:101CE00009F062FAF3480660657770BD30B4EF49D9 -:101CF0000268DFF8C8C34A6142688A61007A0877DF -:101D00000A7DED4BACF1040401204AB10A7E00FAD1 -:101D100002F21A608D7D002D0CBF2260CCF80020ED -:101D20004A7D002A04BF30BC70474A7E904018604C -:101D3000C97D00290CBF2060CCF8000030BC704782 -:101D4000DF4900B50A1D40B101281CBFFFDF00BDFF -:101D5000DC480860DC48106000BDDC480860DC48F6 -:101D6000F9E7F0B502264FF0E02701240025C7F877 -:101D70008061D8490D600C60D7490A6822F077026B -:101D800042F0880242F000420A60CD490A1DD0B1FB -:101D9000012818BFFFDF1AD0D04940F25B6008600D -:101DA000091F40F203100860081F0460CC4903209B -:101DB0000860CC4996200860BC4C94F9240010F0CF -:101DC000030F09D033E0C1480860C14802E0BD48B4 -:101DD0000860BD481060DFE780100A300C2826D26A -:101DE000DFE800F021252525251D1915110D0A060E -:101DF000BD49042008601BE0BB48056018E0BA49F3 -:101E0000FC20086014E0B849F820086010E0B649EA -:101E1000F42008600CE0B449F020086008E0B24902 -:101E2000EC20086004E0B049D820086000E0FFDF43 -:101E3000607F002814BF4FF4C020AC48AC49086054 -:101E4000AD49AC480860091FAC480860C7F880621B -:101E5000AB491020C1F80403F0BD944A0368C2F8EE -:101E600002308088D08011727047904890F8290025 -:101E700070478E4A517010707047F0B50D46044699 -:101E800004EB4501908808841078D2F801100127EE -:101E900040EA012044F8250005F1080007FA00F6A1 -:101EA000002B04BF206BB04304D0012B18BFFFDF11 -:101EB000206B304307FA05F108432063F0BD30B5CD -:101EC0000D460446082988BFFFDF0022002D11D9E6 -:101ED00054F82210900000F1804000F58050C0F8C6 -:101EE000001604EB4201098CC0F82016501CC2B247 -:101EF0009542EDD8206B8349086030BD10B504468B -:101F000010F0030F2BD1A0100A300C2827D2DFE8E5 -:101F100000F022262626261E1A16120E0A067249DE -:101F2000042008601CE070490020086018E06E4939 -:101F3000FC20086014E06C49F820086010E06A4951 -:101F4000F42008600CE06849F020086008E0664969 -:101F5000EC20086004E06449D820086000E0FFDF5E -:101F6000524880F8244010BD504890F83400704723 -:101F7000654AC178116000686449000208607047D2 -:101F8000252808BF02210ED0262808BF1A210AD012 -:101F9000272808BF502106D00A2894BF0422062211 -:101FA00002EB4001C9B25A4A11605A4908607047B1 -:101FB0003E49086270473D498A7A012A49D0022A7F -:101FC00018BF70474B7D002B08BF7047DFF848C132 -:101FD000012A42D0CA7D4B7E002A18BF01227D30E3 -:101FE000CCF80000DFF834C10020CCF84C01180216 -:101FF00082F0010240EA025040F00312087F8300A1 -:1020000003F1804303F5C043C3F81025444A02EBB3 -:102010008002887EC30003F1804303F5F833C3F8E0 -:102020001425DFF800C1C3F810C5C97ECB0003F149 -:10203000804303F5F833C3F81425304AC3F810255C -:10204000012202FA00F002FA01F108433649086061 -:1020500070470B7D002BB9D170478A7D0B7E002A1B -:1020600018BF01227E30BBE72DE9F84F00280CBFD6 -:10207000012002200D4C224D0322A072C5F800223F -:10208000627F002A14BF4FF4C022184A264F3A60DC -:102090004FF00108002976D0012973D002291CBF16 -:1020A000FFDFBDE8F88F206A00283FE0700D0020B8 -:1020B000840D0020A0050040180500500C050050BC -:1020C00014150040050103001F0003020601020071 -:1020D00025000302FC1F00403C170040381500405B -:1020E00010150040441500400C1500400000040489 -:1020F00008F5014040800040A4F501401011004067 -:102100000010004040160040241500401C150040FF -:1021100008150040541500404C85004000800040E8 -:10212000006000404C81004004F5014008BFFFDF23 -:10213000216A206B0844FB490860FC49FA480860A2 -:10214000A17AFB4801290EBF0560FA490160A06B26 -:1021500040F40020A063D5F800924FF0100AC5F8B3 -:1021600008A30026C5F80062F3484FF4802BC0F89E -:1021700000B0FF208DF80000C5F81061C5F8108090 -:102180003DE000E01CE0012813D0C5F804800228DF -:1021900018BFBDE8F88F607D002808BFBDE8F88F44 -:1021A000E648C0F84C80E6480068BDE8F84F0A30C1 -:1021B00001E7C5F80080207D0028F1D1BDE8F88F47 -:1021C000E0490128896B07D0022818BFFFDF09D03A -:1021D000BDE8F84F0A20EEE641F48010A0634FF40A -:1021E000801004E041F40010A0634FF40010386048 -:1021F000EEE700BF9DF80000401E8DF800009DF83E -:10220000000018B1D5F810010028F3D09DF80000A7 -:10221000002808BFFFDFC5F80C61C5F81061C5F8DC -:102220000461C5F81461C5F81861C5F82861C6488D -:1022300000680090C5F80092C7F800B0C5F804A384 -:102240004FF400203860216A206BBDE8F84F084445 -:102250000A30B0E62DE9F847BC4CD4F8000220F073 -:102260000309D4F804034FF0100AC0F30018C4F8AF -:1022700008A30026C4F80062B24D687F002814BF8E -:102280004FF4C020B248AC490860A87A0127012861 -:1022900002D0022803D014E0287D10B911E0687D37 -:1022A00078B1A87EEA7E07FA00F007FA02F210433E -:1022B0000860287F800000F1804000F5C040C0F831 -:1022C0001065FF208DF80000C4F81061276104E05C -:1022D0009DF80000401E8DF800009DF8000018B128 -:1022E000D4F810010028F3D09DF80000002808BFA2 -:1022F000FFDFC4F81061C4F828616E72AE72EF722D -:10230000C4F80092B8F1000F18BFC4F804A3BDE8E8 -:10231000F88700688F4920F07F40086070474FF0D1 -:10232000E0200221C0F88011C0F8801270474FF001 -:10233000E0210220C1F8000170478749087070470A -:1023400010B5864807F0CCFE002818BFFFDF10BD8F -:10235000824807F0DBBE82490860704730B5794C8F -:102360000546206BA84228BFFFDF012020732561AE -:10237000607F40B1A81C20617448D0F8001241F081 -:102380004001C0F800126D490020C1F844017549B0 -:1023900020690860A06B744940F48000A0634FF48A -:1023A0008000086030BD674802210173CA210161C5 -:1023B000417F41B1CC2101616449D1F8002242F052 -:1023C0004002C1F800225D4A0021C2F844110269AE -:1023D000016B1144634A1160816B41F48001816398 -:1023E00061494FF4800008607047564901204877E2 -:1023F0005E49022008605F495D480860091F5E4829 -:10240000086070474F490020487770474A494FF4A9 -:10241000800008604B48816B21F4800181630021BA -:1024200001737047454801214160C1600021C0F837 -:1024300044114C480160434801637047414800B56E -:10244000407F002818BFFFDF4020484908603F4810 -:10245000D0F8001241F04001C0F8001200BD394828 -:1024600000B5407F002818BFFFDF3848D0F80012C1 -:1024700021F04001C0F800123C490020086000BD76 -:102480003248D0F8001221F01001C0F800120121EA -:10249000816170472D480021C0F81C11D0F800124E -:1024A00041F01001C0F800127047284981B0D1F8FE -:1024B0001C21012A1EBF002001B070472F4A12685C -:1024C00002F07F02524202700020C1F81C012C4829 -:1024D00000680090012001B0704730B50C0005463F -:1024E00008BFFFDF14F0010F1CBF012CFFDF002D20 -:1024F0000CBF01200220134901284872CC721349F5 -:1025000004BFD1F8000240F0040007D0022807BF42 -:10251000D1F8000240F00800FFDF30BDC1F8000232 -:1025200030BD00004885004048810040A8F50140CA -:10253000ACF501400410004008F501400080004067 -:102540004C850040700D0020181100400010004024 -:10255000000004043C150040A1000020AC0D002048 -:10256000041500404485004004F50140601500401A -:10257000448000409CF5014028110040481500406F -:102580001C11004070B5EB4C0022E17A11F0020FF3 -:1025900018BF10F0040F16D111F0100F1CBF94F8E3 -:1025A0003530002B02D094F8363063B111F0080FAB -:1025B0001CBF94F82830002B05D111F0040F03D074 -:1025C00094F8291001B90122657ADB4900234FF004 -:1025D000010C35B100F00200104314D0BDE870408A -:1025E00038E6607F002814BF4FF4C020D348D44A97 -:1025F0001060D1F8000220F00300C1F80002A372BD -:1026000084F80BC070BD012D14D0022D18BFFFDF60 -:102610001CD0A07A01280CBFCA48CB484FF47A716D -:1026200000F2E730B0FBF1F0216BBDE87040081A12 -:102630008C30C0E4D1F8000220F00400C1F80002A0 -:10264000637284F80BC084F80AC0E2E7D1F8000294 -:1026500020F00800C1F80002637284F80BC0022069 -:10266000A072D6E72DE9F84FB84FD7F84C21B14CFE -:10267000B3494FF00108A07A0026CAB1012802D060 -:10268000022803D014E0227D12B911E0627D7AB1F4 -:10269000A27EE37E08FA02F208FA03F31A430A6004 -:1026A000227F920002F1804202F5C042C2F810651A -:1026B000A26B0A60A663217B19B1D7F844110129E6 -:1026C00000D000219C4DD5F81021012A0CBF4022DA -:1026D0000022012805BFD5F80C31012B002320234F -:1026E0001A43012805BFD5F80431012B002310231C -:1026F0001343974A022804BFD2F800C0BCF1010F6F -:1027000007D1D5F80CC1BCF1010F08BF4FF0080C80 -:1027100001D04FF0000C4CEA0303022804BF1268FA -:10272000002A05D1D5F80C21012A08BF042200D0C7 -:1027300000221A43022803D1002918BF022100D128 -:1027400000211143022804BFD5F80401012805D156 -:10275000D7F84401012818BF012000D1002040EA29 -:1027600001097C48016811F0FF0F03D0D5F814115E -:10277000012900D0002184F83410006810F0FF0F08 -:1027800003D0D5F81801012800D0002084F83500C6 -:102790007148006818B1FFF7D8F9012800D000206F -:1027A00084F83600C5F80C61C5F81061C5F80461FD -:1027B000C5F81461C5F81861C5F828616748006854 -:1027C0000090C7F84461664800684D46DFF8949170 -:1027D0000090D9F80000E062617F00291CBF801ED4 -:1027E000E062614800682063A07ADFF880A10228D7 -:1027F0000CD1607850B1DAF80010097808402178DF -:1028000031EA000008BF84F8288001D084F82860ED -:10281000DFF85C8115F0010F16D098F80010554ACA -:102820004908E06A52F821108847012198F80020F1 -:10283000514B5208206B53F82220904798F8000023 -:1028400010F0010F0BD01FE015F0200F18BF022170 -:10285000ECD115F0020F18BF0021E7D1EEE7DAF84E -:102860000000062200F10901A01C08F0B7FA40B9E7 -:10287000207ADAF800100978B0EBD11F08BF0120E8 -:1028800000D0002084F829002846FFF77BFE15F0D1 -:10289000020F05D0394898F8001050F82100804701 -:1028A00015F00C0F07D0364898F8001050F821109A -:1028B000C5F3C000884715F0200F05D0314898F8BF -:1028C000001050F82100804798F80000022805D138 -:1028D00005F06E00402806D101F00EF998F80000CE -:1028E000042828BFFFDFA07A022818BFBDE8F88FB0 -:1028F000207B002808BFBDE8F88FC7F84461022894 -:1029000014D0012818BFFFDF216B2069884298BFCF -:10291000FFDF2069C9F80000A06B1B4940F480006C -:10292000A0634FF480000860BDE8F88F2169206B38 -:102930000844EFE7700D0020001000400000040480 -:1029400008F50140F0FE0100B0F8010000800040F1 -:10295000001400404016004060150040181100406F -:1029600044810040448500404085004004150040FB -:10297000A1000020E8B40100F0B40100F8B40100A7 -:1029800008B5010018B5010004F5014010B54A482A -:1029900006F0C5FB0021484806F0F6FB0121464839 -:1029A00006F0C0FB4549002081F822004FF6FF7079 -:1029B000888443490880488010BD10B53E4806F021 -:1029C000AEFB00213C4806F0DFFB01213A4806F04F -:1029D000A9FB3A49002081F822004FF6FF70888455 -:1029E00037490880488010BD704734498A8C82423C -:1029F00018BF7047002081F822004FF6FF708884CE -:102A000070472D49016070472D49088070472B4958 -:102A10008A8CA2F57F43FF3B03D00021016008466A -:102A2000704791F822202549012A1ABF0160012030 -:102A300000207047214901F1220091F82220012A4B -:102A400004BF00207047012202701D48008888845E -:102A5000104670471A49488070471849184B8A8CAD -:102A60005B889A4206D191F82220002A1EBF01609D -:102A700001207047002070471048114A818C52880D -:102A8000914209D14FF6FF71818410F8221F19B1CC -:102A90000021017001207047002070470748084A54 -:102AA000818C5288914205D190F8220000281CBFE9 -:102AB0000020704701207047D60D0020B00D002087 -:102AC000A200002070B5FF4E044696F88400002551 -:102AD000012807D096F8660001281CBF002070BDB1 -:102AE000E1B90EE0D1B9657014202070D6F88500E8 -:102AF000C4F80200D6F88900C4F8060086F88450AD -:102B00000CE06570132020701C2206F16801A01CE7 -:102B100008F090F90120A07186F86650012070BD80 -:102B2000E84890F86610002914BFB0F86A004FF624 -:102B3000FF70704770B5E4480178002918BF0C2673 -:102B400001D0304670BDDF4C0026354684F8546015 -:102B500084F8556084F8566084F8576084F85860AB -:102B600084F8596084F84D6084F82D6084F86460BE -:102B70007F21817094F85A0028B1FFF770FCFEF7AE -:102B8000C4FF84F85A5084F86650D04806F074F9AF -:102B9000CF4806F071F9D4E770B5CB4A002515701F -:102BA000C84CC4E91701107800281CBFFFDF70BDB6 -:102BB00084F8545084F8555084F8565084F857508F -:102BC00084F8585084F8595084F84D5084F82D50AA -:102BD00084F864507F20907094F85A0028B1FFF771 -:102BE0003EFCFEF792FF84F85A5084F86650B748CE -:102BF00006F042F9BDE87040B54806F03DB9B1486D -:102C000090F854007047AF4900B591F84F0091F823 -:102C10004E10C0F38002C0F340031A4400F00100DC -:102C20001044052910D2DFE801F00B070B0309005F -:102C3000A84931F8100000BDA74800BDA74900E031 -:102C4000A74931F8100000BDFFDF002000BD9D48FE -:102C500040F27121B0F8500048437047994890F80D -:102C60006500002818BF0120704770B5954C437B64 -:102C7000002584F84F30037984F84E30012B0EBFC5 -:102C8000A4F85050B0F800C0A4F850C090F80EC09E -:102C900084F865C021701168C4F801109188A4F807 -:102CA000051081796173D0F80710C4F80710B0F8E7 -:102CB0000B00A4F80B0094F84D000126002818BF63 -:102CC00084F8556094F82D00002818BF84F85660E9 -:102CD000052B2CD2DFE803F0030821260800002191 -:102CE0007A4806F0CCF823E00121784806F0C7F8CE -:102CF000E11D764806F0F4F8607B20B1012818BF8A -:102D0000FFDF05D014E00021704806F0FDF80FE069 -:102D100001216E4806F0F8F80AE006216B4806F03B -:102D2000AEF805E00221694806F0A9F800E0FFDFEF -:102D300084F8575084F85850611C644806F0C2F873 -:102D40002178624806F0D3F80421614806F097F82C -:102D5000611C5F4806F0B6F821785D4806F0C7F8B8 -:102D600084F85460002070BD564A012382F8583020 -:102D700092F866C0BCF1000F1CBF3A20704710B437 -:102D800014784FF0000C844218BF82F858C009D163 -:102D900082F857C00868C2F801008888A2F80500C8 -:102DA00082F8573010BC0020704770B5454C05467E -:102DB000002084F856002A4604F10E0008F03AF884 -:102DC00084F82D50012084F8560070BD10B53D4C9C -:102DD000002284F8552084F84D00024604F12E00AC -:102DE00008F028F8012084F8550010BD354981F815 -:102DF0006400704770B5344E3078A0BB314C94F805 -:102E0000540080B3FFF79CFA002584F8525084F8F0 -:102E1000535075702846FFF790FA0020FEF7A1FF87 -:102E20003048FFF7A5F83048FFF773FAFFF7BBFA11 -:102E300094F84F0010F0010F04D094F8521011F0E4 -:102E4000010F13D010F0020F04D094F8521011F0BB -:102E5000020F18D010F0040F2CD094F8520010F08C -:102E6000040F1BD026E0FFE70C2070BD2520FFF7E4 -:102E700087F80020FEF764FF94F8520040F001004C -:102E800084F8520016E02620FFF77AF80020FEF7BB -:102E900057FF94F8520040F0020009E02720FFF7A6 -:102EA0006FF80020FEF74CFF94F8520040F0040049 -:102EB00084F85200FFF73BFA01210020FFF7D4F815 -:102EC0000F2113E0F80D0020A8000020880E00203C -:102ED000B00E002038B501009189130040B5010003 -:102EE00030B501002BB5010028B501000520FEF723 -:102EF000C0FF2178601CFEF7B0FF94F84E00012857 -:102F00001EBF042894F85500002808D094F84D20DE -:102F100004F12E01FE4806F012F884F8555094F89A -:102F2000560040B194F82D2004F10E01F94806F046 -:102F300032F884F85650206E017819B110F8041B4D -:102F4000FEF7BDFFE06D017831B1F34A401CFEF79A -:102F5000B6FD012084F85A00FFF7FAF9002070BD91 -:102F6000EE494860704770B5ED4C05003BD02046F7 -:102F700094F84F1090F8520011F0010F02D010F0A9 -:102F8000010F0CD011F0020F02D010F0020F11D07F -:102F900011F0040F27D010F0040F18D023E02520E3 -:102FA000FEF7EEFF0020FEF7CBFE94F8520040F053 -:102FB000010009E02620FEF7E3FF0020FEF7C0FE37 -:102FC00094F8520040F0020084F852000BE02720F1 -:102FD000FEF7D6FF0020FEF7B3FE94F8520040F053 -:102FE000040084F8520094F8530040B194F84E0065 -:102FF000012808BFFFDFBDE8704000F054BA1DB1E2 -:1030000002210020FFF730F894F85700002558B14E -:10301000611CBF4805F056FF611CBE4805F052FF19 -:1030200084F8575084F85850B948FFF794F994F849 -:103030004E00052809D2DFE800F00303030903006E -:1030400001210846FFF749FA00E0FFDF94F84F003E -:1030500094F8521030EA01014FF0010002D0AF495C -:10306000087070BD94F84E10012914BF84F8530005 -:1030700084F85250F3E710B5FFF762F9A7480078DB -:1030800040B9A74890F8540020B10020FFF76BFF2B -:10309000002010BDFFF7C6F9FFF7B8F9FFF7DAF81F -:1030A000FFF73DF9FFF754F90C2010BD9B490120B3 -:1030B000487070479A4981F85900704770B50025EB -:1030C00002F07BFC68B14FF49670FEF771FF934EEF -:1030D0003078012809D0022801D003282ED0FFDF44 -:1030E00070BDBDE8704000F0DEB98D4C94F84E0024 -:1030F000032823D094F85A0018B1FEF7F2FCFFF72A -:103100009DF98848FFF727F994F84E00012818BF69 -:1031100004280AD094F86500012814BF032810255C -:1031200045F00E010020FFF7D8F994F8640001285B -:1031300008BFFFF7AFF90220307070BDBDE87040E6 -:10314000012010E770B5764C744D94F864000128A6 -:1031500020D000BF94F85A0018B1FFF780F9FEF7AD -:10316000D4FC02F02AFCF8B12878022818BFFFDF4F -:1031700094F84E00012804BF4FF41970FEF718FFB1 -:103180000120FFF7F0FE287800281EBF28780128CC -:10319000FFDF70BD6448FFF788F9002804BF7F2077 -:1031A000A870FFF76DF9D5E7BDE8704000F07BB976 -:1031B0002DE9F05F82460027FEF7D6FE574D814687 -:1031C000B8462878022818BFFFDF554C4FF07F0B18 -:1031D00094F86400012825D0524805F06FFE064699 -:1031E000BAF1000F6FD04F4805F065FF00286AD094 -:1031F000FEF73BFE002866D094F85A00002818BF5E -:103200004FF028081ED000BFA8F1010000F0FF0811 -:10321000FEF79BFC02280FD0012808BF4FF00108E1 -:1032200010D00DE04048FFF740F9002808BF85F8AE -:1032300002B0FFF725F9CFE7B8F1000FE4D1FFDFC7 -:103240004FF0000837484FF0010A062E3BD2DFE866 -:1032500006F083838303833B94F84E10012918BF43 -:10326000042979D059EA080105D194F8651000299C -:1032700018BF022970D194F86410012904BF94F892 -:103280008410002905D02348FFF765F80320287033 -:1032900063E084F884A0007804F18C06C0F3801009 -:1032A00084F88500D4F8E300C4F88600B4F8E70099 -:1032B000A4F88A00A8787F2808BFFFDFA8783070BC -:1032C00085F802B0DFE747E0C178E27991421BD18F -:1032D0000179227A914217D14179627A914213D1D0 -:1032E0008179A27A91420FD1C179E27A91420BD1D0 -:1032F000017A227B914207D10178627BC1F3801170 -:10330000914208BF012200D0002294F84E100DE037 -:10331000880E0020B00E0020DB0E0020A800002048 -:10332000F80D0020D80E0020AA000020012918BFA7 -:10333000042900D14AB979B959EA080105D194F8AC -:103340006510002918BF012906D194F8581019B941 -:1033500094F85910A346C9B1012794F85A0018B13E -:10336000FFF77DF8FEF7D1FB002F1CBF0120FFF710 -:10337000FAFD287800281ABF28780128BDE8F09FB8 -:103380002878032818BFFFDFBDE8F09F06466A686B -:10339000DBF8EF10C2F80D1000786B49C0F3801015 -:1033A0005076DBF8E300C2F81A00BBF8E700D083E0 -:1033B000BBF8F300A2F811009BF8F500D074B07DC3 -:1033C0001075B6F81700D082B6F819005080B6F81C -:1033D0001B009080B6F81D00D08002F1080007F0B5 -:1033E000E8FE96F8240000F01F016868017696F860 -:1033F0002410490980F8CC109BF86600002818BFFB -:10340000FFDF00268BF8686068680188ABF86A10F7 -:10341000417E8BF86D10D0F81A10CBF86E10C18B6E -:10342000ABF872109BF800108BF87410DBF80110E9 -:10343000CBF87510BBF80510ABF879104188ABF8E4 -:103440007C108188ABF87E10C188ABF8801090F8B2 -:10345000CC008BF882009BF88300B8F1000F04BF0A -:1034600020F001008BF883000BD040F001008BF8B6 -:103470008300FEF787FB9BF8831060F347018BF80E -:1034800083108BF866A02E70FEF7CCFFFEF7BEFF10 -:10349000FEF7E0FEFEF743FFFEF75AFF01206968E2 -:1034A00002F06AFB59E770B5FEF7BCFFFEF7AEFF0E -:1034B000FEF7D0FEFEF733FF244C002694F85A00A6 -:1034C00028B1FEF7CCFFFEF720FB84F85A60204DB0 -:1034D0002E70FEF73DFF94F84E004FF000010128DA -:1034E00004D0BDE87040002002F046BB022002F08C -:1034F00043FB94F86600002818BFFFDF68780028B7 -:1035000008BF70BD607B84F86D00207884F874007B -:10351000D4F80700C4F86E00B4F80B00A4F87200E9 -:10352000D4F80100C4F87500B4F80500A4F87900D7 -:103530003C2084F8680068680088A4F86A000120CC -:1035400084F866006E7070BDF70E0020F80D002044 -:10355000A80000202DE9F041FF4F044600207A78B2 -:10356000FE4D4FF00108064612B1012A08D00DE0C9 -:1035700095F8492052B1002908BF87F8018004E07E -:10358000AA7F1AB1002908BF7E7001207A782B2308 -:1035900012FB03F22A44937F184312D021BB02F19D -:1035A0001F012A22A01C07F045FC66700420207031 -:1035B00084F8028078782B2110FB01F0284486776C -:1035C00012E0287801281CBF0020BDE8F08159B91D -:1035D0006670132020701C22A91CA01C07F02AFC76 -:1035E000A6712E7085F89F600120BDE8F081DB4850 -:1035F0000178002914BF80884FF6FF7070472DE9CD -:10360000F041D64C0546A07F002818BFBDE8F081E8 -:10361000284605F053FC00210126072834D2DFE8B4 -:1036200000F004070C3333330E0084F8201009E057 -:1036300084F8206084F828100BE0032000E00220CA -:1036400084F8200004F12901284605F08EFC84F856 -:103650002800284605F054FC84F8210004F12201DA -:10366000284605F036FCBC4D04F1480728787F2831 -:1036700008BFFFDF287838707F202870A677BDE864 -:10368000F041032001F023BB84F82810BDE8F0814D -:1036900010B5002001F0ACFAB04CA0B1FEF747FE27 -:1036A00000210120FEF7E0FC04F1B800FEF753FE14 -:1036B000D4F8A800FEF752FE94F88400032818BF3F -:1036C00002281FD022E0FEF7ADFEFEF79FFEFEF7B8 -:1036D000C1FDFEF724FE94F8A10030B1FEF7BFFE55 -:1036E000FEF713FA002084F8A100012084F8AC0052 -:1036F000022084F8A300FEF72BFEBDE81040002056 -:1037000001F0E5BA01210020FEF7E7FEFEF7C2FE58 -:1037100094F8A10018B1FEF7E4F9FEF78FFE03203C -:1037200084F8A30010BD8D490028B1F8AE202CD03C -:10373000FF2A0BD24FF6FF7000EA4200A1F8AE005C -:10374000FF2888BFFF2001D9A1F8AE008248426857 -:10375000012A12BF002A0D224260D243C2EBC203EB -:1037600003EB021291F8AD30DB4303EB830CCCEB9F -:1037700083131A444260900CB1F8AE20B0FBF2F310 -:1037800002FB130081F8AD007047012ADED9500812 -:10379000A1F8AE0008BF0120D8D1D5E770B56F4CB5 -:1037A00094F8A300022819BF94F8A3000128002070 -:1037B00005461CBF0C2070BD2B2101FB00418D77FD -:1037C000401CC0B20228F7D3257094F8A10028B19C -:1037D000FEF745FEFEF799F984F8A15084F89D5054 -:1037E00084F89E5084F89F5084F8A050012084F8FB -:1037F0007E0084F8845084F8A25084F87B0084F81A -:103800007C0084F87D00606FA16FE26FD4F8803097 -:10381000C4F88800C4F88C10C4F89020C4F8943020 -:10382000D4F88400C4F8980084F89C50002070BD3F -:103830004A4A10B5002382F8A330C2E92C010120C6 -:1038400082F8A300FFF7AAFF002818BFFFDF10BD12 -:103850002DE9F047414C81460C2794F8A30001283C -:103860001FBF94F8A30002280C20BDE8F087FEF7E4 -:1038700067FD0020FEF775FA94F89C004FF00108F0 -:10388000002844D0D4F88800D4F88C10D4F89020C4 -:10389000D4F894306067A167E267C4F88030D4F848 -:1038A0009800C4F88400002684F89D6084F89E6027 -:1038B00094F87B00002801BF94F87C00002894F85D -:1038C0007D0000281ABF94F8A000002884F89C60AE -:1038D00023D094F88400032802D0022805D008E001 -:1038E00005211F4800F0F3FC03E003211C4800F011 -:1038F000EEFC94F87A1004F17400FEF7AEFA00279B -:1039000084F89C6094F8A300012815D10FE094F886 -:10391000A300022808BF0027F4D094F8A3000228CF -:1039200002BF84F8A3800C20BDE8F08704E084F88F -:10393000AC80022084F8A300D4F8B400017819B157 -:1039400010F8041BFEF7BBFAD4F8B000017879B187 -:10395000044A401C08E00000B0000020000F0020D6 -:10396000E00F0020BB0F0020FEF7A9F884F8A1802B -:10397000FD48C4F8A890FEF7CCFCFEF7E9FC3846F9 -:10398000BDE8F08770B5FEF7DBFCF84C94F8A300B7 -:10399000022803D0FEF7DCFC0C2070BD012084F867 -:1039A000AD00A4F8AE000220FEF7C7FCF048FEF719 -:1039B000DFFAF04B002004F17B0200BF94F8A21064 -:1039C000491CA3FB015C4FEA5C0CACEB8C0C614422 -:1039D000C9B284F8A210895C012907D0401CC0B28A -:1039E0000328EBD3FFF754FE002070BD94F8A2002B -:1039F000E149085CFEF7C4FA0020FEF7A1F9F1E7FF -:103A0000DA4B10B44FF0010C83F89EC093F89F403E -:103A1000002C1EBF3A2010BC7047002418B993F840 -:103A20008E0088420FD183F88E1083F89D40106875 -:103A3000C3F888009088A3F88C0083F89DC083F8B1 -:103A4000A0C083F89CC083F89E4010BC0020704743 -:103A50000300C6494FF000004FF0010208BF81F893 -:103A6000922005D0012B16BF122081F892007047DA -:103A700081F89C2081F899307047BC4A032808BF20 -:103A8000C2F8941082F89800012082F89C0000206F -:103A90007047B64890F89C1029B190F8990000281A -:103AA00008BF704704E090F88500002808BF704701 -:103AB0000120704710B5FEF7B5FCFEF7A7FCFEF736 -:103AC000C9FBFEF72CFCA94C94F8A10030B1FEF71D -:103AD000C6FCFEF71AF8002084F8A100012084F843 -:103AE000AC00022084F8A300FEF732FC002010BDD9 -:103AF0009E4981F8A400704710B5FEF793FCFEF7CD -:103B000085FCFEF7A7FBFEF70AFC984C94F8A10091 -:103B100030B1FEF7A4FCFDF7F8FF002084F8A10007 -:103B2000012084F8AC00022084F8A300FEF710FC0A -:103B3000BDE81040002001F0CAB82DE9F05F002672 -:103B4000DFF83882894C7F2780B104F1B80005F096 -:103B500082FA20B904F1B80005F09DFA30B194F86A -:103B6000840003280DD194F89E0050B194F8A3006E -:103B7000052828BFBDE8F09FDFE800F0BABABAF523 -:103B8000F40094F8A3007E4D4FF0010A052880F060 -:103B90005D82DFE800F0FBFBFB03FA00784805F0EC -:103BA0008DF97649887094F87E0030B9FEF7DCF91B -:103BB000002808BF4FF0000801D04FF0010894F82A -:103BC000A100002818BF4FF0280915D0A9F1010065 -:103BD00000F0FF09FDF7B9FF8346022803D1B9F1D0 -:103BE000000FF3D1FFDFB8F1000F14D1BBF1010FCB -:103BF00018BF4FF000080ED0DFF880914FF0020B95 -:103C000099F80200072880F08281DFE800F073F75E -:103C100007F6F6F625004FF00108EDE794F8A1004D -:103C200018B1FEF71CFCFDF770FF5448FEF73DFC91 -:103C3000002808BF89F80070FEF722FCB8F1000FD9 -:103C400000F05F8194F88400012818BF022840F03A -:103C50005881FEF7FFFAEBE094F8A10018B1FEF7E7 -:103C6000FEFBFDF752FF4548FEF71FFC002808BF8A -:103C700089F80070FEF704FCB8F1000F00F04181F4 -:103C800094F88400022803D001287DD000F039B9CF -:103C90003B48FFF7B4FC012000F0AAFF58B13949B6 -:103CA000A1F1280005F039F93648FEF754FB94F8E5 -:103CB0009D00A0B190E0FEF7B5FBFEF7A7FBFEF775 -:103CC000C9FAFEF72CFB94F8A100002870D000BFC1 -:103CD000FEF7C5FBFDF719FF84F8A1609DE0012107 -:103CE0000846FEF7FAFBFEF75EFB052084F8A3000A -:103CF000BDE8F09F94F8A10018B1FEF7B0FBFDF706 -:103D000004FF1E48FEF7D1FB002808BF89F80070A9 -:103D1000FEF7B6FBB8F1000F71D094F884000228CA -:103D200047D0012830D003281CBFFFDFBDE8F09F3B -:103D3000E978D4F88000827E914231D12979C27E1F -:103D400091422DD16979027F914229D1A979427F8F -:103D5000914225D1E979827F914221D1297AC27F8E -:103D6000914214E08BE174E148B50100000F00209E -:103D70004EB50100ABAAAAAA4BB50100B0000020C5 -:103D8000B80F0020E00F002052E0CFE05EE107D145 -:103D90002978427EC1F38011914208BF012100D0F1 -:103DA000002194F88520012A48D0002927D0A0E0DE -:103DB00033E0FE48FFF723FC012000F019FFF8B1C3 -:103DC000FB49A1F1280005F0A8F8F948FEF7C3FA6D -:103DD00094F89D00002882D0D4F888006067B4F879 -:103DE0008C00A4F8780004F17401F14805F06AF839 -:103DF00084F89D6084F89E6071E788E02CE07FE0A5 -:103E0000FEF710FBFEF702FBFEF724FAFEF787FA37 -:103E100094F8A10000287FF45BAF84F8ACA084F88C -:103E2000A3B0FEF795FABDE8F05F002000F04FBFA9 -:103E3000DE48FFF7E4FBBDE8F05F29E4F1BB00BF1B -:103E400000F11A01D94805F044F8D84805F058F8AF -:103E5000D4F8801048764CE094F8A10018B1FEF731 -:103E6000FEFAFDF752FED348FEF71FFB002808BFFD -:103E700089F80070FEF704FBB8F1000F41D0FDF7A0 -:103E8000F4FFE8B394F88400032808D0C748FFF78C -:103E9000B6FBFEF7DFF9BDE8F05FFFF7F9BBD4F83A -:103EA0008000E978827E91421DD12979C27E9142BB -:103EB00019D16979027F914215D100E019E0A97901 -:103EC000427F91420FD1E979827F91420BD1297AC9 -:103ED000C27F914207D12978427EC1F3801191427D -:103EE00008BF012100D0002194F88520012A04D0C8 -:103EF00031B1BDE8F05F00F08FB90029F9D19FE73B -:103F0000FFE7FEF7A7F9BDE8F05FFFF7C1BB94F844 -:103F1000A10018B1FEF7A3FAFDF7F7FDA548FEF7DB -:103F2000C4FA002808BF89F80070A0E09F4804F098 -:103F3000C5FF88F802009E48E978427A91421CD178 -:103F40002979827A914218D16979C27A914214D141 -:103F5000A979027B914210D1E979427B91420CD13F -:103F6000297A827B914208D129780078C1F38011A7 -:103F7000B1EBD01F08BF012500D00025FEF76AF97C -:103F800098F8020004284BD1F5B38A48FEF78DFA61 -:103F9000002808BF88F80070FEF772FA94F8AC00A9 -:103FA00000281CBF0020FFF7BEFB84F8ACA07F4DAB -:103FB00094F8490018B1BDE8F05FFFF769BB042031 -:103FC00084F84B00284604F09BFF002808BF84F8C3 -:103FD0004C6003D0012808BF84F84CA004F14D01C7 -:103FE000284604F076FF04F15401284604F0E9FF66 -:103FF00084F853001F2884BF1F2084F8530004F165 -:10400000730598F8000000E00AE07F2808BFFFDF92 -:1040100098F80000287088F8007084F849A0CAE772 -:104020006448FEF742FA002808BF88F80070FEF7DF -:1040300027FA94F8AC00002804BF0120FFF773FBB7 -:1040400084F8AC60BDE8F05FFFF722BBFFDFBDE89E -:10405000F09F94F8A10018B1FEF701FAFDF755FDA5 -:104060005448FEF722FA002808BF88F80070FEF7CF -:1040700007FAFEF7EFF8BDE8F05FFFF709BB4D4820 -:10408000FEF713FA002808BF88F80070FEF7F8F969 -:1040900094F8AC00002804BF0120FFF744FB84F82B -:1040A000AC60FEF7D7F8BDE8F05FFFF7F1BA70B586 -:1040B000414C94F8A30007285ED2DFE800F05D5D74 -:1040C0005D5D5D040D003948FEF745F9FEF7E2F944 -:1040D000042084F8A30070BDFEF7A4F9FEF796F95A -:1040E000FEF7B8F8FEF71BF9012584F8AC50022062 -:1040F00084F8A300FEF72CF92078002818BFFFDF12 -:104100000020A070D4F880000188A180417EE17178 -:10411000D0F81A10A160C18BA1814188E182818809 -:104120002183C088608394F8A400207794F87A00F3 -:10413000A073606FC4F80F00B4F87800A4F81300FF -:1041400094F8A10018B1FDF700FD012809D0607FA7 -:1041500020F0010060772570BDE87040022000F07B -:10416000B6BD607F40F001006077FDF70BFD617F19 -:1041700060F347016177EEE7FFDF70BD70B50E4C6D -:1041800094F8A3000025052828BF70BDDFE800F0E3 -:104190004343432503000748FEF787F910B9054953 -:1041A0007F200870FEF76CF908E00000B80F0020CF -:1041B000E00F0020B0000020000F002094F8AC00B9 -:1041C000002804BF0120FFF7AEFA84F8AC50FEF7D8 -:1041D00041F8BDE87040FFF75BBAFEF723F9FEF740 -:1041E00015F9FEF737F8FEF79AF894F8A10028B110 -:1041F000FEF735F9FDF789FC84F8A150012084F819 -:10420000AC00022084F8A300FEF7A2F8BDE87040DD -:10421000002000F05CBD70BD70B5022000F0E8FC2D -:104220000025604C0126A0B3012000F050FD04F1F0 -:10423000E001A1F1280004F070FED4F88000C18AEA -:1042400004F1E00004F0E9FED4F88000017D04F1FF -:10425000E00004F0E6FE04F1E000FEF77CF894F8DC -:104260009D0080B1D4F888006067B4F88C00A4F891 -:10427000780004F1740104F1E00004F023FE84F8F6 -:104280009D5084F89E5084F89F60062084F8A30017 -:1042900070BDFFE7FEF7C6F8FEF7B8F8FDF7DAFFE6 -:1042A000FEF73DF894F8A10028B1FEF7D8F8FDF725 -:1042B0002CFC84F8A15084F8AC60022084F8A300A0 -:1042C000FEF746F8BDE87040002000F000BD70B574 -:1042D000344C0546032952D0052918BF70BD04F09F -:1042E000CBFD0521284604F0CAFD94F87A10284633 -:1042F00004F0FDFD04F17401284604F0E3FDD4F858 -:10430000800000F10D01284604F071FED4F8800011 -:1043100000F11101284604F06EFED4F88000017D02 -:10432000284604F07EFED4F88000C18A284604F0B6 -:1043300074FED4F880004188284604F062FED4F868 -:1043400080008188284604F060FED4F88000C1888F -:10435000284604F05EFED4F8800000F108012846EB -:1043600004F076FED4F88000017E284604F05BFE5F -:1043700094F8A4102846BDE8704004F05EBE04F036 -:104380007BFD0321284604F07AFD94F87A10284634 -:1043900004F0ADFD04F174012846BDE8704004F05E -:1043A00091BD0000000F00202DE9F047744E054636 -:1043B00084B096F800040C46DFF8C8A140099AF8CA -:1043C00000144909884218BFFFDF96F8000440092D -:1043D0006D4991F800144909884218BFFFDFDFF8E2 -:1043E000AC816E1E08F13809002709EB4505092C40 -:1043F00080F0C280DFE804F005323C3C37C0C0C02A -:1044000070000B2EA8BFFFDF35F8020C0621F9F76C -:1044100014FB040008BFFFDF0B2EA8BFFFDF35F839 -:10442000020C2188884218BFFFDF94F8980000280A -:1044300008BFFFDFC8F8047088F80170C8F80C7076 -:10444000606AB0F5717F88BFA0F237372046C8F8A0 -:10445000087004B0BDE8F04702F0D5B904B0BDE87B -:10446000F04702F02CBA04B0BDE8F047FEF7FAB806 -:104470009AF8140D4649400991F8001449098842F8 -:1044800018BFFFDF0B2EA8BFFFDF35F8020C062197 -:10449000F9F7D3FA040008BFFFDF0B2EA8BFFFDF38 -:1044A00035F8020C2188884218BFFFDF204602F051 -:1044B000BCFA002818BFFFDF00222146684600F042 -:1044C000EAFC94F8A2006946FBF7BEFD208E401C72 -:1044D000208604B0BDE8F0870B2EA8BFFFDF35F8BB -:1044E000020C0621F9F7A9FA040008BFFFDF0B2E22 -:1044F000A8BFFFDF35F8020C2188884218BFFFDF14 -:1045000094F89800042818BFFFDF84F8987094F896 -:10451000A2504FF6FF76681E0B28A8BFFFDF09EBFD -:10452000450020F8026C94F8A200FBF727F984F804 -:10453000A270D4F8A800002804BFD4F8A400C8F8DA -:10454000100008D0D4E92B12114482691144816112 -:10455000D4E92901C860D4F8A400002819BFD4F810 -:10456000A8100161D4F8A80087610A48007804B057 -:10457000BDE8F047F5F724B8FFDF04B0BDE8F087E9 -:1045800001E000E00BE000E018E000E0081000208F -:1045900019E000E0B80000202DE9F047FD4E074685 -:1045A0000024F08B401C80B2F0833278A046002AB1 -:1045B00008BFFFDF09D0F74B042AA3F114095D6897 -:1045C00013D0052A18BFFFDF44D021463069FBF71E -:1045D000ADFB306187F8008001213971B860B068A7 -:1045E00000F22710F860BDE8F0870A282CBF0220EF -:1045F0000320787100297BD0D6F810A0D9F810409C -:1046000034B3A146E468002CFBD1B9F1000F1FD0F0 -:1046100099F80000002808BFFFDFD9F81410D9F876 -:10462000040001445046FCF707FB002807DA291A6A -:104630004A1E92FBF5F202FB0504294604E090FBBA -:10464000F5F202FB150429468C4288BFFFDFBCE768 -:104650004446BAE702207871002953D0D6F818A052 -:10466000BAF1000F08BFFFDF0025DAF8AC20D9F857 -:1046700010402846691E5CB1A069904228BF814263 -:1046800084BF014625462046E468002CF4D105B9D4 -:1046900005460AF19804CAF8A850002D04BFC4F8D2 -:1046A0000C80C9F8104005D0E868EC60E060002894 -:1046B00018BF0461D4F81090C4F81880B9F1000F45 -:1046C0000ED0D9F8180048B1D4F814A0504538BF1E -:1046D000FFDFD9F81800A0EB0A00A061C9F8188024 -:1046E000002D08BFC6F8208009D02878002800E0F7 -:1046F00008E008BFFFDF696968680844306240F677 -:10470000B83462E72C4660E72DE9F041A24C8046C0 -:1047100084B094F800040E46A04F410997F80004B5 -:104720004009814218BFFFDF94F8000440099C490A -:1047300091F800144909884218BFFFDF00250122C3 -:10474000092E944C5ED2DFE806F0051B3636315D4B -:104750005D184C0062732273607800281CBF04B09F -:10476000BDE8F0818F484560C5602573A068CD38ED -:10477000FFF76EF8002818BFFFDF04B0BDE8F08136 -:10478000607850B1207B002808BFFFF793F965736C -:1047900004B0BDE8F041FAF738BFA273FFF7F2F8B2 -:1047A000002818BFFFDF04B0BDE8F08104B0BDE809 -:1047B000F041FDF757BF97F8140D7B49400991F878 -:1047C00000144909884218BFFFDF01220021684612 -:1047D000FFF7E2FE69464046FBF736FC04B0BDE851 -:1047E000F0812078052818BFFFDF207F002808BF50 -:1047F000FFDF25772570207DFAF7C0FF257504B00F -:10480000BDE8F081FFDF04B0BDE8F0812DE9F041A3 -:10481000604C84B00025207804281FBF207805282C -:104820000C2004B018BFBDE8F08101276770607BE1 -:10483000002690B172B6607B00281CBFA07B0028C8 -:1048400005D0FFF737F96673A673FAF7DEFE62B696 -:10485000207DFCF77BFAD0B913E094F81480032094 -:104860008DF804008DF80500FAF79EFF02904FF0D6 -:10487000FF3003908DF8007069464046FBF7E4FB7B -:10488000E6E720BF207DFCF761FA0028F9D0207F01 -:1048900028B126772078052818BFFFDF0C25667021 -:1048A0002670207DFAF76AFF267504B02846BDE819 -:1048B000F0812DE9F047374884B00078002818BF10 -:1048C000FFF7A4FF0120374E307069460620F9F744 -:1048D00040F8002818BFFFDF00254FF6FF7718E0EB -:1048E000029800281CBF90F89810002911D0008869 -:1048F000B84218BFDFF8B48045D00621F9F79DF81B -:10490000040008BFFFDF94F8A200FCF71FFA68B9A3 -:1049100005E06846F8F7FBFF0028E1D033E020BF50 -:1049200094F8A200FCF712FA0028F8D084F8985006 -:1049300094F8A2904FF6FF7AA9F101000B28A8BFC6 -:10494000FFDF08EB490020F802AC94F8A200FAF768 -:1049500015FF84F8A25069460620F8F7FAFF0028F0 -:1049600018BFFFDF0AE0029800281CBF90F89810DB -:10497000002903D00088B842BFD104E06846F8F7A8 -:10498000C6FF0028EFD03570356104B00020BDE8C7 -:10499000F08700001C10002001E000E00BE000E0C8 -:1049A00018E000E00810002019E000E040100020AE -:1049B00010B50078FE4C60B101280CBF40F6C41061 -:1049C000FFDF06D0A06841F66A01884228BFFFDFFA -:1049D00010BDA060F6E710B5F54C00232070F54837 -:1049E00003704370037703734373837383610375A9 -:1049F00024304FF6FF7101800522418020F8041F0A -:104A0000521EFAD1180008BFA36005D0002B0EBFBC -:104A1000FFDF40F6C410A060A06841F66A0188423A -:104A200028BFFFDFBDE8104043E770B5E14C0E46FC -:104A300084B02178154600291EBF0C2004B070BD3B -:104A4000416A01F29731C0F8AC10A06190F898006B -:104A5000002818BFFFDF40F2712006FB00F1684319 -:104A60000A30C4E90110A1F53D71884288BF0846AB -:104A7000A060D1490020C8600521217060702077B6 -:104A8000E083CE48FAF72BFE2075002808BFFFDF31 -:104A9000FAF78AFE2061002201216846FFF77CFDBB -:104AA000207D6946FBF7D0FA04B0002070BD884233 -:104AB00034BF012200220244D2B2814234BF01201D -:104AC00000200844C1B28A4234BF08461046831A07 -:104AD000A0EB010C114401EBC102634402EB411154 -:104AE00003EB83031B0100EB400203EBC10102EB6C -:104AF000001201EBC201C0EBC00202EB401001EB5F -:104B00008000983870474FF44B72B1F54B7F38BF37 -:104B1000114641627047A748007800281CBF00205A -:104B2000704710B50620F8F725FF80F0010010BD92 -:104B300010B5A04C84B02278002A1EBF0C2004B00F -:104B400010BD40F27122424340F2712048430A30C6 -:104B5000C4E90120A2F53D71884298BF01460020BA -:104B6000A160607004212170E0839448FAF7B7FDDA -:104B70002075002808BFFFDFFAF716FE40F6B831AF -:104B8000FBF7D4F82061002201216846FFF704FDFD -:104B9000207D6946FBF758FA04B0002010BD70B5BF -:104BA000844CA1690160FFF731FE002308B1A361C5 -:104BB00070BDA169D1F8A8205AB1D1E92BC5AC4488 -:104BC0009569AC44C2F818C0D1E9292CCCF80C2066 -:104BD00005E0DFF8E4C1D1F8A420CCF81020D1F82A -:104BE000A420D1F8A810002A14BF11618B61DEE760 -:104BF000714910B54968002801F1980408BF04F50F -:104C0000BC7409D0012808BF04F5317404D002280F -:104C100014BFFFDF04F5B07466488068A0428CBF03 -:104C20000120002010BD6448D0E90112914204D255 -:104C30000078002804BF012070470020704730B57D -:104C40005B4D85B0042221B3012908BF03211CD08C -:104C5000022908BF80F8982023D003291EBFFFDF58 -:104C600005B030BD418840F2E2425143544A1160E0 -:104C7000D0F8BC100A89C2828A7902754A894280BA -:104C80008A898280C989C180022180F8981005B084 -:104C900030BD044648480078002818BF84F89820A2 -:104CA00007D0FAF7B2FC287805B0BDE83040F4F739 -:104CB00087BC01222146684600F0EDF894F8A20076 -:104CC0006946FBF7C1F9208E401C2086E9E72DE9F3 -:104CD000F041374F0100374C387884B04FF0000571 -:104CE0000ED001291CD0022976D003291EBFFFDF78 -:104CF00004B0BDE8F08104B0BDE8F041F4F760BC59 -:104D0000E583F4F75DFC6078002875D10022114638 -:104D10006846FFF741FC207D6946FBF795F96BE09B -:104D2000DFF89480206940F2E243D8F80410084488 -:104D3000A16900F251604A88983102FB03F5D8F866 -:104D400010208A4208BF002614D0216AFBF774FFA6 -:104D5000002807DA291A4A1E92FBF5F202FB050623 -:104D6000294604E090FBF5F202FB150629468E4227 -:104D700088BFFFDFB868864208D2A06940F271227E -:104D80004188C1824A4306EB420605E040F2E24018 -:104D9000B6FBF0F0A169C882A06905210175C08A3F -:104DA0006FF41C71484306EB400040F635410AE0C1 -:104DB000B80000201C100020081000200947010046 -:104DC000BC00002008E0C8F80C00B0EB410F28BF81 -:104DD000FFDF04B0BDE8F081E583F4F7F1FB0120CB -:104DE0002077A0692169C0F89C1080F8985021783C -:104DF000052918BFFFDF06D0FAF707FC6573A57316 -:104E000004B0BDE8F081002808BFFFDFA06990F87A -:104E10009800002818BFFFDFA06990F8A2000028C2 -:104E200018BFFFDF5B48FAF75AFCA169064681F814 -:104E3000A2000F88401E0B28A8BFFFDF564800EBDA -:104E4000460020F8027CA06990F8A200002808BF64 -:104E5000FFDF01226846A16900F01DF8A0696946DC -:104E600090F8A200FBF7F0F8A561C5E7704700B520 -:104E70004A4A59B1012908BF401E07D002291CBF68 -:104E8000FFDF00BD5178491C5170C01F506000BD4C -:104E90004348007870472DE9F05F06460C46488885 -:104EA00040F2E24141439046E08A40F2E24200FB98 -:104EB00002FA94F898200025384F4FF0030B4FF07A -:104EC000010952B13846012A40682DD0022A16D075 -:104ED000032A18BFFFDF27D036E0B8F1000F08BF64 -:104EE000FFDF7868002808BFFFDF7868F968C01D19 -:104EF00008440AF25D41451884F8989023E0A8F12F -:104F00000101084308BFFFDF2648B8F1000F006821 -:104F100000EB0A0505D0786800F20F30A84288BF80 -:104F2000FFDF84F898B00EE00D46B8F1000F0AD00C -:104F300018B97878002818BFFFDF786800F20F30C2 -:104F4000A84288BFFFDF05B9FFDF2946D4F89C00DF -:104F5000FAF7ECFEC4F89C000020307086F804904C -:104F6000D4F89C00B060204601F095FD002818BFE1 -:104F700086F8059005D0606A00F5E570F060BDE840 -:104F8000F09F94F89800012806BF0220707186F8FF -:104F900005B0F0E7A94301004010002008100020F0 -:104FA0001C100020BC000020FE48C07E7047FE4858 -:104FB00040687047FD48C07E7047884234BF012278 -:104FC00000220244D2B2814234BF012000200844B2 -:104FD000C1B28A4234BF08461046831AA0EB010CC6 -:104FE000114401EBC102634402EB411103EB830363 -:104FF0001B0100EB400203EBC10102EB001201EBCD -:10500000C201C0EBC00202EB401001EB80009C38F3 -:1050100070474FF44A72B1F54A7F38BF114641627A -:1050200070472DE9FF4FDF4E83B08846706A3468C1 -:105030005FEA03090568D4F804B0306A0190298E4C -:105040000598A0EB010080B2009019BF04F1380769 -:1050500004F1480A371D05F1A80A032038710398A6 -:10506000002832D0012800F0DF8002287DD00328FC -:1050700018BFFFDF00F00C81B9F1000F1EBF3879B7 -:105080000328FFDFA16A7069FAF750FEB860D4E91F -:10509000081081428EBFCAF800000846CAF8001006 -:1050A000696A084400F24F10F860B5F89810059846 -:1050B000081A00B2002840F349810398022818BF5B -:1050C000032040F0448100F041B9306A002808BF55 -:1050D000FFDFE98A40F27120484340F2E24101EBF0 -:1050E00040010020B8F1000F06D0B14808FB01F1E3 -:1050F000B1FBF0F000F10100A061698840F2E242EA -:1051000001FB02F24FF0000106D0A94908FB02F2B0 -:10511000B2FBF1F101F10101E161316A40F2712369 -:1051200001F10101A162EA8A02FB03F2C0EB420233 -:1051300002F237421144A1622A7D40F2E24312FB9F -:1051400003F202EB400000F2151020626062306A48 -:10515000A1EB00009749A0F1010009188CD2B0F52D -:10516000387F98BFFFDF5CE0FFE7E98A40F27122F9 -:10517000E068514300EB41010020B8F1000F06D078 -:105180008B4808FB01F1B1FBF0F000F10100A061D8 -:10519000688840F2E24100FB01F14FF0000006D0C8 -:1051A000834808FB01F1B1FBF0F000F10100E06180 -:1051B000306A002808BFFFDFB5F8AE00E98A002892 -:1051C00040F27122E06801FB02F100EB4100A169AD -:1051D000A0EB010003D13168D33849680844A062CC -:1051E0002269A168A06901FB0200297D40F2E24228 -:1051F00011FB02F101EB400000F2131020626988FC -:105200005210E0695143C0EB4100A0F54770606265 -:10521000A06A316A401AA0F5AA7167484018BFF425 -:105220002BAF0120387127E7B5F8AE00002808BF82 -:10523000FFDF306A002808BFFFDF698840F2712273 -:10524000E0695143C0EB4101A162B5F8AE3022697B -:10525000D4F818C0D4F808809B1A08FB02C203FBDC -:1052600000202A7D40F2E24312FB03F202EB4000F1 -:1052700000F213102062A1F547706062306A081ACC -:10528000A0F5AA714C484018BFF4F6AEC9E700BFBC -:10529000B9F1000F1CBF94F83400002803D007B008 -:1052A0000220BDE8F08F698840F27122E069514325 -:1052B000C0EB410100984843A062B5F8AE0030B39E -:1052C000BBF1000F18BFFFDFB5F8AE100098002249 -:1052D0000844E169484302EB400000F213102062E9 -:1052E000688840F271225043C1EB4000A0F547703E -:1052F000606232484068B0B1A26A01990120511A37 -:10530000A1F5AA722C49891838BF3871B4E6BBF1EF -:10531000000F1ABF01980028FFDFABF1D301A06A8C -:105320000844A062D0E7FAF73FFA726901461046D6 -:10533000FBF782FCA16A081AA0F24F111E48401820 -:105340003EBF012007B0BDE8F08F95E600207871E0 -:105350001098C8B1B5F8C01000290CBF0020B5F8EE -:10536000C200A5F8C20095F8C420401C50438842F2 -:105370000AD27879401E002806DD01207871B5F840 -:10538000C200401CA5F8C20087F80090B9F1000FD8 -:105390001CBF94F83400002881D189F0010084F802 -:1053A00035000DE058100020DC00002080100020A7 -:1053B00040420F00DBF7FFFFF4F8FFFFCC000020B6 -:1053C000307FF27E3946B37E9A4202D0FAF73CFE35 -:1053D00004E00020F076B0763060706207B0002004 -:1053E000BDE8F08F70B5FD4D0929D5E900326FD2C7 -:1053F000DFE801F0055B73816F9494589000002002 -:105400001062D17E04294ED2DFE801F04D4D0245F5 -:10541000516A0C681168087011684860106890F84B -:10542000350040B9FAF7C0F969680968096CFBF7FB -:1054300003FC002818DC686801684A8E218E8A42C5 -:1054400006D1B4F89C20511AA4F89E10228605E0DB -:10545000511AA4F89E100168498E21860268C1681D -:105460001164C168416111E068680168098E228E8B -:10547000891AA4F89E100168098E218601680A6CB9 -:10548000C2600A6C4261886CC4F8A8002046BDE87E -:10549000704002F01DBAD0685061FDF7ABFC0028E7 -:1054A00018BFFFDF70BDFFDF70BDD07E04280DD2B6 -:1054B000DFE800F00C0C0206BDE8704002F0D8BA3C -:1054C000FDF7D9FD002818BFFFDF70BDFFDF70BDFD -:1054D00024E0BDE87040FDF7C5B8D87E022804D0AE -:1054E000D87E032818BFFFDF0CE0BD48007D0128EF -:1054F00008BFFFDF0AE0D87E022807D0D87E032845 -:1055000018BFFFDFBDE8704000F0B5BBBDE87040DC -:1055100000F0FCBBBDE87040FAF730B9FFDF70BDAA -:105520002DE9F047AD4D0024AE4E82460F464FF0B8 -:10553000010809294ED2DFE801F0053B46463B4D04 -:105540004D4646006868DFF89C92002818BFFFDFD0 -:1055500039465046C5F80490FFF744FFF07E022814 -:1055600018BFBDE8F08768680568406A0768FAF701 -:10557000FEF87A8840F27123E9695A43C1EB42018F -:10558000AB39B72898BFB72000F54A70081A796A76 -:10559000A0F20130B1F5717F88BFA1F5717484422A -:1055A00038BF2046E862306880F83480BDE8F08774 -:1055B0005046FFF717FFF07E022804BF306880F8DE -:1055C0003480BDE8F08750462E60FFF70BFF2C605B -:1055D000BDE8F087FFDFBDE8F0872DE9F0417F4CA3 -:1055E00007460D4609291ED2DFE801F00510141404 -:1055F000101D1D14140060687B4E002818BFFFDFCB -:10560000294638466660BDE8F041EBE63846BDE81D -:10561000F041E7E6744820603846FFF7E3FE0020DB -:105620002060BDE8F081FFDFBDE8F081F0B56D4995 -:1056300085B00026CA7E694C032A03D02831CA7E71 -:10564000032A64D10025216000B3012806BF03208E -:105650008876FFDF0AD02068002E0560456225604D -:1056600055D06248456005B00020F0BD2068C17E7D -:1056700029B1C17E827E914208BF20BFF6D0C17E93 -:1056800000290CBF012600268576E4E700260327C3 -:1056900008468F76C97E032904D0C07E002808BF43 -:1056A000012631E00120FDF705FD2068007F00287C -:1056B00008BFFFDF2068067F8DF804708DF8057045 -:1056C000FAF772F802904FF4FA70039001208DF807 -:1056D000000069463046FAF7B7FC2068007FFBF708 -:1056E00035FB30B920BF2068007FFBF72FFB002877 -:1056F000F8D02068007FFAF741F820680577C57672 -:10570000857605600126456220688576A3E705B0A9 -:105710000C20F0BD10B5334800F076FB324800F0A5 -:1057200073FB2F4900200875304948702D494861A6 -:1057300001F1280250618876907628494860086017 -:1057400010BD2DE9F0412A4C064694F80004294D7D -:10575000400995F800144909884218BFFFDF94F802 -:1057600000044009244991F800144909884218BFEF -:10577000FFDF95F8140D4009204991F800144909FC -:10578000884218BFFFDF1E48164D00240670EC76D5 -:10579000AC7605F12806F476B4761030012101715B -:1057A00004606C6274622C6000F108073460284663 -:1057B0007C6000F029FB05F1280000F025FB05F1D5 -:1057C000500004757C706C617461AC76B476A7F19E -:1057D000100044600460BDE8F0810000CC000020AF -:1057E000A81000205810002080100020DC000020AD -:1057F00001E000E00BE000E018E000E019E000E06C -:10580000C4000020F849087170472DE9F843F749B2 -:105810000546CA7EF64C01F12800002A04BFC27E6C -:10582000002A73D0C97E022907BFC17E00290C203F -:10583000BDE8F8832060EF48F9F751FF2168087749 -:10584000ED4845602168086014384862ADB1012117 -:1058500005F1C400FBF762FD0620F8F799F806464B -:105860000720F8F795F895F8C4103044B1FBF0F232 -:1058700000FB1210401C85F8C4002068007F00283F -:1058800008BFFFDFF9F773FFDC49091838BF40F2A2 -:10589000F65000F26B1087B220680326C676FDF73B -:1058A000B2F921680861FDF7D2F94FF0010800252F -:1058B00058B3FDF7CCF921684A6A106008680121E5 -:1058C00080F800806846FBF7B4FC9DF8000042F2C7 -:1058D00010710002B0FBF1F201FB1208F9F764FF4E -:1058E00007EB0801FAF722FA2168C86022681672ED -:1058F00056721571107FD37E111D92F81AC0634540 -:1059000018D0FAF7A1FB19E000E006E0BC482160DE -:10591000F9F7E5FE2168087792E7F9F745FF394680 -:10592000FAF704FA2168C86008680570086880F80A -:105930000180DBE7D5769576156055622068058392 -:105940000020FDF7B7FB00202560BDE8F883704715 -:10595000F8B5A64EF17E19B906F12801C97E09B144 -:105960000C20F8BD0221F1769F4FA64D776235607D -:10597000002438602C750094A3493A7990F8CC0043 -:10598000234631F8122031F81000104481B222462B -:105990002046FFF746FB002818BFFFDF2C610120DF -:1059A000AC6028756C862C8685F836403868018E88 -:1059B000491E018634830020F8BD8D4810B540682B -:1059C0000124817E032908BF002409D00168497899 -:1059D00031B1006A8D49884284BF0024FDF766FB1F -:1059E000204610BD8248406801680A78521C0A703F -:1059F000016A0068C26A914204D8007D01281CBF78 -:105A000001207047002070472DE9F843784C774813 -:105A100000262060416A00680D6880F8346095F8BF -:105A2000A610002904BF007D032850D1F9F7BCFE61 -:105A30002268526901461046FBF7FEF8002846DD51 -:105A4000216840F271274A6A13680A685B88D2F8B5 -:105A50001CC07B43CCEB4303B0FBF3F02B8E401C0C -:105A6000184410860A68B5F89C00118E401A00B2DE -:105A700000282CDD012082F83600B5F84E00B5F87C -:105A80004C10DFF88481401A298E401E084487B2EA -:105A900016E0496A097938F811100096028E95F8D7 -:105AA000CC30007D38F81330194489B20123FFF758 -:105AB000B8FA60B101280DD0022818BFFFDF06D068 -:105AC00021680868028EBA1A12B2002AE1DA26604A -:105AD000BDE8F88320680068018E491C0186EFE765 -:105AE00070B5434E00240628756843D2DFE800F005 -:105AF0001820030E240D002000F0C3F9EC76AC76DC -:105B00002C606C62706888B1746070BD4048356804 -:105B10000078F3F755FDEC76AC762C606C6270BDC6 -:105B2000012000F0AEF970680028EDD1FFDFEBE74F -:105B300029680320087570BD686A29680068CA6909 -:105B40008A60418840F2E24251432A68D160B0F84D -:105B5000E810C18290F8E6100175B0F8EA104180B3 -:105B6000B0F8EC108180B0F8EE10C18029680220F6 -:105B7000087570BDFFDF70BD70B51D4D002470B19C -:105B8000012812D002281CBFFFDF70BD00F0D5F93C -:105B90006868C47684760460446220B93BE000F013 -:105BA000CCF96868B0B36C6070BD686801684C700F -:105BB000C4768476104E046044620021706802F05E -:105BC000EDFE706880F8E24080F8E340FFF7C0FE29 -:105BD000002818BFFFDFF9F718FD0D486C6000784A -:105BE000F3F7EEFC6C6070BDD4000020581000206C -:105BF000CC000020DB550100DC0000200AFAFFFF8A -:105C000021550100A810002052B50100CF821300D9 -:105C1000C4000020FFE7FFDFC5E7E7494968CA7E07 -:105C2000022A18BF70470A681378002B18BF704704 -:105C300050600968CA6A10442838C8627047DE4A52 -:105C400000B5526841B1012908BF401E04D00229A5 -:105C500016BFFFDFC01F00BD106200BDD748C07E69 -:105C600000281CBF0020704710B50720F7F782FE00 -:105C700080F0010010BD38B5CF4C2068016849782C -:105C8000012932D001216846FBF7D3FA9DF80000C4 -:105C900042F210710002B0FBF1F201FB1201206828 -:105CA000426AC06812681144FAF740F82168C86077 -:105CB000C249226803208A4205D0118B0A2924BFD9 -:105CC0000221517203D2118B491C11835072107240 -:105CD00000231371107F92F81BC0111D947EA44500 -:105CE0000FD0BDE83840FAF7AFB9C0684FF47A7109 -:105CF000FAF71CF82168C860FCF785FF2168086185 -:105D0000D6E7D37693761360536238BD2DE9F84316 -:105D1000A94E3068416A04680D6894F8351031B1B5 -:105D2000618E2A8E914202BF407A0028FFDFF9F788 -:105D30003BFD3268526901461046FAF77DFF336831 -:105D40004FF000090028596A096808BF48460AD080 -:105D50001A68498840F2712CD26901FB0CF1C2EB40 -:105D60004101B0FBF1F02A8E618E02EB000C61451F -:105D7000AEBF481C401C1044608694F8360030B911 -:105D8000608EB5F89C10884204BF401C6086188B5A -:105D90008B4F401C1883B5F84E00B5F84C10401AD4 -:105DA000298E401E08441FFA80F818E03068406AC7 -:105DB000007937F81000CDF8009095F8CC1037F83E -:105DC0001110084481B2207D0023FFF72AF9002832 -:105DD00008BFBDE8F883012818BFFFDF10D0628E2E -:105DE000A8EB020000B20028E0DA082085F84A009B -:105DF000012085F849002846BDE8F84301F037BA8C -:105E0000608E401C6086EAE72DE9F047DFF8B48138 -:105E1000694C05464FF01F090027EE7E042E23D261 -:105E2000DFE806F02922021D454518BFFFDF0220EA -:105E30002560A8762168C87E28B1C87E8A7E9042F7 -:105E400008BF20BFF6D0C87E8F7600281CBF4FF059 -:105E50000C0927600CD10F604F6227600BE0012016 -:105E6000FFF7E4FB814600E0FFDFB9F1000F02D04D -:105E7000E87EB042D1D1E87E002818BFFFDFBDE840 -:105E8000F087F8B54C4D002601286A68516A0C6805 -:105E900044D108794A4B33F81010106890F814C0B8 -:105EA0000127BCF1030F06D0027D022A12D0007D2B -:105EB000012823D032E0066110688660009794F8CC -:105EC000CC00B4F89C2033F810000023084481B2C1 -:105ED00003201EE0B4F8AE200261009794F8CC00D5 -:105EE000B4F89C2033F810000023084481B202204B -:105EF000FFF797F8696809680F750CE0009794F848 -:105F0000CC00B4F89C2033F810000023084481B280 -:105F10000120FFF786F8002818BFFFDFF9F775FBAF -:105F200029480078F3F74CFB686806830268218EE5 -:105F30005186006880F83660F8BD38B51E4C0020E8 -:105F40000546616809684A78002A18BF4D702AD151 -:105F5000097861B101216846FBF78FF99DF80000CF -:105F600042F210710002B0FBF1F201FB1200626814 -:105F7000516A09680144D068F9F7D8FE6268D060B8 -:105F8000157103205072107FD37E111D92F81AC034 -:105F9000634502D0FAF758F803E0D5769576156098 -:105FA000556260680583F9F730FB07480078BDE863 -:105FB0003840F3F705BB0000CC0000208010002023 -:105FC00052B5010058100020C400002010B584B064 -:105FD00004466846FCF71BFD002808BFFFDF009859 -:105FE00003F09DF80321009803F0B3F800980178BE -:105FF00021F010010170214603F00EF90D2C7CD226 -:10600000DFE804F03122075CABABAC159AABACAC6B -:106010008100FE48806890F8B510009803F07BF985 -:10602000FCF708FD00281CBF04B010BD81E0F74854 -:10603000806890F89110009803F0BDF9FCF7FAFC25 -:10604000002808BFFFDFA6E0F0488068D0F8C00055 -:10605000411C009803F050F9FCF7ECFC00281CBF31 -:1060600004B010BD65E0E94CA068D0F8BC008179AF -:10607000009803F015F9A068D0F8BC0001890098D9 -:1060800003F007F9A068D0F8BC004189009803F03C -:10609000EBF8A068D0F8BC008189009803F0EBF819 -:1060A000A068D0F8BC00C189009803F0EBF8FCF7B9 -:1060B000C1FC00281CBF04B010BD3AE0D34CA0685E -:1060C000D0F8BC00011D009803F029F9A068D0F8B1 -:1060D000BC0000F10C01009803F02BF9A068D0F887 -:1060E000BC0000F11E01009803F029F9A06800F13E -:1060F0008801009803F031F900E02EE0FCF79AFCEB -:1061000000283CD145E0C14C60690178009803F05B -:106110003CF960698188009803F039F96069418829 -:10612000009803F038F9FCF785FC00281CBF04B088 -:1061300010BDFFDF04B010BD0020029003909DF859 -:10614000080002A940F001008DF80800009803F053 -:1061500034F9FCF76FFC90B91BE0FFDFFCF76AFC39 -:10616000002808BFFFDF0C2C04BF04B010BD072CB3 -:1061700011D0012C19BF002C022C04B010BD00213D -:10618000A2488068A0F85210012180F8561004B08F -:1061900010BDFFDFF3E79D4900208968A1F8580092 -:1061A00004B010BD2DE9F843984D04464FF00006A9 -:1061B0006878084368702846A988806811F0200F25 -:1061C00018BFA0F84C6004D1B0F84C20521CA0F8C5 -:1061D0004C2011F0600F4FF0010707D090F83E10EF -:1061E00021B980F83E700121FEF729FD4FF0080823 -:1061F000002C40F018826878002840F01681287939 -:1062000010F0040F0DD0A86890F83B00052808BFD7 -:10621000FFDFA86890F83D10022904BF2F7080F8B6 -:106220003D60287910F0020F00F0CD8068780028DA -:1062300040F0C980E868C0780D2880F0C380DFE8AE -:1062400000F04333076FC1C1851823C15264900029 -:10625000A8680023012190F83D20303002F0C3FDF2 -:1062600000283FD1A868032180F83D1080F85660CF -:106270008DE0A8680023194690F83C20303002F0E9 -:10628000B2FD00287ED19EE0A8680023194690F850 -:106290003B20303002F0A7FD002808BFFFDF0920B7 -:1062A000A96881F83B008EE0A8680023194690F8A1 -:1062B0003B20303002F097FD002808BFFFDF0720A9 -:1062C000A96881F83B007EE0A8680023194690F891 -:1062D0003B20303002F087FD002808BFFFDFA868B0 -:1062E00080F83B806FE0A8680023194690F83B20B7 -:1062F000303002F078FD002808BFFFDFA8680A21CF -:1063000080F85B7080F83B105DE0A86890F83B0077 -:106310000D2818BFFFDFA8680C2180F85C7012E020 -:10632000A8680023194690F83B20303002F05BFD4E -:1063300028B9A86890F85C00002808BFFFDFA868AB -:106340000E2180F85B7080F83B103CE0A86890F864 -:106350003B00132818BFFFDF1520A96881F83B0018 -:1063600031E0A868D0F8BC1003884A889A4204BF7C -:10637000097804290ED0A8680023194690F83C201B -:10638000303000E002E002F02EFDE0B1A86880F8B5 -:106390005A6018E090F83B2000231946303002F094 -:1063A00022FD002808BFFFDFA86890F85E1011F0FA -:1063B000020F0FBF80F83B7080F85660D0F8BC0029 -:1063C0000670D8E7FFDF287910F0080F0AD0687848 -:1063D00040B9A86890F83D10032903D10221297023 -:1063E00080F83D6000F0E2FBA87810F0080F19D0AB -:1063F000A8680023052190F83B20303002F0F3FC20 -:1064000070B185F80180A86802E00000E400002077 -:10641000D0F8D01008780B2808BF0020087001E0E1 -:1064200002F029F8A86800F046FB6846FCF7EFFA8E -:10643000002800F0F8806878002840F0F480A86810 -:106440000023012190F83D20303002F0CCFC0028E0 -:1064500040F0E980A86890F8B410002918BF022025 -:1064600026D190F83B200C2A0ED00D2A08BF0B2015 -:106470001ED0132A08BF06201AD000230421303072 -:1064800002F0B1FCB8B1CEE0FAF7F6FE0C284DD31D -:10649000A8680821D0F8BC001E30FAF7EEFE28B13B -:1064A000A86804218830FAF7E8FE00B9FFDF03206E -:1064B000FFF78CFDB7E0A86890F83C10012927D0C1 -:1064C000052920D0D0F8BC100A7882B34988028808 -:1064D000914261D190F83B2000231946303002F000 -:1064E00082FC20B3A868D0F8BC100978022908BF44 -:1064F000002026D003291BD004293AD0052908BF43 -:1065000008201ED048E00720FFF760FDA8680BE0D8 -:106510000C20FFF75BFDA868A0F8586090F85E10AB -:1065200041F0010180F85E1080F83C607BE033E0D0 -:1065300090F83F1041B190F84000002808BFFFDFFD -:106540000A20FFF743FD27E0FAF796FE0C2823D335 -:10655000A8680821D0F8BC001E30FAF78EFE28B1DA -:10656000A86804218830FAF788FE00B9FFDF03200D -:10657000E7E790F85E0010F0030F0DD10C20FFF755 -:1065800025FDA868A0F8526080F8567090F85E105B -:1065900041F0010180F85E106846FCF738FAE0B37C -:1065A000A8680023194690F83B20303002F01BFC0D -:1065B00098B3A86890F8C41079B3A969097861BB49 -:1065C000018E0A292FD900F108010522E86904F09B -:1065D00005FC0028A86808BF80F8C46023D0D0F864 -:1065E000C000017851B1411C0522E86904F0F6FBB6 -:1065F00098B9A868D0F8C000007830B9A868E969EF -:10660000D0F8C000401C04F0D4FDA868D0F8C00049 -:106610000178491C0170012000E004E0FFF7D6FC7E -:10662000A86880F8C460A868A14600F1300490F81A -:10663000B40030B9627B00230121204602F0D3FB75 -:1066400010B1208C401C20843D21B9F1000F18D1DD -:106650002878022808BF16200ED0012804BFA86899 -:1066600090F8B60008D06878B0B110F0140F1CBFD5 -:106670001E20A07602D005E0A07603E010F0080FFF -:1066800002D0A17667763AE010F0030F08BFFFDF73 -:106690002A20A076677632E094F8260028B1608C34 -:1066A000411C6184A18C884213D294F82A0028B13D -:1066B000208D411C2185A18C88420AD2208CE18B3F -:1066C000884203D3AA6892F8B42012B9A28C9042EF -:1066D00003D32220A076677611E0A07B0028A08B50 -:1066E00005D0884228BF84F81A80CBD205E006285E -:1066F00003D33E20A076677601E0607E40B1E6726B -:106700002673A673A868BDE8F8430221FEF797BA7E -:10671000A868BDE8F8430021FEF791BAFE494A781F -:106720008B781A430ED101280AD0087910F0040F93 -:1067300004D0886890F83D00022803D001207047FB -:10674000FEF771BA0020704770B5F34C05460E464F -:10675000A0882843A08015F0020F04D015F0010F87 -:1067600018BFFFDFE66015F0010F18BF266115F0B6 -:10677000020F13D0304602F075FD062802D00B2818 -:1067800030D00BE0A06890F83B10132906D100210F -:10679000C0E91C115FF0010180F8401015F0800F76 -:1067A0001CBF0820A07015F4806F08BF70BDA168E1 -:1067B000088E89880844801D85B2304602F052FD5B -:1067C000012817D0304602F04DFD002818BF70BDDB -:1067D000A0682946D0F8BC0085803046BDE87040EE -:1067E00002F062BDA06890F83B100D2908BF00219F -:1067F000D4D1D1E7A0682946A0F8C6503046BDE8FC -:10680000704002F081BDF8B5C34C00260546A0607B -:10681000A6806670A67026700088FCF7F5F8A06860 -:106820000088FCF717F9B5F8A000A168401C82B2F7 -:1068300001F1300002F0FDF9002818BFFFDFA5F8D4 -:10684000A060A06890F8561031B1B0F85210B0F8BE -:106850005420914228BFF8BD90F85A1031B1B0F8D9 -:106860005810B0F85420914228BFF8BDB0F850201D -:10687000B0F84E108A4228BFF8BD90F83E20B0F81C -:106880004C00CAB1884228BFF8BDA4480090A44B70 -:10689000A44A2946304601F066FCA0680023052181 -:1068A00090F83B20303002F09EFA002808BFF8BD77 -:1068B000BDE8F84001F053BC0628E6D3F8BD964881 -:1068C000806890F8561029B1B0F85210B0F85420F2 -:1068D000914219D290F85A1029B1B0F85810B0F876 -:1068E0005420914210D2B0F85020B0F84E108A4295 -:1068F0000AD290F83E20B0F84C001AB1884203D278 -:1069000001F08BBD0628FBD3002001464AE42DE9A7 -:10691000F0410C4607461D461646D8212046DDF8B4 -:10692000188004F020FB2780C4F8D080C4E92F65CC -:10693000BDE8F081F7F7A4B970B50C4615460621FD -:10694000F7F77BF8002808BF70BDD0F8D0100A78A0 -:106950000021072A1ED00C2A2FD00B2A3BD0062A52 -:1069600049D090F8C820002A04BF002070BD617093 -:106970001222227090F8C82052B100BF80F8C810CF -:10698000D0F8CA20C4F8022090F8C820002AF5D117 -:10699000012070BD002DFBD1617007222270D0F85C -:1069A000D0205368C4F802309368C4F80630928946 -:1069B0006281D0F8D0000170EAE7002DE8D1617063 -:1069C0000C222270D0F8D0205268C4F80220D0F8EF -:1069D000D0000170DCE7002DDAD161700B2222704B -:1069E000D0F8D0205368C4F802301289E280D0F881 -:1069F000D0000170CCE7002DCAD161700622227050 -:106A0000D0F8D0205368D2F808C0D268C4F8023059 -:106A1000C4F806C0C4F80A20D0F8D0000170B7E767 -:106A2000002070473C494861704710B50446B0F8F3 -:106A3000A000401CA4F8A000B4F84C00401CA4F82E -:106A40004C0094F8560020B1B4F85200401CA4F851 -:106A5000520094F85A0020B1B4F85800401CA4F831 -:106A6000580094F8B40040B994F83D200023012167 -:106A700004F1300002F0B7F920B1B4F85000401C26 -:106A8000A4F85000204600F016F8002010BD224A5D -:106A9000C2E906017047B0F84C1090F83E20091D7D -:106AA0002AB1B0F84E00814203D301207047062975 -:106AB000FBD20020704770B5044690F83B000025DB -:106AC000072821D1208EB4F8C610401C884218BF78 -:106AD00070BDD4F8C000411C04F1080004F069FB4B -:106AE0000221204602F00CF884F83B50012084F883 -:106AF0006600D4F8C0000078002808BFFFDFD4F893 -:106B0000C0000178491E017094F83B00082818BFA6 -:106B100070BD208E08E00000E4000020A5610100A7 -:106B20001D67010049670100D4F8BC10401C89882A -:106B3000884218BF70BDD4F8D0000178002918BF72 -:106B4000FFDF1ED12188C180D4F8BC00D4F8D0105A -:106B500040890881D4F8BC00D4F8D01080894881DD -:106B6000D4F8BC00D4F8D010C0898881D4F8D00003 -:106B70000571D4F8D01007200870D4F8D010208800 -:106B800048800121204601F0BBFF03212046FEF78B -:106B900056F8D4F8BC0021884088884218BFFFDF2F -:106BA000D4F8BC00057084F83B5070BDF0B5FF4CC4 -:106BB0008DB0207910F0010F04BF0DB0F0BD206939 -:106BC00000230521C578A06890F83B20303002F002 -:106BD0000AF9002818BF022D0CD00B2D18BF042D68 -:106BE00008D0052D1CBF062D0D2D03D0607840F078 -:106BF00008006070607800281CBF0DB0F0BD2069EF -:106C0000C078801E0C2880F0D881DFE800F006FDF7 -:106C10002B4BD2FCFDFBFD21FA96A068002301213D -:106C200090F83D20303002F0DEF8002840F0E3819B -:106C3000206902F072FBA16881F8B600022081F899 -:106C40003D00002081F85A0081F8560000F0D3B9C9 -:106C5000A06890F83B100A2929D1002180F83F1044 -:106C60000D2166E0A06890F83B100E291FD1D0F8E6 -:106C7000BC1000884988814218BFFFDFA068D0F8A7 -:106C8000BC0000F12601206902F074FBA06800F14D -:106C90008C01206902F076FBA168112081F83B008D -:106CA00000F0A9B9A66896F83B00112803D002208D -:106CB000607000F0A0B9D6F8BC10102501F10E0CE0 -:106CC00000210DF1FF3208206B1A6344401E13F8B7 -:106CD000017C577013F8023C02F8023F01F10201F7 -:106CE000F2D1D6F8BC10102601F11E0300210822B3 -:106CF0000DF10F00A6EB010C9C44891C1CF8015CF3 -:106D000045701CF802CC00F802CF521EF2D1684642 -:106D100003F030F808ADA06895E80E1000F1780592 -:106D200085E80E100021C0E91A11012180F83F10FA -:106D3000132180F83B1000F05EB9A16891F83B0088 -:106D4000112812BF0E2891F85C000028AFD12069ED -:106D500002F02FFBA168002581F8900081F85B50BC -:106D600081F85650D1F8BC0009884088884218BF85 -:106D7000FFDFA068D0F8BC100D70D0F8D0100A78F2 -:106D8000002A18BFFFDF40F014810288CA80D0F8C3 -:106D9000D02090F890101171D0F8D0100D72D0F86A -:106DA000D0200B2111700188D0F8D000418000F074 -:106DB00000B9A06890F83B10152918BF022040F0D8 -:106DC0000981002580F85B5080F85650D0F8BC103F -:106DD00000884988814218BFFFDFA068D0F8BC1046 -:106DE0000D70D0F8D0100A78002A18BFFFDF40F0ED -:106DF000E08090F85C20A2B180F85C500288CA80E4 -:106E000003E020E08BE089E0D7E0D0F8D0100D71EE -:106E1000D0F8D0200C2111700188D0F8D00041802A -:106E2000C7E00288CA80D0F8D0100D71D0F8D02009 -:106E300001211172D0F8D0200B2111700188D0F8F7 -:106E4000D0004180B5E0A0680023194690F83C20AE -:106E5000303001F0C8FF48B9A0680023072190F83E -:106E60003B20303001F0BFFF00287DD06078002843 -:106E700054D1A06890F85E0010F0020F17D120697D -:106E800002F08DFAA16881F85F00206902F089FAAA -:106E9000A168A1F86000206902F086FAA168A1F853 -:106EA000620091F85E0040F0020081F85E00A06888 -:106EB00090F85E1011F0010F15D190F83C200023DE -:106EC0001946303001F08FFF002808BFFFDF012195 -:106ED000A068042280F83C1080F8B82080F85A108E -:106EE0000021A0F85810A06890F83B10012904D1A7 -:106EF000002180F83B1080F85610D0F8BC200388A1 -:106F00005188994204BF1178042974D1002111706D -:106F100090F83B20002A08BF80F856106BE0A0686C -:106F20000023062190F83B20303001F05CFFD8B1FF -:106F3000607800285FD16946206902F04DFA9DF81B -:106F4000000010F001008DF8000014BF01200020A7 -:106F5000A168002581F86400A06880F85650D0F838 -:106F6000BC100088498800E033E0814218BFFFDF91 -:106F7000A068D0F8BC100D70D0F8D0100A78002AA4 -:106F800018BFFFDF15D10288CA80D0F8D0100D716C -:106F9000DDE90013D0F8D0209160D360D0F8D02084 -:106FA000062111700188D0F8D00001E0E400002033 -:106FB0004180A06880F83B501DE0A068002319467E -:106FC00090F83C20303001F00EFF10B1607818B11D -:106FD00011E0012060700EE0206902F043F9A16821 -:106FE00081F89100052081F83C000020A1F85800AC -:106FF000012081F85A00A068D0E91C12491C42F116 -:107000000002C0E91C120DB0F0BD000030B585B023 -:1070100004466846FBF7FBFC002808BFFFDF00982A -:1070200002F07DF80321009802F093F800980178AF -:1070300021F010010170214602F0EEF8A01E0C288C -:1070400051D2DFE800F006501E5151165042505107 -:10705000312CFD48C06890F8651021B106210098D8 -:1070600002F059F940E090F8CF10009802F053F97F -:107070003AE0F548C06890F89110009802F09BF94A -:1070800032E0F14DE86800F1B801009802F06DF9C6 -:10709000E86800F18C01009802F071F924E0062103 -:1070A000009802F084F91FE0E74DA8680178009885 -:1070B00002F06BF9A8688188009802F068F9A86866 -:1070C0004188009802F067F90EE0002002900390DA -:1070D0009DF8080002A940F001008DF80800009812 -:1070E00002F075F900E0FFDFFBF7A4FC002808BF01 -:1070F000FFDF0C2C04BF05B030BD072C0DD0022CD7 -:1071000004BF05B030BD0021CF48C068A0F85810BA -:10711000012180F85A1005B030BDCB490020C96864 -:10712000A1F8580005B030BD70B50C4605464FF4C7 -:107130009071204603F017FF2580002084F8F000AE -:1071400084F8FC0084F8040184F8120170BDF6F79D -:1071500097BD70B50C4615460721F6F76EFC002862 -:1071600008BF70BD90F8F0200021DAB1002D77D172 -:1071700061700722227090F8F0208AB1018480F8B3 -:10718000F010D0F8F220C4F80220D0F8F620C4F8AD -:107190000620B0F8FA20628190F8F020002AEDD1A4 -:1071A000A1705DE090F8FC2002B3002D58D190F85A -:1071B000FC200B2A0CD00C2A18BFFFDF50D16170C5 -:1071C0000C22227090F8FE20A2700288A2800AE0B1 -:1071D00061700B22227090F8FE20A2700288A280BB -:1071E00090F80221A27180F8FC1039E090F8042197 -:1071F0008AB17DB961700822227002886280D0F85D -:107200000821D0F80C316260A360B0F81021A2818F -:1072100080F8041124E090F812214AB105BB617096 -:1072200011222270B0F81421628080F8121117E048 -:1072300090F81621002A04BF002070BD85B9617046 -:107240001222227090F8162152B100BF80F8161158 -:10725000D0F81821C4F8022090F81621002AF5D1A0 -:10726000012070BD00207047774988607047002179 -:1072700080F83B1080F83C1080F83E1090F8A60093 -:1072800010B10220FEF72CBC0320FEF729BC2DE92B -:10729000F04F6D4C07468DB0E0680D460088F6F75C -:1072A00044FD5FEA000B08BFFFDF60782843607091 -:1072B000A188E06811F0200F4FF000051CBFA0F876 -:1072C0004C5080F8AC5004D1B0F84C20521CA0F8BF -:1072D0004C2011F0600F4FF002084FF0010613D060 -:1072E000E06890F83E1011B1032907D00CE080F857 -:1072F0003E6000210120FEF7F3FB05E080F83E80B0 -:1073000000210120FEF7ECFBE06890F83E10012917 -:1073100005D1A18811F4807F18BF80F83E80002F2E -:1073200040F09B81A18811F4007F18BFA0F8C050E5 -:1073300004D1B0F8C010491CA0F8C01000F09AFBAE -:107340000CA8FBF764FB002800F0E88060780028B8 -:1073500040F0E480E0680123194690F83D20303089 -:1073600001F041FD002849D1D4F80CC09CF8CE00B2 -:1073700038B1ACF850508CF865500220FFF746FE4B -:10738000CCE09CF83C200B2A08BF0B201AD00ADC6A -:10739000012A7BD0052A08BF072013D0092A08BF7D -:1073A00009200FD005E00F2A0FD0102A20D0162A6E -:1073B0007CD0012304210CF1300001F014FD0028E1 -:1073C0001CD187E0FFF722FEA8E0F9F755FF0C2853 -:1073D00014D3E0680821B830F9F74FFF28B1E0680E -:1073E00004218C30F9F749FF00B9FFDF0420E9E7F9 -:1073F0009CF8D100012802D0022849D08EE09CF8E8 -:10740000FC00002841D100220CF1D2094FF01008F5 -:1074100008210DF1FF3000BFA8EB02034B44491EC9 -:1074200013F801AC80F801A013F8023C00F8023F09 -:1074300002F10202F0D10CF1B00800204FF0100C64 -:107440000DF10F01082201E004010020ACEB000364 -:107450004344801C13F8019C81F8019013F8023C0E -:1074600001F8023F521EEED1684602F083FC0DF196 -:107470002008E06898E80E10783080E80E100520AB -:10748000FFF7C4FDE06880F8D15047E015E00DE05B -:107490009CF85C0000281ABF8CF8656002200D2063 -:1074A000FFF7B4FDE06880F8D15037E00620FFF721 -:1074B000ADFDE06880F85A5030E00C20FFF7A6FDE3 -:1074C000E068A0F8585090F85E1041F0010180F893 -:1074D0005E1023E0E06890F83B2090F8E210E9B1FC -:1074E00001230021303001F07EFCB8B1E06890F853 -:1074F000E210042904BF90F85E0010F0030F0DD1D4 -:107500000C20FFF783FDE068A0F8525080F8566029 -:1075100090F85E1041F0010180F85E1000F0A1FFCC -:107520000028E06818BFA0F8A05004D1B0F8A0105F -:10753000491CA0F8A01000F097FF40B1E06890F857 -:10754000AC1002299CBF491C80F8AC1004D8E0683C -:1075500090F8AC00022806D9E068A0F8A050A0F886 -:10756000A25080F8AC50E0680123002190F83C2044 -:10757000303001F038FC20B9E06890F83C00072872 -:1075800056D1E0680123002190F83B20303001F013 -:107590002AFCE8B3E0680123002190F83D20303058 -:1075A00001F021FCA0B3E06890F83E10022904BF6E -:1075B00090F8AC0000283BD15846F5F7E8FE38B308 -:1075C000FBF76CFA20B3E068B0F89A1001292FD9C4 -:1075D00080F8A560B0F84E10B0F84C208B1E9A428F -:1075E000AFBF0121891A491E89B2B0F8A030E288E4 -:1075F00093422FBF0122D21A521C92B2914288BFED -:107600001146012908BF80F8A55090F8C82000E075 -:107610000EE08AB1B0F8A220B0F8CA0082422FBFB3 -:107620000120801A401C80B2814288BF014603E0DD -:10763000E068012180F8A550E068028E114489B20B -:10764000A0F89C1090F83E30002B18BF012B1DD0E5 -:10765000022B1CBF032BFFDF09D0A088C0F3402002 -:107660000028E06818BFA0F8AE5022D11AE090F8C8 -:107670003D30032B0DD090F83C20082A06D0B0F8FE -:107680004E20B0F84C30D21A921E1144A0F8981037 -:10769000E3E7B0F84C30032BF8D3B0F84E101144A8 -:1076A000491CF3E7B0F8AE10B0F89E201144A0F8E2 -:1076B000AE10E06890F8CE1039B990F83D20012363 -:1076C0001946303001F08FFB38B1E068B0F8501047 -:1076D000B0F89E201144A0F850103D212FB1E06871 -:1076E00080F84A1080F8496069E02078022810D0BC -:1076F00001281AD0607800B310F0140F14BF1E21B7 -:1077000010F0080FEBD110F0030F08BFFFDF2A21A4 -:10771000E5E7E06890F86510002914BF06211621FE -:1077200080F84A1080F8496049E0E06890F8D0108D -:1077300080F84A1080F8496041E0E06890F85610FF -:1077400041B1B0F852104A1CA0F85220B0F85420B1 -:10775000914214D290F85A1041B1B0F858104A1C16 -:10776000A0F85820B0F85420914208D2B0F8502028 -:10777000B0F84E108A4208D390F8CE202AB12221C8 -:1077800080F84A1080F8496019E090F83E204AB12C -:10779000B0F84C208A420FD3082180F84A1080F8B4 -:1077A00049600CE0B0F84C10062905D33E2180F862 -:1077B0004A1080F8496002E090F8490088B1E0681A -:1077C00080F83B5080F83C5080F83E5090F8A6007E -:1077D0004FF00001002814BF02200320FEF780F9BB -:1077E00003E000210846FEF77BF9E06880F8A65028 -:1077F0000DB0BDE8F08FFE494A788B781A430DD161 -:1078000050B1087910F0080F04D0C86890F83D0016 -:10781000032803D001207047FEF7E4B8002070472A -:107820002DE9F041F24C05460E46A0882843A08081 -:1078300015F0020F04D015F0010F18BFFFDF26610D -:1078400015F0010F4FF000084FF001071CD0304633 -:10785000666101F007FD062802D00B280BD013E06B -:10786000E06890F83C1012290ED10021C0E91A11ED -:1078700080F83F7008E0E06890F83C100C2904BFE5 -:1078800080F83F8080F85C7015F0020F19D02069F5 -:1078900001F0E8FC052802D00B280BD011E0E068CD -:1078A00090F83C1010290CD10021C0E91C1180F87F -:1078B000407006E0E06890F83C100B2908BF80F8A3 -:1078C000408015F0800F1CBF0820A070BDE8F0813B -:1078D0002DE9F043C64C83B00127216900250191B1 -:1078E000A5806570A5702570E06067F307080646FF -:1078F00080F8A6700088F6F718FA5FEA000908BF5A -:10790000FFDFE0680088FBF77FF8E0680088FBF79E -:10791000A1F8E068B0F89A00D0B101A8FBF777F8B9 -:10792000B0B1E06890F8CE1091B190F83D200123FD -:107930001946303001F057FA50B9E068A0F85050BD -:1079400080F865500220FFF761FBE06880F8A550E1 -:10795000E26892F8F00028B9108C9188884288BFBC -:10796000E08001D89088E080B2F89E00B2F8A010C4 -:10797000401E80B2014489B2A2F8A01092F8A4304F -:10798000002B1CBFA2F8A25082F8A45004D1B2F878 -:10799000A2300344A2F8A230B2F84C300344A2F85B -:1079A0004C30B2F89A30012B9CBF5B1CA2F89A3085 -:1079B000002818BF82F8AC5092F8A50000281CBF20 -:1079C000E08881420FD24846F5F7E1FC58B1E06803 -:1079D00090F8C81039B1B0F8A210B0F8CA008142CE -:1079E00028BF00F044FDE06880F8A55090F83C10F6 -:1079F000062918BF072916D1018EB0F8E420891A8C -:107A000009B200290FDB00F1E601083003F0D1FBD9 -:107A10000221E06800F0C2FFE06880F8E35080F8DF -:107A20003C5080F86670E16801F13000B1F89E20AA -:107A300001F0FFF8E06890F8C810002918BFA0F81E -:107A4000A2506C4800906C4B6C4A3146404600F0A6 -:107A50008AFBE0680123052190F83C20303001F0DA -:107A6000C2F9002818BF00F07AFB03B0BDE8F0832C -:107A700000F0D3BC2DE9F0415D4C4FF002074FF010 -:107A80000005207910F0080F13D0607888B9E068FD -:107A900090F83C10142905D180F85B5080F85A50BA -:107AA00080F83C5090F83D10032904BF277080F8FF -:107AB0003D5000F043F9A1884FF0010611F0040F8A -:107AC00014D0607890B9E06890F83C20062A08BF8E -:107AD00080F8E36003D0082A08BF80F8E37090F8CC -:107AE0003D20022A04BF267080F83D5011F0020F9D -:107AF0004FF0030754D06078002851D12069C07836 -:107B0000801E0C287CD2DFE800F006B636415718FC -:107B1000B622B6298B4CE0680123194690F83D2027 -:107B2000303001F060F900283AD1E06880F83D700B -:107B300080F8565080F85A509EE0E06890F83C007B -:107B4000052818BFFFDFE06880F83C50F2E7E068E6 -:107B500090F83C00092818BFFFDF6FE0E06890F85C -:107B60003C000B2818BFFFDFE0680C2180F85B6049 -:107B700080F83C1080E0E06890F83C000F2818BFC7 -:107B8000FFDFE068102180F85B60F1E7E06890F8C3 -:107B90003C00102818BFFFDF1220E16881F83C008C -:107BA0006AE0E06890F83C00102818BFFFDF14205E -:107BB000E16881F83C005FE0E06890F83C0016283E -:107BC00018BFFFDFE06880F85B5080F85A5090F8EB -:107BD000FC00002818BFFFDFE06890F85C1091B14E -:107BE00080F85C500188A0F8001180F8FE5008E091 -:107BF000040100208F720100F77701002178010055 -:107C000039E00C2107E00188A0F8001180F8FE504F -:107C100080F802610B2180F8FC1080F83C502BE0CA -:107C2000E06890F8E21004290ED0E06801230721F3 -:107C300090F83C20303001F0D6F8E8B1E06880F8E8 -:107C40005A5080F83C5017E090F83B200123002167 -:107C5000303001F0C8F8002808BFFFDFE06890F876 -:107C60005E1011F0020F0EBF80F83B6080F8565096 -:107C700080F8E250D9E7FFDF207910F0100F09D02B -:107C8000607838B9E06890F83C10062904BF0721F5 -:107C900080F83C10A07810F0080F10D0E0680123A5 -:107CA000052190F83C20303001F09DF828B10820E3 -:107CB0006070E06880F8FC5001E000F0DCFBE068F8 -:107CC00090F83C10082918BFBDE8F081018EB0F88B -:107CD000E420491C914206BF61780029BDE8F0818B -:107CE000B0F8EA104288914209D1B0F8EC208388BC -:107CF0009A4204D1B0F8EE20C3889A420ED002888E -:107D0000A0F8F420A0F8F610B0F8EC10A0F8F810E5 -:107D1000B0F8EE10A0F8FA1080F8F060012100F041 -:107D20003DFE00210420FDF7DBFEE06880F8E35013 -:107D300080F83C5080F83E70BDE8F08130B5FF4CD3 -:107D400083B0207910F0010F04BF03B030BD60692B -:107D500001230521C578E06890F83C20303001F01F -:107D600042F8002818BF022D0BD00A2D18BF0B2D8A -:107D700007D0032D18BF062D03D0607840F008000F -:107D80006070607800281CBF03B030BD6069C078A7 -:107D90000D2880F0AB81DFE800F0462207C8FEFE28 -:107DA000FDDBFCFEA3C0FB00E0680123194690F850 -:107DB0003D20303001F017F8002840F0B4816069B0 -:107DC00001F0ABFAE16881F8D000022081F83D00B3 -:107DD000002081F85A0081F8560000F0A4B9E0684C -:107DE0000123002190F83C20303000F0FCFF0028F7 -:107DF00075D06078002840F09681606901F088FABB -:107E0000E168A1F8E4000A8E801A00B247F6FE721B -:107E10008242A8BF00285ADDE631606901F06FFA9E -:107E20000620E1683FE0E0680123002190F83C2053 -:107E3000303000F0D8FF00285FD06078002840F094 -:107E40007281606901F037FA88B3606901F030FA35 -:107E5000E168A1F8E4000A8E801A00B247F6FE72CB -:107E60008242A8BF002832DD606901F01BFAE16898 -:107E700081F8E600606901F010FAE168A1F8E80015 -:107E8000606901F0F5F9E168A1F8EA00606901F0C4 -:107E9000F6F9E168A1F8EC00606901F0F7F9E16832 -:107EA000A1F8EE00082081F83C0000F03CB9FFE7A3 -:107EB000E0680123002190F83C20303000F093FF6F -:107EC00068B16078002800F01F8100F02CB92820EC -:107ED00081F84A00012081F8490000F024B90CE043 -:107EE000E0680123002190F83C20303000F07BFF57 -:107EF00018B1607828B100F016B90120607000F068 -:107F000012B9E0680021A0F85810012180F85A1039 -:107F10000B2180F83C1000F006B9E06890F83C10A6 -:107F20000C2908BF0D214CD143E0E068012300215A -:107F300090F83C20303000F056FF20B9E06890F80F -:107F40005C0000287ED06078002801D101E06070DC -:107F5000E9E0E06800210125A0F8581080F85A50A7 -:107F600000F1B001606901F0F1F9E06800F1880109 -:107F7000606901F0F6F9E06890F80401002818BF84 -:107F8000FFDFE0680188A0F8061100F5847103E0C6 -:107F90001EE087E010E0A9E0606901F0C5F9E06843 -:107FA00000F58871606901F0C7F9E06880F8045154 -:107FB0000F2180F83C10B6E0E06890F83C101229E0 -:107FC00001D00220C3E7002180F85A101621F0E703 -:107FD000E0680123002190F83C20303000F003FFDE -:107FE00048B9E0680123072190F83B20303000F0C9 -:107FF000FAFE002826D06078002852D1E06890F878 -:108000005E0010F0020F17D1606901F0C8F9E16855 -:1080100081F85F00606901F0C4F9E168A1F86000CF -:10802000606901F0C1F9E168A1F8620091F85E00B1 -:1080300040F0020081F85E00E06890F85E1011F0F8 -:10804000010F00E05EE015D190F83C2001230021F3 -:10805000303000F0C8FE002808BFFFDF0121E068D3 -:10806000042280F83C1080F8E32080F85A100021A8 -:10807000A0F85810E06890F83B10012904D10021C5 -:1080800080F83B1080F8561090F8E21004294AD18D -:10809000002180F8E21090F83B20002A08BF80F809 -:1080A000561040E0E0680123002190F83C20303079 -:1080B00000F099FE30B3607818BB6946606901F042 -:1080C00081F99DF8000010F001008DF8000014BF48 -:1080D00001200020E16881F86400E0680021A0F838 -:1080E0005810012180F85A10092162E7E068012345 -:1080F000002190F83C20303000F075FE10B160781F -:1081000010B110E0012022E7606901F0ABF8E168EE -:1081100081F89100052081F83C000020A1F858006A -:10812000012081F85A00E068D0E91C21521C41F17D -:108130000001C0E91C2103B030BD00000401002093 -:10814000F9480078002818BF0C20704730B5F64C6D -:1081500005462078002818BFFFDF657230BDF24960 -:108160000120087270472DE9F047EF4C8146DDF899 -:10817000208020781E4617460D4628B9002F1CBFC8 -:10818000002EB8F1000F00D1FFDFC4F81C80C4E955 -:108190000C95C4E9057600202072E0712071E07032 -:1081A0006071A071E14EA070608130784FF00108DD -:1081B00005F130072888F5F7B8FDA0622888F5F7A3 -:1081C000A2FDE062FAF7BCF80120F9F7CAFDFAF760 -:1081D0000CF905F11100FAF79CF805F10D00F9F71B -:1081E000C7FE307800280CBF03200120FAF7A5F85D -:1081F000387EF9F7C5FE0120F9F7A2FDFAF797F8E6 -:10820000397CCB48002914BFCA49CB49016030787A -:108210004FF0010170B10120F9F726FF7068D0F826 -:10822000A800FAF79BF800BF84F80080BDE8F0478B -:10823000FAF78EB80020F9F717FFF5E72DE9F047B8 -:10824000DFF8E89282B0484600264068012700F136 -:1082500030041B20ADF8000060794FF00208A9F14E -:10826000300570B301285AD002285CD0032818BF0B -:10827000FFDF62D0286A0823017821F0080101702D -:10828000A27903EAC202114321F004010170E279EC -:10829000042303EA8202114321F01001017094F8D3 -:1082A00005A0A86AF5F781F80646FAF7F7FBBAF1D8 -:1082B000020F49D0BAF1010F49D0BAF1030F49D0EA -:1082C0004BE0FFE79D48FAF7C8FB40B1296AAF7061 -:1082D0006A694FF48060904703206071CAE701AA81 -:1082E0006946A86AF4F752FF286210B194F82B107F -:1082F00021B19248FAF785FB6771BBE79DF804103E -:1083000021B906808670012100F023FFBDF800002E -:10831000C1B2286A01F065F884F80580AAE78748A9 -:10832000FAF76FFBA6E701AA6946A86AF4F72EFFE1 -:108330002862002808BFFFDF9CE78048FAF78DFB22 -:10834000002808BFFFDF95E7B04306D103E0B04344 -:1083500003D100E00EB1012100E00021286A02787B -:1083600042EA01110170E17B00291CBF61790129FA -:1083700026D004F14801724891E80E1000F1480639 -:1083800086E80E10A16DC0F86110E16DC0F86510AF -:108390002230F9F7E0FF99F8000000280CBF012116 -:1083A000002168480176D4E90E12C0E90412A0F158 -:1083B00026012A6AF9F711FC0020F9F71FFC03E0F7 -:1083C000F9F7C9FFF9F741FC99F8000028B1286ACC -:1083D000007810F0100F05D00CE001210846FAF7E4 -:1083E0007CF80AE05848007810F0100F04BF287994 -:1083F000002802D0A8780028EFD06879002804BFB0 -:108400006F71F9F7D0FF286A0188A9818078A87375 -:1084100085F8008002B0BDE8F087434810B50078C9 -:10842000012818BFFFDFF9F78BFF40480178446847 -:1084300011B9FFF703FF01E000F0BCF994F8280040 -:10844000012818BF10BDBDE81040FAF723B8364820 -:1084500010B50078032818BFFFDFBDE8104000F01A -:10846000F4B93148407970472F48007970472E4958 -:108470000120887170472DE9F0412C482A4D0126D2 -:1084800001784068002700F13004686A417801F003 -:108490001F08E96A02F09AF868B1012821D0022881 -:1084A00034D003281CBFFFDFBDE8F081E86ABDE8D7 -:1084B000F041F5F7E4B801224146E86AF4F7FAFF23 -:1084C000D4E91010491C40F10000C4E91010E07913 -:1084D000012814BFE671E771687ABDE8F041F1F751 -:1084E0006FB800224146E86AF4F7E4FFD4E91001CE -:1084F000401C41F10001C4E91001E079012802D1DA -:10850000E771BDE8F081E671BDE8F081E86AF5F752 -:10851000B6F8D4E91010491C40F10000C4E910106D -:10852000E0790128EFD1EBE71C0100204C0100208D -:10853000181500401F0003021B0003023C0100202D -:10854000F8100020401100202B0100202DE9F041FF -:10855000F04F4FF000083846A7F13004406801267C -:1085600000F130052078022818BFFFDFA87850B14D -:1085700085F80280A67062694146042090473878E9 -:10858000002818BF2E71206A0321007831EA00000C -:1085900004BFE878002805D1EE70216AA6706269F0 -:1085A000022090470121002000F072F918B1BDE8C7 -:1085B000F04100F04AB9BDE8F04100F0FBB82DE908 -:1085C000F05FD44E82463046A6F1300540684FF049 -:1085D000000800F1300928780127032818BFFFDFC1 -:1085E0006889BAF1000F40F40070688104BF40F060 -:1085F0004000688100F0CE80F9F73DFB98B999F80A -:10860000100080B1686A417811F01F0F0BD000781C -:1086100099F80710C0F3C000884204D1EF70BDE89C -:10862000F05F00F012B9686A0188A5F80F10807831 -:108630006874688940F02000688185F8048070685B -:1086400000F1300B044690F82800012813D1F9F707 -:1086500017FF5946204600F09BFB60B13078002898 -:1086600070680CBFC83000F58B70218841809BF882 -:10867000081001710770686A99F806100078C0F355 -:108680008000884233D0706800F1300490F83500E3 -:1086900048B3022844D000BF84F80580307838B150 -:1086A0002079414620B12171AF706A69102090474E -:1086B000E07890B184F80380FAF7DEF9002808BF6B -:1086C000FFDF0820AF706A6900219047D4E90E10DF -:1086D000491C40F10000C4E90E10A07901280CBF2C -:1086E00084F80680A771688940F480706881686AA0 -:1086F00099F807300178C1F3C0029A424AD17268F2 -:1087000001F0030102F13004012918BF02292ED023 -:1087100003291CBFE87940F0040012D0E87139E069 -:10872000A86AF4F76DFD002808BFFFDFD4E90E103A -:10873000491C40F10000C4E90E10687AF0F740FFD0 -:10874000AAE700F02AFD70B1A770696AAF706A6984 -:1087500038469047E079012803D100BF84F80780AC -:1087600018E0E77116E0E87940F01000D6E74078AD -:1087700010F01F0F17D0697861B900F01F001B2897 -:10878000F1D8287A20B180206A690021904701E061 -:10879000FFF771FE5146012000F07AF838B1BDE8CC -:1087A000F05F00F052B8E0790128DAD1D6E7BDE8F1 -:1087B000F05F43E570B5584C1B21E06AF4F723FEE7 -:1087C000002101226062002811BF6170627053486D -:1087D0006062504E3078706800F1300590F84000CB -:1087E00038B305F148014D4891E80E1000F1480EEC -:1087F0008EE80E10A96DC0F86110E96DC0F8651023 -:108800002230F9F7A8FD307800280CBF01200020A5 -:1088100080F0010142480176D5E91012C0E9041246 -:10882000A0F12602616AF9F7D8F90120F9F7E6F913 -:1088300004E0606AF9F78FFDF9F707FA01210020DB -:10884000F9F74BFE0320207070BD70B5314900254B -:108850004C68F9F7E7FDF9F7D9FDF9F7FBFCF9F7F3 -:108860005EFDF9F7F2F9F9F7CDFDF9F771FD94F82E -:108870002800012808BFF9F703FE274C0021626990 -:1088800060899047E269E179E0789047257070BD92 -:1088900070B5214C0546002908BF012D05D120796E -:1088A000401CC0B22071012831D8A16928468847F0 -:1088B00000282CD0A1791B4841B1012D01BF41787E -:1088C00011F01F0F017811F0100F20D0E179F1B9EC -:1088D00010490978002918BF002102D0294304D08B -:1088E00013E0012D18BF0121F8D10F49097811F0CB -:1088F000100F04BF007810F0100F08D0A07830B926 -:10890000607810B111F0100F01D0002070BD01206F -:1089100070BD00004C0100201C010020F810002058 -:10892000401100202B0100202801002010B50A7BF7 -:1089300002F01F020A73002282758B181B7A03F063 -:10894000010C5B0803F00104A4445B0803F001047C -:10895000A4445B0803F00104A4445B0803F0010491 -:1089600064444FEA530C0CF0010323444FEA5C0CBF -:108970000CF00104234403EB5C0300EB020C521CDB -:108980008CF8113090F816C0D2B263448375052A72 -:10899000D3D3D8B2252888BFFFDF10BD0A4610B454 -:1089A0000021032A0DD04FF4FA4C002A60D0012A8E -:1089B0007ED0022A1CBF10BC7047014610BC30306C -:1089C000B4E7018680F8361080F8371080F83B1045 -:1089D00080F83C1080F83D1080F83E1080F832108E -:1089E00080F8331080F8341080F8351080F8491082 -:1089F000A0F84C10A0F8521080F85610A0F85810AB -:108A000080F85A1080F8471080F8481080F83F101E -:108A100080F8401080F85B1080F85C1080F85E10E1 -:108A2000012280F86420A0F8501080F86610A0F8A9 -:108A30009810A0F89A10A0F89C10A0F89E10A0F82A -:108A4000A010A0F8A21080F8A510A0F8AE1080F831 -:108A5000AC10A0F8C010A0F8C21080F82810018453 -:108A600080F8C81080F8CE1080F8D11010BC704784 -:108A7000A0F8AE1080F8A6104288C488A0F84C1068 -:108A8000B0F8501000F13003514391FBF2F1A0F81F -:108A90005010E100B1FBF2F1491C89B201FB02F474 -:108AA000A0F84E10B4F5C84FC4BF491ED98300E0EA -:108AB00004E0BCFBF2F1491C99847EE7A0F8AE10FB -:108AC00000F130024488B0F8EA30B0F8EE0091834B -:108AD000118CC0006143B0FBF3F091FBF3F1401C3B -:108AE000118480B200FB03F1D083B1F5C84FC4BF3D -:108AF000401ED083BCFBF3F0401C908410BC704738 -:108B00000A4610B40021032A0DD04FF4FA4C002A73 -:108B10004FD0012A6DD0022A1CBF10BC70470146FD -:108B200010BC303002E7018680F8361080F837102C -:108B300080F83B1080F83C1080F83D1080F83E1023 -:108B400080F8321080F8331080F8341080F8351037 -:108B500080F84910A0F84C10A0F8521080F8561078 -:108B6000A0F8581080F85A1080F8471080F8481084 -:108B700080F83F1080F8401080F85B1080F85C109F -:108B800080F85E10012280F86420A0F8501080F870 -:108B90006610A0F8A01080F8A21080F89810C0F815 -:108BA0009C1080F8281080F8B41080F8C41010BC15 -:108BB00070474288C488A0F84C10B0F8501000F1FB -:108BC0003003514391FBF2F1A0F85010E100B1FBEA -:108BD000F2F1491C89B201FB02F4A0F84E10B4F581 -:108BE000C84FC4BF491ED983BCFBF2F1491C99840C -:108BF00095E7D0F8BC4000F1300243886089E489F1 -:108C00009183118C594391FBF0F11184E100B1FB88 -:108C1000F0F1491C89B201FB00F3D183B3F5C84FD1 -:108C2000C4BF491ED183BCFBF0F0401C908410BC33 -:108C30007047837D0BB1252B01D912207047002A84 -:108C400004BF0020704770B490F817C00C7E894DA7 -:108C500004FB02C22C464FF0000CE2FB054C4FEA2D -:108C60001C1C6FF024040CFB0422D2B201EBD20CCA -:108C7000C27502F007059CF808C0012404FA05F546 -:108C80001CEA050F18BF02762CD1B2FBF3FC03FBE4 -:108C90001C22521CD2B24FF0000C00BF00EB0C03A0 -:108CA0005B7C93423CBFD21AD2B20ED301EB0C05CF -:108CB00000232D7A04FA03F635421CBF521ED2B2AD -:108CC0006AB15B1CDBB2082BF4D30CF1010303F097 -:108CD000FF0CBCF1050FE1D370BC1F20704703EB04 -:108CE000CC01017670BC0020704730B50D460446BB -:108CF000072988BFFFDFE07805F0070100F050008A -:108D0000084340F08800E070A07800F0A70040F031 -:108D10001800A070607800F05E0040F020006070E5 -:108D2000207800F0BC0040F04000207030BD017998 -:108D300031F01F0113BF002000221146704710B40C -:108D4000435C491C03F0010C5B0803F00104A444DC -:108D50005B0803F00104A4445B0803F00104A4448D -:108D60005B0803F00104A4445B0803F001045B0802 -:108D7000A44403F00104A4440CEB53031A44D2B2FC -:108D80000529DDDB012A8CBF0120002010BC7047C3 -:108D900038B505460C466846F9F787FB002808BF3A -:108DA00038BD9DF90020227294F909100020511A53 -:108DB00048BF494295F829308B42C8BF38BDFF2BC8 -:108DC00008BF38BDA17A491CC9B2A17295F82A30F2 -:108DD000994203D8617A7F2918BF38BD627200209A -:108DE000A072012038BD10B4A2F10B0C08293AD2B0 -:108DF000DFE801F004060B10131D333782B332E0B5 -:108E0000022A18BF032A31D02DE0072A18BF062AEC -:108E10002CD028E0082A29D025E01BB1BCF10B0F8B -:108E200024D920E0A2F10A000B281FD91BE01BB1B6 -:108E3000BCF10B0F1AD916E00D2A18BF0C2A15D059 -:108E400090F82C0020B10D2A0DD3152A0ED90AE076 -:108E5000112A08D3152A09D905E0092A06D002E00B -:108E600004E0012A02D010BC0020704710BC012091 -:108E70007047000053E4B36E282102F052B830B5B9 -:108E80000546007801F00F0220F00F001043287013 -:108E900007290BD2DFE801F00406040604080400E9 -:108EA000062405E00C2403E0222401E00024FFDF77 -:108EB000687820F03F002043687030BD007800F0F3 -:108EC0000F0070470A68C0F803208988A0F80710CF -:108ED0007047D0F803200A60B0F807008880704718 -:108EE0000A68C0F809208988A0F80D107047027838 -:108EF000402322F0400203EA8111114301707047C0 -:108F00000078C0F3801070470278802322F080023E -:108F100003EAC111114301707047D0F80320C1F872 -:108F20000920B0F80720A1F80D200A7822F080026D -:108F30000A700078800942EAC0100870704770B566 -:108F400015460E4604461F2A88BFFFDF2A463146D3 -:108F500004F1090001F06EFF6078A91D20F03F00C8 -:108F600001F03F010843607070BD70B50546407860 -:108F70000E4600F03F04062C38BFFFDFA01FC4B22E -:108F80001F2C88BF1F24224605F10901304601F03D -:108F900051FF204670BD70B515460E4604461F2A87 -:108FA00088BFFFDF2A46314604F1090001F042FF85 -:108FB0006078A91D20F03F0001F03F010843607078 -:108FC00070BD70B5054640780E4600F03F04062C93 -:108FD00038BFFFDFA01FC4B21F2C88BFFFDF2246AF -:108FE00005F10901304601F025FF204670BD0968F2 -:108FF000C0F80F1070470A88A0F8132089784175CF -:1090000070474176090A81767047C176090A01776F -:1090100070474177090A81777047C175090A01765F -:1090200070478175704790F8242001F01F0122F0ED -:109030001F02114380F82410704790F82420E02389 -:1090400022F0E00203EA4111114380F82410704736 -:109050001F3002F0AEB84178007801F03F0110F007 -:109060000F0006D0012808D0022809D006280BD00E -:109070000FE0881F1F280AD90BE00C2909D106E050 -:10908000881F1F2803D904E0881F1F2801D801204A -:109090007047002070474178007801F03F0100F0F0 -:1090A0000F00042805D1062903D325299CBF0120E0 -:1090B00070470020704710B4017801F00F010329B8 -:1090C00022D0052925D14478B0F81910B0F81BC07A -:1090D000B0F81730827D04F03F04222C19D1062904 -:1090E00017D3B1F5486F98BFBCF5FA7F11D282B1A2 -:1090F000082A98BF8A420CD28B429CBFB0F81D0050 -:10910000B0F5486F05D807E0407800F03F000C2824 -:1091100002D010BC0020704710BC012070472221F3 -:1091200001F0FFBE00B5027801F0030322F0030254 -:109130001A4302704278012922F01F02427014BFC4 -:10914000022900BD032912BFFFDF42F00101417077 -:1091500000BD01F0030300B5027822F003021A43B8 -:1091600002704278012922F01F02427014BF0229C6 -:1091700000BD032912BFFFDF42F00101417000BDB5 -:10918000007800F0030070470278102322F01002EC -:1091900003EA01111143017070474178C07801F072 -:1091A0001F010E2832D2DFE800F0070A0D10131657 -:1091B000191C1F2225282B2E0C2929D02AE008292A -:1091C00026D027E0022923D024E0172920D021E04F -:1091D0000D291DD01EE001291AD01BE0012917D04E -:1091E00018E0022914D015E0092911D012E009294C -:1091F0000ED00FE001290BD00CE0012908D009E0C6 -:10920000062905D006E0022902D003E01B2901D877 -:10921000012070470020704730B50546C1700E2907 -:1092200018D2DFE801F007090B0D0F11110B131312 -:109230001111150B0C240FE008240DE002240BE0A3 -:10924000172409E00D2407E0012405E0092403E0C8 -:10925000062401E00024FFDF687820F01F0020438F -:10926000687030BDC0787047C171090A01727047DB -:10927000B0F8070070474172090A81727047B0F870 -:1092800009007047C172090A01737047B0F80B00FA -:1092900070474171090A81717047B0F80500704745 -:1092A00001717047007970474173090A81737047F3 -:1092B000B0F80D00704730B4B0F80720504DB0F84A -:1092C00009C0B0F805300179941F2D1998BFBCF57D -:1092D000FA7F0ED269B1082998BF914209D2934210 -:1092E0009FBFB0F80B00B0F5486F012030BC98BFAD -:1092F0007047002030BC7047001D01F05ABF021DAE -:109300000846114601F055BF4172090A8172704743 -:10931000B0F80900704701717047007970470A681A -:10932000426049688160704742680A6080684860AE -:1093300070470988818170478089088070470A6872 -:10934000C0F80E204968C0F812107047D0F80E20FF -:109350000A60D0F81200486070470968C0F816101B -:109360007047D0F81600086070470A684260496884 -:109370008160704742680A60806848607047096889 -:10938000C1607047C06808607047017170474171E3 -:10939000090A81717047C171090A01727047007929 -:1093A0007047B0F805007047B0F8070070470171CA -:1093B000704700797047017170470A6842604968D8 -:1093C0008160704742680A608068486070470A6838 -:1093D000426049688160704742680A6080684860FE -:1093E000704730B50C4605461B2988BFFFDF6878FB -:1093F00004F01F0120F01F000843687030BD00001A -:1094000086F3FFFF70B50446C2F11005281901F07C -:1094100011FD15F0FF0108D0491EC9B2802060542B -:109420002046BDE8704001F07CBD70BD30B505E060 -:109430005B1EDBB2CC5CD55C6C40C454002BF7D116 -:1094400030BD10B5002409E00B78521E44EA4303F6 -:1094500000F8013B11F8013BD2B2DC09002AF3D13C -:1094600010BD30B50C46097889B01546012049B1C8 -:10947000012905D12978042902D105201070002086 -:1094800009B030BD60680590CDF818D00D210DF100 -:10949000030001F046FDA0680188ADF80010807857 -:1094A0008DF802000120207006208DF81000606AFF -:1094B0000890294604A8F5F745FEE1E72DE9F041BB -:1094C0000C46097892B0154601204FF0020CFE4F71 -:1094D00006264FF0040869B101291ED0022946D0A2 -:1094E000032904D12978042901D11670002012B073 -:1094F000BDE8F081606850B1CDE90107012020701E -:109500008DF80060606A04901146684665E084F852 -:1095100000C085F80080576027E029780429E6D14B -:10952000696810222069FFF78CFF6868C07B00061D -:1095300006D5E54A2069102310320146FFF776FF71 -:10954000D4E904101022FFF77CFF2069C07B0006DD -:1095500006D5DD4A6069102310320146FFF766FF29 -:1095600084F800C085F800806F600320BFE7297889 -:109570000429BCD1A08910280CD9A0F1100080B218 -:10958000A081A1684FF01003014468466A68FFF7A4 -:109590004DFF18E004D14FF010032269A16807E0E5 -:1095A000C2B20DA8A168FFF72DFF626910230DA9B3 -:1095B00009A8FFF73BFF102309A968466A68FFF76F -:1095C00035FF0320207060680590CDF818D08DF825 -:1095D0001060606A0890294604A8F5F7B3FD86E795 -:1095E0002DE9F04107460D4601200B7807213BB1DC -:1095F000012B04D11378062B01D11170002077E7DD -:109600006C69012620226170E8686060686A6062A7 -:10961000A168287C0870A681A068A968401C01F098 -:1096200009FCA08920222030A081A068696821302F -:1096300001F000FCA08921462030A0812E70384620 -:10964000BDE8F041F5F795BD2DE9F05F0D46834685 -:1096500001200978174606464FF00708D1B1DFF818 -:1096600068A24FF00009AAF1080A012923D00229B3 -:109670007ED003290CD13978062909D179681022C6 -:10968000E86901F0D7FB08203870183500207D60AC -:10969000BDE8F09F2C6A8C48202284F8018020309D -:1096A00060602020A081686A60626968A06801F03B -:1096B000C1FB2E70D4E039780629E9D12C6A84F8F0 -:1096C0000180686A606251681022E86901F0B2FBAB -:1096D000E8696060A0684F4680F80090A681A068A5 -:1096E0004670A089401C80B2A081A16808446969C5 -:1096F00051F8012F026089888180A089801D80B285 -:10970000A0816969A268097801F001011154A0895A -:10971000401C80B2A081A1680844296951F8012F3A -:10972000026089888180A089801D80B2A08129691A -:10973000A268097801F001011154A0891022401C8F -:1097400080B2A081A1680844E96801F073FBA08998 -:109750001022103080B2A081A1680844A96801F0ED -:1097600069FBA089103080B2A081A168014400E0AB -:109770000DE0DAF804000860A089001D80B2A08125 -:10978000A1680F54A089401CA081022067E03978AD -:10979000062992D151681022A86901F04BFB2C6A6E -:1097A00084F80180E8696060686A6062A16881F895 -:1097B0000090A681A0684670A089401C80B2A0815C -:1097C000A1680844696951F8012F02608988818085 -:1097D000A089801D80B2A0816969A268097801F022 -:1097E00001011154A089401C80B2A081A1680844E5 -:1097F000296951F8012F026089888180A089801D24 -:1098000080B2A0812969A268097801F00101115490 -:10981000A0891022401C80B2A081A1680844E96898 -:1098200001F008FBA0891022103080B2A081A1684D -:109830000844A96801F0FEFAA089103080B2A08126 -:10984000A1680144DAF804000860A089001D80B214 -:10985000A081A1680E54A089401CA081032028701B -:1098600021465846BDE8F05FF5F783BC70B50D465C -:1098700006460978012041B1012905D11178062950 -:1098800002D109201070002070BD2C6A0720607082 -:1098900068686060686A6062E969A06851F8012FD1 -:1098A0000260898881800620A081E869A16800782B -:1098B00000F001008871A089401C80B2A081A168DD -:1098C0000844A96902E000006AB5010051F8012FBF -:1098D000026089888180A089801D80B2A081A969E9 -:1098E000A268097801F001011154A089401C80B2DE -:1098F000A081A168084469690A880280897881701A -:10990000A0891022C01C80B2A081A16808442969E6 -:1099100001F090FAA0891022103080B2A081A168D5 -:109920000844E96801F086FAA0891022103080B25C -:10993000A081A1680844A96801F07CFAA0892146A9 -:109940001030A081012028703046BDE87040F5F746 -:1099500010BC70B50D4606460978012059B10129A1 -:1099600008D11178062905D10A20107050680068C6 -:109970005060002070BD6C69072010226070E8689C -:109980006060686A60622969A06801F053FA10207B -:10999000A081A06820221030A96801F04BFAA089AC -:1099A0002022203080B2A081A1680844696801F0BB -:1099B00041FAA08921462030A0810120287030463C -:1099C000BDE87040F5F7D5BB70B50C4601200978AD -:1099D0008EB01546062659B1012934D0022905D189 -:1099E0002978042902D10B20107000200EB070BD20 -:1099F000606910236A46007800F001008DF80000CD -:109A0000A069007800F001008DF80100E0680168AD -:109A1000CDF802108188ADF8061080798DF8080025 -:109A200020690168CDF809108188ADF80D108079A2 -:109A30008DF80F006068059009A80690A168FFF7EF -:109A4000F5FC01201DE029780429CFD1A06910235D -:109A50006A4650F8011F00918088ADF804006069E3 -:109A600050F8011FCDF806108088ADF80A000020DC -:109A700003906068059009A806906968FFF7D6FC16 -:109A8000022020708DF81060606A0890294604A8B2 -:109A9000F5F758FBAAE700B50B7889B001204BB168 -:109AA000012B05D11178042902D10C20107000205F -:109AB00009B000BD4868019005A80290C868036815 -:109AC000059340680690886803680793406808908B -:109AD0000120087006208DF80000486A04901146A5 -:109AE0006846F5F72FFBE3E700B50B7889B0012056 -:109AF00043B1012BDCD111780429D9D10D2010708C -:109B00000020D5E74868019005A80290886803689E -:109B10000593406806900020079008900120087087 -:109B200006208DF80000486A049011466846F5F753 -:109B300009FBBDE700B50B7889B0012043B1012BCB -:109B4000B6D111780429B3D10E2010700020AFE7F0 -:109B500048680590CDF818D088680088ADF80000F6 -:109B6000C8680088ADF802000020019002900390C0 -:109B70000120087006208DF81000486A08901146F0 -:109B800004A8F5F7DFFA93E730B403460C78012018 -:109B90005CB1012C15D0022C05D111780D2902D110 -:109BA0000F201070002030BC704701200870C8687A -:109BB000052242704A6842600B4A8260921EC2606F -:109BC0000BE014780E2CEED102200870C868042433 -:109BD0004470526842608A688260496A4162014604 -:109BE00030BC1846F5F7C5BA64B501002DE9F0415F -:109BF0000C4611490D68104A104908321160A0F155 -:109C00002001342901D301200CE0482810D040CC99 -:109C10000B4F94E80E0007EB8000241F50F8807C67 -:109C20003046B84720600448001D0560BDE8F0815B -:109C30002046E7F7C5FAF5E71005024001000001EC -:109C40009CB5010010B54C4800F042FA00B1FFDFAE -:109C50004948401C00F03CFA002800D0FFDF10BD4E -:109C60002DE9F05F454D8246D5F800900126424827 -:109C700000F036FA404C18B90026601C00F046FA95 -:109C80003F494FF0000E4FF0010B00BFC1F804B088 -:109C9000C1F800E1C1F804E1C5F800A0C1F800B0C6 -:109CA000384A4FF480434FF0E0274FF0030C1AE09E -:109CB0001068C00617D5C7F88032EFF3108010F097 -:109CC000010072B600D00120C1F804C3D1F80081B0 -:109CD000B8F1000F05D1D1F80481B8F1000F00D11F -:109CE00020BF00B962B6D1F8000118B9D1F804015B -:109CF0000028DDD0D1F804010028C7D12EB1C5F865 -:109D00000090601C00F0ECF907E0601C00F0E8F93E -:109D10000028B2D1184800F0F9F90020BDE8F09F02 -:109D20002DE9F0438DB00D46064600240DF11009D3 -:109D30000DF1200818E000BF04EB4407102255F88D -:109D40002710684601F076F805EB87071022484691 -:109D5000796801F06FF86846FFF782FF10224146EC -:109D6000B86801F067F8641CB442E5DB0DB0002070 -:109D7000BDE8F08374E700005401002004E50040D2 -:109D800000E0004010ED00E0C74800210170817044 -:109D9000704770B5C54D01232B60C54B1C68002C66 -:109DA000FCD0002407E00E6806601E68002EFCD080 -:109DB000001D091D641C9442F5D30020286018681A -:109DC0000028FCD070BD70B5B74E0446B94D307850 -:109DD000022800D0FFDFAC4200D3FFDF7169B64834 -:109DE000012903D847F23052944201DD0322427127 -:109DF000491C7161291BC160AF497078BDE8704092 -:109E0000F6F722B970B5A84C0D466178884200D0AB -:109E1000FFDFA84E092D4FD2DFE805F04E052231B5 -:109E20004E4E4E4E3C002078022800D0FFDF03202B -:109E30002070A078022802D0012804D008E0A06891 -:109E400000F0F4FB04E004F1080007C8FFF7A1FFED -:109E5000052020700020A070BDE87040F5F7D5BB4C -:109E6000F5F7A2FC01466068F6F7E6FEB04202D2C2 -:109E7000616902290BD30320F7F746F912E0F5F7E1 -:109E800093FC01466068F6F7D7FEB042F3D2BDE816 -:109E9000704098E7207802280AD0052806D0FFDF16 -:109EA00004202070BDE8704000F0F4B8022000E00B -:109EB0000320F7F729F9F3E7FFDF70BD70B505461A -:109EC000F5F772FC784C60602078012800D0FFDF45 -:109ED00079490220087000220A718D6004224A71BB -:109EE000744ACA6020706078BDE87040F6F7ACB87C -:109EF00010B56D4CA07808B9207808B1112010BDBC -:109F00006E48F5F7ECFB6070607820B1012020709E -:109F10000020606110BD032010BD0246010B01202E -:109F2000B2F5003F02D2884000F014BFB2F5802F96 -:109F300003D22039884000F015BFB2F5C02F03D2FC -:109F40004039884000F017BFB2F5002F03D26039C6 -:109F5000884000F019BF002070472DE9F0411446F9 -:109F600000EB84070E4605463F1F00F072FB4FF0E2 -:109F700080510A69504306EB8402121FB24201D29B -:109F8000012200E000221CB10969B4EB910F02D953 -:109F90000920BDE8F0814A498D4216D3AF4214D35F -:109FA000854205D2874203D245EA0600800701D0E8 -:109FB0001020EEE78E4208D33AB92846FFF7ADFFEE -:109FC00018B93846FFF7A9FF08B10F20E1E73D486F -:109FD0003D490068884205D0224631462846FFF7B1 -:109FE000D8FE10E0FFF784FF0028D2D12E480121CF -:109FF0008560C0E9036481704FF4A97104FB01F02E -:10A000001830FFF75BFF0020C3E770B54FF08055B5 -:10A01000044628692A49B1FBF0F084420AD300F0D3 -:10A0200018FBA04201D8102070BD28696043FFF7DB -:10A0300074FF08B10F2070BD224823490068884290 -:10A0400004D02869604300F0F1FA0CE0FFF750FFFC -:10A050000028F0D129691448614381600221817090 -:10A060001A48FFF72BFF002070BD1548010B012097 -:10A070008840401E704770B50D460446FFF7F5FF57 -:10A08000204201D00F2070BD29462046BDE8704017 -:10A0900000F083BE10B5044C6078F5F76FFB00202C -:10A0A0002070A07010BD00005801002004E50140A0 -:10A0B00000E40140105C0C0068110020059E0100C6 -:10A0C00000C0010098000020BEBAFECA7C5E0100FC -:10A0D0000021017008467047014600200870704753 -:10A0E000EFF3108101F0010172B60278012A01D06C -:10A0F000012200E000220123037001B962B60AB117 -:10A10000002070474FF400507047E9E7EFF31081EB -:10A1100011F0010F72B64FF00002027000D162B66A -:10A1200000207047F2E700004C49096801600020F8 -:10A1300070474A4908600020704701218A0720B112 -:10A14000012804D042F204007047916700E0D16713 -:10A150000020704742490120086042F20600704723 -:10A1600008B504233E4A1907103230B1C1F8043350 -:10A17000106840F0010010600BE0106820F0010052 -:10A180001060C1F808330020C1F8080135480068A4 -:10A190000090002008BD3249103140B101280AD09A -:10A1A00002280FD0032812D042F205007047086839 -:10A1B00020F01E0003E0086820F01E00801C0860EC -:10A1C00000207047086820F01E00001DF7E70868AF -:10A1D00020F01E00801DF2E7214924310A68024365 -:10A1E0000A60002070471E4924310A6882430A60D1 -:10A1F000002070471A492431096801600020704727 -:10A2000017491C310A6802430A600020704714494C -:10A210001C310A6882430A600020704710491C31D3 -:10A22000096801600020704702000F494FF00000EC -:10A2300003D0012A01D0072070470A6070474FF011 -:10A2400080410020C1F808014FF0E020802180F813 -:10A2500000140121C0F80011704700000004004004 -:10A260000005004008010040780500406249634B4A -:10A270000A6863499A42096801D1C1F3100101607B -:10A28000002070475C495D4B0A685D49091D9A4290 -:10A2900001D1C0F310000860002070475649574BA9 -:10A2A0000A68574908319A4201D1C0F3100008608A -:10A2B0000020704730B5504B504D1C6842F20803E7 -:10A2C000AC4202D0142802D203E0112801D3184670 -:10A2D00030BDC3004B481844C0F81015C0F8142511 -:10A2E000002030BD4449454B0A6842F209019A42B8 -:10A2F00002D0062802D203E0042801D308467047A2 -:10A30000404A012142F83010002070473A493B4B47 -:10A310000A6842F209019A4202D0062802D203E0FA -:10A32000042801D308467047364A012102EBC000D9 -:10A3300041600020704770B52F4A304E314C15688F -:10A3400042F2090304EB8002B54204D0062804D28D -:10A35000C2F8001807E0042801D3184670BDC1F305 -:10A360001000C2F80008002070BD70B5224A234ECC -:10A37000244C156842F2090304EB8002B54204D074 -:10A38000062804D2D2F8000807E0042801D31846B2 -:10A3900070BDD2F80008C0F310000860002070BD46 -:10A3A000174910B50831184808601120154A0021D6 -:10A3B00002EBC003C3F81015C3F81415401C142891 -:10A3C000F6D3002006E0042804D302EB8003C3F890 -:10A3D000001807E002EB8003D3F80048C4F3100430 -:10A3E000C3F80048401C0628EDD310BD04490648B8 -:10A3F000083108607047000098000020BEBAFECA0D -:10A4000000F5014000F001400000FEFF10B572B6FB -:10A4100000F0C2F850B1E6F773FFF5F7DEF8F6F793 -:10A4200019FEEFF72AF861490020086062B60020A3 -:10A4300010BD2DE9F0410F46044672B600F0ACF8AD -:10A4400018B162B60820BDE8F081E6F7CFFEE6F766 -:10A4500059FF064600256909890001F1E02105F050 -:10A460001F00D1F80011C140C80717D0202D03D21A -:10A4700026FA05F0C00716D168B2002806DA00F007 -:10A480000F0000F1E02090F8140D03E000F1E0204F -:10A4900090F80004400900F0E5F820B16D1C642D2F -:10A4A000D9D324B104E062B641F20100CBE7404CBD -:10A4B0002078022803D962B64FF48050C3E73D49A3 -:10A4C000802081F8140DEEF7AFFF20780028607827 -:10A4D00001D058B908E048B1202807D8A078212831 -:10A4E00004D8012802D003E0A07808B10720AAE729 -:10A4F0002E493148086031480760E6F703FF2146DE -:10A50000F6F78EFDF5F71DF800F0F4F9FFF73CFCC7 -:10A510002046E6F7C3FE040062B603D0FFF776FFDD -:10A52000204690E700208EE710B5044600F034F88E -:10A5300000B101202070002010BD214908600020DA -:10A54000704770B50C461F490D681E491E4E0831F4 -:10A550000E60102807D011280CD012280FD0132815 -:10A5600011D0012013E0D4E90001FFF762FF354666 -:10A5700020600DE0FFF74AFF0025206008E020681A -:10A58000FFF7D2FF03E00E4920680860002020603A -:10A590000C48001D056070BD0448074900688842EA -:10A5A00001D1012070470020704700009800002072 -:10A5B0006CB601000BE000E0BEBAFECA70010020DC -:10A5C000040000201005024001000001F0B585B034 -:10A5D0000F460646FEF7D4FD04467078694600F043 -:10A5E0001F053846F3F751F8C0B1012C07BF019998 -:10A5F000B1F80310032005B018BFF0BD091D89B2E2 -:10A600002844884238BF012008BF00209CBF05B005 -:10A61000F0BD00BF05B04FF00200F0BD022CF9D133 -:10A62000042D28BFB6F80310F4D3E7E70B4A022144 -:10A6300011600B490B68002BFCD0084B1B1D1860E8 -:10A6400008680028FCD00020106008680028FCD0B2 -:10A6500070474FF0805040697047000004E50140AA -:10A6600000E40140082808D238B1042805D00128A8 -:10A6700003D0052801D0012070470020704710B595 -:10A68000044600F0F5F880B1204600F0E2F8FFF74C -:10A69000E9FF68B17D4A04F01F010120137888406A -:10A6A0004BB15168084350600BE042F2010010BD0D -:10A6B00042F2020010BD6109890001F1E021C1F8F8 -:10A6C0000001002010BD10B5044600F0D1F850B1D3 -:10A6D0006E4A04F01F0101201378884033B151689D -:10A6E0008143516008E042F2010010BD6109890018 -:10A6F00001F1E021C1F88001002010BD70B50D46C8 -:10A70000044600F0B5F878B16009800000F1E0205F -:10A71000D0F8000204F01F0201219140084000D04F -:10A7200001202860002070BD42F2010070BD10B50C -:10A73000044600F09DF858B104F01F010120884044 -:10A740006109890001F1E021C1F80002002010BD7B -:10A7500042F2010010BD10B5044600F089F858B16E -:10A7600004F01F01012088406109890001F1E02106 -:10A77000C1F88002002010BD42F2010010BD70B58A -:10A780000D46044600F074F870B12846FFF76AFFE2 -:10A7900068B16807000E002C0CDA04F00F0101F11B -:10A7A000E02181F8140D09E042F2010070BD42F28F -:10A7B000020070BD04F1E02484F80004002070BDA4 -:10A7C00070B50C46054600F053F830B1284600F04D -:10A7D00040F8C0B22060002070BD42F2010070BDA0 -:10A7E000BFF34F8F2A4801682A4A01F4E061114300 -:10A7F0000160BFF34F8FFEE770B50546F7F700F92C -:10A8000008B1072070BD214C0120217889B9207042 -:10A8100072B6F6F72EFC4FF0E026D6F8801106F55A -:10A82000C07681436160F6F724FCC043306062B6B5 -:10A8300000202870002070BD14490A783AB130B960 -:10A840004FF0E0224868C2F80001002008700020A4 -:10A850007047002806DA00F00F0000F1E02090F8C1 -:10A86000140D03E000F1E02090F800044009704767 -:10A8700010B50446642807DAF6F7FBFB0121A14076 -:10A88000084201D1012010BD002010BD740100203C -:10A890000CED00E00400FA0510B54FF000040B4683 -:10A8A0000200204621461ED0012A04D0022A04D0EC -:10A8B000032A1DD103E0012002E0022013E003205F -:10A8C000072B15D2DFE803F0140406080A0C0E006B -:10A8D000012108E0022106E0032104E0042102E056 -:10A8E000052100E00621F4F713FF08B1204610BD52 -:10A8F0000724FBE7FE4805218170002101704170AB -:10A90000C17081607047FB490A78022A06D0CA6884 -:10A910001044C860C8683238F6F749B98A681044EC -:10A9200088608868F7E70378F349F44A13B1012B8C -:10A930000ED011E00379012B00D06BB943790BB134 -:10A94000012B09D18368643B8B4205D2C0680EE0BD -:10A950000379012B02D00BB10020704743790BB172 -:10A96000012BF9D1C368643B8B42F5D280689042D9 -:10A97000F2D8012070472DE9F04704460226F5F78A -:10A98000C6FD006800B1FFDFD94D01273CB120783A -:10A99000B0B1012805D0022810D0032813D02F71A0 -:10A9A0000CE06068C82807D3F6F771F920B1606839 -:10A9B000FFF7A9FF012603E0002601E000F0AFF950 -:10A9C0003046BDE8F08728780028F7D16068FFF7A7 -:10A9D000AAFF0028E3D06068DFF81883007810B37E -:10A9E000A878042800D0FFDF0020474688F8000040 -:10A9F00060680079C0B30020387160684079A0B306 -:10AA00000420787160688168E868F5F78FF9B860AC -:10AA10006068C0683230F8600320A870B549E878F3 -:10AA2000F5F712FBCAE74FF00209404688F800909C -:10AA300061680979D1B10021017161684979B9B1C1 -:10AA40000421417161688968323181606168C96837 -:10AA5000C160C068A64C14346060F4F7A5FE2060A5 -:10AA60006F7085F80290A9E704E005E00321E3E7B1 -:10AA70000321E6E70120BFE70320C2E72DE9F04705 -:10AA80009B4C8846E178884200D0FFDFDFF8609277 -:10AA900000250127974E09F11409B8F1090F76D264 -:10AAA000DFE808F0050D2A3D646A769E7E00A078F6 -:10AAB000032886D0A078022883D0FFDF81E7A07822 -:10AAC000032803D0A078022800D0FFDF0420A07064 -:10AAD0002571207800285FD1FFF715FF3078022814 -:10AAE00006D0B068E06000F06CF92061002048E01A -:10AAF000E078F5F739F9F5E7A078032803D0A078D6 -:10AB0000022800D0FFDF207878BBA078032812D17C -:10AB1000042026E00420F6F7F7FAA57051E7A078A4 -:10AB2000032803D0A078022800D0FFDF2078E0B906 -:10AB3000A078032814D0F4F737FE01464F46D9F821 -:10AB40000000F6F779F80028E4DB79688142E1DB60 -:10AB5000081AF0606749E078BDE8F047F5F774BA85 -:10AB60000520F6F7D1FAA7702BE724E0A078042897 -:10AB700000D0FFDF022004E0A078042800D0FFDF2F -:10AB80000120A1688847FFF7F6FE05462EE027E082 -:10AB9000A078042800D0FFDFBDE8F04700F0BFB880 -:10ABA000A078042805D0607810B1A078022800D0E1 -:10ABB000FFDF207818B1BDE8F04700F0B9B8207980 -:10ABC00020B10620F6F7A0FA2571CCE7607828B10D -:10ABD0004849E078F5F738FA6570F2E60720C0E7F3 -:10ABE000FFDFEEE63DB1012D03D0FFDF022DF9D1ED -:10ABF000E7E60420C5E70320C3E770B5050005D0EC -:10AC00003B4CA078052803D0112070BD102070BDEA -:10AC10003B48F4F764FDE070E07818B1A5600020CF -:10AC2000A07070BD032070BD314810B5017809B126 -:10AC3000112010BD817805290CD0817801290BD015 -:10AC4000817849B1012101708178012904D080788F -:10AC500010B103E00F2010BD00F06AF8002010BD15 -:10AC60002DE9F041224E0446B07808B101280AD1FE -:10AC700064B12046FFF757FE50B120781D4D48B112 -:10AC8000B078012822D00F20BDE8F0811020FBE72A -:10AC90000720F9E702272F70207998B1002028714A -:10ACA000607988B104206871A0683230A860E068DB -:10ACB000E860E8680E4C14346060F4F775FD2060BD -:10ACC000B77022E00320EAE70320ECE700202870B9 -:10ACD000207900B3002028716079F0B104206871F8 -:10ACE000A168F068F5F722F8A860E068323009E062 -:10ACF0007C010020781100203D860100FF1FA10784 -:10AD00007DAA0100E8600320B0701049F078F5F7E3 -:10AD10009BF90020B8E70320DDE70320DFE70C48BC -:10AD200010B5006900F045F8BDE81040F4F76DBCBF -:10AD300010B5074CE078F4F721FD0820F6F7E4F9A8 -:10AD40000520A07000202070607010BD78110020D8 -:10AD50007C0100201F490968014201D00120704791 -:10AD6000002070471B49091D0968014201D00120DC -:10AD7000704700207047174910310968014201D01F -:10AD800001207047002070471249143109680142C0 -:10AD900001D0012070470020704710B50D4C206095 -:10ADA000201D01600B4810300260001D0360002070 -:10ADB00010BD09490A6848F202139A4302430A6027 -:10ADC0007047054A116848F2021301EA03009943EB -:10ADD0001160704700060040C806024040EA0103C7 -:10ADE00010B59B070FD1042A0DD310C808C9121F34 -:10ADF0009C42F8D020BA19BA884201D9012010BD6E -:10AE00004FF0FF3010BD1AB1D30703D0521C07E03A -:10AE1000002010BD10F8013B11F8014B1B1B07D19E -:10AE200010F8013B11F8014B1B1B01D1921EF1D10F -:10AE3000184610BD032A40F2308010F0030C00F0D9 -:10AE4000158011F8013BBCF1020F624498BF11F864 -:10AE500001CB00F8013B38BF11F8013BA2F104021D -:10AE600098BF00F801CB38BF00F8013B11F0030395 -:10AE700000F02580083AC0F0088051F8043B083AF9 -:10AE800051F804CBA0E80810F5E7121D5CBF51F89B -:10AE9000043B40F8043BAFF30080D20724BF11F815 -:10AEA000013B11F801CB48BF11F8012B24BF00F87A -:10AEB000013B00F801CB48BF00F8012B704710B5EB -:10AEC000203AC0F00B80B1E81850203AA0E81850A2 -:10AED000B1E81850A0E81850BFF4F5AF5FEA027C63 -:10AEE00024BFB1E81850A0E8185044BF18C918C0D2 -:10AEF000BDE810405FEA827C24BF51F8043B40F873 -:10AF0000043B08BF7047D20728BF31F8023B48BF57 -:10AF100011F8012B28BF20F8023B48BF00F8012B95 -:10AF200070474FF000020429C0F0128010F0030CAB -:10AF300000F01B80CCF1040CBCF1020F18BF00F82C -:10AF4000012BA8BF20F8022BA1EB0C0100F00DB8DB -:10AF50005FEAC17C24BF00F8012B00F8012B48BF39 -:10AF600000F8012B70474FF0000200B513469446DD -:10AF70009646203922BFA0E80C50A0E80C50B1F151 -:10AF80002001BFF4F7AF090728BFA0E80C5048BF65 -:10AF90000CC05DF804EB890028BF40F8042B08BF03 -:10AFA000704748BF20F8022B11F0804F18BF00F8FF -:10AFB000012B70477047704770477047164B1860F9 -:10AFC000164B1960164B1A607047FEDF042071465D -:10AFD00008421BD10699134A914217DC069902399F -:10AFE0004878DF2812D10878FE2808D0FF280DD134 -:10AFF0004FF001004FF000020B4B1B68184741F265 -:10B0000001000099019A084B1B681847069805999A -:10B01000064B1B68DB6818479C010020A00100203C -:10B02000A401002000C001007001002004000020E5 -:10B03000204821497047FFF7FBFFE6F7AFF800BD56 -:10B0400001200007C06AC0B2FF2806D14FF0FF30D0 -:10B050004FF010210968884203D018484FF00801CA -:10B0600001604FF4805016490968884203D1154A9F -:10B0700013605B68184700BD20BFFDE74FF48050A8 -:10B080000F490968884210D10F4B18684FF0FF3103 -:10B090008842F1D080F308884FF02021884204DDF7 -:10B0A0000A48026802210A430260094880470948A9 -:10B0B0008047FFDF88110020881100202C05004008 -:10B0C000000000200400002000C001002405004012 -:10B0D0008D1A010041B0010004207146084202D0DF -:10B0E000EFF3098101E0EFF3088188690238007805 -:10B0F000102813DB20280FDB2B280BDB0A4A1268F1 -:10B100000A4B9A4203D1602804DB094A1047022007 -:10B1100008607047074A1047074A1047074A1268F5 -:10B120002C3212681047000098000020BEBAFECAF8 -:10B1300009130000ED9B010043A50100040000205D -:10B140000E4B0F4908470F4B0D4908470E4B0C4952 -:10B1500008470E4B0A4908470D4B094908470D4B54 -:10B16000074908470C4B064908470C4B0449084758 -:10B170000B4B034908470B4B01490847A3910000BB -:10B180006D960000A52F0000C98D00004D8D0000B8 -:10B190007F930000251300004F740000C38E000051 -:10B1A000F5950000A91100000021016041600172C5 -:10B1B00070470A6802600B7903717047AB7B00002F -:10B1C0004B7D00007F7B0000457E0000697E000013 -:10B1D000A37E0000D77E0000117F0000417F0000A9 -:10B1E000937F000091120000911200009112000064 -:10B1F000911200009112000091120000F122000053 -:10B2000093230000B3230000BD240000FB1E0000B8 -:10B2100005270000E527000005280000C72D0000D5 -:10B22000EB2D00001B2D00006F2D00001D2E0000D7 -:10B23000A72E0000B3410000774300001F47000025 -:10B2400039480000BD48000063490000D3490000B0 -:10B25000ED4A0000BB4B0000374C00001F280000E7 -:10B26000252800002F280000BD1E0000FB2800003C -:10B270008F1E0000552A0000911200001555000095 -:10B280009B550000B7550000D355000047570000FC -:10B29000FD55000007560000495600006B5600009F -:10B2A0002D57000091120000911200009112000031 -:10B2B0009112000091120000911200001F6D000019 -:10B2C0003F6D0000416D00007B6D0000A96D000026 -:10B2D000936E00003D6F0000516F00009D6F0000F5 -:10B2E000957000003B7200006B730000195F000056 -:10B2F00091120000911200009112000023890000B9 -:10B300006189000083890000100110013A020000E9 -:10B310001A02000069740000F9760000FFFFFFFFC9 -:10B320000000FFFF2F850000CF1B000041520000EE -:10B33000635F0000977600000000000023002300F8 -:10B3400046004D0023002300F5000000000000002F -:10B35000000000001DBB0000000000000000000015 -:10B3600000000000A5C80000000000000000000070 -:10B37000000000007DBB000003BC000000000000D6 -:10B380000000000003BF0000ABBC0000E3C10000F0 -:10B39000000000000000000025CD000000000000BB -:10B3A0000000000000000000B7BF00007BC90000E3 -:10B3B000000000004FCA0000C3CA000000000000E7 -:10B3C0007DC2000059C300000000000089CA0000CF -:10B3D000B9C3000045C60000A9C600009FC7000011 -:10B3E00085C1000039C80000000000009DC00000B9 -:10B3F0000000000095BD00000FBD0000E5C8000082 -:10B4000001CC00006FCC00000000000075BF000000 -:10B410003BBD00002DBF000063CE0000CBBE00008E -:10B4200073CD000000000000D1CC000079BC00000A -:10B43000AFBB0000E9BD0000E7BC0000E3CD0000A9 -:10B4400001CF000005C00000C1CE00008B38000015 -:10B450008B380000CD22000099840000D9610000E3 -:10B46000115200000000000029710100D1380000D5 -:10B47000D1380000EF220000ED840000536200008C -:10B480001B520000356901004F710100BC01BC0175 -:10B490003E002C0044000E00D800200101000000F6 -:10B4A000010000000001020304001011121300004B -:10B4B0000014000063940100C9990100979A0100EB -:10B4C000E99A0100359B0100899B0100BD940100B0 -:10B4D000E1950100499601006D9801005399010022 -:10B4E00013DE000017EF00001B5C01006D4E010031 -:10B4F0003F5C01006F4E0100453101004F840100A7 -:10B500007D4101004F840100B1310100BF85010080 -:10B510003B3B0100BF850100BD3001004D850100AE -:10B52000AF4001004D850100555555D6BE898E00AE -:10B5300000006606F30C801300000A033B066C094A -:10B5400000005604D308500D555555252627D6BE64 -:10B55000898EF401FA00960064004B0032001E0050 -:10B56000140000000300656C74620000000000001D -:10B570000000000000000000000087000000000044 -:10B5800000000000000000000000BE83605ADB0BDA -:10B59000376038A5F5AA9183886C00006DA2010080 -:10B5A00085A201009DA20100B5A20100E5A2010053 -:10B5B0000DA3010037A301006BA301000BA0010044 -:10B5C0005B9F010077A00100D1A00100E1A0010074 -:10B5D0000DA101007FA60100C7A60100FDA6010084 -:10B5E0002FA7010057A701007FA70100C1A70100F5 -:10B5F000E1A70100F9A7010039A80100BF1201006D -:10B60000C7120100D51201003BA1010055A10100A4 -:10B6100029A1010033A1010061A1010097A101004E -:10B62000D9A10100E7A10100F5A1010001A20100DB -:10B630000FA201001DA2010029A2010000000000CC -:10B64000678F0000BD8F0000D38F000099A8010014 -:10B65000619C0100219D0100FBAB010029AC0100B0 -:10B6600061AC0100B51001008D1501000010020051 -:10B6700090B6010008000020A00100004411000065 -:10B68000B4B60100A8010020E00F00008011000006 -:10B6900001593601000100683720FB349B5F8004AC -:10B6A0001F800010022001337F0102E429E4BDAFB6 -:04B6B0000100000095 -:00000001FF diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble.h new file mode 100644 index 0000000000..86d4d9adff --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble.h @@ -0,0 +1,689 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_COMMON BLE SoftDevice Common + @{ + @defgroup ble_api Events, type definitions and API calls + @{ + + @brief Module independent events, type definitions and API calls for the BLE SoftDevice. + + */ + +#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" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup BLE_COMMON_ENUMERATIONS Enumerations + * @{ */ + +/** + * @brief Common API SVC numbers. + */ +enum BLE_COMMON_SVCS +{ + SD_BLE_ENABLE = BLE_SVC_BASE, /**< Enable and initialize the BLE stack */ + SD_BLE_EVT_GET, /**< Get an event from the pending events queue. */ + SD_BLE_TX_PACKET_COUNT_GET, /**< Get the total number of available application transmission packets for a particular connection. */ + SD_BLE_UUID_VS_ADD, /**< Add a Vendor Specific UUID. */ + SD_BLE_UUID_DECODE, /**< Decode UUID bytes. */ + SD_BLE_UUID_ENCODE, /**< Encode UUID bytes. */ + SD_BLE_VERSION_GET, /**< Get the local version information (company id, Link Layer Version, Link Layer Subversion). */ + SD_BLE_USER_MEM_REPLY, /**< User Memory Reply. */ + SD_BLE_OPT_SET, /**< Set a BLE option. */ + SD_BLE_OPT_GET, /**< Get a BLE option. */ +}; + + /** + * @brief BLE Module Independent Event IDs. + */ +enum BLE_COMMON_EVTS +{ + BLE_EVT_TX_COMPLETE = BLE_EVT_BASE, /**< Transmission Complete. @ref ble_evt_tx_complete_t */ + BLE_EVT_USER_MEM_REQUEST, /**< User Memory request. @ref ble_evt_user_mem_request_t */ + BLE_EVT_USER_MEM_RELEASE, /**< User Memory release. @ref ble_evt_user_mem_release_t */ + BLE_EVT_DATA_LENGTH_CHANGED /**< Link layer PDU length changed. @ref ble_evt_data_length_changed_t. */ +}; + +/**@brief BLE connection bandwidth types. + * Bandwidth types supported by the SoftDevice. The bandwidth type dictates the maximum number of full length packets per connection interval. + */ +enum BLE_CONN_BWS +{ + BLE_CONN_BW_INVALID = 0, /**< Invalid connection bandwidth. */ + BLE_CONN_BW_LOW, /**< Low connection bandwidth. */ + BLE_CONN_BW_MID, /**< Medium connection bandwidth. */ + BLE_CONN_BW_HIGH /**< High connection bandwidth. */ +}; + +/**@brief Common Option IDs. + * IDs that uniquely identify a common option. + */ +enum BLE_COMMON_OPTS +{ + BLE_COMMON_OPT_CONN_BW = BLE_OPT_BASE, /**< Bandwidth configuration @ref ble_common_opt_conn_bw_t */ + BLE_COMMON_OPT_PA_LNA, /**< PA and LNA options */ + BLE_COMMON_OPT_CONN_EVT_EXT, /**< Extended connection events option */ +}; + +/** @} */ + +/** @addtogroup BLE_COMMON_DEFINES Defines + * @{ */ + +/** @brief Required pointer alignment for BLE Events. +*/ +#define BLE_EVT_PTR_ALIGNMENT 4 + +/** @brief Leaves the maximum of the two arguments. +*/ +#define BLE_MAX(a, b) ((a) < (b) ? (b) : (a)) + +/** @brief Maximum possible length for BLE Events. + * @note Value of @ref ble_gatt_enable_params_t::att_mtu shall be used as a parameter. + * If that value is set to 0 then @ref BLE_GATT_MTU_SIZE_DEFAULT must be used instead. +*/ +#define BLE_EVT_LEN_MAX(ATT_MTU) (BLE_MAX( \ + sizeof(ble_evt_t), \ + BLE_MAX( \ + offsetof(ble_evt_t, evt.gattc_evt.params.rel_disc_rsp.includes) + ((ATT_MTU) - 2) / 6 * sizeof(ble_gattc_include_t), \ + offsetof(ble_evt_t, evt.gattc_evt.params.attr_info_disc_rsp.info.attr_info16) + ((ATT_MTU) - 2) / 4 * sizeof(ble_gattc_attr_info16_t) \ + ) \ +)) + +/** @defgroup BLE_USER_MEM_TYPES User Memory Types + * @{ */ +#define BLE_USER_MEM_TYPE_INVALID 0x00 /**< Invalid User Memory Types. */ +#define BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES 0x01 /**< User Memory for GATTS queued writes. */ +/** @} */ + +/** @defgroup BLE_UUID_VS_COUNTS Vendor Specific UUID counts + * @{ + */ +#define BLE_UUID_VS_COUNT_MIN 1 /**< Minimum VS UUID count. */ +#define BLE_UUID_VS_COUNT_DEFAULT 0 /**< Use the default VS UUID count (10 for this version of the SoftDevice). */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_COMMON_STRUCTURES Structures + * @{ */ + +/**@brief User Memory Block. */ +typedef struct +{ + uint8_t *p_mem; /**< Pointer to the start of the user memory block. */ + uint16_t len; /**< Length in bytes of the user memory block. */ +} ble_user_mem_block_t; + +/** + * @brief Event structure for @ref BLE_EVT_TX_COMPLETE. + */ +typedef struct +{ + uint8_t count; /**< Number of packets transmitted. */ +} ble_evt_tx_complete_t; + +/**@brief Event structure for @ref BLE_EVT_USER_MEM_REQUEST. */ +typedef struct +{ + uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */ +} ble_evt_user_mem_request_t; + +/**@brief Event structure for @ref BLE_EVT_USER_MEM_RELEASE. */ +typedef struct +{ + uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */ + ble_user_mem_block_t mem_block; /**< User memory block */ +} ble_evt_user_mem_release_t; + +/**@brief Event structure for @ref BLE_EVT_DATA_LENGTH_CHANGED. */ +typedef struct +{ + uint16_t max_tx_octets; /**< The maximum number of payload octets in a Link Layer Data Channel PDU that the local Controller will send. Range: 27-251 */ + uint16_t max_tx_time; /**< The maximum time (in microseconds) that the local Controller will take to send a Link Layer Data Channel PDU. Range: 328-2120 */ + uint16_t max_rx_octets; /**< The maximum number of payload octets in a Link Layer Data Channel PDU that the local controller expects to receive. Range: 27-251 */ + uint16_t max_rx_time; /**< The maximum time (in microseconds) that the local Controller expects to take to receive a Link Layer Data Channel PDU. Range: 328-2120 */ +} ble_evt_data_length_changed_t; + +/**@brief Event structure for events not associated with a specific function module. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which this event occurred. */ + union + { + ble_evt_tx_complete_t tx_complete; /**< Transmission Complete. */ + ble_evt_user_mem_request_t user_mem_request; /**< User Memory Request Event Parameters. */ + ble_evt_user_mem_release_t user_mem_release; /**< User Memory Release Event Parameters. */ + ble_evt_data_length_changed_t data_length_changed; /**< Data Length Changed Event Parameters. */ + } params; /**< Event parameter union. */ +} ble_common_evt_t; + +/**@brief BLE Event header. */ +typedef struct +{ + uint16_t evt_id; /**< Value from a BLE__EVT series. */ + uint16_t evt_len; /**< Length in octets including this header. */ +} ble_evt_hdr_t; + +/**@brief Common BLE Event type, wrapping the module specific event reports. */ +typedef struct +{ + ble_evt_hdr_t header; /**< Event header. */ + union + { + ble_common_evt_t common_evt; /**< Common Event, evt_id in BLE_EVT_* series. */ + ble_gap_evt_t gap_evt; /**< GAP originated event, evt_id in BLE_GAP_EVT_* series. */ + ble_l2cap_evt_t l2cap_evt; /**< L2CAP originated event, evt_id in BLE_L2CAP_EVT* series. */ + ble_gattc_evt_t gattc_evt; /**< GATT client originated event, evt_id in BLE_GATTC_EVT* series. */ + ble_gatts_evt_t gatts_evt; /**< GATT server originated event, evt_id in BLE_GATTS_EVT* series. */ + } evt; /**< Event union. */ +} ble_evt_t; + + +/** + * @brief Version Information. + */ +typedef struct +{ + uint8_t version_number; /**< Link Layer Version number for BT 4.1 spec is 7 (https://www.bluetooth.org/en-us/specification/assigned-numbers/link-layer). */ + uint16_t company_id; /**< Company ID, Nordic Semiconductor's company ID is 89 (0x0059) (https://www.bluetooth.org/apps/content/Default.aspx?doc_id=49708). */ + uint16_t subversion_number; /**< Link Layer Sub Version number, corresponds to the SoftDevice Config ID or Firmware ID (FWID). */ +} ble_version_t; + +/** + * @brief Configuration parameters for the PA and LNA. + */ +typedef struct +{ + uint8_t enable :1; /**< Enable toggling for this amplifier */ + uint8_t active_high :1; /**< Set the pin to be active high */ + uint8_t gpio_pin :6; /**< The GPIO pin to toggle for this amplifier */ +} ble_pa_lna_cfg_t; + +/** + * @brief PA & LNA GPIO toggle configuration + * + * This option configures the SoftDevice to toggle pins when the radio is active for use with a power amplifier and/or + * a low noise amplifier. + * + * Toggling the pins is achieved by using two PPI channels and a GPIOTE channel. The hardware channel IDs are provided + * by the application and should be regarded as reserved as long as any PA/LNA toggling is enabled. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * @note This feature is only supported for nRF52, on nRF51 @ref NRF_ERROR_NOT_SUPPORTED will always be returned. + * @note Setting this option while the radio is in use (i.e. any of the roles are active) may have undefined consequences + * and must be avoided by the application. + */ +typedef struct +{ + ble_pa_lna_cfg_t pa_cfg; /**< Power Amplifier configuration */ + ble_pa_lna_cfg_t lna_cfg; /**< Low Noise Amplifier configuration */ + + uint8_t ppi_ch_id_set; /**< PPI channel used for radio pin setting */ + uint8_t ppi_ch_id_clr; /**< PPI channel used for radio pin clearing */ + uint8_t gpiote_ch_id; /**< GPIOTE channel used for radio pin toggling */ +} ble_common_opt_pa_lna_t; + +/** + * @brief BLE connection bandwidth configuration parameters + */ +typedef struct +{ + uint8_t conn_bw_tx; /**< Connection bandwidth configuration for transmission, see @ref BLE_CONN_BWS.*/ + uint8_t conn_bw_rx; /**< Connection bandwidth configuration for reception, see @ref BLE_CONN_BWS.*/ +} ble_conn_bw_t; + +/**@brief BLE connection specific bandwidth configuration parameters. + * + * This can be used with @ref sd_ble_opt_set to set the bandwidth configuration to be used when creating connections. + * + * Call @ref sd_ble_opt_set with this option prior to calling @ref sd_ble_gap_adv_start or @ref sd_ble_gap_connect. + * + * The bandwidth configurations set via @ref sd_ble_opt_set are maintained separately for central and peripheral + * connections. The given configurations are used for all future connections of the role indicated in this structure + * unless they are changed by subsequent @ref sd_ble_opt_set calls. + * + * @note When this option is not used, the SoftDevice will use the default options: + * - @ref BLE_CONN_BW_HIGH for @ref BLE_GAP_ROLE_PERIPH connections (both transmission and reception). + * - @ref BLE_CONN_BW_MID for @ref BLE_GAP_ROLE_CENTRAL connections (both transmisison and reception). + * This option allows the application to selectively override these defaults for each role. + * + * @note The global memory pool configuration can be set with the @ref ble_conn_bw_counts_t configuration parameter, which + * is provided to @ref sd_ble_enable. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * @note Please refer to SoftDevice Specification for more information on bandwidth configuration. + * + * @mscs + * @mmsc{@ref BLE_COMMON_CONF_BW} + * @endmscs + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::BLE_ERROR_INVALID_ROLE The role is invalid. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid bandwidth configuration parameters. + * @retval ::NRF_ERROR_NOT_SUPPORTED If the combination of role and bandwidth configuration is not supported. + */ +typedef struct +{ + uint8_t role; /**< BLE role of the connection, see @ref BLE_GAP_ROLES. */ + ble_conn_bw_t conn_bw; /**< Bandwidth configuration parameters. */ +} ble_common_opt_conn_bw_t; + +/** + * @brief Configuration of extended BLE connection events. + * + * When enabled the SoftDevice will dynamically extend the connection event when possible. + * + * The connection event length is controlled by the bandwidth configuration as set by @ref ble_common_opt_conn_bw_t. + * The connection event can be extended if there is time to send another packet pair before the start of the next connection interval, + * and if there are no conflicts with other BLE roles requesting radio time. + * + * @note @ref sd_ble_opt_get is not supported for this option. + */ +typedef struct +{ + uint8_t enable : 1; /**< Enable extended BLE connection events, disabled by default. */ +} ble_common_opt_conn_evt_ext_t; + +/**@brief Option structure for common options. */ +typedef union +{ + ble_common_opt_conn_bw_t conn_bw; /**< Parameters for the connection bandwidth option. */ + ble_common_opt_pa_lna_t pa_lna; /**< Parameters for controlling PA and LNA pin toggling. */ + ble_common_opt_conn_evt_ext_t conn_evt_ext; /**< Parameters for enabling extended connection events. */ +} ble_common_opt_t; + +/**@brief Common BLE Option type, wrapping the module specific options. */ +typedef union +{ + ble_common_opt_t common_opt; /**< COMMON options, opt_id in @ref BLE_COMMON_OPTS series. */ + ble_gap_opt_t gap_opt; /**< GAP option, opt_id in @ref BLE_GAP_OPTS series. */ +} ble_opt_t; + +/** + * @brief BLE bandwidth count parameters + * + * These parameters are used to configure the memory pools allocated within the SoftDevice for application packets + * (both transmission and reception) for all connections. + * + * @note The sum of all three counts must add up to the sum of @ref ble_gap_enable_params_t::central_conn_count and + * @ref ble_gap_enable_params_t::periph_conn_count in @ref ble_gap_enable_params_t. + */ +typedef struct { + uint8_t high_count; /**< Total number of high bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ + uint8_t mid_count; /**< Total number of medium bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ + uint8_t low_count; /**< Total number of low bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ +} ble_conn_bw_count_t; + +/** + * @brief BLE bandwidth global memory pool configuration parameters + * + * These configuration parameters are used to set the amount of memory dedicated to application packets for + * all connections. The application should specify the most demanding configuration for the intended use. + * + * Please refer to the SoftDevice Specification for more information on bandwidth configuration. + * + * @note Each connection created at runtime requires both a TX and an RX memory pool. By the use of these configuration + * parameters, the application can decide the size and total number of the global memory pools that will be later + * available for connection creation. + * + * @mscs + * @mmsc{@ref BLE_COMMON_CONF_BW} + * @endmscs + * + */ +typedef struct { + ble_conn_bw_count_t tx_counts; /**< Global memory pool configuration for transmission.*/ + ble_conn_bw_count_t rx_counts; /**< Global memory pool configuration for reception.*/ +} ble_conn_bw_counts_t; + +/** + * @brief BLE Common Initialization parameters. + * + * @note If @ref p_conn_bw_counts is NULL the SoftDevice will assume default bandwidth configuration for all connections. + * To fit a custom bandwidth configuration requirement, the application developer may have to specify a custom memory + * pool configuration here. See @ref ble_common_opt_conn_bw_t for bandwidth configuration of individual connections. + * Please refer to the SoftDevice Specification for more information on bandwidth configuration. + */ +typedef struct +{ + uint16_t vs_uuid_count; /**< Maximum number of 128-bit, Vendor Specific UUID bases to allocate. */ + ble_conn_bw_counts_t *p_conn_bw_counts; /**< Bandwidth configuration parameters or NULL for defaults. */ +} ble_common_enable_params_t; + +/** + * @brief BLE Initialization parameters. + */ +typedef struct +{ + ble_common_enable_params_t common_enable_params; /**< Common init parameters @ref ble_common_enable_params_t. */ + ble_gap_enable_params_t gap_enable_params; /**< GAP init parameters @ref ble_gap_enable_params_t. */ + ble_gatt_enable_params_t gatt_enable_params; /**< GATT init parameters @ref ble_gatt_enable_params_t. */ + ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init parameters @ref ble_gatts_enable_params_t. */ +} ble_enable_params_t; + +/** @} */ + +/** @addtogroup BLE_COMMON_FUNCTIONS Functions + * @{ */ + +/**@brief Enable the BLE stack + * + * @param[in, out] p_ble_enable_params Pointer to ble_enable_params_t + * @param[in, out] p_app_ram_base Pointer to a variable containing the start address of the application RAM region + * (APP_RAM_BASE). On return, this will contain the minimum start address of the application RAM region required by the + * SoftDevice for this configuration. Calling @ref sd_ble_enable() with *p_app_ram_base set to 0 can be used during + * development to find out how much memory a specific configuration will need. + * + * @note The memory requirement for a specific configuration will not increase between SoftDevices with the same major + * version number. + * + * @note At runtime the IC's RAM is split into 2 regions: The SoftDevice RAM region is located between 0x20000000 and + * APP_RAM_BASE-1 and the application's RAM region is located between APP_RAM_BASE and the start of the call stack. + * + * @details This call initializes the BLE stack, no other BLE related function can be called before this one. + * + * @mscs + * @mmsc{@ref BLE_COMMON_ENABLE} + * @endmscs + * + * @retval ::NRF_SUCCESS The BLE stack has been initialized successfully. + * @retval ::NRF_ERROR_INVALID_STATE The BLE stack had already been initialized and cannot be reinitialized. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. + * @retval ::NRF_ERROR_INVALID_LENGTH One or more of the following is true: + * - The specified Attribute Table size is too small. + * The minimum acceptable size is defined by @ref BLE_GATTS_ATTR_TAB_SIZE_MIN. + * - The specified Attribute Table size is not a multiple of 4. + * - The device name length is invalid (must be between 0 and @ref BLE_GAP_DEVNAME_MAX_LEN). + * - The device name length is too long for the given Attribute Table. + * @retval ::NRF_ERROR_INVALID_PARAM One or more of the following is true: + * - Incorrectly configured VS UUID count. + * - Invalid connection count parameters. + * - Invalid device name location (vloc). + * - Invalid device name security mode. + * - Invalid maximum ATT_MTU size, see @ref ble_gatt_enable_params_t::att_mtu. + * @retval ::NRF_ERROR_NOT_SUPPORTED Device name security mode is not supported. + * @retval ::NRF_ERROR_NO_MEM The amount of memory assigned to the SoftDevice by *p_app_ram_base is not + * large enough to fit this configuration's memory requirement. Check *p_app_ram_base + * and set the start address of the application RAM region accordingly. + * @retval ::NRF_ERROR_CONN_COUNT The requested number of connections exceeds the maximum supported by the SoftDevice. + * Please refer to the SoftDevice Specification for more information on role configuration. + */ +SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params, uint32_t * p_app_ram_base)); + +/**@brief Get an event from the pending events queue. + * + * @param[out] p_dest Pointer to buffer to be filled in with an event, or NULL to retrieve the event length. + * This buffer must be aligned to the extend defined by @ref BLE_EVT_PTR_ALIGNMENT. + * The buffer should be interpreted as a @ref ble_evt_t struct. + * @param[in, out] p_len Pointer the length of the buffer, on return it is filled with the event length. + * + * @details This call allows the application to pull a BLE event from the BLE stack. The application is signaled that + * an event is available from the BLE stack by the triggering of the SD_EVT_IRQn interrupt. + * The application is free to choose whether to call this function from thread mode (main context) or directly from the + * Interrupt Service Routine that maps to SD_EVT_IRQn. In any case however, and because the BLE stack runs at a higher + * priority than the application, this function should be called in a loop (until @ref NRF_ERROR_NOT_FOUND is returned) + * every time SD_EVT_IRQn is raised to ensure that all available events are pulled from the BLE stack. Failure to do so + * could potentially leave events in the internal queue without the application being aware of this fact. + * + * Sizing the p_dest buffer is equally important, since the application needs to provide all the memory necessary for the event to + * be copied into application memory. If the buffer provided is not large enough to fit the entire contents of the event, + * @ref NRF_ERROR_DATA_SIZE will be returned and the application can then call again with a larger buffer size. + * The maximum possible event length is defined by @ref BLE_EVT_LEN_MAX. The application may also "peek" the event length + * by providing p_dest as a NULL pointer and inspecting the value of *p_len upon return: + * + * \code + * uint16_t len; + * errcode = sd_ble_evt_get(NULL, &len); + * \endcode + * + * @mscs + * @mmsc{@ref BLE_COMMON_IRQ_EVT_MSC} + * @mmsc{@ref BLE_COMMON_THREAD_EVT_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Event pulled and stored into the supplied buffer. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. + * @retval ::NRF_ERROR_NOT_FOUND No events ready to be pulled. + * @retval ::NRF_ERROR_DATA_SIZE Event ready but could not fit into the supplied buffer. + */ +SVCALL(SD_BLE_EVT_GET, uint32_t, sd_ble_evt_get(uint8_t *p_dest, uint16_t *p_len)); + + +/**@brief Get the total number of available guaranteed application transmission packets for a particular connection. + * + * @details This call allows the application to obtain the total number of guaranteed application transmission packets + * available for a connection. Please note that this does not return the number of free packets, but rather the total + * amount of them for that particular connection. The application has two options to handle transmitting application packets: + * - Use a simple arithmetic calculation: after connection creation time the application should use this function to + * find out the total amount of guaranteed packets available to it and store it in a variable. + * Every time a packet is successfully queued for a transmission on this connection using any of the exposed functions in + * this BLE API, the application should decrement that variable. Conversely, whenever a @ref BLE_EVT_TX_COMPLETE event + * with the conn_handle matching the particular connection is received by the application, it should retrieve the count + * field in such event and add that number to the same variable storing the number of available guaranteed packets. This + * mechanism allows the application to be aware at any time of the number of guaranteed application packets available for + * each of the active connections, and therefore it can know with certainty whether it is possible to send more data or + * it has to wait for a @ref BLE_EVT_TX_COMPLETE event before it proceeds. + * The application can still pursue transmissions when the number of guaranteed application packets available is smaller + * than or equal to zero, but successful queuing of the tranmsission is not guaranteed. + * - Choose to simply not keep track of available packets at all, and instead handle the @ref BLE_ERROR_NO_TX_PACKETS error + * by queueing the packet to be transmitted and try again as soon as a @ref BLE_EVT_TX_COMPLETE event arrives. + * + * The API functions that may consume an application packet depending on the parameters supplied to them can be found below: + * - @ref sd_ble_gattc_write (write without response only) + * - @ref sd_ble_gatts_hvx (notifications only) + * - @ref sd_ble_l2cap_tx (all packets) + * + * @param[in] conn_handle Connection handle. + * @param[out] p_count Pointer to a uint8_t which will contain the number of application transmission packets upon + * successful return. + * @mscs + * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Number of application transmission packets retrieved successfully. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_TX_PACKET_COUNT_GET, uint32_t, sd_ble_tx_packet_count_get(uint16_t conn_handle, uint8_t *p_count)); + + +/**@brief Add a Vendor Specific base UUID. + * + * @details This call enables the application to add a vendor specific base UUID to the BLE stack's table, for later + * use with all other modules and APIs. This then allows the application to use the shorter, 24-bit @ref ble_uuid_t + * format when dealing with both 16-bit and 128-bit UUIDs without having to check for lengths and having split code + * paths. This is accomplished by extending the grouping mechanism that the Bluetooth SIG standard base UUID uses + * for all other 128-bit UUIDs. The type field in the @ref ble_uuid_t structure is an index (relative to + * @ref BLE_UUID_TYPE_VENDOR_BEGIN) to the table populated by multiple calls to this function, and the uuid field + * in the same structure contains the 2 bytes at indices 12 and 13. The number of possible 128-bit UUIDs available to + * the application is therefore the number of Vendor Specific UUIDs added with the help of this function times 65536, + * although restricted to modifying bytes 12 and 13 for each of the entries in the supplied array. + * + * @note Bytes 12 and 13 of the provided UUID will not be used internally, since those are always replaced by + * the 16-bit uuid field in @ref ble_uuid_t. + * + * @note If a UUID is already present in the BLE stack's internal table, the corresponding index will be returned in + * p_uuid_type along with an NRF_SUCCESS error code. + * + * @param[in] p_vs_uuid Pointer to a 16-octet (128-bit) little endian Vendor Specific UUID disregarding + * bytes 12 and 13. + * @param[out] p_uuid_type Pointer to a uint8_t where the type field in @ref ble_uuid_t corresponding to this UUID will be stored. + * + * @retval ::NRF_SUCCESS Successfully added the Vendor Specific UUID. + * @retval ::NRF_ERROR_INVALID_ADDR If p_vs_uuid or p_uuid_type is NULL or invalid. + * @retval ::NRF_ERROR_NO_MEM If there are no more free slots for VS UUIDs. + */ +SVCALL(SD_BLE_UUID_VS_ADD, uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type)); + + +/** @brief Decode little endian raw UUID bytes (16-bit or 128-bit) into a 24 bit @ref ble_uuid_t structure. + * + * @details The raw UUID bytes excluding bytes 12 and 13 (i.e. bytes 0-11 and 14-15) of p_uuid_le are compared + * to the corresponding ones in each entry of the table of vendor specific UUIDs populated with @ref sd_ble_uuid_vs_add + * to look for a match. If there is such a match, bytes 12 and 13 are returned as p_uuid->uuid and the index + * relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN as p_uuid->type. + * + * @note If the UUID length supplied is 2, then the type set by this call will always be @ref BLE_UUID_TYPE_BLE. + * + * @param[in] uuid_le_len Length in bytes of the buffer pointed to by p_uuid_le (must be 2 or 16 bytes). + * @param[in] p_uuid_le Pointer pointing to little endian raw UUID bytes. + * @param[out] p_uuid Pointer to a @ref ble_uuid_t structure to be filled in. + * + * @retval ::NRF_SUCCESS Successfully decoded into the @ref ble_uuid_t structure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_LENGTH Invalid UUID length. + * @retval ::NRF_ERROR_NOT_FOUND For a 128-bit UUID, no match in the populated table of UUIDs. + */ +SVCALL(SD_BLE_UUID_DECODE, uint32_t, sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const *p_uuid_le, ble_uuid_t *p_uuid)); + + +/** @brief Encode a @ref ble_uuid_t structure into little endian raw UUID bytes (16-bit or 128-bit). + * + * @note The pointer to the destination buffer p_uuid_le may be NULL, in which case only the validity and size of p_uuid is computed. + * + * @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes. + * @param[out] p_uuid_le_len Pointer to a uint8_t that will be filled with the encoded length (2 or 16 bytes). + * @param[out] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes (2 or 16) will be stored. + * + * @retval ::NRF_SUCCESS Successfully encoded into the buffer. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid UUID type. + */ +SVCALL(SD_BLE_UUID_ENCODE, uint32_t, sd_ble_uuid_encode(ble_uuid_t const *p_uuid, uint8_t *p_uuid_le_len, uint8_t *p_uuid_le)); + + +/**@brief Get Version Information. + * + * @details This call allows the application to get the BLE stack version information. + * + * @param[out] p_version Pointer to a ble_version_t structure to be filled in. + * + * @retval ::NRF_SUCCESS Version information stored successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy (typically doing a locally-initiated disconnection procedure). + */ +SVCALL(SD_BLE_VERSION_GET, uint32_t, sd_ble_version_get(ble_version_t *p_version)); + + +/**@brief Provide a user memory block. + * + * @note This call can only be used as a response to a @ref BLE_EVT_USER_MEM_REQUEST event issued to the application. + * + * @param[in] conn_handle Connection handle. + * @param[in,out] p_block Pointer to a user memory block structure. + * + * @mscs + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_PEER_CANCEL_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_NOAUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Successfully queued a response to the peer. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection state or no execute write request pending. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_USER_MEM_REPLY, uint32_t, sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block)); + +/**@brief Set a BLE option. + * + * @details This call allows the application to set the value of an option. + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_STATIC_PK_MSC} + * @mmsc{@ref BLE_COMMON_CONF_BW} + * @endmscs + * + * @param[in] opt_id Option ID, see @ref BLE_COMMON_OPTS and @ref BLE_GAP_OPTS. + * @param[in] p_opt Pointer to a ble_opt_t structure containing the option value. + * + * @retval ::NRF_SUCCESS Option set successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. + * @retval ::NRF_ERROR_INVALID_STATE Unable to set the parameter at this time. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed. + */ +SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt)); + + +/**@brief Get a BLE option. + * + * @details This call allows the application to retrieve the value of an option. + * + * @param[in] opt_id Option ID, see @ref BLE_COMMON_OPTS and @ref BLE_GAP_OPTS. + * @param[out] p_opt Pointer to a ble_opt_t structure to be filled in. + * + * @retval ::NRF_SUCCESS Option retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. + * @retval ::NRF_ERROR_INVALID_STATE Unable to retrieve the parameter at this time. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed. + * @retval ::NRF_ERROR_NOT_SUPPORTED This option is not supported. + * + */ +SVCALL(SD_BLE_OPT_GET, uint32_t, sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt)); + +/** @} */ +#ifdef __cplusplus +} +#endif +#endif /* BLE_H__ */ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_err.h similarity index 52% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_err.h index 188ac506c8..bc24f194e0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_err.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Nordic Semiconductor ASA + * Copyright (c) 2000 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,70 +36,58 @@ * */ - /** - * @file - * @brief ADC HAL implementation - */ + @addtogroup BLE_COMMON + @{ + @addtogroup nrf_error + @{ + @ingroup BLE_COMMON + @} -#include "nrf_adc.h" + @defgroup ble_err General error codes + @{ -#ifndef NRF52 + @brief General error code definitions for the BLE API. -/** - * @brief Function for configuring ADC. - * - * This function powers on ADC and configures it. ADC is in DISABLE state after configuration, - * so it should be enabled before using it. - * - * @param[in] config Requested configuration. - */ -void nrf_adc_configure(nrf_adc_config_t * config) -{ - uint32_t config_reg = 0; + @ingroup BLE_COMMON +*/ +#ifndef NRF_BLE_ERR_H__ +#define NRF_BLE_ERR_H__ - config_reg |= ((uint32_t)config->resolution << ADC_CONFIG_RES_Pos) & ADC_CONFIG_RES_Msk; - config_reg |= ((uint32_t)config->scaling << ADC_CONFIG_INPSEL_Pos) & ADC_CONFIG_INPSEL_Msk; - config_reg |= ((uint32_t)config->reference << ADC_CONFIG_REFSEL_Pos) & ADC_CONFIG_REFSEL_Msk; +#include "nrf_error.h" - if (config->reference & ADC_CONFIG_EXTREFSEL_Msk) - { - config_reg |= config->reference & ADC_CONFIG_EXTREFSEL_Msk; - } +#ifdef __cplusplus +extern "C" { +#endif - /* select input */ - nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_DISABLED); - - /* set new configuration keeping selected input */ - NRF_ADC->CONFIG = config_reg | (NRF_ADC->CONFIG & ADC_CONFIG_PSEL_Msk); -} +/* @defgroup BLE_ERRORS Error Codes + * @{ */ +#define BLE_ERROR_NOT_ENABLED (NRF_ERROR_STK_BASE_NUM+0x001) /**< @ref sd_ble_enable has not been called. */ +#define BLE_ERROR_INVALID_CONN_HANDLE (NRF_ERROR_STK_BASE_NUM+0x002) /**< Invalid connection handle. */ +#define BLE_ERROR_INVALID_ATTR_HANDLE (NRF_ERROR_STK_BASE_NUM+0x003) /**< Invalid attribute handle. */ +#define BLE_ERROR_NO_TX_PACKETS (NRF_ERROR_STK_BASE_NUM+0x004) /**< Not enough application packets available on this connection. */ +#define BLE_ERROR_INVALID_ROLE (NRF_ERROR_STK_BASE_NUM+0x005) /**< Invalid role. */ +#define BLE_ERROR_BLOCKED_BY_OTHER_LINKS (NRF_ERROR_STK_BASE_NUM+0x006) /**< The attempt to change link settings failed due to the scheduling of other links. */ +/** @} */ -/** - * @brief Blocking function for executing single ADC conversion. - * - * This function selects the desired input, starts a single conversion, - * waits for it to finish, and returns the result. - * ADC is left in STOP state, the given input is selected. - * This function does not check if ADC is initialized and powered. - * - * @param[in] input Requested input to be selected. - * - * @return Conversion result - */ -int32_t nrf_adc_convert_single(nrf_adc_config_input_t input) -{ - int32_t val; +/** @defgroup BLE_ERROR_SUBRANGES Module specific error code subranges + * @brief Assignment of subranges for module specific error codes. + * @note For specific error codes, see ble_.h or ble_error_.h. + * @{ */ +#define NRF_L2CAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x100) /**< L2CAP specific errors. */ +#define NRF_GAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x200) /**< GAP specific errors. */ +#define NRF_GATTC_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x300) /**< GATT client specific errors. */ +#define NRF_GATTS_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x400) /**< GATT server specific errors. */ +/** @} */ - nrf_adc_input_select(input); - nrf_adc_start(); - - while (!nrf_adc_conversion_finished()) - { - } - nrf_adc_conversion_event_clean(); - val = nrf_adc_result_get(); - nrf_adc_stop(); - return val; +#ifdef __cplusplus } #endif +#endif + + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gap.h new file mode 100644 index 0000000000..7748702e82 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gap.h @@ -0,0 +1,2027 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_GAP Generic Access Profile (GAP) + @{ + @brief Definitions and prototypes for the GAP interface. + */ + +#ifndef BLE_GAP_H__ +#define BLE_GAP_H__ + +#include "ble_types.h" +#include "ble_ranges.h" +#include "nrf_svc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@addtogroup BLE_GAP_ENUMERATIONS Enumerations + * @{ */ + +/**@brief GAP API SVC numbers. + */ +enum BLE_GAP_SVCS +{ + SD_BLE_GAP_ADDR_SET = BLE_GAP_SVC_BASE, /**< Set own Bluetooth Address. */ + SD_BLE_GAP_ADDR_GET, /**< Get own Bluetooth Address. */ + SD_BLE_GAP_WHITELIST_SET, /**< Set active whitelist. */ + SD_BLE_GAP_DEVICE_IDENTITIES_SET, /**< Set device identity list. */ + SD_BLE_GAP_PRIVACY_SET, /**< Set Privacy settings*/ + SD_BLE_GAP_PRIVACY_GET, /**< Get Privacy settings*/ + SD_BLE_GAP_ADV_DATA_SET, /**< Set Advertising Data. */ + SD_BLE_GAP_ADV_START, /**< Start Advertising. */ + SD_BLE_GAP_ADV_STOP, /**< Stop Advertising. */ + SD_BLE_GAP_CONN_PARAM_UPDATE, /**< Connection Parameter Update. */ + SD_BLE_GAP_DISCONNECT, /**< Disconnect. */ + SD_BLE_GAP_TX_POWER_SET, /**< Set TX Power. */ + SD_BLE_GAP_APPEARANCE_SET, /**< Set Appearance. */ + SD_BLE_GAP_APPEARANCE_GET, /**< Get Appearance. */ + SD_BLE_GAP_PPCP_SET, /**< Set PPCP. */ + SD_BLE_GAP_PPCP_GET, /**< Get PPCP. */ + SD_BLE_GAP_DEVICE_NAME_SET, /**< Set Device Name. */ + SD_BLE_GAP_DEVICE_NAME_GET, /**< Get Device Name. */ + SD_BLE_GAP_AUTHENTICATE, /**< Initiate Pairing/Bonding. */ + SD_BLE_GAP_SEC_PARAMS_REPLY, /**< Reply with Security Parameters. */ + SD_BLE_GAP_AUTH_KEY_REPLY, /**< Reply with an authentication key. */ + SD_BLE_GAP_LESC_DHKEY_REPLY, /**< Reply with an LE Secure Connections DHKey. */ + SD_BLE_GAP_KEYPRESS_NOTIFY, /**< Notify of a keypress during an authentication procedure. */ + SD_BLE_GAP_LESC_OOB_DATA_GET, /**< Get the local LE Secure Connections OOB data. */ + SD_BLE_GAP_LESC_OOB_DATA_SET, /**< Set the remote LE Secure Connections OOB data. */ + SD_BLE_GAP_ENCRYPT, /**< Initiate encryption procedure. */ + SD_BLE_GAP_SEC_INFO_REPLY, /**< Reply with Security Information. */ + SD_BLE_GAP_CONN_SEC_GET, /**< Obtain connection security level. */ + SD_BLE_GAP_RSSI_START, /**< Start reporting of changes in RSSI. */ + SD_BLE_GAP_RSSI_STOP, /**< Stop reporting of changes in RSSI. */ + SD_BLE_GAP_SCAN_START, /**< Start Scanning. */ + SD_BLE_GAP_SCAN_STOP, /**< Stop Scanning. */ + SD_BLE_GAP_CONNECT, /**< Connect. */ + SD_BLE_GAP_CONNECT_CANCEL, /**< Cancel ongoing connection procedure. */ + SD_BLE_GAP_RSSI_GET, /**< Get the last RSSI sample. */ + SD_BLE_GAP_PHY_REQUEST, /**< Initiate PHY Update procedure. */ +}; + +/**@brief GAP Event IDs. + * IDs that uniquely identify an event coming from the stack to the application. + */ +enum BLE_GAP_EVTS +{ + BLE_GAP_EVT_CONNECTED = BLE_GAP_EVT_BASE, /**< Connection established. \n See @ref ble_gap_evt_connected_t. */ + BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. \n See @ref ble_gap_evt_disconnected_t. */ + BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. \n See @ref ble_gap_evt_conn_param_update_t. */ + BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. \n Reply with @ref sd_ble_gap_sec_params_reply. \n See @ref ble_gap_evt_sec_params_request_t. */ + BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. \n Reply with @ref sd_ble_gap_sec_info_reply. \n See @ref ble_gap_evt_sec_info_request_t. */ + BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. \n In LESC Numeric Comparison, reply with @ref sd_ble_gap_auth_key_reply. \n See @ref ble_gap_evt_passkey_display_t. */ + BLE_GAP_EVT_KEY_PRESSED, /**< Notification of a keypress on the remote device.\n See @ref ble_gap_evt_key_pressed_t */ + BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. \n Reply with @ref sd_ble_gap_auth_key_reply. \n See @ref ble_gap_evt_auth_key_request_t. */ + BLE_GAP_EVT_LESC_DHKEY_REQUEST, /**< Request to calculate an LE Secure Connections DHKey. \n Reply with @ref sd_ble_gap_lesc_dhkey_reply. \n See @ref ble_gap_evt_lesc_dhkey_request_t */ + BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. \n See @ref ble_gap_evt_auth_status_t. */ + BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. \n See @ref ble_gap_evt_conn_sec_update_t. */ + BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. \n See @ref ble_gap_evt_timeout_t. */ + BLE_GAP_EVT_RSSI_CHANGED, /**< RSSI report. \n See @ref ble_gap_evt_rssi_changed_t. */ + BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. \n See @ref ble_gap_evt_adv_report_t. */ + BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. \n See @ref ble_gap_evt_sec_request_t. */ + BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. \n Reply with @ref sd_ble_gap_conn_param_update. \n See @ref ble_gap_evt_conn_param_update_request_t. */ + BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. \n See @ref ble_gap_evt_scan_req_report_t. */ + BLE_GAP_EVT_PHY_UPDATE, /**< PHY have been updated \n See @ref ble_gap_evt_phy_update_t. */ +}; + +/**@brief GAP Option IDs. + * IDs that uniquely identify a GAP option. + */ +enum BLE_GAP_OPTS +{ + BLE_GAP_OPT_CH_MAP = BLE_GAP_OPT_BASE, /**< Channel Map. @ref ble_gap_opt_ch_map_t */ + BLE_GAP_OPT_LOCAL_CONN_LATENCY, /**< Local connection latency. @ref ble_gap_opt_local_conn_latency_t */ + BLE_GAP_OPT_PASSKEY, /**< Set passkey. @ref ble_gap_opt_passkey_t */ + BLE_GAP_OPT_SCAN_REQ_REPORT, /**< Scan request report. @ref ble_gap_opt_scan_req_report_t */ + BLE_GAP_OPT_COMPAT_MODE, /**< Compatibility mode. @ref ble_gap_opt_compat_mode_t */ + BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT, /**< Set Authenticated payload timeout. @ref ble_gap_opt_auth_payload_timeout_t */ + BLE_GAP_OPT_EXT_LEN, /**< Extended length packets. @ref ble_gap_opt_ext_len_t */ + BLE_GAP_OPT_PREFERRED_PHYS_SET, /**< Set the preferred PHYs for all new connections. @ref ble_gap_opt_preferred_phys_t */ +}; + +/** @} */ + +/**@addtogroup BLE_GAP_DEFINES Defines + * @{ */ + +/**@defgroup BLE_ERRORS_GAP SVC return values specific to GAP + * @{ */ +#define BLE_ERROR_GAP_UUID_LIST_MISMATCH (NRF_GAP_ERR_BASE + 0x000) /**< UUID list does not contain an integral number of UUIDs. */ +#define BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST (NRF_GAP_ERR_BASE + 0x001) /**< Use of Whitelist not permitted with discoverable advertising. */ +#define BLE_ERROR_GAP_INVALID_BLE_ADDR (NRF_GAP_ERR_BASE + 0x002) /**< The upper two bits of the address do not correspond to the specified address type. */ +#define BLE_ERROR_GAP_WHITELIST_IN_USE (NRF_GAP_ERR_BASE + 0x003) /**< Attempt to modify the whitelist while already in use by another operation. */ +#define BLE_ERROR_GAP_DEVICE_IDENTITIES_IN_USE (NRF_GAP_ERR_BASE + 0x004) /**< Attempt to modify the device identity list while already in use by another operation. */ +#define BLE_ERROR_GAP_DEVICE_IDENTITIES_DUPLICATE (NRF_GAP_ERR_BASE + 0x005) /**< The device identity list contains entries with duplicate identity addresses. */ +/**@} */ + + +/**@defgroup BLE_GAP_ROLES GAP Roles + * @note Not explicitly used in peripheral API, but will be relevant for central API. + * @{ */ +#define BLE_GAP_ROLE_INVALID 0x0 /**< Invalid Role. */ +#define BLE_GAP_ROLE_PERIPH 0x1 /**< Peripheral Role. */ +#define BLE_GAP_ROLE_CENTRAL 0x2 /**< Central Role. */ +/**@} */ + + +/**@defgroup BLE_GAP_TIMEOUT_SOURCES GAP Timeout sources + * @{ */ +#define BLE_GAP_TIMEOUT_SRC_ADVERTISING 0x00 /**< Advertising timeout. */ +#define BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST 0x01 /**< Security request timeout. */ +#define BLE_GAP_TIMEOUT_SRC_SCAN 0x02 /**< Scanning timeout. */ +#define BLE_GAP_TIMEOUT_SRC_CONN 0x03 /**< Connection timeout. */ +#define BLE_GAP_TIMEOUT_SRC_AUTH_PAYLOAD 0x04 /**< Authenticated payload timeout. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADDR_TYPES GAP Address types + * @{ */ +#define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random static address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE 0x02 /**< Random private resolvable address. */ +#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**< Random private non-resolvable address. */ +/**@} */ + + +/**@brief The default interval in seconds at which a private address is refreshed. */ +#define BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S (900) /* 15 minutes. */ +/**@brief The maximum interval in seconds at which a private address can be refreshed. */ +#define BLE_GAP_MAX_PRIVATE_ADDR_CYCLE_INTERVAL_S (41400) /* 11 hours 30 minutes. */ + + +/** @brief BLE address length. */ +#define BLE_GAP_ADDR_LEN (6) + + +/**@defgroup BLE_GAP_PRIVACY_MODES Privacy modes + * @{ */ +#define BLE_GAP_PRIVACY_MODE_OFF 0x00 /**< Device will send and accept its identity address for its own address. */ +#define BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY 0x01 /**< Device will send and accept only private addresses for its own address. */ +/**@} */ + + +/**@defgroup BLE_GAP_AD_TYPE_DEFINITIONS GAP Advertising and Scan Response Data format + * @note Found at https://www.bluetooth.org/Technical/AssignedNumbers/generic_access_profile.htm + * @{ */ +#define BLE_GAP_AD_TYPE_FLAGS 0x01 /**< Flags for discoverability. */ +#define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE 0x02 /**< Partial list of 16 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE 0x03 /**< Complete list of 16 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_MORE_AVAILABLE 0x04 /**< Partial list of 32 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE 0x05 /**< Complete list of 32 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE 0x06 /**< Partial list of 128 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE 0x07 /**< Complete list of 128 bit service UUIDs. */ +#define BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME 0x08 /**< Short local device name. */ +#define BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME 0x09 /**< Complete local device name. */ +#define BLE_GAP_AD_TYPE_TX_POWER_LEVEL 0x0A /**< Transmit power level. */ +#define BLE_GAP_AD_TYPE_CLASS_OF_DEVICE 0x0D /**< Class of device. */ +#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C 0x0E /**< Simple Pairing Hash C. */ +#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R 0x0F /**< Simple Pairing Randomizer R. */ +#define BLE_GAP_AD_TYPE_SECURITY_MANAGER_TK_VALUE 0x10 /**< Security Manager TK Value. */ +#define BLE_GAP_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS 0x11 /**< Security Manager Out Of Band Flags. */ +#define BLE_GAP_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE 0x12 /**< Slave Connection Interval Range. */ +#define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT 0x14 /**< List of 16-bit Service Solicitation UUIDs. */ +#define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT 0x15 /**< List of 128-bit Service Solicitation UUIDs. */ +#define BLE_GAP_AD_TYPE_SERVICE_DATA 0x16 /**< Service Data - 16-bit UUID. */ +#define BLE_GAP_AD_TYPE_PUBLIC_TARGET_ADDRESS 0x17 /**< Public Target Address. */ +#define BLE_GAP_AD_TYPE_RANDOM_TARGET_ADDRESS 0x18 /**< Random Target Address. */ +#define BLE_GAP_AD_TYPE_APPEARANCE 0x19 /**< Appearance. */ +#define BLE_GAP_AD_TYPE_ADVERTISING_INTERVAL 0x1A /**< Advertising Interval. */ +#define BLE_GAP_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS 0x1B /**< LE Bluetooth Device Address. */ +#define BLE_GAP_AD_TYPE_LE_ROLE 0x1C /**< LE Role. */ +#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C256 0x1D /**< Simple Pairing Hash C-256. */ +#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R256 0x1E /**< Simple Pairing Randomizer R-256. */ +#define BLE_GAP_AD_TYPE_SERVICE_DATA_32BIT_UUID 0x20 /**< Service Data - 32-bit UUID. */ +#define BLE_GAP_AD_TYPE_SERVICE_DATA_128BIT_UUID 0x21 /**< Service Data - 128-bit UUID. */ +#define BLE_GAP_AD_TYPE_URI 0x24 /**< URI */ +#define BLE_GAP_AD_TYPE_3D_INFORMATION_DATA 0x3D /**< 3D Information Data. */ +#define BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFF /**< Manufacturer Specific Data. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADV_FLAGS GAP Advertisement Flags + * @{ */ +#define BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE (0x01) /**< LE Limited Discoverable Mode. */ +#define BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE (0x02) /**< LE General Discoverable Mode. */ +#define BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED (0x04) /**< BR/EDR not supported. */ +#define BLE_GAP_ADV_FLAG_LE_BR_EDR_CONTROLLER (0x08) /**< Simultaneous LE and BR/EDR, Controller. */ +#define BLE_GAP_ADV_FLAG_LE_BR_EDR_HOST (0x10) /**< Simultaneous LE and BR/EDR, Host. */ +#define BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE (BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) /**< LE Limited Discoverable Mode, BR/EDR not supported. */ +#define BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE (BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) /**< LE General Discoverable Mode, BR/EDR not supported. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADV_INTERVALS GAP Advertising interval max and min + * @{ */ +#define BLE_GAP_ADV_INTERVAL_MIN 0x0020 /**< Minimum Advertising interval in 625 us units, i.e. 20 ms. */ +#define BLE_GAP_ADV_NONCON_INTERVAL_MIN 0x00A0 /**< Minimum Advertising interval in 625 us units for non connectable mode, i.e. 100 ms. */ +#define BLE_GAP_ADV_INTERVAL_MAX 0x4000 /**< Maximum Advertising interval in 625 us units, i.e. 10.24 s. */ + /**@} */ + + +/**@defgroup BLE_GAP_SCAN_INTERVALS GAP Scan interval max and min + * @{ */ +#define BLE_GAP_SCAN_INTERVAL_MIN 0x0004 /**< Minimum Scan interval in 625 us units, i.e. 2.5 ms. */ +#define BLE_GAP_SCAN_INTERVAL_MAX 0x4000 /**< Maximum Scan interval in 625 us units, i.e. 10.24 s. */ + /** @} */ + + +/**@defgroup BLE_GAP_SCAN_WINDOW GAP Scan window max and min + * @{ */ +#define BLE_GAP_SCAN_WINDOW_MIN 0x0004 /**< Minimum Scan window in 625 us units, i.e. 2.5 ms. */ +#define BLE_GAP_SCAN_WINDOW_MAX 0x4000 /**< Maximum Scan window in 625 us units, i.e. 10.24 s. */ + /** @} */ + + +/**@defgroup BLE_GAP_SCAN_TIMEOUT GAP Scan timeout max and min + * @{ */ +#define BLE_GAP_SCAN_TIMEOUT_MIN 0x0001 /**< Minimum Scan timeout in seconds. */ +#define BLE_GAP_SCAN_TIMEOUT_MAX 0xFFFF /**< Maximum Scan timeout in seconds. */ + /** @} */ + + +/**@brief Maximum size of advertising data in octets. */ +#define BLE_GAP_ADV_MAX_SIZE (31) + + +/**@defgroup BLE_GAP_ADV_TYPES GAP Advertising types + * @{ */ +#define BLE_GAP_ADV_TYPE_ADV_IND 0x00 /**< Connectable undirected. */ +#define BLE_GAP_ADV_TYPE_ADV_DIRECT_IND 0x01 /**< Connectable directed. */ +#define BLE_GAP_ADV_TYPE_ADV_SCAN_IND 0x02 /**< Scannable undirected. */ +#define BLE_GAP_ADV_TYPE_ADV_NONCONN_IND 0x03 /**< Non connectable undirected. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADV_FILTER_POLICIES GAP Advertising filter policies + * @{ */ +#define BLE_GAP_ADV_FP_ANY 0x00 /**< Allow scan requests and connect requests from any device. */ +#define BLE_GAP_ADV_FP_FILTER_SCANREQ 0x01 /**< Filter scan requests with whitelist. */ +#define BLE_GAP_ADV_FP_FILTER_CONNREQ 0x02 /**< Filter connect requests with whitelist. */ +#define BLE_GAP_ADV_FP_FILTER_BOTH 0x03 /**< Filter both scan and connect requests with whitelist. */ +/**@} */ + + +/**@defgroup BLE_GAP_ADV_TIMEOUT_VALUES GAP Advertising timeout values + * @{ */ +#define BLE_GAP_ADV_TIMEOUT_LIMITED_MAX (180) /**< Maximum advertising time in limited discoverable mode (TGAP(lim_adv_timeout) = 180s). */ +#define BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED (0) /**< Unlimited advertising in general discoverable mode. */ +/**@} */ + + +/**@defgroup BLE_GAP_DISC_MODES GAP Discovery modes + * @{ */ +#define BLE_GAP_DISC_MODE_NOT_DISCOVERABLE 0x00 /**< Not discoverable discovery Mode. */ +#define BLE_GAP_DISC_MODE_LIMITED 0x01 /**< Limited Discovery Mode. */ +#define BLE_GAP_DISC_MODE_GENERAL 0x02 /**< General Discovery Mode. */ +/**@} */ + + +/**@defgroup BLE_GAP_IO_CAPS GAP IO Capabilities + * @{ */ +#define BLE_GAP_IO_CAPS_DISPLAY_ONLY 0x00 /**< Display Only. */ +#define BLE_GAP_IO_CAPS_DISPLAY_YESNO 0x01 /**< Display and Yes/No entry. */ +#define BLE_GAP_IO_CAPS_KEYBOARD_ONLY 0x02 /**< Keyboard Only. */ +#define BLE_GAP_IO_CAPS_NONE 0x03 /**< No I/O capabilities. */ +#define BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY 0x04 /**< Keyboard and Display. */ +/**@} */ + + +/**@defgroup BLE_GAP_AUTH_KEY_TYPES GAP Authentication Key Types + * @{ */ +#define BLE_GAP_AUTH_KEY_TYPE_NONE 0x00 /**< No key (may be used to reject). */ +#define BLE_GAP_AUTH_KEY_TYPE_PASSKEY 0x01 /**< 6-digit Passkey. */ +#define BLE_GAP_AUTH_KEY_TYPE_OOB 0x02 /**< Out Of Band data. */ +/**@} */ + + +/**@defgroup BLE_GAP_KP_NOT_TYPES GAP Keypress Notification Types + * @{ */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_START 0x00 /**< Passkey entry started. */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_DIGIT_IN 0x01 /**< Passkey digit entered. */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_DIGIT_OUT 0x02 /**< Passkey digit erased. */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_CLEAR 0x03 /**< Passkey cleared. */ +#define BLE_GAP_KP_NOT_TYPE_PASSKEY_END 0x04 /**< Passkey entry completed. */ +/**@} */ + + +/**@defgroup BLE_GAP_SEC_STATUS GAP Security status + * @{ */ +#define BLE_GAP_SEC_STATUS_SUCCESS 0x00 /**< Procedure completed with success. */ +#define BLE_GAP_SEC_STATUS_TIMEOUT 0x01 /**< Procedure timed out. */ +#define BLE_GAP_SEC_STATUS_PDU_INVALID 0x02 /**< Invalid PDU received. */ +#define BLE_GAP_SEC_STATUS_RFU_RANGE1_BEGIN 0x03 /**< Reserved for Future Use range #1 begin. */ +#define BLE_GAP_SEC_STATUS_RFU_RANGE1_END 0x80 /**< Reserved for Future Use range #1 end. */ +#define BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED 0x81 /**< Passkey entry failed (user cancelled or other). */ +#define BLE_GAP_SEC_STATUS_OOB_NOT_AVAILABLE 0x82 /**< Out of Band Key not available. */ +#define BLE_GAP_SEC_STATUS_AUTH_REQ 0x83 /**< Authentication requirements not met. */ +#define BLE_GAP_SEC_STATUS_CONFIRM_VALUE 0x84 /**< Confirm value failed. */ +#define BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP 0x85 /**< Pairing not supported. */ +#define BLE_GAP_SEC_STATUS_ENC_KEY_SIZE 0x86 /**< Encryption key size. */ +#define BLE_GAP_SEC_STATUS_SMP_CMD_UNSUPPORTED 0x87 /**< Unsupported SMP command. */ +#define BLE_GAP_SEC_STATUS_UNSPECIFIED 0x88 /**< Unspecified reason. */ +#define BLE_GAP_SEC_STATUS_REPEATED_ATTEMPTS 0x89 /**< Too little time elapsed since last attempt. */ +#define BLE_GAP_SEC_STATUS_INVALID_PARAMS 0x8A /**< Invalid parameters. */ +#define BLE_GAP_SEC_STATUS_DHKEY_FAILURE 0x8B /**< DHKey check failure. */ +#define BLE_GAP_SEC_STATUS_NUM_COMP_FAILURE 0x8C /**< Numeric Comparison failure. */ +#define BLE_GAP_SEC_STATUS_BR_EDR_IN_PROG 0x8D /**< BR/EDR pairing in progress. */ +#define BLE_GAP_SEC_STATUS_X_TRANS_KEY_DISALLOWED 0x8E /**< BR/EDR Link Key cannot be used for LE keys. */ +#define BLE_GAP_SEC_STATUS_RFU_RANGE2_BEGIN 0x8F /**< Reserved for Future Use range #2 begin. */ +#define BLE_GAP_SEC_STATUS_RFU_RANGE2_END 0xFF /**< Reserved for Future Use range #2 end. */ +/**@} */ + + +/**@defgroup BLE_GAP_SEC_STATUS_SOURCES GAP Security status sources + * @{ */ +#define BLE_GAP_SEC_STATUS_SOURCE_LOCAL 0x00 /**< Local failure. */ +#define BLE_GAP_SEC_STATUS_SOURCE_REMOTE 0x01 /**< Remote failure. */ +/**@} */ + + +/**@defgroup BLE_GAP_CP_LIMITS GAP Connection Parameters Limits + * @{ */ +#define BLE_GAP_CP_MIN_CONN_INTVL_NONE 0xFFFF /**< No new minimum connection interval specified in connect parameters. */ +#define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest minimum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */ +#define BLE_GAP_CP_MIN_CONN_INTVL_MAX 0x0C80 /**< Highest minimum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */ +#define BLE_GAP_CP_MAX_CONN_INTVL_NONE 0xFFFF /**< No new maximum connection interval specified in connect parameters. */ +#define BLE_GAP_CP_MAX_CONN_INTVL_MIN 0x0006 /**< Lowest maximum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */ +#define BLE_GAP_CP_MAX_CONN_INTVL_MAX 0x0C80 /**< Highest maximum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */ +#define BLE_GAP_CP_SLAVE_LATENCY_MAX 0x01F3 /**< Highest slave latency permitted, in connection events. */ +#define BLE_GAP_CP_CONN_SUP_TIMEOUT_NONE 0xFFFF /**< No new supervision timeout specified in connect parameters. */ +#define BLE_GAP_CP_CONN_SUP_TIMEOUT_MIN 0x000A /**< Lowest supervision timeout permitted, in units of 10 ms, i.e. 100 ms. */ +#define BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX 0x0C80 /**< Highest supervision timeout permitted, in units of 10 ms, i.e. 32 s. */ +/**@} */ + + +/**@brief GAP device name defines. */ +#define BLE_GAP_DEVNAME_DEFAULT "nRF5x" /**< Default device name value. */ +#define BLE_GAP_DEVNAME_DEFAULT_LEN 31 /**< Default number of octets in device name. */ +#define BLE_GAP_DEVNAME_MAX_LEN 248 /**< Maximum number of octets in device name. */ + + +/**@brief Disable RSSI events for connections */ +#define BLE_GAP_RSSI_THRESHOLD_INVALID 0xFF + +/**@defgroup BLE_GAP_PHYS GAP PHYs + * @{ */ +#define BLE_GAP_PHY_1MBPS 0x01 /**< 1 Mbps PHY. */ +#define BLE_GAP_PHY_2MBPS 0x02 /**< 2 Mbps PHY. */ +#define BLE_GAP_PHY_CODED 0x04 /**< Coded PHY. */ +/**@} */ + +/**@defgroup BLE_GAP_CONN_SEC_MODE_SET_MACROS GAP attribute security requirement setters + * + * See @ref ble_gap_conn_sec_mode_t. + * @{ */ +/**@brief Set sec_mode pointed to by ptr to have no access rights.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(ptr) do {(ptr)->sm = 0; (ptr)->lv = 0;} while(0) +/**@brief Set sec_mode pointed to by ptr to require no protection, open link.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_OPEN(ptr) do {(ptr)->sm = 1; (ptr)->lv = 1;} while(0) +/**@brief Set sec_mode pointed to by ptr to require encryption, but no MITM protection.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 2;} while(0) +/**@brief Set sec_mode pointed to by ptr to require encryption and MITM protection.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 3;} while(0) +/**@brief Set sec_mode pointed to by ptr to require LESC encryption and MITM protection.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 4;} while(0) +/**@brief Set sec_mode pointed to by ptr to require signing or encryption, no MITM protection needed.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 1;} while(0) +/**@brief Set sec_mode pointed to by ptr to require signing or encryption with MITM protection.*/ +#define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 2;} while(0) +/**@} */ + + +/**@brief GAP Security Random Number Length. */ +#define BLE_GAP_SEC_RAND_LEN 8 + + +/**@brief GAP Security Key Length. */ +#define BLE_GAP_SEC_KEY_LEN 16 + + +/**@brief GAP LE Secure Connections Elliptic Curve Diffie-Hellman P-256 Public Key Length. */ +#define BLE_GAP_LESC_P256_PK_LEN 64 + + +/**@brief GAP LE Secure Connections Elliptic Curve Diffie-Hellman DHKey Length. */ +#define BLE_GAP_LESC_DHKEY_LEN 32 + + +/**@brief GAP Passkey Length. */ +#define BLE_GAP_PASSKEY_LEN 6 + + +/**@brief Maximum amount of addresses in the whitelist. */ +#define BLE_GAP_WHITELIST_ADDR_MAX_COUNT (8) + + +/**@brief Maximum amount of identities in the device identities list. */ +#define BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT (8) + + +/**@defgroup GAP_SEC_MODES GAP Security Modes + * @{ */ +#define BLE_GAP_SEC_MODE 0x00 /**< No key (may be used to reject). */ +/**@} */ +/** @} */ + + +/**@addtogroup BLE_GAP_STRUCTURES Structures + * @{ */ + +/**@brief Bluetooth Low Energy address. */ +typedef struct +{ + uint8_t addr_id_peer : 1; /**< Only valid for peer addresses. + Reference to peer in device identities list (as set with @ref sd_ble_gap_device_identities_set) when peer is using privacy. */ + uint8_t addr_type : 7; /**< See @ref BLE_GAP_ADDR_TYPES. */ + uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */ +} ble_gap_addr_t; + + +/**@brief GAP connection parameters. + * + * @note When ble_conn_params_t is received in an event, both min_conn_interval and + * max_conn_interval will be equal to the connection interval set by the central. + * + * @note If both conn_sup_timeout and max_conn_interval are specified, then the following constraint applies: + * conn_sup_timeout * 4 > (1 + slave_latency) * max_conn_interval + * that corresponds to the following Bluetooth Spec requirement: + * The Supervision_Timeout in milliseconds shall be larger than + * (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds. + */ +typedef struct +{ + uint16_t min_conn_interval; /**< Minimum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/ + uint16_t max_conn_interval; /**< Maximum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/ + uint16_t slave_latency; /**< Slave Latency in number of connection events, see @ref BLE_GAP_CP_LIMITS.*/ + uint16_t conn_sup_timeout; /**< Connection Supervision Timeout in 10 ms units, see @ref BLE_GAP_CP_LIMITS.*/ +} ble_gap_conn_params_t; + + +/**@brief GAP connection security modes. + * + * Security Mode 0 Level 0: No access permissions at all (this level is not defined by the Bluetooth Core specification).\n + * Security Mode 1 Level 1: No security is needed (aka open link).\n + * Security Mode 1 Level 2: Encrypted link required, MITM protection not necessary.\n + * Security Mode 1 Level 3: MITM protected encrypted link required.\n + * Security Mode 1 Level 4: LESC MITM protected encrypted link required.\n + * Security Mode 2 Level 1: Signing or encryption required, MITM protection not necessary.\n + * Security Mode 2 Level 2: MITM protected signing required, unless link is MITM protected encrypted.\n + */ +typedef struct +{ + uint8_t sm : 4; /**< Security Mode (1 or 2), 0 for no permissions at all. */ + uint8_t lv : 4; /**< Level (1, 2, 3 or 4), 0 for no permissions at all. */ + +} ble_gap_conn_sec_mode_t; + + +/**@brief GAP connection security status.*/ +typedef struct +{ + ble_gap_conn_sec_mode_t sec_mode; /**< Currently active security mode for this connection.*/ + uint8_t encr_key_size; /**< Length of currently active encryption key, 7 to 16 octets (only applicable for bonding procedures). */ +} ble_gap_conn_sec_t; + + +/** + * @brief Device name and its properties + * @note If @ref max_len is more than @ref BLE_GAP_DEVNAME_DEFAULT_LEN and vloc is set to @ref BLE_GATTS_VLOC_STACK, the attribute table size must be increased to have room for the longer device name (see @ref ble_gatts_enable_params_t). + */ +typedef struct +{ + ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */ + uint8_t vloc:2; /**< Value location, see @ref BLE_GATTS_VLOCS.*/ + uint8_t *p_value; /**< Pointer to where the value (device name) is stored or will be stored.*/ + uint16_t current_len; /**< Current length in bytes of the memory pointed to by p_value.*/ + uint16_t max_len; /**< Maximum length in bytes of the memory pointed to by p_value.*/ +} ble_gap_device_name_t; + + +/** + * @brief BLE GAP initialization parameters. + */ +typedef struct +{ + uint8_t periph_conn_count; /**< Number of connections acting as a peripheral */ + uint8_t central_conn_count; /**< Number of connections acting as a central */ + uint8_t central_sec_count; /**< Number of SMP instances for all connections acting as a central. */ + ble_gap_device_name_t const *p_device_name; /**< Pointer to device name instance. If NULL, @ref sd_ble_enable() will set the device name to @ref BLE_GAP_DEVNAME_DEFAULT. */ +} ble_gap_enable_params_t; + + +/**@brief Identity Resolving Key. */ +typedef struct +{ + uint8_t irk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing IRK. */ +} ble_gap_irk_t; + + +/**@brief Channel mask for RF channels used in advertising. */ +typedef struct +{ + uint8_t ch_37_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 37 */ + uint8_t ch_38_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 38 */ + uint8_t ch_39_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 39 */ +} ble_gap_adv_ch_mask_t; + + +/**@brief GAP advertising parameters. */ +typedef struct +{ + uint8_t type; /**< See @ref BLE_GAP_ADV_TYPES. */ + ble_gap_addr_t const *p_peer_addr; /**< Address of a known peer. + - When privacy is enabled and the local device use @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE addresses, the device identity list is searched for a matching + entry. If the local IRK for that device identity is set, the local IRK for that device will be used to generate the advertiser address field in the advertise packet. + - If type is @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this must be set to the targeted initiator. If the initiator is in the device identity list, + the peer IRK for that device will be used to generate the initiator address field in the ADV_DIRECT_IND packet. */ + uint8_t fp; /**< Filter Policy, see @ref BLE_GAP_ADV_FILTER_POLICIES. */ + uint16_t interval; /**< Advertising interval between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s), see @ref BLE_GAP_ADV_INTERVALS. + - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for high duty cycle directed advertising. + - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, set @ref BLE_GAP_ADV_INTERVAL_MIN <= interval <= @ref BLE_GAP_ADV_INTERVAL_MAX for low duty cycle advertising.*/ + uint16_t timeout; /**< Advertising timeout between 0x0001 and 0x3FFF in seconds, 0x0000 disables timeout. See also @ref BLE_GAP_ADV_TIMEOUT_VALUES. If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for High duty cycle directed advertising. */ + ble_gap_adv_ch_mask_t channel_mask; /**< Advertising channel mask. See @ref ble_gap_adv_ch_mask_t. */ +} ble_gap_adv_params_t; + + +/**@brief GAP scanning parameters. */ +typedef struct +{ + uint8_t active : 1; /**< If 1, perform active scanning (scan requests). */ + uint8_t use_whitelist : 1; /**< If 1, filter advertisers using current active whitelist. */ + uint8_t adv_dir_report : 1; /**< If 1, also report directed advertisements where the initiator field is set to a private resolvable address, + even if the address did not resolve to an entry in the device identity list. A report will be generated + even if the peer is not in the whitelist. */ + uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + uint16_t timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ +} ble_gap_scan_params_t; + + +/**@brief Device Privacy. + * + * The privacy feature provides a way for the device to avoid being tracked over a period of time. + * The privacy feature, when enabled, hides the local device identity and replaces it with a private address + * that is automatically refreshed at a specified interval. + * + * If a device still wants to be recognized by other peers, it needs to share it's Identity Resolving Key (IRK). + * With this key, a device can generate a random private address that can only be recognized by peers in possession of that key, + * and devices can establish connections without revealing their real identities. + * + * @note If the device IRK is updated, the new IRK becomes the one to be distributed in all + * bonding procedures performed after @ref sd_ble_gap_privacy_set returns. + * The IRK distributed during bonding procedure is the device IRK that is active when @ref sd_ble_gap_sec_params_reply is called. + */ +typedef struct +{ + uint8_t privacy_mode; /**< Privacy mode, see @ref BLE_GAP_PRIVACY_MODES. Default is @ref BLE_GAP_PRIVACY_MODE_OFF. */ + uint8_t private_addr_type; /**< The private address type must be either @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. */ + uint16_t private_addr_cycle_s; /**< Private address cycle interval in seconds. Providing an address cycle value of 0 will use the default value defined by @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S. */ + ble_gap_irk_t *p_device_irk; /**< When used as input, pointer to IRK structure that will be used as the default IRK. If NULL, the device default IRK will be used. + When used as output, pointer to IRK structure where the current default IRK will be written to. If NULL, this argument is ignored. + By default, the default IRK is used to generate random private resolvable addresses for the local device unless instructed otherwise. */ +} ble_gap_privacy_params_t; + + +/**@brief Physical Layer configuration + * @note tx_phys and rx_phys are bitfields, to indicate multiple preferred PHYs for each direction they can be ORed together. + * @code + * p_gap_phys->tx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; + * p_gap_phys->rx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; + * @endcode + * + */ +typedef struct +{ + uint8_t tx_phys; /**< Preferred transmit PHYs, see @ref BLE_GAP_PHYS. */ + uint8_t rx_phys; /**< Preferred receive PHYs, see @ref BLE_GAP_PHYS. */ +} ble_gap_phys_t; + +/** @brief Keys that can be exchanged during a bonding procedure. */ +typedef struct +{ + uint8_t enc : 1; /**< Long Term Key and Master Identification. */ + uint8_t id : 1; /**< Identity Resolving Key and Identity Address Information. */ + uint8_t sign : 1; /**< Connection Signature Resolving Key. */ + uint8_t link : 1; /**< Derive the Link Key from the LTK. */ +} ble_gap_sec_kdist_t; + + +/**@brief GAP security parameters. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Enable Man In The Middle protection. */ + uint8_t lesc : 1; /**< Enable LE Secure Connection pairing. */ + uint8_t keypress : 1; /**< Enable generation of keypress notifications. */ + uint8_t io_caps : 3; /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */ + uint8_t oob : 1; /**< The OOB data flag. + - In LE legacy pairing, this flag is set if a device has out of band authentication data. + The OOB method is used if both of the devices have out of band authentication data. + - In LE Secure Connections pairing, this flag is set if a device has the peer device's out of band authentication data. + The OOB method is used if at least one device has the peer device's OOB data available. */ + uint8_t min_key_size; /**< Minimum encryption key size in octets between 7 and 16. If 0 then not applicable in this instance. */ + uint8_t max_key_size; /**< Maximum encryption key size in octets between min_key_size and 16. */ + ble_gap_sec_kdist_t kdist_own; /**< Key distribution bitmap: keys that the local device will distribute. */ + ble_gap_sec_kdist_t kdist_peer; /**< Key distribution bitmap: keys that the remote device will distribute. */ +} ble_gap_sec_params_t; + + +/**@brief GAP Encryption Information. */ +typedef struct +{ + uint8_t ltk[BLE_GAP_SEC_KEY_LEN]; /**< Long Term Key. */ + uint8_t lesc : 1; /**< Key generated using LE Secure Connections. */ + uint8_t auth : 1; /**< Authenticated Key. */ + uint8_t ltk_len : 6; /**< LTK length in octets. */ +} ble_gap_enc_info_t; + + +/**@brief GAP Master Identification. */ +typedef struct +{ + uint16_t ediv; /**< Encrypted Diversifier. */ + uint8_t rand[BLE_GAP_SEC_RAND_LEN]; /**< Random Number. */ +} ble_gap_master_id_t; + + +/**@brief GAP Signing Information. */ +typedef struct +{ + uint8_t csrk[BLE_GAP_SEC_KEY_LEN]; /**< Connection Signature Resolving Key. */ +} ble_gap_sign_info_t; + + +/**@brief GAP LE Secure Connections P-256 Public Key. */ +typedef struct +{ + uint8_t pk[BLE_GAP_LESC_P256_PK_LEN]; /**< LE Secure Connections Elliptic Curve Diffie-Hellman P-256 Public Key. Stored in the standard SMP protocol format: {X,Y} both in little-endian. */ +} ble_gap_lesc_p256_pk_t; + + +/**@brief GAP LE Secure Connections DHKey. */ +typedef struct +{ + uint8_t key[BLE_GAP_LESC_DHKEY_LEN]; /**< LE Secure Connections Elliptic Curve Diffie-Hellman Key. Stored in little-endian. */ +} ble_gap_lesc_dhkey_t; + + +/**@brief GAP LE Secure Connections OOB data. */ +typedef struct +{ + ble_gap_addr_t addr; /**< Bluetooth address of the device. */ + uint8_t r[BLE_GAP_SEC_KEY_LEN]; /**< Random Number. */ + uint8_t c[BLE_GAP_SEC_KEY_LEN]; /**< Confirm Value. */ +} ble_gap_lesc_oob_data_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_CONNECTED. */ +typedef struct +{ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 + and the address is the device's identity address. */ + uint8_t role; /**< BLE role for this connection, see @ref BLE_GAP_ROLES */ + ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ +} ble_gap_evt_connected_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_DISCONNECTED. */ +typedef struct +{ + uint8_t reason; /**< HCI error code, see @ref BLE_HCI_STATUS_CODES. */ +} ble_gap_evt_disconnected_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE. */ +typedef struct +{ + ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ +} ble_gap_evt_conn_param_update_t; + +/**@brief Event Structure for @ref BLE_GAP_EVT_PHY_UPDATE. */ +typedef struct +{ + uint8_t status; /**< Status of the procedure, see @ref BLE_HCI_STATUS_CODES */ + uint8_t tx_phy; /**< TX PHY for this connection, see @ref BLE_GAP_PHYS. */ + uint8_t rx_phy; /**< RX PHY for this connection, see @ref BLE_GAP_PHYS. */ +} ble_gap_evt_phy_update_t; + +/**@brief Event structure for @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. */ +typedef struct +{ + ble_gap_sec_params_t peer_params; /**< Initiator Security Parameters. */ +} ble_gap_evt_sec_params_request_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_SEC_INFO_REQUEST. */ +typedef struct +{ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ + ble_gap_master_id_t master_id; /**< Master Identification for LTK lookup. */ + uint8_t enc_info : 1; /**< If 1, Encryption Information required. */ + uint8_t id_info : 1; /**< If 1, Identity Information required. */ + uint8_t sign_info : 1; /**< If 1, Signing Information required. */ +} ble_gap_evt_sec_info_request_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_PASSKEY_DISPLAY. */ +typedef struct +{ + uint8_t passkey[BLE_GAP_PASSKEY_LEN]; /**< 6-digit passkey in ASCII ('0'-'9' digits only). */ + uint8_t match_request : 1; /**< If 1 requires the application to report the match using @ref sd_ble_gap_auth_key_reply + with either @ref BLE_GAP_AUTH_KEY_TYPE_NONE if there is no match or + @ref BLE_GAP_AUTH_KEY_TYPE_PASSKEY if there is a match. */ +} ble_gap_evt_passkey_display_t; + +/**@brief Event structure for @ref BLE_GAP_EVT_KEY_PRESSED. */ +typedef struct +{ + uint8_t kp_not; /**< Keypress notification type, see @ref BLE_GAP_KP_NOT_TYPES. */ +} ble_gap_evt_key_pressed_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_AUTH_KEY_REQUEST. */ +typedef struct +{ + uint8_t key_type; /**< See @ref BLE_GAP_AUTH_KEY_TYPES. */ +} ble_gap_evt_auth_key_request_t; + +/**@brief Event structure for @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST. */ +typedef struct +{ + ble_gap_lesc_p256_pk_t *p_pk_peer; /**< LE Secure Connections remote P-256 Public Key. This will point to the application-supplied memory + inside the keyset during the call to @ref sd_ble_gap_sec_params_reply. */ + uint8_t oobd_req :1; /**< LESC OOB data required. A call to @ref sd_ble_gap_lesc_oob_data_set is required to complete the procedure. */ +} ble_gap_evt_lesc_dhkey_request_t; + + +/**@brief Security levels supported. + * @note See Bluetooth Specification Version 4.2 Volume 3, Part C, Chapter 10, Section 10.2.1. +*/ +typedef struct +{ + uint8_t lv1 : 1; /**< If 1: Level 1 is supported. */ + uint8_t lv2 : 1; /**< If 1: Level 2 is supported. */ + uint8_t lv3 : 1; /**< If 1: Level 3 is supported. */ + uint8_t lv4 : 1; /**< If 1: Level 4 is supported. */ +} ble_gap_sec_levels_t; + + +/**@brief Encryption Key. */ +typedef struct +{ + ble_gap_enc_info_t enc_info; /**< Encryption Information. */ + ble_gap_master_id_t master_id; /**< Master Identification. */ +} ble_gap_enc_key_t; + + +/**@brief Identity Key. */ +typedef struct +{ + ble_gap_irk_t id_info; /**< Identity Resolving Key. */ + ble_gap_addr_t id_addr_info; /**< Identity Address. */ +} ble_gap_id_key_t; + + +/**@brief Security Keys. */ +typedef struct +{ + ble_gap_enc_key_t *p_enc_key; /**< Encryption Key, or NULL. */ + ble_gap_id_key_t *p_id_key; /**< Identity Key, or NULL. */ + ble_gap_sign_info_t *p_sign_key; /**< Signing Key, or NULL. */ + ble_gap_lesc_p256_pk_t *p_pk; /**< LE Secure Connections P-256 Public Key. When in debug mode the application must use the value defined + in the Core Bluetooth Specification v4.2 Vol.3, Part H, Section 2.3.5.6.1 */ +} ble_gap_sec_keys_t; + + +/**@brief Security key set for both local and peer keys. */ +typedef struct +{ + ble_gap_sec_keys_t keys_own; /**< Keys distributed by the local device. For LE Secure Connections the encryption key will be generated locally and will always be stored if bonding. */ + ble_gap_sec_keys_t keys_peer; /**< Keys distributed by the remote device. For LE Secure Connections, p_enc_key must always be NULL. */ +} ble_gap_sec_keyset_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_AUTH_STATUS. */ +typedef struct +{ + uint8_t auth_status; /**< Authentication status, see @ref BLE_GAP_SEC_STATUS. */ + uint8_t error_src : 2; /**< On error, source that caused the failure, see @ref BLE_GAP_SEC_STATUS_SOURCES. */ + uint8_t bonded : 1; /**< Procedure resulted in a bond. */ + ble_gap_sec_levels_t sm1_levels; /**< Levels supported in Security Mode 1. */ + ble_gap_sec_levels_t sm2_levels; /**< Levels supported in Security Mode 2. */ + ble_gap_sec_kdist_t kdist_own; /**< Bitmap stating which keys were exchanged (distributed) by the local device. If bonding with LE Secure Connections, the enc bit will be always set. */ + ble_gap_sec_kdist_t kdist_peer; /**< Bitmap stating which keys were exchanged (distributed) by the remote device. If bonding with LE Secure Connections, the enc bit will never be set. */ +} ble_gap_evt_auth_status_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_CONN_SEC_UPDATE. */ +typedef struct +{ + ble_gap_conn_sec_t conn_sec; /**< Connection security level. */ +} ble_gap_evt_conn_sec_update_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_TIMEOUT. */ +typedef struct +{ + uint8_t src; /**< Source of timeout event, see @ref BLE_GAP_TIMEOUT_SOURCES. */ +} ble_gap_evt_timeout_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_RSSI_CHANGED. */ +typedef struct +{ + int8_t rssi; /**< Received Signal Strength Indication in dBm. */ +} ble_gap_evt_rssi_changed_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_ADV_REPORT. */ +typedef struct +{ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 + and the address is the device's identity address. */ + ble_gap_addr_t direct_addr; /**< Set when the scanner is unable to resolve the private resolvable address of the initiator + field of a directed advertisement packet and the scanner has been enabled to report this in @ref ble_gap_scan_params_t::adv_dir_report. */ + int8_t rssi; /**< Received Signal Strength Indication in dBm. */ + uint8_t scan_rsp : 1; /**< If 1, the report corresponds to a scan response and the type field may be ignored. */ + uint8_t type : 2; /**< See @ref BLE_GAP_ADV_TYPES. Only valid if the scan_rsp field is 0. */ + uint8_t dlen : 5; /**< Advertising or scan response data length. */ + uint8_t data[BLE_GAP_ADV_MAX_SIZE]; /**< Advertising or scan response data. */ +} ble_gap_evt_adv_report_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_SEC_REQUEST. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Man In The Middle protection requested. */ + uint8_t lesc : 1; /**< LE Secure Connections requested. */ + uint8_t keypress : 1; /**< Generation of keypress notifications requested. */ +} ble_gap_evt_sec_request_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST. */ +typedef struct +{ + ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ +} ble_gap_evt_conn_param_update_request_t; + + +/**@brief Event structure for @ref BLE_GAP_EVT_SCAN_REQ_REPORT. */ +typedef struct +{ + int8_t rssi; /**< Received Signal Strength Indication in dBm. */ + ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 + and the address is the device's identity address. */ +} ble_gap_evt_scan_req_report_t; + + +/**@brief GAP event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which event occurred. */ + union /**< union alternative identified by evt_id in enclosing struct. */ + { + ble_gap_evt_connected_t connected; /**< Connected Event Parameters. */ + ble_gap_evt_disconnected_t disconnected; /**< Disconnected Event Parameters. */ + ble_gap_evt_conn_param_update_t conn_param_update; /**< Connection Parameter Update Parameters. */ + ble_gap_evt_sec_params_request_t sec_params_request; /**< Security Parameters Request Event Parameters. */ + ble_gap_evt_sec_info_request_t sec_info_request; /**< Security Information Request Event Parameters. */ + ble_gap_evt_passkey_display_t passkey_display; /**< Passkey Display Event Parameters. */ + ble_gap_evt_key_pressed_t key_pressed; /**< Key Pressed Event Parameters. */ + ble_gap_evt_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */ + ble_gap_evt_lesc_dhkey_request_t lesc_dhkey_request; /**< LE Secure Connections DHKey calculation request. */ + ble_gap_evt_auth_status_t auth_status; /**< Authentication Status Event Parameters. */ + ble_gap_evt_conn_sec_update_t conn_sec_update; /**< Connection Security Update Event Parameters. */ + ble_gap_evt_timeout_t timeout; /**< Timeout Event Parameters. */ + ble_gap_evt_rssi_changed_t rssi_changed; /**< RSSI Event Parameters. */ + ble_gap_evt_adv_report_t adv_report; /**< Advertising Report Event Parameters. */ + ble_gap_evt_sec_request_t sec_request; /**< Security Request Event Parameters. */ + ble_gap_evt_conn_param_update_request_t conn_param_update_request; /**< Connection Parameter Update Parameters. */ + ble_gap_evt_scan_req_report_t scan_req_report; /**< Scan Request Report Parameters. */ + ble_gap_evt_phy_update_t phy_update; /**< PHY Update Parameters. */ + } params; /**< Event Parameters. */ +} ble_gap_evt_t; + + +/**@brief Channel Map option. + * Used with @ref sd_ble_opt_get to get the current channel map + * or @ref sd_ble_opt_set to set a new channel map. When setting the + * channel map, it applies to all current and future connections. When getting the + * current channel map, it applies to a single connection and the connection handle + * must be supplied. + * + * @note Setting the channel map may take some time, depending on connection parameters. + * The time taken may be different for each connection and the get operation will + * return the previous channel map until the new one has taken effect. + * + * @note After setting the channel map, by spec it can not be set again until at least 1 s has passed. + * See Bluetooth Specification Version 4.1 Volume 2, Part E, Section 7.3.46. + * + * @retval ::NRF_SUCCESS Get or set successful. + * @retval ::NRF_ERROR_BUSY Channel map was set again before enough time had passed. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied for get. + * @retval ::NRF_ERROR_NOT_SUPPORTED Returned by sd_ble_opt_set in peripheral-only SoftDevices. + * + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle (only applicable for get) */ + uint8_t ch_map[5]; /**< Channel Map (37-bit). */ +} ble_gap_opt_ch_map_t; + + +/**@brief Local connection latency option. + * + * Local connection latency is a feature which enables the slave to improve + * current consumption by ignoring the slave latency set by the peer. The + * local connection latency can only be set to a multiple of the slave latency, + * and cannot be longer than half of the supervision timeout. + * + * Used with @ref sd_ble_opt_set to set the local connection latency. The + * @ref sd_ble_opt_get is not supported for this option, but the actual + * local connection latency (unless set to NULL) is set as a return parameter + * when setting the option. + * + * @note The latency set will be truncated down to the closest slave latency event + * multiple, or the nearest multiple before half of the supervision timeout. + * + * @note The local connection latency is disabled by default, and needs to be enabled for new + * connections and whenever the connection is updated. + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_NOT_SUPPORTED Get is not supported. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle */ + uint16_t requested_latency; /**< Requested local connection latency. */ + uint16_t * p_actual_latency; /**< Pointer to storage for the actual local connection latency (can be set to NULL to skip return value). */ +} ble_gap_opt_local_conn_latency_t; + + +/**@brief Passkey Option. + * + * Structure containing the passkey to be used during pairing. This can be used with @ref + * sd_ble_opt_set to make the SoftDevice use a pre-programmed passkey for authentication + * instead of generating a random one. + * + * @note Repeated pairing attempts using the same pre-programmed passkey makes pairing vulnerable to MITM attacks. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * + */ +typedef struct +{ + uint8_t * p_passkey; /**< Pointer to 6-digit ASCII string (digit 0..9 only, no NULL termination) passkey to be used during pairing. If this is NULL, the SoftDevice will generate a random passkey if required.*/ +} ble_gap_opt_passkey_t; + + +/**@brief Scan request report option. + * + * This can be used with @ref sd_ble_opt_set to make the SoftDevice send + * @ref BLE_GAP_EVT_SCAN_REQ_REPORT events. + * + * @note Due to the limited space reserved for scan request report events, + * not all received scan requests will be reported. + * + * @note If whitelisting is used, only whitelisted requests are reported. + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_STATE When advertising is ongoing while the option is set. + */ +typedef struct +{ + uint8_t enable : 1; /**< Enable scan request reports. */ +} ble_gap_opt_scan_req_report_t; + + +/**@brief Compatibility mode option. + * + * This can be used with @ref sd_ble_opt_set to enable and disable + * compatibility modes. Compatibility modes are disabled by default. + * + * @note Compatibility mode 1 enables interoperability with devices that do not support + * a value of 0 for the WinOffset parameter in the Link Layer CONNECT_REQ packet. + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_STATE When connection creation is ongoing while mode 1 is set. + */ +typedef struct +{ + uint8_t mode_1_enable : 1; /**< Enable compatibility mode 1.*/ +} ble_gap_opt_compat_mode_t; + +/**@brief Data length extension option. + * + * This can be used with @ref sd_ble_opt_set to enable longer data packets. + * + * @note An rxtx_max_pdu_payload_size of 0 will result in the default minimum payload size of 27. + * @note Not supported by SoftDevices for nRF51 Series devices. + * @note The parameters for a connection are applied when a connection complete + * event is generated for the host. + * + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_PARAM If the payload size is not 0 or a valid link layer PDU payload size. + * @retval ::NRF_ERROR_NOT_SUPPORTED If called on a SoftDevice designed for nRF51 (e.g. s130). + */ +typedef struct +{ + uint8_t rxtx_max_pdu_payload_size; /**< Max PDU payload size (in octets). */ +} ble_gap_opt_ext_len_t; + + + +/**@brief Authenticated payload timeout option. + * + * This can be used with @ref sd_ble_opt_set to change the Authenticated payload timeout to a value other than the default of 8 minutes. + * + * @note The authenticated payload timeout event ::BLE_GAP_TIMEOUT_SRC_AUTH_PAYLOAD will be generated + * if auth_payload_timeout time has elapsed without receiving a packet with a valid MIC on an encrypted + * link. + * + * @note The LE ping procedure will be initiated before the timer expires to give the peer a chance + * to reset the timer. In addition the stack will try to prioritize running of LE ping over other + * activities to increase chances of finishing LE ping before timer expires. To avoid side-effects + * on other activities, it is recommended to use high timeout values. + * Recommended timeout > 2*(connInterval * (6 + connSlaveLatency)). + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. auth_payload_timeout was outside of allowed range. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle */ + uint16_t auth_payload_timeout; /**< Requested timeout in 10 ms unit. Maximum is 48 000 (=480 000 ms =8 min). Minimum is 1 (=10ms). */ +} ble_gap_opt_auth_payload_timeout_t; + +/**@brief Preferred PHY option + * + * @details This can be used with @ref sd_ble_opt_set to change the preferred PHYs. Before this function is called the PHYs + * for peer initiated PHY Update procedure is @ref BLE_GAP_PHY_1MBPS. If @ref ble_gap_opt_preferred_phys_t::tx_phys or + * @ref ble_gap_opt_preferred_phys_t::rx_phys is 0, then the stack will select PHYs based on the peer requirements on that specific direction. + * + * @note The preferred PHYs are only valid for newly created connections after this option is called. If the PHYs should be + * changed for an existing link the @ref sd_ble_gap_phy_request would have to be called, and that would try to update the + * PHYs for the given link. + * + * @note tx_phys and rx_phys are bitfields, to indicate multiple preferred PHYs for each direction they can be ORed together. + * @code + * tx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; + * rx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; + * @endcode + * + * @events + * @event{@ref BLE_GAP_EVT_PHY_UPDATE, Result of the PHY Update if initiated by peer.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_PHY_REQUEST} + * @mmsc{@ref BLE_GAP_PERIPHERAL_PHY_REQUEST} + * @endmscs + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + */ +typedef struct +{ + uint8_t tx_phys; /**< Preferred transmit PHYs, see @ref BLE_GAP_PHYS. */ + uint8_t rx_phys; /**< Preferred receive PHYs, see @ref BLE_GAP_PHYS. */ +} ble_gap_opt_preferred_phys_t; + +/**@brief Option structure for GAP options. */ +typedef union +{ + ble_gap_opt_ch_map_t ch_map; /**< Parameters for the Channel Map option. */ + ble_gap_opt_local_conn_latency_t local_conn_latency; /**< Parameters for the Local connection latency option */ + ble_gap_opt_passkey_t passkey; /**< Parameters for the Passkey option.*/ + ble_gap_opt_scan_req_report_t scan_req_report; /**< Parameters for the scan request report option.*/ + ble_gap_opt_compat_mode_t compat_mode; /**< Parameters for the compatibility mode option.*/ + ble_gap_opt_ext_len_t ext_len; /**< Parameters for the extended length option. */ + ble_gap_opt_auth_payload_timeout_t auth_payload_timeout; /**< Parameters for the authenticated payload timeout option.*/ + ble_gap_opt_preferred_phys_t preferred_phys; /**< Parameters for the preferred PHYs option. */ +} ble_gap_opt_t; +/**@} */ + + +/**@addtogroup BLE_GAP_FUNCTIONS Functions + * @{ */ + +/**@brief Set the local Bluetooth identity address. + * + * The local Bluetooth identity address is the address that identifies this device to other peers. + * The address type must be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC. + * The identity address cannot be changed while roles are running. + * + * @note This address will be distributed to the peer during bonding. + * If the address changes, the address stored in the peer device will not be valid and the ability to + * reconnect using the old address will be lost. + * + * @note By default the SoftDevice will set an address of type @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC upon being + * enabled. The address is a random number populated during the IC manufacturing process and remains unchanged + * for the lifetime of each IC. + * + * @mscs + * @mmsc{@ref BLE_GAP_ADV_MSC} + * @endmscs + * + * @param[in] p_addr Pointer to address structure. + * + * @retval ::NRF_SUCCESS Address successfully set. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::NRF_ERROR_INVALID_STATE The identity address cannot be changed while the roles are running. + */ +SVCALL(SD_BLE_GAP_ADDR_SET, uint32_t, sd_ble_gap_addr_set(ble_gap_addr_t const *p_addr)); + + +/**@brief Get local Bluetooth identity address. + * + * @note This will always return the identity address irrespective of the privacy settings, + * i.e. the address type will always be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC. + * + * @param[out] p_addr Pointer to address structure to be filled in. + * + * @retval ::NRF_SUCCESS Address successfully retrieved. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid or NULL pointer supplied. + */ +SVCALL(SD_BLE_GAP_ADDR_GET, uint32_t, sd_ble_gap_addr_get(ble_gap_addr_t *p_addr)); + + +/**@brief Set the active whitelist in the SoftDevice. + * + * @note Only one whitelist can be used at a time and the whitelist is shared between the BLE roles. + * The whitelist cannot be set if a BLE role is using the whitelist. + * + * @note If an address is resolved using the information in the device identity list, then the whitelist + * filter policy applies to the peer identity address and not the resolvable address sent on air. + * + * @mscs + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_PRIVATE_SCAN_MSC} + * @endmscs + * + * @param[in] pp_wl_addrs Pointer to a whitelist of peer addresses, if NULL the whitelist will be cleared. + * @param[in] len Length of the whitelist, maximum @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. + * + * @retval ::NRF_SUCCESS The whitelist is successfully set/cleared. + * @retval ::NRF_ERROR_INVALID_ADDR The whitelist (or one of its entries) provided is invalid. + * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE The whitelist is in use by a BLE role and cannot be set or cleared. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. + * @retval ::NRF_ERROR_DATA_SIZE The given whitelist size is invalid (zero or too large); this can only return when + * pp_wl_addrs is not NULL. + */ +SVCALL(SD_BLE_GAP_WHITELIST_SET, uint32_t, sd_ble_gap_whitelist_set(ble_gap_addr_t const * const * pp_wl_addrs, uint8_t len)); + + +/**@brief Set device identity list. + * + * @note Only one device identity list can be used at a time and the list is shared between the BLE roles. + * The device identity list cannot be set if a BLE role is using the list. + * + * @param[in] pp_id_keys Pointer to an array of peer identity addresses and peer IRKs, if NULL the device identity list will be cleared. + * @param[in] pp_local_irks Pointer to an array of local IRKs. Each entry in the array maps to the entry in pp_id_keys at the same index. + * To fill in the list with the currently set device IRK for all peers, set to NULL. + * @param[in] len Length of the device identity list, maximum @ref BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT. + * + * @mscs + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_PRIVATE_SCAN_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_CONN_PRIV_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_CONN_PRIV_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS The device identity list successfully set/cleared. + * @retval ::NRF_ERROR_INVALID_ADDR The device identity list (or one of its entries) provided is invalid. + This code may be returned if the local IRK list also has an invalid entry. + * @retval ::BLE_ERROR_GAP_DEVICE_IDENTITIES_IN_USE The device identity list is in use and cannot be set or cleared. + * @retval ::BLE_ERROR_GAP_DEVICE_IDENTITIES_DUPLICATE The device identity list contains multiple entries with the same identity address. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. + * @retval ::NRF_ERROR_DATA_SIZE The given device identity list size invalid (zero or too large); this can + * only return when pp_id_keys is not NULL. + */ +SVCALL(SD_BLE_GAP_DEVICE_IDENTITIES_SET, uint32_t, sd_ble_gap_device_identities_set(ble_gap_id_key_t const * const * pp_id_keys, ble_gap_irk_t const * const * pp_local_irks, uint8_t len)); + + +/**@brief Set privacy settings. + * + * @note Privacy settings cannot be set while BLE roles are running. + * + * @param[in] p_privacy_params Privacy settings. + * + * @mscs + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Set successfully. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. + * @retval ::NRF_ERROR_INVALID_ADDR The pointer to privacy settings is NULL or invalid. + Otherwise, the p_device_irk pointer in privacy parameter is an invalid pointer. + * @retval ::NRF_ERROR_INVALID_PARAM Out of range parameters are provided. + * @retval ::NRF_ERROR_INVALID_STATE Privacy settings cannot be changed while BLE roles using privacy are enabled. + */ +SVCALL(SD_BLE_GAP_PRIVACY_SET, uint32_t, sd_ble_gap_privacy_set(ble_gap_privacy_params_t const *p_privacy_params)); + + +/**@brief Get privacy settings. + * + * @note The privacy settings returned include the current device irk as well. + * + * @param[in] p_privacy_params Privacy settings. + * + * @retval ::NRF_SUCCESS Privacy settings read. + * @retval ::NRF_ERROR_INVALID_ADDR The pointer given for returning the privacy settings may be NULL or invalid. + Otherwise, the p_device_irk pointer in privacy parameter is an invalid pointer. + */ +SVCALL(SD_BLE_GAP_PRIVACY_GET, uint32_t, sd_ble_gap_privacy_get(ble_gap_privacy_params_t *p_privacy_params)); + + +/**@brief Set, clear or update advertising and scan response data. + * + * @note The format of the advertising data will be checked by this call to ensure interoperability. + * Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and + * duplicating the local name in the advertising data and scan response data. + * + * @note To clear the advertising data and set it to a 0-length packet, simply provide a valid pointer (p_data/p_sr_data) with its corresponding + * length (dlen/srdlen) set to 0. + * + * @note The call will fail if p_data and p_sr_data are both NULL since this would have no effect. + * + * @mscs + * @mmsc{@ref BLE_GAP_ADV_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @param[in] p_data Raw data to be placed in advertising packet. If NULL, no changes are made to the current advertising packet data. + * @param[in] dlen Data length for p_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_data is NULL, can be 0 if p_data is not NULL. + * @param[in] p_sr_data Raw data to be placed in scan response packet. If NULL, no changes are made to the current scan response packet data. + * @param[in] srdlen Data length for p_sr_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL. + * + * @retval ::NRF_SUCCESS Advertising data successfully updated or cleared. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, both p_data and p_sr_data cannot be NULL. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_FLAGS Invalid combination of advertising flags supplied. + * @retval ::NRF_ERROR_INVALID_DATA Invalid data type(s) supplied, check the advertising data format specification. + * @retval ::NRF_ERROR_INVALID_LENGTH Invalid data length(s) supplied. + * @retval ::NRF_ERROR_NOT_SUPPORTED Unsupported data type. + * @retval ::BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied. + */ +SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const *p_data, uint8_t dlen, uint8_t const *p_sr_data, uint8_t srdlen)); + + +/**@brief Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). + * + * @note An application can start an advertising procedure for broadcasting purposes while a connection + * is active. After a @ref BLE_GAP_EVT_CONNECTED event is received, this function may therefore + * be called to start a broadcast advertising procedure. The advertising procedure + * cannot however be connectable (it must be of type @ref BLE_GAP_ADV_TYPE_ADV_SCAN_IND or + * @ref BLE_GAP_ADV_TYPE_ADV_NONCONN_IND). @note Only one advertiser may be active at any time. + * + * @events + * @event{@ref BLE_GAP_EVT_CONNECTED, Generated after connection has been established through connectable advertising.} + * @event{@ref BLE_GAP_EVT_TIMEOUT, Advertisement has timed out.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_ADV_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_CONN_PRIV_MSC} + * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @param[in] p_adv_params Pointer to advertising parameters structure. + * + * @retval ::NRF_SUCCESS The BLE stack has started advertising. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_CONN_COUNT The limit of available connections has been reached; connectable advertiser cannot be started. + * @retval ::NRF_ERROR_NO_MEM The configured memory pools (see @ref ble_conn_bw_counts_t) are not large enough for the + * bandwidth selected for this connection. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check the accepted ranges and limits. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Bluetooth address supplied. + * @retval ::BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. + * Stop one or more currently active roles (Central, Peripheral or Observer) and try again + */ +SVCALL(SD_BLE_GAP_ADV_START, uint32_t, sd_ble_gap_adv_start(ble_gap_adv_params_t const *p_adv_params)); + + +/**@brief Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). + * + * @mscs + * @mmsc{@ref BLE_GAP_ADV_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS The BLE stack has stopped advertising. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in advertising state). + */ +SVCALL(SD_BLE_GAP_ADV_STOP, uint32_t, sd_ble_gap_adv_stop(void)); + + +/**@brief Update connection parameters. + * + * @details In the central role this will initiate a Link Layer connection parameter update procedure, + * otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for + * the central to perform the procedure. In both cases, and regardless of success or failure, the application + * will be informed of the result with a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE event. + * + * @details This function can be used as a central both to reply to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST or to start the procedure unrequested. + * + * @events + * @event{@ref BLE_GAP_EVT_CONN_PARAM_UPDATE, Result of the connection parameter update procedure.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CPU_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} + * @mmsc{@ref BLE_GAP_MULTILINK_CPU_MSC} + * @mmsc{@ref BLE_GAP_MULTILINK_CTRL_PROC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_CPU_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_conn_params Pointer to desired connection parameters. If NULL is provided on a peripheral role, + * the parameters in the PPCP characteristic of the GAP service will be used instead. + * If NULL is provided on a central role and in response to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, the peripheral request will be rejected + * + * @retval ::NRF_SUCCESS The Connection Update procedure has been started successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, process pending events and wait for pending procedures to complete and retry. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + */ +SVCALL(SD_BLE_GAP_CONN_PARAM_UPDATE, uint32_t, sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_t const *p_conn_params)); + + +/**@brief Disconnect (GAP Link Termination). + * + * @details This call initiates the disconnection procedure, and its completion will be communicated to the application + * with a @ref BLE_GAP_EVT_DISCONNECTED event. + * + * @events + * @event{@ref BLE_GAP_EVT_DISCONNECTED, Generated when disconnection procedure is complete.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CONN_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES (accepted values are @ref BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and @ref BLE_HCI_CONN_INTERVAL_UNACCEPTABLE). + * + * @retval ::NRF_SUCCESS The disconnection procedure has been started successfully. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (disconnection is already in progress). + */ +SVCALL(SD_BLE_GAP_DISCONNECT, uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code)); + + +/**@brief Set the radio's transmit power. + * + * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -20, -16, -12, -8, -4, 0, 2, 3, 4, 5, 6, 7, 8 and 9 dBm). + * + * @note The -40dBm, -20dBm, -16dBm, -12dBm, -8dBm, -4dBm, 0dBm, +2dBm, +3dBm, +4dBm, +5dBm, +6dBm, +7dBm, +8dBm and +9dBm settings are available on nRF52840 series ICs. + * @note The -40dBm, -20dBm, -16dBm, -12dBm, -8dBm, -4dBm, 0dBm, +3dBm and +4dBm settings are available on nRF52 series ICs. + * + * @retval ::NRF_SUCCESS Successfully changed the transmit power. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + */ +SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power)); + + +/**@brief Set GAP Appearance value. + * + * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES. + * + * @retval ::NRF_SUCCESS Appearance value set successfully. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + */ +SVCALL(SD_BLE_GAP_APPEARANCE_SET, uint32_t, sd_ble_gap_appearance_set(uint16_t appearance)); + + +/**@brief Get GAP Appearance value. + * + * @param[out] p_appearance Pointer to appearance (16-bit) to be filled in, see @ref BLE_APPEARANCES. + * + * @retval ::NRF_SUCCESS Appearance value retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_GAP_APPEARANCE_GET, uint32_t, sd_ble_gap_appearance_get(uint16_t *p_appearance)); + + +/**@brief Set GAP Peripheral Preferred Connection Parameters. + * + * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the desired parameters. + * + * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters set successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + */ +SVCALL(SD_BLE_GAP_PPCP_SET, uint32_t, sd_ble_gap_ppcp_set(ble_gap_conn_params_t const *p_conn_params)); + + +/**@brief Get GAP Peripheral Preferred Connection Parameters. + * + * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters will be stored. + * + * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_GAP_PPCP_GET, uint32_t, sd_ble_gap_ppcp_get(ble_gap_conn_params_t *p_conn_params)); + + +/**@brief Set GAP device name. + * + * @param[in] p_write_perm Write permissions for the Device Name characteristic, see @ref ble_gap_conn_sec_mode_t. + * @param[in] p_dev_name Pointer to a UTF-8 encoded, non NULL-terminated string. + * @param[in] len Length of the UTF-8, non NULL-terminated string pointed to by p_dev_name in octets (must be smaller or equal than @ref BLE_GAP_DEVNAME_MAX_LEN). + * + * @note If the device name is located in application flash memory (see @ref ble_gap_device_name_t), it cannot be changed. Then @ref NRF_ERROR_FORBIDDEN will be returned. + * + * @retval ::NRF_SUCCESS GAP device name and permissions set successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + * @retval ::NRF_ERROR_FORBIDDEN Device name is not writable. + */ +SVCALL(SD_BLE_GAP_DEVICE_NAME_SET, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len)); + + +/**@brief Get GAP device name. + * + * @note If the device name is longer than the size of the supplied buffer, + * p_len will return the complete device name length, + * and not the number of bytes actually returned in p_dev_name. + * The application may use this information to allocate a suitable buffer size. + * + * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8 non NULL-terminated string will be placed. Set to NULL to obtain the complete device name length. + * @param[in,out] p_len Length of the buffer pointed by p_dev_name, complete device name length on output. + * + * @retval ::NRF_SUCCESS GAP device name retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + */ +SVCALL(SD_BLE_GAP_DEVICE_NAME_GET, uint32_t, sd_ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_len)); + + +/**@brief Initiate the GAP Authentication procedure. + * + * @details In the central role, this function will send an SMP Pairing Request (or an SMP Pairing Failed if rejected), + * otherwise in the peripheral role, an SMP Security Request will be sent. + * + * @events + * @event{Depending on the security parameters set and the packet exchanges with the peer\, the following events may be generated:} + * @event{@ref BLE_GAP_EVT_SEC_PARAMS_REQUEST} + * @event{@ref BLE_GAP_EVT_SEC_INFO_REQUEST} + * @event{@ref BLE_GAP_EVT_PASSKEY_DISPLAY} + * @event{@ref BLE_GAP_EVT_KEY_PRESSED} + * @event{@ref BLE_GAP_EVT_AUTH_KEY_REQUEST} + * @event{@ref BLE_GAP_EVT_LESC_DHKEY_REQUEST} + * @event{@ref BLE_GAP_EVT_CONN_SEC_UPDATE} + * @event{@ref BLE_GAP_EVT_AUTH_STATUS} + * @event{@ref BLE_GAP_EVT_TIMEOUT} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_SEC_REQ_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_SEC_REQ_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_sec_params Pointer to the @ref ble_gap_sec_params_t structure with the security parameters to be used during the pairing or bonding procedure. + * In the peripheral role, only the bond, mitm, lesc and keypress fields of this structure are used. + * In the central role, this pointer may be NULL to reject a Security Request. + * + * @retval ::NRF_SUCCESS Successfully initiated authentication procedure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::NRF_ERROR_NO_MEM The maximum number of authentication procedures that can run in parallel for the given role is reached. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_NOT_SUPPORTED Setting of sign or link fields in @ref ble_gap_sec_kdist_t not supported. + * @retval ::NRF_ERROR_TIMEOUT A SMP timeout has occurred, and further SMP operations on this link is prohibited. + */ +SVCALL(SD_BLE_GAP_AUTHENTICATE, uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const *p_sec_params)); + + +/**@brief Reply with GAP security parameters. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. + * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. + * + * @events + * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_JW_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_PERIPH_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_CENTRAL_OOB_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_STATIC_PK_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_CONFIRM_FAIL_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_KS_TOO_SMALL_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_APP_ERROR_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_REMOTE_PAIRING_FAIL_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_TIMEOUT_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS. + * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters structure. In the central role this must be set to NULL, as the parameters have + * already been provided during a previous call to @ref sd_ble_gap_authenticate. + * @param[in,out] p_sec_keyset Pointer to a @ref ble_gap_sec_keyset_t security keyset structure. Any keys generated and/or distributed as a result of the ongoing security procedure + * will be stored into the memory referenced by the pointers inside this structure. The keys will be stored and available to the application + * upon reception of a @ref BLE_GAP_EVT_AUTH_STATUS event. + * Note that the SoftDevice expects the application to provide memory for storing the + * peer's keys. So it must be ensured that the relevant pointers inside this structure are not NULL. The pointers to the local key + * can, however, be NULL, in which case, the local key data will not be available to the application upon reception of the + * @ref BLE_GAP_EVT_AUTH_STATUS event. + * + * @retval ::NRF_SUCCESS Successfully accepted security parameter from the application. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_NOT_SUPPORTED Setting of sign or link fields in @ref ble_gap_sec_kdist_t not supported. + */ +SVCALL(SD_BLE_GAP_SEC_PARAMS_REPLY, uint32_t, sd_ble_gap_sec_params_reply(uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params, ble_gap_sec_keyset_t const *p_sec_keyset)); + + +/**@brief Reply with an authentication key. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_REQUEST or a @ref BLE_GAP_EVT_PASSKEY_DISPLAY, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. + * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. + * + * @events + * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_CENTRAL_OOB_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] key_type See @ref BLE_GAP_AUTH_KEY_TYPES. + * @param[in] p_key If key type is @ref BLE_GAP_AUTH_KEY_TYPE_NONE, then NULL. + * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_PASSKEY, then a 6-byte ASCII string (digit 0..9 only, no NULL termination) + * or NULL when confirming LE Secure Connections Numeric Comparison. + * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format. + * + * @retval ::NRF_SUCCESS Authentication key successfully set. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_AUTH_KEY_REPLY, uint32_t, sd_ble_gap_auth_key_reply(uint16_t conn_handle, uint8_t key_type, uint8_t const *p_key)); + +/**@brief Reply with an LE Secure connections DHKey. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. + * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. + * + * @events + * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_dhkey LE Secure Connections DHKey. + * + * @retval ::NRF_SUCCESS DHKey successfully set. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_LESC_DHKEY_REPLY, uint32_t, sd_ble_gap_lesc_dhkey_reply(uint16_t conn_handle, ble_gap_lesc_dhkey_t const *p_dhkey)); + +/**@brief Notify the peer of a local keypress. + * + * @details This function can only be used when an authentication procedure using LE Secure Connection is in progress. Calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] kp_not See @ref BLE_GAP_KP_NOT_TYPES. + * + * @retval ::NRF_SUCCESS Keypress notification successfully queued for transmission. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. Either not entering a passkey or keypresses have not been enabled by both peers. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_BUSY The BLE stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_GAP_KEYPRESS_NOTIFY, uint32_t, sd_ble_gap_keypress_notify(uint16_t conn_handle, uint8_t kp_not)); + +/**@brief Generate a set of OOB data to send to a peer out of band. + * + * @note The @ref ble_gap_addr_t included in the OOB data returned will be the currently active one (or, if a connection has already been established, + * the one used during connection setup). The application may manually overwrite it with an updated value. + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. Can be BLE_CONN_HANDLE_INVALID if a BLE connection has not been established yet. + * @param[in] p_pk_own LE Secure Connections local P-256 Public Key. + * @param[out] p_oobd_own The OOB data to be sent out of band to a peer. + * + * @retval ::NRF_SUCCESS OOB data successfully generated. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_LESC_OOB_DATA_GET, uint32_t, sd_ble_gap_lesc_oob_data_get(uint16_t conn_handle, ble_gap_lesc_p256_pk_t const *p_pk_own, ble_gap_lesc_oob_data_t *p_oobd_own)); + +/**@brief Provide the OOB data sent/received out of band. + * + * @note An authentication procedure with OOB selected as an algorithm must be in progress when calling this function. + * @note A @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST event with the oobd_req set to 1 must have been received prior to calling this function. + * + * @events + * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_oobd_own The OOB data sent out of band to a peer or NULL if the peer has not received OOB data. + * Must correspond to @ref ble_gap_sec_params_t::oob flag in @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. + * @param[in] p_oobd_peer The OOB data received out of band from a peer or NULL if none received. + * Must correspond to @ref ble_gap_sec_params_t::oob flag in @ref sd_ble_gap_authenticate in the central role + * or @ref sd_ble_gap_sec_params_reply in the peripheral role. + * + * @retval ::NRF_SUCCESS OOB data accepted. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_LESC_OOB_DATA_SET, uint32_t, sd_ble_gap_lesc_oob_data_set(uint16_t conn_handle, ble_gap_lesc_oob_data_t const *p_oobd_own, ble_gap_lesc_oob_data_t const *p_oobd_peer)); + +/**@brief Initiate GAP Encryption procedure. + * + * @details In the central role, this function will initiate the encryption procedure using the encryption information provided. + * + * @events + * @event{@ref BLE_GAP_EVT_CONN_SEC_UPDATE, The connection security has been updated.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_ENC_MSC} + * @mmsc{@ref BLE_GAP_MULTILINK_CTRL_PROC_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_SEC_REQ_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_master_id Pointer to a @ref ble_gap_master_id_t master identification structure. + * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure. + * + * @retval ::NRF_SUCCESS Successfully initiated authentication procedure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. + * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, wait for pending procedures to complete and retry. + */ +SVCALL(SD_BLE_GAP_ENCRYPT, uint32_t, sd_ble_gap_encrypt(uint16_t conn_handle, ble_gap_master_id_t const *p_master_id, ble_gap_enc_info_t const *p_enc_info)); + + +/**@brief Reply with GAP security information. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_INFO_REQUEST, calling it at other times will result in @ref NRF_ERROR_INVALID_STATE. + * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. + * @note Data signing is not yet supported, and p_sign_info must therefore be NULL. + * + * @mscs + * @mmsc{@ref BLE_GAP_PERIPH_ENC_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure. May be NULL to signal none is available. + * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t identity information structure. May be NULL to signal none is available. + * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information structure. May be NULL to signal none is available. + * + * @retval ::NRF_SUCCESS Successfully accepted security information. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_SEC_INFO_REPLY, uint32_t, sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_t const *p_enc_info, ble_gap_irk_t const *p_id_info, ble_gap_sign_info_t const *p_sign_info)); + + +/**@brief Get the current connection security. + * + * @param[in] conn_handle Connection handle. + * @param[out] p_conn_sec Pointer to a @ref ble_gap_conn_sec_t structure to be filled in. + * + * @retval ::NRF_SUCCESS Current connection security successfully retrieved. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_CONN_SEC_GET, uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t *p_conn_sec)); + + +/**@brief Start reporting the received signal strength to the application. + * + * A new event is reported whenever the RSSI value changes, until @ref sd_ble_gap_rssi_stop is called. + * + * @events + * @event{@ref BLE_GAP_EVT_RSSI_CHANGED, New RSSI data available. How often the event is generated is + dependent on the settings of the threshold_dbm + and skip_count input parameters.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} + * @mmsc{@ref BLE_GAP_RSSI_FILT_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] threshold_dbm Minimum change in dBm before triggering the @ref BLE_GAP_EVT_RSSI_CHANGED event. Events are disabled if threshold_dbm equals @ref BLE_GAP_RSSI_THRESHOLD_INVALID. + * @param[in] skip_count Number of RSSI samples with a change of threshold_dbm or more before sending a new @ref BLE_GAP_EVT_RSSI_CHANGED event. + * + * @retval ::NRF_SUCCESS Successfully activated RSSI reporting. + * @retval ::NRF_ERROR_INVALID_STATE Disconnection in progress. Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_RSSI_START, uint32_t, sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count)); + + +/**@brief Stop reporting the received signal strength. + * + * @note An RSSI change detected before the call but not yet received by the application + * may be reported after @ref sd_ble_gap_rssi_stop has been called. + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} + * @mmsc{@ref BLE_GAP_RSSI_FILT_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * + * @retval ::NRF_SUCCESS Successfully deactivated RSSI reporting. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + */ +SVCALL(SD_BLE_GAP_RSSI_STOP, uint32_t, sd_ble_gap_rssi_stop(uint16_t conn_handle)); + + +/**@brief Get the received signal strength for the last connection event. + * + * @ref sd_ble_gap_rssi_start must be called to start reporting RSSI before using this function. @ref NRF_ERROR_NOT_FOUND + * will be returned until RSSI was sampled for the first time after calling @ref sd_ble_gap_rssi_start. + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored. + * + * @retval ::NRF_SUCCESS Successfully read the RSSI. + * @retval ::NRF_ERROR_NOT_FOUND No sample is available. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_INVALID_STATE RSSI reporting is not ongoing, or disconnection in progress. + */ +SVCALL(SD_BLE_GAP_RSSI_GET, uint32_t, sd_ble_gap_rssi_get(uint16_t conn_handle, int8_t *p_rssi)); + + +/**@brief Start scanning (GAP Discovery procedure, Observer Procedure). + * + * + * @events + * @event{@ref BLE_GAP_EVT_ADV_REPORT, An advertising or scan response packet has been received.} + * @event{@ref BLE_GAP_EVT_TIMEOUT, Scanner has timed out.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_SCAN_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @param[in] p_scan_params Pointer to scan parameters structure. + * + * @retval ::NRF_SUCCESS Successfully initiated scanning procedure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. + * Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again + */ +SVCALL(SD_BLE_GAP_SCAN_START, uint32_t, sd_ble_gap_scan_start(ble_gap_scan_params_t const *p_scan_params)); + + +/**@brief Stop scanning (GAP Discovery procedure, Observer Procedure). + * + * @mscs + * @mmsc{@ref BLE_GAP_SCAN_MSC} + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Successfully stopped scanning procedure. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in scanning state). + */ +SVCALL(SD_BLE_GAP_SCAN_STOP, uint32_t, sd_ble_gap_scan_stop(void)); + + +/**@brief Create a connection (GAP Link Establishment). + * + * @note If a scanning procedure is currently in progress it will be automatically stopped when calling this function. + * + * @mscs + * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_CONN_PRIV_MSC} + * @mmsc{@ref BLE_GAP_CENTRAL_CONN_MSC} + * @endmscs + * + * @param[in] p_peer_addr Pointer to peer address. If the use_whitelist bit is set in @ref ble_gap_scan_params_t, then this is ignored. + * If @ref ble_gap_addr_t::addr_id_peer is set then p_peer_addr must be present in the device identity list + * see @ref sd_ble_gap_device_identities_set. + * @param[in] p_scan_params Pointer to scan parameters structure. + * @param[in] p_conn_params Pointer to desired connection parameters. + * + * @retval ::NRF_SUCCESS Successfully initiated connection procedure. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid parameter(s) pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + - Invalid parameter(s) in p_scan_params or p_conn_params. + - Use of whitelist requested but whitelist has not been set, see @ref sd_ble_gap_whitelist_set. + - Peer address was not present in the device identity list, see @ref sd_ble_gap_device_identities_set. + * @retval ::NRF_ERROR_INVALID_STATE The SoftDevice is in an invalid state to perform this operation. This may be due to an + * existing locally initiated connect procedure, which must complete before initiating again. + * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Peer address. + * @retval ::NRF_ERROR_CONN_COUNT The limit of available connections has been reached. + * @retval ::NRF_ERROR_NO_MEM The configured memory pool (see @ref ble_conn_bw_counts_t) is not large enough for the + * bandwidth selected for this connection. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. If another connection is being established + * wait for the corresponding @ref BLE_GAP_EVT_CONNECTED event before calling again. + * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. + * Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again + */ +SVCALL(SD_BLE_GAP_CONNECT, uint32_t, sd_ble_gap_connect(ble_gap_addr_t const *p_peer_addr, ble_gap_scan_params_t const *p_scan_params, ble_gap_conn_params_t const *p_conn_params)); + + +/**@brief Cancel a connection establishment. + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_CONN_MSC} + * @endmscs + * + * @retval ::NRF_SUCCESS Successfully cancelled an ongoing connection procedure. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + */ +SVCALL(SD_BLE_GAP_CONNECT_CANCEL, uint32_t, sd_ble_gap_connect_cancel(void)); + + +/**@brief PHY Update Request + * + * @details This function is used to request a new PHY configuration for a central or a peripheral connection. It will always generate a + * @ref BLE_GAP_EVT_PHY_UPDATE event if successfully executed. If @ref ble_gap_phys_t::tx_phys or @ref ble_gap_phys_t::rx_phys + * is 0, then the stack will select PHYs based on the peer requirements on that specific direction. If the peer does not support + * the PHY Update procedure, then the resulting @ref BLE_GAP_EVT_PHY_UPDATE event will have a status different from + * @ref BLE_HCI_STATUS_CODE_SUCCESS. + * + * @note The requested PHYs does not have to be within the set of the preferred PHYs. + * + * @note If the @ref ble_gap_opt_preferred_phys_t have not been configured with @ref BLE_GAP_PHY_CODED, then this call might return + * @ref BLE_ERROR_BLOCKED_BY_OTHER_LINKS if there are multiple devices connected. + * + * + * @events + * @event{@ref BLE_GAP_EVT_PHY_UPDATE, Result of the PHY Update procedure procedure.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GAP_CENTRAL_PHY_REQUEST} + * @mmsc{@ref BLE_GAP_PERIPHERAL_PHY_REQUEST} + * @endmscs + * + * @param[in] conn_handle Connection handle to indicate the connection for which the PHY Update is requested. + * @param[in] p_gap_phys Pointer to PHY structure. + * + * @retval ::NRF_SUCCESS Successfully requested a PHY Update. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Unsupported PHYs supplied to the call. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_BLOCKED_BY_OTHER_LINKS Other connections may block the scheduling of the current link. + * @retval ::NRF_ERROR_BUSY Procedure is already in progress or not allowed at this time. Process pending events and wait for the pending procedure to complete and retry. + * + */ +SVCALL(SD_BLE_GAP_PHY_REQUEST, uint32_t, sd_ble_gap_phy_request(uint16_t conn_handle, ble_gap_phys_t const *p_gap_phys)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // BLE_GAP_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatt.h new file mode 100644 index 0000000000..cfa3860b5f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatt.h @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_GATT Generic Attribute Profile (GATT) Common + @{ + @brief Common definitions and prototypes for the GATT interfaces. + */ + +#ifndef BLE_GATT_H__ +#define BLE_GATT_H__ + +#include "ble_types.h" +#include "ble_ranges.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup BLE_GATT_DEFINES Defines + * @{ */ + +/** @brief Default MTU size, in bytes. */ +#define BLE_GATT_MTU_SIZE_DEFAULT 23 + +/**@brief Invalid Attribute Handle. */ +#define BLE_GATT_HANDLE_INVALID 0x0000 + +/**@brief First Attribute Handle. */ +#define BLE_GATT_HANDLE_START 0x0001 + +/**@brief Last Attribute Handle. */ +#define BLE_GATT_HANDLE_END 0xFFFF + +/** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources + * @{ */ +#define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */ +/** @} */ + +/** @defgroup BLE_GATT_WRITE_OPS GATT Write operations + * @{ */ +#define BLE_GATT_OP_INVALID 0x00 /**< Invalid Operation. */ +#define BLE_GATT_OP_WRITE_REQ 0x01 /**< Write Request. */ +#define BLE_GATT_OP_WRITE_CMD 0x02 /**< Write Command. */ +#define BLE_GATT_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */ +#define BLE_GATT_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */ +#define BLE_GATT_OP_EXEC_WRITE_REQ 0x05 /**< Execute Write Request. */ +/** @} */ + +/** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags + * @{ */ +#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00 /**< Cancel prepared write. */ +#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01 /**< Execute prepared write. */ +/** @} */ + +/** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations + * @{ */ +#define BLE_GATT_HVX_INVALID 0x00 /**< Invalid Operation. */ +#define BLE_GATT_HVX_NOTIFICATION 0x01 /**< Handle Value Notification. */ +#define BLE_GATT_HVX_INDICATION 0x02 /**< Handle Value Indication. */ +/** @} */ + +/** @defgroup BLE_GATT_STATUS_CODES GATT Status Codes + * @{ */ +#define BLE_GATT_STATUS_SUCCESS 0x0000 /**< Success. */ +#define BLE_GATT_STATUS_UNKNOWN 0x0001 /**< Unknown or not applicable status. */ +#define BLE_GATT_STATUS_ATTERR_INVALID 0x0100 /**< ATT Error: Invalid Error Code. */ +#define BLE_GATT_STATUS_ATTERR_INVALID_HANDLE 0x0101 /**< ATT Error: Invalid Attribute Handle. */ +#define BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED 0x0102 /**< ATT Error: Read not permitted. */ +#define BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED 0x0103 /**< ATT Error: Write not permitted. */ +#define BLE_GATT_STATUS_ATTERR_INVALID_PDU 0x0104 /**< ATT Error: Used in ATT as Invalid PDU. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION 0x0105 /**< ATT Error: Authenticated link required. */ +#define BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED 0x0106 /**< ATT Error: Used in ATT as Request Not Supported. */ +#define BLE_GATT_STATUS_ATTERR_INVALID_OFFSET 0x0107 /**< ATT Error: Offset specified was past the end of the attribute. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION 0x0108 /**< ATT Error: Used in ATT as Insufficient Authorisation. */ +#define BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL 0x0109 /**< ATT Error: Used in ATT as Prepare Queue Full. */ +#define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A /**< ATT Error: Used in ATT as Attribute not found. */ +#define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG 0x010B /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE 0x010C /**< ATT Error: Encryption key size used is insufficient. */ +#define BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH 0x010D /**< ATT Error: Invalid value size. */ +#define BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR 0x010E /**< ATT Error: Very unlikely error. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION 0x010F /**< ATT Error: Encrypted link required. */ +#define BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE 0x0110 /**< ATT Error: Attribute type is not a supported grouping attribute. */ +#define BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES 0x0111 /**< ATT Error: Encrypted link required. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN 0x0112 /**< ATT Error: Reserved for Future Use range #1 begin. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END 0x017F /**< ATT Error: Reserved for Future Use range #1 end. */ +#define BLE_GATT_STATUS_ATTERR_APP_BEGIN 0x0180 /**< ATT Error: Application range begin. */ +#define BLE_GATT_STATUS_ATTERR_APP_END 0x019F /**< ATT Error: Application range end. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN 0x01A0 /**< ATT Error: Reserved for Future Use range #2 begin. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END 0x01DF /**< ATT Error: Reserved for Future Use range #2 end. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN 0x01E0 /**< ATT Error: Reserved for Future Use range #3 begin. */ +#define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END 0x01FC /**< ATT Error: Reserved for Future Use range #3 end. */ +#define BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR 0x01FD /**< ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly configured. */ +#define BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG 0x01FE /**< ATT Common Profile and Service Error: Procedure Already in Progress. */ +#define BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE 0x01FF /**< ATT Common Profile and Service Error: Out Of Range. */ +/** @} */ + + +/** @defgroup BLE_GATT_CPF_FORMATS Characteristic Presentation Formats + * @note Found at http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml + * @{ */ +#define BLE_GATT_CPF_FORMAT_RFU 0x00 /**< Reserved For Future Use. */ +#define BLE_GATT_CPF_FORMAT_BOOLEAN 0x01 /**< Boolean. */ +#define BLE_GATT_CPF_FORMAT_2BIT 0x02 /**< Unsigned 2-bit integer. */ +#define BLE_GATT_CPF_FORMAT_NIBBLE 0x03 /**< Unsigned 4-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT8 0x04 /**< Unsigned 8-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT12 0x05 /**< Unsigned 12-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT16 0x06 /**< Unsigned 16-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT24 0x07 /**< Unsigned 24-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT32 0x08 /**< Unsigned 32-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT48 0x09 /**< Unsigned 48-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT64 0x0A /**< Unsigned 64-bit integer. */ +#define BLE_GATT_CPF_FORMAT_UINT128 0x0B /**< Unsigned 128-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT8 0x0C /**< Signed 2-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT12 0x0D /**< Signed 12-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT16 0x0E /**< Signed 16-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT24 0x0F /**< Signed 24-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT32 0x10 /**< Signed 32-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT48 0x11 /**< Signed 48-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT64 0x12 /**< Signed 64-bit integer. */ +#define BLE_GATT_CPF_FORMAT_SINT128 0x13 /**< Signed 128-bit integer. */ +#define BLE_GATT_CPF_FORMAT_FLOAT32 0x14 /**< IEEE-754 32-bit floating point. */ +#define BLE_GATT_CPF_FORMAT_FLOAT64 0x15 /**< IEEE-754 64-bit floating point. */ +#define BLE_GATT_CPF_FORMAT_SFLOAT 0x16 /**< IEEE-11073 16-bit SFLOAT. */ +#define BLE_GATT_CPF_FORMAT_FLOAT 0x17 /**< IEEE-11073 32-bit FLOAT. */ +#define BLE_GATT_CPF_FORMAT_DUINT16 0x18 /**< IEEE-20601 format. */ +#define BLE_GATT_CPF_FORMAT_UTF8S 0x19 /**< UTF-8 string. */ +#define BLE_GATT_CPF_FORMAT_UTF16S 0x1A /**< UTF-16 string. */ +#define BLE_GATT_CPF_FORMAT_STRUCT 0x1B /**< Opaque Structure. */ +/** @} */ + +/** @defgroup BLE_GATT_CPF_NAMESPACES GATT Bluetooth Namespaces + * @{ + */ +#define BLE_GATT_CPF_NAMESPACE_BTSIG 0x01 /**< Bluetooth SIG defined Namespace. */ +#define BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN 0x0000 /**< Namespace Description Unknown. */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATT_STRUCTURES Structures + * @{ */ + +/** + * @brief BLE GATT initialization parameters. + */ +typedef struct +{ + uint16_t att_mtu; /**< Maximum size of ATT packet the SoftDevice can send or receive. + If it is 0 then @ref BLE_GATT_MTU_SIZE_DEFAULT will be used. + Otherwise @ref BLE_GATT_MTU_SIZE_DEFAULT is the minimum value. + @mscs + @mmsc{@ref BLE_GATTC_MTU_EXCHANGE} + @mmsc{@ref BLE_GATTS_MTU_EXCHANGE} + @endmscs + */ +} ble_gatt_enable_params_t; + +/**@brief GATT Characteristic Properties. */ +typedef struct +{ + /* Standard properties */ + uint8_t broadcast :1; /**< Broadcasting of the value permitted. */ + uint8_t read :1; /**< Reading the value permitted. */ + uint8_t write_wo_resp :1; /**< Writing the value with Write Command permitted. */ + uint8_t write :1; /**< Writing the value with Write Request permitted. */ + uint8_t notify :1; /**< Notications of the value permitted. */ + uint8_t indicate :1; /**< Indications of the value permitted. */ + uint8_t auth_signed_wr :1; /**< Writing the value with Signed Write Command permitted. */ +} ble_gatt_char_props_t; + +/**@brief GATT Characteristic Extended Properties. */ +typedef struct +{ + /* Extended properties */ + uint8_t reliable_wr :1; /**< Writing the value with Queued Write operations permitted. */ + uint8_t wr_aux :1; /**< Writing the Characteristic User Description descriptor permitted. */ +} ble_gatt_char_ext_props_t; + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // BLE_GATT_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gattc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gattc.h new file mode 100644 index 0000000000..c36a4d7e34 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gattc.h @@ -0,0 +1,669 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client + @{ + @brief Definitions and prototypes for the GATT Client interface. + */ + +#ifndef BLE_GATTC_H__ +#define BLE_GATTC_H__ + +#include "ble_gatt.h" +#include "ble_types.h" +#include "ble_ranges.h" +#include "nrf_svc.h" +#include "nrf_error.h" +#include "nrf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup BLE_GATTC_ENUMERATIONS Enumerations + * @{ */ + +/**@brief GATTC API SVC numbers. */ +enum BLE_GATTC_SVCS +{ + SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */ + SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */ + SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */ + SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */ + SD_BLE_GATTC_ATTR_INFO_DISCOVER, /**< Attribute Information Discovery. */ + SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */ + SD_BLE_GATTC_READ, /**< Generic read. */ + SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */ + SD_BLE_GATTC_WRITE, /**< Generic write. */ + SD_BLE_GATTC_HV_CONFIRM, /**< Handle Value Confirmation. */ + SD_BLE_GATTC_EXCHANGE_MTU_REQUEST, /**< Exchange MTU Request. */ +}; + +/** + * @brief GATT Client Event IDs. + */ +enum BLE_GATTC_EVTS +{ + BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. \n See @ref ble_gattc_evt_prim_srvc_disc_rsp_t. */ + BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. \n See @ref ble_gattc_evt_rel_disc_rsp_t. */ + BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. \n See @ref ble_gattc_evt_char_disc_rsp_t. */ + BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. \n See @ref ble_gattc_evt_desc_disc_rsp_t. */ + BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, /**< Attribute Information Response event. \n See @ref ble_gattc_evt_attr_info_disc_rsp_t. */ + BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. \n See @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t. */ + BLE_GATTC_EVT_READ_RSP, /**< Read Response event. \n See @ref ble_gattc_evt_read_rsp_t. */ + BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. \n See @ref ble_gattc_evt_char_vals_read_rsp_t. */ + BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. \n See @ref ble_gattc_evt_write_rsp_t. */ + BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. \n Confirm indication with @ref sd_ble_gattc_hv_confirm. \n See @ref ble_gattc_evt_hvx_t. */ + BLE_GATTC_EVT_EXCHANGE_MTU_RSP, /**< Exchange MTU Response event. \n See @ref ble_gattc_evt_exchange_mtu_rsp_t. */ + BLE_GATTC_EVT_TIMEOUT /**< Timeout event. \n See @ref ble_gattc_evt_timeout_t. */ +}; + +/** @} */ + +/** @addtogroup BLE_GATTC_DEFINES Defines + * @{ */ + +/** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC + * @{ */ +#define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000) /**< Procedure not Permitted. */ +/** @} */ + +/** @defgroup BLE_GATTC_ATTR_INFO_FORMAT Attribute Information Formats + * @{ */ +#define BLE_GATTC_ATTR_INFO_FORMAT_16BIT 1 /**< 16-bit Attribute Information Format. */ +#define BLE_GATTC_ATTR_INFO_FORMAT_128BIT 2 /**< 128-bit Attribute Information Format. */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATTC_STRUCTURES Structures + * @{ */ + +/**@brief Operation Handle Range. */ +typedef struct +{ + uint16_t start_handle; /**< Start Handle. */ + uint16_t end_handle; /**< End Handle. */ +} ble_gattc_handle_range_t; + + +/**@brief GATT service. */ +typedef struct +{ + ble_uuid_t uuid; /**< Service UUID. */ + ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */ +} ble_gattc_service_t; + + +/**@brief GATT include. */ +typedef struct +{ + uint16_t handle; /**< Include Handle. */ + ble_gattc_service_t included_srvc; /**< Handle of the included service. */ +} ble_gattc_include_t; + + +/**@brief GATT characteristic. */ +typedef struct +{ + ble_uuid_t uuid; /**< Characteristic UUID. */ + ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ + uint8_t char_ext_props : 1; /**< Extended properties present. */ + uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */ + uint16_t handle_value; /**< Handle of the Characteristic Value. */ +} ble_gattc_char_t; + + +/**@brief GATT descriptor. */ +typedef struct +{ + uint16_t handle; /**< Descriptor Handle. */ + ble_uuid_t uuid; /**< Descriptor UUID. */ +} ble_gattc_desc_t; + + +/**@brief Write Parameters. */ +typedef struct +{ + uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ + uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ + uint16_t handle; /**< Handle to the attribute to be written. */ + uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ + uint16_t len; /**< Length of data in bytes. */ + uint8_t const *p_value; /**< Pointer to the value data. */ +} ble_gattc_write_params_t; + +/**@brief Attribute Information for 16-bit Attribute UUID. */ +typedef struct +{ + uint16_t handle; /**< Attribute handle. */ + ble_uuid_t uuid; /**< 16-bit Attribute UUID. */ +} ble_gattc_attr_info16_t; + +/**@brief Attribute Information for 128-bit Attribute UUID. */ +typedef struct +{ + uint16_t handle; /**< Attribute handle. */ + ble_uuid128_t uuid; /**< 128-bit Attribute UUID. */ +} ble_gattc_attr_info128_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Service count. */ + ble_gattc_service_t services[1]; /**< Service data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_prim_srvc_disc_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_REL_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Include count. */ + ble_gattc_include_t includes[1]; /**< Include data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_rel_disc_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Characteristic count. */ + ble_gattc_char_t chars[1]; /**< Characteristic data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_char_disc_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_DESC_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Descriptor count. */ + ble_gattc_desc_t descs[1]; /**< Descriptor data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_desc_disc_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP. */ +typedef struct +{ + uint16_t count; /**< Attribute count. */ + uint8_t format; /**< Attribute information format, see @ref BLE_GATTC_ATTR_INFO_FORMAT. */ + union { + ble_gattc_attr_info16_t attr_info16[1]; /**< Attribute information for 16-bit Attribute UUID. + @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ + ble_gattc_attr_info128_t attr_info128[1]; /**< Attribute information for 128-bit Attribute UUID. + @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ + } info; /**< Attribute information union. */ +} ble_gattc_evt_attr_info_disc_rsp_t; + +/**@brief GATT read by UUID handle value pair. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + uint8_t *p_value; /**< Pointer to the Attribute Value, length is available in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t::value_len. */ +} ble_gattc_handle_value_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */ +typedef struct +{ + uint16_t count; /**< Handle-Value Pair Count. */ + uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */ + uint8_t handle_value[1]; /**< Handle-Value(s) list. To iterate through the list use @ref sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter. + @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_char_val_by_uuid_read_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_READ_RSP. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + uint16_t offset; /**< Offset of the attribute data. */ + uint16_t len; /**< Attribute data length. */ + uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_read_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */ +typedef struct +{ + uint16_t len; /**< Concatenated Attribute values length. */ + uint8_t values[1]; /**< Attribute values. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_char_vals_read_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_WRITE_RSP. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */ + uint16_t offset; /**< Data offset. */ + uint16_t len; /**< Data length. */ + uint8_t data[1]; /**< Data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_write_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_HVX. */ +typedef struct +{ + uint16_t handle; /**< Handle to which the HVx operation applies. */ + uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ + uint16_t len; /**< Attribute data length. */ + uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gattc_evt_hvx_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP. */ +typedef struct +{ + uint16_t server_rx_mtu; /**< Server RX MTU size. */ +} ble_gattc_evt_exchange_mtu_rsp_t; + +/**@brief Event structure for @ref BLE_GATTC_EVT_TIMEOUT. */ +typedef struct +{ + uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ +} ble_gattc_evt_timeout_t; + +/**@brief GATTC event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which event occured. */ + uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ + uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases @ref BLE_GATT_HANDLE_INVALID. */ + union + { + ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */ + ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */ + ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */ + ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */ + ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */ + ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */ + ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */ + ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */ + ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */ + ble_gattc_evt_exchange_mtu_rsp_t exchange_mtu_rsp; /**< Exchange MTU Response Event Parameters. */ + ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */ + ble_gattc_evt_attr_info_disc_rsp_t attr_info_disc_rsp; /**< Attribute Information Discovery Event Parameters. */ + } params; /**< Event Parameters. @note Only valid if @ref gatt_status == @ref BLE_GATT_STATUS_SUCCESS. */ +} ble_gattc_evt_t; +/** @} */ + +/** @addtogroup BLE_GATTC_FUNCTIONS Functions + * @{ */ + +/**@brief Initiate or continue a GATT Primary Service Discovery procedure. + * + * @details This function initiates or resumes a Primary Service discovery procedure, starting from the supplied handle. + * If the last service has not been reached, this function must be called again with an updated start handle value to continue the search. + * + * @note If any of the discovered services have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with + * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. + * + * @events + * @event{@ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_PRIM_SRVC_DISC_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] start_handle Handle to start searching from. + * @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, uint32_t, sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *p_srvc_uuid)); + + +/**@brief Initiate or continue a GATT Relationship Discovery procedure. + * + * @details This function initiates or resumes the Find Included Services sub-procedure. If the last included service has not been reached, + * this must be called again with an updated handle range to continue the search. + * + * @events + * @event{@ref BLE_GATTC_EVT_REL_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_REL_DISC_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); + + +/**@brief Initiate or continue a GATT Characteristic Discovery procedure. + * + * @details This function initiates or resumes a Characteristic discovery procedure. If the last Characteristic has not been reached, + * this must be called again with an updated handle range to continue the discovery. + * + * @note If any of the discovered characteristics have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with + * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. + * + * @events + * @event{@ref BLE_GATTC_EVT_CHAR_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_CHAR_DISC_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); + + +/**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure. + * + * @details This function initiates or resumes a Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached, + * this must be called again with an updated handle range to continue the discovery. + * + * @events + * @event{@ref BLE_GATTC_EVT_DESC_DISC_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_DESC_DISC_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); + + +/**@brief Initiate or continue a GATT Read using Characteristic UUID procedure. + * + * @details This function initiates or resumes a Read using Characteristic UUID procedure. If the last Characteristic has not been reached, + * this must be called again with an updated handle range to continue the discovery. + * + * @events + * @event{@ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_READ_UUID_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_uuid Pointer to a Characteristic value UUID to read. + * @param[in] p_handle_range A pointer to the range of handles to perform this procedure on. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, uint32_t, sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_t const *p_uuid, ble_gattc_handle_range_t const *p_handle_range)); + + +/**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure. + * + * @details This function initiates or resumes a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor + * to be read is longer than ATT_MTU - 1, this function must be called multiple times with appropriate offset to read the + * complete value. + * + * @events + * @event{@ref BLE_GATTC_EVT_READ_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_VALUE_READ_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] handle The handle of the attribute to be read. + * @param[in] offset Offset into the attribute value to be read. + * + * @retval ::NRF_SUCCESS Successfully started or resumed the Read (Long) procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset)); + + +/**@brief Initiate a GATT Read Multiple Characteristic Values procedure. + * + * @details This function initiates a GATT Read Multiple Characteristic Values procedure. + * + * @events + * @event{@ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_READ_MULT_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read. + * @param[in] handle_count The number of handles in p_handles. + * + * @retval ::NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const *p_handles, uint16_t handle_count)); + + +/**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure. + * + * @details This function can perform all write procedures described in GATT. + * + * @note It is important to note that a write without response will consume an application buffer, and will therefore + * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write (with response) on the other hand will use the + * standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response + * has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. + * + * @events + * @event{@ref BLE_GATTC_EVT_WRITE_RSP, Generated when using write request or queued writes.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_VALUE_WRITE_MSC} + * @mmsc{@ref BLE_GATTC_VALUE_LONG_WRITE_MSC} + * @mmsc{@ref BLE_GATTC_VALUE_RELIABLE_WRITE_MSC} + * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_write_params A pointer to a write parameters structure. + * + * @retval ::NRF_SUCCESS Successfully started the Write procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + * @retval ::NRF_ERROR_BUSY Procedure already in progress. + * @retval ::BLE_ERROR_NO_TX_PACKETS No available application packets for this connection. + */ +SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params)); + + +/**@brief Send a Handle Value Confirmation to the GATT Server. + * + * @mscs + * @mmsc{@ref BLE_GATTC_HVI_MSC} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] handle The handle of the attribute in the indication. + * + * @retval ::NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no Indication pending to be confirmed. + * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle. + */ +SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle)); + +/**@brief Discovers information about a range of attributes on a GATT server. + * + * @events + * @event{@ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, Generated when information about a range of attributes has been received.} + * @endevents + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] p_handle_range The range of handles to request information about. + * + * @retval ::NRF_SUCCESS Successfully started an attribute information discovery procedure. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid connection state + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_ATTR_INFO_DISCOVER, uint32_t, sd_ble_gattc_attr_info_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * p_handle_range)); + +/**@brief Start an ATT_MTU exchange by sending an Exchange MTU Request to the server. + * + * @details The SoftDevice sets ATT_MTU to the minimum of: + * - The Client RX MTU value, and + * - The Server RX MTU value from @ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP. + * + * However, the SoftDevice never sets ATT_MTU lower than @ref BLE_GATT_MTU_SIZE_DEFAULT. + * + * @events + * @event{@ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP} + * @event{@ref BLE_EVT_DATA_LENGTH_CHANGED, Generated if a data length update procedure is performed after the ATT_MTU exchange.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTC_MTU_EXCHANGE} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] client_rx_mtu Client RX MTU size. + * - The minimum value is @ref BLE_GATT_MTU_SIZE_DEFAULT. + * - The maximum value is @ref ble_gatt_enable_params_t::att_mtu. + * - The value must be equal to Server RX MTU size given in @ref sd_ble_gatts_exchange_mtu_reply + * if an ATT_MTU exchange has already been performed in the other direction. + * + * @retval ::NRF_SUCCESS Successfully sent request to the server. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid connection state or an ATT_MTU exchange was already requested once. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid Client RX MTU size supplied. + * @retval ::NRF_ERROR_BUSY Client procedure already in progress. + */ +SVCALL(SD_BLE_GATTC_EXCHANGE_MTU_REQUEST, uint32_t, sd_ble_gattc_exchange_mtu_request(uint16_t conn_handle, uint16_t client_rx_mtu)); + +/**@brief Iterate through Handle-Value(s) list in @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event. + * + * @param[in] p_gattc_evt Pointer to event buffer containing @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event. + * @note If the buffer contains different event, behavior is undefined. + * @param[in,out] p_iter Iterator, points to @ref ble_gattc_handle_value_t structure that will be filled in with + * the next Handle-Value pair in each iteration. If the function returns other than + * @ref NRF_SUCCESS, it will not be changed. + * - To start iteration, initialize the structure to zero. + * - To continue, pass the value from previous iteration. + * + * \code + * ble_gattc_handle_value_t iter; + * memset(&iter, 0, sizeof(ble_gattc_handle_value_t)); + * while (sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(&ble_evt.evt.gattc_evt, &iter) == NRF_SUCCESS) + * { + * app_handle = iter.handle; + * memcpy(app_value, iter.p_value, ble_evt.evt.gattc_evt.params.char_val_by_uuid_read_rsp.value_len); + * } + * \endcode + * + * @retval ::NRF_SUCCESS Successfully retrieved the next Handle-Value pair. + * @retval ::NRF_ERROR_NOT_FOUND No more Handle-Value pairs available in the list. + */ +__STATIC_INLINE uint32_t sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(ble_gattc_evt_t *p_gattc_evt, ble_gattc_handle_value_t *p_iter); + +/** @} */ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE uint32_t sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(ble_gattc_evt_t *p_gattc_evt, ble_gattc_handle_value_t *p_iter) +{ + uint32_t value_len = p_gattc_evt->params.char_val_by_uuid_read_rsp.value_len; + uint8_t *p_first = p_gattc_evt->params.char_val_by_uuid_read_rsp.handle_value; + uint8_t *p_next = p_iter->p_value ? p_iter->p_value + value_len : p_first; + + if ((p_next - p_first) / (sizeof(uint16_t) + value_len) < p_gattc_evt->params.char_val_by_uuid_read_rsp.count) + { + p_iter->handle = (uint16_t)p_next[1] << 8 | p_next[0]; + p_iter->p_value = p_next + sizeof(uint16_t); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_NOT_FOUND; + } +} + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + +#ifdef __cplusplus +} +#endif +#endif /* BLE_GATTC_H__ */ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatts.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatts.h new file mode 100644 index 0000000000..b85735ec31 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatts.h @@ -0,0 +1,778 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_GATTS Generic Attribute Profile (GATT) Server + @{ + @brief Definitions and prototypes for the GATTS interface. + */ + +#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_svc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup BLE_GATTS_ENUMERATIONS Enumerations + * @{ */ + +/** + * @brief GATTS API SVC numbers. + */ +enum BLE_GATTS_SVCS +{ + SD_BLE_GATTS_SERVICE_ADD = BLE_GATTS_SVC_BASE, /**< Add a service. */ + SD_BLE_GATTS_INCLUDE_ADD, /**< Add an included service. */ + SD_BLE_GATTS_CHARACTERISTIC_ADD, /**< Add a characteristic. */ + SD_BLE_GATTS_DESCRIPTOR_ADD, /**< Add a generic attribute. */ + SD_BLE_GATTS_VALUE_SET, /**< Set an attribute value. */ + SD_BLE_GATTS_VALUE_GET, /**< Get an attribute value. */ + SD_BLE_GATTS_HVX, /**< Handle Value Notification or Indication. */ + SD_BLE_GATTS_SERVICE_CHANGED, /**< Perform a Service Changed Indication to one or more peers. */ + SD_BLE_GATTS_RW_AUTHORIZE_REPLY, /**< Reply to an authorization request for a read or write operation on one or more attributes. */ + SD_BLE_GATTS_SYS_ATTR_SET, /**< Set the persistent system attributes for a connection. */ + SD_BLE_GATTS_SYS_ATTR_GET, /**< Retrieve the persistent system attributes. */ + SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, /**< Retrieve the first valid user handle. */ + SD_BLE_GATTS_ATTR_GET, /**< Retrieve the UUID and/or metadata of an attribute. */ + SD_BLE_GATTS_EXCHANGE_MTU_REPLY /**< Reply to Exchange MTU Request. */ +}; + +/** + * @brief GATT Server Event IDs. + */ +enum BLE_GATTS_EVTS +{ + BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE, /**< Write operation performed. \n See @ref ble_gatts_evt_write_t. */ + BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST, /**< Read/Write Authorization request. \n Reply with @ref sd_ble_gatts_rw_authorize_reply. \n See @ref ble_gatts_evt_rw_authorize_request_t. */ + BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending. \n Respond with @ref sd_ble_gatts_sys_attr_set. \n See @ref ble_gatts_evt_sys_attr_missing_t. */ + BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. \n See @ref ble_gatts_evt_hvc_t. */ + BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. No additional event structure applies. */ + BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST, /**< Exchange MTU Request. \n Reply with @ref sd_ble_gatts_exchange_mtu_reply. \n See @ref ble_gatts_evt_exchange_mtu_request_t. */ + BLE_GATTS_EVT_TIMEOUT /**< Peer failed to resonpond to an ATT request in time. \n See @ref ble_gatts_evt_timeout_t. */ +}; +/** @} */ + +/** @addtogroup BLE_GATTS_DEFINES Defines + * @{ */ + +/** @defgroup BLE_ERRORS_GATTS SVC return values specific to GATTS + * @{ */ +#define BLE_ERROR_GATTS_INVALID_ATTR_TYPE (NRF_GATTS_ERR_BASE + 0x000) /**< Invalid attribute type. */ +#define BLE_ERROR_GATTS_SYS_ATTR_MISSING (NRF_GATTS_ERR_BASE + 0x001) /**< System Attributes missing. */ +/** @} */ + +/** @defgroup BLE_GATTS_ATTR_LENS_MAX Maximum attribute lengths + * @{ */ +#define BLE_GATTS_FIX_ATTR_LEN_MAX (510) /**< Maximum length for fixed length Attribute Values. */ +#define BLE_GATTS_VAR_ATTR_LEN_MAX (512) /**< Maximum length for variable length Attribute Values. */ +/** @} */ + +/** @defgroup BLE_GATTS_SRVC_TYPES GATT Server Service Types + * @{ */ +#define BLE_GATTS_SRVC_TYPE_INVALID 0x00 /**< Invalid Service Type. */ +#define BLE_GATTS_SRVC_TYPE_PRIMARY 0x01 /**< Primary Service. */ +#define BLE_GATTS_SRVC_TYPE_SECONDARY 0x02 /**< Secondary Type. */ +/** @} */ + + +/** @defgroup BLE_GATTS_ATTR_TYPES GATT Server Attribute Types + * @{ */ +#define BLE_GATTS_ATTR_TYPE_INVALID 0x00 /**< Invalid Attribute Type. */ +#define BLE_GATTS_ATTR_TYPE_PRIM_SRVC_DECL 0x01 /**< Primary Service Declaration. */ +#define BLE_GATTS_ATTR_TYPE_SEC_SRVC_DECL 0x02 /**< Secondary Service Declaration. */ +#define BLE_GATTS_ATTR_TYPE_INC_DECL 0x03 /**< Include Declaration. */ +#define BLE_GATTS_ATTR_TYPE_CHAR_DECL 0x04 /**< Characteristic Declaration. */ +#define BLE_GATTS_ATTR_TYPE_CHAR_VAL 0x05 /**< Characteristic Value. */ +#define BLE_GATTS_ATTR_TYPE_DESC 0x06 /**< Descriptor. */ +#define BLE_GATTS_ATTR_TYPE_OTHER 0x07 /**< Other, non-GATT specific type. */ +/** @} */ + + +/** @defgroup BLE_GATTS_OPS GATT Server Operations + * @{ */ +#define BLE_GATTS_OP_INVALID 0x00 /**< Invalid Operation. */ +#define BLE_GATTS_OP_WRITE_REQ 0x01 /**< Write Request. */ +#define BLE_GATTS_OP_WRITE_CMD 0x02 /**< Write Command. */ +#define BLE_GATTS_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */ +#define BLE_GATTS_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */ +#define BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL 0x05 /**< Execute Write Request: Cancel all prepared writes. */ +#define BLE_GATTS_OP_EXEC_WRITE_REQ_NOW 0x06 /**< Execute Write Request: Immediately execute all prepared writes. */ +/** @} */ + +/** @defgroup BLE_GATTS_VLOCS GATT Value Locations + * @{ */ +#define BLE_GATTS_VLOC_INVALID 0x00 /**< Invalid Location. */ +#define BLE_GATTS_VLOC_STACK 0x01 /**< Attribute Value is located in stack memory, no user memory is required. */ +#define BLE_GATTS_VLOC_USER 0x02 /**< Attribute Value is located in user memory. This requires the user to maintain a valid buffer through the lifetime of the attribute, since the stack + will read and write directly to the memory using the pointer provided in the APIs. There are no alignment requirements for the buffer. */ +/** @} */ + +/** @defgroup BLE_GATTS_AUTHORIZE_TYPES GATT Server Authorization Types + * @{ */ +#define BLE_GATTS_AUTHORIZE_TYPE_INVALID 0x00 /**< Invalid Type. */ +#define BLE_GATTS_AUTHORIZE_TYPE_READ 0x01 /**< Authorize a Read Operation. */ +#define BLE_GATTS_AUTHORIZE_TYPE_WRITE 0x02 /**< Authorize a Write Request Operation. */ +/** @} */ + +/** @defgroup BLE_GATTS_SYS_ATTR_FLAGS System Attribute Flags + * @{ */ +#define BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS (1 << 0) /**< Restrict system attributes to system services only. */ +#define BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS (1 << 1) /**< Restrict system attributes to user services only. */ +/** @} */ + +/** @defgroup BLE_GATTS_ATTR_TAB_SIZE Attribute Table size + * @{ + */ +#define BLE_GATTS_ATTR_TAB_SIZE_MIN 248 /**< Minimum Attribute Table size */ +#define BLE_GATTS_ATTR_TAB_SIZE_DEFAULT 0x0000 /**< Default Attribute Table size (0x580 bytes for this version of the SoftDevice). */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATTS_STRUCTURES Structures + * @{ */ + +/** + * @brief BLE GATTS initialization parameters. + */ +typedef struct +{ + uint8_t service_changed:1; /**< Include the Service Changed characteristic in the Attribute Table. */ + uint32_t attr_tab_size; /**< Attribute Table size in bytes. The size must be a multiple of 4. @ref BLE_GATTS_ATTR_TAB_SIZE_DEFAULT is used to set the default size. */ +} ble_gatts_enable_params_t; + +/**@brief Attribute metadata. */ +typedef struct +{ + ble_gap_conn_sec_mode_t read_perm; /**< Read permissions. */ + ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */ + uint8_t vlen :1; /**< Variable length attribute. */ + uint8_t vloc :2; /**< Value location, see @ref BLE_GATTS_VLOCS.*/ + uint8_t rd_auth :1; /**< Read authorization and value will be requested from the application on every read operation. */ + uint8_t wr_auth :1; /**< Write authorization will be requested from the application on every Write Request operation (but not Write Command). */ +} ble_gatts_attr_md_t; + + +/**@brief GATT Attribute. */ +typedef struct +{ + ble_uuid_t *p_uuid; /**< Pointer to the attribute UUID. */ + ble_gatts_attr_md_t *p_attr_md; /**< Pointer to the attribute metadata structure. */ + uint16_t init_len; /**< Initial attribute value length in bytes. */ + uint16_t init_offs; /**< Initial attribute value offset in bytes. If different from zero, the first init_offs bytes of the attribute value will be left uninitialized. */ + uint16_t max_len; /**< Maximum attribute value length in bytes, see @ref BLE_GATTS_ATTR_LENS_MAX for maximum values. */ + uint8_t* p_value; /**< Pointer to the attribute data. Please note that if the @ref BLE_GATTS_VLOC_USER value location is selected in the attribute metadata, this will have to point to a buffer + that remains valid through the lifetime of the attribute. This excludes usage of automatic variables that may go out of scope or any other temporary location. + The stack may access that memory directly without the application's knowledge. For writable characteristics, this value must not be a location in flash memory.*/ +} ble_gatts_attr_t; + +/**@brief GATT Attribute Value. */ +typedef struct +{ + uint16_t len; /**< Length in bytes to be written or read. Length in bytes written or read after successful return.*/ + uint16_t offset; /**< Attribute value offset. */ + uint8_t *p_value; /**< Pointer to where value is stored or will be stored. + If value is stored in user memory, only the attribute length is updated when p_value == NULL. + Set to NULL when reading to obtain the complete length of the attribute value */ +} ble_gatts_value_t; + + +/**@brief GATT Characteristic Presentation Format. */ +typedef struct +{ + uint8_t format; /**< Format of the value, see @ref BLE_GATT_CPF_FORMATS. */ + int8_t exponent; /**< Exponent for integer data types. */ + uint16_t unit; /**< Unit from Bluetooth Assigned Numbers. */ + uint8_t name_space; /**< Namespace from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */ + uint16_t desc; /**< Namespace description from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */ +} ble_gatts_char_pf_t; + + +/**@brief GATT Characteristic metadata. */ +typedef struct +{ + ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ + ble_gatt_char_ext_props_t char_ext_props; /**< Characteristic Extended Properties. */ + uint8_t *p_char_user_desc; /**< Pointer to a UTF-8 encoded string (non-NULL terminated), NULL if the descriptor is not required. */ + uint16_t char_user_desc_max_size; /**< The maximum size in bytes of the user description descriptor. */ + uint16_t char_user_desc_size; /**< The size of the user description, must be smaller or equal to char_user_desc_max_size. */ + ble_gatts_char_pf_t* p_char_pf; /**< Pointer to a presentation format structure or NULL if the CPF descriptor is not required. */ + ble_gatts_attr_md_t* p_user_desc_md; /**< Attribute metadata for the User Description descriptor, or NULL for default values. */ + ble_gatts_attr_md_t* p_cccd_md; /**< Attribute metadata for the Client Characteristic Configuration Descriptor, or NULL for default values. */ + ble_gatts_attr_md_t* p_sccd_md; /**< Attribute metadata for the Server Characteristic Configuration Descriptor, or NULL for default values. */ +} ble_gatts_char_md_t; + + +/**@brief GATT Characteristic Definition Handles. */ +typedef struct +{ + uint16_t value_handle; /**< Handle to the characteristic value. */ + uint16_t user_desc_handle; /**< Handle to the User Description descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ + uint16_t cccd_handle; /**< Handle to the Client Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ + uint16_t sccd_handle; /**< Handle to the Server Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ +} ble_gatts_char_handles_t; + + +/**@brief GATT HVx parameters. */ +typedef struct +{ + uint16_t handle; /**< Characteristic Value Handle. */ + uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ + uint16_t offset; /**< Offset within the attribute value. */ + uint16_t *p_len; /**< Length in bytes to be written, length in bytes written after successful return. */ + uint8_t *p_data; /**< Actual data content, use NULL to use the current attribute value. */ +} ble_gatts_hvx_params_t; + +/**@brief GATT Authorization parameters. */ +typedef struct +{ + uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ + uint8_t update : 1; /**< If set, data supplied in p_data will be used to update the attribute value. + Please note that for @ref BLE_GATTS_AUTHORIZE_TYPE_WRITE operations this bit must always be set, + as the data to be written needs to be stored and later provided by the application. */ + uint16_t offset; /**< Offset of the attribute value being updated. */ + uint16_t len; /**< Length in bytes of the value in p_data pointer, see @ref BLE_GATTS_ATTR_LENS_MAX. */ + const uint8_t *p_data; /**< Pointer to new value used to update the attribute value. */ +} ble_gatts_authorize_params_t; + +/**@brief GATT Read or Write Authorize Reply parameters. */ +typedef struct +{ + uint8_t type; /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */ + union { + ble_gatts_authorize_params_t read; /**< Read authorization parameters. */ + ble_gatts_authorize_params_t write; /**< Write authorization parameters. */ + } params; /**< Reply Parameters. */ +} ble_gatts_rw_authorize_reply_params_t; + + + +/**@brief Event structure for @ref BLE_GATTS_EVT_WRITE. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + ble_uuid_t uuid; /**< Attribute UUID. */ + uint8_t op; /**< Type of write operation, see @ref BLE_GATTS_OPS. */ + uint8_t auth_required; /**< Writing operation deferred due to authorization requirement. Application may use @ref sd_ble_gatts_value_set to finalise the writing operation. */ + uint16_t offset; /**< Offset for the write operation. */ + uint16_t len; /**< Length of the received data. */ + uint8_t data[1]; /**< Received data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_gatts_evt_write_t; + +/**@brief Event substructure for authorized read requests, see @ref ble_gatts_evt_rw_authorize_request_t. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + ble_uuid_t uuid; /**< Attribute UUID. */ + uint16_t offset; /**< Offset for the read operation. */ +} ble_gatts_evt_read_t; + +/**@brief Event structure for @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST. */ +typedef struct +{ + uint8_t type; /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */ + union { + ble_gatts_evt_read_t read; /**< Attribute Read Parameters. */ + ble_gatts_evt_write_t write; /**< Attribute Write Parameters. */ + } request; /**< Request Parameters. */ +} ble_gatts_evt_rw_authorize_request_t; + +/**@brief Event structure for @ref BLE_GATTS_EVT_SYS_ATTR_MISSING. */ +typedef struct +{ + uint8_t hint; /**< Hint (currently unused). */ +} ble_gatts_evt_sys_attr_missing_t; + + +/**@brief Event structure for @ref BLE_GATTS_EVT_HVC. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ +} ble_gatts_evt_hvc_t; + +/**@brief Event structure for @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST. */ +typedef struct +{ + uint16_t client_rx_mtu; /**< Client RX MTU size. */ +} ble_gatts_evt_exchange_mtu_request_t; + +/**@brief Event structure for @ref BLE_GATTS_EVT_TIMEOUT. */ +typedef struct +{ + uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ +} ble_gatts_evt_timeout_t; + + +/**@brief GATTS event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which the event occurred. */ + union + { + ble_gatts_evt_write_t write; /**< Write Event Parameters. */ + ble_gatts_evt_rw_authorize_request_t authorize_request; /**< Read or Write Authorize Request Parameters. */ + ble_gatts_evt_sys_attr_missing_t sys_attr_missing; /**< System attributes missing. */ + ble_gatts_evt_hvc_t hvc; /**< Handle Value Confirmation Event Parameters. */ + ble_gatts_evt_exchange_mtu_request_t exchange_mtu_request; /**< Exchange MTU Request Event Parameters. */ + ble_gatts_evt_timeout_t timeout; /**< Timeout Event. */ + } params; /**< Event Parameters. */ +} ble_gatts_evt_t; + +/** @} */ + +/** @addtogroup BLE_GATTS_FUNCTIONS Functions + * @{ */ + +/**@brief Add a service declaration to the Attribute Table. + * + * @note Secondary Services are only relevant in the context of the entity that references them, it is therefore forbidden to + * add a secondary service declaration that is not referenced by another service later in the Attribute Table. + * + * @mscs + * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} + * @endmscs + * + * @param[in] type Toggles between primary and secondary services, see @ref BLE_GATTS_SRVC_TYPES. + * @param[in] p_uuid Pointer to service UUID. + * @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval ::NRF_SUCCESS Successfully added a service declaration. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, Vendor Specific UUIDs need to be present in the table. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + */ +SVCALL(SD_BLE_GATTS_SERVICE_ADD, uint32_t, sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, uint16_t *p_handle)); + + +/**@brief Add an include declaration to the Attribute Table. + * + * @note It is currently only possible to add an include declaration to the last added service (i.e. only sequential population is supported at this time). + * + * @note The included service must already be present in the Attribute Table prior to this call. + * + * @mscs + * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} + * @endmscs + * + * @param[in] service_handle Handle of the service where the included service is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. + * @param[in] inc_srvc_handle Handle of the included service. + * @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval ::NRF_SUCCESS Successfully added an include declaration. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, handle values need to match previously added services. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::NRF_ERROR_NOT_SUPPORTED Feature is not supported, service_handle must be that of the last added service. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, self inclusions are not allowed. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + */ +SVCALL(SD_BLE_GATTS_INCLUDE_ADD, uint32_t, sd_ble_gatts_include_add(uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *p_include_handle)); + + +/**@brief Add a characteristic declaration, a characteristic value declaration and optional characteristic descriptor declarations to the Attribute Table. + * + * @note It is currently only possible to add a characteristic to the last added service (i.e. only sequential population is supported at this time). + * + * @note Several restrictions apply to the parameters, such as matching permissions between the user description descriptor and the writeable auxiliaries bits, + * readable (no security) and writeable (selectable) CCCDs and SCCDs and valid presentation format values. + * + * @note If no metadata is provided for the optional descriptors, their permissions will be derived from the characteristic permissions. + * + * @mscs + * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} + * @endmscs + * + * @param[in] service_handle Handle of the service where the characteristic is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. + * @param[in] p_char_md Characteristic metadata. + * @param[in] p_attr_char_value Pointer to the attribute structure corresponding to the characteristic value. + * @param[out] p_handles Pointer to the structure where the assigned handles will be stored. + * + * @retval ::NRF_SUCCESS Successfully added a characteristic. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, service handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a service context is required. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. + */ +SVCALL(SD_BLE_GATTS_CHARACTERISTIC_ADD, uint32_t, sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_t const *p_char_md, ble_gatts_attr_t const *p_attr_char_value, ble_gatts_char_handles_t *p_handles)); + + +/**@brief Add a descriptor to the Attribute Table. + * + * @note It is currently only possible to add a descriptor to the last added characteristic (i.e. only sequential population is supported at this time). + * + * @mscs + * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} + * @endmscs + * + * @param[in] char_handle Handle of the characteristic where the descriptor is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. + * @param[in] p_attr Pointer to the attribute structure. + * @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval ::NRF_SUCCESS Successfully added a descriptor. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, characteristic handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a characteristic context is required. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. + */ +SVCALL(SD_BLE_GATTS_DESCRIPTOR_ADD, uint32_t, sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_t const *p_attr, uint16_t *p_handle)); + +/**@brief Set the value of a given attribute. + * + * @note Values other than system attributes can be set at any time, regardless of wheter any active connections exist. + * + * @mscs + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. Ignored if the value does not belong to a system attribute. + * @param[in] handle Attribute handle. + * @param[in,out] p_value Attribute value information. + * + * @retval ::NRF_SUCCESS Successfully set the value of the attribute. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + * @retval ::NRF_ERROR_FORBIDDEN Forbidden handle supplied, certain attributes are not modifiable by the application. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied on a system attribute. + */ +SVCALL(SD_BLE_GATTS_VALUE_SET, uint32_t, sd_ble_gatts_value_set(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)); + +/**@brief Get the value of a given attribute. + * + * @note If the attribute value is longer than the size of the supplied buffer, + * p_len will return the total attribute value length (excluding offset), + * and not the number of bytes actually returned in p_data. + * The application may use this information to allocate a suitable buffer size. + * + * @note When retrieving system attribute values with this function, the connection handle + * may refer to an already disconnected connection. Refer to the documentation of + * @ref sd_ble_gatts_sys_attr_get for further information. + * + * @param[in] conn_handle Connection handle. Ignored if the value does not belong to a system attribute. + * @param[in] handle Attribute handle. + * @param[in,out] p_value Attribute value information. + * + * @retval ::NRF_SUCCESS Successfully retrieved the value of the attribute. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid attribute offset supplied. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied on a system attribute. + * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. + */ +SVCALL(SD_BLE_GATTS_VALUE_GET, uint32_t, sd_ble_gatts_value_get(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)); + +/**@brief Notify or Indicate an attribute value. + * + * @details This function checks for the relevant Client Characteristic Configuration descriptor value to verify that the relevant operation + * (notification or indication) has been enabled by the client. It is also able to update the attribute value before issuing the PDU, so that + * the application can atomically perform a value update and a server initiated transaction with a single API call. + * If the application chooses to indicate an attribute value, a @ref BLE_GATTS_EVT_HVC event will be issued as soon as the confirmation arrives from + * the peer. + * + * @note The local attribute value may be updated even if an outgoing packet is not sent to the peer due to an error during execution. + * The Attribute Table has been updated if one of the following error codes is returned: @ref NRF_ERROR_INVALID_STATE, @ref NRF_ERROR_BUSY, + * @ref NRF_ERROR_FORBIDDEN, @ref BLE_ERROR_GATTS_SYS_ATTR_MISSING and @ref BLE_ERROR_NO_TX_PACKETS. + * The caller can check whether the value has been updated by looking at the contents of *(p_hvx_params->p_len). + * + * @note It is important to note that a notification will consume an application buffer, and will therefore + * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. An indication on the other hand will use the + * standard server internal buffer and thus will only generate a @ref BLE_GATTS_EVT_HVC event as soon as the confirmation + * has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. + * + * @events + * @event{@ref BLE_EVT_TX_COMPLETE, Transmission complete.} + * @event{@ref BLE_GATTS_EVT_HVC, Confirmation received from peer.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC} + * @mmsc{@ref BLE_GATTS_HVN_MSC} + * @mmsc{@ref BLE_GATTS_HVI_MSC} + * @mmsc{@ref BLE_GATTS_HVX_DISABLED_MSC} + * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_hvx_params Pointer to an HVx parameters structure. If the p_data member contains a non-NULL pointer the attribute value will be updated with + * the contents pointed by it before sending the notification or indication. + * + * @retval ::NRF_SUCCESS Successfully queued a notification or indication for transmission, and optionally updated the attribute value. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE One or more of the following is true: + * - Invalid Connection State + * - Notifications and/or indications not enabled in the CCCD + * - An ATT_MTU exchange is ongoing + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied. Only attributes added directly by the application are available to notify and indicate. + * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE Invalid attribute type(s) supplied, only characteristic values may be notified and indicated. + * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. + * @retval ::NRF_ERROR_FORBIDDEN The connection's current security level is lower than the one required by the write permissions of the CCCD associated with this characteristic. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. + * @retval ::NRF_ERROR_BUSY Procedure already in progress. + * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. + * @retval ::BLE_ERROR_NO_TX_PACKETS No available application packets for this connection, applies only to notifications. + */ +SVCALL(SD_BLE_GATTS_HVX, uint32_t, sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const *p_hvx_params)); + +/**@brief Indicate the Service Changed attribute value. + * + * @details This call will send a Handle Value Indication to one or more peers connected to inform them that the Attribute + * Table layout has changed. As soon as the peer has confirmed the indication, a @ref BLE_GATTS_EVT_SC_CONFIRM event will + * be issued. + * + * @note Some of the restrictions and limitations that apply to @ref sd_ble_gatts_hvx also apply here. + * + * @events + * @event{@ref BLE_GATTS_EVT_SC_CONFIRM, Confirmation of attribute table change received from peer.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTS_SC_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] start_handle Start of affected attribute handle range. + * @param[in] end_handle End of affected attribute handle range. + * + * @retval ::NRF_SUCCESS Successfully queued the Service Changed indication for transmission. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_NOT_SUPPORTED Service Changed not enabled at initialization. See @ref sd_ble_enable and @ref ble_gatts_enable_params_t. + * @retval ::NRF_ERROR_INVALID_STATE One or more of the following is true: + * - Invalid Connection State + * - Notifications and/or indications not enabled in the CCCD + * - An ATT_MTU exchange is ongoing + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied, handles must be in the range populated by the application. + * @retval ::NRF_ERROR_BUSY Procedure already in progress. + * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. + */ +SVCALL(SD_BLE_GATTS_SERVICE_CHANGED, uint32_t, sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle)); + +/**@brief Respond to a Read/Write authorization request. + * + * @note This call should only be used as a response to a @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event issued to the application. + * + * @mscs + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} + * @mmsc{@ref BLE_GATTS_READ_REQ_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_WRITE_REQ_AUTH_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} + * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_PEER_CANCEL_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_rw_authorize_reply_params Pointer to a structure with the attribute provided by the application. + * + * @note @ref ble_gatts_authorize_params_t::p_data is ignored when this function is used to respond + * to a @ref BLE_GATTS_AUTHORIZE_TYPE_READ event if @ref ble_gatts_authorize_params_t::update + * is set to 0. + * + * @retval ::NRF_SUCCESS Successfully queued a response to the peer, and in the case of a write operation, Attribute Table updated. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no authorization request pending. + * @retval ::NRF_ERROR_INVALID_PARAM Authorization op invalid, + * handle supplied does not match requested handle, + * or invalid data to be written provided by the application. + * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, uint32_t, sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *p_rw_authorize_reply_params)); + + +/**@brief Update persistent system attribute information. + * + * @details Supply information about persistent system attributes to the stack, + * previously obtained using @ref sd_ble_gatts_sys_attr_get. + * This call is only allowed for active connections, and is usually + * made immediately after a connection is established with an known bonded device, + * often as a response to a @ref BLE_GATTS_EVT_SYS_ATTR_MISSING. + * + * p_sysattrs may point directly to the application's stored copy of the system attributes + * obtained using @ref sd_ble_gatts_sys_attr_get. + * If the pointer is NULL, the system attribute info is initialized, assuming that + * the application does not have any previously saved system attribute data for this device. + * + * @note The state of persistent system attributes is reset upon connection establishment and then remembered for its duration. + * + * @note If this call returns with an error code different from @ref NRF_SUCCESS, the storage of persistent system attributes may have been completed only partially. + * This means that the state of the attribute table is undefined, and the application should either provide a new set of attributes using this same call or + * reset the SoftDevice to return to a known state. + * + * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be modified. + * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be modified. + * + * @mscs + * @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC} + * @mmsc{@ref BLE_GATTS_SYS_ATTRS_UNK_PEER_MSC} + * @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle. + * @param[in] p_sys_attr_data Pointer to a saved copy of system attributes supplied to the stack, or NULL. + * @param[in] len Size of data pointed by p_sys_attr_data, in octets. + * @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS + * + * @retval ::NRF_SUCCESS Successfully set the system attribute information. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid flags supplied. + * @retval ::NRF_ERROR_INVALID_DATA Invalid data supplied, the data should be exactly the same as retrieved with @ref sd_ble_gatts_sys_attr_get. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_GATTS_SYS_ATTR_SET, uint32_t, sd_ble_gatts_sys_attr_set(uint16_t conn_handle, uint8_t const *p_sys_attr_data, uint16_t len, uint32_t flags)); + + +/**@brief Retrieve persistent system attribute information from the stack. + * + * @details This call is used to retrieve information about values to be stored perisistently by the application + * during the lifetime of a connection or after it has been terminated. When a new connection is established with the same bonded device, + * the system attribute information retrieved with this function should be restored using using @ref sd_ble_gatts_sys_attr_set. + * If retrieved after disconnection, the data should be read before a new connection established. The connection handle for + * the previous, now disconnected, connection will remain valid until a new one is created to allow this API call to refer to it. + * Connection handles belonging to active connections can be used as well, but care should be taken since the system attributes + * may be written to at any time by the peer during a connection's lifetime. + * + * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be returned. + * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be returned. + * + * @mscs + * @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC} + * @endmscs + * + * @param[in] conn_handle Connection handle of the recently terminated connection. + * @param[out] p_sys_attr_data Pointer to a buffer where updated information about system attributes will be filled in. The format of the data is described + * in @ref BLE_GATTS_SYS_ATTRS_FORMAT. NULL can be provided to obtain the length of the data. + * @param[in,out] p_len Size of application buffer if p_sys_attr_data is not NULL. Unconditially updated to actual length of system attribute data. + * @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS + * + * @retval ::NRF_SUCCESS Successfully retrieved the system attribute information. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid flags supplied. + * @retval ::NRF_ERROR_DATA_SIZE The system attribute information did not fit into the provided buffer. + * @retval ::NRF_ERROR_NOT_FOUND No system attributes found. + */ +SVCALL(SD_BLE_GATTS_SYS_ATTR_GET, uint32_t, sd_ble_gatts_sys_attr_get(uint16_t conn_handle, uint8_t *p_sys_attr_data, uint16_t *p_len, uint32_t flags)); + + +/**@brief Retrieve the first valid user attribute handle. + * + * @param[out] p_handle Pointer to an integer where the handle will be stored. + * + * @retval ::NRF_SUCCESS Successfully retrieved the handle. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, uint32_t, sd_ble_gatts_initial_user_handle_get(uint16_t *p_handle)); + +/**@brief Retrieve the attribute UUID and/or metadata. + * + * @param[in] handle Attribute handle + * @param[out] p_uuid UUID of the attribute. Use NULL to omit this field. + * @param[out] p_md Metadata of the attribute. Use NULL to omit this field. + * + * @retval ::NRF_SUCCESS Successfully retrieved the attribute metadata, + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameters supplied. Returned when both @c p_uuid and @c p_md are NULL. + * @retval ::NRF_ERROR_NOT_FOUND Attribute was not found. + */ +SVCALL(SD_BLE_GATTS_ATTR_GET, uint32_t, sd_ble_gatts_attr_get(uint16_t handle, ble_uuid_t * p_uuid, ble_gatts_attr_md_t * p_md)); + +/**@brief Reply to an ATT_MTU exchange request by sending an Exchange MTU Response to the client. + * + * @details This function is only used to reply to a @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST event. + * + * @details The SoftDevice sets ATT_MTU to the minimum of: + * - The Client RX MTU value from @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST, and + * - The Server RX MTU value. + * + * However, the SoftDevice never sets ATT_MTU lower than @ref BLE_GATT_MTU_SIZE_DEFAULT. + * + * @events + * @event{@ref BLE_EVT_DATA_LENGTH_CHANGED, Generated if a data length update procedure is performed after the ATT_MTU exchange.} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_GATTS_MTU_EXCHANGE} + * @endmscs + * + * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. + * @param[in] server_rx_mtu Server RX MTU size. + * - The minimum value is @ref BLE_GATT_MTU_SIZE_DEFAULT. + * - The maximum value is @ref ble_gatt_enable_params_t::att_mtu. + * - The value must be equal to Client RX MTU size given in @ref sd_ble_gattc_exchange_mtu_request + * if an ATT_MTU exchange has already been performed in the other direction. + * + * @retval ::NRF_SUCCESS Successfully sent response to the client. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no ATT_MTU exchange request pending. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid Server RX MTU size supplied. + * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. + */ +SVCALL(SD_BLE_GATTS_EXCHANGE_MTU_REPLY, uint32_t, sd_ble_gatts_exchange_mtu_reply(uint16_t conn_handle, uint16_t server_rx_mtu)); +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // BLE_GATTS_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_hci.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_hci.h new file mode 100644 index 0000000000..fd619b52c8 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_hci.h @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_COMMON + @{ +*/ + + +#ifndef BLE_HCI_H__ +#define BLE_HCI_H__ +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup BLE_HCI_STATUS_CODES Bluetooth status codes + * @{ */ + +#define BLE_HCI_STATUS_CODE_SUCCESS 0x00 /**< Success. */ +#define BLE_HCI_STATUS_CODE_UNKNOWN_BTLE_COMMAND 0x01 /**< Unknown BLE Command. */ +#define BLE_HCI_STATUS_CODE_UNKNOWN_CONNECTION_IDENTIFIER 0x02 /**< Unknown Connection Identifier. */ +/*0x03 Hardware Failure +0x04 Page Timeout +*/ +#define BLE_HCI_AUTHENTICATION_FAILURE 0x05 /**< Authentication Failure. */ +#define BLE_HCI_STATUS_CODE_PIN_OR_KEY_MISSING 0x06 /**< Pin or Key missing. */ +#define BLE_HCI_MEMORY_CAPACITY_EXCEEDED 0x07 /**< Memory Capacity Exceeded. */ +#define BLE_HCI_CONNECTION_TIMEOUT 0x08 /**< Connection Timeout. */ +/*0x09 Connection Limit Exceeded +0x0A Synchronous Connection Limit To A Device Exceeded +0x0B ACL Connection Already Exists*/ +#define BLE_HCI_STATUS_CODE_COMMAND_DISALLOWED 0x0C /**< Command Disallowed. */ +/*0x0D Connection Rejected due to Limited Resources +0x0E Connection Rejected Due To Security Reasons +0x0F Connection Rejected due to Unacceptable BD_ADDR +0x10 Connection Accept Timeout Exceeded +0x11 Unsupported Feature or Parameter Value*/ +#define BLE_HCI_STATUS_CODE_INVALID_BTLE_COMMAND_PARAMETERS 0x12 /**< Invalid BLE Command Parameters. */ +#define BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION 0x13 /**< Remote User Terminated Connection. */ +#define BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES 0x14 /**< Remote Device Terminated Connection due to low resources.*/ +#define BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF 0x15 /**< Remote Device Terminated Connection due to power off. */ +#define BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION 0x16 /**< Local Host Terminated Connection. */ +/* +0x17 Repeated Attempts +0x18 Pairing Not Allowed +0x19 Unknown LMP PDU +*/ +#define BLE_HCI_UNSUPPORTED_REMOTE_FEATURE 0x1A /**< Unsupported Remote Feature. */ +/* +0x1B SCO Offset Rejected +0x1C SCO Interval Rejected +0x1D SCO Air Mode Rejected*/ +#define BLE_HCI_STATUS_CODE_INVALID_LMP_PARAMETERS 0x1E /**< Invalid LMP Parameters. */ +#define BLE_HCI_STATUS_CODE_UNSPECIFIED_ERROR 0x1F /**< Unspecified Error. */ +/*0x20 Unsupported LMP Parameter Value +0x21 Role Change Not Allowed +*/ +#define BLE_HCI_STATUS_CODE_LMP_RESPONSE_TIMEOUT 0x22 /**< LMP Response Timeout. */ +#define BLE_HCI_STATUS_CODE_LMP_ERROR_TRANSACTION_COLLISION 0x23 /**< LMP Error Transaction Collision/LL Procedure Collision. */ +#define BLE_HCI_STATUS_CODE_LMP_PDU_NOT_ALLOWED 0x24 /**< LMP PDU Not Allowed. */ +/*0x25 Encryption Mode Not Acceptable +0x26 Link Key Can Not be Changed +0x27 Requested QoS Not Supported +*/ +#define BLE_HCI_INSTANT_PASSED 0x28 /**< Instant Passed. */ +#define BLE_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED 0x29 /**< Pairing with Unit Key Unsupported. */ +#define BLE_HCI_DIFFERENT_TRANSACTION_COLLISION 0x2A /**< Different Transaction Collision. */ +/* +0x2B Reserved +0x2C QoS Unacceptable Parameter +0x2D QoS Rejected +0x2E Channel Classification Not Supported +0x2F Insufficient Security +0x30 Parameter Out Of Mandatory Range +0x31 Reserved +0x32 Role Switch Pending +0x33 Reserved +0x34 Reserved Slot Violation +0x35 Role Switch Failed +0x36 Extended Inquiry Response Too Large +0x37 Secure Simple Pairing Not Supported By Host. +0x38 Host Busy - Pairing +0x39 Connection Rejected due to No Suitable Channel Found*/ +#define BLE_HCI_CONTROLLER_BUSY 0x3A /**< Controller Busy. */ +#define BLE_HCI_CONN_INTERVAL_UNACCEPTABLE 0x3B /**< Connection Interval Unacceptable. */ +#define BLE_HCI_DIRECTED_ADVERTISER_TIMEOUT 0x3C /**< Directed Adverisement Timeout. */ +#define BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE 0x3D /**< Connection Terminated due to MIC Failure. */ +#define BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED 0x3E /**< Connection Failed to be Established. */ + +/** @} */ + + +#ifdef __cplusplus +} +#endif +#endif // BLE_HCI_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_l2cap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_l2cap.h new file mode 100644 index 0000000000..eaad7e50fc --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_l2cap.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_L2CAP Logical Link Control and Adaptation Protocol (L2CAP) + @{ + @brief Definitions and prototypes for the L2CAP interface. + */ + +#ifndef BLE_L2CAP_H__ +#define BLE_L2CAP_H__ + +#include "ble_types.h" +#include "ble_ranges.h" +#include "ble_err.h" +#include "nrf_svc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@addtogroup BLE_L2CAP_ENUMERATIONS Enumerations + * @{ */ + +/**@brief L2CAP API SVC numbers. */ +enum BLE_L2CAP_SVCS +{ + SD_BLE_L2CAP_CID_REGISTER = BLE_L2CAP_SVC_BASE, /**< Register a CID. */ + SD_BLE_L2CAP_CID_UNREGISTER, /**< Unregister a CID. */ + SD_BLE_L2CAP_TX /**< Transmit a packet. */ +}; + +/**@brief L2CAP Event IDs. */ +enum BLE_L2CAP_EVTS +{ + BLE_L2CAP_EVT_RX = BLE_L2CAP_EVT_BASE /**< L2CAP packet received. */ +}; + +/** @} */ + +/**@addtogroup BLE_L2CAP_DEFINES Defines + * @{ */ + +/**@defgroup BLE_ERRORS_L2CAP SVC return values specific to L2CAP + * @{ */ +#define BLE_ERROR_L2CAP_CID_IN_USE (NRF_L2CAP_ERR_BASE + 0x000) /**< CID already in use. */ +/** @} */ + +/**@brief Default L2CAP MTU. */ +#define BLE_L2CAP_MTU_DEF (23) + +/**@brief Invalid Channel Identifier. */ +#define BLE_L2CAP_CID_INVALID (0x0000) + +/**@brief Dynamic Channel Identifier base. */ +#define BLE_L2CAP_CID_DYN_BASE (0x0040) + +/**@brief Maximum amount of dynamic CIDs. */ +#define BLE_L2CAP_CID_DYN_MAX (8) + +/** @} */ + +/**@addtogroup BLE_L2CAP_STRUCTURES Structures + * @{ */ + +/**@brief Packet header format for L2CAP transmission. */ +typedef struct +{ + uint16_t len; /**< Length of valid info in data member. */ + uint16_t cid; /**< Channel ID on which packet is transmitted. */ +} ble_l2cap_header_t; + + +/**@brief L2CAP Received packet event report. */ +typedef struct +{ + ble_l2cap_header_t header; /**< L2CAP packet header. */ + uint8_t data[1]; /**< Packet data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. + See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ +} ble_l2cap_evt_rx_t; + + +/**@brief L2CAP event callback event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which event occured. */ + union + { + ble_l2cap_evt_rx_t rx; /**< RX Event parameters. */ + } params; /**< Event Parameters. */ +} ble_l2cap_evt_t; + +/** @} */ + +/**@addtogroup BLE_L2CAP_FUNCTIONS Functions + * @{ */ + +/**@brief Register a CID with L2CAP. + * + * @details This registers a higher protocol layer with the L2CAP multiplexer, and is requried prior to all operations on the CID. + * + * @mscs + * @mmsc{@ref BLE_L2CAP_API_MSC} + * @endmscs + * + * @param[in] cid L2CAP CID. + * + * @retval ::NRF_SUCCESS Successfully registered a CID with the L2CAP layer. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CID must be above @ref BLE_L2CAP_CID_DYN_BASE. + * @retval ::BLE_ERROR_L2CAP_CID_IN_USE L2CAP CID already in use. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + */ +SVCALL(SD_BLE_L2CAP_CID_REGISTER, uint32_t, sd_ble_l2cap_cid_register(uint16_t cid)); + +/**@brief Unregister a CID with L2CAP. + * + * @details This unregisters a previously registerd higher protocol layer with the L2CAP multiplexer. + * + * @mscs + * @mmsc{@ref BLE_L2CAP_API_MSC} + * @endmscs + * + * @param[in] cid L2CAP CID. + * + * @retval ::NRF_SUCCESS Successfully unregistered the CID. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. + * @retval ::NRF_ERROR_NOT_FOUND CID not previously registered. + */ +SVCALL(SD_BLE_L2CAP_CID_UNREGISTER, uint32_t, sd_ble_l2cap_cid_unregister(uint16_t cid)); + +/**@brief Transmit an L2CAP packet. + * + * @note It is important to note that a call to this function will consume an application packet, and will therefore + * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. + * Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. + * + * @events + * @event{@ref BLE_EVT_TX_COMPLETE} + * @event{@ref BLE_L2CAP_EVT_RX} + * @endevents + * + * @mscs + * @mmsc{@ref BLE_L2CAP_API_MSC} + * @endmscs + * + * @param[in] conn_handle Connection Handle. + * @param[in] p_header Pointer to a packet header containing length and CID. + * @param[in] p_data Pointer to the data to be transmitted. + * + * @retval ::NRF_SUCCESS Successfully queued an L2CAP packet for transmission. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register. + * @retval ::NRF_ERROR_NOT_FOUND CID not found. + * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @retval ::BLE_ERROR_NO_TX_PACKETS Not enough application packets available. + * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF. + */ +SVCALL(SD_BLE_L2CAP_TX, uint32_t, sd_ble_l2cap_tx(uint16_t conn_handle, ble_l2cap_header_t const *p_header, uint8_t const *p_data)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // BLE_L2CAP_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_ranges.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_ranges.h new file mode 100644 index 0000000000..051d1438d1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_ranges.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_COMMON + @{ + @defgroup ble_ranges Module specific SVC, event and option number subranges + @{ + + @brief Definition of SVC, event and option number subranges for each API module. + + @note + SVCs, event and option numbers are split into subranges for each API module. + Each module receives its entire allocated range of SVC calls, whether implemented or not, + but return BLE_ERROR_NOT_SUPPORTED for unimplemented or undefined calls in its range. + + Note that the symbols BLE__SVC_LAST is the end of the allocated SVC range, + rather than the last SVC function call actually defined and implemented. + + Specific SVC, event and option values are defined in each module's ble_.h file, + which defines names of each individual SVC code based on the range start value. +*/ + +#ifndef BLE_RANGES_H__ +#define BLE_RANGES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define BLE_SVC_BASE 0x60 /**< Common BLE SVC base. */ +#define BLE_SVC_LAST 0x6B /**< Common BLE SVC last. */ + + +#define BLE_GAP_SVC_BASE 0x6C /**< GAP BLE SVC base. */ +#define BLE_GAP_SVC_LAST 0x93 /**< GAP BLE SVC last. */ + + +#define BLE_GATTC_SVC_BASE 0x94 /**< GATTC BLE SVC base. */ +#define BLE_GATTC_SVC_LAST 0x9F /**< GATTC BLE SVC last. */ + + +#define BLE_GATTS_SVC_BASE 0xA0 /**< GATTS BLE SVC base. */ +#define BLE_GATTS_SVC_LAST 0xAF /**< GATTS BLE SVC last. */ + + +#define BLE_L2CAP_SVC_BASE 0xB0 /**< L2CAP BLE SVC base. */ +#define BLE_L2CAP_SVC_LAST 0xBF /**< L2CAP BLE SVC last. */ + + +#define BLE_EVT_INVALID 0x00 /**< Invalid BLE Event. */ + + +#define BLE_EVT_BASE 0x01 /**< Common BLE Event base. */ +#define BLE_EVT_LAST 0x0F /**< Common BLE Event last. */ + + +#define BLE_GAP_EVT_BASE 0x10 /**< GAP BLE Event base. */ +#define BLE_GAP_EVT_LAST 0x2F /**< GAP BLE Event last. */ + + +#define BLE_GATTC_EVT_BASE 0x30 /**< GATTC BLE Event base. */ +#define BLE_GATTC_EVT_LAST 0x4F /**< GATTC BLE Event last. */ + + +#define BLE_GATTS_EVT_BASE 0x50 /**< GATTS BLE Event base. */ +#define BLE_GATTS_EVT_LAST 0x6F /**< GATTS BLE Event last. */ + + +#define BLE_L2CAP_EVT_BASE 0x70 /**< L2CAP BLE Event base. */ +#define BLE_L2CAP_EVT_LAST 0x8F /**< L2CAP BLE Event last. */ + + +#define BLE_OPT_INVALID 0x00 /**< Invalid BLE Option. */ + + +#define BLE_OPT_BASE 0x01 /**< Common BLE Option base. */ +#define BLE_OPT_LAST 0x1F /**< Common BLE Option last. */ + + +#define BLE_GAP_OPT_BASE 0x20 /**< GAP BLE Option base. */ +#define BLE_GAP_OPT_LAST 0x3F /**< GAP BLE Option last. */ + + +#define BLE_GATTC_OPT_BASE 0x40 /**< GATTC BLE Option base. */ +#define BLE_GATTC_OPT_LAST 0x5F /**< GATTC BLE Option last. */ + + +#define BLE_GATTS_OPT_BASE 0x60 /**< GATTS BLE Option base. */ +#define BLE_GATTS_OPT_LAST 0x7F /**< GATTS BLE Option last. */ + + +#define BLE_L2CAP_OPT_BASE 0x80 /**< L2CAP BLE Option base. */ +#define BLE_L2CAP_OPT_LAST 0x9F /**< L2CAP BLE Option last. */ + + +#ifdef __cplusplus +} +#endif +#endif /* BLE_RANGES_H__ */ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_types.h new file mode 100644 index 0000000000..a85332a4c3 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_types.h @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + @addtogroup BLE_COMMON + @{ + @defgroup ble_types Common types and macro definitions + @{ + + @brief Common types and macro definitions for the BLE SoftDevice. + */ + +#ifndef BLE_TYPES_H__ +#define BLE_TYPES_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup BLE_TYPES_DEFINES Defines + * @{ */ + +/** @defgroup BLE_CONN_HANDLES BLE Connection Handles + * @{ */ +#define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */ +#define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */ +/** @} */ + + +/** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs + * @{ */ +/* Generic UUIDs, applicable to all services */ +#define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */ +#define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */ +#define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */ +#define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */ +#define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */ +#define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */ +#define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */ +#define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */ +#define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */ +#define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */ +#define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */ +/* GATT specific UUIDs */ +#define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */ +#define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */ +/* GAP specific UUIDs */ +#define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */ +#define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */ +#define BLE_UUID_GAP_CHARACTERISTIC_CAR 0x2AA6 /**< Central Address Resolution Characteristic. */ +/** @} */ + + +/** @defgroup BLE_UUID_TYPES Types of UUID + * @{ */ +#define BLE_UUID_TYPE_UNKNOWN 0x00 /**< Invalid UUID type. */ +#define BLE_UUID_TYPE_BLE 0x01 /**< Bluetooth SIG UUID (16-bit). */ +#define BLE_UUID_TYPE_VENDOR_BEGIN 0x02 /**< Vendor UUID types start at this index (128-bit). */ +/** @} */ + + +/** @defgroup BLE_APPEARANCES Bluetooth Appearance values + * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml + * @{ */ +#define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */ +#define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */ +#define BLE_APPEARANCE_GENERIC_COMPUTER 128 /**< Generic Computer. */ +#define BLE_APPEARANCE_GENERIC_WATCH 192 /**< Generic Watch. */ +#define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193 /**< Watch: Sports Watch. */ +#define BLE_APPEARANCE_GENERIC_CLOCK 256 /**< Generic Clock. */ +#define BLE_APPEARANCE_GENERIC_DISPLAY 320 /**< Generic Display. */ +#define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384 /**< Generic Remote Control. */ +#define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448 /**< Generic Eye-glasses. */ +#define BLE_APPEARANCE_GENERIC_TAG 512 /**< Generic Tag. */ +#define BLE_APPEARANCE_GENERIC_KEYRING 576 /**< Generic Keyring. */ +#define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640 /**< Generic Media Player. */ +#define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704 /**< Generic Barcode Scanner. */ +#define BLE_APPEARANCE_GENERIC_THERMOMETER 768 /**< Generic Thermometer. */ +#define BLE_APPEARANCE_THERMOMETER_EAR 769 /**< Thermometer: Ear. */ +#define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832 /**< Generic Heart rate Sensor. */ +#define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833 /**< Heart Rate Sensor: Heart Rate Belt. */ +#define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896 /**< Generic Blood Pressure. */ +#define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897 /**< Blood Pressure: Arm. */ +#define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898 /**< Blood Pressure: Wrist. */ +#define BLE_APPEARANCE_GENERIC_HID 960 /**< Human Interface Device (HID). */ +#define BLE_APPEARANCE_HID_KEYBOARD 961 /**< Keyboard (HID Subtype). */ +#define BLE_APPEARANCE_HID_MOUSE 962 /**< Mouse (HID Subtype). */ +#define BLE_APPEARANCE_HID_JOYSTICK 963 /**< Joystiq (HID Subtype). */ +#define BLE_APPEARANCE_HID_GAMEPAD 964 /**< Gamepad (HID Subtype). */ +#define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965 /**< Digitizer Tablet (HID Subtype). */ +#define BLE_APPEARANCE_HID_CARD_READER 966 /**< Card Reader (HID Subtype). */ +#define BLE_APPEARANCE_HID_DIGITAL_PEN 967 /**< Digital Pen (HID Subtype). */ +#define BLE_APPEARANCE_HID_BARCODE 968 /**< Barcode Scanner (HID Subtype). */ +#define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024 /**< Generic Glucose Meter. */ +#define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088 /**< Generic Running Walking Sensor. */ +#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089 /**< Running Walking Sensor: In-Shoe. */ +#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090 /**< Running Walking Sensor: On-Shoe. */ +#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091 /**< Running Walking Sensor: On-Hip. */ +#define BLE_APPEARANCE_GENERIC_CYCLING 1152 /**< Generic Cycling. */ +#define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153 /**< Cycling: Cycling Computer. */ +#define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154 /**< Cycling: Speed Sensor. */ +#define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155 /**< Cycling: Cadence Sensor. */ +#define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156 /**< Cycling: Power Sensor. */ +#define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157 /**< Cycling: Speed and Cadence Sensor. */ +#define BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 3136 /**< Generic Pulse Oximeter. */ +#define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137 /**< Fingertip (Pulse Oximeter subtype). */ +#define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138 /**< Wrist Worn(Pulse Oximeter subtype). */ +#define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200 /**< Generic Weight Scale. */ +#define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Activity. */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */ +/** @} */ + +/** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */ +#define BLE_UUID_BLE_ASSIGN(instance, value) do {\ + instance.type = BLE_UUID_TYPE_BLE; \ + instance.uuid = value;} while(0) + +/** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */ +#define BLE_UUID_COPY_PTR(dst, src) do {\ + (dst)->type = (src)->type; \ + (dst)->uuid = (src)->uuid;} while(0) + +/** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */ +#define BLE_UUID_COPY_INST(dst, src) do {\ + (dst).type = (src).type; \ + (dst).uuid = (src).uuid;} while(0) + +/** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ +#define BLE_UUID_EQ(p_uuid1, p_uuid2) \ + (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid)) + +/** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ +#define BLE_UUID_NEQ(p_uuid1, p_uuid2) \ + (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid)) + +/** @} */ + +/** @addtogroup BLE_TYPES_STRUCTURES Structures + * @{ */ + +/** @brief 128 bit UUID values. */ +typedef struct +{ + uint8_t uuid128[16]; /**< Little-Endian UUID bytes. */ +} ble_uuid128_t; + +/** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */ +typedef struct +{ + uint16_t uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */ + uint8_t type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is @ref BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */ +} ble_uuid_t; + +/** @} */ +#ifdef __cplusplus +} +#endif + +#endif /* BLE_TYPES_H__ */ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf52/nrf_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf52/nrf_mbr.h new file mode 100644 index 0000000000..124e91692d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf52/nrf_mbr.h @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/** + @defgroup nrf_mbr_api Master Boot Record API + @{ + + @brief APIs for updating SoftDevice and BootLoader + +*/ + +/* Header guard */ +#ifndef NRF_MBR_H__ +#define NRF_MBR_H__ + +#include "nrf_svc.h" +#include + +#ifndef NRF52840_XXAA +#error "This header file shall only be included for nRF52 projects" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup NRF_MBR_DEFINES Defines + * @{ */ + +/**@brief MBR SVC Base number. */ +#define MBR_SVC_BASE (0x18) + +/**@brief Page size in words. */ +#define MBR_PAGE_SIZE_IN_WORDS (1024) + +/** @brief The size that must be reserved for the MBR when a softdevice is written to flash. +This is the offset where the first byte of the softdevice hex file is written.*/ +#define MBR_SIZE (0x1000) + +/** @} */ + +/** @addtogroup NRF_MBR_ENUMS Enumerations + * @{ */ + +/**@brief nRF Master Boot Record API SVC numbers. */ +enum NRF_MBR_SVCS +{ + SD_MBR_COMMAND = MBR_SVC_BASE, /**< ::sd_mbr_command */ +}; + +/**@brief Possible values for ::sd_mbr_command_t.command */ +enum NRF_MBR_COMMANDS +{ + SD_MBR_COMMAND_COPY_BL, /**< Copy a new BootLoader. @see sd_mbr_command_copy_bl_t */ + SD_MBR_COMMAND_COPY_SD, /**< Copy a new SoftDevice. @see ::sd_mbr_command_copy_sd_t*/ + SD_MBR_COMMAND_INIT_SD, /**< Init forwarding interrupts to SD, and run reset function in SD*/ + SD_MBR_COMMAND_COMPARE, /**< This command works like memcmp. @see ::sd_mbr_command_compare_t*/ + SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, /**< Start forwarding all exception to this address @see ::sd_mbr_command_vector_table_base_set_t*/ +}; + +/** @} */ + +/** @addtogroup NRF_MBR_TYPES Types + * @{ */ + +/**@brief This command copies part of a new SoftDevice + * The destination area is erased before copying. + * If dst is in the middle of a flash page, that whole flash page will be erased. + * If (dst+len) is in the middle of a flash page, that whole flash page will be erased. + * + * The user of this function is responsible for setting the BPROT registers. + * + * @retval ::NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly. + * @retval ::NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. + */ +typedef struct +{ + uint32_t *src; /**< Pointer to the source of data to be copied.*/ + uint32_t *dst; /**< Pointer to the destination where the content is to be copied.*/ + uint32_t len; /**< Number of 32 bit words to copy. Must be a multiple of @ref MBR_PAGE_SIZE_IN_WORDS words.*/ +} sd_mbr_command_copy_sd_t; + + +/**@brief This command works like memcmp, but takes the length in words. + * + * @retval ::NRF_SUCCESS indicates that the contents of both memory blocks are equal. + * @retval ::NRF_ERROR_NULL indicates that the contents of the memory blocks are not equal. + */ +typedef struct +{ + uint32_t *ptr1; /**< Pointer to block of memory. */ + uint32_t *ptr2; /**< Pointer to block of memory. */ + uint32_t len; /**< Number of 32 bit words to compare.*/ +} sd_mbr_command_compare_t; + + +/**@brief This command copies a new BootLoader. + * With this command, destination of BootLoader is always the address written in NRF_UICR->BOOTADDR. + * + * Destination is erased by this function. + * If (destination+bl_len) is in the middle of a flash page, that whole flash page will be erased. + * + * This function will use PROTENSET to protect the flash that is not intended to be written. + * + * On Success, this function will not return. It will start the new BootLoader from reset-vector as normal. + * + * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. + * @retval ::NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. + * @retval ::NRF_ERROR_INVALID_LENGTH if parameters attempts to read or write outside flash area. + * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) + */ +typedef struct +{ + uint32_t *bl_src; /**< Pointer to the source of the Bootloader to be be copied.*/ + uint32_t bl_len; /**< Number of 32 bit words to copy for BootLoader. */ +} sd_mbr_command_copy_bl_t; + +/**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the MBR + * + * Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset. + * + * To restore default forwarding this function should be called with @param address set to 0. + * The MBR will then start forwarding to interrupts to the address in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. + * + * On Success, this function will not return. It will reset the device. + * + * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. + * @retval ::NRF_ERROR_INVALID_ADDR if parameter address is outside of the flash size. + * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) + */ +typedef struct +{ + uint32_t address; /**< The base address of the interrupt vector table for forwarded interrupts.*/ +} sd_mbr_command_vector_table_base_set_t; + + +typedef struct +{ + uint32_t command; /**< type of command to be issued see @ref NRF_MBR_COMMANDS. */ + union + { + sd_mbr_command_copy_sd_t copy_sd; /**< Parameters for copy SoftDevice.*/ + sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ + sd_mbr_command_copy_bl_t copy_bl; /**< Parameters for copy BootLoader. Requires parameter page. */ + sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set. Requires parameter page.*/ + } params; +} sd_mbr_command_t; + +/** @} */ + +/** @addtogroup NRF_MBR_FUNCTIONS Functions + * @{ */ + +/**@brief Issue Master Boot Record commands + * + * Commands used when updating a SoftDevice and bootloader. + * + * The SD_MBR_COMMAND_COPY_BL and SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET requires parameters to be + * retained by the MBR when resetting the IC. This is done in a separate flash page + * provided by the application. The uicr register UICR.NRFFW[1] must be set + * to an address corresponding to a page in the application flash space. This page will be cleared + * by the MBR and used to store the command before reset. When the UICR.NRFFW[1] field is set + * the page it refers to must not be used by the application. If the UICR.NRFFW[1] is set to + * 0xFFFFFFFF (the default) MBR commands which use flash will be unavailable and return + * NRF_ERROR_NO_MEM. + * + * @param[in] param Pointer to a struct describing the command. + * + * @note for retvals see ::sd_mbr_command_copy_sd_t ::sd_mbr_command_copy_bl_t ::sd_mbr_command_compare_t ::sd_mbr_command_vector_table_base_set_t + * + * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). + * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. +*/ +SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_MBR_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error.h new file mode 100644 index 0000000000..26486f93c0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + /** + @defgroup nrf_error SoftDevice Global Error Codes + @{ + + @brief Global Error definitions +*/ + +/* Header guard */ +#ifndef NRF_ERROR_H__ +#define NRF_ERROR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup NRF_ERRORS_BASE Error Codes Base number definitions + * @{ */ +#define NRF_ERROR_BASE_NUM (0x0) ///< Global error base +#define NRF_ERROR_SDM_BASE_NUM (0x1000) ///< SDM error base +#define NRF_ERROR_SOC_BASE_NUM (0x2000) ///< SoC error base +#define NRF_ERROR_STK_BASE_NUM (0x3000) ///< STK error base +/** @} */ + +#define NRF_SUCCESS (NRF_ERROR_BASE_NUM + 0) ///< Successful command +#define NRF_ERROR_SVC_HANDLER_MISSING (NRF_ERROR_BASE_NUM + 1) ///< SVC handler is missing +#define NRF_ERROR_SOFTDEVICE_NOT_ENABLED (NRF_ERROR_BASE_NUM + 2) ///< SoftDevice has not been enabled +#define NRF_ERROR_INTERNAL (NRF_ERROR_BASE_NUM + 3) ///< Internal Error +#define NRF_ERROR_NO_MEM (NRF_ERROR_BASE_NUM + 4) ///< No Memory for operation +#define NRF_ERROR_NOT_FOUND (NRF_ERROR_BASE_NUM + 5) ///< Not found +#define NRF_ERROR_NOT_SUPPORTED (NRF_ERROR_BASE_NUM + 6) ///< Not supported +#define NRF_ERROR_INVALID_PARAM (NRF_ERROR_BASE_NUM + 7) ///< Invalid Parameter +#define NRF_ERROR_INVALID_STATE (NRF_ERROR_BASE_NUM + 8) ///< Invalid state, operation disallowed in this state +#define NRF_ERROR_INVALID_LENGTH (NRF_ERROR_BASE_NUM + 9) ///< Invalid Length +#define NRF_ERROR_INVALID_FLAGS (NRF_ERROR_BASE_NUM + 10) ///< Invalid Flags +#define NRF_ERROR_INVALID_DATA (NRF_ERROR_BASE_NUM + 11) ///< Invalid Data +#define NRF_ERROR_DATA_SIZE (NRF_ERROR_BASE_NUM + 12) ///< Invalid Data size +#define NRF_ERROR_TIMEOUT (NRF_ERROR_BASE_NUM + 13) ///< Operation timed out +#define NRF_ERROR_NULL (NRF_ERROR_BASE_NUM + 14) ///< Null Pointer +#define NRF_ERROR_FORBIDDEN (NRF_ERROR_BASE_NUM + 15) ///< Forbidden Operation +#define NRF_ERROR_INVALID_ADDR (NRF_ERROR_BASE_NUM + 16) ///< Bad Memory Address +#define NRF_ERROR_BUSY (NRF_ERROR_BASE_NUM + 17) ///< Busy +#define NRF_ERROR_CONN_COUNT (NRF_ERROR_BASE_NUM + 18) ///< Maximum connection count exceeded. +#define NRF_ERROR_RESOURCES (NRF_ERROR_BASE_NUM + 19) ///< Not enough resources for operation + +#ifdef __cplusplus +} +#endif +#endif // NRF_ERROR_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_sdm.h similarity index 69% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/common.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_sdm.h index acd5a9c5df..fc4728ddf5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/common.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_sdm.h @@ -1,5 +1,5 @@ - /* - * Copyright (c) 2009 Nordic Semiconductor ASA +/* + * Copyright (c) 2000 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,31 +35,35 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + /** + @addtogroup nrf_sdm_api + @{ + @defgroup nrf_sdm_error SoftDevice Manager Error Codes + @{ + @brief Error definitions for the SDM API +*/ -#ifndef COMMON_H -#define COMMON_H +/* Header guard */ +#ifndef NRF_ERROR_SDM_H__ +#define NRF_ERROR_SDM_H__ -/*lint ++flb "Enter library region" */ +#include "nrf_error.h" -#include -#include - -/* @file -* @brief Common header file for generic macros and definitions - * - */ - -/* - * GPIO glue macros, this can be used to define a pin number in source/header file and use that macro for pin - * configuration using this expansion. - * example: - * #define RESET_PIN 8 - * NRF_GPIO->PINCNF(RESET_PIN) = XXX ; // Expanded NRF_GPIO->PIN_CNF[8] = XXX - */ -#define PINX_GLUE(x, y, z) x##y##_##z /*!< first level glue for pin macros */ -#define PINCNF(p) PINX_GLUE(PIN,p,CNF) /*!< gpio configure pin number 'p' */ -#define PINOUT(p) PINX_GLUE(PIN,p,OUT) /*!< gpio out pin number 'p' */ - -/*lint --flb "Leave library region" */ +#ifdef __cplusplus +extern "C" { #endif + +#define NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN (NRF_ERROR_SDM_BASE_NUM + 0) ///< Unknown lfclk source. +#define NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION (NRF_ERROR_SDM_BASE_NUM + 1) ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts). +#define NRF_ERROR_SDM_INCORRECT_CLENR0 (NRF_ERROR_SDM_BASE_NUM + 2) ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing). + +#ifdef __cplusplus +} +#endif +#endif // NRF_ERROR_SDM_H__ + +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_soc.h new file mode 100644 index 0000000000..e1c5f272aa --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_soc.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/** + @addtogroup nrf_soc_api + @{ + @defgroup nrf_soc_error SoC Library Error Codes + @{ + + @brief Error definitions for the SoC library + +*/ + +/* Header guard */ +#ifndef NRF_ERROR_SOC_H__ +#define NRF_ERROR_SOC_H__ + +#include "nrf_error.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* Mutex Errors */ +#define NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN (NRF_ERROR_SOC_BASE_NUM + 0) ///< Mutex already taken + +/* NVIC errors */ +#define NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE (NRF_ERROR_SOC_BASE_NUM + 1) ///< NVIC interrupt not available +#define NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED (NRF_ERROR_SOC_BASE_NUM + 2) ///< NVIC interrupt priority not allowed +#define NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN (NRF_ERROR_SOC_BASE_NUM + 3) ///< NVIC should not return + +/* Power errors */ +#define NRF_ERROR_SOC_POWER_MODE_UNKNOWN (NRF_ERROR_SOC_BASE_NUM + 4) ///< Power mode unknown +#define NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN (NRF_ERROR_SOC_BASE_NUM + 5) ///< Power POF threshold unknown +#define NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN (NRF_ERROR_SOC_BASE_NUM + 6) ///< Power off should not return + +/* Rand errors */ +#define NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES (NRF_ERROR_SOC_BASE_NUM + 7) ///< RAND not enough values + +/* PPI errors */ +#define NRF_ERROR_SOC_PPI_INVALID_CHANNEL (NRF_ERROR_SOC_BASE_NUM + 8) ///< Invalid PPI Channel +#define NRF_ERROR_SOC_PPI_INVALID_GROUP (NRF_ERROR_SOC_BASE_NUM + 9) ///< Invalid PPI Group + +#ifdef __cplusplus +} +#endif +#endif // NRF_ERROR_SOC_H__ +/** + @} + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_mbr.h new file mode 100644 index 0000000000..db75b1d2c9 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_mbr.h @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/** + @defgroup nrf_mbr_api Master Boot Record API + @{ + + @brief APIs for updating SoftDevice and BootLoader + +*/ + +/* Header guard */ +#ifndef NRF_MBR_H__ +#define NRF_MBR_H__ + +#include "nrf_svc.h" +#include + +#ifndef NRF52840_XXAA +#error "This header file shall only be included for nRF52 projects" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup NRF_MBR_DEFINES Defines + * @{ */ + +/**@brief MBR SVC Base number. */ +#define MBR_SVC_BASE (0x18) + +/**@brief Page size in words. */ +#define MBR_PAGE_SIZE_IN_WORDS (1024) + +/** @brief The size that must be reserved for the MBR when a softdevice is written to flash. +This is the offset where the first byte of the softdevice hex file is written.*/ +#define MBR_SIZE (0x1000) + +/** @} */ + +/** @addtogroup NRF_MBR_ENUMS Enumerations + * @{ */ + +/**@brief nRF Master Boot Record API SVC numbers. */ +enum NRF_MBR_SVCS +{ + SD_MBR_COMMAND = MBR_SVC_BASE, /**< ::sd_mbr_command */ +}; + +/**@brief Possible values for ::sd_mbr_command_t.command */ +enum NRF_MBR_COMMANDS +{ + SD_MBR_COMMAND_COPY_BL, /**< Copy a new BootLoader. @see sd_mbr_command_copy_bl_t */ + SD_MBR_COMMAND_COPY_SD, /**< Copy a new SoftDevice. @see ::sd_mbr_command_copy_sd_t*/ + SD_MBR_COMMAND_INIT_SD, /**< Init forwarding interrupts to SD, and run reset function in SD*/ + SD_MBR_COMMAND_COMPARE, /**< This command works like memcmp. @see ::sd_mbr_command_compare_t*/ + SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, /**< Start forwarding all exception to this address @see ::sd_mbr_command_vector_table_base_set_t*/ +}; + +/** @} */ + +/** @addtogroup NRF_MBR_TYPES Types + * @{ */ + +/**@brief This command copies part of a new SoftDevice + * The destination area is erased before copying. + * If dst is in the middle of a flash page, that whole flash page will be erased. + * If (dst+len) is in the middle of a flash page, that whole flash page will be erased. + * + * The user of this function is responsible for setting the BPROT registers. + * + * @retval ::NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly. + * @retval ::NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. + */ +typedef struct +{ + uint32_t *src; /**< Pointer to the source of data to be copied.*/ + uint32_t *dst; /**< Pointer to the destination where the content is to be copied.*/ + uint32_t len; /**< Number of 32 bit words to copy. Must be a multiple of @ref MBR_PAGE_SIZE_IN_WORDS words.*/ +} sd_mbr_command_copy_sd_t; + + +/**@brief This command works like memcmp, but takes the length in words. + * + * @retval ::NRF_SUCCESS indicates that the contents of both memory blocks are equal. + * @retval ::NRF_ERROR_NULL indicates that the contents of the memory blocks are not equal. + */ +typedef struct +{ + uint32_t *ptr1; /**< Pointer to block of memory. */ + uint32_t *ptr2; /**< Pointer to block of memory. */ + uint32_t len; /**< Number of 32 bit words to compare.*/ +} sd_mbr_command_compare_t; + + +/**@brief This command copies a new BootLoader. + * With this command, destination of BootLoader is always the address written in NRF_UICR->BOOTADDR. + * + * Destination is erased by this function. + * If (destination+bl_len) is in the middle of a flash page, that whole flash page will be erased. + * + * This function will use PROTENSET to protect the flash that is not intended to be written. + * + * On Success, this function will not return. It will start the new BootLoader from reset-vector as normal. + * + * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. + * @retval ::NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. + * @retval ::NRF_ERROR_INVALID_LENGTH if parameters attempts to read or write outside flash area. + * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) + */ +typedef struct +{ + uint32_t *bl_src; /**< Pointer to the source of the Bootloader to be be copied.*/ + uint32_t bl_len; /**< Number of 32 bit words to copy for BootLoader. */ +} sd_mbr_command_copy_bl_t; + +/**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the MBR + * + * Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset. + * + * To restore default forwarding this function should be called with @param address set to 0. + * The MBR will then start forwarding to interrupts to the address in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. + * + * On Success, this function will not return. It will reset the device. + * + * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. + * @retval ::NRF_ERROR_INVALID_ADDR if parameter address is outside of the flash size. + * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) + */ +typedef struct +{ + uint32_t address; /**< The base address of the interrupt vector table for forwarded interrupts.*/ +} sd_mbr_command_vector_table_base_set_t; + + +typedef struct +{ + uint32_t command; /**< type of command to be issued see @ref NRF_MBR_COMMANDS. */ + union + { + sd_mbr_command_copy_sd_t copy_sd; /**< Parameters for copy SoftDevice.*/ + sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ + sd_mbr_command_copy_bl_t copy_bl; /**< Parameters for copy BootLoader. Requires parameter page. */ + sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set. Requires parameter page.*/ + } params; +} sd_mbr_command_t; + +/** @} */ + +/** @addtogroup NRF_MBR_FUNCTIONS Functions + * @{ */ + +/**@brief Issue Master Boot Record commands + * + * Commands used when updating a SoftDevice and bootloader. + * + * The SD_MBR_COMMAND_COPY_BL and SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET requires parameters to be + * retained by the MBR when resetting the IC. This is done in a separate flash page + * provided by the application. The uicr register UICR.NRFFW[1] must be set + * to an address corresponding to a page in the application flash space. This page will be cleared + * by the MBR and used to store the command before reset. When the UICR.NRFFW[1] field is set + * the page it refers to must not be used by the application. If the UICR.NRFFW[1] is set to + * 0xFFFFFFFF (the default) MBR commands which use flash will be unavailable and return + * NRF_ERROR_NO_MEM. + * + * @param[in] param Pointer to a struct describing the command. + * + * @note for retvals see ::sd_mbr_command_copy_sd_t ::sd_mbr_command_copy_bl_t ::sd_mbr_command_compare_t ::sd_mbr_command_vector_table_base_set_t + * + * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). + * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. +*/ +SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_MBR_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_nvic.h new file mode 100644 index 0000000000..4bff603fe8 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_nvic.h @@ -0,0 +1,521 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/** + * @defgroup nrf_nvic_api SoftDevice NVIC API + * @{ + * + * @note In order to use this module, the following code has to be added to a .c file: + * \code + * nrf_nvic_state_t nrf_nvic_state = {0}; + * \endcode + * + * @note Definitions and declarations starting with __ (double underscore) in this header file are + * not intended for direct use by the application. + * + * @brief APIs for the accessing NVIC when using a SoftDevice. + * + */ + +#ifndef NRF_NVIC_H__ +#define NRF_NVIC_H__ + +#include +#include "nrf.h" + +#include "nrf_error_soc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@addtogroup NRF_NVIC_DEFINES Defines + * @{ */ + +/**@defgroup NRF_NVIC_ISER_DEFINES SoftDevice NVIC internal definitions + * @{ */ + +#define __NRF_NVIC_NVMC_IRQn (30) /**< The peripheral ID of the NVMC. IRQ numbers are used to identify peripherals, but the NVMC doesn't have an IRQ number in the MDK. */ + +#ifdef NRF51 + #define __NRF_NVIC_ISER_COUNT (1) /**< The number of ISER/ICER registers in the NVIC that are used. */ + + /**@brief Interrupts used by the SoftDevice. */ + #define __NRF_NVIC_SD_IRQS_0 ((uint32_t)( \ + (1U << POWER_CLOCK_IRQn) \ + | (1U << RADIO_IRQn) \ + | (1U << RTC0_IRQn) \ + | (1U << TIMER0_IRQn) \ + | (1U << RNG_IRQn) \ + | (1U << ECB_IRQn) \ + | (1U << CCM_AAR_IRQn) \ + | (1U << TEMP_IRQn) \ + | (1U << __NRF_NVIC_NVMC_IRQn) \ + | (1U << (uint32_t)SWI4_IRQn) \ + | (1U << (uint32_t)SWI5_IRQn) \ + )) + + /**@brief Interrupts available for to application. */ + #define __NRF_NVIC_APP_IRQS_0 (~__NRF_NVIC_SD_IRQS_0) +#endif + +#ifdef NRF52_SERIES + #define __NRF_NVIC_ISER_COUNT (2) /**< The number of ISER/ICER registers in the NVIC that are used. */ + + /**@brief Interrupts used by the SoftDevice. */ + #define __NRF_NVIC_SD_IRQS_0 ((uint32_t)( \ + (1U << POWER_CLOCK_IRQn) \ + | (1U << RADIO_IRQn) \ + | (1U << RTC0_IRQn) \ + | (1U << TIMER0_IRQn) \ + | (1U << RNG_IRQn) \ + | (1U << ECB_IRQn) \ + | (1U << CCM_AAR_IRQn) \ + | (1U << TEMP_IRQn) \ + | (1U << __NRF_NVIC_NVMC_IRQn) \ + | (1U << (uint32_t)SWI4_EGU4_IRQn) \ + | (1U << (uint32_t)SWI5_EGU5_IRQn) \ + )) + #define __NRF_NVIC_SD_IRQS_1 ((uint32_t)0) + + /**@brief Interrupts available for to application. */ + #define __NRF_NVIC_APP_IRQS_0 (~__NRF_NVIC_SD_IRQS_0) + #define __NRF_NVIC_APP_IRQS_1 (~__NRF_NVIC_SD_IRQS_1) +#endif +/**@} */ + +/**@} */ + +/**@addtogroup NRF_NVIC_VARIABLES Variables + * @{ */ + +/**@brief Type representing the state struct for the SoftDevice NVIC module. */ +typedef struct +{ + uint32_t volatile __irq_masks[__NRF_NVIC_ISER_COUNT]; /**< IRQs enabled by the application in the NVIC. */ + uint32_t volatile __cr_flag; /**< Non-zero if already in a critical region */ +} nrf_nvic_state_t; + +/**@brief Variable keeping the state for the SoftDevice NVIC module. This must be declared in an + * application source file. */ +extern nrf_nvic_state_t nrf_nvic_state; + +/**@} */ + +/**@addtogroup NRF_NVIC_INTERNAL_FUNCTIONS SoftDevice NVIC internal functions + * @{ */ + +/**@brief Disables IRQ interrupts globally, including the SoftDevice's interrupts. + * + * @retval The value of PRIMASK prior to disabling the interrupts. + */ +__STATIC_INLINE int __sd_nvic_irq_disable(void); + +/**@brief Enables IRQ interrupts globally, including the SoftDevice's interrupts. + */ +__STATIC_INLINE void __sd_nvic_irq_enable(void); + +/**@brief Checks if IRQn is available to application + * @param[in] IRQn irq to check + * + * @retval 1 (true) if the irq to check is available to the application + */ +__STATIC_INLINE uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn); + +/**@brief Checks if priority is available to application + * @param[in] priority priority to check + * + * @retval 1 (true) if the priority to check is available to the application + */ +__STATIC_INLINE uint32_t __sd_nvic_is_app_accessible_priority(uint32_t priority); + +/**@} */ + +/**@addtogroup NRF_NVIC_FUNCTIONS SoftDevice NVIC public functions + * @{ */ + +/**@brief Enable External Interrupt. + * @note Corresponds to NVIC_EnableIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt was enabled. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt has a priority not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn); + +/**@brief Disable External Interrupt. + * @note Corresponds to NVIC_DisableIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt was disabled. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn); + +/**@brief Get Pending Interrupt. + * @note Corresponds to NVIC_GetPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_GetPendingIRQ documentation in CMSIS. + * @param[out] p_pending_irq Return value from NVIC_GetPendingIRQ. + * + * @retval ::NRF_SUCCESS The interrupt is available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq); + +/**@brief Set Pending Interrupt. + * @note Corresponds to NVIC_SetPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt is set pending. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn); + +/**@brief Clear Pending Interrupt. + * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt pending flag is cleared. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn); + +/**@brief Set Interrupt Priority. + * @note Corresponds to NVIC_SetPriority in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * @pre Priority is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_SetPriority documentation in CMSIS. + * @param[in] priority A valid IRQ priority for use by the application. + * + * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt priority is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority); + +/**@brief Get Interrupt Priority. + * @note Corresponds to NVIC_GetPriority in CMSIS. + * + * @pre IRQn is valid and not reserved by the stack. + * + * @param[in] IRQn See the NVIC_GetPriority documentation in CMSIS. + * @param[out] p_priority Return value from NVIC_GetPriority. + * + * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority. + * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE - IRQn is not available for the application. + */ +__STATIC_INLINE uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority); + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +__STATIC_INLINE uint32_t sd_nvic_SystemReset(void); + +/**@brief Enter critical region. + * + * @post Application interrupts will be disabled. + * @note sd_nvic_critical_region_enter() and ::sd_nvic_critical_region_exit() must be called in matching pairs inside each + * execution context + * @sa sd_nvic_critical_region_exit + * + * @param[out] p_is_nested_critical_region If 1, the application is now in a nested critical region. + * + * @retval ::NRF_SUCCESS + */ +__STATIC_INLINE uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region); + +/**@brief Exit critical region. + * + * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter. + * @post If not in a nested critical region, the application interrupts will restored to the state before ::sd_nvic_critical_region_enter was called. + * + * @param[in] is_nested_critical_region If this is set to 1, the critical region won't be exited. @sa sd_nvic_critical_region_enter. + * + * @retval ::NRF_SUCCESS + */ +__STATIC_INLINE uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region); + +/**@} */ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE int __sd_nvic_irq_disable(void) +{ + int pm = __get_PRIMASK(); + __disable_irq(); + return pm; +} + +__STATIC_INLINE void __sd_nvic_irq_enable(void) +{ + __enable_irq(); +} + +__STATIC_INLINE uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn) +{ + if (IRQn < 32) + { + return ((1UL<= (1 << __NVIC_PRIO_BITS)) + { + return 0; + } +#ifdef NRF51 + if( priority == 0 + || priority == 2 + ) + { + return 0; + } +#endif +#ifdef NRF52_SERIES + if( priority == 0 + || priority == 1 + || priority == 4 + || priority == 5 + ) + { + return 0; + } +#endif + return 1; +} + + +__STATIC_INLINE uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn) +{ + if (!__sd_nvic_app_accessible_irq(IRQn)) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } + if (!__sd_nvic_is_app_accessible_priority(NVIC_GetPriority(IRQn))) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED; + } + + if (nrf_nvic_state.__cr_flag) + { + nrf_nvic_state.__irq_masks[(uint32_t)((int32_t)IRQn) >> 5] |= (uint32_t)(1 << ((uint32_t)((int32_t)IRQn) & (uint32_t)0x1F)); + } + else + { + NVIC_EnableIRQ(IRQn); + } + return NRF_SUCCESS; +} + +__STATIC_INLINE uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn) +{ + if (!__sd_nvic_app_accessible_irq(IRQn)) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } + + if (nrf_nvic_state.__cr_flag) + { + nrf_nvic_state.__irq_masks[(uint32_t)((int32_t)IRQn) >> 5] &= ~(1UL << ((uint32_t)(IRQn) & 0x1F)); + } + else + { + NVIC_DisableIRQ(IRQn); + } + + return NRF_SUCCESS; +} + +__STATIC_INLINE uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq) +{ + if (__sd_nvic_app_accessible_irq(IRQn)) + { + *p_pending_irq = NVIC_GetPendingIRQ(IRQn); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } +} + +__STATIC_INLINE uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn) +{ + if (__sd_nvic_app_accessible_irq(IRQn)) + { + NVIC_SetPendingIRQ(IRQn); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } +} + +__STATIC_INLINE uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn) +{ + if (__sd_nvic_app_accessible_irq(IRQn)) + { + NVIC_ClearPendingIRQ(IRQn); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } +} + +__STATIC_INLINE uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if (!__sd_nvic_app_accessible_irq(IRQn)) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } + + if (!__sd_nvic_is_app_accessible_priority(priority)) + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED; + } + + NVIC_SetPriority(IRQn, (uint32_t)priority); + return NRF_SUCCESS; +} + +__STATIC_INLINE uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority) +{ + if (__sd_nvic_app_accessible_irq(IRQn)) + { + *p_priority = (NVIC_GetPriority(IRQn) & 0xFF); + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; + } +} + +__STATIC_INLINE uint32_t sd_nvic_SystemReset(void) +{ + NVIC_SystemReset(); + return NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN; +} + +__STATIC_INLINE uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region) +{ + int was_masked = __sd_nvic_irq_disable(); + if (!nrf_nvic_state.__cr_flag) + { + nrf_nvic_state.__cr_flag = 1; + nrf_nvic_state.__irq_masks[0] = ( NVIC->ICER[0] & __NRF_NVIC_APP_IRQS_0 ); + NVIC->ICER[0] = __NRF_NVIC_APP_IRQS_0; + #ifdef NRF52_SERIES + nrf_nvic_state.__irq_masks[1] = ( NVIC->ICER[1] & __NRF_NVIC_APP_IRQS_1 ); + NVIC->ICER[1] = __NRF_NVIC_APP_IRQS_1; + #endif + *p_is_nested_critical_region = 0; + } + else + { + *p_is_nested_critical_region = 1; + } + if (!was_masked) + { + __sd_nvic_irq_enable(); + } + return NRF_SUCCESS; +} + +__STATIC_INLINE uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region) +{ + if (nrf_nvic_state.__cr_flag && (is_nested_critical_region == 0)) + { + int was_masked = __sd_nvic_irq_disable(); + NVIC->ISER[0] = nrf_nvic_state.__irq_masks[0]; + #ifdef NRF52_SERIES + NVIC->ISER[1] = nrf_nvic_state.__irq_masks[1]; + #endif + nrf_nvic_state.__cr_flag = 0; + if (!was_masked) + { + __sd_nvic_irq_enable(); + } + } + + return NRF_SUCCESS; +} + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + +#ifdef __cplusplus +} +#endif + +#endif // NRF_NVIC_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_transport.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sd_def.h similarity index 76% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_transport.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sd_def.h index 20fe4c81ba..9cb516acde 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_transport.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sd_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Nordic Semiconductor ASA + * Copyright (c) 2015 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,32 +36,23 @@ * */ - -/**@file - * - * @defgroup nrf_dfu_transport DFU transport API. - * @{ - * - * @brief DFU transport module interface. - */ - -#ifndef DFU_TRANSPORT_H__ -#define DFU_TRANSPORT_H__ +#ifndef NRF_SD_DEF_H__ +#define NRF_SD_DEF_H__ #include -/**@brief Function for starting the update of Device Firmware. - * - * @retval NRF_SUCCESS Operation success. - */ -uint32_t dfu_transport_update_start(void); +#ifdef __cplusplus +extern "C" { +#endif -/**@brief Function for closing the transport layer. - * - * @retval NRF_SUCCESS Operation success. - */ -uint32_t dfu_transport_close(void); +#define SD_PPI_CHANNELS_USED 0xFFFE0000uL /**< PPI channels utilized by SotfDevice (not available to the application). */ +#define SD_PPI_GROUPS_USED 0x0000000CuL /**< PPI groups utilized by SoftDevice (not available to the application). */ +#define SD_TIMERS_USED 0x00000001uL /**< Timers used by SoftDevice. */ +#define SD_SWI_USED 0x0000003CuL /**< Software interrupts used by SoftDevice */ -#endif // DFU_TRANSPORT_H__ -/**@} */ +#ifdef __cplusplus +} +#endif + +#endif /* NRF_SD_DEF_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sdm.h new file mode 100644 index 0000000000..b7fbe0e746 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sdm.h @@ -0,0 +1,335 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/** + @defgroup nrf_sdm_api SoftDevice Manager API + @{ + + @brief APIs for SoftDevice management. + +*/ + +#ifndef NRF_SDM_H__ +#define NRF_SDM_H__ + +#include "nrf_svc.h" +#include "nrf.h" +#include "nrf_soc.h" +#include "nrf_error_sdm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ +#ifdef NRFSOC_DOXYGEN +/// Declared in nrf_mbr.h +#define MBR_SIZE 0 +#warning test +#endif + +/** @brief The major version for the SoftDevice binary distributed with this header file. */ +#define SD_MAJOR_VERSION (5) + +/** @brief The minor version for the SoftDevice binary distributed with this header file. */ +#define SD_MINOR_VERSION (0) + +/** @brief The bugfix version for the SoftDevice binary distributed with this header file. */ +#define SD_BUGFIX_VERSION (0) + +/** @brief The full version number for the SoftDevice binary this header file was distributed + * with, as a decimal number in the form Mmmmbbb, where: + * - M is major version (one or more digits) + * - mmm is minor version (three digits) + * - bbb is bugfix version (three digits). */ +#define SD_VERSION (SD_MAJOR_VERSION * 1000000 + SD_MINOR_VERSION * 1000 + SD_BUGFIX_VERSION) + +/** @brief SoftDevice Manager SVC Base number. */ +#define SDM_SVC_BASE 0x10 + +/** @brief Invalid info field. Returned when an info field does not exist. */ +#define SDM_INFO_FIELD_INVALID (0) + +/** @brief Defines the SoftDevice Information Structure location (address) as an offset from +the start of the softdevice (without MBR)*/ +#define SOFTDEVICE_INFO_STRUCT_OFFSET (0x2000) + +/** @brief Defines the absolute SoftDevice Information Structure location (address) when the + * SoftDevice is installed just above the MBR (the usual case). */ +#define SOFTDEVICE_INFO_STRUCT_ADDRESS (SOFTDEVICE_INFO_STRUCT_OFFSET + MBR_SIZE) + +/** @brief Defines the offset for the SoftDevice Information Structure size value relative to the + * SoftDevice base address. The size value is of type uint8_t. */ +#define SD_INFO_STRUCT_SIZE_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET) + +/** @brief Defines the offset for the SoftDevice size value relative to the SoftDevice base address. + * The size value is of type uint32_t. */ +#define SD_SIZE_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x08) + +/** @brief Defines the offset for FWID value relative to the SoftDevice base address. The FWID value + * is of type uint16_t. */ +#define SD_FWID_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x0C) + +/** @brief Defines the offset for the SoftDevice ID relative to the SoftDevice base address. The ID + * is of type uint32_t. */ +#define SD_ID_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x10) + +/** @brief Defines the offset for the SoftDevice version relative to the SoftDevice base address in + * the same format as @ref SD_VERSION, stored as an uint32_t. */ +#define SD_VERSION_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x14) + +/** @brief Defines a macro for retreiving the actual SoftDevice Information Structure size value + * from a given base address. Use @ref MBR_SIZE as the argument when the SoftDevice is + * installed just above the MBR (the usual case). */ +#define SD_INFO_STRUCT_SIZE_GET(baseaddr) (*((uint8_t *) ((baseaddr) + SD_INFO_STRUCT_SIZE_OFFSET))) + +/** @brief Defines a macro for retreiving the actual SoftDevice size value from a given base + * address. Use @ref MBR_SIZE as the argument when the SoftDevice is installed just above + * the MBR (the usual case). */ +#define SD_SIZE_GET(baseaddr) (*((uint32_t *) ((baseaddr) + SD_SIZE_OFFSET))) + +/** @brief Defines a macro for retreiving the actual FWID value from a given base address. Use @ref + * MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the usual + * case). */ +#define SD_FWID_GET(baseaddr) (*((uint16_t *) ((baseaddr) + SD_FWID_OFFSET))) + +/** @brief Defines a macro for retreiving the actual SoftDevice ID from a given base address. Use + * @ref MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the + * usual case). */ +#define SD_ID_GET(baseaddr) ((SD_INFO_STRUCT_SIZE_GET(baseaddr) > (SD_ID_OFFSET - SOFTDEVICE_INFO_STRUCT_OFFSET)) \ + ? (*((uint32_t *) ((baseaddr) + SD_ID_OFFSET))) : SDM_INFO_FIELD_INVALID) + +/** @brief Defines a macro for retreiving the actual FWID value from a given base address. Use @ref + * MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the usual + * case). */ +#define SD_VERSION_GET(baseaddr) ((SD_INFO_STRUCT_SIZE_GET(baseaddr) > (SD_VERSION_OFFSET - SOFTDEVICE_INFO_STRUCT_OFFSET)) \ + ? (*((uint32_t *) ((baseaddr) + SD_VERSION_OFFSET))) : SDM_INFO_FIELD_INVALID) + +/**@defgroup NRF_FAULT_ID_RANGES Fault ID ranges + * @{ */ +#define NRF_FAULT_ID_SD_RANGE_START 0x00000000 /**< SoftDevice ID range start. */ +#define NRF_FAULT_ID_APP_RANGE_START 0x00001000 /**< Application ID range start. */ +/**@} */ + +/**@defgroup NRF_FAULT_IDS Fault ID types + * @{ */ +#define NRF_FAULT_ID_SD_ASSERT (NRF_FAULT_ID_SD_RANGE_START + 1) /**< SoftDevice assertion. The info parameter is reserved for future used. */ +#define NRF_FAULT_ID_APP_MEMACC (NRF_FAULT_ID_APP_RANGE_START + 1) /**< Application invalid memory access (nRF52 only). The info parameter will contain 0x00000000, in case of SoftDevice RAM + access violation. In case of SoftDevice peripheral register violation the info parameter will contain the sub-region number of PREGION[0], on whose address range the unallowed + write access caused the memory access fault. */ +/**@} */ + +/** @} */ + +/** @addtogroup NRF_SDM_ENUMS Enumerations + * @{ */ + +/**@brief nRF SoftDevice Manager API SVC numbers. */ +enum NRF_SD_SVCS +{ + SD_SOFTDEVICE_ENABLE = SDM_SVC_BASE, /**< ::sd_softdevice_enable */ + SD_SOFTDEVICE_DISABLE, /**< ::sd_softdevice_disable */ + SD_SOFTDEVICE_IS_ENABLED, /**< ::sd_softdevice_is_enabled */ + SD_SOFTDEVICE_VECTOR_TABLE_BASE_SET, /**< ::sd_softdevice_vector_table_base_set */ + SVC_SDM_LAST /**< Placeholder for last SDM SVC */ +}; + +/** @} */ + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ + +/**@defgroup NRF_CLOCK_LF_XTAL_ACCURACY Clock accuracy + * @{ */ + +#define NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM (0) /**< Default: 250 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM (1) /**< 500 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM (2) /**< 150 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM (3) /**< 100 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM (4) /**< 75 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM (5) /**< 50 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM (6) /**< 30 ppm */ +#define NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM (7) /**< 20 ppm */ + +/** @} */ + +/**@defgroup NRF_CLOCK_LF_SRC Possible lfclk oscillator sources + * @{ */ + +#define NRF_CLOCK_LF_SRC_RC (0) /**< LFCLK RC oscillator. */ +#define NRF_CLOCK_LF_SRC_XTAL (1) /**< LFCLK crystal oscillator. */ +#define NRF_CLOCK_LF_SRC_SYNTH (2) /**< LFCLK Synthesized from HFCLK. */ + +/** @} */ + +/** @} */ + +/** @addtogroup NRF_SDM_TYPES Types + * @{ */ + +/**@brief Type representing lfclk oscillator source. */ +typedef struct +{ + uint8_t source; /**< LF oscillator clock source, see @ref NRF_CLOCK_LF_SRC. */ + uint8_t rc_ctiv; /**< Only for NRF_CLOCK_LF_SRC_RC: Calibration timer interval in 1/4 second + units (nRF51: 1-64, nRF52: 1-32). + @note To avoid excessive clock drift, 0.5 degrees Celsius is the + maximum temperature change allowed in one calibration timer + interval. The interval should be selected to ensure this. + + @note Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. */ + uint8_t rc_temp_ctiv; /**< Only for NRF_CLOCK_LF_SRC_RC: How often (in number of calibration + intervals) the RC oscillator shall be calibrated if the temperature + hasn't changed. + 0: Always calibrate even if the temperature hasn't changed. + 1: Only calibrate if the temperature has changed (nRF51 only). + 2-33: Check the temperature and only calibrate if it has changed, + however calibration will take place every rc_temp_ctiv + intervals in any case. + + @note Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. + + @note For nRF52, the application must ensure calibration at least once + every 8 seconds to ensure +/-250ppm clock stability. The + recommended configuration for NRF_CLOCK_LF_SRC_RC on nRF52 is + rc_ctiv=16 and rc_temp_ctiv=2. This will ensure calibration at + least once every 8 seconds and for temperature changes of 0.5 + degrees Celsius every 4 seconds. See the Product Specification + for the nRF52 device being used for more information.*/ + uint8_t xtal_accuracy; /**< External crystal clock accuracy used in the LL to compute timing windows. + + @note For the NRF_CLOCK_LF_SRC_RC clock source this parameter is ignored. */ +} nrf_clock_lf_cfg_t; + +/**@brief Fault Handler type. + * + * When certain unrecoverable errors occur within the application or SoftDevice the fault handler will be called back. + * The protocol stack will be in an undefined state when this happens and the only way to recover will be to + * perform a reset, using e.g. CMSIS NVIC_SystemReset(). + * If the application returns from the fault handler the SoftDevice will call NVIC_SystemReset(). + * + * @note This callback is executed in HardFault context, thus SVC functions cannot be called from the fault callback. + * + * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. + * @param[in] pc The program counter of the instruction that triggered the fault. + * @param[in] info Optional additional information regarding the fault. Refer to each Fault identifier for details. + * + * @note When id is set to NRF_FAULT_ID_APP_MEMACC, pc will contain the address of the instruction being executed at the time when + * the fault is detected by the CPU. The CPU program counter may have advanced up to 2 instructions (no branching) after the one that triggered the fault. + */ +typedef void (*nrf_fault_handler_t)(uint32_t id, uint32_t pc, uint32_t info); + +/** @} */ + +/** @addtogroup NRF_SDM_FUNCTIONS Functions + * @{ */ + +/**@brief Enables the SoftDevice and by extension the protocol stack. + * + * @note Some care must be taken if a low frequency clock source is already running when calling this function: + * If the LF clock has a different source then the one currently running, it will be stopped. Then, the new + * clock source will be started. + * + * @note This function has no effect when returning with an error. + * + * @post If return code is ::NRF_SUCCESS + * - SoC library and protocol stack APIs are made available. + * - A portion of RAM will be unavailable (see relevant SDS documentation). + * - Some peripherals will be unavailable or available only through the SoC API (see relevant SDS documentation). + * - Interrupts will not arrive from protected peripherals or interrupts. + * - nrf_nvic_ functions must be used instead of CMSIS NVIC_ functions for reliable usage of the SoftDevice. + * - Interrupt latency may be affected by the SoftDevice (see relevant SDS documentation). + * - Chosen low frequency clock source will be running. + * + * @param p_clock_lf_cfg Low frequency clock source and accuracy. + If NULL the clock will be configured as an rc source with rc_ctiv = 16 and .rc_temp_ctiv = 2 + In the case of XTAL source, the PPM accuracy of the chosen clock source must be greater than or equal to the actual characteristics of your XTAL clock. + * @param fault_handler Callback to be invoked in case of fault, cannot be NULL. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_ADDR Invalid or NULL pointer supplied. + * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and fault handler cannot be updated. + * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level. + * @retval ::NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN Unknown low frequency clock source selected. + */ +SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler)); + + +/**@brief Disables the SoftDevice and by extension the protocol stack. + * + * Idempotent function to disable the SoftDevice. + * + * @post SoC library and protocol stack APIs are made unavailable. + * @post All interrupts that was protected by the SoftDevice will be disabled and initialized to priority 0 (highest). + * @post All peripherals used by the SoftDevice will be reset to default values. + * @post All of RAM become available. + * @post All interrupts are forwarded to the application. + * @post LFCLK source chosen in ::sd_softdevice_enable will be left running. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_SOFTDEVICE_DISABLE, uint32_t, sd_softdevice_disable(void)); + +/**@brief Check if the SoftDevice is enabled. + * + * @param[out] p_softdevice_enabled If the SoftDevice is enabled: 1 else 0. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_SOFTDEVICE_IS_ENABLED, uint32_t, sd_softdevice_is_enabled(uint8_t * p_softdevice_enabled)); + +/**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the SoftDevice + * + * This function is only intended to be called when a bootloader is enabled. + * + * @param[in] address The base address of the interrupt vector table for forwarded interrupts. + + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_SOFTDEVICE_VECTOR_TABLE_BASE_SET, uint32_t, sd_softdevice_vector_table_base_set(uint32_t address)); + +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_SDM_H__ + +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_soc.h new file mode 100644 index 0000000000..86e5fe421e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_soc.h @@ -0,0 +1,908 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/** + * @defgroup nrf_soc_api SoC Library API + * @{ + * + * @brief APIs for the SoC library. + * + */ + +#ifndef NRF_SOC_H__ +#define NRF_SOC_H__ + +#include +#include +#include "nrf_svc.h" +#include "nrf.h" + +#include "nrf_error_soc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@addtogroup NRF_SOC_DEFINES Defines + * @{ */ + +/**@brief The number of the lowest SVC number reserved for the SoC library. */ +#define SOC_SVC_BASE (0x20) /**< Base value for SVCs that are available when the SoftDevice is disabled. */ +#define SOC_SVC_BASE_NOT_AVAILABLE (0x2B) /**< Base value for SVCs that are not available when the SoftDevice is disabled. */ + +/**@brief Guranteed time for application to process radio inactive notification. */ +#define NRF_RADIO_NOTIFICATION_INACTIVE_GUARANTEED_TIME_US (62) + +/**@brief The minimum allowed timeslot extension time. */ +#define NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US (200) + +#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. */ + +#ifdef NRF51 +#define SD_EVT_IRQn (SWI2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ +#define SD_EVT_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. */ +#endif +#ifdef NRF52_SERIES +#define SD_EVT_IRQn (SWI2_EGU2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ +#define SD_EVT_IRQHandler (SWI2_EGU2_IRQHandler) /**< SoftDevice Event IRQ handler. Used for both protocol events and SoC events. */ +#define RADIO_NOTIFICATION_IRQn (SWI1_EGU1_IRQn) /**< The radio notification IRQ number. */ +#define RADIO_NOTIFICATION_IRQHandler (SWI1_EGU1_IRQHandler) /**< The radio notification IRQ handler. */ +#endif + +#define NRF_RADIO_LENGTH_MIN_US (100) /**< The shortest allowed radio timeslot, in microseconds. */ +#define NRF_RADIO_LENGTH_MAX_US (100000) /**< The longest allowed radio timeslot, in microseconds. */ + +#define NRF_RADIO_DISTANCE_MAX_US (128000000UL - 1UL) /**< The longest timeslot distance, in microseconds, allowed for the distance parameter (see @ref nrf_radio_request_normal_t) in the request. */ + +#define NRF_RADIO_EARLIEST_TIMEOUT_MAX_US (128000000UL - 1UL) /**< The longest timeout, in microseconds, allowed when requesting the earliest possible timeslot. */ + +#define NRF_RADIO_START_JITTER_US (2) /**< The maximum jitter in @ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START relative to the requested start time. */ + +/**@} */ + +/**@addtogroup NRF_SOC_ENUMS Enumerations + * @{ */ + +/**@brief The SVC numbers used by the SVC functions in the SoC library. */ +enum NRF_SOC_SVCS +{ + SD_PPI_CHANNEL_ENABLE_GET = SOC_SVC_BASE, + 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_FLASH_PAGE_ERASE, + SD_FLASH_WRITE, + SD_FLASH_PROTECT, + SD_MUTEX_NEW = SOC_SVC_BASE_NOT_AVAILABLE, + SD_MUTEX_ACQUIRE, + SD_MUTEX_RELEASE, + SD_RAND_APPLICATION_POOL_CAPACITY_GET, + SD_RAND_APPLICATION_BYTES_AVAILABLE_GET, + SD_RAND_APPLICATION_VECTOR_GET, + 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_EVT_WAIT, + SD_CLOCK_HFCLK_REQUEST, + SD_CLOCK_HFCLK_RELEASE, + SD_CLOCK_HFCLK_IS_RUNNING, + SD_RADIO_NOTIFICATION_CFG_SET, + SD_ECB_BLOCK_ENCRYPT, + SD_ECB_BLOCKS_ENCRYPT, + SD_RADIO_SESSION_OPEN, + SD_RADIO_SESSION_CLOSE, + SD_RADIO_REQUEST, + SD_EVT_GET, + SD_TEMP_GET, + SVC_SOC_LAST +}; + +/**@brief Possible values of a ::nrf_mutex_t. */ +enum NRF_MUTEX_VALUES +{ + NRF_MUTEX_FREE, + NRF_MUTEX_TAKEN +}; + +/**@brief Power modes. */ +enum NRF_POWER_MODES +{ + NRF_POWER_MODE_CONSTLAT, /**< Constant latency mode. See power management in the reference manual. */ + NRF_POWER_MODE_LOWPWR /**< Low power mode. See power management in the reference manual. */ +}; + + +/**@brief Power failure thresholds */ +enum NRF_POWER_THRESHOLDS +{ + NRF_POWER_THRESHOLD_V21, /**< 2.1 Volts power failure threshold. */ + NRF_POWER_THRESHOLD_V23, /**< 2.3 Volts power failure threshold. */ + NRF_POWER_THRESHOLD_V25, /**< 2.5 Volts power failure threshold. */ + NRF_POWER_THRESHOLD_V27 /**< 2.7 Volts power failure threshold. */ +}; + + +/**@brief DC/DC converter modes. */ +enum NRF_POWER_DCDC_MODES +{ + NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */ + NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */ +}; + +/**@brief Radio notification distances. */ +enum NRF_RADIO_NOTIFICATION_DISTANCES +{ + NRF_RADIO_NOTIFICATION_DISTANCE_NONE = 0, /**< The event does not have a notification. */ + NRF_RADIO_NOTIFICATION_DISTANCE_800US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_1740US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_2680US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_3620US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_4560US, /**< The distance from the active notification to start of radio activity. */ + NRF_RADIO_NOTIFICATION_DISTANCE_5500US /**< The distance from the active notification to start of radio activity. */ +}; + + +/**@brief Radio notification types. */ +enum NRF_RADIO_NOTIFICATION_TYPES +{ + NRF_RADIO_NOTIFICATION_TYPE_NONE = 0, /**< The event does not have a radio notification signal. */ + NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE, /**< Using interrupt for notification when the radio will be enabled. */ + NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, /**< Using interrupt for notification when the radio has been disabled. */ + NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH, /**< Using interrupt for notification both when the radio will be enabled and disabled. */ +}; + +/**@brief The Radio signal callback types. */ +enum NRF_RADIO_CALLBACK_SIGNAL_TYPE +{ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_START, /**< This signal indicates the start of the radio timeslot. */ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0, /**< This signal indicates the NRF_TIMER0 interrupt. */ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO, /**< This signal indicates the NRF_RADIO interrupt. */ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED, /**< This signal indicates extend action failed. */ + NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_SUCCEEDED /**< This signal indicates extend action succeeded. */ +}; + +/**@brief The actions requested by the signal callback. + * + * This code gives the SOC instructions about what action to take when the signal callback has + * returned. + */ +enum NRF_RADIO_SIGNAL_CALLBACK_ACTION +{ + NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE, /**< Return without action. */ + NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND, /**< Request an extension of the current timeslot (maximum execution time for this action is when the extension succeeded). */ + NRF_RADIO_SIGNAL_CALLBACK_ACTION_END, /**< End the current radio timeslot. */ + NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END /**< Request a new radio timeslot and end the current timeslot. */ +}; + +/**@brief Radio timeslot high frequency clock source configuration. */ +enum NRF_RADIO_HFCLK_CFG +{ + NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED, /**< The SoftDevice will guarantee that the high frequency clock source is the + external crystal for the whole duration of the timeslot. This should be the + preferred option for events that use the radio or require high timing accuracy. */ + NRF_RADIO_HFCLK_CFG_NO_GUARANTEE /**< This configuration allows for earlier and tighter scheduling of timeslots. + The RC oscillator may be the clock source in part or for the whole duration of the timeslot. + The RC oscillator's accuracy must therefore be taken into consideration. + @note If the application will use the radio peripheral in timeslots with this configuration, + it must make sure that the crystal is running and stable before starting the radio. */ +}; + +/**@brief Radio timeslot priorities. */ +enum NRF_RADIO_PRIORITY +{ + NRF_RADIO_PRIORITY_HIGH, /**< High (equal priority as the normal connection priority of the SoftDevice stack(s)). */ + NRF_RADIO_PRIORITY_NORMAL, /**< Normal (equal priority as the priority of secondary activites of the SoftDevice stack(s)). */ +}; + +/**@brief Radio timeslot request type. */ +enum NRF_RADIO_REQUEST_TYPE +{ + NRF_RADIO_REQ_TYPE_EARLIEST, /**< Request radio timeslot as early as possible. This should always be used for the first request in a session. */ + NRF_RADIO_REQ_TYPE_NORMAL /**< Normal radio timeslot request. */ +}; + +/**@brief SoC Events. */ +enum NRF_SOC_EVTS +{ + NRF_EVT_HFCLKSTARTED, /**< Event indicating that the HFCLK has started. */ + NRF_EVT_POWER_FAILURE_WARNING, /**< Event indicating that a power failure warning has occurred. */ + NRF_EVT_FLASH_OPERATION_SUCCESS, /**< Event indicating that the ongoing flash operation has completed successfully. */ + NRF_EVT_FLASH_OPERATION_ERROR, /**< Event indicating that the ongoing flash operation has timed out with an error. */ + NRF_EVT_RADIO_BLOCKED, /**< Event indicating that a radio timeslot was blocked. */ + NRF_EVT_RADIO_CANCELED, /**< Event indicating that a radio timeslot was canceled by SoftDevice. */ + NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN, /**< Event indicating that a radio timeslot signal callback handler return was invalid. */ + NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio timeslot session is idle. */ + NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio timeslot session is closed. */ + NRF_EVT_NUMBER_OF_EVTS +}; + +/**@} */ + + +/**@addtogroup NRF_SOC_STRUCTURES Structures + * @{ */ + +/**@brief Represents a mutex for use with the nrf_mutex functions. + * @note Accessing the value directly is not safe, use the mutex functions! + */ +typedef volatile uint8_t nrf_mutex_t; + +/**@brief Parameters for a request for a timeslot as early as possible. */ +typedef struct +{ + uint8_t hfclk; /**< High frequency clock source, see @ref NRF_RADIO_HFCLK_CFG. */ + uint8_t priority; /**< The radio timeslot priority, see @ref NRF_RADIO_PRIORITY. */ + uint32_t length_us; /**< The radio timeslot length (in the range 100 to 100,000] microseconds). */ + uint32_t timeout_us; /**< Longest acceptable delay until the start of the requested timeslot (up to @ref NRF_RADIO_EARLIEST_TIMEOUT_MAX_US microseconds). */ +} nrf_radio_request_earliest_t; + +/**@brief Parameters for a normal radio timeslot request. */ +typedef struct +{ + uint8_t hfclk; /**< High frequency clock source, see @ref NRF_RADIO_HFCLK_CFG. */ + uint8_t priority; /**< The radio timeslot priority, see @ref NRF_RADIO_PRIORITY. */ + uint32_t distance_us; /**< Distance from the start of the previous radio timeslot (up to @ref NRF_RADIO_DISTANCE_MAX_US microseconds). */ + uint32_t length_us; /**< The radio timeslot length (in the range [100..100,000] microseconds). */ +} nrf_radio_request_normal_t; + +/**@brief Radio timeslot request parameters. */ +typedef struct +{ + uint8_t request_type; /**< Type of request, see @ref NRF_RADIO_REQUEST_TYPE. */ + union + { + nrf_radio_request_earliest_t earliest; /**< Parameters for requesting a radio timeslot as early as possible. */ + nrf_radio_request_normal_t normal; /**< Parameters for requesting a normal radio timeslot. */ + } params; /**< Parameter union. */ +} nrf_radio_request_t; + +/**@brief Return parameters of the radio timeslot signal callback. */ +typedef struct +{ + uint8_t callback_action; /**< The action requested by the application when returning from the signal callback, see @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION. */ + union + { + struct + { + nrf_radio_request_t * p_next; /**< The request parameters for the next radio timeslot. */ + } request; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END. */ + struct + { + uint32_t length_us; /**< Requested extension of the radio timeslot duration (microseconds) (for minimum time see @ref NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US). */ + } extend; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND. */ + } params; /**< Parameter union. */ +} nrf_radio_signal_callback_return_param_t; + +/**@brief The radio timeslot signal callback type. + * + * @note In case of invalid return parameters, the radio timeslot will automatically end + * immediately after returning from the signal callback and the + * @ref NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN event will be sent. + * @note The returned struct pointer must remain valid after the signal callback + * function returns. For instance, this means that it must not point to a stack variable. + * + * @param[in] signal_type Type of signal, see @ref NRF_RADIO_CALLBACK_SIGNAL_TYPE. + * + * @return Pointer to structure containing action requested by the application. + */ +typedef nrf_radio_signal_callback_return_param_t * (*nrf_radio_signal_callback_t) (uint8_t signal_type); + +/**@brief AES ECB parameter typedefs */ +typedef uint8_t soc_ecb_key_t[SOC_ECB_KEY_LENGTH]; /**< Encryption key type. */ +typedef uint8_t soc_ecb_cleartext_t[SOC_ECB_CLEARTEXT_LENGTH]; /**< Cleartext data type. */ +typedef uint8_t soc_ecb_ciphertext_t[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Ciphertext data type. */ + +/**@brief AES ECB data structure */ +typedef struct +{ + soc_ecb_key_t key; /**< Encryption key. */ + soc_ecb_cleartext_t cleartext; /**< Cleartext data. */ + soc_ecb_ciphertext_t ciphertext; /**< Ciphertext data. */ +} nrf_ecb_hal_data_t; + +/**@brief AES ECB block. Used to provide multiple blocks in a single call + to @ref sd_ecb_blocks_encrypt.*/ +typedef struct +{ + soc_ecb_key_t* p_key; /**< Pointer to the Encryption key. */ + soc_ecb_cleartext_t* p_cleartext; /**< Pointer to the Cleartext data. */ + soc_ecb_ciphertext_t* p_ciphertext; /**< Pointer to the Ciphertext data. */ +} nrf_ecb_hal_data_block_t; + +/**@} */ + +/**@addtogroup NRF_SOC_FUNCTIONS Functions + * @{ */ + +/**@brief Initialize a mutex. + * + * @param[in] p_mutex Pointer to the mutex to initialize. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_MUTEX_NEW, uint32_t, sd_mutex_new(nrf_mutex_t * p_mutex)); + +/**@brief Attempt to acquire a mutex. + * + * @param[in] p_mutex Pointer to the mutex to acquire. + * + * @retval ::NRF_SUCCESS The mutex was successfully acquired. + * @retval ::NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN The mutex could not be acquired. + */ +SVCALL(SD_MUTEX_ACQUIRE, uint32_t, sd_mutex_acquire(nrf_mutex_t * p_mutex)); + +/**@brief Release a mutex. + * + * @param[in] p_mutex Pointer to the mutex to release. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_MUTEX_RELEASE, uint32_t, sd_mutex_release(nrf_mutex_t * p_mutex)); + +/**@brief Query the capacity of the application random pool. + * + * @param[out] p_pool_capacity The capacity of the pool. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_RAND_APPLICATION_POOL_CAPACITY_GET, uint32_t, sd_rand_application_pool_capacity_get(uint8_t * p_pool_capacity)); + +/**@brief Get number of random bytes available to the application. + * + * @param[out] p_bytes_available The number of bytes currently available in the pool. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_RAND_APPLICATION_BYTES_AVAILABLE_GET, uint32_t, sd_rand_application_bytes_available_get(uint8_t * p_bytes_available)); + +/**@brief Get random bytes from the application pool. + * + * @param[out] p_buff Pointer to unit8_t buffer for storing the bytes. + * @param[in] length Number of bytes to take from pool and place in p_buff. + * + * @retval ::NRF_SUCCESS The requested bytes were written to p_buff. + * @retval ::NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES No bytes were written to the buffer, because there were not enough bytes available. +*/ +SVCALL(SD_RAND_APPLICATION_VECTOR_GET, uint32_t, sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length)); + +/**@brief Gets the reset reason register. + * + * @param[out] p_reset_reason Contents of the NRF_POWER->RESETREAS register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RESET_REASON_GET, uint32_t, sd_power_reset_reason_get(uint32_t * p_reset_reason)); + +/**@brief Clears the bits of the reset reason register. + * + * @param[in] reset_reason_clr_msk Contains the bits to clear from the reset reason register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RESET_REASON_CLR, uint32_t, sd_power_reset_reason_clr(uint32_t reset_reason_clr_msk)); + +/**@brief Sets the power mode when in CPU sleep. + * + * @param[in] power_mode The power mode to use when in CPU sleep, see @ref NRF_POWER_MODES. @sa sd_app_evt_wait + * + * @retval ::NRF_SUCCESS The power mode was set. + * @retval ::NRF_ERROR_SOC_POWER_MODE_UNKNOWN The power mode was unknown. + */ +SVCALL(SD_POWER_MODE_SET, uint32_t, sd_power_mode_set(uint8_t power_mode)); + +/**@brief Puts the chip in System OFF mode. + * + * @retval ::NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN + */ +SVCALL(SD_POWER_SYSTEM_OFF, uint32_t, sd_power_system_off(void)); + +/**@brief Enables or disables the power-fail comparator. + * + * Enabling this will give a softdevice event (NRF_EVT_POWER_FAILURE_WARNING) when the power failure warning occurs. + * The event can be retrieved with sd_evt_get(); + * + * @param[in] pof_enable True if the power-fail comparator should be enabled, false if it should be disabled. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_POF_ENABLE, uint32_t, sd_power_pof_enable(uint8_t pof_enable)); + +/**@brief Sets the power-fail threshold value. + * + * @param[in] threshold The power-fail threshold value to use, see @ref NRF_POWER_THRESHOLDS. + * + * @retval ::NRF_SUCCESS The power failure threshold was set. + * @retval ::NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN The power failure threshold is unknown. + */ +SVCALL(SD_POWER_POF_THRESHOLD_SET, uint32_t, sd_power_pof_threshold_set(uint8_t threshold)); + +/**@brief Sets bits in the NRF_POWER->RAMON register. + * + * @param[in] ramon Contains the bits needed to be set in the NRF_POWER->RAMON register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RAMON_SET, uint32_t, sd_power_ramon_set(uint32_t ramon)); + +/**@brief Clears bits in the NRF_POWER->RAMON register. + * + * @param ramon Contains the bits needed to be cleared in the NRF_POWER->RAMON register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RAMON_CLR, uint32_t, sd_power_ramon_clr(uint32_t ramon)); + +/**@brief Get contents of NRF_POWER->RAMON register, indicates power status of ram blocks. + * + * @param[out] p_ramon Content of NRF_POWER->RAMON register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_RAMON_GET, uint32_t, sd_power_ramon_get(uint32_t * p_ramon)); + +/**@brief Set bits in the general purpose retention registers (NRF_POWER->GPREGRET*). + * + * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. + * @param[in] gpregret_msk Bits to be set in the GPREGRET register. + * + * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_GPREGRET_SET, uint32_t, sd_power_gpregret_set(uint32_t gpregret_id, uint32_t gpregret_msk)); + +/**@brief Clear bits in the general purpose retention registers (NRF_POWER->GPREGRET*). + * + * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. + * @param[in] gpregret_msk Bits to be clear in the GPREGRET register. + * + * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_GPREGRET_CLR, uint32_t, sd_power_gpregret_clr(uint32_t gpregret_id, uint32_t gpregret_msk)); + +/**@brief Get contents of the general purpose retention registers (NRF_POWER->GPREGRET*). + * + * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. + * @param[out] p_gpregret Contents of the GPREGRET register. + * + * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_POWER_GPREGRET_GET, uint32_t, sd_power_gpregret_get(uint32_t gpregret_id, uint32_t *p_gpregret)); + +/**@brief Sets the DCDC mode. + * + * Enable or disable the DCDC peripheral. + * + * @param[in] dcdc_mode The mode of the DCDC, see @ref NRF_POWER_DCDC_MODES. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_PARAM The DCDC mode is invalid. + */ +SVCALL(SD_POWER_DCDC_MODE_SET, uint32_t, sd_power_dcdc_mode_set(uint8_t dcdc_mode)); + +/**@brief Request the high frequency crystal oscillator. + * + * 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. + * + * @see sd_clock_hfclk_is_running + * @see sd_clock_hfclk_release + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_CLOCK_HFCLK_REQUEST, uint32_t, sd_clock_hfclk_request(void)); + +/**@brief Releases the high frequency crystal oscillator. + * + * Will stop the high frequency crystal oscillator, this happens immediately. + * + * @see sd_clock_hfclk_is_running + * @see sd_clock_hfclk_request + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_CLOCK_HFCLK_RELEASE, uint32_t, sd_clock_hfclk_release(void)); + +/**@brief Checks if the high frequency crystal oscillator is running. + * + * @see sd_clock_hfclk_request + * @see sd_clock_hfclk_release + * + * @param[out] p_is_running 1 if the external crystal oscillator is running, 0 if not. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_CLOCK_HFCLK_IS_RUNNING, uint32_t, sd_clock_hfclk_is_running(uint32_t * p_is_running)); + +/**@brief Waits for an application event. + * + * 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). @sa CMSIS_SCB + * + * @note If an application interrupt has happened since the last time sd_app_evt_wait was + * called this function will return immediately and not go to sleep. This is to avoid race + * conditions that can occur when a flag is updated in the interrupt handler and processed + * in the main loop. + * + * @post An application interrupt has happened or a interrupt pending flag is set. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_APP_EVT_WAIT, uint32_t, sd_app_evt_wait(void)); + +/**@brief Get PPI channel enable register contents. + * + * @param[out] p_channel_enable The contents of the PPI CHEN register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_CHANNEL_ENABLE_GET, uint32_t, sd_ppi_channel_enable_get(uint32_t * p_channel_enable)); + +/**@brief Set PPI channel enable register. + * + * @param[in] channel_enable_set_msk Mask containing the bits to set in the PPI CHEN register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_CHANNEL_ENABLE_SET, uint32_t, sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk)); + +/**@brief Clear PPI channel enable register. + * + * @param[in] channel_enable_clr_msk Mask containing the bits to clear in the PPI CHEN register. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_CHANNEL_ENABLE_CLR, uint32_t, sd_ppi_channel_enable_clr(uint32_t channel_enable_clr_msk)); + +/**@brief Assign endpoints to a PPI channel. + * + * @param[in] channel_num Number of the PPI channel to assign. + * @param[in] evt_endpoint Event endpoint of the PPI channel. + * @param[in] task_endpoint Task endpoint of the PPI channel. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_CHANNEL The channel number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_CHANNEL_ASSIGN, uint32_t, sd_ppi_channel_assign(uint8_t channel_num, const volatile void * evt_endpoint, const volatile void * task_endpoint)); + +/**@brief Task to enable a channel group. + * + * @param[in] group_num Number of the channel group. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_GROUP_TASK_ENABLE, uint32_t, sd_ppi_group_task_enable(uint8_t group_num)); + +/**@brief Task to disable a channel group. + * + * @param[in] group_num Number of the PPI group. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_GROUP_TASK_DISABLE, uint32_t, sd_ppi_group_task_disable(uint8_t group_num)); + +/**@brief Assign PPI channels to a channel group. + * + * @param[in] group_num Number of the channel group. + * @param[in] channel_msk Mask of the channels to assign to the group. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_GROUP_ASSIGN, uint32_t, sd_ppi_group_assign(uint8_t group_num, uint32_t channel_msk)); + +/**@brief Gets the PPI channels of a channel group. + * + * @param[in] group_num Number of the channel group. + * @param[out] p_channel_msk Mask of the channels assigned to the group. + * + * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_PPI_GROUP_GET, uint32_t, sd_ppi_group_get(uint8_t group_num, uint32_t * p_channel_msk)); + +/**@brief Configures the Radio Notification signal. + * + * @note + * - The notification signal latency depends on the interrupt priority settings of SWI used + * for notification signal. + * - To ensure that the radio notification signal behaves in a consistent way, always + * configure radio notifications when there is no protocol stack or other SoftDevice + * activity in progress. It is recommended that the radio notification signal is + * configured directly after the SoftDevice has been enabled. + * - In the period between the ACTIVE signal and the start of the Radio Event, the SoftDevice + * will interrupt the application to do Radio Event preparation. + * - Using the Radio Notification feature may limit the bandwidth, as the SoftDevice may have + * to shorten the connection events to have time for the Radio Notification signals. + * + * @param[in] type Type of notification signal, see @ref NRF_RADIO_NOTIFICATION_TYPES. + * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE shall be used to turn off radio + * notification. Using @ref NRF_RADIO_NOTIFICATION_DISTANCE_NONE is + * recommended (but not required) to be used with + * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE. + * + * @param[in] distance Distance between the notification signal and start of radio activity, see @ref NRF_RADIO_NOTIFICATION_DISTANCES. + * This parameter is ignored when @ref NRF_RADIO_NOTIFICATION_TYPE_NONE or + * @ref NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE is used. + * + * @retval ::NRF_ERROR_INVALID_PARAM The group number is invalid. + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_RADIO_NOTIFICATION_CFG_SET, uint32_t, sd_radio_notification_cfg_set(uint8_t type, uint8_t distance)); + +/**@brief Encrypts a block according to the specified parameters. + * + * 128-bit AES encryption. + * + * @note: + * - The application may set the SEVONPEND bit in the SCR to 1 to make the SoftDevice sleep while + * the ECB is running. The SEVONPEND bit should only be cleared (set to 0) from application + * main or low interrupt level. + * + * @param[in, out] p_ecb_data Pointer to the ECB parameters' struct (two input + * parameters and one output parameter). + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_ECB_BLOCK_ENCRYPT, uint32_t, sd_ecb_block_encrypt(nrf_ecb_hal_data_t * p_ecb_data)); + +/**@brief Encrypts multiple data blocks provided as an array of data block structures. + * + * @details: Performs 128-bit AES encryption on multiple data blocks + * + * @note: + * - The application may set the SEVONPEND bit in the SCR to 1 to make the SoftDevice sleep while + * the ECB is running. The SEVONPEND bit should only be cleared (set to 0) from application + * main or low interrupt level. + * + * @param[in] block_count Count of blocks in the p_data_blocks array. + * @param[in,out] p_data_blocks Pointer to the first entry in a contiguous array of + * @ref nrf_ecb_hal_data_block_t structures. + * + * @retval ::NRF_SUCCESS + */ +SVCALL(SD_ECB_BLOCKS_ENCRYPT, uint32_t, sd_ecb_blocks_encrypt(uint8_t block_count, nrf_ecb_hal_data_block_t * p_data_blocks)); + +/**@brief Gets any pending events generated by the SoC API. + * + * The application should keep calling this function to get events, until ::NRF_ERROR_NOT_FOUND is returned. + * + * @param[out] p_evt_id Set to one of the values in @ref NRF_SOC_EVTS, if any events are pending. + * + * @retval ::NRF_SUCCESS An event was pending. The event id is written in the p_evt_id parameter. + * @retval ::NRF_ERROR_NOT_FOUND No pending events. + */ +SVCALL(SD_EVT_GET, uint32_t, sd_evt_get(uint32_t * p_evt_id)); + +/**@brief Get the temperature measured on the chip + * + * This function will block until the temperature measurement is done. + * It takes around 50us from call to return. + * + * @param[out] p_temp Result of temperature measurement. Die temperature in 0.25 degrees celsius. + * + * @retval ::NRF_SUCCESS A temperature measurement was done, and the temperature was written to temp + */ +SVCALL(SD_TEMP_GET, uint32_t, sd_temp_get(int32_t * p_temp)); + +/**@brief Flash Write +* +* Commands to write a buffer to flash +* +* If the SoftDevice is enabled: +* This call initiates the flash access command, and its completion will be communicated to the +* application with exactly one of the following events: +* - @ref NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed. +* - @ref NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started. +* +* If the SoftDevice is not enabled no event will be generated, and this call will return @ref NRF_SUCCESS when the + * write has been completed +* +* @note +* - This call takes control over the radio and the CPU during flash erase and write to make sure that +* they will not interfere with the flash access. This means that all interrupts will be blocked +* for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual +* and the command parameters). +* - The data in the p_src buffer should not be modified before the @ref NRF_EVT_FLASH_OPERATION_SUCCESS +* or the @ref NRF_EVT_FLASH_OPERATION_ERROR have been received if the SoftDevice is enabled. +* +* +* @param[in] p_dst Pointer to start of flash location to be written. +* @param[in] p_src Pointer to buffer with data to be written. +* @param[in] size Number of 32-bit words to write. Maximum size is 256 32-bit words for nRF51 and 1024 for nRF52. +* +* @retval ::NRF_ERROR_INVALID_ADDR Tried to write to a non existing flash address, or p_dst or p_src was unaligned. +* @retval ::NRF_ERROR_BUSY The previous command has not yet completed. +* @retval ::NRF_ERROR_INVALID_LENGTH Size was 0, or higher than the maximum allowed size. +* @retval ::NRF_ERROR_FORBIDDEN Tried to write to or read from protected location. +* @retval ::NRF_SUCCESS The command was accepted. +*/ +SVCALL(SD_FLASH_WRITE, uint32_t, sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size)); + + +/**@brief Flash Erase page +* +* Commands to erase a flash page +* If the SoftDevice is enabled: +* This call initiates the flash access command, and its completion will be communicated to the +* application with exactly one of the following events: +* - @ref NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed. +* - @ref NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started. +* +* If the SoftDevice is not enabled no event will be generated, and this call will return @ref NRF_SUCCESS when the +* erase has been completed +* +* @note +* - This call takes control over the radio and the CPU during flash erase and write to make sure that +* they will not interfere with the flash access. This means that all interrupts will be blocked +* for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual +* and the command parameters). +* +* +* @param[in] page_number Pagenumber of the page to erase +* @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error. +* @retval ::NRF_ERROR_INVALID_ADDR Tried to erase to a non existing flash page. +* @retval ::NRF_ERROR_BUSY The previous command has not yet completed. +* @retval ::NRF_ERROR_FORBIDDEN Tried to erase a protected page. +* @retval ::NRF_SUCCESS The command was accepted. +*/ +SVCALL(SD_FLASH_PAGE_ERASE, uint32_t, sd_flash_page_erase(uint32_t page_number)); + + +/**@brief Flash Protection set + * + * Commands to set the flash protection configuration registers. + On nRF51 this sets the PROTENSETx registers of the MPU peripheral. + On nRF52 this sets the CONFIGx registers of the BPROT peripheral. + * + * @note To read the values read them directly. They are only write-protected. + * + * @param[in] block_cfg0 Value to be written to the configuration register. + * @param[in] block_cfg1 Value to be written to the configuration register. + * @param[in] block_cfg2 Value to be written to the configuration register (ignored on nRF51). + * @param[in] block_cfg3 Value to be written to the configuration register (ignored on nRF51). + * + * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice. + * @retval ::NRF_SUCCESS Values successfully written to configuration registers. + */ +SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t block_cfg0, uint32_t block_cfg1, uint32_t block_cfg2, uint32_t block_cfg3)); + +/**@brief Opens a session for radio timeslot requests. + * + * @note Only one session can be open at a time. + * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START) will be called when the radio timeslot + * starts. From this point the NRF_RADIO and NRF_TIMER0 peripherals can be freely accessed + * by the application. + * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0) is called whenever the NRF_TIMER0 + * interrupt occurs. + * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO) is called whenever the NRF_RADIO + * interrupt occurs. + * @note p_radio_signal_callback() will be called at ARM interrupt priority level 0. This + * implies that none of the sd_* API calls can be used from p_radio_signal_callback(). + * + * @param[in] p_radio_signal_callback The signal callback. + * + * @retval ::NRF_ERROR_INVALID_ADDR p_radio_signal_callback is an invalid function pointer. + * @retval ::NRF_ERROR_BUSY If session cannot be opened. + * @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error. + * @retval ::NRF_SUCCESS Otherwise. + */ + SVCALL(SD_RADIO_SESSION_OPEN, uint32_t, sd_radio_session_open(nrf_radio_signal_callback_t p_radio_signal_callback)); + +/**@brief Closes a session for radio timeslot requests. + * + * @note Any current radio timeslot will be finished before the session is closed. + * @note If a radio timeslot is scheduled when the session is closed, it will be canceled. + * @note The application cannot consider the session closed until the @ref NRF_EVT_RADIO_SESSION_CLOSED + * event is received. + * + * @retval ::NRF_ERROR_FORBIDDEN If session not opened. + * @retval ::NRF_ERROR_BUSY If session is currently being closed. + * @retval ::NRF_SUCCESS Otherwise. + */ + SVCALL(SD_RADIO_SESSION_CLOSE, uint32_t, sd_radio_session_close(void)); + +/**@brief Requests a radio timeslot. + * + * @note The request type is determined by p_request->request_type, and can be one of @ref NRF_RADIO_REQ_TYPE_EARLIEST + * and @ref NRF_RADIO_REQ_TYPE_NORMAL. The first request in a session must always be of type @ref NRF_RADIO_REQ_TYPE_EARLIEST. + * @note For a normal request (@ref NRF_RADIO_REQ_TYPE_NORMAL), the start time of a radio timeslot is specified by + * p_request->distance_us and is given relative to the start of the previous timeslot. + * @note A too small p_request->distance_us will lead to a @ref NRF_EVT_RADIO_BLOCKED event. + * @note Timeslots scheduled too close will lead to a @ref NRF_EVT_RADIO_BLOCKED event. + * @note See the SoftDevice Specification for more on radio timeslot scheduling, distances and lengths. + * @note If an opportunity for the first radio timeslot is not found before 100ms after the call to this + * function, it is not scheduled, and instead a @ref NRF_EVT_RADIO_BLOCKED event is sent. + * The application may then try to schedule the first radio timeslot again. + * @note Successful requests will result in nrf_radio_signal_callback_t(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START). + * Unsuccessful requests will result in a @ref NRF_EVT_RADIO_BLOCKED event, see @ref NRF_SOC_EVTS. + * @note The jitter in the start time of the radio timeslots is +/- @ref NRF_RADIO_START_JITTER_US us. + * @note The nrf_radio_signal_callback_t(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START) call has a latency relative to the + * specified radio timeslot start, but this does not affect the actual start time of the timeslot. + * @note NRF_TIMER0 is reset at the start of the radio timeslot, and is clocked at 1MHz from the high frequency + * (16 MHz) clock source. If p_request->hfclk_force_xtal is true, the high frequency clock is + * guaranteed to be clocked from the external crystal. + * @note The SoftDevice will neither access the NRF_RADIO peripheral nor the NRF_TIMER0 peripheral + * during the radio timeslot. + * + * @param[in] p_request Pointer to the request parameters. + * + * @retval ::NRF_ERROR_FORBIDDEN If session not opened or the session is not IDLE. + * @retval ::NRF_ERROR_INVALID_ADDR If the p_request pointer is invalid. + * @retval ::NRF_ERROR_INVALID_PARAM If the parameters of p_request are not valid. + * @retval ::NRF_SUCCESS Otherwise. + */ + SVCALL(SD_RADIO_REQUEST, uint32_t, sd_radio_request(nrf_radio_request_t * p_request )); + +/**@} */ + +#ifdef __cplusplus +} +#endif +#endif // NRF_SOC_H__ + +/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_svc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_svc.h new file mode 100644 index 0000000000..9d62a02581 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_svc.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_SVC__ +#define NRF_SVC__ + +#include "stdint.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SVCALL_AS_NORMAL_FUNCTION +#define SVCALL(number, return_type, signature) return_type signature +#else + +#ifndef SVCALL +#if defined (__CC_ARM) +#define SVCALL(number, return_type, signature) return_type __svc(number) signature +#elif defined (__GNUC__) +#ifdef __cplusplus +#define GCC_CAST_CPP (uint16_t) +#else +#define GCC_CAST_CPP +#endif +#define SVCALL(number, return_type, signature) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + __attribute__((naked)) \ + __attribute__((unused)) \ + static return_type signature \ + { \ + __asm( \ + "svc %0\n" \ + "bx r14" : : "I" (GCC_CAST_CPP number) : "r0" \ + ); \ + } \ + _Pragma("GCC diagnostic pop") + +#elif defined (__ICCARM__) +#define PRAGMA(x) _Pragma(#x) +#define SVCALL(number, return_type, signature) \ +PRAGMA(swi_number = (number)) \ + __swi return_type signature; +#else +#define SVCALL(number, return_type, signature) return_type signature +#endif +#endif // SVCALL + +#endif // SVCALL_AS_NORMAL_FUNCTION + +#ifdef __cplusplus +} +#endif +#endif // NRF_SVC__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/copyright_header.txt b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/copyright_header.txt new file mode 100644 index 0000000000..d7e5224ea7 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/copyright_header.txt @@ -0,0 +1,37 @@ +/* + * Copyright (c) Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ \ No newline at end of file diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/replace_headers.py b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/replace_headers.py new file mode 100644 index 0000000000..6e13fd632d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/replace_headers.py @@ -0,0 +1,48 @@ +import os +import re + + + + +def replace_header(in_path): + with open("copyright_header.txt", "r") as fd: + header = fd.read() + + for root, dirs, files in os.walk(in_path): + for fn in [os.path.join(root, x) for x in files]: + with open(fn, "r+") as fd: + #print fn + s = fd.read() + start = s.find("/*") + end = s.find("*/") + copyright_str = s[start:end+2] + if ("copyright (c)" in copyright_str.lower()) and ("nordic semiconductor" in copyright_str.lower()): + + + pat_reg = r"copyright \(c\)[\s]{1,5}([0-9]{4})" + find_obj = re.search(pat_reg, copyright_str.lower()) + + if find_obj == None: + header_year = re.sub(r'()',"2000",header) + print "default date>>" + fn + else: + header_year = re.sub(r'()',find_obj.group(1),header) + + s = s.replace(copyright_str, header_year) + + #print(header_year) + + fd.seek(0) + fd.write(s) + fd.truncate() + + ##print "+"*35 + print fn + + +pathes = ["C:/mbed/mbed-os/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk", + "C:/mbed/mbed-os/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832\sdk", + "C:/mbed/mbed-os/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840\sdk"] + +for path in pathes: + replace_header(path) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk_update.py b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk_update.py rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/update_desc.json b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/update_desc.json similarity index 96% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/update_desc.json rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/update_desc.json index 526a608671..0caeea001f 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/update_desc.json +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/update_desc.json @@ -107,13 +107,13 @@ {"sdk_dir": "libraries\\svc", "mbed_dir": "sdk\\libraries\\svc"}, {"sdk_dir": "ble\\ble_services\\ble_dfu", "mbed_dir": "ble\\ble_services\\ble_dfu"}, {"sdk_dir": "libraries\\bootloader", "mbed_dir": "libraries\\bootloader"}, - {"sdk_dir": "softdevice\\s140", "mbed_dir": "TARGET_MCU_NRF52840\\sdk\\softdevice\\s140"} + {"sdk_dir": "softdevice\\s140", "mbed_dir": "TARGET_MCU_NRF52840\\sdk\\softdevice\\s140"}, + {"sdk_dir": "softdevice\\s140\\nrf52", "mbed_dir": "TARGET_MCU_NRF52840\\sdk\\softdevice\\s140\\nrf52"} ], "sdk_dirs_in_mbed" : [ - "sdk", - ""TARGET_MCU_NRF52832\\sdk" - + "..\\sdk", + "..\\TARGET_MCU_NRF52832\\sdk" ], "sdk_component_path": "C:\\nRF5_SDK_13.0.0-1.alpha_055eef3\\components" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.c index 39a60f7d1c..075228fd49 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.c @@ -35,75 +35,98 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(BLE_ADVERTISING) #include "ble_advdata.h" #include "ble_advertising.h" #include "nrf_soc.h" #include "nrf_log.h" -#include "pstorage.h" #include "fstorage.h" -#include "sdk_common.h" +#include "sdk_errors.h" -#define ADV_LOG(...) - -static bool m_advertising_start_pending = false; /**< Flag to keep track of ongoing operations on persistent memory. */ - -static ble_gap_addr_t m_peer_address; /**< Address of the most recently connected peer, used for direct advertising. */ -static ble_advdata_t m_advdata; /**< Used by the initialization function to set name, appearance, and UUIDs and advertising flags visible to peer devices. */ -static ble_adv_evt_t m_adv_evt; /**< Advertising event propogated to the main application. The event is either a transaction to a new advertising mode, or a request for whitelist or peer address.. */ -static ble_advertising_evt_handler_t m_evt_handler; /**< Handler for the advertising events. Can be initialized as NULL if no handling is implemented on in the main application. */ -static ble_advertising_error_handler_t m_error_handler; /**< Handler for the advertising error events. */ - -static ble_adv_mode_t m_adv_mode_current; /**< Variable to keep track of the current advertising mode. */ -static ble_adv_modes_config_t m_adv_modes_config; /**< Struct to keep track of disabled and enabled advertising modes, as well as time-outs and intervals.*/ - -static ble_gap_whitelist_t m_whitelist; /**< Struct that points to whitelisted addresses. */ -static ble_gap_addr_t * mp_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; /**< Pointer to a list of addresses. Pointed to by the whitelist */ -static ble_gap_irk_t * mp_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; /**< Pointer to a list of Identity Resolving Keys (IRK). Pointed to by the whitelist */ -static bool m_whitelist_temporarily_disabled = false; /**< Flag to keep track of temporary disabling of the whitelist. */ -static bool m_whitelist_reply_expected = false; /**< Flag to verify that whitelist is only set when it is requested. */ -static bool m_peer_addr_reply_expected = false; /**< Flag to verify that peer address is only set when requested. */ - -static ble_advdata_manuf_data_t m_manuf_specific_data; /**< Manufacturer specific data structure*/ -static uint8_t m_manuf_data_array[BLE_GAP_ADV_MAX_SIZE]; /**< Array to store the Manufacturer specific data*/ -static ble_advdata_service_data_t m_service_data; /**< Service data structure. */ -static uint8_t m_service_data_array[BLE_GAP_ADV_MAX_SIZE]; /**< Array to store the service data. */ -static ble_advdata_conn_int_t m_slave_conn_int; /**< Connection interval range structure.*/ -static int8_t m_tx_power_level; /**< TX power level*/ +// Total number of possible advertising modes. +#define BLE_ADV_MODES (5) -/**@brief Function for checking that the whitelist has entries. - */ -static bool whitelist_has_entries(ble_gap_whitelist_t const * whitelist) -{ - if ((whitelist->addr_count != 0) || (whitelist->irk_count != 0)) +static bool m_initialized; +static bool m_advertising_start_pending; /**< Flag to keep track of ongoing operations in flash. */ + +static ble_adv_evt_t m_adv_evt; /**< Advertising event propogated to the main application. The event is either a transaction to a new advertising mode, or a request for whitelist or peer address. */ + +static ble_adv_mode_t m_adv_mode_current; /**< Variable to keep track of the current advertising mode. */ +static ble_adv_modes_config_t m_adv_modes_config; /**< Struct to keep track of disabled and enabled advertising modes, as well as time-outs and intervals.*/ + +static ble_gap_addr_t m_peer_address; /**< Address of the most recently connected peer, used for direct advertising. */ +static bool m_peer_addr_reply_expected; /**< Flag to verify that peer address is only set when requested. */ + +static ble_advdata_t m_advdata; /**< Used by the initialization function to set name, appearance, and UUIDs and advertising flags visible to peer devices. */ +static ble_advdata_manuf_data_t m_manuf_specific_data; /**< Manufacturer specific data structure*/ +static uint8_t m_manuf_data_array[BLE_GAP_ADV_MAX_SIZE]; /**< Array to store the Manufacturer specific data*/ +static ble_advdata_service_data_t m_service_data; /**< Service data structure. */ +static uint8_t m_service_data_array[BLE_GAP_ADV_MAX_SIZE]; /**< Array to store the service data. */ +static ble_advdata_conn_int_t m_slave_conn_int; /**< Connection interval range structure.*/ +static uint16_t m_current_slave_link_conn_handle; /**< Connection handle for the active link. */ + +static ble_advertising_evt_handler_t m_evt_handler; /**< Handler for the advertising events. Can be initialized as NULL if no handling is implemented on in the main application. */ +static ble_advertising_error_handler_t m_error_handler; /**< Handler for the advertising error events. */ + +static bool m_whitelist_temporarily_disabled; /**< Flag to keep track of temporary disabling of the whitelist. */ +static bool m_whitelist_reply_expected; + +#if (NRF_SD_BLE_API_VERSION <= 2) + + // For SoftDevices v 2.x, this module caches a whitelist which is retrieved from the + // application using an event, and which is passed as a parameter when calling + // sd_ble_gap_adv_start(). + + static ble_gap_addr_t * m_p_whitelist_addrs[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + static ble_gap_irk_t * m_p_whitelist_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + static ble_gap_addr_t m_whitelist_addrs[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + static ble_gap_irk_t m_whitelist_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + static ble_gap_whitelist_t m_whitelist = { - return true; + .pp_addrs = m_p_whitelist_addrs, + .pp_irks = m_p_whitelist_irks + }; + +#else + + // For SoftDevices v 3.x, this module does not need to cache a whitelist, but it needs to + // be aware of whether or not a whitelist has been set (e.g. using the Peer Manager) + // in order to start advertising with the proper advertising params (filter policy). + + static bool m_whitelist_in_use; + +#endif + + +#if (NRF_SD_BLE_API_VERSION <= 2) + + static bool whitelist_has_entries() + { + return ((m_whitelist.addr_count != 0) || (m_whitelist.irk_count != 0)); } - return false; -} +#else -/**@brief Function for setting the stored peer address back to zero. - */ -static void ble_advertising_peer_address_clear() -{ - memset(&m_peer_address, 0, sizeof(m_peer_address)); -} - - -/**@brief Function for checking if an address is non-zero. Used to determine if - */ -static bool peer_address_exists(uint8_t const * address) -{ - uint32_t i; - - for (i = 0; i < BLE_GAP_ADDR_LEN; i++) + static bool whitelist_has_entries() { - if (address[i] != 0) + return m_whitelist_in_use; + } + +#endif + + + +/**@brief Function for checking if an address is valid. + */ +static bool addr_is_valid(uint8_t const * const addr) +{ + for (uint32_t i = 0; i < BLE_GAP_ADDR_LEN; i++) + { + if (addr[i] != 0) { return true; } @@ -112,61 +135,302 @@ static bool peer_address_exists(uint8_t const * address) } -uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, - ble_advdata_t const * p_srdata, - ble_adv_modes_config_t const * p_config, - ble_advertising_evt_handler_t const evt_handler, - ble_advertising_error_handler_t const error_handler) +static ble_adv_mode_t adv_mode_next_get(ble_adv_mode_t adv_mode) { - uint32_t err_code; + return (ble_adv_mode_t)((adv_mode + 1) % BLE_ADV_MODES); +} - VERIFY_PARAM_NOT_NULL(p_advdata); - VERIFY_PARAM_NOT_NULL(p_config); - m_adv_mode_current = BLE_ADV_MODE_IDLE; - m_evt_handler = evt_handler; - m_error_handler = error_handler; - m_adv_modes_config = *p_config; +/**@brief Function for handling the Connected event. + * + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connected(ble_evt_t const * p_ble_evt) +{ + if (p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_PERIPH) + { + m_current_slave_link_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + } +} - ble_advertising_peer_address_clear(); - // Prepare Whitelist. Address and IRK double pointers point to allocated arrays. - m_whitelist.pp_addrs = mp_whitelist_addr; - m_whitelist.pp_irks = mp_whitelist_irk; +/**@brief Function for handling the Disconnected event. + * + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnected(ble_evt_t const * p_ble_evt) +{ + uint32_t ret; - // Copy and set advertising data. - memset(&m_advdata, 0, sizeof(m_advdata)); + m_whitelist_temporarily_disabled = false; + + if (p_ble_evt->evt.gap_evt.conn_handle == m_current_slave_link_conn_handle) + { + ret = ble_advertising_start(BLE_ADV_MODE_DIRECTED); + if ((ret != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(ret); + } + } +} + + +/**@brief Function for handling the Timeout event. + * + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_timeout(ble_evt_t const * p_ble_evt) +{ + ret_code_t ret; + + if (p_ble_evt->evt.gap_evt.params.timeout.src != BLE_GAP_TIMEOUT_SRC_ADVERTISING) + { + // Nothing to do. + return; + } + + // Start advertising in the next mode. + ret = ble_advertising_start(adv_mode_next_get(m_adv_mode_current)); + + if ((ret != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(ret); + } +} + + +/** @brief Function to determine if a flash write operation in in progress. + * + * @return true if a flash operation is in progress, false if not. + */ +static bool flash_access_in_progress() +{ + uint32_t count; + + (void)fs_queued_op_count_get(&count); + + return (count != 0); +} + + +/**@brief Get the next available advertising mode. + * + * @param[in] adv_mode Requested advertising mode. + * + * @returns adv_mode if possible, or the best available mode if not. + */ +static ble_adv_mode_t adv_mode_next_avail_get(ble_adv_mode_t adv_mode) +{ + bool peer_addr_is_valid = addr_is_valid(m_peer_address.addr); + + // If a mode is disabled, continue to the next mode. + + switch (adv_mode) + { + case BLE_ADV_MODE_DIRECTED: + if ((m_adv_modes_config.ble_adv_directed_enabled) && peer_addr_is_valid) + { + return BLE_ADV_MODE_DIRECTED; + } + // Fallthrough. + + case BLE_ADV_MODE_DIRECTED_SLOW: + if ((m_adv_modes_config.ble_adv_directed_slow_enabled) && peer_addr_is_valid) + { + return BLE_ADV_MODE_DIRECTED_SLOW; + } + // Fallthrough. + + case BLE_ADV_MODE_FAST: + if (m_adv_modes_config.ble_adv_fast_enabled) + { + return BLE_ADV_MODE_FAST; + } + // Fallthrough. + + case BLE_ADV_MODE_SLOW: + if (m_adv_modes_config.ble_adv_slow_enabled) + { + return BLE_ADV_MODE_SLOW; + } + // Fallthrough. + + default: + return BLE_ADV_MODE_IDLE; + } +} + + +/**@brief Function for starting directed advertising. + * + * @param[out] p_adv_params Advertising parameters. + * + * @return NRF_SUCCESS + */ +static ret_code_t set_adv_mode_directed(ble_gap_adv_params_t * p_adv_params) +{ + m_adv_evt = BLE_ADV_EVT_DIRECTED; + + p_adv_params->p_peer_addr = &m_peer_address; + p_adv_params->type = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND; + p_adv_params->timeout = 0; + p_adv_params->interval = 0; + + return NRF_SUCCESS; +} + + +/**@brief Function for starting directed slow advertising. + * + * @param[out] p_adv_params Advertising parameters. + * + * @return NRF_SUCCESS + */ +static ret_code_t set_adv_mode_directed_slow(ble_gap_adv_params_t * p_adv_params) +{ + m_adv_evt = BLE_ADV_EVT_DIRECTED_SLOW; + + p_adv_params->p_peer_addr = &m_peer_address; + p_adv_params->type = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND; + p_adv_params->timeout = m_adv_modes_config.ble_adv_directed_slow_timeout; + p_adv_params->interval = m_adv_modes_config.ble_adv_directed_slow_interval; + + return NRF_SUCCESS; +} + + +/**@brief Function for starting fast advertising. + * + * @param[out] p_adv_params Advertising parameters. + * + * @return NRF_SUCCESS or an error from @ref ble_advdata_set(). + */ +static ret_code_t set_adv_mode_fast(ble_gap_adv_params_t * p_adv_params) +{ + ret_code_t ret; + + p_adv_params->interval = m_adv_modes_config.ble_adv_fast_interval; + p_adv_params->timeout = m_adv_modes_config.ble_adv_fast_timeout; + + if ((m_adv_modes_config.ble_adv_whitelist_enabled) && + (!m_whitelist_temporarily_disabled) && + (whitelist_has_entries())) + { + #if (NRF_SD_BLE_API_VERSION <= 2) + p_adv_params->p_whitelist = &m_whitelist; + #endif + + p_adv_params->fp = BLE_GAP_ADV_FP_FILTER_CONNREQ; + m_advdata.flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; + + ret = ble_advdata_set(&m_advdata, NULL); + if (ret != NRF_SUCCESS) + { + return ret; + } + + m_adv_evt = BLE_ADV_EVT_FAST_WHITELIST; + } + else + { + m_adv_evt = BLE_ADV_EVT_FAST; + } + + return NRF_SUCCESS; +} + + +/**@brief Function for starting slow advertising. + * + * @param[out] p_adv_params Advertising parameters. + * + * @return NRF_SUCCESS or an error from @ref ble_advdata_set(). + */ +static ret_code_t set_adv_mode_slow(ble_gap_adv_params_t * p_adv_params) +{ + ret_code_t ret; + + p_adv_params->interval = m_adv_modes_config.ble_adv_slow_interval; + p_adv_params->timeout = m_adv_modes_config.ble_adv_slow_timeout; + + if ((m_adv_modes_config.ble_adv_whitelist_enabled) && + (!m_whitelist_temporarily_disabled) && + (whitelist_has_entries())) + { + #if (NRF_SD_BLE_API_VERSION <= 2) + { + p_adv_params->p_whitelist = &m_whitelist; + } + #endif + + p_adv_params->fp = BLE_GAP_ADV_FP_FILTER_CONNREQ; + m_advdata.flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; + + ret = ble_advdata_set(&m_advdata, NULL); + if (ret != NRF_SUCCESS) + { + return ret; + } + + m_adv_evt = BLE_ADV_EVT_SLOW_WHITELIST; + } + else + { + m_adv_evt = BLE_ADV_EVT_SLOW; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, + ble_advdata_t const * p_srdata, + ble_adv_modes_config_t const * p_config, + ble_advertising_evt_handler_t const evt_handler, + ble_advertising_error_handler_t const error_handler) +{ + uint32_t ret; + + if ((p_advdata == NULL) || (p_config == NULL)) + { + return NRF_ERROR_NULL; + } + + m_initialized = true; + m_adv_mode_current = BLE_ADV_MODE_IDLE; + m_adv_modes_config = *p_config; + m_evt_handler = evt_handler; + m_error_handler = error_handler; + m_current_slave_link_conn_handle = BLE_CONN_HANDLE_INVALID; + + memset(&m_peer_address, 0, sizeof(m_peer_address)); + memset(&m_advdata, 0, sizeof(m_advdata)); // Copy advertising data. m_advdata.name_type = p_advdata->name_type; m_advdata.include_appearance = p_advdata->include_appearance; m_advdata.flags = p_advdata->flags; m_advdata.short_name_len = p_advdata->short_name_len; - /* - if(p_advdata->uuids_complete != NULL) - { - m_advdata.uuids_complete = p_advdata->uuids_complete; - } - */ + m_advdata.uuids_complete = p_advdata->uuids_complete; m_advdata.uuids_more_available = p_advdata->uuids_more_available; m_advdata.uuids_solicited = p_advdata->uuids_solicited; - - if(p_advdata->p_manuf_specific_data != NULL) + + if (p_advdata->p_manuf_specific_data != NULL) { m_advdata.p_manuf_specific_data = &m_manuf_specific_data; m_manuf_specific_data.data.p_data = m_manuf_data_array; m_advdata.p_manuf_specific_data->company_identifier = p_advdata->p_manuf_specific_data->company_identifier; m_advdata.p_manuf_specific_data->data.size = p_advdata->p_manuf_specific_data->data.size; - - for(uint32_t i = 0; i < m_advdata.p_manuf_specific_data->data.size; i++) + + for (uint32_t i = 0; i < m_advdata.p_manuf_specific_data->data.size; i++) { m_manuf_data_array[i] = p_advdata->p_manuf_specific_data->data.p_data[i]; } } - - if(p_advdata->p_service_data_array != NULL) + + if (p_advdata->p_service_data_array != NULL) { m_service_data.data.p_data = m_service_data_array; m_advdata.p_service_data_array = &m_service_data; @@ -174,7 +438,7 @@ uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, m_advdata.p_service_data_array->data.size = p_advdata->p_service_data_array->data.size; m_advdata.p_service_data_array->service_uuid = p_advdata->p_service_data_array->service_uuid; - for(uint32_t i = 0; i < m_advdata.p_service_data_array->data.size; i++) + for (uint32_t i = 0; i < m_advdata.p_service_data_array->data.size; i++) { m_service_data_array[i] = p_advdata->p_service_data_array->data.p_data[i]; } @@ -182,79 +446,55 @@ uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, m_advdata.service_data_count = p_advdata->service_data_count; } - - if(p_advdata->p_slave_conn_int != NULL) + if (p_advdata->p_slave_conn_int != NULL) { m_advdata.p_slave_conn_int = &m_slave_conn_int; m_advdata.p_slave_conn_int->max_conn_interval = p_advdata->p_slave_conn_int->max_conn_interval; m_advdata.p_slave_conn_int->min_conn_interval = p_advdata->p_slave_conn_int->min_conn_interval; } - - if(p_advdata->p_tx_power_level != NULL) - { - m_advdata.p_tx_power_level = &m_tx_power_level; - m_advdata.p_tx_power_level = p_advdata->p_tx_power_level; - } - err_code = ble_advdata_set(&m_advdata, p_srdata); - return err_code; -} -/** @brief Function to determine if a flash access in in progress. If it is the case, we can not -* start advertising until it is finished. attempted restart -* in @ref ble_advertising_on_sys_evt -* -* @return true if a flash access is in progress, false if not. -*/ -static bool flash_access_in_progress() -{ - uint32_t err_code; - uint32_t count = 0; - - err_code = pstorage_access_status_get(&count); - if ((err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_SUCCESS)) + if (p_advdata->p_tx_power_level != NULL) { - ADV_LOG("[ADV]: pstorage_access_status_get returned %d.\r\n", err_code); - return true; + m_advdata.p_tx_power_level = p_advdata->p_tx_power_level; } - if (err_code == NRF_ERROR_INVALID_STATE) - { - err_code = fs_queued_op_count_get(&count); - if (err_code != FS_SUCCESS) +#if (NRF_SD_BLE_API_VERSION <= 2) + for (int i = 0; i = 3) + m_whitelist_in_use = false; + #endif m_whitelist_reply_expected = true; m_evt_handler(BLE_ADV_EVT_WHITELIST_REQUEST); } @@ -310,88 +534,45 @@ uint32_t ble_advertising_start(ble_adv_mode_t advertising_mode) // Initialize advertising parameters with default values. memset(&adv_params, 0, sizeof(adv_params)); - adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND; - adv_params.p_peer_addr = NULL; - adv_params.fp = BLE_GAP_ADV_FP_ANY; - adv_params.p_whitelist = NULL; + adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND; + adv_params.fp = BLE_GAP_ADV_FP_ANY; // Set advertising parameters and events according to selected advertising mode. switch (m_adv_mode_current) { case BLE_ADV_MODE_DIRECTED: - ADV_LOG("[ADV]: Starting direct advertisement.\r\n"); - adv_params.p_peer_addr = &m_peer_address; // Directed advertising. - adv_params.type = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND; - adv_params.timeout = 0; - adv_params.interval = 0; - m_adv_evt = BLE_ADV_EVT_DIRECTED; + ret = set_adv_mode_directed(&adv_params); break; case BLE_ADV_MODE_DIRECTED_SLOW: - ADV_LOG("[ADV]: Starting direct advertisement.\r\n"); - adv_params.p_peer_addr = &m_peer_address; // Directed advertising. - adv_params.type = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND; - adv_params.timeout = m_adv_modes_config.ble_adv_directed_slow_timeout; - adv_params.interval = m_adv_modes_config.ble_adv_directed_slow_interval; - m_adv_evt = BLE_ADV_EVT_DIRECTED_SLOW; + ret = set_adv_mode_directed_slow(&adv_params); break; case BLE_ADV_MODE_FAST: - adv_params.timeout = m_adv_modes_config.ble_adv_fast_timeout; - adv_params.interval = m_adv_modes_config.ble_adv_fast_interval; - - if ( whitelist_has_entries(&m_whitelist) - && m_adv_modes_config.ble_adv_whitelist_enabled - && !m_whitelist_temporarily_disabled) - { - adv_params.fp = BLE_GAP_ADV_FP_FILTER_CONNREQ; - adv_params.p_whitelist = &m_whitelist; - m_advdata.flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; - err_code = ble_advdata_set(&m_advdata, NULL); - VERIFY_SUCCESS(err_code); - - m_adv_evt = BLE_ADV_EVT_FAST_WHITELIST; - ADV_LOG("[ADV]: Starting fast advertisement with whitelist.\r\n"); - } - else - { - m_adv_evt = BLE_ADV_EVT_FAST; - ADV_LOG("[ADV]: Starting fast advertisement.\r\n"); - } + ret = set_adv_mode_fast(&adv_params); break; case BLE_ADV_MODE_SLOW: - adv_params.interval = m_adv_modes_config.ble_adv_slow_interval; - adv_params.timeout = m_adv_modes_config.ble_adv_slow_timeout; + ret = set_adv_mode_slow(&adv_params); + break; - if ( whitelist_has_entries(&m_whitelist) - && m_adv_modes_config.ble_adv_whitelist_enabled - && !m_whitelist_temporarily_disabled) - { - adv_params.fp = BLE_GAP_ADV_FP_FILTER_CONNREQ; - adv_params.p_whitelist = &m_whitelist; - m_advdata.flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; - err_code = ble_advdata_set(&m_advdata, NULL); - VERIFY_SUCCESS(err_code); - - m_adv_evt = BLE_ADV_EVT_SLOW_WHITELIST; - ADV_LOG("[ADV]: Starting slow advertisement with whitelist.\r\n"); - } - else - { - m_adv_evt = BLE_ADV_EVT_SLOW; - ADV_LOG("[ADV]: Starting slow advertisement.\r\n"); - } + case BLE_ADV_MODE_IDLE: + m_adv_evt = BLE_ADV_EVT_IDLE; break; default: break; } + if (m_adv_mode_current != BLE_ADV_MODE_IDLE) { - err_code = sd_ble_gap_adv_start(&adv_params); - VERIFY_SUCCESS(err_code); + ret = sd_ble_gap_adv_start(&adv_params); + if (ret != NRF_SUCCESS) + { + return ret; + } } + if (m_evt_handler != NULL) { m_evt_handler(m_adv_evt); @@ -403,112 +584,44 @@ uint32_t ble_advertising_start(ble_adv_mode_t advertising_mode) void ble_advertising_on_ble_evt(ble_evt_t const * p_ble_evt) { - static uint16_t current_slave_link_conn_handle = BLE_CONN_HANDLE_INVALID; - switch (p_ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: - if (p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_PERIPH) - { - current_slave_link_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; - } + on_connected(p_ble_evt); break; // Upon disconnection, whitelist will be activated and direct advertising is started. case BLE_GAP_EVT_DISCONNECTED: - { - uint32_t err_code; - m_whitelist_temporarily_disabled = false; - - if (p_ble_evt->evt.gap_evt.conn_handle == current_slave_link_conn_handle) - { - err_code = ble_advertising_start(BLE_ADV_MODE_DIRECTED); - if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) - { - m_error_handler(err_code); - } - } + on_disconnected(p_ble_evt); break; - } - // Upon time-out, the next advertising mode is started, i.e. go from fast to slow or from slow to idle. - case BLE_GAP_EVT_TIMEOUT: - if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING) - { - switch (m_adv_mode_current) - { - case BLE_ADV_MODE_DIRECTED: - ADV_LOG("[ADV]: Timed out from directed advertising.\r\n"); - { - uint32_t err_code; - err_code = ble_advertising_start(BLE_ADV_MODE_DIRECTED_SLOW); - if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) - { - m_error_handler(err_code); - } - } - break; - case BLE_ADV_MODE_DIRECTED_SLOW: - ADV_LOG("[ADV]: Timed out from directed slow advertising.\r\n"); - { - uint32_t err_code; - err_code = ble_advertising_start(BLE_ADV_MODE_FAST); - if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) - { - m_error_handler(err_code); - } - } - break; - case BLE_ADV_MODE_FAST: - { - uint32_t err_code; - m_adv_evt = BLE_ADV_EVT_FAST; - ADV_LOG("[ADV]: Timed out from fast advertising, starting slow advertising.\r\n"); - err_code = ble_advertising_start(BLE_ADV_MODE_SLOW); - if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) - { - m_error_handler(err_code); - } - break; - } - case BLE_ADV_MODE_SLOW: - m_adv_evt = BLE_ADV_EVT_IDLE; - ADV_LOG("[ADV]: Timed out from slow advertising, stopping advertising.\r\n"); - if (m_evt_handler != NULL) - { - m_evt_handler(m_adv_evt); - } - break; - default: - // No implementation needed. - break; - } - } + // Upon time-out, the next advertising mode is started. + case BLE_GAP_EVT_TIMEOUT: + on_timeout(p_ble_evt); break; default: - // No implementation needed. break; } } + + void ble_advertising_on_sys_evt(uint32_t sys_evt) { - uint32_t err_code = NRF_SUCCESS; + uint32_t ret; + switch (sys_evt) { - + //When a flash operation finishes, re-attempt to start advertising operations. case NRF_EVT_FLASH_OPERATION_SUCCESS: - // Fall through. - - //When a flash operation finishes, advertising no longer needs to be pending. case NRF_EVT_FLASH_OPERATION_ERROR: if (m_advertising_start_pending) { m_advertising_start_pending = false; - err_code = ble_advertising_start(m_adv_mode_current); - if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) + ret = ble_advertising_start(m_adv_mode_current); + if ((ret != NRF_SUCCESS) && (m_error_handler != NULL)) { - m_error_handler(err_code); + m_error_handler(ret); } } break; @@ -519,76 +632,86 @@ void ble_advertising_on_sys_evt(uint32_t sys_evt) } } + uint32_t ble_advertising_peer_addr_reply(ble_gap_addr_t * p_peer_address) { - if(m_peer_addr_reply_expected == false) + if (!m_peer_addr_reply_expected) { return NRF_ERROR_INVALID_STATE; } - m_peer_address.addr_type = p_peer_address->addr_type; - - for (int i = 0; i < BLE_GAP_ADDR_LEN; i++) - { - m_peer_address.addr[i] = p_peer_address->addr[i]; - } - m_peer_addr_reply_expected = false; + + memcpy(&m_peer_address, p_peer_address, sizeof(m_peer_address)); + return NRF_SUCCESS; } -uint32_t ble_advertising_whitelist_reply(ble_gap_whitelist_t * p_whitelist) +uint32_t ble_advertising_whitelist_reply(ble_gap_addr_t const * p_gap_addrs, + uint32_t addr_cnt, + ble_gap_irk_t const * p_gap_irks, + uint32_t irk_cnt) { - uint32_t i; - - if(m_whitelist_reply_expected == false) + if (!m_whitelist_reply_expected) { return NRF_ERROR_INVALID_STATE; } - m_whitelist.addr_count = p_whitelist->addr_count; - m_whitelist.irk_count = p_whitelist->irk_count; - - for (i = 0; i < m_whitelist.irk_count; i++) - { - mp_whitelist_irk[i] = p_whitelist->pp_irks[i]; - } - - for (i = 0; i < m_whitelist.addr_count; i++) - { - mp_whitelist_addr[i] = p_whitelist->pp_addrs[i]; - } - m_whitelist_reply_expected = false; + + #if (NRF_SD_BLE_API_VERSION <= 2) + + m_whitelist.addr_count = addr_cnt; + m_whitelist.irk_count = irk_cnt; + + for (uint32_t i = 0; i < addr_cnt; i++) + { + *m_whitelist.pp_addrs[i] = p_gap_addrs[i]; + } + + for (uint32_t i = 0; i < irk_cnt; i++) + { + *m_whitelist.pp_irks[i] = p_gap_irks[i]; + } + + #else + + m_whitelist_in_use = ((addr_cnt > 0) || (irk_cnt > 0)); + + #endif + return NRF_SUCCESS; } uint32_t ble_advertising_restart_without_whitelist(void) { - uint32_t err_code; + uint32_t ret; - if( m_adv_modes_config.ble_adv_whitelist_enabled == BLE_ADV_WHITELIST_ENABLED - && !m_whitelist_temporarily_disabled) + (void) sd_ble_gap_adv_stop(); + + m_whitelist_temporarily_disabled = true; + + #if (NRF_SD_BLE_API_VERSION >= 3) + m_whitelist_in_use = false; + #endif + + m_advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; + + ret = ble_advdata_set(&m_advdata, NULL); + if (ret != NRF_SUCCESS) { - if (m_adv_mode_current != BLE_ADV_MODE_IDLE) - { - err_code = sd_ble_gap_adv_stop(); - VERIFY_SUCCESS(err_code); - } - m_whitelist_temporarily_disabled = true; - m_advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; - err_code = ble_advdata_set(&m_advdata, NULL); - VERIFY_SUCCESS(err_code); - - err_code = ble_advertising_start(m_adv_mode_current); - if ((err_code != NRF_SUCCESS) && (m_error_handler != NULL)) - { - m_error_handler(err_code); - } + return ret; } + + ret = ble_advertising_start(m_adv_mode_current); + if ((ret != NRF_SUCCESS) && (m_error_handler != NULL)) + { + m_error_handler(ret); + } + return NRF_SUCCESS; } - +#endif // NRF_MODULE_ENABLED(BLE_ADVERTISING) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h index c806399eb4..bb01874d63 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h @@ -37,10 +37,9 @@ */ - /**@file * - * @defgroup ble_sdk_lib_advertising Advertising Module + * @defgroup ble_advertising Advertising Module * @{ * @ingroup ble_sdk_lib * @brief Module for handling connectable BLE advertising. @@ -62,16 +61,21 @@ #define BLE_ADVERTISING_H__ #include -#include "nrf_ble_gattc.h" -#include "nrf_ble.h" #include "nrf_error.h" +#include "ble.h" +#include "ble_gattc.h" #include "ble_advdata.h" +#ifdef __cplusplus +extern "C" { +#endif + + /**@brief Advertising modes. */ typedef enum { - BLE_ADV_MODE_IDLE, /**< Idle; no connectable advertising is ongoing.*/ + BLE_ADV_MODE_IDLE, /**< Idle; no connectable advertising is ongoing. */ BLE_ADV_MODE_DIRECTED, /**< Directed advertising attempts to connect to the most recently disconnected peer. */ BLE_ADV_MODE_DIRECTED_SLOW, /**< Directed advertising (low duty cycle) attempts to connect to the most recently disconnected peer. */ BLE_ADV_MODE_FAST, /**< Fast advertising will connect to any peer device, or filter with a whitelist if one exists. */ @@ -91,13 +95,14 @@ typedef enum BLE_ADV_EVT_DIRECTED, /**< Direct advertising mode has started. */ BLE_ADV_EVT_DIRECTED_SLOW, /**< Directed advertising (low duty cycle) has started. */ BLE_ADV_EVT_FAST, /**< Fast advertising mode has started. */ - BLE_ADV_EVT_SLOW, /**< Slow advertising mode has started.*/ + BLE_ADV_EVT_SLOW, /**< Slow advertising mode has started. */ BLE_ADV_EVT_FAST_WHITELIST, /**< Fast advertising mode using the whitelist has started. */ - BLE_ADV_EVT_SLOW_WHITELIST, /**< Slow advertising mode using the whitelist has started.*/ + BLE_ADV_EVT_SLOW_WHITELIST, /**< Slow advertising mode using the whitelist has started. */ BLE_ADV_EVT_WHITELIST_REQUEST, /**< Request a whitelist from the main application. For whitelist advertising to work, the whitelist must be set when this event occurs. */ BLE_ADV_EVT_PEER_ADDR_REQUEST /**< Request a peer address from the main application. For directed advertising to work, the peer address must be set when this event occurs. */ } ble_adv_evt_t; + /**@brief Options for the different advertisement modes. * * @details This structure is used to enable or disable advertising modes and to configure time-out @@ -108,15 +113,23 @@ typedef struct bool ble_adv_whitelist_enabled; /**< Enable or disable use of the whitelist. */ bool ble_adv_directed_enabled; /**< Enable or disable direct advertising mode. */ bool ble_adv_directed_slow_enabled; /**< Enable or disable direct advertising mode. */ + bool ble_adv_fast_enabled; /**< Enable or disable fast advertising mode. */ + bool ble_adv_slow_enabled; /**< Enable or disable slow advertising mode. */ uint32_t ble_adv_directed_slow_interval; /**< Advertising interval for directed advertising. */ uint32_t ble_adv_directed_slow_timeout; /**< Time-out (number of tries) for direct advertising. */ - bool ble_adv_fast_enabled; /**< Enable or disable fast advertising mode. */ uint32_t ble_adv_fast_interval; /**< Advertising interval for fast advertising. */ uint32_t ble_adv_fast_timeout; /**< Time-out (in seconds) for fast advertising. */ - bool ble_adv_slow_enabled; /**< Enable or disable slow advertising mode. */ uint32_t ble_adv_slow_interval; /**< Advertising interval for slow advertising. */ uint32_t ble_adv_slow_timeout; /**< Time-out (in seconds) for slow advertising. */ -}ble_adv_modes_config_t; +} ble_adv_modes_config_t; + + +typedef struct +{ + uint32_t interval; + uint32_t timeout; + bool enabled; +} ble_adv_mode_config_t; /**@brief BLE advertising event handler type. */ @@ -132,24 +145,7 @@ typedef struct ble_adv_modes_config_t options; /**< Parameters for advertising modes.*/ ble_advdata_t advdata; /**< Advertising data. */ ble_advertising_evt_handler_t evt_handler; /**< Event handler. */ -}ble_adv_init_t; - - -/* Defines to make the mode options easier to set during advertising init.*/ -#define BLE_ADV_DIRECTED_ENABLED true -#define BLE_ADV_DIRECTED_DISABLED false - -#define BLE_ADV_DIRECTED_SLOW_ENABLED true -#define BLE_ADV_DIRECTED_SLOW_DISABLED false - -#define BLE_ADV_FAST_ENABLED true -#define BLE_ADV_FAST_DISABLED false - -#define BLE_ADV_SLOW_ENABLED true -#define BLE_ADV_SLOW_DISABLED false - -#define BLE_ADV_WHITELIST_ENABLED true -#define BLE_ADV_WHITELIST_DISABLED false +} ble_adv_init_t; /**@brief Function for handling BLE events. @@ -189,11 +185,11 @@ void ble_advertising_on_sys_evt(uint32_t sys_evt); * * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. */ -uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, - ble_advdata_t const * p_srdata, - ble_adv_modes_config_t const * p_config, - ble_advertising_evt_handler_t const evt_handler, - ble_advertising_error_handler_t const error_handler); +uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, + ble_advdata_t const * p_srdata, + ble_adv_modes_config_t const * p_config, + ble_advertising_evt_handler_t const evt_handler, + ble_advertising_error_handler_t const error_handler); /**@brief Function for starting advertising. @@ -204,10 +200,11 @@ uint32_t ble_advertising_init(ble_advdata_t const * p_advdata, * @param[in] advertising_mode Advertising mode. * * @retval @ref NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval @ref NRF_ERROR_INVALID_STATE + * @retval @ref NRF_ERROR_INVALID_STATE If the module is not initialized. */ uint32_t ble_advertising_start(ble_adv_mode_t advertising_mode); + /**@brief Function for setting the peer address. * * @details The peer address must be set by the application upon receiving a @@ -228,12 +225,19 @@ uint32_t ble_advertising_peer_addr_reply(ble_gap_addr_t * p_peer_addr); * @ref BLE_ADV_EVT_WHITELIST_REQUEST event. Without the whitelist, the whitelist * advertising for fast and slow modes will not be run. * - * @param[in] p_whitelist Pointer to a whitelist. + * @param[in] p_gap_addrs The list of GAP addresses to whitelist. + * @param[in] addr_cnt The number of GAP addresses to whitelist. + * @param[in] p_gap_irks The list of peer IRK to whitelist. + * @param[in] irk_cnt The number of peer IRK to whitelist. * - * @retval @ref NRF_SUCCESS Successfully stored pointers to the whitelist into the advertising module. - * @retval @ref NRF_ERROR_INVALID_STATE If a reply was not expected. + * @retval @ref NRF_SUCCESS If the operation was successful. + * @retval @ref NRF_ERROR_INVALID_STATE If a call to this function was made without a + * BLE_ADV_EVT_WHITELIST_REQUEST event being received. */ -uint32_t ble_advertising_whitelist_reply(ble_gap_whitelist_t * p_whitelist); +uint32_t ble_advertising_whitelist_reply(ble_gap_addr_t const * p_gap_addrs, + uint32_t addr_cnt, + ble_gap_irk_t const * p_gap_irks, + uint32_t irk_cnt); /**@brief Function for disabling whitelist advertising. @@ -244,8 +248,14 @@ uint32_t ble_advertising_whitelist_reply(ble_gap_whitelist_t * p_whitelist); * @retval @ref NRF_SUCCESS On success, else an error message propogated from the Softdevice. */ uint32_t ble_advertising_restart_without_whitelist(void); + /** @} */ + +#ifdef __cplusplus +} +#endif + #endif // BLE_ADVERTISING_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c index d2a7b0b213..5b7852b2b5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c @@ -36,17 +36,18 @@ * */ - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(BLE_DB_DISCOVERY) #include "ble_db_discovery.h" #include -#include "nrf_ble.h" +#include "ble.h" +#include "ble_srv_common.h" +#define NRF_LOG_MODULE_NAME "BLE_DB_DISC" #include "nrf_log.h" -#include "sdk_common.h" - #define SRV_DISC_START_HANDLE 0x0001 /**< The start handle value used during service discovery. */ #define DB_DISCOVERY_MAX_USERS BLE_DB_DISCOVERY_MAX_SRV /**< The maximum number of users/registrations allowed by this module. */ -#define DB_LOG NRF_LOG_PRINTF_DEBUG /**< A debug logger macro that can be used in this file to do logging information over UART. */ +#define MODULE_INITIALIZED (m_initialized == true) /**< Macro designating whether the module has been initialized properly. */ /**@brief Array of structures containing information about the registered application modules. */ @@ -70,9 +71,6 @@ static uint32_t m_pending_usr_evt_index; /**< The index to the pending user e static uint32_t m_num_of_handlers_reg; /**< The number of handlers registered with the DB Discovery module. */ static bool m_initialized = false; /**< This variable Indicates if the module is initialized or not. */ -#define MODULE_INITIALIZED (m_initialized == true) -#include "sdk_macros.h" - /**@brief Function for fetching the event handler provided by a registered application module. * * @param[in] srv_uuid UUID of the service. @@ -270,7 +268,7 @@ static void on_srv_disc_completion(ble_db_discovery_t * p_db_discovery, // discovery is about to start. p_srv_being_discovered->char_count = 0; - DB_LOG("[DB]: Starting discovery of service with UUID 0x%x for Connection handle %d\r\n", + NRF_LOG_INFO("Starting discovery of service with UUID 0x%x for Connection handle %d\r\n", p_srv_being_discovered->srv_uuid.uuid, conn_handle); uint32_t err_code; @@ -562,7 +560,7 @@ static void on_primary_srv_discovery_rsp(ble_db_discovery_t * const p_db_disc uint32_t err_code; const ble_gattc_evt_prim_srvc_disc_rsp_t * p_prim_srvc_disc_rsp_evt; - DB_LOG("Found service UUID 0x%x\r\n", p_srv_being_discovered->srv_uuid.uuid); + NRF_LOG_INFO("Found service UUID 0x%x\r\n", p_srv_being_discovered->srv_uuid.uuid); p_prim_srvc_disc_rsp_evt = &(p_ble_gattc_evt->params.prim_srvc_disc_rsp); @@ -589,7 +587,7 @@ static void on_primary_srv_discovery_rsp(ble_db_discovery_t * const p_db_disc } else { - DB_LOG("Service UUID 0x%x Not found\r\n", p_srv_being_discovered->srv_uuid.uuid); + NRF_LOG_INFO("Service UUID 0x%x Not found\r\n", p_srv_being_discovered->srv_uuid.uuid); // Trigger Service Not Found event to the application. discovery_complete_evt_trigger(p_db_discovery, false, @@ -654,7 +652,10 @@ static void on_characteristic_discovery_rsp(ble_db_discovery_t * const p_db_d p_srv_being_discovered->charateristics[i].characteristic = p_char_disc_rsp_evt->chars[j]; - p_srv_being_discovered->charateristics[i].cccd_handle = BLE_GATT_HANDLE_INVALID; + p_srv_being_discovered->charateristics[i].cccd_handle = BLE_GATT_HANDLE_INVALID; + p_srv_being_discovered->charateristics[i].ext_prop_handle = BLE_GATT_HANDLE_INVALID; + p_srv_being_discovered->charateristics[i].user_desc_handle = BLE_GATT_HANDLE_INVALID; + p_srv_being_discovered->charateristics[i].report_ref_handle = BLE_GATT_HANDLE_INVALID; } ble_gattc_char_t * p_last_known_char; @@ -730,7 +731,7 @@ static void on_characteristic_discovery_rsp(ble_db_discovery_t * const p_db_d { // No more characteristics and descriptors need to be discovered. Discovery is complete. // Send a discovery complete event to the user application. - DB_LOG("[DB]: Discovery of service with UUID 0x%x completed with success for Connection" + NRF_LOG_INFO("Discovery of service with UUID 0x%x completed with success for Connection" " handle %d\r\n", p_srv_being_discovered->srv_uuid.uuid, p_ble_gattc_evt->conn_handle); @@ -771,20 +772,39 @@ static void on_descriptor_discovery_rsp(ble_db_discovery_t * const p_db_disco if (p_ble_gattc_evt->gatt_status == BLE_GATT_STATUS_SUCCESS) { // The descriptor was found at the peer. - // If the descriptor was a CCCD, then the cccd_handle needs to be populated. - - uint32_t i; - - // Loop through all the descriptors to find the CCCD. - for (i = 0; i < p_desc_disc_rsp_evt->count; i++) + // Iterate through and collect CCCD, Extended Properties, + // User Description & Report Reference descriptor handles. + for (uint32_t i = 0; i < p_desc_disc_rsp_evt->count; i++) { - if ( - p_desc_disc_rsp_evt->descs[i].uuid.uuid == - BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG - ) + switch (p_desc_disc_rsp_evt->descs[i].uuid.uuid) { - p_char_being_discovered->cccd_handle = p_desc_disc_rsp_evt->descs[i].handle; + case BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG: + p_char_being_discovered->cccd_handle = + p_desc_disc_rsp_evt->descs[i].handle; + break; + case BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP: + p_char_being_discovered->ext_prop_handle = + p_desc_disc_rsp_evt->descs[i].handle; + break; + + case BLE_UUID_DESCRIPTOR_CHAR_USER_DESC: + p_char_being_discovered->user_desc_handle = + p_desc_disc_rsp_evt->descs[i].handle; + break; + + case BLE_UUID_REPORT_REF_DESCR: + p_char_being_discovered->report_ref_handle = + p_desc_disc_rsp_evt->descs[i].handle; + break; + } + + /* Break if we've found all the descriptors we are looking for. */ + if (p_char_being_discovered->cccd_handle != BLE_GATT_HANDLE_INVALID && + p_char_being_discovered->ext_prop_handle != BLE_GATT_HANDLE_INVALID && + p_char_being_discovered->user_desc_handle != BLE_GATT_HANDLE_INVALID && + p_char_being_discovered->report_ref_handle != BLE_GATT_HANDLE_INVALID) + { break; } } @@ -829,8 +849,8 @@ static void on_descriptor_discovery_rsp(ble_db_discovery_t * const p_db_disco if (raise_discov_complete) { - DB_LOG("[DB]: Discovery of service with UUID 0x%x completed with success for Connection" - "handle %d\r\n", p_srv_being_discovered->srv_uuid.uuid, + NRF_LOG_INFO("Discovery of service with UUID 0x%x completed with success for Connection" + " handle %d\r\n", p_srv_being_discovered->srv_uuid.uuid, p_ble_gattc_evt->conn_handle); discovery_complete_evt_trigger(p_db_discovery, @@ -900,13 +920,14 @@ uint32_t ble_db_discovery_start(ble_db_discovery_t * const p_db_discovery, m_pending_usr_evt_index = 0; p_db_discovery->discoveries_count = 0; - p_db_discovery->curr_srv_ind = 0; + p_db_discovery->curr_srv_ind = 0; + p_db_discovery->curr_char_ind = 0; p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); p_srv_being_discovered->srv_uuid = m_registered_handlers[p_db_discovery->curr_srv_ind]; - DB_LOG("[DB]: Starting discovery of service with UUID 0x%x for Connection handle %d\r\n", + NRF_LOG_INFO("Starting discovery of service with UUID 0x%x for Connection handle %d\r\n", p_srv_being_discovered->srv_uuid.uuid, conn_handle); uint32_t err_code; @@ -965,3 +986,4 @@ void ble_db_discovery_on_ble_evt(ble_db_discovery_t * const p_db_discovery, break; } } +#endif // NRF_MODULE_ENABLED(BLE_DB_DISCOVERY) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h index edca50f3e5..c68fdeaeee 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h @@ -37,10 +37,9 @@ */ - /**@file * - * @defgroup ble_sdk_lib_db_discovery Database Discovery + * @defgroup ble_db_discovery Database Discovery * @{ * @ingroup ble_sdk_lib * @brief Database discovery module. @@ -53,9 +52,9 @@ * @warning The maximum number of characteristics per service that can be discovered by this module * is determined by the number of characteristics in the service structure defined in * db_disc_config.h. If the peer has more than the supported number of characteristics, then - * the first found will be discovered and any further characteristics will be ignored. No - * descriptors other than Client Characteristic Configuration Descriptors will be searched - * for at the peer. + * the first found will be discovered and any further characteristics will be ignored. Only the + * following descriptors will be searched for at the peer: Client Characteristic Configuration, + * Characteristic Extended Properties, Characteristic User Description, and Report Reference. * * @note Presently only one instance of a Primary Service can be discovered by this module. If * there are multiple instances of the service at the peer, only the first instance @@ -70,12 +69,16 @@ #define BLE_DB_DISCOVERY_H__ #include -#include "nrf_ble_gattc.h" -#include "nrf_ble.h" #include "nrf_error.h" +#include "ble.h" +#include "ble_gattc.h" #include "ble_srv_common.h" #include "ble_gatt_db.h" +#ifdef __cplusplus +extern "C" { +#endif + #define BLE_DB_DISCOVERY_MAX_SRV 6 /**< Maximum number of services supported by this module. This also indicates the maximum number of users allowed to be registered to this module. (one user per service). */ @@ -203,6 +206,11 @@ uint32_t ble_db_discovery_start(ble_db_discovery_t * const p_db_discovery, void ble_db_discovery_on_ble_evt(ble_db_discovery_t * const p_db_discovery, const ble_evt_t * const p_ble_evt); + +#ifdef __cplusplus +} +#endif + #endif // BLE_DB_DISCOVERY_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.c index 665393c6fb..5797c282a3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.c @@ -36,7 +36,6 @@ * */ - #include "ble_debug_assert_handler.h" #include #include "nrf.h" @@ -64,7 +63,7 @@ void ble_debug_assert_handler(uint32_t error_code, uint32_t line_num, const uint UNUSED_VARIABLE(s_error_code); // WARNING: The PRIMASK register is set to disable ALL interrups during writing the error log. - // + // // Do not use __disable_irq() in normal operation. __disable_irq(); diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.h index 7a4ffa2648..f5a2d6342b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_debug_assert_handler/ble_debug_assert_handler.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup ble_debug_assert_handler Assert handler for debug purposes @@ -49,29 +48,38 @@ * This module is ONLY for debugging purposes and must never be used in final product. * */ - + #ifndef BLE_DEBUG_ASSERT_HANDLER_H__ #define BLE_DEBUG_ASSERT_HANDLER_H__ #include - -/**@brief Function for handling the Debug assert, which can be called from an error handler. + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Function for handling the Debug assert, which can be called from an error handler. * To be used only for debugging purposes. * *@details This code will copy the filename and line number into local variables for them to always - * be accessible in Keil debugger. The function will also write the ARM Cortex-M0 stack - * memory into flash where it can be retrieved and manually un-winded in order to + * be accessible in Keil debugger. The function will also write the ARM Cortex-M0 stack + * memory into flash where it can be retrieved and manually un-winded in order to * back-trace the location where the error ocured.
* @warning ALL INTERRUPTS WILL BE DISABLED. - * + * * @note This function will never return but loop forever for debug purposes. * * @param[in] error_code Error code supplied to the handler. * @param[in] line_num Line number where the original handler is called. - * @param[in] p_file_name Pointer to the file name. + * @param[in] p_file_name Pointer to the file name. */ void ble_debug_assert_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name); + +#ifdef __cplusplus +} +#endif + #endif /* BLE_DEBUG_ASSERT_HANDLER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.c index dad99f352b..ccf43efd93 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.c @@ -35,28 +35,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(BLE_DTM) #include "ble_dtm.h" +#include "ble_dtm_hw.h" #include #include #include "nrf.h" #define DTM_HEADER_OFFSET 0 /**< Index where the header of the pdu is located. */ #define DTM_HEADER_SIZE 2 /**< Size of PDU header. */ -#define DTM_PAYLOAD_MAX_SIZE 37 /**< Maximum payload size allowed during dtm execution. */ +#define DTM_PAYLOAD_MAX_SIZE 255 /**< Maximum payload size allowed during dtm execution. */ #define DTM_LENGTH_OFFSET (DTM_HEADER_OFFSET + 1) /**< Index where the length of the payload is encoded. */ #define DTM_PDU_MAX_MEMORY_SIZE (DTM_HEADER_SIZE + DTM_PAYLOAD_MAX_SIZE) /**< Maximum PDU size allowed during dtm execution. */ - -/**@details The UART poll cycle in micro seconds. - * Baud rate of 19200 bits / second, and 8 data bits, 1 start/stop bit, no flow control, - * give the time to transmit a byte: 10 bits * 1/19200 = approx: 520 us. - * - * To ensure no loss of bytes, the UART should be polled every 260 us. - * - * @note If UART bit rate is changed, this value should be recalculated as well. - */ -#define UART_POLL_CYCLE 260 +#define DTM_ON_AIR_OVERHEAD_SIZE 10 /**< Size of the packet on air without the payload (preamble + sync word + type + RFU + length + CRC). */ #define RX_MODE true /**< Constant defining RX mode for radio during dtm test. */ #define TX_MODE false /**< Constant defining TX mode for radio during dtm test. */ @@ -68,11 +60,40 @@ #define RFPHY_TEST_0X0F_REF_PATTERN 0x0f /**< RF-PHY test packet patterns, for the repeated octet packets. */ #define RFPHY_TEST_0X55_REF_PATTERN 0x55 /**< RF-PHY test packet patterns, for the repeated octet packets. */ -#define PRBS9_CONTENT {0xff, 0xc1, 0xfb, 0xe8, 0x4c, 0x90, 0x72, 0x8b, \ - 0xe7, 0xb3, 0x51, 0x89, 0x63, 0xab, 0x23, 0x23, \ - 0x2, 0x84, 0x18, 0x72, 0xaa, 0x61, 0x2f, 0x3b, \ - 0x51, 0xa8, 0xe5, 0x37, 0x49, 0xfb, 0xc9, 0xca, \ - 0xc, 0x18, 0x53, 0x2c, 0xfd} /**< The PRBS9 sequence used as packet payload. */ +#define PRBS9_CONTENT {0xFF, 0xC1, 0xFB, 0xE8, 0x4C, 0x90, 0x72, 0x8B, \ + 0xE7, 0xB3, 0x51, 0x89, 0x63, 0xAB, 0x23, 0x23, \ + 0x02, 0x84, 0x18, 0x72, 0xAA, 0x61, 0x2F, 0x3B, \ + 0x51, 0xA8, 0xE5, 0x37, 0x49, 0xFB, 0xC9, 0xCA, \ + 0x0C, 0x18, 0x53, 0x2C, 0xFD, 0x45, 0xE3, 0x9A, \ + 0xE6, 0xF1, 0x5D, 0xB0, 0xB6, 0x1B, 0xB4, 0xBE, \ + 0x2A, 0x50, 0xEA, 0xE9, 0x0E, 0x9C, 0x4B, 0x5E, \ + 0x57, 0x24, 0xCC, 0xA1, 0xB7, 0x59, 0xB8, 0x87, \ + 0xFF, 0xE0, 0x7D, 0x74, 0x26, 0x48, 0xB9, 0xC5, \ + 0xF3, 0xD9, 0xA8, 0xC4, 0xB1, 0xD5, 0x91, 0x11, \ + 0x01, 0x42, 0x0C, 0x39, 0xD5, 0xB0, 0x97, 0x9D, \ + 0x28, 0xD4, 0xF2, 0x9B, 0xA4, 0xFD, 0x64, 0x65, \ + 0x06, 0x8C, 0x29, 0x96, 0xFE, 0xA2, 0x71, 0x4D, \ + 0xF3, 0xF8, 0x2E, 0x58, 0xDB, 0x0D, 0x5A, 0x5F, \ + 0x15, 0x28, 0xF5, 0x74, 0x07, 0xCE, 0x25, 0xAF, \ + 0x2B, 0x12, 0xE6, 0xD0, 0xDB, 0x2C, 0xDC, 0xC3, \ + 0x7F, 0xF0, 0x3E, 0x3A, 0x13, 0xA4, 0xDC, 0xE2, \ + 0xF9, 0x6C, 0x54, 0xE2, 0xD8, 0xEA, 0xC8, 0x88, \ + 0x00, 0x21, 0x86, 0x9C, 0x6A, 0xD8, 0xCB, 0x4E, \ + 0x14, 0x6A, 0xF9, 0x4D, 0xD2, 0x7E, 0xB2, 0x32, \ + 0x03, 0xC6, 0x14, 0x4B, 0x7F, 0xD1, 0xB8, 0xA6, \ + 0x79, 0x7C, 0x17, 0xAC, 0xED, 0x06, 0xAD, 0xAF, \ + 0x0A, 0x94, 0x7A, 0xBA, 0x03, 0xE7, 0x92, 0xD7, \ + 0x15, 0x09, 0x73, 0xE8, 0x6D, 0x16, 0xEE, 0xE1, \ + 0x3F, 0x78, 0x1F, 0x9D, 0x09, 0x52, 0x6E, 0xF1, \ + 0x7C, 0x36, 0x2A, 0x71, 0x6C, 0x75, 0x64, 0x44, \ + 0x80, 0x10, 0x43, 0x4E, 0x35, 0xEC, 0x65, 0x27, \ + 0x0A, 0xB5, 0xFC, 0x26, 0x69, 0x3F, 0x59, 0x99, \ + 0x01, 0x63, 0x8A, 0xA5, 0xBF, 0x68, 0x5C, 0xD3, \ + 0x3C, 0xBE, 0x0B, 0xD6, 0x76, 0x83, 0xD6, 0x57, \ + 0x05, 0x4A, 0x3D, 0xDD, 0x81, 0x73, 0xC9, 0xEB, \ + 0x8A, 0x84, 0x39, 0xF4, 0x36, 0x0B, 0xF7} /**< The PRBS9 sequence used as packet payload. + The bytes in the sequence is in the right order, but the bits of each byte in the array is reverse. + of that found by running the PRBS9 algorithm. This is because of the endianess of the nRF5 radio. */ /**@brief Structure holding the PDU used for transmitting/receiving a PDU. */ @@ -98,7 +119,7 @@ static uint16_t m_rx_pkt_count; /** static pdu_type_t m_pdu; /**< PDU to be sent. */ static uint16_t m_event; /**< current command status - initially "ok", may be set if error detected, or to packet count. */ static bool m_new_event; /**< Command has been processed - number of not yet reported event bytes. */ -static uint8_t m_packet_length; /**< Payload length of transmitted PDU, bits 2:7 of 16-bit dtm command. */ +static uint32_t m_packet_length; /**< Payload length of transmitted PDU, bits 2:7 of 16-bit dtm command. */ static dtm_pkt_type_t m_packet_type; /**< Bits 0..1 of 16-bit transmit command, or 0xFFFFFFFF. */ static dtm_freq_t m_phys_ch; /**< 0..39 physical channel number (base 2402 MHz, Interval 2 MHz), bits 8:13 of 16-bit dtm command. */ static uint32_t m_current_time = 0; /**< Counter for interrupts from timer to ensure that the 2 bytes forming a DTM command are received within the time window. */ @@ -122,8 +143,8 @@ static uint8_t m_crcLength = RADIO_CRCCNF_LEN_Three; /** static uint32_t m_address = 0x71764129; /**< Address. */ static uint32_t m_crc_poly = 0x0000065B; /**< CRC polynomial. */ static uint32_t m_crc_init = 0x00555555; /**< Initial value for CRC calculation. */ -static uint8_t m_radio_mode = RADIO_MODE_MODE_Ble_1Mbit; /**< nRF51 specific radio mode vale. */ -static uint32_t m_txIntervaluS = 625; /**< Time between start of Tx packets (in uS). */ +static uint8_t m_radio_mode = RADIO_MODE_MODE_Ble_1Mbit; /**< nRF51 specific radio mode value. */ +static uint32_t m_txIntervaluS = 2500; /**< Time between start of Tx packets (in uS). */ /**@brief Function for verifying that a received PDU has the expected structure and content. @@ -133,7 +154,7 @@ static bool check_pdu(void) uint8_t k; // Byte pointer for running through PDU payload uint8_t pattern; // Repeating octet value in payload dtm_pkt_type_t pdu_packet_type; // Note: PDU packet type is a 4-bit field in HCI, but 2 bits in BLE DTM - uint8_t length; + uint32_t length = 0; pdu_packet_type = (dtm_pkt_type_t)(m_pdu.content[DTM_HEADER_OFFSET] & 0x0F); length = m_pdu.content[DTM_LENGTH_OFFSET]; @@ -146,7 +167,7 @@ static bool check_pdu(void) if (pdu_packet_type == DTM_PKT_PRBS9) { // Payload does not consist of one repeated octet; must compare ir with entire block into - return (memcmp(m_pdu.content+DTM_HEADER_SIZE, m_prbs_content, length) == 0); + return (memcmp(m_pdu.content + DTM_HEADER_SIZE, m_prbs_content, length) == 0); } if (pdu_packet_type == DTM_PKT_0X0F) @@ -160,7 +181,7 @@ static bool check_pdu(void) for (k = 0; k < length; k++) { - // Check repeated pattern filling the PDU payload + // Check repeated pattern filling the PDU payload if (m_pdu.content[k + 2] != pattern) { return false; @@ -198,28 +219,7 @@ static void radio_reset(void) */ static uint32_t radio_init(void) { -#ifdef NRF51 - // Handle BLE Radio tuning parameters from production for DTM if required. - // Only needed for DTM without SoftDevice, as the SoftDevice normally handles this. - // PCN-083. - if ( ((NRF_FICR->OVERRIDEEN) & FICR_OVERRIDEEN_BLE_1MBIT_Msk) == FICR_OVERRIDEEN_BLE_1MBIT_Override) - { - NRF_RADIO->OVERRIDE0 = NRF_FICR->BLE_1MBIT[0]; - NRF_RADIO->OVERRIDE1 = NRF_FICR->BLE_1MBIT[1]; - NRF_RADIO->OVERRIDE2 = NRF_FICR->BLE_1MBIT[2]; - NRF_RADIO->OVERRIDE3 = NRF_FICR->BLE_1MBIT[3]; - NRF_RADIO->OVERRIDE4 = NRF_FICR->BLE_1MBIT[4]; - } -#endif // NRF51 - - // Initializing code below is quite generic - for BLE, the values are fixed, and expressions - // are constant. Non-constant values are essentially set in radio_prepare(). - if (((m_tx_power & 0x03) != 0) || // tx_power should be a multiple of 4 - ((m_tx_power & 0xffffff00) != 0) || // Upper 24 bits are required to be zeroed - ((int8_t)m_tx_power > 4) || // Max tx_power is +4 dBm - ((int8_t)(m_tx_power & 0xff) < -40) || // Min tx_power is -40 dBm - (m_radio_mode > RADIO_MODE_MODE_Ble_1Mbit) // Values 0-2: Proprietary mode, 3 (last valid): BLE - ) + if(dtm_radio_validate(m_tx_power, m_radio_mode) != DTM_SUCCESS) { return DTM_ERROR_ILLEGAL_CONFIGURATION; } @@ -262,12 +262,7 @@ static uint32_t radio_init(void) */ static void radio_prepare(bool rx) { -#ifdef NRF51 - NRF_RADIO->TEST = 0; -#elif defined(NRF52) - NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_RU_Default << RADIO_MODECNF0_RU_Pos) | - (RADIO_MODECNF0_DTX_B1 << RADIO_MODECNF0_DTX_Pos); -#endif // NRF51 / NRF52 + dtm_turn_off_test(); NRF_RADIO->CRCPOLY = m_crc_poly; NRF_RADIO->CRCINIT = m_crc_init; NRF_RADIO->FREQUENCY = (m_phys_ch << 1) + 2; // Actual frequency (MHz): 2400 + register value @@ -292,12 +287,7 @@ static void radio_prepare(bool rx) */ static void dtm_test_done(void) { -#ifdef NRF51 - NRF_RADIO->TEST = 0; -#elif defined(NRF52) - NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_RU_Default << RADIO_MODECNF0_RU_Pos) | - (RADIO_MODECNF0_DTX_B1 << RADIO_MODECNF0_DTX_Pos); -#endif // NRF51 / NRF52 + dtm_turn_off_test(); NRF_PPI->CHENCLR = 0x01; NRF_PPI->CH[0].EEP = 0; // Break connection from timer to radio to stop transmit loop NRF_PPI->CH[0].TEP = 0; @@ -334,7 +324,7 @@ static uint32_t timer_init(void) mp_timer->SHORTS = 1 << TIMER_SHORTS_COMPARE0_CLEAR_Pos; // Clear the count every time timer reaches the CCREG0 count mp_timer->PRESCALER = 4; // Input clock is 16MHz, timer clock = 2 ^ prescale -> interval 1us mp_timer->CC[0] = m_txIntervaluS; // 625uS with 1MHz clock to the timer - mp_timer->CC[1] = UART_POLL_CYCLE; // 260uS with 1MHz clock to the timer + mp_timer->CC[1] = UART_POLL_CYCLE; // Depends on the baud rate of the UART. Default baud rate of 19200 will result in a 260uS time with 1MHz clock to the timer mp_timer->TASKS_START = 1; // Start the timer - it will be running continuously m_current_time = 0; return DTM_SUCCESS; @@ -362,13 +352,8 @@ static uint32_t dtm_vendor_specific_pkt(uint32_t vendor_cmd, dtm_freq_t vendor_o // Not a packet type, but used to indicate that a continuous carrier signal // should be transmitted by the radio. radio_prepare(TX_MODE); -#ifdef NRF51 - NRF_RADIO->TEST = (RADIO_TEST_PLL_LOCK_Enabled << RADIO_TEST_PLL_LOCK_Pos) | - (RADIO_TEST_CONST_CARRIER_Enabled << RADIO_TEST_CONST_CARRIER_Pos); -#elif defined(NRF52) - NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_RU_Default << RADIO_MODECNF0_RU_Pos) | - (RADIO_MODECNF0_DTX_B1 << RADIO_MODECNF0_DTX_Pos); -#endif // NRF51 / NRF52 + + dtm_constant_carrier(); // Shortcut between READY event and START task NRF_RADIO->SHORTS = 1 << RADIO_SHORTS_READY_START_Pos; @@ -403,8 +388,9 @@ uint32_t dtm_init(void) { return DTM_ERROR_ILLEGAL_CONFIGURATION; } - m_new_event = false; - m_state = STATE_IDLE; + m_new_event = false; + m_state = STATE_IDLE; + m_packet_length = 0; // Enable wake-up on event SCB->SCR |= SCB_SCR_SEVONPEND_Msk; @@ -420,7 +406,7 @@ uint32_t dtm_wait(void) for (;;) { - // Event may be the reception of a packet - + // Event may be the reception of a packet - // handle radio first, to give it highest priority: if (NRF_RADIO->EVENTS_END != 0) { @@ -465,19 +451,19 @@ uint32_t dtm_cmd(dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t { // Save specified packet in static variable for tx/rx functions to use. // Note that BLE conformance testers always use full length packets. - m_packet_length = ((uint8_t)length & 0xFF); + m_packet_length = (m_packet_length & 0xC0) | ((uint8_t)length & 0x3F); m_packet_type = payload; m_phys_ch = freq; // Clean out any non-retrieved event that might linger from an earlier test m_new_event = true; - + // Set default event; any error will set it to LE_TEST_STATUS_EVENT_ERROR m_event = LE_TEST_STATUS_EVENT_SUCCESS; - + if (m_state == STATE_UNINITIALIZED) { - // Application has not explicitly initialized DTM, + // Application has not explicitly initialized DTM, return DTM_ERROR_UNINITIALIZED; } @@ -485,6 +471,14 @@ uint32_t dtm_cmd(dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t { // Note that timer will continue running after a reset dtm_test_done(); + if (freq == 0x01) + { + m_packet_length = length << 6; + } + else + { + m_packet_length = 0; + } return DTM_SUCCESS; } @@ -505,15 +499,16 @@ uint32_t dtm_cmd(dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t { // Sequencing error - only TEST_END/RESET are legal while test is running // Note: State is unchanged; ongoing test not affected - m_event = LE_TEST_STATUS_EVENT_ERROR; - return DTM_ERROR_INVALID_STATE; + m_event = LE_TEST_STATUS_EVENT_ERROR; + return DTM_ERROR_INVALID_STATE; } - if (m_phys_ch > PHYS_CH_MAX) + // Check for illegal values of m_phys_ch. Skip the check if the packet is vendor spesific. + if (payload != DTM_PKT_VENDORSPECIFIC && m_phys_ch > PHYS_CH_MAX) { // Parameter error // Note: State is unchanged; ongoing test not affected - m_event = LE_TEST_STATUS_EVENT_ERROR; + m_event = LE_TEST_STATUS_EVENT_ERROR; return DTM_ERROR_ILLEGAL_CHANNEL; } @@ -530,7 +525,8 @@ uint32_t dtm_cmd(dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t if (cmd == LE_TRANSMITTER_TEST) { - if (m_packet_length > DTM_PAYLOAD_MAX_SIZE) + // Check for illegal values of m_packet_length. Skip the check if the packet is vendor spesific. + if (payload != DTM_PKT_VENDORSPECIFIC && m_packet_length > DTM_PAYLOAD_MAX_SIZE) { // Parameter error m_event = LE_TEST_STATUS_EVENT_ERROR; @@ -538,39 +534,58 @@ uint32_t dtm_cmd(dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t } // Note that PDU uses 4 bits even though BLE DTM uses only 2 (the HCI SDU uses all 4) - m_pdu.content[DTM_HEADER_OFFSET] = ((uint8_t)m_packet_type & 0x0F); + m_pdu.content[DTM_HEADER_OFFSET] = ((uint8_t)m_packet_type & 0x0F); m_pdu.content[DTM_LENGTH_OFFSET] = m_packet_length; - + switch (m_packet_type) { case DTM_PKT_PRBS9: // Non-repeated, must copy entire pattern to PDU - memcpy(m_pdu.content + DTM_HEADER_SIZE, m_prbs_content, length); + memcpy(m_pdu.content + DTM_HEADER_SIZE, m_prbs_content, m_packet_length); break; - + case DTM_PKT_0X0F: // Bit pattern 00001111 repeated - memset(m_pdu.content + DTM_HEADER_SIZE, RFPHY_TEST_0X0F_REF_PATTERN, length); + memset(m_pdu.content + DTM_HEADER_SIZE, RFPHY_TEST_0X0F_REF_PATTERN, m_packet_length); break; - + case DTM_PKT_0X55: // Bit pattern 01010101 repeated - memset(m_pdu.content + DTM_HEADER_SIZE, RFPHY_TEST_0X55_REF_PATTERN, length); + memset(m_pdu.content + DTM_HEADER_SIZE, RFPHY_TEST_0X55_REF_PATTERN, m_packet_length); break; - + case DTM_PKT_VENDORSPECIFIC: // The length field is for indicating the vendor specific command to execute. // The frequency field is used for vendor specific options to the command. return dtm_vendor_specific_pkt(length, freq); - + default: - // Parameter error - m_event = LE_TEST_STATUS_EVENT_ERROR; + // Parameter error + m_event = LE_TEST_STATUS_EVENT_ERROR; return DTM_ERROR_ILLEGAL_CONFIGURATION; } // Initialize CRC value, set channel: radio_prepare(TX_MODE); + // Set the timer to the correct period. The delay between each packet is described in the + // Bluetooth Core Spsification version 4.2 Vol. 6 Part F Section 4.1.6. + if ((m_packet_length + DTM_ON_AIR_OVERHEAD_SIZE ) * 8 <= 376) + { + mp_timer->CC[0] = 625; // 625uS with 1MHz clock to the timer + } + else if ((m_packet_length + DTM_ON_AIR_OVERHEAD_SIZE ) * 8 <= 1000) + { + mp_timer->CC[0] = 1250; // 625uS with 1MHz clock to the timer + } + else if ((m_packet_length + DTM_ON_AIR_OVERHEAD_SIZE ) * 8 <= 1624) + { + mp_timer->CC[0] = 1875; // 625uS with 1MHz clock to the timer + } + else + { + mp_timer->CC[0] = 2500; // 625uS with 1MHz clock to the timer + } + // Configure PPI so that timer will activate radio every 625 us NRF_PPI->CH[0].EEP = (uint32_t)&mp_timer->EVENTS_COMPARE[0]; NRF_PPI->CH[0].TEP = (uint32_t)&NRF_RADIO->TASKS_TXEN; @@ -605,25 +620,21 @@ bool dtm_set_txpower(uint32_t new_tx_power) { // radio->TXPOWER register is 32 bits, low octet a signed value, upper 24 bits zeroed int8_t new_power8 = (int8_t)(new_tx_power & 0xFF); - + + // The two most significant bits are not sent in the 6 bit field of the DTM command. + // These two bits are 1's if and only if the tx_power is a negative number. + // All valid negative values have the fourth most significant bit as 1. + // All valid positive values have the fourth most significant bit as 0. + // By checking this bit, the two most significant bits can be determined. + new_power8 = (new_power8 & 0x30) != 0 ? (new_power8 | 0xC0) : new_power8; + if (m_state > STATE_IDLE) { // radio must be idle to change the tx power return false; } - if ((new_power8 > 4) || (new_power8 < -40)) - { - // Parameter outside valid range: nRF radio is restricted to the range -40 dBm to +4 dBm - return false; - } - - if (new_tx_power & 0x03) - { - // Parameter error: The nRF51 radio requires settings that are a multiple of 4. - return false; - } - m_tx_power = new_tx_power; + m_tx_power = new_power8; return true; } @@ -643,28 +654,8 @@ bool dtm_set_timer(uint32_t new_timer) { return false; } - if (new_timer == 0) - { - mp_timer = NRF_TIMER0; - m_timer_irq = TIMER0_IRQn; - } - else if (new_timer == 1) - { - mp_timer = NRF_TIMER1; - m_timer_irq = TIMER1_IRQn; - } - else if (new_timer == 2) - { - mp_timer = NRF_TIMER2; - m_timer_irq = TIMER2_IRQn; - } - else - { - // Parameter error: Only TIMER 0, 1, 2 provided by nRF51 - return false; - } - // New timer has been selected: - return true; + return dtm_hw_set_timer(&mp_timer, &m_timer_irq, new_timer); } -/// @} +/// @} +#endif // NRF_MODULE_ENABLED(BLE_DTM) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.h index 6831a85728..2514ccc10f 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm.h @@ -36,10 +36,9 @@ * */ - /** @file * - * @defgroup ble_sdk_dtmlib_dtm DTM - Direct Test Mode + * @defgroup ble_dtm DTM - Direct Test Mode * @{ * @ingroup ble_sdk_lib * @brief Module for testing RF/PHY using DTM commands. @@ -50,9 +49,15 @@ #include #include +#include "nrf.h" + +#ifdef __cplusplus +extern "C" { +#endif /**@brief Configuration parameters. */ +#define DTM_BITRATE UART_BAUDRATE_BAUDRATE_Baud19200/**< Serial bitrate on the UART */ #define DEFAULT_TX_POWER RADIO_TXPOWER_TXPOWER_0dBm /**< Default Transmission power using in the DTM module. */ #define DEFAULT_TIMER NRF_TIMER0 /**< Default timer used for timing. */ #define DEFAULT_TIMER_IRQn TIMER0_IRQn /**< IRQ used for timer. NOTE: MUST correspond to DEFAULT_TIMER. */ @@ -91,6 +96,43 @@ typedef uint32_t dtm_cmd_t; /**< DTM #define DTM_ERROR_ILLEGAL_CONFIGURATION 0x04 /**< Parameter out of range (legal range is function dependent). */ #define DTM_ERROR_UNINITIALIZED 0x05 /**< DTM module has not been initialized by the application. */ +/**@details The UART poll cycle in micro seconds. + * A baud rate of e.g. 19200 bits / second, and 8 data bits, 1 start/stop bit, no flow control, + * give the time to transmit a byte: 10 bits * 1/19200 = approx: 520 us. + * To ensure no loss of bytes, the UART should be polled every 260 us. + */ +#if DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud9600 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/9600/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud14400 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/14400/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud19200 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/19200/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud28800 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/28800/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud38400 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/38400/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud57600 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/57600/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud76800 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/768000/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud115200 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/115200/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud230400 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/230400/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud250000 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/250000/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud460800 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/460800/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud921600 +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/921600/2)) +#elif DTM_BITRATE == UART_BAUDRATE_BAUDRATE_Baud1M +#define UART_POLL_CYCLE ((uint32_t)(10*1e6/1e6/2)) +#else +// It is possible to find values that work for other baud rates, but the formula above is not +// guaranteed to work for all values. Suitable values may have to be found by trial and error. +#error "Unsupported baud rate set." +#endif + // Note: DTM_PKT_VENDORSPECIFIC, is not a packet type #define PACKET_TYPE_MAX DTM_PKT_0X55 /**< Highest value allowed as DTM Packet type. */ @@ -105,7 +147,7 @@ typedef uint32_t dtm_pkt_type_t; /**< Typ /**@brief Function for initializing or re-initializing DTM module - * + * * @return DTM_SUCCESS on successful initialization of the DTM module. */ uint32_t dtm_init(void); @@ -136,7 +178,7 @@ uint32_t dtm_cmd(dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t /**@brief Function for reading the result of a DTM command * * @param[out] p_dtm_event Pointer to buffer for 16 bit event code according to DTM standard. - * + * * @return true: new event, false: no event since last call, this event has been read earlier */ bool dtm_event_get(dtm_event_t * p_dtm_event); @@ -144,25 +186,30 @@ bool dtm_event_get(dtm_event_t * p_dtm_event); /**@brief Function for configuring the timer to use. * - * @note Must be called when no DTM test is running. - * + * @note Must be called when no DTM test is running. + * * @param[in] new_timer Index (0..2) of timer to be used by the DTM library * - * @return true: success, new timer was selected, false: parameter error + * @return true: success, new timer was selected, false: parameter error */ -bool dtm_set_timer(uint32_t new_timer); +bool dtm_set_timer(uint32_t new_timer); /**@brief Function for configuring the transmit power. * * @note Must be called when no DTM test is running. - * + * * @param[in] new_tx_power New output level, +4..-40, in steps of 4. * * @return true: tx power setting changed, false: parameter error */ bool dtm_set_txpower(uint32_t new_tx_power); + +#ifdef __cplusplus +} +#endif + #endif // BLE_DTM_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/config/fstorage_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw.h similarity index 54% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/config/fstorage_config.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw.h index 9ff7550997..4afced0816 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/config/fstorage_config.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,51 +36,67 @@ * */ - -#ifndef FS_CONFIG_H__ -#define FS_CONFIG_H__ - -/** - * @defgroup fstorage_config fstorage configuration - * @ingroup fstorage +/** @file + * + * @defgroup ble_dtm_hw Direct Test Mode HW * @{ - * - * @brief fstorage configuration options. + * @ingroup ble_sdk_lib + * @brief Module contains hardware related function for testing RF/PHY using DTM commands. */ +#ifndef BLE_DTM_HW_H__ +#define BLE_DTM_HW_H__ -/**@brief Configures the size of fstorage internal queue. - * @details Increase this if there are many users, or if it is likely that many operation will be - * queued at once without waiting for the previous operations to complete. In general, - * increase the queue size if you frequently receive @ref FS_ERR_QUEUE_FULL errors when - * calling @ref fs_store or @ref fs_erase. - */ -#define FS_QUEUE_SIZE (4) +#include +#include +#include "nrf.h" -/**@brief Configures how many times should fstorage attempt to execute an operation if - * the SoftDevice fails to schedule flash access due to high BLE activity. - * @details Increase this value if fstorage events return the @ref FS_ERR_OPERATION_TIMEOUT error - * often. - */ -#define FS_OP_MAX_RETRIES (3) - - -/**@brief Configures the maximum number of words to be written to flash in a single operation. - * If data length exceeds this value, the data will be written down in several chunks, - * as necessary. - * - * @details Tweaking this value can increase the chances of the SoftDevice being able to fit - * flash operations in between radio activity. This value is bound by the maximum number - * of words which the SoftDevice can write to flash in a single call to - * @ref sd_flash_write, which is 256 words for nRF51 ICs and 1024 words for nRF52 ICs. - */ -#if defined (NRF51) - #define FS_MAX_WRITE_SIZE_WORDS (256) -#elif defined (NRF52) - #define FS_MAX_WRITE_SIZE_WORDS (1024) +#ifdef __cplusplus +extern "C" { #endif + +/**@brief Function for selecting a timer resource. + * This function may be called directly, or through dtm_cmd() specifying + * DTM_PKT_VENDORSPECIFIC as payload, SELECT_TIMER as length, and the timer as freq + * + * @param[out] mp_timer Pointer to timer instance used in dtm source file. + * @param[out] m_timer_irq Pointer to timer interrupt related to mp_timer. + * @param[in] new_timer Timer id for the timer to use. + * + * @retval true if the timer was successfully changed. + * @retval false if the error occurs. + */ + +bool dtm_hw_set_timer(NRF_TIMER_Type ** mp_timer, IRQn_Type * m_timer_irq, uint32_t new_timer); + + +/**@brief Function for turning off radio test. + * This function is platform depending. For now only nRF51 requieres this special function. + */ +void dtm_turn_off_test(void); + + +/**@brief Function for setting constant carrier in radio settings. + * This function is used to handle vendor specific command testing continous carrier without + * a modulated signal. + */ +void dtm_constant_carrier(void); + + +/**@brief Function for validating tx power and radio move settings. + * @param[in] m_tx_power TX power for transmission test. + * @param[in] m_radio_mode Radio mode value. + * + * @retval DTM_SUCCESS if input parameters values are correct. + * @retval DTM_ERROR_ILLEGAL_CONFIGURATION if input parameters values are not correct. + */ +uint32_t dtm_radio_validate(int32_t m_tx_power, uint8_t m_radio_mode); + +#ifdef __cplusplus +} +#endif + +#endif // BLE_DTM_HW_H__ + /** @} */ - -#endif // FS_CONFIG_H__ - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c new file mode 100644 index 0000000000..e3bd06ea88 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ble_dtm_hw.h" +#include "ble_dtm.h" +#include +#include +#include "nrf.h" + + +void dtm_turn_off_test() +{ + NRF_RADIO->TEST = 0; +} + + +void dtm_constant_carrier() +{ + NRF_RADIO->TEST = (RADIO_TEST_PLL_LOCK_Enabled << RADIO_TEST_PLL_LOCK_Pos) | + (RADIO_TEST_CONST_CARRIER_Enabled << RADIO_TEST_CONST_CARRIER_Pos); +} + + +uint32_t dtm_radio_validate(int32_t m_tx_power, uint8_t m_radio_mode) +{ + // Handle BLE Radio tuning parameters from production for DTM if required. + // Only needed for DTM without SoftDevice, as the SoftDevice normally handles this. + // PCN-083. + if ( ((NRF_FICR->OVERRIDEEN) & FICR_OVERRIDEEN_BLE_1MBIT_Msk) == FICR_OVERRIDEEN_BLE_1MBIT_Override) + { + NRF_RADIO->OVERRIDE0 = NRF_FICR->BLE_1MBIT[0]; + NRF_RADIO->OVERRIDE1 = NRF_FICR->BLE_1MBIT[1]; + NRF_RADIO->OVERRIDE2 = NRF_FICR->BLE_1MBIT[2]; + NRF_RADIO->OVERRIDE3 = NRF_FICR->BLE_1MBIT[3]; + NRF_RADIO->OVERRIDE4 = NRF_FICR->BLE_1MBIT[4]; + } + + // Initializing code below is quite generic - for BLE, the values are fixed, and expressions + // are constant. Non-constant values are essentially set in radio_prepare(). + if (!(m_tx_power == RADIO_TXPOWER_TXPOWER_0dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Pos4dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg30dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg20dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg16dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg12dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg8dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg4dBm + ) || + (m_radio_mode > RADIO_MODE_MODE_Ble_1Mbit) // Values 0 - 2: Proprietary mode, 3 (last valid): BLE + ) + { + return DTM_ERROR_ILLEGAL_CONFIGURATION; + } + + return DTM_SUCCESS; +} + + +bool dtm_hw_set_timer(NRF_TIMER_Type ** mp_timer, IRQn_Type * m_timer_irq, uint32_t new_timer) +{ + if (new_timer == 0) + { + *mp_timer = NRF_TIMER0; + *m_timer_irq = TIMER0_IRQn; + } + else if (new_timer == 1) + { + *mp_timer = NRF_TIMER1; + *m_timer_irq = TIMER1_IRQn; + } + else if (new_timer == 2) + { + *mp_timer = NRF_TIMER2; + *m_timer_irq = TIMER2_IRQn; + } + else + { + // Parameter error: Only TIMER 0, 1, 2 provided by nRF51 + return false; + } + // New timer has been selected: + return true; +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf52.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf52.c new file mode 100644 index 0000000000..6ff4a5a157 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf52.c @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ble_dtm_hw.h" +#include "ble_dtm.h" +#include +#include +#include "nrf.h" + + +void dtm_turn_off_test() +{ +} + + +void dtm_constant_carrier() +{ +NRF_RADIO->MODECNF0 = (RADIO_MODECNF0_RU_Default << RADIO_MODECNF0_RU_Pos) | + (RADIO_MODECNF0_DTX_Center << RADIO_MODECNF0_DTX_Pos); +} + + +uint32_t dtm_radio_validate(int32_t m_tx_power, uint8_t m_radio_mode) +{ + // Initializing code below is quite generic - for BLE, the values are fixed, and expressions + // are constant. Non-constant values are essentially set in radio_prepare(). + if (!(m_tx_power == RADIO_TXPOWER_TXPOWER_0dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Pos4dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg30dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg20dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg16dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg12dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg8dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg4dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Pos3dBm || + m_tx_power == RADIO_TXPOWER_TXPOWER_Neg40dBm + ) || + (m_radio_mode > RADIO_MODE_MODE_Ble_1Mbit) // Values 0 - 2: Proprietary mode, 3 (last valid): BLE + ) + { + return DTM_ERROR_ILLEGAL_CONFIGURATION; + } + + return DTM_SUCCESS; +} + + +bool dtm_hw_set_timer(NRF_TIMER_Type ** mp_timer, IRQn_Type * m_timer_irq, uint32_t new_timer) +{ + if (new_timer == 0) + { + *mp_timer = NRF_TIMER0; + *m_timer_irq = TIMER0_IRQn; + } + else if (new_timer == 1) + { + *mp_timer = NRF_TIMER1; + *m_timer_irq = TIMER1_IRQn; + } + else if (new_timer == 2) + { + *mp_timer = NRF_TIMER2; + *m_timer_irq = TIMER2_IRQn; + } + else if (new_timer == 3) + { + *mp_timer = NRF_TIMER3; + *m_timer_irq = TIMER3_IRQn; + } + else if (new_timer == 4) + { + *mp_timer = NRF_TIMER4; + *m_timer_irq = TIMER4_IRQn; + } + else + { + // Parameter error: Only TIMER 0, 1, 2, 3 and 4 provided by nRF52 + return false; + } + // New timer has been selected: + return true; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_error_log/ble_error_log.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_error_log/ble_error_log.h index ab121c2b3c..9a7556f983 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_error_log/ble_error_log.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_error_log/ble_error_log.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup ble_error_log_module Error Log Module @@ -55,6 +54,10 @@ #include #include "ble_flash.h" +#ifdef __cplusplus +extern "C" { +#endif + #define ERROR_MESSAGE_LENGTH 128 /**< Length of error message to stored. */ #define STACK_DUMP_LENGTH 256 /**< Length of stack to be stored at max: 64 entries of 4 bytes each. */ #define FLASH_PAGE_ERROR_LOG (BLE_FLASH_PAGE_END - 2) /**< Address in flash where stack trace can be stored. */ @@ -76,7 +79,7 @@ typedef struct /**@brief Function for writing the file name/message, line number, and current program stack * to flash. - * + * * @note This function will force the writing to flash, and disregard any radio communication. * USE THIS FUNCTION WITH CARE. * @@ -91,6 +94,11 @@ typedef struct uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number); + +#ifdef __cplusplus +} +#endif + #endif /* BLE_ERROR_LOG_H__ */ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.c index 5229f7ca24..a97c3d6363 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.c @@ -35,8 +35,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(BLE_RACP) #include "ble_racp.h" #include @@ -47,7 +47,7 @@ void ble_racp_decode(uint8_t data_len, uint8_t * p_data, ble_racp_value_t * p_ra p_racp_val->operator = 0xFF; p_racp_val->operand_len = 0; p_racp_val->p_operand = NULL; - + if (data_len > 0) { p_racp_val->opcode = p_data[0]; @@ -82,3 +82,4 @@ uint8_t ble_racp_encode(const ble_racp_value_t * p_racp_val, uint8_t * p_data) return len; } +#endif // NRF_MODULE_ENABLED(BLE_RACP) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h index baf11760f1..715bcb1670 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h @@ -36,10 +36,9 @@ * */ - /** @file * - * @defgroup ble_sdk_lib_racp Record Access Control Point + * @defgroup ble_racp Record Access Control Point * @{ * @ingroup ble_sdk_lib * @brief Record Access Control Point library. @@ -50,9 +49,12 @@ #include #include -#include "nrf_ble.h" -#include "nrf_ble_types.h" -#include "nrf_ble.h" +#include "ble.h" +#include "ble_types.h" + +#ifdef __cplusplus +extern "C" { +#endif /**@brief Record Access Control Point opcodes. */ #define RACP_OPCODE_RESERVED 0 /**< Record Access Control Point opcode - Reserved for future use. */ @@ -64,26 +66,29 @@ #define RACP_OPCODE_RESPONSE_CODE 6 /**< Record Access Control Point opcode - Response code. */ /**@brief Record Access Control Point operators. */ -#define RACP_OPERATOR_NULL 0 /**< Record Access Control Point operator - Null. */ -#define RACP_OPERATOR_ALL 1 /**< Record Access Control Point operator - All records. */ -#define RACP_OPERATOR_LESS_OR_EQUAL 2 /**< Record Access Control Point operator - Less than or equal to. */ -#define RACP_OPERATOR_GREATER_OR_EQUAL 3 /**< Record Access Control Point operator - Greater than or equal to. */ -#define RACP_OPERATOR_RANGE 4 /**< Record Access Control Point operator - Within range of (inclusive). */ -#define RACP_OPERATOR_FIRST 5 /**< Record Access Control Point operator - First record (i.e. oldest record). */ -#define RACP_OPERATOR_LAST 6 /**< Record Access Control Point operator - Last record (i.e. most recent record). */ -#define RACP_OPERATOR_RFU_START 7 /**< Record Access Control Point operator - Start of Reserved for Future Use area. */ +#define RACP_OPERATOR_NULL 0 /**< Record Access Control Point operator - Null. */ +#define RACP_OPERATOR_ALL 1 /**< Record Access Control Point operator - All records. */ +#define RACP_OPERATOR_LESS_OR_EQUAL 2 /**< Record Access Control Point operator - Less than or equal to. */ +#define RACP_OPERATOR_GREATER_OR_EQUAL 3 /**< Record Access Control Point operator - Greater than or equal to. */ +#define RACP_OPERATOR_RANGE 4 /**< Record Access Control Point operator - Within range of (inclusive). */ +#define RACP_OPERATOR_FIRST 5 /**< Record Access Control Point operator - First record (i.e. oldest record). */ +#define RACP_OPERATOR_LAST 6 /**< Record Access Control Point operator - Last record (i.e. most recent record). */ +#define RACP_OPERATOR_RFU_START 7 /**< Record Access Control Point operator - Start of Reserved for Future Use area. */ + +/**@brief Record Access Control Point Operand Filter Type Value. */ +#define RACP_OPERAND_FILTER_TYPE_TIME_OFFSET 1 /**< Record Access Control Point Operand Filter Type Value - Time Offset- */ /**@brief Record Access Control Point response codes. */ -#define RACP_RESPONSE_RESERVED 0 /**< Record Access Control Point response code - Reserved for future use. */ -#define RACP_RESPONSE_SUCCESS 1 /**< Record Access Control Point response code - Successful operation. */ -#define RACP_RESPONSE_OPCODE_UNSUPPORTED 2 /**< Record Access Control Point response code - Unsupported op code received. */ -#define RACP_RESPONSE_INVALID_OPERATOR 3 /**< Record Access Control Point response code - Operator not valid for service. */ -#define RACP_RESPONSE_OPERATOR_UNSUPPORTED 4 /**< Record Access Control Point response code - Unsupported operator. */ -#define RACP_RESPONSE_INVALID_OPERAND 5 /**< Record Access Control Point response code - Operand not valid for service. */ -#define RACP_RESPONSE_NO_RECORDS_FOUND 6 /**< Record Access Control Point response code - No matching records found. */ -#define RACP_RESPONSE_ABORT_FAILED 7 /**< Record Access Control Point response code - Abort could not be completed. */ -#define RACP_RESPONSE_PROCEDURE_NOT_DONE 8 /**< Record Access Control Point response code - Procedure could not be completed. */ -#define RACP_RESPONSE_OPERAND_UNSUPPORTED 9 /**< Record Access Control Point response code - Unsupported operand. */ +#define RACP_RESPONSE_RESERVED 0 /**< Record Access Control Point response code - Reserved for future use. */ +#define RACP_RESPONSE_SUCCESS 1 /**< Record Access Control Point response code - Successful operation. */ +#define RACP_RESPONSE_OPCODE_UNSUPPORTED 2 /**< Record Access Control Point response code - Unsupported op code received. */ +#define RACP_RESPONSE_INVALID_OPERATOR 3 /**< Record Access Control Point response code - Operator not valid for service. */ +#define RACP_RESPONSE_OPERATOR_UNSUPPORTED 4 /**< Record Access Control Point response code - Unsupported operator. */ +#define RACP_RESPONSE_INVALID_OPERAND 5 /**< Record Access Control Point response code - Operand not valid for service. */ +#define RACP_RESPONSE_NO_RECORDS_FOUND 6 /**< Record Access Control Point response code - No matching records found. */ +#define RACP_RESPONSE_ABORT_FAILED 7 /**< Record Access Control Point response code - Abort could not be completed. */ +#define RACP_RESPONSE_PROCEDURE_NOT_DONE 8 /**< Record Access Control Point response code - Procedure could not be completed. */ +#define RACP_RESPONSE_OPERAND_UNSUPPORTED 9 /**< Record Access Control Point response code - Unsupported operand. */ /**@brief Record Access Control Point value structure. */ typedef struct @@ -118,6 +123,12 @@ void ble_racp_decode(uint8_t data_len, uint8_t * p_data, ble_racp_value_t * p_ra */ uint8_t ble_racp_encode(const ble_racp_value_t * p_racp_val, uint8_t * p_data); + +#ifdef __cplusplus +} +#endif + #endif // BLE_RACP_H__ /** @} */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c index b460733871..22989aff22 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c @@ -36,10 +36,8 @@ * */ - #include "ble_radio_notification.h" #include -#include "nrf_nvic.h" static bool m_radio_active = false; /**< Current radio state. */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.h index 02e5b25bf0..2d69e3e461 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup ble_radio_notification Radio Notification Event Handler @@ -52,6 +51,9 @@ #include #include "nrf_soc.h" +#ifdef __cplusplus +extern "C" { +#endif /**@brief Application radio notification event handler type. */ typedef void (*ble_radio_notification_evt_handler_t) (bool radio_active); @@ -69,6 +71,11 @@ uint32_t ble_radio_notification_init(uint32_t irq_pr uint8_t distance, ble_radio_notification_evt_handler_t evt_handler); + +#ifdef __cplusplus +} +#endif + #endif // BLE_RADIO_NOTIFICATION_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c index 333533af54..ac2369eb78 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Nordic Semiconductor ASA + * Copyright (c) 2012 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,170 +36,97 @@ * */ +/* Attention! +* To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ #include "ble_dfu.h" -#include "nrf_ble_types.h" -#include "nrf_ble_gatts.h" +#include "nrf_log.h" +#include +#include "ble_hci.h" +#include "sdk_macros.h" #include "ble_srv_common.h" -#include -#include "sdk_common.h" +#include "nrf_dfu_settings.h" -#define MAX_DFU_PKT_LEN 20 /**< Maximum length (in bytes) of the DFU Packet characteristic. */ -#define PKT_START_DFU_PARAM_LEN 2 /**< Length (in bytes) of the parameters for Packet Start DFU Request. */ -#define PKT_INIT_DFU_PARAM_LEN 2 /**< Length (in bytes) of the parameters for Packet Init DFU Request. */ -#define PKT_RCPT_NOTIF_REQ_LEN 3 /**< Length (in bytes) of the Packet Receipt Notification Request. */ -#define MAX_PKTS_RCPT_NOTIF_LEN 6 /**< Maximum length (in bytes) of the Packets Receipt Notification. */ -#define MAX_RESPONSE_LEN 7 /**< Maximum length (in bytes) of the response to a Control Point command. */ -#define MAX_NOTIF_BUFFER_LEN MAX(MAX_PKTS_RCPT_NOTIF_LEN, MAX_RESPONSE_LEN) /**< Maximum length (in bytes) of the buffer needed by DFU Service while sending notifications to peer. */ +#define MAX_CTRL_POINT_RESP_PARAM_LEN 3 -enum +ble_dfu_t * p_m_dfu; + + +void flash_callback(fs_evt_t const * const evt, fs_ret_t result) { - OP_CODE_START_DFU = 1, /**< Value of the Op code field for 'Start DFU' command.*/ - OP_CODE_RECEIVE_INIT = 2, /**< Value of the Op code field for 'Initialize DFU parameters' command.*/ - OP_CODE_RECEIVE_FW = 3, /**< Value of the Op code field for 'Receive firmware image' command.*/ - OP_CODE_VALIDATE = 4, /**< Value of the Op code field for 'Validate firmware' command.*/ - OP_CODE_ACTIVATE_N_RESET = 5, /**< Value of the Op code field for 'Activate & Reset' command.*/ - OP_CODE_SYS_RESET = 6, /**< Value of the Op code field for 'Reset System' command.*/ - OP_CODE_IMAGE_SIZE_REQ = 7, /**< Value of the Op code field for 'Report received image size' command.*/ - OP_CODE_PKT_RCPT_NOTIF_REQ = 8, /**< Value of the Op code field for 'Request packet receipt notification.*/ - OP_CODE_RESPONSE = 16, /**< Value of the Op code field for 'Response.*/ - OP_CODE_PKT_RCPT_NOTIF = 17 /**< Value of the Op code field for 'Packets Receipt Notification'.*/ -}; + if (result == FS_SUCCESS) + { + NRF_LOG_INFO("Obtained settings, enter dfu is %d\n", s_dfu_settings.enter_buttonless_dfu); -static bool m_is_dfu_service_initialized = false; /**< Variable to check if the DFU service was initialized by the application.*/ -static uint8_t m_notif_buffer[MAX_NOTIF_BUFFER_LEN]; /**< Buffer used for sending notifications to peer. */ + (void)sd_ble_gap_disconnect(p_m_dfu->conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); -/**@brief Function for adding DFU Packet characteristic to the BLE Stack. - * - * @param[in] p_dfu DFU Service structure. - * - * @return NRF_SUCCESS on success. Otherwise an error code. - */ -static uint32_t dfu_pkt_char_add(ble_dfu_t * const p_dfu) + p_m_dfu->is_waiting_for_disconnection = true; + } +} + +static void enter_bootloader(ble_dfu_t * p_dfu) { - ble_gatts_char_md_t char_md; - ble_gatts_attr_t attr_char_value; - ble_uuid_t char_uuid; - ble_gatts_attr_md_t attr_md; + if (p_dfu->evt_handler != NULL) + { + ble_dfu_evt_t evt; - memset(&char_md, 0, sizeof(char_md)); + evt.type = BLE_DFU_EVT_ENTERING_BOOTLOADER; - char_md.char_props.write_wo_resp = 1; - char_md.p_char_user_desc = NULL; - char_md.p_char_pf = NULL; - char_md.p_user_desc_md = NULL; - char_md.p_cccd_md = NULL; - char_md.p_sccd_md = NULL; + p_dfu->evt_handler(p_dfu, &evt); + } - char_uuid.type = p_dfu->uuid_type; - char_uuid.uuid = BLE_DFU_PKT_CHAR_UUID; + s_dfu_settings.enter_buttonless_dfu = true; - memset(&attr_md, 0, sizeof(attr_md)); + (void)nrf_dfu_settings_write(flash_callback); - BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); - - attr_md.vloc = BLE_GATTS_VLOC_STACK; - attr_md.rd_auth = 0; - attr_md.wr_auth = 0; - attr_md.vlen = 1; - - memset(&attr_char_value, 0, sizeof(attr_char_value)); - - attr_char_value.p_uuid = &char_uuid; - attr_char_value.p_attr_md = &attr_md; - attr_char_value.init_len = 0; - attr_char_value.init_offs = 0; - attr_char_value.max_len = MAX_DFU_PKT_LEN; - attr_char_value.p_value = NULL; - - return sd_ble_gatts_characteristic_add(p_dfu->service_handle, - &char_md, - &attr_char_value, - &p_dfu->dfu_pkt_handles); + /* + TODO: + - Save bond data + */ } -/**@brief Function for adding DFU Revision characteristic to the BLE Stack. +/**@brief Function for adding RX characteristic. * - * @param[in] p_dfu DFU Service structure. + * @param[in] p_nus Nordic UART Service structure. + * @param[in] p_nus_init Information needed to initialize the service. * - * @return NRF_SUCCESS on success. Otherwise an error code. + * @return NRF_SUCCESS on success, otherwise an error code. */ -static uint32_t dfu_rev_char_add(ble_dfu_t * const p_dfu, ble_dfu_init_t const * const p_dfu_init) +static uint32_t rx_char_add(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init) { + /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */ ble_gatts_char_md_t char_md; + ble_gatts_attr_md_t cccd_md; ble_gatts_attr_t attr_char_value; - ble_uuid_t char_uuid; + ble_uuid_t ble_uuid; ble_gatts_attr_md_t attr_md; + memset(&cccd_md, 0, sizeof(cccd_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); + + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + memset(&char_md, 0, sizeof(char_md)); - char_md.char_props.read = 1; - char_md.p_char_user_desc = NULL; - char_md.p_char_pf = NULL; - char_md.p_user_desc_md = NULL; - char_md.p_cccd_md = NULL; - char_md.p_sccd_md = NULL; + char_md.char_props.notify = 1; + char_md.char_props.write = 1; + char_md.p_char_user_desc = NULL; + char_md.p_char_pf = NULL; + char_md.p_user_desc_md = NULL; + char_md.p_cccd_md = &cccd_md; + char_md.p_sccd_md = NULL; - char_uuid.type = p_dfu->uuid_type; - char_uuid.uuid = BLE_DFU_REV_CHAR_UUID; + ble_uuid.type = p_dfu->uuid_type; + ble_uuid.uuid = 0x0001; memset(&attr_md, 0, sizeof(attr_md)); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm); - - attr_md.vloc = BLE_GATTS_VLOC_STACK; - attr_md.rd_auth = 0; - attr_md.wr_auth = 0; - attr_md.vlen = 1; - - memset(&attr_char_value, 0, sizeof(attr_char_value)); - - attr_char_value.p_uuid = &char_uuid; - attr_char_value.p_attr_md = &attr_md; - attr_char_value.init_len = sizeof(uint16_t); - attr_char_value.init_offs = 0; - attr_char_value.max_len = sizeof(uint16_t); - attr_char_value.p_value = (uint8_t *)&p_dfu_init->revision; - - return sd_ble_gatts_characteristic_add(p_dfu->service_handle, - &char_md, - &attr_char_value, - &p_dfu->dfu_rev_handles); -} - - -/**@brief Function for adding DFU Control Point characteristic to the BLE Stack. - * - * @param[in] p_dfu DFU Service structure. - * - * @return NRF_SUCCESS on success. Otherwise an error code. - */ -static uint32_t dfu_ctrl_pt_add(ble_dfu_t * const p_dfu) -{ - ble_gatts_char_md_t char_md; - ble_gatts_attr_t attr_char_value; - ble_uuid_t char_uuid; - ble_gatts_attr_md_t attr_md; - - memset(&char_md, 0, sizeof(char_md)); - - char_md.char_props.write = 1; - char_md.char_props.notify = 1; - char_md.p_char_user_desc = NULL; - char_md.p_char_pf = NULL; - char_md.p_user_desc_md = NULL; - char_md.p_cccd_md = NULL; - char_md.p_sccd_md = NULL; - - char_uuid.type = p_dfu->uuid_type; - char_uuid.uuid = BLE_DFU_CTRL_PT_UUID; - - memset(&attr_md, 0, sizeof(attr_md)); - - BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); attr_md.vloc = BLE_GATTS_VLOC_STACK; @@ -209,468 +136,279 @@ static uint32_t dfu_ctrl_pt_add(ble_dfu_t * const p_dfu) memset(&attr_char_value, 0, sizeof(attr_char_value)); - attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_uuid = &ble_uuid; attr_char_value.p_attr_md = &attr_md; attr_char_value.init_len = 0; attr_char_value.init_offs = 0; attr_char_value.max_len = BLE_L2CAP_MTU_DEF; - attr_char_value.p_value = NULL; return sd_ble_gatts_characteristic_add(p_dfu->service_handle, &char_md, &attr_char_value, - &p_dfu->dfu_ctrl_pt_handles); + &p_dfu->control_point_char); + /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */ } -/**@brief Function for handling the @ref BLE_GAP_EVT_CONNECTED event from the S110 SoftDevice. + +uint32_t ble_dfu_init(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + ble_uuid128_t nus_base_uuid = BLE_DFU_BASE_UUID; + + VERIFY_PARAM_NOT_NULL(p_dfu); + VERIFY_PARAM_NOT_NULL(p_dfu_init); + + p_m_dfu = p_dfu; // TODO: find a nicer solution to this + + // Initialize the service structure. + p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; + p_dfu->evt_handler = p_dfu_init->evt_handler; + p_dfu->is_waiting_for_disconnection = false; + p_dfu->is_ctrlpt_notification_enabled = false; + + /**@snippet [Adding proprietary Service to S110 SoftDevice] */ + // Add a custom base UUID. + err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_dfu->uuid_type); + VERIFY_SUCCESS(err_code); + + ble_uuid.type = p_dfu->uuid_type; + ble_uuid.uuid = BLE_UUID_DFU_SERVICE; + + // Add the service. + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_dfu->service_handle); + /**@snippet [Adding proprietary Service to S110 SoftDevice] */ + VERIFY_SUCCESS(err_code); + + // Add the RX Characteristic. + err_code = rx_char_add(p_dfu, p_dfu_init); + VERIFY_SUCCESS(err_code); + + err_code = nrf_dfu_flash_init(true); + VERIFY_SUCCESS(err_code); + + nrf_dfu_settings_init(); + + return NRF_SUCCESS; +} + +static void resp_send(ble_dfu_t * p_dfu, ble_dfu_buttonless_op_code_t op_code, ble_dfu_rsp_code_t rsp_code) +{ + // Send notification + uint16_t hvx_len; + uint8_t hvx_data[MAX_CTRL_POINT_RESP_PARAM_LEN]; + ble_gatts_hvx_params_t hvx_params; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_len = 3; + hvx_data[0] = DFU_OP_RESPONSE_CODE; + hvx_data[1] = (uint8_t)op_code; + hvx_data[2] = (uint8_t)rsp_code; + + hvx_params.handle = p_dfu->control_point_char.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = hvx_data; + + (void)sd_ble_gatts_hvx(p_dfu->conn_handle, &hvx_params); +} + + + +/**@brief Handle write events to the Location and Navigation Service Control Point characteristic. * - * @param[in] p_dfu DFU Service Structure. - * @param[in] p_ble_evt Pointer to the event received from BLE stack. + * @param[in] p_dfu DFU Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. */ -static void on_connect(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) +static void on_ctrlpt_write(ble_dfu_t * p_dfu, ble_gatts_evt_write_t const * p_evt_write) +{ + uint32_t err_code; + ble_dfu_rsp_code_t rsp_code = DFU_RSP_OPERATION_FAILED; + + ble_gatts_rw_authorize_reply_params_t write_authorize_reply; + memset(&write_authorize_reply, 0, sizeof(write_authorize_reply)); + + write_authorize_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + + if (p_dfu->is_ctrlpt_notification_enabled) + { + write_authorize_reply.params.write.update = 1; + write_authorize_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + } + else + { + write_authorize_reply.params.write.gatt_status = DFU_RSP_CCCD_CONFIG_IMPROPER; + } + + // reply to the write authorization + do { + err_code = sd_ble_gatts_rw_authorize_reply(p_dfu->conn_handle, &write_authorize_reply); + } while (err_code == NRF_ERROR_BUSY); + + + if (write_authorize_reply.params.write.gatt_status != BLE_GATT_STATUS_SUCCESS) + { + return; + } + + // Start executing the control point write action + + switch (p_evt_write->data[0]) + { + case BLE_DFU_ENTER_BOOTLOADER: + rsp_code = DFU_RSP_SUCCESS; + break; + + // Unrecognized Op Code + default: + rsp_code = DFU_RSP_OP_CODE_NOT_SUPPORTED; + break; + } + + resp_send(p_dfu, (ble_dfu_buttonless_op_code_t)p_evt_write->data[0], rsp_code); + + if (rsp_code == BLE_DFU_ENTER_BOOTLOADER + && p_evt_write->data[0] == BLE_DFU_ENTER_BOOTLOADER) + { + enter_bootloader(p_dfu); + } +} + + +/**@brief Write authorization request event handler. + * + * @details The write authorization request event handler is called when writing to the control point. + * + * @param[in] p_dfu DFU structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) +{ + if (p_ble_evt->evt.gatts_evt.conn_handle != p_dfu->conn_handle) + { + return; + } + + const ble_gatts_evt_rw_authorize_request_t * p_auth_req = + &p_ble_evt->evt.gatts_evt.params.authorize_request; + + if ( + (p_auth_req->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + && + (p_auth_req->request.write.handle == p_dfu->control_point_char.value_handle) + && + (p_auth_req->request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ) + && + (p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) + && + (p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) + ) + { + on_ctrlpt_write(p_dfu, &p_auth_req->request.write); + } + +} + +/**@brief Connect event handler. + * + * @param[in] p_dfu DFU Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) { p_dfu->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; } -/**@brief Function for checking if the CCCD of DFU Control point is configured for Notification. +/**@brief Disconnect event handler. * - * @details This function checks if the CCCD of DFU Control Point characteristic is configured - * for Notification by the DFU Controller. - * - * @param[in] p_dfu DFU Service structure. - * - * @return True if the CCCD of DFU Control Point characteristic is configured for Notification. - * False otherwise. + * @param[in] p_dfu DFU Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. */ -static bool is_cccd_configured(ble_dfu_t * p_dfu) +static void on_disconnect(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) { - // Check if the CCCDs are configured. - uint8_t cccd_val_buf[BLE_CCCD_VALUE_LEN]; - ble_gatts_value_t gatts_value; - - // Initialize value struct. - memset(&gatts_value, 0, sizeof(gatts_value)); - - gatts_value.len = BLE_CCCD_VALUE_LEN; - gatts_value.offset = 0; - gatts_value.p_value = cccd_val_buf; - - // Check the CCCD Value of DFU Control Point. - uint32_t err_code = sd_ble_gatts_value_get(p_dfu->conn_handle, - p_dfu->dfu_ctrl_pt_handles.cccd_handle, - &gatts_value); - if (err_code != NRF_SUCCESS) + if (p_dfu->conn_handle != p_ble_evt->evt.gatts_evt.conn_handle) { - if (p_dfu->error_handler != NULL) - { - p_dfu->error_handler(err_code); - } - return false; + return; } - return ble_srv_is_notification_enabled(cccd_val_buf); + p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; + + if (p_dfu->is_waiting_for_disconnection) + { + NVIC_SystemReset(); + } } - -/**@brief Function for handling a Write event on the Control Point characteristic. +/**@brief Write event handler. * - * @param[in] p_dfu DFU Service Structure. - * @param[in] p_ble_write_evt Pointer to the write event received from BLE stack. - * - * @return NRF_SUCCESS on successful processing of control point write. Otherwise an error code. + * @param[in] p_dfu DFU Service structure. + * @param[in] p_ble_evt Event received from the BLE stack.rtt */ -static uint32_t on_ctrl_pt_write(ble_dfu_t * p_dfu, ble_gatts_evt_write_t * p_ble_write_evt) +static void on_write(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) { - ble_gatts_rw_authorize_reply_params_t auth_reply; + const ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; - auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; - auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; - auth_reply.params.write.update = 1; - auth_reply.params.write.offset = p_ble_write_evt->offset; - auth_reply.params.write.len = p_ble_write_evt->len; - auth_reply.params.write.p_data = p_ble_write_evt->data; - - - if (!is_cccd_configured(p_dfu)) + if (p_evt_write->handle != p_dfu->control_point_char.cccd_handle) { - // Send an error response to the peer indicating that the CCCD is improperly configured. - auth_reply.params.write.gatt_status = - BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR; - - return (sd_ble_gatts_rw_authorize_reply(p_dfu->conn_handle, &auth_reply)); - - } - else - { - uint32_t err_code; - - auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; - - err_code = (sd_ble_gatts_rw_authorize_reply(p_dfu->conn_handle, &auth_reply)); - VERIFY_SUCCESS(err_code); + return; } - ble_dfu_evt_t ble_dfu_evt; - - switch (p_ble_write_evt->data[0]) + if (p_evt_write->len == BLE_CCCD_VALUE_LEN) { - case OP_CODE_START_DFU: - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_START; + // CCCD written, update indications state + p_dfu->is_ctrlpt_notification_enabled = ble_srv_is_notification_enabled(p_evt_write->data); - if (p_ble_write_evt->len < PKT_START_DFU_PARAM_LEN) + if (p_dfu->evt_handler != NULL) + { + ble_dfu_evt_t evt; + + if (p_dfu->is_ctrlpt_notification_enabled) { - return ble_dfu_response_send(p_dfu, - (ble_dfu_procedure_t) p_ble_write_evt->data[0], - BLE_DFU_RESP_VAL_OPER_FAILED); - } - - ble_dfu_evt.evt.ble_dfu_pkt_write.len = 1; - ble_dfu_evt.evt.ble_dfu_pkt_write.p_data = &(p_ble_write_evt->data[1]); - - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - break; - - case OP_CODE_RECEIVE_INIT: - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_RECEIVE_INIT_DATA; - - if (p_ble_write_evt->len < PKT_INIT_DFU_PARAM_LEN) - { - return ble_dfu_response_send(p_dfu, - (ble_dfu_procedure_t) p_ble_write_evt->data[0], - BLE_DFU_RESP_VAL_OPER_FAILED); - } - - ble_dfu_evt.evt.ble_dfu_pkt_write.len = 1; - ble_dfu_evt.evt.ble_dfu_pkt_write.p_data = &(p_ble_write_evt->data[1]); - - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - break; - - case OP_CODE_RECEIVE_FW: - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_RECEIVE_APP_DATA; - - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - break; - - case OP_CODE_VALIDATE: - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_VALIDATE; - - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - break; - - case OP_CODE_ACTIVATE_N_RESET: - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_ACTIVATE_N_RESET; - - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - break; - - case OP_CODE_SYS_RESET: - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_SYS_RESET; - - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - break; - - case OP_CODE_PKT_RCPT_NOTIF_REQ: - if (p_ble_write_evt->len < PKT_RCPT_NOTIF_REQ_LEN) - { - return (ble_dfu_response_send(p_dfu, - BLE_DFU_PKT_RCPT_REQ_PROCEDURE, - BLE_DFU_RESP_VAL_NOT_SUPPORTED)); - } - - ble_dfu_evt.evt.pkt_rcpt_notif_req.num_of_pkts = - uint16_decode(&(p_ble_write_evt->data[1])); - - if (ble_dfu_evt.evt.pkt_rcpt_notif_req.num_of_pkts == 0) - { - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_PKT_RCPT_NOTIF_DISABLED; + evt.type = BLE_DFU_EVT_INDICATION_ENABLED; } else { - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_PKT_RCPT_NOTIF_ENABLED; + evt.type = BLE_DFU_EVT_INDICATION_DISABLED; } - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - - break; - - case OP_CODE_IMAGE_SIZE_REQ: - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_BYTES_RECEIVED_SEND; - - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - break; - - default: - // Unsupported op code. - return ble_dfu_response_send(p_dfu, - (ble_dfu_procedure_t) p_ble_write_evt->data[0], - BLE_DFU_RESP_VAL_NOT_SUPPORTED); - } - return NRF_SUCCESS; -} - - -/**@brief Function for handling the @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event from the S110 - * Stack. - * - * @param[in] p_dfu DFU Service Structure. - * @param[in] p_ble_evt Pointer to the event received from BLE stack. - */ -static void on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) -{ - ble_gatts_evt_rw_authorize_request_t * p_authorize_request; - - p_authorize_request = &(p_ble_evt->evt.gatts_evt.params.authorize_request); - - if ( - (p_authorize_request->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) - && - (p_authorize_request->request.write.handle == p_dfu->dfu_ctrl_pt_handles.value_handle) - && - (p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ) - && - (p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) - && - (p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) - ) - { - uint32_t err_code; - - err_code = on_ctrl_pt_write(p_dfu, &(p_authorize_request->request.write)); - - if (err_code != NRF_SUCCESS && p_dfu->error_handler != NULL) - { - p_dfu->error_handler(err_code); + p_dfu->evt_handler(p_dfu, &evt); } } } -/**@brief Function for handling the @ref BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. - * - * @param[in] p_dfu DFU Service Structure. - * @param[in] p_ble_evt Pointer to the event received from BLE stack. - */ -static void on_write(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) -{ - if (p_ble_evt->evt.gatts_evt.params.write.handle == p_dfu->dfu_pkt_handles.value_handle) - { - // DFU Packet written - - ble_dfu_evt_t ble_dfu_evt; - - ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_PACKET_WRITE; - ble_dfu_evt.evt.ble_dfu_pkt_write.len = p_ble_evt->evt.gatts_evt.params.write.len; - ble_dfu_evt.evt.ble_dfu_pkt_write.p_data = p_ble_evt->evt.gatts_evt.params.write.data; - - p_dfu->evt_handler(p_dfu, &ble_dfu_evt); - } -} - - -/**@brief Function for handling the BLE_GAP_EVT_DISCONNECTED event from the S110 SoftDevice. - * - * @param[in] p_dfu DFU Service Structure. - * @param[in] p_ble_evt Pointer to the event received from BLE stack. - */ -static void on_disconnect(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) -{ - p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; -} - - -uint32_t ble_dfu_init(ble_dfu_t * p_dfu, ble_dfu_init_t * p_dfu_init) -{ - if ((p_dfu == NULL) || (p_dfu_init == NULL) || (p_dfu_init->evt_handler == NULL)) - { - return NRF_ERROR_NULL; - } - - p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; - - ble_uuid_t service_uuid; - uint32_t err_code; - - const ble_uuid128_t base_uuid128 = - { - { - 0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, - 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00 - } - }; - - service_uuid.uuid = BLE_DFU_SERVICE_UUID; - - err_code = sd_ble_uuid_vs_add(&base_uuid128, &(service_uuid.type)); - VERIFY_SUCCESS(err_code); - - err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, - &service_uuid, - &(p_dfu->service_handle)); - VERIFY_SUCCESS(err_code); - - p_dfu->uuid_type = service_uuid.type; - - err_code = dfu_pkt_char_add(p_dfu); - VERIFY_SUCCESS(err_code); - - err_code = dfu_ctrl_pt_add(p_dfu); - VERIFY_SUCCESS(err_code); - - err_code = dfu_rev_char_add(p_dfu, p_dfu_init); - VERIFY_SUCCESS(err_code); - - p_dfu->evt_handler = p_dfu_init->evt_handler; - - if (p_dfu_init->error_handler != NULL) - { - p_dfu->error_handler = p_dfu_init->error_handler; - } - - m_is_dfu_service_initialized = true; - - return NRF_SUCCESS; -} - - void ble_dfu_on_ble_evt(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) { - if ((p_dfu == NULL) || (p_ble_evt == NULL)) + VERIFY_PARAM_NOT_NULL_VOID(p_dfu); + VERIFY_PARAM_NOT_NULL_VOID(p_ble_evt); + + switch (p_ble_evt->header.evt_id) { - return; + case BLE_GAP_EVT_CONNECTED: + on_connect(p_dfu, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_dfu, p_ble_evt); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + on_rw_authorize_req(p_dfu, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_dfu, p_ble_evt); + break; + + default: + // no implementation + break; } - if (p_dfu->evt_handler != NULL) - { - switch (p_ble_evt->header.evt_id) - { - case BLE_GAP_EVT_CONNECTED: - on_connect(p_dfu, p_ble_evt); - break; - - case BLE_GATTS_EVT_WRITE: - on_write(p_dfu, p_ble_evt); - break; - - case BLE_GAP_EVT_DISCONNECTED: - on_disconnect(p_dfu, p_ble_evt); - break; - - case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: - on_rw_authorize_req(p_dfu, p_ble_evt); - break; - - default: - // No implementation needed. - break; - } - } -} - - -uint32_t ble_dfu_bytes_rcvd_report(ble_dfu_t * p_dfu, uint32_t num_of_firmware_bytes_rcvd) -{ - if (p_dfu == NULL) - { - return NRF_ERROR_NULL; - } - - if ((p_dfu->conn_handle == BLE_CONN_HANDLE_INVALID) || !m_is_dfu_service_initialized) - { - return NRF_ERROR_INVALID_STATE; - } - - ble_gatts_hvx_params_t hvx_params; - uint16_t index = 0; - - // Encode the Op Code. - m_notif_buffer[index++] = OP_CODE_RESPONSE; - - // Encode the Reqest Op Code. - m_notif_buffer[index++] = OP_CODE_IMAGE_SIZE_REQ; - - // Encode the Response Value. - m_notif_buffer[index++] = (uint8_t)BLE_DFU_RESP_VAL_SUCCESS; - - index += uint32_encode(num_of_firmware_bytes_rcvd, &m_notif_buffer[index]); - - memset(&hvx_params, 0, sizeof(hvx_params)); - - hvx_params.handle = p_dfu->dfu_ctrl_pt_handles.value_handle; - hvx_params.type = BLE_GATT_HVX_NOTIFICATION; - hvx_params.offset = 0; - hvx_params.p_len = &index; - hvx_params.p_data = m_notif_buffer; - - return sd_ble_gatts_hvx(p_dfu->conn_handle, &hvx_params); -} - - -uint32_t ble_dfu_pkts_rcpt_notify(ble_dfu_t * p_dfu, uint32_t num_of_firmware_bytes_rcvd) -{ - if (p_dfu == NULL) - { - return NRF_ERROR_NULL; - } - - if ((p_dfu->conn_handle == BLE_CONN_HANDLE_INVALID) || !m_is_dfu_service_initialized) - { - return NRF_ERROR_INVALID_STATE; - } - - ble_gatts_hvx_params_t hvx_params; - uint16_t index = 0; - - m_notif_buffer[index++] = OP_CODE_PKT_RCPT_NOTIF; - - index += uint32_encode(num_of_firmware_bytes_rcvd, &m_notif_buffer[index]); - - memset(&hvx_params, 0, sizeof(hvx_params)); - - hvx_params.handle = p_dfu->dfu_ctrl_pt_handles.value_handle; - hvx_params.type = BLE_GATT_HVX_NOTIFICATION; - hvx_params.offset = 0; - hvx_params.p_len = &index; - hvx_params.p_data = m_notif_buffer; - - return sd_ble_gatts_hvx(p_dfu->conn_handle, &hvx_params); -} - - -uint32_t ble_dfu_response_send(ble_dfu_t * p_dfu, - ble_dfu_procedure_t dfu_proc, - ble_dfu_resp_val_t resp_val) -{ - if (p_dfu == NULL) - { - return NRF_ERROR_NULL; - } - - if ((p_dfu->conn_handle == BLE_CONN_HANDLE_INVALID) || !m_is_dfu_service_initialized) - { - return NRF_ERROR_INVALID_STATE; - } - - ble_gatts_hvx_params_t hvx_params; - uint16_t index = 0; - - m_notif_buffer[index++] = OP_CODE_RESPONSE; - - // Encode the Request Op code - m_notif_buffer[index++] = (uint8_t)dfu_proc; - - // Encode the Response Value. - m_notif_buffer[index++] = (uint8_t)resp_val; - - memset(&hvx_params, 0, sizeof(hvx_params)); - - hvx_params.handle = p_dfu->dfu_ctrl_pt_handles.value_handle; - hvx_params.type = BLE_GATT_HVX_NOTIFICATION; - hvx_params.offset = 0; - hvx_params.p_len = &index; - hvx_params.p_data = m_notif_buffer; - - return sd_ble_gatts_hvx(p_dfu->conn_handle, &hvx_params); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h index 9ce409ee2f..04d154d94f 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Nordic Semiconductor ASA + * Copyright (c) 2012 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,231 +36,117 @@ * */ - -/**@file +/** @file * - * @defgroup ble_sdk_srv_dfu Device Firmware Update Service + * @defgroup ble_dfu Buttonless DFU Service * @{ - * @ingroup ble_sdk_srv - * @brief Device Firmware Update Service + * @ingroup ble_sdk_srv + * @brief Buttonless DFU Service module. * - * @details The Device Firmware Update (DFU) service is a GATT based service that can be used for - * performing firmware updates over BLE. Note that this implementation uses vendor - * specific UUIDs for service and characteristics and is intended to demonstrate the - * firmware updates over BLE. Refer @ref bledfu_transport_bleservice and @ref - * bledfu_transport_bleprofile for more information on the service and profile respectively. + * @details + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. */ #ifndef BLE_DFU_H__ #define BLE_DFU_H__ #include -#include "nrf_ble_gatts.h" -#include "nrf_ble_gap.h" -#include "nrf_ble.h" #include "ble_srv_common.h" -#define BLE_DFU_SERVICE_UUID 0x1530 /**< The UUID of the DFU Service. */ -#define BLE_DFU_PKT_CHAR_UUID 0x1532 /**< The UUID of the DFU Packet Characteristic. */ -#define BLE_DFU_CTRL_PT_UUID 0x1531 /**< The UUID of the DFU Control Point. */ -#define BLE_DFU_STATUS_REP_UUID 0x1533 /**< The UUID of the DFU Status Report Characteristic. */ -#define BLE_DFU_REV_CHAR_UUID 0x1534 /**< The UUID of the DFU Revision Characteristic. */ +#ifdef __cplusplus +extern "C" { +#endif -/**@brief DFU Event type. - * - * @details This enumeration contains the types of events that will be received from the DFU Service. - */ -typedef enum -{ - BLE_DFU_START, /**< The event indicating that the peer wants the application to prepare for a new firmware update. */ - BLE_DFU_RECEIVE_INIT_DATA, /**< The event indicating that the peer wants the application to prepare to receive init parameters. */ - BLE_DFU_RECEIVE_APP_DATA, /**< The event indicating that the peer wants the application to prepare to receive the new firmware image. */ - BLE_DFU_VALIDATE, /**< The event indicating that the peer wants the application to validate the newly received firmware image. */ - BLE_DFU_ACTIVATE_N_RESET, /**< The event indicating that the peer wants the application to undergo activate new firmware and restart with new valid application */ - BLE_DFU_SYS_RESET, /**< The event indicating that the peer wants the application to undergo a reset and start the currently valid application image.*/ - BLE_DFU_PKT_RCPT_NOTIF_ENABLED, /**< The event indicating that the peer has enabled packet receipt notifications. It is the responsibility of the application to call @ref ble_dfu_pkts_rcpt_notify each time the number of packets indicated by num_of_pkts field in @ref ble_dfu_evt_t is received.*/ - BLE_DFU_PKT_RCPT_NOTIF_DISABLED, /**< The event indicating that the peer has disabled the packet receipt notifications.*/ - BLE_DFU_PACKET_WRITE, /**< The event indicating that the peer has written a value to the 'DFU Packet' characteristic. The data received from the peer will be present in the @ref BLE_DFU_PACKET_WRITE element contained within @ref ble_dfu_evt_t.*/ - BLE_DFU_BYTES_RECEIVED_SEND /**< The event indicating that the peer is requesting for the number of bytes of firmware data last received by the application. It is the responsibility of the application to call @ref ble_dfu_pkts_rcpt_notify in response to this event. */ +#define BLE_UUID_DFU_SERVICE 0x0001 +#define BLE_DFU_BASE_UUID {{0x50, 0xEA, 0xDA, 0x30, 0x88, 0x83, 0xB8, 0x9F, 0x60, 0x4F, 0x15, 0xF3, 0x00, 0x00, 0x40, 0x8E}} /**< Used vendor specific UUID. */ + +#define BLE_DFU_ENTER_BOOTLOADER 0x01 + +typedef enum { + BLE_DFU_EVT_ENTERING_BOOTLOADER, /**< Event indicating that the bootloader will be entered after return of this event.*/ + BLE_DFU_EVT_INDICATION_ENABLED, /**< Indication that the control point is enabled.*/ + BLE_DFU_EVT_INDICATION_DISABLED /**< Indication that the control point is disabled.*/ } ble_dfu_evt_type_t; -/**@brief DFU Procedure type. - * - * @details This enumeration contains the types of DFU procedures. - */ -typedef enum -{ - BLE_DFU_START_PROCEDURE = 1, /**< DFU Start procedure.*/ - BLE_DFU_INIT_PROCEDURE = 2, /**< DFU Initialization procedure.*/ - BLE_DFU_RECEIVE_APP_PROCEDURE = 3, /**< Firmware receiving procedure.*/ - BLE_DFU_VALIDATE_PROCEDURE = 4, /**< Firmware image validation procedure .*/ - BLE_DFU_PKT_RCPT_REQ_PROCEDURE = 8 /**< Packet receipt notification request procedure. */ -} ble_dfu_procedure_t; - -/**@brief DFU Response value type. - */ -typedef enum -{ - BLE_DFU_RESP_VAL_SUCCESS = 1, /**< Success.*/ - BLE_DFU_RESP_VAL_INVALID_STATE, /**< Invalid state.*/ - BLE_DFU_RESP_VAL_NOT_SUPPORTED, /**< Operation not supported.*/ - BLE_DFU_RESP_VAL_DATA_SIZE, /**< Data size exceeds limit.*/ - BLE_DFU_RESP_VAL_CRC_ERROR, /**< CRC Error.*/ - BLE_DFU_RESP_VAL_OPER_FAILED /**< Operation failed.*/ -} ble_dfu_resp_val_t; - - -/**@brief DFU Packet structure. - * - * @details This structure contains the value of the DFU Packet characteristic as written by the - * peer and the length of the value written. It will be filled by the DFU Service when the - * peer writes to the DFU Packet characteristic. - */ -typedef struct -{ - uint8_t * p_data; /**< Pointer to the received packet. This will point to a word aligned memory location.*/ - uint8_t len; /**< Length of the packet received. */ -} ble_dfu_pkt_write_t; - -/**@brief Packet receipt notification request structure. - * - * @details This structure contains the contents of the packet receipt notification request - * sent by the DFU Controller. - */ -typedef struct -{ - uint16_t num_of_pkts; /**< The number of packets of firmware data to be received by application before sending the next Packet Receipt Notification to the peer. */ -} ble_pkt_rcpt_notif_req_t; - -/**@brief DFU Event structure. - * - * @details This structure contains the event generated by the DFU Service based on the data - * received from the peer. - */ -typedef struct -{ - ble_dfu_evt_type_t ble_dfu_evt_type; /**< Type of the event.*/ - union - { - ble_dfu_pkt_write_t ble_dfu_pkt_write; /**< The DFU packet received. This field is when the @ref ble_dfu_evt_type field is set to @ref BLE_DFU_PACKET_WRITE.*/ - ble_pkt_rcpt_notif_req_t pkt_rcpt_notif_req; /**< Packet receipt notification request. This field is when the @ref ble_dfu_evt_type field is set to @ref BLE_DFU_PKT_RCPT_NOTIF_ENABLED.*/ - } evt; +typedef struct { + ble_dfu_evt_type_t type; } ble_dfu_evt_t; - -// Forward declaration of the ble_dfu_t type. +/* Forward declaration of the ble_nus_t type. */ typedef struct ble_dfu_s ble_dfu_t; -/**@brief DFU Service event handler type. */ +/**@brief Nordic UART Service event handler type. */ typedef void (*ble_dfu_evt_handler_t) (ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt); -/**@brief DFU service structure. - * - * @details This structure contains status information related to the service. - */ -struct ble_dfu_s + + +// Control Point response values +typedef enum { - uint16_t conn_handle; /**< Handle of the current connection (as provided by the SoftDevice). This will be BLE_CONN_HANDLE_INVALID when not in a connection. */ - uint16_t revision; /**< Handle of DFU Service (as provided by the SoftDevice). */ - uint16_t service_handle; /**< Handle of DFU Service (as provided by the SoftDevice). */ - uint8_t uuid_type; /**< UUID type assigned for DFU Service by the SoftDevice. */ - ble_gatts_char_handles_t dfu_pkt_handles; /**< Handles related to the DFU Packet characteristic. */ - ble_gatts_char_handles_t dfu_ctrl_pt_handles; /**< Handles related to the DFU Control Point characteristic. */ - ble_gatts_char_handles_t dfu_status_rep_handles; /**< Handles related to the DFU Status Report characteristic. */ - ble_gatts_char_handles_t dfu_rev_handles; /**< Handles related to the DFU Revision characteristic. */ - ble_dfu_evt_handler_t evt_handler; /**< The event handler to be called when an event is to be sent to the application.*/ - ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + DFU_RSP_RESERVED = 0x00, /**< Reserved for future use. */ + DFU_RSP_SUCCESS = 0x01, /**< Success. */ + DFU_RSP_OP_CODE_NOT_SUPPORTED = 0x02, /**< Op Code not supported. */ + DFU_RSP_OPERATION_FAILED = 0x04, /**< Operation Failed. */ + DFU_RSP_CCCD_CONFIG_IMPROPER = BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR /**< CCCD is improperly configured. */ +} ble_dfu_rsp_code_t; + +// Control Point Op Code values +typedef enum +{ + DFU_OP_RESERVED = 0x00, /**< Reserved for future use. */ + DFU_OP_ENTER_BOOTLOADER = 0x01, /**< Enter bootloader. */ + DFU_OP_RESPONSE_CODE = 0x20 /**< Response code. */ +} ble_dfu_buttonless_op_code_t; + + + +struct ble_dfu_s { + uint8_t uuid_type; /**< UUID type for DFU UUID. */ + uint16_t service_handle; /**< Handle of DFU (as provided by the SoftDevice). */ + uint16_t conn_handle; + ble_gatts_char_handles_t control_point_char; /**< Handles related to the DFU Control Point characteristic. */ + bool is_ctrlpt_notification_enabled; + + ble_dfu_evt_handler_t evt_handler; /**< Event handler which is called right before. */ + + bool is_waiting_for_disconnection; }; -/**@brief DFU service initialization structure. - * - * @details This structure contains the initialization information for the DFU Service. The - * application needs to fill this structure and pass it to the DFU Service using the - * @ref ble_dfu_init function. - */ -typedef struct -{ - uint16_t revision; /**< Revision number to be exposed by the DFU service. */ - ble_dfu_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Device Firmware Update Service. */ - ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ +typedef struct { + ble_dfu_evt_handler_t evt_handler; /**< Event handler which is called right before. */ + security_req_t ctrl_point_security_req_write_perm; /**< Read security level of the LN Control Point characteristic. */ + security_req_t ctrl_point_security_req_cccd_write_perm; /**< CCCD write security level of the LN Control Point characteristic. */ } ble_dfu_init_t; -/**@brief Function for handling a BLE event. + +/**@brief Function for initializing the Device Firmware Update module * - * @details The DFU service expects the application to call this function each time an event - * is received from the SoftDevice. This function processes the event, if it is - * relevant for the DFU service and calls the DFU event handler of the application if - * necessary. * - * @param[in] p_dfu Pointer to the DFU service structure. - * @param[in] p_ble_evt Pointer to the event received from SoftDevice. + * @param[in] p_dfu DFU Service structure. + * @param[in] p_dfu_init The structure containing the values of characteristics needed by the + * service. + * + * @return NRF_SUCCESS on successful initialization of service. + */ +uint32_t ble_dfu_init(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init); + + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Battery Service. + * + * @param[in] p_dfu DFU Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. */ void ble_dfu_on_ble_evt(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt); -/**@brief Function for initializing the DFU service. - * - * @param[out] p_dfu Device Firmware Update service structure. This structure will have to be - * supplied by the application. It will be initialized by this function, - * and will later be used to identify the service instance. - * @param[in] p_dfu_init Information needed to initialize the service. - * - * @return NRF_SUCCESS if the DFU service and its characteristics were successfully added to the - * SoftDevice. Otherwise an error code. - * This function returns NRF_ERROR_NULL if the value of evt_handler in p_dfu_init - * structure provided is NULL or if the pointers supplied as input are NULL. - */ -uint32_t ble_dfu_init(ble_dfu_t * p_dfu, ble_dfu_init_t * p_dfu_init); -/**@brief Function for sending response to a control point command. - * - * @details This function will encode a DFU Control Point response using the given input - * parameters and will send a notification of the same to the peer. - * - * @param[in] p_dfu Pointer to the DFU service structure. - * @param[in] dfu_proc Procedure for which this response is to be sent. - * @param[in] resp_val Response value. - * - * @return NRF_SUCCESS if the DFU Service has successfully requested the SoftDevice to - * send the notification. Otherwise an error code. - * This function returns NRF_ERROR_INVALID_STATE if the device is not connected to a - * peer or if the DFU service is not initialized or if the notification of the DFU - * Status Report characteristic was not enabled by the peer. It returns NRF_ERROR_NULL - * if the pointer p_dfu is NULL. - */ -uint32_t ble_dfu_response_send(ble_dfu_t * p_dfu, - ble_dfu_procedure_t dfu_proc, - ble_dfu_resp_val_t resp_val); +#ifdef __cplusplus +} +#endif -/**@brief Function for notifying the peer about the number of bytes of firmware data received. - * - * @param[in] p_dfu Pointer to the DFU service structure. - * @param[in] num_of_firmware_bytes_rcvd Number of bytes. - * - * @return NRF_SUCCESS if the DFU Service has successfully requested the SoftDevice to send - * the notification. Otherwise an error code. - * This function returns NRF_ERROR_INVALID_STATE if the device is not connected to a - * peer or if the DFU service is not initialized or if the notification of the DFU - * Status Report characteristic was not enabled by the peer. It returns NRF_ERROR_NULL - * if the pointer p_dfu is NULL. - */ -uint32_t ble_dfu_bytes_rcvd_report(ble_dfu_t * p_dfu, uint32_t num_of_firmware_bytes_rcvd); - -/**@brief Function for sending Packet Receipt Notification to the peer. - * - * This function will encode the number of bytes received as input parameter into a - * notification of the control point characteristic and send it to the peer. - * - * @param[in] p_dfu Pointer to the DFU service structure. - * @param[in] num_of_firmware_bytes_rcvd Number of bytes of firmware image received. - * - * @return NRF_SUCCESS if the DFU Service has successfully requested the SoftDevice to send - * the notification. Otherwise an error code. - * This function returns NRF_ERROR_INVALID_STATE if the device is not connected to a - * peer or if the DFU service is not initialized or if the notification of the DFU - * Status Report characteristic was not enabled by the peer. It returns NRF_ERROR_NULL - * if the pointer p_dfu is NULL. - */ -uint32_t ble_dfu_pkts_rcpt_notify(ble_dfu_t * p_dfu, uint32_t num_of_firmware_bytes_rcvd); - -#endif // BLE_DFU_H__ +#endif // BLE_DIS_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.c index 2b9eaaa286..f114952fba 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.c @@ -36,9 +36,8 @@ * */ - #include "ble_advdata.h" -#include "nrf_ble_gap.h" +#include "ble_gap.h" #include "ble_srv_common.h" #include "sdk_common.h" @@ -48,71 +47,6 @@ #define AD_TYPE_BLE_DEVICE_ADDR_TYPE_PUBLIC 0UL #define AD_TYPE_BLE_DEVICE_ADDR_TYPE_RANDOM 1UL -static uint32_t tk_value_encode(ble_advdata_tk_value_t * p_tk_value, - uint8_t * p_encoded_data, - uint16_t * p_offset, - uint16_t max_size) -{ - int8_t i; - - // Check for buffer overflow. - if (((*p_offset) + AD_TYPE_TK_VALUE_SIZE) > max_size) - { - return NRF_ERROR_DATA_SIZE; - } - - // Encode LE Role. - p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_TK_VALUE_DATA_SIZE); - *p_offset += ADV_LENGTH_FIELD_SIZE; - p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_SECURITY_MANAGER_TK_VALUE; - *p_offset += ADV_AD_TYPE_FIELD_SIZE; - - for (i = AD_TYPE_TK_VALUE_DATA_SIZE - 1; i >= 0; i--, (*p_offset)++) - { - p_encoded_data[*p_offset] = p_tk_value->tk[i]; - } - - return NRF_SUCCESS; -} - -static uint32_t le_role_encode(ble_advdata_le_role_t le_role, - uint8_t * p_encoded_data, - uint16_t * p_offset, - uint16_t max_size) -{ - // Check for buffer overflow. - if (((*p_offset) + AD_TYPE_LE_ROLE_SIZE) > max_size) - { - return NRF_ERROR_DATA_SIZE; - } - - // Encode LE Role. - p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_LE_ROLE_DATA_SIZE); - *p_offset += ADV_LENGTH_FIELD_SIZE; - p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_LE_ROLE; - *p_offset += ADV_AD_TYPE_FIELD_SIZE; - switch(le_role) - { - case BLE_ADVDATA_ROLE_ONLY_PERIPH: - p_encoded_data[*p_offset] = 0; - break; - case BLE_ADVDATA_ROLE_ONLY_CENTRAL: - p_encoded_data[*p_offset] = 1; - break; - case BLE_ADVDATA_ROLE_BOTH_PERIPH_PREFERRED: - p_encoded_data[*p_offset] = 2; - break; - case BLE_ADVDATA_ROLE_BOTH_CENTRAL_PREFERRED: - p_encoded_data[*p_offset] = 3; - break; - default: - return NRF_ERROR_INVALID_PARAM; - } - *p_offset += AD_TYPE_LE_ROLE_DATA_SIZE; - - return NRF_SUCCESS; -} - static uint32_t ble_device_addr_encode(uint8_t * p_encoded_data, uint16_t * p_offset, uint16_t max_size) @@ -126,11 +60,15 @@ static uint32_t ble_device_addr_encode(uint8_t * p_encoded_data, return NRF_ERROR_DATA_SIZE; } - // Get BLE address - err_code = sd_ble_gap_address_get(&device_addr); + // Get BLE address. + #if (NRF_SD_BLE_API_VERSION >= 3) + err_code = sd_ble_gap_addr_get(&device_addr); + #else + err_code = sd_ble_gap_address_get(&device_addr); + #endif VERIFY_SUCCESS(err_code); - // Encode LE Bluetooth Device Address + // Encode LE Bluetooth Device Address. p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_BLE_DEVICE_ADDR_DATA_SIZE); *p_offset += ADV_LENGTH_FIELD_SIZE; @@ -138,7 +76,7 @@ static uint32_t ble_device_addr_encode(uint8_t * p_encoded_data, *p_offset += ADV_AD_TYPE_FIELD_SIZE; memcpy(&p_encoded_data[*p_offset], &device_addr.addr[0], BLE_GAP_ADDR_LEN); *p_offset += BLE_GAP_ADDR_LEN; - if(BLE_GAP_ADDR_TYPE_PUBLIC == device_addr.addr_type) + if (BLE_GAP_ADDR_TYPE_PUBLIC == device_addr.addr_type) { p_encoded_data[*p_offset] = AD_TYPE_BLE_DEVICE_ADDR_TYPE_PUBLIC; } @@ -163,7 +101,7 @@ static uint32_t name_encode(const ble_advdata_t * p_advdata, // Validate parameters - if((BLE_ADVDATA_SHORT_NAME == p_advdata->name_type) && (0 == p_advdata->short_name_len)) + if ((BLE_ADVDATA_SHORT_NAME == p_advdata->name_type) && (0 == p_advdata->short_name_len)) { return NRF_ERROR_INVALID_PARAM; } @@ -211,7 +149,7 @@ static uint32_t name_encode(const ble_advdata_t * p_advdata, } // There is only 1 byte intended to encode length which is (actual_length + ADV_AD_TYPE_FIELD_SIZE) - if(actual_length > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) + if (actual_length > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) { return NRF_ERROR_DATA_SIZE; } @@ -276,28 +214,6 @@ static uint32_t flags_encode(int8_t flags, return NRF_SUCCESS; } -static uint32_t sec_mgr_oob_flags_encode(uint8_t oob_flags, - uint8_t * p_encoded_data, - uint16_t * p_offset, - uint16_t max_size) -{ - // Check for buffer overflow. - if (((*p_offset) + AD_TYPE_OOB_FLAGS_SIZE) > max_size) - { - return NRF_ERROR_DATA_SIZE; - } - - // Encode flags. - p_encoded_data[*p_offset] = (uint8_t)(ADV_AD_TYPE_FIELD_SIZE + AD_TYPE_OOB_FLAGS_DATA_SIZE); - *p_offset += ADV_LENGTH_FIELD_SIZE; - p_encoded_data[*p_offset] = BLE_GAP_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS; - *p_offset += ADV_AD_TYPE_FIELD_SIZE; - p_encoded_data[*p_offset] = oob_flags; - *p_offset += AD_TYPE_OOB_FLAGS_DATA_SIZE; - - return NRF_SUCCESS; -} - static uint32_t tx_power_level_encode(int8_t tx_power_level, uint8_t * p_encoded_data, uint16_t * p_offset, @@ -376,7 +292,7 @@ static uint32_t uuid_list_sized_encode(const ble_advdata_uuid_list_t * p_uuid_li // Write length. length = (*p_offset) - (start_pos + ADV_LENGTH_FIELD_SIZE); // There is only 1 byte intended to encode length - if(length > 0x00FF) + if (length > 0x00FF) { return NRF_ERROR_DATA_SIZE; } @@ -500,7 +416,7 @@ static uint32_t manuf_specific_data_encode(const ble_advdata_manuf_data_t * p_ma } // There is only 1 byte intended to encode length which is (data_size + ADV_AD_TYPE_FIELD_SIZE) - if(data_size > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) + if (data_size > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) { return NRF_ERROR_DATA_SIZE; } @@ -552,7 +468,7 @@ static uint32_t service_data_encode(const ble_advdata_t * p_advdata, data_size = AD_TYPE_SERV_DATA_16BIT_UUID_SIZE + p_service_data->data.size; // There is only 1 byte intended to encode length which is (data_size + ADV_AD_TYPE_FIELD_SIZE) - if(data_size > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) + if (data_size > (0x00FF - ADV_AD_TYPE_FIELD_SIZE)) { return NRF_ERROR_DATA_SIZE; } @@ -589,30 +505,6 @@ uint32_t adv_data_encode(ble_advdata_t const * const p_advdata, uint16_t max_size = *p_len; *p_len = 0; - //Encode Security Manager OOB Flags - if (p_advdata->p_sec_mgr_oob_flags != NULL) - { - err_code = sec_mgr_oob_flags_encode(*p_advdata->p_sec_mgr_oob_flags, - p_encoded_data, - p_len, - max_size); - VERIFY_SUCCESS(err_code); - } - - // Encode Security Manager TK value - if (NULL != p_advdata->p_tk_value) - { - err_code = tk_value_encode(p_advdata->p_tk_value, p_encoded_data, p_len, max_size); - VERIFY_SUCCESS(err_code); - } - - // Encode LE Role - if (BLE_ADVDATA_ROLE_NOT_PRESENT != p_advdata->le_role) - { - err_code = le_role_encode(p_advdata->le_role, p_encoded_data, p_len, max_size); - VERIFY_SUCCESS(err_code); - } - // Encode LE Bluetooth Device Address if (p_advdata->include_ble_device_addr) { @@ -628,7 +520,7 @@ uint32_t adv_data_encode(ble_advdata_t const * const p_advdata, } //Encode Flags - if(p_advdata->flags != 0 ) + if (p_advdata->flags != 0 ) { err_code = flags_encode(p_advdata->flags, p_encoded_data, p_len, max_size); VERIFY_SUCCESS(err_code); diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h index 75a0d014c9..cc16c20d8c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup ble_sdk_lib_advdata Advertising and Scan Response Data Encoder @@ -52,20 +51,18 @@ #include #include #include -#include "nrf_ble.h" +#include "ble.h" #include "app_util.h" +#ifdef __cplusplus +extern "C" { +#endif + #define ADV_LENGTH_FIELD_SIZE 1UL /**< Advertising Data and Scan Response format contains 1 octet for the length. */ #define ADV_AD_TYPE_FIELD_SIZE 1UL /**< Advertising Data and Scan Response format contains 1 octet for the AD type. */ #define ADV_AD_DATA_OFFSET (ADV_LENGTH_FIELD_SIZE + \ ADV_AD_TYPE_FIELD_SIZE) /**< Offset for the AD data field of the Advertising Data and Scan Response format. */ -#define AD_TYPE_TK_VALUE_DATA_SIZE (sizeof(ble_advdata_tk_value_t)) /**< Data size (in octets) of the Security Manager TK value AD type. */ -#define AD_TYPE_TK_VALUE_SIZE (ADV_AD_DATA_OFFSET + \ - AD_TYPE_TK_VALUE_DATA_SIZE) /**< Size (in octets) of the Security Manager TK value AD type. */ -#define AD_TYPE_LE_ROLE_DATA_SIZE 1UL /**< Data size (in octets) of the LE Bluetooth Device Address AD type. */ -#define AD_TYPE_LE_ROLE_SIZE (ADV_AD_DATA_OFFSET + \ - AD_TYPE_LE_ROLE_DATA_SIZE) /**< Size (in octets) of the LE Bluetooth Device Address AD type. */ #define AD_TYPE_BLE_DEVICE_ADDR_TYPE_SIZE 1UL /**< Data size (in octets) of the Address type of the LE Bluetooth Device Address AD type. */ #define AD_TYPE_BLE_DEVICE_ADDR_DATA_SIZE (BLE_GAP_ADDR_LEN + \ AD_TYPE_BLE_DEVICE_ADDR_TYPE_SIZE) /**< Data size (in octets) of the LE Bluetooth Device Address AD type. */ @@ -85,24 +82,11 @@ AD_TYPE_CONN_INT_DATA_SIZE) /**< Data size (in octets) of the Slave Connection Interval Range AD type. */ #define AD_TYPE_MANUF_SPEC_DATA_ID_SIZE 2UL /**< Size (in octets) of the Company Identifier Code, which is a part of the Manufacturer Specific Data AD type. */ #define AD_TYPE_SERV_DATA_16BIT_UUID_SIZE 2UL /**< Size (in octets) of the 16-bit UUID, which is a part of the Service Data AD type. */ -#define AD_TYPE_OOB_FLAGS_DATA_SIZE 1UL /**< Data size (in octets) of the Security Manager OOB Flags AD type. */ -#define AD_TYPE_OOB_FLAGS_SIZE (ADV_AD_DATA_OFFSET + \ - AD_TYPE_OOB_FLAGS_DATA_SIZE) /**< Size (in octets) of the Security Manager OOB Flags AD type. */ - -#define AD_TYPE_SEC_MGR_OOB_FLAG_SET 1U /**< Security Manager OOB Flag set. Flag selection is done using _POS defines */ -#define AD_TYPE_SEC_MGR_OOB_FLAG_CLEAR 0U /**< Security Manager OOB Flag clear. Flag selection is done using _POS defines */ -#define AD_TYPE_SEC_MGR_OOB_FLAG_OOB_DATA_PRESENT_POS 0UL /**< Security Manager OOB Data Present Flag position. */ -#define AD_TYPE_SEC_MGR_OOB_FLAG_OOB_LE_SUPPORTED_POS 1UL /**< Security Manager OOB Low Energy Supported Flag position. */ -#define AD_TYPE_SEC_MGR_OOB_FLAG_SIM_LE_AND_EP_POS 2UL /**< Security Manager OOB Simultaneous LE and BR/EDR to Same Device Capable Flag position. */ -#define AD_TYPE_SEC_MGR_OOB_ADDRESS_TYPE_PUBLIC 0UL /**< Security Manager OOB Public Address type. */ -#define AD_TYPE_SEC_MGR_OOB_ADDRESS_TYPE_RANDOM 1UL /**< Security Manager OOB Random Address type. */ -#define AD_TYPE_SEC_MGR_OOB_FLAG_ADDRESS_TYPE_POS 3UL /**< Security Manager OOB Address type Flag (0 = Public Address, 1 = Random Address) position. */ - /**@brief Security Manager TK value. */ typedef struct { - uint8_t tk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing TK value. */ + uint8_t tk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing TK value in little-endian format. */ } ble_advdata_tk_value_t; /**@brief Advertising data LE Role types. This enumeration contains the options available for the LE role inside @@ -173,6 +157,7 @@ typedef struct ble_advdata_le_role_t le_role; /**< LE Role field. Included when different from @ref BLE_ADVDATA_ROLE_NOT_PRESENT. @warning This field can be used only for NFC. For BLE advertising, set it to NULL. */ ble_advdata_tk_value_t * p_tk_value; /**< Security Manager TK value field. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/ uint8_t * p_sec_mgr_oob_flags; /**< Security Manager Out Of Band Flags field. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/ + ble_gap_lesc_oob_data_t * p_lesc_data; /**< LE Secure Connections OOB data. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/ } ble_advdata_t; /**@brief Function for encoding data in the Advertising and Scan Response data format @@ -234,6 +219,11 @@ uint32_t adv_data_encode(ble_advdata_t const * const p_advdata, */ uint32_t ble_advdata_set(const ble_advdata_t * p_advdata, const ble_advdata_t * p_srdata); + +#ifdef __cplusplus +} +#endif + #endif // BLE_ADVDATA_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h index 81bca6eae5..ac69e0781f 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup ble_sdk_lib_conn_params Connection Parameters Negotiation @@ -49,9 +48,13 @@ #define BLE_CONN_PARAMS_H__ #include -#include "nrf_ble.h" +#include "ble.h" #include "ble_srv_common.h" +#ifdef __cplusplus +extern "C" { +#endif + /**@brief Connection Parameters Module event type. */ typedef enum { @@ -133,6 +136,11 @@ uint32_t ble_conn_params_change_conn_params(ble_gap_conn_params_t *new_params); */ void ble_conn_params_on_ble_evt(ble_evt_t * p_ble_evt); + +#ifdef __cplusplus +} +#endif + #endif // BLE_CONN_PARAMS_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c index 060ce77e34..3d008a9730 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c @@ -36,12 +36,11 @@ * */ - #include "ble_conn_state.h" #include #include #include -#include "nrf_ble.h" +#include "ble.h" #include "sdk_mapped_flags.h" #include "app_error.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h index d5b48aa9cf..b39c76ff25 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h @@ -36,7 +36,6 @@ * */ - /** * @file * @@ -69,9 +68,13 @@ #include #include -#include "nrf_ble.h" +#include "ble.h" #include "sdk_mapped_flags.h" +#ifdef __cplusplus +extern "C" { +#endif + /**@brief Connection handle statuses. */ typedef enum @@ -299,4 +302,9 @@ sdk_mapped_flags_t ble_conn_state_user_flag_collection(ble_conn_state_user_flag_ /** @} */ /** @} */ + +#ifdef __cplusplus +} +#endif + #endif /* BLE_CONN_STATE_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_date_time.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_date_time.h index 7112223857..13e70d120e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_date_time.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_date_time.h @@ -36,9 +36,8 @@ * */ - -/* Attention! -* To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile +/* Attention! +* To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile * qualification listings, this section of source code must not be modified. */ @@ -59,6 +58,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /**@brief Date and Time structure. */ typedef struct { @@ -74,13 +77,13 @@ static __INLINE uint8_t ble_date_time_encode(const ble_date_time_t * p_date_time uint8_t * p_encoded_data) { uint8_t len = uint16_encode(p_date_time->year, p_encoded_data); - + p_encoded_data[len++] = p_date_time->month; p_encoded_data[len++] = p_date_time->day; p_encoded_data[len++] = p_date_time->hours; p_encoded_data[len++] = p_date_time->minutes; p_encoded_data[len++] = p_date_time->seconds; - + return len; } @@ -88,17 +91,22 @@ static __INLINE uint8_t ble_date_time_decode(ble_date_time_t * p_date_time, const uint8_t * p_encoded_data) { uint8_t len = sizeof(uint16_t); - + p_date_time->year = uint16_decode(p_encoded_data); p_date_time->month = p_encoded_data[len++]; - p_date_time->day = p_encoded_data[len++]; + p_date_time->day = p_encoded_data[len++]; p_date_time->hours = p_encoded_data[len++]; p_date_time->minutes = p_encoded_data[len++]; p_date_time->seconds = p_encoded_data[len++]; - + return len; } + +#ifdef __cplusplus +} +#endif + #endif // BLE_DATE_TIME_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h index 9e9b0deed4..d027c289d6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h @@ -36,7 +36,6 @@ * */ - /**@file * * @defgroup ble_sdk_lib_gatt_db GATT Database Service Structure @@ -48,17 +47,24 @@ #define BLE_GATT_DB_H__ #include -#include "nrf_ble.h" -#include "nrf_ble_gattc.h" +#include "ble.h" +#include "ble_gattc.h" -#define BLE_GATT_DB_MAX_CHARS 5 /**< The maximum number of characteristics present in a service record. */ +#ifdef __cplusplus +extern "C" { +#endif + +#define BLE_GATT_DB_MAX_CHARS 5 /**< The maximum number of characteristics present in a service record. */ /**@brief Structure for holding the characteristic and the handle of its CCCD present on a server. */ typedef struct { - ble_gattc_char_t characteristic; /**< Structure containing information about the characteristic. */ - uint16_t cccd_handle; /**< CCCD Handle value for this characteristic. This will be set to BLE_GATT_HANDLE_INVALID if a CCCD is not present at the server. */ + ble_gattc_char_t characteristic; /**< Structure containing information about the characteristic. */ + uint16_t cccd_handle; /**< CCCD Handle value for this characteristic. This will be set to BLE_GATT_HANDLE_INVALID if a CCCD is not present at the server. */ + uint16_t ext_prop_handle; /**< Extended Properties Handle value for this characteristic. This will be set to BLE_GATT_HANDLE_INVALID if an Extended Properties descriptor is not present at the server. */ + uint16_t user_desc_handle; /**< User Description Handle value for this characteristic. This will be set to BLE_GATT_HANDLE_INVALID if a User Description descriptor is not present at the server. */ + uint16_t report_ref_handle; /**< Report Refence Handle value for this characteristic. This will be set to BLE_GATT_HANDLE_INVALID if a Report Reference descriptor is not present at the server. */ } ble_gatt_db_char_t; /**@brief Structure for holding information about the service and the characteristics present on a @@ -72,6 +78,11 @@ typedef struct ble_gatt_db_char_t charateristics[BLE_GATT_DB_MAX_CHARS]; /**< Array of information related to the characteristics present in the service. This list can extend further than one. */ } ble_gatt_db_srv_t; + +#ifdef __cplusplus +} +#endif + #endif /* BLE_GATT_DB_H__ */ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_sensor_location.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_sensor_location.h index 43311a6077..d5b89f6a69 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_sensor_location.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_sensor_location.h @@ -36,15 +36,18 @@ * */ - /* Attention! * To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile * qualification listings, this section of source code must not be modified. */ - + #ifndef BLE_SENSOR_LOCATION_H__ #define BLE_SENSOR_LOCATION_H__ +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { BLE_SENSOR_LOCATION_OTHER = 0 , /**<-- Other */ BLE_SENSOR_LOCATION_TOP_OF_SHOE = 1 , /**<-- Top of shoe */ @@ -64,4 +67,9 @@ typedef enum { #define BLE_NB_MAX_SENSOR_LOCATIONS 14 + +#ifdef __cplusplus +} +#endif + #endif // BLE_SENSOR_LOCATION_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c index 42cd2d4f2a..de8c343f6a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c @@ -36,9 +36,8 @@ * */ - /* Attention! -* To maintain compliance with Nordic Semiconductor ASA�s Bluetooth profile +* To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile * qualification listings, this section of source code must not be modified. */ @@ -46,7 +45,19 @@ #include #include "nordic_common.h" #include "app_error.h" -#include "nrf_ble.h" +#include "ble.h" + +bool ble_srv_is_notification_enabled(uint8_t const * p_encoded_data) +{ + uint16_t cccd_value = uint16_decode(p_encoded_data); + return ((cccd_value & BLE_GATT_HVX_NOTIFICATION) != 0); +} + +bool ble_srv_is_indication_enabled(uint8_t const * p_encoded_data) +{ + uint16_t cccd_value = uint16_decode(p_encoded_data); + return ((cccd_value & BLE_GATT_HVX_INDICATION) != 0); +} uint8_t ble_srv_report_ref_encode(uint8_t * p_encoded_buffer, const ble_srv_report_ref_t * p_report_ref) @@ -147,7 +158,8 @@ uint32_t characteristic_add(uint16_t service_handle, char_md.p_cccd_md = &cccd_md; } - char_md.char_props = p_char_props->char_props; + char_md.char_props = p_char_props->char_props; + char_md.char_ext_props = p_char_props->char_ext_props; memset(&attr_char_value, 0, sizeof(ble_gatts_attr_t)); attr_char_value.p_uuid = &char_uuid; diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h index 79a7ad0bfc..9836cba680 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup ble_sdk_srv_common Common service definitions @@ -50,11 +49,15 @@ #include #include -#include "nrf_ble_types.h" +#include "ble_types.h" #include "app_util.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" -#include "nrf_ble_gatt.h" +#include "ble.h" +#include "ble_gap.h" +#include "ble_gatt.h" + +#ifdef __cplusplus +extern "C" { +#endif /** @defgroup UUID_SERVICES Service UUID definitions * @{ */ @@ -247,11 +250,8 @@ typedef struct * @retval TRUE If notification is enabled. * @retval FALSE Otherwise. */ -static __INLINE bool ble_srv_is_notification_enabled(uint8_t const * p_encoded_data) -{ - uint16_t cccd_value = uint16_decode(p_encoded_data); - return ((cccd_value & BLE_GATT_HVX_NOTIFICATION) != 0); -} +bool ble_srv_is_notification_enabled(uint8_t const * p_encoded_data); + /**@brief Function for decoding a CCCD value, and then testing if indication is * enabled. @@ -261,11 +261,8 @@ static __INLINE bool ble_srv_is_notification_enabled(uint8_t const * p_encoded_d * @retval TRUE If indication is enabled. * @retval FALSE Otherwise. */ -static __INLINE bool ble_srv_is_indication_enabled(uint8_t const * p_encoded_data) -{ - uint16_t cccd_value = uint16_decode(p_encoded_data); - return ((cccd_value & BLE_GATT_HVX_INDICATION) != 0); -} +bool ble_srv_is_indication_enabled(uint8_t const * p_encoded_data); + /**@brief Function for encoding a Report Reference Descriptor. * @@ -329,6 +326,7 @@ typedef struct uint8_t * p_init_value; /**< Initial encoded value of the characteristic.*/ bool is_var_len; /**< Indicates if the characteristic value has variable length.*/ ble_gatt_char_props_t char_props; /**< Characteristic properties.*/ + ble_gatt_char_ext_props_t char_ext_props; /**< Characteristic extended properties.*/ bool is_defered_read; /**< Indicate if deferred read operations are supported.*/ bool is_defered_write; /**< Indicate if deferred write operations are supported.*/ security_req_t read_access; /**< Security requirement for reading the characteristic value.*/ @@ -389,6 +387,11 @@ uint32_t descriptor_add(uint16_t char_handle, uint16_t * p_descr_handle); + +#ifdef __cplusplus +} +#endif + #endif // BLE_SRV_COMMON_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/config/device_manager_cnfg.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/config/device_manager_cnfg.h deleted file mode 100644 index 394a118874..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/config/device_manager_cnfg.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - - /** - * @file device_manager_cnfg.h - * - * @cond - * @defgroup device_manager_cnfg Device Manager Configuration - * @ingroup device_manager - * @{ - * - * @brief Defines application specific configuration for Device Manager. - * - * @details All configurations that are specific to application have been defined - * here. Application should configuration that best suits its requirements. - */ - -#ifndef DEVICE_MANAGER_CNFG_H__ -#define DEVICE_MANAGER_CNFG_H__ - -/** - * @defgroup device_manager_inst Device Manager Instances - * @{ - */ -/** - * @brief Maximum applications that Device Manager can support. - * - * @details Maximum application that the Device Manager can support. - * Currently only one application can be supported. - * Minimum value : 1 - * Maximum value : 1 - * Dependencies : None. - */ -#define DEVICE_MANAGER_MAX_APPLICATIONS 1 - -/** - * @brief Maximum connections that Device Manager should simultaneously manage. - * - * @details Maximum connections that Device Manager should simultaneously manage. - * Minimum value : 1 - * Maximum value : Maximum links supported by SoftDevice. - * Dependencies : None. - */ -#define DEVICE_MANAGER_MAX_CONNECTIONS 1 - - -/** - * @brief Maximum bonds that Device Manager should manage. - * - * @details Maximum bonds that Device Manager should manage. - * Minimum value : 1 - * Maximum value : 254. - * Dependencies : None. - * @note In case of GAP Peripheral role, the Device Manager will accept bonding procedure - * requests from peers even if this limit is reached, but bonding information will not - * be stored. In such cases, application will be notified with DM_DEVICE_CONTEXT_FULL - * as event result at the completion of the security procedure. - */ -#define DEVICE_MANAGER_MAX_BONDS 7 - - -/** - * @brief Maximum Characteristic Client Descriptors used for GATT Server. - * - * @details Maximum Characteristic Client Descriptors used for GATT Server. - * Minimum value : 1 - * Maximum value : 254. - * Dependencies : None. - */ -#define DM_GATT_CCCD_COUNT 2 - - -/** - * @brief Size of application context. - * - * @details Size of application context that Device Manager should manage for each bonded device. - * Size had to be a multiple of word size. - * Minimum value : 4. - * Maximum value : 256. - * Dependencies : Needed only if Application Context saving is used by the application. - * @note If set to zero, its an indication that application context is not required to be managed - * by the module. - */ -#define DEVICE_MANAGER_APP_CONTEXT_SIZE 0 - -/* @} */ -/* @} */ -/** @endcond */ -#endif // DEVICE_MANAGER_CNFG_H__ - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager.h deleted file mode 100644 index 0b085abc64..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager.h +++ /dev/null @@ -1,915 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/** - * @file device_manager.h - * - * @defgroup device_manager Device Manager - * @ingroup ble_sdk_lib - * @{ - * @brief Device Manager Application Interface Abstraction. - * - * @details The Device Manager module manages Active and Bonded Peers. Management of peer includes - * book keeping of contextual information like the Security Keys, GATT - * configuration and any application specific information. - * - * Active Peers are devices which are connected, and may or may not be bonded. - * Bonded Peers are devices which are bonded, and may or may not be Active (Connected). - * Active Bonded Peer refers to a device which is connected and bonded. - * - * Paired Devices refers to peer devices that are connected and have necessary context - * establishment/exchange for the current connection session. On disconnect, - * all contextual information is flushed. For example, SMP Information Exchanged during - * pairing and GATT Configuration is not retained on disconnection. - * - * Note that this module allows management of contextual information but - * does not provide an interface for connection management. Therefore, entering connectible - * mode, connection establishment, or disconnection of a link with peer is not in scope - * of this module. - * - * For bonded peers, the contextual information is required to be retained on disconnection - * and power cycling. Persistent storage of contextual information is handled by the - * module. This module categorizes the contextual information into 3 categories: - * - Bonding Information - * Bond information is the information exchanged between local and peer device to - * establish a bond. It also includes peer identification information, - * like the peer address or the IRK or both. From here on this category of information - * is referred to as Device Context. - * - Service/Protocol Information - * Service/Protocol information is the information retained for the peer to save on one-time - * procedures like the GATT Service Discovery procedures and Service Configurations. - * It allows devices to resume data exchange on subsequent reconnection without having - * to perform initial set-up procedures each time. From here on this category is - * referred to as Service Context. - * - Application Information - * Application information is the context that the application would like to associate with - * each of the bonded device. For example, if the application chooses to rank its peers - * in order to manage them better, the rank information could be treated as - * Application Information. This storage space is provided to save the application from - * maintaining a mapping table with each Device Instance and Application Information. - * However, if the application have no use for this, it is possible to not - * use or employ this at compile time. From here on this category of information is - * referred to as Application Context. - */ - - -#ifndef DEVICE_MANAGER_H__ -#define DEVICE_MANAGER_H__ - -#include -#include -#include "sdk_common.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" -#include "device_manager_cnfg.h" - -/** - * @defgroup dm_service_cntext_types Service/Protocol Types - * - * @brief Describes the possible types of Service/Protocol Contexts for a bonded/peer device. - * - * @details Possible Service/Protocol context per peer device. The Device Manager provides the - * functionality of persistently storing the Service/Protocol context and can automatically - * load them when needed. - * For example system attributes for a GATT Server. Based on the nature of the application, - * not all service types may be needed. The application can specify - * only the service/protocol context it wants to use at the time of registration. - * @{ - */ -#define DM_PROTOCOL_CNTXT_NONE 0x00 /**< No Service Context, this implies the application does not want to associate any service/protocol context with the peer device */ -#define DM_PROTOCOL_CNTXT_GATT_SRVR_ID 0x01 /**< GATT Server Service Context, this implies the application does associate GATT Server with the peer device and this information will be loaded when needed for a bonded device */ -#define DM_PROTOCOL_CNTXT_GATT_CLI_ID 0x02 /**< GATT Client Service Context, this implies the application does associate GATT Client with the peer device and this information will be loaded when needed for a bonded device */ -#define DM_PROTOCOL_CNTXT_ALL \ - (DM_PROTOCOL_CNTXT_GATT_SRVR_ID | DM_PROTOCOL_CNTXT_GATT_CLI_ID) /**< All Service/Protocol Context, this implies that the application wants to associate all Service/Protocol Information with the bonded device. This is configurable based on system requirements. If the application has only one type of service, this define could be altered to reflect the same. */ -/** @} */ - - -/** - * @defgroup dm_events Device Manager Events - * - * @brief This section describes the device manager events that are notified to the application. - * - * @details The Device Manager notifies the application of various asynchronous events using the - * asynchronous event notification callback. All events has been categorized into: - * a. General. - * b. Link Status. - * c. Context Management. - * - * In the callback, these events are notified along with handle that uniquely identifies: - * application instance, active instance (if applicable), device instance - * bonding instance, (if applicable) and service instance. - * Not all events are pertaining to an active connection, for example a context deletion event could occur even if the peer - * is not connected. Also, general category of events may not be pertaining to any specific peer. - * See also \ref dm_event_cb_t and \ref dm_register. - * @{ - */ -/** - * @defgroup general_events General Events - * - * @brief General or miscellaneous events. - * - * @details This category of events are general events not pertaining to a peer or context. - * - * @{ - */ -#define DM_EVT_RFU 0x00 /**< Reserved for future use, is never notified. */ -#define DM_EVT_ERROR 0x01 /**< Device Manager Event Error. */ -/** @} */ - -/** - * @defgroup link_status_events Link Status Events - * - * @brief Link Status Events. - * - * @details This category of events notify the application of the link status. Event result associated - * with the event is provided along with the event in the callback to provide more details of - * whether a procedure succeeded or failed and assist the application in decision making of - * how to proceed. For example if a DM_DEVICE_CONNECT_IND is indicated with NRF_SUCCESS - * result, the application may want to proceed with discovering and association with - * service of the peer. However, if indicated with a failure result, the application may - * want to take an alternate action such as reattempting to connect or go into a - * sleep mode. - * - * @{ - */ -#define DM_EVT_CONNECTION 0x11 /**< Indicates that link with the peer is established. */ -#define DM_EVT_DISCONNECTION 0x12 /**< Indicates that link with peer is torn down. */ -#define DM_EVT_SECURITY_SETUP 0x13 /**< Security procedure for link started indication */ -#define DM_EVT_SECURITY_SETUP_COMPLETE 0x14 /**< Security procedure for link completion indication. */ -#define DM_EVT_LINK_SECURED 0x15 /**< Indicates that link with the peer is secured. For bonded devices, subsequent reconnections with bonded peer will result only in this event when the link is secured and setup procedures will not occur unless the bonding information is either lost or deleted on either or both sides. */ -#define DM_EVT_SECURITY_SETUP_REFRESH 0x16 /**< Indicates that the security on the link was re-established. */ -/** @} */ - -/** - * @defgroup context_mgmt_events Context Management Events - * - * @brief Context Management Events. - * - * @details These events notify the application of the status of context loading and storing. - * - * @{ - */ -#define DM_EVT_DEVICE_CONTEXT_LOADED 0x21 /**< Indicates that device context for a peer is loaded. */ -#define DM_EVT_DEVICE_CONTEXT_STORED 0x22 /**< Indicates that device context is stored persistently. */ -#define DM_EVT_DEVICE_CONTEXT_DELETED 0x23 /**< Indicates that device context is deleted. */ -#define DM_EVT_SERVICE_CONTEXT_LOADED 0x31 /**< Indicates that service context for a peer is loaded. */ -#define DM_EVT_SERVICE_CONTEXT_STORED 0x32 /**< Indicates that service context is stored persistently. */ -#define DM_EVT_SERVICE_CONTEXT_DELETED 0x33 /**< Indicates that service context is deleted. */ -#define DM_EVT_APPL_CONTEXT_LOADED 0x41 /**< Indicates that application context for a peer is loaded. */ -#define DM_EVT_APPL_CONTEXT_STORED 0x42 /**< Indicates that application context is stored persistently. */ -#define DM_EVT_APPL_CONTEXT_DELETED 0x43 /**< Indicates that application context is deleted. */ -/** @} */ -/** @} */ - -#define DM_INVALID_ID 0xFF /**< Invalid instance idenitifer. */ - -/** - * @defgroup dm_data_structure Device Manager Data Types - * - * @brief This section describes all the data types exposed by the module to the application. - * @{ - */ - -/** - * @brief Application Instance. - * - * @details Application instance uniquely identifies an application. The identifier is allocated by - * the device manager when application registers with the module. The application is - * expected to identify itself with this instance identifier when initiating subsequent - * requests. Application should use the utility API \ref dm_application_instance_set in - * order to set its application instance in dm_handle_t needed for all subsequent APIs. - * See also \ref dm_register. - */ -typedef uint8_t dm_application_instance_t; - -/** - * @brief Connection Instance. - * - * @details Identifies connection instance for an active device. This instance is allocated by the - * device manager when a connection is established and is notified with DM_EVT_CONNECTION - * with the event result NRF_SUCCESS. - */ -typedef uint8_t dm_connection_instance_t; - -/** - * @brief Device Instance. - * - * @details Uniquely identifies a bonded peer device. The peer device may or may not be connected. - * In case of the central: The bonded device instance to identify the peer is allocated when bonding procedure is initiated by the central using dm_security_setup_req. - * In case of the peripheral: When the bonding procedure is successful, the DM_EVT_SECURITY_SETUP_COMPLETE event with success event result, is received. - * In case the module cannot add more bonded devices, no instance is allocated, this is indicated by an appropriate error code for the API/event as the case may be. Application can choose to disconnect the link. - */ -typedef uint8_t dm_device_instance_t; - -/** - * @brief Service Instance. - * - * @details Uniquely identifies a peer device. The peer device may or may not be connected. This - * instance is allocated by the device manager when a device is bonded and is notified - * when security procedures have been initiated. - * Security Procedures initiation is notified with DM_SECURITY_SETUP_IND with - * success event result. In case the event result indicates that the module cannot add more - * bonded devices, no instance is allocated. Application can chose to disconnect the link. - */ -typedef uint8_t dm_service_instance_t; - -/** - * @brief Service/Protocol Type Identifier. - * - * @details Uniquely identifies a service or a protocol type. Service/Protocol Type identification - * is needed as each service/protocol can have its own contextual data. - * This allows the peer to access more than one service at a time. \ref dm_service_cntext_types describes the - * list of services/protocols supported. - */ -typedef uint8_t service_type_t; - -/**@brief Device Manager Master identification and encryption information. */ -typedef struct dm_enc_key -{ - ble_gap_enc_info_t enc_info; /**< GAP encryption information. */ - ble_gap_master_id_t master_id; /**< Master identification. */ -} dm_enc_key_t; - -/** @brief Device Manager identity and address information. */ -typedef struct dm_id_key -{ - ble_gap_irk_t id_info; /**< Identity information. */ - ble_gap_addr_t id_addr_info; /**< Identity address information. */ -} dm_id_key_t; - -/** @brief Device Manager signing information. */ -typedef struct dm_sign_key -{ - ble_gap_sign_info_t sign_key; /**< GAP signing information. */ -} dm_sign_key_t; - -/** @brief Security keys. */ -typedef struct dm_sec_keyset -{ - union - { - dm_enc_key_t * p_enc_key; /**< Pointer to Device Manager encryption information structure. */ - } enc_key; - dm_id_key_t * p_id_key; /**< Identity key, or NULL. */ - dm_sign_key_t * p_sign_key; /**< Signing key, or NULL. */ -} dm_sec_keys_t; - -/** @brief Device Manager security key set. */ -typedef struct -{ - dm_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */ - dm_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */ -} dm_sec_keyset_t; - -/** - * @brief Device Handle used for unique identification of each peer. - * - * @details This data type is used to uniquely identify each peer device. A peer device could be - * active and/or bonded. Therefore an instance for active and bonded is provided. - * However, the application is expected to treat this is an opaque structure and use this for - * all API interactions once stored on appropriate events. - * See \ref dm_events. - */ -typedef struct device_handle -{ - dm_application_instance_t appl_id; /**< Identifies the application instances for the device that is being managed. */ - dm_connection_instance_t connection_id; /**< Identifies the active connection instance. */ - dm_device_instance_t device_id; /**< Identifies peer instance in the data base. */ - dm_service_instance_t service_id; /**< Service instance identifier. */ -} dm_handle_t; - -/** - * @brief Definition of Data Context. - * - * @details Defines contextual data format, it consists of context data length and pointer to data. - */ -typedef struct -{ - uint32_t flags; /**< Additional flags identifying data. */ - uint32_t len; /**< Length of data. */ - uint8_t * p_data; /**< Pointer to contextual data, a copy is made of the data. */ -} dm_context_t; - - -/** - * @brief Device Context. - * - * @details Defines "device context" type for a device managed by device manager. - */ -typedef dm_context_t dm_device_context_t; - -/** - * @brief Service Context. - * - * @details Service context data for a service identified by the 'service_type' field. - */ -typedef struct -{ - service_type_t service_type; /**< Identifies the service/protocol to which the context data is related. */ - dm_context_t context_data; /**< Contains length and pointer to context data */ -} dm_service_context_t; - -/** - * @brief Application context. - * - * @details The application context can be used by the application to map any application level - * information that is to be mapped with a particular peer. - * For bonded peers, this information will be stored by the bond manager persistently. - * Note that the device manager treats this information as an - * opaque block of bytes. - * Necessary APIs to get and set this context for a peer have been provided. - */ -typedef dm_context_t dm_application_context_t; - -/** - * @brief Event parameters. - * - * @details Defines event parameters for each of the events notified by the module. - */ -typedef union -{ - ble_gap_evt_t * p_gap_param; /**< All events that are triggered in device manager as a result of GAP events, like connection, disconnection and security procedures are accompanied with GAP parameters. */ - dm_application_context_t * p_app_context; /**< All events that are associated with application context procedures of store, load, and deletion have this as event parameter. */ - dm_service_context_t * p_service_context; /**< All events that are associated with service context procedures of store, load and deletion have this as event parameter. */ - dm_device_context_t * p_device_context; /**< All events that are associated with device context procedures of store, load and deletion have this as event parameter. */ -} dm_event_param_t; - -/** - * @brief Asynchronous events details notified to the application by the module. - * - * @details Defines event type along with event parameters notified to the application by the - * module. - */ -typedef struct -{ - uint8_t event_id; /**< Identifies the event. See \ref dm_events for details on event types and their significance. */ - dm_event_param_t event_param; /**< Event parameters. Can be NULL if the event does not have any parameters. */ - uint16_t event_paramlen; /**< Length of the event parameters, is zero if the event does not have any parameters. */ -} dm_event_t; - -/** - * @brief Event notification callback registered by application with the module. - * - * @details Event notification callback registered by application with the module when registering - * the module using \ref dm_register API. - * - * @param[in] p_handle Identifies the peer for which the event is being notified. - * @param[in] p_event Identifies the event, any associated parameters and parameter length. - * See \ref dm_events for details on event types and their significance. - * @param[in,out] event_result Provide additional information on the event. - * In addition to SDK error codes there is also a return value - * indicating if maximum number of connections has been reached when connecting or bonding. - * - * @retval NRF_SUCCESS on success, or a failure to indicate if it could handle the event - * successfully. There is no action taken in case application returns a failure. - */ -typedef ret_code_t (*dm_event_cb_t)(dm_handle_t const * p_handle, - dm_event_t const * p_event, - ret_code_t event_result); - -/** - * @brief Initialization Parameters. - * - * @details Indicates the application parameters. Currently this only encompasses clearing - * all persistent data. - */ -typedef struct -{ - bool clear_persistent_data; /**< Set to true in case the module should clear all persistent data. */ -} dm_init_param_t; - -/** - * @brief Application Registration Parameters. - * - * @details Parameters needed by the module when registering with it. - */ -typedef struct -{ - dm_event_cb_t evt_handler; /**< Event Handler to be registered. It will receive asynchronous notification from the module, see \ref dm_events for asynchronous events. */ - uint8_t service_type; /**< Bit mask identifying services that the application intends to support for all peers. */ - ble_gap_sec_params_t sec_param; /**< Security parameters to be used for the application. */ -} dm_application_param_t; - -/** - * @brief Defines possible security status/states. - * - * @details Defines possible security status/states of a link when requested by application using - * the \ref dm_security_status_req. - */ -typedef enum -{ - NOT_ENCRYPTED, /**< The link is not secured. */ - ENCRYPTION_IN_PROGRESS, /**< Link security is being established.*/ - ENCRYPTED /**< The link is secure.*/ -} dm_security_status_t; -/** @} */ - -/** - * @defgroup dm_api Device Module APIs - * - * @brief This section describes APIs exposed by the module. - * - * @details This section describes APIs exposed by the module. The APIs have been categorized to provide - * better and specific look up for developers. Categories are: - * - Set up APIs. - * - Context Management APIs. - * - Utility APIs. - * - * MSCs describe usage of these APIs. - * See @ref dm_msc. - * @{ - */ -/** - * @defgroup dm_setup_api Device Module Set-up APIs - * - * @brief Initialization & registration APIs that are pre-requisite for all other module procedures. - * @details This section describes the Module Initialization and Registration APIs needed to be set up by - * the application before device manager can start managing devices and device contexts - * for the application. - * - * @{ - */ - -/** - * @brief Module Initialization Routine. - * - * @details Function for initializing the module. Must called before any other APIs of the module are used. - * - * @param[in] p_init_param Initialization parameters. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * - * @note It is mandatory that pstorage is initialized before initializing this module. - */ -ret_code_t dm_init(dm_init_param_t const * p_init_param); - -/** - * @brief Function for registering the application. - * - * @details This routine is used by the application to register for asynchronous events with the - * device manager. During registration the application also indicates the services that it - * intends to support on this instance. It is possible to register multiple times with the - * device manager. At least one instance shall be registered with the device manager after - * the module has been initialized. - * Maximum number of application instances device manager can support is determined - * by DM_MAX_APPLICATIONS. - * - * All applications must be registered before initiating or accepting connections from the peer. - * - * @param[in] p_appl_param Application parameters. - * @param[out] p_appl_instance Application Instance Identifier in case registration is successful. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization. - * @retval NRF_ERROR_NO_MEM If module cannot support more applications. - * - * @note Currently only one application instance is supported by the module. - */ -ret_code_t dm_register(dm_application_instance_t * p_appl_instance, - dm_application_param_t const * p_appl_param); - -/** - * @brief Function for handling BLE events. - * - * @details BLE Event Handler for the module. This routine should be called from BLE stack event - * dispatcher for the module to work as expected. - * - * @param[in] p_ble_evt BLE stack event being dispatched to the function. - * - */ -void dm_ble_evt_handler(ble_evt_t * p_ble_evt); - -/** @} */ - - -/** - * @defgroup dm_security_api APIs to set up or read status of security on a link. - * - * @brief This section describes APIs to set up Security. These APIs require that the peer is - * connected before the procedures can be requested. - * - * @details This group allows application to request security procedures - * or get the status of the security on a link. - * @{ - */ -/** - * @brief Function for requesting setting up security on a link. - * - * @details This API initiates security procedures with a peer device. - * @note For the GAP Central role, in case peer is not bonded, request to bond/pair is - * initiated. If it is bonded, the link is re-encrypted using the existing bond information. - * For the GAP peripheral role, a Slave security request is sent. - * @details If a pairing procedure is initiated successfully, application is notified of - * @ref DM_EVT_SECURITY_SETUP_COMPLETE. A result indicating success or failure is notified along with the event. - * In case the link is re-encrypted using existing bond information, @ref DM_EVT_LINK_SECURED is - * notified to the application. - * - * @param[in] p_handle Identifies the link on which security is desired. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle is NULL. - * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application - * or if the peer is not connected when this procedure is requested. - */ -ret_code_t dm_security_setup_req(dm_handle_t * p_handle); - -/** - * @brief Function for reading the status of the security on a link. - * - * @details This API allows application to query status of security on a link. - * - * @param[in] p_handle Identifies the link on which security is desired. - * @param[out] p_status Pointer where security status is provided to the application. - * See \ref dm_security_status_t for possible statuses that can be expected. - * - * @retval NRF_SUCCESS Or appropriate error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle or p_status is NULL. - * @retval NRF_ERROR_INVALID_ADDR If peer is not identified by the handle provided by the application - * or if peer is not connected when this procedure is requested. - */ -ret_code_t dm_security_status_req(dm_handle_t const * p_handle, dm_security_status_t * p_status); - -/** - * @brief Function for creating the whitelist. - * - * @details This API allows application to create whitelist based on bonded peer devices in module - * data base. - * - * @param[in] p_handle Identifies the application requesting whitelist creation. - * @param[in,out] p_whitelist Pointer where created whitelist is provided to the application. - * - * @note 'addr_count' and 'irk_count' fields of the structure should be populated with the maximum - * number of devices that the application wishes to request in the whitelist. - * If the number of bonded devices is less than requested, the fields are updated with that number of devices. - * If the number of devices are more than requested, the module will populate the list - * with devices in the order the bond was established with the peer devices. Also, if this routine is - * called when a connection exists with one or more peer devices, - * those connected devices are not added to the whitelist. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle or p_whitelist is NULL. - */ -ret_code_t dm_whitelist_create(dm_application_instance_t const * p_handle, - ble_gap_whitelist_t * p_whitelist); - -/** @} */ - - -/** - * @defgroup dm_cntxt_mgmt_api Context Management APIs - * - * @brief Utility APIs offered by the device manager to get information about the peer if and - * when needed. - * - * @details This group of API allow the application to access information that is not required to be - * maintained by the application but may be needed. Hence it is possible to get the - * information from the module instead of mapping all the information with a device - * context. - * @{ - */ - -ret_code_t dm_device_add(dm_handle_t * p_handle, - dm_device_context_t const * p_context); - -/** - * @brief Function for deleting a peer device context and all related information from the database. - * - * @details Delete peer device context and all related information from database. If - * this API returns NRF_SUCCESS, DM_EVT_DEVICE_CONTEXT_DELETED event is notified to the - * application. Event result notified along with the event indicates success or failure - * of this procedure. - * - * @param[in] p_handle Identifies the peer device to be deleted. - * - * @retval NRF_SUCCESS on success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE In the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle is NULL. - * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application. - * - * @note Deleting device context results in deleting service and application context for the - * bonded device. The respective events DM_EVT_SERVICE_CONTEXT_DELETED and - * DM_EVT_APPL_CONTEXT_DELETED are not notified to the application. - */ -ret_code_t dm_device_delete(dm_handle_t const * p_handle); - -/** - * @brief Function for deleting all peer device context and all related information from the database. - * - * @details Delete peer device context and all related information from database. If - * this API returns NRF_SUCCESS, DM_EVT_DEVICE_CONTEXT_DELETED event is notified to the - * application for each device that is deleted from the data base. Event result - * notified along with the event indicates success or failure of this procedure. - * - * @param[in] p_handle Identifies application instance that is requesting - * the deletion of all bonded devices. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle is NULL. - * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application. - * - * @note Deleting device context results in deleting both service and application context for the - * bonded device. The respective events DM_EVT_SERVICE_CONTEXT_DELETED and - * DM_EVT_APPL_CONTEXT_DELETED are not notified to the application. - */ -ret_code_t dm_device_delete_all(dm_application_instance_t const * p_handle); - -/** - * @brief Function for setting Service Context for a peer device identified by 'p_handle' parameter. - * - * @details This API allows application to Set Service Context for a peer device identified by the - * 'p_handle' parameter. This API is useful when the Service Context cannot be requested - * from the SoftDevice, but needs to be assembled by the application or an another module. - * (or when service context is exchanged in an out of band way.) - * This API could also be used to trigger a storing of service context into persistent - * memory. If this is desired, a NULL pointer could be passed to the p_context. - * - * @param[in] p_handle Identifies peer device for which the procedure is requested. - * @param[in] p_context Service context being set. The context information includes length of - * data and pointer to the contextual data being set. The memory pointed to by - * the pointer to data is assumed to be resident when API is being called and - * can be freed or reused once the set procedure is complete. Set procedure - * completion is indicated by the event \ref DM_EVT_SERVICE_CONTEXT_STORED. - * The Event result is notified along with the event and indicates success or failure of - * this procedure. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle is NULL. - * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. - */ -ret_code_t dm_service_context_set(dm_handle_t const * p_handle, - dm_service_context_t const * p_context); - -/** - * @brief Function for getting Service Context for a peer device identified by 'p_handle' parameter. - * - * @details Get Service Context for a peer device identified by the 'p_handle' parameter. If - * this API returns NRF_SUCCESS, DM_EVT_SERVICE_CONTEXT_LOADED event is notified to the - * application. The event result is notified along with the event indicates success or failure - * of this procedure. - * - * @param[in] p_handle Identifies peer device for which procedure is requested. - * @param[in] p_context Application context being requested. The context information includes length - * of the data and a pointer to the data. Note that requesting a 'get' - * of application does not need to provide memory, the pointer to data will be - * pointing to service data and hence no data movement is involved. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE In case API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle is NULL. - * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. - */ -ret_code_t dm_service_context_get(dm_handle_t const * p_handle, - dm_service_context_t * p_context); - -/** - * @brief Function for deleting a Service Context for a peer device identified by the 'p_handle' parameter. - * - * @details This API allows application to delete a Service Context identified for a peer device - * identified by the 'p_handle' parameter. If this API returns NRF_SUCCESS, - * DM_EVT_SERVICE_CONTEXT_DELETED event is notified to the application. - * Event result is notified along with the event and indicates success or failure of this - * procedure. - * - * @param[in] p_handle Identifies peer device for which procedure is requested. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle is NULL. - * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. - */ -ret_code_t dm_service_context_delete(dm_handle_t const * p_handle); - -/** - * @brief Function for setting Application Context for a peer device identified by the 'p_handle' parameter. - * - * @details This application allows the setting of the application context for the peer device identified by - * the 'p_handle'. Application context is stored persistently by the module and can be - * requested by the application at any time using the \ref dm_application_context_get - * API. Note that this procedure is permitted only for bonded devices. If the - * device is not bonded, application context cannot be set. However, it is not mandatory - * that the bonded device is connected when requesting this procedure. - * - * @param[in] p_handle Identifies peer device for which procedure is requested. - * - * @param[in] p_context Application context being set. The context information includes length of the - * data and pointer to the contextual data being set. The memory pointed to by - * the data pointer is assumed to be resident when API is being called and - * can be freed or reused once the set procedure is complete. Set procedure - * completion is notified by the event \ref DM_EVT_APPL_CONTEXT_STORED. - * The event result is notified along with the event and indicates success or - * failure of this procedure. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle and/or p_context is NULL. - * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application. - * - * @note The API returns FEATURE_NOT_ENABLED in case DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero. - */ -ret_code_t dm_application_context_set(dm_handle_t const * p_handle, - dm_application_context_t const * p_context); - -/** - * @brief Function for getting Application Context for a peer device identified by the 'p_handle' parameter. - * - * @details Get Application Context for a peer device identified by the 'p_handle' parameter. If - * this API returns NRF_SUCCESS, DM_EVT_APPL_CONTEXT_LOADED event is notified to the - * application. Event result notified along with the event indicates success or failure - * of this procedure. - * - * @param[in] p_handle Identifies peer device for which procedure is requested. - * @param[in] p_context Application context being requested. The context information includes - * length of data and pointer to the contextual data is provided. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle and/or p_context is NULL. - * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. - * @retval DM_NO_APP_CONTEXT If no application context was set that can be fetched. - * - * @note The API returns FEATURE_NOT_ENABLED in case DEVICE_MANAGER_APP_CONTEXT_SIZE is set to - * zero. - */ -ret_code_t dm_application_context_get(dm_handle_t const * p_handle, - dm_application_context_t * p_context); - -/** - * @brief Function for deleting Application Context for a peer device identified by the 'p_handle' parameter. - * - * @details Delete Application Context for a peer device identified by the 'p_handle' parameter. If - * this API returns NRF_SUCCESS, DM_EVT_APPL_CONTEXT_DELETED event is notified to the - * application. The event result notified along with the event and indicates success or failure - * of this procedure. - * - * @param[in] p_handle Identifies peer device for which procedure is requested. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If the p_handle is NULL. - * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application. - * @retval DM_NO_APP_CONTEXT If no application context was set that can be deleted. - * - * @note The API returns FEATURE_NOT_ENABLED if the DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero. - */ -ret_code_t dm_application_context_delete(dm_handle_t const * p_handle); - -/** @} */ - - -/** - * @defgroup utility_api Utility APIs - * @{ - * @brief This section describes the utility APIs offered by the module. - * - * @details APIs defined in this section are utility or assisting/helper APIs. - */ -/** - * @brief Function for Setting/Copying Application instance to Device Manager handle. - * - * @param[in] p_appl_instance Application instance to be set. - * @param[out] p_handle Device Manager handle for which the instance is to be copied. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL. - */ -ret_code_t dm_application_instance_set(dm_application_instance_t const * p_appl_instance, - dm_handle_t * p_handle); - -/** - * @brief Function for getting a peer's device address. - * - * @param[in] p_handle Identifies the peer device whose address is requested. Can not be NULL. - * @param[out] p_addr Pointer where address is to be copied. Can not be NULL. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL. - * @retval NRF_ERROR_NOT_FOUND If the peer could not be identified. - */ -ret_code_t dm_peer_addr_get(dm_handle_t const * p_handle, - ble_gap_addr_t * p_addr); - -/** - * @brief Function for setting/updating a peer's device address. - * - * @param[in] p_handle Identifies the peer device whose address is requested to be set/updated. - * @param[out] p_addr Address to be set/updated. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL. - * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. - * @retval NRF_ERROR_INVALID_PARAM If this procedure is requested while connected to the peer or if the address - * type was set to BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE. - * - * @note Setting or updating a peer's device address is permitted - * only for a peer that is bonded and disconnected. - * @note Updated address is reflected only after DM_EVT_DEVICE_CONTEXT_STORED is notified to the - * application for this bonded device instance. In order to avoid abnormal behaviour, it is - * recommended to not invite/initiate connections on the updated address unless this event - * has been notified. - */ -ret_code_t dm_peer_addr_set(dm_handle_t const * p_handle, - ble_gap_addr_t const * p_addr); - -/** - * @brief Function for initializing Device Manager handle. - * - * @param[in] p_handle Device Manager handle to be initialized. - * - * @retval NRF_SUCCESS On success. - * @retval NRF_ERROR_NULL If p_handle is NULL. - * - * @note This routine is permitted before initialization of the module. - */ -ret_code_t dm_handle_initialize(dm_handle_t * p_handle); - -/** - * @brief Function for getting distributed keys for a device. - * - * @param[in] p_handle Device Manager handle identifying the peer. - * @param[out] p_key_dist Pointer to distributed keys. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or - * application registration. - * @retval NRF_ERROR_NULL If the p_handle and/or p_key_dist pointer is NULL. - * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application. - */ -ret_code_t dm_distributed_keys_get(dm_handle_t const * p_handle, - dm_sec_keyset_t * p_key_dist); - -/** - * @brief Function for getting the corresponding dm_handle_t based on the connection handle. - * - * @param[in] conn_handle Connection handle as provided by the SoftDevice. - * @param[in,out] p_handle Pointer to the p_handle containg the application instance for the - * registered application. If the application instance is valid then - * the p_handle will be filled with requested data. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - * @retval NRF_ERROR_NULL If the p_handle pointer is NULL. - * @retval NRF_ERROR_NOT_FOUND If no p_handle is found for the provided connection handle. - */ -ret_code_t dm_handle_get(uint16_t conn_handle, dm_handle_t * p_handle); - -/** @} */ -/** @} */ -/** @} */ -#endif // DEVICE_MANAGER_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager_peripheral.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager_peripheral.c deleted file mode 100644 index 0302e2ff9e..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/device_manager/device_manager_peripheral.c +++ /dev/null @@ -1,2971 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#include "device_manager.h" -#include "app_trace.h" -#include "pstorage.h" -#include "nrf_ble_hci.h" -#include "app_error.h" - -#if defined ( __CC_ARM ) - #ifndef __ALIGN - #define __ALIGN(x) __align(x) /**< Forced aligment keyword for ARM Compiler */ - #endif -#elif defined ( __ICCARM__ ) - #ifndef __ALIGN - #define __ALIGN(x) /**< Forced aligment keyword for IAR Compiler */ - #endif -#elif defined ( __GNUC__ ) - #ifndef __ALIGN - #define __ALIGN(x) __attribute__((aligned(x))) /**< Forced aligment keyword for GNU Compiler */ - #endif -#endif - -#define INVALID_ADDR_TYPE 0xFF /**< Identifier for an invalid address type. */ -#define EDIV_INIT_VAL 0xFFFF /**< Initial value for diversifier. */ - -/** - * @defgroup device_manager_app_states Connection Manager Application States - * @{ - */ -#define STATE_CONTROL_PROCEDURE_IN_PROGRESS 0x01 /**< State where a security procedure is ongoing. */ -#define STATE_QUEUED_CONTROL_REQUEST 0x02 /**< State where it is known if there is any queued security request or not. */ -/** @} */ - -/** - * @defgroup device_manager_conn_inst_states Connection Manager Connection Instances States. - * @{ - */ -#define STATE_IDLE 0x01 /**< State where connection instance is free. */ -#define STATE_CONNECTED 0x02 /**< State where connection is successfully established. */ -#define STATE_PAIRING 0x04 /**< State where pairing procedure is in progress. This state is used for pairing and bonding, as pairing is needed for both. */ -#define STATE_BONDED 0x08 /**< State where device is bonded. */ -#define STATE_DISCONNECTING 0x10 /**< State where disconnection is in progress, application will be notified first, but no further active procedures on the link. */ -#define STATE_PAIRING_PENDING 0x20 /**< State where pairing request is pending on the link. */ -#define STATE_BOND_INFO_UPDATE 0x40 /**< State where information has been updated, update the flash. */ -#define STATE_LINK_ENCRYPTED 0x80 /**< State where link is encrypted. */ -/** @} */ - -/** - * @defgroup device_manager_peer_id_defines Peer Identification Information Defines. - * - * @brief These defines are used to know which of the peer identification is applicable for a peer. - * - * @details These defines are used for peer identification. Here, bit map is used because it is - * possible that the application has both IRK and address for identification. - * @{ - */ -#define UNASSIGNED 0xFF /**< Peer instance is unassigned/unused. */ -#define IRK_ENTRY 0x01 /**< Peer instance has IRK as identification information. */ -#define ADDR_ENTRY 0x02 /**< Peer instance has address as identification information. */ -#define SERVICE_CONTEXT_ENTRY 0x04 /**< Peer instance has service context set. */ -#define APP_CONTEXT_ENTRY 0x08 /**< Peer instance has an application context set. */ -/** @} */ - -/**@brief Device store state identifiers. */ -typedef enum -{ - STORE_ALL_CONTEXT, /**< Store all context. */ - FIRST_BOND_STORE, /**< Store bond. */ - UPDATE_PEER_ADDR /**< Update peer address. */ -} device_store_state_t; - -/** - * @defgroup device_manager_context_offsets Context Offsets - * @{ - * - * @brief Context offsets each of the context information in persistent memory. - * - * @details Below is a layout showing how each how the context information is stored in persistent - * memory. - * - * All Device context is stored in the flash as follows: - * +---------+---------+---------+------------------+----------------+--------------------+ - * | Block / Device ID + Layout of stored information in storage block | - * +---------+---------+---------+------------------+----------------+--------------------+ - * | Block 0 | Device 0| Peer Id | Bond Information | Service Context| Application Context| - * +---------+---------+---------+------------------+----------------+--------------------+ - * | Block 1 | Device 1| Peer Id | Bond Information | Service Context| Application Context| - * +---------+---------+---------+------------------+----------------+--------------------+ - * | ... | .... | - * +---------+---------+---------+------------------+----------------+--------------------+ - * | Block N | Device N| Peer Id | Bond Information | Service Context| Application Context| - * +---------+---------+---------+------------------+----------------+--------------------+ - * - * The following defines are used to get offset of each of the components within a block. - */ - -#define PEER_ID_STORAGE_OFFSET 0 /**< Offset at which peer id is stored in the block. */ -#define BOND_STORAGE_OFFSET PEER_ID_SIZE /**< Offset at which bond information is stored in the block. */ -#define SERVICE_STORAGE_OFFSET (BOND_STORAGE_OFFSET + BOND_SIZE) /**< Offset at which service context is stored in the block. */ -#define APP_CONTEXT_STORAGE_OFFSET (SERVICE_STORAGE_OFFSET + SERVICE_CONTEXT_SIZE) /**< Offset at which application context is stored in the block. */ -/** @} */ - -/** - * @defgroup device_manager_context_size Context size. - * @{ - * - * @brief This group defines the size of each of the context information. - */ -#define PEER_ID_SIZE (sizeof(peer_id_t)) /**< Size of peer identification information. */ -#define BOND_SIZE (sizeof(bond_context_t)) /**< Size of bond information. */ -#define DEVICE_CONTEXT_SIZE (PEER_ID_SIZE + BOND_SIZE) /**< Size of Device context, include peer identification and bond information. */ -#define GATTS_SERVICE_CONTEXT_SIZE (sizeof(dm_gatts_context_t)) /**< Size of GATTS service context. */ -#define GATTC_SERVICE_CONTEXT_SIZE (sizeof(dm_gatt_client_context_t)) /**< Size of GATTC service context. */ -#define SERVICE_CONTEXT_SIZE (GATTS_SERVICE_CONTEXT_SIZE + GATTC_SERVICE_CONTEXT_SIZE) /**< Combined size of GATTS and GATTC service contexts. */ -#define APP_CONTEXT_MIN_SIZE 4 /**< Minimum size for application context data. */ -#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) -#define APP_CONTEXT_SIZE (sizeof(uint32_t) + DEVICE_MANAGER_APP_CONTEXT_SIZE) /**< Size of application context including length field. */ -#else //DEVICE_MANAGER_APP_CONTEXT_SIZE -#define APP_CONTEXT_SIZE 0 /**< Size of application context. */ -#endif // DEVICE_MANAGER_APP_CONTEXT_SIZE -#define ALL_CONTEXT_SIZE (DEVICE_CONTEXT_SIZE + SERVICE_CONTEXT_SIZE + APP_CONTEXT_SIZE) /**< Size of all contexts. */ -/** @} */ - - -/** - * @defgroup device_manager_log Module's Log Macros - * - * @details Macros used for creating module logs which can be useful in understanding handling - * of events or actions on API requests. These are intended for debugging purposes and - * can be disabled by defining the DM_DISABLE_LOGS. - * - * @note That if ENABLE_DEBUG_LOG_SUPPORT is disabled, having DM_DISABLE_LOGS has no effect. - * @{ - */ -#define nDM_DISABLE_LOGS /**< Enable this macro to disable any logs from this module. */ - -#ifndef DM_DISABLE_LOGS -#define DM_LOG app_trace_log /**< Used for logging details. */ -#define DM_ERR app_trace_log /**< Used for logging errors in the module. */ -#define DM_TRC app_trace_log /**< Used for getting trace of execution in the module. */ -#define DM_DUMP app_trace_dump /**< Used for dumping octet information to get details of bond information etc. */ -#else //DM_DISABLE_LOGS -#define DM_DUMP(...) /**< Disables dumping of octet streams. */ -#define DM_LOG(...) /**< Disables detailed logs. */ -#define DM_ERR(...) /**< Disables error logs. */ -#define DM_TRC(...) /**< Disables traces. */ -#endif //DM_DISABLE_LOGS -/** @} */ - -/** - * @defgroup device_manager_mutex_lock_unlock Module's Mutex Lock/Unlock Macros. - * - * @details Macros used to lock and unlock modules. Currently the SDK does not use mutexes but - * framework is provided in case need arises to use an alternative architecture. - * @{ - */ -#define DM_MUTEX_LOCK() SDK_MUTEX_LOCK(m_dm_mutex) /**< Lock module using mutex. */ -#define DM_MUTEX_UNLOCK() SDK_MUTEX_UNLOCK(m_dm_mutex) /**< Unlock module using mutex. */ -/** @} */ - - -/** - * @defgroup device_manager_misc_defines Miscellaneous defines used across the module. - * @{ - */ -#define DM_GATT_ATTR_SIZE 6 /**< Size of each GATT attribute to be stored persistently. */ -#define DM_GATT_SERVER_ATTR_MAX_SIZE ((DM_GATT_ATTR_SIZE * DM_GATT_CCCD_COUNT) + 2) /**< Maximum size of GATT attributes to be stored.*/ -#define DM_SERVICE_CONTEXT_COUNT (DM_PROTOCOL_CNTXT_ALL + 1) /**< Maximum number of service contexts. */ -#define DM_EVT_DEVICE_CONTEXT_BASE 0x20 /**< Base for device context base. */ -#define DM_EVT_SERVICE_CONTEXT_BASE 0x30 /**< Base for service context base. */ -#define DM_EVT_APP_CONTEXT_BASE 0x40 /**< Base for application context base. */ -#define DM_LOAD_OPERATION_ID 0x01 /**< Load operation identifier. */ -#define DM_STORE_OPERATION_ID 0x02 /**< Store operation identifier. */ -#define DM_CLEAR_OPERATION_ID 0x03 /**< Clear operation identifier. */ -/** @} */ - -#define DM_GATTS_INVALID_SIZE 0xFFFFFFFF /**< Identifer for GATTS invalid size. */ - -/** - * @defgroup api_param_check API Parameters check macros. - * - * @details Macros for verifying parameters passed to the module in the APIs. These macros - * could be mapped to nothing in the final version of the code in order to save execution - * time and program size. - * @{ - */ - -//#define DM_DISABLE_API_PARAM_CHECK /**< Macro to disable API parameters check. */ - -#undef NULL_PARAM_CHECK -#undef VERIFY_MODULE_INITIALIZED -#undef VERIFY_MODULE_INITIALIZED_VOID -#undef VERIFY_APP_REGISTERED -#undef VERIFY_APP_REGISTERED_VOID -#undef VERIFY_CONNECTION_INSTANCE -#undef VERIFY_DEVICE_INSTANCE - -#ifndef DM_DISABLE_API_PARAM_CHECK - -/**@brief Macro for verifying NULL parameters are not passed to API. - * - * @param[in] PARAM Parameter checked for NULL. - * - * @retval (NRF_ERROR_NULL | DEVICE_MANAGER_ERR_BASE) when @ref PARAM is NULL. - */ -#define NULL_PARAM_CHECK(PARAM) \ - if ((PARAM) == NULL) \ - { \ - return (NRF_ERROR_NULL | DEVICE_MANAGER_ERR_BASE); \ - } -/**@} */ - - -/**@brief Macro for verifying module's initialization status. - * - * @retval (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE) when module is not initialized. - */ -#define VERIFY_MODULE_INITIALIZED() \ - do \ - { \ - if (!m_module_initialized) \ - { \ - return (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE); \ - } \ - } while (0) - - -/**@brief Macro for verifying module's initialization status. Returns in case it is not initialized. - */ -#define VERIFY_MODULE_INITIALIZED_VOID() \ - do \ - { \ - if (!m_module_initialized) \ - { \ - return; \ - } \ - } while (0) - - -/**@brief Macro for verifying that the application is registered. - * - * @param[in] X Application instance identifier. - * - * @retval (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE) when module API is called without - * registering an application with the module. - */ -#define VERIFY_APP_REGISTERED(X) \ - do \ - { \ - if (((X) >= DEVICE_MANAGER_MAX_APPLICATIONS) || \ - (m_application_table[(X)].ntf_cb == NULL)) \ - { \ - return (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE); \ - } \ - } while (0) - - -/**@brief Macro for verifying that the application is registered. Returns in case it is not - * registered. - * - * @param[in] X Application instance identifier. - */ -#define VERIFY_APP_REGISTERED_VOID(X) \ - do \ - { \ - if (((X) >= DEVICE_MANAGER_MAX_APPLICATIONS) || \ - (m_application_table[(X)].ntf_cb == NULL)) \ - { \ - return; \ - } \ - } while (0) - - -/**@brief Macro for verifying connection instance is allocated. - * - * @param[in] X Connection instance identifier. - * - * @retval (NRF_ERROR_INVALID_ADDR | DEVICE_MANAGER_ERR_BASE) when connection instance is not - * allocated. - */ -#define VERIFY_CONNECTION_INSTANCE(X) \ - do \ - { \ - if (((X) >= DEVICE_MANAGER_MAX_CONNECTIONS) || \ - (m_connection_table[(X)].state == STATE_IDLE)) \ - { \ - return (NRF_ERROR_INVALID_ADDR | DEVICE_MANAGER_ERR_BASE); \ - } \ - } while (0) - - -/**@brief Macro for verifying if device instance is allocated. - * - * @param[in] X Device instance identifier. - * - * @retval (NRF_ERROR_INVALID_ADDR | DEVICE_MANAGER_ERR_BASE) when device instance is not allocated. - */ -#define VERIFY_DEVICE_INSTANCE(X) \ - do \ - { \ - if (((X) >= DEVICE_MANAGER_MAX_BONDS) || \ - (m_peer_table[(X)].id_bitmap == UNASSIGNED)) \ - { \ - return (NRF_ERROR_INVALID_ADDR | DEVICE_MANAGER_ERR_BASE); \ - } \ - } while (0) - -/**@brief Macro for verifying if device is bonded and thus can store data persistantly. - * - * @param[in] X Connection instance identifier. - * - * @retval (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE) when device is not bonded. - */ -#define VERIFY_DEVICE_BOND(X) \ - do \ - { \ - if ((m_connection_table[(X)].state & STATE_BONDED) != STATE_BONDED)\ - { \ - return (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE); \ - } \ - } while (0) -#else -#define NULL_PARAM_CHECK(X) -#define VERIFY_MODULE_INITIALIZED() -#define VERIFY_MODULE_INITIALIZED_VOID() -#define VERIFY_APP_REGISTERED(X) -#define VERIFY_APP_REGISTERED_VOID(X) -#define VERIFY_CONNECTION_INSTANCE(X) -#define VERIFY_DEVICE_INSTANCE(X) -#endif //DM_DISABLE_API_PARAM_CHECK -/** @} */ - -#define INVALID_CONTEXT_LEN 0xFFFFFFFF /**< Identifier for invalid context length. */ -/**@brief Macro for checking that application context size is greater that minimal size. - * - * @param[in] X Size of application context. - * - * @retval (NRF_ERROR_INVALID_PARAM) when size is smaller than minimun required size. - */ -#define SIZE_CHECK_APP_CONTEXT(X) \ - if ((X) < (APP_CONTEXT_MIN_SIZE)) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } - - -/** - * @defgroup dm_data_types Module's internal data types. - * - * @brief This section describes a module's internal data structures. - * @{ - */ -/**@brief Peer identification information. - */ -typedef struct -{ - ble_gap_id_key_t peer_id; /**< IRK and/or address of peer. */ - uint16_t ediv; /**< Peer's encrypted diversifier. */ - uint8_t id_bitmap; /**< Contains information if above field is valid. */ -} peer_id_t; - -STATIC_ASSERT(sizeof(peer_id_t) % 4 == 0); /**< Check to ensure Peer identification information is a multiple of 4. */ - -/**@brief Portion of bonding information exchanged by a device during bond creation that needs to - * be stored persistently. - * - * @note An entry is not made in this table unless device is bonded. - */ -typedef struct -{ - ble_gap_enc_key_t peer_enc_key; /**< Local LTK info, central IRK and address */ -} bond_context_t; - -STATIC_ASSERT(sizeof(bond_context_t) % 4 == 0); /**< Check to ensure bond information is a multiple of 4. */ - -/**@brief GATT Server Attributes size and data. - */ -typedef struct -{ - uint32_t flags; /**< Flags identifying the stored attributes. */ - uint32_t size; /**< Size of stored attributes. */ - uint8_t attributes[DM_GATT_SERVER_ATTR_MAX_SIZE]; /**< Array to hold the server attributes. */ -} dm_gatts_context_t; - -STATIC_ASSERT(sizeof(dm_gatts_context_t) % 4 == 0); /**< Check to ensure GATT Server Attributes size and data information is a multiple of 4. */ - -/**@brief GATT Client context information. Placeholder for now. - */ -typedef struct -{ - void * p_dummy; /**< Placeholder, currently unused. */ -} dm_gatt_client_context_t; - -STATIC_ASSERT(sizeof(dm_gatt_client_context_t) % 4 == 0); /**< Check to ensure GATT Client context information is a multiple of 4. */ -STATIC_ASSERT((DEVICE_MANAGER_APP_CONTEXT_SIZE % 4) == 0); /**< Check to ensure device manager application context information is a multiple of 4. */ - -/**@brief Connection instance definition. Maintains information with respect to an active peer. - */ -typedef struct -{ - ble_gap_addr_t peer_addr; /**< Peer identification information. This information is retained as long as the connection session exists, once disconnected, for non-bonded devices this information is not stored persistently. */ - uint16_t conn_handle; /**< Connection handle for the device. */ - uint8_t state; /**< Link state. */ - uint8_t bonded_dev_id; /**< In case the device is bonded, this points to the corresponding bonded device. This index can be used to index service and bond context as well. */ -} connection_instance_t; - -/**@brief Application instance definition. Maintains information with respect to a registered - * application. - */ -typedef struct -{ - dm_event_cb_t ntf_cb; /**< Callback registered with the application. */ - ble_gap_sec_params_t sec_param; /**< Local security parameters registered by the application. */ - uint8_t state; /**< Application state. Currently this is used only for knowing if any security procedure is in progress and/or a security procedure is pending to be requested. */ - uint8_t service; /**< Service registered by the application. */ -} application_instance_t; - -/**@brief Function for performing necessary action of storing each of the service context as - * registered by the application. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is stored. - * - * @retval Operation result code. - */ -typedef ret_code_t (* service_context_access_t)(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -/**@brief Function for performing necessary action of applying the context information. - * - * @param[in] p_handle Device handle identifying device that is stored. - * - * @retval Operation result code. - */ -typedef ret_code_t (* service_context_apply_t)(dm_handle_t * p_handle); - -/**@brief Function for performing necessary functions of storing or updating. - * - * @param[in] p_dest Destination address where data is stored persistently. - * @param[in] p_src Source address containing data to be stored. - * @param[in] size Size of data to be stored expressed in bytes. Must be word aligned. - * @param[in] offset Offset in bytes to be applied when writing to the block. - * - * @retval Operation result code. - */ -typedef uint32_t (* storage_operation)(pstorage_handle_t * p_dest, - uint8_t * p_src, - pstorage_size_t size, - pstorage_size_t offset); -/** @} */ - -/** - * @defgroup dm_tables Module's internal tables. - * - * @brief This section describes the module's internal tables and the static global variables - * needed for its functionality. - * @{ - */ -#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) -static uint8_t * m_app_context_table[DEVICE_MANAGER_MAX_BONDS]; /**< Table to remember application contexts of bonded devices. */ -#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE -__ALIGN(sizeof(uint32_t)) -static peer_id_t m_peer_table[DEVICE_MANAGER_MAX_BONDS] ; /**< Table to maintain bonded devices' identification information, an instance is allocated in the table when a device is bonded and freed when bond information is deleted. */ -__ALIGN(sizeof(uint32_t)) -static bond_context_t m_bond_table[DEVICE_MANAGER_MAX_CONNECTIONS]; /**< Table to maintain bond information for active peers. */ -static dm_gatts_context_t m_gatts_table[DEVICE_MANAGER_MAX_CONNECTIONS]; /**< Table for service information for active connection instances. */ -static connection_instance_t m_connection_table[DEVICE_MANAGER_MAX_CONNECTIONS]; /**< Table to maintain active peer information. An instance is allocated in the table when a new connection is established and freed on disconnection. */ -static application_instance_t m_application_table[DEVICE_MANAGER_MAX_APPLICATIONS]; /**< Table to maintain application instances. */ -static pstorage_handle_t m_storage_handle; /**< Persistent storage handle for blocks requested by the module. */ -static uint32_t m_peer_addr_update; /**< 32-bit bitmap to remember peer device address update. */ -static ble_gap_id_key_t m_local_id_info; /**< ID information of central in case resolvable address is used. */ -static bool m_module_initialized = false; /**< State indicating if module is initialized or not. */ -static uint8_t m_irk_index_table[DEVICE_MANAGER_MAX_BONDS]; /**< List maintaining IRK index list. */ - -SDK_MUTEX_DEFINE(m_dm_mutex) /**< Mutex variable. Currently unused, this declaration does not occupy any space in RAM. */ -/** @} */ - -static __INLINE ret_code_t no_service_context_store(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -static __INLINE ret_code_t gatts_context_store(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -static __INLINE ret_code_t gattc_context_store(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -static __INLINE ret_code_t gattsc_context_store(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -static __INLINE ret_code_t no_service_context_load(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -static __INLINE ret_code_t gatts_context_load(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -static __INLINE ret_code_t gattc_context_load(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -static __INLINE ret_code_t gattsc_context_load(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle); - -static __INLINE ret_code_t no_service_context_apply(dm_handle_t * p_handle); - -static __INLINE ret_code_t gatts_context_apply(dm_handle_t * p_handle); - -static __INLINE ret_code_t gattc_context_apply(dm_handle_t * p_handle); - -static __INLINE ret_code_t gattsc_context_apply(dm_handle_t * p_handle); - - -/**< Array of function pointers based on the types of service registered. */ -const service_context_access_t m_service_context_store[DM_SERVICE_CONTEXT_COUNT] = -{ - no_service_context_store, /**< Dummy function, when there is no service context registered. */ - gatts_context_store, /**< GATT Server context store function. */ - gattc_context_store, /**< GATT Client context store function. */ - gattsc_context_store /**< GATT Server & Client context store function. */ -}; - - -/**< Array of function pointers based on the types of service registered. */ -const service_context_access_t m_service_context_load[DM_SERVICE_CONTEXT_COUNT] = -{ - no_service_context_load, /**< Dummy function, when there is no service context registered. */ - gatts_context_load, /**< GATT Server context load function. */ - gattc_context_load, /**< GATT Client context load function. */ - gattsc_context_load /**< GATT Server & Client context load function. */ -}; - - -/**< Array of function pointers based on the types of service registered. */ -const service_context_apply_t m_service_context_apply[DM_SERVICE_CONTEXT_COUNT] = -{ - no_service_context_apply, /**< Dummy function, when there is no service context registered. */ - gatts_context_apply, /**< GATT Server context apply function. */ - gattc_context_apply, /**< GATT Client context apply function. */ - gattsc_context_apply /**< GATT Server & Client context apply function. */ -}; - - -const uint32_t m_context_init_len = 0xFFFFFFFF; /**< Constant used to update the initial value for context in the flash. */ - -/**@brief Function for setting update status for the device identified by 'index'. - * - * @param[in] index Device identifier. - */ -static __INLINE void update_status_bit_set(uint32_t index) -{ - m_peer_addr_update |= (BIT_0 << index); -} - - -/**@brief Function for resetting update status for device identified by 'index'. - * - * @param[in] index Device identifier. - */ -static __INLINE void update_status_bit_reset(uint32_t index) -{ - m_peer_addr_update &= (~((uint32_t)BIT_0 << index)); -} - - -/**@brief Function for providing update status for the device identified by 'index'. - * - * @param[in] index Device identifier. - * - * @retval true if the bit is set, false otherwise. - */ -static __INLINE bool update_status_bit_is_set(uint32_t index) -{ - return ((m_peer_addr_update & (BIT_0 << index)) ? true : false); -} - - -/**@brief Function for initialiasing the application instance identified by 'index'. - * - * @param[in] index Device identifier. - */ -static __INLINE void application_instance_init(uint32_t index) -{ - DM_TRC("[DM]: Initializing Application Instance 0x%08X.\r\n", index); - - m_application_table[index].ntf_cb = NULL; - m_application_table[index].state = 0x00; - m_application_table[index].service = 0x00; -} - - -/**@brief Function for initialiasing the connection instance identified by 'index'. - * - * @param[in] index Device identifier. - */ -static __INLINE void connection_instance_init(uint32_t index) -{ - DM_TRC("[DM]: Initializing Connection Instance 0x%08X.\r\n", index); - - m_connection_table[index].state = STATE_IDLE; - m_connection_table[index].conn_handle = BLE_CONN_HANDLE_INVALID; - m_connection_table[index].bonded_dev_id = DM_INVALID_ID; - - memset(&m_connection_table[index].peer_addr, 0, sizeof (ble_gap_addr_t)); -} - - -/**@brief Function for initialiasing the peer device instance identified by 'index'. - * - * @param[in] index Device identifier. - */ -static __INLINE void peer_instance_init(uint32_t index) -{ - DM_TRC("[DM]: Initializing Peer Instance 0x%08X.\r\n", index); - - memset(m_peer_table[index].peer_id.id_addr_info.addr, 0, BLE_GAP_ADDR_LEN); - memset(m_peer_table[index].peer_id.id_info.irk, 0, BLE_GAP_SEC_KEY_LEN); - - //Initialize the address type to invalid. - m_peer_table[index].peer_id.id_addr_info.addr_type = INVALID_ADDR_TYPE; - - //Initialize the identification bit map to unassigned. - m_peer_table[index].id_bitmap = UNASSIGNED; - - // Initialize diversifier. - m_peer_table[index].ediv = EDIV_INIT_VAL; - - - //Reset the status bit. - update_status_bit_reset(index); - -#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) - //Initialize the application context for bond device. - m_app_context_table[index] = NULL; -#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE -} - - -/**@brief Function for searching connection instance matching the connection handle and the state - * requested. - * - * @details Connection handle and state information is used to get a connection instance, it - * is possible to ignore the connection handle by using BLE_CONN_HANDLE_INVALID. - * - * @param[in] conn_handle Connection handle. - * @param[in] state Connection instance state. - * @param[out] p_instance Connection instance. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. Invalid state - * @retval NRF_ERROR_NOT_FOUND Operation failure. Not found - */ -static ret_code_t connection_instance_find(uint16_t conn_handle, - uint8_t state, - uint32_t * p_instance) -{ - ret_code_t err_code; - uint32_t index; - - err_code = NRF_ERROR_INVALID_STATE; - - for (index = 0; index < DEVICE_MANAGER_MAX_CONNECTIONS; index++) - { - //Search only based on the state. - if (state & m_connection_table[index].state) - { - //Ignore the connection handle. - if ((conn_handle == BLE_CONN_HANDLE_INVALID) || - (conn_handle == m_connection_table[index].conn_handle)) - { - //Search for matching connection handle. - (*p_instance) = index; - err_code = NRF_SUCCESS; - - break; - } - else - { - err_code = NRF_ERROR_NOT_FOUND; - } - } - } - - return err_code; -} - - -/**@brief Function for allocating device instance for a bonded device. - * - * @param[out] p_device_index Device index. - * @param[in] p_addr Peer identification information. - * - * @retval NRF_SUCCESS Operation success. - * @retval DM_DEVICE_CONTEXT_FULL Operation failure. - */ -static __INLINE ret_code_t device_instance_allocate(uint8_t * p_device_index, - ble_gap_addr_t const * p_addr) -{ - ret_code_t err_code; - uint32_t index; - - err_code = DM_DEVICE_CONTEXT_FULL; - - for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) - { - DM_TRC("[DM]:[DI 0x%02X]: Device type 0x%02X.\r\n", - index, m_peer_table[index].peer_id.id_addr_info.addr_type); - DM_TRC("[DM]: Device Addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n", - m_peer_table[index].peer_id.id_addr_info.addr[0], - m_peer_table[index].peer_id.id_addr_info.addr[1], - m_peer_table[index].peer_id.id_addr_info.addr[2], - m_peer_table[index].peer_id.id_addr_info.addr[3], - m_peer_table[index].peer_id.id_addr_info.addr[4], - m_peer_table[index].peer_id.id_addr_info.addr[5]); - - if (m_peer_table[index].id_bitmap == UNASSIGNED) - { - if (p_addr->addr_type != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE) - { - m_peer_table[index].id_bitmap &= (~ADDR_ENTRY); - m_peer_table[index].peer_id.id_addr_info = (*p_addr); - } - else - { - m_peer_table[index].id_bitmap &= (~IRK_ENTRY); - } - - (*p_device_index) = index; - err_code = NRF_SUCCESS; - - DM_LOG("[DM]: Allocated device instance 0x%02X\r\n", index); - - break; - } - } - - return err_code; -} - - -/**@brief Function for freeing a device instance allocated for bonded device. - * - * @param[in] device_index Device index. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - */ -static __INLINE ret_code_t device_instance_free(uint32_t device_index) -{ - ret_code_t err_code; - pstorage_handle_t block_handle; - - //Get the block handle. - err_code = pstorage_block_identifier_get(&m_storage_handle, device_index, &block_handle); - - if (err_code == NRF_SUCCESS) - { - DM_TRC("[DM]:[DI 0x%02X]: Freeing Instance.\r\n", device_index); - - //Request clearing of the block. - err_code = pstorage_clear(&block_handle, ALL_CONTEXT_SIZE); - - if (err_code == NRF_SUCCESS) - { - peer_instance_init(device_index); - } - } - - return err_code; -} - - -/**@brief Function for searching for the device in the bonded device list. - * - * @param[in] p_addr Peer identification information. - * @param[out] p_device_index Device index. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_NOT_FOUND Operation failure. - */ -static ret_code_t device_instance_find(ble_gap_addr_t const * p_addr, uint32_t * p_device_index, uint16_t ediv) -{ - ret_code_t err_code; - uint32_t index; - - err_code = NRF_ERROR_NOT_FOUND; - - if (NULL != p_addr) - { - DM_TRC("[DM]: Searching for device 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n", - p_addr->addr[0], - p_addr->addr[1], - p_addr->addr[2], - p_addr->addr[3], - p_addr->addr[4], - p_addr->addr[5]); - } - - for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) - { - DM_TRC("[DM]:[DI 0x%02X]: Device type 0x%02X.\r\n", - index, m_peer_table[index].peer_id.id_addr_info.addr_type); - DM_TRC("[DM]: Device Addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n", - m_peer_table[index].peer_id.id_addr_info.addr[0], - m_peer_table[index].peer_id.id_addr_info.addr[1], - m_peer_table[index].peer_id.id_addr_info.addr[2], - m_peer_table[index].peer_id.id_addr_info.addr[3], - m_peer_table[index].peer_id.id_addr_info.addr[4], - m_peer_table[index].peer_id.id_addr_info.addr[5]); - - if (((NULL == p_addr) && (ediv == m_peer_table[index].ediv)) || - ((NULL != p_addr) && (memcmp(&m_peer_table[index].peer_id.id_addr_info, p_addr, sizeof(ble_gap_addr_t)) == 0))) - { - DM_LOG("[DM]: Found device at instance 0x%02X\r\n", index); - - (*p_device_index) = index; - err_code = NRF_SUCCESS; - - break; - } - } - - return err_code; -} - - -/**@brief Function for notifying connection manager event to the application. - * - * @param[in] p_handle Device handle identifying device. - * @param[in] p_event Connection manager event details. - * @param[in] event_result Event result code. - */ -static __INLINE void app_evt_notify(dm_handle_t const * const p_handle, - dm_event_t const * const p_event, - uint32_t event_result) -{ - dm_event_cb_t app_cb = m_application_table[0].ntf_cb; - - DM_MUTEX_UNLOCK(); - - DM_TRC("[DM]: Notifying application of event 0x%02X\r\n", p_event->event_id); - - //No need to do any kind of return value processing thus can be supressed. - UNUSED_VARIABLE(app_cb(p_handle, p_event, event_result)); - - DM_MUTEX_LOCK(); -} - - -/**@brief Function for allocating instance. - * - * @details The instance identifier is provided in the 'p_instance' parameter if the routine - * succeeds. - * - * @param[out] p_instance Connection instance. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_NO_MEM Operation failure. No memory. - */ -static __INLINE uint32_t connection_instance_allocate(uint32_t * p_instance) -{ - uint32_t err_code; - - DM_TRC("[DM]: Request to allocation connection instance\r\n"); - - err_code = connection_instance_find(BLE_CONN_HANDLE_INVALID, STATE_IDLE, p_instance); - - if (err_code == NRF_SUCCESS) - { - DM_LOG("[DM]:[%02X]: Connection Instance Allocated.\r\n", (*p_instance)); - m_connection_table[*p_instance].state = STATE_CONNECTED; - } - else - { - DM_LOG("[DM]: No free connection instances available\r\n"); - err_code = NRF_ERROR_NO_MEM; - } - - return err_code; -} - - -/**@brief Function for freeing instance. Instance identifier is provided in the parameter - * 'p_instance' in case the routine succeeds. - * - * @param[in] p_instance Connection instance. - */ -static __INLINE void connection_instance_free(uint32_t const * p_instance) -{ - DM_TRC("[DM]:[CI 0x%02X]: Freeing connection instance\r\n", (*p_instance)); - - if (m_connection_table[*p_instance].state != STATE_IDLE) - { - DM_LOG("[DM]:[%02X]: Freed connection instance.\r\n", (*p_instance)); - connection_instance_init(*p_instance); - } -} - - -/**@brief Function for storage operation dummy handler. - * - * @param[in] p_dest Destination address where data is to be stored persistently. - * @param[in] p_src Source address containing data to be stored. API assumes this to be resident - * memory and no intermediate copy of data is made by the API. - * @param[in] size Size of data to be stored expressed in bytes. Should be word aligned. - * @param[in] offset Offset in bytes to be applied when writing to the block. - * For example, if within a block of 100 bytes, application wishes to - * write 20 bytes at offset of 12, then this field should be set to 12. - * Should be word aligned. - * - * @retval NRF_SUCCESS Operation success. - */ -static uint32_t storage_operation_dummy_handler(pstorage_handle_t * p_dest, - uint8_t * p_src, - pstorage_size_t size, - pstorage_size_t offset) -{ - return NRF_SUCCESS; -} - - -/**@brief Function for saving the device context persistently. - * - * @param[in] p_handle Device handle identifying device. - * @param[in] state Device store state. - */ -static __INLINE void device_context_store(dm_handle_t const * p_handle, device_store_state_t state) -{ - pstorage_handle_t block_handle; - storage_operation store_fn; - ret_code_t err_code; - - DM_LOG("[DM]: --> device_context_store\r\n"); - - err_code = pstorage_block_identifier_get(&m_storage_handle, - p_handle->device_id, - &block_handle); - - if (err_code == NRF_SUCCESS) - { - if ((STATE_BOND_INFO_UPDATE == - (m_connection_table[p_handle->connection_id].state & STATE_BOND_INFO_UPDATE)) || - (state == UPDATE_PEER_ADDR)) - { - DM_LOG("[DM]:[DI %02X]:[CI %02X]: -> Updating bonding information.\r\n", - p_handle->device_id, p_handle->connection_id); - - store_fn = pstorage_update; - } - else if (state == FIRST_BOND_STORE) - { - DM_LOG("[DM]:[DI %02X]:[CI %02X]: -> Storing bonding information.\r\n", - p_handle->device_id, p_handle->connection_id); - - store_fn = pstorage_store; - } - else - { - DM_LOG("[DM]:[DI %02X]:[CI %02X]: -> No update in bonding information.\r\n", - p_handle->device_id, p_handle->connection_id); - - //No operation needed. - store_fn = storage_operation_dummy_handler; - } - - //Store the peer id. - err_code = store_fn(&block_handle, - (uint8_t *)&m_peer_table[p_handle->device_id], - PEER_ID_SIZE, - PEER_ID_STORAGE_OFFSET); - - if ((err_code == NRF_SUCCESS) && (state != UPDATE_PEER_ADDR)) - { - m_connection_table[p_handle->connection_id].state &= (~STATE_BOND_INFO_UPDATE); - - //Store the bond information. - err_code = store_fn(&block_handle, - (uint8_t *)&m_bond_table[p_handle->connection_id], - BOND_SIZE, - BOND_STORAGE_OFFSET); - - if (err_code != NRF_SUCCESS) - { - DM_ERR("[DM]:[0x%02X]:Failed to store bond information, reason 0x%08X\r\n", - p_handle->device_id, err_code); - } - } - - if (state != UPDATE_PEER_ADDR) - { - //Store the service information - err_code = m_service_context_store[m_application_table[p_handle->appl_id].service] - ( - &block_handle, - p_handle - ); - - if (err_code != NRF_SUCCESS) - { - //Notify application of an error event. - DM_ERR("[DM]: Failed to store service context, reason %08X\r\n", err_code); - } - } - } - - if (err_code != NRF_SUCCESS) - { - //Notify application of an error event. - DM_ERR("[DM]: Failed to store device context, reason %08X\r\n", err_code); - } -} - - -/**@brief Function for storing when there is no service registered. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is loaded. - * - * @retval NRF_SUCCESS - */ -static __INLINE ret_code_t no_service_context_store(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle) -{ - DM_LOG("[DM]: --> no_service_context_store\r\n"); - - return NRF_SUCCESS; -} - - -/**@brief Function for storing GATT Server context. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is stored. - * - * @retval NRF_SUCCESS Operation success. - */ -static __INLINE ret_code_t gatts_context_store(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle) -{ - storage_operation store_fn; - uint32_t attr_flags = BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS | BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS; - uint16_t attr_len = DM_GATT_SERVER_ATTR_MAX_SIZE; - uint8_t sys_data[DM_GATT_SERVER_ATTR_MAX_SIZE]; - - DM_LOG("[DM]: --> gatts_context_store\r\n"); - - uint32_t err_code = sd_ble_gatts_sys_attr_get( - m_connection_table[p_handle->connection_id].conn_handle, - sys_data, - &attr_len, - attr_flags); - - if (err_code == NRF_SUCCESS) - { - if (memcmp(m_gatts_table[p_handle->connection_id].attributes, sys_data, attr_len) == 0) - { - //No store operation is needed. - DM_LOG("[DM]:[0x%02X]: No change in GATTS Context information.\r\n", - p_handle->device_id); - - if ((m_connection_table[p_handle->connection_id].state & STATE_CONNECTED) != - STATE_CONNECTED) - { - DM_LOG("[DM]:[0x%02X]: Resetting GATTS for active instance.\r\n", - p_handle->connection_id); - - //Reset GATTS information for the current context. - memset(&m_gatts_table[p_handle->connection_id], 0, sizeof(dm_gatts_context_t)); - } - } - else - { - if (m_gatts_table[p_handle->connection_id].size != 0) - { - //There is data already stored in persistent memory, therefore an update is needed. - DM_LOG("[DM]:[0x%02X]: Updating stored service context\r\n", p_handle->device_id); - - store_fn = pstorage_update; - } - else - { - //Fresh write, a store is needed. - DM_LOG("[DM]:[0x%02X]: Storing service context\r\n", p_handle->device_id); - - store_fn = pstorage_store; - } - - m_gatts_table[p_handle->connection_id].flags = attr_flags; - m_gatts_table[p_handle->connection_id].size = attr_len; - memcpy(m_gatts_table[p_handle->connection_id].attributes, sys_data, attr_len); - - DM_DUMP((uint8_t *)&m_gatts_table[p_handle->connection_id], sizeof(dm_gatts_context_t)); - - DM_LOG("[DM]:[0x%02X]: GATTS Data size 0x%08X\r\n", - p_handle->device_id, - m_gatts_table[p_handle->connection_id].size); - - //Store GATTS information. - err_code = store_fn((pstorage_handle_t *)p_block_handle, - (uint8_t *)&m_gatts_table[p_handle->connection_id], - GATTS_SERVICE_CONTEXT_SIZE, - SERVICE_STORAGE_OFFSET); - - if (err_code != NRF_SUCCESS) - { - DM_ERR("[DM]:[0x%02X]:Failed to store service context, reason 0x%08X\r\n", - p_handle->device_id, - err_code); - } - else - { - DM_LOG("[DM]: Service context successfully stored.\r\n"); - } - } - } - - return NRF_SUCCESS; -} - - -/**@brief Function for storing GATT Client context. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is stored. - * - * @retval NRF_SUCCESS Operation success. - */ -static __INLINE ret_code_t gattc_context_store(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle) -{ - DM_LOG("[DM]: --> gattc_context_store\r\n"); - - return NRF_SUCCESS; -} - - -/**@brief Function for storing GATT Server & Client context. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is stored. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - */ -static __INLINE ret_code_t gattsc_context_store(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle) -{ - DM_LOG("[DM]: --> gattsc_context_store\r\n"); - - ret_code_t err_code = gatts_context_store(p_block_handle, p_handle); - - if (NRF_SUCCESS == err_code) - { - err_code = gattc_context_store(p_block_handle, p_handle); - } - - return err_code; -} - - -/**@brief Function for loading when there is no service registered. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is loaded. - * - * @retval NRF_SUCCESS - */ -static __INLINE ret_code_t no_service_context_load(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle) -{ - DM_LOG("[DM]: --> no_service_context_load\r\n"); - - return NRF_SUCCESS; -} - - -/**@brief Function for loading GATT Server context. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is loaded. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - */ -static __INLINE ret_code_t gatts_context_load(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle) -{ - DM_LOG("[DM]:[CI 0x%02X]:[DI 0x%02X]: --> gatts_context_load\r\n", - p_handle->connection_id, - p_handle->device_id); - - ret_code_t err_code = pstorage_load((uint8_t *)&m_gatts_table[p_handle->connection_id], - (pstorage_handle_t *)p_block_handle, - GATTS_SERVICE_CONTEXT_SIZE, - SERVICE_STORAGE_OFFSET); - - if (err_code == NRF_SUCCESS) - { - DM_LOG("[DM]:[%02X]:[Block ID 0x%08X]: Service context loaded, size 0x%08X\r\n", - p_handle->connection_id, - p_block_handle->block_id, - m_gatts_table[p_handle->connection_id].size); - DM_DUMP((uint8_t *)&m_gatts_table[p_handle->connection_id], sizeof(dm_gatts_context_t)); - - if (m_gatts_table[p_handle->connection_id].size == DM_GATTS_INVALID_SIZE) - { - m_gatts_table[p_handle->connection_id].size = 0; - } - } - else - { - DM_ERR("[DM]:[%02X]: Failed to load Service context, reason %08X\r\n", - p_handle->connection_id, - err_code); - } - - return err_code; -} - - -/**@brief Function for loading GATT Client context. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is loaded. - * - * @retval NRF_SUCCESS - */ -static __INLINE ret_code_t gattc_context_load(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle) -{ - DM_LOG("[DM]: --> gattc_context_load\r\n"); - - return NRF_SUCCESS; -} - - -/**@brief Function for loading GATT Server & Client context. - * - * @param[in] p_block_handle Storage block identifier. - * @param[in] p_handle Device handle identifying device that is loaded. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - */ -static __INLINE ret_code_t gattsc_context_load(pstorage_handle_t const * p_block_handle, - dm_handle_t const * p_handle) -{ - DM_LOG("[DM]: --> gattsc_context_load\r\n"); - - ret_code_t err_code = gatts_context_load(p_block_handle, p_handle); - - if (NRF_SUCCESS == err_code) - { - err_code = gattc_context_load(p_block_handle, p_handle); - } - - return err_code; -} - - -/**@brief Function for applying when there is no service registered. - * - * @param[in] p_handle Device handle identifying device that is applied. - * - * @retval NRF_SUCCESS - */ -static __INLINE ret_code_t no_service_context_apply(dm_handle_t * p_handle) -{ - DM_LOG("[DM]: --> no_service_context_apply\r\n"); - DM_LOG("[DM]:[CI 0x%02X]: No Service context\r\n", p_handle->connection_id); - - return NRF_SUCCESS; -} - - -/**@brief Function for applying GATT Server context. - * - * @param[in] p_handle Device handle identifying device that is applied. - * - * @retval NRF_SUCCESS On success. - * @retval DM_SERVICE_CONTEXT_NOT_APPLIED On failure. - */ -static __INLINE ret_code_t gatts_context_apply(dm_handle_t * p_handle) -{ - uint32_t err_code; - - uint8_t * p_gatts_context = NULL; - uint16_t context_len = 0; - uint32_t context_flags = 0; - - DM_LOG("[DM]: --> gatts_context_apply\r\n"); - DM_LOG("[DM]:[CI 0x%02X]: State 0x%02X, Size 0x%08X\r\n", - p_handle->connection_id, - m_connection_table[p_handle->connection_id].state, - m_gatts_table[p_handle->connection_id].size); - - if ((m_gatts_table[p_handle->connection_id].size != 0) && - ( - ((m_connection_table[p_handle->connection_id].state & STATE_LINK_ENCRYPTED) == STATE_LINK_ENCRYPTED) && - ((m_connection_table[p_handle->connection_id].state & STATE_BOND_INFO_UPDATE) - != STATE_BOND_INFO_UPDATE) - ) - ) - { - DM_LOG("[DM]: Setting stored context.\r\n"); - - p_gatts_context = &m_gatts_table[p_handle->connection_id].attributes[0]; - context_len = m_gatts_table[p_handle->connection_id].size; - context_flags = m_gatts_table[p_handle->connection_id].flags; - } - - err_code = sd_ble_gatts_sys_attr_set(m_connection_table[p_handle->connection_id].conn_handle, - p_gatts_context, - context_len, - context_flags); - - if (err_code == NRF_ERROR_INVALID_DATA) - { - // Indication that the ATT table has changed. Restore the system attributes to system - // services only and send a service changed indication if possible. - context_flags = BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS; - err_code = sd_ble_gatts_sys_attr_set(m_connection_table[p_handle->connection_id].conn_handle, - p_gatts_context, - context_len, - context_flags); - } - - if (err_code != NRF_SUCCESS) - { - DM_LOG("[DM]: Failed to set system attributes, reason 0x%08X.\r\n", err_code); - - err_code = DM_SERVICE_CONTEXT_NOT_APPLIED; - } - - if (context_flags == BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS) - { - err_code = sd_ble_gatts_service_changed(m_connection_table[p_handle->connection_id].conn_handle, - 0x000C, - 0xFFFF); - if (err_code != NRF_SUCCESS) - { - DM_LOG("[DM]: Failed to send Service Changed indication, reason 0x%08X.\r\n", err_code); - if ((err_code != BLE_ERROR_INVALID_CONN_HANDLE) && - (err_code != NRF_ERROR_INVALID_STATE) && - (err_code != BLE_ERROR_NO_TX_PACKETS) && - (err_code != NRF_ERROR_BUSY)) - { - // Those errors can be expected when sending trying to send Service Changed - // Indication if the CCCD is not set to indicate. Thus set the returning error - // code to success. - err_code = NRF_SUCCESS; - } - else - { - err_code = DM_SERVICE_CONTEXT_NOT_APPLIED; - } - } - } - - return err_code; -} - - -/**@brief Function for applying GATT Client context. - * - * @param[in] p_handle Device handle identifying device that is applied. - * - * @retval NRF_SUCCESS On success. - */ -static __INLINE ret_code_t gattc_context_apply(dm_handle_t * p_handle) -{ - DM_LOG("[DM]: --> gattc_context_apply\r\n"); - - return NRF_SUCCESS; -} - - -/**@brief Function for applying GATT Server & Client context. - * - * @param[in] p_handle Device handle identifying device that is applied. - * - * @retval NRF_SUCCESS On success, else an error code indicating reason for failure. - */ -static __INLINE ret_code_t gattsc_context_apply(dm_handle_t * p_handle) -{ - uint32_t err_code; - - DM_LOG("[DM]: --> gattsc_context_apply\r\n"); - - err_code = gatts_context_apply(p_handle); - - if (err_code == NRF_SUCCESS) - { - err_code = gattc_context_apply(p_handle); - } - - return err_code; -} - - -/**@brief Function for pstorage module callback. - * - * @param[in] p_handle Identifies module and block for which callback is received. - * @param[in] op_code Identifies the operation for which the event is notified. - * @param[in] result Identifies the result of flash access operation. - * NRF_SUCCESS implies, operation succeeded. - * @param[in] p_data Identifies the application data pointer. In case of store operation, this - * points to the resident source of application memory that application can now - * free or reuse. In case of clear, this is NULL as no application pointer is - * needed for this operation. - * @param[in] data_len Length of data provided by the application for the operation. - */ -static void dm_pstorage_cb_handler(pstorage_handle_t * p_handle, - uint8_t op_code, - uint32_t result, - uint8_t * p_data, - uint32_t data_len) -{ - VERIFY_APP_REGISTERED_VOID(0); - - if (data_len > ALL_CONTEXT_SIZE) - { - //Clearing of all bonds at initialization, no event is generated. - return; - } - - DM_MUTEX_LOCK(); - - dm_event_t dm_event; - dm_handle_t dm_handle; - dm_context_t context_data; - pstorage_handle_t block_handle; - uint32_t index_count; - uint32_t err_code; - - bool app_notify = true; - - err_code = dm_handle_initialize(&dm_handle); - APP_ERROR_CHECK(err_code); - - dm_handle.appl_id = 0; - dm_event.event_id = 0x00; - - //Construct the event which it is related to. - - //Initialize context data information and length. - context_data.p_data = p_data; - context_data.len = data_len; - - for (uint32_t index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) - { - err_code = pstorage_block_identifier_get(&m_storage_handle, index, &block_handle); - if ((err_code == NRF_SUCCESS) && - ( - (memcmp(p_handle, &block_handle, sizeof(pstorage_handle_t)) == 0) - ) - ) - { - dm_handle.device_id = index; - break; - } - } - - if (dm_handle.device_id != DM_INVALID_ID) - { - if (op_code == PSTORAGE_CLEAR_OP_CODE) - { - if (data_len == ALL_CONTEXT_SIZE) - { - dm_event.event_id = DM_EVT_DEVICE_CONTEXT_BASE; - } - else - { - dm_event.event_id = DM_EVT_APP_CONTEXT_BASE; - } - } - else - { - //Update or store operation. - //Context is identified based on the pointer value. Device context, application context - //and service context all have their own value range. - index_count = ((uint32_t)(p_data - (uint8_t *)m_peer_table)) / PEER_ID_SIZE; - - if (index_count < DEVICE_MANAGER_MAX_BONDS) - { - dm_event.event_param.p_device_context = &context_data; - - //Only the peer identification is stored, not bond information. Hence do not notify - //the application yet, unless the store operation resulted in a failure. - if ((result == NRF_SUCCESS) && - ( - (update_status_bit_is_set(dm_handle.device_id) == false) - ) - ) - { - app_notify = false; - } - else - { - //Reset update status since update is complete. - update_status_bit_reset(dm_handle.device_id); - - //Notify application of error in storing the context. - dm_event.event_id = DM_EVT_DEVICE_CONTEXT_BASE; - } - } - else - { - index_count = ((uint32_t)(p_data - (uint8_t *)m_bond_table)) / BOND_SIZE; - - if (index_count < DEVICE_MANAGER_MAX_CONNECTIONS) - { - DM_LOG("[DM]:[0x%02X]:[0x%02X]: Bond context Event\r\n", - dm_handle.device_id, - dm_handle.connection_id); - - dm_event.event_param.p_device_context = &context_data; - dm_event.event_id = DM_EVT_DEVICE_CONTEXT_BASE; - dm_handle.connection_id = index_count; - - ble_gap_sec_keyset_t keys_exchanged; - keys_exchanged.keys_peer.p_enc_key = NULL; - keys_exchanged.keys_peer.p_id_key = &m_local_id_info; - keys_exchanged.keys_own.p_enc_key = &m_bond_table[index_count].peer_enc_key; - keys_exchanged.keys_own.p_id_key = &m_peer_table[dm_handle.device_id].peer_id; - - //Context information updated to provide the keys. - context_data.p_data = (uint8_t *)&keys_exchanged; - context_data.len = sizeof(ble_gap_sec_keyset_t); - } - else - { - index_count = ((uint32_t)(p_data - (uint8_t *)m_gatts_table)) / - GATTS_SERVICE_CONTEXT_SIZE; - - if (index_count < DEVICE_MANAGER_MAX_CONNECTIONS) - { - DM_LOG("[DM]:[0x%02X]:[0x%02X]: Service context Event\r\n", - dm_handle.device_id, - dm_handle.connection_id); - - //Notify application. - dm_event.event_id = DM_EVT_SERVICE_CONTEXT_BASE; - dm_handle.connection_id = index_count; - dm_handle.service_id = DM_PROTOCOL_CNTXT_GATT_SRVR_ID; - - //Reset the service context now that it was successfully written to the - //application and the link is disconnected. - if ((m_connection_table[index_count].state & STATE_CONNECTED) != - STATE_CONNECTED) - { - DM_LOG("[DM]:[0x%02X]:[0x%02X]: Resetting bond information for " - "active instance.\r\n", - dm_handle.device_id, - dm_handle.connection_id); - - memset(&m_gatts_table[dm_handle.connection_id], - 0, - sizeof(dm_gatts_context_t)); - } - } - else - { - DM_LOG("[DM]:[0x%02X]:[0x%02X]: App context Event\r\n", - dm_handle.device_id, - dm_handle.connection_id); - - app_notify = false; - dm_event.event_id = DM_EVT_APP_CONTEXT_BASE; -#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) - - if (p_data == (uint8_t *)(&m_context_init_len)) - { - //Context data is deleted. - //This is a workaround to get the right event as on delete operation - //update operation is used instead of clear. - op_code = PSTORAGE_CLEAR_OP_CODE; - app_notify = true; - } - else if (m_app_context_table[dm_handle.device_id] == p_data) - { - app_notify = true; - dm_event.event_param.p_app_context = &context_data; - - //Verify if the device is connected, if yes set connection instance. - for (uint32_t index = 0; - index < DEVICE_MANAGER_MAX_CONNECTIONS; - index++) - { - if (dm_handle.device_id == m_connection_table[index].bonded_dev_id) - { - dm_handle.connection_id = index; - break; - } - } - } - else - { - //No implementation needed. - } -#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE - } - } - } - } - - if (app_notify == true) - { - if (op_code == PSTORAGE_CLEAR_OP_CODE) - { - dm_event.event_id |= DM_CLEAR_OPERATION_ID; - } - else if (op_code == PSTORAGE_LOAD_OP_CODE) - { - dm_event.event_id |= DM_LOAD_OPERATION_ID; - } - else - { - dm_event.event_id |= DM_STORE_OPERATION_ID; - } - - dm_event.event_param.p_app_context = &context_data; - app_evt_notify(&dm_handle, &dm_event, result); - } - } - - DM_MUTEX_UNLOCK(); -} - - -ret_code_t dm_init(dm_init_param_t const * const p_init_param) -{ - pstorage_module_param_t param; - pstorage_handle_t block_handle; - ret_code_t err_code; - uint32_t index; - - DM_LOG("[DM]: >> dm_init.\r\n"); - - NULL_PARAM_CHECK(p_init_param); - - SDK_MUTEX_INIT(m_dm_mutex); - - DM_MUTEX_LOCK(); - - for (index = 0; index < DEVICE_MANAGER_MAX_APPLICATIONS; index++) - { - application_instance_init(index); - } - - for (index = 0; index < DEVICE_MANAGER_MAX_CONNECTIONS; index++) - { - connection_instance_init(index); - } - - memset(m_gatts_table, 0, sizeof(m_gatts_table)); - - //Initialization of all device instances. - for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) - { - peer_instance_init(index); - m_irk_index_table[index] = DM_INVALID_ID; - } - - //All context with respect to a particular device is stored contiguously. - param.block_size = ALL_CONTEXT_SIZE; - param.block_count = DEVICE_MANAGER_MAX_BONDS; - param.cb = dm_pstorage_cb_handler; - - err_code = pstorage_register(¶m, &m_storage_handle); - - if (err_code == NRF_SUCCESS) - { - m_module_initialized = true; - - if (p_init_param->clear_persistent_data == false) - { - DM_LOG("[DM]: Storage handle 0x%08X.\r\n", m_storage_handle.block_id); - - //Copy bonded peer device address and IRK to RAM table. - - //Bonded devices are stored in range (0,DEVICE_MANAGER_MAX_BONDS-1). The remaining - //range is for active connections that may or may not be bonded. - for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) - { - err_code = pstorage_block_identifier_get(&m_storage_handle, index, &block_handle); - - //Issue read request if you successfully get the block identifier. - if (err_code == NRF_SUCCESS) - { - DM_TRC("[DM]:[0x%02X]: Block handle 0x%08X.\r\n", index, block_handle.block_id); - - err_code = pstorage_load((uint8_t *)&m_peer_table[index], - &block_handle, - sizeof(peer_id_t), - 0); - - if (err_code != NRF_SUCCESS) - { - // In case a peer device could not be loaded successfully, rest of the - // initialization procedure are skipped and an error is sent to the - // application. - DM_ERR( - "[DM]: Failed to load peer device %08X from storage, reason %08X.\r\n", - index, - err_code); - - m_module_initialized = false; - break; - } - else - { - DM_TRC("[DM]:[DI 0x%02X]: Device type 0x%02X.\r\n", - index, - m_peer_table[index].peer_id.id_addr_info.addr_type); - DM_TRC("[DM]: Device Addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n", - m_peer_table[index].peer_id.id_addr_info.addr[0], - m_peer_table[index].peer_id.id_addr_info.addr[1], - m_peer_table[index].peer_id.id_addr_info.addr[2], - m_peer_table[index].peer_id.id_addr_info.addr[3], - m_peer_table[index].peer_id.id_addr_info.addr[4], - m_peer_table[index].peer_id.id_addr_info.addr[5]); - } - } - else - { - //In case a peer device could not be loaded successfully, rest of the - //initialization procedure are skipped and an error is sent to the application. - DM_LOG("[DM]: Failed to get block handle for instance %08X, reason %08X.\r\n", - index, - err_code); - - m_module_initialized = false; - break; - } - } - } - else - { - err_code = pstorage_clear(&m_storage_handle, (param.block_size * param.block_count)); - DM_ERR("[DM]: Successfully requested clear of persistent data.\r\n"); - } - } - else - { - DM_ERR("[DM]: Failed to register with storage module, reason 0x%08X.\r\n", err_code); - } - - DM_MUTEX_UNLOCK(); - - DM_TRC("[DM]: << dm_init.\r\n"); - - return err_code; -} - - -ret_code_t dm_register(dm_application_instance_t * p_appl_instance, - dm_application_param_t const * p_appl_param) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_appl_instance); - NULL_PARAM_CHECK(p_appl_param); - NULL_PARAM_CHECK(p_appl_param->evt_handler); - - DM_MUTEX_LOCK(); - - DM_LOG("[DM]: >> dm_register.\r\n"); - - uint32_t err_code; - - //Verify if an application instance is available. Currently only one instance is supported. - if (m_application_table[0].ntf_cb == NULL) - { - DM_LOG("[DM]: Application Instance allocated.\r\n"); - - //Mark instance as allocated. - m_application_table[0].ntf_cb = p_appl_param->evt_handler; - m_application_table[0].sec_param = p_appl_param->sec_param; - m_application_table[0].service = p_appl_param->service_type; - - m_application_table[0].sec_param.kdist_peer.enc = 0; - m_application_table[0].sec_param.kdist_peer.id = 1; - m_application_table[0].sec_param.kdist_peer.sign = 0; - m_application_table[0].sec_param.kdist_own.enc = 1; - m_application_table[0].sec_param.kdist_own.id = 1; - m_application_table[0].sec_param.kdist_own.sign = 0; - //Populate application's instance variable with the assigned allocation instance. - *p_appl_instance = 0; - err_code = NRF_SUCCESS; - } - else - { - err_code = (NRF_ERROR_NO_MEM | DEVICE_MANAGER_ERR_BASE); - } - - DM_MUTEX_UNLOCK(); - - DM_TRC("[DM]: << dm_register.\r\n"); - - return err_code; -} - - -ret_code_t dm_security_setup_req(dm_handle_t * p_handle) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_CONNECTION_INSTANCE(p_handle->connection_id); - - DM_MUTEX_LOCK(); - - DM_LOG("[DM]: >> dm_security_setup_req\r\n"); - - uint32_t err_code = (NRF_ERROR_INVALID_STATE | DEVICE_MANAGER_ERR_BASE); - - if ((m_connection_table[p_handle->connection_id].state & STATE_CONNECTED) == STATE_CONNECTED) - { - err_code = sd_ble_gap_authenticate(m_connection_table[p_handle->connection_id].conn_handle, - &m_application_table[0].sec_param); - } - - DM_TRC("[DM]: << dm_security_setup_req, 0x%08X\r\n", err_code); - - DM_MUTEX_UNLOCK(); - - return err_code; -} - - -ret_code_t dm_security_status_req(dm_handle_t const * p_handle, - dm_security_status_t * p_status) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_status); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_CONNECTION_INSTANCE(p_handle->connection_id); - - DM_MUTEX_LOCK(); - - DM_LOG("[DM]: >> dm_security_status_req\r\n"); - - if ((m_connection_table[p_handle->connection_id].state & STATE_PAIRING) || - (m_connection_table[p_handle->connection_id].state & STATE_PAIRING_PENDING)) - { - (*p_status) = ENCRYPTION_IN_PROGRESS; - } - else if (m_connection_table[p_handle->connection_id].state & STATE_LINK_ENCRYPTED) - { - (*p_status) = ENCRYPTED; - } - else - { - (*p_status) = NOT_ENCRYPTED; - } - - DM_TRC("[DM]: << dm_security_status_req\r\n"); - - DM_MUTEX_UNLOCK(); - - return NRF_SUCCESS; -} - - -ret_code_t dm_whitelist_create(dm_application_instance_t const * p_handle, - ble_gap_whitelist_t * p_whitelist) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_whitelist); - NULL_PARAM_CHECK(p_whitelist->pp_addrs); - NULL_PARAM_CHECK(p_whitelist->pp_irks); - VERIFY_APP_REGISTERED(*p_handle); - - DM_MUTEX_LOCK(); - - DM_LOG("[DM]: >> dm_whitelist_create\r\n"); - - uint32_t addr_count = 0; - uint32_t irk_count = 0; - bool connected = false; - - for (uint32_t index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) - { - connected = false; - - for (uint32_t c_index = 0; c_index < DEVICE_MANAGER_MAX_CONNECTIONS; c_index++) - { - if ((index == m_connection_table[c_index].bonded_dev_id) && - ((m_connection_table[c_index].state & STATE_CONNECTED) == STATE_CONNECTED)) - { - connected = true; - break; - } - } - - if (connected == false) - { - if ((irk_count < p_whitelist->irk_count) && - ((m_peer_table[index].id_bitmap & IRK_ENTRY) == 0)) - { - p_whitelist->pp_irks[irk_count] = &m_peer_table[index].peer_id.id_info; - m_irk_index_table[irk_count] = index; - irk_count++; - } - - if ((addr_count < p_whitelist->addr_count) && - (m_peer_table[index].id_bitmap & ADDR_ENTRY) == 0) - { - p_whitelist->pp_addrs[addr_count] = &m_peer_table[index].peer_id.id_addr_info; - addr_count++; - } - } - } - - p_whitelist->addr_count = addr_count; - p_whitelist->irk_count = irk_count; - - DM_LOG("[DM]: Created whitelist, number of IRK = 0x%02X, number of addr = 0x%02X\r\n", - irk_count, - addr_count); - - DM_TRC("[DM]: << dm_whitelist_create\r\n"); - - DM_MUTEX_UNLOCK(); - - return NRF_SUCCESS; -} - - -ret_code_t dm_device_add(dm_handle_t * p_handle, - dm_device_context_t const * p_context) -{ - return (API_NOT_IMPLEMENTED | DEVICE_MANAGER_ERR_BASE); -} - - -ret_code_t dm_device_delete(dm_handle_t const * p_handle) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_device_delete\r\n"); - - uint32_t err_code = device_instance_free(p_handle->device_id); - - DM_TRC("[DM]: << dm_device_delete\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; -} - - -ret_code_t dm_device_delete_all(dm_application_instance_t const * p_handle) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - VERIFY_APP_REGISTERED((*p_handle)); - - DM_MUTEX_LOCK(); - - uint32_t err_code = NRF_SUCCESS; - - DM_TRC("[DM]: >> dm_device_delete_all\r\n"); - - for (uint32_t index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++) - { - if (m_peer_table[index].id_bitmap != UNASSIGNED) - { - err_code = device_instance_free(index); - } - } - - DM_TRC("[DM]: << dm_device_delete_all\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; -} - - -ret_code_t dm_service_context_set(dm_handle_t const * p_handle, - dm_service_context_t const * p_context) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_context); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_CONNECTION_INSTANCE(p_handle->connection_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_service_context_set\r\n"); - - if ((p_context->context_data.p_data != NULL) && - ( - (p_context->context_data.len != 0) && - (p_context->context_data.len < DM_GATT_SERVER_ATTR_MAX_SIZE) - ) - ) - { - if (p_context->service_type == DM_PROTOCOL_CNTXT_GATT_SRVR_ID) - { - memcpy(m_gatts_table[p_handle->connection_id].attributes, - p_context->context_data.p_data, - p_context->context_data.len); - } - } - - pstorage_handle_t block_handle; - uint32_t err_code = pstorage_block_identifier_get(&m_storage_handle, - p_handle->device_id, - &block_handle); - - err_code = m_service_context_store[p_context->service_type](&block_handle, p_handle); - - DM_TRC("[DM]: << dm_service_context_set\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; -} - - -ret_code_t dm_service_context_get(dm_handle_t const * p_handle, - dm_service_context_t * p_context) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_context); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - - if ((m_connection_table[p_handle->connection_id].state & STATE_CONNECTED) != STATE_CONNECTED) - { - DM_TRC("[DM]: Device must be connected to get context. \r\n"); - - return (FEATURE_NOT_ENABLED | DEVICE_MANAGER_ERR_BASE); - } - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_service_context_get\r\n"); - - if (p_context->service_type == DM_PROTOCOL_CNTXT_GATT_SRVR_ID) - { - p_context->context_data.p_data = m_gatts_table[p_handle->connection_id].attributes; - p_context->context_data.len = m_gatts_table[p_handle->connection_id].size; - } - - pstorage_handle_t block_handle; - uint32_t err_code = pstorage_block_identifier_get(&m_storage_handle, - p_handle->device_id, - &block_handle); - - err_code = m_service_context_load[p_context->service_type](&block_handle, p_handle); - - if (p_context->service_type == DM_PROTOCOL_CNTXT_GATT_SRVR_ID) - { - p_context->context_data.p_data = m_gatts_table[p_handle->connection_id].attributes; - p_context->context_data.len = m_gatts_table[p_handle->connection_id].size; - } - - DM_TRC("[DM]: << dm_service_context_get\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; -} - - -ret_code_t dm_service_context_delete(dm_handle_t const * p_handle) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - - DM_LOG("[DM]: Context delete is not supported yet.\r\n"); - - return (API_NOT_IMPLEMENTED | DEVICE_MANAGER_ERR_BASE); -} - - -ret_code_t dm_application_context_set(dm_handle_t const * p_handle, - dm_application_context_t const * p_context) -{ -#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_context); - NULL_PARAM_CHECK(p_context->p_data); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - VERIFY_DEVICE_BOND(p_handle->connection_id); - SIZE_CHECK_APP_CONTEXT(p_context->len); - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_application_context_set\r\n"); - - uint32_t err_code; - uint32_t context_len; - pstorage_handle_t block_handle; - - storage_operation store_fn = pstorage_store; - - err_code = pstorage_block_identifier_get(&m_storage_handle, - p_handle->device_id, - &block_handle); - - if (err_code == NRF_SUCCESS) - { - err_code = pstorage_load((uint8_t *)&context_len, - &block_handle, - sizeof(uint32_t), - APP_CONTEXT_STORAGE_OFFSET); - - if ((err_code == NRF_SUCCESS) && (context_len != INVALID_CONTEXT_LEN)) - { - //Data already exists. Need an update. - store_fn = pstorage_update; - - DM_LOG("[DM]:[DI 0x%02X]: Updating existing application context, existing len 0x%08X, " - "new length 0x%08X.\r\n", - p_handle->device_id, - context_len, - p_context->len); - } - else - { - DM_LOG("[DM]: Storing application context.\r\n"); - } - - //Store/update context length. - err_code = store_fn(&block_handle, - (uint8_t *)(&p_context->len), - sizeof(uint32_t), - APP_CONTEXT_STORAGE_OFFSET); - - if (err_code == NRF_SUCCESS) - { - //Update context data is used for application context as flash is never - //cleared if a delete of application context is called. - err_code = pstorage_update(&block_handle, - p_context->p_data, - DEVICE_MANAGER_APP_CONTEXT_SIZE, - (APP_CONTEXT_STORAGE_OFFSET + sizeof(uint32_t))); - if (err_code == NRF_SUCCESS) - { - m_app_context_table[p_handle->device_id] = p_context->p_data; - } - } - } - - DM_TRC("[DM]: << dm_application_context_set\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; - -#else //DEVICE_MANAGER_APP_CONTEXT_SIZE - return (FEATURE_NOT_ENABLED | DEVICE_MANAGER_ERR_BASE); -#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE -} - - -ret_code_t dm_application_context_get(dm_handle_t const * p_handle, - dm_application_context_t * p_context) -{ -#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_context); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_application_context_get\r\n"); - - uint32_t context_len; - uint32_t err_code; - pstorage_handle_t block_handle; - - //Check if the context exists. - if (NULL == p_context->p_data) - { - p_context->p_data = m_app_context_table[p_handle->device_id]; - } - else - { - m_app_context_table[p_handle->device_id] = p_context->p_data; - } - - err_code = pstorage_block_identifier_get(&m_storage_handle, - p_handle->device_id, - &block_handle); - - if (err_code == NRF_SUCCESS) - { - err_code = pstorage_load((uint8_t *)&context_len, - &block_handle, - sizeof(uint32_t), - APP_CONTEXT_STORAGE_OFFSET); - - if ((err_code == NRF_SUCCESS) && (context_len != INVALID_CONTEXT_LEN)) - { - err_code = pstorage_load(p_context->p_data, - &block_handle, - DEVICE_MANAGER_APP_CONTEXT_SIZE, - (APP_CONTEXT_STORAGE_OFFSET + sizeof(uint32_t))); - if (err_code == NRF_SUCCESS) - { - p_context->len = context_len; - } - } - else - { - err_code = DM_NO_APP_CONTEXT; - } - } - - DM_TRC("[DM]: << dm_application_context_get\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; - -#else //DEVICE_MANAGER_APP_CONTEXT_SIZE - return (FEATURE_NOT_ENABLED | DEVICE_MANAGER_ERR_BASE); -#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE -} - - -ret_code_t dm_application_context_delete(const dm_handle_t * p_handle) -{ -#if (DEVICE_MANAGER_APP_CONTEXT_SIZE != 0) - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_application_context_delete\r\n"); - - uint32_t err_code; - uint32_t context_len; - pstorage_handle_t block_handle; - - err_code = pstorage_block_identifier_get(&m_storage_handle, - p_handle->device_id, - &block_handle); - - if (err_code == NRF_SUCCESS) - { - err_code = pstorage_load((uint8_t *)&context_len, - &block_handle, - sizeof(uint32_t), - APP_CONTEXT_STORAGE_OFFSET); - - if (context_len != m_context_init_len) - { - err_code = pstorage_update(&block_handle, - (uint8_t *)&m_context_init_len, - sizeof(uint32_t), - APP_CONTEXT_STORAGE_OFFSET); - - if (err_code != NRF_SUCCESS) - { - DM_ERR("[DM]: Failed to delete application context, reason 0x%08X\r\n", err_code); - } - else - { - m_app_context_table[p_handle->device_id] = NULL; - } - } - } - - DM_TRC("[DM]: << dm_application_context_delete\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; -#else //DEVICE_MANAGER_APP_CONTEXT_SIZE - return (FEATURE_NOT_ENABLED | DEVICE_MANAGER_ERR_BASE); -#endif //DEVICE_MANAGER_APP_CONTEXT_SIZE -} - - -ret_code_t dm_application_instance_set(dm_application_instance_t const * p_appl_instance, - dm_handle_t * p_handle) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_appl_instance); - VERIFY_APP_REGISTERED((*p_appl_instance)); - - p_handle->appl_id = (*p_appl_instance); - - return NRF_SUCCESS; -} - - -uint32_t dm_handle_initialize(dm_handle_t * p_handle) -{ - NULL_PARAM_CHECK(p_handle); - - p_handle->appl_id = DM_INVALID_ID; - p_handle->connection_id = DM_INVALID_ID; - p_handle->device_id = DM_INVALID_ID; - p_handle->service_id = DM_INVALID_ID; - - return NRF_SUCCESS; -} - - -ret_code_t dm_peer_addr_set(dm_handle_t const * p_handle, - ble_gap_addr_t const * p_addr) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_addr); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_peer_addr_set\r\n"); - - ret_code_t err_code; - - if ((p_handle->connection_id == DM_INVALID_ID) && - (p_addr->addr_type != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE)) - { - m_peer_table[p_handle->device_id].peer_id.id_addr_info = (*p_addr); - update_status_bit_set(p_handle->device_id); - device_context_store(p_handle, UPDATE_PEER_ADDR); - err_code = NRF_SUCCESS; - } - else - { - err_code = (NRF_ERROR_INVALID_PARAM | DEVICE_MANAGER_ERR_BASE); - } - - DM_TRC("[DM]: << dm_peer_addr_set\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; -} - - -ret_code_t dm_peer_addr_get(dm_handle_t const * p_handle, - ble_gap_addr_t * p_addr) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_addr); - VERIFY_APP_REGISTERED(p_handle->appl_id); - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_peer_addr_get\r\n"); - - ret_code_t err_code; - - err_code = (NRF_ERROR_NOT_FOUND | DEVICE_MANAGER_ERR_BASE); - - if (p_handle->device_id == DM_INVALID_ID) - { - if ((p_handle->connection_id != DM_INVALID_ID) && - ((m_connection_table[p_handle->connection_id].state & STATE_CONNECTED) == - STATE_CONNECTED)) - { - DM_TRC("[DM]:[CI 0x%02X]: Address get for non bonded active connection.\r\n", - p_handle->connection_id); - - (*p_addr) = m_connection_table[p_handle->connection_id].peer_addr; - err_code = NRF_SUCCESS; - } - } - else - { - if ((m_peer_table[p_handle->device_id].id_bitmap & ADDR_ENTRY) == 0) - { - DM_TRC("[DM]:[DI 0x%02X]: Address get for bonded device.\r\n", - p_handle->device_id); - - (*p_addr) = m_peer_table[p_handle->device_id].peer_id.id_addr_info; - err_code = NRF_SUCCESS; - } - } - - DM_TRC("[DM]: << dm_peer_addr_get\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; -} - - -ret_code_t dm_distributed_keys_get(dm_handle_t const * p_handle, - dm_sec_keyset_t * p_key_dist) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_handle); - NULL_PARAM_CHECK(p_key_dist); - VERIFY_APP_REGISTERED(p_handle->appl_id); - VERIFY_DEVICE_INSTANCE(p_handle->device_id); - - DM_MUTEX_LOCK(); - - DM_TRC("[DM]: >> dm_distributed_keys_get\r\n"); - - ret_code_t err_code; - ble_gap_enc_key_t peer_enc_key; - pstorage_handle_t block_handle; - - err_code = NRF_ERROR_NOT_FOUND; - p_key_dist->keys_central.enc_key.p_enc_key = NULL; - p_key_dist->keys_central.p_id_key = (dm_id_key_t *)&m_peer_table[p_handle->device_id].peer_id; - p_key_dist->keys_central.p_sign_key = NULL; - p_key_dist->keys_periph.p_id_key = (dm_id_key_t *)&m_local_id_info; - p_key_dist->keys_periph.p_sign_key = NULL; - p_key_dist->keys_periph.enc_key.p_enc_key = (dm_enc_key_t *)&peer_enc_key; - - if ((m_peer_table[p_handle->device_id].id_bitmap & IRK_ENTRY) == 0) - { -// p_key_dist->keys_periph.p_id_key->id_addr_info.addr_type = INVALID_ADDR_TYPE; - } - - err_code = pstorage_block_identifier_get(&m_storage_handle, p_handle->device_id, &block_handle); - if (err_code == NRF_SUCCESS) - { - - err_code = pstorage_load((uint8_t *)&peer_enc_key, - &block_handle, - BOND_SIZE, - BOND_STORAGE_OFFSET); - - if (err_code == NRF_SUCCESS) - { - p_key_dist->keys_central.enc_key.p_enc_key = NULL; - p_key_dist->keys_central.p_id_key = (dm_id_key_t *)&m_peer_table[p_handle->device_id].peer_id; - p_key_dist->keys_central.p_sign_key = NULL; - p_key_dist->keys_periph.p_id_key = (dm_id_key_t *)&m_local_id_info; - p_key_dist->keys_periph.p_sign_key = NULL; - p_key_dist->keys_periph.enc_key.p_enc_key = (dm_enc_key_t *)&peer_enc_key; - } - } - - DM_TRC("[DM]: << dm_distributed_keys_get\r\n"); - - DM_MUTEX_UNLOCK(); - - return err_code; -} - - -/**@brief Function for loading bond information for a connection instance. - */ -void bond_data_load(dm_handle_t * p_handle) -{ - pstorage_handle_t block_handle; - - uint32_t err_code = pstorage_block_identifier_get(&m_storage_handle, - p_handle->device_id, - &block_handle); - if (err_code == NRF_SUCCESS) - { - DM_LOG( - "[DM]:[%02X]:[Block ID 0x%08X]:Loading bond information at %p, size 0x%08X, offset 0x%08X.\r\n", - p_handle->connection_id, - block_handle.block_id, - &m_bond_table[p_handle->connection_id], - BOND_SIZE, - BOND_STORAGE_OFFSET); - - err_code = pstorage_load((uint8_t *)&m_bond_table[p_handle->connection_id], - &block_handle, - BOND_SIZE, - BOND_STORAGE_OFFSET); - - if (err_code != NRF_SUCCESS) - { - DM_ERR("[DM]:[%02X]: Failed to load Bond information, reason %08X\r\n", - p_handle->connection_id, - err_code); - } - - DM_LOG( - "[DM]:[%02X]:Loading service context at %p, size 0x%08X, offset 0x%08X.\r\n", - p_handle->connection_id, - &m_gatts_table[p_handle->connection_id], - sizeof(dm_gatts_context_t), - SERVICE_STORAGE_OFFSET); - - err_code = m_service_context_load[m_application_table[0].service]( - &block_handle, - p_handle); - - if (err_code != NRF_SUCCESS) - { - DM_ERR( - "[DM]:[%02X]: Failed to load service information, reason %08X\r\n", - p_handle->connection_id, - err_code); - } - } - else - { - DM_ERR("[DM]:[%02X]: Failed to get block identifier for " - "device %08X, reason %08X.\r\n", p_handle->connection_id, p_handle->device_id, err_code); - } -} - - -void dm_ble_evt_handler(ble_evt_t * p_ble_evt) -{ - uint32_t err_code; - uint32_t index; - uint32_t device_index = DM_INVALID_ID; - bool notify_app = false; - dm_handle_t handle; - dm_event_t event; - uint32_t event_result; - ble_gap_enc_info_t * p_enc_info = NULL; - - VERIFY_MODULE_INITIALIZED_VOID(); - VERIFY_APP_REGISTERED_VOID(0); - DM_MUTEX_LOCK(); - - err_code = dm_handle_initialize(&handle); - APP_ERROR_CHECK(err_code); - - event_result = NRF_SUCCESS; - err_code = NRF_SUCCESS; - event.event_param.p_gap_param = &p_ble_evt->evt.gap_evt; - event.event_paramlen = sizeof(ble_gap_evt_t); - handle.device_id = DM_INVALID_ID; - handle.appl_id = 0; - index = 0x00; - - if (p_ble_evt->header.evt_id != BLE_GAP_EVT_CONNECTED) - { - err_code = connection_instance_find(p_ble_evt->evt.gap_evt.conn_handle, - STATE_CONNECTED, - &index); - - if (err_code == NRF_SUCCESS) - { - handle.device_id = m_connection_table[index].bonded_dev_id; - handle.connection_id = index; - } - } - - switch (p_ble_evt->header.evt_id) - { - case BLE_GAP_EVT_CONNECTED: - //Allocate connection instance for a new connection. - err_code = connection_instance_allocate(&index); - - //Connection instance is successfully allocated. - if (err_code == NRF_SUCCESS) - { - //Application notification related information. - notify_app = true; - event.event_id = DM_EVT_CONNECTION; - handle.connection_id = index; - - m_connection_table[index].conn_handle = p_ble_evt->evt.gap_evt.conn_handle; - m_connection_table[index].state = STATE_CONNECTED; - m_connection_table[index].peer_addr = - p_ble_evt->evt.gap_evt.params.connected.peer_addr; - - if (p_ble_evt->evt.gap_evt.params.connected.irk_match == 1) - { - if (m_irk_index_table[p_ble_evt->evt.gap_evt.params.connected.irk_match_idx] != DM_INVALID_ID) - { - device_index = m_irk_index_table[p_ble_evt->evt.gap_evt.params.connected.irk_match_idx]; - err_code = NRF_SUCCESS; - } - } - else - { - //Use the device address to check if the device exists in the bonded device list. - err_code = device_instance_find(&p_ble_evt->evt.gap_evt.params.connected.peer_addr, - &device_index, EDIV_INIT_VAL); - } - - if (err_code == NRF_SUCCESS) - { - m_connection_table[index].bonded_dev_id = device_index; - m_connection_table[index].state |= STATE_BONDED; - handle.device_id = device_index; - - bond_data_load(&handle); - } - } - break; - - case BLE_GAP_EVT_DISCONNECTED: - //Disconnection could be peer or self initiated hence disconnecting and connecting - //both states are permitted, however, connection handle must be known. - DM_LOG("[DM]: Disconnect Reason 0x%04X\r\n", - p_ble_evt->evt.gap_evt.params.disconnected.reason); - - m_connection_table[index].state &= (~STATE_CONNECTED); - - if ((m_connection_table[index].state & STATE_BONDED) == STATE_BONDED) - { - if ((m_connection_table[index].state & STATE_LINK_ENCRYPTED) == STATE_LINK_ENCRYPTED) - { - //Write bond information persistently. - device_context_store(&handle, STORE_ALL_CONTEXT); - } - } - else - { - //Free any allocated instances for devices that is not bonded. - if (handle.device_id != DM_INVALID_ID) - { - peer_instance_init(handle.device_id); - handle.device_id = DM_INVALID_ID; - } - } - - m_connection_table[index].state = STATE_DISCONNECTING; - notify_app = true; - event.event_id = DM_EVT_DISCONNECTION; - - break; - - case BLE_GAP_EVT_SEC_INFO_REQUEST: - DM_LOG("[DM]: >> BLE_GAP_EVT_SEC_INFO_REQUEST\r\n"); - - //If the device is already bonded, respond with existing info, else NULL. - if (m_connection_table[index].bonded_dev_id == DM_INVALID_ID) - { - //Find device based on div. - err_code = device_instance_find(NULL,&device_index, p_ble_evt->evt.gap_evt.params.sec_info_request.master_id.ediv); - if (err_code == NRF_SUCCESS) - { - //Load needed bonding information. - m_connection_table[index].bonded_dev_id = device_index; - m_connection_table[index].state |= STATE_BONDED; - handle.device_id = device_index; - bond_data_load(&handle); - } - } - - if (m_connection_table[index].bonded_dev_id != DM_INVALID_ID) - { - p_enc_info = &m_bond_table[index].peer_enc_key.enc_info; - DM_DUMP((uint8_t *)p_enc_info, sizeof(ble_gap_enc_info_t)); - } - - err_code = sd_ble_gap_sec_info_reply(p_ble_evt->evt.gap_evt.conn_handle, - p_enc_info, - &m_peer_table[index].peer_id.id_info, - NULL); - - if (err_code != NRF_SUCCESS) - { - DM_ERR("[DM]:[CI %02X]:[DI %02X]: Security information response failed, reason " - "0x%08X\r\n", index, m_connection_table[index].bonded_dev_id, err_code); - } - break; - - case BLE_GAP_EVT_SEC_PARAMS_REQUEST: - DM_LOG("[DM]: >> BLE_GAP_EVT_SEC_PARAMS_REQUEST\r\n"); - - event.event_id = DM_EVT_SECURITY_SETUP; - - m_connection_table[index].state |= STATE_PAIRING; - notify_app = true; - - if (m_connection_table[index].bonded_dev_id == DM_INVALID_ID) - { - //Assign a peer index as a new bond or update existing bonds. - err_code = device_instance_allocate((uint8_t *)&device_index, - &m_connection_table[index].peer_addr); - - //Allocation successful. - if (err_code == NRF_SUCCESS) - { - DM_LOG("[DM]:[CI 0x%02X]:[DI 0x%02X]: Bonded!\r\n",index, device_index); - - handle.device_id = device_index; - m_connection_table[index].bonded_dev_id = device_index; - } - else - { - DM_LOG("[DM]: Security parameter request failed, reason 0x%08X.\r\n", err_code); - event_result = err_code; - notify_app = true; - } - - ble_gap_sec_keyset_t keys_exchanged; - - DM_LOG("[DM]: 0x%02X, 0x%02X, 0x%02X, 0x%02X\r\n", - p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_peer.enc, - p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_own.id, - p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_peer.sign, - p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.bond); - - keys_exchanged.keys_peer.p_enc_key = NULL; - keys_exchanged.keys_peer.p_id_key = &m_peer_table[m_connection_table[index].bonded_dev_id].peer_id; - keys_exchanged.keys_peer.p_sign_key = NULL; - keys_exchanged.keys_peer.p_pk = NULL; - keys_exchanged.keys_own.p_enc_key = &m_bond_table[index].peer_enc_key; - keys_exchanged.keys_own.p_id_key = NULL; - keys_exchanged.keys_own.p_sign_key = NULL; - keys_exchanged.keys_own.p_pk = NULL; - - err_code = sd_ble_gap_sec_params_reply(p_ble_evt->evt.gap_evt.conn_handle, - BLE_GAP_SEC_STATUS_SUCCESS, - &m_application_table[0].sec_param, - &keys_exchanged); - - if (err_code != NRF_SUCCESS) - { - DM_LOG("[DM]: Security parameter reply request failed, reason 0x%08X.\r\n", err_code); - event_result = err_code; - notify_app = false; - } - - } - else - { - //Bond/key refresh. - DM_LOG("[DM]: !!! Bond/key refresh !!!\r\n"); - //Set the update flag for bond data. - m_connection_table[index].state |= STATE_BOND_INFO_UPDATE; - event.event_id = DM_EVT_SECURITY_SETUP_REFRESH; - - err_code = sd_ble_gap_sec_params_reply(p_ble_evt->evt.gap_evt.conn_handle, - BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, - NULL, - NULL); - - if (err_code != NRF_SUCCESS) - { - DM_LOG("[DM]: Security parameter reply request failed, reason 0x%08X.\r\n", err_code); - event_result = err_code; - notify_app = false; - } - - } - break; - - case BLE_GAP_EVT_AUTH_STATUS: - { - DM_LOG("[DM]: >> BLE_GAP_EVT_AUTH_STATUS, status %08X\r\n", - p_ble_evt->evt.gap_evt.params.auth_status.auth_status); - - m_application_table[0].state &= (~STATE_CONTROL_PROCEDURE_IN_PROGRESS); - m_connection_table[index].state &= (~STATE_PAIRING); - event.event_id = DM_EVT_SECURITY_SETUP_COMPLETE; - notify_app = true; - - if (p_ble_evt->evt.gap_evt.params.auth_status.auth_status != BLE_GAP_SEC_STATUS_SUCCESS) - { - // In case of key refresh attempt, since this behavior is now rejected, we don't do anything here - if ((m_connection_table[index].state & STATE_BOND_INFO_UPDATE) - != STATE_BOND_INFO_UPDATE) - { - // Free the allocation as bonding failed. - ret_code_t result = device_instance_free(m_connection_table[index].bonded_dev_id); - (void) result; - event_result = p_ble_evt->evt.gap_evt.params.auth_status.auth_status; - } - } - else - { - DM_DUMP((uint8_t *)&p_ble_evt->evt.gap_evt.params.auth_status, - sizeof(ble_gap_evt_auth_status_t)); - DM_DUMP((uint8_t *)&m_bond_table[index], sizeof(bond_context_t)); - - if (p_ble_evt->evt.gap_evt.params.auth_status.bonded == 1) - { - if (handle.device_id != DM_INVALID_ID) - { - m_connection_table[index].state |= STATE_BONDED; - - //IRK and/or public address is shared, update it. - if (p_ble_evt->evt.gap_evt.params.auth_status.kdist_peer.id == 1) - { - m_peer_table[handle.device_id].id_bitmap &= (~IRK_ENTRY); - } - - if (m_connection_table[index].bonded_dev_id != DM_INVALID_ID) - { - DM_LOG("[DM]:[CI 0x%02X]:[DI 0x%02X]: Bonded!\r\n", - index, - handle.device_id); - - if (m_connection_table[index].peer_addr.addr_type != - BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE) - { - m_peer_table[handle.device_id].peer_id.id_addr_info = - m_connection_table[index].peer_addr; - m_peer_table[handle.device_id].id_bitmap &= (~ADDR_ENTRY); - - DM_DUMP((uint8_t *)&m_peer_table[handle.device_id].peer_id.id_addr_info, - sizeof(m_peer_table[handle.device_id].peer_id.id_addr_info)); - } - else - { - // Here we must fetch the keys from the keyset distributed. - m_peer_table[handle.device_id].ediv = m_bond_table[index].peer_enc_key.master_id.ediv; - m_peer_table[handle.device_id].id_bitmap &= (~IRK_ENTRY); - } - - device_context_store(&handle, FIRST_BOND_STORE); - } - } - } - else - { - //Pairing request, no need to touch the bonding info. - } - } - break; - } - - case BLE_GAP_EVT_CONN_SEC_UPDATE: - DM_LOG("[DM]: >> BLE_GAP_EVT_CONN_SEC_UPDATE, Mode 0x%02X, Level 0x%02X\r\n", - p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm, - p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv); - - if ((p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv == 1) && - (p_ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm == 1) && - ((m_connection_table[index].state & STATE_BONDED) == STATE_BONDED)) - { - //Lost bond case, generate a security refresh event! - memset(m_gatts_table[index].attributes, 0, DM_GATT_SERVER_ATTR_MAX_SIZE); - - event.event_id = DM_EVT_SECURITY_SETUP_REFRESH; - m_connection_table[index].state |= STATE_PAIRING_PENDING; - m_connection_table[index].state |= STATE_BOND_INFO_UPDATE; - m_application_table[0].state |= STATE_QUEUED_CONTROL_REQUEST; - } - else - { - m_connection_table[index].state |= STATE_LINK_ENCRYPTED; - event.event_id = DM_EVT_LINK_SECURED; - - //Apply service context. - err_code = m_service_context_apply[m_application_table[0].service](&handle); - - if (err_code != NRF_SUCCESS) - { - DM_ERR("[DM]:[CI 0x%02X]:[DI 0x%02X]: Failed to apply service context\r\n", - handle.connection_id, - handle.device_id); - - event_result = DM_SERVICE_CONTEXT_NOT_APPLIED; - } - } - event_result = NRF_SUCCESS; - notify_app = true; - - break; - - case BLE_GATTS_EVT_SYS_ATTR_MISSING: - DM_LOG("[DM]: >> BLE_GATTS_EVT_SYS_ATTR_MISSING\r\n"); - - //Apply service context. - event_result = m_service_context_apply[m_application_table[0].service](&handle); - break; - - case BLE_GAP_EVT_SEC_REQUEST: - DM_LOG("[DM]: >> BLE_GAP_EVT_SEC_REQUEST\r\n"); - - //Verify if the device is already bonded, and if it is bonded, initiate encryption. - //If the device is not bonded, an instance needs to be allocated in order to initiate - //bonding. The application have to initiate the procedure, the module will not do this - //automatically. - event.event_id = DM_EVT_SECURITY_SETUP; - notify_app = true; - - break; - - default: - break; - } - - if (notify_app) - { - app_evt_notify(&handle, &event, event_result); - - //Freeing the instance after the event is notified so the application can get the context. - if (event.event_id == DM_EVT_DISCONNECTION) - { - //Free the instance. - connection_instance_free(&index); - } - } - - UNUSED_VARIABLE(err_code); - - DM_MUTEX_UNLOCK(); -} - - -ret_code_t dm_handle_get(uint16_t conn_handle, dm_handle_t * p_handle) -{ - ret_code_t err_code; - uint32_t index; - - NULL_PARAM_CHECK(p_handle); - VERIFY_APP_REGISTERED(p_handle->appl_id); - - p_handle->device_id = DM_INVALID_ID; - - err_code = NRF_ERROR_NOT_FOUND; - - for (index = 0; index < DEVICE_MANAGER_MAX_CONNECTIONS; index++) - { - //Search for matching connection handle. - if (conn_handle == m_connection_table[index].conn_handle) - { - p_handle->connection_id = index; - p_handle->device_id = m_connection_table[index].bonded_dev_id; - - err_code = NRF_SUCCESS; - break; - } - } - return err_code; -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.c index ef09362c4c..ba19efadd3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.c @@ -36,47 +36,58 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "gatt_cache_manager.h" -#include "nrf_ble_gap.h" +#include "ble_gap.h" #include "ble_conn_state.h" #include "peer_manager_types.h" #include "peer_manager_internal.h" -#include "peer_database.h" #include "id_manager.h" #include "security_dispatcher.h" #include "gatts_cache_manager.h" -#include "gattc_cache_manager.h" -#include "sdk_common.h" -/**@brief Structure containing the module variable(s) of the GCM module. - */ -typedef struct + +// The number of registered event handlers. +#define GCM_EVENT_HANDLERS_CNT (sizeof(m_evt_handlers) / sizeof(m_evt_handlers[0])) + +// GATT Cache Manager event handler in Peer Manager. +extern void pm_gcm_evt_handler(gcm_evt_t const * p_gcm_evt); + +// GATT Cache Manager events' handlers. +// The number of elements in this array is GCM_EVENT_HANDLERS_CNT. +static gcm_evt_handler_t m_evt_handlers[] = { - gcm_evt_handler_t evt_handler; /**< The event handler to use for outbound GSCM events. */ - ble_conn_state_user_flag_id_t flag_id_local_db_update_pending; /**< Flag ID for flag collection to keep track of which connections need a local DB update procedure. */ - ble_conn_state_user_flag_id_t flag_id_local_db_apply_pending; /**< Flag ID for flag collection to keep track of which connections need a local DB apply procedure. */ - ble_conn_state_user_flag_id_t flag_id_service_changed_pending; /**< Flag ID for flag collection to keep track of which connections need to be sent a service changed indication. */ - ble_conn_state_user_flag_id_t flag_id_service_changed_sent; /**< Flag ID for flag collection to keep track of which connections have been sent a service changed indication and are waiting for a handle value confirmation. */ -} gcm_t; + pm_gcm_evt_handler +}; -static gcm_t m_gcm; /**< Instantiation of module variable(s). */ - -#define MODULE_INITIALIZED (m_gcm.evt_handler != NULL) -#include "sdk_macros.h" +static bool m_module_initialized; +static ble_conn_state_user_flag_id_t m_flag_local_db_update_pending; /**< Flag ID for flag collection to keep track of which connections need a local DB update procedure. */ +static ble_conn_state_user_flag_id_t m_flag_local_db_apply_pending; /**< Flag ID for flag collection to keep track of which connections need a local DB apply procedure. */ +static ble_conn_state_user_flag_id_t m_flag_service_changed_pending; /**< Flag ID for flag collection to keep track of which connections need to be sent a service changed indication. */ +static ble_conn_state_user_flag_id_t m_flag_service_changed_sent; /**< Flag ID for flag collection to keep track of which connections have been sent a service changed indication and are waiting for a handle value confirmation. */ static void service_changed_pending_flags_check(void); + /**@brief Function for resetting the module variable(s) of the GSCM module. * * @param[out] The instance to reset. */ -static void internal_state_reset(gcm_t * p_gcm) +static void internal_state_reset() { - memset(p_gcm, 0, sizeof(gcm_t)); + m_module_initialized = false; +} + + +static void evt_send(gcm_evt_t const * p_gcm_evt) +{ + for (uint32_t i = 0; i < GCM_EVENT_HANDLERS_CNT; i++) + { + m_evt_handlers[i](p_gcm_evt); + } } @@ -117,14 +128,14 @@ static void local_db_apply_in_evt(uint16_t conn_handle) err_code = gscm_local_db_cache_apply(conn_handle); - switch(err_code) + switch (err_code) { case NRF_SUCCESS: event.evt_id = GCM_EVT_LOCAL_DB_CACHE_APPLIED; event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); event.params.local_db_cache_applied.conn_handle = conn_handle; - m_gcm.evt_handler(&event); + evt_send(&event); break; case NRF_ERROR_BUSY: @@ -136,7 +147,7 @@ static void local_db_apply_in_evt(uint16_t conn_handle) event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); event.params.error_local_db_cache_apply.conn_handle = conn_handle; - m_gcm.evt_handler(&event); + evt_send(&event); break; case BLE_ERROR_INVALID_CONN_HANDLE: @@ -149,11 +160,11 @@ static void local_db_apply_in_evt(uint16_t conn_handle) event.params.error_unexpected.conn_handle = conn_handle; event.params.error_unexpected.error = err_code; - m_gcm.evt_handler(&event); + evt_send(&event); break; } - ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_local_db_apply_pending, set_procedure_as_pending); + ble_conn_state_user_flag_set(conn_handle, m_flag_local_db_apply_pending, set_procedure_as_pending); } @@ -171,14 +182,14 @@ static void local_db_update_in_evt(uint16_t conn_handle) bool set_procedure_as_pending = false; ret_code_t err_code = gscm_local_db_cache_update(conn_handle); - switch(err_code) + switch (err_code) { case NRF_SUCCESS: event.evt_id = GCM_EVT_LOCAL_DB_CACHE_UPDATED; event.params.local_db_cache_applied.conn_handle = conn_handle; event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); - m_gcm.evt_handler(&event); + evt_send(&event); break; case BLE_ERROR_INVALID_CONN_HANDLE: @@ -194,15 +205,15 @@ static void local_db_update_in_evt(uint16_t conn_handle) event.params.error_data_size.conn_handle = conn_handle; event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); - m_gcm.evt_handler(&event); + evt_send(&event); break; - case NRF_ERROR_NO_MEM: + case NRF_ERROR_STORAGE_FULL: event.evt_id = GCM_EVT_ERROR_STORAGE_FULL; event.params.error_no_mem.conn_handle = conn_handle; event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); - m_gcm.evt_handler(&event); + evt_send(&event); break; default: @@ -211,11 +222,11 @@ static void local_db_update_in_evt(uint16_t conn_handle) event.params.error_unexpected.conn_handle = conn_handle; event.params.error_unexpected.error = err_code; - m_gcm.evt_handler(&event); + evt_send(&event); break; } - ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_local_db_update_pending, set_procedure_as_pending); + ble_conn_state_user_flag_set(conn_handle, m_flag_local_db_update_pending, set_procedure_as_pending); } @@ -234,7 +245,7 @@ static void service_changed_send_in_evt(uint16_t conn_handle) bool sc_sent_state = false; ret_code_t err_code = gscm_service_changed_ind_send(conn_handle); - switch(err_code) + switch (err_code) { case NRF_SUCCESS: sc_sent_state = true; @@ -243,7 +254,7 @@ static void service_changed_send_in_evt(uint16_t conn_handle) event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); event.params.service_changed_ind_sent.conn_handle = conn_handle; - m_gcm.evt_handler(&event); + evt_send(&event); break; case NRF_ERROR_BUSY: @@ -274,20 +285,21 @@ static void service_changed_send_in_evt(uint16_t conn_handle) event.params.error_unexpected.error = err_code; event.peer_id = im_peer_id_get_by_conn_handle(conn_handle); - m_gcm.evt_handler(&event); + evt_send(&event); break; } - ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_service_changed_pending, sc_pending_state); - ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_service_changed_sent, sc_sent_state); + ble_conn_state_user_flag_set(conn_handle, m_flag_service_changed_pending, sc_pending_state); + ble_conn_state_user_flag_set(conn_handle, m_flag_service_changed_sent, sc_sent_state); } /**@brief Callback function for events from the GATT Cache Server Manager module. + * This handler is extern in GATTS Cache Manager module. * * @param[in] p_event The event from the GATT Cache Server Manager module. */ -static void gscm_evt_handler(gscm_evt_t const * p_event) +void gcm_gscm_evt_handler(gscm_evt_t const * p_event) { gcm_evt_t event; event.peer_id = p_event->peer_id; @@ -297,7 +309,7 @@ static void gscm_evt_handler(gscm_evt_t const * p_event) case GSCM_EVT_LOCAL_DB_CACHE_STORED: event.evt_id = GCM_EVT_LOCAL_DB_CACHE_STORED; - m_gcm.evt_handler(&event); + evt_send(&event); local_db_apply_in_evt(im_conn_handle_get(p_event->peer_id)); break; @@ -305,7 +317,7 @@ static void gscm_evt_handler(gscm_evt_t const * p_event) event.evt_id = GCM_EVT_LOCAL_DB_CACHE_UPDATED; event.params.local_db_cache_updated.conn_handle = p_event->params.local_db_cache_updated.conn_handle; - m_gcm.evt_handler(&event); + evt_send(&event); break; case GSCM_EVT_SC_STATE_STORED: @@ -314,7 +326,7 @@ static void gscm_evt_handler(gscm_evt_t const * p_event) uint16_t conn_handle = im_conn_handle_get(p_event->peer_id); if (conn_handle != BLE_CONN_HANDLE_INVALID) { - ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_service_changed_pending, true); + ble_conn_state_user_flag_set(conn_handle, m_flag_service_changed_pending, true); service_changed_pending_flags_check(); } } @@ -323,21 +335,12 @@ static void gscm_evt_handler(gscm_evt_t const * p_event) } -/**@brief Callback function for events from the GATT Cache Client Manager module. +/**@brief Callback function for events from the ID Manager module. + * This function is registered in the ID Manager module. * - * @param[in] p_event The event from the GATT Cache Client Manager module. + * @param[in] p_event The event from the ID Manager module. */ -static void gccm_evt_handler(gccm_evt_t const * p_event) -{ - -} - - -/**@brief Callback function for events from the Identity Manager module. - * - * @param[in] p_event The event from the Identity Manager module. - */ -static void im_evt_handler(im_evt_t const * p_event) +void gcm_im_evt_handler(im_evt_t const * p_event) { switch (p_event->evt_id) { @@ -345,7 +348,7 @@ static void im_evt_handler(im_evt_t const * p_event) local_db_apply_in_evt(p_event->conn_handle); if (gscm_service_changed_ind_needed(p_event->conn_handle)) { - ble_conn_state_user_flag_set(p_event->conn_handle, m_gcm.flag_id_service_changed_pending, true); + ble_conn_state_user_flag_set(p_event->conn_handle, m_flag_service_changed_pending, true); } break; default: @@ -355,10 +358,11 @@ static void im_evt_handler(im_evt_t const * p_event) /**@brief Callback function for events from the Security Dispatcher module. + * This handler is extern in Security Dispatcher. * * @param[in] p_event The event from the Security Dispatcher module. */ -static void smd_evt_handler(smd_evt_t const * p_event) +void gcm_smd_evt_handler(smd_evt_t const * p_event) { switch (p_event->evt_id) { @@ -371,52 +375,41 @@ static void smd_evt_handler(smd_evt_t const * p_event) } -ret_code_t gcm_init(gcm_evt_handler_t evt_handler) +ret_code_t gcm_init() { - VERIFY_PARAM_NOT_NULL(evt_handler); + NRF_PM_DEBUG_CHECK(!m_module_initialized); - ret_code_t err_code; + internal_state_reset(); - err_code = gscm_init(gscm_evt_handler); - VERIFY_SUCCESS(err_code); + m_flag_local_db_update_pending = ble_conn_state_user_flag_acquire(); + m_flag_local_db_apply_pending = ble_conn_state_user_flag_acquire(); + m_flag_service_changed_pending = ble_conn_state_user_flag_acquire(); + m_flag_service_changed_sent = ble_conn_state_user_flag_acquire(); - err_code = gccm_init(gccm_evt_handler); - VERIFY_SUCCESS(err_code); - - internal_state_reset(&m_gcm); - m_gcm.evt_handler = evt_handler; - - err_code = im_register(im_evt_handler); - VERIFY_SUCCESS(err_code); - - err_code = smd_register(smd_evt_handler); - VERIFY_SUCCESS(err_code); - - - m_gcm.flag_id_local_db_update_pending = ble_conn_state_user_flag_acquire(); - m_gcm.flag_id_local_db_apply_pending = ble_conn_state_user_flag_acquire(); - m_gcm.flag_id_service_changed_pending = ble_conn_state_user_flag_acquire(); - m_gcm.flag_id_service_changed_sent = ble_conn_state_user_flag_acquire(); - - if ((m_gcm.flag_id_local_db_update_pending == BLE_CONN_STATE_USER_FLAG_INVALID) - || (m_gcm.flag_id_local_db_apply_pending == BLE_CONN_STATE_USER_FLAG_INVALID) - || (m_gcm.flag_id_service_changed_pending == BLE_CONN_STATE_USER_FLAG_INVALID) - || (m_gcm.flag_id_service_changed_sent == BLE_CONN_STATE_USER_FLAG_INVALID)) + if ((m_flag_local_db_update_pending == BLE_CONN_STATE_USER_FLAG_INVALID) + || (m_flag_local_db_apply_pending == BLE_CONN_STATE_USER_FLAG_INVALID) + || (m_flag_service_changed_pending == BLE_CONN_STATE_USER_FLAG_INVALID) + || (m_flag_service_changed_sent == BLE_CONN_STATE_USER_FLAG_INVALID)) { - err_code = NRF_ERROR_INTERNAL; + return NRF_ERROR_INTERNAL; } - return err_code; + m_module_initialized = true; + + return NRF_SUCCESS; } +// @todo emdi: apply_pending_flags_check() and update_pending_flags_check() should really be +// refactored into one function.. + /**@brief Function for performing the Local DB apply procedure if it is pending on any connections. */ static void apply_pending_flags_check(void) { sdk_mapped_flags_t apply_pending_flags; - apply_pending_flags = ble_conn_state_user_flag_collection(m_gcm.flag_id_local_db_apply_pending); + apply_pending_flags = ble_conn_state_user_flag_collection(m_flag_local_db_apply_pending); if (sdk_mapped_flags_any_set(apply_pending_flags)) { sdk_mapped_flags_key_list_t conn_handle_list; @@ -424,7 +417,7 @@ static void apply_pending_flags_check(void) for (uint32_t i = 0; i < conn_handle_list.len; i++) { - if (ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_gcm.flag_id_local_db_apply_pending)) + if (ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_flag_local_db_apply_pending)) { local_db_apply_in_evt(conn_handle_list.flag_keys[i]); } @@ -439,7 +432,7 @@ static void update_pending_flags_check(void) { sdk_mapped_flags_t update_pending_flags; - update_pending_flags = ble_conn_state_user_flag_collection(m_gcm.flag_id_local_db_update_pending); + update_pending_flags = ble_conn_state_user_flag_collection(m_flag_local_db_update_pending); if (sdk_mapped_flags_any_set(update_pending_flags)) { sdk_mapped_flags_key_list_t conn_handle_list; @@ -447,7 +440,7 @@ static void update_pending_flags_check(void) for (uint32_t i = 0; i < conn_handle_list.len; i++) { - if (ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_gcm.flag_id_local_db_update_pending)) + if (ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_flag_local_db_update_pending)) { local_db_update_in_evt(conn_handle_list.flag_keys[i]); } @@ -462,7 +455,7 @@ static void service_changed_pending_flags_check(void) { sdk_mapped_flags_t service_changed_pending_flags; - service_changed_pending_flags = ble_conn_state_user_flag_collection(m_gcm.flag_id_service_changed_pending); + service_changed_pending_flags = ble_conn_state_user_flag_collection(m_flag_service_changed_pending); if (sdk_mapped_flags_any_set(service_changed_pending_flags)) { sdk_mapped_flags_key_list_t conn_handle_list; @@ -471,9 +464,9 @@ static void service_changed_pending_flags_check(void) for (uint32_t i = 0; i < conn_handle_list.len; i++) { if ( ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], - m_gcm.flag_id_service_changed_pending) + m_flag_service_changed_pending) && !ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], - m_gcm.flag_id_service_changed_sent)) + m_flag_service_changed_sent)) { service_changed_send_in_evt(conn_handle_list.flag_keys[i]); } @@ -490,7 +483,7 @@ void gcm_ble_evt_handler(ble_evt_t * p_ble_evt) { gcm_evt_t event; - switch(p_ble_evt->header.evt_id) + switch (p_ble_evt->header.evt_id) { case BLE_GATTS_EVT_SYS_ATTR_MISSING: local_db_apply_in_evt(p_ble_evt->evt.gatts_evt.conn_handle); @@ -502,9 +495,9 @@ void gcm_ble_evt_handler(ble_evt_t * p_ble_evt) event.params.service_changed_ind_sent.conn_handle = p_ble_evt->evt.gatts_evt.conn_handle; gscm_db_change_notification_done(event.peer_id); - ble_conn_state_user_flag_set(p_ble_evt->evt.gatts_evt.conn_handle, m_gcm.flag_id_service_changed_pending, false); + ble_conn_state_user_flag_set(p_ble_evt->evt.gatts_evt.conn_handle, m_flag_service_changed_pending, false); - m_gcm.evt_handler(&event); + evt_send(&event); break; case BLE_GATTS_EVT_WRITE: @@ -521,30 +514,9 @@ void gcm_ble_evt_handler(ble_evt_t * p_ble_evt) } -ret_code_t gcm_remote_db_store(pm_peer_id_t peer_id, - ble_gatt_db_srv_t * p_remote_db, - uint32_t n_services) -{ - VERIFY_MODULE_INITIALIZED(); - - return gccm_remote_db_store(peer_id, p_remote_db, n_services); -} - - -ret_code_t gcm_remote_db_retrieve(pm_peer_id_t peer_id, - ble_gatt_db_srv_t * p_remote_db, - uint32_t * p_n_services) -{ - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_NULL(p_remote_db); - - return gccm_remote_db_retrieve(peer_id, p_remote_db, p_n_services); -} - - ret_code_t gcm_local_db_cache_update(uint16_t conn_handle) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); ret_code_t err_code = gscm_local_db_cache_update(conn_handle); bool set_procedure_as_pending = false; @@ -555,7 +527,7 @@ ret_code_t gcm_local_db_cache_update(uint16_t conn_handle) err_code = NRF_SUCCESS; } - ble_conn_state_user_flag_set(conn_handle, m_gcm.flag_id_local_db_update_pending, set_procedure_as_pending); + ble_conn_state_user_flag_set(conn_handle, m_flag_local_db_update_pending, set_procedure_as_pending); return err_code; } @@ -563,20 +535,12 @@ ret_code_t gcm_local_db_cache_update(uint16_t conn_handle) ret_code_t gcm_local_db_cache_set(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); return gscm_local_db_cache_set(peer_id, p_local_db); } -ret_code_t gcm_local_db_cache_get(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db) -{ - VERIFY_MODULE_INITIALIZED(); - - return gscm_local_db_cache_get(peer_id, p_local_db); -} - - void gcm_local_database_has_changed(void) { gscm_local_database_has_changed(); @@ -587,9 +551,10 @@ void gcm_local_database_has_changed(void) { if (im_peer_id_get_by_conn_handle(conn_handles.flag_keys[i]) == PM_PEER_ID_INVALID) { - ble_conn_state_user_flag_set(conn_handles.flag_keys[i], m_gcm.flag_id_service_changed_pending, true); + ble_conn_state_user_flag_set(conn_handles.flag_keys[i], m_flag_service_changed_pending, true); } } service_changed_pending_flags_check(); } +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h index c4b763c358..8c0055f6ee 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h @@ -37,16 +37,19 @@ */ - #ifndef GATT_CACHE_MANAGER_H__ #define GATT_CACHE_MANAGER_H__ #include #include "sdk_errors.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "peer_manager_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** @@ -118,12 +121,10 @@ typedef void (*gcm_evt_handler_t)(gcm_evt_t const * p_event); /**@brief Function for initializing the GATT Cache Manager module. * - * @param[in] evt_handler Callback for events from the GATT Cache Manager module. - * - * @retval NRF_SUCCESS Initialization was successful. - * @retval NRF_ERROR_NULL evt_handler was NULL. + * @retval NRF_SUCCESS Initialization was successful. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ -ret_code_t gcm_init(gcm_evt_handler_t evt_handler); +ret_code_t gcm_init(void); /**@brief Function for dispatching SoftDevice events to the GATT Cache Manager module. @@ -181,9 +182,9 @@ ret_code_t gcm_remote_db_retrieve(pm_peer_id_t peer_id, * @retval BLE_ERROR_INVALID_CONN_HANDLE conn_handle does not refer to an active, bonded connection. * @retval NRF_ERROR_DATA_SIZE Write buffer not large enough. Call will never work with * this GATT database. - * @retval NRF_ERROR_NO_MEM No room in persistent_storage. Free up space; the + * @retval NRF_ERROR_STORAGE_FULL No room in persistent_storage. Free up space; the * operation will be automatically reattempted after the - * next compression procedure + * next FDS garbage collection procedure. * @retval NRF_ERROR_INVALID_STATE Module is not initialized. */ ret_code_t gcm_local_db_cache_update(uint16_t conn_handle); @@ -233,4 +234,9 @@ void gcm_local_database_has_changed(void); * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* GATT_CACHE_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.c deleted file mode 100644 index e6b5469b41..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - - -#include "gattc_cache_manager.h" - -#include "nrf_ble_gap.h" -#include "ble_conn_state.h" -#include "peer_manager_types.h" -#include "peer_database.h" -#include "id_manager.h" -#include "sdk_common.h" - -#define MAX_SIMUL_SEC_PROCEDURES 2 - -typedef struct -{ - gccm_evt_handler_t evt_handler; -} gccm_t; - -static gccm_t m_gccm; - -#define MODULE_INITIALIZED (m_gccm.evt_handler != NULL) -#include "sdk_macros.h" - -static void internal_state_reset(gccm_t * gccm) -{ - memset(gccm, 0, sizeof(gccm_t)); -} - - -/**@brief Event handler for events from the peer_database module. - * - * @param[in] p_event The event that has happend with peer id and flags. - */ -static void pdb_evt_handler(pdb_evt_t const * p_event) -{ - gccm_evt_t gccm_evt; - gccm_evt.evt_id = GCCM_EVT_REMOTE_DB_STORED; - gccm_evt.peer_id = p_event->peer_id; - m_gccm.evt_handler(&gccm_evt); -} - - -ret_code_t gccm_init(gccm_evt_handler_t evt_handler) -{ - ret_code_t err_code; - if (evt_handler == NULL) - { - err_code = NRF_ERROR_NULL; - } - else - { - err_code = pdb_register(pdb_evt_handler); - if (err_code == NRF_SUCCESS) - { - internal_state_reset(&m_gccm); - m_gccm.evt_handler = evt_handler; - } - } - return err_code; -} - - -ret_code_t gccm_remote_db_store(pm_peer_id_t peer_id, - ble_gatt_db_srv_t * p_remote_db, - uint32_t n_services) -{ - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_NULL(p_remote_db); - - // Initialize the peer_data - pm_peer_data_const_t peer_data; - memset(&peer_data, 0, sizeof(peer_data)); - peer_data.data_id = PM_PEER_DATA_ID_GATT_REMOTE; - peer_data.p_remote_gatt_db = p_remote_db; - peer_data.length_words = PM_REMOTE_DB_N_WORDS(n_services); - - return pdb_raw_store(peer_id, &peer_data, NULL); -} - - -ret_code_t gccm_remote_db_retrieve(pm_peer_id_t peer_id, - ble_gatt_db_srv_t * p_remote_db, - uint32_t * p_n_services) -{ - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_NULL(p_remote_db); - VERIFY_PARAM_NOT_NULL(p_n_services); - - // Initialize the peer_data - pm_peer_data_t peer_data; - memset(&peer_data, 0, sizeof(peer_data)); - peer_data.data_id = PM_PEER_DATA_ID_GATT_REMOTE; - peer_data.p_remote_gatt_db = p_remote_db; - peer_data.length_words = PM_REMOTE_DB_N_WORDS(*p_n_services); - - ret_code_t err_code = pdb_raw_read(peer_id, PM_PEER_DATA_ID_GATT_REMOTE, &peer_data); - - *p_n_services = PM_REMOTE_DB_N_SERVICES(peer_data.length_words); - - return err_code; -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.h deleted file mode 100644 index abfca986a4..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gattc_cache_manager.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - - -#ifndef GATTC_CACHE_MANAGER_H__ -#define GATTC_CACHE_MANAGER_H__ - -#include -#include "sdk_errors.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" -#include "peer_manager_types.h" - - -/** - * @cond NO_DOXYGEN - * @defgroup gattc_cache_manager GATT Client Cache Manager - * @ingroup peer_manager - * @{ - * @brief An internal module of @ref peer_manager. A module for managing persistent storing of GATT - * attributes pertaining to the GATT client role of the local device. - */ - - -/**@brief Events that can come from the GATT Cache Manager module. - */ -typedef enum -{ - GCCM_EVT_REMOTE_DB_UPDATED, /**< Values for the specified data has been updated in persistent storage. */ - GCCM_EVT_REMOTE_DB_STORED, /**< New values for the specified data has been written in persistent storage. */ -} gccm_evt_id_t; - - -typedef struct -{ - gccm_evt_id_t evt_id; - pm_peer_id_t peer_id; -} gccm_evt_t; - -/**@brief Event handler for events from the GATT Client Cache Manager module. - * - * @param[in] event The event that has happened. - * @param[in] peer The id of the peer the event pertains to. - * @param[in] flags The data the event pertains to. - */ -typedef void (*gccm_evt_handler_t)(gccm_evt_t const * p_event); - - -/**@brief Function for initializing the GATT Client Cache Manager module. - * - * @param[in] evt_handler Callback for events from the GATT Client Cache Manager module. - * - * @retval NRF_SUCCESS Initialization was successful. - * @retval NRF_ERROR_NULL evt_handler was NULL. - */ -ret_code_t gccm_init(gccm_evt_handler_t evt_handler); - - -/**@brief Function for storing a discovered remote database persistently. - * - * @param[in] peer_id Peer to store the database for. - * @param[in] p_remote_db Database values to store as an array. Can be NULL if n_services is 0. - * @param[in] n_services Number of services in p_remote_db array. If 0, values are cleared. - * - * @retval NRF_SUCCESS Store procedure successfully started. - * @retval NRF_ERROR_NOT_FOUND The peer id is invalid or unallocated. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. - */ -ret_code_t gccm_remote_db_store(pm_peer_id_t peer_id, - ble_gatt_db_srv_t * p_remote_db, - uint32_t n_services); - - -/**@brief Function for retrieving a persistently stored remote database. - * - * @param[in] peer_id Peer to retrieve data for. - * @param[out] p_remote_db If p_n_services was large enough: Copied database values. - * @param[inout] p_n_services In: Size of provided p_remote_db array. Out: Size of data in flash. - * - * @note p_n_services is always updated with the size of the data to be retrieved. The data is only - * copied if p_remote_db is large enough (p_n_services is large enough initially). - * - * @retval NRF_SUCCESS Data retrieved successfully. - * @retval NRF_ERROR_NOT_FOUND The peer ID is invalid or unallocated. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. - */ -ret_code_t gccm_remote_db_retrieve(pm_peer_id_t peer_id, - ble_gatt_db_srv_t * p_remote_db, - uint32_t * p_n_services); - - -/** @} - * @endcond - */ - -#endif /* GATTC_CACHE_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.c index 8cbca8e3f1..3f6b89c8bc 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.c @@ -36,49 +36,56 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "gatts_cache_manager.h" #include -#include "nrf_ble_gap.h" -#include "ble_conn_state.h" +#include "ble_gap.h" #include "peer_manager_types.h" #include "peer_manager_internal.h" #include "peer_database.h" #include "id_manager.h" -#include "sdk_common.h" - -#define SYS_ATTR_SYS (BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS) /**< Shorthand define for the flag for system attributes. */ -#define SYS_ATTR_USR (BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS) /**< Shorthand define for the flag for user attributes. */ -#define SYS_ATTR_BOTH (SYS_ATTR_SYS | SYS_ATTR_USR) /**< Shorthand define for the combined flags for system and user attributes. */ -/**@brief Structure containing the module variable(s) of the GSCM module. - */ -typedef struct +// Syntactic sugar, two spoons. +#define SYS_ATTR_SYS (BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS) +#define SYS_ATTR_USR (BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS) +#define SYS_ATTR_BOTH (SYS_ATTR_SYS | SYS_ATTR_USR) + +// The number of registered event handlers. +#define GSCM_EVENT_HANDLERS_CNT (sizeof(m_evt_handler) / sizeof(m_evt_handler[0])) + + +// GATTS Cache Manager event handler in Peer Manager. +extern void gcm_gscm_evt_handler(gscm_evt_t const * p_event); + +// GATTS Cache Manager events' handlers. +// The number of elements in this array is GSCM_EVENT_HANDLERS_CNT. +static gscm_evt_handler_t m_evt_handler[] = { - gscm_evt_handler_t evt_handler; /**< The event handler to use for outbound GSCM events. */ - pm_peer_id_t current_sc_store_peer_id; -} gscm_t; + gcm_gscm_evt_handler +}; -static gscm_t m_gscm = -{ - .current_sc_store_peer_id = PM_PEER_ID_INVALID, -}; /**< Instantiation of module variable(s). */ - -#define MODULE_INITIALIZED (m_gscm.evt_handler != NULL) -#include "sdk_macros.h" +static bool m_module_initialized; +static pm_peer_id_t m_current_sc_store_peer_id; /**@brief Function for resetting the module variable(s) of the GSCM module. - * - * @param[out] p_gscm The instance to reset. */ -static void internal_state_reset(gscm_t * p_gscm) +static void internal_state_reset() { - memset(p_gscm, 0, sizeof(gscm_t)); - p_gscm->current_sc_store_peer_id = PM_PEER_ID_INVALID; + m_module_initialized = false; + m_current_sc_store_peer_id = PM_PEER_ID_INVALID; +} + + +static void evt_send(gscm_evt_t const * p_event) +{ + for (uint32_t i = 0; i < GSCM_EVENT_HANDLERS_CNT; i++) + { + m_evt_handler[i](p_event); + } } @@ -90,35 +97,38 @@ static void internal_state_reset(gscm_t * p_gscm) */ static void service_changed_pending_set(void) { - VERIFY_MODULE_INITIALIZED_VOID(); - static const bool service_changed_pending = true; + NRF_PM_DEBUG_CHECK(m_module_initialized); + ret_code_t err_code; + // Use a uint32_t to enforce 4-byte alignment. + static const uint32_t service_changed_pending = true; //lint -save -e65 -e64 pm_peer_data_const_t peer_data = { .data_id = PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, .length_words = PM_SC_STATE_N_WORDS(), - .p_service_changed_pending = &service_changed_pending, + .p_service_changed_pending = (bool*)&service_changed_pending, }; //lint -restore - err_code = pdb_raw_store(m_gscm.current_sc_store_peer_id, &peer_data, NULL); - while((m_gscm.current_sc_store_peer_id != PM_PEER_ID_INVALID) && (err_code != NRF_ERROR_BUSY)) + err_code = pdb_raw_store(m_current_sc_store_peer_id, &peer_data, NULL); + while ((m_current_sc_store_peer_id != PM_PEER_ID_INVALID) && (err_code != NRF_ERROR_BUSY)) { - m_gscm.current_sc_store_peer_id = pdb_next_peer_id_get(m_gscm.current_sc_store_peer_id); - err_code = pdb_raw_store(m_gscm.current_sc_store_peer_id, &peer_data, NULL); + m_current_sc_store_peer_id = pdb_next_peer_id_get(m_current_sc_store_peer_id); + err_code = pdb_raw_store(m_current_sc_store_peer_id, &peer_data, NULL); } } //lint -restore -/**@brief Event handler for events from the peer_database module. +/**@brief Event handler for events from the Peer Database module. + * This function is extern in Peer Database. * * @param[in] p_event The event that has happend with peer id and flags. */ -static void pdb_evt_handler(pdb_evt_t const * p_event) +void gscm_pdb_evt_handler(pdb_evt_t const * p_event) { if (p_event->evt_id == PDB_EVT_RAW_STORED) { @@ -127,7 +137,9 @@ static void pdb_evt_handler(pdb_evt_t const * p_event) ret_code_t err_code; pm_peer_data_flash_t peer_data; - err_code = pdb_read_buf_get(p_event->peer_id, PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, &peer_data, NULL); + err_code = pdb_peer_data_ptr_get(p_event->peer_id, + PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, + &peer_data); if (err_code == NRF_SUCCESS) { @@ -136,41 +148,32 @@ static void pdb_evt_handler(pdb_evt_t const * p_event) gscm_evt.peer_id = p_event->peer_id; gscm_evt.params.sc_state_stored.state = &peer_data.p_service_changed_pending; - m_gscm.evt_handler(&gscm_evt); + evt_send(&gscm_evt); } } } - if (m_gscm.current_sc_store_peer_id != PM_PEER_ID_INVALID) + if (m_current_sc_store_peer_id != PM_PEER_ID_INVALID) { service_changed_pending_set(); } } -ret_code_t gscm_init(gscm_evt_handler_t evt_handler) +ret_code_t gscm_init() { - ret_code_t err_code; - if (evt_handler == NULL) - { - err_code = NRF_ERROR_NULL; - } - else - { - err_code = pdb_register(pdb_evt_handler); - if (err_code == NRF_SUCCESS) - { - internal_state_reset(&m_gscm); - m_gscm.evt_handler = evt_handler; - } - } - return err_code; + NRF_PM_DEBUG_CHECK(!m_module_initialized); + + internal_state_reset(); + m_module_initialized = true; + + return NRF_SUCCESS; } ret_code_t gscm_local_db_cache_update(uint16_t conn_handle) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(conn_handle); ret_code_t err_code; @@ -236,7 +239,7 @@ ret_code_t gscm_local_db_cache_update(uint16_t conn_handle) ret_code_t gscm_local_db_cache_apply(uint16_t conn_handle) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(conn_handle); ret_code_t err_code; @@ -248,7 +251,7 @@ ret_code_t gscm_local_db_cache_apply(uint16_t conn_handle) if (peer_id != PM_PEER_ID_INVALID) { - err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_GATT_LOCAL, &peer_data, NULL); + err_code = pdb_peer_data_ptr_get(peer_id, PM_PEER_DATA_ID_GATT_LOCAL, &peer_data); if (err_code == NRF_SUCCESS) { pm_peer_data_local_gatt_db_t const * p_local_gatt_db; @@ -306,7 +309,7 @@ ret_code_t gscm_local_db_cache_apply(uint16_t conn_handle) ret_code_t gscm_local_db_cache_set(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); pm_peer_data_const_t peer_data; @@ -318,22 +321,10 @@ ret_code_t gscm_local_db_cache_set(pm_peer_id_t peer_id, pm_peer_data_local_gatt } -ret_code_t gscm_local_db_cache_get(pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t * p_local_db) -{ - VERIFY_MODULE_INITIALIZED(); - - pm_peer_data_t peer_data; - memset(&peer_data, 0, sizeof(pm_peer_data_t)); - peer_data.p_local_gatt_db = p_local_db; - - return pdb_raw_read(peer_id, PM_PEER_DATA_ID_GATT_LOCAL, &peer_data); -} - - void gscm_local_database_has_changed(void) { - VERIFY_MODULE_INITIALIZED_VOID(); - m_gscm.current_sc_store_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); + NRF_PM_DEBUG_CHECK(m_module_initialized); + m_current_sc_store_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); service_changed_pending_set(); } @@ -344,14 +335,14 @@ bool gscm_service_changed_ind_needed(uint16_t conn_handle) pm_peer_data_flash_t peer_data; pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(conn_handle); - err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, &peer_data, NULL); + err_code = pdb_peer_data_ptr_get(peer_id, PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, &peer_data); if (err_code != NRF_SUCCESS) { return false; } - return &peer_data.p_service_changed_pending; + return *peer_data.p_service_changed_pending; } @@ -376,16 +367,17 @@ ret_code_t gscm_service_changed_ind_send(uint16_t conn_handle) void gscm_db_change_notification_done(pm_peer_id_t peer_id) { - VERIFY_MODULE_INITIALIZED_VOID(); + NRF_PM_DEBUG_CHECK(m_module_initialized); - static const bool service_changed_pending = false; + // Use a uint32_t to enforce 4-byte alignment. + static const uint32_t service_changed_pending = false; //lint -save -e65 -e64 pm_peer_data_const_t peer_data = { .data_id = PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, .length_words = PM_SC_STATE_N_WORDS(), - .p_service_changed_pending = &service_changed_pending, + .p_service_changed_pending = (bool*)&service_changed_pending, }; //lint -restore @@ -394,3 +386,4 @@ void gscm_db_change_notification_done(pm_peer_id_t peer_id) (void) pdb_raw_store(peer_id, &peer_data, NULL); //lint -restore } +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h index 6c6b3f8baa..abf484fad8 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h @@ -37,16 +37,19 @@ */ - #ifndef GATTS_CACHE_MANAGER_H__ #define GATTS_CACHE_MANAGER_H__ #include #include "sdk_errors.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "peer_manager_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** @@ -98,13 +101,11 @@ typedef void (*gscm_evt_handler_t)(gscm_evt_t const * p_event); /**@brief Function for initializing the GATT Server Cache Manager module. - * - * @param[in] evt_handler Callback for events from the GATT Server Cache Manager module. * * @retval NRF_SUCCESS Initialization was successful. - * @retval NRF_ERROR_NULL evt_handler was NULL. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ -ret_code_t gscm_init(gscm_evt_handler_t evt_handler); +ret_code_t gscm_init(void); /**@brief Function for triggering local GATT database data to be stored persistently. Values are @@ -118,9 +119,9 @@ ret_code_t gscm_init(gscm_evt_handler_t evt_handler); * @retval NRF_ERROR_BUSY Unable to perform operation at this time. Reattempt later. * @retval NRF_ERROR_DATA_SIZE Write buffer not large enough. Call will never work with * this GATT database. - * @retval NRF_ERROR_NO_MEM No room in persistent_storage. Free up space; the + * @retval NRF_ERROR_STORAGE_FULL No room in persistent_storage. Free up space; the * operation will be automatically reattempted after the - * next compression procedure + * next FDS garbage collection procedure. * @retval NRF_ERROR_INVALID_STATE Module is not initialized. */ ret_code_t gscm_local_db_cache_update(uint16_t conn_handle); @@ -225,4 +226,9 @@ void gscm_db_change_notification_done(pm_peer_id_t peer_id); * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* GATTS_CACHE_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c index 94bc363ef6..75942d5471 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c @@ -36,26 +36,41 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "id_manager.h" #include -#include "nrf_soc.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "ble_conn_state.h" #include "peer_manager_types.h" #include "peer_database.h" -#include "nordic_common.h" -#include "sdk_common.h" +#include "peer_data_storage.h" +#include "nrf_soc.h" + + +#define IM_MAX_CONN_HANDLES (8) +#define IM_NO_INVALID_CONN_HANDLES (0xFF) +#define IM_ADDR_CLEARTEXT_LENGTH (3) +#define IM_ADDR_CIPHERTEXT_LENGTH (3) + +// The number of registered event handlers. +#define IM_EVENT_HANDLERS_CNT (sizeof(m_evt_handlers) / sizeof(m_evt_handlers[0])) + + +// Identity Manager event handlers in Peer Manager and GATT Cache Manager. +extern void pm_im_evt_handler(im_evt_t const * p_event); +extern void gcm_im_evt_handler(im_evt_t const * p_event); + +// Identity Manager events' handlers. +// The number of elements in this array is IM_EVENT_HANDLERS_CNT. +static im_evt_handler_t const m_evt_handlers[] = +{ + pm_im_evt_handler, + gcm_im_evt_handler +}; -#define IM_MAX_CONN_HANDLES 8 -#define IM_NO_INVALID_CONN_HANDLES 0xFF -#define MAX_REGISTRANTS 3 -#define WHITELIST_MAX_COUNT MAX(BLE_GAP_WHITELIST_ADDR_MAX_COUNT, \ - BLE_GAP_WHITELIST_IRK_MAX_COUNT) -#define IM_ADDR_CLEARTEXT_LENGTH 3 -#define IM_ADDR_CIPHERTEXT_LENGTH 3 typedef struct { @@ -64,32 +79,25 @@ typedef struct ble_gap_addr_t peer_address; } im_connection_t; -typedef struct -{ - im_evt_handler_t evt_handlers[MAX_REGISTRANTS]; - uint8_t n_registrants; - im_connection_t connections[8]; - pm_peer_id_t irk_whitelist_peer_ids[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; - ble_gap_irk_t whitelist_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; - ble_gap_addr_t whitelist_addrs[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; - uint8_t n_irk_whitelist_peer_ids; - ble_conn_state_user_flag_id_t conn_state_user_flag_id; -} im_t; +static bool m_module_initialized; +static im_connection_t m_connections[8]; +static ble_conn_state_user_flag_id_t m_conn_state_user_flag_id; -static im_t m_im = {.n_registrants = 0}; +static uint8_t m_wlisted_peer_cnt; +static pm_peer_id_t m_wlisted_peers[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + +#if (NRF_SD_BLE_API_VERSION <= 2) + static ble_gap_addr_t m_current_id_addr; +#endif -#define MODULE_INITIALIZED (m_im.n_registrants > 0) -#include "sdk_macros.h" static void internal_state_reset() { - memset(&m_im, 0, sizeof(im_t)); - m_im.n_registrants = 0; - m_im.n_irk_whitelist_peer_ids = 0; - m_im.conn_state_user_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; + m_conn_state_user_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; + for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) { - m_im.connections[i].conn_handle = BLE_CONN_HANDLE_INVALID; + m_connections[i].conn_handle = BLE_CONN_HANDLE_INVALID; } } @@ -100,15 +108,15 @@ static void internal_state_reset() */ static void evt_send(im_evt_t * p_event) { - for (uint32_t i = 0; i < m_im.n_registrants; i++) + for (uint32_t i = 0; i < IM_EVENT_HANDLERS_CNT; i++) { - m_im.evt_handlers[i](p_event); + m_evt_handlers[i](p_event); } } -/**@brief Function finding a free position in m_im.connections. +/**@brief Function finding a free position in m_connections. * - * @detail All connection handles in the m_im.connections array are checked against the connection + * @detail All connection handles in the m_connections array are checked against the connection * state module. The index of the first one that is not a connection handle for a current * connection is returned. This position in the array can safely be used for a new connection. * @@ -119,9 +127,9 @@ uint8_t get_free_connection() { for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) { - // Query the connection state module to check if the connection handle does not belong to a - // valid connection. - if (!ble_conn_state_user_flag_get(m_im.connections[i].conn_handle, m_im.conn_state_user_flag_id)) + // Query the connection state module to check if the + // connection handle does not belong to a valid connection. + if (!ble_conn_state_user_flag_get(m_connections[i].conn_handle, m_conn_state_user_flag_id)) { return i; } @@ -131,7 +139,7 @@ uint8_t get_free_connection() } -/**@brief Function finding a particular connection handle m_im.connections. +/**@brief Function finding a particular connection handle m_connections. * * @param[in] conn_handle The handle to find. * @@ -140,11 +148,11 @@ uint8_t get_free_connection() */ uint8_t get_connection_by_conn_handle(uint16_t conn_handle) { - if (ble_conn_state_user_flag_get(conn_handle, m_im.conn_state_user_flag_id)) + if (ble_conn_state_user_flag_get(conn_handle, m_conn_state_user_flag_id)) { for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) { - if (m_im.connections[i].conn_handle == conn_handle) + if (m_connections[i].conn_handle == conn_handle) { return i; } @@ -169,7 +177,7 @@ uint8_t new_connection(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr) if ((p_ble_addr != NULL) && (conn_handle != BLE_CONN_HANDLE_INVALID)) { - ble_conn_state_user_flag_set(conn_handle, m_im.conn_state_user_flag_id, true); + ble_conn_state_user_flag_set(conn_handle, m_conn_state_user_flag_id, true); conn_index = get_connection_by_conn_handle(conn_handle); if (conn_index == IM_NO_INVALID_CONN_HANDLES) @@ -179,9 +187,9 @@ uint8_t new_connection(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr) if (conn_index != IM_NO_INVALID_CONN_HANDLES) { - m_im.connections[conn_index].conn_handle = conn_handle; - m_im.connections[conn_index].peer_id = PM_PEER_ID_INVALID; - m_im.connections[conn_index].peer_address = *p_ble_addr; + m_connections[conn_index].conn_handle = conn_handle; + m_connections[conn_index].peer_id = PM_PEER_ID_INVALID; + m_connections[conn_index].peer_address = *p_ble_addr; } } return conn_index; @@ -192,16 +200,18 @@ uint8_t new_connection(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr) * * @detail An all-zero IRK is not valid. This function will check if a given IRK is valid. * - * @param[in] irk The IRK for which the validity is going to be checked. + * @param[in] p_irk The IRK for which the validity is going to be checked. * * @retval true The IRK is valid. * @retval false The IRK is invalid. */ -bool is_valid_irk(ble_gap_irk_t const * irk) +bool is_valid_irk(ble_gap_irk_t const * p_irk) { + NRF_PM_DEBUG_CHECK(p_irk != NULL); + for (uint32_t i = 0; i < BLE_GAP_SEC_KEY_LEN; i++) { - if (irk->irk[i] != 0) + if (p_irk->irk[i] != 0) { return true; } @@ -222,6 +232,7 @@ bool is_valid_irk(ble_gap_irk_t const * irk) */ bool addr_compare(ble_gap_addr_t const * p_addr1, ble_gap_addr_t const * p_addr2) { + // @note emdi: use NRF_PM_DEBUG_CHECK ? if ((p_addr1 == NULL) || (p_addr2 == NULL)) { return false; @@ -239,89 +250,85 @@ bool addr_compare(ble_gap_addr_t const * p_addr1, ble_gap_addr_t const * p_addr2 void im_ble_evt_handler(ble_evt_t * ble_evt) { - ret_code_t err_code; - switch (ble_evt->header.evt_id) + ble_gap_evt_t gap_evt; + pm_peer_id_t bonded_matching_peer_id; + + NRF_PM_DEBUG_CHECK(m_module_initialized); + + if (ble_evt->header.evt_id != BLE_GAP_EVT_CONNECTED) { - case BLE_GAP_EVT_CONNECTED: + // Nothing to do. + return; + } + + gap_evt = ble_evt->evt.gap_evt; + bonded_matching_peer_id = PM_PEER_ID_INVALID; + + if ( gap_evt.params.connected.peer_addr.addr_type + != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE) + { + /* Search the database for bonding data matching the one that triggered the event. + * Public and static addresses can be matched on address alone, while resolvable + * random addresses can be resolved agains known IRKs. Non-resolvable random addresses + * are never matching because they are not longterm form of identification. + */ + + pm_peer_id_t peer_id; + pm_peer_data_flash_t peer_data; + + pds_peer_data_iterate_prepare(); + + switch (gap_evt.params.connected.peer_addr.addr_type) { - pm_peer_id_t bonded_matching_peer_id = PM_PEER_ID_INVALID; - - if (ble_evt->evt.gap_evt.params.connected.irk_match == 1) + case BLE_GAP_ADDR_TYPE_PUBLIC: + case BLE_GAP_ADDR_TYPE_RANDOM_STATIC: { - // The peer was matched using a whitelist. - bonded_matching_peer_id - = m_im.irk_whitelist_peer_ids[ble_evt->evt.gap_evt.params.connected.irk_match_idx]; - } - else if ( ble_evt->evt.gap_evt.params.connected.peer_addr.addr_type - != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE) - { - /* Search the database for bonding data matching the one that triggered the event. - * Public and static addresses can be matched on address alone, while resolvable - * random addresses can be resolved agains known IRKs. Non-resolvable random addresses - * are never matching because they are not longterm form of identification. - */ - pm_peer_id_t compared_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); - while ( (compared_peer_id != PM_PEER_ID_INVALID) - && (bonded_matching_peer_id == PM_PEER_ID_INVALID)) + while (pds_peer_data_iterate(PM_PEER_DATA_ID_BONDING, &peer_id, &peer_data)) { - pm_peer_data_flash_t compared_data; - switch (ble_evt->evt.gap_evt.params.connected.peer_addr.addr_type) + if (addr_compare(&gap_evt.params.connected.peer_addr, + &peer_data.p_bonding_data->peer_ble_id.id_addr_info)) { - case BLE_GAP_ADDR_TYPE_PUBLIC: - /* fall-through */ - case BLE_GAP_ADDR_TYPE_RANDOM_STATIC: - err_code = pdb_read_buf_get(compared_peer_id, - PM_PEER_DATA_ID_BONDING, - &compared_data, - NULL); - if ((err_code == NRF_SUCCESS) && - addr_compare(&ble_evt->evt.gap_evt.params.connected.peer_addr, - &compared_data.p_bonding_data->peer_id.id_addr_info) - ) - { - bonded_matching_peer_id = compared_peer_id; - } - break; - - case BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE: - err_code = pdb_read_buf_get(compared_peer_id, - PM_PEER_DATA_ID_BONDING, - &compared_data, - NULL); - if (err_code == NRF_SUCCESS && - im_address_resolve(&ble_evt->evt.gap_evt.params.connected.peer_addr, - &compared_data.p_bonding_data->peer_id.id_info) - ) - { - bonded_matching_peer_id = compared_peer_id; - } - break; - - case BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE: - // Should not happen. - break; - - default: - break; + bonded_matching_peer_id = peer_id; + break; } - compared_peer_id = pdb_next_peer_id_get(compared_peer_id); } } - uint8_t new_index = new_connection(ble_evt->evt.gap_evt.conn_handle, &ble_evt->evt.gap_evt.params.connected.peer_addr); - UNUSED_VARIABLE(new_index); + break; - if (bonded_matching_peer_id != PM_PEER_ID_INVALID) + case BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE: { - im_new_peer_id(ble_evt->evt.gap_evt.conn_handle, bonded_matching_peer_id); - - // Send a bonded peer event - im_evt_t im_evt; - im_evt.conn_handle = ble_evt->evt.gap_evt.conn_handle; - im_evt.evt_id = IM_EVT_BONDED_PEER_CONNECTED; - evt_send(&im_evt); + while (pds_peer_data_iterate(PM_PEER_DATA_ID_BONDING, &peer_id, &peer_data)) + { + if (im_address_resolve(&gap_evt.params.connected.peer_addr, + &peer_data.p_bonding_data->peer_ble_id.id_info)) + { + bonded_matching_peer_id = peer_id; + break; + } + } } + break; + + default: + NRF_PM_DEBUG_CHECK(false); + break; } } + + uint8_t new_index = new_connection(gap_evt.conn_handle, + &gap_evt.params.connected.peer_addr); + UNUSED_VARIABLE(new_index); + + if (bonded_matching_peer_id != PM_PEER_ID_INVALID) + { + im_new_peer_id(gap_evt.conn_handle, bonded_matching_peer_id); + + // Send a bonded peer event + im_evt_t im_evt; + im_evt.conn_handle = gap_evt.conn_handle; + im_evt.evt_id = IM_EVT_BONDED_PEER_CONNECTED; + evt_send(&im_evt); + } } @@ -333,108 +340,124 @@ void im_ble_evt_handler(ble_evt_t * ble_evt) * * @return True if the input matches, false if it does not. */ -bool is_duplicate_bonding_data(pm_peer_data_bonding_t const * p_bonding_data1, - pm_peer_data_bonding_t const * p_bonding_data2) +bool im_is_duplicate_bonding_data(pm_peer_data_bonding_t const * p_bonding_data1, + pm_peer_data_bonding_t const * p_bonding_data2) { - bool valid_irk = is_valid_irk(&p_bonding_data1->peer_id.id_info); - bool duplicate_irk = valid_irk && - (memcmp(p_bonding_data1->peer_id.id_info.irk, - p_bonding_data2->peer_id.id_info.irk, - BLE_GAP_SEC_KEY_LEN) == 0 - ); - bool duplicate_addr = addr_compare(&p_bonding_data1->peer_id.id_addr_info, - &p_bonding_data2->peer_id.id_addr_info - ); + NRF_PM_DEBUG_CHECK(p_bonding_data1 != NULL); + NRF_PM_DEBUG_CHECK(p_bonding_data2 != NULL); + + if (!is_valid_irk(&p_bonding_data1->peer_ble_id.id_info)) + { + return false; + } + + bool duplicate_irk = (memcmp(p_bonding_data1->peer_ble_id.id_info.irk, + p_bonding_data2->peer_ble_id.id_info.irk, + BLE_GAP_SEC_KEY_LEN) == 0); + + bool duplicate_addr = addr_compare(&p_bonding_data1->peer_ble_id.id_addr_info, + &p_bonding_data2->peer_ble_id.id_addr_info); + return duplicate_irk || duplicate_addr; } -/**@brief Event handler for events from the peer_database module. +/**@brief Event handler for events from the Peer Database module. + * This function is extern in Peer Database. * * @param[in] p_event The event that has happend with peer id and flags. */ -static void pdb_evt_handler(pdb_evt_t const * p_event) +void im_pdb_evt_handler(pdb_evt_t const * p_event) { - ret_code_t err_code; - if ((p_event != NULL) && (p_event->evt_id == PDB_EVT_WRITE_BUF_STORED)) + ret_code_t ret; + pm_peer_id_t peer_id; + pm_peer_data_flash_t peer_data; + pm_peer_data_flash_t peer_data_duplicate; + + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_event != NULL); + + if ((p_event->evt_id != PDB_EVT_WRITE_BUF_STORED) || + (p_event->data_id != PM_PEER_DATA_ID_BONDING)) { - // If new data about peer id has been stored it is compared to other peers peer ids in - // search of duplicates. - if (p_event->data_id == PM_PEER_DATA_ID_BONDING) + return; + } + + // If new data about peer id has been stored it is compared to other peers peer ids in + // search of duplicates. + + ret = pdb_peer_data_ptr_get(p_event->peer_id, PM_PEER_DATA_ID_BONDING, &peer_data); + + if (ret != NRF_SUCCESS) + { + // @note emdi: this shouldn't happen, since the data was just stored, right? + NRF_PM_DEBUG_CHECK(false); + return; + } + + pds_peer_data_iterate_prepare(); + + while (pds_peer_data_iterate(PM_PEER_DATA_ID_BONDING, &peer_id, &peer_data_duplicate)) + { + if (p_event->peer_id == peer_id) { - pm_peer_data_flash_t written_data; - err_code = pdb_read_buf_get(p_event->peer_id, PM_PEER_DATA_ID_BONDING, &written_data, NULL); - if (err_code == NRF_SUCCESS) - { - pm_peer_id_t compared_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); - while (compared_peer_id != PM_PEER_ID_INVALID) - { - pm_peer_data_flash_t compared_data; - err_code = pdb_read_buf_get(compared_peer_id, - PM_PEER_DATA_ID_BONDING, - &compared_data, - NULL); - if ( err_code == NRF_SUCCESS && - p_event->peer_id != compared_peer_id && - is_duplicate_bonding_data(written_data.p_bonding_data, - compared_data.p_bonding_data) - ) - { - im_evt_t im_evt; - im_evt.conn_handle = im_conn_handle_get(p_event->peer_id); - im_evt.evt_id = IM_EVT_DUPLICATE_ID; - im_evt.params.duplicate_id.peer_id_1 = p_event->peer_id; - im_evt.params.duplicate_id.peer_id_2 = compared_peer_id; - evt_send(&im_evt); - } - compared_peer_id = pdb_next_peer_id_get(compared_peer_id); - } - } + // Skip the iteration if the bonding data retrieved is for a peer + // with the same ID as the one contained in the event. + continue; + } + + if (im_is_duplicate_bonding_data(peer_data.p_bonding_data, + peer_data_duplicate.p_bonding_data)) + { + im_evt_t im_evt; + im_evt.conn_handle = im_conn_handle_get(p_event->peer_id); + im_evt.evt_id = IM_EVT_DUPLICATE_ID; + im_evt.params.duplicate_id.peer_id_1 = p_event->peer_id; + im_evt.params.duplicate_id.peer_id_2 = peer_id; + evt_send(&im_evt); + break; } } } -ret_code_t im_register(im_evt_handler_t evt_handler) +ret_code_t im_init(void) { - VERIFY_PARAM_NOT_NULL(evt_handler); - ret_code_t err_code = NRF_SUCCESS; + NRF_PM_DEBUG_CHECK(!m_module_initialized); - if (!MODULE_INITIALIZED) + internal_state_reset(); + + m_conn_state_user_flag_id = ble_conn_state_user_flag_acquire(); + if (m_conn_state_user_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) { - internal_state_reset(); - m_im.conn_state_user_flag_id = ble_conn_state_user_flag_acquire(); - if (m_im.conn_state_user_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) - { - err_code = NRF_ERROR_NO_MEM; - } - else - { - err_code = pdb_register(pdb_evt_handler); - } + return NRF_ERROR_INTERNAL; } - if (err_code == NRF_SUCCESS) - { - if ((m_im.n_registrants < MAX_REGISTRANTS)) + + #if (NRF_SD_BLE_API_VERSION <= 2) + ret_code_t ret_code = sd_ble_gap_address_get(&m_current_id_addr); + if (ret_code != NRF_SUCCESS) { - m_im.evt_handlers[m_im.n_registrants++] = evt_handler; + return NRF_ERROR_INTERNAL; } - else - { - err_code = NRF_ERROR_NO_MEM; - } - } - return err_code; + #endif + + m_module_initialized = true; + + return NRF_SUCCESS; } pm_peer_id_t im_peer_id_get_by_conn_handle(uint16_t conn_handle) { - uint8_t conn_index = get_connection_by_conn_handle(conn_handle); + uint8_t conn_index; - if (MODULE_INITIALIZED && (conn_index != IM_NO_INVALID_CONN_HANDLES)) + NRF_PM_DEBUG_CHECK(m_module_initialized); + + conn_index = get_connection_by_conn_handle(conn_handle); + + if (conn_index != IM_NO_INVALID_CONN_HANDLES) { - return m_im.connections[conn_index].peer_id; + return m_connections[conn_index].peer_id; } return PM_PEER_ID_INVALID; @@ -443,13 +466,16 @@ pm_peer_id_t im_peer_id_get_by_conn_handle(uint16_t conn_handle) ret_code_t im_ble_addr_get(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr) { - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_NULL(p_ble_addr); + uint8_t conn_index; + + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_ble_addr != NULL); + + conn_index = get_connection_by_conn_handle(conn_handle); - uint8_t conn_index = get_connection_by_conn_handle(conn_handle); if (conn_index != IM_NO_INVALID_CONN_HANDLES) { - *p_ble_addr = m_im.connections[conn_index].peer_address; + *p_ble_addr = m_connections[conn_index].peer_address; return NRF_SUCCESS; } @@ -460,74 +486,59 @@ ret_code_t im_ble_addr_get(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr) bool im_master_ids_compare(ble_gap_master_id_t const * p_master_id1, ble_gap_master_id_t const * p_master_id2) { - if(!im_master_id_is_valid(p_master_id1)) + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_master_id1 != NULL); + NRF_PM_DEBUG_CHECK(p_master_id2 != NULL); + + if (!im_master_id_is_valid(p_master_id1)) { return false; } + if (p_master_id1->ediv != p_master_id2->ediv) { return false; } + return (memcmp(p_master_id1->rand, p_master_id2->rand, BLE_GAP_SEC_RAND_LEN) == 0); } pm_peer_id_t im_peer_id_get_by_master_id(ble_gap_master_id_t * p_master_id) { - ret_code_t err_code; - // For each stored peer, check if the master_id match p_master_id - pm_peer_id_t compared_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); - while (compared_peer_id != PM_PEER_ID_INVALID) - { - pm_peer_data_flash_t compared_data; - ble_gap_master_id_t const * p_compared_master_id; + pm_peer_id_t peer_id; + pm_peer_data_flash_t peer_data; - err_code = pdb_read_buf_get(compared_peer_id, PM_PEER_DATA_ID_BONDING, &compared_data, NULL); - if (err_code == NRF_SUCCESS) + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_master_id != NULL); + + pds_peer_data_iterate_prepare(); + + // For each stored peer, check if the master_id matches p_master_id + while (pds_peer_data_iterate(PM_PEER_DATA_ID_BONDING, &peer_id, &peer_data)) + { + if (im_master_ids_compare(p_master_id, &peer_data.p_bonding_data->own_ltk.master_id) || + im_master_ids_compare(p_master_id, &peer_data.p_bonding_data->peer_ltk.master_id)) { - p_compared_master_id = &compared_data.p_bonding_data->own_ltk.master_id; - if (im_master_ids_compare(p_master_id, p_compared_master_id)) - { - // If a matching master_id is found return the peer_id - return compared_peer_id; - } - p_compared_master_id = &compared_data.p_bonding_data->peer_ltk.master_id; - if (im_master_ids_compare(p_master_id, p_compared_master_id)) - { - // If a matching master_id is found return the peer_id - return compared_peer_id; - } + // If a matching master ID is found then return the peer ID. + return peer_id; } - compared_peer_id = pdb_next_peer_id_get(compared_peer_id); } - // If no matching master_id is found return the PM_PEER_ID_INVALID + + // If no matching master ID is found return PM_PEER_ID_INVALID. return PM_PEER_ID_INVALID; } -pm_peer_id_t im_peer_id_get_by_irk_match_idx(uint8_t irk_match_idx) -{ - // Verify that the requested idx is within the list - if (irk_match_idx < m_im.n_irk_whitelist_peer_ids) - { - // Return the peer_id from the white list - return m_im.irk_whitelist_peer_ids[irk_match_idx]; - } - else - { - // Return PM_PEER_ID_INVALID to indicate that there was no peer with the requested idx - return PM_PEER_ID_INVALID; - } -} - - uint16_t im_conn_handle_get(pm_peer_id_t peer_id) { + NRF_PM_DEBUG_CHECK(m_module_initialized); + for (uint32_t i = 0; i < IM_MAX_CONN_HANDLES; i++) { - if (peer_id == m_im.connections[i].peer_id) + if (peer_id == m_connections[i].peer_id) { - return m_im.connections[i].conn_handle; + return m_connections[i].conn_handle; } } return BLE_CONN_HANDLE_INVALID; @@ -536,10 +547,13 @@ uint16_t im_conn_handle_get(pm_peer_id_t peer_id) bool im_master_id_is_valid(ble_gap_master_id_t const * p_master_id) { + NRF_PM_DEBUG_CHECK(m_module_initialized); + if (p_master_id->ediv != 0) { return true; } + for (uint32_t i = 0; i < BLE_GAP_SEC_RAND_LEN; i++) { if (p_master_id->rand[i] != 0) @@ -561,135 +575,450 @@ static void peer_id_set(uint16_t conn_handle, pm_peer_id_t peer_id) uint8_t conn_index = get_connection_by_conn_handle(conn_handle); if (conn_index != IM_NO_INVALID_CONN_HANDLES) { - m_im.connections[conn_index].peer_id = peer_id; + m_connections[conn_index].peer_id = peer_id; } } void im_new_peer_id(uint16_t conn_handle, pm_peer_id_t peer_id) { + NRF_PM_DEBUG_CHECK(m_module_initialized); + peer_id_set(conn_handle, peer_id); } ret_code_t im_peer_free(pm_peer_id_t peer_id) { - VERIFY_MODULE_INITIALIZED(); + uint16_t conn_handle; + ret_code_t ret; - uint16_t conn_handle = im_conn_handle_get(peer_id); - ret_code_t err_code = pdb_peer_free(peer_id); - if ((conn_handle != BLE_CONN_HANDLE_INVALID) && (err_code == NRF_SUCCESS)) + NRF_PM_DEBUG_CHECK(m_module_initialized); + + conn_handle = im_conn_handle_get(peer_id); + ret = pdb_peer_free(peer_id); + + if ((conn_handle != BLE_CONN_HANDLE_INVALID) && (ret == NRF_SUCCESS)) { peer_id_set(conn_handle, PM_PEER_ID_INVALID); } - return err_code; + return ret; } -ret_code_t im_whitelist_create(pm_peer_id_t * p_peer_ids, - uint8_t n_peer_ids, - ble_gap_whitelist_t * p_whitelist) +/**@brief Given a list of peers, loads their GAP address and IRK into the provided buffers. + */ +static ret_code_t peers_id_keys_get(pm_peer_id_t const * p_peers, + uint32_t peer_cnt, + ble_gap_addr_t * p_gap_addrs, + uint32_t * p_addr_cnt, + ble_gap_irk_t * p_gap_irks, + uint32_t * p_irk_cnt) { - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_NULL(p_whitelist); - ret_code_t err_code; - p_whitelist->addr_count = 0; - p_whitelist->irk_count = 0; - m_im.n_irk_whitelist_peer_ids = 0; - for (uint32_t peer_index = 0; peer_index < n_peer_ids; peer_index++) + ret_code_t ret; + + pm_peer_data_bonding_t bond_data; + pm_peer_data_t peer_data; + + uint32_t const buf_size = sizeof(bond_data); + + bool copy_addrs = false; + bool copy_irks = false; + + NRF_PM_DEBUG_CHECK(p_peers != NULL); + + // One of these two has to be provided. + NRF_PM_DEBUG_CHECK((p_gap_addrs != NULL) || (p_gap_irks != NULL)); + + if ((p_gap_addrs != NULL) && (p_addr_cnt != NULL)) { - uint16_t conn_handle = im_conn_handle_get(p_peer_ids[peer_index]); - if (ble_conn_state_status(conn_handle) != BLE_CONN_STATUS_CONNECTED) + NRF_PM_DEBUG_CHECK((*p_addr_cnt) >= peer_cnt); + + copy_addrs = true; + *p_addr_cnt = 0; + } + + if ((p_gap_irks != NULL) && (p_irk_cnt != NULL)) + { + NRF_PM_DEBUG_CHECK((*p_irk_cnt) >= peer_cnt); + + copy_irks = true; + *p_irk_cnt = 0; + } + + memset(&peer_data, 0x00, sizeof(peer_data)); + peer_data.p_bonding_data = &bond_data; + + // Read through flash memory and look for peers ID keys. + + for (uint32_t i = 0; i < peer_cnt; i++) + { + memset(&bond_data, 0x00, sizeof(bond_data)); + + // Read peer data from flash. + ret = pds_peer_data_read(p_peers[i], PM_PEER_DATA_ID_BONDING, + &peer_data, &buf_size); + + if ((ret == NRF_ERROR_NOT_FOUND) || (ret == NRF_ERROR_INVALID_PARAM)) { - pm_peer_data_flash_t peer_data; - err_code = pdb_read_buf_get(p_peer_ids[peer_index], PM_PEER_DATA_ID_BONDING, &peer_data, NULL); - if (err_code == NRF_ERROR_INVALID_PARAM || err_code == NRF_ERROR_NOT_FOUND) - { - return NRF_ERROR_INVALID_PARAM; - } - if (p_whitelist->pp_addrs != NULL && - peer_data.p_bonding_data->peer_id.id_addr_info.addr_type - != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE && - peer_data.p_bonding_data->peer_id.id_addr_info.addr_type - != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE - ) - { - memcpy(m_im.whitelist_addrs[peer_index].addr, - peer_data.p_bonding_data->peer_id.id_addr_info.addr, - BLE_GAP_ADDR_LEN - ); - m_im.whitelist_addrs[peer_index].addr_type = - peer_data.p_bonding_data->peer_id.id_addr_info.addr_type; - p_whitelist->pp_addrs[peer_index] = &m_im.whitelist_addrs[peer_index]; - p_whitelist->addr_count++; - } - if (p_whitelist->pp_irks != NULL && - is_valid_irk(&(peer_data.p_bonding_data->peer_id.id_info)) - ) - { - memcpy(m_im.whitelist_irks[peer_index].irk, - peer_data.p_bonding_data->peer_id.id_info.irk, - BLE_GAP_SEC_KEY_LEN - ); - p_whitelist->pp_irks[peer_index] = &m_im.whitelist_irks[peer_index]; - p_whitelist->irk_count++; - m_im.irk_whitelist_peer_ids[peer_index] = p_peer_ids[peer_index]; - m_im.n_irk_whitelist_peer_ids++; - } + // Peer data coulnd't be found in flash or peer ID is not valid. + return NRF_ERROR_NOT_FOUND; + } + + uint8_t const addr_type = bond_data.peer_ble_id.id_addr_info.addr_type; + + if ((addr_type != BLE_GAP_ADDR_TYPE_PUBLIC) && + (addr_type != BLE_GAP_ADDR_TYPE_RANDOM_STATIC)) + { + // The address shared by the peer during bonding can't be used for whitelisting. + return BLE_ERROR_GAP_INVALID_BLE_ADDR; + } + + // Copy the GAP address. + if (copy_addrs) + { + memcpy(&p_gap_addrs[i], &bond_data.peer_ble_id.id_addr_info, sizeof(ble_gap_addr_t)); + (*p_addr_cnt)++; + } + + // Copy the IRK. + if (copy_irks) + { + memcpy(&p_gap_irks[i], bond_data.peer_ble_id.id_info.irk, BLE_GAP_SEC_KEY_LEN); + (*p_irk_cnt)++; } } + return NRF_SUCCESS; } -ret_code_t im_whitelist_custom(ble_gap_whitelist_t const * p_whitelist) +ret_code_t im_device_identities_list_set(pm_peer_id_t const * p_peers, + uint32_t peer_cnt) { - ret_code_t err_code; + #if (NRF_SD_BLE_API_VERSION >= 3) - pm_peer_id_t new_irk_whitelist_peer_ids[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; - uint32_t n_new_irk_whitelist_peer_ids = 0; - VERIFY_PARAM_NOT_NULL(p_whitelist); - for (uint32_t i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) - { - new_irk_whitelist_peer_ids[i] = PM_PEER_ID_INVALID; - } - pm_peer_id_t compared_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); - while (compared_peer_id != PM_PEER_ID_INVALID) - { - pm_peer_data_flash_t compared_data; - err_code = pdb_read_buf_get(compared_peer_id, PM_PEER_DATA_ID_BONDING, &compared_data, NULL); - if (err_code == NRF_SUCCESS) + ret_code_t ret; + pm_peer_data_t peer_data; + pm_peer_data_bonding_t bond_data; + + ble_gap_id_key_t keys[BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT]; + ble_gap_id_key_t const * key_ptrs[BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT]; + + if ((p_peers == NULL) || (peer_cnt == 0)) { - for (uint32_t i = 0; i < p_whitelist->irk_count; i++) + // Clear the device identities list. + return sd_ble_gap_device_identities_set(NULL, NULL, 0); + } + + peer_data.p_bonding_data = &bond_data; + uint32_t const buf_size = sizeof(bond_data); + + memset(keys, 0x00, sizeof(keys)); + for (uint32_t i = 0; i < BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT; i++) + { + key_ptrs[i] = &keys[i]; + } + + for (uint32_t i = 0; i < peer_cnt; i++) + { + memset(&bond_data, 0x00, sizeof(bond_data)); + + // Read peer data from flash. + ret = pds_peer_data_read(p_peers[i], PM_PEER_DATA_ID_BONDING, + &peer_data, &buf_size); + + if ((ret == NRF_ERROR_NOT_FOUND) || (ret == NRF_ERROR_INVALID_PARAM)) { - bool valid_irk = is_valid_irk(&compared_data.p_bonding_data->peer_id.id_info); - bool duplicate_irk = valid_irk && - (memcmp(p_whitelist->pp_irks[i]->irk, - compared_data.p_bonding_data->peer_id.id_info.irk, - BLE_GAP_SEC_KEY_LEN) == 0 - ); - if (duplicate_irk) - { - new_irk_whitelist_peer_ids[i] = compared_peer_id; - n_new_irk_whitelist_peer_ids++; - } + // Peer data coulnd't be found in flash or peer ID is not valid. + return NRF_ERROR_NOT_FOUND; + } + + uint8_t const addr_type = bond_data.peer_ble_id.id_addr_info.addr_type; + + if ((addr_type != BLE_GAP_ADDR_TYPE_PUBLIC) && + (addr_type != BLE_GAP_ADDR_TYPE_RANDOM_STATIC)) + { + // The address shared by the peer during bonding can't be whitelisted. + return BLE_ERROR_GAP_INVALID_BLE_ADDR; + } + + // Copy data to the buffer. + memcpy(&keys[i], &bond_data.peer_ble_id, sizeof(ble_gap_id_key_t)); + } + + return sd_ble_gap_device_identities_set(key_ptrs, NULL, peer_cnt); + + #else + + return NRF_ERROR_NOT_SUPPORTED; + + #endif +} + + +#if (NRF_SD_BLE_API_VERSION <= 2) + +static ret_code_t address_set_v2(uint8_t cycle_mode, ble_gap_addr_t * p_addr) +{ + NRF_PM_DEBUG_CHECK(p_addr != NULL); + + ret_code_t ret = sd_ble_gap_address_set(cycle_mode, p_addr); + + switch (ret) + { + case NRF_SUCCESS: + case NRF_ERROR_BUSY: + case NRF_ERROR_INVALID_STATE: + case NRF_ERROR_INVALID_PARAM: // If cycle_mode is not AUTO or NONE. + case BLE_ERROR_GAP_INVALID_BLE_ADDR: // If the GAP address is not valid. + return ret; + + default: + return NRF_ERROR_INTERNAL; + } +} + +#endif + + +ret_code_t im_id_addr_set(ble_gap_addr_t const * p_addr) +{ + #if (NRF_SD_BLE_API_VERSION <= 2) + + ret_code_t ret; + ble_gap_addr_t current_addr; + + NRF_PM_DEBUG_CHECK(p_addr != NULL); + + (void) sd_ble_gap_address_get(¤t_addr); + + ret = address_set_v2(BLE_GAP_ADDR_CYCLE_MODE_NONE, (ble_gap_addr_t *)p_addr); + if (ret != NRF_SUCCESS) + { + return ret; + } + + if ( current_addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE + || current_addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE) + { + // If currently using privacy, it must be re-enabled. + // We force AUTO when privacy is enabled. + ret = address_set_v2(BLE_GAP_ADDR_CYCLE_MODE_AUTO, ¤t_addr); + if (ret != NRF_SUCCESS) + { + return ret; } } - compared_peer_id = pdb_next_peer_id_get(compared_peer_id); - } - if (n_new_irk_whitelist_peer_ids != p_whitelist->irk_count) - { - return NRF_ERROR_NOT_FOUND; - } - else - { - for (uint32_t i = 0; i < n_new_irk_whitelist_peer_ids; i++) - { - m_im.irk_whitelist_peer_ids[i] = new_irk_whitelist_peer_ids[i]; - } - m_im.n_irk_whitelist_peer_ids = n_new_irk_whitelist_peer_ids; + + memcpy(&m_current_id_addr, p_addr, sizeof(ble_gap_addr_t)); + return NRF_SUCCESS; + + #else + + return sd_ble_gap_addr_set(p_addr); + + #endif +} + + +ret_code_t im_id_addr_get(ble_gap_addr_t * p_addr) +{ + NRF_PM_DEBUG_CHECK(p_addr != NULL); + + #if (NRF_SD_BLE_API_VERSION <= 2) + memcpy(p_addr, &m_current_id_addr, sizeof(ble_gap_addr_t)); + return NRF_SUCCESS; + #else + return sd_ble_gap_addr_get(p_addr); + #endif +} + + +ret_code_t im_privacy_set(pm_privacy_params_t const * p_privacy_params) +{ + #if (NRF_SD_BLE_API_VERSION <= 2) + + ret_code_t ret; + ble_gap_addr_t privacy_addr; + ble_gap_irk_t current_irk; + ble_opt_t privacy_options; + ble_opt_t current_privacy_options; + + NRF_PM_DEBUG_CHECK(p_privacy_params != NULL); + + privacy_addr.addr_type = p_privacy_params->private_addr_type; + privacy_options.gap_opt.privacy.p_irk = p_privacy_params->p_device_irk; + privacy_options.gap_opt.privacy.interval_s = p_privacy_params->private_addr_cycle_s; + current_privacy_options.gap_opt.privacy.p_irk = ¤t_irk; + + // Can not fail. + (void) sd_ble_opt_get(BLE_GAP_OPT_PRIVACY, ¤t_privacy_options); + (void) sd_ble_opt_set(BLE_GAP_OPT_PRIVACY, &privacy_options); + + if (p_privacy_params->privacy_mode == BLE_GAP_PRIVACY_MODE_OFF) + { + ret = address_set_v2(BLE_GAP_ADDR_CYCLE_MODE_NONE, &m_current_id_addr); + } + else + { + ret = address_set_v2(BLE_GAP_ADDR_CYCLE_MODE_AUTO, &privacy_addr); + } + + if (ret != NRF_SUCCESS) + { + // Restore previous settings. + (void) sd_ble_opt_set(BLE_GAP_OPT_PRIVACY, ¤t_privacy_options); + } + + // NRF_ERROR_BUSY, + // NRF_ERROR_INVALID_STATE, + // NRF_ERROR_INVALID_PARAM, if address type is not valid. + return ret; + + #else + + return sd_ble_gap_privacy_set(p_privacy_params); + + #endif +} + + +ret_code_t im_privacy_get(pm_privacy_params_t * p_privacy_params) +{ + #if (NRF_SD_BLE_API_VERSION <= 2) + + ble_gap_addr_t cur_addr; + ble_opt_t cur_privacy_opt; + + NRF_PM_DEBUG_CHECK(p_privacy_params != NULL); + NRF_PM_DEBUG_CHECK(p_privacy_params->p_device_irk != NULL); + + cur_privacy_opt.gap_opt.privacy.p_irk = p_privacy_params->p_device_irk; + + // Can not fail. + (void) sd_ble_gap_address_get(&cur_addr); + + if ( cur_addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE + || cur_addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE) + { + p_privacy_params->privacy_mode = BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY; + p_privacy_params->private_addr_type = cur_addr.addr_type; + } + else + { + p_privacy_params->privacy_mode = BLE_GAP_PRIVACY_MODE_OFF; + } + + // Can not fail. + (void) sd_ble_opt_get(BLE_GAP_OPT_PRIVACY, &cur_privacy_opt); + + p_privacy_params->private_addr_cycle_s = cur_privacy_opt.gap_opt.privacy.interval_s; + + return NRF_SUCCESS; + + #else + + return sd_ble_gap_privacy_get(p_privacy_params); + + #endif +} + + +/* Create a whitelist for the user using the cached list of peers. + * This whitelist is meant to be provided by the application to the Advertising module. + */ +ret_code_t im_whitelist_get(ble_gap_addr_t * p_addrs, + uint32_t * p_addr_cnt, + ble_gap_irk_t * p_irks, + uint32_t * p_irk_cnt) +{ + // One of the two buffers has to be provided. + NRF_PM_DEBUG_CHECK((p_addrs != NULL) || (p_irks != NULL)); + NRF_PM_DEBUG_CHECK((p_addr_cnt != NULL) || (p_irk_cnt != NULL)); + + if (((p_addr_cnt != NULL) && (m_wlisted_peer_cnt > *p_addr_cnt)) || + ((p_irk_cnt != NULL) && (m_wlisted_peer_cnt > *p_irk_cnt))) + { + // The size of the cached list of peers is larger than the provided buffers. + return NRF_ERROR_NO_MEM; } + + // NRF_SUCCESS or + // NRF_ERROR_NOT_FOUND, if a peer or its data were not found. + // BLE_ERROR_GAP_INVALID_BLE_ADDR, if a peer address can not be used for whitelisting. + return peers_id_keys_get(m_wlisted_peers, m_wlisted_peer_cnt, + p_addrs, p_addr_cnt, + p_irks, p_irk_cnt); +} + + +/* Copies the peers to whitelist into a local cache. + * The cached list will be used by im_whitelist_get() to retrieve the active whitelist. + * For SoftDevices 3x, also loads the peers' GAP addresses and whitelists them using + * sd_ble_gap_whitelist_set(). + */ +ret_code_t im_whitelist_set(pm_peer_id_t const * p_peers, + uint32_t peer_cnt) +{ + // Clear the cache of whitelisted peers. + memset(m_wlisted_peers, 0x00, sizeof(m_wlisted_peers)); + + if ((p_peers == NULL) || (peer_cnt == 0)) + { + // Clear the current whitelist. + m_wlisted_peer_cnt = 0; + #if (NRF_SD_BLE_API_VERSION >= 3) + // NRF_SUCCESS, or + // BLE_GAP_ERROR_WHITELIST_IN_USE + return sd_ble_gap_whitelist_set(NULL, 0); + #else + // The cached list of whitelisted peers is already cleared; nothing to do. + return NRF_SUCCESS; + #endif + } + + // @todo emdi: should not ever cache more than BLE_GAP_WHITELIST_ADDR_MAX_COUNT... + + // Copy the new whitelisted peers. + m_wlisted_peer_cnt = peer_cnt; + memcpy(m_wlisted_peers, p_peers, sizeof(pm_peer_id_t) * peer_cnt); + + #if (NRF_SD_BLE_API_VERSION >= 3) + + ret_code_t ret; + uint32_t wlist_addr_cnt = 0; + + ble_gap_addr_t const * addr_ptrs[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_addr_t addrs[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + + memset(addrs, 0x00, sizeof(addrs)); + + // Fetch GAP addresses for these peers, but don't fetch IRKs. + ret = peers_id_keys_get(p_peers, peer_cnt, addrs, &wlist_addr_cnt, NULL, NULL); + + if (ret != NRF_SUCCESS) + { + // NRF_ERROR_NOT_FOUND, if a peer or its data were not found. + // BLE_ERROR_GAP_INVALID_BLE_ADDR, if a peer address can not be used for whitelisting. + return ret; + } + + for (uint32_t i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; i++) + { + addr_ptrs[i] = &addrs[i]; + } + + // NRF_ERROR_DATA_SIZE, if peer_cnt > BLE_GAP_WHITELIST_ADDR_MAX_COUNT. + // BLE_ERROR_GAP_WHITELIST_IN_USE, if a whitelist is in use. + return sd_ble_gap_whitelist_set(addr_ptrs, peer_cnt); + + #else + + return NRF_SUCCESS; + + #endif } @@ -718,12 +1047,13 @@ ret_code_t im_whitelist_custom(ble_gap_whitelist_t const * p_whitelist) */ void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash) { - ret_code_t err_code; nrf_ecb_hal_data_t ecb_hal_data; + for (uint32_t i = 0; i < SOC_ECB_KEY_LENGTH; i++) { ecb_hal_data.key[i] = p_k[SOC_ECB_KEY_LENGTH - 1 - i]; } + memset(ecb_hal_data.cleartext, 0, SOC_ECB_KEY_LENGTH - IM_ADDR_CLEARTEXT_LENGTH); for (uint32_t i = 0; i < IM_ADDR_CLEARTEXT_LENGTH; i++) @@ -731,8 +1061,8 @@ void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash) ecb_hal_data.cleartext[SOC_ECB_KEY_LENGTH - 1 - i] = p_r[i]; } - err_code = sd_ecb_block_encrypt(&ecb_hal_data); // Can only return NRF_SUCCESS. - UNUSED_VARIABLE(err_code); + // Can only return NRF_SUCCESS. + (void) sd_ecb_block_encrypt(&ecb_hal_data); for (uint32_t i = 0; i < IM_ADDR_CIPHERTEXT_LENGTH; i++) { @@ -743,16 +1073,21 @@ void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash) bool im_address_resolve(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk) { + NRF_PM_DEBUG_CHECK(m_module_initialized); + + uint8_t hash[IM_ADDR_CIPHERTEXT_LENGTH]; + uint8_t local_hash[IM_ADDR_CIPHERTEXT_LENGTH]; + uint8_t prand[IM_ADDR_CLEARTEXT_LENGTH]; + if (p_addr->addr_type != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE) { return false; } - uint8_t hash[IM_ADDR_CIPHERTEXT_LENGTH]; - uint8_t local_hash[IM_ADDR_CIPHERTEXT_LENGTH]; - uint8_t prand[IM_ADDR_CLEARTEXT_LENGTH]; + memcpy(hash, p_addr->addr, IM_ADDR_CIPHERTEXT_LENGTH); memcpy(prand, &p_addr->addr[IM_ADDR_CIPHERTEXT_LENGTH], IM_ADDR_CLEARTEXT_LENGTH); ah(p_irk->irk, prand, local_hash); return (memcmp(hash, local_hash, IM_ADDR_CIPHERTEXT_LENGTH) == 0); } +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h index 27434bff3a..d8ab77818e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h @@ -37,16 +37,19 @@ */ - #ifndef PEER_ID_MANAGER_H__ #define PEER_ID_MANAGER_H__ #include #include "sdk_errors.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "peer_manager_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN @@ -88,17 +91,13 @@ typedef struct */ typedef void (*im_evt_handler_t)(im_evt_t const * p_event); -/**@brief Function for registering for events from the ID Manager module. + +/**@brief Function for initializing the Identity manager. * - * @note This will also initialize the module if needed. - * - * @param[in] evt_handler Callback for events from the ID Manager module. - * - * @retval NRF_SUCCESS Registration was successful. - * @retval NRF_ERROR_NO_MEM No more registrations possible. - * @retval NRF_ERROR_NULL evt_handler was NULL. + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INTERNAL If an error occurred. */ -ret_code_t im_register(im_evt_handler_t evt_handler); +ret_code_t im_init(void); /**@brief Function for dispatching SoftDevice events to the ID Manager module. @@ -126,16 +125,6 @@ pm_peer_id_t im_peer_id_get_by_conn_handle(uint16_t conn_handle); pm_peer_id_t im_peer_id_get_by_master_id(ble_gap_master_id_t * p_master_id); -/**@brief Function for getting the corresponding peer ID from an IRK match index, see @ref - * ble_gap_evt_connected_t. - * - * @param[in] irk_match_idx The IRK match index. - * - * @return The corresponding peer ID, or @ref PM_PEER_ID_INVALID if none could be resolved. - */ -pm_peer_id_t im_peer_id_get_by_irk_match_idx(uint8_t irk_match_idx); - - /**@brief Function for getting the corresponding connection handle from a peer ID. * * @param[in] peer_id The peer ID. @@ -182,6 +171,10 @@ ret_code_t im_ble_addr_get(uint16_t conn_handle, ble_gap_addr_t * p_ble_addr); bool im_master_id_is_valid(ble_gap_master_id_t const * p_master_id); +bool im_is_duplicate_bonding_data(pm_peer_data_bonding_t const * p_bonding_data1, + pm_peer_data_bonding_t const * p_bonding_data2); + + /**@brief Function for reporting that a new peer ID has been allocated for a specified connection. * * @param[in] conn_handle The connection. @@ -200,53 +193,78 @@ void im_new_peer_id(uint16_t conn_handle, pm_peer_id_t peer_id); ret_code_t im_peer_free(pm_peer_id_t peer_id); -/**@brief Function for informing this module of what whitelist will be used. +/**@brief Function to set the local Bluetooth identity address. * - * @details This function is meant to be used when the app wants to use a custom whitelist. - * When using peer manager, this function must be used if a custom whitelist is used. - * Only whitelisted IRKs are of any importance for this function. + * @details The local Bluetooth identity address is the address that identifies this device to other + * peers. The address type must be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref + * BLE_GAP_ADDR_TYPE_RANDOM_STATIC. The identity address cannot be changed while roles are + * running. * - * @note When using a whitelist, always use the whitelist created/set by the most recent - * call to @ref im_whitelist_create or to this function, whichever happened most recently. - * @note Do not call this function while scanning with another whitelist. - * @note Do not add any irks to the whitelist that are not present in the bonding data of a peer in - * the peer database. - * @note The whitelist is not altered in any way by calling this function. Only the internal state - * of the module is changed. + * @note This address will be distributed to the peer during bonding. + * If the address changes, the address stored in the peer device will not be valid and the + * ability to reconnect using the old address will be lost. * - * @param[in] p_whitelist The whitelist. + * @note By default the SoftDevice will set an address of type @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC + * upon being enabled. The address is a random number populated during the IC manufacturing + * process and remains unchanged for the lifetime of each IC. * - * @retval NRF_SUCCESS Whitelist successfully set. - * @retval NRF_ERROR_NULL p_whitelist was NULL. - * @retval NRF_ERROR_NOT_FOUND One or more of the whitelists irks was not found in the peer_database. + * @param[in] p_addr Pointer to address structure. + * + * @retval NRF_SUCCESS Address successfully set. + * @retval BLE_ERROR_GAP_INVALID_BLE_ADDR If the GAP address is invalid. + * @retval NRF_ERROR_BUSY Could not process at this time. Process SoftDevice events + * and retry. + * @retval NRF_ERROR_INVALID_STATE The identity address cannot be changed while advertising, + * scanning, or while in a connection. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ -ret_code_t im_whitelist_custom(ble_gap_whitelist_t const * p_whitelist); +ret_code_t im_id_addr_set(ble_gap_addr_t const * p_addr); -/** - * @brief Function for constructing a whitelist for use when advertising. +/**@brief Function to get the local Bluetooth identity address. * - * @note When advertising with whitelist, always use the whitelist created/set by the most recent - * call to this function or to @ref im_whitelist_custom, whichever happened most recently. - * @note Do not call this function while advertising with another whitelist. + * @note This will always return the identity address irrespective of the privacy settings, + * i.e. the address type will always be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref + * BLE_GAP_ADDR_TYPE_RANDOM_STATIC. * - * @param[in] p_peer_ids The ids of the peers to be added to the whitelist. - * @param[in] n_peer_ids The number of peer ids in p_peer_ids. - * @param[in,out] p_whitelist The constructed whitelist. Note that p_adv_whitelist->pp_addrs - * must be NULL or point to an array with size @ref - * BLE_GAP_WHITELIST_ADDR_MAX_COUNT and p_adv_whitelist->pp_irks - * must be NULL or point to an array with size @ref - * BLE_GAP_WHITELIST_IRK_MAX_COUNT. + * @param[out] p_addr Pointer to address structure to be filled in. * - * @retval NRF_SUCCESS Whitelist successfully created. - * @retval NRF_ERROR_NULL p_whitelist was NULL. + * @retval NRF_SUCCESS If the address was successfully retrieved. */ -ret_code_t im_whitelist_create(pm_peer_id_t * p_peer_ids, - uint8_t n_peer_ids, - ble_gap_whitelist_t * p_whitelist); +ret_code_t im_id_addr_get(ble_gap_addr_t * p_addr); -/** - * @brief Function for resolving a resolvable address with an identity resolution key (IRK). + +/**@brief Function to set privacy settings. + * + * @details Privacy settings cannot be set while advertising, scanning, or while in a connection. + * + * @param[in] p_privacy_params Privacy settings. + * + * @retval NRF_SUCCESS If privacy options were set successfully. + * @retval NRF_ERROR_NULL If @p p_privacy_params is NULL. + * @retval NRF_ERROR_INVALID_PARAM If the address type is not valid. + * @retval NRF_ERROR_BUSY If the request could not be processed at this time. + * Process SoftDevice events and retry. + * @retval NRF_ERROR_INVALID_STATE Privacy settings cannot be changed while BLE roles using + * privacy are enabled. + */ +ret_code_t im_privacy_set(pm_privacy_params_t const * p_privacy_params); + + +/**@brief Function to retrieve the current privacy settings. + * + * @details The privacy settings returned include the current device irk as well. + * + * @param[in] p_privacy_params Privacy settings. + * + * @retval NRF_SUCCESS Successfully retrieved privacy settings. + * @retval NRF_ERROR_NULL @c p_privacy_params is NULL. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. + */ +ret_code_t im_privacy_get(pm_privacy_params_t * p_privacy_params); + + +/**@brief Function for resolving a resolvable address with an identity resolution key (IRK). * * @details This function will use the ECB peripheral to resolve a resolvable address. * This can be used to resolve the identity of a device distributing a random @@ -262,40 +280,60 @@ ret_code_t im_whitelist_create(pm_peer_id_t * p_peer_ids, */ bool im_address_resolve(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk); -/**@brief Function for calculating the ah() hash function described in Bluetooth core specification - * 4.2 section 3.H.2.2.2. + +/**@brief Function for setting / clearing the whitelist. * - * @detail BLE uses a hash function to calculate the first half of a resolvable address - * from the second half of the address and an irk. This function will use the ECB - * periferal to hash these data acording to the Bluetooth core specification. + * @param p_peers The peers to whitelist. Pass NULL to clear the whitelist. + * @param peer_cnt The number of peers to whitelist. Pass zero to clear the whitelist. * - * @note The ECB expect little endian input and output. - * This function expect big endian and will reverse the data as necessary. - * - * @param[in] p_k The key used in the hash function. - * For address resolution this is should be the irk. - * The array must have a length of 16. - * @param[in] p_r The rand used in the hash function. For generating a new address - * this would be a random number. For resolving a resolvable address - * this would be the last half of the address being resolved. - * The array must have a length of 3. - * @param[out] p_local_hash The result of the hash operation. For address resolution this - * will match the first half of the address being resolved if and only - * if the irk used in the hash function is the same one used to generate - * the address. - * The array must have a length of 16. - * - * @note ====IMPORTANT==== - * This is a special modification to the original nRF5x SDK required by the mbed BLE API - * to be able to generate BLE private resolvable addresses. This function is used by - * the BLE API implementation for nRF5xSecurityManager::getAddressFromBondTable() in the - * ble-nrf52832 yotta module. - * ================= + * @retval NRF_SUCCESS If the whitelist was successfully set or cleared. + * @retval BLE_GAP_ERROR_WHITELIST_IN_USE If a whitelist is in use. + * @retval BLE_ERROR_GAP_INVALID_BLE_ADDR If any peer has an address which can not be used + * for whitelisting. + * @retval NRF_ERROR_NOT_FOUND If any peer or its data could not be found. + * @retval NRF_ERROR_DATA_SIZE If @p peer_cnt is greater than + * @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. */ -void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash); +ret_code_t im_whitelist_set(pm_peer_id_t const * p_peers, + uint32_t const peer_cnt); + + +/**@brief Retrieves the current whitelist, set by a previous call to @ref im_whitelist_set. + * + * @param[out] A buffer where to copy the GAP addresses. + * @param[inout] In: the size of the @p p_addrs buffer. + * Out: the number of address copied into the buffer. + * @param[out] A buffer where to copy the IRKs. + * @param[inout] In: the size of the @p p_irks buffer. + * Out: the number of IRKs copied into the buffer. + * + * @retval NRF_SUCCESS If the whitelist was successfully retreived. + * @retval BLE_ERROR_GAP_INVALID_BLE_ADDR If any peer has an address which can not be used for + * whitelisting. + * @retval NRF_ERROR_NOT_FOUND If the data for any of the cached whitelisted peers + * can not be found anymore. It might have been deleted in + * the meanwhile. + * @retval NRF_ERROR_NO_MEM If the provided buffers are too small. + */ +ret_code_t im_whitelist_get(ble_gap_addr_t * p_addrs, + uint32_t * p_addr_cnt, + ble_gap_irk_t * p_irks, + uint32_t * p_irk_cnt); + + +/**@brief Set the device identities list. + */ +ret_code_t im_device_identities_list_set(pm_peer_id_t const * p_peers, + uint32_t peer_cnt); + /** @} * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* PEER_ID_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.c index 2282cc48d3..778ee3d1e0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.c @@ -36,13 +36,12 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "peer_data.h" #include "peer_manager_types.h" #include "fds.h" -#include "sdk_common.h" void peer_data_parts_get(pm_peer_data_const_t const * p_peer_data, fds_record_chunk_t * p_chunks, uint16_t * p_n_chunks) @@ -88,5 +87,4 @@ ret_code_t peer_data_deserialize(pm_peer_data_flash_t const * p_in_data, pm_peer } return err_code; } - - +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.h index 3c1f373087..6e2f9b3b24 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data.h @@ -37,7 +37,6 @@ */ - #ifndef PEER_DATA_H__ #define PEER_DATA_H__ @@ -46,6 +45,10 @@ #include "peer_manager_internal.h" #include "fds.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN @@ -77,8 +80,13 @@ void peer_data_parts_get(pm_peer_data_const_t const * p_peer_data, fds_record_ch */ ret_code_t peer_data_deserialize(pm_peer_data_flash_t const * p_in_data, pm_peer_data_t * p_out_data); -/** @} +/** @} * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* PEER_DATA_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.c index 1f4e05dd5b..29e7557180 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.c @@ -36,8 +36,8 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "peer_data_storage.h" #include @@ -48,84 +48,44 @@ #include "peer_id.h" #include "peer_data.h" #include "fds.h" -#include "sdk_common.h" - - -// The number of user that can register with the module. -#define MAX_REGISTRANTS 6 - -// Macro for verifying that param is not zero. -#define VERIFY_PARAM_NOT_ZERO(param) \ -do \ -{ \ - if (param == 0) \ - { \ - return NRF_ERROR_NULL; \ - } \ -} while(0) // Macro for verifying that the peer id is within a valid range. -#define VERIFY_PEER_ID_IN_RANGE(id) \ -do \ -{ \ - if (id >= PM_PEER_ID_N_AVAILABLE_IDS) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } \ -} while (0) - +#define VERIFY_PEER_ID_IN_RANGE(id) VERIFY_FALSE((id >= PM_PEER_ID_N_AVAILABLE_IDS), \ + NRF_ERROR_INVALID_PARAM) // Macro for verifying that the peer data id is withing a valid range. -#define VERIFY_PEER_DATA_ID_IN_RANGE(id) \ -do \ -{ \ - if (!PM_PEER_DATA_ID_IS_VALID(id)) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } \ -} while (0) +#define VERIFY_PEER_DATA_ID_IN_RANGE(id) VERIFY_TRUE(peer_data_id_is_valid(id), \ + NRF_ERROR_INVALID_PARAM) + +// The number of registered event handlers. +#define PDS_EVENT_HANDLERS_CNT (sizeof(m_evt_handlers) / sizeof(m_evt_handlers[0])) -// Macro for initializing the peer ID tracking system if it is not already initialized. -#define PEER_IDS_INITIALIZE() \ -do \ -{ \ - if (!m_pds.peer_ids_initialized) \ - { \ - peer_ids_init(); \ - } \ -} while (0) +// Peer Data Storage event handler in Peer Database. +extern void pdb_pds_evt_handler(pds_evt_t const *); - -typedef struct +// Peer Data Storage events' handlers. +// The number of elements in this array is PDS_EVENT_HANDLERS_CNT. +static pds_evt_handler_t const m_evt_handlers[] = { - bool peer_ids_initialized; - pds_evt_handler_t evt_handlers[MAX_REGISTRANTS]; - uint8_t n_registrants; - bool clearing; - bool clear_queued; -} pds_t; + pdb_pds_evt_handler, +}; + +static bool m_module_initialized = false; +static bool m_peer_delete_queued = false; +static bool m_peer_delete_ongoing = false; + +// A token used for Flash Data Storage searches. +static fds_find_token_t m_fds_ftok; -static pds_t m_pds = { .n_registrants = 0 }; - - -#define MODULE_INITIALIZED (m_pds.n_registrants > 0) /**< Expression which is true when the module is initialized. */ -#include "sdk_macros.h" - -static void internal_state_reset(pds_t * p_pds) -{ - memset(p_pds, 0, sizeof(pds_t)); -} - - -// Function for dispatching outbound events to all registered event handlers. +// Function for dispatching events to all registered event handlers. static void pds_evt_send(pds_evt_t * p_event) { - for (uint32_t i = 0; i < m_pds.n_registrants; i++) + for (uint32_t i = 0; i < PDS_EVENT_HANDLERS_CNT; i++) { - m_pds.evt_handlers[i](p_event); + m_evt_handlers[i](p_event); } } @@ -147,57 +107,87 @@ static pm_peer_id_t file_id_to_peer_id(uint16_t file_id) // Function to convert peer data IDs to record keys. static uint16_t peer_data_id_to_record_key(pm_peer_data_id_t peer_data_id) { - return (uint16_t)peer_data_id + (uint16_t)PEER_DATA_ID_TO_RECORD_KEY; + return (uint16_t)(peer_data_id + DATA_ID_TO_RECORD_KEY); } // Function to convert record keys to peer data IDs. static pm_peer_data_id_t record_key_to_peer_data_id(uint16_t record_key) { - return (pm_peer_data_id_t)(record_key + RECORD_KEY_TO_PEER_DATA_ID); + return (pm_peer_data_id_t)(record_key + RECORD_KEY_TO_DATA_ID); } -// Function for clearing all peer data of one peer. -// These operations will be sent to FDS one at a time. -static void peer_data_clear() +// Function for checking whether a file ID is relevant for the Peer Manager. +static bool file_id_within_pm_range(uint16_t file_id) { - ret_code_t retval; + return ((PDS_FIRST_RESERVED_FILE_ID <= file_id) + && (file_id <= PDS_LAST_RESERVED_FILE_ID)); +} + + +// Function for checking whether a record key is relevant for the Peer Manager. +static bool record_key_within_pm_range(uint16_t record_key) +{ + return ((PDS_FIRST_RESERVED_RECORD_KEY <= record_key) + && (record_key <= PDS_LAST_RESERVED_RECORD_KEY)); +} + + +static bool peer_data_id_is_valid(pm_peer_data_id_t data_id) +{ + return ((data_id == PM_PEER_DATA_ID_BONDING) || + (data_id == PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING) || + (data_id == PM_PEER_DATA_ID_GATT_LOCAL) || + (data_id == PM_PEER_DATA_ID_GATT_REMOTE) || + (data_id == PM_PEER_DATA_ID_PEER_RANK) || + (data_id == PM_PEER_DATA_ID_APPLICATION)); +} + + +// Function for deleting all data beloning to a peer. +// These operations will be sent to FDS one at a time. +static void peer_data_delete() +{ + ret_code_t ret; + pm_peer_id_t peer_id; uint16_t file_id; fds_record_desc_t desc; - fds_find_token_t token = {0}; - pm_peer_id_t peer_id = peer_id_get_next_deleted(PM_PEER_ID_INVALID); + fds_find_token_t ftok; + + memset(&ftok, 0x00, sizeof(fds_find_token_t)); + peer_id = peer_id_get_next_deleted(PM_PEER_ID_INVALID); while ( (peer_id != PM_PEER_ID_INVALID) - && (fds_record_find_in_file(peer_id_to_file_id(peer_id), &desc, &token) + && (fds_record_find_in_file(peer_id_to_file_id(peer_id), &desc, &ftok) == FDS_ERR_NOT_FOUND)) { peer_id_free(peer_id); peer_id = peer_id_get_next_deleted(peer_id); } - if (!m_pds.clearing && (peer_id != PM_PEER_ID_INVALID)) + if (!m_peer_delete_ongoing && (peer_id != PM_PEER_ID_INVALID)) { - file_id = peer_id_to_file_id(peer_id); - retval = fds_file_delete(file_id); + m_peer_delete_ongoing = true; - if (retval == FDS_SUCCESS) + file_id = peer_id_to_file_id(peer_id); + ret = fds_file_delete(file_id); + + if (ret == FDS_ERR_NO_SPACE_IN_QUEUES) { - m_pds.clearing = true; + m_peer_delete_queued = true; } - else if (retval == FDS_ERR_NO_SPACE_IN_QUEUES) - { - m_pds.clear_queued = true; - } - else + else if (ret != NRF_SUCCESS) { + m_peer_delete_ongoing = false; + pds_evt_t pds_evt; pds_evt.evt_id = PDS_EVT_ERROR_UNEXPECTED; pds_evt.peer_id = peer_id; pds_evt.data_id = PM_PEER_DATA_ID_INVALID; pds_evt.store_token = PM_STORE_TOKEN_INVALID; - pds_evt.result = retval; + pds_evt.result = ret; pds_evt_send(&pds_evt); } @@ -205,47 +195,54 @@ static void peer_data_clear() } -static ret_code_t find_fds_item(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - fds_record_desc_t * const p_desc) +static ret_code_t peer_data_find(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + fds_record_desc_t * const p_desc) { - fds_find_token_t find_tok = {0}; + ret_code_t ret; + fds_find_token_t ftok; - VERIFY_PEER_ID_IN_RANGE(peer_id); - VERIFY_PEER_DATA_ID_IN_RANGE(data_id); - // pp_record verified by caller. + NRF_PM_DEBUG_CHECK(peer_id < PM_PEER_ID_N_AVAILABLE_IDS); + NRF_PM_DEBUG_CHECK(peer_data_id_is_valid(data_id)); + NRF_PM_DEBUG_CHECK(p_desc != NULL); + + memset(&ftok, 0x00, sizeof(fds_find_token_t)); uint16_t file_id = peer_id_to_file_id(peer_id); uint16_t record_key = peer_data_id_to_record_key(data_id); - return fds_record_find(file_id, record_key, p_desc, &find_tok); + ret = fds_record_find(file_id, record_key, p_desc, &ftok); + + if (ret != FDS_SUCCESS) + { + return NRF_ERROR_NOT_FOUND; + } + + return NRF_SUCCESS; } -static void peer_ids_init() +static void peer_ids_load() { fds_record_desc_t record_desc; fds_flash_record_t record; - fds_find_token_t find_tok = {0}; + fds_find_token_t ftok; + + memset(&ftok, 0x00, sizeof(fds_find_token_t)); uint16_t const record_key = peer_data_id_to_record_key(PM_PEER_DATA_ID_BONDING); - if (!m_pds.peer_ids_initialized) + while (fds_record_find_by_key(record_key, &record_desc, &ftok) == FDS_SUCCESS) { - while(fds_record_find_by_key(record_key, &record_desc, &find_tok) == FDS_SUCCESS) - { - pm_peer_id_t peer_id; + pm_peer_id_t peer_id; - // It is safe to ignore the return value since we just obtained - // this descriptor and also 'record' is different from NULL. - (void)fds_record_open(&record_desc, &record); - peer_id = file_id_to_peer_id(record.p_header->ic.file_id); - (void)fds_record_close(&record_desc); + // It is safe to ignore the return value since the descriptor was + // just obtained and also 'record' is different from NULL. + (void)fds_record_open(&record_desc, &record); + peer_id = file_id_to_peer_id(record.p_header->ic.file_id); + (void)fds_record_close(&record_desc); - (void)peer_id_allocate(peer_id); - } - - m_pds.peer_ids_initialized = true; + (void)peer_id_allocate(peer_id); } } @@ -253,45 +250,57 @@ static void peer_ids_init() static void fds_evt_handler(fds_evt_t const * const p_fds_evt) { pds_evt_t pds_evt; - bool send_event = true; pds_evt.result = (p_fds_evt->result == FDS_SUCCESS); - switch(p_fds_evt->id) + switch (p_fds_evt->id) { case FDS_EVT_WRITE: - pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_STORED : - PDS_EVT_ERROR_STORE; - - pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->write.file_id); - pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->write.record_key); - pds_evt.result = p_fds_evt->result; - pds_evt.store_token = p_fds_evt->write.record_id; - break; - case FDS_EVT_UPDATE: - pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_UPDATED : - PDS_EVT_ERROR_UPDATE; + if ( file_id_within_pm_range(p_fds_evt->write.file_id) + || record_key_within_pm_range(p_fds_evt->write.record_key)) + { + pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->write.file_id); + pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->write.record_key); - pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->write.file_id); - pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->write.record_key); - pds_evt.result = p_fds_evt->result; - pds_evt.store_token = p_fds_evt->write.record_id; + if (p_fds_evt->id == FDS_EVT_WRITE) + { + pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_STORED : + PDS_EVT_ERROR_STORE; + } + else + { + pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_UPDATED : + PDS_EVT_ERROR_UPDATE; + } + + pds_evt.result = p_fds_evt->result; + pds_evt.store_token = p_fds_evt->write.record_id; + + pds_evt_send(&pds_evt); + } break; case FDS_EVT_DEL_RECORD: - pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_CLEARED : - PDS_EVT_ERROR_CLEAR; + if ( file_id_within_pm_range(p_fds_evt->del.file_id) + || record_key_within_pm_range(p_fds_evt->del.record_key)) + { + pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->del.file_id); + pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->del.record_key); - pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->del.file_id); - pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->del.record_key); - pds_evt.store_token = p_fds_evt->del.record_id; + pds_evt.evt_id = (p_fds_evt->result == FDS_SUCCESS) ? PDS_EVT_CLEARED : + PDS_EVT_ERROR_CLEAR; + + pds_evt.store_token = p_fds_evt->del.record_id; + + pds_evt_send(&pds_evt); + } break; case FDS_EVT_DEL_FILE: { - if ((p_fds_evt->del.record_key == FDS_RECORD_KEY_DIRTY) && - (p_fds_evt->del.file_id != FDS_FILE_ID_INVALID)) + if ( file_id_within_pm_range(p_fds_evt->del.file_id) + && (p_fds_evt->del.record_key == FDS_RECORD_KEY_DIRTY)) { pds_evt.peer_id = file_id_to_peer_id(p_fds_evt->del.file_id); pds_evt.data_id = record_key_to_peer_data_id(p_fds_evt->del.record_key); @@ -306,198 +315,199 @@ static void fds_evt_handler(fds_evt_t const * const p_fds_evt) { pds_evt.evt_id = PDS_EVT_ERROR_PEER_ID_CLEAR; } - m_pds.clearing = false; - m_pds.clear_queued = false; - peer_data_clear(); + m_peer_delete_queued = false; + m_peer_delete_ongoing = false; + + peer_data_delete(); + + pds_evt_send(&pds_evt); } } break; case FDS_EVT_GC: pds_evt.evt_id = PDS_EVT_COMPRESSED; + pds_evt_send(&pds_evt); break; default: - send_event = false; break; } - if (send_event) + if (m_peer_delete_queued) { - pds_evt_send(&pds_evt); - } - - if (m_pds.clear_queued) - { - m_pds.clear_queued = false; - peer_data_clear(); + m_peer_delete_queued = false; + peer_data_delete(); } } -ret_code_t pds_register(pds_evt_handler_t evt_handler) +ret_code_t pds_init() { - if (m_pds.n_registrants >= MAX_REGISTRANTS) + ret_code_t ret; + + // Check for re-initialization if debugging. + NRF_PM_DEBUG_CHECK(!m_module_initialized); + + ret = fds_register(fds_evt_handler); + if (ret != NRF_SUCCESS) { - return NRF_ERROR_NO_MEM; + return NRF_ERROR_INTERNAL; } - VERIFY_PARAM_NOT_NULL(evt_handler); - - if (!MODULE_INITIALIZED) + ret = fds_init(); + if (ret != NRF_SUCCESS) { - ret_code_t retval; - internal_state_reset(&m_pds); - peer_id_init(); - - retval = fds_register(fds_evt_handler); - if (retval != FDS_SUCCESS) - { - return NRF_ERROR_NO_MEM; - } - - retval = fds_init(); - if (retval != FDS_SUCCESS) - { - return NRF_ERROR_INTERNAL; - } + return NRF_ERROR_STORAGE_FULL; } - m_pds.evt_handlers[m_pds.n_registrants] = evt_handler; - m_pds.n_registrants += 1; + peer_id_init(); + peer_ids_load(); + + m_module_initialized = true; return NRF_SUCCESS; } -ret_code_t pds_peer_data_read_ptr_get(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_flash_t * p_data, - pm_store_token_t * p_token) +ret_code_t pds_peer_data_read(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_t * const p_data, + uint32_t const * const p_buf_len) { - ret_code_t retval; + ret_code_t ret; + fds_record_desc_t rec_desc; + fds_flash_record_t rec_flash; - fds_flash_record_t record; - fds_record_desc_t record_desc; + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_data != NULL); - VERIFY_MODULE_INITIALIZED(); VERIFY_PEER_ID_IN_RANGE(peer_id); VERIFY_PEER_DATA_ID_IN_RANGE(data_id); - VERIFY_PARAM_NOT_NULL(p_data); - retval = find_fds_item(peer_id, data_id, &record_desc); - if (retval != FDS_SUCCESS) + ret = peer_data_find(peer_id, data_id, &rec_desc); + + if (ret != NRF_SUCCESS) { return NRF_ERROR_NOT_FOUND; } - // Shouldn't fail, unless the record was deleted. - (void)fds_record_open(&record_desc, &record); + // Shouldn't fail, unless the record was deleted in the meanwhile or the CRC check has failed. + ret = fds_record_open(&rec_desc, &rec_flash); - if (p_data != NULL) + if (ret != NRF_SUCCESS) { - p_data->data_id = data_id; - p_data->length_words = record.p_header->tl.length_words; - p_data->p_all_data = record.p_data; + return NRF_ERROR_NOT_FOUND; } - if (p_token != NULL) + // @note emdi: could this actually be set by the caller and used instead + // of an additional parameter (data_id) ? + p_data->data_id = data_id; + p_data->length_words = rec_flash.p_header->tl.length_words; + + // If p_buf_len is NULL, provide a pointer to data in flash, otherwise, + // check that the buffer is large enough and copy the data in flash into the buffer. + if (p_buf_len != NULL) { - *p_token = (uint32_t)record.p_header->record_id; + uint32_t const data_len_bytes = (p_data->length_words * sizeof(uint32_t)); + + if ((*p_buf_len) <= data_len_bytes) + { + memcpy(p_data->p_all_data, rec_flash.p_data, data_len_bytes); + } + else + { + return NRF_ERROR_NO_MEM; + } + } + else + { + // The cast is necessary because if no buffer is provided, we just copy the pointer, + // but it that case it should be considered a pointer to const data by the caller, + // since it is a pointer to data in flash. + p_data->p_all_data = (void*)rec_flash.p_data; } - // Shouldn't fail, unless the record was already closed. - (void)fds_record_close(&record_desc); + // Shouldn't fail unless the record was already closed, in which case it can be ignored. + (void)fds_record_close(&rec_desc); return NRF_SUCCESS; } -ret_code_t pds_peer_data_lock(pm_store_token_t store_token) +void pds_peer_data_iterate_prepare(void) { - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_ZERO(store_token); - - // TODO: Not implemented in fds yet. - - return NRF_SUCCESS; + memset(&m_fds_ftok, 0x00, sizeof(fds_find_token_t)); } -ret_code_t pds_peer_data_verify(pm_store_token_t store_token) +bool pds_peer_data_iterate(pm_peer_data_id_t data_id, + pm_peer_id_t * const p_peer_id, + pm_peer_data_flash_t * const p_data) { - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_ZERO(store_token); + ret_code_t ret; + uint16_t rec_key; + fds_record_desc_t rec_desc; + fds_flash_record_t rec_flash; - // TODO: Not implemented in fds yet. + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_peer_id != NULL); + NRF_PM_DEBUG_CHECK(p_data != NULL); - return NRF_SUCCESS; + // @note emdi: should we check the data_id ? + rec_key = peer_data_id_to_record_key(data_id); + + if (fds_record_find_by_key(rec_key, &rec_desc, &m_fds_ftok) != NRF_SUCCESS) + { + return false; + } + + ret = fds_record_open(&rec_desc, &rec_flash); + + if (ret != NRF_SUCCESS) + { + // It can only happen if the record was deleted after the call to fds_record_find_by_key(), + // before we could open it, or if CRC support was enabled in Flash Data Storage at compile + // time and the CRC check failed. + return false; + } + + p_data->data_id = data_id; + p_data->length_words = rec_flash.p_header->tl.length_words; + p_data->p_all_data = rec_flash.p_data; + + *p_peer_id = file_id_to_peer_id(rec_flash.p_header->ic.file_id); + + (void)fds_record_close(&rec_desc); + + return true; } -ret_code_t pds_peer_data_read(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_t * p_data, - uint16_t * p_len_words) +ret_code_t pds_space_reserve(pm_peer_data_const_t const * p_peer_data, + pm_prepare_token_t * p_prepare_token) { - ret_code_t retval; - pm_peer_data_flash_t peer_data_flash; + ret_code_t ret; - VERIFY_PEER_ID_IN_RANGE(peer_id); - VERIFY_PEER_DATA_ID_IN_RANGE(data_id); - VERIFY_PARAM_NOT_NULL(p_len_words); - VERIFY_PARAM_NOT_NULL(p_data); + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_peer_data != NULL); + NRF_PM_DEBUG_CHECK(p_prepare_token != NULL); - retval = pds_peer_data_read_ptr_get(peer_id, data_id, &peer_data_flash, NULL); - if (retval != NRF_SUCCESS) - { - return retval; - } - - if ((*p_len_words) == 0) - { - (*p_len_words) = peer_data_flash.length_words; - return NRF_SUCCESS; - } - else if ((*p_len_words) < peer_data_flash.length_words) - { - return NRF_ERROR_NO_MEM; - } - - VERIFY_PARAM_NOT_NULL(p_data->p_all_data); - - retval = peer_data_deserialize(&peer_data_flash, p_data); - - return retval; -} - - -ret_code_t pds_peer_data_write_prepare(pm_peer_data_const_t const * p_peer_data, - pm_prepare_token_t * p_prepare_token) -{ - ret_code_t retval; - - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_NULL(p_peer_data); VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id); - //VERIFY_PARAM_NOT_NULL(p_prepare_token); redundant, see fds_reserve(). - retval = fds_reserve((fds_reserve_token_t*)p_prepare_token, p_peer_data->length_words); + ret = fds_reserve((fds_reserve_token_t*)p_prepare_token, p_peer_data->length_words); - switch (retval) + switch (ret) { case FDS_SUCCESS: return NRF_SUCCESS; - case FDS_ERR_NULL_ARG: - return NRF_ERROR_NULL; - case FDS_ERR_RECORD_TOO_LARGE: return NRF_ERROR_INVALID_LENGTH; case FDS_ERR_NO_SPACE_IN_FLASH: - return NRF_ERROR_NO_MEM; + return NRF_ERROR_STORAGE_FULL; default: return NRF_ERROR_INTERNAL; @@ -505,119 +515,85 @@ ret_code_t pds_peer_data_write_prepare(pm_peer_data_const_t const * p_peer_data, } -ret_code_t pds_peer_data_write_prepare_cancel(pm_prepare_token_t prepare_token) +ret_code_t pds_space_reserve_cancel(pm_prepare_token_t prepare_token) { - ret_code_t retval; + ret_code_t ret; - VERIFY_MODULE_INITIALIZED(); - VERIFY_PARAM_NOT_ZERO(prepare_token); + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(prepare_token != PDS_PREPARE_TOKEN_INVALID); - retval = fds_reserve_cancel((fds_reserve_token_t*)&prepare_token); + ret = fds_reserve_cancel((fds_reserve_token_t*)&prepare_token); - switch (retval) + if (ret != FDS_SUCCESS) { - case FDS_SUCCESS: - return NRF_SUCCESS; - - case FDS_ERR_NULL_ARG: - return NRF_ERROR_NULL; - - default: - return NRF_ERROR_INTERNAL; + return NRF_ERROR_INTERNAL; } + + return NRF_SUCCESS; } -ret_code_t pds_peer_data_write_prepared(pm_peer_id_t peer_id, - pm_peer_data_const_t const * p_peer_data, - pm_prepare_token_t prepare_token, - pm_store_token_t * p_store_token) -{ - ret_code_t retval; - fds_record_t record; - fds_record_desc_t record_desc; - fds_record_chunk_t chunks[2]; - uint16_t n_chunks; - - VERIFY_MODULE_INITIALIZED(); - VERIFY_PEER_ID_IN_RANGE(peer_id); - VERIFY_PARAM_NOT_NULL(p_peer_data); - VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id); - VERIFY_PARAM_NOT_ZERO(prepare_token); - - // Create chunks. - peer_data_parts_get(p_peer_data, chunks, &n_chunks); - - // Prepare the record to be written. - record.file_id = peer_id_to_file_id(peer_id); - record.key = peer_data_id_to_record_key(p_peer_data->data_id); - record.data.p_chunks = chunks; - record.data.num_chunks = n_chunks; - - retval = fds_record_write_reserved(&record_desc, - &record, - (fds_reserve_token_t*)&prepare_token); - - if ((retval == FDS_SUCCESS) && (p_store_token != NULL)) - { - // If fds_record_write_reserved() returned sucessfully, it is safe - // to ignore the return value from fds_record_id_from_desc() since - // the descriptor is valid, and also p_store_token is different from NULL. - (void)fds_record_id_from_desc(&record_desc, (uint32_t*)p_store_token); - } - - switch (retval) - { - case FDS_SUCCESS: - return NRF_SUCCESS; - - case FDS_ERR_BUSY: - case FDS_ERR_NO_SPACE_IN_QUEUES: - return NRF_ERROR_BUSY; - - default: - return NRF_ERROR_INTERNAL; - } -} - - -ret_code_t pds_peer_data_write(pm_peer_id_t peer_id, +ret_code_t pds_peer_data_store(pm_peer_id_t peer_id, pm_peer_data_const_t const * p_peer_data, + pm_prepare_token_t prepare_token, pm_store_token_t * p_store_token) { - ret_code_t retval; - fds_record_t record; - fds_record_desc_t record_desc; - fds_record_chunk_t chunks[2]; - uint16_t n_chunks; + ret_code_t ret; + fds_record_t rec; + fds_record_desc_t rec_desc; + fds_record_chunk_t rec_chunk; + + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_peer_data != NULL); - VERIFY_MODULE_INITIALIZED(); VERIFY_PEER_ID_IN_RANGE(peer_id); - VERIFY_PARAM_NOT_NULL(p_peer_data); VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id); - // Create chunks. - peer_data_parts_get(p_peer_data, chunks, &n_chunks); + // Prepare chunk. + rec_chunk.p_data = p_peer_data->p_all_data; + rec_chunk.length_words = p_peer_data->length_words; - // Prepare the record to be written. - record.file_id = peer_id_to_file_id(peer_id); - record.key = peer_data_id_to_record_key(p_peer_data->data_id); - record.data.p_chunks = chunks; - record.data.num_chunks = n_chunks; + // Prepare the record to be stored in flash. + rec.file_id = peer_id_to_file_id(peer_id); + rec.key = peer_data_id_to_record_key(p_peer_data->data_id); + rec.data.p_chunks = &rec_chunk; + rec.data.num_chunks = 1; - retval = fds_record_write(&record_desc, &record); + ret = peer_data_find(peer_id, p_peer_data->data_id, &rec_desc); - if ((retval == FDS_SUCCESS) && (p_store_token != NULL)) + if (ret == NRF_ERROR_NOT_FOUND) { - // If fds_record_write() returned sucessfully, it is safe - // to ignore the return value from fds_record_id_from_desc() since - // the descriptor is valid, and also p_store_token is different from NULL. - (void)fds_record_id_from_desc(&record_desc, (uint32_t*)p_store_token); + // No previous data exists in flash. + if (prepare_token == PDS_PREPARE_TOKEN_INVALID) + { + // No space was previously reserved. + ret = fds_record_write(&rec_desc, &rec); + } + else + { + // Space for this record was previously reserved. + ret = fds_record_write_reserved(&rec_desc, &rec, (fds_reserve_token_t*)&prepare_token); + } + } + else // NRF_SUCCESS + { + // Token shouldn't be zero at this point. + // NRF_PM_DEBUG_CHECK(prepare_token != PDS_PREPARE_TOKEN_INVALID); + + (void)fds_reserve_cancel((fds_reserve_token_t*)&prepare_token); + + // Update existing record. + ret = fds_record_update(&rec_desc, &rec); } - switch (retval) + switch (ret) { case FDS_SUCCESS: + if (p_store_token != NULL) + { + // Update the store token. + (void)fds_record_id_from_desc(&rec_desc, (uint32_t*)p_store_token); + } return NRF_SUCCESS; case FDS_ERR_BUSY: @@ -625,7 +601,7 @@ ret_code_t pds_peer_data_write(pm_peer_id_t peer_id, return NRF_ERROR_BUSY; case FDS_ERR_NO_SPACE_IN_FLASH: - return NRF_ERROR_NO_MEM; + return NRF_ERROR_STORAGE_FULL; default: return NRF_ERROR_INTERNAL; @@ -633,86 +609,27 @@ ret_code_t pds_peer_data_write(pm_peer_id_t peer_id, } -ret_code_t pds_peer_data_update(pm_peer_id_t peer_id, - pm_peer_data_const_t const * p_peer_data, - pm_store_token_t old_token, - pm_store_token_t * p_store_token) +// @note emdi: unused.. +ret_code_t pds_peer_data_delete(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) { - ret_code_t retval; - fds_record_t record; - fds_record_desc_t record_desc; - fds_record_chunk_t chunks[2]; - uint16_t n_chunks; - - VERIFY_MODULE_INITIALIZED(); - VERIFY_PEER_ID_IN_RANGE(peer_id); - VERIFY_PARAM_NOT_NULL(p_peer_data); - VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_id); - - // Create chunks. - peer_data_parts_get(p_peer_data, chunks, &n_chunks); - - // Prepare the record to be written. - record.file_id = peer_id_to_file_id(peer_id); - record.key = peer_data_id_to_record_key(p_peer_data->data_id); - record.data.p_chunks = chunks; - record.data.num_chunks = n_chunks; - - // Obtain the descriptor of the record to be updated. - // It is safe to ignore the return value if record_desc is different from NULL. - (void)fds_descriptor_from_rec_id(&record_desc, (uint32_t)old_token); - - retval = fds_record_update(&record_desc, &record); - - if ((retval == FDS_SUCCESS) && (p_store_token != NULL)) - { - // If fds_record_update() returned sucessfully, it is safe - // to ignore the return value from fds_record_id_from_desc() since - // the descriptor is valid, and also p_store_token is different from NULL. - (void)fds_record_id_from_desc(&record_desc, (uint32_t*)p_store_token); - } - - switch (retval) - { - case FDS_SUCCESS: - return NRF_SUCCESS; - - case FDS_ERR_BUSY: - case FDS_ERR_NO_SPACE_IN_QUEUES: - return NRF_ERROR_BUSY; - - case FDS_ERR_NO_SPACE_IN_FLASH: - return NRF_ERROR_NO_MEM; - - default: - return NRF_ERROR_INTERNAL; - } -} - -ret_code_t pds_peer_data_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) -{ - ret_code_t retval; - uint16_t file_id; - uint16_t record_key; + ret_code_t ret; fds_record_desc_t record_desc; - fds_find_token_t find_tok = {0}; - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); + VERIFY_PEER_ID_IN_RANGE(peer_id); VERIFY_PEER_DATA_ID_IN_RANGE(data_id); - file_id = peer_id_to_file_id(peer_id); - record_key = peer_data_id_to_record_key(data_id); + ret = peer_data_find(peer_id, data_id, &record_desc); - retval = fds_record_find(file_id, record_key, &record_desc, &find_tok); - if(retval != FDS_SUCCESS) + if (ret != NRF_SUCCESS) { return NRF_ERROR_NOT_FOUND; } - retval = fds_record_delete(&record_desc); + ret = fds_record_delete(&record_desc); - switch (retval) + switch (ret) { case FDS_SUCCESS: return NRF_SUCCESS; @@ -728,23 +645,18 @@ ret_code_t pds_peer_data_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) pm_peer_id_t pds_peer_id_allocate(void) { - if (!MODULE_INITIALIZED) - { - return PM_PEER_ID_INVALID; - } - PEER_IDS_INITIALIZE(); + NRF_PM_DEBUG_CHECK(m_module_initialized); return peer_id_allocate(PM_PEER_ID_INVALID); } ret_code_t pds_peer_id_free(pm_peer_id_t peer_id) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); VERIFY_PEER_ID_IN_RANGE(peer_id); - PEER_IDS_INITIALIZE(); (void)peer_id_delete(peer_id); - peer_data_clear(); + peer_data_delete(); return NRF_SUCCESS; } @@ -752,36 +664,28 @@ ret_code_t pds_peer_id_free(pm_peer_id_t peer_id) bool pds_peer_id_is_allocated(pm_peer_id_t peer_id) { - if (!MODULE_INITIALIZED) - { - return false; - } - PEER_IDS_INITIALIZE(); - + NRF_PM_DEBUG_CHECK(m_module_initialized); return peer_id_is_allocated(peer_id); } pm_peer_id_t pds_next_peer_id_get(pm_peer_id_t prev_peer_id) { - if (!MODULE_INITIALIZED) - { - return PM_PEER_ID_INVALID; - } - PEER_IDS_INITIALIZE(); - + NRF_PM_DEBUG_CHECK(m_module_initialized); return peer_id_get_next_used(prev_peer_id); } -uint32_t pds_n_peers(void) +pm_peer_id_t pds_next_deleted_peer_id_get(pm_peer_id_t prev_peer_id) { - if (!MODULE_INITIALIZED) - { - return 0; - } - PEER_IDS_INITIALIZE(); - return peer_id_n_ids(); + NRF_PM_DEBUG_CHECK(m_module_initialized); + return peer_id_get_next_deleted(prev_peer_id); } -//lint -restore + +uint32_t pds_peer_count_get(void) +{ + NRF_PM_DEBUG_CHECK(m_module_initialized); + return peer_id_n_ids(); +} +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.h index 42dcacd69c..f9b6349924 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_data_storage.h @@ -37,17 +37,20 @@ */ - #ifndef PEER_DATA_STORAGE_H__ #define PEER_DATA_STORAGE_H__ #include #include "sdk_errors.h" -#include "nrf_ble_gap.h" +#include "ble_gap.h" #include "peer_manager_types.h" #include "peer_manager_internal.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN @@ -56,37 +59,40 @@ * @{ * @brief An internal module of @ref peer_manager. This module provides a Peer Manager-specific API * to the persistent storage. + * + * @details This module uses Flash Data Storage (FDS) to interface with persistent storage. */ -#define PDS_PREPARE_TOKEN_INVALID 0 /**< Invalid value for prepare token. */ +#define PDS_PREPARE_TOKEN_INVALID (0) /**< Invalid value for prepare token. */ +#define PDS_FIRST_RESERVED_FILE_ID (0xC000) /**< The beginning of the range of file IDs reserved for Peer Manager. */ +#define PDS_LAST_RESERVED_FILE_ID (0xFFFE) /**< The end of the range of file IDs reserved for Peer Manager. */ +#define PDS_FIRST_RESERVED_RECORD_KEY (0xC000) /**< The beginning of the range of record keys reserved for Peer Manager. */ +#define PDS_LAST_RESERVED_RECORD_KEY (0xFFFE) /**< The end of the range of record keys reserved for Peer Manager. */ -enum -{ - PEER_ID_TO_FILE_ID = 0xC000, - FILE_ID_TO_PEER_ID = -PEER_ID_TO_FILE_ID, - PEER_DATA_ID_TO_RECORD_KEY = 0xC000, - RECORD_KEY_TO_PEER_DATA_ID = -PEER_DATA_ID_TO_RECORD_KEY, -}; +#define PEER_ID_TO_FILE_ID ( PDS_FIRST_RESERVED_FILE_ID) //!< Macro for converting a @ref pm_peer_id_t to an FDS file ID. +#define FILE_ID_TO_PEER_ID (-PDS_FIRST_RESERVED_FILE_ID) //!< Macro for converting an FDS file ID to a @ref pm_peer_id_t. +#define DATA_ID_TO_RECORD_KEY ( PDS_FIRST_RESERVED_RECORD_KEY) //!< Macro for converting a @ref pm_peer_data_id_t to an FDS record ID. +#define RECORD_KEY_TO_DATA_ID (-PDS_FIRST_RESERVED_RECORD_KEY) //!< Macro for converting an FDS record ID to a @ref pm_peer_data_id_t. -/**@brief The types of events that can come from the peer_data_storage module. +/**@brief The events that come from this module. */ typedef enum { - PDS_EVT_STORED, /**< The specified data has been successfully stored. */ - PDS_EVT_UPDATED, /**< The specified data has been successfully updated. */ - PDS_EVT_CLEARED, /**< The specified data has been successfully cleared. */ - PDS_EVT_ERROR_STORE, /**< The specified data could not be stored. */ - PDS_EVT_ERROR_UPDATE, /**< The specified data could not be updated. */ - PDS_EVT_ERROR_CLEAR, /**< The specified data could not be cleared. */ - PDS_EVT_PEER_ID_CLEAR, /**< The peer id has been successfully cleared. */ - PDS_EVT_ERROR_PEER_ID_CLEAR, /**< The peer id has been successfully cleared. */ - PDS_EVT_COMPRESSED, /**< A compress procedure has finished successfully. */ - PDS_EVT_ERROR_UNEXPECTED, /**< An unexpected, possibly fatal error occurred. The unexpected error is included in the event structure. */ + PDS_EVT_STORED, //!< The specified data has been successfully stored. + PDS_EVT_UPDATED, //!< The specified data has been successfully updated. + PDS_EVT_CLEARED, //!< The specified data has been successfully cleared. + PDS_EVT_ERROR_STORE, //!< The specified data could not be stored. + PDS_EVT_ERROR_UPDATE, //!< The specified data could not be updated. + PDS_EVT_ERROR_CLEAR, //!< The specified data could not be cleared. + PDS_EVT_PEER_ID_CLEAR, //!< The peer id has been successfully cleared. + PDS_EVT_ERROR_PEER_ID_CLEAR, //!< The peer id has been successfully cleared. + PDS_EVT_COMPRESSED, //!< A compress procedure has finished successfully. + PDS_EVT_ERROR_UNEXPECTED, //!< An unexpected, possibly fatal error occurred. } pds_evt_id_t; -/**@brief Events that can come from the peer_data_storage module. +/**@brief The event structure for events generated by the this module. */ typedef struct { @@ -107,235 +113,134 @@ typedef struct typedef void (*pds_evt_handler_t)(pds_evt_t const * p_event); -/**@brief Function for registering for events from the peer database. +/**@brief Function for initializing the module. * - * @note This function will initialize the module if it is not already initialized. - * - * @param[in] evt_handler Event handler to register. - * - * @retval NRF_SUCCESS Registration successful. - * @retval NRF_ERROR_NO_MEM No more event handlers can be registered. - * @retval NRF_ERROR_NULL evt_handler was NULL. - * @retval NRF_ERROR_INTERNAL An unexpected error happened. - * @retval NRF_ERROR_INTERNAL Unexpected error. + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_STORAGE_FULL If no flash pages were available for use. + * @retval NRF_ERROR_INTERNAL If the module couldn't register with the flash filesystem. */ -ret_code_t pds_register(pds_evt_handler_t evt_handler); +ret_code_t pds_init(void); -/**@brief Function for retrieving a direct pointer to peer data in persistent storage. +/**@brief Function for reading peer data in flash. * - * @param[in] peer_id The id of the peer whose data to read. - * @param[in] data_id Which data to get. - * @param[out] p_data The peer data pointer. - * @param[out] p_token Token that can be used to lock data in flash and check data validity. + * @param[in] peer_id The peer the data belongs to. + * @param[in] data_id The data to retrieve. + * @param[out] p_data The peer data. May not be @c NULL. + * @param[in] p_buf_len Length of the provided buffer, in bytes. Pass @c NULL to only copy + * a pointer to the data in flash. * - * @retval NRF_SUCCESS The pointer was successfully retrieved. - * @retval NRF_ERROR_INVALID_PARAM Invalid data_id. - * @retval NRF_ERROR_NOT_FOUND The requested data was not found in persistent storage. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INVALID_PARAM If @p peer_id or @p data_id are invalid. + * @retval NRF_ERROR_NOT_FOUND If the data was not found in flash. + * @retval NRF_ERROR_NO_MEM If the provided buffer is too small. */ -ret_code_t pds_peer_data_read_ptr_get(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_flash_t * p_data, - pm_store_token_t * p_token); +ret_code_t pds_peer_data_read(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_t * const p_data, + uint32_t const * const p_buf_len); -#if 0 -// @TODO: Finish documentation -/**@brief Function to lock the flash data (to defer compression from invalidating data) - * - * @param[in] store_token The token representing the item to lock - * - * @retval NRF_SUCCESS Successfully locked +/**@brief Function to prepare iterating over peer data in flash using @ref pds_peer_data_iterate. + * Call this function once each time before iterating using @ref pds_peer_data_iterate. */ -ret_code_t pds_peer_data_lock(pm_store_token_t store_token); +void pds_peer_data_iterate_prepare(void); -/**@brief Function to verify flash data integrity +/**@brief Function for iterating peers' data in flash. + * Always call @ref pds_peer_data_iterate_prepare before starting iterating. * - * @param[in] store_token The token representing the item to lock + * @param[in] data_id The peer data to iterate over. + * @param[out] p_peer_id The peer the data belongs to. + * @param[out] p_data The peer data in flash. * - * @retval NRF_SUCCESS The data integrity is valid. - * @retval NRF_ERROR_NULL The token is invalid. - * @retval NRF_ERROR_INVALID_DATA The data integrity is not valid. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval true If the operation was successful. + * @retval false If the data was not found in flash, or another error occurred. */ -ret_code_t pds_peer_data_verify(pm_store_token_t store_token); -#endif +bool pds_peer_data_iterate(pm_peer_data_id_t data_id, + pm_peer_id_t * const p_peer_id, + pm_peer_data_flash_t * const p_data); -/**@brief Function for retrieving peer data from persistent storage by making a copy. +/**@brief Function for reserving space in flash to store data. * - * @param[in] peer_id The id of the peer whose data to read. - * @param[in] data_id Which piece of data to read. - * @param[out] p_data Pointer to the peer data. - * @param[in,out] p_len_words Length available to copy to (in words). - * If set to NULL, then no copy will be made and the - * length will be reflected in p_len_words after the call returns. + * @param[in] p_peer_data The data to be stored in flash. Only data length and type (ID) are + * relevant for this operation. May not be @c NULL. + * @param[out] p_prepare_token A token identifying the reserved space. May not be @c NULL. * - * @retval NRF_SUCCESS The read was successful. - * @retval NRF_ERROR_INVALID_PARAM Invalid data_id or peer_id. - * @retval NRF_ERROR_NULL Either \c p_data or \c p_len_words were \c NULL, or \c p_data - * contained a NULL pointer. - * @retval NRF_ERROR_NOT_FOUND The requested data was not found in persistent storage. - * @retval NRF_ERROR_NO_MEM The length of stored data too large to copy out. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INVALID_PARAM If the data ID in @p p_peer_data is invalid. + * @retval NRF_ERROR_INVALID_LENGTH If data length exceeds the maximum allowed length. + * @retval NRF_ERROR_STORAGE_FULL If no space is available in flash. + * @retval NRF_ERROR_INTERNAL If an unexpected error occurred. */ -ret_code_t pds_peer_data_read(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_t * p_data, - uint16_t * p_len_words); +ret_code_t pds_space_reserve(pm_peer_data_const_t const * p_peer_data, + pm_prepare_token_t * p_prepare_token); -/**@brief Function for preparing persistent storage for a write. +/**@brief Function for undoing a previous call to @ref pds_space_reserve. * - * @details If this call succeeds, space is reserved in persistent storage, so the write will fit. + * @param[in] prepare_token A token identifying the reservation to cancel. * - * @note If space has already been prepared for this peer_id/data_id pair, no new space will be - * reserved, unless the previous reservation had too small size. - * - * @param[in] p_peer_data Data to prepare for. The data needs not be ready, but length and type - * values must. - * @param[out] p_prepare_token A token identifying the prepared memory area. - * - * @retval NRF_SUCCESS The call was successful. - * @retval NRF_ERROR_NULL Either \c p_peer_data or \c p_prepare code were \c NULL. - * @retval NRF_ERROR_INVALID_PARAM Invalid data ID. - * @retval NRF_ERROR_INVALID_LENGTH Data length exceeds the maximum length allowed. - * @retval NRF_ERROR_NO_MEM No space available in persistent storage. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. - * @retval NRF_ERROR_INTERNAL Internal error. + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INTERNAL If an unexpected error occurred. */ -ret_code_t pds_peer_data_write_prepare(pm_peer_data_const_t const * p_peer_data, - pm_prepare_token_t * p_prepare_token); +ret_code_t pds_space_reserve_cancel(pm_prepare_token_t prepare_token); -/**@brief Function for undoing a previous call to @ref pds_peer_data_write_prepare. +/**@brief Function for storing peer data in flash. If the same piece of data already exists for the + * given peer, it will be updated. This operation is asynchronous. + * Expect a @ref PDS_EVT_STORED or @ref PDS_EVT_ERROR_STORE event. * - * @param[in] prepare_token A token identifying the prepared memory area to cancel. - * - * @retval NRF_SUCCESS The call was successful. - * @retval NRF_ERROR_NULL Invalid value for \c prepare_token. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. - * @retval NRF_ERROR_INTERNAL Internal error. - */ -ret_code_t pds_peer_data_write_prepare_cancel(pm_prepare_token_t prepare_token); - - -/**@brief Function for writing prepared (reserved) peer data to persistent storage. - * - * @details Writing happens asynchronously. Expect a @ref PDS_EVT_STORED or @ref PDS_EVT_ERROR_STORE - * event. - * - * @param[in] peer_id The id of the peer the data pertains to. - * @param[in] p_peer_data The peer data. - * @param[in] prepare_token A token identifying the prepared memory area to write into. If - * the prepare token is invalid, e.g. PDS_PREPARE_TOKEN_INVALID, the - * prepare/write sequence will happen atomically. + * @param[in] peer_id The peer the data belongs to. + * @param[in] p_peer_data The peer data. May not be @c NULL. + * @param[in] prepare_token A token identifying the reservation made in flash to store the data. + * Pass @ref PDS_PREPARE_TOKEN_INVALID if no space was reserved. * @param[out] p_store_token A token identifying this particular store operation. The token can be - * used to identify events pertaining to this operation. + * used to identify events pertaining to this operation. Pass @p NULL + * if not used. * - * @retval NRF_SUCCESS The write was initiated successfully. - * @retval NRF_ERROR_INVALID_PARAM Invalid peer ID or data ID. - * @retval NRF_ERROR_NULL \c p_peer_data was \c NULL or contained a \c NULL pointer or - * \c prepare_token was zero. - * @retval NRF_ERROR_NO_MEM No space available in persistent storage. This can only happen - * if \c p_prepare_token is \c NULL. - * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any - * more requests. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. - * @retval NRF_ERROR_INTERNAL Internal error. + * @retval NRF_SUCCESS If the operation was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM If @p peer_id or the data ID in @p_peer_data are invalid. + * @retval NRF_ERROR_STORAGE_FULL If no space is available in flash. This can only happen if + * @p p_prepare_token is @ref PDS_PREPARE_TOKEN_INVALID. + * @retval NRF_ERROR_BUSY If the flash filesystem was busy. + * @retval NRF_ERROR_INTERNAL If an unexpected error occurred. */ -ret_code_t pds_peer_data_write_prepared(pm_peer_id_t peer_id, - pm_peer_data_const_t const * p_peer_data, - pm_prepare_token_t prepare_token, - pm_store_token_t * p_store_token); - - -/**@brief Function for writing peer data to persistent storage. - * - * @details Writing happens asynchronously. Expect a @ref PDS_EVT_STORED or @ref PDS_EVT_ERROR_STORE - * event. - * - * @param[in] peer_id The id of the peer the data pertains to. - * @param[in] p_peer_data The peer data. - * @param[out] p_store_token A token identifying this particular store operation. The token can be - * used to identify events pertaining to this operation. - * - * @retval NRF_SUCCESS The write was initiated successfully. - * @retval NRF_ERROR_INVALID_PARAM Invalid data ID or peer ID. - * @retval NRF_ERROR_NULL \c p_peer_data was \c NULL or data contained a \c NULL pointer. - * @retval NRF_ERROR_NO_MEM No space available in persistent storage. - * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any - * more requests. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. - * @retval NRF_ERROR_INTERNAL Internal error. - */ -ret_code_t pds_peer_data_write(pm_peer_id_t peer_id, +ret_code_t pds_peer_data_store(pm_peer_id_t peer_id, pm_peer_data_const_t const * p_peer_data, + pm_prepare_token_t prepare_token, pm_store_token_t * p_store_token); -/**@brief Function for updating currently stored peer data to a new version +/**@brief Function for deleting peer data in flash. This operation is asynchronous. + * Expect a @ref PDS_EVT_CLEARED or @ref PDS_EVT_ERROR_CLEAR event. * - * @details Updating happens asynchronously. - * Expect a @ref PDS_EVT_STORED or @ref PDS_EVT_ERROR_STORE for the store token - * and a @ref PDS_EVT_ERROR_CLEAR or @ref PDS_EVT_ERROR_CLEAR for the old token + * @param[in] peer_id The peer the data belongs to + * @param[in] data_id The data to delete. * - * @param[in] peer_id The peer which the data is associated to. - * @param[in] p_peer_data New data. - * @param[in] old_token Store token for the old data. - * @param[out] p_store_token Store token for the new data. - * - * @retval NRF_SUCESS The update was initiated successfully - * @retval NRF_ERROR_NULL \c p_peer_data was \c NULL or data contained a \c NULL pointer. - * @retval NRF_ERROR_NO_MEM No space available in persistent storage. - * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any - * more requests at this moment. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. - * @retval NRF_ERROR_INTERNAL Internal error. + * @retval NRF_SUCCESS If the operation was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM If @p peer_id or @p data_id are invalid. + * @retval NRF_ERROR_NOT_FOUND If data was not found in flash. + * @retval NRF_ERROR_BUSY If the flash filesystem was busy. + * @retval NRF_ERROR_INTERNAL If an unexpected error occurred. */ -ret_code_t pds_peer_data_update(pm_peer_id_t peer_id, - pm_peer_data_const_t const * p_peer_data, - pm_store_token_t old_token, - pm_store_token_t * p_store_token); - - -/**@brief Function for clearing peer data from persistent storage. - * - * @details Clearing happens asynchronously. Expect a @ref PDS_EVT_CLEARED or @ref PDS_EVT_ERROR_CLEAR - * event. - * - * @param[in] peer_id The id of the peer the data pertains to. - * @param[in] data_id Which data to clear. - * - * @retval NRF_SUCCESS The clear was initiated successfully. - * @retval NRF_ERROR_INVALID_PARAM Data ID or peer ID was invalid. - * @retval NRF_ERROR_NOT_FOUND Nothing to clear for this peer ID. - * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any - * more requests at this moment. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. - * @retval NRF_ERROR_INTERNAL Internal error. - */ -ret_code_t pds_peer_data_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); +ret_code_t pds_peer_data_delete(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); /**@brief Function for claiming an unused peer ID. * - * @return The first unused peer ID. - * @retval PM_PEER_ID_INVALID If no peer ID is available or module is not initialized. + * @retval PM_PEER_ID_INVALID If no peer ID was available. */ pm_peer_id_t pds_peer_id_allocate(void); -/**@brief Function for freeing a peer ID and clearing all data associated with it in persistent - * storage. +/**@brief Function for freeing a peer ID and deleting all data associated with it in flash. * - * @param[in] peer_id Peer ID to free. + * @param[in] peer_id The ID of the peer to free. * - * @retval NRF_SUCCESS The clear was initiated successfully. - * @retval NRF_ERROR_INVALID_STATE Module not initialized. - * @retval NRF_ERROR_INVALID_PARAM Invalid peer ID. + * @retval NRF_SUCCESS The operation was initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM If @p peer_id is invalid. */ ret_code_t pds_peer_id_free(pm_peer_id_t peer_id); @@ -344,8 +249,8 @@ ret_code_t pds_peer_id_free(pm_peer_id_t peer_id); * * @param[in] peer_id The peer ID to inquire about. * - * @retval true peer_id is in use. - * @retval false peer_id is free, or the module is not initialized. + * @retval true @p peer_id is in use. + * @retval false @p peer_id is free. */ bool pds_peer_id_is_allocated(pm_peer_id_t peer_id); @@ -358,24 +263,44 @@ bool pds_peer_id_is_allocated(pm_peer_id_t peer_id); * * @param[in] prev_peer_id The previous peer ID. * - * @return The next peer ID. - * @return The first ordinary peer ID if prev_peer_id was @ref PM_PEER_ID_INVALID. - * @retval PM_PEER_ID_INVALID if prev_peer_id was the last ordinary peer ID or the module + * @return The first ordinary peer ID If @p prev_peer_id is @ref PM_PEER_ID_INVALID. + * @retval PM_PEER_ID_INVALID If @p prev_peer_id is the last ordinary peer ID or the module * is not initialized. */ pm_peer_id_t pds_next_peer_id_get(pm_peer_id_t prev_peer_id); +/**@brief Function for getting the next peer ID in the sequence of all peer IDs pending deletion. + * Can be used to loop through all used peer IDs. + * + * @note @ref PM_PEER_ID_INVALID is considered to be before the first and after the last ordinary + * peer ID. + * + * @param[in] prev_peer_id The previous peer ID. + * + * @return The next peer ID pending deletion. + * @return The first ordinary peer ID if prev_peer_id was @ref PM_PEER_ID_INVALID. + * @retval PM_PEER_ID_INVALID if prev_peer_id was the last ordinary peer ID or the module + * is not initialized. + */ +pm_peer_id_t pds_next_deleted_peer_id_get(pm_peer_id_t prev_peer_id); + + /**@brief Function for querying the number of valid peer IDs available. I.E the number of peers * in persistent storage. * - * @return The number of valid peer IDs, or 0 if module is not initialized. + * @return The number of valid peer IDs. */ -uint32_t pds_n_peers(void); +uint32_t pds_peer_count_get(void); /** @} * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* PEER_DATA_STORAGE_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.c index fd6c30193d..5fffea5c3b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.c @@ -36,27 +36,26 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "peer_database.h" #include -#include "app_util.h" #include "peer_manager_types.h" #include "peer_manager_internal.h" #include "peer_data_storage.h" #include "pm_buffer.h" -#include "sdk_common.h" -#define MAX_REGISTRANTS 6 /**< The number of user that can register with the module. */ -#define N_WRITE_BUFFERS 8 /**< The number of write buffers available. */ -#define N_WRITE_BUFFER_RECORDS (N_WRITE_BUFFERS) /**< The number of write buffer records. */ +#define N_WRITE_BUFFERS (8) /**< The number of write buffers available. */ +#define N_WRITE_BUFFER_RECORDS (N_WRITE_BUFFERS) /**< The number of write buffer records. */ + /**@brief Macro for verifying that the data ID is among the values eligible for using the write buffer. * * @param[in] data_id The data ID to verify. */ +// @note emdi: could this maybe be a function? #define VERIFY_DATA_ID_WRITE_BUF(data_id) \ do \ { \ @@ -64,7 +63,30 @@ do { \ return NRF_ERROR_INVALID_PARAM; \ } \ -} while(0) +} while (0) + + +// The number of registered event handlers. +#define PDB_EVENT_HANDLERS_CNT (sizeof(m_evt_handlers) / sizeof(m_evt_handlers[0])) + + +// Peer Database event handlers in other Peer Manager submodules. +extern void pm_pdb_evt_handler(pdb_evt_t const * p_event); +extern void im_pdb_evt_handler(pdb_evt_t const * p_event); +extern void sm_pdb_evt_handler(pdb_evt_t const * p_event); +extern void smd_pdb_evt_handler(pdb_evt_t const * p_event); +extern void gscm_pdb_evt_handler(pdb_evt_t const * p_event); + +// Peer Database events' handlers. +// The number of elements in this array is PDB_EVENT_HANDLERS_CNT. +static pdb_evt_handler_t const m_evt_handlers[] = +{ + pm_pdb_evt_handler, + im_pdb_evt_handler, + sm_pdb_evt_handler, + smd_pdb_evt_handler, + gscm_pdb_evt_handler, +}; /**@brief Struct for keeping track of one write buffer, from allocation, until it is fully written @@ -74,30 +96,22 @@ typedef struct { pm_peer_id_t peer_id; /**< The peer ID this buffer belongs to. */ pm_peer_data_id_t data_id; /**< The data ID this buffer belongs to. */ - uint8_t buffer_block_id; /**< The index of the first (or only) buffer block containing peer data. */ - uint32_t n_bufs; /**< The number of buffer blocks containing peer data. */ - uint8_t store_busy : 1; /**< Flag indicating that the buffer was attempted written to flash, but a busy error was returned and the operation should be retried. */ - uint8_t store_flash_full : 1; /**< Flag indicating that the buffer was attempted written to flash, but a flash full error was returned and the operation should be retried after room has been made. */ - uint8_t store_requested : 1; /**< Flag indicating that the buffer is being written to flash. */ pm_prepare_token_t prepare_token; /**< Token given by Peer Data Storage if room in flash has been reserved. */ pm_store_token_t store_token; /**< Token given by Peer Data Storage when a flash write has been successfully requested. */ + uint32_t n_bufs; /**< The number of buffer blocks containing peer data. */ + uint8_t buffer_block_id; /**< The index of the first (or only) buffer block containing peer data. */ + uint8_t store_requested : 1; /**< Flag indicating that the buffer is being written to flash. */ + uint8_t store_flash_full : 1; /**< Flag indicating that the buffer was attempted written to flash, but a flash full error was returned and the operation should be retried after room has been made. */ + uint8_t store_busy : 1; /**< Flag indicating that the buffer was attempted written to flash, but a busy error was returned and the operation should be retried. */ } pdb_buffer_record_t; -/**@brief Struct for keeping track of the state of the module. - */ -typedef struct -{ - pdb_evt_handler_t evt_handlers[MAX_REGISTRANTS]; /**< All registered event handlers. */ - uint8_t n_registrants; /**< The number of registered event handlers. */ - pm_buffer_t write_buffer; /**< The state of the write buffer. */ - pdb_buffer_record_t write_buffer_records[N_WRITE_BUFFER_RECORDS]; /**< The available write buffer records. */ - uint32_t n_writes; /**< The number of pending (Not yet successfully requested in Peer Data Storage) store operations. */ -} pdb_t; -static pdb_t m_pdb = {.n_registrants = 0}; /**< The state of the module. */ +static bool m_module_initialized; +static pm_buffer_t m_write_buffer; /**< The state of the write buffer. */ +static pdb_buffer_record_t m_write_buffer_records[N_WRITE_BUFFER_RECORDS]; /**< The available write buffer records. */ +static uint32_t m_n_writes; /**< The number of pending (Not yet successfully requested in Peer Data Storage) store operations. */ + -#define MODULE_INITIALIZED (m_pdb.n_registrants > 0) /**< Expression which is true when the module is initialized. */ -#include "sdk_macros.h" /**@brief Function for invalidating a record of a write buffer allocation. * @@ -107,7 +121,7 @@ static void write_buffer_record_invalidate(pdb_buffer_record_t * p_record) { p_record->peer_id = PM_PEER_ID_INVALID; p_record->data_id = PM_PEER_DATA_ID_INVALID; - p_record->buffer_block_id = BUFFER_INVALID_ID; + p_record->buffer_block_id = PM_BUFFER_INVALID_ID; p_record->store_busy = false; p_record->store_flash_full = false; p_record->store_requested = false; @@ -128,9 +142,9 @@ static pdb_buffer_record_t * write_buffer_record_find_next(pm_peer_id_t peer_id, { for (uint32_t i = *p_index; i < N_WRITE_BUFFER_RECORDS; i++) { - if ((m_pdb.write_buffer_records[i].peer_id == peer_id)) + if ((m_write_buffer_records[i].peer_id == peer_id)) { - return &m_pdb.write_buffer_records[i]; + return &m_write_buffer_records[i]; } } return NULL; @@ -182,7 +196,7 @@ static void write_buffer_record_release(pdb_buffer_record_t * p_write_buffer_rec { for (uint32_t i = 0; i < p_write_buffer_record->n_bufs; i++) { - pm_buffer_release(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id + i); + pm_buffer_release(&m_write_buffer, p_write_buffer_record->buffer_block_id + i); } write_buffer_record_invalidate(p_write_buffer_record); @@ -218,9 +232,9 @@ static void write_buffer_record_get(pdb_buffer_record_t ** pp_write_buffer_recor */ static void pdb_evt_send(pdb_evt_t * p_event) { - for (uint32_t i = 0; i < m_pdb.n_registrants; i++) + for (uint32_t i = 0; i < PDB_EVENT_HANDLERS_CNT; i++) { - m_pdb.evt_handlers[i](p_event); + m_evt_handlers[i](p_event); } } @@ -229,21 +243,21 @@ static void pdb_evt_send(pdb_evt_t * p_event) * * @param[out] p_event The event to dispatch. */ -static void internal_state_reset(pdb_t * pdb) +static void internal_state_reset() { - memset(pdb, 0, sizeof(pdb_t)); for (uint32_t i = 0; i < N_WRITE_BUFFER_RECORDS; i++) { - write_buffer_record_invalidate(&pdb->write_buffer_records[i]); + write_buffer_record_invalidate(&m_write_buffer_records[i]); } } /**@brief Function for handling events from the Peer Data Storage module. + * This function is extern in Peer Data Storage. * * @param[in] p_event The event to handle. */ -static void pds_evt_handler(pds_evt_t const * p_event) +void pdb_pds_evt_handler(pds_evt_t const * p_event) { ret_code_t err_code; pdb_buffer_record_t * p_write_buffer_record; @@ -283,7 +297,7 @@ static void pds_evt_handler(pds_evt_t const * p_event) && (p_write_buffer_record->store_requested)) { // Retry if internal buffer. - m_pdb.n_writes++; + m_n_writes++; p_write_buffer_record->store_requested = false; p_write_buffer_record->store_busy = true; } @@ -324,20 +338,20 @@ static void pds_evt_handler(pds_evt_t const * p_event) break; } - if (m_pdb.n_writes > 0) + if (m_n_writes > 0) { for (uint32_t i = 0; i < N_WRITE_BUFFER_RECORDS; i++) { - if ((m_pdb.write_buffer_records[i].store_busy) - || (m_pdb.write_buffer_records[i].store_flash_full && retry_flash_full)) + if ((m_write_buffer_records[i].store_busy) + || (m_write_buffer_records[i].store_flash_full && retry_flash_full)) { - err_code = pdb_write_buf_store(m_pdb.write_buffer_records[i].peer_id, - m_pdb.write_buffer_records[i].data_id); + err_code = pdb_write_buf_store(m_write_buffer_records[i].peer_id, + m_write_buffer_records[i].data_id); if (err_code != NRF_SUCCESS) { - event.peer_id = m_pdb.write_buffer_records[i].peer_id; - event.data_id = m_pdb.write_buffer_records[i].data_id; - if (err_code == NRF_ERROR_NO_MEM) + event.peer_id = m_write_buffer_records[i].peer_id; + event.data_id = m_write_buffer_records[i].data_id; + if (err_code == NRF_ERROR_STORAGE_FULL) { event.evt_id = PDB_EVT_ERROR_NO_MEM; } @@ -356,34 +370,22 @@ static void pds_evt_handler(pds_evt_t const * p_event) } -ret_code_t pdb_register(pdb_evt_handler_t evt_handler) +ret_code_t pdb_init() { - if (m_pdb.n_registrants >= MAX_REGISTRANTS) + ret_code_t ret; + + NRF_PM_DEBUG_CHECK(!m_module_initialized); + + internal_state_reset(); + + PM_BUFFER_INIT(&m_write_buffer, N_WRITE_BUFFERS, PDB_WRITE_BUF_SIZE, ret); + + if (ret != NRF_SUCCESS) { - return NRF_ERROR_NO_MEM; + return NRF_ERROR_INTERNAL; } - VERIFY_PARAM_NOT_NULL(evt_handler); - - if (!MODULE_INITIALIZED) - { - ret_code_t err_code; - - internal_state_reset(&m_pdb); - err_code = pds_register(pds_evt_handler); - if (err_code != NRF_SUCCESS) - { - return NRF_ERROR_INTERNAL; - } - PM_BUFFER_INIT(&m_pdb.write_buffer, N_WRITE_BUFFERS, PDB_WRITE_BUF_SIZE, err_code); - if (err_code != NRF_SUCCESS) - { - return NRF_ERROR_INTERNAL; - } - } - - m_pdb.evt_handlers[m_pdb.n_registrants] = evt_handler; - m_pdb.n_registrants += 1; + m_module_initialized = true; return NRF_SUCCESS; } @@ -391,21 +393,25 @@ ret_code_t pdb_register(pdb_evt_handler_t evt_handler) pm_peer_id_t pdb_peer_allocate(void) { + #if 0 if (!MODULE_INITIALIZED) { return PM_PEER_ID_INVALID; } + #endif + NRF_PM_DEBUG_CHECK(m_module_initialized); return pds_peer_id_allocate(); } ret_code_t pdb_peer_free(pm_peer_id_t peer_id) { - VERIFY_MODULE_INITIALIZED(); ret_code_t err_code_in = NRF_SUCCESS; ret_code_t err_code_out = NRF_SUCCESS; + NRF_PM_DEBUG_CHECK(m_module_initialized); + int index = 0; pdb_buffer_record_t * p_record = write_buffer_record_find_next(peer_id, &index); @@ -445,14 +451,15 @@ ret_code_t pdb_peer_free(pm_peer_id_t peer_id) } -ret_code_t pdb_read_buf_get(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_flash_t * p_peer_data, - pm_store_token_t * p_token) +ret_code_t pdb_peer_data_ptr_get(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_flash_t * const p_peer_data) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_peer_data != NULL); - return pds_peer_data_read_ptr_get(peer_id, data_id, p_peer_data, p_token); + // Pass NULL to only retrieve a pointer. + return pds_peer_data_read(peer_id, data_id, (pm_peer_data_t*)p_peer_data, NULL); } @@ -500,9 +507,11 @@ ret_code_t pdb_write_buf_get(pm_peer_id_t peer_id, uint32_t n_bufs, pm_peer_data_t * p_peer_data) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); + VERIFY_PARAM_NOT_NULL(p_peer_data); VERIFY_DATA_ID_WRITE_BUF(data_id); + if ( (n_bufs == 0) || (n_bufs > N_WRITE_BUFFERS) || !pds_peer_id_is_allocated(peer_id)) @@ -522,7 +531,7 @@ ret_code_t pdb_write_buf_get(pm_peer_id_t peer_id, // Existing buffer is too small. for (uint8_t i = 0; i < write_buffer_record->n_bufs; i++) { - pm_buffer_release(&m_pdb.write_buffer, write_buffer_record->buffer_block_id + i); + pm_buffer_release(&m_write_buffer, write_buffer_record->buffer_block_id + i); } write_buffer_record_invalidate(write_buffer_record); write_buffer_record = NULL; @@ -532,7 +541,7 @@ ret_code_t pdb_write_buf_get(pm_peer_id_t peer_id, // Release excess blocks. for (uint8_t i = n_bufs; i < write_buffer_record->n_bufs; i++) { - pm_buffer_release(&m_pdb.write_buffer, write_buffer_record->buffer_block_id + i); + pm_buffer_release(&m_write_buffer, write_buffer_record->buffer_block_id + i); } } @@ -545,11 +554,11 @@ ret_code_t pdb_write_buf_get(pm_peer_id_t peer_id, } } - if (write_buffer_record->buffer_block_id == BUFFER_INVALID_ID) + if (write_buffer_record->buffer_block_id == PM_BUFFER_INVALID_ID) { - write_buffer_record->buffer_block_id = pm_buffer_block_acquire(&m_pdb.write_buffer, n_bufs); + write_buffer_record->buffer_block_id = pm_buffer_block_acquire(&m_write_buffer, n_bufs); - if (write_buffer_record->buffer_block_id == BUFFER_INVALID_ID) + if (write_buffer_record->buffer_block_id == PM_BUFFER_INVALID_ID) { write_buffer_record_invalidate(write_buffer_record); return NRF_ERROR_BUSY; @@ -560,7 +569,7 @@ ret_code_t pdb_write_buf_get(pm_peer_id_t peer_id, write_buffer_record->n_bufs = n_bufs; - p_buffer_memory = pm_buffer_ptr_get(&m_pdb.write_buffer, write_buffer_record->buffer_block_id); + p_buffer_memory = pm_buffer_ptr_get(&m_write_buffer, write_buffer_record->buffer_block_id); if (p_buffer_memory == NULL) { @@ -579,7 +588,7 @@ ret_code_t pdb_write_buf_get(pm_peer_id_t peer_id, ret_code_t pdb_write_buf_release(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); ret_code_t err_code = NRF_SUCCESS; pdb_buffer_record_t * p_write_buffer_record; @@ -592,7 +601,7 @@ ret_code_t pdb_write_buf_release(pm_peer_id_t peer_id, pm_peer_data_id_t data_id if (p_write_buffer_record->prepare_token != PDS_PREPARE_TOKEN_INVALID) { - err_code = pds_peer_data_write_prepare_cancel(p_write_buffer_record->prepare_token); + err_code = pds_space_reserve_cancel(p_write_buffer_record->prepare_token); if (err_code != NRF_SUCCESS) { err_code = NRF_ERROR_INTERNAL; @@ -607,7 +616,8 @@ ret_code_t pdb_write_buf_release(pm_peer_id_t peer_id, pm_peer_data_id_t data_id ret_code_t pdb_write_buf_store_prepare(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); + VERIFY_DATA_ID_WRITE_BUF(data_id); ret_code_t err_code = NRF_SUCCESS; @@ -621,7 +631,7 @@ ret_code_t pdb_write_buf_store_prepare(pm_peer_id_t peer_id, pm_peer_data_id_t d if (p_write_buffer_record->prepare_token == PDS_PREPARE_TOKEN_INVALID) { - uint8_t * p_buffer_memory = pm_buffer_ptr_get(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id); + uint8_t * p_buffer_memory = pm_buffer_ptr_get(&m_write_buffer, p_write_buffer_record->buffer_block_id); pm_peer_data_const_t peer_data = {.data_id = data_id}; if (p_buffer_memory == NULL) @@ -633,7 +643,7 @@ ret_code_t pdb_write_buf_store_prepare(pm_peer_id_t peer_id, pm_peer_data_id_t d write_buf_length_words_set(&peer_data); - err_code = pds_peer_data_write_prepare(&peer_data, &p_write_buffer_record->prepare_token); + err_code = pds_space_reserve(&peer_data, &p_write_buffer_record->prepare_token); if (err_code == NRF_ERROR_INVALID_LENGTH) { return NRF_ERROR_INTERNAL; @@ -644,47 +654,11 @@ ret_code_t pdb_write_buf_store_prepare(pm_peer_id_t peer_id, pm_peer_data_id_t d } -static ret_code_t write_or_update(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_const_t * p_peer_data, - pm_store_token_t * p_store_token, - pm_prepare_token_t prepare_token) -{ - pm_peer_data_flash_t old_peer_data; - pm_store_token_t old_store_token; - ret_code_t err_code = pds_peer_data_read_ptr_get(peer_id, data_id, &old_peer_data, &old_store_token); - - if (err_code == NRF_SUCCESS) - { - err_code = pds_peer_data_write_prepare_cancel(prepare_token); - if ((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NULL)) - { - err_code = pds_peer_data_update(peer_id, p_peer_data, old_store_token, p_store_token); - } - else - { - err_code = NRF_ERROR_INTERNAL; - } - } - else if (err_code == NRF_ERROR_NOT_FOUND) - { - if (prepare_token == PDS_PREPARE_TOKEN_INVALID) - { - err_code = pds_peer_data_write(peer_id, p_peer_data, p_store_token); - } - else - { - err_code = pds_peer_data_write_prepared(peer_id, p_peer_data, prepare_token, p_store_token); - } - } - return err_code; -} - - ret_code_t pdb_write_buf_store(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); + VERIFY_DATA_ID_WRITE_BUF(data_id); ret_code_t err_code = NRF_SUCCESS; @@ -705,7 +679,7 @@ ret_code_t pdb_write_buf_store(pm_peer_id_t peer_id, return NRF_SUCCESS; } - p_buffer_memory = pm_buffer_ptr_get(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id); + p_buffer_memory = pm_buffer_ptr_get(&m_write_buffer, p_write_buffer_record->buffer_block_id); if (p_buffer_memory == NULL) { @@ -716,11 +690,14 @@ ret_code_t pdb_write_buf_store(pm_peer_id_t peer_id, write_buf_length_words_set(&peer_data); - err_code = write_or_update(peer_id, data_id, &peer_data, &p_write_buffer_record->store_token, p_write_buffer_record->prepare_token); + err_code = pds_peer_data_store(peer_id, + &peer_data, + p_write_buffer_record->prepare_token, + &p_write_buffer_record->store_token); if (p_write_buffer_record->store_busy && p_write_buffer_record->store_flash_full) { - m_pdb.n_writes--; + m_n_writes--; } if (err_code == NRF_SUCCESS) @@ -733,18 +710,18 @@ ret_code_t pdb_write_buf_store(pm_peer_id_t peer_id, { if (err_code == NRF_ERROR_BUSY) { - m_pdb.n_writes++; + m_n_writes++; p_write_buffer_record->store_busy = true; p_write_buffer_record->store_flash_full = false; err_code = NRF_SUCCESS; } - else if (err_code == NRF_ERROR_NO_MEM) + else if (err_code == NRF_ERROR_STORAGE_FULL) { - m_pdb.n_writes++; + m_n_writes++; p_write_buffer_record->store_busy = false; p_write_buffer_record->store_flash_full = true; } - else if ((err_code != NRF_ERROR_NO_MEM) && (err_code != NRF_ERROR_INVALID_PARAM)) + else if (err_code != NRF_ERROR_INVALID_PARAM) { err_code = NRF_ERROR_INTERNAL; } @@ -756,40 +733,42 @@ ret_code_t pdb_write_buf_store(pm_peer_id_t peer_id, ret_code_t pdb_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) { - VERIFY_MODULE_INITIALIZED(); - - return pds_peer_data_clear(peer_id, data_id); + NRF_PM_DEBUG_CHECK(m_module_initialized); + return pds_peer_data_delete(peer_id, data_id); } uint32_t pdb_n_peers(void) { - if (!MODULE_INITIALIZED) - { - return 0; - } - - return pds_n_peers(); + NRF_PM_DEBUG_CHECK(m_module_initialized); + return pds_peer_count_get(); } pm_peer_id_t pdb_next_peer_id_get(pm_peer_id_t prev_peer_id) { - if (!MODULE_INITIALIZED) - { - return PM_PEER_ID_INVALID; - } - + NRF_PM_DEBUG_CHECK(m_module_initialized); return pds_next_peer_id_get(prev_peer_id); } -ret_code_t pdb_raw_read(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_t * p_peer_data) +pm_peer_id_t pdb_next_deleted_peer_id_get(pm_peer_id_t prev_peer_id) { - VERIFY_MODULE_INITIALIZED(); - return pds_peer_data_read(peer_id, data_id, p_peer_data, &p_peer_data->length_words); + NRF_PM_DEBUG_CHECK(m_module_initialized); + return pds_next_deleted_peer_id_get(prev_peer_id); +} + + +ret_code_t pdb_peer_data_load(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_t * const p_peer_data) +{ + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_peer_data != NULL); + + // Provide the buffer length in bytes. + uint32_t const data_len_bytes = (p_peer_data->length_words * sizeof(uint32_t)); + return pds_peer_data_read(peer_id, data_id, p_peer_data, &data_len_bytes); } @@ -797,8 +776,7 @@ ret_code_t pdb_raw_store(pm_peer_id_t peer_id, pm_peer_data_const_t * p_peer_data, pm_store_token_t * p_store_token) { - VERIFY_MODULE_INITIALIZED(); - - return write_or_update(peer_id, p_peer_data->data_id, p_peer_data, p_store_token, PDS_PREPARE_TOKEN_INVALID); + NRF_PM_DEBUG_CHECK(m_module_initialized); + return pds_peer_data_store(peer_id, p_peer_data, PDS_PREPARE_TOKEN_INVALID, p_store_token); } - +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.h index c0eee65774..4d83aa682c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_database.h @@ -37,7 +37,6 @@ */ - #ifndef PEER_DATABASE_H__ #define PEER_DATABASE_H__ @@ -46,6 +45,10 @@ #include "peer_manager_internal.h" #include "sdk_errors.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN * @defgroup peer_database Peer Database @@ -56,7 +59,7 @@ * */ -#define PDB_WRITE_BUF_SIZE (sizeof(pm_peer_data_bonding_t)) +#define PDB_WRITE_BUF_SIZE (sizeof(pm_peer_data_bonding_t)) //!< The size (in bytes) of each block in the internal buffer accessible via @ref pdb_write_buf_get. /**@brief Events that can come from the peer_database module. */ @@ -118,18 +121,12 @@ typedef struct typedef void (*pdb_evt_handler_t)(pdb_evt_t const * p_event); -/**@brief Function for registering for events from the peer database. +/**@brief Function for initializing the module. * - * @note This function will initialize the module if it is not already initialized. - * - * @param[in] evt_handler Event handler to register. - * - * @retval NRF_SUCCESS Registration successful. - * @retval NRF_ERROR_NO_MEM No more event handlers can be registered. - * @retval NRF_ERROR_NULL evt_handler was NULL. - * @retval NRF_ERROR_INTERNAL An unexpected error happened. + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INTERNAL An unexpected error happened. */ -ret_code_t pdb_register(pdb_evt_handler_t evt_handler); +ret_code_t pdb_init(void); /**@brief Function for allocating persistent bond storage for a peer. @@ -153,30 +150,23 @@ pm_peer_id_t pdb_peer_allocate(void); ret_code_t pdb_peer_free(pm_peer_id_t peer_id); -/**@brief Function for retrieving pointers to read-only peer data. +/**@brief Function for retrieving a pointer to peer data in flash (read-only). * - * @note Reading this pointer is not safe in the strictest sense. If a safe read is required: - * - Disable interrupts - * - Call this function. If the return code is @ref NRF_SUCCESS, the following read is safe. - * - Read memory. - * - Enable interrupts. - * @note This buffer does not need to be released. It is a pointer directly to flash. + * @note Dereferencing this pointer is not the safest thing to do if interrupts are enabled, + * because Flash Data Storage garbage collection might move the data around. Either disable + * interrupts while using the data, or use @ref pdb_peer_data_load. * - * @param[in] peer_id ID of peer to retrieve data for. - * @param[in] data_id Which piece of data to get. - * @param[out] p_peer_data Pointer to immutable peer data. - * @param[out] p_token Token that can be used to lock data in flash and check data validity. + * @param[in] peer_id The peer the data belongs to. + * @param[in] data_id The data to read. + * @param[out] p_peer_data The peer data, read-only. * - * @retval NRF_SUCCESS Data retrieved successfully. - * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated. - * @retval NRF_ERROR_NULL p_peer_data was NULL. - * @retval NRF_ERROR_NOT_FOUND This data was not found for this peer ID. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_SUCCESS If the pointer to the data was retrieved successfully. + * @retval NRF_ERROR_INVALID_PARAM If either @p peer_id or @p data_id are invalid. + * @retval NRF_ERROR_NOT_FOUND If data was not found in flash. */ -ret_code_t pdb_read_buf_get(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_flash_t * p_peer_data, - pm_store_token_t * p_token); +ret_code_t pdb_peer_data_ptr_get(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_flash_t * const p_peer_data); /**@brief Function for retrieving pointers to a write buffer for peer data. @@ -244,7 +234,7 @@ ret_code_t pdb_write_buf_release(pm_peer_id_t peer_id, pm_peer_data_id_t data_id * @param[in] data_id The type of data to reserve space for. * * @retval NRF_SUCCESS Successfully reserved space in persistent storage. - * @retval NRF_ERROR_NO_MEM Not enough room in persistent storage. + * @retval NRF_ERROR_STORAGE_FULL Not enough room in persistent storage. * @retval NRF_ERROR_BUSY Could not process request at this time. Reattempt later. * @retval NRF_ERROR_NOT_FOUND No buffer has been allocated for this peer ID/data ID pair. * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated. @@ -261,7 +251,7 @@ ret_code_t pdb_write_buf_store_prepare(pm_peer_id_t peer_id, pm_peer_data_id_t d * @param[in] data_id Which piece of data to store. * * @retval NRF_SUCCESS Data storing was successfully started. - * @retval NRF_ERROR_NO_MEM No space available in persistent storage. Please clear some + * @retval NRF_ERROR_STORAGE_FULL No space available in persistent storage. Please clear some * space, the operation will be reattempted after the next compress * procedure. This error will not happen if * @ref pdb_write_buf_store_prepare is called beforehand. @@ -313,6 +303,21 @@ uint32_t pdb_n_peers(void); pm_peer_id_t pdb_next_peer_id_get(pm_peer_id_t prev_peer_id); +/**@brief Function for getting the next peer ID in the sequence of all peer IDs pending deletion. + * Can be used to loop through all used peer IDs. + * + * @note @ref PM_PEER_ID_INVALID is considered to be before the first and after the last ordinary + * peer ID. + * + * @param[in] prev_peer_id The previous peer ID. + * + * @return The next peer ID pending deletion. + * @return The first ordinary peer ID if prev_peer_id was @ref PM_PEER_ID_INVALID. + * @retval PM_PEER_ID_INVALID if prev_peer_id was the last ordinary peer ID. + */ +pm_peer_id_t pdb_next_deleted_peer_id_get(pm_peer_id_t prev_peer_id); + + /**@brief Function for updating currently stored peer data to a new version * * @details Updating happens asynchronously. @@ -326,7 +331,7 @@ pm_peer_id_t pdb_next_peer_id_get(pm_peer_id_t prev_peer_id); * @retval NRF_SUCESS The update was initiated successfully * @retval NRF_ERROR_NOT_FOUND The old store token was invalid. * @retval NRF_ERROR_NULL Data contained a NULL pointer. - * @retval NRF_ERROR_NO_MEM No space available in persistent storage. + * @retval NRF_ERROR_STORAGE_FULL No space available in persistent storage. * @retval NRF_ERROR_BUSY FDS or underlying modules are busy and can't take any * more requests * @retval NRF_ERROR_INVALID_STATE Module is not initialized. @@ -336,25 +341,24 @@ ret_code_t pdb_peer_data_update(pm_peer_data_const_t peer_data, pm_store_token_t * p_store_token); -/**@brief Function for reading data directly from persistent storage to external memory. +/**@brief Function for copy peer data from flash into a provided buffer. * - * @param[in] peer_id ID of peer to read data for. - * @param[in] data_id Which piece of data to read. - * @param[inout] p_peer_data Where to store the data. If the data to be read has variable length, - * the appropriate length field needs to reflect the available buffer - * space. On a successful read, the length field is updated to match the - * length of the read data. + * @param[in] peer_id The peer the data belongs to. + * @param[in] data_id The data to read. + * @param[inout] p_peer_data The buffer where to copy data into. The field @c length_words in this + * parameter must represent the buffer length in words. * - * @retval NRF_SUCCESS Data successfully read. - * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated. - * @retval NRF_ERROR_NULL p_peer_data contained a NULL pointer. - * @retval NRF_ERROR_NOT_FOUND This data was not found for this peer ID. - * @retval NRF_ERROR_DATA_SIZE The provided buffer was not large enough. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @note Actually, it represents the buffer length in bytes upon entering the function, + * and upon exit it represents the length of the data in words.. not good. Fix this. + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INVALID_PARAM If @p peer_id or @p data_id are invalid. + * @retval NRF_ERROR_NOT_FOUND If the data was not found in flash. + * @retval NRF_ERROR_NO_MEM If the provided buffer is too small. */ -ret_code_t pdb_raw_read(pm_peer_id_t peer_id, - pm_peer_data_id_t data_id, - pm_peer_data_t * p_peer_data); +ret_code_t pdb_peer_data_load(pm_peer_id_t peer_id, + pm_peer_data_id_t data_id, + pm_peer_data_t * const p_peer_data); /**@brief Function for writing data directly to persistent storage from external memory. @@ -367,9 +371,8 @@ ret_code_t pdb_raw_read(pm_peer_id_t peer_id, * @retval NRF_SUCCESS Data successfully written. * @retval NRF_ERROR_INVALID_PARAM Data ID or Peer ID was invalid or unallocated. * @retval NRF_ERROR_NULL p_peer_data contained a NULL pointer. - * @retval NRF_ERROR_NO_MEM No space available in persistent storage. + * @retval NRF_ERROR_STORAGE_FULL No space available in persistent storage. * @retval NRF_ERROR_INVALID_LENGTH Data length above the maximum allowed. - * @retval NRF_ERROR_INVALID_STATE Module is not initialized. * @retval NRF_ERROR_BUSY Unable to perform operation at this time. */ ret_code_t pdb_raw_store(pm_peer_id_t peer_id, @@ -380,6 +383,11 @@ ret_code_t pdb_raw_store(pm_peer_id_t peer_id, * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* PEER_DATABASE_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.c index df7ac58e2b..4bf5b08f1e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.c @@ -36,8 +36,8 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "peer_id.h" #include @@ -49,7 +49,7 @@ typedef struct { - uint8_t active_peer_ids[MUTEX_STORAGE_SIZE(PM_PEER_ID_N_AVAILABLE_IDS)]; /**< Bitmap designating which peer IDs are in use. */ + uint8_t used_peer_ids[MUTEX_STORAGE_SIZE(PM_PEER_ID_N_AVAILABLE_IDS)]; /**< Bitmap designating which peer IDs are in use. */ uint8_t deleted_peer_ids[MUTEX_STORAGE_SIZE(PM_PEER_ID_N_AVAILABLE_IDS)]; /**< Bitmap designating which peer IDs are marked for deletion. */ } pi_t; @@ -66,7 +66,7 @@ static void internal_state_reset(pi_t * p_pi) void peer_id_init(void) { internal_state_reset(&m_pi); - pm_mutex_init(m_pi.active_peer_ids, PM_PEER_ID_N_AVAILABLE_IDS); + pm_mutex_init(m_pi.used_peer_ids, PM_PEER_ID_N_AVAILABLE_IDS); pm_mutex_init(m_pi.deleted_peer_ids, PM_PEER_ID_N_AVAILABLE_IDS); } @@ -102,24 +102,28 @@ static void release(pm_peer_id_t peer_id, uint8_t * mutex_group) pm_peer_id_t peer_id_allocate(pm_peer_id_t peer_id) { - return claim(peer_id, m_pi.active_peer_ids); + return claim(peer_id, m_pi.used_peer_ids); } bool peer_id_delete(pm_peer_id_t peer_id) { + pm_peer_id_t deleted_peer_id; + if (peer_id == PM_PEER_ID_INVALID) { return false; } - pm_peer_id_t deleted_id = claim(peer_id, m_pi.deleted_peer_ids); - return (deleted_id == peer_id); + + deleted_peer_id = claim(peer_id, m_pi.deleted_peer_ids); + + return (deleted_peer_id == peer_id); } void peer_id_free(pm_peer_id_t peer_id) { - release(peer_id, m_pi.active_peer_ids); + release(peer_id, m_pi.used_peer_ids); release(peer_id, m_pi.deleted_peer_ids); } @@ -128,7 +132,7 @@ bool peer_id_is_allocated(pm_peer_id_t peer_id) { if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS) { - return pm_mutex_lock_status_get(m_pi.active_peer_ids, peer_id); + return pm_mutex_lock_status_get(m_pi.used_peer_ids, peer_id); } return false; } @@ -159,9 +163,21 @@ pm_peer_id_t next_id_get(pm_peer_id_t prev_peer_id, uint8_t * mutex_group) } -pm_peer_id_t peer_id_get_next_used(pm_peer_id_t prev_peer_id) +pm_peer_id_t peer_id_get_next_used(pm_peer_id_t peer_id) { - return next_id_get(prev_peer_id, m_pi.active_peer_ids); + peer_id = next_id_get(peer_id, m_pi.used_peer_ids); + + while (peer_id != PM_PEER_ID_INVALID) + { + if (!peer_id_is_deleted(peer_id)) + { + return peer_id; + } + + peer_id = next_id_get(peer_id, m_pi.used_peer_ids); + } + + return peer_id; } @@ -177,10 +193,9 @@ uint32_t peer_id_n_ids(void) for (pm_peer_id_t i = 0; i < PM_PEER_ID_N_AVAILABLE_IDS; i++) { - n_ids += pm_mutex_lock_status_get(m_pi.active_peer_ids, i); + n_ids += pm_mutex_lock_status_get(m_pi.used_peer_ids, i); } return n_ids; } - - +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.h index ac68851451..0c1116c8cb 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_id.h @@ -37,16 +37,19 @@ */ - #ifndef PEER_ID_H__ #define PEER_ID_H__ #include #include "sdk_errors.h" -#include "nrf_ble_gap.h" +#include "ble_gap.h" #include "peer_manager_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN @@ -156,4 +159,9 @@ uint32_t peer_id_n_ids(void); * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* PEER_ID_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.c index 7d11076083..0effe7bd02 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.c @@ -36,69 +36,58 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "peer_manager.h" #include -#include "app_util.h" #include "security_manager.h" +#include "security_dispatcher.h" #include "gatt_cache_manager.h" +#include "gatts_cache_manager.h" #include "peer_database.h" +#include "peer_data_storage.h" #include "id_manager.h" #include "ble_conn_state.h" -#include "sdk_common.h" #include "peer_manager_internal.h" -#define MODULE_INITIALIZED m_pm.initialized -#include "sdk_macros.h" + +/**< The number of event handlers that can be registered with the module. */ +#define MAX_REGISTRANTS (3) +/**< Macro indicating whether the module has been initialized properly. */ +#define MODULE_INITIALIZED (m_module_initialized) -#define MAX_REGISTRANTS 3 /**< The number of event handlers that can be registered with the module. */ +static bool m_module_initialized; /**< Whether or not @ref pm_init has been called successfully. */ +static bool m_peer_rank_initialized; /**< Whether or not @ref rank_init has been called successfully. */ +static bool m_deleting_all; /**< True from when @ref pm_peers_delete is called until all peers have been deleted. */ +static pm_store_token_t m_peer_rank_token; /**< The store token of an ongoing peer rank update via a call to @ref pm_peer_rank_highest. If @ref PM_STORE_TOKEN_INVALID, there is no ongoing update. */ +static uint32_t m_current_highest_peer_rank; /**< The current highest peer rank. Used by @ref pm_peer_rank_highest. */ +static pm_peer_id_t m_highest_ranked_peer; /**< The peer with the highest peer rank. Used by @ref pm_peer_rank_highest. */ +static pm_evt_handler_t m_evt_handlers[MAX_REGISTRANTS]; /**< The subscribers to Peer Manager events, as registered through @ref pm_register. */ +static uint8_t m_n_registrants; /**< The number of event handlers registered through @ref pm_register. */ +static ble_conn_state_user_flag_id_t m_pairing_flag_id; /**< The flag ID for which connections are paired. */ +static ble_conn_state_user_flag_id_t m_bonding_flag_id; /**< The flag ID for which connections are bonded. */ -/**@brief Internal state of the module. - */ -typedef struct -{ - uint8_t initialized : 1; /**< Whether or not @ref pm_init has been called successfully. */ - uint8_t peer_rank_initialized : 1; /**< Whether or not @ref rank_init has been called successfully. */ - uint8_t deleting_all : 1; /**< True from when @ref pm_peers_delete is called until all peers have been deleted. */ - pm_store_token_t peer_rank_token; /**< The store token of an ongoing peer rank update via a call to @ref pm_peer_rank_highest. If @ref PM_STORE_TOKEN_INVALID, there is no ongoing update. */ - uint32_t current_highest_peer_rank; /**< The current highest peer rank. Used by @ref pm_peer_rank_highest. */ - pm_peer_id_t highest_ranked_peer; /**< The peer with the highest peer rank. Used by @ref pm_peer_rank_highest. */ - pm_evt_handler_t evt_handlers[MAX_REGISTRANTS]; /**< The subscribers to Peer Manager events, as registered through @ref pm_register. */ - uint8_t n_registrants; /**< The number of event handlers registered through @ref pm_register. */ - ble_conn_state_user_flag_id_t pairing_flag_id; /**< The flag ID for which connections are paired. */ - ble_conn_state_user_flag_id_t bonding_flag_id; /**< The flag ID for which connections are bonded. */ -} pm_t; - - -/**@brief Instantiation of Peer Manager internal state. - */ -static pm_t m_pm = -{ - .initialized = 0, - .peer_rank_initialized = 0, -}; - /**@brief Function for sending a Peer Manager event to all subscribers. * * @param[in] p_pm_evt The event to send. */ static void evt_send(pm_evt_t * p_pm_evt) { - for (int i = 0; i < m_pm.n_registrants; i++) + for (int i = 0; i < m_n_registrants; i++) { - m_pm.evt_handlers[i](p_pm_evt); + m_evt_handlers[i](p_pm_evt); } } /**@brief Event handler for events from the Peer Database module. + * This handler is extern in the Peer Database module. * * @param[in] p_pdb_evt The incoming Peer Database event. */ -static void pdb_evt_handler(pdb_evt_t const * p_pdb_evt) +void pm_pdb_evt_handler(pdb_evt_t const * p_pdb_evt) { bool send_evt = true; pm_evt_t pm_evt; @@ -125,11 +114,11 @@ static void pdb_evt_handler(pdb_evt_t const * p_pdb_evt) = p_pdb_evt->params.raw_stored_evt.store_token; pm_evt.params.peer_data_update_succeeded.flash_changed = true; - if( (m_pm.peer_rank_token != PM_STORE_TOKEN_INVALID) - && (m_pm.peer_rank_token == p_pdb_evt->params.raw_stored_evt.store_token)) + if ( (m_peer_rank_token != PM_STORE_TOKEN_INVALID) + && (m_peer_rank_token == p_pdb_evt->params.raw_stored_evt.store_token)) { - m_pm.peer_rank_token = PM_STORE_TOKEN_INVALID; - m_pm.highest_ranked_peer = pm_evt.peer_id; + m_peer_rank_token = PM_STORE_TOKEN_INVALID; + m_highest_ranked_peer = pm_evt.peer_id; pm_evt.params.peer_data_update_succeeded.token = PM_STORE_TOKEN_INVALID; } @@ -144,11 +133,11 @@ static void pdb_evt_handler(pdb_evt_t const * p_pdb_evt) pm_evt.params.peer_data_update_failed.error = p_pdb_evt->params.error_raw_store_evt.err_code; - if( (m_pm.peer_rank_token != PM_STORE_TOKEN_INVALID) - && (m_pm.peer_rank_token == p_pdb_evt->params.raw_stored_evt.store_token)) + if ( (m_peer_rank_token != PM_STORE_TOKEN_INVALID) + && (m_peer_rank_token == p_pdb_evt->params.raw_stored_evt.store_token)) { - m_pm.peer_rank_token = PM_STORE_TOKEN_INVALID; - m_pm.current_highest_peer_rank -= 1; + m_peer_rank_token = PM_STORE_TOKEN_INVALID; + m_current_highest_peer_rank -= 1; pm_evt.params.peer_data_update_succeeded.token = PM_STORE_TOKEN_INVALID; } @@ -171,11 +160,13 @@ static void pdb_evt_handler(pdb_evt_t const * p_pdb_evt) case PDB_EVT_PEER_FREED: pm_evt.evt_id = PM_EVT_PEER_DELETE_SUCCEEDED; - if (m_pm.deleting_all && (pdb_next_peer_id_get(PM_PEER_ID_INVALID) == PM_PEER_ID_INVALID)) + // Check that no peers marked for deletion are left. + if (m_deleting_all + && (pdb_next_peer_id_get(PM_PEER_ID_INVALID) == PM_PEER_ID_INVALID) + && (pdb_next_deleted_peer_id_get(PM_PEER_ID_INVALID) == PM_PEER_ID_INVALID)) { // pm_peers_delete() has been called and this is the last peer to be deleted. - - m_pm.deleting_all = false; + m_deleting_all = false; pm_evt_t pm_delete_all_evt; memset(&pm_delete_all_evt, 0, sizeof(pm_evt_t)); @@ -191,11 +182,11 @@ static void pdb_evt_handler(pdb_evt_t const * p_pdb_evt) pm_evt.evt_id = PM_EVT_PEER_DELETE_FAILED; pm_evt.params.peer_delete_failed.error = p_pdb_evt->params.peer_free_failed_evt.err_code; - if (m_pm.deleting_all) + if (m_deleting_all) { // pm_peers_delete() has been called and has thus failed. - m_pm.deleting_all = false; + m_deleting_all = false; pm_evt_t pm_delete_all_evt; memset(&pm_delete_all_evt, 0, sizeof(pm_evt_t)); @@ -235,10 +226,11 @@ static void pdb_evt_handler(pdb_evt_t const * p_pdb_evt) /**@brief Event handler for events from the Security Manager module. + * This handler is extern in the Security Manager module. * * @param[in] p_sm_evt The incoming Security Manager event. */ -static void sm_evt_handler(sm_evt_t const * p_sm_evt) +void pm_sm_evt_handler(sm_evt_t const * p_sm_evt) { bool find_peer_id = true; bool send_evt = true; @@ -260,8 +252,8 @@ static void sm_evt_handler(sm_evt_t const * p_sm_evt) != PM_LINK_SECURED_PROCEDURE_ENCRYPTION; bool bonding = p_sm_evt->params.sec_procedure_start.procedure == PM_LINK_SECURED_PROCEDURE_BONDING; - ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_pm.pairing_flag_id, pairing); - ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_pm.bonding_flag_id, bonding); + ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_pairing_flag_id, pairing); + ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_bonding_flag_id, bonding); break; } @@ -271,9 +263,9 @@ static void sm_evt_handler(sm_evt_t const * p_sm_evt) p_sm_evt->params.pairing_success.bonded ? PM_LINK_SECURED_PROCEDURE_BONDING : PM_LINK_SECURED_PROCEDURE_PAIRING; - ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_pm.pairing_flag_id, true); + ble_conn_state_user_flag_set(p_sm_evt->conn_handle, m_pairing_flag_id, true); ble_conn_state_user_flag_set(p_sm_evt->conn_handle, - m_pm.bonding_flag_id, + m_bonding_flag_id, p_sm_evt->params.pairing_success.bonded ); break; @@ -281,7 +273,7 @@ static void sm_evt_handler(sm_evt_t const * p_sm_evt) case SM_EVT_PAIRING_FAIL: pm_evt.evt_id = PM_EVT_CONN_SEC_FAILED; pm_evt.params.conn_sec_failed.procedure = - ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_pm.bonding_flag_id) + ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_bonding_flag_id) ? PM_LINK_SECURED_PROCEDURE_BONDING : PM_LINK_SECURED_PROCEDURE_PAIRING; pm_evt.params.conn_sec_failed.error_src @@ -291,7 +283,7 @@ static void sm_evt_handler(sm_evt_t const * p_sm_evt) break; case SM_EVT_LINK_ENCRYPTION_UPDATE: - if (!ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_pm.pairing_flag_id)) + if (!ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_pairing_flag_id)) { pm_evt.evt_id = PM_EVT_CONN_SEC_SUCCEEDED; pm_evt.params.conn_sec_succeeded.procedure = PM_LINK_SECURED_PROCEDURE_ENCRYPTION; @@ -343,7 +335,7 @@ static void sm_evt_handler(sm_evt_t const * p_sm_evt) case SM_EVT_ERROR_SMP_TIMEOUT: pm_evt.evt_id = PM_EVT_CONN_SEC_FAILED; pm_evt.params.conn_sec_failed.procedure - = ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_pm.bonding_flag_id) + = ble_conn_state_user_flag_get(p_sm_evt->conn_handle, m_bonding_flag_id) ? PM_LINK_SECURED_PROCEDURE_BONDING : PM_LINK_SECURED_PROCEDURE_PAIRING; pm_evt.params.conn_sec_failed.error_src = BLE_GAP_SEC_STATUS_SOURCE_LOCAL; @@ -372,12 +364,12 @@ static void sm_evt_handler(sm_evt_t const * p_sm_evt) /**@brief Event handler for events from the GATT Cache Manager module. + * This handler is extern in GATT Cache Manager. * * @param[in] p_gcm_evt The incoming GATT Cache Manager event. */ -static void gcm_evt_handler(gcm_evt_t const * p_gcm_evt) +void pm_gcm_evt_handler(gcm_evt_t const * p_gcm_evt) { - bool send_evt = true; pm_evt_t pm_evt; @@ -444,10 +436,11 @@ static void gcm_evt_handler(gcm_evt_t const * p_gcm_evt) /**@brief Event handler for events from the ID Manager module. + * This function is registered in the ID Manager. * * @param[in] p_im_evt The incoming ID Manager event. */ -static void im_evt_handler(im_evt_t const * p_im_evt) +void pm_im_evt_handler(im_evt_t const * p_im_evt) { pm_evt_t pm_evt; ret_code_t err_code; @@ -462,7 +455,7 @@ static void im_evt_handler(im_evt_t const * p_im_evt) break; case IM_EVT_BONDED_PEER_CONNECTED: - ble_conn_state_user_flag_set(p_im_evt->conn_handle, m_pm.bonding_flag_id, true); + ble_conn_state_user_flag_set(p_im_evt->conn_handle, m_bonding_flag_id, true); memset(&pm_evt, 0, sizeof(pm_evt_t)); pm_evt.conn_handle = p_im_evt->conn_handle; pm_evt.peer_id = im_peer_id_get_by_conn_handle(p_im_evt->conn_handle); @@ -487,11 +480,10 @@ void pm_on_ble_evt(ble_evt_t * p_ble_evt) */ static void internal_state_reset() { - memset(&m_pm, 0, sizeof(m_pm)); - m_pm.highest_ranked_peer = PM_PEER_ID_INVALID; - m_pm.peer_rank_token = PM_STORE_TOKEN_INVALID; - m_pm.pairing_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; - m_pm.bonding_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; + m_highest_ranked_peer = PM_PEER_ID_INVALID; + m_peer_rank_token = PM_STORE_TOKEN_INVALID; + m_pairing_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; + m_bonding_flag_id = BLE_CONN_STATE_USER_FLAG_INVALID; } @@ -499,29 +491,43 @@ ret_code_t pm_init(void) { ret_code_t err_code; - err_code = pdb_register(pdb_evt_handler); - if (err_code != NRF_SUCCESS) - { - if (err_code != NRF_ERROR_INVALID_STATE) - { - err_code = NRF_ERROR_INTERNAL; - } - return err_code; - } - - err_code = sm_register(sm_evt_handler); + err_code = pds_init(); if (err_code != NRF_SUCCESS) { return NRF_ERROR_INTERNAL; } - err_code = gcm_init(gcm_evt_handler); + err_code = pdb_init(); if (err_code != NRF_SUCCESS) { return NRF_ERROR_INTERNAL; } - err_code = im_register(im_evt_handler); + err_code = sm_init(); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = smd_init(); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = gcm_init(); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = gscm_init(); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = im_init(); if (err_code != NRF_SUCCESS) { return NRF_ERROR_INTERNAL; @@ -529,20 +535,20 @@ ret_code_t pm_init(void) internal_state_reset(); - m_pm.pairing_flag_id = ble_conn_state_user_flag_acquire(); - if (m_pm.pairing_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) + m_pairing_flag_id = ble_conn_state_user_flag_acquire(); + if (m_pairing_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) { return NRF_ERROR_INTERNAL; } - m_pm.bonding_flag_id = ble_conn_state_user_flag_acquire(); - if (m_pm.bonding_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) + m_bonding_flag_id = ble_conn_state_user_flag_acquire(); + if (m_bonding_flag_id == BLE_CONN_STATE_USER_FLAG_INVALID) { return NRF_ERROR_INTERNAL; } - m_pm.peer_rank_initialized = false; - m_pm.initialized = true; + m_peer_rank_initialized = false; + m_module_initialized = true; return NRF_SUCCESS; } @@ -552,13 +558,13 @@ ret_code_t pm_register(pm_evt_handler_t event_handler) { VERIFY_MODULE_INITIALIZED(); - if (m_pm.n_registrants >= MAX_REGISTRANTS) + if (m_n_registrants >= MAX_REGISTRANTS) { return NRF_ERROR_NO_MEM; } - m_pm.evt_handlers[m_pm.n_registrants] = event_handler; - m_pm.n_registrants += 1; + m_evt_handlers[m_n_registrants] = event_handler; + m_n_registrants += 1; return NRF_SUCCESS; } @@ -572,11 +578,8 @@ ret_code_t pm_sec_params_set(ble_gap_sec_params_t * p_sec_params) err_code = sm_sec_params_set(p_sec_params); - if (err_code == NRF_ERROR_INVALID_STATE) - { - err_code = NRF_ERROR_INTERNAL; - } - + // NRF_ERROR_INVALID_PARAM if parameters are invalid, + // NRF_SUCCESS otherwise. return err_code; } @@ -613,19 +616,70 @@ void pm_local_database_has_changed(void) } -ret_code_t pm_whitelist_create(pm_peer_id_t * p_peer_ids, - uint8_t n_peer_ids, - ble_gap_whitelist_t * p_whitelist) +ret_code_t pm_id_addr_set(ble_gap_addr_t const * p_addr) { VERIFY_MODULE_INITIALIZED(); - return im_whitelist_create(p_peer_ids, n_peer_ids, p_whitelist); + return im_id_addr_set(p_addr); } -ret_code_t pm_whitelist_custom(ble_gap_whitelist_t * p_whitelist) +ret_code_t pm_id_addr_get(ble_gap_addr_t * p_addr) { VERIFY_MODULE_INITIALIZED(); - return im_whitelist_custom(p_whitelist); + VERIFY_PARAM_NOT_NULL(p_addr); + return im_id_addr_get(p_addr); +} + + +ret_code_t pm_privacy_set(pm_privacy_params_t const * p_privacy_params) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_privacy_params); + return im_privacy_set(p_privacy_params); +} + + +ret_code_t pm_privacy_get(pm_privacy_params_t * p_privacy_params) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_privacy_params); + VERIFY_PARAM_NOT_NULL(p_privacy_params->p_device_irk); + return im_privacy_get(p_privacy_params); +} + + +ret_code_t pm_whitelist_set(pm_peer_id_t const * p_peers, + uint32_t peer_cnt) +{ + VERIFY_MODULE_INITIALIZED(); + return im_whitelist_set(p_peers, peer_cnt); +} + + +ret_code_t pm_whitelist_get(ble_gap_addr_t * p_addrs, + uint32_t * p_addr_cnt, + ble_gap_irk_t * p_irks, + uint32_t * p_irk_cnt) +{ + VERIFY_MODULE_INITIALIZED(); + + if (((p_addrs == NULL) && (p_irks == NULL)) || + ((p_addrs != NULL) && (p_addr_cnt == NULL)) || + ((p_irks != NULL) && (p_irk_cnt == NULL))) + { + // The buffers can't be both NULL, and if a buffer is provided its size must be specified. + return NRF_ERROR_NULL; + } + + return im_whitelist_get(p_addrs, p_addr_cnt, p_irks, p_irk_cnt); +} + + +ret_code_t pm_device_identities_list_set(pm_peer_id_t const * p_peers, + uint32_t peer_cnt) +{ + VERIFY_MODULE_INITIALIZED(); + return im_device_identities_list_set(p_peers, peer_cnt); } @@ -642,7 +696,7 @@ ret_code_t pm_conn_sec_status_get(uint16_t conn_handle, pm_conn_sec_status_t * p } p_conn_sec_status->connected = (status == BLE_CONN_STATUS_CONNECTED); - p_conn_sec_status->bonded = ble_conn_state_user_flag_get(conn_handle, m_pm.bonding_flag_id); + p_conn_sec_status->bonded = ble_conn_state_user_flag_get(conn_handle, m_bonding_flag_id); p_conn_sec_status->encrypted = ble_conn_state_encrypted(conn_handle); p_conn_sec_status->mitm_protected = ble_conn_state_mitm_protected(conn_handle); return NRF_SUCCESS; @@ -713,7 +767,7 @@ ret_code_t pm_peer_data_load(pm_peer_id_t peer_id, peer_data.data_id = data_id; peer_data.p_all_data = p_data; - ret_code_t err_code = pdb_raw_read(peer_id, data_id, &peer_data); + ret_code_t err_code = pdb_peer_data_load(peer_id, data_id, &peer_data); *p_length = peer_data.length_words * BYTES_PER_WORD; @@ -767,7 +821,7 @@ ret_code_t pm_peer_data_store(pm_peer_id_t peer_id, return NRF_ERROR_INVALID_PARAM; } - pm_peer_data_const_t peer_data; + pm_peer_data_flash_t peer_data; memset(&peer_data, 0, sizeof(peer_data)); peer_data.length_words = BYTES_TO_WORDS(length); peer_data.data_id = data_id; @@ -832,33 +886,60 @@ ret_code_t pm_peer_new(pm_peer_id_t * p_new_peer_id, pm_peer_data_bonding_t * p_bonding_data, pm_store_token_t * p_token) { + ret_code_t err_code; + pm_peer_id_t peer_id; + pm_peer_data_flash_t peer_data; + VERIFY_MODULE_INITIALIZED(); VERIFY_PARAM_NOT_NULL(p_bonding_data); VERIFY_PARAM_NOT_NULL(p_new_peer_id); - ret_code_t err_code; + + memset(&peer_data, 0, sizeof(pm_peer_data_flash_t)); + + // Search through existing bonds to look for a duplicate. + pds_peer_data_iterate_prepare(); + + // @note emdi: should maybe use a critical section, since data is not copied while iterating. + while (pds_peer_data_iterate(PM_PEER_DATA_ID_BONDING, &peer_id, &peer_data)) + { + if (im_is_duplicate_bonding_data(p_bonding_data, peer_data.p_bonding_data)) + { + *p_new_peer_id = peer_id; + return NRF_SUCCESS; + } + } + + // If no duplicate data is found, prepare to write a new bond to flash. *p_new_peer_id = pdb_peer_allocate(); + if (*p_new_peer_id == PM_PEER_ID_INVALID) { return NRF_ERROR_NO_MEM; } - pm_peer_data_const_t peer_data; - memset(&peer_data, 0, sizeof(pm_peer_data_const_t)); - peer_data.length_words = BYTES_TO_WORDS(sizeof(pm_peer_data_bonding_t)); - peer_data.data_id = PM_PEER_DATA_ID_BONDING; - peer_data.p_bonding_data = p_bonding_data; + memset(&peer_data, 0, sizeof(pm_peer_data_flash_t)); + + peer_data.data_id = PM_PEER_DATA_ID_BONDING; + peer_data.p_bonding_data = p_bonding_data; + peer_data.length_words = BYTES_TO_WORDS(sizeof(pm_peer_data_bonding_t)); + + err_code = pdb_raw_store(*p_new_peer_id, &peer_data, p_token); - err_code = pm_peer_data_bonding_store(*p_new_peer_id, p_bonding_data, p_token); if (err_code != NRF_SUCCESS) { - ret_code_t err_code_free = im_peer_free(*p_new_peer_id); - if (err_code_free != NRF_SUCCESS) + if (im_peer_free(*p_new_peer_id) != NRF_SUCCESS) { - err_code = NRF_ERROR_INTERNAL; + return NRF_ERROR_INTERNAL; } + + // NRF_ERROR_STORAGE_FULL, if no space in flash. + // NRF_ERROR_BUSY, if flash filesystem was busy. + // NRF_ERROR_INTENRAL, on internal error. + return err_code; } - return err_code; + + return NRF_SUCCESS; } @@ -874,7 +955,7 @@ ret_code_t pm_peers_delete(void) { VERIFY_MODULE_INITIALIZED(); - m_pm.deleting_all = true; + m_deleting_all = true; pm_peer_id_t current_peer_id = pdb_next_peer_id_get(PM_PEER_ID_INVALID); while (current_peer_id != PM_PEER_ID_INVALID) @@ -905,7 +986,7 @@ ret_code_t pm_peer_ranks_get(pm_peer_id_t * p_highest_ranked_peer, pm_peer_data_t peer_data = {.length_words = BYTES_TO_WORDS(sizeof(peer_rank)), .p_peer_rank = &peer_rank}; //lint -restore - ret_code_t err_code = pdb_raw_read(peer_id, PM_PEER_DATA_ID_PEER_RANK, &peer_data); + ret_code_t err_code = pdb_peer_data_load(peer_id, PM_PEER_DATA_ID_PEER_RANK, &peer_data); uint32_t highest_rank = 0; uint32_t lowest_rank = 0xFFFFFFFF; pm_peer_id_t highest_ranked_peer = PM_PEER_ID_INVALID; @@ -934,7 +1015,7 @@ ret_code_t pm_peer_ranks_get(pm_peer_id_t * p_highest_ranked_peer, lowest_ranked_peer = peer_id; } peer_id = pdb_next_peer_id_get(peer_id); - err_code = pdb_raw_read(peer_id, PM_PEER_DATA_ID_PEER_RANK, &peer_data); + err_code = pdb_peer_data_load(peer_id, PM_PEER_DATA_ID_PEER_RANK, &peer_data); } if (peer_id == PM_PEER_ID_INVALID) { @@ -968,13 +1049,13 @@ ret_code_t pm_peer_ranks_get(pm_peer_id_t * p_highest_ranked_peer, */ static void rank_init(void) { - ret_code_t err_code = pm_peer_ranks_get(&m_pm.highest_ranked_peer, - &m_pm.current_highest_peer_rank, + ret_code_t err_code = pm_peer_ranks_get(&m_highest_ranked_peer, + &m_current_highest_peer_rank, NULL, NULL); if ((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NOT_FOUND)) { - m_pm.peer_rank_initialized = true; + m_peer_rank_initialized = true; } } @@ -985,24 +1066,24 @@ ret_code_t pm_peer_rank_highest(pm_peer_id_t peer_id) ret_code_t err_code; //lint -save -e65 -e64 - pm_peer_data_const_t peer_data = {.length_words = BYTES_TO_WORDS(sizeof(m_pm.current_highest_peer_rank)), + pm_peer_data_flash_t peer_data = {.length_words = BYTES_TO_WORDS(sizeof(m_current_highest_peer_rank)), .data_id = PM_PEER_DATA_ID_PEER_RANK, - .p_peer_rank = &m_pm.current_highest_peer_rank}; + .p_peer_rank = &m_current_highest_peer_rank}; //lint -restore - if (!m_pm.peer_rank_initialized) + if (!m_peer_rank_initialized) { rank_init(); } - if (!m_pm.peer_rank_initialized || (m_pm.peer_rank_token != PM_STORE_TOKEN_INVALID)) + if (!m_peer_rank_initialized || (m_peer_rank_token != PM_STORE_TOKEN_INVALID)) { err_code = NRF_ERROR_BUSY; } else { - if ((peer_id == m_pm.highest_ranked_peer) && (m_pm.current_highest_peer_rank > 0)) + if ((peer_id == m_highest_ranked_peer) && (m_current_highest_peer_rank > 0)) { pm_evt_t pm_evt; @@ -1022,14 +1103,14 @@ ret_code_t pm_peer_rank_highest(pm_peer_id_t peer_id) } else { - m_pm.current_highest_peer_rank += 1; - err_code = pdb_raw_store(peer_id, &peer_data, &m_pm.peer_rank_token); + m_current_highest_peer_rank += 1; + err_code = pdb_raw_store(peer_id, &peer_data, &m_peer_rank_token); if (err_code != NRF_SUCCESS) { - m_pm.peer_rank_token = PM_STORE_TOKEN_INVALID; - m_pm.current_highest_peer_rank -= 1; - if ((err_code != NRF_ERROR_BUSY) && (err_code != NRF_ERROR_NO_MEM)) + m_peer_rank_token = PM_STORE_TOKEN_INVALID; + m_current_highest_peer_rank -= 1; { + if ((err_code != NRF_ERROR_BUSY) && (err_code != NRF_ERROR_STORAGE_FULL)) err_code = NRF_ERROR_INTERNAL; } } @@ -1037,3 +1118,4 @@ ret_code_t pm_peer_rank_highest(pm_peer_id_t peer_id) } return err_code; } +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h index 5618dbbd56..c128a1ab7a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h @@ -37,7 +37,6 @@ */ - /** * @file peer_manager.h * @@ -50,6 +49,10 @@ * * @details The API consists of functions for configuring the pairing and encryption behavior of the * device and functions for manipulating the stored data. + * + * This module uses Flash Data Storage (FDS) to interface with persistent storage. The + * Peer Manager needs exclusive use of certain FDS file IDs and record keys. See + * @ref lib_fds_functionality_keys for more information. */ @@ -59,11 +62,15 @@ #include #include #include "sdk_common.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "peer_manager_types.h" #include "peer_database.h" +#ifdef __cplusplus +extern "C" { +#endif + /**@brief Security status of a connection. @@ -195,7 +202,7 @@ typedef void (*pm_evt_handler_t)(pm_evt_t const * p_event); * functions. * * @retval NRF_SUCCESS If initialization was successful. - * @retval NRF_ERROR_INTERNAL If another error occurred. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ ret_code_t pm_init(void); @@ -208,6 +215,7 @@ ret_code_t pm_init(void); * * @retval NRF_SUCCESS If initialization was successful. * @retval NRF_ERROR_NULL If @p event_handler was NULL. + * @retval NRF_ERROR_NO_MEM If no more registrations can happen. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. */ ret_code_t pm_register(pm_evt_handler_t event_handler); @@ -226,7 +234,7 @@ ret_code_t pm_register(pm_evt_handler_t event_handler); * @retval NRF_SUCCESS If the parameters were set successfully. * @retval NRF_ERROR_INVALID_PARAM If the combination of parameters is invalid. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. - * @retval NRF_ERROR_INTERNAL If another error occurred. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ ret_code_t pm_sec_params_set(ble_gap_sec_params_t * p_sec_params); @@ -276,10 +284,12 @@ void pm_on_ble_evt(ble_evt_t * p_ble_evt); * operations can be performed on this link. * @retval BLE_ERROR_INVALID_CONN_HANDLE If the connection handle is invalid. * @retval NRF_ERROR_NOT_FOUND If the security parameters have not been set. - * @retval NRF_ERROR_NO_MEM If there is no more space in flash. + * @retval NRF_ERROR_STORAGE_FULL If there is no more space in persistent storage. + * @retval NRF_ERROR_NO_MEM If no more authentication procedures can run in parallel + * for the given role. See @ref sd_ble_gap_authenticate. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized, or the peer is * disconnected or in the process of disconnecting. - * @retval NRF_ERROR_INTERNAL If another error occurred. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ ret_code_t pm_conn_secure(uint16_t conn_handle, bool force_repairing); @@ -335,84 +345,201 @@ ret_code_t pm_conn_sec_status_get(uint16_t conn_handle, pm_conn_sec_status_t * p * * @param[in] p_public_key The public key to use for all subsequent LESC operations. * - * @retval NRF_SUCCESS Pairing initiated successfully. - * @retval NRF_ERROR_INVALID_STATE Peer Manager is not initialized. + * @retval NRF_SUCCESS If pairing was initiated successfully. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. */ ret_code_t pm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key); -/** - * @brief Function for constructing a whitelist for use when advertising. +/**@brief Function for setting or clearing the whitelist. * - * @details This function constructs a whitelist that contains the addresses and IRKs of the - * provided peer IDs. If @p p_peer_ids is NULL, the first (lowest) 8 peer IDs are chosen. - * If @ref ble_gap_whitelist_t.pp_addrs in @p p_whitelist is NULL, the whitelist contains - * only IRKs, and vice versa. + * When using the S13x SoftDevice v3.x, this function sets or clears the whitelist. + * When using the S13x SoftDevice v2.x, this function caches a list of + * peers that can be retrieved later by @ref pm_whitelist_get to pass to the @ref lib_ble_advertising. * - * @note When using a whitelist, always use the whitelist that was created or set by the most recent - * call to this function or to @ref pm_whitelist_custom. - * @note Do not call this function while advertising or scanning with another whitelist. + * To clear the current whitelist, pass either NULL as @p p_peers or zero as @p peer_cnt. * - * @param[in] p_peer_ids The IDs of the peers to be added to the whitelist, or NULL. - * @param[in] n_peer_ids The number of peer IDs in @p p_peer_ids. - * @param[in,out] p_whitelist The constructed whitelist. Note that @p p_whitelist->pp_addrs - * must be NULL or point to an array with size @ref - * BLE_GAP_WHITELIST_ADDR_MAX_COUNT and @p p_whitelist->pp_irks - * must be NULL or point to an array with size @ref - * BLE_GAP_WHITELIST_IRK_MAX_COUNT. + * @param[in] p_peers The peers to add to the whitelist. Pass NULL to clear the current whitelist. + * @param[in] peer_cnt The number of peers to add to the whitelist. The number must not be greater than + * @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. Pass zero to clear the current + * whitelist. * - * @retval NRF_SUCCESS If the whitelist was created successfully. - * @retval NRF_ERROR_NULL If @p p_whitelist was NULL. + * @retval NRF_SUCCESS If the whitelist was successfully set or cleared. + * @retval BLE_GAP_ERROR_WHITELIST_IN_USE If a whitelist is already in use and cannot be set. + * @retval BLE_ERROR_GAP_INVALID_BLE_ADDR If a peer in @p p_peers has an address that cannot + * be used for whitelisting. + * @retval NRF_ERROR_NOT_FOUND If any of the peers in @p p_peers cannot be found. + * @retval NRF_ERROR_DATA_SIZE If @p peer_cnt is greater than + * @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_whitelist_set(pm_peer_id_t const * p_peers, + uint32_t peer_cnt); + + +/**@brief Function for retrieving the previously set whitelist. + * + * The function retrieves the whitelist of GAP addresses and IRKs that was + * previously set by @ref pm_whitelist_set. + * + * To retrieve only GAP addresses or only IRKs, provide only one of the + * buffers. If a buffer is provided, its size must be specified. + * + * @param[out] p_addrs The buffer where to store GAP addresses. Pass NULL to retrieve + * only IRKs (in that case, @p p_irks must not be NULL). + * @param[in,out] p_addr_cnt In: The size of the @p p_addrs buffer. + * May be NULL if and only if @p p_addrs is NULL. + * Out: The number of GAP addresses copied into the buffer. + * If @p p_addrs is NULL, this parameter remains unchanged. + * @param[out] p_irks The buffer where to store IRKs. Pass NULL to retrieve + * only GAP addresses (in that case, @p p_addrs must not NULL). + * @param[in,out] p_irk_cnt In: The size of the @p p_irks buffer. + * May be NULL if and only if @p p_irks is NULL. + * Out: The number of IRKs copied into the buffer. + * If @p p_irks is NULL, this paramater remains unchanged. + * + * @retval NRF_SUCCESS If the whitelist was successfully retrieved. + * @retval BLE_ERROR_GAP_INVALID_BLE_ADDR If a peer has an address that cannot be used for + * whitelisting (this error can occur only + * when using the S13x SoftDevice v2.x). + * @retval NRF_ERROR_NULL If a required parameter is NULL. + * @retval NRF_ERROR_NO_MEM If the provided buffers are too small. + * @retval NRF_ERROR_NOT_FOUND If the data for any of the cached whitelisted peers + * cannot be found. It might have been deleted. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_whitelist_get(ble_gap_addr_t * p_addrs, + uint32_t * p_addr_cnt, + ble_gap_irk_t * p_irks, + uint32_t * p_irk_cnt); + + +/**@brief Function for setting and clearing the device identities list. + * + * @param[in] p_peers The peers to add to the device identities list. Pass NULL to clear + * the device identities list. + * @param[in] peer_cnt The number of peers. Pass zero to clear the device identities list. + * + * @retval NRF_SUCCESS If the device identities list was successfully + * set or cleared. + * @retval NRF_ERROR_NOT_FOUND If a peer is invalid or its data could not + * be found in flash. + * @retval BLE_ERROR_GAP_INVALID_BLE_ADDR If a peer has an address that cannot be + * used for whitelisting. + * @retval BLE_ERROR_GAP_DEVICE_IDENTITIES_IN_USE If the device identities list is in use and + * cannot be set. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + * @retval NRF_ERROR_NOT_SUPPORTED If using a SoftDevice that does not support + * device identities, e.g. S130 v2.0. + */ +ret_code_t pm_device_identities_list_set(pm_peer_id_t const * p_peers, + uint32_t peer_cnt); + + +/**@brief Function for setting the local Bluetooth identity address. + * + * @details The local Bluetooth identity address is the address that identifies the device to other + * peers. The address type must be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref + * BLE_GAP_ADDR_TYPE_RANDOM_STATIC. The identity address cannot be changed while roles are + * running. + * + * The SoftDevice sets a default address of type @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC + * when it is enabled. This default address is a random number that is populated during + * the IC manufacturing process. It remains unchanged for the lifetime of each IC, but the application can assign a different identity address. + * + * The identity address is distributed to the peer during bonding. + * If the address changes, the address stored in the peer device will not be valid and the + * ability to reconnect using the old address will be lost. + * + * + * @note The SoftDevice functions @ref sd_ble_gap_addr_set + * and @ref sd_ble_gap_privacy_set must not be called when using the Peer Manager. + * Use this function instead. + * + * @param[in] p_addr The GAP address to be set. + * + * @retval NRF_SUCCESS If the identity address was set successfully. + * @retval NRF_ERROR_NULL If @p p_addr is NULL. + * @retval NRF_ERROR_INVALID_ADDR If the @p p_addr pointer is invalid. + * @retval BLE_ERROR_GAP_INVALID_BLE_ADDR If the BLE address is invalid. + * @retval NRF_ERROR_BUSY If the SoftDevice was busy. Process SoftDevice events + * and retry. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized or if this function + * was called while advertising, scanning, or while connected. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. + */ +ret_code_t pm_id_addr_set(ble_gap_addr_t const * p_addr); + + +/**@brief Function for retrieving the local Bluetooth identity address. + * + * This function always returns the identity address, irrespective of the privacy settings. + * This means that the address type will always be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref + * BLE_GAP_ADDR_TYPE_RANDOM_STATIC. + * + * @param[out] p_addr Pointer to the address structure to be filled in. + * + * @retval NRF_SUCCESS If the address was retrieved successfully. + * @retval NRF_ERROR_NULL If @p p_addr is NULL. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_id_addr_get(ble_gap_addr_t * p_addr); + + +/**@brief Function for configuring privacy settings. + * + * The privacy settings cannot be configured while advertising, scanning, or while in a connection. + * + * @note The SoftDevice functions @ref sd_ble_gap_addr_set + * and @ref sd_ble_gap_privacy_set must not be called when using the Peer Manager. + * Use this function instead. + * + * @param[in] p_privacy_params Privacy settings. + * + * @retval NRF_SUCCESS If the privacy settings were configured successfully. + * @retval NRF_ERROR_NULL If @p p_privacy_params is NULL. + * @retval NRF_ERROR_BUSY If the operation could not be performed at this time. + * Process SoftDevice events and retry. + * @retval NRF_ERROR_INVALID_PARAM If the address type is invalid. + * @retval NRF_ERROR_INVALID_STATE If this function is called while BLE roles using + * privacy are enabled. + * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + */ +ret_code_t pm_privacy_set(pm_privacy_params_t const * p_privacy_params); + + +/**@brief Function for retrieving privacy settings. + * + * The privacy settings that are returned include the current IRK as well. + * + * @param[out] p_privacy_params Privacy settings. + * + * @retval NRF_SUCCESS If the privacy settings were retrieved successfully. + * @retval NRF_ERROR_NULL If @p p_privacy_params or @p p_privacy_params->p_device_irk is + * NULL. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. */ -ret_code_t pm_whitelist_create(pm_peer_id_t * p_peer_ids, - uint8_t n_peer_ids, - ble_gap_whitelist_t * p_whitelist); +ret_code_t pm_privacy_get(pm_privacy_params_t * p_privacy_params); -/** - * @brief Function for informing the Peer Manager of what whitelist should be used. - * - * @details This function should be used if the application wants to use a whitelist that is - * created in the application. When using Peer Manager, this function must be called to - * inform that the custom whitelist should be used instead of the one in Peer Manager. - * - * @note When using a whitelist, always use the whitelist that was created or set by the most recent - * call to this function or to @ref pm_whitelist_create. - * @note Do not call this function while advertising or scanning with another whitelist. - * @note Do not add any IRKs to the whitelist that are not present in the Peer Manager's persistent - * storage. - * - * @param[in] p_whitelist The whitelist. - * - * @retval NRF_SUCCESS If the operation completed successfully. - * @retval NRF_ERROR_NULL If @p p_whitelist was NULL. - * @retval NRF_ERROR_NOT_FOUND If one or more of the whitelist's IRKs was not found in the Peer - * Manager's persistent storage. - * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. - */ -ret_code_t pm_whitelist_custom(ble_gap_whitelist_t * p_whitelist); - - -/** - * @brief Function for getting the connection handle of the connection with a bonded peer. +/**@brief Function for getting the connection handle of the connection with a bonded peer. * * @param[in] peer_id The peer ID of the bonded peer. * @param[out] p_conn_handle Connection handle, or @ref BLE_ERROR_INVALID_CONN_HANDLE if the peer * is not connected. * - * @retval NRF_SUCCESS If the connection handle was determined successfully. + * @retval NRF_SUCCESS If the connection handle was retrieved successfully. * @retval NRF_ERROR_NULL If @p p_conn_handle was NULL. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. */ ret_code_t pm_conn_handle_get(pm_peer_id_t peer_id, uint16_t * p_conn_handle); -/**@brief Function for getting the peer ID of a connected peer. +/**@brief Function for retrieving the ID of a peer, given its connection handle. * - * @param[in] conn_handle Connection handle. - * @param[out] p_peer_id Peer ID, or @ref PM_PEER_ID_INVALID if the peer is not bonded or - * @p conn_handle does not refer to a connection. + * @param[in] conn_handle The connection handle of the peer. + * @param[out] p_peer_id The peer ID, or @ref PM_PEER_ID_INVALID if the peer is not bonded or + * @p conn_handle does not refer to a valid connection. * * @retval NRF_SUCCESS If the peer ID was retrieved successfully. * @retval NRF_ERROR_NULL If @p p_peer_id was NULL. @@ -518,7 +645,7 @@ ret_code_t pm_peer_data_app_data_load(pm_peer_id_t peer_id, * @note Writing the data to persistent storage happens asynchronously. Therefore, the buffer * that contains the data must be kept alive until the operation has completed. * - * @note The data written using this function may later be overwritten as a result of internal + * @note The data written using this function might later be overwritten as a result of internal * operations in the Peer Manager. A Peer Manager event is sent each time data is updated, * regardless of whether the operation originated internally or from action by the user. * @@ -588,7 +715,7 @@ ret_code_t pm_peer_data_app_data_store(pm_peer_id_t peer_id, * @retval NRF_ERROR_BUSY If the underlying flash handler is busy with other flash * operations. Try again after receiving a Peer Manager event. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. - * @retval NRF_ERROR_INTERNAL If another error occurred. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ ret_code_t pm_peer_data_delete(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); @@ -607,12 +734,12 @@ ret_code_t pm_peer_data_delete(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); * * @retval NRF_SUCCESS If the store operation for bonding data was initiated successfully. * @retval NRF_ERROR_NULL If @p p_bonding_data or @p p_new_peer_id is NULL. - * @retval NRF_ERROR_NO_MEM If there is no more space in persistent storage, so that the new - * peer cannot be allocated. - * @retval NRF_ERROR_BUSY If the underlying flash handler is busy with other flash + * @retval NRF_ERROR_STORAGE_FULL If there is no more space in persistent storage. + * @retval NRF_ERROR_NO_MEM If there are no more available peer IDs. + * @retval NRF_ERROR_BUSY If the underlying flash filesystem is busy with other flash * operations. Try again after receiving a Peer Manager event. - * @retval NRF_ERROR_INVALID_PARAM If the bonding data is invalid. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ ret_code_t pm_peer_new(pm_peer_id_t * p_new_peer_id, pm_peer_data_bonding_t * p_bonding_data, @@ -653,7 +780,7 @@ ret_code_t pm_peer_delete(pm_peer_id_t peer_id); * * @retval NRF_SUCCESS If the deletion process was initiated successfully. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. - * @retval NRF_ERROR_INTERNAL If another error occurred. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ ret_code_t pm_peers_delete(void); /** @}*/ @@ -684,7 +811,7 @@ ret_code_t pm_peers_delete(void); * @retval NRF_SUCCESS If the operation completed successfully. * @retval NRF_ERROR_NOT_FOUND If no peers were found. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. - * @retval NRF_ERROR_INTERNAL If another error occurred. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ ret_code_t pm_peer_ranks_get(pm_peer_id_t * p_highest_ranked_peer, uint32_t * p_highest_rank, @@ -712,8 +839,8 @@ ret_code_t pm_peer_ranks_get(pm_peer_id_t * p_highest_ranked_peer, * @retval NRF_ERROR_BUSY If the underlying flash handler is busy with other flash * operations, or if a previous call to this function has not * completed. Try again after receiving a Peer Manager event. - * @retval NRF_ERROR_INTERNAL If another error occurred. * @retval NRF_ERROR_INVALID_STATE If the Peer Manager is not initialized. + * @retval NRF_ERROR_INTERNAL If an internal error occurred. */ ret_code_t pm_peer_rank_highest(pm_peer_id_t peer_id); @@ -723,4 +850,9 @@ ret_code_t pm_peer_rank_highest(pm_peer_id_t peer_id); /** @} */ + +#ifdef __cplusplus +} +#endif + #endif // PEER_MANAGER_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h index df365e2e94..5834b3a76d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h @@ -37,16 +37,19 @@ */ - #ifndef PEER_MANAGER_INTERNAL_H__ #define PEER_MANAGER_INTERNAL_H__ #include #include "sdk_errors.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "peer_manager_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN @@ -171,4 +174,25 @@ typedef pm_peer_data_const_t pm_peer_data_flash_t; * @endcond */ + +#ifdef NRF_PM_DEBUG + + #define NRF_PM_DEBUG_CHECK(condition) \ + if (!(condition)) \ + { \ + __asm("bkpt #0"); \ + } + +#else + + // Prevent "variable set but never used" compiler warnings. + #define NRF_PM_DEBUG_CHECK(condition) (void)(condition) + +#endif + + +#ifdef __cplusplus +} +#endif + #endif /* PEER_MANAGER_INTERNAL_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_types.h index 37a43b316b..7e085b26c2 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_types.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_types.h @@ -37,7 +37,6 @@ */ - /** * @file peer_manager_types.h * @@ -52,11 +51,16 @@ #include #include #include "nrf.h" -#include "nrf_ble_gap.h" -#include "nrf_ble_hci.h" +#include "ble_gap.h" +#include "ble_hci.h" +#include "ble_gatt_db.h" #include "app_util.h" #include "app_util_platform.h" -#include "ble_gatt_db.h" + + +#ifdef __cplusplus +extern "C" { +#endif /**@brief Handle to uniquely identify a peer for which we have persistently stored data. @@ -161,42 +165,69 @@ typedef struct */ typedef struct { - uint8_t own_role; /**< @brief The role of the local device during bonding. */ - ble_gap_id_key_t peer_id; /**< @brief The peer's peer address and identity resolution key. */ - ble_gap_enc_key_t peer_ltk; /**< @brief The peer's long-term encryption key. */ - ble_gap_enc_key_t own_ltk; /**< @brief Locally generated long-term encryption key, distributed to the peer. */ + uint8_t own_role; /**< @brief The BLE role of the local device during bonding. See @ref BLE_GAP_ROLES. */ + ble_gap_id_key_t peer_ble_id; /**< @brief The peer's Bluetooth address and identity resolution key (IRK). */ + ble_gap_enc_key_t peer_ltk; /**< @brief The peer's long-term encryption key (LTK) and master ID. */ + ble_gap_enc_key_t own_ltk; /**< @brief Locally generated long-term encryption key (LTK) and master ID, distributed to the peer. */ } pm_peer_data_bonding_t; - /**@brief Data on a local GATT database. */ typedef struct { uint32_t flags; /**< @brief Flags that describe the database attributes. */ uint16_t len; /**< @brief Size of the attribute array. */ - -#ifdef __ICCARM__ //IAR dosen't support "flexible array member" in c++ compilation - uint8_t data[1]; /**< @brief Array to hold the database attributes. */ -#else - uint8_t data[]; /**< @brief Array to hold the database attributes. */ -#endif + uint8_t data[1]; /**< @brief Array to hold the database attributes. */ } pm_peer_data_local_gatt_db_t; -/**@brief Macro to check whether a data type is valid, thus one of the valid enum values. +/**@brief Device Privacy. * - * @param[in] data_id The data type to check. + * The privacy feature provides a way for the device to avoid being tracked over a period of + * time. The privacy feature, when enabled, hides the local device identity and replaces it + * with a private address that is automatically refreshed at a specified interval. + * + * If a device still wants to be recognized by other peers, it needs to share it's Identity + * Resolving Key (IRK). With this key, a device can generate a random private address that + * can only be recognized by peers in possession of that key, and devices can establish + * connections without revealing their real identities. + * + * @note If the device IRK is updated, the new IRK becomes the one to be distributed in all + * bonding procedures performed after @ref sd_ble_gap_privacy_set returns. + * The IRK distributed during bonding procedure is the device IRK that is active when @ref + * sd_ble_gap_sec_params_reply is called. */ -#define PM_PEER_DATA_ID_IS_VALID(data_id) \ - ( ((data_id) == PM_PEER_DATA_ID_BONDING) \ - || ((data_id) == PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING)\ - || ((data_id) == PM_PEER_DATA_ID_GATT_LOCAL) \ - || ((data_id) == PM_PEER_DATA_ID_GATT_REMOTE) \ - || ((data_id) == PM_PEER_DATA_ID_PEER_RANK) \ - || ((data_id) == PM_PEER_DATA_ID_APPLICATION)) +#if (NRF_SD_BLE_API_VERSION < 3) + +typedef struct +{ + uint8_t privacy_mode; /**< Privacy mode, see @ref BLE_GAP_PRIVACY_MODES. Default is @ref BLE_GAP_PRIVACY_MODE_OFF. */ + uint8_t private_addr_type; /**< The private address type must be either @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. */ + uint16_t private_addr_cycle_s; /**< Private address cycle interval in seconds. Providing an address cycle value of 0 will use the default value defined by @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S. */ + ble_gap_irk_t * p_device_irk; /**< When used as input, pointer to IRK structure that will be used as the default IRK. If NULL, the device default IRK will be used. + When used as output, pointer to IRK structure where the current default IRK will be written to. If NULL, this argument is ignored. + By default, the default IRK is used to generate random private resolvable addresses for the local device unless instructed otherwise. */ +} pm_privacy_params_t; - /** @} */ +/**@defgroup BLE_GAP_PRIVACY_MODES Privacy modes + * @{ */ +#define BLE_GAP_PRIVACY_MODE_OFF 0x00 /**< Device will send and accept its identity address for its own address. */ +#define BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY 0x01 /**< Device will send and accept only private addresses for its own address. */ +/**@} */ + +#else + +typedef ble_gap_privacy_params_t pm_privacy_params_t; + +#endif + + +#ifdef __cplusplus +} +#endif #endif /* PEER_MANAGER_TYPES_H__ */ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.c index f185b5358e..96244bbea5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.c @@ -36,8 +36,8 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "pm_buffer.h" #include @@ -63,7 +63,7 @@ ret_code_t pm_buffer_init(pm_buffer_t * p_buffer, if ( (p_buffer != NULL) && (p_buffer_memory != NULL) && (p_mutex_memory != NULL) - && (buffer_memory_size >= (n_blocks*block_size)) + && (buffer_memory_size >= (n_blocks * block_size)) && (mutex_memory_size >= MUTEX_STORAGE_SIZE(n_blocks)) && (n_blocks != 0) && (block_size != 0)) @@ -87,35 +87,35 @@ uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks) { if (!BUFFER_IS_VALID(p_buffer)) { - return ( BUFFER_INVALID_ID ); + return ( PM_BUFFER_INVALID_ID ); } - uint8_t first_locked_mutex = BUFFER_INVALID_ID; + uint8_t first_locked_mutex = PM_BUFFER_INVALID_ID; for (uint8_t i = 0; i < p_buffer->n_blocks; i++) { if (pm_mutex_lock(p_buffer->p_mutex, i)) { - if (first_locked_mutex == BUFFER_INVALID_ID) + if (first_locked_mutex == PM_BUFFER_INVALID_ID) { first_locked_mutex = i; } - if ((i - first_locked_mutex + 1) >= 0 && ((uint32_t) (i - first_locked_mutex + 1)) == n_blocks) + if ((i - first_locked_mutex + 1) == n_blocks) { return first_locked_mutex; } } - else if (first_locked_mutex != BUFFER_INVALID_ID) + else if (first_locked_mutex != PM_BUFFER_INVALID_ID) { for (uint8_t j = first_locked_mutex; j < i; j++) { pm_buffer_release(p_buffer, j); } - first_locked_mutex = BUFFER_INVALID_ID; + first_locked_mutex = PM_BUFFER_INVALID_ID; } } - return ( BUFFER_INVALID_ID ); + return ( PM_BUFFER_INVALID_ID ); } @@ -126,10 +126,10 @@ uint8_t * pm_buffer_ptr_get(pm_buffer_t * p_buffer, uint8_t id) return ( NULL ); } - if ( (id != BUFFER_INVALID_ID) + if ( (id != PM_BUFFER_INVALID_ID) && pm_mutex_lock_status_get(p_buffer->p_mutex, id) ) { - return ( &p_buffer->p_memory[id*p_buffer->block_size] ); + return ( &p_buffer->p_memory[id * p_buffer->block_size] ); } else { @@ -141,9 +141,10 @@ uint8_t * pm_buffer_ptr_get(pm_buffer_t * p_buffer, uint8_t id) void pm_buffer_release(pm_buffer_t * p_buffer, uint8_t id) { if ( BUFFER_IS_VALID(p_buffer) - && (id != BUFFER_INVALID_ID) + && (id != PM_BUFFER_INVALID_ID) && pm_mutex_lock_status_get(p_buffer->p_mutex, id)) { pm_mutex_unlock(p_buffer->p_mutex, id); } } +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.h index 55fea30d10..369b3236da 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_buffer.h @@ -37,14 +37,18 @@ */ - #ifndef BUFFER_H__ #define BUFFER_H__ #include +#include "compiler_abstraction.h" #include "sdk_errors.h" #include "pm_mutex.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN @@ -55,24 +59,29 @@ */ -#define BUFFER_INVALID_ID 0xFF +#define PM_BUFFER_INVALID_ID 0xFF //!< Invalid buffer block ID. -#define PM_BUFFER_INIT(p_buffer, n_blocks, block_size, err_code) \ -do \ -{ \ - static union { \ - uint8_t u8[(n_blocks) * (block_size)]; \ - uint32_t u32[1]; /*force allign to uint32_t*/ \ - } buffer_memory; \ - static uint8_t mutex_memory[MUTEX_STORAGE_SIZE(n_blocks)]; \ - err_code = pm_buffer_init((p_buffer), \ - buffer_memory.u8, \ - (n_blocks) * (block_size), \ - mutex_memory, \ - MUTEX_STORAGE_SIZE(n_blocks), \ - (n_blocks), \ - (block_size)); \ -} while(0) + +/**@brief Convenience macro for declaring memory and initializing a buffer instance. + * + * @param[out] p_buffer The buffer instance to initialize. + * @param[in] n_blocks The desired number of blocks in the buffer. + * @param[in] block_size The desired block size of the buffer. + * @param[out] err_code The return code from @ref pm_buffer_init. + */ +#define PM_BUFFER_INIT(p_buffer, n_blocks, block_size, err_code) \ +do \ +{ \ + __ALIGN(4) static uint8_t buffer_memory[(n_blocks) * (block_size)]; \ + __ALIGN(4) static uint8_t mutex_memory[MUTEX_STORAGE_SIZE(n_blocks)]; \ + err_code = pm_buffer_init((p_buffer), \ + buffer_memory, \ + (n_blocks) * (block_size), \ + mutex_memory, \ + MUTEX_STORAGE_SIZE(n_blocks), \ + (n_blocks), \ + (block_size)); \ +} while (0) typedef struct @@ -113,7 +122,7 @@ ret_code_t pm_buffer_init(pm_buffer_t * p_buffer, * @param[in] n_blocks The number of contiguous blocks to acquire. * * @return The id of the acquired block, if successful. - * @retval BUFFER_INVALID_ID If unsuccessful. + * @retval PM_BUFFER_INVALID_ID If unsuccessful. */ uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks); @@ -137,6 +146,11 @@ uint8_t * pm_buffer_ptr_get(pm_buffer_t * p_buffer, uint8_t id); void pm_buffer_release(pm_buffer_t * p_buffer, uint8_t id); + +#ifdef __cplusplus +} +#endif + #endif // BUFFER_H__ /** diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.c index 1758108d34..e9b42578cb 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.c @@ -36,8 +36,8 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "pm_mutex.h" #include @@ -140,3 +140,4 @@ bool pm_mutex_lock_status_get(uint8_t * p_mutex, uint16_t mutex_id) return true; } } +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.h index abc2446921..efc54e100f 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/pm_mutex.h @@ -37,7 +37,6 @@ */ - #ifndef MUTEX_H__ #define MUTEX_H__ @@ -45,6 +44,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN * @defgroup pm_mutex Mutex @@ -110,8 +113,13 @@ void pm_mutex_unlock(uint8_t * p_mutex, uint16_t mutex_bit_id); bool pm_mutex_lock_status_get(uint8_t * p_mutex, uint16_t mutex_bit_id); + +#ifdef __cplusplus +} +#endif + #endif // MUTEX_H__ -/** @} - * @endcond +/** @} + * @endcond */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c index f35d701e79..ff292ebf92 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c @@ -36,51 +36,49 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "security_dispatcher.h" #include -#include "nrf_ble.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "ble_conn_state.h" #include "peer_manager_types.h" #include "peer_database.h" #include "id_manager.h" -#include "sdk_common.h" -#define MAX_REGISTRANTS 3 /**< The number of user that can register with the module. */ +// The number of registered event handlers. +#define SMD_EVENT_HANDLERS_CNT (sizeof(m_evt_handlers) / sizeof(m_evt_handlers[0])) -typedef struct +// Security Dispacher event handlers in Security Manager and GATT Cache Manager. +extern void sm_smd_evt_handler(smd_evt_t const * p_event); +extern void gcm_smd_evt_handler(smd_evt_t const * p_event); + +// Security Dispatcher events' handlers. +// The number of elements in this array is SMD_EVENT_HANDLERS_CNT. +static smd_evt_handler_t const m_evt_handlers[] = { - smd_evt_handler_t evt_handlers[MAX_REGISTRANTS]; - uint8_t n_registrants; - ble_conn_state_user_flag_id_t flag_id_sec_proc; - ble_conn_state_user_flag_id_t flag_id_sec_proc_pairing; - ble_conn_state_user_flag_id_t flag_id_sec_proc_new_peer; - ble_gap_lesc_p256_pk_t peer_pk; -} smd_t; - - -static smd_t m_smd = -{ - .flag_id_sec_proc = BLE_CONN_STATE_USER_FLAG_INVALID, - .flag_id_sec_proc_pairing = BLE_CONN_STATE_USER_FLAG_INVALID, - .flag_id_sec_proc_new_peer = BLE_CONN_STATE_USER_FLAG_INVALID, + sm_smd_evt_handler, + gcm_smd_evt_handler }; +static bool m_module_initialized; -#define MODULE_INITIALIZED (m_smd.n_registrants > 0) /**< Expression which is true when the module is initialized. */ -#include "sdk_macros.h" +static ble_conn_state_user_flag_id_t m_flag_sec_proc = BLE_CONN_STATE_USER_FLAG_INVALID; +static ble_conn_state_user_flag_id_t m_flag_sec_proc_pairing = BLE_CONN_STATE_USER_FLAG_INVALID; +static ble_conn_state_user_flag_id_t m_flag_sec_proc_new_peer = BLE_CONN_STATE_USER_FLAG_INVALID; + +static ble_gap_lesc_p256_pk_t m_peer_pk; static void evt_send(smd_evt_t * p_event) { - for (int i = 0; i < m_smd.n_registrants; i++) + for (uint32_t i = 0; i < SMD_EVENT_HANDLERS_CNT; i++) { - m_smd.evt_handlers[i](p_event); + m_evt_handlers[i](p_event); } } @@ -89,30 +87,28 @@ static void sec_start_send(uint16_t conn_handle, pm_conn_sec_procedure_t procedu { smd_evt_t evt = { - .evt_id = SMD_EVT_SEC_PROCEDURE_START, + .evt_id = SMD_EVT_SEC_PROCEDURE_START, .conn_handle = conn_handle, - .params = {.sec_procedure_start = {.procedure = procedure}} + .params = {.sec_procedure_start = {.procedure = procedure}} }; evt_send(&evt); } -/**@brief Event handler for events from the peer_database module. +/**@brief Event handler for events from the Peer Database module. + * This handler is extern in Peer Database. * * @param[in] p_event The event that has happened. */ -static void pdb_evt_handler(pdb_evt_t const * p_event) +void smd_pdb_evt_handler(pdb_evt_t const * p_event) { if ((p_event->evt_id == PDB_EVT_WRITE_BUF_STORED) && (p_event->data_id == PM_PEER_DATA_ID_BONDING)) { smd_evt_t evt = { - .evt_id = SMD_EVT_BONDING_INFO_STORED, + .evt_id = SMD_EVT_BONDING_INFO_STORED, .conn_handle = im_conn_handle_get(p_event->peer_id), - .params = {.bonding_info_stored = - { - .peer_id = p_event->peer_id, - }} + .params = {.bonding_info_stored = {.peer_id = p_event->peer_id}} }; evt_send(&evt); } @@ -127,7 +123,7 @@ static void sec_params_request_process(ble_gap_evt_t * p_gap_evt) { smd_evt_t evt = { - .evt_id = SMD_EVT_PARAMS_REQ, + .evt_id = SMD_EVT_PARAMS_REQ, .conn_handle = p_gap_evt->conn_handle }; evt_send(&evt); @@ -149,21 +145,21 @@ static void sec_proc_start(uint16_t conn_handle, bool pairing, bool new_peer_created) { - ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc, success); + ble_conn_state_user_flag_set(conn_handle, m_flag_sec_proc, success); if (success) { - ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc_pairing, pairing); - ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc_new_peer, new_peer_created); + ble_conn_state_user_flag_set(conn_handle, m_flag_sec_proc_pairing, pairing); + ble_conn_state_user_flag_set(conn_handle, m_flag_sec_proc_new_peer, new_peer_created); - if(new_peer_created) + if (new_peer_created) { im_new_peer_id(conn_handle, peer_id); } } else { - if(new_peer_created) + if (new_peer_created) { ret_code_t err_code = im_peer_free(peer_id); // Attempt to free allocated peer. UNUSED_VARIABLE(err_code); @@ -194,7 +190,7 @@ static void sec_info_request_process(ble_gap_evt_t * p_gap_evt) if (peer_id != PM_PEER_ID_INVALID) { - err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, &peer_data, NULL); + err_code = pdb_peer_data_ptr_get(peer_id, PM_PEER_DATA_ID_BONDING, &peer_data); if (err_code == NRF_SUCCESS) { @@ -279,7 +275,7 @@ static void auth_status_success_process(ble_gap_evt_t * p_gap_evt) ble_gap_sec_kdist_t kdist_own = p_gap_evt->params.auth_status.kdist_own; ble_gap_sec_kdist_t kdist_peer = p_gap_evt->params.auth_status.kdist_peer; - ble_conn_state_user_flag_set(p_gap_evt->conn_handle, m_smd.flag_id_sec_proc, false); + ble_conn_state_user_flag_set(p_gap_evt->conn_handle, m_flag_sec_proc, false); if (role == BLE_GAP_ROLE_INVALID) { @@ -305,7 +301,7 @@ static void auth_status_success_process(ble_gap_evt_t * p_gap_evt) } } - else if (ble_conn_state_user_flag_get(p_gap_evt->conn_handle, m_smd.flag_id_sec_proc_new_peer)) + else if (ble_conn_state_user_flag_get(p_gap_evt->conn_handle, m_flag_sec_proc_new_peer)) { ret_code_t err_code_free = im_peer_free(peer_id); UNUSED_VARIABLE(err_code_free); // Errors can be safely ignored. @@ -341,7 +337,7 @@ static void pairing_failure(uint16_t conn_handle, smd_evt_t evt = { - .evt_id = SMD_EVT_PAIRING_FAIL, + .evt_id = SMD_EVT_PAIRING_FAIL, .conn_handle = conn_handle, .params = { @@ -353,7 +349,7 @@ static void pairing_failure(uint16_t conn_handle, } }; - if(ble_conn_state_user_flag_get(conn_handle, m_smd.flag_id_sec_proc_new_peer)) + if (ble_conn_state_user_flag_get(conn_handle, m_flag_sec_proc_new_peer)) { // The peer_id was created during the procedure, and should be freed, because no data is // stored under it. @@ -373,7 +369,7 @@ static void pairing_failure(uint16_t conn_handle, } } - ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc, false); + ble_conn_state_user_flag_set(conn_handle, m_flag_sec_proc, false); evt_send(&evt); return; @@ -404,7 +400,7 @@ static void encryption_failure(uint16_t conn_handle, } }; - ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc, false); + ble_conn_state_user_flag_set(conn_handle, m_flag_sec_proc, false); evt_send(&evt); return; @@ -422,13 +418,13 @@ static void link_secure_failure(uint16_t conn_handle, pm_sec_error_code_t error, uint8_t error_src) { - if (ble_conn_state_user_flag_get(conn_handle, m_smd.flag_id_sec_proc)) + if (ble_conn_state_user_flag_get(conn_handle, m_flag_sec_proc)) { pm_peer_id_t peer_id = im_peer_id_get_by_conn_handle(conn_handle); if (peer_id != PM_PEER_ID_INVALID) { - if (ble_conn_state_user_flag_get(conn_handle, m_smd.flag_id_sec_proc_pairing)) + if (ble_conn_state_user_flag_get(conn_handle, m_flag_sec_proc_pairing)) { pairing_failure(conn_handle, peer_id, error, error_src); } @@ -495,9 +491,9 @@ static void conn_sec_update_process(ble_gap_evt_t * p_gap_evt) { if (ble_conn_state_encrypted(p_gap_evt->conn_handle)) { - if (!ble_conn_state_user_flag_get(p_gap_evt->conn_handle, m_smd.flag_id_sec_proc_pairing)) + if (!ble_conn_state_user_flag_get(p_gap_evt->conn_handle, m_flag_sec_proc_pairing)) { - ble_conn_state_user_flag_set(p_gap_evt->conn_handle, m_smd.flag_id_sec_proc, false); + ble_conn_state_user_flag_set(p_gap_evt->conn_handle, m_flag_sec_proc, false); } smd_evt_t evt; @@ -530,43 +526,24 @@ static void flag_id_init(ble_conn_state_user_flag_id_t * p_flag_id) } -ret_code_t smd_register(smd_evt_handler_t evt_handler) +ret_code_t smd_init(void) { - ret_code_t err_code = NRF_SUCCESS; - if (evt_handler == NULL) - { - err_code = NRF_ERROR_NULL; - } - else - { - if (!MODULE_INITIALIZED) - { - flag_id_init(&m_smd.flag_id_sec_proc); - flag_id_init(&m_smd.flag_id_sec_proc_pairing); - flag_id_init(&m_smd.flag_id_sec_proc_new_peer); + NRF_PM_DEBUG_CHECK(!m_module_initialized); - if (m_smd.flag_id_sec_proc_new_peer == BLE_CONN_STATE_USER_FLAG_INVALID) - { - err_code = NRF_ERROR_INTERNAL; - } - else - { - err_code = pdb_register(pdb_evt_handler); - } - } - if ((err_code == NRF_SUCCESS)) - { - if ((m_smd.n_registrants < MAX_REGISTRANTS)) - { - m_smd.evt_handlers[m_smd.n_registrants++] = evt_handler; - } - else - { - err_code = NRF_ERROR_NO_MEM; - } - } + flag_id_init(&m_flag_sec_proc); + flag_id_init(&m_flag_sec_proc_pairing); + flag_id_init(&m_flag_sec_proc_new_peer); + + if ((m_flag_sec_proc == BLE_CONN_STATE_USER_FLAG_INVALID) || + (m_flag_sec_proc_pairing == BLE_CONN_STATE_USER_FLAG_INVALID) || + (m_flag_sec_proc_new_peer == BLE_CONN_STATE_USER_FLAG_INVALID)) + { + return NRF_ERROR_INTERNAL; } - return err_code; + + m_module_initialized = true; + + return NRF_SUCCESS; } @@ -574,7 +551,7 @@ ret_code_t smd_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params, ble_gap_lesc_p256_pk_t * p_public_key) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); uint8_t role = ble_conn_state_role(conn_handle); pm_peer_id_t peer_id = PM_PEER_ID_INVALID; @@ -629,10 +606,13 @@ ret_code_t smd_params_reply(uint16_t conn_handle, sec_keyset.keys_own.p_enc_key = &peer_data.p_bonding_data->own_ltk; sec_keyset.keys_own.p_pk = p_public_key; sec_keyset.keys_peer.p_enc_key = &peer_data.p_bonding_data->peer_ltk; - sec_keyset.keys_peer.p_id_key = &peer_data.p_bonding_data->peer_id; - sec_keyset.keys_peer.p_pk = &m_smd.peer_pk; + sec_keyset.keys_peer.p_id_key = &peer_data.p_bonding_data->peer_ble_id; + sec_keyset.keys_peer.p_pk = &m_peer_pk; - ret_code_t err_code_addr = im_ble_addr_get(conn_handle, &peer_data.p_bonding_data->peer_id.id_addr_info); // Retrieve the address the peer used during connection establishment. This address will be overwritten if ID is shared. Should not fail. + // Retrieve the address the peer used during connection establishment. + // This address will be overwritten if ID is shared. Should not fail. + ret_code_t err_code_addr = im_ble_addr_get(conn_handle, + &peer_data.p_bonding_data->peer_ble_id.id_addr_info); UNUSED_VARIABLE(err_code_addr); // Buffer is OK, reserve room in flash for the data. @@ -642,7 +622,10 @@ ret_code_t smd_params_reply(uint16_t conn_handle, } else { - // Pairing only, no action needed. + // Pairing, no bonding. + + sec_keyset.keys_own.p_pk = p_public_key; + sec_keyset.keys_peer.p_pk = &m_peer_pk; } if (err_code == NRF_SUCCESS) @@ -689,7 +672,7 @@ static ret_code_t link_secure_central_existing_peer(uint16_t co ble_gap_enc_key_t const * p_existing_key = NULL; bool lesc = false; - err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, &peer_data, NULL); + err_code = pdb_peer_data_ptr_get(peer_id, PM_PEER_DATA_ID_BONDING, &peer_data); if (err_code == NRF_SUCCESS) { @@ -849,7 +832,10 @@ static ret_code_t link_secure_central(uint16_t conn_handle, static ret_code_t link_secure_peripheral(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params) { - VERIFY_PARAM_NOT_NULL(p_sec_params); + // This should never happen for a peripheral. + NRF_PM_DEBUG_CHECK(p_sec_params != NULL); + + // VERIFY_PARAM_NOT_NULL(p_sec_params); ret_code_t err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); @@ -861,7 +847,7 @@ ret_code_t smd_link_secure(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params, bool force_repairing) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); uint8_t role = ble_conn_state_role(conn_handle); @@ -908,3 +894,4 @@ void smd_ble_evt_handler(ble_evt_t * p_ble_evt) break; }; } +#endif //NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h index 037158a9f7..fcc84ea546 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h @@ -37,16 +37,19 @@ */ - #ifndef SECURITY_DISPATCHER_H__ #define SECURITY_DISPATCHER_H__ #include #include "sdk_errors.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "peer_manager_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN @@ -195,6 +198,7 @@ typedef struct typedef void (*smd_evt_handler_t)(smd_evt_t const * p_event); +#if 0 /**@brief Function for registering with the Security Dispatcher module. This function also * initializes the module if uninitialized. * @@ -205,6 +209,10 @@ typedef void (*smd_evt_handler_t)(smd_evt_t const * p_event); * @retval NRF_ERROR_NULL evt_handler was NULL. */ ret_code_t smd_register(smd_evt_handler_t evt_handler); +#endif + + +ret_code_t smd_init(void); /**@brief Function for dispatching SoftDevice events to the Security Dispatcher module. @@ -218,8 +226,8 @@ void smd_ble_evt_handler(ble_evt_t * ble_evt); * procedure on a connection. * * @note If this function returns an @ref NRF_ERROR_NULL, @ref NRF_ERROR_INVALID_PARAM, @ref - * BLE_ERROR_INVALID_CONN_HANDLE, or @ref NRF_ERROR_NO_MEM, this function can be called again - * after corrective action. + * BLE_ERROR_INVALID_CONN_HANDLE, or @ref NRF_ERROR_STORAGE_FULL, this function can be called + * again after corrective action. * * @note To reject a request, call this function with NULL p_sec_params. * @@ -235,7 +243,8 @@ void smd_ble_evt_handler(ble_evt_t * ble_evt); * @retval NRF_ERROR_TIMEOUT There has been an SMP timeout, so no more SMP operations * can be performed on this link. * @retval BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. - * @retval NRF_ERROR_NO_MEM No more room in flash. Fix and reattempt later. + * @retval NRF_ERROR_STORAGE_FULL No more room in flash. Fix and reattempt after the next + * FDS garbage collection procedure. * @retval NRF_ERROR_BUSY No write buffer. Reattempt later. */ ret_code_t smd_params_reply(uint16_t conn_handle, @@ -267,7 +276,8 @@ ret_code_t smd_params_reply(uint16_t conn_handle, * @retval NRF_ERROR_TIMEOUT There has been an SMP timeout, so no more SMP operations * can be performed on this link. * @retval BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. - * @retval NRF_ERROR_NO_MEM No more room in flash. + * @retval NRF_ERROR_STORAGE_FULL No more room in flash. Fix and reattempt after the next + * FDS garbage collection procedure. * @retval NRF_ERROR_INTERNAL No more available peer IDs. */ ret_code_t smd_link_secure(uint16_t conn_handle, @@ -278,4 +288,9 @@ ret_code_t smd_link_secure(uint16_t conn_handle, * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* SECURITY_DISPATCHER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.c index 2bb3dc917d..28a1aaf430 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.c @@ -36,51 +36,51 @@ * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PEER_MANAGER) #include "security_manager.h" + #include #include "security_dispatcher.h" #include "peer_database.h" #include "ble_conn_state.h" -#include "sdk_common.h" #include "id_manager.h" -#define MAX_REGISTRANTS 3 /**< The number of user that can register with the module. */ -typedef struct +// The number of registered event handlers. +#define SM_EVENT_HANDLERS_CNT (sizeof(m_evt_handlers) / sizeof(m_evt_handlers[0])) + + +// Security Manager event handler in Peer Manager. +extern void pm_sm_evt_handler(sm_evt_t const * p_sm_evt); + +// Security Manager events' handlers. +// The number of elements in this array is SM_EVENT_HANDLERS_CNT. +static sm_evt_handler_t const m_evt_handlers[] = { - sm_evt_handler_t evt_handlers[MAX_REGISTRANTS]; - uint8_t n_registrants; - ble_conn_state_user_flag_id_t flag_id_link_secure_pending_busy; - ble_conn_state_user_flag_id_t flag_id_link_secure_pending_flash_full; - ble_conn_state_user_flag_id_t flag_id_link_secure_force_repairing; - ble_conn_state_user_flag_id_t flag_id_link_secure_null_params; - ble_conn_state_user_flag_id_t flag_id_params_reply_pending_busy; - ble_conn_state_user_flag_id_t flag_id_params_reply_pending_flash_full; - ble_conn_state_user_flag_id_t flag_id_reject_pairing; - bool pdb_evt_handler_registered; - bool sec_params_valid; - ble_gap_sec_params_t sec_params; - ble_gap_lesc_p256_pk_t * p_public_key; -} sm_t; + pm_sm_evt_handler +}; -static sm_t m_sm = {.flag_id_link_secure_pending_busy = BLE_CONN_STATE_USER_FLAG_INVALID, - .flag_id_link_secure_pending_flash_full = BLE_CONN_STATE_USER_FLAG_INVALID, - .flag_id_link_secure_force_repairing = BLE_CONN_STATE_USER_FLAG_INVALID, - .flag_id_link_secure_null_params = BLE_CONN_STATE_USER_FLAG_INVALID, - .flag_id_params_reply_pending_busy = BLE_CONN_STATE_USER_FLAG_INVALID, - .flag_id_params_reply_pending_flash_full = BLE_CONN_STATE_USER_FLAG_INVALID, - .flag_id_reject_pairing = BLE_CONN_STATE_USER_FLAG_INVALID}; +static bool m_module_initialized; + +static ble_gap_sec_params_t m_sec_params; +static bool m_sec_params_valid; + +static ble_gap_lesc_p256_pk_t * m_p_public_key; +static ble_conn_state_user_flag_id_t m_flag_link_secure_pending_busy = BLE_CONN_STATE_USER_FLAG_INVALID; +static ble_conn_state_user_flag_id_t m_flag_link_secure_pending_flash_full = BLE_CONN_STATE_USER_FLAG_INVALID; +static ble_conn_state_user_flag_id_t m_flag_link_secure_force_repairing = BLE_CONN_STATE_USER_FLAG_INVALID; +static ble_conn_state_user_flag_id_t m_flag_link_secure_null_params = BLE_CONN_STATE_USER_FLAG_INVALID; +static ble_conn_state_user_flag_id_t m_flag_params_reply_pending_busy = BLE_CONN_STATE_USER_FLAG_INVALID; +static ble_conn_state_user_flag_id_t m_flag_params_reply_pending_flash_full = BLE_CONN_STATE_USER_FLAG_INVALID; +static ble_conn_state_user_flag_id_t m_flag_reject_pairing = BLE_CONN_STATE_USER_FLAG_INVALID; -#define MODULE_INITIALIZED (m_sm.n_registrants > 0) /**< Expression which is true when the module is initialized. */ -#include "sdk_macros.h" static void evt_send(sm_evt_t * p_event) { - for (uint32_t i = 0; i < m_sm.n_registrants; i++) + for (uint32_t i = 0; i < SM_EVENT_HANDLERS_CNT; i++) { - m_sm.evt_handlers[i](p_event); + m_evt_handlers[i](p_event); } } @@ -90,11 +90,11 @@ static void flags_set_from_err_code(uint16_t conn_handle, ret_code_t err_code, b bool flag_value_flash_full = false; bool flag_value_busy = false; - if ( (err_code == NRF_ERROR_NO_MEM) + if ( (err_code == NRF_ERROR_STORAGE_FULL) || (err_code == NRF_ERROR_BUSY) || (err_code == NRF_SUCCESS)) { - if ((err_code == NRF_ERROR_NO_MEM)) + if ((err_code == NRF_ERROR_STORAGE_FULL)) { flag_value_busy = false; flag_value_flash_full = true; @@ -113,25 +113,25 @@ static void flags_set_from_err_code(uint16_t conn_handle, ret_code_t err_code, b if (params_reply) { ble_conn_state_user_flag_set(conn_handle, - m_sm.flag_id_params_reply_pending_flash_full, + m_flag_params_reply_pending_flash_full, flag_value_flash_full); ble_conn_state_user_flag_set(conn_handle, - m_sm.flag_id_params_reply_pending_busy, + m_flag_params_reply_pending_busy, flag_value_busy); ble_conn_state_user_flag_set(conn_handle, - m_sm.flag_id_link_secure_pending_flash_full, + m_flag_link_secure_pending_flash_full, false); ble_conn_state_user_flag_set(conn_handle, - m_sm.flag_id_link_secure_pending_busy, + m_flag_link_secure_pending_busy, false); } else { ble_conn_state_user_flag_set(conn_handle, - m_sm.flag_id_link_secure_pending_flash_full, + m_flag_link_secure_pending_flash_full, flag_value_flash_full); ble_conn_state_user_flag_set(conn_handle, - m_sm.flag_id_link_secure_pending_busy, + m_flag_link_secure_pending_busy, flag_value_busy); } } @@ -153,7 +153,7 @@ static void events_send_from_err_code(uint16_t conn_handle, ret_code_t err_code) { evt.evt_id = SM_EVT_ERROR_SMP_TIMEOUT; } - else if (err_code == NRF_ERROR_NO_MEM) + else if (err_code == NRF_ERROR_STORAGE_FULL) { evt.evt_id = SM_EVT_ERROR_NO_MEM; } @@ -170,18 +170,18 @@ static ret_code_t link_secure(uint16_t conn_handle, bool null_params, bool force { ret_code_t err_code; - if (!null_params && !m_sm.sec_params_valid) + if (!null_params && !m_sec_params_valid) { return NRF_ERROR_NOT_FOUND; } - if(null_params) + if (null_params) { err_code = smd_link_secure(conn_handle, NULL, force_repairing); } else { - err_code = smd_link_secure(conn_handle, &m_sm.sec_params, force_repairing); + err_code = smd_link_secure(conn_handle, &m_sec_params, force_repairing); } flags_set_from_err_code(conn_handle, err_code, false); @@ -194,13 +194,13 @@ static ret_code_t link_secure(uint16_t conn_handle, bool null_params, bool force switch (err_code) { case NRF_ERROR_BUSY: - ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_link_secure_null_params, null_params); - ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_link_secure_force_repairing, force_repairing); + ble_conn_state_user_flag_set(conn_handle, m_flag_link_secure_null_params, null_params); + ble_conn_state_user_flag_set(conn_handle, m_flag_link_secure_force_repairing, force_repairing); err_code = NRF_SUCCESS; break; - case NRF_ERROR_NO_MEM: - ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_link_secure_null_params, null_params); - ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_link_secure_force_repairing, force_repairing); + case NRF_ERROR_STORAGE_FULL: + ble_conn_state_user_flag_set(conn_handle, m_flag_link_secure_null_params, null_params); + ble_conn_state_user_flag_set(conn_handle, m_flag_link_secure_force_repairing, force_repairing); break; case NRF_SUCCESS: case NRF_ERROR_TIMEOUT: @@ -237,18 +237,18 @@ static void smd_params_reply_perform(uint16_t conn_handle) && im_peer_id_get_by_conn_handle(conn_handle) != PM_PEER_ID_INVALID) { // Bond already exists. Reject the pairing request if the user doesn't intervene. - ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_reject_pairing, true); + ble_conn_state_user_flag_set(conn_handle, m_flag_reject_pairing, true); send_config_req(conn_handle); } else { - ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_reject_pairing, false); + ble_conn_state_user_flag_set(conn_handle, m_flag_reject_pairing, false); } - if ( m_sm.sec_params_valid - && !ble_conn_state_user_flag_get(conn_handle, m_sm.flag_id_reject_pairing)) + if ( m_sec_params_valid + && !ble_conn_state_user_flag_get(conn_handle, m_flag_reject_pairing)) { - err_code = smd_params_reply(conn_handle, &m_sm.sec_params, m_sm.p_public_key); + err_code = smd_params_reply(conn_handle, &m_sec_params, m_p_public_key); } else { @@ -260,9 +260,14 @@ static void smd_params_reply_perform(uint16_t conn_handle) } -static void smd_evt_handler(smd_evt_t const * p_event) +/**@brief Event handler for events from the Security Dispatcher module. + * This handler is extern in Security Dispatcher. + * + * @param[in] p_event The event that has happened. + */ +void sm_smd_evt_handler(smd_evt_t const * p_event) { - switch(p_event->evt_id) + switch (p_event->evt_id) { case SMD_EVT_PARAMS_REQ: smd_params_reply_perform(p_event->conn_handle); @@ -270,15 +275,15 @@ static void smd_evt_handler(smd_evt_t const * p_event) case SMD_EVT_SLAVE_SECURITY_REQ: { bool null_params = false; - if (!m_sm.sec_params_valid) + if (!m_sec_params_valid) { null_params = true; } - else if ((bool)m_sm.sec_params.bond < (bool)p_event->params.slave_security_req.bond) + else if ((bool)m_sec_params.bond < (bool)p_event->params.slave_security_req.bond) { null_params = true; } - else if ((bool)m_sm.sec_params.mitm < (bool)p_event->params.slave_security_req.mitm) + else if ((bool)m_sec_params.mitm < (bool)p_event->params.slave_security_req.mitm) { null_params = true; } @@ -320,8 +325,8 @@ static void link_secure_pending_process(ble_conn_state_user_flag_id_t flag_id) bool pending = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], flag_id); if (pending) { - bool force_repairing = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_sm.flag_id_link_secure_force_repairing); - bool null_params = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_sm.flag_id_link_secure_null_params); + bool force_repairing = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_flag_link_secure_force_repairing); + bool null_params = ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_flag_link_secure_null_params); ret_code_t err_code = link_secure(conn_handle_list.flag_keys[i], null_params, force_repairing, true); // If this fails, it will be automatically retried. UNUSED_VARIABLE(err_code); @@ -350,14 +355,18 @@ static void params_reply_pending_process(ble_conn_state_user_flag_id_t flag_id) } - -static void pdb_evt_handler(pdb_evt_t const * p_event) +/**@brief Event handler for events from the Peer Database module. + * This handler is extern in Peer Database. + * + * @param[in] p_event The event that has happened. + */ +void sm_pdb_evt_handler(pdb_evt_t const * p_event) { switch (p_event->evt_id) { case PDB_EVT_COMPRESSED: - params_reply_pending_process(m_sm.flag_id_params_reply_pending_flash_full); - link_secure_pending_process(m_sm.flag_id_link_secure_pending_flash_full); + params_reply_pending_process(m_flag_params_reply_pending_flash_full); + link_secure_pending_process(m_flag_link_secure_pending_flash_full); /* fallthrough */ case PDB_EVT_WRITE_BUF_STORED: case PDB_EVT_RAW_STORED: @@ -366,8 +375,8 @@ static void pdb_evt_handler(pdb_evt_t const * p_event) case PDB_EVT_CLEAR_FAILED: case PDB_EVT_PEER_FREED: case PDB_EVT_PEER_FREE_FAILED: - params_reply_pending_process(m_sm.flag_id_params_reply_pending_busy); - link_secure_pending_process(m_sm.flag_id_link_secure_pending_busy); + params_reply_pending_process(m_flag_params_reply_pending_busy); + link_secure_pending_process(m_flag_link_secure_pending_busy); break; case PDB_EVT_ERROR_NO_MEM: case PDB_EVT_ERROR_UNEXPECTED: @@ -389,63 +398,35 @@ static void flag_id_init(ble_conn_state_user_flag_id_t * p_flag_id) } -ret_code_t sm_register(sm_evt_handler_t evt_handler) +ret_code_t sm_init(void) { - VERIFY_PARAM_NOT_NULL(evt_handler); + NRF_PM_DEBUG_CHECK(!m_module_initialized); - ret_code_t err_code = NRF_SUCCESS; + flag_id_init(&m_flag_link_secure_pending_busy); + flag_id_init(&m_flag_link_secure_pending_flash_full); + flag_id_init(&m_flag_link_secure_force_repairing); + flag_id_init(&m_flag_link_secure_null_params); + flag_id_init(&m_flag_params_reply_pending_busy); + flag_id_init(&m_flag_params_reply_pending_flash_full); + flag_id_init(&m_flag_reject_pairing); - if (!MODULE_INITIALIZED) + if (m_flag_reject_pairing == BLE_CONN_STATE_USER_FLAG_INVALID) { - flag_id_init(&m_sm.flag_id_link_secure_pending_busy); - flag_id_init(&m_sm.flag_id_link_secure_pending_flash_full); - flag_id_init(&m_sm.flag_id_link_secure_force_repairing); - flag_id_init(&m_sm.flag_id_link_secure_null_params); - flag_id_init(&m_sm.flag_id_params_reply_pending_busy); - flag_id_init(&m_sm.flag_id_params_reply_pending_flash_full); - flag_id_init(&m_sm.flag_id_reject_pairing); + return NRF_ERROR_INTERNAL; + } - if (m_sm.flag_id_reject_pairing == BLE_CONN_STATE_USER_FLAG_INVALID) - { - return NRF_ERROR_INTERNAL; - } - if (!m_sm.pdb_evt_handler_registered) - { - err_code = pdb_register(pdb_evt_handler); - if (err_code != NRF_SUCCESS) - { - return NRF_ERROR_INTERNAL; - } - m_sm.pdb_evt_handler_registered = true; - } - err_code = smd_register(smd_evt_handler); - if (err_code != NRF_SUCCESS) - { - return NRF_ERROR_INTERNAL; - } - } - if (err_code == NRF_SUCCESS) - { - if ((m_sm.n_registrants < MAX_REGISTRANTS)) - { - m_sm.evt_handlers[m_sm.n_registrants++] = evt_handler; - } - else - { - err_code = NRF_ERROR_NO_MEM; - } - } - return err_code; + m_module_initialized = true; + + return NRF_SUCCESS; } void sm_ble_evt_handler(ble_evt_t * p_ble_evt) { - VERIFY_MODULE_INITIALIZED_VOID(); + NRF_PM_DEBUG_CHECK(p_ble_evt != NULL); smd_ble_evt_handler(p_ble_evt); - - link_secure_pending_process(m_sm.flag_id_link_secure_pending_busy); + link_secure_pending_process(m_flag_link_secure_pending_busy); } @@ -530,17 +511,17 @@ static bool sec_params_verify(ble_gap_sec_params_t * p_sec_params) ret_code_t sm_sec_params_set(ble_gap_sec_params_t * p_sec_params) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); if (p_sec_params == NULL) { - m_sm.sec_params_valid = false; + m_sec_params_valid = false; return NRF_SUCCESS; } else if (sec_params_verify(p_sec_params)) { - m_sm.sec_params = *p_sec_params; - m_sm.sec_params_valid = true; + m_sec_params = *p_sec_params; + m_sec_params_valid = true; return NRF_SUCCESS; } else @@ -552,29 +533,37 @@ ret_code_t sm_sec_params_set(ble_gap_sec_params_t * p_sec_params) void sm_conn_sec_config_reply(uint16_t conn_handle, pm_conn_sec_config_t * p_conn_sec_config) { - ble_conn_state_user_flag_set(conn_handle, m_sm.flag_id_reject_pairing, !p_conn_sec_config->allow_repairing); + NRF_PM_DEBUG_CHECK(m_module_initialized); + NRF_PM_DEBUG_CHECK(p_conn_sec_config != NULL); + + ble_conn_state_user_flag_set(conn_handle, m_flag_reject_pairing, !p_conn_sec_config->allow_repairing); } ret_code_t sm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key) { - VERIFY_MODULE_INITIALIZED(); - m_sm.p_public_key = p_public_key; + NRF_PM_DEBUG_CHECK(m_module_initialized); + + m_p_public_key = p_public_key; + return NRF_SUCCESS; } ret_code_t sm_sec_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params) { - VERIFY_MODULE_INITIALIZED(); + NRF_PM_DEBUG_CHECK(m_module_initialized); return NRF_SUCCESS; } ret_code_t sm_link_secure(uint16_t conn_handle, bool force_repairing) { - VERIFY_MODULE_INITIALIZED(); - ret_code_t err_code = link_secure(conn_handle, false, force_repairing, false); - return err_code; -} + ret_code_t ret; + NRF_PM_DEBUG_CHECK(m_module_initialized); + + ret = link_secure(conn_handle, false, force_repairing, false); + return ret; +} +#endif // NRF_MODULE_ENABLED(PEER_MANAGER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h index 39b0d92ce2..8f915cfc4b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h @@ -37,17 +37,20 @@ */ - #ifndef SECURITY_MANAGER_H__ #define SECURITY_MANAGER_H__ #include #include "sdk_errors.h" -#include "nrf_ble.h" -#include "nrf_ble_gap.h" +#include "ble.h" +#include "ble_gap.h" #include "peer_manager_types.h" #include "security_dispatcher.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @cond NO_DOXYGEN @@ -87,7 +90,6 @@ typedef struct } sm_evt_t; - /**@brief Event handler for events from the Security Manager module. * * @param[in] event The event that has happened. @@ -96,17 +98,12 @@ typedef struct typedef void (*sm_evt_handler_t)(sm_evt_t const * p_event); -/**@brief Function for registering with the Security Manager module. This function also - * initializes the module if uninitialized. +/**@brief Function for initializing the Security Manager module. * - * @param[in] evt_handler Callback for events from the Security Manager module. - * - * @retval NRF_SUCCESS Registration was successful. - * @retval NRF_ERROR_NO_MEM No more registrations possible. - * @retval NRF_ERROR_NULL evt_handler was NULL. - * @retval NRF_ERROR_INTERNAL An unexpected error occurred. + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INTERNAL If an unexpected error occurred. */ -ret_code_t sm_register(sm_evt_handler_t evt_handler); +ret_code_t sm_init(void); /**@brief Function for dispatching SoftDevice events to the Security Manager module. @@ -167,8 +164,8 @@ ret_code_t sm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key); * @warning This function is not yet implemented. * * @note If this function returns an @ref NRF_ERROR_NULL, @ref NRF_ERROR_INVALID_PARAM, @ref - * BLE_ERROR_INVALID_CONN_HANDLE, or @ref NRF_ERROR_NO_MEM, this function can be called again - * after corrective action. + * BLE_ERROR_INVALID_CONN_HANDLE, or @ref NRF_ERROR_STORAGE_FULL, this function can be called + * again after corrective action. * * @note To reject a request, call this function with NULL p_sec_params. * @@ -183,7 +180,7 @@ ret_code_t sm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key); * @retval NRF_ERROR_TIMEOUT There has been an SMP timeout, so no more SMP operations * can be performed on this link. * @retval BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. - * @retval NRF_ERROR_NO_MEM No more room in flash. Fix and reattempt later. + * @retval NRF_ERROR_STORAGE_FULL No more room in flash. Fix and reattempt later. * @retval NRF_ERROR_BUSY No write buffer. Reattempt later. */ ret_code_t sm_sec_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params); @@ -216,4 +213,9 @@ ret_code_t sm_link_secure(uint16_t conn_handle, bool force_repairing); * @endcond */ + +#ifdef __cplusplus +} +#endif + #endif /* SECURITY_MANAGER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/compiler_abstraction.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/compiler_abstraction.h index 371d95b65a..72e6ff9064 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/compiler_abstraction.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/compiler_abstraction.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,7 +35,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - + #ifndef _COMPILER_ABSTRACTION_H #define _COMPILER_ABSTRACTION_H @@ -59,6 +59,10 @@ #define __ALIGN(n) __align(n) #endif + #ifndef __PACKED + #define __PACKED __packed + #endif + #define GET_SP() __current_sp() #elif defined ( __ICCARM__ ) @@ -75,11 +79,15 @@ #define __WEAK __weak #endif - /* Not defined for IAR since it requires a new line to work, and C preprocessor does not allow that. */ #ifndef __ALIGN - #define __ALIGN(n) + #define STRING_PRAGMA(x) _Pragma(#x) + #define __ALIGN(n) STRING_PRAGMA(data_alignment = n) #endif + #ifndef __PACKED + #define __PACKED __packed + #endif + #define GET_SP() __get_SP() #elif defined ( __GNUC__ ) @@ -100,6 +108,10 @@ #define __ALIGN(n) __attribute__((aligned(n))) #endif + #ifndef __PACKED + #define __PACKED __attribute__((packed)) + #endif + #define GET_SP() gcc_current_sp() static inline unsigned int gcc_current_sp(void) @@ -125,6 +137,11 @@ #ifndef __ALIGN #define __ALIGN(n) __align(n) #endif + + /* Not defined for TASKING. */ + #ifndef __PACKED + #define __PACKED + #endif #define GET_SP() __get_MSP() diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf.h index 22948d7b1e..510a106de8 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,40 +35,56 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - + #ifndef NRF_H #define NRF_H /* MDK version */ #define MDK_MAJOR_VERSION 8 -#define MDK_MINOR_VERSION 5 -#define MDK_MICRO_VERSION 0 +#define MDK_MINOR_VERSION 11 +#define MDK_MICRO_VERSION 1 + +/* Redefine "old" too-generic name NRF52 to NRF52832_XXAA to keep backwards compatibility. */ +#if defined (NRF52) + #ifndef NRF52832_XXAA + #define NRF52832_XXAA + #endif +#endif + +/* Define NRF52_SERIES for common use in nRF52 series devices. */ +#if defined (NRF52832_XXAA) || defined (NRF52840_XXAA) + #define NRF52_SERIES +#endif + #if defined(_WIN32) - /* Do not include nrf51 specific files when building for PC host */ + /* Do not include nrf specific files when building for PC host */ #elif defined(__unix) - /* Do not include nrf51 specific files when building for PC host */ + /* Do not include nrf specific files when building for PC host */ #elif defined(__APPLE__) - /* Do not include nrf51 specific files when building for PC host */ + /* Do not include nrf specific files when building for PC host */ #else - /* Family selection for family includes. */ + /* Device selection for device includes. */ #if defined (NRF51) #include "nrf51.h" #include "nrf51_bitfields.h" #include "nrf51_deprecated.h" - #elif defined (NRF52) + #elif defined (NRF52840_XXAA) + #include "nrf52840.h" + #include "nrf52840_bitfields.h" + #include "nrf51_to_nrf52840.h" + #include "nrf52_to_nrf52840.h" + #elif defined (NRF52832_XXAA) #include "nrf52.h" #include "nrf52_bitfields.h" #include "nrf51_to_nrf52.h" #include "nrf52_name_change.h" #else - #error "Device family must be defined. See nrf.h." - #endif /* NRF51, NRF52 */ + #error "Device must be defined. See nrf.h." + #endif /* NRF51, NRF52832_XXAA, NRF52840_XXAA */ #include "compiler_abstraction.h" - #include "irq_handlers_hw.h" #endif /* _WIN32 || __unix || __APPLE__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51.h index 0fae756197..ae60a5613d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51.h @@ -6,12 +6,12 @@ * nrf51 from Nordic Semiconductor. * * @version V522 - * @date 23. February 2016 + * @date 18. November 2016 * * @note Generated with SVDConv V2.81d * from CMSIS SVD File 'nrf51.svd' Version 522, * - * @par Copyright (c) 2013, Nordic Semiconductor ASA + * @par Copyright (c) 2016, Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -147,33 +147,6 @@ typedef enum { #endif -typedef struct { - __IO uint32_t CPU0; /*!< Configurable priority configuration register for CPU0. */ - __IO uint32_t SPIS1; /*!< Configurable priority configuration register for SPIS1. */ - __IO uint32_t RADIO; /*!< Configurable priority configuration register for RADIO. */ - __IO uint32_t ECB; /*!< Configurable priority configuration register for ECB. */ - __IO uint32_t CCM; /*!< Configurable priority configuration register for CCM. */ - __IO uint32_t AAR; /*!< Configurable priority configuration register for AAR. */ -} AMLI_RAMPRI_Type; - -typedef struct { - __IO uint32_t SCK; /*!< Pin select for SCK. */ - __IO uint32_t MOSI; /*!< Pin select for MOSI. */ - __IO uint32_t MISO; /*!< Pin select for MISO. */ -} SPIM_PSEL_Type; - -typedef struct { - __IO uint32_t PTR; /*!< Data pointer. */ - __IO uint32_t MAXCNT; /*!< Maximum number of buffer bytes to receive. */ - __I uint32_t AMOUNT; /*!< Number of bytes received in the last transaction. */ -} SPIM_RXD_Type; - -typedef struct { - __IO uint32_t PTR; /*!< Data pointer. */ - __IO uint32_t MAXCNT; /*!< Maximum number of buffer bytes to send. */ - __I uint32_t AMOUNT; /*!< Number of bytes sent in the last transaction. */ -} SPIM_TXD_Type; - typedef struct { __O uint32_t EN; /*!< Enable channel group. */ __O uint32_t DIS; /*!< Disable channel group. */ @@ -292,21 +265,6 @@ typedef struct { /*!< MPU Structure } NRF_MPU_Type; -/* ================================================================================ */ -/* ================ AMLI ================ */ -/* ================================================================================ */ - - -/** - * @brief AHB Multi-Layer Interface. (AMLI) - */ - -typedef struct { /*!< AMLI Structure */ - __I uint32_t RESERVED0[896]; - AMLI_RAMPRI_Type RAMPRI; /*!< RAM configurable priority configuration structure. */ -} NRF_AMLI_Type; - - /* ================================================================================ */ /* ================ RADIO ================ */ /* ================================================================================ */ @@ -581,52 +539,6 @@ typedef struct { /*!< SPIS Structure } NRF_SPIS_Type; -/* ================================================================================ */ -/* ================ SPIM ================ */ -/* ================================================================================ */ - - -/** - * @brief SPI master with easyDMA 1. (SPIM) - */ - -typedef struct { /*!< SPIM Structure */ - __I uint32_t RESERVED0[4]; - __O uint32_t TASKS_START; /*!< Start SPI transaction. */ - __O uint32_t TASKS_STOP; /*!< Stop SPI transaction. */ - __I uint32_t RESERVED1; - __O uint32_t TASKS_SUSPEND; /*!< Suspend SPI transaction. */ - __O uint32_t TASKS_RESUME; /*!< Resume SPI transaction. */ - __I uint32_t RESERVED2[56]; - __IO uint32_t EVENTS_STOPPED; /*!< SPI transaction has stopped. */ - __I uint32_t RESERVED3[2]; - __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached. */ - __I uint32_t RESERVED4[3]; - __IO uint32_t EVENTS_ENDTX; /*!< End of TXD buffer reached. */ - __I uint32_t RESERVED5[10]; - __IO uint32_t EVENTS_STARTED; /*!< Transaction started. */ - __I uint32_t RESERVED6[109]; - __IO uint32_t INTENSET; /*!< Interrupt enable set register. */ - __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */ - __I uint32_t RESERVED7[125]; - __IO uint32_t ENABLE; /*!< Enable SPIM. */ - __I uint32_t RESERVED8; - SPIM_PSEL_Type PSEL; /*!< Pin select configuration. */ - __I uint32_t RESERVED9[4]; - __IO uint32_t FREQUENCY; /*!< SPI frequency. */ - __I uint32_t RESERVED10[3]; - SPIM_RXD_Type RXD; /*!< RXD EasyDMA configuration and status. */ - __I uint32_t RESERVED11; - SPIM_TXD_Type TXD; /*!< TXD EasyDMA configuration and status. */ - __I uint32_t RESERVED12; - __IO uint32_t CONFIG; /*!< Configuration register. */ - __I uint32_t RESERVED13[26]; - __IO uint32_t ORC; /*!< Over-read character. */ - __I uint32_t RESERVED14[654]; - __IO uint32_t POWER; /*!< Peripheral power control. */ -} NRF_SPIM_Type; - - /* ================================================================================ */ /* ================ GPIOTE ================ */ /* ================================================================================ */ @@ -1201,7 +1113,6 @@ typedef struct { /*!< GPIO Structure #define NRF_POWER_BASE 0x40000000UL #define NRF_CLOCK_BASE 0x40000000UL #define NRF_MPU_BASE 0x40000000UL -#define NRF_AMLI_BASE 0x40000000UL #define NRF_RADIO_BASE 0x40001000UL #define NRF_UART0_BASE 0x40002000UL #define NRF_SPI0_BASE 0x40003000UL @@ -1209,7 +1120,6 @@ typedef struct { /*!< GPIO Structure #define NRF_SPI1_BASE 0x40004000UL #define NRF_TWI1_BASE 0x40004000UL #define NRF_SPIS1_BASE 0x40004000UL -#define NRF_SPIM1_BASE 0x40004000UL #define NRF_GPIOTE_BASE 0x40006000UL #define NRF_ADC_BASE 0x40007000UL #define NRF_TIMER0_BASE 0x40008000UL @@ -1240,7 +1150,6 @@ typedef struct { /*!< GPIO Structure #define NRF_POWER ((NRF_POWER_Type *) NRF_POWER_BASE) #define NRF_CLOCK ((NRF_CLOCK_Type *) NRF_CLOCK_BASE) #define NRF_MPU ((NRF_MPU_Type *) NRF_MPU_BASE) -#define NRF_AMLI ((NRF_AMLI_Type *) NRF_AMLI_BASE) #define NRF_RADIO ((NRF_RADIO_Type *) NRF_RADIO_BASE) #define NRF_UART0 ((NRF_UART_Type *) NRF_UART0_BASE) #define NRF_SPI0 ((NRF_SPI_Type *) NRF_SPI0_BASE) @@ -1248,7 +1157,6 @@ typedef struct { /*!< GPIO Structure #define NRF_SPI1 ((NRF_SPI_Type *) NRF_SPI1_BASE) #define NRF_TWI1 ((NRF_TWI_Type *) NRF_TWI1_BASE) #define NRF_SPIS1 ((NRF_SPIS_Type *) NRF_SPIS1_BASE) -#define NRF_SPIM1 ((NRF_SPIM_Type *) NRF_SPIM1_BASE) #define NRF_GPIOTE ((NRF_GPIOTE_Type *) NRF_GPIOTE_BASE) #define NRF_ADC ((NRF_ADC_Type *) NRF_ADC_BASE) #define NRF_TIMER0 ((NRF_TIMER_Type *) NRF_TIMER0_BASE) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51422_peripherals.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51422_peripherals.h new file mode 100644 index 0000000000..16030dbc9f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51422_peripherals.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _NRF51422_PERIPHERALS_H +#define _NRF51422_PERIPHERALS_H + + +/* Software Interrupts */ +#define SWI_PRESENT +#define SWI_COUNT 6 + +/* GPIO */ +#define GPIO_PRESENT +#define GPIO_COUNT 1 + +#define P0_PIN_NUM 32 + +/* MPU and BPROT */ +#define BPROT_PRESENT + +#define BPROT_REGIONS_SIZE 4096 +#define BPROT_REGIONS_NUM 64 + +/* Radio */ +#define RADIO_PRESENT +#define RADIO_COUNT 1 + +/* Accelerated Address Resolver */ +#define AAR_PRESENT +#define AAR_COUNT 1 + +#define AAR_MAX_IRK_NUM 8 + +/* AES Electronic CodeBook mode encryption */ +#define ECB_PRESENT +#define ECB_COUNT 1 + +/* AES CCM mode encryption */ +#define CCM_PRESENT +#define CCM_COUNT 1 + +/* Peripheral to Peripheral Interconnect */ +#define PPI_PRESENT +#define PPI_COUNT 1 + +#define PPI_CH_NUM 16 +#define PPI_GROUP_NUM 4 + +/* Timer/Counter */ +#define TIMER_PRESENT +#define TIMER_COUNT 3 + +#define TIMER0_MAX_SIZE 32 +#define TIMER1_MAX_SIZE 16 +#define TIMER2_MAX_SIZE 16 + +#define TIMER0_CC_NUM 4 +#define TIMER1_CC_NUM 4 +#define TIMER2_CC_NUM 4 + +/* Real Time Counter */ +#define RTC_PRESENT +#define RTC_COUNT 2 + +#define RTC0_CC_NUM 3 +#define RTC1_CC_NUM 4 + +/* RNG */ +#define RNG_PRESENT +#define RNG_COUNT 1 + +/* Watchdog Timer */ +#define WDT_PRESENT +#define WDT_COUNT 1 + +/* Temperature Sensor */ +#define TEMP_PRESENT +#define TEMP_COUNT 1 + +/* Serial Peripheral Interface Master */ +#define SPI_PRESENT +#define SPI_COUNT 2 + +/* Serial Peripheral Interface Slave with DMA */ +#define SPIS_PRESENT +#define SPIS_COUNT 1 + +/* Two Wire Interface Master */ +#define TWI_PRESENT +#define TWI_COUNT 2 + +/* Universal Asynchronous Receiver-Transmitter */ +#define UART_PRESENT +#define UART_COUNT 1 + +/* Quadrature Decoder */ +#define QDEC_PRESENT +#define QDEC_COUNT 1 + +/* Analog to Digital Converter */ +#define ADC_PRESENT +#define ADC_COUNT 1 + +/* GPIO Tasks and Events */ +#define GPIOTE_PRESENT +#define GPIOTE_COUNT 1 + +#define GPIOTE_CH_NUM 4 + +/* Low Power Comparator */ +#define LPCOMP_PRESENT +#define LPCOMP_COUNT 1 + +#define LPCOMP_REFSEL_RESOLUTION 8 + + +#endif // _NRF51422_PERIPHERALS_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51802_peripherals.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51802_peripherals.h new file mode 100644 index 0000000000..5f9c103024 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51802_peripherals.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _NRF51802_PERIPHERALS_H +#define _NRF51802_PERIPHERALS_H + + +/* Software Interrupts */ +#define SWI_PRESENT +#define SWI_COUNT 6 + +/* GPIO */ +#define GPIO_PRESENT +#define GPIO_COUNT 1 + +#define P0_PIN_NUM 32 + +/* MPU and BPROT */ +#define BPROT_PRESENT + +#define BPROT_REGIONS_SIZE 4096 +#define BPROT_REGIONS_NUM 64 + +/* Radio */ +#define RADIO_PRESENT +#define RADIO_COUNT 1 + +/* Accelerated Address Resolver */ +#define AAR_PRESENT +#define AAR_COUNT 1 + +#define AAR_MAX_IRK_NUM 8 + +/* AES Electronic CodeBook mode encryption */ +#define ECB_PRESENT +#define ECB_COUNT 1 + +/* AES CCM mode encryption */ +#define CCM_PRESENT +#define CCM_COUNT 1 + +/* Peripheral to Peripheral Interconnect */ +#define PPI_PRESENT +#define PPI_COUNT 1 + +#define PPI_CH_NUM 16 +#define PPI_GROUP_NUM 4 + +/* Timer/Counter */ +#define TIMER_PRESENT +#define TIMER_COUNT 3 + +#define TIMER0_MAX_SIZE 32 +#define TIMER1_MAX_SIZE 16 +#define TIMER2_MAX_SIZE 16 + +#define TIMER0_CC_NUM 4 +#define TIMER1_CC_NUM 4 +#define TIMER2_CC_NUM 4 + +/* Real Time Counter */ +#define RTC_PRESENT +#define RTC_COUNT 2 + +#define RTC0_CC_NUM 3 +#define RTC1_CC_NUM 4 + +/* RNG */ +#define RNG_PRESENT +#define RNG_COUNT 1 + +/* Watchdog Timer */ +#define WDT_PRESENT +#define WDT_COUNT 1 + +/* Temperature Sensor */ +#define TEMP_PRESENT +#define TEMP_COUNT 1 + +/* Serial Peripheral Interface Master */ +#define SPI_PRESENT +#define SPI_COUNT 2 + +/* Serial Peripheral Interface Slave with DMA */ +#define SPIS_PRESENT +#define SPIS_COUNT 1 + +/* Two Wire Interface Master */ +#define TWI_PRESENT +#define TWI_COUNT 2 + +/* Universal Asynchronous Receiver-Transmitter */ +#define UART_PRESENT +#define UART_COUNT 1 + +/* Quadrature Decoder */ +#define QDEC_PRESENT +#define QDEC_COUNT 1 + +/* Analog to Digital Converter */ +#define ADC_PRESENT +#define ADC_COUNT 1 + +/* GPIO Tasks and Events */ +#define GPIOTE_PRESENT +#define GPIOTE_COUNT 1 + +#define GPIOTE_CH_NUM 4 + +/* Low Power Comparator */ +#define LPCOMP_PRESENT +#define LPCOMP_COUNT 1 + +#define LPCOMP_REFSEL_RESOLUTION 8 + + +#endif // _NRF51802_PERIPHERALS_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51822_peripherals.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51822_peripherals.h new file mode 100644 index 0000000000..83c3fa277d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51822_peripherals.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _NRF51822_PERIPHERALS_H +#define _NRF51822_PERIPHERALS_H + + +/* Software Interrupts */ +#define SWI_PRESENT +#define SWI_COUNT 6 + +/* GPIO */ +#define GPIO_PRESENT +#define GPIO_COUNT 1 + +#define P0_PIN_NUM 32 + +/* MPU and BPROT */ +#define BPROT_PRESENT + +#define BPROT_REGIONS_SIZE 4096 +#define BPROT_REGIONS_NUM 64 + +/* Radio */ +#define RADIO_PRESENT +#define RADIO_COUNT 1 + +/* Accelerated Address Resolver */ +#define AAR_PRESENT +#define AAR_COUNT 1 + +#define AAR_MAX_IRK_NUM 8 + +/* AES Electronic CodeBook mode encryption */ +#define ECB_PRESENT +#define ECB_COUNT 1 + +/* AES CCM mode encryption */ +#define CCM_PRESENT +#define CCM_COUNT 1 + +/* Peripheral to Peripheral Interconnect */ +#define PPI_PRESENT +#define PPI_COUNT 1 + +#define PPI_CH_NUM 16 +#define PPI_GROUP_NUM 4 + +/* Timer/Counter */ +#define TIMER_PRESENT +#define TIMER_COUNT 3 + +#define TIMER0_MAX_SIZE 32 +#define TIMER1_MAX_SIZE 16 +#define TIMER2_MAX_SIZE 16 + +#define TIMER0_CC_NUM 4 +#define TIMER1_CC_NUM 4 +#define TIMER2_CC_NUM 4 + +/* Real Time Counter */ +#define RTC_PRESENT +#define RTC_COUNT 2 + +#define RTC0_CC_NUM 3 +#define RTC1_CC_NUM 4 + +/* RNG */ +#define RNG_PRESENT +#define RNG_COUNT 1 + +/* Watchdog Timer */ +#define WDT_PRESENT +#define WDT_COUNT 1 + +/* Temperature Sensor */ +#define TEMP_PRESENT +#define TEMP_COUNT 1 + +/* Serial Peripheral Interface Master */ +#define SPI_PRESENT +#define SPI_COUNT 2 + +/* Serial Peripheral Interface Slave with DMA */ +#define SPIS_PRESENT +#define SPIS_COUNT 1 + +/* Two Wire Interface Master */ +#define TWI_PRESENT +#define TWI_COUNT 2 + +/* Universal Asynchronous Receiver-Transmitter */ +#define UART_PRESENT +#define UART_COUNT 1 + +/* Quadrature Decoder */ +#define QDEC_PRESENT +#define QDEC_COUNT 1 + +/* Analog to Digital Converter */ +#define ADC_PRESENT +#define ADC_COUNT 1 + +/* GPIO Tasks and Events */ +#define GPIOTE_PRESENT +#define GPIOTE_COUNT 1 + +#define GPIOTE_CH_NUM 4 + +/* Low Power Comparator */ +#define LPCOMP_PRESENT +#define LPCOMP_COUNT 1 + +#define LPCOMP_REFSEL_RESOLUTION 8 + + +#endif // _NRF51822_PERIPHERALS_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_bitfields.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_bitfields.h index f9b512fef7..06005c7dc7 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_bitfields.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_bitfields.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,7 +35,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - + #ifndef __NRF51_BITS_H #define __NRF51_BITS_H @@ -230,604 +230,6 @@ #define ADC_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ -/* Peripheral: AMLI */ -/* Description: AHB Multi-Layer Interface. */ - -/* Register: AMLI_RAMPRI_CPU0 */ -/* Description: Configurable priority configuration register for CPU0. */ - -/* Bits 31..28 : Configuration field for RAM block 7. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_CPU0_RAM7_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 27..24 : Configuration field for RAM block 6. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_CPU0_RAM6_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 23..20 : Configuration field for RAM block 5. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_CPU0_RAM5_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 19..16 : Configuration field for RAM block 4. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_CPU0_RAM4_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 15..12 : Configuration field for RAM block 3. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_CPU0_RAM3_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 11..8 : Configuration field for RAM block 2. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_CPU0_RAM2_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 7..4 : Configuration field for RAM block 1. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_CPU0_RAM1_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 3..0 : Configuration field for RAM block 0. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_CPU0_RAM0_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Register: AMLI_RAMPRI_SPIS1 */ -/* Description: Configurable priority configuration register for SPIS1. */ - -/* Bits 31..28 : Configuration field for RAM block 7. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 27..24 : Configuration field for RAM block 6. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 23..20 : Configuration field for RAM block 5. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 19..16 : Configuration field for RAM block 4. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 15..12 : Configuration field for RAM block 3. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 11..8 : Configuration field for RAM block 2. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 7..4 : Configuration field for RAM block 1. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 3..0 : Configuration field for RAM block 0. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Register: AMLI_RAMPRI_RADIO */ -/* Description: Configurable priority configuration register for RADIO. */ - -/* Bits 31..28 : Configuration field for RAM block 7. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_RADIO_RAM7_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 27..24 : Configuration field for RAM block 6. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_RADIO_RAM6_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 23..20 : Configuration field for RAM block 5. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_RADIO_RAM5_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 19..16 : Configuration field for RAM block 4. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_RADIO_RAM4_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 15..12 : Configuration field for RAM block 3. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_RADIO_RAM3_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 11..8 : Configuration field for RAM block 2. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_RADIO_RAM2_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 7..4 : Configuration field for RAM block 1. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_RADIO_RAM1_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 3..0 : Configuration field for RAM block 0. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_RADIO_RAM0_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Register: AMLI_RAMPRI_ECB */ -/* Description: Configurable priority configuration register for ECB. */ - -/* Bits 31..28 : Configuration field for RAM block 7. */ -#define AMLI_RAMPRI_ECB_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_ECB_RAM7_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 27..24 : Configuration field for RAM block 6. */ -#define AMLI_RAMPRI_ECB_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_ECB_RAM6_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 23..20 : Configuration field for RAM block 5. */ -#define AMLI_RAMPRI_ECB_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_ECB_RAM5_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 19..16 : Configuration field for RAM block 4. */ -#define AMLI_RAMPRI_ECB_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_ECB_RAM4_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 15..12 : Configuration field for RAM block 3. */ -#define AMLI_RAMPRI_ECB_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_ECB_RAM3_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 11..8 : Configuration field for RAM block 2. */ -#define AMLI_RAMPRI_ECB_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_ECB_RAM2_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 7..4 : Configuration field for RAM block 1. */ -#define AMLI_RAMPRI_ECB_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_ECB_RAM1_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 3..0 : Configuration field for RAM block 0. */ -#define AMLI_RAMPRI_ECB_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_ECB_RAM0_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Register: AMLI_RAMPRI_CCM */ -/* Description: Configurable priority configuration register for CCM. */ - -/* Bits 31..28 : Configuration field for RAM block 7. */ -#define AMLI_RAMPRI_CCM_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_CCM_RAM7_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 27..24 : Configuration field for RAM block 6. */ -#define AMLI_RAMPRI_CCM_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_CCM_RAM6_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 23..20 : Configuration field for RAM block 5. */ -#define AMLI_RAMPRI_CCM_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_CCM_RAM5_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 19..16 : Configuration field for RAM block 4. */ -#define AMLI_RAMPRI_CCM_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_CCM_RAM4_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 15..12 : Configuration field for RAM block 3. */ -#define AMLI_RAMPRI_CCM_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_CCM_RAM3_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 11..8 : Configuration field for RAM block 2. */ -#define AMLI_RAMPRI_CCM_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_CCM_RAM2_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 7..4 : Configuration field for RAM block 1. */ -#define AMLI_RAMPRI_CCM_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_CCM_RAM1_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 3..0 : Configuration field for RAM block 0. */ -#define AMLI_RAMPRI_CCM_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_CCM_RAM0_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Register: AMLI_RAMPRI_AAR */ -/* Description: Configurable priority configuration register for AAR. */ - -/* Bits 31..28 : Configuration field for RAM block 7. */ -#define AMLI_RAMPRI_AAR_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_AAR_RAM7_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 27..24 : Configuration field for RAM block 6. */ -#define AMLI_RAMPRI_AAR_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_AAR_RAM6_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 23..20 : Configuration field for RAM block 5. */ -#define AMLI_RAMPRI_AAR_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_AAR_RAM5_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 19..16 : Configuration field for RAM block 4. */ -#define AMLI_RAMPRI_AAR_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_AAR_RAM4_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 15..12 : Configuration field for RAM block 3. */ -#define AMLI_RAMPRI_AAR_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_AAR_RAM3_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 11..8 : Configuration field for RAM block 2. */ -#define AMLI_RAMPRI_AAR_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_AAR_RAM2_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 7..4 : Configuration field for RAM block 1. */ -#define AMLI_RAMPRI_AAR_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_AAR_RAM1_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri14 (0xEUL) /*!< Priority 14. */ - -/* Bits 3..0 : Configuration field for RAM block 0. */ -#define AMLI_RAMPRI_AAR_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_AAR_RAM0_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri0 (0x0UL) /*!< Priority 0. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri2 (0x2UL) /*!< Priority 2. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri4 (0x4UL) /*!< Priority 4. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri6 (0x6UL) /*!< Priority 6. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri8 (0x8UL) /*!< Priority 8. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri10 (0xAUL) /*!< Priority 10. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri12 (0xCUL) /*!< Priority 12. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri14 (0xEUL) /*!< Priority 14. */ - - /* Peripheral: CCM */ /* Description: AES CCM Mode Encryption. */ @@ -2930,7 +2332,7 @@ /* Bit 0 : Result of last compare. Decision point SAMPLE task. */ #define LPCOMP_RESULT_RESULT_Pos (0UL) /*!< Position of RESULT field. */ #define LPCOMP_RESULT_RESULT_Msk (0x1UL << LPCOMP_RESULT_RESULT_Pos) /*!< Bit mask of RESULT field. */ -#define LPCOMP_RESULT_RESULT_Bellow (0UL) /*!< Input voltage is bellow the reference threshold. */ +#define LPCOMP_RESULT_RESULT_Below (0UL) /*!< Input voltage is bellow the reference threshold. */ #define LPCOMP_RESULT_RESULT_Above (1UL) /*!< Input voltage is above the reference threshold. */ /* Register: LPCOMP_ENABLE */ @@ -5779,174 +5181,6 @@ #define SPI_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ -/* Peripheral: SPIM */ -/* Description: SPI master with easyDMA 1. */ - -/* Register: SPIM_INTENSET */ -/* Description: Interrupt enable set register. */ - -/* Bit 19 : Enable interrupt on STARTED event. */ -#define SPIM_INTENSET_STARTED_Pos (19UL) /*!< Position of STARTED field. */ -#define SPIM_INTENSET_STARTED_Msk (0x1UL << SPIM_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ -#define SPIM_INTENSET_STARTED_Disabled (0UL) /*!< Interrupt disabled. */ -#define SPIM_INTENSET_STARTED_Enabled (1UL) /*!< Interrupt enabled. */ -#define SPIM_INTENSET_STARTED_Set (1UL) /*!< Enable interrupt on write. */ - -/* Bit 8 : Enable interrupt on ENDTX event. */ -#define SPIM_INTENSET_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ -#define SPIM_INTENSET_ENDTX_Msk (0x1UL << SPIM_INTENSET_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ -#define SPIM_INTENSET_ENDTX_Disabled (0UL) /*!< Interrupt disabled. */ -#define SPIM_INTENSET_ENDTX_Enabled (1UL) /*!< Interrupt enabled. */ -#define SPIM_INTENSET_ENDTX_Set (1UL) /*!< Enable interrupt on write. */ - -/* Bit 4 : Enable interrupt on ENDRX event. */ -#define SPIM_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ -#define SPIM_INTENSET_ENDRX_Msk (0x1UL << SPIM_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ -#define SPIM_INTENSET_ENDRX_Disabled (0UL) /*!< Interrupt disabled. */ -#define SPIM_INTENSET_ENDRX_Enabled (1UL) /*!< Interrupt enabled. */ -#define SPIM_INTENSET_ENDRX_Set (1UL) /*!< Enable interrupt on write. */ - -/* Bit 1 : Enable interrupt on STOPPED event. */ -#define SPIM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ -#define SPIM_INTENSET_STOPPED_Msk (0x1UL << SPIM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ -#define SPIM_INTENSET_STOPPED_Disabled (0UL) /*!< Interrupt disabled. */ -#define SPIM_INTENSET_STOPPED_Enabled (1UL) /*!< Interrupt enabled. */ -#define SPIM_INTENSET_STOPPED_Set (1UL) /*!< Enable interrupt on write. */ - -/* Register: SPIM_INTENCLR */ -/* Description: Interrupt enable clear register. */ - -/* Bit 19 : Disable interrupt on STARTED event. */ -#define SPIM_INTENCLR_STARTED_Pos (19UL) /*!< Position of STARTED field. */ -#define SPIM_INTENCLR_STARTED_Msk (0x1UL << SPIM_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ -#define SPIM_INTENCLR_STARTED_Disabled (0UL) /*!< Interrupt disabled. */ -#define SPIM_INTENCLR_STARTED_Enabled (1UL) /*!< Interrupt enabled. */ -#define SPIM_INTENCLR_STARTED_Clear (1UL) /*!< Disable interrupt on write. */ - -/* Bit 8 : Disable interrupt on ENDTX event. */ -#define SPIM_INTENCLR_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ -#define SPIM_INTENCLR_ENDTX_Msk (0x1UL << SPIM_INTENCLR_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ -#define SPIM_INTENCLR_ENDTX_Disabled (0UL) /*!< Interrupt disabled. */ -#define SPIM_INTENCLR_ENDTX_Enabled (1UL) /*!< Interrupt enabled. */ -#define SPIM_INTENCLR_ENDTX_Clear (1UL) /*!< Disable interrupt on write. */ - -/* Bit 4 : Disable interrupt on ENDRX event. */ -#define SPIM_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ -#define SPIM_INTENCLR_ENDRX_Msk (0x1UL << SPIM_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ -#define SPIM_INTENCLR_ENDRX_Disabled (0UL) /*!< Interrupt disabled. */ -#define SPIM_INTENCLR_ENDRX_Enabled (1UL) /*!< Interrupt enabled. */ -#define SPIM_INTENCLR_ENDRX_Clear (1UL) /*!< Disable interrupt on write. */ - -/* Bit 1 : Disable interrupt on STOPPED event. */ -#define SPIM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ -#define SPIM_INTENCLR_STOPPED_Msk (0x1UL << SPIM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ -#define SPIM_INTENCLR_STOPPED_Disabled (0UL) /*!< Interrupt disabled. */ -#define SPIM_INTENCLR_STOPPED_Enabled (1UL) /*!< Interrupt enabled. */ -#define SPIM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable interrupt on write. */ - -/* Register: SPIM_ENABLE */ -/* Description: Enable SPIM. */ - -/* Bits 3..0 : Enable or disable SPIM. */ -#define SPIM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ -#define SPIM_ENABLE_ENABLE_Msk (0xFUL << SPIM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ -#define SPIM_ENABLE_ENABLE_Disabled (0x00UL) /*!< Disabled SPIM. */ -#define SPIM_ENABLE_ENABLE_Enabled (0x07UL) /*!< Enable SPIM. */ - -/* Register: SPIM_FREQUENCY */ -/* Description: SPI frequency. */ - -/* Bits 31..0 : SPI master data rate. */ -#define SPIM_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ -#define SPIM_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << SPIM_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ -#define SPIM_FREQUENCY_FREQUENCY_K125 (0x02000000UL) /*!< 125 kbps. */ -#define SPIM_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps. */ -#define SPIM_FREQUENCY_FREQUENCY_K500 (0x08000000UL) /*!< 500 kbps. */ -#define SPIM_FREQUENCY_FREQUENCY_M1 (0x10000000UL) /*!< 1 Mbps. */ -#define SPIM_FREQUENCY_FREQUENCY_M2 (0x20000000UL) /*!< 2 Mbps. */ -#define SPIM_FREQUENCY_FREQUENCY_M4 (0x40000000UL) /*!< 4 Mbps. */ -#define SPIM_FREQUENCY_FREQUENCY_M8 (0x80000000UL) /*!< 8 Mbps. */ - -/* Register: SPIM_RXD_PTR */ -/* Description: Data pointer. */ - -/* Bits 31..0 : Data pointer. */ -#define SPIM_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ -#define SPIM_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIM_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ - -/* Register: SPIM_RXD_MAXCNT */ -/* Description: Maximum number of buffer bytes to receive. */ - -/* Bits 7..0 : Maximum number of buffer bytes to receive. */ -#define SPIM_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ -#define SPIM_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIM_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ - -/* Register: SPIM_RXD_AMOUNT */ -/* Description: Number of bytes received in the last transaction. */ - -/* Bits 7..0 : Number of bytes received in the last transaction. */ -#define SPIM_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ -#define SPIM_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIM_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ - -/* Register: SPIM_TXD_PTR */ -/* Description: Data pointer. */ - -/* Bits 31..0 : Data pointer. */ -#define SPIM_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ -#define SPIM_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIM_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ - -/* Register: SPIM_TXD_MAXCNT */ -/* Description: Maximum number of buffer bytes to send. */ - -/* Bits 7..0 : Maximum number of buffer bytes to send. */ -#define SPIM_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ -#define SPIM_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIM_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ - -/* Register: SPIM_TXD_AMOUNT */ -/* Description: Number of bytes sent in the last transaction. */ - -/* Bits 7..0 : Number of bytes sent in the last transaction. */ -#define SPIM_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ -#define SPIM_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIM_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ - -/* Register: SPIM_CONFIG */ -/* Description: Configuration register. */ - -/* Bit 2 : Serial clock (SCK) polarity. */ -#define SPIM_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ -#define SPIM_CONFIG_CPOL_Msk (0x1UL << SPIM_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ -#define SPIM_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high. */ -#define SPIM_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low. */ - -/* Bit 1 : Serial clock (SCK) phase. */ -#define SPIM_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ -#define SPIM_CONFIG_CPHA_Msk (0x1UL << SPIM_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ -#define SPIM_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of the clock. Shift serial data on trailing edge. */ -#define SPIM_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of the clock. Shift serial data on leading edge. */ - -/* Bit 0 : Bit order. */ -#define SPIM_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ -#define SPIM_CONFIG_ORDER_Msk (0x1UL << SPIM_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ -#define SPIM_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit transmitted out first. */ -#define SPIM_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit transmitted out first. */ - -/* Register: SPIM_ORC */ -/* Description: Over-read character. */ - -/* Bits 7..0 : Over-read character. */ -#define SPIM_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ -#define SPIM_ORC_ORC_Msk (0xFFUL << SPIM_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ - -/* Register: SPIM_POWER */ -/* Description: Peripheral power control. */ - -/* Bit 0 : Peripheral power control. */ -#define SPIM_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ -#define SPIM_POWER_POWER_Msk (0x1UL << SPIM_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ -#define SPIM_POWER_POWER_Disabled (0UL) /*!< Module power disabled. */ -#define SPIM_POWER_POWER_Enabled (1UL) /*!< Module power enabled. */ - - /* Peripheral: SPIS */ /* Description: SPI slave 1. */ @@ -6466,7 +5700,7 @@ #define TWI_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << TWI_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ #define TWI_FREQUENCY_FREQUENCY_K100 (0x01980000UL) /*!< 100 kbps. */ #define TWI_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps. */ -#define TWI_FREQUENCY_FREQUENCY_K400 (0x06680000UL) /*!< 400 kbps. */ +#define TWI_FREQUENCY_FREQUENCY_K400 (0x06680000UL) /*!< 400 kbps (actual rate 410.256 kbps). */ /* Register: TWI_ADDRESS */ /* Description: Address used in the two-wire transfer. */ @@ -6660,7 +5894,9 @@ #define UART_BAUDRATE_BAUDRATE_Baud14400 (0x003B0000UL) /*!< 14400 baud. */ #define UART_BAUDRATE_BAUDRATE_Baud19200 (0x004EA000UL) /*!< 19200 baud. */ #define UART_BAUDRATE_BAUDRATE_Baud28800 (0x0075F000UL) /*!< 28800 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud31250 (0x00800000UL) /*!< 31250 baud. */ #define UART_BAUDRATE_BAUDRATE_Baud38400 (0x009D5000UL) /*!< 38400 baud. */ +#define UART_BAUDRATE_BAUDRATE_Baud56000 (0x00E50000UL) /*!< 56000 baud. */ #define UART_BAUDRATE_BAUDRATE_Baud57600 (0x00EBF000UL) /*!< 57600 baud. */ #define UART_BAUDRATE_BAUDRATE_Baud76800 (0x013A9000UL) /*!< 76800 baud. */ #define UART_BAUDRATE_BAUDRATE_Baud115200 (0x01D7E000UL) /*!< 115200 baud. */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_deprecated.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_deprecated.h index 81bd149663..757f2a992a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_deprecated.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_deprecated.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,8 +35,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - + #ifndef NRF51_DEPRECATED_H #define NRF51_DEPRECATED_H @@ -54,8 +53,10 @@ /* LPCOMP */ /* The interrupt ISR was renamed. Adding old name to the macros. */ -#define LPCOMP_COMP_IRQHandler LPCOMP_IRQHandler -#define LPCOMP_COMP_IRQn LPCOMP_IRQn +#define LPCOMP_COMP_IRQHandler LPCOMP_IRQHandler +#define LPCOMP_COMP_IRQn LPCOMP_IRQn +/* Corrected typo in RESULT register. */ +#define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below /* MPU */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52.h index a74b165a2b..6a6ce502dd 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,8 +35,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - + #ifndef NRF51_TO_NRF52_H #define NRF51_TO_NRF52_H @@ -44,7 +43,7 @@ /* This file is given to prevent your SW from not compiling with the name changes between nRF51 and nRF52 devices. * It redefines the old nRF51 names into the new ones as long as the functionality is still supported. If the - * functionality is gone, there old names are not define, so compilation will fail. Note that also includes macros + * functionality is gone, there old names are not defined, so compilation will fail. Note that also includes macros * from the nrf51_deprecated.h file. */ @@ -91,6 +90,13 @@ #define NRF_GPIO_BASE NRF_P0_BASE +/* QDEC */ +/* The registers PSELA, PSELB and PSELLED were restructured into a struct. */ +#define PSELLED PSEL.LED +#define PSELA PSEL.A +#define PSELB PSEL.B + + /* SPIS */ /* The registers PSELSCK, PSELMISO, PSELMOSI, PSELCSN were restructured into a struct. */ #define PSELSCK PSEL.SCK @@ -533,6 +539,16 @@ #define LPCOMP_COMP_IRQn COMP_LPCOMP_IRQn +/* REFSEL register redefined enumerated values and added some more. */ +#define LPCOMP_REFSEL_REFSEL_SupplyOneEighthPrescaling LPCOMP_REFSEL_REFSEL_Ref1_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplyTwoEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref2_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplyThreeEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref3_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplyFourEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref4_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplyFiveEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref5_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplySixEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref6_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplySevenEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref7_8Vdd + + /* RADIO */ /* The name of the field SKIPADDR was corrected. Old macros added for compatibility. */ #define RADIO_CRCCNF_SKIP_ADDR_Pos RADIO_CRCCNF_SKIPADDR_Pos diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52840.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52840.h new file mode 100644 index 0000000000..56a436d352 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf51_to_nrf52840.h @@ -0,0 +1,575 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF51_TO_NRF52840_H +#define NRF51_TO_NRF52840_H + +/*lint ++flb "Enter library region */ + +/* This file is given to prevent your SW from not compiling with the name changes between nRF51 and nRF52840 devices. + * It redefines the old nRF51 names into the new ones as long as the functionality is still supported. If the + * functionality is gone, there old names are not defined, so compilation will fail. Note that also includes macros + * from the nrf51_deprecated.h file. */ + + +/* IRQ */ +/* Several peripherals have been added to several indexes. Names of IRQ handlers and IRQ numbers have changed. */ +#define UART0_IRQHandler UARTE0_UART0_IRQHandler +#define SPI0_TWI0_IRQHandler SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler +#define SPI1_TWI1_IRQHandler SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler +#define ADC_IRQHandler SAADC_IRQHandler +#define LPCOMP_IRQHandler COMP_LPCOMP_IRQHandler +#define SWI0_IRQHandler SWI0_EGU0_IRQHandler +#define SWI1_IRQHandler SWI1_EGU1_IRQHandler +#define SWI2_IRQHandler SWI2_EGU2_IRQHandler +#define SWI3_IRQHandler SWI3_EGU3_IRQHandler +#define SWI4_IRQHandler SWI4_EGU4_IRQHandler +#define SWI5_IRQHandler SWI5_EGU5_IRQHandler + +#define UART0_IRQn UARTE0_UART0_IRQn +#define SPI0_TWI0_IRQn SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn +#define SPI1_TWI1_IRQn SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn +#define ADC_IRQn SAADC_IRQn +#define LPCOMP_IRQn COMP_LPCOMP_IRQn +#define SWI0_IRQn SWI0_EGU0_IRQn +#define SWI1_IRQn SWI1_EGU1_IRQn +#define SWI2_IRQn SWI2_EGU2_IRQn +#define SWI3_IRQn SWI3_EGU3_IRQn +#define SWI4_IRQn SWI4_EGU4_IRQn +#define SWI5_IRQn SWI5_EGU5_IRQn + + +/* UICR */ +/* Register RBPCONF was renamed to APPROTECT. */ +#define RBPCONF APPROTECT + +#define UICR_RBPCONF_PALL_Pos UICR_APPROTECT_PALL_Pos +#define UICR_RBPCONF_PALL_Msk UICR_APPROTECT_PALL_Msk +#define UICR_RBPCONF_PALL_Enabled UICR_APPROTECT_PALL_Enabled +#define UICR_RBPCONF_PALL_Disabled UICR_APPROTECT_PALL_Disabled + + +/* GPIO */ +/* GPIO port was renamed to P0. */ +#define NRF_GPIO NRF_P0 +#define NRF_GPIO_BASE NRF_P0_BASE + + +/* QDEC */ +/* The registers PSELA, PSELB and PSELLED were restructured into a struct. */ +#define PSELLED PSEL.LED +#define PSELA PSEL.A +#define PSELB PSEL.B + + +/* SPIS */ +/* The registers PSELSCK, PSELMISO, PSELMOSI, PSELCSN were restructured into a struct. */ +#define PSELSCK PSEL.SCK +#define PSELMISO PSEL.MISO +#define PSELMOSI PSEL.MOSI +#define PSELCSN PSEL.CSN + +/* The registers RXDPTR, MAXRX, AMOUNTRX were restructured into a struct */ +#define RXDPTR RXD.PTR +#define MAXRX RXD.MAXCNT +#define AMOUNTRX RXD.AMOUNT + +#define SPIS_MAXRX_MAXRX_Pos SPIS_RXD_MAXCNT_MAXCNT_Pos +#define SPIS_MAXRX_MAXRX_Msk SPIS_RXD_MAXCNT_MAXCNT_Msk + +#define SPIS_AMOUNTRX_AMOUNTRX_Pos SPIS_RXD_AMOUNT_AMOUNT_Pos +#define SPIS_AMOUNTRX_AMOUNTRX_Msk SPIS_RXD_AMOUNT_AMOUNT_Msk + +/* The registers TXDPTR, MAXTX, AMOUNTTX were restructured into a struct */ +#define TXDPTR TXD.PTR +#define MAXTX TXD.MAXCNT +#define AMOUNTTX TXD.AMOUNT + +#define SPIS_MAXTX_MAXTX_Pos SPIS_TXD_MAXCNT_MAXCNT_Pos +#define SPIS_MAXTX_MAXTX_Msk SPIS_TXD_MAXCNT_MAXCNT_Msk + +#define SPIS_AMOUNTTX_AMOUNTTX_Pos SPIS_TXD_AMOUNT_AMOUNT_Pos +#define SPIS_AMOUNTTX_AMOUNTTX_Msk SPIS_TXD_AMOUNT_AMOUNT_Msk + + +/* UART */ +/* The registers PSELRTS, PSELTXD, PSELCTS, PSELRXD were restructured into a struct. */ +#define PSELRTS PSEL.RTS +#define PSELTXD PSEL.TXD +#define PSELCTS PSEL.CTS +#define PSELRXD PSEL.RXD + +/* TWI */ +/* The registers PSELSCL, PSELSDA were restructured into a struct. */ +#define PSELSCL PSEL.SCL +#define PSELSDA PSEL.SDA + + + +/* From nrf51_deprecated.h */ + +/* NVMC */ +/* The register ERASEPROTECTEDPAGE changed name to ERASEPCR0 in the documentation. */ +#define ERASEPROTECTEDPAGE ERASEPCR0 + + +/* IRQ */ +/* COMP module was eliminated. Adapted to nrf52840 headers. */ +#define LPCOMP_COMP_IRQHandler COMP_LPCOMP_IRQHandler +#define LPCOMP_COMP_IRQn COMP_LPCOMP_IRQn + + +/* REFSEL register redefined enumerated values and added some more. */ +#define LPCOMP_REFSEL_REFSEL_SupplyOneEighthPrescaling LPCOMP_REFSEL_REFSEL_Ref1_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplyTwoEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref2_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplyThreeEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref3_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplyFourEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref4_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplyFiveEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref5_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplySixEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref6_8Vdd +#define LPCOMP_REFSEL_REFSEL_SupplySevenEighthsPrescaling LPCOMP_REFSEL_REFSEL_Ref7_8Vdd + + +/* RADIO */ +/* The name of the field SKIPADDR was corrected. Old macros added for compatibility. */ +#define RADIO_CRCCNF_SKIP_ADDR_Pos RADIO_CRCCNF_SKIPADDR_Pos +#define RADIO_CRCCNF_SKIP_ADDR_Msk RADIO_CRCCNF_SKIPADDR_Msk +#define RADIO_CRCCNF_SKIP_ADDR_Include RADIO_CRCCNF_SKIPADDR_Include +#define RADIO_CRCCNF_SKIP_ADDR_Skip RADIO_CRCCNF_SKIPADDR_Skip + + +/* FICR */ +/* The registers FICR.DEVICEID0 and FICR.DEVICEID1 were renamed into an array. */ +#define DEVICEID0 DEVICEID[0] +#define DEVICEID1 DEVICEID[1] + +/* The registers FICR.ER0, FICR.ER1, FICR.ER2 and FICR.ER3 were renamed into an array. */ +#define ER0 ER[0] +#define ER1 ER[1] +#define ER2 ER[2] +#define ER3 ER[3] + +/* The registers FICR.IR0, FICR.IR1, FICR.IR2 and FICR.IR3 were renamed into an array. */ +#define IR0 IR[0] +#define IR1 IR[1] +#define IR2 IR[2] +#define IR3 IR[3] + +/* The registers FICR.DEVICEADDR0 and FICR.DEVICEADDR1 were renamed into an array. */ +#define DEVICEADDR0 DEVICEADDR[0] +#define DEVICEADDR1 DEVICEADDR[1] + + +/* PPI */ +/* The tasks PPI.TASKS_CHGxEN and PPI.TASKS_CHGxDIS were renamed into an array of structs. */ +#define TASKS_CHG0EN TASKS_CHG[0].EN +#define TASKS_CHG0DIS TASKS_CHG[0].DIS +#define TASKS_CHG1EN TASKS_CHG[1].EN +#define TASKS_CHG1DIS TASKS_CHG[1].DIS +#define TASKS_CHG2EN TASKS_CHG[2].EN +#define TASKS_CHG2DIS TASKS_CHG[2].DIS +#define TASKS_CHG3EN TASKS_CHG[3].EN +#define TASKS_CHG3DIS TASKS_CHG[3].DIS + +/* The registers PPI.CHx_EEP and PPI.CHx_TEP were renamed into an array of structs. */ +#define CH0_EEP CH[0].EEP +#define CH0_TEP CH[0].TEP +#define CH1_EEP CH[1].EEP +#define CH1_TEP CH[1].TEP +#define CH2_EEP CH[2].EEP +#define CH2_TEP CH[2].TEP +#define CH3_EEP CH[3].EEP +#define CH3_TEP CH[3].TEP +#define CH4_EEP CH[4].EEP +#define CH4_TEP CH[4].TEP +#define CH5_EEP CH[5].EEP +#define CH5_TEP CH[5].TEP +#define CH6_EEP CH[6].EEP +#define CH6_TEP CH[6].TEP +#define CH7_EEP CH[7].EEP +#define CH7_TEP CH[7].TEP +#define CH8_EEP CH[8].EEP +#define CH8_TEP CH[8].TEP +#define CH9_EEP CH[9].EEP +#define CH9_TEP CH[9].TEP +#define CH10_EEP CH[10].EEP +#define CH10_TEP CH[10].TEP +#define CH11_EEP CH[11].EEP +#define CH11_TEP CH[11].TEP +#define CH12_EEP CH[12].EEP +#define CH12_TEP CH[12].TEP +#define CH13_EEP CH[13].EEP +#define CH13_TEP CH[13].TEP +#define CH14_EEP CH[14].EEP +#define CH14_TEP CH[14].TEP +#define CH15_EEP CH[15].EEP +#define CH15_TEP CH[15].TEP + +/* The registers PPI.CHG0, PPI.CHG1, PPI.CHG2 and PPI.CHG3 were renamed into an array. */ +#define CHG0 CHG[0] +#define CHG1 CHG[1] +#define CHG2 CHG[2] +#define CHG3 CHG[3] + +/* All bitfield macros for the CHGx registers therefore changed name. */ +#define PPI_CHG0_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG0_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG0_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG0_CH15_Included PPI_CHG_CH15_Included + +#define PPI_CHG0_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG0_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG0_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG0_CH14_Included PPI_CHG_CH14_Included + +#define PPI_CHG0_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG0_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG0_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG0_CH13_Included PPI_CHG_CH13_Included + +#define PPI_CHG0_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG0_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG0_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG0_CH12_Included PPI_CHG_CH12_Included + +#define PPI_CHG0_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG0_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG0_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG0_CH11_Included PPI_CHG_CH11_Included + +#define PPI_CHG0_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG0_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG0_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG0_CH10_Included PPI_CHG_CH10_Included + +#define PPI_CHG0_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG0_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG0_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG0_CH9_Included PPI_CHG_CH9_Included + +#define PPI_CHG0_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG0_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG0_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG0_CH8_Included PPI_CHG_CH8_Included + +#define PPI_CHG0_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG0_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG0_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG0_CH7_Included PPI_CHG_CH7_Included + +#define PPI_CHG0_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG0_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG0_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG0_CH6_Included PPI_CHG_CH6_Included + +#define PPI_CHG0_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG0_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG0_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG0_CH5_Included PPI_CHG_CH5_Included + +#define PPI_CHG0_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG0_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG0_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG0_CH4_Included PPI_CHG_CH4_Included + +#define PPI_CHG0_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG0_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG0_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG0_CH3_Included PPI_CHG_CH3_Included + +#define PPI_CHG0_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG0_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG0_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG0_CH2_Included PPI_CHG_CH2_Included + +#define PPI_CHG0_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG0_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG0_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG0_CH1_Included PPI_CHG_CH1_Included + +#define PPI_CHG0_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG0_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG0_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG0_CH0_Included PPI_CHG_CH0_Included + +#define PPI_CHG1_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG1_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG1_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG1_CH15_Included PPI_CHG_CH15_Included + +#define PPI_CHG1_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG1_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG1_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG1_CH14_Included PPI_CHG_CH14_Included + +#define PPI_CHG1_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG1_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG1_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG1_CH13_Included PPI_CHG_CH13_Included + +#define PPI_CHG1_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG1_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG1_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG1_CH12_Included PPI_CHG_CH12_Included + +#define PPI_CHG1_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG1_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG1_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG1_CH11_Included PPI_CHG_CH11_Included + +#define PPI_CHG1_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG1_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG1_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG1_CH10_Included PPI_CHG_CH10_Included + +#define PPI_CHG1_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG1_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG1_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG1_CH9_Included PPI_CHG_CH9_Included + +#define PPI_CHG1_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG1_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG1_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG1_CH8_Included PPI_CHG_CH8_Included + +#define PPI_CHG1_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG1_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG1_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG1_CH7_Included PPI_CHG_CH7_Included + +#define PPI_CHG1_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG1_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG1_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG1_CH6_Included PPI_CHG_CH6_Included + +#define PPI_CHG1_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG1_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG1_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG1_CH5_Included PPI_CHG_CH5_Included + +#define PPI_CHG1_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG1_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG1_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG1_CH4_Included PPI_CHG_CH4_Included + +#define PPI_CHG1_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG1_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG1_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG1_CH3_Included PPI_CHG_CH3_Included + +#define PPI_CHG1_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG1_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG1_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG1_CH2_Included PPI_CHG_CH2_Included + +#define PPI_CHG1_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG1_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG1_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG1_CH1_Included PPI_CHG_CH1_Included + +#define PPI_CHG1_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG1_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG1_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG1_CH0_Included PPI_CHG_CH0_Included + +#define PPI_CHG2_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG2_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG2_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG2_CH15_Included PPI_CHG_CH15_Included + +#define PPI_CHG2_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG2_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG2_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG2_CH14_Included PPI_CHG_CH14_Included + +#define PPI_CHG2_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG2_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG2_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG2_CH13_Included PPI_CHG_CH13_Included + +#define PPI_CHG2_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG2_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG2_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG2_CH12_Included PPI_CHG_CH12_Included + +#define PPI_CHG2_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG2_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG2_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG2_CH11_Included PPI_CHG_CH11_Included + +#define PPI_CHG2_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG2_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG2_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG2_CH10_Included PPI_CHG_CH10_Included + +#define PPI_CHG2_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG2_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG2_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG2_CH9_Included PPI_CHG_CH9_Included + +#define PPI_CHG2_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG2_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG2_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG2_CH8_Included PPI_CHG_CH8_Included + +#define PPI_CHG2_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG2_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG2_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG2_CH7_Included PPI_CHG_CH7_Included + +#define PPI_CHG2_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG2_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG2_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG2_CH6_Included PPI_CHG_CH6_Included + +#define PPI_CHG2_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG2_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG2_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG2_CH5_Included PPI_CHG_CH5_Included + +#define PPI_CHG2_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG2_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG2_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG2_CH4_Included PPI_CHG_CH4_Included + +#define PPI_CHG2_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG2_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG2_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG2_CH3_Included PPI_CHG_CH3_Included + +#define PPI_CHG2_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG2_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG2_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG2_CH2_Included PPI_CHG_CH2_Included + +#define PPI_CHG2_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG2_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG2_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG2_CH1_Included PPI_CHG_CH1_Included + +#define PPI_CHG2_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG2_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG2_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG2_CH0_Included PPI_CHG_CH0_Included + +#define PPI_CHG3_CH15_Pos PPI_CHG_CH15_Pos +#define PPI_CHG3_CH15_Msk PPI_CHG_CH15_Msk +#define PPI_CHG3_CH15_Excluded PPI_CHG_CH15_Excluded +#define PPI_CHG3_CH15_Included PPI_CHG_CH15_Included + +#define PPI_CHG3_CH14_Pos PPI_CHG_CH14_Pos +#define PPI_CHG3_CH14_Msk PPI_CHG_CH14_Msk +#define PPI_CHG3_CH14_Excluded PPI_CHG_CH14_Excluded +#define PPI_CHG3_CH14_Included PPI_CHG_CH14_Included + +#define PPI_CHG3_CH13_Pos PPI_CHG_CH13_Pos +#define PPI_CHG3_CH13_Msk PPI_CHG_CH13_Msk +#define PPI_CHG3_CH13_Excluded PPI_CHG_CH13_Excluded +#define PPI_CHG3_CH13_Included PPI_CHG_CH13_Included + +#define PPI_CHG3_CH12_Pos PPI_CHG_CH12_Pos +#define PPI_CHG3_CH12_Msk PPI_CHG_CH12_Msk +#define PPI_CHG3_CH12_Excluded PPI_CHG_CH12_Excluded +#define PPI_CHG3_CH12_Included PPI_CHG_CH12_Included + +#define PPI_CHG3_CH11_Pos PPI_CHG_CH11_Pos +#define PPI_CHG3_CH11_Msk PPI_CHG_CH11_Msk +#define PPI_CHG3_CH11_Excluded PPI_CHG_CH11_Excluded +#define PPI_CHG3_CH11_Included PPI_CHG_CH11_Included + +#define PPI_CHG3_CH10_Pos PPI_CHG_CH10_Pos +#define PPI_CHG3_CH10_Msk PPI_CHG_CH10_Msk +#define PPI_CHG3_CH10_Excluded PPI_CHG_CH10_Excluded +#define PPI_CHG3_CH10_Included PPI_CHG_CH10_Included + +#define PPI_CHG3_CH9_Pos PPI_CHG_CH9_Pos +#define PPI_CHG3_CH9_Msk PPI_CHG_CH9_Msk +#define PPI_CHG3_CH9_Excluded PPI_CHG_CH9_Excluded +#define PPI_CHG3_CH9_Included PPI_CHG_CH9_Included + +#define PPI_CHG3_CH8_Pos PPI_CHG_CH8_Pos +#define PPI_CHG3_CH8_Msk PPI_CHG_CH8_Msk +#define PPI_CHG3_CH8_Excluded PPI_CHG_CH8_Excluded +#define PPI_CHG3_CH8_Included PPI_CHG_CH8_Included + +#define PPI_CHG3_CH7_Pos PPI_CHG_CH7_Pos +#define PPI_CHG3_CH7_Msk PPI_CHG_CH7_Msk +#define PPI_CHG3_CH7_Excluded PPI_CHG_CH7_Excluded +#define PPI_CHG3_CH7_Included PPI_CHG_CH7_Included + +#define PPI_CHG3_CH6_Pos PPI_CHG_CH6_Pos +#define PPI_CHG3_CH6_Msk PPI_CHG_CH6_Msk +#define PPI_CHG3_CH6_Excluded PPI_CHG_CH6_Excluded +#define PPI_CHG3_CH6_Included PPI_CHG_CH6_Included + +#define PPI_CHG3_CH5_Pos PPI_CHG_CH5_Pos +#define PPI_CHG3_CH5_Msk PPI_CHG_CH5_Msk +#define PPI_CHG3_CH5_Excluded PPI_CHG_CH5_Excluded +#define PPI_CHG3_CH5_Included PPI_CHG_CH5_Included + +#define PPI_CHG3_CH4_Pos PPI_CHG_CH4_Pos +#define PPI_CHG3_CH4_Msk PPI_CHG_CH4_Msk +#define PPI_CHG3_CH4_Excluded PPI_CHG_CH4_Excluded +#define PPI_CHG3_CH4_Included PPI_CHG_CH4_Included + +#define PPI_CHG3_CH3_Pos PPI_CHG_CH3_Pos +#define PPI_CHG3_CH3_Msk PPI_CHG_CH3_Msk +#define PPI_CHG3_CH3_Excluded PPI_CHG_CH3_Excluded +#define PPI_CHG3_CH3_Included PPI_CHG_CH3_Included + +#define PPI_CHG3_CH2_Pos PPI_CHG_CH2_Pos +#define PPI_CHG3_CH2_Msk PPI_CHG_CH2_Msk +#define PPI_CHG3_CH2_Excluded PPI_CHG_CH2_Excluded +#define PPI_CHG3_CH2_Included PPI_CHG_CH2_Included + +#define PPI_CHG3_CH1_Pos PPI_CHG_CH1_Pos +#define PPI_CHG3_CH1_Msk PPI_CHG_CH1_Msk +#define PPI_CHG3_CH1_Excluded PPI_CHG_CH1_Excluded +#define PPI_CHG3_CH1_Included PPI_CHG_CH1_Included + +#define PPI_CHG3_CH0_Pos PPI_CHG_CH0_Pos +#define PPI_CHG3_CH0_Msk PPI_CHG_CH0_Msk +#define PPI_CHG3_CH0_Excluded PPI_CHG_CH0_Excluded +#define PPI_CHG3_CH0_Included PPI_CHG_CH0_Included + + + + +/*lint --flb "Leave library region" */ + +#endif /* NRF51_TO_NRF52840_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52.h index bf7c165a0e..8e0ff0c0b5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52.h @@ -6,12 +6,12 @@ * nrf52 from Nordic Semiconductor. * * @version V1 - * @date 23. February 2016 + * @date 18. November 2016 * * @note Generated with SVDConv V2.81d * from CMSIS SVD File 'nrf52.svd' Version 1, * - * @par Copyright (c) 2015, Nordic Semiconductor ASA + * @par Copyright (c) 2016, Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -212,25 +212,6 @@ typedef struct { __I uint32_t RESERVED0; } POWER_RAM_Type; -typedef struct { - __IO uint32_t CPU0; /*!< AHB bus master priority register for CPU0 */ - __IO uint32_t SPIS1; /*!< AHB bus master priority register for SPIM1, SPIS1, TWIM1 and - TWIS1 */ - __IO uint32_t RADIO; /*!< AHB bus master priority register for RADIO */ - __IO uint32_t ECB; /*!< AHB bus master priority register for ECB */ - __IO uint32_t CCM; /*!< AHB bus master priority register for CCM */ - __IO uint32_t AAR; /*!< AHB bus master priority register for AAR */ - __IO uint32_t SAADC; /*!< AHB bus master priority register for SAADC */ - __IO uint32_t UARTE; /*!< AHB bus master priority register for UARTE */ - __IO uint32_t SERIAL0; /*!< AHB bus master priority register for SPIM0, SPIS0, TWIM0 and - TWIS0 */ - __IO uint32_t SERIAL2; /*!< AHB bus master priority register for SPIM2 and SPIS2 */ - __IO uint32_t NFCT; /*!< AHB bus master priority register for NFCT */ - __IO uint32_t I2S; /*!< AHB bus master priority register for I2S */ - __IO uint32_t PDM; /*!< AHB bus master priority register for PDM */ - __IO uint32_t PWM; /*!< AHB bus master priority register for PWM0, PWM1 and PWM2 */ -} AMLI_RAMPRI_Type; - typedef struct { __IO uint32_t RTS; /*!< Pin select for RTS signal */ __IO uint32_t TXD; /*!< Pin select for TXD signal */ @@ -371,12 +352,12 @@ typedef struct { } QDEC_PSEL_Type; typedef struct { - __IO uint32_t PTR; /*!< Description cluster[0]: Beginning address in Data RAM of sequence - A */ - __IO uint32_t CNT; /*!< Description cluster[0]: Amount of values (duty cycles) in sequence - A */ + __IO uint32_t PTR; /*!< Description cluster[0]: Beginning address in Data RAM of this + sequence */ + __IO uint32_t CNT; /*!< Description cluster[0]: Amount of values (duty cycles) in this + sequence */ __IO uint32_t REFRESH; /*!< Description cluster[0]: Amount of additional PWM periods between - samples loaded to compare register (load every CNT+1 PWM periods) */ + samples loaded into compare register */ __IO uint32_t ENDDELAY; /*!< Description cluster[0]: Time added after the sequence */ __I uint32_t RESERVED1[4]; } PWM_SEQ_Type; @@ -633,28 +614,12 @@ typedef struct { /*!< CLOCK Structure __I uint32_t RESERVED5[62]; __IO uint32_t LFCLKSRC; /*!< Clock source for the LFCLK */ __I uint32_t RESERVED6[7]; - __IO uint32_t CTIV; /*!< Calibration timer interval (retained register, same reset behaviour - as RESETREAS) */ + __IO uint32_t CTIV; /*!< Calibration timer interval */ __I uint32_t RESERVED7[8]; __IO uint32_t TRACECONFIG; /*!< Clocking options for the Trace Port debug interface */ } NRF_CLOCK_Type; -/* ================================================================================ */ -/* ================ AMLI ================ */ -/* ================================================================================ */ - - -/** - * @brief AHB Multi-Layer Interface (AMLI) - */ - -typedef struct { /*!< AMLI Structure */ - __I uint32_t RESERVED0[896]; - AMLI_RAMPRI_Type RAMPRI; /*!< RAM configurable priority configuration structure */ -} NRF_AMLI_Type; - - /* ================================================================================ */ /* ================ RADIO ================ */ /* ================================================================================ */ @@ -754,9 +719,12 @@ typedef struct { /*!< UARTE Structure __I uint32_t RESERVED1[52]; __IO uint32_t EVENTS_CTS; /*!< CTS is activated (set low). Clear To Send. */ __IO uint32_t EVENTS_NCTS; /*!< CTS is deactivated (set high). Not Clear To Send. */ - __I uint32_t RESERVED2[2]; + __IO uint32_t EVENTS_RXDRDY; /*!< Data received in RXD (but potentially not yet transferred to + Data RAM) */ + __I uint32_t RESERVED2; __IO uint32_t EVENTS_ENDRX; /*!< Receive buffer is filled up */ - __I uint32_t RESERVED3[3]; + __I uint32_t RESERVED3[2]; + __IO uint32_t EVENTS_TXDRDY; /*!< Data sent from TXD */ __IO uint32_t EVENTS_ENDTX; /*!< Last TX byte transmitted */ __IO uint32_t EVENTS_ERROR; /*!< Error detected */ __I uint32_t RESERVED4[7]; @@ -779,7 +747,7 @@ typedef struct { /*!< UARTE Structure __I uint32_t RESERVED11; UARTE_PSEL_Type PSEL; /*!< Unspecified */ __I uint32_t RESERVED12[3]; - __IO uint32_t BAUDRATE; /*!< Baud rate */ + __IO uint32_t BAUDRATE; /*!< Baud rate. Accuracy depends on the HFCLK source selected. */ __I uint32_t RESERVED13[3]; UARTE_RXD_Type RXD; /*!< RXD EasyDMA channel */ __I uint32_t RESERVED14; @@ -1977,7 +1945,6 @@ typedef struct { /*!< GPIO Structure #define NRF_BPROT_BASE 0x40000000UL #define NRF_POWER_BASE 0x40000000UL #define NRF_CLOCK_BASE 0x40000000UL -#define NRF_AMLI_BASE 0x40000000UL #define NRF_RADIO_BASE 0x40001000UL #define NRF_UARTE0_BASE 0x40002000UL #define NRF_UART0_BASE 0x40002000UL @@ -2049,7 +2016,6 @@ typedef struct { /*!< GPIO Structure #define NRF_BPROT ((NRF_BPROT_Type *) NRF_BPROT_BASE) #define NRF_POWER ((NRF_POWER_Type *) NRF_POWER_BASE) #define NRF_CLOCK ((NRF_CLOCK_Type *) NRF_CLOCK_BASE) -#define NRF_AMLI ((NRF_AMLI_Type *) NRF_AMLI_BASE) #define NRF_RADIO ((NRF_RADIO_Type *) NRF_RADIO_BASE) #define NRF_UARTE0 ((NRF_UARTE_Type *) NRF_UARTE0_BASE) #define NRF_UART0 ((NRF_UART_Type *) NRF_UART0_BASE) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52832_peripherals.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52832_peripherals.h new file mode 100644 index 0000000000..b99f3fe3b9 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52832_peripherals.h @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _NRF52832_PERIPHERALS_H +#define _NRF52832_PERIPHERALS_H + + +/* Floating Point Unit */ +#define FPU_PRESENT +#define FPU_COUNT 1 + +/* Systick timer */ +#define SYSTICK_PRESENT +#define SYSTICK_COUNT 1 + +/* Software Interrupts */ +#define SWI_PRESENT +#define SWI_COUNT 6 + +/* Memory Watch Unit */ +#define MWU_PRESENT +#define MWU_COUNT 1 + +/* GPIO */ +#define GPIO_PRESENT +#define GPIO_COUNT 1 + +#define P0_PIN_NUM 32 + +/* MPU and BPROT */ +#define BPROT_PRESENT + +#define BPROT_REGIONS_SIZE 4096 +#define BPROT_REGIONS_NUM 128 + +/* Radio */ +#define RADIO_PRESENT +#define RADIO_COUNT 1 + +/* Accelerated Address Resolver */ +#define AAR_PRESENT +#define AAR_COUNT 1 + +#define AAR_MAX_IRK_NUM 16 + +/* AES Electronic CodeBook mode encryption */ +#define ECB_PRESENT +#define ECB_COUNT 1 + +/* AES CCM mode encryption */ +#define CCM_PRESENT +#define CCM_COUNT 1 + +/* NFC Tag */ +#define NFCT_PRESENT +#define NFCT_COUNT 1 + +/* Peripheral to Peripheral Interconnect */ +#define PPI_PRESENT +#define PPI_COUNT 1 + +#define PPI_CH_NUM 20 +#define PPI_GROUP_NUM 6 +#define PPI_FEATURE_FORKS_PRESENT + +/* Event Generator Unit */ +#define EGU_PRESENT +#define EGU_COUNT 6 + +#define EGU0_CH_NUM 16 +#define EGU1_CH_NUM 16 +#define EGU2_CH_NUM 16 +#define EGU3_CH_NUM 16 +#define EGU4_CH_NUM 16 +#define EGU5_CH_NUM 16 + +/* Timer/Counter */ +#define TIMER_PRESENT +#define TIMER_COUNT 5 + +#define TIMER0_MAX_SIZE 32 +#define TIMER1_MAX_SIZE 32 +#define TIMER2_MAX_SIZE 32 +#define TIMER3_MAX_SIZE 32 +#define TIMER4_MAX_SIZE 32 + +#define TIMER0_CC_NUM 4 +#define TIMER1_CC_NUM 4 +#define TIMER2_CC_NUM 4 +#define TIMER3_CC_NUM 6 +#define TIMER4_CC_NUM 6 + +/* Real Time Counter */ +#define RTC_PRESENT +#define RTC_COUNT 3 + +#define RTC0_CC_NUM 3 +#define RTC1_CC_NUM 4 +#define RTC2_CC_NUM 4 + +/* RNG */ +#define RNG_PRESENT +#define RNG_COUNT 1 + +/* Watchdog Timer */ +#define WDT_PRESENT +#define WDT_COUNT 1 + +/* Temperature Sensor */ +#define TEMP_PRESENT +#define TEMP_COUNT 1 + +/* Serial Peripheral Interface Master */ +#define SPI_PRESENT +#define SPI_COUNT 3 + +/* Serial Peripheral Interface Master with DMA */ +#define SPIM_PRESENT +#define SPIM_COUNT 3 + +/* Serial Peripheral Interface Slave with DMA*/ +#define SPIS_PRESENT +#define SPIS_COUNT 3 + +/* Two Wire Interface Master */ +#define TWI_PRESENT +#define TWI_COUNT 2 + +/* Two Wire Interface Master with DMA */ +#define TWIM_PRESENT +#define TWIM_COUNT 2 + +/* Two Wire Interface Slave with DMA */ +#define TWIS_PRESENT +#define TWIS_COUNT 2 + +/* Universal Asynchronous Receiver-Transmitter */ +#define UART_PRESENT +#define UART_COUNT 1 + +/* Universal Asynchronous Receiver-Transmitter with DMA */ +#define UARTE_PRESENT +#define UARTE_COUNT 1 + +/* Quadrature Decoder */ +#define QDEC_PRESENT +#define QDEC_COUNT 1 + +/* Successive Approximation Analog to Digital Converter */ +#define SAADC_PRESENT +#define SAADC_COUNT 1 + +/* GPIO Tasks and Events */ +#define GPIOTE_PRESENT +#define GPIOTE_COUNT 1 + +#define GPIOTE_CH_NUM 8 + +#define GPIOTE_FEATURE_SET_PRESENT +#define GPIOTE_FEATURE_CLR_PRESENT + +/* Low Power Comparator */ +#define LPCOMP_PRESENT +#define LPCOMP_COUNT 1 + +#define LPCOMP_REFSEL_RESOLUTION 16 + +#define LPCOMP_FEATURE_HYST_PRESENT + +/* Comparator */ +#define COMP_PRESENT +#define COMP_COUNT 1 + +/* Pulse Width Modulator */ +#define PWM_PRESENT +#define PWM_COUNT 3 + +#define PWM0_CH_NUM 4 +#define PWM1_CH_NUM 4 +#define PWM2_CH_NUM 4 + +/* Pulse Density Modulator */ +#define PDM_PRESENT +#define PDM_COUNT 1 + +/* Inter-IC Sound Interface */ +#define I2S_PRESENT +#define I2S_COUNT 1 + + +#endif // _NRF52832_PERIPHERALS_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840.h new file mode 100644 index 0000000000..92a40f4c08 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840.h @@ -0,0 +1,2417 @@ + +/****************************************************************************************************//** + * @file nrf52840.h + * + * @brief CMSIS Cortex-M4 Peripheral Access Layer Header File for + * nrf52840 from Nordic Semiconductor. + * + * @version V1 + * @date 18. November 2016 + * + * @note Generated with SVDConv V2.81d + * from CMSIS SVD File 'nrf52840.svd' Version 1, + * + * @par Copyright (c) 2016, Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + *******************************************************************************************************/ + + + +/** @addtogroup Nordic Semiconductor + * @{ + */ + +/** @addtogroup nrf52840 + * @{ + */ + +#ifndef NRF52840_H +#define NRF52840_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ------------------------- Interrupt Number Definition ------------------------ */ + +typedef enum { +/* ------------------- Cortex-M4 Processor Exceptions Numbers ------------------- */ + Reset_IRQn = -15, /*!< 1 Reset Vector, invoked on Power up and warm reset */ + NonMaskableInt_IRQn = -14, /*!< 2 Non maskable Interrupt, cannot be stopped or preempted */ + HardFault_IRQn = -13, /*!< 3 Hard Fault, all classes of Fault */ + MemoryManagement_IRQn = -12, /*!< 4 Memory Management, MPU mismatch, including Access Violation + and No Match */ + BusFault_IRQn = -11, /*!< 5 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory + related Fault */ + UsageFault_IRQn = -10, /*!< 6 Usage Fault, i.e. Undef Instruction, Illegal State Transition */ + SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */ + DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor */ + PendSV_IRQn = -2, /*!< 14 Pendable request for system service */ + SysTick_IRQn = -1, /*!< 15 System Tick Timer */ +/* --------------------- nrf52840 Specific Interrupt Numbers -------------------- */ + POWER_CLOCK_IRQn = 0, /*!< 0 POWER_CLOCK */ + RADIO_IRQn = 1, /*!< 1 RADIO */ + UARTE0_UART0_IRQn = 2, /*!< 2 UARTE0_UART0 */ + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn= 3, /*!< 3 SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 */ + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn= 4, /*!< 4 SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 */ + NFCT_IRQn = 5, /*!< 5 NFCT */ + GPIOTE_IRQn = 6, /*!< 6 GPIOTE */ + SAADC_IRQn = 7, /*!< 7 SAADC */ + TIMER0_IRQn = 8, /*!< 8 TIMER0 */ + TIMER1_IRQn = 9, /*!< 9 TIMER1 */ + TIMER2_IRQn = 10, /*!< 10 TIMER2 */ + RTC0_IRQn = 11, /*!< 11 RTC0 */ + TEMP_IRQn = 12, /*!< 12 TEMP */ + RNG_IRQn = 13, /*!< 13 RNG */ + ECB_IRQn = 14, /*!< 14 ECB */ + CCM_AAR_IRQn = 15, /*!< 15 CCM_AAR */ + WDT_IRQn = 16, /*!< 16 WDT */ + RTC1_IRQn = 17, /*!< 17 RTC1 */ + QDEC_IRQn = 18, /*!< 18 QDEC */ + COMP_LPCOMP_IRQn = 19, /*!< 19 COMP_LPCOMP */ + SWI0_EGU0_IRQn = 20, /*!< 20 SWI0_EGU0 */ + SWI1_EGU1_IRQn = 21, /*!< 21 SWI1_EGU1 */ + SWI2_EGU2_IRQn = 22, /*!< 22 SWI2_EGU2 */ + SWI3_EGU3_IRQn = 23, /*!< 23 SWI3_EGU3 */ + SWI4_EGU4_IRQn = 24, /*!< 24 SWI4_EGU4 */ + SWI5_EGU5_IRQn = 25, /*!< 25 SWI5_EGU5 */ + TIMER3_IRQn = 26, /*!< 26 TIMER3 */ + TIMER4_IRQn = 27, /*!< 27 TIMER4 */ + PWM0_IRQn = 28, /*!< 28 PWM0 */ + PDM_IRQn = 29, /*!< 29 PDM */ + MWU_IRQn = 32, /*!< 32 MWU */ + PWM1_IRQn = 33, /*!< 33 PWM1 */ + PWM2_IRQn = 34, /*!< 34 PWM2 */ + SPIM2_SPIS2_SPI2_IRQn = 35, /*!< 35 SPIM2_SPIS2_SPI2 */ + RTC2_IRQn = 36, /*!< 36 RTC2 */ + I2S_IRQn = 37, /*!< 37 I2S */ + FPU_IRQn = 38, /*!< 38 FPU */ + USBD_IRQn = 39, /*!< 39 USBD */ + UARTE1_IRQn = 40, /*!< 40 UARTE1 */ + QSPI_IRQn = 41, /*!< 41 QSPI */ + CRYPTOCELL_IRQn = 42, /*!< 42 CRYPTOCELL */ + SPIM3_IRQn = 43, /*!< 43 SPIM3 */ + PWM3_IRQn = 45 /*!< 45 PWM3 */ +} IRQn_Type; + + +/** @addtogroup Configuration_of_CMSIS + * @{ + */ + + +/* ================================================================================ */ +/* ================ Processor and Core Peripheral Section ================ */ +/* ================================================================================ */ + +/* ----------------Configuration of the Cortex-M4 Processor and Core Peripherals---------------- */ +#define __CM4_REV 0x0001 /*!< Cortex-M4 Core Revision */ +#define __MPU_PRESENT 1 /*!< MPU present or not */ +#define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */ +#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ +#define __FPU_PRESENT 1 /*!< FPU present or not */ +/** @} */ /* End of group Configuration_of_CMSIS */ + +#include "core_cm4.h" /*!< Cortex-M4 processor and core peripherals */ +#include "system_nrf52840.h" /*!< nrf52840 System */ + + +/* ================================================================================ */ +/* ================ Device Specific Peripheral Section ================ */ +/* ================================================================================ */ + + +/** @addtogroup Device_Peripheral_Registers + * @{ + */ + + +/* ------------------- Start of section using anonymous unions ------------------ */ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#elif defined(__TMS470__) +/* anonymous unions are enabled by default */ +#elif defined(__TASKING__) + #pragma warning 586 +#else + #warning Not supported compiler type +#endif + + +typedef struct { + __I uint32_t PART; /*!< Part code */ + __I uint32_t VARIANT; /*!< Part variant (hardware version and production configuration). */ + __I uint32_t PACKAGE; /*!< Package option */ + __I uint32_t RAM; /*!< RAM variant */ + __I uint32_t FLASH; /*!< Flash variant */ + __IO uint32_t UNUSED0[3]; /*!< Description collection[0]: Unspecified */ +} FICR_INFO_Type; + +typedef struct { + __I uint32_t A0; /*!< Slope definition A0. */ + __I uint32_t A1; /*!< Slope definition A1. */ + __I uint32_t A2; /*!< Slope definition A2. */ + __I uint32_t A3; /*!< Slope definition A3. */ + __I uint32_t A4; /*!< Slope definition A4. */ + __I uint32_t A5; /*!< Slope definition A5. */ + __I uint32_t B0; /*!< y-intercept B0. */ + __I uint32_t B1; /*!< y-intercept B1. */ + __I uint32_t B2; /*!< y-intercept B2. */ + __I uint32_t B3; /*!< y-intercept B3. */ + __I uint32_t B4; /*!< y-intercept B4. */ + __I uint32_t B5; /*!< y-intercept B5. */ + __I uint32_t T0; /*!< Segment end T0. */ + __I uint32_t T1; /*!< Segment end T1. */ + __I uint32_t T2; /*!< Segment end T2. */ + __I uint32_t T3; /*!< Segment end T3. */ + __I uint32_t T4; /*!< Segment end T4. */ +} FICR_TEMP_Type; + +typedef struct { + __I uint32_t TAGHEADER0; /*!< Default header for NFC Tag. Software can read these values to + populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + __I uint32_t TAGHEADER1; /*!< Default header for NFC Tag. Software can read these values to + populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + __I uint32_t TAGHEADER2; /*!< Default header for NFC Tag. Software can read these values to + populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + __I uint32_t TAGHEADER3; /*!< Default header for NFC Tag. Software can read these values to + populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ +} FICR_NFC_Type; + +typedef struct { + __IO uint32_t POWER; /*!< Description cluster[0]: RAM0 power control register */ + __O uint32_t POWERSET; /*!< Description cluster[0]: RAM0 power control set register */ + __O uint32_t POWERCLR; /*!< Description cluster[0]: RAM0 power control clear register */ + __I uint32_t RESERVED0; +} POWER_RAM_Type; + +typedef struct { + __IO uint32_t RTS; /*!< Pin select for RTS signal */ + __IO uint32_t TXD; /*!< Pin select for TXD signal */ + __IO uint32_t CTS; /*!< Pin select for CTS signal */ + __IO uint32_t RXD; /*!< Pin select for RXD signal */ +} UARTE_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in receive buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ +} UARTE_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in transmit buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ +} UARTE_TXD_Type; + +typedef struct { + __IO uint32_t RTS; /*!< Pin select for RTS */ + __IO uint32_t TXD; /*!< Pin select for TXD */ + __IO uint32_t CTS; /*!< Pin select for CTS */ + __IO uint32_t RXD; /*!< Pin select for RXD */ +} UART_PSEL_Type; + +typedef struct { + __IO uint32_t SCK; /*!< Pin select for SCK */ + __IO uint32_t MOSI; /*!< Pin select for MOSI signal */ + __IO uint32_t MISO; /*!< Pin select for MISO signal */ + __IO uint32_t CSN; /*!< Pin select for CSN */ +} SPIM_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in receive buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ + __IO uint32_t LIST; /*!< EasyDMA list type */ +} SPIM_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Number of bytes in transmit buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ + __IO uint32_t LIST; /*!< EasyDMA list type */ +} SPIM_TXD_Type; + +typedef struct { + __IO uint32_t RXDELAY; /*!< Sample delay for input serial data on MISO */ + __IO uint32_t CSNDUR; /*!< Minimum duration between edge of CSN and edge of SCK and minimum + duration CSN must stay high between transactions */ +} SPIM_IFTIMING_Type; + +typedef struct { + __IO uint32_t SCK; /*!< Pin select for SCK */ + __IO uint32_t MISO; /*!< Pin select for MISO signal */ + __IO uint32_t MOSI; /*!< Pin select for MOSI signal */ + __IO uint32_t CSN; /*!< Pin select for CSN signal */ +} SPIS_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< RXD data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in receive buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes received in last granted transaction */ +} SPIS_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< TXD data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in transmit buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transmitted in last granted transaction */ +} SPIS_TXD_Type; + +typedef struct { + __IO uint32_t SCL; /*!< Pin select for SCL signal */ + __IO uint32_t SDA; /*!< Pin select for SDA signal */ +} TWIM_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in receive buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ + __IO uint32_t LIST; /*!< EasyDMA list type */ +} TWIM_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in transmit buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ + __IO uint32_t LIST; /*!< EasyDMA list type */ +} TWIM_TXD_Type; + +typedef struct { + __IO uint32_t SCL; /*!< Pin select for SCL signal */ + __IO uint32_t SDA; /*!< Pin select for SDA signal */ +} TWIS_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< RXD Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in RXD buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last RXD transaction */ +} TWIS_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< TXD Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes in TXD buffer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last TXD transaction */ +} TWIS_TXD_Type; + +typedef struct { + __IO uint32_t SCK; /*!< Pin select for SCK */ + __IO uint32_t MOSI; /*!< Pin select for MOSI signal */ + __IO uint32_t MISO; /*!< Pin select for MISO signal */ +} SPI_PSEL_Type; + +typedef struct { + __IO uint32_t SCL; /*!< Pin select for SCL */ + __IO uint32_t SDA; /*!< Pin select for SDA */ +} TWI_PSEL_Type; + +typedef struct { + __IO uint32_t RX; /*!< Result of last incoming frame */ +} NFCT_FRAMESTATUS_Type; + +typedef struct { + __IO uint32_t FRAMECONFIG; /*!< Configuration of outgoing frames */ + __IO uint32_t AMOUNT; /*!< Size of outgoing frame */ +} NFCT_TXD_Type; + +typedef struct { + __IO uint32_t FRAMECONFIG; /*!< Configuration of incoming frames */ + __I uint32_t AMOUNT; /*!< Size of last incoming frame */ +} NFCT_RXD_Type; + +typedef struct { + __IO uint32_t LIMITH; /*!< Description cluster[0]: Last results is equal or above CH[0].LIMIT.HIGH */ + __IO uint32_t LIMITL; /*!< Description cluster[0]: Last results is equal or below CH[0].LIMIT.LOW */ +} SAADC_EVENTS_CH_Type; + +typedef struct { + __IO uint32_t PSELP; /*!< Description cluster[0]: Input positive pin selection for CH[0] */ + __IO uint32_t PSELN; /*!< Description cluster[0]: Input negative pin selection for CH[0] */ + __IO uint32_t CONFIG; /*!< Description cluster[0]: Input configuration for CH[0] */ + __IO uint32_t LIMIT; /*!< Description cluster[0]: High/low limits for event monitoring + a channel */ +} SAADC_CH_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of buffer words to transfer */ + __I uint32_t AMOUNT; /*!< Number of buffer words transferred since last START */ +} SAADC_RESULT_Type; + +typedef struct { + __IO uint32_t LED; /*!< Pin select for LED signal */ + __IO uint32_t A; /*!< Pin select for A signal */ + __IO uint32_t B; /*!< Pin select for B signal */ +} QDEC_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Description cluster[0]: Beginning address in Data RAM of sequence + A */ + __IO uint32_t CNT; /*!< Description cluster[0]: Amount of values (duty cycles) in sequence + A */ + __IO uint32_t REFRESH; /*!< Description cluster[0]: Amount of additional PWM periods between + samples loaded to compare register (load every CNT+1 PWM periods) */ + __IO uint32_t ENDDELAY; /*!< Description cluster[0]: Time added after the sequence */ + __I uint32_t RESERVED1[4]; +} PWM_SEQ_Type; + +typedef struct { + __IO uint32_t OUT[4]; /*!< Description collection[0]: Output pin select for PWM channel + 0 */ +} PWM_PSEL_Type; + +typedef struct { + __IO uint32_t CLK; /*!< Pin number configuration for PDM CLK signal */ + __IO uint32_t DIN; /*!< Pin number configuration for PDM DIN signal */ +} PDM_PSEL_Type; + +typedef struct { + __IO uint32_t PTR; /*!< RAM address pointer to write samples to with EasyDMA */ + __IO uint32_t MAXCNT; /*!< Number of samples to allocate memory for in EasyDMA mode */ +} PDM_SAMPLE_Type; + +typedef struct { + __IO uint32_t ADDR; /*!< Description cluster[0]: Configure the word-aligned start address + of region 0 to protect */ + __IO uint32_t SIZE; /*!< Description cluster[0]: Size of region to protect counting from + address ACL[0].ADDR. Write '0' as no effect. */ + __IO uint32_t PERM; /*!< Description cluster[0]: Access permissions for region 0 as defined + by start address ACL[0].ADDR and size ACL[0].SIZE */ + __IO uint32_t UNUSED0; /*!< Unspecified */ +} ACL_ACL_Type; + +typedef struct { + __O uint32_t EN; /*!< Description cluster[0]: Enable channel group 0 */ + __O uint32_t DIS; /*!< Description cluster[0]: Disable channel group 0 */ +} PPI_TASKS_CHG_Type; + +typedef struct { + __IO uint32_t EEP; /*!< Description cluster[0]: Channel 0 event end-point */ + __IO uint32_t TEP; /*!< Description cluster[0]: Channel 0 task end-point */ +} PPI_CH_Type; + +typedef struct { + __IO uint32_t TEP; /*!< Description cluster[0]: Channel 0 task end-point */ +} PPI_FORK_Type; + +typedef struct { + __IO uint32_t WA; /*!< Description cluster[0]: Write access to region 0 detected */ + __IO uint32_t RA; /*!< Description cluster[0]: Read access to region 0 detected */ +} MWU_EVENTS_REGION_Type; + +typedef struct { + __IO uint32_t WA; /*!< Description cluster[0]: Write access to peripheral region 0 + detected */ + __IO uint32_t RA; /*!< Description cluster[0]: Read access to peripheral region 0 detected */ +} MWU_EVENTS_PREGION_Type; + +typedef struct { + __IO uint32_t SUBSTATWA; /*!< Description cluster[0]: Source of event/interrupt in region + 0, write access detected while corresponding subregion was enabled + for watching */ + __IO uint32_t SUBSTATRA; /*!< Description cluster[0]: Source of event/interrupt in region + 0, read access detected while corresponding subregion was enabled + for watching */ +} MWU_PERREGION_Type; + +typedef struct { + __IO uint32_t START; /*!< Description cluster[0]: Start address for region 0 */ + __IO uint32_t END; /*!< Description cluster[0]: End address of region 0 */ + __I uint32_t RESERVED2[2]; +} MWU_REGION_Type; + +typedef struct { + __I uint32_t START; /*!< Description cluster[0]: Reserved for future use */ + __I uint32_t END; /*!< Description cluster[0]: Reserved for future use */ + __IO uint32_t SUBS; /*!< Description cluster[0]: Subregions of region 0 */ + __I uint32_t RESERVED3; +} MWU_PREGION_Type; + +typedef struct { + __IO uint32_t MODE; /*!< I2S mode. */ + __IO uint32_t RXEN; /*!< Reception (RX) enable. */ + __IO uint32_t TXEN; /*!< Transmission (TX) enable. */ + __IO uint32_t MCKEN; /*!< Master clock generator enable. */ + __IO uint32_t MCKFREQ; /*!< Master clock generator frequency. */ + __IO uint32_t RATIO; /*!< MCK / LRCK ratio. */ + __IO uint32_t SWIDTH; /*!< Sample width. */ + __IO uint32_t ALIGN; /*!< Alignment of sample within a frame. */ + __IO uint32_t FORMAT; /*!< Frame format. */ + __IO uint32_t CHANNELS; /*!< Enable channels. */ +} I2S_CONFIG_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Receive buffer RAM start address. */ +} I2S_RXD_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Transmit buffer RAM start address. */ +} I2S_TXD_Type; + +typedef struct { + __IO uint32_t MAXCNT; /*!< Size of RXD and TXD buffers. */ +} I2S_RXTXD_Type; + +typedef struct { + __IO uint32_t MCK; /*!< Pin select for MCK signal. */ + __IO uint32_t SCK; /*!< Pin select for SCK signal. */ + __IO uint32_t LRCK; /*!< Pin select for LRCK signal. */ + __IO uint32_t SDIN; /*!< Pin select for SDIN signal. */ + __IO uint32_t SDOUT; /*!< Pin select for SDOUT signal. */ +} I2S_PSEL_Type; + +typedef struct { + __I uint32_t EPIN[8]; /*!< Description collection[0]: IN endpoint halted status. Can be + used as is as response to a GetStatus() request to endpoint. */ + __I uint32_t RESERVED4; + __I uint32_t EPOUT[8]; /*!< Description collection[0]: OUT endpoint halted status. Can be + used as is as response to a GetStatus() request to endpoint. */ +} USBD_HALTED_Type; + +typedef struct { + __IO uint32_t EPOUT[8]; /*!< Description collection[0]: Amount of bytes received last in + the data stage of this OUT endpoint */ + __IO uint32_t ISOOUT; /*!< Amount of bytes received last on this iso OUT data endpoint */ +} USBD_SIZE_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Description cluster[0]: Data pointer */ + __IO uint32_t MAXCNT; /*!< Description cluster[0]: Maximum number of bytes to transfer */ + __I uint32_t AMOUNT; /*!< Description cluster[0]: Number of bytes transferred in the last + transaction */ + __I uint32_t RESERVED5[2]; +} USBD_EPIN_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes to transfer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ +} USBD_ISOIN_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Description cluster[0]: Data pointer */ + __IO uint32_t MAXCNT; /*!< Description cluster[0]: Maximum number of bytes to transfer */ + __I uint32_t AMOUNT; /*!< Description cluster[0]: Number of bytes transferred in the last + transaction */ + __I uint32_t RESERVED6[2]; +} USBD_EPOUT_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Data pointer */ + __IO uint32_t MAXCNT; /*!< Maximum number of bytes to transfer */ + __I uint32_t AMOUNT; /*!< Number of bytes transferred in the last transaction */ +} USBD_ISOOUT_Type; + +typedef struct { + __IO uint32_t SRC; /*!< Flash memory source address */ + __IO uint32_t DST; /*!< RAM destination address */ + __IO uint32_t CNT; /*!< Read transfer length */ +} QSPI_READ_Type; + +typedef struct { + __IO uint32_t DST; /*!< Flash destination address */ + __IO uint32_t SRC; /*!< RAM source address */ + __IO uint32_t CNT; /*!< Write transfer length */ +} QSPI_WRITE_Type; + +typedef struct { + __IO uint32_t PTR; /*!< Start address of flash block to be erased */ + __IO uint32_t LEN; /*!< Size of block to be erased. */ +} QSPI_ERASE_Type; + +typedef struct { + __IO uint32_t SCK; /*!< Pin select for serial clock SCK */ + __IO uint32_t CSN; /*!< Pin select for chip select signal CSN. */ + __I uint32_t RESERVED7; + __IO uint32_t IO0; /*!< Pin select for serial data MOSI/IO0. */ + __IO uint32_t IO1; /*!< Pin select for serial data MISO/IO1. */ + __IO uint32_t IO2; /*!< Pin select for serial data IO2. */ + __IO uint32_t IO3; /*!< Pin select for serial data IO3. */ +} QSPI_PSEL_Type; + + +/* ================================================================================ */ +/* ================ FICR ================ */ +/* ================================================================================ */ + + +/** + * @brief Factory Information Configuration Registers (FICR) + */ + +typedef struct { /*!< FICR Structure */ + __I uint32_t RESERVED0[4]; + __I uint32_t CODEPAGESIZE; /*!< Code memory page size */ + __I uint32_t CODESIZE; /*!< Code memory size */ + __I uint32_t RESERVED1[18]; + __I uint32_t DEVICEID[2]; /*!< Description collection[0]: Device identifier */ + __I uint32_t RESERVED2[6]; + __I uint32_t ER[4]; /*!< Description collection[0]: Encryption root, word 0 */ + __I uint32_t IR[4]; /*!< Description collection[0]: Identity Root, word 0 */ + __I uint32_t DEVICEADDRTYPE; /*!< Device address type */ + __I uint32_t DEVICEADDR[2]; /*!< Description collection[0]: Device address 0 */ + __I uint32_t RESERVED3[21]; + FICR_INFO_Type INFO; /*!< Device info */ + __I uint32_t RESERVED4[185]; + FICR_TEMP_Type TEMP; /*!< Registers storing factory TEMP module linearization coefficients */ + __I uint32_t RESERVED5[2]; + FICR_NFC_Type NFC; /*!< Unspecified */ +} NRF_FICR_Type; + + +/* ================================================================================ */ +/* ================ UICR ================ */ +/* ================================================================================ */ + + +/** + * @brief User Information Configuration Registers (UICR) + */ + +typedef struct { /*!< UICR Structure */ + __IO uint32_t UNUSED0; /*!< Unspecified */ + __IO uint32_t UNUSED1; /*!< Unspecified */ + __IO uint32_t UNUSED2; /*!< Unspecified */ + __I uint32_t RESERVED0; + __IO uint32_t UNUSED3; /*!< Unspecified */ + __IO uint32_t NRFFW[15]; /*!< Description collection[0]: Reserved for Nordic firmware design */ + __IO uint32_t NRFHW[12]; /*!< Description collection[0]: Reserved for Nordic hardware design */ + __IO uint32_t CUSTOMER[32]; /*!< Description collection[0]: Reserved for customer */ + __I uint32_t RESERVED1[64]; + __IO uint32_t PSELRESET[2]; /*!< Description collection[0]: Mapping of the nRESET function */ + __IO uint32_t APPROTECT; /*!< Access port protection */ + __IO uint32_t NFCPINS; /*!< Setting of pins dedicated to NFC functionality: NFC antenna + or GPIO */ + __I uint32_t RESERVED2[60]; + __IO uint32_t EXTSUPPLY; /*!< Enable external circuitry to be supplied from VDD pin. Applicable + in 'High voltage mode' only. */ + __IO uint32_t REGOUT0; /*!< GPIO reference voltage / external output supply voltage in 'High + voltage mode'. */ +} NRF_UICR_Type; + + +/* ================================================================================ */ +/* ================ POWER ================ */ +/* ================================================================================ */ + + +/** + * @brief Power control (POWER) + */ + +typedef struct { /*!< POWER Structure */ + __I uint32_t RESERVED0[30]; + __O uint32_t TASKS_CONSTLAT; /*!< Enable constant latency mode */ + __O uint32_t TASKS_LOWPWR; /*!< Enable low power mode (variable latency) */ + __I uint32_t RESERVED1[34]; + __IO uint32_t EVENTS_POFWARN; /*!< Power failure warning */ + __I uint32_t RESERVED2[2]; + __IO uint32_t EVENTS_SLEEPENTER; /*!< CPU entered WFI/WFE sleep */ + __IO uint32_t EVENTS_SLEEPEXIT; /*!< CPU exited WFI/WFE sleep */ + __IO uint32_t EVENTS_USBDETECTED; /*!< Voltage supply detected on VBUS */ + __IO uint32_t EVENTS_USBREMOVED; /*!< Voltage supply removed from VBUS */ + __IO uint32_t EVENTS_USBPWRRDY; /*!< USB 3.3 V supply ready */ + __I uint32_t RESERVED3[119]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED4[61]; + __IO uint32_t RESETREAS; /*!< Reset reason */ + __I uint32_t RESERVED5[9]; + __I uint32_t RAMSTATUS; /*!< Deprecated register - RAM status register */ + __I uint32_t RESERVED6[3]; + __I uint32_t USBREGSTATUS; /*!< USB supply status */ + __I uint32_t RESERVED7[49]; + __O uint32_t SYSTEMOFF; /*!< System OFF register */ + __I uint32_t RESERVED8[3]; + __IO uint32_t POFCON; /*!< Power failure comparator configuration */ + __I uint32_t RESERVED9[2]; + __IO uint32_t GPREGRET; /*!< General purpose retention register */ + __IO uint32_t GPREGRET2; /*!< General purpose retention register */ + __I uint32_t RESERVED10[21]; + __IO uint32_t DCDCEN; /*!< Enable DC/DC converter for REG1 stage. */ + __I uint32_t RESERVED11; + __IO uint32_t DCDCEN0; /*!< Enable DC/DC converter for REG0 stage. */ + __I uint32_t RESERVED12[47]; + __I uint32_t MAINREGSTATUS; /*!< Main supply status */ + __I uint32_t RESERVED13[175]; + POWER_RAM_Type RAM[9]; /*!< Unspecified */ +} NRF_POWER_Type; + + +/* ================================================================================ */ +/* ================ CLOCK ================ */ +/* ================================================================================ */ + + +/** + * @brief Clock control (CLOCK) + */ + +typedef struct { /*!< CLOCK Structure */ + __O uint32_t TASKS_HFCLKSTART; /*!< Start HFCLK crystal oscillator */ + __O uint32_t TASKS_HFCLKSTOP; /*!< Stop HFCLK crystal oscillator */ + __O uint32_t TASKS_LFCLKSTART; /*!< Start LFCLK source */ + __O uint32_t TASKS_LFCLKSTOP; /*!< Stop LFCLK source */ + __O uint32_t TASKS_CAL; /*!< Start calibration of LFRC or LFULP oscillator */ + __O uint32_t TASKS_CTSTART; /*!< Start calibration timer */ + __O uint32_t TASKS_CTSTOP; /*!< Stop calibration timer */ + __I uint32_t RESERVED0[57]; + __IO uint32_t EVENTS_HFCLKSTARTED; /*!< HFCLK oscillator started */ + __IO uint32_t EVENTS_LFCLKSTARTED; /*!< LFCLK started */ + __I uint32_t RESERVED1; + __IO uint32_t EVENTS_DONE; /*!< Calibration of LFCLK RC oscillator complete event */ + __IO uint32_t EVENTS_CTTO; /*!< Calibration timer timeout */ + __I uint32_t RESERVED2[124]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[63]; + __I uint32_t HFCLKRUN; /*!< Status indicating that HFCLKSTART task has been triggered */ + __I uint32_t HFCLKSTAT; /*!< HFCLK status */ + __I uint32_t RESERVED4; + __I uint32_t LFCLKRUN; /*!< Status indicating that LFCLKSTART task has been triggered */ + __I uint32_t LFCLKSTAT; /*!< LFCLK status */ + __I uint32_t LFCLKSRCCOPY; /*!< Copy of LFCLKSRC register, set when LFCLKSTART task was triggered */ + __I uint32_t RESERVED5[62]; + __IO uint32_t LFCLKSRC; /*!< Clock source for the LFCLK */ + __I uint32_t RESERVED6[7]; + __IO uint32_t CTIV; /*!< Calibration timer interval */ + __I uint32_t RESERVED7[8]; + __IO uint32_t TRACECONFIG; /*!< Clocking options for the Trace Port debug interface */ +} NRF_CLOCK_Type; + + +/* ================================================================================ */ +/* ================ RADIO ================ */ +/* ================================================================================ */ + + +/** + * @brief 2.4 GHz Radio (RADIO) + */ + +typedef struct { /*!< RADIO Structure */ + __O uint32_t TASKS_TXEN; /*!< Enable RADIO in TX mode */ + __O uint32_t TASKS_RXEN; /*!< Enable RADIO in RX mode */ + __O uint32_t TASKS_START; /*!< Start RADIO */ + __O uint32_t TASKS_STOP; /*!< Stop RADIO */ + __O uint32_t TASKS_DISABLE; /*!< Disable RADIO */ + __O uint32_t TASKS_RSSISTART; /*!< Start the RSSI and take one single sample of the receive signal + strength. */ + __O uint32_t TASKS_RSSISTOP; /*!< Stop the RSSI measurement */ + __O uint32_t TASKS_BCSTART; /*!< Start the bit counter */ + __O uint32_t TASKS_BCSTOP; /*!< Stop the bit counter */ + __O uint32_t TASKS_EDSTART; /*!< Start the Energy Detect measurement used in IEEE 802.15.4 mode */ + __O uint32_t TASKS_EDSTOP; /*!< Stop the Energy Detect measurement */ + __O uint32_t TASKS_CCASTART; /*!< Start the Clear Channel Assessment used in IEEE 802.15.4 mode */ + __O uint32_t TASKS_CCASTOP; /*!< Stop the Clear Channel Assessment */ + __I uint32_t RESERVED0[51]; + __IO uint32_t EVENTS_READY; /*!< RADIO has ramped up and is ready to be started */ + __IO uint32_t EVENTS_ADDRESS; /*!< Address sent or received */ + __IO uint32_t EVENTS_PAYLOAD; /*!< Packet payload sent or received */ + __IO uint32_t EVENTS_END; /*!< Packet sent or received */ + __IO uint32_t EVENTS_DISABLED; /*!< RADIO has been disabled */ + __IO uint32_t EVENTS_DEVMATCH; /*!< A device address match occurred on the last received packet */ + __IO uint32_t EVENTS_DEVMISS; /*!< No device address match occurred on the last received packet */ + __IO uint32_t EVENTS_RSSIEND; /*!< Sampling of receive signal strength complete. */ + __I uint32_t RESERVED1[2]; + __IO uint32_t EVENTS_BCMATCH; /*!< Bit counter reached bit count value. */ + __I uint32_t RESERVED2; + __IO uint32_t EVENTS_CRCOK; /*!< Packet received with CRC ok */ + __IO uint32_t EVENTS_CRCERROR; /*!< Packet received with CRC error */ + __IO uint32_t EVENTS_FRAMESTART; /*!< IEEE 802.15.4 length field received */ + __IO uint32_t EVENTS_EDEND; /*!< Sampling of Energy Detection complete. A new ED sample is ready + for readout from the RADIO.EDSAMPLE register */ + __IO uint32_t EVENTS_EDSTOPPED; /*!< The sampling of Energy Detection has stopped */ + __IO uint32_t EVENTS_CCAIDLE; /*!< Wireless medium in idle - clear to send */ + __IO uint32_t EVENTS_CCABUSY; /*!< Wireless medium busy - do not send */ + __IO uint32_t EVENTS_CCASTOPPED; /*!< The CCA has stopped */ + __IO uint32_t EVENTS_RATEBOOST; /*!< Ble_LR CI field received, receive mode is changed from Ble_LR125Kbit + to Ble_LR500Kbit. */ + __IO uint32_t EVENTS_TXREADY; /*!< RADIO has ramped up and is ready to be started TX path */ + __IO uint32_t EVENTS_RXREADY; /*!< RADIO has ramped up and is ready to be started RX path */ + __IO uint32_t EVENTS_MHRMATCH; /*!< MAC Header match found. */ + __I uint32_t RESERVED3[40]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED4[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED5[61]; + __I uint32_t CRCSTATUS; /*!< CRC status */ + __I uint32_t RESERVED6; + __I uint32_t RXMATCH; /*!< Received address */ + __I uint32_t RXCRC; /*!< CRC field of previously received packet */ + __I uint32_t DAI; /*!< Device address match index */ + __I uint32_t RESERVED7[60]; + __IO uint32_t PACKETPTR; /*!< Packet pointer */ + __IO uint32_t FREQUENCY; /*!< Frequency */ + __IO uint32_t TXPOWER; /*!< Output power */ + __IO uint32_t MODE; /*!< Data rate and modulation */ + __IO uint32_t PCNF0; /*!< Packet configuration register 0 */ + __IO uint32_t PCNF1; /*!< Packet configuration register 1 */ + __IO uint32_t BASE0; /*!< Base address 0 */ + __IO uint32_t BASE1; /*!< Base address 1 */ + __IO uint32_t PREFIX0; /*!< Prefixes bytes for logical addresses 0-3 */ + __IO uint32_t PREFIX1; /*!< Prefixes bytes for logical addresses 4-7 */ + __IO uint32_t TXADDRESS; /*!< Transmit address select */ + __IO uint32_t RXADDRESSES; /*!< Receive address select */ + __IO uint32_t CRCCNF; /*!< CRC configuration */ + __IO uint32_t CRCPOLY; /*!< CRC polynomial */ + __IO uint32_t CRCINIT; /*!< CRC initial value */ + __I uint32_t RESERVED8; + __IO uint32_t TIFS; /*!< Inter Frame Spacing in us */ + __I uint32_t RSSISAMPLE; /*!< RSSI sample */ + __I uint32_t RESERVED9; + __I uint32_t STATE; /*!< Current radio state */ + __IO uint32_t DATAWHITEIV; /*!< Data whitening initial value */ + __I uint32_t RESERVED10[2]; + __IO uint32_t BCC; /*!< Bit counter compare */ + __I uint32_t RESERVED11[39]; + __IO uint32_t DAB[8]; /*!< Description collection[0]: Device address base segment 0 */ + __IO uint32_t DAP[8]; /*!< Description collection[0]: Device address prefix 0 */ + __IO uint32_t DACNF; /*!< Device address match configuration */ + __IO uint32_t MHRMATCHCONF; /*!< Search Pattern Configuration */ + __IO uint32_t MHRMATCHMAS; /*!< Pattern mask */ + __I uint32_t RESERVED12; + __IO uint32_t MODECNF0; /*!< Radio mode configuration register 0 */ + __I uint32_t RESERVED13[3]; + __IO uint32_t SFD; /*!< IEEE 802.15.4 Start of Frame Delimiter */ + __IO uint32_t EDCNT; /*!< IEEE 802.15.4 Energy Detect Loop Count */ + __IO uint32_t EDSAMPLE; /*!< IEEE 802.15.4 Energy Detect Level */ + __IO uint32_t CCACTRL; /*!< IEEE 802.15.4 Clear Channel Assessment Control */ + __I uint32_t RESERVED14[611]; + __IO uint32_t POWER; /*!< Peripheral power control */ +} NRF_RADIO_Type; + + +/* ================================================================================ */ +/* ================ UARTE ================ */ +/* ================================================================================ */ + + +/** + * @brief UART with EasyDMA 0 (UARTE) + */ + +typedef struct { /*!< UARTE Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start UART receiver */ + __O uint32_t TASKS_STOPRX; /*!< Stop UART receiver */ + __O uint32_t TASKS_STARTTX; /*!< Start UART transmitter */ + __O uint32_t TASKS_STOPTX; /*!< Stop UART transmitter */ + __I uint32_t RESERVED0[7]; + __O uint32_t TASKS_FLUSHRX; /*!< Flush RX FIFO into RX buffer */ + __I uint32_t RESERVED1[52]; + __IO uint32_t EVENTS_CTS; /*!< CTS is activated (set low). Clear To Send. */ + __IO uint32_t EVENTS_NCTS; /*!< CTS is deactivated (set high). Not Clear To Send. */ + __IO uint32_t EVENTS_RXDRDY; /*!< Data received in RXD (but potentially not yet transferred to + Data RAM) */ + __I uint32_t RESERVED2; + __IO uint32_t EVENTS_ENDRX; /*!< Receive buffer is filled up */ + __I uint32_t RESERVED3[2]; + __IO uint32_t EVENTS_TXDRDY; /*!< Data sent from TXD */ + __IO uint32_t EVENTS_ENDTX; /*!< Last TX byte transmitted */ + __IO uint32_t EVENTS_ERROR; /*!< Error detected */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_RXTO; /*!< Receiver timeout */ + __I uint32_t RESERVED5; + __IO uint32_t EVENTS_RXSTARTED; /*!< UART receiver has started */ + __IO uint32_t EVENTS_TXSTARTED; /*!< UART transmitter has started */ + __I uint32_t RESERVED6; + __IO uint32_t EVENTS_TXSTOPPED; /*!< Transmitter stopped */ + __I uint32_t RESERVED7[41]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED8[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED9[93]; + __IO uint32_t ERRORSRC; /*!< Error source Note : this register is read / write one to clear. */ + __I uint32_t RESERVED10[31]; + __IO uint32_t ENABLE; /*!< Enable UART */ + __I uint32_t RESERVED11; + UARTE_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED12[3]; + __IO uint32_t BAUDRATE; /*!< Baud rate. Accuracy depends on the HFCLK source selected. */ + __I uint32_t RESERVED13[3]; + UARTE_RXD_Type RXD; /*!< RXD EasyDMA channel */ + __I uint32_t RESERVED14; + UARTE_TXD_Type TXD; /*!< TXD EasyDMA channel */ + __I uint32_t RESERVED15[7]; + __IO uint32_t CONFIG; /*!< Configuration of parity and hardware flow control */ +} NRF_UARTE_Type; + + +/* ================================================================================ */ +/* ================ UART ================ */ +/* ================================================================================ */ + + +/** + * @brief Universal Asynchronous Receiver/Transmitter (UART) + */ + +typedef struct { /*!< UART Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start UART receiver */ + __O uint32_t TASKS_STOPRX; /*!< Stop UART receiver */ + __O uint32_t TASKS_STARTTX; /*!< Start UART transmitter */ + __O uint32_t TASKS_STOPTX; /*!< Stop UART transmitter */ + __I uint32_t RESERVED0[3]; + __O uint32_t TASKS_SUSPEND; /*!< Suspend UART */ + __I uint32_t RESERVED1[56]; + __IO uint32_t EVENTS_CTS; /*!< CTS is activated (set low). Clear To Send. */ + __IO uint32_t EVENTS_NCTS; /*!< CTS is deactivated (set high). Not Clear To Send. */ + __IO uint32_t EVENTS_RXDRDY; /*!< Data received in RXD */ + __I uint32_t RESERVED2[4]; + __IO uint32_t EVENTS_TXDRDY; /*!< Data sent from TXD */ + __I uint32_t RESERVED3; + __IO uint32_t EVENTS_ERROR; /*!< Error detected */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_RXTO; /*!< Receiver timeout */ + __I uint32_t RESERVED5[46]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED6[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED7[93]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t RESERVED8[31]; + __IO uint32_t ENABLE; /*!< Enable UART */ + __I uint32_t RESERVED9; + UART_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RXD; /*!< RXD register */ + __O uint32_t TXD; /*!< TXD register */ + __I uint32_t RESERVED10; + __IO uint32_t BAUDRATE; /*!< Baud rate. Accuracy depends on the HFCLK source selected. */ + __I uint32_t RESERVED11[17]; + __IO uint32_t CONFIG; /*!< Configuration of parity and hardware flow control */ +} NRF_UART_Type; + + +/* ================================================================================ */ +/* ================ SPIM ================ */ +/* ================================================================================ */ + + +/** + * @brief Serial Peripheral Interface Master with EasyDMA 0 (SPIM) + */ + +typedef struct { /*!< SPIM Structure */ + __I uint32_t RESERVED0[4]; + __O uint32_t TASKS_START; /*!< Start SPI transaction */ + __O uint32_t TASKS_STOP; /*!< Stop SPI transaction */ + __I uint32_t RESERVED1; + __O uint32_t TASKS_SUSPEND; /*!< Suspend SPI transaction */ + __O uint32_t TASKS_RESUME; /*!< Resume SPI transaction */ + __I uint32_t RESERVED2[56]; + __IO uint32_t EVENTS_STOPPED; /*!< SPI transaction has stopped */ + __I uint32_t RESERVED3[2]; + __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached */ + __I uint32_t RESERVED4; + __IO uint32_t EVENTS_END; /*!< End of RXD buffer and TXD buffer reached */ + __I uint32_t RESERVED5; + __IO uint32_t EVENTS_ENDTX; /*!< End of TXD buffer reached */ + __I uint32_t RESERVED6[10]; + __IO uint32_t EVENTS_STARTED; /*!< Transaction started */ + __I uint32_t RESERVED7[44]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED8[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED9[61]; + __IO uint32_t STALLSTAT; /*!< Stall status for EasyDMA RAM accesses. The fields in this register + is set to STALL by hardware whenever a stall occurres and can + be cleared (set to NOSTALL) by the CPU. */ + __I uint32_t RESERVED10[63]; + __IO uint32_t ENABLE; /*!< Enable SPIM */ + __I uint32_t RESERVED11; + SPIM_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED12[3]; + __IO uint32_t FREQUENCY; /*!< SPI frequency. Accuracy depends on the HFCLK source selected. */ + __I uint32_t RESERVED13[3]; + SPIM_RXD_Type RXD; /*!< RXD EasyDMA channel */ + SPIM_TXD_Type TXD; /*!< TXD EasyDMA channel */ + __IO uint32_t CONFIG; /*!< Configuration register */ + __I uint32_t RESERVED14[2]; + SPIM_IFTIMING_Type IFTIMING; /*!< Unspecified */ + __I uint32_t RESERVED15[22]; + __IO uint32_t ORC; /*!< Byte transmitted after TXD.MAXCNT bytes have been transmitted + in the case when RXD.MAXCNT is greater than TXD.MAXCNT */ +} NRF_SPIM_Type; + + +/* ================================================================================ */ +/* ================ SPIS ================ */ +/* ================================================================================ */ + + +/** + * @brief SPI Slave 0 (SPIS) + */ + +typedef struct { /*!< SPIS Structure */ + __I uint32_t RESERVED0[9]; + __O uint32_t TASKS_ACQUIRE; /*!< Acquire SPI semaphore */ + __O uint32_t TASKS_RELEASE; /*!< Release SPI semaphore, enabling the SPI slave to acquire it */ + __I uint32_t RESERVED1[54]; + __IO uint32_t EVENTS_END; /*!< Granted transaction completed */ + __I uint32_t RESERVED2[2]; + __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached */ + __I uint32_t RESERVED3[5]; + __IO uint32_t EVENTS_ACQUIRED; /*!< Semaphore acquired */ + __I uint32_t RESERVED4[53]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED5[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED6[61]; + __I uint32_t SEMSTAT; /*!< Semaphore status register */ + __I uint32_t RESERVED7[15]; + __IO uint32_t STATUS; /*!< Status from last transaction */ + __I uint32_t RESERVED8[47]; + __IO uint32_t ENABLE; /*!< Enable SPI slave */ + __I uint32_t RESERVED9; + SPIS_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED10[7]; + SPIS_RXD_Type RXD; /*!< Unspecified */ + __I uint32_t RESERVED11; + SPIS_TXD_Type TXD; /*!< Unspecified */ + __I uint32_t RESERVED12; + __IO uint32_t CONFIG; /*!< Configuration register */ + __I uint32_t RESERVED13; + __IO uint32_t DEF; /*!< Default character. Character clocked out in case of an ignored + transaction. */ + __I uint32_t RESERVED14[24]; + __IO uint32_t ORC; /*!< Over-read character */ +} NRF_SPIS_Type; + + +/* ================================================================================ */ +/* ================ TWIM ================ */ +/* ================================================================================ */ + + +/** + * @brief I2C compatible Two-Wire Master Interface with EasyDMA 0 (TWIM) + */ + +typedef struct { /*!< TWIM Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start TWI receive sequence */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STARTTX; /*!< Start TWI transmit sequence */ + __I uint32_t RESERVED1[2]; + __O uint32_t TASKS_STOP; /*!< Stop TWI transaction. Must be issued while the TWI master is + not suspended. */ + __I uint32_t RESERVED2; + __O uint32_t TASKS_SUSPEND; /*!< Suspend TWI transaction */ + __O uint32_t TASKS_RESUME; /*!< Resume TWI transaction */ + __I uint32_t RESERVED3[56]; + __IO uint32_t EVENTS_STOPPED; /*!< TWI stopped */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_ERROR; /*!< TWI error */ + __I uint32_t RESERVED5[8]; + __IO uint32_t EVENTS_SUSPENDED; /*!< Last byte has been sent out after the SUSPEND task has been + issued, TWI traffic is now suspended. */ + __IO uint32_t EVENTS_RXSTARTED; /*!< Receive sequence started */ + __IO uint32_t EVENTS_TXSTARTED; /*!< Transmit sequence started */ + __I uint32_t RESERVED6[2]; + __IO uint32_t EVENTS_LASTRX; /*!< Byte boundary, starting to receive the last byte */ + __IO uint32_t EVENTS_LASTTX; /*!< Byte boundary, starting to transmit the last byte */ + __I uint32_t RESERVED7[39]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED8[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED9[110]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t RESERVED10[14]; + __IO uint32_t ENABLE; /*!< Enable TWIM */ + __I uint32_t RESERVED11; + TWIM_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED12[5]; + __IO uint32_t FREQUENCY; /*!< TWI frequency. Accuracy depends on the HFCLK source selected. */ + __I uint32_t RESERVED13[3]; + TWIM_RXD_Type RXD; /*!< RXD EasyDMA channel */ + TWIM_TXD_Type TXD; /*!< TXD EasyDMA channel */ + __I uint32_t RESERVED14[13]; + __IO uint32_t ADDRESS; /*!< Address used in the TWI transfer */ +} NRF_TWIM_Type; + + +/* ================================================================================ */ +/* ================ TWIS ================ */ +/* ================================================================================ */ + + +/** + * @brief I2C compatible Two-Wire Slave Interface with EasyDMA 0 (TWIS) + */ + +typedef struct { /*!< TWIS Structure */ + __I uint32_t RESERVED0[5]; + __O uint32_t TASKS_STOP; /*!< Stop TWI transaction */ + __I uint32_t RESERVED1; + __O uint32_t TASKS_SUSPEND; /*!< Suspend TWI transaction */ + __O uint32_t TASKS_RESUME; /*!< Resume TWI transaction */ + __I uint32_t RESERVED2[3]; + __O uint32_t TASKS_PREPARERX; /*!< Prepare the TWI slave to respond to a write command */ + __O uint32_t TASKS_PREPARETX; /*!< Prepare the TWI slave to respond to a read command */ + __I uint32_t RESERVED3[51]; + __IO uint32_t EVENTS_STOPPED; /*!< TWI stopped */ + __I uint32_t RESERVED4[7]; + __IO uint32_t EVENTS_ERROR; /*!< TWI error */ + __I uint32_t RESERVED5[9]; + __IO uint32_t EVENTS_RXSTARTED; /*!< Receive sequence started */ + __IO uint32_t EVENTS_TXSTARTED; /*!< Transmit sequence started */ + __I uint32_t RESERVED6[4]; + __IO uint32_t EVENTS_WRITE; /*!< Write command received */ + __IO uint32_t EVENTS_READ; /*!< Read command received */ + __I uint32_t RESERVED7[37]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED8[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED9[113]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t MATCH; /*!< Status register indicating which address had a match */ + __I uint32_t RESERVED10[10]; + __IO uint32_t ENABLE; /*!< Enable TWIS */ + __I uint32_t RESERVED11; + TWIS_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED12[9]; + TWIS_RXD_Type RXD; /*!< RXD EasyDMA channel */ + __I uint32_t RESERVED13; + TWIS_TXD_Type TXD; /*!< TXD EasyDMA channel */ + __I uint32_t RESERVED14[14]; + __IO uint32_t ADDRESS[2]; /*!< Description collection[0]: TWI slave address 0 */ + __I uint32_t RESERVED15; + __IO uint32_t CONFIG; /*!< Configuration register for the address match mechanism */ + __I uint32_t RESERVED16[10]; + __IO uint32_t ORC; /*!< Over-read character. Character sent out in case of an over-read + of the transmit buffer. */ +} NRF_TWIS_Type; + + +/* ================================================================================ */ +/* ================ SPI ================ */ +/* ================================================================================ */ + + +/** + * @brief Serial Peripheral Interface 0 (SPI) + */ + +typedef struct { /*!< SPI Structure */ + __I uint32_t RESERVED0[66]; + __IO uint32_t EVENTS_READY; /*!< TXD byte sent and RXD byte received */ + __I uint32_t RESERVED1[126]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[125]; + __IO uint32_t ENABLE; /*!< Enable SPI */ + __I uint32_t RESERVED3; + SPI_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED4; + __I uint32_t RXD; /*!< RXD register */ + __IO uint32_t TXD; /*!< TXD register */ + __I uint32_t RESERVED5; + __IO uint32_t FREQUENCY; /*!< SPI frequency. Accuracy depends on the HFCLK source selected. */ + __I uint32_t RESERVED6[11]; + __IO uint32_t CONFIG; /*!< Configuration register */ +} NRF_SPI_Type; + + +/* ================================================================================ */ +/* ================ TWI ================ */ +/* ================================================================================ */ + + +/** + * @brief I2C compatible Two-Wire Interface 0 (TWI) + */ + +typedef struct { /*!< TWI Structure */ + __O uint32_t TASKS_STARTRX; /*!< Start TWI receive sequence */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STARTTX; /*!< Start TWI transmit sequence */ + __I uint32_t RESERVED1[2]; + __O uint32_t TASKS_STOP; /*!< Stop TWI transaction */ + __I uint32_t RESERVED2; + __O uint32_t TASKS_SUSPEND; /*!< Suspend TWI transaction */ + __O uint32_t TASKS_RESUME; /*!< Resume TWI transaction */ + __I uint32_t RESERVED3[56]; + __IO uint32_t EVENTS_STOPPED; /*!< TWI stopped */ + __IO uint32_t EVENTS_RXDREADY; /*!< TWI RXD byte received */ + __I uint32_t RESERVED4[4]; + __IO uint32_t EVENTS_TXDSENT; /*!< TWI TXD byte sent */ + __I uint32_t RESERVED5; + __IO uint32_t EVENTS_ERROR; /*!< TWI error */ + __I uint32_t RESERVED6[4]; + __IO uint32_t EVENTS_BB; /*!< TWI byte boundary, generated before each byte that is sent or + received */ + __I uint32_t RESERVED7[3]; + __IO uint32_t EVENTS_SUSPENDED; /*!< TWI entered the suspended state */ + __I uint32_t RESERVED8[45]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED9[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED10[110]; + __IO uint32_t ERRORSRC; /*!< Error source */ + __I uint32_t RESERVED11[14]; + __IO uint32_t ENABLE; /*!< Enable TWI */ + __I uint32_t RESERVED12; + TWI_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED13[2]; + __I uint32_t RXD; /*!< RXD register */ + __IO uint32_t TXD; /*!< TXD register */ + __I uint32_t RESERVED14; + __IO uint32_t FREQUENCY; /*!< TWI frequency. Accuracy depends on the HFCLK source selected. */ + __I uint32_t RESERVED15[24]; + __IO uint32_t ADDRESS; /*!< Address used in the TWI transfer */ +} NRF_TWI_Type; + + +/* ================================================================================ */ +/* ================ NFCT ================ */ +/* ================================================================================ */ + + +/** + * @brief NFC-A compatible radio (NFCT) + */ + +typedef struct { /*!< NFCT Structure */ + __O uint32_t TASKS_ACTIVATE; /*!< Activate NFCT peripheral for incoming and outgoing frames, change + state to activated */ + __O uint32_t TASKS_DISABLE; /*!< Disable NFCT peripheral */ + __O uint32_t TASKS_SENSE; /*!< Enable NFC sense field mode, change state to sense mode */ + __O uint32_t TASKS_STARTTX; /*!< Start transmission of an outgoing frame, change state to transmit */ + __I uint32_t RESERVED0[3]; + __O uint32_t TASKS_ENABLERXDATA; /*!< Initializes the EasyDMA for receive. */ + __I uint32_t RESERVED1; + __O uint32_t TASKS_GOIDLE; /*!< Force state machine to IDLE state */ + __O uint32_t TASKS_GOSLEEP; /*!< Force state machine to SLEEP_A state */ + __I uint32_t RESERVED2[53]; + __IO uint32_t EVENTS_READY; /*!< The NFCT peripheral is ready to receive and send frames */ + __IO uint32_t EVENTS_FIELDDETECTED; /*!< Remote NFC field detected */ + __IO uint32_t EVENTS_FIELDLOST; /*!< Remote NFC field lost */ + __IO uint32_t EVENTS_TXFRAMESTART; /*!< Marks the start of the first symbol of a transmitted frame */ + __IO uint32_t EVENTS_TXFRAMEEND; /*!< Marks the end of the last transmitted on-air symbol of a frame */ + __IO uint32_t EVENTS_RXFRAMESTART; /*!< Marks the end of the first symbol of a received frame */ + __IO uint32_t EVENTS_RXFRAMEEND; /*!< Received data has been checked (CRC, parity) and transferred + to RAM, and EasyDMA has ended accessing the RX buffer */ + __IO uint32_t EVENTS_ERROR; /*!< NFC error reported. The ERRORSTATUS register contains details + on the source of the error. */ + __I uint32_t RESERVED3[2]; + __IO uint32_t EVENTS_RXERROR; /*!< NFC RX frame error reported. The FRAMESTATUS.RX register contains + details on the source of the error. */ + __IO uint32_t EVENTS_ENDRX; /*!< RX buffer (as defined by PACKETPTR and MAXLEN) in Data RAM full. */ + __IO uint32_t EVENTS_ENDTX; /*!< Transmission of data in RAM has ended, and EasyDMA has ended + accessing the TX buffer */ + __I uint32_t RESERVED4; + __IO uint32_t EVENTS_AUTOCOLRESSTARTED; /*!< Auto collision resolution process has started */ + __I uint32_t RESERVED5[3]; + __IO uint32_t EVENTS_COLLISION; /*!< NFC auto collision resolution error reported. */ + __IO uint32_t EVENTS_SELECTED; /*!< NFC auto collision resolution successfully completed */ + __IO uint32_t EVENTS_STARTED; /*!< EasyDMA is ready to receive or send frames. */ + __I uint32_t RESERVED6[43]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED7[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED8[62]; + __IO uint32_t ERRORSTATUS; /*!< NFC Error Status register */ + __I uint32_t RESERVED9; + NFCT_FRAMESTATUS_Type FRAMESTATUS; /*!< Unspecified */ + __I uint32_t NFCTAGSTATE; /*!< NfcTag state register */ + __I uint32_t RESERVED10[10]; + __I uint32_t FIELDPRESENT; /*!< Indicates the presence or not of a valid field */ + __I uint32_t RESERVED11[49]; + __IO uint32_t FRAMEDELAYMIN; /*!< Minimum frame delay */ + __IO uint32_t FRAMEDELAYMAX; /*!< Maximum frame delay */ + __IO uint32_t FRAMEDELAYMODE; /*!< Configuration register for the Frame Delay Timer */ + __IO uint32_t PACKETPTR; /*!< Packet pointer for TXD and RXD data storage in Data RAM */ + __IO uint32_t MAXLEN; /*!< Size of the RAM buffer allocated to TXD and RXD data storage + each */ + NFCT_TXD_Type TXD; /*!< Unspecified */ + NFCT_RXD_Type RXD; /*!< Unspecified */ + __I uint32_t RESERVED12[26]; + __IO uint32_t NFCID1_LAST; /*!< Last NFCID1 part (4, 7 or 10 bytes ID) */ + __IO uint32_t NFCID1_2ND_LAST; /*!< Second last NFCID1 part (7 or 10 bytes ID) */ + __IO uint32_t NFCID1_3RD_LAST; /*!< Third last NFCID1 part (10 bytes ID) */ + __IO uint32_t AUTOCOLRESCONFIG; /*!< Controls the auto collision resolution function. This setting + must be done before the NFCT peripheral is enabled. */ + __IO uint32_t SENSRES; /*!< NFC-A SENS_RES auto-response settings */ + __IO uint32_t SELRES; /*!< NFC-A SEL_RES auto-response settings */ +} NRF_NFCT_Type; + + +/* ================================================================================ */ +/* ================ GPIOTE ================ */ +/* ================================================================================ */ + + +/** + * @brief GPIO Tasks and Events (GPIOTE) + */ + +typedef struct { /*!< GPIOTE Structure */ + __O uint32_t TASKS_OUT[8]; /*!< Description collection[0]: Task for writing to pin specified + in CONFIG[0].PSEL. Action on pin is configured in CONFIG[0].POLARITY. */ + __I uint32_t RESERVED0[4]; + __O uint32_t TASKS_SET[8]; /*!< Description collection[0]: Task for writing to pin specified + in CONFIG[0].PSEL. Action on pin is to set it high. */ + __I uint32_t RESERVED1[4]; + __O uint32_t TASKS_CLR[8]; /*!< Description collection[0]: Task for writing to pin specified + in CONFIG[0].PSEL. Action on pin is to set it low. */ + __I uint32_t RESERVED2[32]; + __IO uint32_t EVENTS_IN[8]; /*!< Description collection[0]: Event generated from pin specified + in CONFIG[0].PSEL */ + __I uint32_t RESERVED3[23]; + __IO uint32_t EVENTS_PORT; /*!< Event generated from multiple input GPIO pins with SENSE mechanism + enabled */ + __I uint32_t RESERVED4[97]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED5[129]; + __IO uint32_t CONFIG[8]; /*!< Description collection[0]: Configuration for OUT[n], SET[n] + and CLR[n] tasks and IN[n] event */ +} NRF_GPIOTE_Type; + + +/* ================================================================================ */ +/* ================ SAADC ================ */ +/* ================================================================================ */ + + +/** + * @brief Analog to Digital Converter (SAADC) + */ + +typedef struct { /*!< SAADC Structure */ + __O uint32_t TASKS_START; /*!< Start the ADC and prepare the result buffer in RAM */ + __O uint32_t TASKS_SAMPLE; /*!< Take one ADC sample, if scan is enabled all channels are sampled */ + __O uint32_t TASKS_STOP; /*!< Stop the ADC and terminate any on-going conversion */ + __O uint32_t TASKS_CALIBRATEOFFSET; /*!< Starts offset auto-calibration */ + __I uint32_t RESERVED0[60]; + __IO uint32_t EVENTS_STARTED; /*!< The ADC has started */ + __IO uint32_t EVENTS_END; /*!< The ADC has filled up the Result buffer */ + __IO uint32_t EVENTS_DONE; /*!< A conversion task has been completed. Depending on the mode, + multiple conversions might be needed for a result to be transferred + to RAM. */ + __IO uint32_t EVENTS_RESULTDONE; /*!< A result is ready to get transferred to RAM. */ + __IO uint32_t EVENTS_CALIBRATEDONE; /*!< Calibration is complete */ + __IO uint32_t EVENTS_STOPPED; /*!< The ADC has stopped */ + SAADC_EVENTS_CH_Type EVENTS_CH[8]; /*!< Unspecified */ + __I uint32_t RESERVED1[106]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[61]; + __I uint32_t STATUS; /*!< Status */ + __I uint32_t RESERVED3[63]; + __IO uint32_t ENABLE; /*!< Enable or disable ADC */ + __I uint32_t RESERVED4[3]; + SAADC_CH_Type CH[8]; /*!< Unspecified */ + __I uint32_t RESERVED5[24]; + __IO uint32_t RESOLUTION; /*!< Resolution configuration */ + __IO uint32_t OVERSAMPLE; /*!< Oversampling configuration. OVERSAMPLE should not be combined + with SCAN. The RESOLUTION is applied before averaging, thus + for high OVERSAMPLE a higher RESOLUTION should be used. */ + __IO uint32_t SAMPLERATE; /*!< Controls normal or continuous sample rate */ + __I uint32_t RESERVED6[12]; + SAADC_RESULT_Type RESULT; /*!< RESULT EasyDMA channel */ +} NRF_SAADC_Type; + + +/* ================================================================================ */ +/* ================ TIMER ================ */ +/* ================================================================================ */ + + +/** + * @brief Timer/Counter 0 (TIMER) + */ + +typedef struct { /*!< TIMER Structure */ + __O uint32_t TASKS_START; /*!< Start Timer */ + __O uint32_t TASKS_STOP; /*!< Stop Timer */ + __O uint32_t TASKS_COUNT; /*!< Increment Timer (Counter mode only) */ + __O uint32_t TASKS_CLEAR; /*!< Clear time */ + __O uint32_t TASKS_SHUTDOWN; /*!< Deprecated register - Shut down timer */ + __I uint32_t RESERVED0[11]; + __O uint32_t TASKS_CAPTURE[6]; /*!< Description collection[0]: Capture Timer value to CC[0] register */ + __I uint32_t RESERVED1[58]; + __IO uint32_t EVENTS_COMPARE[6]; /*!< Description collection[0]: Compare event on CC[0] match */ + __I uint32_t RESERVED2[42]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED3[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED4[61]; + __I uint32_t STATUS; /*!< Timer status */ + __I uint32_t RESERVED5[64]; + __IO uint32_t MODE; /*!< Timer mode selection */ + __IO uint32_t BITMODE; /*!< Configure the number of bits used by the TIMER */ + __I uint32_t RESERVED6; + __IO uint32_t PRESCALER; /*!< Timer prescaler register */ + __I uint32_t RESERVED7[11]; + __IO uint32_t CC[6]; /*!< Description collection[0]: Capture/Compare register 0 */ +} NRF_TIMER_Type; + + +/* ================================================================================ */ +/* ================ RTC ================ */ +/* ================================================================================ */ + + +/** + * @brief Real time counter 0 (RTC) + */ + +typedef struct { /*!< RTC Structure */ + __O uint32_t TASKS_START; /*!< Start RTC COUNTER */ + __O uint32_t TASKS_STOP; /*!< Stop RTC COUNTER */ + __O uint32_t TASKS_CLEAR; /*!< Clear RTC COUNTER */ + __O uint32_t TASKS_TRIGOVRFLW; /*!< Set COUNTER to 0xFFFFF0 */ + __I uint32_t RESERVED0[60]; + __IO uint32_t EVENTS_TICK; /*!< Event on COUNTER increment */ + __IO uint32_t EVENTS_OVRFLW; /*!< Event on COUNTER overflow */ + __I uint32_t RESERVED1[14]; + __IO uint32_t EVENTS_COMPARE[4]; /*!< Description collection[0]: Compare event on CC[0] match */ + __I uint32_t RESERVED2[109]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[13]; + __IO uint32_t EVTEN; /*!< Enable or disable event routing */ + __IO uint32_t EVTENSET; /*!< Enable event routing */ + __IO uint32_t EVTENCLR; /*!< Disable event routing */ + __I uint32_t RESERVED4[110]; + __I uint32_t COUNTER; /*!< Current COUNTER value */ + __IO uint32_t PRESCALER; /*!< 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must + be written when RTC is stopped */ + __I uint32_t RESERVED5[13]; + __IO uint32_t CC[4]; /*!< Description collection[0]: Compare register 0 */ +} NRF_RTC_Type; + + +/* ================================================================================ */ +/* ================ TEMP ================ */ +/* ================================================================================ */ + + +/** + * @brief Temperature Sensor (TEMP) + */ + +typedef struct { /*!< TEMP Structure */ + __O uint32_t TASKS_START; /*!< Start temperature measurement */ + __O uint32_t TASKS_STOP; /*!< Stop temperature measurement */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_DATARDY; /*!< Temperature measurement complete, data ready */ + __I uint32_t RESERVED1[128]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[127]; + __I int32_t TEMP; /*!< Temperature in degC (0.25deg steps) */ + __I uint32_t RESERVED3[5]; + __IO uint32_t A0; /*!< Slope of 1st piece wise linear function */ + __IO uint32_t A1; /*!< Slope of 2nd piece wise linear function */ + __IO uint32_t A2; /*!< Slope of 3rd piece wise linear function */ + __IO uint32_t A3; /*!< Slope of 4th piece wise linear function */ + __IO uint32_t A4; /*!< Slope of 5th piece wise linear function */ + __IO uint32_t A5; /*!< Slope of 6th piece wise linear function */ + __I uint32_t RESERVED4[2]; + __IO uint32_t B0; /*!< y-intercept of 1st piece wise linear function */ + __IO uint32_t B1; /*!< y-intercept of 2nd piece wise linear function */ + __IO uint32_t B2; /*!< y-intercept of 3rd piece wise linear function */ + __IO uint32_t B3; /*!< y-intercept of 4th piece wise linear function */ + __IO uint32_t B4; /*!< y-intercept of 5th piece wise linear function */ + __IO uint32_t B5; /*!< y-intercept of 6th piece wise linear function */ + __I uint32_t RESERVED5[2]; + __IO uint32_t T0; /*!< End point of 1st piece wise linear function */ + __IO uint32_t T1; /*!< End point of 2nd piece wise linear function */ + __IO uint32_t T2; /*!< End point of 3rd piece wise linear function */ + __IO uint32_t T3; /*!< End point of 4th piece wise linear function */ + __IO uint32_t T4; /*!< End point of 5th piece wise linear function */ +} NRF_TEMP_Type; + + +/* ================================================================================ */ +/* ================ RNG ================ */ +/* ================================================================================ */ + + +/** + * @brief Random Number Generator (RNG) + */ + +typedef struct { /*!< RNG Structure */ + __O uint32_t TASKS_START; /*!< Task starting the random number generator */ + __O uint32_t TASKS_STOP; /*!< Task stopping the random number generator */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_VALRDY; /*!< Event being generated for every new random number written to + the VALUE register */ + __I uint32_t RESERVED1[63]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[126]; + __IO uint32_t CONFIG; /*!< Configuration register */ + __I uint32_t VALUE; /*!< Output random number */ +} NRF_RNG_Type; + + +/* ================================================================================ */ +/* ================ ECB ================ */ +/* ================================================================================ */ + + +/** + * @brief AES ECB Mode Encryption (ECB) + */ + +typedef struct { /*!< ECB Structure */ + __O uint32_t TASKS_STARTECB; /*!< Start ECB block encrypt */ + __O uint32_t TASKS_STOPECB; /*!< Abort a possible executing ECB operation */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_ENDECB; /*!< ECB block encrypt complete */ + __IO uint32_t EVENTS_ERRORECB; /*!< ECB block encrypt aborted because of a STOPECB task or due to + an error */ + __I uint32_t RESERVED1[127]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[126]; + __IO uint32_t ECBDATAPTR; /*!< ECB block encrypt memory pointers */ +} NRF_ECB_Type; + + +/* ================================================================================ */ +/* ================ CCM ================ */ +/* ================================================================================ */ + + +/** + * @brief AES CCM Mode Encryption (CCM) + */ + +typedef struct { /*!< CCM Structure */ + __O uint32_t TASKS_KSGEN; /*!< Start generation of key-stream. This operation will stop by + itself when completed. */ + __O uint32_t TASKS_CRYPT; /*!< Start encryption/decryption. This operation will stop by itself + when completed. */ + __O uint32_t TASKS_STOP; /*!< Stop encryption/decryption */ + __O uint32_t TASKS_RATEOVERRIDE; /*!< Override DATARATE setting in MODE register with the contents + of the RATEOVERRIDE register for any ongoing encryption/decryption */ + __I uint32_t RESERVED0[60]; + __IO uint32_t EVENTS_ENDKSGEN; /*!< Key-stream generation complete */ + __IO uint32_t EVENTS_ENDCRYPT; /*!< Encrypt/decrypt complete */ + __IO uint32_t EVENTS_ERROR; /*!< Deprecated register - CCM error event */ + __I uint32_t RESERVED1[61]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[61]; + __I uint32_t MICSTATUS; /*!< MIC check result */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< Enable */ + __IO uint32_t MODE; /*!< Operation mode */ + __IO uint32_t CNFPTR; /*!< Pointer to data structure holding AES key and NONCE vector */ + __IO uint32_t INPTR; /*!< Input pointer */ + __IO uint32_t OUTPTR; /*!< Output pointer */ + __IO uint32_t SCRATCHPTR; /*!< Pointer to data area used for temporary storage */ + __IO uint32_t MAXPACKETSIZE; /*!< Length of key-stream generated when MODE.LENGTH = Extended. */ + __IO uint32_t RATEOVERRIDE; /*!< Data rate override setting. */ +} NRF_CCM_Type; + + +/* ================================================================================ */ +/* ================ AAR ================ */ +/* ================================================================================ */ + + +/** + * @brief Accelerated Address Resolver (AAR) + */ + +typedef struct { /*!< AAR Structure */ + __O uint32_t TASKS_START; /*!< Start resolving addresses based on IRKs specified in the IRK + data structure */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STOP; /*!< Stop resolving addresses */ + __I uint32_t RESERVED1[61]; + __IO uint32_t EVENTS_END; /*!< Address resolution procedure complete */ + __IO uint32_t EVENTS_RESOLVED; /*!< Address resolved */ + __IO uint32_t EVENTS_NOTRESOLVED; /*!< Address not resolved */ + __I uint32_t RESERVED2[126]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[61]; + __I uint32_t STATUS; /*!< Resolution status */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< Enable AAR */ + __IO uint32_t NIRK; /*!< Number of IRKs */ + __IO uint32_t IRKPTR; /*!< Pointer to IRK data structure */ + __I uint32_t RESERVED5; + __IO uint32_t ADDRPTR; /*!< Pointer to the resolvable address */ + __IO uint32_t SCRATCHPTR; /*!< Pointer to data area used for temporary storage */ +} NRF_AAR_Type; + + +/* ================================================================================ */ +/* ================ WDT ================ */ +/* ================================================================================ */ + + +/** + * @brief Watchdog Timer (WDT) + */ + +typedef struct { /*!< WDT Structure */ + __O uint32_t TASKS_START; /*!< Start the watchdog */ + __I uint32_t RESERVED0[63]; + __IO uint32_t EVENTS_TIMEOUT; /*!< Watchdog timeout */ + __I uint32_t RESERVED1[128]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[61]; + __I uint32_t RUNSTATUS; /*!< Run status */ + __I uint32_t REQSTATUS; /*!< Request status */ + __I uint32_t RESERVED3[63]; + __IO uint32_t CRV; /*!< Counter reload value */ + __IO uint32_t RREN; /*!< Enable register for reload request registers */ + __IO uint32_t CONFIG; /*!< Configuration register */ + __I uint32_t RESERVED4[60]; + __O uint32_t RR[8]; /*!< Description collection[0]: Reload request 0 */ +} NRF_WDT_Type; + + +/* ================================================================================ */ +/* ================ QDEC ================ */ +/* ================================================================================ */ + + +/** + * @brief Quadrature Decoder (QDEC) + */ + +typedef struct { /*!< QDEC Structure */ + __O uint32_t TASKS_START; /*!< Task starting the quadrature decoder */ + __O uint32_t TASKS_STOP; /*!< Task stopping the quadrature decoder */ + __O uint32_t TASKS_READCLRACC; /*!< Read and clear ACC and ACCDBL */ + __O uint32_t TASKS_RDCLRACC; /*!< Read and clear ACC */ + __O uint32_t TASKS_RDCLRDBL; /*!< Read and clear ACCDBL */ + __I uint32_t RESERVED0[59]; + __IO uint32_t EVENTS_SAMPLERDY; /*!< Event being generated for every new sample value written to + the SAMPLE register */ + __IO uint32_t EVENTS_REPORTRDY; /*!< Non-null report ready */ + __IO uint32_t EVENTS_ACCOF; /*!< ACC or ACCDBL register overflow */ + __IO uint32_t EVENTS_DBLRDY; /*!< Double displacement(s) detected */ + __IO uint32_t EVENTS_STOPPED; /*!< QDEC has been stopped */ + __I uint32_t RESERVED1[59]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[125]; + __IO uint32_t ENABLE; /*!< Enable the quadrature decoder */ + __IO uint32_t LEDPOL; /*!< LED output pin polarity */ + __IO uint32_t SAMPLEPER; /*!< Sample period */ + __I int32_t SAMPLE; /*!< Motion sample value */ + __IO uint32_t REPORTPER; /*!< Number of samples to be taken before REPORTRDY and DBLRDY events + can be generated */ + __I int32_t ACC; /*!< Register accumulating the valid transitions */ + __I int32_t ACCREAD; /*!< Snapshot of the ACC register, updated by the READCLRACC or RDCLRACC + task */ + QDEC_PSEL_Type PSEL; /*!< Unspecified */ + __IO uint32_t DBFEN; /*!< Enable input debounce filters */ + __I uint32_t RESERVED4[5]; + __IO uint32_t LEDPRE; /*!< Time period the LED is switched ON prior to sampling */ + __I uint32_t ACCDBL; /*!< Register accumulating the number of detected double transitions */ + __I uint32_t ACCDBLREAD; /*!< Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL + task */ +} NRF_QDEC_Type; + + +/* ================================================================================ */ +/* ================ COMP ================ */ +/* ================================================================================ */ + + +/** + * @brief Comparator (COMP) + */ + +typedef struct { /*!< COMP Structure */ + __O uint32_t TASKS_START; /*!< Start comparator */ + __O uint32_t TASKS_STOP; /*!< Stop comparator */ + __O uint32_t TASKS_SAMPLE; /*!< Sample comparator value */ + __I uint32_t RESERVED0[61]; + __IO uint32_t EVENTS_READY; /*!< COMP is ready and output is valid */ + __IO uint32_t EVENTS_DOWN; /*!< Downward crossing */ + __IO uint32_t EVENTS_UP; /*!< Upward crossing */ + __IO uint32_t EVENTS_CROSS; /*!< Downward or upward crossing */ + __I uint32_t RESERVED1[60]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[61]; + __I uint32_t RESULT; /*!< Compare result */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< COMP enable */ + __IO uint32_t PSEL; /*!< Pin select */ + __IO uint32_t REFSEL; /*!< Reference source select */ + __IO uint32_t EXTREFSEL; /*!< External reference select */ + __I uint32_t RESERVED5[8]; + __IO uint32_t TH; /*!< Threshold configuration for hysteresis unit */ + __IO uint32_t MODE; /*!< Mode configuration */ + __IO uint32_t HYST; /*!< Comparator hysteresis enable */ + __IO uint32_t ISOURCE; /*!< Current source select on analog input */ +} NRF_COMP_Type; + + +/* ================================================================================ */ +/* ================ LPCOMP ================ */ +/* ================================================================================ */ + + +/** + * @brief Low Power Comparator (LPCOMP) + */ + +typedef struct { /*!< LPCOMP Structure */ + __O uint32_t TASKS_START; /*!< Start comparator */ + __O uint32_t TASKS_STOP; /*!< Stop comparator */ + __O uint32_t TASKS_SAMPLE; /*!< Sample comparator value */ + __I uint32_t RESERVED0[61]; + __IO uint32_t EVENTS_READY; /*!< LPCOMP is ready and output is valid */ + __IO uint32_t EVENTS_DOWN; /*!< Downward crossing */ + __IO uint32_t EVENTS_UP; /*!< Upward crossing */ + __IO uint32_t EVENTS_CROSS; /*!< Downward or upward crossing */ + __I uint32_t RESERVED1[60]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED2[64]; + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[61]; + __I uint32_t RESULT; /*!< Compare result */ + __I uint32_t RESERVED4[63]; + __IO uint32_t ENABLE; /*!< Enable LPCOMP */ + __IO uint32_t PSEL; /*!< Input pin select */ + __IO uint32_t REFSEL; /*!< Reference select */ + __IO uint32_t EXTREFSEL; /*!< External reference select */ + __I uint32_t RESERVED5[4]; + __IO uint32_t ANADETECT; /*!< Analog detect configuration */ + __I uint32_t RESERVED6[5]; + __IO uint32_t HYST; /*!< Comparator hysteresis enable */ +} NRF_LPCOMP_Type; + + +/* ================================================================================ */ +/* ================ SWI ================ */ +/* ================================================================================ */ + + +/** + * @brief Software interrupt 0 (SWI) + */ + +typedef struct { /*!< SWI Structure */ + __I uint32_t UNUSED; /*!< Unused. */ +} NRF_SWI_Type; + + +/* ================================================================================ */ +/* ================ EGU ================ */ +/* ================================================================================ */ + + +/** + * @brief Event Generator Unit 0 (EGU) + */ + +typedef struct { /*!< EGU Structure */ + __O uint32_t TASKS_TRIGGER[16]; /*!< Description collection[0]: Trigger 0 for triggering the corresponding + TRIGGERED[0] event */ + __I uint32_t RESERVED0[48]; + __IO uint32_t EVENTS_TRIGGERED[16]; /*!< Description collection[0]: Event number 0 generated by triggering + the corresponding TRIGGER[0] task */ + __I uint32_t RESERVED1[112]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ +} NRF_EGU_Type; + + +/* ================================================================================ */ +/* ================ PWM ================ */ +/* ================================================================================ */ + + +/** + * @brief Pulse Width Modulation Unit 0 (PWM) + */ + +typedef struct { /*!< PWM Structure */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STOP; /*!< Stops PWM pulse generation on all channels at the end of current + PWM period, and stops sequence playback */ + __O uint32_t TASKS_SEQSTART[2]; /*!< Description collection[0]: Loads the first PWM value on all + enabled channels from sequence 0, and starts playing that sequence + at the rate defined in SEQ[0]REFRESH and/or DECODER.MODE. Causes + PWM generation to start it was not running. */ + __O uint32_t TASKS_NEXTSTEP; /*!< Steps by one value in the current sequence on all enabled channels + if DECODER.MODE=NextStep. Does not cause PWM generation to start + it was not running. */ + __I uint32_t RESERVED1[60]; + __IO uint32_t EVENTS_STOPPED; /*!< Response to STOP task, emitted when PWM pulses are no longer + generated */ + __IO uint32_t EVENTS_SEQSTARTED[2]; /*!< Description collection[0]: First PWM period started on sequence + 0 */ + __IO uint32_t EVENTS_SEQEND[2]; /*!< Description collection[0]: Emitted at end of every sequence + 0, when last value from RAM has been applied to wave counter */ + __IO uint32_t EVENTS_PWMPERIODEND; /*!< Emitted at the end of each PWM period */ + __IO uint32_t EVENTS_LOOPSDONE; /*!< Concatenated sequences have been played the amount of times + defined in LOOP.CNT */ + __I uint32_t RESERVED2[56]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED3[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED4[125]; + __IO uint32_t ENABLE; /*!< PWM module enable register */ + __IO uint32_t MODE; /*!< Selects operating mode of the wave counter */ + __IO uint32_t COUNTERTOP; /*!< Value up to which the pulse generator counter counts */ + __IO uint32_t PRESCALER; /*!< Configuration for PWM_CLK */ + __IO uint32_t DECODER; /*!< Configuration of the decoder */ + __IO uint32_t LOOP; /*!< Amount of playback of a loop */ + __I uint32_t RESERVED5[2]; + PWM_SEQ_Type SEQ[2]; /*!< Unspecified */ + PWM_PSEL_Type PSEL; /*!< Unspecified */ +} NRF_PWM_Type; + + +/* ================================================================================ */ +/* ================ PDM ================ */ +/* ================================================================================ */ + + +/** + * @brief Pulse Density Modulation (Digital Microphone) Interface (PDM) + */ + +typedef struct { /*!< PDM Structure */ + __O uint32_t TASKS_START; /*!< Starts continuous PDM transfer */ + __O uint32_t TASKS_STOP; /*!< Stops PDM transfer */ + __I uint32_t RESERVED0[62]; + __IO uint32_t EVENTS_STARTED; /*!< PDM transfer has started */ + __IO uint32_t EVENTS_STOPPED; /*!< PDM transfer has finished */ + __IO uint32_t EVENTS_END; /*!< The PDM has written the last sample specified by SAMPLE.MAXCNT + (or the last sample after a STOP task has been received) to + Data RAM */ + __I uint32_t RESERVED1[125]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[125]; + __IO uint32_t ENABLE; /*!< PDM module enable register */ + __IO uint32_t PDMCLKCTRL; /*!< PDM clock generator control */ + __IO uint32_t MODE; /*!< Defines the routing of the connected PDM microphones' signals */ + __I uint32_t RESERVED3[3]; + __IO uint32_t GAINL; /*!< Left output gain adjustment */ + __IO uint32_t GAINR; /*!< Right output gain adjustment */ + __IO uint32_t RATIO; /*!< Selects the ratio between PDM_CLK and output sample rate. Change + PDMCLKCTRL accordingly. */ + __I uint32_t RESERVED4[7]; + PDM_PSEL_Type PSEL; /*!< Unspecified */ + __I uint32_t RESERVED5[6]; + PDM_SAMPLE_Type SAMPLE; /*!< Unspecified */ +} NRF_PDM_Type; + + +/* ================================================================================ */ +/* ================ NVMC ================ */ +/* ================================================================================ */ + + +/** + * @brief Non Volatile Memory Controller (NVMC) + */ + +typedef struct { /*!< NVMC Structure */ + __I uint32_t RESERVED0[256]; + __I uint32_t READY; /*!< Ready flag */ + __I uint32_t RESERVED1[64]; + __IO uint32_t CONFIG; /*!< Configuration register */ + + union { + __IO uint32_t ERASEPCR1; /*!< Deprecated register - Register for erasing a page in Code area. + Equivalent to ERASEPAGE. */ + __IO uint32_t ERASEPAGE; /*!< Register for erasing a page in Code area */ + }; + __IO uint32_t ERASEALL; /*!< Register for erasing all non-volatile user memory */ + __IO uint32_t ERASEPCR0; /*!< Deprecated register - Register for erasing a page in Code area. + Equivalent to ERASEPAGE. */ + __IO uint32_t ERASEUICR; /*!< Register for erasing User Information Configuration Registers */ + __I uint32_t RESERVED2[10]; + __IO uint32_t ICACHECNF; /*!< I-Code cache configuration register. */ + __I uint32_t RESERVED3; + __IO uint32_t IHIT; /*!< I-Code cache hit counter. */ + __IO uint32_t IMISS; /*!< I-Code cache miss counter. */ +} NRF_NVMC_Type; + + +/* ================================================================================ */ +/* ================ ACL ================ */ +/* ================================================================================ */ + + +/** + * @brief Access control lists (ACL) + */ + +typedef struct { /*!< ACL Structure */ + __I uint32_t RESERVED0[449]; + __IO uint32_t DISABLEINDEBUG; /*!< Disable all ACL protection mechanisms for regions while in debug + mode */ + __I uint32_t RESERVED1[62]; + ACL_ACL_Type ACL[8]; /*!< Unspecified */ +} NRF_ACL_Type; + + +/* ================================================================================ */ +/* ================ PPI ================ */ +/* ================================================================================ */ + + +/** + * @brief Programmable Peripheral Interconnect (PPI) + */ + +typedef struct { /*!< PPI Structure */ + PPI_TASKS_CHG_Type TASKS_CHG[6]; /*!< Channel group tasks */ + __I uint32_t RESERVED0[308]; + __IO uint32_t CHEN; /*!< Channel enable register */ + __IO uint32_t CHENSET; /*!< Channel enable set register */ + __IO uint32_t CHENCLR; /*!< Channel enable clear register */ + __I uint32_t RESERVED1; + PPI_CH_Type CH[20]; /*!< PPI Channel */ + __I uint32_t RESERVED2[148]; + __IO uint32_t CHG[6]; /*!< Description collection[0]: Channel group 0 */ + __I uint32_t RESERVED3[62]; + PPI_FORK_Type FORK[32]; /*!< Fork */ +} NRF_PPI_Type; + + +/* ================================================================================ */ +/* ================ MWU ================ */ +/* ================================================================================ */ + + +/** + * @brief Memory Watch Unit (MWU) + */ + +typedef struct { /*!< MWU Structure */ + __I uint32_t RESERVED0[64]; + MWU_EVENTS_REGION_Type EVENTS_REGION[4]; /*!< Unspecified */ + __I uint32_t RESERVED1[16]; + MWU_EVENTS_PREGION_Type EVENTS_PREGION[2]; /*!< Unspecified */ + __I uint32_t RESERVED2[100]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[5]; + __IO uint32_t NMIEN; /*!< Enable or disable non-maskable interrupt */ + __IO uint32_t NMIENSET; /*!< Enable non-maskable interrupt */ + __IO uint32_t NMIENCLR; /*!< Disable non-maskable interrupt */ + __I uint32_t RESERVED4[53]; + MWU_PERREGION_Type PERREGION[2]; /*!< Unspecified */ + __I uint32_t RESERVED5[64]; + __IO uint32_t REGIONEN; /*!< Enable/disable regions watch */ + __IO uint32_t REGIONENSET; /*!< Enable regions watch */ + __IO uint32_t REGIONENCLR; /*!< Disable regions watch */ + __I uint32_t RESERVED6[57]; + MWU_REGION_Type REGION[4]; /*!< Unspecified */ + __I uint32_t RESERVED7[32]; + MWU_PREGION_Type PREGION[2]; /*!< Unspecified */ +} NRF_MWU_Type; + + +/* ================================================================================ */ +/* ================ I2S ================ */ +/* ================================================================================ */ + + +/** + * @brief Inter-IC Sound (I2S) + */ + +typedef struct { /*!< I2S Structure */ + __O uint32_t TASKS_START; /*!< Starts continuous I2S transfer. Also starts MCK generator when + this is enabled. */ + __O uint32_t TASKS_STOP; /*!< Stops I2S transfer. Also stops MCK generator. Triggering this + task will cause the {event:STOPPED} event to be generated. */ + __I uint32_t RESERVED0[63]; + __IO uint32_t EVENTS_RXPTRUPD; /*!< The RXD.PTR register has been copied to internal double-buffers. + When the I2S module is started and RX is enabled, this event + will be generated for every RXTXD.MAXCNT words that are received + on the SDIN pin. */ + __IO uint32_t EVENTS_STOPPED; /*!< I2S transfer stopped. */ + __I uint32_t RESERVED1[2]; + __IO uint32_t EVENTS_TXPTRUPD; /*!< The TDX.PTR register has been copied to internal double-buffers. + When the I2S module is started and TX is enabled, this event + will be generated for every RXTXD.MAXCNT words that are sent + on the SDOUT pin. */ + __I uint32_t RESERVED2[122]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED3[125]; + __IO uint32_t ENABLE; /*!< Enable I2S module. */ + I2S_CONFIG_Type CONFIG; /*!< Unspecified */ + __I uint32_t RESERVED4[3]; + I2S_RXD_Type RXD; /*!< Unspecified */ + __I uint32_t RESERVED5; + I2S_TXD_Type TXD; /*!< Unspecified */ + __I uint32_t RESERVED6[3]; + I2S_RXTXD_Type RXTXD; /*!< Unspecified */ + __I uint32_t RESERVED7[3]; + I2S_PSEL_Type PSEL; /*!< Unspecified */ +} NRF_I2S_Type; + + +/* ================================================================================ */ +/* ================ FPU ================ */ +/* ================================================================================ */ + + +/** + * @brief FPU (FPU) + */ + +typedef struct { /*!< FPU Structure */ + __I uint32_t UNUSED; /*!< Unused. */ +} NRF_FPU_Type; + + +/* ================================================================================ */ +/* ================ USBD ================ */ +/* ================================================================================ */ + + +/** + * @brief Universal Serial Bus device (USBD) + */ + +typedef struct { /*!< USBD Structure */ + __I uint32_t RESERVED0; + __O uint32_t TASKS_STARTEPIN[8]; /*!< Description collection[0]: Captures the EPIN[0].PTR, EPIN[0].MAXCNT + and EPIN[0].CONFIG registers values, and enables endpoint IN + 0 to respond to traffic from host */ + __O uint32_t TASKS_STARTISOIN; /*!< Captures the ISOIN.PTR, ISOIN.MAXCNT and ISOIN.CONFIG registers + values, and enables sending data on iso endpoint */ + __O uint32_t TASKS_STARTEPOUT[8]; /*!< Description collection[0]: Captures the EPOUT[0].PTR, EPOUT[0].MAXCNT + and EPOUT[0].CONFIG registers values, and enables endpoint 0 + to respond to traffic from host */ + __O uint32_t TASKS_STARTISOOUT; /*!< Captures the ISOOUT.PTR, ISOOUT.MAXCNT and ISOOUT.CONFIG registers + values, and enables receiving of data on iso endpoint */ + __O uint32_t TASKS_EP0RCVOUT; /*!< Allows OUT data stage on control endpoint 0 */ + __O uint32_t TASKS_EP0STATUS; /*!< Allows status stage on control endpoint 0 */ + __O uint32_t TASKS_EP0STALL; /*!< STALLs data and status stage on control endpoint 0 */ + __O uint32_t TASKS_DPDMDRIVE; /*!< Forces D+ and D-lines to the state defined in the DPDMVALUE + register */ + __O uint32_t TASKS_DPDMNODRIVE; /*!< Stops forcing D+ and D- lines to any state (USB engine takes + control) */ + __I uint32_t RESERVED1[40]; + __IO uint32_t EVENTS_USBRESET; /*!< Signals that a USB reset condition has been detected on the + USB lines */ + __IO uint32_t EVENTS_STARTED; /*!< Confirms that the EPIN[n].PTR, EPIN[n].MAXCNT, EPIN[n].CONFIG, + or EPOUT[n].PTR, EPOUT[n].MAXCNT and EPOUT[n].CONFIG registers + have been captured on all endpoints reported in the EPSTATUS + register */ + __IO uint32_t EVENTS_ENDEPIN[8]; /*!< Description collection[0]: The whole EPIN[0] buffer has been + consumed. The RAM buffer can be accessed safely by software. */ + __IO uint32_t EVENTS_EP0DATADONE; /*!< An acknowledged data transfer has taken place on the control + endpoint */ + __IO uint32_t EVENTS_ENDISOIN; /*!< The whole ISOIN buffer has been consumed. The RAM buffer can + be accessed safely by software. */ + __IO uint32_t EVENTS_ENDEPOUT[8]; /*!< Description collection[0]: The whole EPOUT[0] buffer has been + consumed. The RAM buffer can be accessed safely by software. */ + __IO uint32_t EVENTS_ENDISOOUT; /*!< The whole ISOOUT buffer has been consumed. The RAM buffer can + be accessed safely by software. */ + __IO uint32_t EVENTS_SOF; /*!< Signals that a SOF (start of frame) condition has been detected + on the USB lines */ + __IO uint32_t EVENTS_USBEVENT; /*!< An event or an error not covered by specific events has occurred, + check EVENTCAUSE register to find the cause */ + __IO uint32_t EVENTS_EP0SETUP; /*!< A valid SETUP token has been received (and acknowledged) on + the control endpoint */ + __IO uint32_t EVENTS_EPDATA; /*!< A data transfer has occurred on a data endpoint, indicated by + the EPDATASTATUS register */ + __IO uint32_t EVENTS_ACCESSFAULT; /*!< Access to an unavailable USB register has been attempted (software + or EasyDMA). This event can get fired even when USBD is not + ENABLEd. */ + __I uint32_t RESERVED2[38]; + __IO uint32_t SHORTS; /*!< Shortcut register */ + __I uint32_t RESERVED3[63]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED4[61]; + __IO uint32_t EVENTCAUSE; /*!< Details on event that caused the USBEVENT event */ + __I uint32_t BUSSTATE; /*!< Provides the logic state of the D+ and D- lines */ + __I uint32_t RESERVED5[6]; + USBD_HALTED_Type HALTED; /*!< Unspecified */ + __I uint32_t RESERVED6; + __IO uint32_t EPSTATUS; /*!< Provides information on which endpoint's EasyDMA registers have + been captured */ + __IO uint32_t EPDATASTATUS; /*!< Provides information on which endpoint(s) an acknowledged data + transfer has occurred (EPDATA event) */ + __I uint32_t USBADDR; /*!< Device USB address */ + __I uint32_t RESERVED7[3]; + __I uint32_t BMREQUESTTYPE; /*!< SETUP data, byte 0, bmRequestType */ + __I uint32_t BREQUEST; /*!< SETUP data, byte 1, bRequest */ + __I uint32_t WVALUEL; /*!< SETUP data, byte 2, LSB of wValue */ + __I uint32_t WVALUEH; /*!< SETUP data, byte 3, MSB of wValue */ + __I uint32_t WINDEXL; /*!< SETUP data, byte 4, LSB of wIndex */ + __I uint32_t WINDEXH; /*!< SETUP data, byte 5, MSB of wIndex */ + __I uint32_t WLENGTHL; /*!< SETUP data, byte 6, LSB of wLength */ + __I uint32_t WLENGTHH; /*!< SETUP data, byte 7, MSB of wLength */ + USBD_SIZE_Type SIZE; /*!< Unspecified */ + __I uint32_t RESERVED8[15]; + __IO uint32_t ENABLE; /*!< Enable USB */ + __IO uint32_t USBPULLUP; /*!< Control of the USB pull-up */ + __IO uint32_t DPDMVALUE; /*!< State at which the DPDMDRIVE task will force D+ and D-. The + DPDMNODRIVE task reverts the control of the lines to MAC IP + (no forcing). */ + __IO uint32_t DTOGGLE; /*!< Data toggle control and status. */ + __IO uint32_t EPINEN; /*!< Endpoint IN enable */ + __IO uint32_t EPOUTEN; /*!< Endpoint OUT enable */ + __O uint32_t EPSTALL; /*!< STALL endpoints */ + __IO uint32_t ISOSPLIT; /*!< Controls the split of ISO buffers */ + __I uint32_t FRAMECNTR; /*!< Returns the current value of the start of frame counter */ + __I uint32_t RESERVED9[3]; + __IO uint32_t ISOINCONFIG; /*!< Controls the response of the ISO IN endpoint to an IN token + when no data is ready to be sent */ + __I uint32_t RESERVED10[51]; + USBD_EPIN_Type EPIN[8]; /*!< Unspecified */ + USBD_ISOIN_Type ISOIN; /*!< Unspecified */ + __I uint32_t RESERVED11[21]; + USBD_EPOUT_Type EPOUT[8]; /*!< Unspecified */ + USBD_ISOOUT_Type ISOOUT; /*!< Unspecified */ +} NRF_USBD_Type; + + +/* ================================================================================ */ +/* ================ QSPI ================ */ +/* ================================================================================ */ + + +/** + * @brief External flash interface (QSPI) + */ + +typedef struct { /*!< QSPI Structure */ + __O uint32_t TASKS_ACTIVATE; /*!< Activate QSPI interface */ + __O uint32_t TASKS_READSTART; /*!< Start transfer from external flash memory to internal RAM */ + __O uint32_t TASKS_WRITESTART; /*!< Start transfer from internal RAM to external flash memory */ + __O uint32_t TASKS_ERASESTART; /*!< Start external flash memory erase operation */ + __I uint32_t RESERVED0[60]; + __IO uint32_t EVENTS_READY; /*!< QSPI peripheral is ready. This event will be generated as a + response to any QSPI task. */ + __I uint32_t RESERVED1[127]; + __IO uint32_t INTEN; /*!< Enable or disable interrupt */ + __IO uint32_t INTENSET; /*!< Enable interrupt */ + __IO uint32_t INTENCLR; /*!< Disable interrupt */ + __I uint32_t RESERVED2[125]; + __IO uint32_t ENABLE; /*!< Enable QSPI peripheral and acquire the pins selected in PSELn + registers */ + QSPI_READ_Type READ; /*!< Unspecified */ + QSPI_WRITE_Type WRITE; /*!< Unspecified */ + QSPI_ERASE_Type ERASE; /*!< Unspecified */ + QSPI_PSEL_Type PSEL; /*!< Unspecified */ + __IO uint32_t XIPOFFSET; /*!< Address offset into the external memory for Execute in Place + operation. */ + __IO uint32_t IFCONFIG0; /*!< Interface configuration. */ + __I uint32_t RESERVED3[46]; + __IO uint32_t IFCONFIG1; /*!< Interface configuration. */ + __I uint32_t STATUS; /*!< Status register. */ + __I uint32_t RESERVED4[3]; + __IO uint32_t DPMDUR; /*!< Set the duration required to enter/exit deep power-down mode + (DPM). */ + __I uint32_t RESERVED5[3]; + __IO uint32_t ADDRCONF; /*!< Extended address configuration. */ + __I uint32_t RESERVED6[3]; + __IO uint32_t CINSTRCONF; /*!< Custom instruction configuration register. */ + __IO uint32_t CINSTRDAT0; /*!< Custom instruction data register 0. */ + __IO uint32_t CINSTRDAT1; /*!< Custom instruction data register 1. */ + __IO uint32_t IFTIMING; /*!< SPI interface timing. */ +} NRF_QSPI_Type; + + +/* ================================================================================ */ +/* ================ GPIO ================ */ +/* ================================================================================ */ + + +/** + * @brief GPIO Port 1 (GPIO) + */ + +typedef struct { /*!< GPIO Structure */ + __I uint32_t RESERVED0[321]; + __IO uint32_t OUT; /*!< Write GPIO port */ + __IO uint32_t OUTSET; /*!< Set individual bits in GPIO port */ + __IO uint32_t OUTCLR; /*!< Clear individual bits in GPIO port */ + __I uint32_t IN; /*!< Read GPIO port */ + __IO uint32_t DIR; /*!< Direction of GPIO pins */ + __IO uint32_t DIRSET; /*!< DIR set register */ + __IO uint32_t DIRCLR; /*!< DIR clear register */ + __IO uint32_t LATCH; /*!< Latch register indicating what GPIO pins that have met the criteria + set in the PIN_CNF[n].SENSE registers */ + __IO uint32_t DETECTMODE; /*!< Select between default DETECT signal behaviour and LDETECT mode */ + __I uint32_t RESERVED1[118]; + __IO uint32_t PIN_CNF[32]; /*!< Description collection[0]: Configuration of GPIO pins */ +} NRF_GPIO_Type; + + +/* ================================================================================ */ +/* ================ CRYPTOCELL ================ */ +/* ================================================================================ */ + + +/** + * @brief ARM CryptoCell register interface (CRYPTOCELL) + */ + +typedef struct { /*!< CRYPTOCELL Structure */ + __I uint32_t RESERVED0[320]; + __IO uint32_t ENABLE; /*!< Control power and clock for ARM CryptoCell subsystem */ +} NRF_CRYPTOCELL_Type; + + +/* -------------------- End of section using anonymous unions ------------------- */ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + /* leave anonymous unions enabled */ +#elif defined(__GNUC__) + /* anonymous unions are enabled by default */ +#elif defined(__TMS470__) + /* anonymous unions are enabled by default */ +#elif defined(__TASKING__) + #pragma warning restore +#else + #warning Not supported compiler type +#endif + + + + +/* ================================================================================ */ +/* ================ Peripheral memory map ================ */ +/* ================================================================================ */ + +#define NRF_FICR_BASE 0x10000000UL +#define NRF_UICR_BASE 0x10001000UL +#define NRF_POWER_BASE 0x40000000UL +#define NRF_CLOCK_BASE 0x40000000UL +#define NRF_RADIO_BASE 0x40001000UL +#define NRF_UARTE0_BASE 0x40002000UL +#define NRF_UART0_BASE 0x40002000UL +#define NRF_SPIM0_BASE 0x40003000UL +#define NRF_SPIS0_BASE 0x40003000UL +#define NRF_TWIM0_BASE 0x40003000UL +#define NRF_TWIS0_BASE 0x40003000UL +#define NRF_SPI0_BASE 0x40003000UL +#define NRF_TWI0_BASE 0x40003000UL +#define NRF_SPIM1_BASE 0x40004000UL +#define NRF_SPIS1_BASE 0x40004000UL +#define NRF_TWIM1_BASE 0x40004000UL +#define NRF_TWIS1_BASE 0x40004000UL +#define NRF_SPI1_BASE 0x40004000UL +#define NRF_TWI1_BASE 0x40004000UL +#define NRF_NFCT_BASE 0x40005000UL +#define NRF_GPIOTE_BASE 0x40006000UL +#define NRF_SAADC_BASE 0x40007000UL +#define NRF_TIMER0_BASE 0x40008000UL +#define NRF_TIMER1_BASE 0x40009000UL +#define NRF_TIMER2_BASE 0x4000A000UL +#define NRF_RTC0_BASE 0x4000B000UL +#define NRF_TEMP_BASE 0x4000C000UL +#define NRF_RNG_BASE 0x4000D000UL +#define NRF_ECB_BASE 0x4000E000UL +#define NRF_CCM_BASE 0x4000F000UL +#define NRF_AAR_BASE 0x4000F000UL +#define NRF_WDT_BASE 0x40010000UL +#define NRF_RTC1_BASE 0x40011000UL +#define NRF_QDEC_BASE 0x40012000UL +#define NRF_COMP_BASE 0x40013000UL +#define NRF_LPCOMP_BASE 0x40013000UL +#define NRF_SWI0_BASE 0x40014000UL +#define NRF_EGU0_BASE 0x40014000UL +#define NRF_SWI1_BASE 0x40015000UL +#define NRF_EGU1_BASE 0x40015000UL +#define NRF_SWI2_BASE 0x40016000UL +#define NRF_EGU2_BASE 0x40016000UL +#define NRF_SWI3_BASE 0x40017000UL +#define NRF_EGU3_BASE 0x40017000UL +#define NRF_SWI4_BASE 0x40018000UL +#define NRF_EGU4_BASE 0x40018000UL +#define NRF_SWI5_BASE 0x40019000UL +#define NRF_EGU5_BASE 0x40019000UL +#define NRF_TIMER3_BASE 0x4001A000UL +#define NRF_TIMER4_BASE 0x4001B000UL +#define NRF_PWM0_BASE 0x4001C000UL +#define NRF_PDM_BASE 0x4001D000UL +#define NRF_NVMC_BASE 0x4001E000UL +#define NRF_ACL_BASE 0x4001E000UL +#define NRF_PPI_BASE 0x4001F000UL +#define NRF_MWU_BASE 0x40020000UL +#define NRF_PWM1_BASE 0x40021000UL +#define NRF_PWM2_BASE 0x40022000UL +#define NRF_SPIM2_BASE 0x40023000UL +#define NRF_SPIS2_BASE 0x40023000UL +#define NRF_SPI2_BASE 0x40023000UL +#define NRF_RTC2_BASE 0x40024000UL +#define NRF_I2S_BASE 0x40025000UL +#define NRF_FPU_BASE 0x40026000UL +#define NRF_USBD_BASE 0x40027000UL +#define NRF_UARTE1_BASE 0x40028000UL +#define NRF_QSPI_BASE 0x40029000UL +#define NRF_SPIM3_BASE 0x4002B000UL +#define NRF_PWM3_BASE 0x4002D000UL +#define NRF_P0_BASE 0x50000000UL +#define NRF_P1_BASE 0x50000300UL +#define NRF_CRYPTOCELL_BASE 0x5002A000UL + + +/* ================================================================================ */ +/* ================ Peripheral declaration ================ */ +/* ================================================================================ */ + +#define NRF_FICR ((NRF_FICR_Type *) NRF_FICR_BASE) +#define NRF_UICR ((NRF_UICR_Type *) NRF_UICR_BASE) +#define NRF_POWER ((NRF_POWER_Type *) NRF_POWER_BASE) +#define NRF_CLOCK ((NRF_CLOCK_Type *) NRF_CLOCK_BASE) +#define NRF_RADIO ((NRF_RADIO_Type *) NRF_RADIO_BASE) +#define NRF_UARTE0 ((NRF_UARTE_Type *) NRF_UARTE0_BASE) +#define NRF_UART0 ((NRF_UART_Type *) NRF_UART0_BASE) +#define NRF_SPIM0 ((NRF_SPIM_Type *) NRF_SPIM0_BASE) +#define NRF_SPIS0 ((NRF_SPIS_Type *) NRF_SPIS0_BASE) +#define NRF_TWIM0 ((NRF_TWIM_Type *) NRF_TWIM0_BASE) +#define NRF_TWIS0 ((NRF_TWIS_Type *) NRF_TWIS0_BASE) +#define NRF_SPI0 ((NRF_SPI_Type *) NRF_SPI0_BASE) +#define NRF_TWI0 ((NRF_TWI_Type *) NRF_TWI0_BASE) +#define NRF_SPIM1 ((NRF_SPIM_Type *) NRF_SPIM1_BASE) +#define NRF_SPIS1 ((NRF_SPIS_Type *) NRF_SPIS1_BASE) +#define NRF_TWIM1 ((NRF_TWIM_Type *) NRF_TWIM1_BASE) +#define NRF_TWIS1 ((NRF_TWIS_Type *) NRF_TWIS1_BASE) +#define NRF_SPI1 ((NRF_SPI_Type *) NRF_SPI1_BASE) +#define NRF_TWI1 ((NRF_TWI_Type *) NRF_TWI1_BASE) +#define NRF_NFCT ((NRF_NFCT_Type *) NRF_NFCT_BASE) +#define NRF_GPIOTE ((NRF_GPIOTE_Type *) NRF_GPIOTE_BASE) +#define NRF_SAADC ((NRF_SAADC_Type *) NRF_SAADC_BASE) +#define NRF_TIMER0 ((NRF_TIMER_Type *) NRF_TIMER0_BASE) +#define NRF_TIMER1 ((NRF_TIMER_Type *) NRF_TIMER1_BASE) +#define NRF_TIMER2 ((NRF_TIMER_Type *) NRF_TIMER2_BASE) +#define NRF_RTC0 ((NRF_RTC_Type *) NRF_RTC0_BASE) +#define NRF_TEMP ((NRF_TEMP_Type *) NRF_TEMP_BASE) +#define NRF_RNG ((NRF_RNG_Type *) NRF_RNG_BASE) +#define NRF_ECB ((NRF_ECB_Type *) NRF_ECB_BASE) +#define NRF_CCM ((NRF_CCM_Type *) NRF_CCM_BASE) +#define NRF_AAR ((NRF_AAR_Type *) NRF_AAR_BASE) +#define NRF_WDT ((NRF_WDT_Type *) NRF_WDT_BASE) +#define NRF_RTC1 ((NRF_RTC_Type *) NRF_RTC1_BASE) +#define NRF_QDEC ((NRF_QDEC_Type *) NRF_QDEC_BASE) +#define NRF_COMP ((NRF_COMP_Type *) NRF_COMP_BASE) +#define NRF_LPCOMP ((NRF_LPCOMP_Type *) NRF_LPCOMP_BASE) +#define NRF_SWI0 ((NRF_SWI_Type *) NRF_SWI0_BASE) +#define NRF_EGU0 ((NRF_EGU_Type *) NRF_EGU0_BASE) +#define NRF_SWI1 ((NRF_SWI_Type *) NRF_SWI1_BASE) +#define NRF_EGU1 ((NRF_EGU_Type *) NRF_EGU1_BASE) +#define NRF_SWI2 ((NRF_SWI_Type *) NRF_SWI2_BASE) +#define NRF_EGU2 ((NRF_EGU_Type *) NRF_EGU2_BASE) +#define NRF_SWI3 ((NRF_SWI_Type *) NRF_SWI3_BASE) +#define NRF_EGU3 ((NRF_EGU_Type *) NRF_EGU3_BASE) +#define NRF_SWI4 ((NRF_SWI_Type *) NRF_SWI4_BASE) +#define NRF_EGU4 ((NRF_EGU_Type *) NRF_EGU4_BASE) +#define NRF_SWI5 ((NRF_SWI_Type *) NRF_SWI5_BASE) +#define NRF_EGU5 ((NRF_EGU_Type *) NRF_EGU5_BASE) +#define NRF_TIMER3 ((NRF_TIMER_Type *) NRF_TIMER3_BASE) +#define NRF_TIMER4 ((NRF_TIMER_Type *) NRF_TIMER4_BASE) +#define NRF_PWM0 ((NRF_PWM_Type *) NRF_PWM0_BASE) +#define NRF_PDM ((NRF_PDM_Type *) NRF_PDM_BASE) +#define NRF_NVMC ((NRF_NVMC_Type *) NRF_NVMC_BASE) +#define NRF_ACL ((NRF_ACL_Type *) NRF_ACL_BASE) +#define NRF_PPI ((NRF_PPI_Type *) NRF_PPI_BASE) +#define NRF_MWU ((NRF_MWU_Type *) NRF_MWU_BASE) +#define NRF_PWM1 ((NRF_PWM_Type *) NRF_PWM1_BASE) +#define NRF_PWM2 ((NRF_PWM_Type *) NRF_PWM2_BASE) +#define NRF_SPIM2 ((NRF_SPIM_Type *) NRF_SPIM2_BASE) +#define NRF_SPIS2 ((NRF_SPIS_Type *) NRF_SPIS2_BASE) +#define NRF_SPI2 ((NRF_SPI_Type *) NRF_SPI2_BASE) +#define NRF_RTC2 ((NRF_RTC_Type *) NRF_RTC2_BASE) +#define NRF_I2S ((NRF_I2S_Type *) NRF_I2S_BASE) +#define NRF_FPU ((NRF_FPU_Type *) NRF_FPU_BASE) +#define NRF_USBD ((NRF_USBD_Type *) NRF_USBD_BASE) +#define NRF_UARTE1 ((NRF_UARTE_Type *) NRF_UARTE1_BASE) +#define NRF_QSPI ((NRF_QSPI_Type *) NRF_QSPI_BASE) +#define NRF_SPIM3 ((NRF_SPIM_Type *) NRF_SPIM3_BASE) +#define NRF_PWM3 ((NRF_PWM_Type *) NRF_PWM3_BASE) +#define NRF_P0 ((NRF_GPIO_Type *) NRF_P0_BASE) +#define NRF_P1 ((NRF_GPIO_Type *) NRF_P1_BASE) +#define NRF_CRYPTOCELL ((NRF_CRYPTOCELL_Type *) NRF_CRYPTOCELL_BASE) + + +/** @} */ /* End of group Device_Peripheral_Registers */ +/** @} */ /* End of group nrf52840 */ +/** @} */ /* End of group Nordic Semiconductor */ + +#ifdef __cplusplus +} +#endif + + +#endif /* nrf52840_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840_bitfields.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840_bitfields.h new file mode 100644 index 0000000000..3c71d50578 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840_bitfields.h @@ -0,0 +1,14641 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __NRF52840_BITS_H +#define __NRF52840_BITS_H + +/*lint ++flb "Enter library region" */ + +/* Peripheral: AAR */ +/* Description: Accelerated Address Resolver */ + +/* Register: AAR_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 2 : Write '1' to Enable interrupt for NOTRESOLVED event */ +#define AAR_INTENSET_NOTRESOLVED_Pos (2UL) /*!< Position of NOTRESOLVED field. */ +#define AAR_INTENSET_NOTRESOLVED_Msk (0x1UL << AAR_INTENSET_NOTRESOLVED_Pos) /*!< Bit mask of NOTRESOLVED field. */ +#define AAR_INTENSET_NOTRESOLVED_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENSET_NOTRESOLVED_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENSET_NOTRESOLVED_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for RESOLVED event */ +#define AAR_INTENSET_RESOLVED_Pos (1UL) /*!< Position of RESOLVED field. */ +#define AAR_INTENSET_RESOLVED_Msk (0x1UL << AAR_INTENSET_RESOLVED_Pos) /*!< Bit mask of RESOLVED field. */ +#define AAR_INTENSET_RESOLVED_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENSET_RESOLVED_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENSET_RESOLVED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for END event */ +#define AAR_INTENSET_END_Pos (0UL) /*!< Position of END field. */ +#define AAR_INTENSET_END_Msk (0x1UL << AAR_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define AAR_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Register: AAR_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 2 : Write '1' to Disable interrupt for NOTRESOLVED event */ +#define AAR_INTENCLR_NOTRESOLVED_Pos (2UL) /*!< Position of NOTRESOLVED field. */ +#define AAR_INTENCLR_NOTRESOLVED_Msk (0x1UL << AAR_INTENCLR_NOTRESOLVED_Pos) /*!< Bit mask of NOTRESOLVED field. */ +#define AAR_INTENCLR_NOTRESOLVED_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENCLR_NOTRESOLVED_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENCLR_NOTRESOLVED_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for RESOLVED event */ +#define AAR_INTENCLR_RESOLVED_Pos (1UL) /*!< Position of RESOLVED field. */ +#define AAR_INTENCLR_RESOLVED_Msk (0x1UL << AAR_INTENCLR_RESOLVED_Pos) /*!< Bit mask of RESOLVED field. */ +#define AAR_INTENCLR_RESOLVED_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENCLR_RESOLVED_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENCLR_RESOLVED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for END event */ +#define AAR_INTENCLR_END_Pos (0UL) /*!< Position of END field. */ +#define AAR_INTENCLR_END_Msk (0x1UL << AAR_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define AAR_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define AAR_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define AAR_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Register: AAR_STATUS */ +/* Description: Resolution status */ + +/* Bits 3..0 : The IRK that was used last time an address was resolved */ +#define AAR_STATUS_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define AAR_STATUS_STATUS_Msk (0xFUL << AAR_STATUS_STATUS_Pos) /*!< Bit mask of STATUS field. */ + +/* Register: AAR_ENABLE */ +/* Description: Enable AAR */ + +/* Bits 1..0 : Enable or disable AAR */ +#define AAR_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define AAR_ENABLE_ENABLE_Msk (0x3UL << AAR_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define AAR_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define AAR_ENABLE_ENABLE_Enabled (3UL) /*!< Enable */ + +/* Register: AAR_NIRK */ +/* Description: Number of IRKs */ + +/* Bits 4..0 : Number of Identity root keys available in the IRK data structure */ +#define AAR_NIRK_NIRK_Pos (0UL) /*!< Position of NIRK field. */ +#define AAR_NIRK_NIRK_Msk (0x1FUL << AAR_NIRK_NIRK_Pos) /*!< Bit mask of NIRK field. */ + +/* Register: AAR_IRKPTR */ +/* Description: Pointer to IRK data structure */ + +/* Bits 31..0 : Pointer to the IRK data structure */ +#define AAR_IRKPTR_IRKPTR_Pos (0UL) /*!< Position of IRKPTR field. */ +#define AAR_IRKPTR_IRKPTR_Msk (0xFFFFFFFFUL << AAR_IRKPTR_IRKPTR_Pos) /*!< Bit mask of IRKPTR field. */ + +/* Register: AAR_ADDRPTR */ +/* Description: Pointer to the resolvable address */ + +/* Bits 31..0 : Pointer to the resolvable address (6-bytes) */ +#define AAR_ADDRPTR_ADDRPTR_Pos (0UL) /*!< Position of ADDRPTR field. */ +#define AAR_ADDRPTR_ADDRPTR_Msk (0xFFFFFFFFUL << AAR_ADDRPTR_ADDRPTR_Pos) /*!< Bit mask of ADDRPTR field. */ + +/* Register: AAR_SCRATCHPTR */ +/* Description: Pointer to data area used for temporary storage */ + +/* Bits 31..0 : Pointer to a scratch data area used for temporary storage during resolution.A space of minimum 3 bytes must be reserved. */ +#define AAR_SCRATCHPTR_SCRATCHPTR_Pos (0UL) /*!< Position of SCRATCHPTR field. */ +#define AAR_SCRATCHPTR_SCRATCHPTR_Msk (0xFFFFFFFFUL << AAR_SCRATCHPTR_SCRATCHPTR_Pos) /*!< Bit mask of SCRATCHPTR field. */ + + +/* Peripheral: ACL */ +/* Description: Access control lists */ + +/* Register: ACL_DISABLEINDEBUG */ +/* Description: Disable all ACL protection mechanisms for regions while in debug mode */ + +/* Bit 0 : Disable the protection mechanism for regions while in debug mode. */ +#define ACL_DISABLEINDEBUG_DISABLEINDEBUG_Pos (0UL) /*!< Position of DISABLEINDEBUG field. */ +#define ACL_DISABLEINDEBUG_DISABLEINDEBUG_Msk (0x1UL << ACL_DISABLEINDEBUG_DISABLEINDEBUG_Pos) /*!< Bit mask of DISABLEINDEBUG field. */ +#define ACL_DISABLEINDEBUG_DISABLEINDEBUG_Enabled (0UL) /*!< ACL is enabled in debug mode */ +#define ACL_DISABLEINDEBUG_DISABLEINDEBUG_Disabled (1UL) /*!< ACL is disabled in debug mode */ + +/* Register: ACL_ACL_ADDR */ +/* Description: Description cluster[0]: Configure the word-aligned start address of region 0 to protect */ + +/* Bits 31..0 : Valid word-aligned start address of region 0 to protect. Address must point to a flash page boundary. */ +#define ACL_ACL_ADDR_ADDR_Pos (0UL) /*!< Position of ADDR field. */ +#define ACL_ACL_ADDR_ADDR_Msk (0xFFFFFFFFUL << ACL_ACL_ADDR_ADDR_Pos) /*!< Bit mask of ADDR field. */ + +/* Register: ACL_ACL_SIZE */ +/* Description: Description cluster[0]: Size of region to protect counting from address ACL[0].ADDR. Write '0' as no effect. */ + +/* Bits 31..0 : Size of flash region 0 in bytes. Must be a multiple of the flash page size. */ +#define ACL_ACL_SIZE_SIZE_Pos (0UL) /*!< Position of SIZE field. */ +#define ACL_ACL_SIZE_SIZE_Msk (0xFFFFFFFFUL << ACL_ACL_SIZE_SIZE_Pos) /*!< Bit mask of SIZE field. */ + +/* Register: ACL_ACL_PERM */ +/* Description: Description cluster[0]: Access permissions for region 0 as defined by start address ACL[0].ADDR and size ACL[0].SIZE */ + +/* Bit 2 : Configure read permissions for region 0. Write '0' has no effect. */ +#define ACL_ACL_PERM_READ_Pos (2UL) /*!< Position of READ field. */ +#define ACL_ACL_PERM_READ_Msk (0x1UL << ACL_ACL_PERM_READ_Pos) /*!< Bit mask of READ field. */ +#define ACL_ACL_PERM_READ_Enable (0UL) /*!< Allow read instructions to region 0 */ +#define ACL_ACL_PERM_READ_Disable (1UL) /*!< Block read instructions to region 0 */ + +/* Bit 1 : Configure write and erase permissions for region 0. Write '0' has no effect. */ +#define ACL_ACL_PERM_WRITE_Pos (1UL) /*!< Position of WRITE field. */ +#define ACL_ACL_PERM_WRITE_Msk (0x1UL << ACL_ACL_PERM_WRITE_Pos) /*!< Bit mask of WRITE field. */ +#define ACL_ACL_PERM_WRITE_Enable (0UL) /*!< Allow write and erase instructions to region 0 */ +#define ACL_ACL_PERM_WRITE_Disable (1UL) /*!< Block write and erase instructions to region 0 */ + + +/* Peripheral: CCM */ +/* Description: AES CCM Mode Encryption */ + +/* Register: CCM_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 0 : Shortcut between ENDKSGEN event and CRYPT task */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Pos (0UL) /*!< Position of ENDKSGEN_CRYPT field. */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Msk (0x1UL << CCM_SHORTS_ENDKSGEN_CRYPT_Pos) /*!< Bit mask of ENDKSGEN_CRYPT field. */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Disabled (0UL) /*!< Disable shortcut */ +#define CCM_SHORTS_ENDKSGEN_CRYPT_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: CCM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 2 : Write '1' to Enable interrupt for ERROR event */ +#define CCM_INTENSET_ERROR_Pos (2UL) /*!< Position of ERROR field. */ +#define CCM_INTENSET_ERROR_Msk (0x1UL << CCM_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define CCM_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for ENDCRYPT event */ +#define CCM_INTENSET_ENDCRYPT_Pos (1UL) /*!< Position of ENDCRYPT field. */ +#define CCM_INTENSET_ENDCRYPT_Msk (0x1UL << CCM_INTENSET_ENDCRYPT_Pos) /*!< Bit mask of ENDCRYPT field. */ +#define CCM_INTENSET_ENDCRYPT_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENSET_ENDCRYPT_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENSET_ENDCRYPT_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for ENDKSGEN event */ +#define CCM_INTENSET_ENDKSGEN_Pos (0UL) /*!< Position of ENDKSGEN field. */ +#define CCM_INTENSET_ENDKSGEN_Msk (0x1UL << CCM_INTENSET_ENDKSGEN_Pos) /*!< Bit mask of ENDKSGEN field. */ +#define CCM_INTENSET_ENDKSGEN_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENSET_ENDKSGEN_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENSET_ENDKSGEN_Set (1UL) /*!< Enable */ + +/* Register: CCM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 2 : Write '1' to Disable interrupt for ERROR event */ +#define CCM_INTENCLR_ERROR_Pos (2UL) /*!< Position of ERROR field. */ +#define CCM_INTENCLR_ERROR_Msk (0x1UL << CCM_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define CCM_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for ENDCRYPT event */ +#define CCM_INTENCLR_ENDCRYPT_Pos (1UL) /*!< Position of ENDCRYPT field. */ +#define CCM_INTENCLR_ENDCRYPT_Msk (0x1UL << CCM_INTENCLR_ENDCRYPT_Pos) /*!< Bit mask of ENDCRYPT field. */ +#define CCM_INTENCLR_ENDCRYPT_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENCLR_ENDCRYPT_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENCLR_ENDCRYPT_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for ENDKSGEN event */ +#define CCM_INTENCLR_ENDKSGEN_Pos (0UL) /*!< Position of ENDKSGEN field. */ +#define CCM_INTENCLR_ENDKSGEN_Msk (0x1UL << CCM_INTENCLR_ENDKSGEN_Pos) /*!< Bit mask of ENDKSGEN field. */ +#define CCM_INTENCLR_ENDKSGEN_Disabled (0UL) /*!< Read: Disabled */ +#define CCM_INTENCLR_ENDKSGEN_Enabled (1UL) /*!< Read: Enabled */ +#define CCM_INTENCLR_ENDKSGEN_Clear (1UL) /*!< Disable */ + +/* Register: CCM_MICSTATUS */ +/* Description: MIC check result */ + +/* Bit 0 : The result of the MIC check performed during the previous decryption operation */ +#define CCM_MICSTATUS_MICSTATUS_Pos (0UL) /*!< Position of MICSTATUS field. */ +#define CCM_MICSTATUS_MICSTATUS_Msk (0x1UL << CCM_MICSTATUS_MICSTATUS_Pos) /*!< Bit mask of MICSTATUS field. */ +#define CCM_MICSTATUS_MICSTATUS_CheckFailed (0UL) /*!< MIC check failed */ +#define CCM_MICSTATUS_MICSTATUS_CheckPassed (1UL) /*!< MIC check passed */ + +/* Register: CCM_ENABLE */ +/* Description: Enable */ + +/* Bits 1..0 : Enable or disable CCM */ +#define CCM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define CCM_ENABLE_ENABLE_Msk (0x3UL << CCM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define CCM_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define CCM_ENABLE_ENABLE_Enabled (2UL) /*!< Enable */ + +/* Register: CCM_MODE */ +/* Description: Operation mode */ + +/* Bit 24 : Packet length configuration */ +#define CCM_MODE_LENGTH_Pos (24UL) /*!< Position of LENGTH field. */ +#define CCM_MODE_LENGTH_Msk (0x1UL << CCM_MODE_LENGTH_Pos) /*!< Bit mask of LENGTH field. */ +#define CCM_MODE_LENGTH_Default (0UL) /*!< Default length. Effective length of LENGTH field in encrypted/decrypted packet is 5 bits. A key-stream for packets up to 27 bytes will be generated. */ +#define CCM_MODE_LENGTH_Extended (1UL) /*!< Extended length. Effective length of LENGTH field in encrypted/decrypted packet is 8 bits. A key-stream for packets up to MAXPACKETSIZE bytes will be generated. */ + +/* Bits 17..16 : Radio data rate that the CCM shall run synchronous with */ +#define CCM_MODE_DATARATE_Pos (16UL) /*!< Position of DATARATE field. */ +#define CCM_MODE_DATARATE_Msk (0x3UL << CCM_MODE_DATARATE_Pos) /*!< Bit mask of DATARATE field. */ +#define CCM_MODE_DATARATE_1Mbit (0UL) /*!< 1 Mbps */ +#define CCM_MODE_DATARATE_2Mbit (1UL) /*!< 2 Mbps */ +#define CCM_MODE_DATARATE_125Kbps (2UL) /*!< 125 Kbps */ +#define CCM_MODE_DATARATE_500Kbps (3UL) /*!< 500 Kbps */ + +/* Bit 0 : The mode of operation to be used. The settings in this register apply whenever either the KSGEN or CRYPT tasks are triggered. */ +#define CCM_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define CCM_MODE_MODE_Msk (0x1UL << CCM_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define CCM_MODE_MODE_Encryption (0UL) /*!< AES CCM packet encryption mode */ +#define CCM_MODE_MODE_Decryption (1UL) /*!< AES CCM packet decryption mode */ + +/* Register: CCM_CNFPTR */ +/* Description: Pointer to data structure holding AES key and NONCE vector */ + +/* Bits 31..0 : Pointer to the data structure holding the AES key and the CCM NONCE vector (see Table 1 CCM data structure overview) */ +#define CCM_CNFPTR_CNFPTR_Pos (0UL) /*!< Position of CNFPTR field. */ +#define CCM_CNFPTR_CNFPTR_Msk (0xFFFFFFFFUL << CCM_CNFPTR_CNFPTR_Pos) /*!< Bit mask of CNFPTR field. */ + +/* Register: CCM_INPTR */ +/* Description: Input pointer */ + +/* Bits 31..0 : Input pointer */ +#define CCM_INPTR_INPTR_Pos (0UL) /*!< Position of INPTR field. */ +#define CCM_INPTR_INPTR_Msk (0xFFFFFFFFUL << CCM_INPTR_INPTR_Pos) /*!< Bit mask of INPTR field. */ + +/* Register: CCM_OUTPTR */ +/* Description: Output pointer */ + +/* Bits 31..0 : Output pointer */ +#define CCM_OUTPTR_OUTPTR_Pos (0UL) /*!< Position of OUTPTR field. */ +#define CCM_OUTPTR_OUTPTR_Msk (0xFFFFFFFFUL << CCM_OUTPTR_OUTPTR_Pos) /*!< Bit mask of OUTPTR field. */ + +/* Register: CCM_SCRATCHPTR */ +/* Description: Pointer to data area used for temporary storage */ + +/* Bits 31..0 : Pointer to a scratch data area used for temporary storage during key-stream generation, MIC generation and encryption/decryption. */ +#define CCM_SCRATCHPTR_SCRATCHPTR_Pos (0UL) /*!< Position of SCRATCHPTR field. */ +#define CCM_SCRATCHPTR_SCRATCHPTR_Msk (0xFFFFFFFFUL << CCM_SCRATCHPTR_SCRATCHPTR_Pos) /*!< Bit mask of SCRATCHPTR field. */ + +/* Register: CCM_MAXPACKETSIZE */ +/* Description: Length of key-stream generated when MODE.LENGTH = Extended. */ + +/* Bits 7..0 : Length of key-stream generated when MODE.LENGTH = Extended. This value must be greater or equal to the subsequent packet to be encrypted/decrypted. */ +#define CCM_MAXPACKETSIZE_MAXPACKETSIZE_Pos (0UL) /*!< Position of MAXPACKETSIZE field. */ +#define CCM_MAXPACKETSIZE_MAXPACKETSIZE_Msk (0xFFUL << CCM_MAXPACKETSIZE_MAXPACKETSIZE_Pos) /*!< Bit mask of MAXPACKETSIZE field. */ + +/* Register: CCM_RATEOVERRIDE */ +/* Description: Data rate override setting. */ + +/* Bits 1..0 : Data rate override setting. */ +#define CCM_RATEOVERRIDE_RATEOVERRIDE_Pos (0UL) /*!< Position of RATEOVERRIDE field. */ +#define CCM_RATEOVERRIDE_RATEOVERRIDE_Msk (0x3UL << CCM_RATEOVERRIDE_RATEOVERRIDE_Pos) /*!< Bit mask of RATEOVERRIDE field. */ +#define CCM_RATEOVERRIDE_RATEOVERRIDE_1Mbit (0UL) /*!< 1 Mbps */ +#define CCM_RATEOVERRIDE_RATEOVERRIDE_2Mbit (1UL) /*!< 2 Mbps */ +#define CCM_RATEOVERRIDE_RATEOVERRIDE_125Kbps (2UL) /*!< 125 Kbps */ +#define CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbps (3UL) /*!< 500 Kbps */ + + +/* Peripheral: CLOCK */ +/* Description: Clock control */ + +/* Register: CLOCK_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 4 : Write '1' to Enable interrupt for CTTO event */ +#define CLOCK_INTENSET_CTTO_Pos (4UL) /*!< Position of CTTO field. */ +#define CLOCK_INTENSET_CTTO_Msk (0x1UL << CLOCK_INTENSET_CTTO_Pos) /*!< Bit mask of CTTO field. */ +#define CLOCK_INTENSET_CTTO_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENSET_CTTO_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENSET_CTTO_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for DONE event */ +#define CLOCK_INTENSET_DONE_Pos (3UL) /*!< Position of DONE field. */ +#define CLOCK_INTENSET_DONE_Msk (0x1UL << CLOCK_INTENSET_DONE_Pos) /*!< Bit mask of DONE field. */ +#define CLOCK_INTENSET_DONE_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENSET_DONE_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENSET_DONE_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for LFCLKSTARTED event */ +#define CLOCK_INTENSET_LFCLKSTARTED_Pos (1UL) /*!< Position of LFCLKSTARTED field. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Msk (0x1UL << CLOCK_INTENSET_LFCLKSTARTED_Pos) /*!< Bit mask of LFCLKSTARTED field. */ +#define CLOCK_INTENSET_LFCLKSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENSET_LFCLKSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENSET_LFCLKSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for HFCLKSTARTED event */ +#define CLOCK_INTENSET_HFCLKSTARTED_Pos (0UL) /*!< Position of HFCLKSTARTED field. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Msk (0x1UL << CLOCK_INTENSET_HFCLKSTARTED_Pos) /*!< Bit mask of HFCLKSTARTED field. */ +#define CLOCK_INTENSET_HFCLKSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENSET_HFCLKSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENSET_HFCLKSTARTED_Set (1UL) /*!< Enable */ + +/* Register: CLOCK_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 4 : Write '1' to Disable interrupt for CTTO event */ +#define CLOCK_INTENCLR_CTTO_Pos (4UL) /*!< Position of CTTO field. */ +#define CLOCK_INTENCLR_CTTO_Msk (0x1UL << CLOCK_INTENCLR_CTTO_Pos) /*!< Bit mask of CTTO field. */ +#define CLOCK_INTENCLR_CTTO_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENCLR_CTTO_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENCLR_CTTO_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for DONE event */ +#define CLOCK_INTENCLR_DONE_Pos (3UL) /*!< Position of DONE field. */ +#define CLOCK_INTENCLR_DONE_Msk (0x1UL << CLOCK_INTENCLR_DONE_Pos) /*!< Bit mask of DONE field. */ +#define CLOCK_INTENCLR_DONE_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENCLR_DONE_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENCLR_DONE_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for LFCLKSTARTED event */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Pos (1UL) /*!< Position of LFCLKSTARTED field. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Msk (0x1UL << CLOCK_INTENCLR_LFCLKSTARTED_Pos) /*!< Bit mask of LFCLKSTARTED field. */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENCLR_LFCLKSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for HFCLKSTARTED event */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Pos (0UL) /*!< Position of HFCLKSTARTED field. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Msk (0x1UL << CLOCK_INTENCLR_HFCLKSTARTED_Pos) /*!< Bit mask of HFCLKSTARTED field. */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define CLOCK_INTENCLR_HFCLKSTARTED_Clear (1UL) /*!< Disable */ + +/* Register: CLOCK_HFCLKRUN */ +/* Description: Status indicating that HFCLKSTART task has been triggered */ + +/* Bit 0 : HFCLKSTART task triggered or not */ +#define CLOCK_HFCLKRUN_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define CLOCK_HFCLKRUN_STATUS_Msk (0x1UL << CLOCK_HFCLKRUN_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define CLOCK_HFCLKRUN_STATUS_NotTriggered (0UL) /*!< Task not triggered */ +#define CLOCK_HFCLKRUN_STATUS_Triggered (1UL) /*!< Task triggered */ + +/* Register: CLOCK_HFCLKSTAT */ +/* Description: HFCLK status */ + +/* Bit 16 : HFCLK state */ +#define CLOCK_HFCLKSTAT_STATE_Pos (16UL) /*!< Position of STATE field. */ +#define CLOCK_HFCLKSTAT_STATE_Msk (0x1UL << CLOCK_HFCLKSTAT_STATE_Pos) /*!< Bit mask of STATE field. */ +#define CLOCK_HFCLKSTAT_STATE_NotRunning (0UL) /*!< HFCLK not running */ +#define CLOCK_HFCLKSTAT_STATE_Running (1UL) /*!< HFCLK running */ + +/* Bit 0 : Source of HFCLK */ +#define CLOCK_HFCLKSTAT_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_HFCLKSTAT_SRC_Msk (0x1UL << CLOCK_HFCLKSTAT_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_HFCLKSTAT_SRC_RC (0UL) /*!< 64 MHz internal oscillator (HFINT) */ +#define CLOCK_HFCLKSTAT_SRC_Xtal (1UL) /*!< 64 MHz crystal oscillator (HFXO) */ + +/* Register: CLOCK_LFCLKRUN */ +/* Description: Status indicating that LFCLKSTART task has been triggered */ + +/* Bit 0 : LFCLKSTART task triggered or not */ +#define CLOCK_LFCLKRUN_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define CLOCK_LFCLKRUN_STATUS_Msk (0x1UL << CLOCK_LFCLKRUN_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define CLOCK_LFCLKRUN_STATUS_NotTriggered (0UL) /*!< Task not triggered */ +#define CLOCK_LFCLKRUN_STATUS_Triggered (1UL) /*!< Task triggered */ + +/* Register: CLOCK_LFCLKSTAT */ +/* Description: LFCLK status */ + +/* Bit 16 : LFCLK state */ +#define CLOCK_LFCLKSTAT_STATE_Pos (16UL) /*!< Position of STATE field. */ +#define CLOCK_LFCLKSTAT_STATE_Msk (0x1UL << CLOCK_LFCLKSTAT_STATE_Pos) /*!< Bit mask of STATE field. */ +#define CLOCK_LFCLKSTAT_STATE_NotRunning (0UL) /*!< LFCLK not running */ +#define CLOCK_LFCLKSTAT_STATE_Running (1UL) /*!< LFCLK running */ + +/* Bits 1..0 : Source of LFCLK */ +#define CLOCK_LFCLKSTAT_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSTAT_SRC_Msk (0x3UL << CLOCK_LFCLKSTAT_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSTAT_SRC_RC (0UL) /*!< 32.768 kHz RC oscillator */ +#define CLOCK_LFCLKSTAT_SRC_Xtal (1UL) /*!< 32.768 kHz crystal oscillator */ +#define CLOCK_LFCLKSTAT_SRC_Synth (2UL) /*!< 32.768 kHz synthesized from HFCLK */ +#define CLOCK_LFCLKSTAT_SRC_LFULP (3UL) /*!< 32.768 kHz ultra low power RC oscillator */ + +/* Register: CLOCK_LFCLKSRCCOPY */ +/* Description: Copy of LFCLKSRC register, set when LFCLKSTART task was triggered */ + +/* Bits 1..0 : Clock source */ +#define CLOCK_LFCLKSRCCOPY_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSRCCOPY_SRC_Msk (0x3UL << CLOCK_LFCLKSRCCOPY_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSRCCOPY_SRC_RC (0UL) /*!< 32.768 kHz RC oscillator */ +#define CLOCK_LFCLKSRCCOPY_SRC_Xtal (1UL) /*!< 32.768 kHz crystal oscillator */ +#define CLOCK_LFCLKSRCCOPY_SRC_Synth (2UL) /*!< 32.768 kHz synthesized from HFCLK */ +#define CLOCK_LFCLKSRCCOPY_SRC_LFULP (3UL) /*!< 32.768 kHz ultra low power RC oscillator */ + +/* Register: CLOCK_LFCLKSRC */ +/* Description: Clock source for the LFCLK */ + +/* Bit 17 : Enable or disable external source for LFCLK */ +#define CLOCK_LFCLKSRC_EXTERNAL_Pos (17UL) /*!< Position of EXTERNAL field. */ +#define CLOCK_LFCLKSRC_EXTERNAL_Msk (0x1UL << CLOCK_LFCLKSRC_EXTERNAL_Pos) /*!< Bit mask of EXTERNAL field. */ +#define CLOCK_LFCLKSRC_EXTERNAL_Disabled (0UL) /*!< Disable external source (use with Xtal) */ +#define CLOCK_LFCLKSRC_EXTERNAL_Enabled (1UL) /*!< Enable use of external source instead of Xtal (SRC needs to be set to Xtal) */ + +/* Bit 16 : Enable or disable bypass of LFCLK crystal oscillator with external clock source */ +#define CLOCK_LFCLKSRC_BYPASS_Pos (16UL) /*!< Position of BYPASS field. */ +#define CLOCK_LFCLKSRC_BYPASS_Msk (0x1UL << CLOCK_LFCLKSRC_BYPASS_Pos) /*!< Bit mask of BYPASS field. */ +#define CLOCK_LFCLKSRC_BYPASS_Disabled (0UL) /*!< Disable (use with Xtal or low-swing external source) */ +#define CLOCK_LFCLKSRC_BYPASS_Enabled (1UL) /*!< Enable (use with rail-to-rail external source) */ + +/* Bits 1..0 : Clock source */ +#define CLOCK_LFCLKSRC_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define CLOCK_LFCLKSRC_SRC_Msk (0x3UL << CLOCK_LFCLKSRC_SRC_Pos) /*!< Bit mask of SRC field. */ +#define CLOCK_LFCLKSRC_SRC_RC (0UL) /*!< 32.768 kHz RC oscillator */ +#define CLOCK_LFCLKSRC_SRC_Xtal (1UL) /*!< 32.768 kHz crystal oscillator */ +#define CLOCK_LFCLKSRC_SRC_Synth (2UL) /*!< 32.768 kHz synthesized from HFCLK */ +#define CLOCK_LFCLKSRC_SRC_LFULP (3UL) /*!< 32.768 kHz ultra low power RC oscillator */ + +/* Register: CLOCK_CTIV */ +/* Description: Calibration timer interval */ + +/* Bits 6..0 : Calibration timer interval in multiple of 0.25 seconds. Range: 0.25 seconds to 31.75 seconds. */ +#define CLOCK_CTIV_CTIV_Pos (0UL) /*!< Position of CTIV field. */ +#define CLOCK_CTIV_CTIV_Msk (0x7FUL << CLOCK_CTIV_CTIV_Pos) /*!< Bit mask of CTIV field. */ + +/* Register: CLOCK_TRACECONFIG */ +/* Description: Clocking options for the Trace Port debug interface */ + +/* Bits 17..16 : Pin multiplexing of trace signals. */ +#define CLOCK_TRACECONFIG_TRACEMUX_Pos (16UL) /*!< Position of TRACEMUX field. */ +#define CLOCK_TRACECONFIG_TRACEMUX_Msk (0x3UL << CLOCK_TRACECONFIG_TRACEMUX_Pos) /*!< Bit mask of TRACEMUX field. */ +#define CLOCK_TRACECONFIG_TRACEMUX_GPIO (0UL) /*!< GPIOs multiplexed onto all trace-pins */ +#define CLOCK_TRACECONFIG_TRACEMUX_Serial (1UL) /*!< SWO multiplexed onto P0.18, GPIO multiplexed onto other trace pins */ +#define CLOCK_TRACECONFIG_TRACEMUX_Parallel (2UL) /*!< TRACECLK and TRACEDATA multiplexed onto P0.20, P0.18, P0.16, P0.15 and P0.14. */ + +/* Bits 1..0 : Speed of Trace Port clock. Note that the TRACECLK pin will output this clock divided by two. */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_Pos (0UL) /*!< Position of TRACEPORTSPEED field. */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_Msk (0x3UL << CLOCK_TRACECONFIG_TRACEPORTSPEED_Pos) /*!< Bit mask of TRACEPORTSPEED field. */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_32MHz (0UL) /*!< 32 MHz Trace Port clock (TRACECLK = 16 MHz) */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_16MHz (1UL) /*!< 16 MHz Trace Port clock (TRACECLK = 8 MHz) */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_8MHz (2UL) /*!< 8 MHz Trace Port clock (TRACECLK = 4 MHz) */ +#define CLOCK_TRACECONFIG_TRACEPORTSPEED_4MHz (3UL) /*!< 4 MHz Trace Port clock (TRACECLK = 2 MHz) */ + + +/* Peripheral: COMP */ +/* Description: Comparator */ + +/* Register: COMP_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between CROSS event and STOP task */ +#define COMP_SHORTS_CROSS_STOP_Pos (4UL) /*!< Position of CROSS_STOP field. */ +#define COMP_SHORTS_CROSS_STOP_Msk (0x1UL << COMP_SHORTS_CROSS_STOP_Pos) /*!< Bit mask of CROSS_STOP field. */ +#define COMP_SHORTS_CROSS_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_CROSS_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between UP event and STOP task */ +#define COMP_SHORTS_UP_STOP_Pos (3UL) /*!< Position of UP_STOP field. */ +#define COMP_SHORTS_UP_STOP_Msk (0x1UL << COMP_SHORTS_UP_STOP_Pos) /*!< Bit mask of UP_STOP field. */ +#define COMP_SHORTS_UP_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_UP_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between DOWN event and STOP task */ +#define COMP_SHORTS_DOWN_STOP_Pos (2UL) /*!< Position of DOWN_STOP field. */ +#define COMP_SHORTS_DOWN_STOP_Msk (0x1UL << COMP_SHORTS_DOWN_STOP_Pos) /*!< Bit mask of DOWN_STOP field. */ +#define COMP_SHORTS_DOWN_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_DOWN_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between READY event and STOP task */ +#define COMP_SHORTS_READY_STOP_Pos (1UL) /*!< Position of READY_STOP field. */ +#define COMP_SHORTS_READY_STOP_Msk (0x1UL << COMP_SHORTS_READY_STOP_Pos) /*!< Bit mask of READY_STOP field. */ +#define COMP_SHORTS_READY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_READY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between READY event and SAMPLE task */ +#define COMP_SHORTS_READY_SAMPLE_Pos (0UL) /*!< Position of READY_SAMPLE field. */ +#define COMP_SHORTS_READY_SAMPLE_Msk (0x1UL << COMP_SHORTS_READY_SAMPLE_Pos) /*!< Bit mask of READY_SAMPLE field. */ +#define COMP_SHORTS_READY_SAMPLE_Disabled (0UL) /*!< Disable shortcut */ +#define COMP_SHORTS_READY_SAMPLE_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: COMP_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 3 : Enable or disable interrupt for CROSS event */ +#define COMP_INTEN_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define COMP_INTEN_CROSS_Msk (0x1UL << COMP_INTEN_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define COMP_INTEN_CROSS_Disabled (0UL) /*!< Disable */ +#define COMP_INTEN_CROSS_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for UP event */ +#define COMP_INTEN_UP_Pos (2UL) /*!< Position of UP field. */ +#define COMP_INTEN_UP_Msk (0x1UL << COMP_INTEN_UP_Pos) /*!< Bit mask of UP field. */ +#define COMP_INTEN_UP_Disabled (0UL) /*!< Disable */ +#define COMP_INTEN_UP_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for DOWN event */ +#define COMP_INTEN_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define COMP_INTEN_DOWN_Msk (0x1UL << COMP_INTEN_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define COMP_INTEN_DOWN_Disabled (0UL) /*!< Disable */ +#define COMP_INTEN_DOWN_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for READY event */ +#define COMP_INTEN_READY_Pos (0UL) /*!< Position of READY field. */ +#define COMP_INTEN_READY_Msk (0x1UL << COMP_INTEN_READY_Pos) /*!< Bit mask of READY field. */ +#define COMP_INTEN_READY_Disabled (0UL) /*!< Disable */ +#define COMP_INTEN_READY_Enabled (1UL) /*!< Enable */ + +/* Register: COMP_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 3 : Write '1' to Enable interrupt for CROSS event */ +#define COMP_INTENSET_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define COMP_INTENSET_CROSS_Msk (0x1UL << COMP_INTENSET_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define COMP_INTENSET_CROSS_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENSET_CROSS_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENSET_CROSS_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for UP event */ +#define COMP_INTENSET_UP_Pos (2UL) /*!< Position of UP field. */ +#define COMP_INTENSET_UP_Msk (0x1UL << COMP_INTENSET_UP_Pos) /*!< Bit mask of UP field. */ +#define COMP_INTENSET_UP_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENSET_UP_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENSET_UP_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for DOWN event */ +#define COMP_INTENSET_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define COMP_INTENSET_DOWN_Msk (0x1UL << COMP_INTENSET_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define COMP_INTENSET_DOWN_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENSET_DOWN_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENSET_DOWN_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define COMP_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define COMP_INTENSET_READY_Msk (0x1UL << COMP_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define COMP_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: COMP_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 3 : Write '1' to Disable interrupt for CROSS event */ +#define COMP_INTENCLR_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define COMP_INTENCLR_CROSS_Msk (0x1UL << COMP_INTENCLR_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define COMP_INTENCLR_CROSS_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENCLR_CROSS_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENCLR_CROSS_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for UP event */ +#define COMP_INTENCLR_UP_Pos (2UL) /*!< Position of UP field. */ +#define COMP_INTENCLR_UP_Msk (0x1UL << COMP_INTENCLR_UP_Pos) /*!< Bit mask of UP field. */ +#define COMP_INTENCLR_UP_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENCLR_UP_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENCLR_UP_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for DOWN event */ +#define COMP_INTENCLR_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define COMP_INTENCLR_DOWN_Msk (0x1UL << COMP_INTENCLR_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define COMP_INTENCLR_DOWN_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENCLR_DOWN_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENCLR_DOWN_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define COMP_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define COMP_INTENCLR_READY_Msk (0x1UL << COMP_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define COMP_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define COMP_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define COMP_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: COMP_RESULT */ +/* Description: Compare result */ + +/* Bit 0 : Result of last compare. Decision point SAMPLE task. */ +#define COMP_RESULT_RESULT_Pos (0UL) /*!< Position of RESULT field. */ +#define COMP_RESULT_RESULT_Msk (0x1UL << COMP_RESULT_RESULT_Pos) /*!< Bit mask of RESULT field. */ +#define COMP_RESULT_RESULT_Below (0UL) /*!< Input voltage is below the threshold (VIN+ < VIN-) */ +#define COMP_RESULT_RESULT_Above (1UL) /*!< Input voltage is above the threshold (VIN+ > VIN-) */ + +/* Register: COMP_ENABLE */ +/* Description: COMP enable */ + +/* Bits 1..0 : Enable or disable COMP */ +#define COMP_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define COMP_ENABLE_ENABLE_Msk (0x3UL << COMP_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define COMP_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define COMP_ENABLE_ENABLE_Enabled (2UL) /*!< Enable */ + +/* Register: COMP_PSEL */ +/* Description: Pin select */ + +/* Bits 2..0 : Analog pin select */ +#define COMP_PSEL_PSEL_Pos (0UL) /*!< Position of PSEL field. */ +#define COMP_PSEL_PSEL_Msk (0x7UL << COMP_PSEL_PSEL_Pos) /*!< Bit mask of PSEL field. */ +#define COMP_PSEL_PSEL_AnalogInput0 (0UL) /*!< AIN0 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput1 (1UL) /*!< AIN1 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput2 (2UL) /*!< AIN2 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput3 (3UL) /*!< AIN3 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput4 (4UL) /*!< AIN4 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput5 (5UL) /*!< AIN5 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput6 (6UL) /*!< AIN6 selected as analog input */ +#define COMP_PSEL_PSEL_AnalogInput7 (7UL) /*!< AIN7 selected as analog input */ + +/* Register: COMP_REFSEL */ +/* Description: Reference source select */ + +/* Bits 2..0 : Reference select */ +#define COMP_REFSEL_REFSEL_Pos (0UL) /*!< Position of REFSEL field. */ +#define COMP_REFSEL_REFSEL_Msk (0x7UL << COMP_REFSEL_REFSEL_Pos) /*!< Bit mask of REFSEL field. */ +#define COMP_REFSEL_REFSEL_Int1V2 (0UL) /*!< VREF = internal 1.2 V reference (VDD >= 1.7 V) */ +#define COMP_REFSEL_REFSEL_Int1V8 (1UL) /*!< VREF = internal 1.8 V reference (VDD >= VREF + 0.2 V) */ +#define COMP_REFSEL_REFSEL_Int2V4 (2UL) /*!< VREF = internal 2.4 V reference (VDD >= VREF + 0.2 V) */ +#define COMP_REFSEL_REFSEL_VDD (4UL) /*!< VREF = VDD */ +#define COMP_REFSEL_REFSEL_ARef (7UL) /*!< VREF = AREF (VDD >= VREF >= AREFMIN) */ + +/* Register: COMP_EXTREFSEL */ +/* Description: External reference select */ + +/* Bit 0 : External analog reference select */ +#define COMP_EXTREFSEL_EXTREFSEL_Pos (0UL) /*!< Position of EXTREFSEL field. */ +#define COMP_EXTREFSEL_EXTREFSEL_Msk (0x1UL << COMP_EXTREFSEL_EXTREFSEL_Pos) /*!< Bit mask of EXTREFSEL field. */ +#define COMP_EXTREFSEL_EXTREFSEL_AnalogReference0 (0UL) /*!< Use AIN0 as external analog reference */ +#define COMP_EXTREFSEL_EXTREFSEL_AnalogReference1 (1UL) /*!< Use AIN1 as external analog reference */ + +/* Register: COMP_TH */ +/* Description: Threshold configuration for hysteresis unit */ + +/* Bits 13..8 : VUP = (THUP+1)/64*VREF */ +#define COMP_TH_THUP_Pos (8UL) /*!< Position of THUP field. */ +#define COMP_TH_THUP_Msk (0x3FUL << COMP_TH_THUP_Pos) /*!< Bit mask of THUP field. */ + +/* Bits 5..0 : VDOWN = (THDOWN+1)/64*VREF */ +#define COMP_TH_THDOWN_Pos (0UL) /*!< Position of THDOWN field. */ +#define COMP_TH_THDOWN_Msk (0x3FUL << COMP_TH_THDOWN_Pos) /*!< Bit mask of THDOWN field. */ + +/* Register: COMP_MODE */ +/* Description: Mode configuration */ + +/* Bit 8 : Main operation mode */ +#define COMP_MODE_MAIN_Pos (8UL) /*!< Position of MAIN field. */ +#define COMP_MODE_MAIN_Msk (0x1UL << COMP_MODE_MAIN_Pos) /*!< Bit mask of MAIN field. */ +#define COMP_MODE_MAIN_SE (0UL) /*!< Single ended mode */ +#define COMP_MODE_MAIN_Diff (1UL) /*!< Differential mode */ + +/* Bits 1..0 : Speed and power mode */ +#define COMP_MODE_SP_Pos (0UL) /*!< Position of SP field. */ +#define COMP_MODE_SP_Msk (0x3UL << COMP_MODE_SP_Pos) /*!< Bit mask of SP field. */ +#define COMP_MODE_SP_Low (0UL) /*!< Low power mode */ +#define COMP_MODE_SP_Normal (1UL) /*!< Normal mode */ +#define COMP_MODE_SP_High (2UL) /*!< High speed mode */ + +/* Register: COMP_HYST */ +/* Description: Comparator hysteresis enable */ + +/* Bit 0 : Comparator hysteresis */ +#define COMP_HYST_HYST_Pos (0UL) /*!< Position of HYST field. */ +#define COMP_HYST_HYST_Msk (0x1UL << COMP_HYST_HYST_Pos) /*!< Bit mask of HYST field. */ +#define COMP_HYST_HYST_NoHyst (0UL) /*!< Comparator hysteresis disabled */ +#define COMP_HYST_HYST_Hyst50mV (1UL) /*!< Comparator hysteresis enabled */ + +/* Register: COMP_ISOURCE */ +/* Description: Current source select on analog input */ + +/* Bits 1..0 : Comparator hysteresis */ +#define COMP_ISOURCE_ISOURCE_Pos (0UL) /*!< Position of ISOURCE field. */ +#define COMP_ISOURCE_ISOURCE_Msk (0x3UL << COMP_ISOURCE_ISOURCE_Pos) /*!< Bit mask of ISOURCE field. */ +#define COMP_ISOURCE_ISOURCE_Off (0UL) /*!< Current source disabled */ +#define COMP_ISOURCE_ISOURCE_Ien2mA5 (1UL) /*!< Current source enabled (+/- 2.5 uA) */ +#define COMP_ISOURCE_ISOURCE_Ien5mA (2UL) /*!< Current source enabled (+/- 5 uA) */ +#define COMP_ISOURCE_ISOURCE_Ien10mA (3UL) /*!< Current source enabled (+/- 10 uA) */ + + +/* Peripheral: CRYPTOCELL */ +/* Description: ARM CryptoCell register interface */ + +/* Register: CRYPTOCELL_ENABLE */ +/* Description: Control power and clock for ARM CryptoCell subsystem */ + +/* Bit 0 : Enable or disable the CryptoCell subsystem */ +#define CRYPTOCELL_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define CRYPTOCELL_ENABLE_ENABLE_Msk (0x1UL << CRYPTOCELL_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define CRYPTOCELL_ENABLE_ENABLE_Disabled (0UL) /*!< CryptoCell subsystem disabled */ +#define CRYPTOCELL_ENABLE_ENABLE_Enabled (1UL) /*!< CryptoCell subsystem enabled */ + + +/* Peripheral: ECB */ +/* Description: AES ECB Mode Encryption */ + +/* Register: ECB_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 1 : Write '1' to Enable interrupt for ERRORECB event */ +#define ECB_INTENSET_ERRORECB_Pos (1UL) /*!< Position of ERRORECB field. */ +#define ECB_INTENSET_ERRORECB_Msk (0x1UL << ECB_INTENSET_ERRORECB_Pos) /*!< Bit mask of ERRORECB field. */ +#define ECB_INTENSET_ERRORECB_Disabled (0UL) /*!< Read: Disabled */ +#define ECB_INTENSET_ERRORECB_Enabled (1UL) /*!< Read: Enabled */ +#define ECB_INTENSET_ERRORECB_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for ENDECB event */ +#define ECB_INTENSET_ENDECB_Pos (0UL) /*!< Position of ENDECB field. */ +#define ECB_INTENSET_ENDECB_Msk (0x1UL << ECB_INTENSET_ENDECB_Pos) /*!< Bit mask of ENDECB field. */ +#define ECB_INTENSET_ENDECB_Disabled (0UL) /*!< Read: Disabled */ +#define ECB_INTENSET_ENDECB_Enabled (1UL) /*!< Read: Enabled */ +#define ECB_INTENSET_ENDECB_Set (1UL) /*!< Enable */ + +/* Register: ECB_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 1 : Write '1' to Disable interrupt for ERRORECB event */ +#define ECB_INTENCLR_ERRORECB_Pos (1UL) /*!< Position of ERRORECB field. */ +#define ECB_INTENCLR_ERRORECB_Msk (0x1UL << ECB_INTENCLR_ERRORECB_Pos) /*!< Bit mask of ERRORECB field. */ +#define ECB_INTENCLR_ERRORECB_Disabled (0UL) /*!< Read: Disabled */ +#define ECB_INTENCLR_ERRORECB_Enabled (1UL) /*!< Read: Enabled */ +#define ECB_INTENCLR_ERRORECB_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for ENDECB event */ +#define ECB_INTENCLR_ENDECB_Pos (0UL) /*!< Position of ENDECB field. */ +#define ECB_INTENCLR_ENDECB_Msk (0x1UL << ECB_INTENCLR_ENDECB_Pos) /*!< Bit mask of ENDECB field. */ +#define ECB_INTENCLR_ENDECB_Disabled (0UL) /*!< Read: Disabled */ +#define ECB_INTENCLR_ENDECB_Enabled (1UL) /*!< Read: Enabled */ +#define ECB_INTENCLR_ENDECB_Clear (1UL) /*!< Disable */ + +/* Register: ECB_ECBDATAPTR */ +/* Description: ECB block encrypt memory pointers */ + +/* Bits 31..0 : Pointer to the ECB data structure (see Table 1 ECB data structure overview) */ +#define ECB_ECBDATAPTR_ECBDATAPTR_Pos (0UL) /*!< Position of ECBDATAPTR field. */ +#define ECB_ECBDATAPTR_ECBDATAPTR_Msk (0xFFFFFFFFUL << ECB_ECBDATAPTR_ECBDATAPTR_Pos) /*!< Bit mask of ECBDATAPTR field. */ + + +/* Peripheral: EGU */ +/* Description: Event Generator Unit 0 */ + +/* Register: EGU_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 15 : Enable or disable interrupt for TRIGGERED[15] event */ +#define EGU_INTEN_TRIGGERED15_Pos (15UL) /*!< Position of TRIGGERED15 field. */ +#define EGU_INTEN_TRIGGERED15_Msk (0x1UL << EGU_INTEN_TRIGGERED15_Pos) /*!< Bit mask of TRIGGERED15 field. */ +#define EGU_INTEN_TRIGGERED15_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED15_Enabled (1UL) /*!< Enable */ + +/* Bit 14 : Enable or disable interrupt for TRIGGERED[14] event */ +#define EGU_INTEN_TRIGGERED14_Pos (14UL) /*!< Position of TRIGGERED14 field. */ +#define EGU_INTEN_TRIGGERED14_Msk (0x1UL << EGU_INTEN_TRIGGERED14_Pos) /*!< Bit mask of TRIGGERED14 field. */ +#define EGU_INTEN_TRIGGERED14_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED14_Enabled (1UL) /*!< Enable */ + +/* Bit 13 : Enable or disable interrupt for TRIGGERED[13] event */ +#define EGU_INTEN_TRIGGERED13_Pos (13UL) /*!< Position of TRIGGERED13 field. */ +#define EGU_INTEN_TRIGGERED13_Msk (0x1UL << EGU_INTEN_TRIGGERED13_Pos) /*!< Bit mask of TRIGGERED13 field. */ +#define EGU_INTEN_TRIGGERED13_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED13_Enabled (1UL) /*!< Enable */ + +/* Bit 12 : Enable or disable interrupt for TRIGGERED[12] event */ +#define EGU_INTEN_TRIGGERED12_Pos (12UL) /*!< Position of TRIGGERED12 field. */ +#define EGU_INTEN_TRIGGERED12_Msk (0x1UL << EGU_INTEN_TRIGGERED12_Pos) /*!< Bit mask of TRIGGERED12 field. */ +#define EGU_INTEN_TRIGGERED12_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED12_Enabled (1UL) /*!< Enable */ + +/* Bit 11 : Enable or disable interrupt for TRIGGERED[11] event */ +#define EGU_INTEN_TRIGGERED11_Pos (11UL) /*!< Position of TRIGGERED11 field. */ +#define EGU_INTEN_TRIGGERED11_Msk (0x1UL << EGU_INTEN_TRIGGERED11_Pos) /*!< Bit mask of TRIGGERED11 field. */ +#define EGU_INTEN_TRIGGERED11_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED11_Enabled (1UL) /*!< Enable */ + +/* Bit 10 : Enable or disable interrupt for TRIGGERED[10] event */ +#define EGU_INTEN_TRIGGERED10_Pos (10UL) /*!< Position of TRIGGERED10 field. */ +#define EGU_INTEN_TRIGGERED10_Msk (0x1UL << EGU_INTEN_TRIGGERED10_Pos) /*!< Bit mask of TRIGGERED10 field. */ +#define EGU_INTEN_TRIGGERED10_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED10_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for TRIGGERED[9] event */ +#define EGU_INTEN_TRIGGERED9_Pos (9UL) /*!< Position of TRIGGERED9 field. */ +#define EGU_INTEN_TRIGGERED9_Msk (0x1UL << EGU_INTEN_TRIGGERED9_Pos) /*!< Bit mask of TRIGGERED9 field. */ +#define EGU_INTEN_TRIGGERED9_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED9_Enabled (1UL) /*!< Enable */ + +/* Bit 8 : Enable or disable interrupt for TRIGGERED[8] event */ +#define EGU_INTEN_TRIGGERED8_Pos (8UL) /*!< Position of TRIGGERED8 field. */ +#define EGU_INTEN_TRIGGERED8_Msk (0x1UL << EGU_INTEN_TRIGGERED8_Pos) /*!< Bit mask of TRIGGERED8 field. */ +#define EGU_INTEN_TRIGGERED8_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED8_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for TRIGGERED[7] event */ +#define EGU_INTEN_TRIGGERED7_Pos (7UL) /*!< Position of TRIGGERED7 field. */ +#define EGU_INTEN_TRIGGERED7_Msk (0x1UL << EGU_INTEN_TRIGGERED7_Pos) /*!< Bit mask of TRIGGERED7 field. */ +#define EGU_INTEN_TRIGGERED7_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED7_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for TRIGGERED[6] event */ +#define EGU_INTEN_TRIGGERED6_Pos (6UL) /*!< Position of TRIGGERED6 field. */ +#define EGU_INTEN_TRIGGERED6_Msk (0x1UL << EGU_INTEN_TRIGGERED6_Pos) /*!< Bit mask of TRIGGERED6 field. */ +#define EGU_INTEN_TRIGGERED6_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED6_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for TRIGGERED[5] event */ +#define EGU_INTEN_TRIGGERED5_Pos (5UL) /*!< Position of TRIGGERED5 field. */ +#define EGU_INTEN_TRIGGERED5_Msk (0x1UL << EGU_INTEN_TRIGGERED5_Pos) /*!< Bit mask of TRIGGERED5 field. */ +#define EGU_INTEN_TRIGGERED5_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED5_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for TRIGGERED[4] event */ +#define EGU_INTEN_TRIGGERED4_Pos (4UL) /*!< Position of TRIGGERED4 field. */ +#define EGU_INTEN_TRIGGERED4_Msk (0x1UL << EGU_INTEN_TRIGGERED4_Pos) /*!< Bit mask of TRIGGERED4 field. */ +#define EGU_INTEN_TRIGGERED4_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED4_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for TRIGGERED[3] event */ +#define EGU_INTEN_TRIGGERED3_Pos (3UL) /*!< Position of TRIGGERED3 field. */ +#define EGU_INTEN_TRIGGERED3_Msk (0x1UL << EGU_INTEN_TRIGGERED3_Pos) /*!< Bit mask of TRIGGERED3 field. */ +#define EGU_INTEN_TRIGGERED3_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED3_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for TRIGGERED[2] event */ +#define EGU_INTEN_TRIGGERED2_Pos (2UL) /*!< Position of TRIGGERED2 field. */ +#define EGU_INTEN_TRIGGERED2_Msk (0x1UL << EGU_INTEN_TRIGGERED2_Pos) /*!< Bit mask of TRIGGERED2 field. */ +#define EGU_INTEN_TRIGGERED2_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED2_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for TRIGGERED[1] event */ +#define EGU_INTEN_TRIGGERED1_Pos (1UL) /*!< Position of TRIGGERED1 field. */ +#define EGU_INTEN_TRIGGERED1_Msk (0x1UL << EGU_INTEN_TRIGGERED1_Pos) /*!< Bit mask of TRIGGERED1 field. */ +#define EGU_INTEN_TRIGGERED1_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED1_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for TRIGGERED[0] event */ +#define EGU_INTEN_TRIGGERED0_Pos (0UL) /*!< Position of TRIGGERED0 field. */ +#define EGU_INTEN_TRIGGERED0_Msk (0x1UL << EGU_INTEN_TRIGGERED0_Pos) /*!< Bit mask of TRIGGERED0 field. */ +#define EGU_INTEN_TRIGGERED0_Disabled (0UL) /*!< Disable */ +#define EGU_INTEN_TRIGGERED0_Enabled (1UL) /*!< Enable */ + +/* Register: EGU_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 15 : Write '1' to Enable interrupt for TRIGGERED[15] event */ +#define EGU_INTENSET_TRIGGERED15_Pos (15UL) /*!< Position of TRIGGERED15 field. */ +#define EGU_INTENSET_TRIGGERED15_Msk (0x1UL << EGU_INTENSET_TRIGGERED15_Pos) /*!< Bit mask of TRIGGERED15 field. */ +#define EGU_INTENSET_TRIGGERED15_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED15_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED15_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for TRIGGERED[14] event */ +#define EGU_INTENSET_TRIGGERED14_Pos (14UL) /*!< Position of TRIGGERED14 field. */ +#define EGU_INTENSET_TRIGGERED14_Msk (0x1UL << EGU_INTENSET_TRIGGERED14_Pos) /*!< Bit mask of TRIGGERED14 field. */ +#define EGU_INTENSET_TRIGGERED14_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED14_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED14_Set (1UL) /*!< Enable */ + +/* Bit 13 : Write '1' to Enable interrupt for TRIGGERED[13] event */ +#define EGU_INTENSET_TRIGGERED13_Pos (13UL) /*!< Position of TRIGGERED13 field. */ +#define EGU_INTENSET_TRIGGERED13_Msk (0x1UL << EGU_INTENSET_TRIGGERED13_Pos) /*!< Bit mask of TRIGGERED13 field. */ +#define EGU_INTENSET_TRIGGERED13_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED13_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED13_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for TRIGGERED[12] event */ +#define EGU_INTENSET_TRIGGERED12_Pos (12UL) /*!< Position of TRIGGERED12 field. */ +#define EGU_INTENSET_TRIGGERED12_Msk (0x1UL << EGU_INTENSET_TRIGGERED12_Pos) /*!< Bit mask of TRIGGERED12 field. */ +#define EGU_INTENSET_TRIGGERED12_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED12_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED12_Set (1UL) /*!< Enable */ + +/* Bit 11 : Write '1' to Enable interrupt for TRIGGERED[11] event */ +#define EGU_INTENSET_TRIGGERED11_Pos (11UL) /*!< Position of TRIGGERED11 field. */ +#define EGU_INTENSET_TRIGGERED11_Msk (0x1UL << EGU_INTENSET_TRIGGERED11_Pos) /*!< Bit mask of TRIGGERED11 field. */ +#define EGU_INTENSET_TRIGGERED11_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED11_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED11_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for TRIGGERED[10] event */ +#define EGU_INTENSET_TRIGGERED10_Pos (10UL) /*!< Position of TRIGGERED10 field. */ +#define EGU_INTENSET_TRIGGERED10_Msk (0x1UL << EGU_INTENSET_TRIGGERED10_Pos) /*!< Bit mask of TRIGGERED10 field. */ +#define EGU_INTENSET_TRIGGERED10_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED10_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED10_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for TRIGGERED[9] event */ +#define EGU_INTENSET_TRIGGERED9_Pos (9UL) /*!< Position of TRIGGERED9 field. */ +#define EGU_INTENSET_TRIGGERED9_Msk (0x1UL << EGU_INTENSET_TRIGGERED9_Pos) /*!< Bit mask of TRIGGERED9 field. */ +#define EGU_INTENSET_TRIGGERED9_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED9_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED9_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for TRIGGERED[8] event */ +#define EGU_INTENSET_TRIGGERED8_Pos (8UL) /*!< Position of TRIGGERED8 field. */ +#define EGU_INTENSET_TRIGGERED8_Msk (0x1UL << EGU_INTENSET_TRIGGERED8_Pos) /*!< Bit mask of TRIGGERED8 field. */ +#define EGU_INTENSET_TRIGGERED8_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED8_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED8_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for TRIGGERED[7] event */ +#define EGU_INTENSET_TRIGGERED7_Pos (7UL) /*!< Position of TRIGGERED7 field. */ +#define EGU_INTENSET_TRIGGERED7_Msk (0x1UL << EGU_INTENSET_TRIGGERED7_Pos) /*!< Bit mask of TRIGGERED7 field. */ +#define EGU_INTENSET_TRIGGERED7_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED7_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED7_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for TRIGGERED[6] event */ +#define EGU_INTENSET_TRIGGERED6_Pos (6UL) /*!< Position of TRIGGERED6 field. */ +#define EGU_INTENSET_TRIGGERED6_Msk (0x1UL << EGU_INTENSET_TRIGGERED6_Pos) /*!< Bit mask of TRIGGERED6 field. */ +#define EGU_INTENSET_TRIGGERED6_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED6_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED6_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for TRIGGERED[5] event */ +#define EGU_INTENSET_TRIGGERED5_Pos (5UL) /*!< Position of TRIGGERED5 field. */ +#define EGU_INTENSET_TRIGGERED5_Msk (0x1UL << EGU_INTENSET_TRIGGERED5_Pos) /*!< Bit mask of TRIGGERED5 field. */ +#define EGU_INTENSET_TRIGGERED5_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED5_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED5_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for TRIGGERED[4] event */ +#define EGU_INTENSET_TRIGGERED4_Pos (4UL) /*!< Position of TRIGGERED4 field. */ +#define EGU_INTENSET_TRIGGERED4_Msk (0x1UL << EGU_INTENSET_TRIGGERED4_Pos) /*!< Bit mask of TRIGGERED4 field. */ +#define EGU_INTENSET_TRIGGERED4_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED4_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED4_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for TRIGGERED[3] event */ +#define EGU_INTENSET_TRIGGERED3_Pos (3UL) /*!< Position of TRIGGERED3 field. */ +#define EGU_INTENSET_TRIGGERED3_Msk (0x1UL << EGU_INTENSET_TRIGGERED3_Pos) /*!< Bit mask of TRIGGERED3 field. */ +#define EGU_INTENSET_TRIGGERED3_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED3_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED3_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for TRIGGERED[2] event */ +#define EGU_INTENSET_TRIGGERED2_Pos (2UL) /*!< Position of TRIGGERED2 field. */ +#define EGU_INTENSET_TRIGGERED2_Msk (0x1UL << EGU_INTENSET_TRIGGERED2_Pos) /*!< Bit mask of TRIGGERED2 field. */ +#define EGU_INTENSET_TRIGGERED2_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED2_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED2_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for TRIGGERED[1] event */ +#define EGU_INTENSET_TRIGGERED1_Pos (1UL) /*!< Position of TRIGGERED1 field. */ +#define EGU_INTENSET_TRIGGERED1_Msk (0x1UL << EGU_INTENSET_TRIGGERED1_Pos) /*!< Bit mask of TRIGGERED1 field. */ +#define EGU_INTENSET_TRIGGERED1_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED1_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED1_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for TRIGGERED[0] event */ +#define EGU_INTENSET_TRIGGERED0_Pos (0UL) /*!< Position of TRIGGERED0 field. */ +#define EGU_INTENSET_TRIGGERED0_Msk (0x1UL << EGU_INTENSET_TRIGGERED0_Pos) /*!< Bit mask of TRIGGERED0 field. */ +#define EGU_INTENSET_TRIGGERED0_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENSET_TRIGGERED0_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENSET_TRIGGERED0_Set (1UL) /*!< Enable */ + +/* Register: EGU_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 15 : Write '1' to Disable interrupt for TRIGGERED[15] event */ +#define EGU_INTENCLR_TRIGGERED15_Pos (15UL) /*!< Position of TRIGGERED15 field. */ +#define EGU_INTENCLR_TRIGGERED15_Msk (0x1UL << EGU_INTENCLR_TRIGGERED15_Pos) /*!< Bit mask of TRIGGERED15 field. */ +#define EGU_INTENCLR_TRIGGERED15_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED15_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED15_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for TRIGGERED[14] event */ +#define EGU_INTENCLR_TRIGGERED14_Pos (14UL) /*!< Position of TRIGGERED14 field. */ +#define EGU_INTENCLR_TRIGGERED14_Msk (0x1UL << EGU_INTENCLR_TRIGGERED14_Pos) /*!< Bit mask of TRIGGERED14 field. */ +#define EGU_INTENCLR_TRIGGERED14_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED14_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED14_Clear (1UL) /*!< Disable */ + +/* Bit 13 : Write '1' to Disable interrupt for TRIGGERED[13] event */ +#define EGU_INTENCLR_TRIGGERED13_Pos (13UL) /*!< Position of TRIGGERED13 field. */ +#define EGU_INTENCLR_TRIGGERED13_Msk (0x1UL << EGU_INTENCLR_TRIGGERED13_Pos) /*!< Bit mask of TRIGGERED13 field. */ +#define EGU_INTENCLR_TRIGGERED13_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED13_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED13_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for TRIGGERED[12] event */ +#define EGU_INTENCLR_TRIGGERED12_Pos (12UL) /*!< Position of TRIGGERED12 field. */ +#define EGU_INTENCLR_TRIGGERED12_Msk (0x1UL << EGU_INTENCLR_TRIGGERED12_Pos) /*!< Bit mask of TRIGGERED12 field. */ +#define EGU_INTENCLR_TRIGGERED12_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED12_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED12_Clear (1UL) /*!< Disable */ + +/* Bit 11 : Write '1' to Disable interrupt for TRIGGERED[11] event */ +#define EGU_INTENCLR_TRIGGERED11_Pos (11UL) /*!< Position of TRIGGERED11 field. */ +#define EGU_INTENCLR_TRIGGERED11_Msk (0x1UL << EGU_INTENCLR_TRIGGERED11_Pos) /*!< Bit mask of TRIGGERED11 field. */ +#define EGU_INTENCLR_TRIGGERED11_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED11_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED11_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for TRIGGERED[10] event */ +#define EGU_INTENCLR_TRIGGERED10_Pos (10UL) /*!< Position of TRIGGERED10 field. */ +#define EGU_INTENCLR_TRIGGERED10_Msk (0x1UL << EGU_INTENCLR_TRIGGERED10_Pos) /*!< Bit mask of TRIGGERED10 field. */ +#define EGU_INTENCLR_TRIGGERED10_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED10_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED10_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for TRIGGERED[9] event */ +#define EGU_INTENCLR_TRIGGERED9_Pos (9UL) /*!< Position of TRIGGERED9 field. */ +#define EGU_INTENCLR_TRIGGERED9_Msk (0x1UL << EGU_INTENCLR_TRIGGERED9_Pos) /*!< Bit mask of TRIGGERED9 field. */ +#define EGU_INTENCLR_TRIGGERED9_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED9_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED9_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for TRIGGERED[8] event */ +#define EGU_INTENCLR_TRIGGERED8_Pos (8UL) /*!< Position of TRIGGERED8 field. */ +#define EGU_INTENCLR_TRIGGERED8_Msk (0x1UL << EGU_INTENCLR_TRIGGERED8_Pos) /*!< Bit mask of TRIGGERED8 field. */ +#define EGU_INTENCLR_TRIGGERED8_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED8_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED8_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for TRIGGERED[7] event */ +#define EGU_INTENCLR_TRIGGERED7_Pos (7UL) /*!< Position of TRIGGERED7 field. */ +#define EGU_INTENCLR_TRIGGERED7_Msk (0x1UL << EGU_INTENCLR_TRIGGERED7_Pos) /*!< Bit mask of TRIGGERED7 field. */ +#define EGU_INTENCLR_TRIGGERED7_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED7_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED7_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for TRIGGERED[6] event */ +#define EGU_INTENCLR_TRIGGERED6_Pos (6UL) /*!< Position of TRIGGERED6 field. */ +#define EGU_INTENCLR_TRIGGERED6_Msk (0x1UL << EGU_INTENCLR_TRIGGERED6_Pos) /*!< Bit mask of TRIGGERED6 field. */ +#define EGU_INTENCLR_TRIGGERED6_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED6_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED6_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for TRIGGERED[5] event */ +#define EGU_INTENCLR_TRIGGERED5_Pos (5UL) /*!< Position of TRIGGERED5 field. */ +#define EGU_INTENCLR_TRIGGERED5_Msk (0x1UL << EGU_INTENCLR_TRIGGERED5_Pos) /*!< Bit mask of TRIGGERED5 field. */ +#define EGU_INTENCLR_TRIGGERED5_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED5_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED5_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for TRIGGERED[4] event */ +#define EGU_INTENCLR_TRIGGERED4_Pos (4UL) /*!< Position of TRIGGERED4 field. */ +#define EGU_INTENCLR_TRIGGERED4_Msk (0x1UL << EGU_INTENCLR_TRIGGERED4_Pos) /*!< Bit mask of TRIGGERED4 field. */ +#define EGU_INTENCLR_TRIGGERED4_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED4_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED4_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for TRIGGERED[3] event */ +#define EGU_INTENCLR_TRIGGERED3_Pos (3UL) /*!< Position of TRIGGERED3 field. */ +#define EGU_INTENCLR_TRIGGERED3_Msk (0x1UL << EGU_INTENCLR_TRIGGERED3_Pos) /*!< Bit mask of TRIGGERED3 field. */ +#define EGU_INTENCLR_TRIGGERED3_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED3_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED3_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for TRIGGERED[2] event */ +#define EGU_INTENCLR_TRIGGERED2_Pos (2UL) /*!< Position of TRIGGERED2 field. */ +#define EGU_INTENCLR_TRIGGERED2_Msk (0x1UL << EGU_INTENCLR_TRIGGERED2_Pos) /*!< Bit mask of TRIGGERED2 field. */ +#define EGU_INTENCLR_TRIGGERED2_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED2_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED2_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for TRIGGERED[1] event */ +#define EGU_INTENCLR_TRIGGERED1_Pos (1UL) /*!< Position of TRIGGERED1 field. */ +#define EGU_INTENCLR_TRIGGERED1_Msk (0x1UL << EGU_INTENCLR_TRIGGERED1_Pos) /*!< Bit mask of TRIGGERED1 field. */ +#define EGU_INTENCLR_TRIGGERED1_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED1_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED1_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for TRIGGERED[0] event */ +#define EGU_INTENCLR_TRIGGERED0_Pos (0UL) /*!< Position of TRIGGERED0 field. */ +#define EGU_INTENCLR_TRIGGERED0_Msk (0x1UL << EGU_INTENCLR_TRIGGERED0_Pos) /*!< Bit mask of TRIGGERED0 field. */ +#define EGU_INTENCLR_TRIGGERED0_Disabled (0UL) /*!< Read: Disabled */ +#define EGU_INTENCLR_TRIGGERED0_Enabled (1UL) /*!< Read: Enabled */ +#define EGU_INTENCLR_TRIGGERED0_Clear (1UL) /*!< Disable */ + + +/* Peripheral: FICR */ +/* Description: Factory Information Configuration Registers */ + +/* Register: FICR_CODEPAGESIZE */ +/* Description: Code memory page size */ + +/* Bits 31..0 : Code memory page size */ +#define FICR_CODEPAGESIZE_CODEPAGESIZE_Pos (0UL) /*!< Position of CODEPAGESIZE field. */ +#define FICR_CODEPAGESIZE_CODEPAGESIZE_Msk (0xFFFFFFFFUL << FICR_CODEPAGESIZE_CODEPAGESIZE_Pos) /*!< Bit mask of CODEPAGESIZE field. */ + +/* Register: FICR_CODESIZE */ +/* Description: Code memory size */ + +/* Bits 31..0 : Code memory size in number of pages */ +#define FICR_CODESIZE_CODESIZE_Pos (0UL) /*!< Position of CODESIZE field. */ +#define FICR_CODESIZE_CODESIZE_Msk (0xFFFFFFFFUL << FICR_CODESIZE_CODESIZE_Pos) /*!< Bit mask of CODESIZE field. */ + +/* Register: FICR_DEVICEID */ +/* Description: Description collection[0]: Device identifier */ + +/* Bits 31..0 : 64 bit unique device identifier */ +#define FICR_DEVICEID_DEVICEID_Pos (0UL) /*!< Position of DEVICEID field. */ +#define FICR_DEVICEID_DEVICEID_Msk (0xFFFFFFFFUL << FICR_DEVICEID_DEVICEID_Pos) /*!< Bit mask of DEVICEID field. */ + +/* Register: FICR_ER */ +/* Description: Description collection[0]: Encryption root, word 0 */ + +/* Bits 31..0 : Encryption root, word 0 */ +#define FICR_ER_ER_Pos (0UL) /*!< Position of ER field. */ +#define FICR_ER_ER_Msk (0xFFFFFFFFUL << FICR_ER_ER_Pos) /*!< Bit mask of ER field. */ + +/* Register: FICR_IR */ +/* Description: Description collection[0]: Identity Root, word 0 */ + +/* Bits 31..0 : Identity Root, word 0 */ +#define FICR_IR_IR_Pos (0UL) /*!< Position of IR field. */ +#define FICR_IR_IR_Msk (0xFFFFFFFFUL << FICR_IR_IR_Pos) /*!< Bit mask of IR field. */ + +/* Register: FICR_DEVICEADDRTYPE */ +/* Description: Device address type */ + +/* Bit 0 : Device address type */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Pos (0UL) /*!< Position of DEVICEADDRTYPE field. */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Msk (0x1UL << FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Pos) /*!< Bit mask of DEVICEADDRTYPE field. */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Public (0UL) /*!< Public address */ +#define FICR_DEVICEADDRTYPE_DEVICEADDRTYPE_Random (1UL) /*!< Random address */ + +/* Register: FICR_DEVICEADDR */ +/* Description: Description collection[0]: Device address 0 */ + +/* Bits 31..0 : 48 bit device address */ +#define FICR_DEVICEADDR_DEVICEADDR_Pos (0UL) /*!< Position of DEVICEADDR field. */ +#define FICR_DEVICEADDR_DEVICEADDR_Msk (0xFFFFFFFFUL << FICR_DEVICEADDR_DEVICEADDR_Pos) /*!< Bit mask of DEVICEADDR field. */ + +/* Register: FICR_INFO_PART */ +/* Description: Part code */ + +/* Bits 31..0 : Part code */ +#define FICR_INFO_PART_PART_Pos (0UL) /*!< Position of PART field. */ +#define FICR_INFO_PART_PART_Msk (0xFFFFFFFFUL << FICR_INFO_PART_PART_Pos) /*!< Bit mask of PART field. */ +#define FICR_INFO_PART_PART_N52840 (0x52840UL) /*!< nRF52840 */ +#define FICR_INFO_PART_PART_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_INFO_VARIANT */ +/* Description: Part variant (hardware version and production configuration). */ + +/* Bits 31..0 : Part variant (hardware version and production configuration). Encoded as ASCII. */ +#define FICR_INFO_VARIANT_VARIANT_Pos (0UL) /*!< Position of VARIANT field. */ +#define FICR_INFO_VARIANT_VARIANT_Msk (0xFFFFFFFFUL << FICR_INFO_VARIANT_VARIANT_Pos) /*!< Bit mask of VARIANT field. */ +#define FICR_INFO_VARIANT_VARIANT_AAAA (0x41414141UL) /*!< AAAA */ +#define FICR_INFO_VARIANT_VARIANT_AAAB (0x41414142UL) /*!< AAAB */ +#define FICR_INFO_VARIANT_VARIANT_AAB0 (0x41414230UL) /*!< AAB0 */ +#define FICR_INFO_VARIANT_VARIANT_AABA (0x41414241UL) /*!< AABA */ +#define FICR_INFO_VARIANT_VARIANT_AABB (0x41414242UL) /*!< AABB */ +#define FICR_INFO_VARIANT_VARIANT_ABBA (0x41424241UL) /*!< ABBA */ +#define FICR_INFO_VARIANT_VARIANT_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_INFO_PACKAGE */ +/* Description: Package option */ + +/* Bits 31..0 : Package option */ +#define FICR_INFO_PACKAGE_PACKAGE_Pos (0UL) /*!< Position of PACKAGE field. */ +#define FICR_INFO_PACKAGE_PACKAGE_Msk (0xFFFFFFFFUL << FICR_INFO_PACKAGE_PACKAGE_Pos) /*!< Bit mask of PACKAGE field. */ +#define FICR_INFO_PACKAGE_PACKAGE_QI (0x2004UL) /*!< QIxx - 73-pin aQFN */ +#define FICR_INFO_PACKAGE_PACKAGE_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_INFO_RAM */ +/* Description: RAM variant */ + +/* Bits 31..0 : RAM variant */ +#define FICR_INFO_RAM_RAM_Pos (0UL) /*!< Position of RAM field. */ +#define FICR_INFO_RAM_RAM_Msk (0xFFFFFFFFUL << FICR_INFO_RAM_RAM_Pos) /*!< Bit mask of RAM field. */ +#define FICR_INFO_RAM_RAM_K16 (0x10UL) /*!< 16 kByte RAM */ +#define FICR_INFO_RAM_RAM_K32 (0x20UL) /*!< 32 kByte RAM */ +#define FICR_INFO_RAM_RAM_K64 (0x40UL) /*!< 64 kByte RAM */ +#define FICR_INFO_RAM_RAM_K128 (0x80UL) /*!< 128 kByte RAM */ +#define FICR_INFO_RAM_RAM_K256 (0x100UL) /*!< 256 kByte RAM */ +#define FICR_INFO_RAM_RAM_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_INFO_FLASH */ +/* Description: Flash variant */ + +/* Bits 31..0 : Flash variant */ +#define FICR_INFO_FLASH_FLASH_Pos (0UL) /*!< Position of FLASH field. */ +#define FICR_INFO_FLASH_FLASH_Msk (0xFFFFFFFFUL << FICR_INFO_FLASH_FLASH_Pos) /*!< Bit mask of FLASH field. */ +#define FICR_INFO_FLASH_FLASH_K128 (0x80UL) /*!< 128 kByte FLASH */ +#define FICR_INFO_FLASH_FLASH_K256 (0x100UL) /*!< 256 kByte FLASH */ +#define FICR_INFO_FLASH_FLASH_K512 (0x200UL) /*!< 512 kByte FLASH */ +#define FICR_INFO_FLASH_FLASH_K1024 (0x400UL) /*!< 1 MByte FLASH */ +#define FICR_INFO_FLASH_FLASH_K2048 (0x800UL) /*!< 2 MByte FLASH */ +#define FICR_INFO_FLASH_FLASH_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ + +/* Register: FICR_TEMP_A0 */ +/* Description: Slope definition A0. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A0_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A0_A_Msk (0xFFFUL << FICR_TEMP_A0_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A1 */ +/* Description: Slope definition A1. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A1_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A1_A_Msk (0xFFFUL << FICR_TEMP_A1_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A2 */ +/* Description: Slope definition A2. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A2_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A2_A_Msk (0xFFFUL << FICR_TEMP_A2_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A3 */ +/* Description: Slope definition A3. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A3_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A3_A_Msk (0xFFFUL << FICR_TEMP_A3_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A4 */ +/* Description: Slope definition A4. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A4_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A4_A_Msk (0xFFFUL << FICR_TEMP_A4_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_A5 */ +/* Description: Slope definition A5. */ + +/* Bits 11..0 : A (slope definition) register. */ +#define FICR_TEMP_A5_A_Pos (0UL) /*!< Position of A field. */ +#define FICR_TEMP_A5_A_Msk (0xFFFUL << FICR_TEMP_A5_A_Pos) /*!< Bit mask of A field. */ + +/* Register: FICR_TEMP_B0 */ +/* Description: y-intercept B0. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B0_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B0_B_Msk (0x3FFFUL << FICR_TEMP_B0_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B1 */ +/* Description: y-intercept B1. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B1_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B1_B_Msk (0x3FFFUL << FICR_TEMP_B1_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B2 */ +/* Description: y-intercept B2. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B2_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B2_B_Msk (0x3FFFUL << FICR_TEMP_B2_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B3 */ +/* Description: y-intercept B3. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B3_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B3_B_Msk (0x3FFFUL << FICR_TEMP_B3_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B4 */ +/* Description: y-intercept B4. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B4_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B4_B_Msk (0x3FFFUL << FICR_TEMP_B4_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_B5 */ +/* Description: y-intercept B5. */ + +/* Bits 13..0 : B (y-intercept) */ +#define FICR_TEMP_B5_B_Pos (0UL) /*!< Position of B field. */ +#define FICR_TEMP_B5_B_Msk (0x3FFFUL << FICR_TEMP_B5_B_Pos) /*!< Bit mask of B field. */ + +/* Register: FICR_TEMP_T0 */ +/* Description: Segment end T0. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T0_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T0_T_Msk (0xFFUL << FICR_TEMP_T0_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_TEMP_T1 */ +/* Description: Segment end T1. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T1_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T1_T_Msk (0xFFUL << FICR_TEMP_T1_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_TEMP_T2 */ +/* Description: Segment end T2. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T2_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T2_T_Msk (0xFFUL << FICR_TEMP_T2_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_TEMP_T3 */ +/* Description: Segment end T3. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T3_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T3_T_Msk (0xFFUL << FICR_TEMP_T3_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_TEMP_T4 */ +/* Description: Segment end T4. */ + +/* Bits 7..0 : T (segment end)register. */ +#define FICR_TEMP_T4_T_Pos (0UL) /*!< Position of T field. */ +#define FICR_TEMP_T4_T_Msk (0xFFUL << FICR_TEMP_T4_T_Pos) /*!< Bit mask of T field. */ + +/* Register: FICR_NFC_TAGHEADER0 */ +/* Description: Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + +/* Bits 31..24 : Unique identifier byte 3 */ +#define FICR_NFC_TAGHEADER0_UD3_Pos (24UL) /*!< Position of UD3 field. */ +#define FICR_NFC_TAGHEADER0_UD3_Msk (0xFFUL << FICR_NFC_TAGHEADER0_UD3_Pos) /*!< Bit mask of UD3 field. */ + +/* Bits 23..16 : Unique identifier byte 2 */ +#define FICR_NFC_TAGHEADER0_UD2_Pos (16UL) /*!< Position of UD2 field. */ +#define FICR_NFC_TAGHEADER0_UD2_Msk (0xFFUL << FICR_NFC_TAGHEADER0_UD2_Pos) /*!< Bit mask of UD2 field. */ + +/* Bits 15..8 : Unique identifier byte 1 */ +#define FICR_NFC_TAGHEADER0_UD1_Pos (8UL) /*!< Position of UD1 field. */ +#define FICR_NFC_TAGHEADER0_UD1_Msk (0xFFUL << FICR_NFC_TAGHEADER0_UD1_Pos) /*!< Bit mask of UD1 field. */ + +/* Bits 7..0 : Default Manufacturer ID: Nordic Semiconductor ASA has ICM 0x5F */ +#define FICR_NFC_TAGHEADER0_MFGID_Pos (0UL) /*!< Position of MFGID field. */ +#define FICR_NFC_TAGHEADER0_MFGID_Msk (0xFFUL << FICR_NFC_TAGHEADER0_MFGID_Pos) /*!< Bit mask of MFGID field. */ + +/* Register: FICR_NFC_TAGHEADER1 */ +/* Description: Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + +/* Bits 31..24 : Unique identifier byte 7 */ +#define FICR_NFC_TAGHEADER1_UD7_Pos (24UL) /*!< Position of UD7 field. */ +#define FICR_NFC_TAGHEADER1_UD7_Msk (0xFFUL << FICR_NFC_TAGHEADER1_UD7_Pos) /*!< Bit mask of UD7 field. */ + +/* Bits 23..16 : Unique identifier byte 6 */ +#define FICR_NFC_TAGHEADER1_UD6_Pos (16UL) /*!< Position of UD6 field. */ +#define FICR_NFC_TAGHEADER1_UD6_Msk (0xFFUL << FICR_NFC_TAGHEADER1_UD6_Pos) /*!< Bit mask of UD6 field. */ + +/* Bits 15..8 : Unique identifier byte 5 */ +#define FICR_NFC_TAGHEADER1_UD5_Pos (8UL) /*!< Position of UD5 field. */ +#define FICR_NFC_TAGHEADER1_UD5_Msk (0xFFUL << FICR_NFC_TAGHEADER1_UD5_Pos) /*!< Bit mask of UD5 field. */ + +/* Bits 7..0 : Unique identifier byte 4 */ +#define FICR_NFC_TAGHEADER1_UD4_Pos (0UL) /*!< Position of UD4 field. */ +#define FICR_NFC_TAGHEADER1_UD4_Msk (0xFFUL << FICR_NFC_TAGHEADER1_UD4_Pos) /*!< Bit mask of UD4 field. */ + +/* Register: FICR_NFC_TAGHEADER2 */ +/* Description: Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + +/* Bits 31..24 : Unique identifier byte 11 */ +#define FICR_NFC_TAGHEADER2_UD11_Pos (24UL) /*!< Position of UD11 field. */ +#define FICR_NFC_TAGHEADER2_UD11_Msk (0xFFUL << FICR_NFC_TAGHEADER2_UD11_Pos) /*!< Bit mask of UD11 field. */ + +/* Bits 23..16 : Unique identifier byte 10 */ +#define FICR_NFC_TAGHEADER2_UD10_Pos (16UL) /*!< Position of UD10 field. */ +#define FICR_NFC_TAGHEADER2_UD10_Msk (0xFFUL << FICR_NFC_TAGHEADER2_UD10_Pos) /*!< Bit mask of UD10 field. */ + +/* Bits 15..8 : Unique identifier byte 9 */ +#define FICR_NFC_TAGHEADER2_UD9_Pos (8UL) /*!< Position of UD9 field. */ +#define FICR_NFC_TAGHEADER2_UD9_Msk (0xFFUL << FICR_NFC_TAGHEADER2_UD9_Pos) /*!< Bit mask of UD9 field. */ + +/* Bits 7..0 : Unique identifier byte 8 */ +#define FICR_NFC_TAGHEADER2_UD8_Pos (0UL) /*!< Position of UD8 field. */ +#define FICR_NFC_TAGHEADER2_UD8_Msk (0xFFUL << FICR_NFC_TAGHEADER2_UD8_Pos) /*!< Bit mask of UD8 field. */ + +/* Register: FICR_NFC_TAGHEADER3 */ +/* Description: Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. */ + +/* Bits 31..24 : Unique identifier byte 15 */ +#define FICR_NFC_TAGHEADER3_UD15_Pos (24UL) /*!< Position of UD15 field. */ +#define FICR_NFC_TAGHEADER3_UD15_Msk (0xFFUL << FICR_NFC_TAGHEADER3_UD15_Pos) /*!< Bit mask of UD15 field. */ + +/* Bits 23..16 : Unique identifier byte 14 */ +#define FICR_NFC_TAGHEADER3_UD14_Pos (16UL) /*!< Position of UD14 field. */ +#define FICR_NFC_TAGHEADER3_UD14_Msk (0xFFUL << FICR_NFC_TAGHEADER3_UD14_Pos) /*!< Bit mask of UD14 field. */ + +/* Bits 15..8 : Unique identifier byte 13 */ +#define FICR_NFC_TAGHEADER3_UD13_Pos (8UL) /*!< Position of UD13 field. */ +#define FICR_NFC_TAGHEADER3_UD13_Msk (0xFFUL << FICR_NFC_TAGHEADER3_UD13_Pos) /*!< Bit mask of UD13 field. */ + +/* Bits 7..0 : Unique identifier byte 12 */ +#define FICR_NFC_TAGHEADER3_UD12_Pos (0UL) /*!< Position of UD12 field. */ +#define FICR_NFC_TAGHEADER3_UD12_Msk (0xFFUL << FICR_NFC_TAGHEADER3_UD12_Pos) /*!< Bit mask of UD12 field. */ + + +/* Peripheral: GPIOTE */ +/* Description: GPIO Tasks and Events */ + +/* Register: GPIOTE_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 31 : Write '1' to Enable interrupt for PORT event */ +#define GPIOTE_INTENSET_PORT_Pos (31UL) /*!< Position of PORT field. */ +#define GPIOTE_INTENSET_PORT_Msk (0x1UL << GPIOTE_INTENSET_PORT_Pos) /*!< Bit mask of PORT field. */ +#define GPIOTE_INTENSET_PORT_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_PORT_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_PORT_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for IN[7] event */ +#define GPIOTE_INTENSET_IN7_Pos (7UL) /*!< Position of IN7 field. */ +#define GPIOTE_INTENSET_IN7_Msk (0x1UL << GPIOTE_INTENSET_IN7_Pos) /*!< Bit mask of IN7 field. */ +#define GPIOTE_INTENSET_IN7_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN7_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN7_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for IN[6] event */ +#define GPIOTE_INTENSET_IN6_Pos (6UL) /*!< Position of IN6 field. */ +#define GPIOTE_INTENSET_IN6_Msk (0x1UL << GPIOTE_INTENSET_IN6_Pos) /*!< Bit mask of IN6 field. */ +#define GPIOTE_INTENSET_IN6_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN6_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN6_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for IN[5] event */ +#define GPIOTE_INTENSET_IN5_Pos (5UL) /*!< Position of IN5 field. */ +#define GPIOTE_INTENSET_IN5_Msk (0x1UL << GPIOTE_INTENSET_IN5_Pos) /*!< Bit mask of IN5 field. */ +#define GPIOTE_INTENSET_IN5_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN5_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN5_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for IN[4] event */ +#define GPIOTE_INTENSET_IN4_Pos (4UL) /*!< Position of IN4 field. */ +#define GPIOTE_INTENSET_IN4_Msk (0x1UL << GPIOTE_INTENSET_IN4_Pos) /*!< Bit mask of IN4 field. */ +#define GPIOTE_INTENSET_IN4_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN4_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN4_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for IN[3] event */ +#define GPIOTE_INTENSET_IN3_Pos (3UL) /*!< Position of IN3 field. */ +#define GPIOTE_INTENSET_IN3_Msk (0x1UL << GPIOTE_INTENSET_IN3_Pos) /*!< Bit mask of IN3 field. */ +#define GPIOTE_INTENSET_IN3_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN3_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN3_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for IN[2] event */ +#define GPIOTE_INTENSET_IN2_Pos (2UL) /*!< Position of IN2 field. */ +#define GPIOTE_INTENSET_IN2_Msk (0x1UL << GPIOTE_INTENSET_IN2_Pos) /*!< Bit mask of IN2 field. */ +#define GPIOTE_INTENSET_IN2_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN2_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN2_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for IN[1] event */ +#define GPIOTE_INTENSET_IN1_Pos (1UL) /*!< Position of IN1 field. */ +#define GPIOTE_INTENSET_IN1_Msk (0x1UL << GPIOTE_INTENSET_IN1_Pos) /*!< Bit mask of IN1 field. */ +#define GPIOTE_INTENSET_IN1_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN1_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN1_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for IN[0] event */ +#define GPIOTE_INTENSET_IN0_Pos (0UL) /*!< Position of IN0 field. */ +#define GPIOTE_INTENSET_IN0_Msk (0x1UL << GPIOTE_INTENSET_IN0_Pos) /*!< Bit mask of IN0 field. */ +#define GPIOTE_INTENSET_IN0_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENSET_IN0_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENSET_IN0_Set (1UL) /*!< Enable */ + +/* Register: GPIOTE_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 31 : Write '1' to Disable interrupt for PORT event */ +#define GPIOTE_INTENCLR_PORT_Pos (31UL) /*!< Position of PORT field. */ +#define GPIOTE_INTENCLR_PORT_Msk (0x1UL << GPIOTE_INTENCLR_PORT_Pos) /*!< Bit mask of PORT field. */ +#define GPIOTE_INTENCLR_PORT_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_PORT_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_PORT_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for IN[7] event */ +#define GPIOTE_INTENCLR_IN7_Pos (7UL) /*!< Position of IN7 field. */ +#define GPIOTE_INTENCLR_IN7_Msk (0x1UL << GPIOTE_INTENCLR_IN7_Pos) /*!< Bit mask of IN7 field. */ +#define GPIOTE_INTENCLR_IN7_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN7_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN7_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for IN[6] event */ +#define GPIOTE_INTENCLR_IN6_Pos (6UL) /*!< Position of IN6 field. */ +#define GPIOTE_INTENCLR_IN6_Msk (0x1UL << GPIOTE_INTENCLR_IN6_Pos) /*!< Bit mask of IN6 field. */ +#define GPIOTE_INTENCLR_IN6_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN6_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN6_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for IN[5] event */ +#define GPIOTE_INTENCLR_IN5_Pos (5UL) /*!< Position of IN5 field. */ +#define GPIOTE_INTENCLR_IN5_Msk (0x1UL << GPIOTE_INTENCLR_IN5_Pos) /*!< Bit mask of IN5 field. */ +#define GPIOTE_INTENCLR_IN5_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN5_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN5_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for IN[4] event */ +#define GPIOTE_INTENCLR_IN4_Pos (4UL) /*!< Position of IN4 field. */ +#define GPIOTE_INTENCLR_IN4_Msk (0x1UL << GPIOTE_INTENCLR_IN4_Pos) /*!< Bit mask of IN4 field. */ +#define GPIOTE_INTENCLR_IN4_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN4_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN4_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for IN[3] event */ +#define GPIOTE_INTENCLR_IN3_Pos (3UL) /*!< Position of IN3 field. */ +#define GPIOTE_INTENCLR_IN3_Msk (0x1UL << GPIOTE_INTENCLR_IN3_Pos) /*!< Bit mask of IN3 field. */ +#define GPIOTE_INTENCLR_IN3_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN3_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN3_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for IN[2] event */ +#define GPIOTE_INTENCLR_IN2_Pos (2UL) /*!< Position of IN2 field. */ +#define GPIOTE_INTENCLR_IN2_Msk (0x1UL << GPIOTE_INTENCLR_IN2_Pos) /*!< Bit mask of IN2 field. */ +#define GPIOTE_INTENCLR_IN2_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN2_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN2_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for IN[1] event */ +#define GPIOTE_INTENCLR_IN1_Pos (1UL) /*!< Position of IN1 field. */ +#define GPIOTE_INTENCLR_IN1_Msk (0x1UL << GPIOTE_INTENCLR_IN1_Pos) /*!< Bit mask of IN1 field. */ +#define GPIOTE_INTENCLR_IN1_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN1_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN1_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for IN[0] event */ +#define GPIOTE_INTENCLR_IN0_Pos (0UL) /*!< Position of IN0 field. */ +#define GPIOTE_INTENCLR_IN0_Msk (0x1UL << GPIOTE_INTENCLR_IN0_Pos) /*!< Bit mask of IN0 field. */ +#define GPIOTE_INTENCLR_IN0_Disabled (0UL) /*!< Read: Disabled */ +#define GPIOTE_INTENCLR_IN0_Enabled (1UL) /*!< Read: Enabled */ +#define GPIOTE_INTENCLR_IN0_Clear (1UL) /*!< Disable */ + +/* Register: GPIOTE_CONFIG */ +/* Description: Description collection[0]: Configuration for OUT[n], SET[n] and CLR[n] tasks and IN[n] event */ + +/* Bit 20 : When in task mode: Initial value of the output when the GPIOTE channel is configured. When in event mode: No effect. */ +#define GPIOTE_CONFIG_OUTINIT_Pos (20UL) /*!< Position of OUTINIT field. */ +#define GPIOTE_CONFIG_OUTINIT_Msk (0x1UL << GPIOTE_CONFIG_OUTINIT_Pos) /*!< Bit mask of OUTINIT field. */ +#define GPIOTE_CONFIG_OUTINIT_Low (0UL) /*!< Task mode: Initial value of pin before task triggering is low */ +#define GPIOTE_CONFIG_OUTINIT_High (1UL) /*!< Task mode: Initial value of pin before task triggering is high */ + +/* Bits 17..16 : When In task mode: Operation to be performed on output when OUT[n] task is triggered. When In event mode: Operation on input that shall trigger IN[n] event. */ +#define GPIOTE_CONFIG_POLARITY_Pos (16UL) /*!< Position of POLARITY field. */ +#define GPIOTE_CONFIG_POLARITY_Msk (0x3UL << GPIOTE_CONFIG_POLARITY_Pos) /*!< Bit mask of POLARITY field. */ +#define GPIOTE_CONFIG_POLARITY_None (0UL) /*!< Task mode: No effect on pin from OUT[n] task. Event mode: no IN[n] event generated on pin activity. */ +#define GPIOTE_CONFIG_POLARITY_LoToHi (1UL) /*!< Task mode: Set pin from OUT[n] task. Event mode: Generate IN[n] event when rising edge on pin. */ +#define GPIOTE_CONFIG_POLARITY_HiToLo (2UL) /*!< Task mode: Clear pin from OUT[n] task. Event mode: Generate IN[n] event when falling edge on pin. */ +#define GPIOTE_CONFIG_POLARITY_Toggle (3UL) /*!< Task mode: Toggle pin from OUT[n]. Event mode: Generate IN[n] when any change on pin. */ + +/* Bits 14..13 : Port number */ +#define GPIOTE_CONFIG_PORT_Pos (13UL) /*!< Position of PORT field. */ +#define GPIOTE_CONFIG_PORT_Msk (0x3UL << GPIOTE_CONFIG_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 12..8 : GPIO number associated with SET[n], CLR[n] and OUT[n] tasks and IN[n] event */ +#define GPIOTE_CONFIG_PSEL_Pos (8UL) /*!< Position of PSEL field. */ +#define GPIOTE_CONFIG_PSEL_Msk (0x1FUL << GPIOTE_CONFIG_PSEL_Pos) /*!< Bit mask of PSEL field. */ + +/* Bits 1..0 : Mode */ +#define GPIOTE_CONFIG_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define GPIOTE_CONFIG_MODE_Msk (0x3UL << GPIOTE_CONFIG_MODE_Pos) /*!< Bit mask of MODE field. */ +#define GPIOTE_CONFIG_MODE_Disabled (0UL) /*!< Disabled. Pin specified by PSEL will not be acquired by the GPIOTE module. */ +#define GPIOTE_CONFIG_MODE_Event (1UL) /*!< Event mode */ +#define GPIOTE_CONFIG_MODE_Task (3UL) /*!< Task mode */ + + +/* Peripheral: I2S */ +/* Description: Inter-IC Sound */ + +/* Register: I2S_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 5 : Enable or disable interrupt for TXPTRUPD event */ +#define I2S_INTEN_TXPTRUPD_Pos (5UL) /*!< Position of TXPTRUPD field. */ +#define I2S_INTEN_TXPTRUPD_Msk (0x1UL << I2S_INTEN_TXPTRUPD_Pos) /*!< Bit mask of TXPTRUPD field. */ +#define I2S_INTEN_TXPTRUPD_Disabled (0UL) /*!< Disable */ +#define I2S_INTEN_TXPTRUPD_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for STOPPED event */ +#define I2S_INTEN_STOPPED_Pos (2UL) /*!< Position of STOPPED field. */ +#define I2S_INTEN_STOPPED_Msk (0x1UL << I2S_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define I2S_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define I2S_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for RXPTRUPD event */ +#define I2S_INTEN_RXPTRUPD_Pos (1UL) /*!< Position of RXPTRUPD field. */ +#define I2S_INTEN_RXPTRUPD_Msk (0x1UL << I2S_INTEN_RXPTRUPD_Pos) /*!< Bit mask of RXPTRUPD field. */ +#define I2S_INTEN_RXPTRUPD_Disabled (0UL) /*!< Disable */ +#define I2S_INTEN_RXPTRUPD_Enabled (1UL) /*!< Enable */ + +/* Register: I2S_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 5 : Write '1' to Enable interrupt for TXPTRUPD event */ +#define I2S_INTENSET_TXPTRUPD_Pos (5UL) /*!< Position of TXPTRUPD field. */ +#define I2S_INTENSET_TXPTRUPD_Msk (0x1UL << I2S_INTENSET_TXPTRUPD_Pos) /*!< Bit mask of TXPTRUPD field. */ +#define I2S_INTENSET_TXPTRUPD_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENSET_TXPTRUPD_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENSET_TXPTRUPD_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for STOPPED event */ +#define I2S_INTENSET_STOPPED_Pos (2UL) /*!< Position of STOPPED field. */ +#define I2S_INTENSET_STOPPED_Msk (0x1UL << I2S_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define I2S_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for RXPTRUPD event */ +#define I2S_INTENSET_RXPTRUPD_Pos (1UL) /*!< Position of RXPTRUPD field. */ +#define I2S_INTENSET_RXPTRUPD_Msk (0x1UL << I2S_INTENSET_RXPTRUPD_Pos) /*!< Bit mask of RXPTRUPD field. */ +#define I2S_INTENSET_RXPTRUPD_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENSET_RXPTRUPD_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENSET_RXPTRUPD_Set (1UL) /*!< Enable */ + +/* Register: I2S_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 5 : Write '1' to Disable interrupt for TXPTRUPD event */ +#define I2S_INTENCLR_TXPTRUPD_Pos (5UL) /*!< Position of TXPTRUPD field. */ +#define I2S_INTENCLR_TXPTRUPD_Msk (0x1UL << I2S_INTENCLR_TXPTRUPD_Pos) /*!< Bit mask of TXPTRUPD field. */ +#define I2S_INTENCLR_TXPTRUPD_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENCLR_TXPTRUPD_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENCLR_TXPTRUPD_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for STOPPED event */ +#define I2S_INTENCLR_STOPPED_Pos (2UL) /*!< Position of STOPPED field. */ +#define I2S_INTENCLR_STOPPED_Msk (0x1UL << I2S_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define I2S_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for RXPTRUPD event */ +#define I2S_INTENCLR_RXPTRUPD_Pos (1UL) /*!< Position of RXPTRUPD field. */ +#define I2S_INTENCLR_RXPTRUPD_Msk (0x1UL << I2S_INTENCLR_RXPTRUPD_Pos) /*!< Bit mask of RXPTRUPD field. */ +#define I2S_INTENCLR_RXPTRUPD_Disabled (0UL) /*!< Read: Disabled */ +#define I2S_INTENCLR_RXPTRUPD_Enabled (1UL) /*!< Read: Enabled */ +#define I2S_INTENCLR_RXPTRUPD_Clear (1UL) /*!< Disable */ + +/* Register: I2S_ENABLE */ +/* Description: Enable I2S module. */ + +/* Bit 0 : Enable I2S module. */ +#define I2S_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define I2S_ENABLE_ENABLE_Msk (0x1UL << I2S_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define I2S_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define I2S_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: I2S_CONFIG_MODE */ +/* Description: I2S mode. */ + +/* Bit 0 : I2S mode. */ +#define I2S_CONFIG_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define I2S_CONFIG_MODE_MODE_Msk (0x1UL << I2S_CONFIG_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define I2S_CONFIG_MODE_MODE_Master (0UL) /*!< Master mode. SCK and LRCK generated from internal master clcok (MCK) and output on pins defined by PSEL.xxx. */ +#define I2S_CONFIG_MODE_MODE_Slave (1UL) /*!< Slave mode. SCK and LRCK generated by external master and received on pins defined by PSEL.xxx */ + +/* Register: I2S_CONFIG_RXEN */ +/* Description: Reception (RX) enable. */ + +/* Bit 0 : Reception (RX) enable. */ +#define I2S_CONFIG_RXEN_RXEN_Pos (0UL) /*!< Position of RXEN field. */ +#define I2S_CONFIG_RXEN_RXEN_Msk (0x1UL << I2S_CONFIG_RXEN_RXEN_Pos) /*!< Bit mask of RXEN field. */ +#define I2S_CONFIG_RXEN_RXEN_Disabled (0UL) /*!< Reception disabled and now data will be written to the RXD.PTR address. */ +#define I2S_CONFIG_RXEN_RXEN_Enabled (1UL) /*!< Reception enabled. */ + +/* Register: I2S_CONFIG_TXEN */ +/* Description: Transmission (TX) enable. */ + +/* Bit 0 : Transmission (TX) enable. */ +#define I2S_CONFIG_TXEN_TXEN_Pos (0UL) /*!< Position of TXEN field. */ +#define I2S_CONFIG_TXEN_TXEN_Msk (0x1UL << I2S_CONFIG_TXEN_TXEN_Pos) /*!< Bit mask of TXEN field. */ +#define I2S_CONFIG_TXEN_TXEN_Disabled (0UL) /*!< Transmission disabled and now data will be read from the RXD.TXD address. */ +#define I2S_CONFIG_TXEN_TXEN_Enabled (1UL) /*!< Transmission enabled. */ + +/* Register: I2S_CONFIG_MCKEN */ +/* Description: Master clock generator enable. */ + +/* Bit 0 : Master clock generator enable. */ +#define I2S_CONFIG_MCKEN_MCKEN_Pos (0UL) /*!< Position of MCKEN field. */ +#define I2S_CONFIG_MCKEN_MCKEN_Msk (0x1UL << I2S_CONFIG_MCKEN_MCKEN_Pos) /*!< Bit mask of MCKEN field. */ +#define I2S_CONFIG_MCKEN_MCKEN_Disabled (0UL) /*!< Master clock generator disabled and PSEL.MCK not connected(available as GPIO). */ +#define I2S_CONFIG_MCKEN_MCKEN_Enabled (1UL) /*!< Master clock generator running and MCK output on PSEL.MCK. */ + +/* Register: I2S_CONFIG_MCKFREQ */ +/* Description: Master clock generator frequency. */ + +/* Bits 31..0 : Master clock generator frequency. */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_Pos (0UL) /*!< Position of MCKFREQ field. */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_Msk (0xFFFFFFFFUL << I2S_CONFIG_MCKFREQ_MCKFREQ_Pos) /*!< Bit mask of MCKFREQ field. */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV125 (0x020C0000UL) /*!< 32 MHz / 125 = 0.256 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV63 (0x04100000UL) /*!< 32 MHz / 63 = 0.5079365 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV42 (0x06000000UL) /*!< 32 MHz / 42 = 0.7619048 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV32 (0x08000000UL) /*!< 32 MHz / 32 = 1.0 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV31 (0x08400000UL) /*!< 32 MHz / 31 = 1.0322581 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV30 (0x08800000UL) /*!< 32 MHz / 30 = 1.0666667 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV23 (0x0B000000UL) /*!< 32 MHz / 23 = 1.3913043 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV21 (0x0C000000UL) /*!< 32 MHz / 21 = 1.5238095 */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV16 (0x10000000UL) /*!< 32 MHz / 16 = 2.0 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV15 (0x11000000UL) /*!< 32 MHz / 15 = 2.1333333 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV11 (0x16000000UL) /*!< 32 MHz / 11 = 2.9090909 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV10 (0x18000000UL) /*!< 32 MHz / 10 = 3.2 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV8 (0x20000000UL) /*!< 32 MHz / 8 = 4.0 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV6 (0x28000000UL) /*!< 32 MHz / 6 = 5.3333333 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV5 (0x30000000UL) /*!< 32 MHz / 5 = 6.4 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV4 (0x40000000UL) /*!< 32 MHz / 4 = 8.0 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV3 (0x50000000UL) /*!< 32 MHz / 3 = 10.6666667 MHz */ +#define I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2 (0x80000000UL) /*!< 32 MHz / 2 = 16.0 MHz */ + +/* Register: I2S_CONFIG_RATIO */ +/* Description: MCK / LRCK ratio. */ + +/* Bits 3..0 : MCK / LRCK ratio. */ +#define I2S_CONFIG_RATIO_RATIO_Pos (0UL) /*!< Position of RATIO field. */ +#define I2S_CONFIG_RATIO_RATIO_Msk (0xFUL << I2S_CONFIG_RATIO_RATIO_Pos) /*!< Bit mask of RATIO field. */ +#define I2S_CONFIG_RATIO_RATIO_32X (0UL) /*!< LRCK = MCK / 32 */ +#define I2S_CONFIG_RATIO_RATIO_48X (1UL) /*!< LRCK = MCK / 48 */ +#define I2S_CONFIG_RATIO_RATIO_64X (2UL) /*!< LRCK = MCK / 64 */ +#define I2S_CONFIG_RATIO_RATIO_96X (3UL) /*!< LRCK = MCK / 96 */ +#define I2S_CONFIG_RATIO_RATIO_128X (4UL) /*!< LRCK = MCK / 128 */ +#define I2S_CONFIG_RATIO_RATIO_192X (5UL) /*!< LRCK = MCK / 192 */ +#define I2S_CONFIG_RATIO_RATIO_256X (6UL) /*!< LRCK = MCK / 256 */ +#define I2S_CONFIG_RATIO_RATIO_384X (7UL) /*!< LRCK = MCK / 384 */ +#define I2S_CONFIG_RATIO_RATIO_512X (8UL) /*!< LRCK = MCK / 512 */ + +/* Register: I2S_CONFIG_SWIDTH */ +/* Description: Sample width. */ + +/* Bits 1..0 : Sample width. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_Pos (0UL) /*!< Position of SWIDTH field. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_Msk (0x3UL << I2S_CONFIG_SWIDTH_SWIDTH_Pos) /*!< Bit mask of SWIDTH field. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_8Bit (0UL) /*!< 8 bit. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_16Bit (1UL) /*!< 16 bit. */ +#define I2S_CONFIG_SWIDTH_SWIDTH_24Bit (2UL) /*!< 24 bit. */ + +/* Register: I2S_CONFIG_ALIGN */ +/* Description: Alignment of sample within a frame. */ + +/* Bit 0 : Alignment of sample within a frame. */ +#define I2S_CONFIG_ALIGN_ALIGN_Pos (0UL) /*!< Position of ALIGN field. */ +#define I2S_CONFIG_ALIGN_ALIGN_Msk (0x1UL << I2S_CONFIG_ALIGN_ALIGN_Pos) /*!< Bit mask of ALIGN field. */ +#define I2S_CONFIG_ALIGN_ALIGN_Left (0UL) /*!< Left-aligned. */ +#define I2S_CONFIG_ALIGN_ALIGN_Right (1UL) /*!< Right-aligned. */ + +/* Register: I2S_CONFIG_FORMAT */ +/* Description: Frame format. */ + +/* Bit 0 : Frame format. */ +#define I2S_CONFIG_FORMAT_FORMAT_Pos (0UL) /*!< Position of FORMAT field. */ +#define I2S_CONFIG_FORMAT_FORMAT_Msk (0x1UL << I2S_CONFIG_FORMAT_FORMAT_Pos) /*!< Bit mask of FORMAT field. */ +#define I2S_CONFIG_FORMAT_FORMAT_I2S (0UL) /*!< Original I2S format. */ +#define I2S_CONFIG_FORMAT_FORMAT_Aligned (1UL) /*!< Alternate (left- or right-aligned) format. */ + +/* Register: I2S_CONFIG_CHANNELS */ +/* Description: Enable channels. */ + +/* Bits 1..0 : Enable channels. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Pos (0UL) /*!< Position of CHANNELS field. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Msk (0x3UL << I2S_CONFIG_CHANNELS_CHANNELS_Pos) /*!< Bit mask of CHANNELS field. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Stereo (0UL) /*!< Stereo. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Left (1UL) /*!< Left only. */ +#define I2S_CONFIG_CHANNELS_CHANNELS_Right (2UL) /*!< Right only. */ + +/* Register: I2S_RXD_PTR */ +/* Description: Receive buffer RAM start address. */ + +/* Bits 31..0 : Receive buffer Data RAM start address. When receiving, words containing samples will be written to this address. This address is a word aligned Data RAM address. */ +#define I2S_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define I2S_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << I2S_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: I2S_TXD_PTR */ +/* Description: Transmit buffer RAM start address. */ + +/* Bits 31..0 : Transmit buffer Data RAM start address. When transmitting, words containing samples will be fetched from this address. This address is a word aligned Data RAM address. */ +#define I2S_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define I2S_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << I2S_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: I2S_RXTXD_MAXCNT */ +/* Description: Size of RXD and TXD buffers. */ + +/* Bits 13..0 : Size of RXD and TXD buffers in number of 32 bit words. */ +#define I2S_RXTXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define I2S_RXTXD_MAXCNT_MAXCNT_Msk (0x3FFFUL << I2S_RXTXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: I2S_PSEL_MCK */ +/* Description: Pin select for MCK signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_MCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_MCK_CONNECT_Msk (0x1UL << I2S_PSEL_MCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_MCK_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_MCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 9..8 : Port number */ +#define I2S_PSEL_MCK_PORT_Pos (8UL) /*!< Position of PORT field. */ +#define I2S_PSEL_MCK_PORT_Msk (0x3UL << I2S_PSEL_MCK_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_MCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_MCK_PIN_Msk (0x1FUL << I2S_PSEL_MCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: I2S_PSEL_SCK */ +/* Description: Pin select for SCK signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_SCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_SCK_CONNECT_Msk (0x1UL << I2S_PSEL_SCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_SCK_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_SCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 9..8 : Port number */ +#define I2S_PSEL_SCK_PORT_Pos (8UL) /*!< Position of PORT field. */ +#define I2S_PSEL_SCK_PORT_Msk (0x3UL << I2S_PSEL_SCK_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_SCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_SCK_PIN_Msk (0x1FUL << I2S_PSEL_SCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: I2S_PSEL_LRCK */ +/* Description: Pin select for LRCK signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_LRCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_LRCK_CONNECT_Msk (0x1UL << I2S_PSEL_LRCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_LRCK_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_LRCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 9..8 : Port number */ +#define I2S_PSEL_LRCK_PORT_Pos (8UL) /*!< Position of PORT field. */ +#define I2S_PSEL_LRCK_PORT_Msk (0x3UL << I2S_PSEL_LRCK_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_LRCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_LRCK_PIN_Msk (0x1FUL << I2S_PSEL_LRCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: I2S_PSEL_SDIN */ +/* Description: Pin select for SDIN signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_SDIN_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_SDIN_CONNECT_Msk (0x1UL << I2S_PSEL_SDIN_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_SDIN_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_SDIN_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 9..8 : Port number */ +#define I2S_PSEL_SDIN_PORT_Pos (8UL) /*!< Position of PORT field. */ +#define I2S_PSEL_SDIN_PORT_Msk (0x3UL << I2S_PSEL_SDIN_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_SDIN_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_SDIN_PIN_Msk (0x1FUL << I2S_PSEL_SDIN_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: I2S_PSEL_SDOUT */ +/* Description: Pin select for SDOUT signal. */ + +/* Bit 31 : Connection */ +#define I2S_PSEL_SDOUT_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define I2S_PSEL_SDOUT_CONNECT_Msk (0x1UL << I2S_PSEL_SDOUT_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define I2S_PSEL_SDOUT_CONNECT_Connected (0UL) /*!< Connect */ +#define I2S_PSEL_SDOUT_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 9..8 : Port number */ +#define I2S_PSEL_SDOUT_PORT_Pos (8UL) /*!< Position of PORT field. */ +#define I2S_PSEL_SDOUT_PORT_Msk (0x3UL << I2S_PSEL_SDOUT_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define I2S_PSEL_SDOUT_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define I2S_PSEL_SDOUT_PIN_Msk (0x1FUL << I2S_PSEL_SDOUT_PIN_Pos) /*!< Bit mask of PIN field. */ + + +/* Peripheral: LPCOMP */ +/* Description: Low Power Comparator */ + +/* Register: LPCOMP_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between CROSS event and STOP task */ +#define LPCOMP_SHORTS_CROSS_STOP_Pos (4UL) /*!< Position of CROSS_STOP field. */ +#define LPCOMP_SHORTS_CROSS_STOP_Msk (0x1UL << LPCOMP_SHORTS_CROSS_STOP_Pos) /*!< Bit mask of CROSS_STOP field. */ +#define LPCOMP_SHORTS_CROSS_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_CROSS_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between UP event and STOP task */ +#define LPCOMP_SHORTS_UP_STOP_Pos (3UL) /*!< Position of UP_STOP field. */ +#define LPCOMP_SHORTS_UP_STOP_Msk (0x1UL << LPCOMP_SHORTS_UP_STOP_Pos) /*!< Bit mask of UP_STOP field. */ +#define LPCOMP_SHORTS_UP_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_UP_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between DOWN event and STOP task */ +#define LPCOMP_SHORTS_DOWN_STOP_Pos (2UL) /*!< Position of DOWN_STOP field. */ +#define LPCOMP_SHORTS_DOWN_STOP_Msk (0x1UL << LPCOMP_SHORTS_DOWN_STOP_Pos) /*!< Bit mask of DOWN_STOP field. */ +#define LPCOMP_SHORTS_DOWN_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_DOWN_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between READY event and STOP task */ +#define LPCOMP_SHORTS_READY_STOP_Pos (1UL) /*!< Position of READY_STOP field. */ +#define LPCOMP_SHORTS_READY_STOP_Msk (0x1UL << LPCOMP_SHORTS_READY_STOP_Pos) /*!< Bit mask of READY_STOP field. */ +#define LPCOMP_SHORTS_READY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_READY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between READY event and SAMPLE task */ +#define LPCOMP_SHORTS_READY_SAMPLE_Pos (0UL) /*!< Position of READY_SAMPLE field. */ +#define LPCOMP_SHORTS_READY_SAMPLE_Msk (0x1UL << LPCOMP_SHORTS_READY_SAMPLE_Pos) /*!< Bit mask of READY_SAMPLE field. */ +#define LPCOMP_SHORTS_READY_SAMPLE_Disabled (0UL) /*!< Disable shortcut */ +#define LPCOMP_SHORTS_READY_SAMPLE_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: LPCOMP_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 3 : Write '1' to Enable interrupt for CROSS event */ +#define LPCOMP_INTENSET_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define LPCOMP_INTENSET_CROSS_Msk (0x1UL << LPCOMP_INTENSET_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define LPCOMP_INTENSET_CROSS_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENSET_CROSS_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENSET_CROSS_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for UP event */ +#define LPCOMP_INTENSET_UP_Pos (2UL) /*!< Position of UP field. */ +#define LPCOMP_INTENSET_UP_Msk (0x1UL << LPCOMP_INTENSET_UP_Pos) /*!< Bit mask of UP field. */ +#define LPCOMP_INTENSET_UP_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENSET_UP_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENSET_UP_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for DOWN event */ +#define LPCOMP_INTENSET_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define LPCOMP_INTENSET_DOWN_Msk (0x1UL << LPCOMP_INTENSET_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define LPCOMP_INTENSET_DOWN_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENSET_DOWN_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENSET_DOWN_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define LPCOMP_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define LPCOMP_INTENSET_READY_Msk (0x1UL << LPCOMP_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define LPCOMP_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: LPCOMP_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 3 : Write '1' to Disable interrupt for CROSS event */ +#define LPCOMP_INTENCLR_CROSS_Pos (3UL) /*!< Position of CROSS field. */ +#define LPCOMP_INTENCLR_CROSS_Msk (0x1UL << LPCOMP_INTENCLR_CROSS_Pos) /*!< Bit mask of CROSS field. */ +#define LPCOMP_INTENCLR_CROSS_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENCLR_CROSS_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENCLR_CROSS_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for UP event */ +#define LPCOMP_INTENCLR_UP_Pos (2UL) /*!< Position of UP field. */ +#define LPCOMP_INTENCLR_UP_Msk (0x1UL << LPCOMP_INTENCLR_UP_Pos) /*!< Bit mask of UP field. */ +#define LPCOMP_INTENCLR_UP_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENCLR_UP_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENCLR_UP_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for DOWN event */ +#define LPCOMP_INTENCLR_DOWN_Pos (1UL) /*!< Position of DOWN field. */ +#define LPCOMP_INTENCLR_DOWN_Msk (0x1UL << LPCOMP_INTENCLR_DOWN_Pos) /*!< Bit mask of DOWN field. */ +#define LPCOMP_INTENCLR_DOWN_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENCLR_DOWN_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENCLR_DOWN_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define LPCOMP_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define LPCOMP_INTENCLR_READY_Msk (0x1UL << LPCOMP_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define LPCOMP_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define LPCOMP_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define LPCOMP_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: LPCOMP_RESULT */ +/* Description: Compare result */ + +/* Bit 0 : Result of last compare. Decision point SAMPLE task. */ +#define LPCOMP_RESULT_RESULT_Pos (0UL) /*!< Position of RESULT field. */ +#define LPCOMP_RESULT_RESULT_Msk (0x1UL << LPCOMP_RESULT_RESULT_Pos) /*!< Bit mask of RESULT field. */ +#define LPCOMP_RESULT_RESULT_Below (0UL) /*!< Input voltage is below the reference threshold (VIN+ < VIN-). */ +#define LPCOMP_RESULT_RESULT_Above (1UL) /*!< Input voltage is above the reference threshold (VIN+ > VIN-). */ + +/* Register: LPCOMP_ENABLE */ +/* Description: Enable LPCOMP */ + +/* Bits 1..0 : Enable or disable LPCOMP */ +#define LPCOMP_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define LPCOMP_ENABLE_ENABLE_Msk (0x3UL << LPCOMP_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define LPCOMP_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define LPCOMP_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: LPCOMP_PSEL */ +/* Description: Input pin select */ + +/* Bits 2..0 : Analog pin select */ +#define LPCOMP_PSEL_PSEL_Pos (0UL) /*!< Position of PSEL field. */ +#define LPCOMP_PSEL_PSEL_Msk (0x7UL << LPCOMP_PSEL_PSEL_Pos) /*!< Bit mask of PSEL field. */ +#define LPCOMP_PSEL_PSEL_AnalogInput0 (0UL) /*!< AIN0 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput1 (1UL) /*!< AIN1 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput2 (2UL) /*!< AIN2 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput3 (3UL) /*!< AIN3 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput4 (4UL) /*!< AIN4 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput5 (5UL) /*!< AIN5 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput6 (6UL) /*!< AIN6 selected as analog input */ +#define LPCOMP_PSEL_PSEL_AnalogInput7 (7UL) /*!< AIN7 selected as analog input */ + +/* Register: LPCOMP_REFSEL */ +/* Description: Reference select */ + +/* Bits 3..0 : Reference select */ +#define LPCOMP_REFSEL_REFSEL_Pos (0UL) /*!< Position of REFSEL field. */ +#define LPCOMP_REFSEL_REFSEL_Msk (0xFUL << LPCOMP_REFSEL_REFSEL_Pos) /*!< Bit mask of REFSEL field. */ +#define LPCOMP_REFSEL_REFSEL_Ref1_8Vdd (0UL) /*!< VDD * 1/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref2_8Vdd (1UL) /*!< VDD * 2/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref3_8Vdd (2UL) /*!< VDD * 3/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref4_8Vdd (3UL) /*!< VDD * 4/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref5_8Vdd (4UL) /*!< VDD * 5/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref6_8Vdd (5UL) /*!< VDD * 6/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref7_8Vdd (6UL) /*!< VDD * 7/8 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_ARef (7UL) /*!< External analog reference selected */ +#define LPCOMP_REFSEL_REFSEL_Ref1_16Vdd (8UL) /*!< VDD * 1/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref3_16Vdd (9UL) /*!< VDD * 3/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref5_16Vdd (10UL) /*!< VDD * 5/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref7_16Vdd (11UL) /*!< VDD * 7/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref9_16Vdd (12UL) /*!< VDD * 9/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref11_16Vdd (13UL) /*!< VDD * 11/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref13_16Vdd (14UL) /*!< VDD * 13/16 selected as reference */ +#define LPCOMP_REFSEL_REFSEL_Ref15_16Vdd (15UL) /*!< VDD * 15/16 selected as reference */ + +/* Register: LPCOMP_EXTREFSEL */ +/* Description: External reference select */ + +/* Bit 0 : External analog reference select */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_Pos (0UL) /*!< Position of EXTREFSEL field. */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_Msk (0x1UL << LPCOMP_EXTREFSEL_EXTREFSEL_Pos) /*!< Bit mask of EXTREFSEL field. */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference0 (0UL) /*!< Use AIN0 as external analog reference */ +#define LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference1 (1UL) /*!< Use AIN1 as external analog reference */ + +/* Register: LPCOMP_ANADETECT */ +/* Description: Analog detect configuration */ + +/* Bits 1..0 : Analog detect configuration */ +#define LPCOMP_ANADETECT_ANADETECT_Pos (0UL) /*!< Position of ANADETECT field. */ +#define LPCOMP_ANADETECT_ANADETECT_Msk (0x3UL << LPCOMP_ANADETECT_ANADETECT_Pos) /*!< Bit mask of ANADETECT field. */ +#define LPCOMP_ANADETECT_ANADETECT_Cross (0UL) /*!< Generate ANADETECT on crossing, both upward crossing and downward crossing */ +#define LPCOMP_ANADETECT_ANADETECT_Up (1UL) /*!< Generate ANADETECT on upward crossing only */ +#define LPCOMP_ANADETECT_ANADETECT_Down (2UL) /*!< Generate ANADETECT on downward crossing only */ + +/* Register: LPCOMP_HYST */ +/* Description: Comparator hysteresis enable */ + +/* Bit 0 : Comparator hysteresis enable */ +#define LPCOMP_HYST_HYST_Pos (0UL) /*!< Position of HYST field. */ +#define LPCOMP_HYST_HYST_Msk (0x1UL << LPCOMP_HYST_HYST_Pos) /*!< Bit mask of HYST field. */ +#define LPCOMP_HYST_HYST_NoHyst (0UL) /*!< Comparator hysteresis disabled */ +#define LPCOMP_HYST_HYST_Hyst50mV (1UL) /*!< Comparator hysteresis disabled (typ. 50 mV) */ + + +/* Peripheral: MWU */ +/* Description: Memory Watch Unit */ + +/* Register: MWU_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 27 : Enable or disable interrupt for PREGION[1].RA event */ +#define MWU_INTEN_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_INTEN_PREGION1RA_Msk (0x1UL << MWU_INTEN_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_INTEN_PREGION1RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_PREGION1RA_Enabled (1UL) /*!< Enable */ + +/* Bit 26 : Enable or disable interrupt for PREGION[1].WA event */ +#define MWU_INTEN_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_INTEN_PREGION1WA_Msk (0x1UL << MWU_INTEN_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_INTEN_PREGION1WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_PREGION1WA_Enabled (1UL) /*!< Enable */ + +/* Bit 25 : Enable or disable interrupt for PREGION[0].RA event */ +#define MWU_INTEN_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_INTEN_PREGION0RA_Msk (0x1UL << MWU_INTEN_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_INTEN_PREGION0RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_PREGION0RA_Enabled (1UL) /*!< Enable */ + +/* Bit 24 : Enable or disable interrupt for PREGION[0].WA event */ +#define MWU_INTEN_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_INTEN_PREGION0WA_Msk (0x1UL << MWU_INTEN_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_INTEN_PREGION0WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_PREGION0WA_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for REGION[3].RA event */ +#define MWU_INTEN_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_INTEN_REGION3RA_Msk (0x1UL << MWU_INTEN_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_INTEN_REGION3RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION3RA_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for REGION[3].WA event */ +#define MWU_INTEN_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_INTEN_REGION3WA_Msk (0x1UL << MWU_INTEN_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_INTEN_REGION3WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION3WA_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for REGION[2].RA event */ +#define MWU_INTEN_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_INTEN_REGION2RA_Msk (0x1UL << MWU_INTEN_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_INTEN_REGION2RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION2RA_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for REGION[2].WA event */ +#define MWU_INTEN_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_INTEN_REGION2WA_Msk (0x1UL << MWU_INTEN_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_INTEN_REGION2WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION2WA_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for REGION[1].RA event */ +#define MWU_INTEN_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_INTEN_REGION1RA_Msk (0x1UL << MWU_INTEN_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_INTEN_REGION1RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION1RA_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for REGION[1].WA event */ +#define MWU_INTEN_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_INTEN_REGION1WA_Msk (0x1UL << MWU_INTEN_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_INTEN_REGION1WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION1WA_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for REGION[0].RA event */ +#define MWU_INTEN_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_INTEN_REGION0RA_Msk (0x1UL << MWU_INTEN_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_INTEN_REGION0RA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION0RA_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for REGION[0].WA event */ +#define MWU_INTEN_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_INTEN_REGION0WA_Msk (0x1UL << MWU_INTEN_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_INTEN_REGION0WA_Disabled (0UL) /*!< Disable */ +#define MWU_INTEN_REGION0WA_Enabled (1UL) /*!< Enable */ + +/* Register: MWU_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 27 : Write '1' to Enable interrupt for PREGION[1].RA event */ +#define MWU_INTENSET_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_INTENSET_PREGION1RA_Msk (0x1UL << MWU_INTENSET_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_INTENSET_PREGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_PREGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_PREGION1RA_Set (1UL) /*!< Enable */ + +/* Bit 26 : Write '1' to Enable interrupt for PREGION[1].WA event */ +#define MWU_INTENSET_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_INTENSET_PREGION1WA_Msk (0x1UL << MWU_INTENSET_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_INTENSET_PREGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_PREGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_PREGION1WA_Set (1UL) /*!< Enable */ + +/* Bit 25 : Write '1' to Enable interrupt for PREGION[0].RA event */ +#define MWU_INTENSET_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_INTENSET_PREGION0RA_Msk (0x1UL << MWU_INTENSET_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_INTENSET_PREGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_PREGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_PREGION0RA_Set (1UL) /*!< Enable */ + +/* Bit 24 : Write '1' to Enable interrupt for PREGION[0].WA event */ +#define MWU_INTENSET_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_INTENSET_PREGION0WA_Msk (0x1UL << MWU_INTENSET_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_INTENSET_PREGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_PREGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_PREGION0WA_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for REGION[3].RA event */ +#define MWU_INTENSET_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_INTENSET_REGION3RA_Msk (0x1UL << MWU_INTENSET_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_INTENSET_REGION3RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION3RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION3RA_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for REGION[3].WA event */ +#define MWU_INTENSET_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_INTENSET_REGION3WA_Msk (0x1UL << MWU_INTENSET_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_INTENSET_REGION3WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION3WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION3WA_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for REGION[2].RA event */ +#define MWU_INTENSET_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_INTENSET_REGION2RA_Msk (0x1UL << MWU_INTENSET_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_INTENSET_REGION2RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION2RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION2RA_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for REGION[2].WA event */ +#define MWU_INTENSET_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_INTENSET_REGION2WA_Msk (0x1UL << MWU_INTENSET_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_INTENSET_REGION2WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION2WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION2WA_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for REGION[1].RA event */ +#define MWU_INTENSET_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_INTENSET_REGION1RA_Msk (0x1UL << MWU_INTENSET_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_INTENSET_REGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION1RA_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for REGION[1].WA event */ +#define MWU_INTENSET_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_INTENSET_REGION1WA_Msk (0x1UL << MWU_INTENSET_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_INTENSET_REGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION1WA_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for REGION[0].RA event */ +#define MWU_INTENSET_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_INTENSET_REGION0RA_Msk (0x1UL << MWU_INTENSET_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_INTENSET_REGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION0RA_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for REGION[0].WA event */ +#define MWU_INTENSET_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_INTENSET_REGION0WA_Msk (0x1UL << MWU_INTENSET_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_INTENSET_REGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENSET_REGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENSET_REGION0WA_Set (1UL) /*!< Enable */ + +/* Register: MWU_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 27 : Write '1' to Disable interrupt for PREGION[1].RA event */ +#define MWU_INTENCLR_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_INTENCLR_PREGION1RA_Msk (0x1UL << MWU_INTENCLR_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_INTENCLR_PREGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_PREGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_PREGION1RA_Clear (1UL) /*!< Disable */ + +/* Bit 26 : Write '1' to Disable interrupt for PREGION[1].WA event */ +#define MWU_INTENCLR_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_INTENCLR_PREGION1WA_Msk (0x1UL << MWU_INTENCLR_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_INTENCLR_PREGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_PREGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_PREGION1WA_Clear (1UL) /*!< Disable */ + +/* Bit 25 : Write '1' to Disable interrupt for PREGION[0].RA event */ +#define MWU_INTENCLR_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_INTENCLR_PREGION0RA_Msk (0x1UL << MWU_INTENCLR_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_INTENCLR_PREGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_PREGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_PREGION0RA_Clear (1UL) /*!< Disable */ + +/* Bit 24 : Write '1' to Disable interrupt for PREGION[0].WA event */ +#define MWU_INTENCLR_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_INTENCLR_PREGION0WA_Msk (0x1UL << MWU_INTENCLR_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_INTENCLR_PREGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_PREGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_PREGION0WA_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for REGION[3].RA event */ +#define MWU_INTENCLR_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_INTENCLR_REGION3RA_Msk (0x1UL << MWU_INTENCLR_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_INTENCLR_REGION3RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION3RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION3RA_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for REGION[3].WA event */ +#define MWU_INTENCLR_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_INTENCLR_REGION3WA_Msk (0x1UL << MWU_INTENCLR_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_INTENCLR_REGION3WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION3WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION3WA_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for REGION[2].RA event */ +#define MWU_INTENCLR_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_INTENCLR_REGION2RA_Msk (0x1UL << MWU_INTENCLR_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_INTENCLR_REGION2RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION2RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION2RA_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for REGION[2].WA event */ +#define MWU_INTENCLR_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_INTENCLR_REGION2WA_Msk (0x1UL << MWU_INTENCLR_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_INTENCLR_REGION2WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION2WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION2WA_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for REGION[1].RA event */ +#define MWU_INTENCLR_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_INTENCLR_REGION1RA_Msk (0x1UL << MWU_INTENCLR_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_INTENCLR_REGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION1RA_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for REGION[1].WA event */ +#define MWU_INTENCLR_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_INTENCLR_REGION1WA_Msk (0x1UL << MWU_INTENCLR_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_INTENCLR_REGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION1WA_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for REGION[0].RA event */ +#define MWU_INTENCLR_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_INTENCLR_REGION0RA_Msk (0x1UL << MWU_INTENCLR_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_INTENCLR_REGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION0RA_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for REGION[0].WA event */ +#define MWU_INTENCLR_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_INTENCLR_REGION0WA_Msk (0x1UL << MWU_INTENCLR_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_INTENCLR_REGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_INTENCLR_REGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_INTENCLR_REGION0WA_Clear (1UL) /*!< Disable */ + +/* Register: MWU_NMIEN */ +/* Description: Enable or disable non-maskable interrupt */ + +/* Bit 27 : Enable or disable non-maskable interrupt for PREGION[1].RA event */ +#define MWU_NMIEN_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_NMIEN_PREGION1RA_Msk (0x1UL << MWU_NMIEN_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_NMIEN_PREGION1RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_PREGION1RA_Enabled (1UL) /*!< Enable */ + +/* Bit 26 : Enable or disable non-maskable interrupt for PREGION[1].WA event */ +#define MWU_NMIEN_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_NMIEN_PREGION1WA_Msk (0x1UL << MWU_NMIEN_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_NMIEN_PREGION1WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_PREGION1WA_Enabled (1UL) /*!< Enable */ + +/* Bit 25 : Enable or disable non-maskable interrupt for PREGION[0].RA event */ +#define MWU_NMIEN_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_NMIEN_PREGION0RA_Msk (0x1UL << MWU_NMIEN_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_NMIEN_PREGION0RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_PREGION0RA_Enabled (1UL) /*!< Enable */ + +/* Bit 24 : Enable or disable non-maskable interrupt for PREGION[0].WA event */ +#define MWU_NMIEN_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_NMIEN_PREGION0WA_Msk (0x1UL << MWU_NMIEN_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_NMIEN_PREGION0WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_PREGION0WA_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable non-maskable interrupt for REGION[3].RA event */ +#define MWU_NMIEN_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_NMIEN_REGION3RA_Msk (0x1UL << MWU_NMIEN_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_NMIEN_REGION3RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION3RA_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable non-maskable interrupt for REGION[3].WA event */ +#define MWU_NMIEN_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_NMIEN_REGION3WA_Msk (0x1UL << MWU_NMIEN_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_NMIEN_REGION3WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION3WA_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable non-maskable interrupt for REGION[2].RA event */ +#define MWU_NMIEN_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_NMIEN_REGION2RA_Msk (0x1UL << MWU_NMIEN_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_NMIEN_REGION2RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION2RA_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable non-maskable interrupt for REGION[2].WA event */ +#define MWU_NMIEN_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_NMIEN_REGION2WA_Msk (0x1UL << MWU_NMIEN_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_NMIEN_REGION2WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION2WA_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable non-maskable interrupt for REGION[1].RA event */ +#define MWU_NMIEN_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_NMIEN_REGION1RA_Msk (0x1UL << MWU_NMIEN_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_NMIEN_REGION1RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION1RA_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable non-maskable interrupt for REGION[1].WA event */ +#define MWU_NMIEN_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_NMIEN_REGION1WA_Msk (0x1UL << MWU_NMIEN_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_NMIEN_REGION1WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION1WA_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable non-maskable interrupt for REGION[0].RA event */ +#define MWU_NMIEN_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_NMIEN_REGION0RA_Msk (0x1UL << MWU_NMIEN_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_NMIEN_REGION0RA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION0RA_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable non-maskable interrupt for REGION[0].WA event */ +#define MWU_NMIEN_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_NMIEN_REGION0WA_Msk (0x1UL << MWU_NMIEN_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_NMIEN_REGION0WA_Disabled (0UL) /*!< Disable */ +#define MWU_NMIEN_REGION0WA_Enabled (1UL) /*!< Enable */ + +/* Register: MWU_NMIENSET */ +/* Description: Enable non-maskable interrupt */ + +/* Bit 27 : Write '1' to Enable non-maskable interrupt for PREGION[1].RA event */ +#define MWU_NMIENSET_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_NMIENSET_PREGION1RA_Msk (0x1UL << MWU_NMIENSET_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_NMIENSET_PREGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_PREGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_PREGION1RA_Set (1UL) /*!< Enable */ + +/* Bit 26 : Write '1' to Enable non-maskable interrupt for PREGION[1].WA event */ +#define MWU_NMIENSET_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_NMIENSET_PREGION1WA_Msk (0x1UL << MWU_NMIENSET_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_NMIENSET_PREGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_PREGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_PREGION1WA_Set (1UL) /*!< Enable */ + +/* Bit 25 : Write '1' to Enable non-maskable interrupt for PREGION[0].RA event */ +#define MWU_NMIENSET_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_NMIENSET_PREGION0RA_Msk (0x1UL << MWU_NMIENSET_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_NMIENSET_PREGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_PREGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_PREGION0RA_Set (1UL) /*!< Enable */ + +/* Bit 24 : Write '1' to Enable non-maskable interrupt for PREGION[0].WA event */ +#define MWU_NMIENSET_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_NMIENSET_PREGION0WA_Msk (0x1UL << MWU_NMIENSET_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_NMIENSET_PREGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_PREGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_PREGION0WA_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable non-maskable interrupt for REGION[3].RA event */ +#define MWU_NMIENSET_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_NMIENSET_REGION3RA_Msk (0x1UL << MWU_NMIENSET_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_NMIENSET_REGION3RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION3RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION3RA_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable non-maskable interrupt for REGION[3].WA event */ +#define MWU_NMIENSET_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_NMIENSET_REGION3WA_Msk (0x1UL << MWU_NMIENSET_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_NMIENSET_REGION3WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION3WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION3WA_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable non-maskable interrupt for REGION[2].RA event */ +#define MWU_NMIENSET_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_NMIENSET_REGION2RA_Msk (0x1UL << MWU_NMIENSET_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_NMIENSET_REGION2RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION2RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION2RA_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable non-maskable interrupt for REGION[2].WA event */ +#define MWU_NMIENSET_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_NMIENSET_REGION2WA_Msk (0x1UL << MWU_NMIENSET_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_NMIENSET_REGION2WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION2WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION2WA_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable non-maskable interrupt for REGION[1].RA event */ +#define MWU_NMIENSET_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_NMIENSET_REGION1RA_Msk (0x1UL << MWU_NMIENSET_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_NMIENSET_REGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION1RA_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable non-maskable interrupt for REGION[1].WA event */ +#define MWU_NMIENSET_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_NMIENSET_REGION1WA_Msk (0x1UL << MWU_NMIENSET_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_NMIENSET_REGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION1WA_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable non-maskable interrupt for REGION[0].RA event */ +#define MWU_NMIENSET_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_NMIENSET_REGION0RA_Msk (0x1UL << MWU_NMIENSET_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_NMIENSET_REGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION0RA_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable non-maskable interrupt for REGION[0].WA event */ +#define MWU_NMIENSET_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_NMIENSET_REGION0WA_Msk (0x1UL << MWU_NMIENSET_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_NMIENSET_REGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENSET_REGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENSET_REGION0WA_Set (1UL) /*!< Enable */ + +/* Register: MWU_NMIENCLR */ +/* Description: Disable non-maskable interrupt */ + +/* Bit 27 : Write '1' to Disable non-maskable interrupt for PREGION[1].RA event */ +#define MWU_NMIENCLR_PREGION1RA_Pos (27UL) /*!< Position of PREGION1RA field. */ +#define MWU_NMIENCLR_PREGION1RA_Msk (0x1UL << MWU_NMIENCLR_PREGION1RA_Pos) /*!< Bit mask of PREGION1RA field. */ +#define MWU_NMIENCLR_PREGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_PREGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_PREGION1RA_Clear (1UL) /*!< Disable */ + +/* Bit 26 : Write '1' to Disable non-maskable interrupt for PREGION[1].WA event */ +#define MWU_NMIENCLR_PREGION1WA_Pos (26UL) /*!< Position of PREGION1WA field. */ +#define MWU_NMIENCLR_PREGION1WA_Msk (0x1UL << MWU_NMIENCLR_PREGION1WA_Pos) /*!< Bit mask of PREGION1WA field. */ +#define MWU_NMIENCLR_PREGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_PREGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_PREGION1WA_Clear (1UL) /*!< Disable */ + +/* Bit 25 : Write '1' to Disable non-maskable interrupt for PREGION[0].RA event */ +#define MWU_NMIENCLR_PREGION0RA_Pos (25UL) /*!< Position of PREGION0RA field. */ +#define MWU_NMIENCLR_PREGION0RA_Msk (0x1UL << MWU_NMIENCLR_PREGION0RA_Pos) /*!< Bit mask of PREGION0RA field. */ +#define MWU_NMIENCLR_PREGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_PREGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_PREGION0RA_Clear (1UL) /*!< Disable */ + +/* Bit 24 : Write '1' to Disable non-maskable interrupt for PREGION[0].WA event */ +#define MWU_NMIENCLR_PREGION0WA_Pos (24UL) /*!< Position of PREGION0WA field. */ +#define MWU_NMIENCLR_PREGION0WA_Msk (0x1UL << MWU_NMIENCLR_PREGION0WA_Pos) /*!< Bit mask of PREGION0WA field. */ +#define MWU_NMIENCLR_PREGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_PREGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_PREGION0WA_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable non-maskable interrupt for REGION[3].RA event */ +#define MWU_NMIENCLR_REGION3RA_Pos (7UL) /*!< Position of REGION3RA field. */ +#define MWU_NMIENCLR_REGION3RA_Msk (0x1UL << MWU_NMIENCLR_REGION3RA_Pos) /*!< Bit mask of REGION3RA field. */ +#define MWU_NMIENCLR_REGION3RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION3RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION3RA_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable non-maskable interrupt for REGION[3].WA event */ +#define MWU_NMIENCLR_REGION3WA_Pos (6UL) /*!< Position of REGION3WA field. */ +#define MWU_NMIENCLR_REGION3WA_Msk (0x1UL << MWU_NMIENCLR_REGION3WA_Pos) /*!< Bit mask of REGION3WA field. */ +#define MWU_NMIENCLR_REGION3WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION3WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION3WA_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable non-maskable interrupt for REGION[2].RA event */ +#define MWU_NMIENCLR_REGION2RA_Pos (5UL) /*!< Position of REGION2RA field. */ +#define MWU_NMIENCLR_REGION2RA_Msk (0x1UL << MWU_NMIENCLR_REGION2RA_Pos) /*!< Bit mask of REGION2RA field. */ +#define MWU_NMIENCLR_REGION2RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION2RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION2RA_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable non-maskable interrupt for REGION[2].WA event */ +#define MWU_NMIENCLR_REGION2WA_Pos (4UL) /*!< Position of REGION2WA field. */ +#define MWU_NMIENCLR_REGION2WA_Msk (0x1UL << MWU_NMIENCLR_REGION2WA_Pos) /*!< Bit mask of REGION2WA field. */ +#define MWU_NMIENCLR_REGION2WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION2WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION2WA_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable non-maskable interrupt for REGION[1].RA event */ +#define MWU_NMIENCLR_REGION1RA_Pos (3UL) /*!< Position of REGION1RA field. */ +#define MWU_NMIENCLR_REGION1RA_Msk (0x1UL << MWU_NMIENCLR_REGION1RA_Pos) /*!< Bit mask of REGION1RA field. */ +#define MWU_NMIENCLR_REGION1RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION1RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION1RA_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable non-maskable interrupt for REGION[1].WA event */ +#define MWU_NMIENCLR_REGION1WA_Pos (2UL) /*!< Position of REGION1WA field. */ +#define MWU_NMIENCLR_REGION1WA_Msk (0x1UL << MWU_NMIENCLR_REGION1WA_Pos) /*!< Bit mask of REGION1WA field. */ +#define MWU_NMIENCLR_REGION1WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION1WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION1WA_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable non-maskable interrupt for REGION[0].RA event */ +#define MWU_NMIENCLR_REGION0RA_Pos (1UL) /*!< Position of REGION0RA field. */ +#define MWU_NMIENCLR_REGION0RA_Msk (0x1UL << MWU_NMIENCLR_REGION0RA_Pos) /*!< Bit mask of REGION0RA field. */ +#define MWU_NMIENCLR_REGION0RA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION0RA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION0RA_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable non-maskable interrupt for REGION[0].WA event */ +#define MWU_NMIENCLR_REGION0WA_Pos (0UL) /*!< Position of REGION0WA field. */ +#define MWU_NMIENCLR_REGION0WA_Msk (0x1UL << MWU_NMIENCLR_REGION0WA_Pos) /*!< Bit mask of REGION0WA field. */ +#define MWU_NMIENCLR_REGION0WA_Disabled (0UL) /*!< Read: Disabled */ +#define MWU_NMIENCLR_REGION0WA_Enabled (1UL) /*!< Read: Enabled */ +#define MWU_NMIENCLR_REGION0WA_Clear (1UL) /*!< Disable */ + +/* Register: MWU_PERREGION_SUBSTATWA */ +/* Description: Description cluster[0]: Source of event/interrupt in region 0, write access detected while corresponding subregion was enabled for watching */ + +/* Bit 31 : Subregion 31 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR31_Pos (31UL) /*!< Position of SR31 field. */ +#define MWU_PERREGION_SUBSTATWA_SR31_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR31_Pos) /*!< Bit mask of SR31 field. */ +#define MWU_PERREGION_SUBSTATWA_SR31_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR31_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 30 : Subregion 30 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR30_Pos (30UL) /*!< Position of SR30 field. */ +#define MWU_PERREGION_SUBSTATWA_SR30_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR30_Pos) /*!< Bit mask of SR30 field. */ +#define MWU_PERREGION_SUBSTATWA_SR30_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR30_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 29 : Subregion 29 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR29_Pos (29UL) /*!< Position of SR29 field. */ +#define MWU_PERREGION_SUBSTATWA_SR29_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR29_Pos) /*!< Bit mask of SR29 field. */ +#define MWU_PERREGION_SUBSTATWA_SR29_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR29_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 28 : Subregion 28 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR28_Pos (28UL) /*!< Position of SR28 field. */ +#define MWU_PERREGION_SUBSTATWA_SR28_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR28_Pos) /*!< Bit mask of SR28 field. */ +#define MWU_PERREGION_SUBSTATWA_SR28_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR28_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 27 : Subregion 27 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR27_Pos (27UL) /*!< Position of SR27 field. */ +#define MWU_PERREGION_SUBSTATWA_SR27_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR27_Pos) /*!< Bit mask of SR27 field. */ +#define MWU_PERREGION_SUBSTATWA_SR27_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR27_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 26 : Subregion 26 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR26_Pos (26UL) /*!< Position of SR26 field. */ +#define MWU_PERREGION_SUBSTATWA_SR26_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR26_Pos) /*!< Bit mask of SR26 field. */ +#define MWU_PERREGION_SUBSTATWA_SR26_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR26_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 25 : Subregion 25 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR25_Pos (25UL) /*!< Position of SR25 field. */ +#define MWU_PERREGION_SUBSTATWA_SR25_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR25_Pos) /*!< Bit mask of SR25 field. */ +#define MWU_PERREGION_SUBSTATWA_SR25_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR25_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 24 : Subregion 24 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR24_Pos (24UL) /*!< Position of SR24 field. */ +#define MWU_PERREGION_SUBSTATWA_SR24_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR24_Pos) /*!< Bit mask of SR24 field. */ +#define MWU_PERREGION_SUBSTATWA_SR24_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR24_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 23 : Subregion 23 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR23_Pos (23UL) /*!< Position of SR23 field. */ +#define MWU_PERREGION_SUBSTATWA_SR23_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR23_Pos) /*!< Bit mask of SR23 field. */ +#define MWU_PERREGION_SUBSTATWA_SR23_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR23_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 22 : Subregion 22 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR22_Pos (22UL) /*!< Position of SR22 field. */ +#define MWU_PERREGION_SUBSTATWA_SR22_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR22_Pos) /*!< Bit mask of SR22 field. */ +#define MWU_PERREGION_SUBSTATWA_SR22_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR22_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 21 : Subregion 21 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR21_Pos (21UL) /*!< Position of SR21 field. */ +#define MWU_PERREGION_SUBSTATWA_SR21_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR21_Pos) /*!< Bit mask of SR21 field. */ +#define MWU_PERREGION_SUBSTATWA_SR21_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR21_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 20 : Subregion 20 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR20_Pos (20UL) /*!< Position of SR20 field. */ +#define MWU_PERREGION_SUBSTATWA_SR20_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR20_Pos) /*!< Bit mask of SR20 field. */ +#define MWU_PERREGION_SUBSTATWA_SR20_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR20_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 19 : Subregion 19 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR19_Pos (19UL) /*!< Position of SR19 field. */ +#define MWU_PERREGION_SUBSTATWA_SR19_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR19_Pos) /*!< Bit mask of SR19 field. */ +#define MWU_PERREGION_SUBSTATWA_SR19_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR19_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 18 : Subregion 18 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR18_Pos (18UL) /*!< Position of SR18 field. */ +#define MWU_PERREGION_SUBSTATWA_SR18_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR18_Pos) /*!< Bit mask of SR18 field. */ +#define MWU_PERREGION_SUBSTATWA_SR18_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR18_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 17 : Subregion 17 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR17_Pos (17UL) /*!< Position of SR17 field. */ +#define MWU_PERREGION_SUBSTATWA_SR17_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR17_Pos) /*!< Bit mask of SR17 field. */ +#define MWU_PERREGION_SUBSTATWA_SR17_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR17_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 16 : Subregion 16 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR16_Pos (16UL) /*!< Position of SR16 field. */ +#define MWU_PERREGION_SUBSTATWA_SR16_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR16_Pos) /*!< Bit mask of SR16 field. */ +#define MWU_PERREGION_SUBSTATWA_SR16_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR16_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 15 : Subregion 15 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR15_Pos (15UL) /*!< Position of SR15 field. */ +#define MWU_PERREGION_SUBSTATWA_SR15_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR15_Pos) /*!< Bit mask of SR15 field. */ +#define MWU_PERREGION_SUBSTATWA_SR15_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR15_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 14 : Subregion 14 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR14_Pos (14UL) /*!< Position of SR14 field. */ +#define MWU_PERREGION_SUBSTATWA_SR14_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR14_Pos) /*!< Bit mask of SR14 field. */ +#define MWU_PERREGION_SUBSTATWA_SR14_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR14_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 13 : Subregion 13 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR13_Pos (13UL) /*!< Position of SR13 field. */ +#define MWU_PERREGION_SUBSTATWA_SR13_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR13_Pos) /*!< Bit mask of SR13 field. */ +#define MWU_PERREGION_SUBSTATWA_SR13_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR13_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 12 : Subregion 12 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR12_Pos (12UL) /*!< Position of SR12 field. */ +#define MWU_PERREGION_SUBSTATWA_SR12_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR12_Pos) /*!< Bit mask of SR12 field. */ +#define MWU_PERREGION_SUBSTATWA_SR12_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR12_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 11 : Subregion 11 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR11_Pos (11UL) /*!< Position of SR11 field. */ +#define MWU_PERREGION_SUBSTATWA_SR11_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR11_Pos) /*!< Bit mask of SR11 field. */ +#define MWU_PERREGION_SUBSTATWA_SR11_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR11_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 10 : Subregion 10 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR10_Pos (10UL) /*!< Position of SR10 field. */ +#define MWU_PERREGION_SUBSTATWA_SR10_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR10_Pos) /*!< Bit mask of SR10 field. */ +#define MWU_PERREGION_SUBSTATWA_SR10_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR10_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 9 : Subregion 9 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR9_Pos (9UL) /*!< Position of SR9 field. */ +#define MWU_PERREGION_SUBSTATWA_SR9_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR9_Pos) /*!< Bit mask of SR9 field. */ +#define MWU_PERREGION_SUBSTATWA_SR9_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR9_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 8 : Subregion 8 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR8_Pos (8UL) /*!< Position of SR8 field. */ +#define MWU_PERREGION_SUBSTATWA_SR8_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR8_Pos) /*!< Bit mask of SR8 field. */ +#define MWU_PERREGION_SUBSTATWA_SR8_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR8_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 7 : Subregion 7 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR7_Pos (7UL) /*!< Position of SR7 field. */ +#define MWU_PERREGION_SUBSTATWA_SR7_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR7_Pos) /*!< Bit mask of SR7 field. */ +#define MWU_PERREGION_SUBSTATWA_SR7_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR7_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 6 : Subregion 6 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR6_Pos (6UL) /*!< Position of SR6 field. */ +#define MWU_PERREGION_SUBSTATWA_SR6_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR6_Pos) /*!< Bit mask of SR6 field. */ +#define MWU_PERREGION_SUBSTATWA_SR6_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR6_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 5 : Subregion 5 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR5_Pos (5UL) /*!< Position of SR5 field. */ +#define MWU_PERREGION_SUBSTATWA_SR5_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR5_Pos) /*!< Bit mask of SR5 field. */ +#define MWU_PERREGION_SUBSTATWA_SR5_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR5_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 4 : Subregion 4 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR4_Pos (4UL) /*!< Position of SR4 field. */ +#define MWU_PERREGION_SUBSTATWA_SR4_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR4_Pos) /*!< Bit mask of SR4 field. */ +#define MWU_PERREGION_SUBSTATWA_SR4_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR4_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 3 : Subregion 3 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR3_Pos (3UL) /*!< Position of SR3 field. */ +#define MWU_PERREGION_SUBSTATWA_SR3_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR3_Pos) /*!< Bit mask of SR3 field. */ +#define MWU_PERREGION_SUBSTATWA_SR3_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR3_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 2 : Subregion 2 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR2_Pos (2UL) /*!< Position of SR2 field. */ +#define MWU_PERREGION_SUBSTATWA_SR2_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR2_Pos) /*!< Bit mask of SR2 field. */ +#define MWU_PERREGION_SUBSTATWA_SR2_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR2_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 1 : Subregion 1 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR1_Pos (1UL) /*!< Position of SR1 field. */ +#define MWU_PERREGION_SUBSTATWA_SR1_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR1_Pos) /*!< Bit mask of SR1 field. */ +#define MWU_PERREGION_SUBSTATWA_SR1_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR1_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Bit 0 : Subregion 0 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATWA_SR0_Pos (0UL) /*!< Position of SR0 field. */ +#define MWU_PERREGION_SUBSTATWA_SR0_Msk (0x1UL << MWU_PERREGION_SUBSTATWA_SR0_Pos) /*!< Bit mask of SR0 field. */ +#define MWU_PERREGION_SUBSTATWA_SR0_NoAccess (0UL) /*!< No write access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATWA_SR0_Access (1UL) /*!< Write access(es) occurred in this subregion */ + +/* Register: MWU_PERREGION_SUBSTATRA */ +/* Description: Description cluster[0]: Source of event/interrupt in region 0, read access detected while corresponding subregion was enabled for watching */ + +/* Bit 31 : Subregion 31 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR31_Pos (31UL) /*!< Position of SR31 field. */ +#define MWU_PERREGION_SUBSTATRA_SR31_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR31_Pos) /*!< Bit mask of SR31 field. */ +#define MWU_PERREGION_SUBSTATRA_SR31_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR31_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 30 : Subregion 30 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR30_Pos (30UL) /*!< Position of SR30 field. */ +#define MWU_PERREGION_SUBSTATRA_SR30_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR30_Pos) /*!< Bit mask of SR30 field. */ +#define MWU_PERREGION_SUBSTATRA_SR30_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR30_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 29 : Subregion 29 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR29_Pos (29UL) /*!< Position of SR29 field. */ +#define MWU_PERREGION_SUBSTATRA_SR29_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR29_Pos) /*!< Bit mask of SR29 field. */ +#define MWU_PERREGION_SUBSTATRA_SR29_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR29_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 28 : Subregion 28 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR28_Pos (28UL) /*!< Position of SR28 field. */ +#define MWU_PERREGION_SUBSTATRA_SR28_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR28_Pos) /*!< Bit mask of SR28 field. */ +#define MWU_PERREGION_SUBSTATRA_SR28_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR28_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 27 : Subregion 27 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR27_Pos (27UL) /*!< Position of SR27 field. */ +#define MWU_PERREGION_SUBSTATRA_SR27_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR27_Pos) /*!< Bit mask of SR27 field. */ +#define MWU_PERREGION_SUBSTATRA_SR27_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR27_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 26 : Subregion 26 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR26_Pos (26UL) /*!< Position of SR26 field. */ +#define MWU_PERREGION_SUBSTATRA_SR26_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR26_Pos) /*!< Bit mask of SR26 field. */ +#define MWU_PERREGION_SUBSTATRA_SR26_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR26_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 25 : Subregion 25 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR25_Pos (25UL) /*!< Position of SR25 field. */ +#define MWU_PERREGION_SUBSTATRA_SR25_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR25_Pos) /*!< Bit mask of SR25 field. */ +#define MWU_PERREGION_SUBSTATRA_SR25_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR25_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 24 : Subregion 24 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR24_Pos (24UL) /*!< Position of SR24 field. */ +#define MWU_PERREGION_SUBSTATRA_SR24_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR24_Pos) /*!< Bit mask of SR24 field. */ +#define MWU_PERREGION_SUBSTATRA_SR24_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR24_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 23 : Subregion 23 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR23_Pos (23UL) /*!< Position of SR23 field. */ +#define MWU_PERREGION_SUBSTATRA_SR23_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR23_Pos) /*!< Bit mask of SR23 field. */ +#define MWU_PERREGION_SUBSTATRA_SR23_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR23_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 22 : Subregion 22 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR22_Pos (22UL) /*!< Position of SR22 field. */ +#define MWU_PERREGION_SUBSTATRA_SR22_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR22_Pos) /*!< Bit mask of SR22 field. */ +#define MWU_PERREGION_SUBSTATRA_SR22_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR22_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 21 : Subregion 21 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR21_Pos (21UL) /*!< Position of SR21 field. */ +#define MWU_PERREGION_SUBSTATRA_SR21_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR21_Pos) /*!< Bit mask of SR21 field. */ +#define MWU_PERREGION_SUBSTATRA_SR21_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR21_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 20 : Subregion 20 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR20_Pos (20UL) /*!< Position of SR20 field. */ +#define MWU_PERREGION_SUBSTATRA_SR20_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR20_Pos) /*!< Bit mask of SR20 field. */ +#define MWU_PERREGION_SUBSTATRA_SR20_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR20_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 19 : Subregion 19 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR19_Pos (19UL) /*!< Position of SR19 field. */ +#define MWU_PERREGION_SUBSTATRA_SR19_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR19_Pos) /*!< Bit mask of SR19 field. */ +#define MWU_PERREGION_SUBSTATRA_SR19_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR19_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 18 : Subregion 18 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR18_Pos (18UL) /*!< Position of SR18 field. */ +#define MWU_PERREGION_SUBSTATRA_SR18_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR18_Pos) /*!< Bit mask of SR18 field. */ +#define MWU_PERREGION_SUBSTATRA_SR18_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR18_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 17 : Subregion 17 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR17_Pos (17UL) /*!< Position of SR17 field. */ +#define MWU_PERREGION_SUBSTATRA_SR17_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR17_Pos) /*!< Bit mask of SR17 field. */ +#define MWU_PERREGION_SUBSTATRA_SR17_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR17_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 16 : Subregion 16 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR16_Pos (16UL) /*!< Position of SR16 field. */ +#define MWU_PERREGION_SUBSTATRA_SR16_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR16_Pos) /*!< Bit mask of SR16 field. */ +#define MWU_PERREGION_SUBSTATRA_SR16_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR16_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 15 : Subregion 15 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR15_Pos (15UL) /*!< Position of SR15 field. */ +#define MWU_PERREGION_SUBSTATRA_SR15_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR15_Pos) /*!< Bit mask of SR15 field. */ +#define MWU_PERREGION_SUBSTATRA_SR15_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR15_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 14 : Subregion 14 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR14_Pos (14UL) /*!< Position of SR14 field. */ +#define MWU_PERREGION_SUBSTATRA_SR14_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR14_Pos) /*!< Bit mask of SR14 field. */ +#define MWU_PERREGION_SUBSTATRA_SR14_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR14_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 13 : Subregion 13 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR13_Pos (13UL) /*!< Position of SR13 field. */ +#define MWU_PERREGION_SUBSTATRA_SR13_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR13_Pos) /*!< Bit mask of SR13 field. */ +#define MWU_PERREGION_SUBSTATRA_SR13_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR13_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 12 : Subregion 12 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR12_Pos (12UL) /*!< Position of SR12 field. */ +#define MWU_PERREGION_SUBSTATRA_SR12_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR12_Pos) /*!< Bit mask of SR12 field. */ +#define MWU_PERREGION_SUBSTATRA_SR12_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR12_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 11 : Subregion 11 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR11_Pos (11UL) /*!< Position of SR11 field. */ +#define MWU_PERREGION_SUBSTATRA_SR11_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR11_Pos) /*!< Bit mask of SR11 field. */ +#define MWU_PERREGION_SUBSTATRA_SR11_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR11_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 10 : Subregion 10 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR10_Pos (10UL) /*!< Position of SR10 field. */ +#define MWU_PERREGION_SUBSTATRA_SR10_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR10_Pos) /*!< Bit mask of SR10 field. */ +#define MWU_PERREGION_SUBSTATRA_SR10_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR10_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 9 : Subregion 9 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR9_Pos (9UL) /*!< Position of SR9 field. */ +#define MWU_PERREGION_SUBSTATRA_SR9_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR9_Pos) /*!< Bit mask of SR9 field. */ +#define MWU_PERREGION_SUBSTATRA_SR9_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR9_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 8 : Subregion 8 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR8_Pos (8UL) /*!< Position of SR8 field. */ +#define MWU_PERREGION_SUBSTATRA_SR8_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR8_Pos) /*!< Bit mask of SR8 field. */ +#define MWU_PERREGION_SUBSTATRA_SR8_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR8_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 7 : Subregion 7 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR7_Pos (7UL) /*!< Position of SR7 field. */ +#define MWU_PERREGION_SUBSTATRA_SR7_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR7_Pos) /*!< Bit mask of SR7 field. */ +#define MWU_PERREGION_SUBSTATRA_SR7_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR7_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 6 : Subregion 6 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR6_Pos (6UL) /*!< Position of SR6 field. */ +#define MWU_PERREGION_SUBSTATRA_SR6_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR6_Pos) /*!< Bit mask of SR6 field. */ +#define MWU_PERREGION_SUBSTATRA_SR6_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR6_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 5 : Subregion 5 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR5_Pos (5UL) /*!< Position of SR5 field. */ +#define MWU_PERREGION_SUBSTATRA_SR5_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR5_Pos) /*!< Bit mask of SR5 field. */ +#define MWU_PERREGION_SUBSTATRA_SR5_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR5_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 4 : Subregion 4 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR4_Pos (4UL) /*!< Position of SR4 field. */ +#define MWU_PERREGION_SUBSTATRA_SR4_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR4_Pos) /*!< Bit mask of SR4 field. */ +#define MWU_PERREGION_SUBSTATRA_SR4_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR4_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 3 : Subregion 3 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR3_Pos (3UL) /*!< Position of SR3 field. */ +#define MWU_PERREGION_SUBSTATRA_SR3_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR3_Pos) /*!< Bit mask of SR3 field. */ +#define MWU_PERREGION_SUBSTATRA_SR3_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR3_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 2 : Subregion 2 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR2_Pos (2UL) /*!< Position of SR2 field. */ +#define MWU_PERREGION_SUBSTATRA_SR2_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR2_Pos) /*!< Bit mask of SR2 field. */ +#define MWU_PERREGION_SUBSTATRA_SR2_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR2_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 1 : Subregion 1 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR1_Pos (1UL) /*!< Position of SR1 field. */ +#define MWU_PERREGION_SUBSTATRA_SR1_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR1_Pos) /*!< Bit mask of SR1 field. */ +#define MWU_PERREGION_SUBSTATRA_SR1_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR1_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Bit 0 : Subregion 0 in region 0 (write '1' to clear) */ +#define MWU_PERREGION_SUBSTATRA_SR0_Pos (0UL) /*!< Position of SR0 field. */ +#define MWU_PERREGION_SUBSTATRA_SR0_Msk (0x1UL << MWU_PERREGION_SUBSTATRA_SR0_Pos) /*!< Bit mask of SR0 field. */ +#define MWU_PERREGION_SUBSTATRA_SR0_NoAccess (0UL) /*!< No read access occurred in this subregion */ +#define MWU_PERREGION_SUBSTATRA_SR0_Access (1UL) /*!< Read access(es) occurred in this subregion */ + +/* Register: MWU_REGIONEN */ +/* Description: Enable/disable regions watch */ + +/* Bit 27 : Enable/disable read access watch in PREGION[1] */ +#define MWU_REGIONEN_PRGN1RA_Pos (27UL) /*!< Position of PRGN1RA field. */ +#define MWU_REGIONEN_PRGN1RA_Msk (0x1UL << MWU_REGIONEN_PRGN1RA_Pos) /*!< Bit mask of PRGN1RA field. */ +#define MWU_REGIONEN_PRGN1RA_Disable (0UL) /*!< Disable read access watch in this PREGION */ +#define MWU_REGIONEN_PRGN1RA_Enable (1UL) /*!< Enable read access watch in this PREGION */ + +/* Bit 26 : Enable/disable write access watch in PREGION[1] */ +#define MWU_REGIONEN_PRGN1WA_Pos (26UL) /*!< Position of PRGN1WA field. */ +#define MWU_REGIONEN_PRGN1WA_Msk (0x1UL << MWU_REGIONEN_PRGN1WA_Pos) /*!< Bit mask of PRGN1WA field. */ +#define MWU_REGIONEN_PRGN1WA_Disable (0UL) /*!< Disable write access watch in this PREGION */ +#define MWU_REGIONEN_PRGN1WA_Enable (1UL) /*!< Enable write access watch in this PREGION */ + +/* Bit 25 : Enable/disable read access watch in PREGION[0] */ +#define MWU_REGIONEN_PRGN0RA_Pos (25UL) /*!< Position of PRGN0RA field. */ +#define MWU_REGIONEN_PRGN0RA_Msk (0x1UL << MWU_REGIONEN_PRGN0RA_Pos) /*!< Bit mask of PRGN0RA field. */ +#define MWU_REGIONEN_PRGN0RA_Disable (0UL) /*!< Disable read access watch in this PREGION */ +#define MWU_REGIONEN_PRGN0RA_Enable (1UL) /*!< Enable read access watch in this PREGION */ + +/* Bit 24 : Enable/disable write access watch in PREGION[0] */ +#define MWU_REGIONEN_PRGN0WA_Pos (24UL) /*!< Position of PRGN0WA field. */ +#define MWU_REGIONEN_PRGN0WA_Msk (0x1UL << MWU_REGIONEN_PRGN0WA_Pos) /*!< Bit mask of PRGN0WA field. */ +#define MWU_REGIONEN_PRGN0WA_Disable (0UL) /*!< Disable write access watch in this PREGION */ +#define MWU_REGIONEN_PRGN0WA_Enable (1UL) /*!< Enable write access watch in this PREGION */ + +/* Bit 7 : Enable/disable read access watch in region[3] */ +#define MWU_REGIONEN_RGN3RA_Pos (7UL) /*!< Position of RGN3RA field. */ +#define MWU_REGIONEN_RGN3RA_Msk (0x1UL << MWU_REGIONEN_RGN3RA_Pos) /*!< Bit mask of RGN3RA field. */ +#define MWU_REGIONEN_RGN3RA_Disable (0UL) /*!< Disable read access watch in this region */ +#define MWU_REGIONEN_RGN3RA_Enable (1UL) /*!< Enable read access watch in this region */ + +/* Bit 6 : Enable/disable write access watch in region[3] */ +#define MWU_REGIONEN_RGN3WA_Pos (6UL) /*!< Position of RGN3WA field. */ +#define MWU_REGIONEN_RGN3WA_Msk (0x1UL << MWU_REGIONEN_RGN3WA_Pos) /*!< Bit mask of RGN3WA field. */ +#define MWU_REGIONEN_RGN3WA_Disable (0UL) /*!< Disable write access watch in this region */ +#define MWU_REGIONEN_RGN3WA_Enable (1UL) /*!< Enable write access watch in this region */ + +/* Bit 5 : Enable/disable read access watch in region[2] */ +#define MWU_REGIONEN_RGN2RA_Pos (5UL) /*!< Position of RGN2RA field. */ +#define MWU_REGIONEN_RGN2RA_Msk (0x1UL << MWU_REGIONEN_RGN2RA_Pos) /*!< Bit mask of RGN2RA field. */ +#define MWU_REGIONEN_RGN2RA_Disable (0UL) /*!< Disable read access watch in this region */ +#define MWU_REGIONEN_RGN2RA_Enable (1UL) /*!< Enable read access watch in this region */ + +/* Bit 4 : Enable/disable write access watch in region[2] */ +#define MWU_REGIONEN_RGN2WA_Pos (4UL) /*!< Position of RGN2WA field. */ +#define MWU_REGIONEN_RGN2WA_Msk (0x1UL << MWU_REGIONEN_RGN2WA_Pos) /*!< Bit mask of RGN2WA field. */ +#define MWU_REGIONEN_RGN2WA_Disable (0UL) /*!< Disable write access watch in this region */ +#define MWU_REGIONEN_RGN2WA_Enable (1UL) /*!< Enable write access watch in this region */ + +/* Bit 3 : Enable/disable read access watch in region[1] */ +#define MWU_REGIONEN_RGN1RA_Pos (3UL) /*!< Position of RGN1RA field. */ +#define MWU_REGIONEN_RGN1RA_Msk (0x1UL << MWU_REGIONEN_RGN1RA_Pos) /*!< Bit mask of RGN1RA field. */ +#define MWU_REGIONEN_RGN1RA_Disable (0UL) /*!< Disable read access watch in this region */ +#define MWU_REGIONEN_RGN1RA_Enable (1UL) /*!< Enable read access watch in this region */ + +/* Bit 2 : Enable/disable write access watch in region[1] */ +#define MWU_REGIONEN_RGN1WA_Pos (2UL) /*!< Position of RGN1WA field. */ +#define MWU_REGIONEN_RGN1WA_Msk (0x1UL << MWU_REGIONEN_RGN1WA_Pos) /*!< Bit mask of RGN1WA field. */ +#define MWU_REGIONEN_RGN1WA_Disable (0UL) /*!< Disable write access watch in this region */ +#define MWU_REGIONEN_RGN1WA_Enable (1UL) /*!< Enable write access watch in this region */ + +/* Bit 1 : Enable/disable read access watch in region[0] */ +#define MWU_REGIONEN_RGN0RA_Pos (1UL) /*!< Position of RGN0RA field. */ +#define MWU_REGIONEN_RGN0RA_Msk (0x1UL << MWU_REGIONEN_RGN0RA_Pos) /*!< Bit mask of RGN0RA field. */ +#define MWU_REGIONEN_RGN0RA_Disable (0UL) /*!< Disable read access watch in this region */ +#define MWU_REGIONEN_RGN0RA_Enable (1UL) /*!< Enable read access watch in this region */ + +/* Bit 0 : Enable/disable write access watch in region[0] */ +#define MWU_REGIONEN_RGN0WA_Pos (0UL) /*!< Position of RGN0WA field. */ +#define MWU_REGIONEN_RGN0WA_Msk (0x1UL << MWU_REGIONEN_RGN0WA_Pos) /*!< Bit mask of RGN0WA field. */ +#define MWU_REGIONEN_RGN0WA_Disable (0UL) /*!< Disable write access watch in this region */ +#define MWU_REGIONEN_RGN0WA_Enable (1UL) /*!< Enable write access watch in this region */ + +/* Register: MWU_REGIONENSET */ +/* Description: Enable regions watch */ + +/* Bit 27 : Enable read access watch in PREGION[1] */ +#define MWU_REGIONENSET_PRGN1RA_Pos (27UL) /*!< Position of PRGN1RA field. */ +#define MWU_REGIONENSET_PRGN1RA_Msk (0x1UL << MWU_REGIONENSET_PRGN1RA_Pos) /*!< Bit mask of PRGN1RA field. */ +#define MWU_REGIONENSET_PRGN1RA_Disabled (0UL) /*!< Read access watch in this PREGION is disabled */ +#define MWU_REGIONENSET_PRGN1RA_Enabled (1UL) /*!< Read access watch in this PREGION is enabled */ +#define MWU_REGIONENSET_PRGN1RA_Set (1UL) /*!< Enable read access watch in this PREGION */ + +/* Bit 26 : Enable write access watch in PREGION[1] */ +#define MWU_REGIONENSET_PRGN1WA_Pos (26UL) /*!< Position of PRGN1WA field. */ +#define MWU_REGIONENSET_PRGN1WA_Msk (0x1UL << MWU_REGIONENSET_PRGN1WA_Pos) /*!< Bit mask of PRGN1WA field. */ +#define MWU_REGIONENSET_PRGN1WA_Disabled (0UL) /*!< Write access watch in this PREGION is disabled */ +#define MWU_REGIONENSET_PRGN1WA_Enabled (1UL) /*!< Write access watch in this PREGION is enabled */ +#define MWU_REGIONENSET_PRGN1WA_Set (1UL) /*!< Enable write access watch in this PREGION */ + +/* Bit 25 : Enable read access watch in PREGION[0] */ +#define MWU_REGIONENSET_PRGN0RA_Pos (25UL) /*!< Position of PRGN0RA field. */ +#define MWU_REGIONENSET_PRGN0RA_Msk (0x1UL << MWU_REGIONENSET_PRGN0RA_Pos) /*!< Bit mask of PRGN0RA field. */ +#define MWU_REGIONENSET_PRGN0RA_Disabled (0UL) /*!< Read access watch in this PREGION is disabled */ +#define MWU_REGIONENSET_PRGN0RA_Enabled (1UL) /*!< Read access watch in this PREGION is enabled */ +#define MWU_REGIONENSET_PRGN0RA_Set (1UL) /*!< Enable read access watch in this PREGION */ + +/* Bit 24 : Enable write access watch in PREGION[0] */ +#define MWU_REGIONENSET_PRGN0WA_Pos (24UL) /*!< Position of PRGN0WA field. */ +#define MWU_REGIONENSET_PRGN0WA_Msk (0x1UL << MWU_REGIONENSET_PRGN0WA_Pos) /*!< Bit mask of PRGN0WA field. */ +#define MWU_REGIONENSET_PRGN0WA_Disabled (0UL) /*!< Write access watch in this PREGION is disabled */ +#define MWU_REGIONENSET_PRGN0WA_Enabled (1UL) /*!< Write access watch in this PREGION is enabled */ +#define MWU_REGIONENSET_PRGN0WA_Set (1UL) /*!< Enable write access watch in this PREGION */ + +/* Bit 7 : Enable read access watch in region[3] */ +#define MWU_REGIONENSET_RGN3RA_Pos (7UL) /*!< Position of RGN3RA field. */ +#define MWU_REGIONENSET_RGN3RA_Msk (0x1UL << MWU_REGIONENSET_RGN3RA_Pos) /*!< Bit mask of RGN3RA field. */ +#define MWU_REGIONENSET_RGN3RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN3RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN3RA_Set (1UL) /*!< Enable read access watch in this region */ + +/* Bit 6 : Enable write access watch in region[3] */ +#define MWU_REGIONENSET_RGN3WA_Pos (6UL) /*!< Position of RGN3WA field. */ +#define MWU_REGIONENSET_RGN3WA_Msk (0x1UL << MWU_REGIONENSET_RGN3WA_Pos) /*!< Bit mask of RGN3WA field. */ +#define MWU_REGIONENSET_RGN3WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN3WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN3WA_Set (1UL) /*!< Enable write access watch in this region */ + +/* Bit 5 : Enable read access watch in region[2] */ +#define MWU_REGIONENSET_RGN2RA_Pos (5UL) /*!< Position of RGN2RA field. */ +#define MWU_REGIONENSET_RGN2RA_Msk (0x1UL << MWU_REGIONENSET_RGN2RA_Pos) /*!< Bit mask of RGN2RA field. */ +#define MWU_REGIONENSET_RGN2RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN2RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN2RA_Set (1UL) /*!< Enable read access watch in this region */ + +/* Bit 4 : Enable write access watch in region[2] */ +#define MWU_REGIONENSET_RGN2WA_Pos (4UL) /*!< Position of RGN2WA field. */ +#define MWU_REGIONENSET_RGN2WA_Msk (0x1UL << MWU_REGIONENSET_RGN2WA_Pos) /*!< Bit mask of RGN2WA field. */ +#define MWU_REGIONENSET_RGN2WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN2WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN2WA_Set (1UL) /*!< Enable write access watch in this region */ + +/* Bit 3 : Enable read access watch in region[1] */ +#define MWU_REGIONENSET_RGN1RA_Pos (3UL) /*!< Position of RGN1RA field. */ +#define MWU_REGIONENSET_RGN1RA_Msk (0x1UL << MWU_REGIONENSET_RGN1RA_Pos) /*!< Bit mask of RGN1RA field. */ +#define MWU_REGIONENSET_RGN1RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN1RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN1RA_Set (1UL) /*!< Enable read access watch in this region */ + +/* Bit 2 : Enable write access watch in region[1] */ +#define MWU_REGIONENSET_RGN1WA_Pos (2UL) /*!< Position of RGN1WA field. */ +#define MWU_REGIONENSET_RGN1WA_Msk (0x1UL << MWU_REGIONENSET_RGN1WA_Pos) /*!< Bit mask of RGN1WA field. */ +#define MWU_REGIONENSET_RGN1WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN1WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN1WA_Set (1UL) /*!< Enable write access watch in this region */ + +/* Bit 1 : Enable read access watch in region[0] */ +#define MWU_REGIONENSET_RGN0RA_Pos (1UL) /*!< Position of RGN0RA field. */ +#define MWU_REGIONENSET_RGN0RA_Msk (0x1UL << MWU_REGIONENSET_RGN0RA_Pos) /*!< Bit mask of RGN0RA field. */ +#define MWU_REGIONENSET_RGN0RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN0RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN0RA_Set (1UL) /*!< Enable read access watch in this region */ + +/* Bit 0 : Enable write access watch in region[0] */ +#define MWU_REGIONENSET_RGN0WA_Pos (0UL) /*!< Position of RGN0WA field. */ +#define MWU_REGIONENSET_RGN0WA_Msk (0x1UL << MWU_REGIONENSET_RGN0WA_Pos) /*!< Bit mask of RGN0WA field. */ +#define MWU_REGIONENSET_RGN0WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENSET_RGN0WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENSET_RGN0WA_Set (1UL) /*!< Enable write access watch in this region */ + +/* Register: MWU_REGIONENCLR */ +/* Description: Disable regions watch */ + +/* Bit 27 : Disable read access watch in PREGION[1] */ +#define MWU_REGIONENCLR_PRGN1RA_Pos (27UL) /*!< Position of PRGN1RA field. */ +#define MWU_REGIONENCLR_PRGN1RA_Msk (0x1UL << MWU_REGIONENCLR_PRGN1RA_Pos) /*!< Bit mask of PRGN1RA field. */ +#define MWU_REGIONENCLR_PRGN1RA_Disabled (0UL) /*!< Read access watch in this PREGION is disabled */ +#define MWU_REGIONENCLR_PRGN1RA_Enabled (1UL) /*!< Read access watch in this PREGION is enabled */ +#define MWU_REGIONENCLR_PRGN1RA_Clear (1UL) /*!< Disable read access watch in this PREGION */ + +/* Bit 26 : Disable write access watch in PREGION[1] */ +#define MWU_REGIONENCLR_PRGN1WA_Pos (26UL) /*!< Position of PRGN1WA field. */ +#define MWU_REGIONENCLR_PRGN1WA_Msk (0x1UL << MWU_REGIONENCLR_PRGN1WA_Pos) /*!< Bit mask of PRGN1WA field. */ +#define MWU_REGIONENCLR_PRGN1WA_Disabled (0UL) /*!< Write access watch in this PREGION is disabled */ +#define MWU_REGIONENCLR_PRGN1WA_Enabled (1UL) /*!< Write access watch in this PREGION is enabled */ +#define MWU_REGIONENCLR_PRGN1WA_Clear (1UL) /*!< Disable write access watch in this PREGION */ + +/* Bit 25 : Disable read access watch in PREGION[0] */ +#define MWU_REGIONENCLR_PRGN0RA_Pos (25UL) /*!< Position of PRGN0RA field. */ +#define MWU_REGIONENCLR_PRGN0RA_Msk (0x1UL << MWU_REGIONENCLR_PRGN0RA_Pos) /*!< Bit mask of PRGN0RA field. */ +#define MWU_REGIONENCLR_PRGN0RA_Disabled (0UL) /*!< Read access watch in this PREGION is disabled */ +#define MWU_REGIONENCLR_PRGN0RA_Enabled (1UL) /*!< Read access watch in this PREGION is enabled */ +#define MWU_REGIONENCLR_PRGN0RA_Clear (1UL) /*!< Disable read access watch in this PREGION */ + +/* Bit 24 : Disable write access watch in PREGION[0] */ +#define MWU_REGIONENCLR_PRGN0WA_Pos (24UL) /*!< Position of PRGN0WA field. */ +#define MWU_REGIONENCLR_PRGN0WA_Msk (0x1UL << MWU_REGIONENCLR_PRGN0WA_Pos) /*!< Bit mask of PRGN0WA field. */ +#define MWU_REGIONENCLR_PRGN0WA_Disabled (0UL) /*!< Write access watch in this PREGION is disabled */ +#define MWU_REGIONENCLR_PRGN0WA_Enabled (1UL) /*!< Write access watch in this PREGION is enabled */ +#define MWU_REGIONENCLR_PRGN0WA_Clear (1UL) /*!< Disable write access watch in this PREGION */ + +/* Bit 7 : Disable read access watch in region[3] */ +#define MWU_REGIONENCLR_RGN3RA_Pos (7UL) /*!< Position of RGN3RA field. */ +#define MWU_REGIONENCLR_RGN3RA_Msk (0x1UL << MWU_REGIONENCLR_RGN3RA_Pos) /*!< Bit mask of RGN3RA field. */ +#define MWU_REGIONENCLR_RGN3RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN3RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN3RA_Clear (1UL) /*!< Disable read access watch in this region */ + +/* Bit 6 : Disable write access watch in region[3] */ +#define MWU_REGIONENCLR_RGN3WA_Pos (6UL) /*!< Position of RGN3WA field. */ +#define MWU_REGIONENCLR_RGN3WA_Msk (0x1UL << MWU_REGIONENCLR_RGN3WA_Pos) /*!< Bit mask of RGN3WA field. */ +#define MWU_REGIONENCLR_RGN3WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN3WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN3WA_Clear (1UL) /*!< Disable write access watch in this region */ + +/* Bit 5 : Disable read access watch in region[2] */ +#define MWU_REGIONENCLR_RGN2RA_Pos (5UL) /*!< Position of RGN2RA field. */ +#define MWU_REGIONENCLR_RGN2RA_Msk (0x1UL << MWU_REGIONENCLR_RGN2RA_Pos) /*!< Bit mask of RGN2RA field. */ +#define MWU_REGIONENCLR_RGN2RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN2RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN2RA_Clear (1UL) /*!< Disable read access watch in this region */ + +/* Bit 4 : Disable write access watch in region[2] */ +#define MWU_REGIONENCLR_RGN2WA_Pos (4UL) /*!< Position of RGN2WA field. */ +#define MWU_REGIONENCLR_RGN2WA_Msk (0x1UL << MWU_REGIONENCLR_RGN2WA_Pos) /*!< Bit mask of RGN2WA field. */ +#define MWU_REGIONENCLR_RGN2WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN2WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN2WA_Clear (1UL) /*!< Disable write access watch in this region */ + +/* Bit 3 : Disable read access watch in region[1] */ +#define MWU_REGIONENCLR_RGN1RA_Pos (3UL) /*!< Position of RGN1RA field. */ +#define MWU_REGIONENCLR_RGN1RA_Msk (0x1UL << MWU_REGIONENCLR_RGN1RA_Pos) /*!< Bit mask of RGN1RA field. */ +#define MWU_REGIONENCLR_RGN1RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN1RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN1RA_Clear (1UL) /*!< Disable read access watch in this region */ + +/* Bit 2 : Disable write access watch in region[1] */ +#define MWU_REGIONENCLR_RGN1WA_Pos (2UL) /*!< Position of RGN1WA field. */ +#define MWU_REGIONENCLR_RGN1WA_Msk (0x1UL << MWU_REGIONENCLR_RGN1WA_Pos) /*!< Bit mask of RGN1WA field. */ +#define MWU_REGIONENCLR_RGN1WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN1WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN1WA_Clear (1UL) /*!< Disable write access watch in this region */ + +/* Bit 1 : Disable read access watch in region[0] */ +#define MWU_REGIONENCLR_RGN0RA_Pos (1UL) /*!< Position of RGN0RA field. */ +#define MWU_REGIONENCLR_RGN0RA_Msk (0x1UL << MWU_REGIONENCLR_RGN0RA_Pos) /*!< Bit mask of RGN0RA field. */ +#define MWU_REGIONENCLR_RGN0RA_Disabled (0UL) /*!< Read access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN0RA_Enabled (1UL) /*!< Read access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN0RA_Clear (1UL) /*!< Disable read access watch in this region */ + +/* Bit 0 : Disable write access watch in region[0] */ +#define MWU_REGIONENCLR_RGN0WA_Pos (0UL) /*!< Position of RGN0WA field. */ +#define MWU_REGIONENCLR_RGN0WA_Msk (0x1UL << MWU_REGIONENCLR_RGN0WA_Pos) /*!< Bit mask of RGN0WA field. */ +#define MWU_REGIONENCLR_RGN0WA_Disabled (0UL) /*!< Write access watch in this region is disabled */ +#define MWU_REGIONENCLR_RGN0WA_Enabled (1UL) /*!< Write access watch in this region is enabled */ +#define MWU_REGIONENCLR_RGN0WA_Clear (1UL) /*!< Disable write access watch in this region */ + +/* Register: MWU_REGION_START */ +/* Description: Description cluster[0]: Start address for region 0 */ + +/* Bits 31..0 : Start address for region */ +#define MWU_REGION_START_START_Pos (0UL) /*!< Position of START field. */ +#define MWU_REGION_START_START_Msk (0xFFFFFFFFUL << MWU_REGION_START_START_Pos) /*!< Bit mask of START field. */ + +/* Register: MWU_REGION_END */ +/* Description: Description cluster[0]: End address of region 0 */ + +/* Bits 31..0 : End address of region. */ +#define MWU_REGION_END_END_Pos (0UL) /*!< Position of END field. */ +#define MWU_REGION_END_END_Msk (0xFFFFFFFFUL << MWU_REGION_END_END_Pos) /*!< Bit mask of END field. */ + +/* Register: MWU_PREGION_START */ +/* Description: Description cluster[0]: Reserved for future use */ + +/* Bits 31..0 : Reserved for future use */ +#define MWU_PREGION_START_START_Pos (0UL) /*!< Position of START field. */ +#define MWU_PREGION_START_START_Msk (0xFFFFFFFFUL << MWU_PREGION_START_START_Pos) /*!< Bit mask of START field. */ + +/* Register: MWU_PREGION_END */ +/* Description: Description cluster[0]: Reserved for future use */ + +/* Bits 31..0 : Reserved for future use */ +#define MWU_PREGION_END_END_Pos (0UL) /*!< Position of END field. */ +#define MWU_PREGION_END_END_Msk (0xFFFFFFFFUL << MWU_PREGION_END_END_Pos) /*!< Bit mask of END field. */ + +/* Register: MWU_PREGION_SUBS */ +/* Description: Description cluster[0]: Subregions of region 0 */ + +/* Bit 31 : Include or exclude subregion 31 in region */ +#define MWU_PREGION_SUBS_SR31_Pos (31UL) /*!< Position of SR31 field. */ +#define MWU_PREGION_SUBS_SR31_Msk (0x1UL << MWU_PREGION_SUBS_SR31_Pos) /*!< Bit mask of SR31 field. */ +#define MWU_PREGION_SUBS_SR31_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR31_Include (1UL) /*!< Include */ + +/* Bit 30 : Include or exclude subregion 30 in region */ +#define MWU_PREGION_SUBS_SR30_Pos (30UL) /*!< Position of SR30 field. */ +#define MWU_PREGION_SUBS_SR30_Msk (0x1UL << MWU_PREGION_SUBS_SR30_Pos) /*!< Bit mask of SR30 field. */ +#define MWU_PREGION_SUBS_SR30_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR30_Include (1UL) /*!< Include */ + +/* Bit 29 : Include or exclude subregion 29 in region */ +#define MWU_PREGION_SUBS_SR29_Pos (29UL) /*!< Position of SR29 field. */ +#define MWU_PREGION_SUBS_SR29_Msk (0x1UL << MWU_PREGION_SUBS_SR29_Pos) /*!< Bit mask of SR29 field. */ +#define MWU_PREGION_SUBS_SR29_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR29_Include (1UL) /*!< Include */ + +/* Bit 28 : Include or exclude subregion 28 in region */ +#define MWU_PREGION_SUBS_SR28_Pos (28UL) /*!< Position of SR28 field. */ +#define MWU_PREGION_SUBS_SR28_Msk (0x1UL << MWU_PREGION_SUBS_SR28_Pos) /*!< Bit mask of SR28 field. */ +#define MWU_PREGION_SUBS_SR28_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR28_Include (1UL) /*!< Include */ + +/* Bit 27 : Include or exclude subregion 27 in region */ +#define MWU_PREGION_SUBS_SR27_Pos (27UL) /*!< Position of SR27 field. */ +#define MWU_PREGION_SUBS_SR27_Msk (0x1UL << MWU_PREGION_SUBS_SR27_Pos) /*!< Bit mask of SR27 field. */ +#define MWU_PREGION_SUBS_SR27_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR27_Include (1UL) /*!< Include */ + +/* Bit 26 : Include or exclude subregion 26 in region */ +#define MWU_PREGION_SUBS_SR26_Pos (26UL) /*!< Position of SR26 field. */ +#define MWU_PREGION_SUBS_SR26_Msk (0x1UL << MWU_PREGION_SUBS_SR26_Pos) /*!< Bit mask of SR26 field. */ +#define MWU_PREGION_SUBS_SR26_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR26_Include (1UL) /*!< Include */ + +/* Bit 25 : Include or exclude subregion 25 in region */ +#define MWU_PREGION_SUBS_SR25_Pos (25UL) /*!< Position of SR25 field. */ +#define MWU_PREGION_SUBS_SR25_Msk (0x1UL << MWU_PREGION_SUBS_SR25_Pos) /*!< Bit mask of SR25 field. */ +#define MWU_PREGION_SUBS_SR25_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR25_Include (1UL) /*!< Include */ + +/* Bit 24 : Include or exclude subregion 24 in region */ +#define MWU_PREGION_SUBS_SR24_Pos (24UL) /*!< Position of SR24 field. */ +#define MWU_PREGION_SUBS_SR24_Msk (0x1UL << MWU_PREGION_SUBS_SR24_Pos) /*!< Bit mask of SR24 field. */ +#define MWU_PREGION_SUBS_SR24_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR24_Include (1UL) /*!< Include */ + +/* Bit 23 : Include or exclude subregion 23 in region */ +#define MWU_PREGION_SUBS_SR23_Pos (23UL) /*!< Position of SR23 field. */ +#define MWU_PREGION_SUBS_SR23_Msk (0x1UL << MWU_PREGION_SUBS_SR23_Pos) /*!< Bit mask of SR23 field. */ +#define MWU_PREGION_SUBS_SR23_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR23_Include (1UL) /*!< Include */ + +/* Bit 22 : Include or exclude subregion 22 in region */ +#define MWU_PREGION_SUBS_SR22_Pos (22UL) /*!< Position of SR22 field. */ +#define MWU_PREGION_SUBS_SR22_Msk (0x1UL << MWU_PREGION_SUBS_SR22_Pos) /*!< Bit mask of SR22 field. */ +#define MWU_PREGION_SUBS_SR22_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR22_Include (1UL) /*!< Include */ + +/* Bit 21 : Include or exclude subregion 21 in region */ +#define MWU_PREGION_SUBS_SR21_Pos (21UL) /*!< Position of SR21 field. */ +#define MWU_PREGION_SUBS_SR21_Msk (0x1UL << MWU_PREGION_SUBS_SR21_Pos) /*!< Bit mask of SR21 field. */ +#define MWU_PREGION_SUBS_SR21_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR21_Include (1UL) /*!< Include */ + +/* Bit 20 : Include or exclude subregion 20 in region */ +#define MWU_PREGION_SUBS_SR20_Pos (20UL) /*!< Position of SR20 field. */ +#define MWU_PREGION_SUBS_SR20_Msk (0x1UL << MWU_PREGION_SUBS_SR20_Pos) /*!< Bit mask of SR20 field. */ +#define MWU_PREGION_SUBS_SR20_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR20_Include (1UL) /*!< Include */ + +/* Bit 19 : Include or exclude subregion 19 in region */ +#define MWU_PREGION_SUBS_SR19_Pos (19UL) /*!< Position of SR19 field. */ +#define MWU_PREGION_SUBS_SR19_Msk (0x1UL << MWU_PREGION_SUBS_SR19_Pos) /*!< Bit mask of SR19 field. */ +#define MWU_PREGION_SUBS_SR19_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR19_Include (1UL) /*!< Include */ + +/* Bit 18 : Include or exclude subregion 18 in region */ +#define MWU_PREGION_SUBS_SR18_Pos (18UL) /*!< Position of SR18 field. */ +#define MWU_PREGION_SUBS_SR18_Msk (0x1UL << MWU_PREGION_SUBS_SR18_Pos) /*!< Bit mask of SR18 field. */ +#define MWU_PREGION_SUBS_SR18_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR18_Include (1UL) /*!< Include */ + +/* Bit 17 : Include or exclude subregion 17 in region */ +#define MWU_PREGION_SUBS_SR17_Pos (17UL) /*!< Position of SR17 field. */ +#define MWU_PREGION_SUBS_SR17_Msk (0x1UL << MWU_PREGION_SUBS_SR17_Pos) /*!< Bit mask of SR17 field. */ +#define MWU_PREGION_SUBS_SR17_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR17_Include (1UL) /*!< Include */ + +/* Bit 16 : Include or exclude subregion 16 in region */ +#define MWU_PREGION_SUBS_SR16_Pos (16UL) /*!< Position of SR16 field. */ +#define MWU_PREGION_SUBS_SR16_Msk (0x1UL << MWU_PREGION_SUBS_SR16_Pos) /*!< Bit mask of SR16 field. */ +#define MWU_PREGION_SUBS_SR16_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR16_Include (1UL) /*!< Include */ + +/* Bit 15 : Include or exclude subregion 15 in region */ +#define MWU_PREGION_SUBS_SR15_Pos (15UL) /*!< Position of SR15 field. */ +#define MWU_PREGION_SUBS_SR15_Msk (0x1UL << MWU_PREGION_SUBS_SR15_Pos) /*!< Bit mask of SR15 field. */ +#define MWU_PREGION_SUBS_SR15_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR15_Include (1UL) /*!< Include */ + +/* Bit 14 : Include or exclude subregion 14 in region */ +#define MWU_PREGION_SUBS_SR14_Pos (14UL) /*!< Position of SR14 field. */ +#define MWU_PREGION_SUBS_SR14_Msk (0x1UL << MWU_PREGION_SUBS_SR14_Pos) /*!< Bit mask of SR14 field. */ +#define MWU_PREGION_SUBS_SR14_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR14_Include (1UL) /*!< Include */ + +/* Bit 13 : Include or exclude subregion 13 in region */ +#define MWU_PREGION_SUBS_SR13_Pos (13UL) /*!< Position of SR13 field. */ +#define MWU_PREGION_SUBS_SR13_Msk (0x1UL << MWU_PREGION_SUBS_SR13_Pos) /*!< Bit mask of SR13 field. */ +#define MWU_PREGION_SUBS_SR13_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR13_Include (1UL) /*!< Include */ + +/* Bit 12 : Include or exclude subregion 12 in region */ +#define MWU_PREGION_SUBS_SR12_Pos (12UL) /*!< Position of SR12 field. */ +#define MWU_PREGION_SUBS_SR12_Msk (0x1UL << MWU_PREGION_SUBS_SR12_Pos) /*!< Bit mask of SR12 field. */ +#define MWU_PREGION_SUBS_SR12_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR12_Include (1UL) /*!< Include */ + +/* Bit 11 : Include or exclude subregion 11 in region */ +#define MWU_PREGION_SUBS_SR11_Pos (11UL) /*!< Position of SR11 field. */ +#define MWU_PREGION_SUBS_SR11_Msk (0x1UL << MWU_PREGION_SUBS_SR11_Pos) /*!< Bit mask of SR11 field. */ +#define MWU_PREGION_SUBS_SR11_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR11_Include (1UL) /*!< Include */ + +/* Bit 10 : Include or exclude subregion 10 in region */ +#define MWU_PREGION_SUBS_SR10_Pos (10UL) /*!< Position of SR10 field. */ +#define MWU_PREGION_SUBS_SR10_Msk (0x1UL << MWU_PREGION_SUBS_SR10_Pos) /*!< Bit mask of SR10 field. */ +#define MWU_PREGION_SUBS_SR10_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR10_Include (1UL) /*!< Include */ + +/* Bit 9 : Include or exclude subregion 9 in region */ +#define MWU_PREGION_SUBS_SR9_Pos (9UL) /*!< Position of SR9 field. */ +#define MWU_PREGION_SUBS_SR9_Msk (0x1UL << MWU_PREGION_SUBS_SR9_Pos) /*!< Bit mask of SR9 field. */ +#define MWU_PREGION_SUBS_SR9_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR9_Include (1UL) /*!< Include */ + +/* Bit 8 : Include or exclude subregion 8 in region */ +#define MWU_PREGION_SUBS_SR8_Pos (8UL) /*!< Position of SR8 field. */ +#define MWU_PREGION_SUBS_SR8_Msk (0x1UL << MWU_PREGION_SUBS_SR8_Pos) /*!< Bit mask of SR8 field. */ +#define MWU_PREGION_SUBS_SR8_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR8_Include (1UL) /*!< Include */ + +/* Bit 7 : Include or exclude subregion 7 in region */ +#define MWU_PREGION_SUBS_SR7_Pos (7UL) /*!< Position of SR7 field. */ +#define MWU_PREGION_SUBS_SR7_Msk (0x1UL << MWU_PREGION_SUBS_SR7_Pos) /*!< Bit mask of SR7 field. */ +#define MWU_PREGION_SUBS_SR7_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR7_Include (1UL) /*!< Include */ + +/* Bit 6 : Include or exclude subregion 6 in region */ +#define MWU_PREGION_SUBS_SR6_Pos (6UL) /*!< Position of SR6 field. */ +#define MWU_PREGION_SUBS_SR6_Msk (0x1UL << MWU_PREGION_SUBS_SR6_Pos) /*!< Bit mask of SR6 field. */ +#define MWU_PREGION_SUBS_SR6_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR6_Include (1UL) /*!< Include */ + +/* Bit 5 : Include or exclude subregion 5 in region */ +#define MWU_PREGION_SUBS_SR5_Pos (5UL) /*!< Position of SR5 field. */ +#define MWU_PREGION_SUBS_SR5_Msk (0x1UL << MWU_PREGION_SUBS_SR5_Pos) /*!< Bit mask of SR5 field. */ +#define MWU_PREGION_SUBS_SR5_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR5_Include (1UL) /*!< Include */ + +/* Bit 4 : Include or exclude subregion 4 in region */ +#define MWU_PREGION_SUBS_SR4_Pos (4UL) /*!< Position of SR4 field. */ +#define MWU_PREGION_SUBS_SR4_Msk (0x1UL << MWU_PREGION_SUBS_SR4_Pos) /*!< Bit mask of SR4 field. */ +#define MWU_PREGION_SUBS_SR4_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR4_Include (1UL) /*!< Include */ + +/* Bit 3 : Include or exclude subregion 3 in region */ +#define MWU_PREGION_SUBS_SR3_Pos (3UL) /*!< Position of SR3 field. */ +#define MWU_PREGION_SUBS_SR3_Msk (0x1UL << MWU_PREGION_SUBS_SR3_Pos) /*!< Bit mask of SR3 field. */ +#define MWU_PREGION_SUBS_SR3_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR3_Include (1UL) /*!< Include */ + +/* Bit 2 : Include or exclude subregion 2 in region */ +#define MWU_PREGION_SUBS_SR2_Pos (2UL) /*!< Position of SR2 field. */ +#define MWU_PREGION_SUBS_SR2_Msk (0x1UL << MWU_PREGION_SUBS_SR2_Pos) /*!< Bit mask of SR2 field. */ +#define MWU_PREGION_SUBS_SR2_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR2_Include (1UL) /*!< Include */ + +/* Bit 1 : Include or exclude subregion 1 in region */ +#define MWU_PREGION_SUBS_SR1_Pos (1UL) /*!< Position of SR1 field. */ +#define MWU_PREGION_SUBS_SR1_Msk (0x1UL << MWU_PREGION_SUBS_SR1_Pos) /*!< Bit mask of SR1 field. */ +#define MWU_PREGION_SUBS_SR1_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR1_Include (1UL) /*!< Include */ + +/* Bit 0 : Include or exclude subregion 0 in region */ +#define MWU_PREGION_SUBS_SR0_Pos (0UL) /*!< Position of SR0 field. */ +#define MWU_PREGION_SUBS_SR0_Msk (0x1UL << MWU_PREGION_SUBS_SR0_Pos) /*!< Bit mask of SR0 field. */ +#define MWU_PREGION_SUBS_SR0_Exclude (0UL) /*!< Exclude */ +#define MWU_PREGION_SUBS_SR0_Include (1UL) /*!< Include */ + + +/* Peripheral: NFCT */ +/* Description: NFC-A compatible radio */ + +/* Register: NFCT_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 5 : Shortcut between TXFRAMEEND event and ENABLERXDATA task */ +#define NFCT_SHORTS_TXFRAMEEND_ENABLERXDATA_Pos (5UL) /*!< Position of TXFRAMEEND_ENABLERXDATA field. */ +#define NFCT_SHORTS_TXFRAMEEND_ENABLERXDATA_Msk (0x1UL << NFCT_SHORTS_TXFRAMEEND_ENABLERXDATA_Pos) /*!< Bit mask of TXFRAMEEND_ENABLERXDATA field. */ +#define NFCT_SHORTS_TXFRAMEEND_ENABLERXDATA_Disabled (0UL) /*!< Disable shortcut */ +#define NFCT_SHORTS_TXFRAMEEND_ENABLERXDATA_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between FIELDLOST event and SENSE task */ +#define NFCT_SHORTS_FIELDLOST_SENSE_Pos (1UL) /*!< Position of FIELDLOST_SENSE field. */ +#define NFCT_SHORTS_FIELDLOST_SENSE_Msk (0x1UL << NFCT_SHORTS_FIELDLOST_SENSE_Pos) /*!< Bit mask of FIELDLOST_SENSE field. */ +#define NFCT_SHORTS_FIELDLOST_SENSE_Disabled (0UL) /*!< Disable shortcut */ +#define NFCT_SHORTS_FIELDLOST_SENSE_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between FIELDDETECTED event and ACTIVATE task */ +#define NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Pos (0UL) /*!< Position of FIELDDETECTED_ACTIVATE field. */ +#define NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Msk (0x1UL << NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Pos) /*!< Bit mask of FIELDDETECTED_ACTIVATE field. */ +#define NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Disabled (0UL) /*!< Disable shortcut */ +#define NFCT_SHORTS_FIELDDETECTED_ACTIVATE_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: NFCT_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 20 : Enable or disable interrupt for STARTED event */ +#define NFCT_INTEN_STARTED_Pos (20UL) /*!< Position of STARTED field. */ +#define NFCT_INTEN_STARTED_Msk (0x1UL << NFCT_INTEN_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define NFCT_INTEN_STARTED_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_STARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for SELECTED event */ +#define NFCT_INTEN_SELECTED_Pos (19UL) /*!< Position of SELECTED field. */ +#define NFCT_INTEN_SELECTED_Msk (0x1UL << NFCT_INTEN_SELECTED_Pos) /*!< Bit mask of SELECTED field. */ +#define NFCT_INTEN_SELECTED_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_SELECTED_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable interrupt for COLLISION event */ +#define NFCT_INTEN_COLLISION_Pos (18UL) /*!< Position of COLLISION field. */ +#define NFCT_INTEN_COLLISION_Msk (0x1UL << NFCT_INTEN_COLLISION_Pos) /*!< Bit mask of COLLISION field. */ +#define NFCT_INTEN_COLLISION_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_COLLISION_Enabled (1UL) /*!< Enable */ + +/* Bit 14 : Enable or disable interrupt for AUTOCOLRESSTARTED event */ +#define NFCT_INTEN_AUTOCOLRESSTARTED_Pos (14UL) /*!< Position of AUTOCOLRESSTARTED field. */ +#define NFCT_INTEN_AUTOCOLRESSTARTED_Msk (0x1UL << NFCT_INTEN_AUTOCOLRESSTARTED_Pos) /*!< Bit mask of AUTOCOLRESSTARTED field. */ +#define NFCT_INTEN_AUTOCOLRESSTARTED_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_AUTOCOLRESSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 12 : Enable or disable interrupt for ENDTX event */ +#define NFCT_INTEN_ENDTX_Pos (12UL) /*!< Position of ENDTX field. */ +#define NFCT_INTEN_ENDTX_Msk (0x1UL << NFCT_INTEN_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define NFCT_INTEN_ENDTX_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_ENDTX_Enabled (1UL) /*!< Enable */ + +/* Bit 11 : Enable or disable interrupt for ENDRX event */ +#define NFCT_INTEN_ENDRX_Pos (11UL) /*!< Position of ENDRX field. */ +#define NFCT_INTEN_ENDRX_Msk (0x1UL << NFCT_INTEN_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define NFCT_INTEN_ENDRX_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_ENDRX_Enabled (1UL) /*!< Enable */ + +/* Bit 10 : Enable or disable interrupt for RXERROR event */ +#define NFCT_INTEN_RXERROR_Pos (10UL) /*!< Position of RXERROR field. */ +#define NFCT_INTEN_RXERROR_Msk (0x1UL << NFCT_INTEN_RXERROR_Pos) /*!< Bit mask of RXERROR field. */ +#define NFCT_INTEN_RXERROR_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_RXERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for ERROR event */ +#define NFCT_INTEN_ERROR_Pos (7UL) /*!< Position of ERROR field. */ +#define NFCT_INTEN_ERROR_Msk (0x1UL << NFCT_INTEN_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define NFCT_INTEN_ERROR_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_ERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for RXFRAMEEND event */ +#define NFCT_INTEN_RXFRAMEEND_Pos (6UL) /*!< Position of RXFRAMEEND field. */ +#define NFCT_INTEN_RXFRAMEEND_Msk (0x1UL << NFCT_INTEN_RXFRAMEEND_Pos) /*!< Bit mask of RXFRAMEEND field. */ +#define NFCT_INTEN_RXFRAMEEND_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_RXFRAMEEND_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for RXFRAMESTART event */ +#define NFCT_INTEN_RXFRAMESTART_Pos (5UL) /*!< Position of RXFRAMESTART field. */ +#define NFCT_INTEN_RXFRAMESTART_Msk (0x1UL << NFCT_INTEN_RXFRAMESTART_Pos) /*!< Bit mask of RXFRAMESTART field. */ +#define NFCT_INTEN_RXFRAMESTART_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_RXFRAMESTART_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for TXFRAMEEND event */ +#define NFCT_INTEN_TXFRAMEEND_Pos (4UL) /*!< Position of TXFRAMEEND field. */ +#define NFCT_INTEN_TXFRAMEEND_Msk (0x1UL << NFCT_INTEN_TXFRAMEEND_Pos) /*!< Bit mask of TXFRAMEEND field. */ +#define NFCT_INTEN_TXFRAMEEND_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_TXFRAMEEND_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for TXFRAMESTART event */ +#define NFCT_INTEN_TXFRAMESTART_Pos (3UL) /*!< Position of TXFRAMESTART field. */ +#define NFCT_INTEN_TXFRAMESTART_Msk (0x1UL << NFCT_INTEN_TXFRAMESTART_Pos) /*!< Bit mask of TXFRAMESTART field. */ +#define NFCT_INTEN_TXFRAMESTART_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_TXFRAMESTART_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for FIELDLOST event */ +#define NFCT_INTEN_FIELDLOST_Pos (2UL) /*!< Position of FIELDLOST field. */ +#define NFCT_INTEN_FIELDLOST_Msk (0x1UL << NFCT_INTEN_FIELDLOST_Pos) /*!< Bit mask of FIELDLOST field. */ +#define NFCT_INTEN_FIELDLOST_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_FIELDLOST_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for FIELDDETECTED event */ +#define NFCT_INTEN_FIELDDETECTED_Pos (1UL) /*!< Position of FIELDDETECTED field. */ +#define NFCT_INTEN_FIELDDETECTED_Msk (0x1UL << NFCT_INTEN_FIELDDETECTED_Pos) /*!< Bit mask of FIELDDETECTED field. */ +#define NFCT_INTEN_FIELDDETECTED_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_FIELDDETECTED_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for READY event */ +#define NFCT_INTEN_READY_Pos (0UL) /*!< Position of READY field. */ +#define NFCT_INTEN_READY_Msk (0x1UL << NFCT_INTEN_READY_Pos) /*!< Bit mask of READY field. */ +#define NFCT_INTEN_READY_Disabled (0UL) /*!< Disable */ +#define NFCT_INTEN_READY_Enabled (1UL) /*!< Enable */ + +/* Register: NFCT_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 20 : Write '1' to Enable interrupt for STARTED event */ +#define NFCT_INTENSET_STARTED_Pos (20UL) /*!< Position of STARTED field. */ +#define NFCT_INTENSET_STARTED_Msk (0x1UL << NFCT_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define NFCT_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for SELECTED event */ +#define NFCT_INTENSET_SELECTED_Pos (19UL) /*!< Position of SELECTED field. */ +#define NFCT_INTENSET_SELECTED_Msk (0x1UL << NFCT_INTENSET_SELECTED_Pos) /*!< Bit mask of SELECTED field. */ +#define NFCT_INTENSET_SELECTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_SELECTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_SELECTED_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for COLLISION event */ +#define NFCT_INTENSET_COLLISION_Pos (18UL) /*!< Position of COLLISION field. */ +#define NFCT_INTENSET_COLLISION_Msk (0x1UL << NFCT_INTENSET_COLLISION_Pos) /*!< Bit mask of COLLISION field. */ +#define NFCT_INTENSET_COLLISION_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_COLLISION_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_COLLISION_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for AUTOCOLRESSTARTED event */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Pos (14UL) /*!< Position of AUTOCOLRESSTARTED field. */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Msk (0x1UL << NFCT_INTENSET_AUTOCOLRESSTARTED_Pos) /*!< Bit mask of AUTOCOLRESSTARTED field. */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_AUTOCOLRESSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for ENDTX event */ +#define NFCT_INTENSET_ENDTX_Pos (12UL) /*!< Position of ENDTX field. */ +#define NFCT_INTENSET_ENDTX_Msk (0x1UL << NFCT_INTENSET_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define NFCT_INTENSET_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_ENDTX_Set (1UL) /*!< Enable */ + +/* Bit 11 : Write '1' to Enable interrupt for ENDRX event */ +#define NFCT_INTENSET_ENDRX_Pos (11UL) /*!< Position of ENDRX field. */ +#define NFCT_INTENSET_ENDRX_Msk (0x1UL << NFCT_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define NFCT_INTENSET_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_ENDRX_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for RXERROR event */ +#define NFCT_INTENSET_RXERROR_Pos (10UL) /*!< Position of RXERROR field. */ +#define NFCT_INTENSET_RXERROR_Msk (0x1UL << NFCT_INTENSET_RXERROR_Pos) /*!< Bit mask of RXERROR field. */ +#define NFCT_INTENSET_RXERROR_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_RXERROR_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_RXERROR_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for ERROR event */ +#define NFCT_INTENSET_ERROR_Pos (7UL) /*!< Position of ERROR field. */ +#define NFCT_INTENSET_ERROR_Msk (0x1UL << NFCT_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define NFCT_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for RXFRAMEEND event */ +#define NFCT_INTENSET_RXFRAMEEND_Pos (6UL) /*!< Position of RXFRAMEEND field. */ +#define NFCT_INTENSET_RXFRAMEEND_Msk (0x1UL << NFCT_INTENSET_RXFRAMEEND_Pos) /*!< Bit mask of RXFRAMEEND field. */ +#define NFCT_INTENSET_RXFRAMEEND_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_RXFRAMEEND_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_RXFRAMEEND_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for RXFRAMESTART event */ +#define NFCT_INTENSET_RXFRAMESTART_Pos (5UL) /*!< Position of RXFRAMESTART field. */ +#define NFCT_INTENSET_RXFRAMESTART_Msk (0x1UL << NFCT_INTENSET_RXFRAMESTART_Pos) /*!< Bit mask of RXFRAMESTART field. */ +#define NFCT_INTENSET_RXFRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_RXFRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_RXFRAMESTART_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for TXFRAMEEND event */ +#define NFCT_INTENSET_TXFRAMEEND_Pos (4UL) /*!< Position of TXFRAMEEND field. */ +#define NFCT_INTENSET_TXFRAMEEND_Msk (0x1UL << NFCT_INTENSET_TXFRAMEEND_Pos) /*!< Bit mask of TXFRAMEEND field. */ +#define NFCT_INTENSET_TXFRAMEEND_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_TXFRAMEEND_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_TXFRAMEEND_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for TXFRAMESTART event */ +#define NFCT_INTENSET_TXFRAMESTART_Pos (3UL) /*!< Position of TXFRAMESTART field. */ +#define NFCT_INTENSET_TXFRAMESTART_Msk (0x1UL << NFCT_INTENSET_TXFRAMESTART_Pos) /*!< Bit mask of TXFRAMESTART field. */ +#define NFCT_INTENSET_TXFRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_TXFRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_TXFRAMESTART_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for FIELDLOST event */ +#define NFCT_INTENSET_FIELDLOST_Pos (2UL) /*!< Position of FIELDLOST field. */ +#define NFCT_INTENSET_FIELDLOST_Msk (0x1UL << NFCT_INTENSET_FIELDLOST_Pos) /*!< Bit mask of FIELDLOST field. */ +#define NFCT_INTENSET_FIELDLOST_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_FIELDLOST_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_FIELDLOST_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for FIELDDETECTED event */ +#define NFCT_INTENSET_FIELDDETECTED_Pos (1UL) /*!< Position of FIELDDETECTED field. */ +#define NFCT_INTENSET_FIELDDETECTED_Msk (0x1UL << NFCT_INTENSET_FIELDDETECTED_Pos) /*!< Bit mask of FIELDDETECTED field. */ +#define NFCT_INTENSET_FIELDDETECTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_FIELDDETECTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_FIELDDETECTED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define NFCT_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define NFCT_INTENSET_READY_Msk (0x1UL << NFCT_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define NFCT_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: NFCT_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 20 : Write '1' to Disable interrupt for STARTED event */ +#define NFCT_INTENCLR_STARTED_Pos (20UL) /*!< Position of STARTED field. */ +#define NFCT_INTENCLR_STARTED_Msk (0x1UL << NFCT_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define NFCT_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for SELECTED event */ +#define NFCT_INTENCLR_SELECTED_Pos (19UL) /*!< Position of SELECTED field. */ +#define NFCT_INTENCLR_SELECTED_Msk (0x1UL << NFCT_INTENCLR_SELECTED_Pos) /*!< Bit mask of SELECTED field. */ +#define NFCT_INTENCLR_SELECTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_SELECTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_SELECTED_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for COLLISION event */ +#define NFCT_INTENCLR_COLLISION_Pos (18UL) /*!< Position of COLLISION field. */ +#define NFCT_INTENCLR_COLLISION_Msk (0x1UL << NFCT_INTENCLR_COLLISION_Pos) /*!< Bit mask of COLLISION field. */ +#define NFCT_INTENCLR_COLLISION_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_COLLISION_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_COLLISION_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for AUTOCOLRESSTARTED event */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Pos (14UL) /*!< Position of AUTOCOLRESSTARTED field. */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Msk (0x1UL << NFCT_INTENCLR_AUTOCOLRESSTARTED_Pos) /*!< Bit mask of AUTOCOLRESSTARTED field. */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_AUTOCOLRESSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for ENDTX event */ +#define NFCT_INTENCLR_ENDTX_Pos (12UL) /*!< Position of ENDTX field. */ +#define NFCT_INTENCLR_ENDTX_Msk (0x1UL << NFCT_INTENCLR_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define NFCT_INTENCLR_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_ENDTX_Clear (1UL) /*!< Disable */ + +/* Bit 11 : Write '1' to Disable interrupt for ENDRX event */ +#define NFCT_INTENCLR_ENDRX_Pos (11UL) /*!< Position of ENDRX field. */ +#define NFCT_INTENCLR_ENDRX_Msk (0x1UL << NFCT_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define NFCT_INTENCLR_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for RXERROR event */ +#define NFCT_INTENCLR_RXERROR_Pos (10UL) /*!< Position of RXERROR field. */ +#define NFCT_INTENCLR_RXERROR_Msk (0x1UL << NFCT_INTENCLR_RXERROR_Pos) /*!< Bit mask of RXERROR field. */ +#define NFCT_INTENCLR_RXERROR_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_RXERROR_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_RXERROR_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for ERROR event */ +#define NFCT_INTENCLR_ERROR_Pos (7UL) /*!< Position of ERROR field. */ +#define NFCT_INTENCLR_ERROR_Msk (0x1UL << NFCT_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define NFCT_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for RXFRAMEEND event */ +#define NFCT_INTENCLR_RXFRAMEEND_Pos (6UL) /*!< Position of RXFRAMEEND field. */ +#define NFCT_INTENCLR_RXFRAMEEND_Msk (0x1UL << NFCT_INTENCLR_RXFRAMEEND_Pos) /*!< Bit mask of RXFRAMEEND field. */ +#define NFCT_INTENCLR_RXFRAMEEND_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_RXFRAMEEND_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_RXFRAMEEND_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for RXFRAMESTART event */ +#define NFCT_INTENCLR_RXFRAMESTART_Pos (5UL) /*!< Position of RXFRAMESTART field. */ +#define NFCT_INTENCLR_RXFRAMESTART_Msk (0x1UL << NFCT_INTENCLR_RXFRAMESTART_Pos) /*!< Bit mask of RXFRAMESTART field. */ +#define NFCT_INTENCLR_RXFRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_RXFRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_RXFRAMESTART_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for TXFRAMEEND event */ +#define NFCT_INTENCLR_TXFRAMEEND_Pos (4UL) /*!< Position of TXFRAMEEND field. */ +#define NFCT_INTENCLR_TXFRAMEEND_Msk (0x1UL << NFCT_INTENCLR_TXFRAMEEND_Pos) /*!< Bit mask of TXFRAMEEND field. */ +#define NFCT_INTENCLR_TXFRAMEEND_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_TXFRAMEEND_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_TXFRAMEEND_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for TXFRAMESTART event */ +#define NFCT_INTENCLR_TXFRAMESTART_Pos (3UL) /*!< Position of TXFRAMESTART field. */ +#define NFCT_INTENCLR_TXFRAMESTART_Msk (0x1UL << NFCT_INTENCLR_TXFRAMESTART_Pos) /*!< Bit mask of TXFRAMESTART field. */ +#define NFCT_INTENCLR_TXFRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_TXFRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_TXFRAMESTART_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for FIELDLOST event */ +#define NFCT_INTENCLR_FIELDLOST_Pos (2UL) /*!< Position of FIELDLOST field. */ +#define NFCT_INTENCLR_FIELDLOST_Msk (0x1UL << NFCT_INTENCLR_FIELDLOST_Pos) /*!< Bit mask of FIELDLOST field. */ +#define NFCT_INTENCLR_FIELDLOST_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_FIELDLOST_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_FIELDLOST_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for FIELDDETECTED event */ +#define NFCT_INTENCLR_FIELDDETECTED_Pos (1UL) /*!< Position of FIELDDETECTED field. */ +#define NFCT_INTENCLR_FIELDDETECTED_Msk (0x1UL << NFCT_INTENCLR_FIELDDETECTED_Pos) /*!< Bit mask of FIELDDETECTED field. */ +#define NFCT_INTENCLR_FIELDDETECTED_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_FIELDDETECTED_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_FIELDDETECTED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define NFCT_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define NFCT_INTENCLR_READY_Msk (0x1UL << NFCT_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define NFCT_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define NFCT_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define NFCT_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: NFCT_ERRORSTATUS */ +/* Description: NFC Error Status register */ + +/* Bit 0 : No STARTTX task triggered before expiration of the time set in FRAMEDELAYMAX */ +#define NFCT_ERRORSTATUS_FRAMEDELAYTIMEOUT_Pos (0UL) /*!< Position of FRAMEDELAYTIMEOUT field. */ +#define NFCT_ERRORSTATUS_FRAMEDELAYTIMEOUT_Msk (0x1UL << NFCT_ERRORSTATUS_FRAMEDELAYTIMEOUT_Pos) /*!< Bit mask of FRAMEDELAYTIMEOUT field. */ + +/* Register: NFCT_FRAMESTATUS_RX */ +/* Description: Result of last incoming frame */ + +/* Bit 3 : Overrun detected */ +#define NFCT_FRAMESTATUS_RX_OVERRUN_Pos (3UL) /*!< Position of OVERRUN field. */ +#define NFCT_FRAMESTATUS_RX_OVERRUN_Msk (0x1UL << NFCT_FRAMESTATUS_RX_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define NFCT_FRAMESTATUS_RX_OVERRUN_NoOverrun (0UL) /*!< No overrun detected */ +#define NFCT_FRAMESTATUS_RX_OVERRUN_Overrun (1UL) /*!< Overrun error */ + +/* Bit 2 : Parity status of received frame */ +#define NFCT_FRAMESTATUS_RX_PARITYSTATUS_Pos (2UL) /*!< Position of PARITYSTATUS field. */ +#define NFCT_FRAMESTATUS_RX_PARITYSTATUS_Msk (0x1UL << NFCT_FRAMESTATUS_RX_PARITYSTATUS_Pos) /*!< Bit mask of PARITYSTATUS field. */ +#define NFCT_FRAMESTATUS_RX_PARITYSTATUS_ParityOK (0UL) /*!< Frame received with parity OK */ +#define NFCT_FRAMESTATUS_RX_PARITYSTATUS_ParityError (1UL) /*!< Frame received with parity error */ + +/* Bit 0 : No valid end of frame (EoF) detected */ +#define NFCT_FRAMESTATUS_RX_CRCERROR_Pos (0UL) /*!< Position of CRCERROR field. */ +#define NFCT_FRAMESTATUS_RX_CRCERROR_Msk (0x1UL << NFCT_FRAMESTATUS_RX_CRCERROR_Pos) /*!< Bit mask of CRCERROR field. */ +#define NFCT_FRAMESTATUS_RX_CRCERROR_CRCCorrect (0UL) /*!< Valid CRC detected */ +#define NFCT_FRAMESTATUS_RX_CRCERROR_CRCError (1UL) /*!< CRC received does not match local check */ + +/* Register: NFCT_NFCTAGSTATE */ +/* Description: NfcTag state register */ + +/* Bits 2..0 : NfcTag state */ +#define NFCT_NFCTAGSTATE_NFCTAGSTATE_Pos (0UL) /*!< Position of NFCTAGSTATE field. */ +#define NFCT_NFCTAGSTATE_NFCTAGSTATE_Msk (0x7UL << NFCT_NFCTAGSTATE_NFCTAGSTATE_Pos) /*!< Bit mask of NFCTAGSTATE field. */ +#define NFCT_NFCTAGSTATE_NFCTAGSTATE_Disabled (0UL) /*!< Disabled or sense */ +#define NFCT_NFCTAGSTATE_NFCTAGSTATE_RampUp (2UL) /*!< RampUp */ +#define NFCT_NFCTAGSTATE_NFCTAGSTATE_Idle (3UL) /*!< Idle */ +#define NFCT_NFCTAGSTATE_NFCTAGSTATE_Receive (4UL) /*!< Receive */ +#define NFCT_NFCTAGSTATE_NFCTAGSTATE_FrameDelay (5UL) /*!< FrameDelay */ +#define NFCT_NFCTAGSTATE_NFCTAGSTATE_Transmit (6UL) /*!< Transmit */ + +/* Register: NFCT_FIELDPRESENT */ +/* Description: Indicates the presence or not of a valid field */ + +/* Bit 1 : Indicates if the low level has locked to the field */ +#define NFCT_FIELDPRESENT_LOCKDETECT_Pos (1UL) /*!< Position of LOCKDETECT field. */ +#define NFCT_FIELDPRESENT_LOCKDETECT_Msk (0x1UL << NFCT_FIELDPRESENT_LOCKDETECT_Pos) /*!< Bit mask of LOCKDETECT field. */ +#define NFCT_FIELDPRESENT_LOCKDETECT_NotLocked (0UL) /*!< Not locked to field */ +#define NFCT_FIELDPRESENT_LOCKDETECT_Locked (1UL) /*!< Locked to field */ + +/* Bit 0 : Indicates if a valid field is present. Available only in the activated state. */ +#define NFCT_FIELDPRESENT_FIELDPRESENT_Pos (0UL) /*!< Position of FIELDPRESENT field. */ +#define NFCT_FIELDPRESENT_FIELDPRESENT_Msk (0x1UL << NFCT_FIELDPRESENT_FIELDPRESENT_Pos) /*!< Bit mask of FIELDPRESENT field. */ +#define NFCT_FIELDPRESENT_FIELDPRESENT_NoField (0UL) /*!< No valid field detected */ +#define NFCT_FIELDPRESENT_FIELDPRESENT_FieldPresent (1UL) /*!< Valid field detected */ + +/* Register: NFCT_FRAMEDELAYMIN */ +/* Description: Minimum frame delay */ + +/* Bits 15..0 : Minimum frame delay in number of 13.56 MHz clocks */ +#define NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Pos (0UL) /*!< Position of FRAMEDELAYMIN field. */ +#define NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Msk (0xFFFFUL << NFCT_FRAMEDELAYMIN_FRAMEDELAYMIN_Pos) /*!< Bit mask of FRAMEDELAYMIN field. */ + +/* Register: NFCT_FRAMEDELAYMAX */ +/* Description: Maximum frame delay */ + +/* Bits 15..0 : Maximum frame delay in number of 13.56 MHz clocks */ +#define NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Pos (0UL) /*!< Position of FRAMEDELAYMAX field. */ +#define NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Msk (0xFFFFUL << NFCT_FRAMEDELAYMAX_FRAMEDELAYMAX_Pos) /*!< Bit mask of FRAMEDELAYMAX field. */ + +/* Register: NFCT_FRAMEDELAYMODE */ +/* Description: Configuration register for the Frame Delay Timer */ + +/* Bits 1..0 : Configuration register for the Frame Delay Timer */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Pos (0UL) /*!< Position of FRAMEDELAYMODE field. */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Msk (0x3UL << NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Pos) /*!< Bit mask of FRAMEDELAYMODE field. */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_FreeRun (0UL) /*!< Transmission is independent of frame timer and will start when the STARTTX task is triggered. No timeout. */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_Window (1UL) /*!< Frame is transmitted between FRAMEDELAYMIN and FRAMEDELAYMAX */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_ExactVal (2UL) /*!< Frame is transmitted exactly at FRAMEDELAYMAX */ +#define NFCT_FRAMEDELAYMODE_FRAMEDELAYMODE_WindowGrid (3UL) /*!< Frame is transmitted on a bit grid between FRAMEDELAYMIN and FRAMEDELAYMAX */ + +/* Register: NFCT_PACKETPTR */ +/* Description: Packet pointer for TXD and RXD data storage in Data RAM */ + +/* Bits 31..0 : Packet pointer for TXD and RXD data storage in Data RAM. This address is a byte-aligned RAM address. */ +#define NFCT_PACKETPTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define NFCT_PACKETPTR_PTR_Msk (0xFFFFFFFFUL << NFCT_PACKETPTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: NFCT_MAXLEN */ +/* Description: Size of the RAM buffer allocated to TXD and RXD data storage each */ + +/* Bits 8..0 : Size of the RAM buffer allocated to TXD and RXD data storage each */ +#define NFCT_MAXLEN_MAXLEN_Pos (0UL) /*!< Position of MAXLEN field. */ +#define NFCT_MAXLEN_MAXLEN_Msk (0x1FFUL << NFCT_MAXLEN_MAXLEN_Pos) /*!< Bit mask of MAXLEN field. */ + +/* Register: NFCT_TXD_FRAMECONFIG */ +/* Description: Configuration of outgoing frames */ + +/* Bit 4 : CRC mode for outgoing frames */ +#define NFCT_TXD_FRAMECONFIG_CRCMODETX_Pos (4UL) /*!< Position of CRCMODETX field. */ +#define NFCT_TXD_FRAMECONFIG_CRCMODETX_Msk (0x1UL << NFCT_TXD_FRAMECONFIG_CRCMODETX_Pos) /*!< Bit mask of CRCMODETX field. */ +#define NFCT_TXD_FRAMECONFIG_CRCMODETX_NoCRCTX (0UL) /*!< CRC is not added to the frame */ +#define NFCT_TXD_FRAMECONFIG_CRCMODETX_CRC16TX (1UL) /*!< 16 bit CRC added to the frame based on all the data read from RAM that is used in the frame */ + +/* Bit 2 : Adding SoF or not in TX frames */ +#define NFCT_TXD_FRAMECONFIG_SOF_Pos (2UL) /*!< Position of SOF field. */ +#define NFCT_TXD_FRAMECONFIG_SOF_Msk (0x1UL << NFCT_TXD_FRAMECONFIG_SOF_Pos) /*!< Bit mask of SOF field. */ +#define NFCT_TXD_FRAMECONFIG_SOF_NoSoF (0UL) /*!< SoF symbol not added */ +#define NFCT_TXD_FRAMECONFIG_SOF_SoF (1UL) /*!< SoF symbol added */ + +/* Bit 1 : Discarding unused bits at start or end of a frame */ +#define NFCT_TXD_FRAMECONFIG_DISCARDMODE_Pos (1UL) /*!< Position of DISCARDMODE field. */ +#define NFCT_TXD_FRAMECONFIG_DISCARDMODE_Msk (0x1UL << NFCT_TXD_FRAMECONFIG_DISCARDMODE_Pos) /*!< Bit mask of DISCARDMODE field. */ +#define NFCT_TXD_FRAMECONFIG_DISCARDMODE_DiscardEnd (0UL) /*!< Unused bits are discarded at end of frame (EoF) */ +#define NFCT_TXD_FRAMECONFIG_DISCARDMODE_DiscardStart (1UL) /*!< Unused bits are discarded at start of frame (SoF) */ + +/* Bit 0 : Indicates if parity is added to the frame */ +#define NFCT_TXD_FRAMECONFIG_PARITY_Pos (0UL) /*!< Position of PARITY field. */ +#define NFCT_TXD_FRAMECONFIG_PARITY_Msk (0x1UL << NFCT_TXD_FRAMECONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define NFCT_TXD_FRAMECONFIG_PARITY_NoParity (0UL) /*!< Parity is not added to TX frames */ +#define NFCT_TXD_FRAMECONFIG_PARITY_Parity (1UL) /*!< Parity is added to TX frames */ + +/* Register: NFCT_TXD_AMOUNT */ +/* Description: Size of outgoing frame */ + +/* Bits 11..3 : Number of complete bytes that shall be included in the frame, excluding CRC, parity and framing */ +#define NFCT_TXD_AMOUNT_TXDATABYTES_Pos (3UL) /*!< Position of TXDATABYTES field. */ +#define NFCT_TXD_AMOUNT_TXDATABYTES_Msk (0x1FFUL << NFCT_TXD_AMOUNT_TXDATABYTES_Pos) /*!< Bit mask of TXDATABYTES field. */ + +/* Bits 2..0 : Number of bits in the last or first byte read from RAM that shall be included in the frame (excluding parity bit). */ +#define NFCT_TXD_AMOUNT_TXDATABITS_Pos (0UL) /*!< Position of TXDATABITS field. */ +#define NFCT_TXD_AMOUNT_TXDATABITS_Msk (0x7UL << NFCT_TXD_AMOUNT_TXDATABITS_Pos) /*!< Bit mask of TXDATABITS field. */ + +/* Register: NFCT_RXD_FRAMECONFIG */ +/* Description: Configuration of incoming frames */ + +/* Bit 4 : CRC mode for incoming frames */ +#define NFCT_RXD_FRAMECONFIG_CRCMODERX_Pos (4UL) /*!< Position of CRCMODERX field. */ +#define NFCT_RXD_FRAMECONFIG_CRCMODERX_Msk (0x1UL << NFCT_RXD_FRAMECONFIG_CRCMODERX_Pos) /*!< Bit mask of CRCMODERX field. */ +#define NFCT_RXD_FRAMECONFIG_CRCMODERX_NoCRCRX (0UL) /*!< CRC is not expected in RX frames */ +#define NFCT_RXD_FRAMECONFIG_CRCMODERX_CRC16RX (1UL) /*!< Last 16 bits in RX frame is CRC, CRC is checked and CRCSTATUS updated */ + +/* Bit 2 : SoF expected or not in RX frames */ +#define NFCT_RXD_FRAMECONFIG_SOF_Pos (2UL) /*!< Position of SOF field. */ +#define NFCT_RXD_FRAMECONFIG_SOF_Msk (0x1UL << NFCT_RXD_FRAMECONFIG_SOF_Pos) /*!< Bit mask of SOF field. */ +#define NFCT_RXD_FRAMECONFIG_SOF_NoSoF (0UL) /*!< SoF symbol is not expected in RX frames */ +#define NFCT_RXD_FRAMECONFIG_SOF_SoF (1UL) /*!< SoF symbol is expected in RX frames */ + +/* Bit 0 : Indicates if parity expected in RX frame */ +#define NFCT_RXD_FRAMECONFIG_PARITY_Pos (0UL) /*!< Position of PARITY field. */ +#define NFCT_RXD_FRAMECONFIG_PARITY_Msk (0x1UL << NFCT_RXD_FRAMECONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define NFCT_RXD_FRAMECONFIG_PARITY_NoParity (0UL) /*!< Parity is not expected in RX frames */ +#define NFCT_RXD_FRAMECONFIG_PARITY_Parity (1UL) /*!< Parity is expected in RX frames */ + +/* Register: NFCT_RXD_AMOUNT */ +/* Description: Size of last incoming frame */ + +/* Bits 11..3 : Number of complete bytes received in the frame (including CRC, but excluding parity and SoF/EoF framing) */ +#define NFCT_RXD_AMOUNT_RXDATABYTES_Pos (3UL) /*!< Position of RXDATABYTES field. */ +#define NFCT_RXD_AMOUNT_RXDATABYTES_Msk (0x1FFUL << NFCT_RXD_AMOUNT_RXDATABYTES_Pos) /*!< Bit mask of RXDATABYTES field. */ + +/* Bits 2..0 : Number of bits in the last byte in the frame, if less than 8 (including CRC, but excluding parity and SoF/EoF framing). */ +#define NFCT_RXD_AMOUNT_RXDATABITS_Pos (0UL) /*!< Position of RXDATABITS field. */ +#define NFCT_RXD_AMOUNT_RXDATABITS_Msk (0x7UL << NFCT_RXD_AMOUNT_RXDATABITS_Pos) /*!< Bit mask of RXDATABITS field. */ + +/* Register: NFCT_NFCID1_LAST */ +/* Description: Last NFCID1 part (4, 7 or 10 bytes ID) */ + +/* Bits 31..24 : NFCID1 byte W */ +#define NFCT_NFCID1_LAST_NFCID1_W_Pos (24UL) /*!< Position of NFCID1_W field. */ +#define NFCT_NFCID1_LAST_NFCID1_W_Msk (0xFFUL << NFCT_NFCID1_LAST_NFCID1_W_Pos) /*!< Bit mask of NFCID1_W field. */ + +/* Bits 23..16 : NFCID1 byte X */ +#define NFCT_NFCID1_LAST_NFCID1_X_Pos (16UL) /*!< Position of NFCID1_X field. */ +#define NFCT_NFCID1_LAST_NFCID1_X_Msk (0xFFUL << NFCT_NFCID1_LAST_NFCID1_X_Pos) /*!< Bit mask of NFCID1_X field. */ + +/* Bits 15..8 : NFCID1 byte Y */ +#define NFCT_NFCID1_LAST_NFCID1_Y_Pos (8UL) /*!< Position of NFCID1_Y field. */ +#define NFCT_NFCID1_LAST_NFCID1_Y_Msk (0xFFUL << NFCT_NFCID1_LAST_NFCID1_Y_Pos) /*!< Bit mask of NFCID1_Y field. */ + +/* Bits 7..0 : NFCID1 byte Z (very last byte sent) */ +#define NFCT_NFCID1_LAST_NFCID1_Z_Pos (0UL) /*!< Position of NFCID1_Z field. */ +#define NFCT_NFCID1_LAST_NFCID1_Z_Msk (0xFFUL << NFCT_NFCID1_LAST_NFCID1_Z_Pos) /*!< Bit mask of NFCID1_Z field. */ + +/* Register: NFCT_NFCID1_2ND_LAST */ +/* Description: Second last NFCID1 part (7 or 10 bytes ID) */ + +/* Bits 23..16 : NFCID1 byte T */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_T_Pos (16UL) /*!< Position of NFCID1_T field. */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_T_Msk (0xFFUL << NFCT_NFCID1_2ND_LAST_NFCID1_T_Pos) /*!< Bit mask of NFCID1_T field. */ + +/* Bits 15..8 : NFCID1 byte U */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_U_Pos (8UL) /*!< Position of NFCID1_U field. */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_U_Msk (0xFFUL << NFCT_NFCID1_2ND_LAST_NFCID1_U_Pos) /*!< Bit mask of NFCID1_U field. */ + +/* Bits 7..0 : NFCID1 byte V */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_V_Pos (0UL) /*!< Position of NFCID1_V field. */ +#define NFCT_NFCID1_2ND_LAST_NFCID1_V_Msk (0xFFUL << NFCT_NFCID1_2ND_LAST_NFCID1_V_Pos) /*!< Bit mask of NFCID1_V field. */ + +/* Register: NFCT_NFCID1_3RD_LAST */ +/* Description: Third last NFCID1 part (10 bytes ID) */ + +/* Bits 23..16 : NFCID1 byte Q */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_Q_Pos (16UL) /*!< Position of NFCID1_Q field. */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_Q_Msk (0xFFUL << NFCT_NFCID1_3RD_LAST_NFCID1_Q_Pos) /*!< Bit mask of NFCID1_Q field. */ + +/* Bits 15..8 : NFCID1 byte R */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_R_Pos (8UL) /*!< Position of NFCID1_R field. */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_R_Msk (0xFFUL << NFCT_NFCID1_3RD_LAST_NFCID1_R_Pos) /*!< Bit mask of NFCID1_R field. */ + +/* Bits 7..0 : NFCID1 byte S */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_S_Pos (0UL) /*!< Position of NFCID1_S field. */ +#define NFCT_NFCID1_3RD_LAST_NFCID1_S_Msk (0xFFUL << NFCT_NFCID1_3RD_LAST_NFCID1_S_Pos) /*!< Bit mask of NFCID1_S field. */ + +/* Register: NFCT_AUTOCOLRESCONFIG */ +/* Description: Controls the auto collision resolution function. This setting must be done before the NFCT peripheral is enabled. */ + +/* Bit 0 : Enables/disables auto collision resolution */ +#define NFCT_AUTOCOLRESCONFIG_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define NFCT_AUTOCOLRESCONFIG_MODE_Msk (0x1UL << NFCT_AUTOCOLRESCONFIG_MODE_Pos) /*!< Bit mask of MODE field. */ +#define NFCT_AUTOCOLRESCONFIG_MODE_Enabled (0UL) /*!< Auto collision resolution enabled */ +#define NFCT_AUTOCOLRESCONFIG_MODE_Disabled (1UL) /*!< Auto collision resolution disabled */ + +/* Register: NFCT_SENSRES */ +/* Description: NFC-A SENS_RES auto-response settings */ + +/* Bits 15..12 : Reserved for future use. Shall be 0. */ +#define NFCT_SENSRES_RFU74_Pos (12UL) /*!< Position of RFU74 field. */ +#define NFCT_SENSRES_RFU74_Msk (0xFUL << NFCT_SENSRES_RFU74_Pos) /*!< Bit mask of RFU74 field. */ + +/* Bits 11..8 : Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification */ +#define NFCT_SENSRES_PLATFCONFIG_Pos (8UL) /*!< Position of PLATFCONFIG field. */ +#define NFCT_SENSRES_PLATFCONFIG_Msk (0xFUL << NFCT_SENSRES_PLATFCONFIG_Pos) /*!< Bit mask of PLATFCONFIG field. */ + +/* Bits 7..6 : NFCID1 size. This value is used by the auto collision resolution engine. */ +#define NFCT_SENSRES_NFCIDSIZE_Pos (6UL) /*!< Position of NFCIDSIZE field. */ +#define NFCT_SENSRES_NFCIDSIZE_Msk (0x3UL << NFCT_SENSRES_NFCIDSIZE_Pos) /*!< Bit mask of NFCIDSIZE field. */ +#define NFCT_SENSRES_NFCIDSIZE_NFCID1Single (0UL) /*!< NFCID1 size: single (4 bytes) */ +#define NFCT_SENSRES_NFCIDSIZE_NFCID1Double (1UL) /*!< NFCID1 size: double (7 bytes) */ +#define NFCT_SENSRES_NFCIDSIZE_NFCID1Triple (2UL) /*!< NFCID1 size: triple (10 bytes) */ + +/* Bit 5 : Reserved for future use. Shall be 0. */ +#define NFCT_SENSRES_RFU5_Pos (5UL) /*!< Position of RFU5 field. */ +#define NFCT_SENSRES_RFU5_Msk (0x1UL << NFCT_SENSRES_RFU5_Pos) /*!< Bit mask of RFU5 field. */ + +/* Bits 4..0 : Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification */ +#define NFCT_SENSRES_BITFRAMESDD_Pos (0UL) /*!< Position of BITFRAMESDD field. */ +#define NFCT_SENSRES_BITFRAMESDD_Msk (0x1FUL << NFCT_SENSRES_BITFRAMESDD_Pos) /*!< Bit mask of BITFRAMESDD field. */ +#define NFCT_SENSRES_BITFRAMESDD_SDD00000 (0UL) /*!< SDD pattern 00000 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD00001 (1UL) /*!< SDD pattern 00001 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD00010 (2UL) /*!< SDD pattern 00010 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD00100 (4UL) /*!< SDD pattern 00100 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD01000 (8UL) /*!< SDD pattern 01000 */ +#define NFCT_SENSRES_BITFRAMESDD_SDD10000 (16UL) /*!< SDD pattern 10000 */ + +/* Register: NFCT_SELRES */ +/* Description: NFC-A SEL_RES auto-response settings */ + +/* Bit 7 : Reserved for future use. Shall be 0. */ +#define NFCT_SELRES_RFU7_Pos (7UL) /*!< Position of RFU7 field. */ +#define NFCT_SELRES_RFU7_Msk (0x1UL << NFCT_SELRES_RFU7_Pos) /*!< Bit mask of RFU7 field. */ + +/* Bits 6..5 : Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification */ +#define NFCT_SELRES_PROTOCOL_Pos (5UL) /*!< Position of PROTOCOL field. */ +#define NFCT_SELRES_PROTOCOL_Msk (0x3UL << NFCT_SELRES_PROTOCOL_Pos) /*!< Bit mask of PROTOCOL field. */ + +/* Bits 4..3 : Reserved for future use. Shall be 0. */ +#define NFCT_SELRES_RFU43_Pos (3UL) /*!< Position of RFU43 field. */ +#define NFCT_SELRES_RFU43_Msk (0x3UL << NFCT_SELRES_RFU43_Pos) /*!< Bit mask of RFU43 field. */ + +/* Bit 2 : Cascade as defined by the b3 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification (controlled by hardware, shall be 0) */ +#define NFCT_SELRES_CASCADE_Pos (2UL) /*!< Position of CASCADE field. */ +#define NFCT_SELRES_CASCADE_Msk (0x1UL << NFCT_SELRES_CASCADE_Pos) /*!< Bit mask of CASCADE field. */ + +/* Bits 1..0 : Reserved for future use. Shall be 0. */ +#define NFCT_SELRES_RFU10_Pos (0UL) /*!< Position of RFU10 field. */ +#define NFCT_SELRES_RFU10_Msk (0x3UL << NFCT_SELRES_RFU10_Pos) /*!< Bit mask of RFU10 field. */ + + +/* Peripheral: NVMC */ +/* Description: Non Volatile Memory Controller */ + +/* Register: NVMC_READY */ +/* Description: Ready flag */ + +/* Bit 0 : NVMC is ready or busy */ +#define NVMC_READY_READY_Pos (0UL) /*!< Position of READY field. */ +#define NVMC_READY_READY_Msk (0x1UL << NVMC_READY_READY_Pos) /*!< Bit mask of READY field. */ +#define NVMC_READY_READY_Busy (0UL) /*!< NVMC is busy (on-going write or erase operation) */ +#define NVMC_READY_READY_Ready (1UL) /*!< NVMC is ready */ + +/* Register: NVMC_CONFIG */ +/* Description: Configuration register */ + +/* Bits 1..0 : Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used. Enabling write or erase will invalidate the cache and keep it invalidated. */ +#define NVMC_CONFIG_WEN_Pos (0UL) /*!< Position of WEN field. */ +#define NVMC_CONFIG_WEN_Msk (0x3UL << NVMC_CONFIG_WEN_Pos) /*!< Bit mask of WEN field. */ +#define NVMC_CONFIG_WEN_Ren (0UL) /*!< Read only access */ +#define NVMC_CONFIG_WEN_Wen (1UL) /*!< Write Enabled */ +#define NVMC_CONFIG_WEN_Een (2UL) /*!< Erase enabled */ + +/* Register: NVMC_ERASEPAGE */ +/* Description: Register for erasing a page in Code area */ + +/* Bits 31..0 : Register for starting erase of a page in Code area */ +#define NVMC_ERASEPAGE_ERASEPAGE_Pos (0UL) /*!< Position of ERASEPAGE field. */ +#define NVMC_ERASEPAGE_ERASEPAGE_Msk (0xFFFFFFFFUL << NVMC_ERASEPAGE_ERASEPAGE_Pos) /*!< Bit mask of ERASEPAGE field. */ + +/* Register: NVMC_ERASEPCR1 */ +/* Description: Deprecated register - Register for erasing a page in Code area. Equivalent to ERASEPAGE. */ + +/* Bits 31..0 : Register for erasing a page in Code area. Equivalent to ERASEPAGE. */ +#define NVMC_ERASEPCR1_ERASEPCR1_Pos (0UL) /*!< Position of ERASEPCR1 field. */ +#define NVMC_ERASEPCR1_ERASEPCR1_Msk (0xFFFFFFFFUL << NVMC_ERASEPCR1_ERASEPCR1_Pos) /*!< Bit mask of ERASEPCR1 field. */ + +/* Register: NVMC_ERASEALL */ +/* Description: Register for erasing all non-volatile user memory */ + +/* Bit 0 : Erase all non-volatile memory including UICR registers. Note that the erase must be enabled using CONFIG.WEN before the non-volatile memory can be erased. */ +#define NVMC_ERASEALL_ERASEALL_Pos (0UL) /*!< Position of ERASEALL field. */ +#define NVMC_ERASEALL_ERASEALL_Msk (0x1UL << NVMC_ERASEALL_ERASEALL_Pos) /*!< Bit mask of ERASEALL field. */ +#define NVMC_ERASEALL_ERASEALL_NoOperation (0UL) /*!< No operation */ +#define NVMC_ERASEALL_ERASEALL_Erase (1UL) /*!< Start chip erase */ + +/* Register: NVMC_ERASEPCR0 */ +/* Description: Deprecated register - Register for erasing a page in Code area. Equivalent to ERASEPAGE. */ + +/* Bits 31..0 : Register for starting erase of a page in Code area. Equivalent to ERASEPAGE. */ +#define NVMC_ERASEPCR0_ERASEPCR0_Pos (0UL) /*!< Position of ERASEPCR0 field. */ +#define NVMC_ERASEPCR0_ERASEPCR0_Msk (0xFFFFFFFFUL << NVMC_ERASEPCR0_ERASEPCR0_Pos) /*!< Bit mask of ERASEPCR0 field. */ + +/* Register: NVMC_ERASEUICR */ +/* Description: Register for erasing User Information Configuration Registers */ + +/* Bit 0 : Register starting erase of all User Information Configuration Registers. Note that the erase must be enabled using CONFIG.WEN before the UICR can be erased. */ +#define NVMC_ERASEUICR_ERASEUICR_Pos (0UL) /*!< Position of ERASEUICR field. */ +#define NVMC_ERASEUICR_ERASEUICR_Msk (0x1UL << NVMC_ERASEUICR_ERASEUICR_Pos) /*!< Bit mask of ERASEUICR field. */ +#define NVMC_ERASEUICR_ERASEUICR_NoOperation (0UL) /*!< No operation */ +#define NVMC_ERASEUICR_ERASEUICR_Erase (1UL) /*!< Start erase of UICR */ + +/* Register: NVMC_ICACHECNF */ +/* Description: I-Code cache configuration register. */ + +/* Bit 8 : Cache profiling enable */ +#define NVMC_ICACHECNF_CACHEPROFEN_Pos (8UL) /*!< Position of CACHEPROFEN field. */ +#define NVMC_ICACHECNF_CACHEPROFEN_Msk (0x1UL << NVMC_ICACHECNF_CACHEPROFEN_Pos) /*!< Bit mask of CACHEPROFEN field. */ +#define NVMC_ICACHECNF_CACHEPROFEN_Disabled (0UL) /*!< Disable cache profiling */ +#define NVMC_ICACHECNF_CACHEPROFEN_Enabled (1UL) /*!< Enable cache profiling */ + +/* Bit 0 : Cache enable */ +#define NVMC_ICACHECNF_CACHEEN_Pos (0UL) /*!< Position of CACHEEN field. */ +#define NVMC_ICACHECNF_CACHEEN_Msk (0x1UL << NVMC_ICACHECNF_CACHEEN_Pos) /*!< Bit mask of CACHEEN field. */ +#define NVMC_ICACHECNF_CACHEEN_Disabled (0UL) /*!< Disable cache. Invalidates all cache entries. */ +#define NVMC_ICACHECNF_CACHEEN_Enabled (1UL) /*!< Enable cache */ + +/* Register: NVMC_IHIT */ +/* Description: I-Code cache hit counter. */ + +/* Bits 31..0 : Number of cache hits */ +#define NVMC_IHIT_HITS_Pos (0UL) /*!< Position of HITS field. */ +#define NVMC_IHIT_HITS_Msk (0xFFFFFFFFUL << NVMC_IHIT_HITS_Pos) /*!< Bit mask of HITS field. */ + +/* Register: NVMC_IMISS */ +/* Description: I-Code cache miss counter. */ + +/* Bits 31..0 : Number of cache misses */ +#define NVMC_IMISS_MISSES_Pos (0UL) /*!< Position of MISSES field. */ +#define NVMC_IMISS_MISSES_Msk (0xFFFFFFFFUL << NVMC_IMISS_MISSES_Pos) /*!< Bit mask of MISSES field. */ + + +/* Peripheral: GPIO */ +/* Description: GPIO Port 1 */ + +/* Register: GPIO_OUT */ +/* Description: Write GPIO port */ + +/* Bit 31 : Pin 31 */ +#define GPIO_OUT_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUT_PIN31_Msk (0x1UL << GPIO_OUT_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUT_PIN31_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN31_High (1UL) /*!< Pin driver is high */ + +/* Bit 30 : Pin 30 */ +#define GPIO_OUT_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUT_PIN30_Msk (0x1UL << GPIO_OUT_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUT_PIN30_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN30_High (1UL) /*!< Pin driver is high */ + +/* Bit 29 : Pin 29 */ +#define GPIO_OUT_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUT_PIN29_Msk (0x1UL << GPIO_OUT_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUT_PIN29_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN29_High (1UL) /*!< Pin driver is high */ + +/* Bit 28 : Pin 28 */ +#define GPIO_OUT_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUT_PIN28_Msk (0x1UL << GPIO_OUT_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUT_PIN28_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN28_High (1UL) /*!< Pin driver is high */ + +/* Bit 27 : Pin 27 */ +#define GPIO_OUT_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUT_PIN27_Msk (0x1UL << GPIO_OUT_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUT_PIN27_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN27_High (1UL) /*!< Pin driver is high */ + +/* Bit 26 : Pin 26 */ +#define GPIO_OUT_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUT_PIN26_Msk (0x1UL << GPIO_OUT_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUT_PIN26_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN26_High (1UL) /*!< Pin driver is high */ + +/* Bit 25 : Pin 25 */ +#define GPIO_OUT_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUT_PIN25_Msk (0x1UL << GPIO_OUT_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUT_PIN25_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN25_High (1UL) /*!< Pin driver is high */ + +/* Bit 24 : Pin 24 */ +#define GPIO_OUT_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUT_PIN24_Msk (0x1UL << GPIO_OUT_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUT_PIN24_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN24_High (1UL) /*!< Pin driver is high */ + +/* Bit 23 : Pin 23 */ +#define GPIO_OUT_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUT_PIN23_Msk (0x1UL << GPIO_OUT_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUT_PIN23_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN23_High (1UL) /*!< Pin driver is high */ + +/* Bit 22 : Pin 22 */ +#define GPIO_OUT_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUT_PIN22_Msk (0x1UL << GPIO_OUT_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUT_PIN22_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN22_High (1UL) /*!< Pin driver is high */ + +/* Bit 21 : Pin 21 */ +#define GPIO_OUT_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUT_PIN21_Msk (0x1UL << GPIO_OUT_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUT_PIN21_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN21_High (1UL) /*!< Pin driver is high */ + +/* Bit 20 : Pin 20 */ +#define GPIO_OUT_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUT_PIN20_Msk (0x1UL << GPIO_OUT_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUT_PIN20_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN20_High (1UL) /*!< Pin driver is high */ + +/* Bit 19 : Pin 19 */ +#define GPIO_OUT_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUT_PIN19_Msk (0x1UL << GPIO_OUT_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUT_PIN19_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN19_High (1UL) /*!< Pin driver is high */ + +/* Bit 18 : Pin 18 */ +#define GPIO_OUT_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUT_PIN18_Msk (0x1UL << GPIO_OUT_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUT_PIN18_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN18_High (1UL) /*!< Pin driver is high */ + +/* Bit 17 : Pin 17 */ +#define GPIO_OUT_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUT_PIN17_Msk (0x1UL << GPIO_OUT_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUT_PIN17_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN17_High (1UL) /*!< Pin driver is high */ + +/* Bit 16 : Pin 16 */ +#define GPIO_OUT_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUT_PIN16_Msk (0x1UL << GPIO_OUT_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUT_PIN16_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN16_High (1UL) /*!< Pin driver is high */ + +/* Bit 15 : Pin 15 */ +#define GPIO_OUT_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUT_PIN15_Msk (0x1UL << GPIO_OUT_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUT_PIN15_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN15_High (1UL) /*!< Pin driver is high */ + +/* Bit 14 : Pin 14 */ +#define GPIO_OUT_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUT_PIN14_Msk (0x1UL << GPIO_OUT_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUT_PIN14_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN14_High (1UL) /*!< Pin driver is high */ + +/* Bit 13 : Pin 13 */ +#define GPIO_OUT_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUT_PIN13_Msk (0x1UL << GPIO_OUT_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUT_PIN13_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN13_High (1UL) /*!< Pin driver is high */ + +/* Bit 12 : Pin 12 */ +#define GPIO_OUT_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUT_PIN12_Msk (0x1UL << GPIO_OUT_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUT_PIN12_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN12_High (1UL) /*!< Pin driver is high */ + +/* Bit 11 : Pin 11 */ +#define GPIO_OUT_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUT_PIN11_Msk (0x1UL << GPIO_OUT_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUT_PIN11_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN11_High (1UL) /*!< Pin driver is high */ + +/* Bit 10 : Pin 10 */ +#define GPIO_OUT_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUT_PIN10_Msk (0x1UL << GPIO_OUT_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUT_PIN10_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN10_High (1UL) /*!< Pin driver is high */ + +/* Bit 9 : Pin 9 */ +#define GPIO_OUT_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUT_PIN9_Msk (0x1UL << GPIO_OUT_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUT_PIN9_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN9_High (1UL) /*!< Pin driver is high */ + +/* Bit 8 : Pin 8 */ +#define GPIO_OUT_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUT_PIN8_Msk (0x1UL << GPIO_OUT_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUT_PIN8_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN8_High (1UL) /*!< Pin driver is high */ + +/* Bit 7 : Pin 7 */ +#define GPIO_OUT_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUT_PIN7_Msk (0x1UL << GPIO_OUT_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUT_PIN7_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN7_High (1UL) /*!< Pin driver is high */ + +/* Bit 6 : Pin 6 */ +#define GPIO_OUT_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUT_PIN6_Msk (0x1UL << GPIO_OUT_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUT_PIN6_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN6_High (1UL) /*!< Pin driver is high */ + +/* Bit 5 : Pin 5 */ +#define GPIO_OUT_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUT_PIN5_Msk (0x1UL << GPIO_OUT_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUT_PIN5_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN5_High (1UL) /*!< Pin driver is high */ + +/* Bit 4 : Pin 4 */ +#define GPIO_OUT_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUT_PIN4_Msk (0x1UL << GPIO_OUT_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUT_PIN4_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN4_High (1UL) /*!< Pin driver is high */ + +/* Bit 3 : Pin 3 */ +#define GPIO_OUT_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUT_PIN3_Msk (0x1UL << GPIO_OUT_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUT_PIN3_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN3_High (1UL) /*!< Pin driver is high */ + +/* Bit 2 : Pin 2 */ +#define GPIO_OUT_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUT_PIN2_Msk (0x1UL << GPIO_OUT_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUT_PIN2_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN2_High (1UL) /*!< Pin driver is high */ + +/* Bit 1 : Pin 1 */ +#define GPIO_OUT_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUT_PIN1_Msk (0x1UL << GPIO_OUT_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUT_PIN1_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN1_High (1UL) /*!< Pin driver is high */ + +/* Bit 0 : Pin 0 */ +#define GPIO_OUT_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUT_PIN0_Msk (0x1UL << GPIO_OUT_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUT_PIN0_Low (0UL) /*!< Pin driver is low */ +#define GPIO_OUT_PIN0_High (1UL) /*!< Pin driver is high */ + +/* Register: GPIO_OUTSET */ +/* Description: Set individual bits in GPIO port */ + +/* Bit 31 : Pin 31 */ +#define GPIO_OUTSET_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUTSET_PIN31_Msk (0x1UL << GPIO_OUTSET_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUTSET_PIN31_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN31_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN31_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 30 : Pin 30 */ +#define GPIO_OUTSET_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUTSET_PIN30_Msk (0x1UL << GPIO_OUTSET_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUTSET_PIN30_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN30_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN30_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 29 : Pin 29 */ +#define GPIO_OUTSET_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUTSET_PIN29_Msk (0x1UL << GPIO_OUTSET_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUTSET_PIN29_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN29_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN29_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 28 : Pin 28 */ +#define GPIO_OUTSET_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUTSET_PIN28_Msk (0x1UL << GPIO_OUTSET_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUTSET_PIN28_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN28_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN28_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 27 : Pin 27 */ +#define GPIO_OUTSET_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUTSET_PIN27_Msk (0x1UL << GPIO_OUTSET_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUTSET_PIN27_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN27_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN27_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 26 : Pin 26 */ +#define GPIO_OUTSET_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUTSET_PIN26_Msk (0x1UL << GPIO_OUTSET_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUTSET_PIN26_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN26_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN26_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 25 : Pin 25 */ +#define GPIO_OUTSET_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUTSET_PIN25_Msk (0x1UL << GPIO_OUTSET_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUTSET_PIN25_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN25_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN25_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 24 : Pin 24 */ +#define GPIO_OUTSET_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUTSET_PIN24_Msk (0x1UL << GPIO_OUTSET_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUTSET_PIN24_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN24_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN24_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 23 : Pin 23 */ +#define GPIO_OUTSET_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUTSET_PIN23_Msk (0x1UL << GPIO_OUTSET_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUTSET_PIN23_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN23_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN23_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 22 : Pin 22 */ +#define GPIO_OUTSET_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUTSET_PIN22_Msk (0x1UL << GPIO_OUTSET_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUTSET_PIN22_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN22_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN22_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 21 : Pin 21 */ +#define GPIO_OUTSET_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUTSET_PIN21_Msk (0x1UL << GPIO_OUTSET_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUTSET_PIN21_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN21_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN21_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 20 : Pin 20 */ +#define GPIO_OUTSET_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUTSET_PIN20_Msk (0x1UL << GPIO_OUTSET_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUTSET_PIN20_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN20_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN20_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 19 : Pin 19 */ +#define GPIO_OUTSET_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUTSET_PIN19_Msk (0x1UL << GPIO_OUTSET_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUTSET_PIN19_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN19_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN19_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 18 : Pin 18 */ +#define GPIO_OUTSET_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUTSET_PIN18_Msk (0x1UL << GPIO_OUTSET_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUTSET_PIN18_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN18_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN18_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 17 : Pin 17 */ +#define GPIO_OUTSET_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUTSET_PIN17_Msk (0x1UL << GPIO_OUTSET_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUTSET_PIN17_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN17_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN17_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 16 : Pin 16 */ +#define GPIO_OUTSET_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUTSET_PIN16_Msk (0x1UL << GPIO_OUTSET_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUTSET_PIN16_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN16_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN16_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 15 : Pin 15 */ +#define GPIO_OUTSET_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUTSET_PIN15_Msk (0x1UL << GPIO_OUTSET_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUTSET_PIN15_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN15_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN15_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 14 : Pin 14 */ +#define GPIO_OUTSET_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUTSET_PIN14_Msk (0x1UL << GPIO_OUTSET_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUTSET_PIN14_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN14_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN14_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 13 : Pin 13 */ +#define GPIO_OUTSET_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUTSET_PIN13_Msk (0x1UL << GPIO_OUTSET_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUTSET_PIN13_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN13_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN13_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 12 : Pin 12 */ +#define GPIO_OUTSET_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUTSET_PIN12_Msk (0x1UL << GPIO_OUTSET_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUTSET_PIN12_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN12_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN12_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 11 : Pin 11 */ +#define GPIO_OUTSET_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUTSET_PIN11_Msk (0x1UL << GPIO_OUTSET_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUTSET_PIN11_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN11_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN11_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 10 : Pin 10 */ +#define GPIO_OUTSET_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUTSET_PIN10_Msk (0x1UL << GPIO_OUTSET_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUTSET_PIN10_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN10_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN10_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 9 : Pin 9 */ +#define GPIO_OUTSET_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUTSET_PIN9_Msk (0x1UL << GPIO_OUTSET_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUTSET_PIN9_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN9_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN9_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 8 : Pin 8 */ +#define GPIO_OUTSET_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUTSET_PIN8_Msk (0x1UL << GPIO_OUTSET_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUTSET_PIN8_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN8_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN8_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 7 : Pin 7 */ +#define GPIO_OUTSET_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUTSET_PIN7_Msk (0x1UL << GPIO_OUTSET_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUTSET_PIN7_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN7_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN7_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 6 : Pin 6 */ +#define GPIO_OUTSET_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUTSET_PIN6_Msk (0x1UL << GPIO_OUTSET_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUTSET_PIN6_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN6_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN6_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 5 : Pin 5 */ +#define GPIO_OUTSET_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUTSET_PIN5_Msk (0x1UL << GPIO_OUTSET_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUTSET_PIN5_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN5_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN5_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 4 : Pin 4 */ +#define GPIO_OUTSET_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUTSET_PIN4_Msk (0x1UL << GPIO_OUTSET_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUTSET_PIN4_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN4_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN4_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 3 : Pin 3 */ +#define GPIO_OUTSET_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUTSET_PIN3_Msk (0x1UL << GPIO_OUTSET_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUTSET_PIN3_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN3_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN3_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 2 : Pin 2 */ +#define GPIO_OUTSET_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUTSET_PIN2_Msk (0x1UL << GPIO_OUTSET_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUTSET_PIN2_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN2_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN2_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 1 : Pin 1 */ +#define GPIO_OUTSET_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUTSET_PIN1_Msk (0x1UL << GPIO_OUTSET_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUTSET_PIN1_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN1_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN1_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Bit 0 : Pin 0 */ +#define GPIO_OUTSET_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUTSET_PIN0_Msk (0x1UL << GPIO_OUTSET_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUTSET_PIN0_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTSET_PIN0_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTSET_PIN0_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ + +/* Register: GPIO_OUTCLR */ +/* Description: Clear individual bits in GPIO port */ + +/* Bit 31 : Pin 31 */ +#define GPIO_OUTCLR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_OUTCLR_PIN31_Msk (0x1UL << GPIO_OUTCLR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_OUTCLR_PIN31_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN31_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN31_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 30 : Pin 30 */ +#define GPIO_OUTCLR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_OUTCLR_PIN30_Msk (0x1UL << GPIO_OUTCLR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_OUTCLR_PIN30_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN30_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN30_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 29 : Pin 29 */ +#define GPIO_OUTCLR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_OUTCLR_PIN29_Msk (0x1UL << GPIO_OUTCLR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_OUTCLR_PIN29_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN29_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN29_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 28 : Pin 28 */ +#define GPIO_OUTCLR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_OUTCLR_PIN28_Msk (0x1UL << GPIO_OUTCLR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_OUTCLR_PIN28_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN28_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN28_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 27 : Pin 27 */ +#define GPIO_OUTCLR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_OUTCLR_PIN27_Msk (0x1UL << GPIO_OUTCLR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_OUTCLR_PIN27_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN27_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN27_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 26 : Pin 26 */ +#define GPIO_OUTCLR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_OUTCLR_PIN26_Msk (0x1UL << GPIO_OUTCLR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_OUTCLR_PIN26_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN26_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN26_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 25 : Pin 25 */ +#define GPIO_OUTCLR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_OUTCLR_PIN25_Msk (0x1UL << GPIO_OUTCLR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_OUTCLR_PIN25_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN25_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN25_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 24 : Pin 24 */ +#define GPIO_OUTCLR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_OUTCLR_PIN24_Msk (0x1UL << GPIO_OUTCLR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_OUTCLR_PIN24_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN24_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN24_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 23 : Pin 23 */ +#define GPIO_OUTCLR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_OUTCLR_PIN23_Msk (0x1UL << GPIO_OUTCLR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_OUTCLR_PIN23_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN23_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN23_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 22 : Pin 22 */ +#define GPIO_OUTCLR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_OUTCLR_PIN22_Msk (0x1UL << GPIO_OUTCLR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_OUTCLR_PIN22_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN22_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN22_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 21 : Pin 21 */ +#define GPIO_OUTCLR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_OUTCLR_PIN21_Msk (0x1UL << GPIO_OUTCLR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_OUTCLR_PIN21_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN21_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN21_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 20 : Pin 20 */ +#define GPIO_OUTCLR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_OUTCLR_PIN20_Msk (0x1UL << GPIO_OUTCLR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_OUTCLR_PIN20_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN20_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN20_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 19 : Pin 19 */ +#define GPIO_OUTCLR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_OUTCLR_PIN19_Msk (0x1UL << GPIO_OUTCLR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_OUTCLR_PIN19_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN19_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN19_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 18 : Pin 18 */ +#define GPIO_OUTCLR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_OUTCLR_PIN18_Msk (0x1UL << GPIO_OUTCLR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_OUTCLR_PIN18_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN18_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN18_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 17 : Pin 17 */ +#define GPIO_OUTCLR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_OUTCLR_PIN17_Msk (0x1UL << GPIO_OUTCLR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_OUTCLR_PIN17_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN17_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN17_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 16 : Pin 16 */ +#define GPIO_OUTCLR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_OUTCLR_PIN16_Msk (0x1UL << GPIO_OUTCLR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_OUTCLR_PIN16_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN16_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN16_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 15 : Pin 15 */ +#define GPIO_OUTCLR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_OUTCLR_PIN15_Msk (0x1UL << GPIO_OUTCLR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_OUTCLR_PIN15_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN15_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN15_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 14 : Pin 14 */ +#define GPIO_OUTCLR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_OUTCLR_PIN14_Msk (0x1UL << GPIO_OUTCLR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_OUTCLR_PIN14_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN14_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN14_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 13 : Pin 13 */ +#define GPIO_OUTCLR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_OUTCLR_PIN13_Msk (0x1UL << GPIO_OUTCLR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_OUTCLR_PIN13_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN13_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN13_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 12 : Pin 12 */ +#define GPIO_OUTCLR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_OUTCLR_PIN12_Msk (0x1UL << GPIO_OUTCLR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_OUTCLR_PIN12_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN12_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN12_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 11 : Pin 11 */ +#define GPIO_OUTCLR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_OUTCLR_PIN11_Msk (0x1UL << GPIO_OUTCLR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_OUTCLR_PIN11_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN11_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN11_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 10 : Pin 10 */ +#define GPIO_OUTCLR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_OUTCLR_PIN10_Msk (0x1UL << GPIO_OUTCLR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_OUTCLR_PIN10_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN10_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN10_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 9 : Pin 9 */ +#define GPIO_OUTCLR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_OUTCLR_PIN9_Msk (0x1UL << GPIO_OUTCLR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_OUTCLR_PIN9_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN9_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN9_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 8 : Pin 8 */ +#define GPIO_OUTCLR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_OUTCLR_PIN8_Msk (0x1UL << GPIO_OUTCLR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_OUTCLR_PIN8_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN8_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN8_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 7 : Pin 7 */ +#define GPIO_OUTCLR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_OUTCLR_PIN7_Msk (0x1UL << GPIO_OUTCLR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_OUTCLR_PIN7_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN7_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN7_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 6 : Pin 6 */ +#define GPIO_OUTCLR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_OUTCLR_PIN6_Msk (0x1UL << GPIO_OUTCLR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_OUTCLR_PIN6_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN6_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN6_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 5 : Pin 5 */ +#define GPIO_OUTCLR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_OUTCLR_PIN5_Msk (0x1UL << GPIO_OUTCLR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_OUTCLR_PIN5_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN5_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN5_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 4 : Pin 4 */ +#define GPIO_OUTCLR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_OUTCLR_PIN4_Msk (0x1UL << GPIO_OUTCLR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_OUTCLR_PIN4_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN4_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN4_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 3 : Pin 3 */ +#define GPIO_OUTCLR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_OUTCLR_PIN3_Msk (0x1UL << GPIO_OUTCLR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_OUTCLR_PIN3_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN3_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN3_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 2 : Pin 2 */ +#define GPIO_OUTCLR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_OUTCLR_PIN2_Msk (0x1UL << GPIO_OUTCLR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_OUTCLR_PIN2_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN2_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN2_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 1 : Pin 1 */ +#define GPIO_OUTCLR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_OUTCLR_PIN1_Msk (0x1UL << GPIO_OUTCLR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_OUTCLR_PIN1_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN1_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN1_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Bit 0 : Pin 0 */ +#define GPIO_OUTCLR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_OUTCLR_PIN0_Msk (0x1UL << GPIO_OUTCLR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_OUTCLR_PIN0_Low (0UL) /*!< Read: pin driver is low */ +#define GPIO_OUTCLR_PIN0_High (1UL) /*!< Read: pin driver is high */ +#define GPIO_OUTCLR_PIN0_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ + +/* Register: GPIO_IN */ +/* Description: Read GPIO port */ + +/* Bit 31 : Pin 31 */ +#define GPIO_IN_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_IN_PIN31_Msk (0x1UL << GPIO_IN_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_IN_PIN31_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN31_High (1UL) /*!< Pin input is high */ + +/* Bit 30 : Pin 30 */ +#define GPIO_IN_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_IN_PIN30_Msk (0x1UL << GPIO_IN_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_IN_PIN30_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN30_High (1UL) /*!< Pin input is high */ + +/* Bit 29 : Pin 29 */ +#define GPIO_IN_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_IN_PIN29_Msk (0x1UL << GPIO_IN_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_IN_PIN29_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN29_High (1UL) /*!< Pin input is high */ + +/* Bit 28 : Pin 28 */ +#define GPIO_IN_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_IN_PIN28_Msk (0x1UL << GPIO_IN_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_IN_PIN28_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN28_High (1UL) /*!< Pin input is high */ + +/* Bit 27 : Pin 27 */ +#define GPIO_IN_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_IN_PIN27_Msk (0x1UL << GPIO_IN_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_IN_PIN27_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN27_High (1UL) /*!< Pin input is high */ + +/* Bit 26 : Pin 26 */ +#define GPIO_IN_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_IN_PIN26_Msk (0x1UL << GPIO_IN_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_IN_PIN26_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN26_High (1UL) /*!< Pin input is high */ + +/* Bit 25 : Pin 25 */ +#define GPIO_IN_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_IN_PIN25_Msk (0x1UL << GPIO_IN_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_IN_PIN25_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN25_High (1UL) /*!< Pin input is high */ + +/* Bit 24 : Pin 24 */ +#define GPIO_IN_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_IN_PIN24_Msk (0x1UL << GPIO_IN_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_IN_PIN24_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN24_High (1UL) /*!< Pin input is high */ + +/* Bit 23 : Pin 23 */ +#define GPIO_IN_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_IN_PIN23_Msk (0x1UL << GPIO_IN_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_IN_PIN23_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN23_High (1UL) /*!< Pin input is high */ + +/* Bit 22 : Pin 22 */ +#define GPIO_IN_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_IN_PIN22_Msk (0x1UL << GPIO_IN_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_IN_PIN22_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN22_High (1UL) /*!< Pin input is high */ + +/* Bit 21 : Pin 21 */ +#define GPIO_IN_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_IN_PIN21_Msk (0x1UL << GPIO_IN_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_IN_PIN21_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN21_High (1UL) /*!< Pin input is high */ + +/* Bit 20 : Pin 20 */ +#define GPIO_IN_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_IN_PIN20_Msk (0x1UL << GPIO_IN_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_IN_PIN20_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN20_High (1UL) /*!< Pin input is high */ + +/* Bit 19 : Pin 19 */ +#define GPIO_IN_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_IN_PIN19_Msk (0x1UL << GPIO_IN_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_IN_PIN19_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN19_High (1UL) /*!< Pin input is high */ + +/* Bit 18 : Pin 18 */ +#define GPIO_IN_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_IN_PIN18_Msk (0x1UL << GPIO_IN_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_IN_PIN18_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN18_High (1UL) /*!< Pin input is high */ + +/* Bit 17 : Pin 17 */ +#define GPIO_IN_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_IN_PIN17_Msk (0x1UL << GPIO_IN_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_IN_PIN17_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN17_High (1UL) /*!< Pin input is high */ + +/* Bit 16 : Pin 16 */ +#define GPIO_IN_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_IN_PIN16_Msk (0x1UL << GPIO_IN_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_IN_PIN16_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN16_High (1UL) /*!< Pin input is high */ + +/* Bit 15 : Pin 15 */ +#define GPIO_IN_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_IN_PIN15_Msk (0x1UL << GPIO_IN_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_IN_PIN15_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN15_High (1UL) /*!< Pin input is high */ + +/* Bit 14 : Pin 14 */ +#define GPIO_IN_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_IN_PIN14_Msk (0x1UL << GPIO_IN_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_IN_PIN14_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN14_High (1UL) /*!< Pin input is high */ + +/* Bit 13 : Pin 13 */ +#define GPIO_IN_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_IN_PIN13_Msk (0x1UL << GPIO_IN_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_IN_PIN13_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN13_High (1UL) /*!< Pin input is high */ + +/* Bit 12 : Pin 12 */ +#define GPIO_IN_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_IN_PIN12_Msk (0x1UL << GPIO_IN_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_IN_PIN12_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN12_High (1UL) /*!< Pin input is high */ + +/* Bit 11 : Pin 11 */ +#define GPIO_IN_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_IN_PIN11_Msk (0x1UL << GPIO_IN_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_IN_PIN11_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN11_High (1UL) /*!< Pin input is high */ + +/* Bit 10 : Pin 10 */ +#define GPIO_IN_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_IN_PIN10_Msk (0x1UL << GPIO_IN_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_IN_PIN10_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN10_High (1UL) /*!< Pin input is high */ + +/* Bit 9 : Pin 9 */ +#define GPIO_IN_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_IN_PIN9_Msk (0x1UL << GPIO_IN_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_IN_PIN9_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN9_High (1UL) /*!< Pin input is high */ + +/* Bit 8 : Pin 8 */ +#define GPIO_IN_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_IN_PIN8_Msk (0x1UL << GPIO_IN_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_IN_PIN8_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN8_High (1UL) /*!< Pin input is high */ + +/* Bit 7 : Pin 7 */ +#define GPIO_IN_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_IN_PIN7_Msk (0x1UL << GPIO_IN_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_IN_PIN7_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN7_High (1UL) /*!< Pin input is high */ + +/* Bit 6 : Pin 6 */ +#define GPIO_IN_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_IN_PIN6_Msk (0x1UL << GPIO_IN_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_IN_PIN6_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN6_High (1UL) /*!< Pin input is high */ + +/* Bit 5 : Pin 5 */ +#define GPIO_IN_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_IN_PIN5_Msk (0x1UL << GPIO_IN_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_IN_PIN5_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN5_High (1UL) /*!< Pin input is high */ + +/* Bit 4 : Pin 4 */ +#define GPIO_IN_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_IN_PIN4_Msk (0x1UL << GPIO_IN_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_IN_PIN4_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN4_High (1UL) /*!< Pin input is high */ + +/* Bit 3 : Pin 3 */ +#define GPIO_IN_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_IN_PIN3_Msk (0x1UL << GPIO_IN_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_IN_PIN3_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN3_High (1UL) /*!< Pin input is high */ + +/* Bit 2 : Pin 2 */ +#define GPIO_IN_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_IN_PIN2_Msk (0x1UL << GPIO_IN_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_IN_PIN2_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN2_High (1UL) /*!< Pin input is high */ + +/* Bit 1 : Pin 1 */ +#define GPIO_IN_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_IN_PIN1_Msk (0x1UL << GPIO_IN_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_IN_PIN1_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN1_High (1UL) /*!< Pin input is high */ + +/* Bit 0 : Pin 0 */ +#define GPIO_IN_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_IN_PIN0_Msk (0x1UL << GPIO_IN_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_IN_PIN0_Low (0UL) /*!< Pin input is low */ +#define GPIO_IN_PIN0_High (1UL) /*!< Pin input is high */ + +/* Register: GPIO_DIR */ +/* Description: Direction of GPIO pins */ + +/* Bit 31 : Pin 31 */ +#define GPIO_DIR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIR_PIN31_Msk (0x1UL << GPIO_DIR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIR_PIN31_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN31_Output (1UL) /*!< Pin set as output */ + +/* Bit 30 : Pin 30 */ +#define GPIO_DIR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIR_PIN30_Msk (0x1UL << GPIO_DIR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIR_PIN30_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN30_Output (1UL) /*!< Pin set as output */ + +/* Bit 29 : Pin 29 */ +#define GPIO_DIR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIR_PIN29_Msk (0x1UL << GPIO_DIR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIR_PIN29_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN29_Output (1UL) /*!< Pin set as output */ + +/* Bit 28 : Pin 28 */ +#define GPIO_DIR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIR_PIN28_Msk (0x1UL << GPIO_DIR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIR_PIN28_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN28_Output (1UL) /*!< Pin set as output */ + +/* Bit 27 : Pin 27 */ +#define GPIO_DIR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIR_PIN27_Msk (0x1UL << GPIO_DIR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIR_PIN27_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN27_Output (1UL) /*!< Pin set as output */ + +/* Bit 26 : Pin 26 */ +#define GPIO_DIR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIR_PIN26_Msk (0x1UL << GPIO_DIR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIR_PIN26_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN26_Output (1UL) /*!< Pin set as output */ + +/* Bit 25 : Pin 25 */ +#define GPIO_DIR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIR_PIN25_Msk (0x1UL << GPIO_DIR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIR_PIN25_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN25_Output (1UL) /*!< Pin set as output */ + +/* Bit 24 : Pin 24 */ +#define GPIO_DIR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIR_PIN24_Msk (0x1UL << GPIO_DIR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIR_PIN24_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN24_Output (1UL) /*!< Pin set as output */ + +/* Bit 23 : Pin 23 */ +#define GPIO_DIR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIR_PIN23_Msk (0x1UL << GPIO_DIR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIR_PIN23_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN23_Output (1UL) /*!< Pin set as output */ + +/* Bit 22 : Pin 22 */ +#define GPIO_DIR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIR_PIN22_Msk (0x1UL << GPIO_DIR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIR_PIN22_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN22_Output (1UL) /*!< Pin set as output */ + +/* Bit 21 : Pin 21 */ +#define GPIO_DIR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIR_PIN21_Msk (0x1UL << GPIO_DIR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIR_PIN21_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN21_Output (1UL) /*!< Pin set as output */ + +/* Bit 20 : Pin 20 */ +#define GPIO_DIR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIR_PIN20_Msk (0x1UL << GPIO_DIR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIR_PIN20_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN20_Output (1UL) /*!< Pin set as output */ + +/* Bit 19 : Pin 19 */ +#define GPIO_DIR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIR_PIN19_Msk (0x1UL << GPIO_DIR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIR_PIN19_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN19_Output (1UL) /*!< Pin set as output */ + +/* Bit 18 : Pin 18 */ +#define GPIO_DIR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIR_PIN18_Msk (0x1UL << GPIO_DIR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIR_PIN18_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN18_Output (1UL) /*!< Pin set as output */ + +/* Bit 17 : Pin 17 */ +#define GPIO_DIR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIR_PIN17_Msk (0x1UL << GPIO_DIR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIR_PIN17_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN17_Output (1UL) /*!< Pin set as output */ + +/* Bit 16 : Pin 16 */ +#define GPIO_DIR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIR_PIN16_Msk (0x1UL << GPIO_DIR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIR_PIN16_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN16_Output (1UL) /*!< Pin set as output */ + +/* Bit 15 : Pin 15 */ +#define GPIO_DIR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIR_PIN15_Msk (0x1UL << GPIO_DIR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIR_PIN15_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN15_Output (1UL) /*!< Pin set as output */ + +/* Bit 14 : Pin 14 */ +#define GPIO_DIR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIR_PIN14_Msk (0x1UL << GPIO_DIR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIR_PIN14_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN14_Output (1UL) /*!< Pin set as output */ + +/* Bit 13 : Pin 13 */ +#define GPIO_DIR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIR_PIN13_Msk (0x1UL << GPIO_DIR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIR_PIN13_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN13_Output (1UL) /*!< Pin set as output */ + +/* Bit 12 : Pin 12 */ +#define GPIO_DIR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIR_PIN12_Msk (0x1UL << GPIO_DIR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIR_PIN12_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN12_Output (1UL) /*!< Pin set as output */ + +/* Bit 11 : Pin 11 */ +#define GPIO_DIR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIR_PIN11_Msk (0x1UL << GPIO_DIR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIR_PIN11_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN11_Output (1UL) /*!< Pin set as output */ + +/* Bit 10 : Pin 10 */ +#define GPIO_DIR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIR_PIN10_Msk (0x1UL << GPIO_DIR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIR_PIN10_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN10_Output (1UL) /*!< Pin set as output */ + +/* Bit 9 : Pin 9 */ +#define GPIO_DIR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIR_PIN9_Msk (0x1UL << GPIO_DIR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIR_PIN9_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN9_Output (1UL) /*!< Pin set as output */ + +/* Bit 8 : Pin 8 */ +#define GPIO_DIR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIR_PIN8_Msk (0x1UL << GPIO_DIR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIR_PIN8_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN8_Output (1UL) /*!< Pin set as output */ + +/* Bit 7 : Pin 7 */ +#define GPIO_DIR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIR_PIN7_Msk (0x1UL << GPIO_DIR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIR_PIN7_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN7_Output (1UL) /*!< Pin set as output */ + +/* Bit 6 : Pin 6 */ +#define GPIO_DIR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIR_PIN6_Msk (0x1UL << GPIO_DIR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIR_PIN6_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN6_Output (1UL) /*!< Pin set as output */ + +/* Bit 5 : Pin 5 */ +#define GPIO_DIR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIR_PIN5_Msk (0x1UL << GPIO_DIR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIR_PIN5_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN5_Output (1UL) /*!< Pin set as output */ + +/* Bit 4 : Pin 4 */ +#define GPIO_DIR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIR_PIN4_Msk (0x1UL << GPIO_DIR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIR_PIN4_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN4_Output (1UL) /*!< Pin set as output */ + +/* Bit 3 : Pin 3 */ +#define GPIO_DIR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIR_PIN3_Msk (0x1UL << GPIO_DIR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIR_PIN3_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN3_Output (1UL) /*!< Pin set as output */ + +/* Bit 2 : Pin 2 */ +#define GPIO_DIR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIR_PIN2_Msk (0x1UL << GPIO_DIR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIR_PIN2_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN2_Output (1UL) /*!< Pin set as output */ + +/* Bit 1 : Pin 1 */ +#define GPIO_DIR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIR_PIN1_Msk (0x1UL << GPIO_DIR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIR_PIN1_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN1_Output (1UL) /*!< Pin set as output */ + +/* Bit 0 : Pin 0 */ +#define GPIO_DIR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIR_PIN0_Msk (0x1UL << GPIO_DIR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIR_PIN0_Input (0UL) /*!< Pin set as input */ +#define GPIO_DIR_PIN0_Output (1UL) /*!< Pin set as output */ + +/* Register: GPIO_DIRSET */ +/* Description: DIR set register */ + +/* Bit 31 : Set as output pin 31 */ +#define GPIO_DIRSET_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIRSET_PIN31_Msk (0x1UL << GPIO_DIRSET_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIRSET_PIN31_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN31_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN31_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 30 : Set as output pin 30 */ +#define GPIO_DIRSET_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIRSET_PIN30_Msk (0x1UL << GPIO_DIRSET_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIRSET_PIN30_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN30_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN30_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 29 : Set as output pin 29 */ +#define GPIO_DIRSET_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIRSET_PIN29_Msk (0x1UL << GPIO_DIRSET_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIRSET_PIN29_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN29_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN29_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 28 : Set as output pin 28 */ +#define GPIO_DIRSET_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIRSET_PIN28_Msk (0x1UL << GPIO_DIRSET_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIRSET_PIN28_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN28_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN28_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 27 : Set as output pin 27 */ +#define GPIO_DIRSET_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIRSET_PIN27_Msk (0x1UL << GPIO_DIRSET_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIRSET_PIN27_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN27_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN27_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 26 : Set as output pin 26 */ +#define GPIO_DIRSET_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIRSET_PIN26_Msk (0x1UL << GPIO_DIRSET_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIRSET_PIN26_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN26_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN26_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 25 : Set as output pin 25 */ +#define GPIO_DIRSET_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIRSET_PIN25_Msk (0x1UL << GPIO_DIRSET_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIRSET_PIN25_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN25_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN25_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 24 : Set as output pin 24 */ +#define GPIO_DIRSET_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIRSET_PIN24_Msk (0x1UL << GPIO_DIRSET_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIRSET_PIN24_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN24_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN24_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 23 : Set as output pin 23 */ +#define GPIO_DIRSET_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIRSET_PIN23_Msk (0x1UL << GPIO_DIRSET_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIRSET_PIN23_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN23_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN23_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 22 : Set as output pin 22 */ +#define GPIO_DIRSET_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIRSET_PIN22_Msk (0x1UL << GPIO_DIRSET_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIRSET_PIN22_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN22_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN22_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 21 : Set as output pin 21 */ +#define GPIO_DIRSET_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIRSET_PIN21_Msk (0x1UL << GPIO_DIRSET_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIRSET_PIN21_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN21_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN21_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 20 : Set as output pin 20 */ +#define GPIO_DIRSET_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIRSET_PIN20_Msk (0x1UL << GPIO_DIRSET_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIRSET_PIN20_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN20_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN20_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 19 : Set as output pin 19 */ +#define GPIO_DIRSET_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIRSET_PIN19_Msk (0x1UL << GPIO_DIRSET_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIRSET_PIN19_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN19_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN19_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 18 : Set as output pin 18 */ +#define GPIO_DIRSET_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIRSET_PIN18_Msk (0x1UL << GPIO_DIRSET_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIRSET_PIN18_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN18_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN18_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 17 : Set as output pin 17 */ +#define GPIO_DIRSET_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIRSET_PIN17_Msk (0x1UL << GPIO_DIRSET_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIRSET_PIN17_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN17_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN17_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 16 : Set as output pin 16 */ +#define GPIO_DIRSET_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIRSET_PIN16_Msk (0x1UL << GPIO_DIRSET_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIRSET_PIN16_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN16_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN16_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 15 : Set as output pin 15 */ +#define GPIO_DIRSET_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIRSET_PIN15_Msk (0x1UL << GPIO_DIRSET_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIRSET_PIN15_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN15_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN15_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 14 : Set as output pin 14 */ +#define GPIO_DIRSET_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIRSET_PIN14_Msk (0x1UL << GPIO_DIRSET_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIRSET_PIN14_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN14_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN14_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 13 : Set as output pin 13 */ +#define GPIO_DIRSET_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIRSET_PIN13_Msk (0x1UL << GPIO_DIRSET_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIRSET_PIN13_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN13_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN13_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 12 : Set as output pin 12 */ +#define GPIO_DIRSET_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIRSET_PIN12_Msk (0x1UL << GPIO_DIRSET_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIRSET_PIN12_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN12_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN12_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 11 : Set as output pin 11 */ +#define GPIO_DIRSET_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIRSET_PIN11_Msk (0x1UL << GPIO_DIRSET_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIRSET_PIN11_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN11_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN11_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 10 : Set as output pin 10 */ +#define GPIO_DIRSET_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIRSET_PIN10_Msk (0x1UL << GPIO_DIRSET_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIRSET_PIN10_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN10_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN10_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 9 : Set as output pin 9 */ +#define GPIO_DIRSET_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIRSET_PIN9_Msk (0x1UL << GPIO_DIRSET_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIRSET_PIN9_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN9_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN9_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 8 : Set as output pin 8 */ +#define GPIO_DIRSET_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIRSET_PIN8_Msk (0x1UL << GPIO_DIRSET_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIRSET_PIN8_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN8_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN8_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 7 : Set as output pin 7 */ +#define GPIO_DIRSET_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIRSET_PIN7_Msk (0x1UL << GPIO_DIRSET_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIRSET_PIN7_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN7_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN7_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 6 : Set as output pin 6 */ +#define GPIO_DIRSET_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIRSET_PIN6_Msk (0x1UL << GPIO_DIRSET_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIRSET_PIN6_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN6_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN6_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 5 : Set as output pin 5 */ +#define GPIO_DIRSET_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIRSET_PIN5_Msk (0x1UL << GPIO_DIRSET_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIRSET_PIN5_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN5_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN5_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 4 : Set as output pin 4 */ +#define GPIO_DIRSET_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIRSET_PIN4_Msk (0x1UL << GPIO_DIRSET_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIRSET_PIN4_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN4_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN4_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 3 : Set as output pin 3 */ +#define GPIO_DIRSET_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIRSET_PIN3_Msk (0x1UL << GPIO_DIRSET_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIRSET_PIN3_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN3_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN3_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 2 : Set as output pin 2 */ +#define GPIO_DIRSET_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIRSET_PIN2_Msk (0x1UL << GPIO_DIRSET_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIRSET_PIN2_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN2_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN2_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 1 : Set as output pin 1 */ +#define GPIO_DIRSET_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIRSET_PIN1_Msk (0x1UL << GPIO_DIRSET_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIRSET_PIN1_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN1_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN1_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Bit 0 : Set as output pin 0 */ +#define GPIO_DIRSET_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIRSET_PIN0_Msk (0x1UL << GPIO_DIRSET_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIRSET_PIN0_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRSET_PIN0_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRSET_PIN0_Set (1UL) /*!< Write: writing a '1' sets pin to output; writing a '0' has no effect */ + +/* Register: GPIO_DIRCLR */ +/* Description: DIR clear register */ + +/* Bit 31 : Set as input pin 31 */ +#define GPIO_DIRCLR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_DIRCLR_PIN31_Msk (0x1UL << GPIO_DIRCLR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_DIRCLR_PIN31_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN31_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN31_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 30 : Set as input pin 30 */ +#define GPIO_DIRCLR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_DIRCLR_PIN30_Msk (0x1UL << GPIO_DIRCLR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_DIRCLR_PIN30_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN30_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN30_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 29 : Set as input pin 29 */ +#define GPIO_DIRCLR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_DIRCLR_PIN29_Msk (0x1UL << GPIO_DIRCLR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_DIRCLR_PIN29_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN29_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN29_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 28 : Set as input pin 28 */ +#define GPIO_DIRCLR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_DIRCLR_PIN28_Msk (0x1UL << GPIO_DIRCLR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_DIRCLR_PIN28_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN28_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN28_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 27 : Set as input pin 27 */ +#define GPIO_DIRCLR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_DIRCLR_PIN27_Msk (0x1UL << GPIO_DIRCLR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_DIRCLR_PIN27_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN27_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN27_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 26 : Set as input pin 26 */ +#define GPIO_DIRCLR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_DIRCLR_PIN26_Msk (0x1UL << GPIO_DIRCLR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_DIRCLR_PIN26_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN26_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN26_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 25 : Set as input pin 25 */ +#define GPIO_DIRCLR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_DIRCLR_PIN25_Msk (0x1UL << GPIO_DIRCLR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_DIRCLR_PIN25_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN25_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN25_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 24 : Set as input pin 24 */ +#define GPIO_DIRCLR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_DIRCLR_PIN24_Msk (0x1UL << GPIO_DIRCLR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_DIRCLR_PIN24_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN24_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN24_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 23 : Set as input pin 23 */ +#define GPIO_DIRCLR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_DIRCLR_PIN23_Msk (0x1UL << GPIO_DIRCLR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_DIRCLR_PIN23_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN23_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN23_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 22 : Set as input pin 22 */ +#define GPIO_DIRCLR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_DIRCLR_PIN22_Msk (0x1UL << GPIO_DIRCLR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_DIRCLR_PIN22_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN22_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN22_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 21 : Set as input pin 21 */ +#define GPIO_DIRCLR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_DIRCLR_PIN21_Msk (0x1UL << GPIO_DIRCLR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_DIRCLR_PIN21_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN21_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN21_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 20 : Set as input pin 20 */ +#define GPIO_DIRCLR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_DIRCLR_PIN20_Msk (0x1UL << GPIO_DIRCLR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_DIRCLR_PIN20_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN20_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN20_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 19 : Set as input pin 19 */ +#define GPIO_DIRCLR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_DIRCLR_PIN19_Msk (0x1UL << GPIO_DIRCLR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_DIRCLR_PIN19_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN19_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN19_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 18 : Set as input pin 18 */ +#define GPIO_DIRCLR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_DIRCLR_PIN18_Msk (0x1UL << GPIO_DIRCLR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_DIRCLR_PIN18_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN18_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN18_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 17 : Set as input pin 17 */ +#define GPIO_DIRCLR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_DIRCLR_PIN17_Msk (0x1UL << GPIO_DIRCLR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_DIRCLR_PIN17_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN17_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN17_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 16 : Set as input pin 16 */ +#define GPIO_DIRCLR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_DIRCLR_PIN16_Msk (0x1UL << GPIO_DIRCLR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_DIRCLR_PIN16_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN16_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN16_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 15 : Set as input pin 15 */ +#define GPIO_DIRCLR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_DIRCLR_PIN15_Msk (0x1UL << GPIO_DIRCLR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_DIRCLR_PIN15_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN15_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN15_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 14 : Set as input pin 14 */ +#define GPIO_DIRCLR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_DIRCLR_PIN14_Msk (0x1UL << GPIO_DIRCLR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_DIRCLR_PIN14_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN14_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN14_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 13 : Set as input pin 13 */ +#define GPIO_DIRCLR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_DIRCLR_PIN13_Msk (0x1UL << GPIO_DIRCLR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_DIRCLR_PIN13_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN13_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN13_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 12 : Set as input pin 12 */ +#define GPIO_DIRCLR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_DIRCLR_PIN12_Msk (0x1UL << GPIO_DIRCLR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_DIRCLR_PIN12_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN12_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN12_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 11 : Set as input pin 11 */ +#define GPIO_DIRCLR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_DIRCLR_PIN11_Msk (0x1UL << GPIO_DIRCLR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_DIRCLR_PIN11_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN11_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN11_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 10 : Set as input pin 10 */ +#define GPIO_DIRCLR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_DIRCLR_PIN10_Msk (0x1UL << GPIO_DIRCLR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_DIRCLR_PIN10_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN10_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN10_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 9 : Set as input pin 9 */ +#define GPIO_DIRCLR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_DIRCLR_PIN9_Msk (0x1UL << GPIO_DIRCLR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_DIRCLR_PIN9_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN9_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN9_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 8 : Set as input pin 8 */ +#define GPIO_DIRCLR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_DIRCLR_PIN8_Msk (0x1UL << GPIO_DIRCLR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_DIRCLR_PIN8_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN8_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN8_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 7 : Set as input pin 7 */ +#define GPIO_DIRCLR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_DIRCLR_PIN7_Msk (0x1UL << GPIO_DIRCLR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_DIRCLR_PIN7_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN7_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN7_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 6 : Set as input pin 6 */ +#define GPIO_DIRCLR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_DIRCLR_PIN6_Msk (0x1UL << GPIO_DIRCLR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_DIRCLR_PIN6_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN6_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN6_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 5 : Set as input pin 5 */ +#define GPIO_DIRCLR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_DIRCLR_PIN5_Msk (0x1UL << GPIO_DIRCLR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_DIRCLR_PIN5_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN5_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN5_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 4 : Set as input pin 4 */ +#define GPIO_DIRCLR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_DIRCLR_PIN4_Msk (0x1UL << GPIO_DIRCLR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_DIRCLR_PIN4_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN4_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN4_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 3 : Set as input pin 3 */ +#define GPIO_DIRCLR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_DIRCLR_PIN3_Msk (0x1UL << GPIO_DIRCLR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_DIRCLR_PIN3_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN3_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN3_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 2 : Set as input pin 2 */ +#define GPIO_DIRCLR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_DIRCLR_PIN2_Msk (0x1UL << GPIO_DIRCLR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_DIRCLR_PIN2_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN2_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN2_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 1 : Set as input pin 1 */ +#define GPIO_DIRCLR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_DIRCLR_PIN1_Msk (0x1UL << GPIO_DIRCLR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_DIRCLR_PIN1_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN1_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN1_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Bit 0 : Set as input pin 0 */ +#define GPIO_DIRCLR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_DIRCLR_PIN0_Msk (0x1UL << GPIO_DIRCLR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_DIRCLR_PIN0_Input (0UL) /*!< Read: pin set as input */ +#define GPIO_DIRCLR_PIN0_Output (1UL) /*!< Read: pin set as output */ +#define GPIO_DIRCLR_PIN0_Clear (1UL) /*!< Write: writing a '1' sets pin to input; writing a '0' has no effect */ + +/* Register: GPIO_LATCH */ +/* Description: Latch register indicating what GPIO pins that have met the criteria set in the PIN_CNF[n].SENSE registers */ + +/* Bit 31 : Status on whether PIN31 has met criteria set in PIN_CNF31.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ +#define GPIO_LATCH_PIN31_Msk (0x1UL << GPIO_LATCH_PIN31_Pos) /*!< Bit mask of PIN31 field. */ +#define GPIO_LATCH_PIN31_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN31_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 30 : Status on whether PIN30 has met criteria set in PIN_CNF30.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ +#define GPIO_LATCH_PIN30_Msk (0x1UL << GPIO_LATCH_PIN30_Pos) /*!< Bit mask of PIN30 field. */ +#define GPIO_LATCH_PIN30_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN30_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 29 : Status on whether PIN29 has met criteria set in PIN_CNF29.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ +#define GPIO_LATCH_PIN29_Msk (0x1UL << GPIO_LATCH_PIN29_Pos) /*!< Bit mask of PIN29 field. */ +#define GPIO_LATCH_PIN29_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN29_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 28 : Status on whether PIN28 has met criteria set in PIN_CNF28.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ +#define GPIO_LATCH_PIN28_Msk (0x1UL << GPIO_LATCH_PIN28_Pos) /*!< Bit mask of PIN28 field. */ +#define GPIO_LATCH_PIN28_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN28_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 27 : Status on whether PIN27 has met criteria set in PIN_CNF27.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ +#define GPIO_LATCH_PIN27_Msk (0x1UL << GPIO_LATCH_PIN27_Pos) /*!< Bit mask of PIN27 field. */ +#define GPIO_LATCH_PIN27_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN27_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 26 : Status on whether PIN26 has met criteria set in PIN_CNF26.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ +#define GPIO_LATCH_PIN26_Msk (0x1UL << GPIO_LATCH_PIN26_Pos) /*!< Bit mask of PIN26 field. */ +#define GPIO_LATCH_PIN26_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN26_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 25 : Status on whether PIN25 has met criteria set in PIN_CNF25.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ +#define GPIO_LATCH_PIN25_Msk (0x1UL << GPIO_LATCH_PIN25_Pos) /*!< Bit mask of PIN25 field. */ +#define GPIO_LATCH_PIN25_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN25_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 24 : Status on whether PIN24 has met criteria set in PIN_CNF24.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ +#define GPIO_LATCH_PIN24_Msk (0x1UL << GPIO_LATCH_PIN24_Pos) /*!< Bit mask of PIN24 field. */ +#define GPIO_LATCH_PIN24_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN24_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 23 : Status on whether PIN23 has met criteria set in PIN_CNF23.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ +#define GPIO_LATCH_PIN23_Msk (0x1UL << GPIO_LATCH_PIN23_Pos) /*!< Bit mask of PIN23 field. */ +#define GPIO_LATCH_PIN23_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN23_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 22 : Status on whether PIN22 has met criteria set in PIN_CNF22.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ +#define GPIO_LATCH_PIN22_Msk (0x1UL << GPIO_LATCH_PIN22_Pos) /*!< Bit mask of PIN22 field. */ +#define GPIO_LATCH_PIN22_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN22_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 21 : Status on whether PIN21 has met criteria set in PIN_CNF21.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ +#define GPIO_LATCH_PIN21_Msk (0x1UL << GPIO_LATCH_PIN21_Pos) /*!< Bit mask of PIN21 field. */ +#define GPIO_LATCH_PIN21_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN21_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 20 : Status on whether PIN20 has met criteria set in PIN_CNF20.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ +#define GPIO_LATCH_PIN20_Msk (0x1UL << GPIO_LATCH_PIN20_Pos) /*!< Bit mask of PIN20 field. */ +#define GPIO_LATCH_PIN20_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN20_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 19 : Status on whether PIN19 has met criteria set in PIN_CNF19.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ +#define GPIO_LATCH_PIN19_Msk (0x1UL << GPIO_LATCH_PIN19_Pos) /*!< Bit mask of PIN19 field. */ +#define GPIO_LATCH_PIN19_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN19_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 18 : Status on whether PIN18 has met criteria set in PIN_CNF18.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ +#define GPIO_LATCH_PIN18_Msk (0x1UL << GPIO_LATCH_PIN18_Pos) /*!< Bit mask of PIN18 field. */ +#define GPIO_LATCH_PIN18_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN18_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 17 : Status on whether PIN17 has met criteria set in PIN_CNF17.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ +#define GPIO_LATCH_PIN17_Msk (0x1UL << GPIO_LATCH_PIN17_Pos) /*!< Bit mask of PIN17 field. */ +#define GPIO_LATCH_PIN17_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN17_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 16 : Status on whether PIN16 has met criteria set in PIN_CNF16.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ +#define GPIO_LATCH_PIN16_Msk (0x1UL << GPIO_LATCH_PIN16_Pos) /*!< Bit mask of PIN16 field. */ +#define GPIO_LATCH_PIN16_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN16_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 15 : Status on whether PIN15 has met criteria set in PIN_CNF15.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ +#define GPIO_LATCH_PIN15_Msk (0x1UL << GPIO_LATCH_PIN15_Pos) /*!< Bit mask of PIN15 field. */ +#define GPIO_LATCH_PIN15_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN15_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 14 : Status on whether PIN14 has met criteria set in PIN_CNF14.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ +#define GPIO_LATCH_PIN14_Msk (0x1UL << GPIO_LATCH_PIN14_Pos) /*!< Bit mask of PIN14 field. */ +#define GPIO_LATCH_PIN14_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN14_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 13 : Status on whether PIN13 has met criteria set in PIN_CNF13.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ +#define GPIO_LATCH_PIN13_Msk (0x1UL << GPIO_LATCH_PIN13_Pos) /*!< Bit mask of PIN13 field. */ +#define GPIO_LATCH_PIN13_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN13_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 12 : Status on whether PIN12 has met criteria set in PIN_CNF12.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ +#define GPIO_LATCH_PIN12_Msk (0x1UL << GPIO_LATCH_PIN12_Pos) /*!< Bit mask of PIN12 field. */ +#define GPIO_LATCH_PIN12_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN12_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 11 : Status on whether PIN11 has met criteria set in PIN_CNF11.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ +#define GPIO_LATCH_PIN11_Msk (0x1UL << GPIO_LATCH_PIN11_Pos) /*!< Bit mask of PIN11 field. */ +#define GPIO_LATCH_PIN11_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN11_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 10 : Status on whether PIN10 has met criteria set in PIN_CNF10.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ +#define GPIO_LATCH_PIN10_Msk (0x1UL << GPIO_LATCH_PIN10_Pos) /*!< Bit mask of PIN10 field. */ +#define GPIO_LATCH_PIN10_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN10_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 9 : Status on whether PIN9 has met criteria set in PIN_CNF9.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ +#define GPIO_LATCH_PIN9_Msk (0x1UL << GPIO_LATCH_PIN9_Pos) /*!< Bit mask of PIN9 field. */ +#define GPIO_LATCH_PIN9_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN9_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 8 : Status on whether PIN8 has met criteria set in PIN_CNF8.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ +#define GPIO_LATCH_PIN8_Msk (0x1UL << GPIO_LATCH_PIN8_Pos) /*!< Bit mask of PIN8 field. */ +#define GPIO_LATCH_PIN8_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN8_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 7 : Status on whether PIN7 has met criteria set in PIN_CNF7.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ +#define GPIO_LATCH_PIN7_Msk (0x1UL << GPIO_LATCH_PIN7_Pos) /*!< Bit mask of PIN7 field. */ +#define GPIO_LATCH_PIN7_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN7_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 6 : Status on whether PIN6 has met criteria set in PIN_CNF6.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ +#define GPIO_LATCH_PIN6_Msk (0x1UL << GPIO_LATCH_PIN6_Pos) /*!< Bit mask of PIN6 field. */ +#define GPIO_LATCH_PIN6_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN6_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 5 : Status on whether PIN5 has met criteria set in PIN_CNF5.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ +#define GPIO_LATCH_PIN5_Msk (0x1UL << GPIO_LATCH_PIN5_Pos) /*!< Bit mask of PIN5 field. */ +#define GPIO_LATCH_PIN5_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN5_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 4 : Status on whether PIN4 has met criteria set in PIN_CNF4.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ +#define GPIO_LATCH_PIN4_Msk (0x1UL << GPIO_LATCH_PIN4_Pos) /*!< Bit mask of PIN4 field. */ +#define GPIO_LATCH_PIN4_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN4_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 3 : Status on whether PIN3 has met criteria set in PIN_CNF3.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ +#define GPIO_LATCH_PIN3_Msk (0x1UL << GPIO_LATCH_PIN3_Pos) /*!< Bit mask of PIN3 field. */ +#define GPIO_LATCH_PIN3_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN3_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 2 : Status on whether PIN2 has met criteria set in PIN_CNF2.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ +#define GPIO_LATCH_PIN2_Msk (0x1UL << GPIO_LATCH_PIN2_Pos) /*!< Bit mask of PIN2 field. */ +#define GPIO_LATCH_PIN2_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN2_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 1 : Status on whether PIN1 has met criteria set in PIN_CNF1.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ +#define GPIO_LATCH_PIN1_Msk (0x1UL << GPIO_LATCH_PIN1_Pos) /*!< Bit mask of PIN1 field. */ +#define GPIO_LATCH_PIN1_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN1_Latched (1UL) /*!< Criteria has been met */ + +/* Bit 0 : Status on whether PIN0 has met criteria set in PIN_CNF0.SENSE register. Write '1' to clear. */ +#define GPIO_LATCH_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ +#define GPIO_LATCH_PIN0_Msk (0x1UL << GPIO_LATCH_PIN0_Pos) /*!< Bit mask of PIN0 field. */ +#define GPIO_LATCH_PIN0_NotLatched (0UL) /*!< Criteria has not been met */ +#define GPIO_LATCH_PIN0_Latched (1UL) /*!< Criteria has been met */ + +/* Register: GPIO_DETECTMODE */ +/* Description: Select between default DETECT signal behaviour and LDETECT mode */ + +/* Bit 0 : Select between default DETECT signal behaviour and LDETECT mode */ +#define GPIO_DETECTMODE_DETECTMODE_Pos (0UL) /*!< Position of DETECTMODE field. */ +#define GPIO_DETECTMODE_DETECTMODE_Msk (0x1UL << GPIO_DETECTMODE_DETECTMODE_Pos) /*!< Bit mask of DETECTMODE field. */ +#define GPIO_DETECTMODE_DETECTMODE_Default (0UL) /*!< DETECT directly connected to PIN DETECT signals */ +#define GPIO_DETECTMODE_DETECTMODE_LDETECT (1UL) /*!< Use the latched LDETECT behaviour */ + +/* Register: GPIO_PIN_CNF */ +/* Description: Description collection[0]: Configuration of GPIO pins */ + +/* Bits 17..16 : Pin sensing mechanism */ +#define GPIO_PIN_CNF_SENSE_Pos (16UL) /*!< Position of SENSE field. */ +#define GPIO_PIN_CNF_SENSE_Msk (0x3UL << GPIO_PIN_CNF_SENSE_Pos) /*!< Bit mask of SENSE field. */ +#define GPIO_PIN_CNF_SENSE_Disabled (0UL) /*!< Disabled */ +#define GPIO_PIN_CNF_SENSE_High (2UL) /*!< Sense for high level */ +#define GPIO_PIN_CNF_SENSE_Low (3UL) /*!< Sense for low level */ + +/* Bits 10..8 : Drive configuration */ +#define GPIO_PIN_CNF_DRIVE_Pos (8UL) /*!< Position of DRIVE field. */ +#define GPIO_PIN_CNF_DRIVE_Msk (0x7UL << GPIO_PIN_CNF_DRIVE_Pos) /*!< Bit mask of DRIVE field. */ +#define GPIO_PIN_CNF_DRIVE_S0S1 (0UL) /*!< Standard '0', standard '1' */ +#define GPIO_PIN_CNF_DRIVE_H0S1 (1UL) /*!< High drive '0', standard '1' */ +#define GPIO_PIN_CNF_DRIVE_S0H1 (2UL) /*!< Standard '0', high drive '1' */ +#define GPIO_PIN_CNF_DRIVE_H0H1 (3UL) /*!< High drive '0', high 'drive '1'' */ +#define GPIO_PIN_CNF_DRIVE_D0S1 (4UL) /*!< Disconnect '0' standard '1' (normally used for wired-or connections) */ +#define GPIO_PIN_CNF_DRIVE_D0H1 (5UL) /*!< Disconnect '0', high drive '1' (normally used for wired-or connections) */ +#define GPIO_PIN_CNF_DRIVE_S0D1 (6UL) /*!< Standard '0'. disconnect '1' (normally used for wired-and connections) */ +#define GPIO_PIN_CNF_DRIVE_H0D1 (7UL) /*!< High drive '0', disconnect '1' (normally used for wired-and connections) */ + +/* Bits 3..2 : Pull configuration */ +#define GPIO_PIN_CNF_PULL_Pos (2UL) /*!< Position of PULL field. */ +#define GPIO_PIN_CNF_PULL_Msk (0x3UL << GPIO_PIN_CNF_PULL_Pos) /*!< Bit mask of PULL field. */ +#define GPIO_PIN_CNF_PULL_Disabled (0UL) /*!< No pull */ +#define GPIO_PIN_CNF_PULL_Pulldown (1UL) /*!< Pull down on pin */ +#define GPIO_PIN_CNF_PULL_Pullup (3UL) /*!< Pull up on pin */ + +/* Bit 1 : Connect or disconnect input buffer */ +#define GPIO_PIN_CNF_INPUT_Pos (1UL) /*!< Position of INPUT field. */ +#define GPIO_PIN_CNF_INPUT_Msk (0x1UL << GPIO_PIN_CNF_INPUT_Pos) /*!< Bit mask of INPUT field. */ +#define GPIO_PIN_CNF_INPUT_Connect (0UL) /*!< Connect input buffer */ +#define GPIO_PIN_CNF_INPUT_Disconnect (1UL) /*!< Disconnect input buffer */ + +/* Bit 0 : Pin direction. Same physical register as DIR register */ +#define GPIO_PIN_CNF_DIR_Pos (0UL) /*!< Position of DIR field. */ +#define GPIO_PIN_CNF_DIR_Msk (0x1UL << GPIO_PIN_CNF_DIR_Pos) /*!< Bit mask of DIR field. */ +#define GPIO_PIN_CNF_DIR_Input (0UL) /*!< Configure pin as an input pin */ +#define GPIO_PIN_CNF_DIR_Output (1UL) /*!< Configure pin as an output pin */ + + +/* Peripheral: PDM */ +/* Description: Pulse Density Modulation (Digital Microphone) Interface */ + +/* Register: PDM_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 2 : Enable or disable interrupt for END event */ +#define PDM_INTEN_END_Pos (2UL) /*!< Position of END field. */ +#define PDM_INTEN_END_Msk (0x1UL << PDM_INTEN_END_Pos) /*!< Bit mask of END field. */ +#define PDM_INTEN_END_Disabled (0UL) /*!< Disable */ +#define PDM_INTEN_END_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STOPPED event */ +#define PDM_INTEN_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PDM_INTEN_STOPPED_Msk (0x1UL << PDM_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PDM_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define PDM_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for STARTED event */ +#define PDM_INTEN_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define PDM_INTEN_STARTED_Msk (0x1UL << PDM_INTEN_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define PDM_INTEN_STARTED_Disabled (0UL) /*!< Disable */ +#define PDM_INTEN_STARTED_Enabled (1UL) /*!< Enable */ + +/* Register: PDM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 2 : Write '1' to Enable interrupt for END event */ +#define PDM_INTENSET_END_Pos (2UL) /*!< Position of END field. */ +#define PDM_INTENSET_END_Msk (0x1UL << PDM_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define PDM_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define PDM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PDM_INTENSET_STOPPED_Msk (0x1UL << PDM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PDM_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for STARTED event */ +#define PDM_INTENSET_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define PDM_INTENSET_STARTED_Msk (0x1UL << PDM_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define PDM_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Register: PDM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 2 : Write '1' to Disable interrupt for END event */ +#define PDM_INTENCLR_END_Pos (2UL) /*!< Position of END field. */ +#define PDM_INTENCLR_END_Msk (0x1UL << PDM_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define PDM_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define PDM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PDM_INTENCLR_STOPPED_Msk (0x1UL << PDM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PDM_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for STARTED event */ +#define PDM_INTENCLR_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define PDM_INTENCLR_STARTED_Msk (0x1UL << PDM_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define PDM_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define PDM_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define PDM_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Register: PDM_ENABLE */ +/* Description: PDM module enable register */ + +/* Bit 0 : Enable or disable PDM module */ +#define PDM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define PDM_ENABLE_ENABLE_Msk (0x1UL << PDM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define PDM_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define PDM_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: PDM_PDMCLKCTRL */ +/* Description: PDM clock generator control */ + +/* Bits 31..0 : PDM_CLK frequency */ +#define PDM_PDMCLKCTRL_FREQ_Pos (0UL) /*!< Position of FREQ field. */ +#define PDM_PDMCLKCTRL_FREQ_Msk (0xFFFFFFFFUL << PDM_PDMCLKCTRL_FREQ_Pos) /*!< Bit mask of FREQ field. */ +#define PDM_PDMCLKCTRL_FREQ_1000K (0x08000000UL) /*!< PDM_CLK = 32 MHz / 32 = 1.000 MHz */ +#define PDM_PDMCLKCTRL_FREQ_Default (0x08400000UL) /*!< PDM_CLK = 32 MHz / 31 = 1.032 MHz. Nominal clock for RATIO=Ratio64. */ +#define PDM_PDMCLKCTRL_FREQ_1067K (0x08800000UL) /*!< PDM_CLK = 32 MHz / 30 = 1.067 MHz */ +#define PDM_PDMCLKCTRL_FREQ_1231K (0x09800000UL) /*!< PDM_CLK = 32 MHz / 26 = 1.231 MHz */ +#define PDM_PDMCLKCTRL_FREQ_1280K (0x0A000000UL) /*!< PDM_CLK = 32 MHz / 25 = 1.280 MHz. Nominal clock for RATIO=Ratio80. */ +#define PDM_PDMCLKCTRL_FREQ_1333K (0x0A800000UL) /*!< PDM_CLK = 32 MHz / 24 = 1.333 MHz */ + +/* Register: PDM_MODE */ +/* Description: Defines the routing of the connected PDM microphones' signals */ + +/* Bit 1 : Defines on which PDM_CLK edge Left (or mono) is sampled */ +#define PDM_MODE_EDGE_Pos (1UL) /*!< Position of EDGE field. */ +#define PDM_MODE_EDGE_Msk (0x1UL << PDM_MODE_EDGE_Pos) /*!< Bit mask of EDGE field. */ +#define PDM_MODE_EDGE_LeftFalling (0UL) /*!< Left (or mono) is sampled on falling edge of PDM_CLK */ +#define PDM_MODE_EDGE_LeftRising (1UL) /*!< Left (or mono) is sampled on rising edge of PDM_CLK */ + +/* Bit 0 : Mono or stereo operation */ +#define PDM_MODE_OPERATION_Pos (0UL) /*!< Position of OPERATION field. */ +#define PDM_MODE_OPERATION_Msk (0x1UL << PDM_MODE_OPERATION_Pos) /*!< Bit mask of OPERATION field. */ +#define PDM_MODE_OPERATION_Stereo (0UL) /*!< Sample and store one pair (Left + Right) of 16bit samples per RAM word R=[31:16]; L=[15:0] */ +#define PDM_MODE_OPERATION_Mono (1UL) /*!< Sample and store two successive Left samples (16 bit each) per RAM word L1=[31:16]; L0=[15:0] */ + +/* Register: PDM_GAINL */ +/* Description: Left output gain adjustment */ + +/* Bits 6..0 : Left output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) 0x00 -20 dB gain adjust 0x01 -19.5 dB gain adjust (...) 0x27 -0.5 dB gain adjust 0x28 0 dB gain adjust 0x29 +0.5 dB gain adjust (...) 0x4F +19.5 dB gain adjust 0x50 +20 dB gain adjust */ +#define PDM_GAINL_GAINL_Pos (0UL) /*!< Position of GAINL field. */ +#define PDM_GAINL_GAINL_Msk (0x7FUL << PDM_GAINL_GAINL_Pos) /*!< Bit mask of GAINL field. */ +#define PDM_GAINL_GAINL_MinGain (0x00UL) /*!< -20dB gain adjustment (minimum) */ +#define PDM_GAINL_GAINL_DefaultGain (0x28UL) /*!< 0dB gain adjustment ('2500 RMS' requirement) */ +#define PDM_GAINL_GAINL_MaxGain (0x50UL) /*!< +20dB gain adjustment (maximum) */ + +/* Register: PDM_GAINR */ +/* Description: Right output gain adjustment */ + +/* Bits 7..0 : Right output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) */ +#define PDM_GAINR_GAINR_Pos (0UL) /*!< Position of GAINR field. */ +#define PDM_GAINR_GAINR_Msk (0xFFUL << PDM_GAINR_GAINR_Pos) /*!< Bit mask of GAINR field. */ +#define PDM_GAINR_GAINR_MinGain (0x00UL) /*!< -20dB gain adjustment (minimum) */ +#define PDM_GAINR_GAINR_DefaultGain (0x28UL) /*!< 0dB gain adjustment ('2500 RMS' requirement) */ +#define PDM_GAINR_GAINR_MaxGain (0x50UL) /*!< +20dB gain adjustment (maximum) */ + +/* Register: PDM_RATIO */ +/* Description: Selects the ratio between PDM_CLK and output sample rate. Change PDMCLKCTRL accordingly. */ + +/* Bit 0 : Selects the ratio between PDM_CLK and output sample rate */ +#define PDM_RATIO_RATIO_Pos (0UL) /*!< Position of RATIO field. */ +#define PDM_RATIO_RATIO_Msk (0x1UL << PDM_RATIO_RATIO_Pos) /*!< Bit mask of RATIO field. */ +#define PDM_RATIO_RATIO_Ratio64 (0UL) /*!< Ratio of 64 */ +#define PDM_RATIO_RATIO_Ratio80 (1UL) /*!< Ratio of 80 */ + +/* Register: PDM_PSEL_CLK */ +/* Description: Pin number configuration for PDM CLK signal */ + +/* Bit 31 : Connection */ +#define PDM_PSEL_CLK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define PDM_PSEL_CLK_CONNECT_Msk (0x1UL << PDM_PSEL_CLK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define PDM_PSEL_CLK_CONNECT_Connected (0UL) /*!< Connect */ +#define PDM_PSEL_CLK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define PDM_PSEL_CLK_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define PDM_PSEL_CLK_PORT_Msk (0x3UL << PDM_PSEL_CLK_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define PDM_PSEL_CLK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define PDM_PSEL_CLK_PIN_Msk (0x1FUL << PDM_PSEL_CLK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: PDM_PSEL_DIN */ +/* Description: Pin number configuration for PDM DIN signal */ + +/* Bit 31 : Connection */ +#define PDM_PSEL_DIN_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define PDM_PSEL_DIN_CONNECT_Msk (0x1UL << PDM_PSEL_DIN_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define PDM_PSEL_DIN_CONNECT_Connected (0UL) /*!< Connect */ +#define PDM_PSEL_DIN_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define PDM_PSEL_DIN_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define PDM_PSEL_DIN_PORT_Msk (0x3UL << PDM_PSEL_DIN_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define PDM_PSEL_DIN_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define PDM_PSEL_DIN_PIN_Msk (0x1FUL << PDM_PSEL_DIN_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: PDM_SAMPLE_PTR */ +/* Description: RAM address pointer to write samples to with EasyDMA */ + +/* Bits 31..0 : Address to write PDM samples to over DMA */ +#define PDM_SAMPLE_PTR_SAMPLEPTR_Pos (0UL) /*!< Position of SAMPLEPTR field. */ +#define PDM_SAMPLE_PTR_SAMPLEPTR_Msk (0xFFFFFFFFUL << PDM_SAMPLE_PTR_SAMPLEPTR_Pos) /*!< Bit mask of SAMPLEPTR field. */ + +/* Register: PDM_SAMPLE_MAXCNT */ +/* Description: Number of samples to allocate memory for in EasyDMA mode */ + +/* Bits 14..0 : Length of DMA RAM allocation in number of samples */ +#define PDM_SAMPLE_MAXCNT_BUFFSIZE_Pos (0UL) /*!< Position of BUFFSIZE field. */ +#define PDM_SAMPLE_MAXCNT_BUFFSIZE_Msk (0x7FFFUL << PDM_SAMPLE_MAXCNT_BUFFSIZE_Pos) /*!< Bit mask of BUFFSIZE field. */ + + +/* Peripheral: POWER */ +/* Description: Power control */ + +/* Register: POWER_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 9 : Write '1' to Enable interrupt for USBPWRRDY event */ +#define POWER_INTENSET_USBPWRRDY_Pos (9UL) /*!< Position of USBPWRRDY field. */ +#define POWER_INTENSET_USBPWRRDY_Msk (0x1UL << POWER_INTENSET_USBPWRRDY_Pos) /*!< Bit mask of USBPWRRDY field. */ +#define POWER_INTENSET_USBPWRRDY_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_USBPWRRDY_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_USBPWRRDY_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for USBREMOVED event */ +#define POWER_INTENSET_USBREMOVED_Pos (8UL) /*!< Position of USBREMOVED field. */ +#define POWER_INTENSET_USBREMOVED_Msk (0x1UL << POWER_INTENSET_USBREMOVED_Pos) /*!< Bit mask of USBREMOVED field. */ +#define POWER_INTENSET_USBREMOVED_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_USBREMOVED_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_USBREMOVED_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for USBDETECTED event */ +#define POWER_INTENSET_USBDETECTED_Pos (7UL) /*!< Position of USBDETECTED field. */ +#define POWER_INTENSET_USBDETECTED_Msk (0x1UL << POWER_INTENSET_USBDETECTED_Pos) /*!< Bit mask of USBDETECTED field. */ +#define POWER_INTENSET_USBDETECTED_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_USBDETECTED_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_USBDETECTED_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for SLEEPEXIT event */ +#define POWER_INTENSET_SLEEPEXIT_Pos (6UL) /*!< Position of SLEEPEXIT field. */ +#define POWER_INTENSET_SLEEPEXIT_Msk (0x1UL << POWER_INTENSET_SLEEPEXIT_Pos) /*!< Bit mask of SLEEPEXIT field. */ +#define POWER_INTENSET_SLEEPEXIT_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_SLEEPEXIT_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_SLEEPEXIT_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for SLEEPENTER event */ +#define POWER_INTENSET_SLEEPENTER_Pos (5UL) /*!< Position of SLEEPENTER field. */ +#define POWER_INTENSET_SLEEPENTER_Msk (0x1UL << POWER_INTENSET_SLEEPENTER_Pos) /*!< Bit mask of SLEEPENTER field. */ +#define POWER_INTENSET_SLEEPENTER_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_SLEEPENTER_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_SLEEPENTER_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for POFWARN event */ +#define POWER_INTENSET_POFWARN_Pos (2UL) /*!< Position of POFWARN field. */ +#define POWER_INTENSET_POFWARN_Msk (0x1UL << POWER_INTENSET_POFWARN_Pos) /*!< Bit mask of POFWARN field. */ +#define POWER_INTENSET_POFWARN_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENSET_POFWARN_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENSET_POFWARN_Set (1UL) /*!< Enable */ + +/* Register: POWER_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 9 : Write '1' to Disable interrupt for USBPWRRDY event */ +#define POWER_INTENCLR_USBPWRRDY_Pos (9UL) /*!< Position of USBPWRRDY field. */ +#define POWER_INTENCLR_USBPWRRDY_Msk (0x1UL << POWER_INTENCLR_USBPWRRDY_Pos) /*!< Bit mask of USBPWRRDY field. */ +#define POWER_INTENCLR_USBPWRRDY_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_USBPWRRDY_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_USBPWRRDY_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for USBREMOVED event */ +#define POWER_INTENCLR_USBREMOVED_Pos (8UL) /*!< Position of USBREMOVED field. */ +#define POWER_INTENCLR_USBREMOVED_Msk (0x1UL << POWER_INTENCLR_USBREMOVED_Pos) /*!< Bit mask of USBREMOVED field. */ +#define POWER_INTENCLR_USBREMOVED_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_USBREMOVED_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_USBREMOVED_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for USBDETECTED event */ +#define POWER_INTENCLR_USBDETECTED_Pos (7UL) /*!< Position of USBDETECTED field. */ +#define POWER_INTENCLR_USBDETECTED_Msk (0x1UL << POWER_INTENCLR_USBDETECTED_Pos) /*!< Bit mask of USBDETECTED field. */ +#define POWER_INTENCLR_USBDETECTED_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_USBDETECTED_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_USBDETECTED_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for SLEEPEXIT event */ +#define POWER_INTENCLR_SLEEPEXIT_Pos (6UL) /*!< Position of SLEEPEXIT field. */ +#define POWER_INTENCLR_SLEEPEXIT_Msk (0x1UL << POWER_INTENCLR_SLEEPEXIT_Pos) /*!< Bit mask of SLEEPEXIT field. */ +#define POWER_INTENCLR_SLEEPEXIT_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_SLEEPEXIT_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_SLEEPEXIT_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for SLEEPENTER event */ +#define POWER_INTENCLR_SLEEPENTER_Pos (5UL) /*!< Position of SLEEPENTER field. */ +#define POWER_INTENCLR_SLEEPENTER_Msk (0x1UL << POWER_INTENCLR_SLEEPENTER_Pos) /*!< Bit mask of SLEEPENTER field. */ +#define POWER_INTENCLR_SLEEPENTER_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_SLEEPENTER_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_SLEEPENTER_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for POFWARN event */ +#define POWER_INTENCLR_POFWARN_Pos (2UL) /*!< Position of POFWARN field. */ +#define POWER_INTENCLR_POFWARN_Msk (0x1UL << POWER_INTENCLR_POFWARN_Pos) /*!< Bit mask of POFWARN field. */ +#define POWER_INTENCLR_POFWARN_Disabled (0UL) /*!< Read: Disabled */ +#define POWER_INTENCLR_POFWARN_Enabled (1UL) /*!< Read: Enabled */ +#define POWER_INTENCLR_POFWARN_Clear (1UL) /*!< Disable */ + +/* Register: POWER_RESETREAS */ +/* Description: Reset reason */ + +/* Bit 20 : Reset due to wake up from System OFF mode by Vbus rising into valid range */ +#define POWER_RESETREAS_VBUS_Pos (20UL) /*!< Position of VBUS field. */ +#define POWER_RESETREAS_VBUS_Msk (0x1UL << POWER_RESETREAS_VBUS_Pos) /*!< Bit mask of VBUS field. */ +#define POWER_RESETREAS_VBUS_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_VBUS_Detected (1UL) /*!< Detected */ + +/* Bit 19 : Reset due to wake up from System OFF mode by NFC field detect */ +#define POWER_RESETREAS_NFC_Pos (19UL) /*!< Position of NFC field. */ +#define POWER_RESETREAS_NFC_Msk (0x1UL << POWER_RESETREAS_NFC_Pos) /*!< Bit mask of NFC field. */ +#define POWER_RESETREAS_NFC_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_NFC_Detected (1UL) /*!< Detected */ + +/* Bit 18 : Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode */ +#define POWER_RESETREAS_DIF_Pos (18UL) /*!< Position of DIF field. */ +#define POWER_RESETREAS_DIF_Msk (0x1UL << POWER_RESETREAS_DIF_Pos) /*!< Bit mask of DIF field. */ +#define POWER_RESETREAS_DIF_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_DIF_Detected (1UL) /*!< Detected */ + +/* Bit 17 : Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP */ +#define POWER_RESETREAS_LPCOMP_Pos (17UL) /*!< Position of LPCOMP field. */ +#define POWER_RESETREAS_LPCOMP_Msk (0x1UL << POWER_RESETREAS_LPCOMP_Pos) /*!< Bit mask of LPCOMP field. */ +#define POWER_RESETREAS_LPCOMP_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_LPCOMP_Detected (1UL) /*!< Detected */ + +/* Bit 16 : Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO */ +#define POWER_RESETREAS_OFF_Pos (16UL) /*!< Position of OFF field. */ +#define POWER_RESETREAS_OFF_Msk (0x1UL << POWER_RESETREAS_OFF_Pos) /*!< Bit mask of OFF field. */ +#define POWER_RESETREAS_OFF_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_OFF_Detected (1UL) /*!< Detected */ + +/* Bit 3 : Reset from CPU lock-up detected */ +#define POWER_RESETREAS_LOCKUP_Pos (3UL) /*!< Position of LOCKUP field. */ +#define POWER_RESETREAS_LOCKUP_Msk (0x1UL << POWER_RESETREAS_LOCKUP_Pos) /*!< Bit mask of LOCKUP field. */ +#define POWER_RESETREAS_LOCKUP_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_LOCKUP_Detected (1UL) /*!< Detected */ + +/* Bit 2 : Reset from soft reset detected */ +#define POWER_RESETREAS_SREQ_Pos (2UL) /*!< Position of SREQ field. */ +#define POWER_RESETREAS_SREQ_Msk (0x1UL << POWER_RESETREAS_SREQ_Pos) /*!< Bit mask of SREQ field. */ +#define POWER_RESETREAS_SREQ_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_SREQ_Detected (1UL) /*!< Detected */ + +/* Bit 1 : Reset from watchdog detected */ +#define POWER_RESETREAS_DOG_Pos (1UL) /*!< Position of DOG field. */ +#define POWER_RESETREAS_DOG_Msk (0x1UL << POWER_RESETREAS_DOG_Pos) /*!< Bit mask of DOG field. */ +#define POWER_RESETREAS_DOG_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_DOG_Detected (1UL) /*!< Detected */ + +/* Bit 0 : Reset from pin-reset detected */ +#define POWER_RESETREAS_RESETPIN_Pos (0UL) /*!< Position of RESETPIN field. */ +#define POWER_RESETREAS_RESETPIN_Msk (0x1UL << POWER_RESETREAS_RESETPIN_Pos) /*!< Bit mask of RESETPIN field. */ +#define POWER_RESETREAS_RESETPIN_NotDetected (0UL) /*!< Not detected */ +#define POWER_RESETREAS_RESETPIN_Detected (1UL) /*!< Detected */ + +/* Register: POWER_RAMSTATUS */ +/* Description: Deprecated register - RAM status register */ + +/* Bit 3 : RAM block 3 is on or off/powering up */ +#define POWER_RAMSTATUS_RAMBLOCK3_Pos (3UL) /*!< Position of RAMBLOCK3 field. */ +#define POWER_RAMSTATUS_RAMBLOCK3_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK3_Pos) /*!< Bit mask of RAMBLOCK3 field. */ +#define POWER_RAMSTATUS_RAMBLOCK3_Off (0UL) /*!< Off */ +#define POWER_RAMSTATUS_RAMBLOCK3_On (1UL) /*!< On */ + +/* Bit 2 : RAM block 2 is on or off/powering up */ +#define POWER_RAMSTATUS_RAMBLOCK2_Pos (2UL) /*!< Position of RAMBLOCK2 field. */ +#define POWER_RAMSTATUS_RAMBLOCK2_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK2_Pos) /*!< Bit mask of RAMBLOCK2 field. */ +#define POWER_RAMSTATUS_RAMBLOCK2_Off (0UL) /*!< Off */ +#define POWER_RAMSTATUS_RAMBLOCK2_On (1UL) /*!< On */ + +/* Bit 1 : RAM block 1 is on or off/powering up */ +#define POWER_RAMSTATUS_RAMBLOCK1_Pos (1UL) /*!< Position of RAMBLOCK1 field. */ +#define POWER_RAMSTATUS_RAMBLOCK1_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK1_Pos) /*!< Bit mask of RAMBLOCK1 field. */ +#define POWER_RAMSTATUS_RAMBLOCK1_Off (0UL) /*!< Off */ +#define POWER_RAMSTATUS_RAMBLOCK1_On (1UL) /*!< On */ + +/* Bit 0 : RAM block 0 is on or off/powering up */ +#define POWER_RAMSTATUS_RAMBLOCK0_Pos (0UL) /*!< Position of RAMBLOCK0 field. */ +#define POWER_RAMSTATUS_RAMBLOCK0_Msk (0x1UL << POWER_RAMSTATUS_RAMBLOCK0_Pos) /*!< Bit mask of RAMBLOCK0 field. */ +#define POWER_RAMSTATUS_RAMBLOCK0_Off (0UL) /*!< Off */ +#define POWER_RAMSTATUS_RAMBLOCK0_On (1UL) /*!< On */ + +/* Register: POWER_USBREGSTATUS */ +/* Description: USB supply status */ + +/* Bit 1 : USB supply output settling time elapsed */ +#define POWER_USBREGSTATUS_OUTPUTRDY_Pos (1UL) /*!< Position of OUTPUTRDY field. */ +#define POWER_USBREGSTATUS_OUTPUTRDY_Msk (0x1UL << POWER_USBREGSTATUS_OUTPUTRDY_Pos) /*!< Bit mask of OUTPUTRDY field. */ +#define POWER_USBREGSTATUS_OUTPUTRDY_NotReady (0UL) /*!< USBREG output settling time not elapsed */ +#define POWER_USBREGSTATUS_OUTPUTRDY_Ready (1UL) /*!< USBREG output settling time elapsed (same information as USBPWRRDY event) */ + +/* Bit 0 : VBUS input detection status (USBDETECTED and USBREMOVED events are derived from this information) */ +#define POWER_USBREGSTATUS_VBUSDETECT_Pos (0UL) /*!< Position of VBUSDETECT field. */ +#define POWER_USBREGSTATUS_VBUSDETECT_Msk (0x1UL << POWER_USBREGSTATUS_VBUSDETECT_Pos) /*!< Bit mask of VBUSDETECT field. */ +#define POWER_USBREGSTATUS_VBUSDETECT_NoVbus (0UL) /*!< VBUS voltage below valid threshold */ +#define POWER_USBREGSTATUS_VBUSDETECT_VbusPresent (1UL) /*!< VBUS voltage above valid threshold */ + +/* Register: POWER_SYSTEMOFF */ +/* Description: System OFF register */ + +/* Bit 0 : Enable System OFF mode */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Pos (0UL) /*!< Position of SYSTEMOFF field. */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Msk (0x1UL << POWER_SYSTEMOFF_SYSTEMOFF_Pos) /*!< Bit mask of SYSTEMOFF field. */ +#define POWER_SYSTEMOFF_SYSTEMOFF_Enter (1UL) /*!< Enable System OFF mode */ + +/* Register: POWER_POFCON */ +/* Description: Power failure comparator configuration */ + +/* Bits 11..8 : Power failure comparator threshold setting for voltage supply on VDDH */ +#define POWER_POFCON_THRESHOLDVDDH_Pos (8UL) /*!< Position of THRESHOLDVDDH field. */ +#define POWER_POFCON_THRESHOLDVDDH_Msk (0xFUL << POWER_POFCON_THRESHOLDVDDH_Pos) /*!< Bit mask of THRESHOLDVDDH field. */ +#define POWER_POFCON_THRESHOLDVDDH_V27 (0UL) /*!< Set threshold to 2.7 V */ +#define POWER_POFCON_THRESHOLDVDDH_V28 (1UL) /*!< Set threshold to 2.8 V */ +#define POWER_POFCON_THRESHOLDVDDH_V29 (2UL) /*!< Set threshold to 2.9 V */ +#define POWER_POFCON_THRESHOLDVDDH_V30 (3UL) /*!< Set threshold to 3.0 V */ +#define POWER_POFCON_THRESHOLDVDDH_V31 (4UL) /*!< Set threshold to 3.1 V */ +#define POWER_POFCON_THRESHOLDVDDH_V32 (5UL) /*!< Set threshold to 3.2 V */ +#define POWER_POFCON_THRESHOLDVDDH_V33 (6UL) /*!< Set threshold to 3.3 V */ +#define POWER_POFCON_THRESHOLDVDDH_V34 (7UL) /*!< Set threshold to 3.4 V */ +#define POWER_POFCON_THRESHOLDVDDH_V35 (8UL) /*!< Set threshold to 3.5 V */ +#define POWER_POFCON_THRESHOLDVDDH_V36 (9UL) /*!< Set threshold to 3.6 V */ +#define POWER_POFCON_THRESHOLDVDDH_V37 (10UL) /*!< Set threshold to 3.7 V */ +#define POWER_POFCON_THRESHOLDVDDH_V38 (11UL) /*!< Set threshold to 3.8 V */ +#define POWER_POFCON_THRESHOLDVDDH_V39 (12UL) /*!< Set threshold to 3.9 V */ +#define POWER_POFCON_THRESHOLDVDDH_V40 (13UL) /*!< Set threshold to 4.0 V */ +#define POWER_POFCON_THRESHOLDVDDH_V41 (14UL) /*!< Set threshold to 4.1 V */ +#define POWER_POFCON_THRESHOLDVDDH_V42 (15UL) /*!< Set threshold to 4.2 V */ + +/* Bits 4..1 : Power failure comparator threshold setting */ +#define POWER_POFCON_THRESHOLD_Pos (1UL) /*!< Position of THRESHOLD field. */ +#define POWER_POFCON_THRESHOLD_Msk (0xFUL << POWER_POFCON_THRESHOLD_Pos) /*!< Bit mask of THRESHOLD field. */ +#define POWER_POFCON_THRESHOLD_V17 (4UL) /*!< Set threshold to 1.7 V */ +#define POWER_POFCON_THRESHOLD_V18 (5UL) /*!< Set threshold to 1.8 V */ +#define POWER_POFCON_THRESHOLD_V19 (6UL) /*!< Set threshold to 1.9 V */ +#define POWER_POFCON_THRESHOLD_V20 (7UL) /*!< Set threshold to 2.0 V */ +#define POWER_POFCON_THRESHOLD_V21 (8UL) /*!< Set threshold to 2.1 V */ +#define POWER_POFCON_THRESHOLD_V22 (9UL) /*!< Set threshold to 2.2 V */ +#define POWER_POFCON_THRESHOLD_V23 (10UL) /*!< Set threshold to 2.3 V */ +#define POWER_POFCON_THRESHOLD_V24 (11UL) /*!< Set threshold to 2.4 V */ +#define POWER_POFCON_THRESHOLD_V25 (12UL) /*!< Set threshold to 2.5 V */ +#define POWER_POFCON_THRESHOLD_V26 (13UL) /*!< Set threshold to 2.6 V */ +#define POWER_POFCON_THRESHOLD_V27 (14UL) /*!< Set threshold to 2.7 V */ +#define POWER_POFCON_THRESHOLD_V28 (15UL) /*!< Set threshold to 2.8 V */ + +/* Bit 0 : Enable or disable power failure comparator */ +#define POWER_POFCON_POF_Pos (0UL) /*!< Position of POF field. */ +#define POWER_POFCON_POF_Msk (0x1UL << POWER_POFCON_POF_Pos) /*!< Bit mask of POF field. */ +#define POWER_POFCON_POF_Disabled (0UL) /*!< Disable */ +#define POWER_POFCON_POF_Enabled (1UL) /*!< Enable */ + +/* Register: POWER_GPREGRET */ +/* Description: General purpose retention register */ + +/* Bits 7..0 : General purpose retention register */ +#define POWER_GPREGRET_GPREGRET_Pos (0UL) /*!< Position of GPREGRET field. */ +#define POWER_GPREGRET_GPREGRET_Msk (0xFFUL << POWER_GPREGRET_GPREGRET_Pos) /*!< Bit mask of GPREGRET field. */ + +/* Register: POWER_GPREGRET2 */ +/* Description: General purpose retention register */ + +/* Bits 7..0 : General purpose retention register */ +#define POWER_GPREGRET2_GPREGRET_Pos (0UL) /*!< Position of GPREGRET field. */ +#define POWER_GPREGRET2_GPREGRET_Msk (0xFFUL << POWER_GPREGRET2_GPREGRET_Pos) /*!< Bit mask of GPREGRET field. */ + +/* Register: POWER_DCDCEN */ +/* Description: Enable DC/DC converter for REG1 stage. */ + +/* Bit 0 : Enable DC/DC converter for REG1 stage. */ +#define POWER_DCDCEN_DCDCEN_Pos (0UL) /*!< Position of DCDCEN field. */ +#define POWER_DCDCEN_DCDCEN_Msk (0x1UL << POWER_DCDCEN_DCDCEN_Pos) /*!< Bit mask of DCDCEN field. */ +#define POWER_DCDCEN_DCDCEN_Disabled (0UL) /*!< Disable */ +#define POWER_DCDCEN_DCDCEN_Enabled (1UL) /*!< Enable */ + +/* Register: POWER_DCDCEN0 */ +/* Description: Enable DC/DC converter for REG0 stage. */ + +/* Bit 0 : Enable DC/DC converter for REG0 stage. */ +#define POWER_DCDCEN0_DCDCEN_Pos (0UL) /*!< Position of DCDCEN field. */ +#define POWER_DCDCEN0_DCDCEN_Msk (0x1UL << POWER_DCDCEN0_DCDCEN_Pos) /*!< Bit mask of DCDCEN field. */ +#define POWER_DCDCEN0_DCDCEN_Disabled (0UL) /*!< Disable */ +#define POWER_DCDCEN0_DCDCEN_Enabled (1UL) /*!< Enable */ + +/* Register: POWER_MAINREGSTATUS */ +/* Description: Main supply status */ + +/* Bit 0 : Main supply status */ +#define POWER_MAINREGSTATUS_MAINREGSTATUS_Pos (0UL) /*!< Position of MAINREGSTATUS field. */ +#define POWER_MAINREGSTATUS_MAINREGSTATUS_Msk (0x1UL << POWER_MAINREGSTATUS_MAINREGSTATUS_Pos) /*!< Bit mask of MAINREGSTATUS field. */ +#define POWER_MAINREGSTATUS_MAINREGSTATUS_Normal (0UL) /*!< Normal voltage mode. Voltage supplied on VDD. */ +#define POWER_MAINREGSTATUS_MAINREGSTATUS_High (1UL) /*!< High voltage mode. Voltage supplied on VDDH. */ + +/* Register: POWER_RAM_POWER */ +/* Description: Description cluster[0]: RAM0 power control register */ + +/* Bit 31 : Keep retention on RAM section S15 when RAM section is in OFF */ +#define POWER_RAM_POWER_S15RETENTION_Pos (31UL) /*!< Position of S15RETENTION field. */ +#define POWER_RAM_POWER_S15RETENTION_Msk (0x1UL << POWER_RAM_POWER_S15RETENTION_Pos) /*!< Bit mask of S15RETENTION field. */ +#define POWER_RAM_POWER_S15RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S15RETENTION_On (1UL) /*!< On */ + +/* Bit 30 : Keep retention on RAM section S14 when RAM section is in OFF */ +#define POWER_RAM_POWER_S14RETENTION_Pos (30UL) /*!< Position of S14RETENTION field. */ +#define POWER_RAM_POWER_S14RETENTION_Msk (0x1UL << POWER_RAM_POWER_S14RETENTION_Pos) /*!< Bit mask of S14RETENTION field. */ +#define POWER_RAM_POWER_S14RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S14RETENTION_On (1UL) /*!< On */ + +/* Bit 29 : Keep retention on RAM section S13 when RAM section is in OFF */ +#define POWER_RAM_POWER_S13RETENTION_Pos (29UL) /*!< Position of S13RETENTION field. */ +#define POWER_RAM_POWER_S13RETENTION_Msk (0x1UL << POWER_RAM_POWER_S13RETENTION_Pos) /*!< Bit mask of S13RETENTION field. */ +#define POWER_RAM_POWER_S13RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S13RETENTION_On (1UL) /*!< On */ + +/* Bit 28 : Keep retention on RAM section S12 when RAM section is in OFF */ +#define POWER_RAM_POWER_S12RETENTION_Pos (28UL) /*!< Position of S12RETENTION field. */ +#define POWER_RAM_POWER_S12RETENTION_Msk (0x1UL << POWER_RAM_POWER_S12RETENTION_Pos) /*!< Bit mask of S12RETENTION field. */ +#define POWER_RAM_POWER_S12RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S12RETENTION_On (1UL) /*!< On */ + +/* Bit 27 : Keep retention on RAM section S11 when RAM section is in OFF */ +#define POWER_RAM_POWER_S11RETENTION_Pos (27UL) /*!< Position of S11RETENTION field. */ +#define POWER_RAM_POWER_S11RETENTION_Msk (0x1UL << POWER_RAM_POWER_S11RETENTION_Pos) /*!< Bit mask of S11RETENTION field. */ +#define POWER_RAM_POWER_S11RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S11RETENTION_On (1UL) /*!< On */ + +/* Bit 26 : Keep retention on RAM section S10 when RAM section is in OFF */ +#define POWER_RAM_POWER_S10RETENTION_Pos (26UL) /*!< Position of S10RETENTION field. */ +#define POWER_RAM_POWER_S10RETENTION_Msk (0x1UL << POWER_RAM_POWER_S10RETENTION_Pos) /*!< Bit mask of S10RETENTION field. */ +#define POWER_RAM_POWER_S10RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S10RETENTION_On (1UL) /*!< On */ + +/* Bit 25 : Keep retention on RAM section S9 when RAM section is in OFF */ +#define POWER_RAM_POWER_S9RETENTION_Pos (25UL) /*!< Position of S9RETENTION field. */ +#define POWER_RAM_POWER_S9RETENTION_Msk (0x1UL << POWER_RAM_POWER_S9RETENTION_Pos) /*!< Bit mask of S9RETENTION field. */ +#define POWER_RAM_POWER_S9RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S9RETENTION_On (1UL) /*!< On */ + +/* Bit 24 : Keep retention on RAM section S8 when RAM section is in OFF */ +#define POWER_RAM_POWER_S8RETENTION_Pos (24UL) /*!< Position of S8RETENTION field. */ +#define POWER_RAM_POWER_S8RETENTION_Msk (0x1UL << POWER_RAM_POWER_S8RETENTION_Pos) /*!< Bit mask of S8RETENTION field. */ +#define POWER_RAM_POWER_S8RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S8RETENTION_On (1UL) /*!< On */ + +/* Bit 23 : Keep retention on RAM section S7 when RAM section is in OFF */ +#define POWER_RAM_POWER_S7RETENTION_Pos (23UL) /*!< Position of S7RETENTION field. */ +#define POWER_RAM_POWER_S7RETENTION_Msk (0x1UL << POWER_RAM_POWER_S7RETENTION_Pos) /*!< Bit mask of S7RETENTION field. */ +#define POWER_RAM_POWER_S7RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S7RETENTION_On (1UL) /*!< On */ + +/* Bit 22 : Keep retention on RAM section S6 when RAM section is in OFF */ +#define POWER_RAM_POWER_S6RETENTION_Pos (22UL) /*!< Position of S6RETENTION field. */ +#define POWER_RAM_POWER_S6RETENTION_Msk (0x1UL << POWER_RAM_POWER_S6RETENTION_Pos) /*!< Bit mask of S6RETENTION field. */ +#define POWER_RAM_POWER_S6RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S6RETENTION_On (1UL) /*!< On */ + +/* Bit 21 : Keep retention on RAM section S5 when RAM section is in OFF */ +#define POWER_RAM_POWER_S5RETENTION_Pos (21UL) /*!< Position of S5RETENTION field. */ +#define POWER_RAM_POWER_S5RETENTION_Msk (0x1UL << POWER_RAM_POWER_S5RETENTION_Pos) /*!< Bit mask of S5RETENTION field. */ +#define POWER_RAM_POWER_S5RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S5RETENTION_On (1UL) /*!< On */ + +/* Bit 20 : Keep retention on RAM section S4 when RAM section is in OFF */ +#define POWER_RAM_POWER_S4RETENTION_Pos (20UL) /*!< Position of S4RETENTION field. */ +#define POWER_RAM_POWER_S4RETENTION_Msk (0x1UL << POWER_RAM_POWER_S4RETENTION_Pos) /*!< Bit mask of S4RETENTION field. */ +#define POWER_RAM_POWER_S4RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S4RETENTION_On (1UL) /*!< On */ + +/* Bit 19 : Keep retention on RAM section S3 when RAM section is in OFF */ +#define POWER_RAM_POWER_S3RETENTION_Pos (19UL) /*!< Position of S3RETENTION field. */ +#define POWER_RAM_POWER_S3RETENTION_Msk (0x1UL << POWER_RAM_POWER_S3RETENTION_Pos) /*!< Bit mask of S3RETENTION field. */ +#define POWER_RAM_POWER_S3RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S3RETENTION_On (1UL) /*!< On */ + +/* Bit 18 : Keep retention on RAM section S2 when RAM section is in OFF */ +#define POWER_RAM_POWER_S2RETENTION_Pos (18UL) /*!< Position of S2RETENTION field. */ +#define POWER_RAM_POWER_S2RETENTION_Msk (0x1UL << POWER_RAM_POWER_S2RETENTION_Pos) /*!< Bit mask of S2RETENTION field. */ +#define POWER_RAM_POWER_S2RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S2RETENTION_On (1UL) /*!< On */ + +/* Bit 17 : Keep retention on RAM section S1 when RAM section is in OFF */ +#define POWER_RAM_POWER_S1RETENTION_Pos (17UL) /*!< Position of S1RETENTION field. */ +#define POWER_RAM_POWER_S1RETENTION_Msk (0x1UL << POWER_RAM_POWER_S1RETENTION_Pos) /*!< Bit mask of S1RETENTION field. */ +#define POWER_RAM_POWER_S1RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S1RETENTION_On (1UL) /*!< On */ + +/* Bit 16 : Keep retention on RAM section S0 when RAM section is in OFF */ +#define POWER_RAM_POWER_S0RETENTION_Pos (16UL) /*!< Position of S0RETENTION field. */ +#define POWER_RAM_POWER_S0RETENTION_Msk (0x1UL << POWER_RAM_POWER_S0RETENTION_Pos) /*!< Bit mask of S0RETENTION field. */ +#define POWER_RAM_POWER_S0RETENTION_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S0RETENTION_On (1UL) /*!< On */ + +/* Bit 15 : Keep RAM section S15 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S15POWER_Pos (15UL) /*!< Position of S15POWER field. */ +#define POWER_RAM_POWER_S15POWER_Msk (0x1UL << POWER_RAM_POWER_S15POWER_Pos) /*!< Bit mask of S15POWER field. */ +#define POWER_RAM_POWER_S15POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S15POWER_On (1UL) /*!< On */ + +/* Bit 14 : Keep RAM section S14 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S14POWER_Pos (14UL) /*!< Position of S14POWER field. */ +#define POWER_RAM_POWER_S14POWER_Msk (0x1UL << POWER_RAM_POWER_S14POWER_Pos) /*!< Bit mask of S14POWER field. */ +#define POWER_RAM_POWER_S14POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S14POWER_On (1UL) /*!< On */ + +/* Bit 13 : Keep RAM section S13 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S13POWER_Pos (13UL) /*!< Position of S13POWER field. */ +#define POWER_RAM_POWER_S13POWER_Msk (0x1UL << POWER_RAM_POWER_S13POWER_Pos) /*!< Bit mask of S13POWER field. */ +#define POWER_RAM_POWER_S13POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S13POWER_On (1UL) /*!< On */ + +/* Bit 12 : Keep RAM section S12 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S12POWER_Pos (12UL) /*!< Position of S12POWER field. */ +#define POWER_RAM_POWER_S12POWER_Msk (0x1UL << POWER_RAM_POWER_S12POWER_Pos) /*!< Bit mask of S12POWER field. */ +#define POWER_RAM_POWER_S12POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S12POWER_On (1UL) /*!< On */ + +/* Bit 11 : Keep RAM section S11 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S11POWER_Pos (11UL) /*!< Position of S11POWER field. */ +#define POWER_RAM_POWER_S11POWER_Msk (0x1UL << POWER_RAM_POWER_S11POWER_Pos) /*!< Bit mask of S11POWER field. */ +#define POWER_RAM_POWER_S11POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S11POWER_On (1UL) /*!< On */ + +/* Bit 10 : Keep RAM section S10 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S10POWER_Pos (10UL) /*!< Position of S10POWER field. */ +#define POWER_RAM_POWER_S10POWER_Msk (0x1UL << POWER_RAM_POWER_S10POWER_Pos) /*!< Bit mask of S10POWER field. */ +#define POWER_RAM_POWER_S10POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S10POWER_On (1UL) /*!< On */ + +/* Bit 9 : Keep RAM section S9 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S9POWER_Pos (9UL) /*!< Position of S9POWER field. */ +#define POWER_RAM_POWER_S9POWER_Msk (0x1UL << POWER_RAM_POWER_S9POWER_Pos) /*!< Bit mask of S9POWER field. */ +#define POWER_RAM_POWER_S9POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S9POWER_On (1UL) /*!< On */ + +/* Bit 8 : Keep RAM section S8 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S8POWER_Pos (8UL) /*!< Position of S8POWER field. */ +#define POWER_RAM_POWER_S8POWER_Msk (0x1UL << POWER_RAM_POWER_S8POWER_Pos) /*!< Bit mask of S8POWER field. */ +#define POWER_RAM_POWER_S8POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S8POWER_On (1UL) /*!< On */ + +/* Bit 7 : Keep RAM section S7 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S7POWER_Pos (7UL) /*!< Position of S7POWER field. */ +#define POWER_RAM_POWER_S7POWER_Msk (0x1UL << POWER_RAM_POWER_S7POWER_Pos) /*!< Bit mask of S7POWER field. */ +#define POWER_RAM_POWER_S7POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S7POWER_On (1UL) /*!< On */ + +/* Bit 6 : Keep RAM section S6 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S6POWER_Pos (6UL) /*!< Position of S6POWER field. */ +#define POWER_RAM_POWER_S6POWER_Msk (0x1UL << POWER_RAM_POWER_S6POWER_Pos) /*!< Bit mask of S6POWER field. */ +#define POWER_RAM_POWER_S6POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S6POWER_On (1UL) /*!< On */ + +/* Bit 5 : Keep RAM section S5 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S5POWER_Pos (5UL) /*!< Position of S5POWER field. */ +#define POWER_RAM_POWER_S5POWER_Msk (0x1UL << POWER_RAM_POWER_S5POWER_Pos) /*!< Bit mask of S5POWER field. */ +#define POWER_RAM_POWER_S5POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S5POWER_On (1UL) /*!< On */ + +/* Bit 4 : Keep RAM section S4 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S4POWER_Pos (4UL) /*!< Position of S4POWER field. */ +#define POWER_RAM_POWER_S4POWER_Msk (0x1UL << POWER_RAM_POWER_S4POWER_Pos) /*!< Bit mask of S4POWER field. */ +#define POWER_RAM_POWER_S4POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S4POWER_On (1UL) /*!< On */ + +/* Bit 3 : Keep RAM section S3 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S3POWER_Pos (3UL) /*!< Position of S3POWER field. */ +#define POWER_RAM_POWER_S3POWER_Msk (0x1UL << POWER_RAM_POWER_S3POWER_Pos) /*!< Bit mask of S3POWER field. */ +#define POWER_RAM_POWER_S3POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S3POWER_On (1UL) /*!< On */ + +/* Bit 2 : Keep RAM section S2 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S2POWER_Pos (2UL) /*!< Position of S2POWER field. */ +#define POWER_RAM_POWER_S2POWER_Msk (0x1UL << POWER_RAM_POWER_S2POWER_Pos) /*!< Bit mask of S2POWER field. */ +#define POWER_RAM_POWER_S2POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S2POWER_On (1UL) /*!< On */ + +/* Bit 1 : Keep RAM section S1 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S1POWER_Pos (1UL) /*!< Position of S1POWER field. */ +#define POWER_RAM_POWER_S1POWER_Msk (0x1UL << POWER_RAM_POWER_S1POWER_Pos) /*!< Bit mask of S1POWER field. */ +#define POWER_RAM_POWER_S1POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S1POWER_On (1UL) /*!< On */ + +/* Bit 0 : Keep RAM section S0 ON or OFF in System ON mode. */ +#define POWER_RAM_POWER_S0POWER_Pos (0UL) /*!< Position of S0POWER field. */ +#define POWER_RAM_POWER_S0POWER_Msk (0x1UL << POWER_RAM_POWER_S0POWER_Pos) /*!< Bit mask of S0POWER field. */ +#define POWER_RAM_POWER_S0POWER_Off (0UL) /*!< Off */ +#define POWER_RAM_POWER_S0POWER_On (1UL) /*!< On */ + +/* Register: POWER_RAM_POWERSET */ +/* Description: Description cluster[0]: RAM0 power control set register */ + +/* Bit 31 : Keep retention on RAM section S15 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S15RETENTION_Pos (31UL) /*!< Position of S15RETENTION field. */ +#define POWER_RAM_POWERSET_S15RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S15RETENTION_Pos) /*!< Bit mask of S15RETENTION field. */ +#define POWER_RAM_POWERSET_S15RETENTION_On (1UL) /*!< On */ + +/* Bit 30 : Keep retention on RAM section S14 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S14RETENTION_Pos (30UL) /*!< Position of S14RETENTION field. */ +#define POWER_RAM_POWERSET_S14RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S14RETENTION_Pos) /*!< Bit mask of S14RETENTION field. */ +#define POWER_RAM_POWERSET_S14RETENTION_On (1UL) /*!< On */ + +/* Bit 29 : Keep retention on RAM section S13 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S13RETENTION_Pos (29UL) /*!< Position of S13RETENTION field. */ +#define POWER_RAM_POWERSET_S13RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S13RETENTION_Pos) /*!< Bit mask of S13RETENTION field. */ +#define POWER_RAM_POWERSET_S13RETENTION_On (1UL) /*!< On */ + +/* Bit 28 : Keep retention on RAM section S12 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S12RETENTION_Pos (28UL) /*!< Position of S12RETENTION field. */ +#define POWER_RAM_POWERSET_S12RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S12RETENTION_Pos) /*!< Bit mask of S12RETENTION field. */ +#define POWER_RAM_POWERSET_S12RETENTION_On (1UL) /*!< On */ + +/* Bit 27 : Keep retention on RAM section S11 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S11RETENTION_Pos (27UL) /*!< Position of S11RETENTION field. */ +#define POWER_RAM_POWERSET_S11RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S11RETENTION_Pos) /*!< Bit mask of S11RETENTION field. */ +#define POWER_RAM_POWERSET_S11RETENTION_On (1UL) /*!< On */ + +/* Bit 26 : Keep retention on RAM section S10 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S10RETENTION_Pos (26UL) /*!< Position of S10RETENTION field. */ +#define POWER_RAM_POWERSET_S10RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S10RETENTION_Pos) /*!< Bit mask of S10RETENTION field. */ +#define POWER_RAM_POWERSET_S10RETENTION_On (1UL) /*!< On */ + +/* Bit 25 : Keep retention on RAM section S9 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S9RETENTION_Pos (25UL) /*!< Position of S9RETENTION field. */ +#define POWER_RAM_POWERSET_S9RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S9RETENTION_Pos) /*!< Bit mask of S9RETENTION field. */ +#define POWER_RAM_POWERSET_S9RETENTION_On (1UL) /*!< On */ + +/* Bit 24 : Keep retention on RAM section S8 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S8RETENTION_Pos (24UL) /*!< Position of S8RETENTION field. */ +#define POWER_RAM_POWERSET_S8RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S8RETENTION_Pos) /*!< Bit mask of S8RETENTION field. */ +#define POWER_RAM_POWERSET_S8RETENTION_On (1UL) /*!< On */ + +/* Bit 23 : Keep retention on RAM section S7 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S7RETENTION_Pos (23UL) /*!< Position of S7RETENTION field. */ +#define POWER_RAM_POWERSET_S7RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S7RETENTION_Pos) /*!< Bit mask of S7RETENTION field. */ +#define POWER_RAM_POWERSET_S7RETENTION_On (1UL) /*!< On */ + +/* Bit 22 : Keep retention on RAM section S6 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S6RETENTION_Pos (22UL) /*!< Position of S6RETENTION field. */ +#define POWER_RAM_POWERSET_S6RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S6RETENTION_Pos) /*!< Bit mask of S6RETENTION field. */ +#define POWER_RAM_POWERSET_S6RETENTION_On (1UL) /*!< On */ + +/* Bit 21 : Keep retention on RAM section S5 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S5RETENTION_Pos (21UL) /*!< Position of S5RETENTION field. */ +#define POWER_RAM_POWERSET_S5RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S5RETENTION_Pos) /*!< Bit mask of S5RETENTION field. */ +#define POWER_RAM_POWERSET_S5RETENTION_On (1UL) /*!< On */ + +/* Bit 20 : Keep retention on RAM section S4 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S4RETENTION_Pos (20UL) /*!< Position of S4RETENTION field. */ +#define POWER_RAM_POWERSET_S4RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S4RETENTION_Pos) /*!< Bit mask of S4RETENTION field. */ +#define POWER_RAM_POWERSET_S4RETENTION_On (1UL) /*!< On */ + +/* Bit 19 : Keep retention on RAM section S3 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S3RETENTION_Pos (19UL) /*!< Position of S3RETENTION field. */ +#define POWER_RAM_POWERSET_S3RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S3RETENTION_Pos) /*!< Bit mask of S3RETENTION field. */ +#define POWER_RAM_POWERSET_S3RETENTION_On (1UL) /*!< On */ + +/* Bit 18 : Keep retention on RAM section S2 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S2RETENTION_Pos (18UL) /*!< Position of S2RETENTION field. */ +#define POWER_RAM_POWERSET_S2RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S2RETENTION_Pos) /*!< Bit mask of S2RETENTION field. */ +#define POWER_RAM_POWERSET_S2RETENTION_On (1UL) /*!< On */ + +/* Bit 17 : Keep retention on RAM section S1 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S1RETENTION_Pos (17UL) /*!< Position of S1RETENTION field. */ +#define POWER_RAM_POWERSET_S1RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S1RETENTION_Pos) /*!< Bit mask of S1RETENTION field. */ +#define POWER_RAM_POWERSET_S1RETENTION_On (1UL) /*!< On */ + +/* Bit 16 : Keep retention on RAM section S0 when RAM section is switched off */ +#define POWER_RAM_POWERSET_S0RETENTION_Pos (16UL) /*!< Position of S0RETENTION field. */ +#define POWER_RAM_POWERSET_S0RETENTION_Msk (0x1UL << POWER_RAM_POWERSET_S0RETENTION_Pos) /*!< Bit mask of S0RETENTION field. */ +#define POWER_RAM_POWERSET_S0RETENTION_On (1UL) /*!< On */ + +/* Bit 15 : Keep RAM section S15 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S15POWER_Pos (15UL) /*!< Position of S15POWER field. */ +#define POWER_RAM_POWERSET_S15POWER_Msk (0x1UL << POWER_RAM_POWERSET_S15POWER_Pos) /*!< Bit mask of S15POWER field. */ +#define POWER_RAM_POWERSET_S15POWER_On (1UL) /*!< On */ + +/* Bit 14 : Keep RAM section S14 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S14POWER_Pos (14UL) /*!< Position of S14POWER field. */ +#define POWER_RAM_POWERSET_S14POWER_Msk (0x1UL << POWER_RAM_POWERSET_S14POWER_Pos) /*!< Bit mask of S14POWER field. */ +#define POWER_RAM_POWERSET_S14POWER_On (1UL) /*!< On */ + +/* Bit 13 : Keep RAM section S13 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S13POWER_Pos (13UL) /*!< Position of S13POWER field. */ +#define POWER_RAM_POWERSET_S13POWER_Msk (0x1UL << POWER_RAM_POWERSET_S13POWER_Pos) /*!< Bit mask of S13POWER field. */ +#define POWER_RAM_POWERSET_S13POWER_On (1UL) /*!< On */ + +/* Bit 12 : Keep RAM section S12 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S12POWER_Pos (12UL) /*!< Position of S12POWER field. */ +#define POWER_RAM_POWERSET_S12POWER_Msk (0x1UL << POWER_RAM_POWERSET_S12POWER_Pos) /*!< Bit mask of S12POWER field. */ +#define POWER_RAM_POWERSET_S12POWER_On (1UL) /*!< On */ + +/* Bit 11 : Keep RAM section S11 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S11POWER_Pos (11UL) /*!< Position of S11POWER field. */ +#define POWER_RAM_POWERSET_S11POWER_Msk (0x1UL << POWER_RAM_POWERSET_S11POWER_Pos) /*!< Bit mask of S11POWER field. */ +#define POWER_RAM_POWERSET_S11POWER_On (1UL) /*!< On */ + +/* Bit 10 : Keep RAM section S10 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S10POWER_Pos (10UL) /*!< Position of S10POWER field. */ +#define POWER_RAM_POWERSET_S10POWER_Msk (0x1UL << POWER_RAM_POWERSET_S10POWER_Pos) /*!< Bit mask of S10POWER field. */ +#define POWER_RAM_POWERSET_S10POWER_On (1UL) /*!< On */ + +/* Bit 9 : Keep RAM section S9 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S9POWER_Pos (9UL) /*!< Position of S9POWER field. */ +#define POWER_RAM_POWERSET_S9POWER_Msk (0x1UL << POWER_RAM_POWERSET_S9POWER_Pos) /*!< Bit mask of S9POWER field. */ +#define POWER_RAM_POWERSET_S9POWER_On (1UL) /*!< On */ + +/* Bit 8 : Keep RAM section S8 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S8POWER_Pos (8UL) /*!< Position of S8POWER field. */ +#define POWER_RAM_POWERSET_S8POWER_Msk (0x1UL << POWER_RAM_POWERSET_S8POWER_Pos) /*!< Bit mask of S8POWER field. */ +#define POWER_RAM_POWERSET_S8POWER_On (1UL) /*!< On */ + +/* Bit 7 : Keep RAM section S7 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S7POWER_Pos (7UL) /*!< Position of S7POWER field. */ +#define POWER_RAM_POWERSET_S7POWER_Msk (0x1UL << POWER_RAM_POWERSET_S7POWER_Pos) /*!< Bit mask of S7POWER field. */ +#define POWER_RAM_POWERSET_S7POWER_On (1UL) /*!< On */ + +/* Bit 6 : Keep RAM section S6 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S6POWER_Pos (6UL) /*!< Position of S6POWER field. */ +#define POWER_RAM_POWERSET_S6POWER_Msk (0x1UL << POWER_RAM_POWERSET_S6POWER_Pos) /*!< Bit mask of S6POWER field. */ +#define POWER_RAM_POWERSET_S6POWER_On (1UL) /*!< On */ + +/* Bit 5 : Keep RAM section S5 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S5POWER_Pos (5UL) /*!< Position of S5POWER field. */ +#define POWER_RAM_POWERSET_S5POWER_Msk (0x1UL << POWER_RAM_POWERSET_S5POWER_Pos) /*!< Bit mask of S5POWER field. */ +#define POWER_RAM_POWERSET_S5POWER_On (1UL) /*!< On */ + +/* Bit 4 : Keep RAM section S4 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S4POWER_Pos (4UL) /*!< Position of S4POWER field. */ +#define POWER_RAM_POWERSET_S4POWER_Msk (0x1UL << POWER_RAM_POWERSET_S4POWER_Pos) /*!< Bit mask of S4POWER field. */ +#define POWER_RAM_POWERSET_S4POWER_On (1UL) /*!< On */ + +/* Bit 3 : Keep RAM section S3 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S3POWER_Pos (3UL) /*!< Position of S3POWER field. */ +#define POWER_RAM_POWERSET_S3POWER_Msk (0x1UL << POWER_RAM_POWERSET_S3POWER_Pos) /*!< Bit mask of S3POWER field. */ +#define POWER_RAM_POWERSET_S3POWER_On (1UL) /*!< On */ + +/* Bit 2 : Keep RAM section S2 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S2POWER_Pos (2UL) /*!< Position of S2POWER field. */ +#define POWER_RAM_POWERSET_S2POWER_Msk (0x1UL << POWER_RAM_POWERSET_S2POWER_Pos) /*!< Bit mask of S2POWER field. */ +#define POWER_RAM_POWERSET_S2POWER_On (1UL) /*!< On */ + +/* Bit 1 : Keep RAM section S1 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S1POWER_Pos (1UL) /*!< Position of S1POWER field. */ +#define POWER_RAM_POWERSET_S1POWER_Msk (0x1UL << POWER_RAM_POWERSET_S1POWER_Pos) /*!< Bit mask of S1POWER field. */ +#define POWER_RAM_POWERSET_S1POWER_On (1UL) /*!< On */ + +/* Bit 0 : Keep RAM section S0 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERSET_S0POWER_Pos (0UL) /*!< Position of S0POWER field. */ +#define POWER_RAM_POWERSET_S0POWER_Msk (0x1UL << POWER_RAM_POWERSET_S0POWER_Pos) /*!< Bit mask of S0POWER field. */ +#define POWER_RAM_POWERSET_S0POWER_On (1UL) /*!< On */ + +/* Register: POWER_RAM_POWERCLR */ +/* Description: Description cluster[0]: RAM0 power control clear register */ + +/* Bit 31 : Keep retention on RAM section S15 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S15RETENTION_Pos (31UL) /*!< Position of S15RETENTION field. */ +#define POWER_RAM_POWERCLR_S15RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S15RETENTION_Pos) /*!< Bit mask of S15RETENTION field. */ +#define POWER_RAM_POWERCLR_S15RETENTION_Off (1UL) /*!< Off */ + +/* Bit 30 : Keep retention on RAM section S14 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S14RETENTION_Pos (30UL) /*!< Position of S14RETENTION field. */ +#define POWER_RAM_POWERCLR_S14RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S14RETENTION_Pos) /*!< Bit mask of S14RETENTION field. */ +#define POWER_RAM_POWERCLR_S14RETENTION_Off (1UL) /*!< Off */ + +/* Bit 29 : Keep retention on RAM section S13 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S13RETENTION_Pos (29UL) /*!< Position of S13RETENTION field. */ +#define POWER_RAM_POWERCLR_S13RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S13RETENTION_Pos) /*!< Bit mask of S13RETENTION field. */ +#define POWER_RAM_POWERCLR_S13RETENTION_Off (1UL) /*!< Off */ + +/* Bit 28 : Keep retention on RAM section S12 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S12RETENTION_Pos (28UL) /*!< Position of S12RETENTION field. */ +#define POWER_RAM_POWERCLR_S12RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S12RETENTION_Pos) /*!< Bit mask of S12RETENTION field. */ +#define POWER_RAM_POWERCLR_S12RETENTION_Off (1UL) /*!< Off */ + +/* Bit 27 : Keep retention on RAM section S11 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S11RETENTION_Pos (27UL) /*!< Position of S11RETENTION field. */ +#define POWER_RAM_POWERCLR_S11RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S11RETENTION_Pos) /*!< Bit mask of S11RETENTION field. */ +#define POWER_RAM_POWERCLR_S11RETENTION_Off (1UL) /*!< Off */ + +/* Bit 26 : Keep retention on RAM section S10 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S10RETENTION_Pos (26UL) /*!< Position of S10RETENTION field. */ +#define POWER_RAM_POWERCLR_S10RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S10RETENTION_Pos) /*!< Bit mask of S10RETENTION field. */ +#define POWER_RAM_POWERCLR_S10RETENTION_Off (1UL) /*!< Off */ + +/* Bit 25 : Keep retention on RAM section S9 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S9RETENTION_Pos (25UL) /*!< Position of S9RETENTION field. */ +#define POWER_RAM_POWERCLR_S9RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S9RETENTION_Pos) /*!< Bit mask of S9RETENTION field. */ +#define POWER_RAM_POWERCLR_S9RETENTION_Off (1UL) /*!< Off */ + +/* Bit 24 : Keep retention on RAM section S8 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S8RETENTION_Pos (24UL) /*!< Position of S8RETENTION field. */ +#define POWER_RAM_POWERCLR_S8RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S8RETENTION_Pos) /*!< Bit mask of S8RETENTION field. */ +#define POWER_RAM_POWERCLR_S8RETENTION_Off (1UL) /*!< Off */ + +/* Bit 23 : Keep retention on RAM section S7 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S7RETENTION_Pos (23UL) /*!< Position of S7RETENTION field. */ +#define POWER_RAM_POWERCLR_S7RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S7RETENTION_Pos) /*!< Bit mask of S7RETENTION field. */ +#define POWER_RAM_POWERCLR_S7RETENTION_Off (1UL) /*!< Off */ + +/* Bit 22 : Keep retention on RAM section S6 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S6RETENTION_Pos (22UL) /*!< Position of S6RETENTION field. */ +#define POWER_RAM_POWERCLR_S6RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S6RETENTION_Pos) /*!< Bit mask of S6RETENTION field. */ +#define POWER_RAM_POWERCLR_S6RETENTION_Off (1UL) /*!< Off */ + +/* Bit 21 : Keep retention on RAM section S5 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S5RETENTION_Pos (21UL) /*!< Position of S5RETENTION field. */ +#define POWER_RAM_POWERCLR_S5RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S5RETENTION_Pos) /*!< Bit mask of S5RETENTION field. */ +#define POWER_RAM_POWERCLR_S5RETENTION_Off (1UL) /*!< Off */ + +/* Bit 20 : Keep retention on RAM section S4 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S4RETENTION_Pos (20UL) /*!< Position of S4RETENTION field. */ +#define POWER_RAM_POWERCLR_S4RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S4RETENTION_Pos) /*!< Bit mask of S4RETENTION field. */ +#define POWER_RAM_POWERCLR_S4RETENTION_Off (1UL) /*!< Off */ + +/* Bit 19 : Keep retention on RAM section S3 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S3RETENTION_Pos (19UL) /*!< Position of S3RETENTION field. */ +#define POWER_RAM_POWERCLR_S3RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S3RETENTION_Pos) /*!< Bit mask of S3RETENTION field. */ +#define POWER_RAM_POWERCLR_S3RETENTION_Off (1UL) /*!< Off */ + +/* Bit 18 : Keep retention on RAM section S2 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S2RETENTION_Pos (18UL) /*!< Position of S2RETENTION field. */ +#define POWER_RAM_POWERCLR_S2RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S2RETENTION_Pos) /*!< Bit mask of S2RETENTION field. */ +#define POWER_RAM_POWERCLR_S2RETENTION_Off (1UL) /*!< Off */ + +/* Bit 17 : Keep retention on RAM section S1 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S1RETENTION_Pos (17UL) /*!< Position of S1RETENTION field. */ +#define POWER_RAM_POWERCLR_S1RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S1RETENTION_Pos) /*!< Bit mask of S1RETENTION field. */ +#define POWER_RAM_POWERCLR_S1RETENTION_Off (1UL) /*!< Off */ + +/* Bit 16 : Keep retention on RAM section S0 when RAM section is switched off */ +#define POWER_RAM_POWERCLR_S0RETENTION_Pos (16UL) /*!< Position of S0RETENTION field. */ +#define POWER_RAM_POWERCLR_S0RETENTION_Msk (0x1UL << POWER_RAM_POWERCLR_S0RETENTION_Pos) /*!< Bit mask of S0RETENTION field. */ +#define POWER_RAM_POWERCLR_S0RETENTION_Off (1UL) /*!< Off */ + +/* Bit 15 : Keep RAM section S15 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S15POWER_Pos (15UL) /*!< Position of S15POWER field. */ +#define POWER_RAM_POWERCLR_S15POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S15POWER_Pos) /*!< Bit mask of S15POWER field. */ +#define POWER_RAM_POWERCLR_S15POWER_Off (1UL) /*!< Off */ + +/* Bit 14 : Keep RAM section S14 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S14POWER_Pos (14UL) /*!< Position of S14POWER field. */ +#define POWER_RAM_POWERCLR_S14POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S14POWER_Pos) /*!< Bit mask of S14POWER field. */ +#define POWER_RAM_POWERCLR_S14POWER_Off (1UL) /*!< Off */ + +/* Bit 13 : Keep RAM section S13 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S13POWER_Pos (13UL) /*!< Position of S13POWER field. */ +#define POWER_RAM_POWERCLR_S13POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S13POWER_Pos) /*!< Bit mask of S13POWER field. */ +#define POWER_RAM_POWERCLR_S13POWER_Off (1UL) /*!< Off */ + +/* Bit 12 : Keep RAM section S12 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S12POWER_Pos (12UL) /*!< Position of S12POWER field. */ +#define POWER_RAM_POWERCLR_S12POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S12POWER_Pos) /*!< Bit mask of S12POWER field. */ +#define POWER_RAM_POWERCLR_S12POWER_Off (1UL) /*!< Off */ + +/* Bit 11 : Keep RAM section S11 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S11POWER_Pos (11UL) /*!< Position of S11POWER field. */ +#define POWER_RAM_POWERCLR_S11POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S11POWER_Pos) /*!< Bit mask of S11POWER field. */ +#define POWER_RAM_POWERCLR_S11POWER_Off (1UL) /*!< Off */ + +/* Bit 10 : Keep RAM section S10 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S10POWER_Pos (10UL) /*!< Position of S10POWER field. */ +#define POWER_RAM_POWERCLR_S10POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S10POWER_Pos) /*!< Bit mask of S10POWER field. */ +#define POWER_RAM_POWERCLR_S10POWER_Off (1UL) /*!< Off */ + +/* Bit 9 : Keep RAM section S9 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S9POWER_Pos (9UL) /*!< Position of S9POWER field. */ +#define POWER_RAM_POWERCLR_S9POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S9POWER_Pos) /*!< Bit mask of S9POWER field. */ +#define POWER_RAM_POWERCLR_S9POWER_Off (1UL) /*!< Off */ + +/* Bit 8 : Keep RAM section S8 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S8POWER_Pos (8UL) /*!< Position of S8POWER field. */ +#define POWER_RAM_POWERCLR_S8POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S8POWER_Pos) /*!< Bit mask of S8POWER field. */ +#define POWER_RAM_POWERCLR_S8POWER_Off (1UL) /*!< Off */ + +/* Bit 7 : Keep RAM section S7 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S7POWER_Pos (7UL) /*!< Position of S7POWER field. */ +#define POWER_RAM_POWERCLR_S7POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S7POWER_Pos) /*!< Bit mask of S7POWER field. */ +#define POWER_RAM_POWERCLR_S7POWER_Off (1UL) /*!< Off */ + +/* Bit 6 : Keep RAM section S6 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S6POWER_Pos (6UL) /*!< Position of S6POWER field. */ +#define POWER_RAM_POWERCLR_S6POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S6POWER_Pos) /*!< Bit mask of S6POWER field. */ +#define POWER_RAM_POWERCLR_S6POWER_Off (1UL) /*!< Off */ + +/* Bit 5 : Keep RAM section S5 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S5POWER_Pos (5UL) /*!< Position of S5POWER field. */ +#define POWER_RAM_POWERCLR_S5POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S5POWER_Pos) /*!< Bit mask of S5POWER field. */ +#define POWER_RAM_POWERCLR_S5POWER_Off (1UL) /*!< Off */ + +/* Bit 4 : Keep RAM section S4 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S4POWER_Pos (4UL) /*!< Position of S4POWER field. */ +#define POWER_RAM_POWERCLR_S4POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S4POWER_Pos) /*!< Bit mask of S4POWER field. */ +#define POWER_RAM_POWERCLR_S4POWER_Off (1UL) /*!< Off */ + +/* Bit 3 : Keep RAM section S3 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S3POWER_Pos (3UL) /*!< Position of S3POWER field. */ +#define POWER_RAM_POWERCLR_S3POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S3POWER_Pos) /*!< Bit mask of S3POWER field. */ +#define POWER_RAM_POWERCLR_S3POWER_Off (1UL) /*!< Off */ + +/* Bit 2 : Keep RAM section S2 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S2POWER_Pos (2UL) /*!< Position of S2POWER field. */ +#define POWER_RAM_POWERCLR_S2POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S2POWER_Pos) /*!< Bit mask of S2POWER field. */ +#define POWER_RAM_POWERCLR_S2POWER_Off (1UL) /*!< Off */ + +/* Bit 1 : Keep RAM section S1 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S1POWER_Pos (1UL) /*!< Position of S1POWER field. */ +#define POWER_RAM_POWERCLR_S1POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S1POWER_Pos) /*!< Bit mask of S1POWER field. */ +#define POWER_RAM_POWERCLR_S1POWER_Off (1UL) /*!< Off */ + +/* Bit 0 : Keep RAM section S0 of RAM0 on or off in System ON mode */ +#define POWER_RAM_POWERCLR_S0POWER_Pos (0UL) /*!< Position of S0POWER field. */ +#define POWER_RAM_POWERCLR_S0POWER_Msk (0x1UL << POWER_RAM_POWERCLR_S0POWER_Pos) /*!< Bit mask of S0POWER field. */ +#define POWER_RAM_POWERCLR_S0POWER_Off (1UL) /*!< Off */ + + +/* Peripheral: PPI */ +/* Description: Programmable Peripheral Interconnect */ + +/* Register: PPI_CHEN */ +/* Description: Channel enable register */ + +/* Bit 31 : Enable or disable channel 31 */ +#define PPI_CHEN_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHEN_CH31_Msk (0x1UL << PPI_CHEN_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHEN_CH31_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH31_Enabled (1UL) /*!< Enable channel */ + +/* Bit 30 : Enable or disable channel 30 */ +#define PPI_CHEN_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHEN_CH30_Msk (0x1UL << PPI_CHEN_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHEN_CH30_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH30_Enabled (1UL) /*!< Enable channel */ + +/* Bit 29 : Enable or disable channel 29 */ +#define PPI_CHEN_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHEN_CH29_Msk (0x1UL << PPI_CHEN_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHEN_CH29_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH29_Enabled (1UL) /*!< Enable channel */ + +/* Bit 28 : Enable or disable channel 28 */ +#define PPI_CHEN_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHEN_CH28_Msk (0x1UL << PPI_CHEN_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHEN_CH28_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH28_Enabled (1UL) /*!< Enable channel */ + +/* Bit 27 : Enable or disable channel 27 */ +#define PPI_CHEN_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHEN_CH27_Msk (0x1UL << PPI_CHEN_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHEN_CH27_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH27_Enabled (1UL) /*!< Enable channel */ + +/* Bit 26 : Enable or disable channel 26 */ +#define PPI_CHEN_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHEN_CH26_Msk (0x1UL << PPI_CHEN_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHEN_CH26_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH26_Enabled (1UL) /*!< Enable channel */ + +/* Bit 25 : Enable or disable channel 25 */ +#define PPI_CHEN_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHEN_CH25_Msk (0x1UL << PPI_CHEN_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHEN_CH25_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH25_Enabled (1UL) /*!< Enable channel */ + +/* Bit 24 : Enable or disable channel 24 */ +#define PPI_CHEN_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHEN_CH24_Msk (0x1UL << PPI_CHEN_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHEN_CH24_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH24_Enabled (1UL) /*!< Enable channel */ + +/* Bit 23 : Enable or disable channel 23 */ +#define PPI_CHEN_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHEN_CH23_Msk (0x1UL << PPI_CHEN_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHEN_CH23_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH23_Enabled (1UL) /*!< Enable channel */ + +/* Bit 22 : Enable or disable channel 22 */ +#define PPI_CHEN_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHEN_CH22_Msk (0x1UL << PPI_CHEN_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHEN_CH22_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH22_Enabled (1UL) /*!< Enable channel */ + +/* Bit 21 : Enable or disable channel 21 */ +#define PPI_CHEN_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHEN_CH21_Msk (0x1UL << PPI_CHEN_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHEN_CH21_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH21_Enabled (1UL) /*!< Enable channel */ + +/* Bit 20 : Enable or disable channel 20 */ +#define PPI_CHEN_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHEN_CH20_Msk (0x1UL << PPI_CHEN_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHEN_CH20_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH20_Enabled (1UL) /*!< Enable channel */ + +/* Bit 19 : Enable or disable channel 19 */ +#define PPI_CHEN_CH19_Pos (19UL) /*!< Position of CH19 field. */ +#define PPI_CHEN_CH19_Msk (0x1UL << PPI_CHEN_CH19_Pos) /*!< Bit mask of CH19 field. */ +#define PPI_CHEN_CH19_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH19_Enabled (1UL) /*!< Enable channel */ + +/* Bit 18 : Enable or disable channel 18 */ +#define PPI_CHEN_CH18_Pos (18UL) /*!< Position of CH18 field. */ +#define PPI_CHEN_CH18_Msk (0x1UL << PPI_CHEN_CH18_Pos) /*!< Bit mask of CH18 field. */ +#define PPI_CHEN_CH18_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH18_Enabled (1UL) /*!< Enable channel */ + +/* Bit 17 : Enable or disable channel 17 */ +#define PPI_CHEN_CH17_Pos (17UL) /*!< Position of CH17 field. */ +#define PPI_CHEN_CH17_Msk (0x1UL << PPI_CHEN_CH17_Pos) /*!< Bit mask of CH17 field. */ +#define PPI_CHEN_CH17_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH17_Enabled (1UL) /*!< Enable channel */ + +/* Bit 16 : Enable or disable channel 16 */ +#define PPI_CHEN_CH16_Pos (16UL) /*!< Position of CH16 field. */ +#define PPI_CHEN_CH16_Msk (0x1UL << PPI_CHEN_CH16_Pos) /*!< Bit mask of CH16 field. */ +#define PPI_CHEN_CH16_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH16_Enabled (1UL) /*!< Enable channel */ + +/* Bit 15 : Enable or disable channel 15 */ +#define PPI_CHEN_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHEN_CH15_Msk (0x1UL << PPI_CHEN_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHEN_CH15_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH15_Enabled (1UL) /*!< Enable channel */ + +/* Bit 14 : Enable or disable channel 14 */ +#define PPI_CHEN_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHEN_CH14_Msk (0x1UL << PPI_CHEN_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHEN_CH14_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH14_Enabled (1UL) /*!< Enable channel */ + +/* Bit 13 : Enable or disable channel 13 */ +#define PPI_CHEN_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHEN_CH13_Msk (0x1UL << PPI_CHEN_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHEN_CH13_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH13_Enabled (1UL) /*!< Enable channel */ + +/* Bit 12 : Enable or disable channel 12 */ +#define PPI_CHEN_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHEN_CH12_Msk (0x1UL << PPI_CHEN_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHEN_CH12_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH12_Enabled (1UL) /*!< Enable channel */ + +/* Bit 11 : Enable or disable channel 11 */ +#define PPI_CHEN_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHEN_CH11_Msk (0x1UL << PPI_CHEN_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHEN_CH11_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH11_Enabled (1UL) /*!< Enable channel */ + +/* Bit 10 : Enable or disable channel 10 */ +#define PPI_CHEN_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHEN_CH10_Msk (0x1UL << PPI_CHEN_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHEN_CH10_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH10_Enabled (1UL) /*!< Enable channel */ + +/* Bit 9 : Enable or disable channel 9 */ +#define PPI_CHEN_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHEN_CH9_Msk (0x1UL << PPI_CHEN_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHEN_CH9_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH9_Enabled (1UL) /*!< Enable channel */ + +/* Bit 8 : Enable or disable channel 8 */ +#define PPI_CHEN_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHEN_CH8_Msk (0x1UL << PPI_CHEN_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHEN_CH8_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH8_Enabled (1UL) /*!< Enable channel */ + +/* Bit 7 : Enable or disable channel 7 */ +#define PPI_CHEN_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHEN_CH7_Msk (0x1UL << PPI_CHEN_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHEN_CH7_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH7_Enabled (1UL) /*!< Enable channel */ + +/* Bit 6 : Enable or disable channel 6 */ +#define PPI_CHEN_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHEN_CH6_Msk (0x1UL << PPI_CHEN_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHEN_CH6_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH6_Enabled (1UL) /*!< Enable channel */ + +/* Bit 5 : Enable or disable channel 5 */ +#define PPI_CHEN_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHEN_CH5_Msk (0x1UL << PPI_CHEN_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHEN_CH5_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH5_Enabled (1UL) /*!< Enable channel */ + +/* Bit 4 : Enable or disable channel 4 */ +#define PPI_CHEN_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHEN_CH4_Msk (0x1UL << PPI_CHEN_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHEN_CH4_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH4_Enabled (1UL) /*!< Enable channel */ + +/* Bit 3 : Enable or disable channel 3 */ +#define PPI_CHEN_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHEN_CH3_Msk (0x1UL << PPI_CHEN_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHEN_CH3_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH3_Enabled (1UL) /*!< Enable channel */ + +/* Bit 2 : Enable or disable channel 2 */ +#define PPI_CHEN_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHEN_CH2_Msk (0x1UL << PPI_CHEN_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHEN_CH2_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH2_Enabled (1UL) /*!< Enable channel */ + +/* Bit 1 : Enable or disable channel 1 */ +#define PPI_CHEN_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHEN_CH1_Msk (0x1UL << PPI_CHEN_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHEN_CH1_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH1_Enabled (1UL) /*!< Enable channel */ + +/* Bit 0 : Enable or disable channel 0 */ +#define PPI_CHEN_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHEN_CH0_Msk (0x1UL << PPI_CHEN_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHEN_CH0_Disabled (0UL) /*!< Disable channel */ +#define PPI_CHEN_CH0_Enabled (1UL) /*!< Enable channel */ + +/* Register: PPI_CHENSET */ +/* Description: Channel enable set register */ + +/* Bit 31 : Channel 31 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHENSET_CH31_Msk (0x1UL << PPI_CHENSET_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHENSET_CH31_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH31_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH31_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 30 : Channel 30 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHENSET_CH30_Msk (0x1UL << PPI_CHENSET_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHENSET_CH30_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH30_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH30_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 29 : Channel 29 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHENSET_CH29_Msk (0x1UL << PPI_CHENSET_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHENSET_CH29_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH29_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH29_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 28 : Channel 28 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHENSET_CH28_Msk (0x1UL << PPI_CHENSET_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHENSET_CH28_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH28_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH28_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 27 : Channel 27 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHENSET_CH27_Msk (0x1UL << PPI_CHENSET_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHENSET_CH27_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH27_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH27_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 26 : Channel 26 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHENSET_CH26_Msk (0x1UL << PPI_CHENSET_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHENSET_CH26_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH26_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH26_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 25 : Channel 25 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHENSET_CH25_Msk (0x1UL << PPI_CHENSET_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHENSET_CH25_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH25_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH25_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 24 : Channel 24 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHENSET_CH24_Msk (0x1UL << PPI_CHENSET_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHENSET_CH24_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH24_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH24_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 23 : Channel 23 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHENSET_CH23_Msk (0x1UL << PPI_CHENSET_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHENSET_CH23_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH23_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH23_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 22 : Channel 22 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHENSET_CH22_Msk (0x1UL << PPI_CHENSET_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHENSET_CH22_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH22_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH22_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 21 : Channel 21 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHENSET_CH21_Msk (0x1UL << PPI_CHENSET_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHENSET_CH21_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH21_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH21_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 20 : Channel 20 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHENSET_CH20_Msk (0x1UL << PPI_CHENSET_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHENSET_CH20_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH20_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH20_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 19 : Channel 19 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH19_Pos (19UL) /*!< Position of CH19 field. */ +#define PPI_CHENSET_CH19_Msk (0x1UL << PPI_CHENSET_CH19_Pos) /*!< Bit mask of CH19 field. */ +#define PPI_CHENSET_CH19_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH19_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH19_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 18 : Channel 18 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH18_Pos (18UL) /*!< Position of CH18 field. */ +#define PPI_CHENSET_CH18_Msk (0x1UL << PPI_CHENSET_CH18_Pos) /*!< Bit mask of CH18 field. */ +#define PPI_CHENSET_CH18_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH18_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH18_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 17 : Channel 17 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH17_Pos (17UL) /*!< Position of CH17 field. */ +#define PPI_CHENSET_CH17_Msk (0x1UL << PPI_CHENSET_CH17_Pos) /*!< Bit mask of CH17 field. */ +#define PPI_CHENSET_CH17_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH17_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH17_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 16 : Channel 16 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH16_Pos (16UL) /*!< Position of CH16 field. */ +#define PPI_CHENSET_CH16_Msk (0x1UL << PPI_CHENSET_CH16_Pos) /*!< Bit mask of CH16 field. */ +#define PPI_CHENSET_CH16_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH16_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH16_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 15 : Channel 15 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHENSET_CH15_Msk (0x1UL << PPI_CHENSET_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHENSET_CH15_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH15_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH15_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 14 : Channel 14 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHENSET_CH14_Msk (0x1UL << PPI_CHENSET_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHENSET_CH14_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH14_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH14_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 13 : Channel 13 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHENSET_CH13_Msk (0x1UL << PPI_CHENSET_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHENSET_CH13_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH13_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH13_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 12 : Channel 12 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHENSET_CH12_Msk (0x1UL << PPI_CHENSET_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHENSET_CH12_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH12_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH12_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 11 : Channel 11 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHENSET_CH11_Msk (0x1UL << PPI_CHENSET_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHENSET_CH11_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH11_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH11_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 10 : Channel 10 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHENSET_CH10_Msk (0x1UL << PPI_CHENSET_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHENSET_CH10_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH10_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH10_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 9 : Channel 9 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHENSET_CH9_Msk (0x1UL << PPI_CHENSET_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHENSET_CH9_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH9_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH9_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 8 : Channel 8 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHENSET_CH8_Msk (0x1UL << PPI_CHENSET_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHENSET_CH8_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH8_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH8_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 7 : Channel 7 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHENSET_CH7_Msk (0x1UL << PPI_CHENSET_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHENSET_CH7_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH7_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH7_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 6 : Channel 6 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHENSET_CH6_Msk (0x1UL << PPI_CHENSET_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHENSET_CH6_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH6_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH6_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 5 : Channel 5 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHENSET_CH5_Msk (0x1UL << PPI_CHENSET_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHENSET_CH5_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH5_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH5_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 4 : Channel 4 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHENSET_CH4_Msk (0x1UL << PPI_CHENSET_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHENSET_CH4_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH4_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH4_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 3 : Channel 3 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHENSET_CH3_Msk (0x1UL << PPI_CHENSET_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHENSET_CH3_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH3_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH3_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 2 : Channel 2 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHENSET_CH2_Msk (0x1UL << PPI_CHENSET_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHENSET_CH2_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH2_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH2_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 1 : Channel 1 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHENSET_CH1_Msk (0x1UL << PPI_CHENSET_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHENSET_CH1_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH1_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH1_Set (1UL) /*!< Write: Enable channel */ + +/* Bit 0 : Channel 0 enable set register. Writing '0' has no effect */ +#define PPI_CHENSET_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHENSET_CH0_Msk (0x1UL << PPI_CHENSET_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHENSET_CH0_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENSET_CH0_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENSET_CH0_Set (1UL) /*!< Write: Enable channel */ + +/* Register: PPI_CHENCLR */ +/* Description: Channel enable clear register */ + +/* Bit 31 : Channel 31 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHENCLR_CH31_Msk (0x1UL << PPI_CHENCLR_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHENCLR_CH31_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH31_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH31_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 30 : Channel 30 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHENCLR_CH30_Msk (0x1UL << PPI_CHENCLR_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHENCLR_CH30_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH30_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH30_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 29 : Channel 29 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHENCLR_CH29_Msk (0x1UL << PPI_CHENCLR_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHENCLR_CH29_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH29_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH29_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 28 : Channel 28 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHENCLR_CH28_Msk (0x1UL << PPI_CHENCLR_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHENCLR_CH28_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH28_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH28_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 27 : Channel 27 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHENCLR_CH27_Msk (0x1UL << PPI_CHENCLR_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHENCLR_CH27_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH27_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH27_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 26 : Channel 26 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHENCLR_CH26_Msk (0x1UL << PPI_CHENCLR_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHENCLR_CH26_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH26_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH26_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 25 : Channel 25 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHENCLR_CH25_Msk (0x1UL << PPI_CHENCLR_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHENCLR_CH25_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH25_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH25_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 24 : Channel 24 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHENCLR_CH24_Msk (0x1UL << PPI_CHENCLR_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHENCLR_CH24_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH24_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH24_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 23 : Channel 23 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHENCLR_CH23_Msk (0x1UL << PPI_CHENCLR_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHENCLR_CH23_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH23_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH23_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 22 : Channel 22 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHENCLR_CH22_Msk (0x1UL << PPI_CHENCLR_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHENCLR_CH22_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH22_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH22_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 21 : Channel 21 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHENCLR_CH21_Msk (0x1UL << PPI_CHENCLR_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHENCLR_CH21_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH21_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH21_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 20 : Channel 20 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHENCLR_CH20_Msk (0x1UL << PPI_CHENCLR_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHENCLR_CH20_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH20_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH20_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 19 : Channel 19 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH19_Pos (19UL) /*!< Position of CH19 field. */ +#define PPI_CHENCLR_CH19_Msk (0x1UL << PPI_CHENCLR_CH19_Pos) /*!< Bit mask of CH19 field. */ +#define PPI_CHENCLR_CH19_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH19_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH19_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 18 : Channel 18 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH18_Pos (18UL) /*!< Position of CH18 field. */ +#define PPI_CHENCLR_CH18_Msk (0x1UL << PPI_CHENCLR_CH18_Pos) /*!< Bit mask of CH18 field. */ +#define PPI_CHENCLR_CH18_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH18_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH18_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 17 : Channel 17 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH17_Pos (17UL) /*!< Position of CH17 field. */ +#define PPI_CHENCLR_CH17_Msk (0x1UL << PPI_CHENCLR_CH17_Pos) /*!< Bit mask of CH17 field. */ +#define PPI_CHENCLR_CH17_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH17_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH17_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 16 : Channel 16 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH16_Pos (16UL) /*!< Position of CH16 field. */ +#define PPI_CHENCLR_CH16_Msk (0x1UL << PPI_CHENCLR_CH16_Pos) /*!< Bit mask of CH16 field. */ +#define PPI_CHENCLR_CH16_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH16_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH16_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 15 : Channel 15 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHENCLR_CH15_Msk (0x1UL << PPI_CHENCLR_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHENCLR_CH15_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH15_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH15_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 14 : Channel 14 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHENCLR_CH14_Msk (0x1UL << PPI_CHENCLR_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHENCLR_CH14_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH14_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH14_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 13 : Channel 13 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHENCLR_CH13_Msk (0x1UL << PPI_CHENCLR_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHENCLR_CH13_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH13_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH13_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 12 : Channel 12 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHENCLR_CH12_Msk (0x1UL << PPI_CHENCLR_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHENCLR_CH12_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH12_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH12_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 11 : Channel 11 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHENCLR_CH11_Msk (0x1UL << PPI_CHENCLR_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHENCLR_CH11_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH11_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH11_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 10 : Channel 10 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHENCLR_CH10_Msk (0x1UL << PPI_CHENCLR_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHENCLR_CH10_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH10_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH10_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 9 : Channel 9 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHENCLR_CH9_Msk (0x1UL << PPI_CHENCLR_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHENCLR_CH9_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH9_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH9_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 8 : Channel 8 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHENCLR_CH8_Msk (0x1UL << PPI_CHENCLR_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHENCLR_CH8_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH8_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH8_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 7 : Channel 7 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHENCLR_CH7_Msk (0x1UL << PPI_CHENCLR_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHENCLR_CH7_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH7_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH7_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 6 : Channel 6 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHENCLR_CH6_Msk (0x1UL << PPI_CHENCLR_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHENCLR_CH6_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH6_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH6_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 5 : Channel 5 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHENCLR_CH5_Msk (0x1UL << PPI_CHENCLR_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHENCLR_CH5_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH5_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH5_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 4 : Channel 4 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHENCLR_CH4_Msk (0x1UL << PPI_CHENCLR_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHENCLR_CH4_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH4_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH4_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 3 : Channel 3 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHENCLR_CH3_Msk (0x1UL << PPI_CHENCLR_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHENCLR_CH3_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH3_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH3_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 2 : Channel 2 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHENCLR_CH2_Msk (0x1UL << PPI_CHENCLR_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHENCLR_CH2_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH2_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH2_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 1 : Channel 1 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHENCLR_CH1_Msk (0x1UL << PPI_CHENCLR_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHENCLR_CH1_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH1_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH1_Clear (1UL) /*!< Write: disable channel */ + +/* Bit 0 : Channel 0 enable clear register. Writing '0' has no effect */ +#define PPI_CHENCLR_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHENCLR_CH0_Msk (0x1UL << PPI_CHENCLR_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHENCLR_CH0_Disabled (0UL) /*!< Read: channel disabled */ +#define PPI_CHENCLR_CH0_Enabled (1UL) /*!< Read: channel enabled */ +#define PPI_CHENCLR_CH0_Clear (1UL) /*!< Write: disable channel */ + +/* Register: PPI_CH_EEP */ +/* Description: Description cluster[0]: Channel 0 event end-point */ + +/* Bits 31..0 : Pointer to event register. Accepts only addresses to registers from the Event group. */ +#define PPI_CH_EEP_EEP_Pos (0UL) /*!< Position of EEP field. */ +#define PPI_CH_EEP_EEP_Msk (0xFFFFFFFFUL << PPI_CH_EEP_EEP_Pos) /*!< Bit mask of EEP field. */ + +/* Register: PPI_CH_TEP */ +/* Description: Description cluster[0]: Channel 0 task end-point */ + +/* Bits 31..0 : Pointer to task register. Accepts only addresses to registers from the Task group. */ +#define PPI_CH_TEP_TEP_Pos (0UL) /*!< Position of TEP field. */ +#define PPI_CH_TEP_TEP_Msk (0xFFFFFFFFUL << PPI_CH_TEP_TEP_Pos) /*!< Bit mask of TEP field. */ + +/* Register: PPI_CHG */ +/* Description: Description collection[0]: Channel group 0 */ + +/* Bit 31 : Include or exclude channel 31 */ +#define PPI_CHG_CH31_Pos (31UL) /*!< Position of CH31 field. */ +#define PPI_CHG_CH31_Msk (0x1UL << PPI_CHG_CH31_Pos) /*!< Bit mask of CH31 field. */ +#define PPI_CHG_CH31_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH31_Included (1UL) /*!< Include */ + +/* Bit 30 : Include or exclude channel 30 */ +#define PPI_CHG_CH30_Pos (30UL) /*!< Position of CH30 field. */ +#define PPI_CHG_CH30_Msk (0x1UL << PPI_CHG_CH30_Pos) /*!< Bit mask of CH30 field. */ +#define PPI_CHG_CH30_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH30_Included (1UL) /*!< Include */ + +/* Bit 29 : Include or exclude channel 29 */ +#define PPI_CHG_CH29_Pos (29UL) /*!< Position of CH29 field. */ +#define PPI_CHG_CH29_Msk (0x1UL << PPI_CHG_CH29_Pos) /*!< Bit mask of CH29 field. */ +#define PPI_CHG_CH29_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH29_Included (1UL) /*!< Include */ + +/* Bit 28 : Include or exclude channel 28 */ +#define PPI_CHG_CH28_Pos (28UL) /*!< Position of CH28 field. */ +#define PPI_CHG_CH28_Msk (0x1UL << PPI_CHG_CH28_Pos) /*!< Bit mask of CH28 field. */ +#define PPI_CHG_CH28_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH28_Included (1UL) /*!< Include */ + +/* Bit 27 : Include or exclude channel 27 */ +#define PPI_CHG_CH27_Pos (27UL) /*!< Position of CH27 field. */ +#define PPI_CHG_CH27_Msk (0x1UL << PPI_CHG_CH27_Pos) /*!< Bit mask of CH27 field. */ +#define PPI_CHG_CH27_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH27_Included (1UL) /*!< Include */ + +/* Bit 26 : Include or exclude channel 26 */ +#define PPI_CHG_CH26_Pos (26UL) /*!< Position of CH26 field. */ +#define PPI_CHG_CH26_Msk (0x1UL << PPI_CHG_CH26_Pos) /*!< Bit mask of CH26 field. */ +#define PPI_CHG_CH26_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH26_Included (1UL) /*!< Include */ + +/* Bit 25 : Include or exclude channel 25 */ +#define PPI_CHG_CH25_Pos (25UL) /*!< Position of CH25 field. */ +#define PPI_CHG_CH25_Msk (0x1UL << PPI_CHG_CH25_Pos) /*!< Bit mask of CH25 field. */ +#define PPI_CHG_CH25_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH25_Included (1UL) /*!< Include */ + +/* Bit 24 : Include or exclude channel 24 */ +#define PPI_CHG_CH24_Pos (24UL) /*!< Position of CH24 field. */ +#define PPI_CHG_CH24_Msk (0x1UL << PPI_CHG_CH24_Pos) /*!< Bit mask of CH24 field. */ +#define PPI_CHG_CH24_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH24_Included (1UL) /*!< Include */ + +/* Bit 23 : Include or exclude channel 23 */ +#define PPI_CHG_CH23_Pos (23UL) /*!< Position of CH23 field. */ +#define PPI_CHG_CH23_Msk (0x1UL << PPI_CHG_CH23_Pos) /*!< Bit mask of CH23 field. */ +#define PPI_CHG_CH23_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH23_Included (1UL) /*!< Include */ + +/* Bit 22 : Include or exclude channel 22 */ +#define PPI_CHG_CH22_Pos (22UL) /*!< Position of CH22 field. */ +#define PPI_CHG_CH22_Msk (0x1UL << PPI_CHG_CH22_Pos) /*!< Bit mask of CH22 field. */ +#define PPI_CHG_CH22_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH22_Included (1UL) /*!< Include */ + +/* Bit 21 : Include or exclude channel 21 */ +#define PPI_CHG_CH21_Pos (21UL) /*!< Position of CH21 field. */ +#define PPI_CHG_CH21_Msk (0x1UL << PPI_CHG_CH21_Pos) /*!< Bit mask of CH21 field. */ +#define PPI_CHG_CH21_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH21_Included (1UL) /*!< Include */ + +/* Bit 20 : Include or exclude channel 20 */ +#define PPI_CHG_CH20_Pos (20UL) /*!< Position of CH20 field. */ +#define PPI_CHG_CH20_Msk (0x1UL << PPI_CHG_CH20_Pos) /*!< Bit mask of CH20 field. */ +#define PPI_CHG_CH20_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH20_Included (1UL) /*!< Include */ + +/* Bit 19 : Include or exclude channel 19 */ +#define PPI_CHG_CH19_Pos (19UL) /*!< Position of CH19 field. */ +#define PPI_CHG_CH19_Msk (0x1UL << PPI_CHG_CH19_Pos) /*!< Bit mask of CH19 field. */ +#define PPI_CHG_CH19_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH19_Included (1UL) /*!< Include */ + +/* Bit 18 : Include or exclude channel 18 */ +#define PPI_CHG_CH18_Pos (18UL) /*!< Position of CH18 field. */ +#define PPI_CHG_CH18_Msk (0x1UL << PPI_CHG_CH18_Pos) /*!< Bit mask of CH18 field. */ +#define PPI_CHG_CH18_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH18_Included (1UL) /*!< Include */ + +/* Bit 17 : Include or exclude channel 17 */ +#define PPI_CHG_CH17_Pos (17UL) /*!< Position of CH17 field. */ +#define PPI_CHG_CH17_Msk (0x1UL << PPI_CHG_CH17_Pos) /*!< Bit mask of CH17 field. */ +#define PPI_CHG_CH17_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH17_Included (1UL) /*!< Include */ + +/* Bit 16 : Include or exclude channel 16 */ +#define PPI_CHG_CH16_Pos (16UL) /*!< Position of CH16 field. */ +#define PPI_CHG_CH16_Msk (0x1UL << PPI_CHG_CH16_Pos) /*!< Bit mask of CH16 field. */ +#define PPI_CHG_CH16_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH16_Included (1UL) /*!< Include */ + +/* Bit 15 : Include or exclude channel 15 */ +#define PPI_CHG_CH15_Pos (15UL) /*!< Position of CH15 field. */ +#define PPI_CHG_CH15_Msk (0x1UL << PPI_CHG_CH15_Pos) /*!< Bit mask of CH15 field. */ +#define PPI_CHG_CH15_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH15_Included (1UL) /*!< Include */ + +/* Bit 14 : Include or exclude channel 14 */ +#define PPI_CHG_CH14_Pos (14UL) /*!< Position of CH14 field. */ +#define PPI_CHG_CH14_Msk (0x1UL << PPI_CHG_CH14_Pos) /*!< Bit mask of CH14 field. */ +#define PPI_CHG_CH14_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH14_Included (1UL) /*!< Include */ + +/* Bit 13 : Include or exclude channel 13 */ +#define PPI_CHG_CH13_Pos (13UL) /*!< Position of CH13 field. */ +#define PPI_CHG_CH13_Msk (0x1UL << PPI_CHG_CH13_Pos) /*!< Bit mask of CH13 field. */ +#define PPI_CHG_CH13_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH13_Included (1UL) /*!< Include */ + +/* Bit 12 : Include or exclude channel 12 */ +#define PPI_CHG_CH12_Pos (12UL) /*!< Position of CH12 field. */ +#define PPI_CHG_CH12_Msk (0x1UL << PPI_CHG_CH12_Pos) /*!< Bit mask of CH12 field. */ +#define PPI_CHG_CH12_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH12_Included (1UL) /*!< Include */ + +/* Bit 11 : Include or exclude channel 11 */ +#define PPI_CHG_CH11_Pos (11UL) /*!< Position of CH11 field. */ +#define PPI_CHG_CH11_Msk (0x1UL << PPI_CHG_CH11_Pos) /*!< Bit mask of CH11 field. */ +#define PPI_CHG_CH11_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH11_Included (1UL) /*!< Include */ + +/* Bit 10 : Include or exclude channel 10 */ +#define PPI_CHG_CH10_Pos (10UL) /*!< Position of CH10 field. */ +#define PPI_CHG_CH10_Msk (0x1UL << PPI_CHG_CH10_Pos) /*!< Bit mask of CH10 field. */ +#define PPI_CHG_CH10_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH10_Included (1UL) /*!< Include */ + +/* Bit 9 : Include or exclude channel 9 */ +#define PPI_CHG_CH9_Pos (9UL) /*!< Position of CH9 field. */ +#define PPI_CHG_CH9_Msk (0x1UL << PPI_CHG_CH9_Pos) /*!< Bit mask of CH9 field. */ +#define PPI_CHG_CH9_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH9_Included (1UL) /*!< Include */ + +/* Bit 8 : Include or exclude channel 8 */ +#define PPI_CHG_CH8_Pos (8UL) /*!< Position of CH8 field. */ +#define PPI_CHG_CH8_Msk (0x1UL << PPI_CHG_CH8_Pos) /*!< Bit mask of CH8 field. */ +#define PPI_CHG_CH8_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH8_Included (1UL) /*!< Include */ + +/* Bit 7 : Include or exclude channel 7 */ +#define PPI_CHG_CH7_Pos (7UL) /*!< Position of CH7 field. */ +#define PPI_CHG_CH7_Msk (0x1UL << PPI_CHG_CH7_Pos) /*!< Bit mask of CH7 field. */ +#define PPI_CHG_CH7_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH7_Included (1UL) /*!< Include */ + +/* Bit 6 : Include or exclude channel 6 */ +#define PPI_CHG_CH6_Pos (6UL) /*!< Position of CH6 field. */ +#define PPI_CHG_CH6_Msk (0x1UL << PPI_CHG_CH6_Pos) /*!< Bit mask of CH6 field. */ +#define PPI_CHG_CH6_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH6_Included (1UL) /*!< Include */ + +/* Bit 5 : Include or exclude channel 5 */ +#define PPI_CHG_CH5_Pos (5UL) /*!< Position of CH5 field. */ +#define PPI_CHG_CH5_Msk (0x1UL << PPI_CHG_CH5_Pos) /*!< Bit mask of CH5 field. */ +#define PPI_CHG_CH5_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH5_Included (1UL) /*!< Include */ + +/* Bit 4 : Include or exclude channel 4 */ +#define PPI_CHG_CH4_Pos (4UL) /*!< Position of CH4 field. */ +#define PPI_CHG_CH4_Msk (0x1UL << PPI_CHG_CH4_Pos) /*!< Bit mask of CH4 field. */ +#define PPI_CHG_CH4_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH4_Included (1UL) /*!< Include */ + +/* Bit 3 : Include or exclude channel 3 */ +#define PPI_CHG_CH3_Pos (3UL) /*!< Position of CH3 field. */ +#define PPI_CHG_CH3_Msk (0x1UL << PPI_CHG_CH3_Pos) /*!< Bit mask of CH3 field. */ +#define PPI_CHG_CH3_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH3_Included (1UL) /*!< Include */ + +/* Bit 2 : Include or exclude channel 2 */ +#define PPI_CHG_CH2_Pos (2UL) /*!< Position of CH2 field. */ +#define PPI_CHG_CH2_Msk (0x1UL << PPI_CHG_CH2_Pos) /*!< Bit mask of CH2 field. */ +#define PPI_CHG_CH2_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH2_Included (1UL) /*!< Include */ + +/* Bit 1 : Include or exclude channel 1 */ +#define PPI_CHG_CH1_Pos (1UL) /*!< Position of CH1 field. */ +#define PPI_CHG_CH1_Msk (0x1UL << PPI_CHG_CH1_Pos) /*!< Bit mask of CH1 field. */ +#define PPI_CHG_CH1_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH1_Included (1UL) /*!< Include */ + +/* Bit 0 : Include or exclude channel 0 */ +#define PPI_CHG_CH0_Pos (0UL) /*!< Position of CH0 field. */ +#define PPI_CHG_CH0_Msk (0x1UL << PPI_CHG_CH0_Pos) /*!< Bit mask of CH0 field. */ +#define PPI_CHG_CH0_Excluded (0UL) /*!< Exclude */ +#define PPI_CHG_CH0_Included (1UL) /*!< Include */ + +/* Register: PPI_FORK_TEP */ +/* Description: Description cluster[0]: Channel 0 task end-point */ + +/* Bits 31..0 : Pointer to task register */ +#define PPI_FORK_TEP_TEP_Pos (0UL) /*!< Position of TEP field. */ +#define PPI_FORK_TEP_TEP_Msk (0xFFFFFFFFUL << PPI_FORK_TEP_TEP_Pos) /*!< Bit mask of TEP field. */ + + +/* Peripheral: PWM */ +/* Description: Pulse Width Modulation Unit 0 */ + +/* Register: PWM_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between LOOPSDONE event and STOP task */ +#define PWM_SHORTS_LOOPSDONE_STOP_Pos (4UL) /*!< Position of LOOPSDONE_STOP field. */ +#define PWM_SHORTS_LOOPSDONE_STOP_Msk (0x1UL << PWM_SHORTS_LOOPSDONE_STOP_Pos) /*!< Bit mask of LOOPSDONE_STOP field. */ +#define PWM_SHORTS_LOOPSDONE_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_LOOPSDONE_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between LOOPSDONE event and SEQSTART[1] task */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART1_Pos (3UL) /*!< Position of LOOPSDONE_SEQSTART1 field. */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART1_Msk (0x1UL << PWM_SHORTS_LOOPSDONE_SEQSTART1_Pos) /*!< Bit mask of LOOPSDONE_SEQSTART1 field. */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART1_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART1_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between LOOPSDONE event and SEQSTART[0] task */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Pos (2UL) /*!< Position of LOOPSDONE_SEQSTART0 field. */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk (0x1UL << PWM_SHORTS_LOOPSDONE_SEQSTART0_Pos) /*!< Bit mask of LOOPSDONE_SEQSTART0 field. */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between SEQEND[1] event and STOP task */ +#define PWM_SHORTS_SEQEND1_STOP_Pos (1UL) /*!< Position of SEQEND1_STOP field. */ +#define PWM_SHORTS_SEQEND1_STOP_Msk (0x1UL << PWM_SHORTS_SEQEND1_STOP_Pos) /*!< Bit mask of SEQEND1_STOP field. */ +#define PWM_SHORTS_SEQEND1_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_SEQEND1_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between SEQEND[0] event and STOP task */ +#define PWM_SHORTS_SEQEND0_STOP_Pos (0UL) /*!< Position of SEQEND0_STOP field. */ +#define PWM_SHORTS_SEQEND0_STOP_Msk (0x1UL << PWM_SHORTS_SEQEND0_STOP_Pos) /*!< Bit mask of SEQEND0_STOP field. */ +#define PWM_SHORTS_SEQEND0_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define PWM_SHORTS_SEQEND0_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: PWM_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 7 : Enable or disable interrupt for LOOPSDONE event */ +#define PWM_INTEN_LOOPSDONE_Pos (7UL) /*!< Position of LOOPSDONE field. */ +#define PWM_INTEN_LOOPSDONE_Msk (0x1UL << PWM_INTEN_LOOPSDONE_Pos) /*!< Bit mask of LOOPSDONE field. */ +#define PWM_INTEN_LOOPSDONE_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_LOOPSDONE_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for PWMPERIODEND event */ +#define PWM_INTEN_PWMPERIODEND_Pos (6UL) /*!< Position of PWMPERIODEND field. */ +#define PWM_INTEN_PWMPERIODEND_Msk (0x1UL << PWM_INTEN_PWMPERIODEND_Pos) /*!< Bit mask of PWMPERIODEND field. */ +#define PWM_INTEN_PWMPERIODEND_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_PWMPERIODEND_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for SEQEND[1] event */ +#define PWM_INTEN_SEQEND1_Pos (5UL) /*!< Position of SEQEND1 field. */ +#define PWM_INTEN_SEQEND1_Msk (0x1UL << PWM_INTEN_SEQEND1_Pos) /*!< Bit mask of SEQEND1 field. */ +#define PWM_INTEN_SEQEND1_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_SEQEND1_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for SEQEND[0] event */ +#define PWM_INTEN_SEQEND0_Pos (4UL) /*!< Position of SEQEND0 field. */ +#define PWM_INTEN_SEQEND0_Msk (0x1UL << PWM_INTEN_SEQEND0_Pos) /*!< Bit mask of SEQEND0 field. */ +#define PWM_INTEN_SEQEND0_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_SEQEND0_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for SEQSTARTED[1] event */ +#define PWM_INTEN_SEQSTARTED1_Pos (3UL) /*!< Position of SEQSTARTED1 field. */ +#define PWM_INTEN_SEQSTARTED1_Msk (0x1UL << PWM_INTEN_SEQSTARTED1_Pos) /*!< Bit mask of SEQSTARTED1 field. */ +#define PWM_INTEN_SEQSTARTED1_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_SEQSTARTED1_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for SEQSTARTED[0] event */ +#define PWM_INTEN_SEQSTARTED0_Pos (2UL) /*!< Position of SEQSTARTED0 field. */ +#define PWM_INTEN_SEQSTARTED0_Msk (0x1UL << PWM_INTEN_SEQSTARTED0_Pos) /*!< Bit mask of SEQSTARTED0 field. */ +#define PWM_INTEN_SEQSTARTED0_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_SEQSTARTED0_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STOPPED event */ +#define PWM_INTEN_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PWM_INTEN_STOPPED_Msk (0x1UL << PWM_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PWM_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define PWM_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Register: PWM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 7 : Write '1' to Enable interrupt for LOOPSDONE event */ +#define PWM_INTENSET_LOOPSDONE_Pos (7UL) /*!< Position of LOOPSDONE field. */ +#define PWM_INTENSET_LOOPSDONE_Msk (0x1UL << PWM_INTENSET_LOOPSDONE_Pos) /*!< Bit mask of LOOPSDONE field. */ +#define PWM_INTENSET_LOOPSDONE_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_LOOPSDONE_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_LOOPSDONE_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for PWMPERIODEND event */ +#define PWM_INTENSET_PWMPERIODEND_Pos (6UL) /*!< Position of PWMPERIODEND field. */ +#define PWM_INTENSET_PWMPERIODEND_Msk (0x1UL << PWM_INTENSET_PWMPERIODEND_Pos) /*!< Bit mask of PWMPERIODEND field. */ +#define PWM_INTENSET_PWMPERIODEND_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_PWMPERIODEND_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_PWMPERIODEND_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for SEQEND[1] event */ +#define PWM_INTENSET_SEQEND1_Pos (5UL) /*!< Position of SEQEND1 field. */ +#define PWM_INTENSET_SEQEND1_Msk (0x1UL << PWM_INTENSET_SEQEND1_Pos) /*!< Bit mask of SEQEND1 field. */ +#define PWM_INTENSET_SEQEND1_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_SEQEND1_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_SEQEND1_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for SEQEND[0] event */ +#define PWM_INTENSET_SEQEND0_Pos (4UL) /*!< Position of SEQEND0 field. */ +#define PWM_INTENSET_SEQEND0_Msk (0x1UL << PWM_INTENSET_SEQEND0_Pos) /*!< Bit mask of SEQEND0 field. */ +#define PWM_INTENSET_SEQEND0_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_SEQEND0_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_SEQEND0_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for SEQSTARTED[1] event */ +#define PWM_INTENSET_SEQSTARTED1_Pos (3UL) /*!< Position of SEQSTARTED1 field. */ +#define PWM_INTENSET_SEQSTARTED1_Msk (0x1UL << PWM_INTENSET_SEQSTARTED1_Pos) /*!< Bit mask of SEQSTARTED1 field. */ +#define PWM_INTENSET_SEQSTARTED1_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_SEQSTARTED1_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_SEQSTARTED1_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for SEQSTARTED[0] event */ +#define PWM_INTENSET_SEQSTARTED0_Pos (2UL) /*!< Position of SEQSTARTED0 field. */ +#define PWM_INTENSET_SEQSTARTED0_Msk (0x1UL << PWM_INTENSET_SEQSTARTED0_Pos) /*!< Bit mask of SEQSTARTED0 field. */ +#define PWM_INTENSET_SEQSTARTED0_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_SEQSTARTED0_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_SEQSTARTED0_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define PWM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PWM_INTENSET_STOPPED_Msk (0x1UL << PWM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PWM_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: PWM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 7 : Write '1' to Disable interrupt for LOOPSDONE event */ +#define PWM_INTENCLR_LOOPSDONE_Pos (7UL) /*!< Position of LOOPSDONE field. */ +#define PWM_INTENCLR_LOOPSDONE_Msk (0x1UL << PWM_INTENCLR_LOOPSDONE_Pos) /*!< Bit mask of LOOPSDONE field. */ +#define PWM_INTENCLR_LOOPSDONE_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_LOOPSDONE_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_LOOPSDONE_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for PWMPERIODEND event */ +#define PWM_INTENCLR_PWMPERIODEND_Pos (6UL) /*!< Position of PWMPERIODEND field. */ +#define PWM_INTENCLR_PWMPERIODEND_Msk (0x1UL << PWM_INTENCLR_PWMPERIODEND_Pos) /*!< Bit mask of PWMPERIODEND field. */ +#define PWM_INTENCLR_PWMPERIODEND_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_PWMPERIODEND_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_PWMPERIODEND_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for SEQEND[1] event */ +#define PWM_INTENCLR_SEQEND1_Pos (5UL) /*!< Position of SEQEND1 field. */ +#define PWM_INTENCLR_SEQEND1_Msk (0x1UL << PWM_INTENCLR_SEQEND1_Pos) /*!< Bit mask of SEQEND1 field. */ +#define PWM_INTENCLR_SEQEND1_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_SEQEND1_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_SEQEND1_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for SEQEND[0] event */ +#define PWM_INTENCLR_SEQEND0_Pos (4UL) /*!< Position of SEQEND0 field. */ +#define PWM_INTENCLR_SEQEND0_Msk (0x1UL << PWM_INTENCLR_SEQEND0_Pos) /*!< Bit mask of SEQEND0 field. */ +#define PWM_INTENCLR_SEQEND0_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_SEQEND0_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_SEQEND0_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for SEQSTARTED[1] event */ +#define PWM_INTENCLR_SEQSTARTED1_Pos (3UL) /*!< Position of SEQSTARTED1 field. */ +#define PWM_INTENCLR_SEQSTARTED1_Msk (0x1UL << PWM_INTENCLR_SEQSTARTED1_Pos) /*!< Bit mask of SEQSTARTED1 field. */ +#define PWM_INTENCLR_SEQSTARTED1_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_SEQSTARTED1_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_SEQSTARTED1_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for SEQSTARTED[0] event */ +#define PWM_INTENCLR_SEQSTARTED0_Pos (2UL) /*!< Position of SEQSTARTED0 field. */ +#define PWM_INTENCLR_SEQSTARTED0_Msk (0x1UL << PWM_INTENCLR_SEQSTARTED0_Pos) /*!< Bit mask of SEQSTARTED0 field. */ +#define PWM_INTENCLR_SEQSTARTED0_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_SEQSTARTED0_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_SEQSTARTED0_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define PWM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define PWM_INTENCLR_STOPPED_Msk (0x1UL << PWM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define PWM_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define PWM_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define PWM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: PWM_ENABLE */ +/* Description: PWM module enable register */ + +/* Bit 0 : Enable or disable PWM module */ +#define PWM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define PWM_ENABLE_ENABLE_Msk (0x1UL << PWM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define PWM_ENABLE_ENABLE_Disabled (0UL) /*!< Disabled */ +#define PWM_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: PWM_MODE */ +/* Description: Selects operating mode of the wave counter */ + +/* Bit 0 : Selects up or up and down as wave counter mode */ +#define PWM_MODE_UPDOWN_Pos (0UL) /*!< Position of UPDOWN field. */ +#define PWM_MODE_UPDOWN_Msk (0x1UL << PWM_MODE_UPDOWN_Pos) /*!< Bit mask of UPDOWN field. */ +#define PWM_MODE_UPDOWN_Up (0UL) /*!< Up counter - edge aligned PWM duty-cycle */ +#define PWM_MODE_UPDOWN_UpAndDown (1UL) /*!< Up and down counter - center aligned PWM duty cycle */ + +/* Register: PWM_COUNTERTOP */ +/* Description: Value up to which the pulse generator counter counts */ + +/* Bits 14..0 : Value up to which the pulse generator counter counts. This register is ignored when DECODER.MODE=WaveForm and only values from RAM will be used. */ +#define PWM_COUNTERTOP_COUNTERTOP_Pos (0UL) /*!< Position of COUNTERTOP field. */ +#define PWM_COUNTERTOP_COUNTERTOP_Msk (0x7FFFUL << PWM_COUNTERTOP_COUNTERTOP_Pos) /*!< Bit mask of COUNTERTOP field. */ + +/* Register: PWM_PRESCALER */ +/* Description: Configuration for PWM_CLK */ + +/* Bits 2..0 : Pre-scaler of PWM_CLK */ +#define PWM_PRESCALER_PRESCALER_Pos (0UL) /*!< Position of PRESCALER field. */ +#define PWM_PRESCALER_PRESCALER_Msk (0x7UL << PWM_PRESCALER_PRESCALER_Pos) /*!< Bit mask of PRESCALER field. */ +#define PWM_PRESCALER_PRESCALER_DIV_1 (0UL) /*!< Divide by 1 (16MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_2 (1UL) /*!< Divide by 2 ( 8MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_4 (2UL) /*!< Divide by 4 ( 4MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_8 (3UL) /*!< Divide by 8 ( 2MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_16 (4UL) /*!< Divide by 16 ( 1MHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_32 (5UL) /*!< Divide by 32 ( 500kHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_64 (6UL) /*!< Divide by 64 ( 250kHz) */ +#define PWM_PRESCALER_PRESCALER_DIV_128 (7UL) /*!< Divide by 128 ( 125kHz) */ + +/* Register: PWM_DECODER */ +/* Description: Configuration of the decoder */ + +/* Bit 8 : Selects source for advancing the active sequence */ +#define PWM_DECODER_MODE_Pos (8UL) /*!< Position of MODE field. */ +#define PWM_DECODER_MODE_Msk (0x1UL << PWM_DECODER_MODE_Pos) /*!< Bit mask of MODE field. */ +#define PWM_DECODER_MODE_RefreshCount (0UL) /*!< SEQ[n].REFRESH is used to determine loading internal compare registers */ +#define PWM_DECODER_MODE_NextStep (1UL) /*!< NEXTSTEP task causes a new value to be loaded to internal compare registers */ + +/* Bits 2..0 : How a sequence is read from RAM and spread to the compare register */ +#define PWM_DECODER_LOAD_Pos (0UL) /*!< Position of LOAD field. */ +#define PWM_DECODER_LOAD_Msk (0x7UL << PWM_DECODER_LOAD_Pos) /*!< Bit mask of LOAD field. */ +#define PWM_DECODER_LOAD_Common (0UL) /*!< 1st half word (16-bit) used in all PWM channels 0..3 */ +#define PWM_DECODER_LOAD_Grouped (1UL) /*!< 1st half word (16-bit) used in channel 0..1; 2nd word in channel 2..3 */ +#define PWM_DECODER_LOAD_Individual (2UL) /*!< 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in ch.3 */ +#define PWM_DECODER_LOAD_WaveForm (3UL) /*!< 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in COUNTERTOP */ + +/* Register: PWM_LOOP */ +/* Description: Amount of playback of a loop */ + +/* Bits 15..0 : Amount of playback of pattern cycles */ +#define PWM_LOOP_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define PWM_LOOP_CNT_Msk (0xFFFFUL << PWM_LOOP_CNT_Pos) /*!< Bit mask of CNT field. */ +#define PWM_LOOP_CNT_Disabled (0UL) /*!< Looping disabled (stop at the end of the sequence) */ + +/* Register: PWM_SEQ_PTR */ +/* Description: Description cluster[0]: Beginning address in Data RAM of sequence A */ + +/* Bits 31..0 : Beginning address in Data RAM of sequence A */ +#define PWM_SEQ_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define PWM_SEQ_PTR_PTR_Msk (0xFFFFFFFFUL << PWM_SEQ_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: PWM_SEQ_CNT */ +/* Description: Description cluster[0]: Amount of values (duty cycles) in sequence A */ + +/* Bits 14..0 : Amount of values (duty cycles) in sequence A */ +#define PWM_SEQ_CNT_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define PWM_SEQ_CNT_CNT_Msk (0x7FFFUL << PWM_SEQ_CNT_CNT_Pos) /*!< Bit mask of CNT field. */ +#define PWM_SEQ_CNT_CNT_Disabled (0UL) /*!< Sequence is disabled, and shall not be started as it is empty */ + +/* Register: PWM_SEQ_REFRESH */ +/* Description: Description cluster[0]: Amount of additional PWM periods between samples loaded to compare register (load every CNT+1 PWM periods) */ + +/* Bits 23..0 : Amount of additional PWM periods between samples loaded to compare register (load every CNT+1 PWM periods) */ +#define PWM_SEQ_REFRESH_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define PWM_SEQ_REFRESH_CNT_Msk (0xFFFFFFUL << PWM_SEQ_REFRESH_CNT_Pos) /*!< Bit mask of CNT field. */ +#define PWM_SEQ_REFRESH_CNT_Continuous (0UL) /*!< Update every PWM period */ + +/* Register: PWM_SEQ_ENDDELAY */ +/* Description: Description cluster[0]: Time added after the sequence */ + +/* Bits 23..0 : Time added after the sequence in PWM periods */ +#define PWM_SEQ_ENDDELAY_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define PWM_SEQ_ENDDELAY_CNT_Msk (0xFFFFFFUL << PWM_SEQ_ENDDELAY_CNT_Pos) /*!< Bit mask of CNT field. */ + +/* Register: PWM_PSEL_OUT */ +/* Description: Description collection[0]: Output pin select for PWM channel 0 */ + +/* Bit 31 : Connection */ +#define PWM_PSEL_OUT_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define PWM_PSEL_OUT_CONNECT_Msk (0x1UL << PWM_PSEL_OUT_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define PWM_PSEL_OUT_CONNECT_Connected (0UL) /*!< Connect */ +#define PWM_PSEL_OUT_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 9..8 : Port number */ +#define PWM_PSEL_OUT_PORT_Pos (8UL) /*!< Position of PORT field. */ +#define PWM_PSEL_OUT_PORT_Msk (0x3UL << PWM_PSEL_OUT_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define PWM_PSEL_OUT_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define PWM_PSEL_OUT_PIN_Msk (0x1FUL << PWM_PSEL_OUT_PIN_Pos) /*!< Bit mask of PIN field. */ + + +/* Peripheral: QDEC */ +/* Description: Quadrature Decoder */ + +/* Register: QDEC_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 6 : Shortcut between SAMPLERDY event and READCLRACC task */ +#define QDEC_SHORTS_SAMPLERDY_READCLRACC_Pos (6UL) /*!< Position of SAMPLERDY_READCLRACC field. */ +#define QDEC_SHORTS_SAMPLERDY_READCLRACC_Msk (0x1UL << QDEC_SHORTS_SAMPLERDY_READCLRACC_Pos) /*!< Bit mask of SAMPLERDY_READCLRACC field. */ +#define QDEC_SHORTS_SAMPLERDY_READCLRACC_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_SAMPLERDY_READCLRACC_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 5 : Shortcut between DBLRDY event and STOP task */ +#define QDEC_SHORTS_DBLRDY_STOP_Pos (5UL) /*!< Position of DBLRDY_STOP field. */ +#define QDEC_SHORTS_DBLRDY_STOP_Msk (0x1UL << QDEC_SHORTS_DBLRDY_STOP_Pos) /*!< Bit mask of DBLRDY_STOP field. */ +#define QDEC_SHORTS_DBLRDY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_DBLRDY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 4 : Shortcut between DBLRDY event and RDCLRDBL task */ +#define QDEC_SHORTS_DBLRDY_RDCLRDBL_Pos (4UL) /*!< Position of DBLRDY_RDCLRDBL field. */ +#define QDEC_SHORTS_DBLRDY_RDCLRDBL_Msk (0x1UL << QDEC_SHORTS_DBLRDY_RDCLRDBL_Pos) /*!< Bit mask of DBLRDY_RDCLRDBL field. */ +#define QDEC_SHORTS_DBLRDY_RDCLRDBL_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_DBLRDY_RDCLRDBL_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between REPORTRDY event and STOP task */ +#define QDEC_SHORTS_REPORTRDY_STOP_Pos (3UL) /*!< Position of REPORTRDY_STOP field. */ +#define QDEC_SHORTS_REPORTRDY_STOP_Msk (0x1UL << QDEC_SHORTS_REPORTRDY_STOP_Pos) /*!< Bit mask of REPORTRDY_STOP field. */ +#define QDEC_SHORTS_REPORTRDY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_REPORTRDY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between REPORTRDY event and RDCLRACC task */ +#define QDEC_SHORTS_REPORTRDY_RDCLRACC_Pos (2UL) /*!< Position of REPORTRDY_RDCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_RDCLRACC_Msk (0x1UL << QDEC_SHORTS_REPORTRDY_RDCLRACC_Pos) /*!< Bit mask of REPORTRDY_RDCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_RDCLRACC_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_REPORTRDY_RDCLRACC_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between SAMPLERDY event and STOP task */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Pos (1UL) /*!< Position of SAMPLERDY_STOP field. */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Msk (0x1UL << QDEC_SHORTS_SAMPLERDY_STOP_Pos) /*!< Bit mask of SAMPLERDY_STOP field. */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_SAMPLERDY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between REPORTRDY event and READCLRACC task */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Pos (0UL) /*!< Position of REPORTRDY_READCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Msk (0x1UL << QDEC_SHORTS_REPORTRDY_READCLRACC_Pos) /*!< Bit mask of REPORTRDY_READCLRACC field. */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Disabled (0UL) /*!< Disable shortcut */ +#define QDEC_SHORTS_REPORTRDY_READCLRACC_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: QDEC_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 4 : Write '1' to Enable interrupt for STOPPED event */ +#define QDEC_INTENSET_STOPPED_Pos (4UL) /*!< Position of STOPPED field. */ +#define QDEC_INTENSET_STOPPED_Msk (0x1UL << QDEC_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define QDEC_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for DBLRDY event */ +#define QDEC_INTENSET_DBLRDY_Pos (3UL) /*!< Position of DBLRDY field. */ +#define QDEC_INTENSET_DBLRDY_Msk (0x1UL << QDEC_INTENSET_DBLRDY_Pos) /*!< Bit mask of DBLRDY field. */ +#define QDEC_INTENSET_DBLRDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_DBLRDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_DBLRDY_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for ACCOF event */ +#define QDEC_INTENSET_ACCOF_Pos (2UL) /*!< Position of ACCOF field. */ +#define QDEC_INTENSET_ACCOF_Msk (0x1UL << QDEC_INTENSET_ACCOF_Pos) /*!< Bit mask of ACCOF field. */ +#define QDEC_INTENSET_ACCOF_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_ACCOF_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_ACCOF_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for REPORTRDY event */ +#define QDEC_INTENSET_REPORTRDY_Pos (1UL) /*!< Position of REPORTRDY field. */ +#define QDEC_INTENSET_REPORTRDY_Msk (0x1UL << QDEC_INTENSET_REPORTRDY_Pos) /*!< Bit mask of REPORTRDY field. */ +#define QDEC_INTENSET_REPORTRDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_REPORTRDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_REPORTRDY_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for SAMPLERDY event */ +#define QDEC_INTENSET_SAMPLERDY_Pos (0UL) /*!< Position of SAMPLERDY field. */ +#define QDEC_INTENSET_SAMPLERDY_Msk (0x1UL << QDEC_INTENSET_SAMPLERDY_Pos) /*!< Bit mask of SAMPLERDY field. */ +#define QDEC_INTENSET_SAMPLERDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENSET_SAMPLERDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENSET_SAMPLERDY_Set (1UL) /*!< Enable */ + +/* Register: QDEC_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 4 : Write '1' to Disable interrupt for STOPPED event */ +#define QDEC_INTENCLR_STOPPED_Pos (4UL) /*!< Position of STOPPED field. */ +#define QDEC_INTENCLR_STOPPED_Msk (0x1UL << QDEC_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define QDEC_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for DBLRDY event */ +#define QDEC_INTENCLR_DBLRDY_Pos (3UL) /*!< Position of DBLRDY field. */ +#define QDEC_INTENCLR_DBLRDY_Msk (0x1UL << QDEC_INTENCLR_DBLRDY_Pos) /*!< Bit mask of DBLRDY field. */ +#define QDEC_INTENCLR_DBLRDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_DBLRDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_DBLRDY_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for ACCOF event */ +#define QDEC_INTENCLR_ACCOF_Pos (2UL) /*!< Position of ACCOF field. */ +#define QDEC_INTENCLR_ACCOF_Msk (0x1UL << QDEC_INTENCLR_ACCOF_Pos) /*!< Bit mask of ACCOF field. */ +#define QDEC_INTENCLR_ACCOF_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_ACCOF_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_ACCOF_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for REPORTRDY event */ +#define QDEC_INTENCLR_REPORTRDY_Pos (1UL) /*!< Position of REPORTRDY field. */ +#define QDEC_INTENCLR_REPORTRDY_Msk (0x1UL << QDEC_INTENCLR_REPORTRDY_Pos) /*!< Bit mask of REPORTRDY field. */ +#define QDEC_INTENCLR_REPORTRDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_REPORTRDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_REPORTRDY_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for SAMPLERDY event */ +#define QDEC_INTENCLR_SAMPLERDY_Pos (0UL) /*!< Position of SAMPLERDY field. */ +#define QDEC_INTENCLR_SAMPLERDY_Msk (0x1UL << QDEC_INTENCLR_SAMPLERDY_Pos) /*!< Bit mask of SAMPLERDY field. */ +#define QDEC_INTENCLR_SAMPLERDY_Disabled (0UL) /*!< Read: Disabled */ +#define QDEC_INTENCLR_SAMPLERDY_Enabled (1UL) /*!< Read: Enabled */ +#define QDEC_INTENCLR_SAMPLERDY_Clear (1UL) /*!< Disable */ + +/* Register: QDEC_ENABLE */ +/* Description: Enable the quadrature decoder */ + +/* Bit 0 : Enable or disable the quadrature decoder */ +#define QDEC_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define QDEC_ENABLE_ENABLE_Msk (0x1UL << QDEC_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define QDEC_ENABLE_ENABLE_Disabled (0UL) /*!< Disable */ +#define QDEC_ENABLE_ENABLE_Enabled (1UL) /*!< Enable */ + +/* Register: QDEC_LEDPOL */ +/* Description: LED output pin polarity */ + +/* Bit 0 : LED output pin polarity */ +#define QDEC_LEDPOL_LEDPOL_Pos (0UL) /*!< Position of LEDPOL field. */ +#define QDEC_LEDPOL_LEDPOL_Msk (0x1UL << QDEC_LEDPOL_LEDPOL_Pos) /*!< Bit mask of LEDPOL field. */ +#define QDEC_LEDPOL_LEDPOL_ActiveLow (0UL) /*!< Led active on output pin low */ +#define QDEC_LEDPOL_LEDPOL_ActiveHigh (1UL) /*!< Led active on output pin high */ + +/* Register: QDEC_SAMPLEPER */ +/* Description: Sample period */ + +/* Bits 3..0 : Sample period. The SAMPLE register will be updated for every new sample */ +#define QDEC_SAMPLEPER_SAMPLEPER_Pos (0UL) /*!< Position of SAMPLEPER field. */ +#define QDEC_SAMPLEPER_SAMPLEPER_Msk (0xFUL << QDEC_SAMPLEPER_SAMPLEPER_Pos) /*!< Bit mask of SAMPLEPER field. */ +#define QDEC_SAMPLEPER_SAMPLEPER_128us (0UL) /*!< 128 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_256us (1UL) /*!< 256 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_512us (2UL) /*!< 512 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_1024us (3UL) /*!< 1024 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_2048us (4UL) /*!< 2048 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_4096us (5UL) /*!< 4096 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_8192us (6UL) /*!< 8192 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_16384us (7UL) /*!< 16384 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_32ms (8UL) /*!< 32768 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_65ms (9UL) /*!< 65536 us */ +#define QDEC_SAMPLEPER_SAMPLEPER_131ms (10UL) /*!< 131072 us */ + +/* Register: QDEC_SAMPLE */ +/* Description: Motion sample value */ + +/* Bits 31..0 : Last motion sample */ +#define QDEC_SAMPLE_SAMPLE_Pos (0UL) /*!< Position of SAMPLE field. */ +#define QDEC_SAMPLE_SAMPLE_Msk (0xFFFFFFFFUL << QDEC_SAMPLE_SAMPLE_Pos) /*!< Bit mask of SAMPLE field. */ + +/* Register: QDEC_REPORTPER */ +/* Description: Number of samples to be taken before REPORTRDY and DBLRDY events can be generated */ + +/* Bits 3..0 : Specifies the number of samples to be accumulated in the ACC register before the REPORTRDY and DBLRDY events can be generated */ +#define QDEC_REPORTPER_REPORTPER_Pos (0UL) /*!< Position of REPORTPER field. */ +#define QDEC_REPORTPER_REPORTPER_Msk (0xFUL << QDEC_REPORTPER_REPORTPER_Pos) /*!< Bit mask of REPORTPER field. */ +#define QDEC_REPORTPER_REPORTPER_10Smpl (0UL) /*!< 10 samples / report */ +#define QDEC_REPORTPER_REPORTPER_40Smpl (1UL) /*!< 40 samples / report */ +#define QDEC_REPORTPER_REPORTPER_80Smpl (2UL) /*!< 80 samples / report */ +#define QDEC_REPORTPER_REPORTPER_120Smpl (3UL) /*!< 120 samples / report */ +#define QDEC_REPORTPER_REPORTPER_160Smpl (4UL) /*!< 160 samples / report */ +#define QDEC_REPORTPER_REPORTPER_200Smpl (5UL) /*!< 200 samples / report */ +#define QDEC_REPORTPER_REPORTPER_240Smpl (6UL) /*!< 240 samples / report */ +#define QDEC_REPORTPER_REPORTPER_280Smpl (7UL) /*!< 280 samples / report */ +#define QDEC_REPORTPER_REPORTPER_1Smpl (8UL) /*!< 1 sample / report */ + +/* Register: QDEC_ACC */ +/* Description: Register accumulating the valid transitions */ + +/* Bits 31..0 : Register accumulating all valid samples (not double transition) read from the SAMPLE register */ +#define QDEC_ACC_ACC_Pos (0UL) /*!< Position of ACC field. */ +#define QDEC_ACC_ACC_Msk (0xFFFFFFFFUL << QDEC_ACC_ACC_Pos) /*!< Bit mask of ACC field. */ + +/* Register: QDEC_ACCREAD */ +/* Description: Snapshot of the ACC register, updated by the READCLRACC or RDCLRACC task */ + +/* Bits 31..0 : Snapshot of the ACC register. */ +#define QDEC_ACCREAD_ACCREAD_Pos (0UL) /*!< Position of ACCREAD field. */ +#define QDEC_ACCREAD_ACCREAD_Msk (0xFFFFFFFFUL << QDEC_ACCREAD_ACCREAD_Pos) /*!< Bit mask of ACCREAD field. */ + +/* Register: QDEC_PSEL_LED */ +/* Description: Pin select for LED signal */ + +/* Bit 31 : Connection */ +#define QDEC_PSEL_LED_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QDEC_PSEL_LED_CONNECT_Msk (0x1UL << QDEC_PSEL_LED_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QDEC_PSEL_LED_CONNECT_Connected (0UL) /*!< Connect */ +#define QDEC_PSEL_LED_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QDEC_PSEL_LED_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QDEC_PSEL_LED_PORT_Msk (0x3UL << QDEC_PSEL_LED_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QDEC_PSEL_LED_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QDEC_PSEL_LED_PIN_Msk (0x1FUL << QDEC_PSEL_LED_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QDEC_PSEL_A */ +/* Description: Pin select for A signal */ + +/* Bit 31 : Connection */ +#define QDEC_PSEL_A_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QDEC_PSEL_A_CONNECT_Msk (0x1UL << QDEC_PSEL_A_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QDEC_PSEL_A_CONNECT_Connected (0UL) /*!< Connect */ +#define QDEC_PSEL_A_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QDEC_PSEL_A_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QDEC_PSEL_A_PORT_Msk (0x3UL << QDEC_PSEL_A_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QDEC_PSEL_A_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QDEC_PSEL_A_PIN_Msk (0x1FUL << QDEC_PSEL_A_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QDEC_PSEL_B */ +/* Description: Pin select for B signal */ + +/* Bit 31 : Connection */ +#define QDEC_PSEL_B_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QDEC_PSEL_B_CONNECT_Msk (0x1UL << QDEC_PSEL_B_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QDEC_PSEL_B_CONNECT_Connected (0UL) /*!< Connect */ +#define QDEC_PSEL_B_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QDEC_PSEL_B_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QDEC_PSEL_B_PORT_Msk (0x3UL << QDEC_PSEL_B_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QDEC_PSEL_B_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QDEC_PSEL_B_PIN_Msk (0x1FUL << QDEC_PSEL_B_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QDEC_DBFEN */ +/* Description: Enable input debounce filters */ + +/* Bit 0 : Enable input debounce filters */ +#define QDEC_DBFEN_DBFEN_Pos (0UL) /*!< Position of DBFEN field. */ +#define QDEC_DBFEN_DBFEN_Msk (0x1UL << QDEC_DBFEN_DBFEN_Pos) /*!< Bit mask of DBFEN field. */ +#define QDEC_DBFEN_DBFEN_Disabled (0UL) /*!< Debounce input filters disabled */ +#define QDEC_DBFEN_DBFEN_Enabled (1UL) /*!< Debounce input filters enabled */ + +/* Register: QDEC_LEDPRE */ +/* Description: Time period the LED is switched ON prior to sampling */ + +/* Bits 8..0 : Period in us the LED is switched on prior to sampling */ +#define QDEC_LEDPRE_LEDPRE_Pos (0UL) /*!< Position of LEDPRE field. */ +#define QDEC_LEDPRE_LEDPRE_Msk (0x1FFUL << QDEC_LEDPRE_LEDPRE_Pos) /*!< Bit mask of LEDPRE field. */ + +/* Register: QDEC_ACCDBL */ +/* Description: Register accumulating the number of detected double transitions */ + +/* Bits 3..0 : Register accumulating the number of detected double or illegal transitions. ( SAMPLE = 2 ). */ +#define QDEC_ACCDBL_ACCDBL_Pos (0UL) /*!< Position of ACCDBL field. */ +#define QDEC_ACCDBL_ACCDBL_Msk (0xFUL << QDEC_ACCDBL_ACCDBL_Pos) /*!< Bit mask of ACCDBL field. */ + +/* Register: QDEC_ACCDBLREAD */ +/* Description: Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL task */ + +/* Bits 3..0 : Snapshot of the ACCDBL register. This field is updated when the READCLRACC or RDCLRDBL task is triggered. */ +#define QDEC_ACCDBLREAD_ACCDBLREAD_Pos (0UL) /*!< Position of ACCDBLREAD field. */ +#define QDEC_ACCDBLREAD_ACCDBLREAD_Msk (0xFUL << QDEC_ACCDBLREAD_ACCDBLREAD_Pos) /*!< Bit mask of ACCDBLREAD field. */ + + +/* Peripheral: QSPI */ +/* Description: External flash interface */ + +/* Register: QSPI_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 0 : Enable or disable interrupt for READY event */ +#define QSPI_INTEN_READY_Pos (0UL) /*!< Position of READY field. */ +#define QSPI_INTEN_READY_Msk (0x1UL << QSPI_INTEN_READY_Pos) /*!< Bit mask of READY field. */ +#define QSPI_INTEN_READY_Disabled (0UL) /*!< Disable */ +#define QSPI_INTEN_READY_Enabled (1UL) /*!< Enable */ + +/* Register: QSPI_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define QSPI_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define QSPI_INTENSET_READY_Msk (0x1UL << QSPI_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define QSPI_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define QSPI_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define QSPI_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: QSPI_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define QSPI_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define QSPI_INTENCLR_READY_Msk (0x1UL << QSPI_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define QSPI_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define QSPI_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define QSPI_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: QSPI_ENABLE */ +/* Description: Enable QSPI peripheral and acquire the pins selected in PSELn registers */ + +/* Bit 0 : Enable or disable QSPI */ +#define QSPI_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define QSPI_ENABLE_ENABLE_Msk (0x1UL << QSPI_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define QSPI_ENABLE_ENABLE_Disabled (0UL) /*!< Disable QSPI */ +#define QSPI_ENABLE_ENABLE_Enabled (1UL) /*!< Enable QSPI */ + +/* Register: QSPI_READ_SRC */ +/* Description: Flash memory source address */ + +/* Bits 31..0 : Word-aligned flash memory source address. */ +#define QSPI_READ_SRC_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define QSPI_READ_SRC_SRC_Msk (0xFFFFFFFFUL << QSPI_READ_SRC_SRC_Pos) /*!< Bit mask of SRC field. */ + +/* Register: QSPI_READ_DST */ +/* Description: RAM destination address */ + +/* Bits 31..0 : Word-aligned RAM destination address. */ +#define QSPI_READ_DST_DST_Pos (0UL) /*!< Position of DST field. */ +#define QSPI_READ_DST_DST_Msk (0xFFFFFFFFUL << QSPI_READ_DST_DST_Pos) /*!< Bit mask of DST field. */ + +/* Register: QSPI_READ_CNT */ +/* Description: Read transfer length */ + +/* Bits 20..0 : Read transfer length in number of bytes. The length must be a multiple of 4 bytes. */ +#define QSPI_READ_CNT_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define QSPI_READ_CNT_CNT_Msk (0x1FFFFFUL << QSPI_READ_CNT_CNT_Pos) /*!< Bit mask of CNT field. */ + +/* Register: QSPI_WRITE_DST */ +/* Description: Flash destination address */ + +/* Bits 31..0 : Word-aligned flash destination address. */ +#define QSPI_WRITE_DST_DST_Pos (0UL) /*!< Position of DST field. */ +#define QSPI_WRITE_DST_DST_Msk (0xFFFFFFFFUL << QSPI_WRITE_DST_DST_Pos) /*!< Bit mask of DST field. */ + +/* Register: QSPI_WRITE_SRC */ +/* Description: RAM source address */ + +/* Bits 31..0 : Word-aligned RAM source address. */ +#define QSPI_WRITE_SRC_SRC_Pos (0UL) /*!< Position of SRC field. */ +#define QSPI_WRITE_SRC_SRC_Msk (0xFFFFFFFFUL << QSPI_WRITE_SRC_SRC_Pos) /*!< Bit mask of SRC field. */ + +/* Register: QSPI_WRITE_CNT */ +/* Description: Write transfer length */ + +/* Bits 20..0 : Write transfer length in number of bytes. The length must be a multiple of 4 bytes. */ +#define QSPI_WRITE_CNT_CNT_Pos (0UL) /*!< Position of CNT field. */ +#define QSPI_WRITE_CNT_CNT_Msk (0x1FFFFFUL << QSPI_WRITE_CNT_CNT_Pos) /*!< Bit mask of CNT field. */ + +/* Register: QSPI_ERASE_PTR */ +/* Description: Start address of flash block to be erased */ + +/* Bits 31..0 : Word-aligned start address of block to be erased. */ +#define QSPI_ERASE_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define QSPI_ERASE_PTR_PTR_Msk (0xFFFFFFFFUL << QSPI_ERASE_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: QSPI_ERASE_LEN */ +/* Description: Size of block to be erased. */ + +/* Bits 1..0 : LEN */ +#define QSPI_ERASE_LEN_LEN_Pos (0UL) /*!< Position of LEN field. */ +#define QSPI_ERASE_LEN_LEN_Msk (0x3UL << QSPI_ERASE_LEN_LEN_Pos) /*!< Bit mask of LEN field. */ +#define QSPI_ERASE_LEN_LEN_4KB (0UL) /*!< Erase 4 kB block (flash command 0x20) */ +#define QSPI_ERASE_LEN_LEN_64KB (1UL) /*!< Erase 64 kB block (flash command 0xD8) */ +#define QSPI_ERASE_LEN_LEN_All (2UL) /*!< Erase all (flash command 0xC7) */ + +/* Register: QSPI_PSEL_SCK */ +/* Description: Pin select for serial clock SCK */ + +/* Bit 31 : Connection */ +#define QSPI_PSEL_SCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QSPI_PSEL_SCK_CONNECT_Msk (0x1UL << QSPI_PSEL_SCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QSPI_PSEL_SCK_CONNECT_Connected (0UL) /*!< Connect */ +#define QSPI_PSEL_SCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QSPI_PSEL_SCK_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QSPI_PSEL_SCK_PORT_Msk (0x3UL << QSPI_PSEL_SCK_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QSPI_PSEL_SCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QSPI_PSEL_SCK_PIN_Msk (0x1FUL << QSPI_PSEL_SCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QSPI_PSEL_CSN */ +/* Description: Pin select for chip select signal CSN. */ + +/* Bit 31 : Connection */ +#define QSPI_PSEL_CSN_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QSPI_PSEL_CSN_CONNECT_Msk (0x1UL << QSPI_PSEL_CSN_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QSPI_PSEL_CSN_CONNECT_Connected (0UL) /*!< Connect */ +#define QSPI_PSEL_CSN_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QSPI_PSEL_CSN_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QSPI_PSEL_CSN_PORT_Msk (0x3UL << QSPI_PSEL_CSN_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QSPI_PSEL_CSN_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QSPI_PSEL_CSN_PIN_Msk (0x1FUL << QSPI_PSEL_CSN_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QSPI_PSEL_IO0 */ +/* Description: Pin select for serial data MOSI/IO0. */ + +/* Bit 31 : Connection */ +#define QSPI_PSEL_IO0_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QSPI_PSEL_IO0_CONNECT_Msk (0x1UL << QSPI_PSEL_IO0_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QSPI_PSEL_IO0_CONNECT_Connected (0UL) /*!< Connect */ +#define QSPI_PSEL_IO0_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QSPI_PSEL_IO0_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QSPI_PSEL_IO0_PORT_Msk (0x3UL << QSPI_PSEL_IO0_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QSPI_PSEL_IO0_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QSPI_PSEL_IO0_PIN_Msk (0x1FUL << QSPI_PSEL_IO0_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QSPI_PSEL_IO1 */ +/* Description: Pin select for serial data MISO/IO1. */ + +/* Bit 31 : Connection */ +#define QSPI_PSEL_IO1_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QSPI_PSEL_IO1_CONNECT_Msk (0x1UL << QSPI_PSEL_IO1_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QSPI_PSEL_IO1_CONNECT_Connected (0UL) /*!< Connect */ +#define QSPI_PSEL_IO1_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QSPI_PSEL_IO1_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QSPI_PSEL_IO1_PORT_Msk (0x3UL << QSPI_PSEL_IO1_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QSPI_PSEL_IO1_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QSPI_PSEL_IO1_PIN_Msk (0x1FUL << QSPI_PSEL_IO1_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QSPI_PSEL_IO2 */ +/* Description: Pin select for serial data IO2. */ + +/* Bit 31 : Connection */ +#define QSPI_PSEL_IO2_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QSPI_PSEL_IO2_CONNECT_Msk (0x1UL << QSPI_PSEL_IO2_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QSPI_PSEL_IO2_CONNECT_Connected (0UL) /*!< Connect */ +#define QSPI_PSEL_IO2_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QSPI_PSEL_IO2_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QSPI_PSEL_IO2_PORT_Msk (0x3UL << QSPI_PSEL_IO2_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QSPI_PSEL_IO2_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QSPI_PSEL_IO2_PIN_Msk (0x1FUL << QSPI_PSEL_IO2_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QSPI_PSEL_IO3 */ +/* Description: Pin select for serial data IO3. */ + +/* Bit 31 : Connection */ +#define QSPI_PSEL_IO3_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define QSPI_PSEL_IO3_CONNECT_Msk (0x1UL << QSPI_PSEL_IO3_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define QSPI_PSEL_IO3_CONNECT_Connected (0UL) /*!< Connect */ +#define QSPI_PSEL_IO3_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define QSPI_PSEL_IO3_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define QSPI_PSEL_IO3_PORT_Msk (0x3UL << QSPI_PSEL_IO3_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define QSPI_PSEL_IO3_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define QSPI_PSEL_IO3_PIN_Msk (0x1FUL << QSPI_PSEL_IO3_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: QSPI_XIPOFFSET */ +/* Description: Address offset into the external memory for Execute in Place operation. */ + +/* Bits 31..0 : Address offset into the external memory for Execute in Place operation. Value must be a multiple of 4. */ +#define QSPI_XIPOFFSET_XIPOFFSET_Pos (0UL) /*!< Position of XIPOFFSET field. */ +#define QSPI_XIPOFFSET_XIPOFFSET_Msk (0xFFFFFFFFUL << QSPI_XIPOFFSET_XIPOFFSET_Pos) /*!< Bit mask of XIPOFFSET field. */ + +/* Register: QSPI_IFCONFIG0 */ +/* Description: Interface configuration. */ + +/* Bit 7 : Enable deep power-down mode (DPM) feature. */ +#define QSPI_IFCONFIG0_DPMENABLE_Pos (7UL) /*!< Position of DPMENABLE field. */ +#define QSPI_IFCONFIG0_DPMENABLE_Msk (0x1UL << QSPI_IFCONFIG0_DPMENABLE_Pos) /*!< Bit mask of DPMENABLE field. */ +#define QSPI_IFCONFIG0_DPMENABLE_Disable (0UL) /*!< Disable DPM feature. */ +#define QSPI_IFCONFIG0_DPMENABLE_Enable (1UL) /*!< Enable DPM feature. */ + +/* Bit 6 : Addressing mode. */ +#define QSPI_IFCONFIG0_ADDRMODE_Pos (6UL) /*!< Position of ADDRMODE field. */ +#define QSPI_IFCONFIG0_ADDRMODE_Msk (0x1UL << QSPI_IFCONFIG0_ADDRMODE_Pos) /*!< Bit mask of ADDRMODE field. */ +#define QSPI_IFCONFIG0_ADDRMODE_24BIT (0UL) /*!< 24-bit addressing. */ +#define QSPI_IFCONFIG0_ADDRMODE_32BIT (1UL) /*!< 32-bit addressing. */ + +/* Bits 5..3 : Configure number of data lines and opcode used for writing. */ +#define QSPI_IFCONFIG0_WRITEOC_Pos (3UL) /*!< Position of WRITEOC field. */ +#define QSPI_IFCONFIG0_WRITEOC_Msk (0x7UL << QSPI_IFCONFIG0_WRITEOC_Pos) /*!< Bit mask of WRITEOC field. */ +#define QSPI_IFCONFIG0_WRITEOC_PP (0UL) /*!< Single data line SPI. PP (opcode 0x02). */ +#define QSPI_IFCONFIG0_WRITEOC_PP2O (1UL) /*!< Dual data line SPI. PP2O (opcode 0xA2). */ +#define QSPI_IFCONFIG0_WRITEOC_PP4O (2UL) /*!< Quad data line SPI. PP4O (opcode 0x32). */ +#define QSPI_IFCONFIG0_WRITEOC_PP4IO (3UL) /*!< Quad data line SPI. PP4IO (opcode 0x38). */ + +/* Bits 2..0 : Configure number of data lines and opcode used for reading. */ +#define QSPI_IFCONFIG0_READOC_Pos (0UL) /*!< Position of READOC field. */ +#define QSPI_IFCONFIG0_READOC_Msk (0x7UL << QSPI_IFCONFIG0_READOC_Pos) /*!< Bit mask of READOC field. */ +#define QSPI_IFCONFIG0_READOC_FASTREAD (0UL) /*!< Single data line SPI. FAST_READ (opcode 0x0B). */ +#define QSPI_IFCONFIG0_READOC_READ2O (1UL) /*!< Dual data line SPI. READ2O (opcode 0x3B). */ +#define QSPI_IFCONFIG0_READOC_READ2IO (2UL) /*!< Dual data line SPI. READ2IO (opcode 0xBB). */ +#define QSPI_IFCONFIG0_READOC_READ4O (3UL) /*!< Quad data line SPI. READ4O (opcode 0x6B). */ +#define QSPI_IFCONFIG0_READOC_READ4IO (4UL) /*!< Quad data line SPI. READ4IO (opcode 0xEB). */ + +/* Register: QSPI_IFCONFIG1 */ +/* Description: Interface configuration. */ + +/* Bits 31..28 : SCK frequency is given as 32 MHz / (SCKFREQ + 1). */ +#define QSPI_IFCONFIG1_SCKFREQ_Pos (28UL) /*!< Position of SCKFREQ field. */ +#define QSPI_IFCONFIG1_SCKFREQ_Msk (0xFUL << QSPI_IFCONFIG1_SCKFREQ_Pos) /*!< Bit mask of SCKFREQ field. */ + +/* Bit 25 : Select SPI mode. */ +#define QSPI_IFCONFIG1_SPIMODE_Pos (25UL) /*!< Position of SPIMODE field. */ +#define QSPI_IFCONFIG1_SPIMODE_Msk (0x1UL << QSPI_IFCONFIG1_SPIMODE_Pos) /*!< Bit mask of SPIMODE field. */ +#define QSPI_IFCONFIG1_SPIMODE_MODE0 (0UL) /*!< Mode 0: Data are captured on the clock's rising edge and data is output on a falling edge. Base level of clock is 0 (CPOL=0, CPHA=0). */ +#define QSPI_IFCONFIG1_SPIMODE_MODE3 (1UL) /*!< Mode 3: Data are captured on the clock's falling edge and data is output on a rising edge. Base level of clock is 1 (CPOL=1, CPHA=1). */ + +/* Bit 24 : Enter/exit deep power-down mode (DPM) for external flash memory. */ +#define QSPI_IFCONFIG1_DPMEN_Pos (24UL) /*!< Position of DPMEN field. */ +#define QSPI_IFCONFIG1_DPMEN_Msk (0x1UL << QSPI_IFCONFIG1_DPMEN_Pos) /*!< Bit mask of DPMEN field. */ +#define QSPI_IFCONFIG1_DPMEN_Exit (0UL) /*!< Exit DPM. */ +#define QSPI_IFCONFIG1_DPMEN_Enter (1UL) /*!< Enter DPM. */ + +/* Bits 7..0 : Minimum amount of time that the CSN pin must stay high before it can go low again. Value is specified in number of 16 MHz periods (62.5 ns). */ +#define QSPI_IFCONFIG1_SCKDELAY_Pos (0UL) /*!< Position of SCKDELAY field. */ +#define QSPI_IFCONFIG1_SCKDELAY_Msk (0xFFUL << QSPI_IFCONFIG1_SCKDELAY_Pos) /*!< Bit mask of SCKDELAY field. */ + +/* Register: QSPI_STATUS */ +/* Description: Status register. */ + +/* Bits 31..24 : Value of external flash devices Status Register. When the external flash has two bytes status register this field includes the value of the low byte. */ +#define QSPI_STATUS_SREG_Pos (24UL) /*!< Position of SREG field. */ +#define QSPI_STATUS_SREG_Msk (0xFFUL << QSPI_STATUS_SREG_Pos) /*!< Bit mask of SREG field. */ + +/* Bit 3 : Ready status. */ +#define QSPI_STATUS_READY_Pos (3UL) /*!< Position of READY field. */ +#define QSPI_STATUS_READY_Msk (0x1UL << QSPI_STATUS_READY_Pos) /*!< Bit mask of READY field. */ +#define QSPI_STATUS_READY_BUSY (0UL) /*!< QSPI peripheral is busy. It is not allowed to trigger any new tasks, writing custom instructions or enter/exit DPM. */ +#define QSPI_STATUS_READY_READY (1UL) /*!< QSPI peripheral is ready. It is allowed to trigger new tasks, writing custom instructions or enter/exit DPM. */ + +/* Bit 2 : Deep power-down mode (DPM) status of external flash. */ +#define QSPI_STATUS_DPM_Pos (2UL) /*!< Position of DPM field. */ +#define QSPI_STATUS_DPM_Msk (0x1UL << QSPI_STATUS_DPM_Pos) /*!< Bit mask of DPM field. */ +#define QSPI_STATUS_DPM_Disabled (0UL) /*!< External flash is not in DPM. */ +#define QSPI_STATUS_DPM_Enabled (1UL) /*!< External flash is in DPM. */ + +/* Register: QSPI_DPMDUR */ +/* Description: Set the duration required to enter/exit deep power-down mode (DPM). */ + +/* Bits 31..16 : Duration needed by external flash to exit DPM. Duration is given as EXIT * 256 * 62.5 ns. */ +#define QSPI_DPMDUR_EXIT_Pos (16UL) /*!< Position of EXIT field. */ +#define QSPI_DPMDUR_EXIT_Msk (0xFFFFUL << QSPI_DPMDUR_EXIT_Pos) /*!< Bit mask of EXIT field. */ + +/* Bits 15..0 : Duration needed by external flash to enter DPM. Duration is given as ENTER * 256 * 62.5 ns. */ +#define QSPI_DPMDUR_ENTER_Pos (0UL) /*!< Position of ENTER field. */ +#define QSPI_DPMDUR_ENTER_Msk (0xFFFFUL << QSPI_DPMDUR_ENTER_Pos) /*!< Bit mask of ENTER field. */ + +/* Register: QSPI_ADDRCONF */ +/* Description: Extended address configuration. */ + +/* Bit 27 : Send WREN (write enable opcode 0x06) before instruction. */ +#define QSPI_ADDRCONF_WREN_Pos (27UL) /*!< Position of WREN field. */ +#define QSPI_ADDRCONF_WREN_Msk (0x1UL << QSPI_ADDRCONF_WREN_Pos) /*!< Bit mask of WREN field. */ +#define QSPI_ADDRCONF_WREN_Disable (0UL) /*!< Do not send WREN. */ +#define QSPI_ADDRCONF_WREN_Enable (1UL) /*!< Send WREN. */ + +/* Bit 26 : Wait for write complete before sending command. */ +#define QSPI_ADDRCONF_WIPWAIT_Pos (26UL) /*!< Position of WIPWAIT field. */ +#define QSPI_ADDRCONF_WIPWAIT_Msk (0x1UL << QSPI_ADDRCONF_WIPWAIT_Pos) /*!< Bit mask of WIPWAIT field. */ +#define QSPI_ADDRCONF_WIPWAIT_Disable (0UL) /*!< No wait. */ +#define QSPI_ADDRCONF_WIPWAIT_Enable (1UL) /*!< Wait. */ + +/* Bits 25..24 : Extended addressing mode. */ +#define QSPI_ADDRCONF_MODE_Pos (24UL) /*!< Position of MODE field. */ +#define QSPI_ADDRCONF_MODE_Msk (0x3UL << QSPI_ADDRCONF_MODE_Pos) /*!< Bit mask of MODE field. */ +#define QSPI_ADDRCONF_MODE_NoInstr (0UL) /*!< Do not send any instruction. */ +#define QSPI_ADDRCONF_MODE_Opcode (1UL) /*!< Send opcode. */ +#define QSPI_ADDRCONF_MODE_OpByte0 (2UL) /*!< Send opcode, byte0. */ +#define QSPI_ADDRCONF_MODE_All (3UL) /*!< Send opcode, byte0, byte1. */ + +/* Bits 23..16 : Byte 1 following byte 0. */ +#define QSPI_ADDRCONF_BYTE1_Pos (16UL) /*!< Position of BYTE1 field. */ +#define QSPI_ADDRCONF_BYTE1_Msk (0xFFUL << QSPI_ADDRCONF_BYTE1_Pos) /*!< Bit mask of BYTE1 field. */ + +/* Bits 15..8 : Byte 0 following opcode. */ +#define QSPI_ADDRCONF_BYTE0_Pos (8UL) /*!< Position of BYTE0 field. */ +#define QSPI_ADDRCONF_BYTE0_Msk (0xFFUL << QSPI_ADDRCONF_BYTE0_Pos) /*!< Bit mask of BYTE0 field. */ + +/* Bits 7..0 : Opcode that enters the 32-bit addressing mode. */ +#define QSPI_ADDRCONF_OPCODE_Pos (0UL) /*!< Position of OPCODE field. */ +#define QSPI_ADDRCONF_OPCODE_Msk (0xFFUL << QSPI_ADDRCONF_OPCODE_Pos) /*!< Bit mask of OPCODE field. */ + +/* Register: QSPI_CINSTRCONF */ +/* Description: Custom instruction configuration register. */ + +/* Bit 15 : Send WREN (write enable opcode 0x06) before instruction. */ +#define QSPI_CINSTRCONF_WREN_Pos (15UL) /*!< Position of WREN field. */ +#define QSPI_CINSTRCONF_WREN_Msk (0x1UL << QSPI_CINSTRCONF_WREN_Pos) /*!< Bit mask of WREN field. */ +#define QSPI_CINSTRCONF_WREN_Disable (0UL) /*!< Do not send WREN. */ +#define QSPI_CINSTRCONF_WREN_Enable (1UL) /*!< Send WREN. */ + +/* Bit 14 : Wait for write complete before sending command. */ +#define QSPI_CINSTRCONF_WIPWAIT_Pos (14UL) /*!< Position of WIPWAIT field. */ +#define QSPI_CINSTRCONF_WIPWAIT_Msk (0x1UL << QSPI_CINSTRCONF_WIPWAIT_Pos) /*!< Bit mask of WIPWAIT field. */ +#define QSPI_CINSTRCONF_WIPWAIT_Disable (0UL) /*!< No wait. */ +#define QSPI_CINSTRCONF_WIPWAIT_Enable (1UL) /*!< Wait. */ + +/* Bit 13 : Level of the IO3 pin (if connected) during transmission of custom instruction. */ +#define QSPI_CINSTRCONF_LIO3_Pos (13UL) /*!< Position of LIO3 field. */ +#define QSPI_CINSTRCONF_LIO3_Msk (0x1UL << QSPI_CINSTRCONF_LIO3_Pos) /*!< Bit mask of LIO3 field. */ + +/* Bit 12 : Level of the IO2 pin (if connected) during transmission of custom instruction. */ +#define QSPI_CINSTRCONF_LIO2_Pos (12UL) /*!< Position of LIO2 field. */ +#define QSPI_CINSTRCONF_LIO2_Msk (0x1UL << QSPI_CINSTRCONF_LIO2_Pos) /*!< Bit mask of LIO2 field. */ + +/* Bits 11..8 : Length of custom instruction in number of bytes. */ +#define QSPI_CINSTRCONF_LENGTH_Pos (8UL) /*!< Position of LENGTH field. */ +#define QSPI_CINSTRCONF_LENGTH_Msk (0xFUL << QSPI_CINSTRCONF_LENGTH_Pos) /*!< Bit mask of LENGTH field. */ +#define QSPI_CINSTRCONF_LENGTH_1B (1UL) /*!< Send opcode only. */ +#define QSPI_CINSTRCONF_LENGTH_2B (2UL) /*!< Send opcode, CINSTRDAT0.BYTE0. */ +#define QSPI_CINSTRCONF_LENGTH_3B (3UL) /*!< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE1. */ +#define QSPI_CINSTRCONF_LENGTH_4B (4UL) /*!< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE2. */ +#define QSPI_CINSTRCONF_LENGTH_5B (5UL) /*!< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE3. */ +#define QSPI_CINSTRCONF_LENGTH_6B (6UL) /*!< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE4. */ +#define QSPI_CINSTRCONF_LENGTH_7B (7UL) /*!< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE5. */ +#define QSPI_CINSTRCONF_LENGTH_8B (8UL) /*!< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE6. */ +#define QSPI_CINSTRCONF_LENGTH_9B (9UL) /*!< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE7. */ + +/* Bits 7..0 : Opcode of Custom instruction. */ +#define QSPI_CINSTRCONF_OPCODE_Pos (0UL) /*!< Position of OPCODE field. */ +#define QSPI_CINSTRCONF_OPCODE_Msk (0xFFUL << QSPI_CINSTRCONF_OPCODE_Pos) /*!< Bit mask of OPCODE field. */ + +/* Register: QSPI_CINSTRDAT0 */ +/* Description: Custom instruction data register 0. */ + +/* Bits 31..24 : Data byte 3 */ +#define QSPI_CINSTRDAT0_BYTE3_Pos (24UL) /*!< Position of BYTE3 field. */ +#define QSPI_CINSTRDAT0_BYTE3_Msk (0xFFUL << QSPI_CINSTRDAT0_BYTE3_Pos) /*!< Bit mask of BYTE3 field. */ + +/* Bits 23..16 : Data byte 2 */ +#define QSPI_CINSTRDAT0_BYTE2_Pos (16UL) /*!< Position of BYTE2 field. */ +#define QSPI_CINSTRDAT0_BYTE2_Msk (0xFFUL << QSPI_CINSTRDAT0_BYTE2_Pos) /*!< Bit mask of BYTE2 field. */ + +/* Bits 15..8 : Data byte 1 */ +#define QSPI_CINSTRDAT0_BYTE1_Pos (8UL) /*!< Position of BYTE1 field. */ +#define QSPI_CINSTRDAT0_BYTE1_Msk (0xFFUL << QSPI_CINSTRDAT0_BYTE1_Pos) /*!< Bit mask of BYTE1 field. */ + +/* Bits 7..0 : Data byte 0 */ +#define QSPI_CINSTRDAT0_BYTE0_Pos (0UL) /*!< Position of BYTE0 field. */ +#define QSPI_CINSTRDAT0_BYTE0_Msk (0xFFUL << QSPI_CINSTRDAT0_BYTE0_Pos) /*!< Bit mask of BYTE0 field. */ + +/* Register: QSPI_CINSTRDAT1 */ +/* Description: Custom instruction data register 1. */ + +/* Bits 31..24 : Data byte 7 */ +#define QSPI_CINSTRDAT1_BYTE7_Pos (24UL) /*!< Position of BYTE7 field. */ +#define QSPI_CINSTRDAT1_BYTE7_Msk (0xFFUL << QSPI_CINSTRDAT1_BYTE7_Pos) /*!< Bit mask of BYTE7 field. */ + +/* Bits 23..16 : Data byte 6 */ +#define QSPI_CINSTRDAT1_BYTE6_Pos (16UL) /*!< Position of BYTE6 field. */ +#define QSPI_CINSTRDAT1_BYTE6_Msk (0xFFUL << QSPI_CINSTRDAT1_BYTE6_Pos) /*!< Bit mask of BYTE6 field. */ + +/* Bits 15..8 : Data byte 5 */ +#define QSPI_CINSTRDAT1_BYTE5_Pos (8UL) /*!< Position of BYTE5 field. */ +#define QSPI_CINSTRDAT1_BYTE5_Msk (0xFFUL << QSPI_CINSTRDAT1_BYTE5_Pos) /*!< Bit mask of BYTE5 field. */ + +/* Bits 7..0 : Data byte 4 */ +#define QSPI_CINSTRDAT1_BYTE4_Pos (0UL) /*!< Position of BYTE4 field. */ +#define QSPI_CINSTRDAT1_BYTE4_Msk (0xFFUL << QSPI_CINSTRDAT1_BYTE4_Pos) /*!< Bit mask of BYTE4 field. */ + +/* Register: QSPI_IFTIMING */ +/* Description: SPI interface timing. */ + +/* Bits 10..8 : Timing related to sampling of the input serial data. The value of RXDELAY specifies the number of 64 MHz cycles (15.625 ns) delay from the the rising edge of the SPI Clock (SCK) until the input serial data is sampled. As en example, if set to 0 the input serial data is sampled on the rising edge of SCK. */ +#define QSPI_IFTIMING_RXDELAY_Pos (8UL) /*!< Position of RXDELAY field. */ +#define QSPI_IFTIMING_RXDELAY_Msk (0x7UL << QSPI_IFTIMING_RXDELAY_Pos) /*!< Bit mask of RXDELAY field. */ + + +/* Peripheral: RADIO */ +/* Description: 2.4 GHz Radio */ + +/* Register: RADIO_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 19 : Shortcut between RXREADY event and START task */ +#define RADIO_SHORTS_RXREADY_START_Pos (19UL) /*!< Position of RXREADY_START field. */ +#define RADIO_SHORTS_RXREADY_START_Msk (0x1UL << RADIO_SHORTS_RXREADY_START_Pos) /*!< Bit mask of RXREADY_START field. */ +#define RADIO_SHORTS_RXREADY_START_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_RXREADY_START_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 18 : Shortcut between TXREADY event and START task */ +#define RADIO_SHORTS_TXREADY_START_Pos (18UL) /*!< Position of TXREADY_START field. */ +#define RADIO_SHORTS_TXREADY_START_Msk (0x1UL << RADIO_SHORTS_TXREADY_START_Pos) /*!< Bit mask of TXREADY_START field. */ +#define RADIO_SHORTS_TXREADY_START_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_TXREADY_START_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 17 : Shortcut between CCAIDLE event and STOP task */ +#define RADIO_SHORTS_CCAIDLE_STOP_Pos (17UL) /*!< Position of CCAIDLE_STOP field. */ +#define RADIO_SHORTS_CCAIDLE_STOP_Msk (0x1UL << RADIO_SHORTS_CCAIDLE_STOP_Pos) /*!< Bit mask of CCAIDLE_STOP field. */ +#define RADIO_SHORTS_CCAIDLE_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_CCAIDLE_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 16 : Shortcut between EDEND event and DISABLE task */ +#define RADIO_SHORTS_EDEND_DISABLE_Pos (16UL) /*!< Position of EDEND_DISABLE field. */ +#define RADIO_SHORTS_EDEND_DISABLE_Msk (0x1UL << RADIO_SHORTS_EDEND_DISABLE_Pos) /*!< Bit mask of EDEND_DISABLE field. */ +#define RADIO_SHORTS_EDEND_DISABLE_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_EDEND_DISABLE_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 15 : Shortcut between READY event and EDSTART task */ +#define RADIO_SHORTS_READY_EDSTART_Pos (15UL) /*!< Position of READY_EDSTART field. */ +#define RADIO_SHORTS_READY_EDSTART_Msk (0x1UL << RADIO_SHORTS_READY_EDSTART_Pos) /*!< Bit mask of READY_EDSTART field. */ +#define RADIO_SHORTS_READY_EDSTART_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_READY_EDSTART_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 14 : Shortcut between FRAMESTART event and BCSTART task */ +#define RADIO_SHORTS_FRAMESTART_BCSTART_Pos (14UL) /*!< Position of FRAMESTART_BCSTART field. */ +#define RADIO_SHORTS_FRAMESTART_BCSTART_Msk (0x1UL << RADIO_SHORTS_FRAMESTART_BCSTART_Pos) /*!< Bit mask of FRAMESTART_BCSTART field. */ +#define RADIO_SHORTS_FRAMESTART_BCSTART_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_FRAMESTART_BCSTART_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 13 : Shortcut between CCABUSY event and DISABLE task */ +#define RADIO_SHORTS_CCABUSY_DISABLE_Pos (13UL) /*!< Position of CCABUSY_DISABLE field. */ +#define RADIO_SHORTS_CCABUSY_DISABLE_Msk (0x1UL << RADIO_SHORTS_CCABUSY_DISABLE_Pos) /*!< Bit mask of CCABUSY_DISABLE field. */ +#define RADIO_SHORTS_CCABUSY_DISABLE_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_CCABUSY_DISABLE_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 12 : Shortcut between CCAIDLE event and TXEN task */ +#define RADIO_SHORTS_CCAIDLE_TXEN_Pos (12UL) /*!< Position of CCAIDLE_TXEN field. */ +#define RADIO_SHORTS_CCAIDLE_TXEN_Msk (0x1UL << RADIO_SHORTS_CCAIDLE_TXEN_Pos) /*!< Bit mask of CCAIDLE_TXEN field. */ +#define RADIO_SHORTS_CCAIDLE_TXEN_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_CCAIDLE_TXEN_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 11 : Shortcut between RXREADY event and CCASTART task */ +#define RADIO_SHORTS_RXREADY_CCASTART_Pos (11UL) /*!< Position of RXREADY_CCASTART field. */ +#define RADIO_SHORTS_RXREADY_CCASTART_Msk (0x1UL << RADIO_SHORTS_RXREADY_CCASTART_Pos) /*!< Bit mask of RXREADY_CCASTART field. */ +#define RADIO_SHORTS_RXREADY_CCASTART_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_RXREADY_CCASTART_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 8 : Shortcut between DISABLED event and RSSISTOP task */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Pos (8UL) /*!< Position of DISABLED_RSSISTOP field. */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Msk (0x1UL << RADIO_SHORTS_DISABLED_RSSISTOP_Pos) /*!< Bit mask of DISABLED_RSSISTOP field. */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_DISABLED_RSSISTOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 6 : Shortcut between ADDRESS event and BCSTART task */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Pos (6UL) /*!< Position of ADDRESS_BCSTART field. */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Msk (0x1UL << RADIO_SHORTS_ADDRESS_BCSTART_Pos) /*!< Bit mask of ADDRESS_BCSTART field. */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_ADDRESS_BCSTART_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 5 : Shortcut between END event and START task */ +#define RADIO_SHORTS_END_START_Pos (5UL) /*!< Position of END_START field. */ +#define RADIO_SHORTS_END_START_Msk (0x1UL << RADIO_SHORTS_END_START_Pos) /*!< Bit mask of END_START field. */ +#define RADIO_SHORTS_END_START_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_END_START_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 4 : Shortcut between ADDRESS event and RSSISTART task */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Pos (4UL) /*!< Position of ADDRESS_RSSISTART field. */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Msk (0x1UL << RADIO_SHORTS_ADDRESS_RSSISTART_Pos) /*!< Bit mask of ADDRESS_RSSISTART field. */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_ADDRESS_RSSISTART_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between DISABLED event and RXEN task */ +#define RADIO_SHORTS_DISABLED_RXEN_Pos (3UL) /*!< Position of DISABLED_RXEN field. */ +#define RADIO_SHORTS_DISABLED_RXEN_Msk (0x1UL << RADIO_SHORTS_DISABLED_RXEN_Pos) /*!< Bit mask of DISABLED_RXEN field. */ +#define RADIO_SHORTS_DISABLED_RXEN_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_DISABLED_RXEN_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between DISABLED event and TXEN task */ +#define RADIO_SHORTS_DISABLED_TXEN_Pos (2UL) /*!< Position of DISABLED_TXEN field. */ +#define RADIO_SHORTS_DISABLED_TXEN_Msk (0x1UL << RADIO_SHORTS_DISABLED_TXEN_Pos) /*!< Bit mask of DISABLED_TXEN field. */ +#define RADIO_SHORTS_DISABLED_TXEN_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_DISABLED_TXEN_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between END event and DISABLE task */ +#define RADIO_SHORTS_END_DISABLE_Pos (1UL) /*!< Position of END_DISABLE field. */ +#define RADIO_SHORTS_END_DISABLE_Msk (0x1UL << RADIO_SHORTS_END_DISABLE_Pos) /*!< Bit mask of END_DISABLE field. */ +#define RADIO_SHORTS_END_DISABLE_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_END_DISABLE_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between READY event and START task */ +#define RADIO_SHORTS_READY_START_Pos (0UL) /*!< Position of READY_START field. */ +#define RADIO_SHORTS_READY_START_Msk (0x1UL << RADIO_SHORTS_READY_START_Pos) /*!< Bit mask of READY_START field. */ +#define RADIO_SHORTS_READY_START_Disabled (0UL) /*!< Disable shortcut */ +#define RADIO_SHORTS_READY_START_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: RADIO_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 23 : Write '1' to Enable interrupt for MHRMATCH event */ +#define RADIO_INTENSET_MHRMATCH_Pos (23UL) /*!< Position of MHRMATCH field. */ +#define RADIO_INTENSET_MHRMATCH_Msk (0x1UL << RADIO_INTENSET_MHRMATCH_Pos) /*!< Bit mask of MHRMATCH field. */ +#define RADIO_INTENSET_MHRMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_MHRMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_MHRMATCH_Set (1UL) /*!< Enable */ + +/* Bit 22 : Write '1' to Enable interrupt for RXREADY event */ +#define RADIO_INTENSET_RXREADY_Pos (22UL) /*!< Position of RXREADY field. */ +#define RADIO_INTENSET_RXREADY_Msk (0x1UL << RADIO_INTENSET_RXREADY_Pos) /*!< Bit mask of RXREADY field. */ +#define RADIO_INTENSET_RXREADY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_RXREADY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_RXREADY_Set (1UL) /*!< Enable */ + +/* Bit 21 : Write '1' to Enable interrupt for TXREADY event */ +#define RADIO_INTENSET_TXREADY_Pos (21UL) /*!< Position of TXREADY field. */ +#define RADIO_INTENSET_TXREADY_Msk (0x1UL << RADIO_INTENSET_TXREADY_Pos) /*!< Bit mask of TXREADY field. */ +#define RADIO_INTENSET_TXREADY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_TXREADY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_TXREADY_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for RATEBOOST event */ +#define RADIO_INTENSET_RATEBOOST_Pos (20UL) /*!< Position of RATEBOOST field. */ +#define RADIO_INTENSET_RATEBOOST_Msk (0x1UL << RADIO_INTENSET_RATEBOOST_Pos) /*!< Bit mask of RATEBOOST field. */ +#define RADIO_INTENSET_RATEBOOST_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_RATEBOOST_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_RATEBOOST_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for CCASTOPPED event */ +#define RADIO_INTENSET_CCASTOPPED_Pos (19UL) /*!< Position of CCASTOPPED field. */ +#define RADIO_INTENSET_CCASTOPPED_Msk (0x1UL << RADIO_INTENSET_CCASTOPPED_Pos) /*!< Bit mask of CCASTOPPED field. */ +#define RADIO_INTENSET_CCASTOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_CCASTOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_CCASTOPPED_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for CCABUSY event */ +#define RADIO_INTENSET_CCABUSY_Pos (18UL) /*!< Position of CCABUSY field. */ +#define RADIO_INTENSET_CCABUSY_Msk (0x1UL << RADIO_INTENSET_CCABUSY_Pos) /*!< Bit mask of CCABUSY field. */ +#define RADIO_INTENSET_CCABUSY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_CCABUSY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_CCABUSY_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for CCAIDLE event */ +#define RADIO_INTENSET_CCAIDLE_Pos (17UL) /*!< Position of CCAIDLE field. */ +#define RADIO_INTENSET_CCAIDLE_Msk (0x1UL << RADIO_INTENSET_CCAIDLE_Pos) /*!< Bit mask of CCAIDLE field. */ +#define RADIO_INTENSET_CCAIDLE_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_CCAIDLE_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_CCAIDLE_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable interrupt for EDSTOPPED event */ +#define RADIO_INTENSET_EDSTOPPED_Pos (16UL) /*!< Position of EDSTOPPED field. */ +#define RADIO_INTENSET_EDSTOPPED_Msk (0x1UL << RADIO_INTENSET_EDSTOPPED_Pos) /*!< Bit mask of EDSTOPPED field. */ +#define RADIO_INTENSET_EDSTOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_EDSTOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_EDSTOPPED_Set (1UL) /*!< Enable */ + +/* Bit 15 : Write '1' to Enable interrupt for EDEND event */ +#define RADIO_INTENSET_EDEND_Pos (15UL) /*!< Position of EDEND field. */ +#define RADIO_INTENSET_EDEND_Msk (0x1UL << RADIO_INTENSET_EDEND_Pos) /*!< Bit mask of EDEND field. */ +#define RADIO_INTENSET_EDEND_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_EDEND_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_EDEND_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for FRAMESTART event */ +#define RADIO_INTENSET_FRAMESTART_Pos (14UL) /*!< Position of FRAMESTART field. */ +#define RADIO_INTENSET_FRAMESTART_Msk (0x1UL << RADIO_INTENSET_FRAMESTART_Pos) /*!< Bit mask of FRAMESTART field. */ +#define RADIO_INTENSET_FRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_FRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_FRAMESTART_Set (1UL) /*!< Enable */ + +/* Bit 13 : Write '1' to Enable interrupt for CRCERROR event */ +#define RADIO_INTENSET_CRCERROR_Pos (13UL) /*!< Position of CRCERROR field. */ +#define RADIO_INTENSET_CRCERROR_Msk (0x1UL << RADIO_INTENSET_CRCERROR_Pos) /*!< Bit mask of CRCERROR field. */ +#define RADIO_INTENSET_CRCERROR_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_CRCERROR_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_CRCERROR_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for CRCOK event */ +#define RADIO_INTENSET_CRCOK_Pos (12UL) /*!< Position of CRCOK field. */ +#define RADIO_INTENSET_CRCOK_Msk (0x1UL << RADIO_INTENSET_CRCOK_Pos) /*!< Bit mask of CRCOK field. */ +#define RADIO_INTENSET_CRCOK_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_CRCOK_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_CRCOK_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for BCMATCH event */ +#define RADIO_INTENSET_BCMATCH_Pos (10UL) /*!< Position of BCMATCH field. */ +#define RADIO_INTENSET_BCMATCH_Msk (0x1UL << RADIO_INTENSET_BCMATCH_Pos) /*!< Bit mask of BCMATCH field. */ +#define RADIO_INTENSET_BCMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_BCMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_BCMATCH_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for RSSIEND event */ +#define RADIO_INTENSET_RSSIEND_Pos (7UL) /*!< Position of RSSIEND field. */ +#define RADIO_INTENSET_RSSIEND_Msk (0x1UL << RADIO_INTENSET_RSSIEND_Pos) /*!< Bit mask of RSSIEND field. */ +#define RADIO_INTENSET_RSSIEND_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_RSSIEND_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_RSSIEND_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for DEVMISS event */ +#define RADIO_INTENSET_DEVMISS_Pos (6UL) /*!< Position of DEVMISS field. */ +#define RADIO_INTENSET_DEVMISS_Msk (0x1UL << RADIO_INTENSET_DEVMISS_Pos) /*!< Bit mask of DEVMISS field. */ +#define RADIO_INTENSET_DEVMISS_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_DEVMISS_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_DEVMISS_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for DEVMATCH event */ +#define RADIO_INTENSET_DEVMATCH_Pos (5UL) /*!< Position of DEVMATCH field. */ +#define RADIO_INTENSET_DEVMATCH_Msk (0x1UL << RADIO_INTENSET_DEVMATCH_Pos) /*!< Bit mask of DEVMATCH field. */ +#define RADIO_INTENSET_DEVMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_DEVMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_DEVMATCH_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for DISABLED event */ +#define RADIO_INTENSET_DISABLED_Pos (4UL) /*!< Position of DISABLED field. */ +#define RADIO_INTENSET_DISABLED_Msk (0x1UL << RADIO_INTENSET_DISABLED_Pos) /*!< Bit mask of DISABLED field. */ +#define RADIO_INTENSET_DISABLED_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_DISABLED_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_DISABLED_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for END event */ +#define RADIO_INTENSET_END_Pos (3UL) /*!< Position of END field. */ +#define RADIO_INTENSET_END_Msk (0x1UL << RADIO_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define RADIO_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for PAYLOAD event */ +#define RADIO_INTENSET_PAYLOAD_Pos (2UL) /*!< Position of PAYLOAD field. */ +#define RADIO_INTENSET_PAYLOAD_Msk (0x1UL << RADIO_INTENSET_PAYLOAD_Pos) /*!< Bit mask of PAYLOAD field. */ +#define RADIO_INTENSET_PAYLOAD_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_PAYLOAD_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_PAYLOAD_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for ADDRESS event */ +#define RADIO_INTENSET_ADDRESS_Pos (1UL) /*!< Position of ADDRESS field. */ +#define RADIO_INTENSET_ADDRESS_Msk (0x1UL << RADIO_INTENSET_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ +#define RADIO_INTENSET_ADDRESS_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_ADDRESS_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_ADDRESS_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for READY event */ +#define RADIO_INTENSET_READY_Pos (0UL) /*!< Position of READY field. */ +#define RADIO_INTENSET_READY_Msk (0x1UL << RADIO_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define RADIO_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: RADIO_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 23 : Write '1' to Disable interrupt for MHRMATCH event */ +#define RADIO_INTENCLR_MHRMATCH_Pos (23UL) /*!< Position of MHRMATCH field. */ +#define RADIO_INTENCLR_MHRMATCH_Msk (0x1UL << RADIO_INTENCLR_MHRMATCH_Pos) /*!< Bit mask of MHRMATCH field. */ +#define RADIO_INTENCLR_MHRMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_MHRMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_MHRMATCH_Clear (1UL) /*!< Disable */ + +/* Bit 22 : Write '1' to Disable interrupt for RXREADY event */ +#define RADIO_INTENCLR_RXREADY_Pos (22UL) /*!< Position of RXREADY field. */ +#define RADIO_INTENCLR_RXREADY_Msk (0x1UL << RADIO_INTENCLR_RXREADY_Pos) /*!< Bit mask of RXREADY field. */ +#define RADIO_INTENCLR_RXREADY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_RXREADY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_RXREADY_Clear (1UL) /*!< Disable */ + +/* Bit 21 : Write '1' to Disable interrupt for TXREADY event */ +#define RADIO_INTENCLR_TXREADY_Pos (21UL) /*!< Position of TXREADY field. */ +#define RADIO_INTENCLR_TXREADY_Msk (0x1UL << RADIO_INTENCLR_TXREADY_Pos) /*!< Bit mask of TXREADY field. */ +#define RADIO_INTENCLR_TXREADY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_TXREADY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_TXREADY_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for RATEBOOST event */ +#define RADIO_INTENCLR_RATEBOOST_Pos (20UL) /*!< Position of RATEBOOST field. */ +#define RADIO_INTENCLR_RATEBOOST_Msk (0x1UL << RADIO_INTENCLR_RATEBOOST_Pos) /*!< Bit mask of RATEBOOST field. */ +#define RADIO_INTENCLR_RATEBOOST_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_RATEBOOST_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_RATEBOOST_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for CCASTOPPED event */ +#define RADIO_INTENCLR_CCASTOPPED_Pos (19UL) /*!< Position of CCASTOPPED field. */ +#define RADIO_INTENCLR_CCASTOPPED_Msk (0x1UL << RADIO_INTENCLR_CCASTOPPED_Pos) /*!< Bit mask of CCASTOPPED field. */ +#define RADIO_INTENCLR_CCASTOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_CCASTOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_CCASTOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for CCABUSY event */ +#define RADIO_INTENCLR_CCABUSY_Pos (18UL) /*!< Position of CCABUSY field. */ +#define RADIO_INTENCLR_CCABUSY_Msk (0x1UL << RADIO_INTENCLR_CCABUSY_Pos) /*!< Bit mask of CCABUSY field. */ +#define RADIO_INTENCLR_CCABUSY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_CCABUSY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_CCABUSY_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for CCAIDLE event */ +#define RADIO_INTENCLR_CCAIDLE_Pos (17UL) /*!< Position of CCAIDLE field. */ +#define RADIO_INTENCLR_CCAIDLE_Msk (0x1UL << RADIO_INTENCLR_CCAIDLE_Pos) /*!< Bit mask of CCAIDLE field. */ +#define RADIO_INTENCLR_CCAIDLE_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_CCAIDLE_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_CCAIDLE_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable interrupt for EDSTOPPED event */ +#define RADIO_INTENCLR_EDSTOPPED_Pos (16UL) /*!< Position of EDSTOPPED field. */ +#define RADIO_INTENCLR_EDSTOPPED_Msk (0x1UL << RADIO_INTENCLR_EDSTOPPED_Pos) /*!< Bit mask of EDSTOPPED field. */ +#define RADIO_INTENCLR_EDSTOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_EDSTOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_EDSTOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 15 : Write '1' to Disable interrupt for EDEND event */ +#define RADIO_INTENCLR_EDEND_Pos (15UL) /*!< Position of EDEND field. */ +#define RADIO_INTENCLR_EDEND_Msk (0x1UL << RADIO_INTENCLR_EDEND_Pos) /*!< Bit mask of EDEND field. */ +#define RADIO_INTENCLR_EDEND_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_EDEND_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_EDEND_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for FRAMESTART event */ +#define RADIO_INTENCLR_FRAMESTART_Pos (14UL) /*!< Position of FRAMESTART field. */ +#define RADIO_INTENCLR_FRAMESTART_Msk (0x1UL << RADIO_INTENCLR_FRAMESTART_Pos) /*!< Bit mask of FRAMESTART field. */ +#define RADIO_INTENCLR_FRAMESTART_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_FRAMESTART_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_FRAMESTART_Clear (1UL) /*!< Disable */ + +/* Bit 13 : Write '1' to Disable interrupt for CRCERROR event */ +#define RADIO_INTENCLR_CRCERROR_Pos (13UL) /*!< Position of CRCERROR field. */ +#define RADIO_INTENCLR_CRCERROR_Msk (0x1UL << RADIO_INTENCLR_CRCERROR_Pos) /*!< Bit mask of CRCERROR field. */ +#define RADIO_INTENCLR_CRCERROR_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_CRCERROR_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_CRCERROR_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for CRCOK event */ +#define RADIO_INTENCLR_CRCOK_Pos (12UL) /*!< Position of CRCOK field. */ +#define RADIO_INTENCLR_CRCOK_Msk (0x1UL << RADIO_INTENCLR_CRCOK_Pos) /*!< Bit mask of CRCOK field. */ +#define RADIO_INTENCLR_CRCOK_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_CRCOK_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_CRCOK_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for BCMATCH event */ +#define RADIO_INTENCLR_BCMATCH_Pos (10UL) /*!< Position of BCMATCH field. */ +#define RADIO_INTENCLR_BCMATCH_Msk (0x1UL << RADIO_INTENCLR_BCMATCH_Pos) /*!< Bit mask of BCMATCH field. */ +#define RADIO_INTENCLR_BCMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_BCMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_BCMATCH_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for RSSIEND event */ +#define RADIO_INTENCLR_RSSIEND_Pos (7UL) /*!< Position of RSSIEND field. */ +#define RADIO_INTENCLR_RSSIEND_Msk (0x1UL << RADIO_INTENCLR_RSSIEND_Pos) /*!< Bit mask of RSSIEND field. */ +#define RADIO_INTENCLR_RSSIEND_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_RSSIEND_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_RSSIEND_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for DEVMISS event */ +#define RADIO_INTENCLR_DEVMISS_Pos (6UL) /*!< Position of DEVMISS field. */ +#define RADIO_INTENCLR_DEVMISS_Msk (0x1UL << RADIO_INTENCLR_DEVMISS_Pos) /*!< Bit mask of DEVMISS field. */ +#define RADIO_INTENCLR_DEVMISS_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_DEVMISS_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_DEVMISS_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for DEVMATCH event */ +#define RADIO_INTENCLR_DEVMATCH_Pos (5UL) /*!< Position of DEVMATCH field. */ +#define RADIO_INTENCLR_DEVMATCH_Msk (0x1UL << RADIO_INTENCLR_DEVMATCH_Pos) /*!< Bit mask of DEVMATCH field. */ +#define RADIO_INTENCLR_DEVMATCH_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_DEVMATCH_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_DEVMATCH_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for DISABLED event */ +#define RADIO_INTENCLR_DISABLED_Pos (4UL) /*!< Position of DISABLED field. */ +#define RADIO_INTENCLR_DISABLED_Msk (0x1UL << RADIO_INTENCLR_DISABLED_Pos) /*!< Bit mask of DISABLED field. */ +#define RADIO_INTENCLR_DISABLED_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_DISABLED_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_DISABLED_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for END event */ +#define RADIO_INTENCLR_END_Pos (3UL) /*!< Position of END field. */ +#define RADIO_INTENCLR_END_Msk (0x1UL << RADIO_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define RADIO_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for PAYLOAD event */ +#define RADIO_INTENCLR_PAYLOAD_Pos (2UL) /*!< Position of PAYLOAD field. */ +#define RADIO_INTENCLR_PAYLOAD_Msk (0x1UL << RADIO_INTENCLR_PAYLOAD_Pos) /*!< Bit mask of PAYLOAD field. */ +#define RADIO_INTENCLR_PAYLOAD_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_PAYLOAD_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_PAYLOAD_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for ADDRESS event */ +#define RADIO_INTENCLR_ADDRESS_Pos (1UL) /*!< Position of ADDRESS field. */ +#define RADIO_INTENCLR_ADDRESS_Msk (0x1UL << RADIO_INTENCLR_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ +#define RADIO_INTENCLR_ADDRESS_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_ADDRESS_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_ADDRESS_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for READY event */ +#define RADIO_INTENCLR_READY_Pos (0UL) /*!< Position of READY field. */ +#define RADIO_INTENCLR_READY_Msk (0x1UL << RADIO_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define RADIO_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define RADIO_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define RADIO_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: RADIO_CRCSTATUS */ +/* Description: CRC status */ + +/* Bit 0 : CRC status of packet received */ +#define RADIO_CRCSTATUS_CRCSTATUS_Pos (0UL) /*!< Position of CRCSTATUS field. */ +#define RADIO_CRCSTATUS_CRCSTATUS_Msk (0x1UL << RADIO_CRCSTATUS_CRCSTATUS_Pos) /*!< Bit mask of CRCSTATUS field. */ +#define RADIO_CRCSTATUS_CRCSTATUS_CRCError (0UL) /*!< Packet received with CRC error */ +#define RADIO_CRCSTATUS_CRCSTATUS_CRCOk (1UL) /*!< Packet received with CRC ok */ + +/* Register: RADIO_RXMATCH */ +/* Description: Received address */ + +/* Bits 2..0 : Received address */ +#define RADIO_RXMATCH_RXMATCH_Pos (0UL) /*!< Position of RXMATCH field. */ +#define RADIO_RXMATCH_RXMATCH_Msk (0x7UL << RADIO_RXMATCH_RXMATCH_Pos) /*!< Bit mask of RXMATCH field. */ + +/* Register: RADIO_RXCRC */ +/* Description: CRC field of previously received packet */ + +/* Bits 23..0 : CRC field of previously received packet */ +#define RADIO_RXCRC_RXCRC_Pos (0UL) /*!< Position of RXCRC field. */ +#define RADIO_RXCRC_RXCRC_Msk (0xFFFFFFUL << RADIO_RXCRC_RXCRC_Pos) /*!< Bit mask of RXCRC field. */ + +/* Register: RADIO_DAI */ +/* Description: Device address match index */ + +/* Bits 2..0 : Device address match index */ +#define RADIO_DAI_DAI_Pos (0UL) /*!< Position of DAI field. */ +#define RADIO_DAI_DAI_Msk (0x7UL << RADIO_DAI_DAI_Pos) /*!< Bit mask of DAI field. */ + +/* Register: RADIO_PACKETPTR */ +/* Description: Packet pointer */ + +/* Bits 31..0 : Packet pointer */ +#define RADIO_PACKETPTR_PACKETPTR_Pos (0UL) /*!< Position of PACKETPTR field. */ +#define RADIO_PACKETPTR_PACKETPTR_Msk (0xFFFFFFFFUL << RADIO_PACKETPTR_PACKETPTR_Pos) /*!< Bit mask of PACKETPTR field. */ + +/* Register: RADIO_FREQUENCY */ +/* Description: Frequency */ + +/* Bit 8 : Channel map selection. */ +#define RADIO_FREQUENCY_MAP_Pos (8UL) /*!< Position of MAP field. */ +#define RADIO_FREQUENCY_MAP_Msk (0x1UL << RADIO_FREQUENCY_MAP_Pos) /*!< Bit mask of MAP field. */ +#define RADIO_FREQUENCY_MAP_Default (0UL) /*!< Channel map between 2400 MHZ .. 2500 MHz */ +#define RADIO_FREQUENCY_MAP_Low (1UL) /*!< Channel map between 2360 MHZ .. 2460 MHz */ + +/* Bits 6..0 : Radio channel frequency */ +#define RADIO_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define RADIO_FREQUENCY_FREQUENCY_Msk (0x7FUL << RADIO_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ + +/* Register: RADIO_TXPOWER */ +/* Description: Output power */ + +/* Bits 7..0 : RADIO output power. */ +#define RADIO_TXPOWER_TXPOWER_Pos (0UL) /*!< Position of TXPOWER field. */ +#define RADIO_TXPOWER_TXPOWER_Msk (0xFFUL << RADIO_TXPOWER_TXPOWER_Pos) /*!< Bit mask of TXPOWER field. */ +#define RADIO_TXPOWER_TXPOWER_0dBm (0x0UL) /*!< 0 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos2dBm (0x2UL) /*!< +2 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos3dBm (0x3UL) /*!< +3 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos4dBm (0x4UL) /*!< +4 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos5dBm (0x5UL) /*!< +5 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos6dBm (0x6UL) /*!< +6 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos7dBm (0x7UL) /*!< +7 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos8dBm (0x8UL) /*!< +8 dBm */ +#define RADIO_TXPOWER_TXPOWER_Pos9dBm (0x9UL) /*!< +9 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg30dBm (0xD8UL) /*!< Deprecated enumerator - -40 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg40dBm (0xD8UL) /*!< -40 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg20dBm (0xECUL) /*!< -20 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg16dBm (0xF0UL) /*!< -16 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg12dBm (0xF4UL) /*!< -12 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg8dBm (0xF8UL) /*!< -8 dBm */ +#define RADIO_TXPOWER_TXPOWER_Neg4dBm (0xFCUL) /*!< -4 dBm */ + +/* Register: RADIO_MODE */ +/* Description: Data rate and modulation */ + +/* Bits 3..0 : Radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation. */ +#define RADIO_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define RADIO_MODE_MODE_Msk (0xFUL << RADIO_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define RADIO_MODE_MODE_Nrf_1Mbit (0UL) /*!< 1 Mbit/s Nordic proprietary radio mode */ +#define RADIO_MODE_MODE_Nrf_2Mbit (1UL) /*!< 2 Mbit/s Nordic proprietary radio mode */ +#define RADIO_MODE_MODE_Nrf_250Kbit (2UL) /*!< Deprecated enumerator - 250 kbit/s Nordic proprietary radio mode */ +#define RADIO_MODE_MODE_Ble_1Mbit (3UL) /*!< 1 Mbit/s Bluetooth Low Energy */ +#define RADIO_MODE_MODE_Ble_2Mbit (4UL) /*!< 2 Mbit/s Bluetooth Low Energy */ +#define RADIO_MODE_MODE_Ble_LR125Kbit (5UL) /*!< Long range 125 kbit/s (TX Only - RX supports both) */ +#define RADIO_MODE_MODE_Ble_LR500Kbit (6UL) /*!< Long range 500 kbit/s (TX Only - RX supports both) */ +#define RADIO_MODE_MODE_Ieee802154_250Kbit (15UL) /*!< IEEE 802.15.4-2006 250 kbit/s */ + +/* Register: RADIO_PCNF0 */ +/* Description: Packet configuration register 0 */ + +/* Bits 30..29 : Length of TERM field in Long Range operation */ +#define RADIO_PCNF0_TERMLEN_Pos (29UL) /*!< Position of TERMLEN field. */ +#define RADIO_PCNF0_TERMLEN_Msk (0x3UL << RADIO_PCNF0_TERMLEN_Pos) /*!< Bit mask of TERMLEN field. */ + +/* Bit 26 : Indicates if LENGTH field contains CRC or not */ +#define RADIO_PCNF0_CRCINC_Pos (26UL) /*!< Position of CRCINC field. */ +#define RADIO_PCNF0_CRCINC_Msk (0x1UL << RADIO_PCNF0_CRCINC_Pos) /*!< Bit mask of CRCINC field. */ +#define RADIO_PCNF0_CRCINC_Exclude (0UL) /*!< LENGTH does not contain CRC */ +#define RADIO_PCNF0_CRCINC_Include (1UL) /*!< LENGTH includes CRC */ + +/* Bits 25..24 : Length of preamble on air. Decision point: TASKS_START task */ +#define RADIO_PCNF0_PLEN_Pos (24UL) /*!< Position of PLEN field. */ +#define RADIO_PCNF0_PLEN_Msk (0x3UL << RADIO_PCNF0_PLEN_Pos) /*!< Bit mask of PLEN field. */ +#define RADIO_PCNF0_PLEN_8bit (0UL) /*!< 8-bit preamble */ +#define RADIO_PCNF0_PLEN_16bit (1UL) /*!< 16-bit preamble */ +#define RADIO_PCNF0_PLEN_32bitZero (2UL) /*!< 32-bit zero preamble - used for IEEE 802.15.4 */ +#define RADIO_PCNF0_PLEN_LongRange (3UL) /*!< Preamble - used for BTLE Long Range */ + +/* Bits 23..22 : Length of Code Indicator - Long Range */ +#define RADIO_PCNF0_CILEN_Pos (22UL) /*!< Position of CILEN field. */ +#define RADIO_PCNF0_CILEN_Msk (0x3UL << RADIO_PCNF0_CILEN_Pos) /*!< Bit mask of CILEN field. */ + +/* Bit 20 : Include or exclude S1 field in RAM */ +#define RADIO_PCNF0_S1INCL_Pos (20UL) /*!< Position of S1INCL field. */ +#define RADIO_PCNF0_S1INCL_Msk (0x1UL << RADIO_PCNF0_S1INCL_Pos) /*!< Bit mask of S1INCL field. */ +#define RADIO_PCNF0_S1INCL_Automatic (0UL) /*!< Include S1 field in RAM only if S1LEN > 0 */ +#define RADIO_PCNF0_S1INCL_Include (1UL) /*!< Always include S1 field in RAM independent of S1LEN */ + +/* Bits 19..16 : Length on air of S1 field in number of bits. */ +#define RADIO_PCNF0_S1LEN_Pos (16UL) /*!< Position of S1LEN field. */ +#define RADIO_PCNF0_S1LEN_Msk (0xFUL << RADIO_PCNF0_S1LEN_Pos) /*!< Bit mask of S1LEN field. */ + +/* Bit 8 : Length on air of S0 field in number of bytes. */ +#define RADIO_PCNF0_S0LEN_Pos (8UL) /*!< Position of S0LEN field. */ +#define RADIO_PCNF0_S0LEN_Msk (0x1UL << RADIO_PCNF0_S0LEN_Pos) /*!< Bit mask of S0LEN field. */ + +/* Bits 3..0 : Length on air of LENGTH field in number of bits. */ +#define RADIO_PCNF0_LFLEN_Pos (0UL) /*!< Position of LFLEN field. */ +#define RADIO_PCNF0_LFLEN_Msk (0xFUL << RADIO_PCNF0_LFLEN_Pos) /*!< Bit mask of LFLEN field. */ + +/* Register: RADIO_PCNF1 */ +/* Description: Packet configuration register 1 */ + +/* Bit 25 : Enable or disable packet whitening */ +#define RADIO_PCNF1_WHITEEN_Pos (25UL) /*!< Position of WHITEEN field. */ +#define RADIO_PCNF1_WHITEEN_Msk (0x1UL << RADIO_PCNF1_WHITEEN_Pos) /*!< Bit mask of WHITEEN field. */ +#define RADIO_PCNF1_WHITEEN_Disabled (0UL) /*!< Disable */ +#define RADIO_PCNF1_WHITEEN_Enabled (1UL) /*!< Enable */ + +/* Bit 24 : On air endianness of packet, this applies to the S0, LENGTH, S1 and the PAYLOAD fields. */ +#define RADIO_PCNF1_ENDIAN_Pos (24UL) /*!< Position of ENDIAN field. */ +#define RADIO_PCNF1_ENDIAN_Msk (0x1UL << RADIO_PCNF1_ENDIAN_Pos) /*!< Bit mask of ENDIAN field. */ +#define RADIO_PCNF1_ENDIAN_Little (0UL) /*!< Least Significant bit on air first */ +#define RADIO_PCNF1_ENDIAN_Big (1UL) /*!< Most significant bit on air first */ + +/* Bits 18..16 : Base address length in number of bytes */ +#define RADIO_PCNF1_BALEN_Pos (16UL) /*!< Position of BALEN field. */ +#define RADIO_PCNF1_BALEN_Msk (0x7UL << RADIO_PCNF1_BALEN_Pos) /*!< Bit mask of BALEN field. */ + +/* Bits 15..8 : Static length in number of bytes */ +#define RADIO_PCNF1_STATLEN_Pos (8UL) /*!< Position of STATLEN field. */ +#define RADIO_PCNF1_STATLEN_Msk (0xFFUL << RADIO_PCNF1_STATLEN_Pos) /*!< Bit mask of STATLEN field. */ + +/* Bits 7..0 : Maximum length of packet payload. If the packet payload is larger than MAXLEN, the radio will truncate the payload to MAXLEN. */ +#define RADIO_PCNF1_MAXLEN_Pos (0UL) /*!< Position of MAXLEN field. */ +#define RADIO_PCNF1_MAXLEN_Msk (0xFFUL << RADIO_PCNF1_MAXLEN_Pos) /*!< Bit mask of MAXLEN field. */ + +/* Register: RADIO_BASE0 */ +/* Description: Base address 0 */ + +/* Bits 31..0 : Base address 0 */ +#define RADIO_BASE0_BASE0_Pos (0UL) /*!< Position of BASE0 field. */ +#define RADIO_BASE0_BASE0_Msk (0xFFFFFFFFUL << RADIO_BASE0_BASE0_Pos) /*!< Bit mask of BASE0 field. */ + +/* Register: RADIO_BASE1 */ +/* Description: Base address 1 */ + +/* Bits 31..0 : Base address 1 */ +#define RADIO_BASE1_BASE1_Pos (0UL) /*!< Position of BASE1 field. */ +#define RADIO_BASE1_BASE1_Msk (0xFFFFFFFFUL << RADIO_BASE1_BASE1_Pos) /*!< Bit mask of BASE1 field. */ + +/* Register: RADIO_PREFIX0 */ +/* Description: Prefixes bytes for logical addresses 0-3 */ + +/* Bits 31..24 : Address prefix 3. */ +#define RADIO_PREFIX0_AP3_Pos (24UL) /*!< Position of AP3 field. */ +#define RADIO_PREFIX0_AP3_Msk (0xFFUL << RADIO_PREFIX0_AP3_Pos) /*!< Bit mask of AP3 field. */ + +/* Bits 23..16 : Address prefix 2. */ +#define RADIO_PREFIX0_AP2_Pos (16UL) /*!< Position of AP2 field. */ +#define RADIO_PREFIX0_AP2_Msk (0xFFUL << RADIO_PREFIX0_AP2_Pos) /*!< Bit mask of AP2 field. */ + +/* Bits 15..8 : Address prefix 1. */ +#define RADIO_PREFIX0_AP1_Pos (8UL) /*!< Position of AP1 field. */ +#define RADIO_PREFIX0_AP1_Msk (0xFFUL << RADIO_PREFIX0_AP1_Pos) /*!< Bit mask of AP1 field. */ + +/* Bits 7..0 : Address prefix 0. */ +#define RADIO_PREFIX0_AP0_Pos (0UL) /*!< Position of AP0 field. */ +#define RADIO_PREFIX0_AP0_Msk (0xFFUL << RADIO_PREFIX0_AP0_Pos) /*!< Bit mask of AP0 field. */ + +/* Register: RADIO_PREFIX1 */ +/* Description: Prefixes bytes for logical addresses 4-7 */ + +/* Bits 31..24 : Address prefix 7. */ +#define RADIO_PREFIX1_AP7_Pos (24UL) /*!< Position of AP7 field. */ +#define RADIO_PREFIX1_AP7_Msk (0xFFUL << RADIO_PREFIX1_AP7_Pos) /*!< Bit mask of AP7 field. */ + +/* Bits 23..16 : Address prefix 6. */ +#define RADIO_PREFIX1_AP6_Pos (16UL) /*!< Position of AP6 field. */ +#define RADIO_PREFIX1_AP6_Msk (0xFFUL << RADIO_PREFIX1_AP6_Pos) /*!< Bit mask of AP6 field. */ + +/* Bits 15..8 : Address prefix 5. */ +#define RADIO_PREFIX1_AP5_Pos (8UL) /*!< Position of AP5 field. */ +#define RADIO_PREFIX1_AP5_Msk (0xFFUL << RADIO_PREFIX1_AP5_Pos) /*!< Bit mask of AP5 field. */ + +/* Bits 7..0 : Address prefix 4. */ +#define RADIO_PREFIX1_AP4_Pos (0UL) /*!< Position of AP4 field. */ +#define RADIO_PREFIX1_AP4_Msk (0xFFUL << RADIO_PREFIX1_AP4_Pos) /*!< Bit mask of AP4 field. */ + +/* Register: RADIO_TXADDRESS */ +/* Description: Transmit address select */ + +/* Bits 2..0 : Transmit address select */ +#define RADIO_TXADDRESS_TXADDRESS_Pos (0UL) /*!< Position of TXADDRESS field. */ +#define RADIO_TXADDRESS_TXADDRESS_Msk (0x7UL << RADIO_TXADDRESS_TXADDRESS_Pos) /*!< Bit mask of TXADDRESS field. */ + +/* Register: RADIO_RXADDRESSES */ +/* Description: Receive address select */ + +/* Bit 7 : Enable or disable reception on logical address 7. */ +#define RADIO_RXADDRESSES_ADDR7_Pos (7UL) /*!< Position of ADDR7 field. */ +#define RADIO_RXADDRESSES_ADDR7_Msk (0x1UL << RADIO_RXADDRESSES_ADDR7_Pos) /*!< Bit mask of ADDR7 field. */ +#define RADIO_RXADDRESSES_ADDR7_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR7_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable reception on logical address 6. */ +#define RADIO_RXADDRESSES_ADDR6_Pos (6UL) /*!< Position of ADDR6 field. */ +#define RADIO_RXADDRESSES_ADDR6_Msk (0x1UL << RADIO_RXADDRESSES_ADDR6_Pos) /*!< Bit mask of ADDR6 field. */ +#define RADIO_RXADDRESSES_ADDR6_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR6_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable reception on logical address 5. */ +#define RADIO_RXADDRESSES_ADDR5_Pos (5UL) /*!< Position of ADDR5 field. */ +#define RADIO_RXADDRESSES_ADDR5_Msk (0x1UL << RADIO_RXADDRESSES_ADDR5_Pos) /*!< Bit mask of ADDR5 field. */ +#define RADIO_RXADDRESSES_ADDR5_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR5_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable reception on logical address 4. */ +#define RADIO_RXADDRESSES_ADDR4_Pos (4UL) /*!< Position of ADDR4 field. */ +#define RADIO_RXADDRESSES_ADDR4_Msk (0x1UL << RADIO_RXADDRESSES_ADDR4_Pos) /*!< Bit mask of ADDR4 field. */ +#define RADIO_RXADDRESSES_ADDR4_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR4_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable reception on logical address 3. */ +#define RADIO_RXADDRESSES_ADDR3_Pos (3UL) /*!< Position of ADDR3 field. */ +#define RADIO_RXADDRESSES_ADDR3_Msk (0x1UL << RADIO_RXADDRESSES_ADDR3_Pos) /*!< Bit mask of ADDR3 field. */ +#define RADIO_RXADDRESSES_ADDR3_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR3_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable reception on logical address 2. */ +#define RADIO_RXADDRESSES_ADDR2_Pos (2UL) /*!< Position of ADDR2 field. */ +#define RADIO_RXADDRESSES_ADDR2_Msk (0x1UL << RADIO_RXADDRESSES_ADDR2_Pos) /*!< Bit mask of ADDR2 field. */ +#define RADIO_RXADDRESSES_ADDR2_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR2_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable reception on logical address 1. */ +#define RADIO_RXADDRESSES_ADDR1_Pos (1UL) /*!< Position of ADDR1 field. */ +#define RADIO_RXADDRESSES_ADDR1_Msk (0x1UL << RADIO_RXADDRESSES_ADDR1_Pos) /*!< Bit mask of ADDR1 field. */ +#define RADIO_RXADDRESSES_ADDR1_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR1_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable reception on logical address 0. */ +#define RADIO_RXADDRESSES_ADDR0_Pos (0UL) /*!< Position of ADDR0 field. */ +#define RADIO_RXADDRESSES_ADDR0_Msk (0x1UL << RADIO_RXADDRESSES_ADDR0_Pos) /*!< Bit mask of ADDR0 field. */ +#define RADIO_RXADDRESSES_ADDR0_Disabled (0UL) /*!< Disable */ +#define RADIO_RXADDRESSES_ADDR0_Enabled (1UL) /*!< Enable */ + +/* Register: RADIO_CRCCNF */ +/* Description: CRC configuration */ + +/* Bits 9..8 : Include or exclude packet address field out of CRC calculation. */ +#define RADIO_CRCCNF_SKIPADDR_Pos (8UL) /*!< Position of SKIPADDR field. */ +#define RADIO_CRCCNF_SKIPADDR_Msk (0x3UL << RADIO_CRCCNF_SKIPADDR_Pos) /*!< Bit mask of SKIPADDR field. */ +#define RADIO_CRCCNF_SKIPADDR_Include (0UL) /*!< CRC calculation includes address field */ +#define RADIO_CRCCNF_SKIPADDR_Skip (1UL) /*!< CRC calculation does not include address field. The CRC calculation will start at the first byte after the address. */ +#define RADIO_CRCCNF_SKIPADDR_Ieee802154 (2UL) /*!< CRC calculation as per 802.15.4 standard. Starting at first byte after length field. */ + +/* Bits 1..0 : CRC length in number of bytes. */ +#define RADIO_CRCCNF_LEN_Pos (0UL) /*!< Position of LEN field. */ +#define RADIO_CRCCNF_LEN_Msk (0x3UL << RADIO_CRCCNF_LEN_Pos) /*!< Bit mask of LEN field. */ +#define RADIO_CRCCNF_LEN_Disabled (0UL) /*!< CRC length is zero and CRC calculation is disabled */ +#define RADIO_CRCCNF_LEN_One (1UL) /*!< CRC length is one byte and CRC calculation is enabled */ +#define RADIO_CRCCNF_LEN_Two (2UL) /*!< CRC length is two bytes and CRC calculation is enabled */ +#define RADIO_CRCCNF_LEN_Three (3UL) /*!< CRC length is three bytes and CRC calculation is enabled */ + +/* Register: RADIO_CRCPOLY */ +/* Description: CRC polynomial */ + +/* Bits 23..0 : CRC polynomial */ +#define RADIO_CRCPOLY_CRCPOLY_Pos (0UL) /*!< Position of CRCPOLY field. */ +#define RADIO_CRCPOLY_CRCPOLY_Msk (0xFFFFFFUL << RADIO_CRCPOLY_CRCPOLY_Pos) /*!< Bit mask of CRCPOLY field. */ + +/* Register: RADIO_CRCINIT */ +/* Description: CRC initial value */ + +/* Bits 23..0 : CRC initial value */ +#define RADIO_CRCINIT_CRCINIT_Pos (0UL) /*!< Position of CRCINIT field. */ +#define RADIO_CRCINIT_CRCINIT_Msk (0xFFFFFFUL << RADIO_CRCINIT_CRCINIT_Pos) /*!< Bit mask of CRCINIT field. */ + +/* Register: RADIO_TIFS */ +/* Description: Inter Frame Spacing in us */ + +/* Bits 9..0 : Inter Frame Spacing in us */ +#define RADIO_TIFS_TIFS_Pos (0UL) /*!< Position of TIFS field. */ +#define RADIO_TIFS_TIFS_Msk (0x3FFUL << RADIO_TIFS_TIFS_Pos) /*!< Bit mask of TIFS field. */ + +/* Register: RADIO_RSSISAMPLE */ +/* Description: RSSI sample */ + +/* Bits 6..0 : RSSI sample */ +#define RADIO_RSSISAMPLE_RSSISAMPLE_Pos (0UL) /*!< Position of RSSISAMPLE field. */ +#define RADIO_RSSISAMPLE_RSSISAMPLE_Msk (0x7FUL << RADIO_RSSISAMPLE_RSSISAMPLE_Pos) /*!< Bit mask of RSSISAMPLE field. */ + +/* Register: RADIO_STATE */ +/* Description: Current radio state */ + +/* Bits 3..0 : Current radio state */ +#define RADIO_STATE_STATE_Pos (0UL) /*!< Position of STATE field. */ +#define RADIO_STATE_STATE_Msk (0xFUL << RADIO_STATE_STATE_Pos) /*!< Bit mask of STATE field. */ +#define RADIO_STATE_STATE_Disabled (0UL) /*!< RADIO is in the Disabled state */ +#define RADIO_STATE_STATE_RxRu (1UL) /*!< RADIO is in the RXRU state */ +#define RADIO_STATE_STATE_RxIdle (2UL) /*!< RADIO is in the RXIDLE state */ +#define RADIO_STATE_STATE_Rx (3UL) /*!< RADIO is in the RX state */ +#define RADIO_STATE_STATE_RxDisable (4UL) /*!< RADIO is in the RXDISABLED state */ +#define RADIO_STATE_STATE_TxRu (9UL) /*!< RADIO is in the TXRU state */ +#define RADIO_STATE_STATE_TxIdle (10UL) /*!< RADIO is in the TXIDLE state */ +#define RADIO_STATE_STATE_Tx (11UL) /*!< RADIO is in the TX state */ +#define RADIO_STATE_STATE_TxDisable (12UL) /*!< RADIO is in the TXDISABLED state */ + +/* Register: RADIO_DATAWHITEIV */ +/* Description: Data whitening initial value */ + +/* Bits 6..0 : Data whitening initial value. Bit 6 is hard-wired to '1', writing '0' to it has no effect, and it will always be read back and used by the device as '1'. */ +#define RADIO_DATAWHITEIV_DATAWHITEIV_Pos (0UL) /*!< Position of DATAWHITEIV field. */ +#define RADIO_DATAWHITEIV_DATAWHITEIV_Msk (0x7FUL << RADIO_DATAWHITEIV_DATAWHITEIV_Pos) /*!< Bit mask of DATAWHITEIV field. */ + +/* Register: RADIO_BCC */ +/* Description: Bit counter compare */ + +/* Bits 31..0 : Bit counter compare */ +#define RADIO_BCC_BCC_Pos (0UL) /*!< Position of BCC field. */ +#define RADIO_BCC_BCC_Msk (0xFFFFFFFFUL << RADIO_BCC_BCC_Pos) /*!< Bit mask of BCC field. */ + +/* Register: RADIO_DAB */ +/* Description: Description collection[0]: Device address base segment 0 */ + +/* Bits 31..0 : Device address base segment 0 */ +#define RADIO_DAB_DAB_Pos (0UL) /*!< Position of DAB field. */ +#define RADIO_DAB_DAB_Msk (0xFFFFFFFFUL << RADIO_DAB_DAB_Pos) /*!< Bit mask of DAB field. */ + +/* Register: RADIO_DAP */ +/* Description: Description collection[0]: Device address prefix 0 */ + +/* Bits 15..0 : Device address prefix 0 */ +#define RADIO_DAP_DAP_Pos (0UL) /*!< Position of DAP field. */ +#define RADIO_DAP_DAP_Msk (0xFFFFUL << RADIO_DAP_DAP_Pos) /*!< Bit mask of DAP field. */ + +/* Register: RADIO_DACNF */ +/* Description: Device address match configuration */ + +/* Bit 15 : TxAdd for device address 7 */ +#define RADIO_DACNF_TXADD7_Pos (15UL) /*!< Position of TXADD7 field. */ +#define RADIO_DACNF_TXADD7_Msk (0x1UL << RADIO_DACNF_TXADD7_Pos) /*!< Bit mask of TXADD7 field. */ + +/* Bit 14 : TxAdd for device address 6 */ +#define RADIO_DACNF_TXADD6_Pos (14UL) /*!< Position of TXADD6 field. */ +#define RADIO_DACNF_TXADD6_Msk (0x1UL << RADIO_DACNF_TXADD6_Pos) /*!< Bit mask of TXADD6 field. */ + +/* Bit 13 : TxAdd for device address 5 */ +#define RADIO_DACNF_TXADD5_Pos (13UL) /*!< Position of TXADD5 field. */ +#define RADIO_DACNF_TXADD5_Msk (0x1UL << RADIO_DACNF_TXADD5_Pos) /*!< Bit mask of TXADD5 field. */ + +/* Bit 12 : TxAdd for device address 4 */ +#define RADIO_DACNF_TXADD4_Pos (12UL) /*!< Position of TXADD4 field. */ +#define RADIO_DACNF_TXADD4_Msk (0x1UL << RADIO_DACNF_TXADD4_Pos) /*!< Bit mask of TXADD4 field. */ + +/* Bit 11 : TxAdd for device address 3 */ +#define RADIO_DACNF_TXADD3_Pos (11UL) /*!< Position of TXADD3 field. */ +#define RADIO_DACNF_TXADD3_Msk (0x1UL << RADIO_DACNF_TXADD3_Pos) /*!< Bit mask of TXADD3 field. */ + +/* Bit 10 : TxAdd for device address 2 */ +#define RADIO_DACNF_TXADD2_Pos (10UL) /*!< Position of TXADD2 field. */ +#define RADIO_DACNF_TXADD2_Msk (0x1UL << RADIO_DACNF_TXADD2_Pos) /*!< Bit mask of TXADD2 field. */ + +/* Bit 9 : TxAdd for device address 1 */ +#define RADIO_DACNF_TXADD1_Pos (9UL) /*!< Position of TXADD1 field. */ +#define RADIO_DACNF_TXADD1_Msk (0x1UL << RADIO_DACNF_TXADD1_Pos) /*!< Bit mask of TXADD1 field. */ + +/* Bit 8 : TxAdd for device address 0 */ +#define RADIO_DACNF_TXADD0_Pos (8UL) /*!< Position of TXADD0 field. */ +#define RADIO_DACNF_TXADD0_Msk (0x1UL << RADIO_DACNF_TXADD0_Pos) /*!< Bit mask of TXADD0 field. */ + +/* Bit 7 : Enable or disable device address matching using device address 7 */ +#define RADIO_DACNF_ENA7_Pos (7UL) /*!< Position of ENA7 field. */ +#define RADIO_DACNF_ENA7_Msk (0x1UL << RADIO_DACNF_ENA7_Pos) /*!< Bit mask of ENA7 field. */ +#define RADIO_DACNF_ENA7_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA7_Enabled (1UL) /*!< Enabled */ + +/* Bit 6 : Enable or disable device address matching using device address 6 */ +#define RADIO_DACNF_ENA6_Pos (6UL) /*!< Position of ENA6 field. */ +#define RADIO_DACNF_ENA6_Msk (0x1UL << RADIO_DACNF_ENA6_Pos) /*!< Bit mask of ENA6 field. */ +#define RADIO_DACNF_ENA6_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA6_Enabled (1UL) /*!< Enabled */ + +/* Bit 5 : Enable or disable device address matching using device address 5 */ +#define RADIO_DACNF_ENA5_Pos (5UL) /*!< Position of ENA5 field. */ +#define RADIO_DACNF_ENA5_Msk (0x1UL << RADIO_DACNF_ENA5_Pos) /*!< Bit mask of ENA5 field. */ +#define RADIO_DACNF_ENA5_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA5_Enabled (1UL) /*!< Enabled */ + +/* Bit 4 : Enable or disable device address matching using device address 4 */ +#define RADIO_DACNF_ENA4_Pos (4UL) /*!< Position of ENA4 field. */ +#define RADIO_DACNF_ENA4_Msk (0x1UL << RADIO_DACNF_ENA4_Pos) /*!< Bit mask of ENA4 field. */ +#define RADIO_DACNF_ENA4_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA4_Enabled (1UL) /*!< Enabled */ + +/* Bit 3 : Enable or disable device address matching using device address 3 */ +#define RADIO_DACNF_ENA3_Pos (3UL) /*!< Position of ENA3 field. */ +#define RADIO_DACNF_ENA3_Msk (0x1UL << RADIO_DACNF_ENA3_Pos) /*!< Bit mask of ENA3 field. */ +#define RADIO_DACNF_ENA3_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA3_Enabled (1UL) /*!< Enabled */ + +/* Bit 2 : Enable or disable device address matching using device address 2 */ +#define RADIO_DACNF_ENA2_Pos (2UL) /*!< Position of ENA2 field. */ +#define RADIO_DACNF_ENA2_Msk (0x1UL << RADIO_DACNF_ENA2_Pos) /*!< Bit mask of ENA2 field. */ +#define RADIO_DACNF_ENA2_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA2_Enabled (1UL) /*!< Enabled */ + +/* Bit 1 : Enable or disable device address matching using device address 1 */ +#define RADIO_DACNF_ENA1_Pos (1UL) /*!< Position of ENA1 field. */ +#define RADIO_DACNF_ENA1_Msk (0x1UL << RADIO_DACNF_ENA1_Pos) /*!< Bit mask of ENA1 field. */ +#define RADIO_DACNF_ENA1_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA1_Enabled (1UL) /*!< Enabled */ + +/* Bit 0 : Enable or disable device address matching using device address 0 */ +#define RADIO_DACNF_ENA0_Pos (0UL) /*!< Position of ENA0 field. */ +#define RADIO_DACNF_ENA0_Msk (0x1UL << RADIO_DACNF_ENA0_Pos) /*!< Bit mask of ENA0 field. */ +#define RADIO_DACNF_ENA0_Disabled (0UL) /*!< Disabled */ +#define RADIO_DACNF_ENA0_Enabled (1UL) /*!< Enabled */ + +/* Register: RADIO_MODECNF0 */ +/* Description: Radio mode configuration register 0 */ + +/* Bits 9..8 : Default TX value */ +#define RADIO_MODECNF0_DTX_Pos (8UL) /*!< Position of DTX field. */ +#define RADIO_MODECNF0_DTX_Msk (0x3UL << RADIO_MODECNF0_DTX_Pos) /*!< Bit mask of DTX field. */ +#define RADIO_MODECNF0_DTX_B1 (0UL) /*!< Transmit '1' */ +#define RADIO_MODECNF0_DTX_B0 (1UL) /*!< Transmit '0' */ +#define RADIO_MODECNF0_DTX_Center (2UL) /*!< Transmit center frequency */ + +/* Bit 0 : Radio ramp-up time */ +#define RADIO_MODECNF0_RU_Pos (0UL) /*!< Position of RU field. */ +#define RADIO_MODECNF0_RU_Msk (0x1UL << RADIO_MODECNF0_RU_Pos) /*!< Bit mask of RU field. */ +#define RADIO_MODECNF0_RU_Default (0UL) /*!< Default ramp-up time (tRXEN), compatible with firmware written for nRF51 */ +#define RADIO_MODECNF0_RU_Fast (1UL) /*!< Fast ramp-up (tRXEN,FAST), see electrical specification for more information */ + +/* Register: RADIO_SFD */ +/* Description: IEEE 802.15.4 Start of Frame Delimiter */ + +/* Bits 7..0 : IEEE 802.15.4 Start of Frame Delimiter */ +#define RADIO_SFD_SFD_Pos (0UL) /*!< Position of SFD field. */ +#define RADIO_SFD_SFD_Msk (0xFFUL << RADIO_SFD_SFD_Pos) /*!< Bit mask of SFD field. */ + +/* Register: RADIO_EDCNT */ +/* Description: IEEE 802.15.4 Energy Detect Loop Count */ + +/* Bits 20..0 : IEEE 802.15.4 Energy Detect Loop Count */ +#define RADIO_EDCNT_EDCNT_Pos (0UL) /*!< Position of EDCNT field. */ +#define RADIO_EDCNT_EDCNT_Msk (0x1FFFFFUL << RADIO_EDCNT_EDCNT_Pos) /*!< Bit mask of EDCNT field. */ + +/* Register: RADIO_EDSAMPLE */ +/* Description: IEEE 802.15.4 Energy Detect Level */ + +/* Bits 7..0 : IEEE 802.15.4 Energy Detect Level */ +#define RADIO_EDSAMPLE_EDLVL_Pos (0UL) /*!< Position of EDLVL field. */ +#define RADIO_EDSAMPLE_EDLVL_Msk (0xFFUL << RADIO_EDSAMPLE_EDLVL_Pos) /*!< Bit mask of EDLVL field. */ + +/* Register: RADIO_CCACTRL */ +/* Description: IEEE 802.15.4 Clear Channel Assessment Control */ + +/* Bits 31..24 : Limit for occurances above CCACORRTHRES. When not equal to zero the corrolator based signal detect is enabled. */ +#define RADIO_CCACTRL_CCACORRCNT_Pos (24UL) /*!< Position of CCACORRCNT field. */ +#define RADIO_CCACTRL_CCACORRCNT_Msk (0xFFUL << RADIO_CCACTRL_CCACORRCNT_Pos) /*!< Bit mask of CCACORRCNT field. */ + +/* Bits 23..16 : CCA Correlator Busy Threshold. Only relevant to CarrierMode, CarrierAndEdMode and CarrierOrEdMode. */ +#define RADIO_CCACTRL_CCACORRTHRES_Pos (16UL) /*!< Position of CCACORRTHRES field. */ +#define RADIO_CCACTRL_CCACORRTHRES_Msk (0xFFUL << RADIO_CCACTRL_CCACORRTHRES_Pos) /*!< Bit mask of CCACORRTHRES field. */ + +/* Bits 15..8 : CCA Energy Busy Threshold. Used in all the CCA modes except CarrierMode. */ +#define RADIO_CCACTRL_CCAEDTHRES_Pos (8UL) /*!< Position of CCAEDTHRES field. */ +#define RADIO_CCACTRL_CCAEDTHRES_Msk (0xFFUL << RADIO_CCACTRL_CCAEDTHRES_Pos) /*!< Bit mask of CCAEDTHRES field. */ + +/* Bits 2..0 : CCA Mode Of Operation */ +#define RADIO_CCACTRL_CCAMODE_Pos (0UL) /*!< Position of CCAMODE field. */ +#define RADIO_CCACTRL_CCAMODE_Msk (0x7UL << RADIO_CCACTRL_CCAMODE_Pos) /*!< Bit mask of CCAMODE field. */ +#define RADIO_CCACTRL_CCAMODE_EdMode (0UL) /*!< Energy Above Threshold */ +#define RADIO_CCACTRL_CCAMODE_CarrierMode (1UL) /*!< Carrier Seen */ +#define RADIO_CCACTRL_CCAMODE_CarrierAndEdMode (2UL) /*!< Energy Above Threshold AND Carrier Seen */ +#define RADIO_CCACTRL_CCAMODE_CarrierOrEdMode (3UL) /*!< Energy Above Threshold OR Carrier Seen */ +#define RADIO_CCACTRL_CCAMODE_EdModeTest1 (4UL) /*!< Energy Above Threshold test mode that will abort when first ED measurement over threshold is seen. No averaging. */ + +/* Register: RADIO_POWER */ +/* Description: Peripheral power control */ + +/* Bit 0 : Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again. */ +#define RADIO_POWER_POWER_Pos (0UL) /*!< Position of POWER field. */ +#define RADIO_POWER_POWER_Msk (0x1UL << RADIO_POWER_POWER_Pos) /*!< Bit mask of POWER field. */ +#define RADIO_POWER_POWER_Disabled (0UL) /*!< Peripheral is powered off */ +#define RADIO_POWER_POWER_Enabled (1UL) /*!< Peripheral is powered on */ + + +/* Peripheral: RNG */ +/* Description: Random Number Generator */ + +/* Register: RNG_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 0 : Shortcut between VALRDY event and STOP task */ +#define RNG_SHORTS_VALRDY_STOP_Pos (0UL) /*!< Position of VALRDY_STOP field. */ +#define RNG_SHORTS_VALRDY_STOP_Msk (0x1UL << RNG_SHORTS_VALRDY_STOP_Pos) /*!< Bit mask of VALRDY_STOP field. */ +#define RNG_SHORTS_VALRDY_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define RNG_SHORTS_VALRDY_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: RNG_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 0 : Write '1' to Enable interrupt for VALRDY event */ +#define RNG_INTENSET_VALRDY_Pos (0UL) /*!< Position of VALRDY field. */ +#define RNG_INTENSET_VALRDY_Msk (0x1UL << RNG_INTENSET_VALRDY_Pos) /*!< Bit mask of VALRDY field. */ +#define RNG_INTENSET_VALRDY_Disabled (0UL) /*!< Read: Disabled */ +#define RNG_INTENSET_VALRDY_Enabled (1UL) /*!< Read: Enabled */ +#define RNG_INTENSET_VALRDY_Set (1UL) /*!< Enable */ + +/* Register: RNG_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 0 : Write '1' to Disable interrupt for VALRDY event */ +#define RNG_INTENCLR_VALRDY_Pos (0UL) /*!< Position of VALRDY field. */ +#define RNG_INTENCLR_VALRDY_Msk (0x1UL << RNG_INTENCLR_VALRDY_Pos) /*!< Bit mask of VALRDY field. */ +#define RNG_INTENCLR_VALRDY_Disabled (0UL) /*!< Read: Disabled */ +#define RNG_INTENCLR_VALRDY_Enabled (1UL) /*!< Read: Enabled */ +#define RNG_INTENCLR_VALRDY_Clear (1UL) /*!< Disable */ + +/* Register: RNG_CONFIG */ +/* Description: Configuration register */ + +/* Bit 0 : Bias correction */ +#define RNG_CONFIG_DERCEN_Pos (0UL) /*!< Position of DERCEN field. */ +#define RNG_CONFIG_DERCEN_Msk (0x1UL << RNG_CONFIG_DERCEN_Pos) /*!< Bit mask of DERCEN field. */ +#define RNG_CONFIG_DERCEN_Disabled (0UL) /*!< Disabled */ +#define RNG_CONFIG_DERCEN_Enabled (1UL) /*!< Enabled */ + +/* Register: RNG_VALUE */ +/* Description: Output random number */ + +/* Bits 7..0 : Generated random number */ +#define RNG_VALUE_VALUE_Pos (0UL) /*!< Position of VALUE field. */ +#define RNG_VALUE_VALUE_Msk (0xFFUL << RNG_VALUE_VALUE_Pos) /*!< Bit mask of VALUE field. */ + + +/* Peripheral: RTC */ +/* Description: Real time counter 0 */ + +/* Register: RTC_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 19 : Write '1' to Enable interrupt for COMPARE[3] event */ +#define RTC_INTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_INTENSET_COMPARE3_Msk (0x1UL << RTC_INTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_INTENSET_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_COMPARE3_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for COMPARE[2] event */ +#define RTC_INTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_INTENSET_COMPARE2_Msk (0x1UL << RTC_INTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_INTENSET_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_COMPARE2_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for COMPARE[1] event */ +#define RTC_INTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_INTENSET_COMPARE1_Msk (0x1UL << RTC_INTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_INTENSET_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_COMPARE1_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable interrupt for COMPARE[0] event */ +#define RTC_INTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_INTENSET_COMPARE0_Msk (0x1UL << RTC_INTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_INTENSET_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_COMPARE0_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for OVRFLW event */ +#define RTC_INTENSET_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_INTENSET_OVRFLW_Msk (0x1UL << RTC_INTENSET_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_INTENSET_OVRFLW_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_OVRFLW_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_OVRFLW_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for TICK event */ +#define RTC_INTENSET_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_INTENSET_TICK_Msk (0x1UL << RTC_INTENSET_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_INTENSET_TICK_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENSET_TICK_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENSET_TICK_Set (1UL) /*!< Enable */ + +/* Register: RTC_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 19 : Write '1' to Disable interrupt for COMPARE[3] event */ +#define RTC_INTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_INTENCLR_COMPARE3_Msk (0x1UL << RTC_INTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_INTENCLR_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_COMPARE3_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for COMPARE[2] event */ +#define RTC_INTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_INTENCLR_COMPARE2_Msk (0x1UL << RTC_INTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_INTENCLR_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_COMPARE2_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for COMPARE[1] event */ +#define RTC_INTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_INTENCLR_COMPARE1_Msk (0x1UL << RTC_INTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_INTENCLR_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_COMPARE1_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable interrupt for COMPARE[0] event */ +#define RTC_INTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_INTENCLR_COMPARE0_Msk (0x1UL << RTC_INTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_INTENCLR_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_COMPARE0_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for OVRFLW event */ +#define RTC_INTENCLR_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_INTENCLR_OVRFLW_Msk (0x1UL << RTC_INTENCLR_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_INTENCLR_OVRFLW_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_OVRFLW_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_OVRFLW_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for TICK event */ +#define RTC_INTENCLR_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_INTENCLR_TICK_Msk (0x1UL << RTC_INTENCLR_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_INTENCLR_TICK_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_INTENCLR_TICK_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_INTENCLR_TICK_Clear (1UL) /*!< Disable */ + +/* Register: RTC_EVTEN */ +/* Description: Enable or disable event routing */ + +/* Bit 19 : Enable or disable event routing for COMPARE[3] event */ +#define RTC_EVTEN_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTEN_COMPARE3_Msk (0x1UL << RTC_EVTEN_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTEN_COMPARE3_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_COMPARE3_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable event routing for COMPARE[2] event */ +#define RTC_EVTEN_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTEN_COMPARE2_Msk (0x1UL << RTC_EVTEN_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTEN_COMPARE2_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_COMPARE2_Enabled (1UL) /*!< Enable */ + +/* Bit 17 : Enable or disable event routing for COMPARE[1] event */ +#define RTC_EVTEN_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTEN_COMPARE1_Msk (0x1UL << RTC_EVTEN_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTEN_COMPARE1_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_COMPARE1_Enabled (1UL) /*!< Enable */ + +/* Bit 16 : Enable or disable event routing for COMPARE[0] event */ +#define RTC_EVTEN_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTEN_COMPARE0_Msk (0x1UL << RTC_EVTEN_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTEN_COMPARE0_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_COMPARE0_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable event routing for OVRFLW event */ +#define RTC_EVTEN_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTEN_OVRFLW_Msk (0x1UL << RTC_EVTEN_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTEN_OVRFLW_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_OVRFLW_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable event routing for TICK event */ +#define RTC_EVTEN_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTEN_TICK_Msk (0x1UL << RTC_EVTEN_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTEN_TICK_Disabled (0UL) /*!< Disable */ +#define RTC_EVTEN_TICK_Enabled (1UL) /*!< Enable */ + +/* Register: RTC_EVTENSET */ +/* Description: Enable event routing */ + +/* Bit 19 : Write '1' to Enable event routing for COMPARE[3] event */ +#define RTC_EVTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTENSET_COMPARE3_Msk (0x1UL << RTC_EVTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTENSET_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_COMPARE3_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable event routing for COMPARE[2] event */ +#define RTC_EVTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTENSET_COMPARE2_Msk (0x1UL << RTC_EVTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTENSET_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_COMPARE2_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable event routing for COMPARE[1] event */ +#define RTC_EVTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTENSET_COMPARE1_Msk (0x1UL << RTC_EVTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTENSET_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_COMPARE1_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable event routing for COMPARE[0] event */ +#define RTC_EVTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTENSET_COMPARE0_Msk (0x1UL << RTC_EVTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTENSET_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_COMPARE0_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable event routing for OVRFLW event */ +#define RTC_EVTENSET_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTENSET_OVRFLW_Msk (0x1UL << RTC_EVTENSET_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTENSET_OVRFLW_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_OVRFLW_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_OVRFLW_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable event routing for TICK event */ +#define RTC_EVTENSET_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTENSET_TICK_Msk (0x1UL << RTC_EVTENSET_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTENSET_TICK_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENSET_TICK_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENSET_TICK_Set (1UL) /*!< Enable */ + +/* Register: RTC_EVTENCLR */ +/* Description: Disable event routing */ + +/* Bit 19 : Write '1' to Disable event routing for COMPARE[3] event */ +#define RTC_EVTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define RTC_EVTENCLR_COMPARE3_Msk (0x1UL << RTC_EVTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define RTC_EVTENCLR_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_COMPARE3_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable event routing for COMPARE[2] event */ +#define RTC_EVTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define RTC_EVTENCLR_COMPARE2_Msk (0x1UL << RTC_EVTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define RTC_EVTENCLR_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_COMPARE2_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable event routing for COMPARE[1] event */ +#define RTC_EVTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define RTC_EVTENCLR_COMPARE1_Msk (0x1UL << RTC_EVTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define RTC_EVTENCLR_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_COMPARE1_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable event routing for COMPARE[0] event */ +#define RTC_EVTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define RTC_EVTENCLR_COMPARE0_Msk (0x1UL << RTC_EVTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define RTC_EVTENCLR_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_COMPARE0_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable event routing for OVRFLW event */ +#define RTC_EVTENCLR_OVRFLW_Pos (1UL) /*!< Position of OVRFLW field. */ +#define RTC_EVTENCLR_OVRFLW_Msk (0x1UL << RTC_EVTENCLR_OVRFLW_Pos) /*!< Bit mask of OVRFLW field. */ +#define RTC_EVTENCLR_OVRFLW_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_OVRFLW_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_OVRFLW_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable event routing for TICK event */ +#define RTC_EVTENCLR_TICK_Pos (0UL) /*!< Position of TICK field. */ +#define RTC_EVTENCLR_TICK_Msk (0x1UL << RTC_EVTENCLR_TICK_Pos) /*!< Bit mask of TICK field. */ +#define RTC_EVTENCLR_TICK_Disabled (0UL) /*!< Read: Disabled */ +#define RTC_EVTENCLR_TICK_Enabled (1UL) /*!< Read: Enabled */ +#define RTC_EVTENCLR_TICK_Clear (1UL) /*!< Disable */ + +/* Register: RTC_COUNTER */ +/* Description: Current COUNTER value */ + +/* Bits 23..0 : Counter value */ +#define RTC_COUNTER_COUNTER_Pos (0UL) /*!< Position of COUNTER field. */ +#define RTC_COUNTER_COUNTER_Msk (0xFFFFFFUL << RTC_COUNTER_COUNTER_Pos) /*!< Bit mask of COUNTER field. */ + +/* Register: RTC_PRESCALER */ +/* Description: 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must be written when RTC is stopped */ + +/* Bits 11..0 : Prescaler value */ +#define RTC_PRESCALER_PRESCALER_Pos (0UL) /*!< Position of PRESCALER field. */ +#define RTC_PRESCALER_PRESCALER_Msk (0xFFFUL << RTC_PRESCALER_PRESCALER_Pos) /*!< Bit mask of PRESCALER field. */ + +/* Register: RTC_CC */ +/* Description: Description collection[0]: Compare register 0 */ + +/* Bits 23..0 : Compare value */ +#define RTC_CC_COMPARE_Pos (0UL) /*!< Position of COMPARE field. */ +#define RTC_CC_COMPARE_Msk (0xFFFFFFUL << RTC_CC_COMPARE_Pos) /*!< Bit mask of COMPARE field. */ + + +/* Peripheral: SAADC */ +/* Description: Analog to Digital Converter */ + +/* Register: SAADC_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 21 : Enable or disable interrupt for CH[7].LIMITL event */ +#define SAADC_INTEN_CH7LIMITL_Pos (21UL) /*!< Position of CH7LIMITL field. */ +#define SAADC_INTEN_CH7LIMITL_Msk (0x1UL << SAADC_INTEN_CH7LIMITL_Pos) /*!< Bit mask of CH7LIMITL field. */ +#define SAADC_INTEN_CH7LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH7LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for CH[7].LIMITH event */ +#define SAADC_INTEN_CH7LIMITH_Pos (20UL) /*!< Position of CH7LIMITH field. */ +#define SAADC_INTEN_CH7LIMITH_Msk (0x1UL << SAADC_INTEN_CH7LIMITH_Pos) /*!< Bit mask of CH7LIMITH field. */ +#define SAADC_INTEN_CH7LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH7LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for CH[6].LIMITL event */ +#define SAADC_INTEN_CH6LIMITL_Pos (19UL) /*!< Position of CH6LIMITL field. */ +#define SAADC_INTEN_CH6LIMITL_Msk (0x1UL << SAADC_INTEN_CH6LIMITL_Pos) /*!< Bit mask of CH6LIMITL field. */ +#define SAADC_INTEN_CH6LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH6LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable interrupt for CH[6].LIMITH event */ +#define SAADC_INTEN_CH6LIMITH_Pos (18UL) /*!< Position of CH6LIMITH field. */ +#define SAADC_INTEN_CH6LIMITH_Msk (0x1UL << SAADC_INTEN_CH6LIMITH_Pos) /*!< Bit mask of CH6LIMITH field. */ +#define SAADC_INTEN_CH6LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH6LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 17 : Enable or disable interrupt for CH[5].LIMITL event */ +#define SAADC_INTEN_CH5LIMITL_Pos (17UL) /*!< Position of CH5LIMITL field. */ +#define SAADC_INTEN_CH5LIMITL_Msk (0x1UL << SAADC_INTEN_CH5LIMITL_Pos) /*!< Bit mask of CH5LIMITL field. */ +#define SAADC_INTEN_CH5LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH5LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 16 : Enable or disable interrupt for CH[5].LIMITH event */ +#define SAADC_INTEN_CH5LIMITH_Pos (16UL) /*!< Position of CH5LIMITH field. */ +#define SAADC_INTEN_CH5LIMITH_Msk (0x1UL << SAADC_INTEN_CH5LIMITH_Pos) /*!< Bit mask of CH5LIMITH field. */ +#define SAADC_INTEN_CH5LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH5LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 15 : Enable or disable interrupt for CH[4].LIMITL event */ +#define SAADC_INTEN_CH4LIMITL_Pos (15UL) /*!< Position of CH4LIMITL field. */ +#define SAADC_INTEN_CH4LIMITL_Msk (0x1UL << SAADC_INTEN_CH4LIMITL_Pos) /*!< Bit mask of CH4LIMITL field. */ +#define SAADC_INTEN_CH4LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH4LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 14 : Enable or disable interrupt for CH[4].LIMITH event */ +#define SAADC_INTEN_CH4LIMITH_Pos (14UL) /*!< Position of CH4LIMITH field. */ +#define SAADC_INTEN_CH4LIMITH_Msk (0x1UL << SAADC_INTEN_CH4LIMITH_Pos) /*!< Bit mask of CH4LIMITH field. */ +#define SAADC_INTEN_CH4LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH4LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 13 : Enable or disable interrupt for CH[3].LIMITL event */ +#define SAADC_INTEN_CH3LIMITL_Pos (13UL) /*!< Position of CH3LIMITL field. */ +#define SAADC_INTEN_CH3LIMITL_Msk (0x1UL << SAADC_INTEN_CH3LIMITL_Pos) /*!< Bit mask of CH3LIMITL field. */ +#define SAADC_INTEN_CH3LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH3LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 12 : Enable or disable interrupt for CH[3].LIMITH event */ +#define SAADC_INTEN_CH3LIMITH_Pos (12UL) /*!< Position of CH3LIMITH field. */ +#define SAADC_INTEN_CH3LIMITH_Msk (0x1UL << SAADC_INTEN_CH3LIMITH_Pos) /*!< Bit mask of CH3LIMITH field. */ +#define SAADC_INTEN_CH3LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH3LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 11 : Enable or disable interrupt for CH[2].LIMITL event */ +#define SAADC_INTEN_CH2LIMITL_Pos (11UL) /*!< Position of CH2LIMITL field. */ +#define SAADC_INTEN_CH2LIMITL_Msk (0x1UL << SAADC_INTEN_CH2LIMITL_Pos) /*!< Bit mask of CH2LIMITL field. */ +#define SAADC_INTEN_CH2LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH2LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 10 : Enable or disable interrupt for CH[2].LIMITH event */ +#define SAADC_INTEN_CH2LIMITH_Pos (10UL) /*!< Position of CH2LIMITH field. */ +#define SAADC_INTEN_CH2LIMITH_Msk (0x1UL << SAADC_INTEN_CH2LIMITH_Pos) /*!< Bit mask of CH2LIMITH field. */ +#define SAADC_INTEN_CH2LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH2LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for CH[1].LIMITL event */ +#define SAADC_INTEN_CH1LIMITL_Pos (9UL) /*!< Position of CH1LIMITL field. */ +#define SAADC_INTEN_CH1LIMITL_Msk (0x1UL << SAADC_INTEN_CH1LIMITL_Pos) /*!< Bit mask of CH1LIMITL field. */ +#define SAADC_INTEN_CH1LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH1LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 8 : Enable or disable interrupt for CH[1].LIMITH event */ +#define SAADC_INTEN_CH1LIMITH_Pos (8UL) /*!< Position of CH1LIMITH field. */ +#define SAADC_INTEN_CH1LIMITH_Msk (0x1UL << SAADC_INTEN_CH1LIMITH_Pos) /*!< Bit mask of CH1LIMITH field. */ +#define SAADC_INTEN_CH1LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH1LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for CH[0].LIMITL event */ +#define SAADC_INTEN_CH0LIMITL_Pos (7UL) /*!< Position of CH0LIMITL field. */ +#define SAADC_INTEN_CH0LIMITL_Msk (0x1UL << SAADC_INTEN_CH0LIMITL_Pos) /*!< Bit mask of CH0LIMITL field. */ +#define SAADC_INTEN_CH0LIMITL_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH0LIMITL_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for CH[0].LIMITH event */ +#define SAADC_INTEN_CH0LIMITH_Pos (6UL) /*!< Position of CH0LIMITH field. */ +#define SAADC_INTEN_CH0LIMITH_Msk (0x1UL << SAADC_INTEN_CH0LIMITH_Pos) /*!< Bit mask of CH0LIMITH field. */ +#define SAADC_INTEN_CH0LIMITH_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CH0LIMITH_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for STOPPED event */ +#define SAADC_INTEN_STOPPED_Pos (5UL) /*!< Position of STOPPED field. */ +#define SAADC_INTEN_STOPPED_Msk (0x1UL << SAADC_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SAADC_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for CALIBRATEDONE event */ +#define SAADC_INTEN_CALIBRATEDONE_Pos (4UL) /*!< Position of CALIBRATEDONE field. */ +#define SAADC_INTEN_CALIBRATEDONE_Msk (0x1UL << SAADC_INTEN_CALIBRATEDONE_Pos) /*!< Bit mask of CALIBRATEDONE field. */ +#define SAADC_INTEN_CALIBRATEDONE_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_CALIBRATEDONE_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for RESULTDONE event */ +#define SAADC_INTEN_RESULTDONE_Pos (3UL) /*!< Position of RESULTDONE field. */ +#define SAADC_INTEN_RESULTDONE_Msk (0x1UL << SAADC_INTEN_RESULTDONE_Pos) /*!< Bit mask of RESULTDONE field. */ +#define SAADC_INTEN_RESULTDONE_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_RESULTDONE_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for DONE event */ +#define SAADC_INTEN_DONE_Pos (2UL) /*!< Position of DONE field. */ +#define SAADC_INTEN_DONE_Msk (0x1UL << SAADC_INTEN_DONE_Pos) /*!< Bit mask of DONE field. */ +#define SAADC_INTEN_DONE_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_DONE_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for END event */ +#define SAADC_INTEN_END_Pos (1UL) /*!< Position of END field. */ +#define SAADC_INTEN_END_Msk (0x1UL << SAADC_INTEN_END_Pos) /*!< Bit mask of END field. */ +#define SAADC_INTEN_END_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_END_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for STARTED event */ +#define SAADC_INTEN_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define SAADC_INTEN_STARTED_Msk (0x1UL << SAADC_INTEN_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SAADC_INTEN_STARTED_Disabled (0UL) /*!< Disable */ +#define SAADC_INTEN_STARTED_Enabled (1UL) /*!< Enable */ + +/* Register: SAADC_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 21 : Write '1' to Enable interrupt for CH[7].LIMITL event */ +#define SAADC_INTENSET_CH7LIMITL_Pos (21UL) /*!< Position of CH7LIMITL field. */ +#define SAADC_INTENSET_CH7LIMITL_Msk (0x1UL << SAADC_INTENSET_CH7LIMITL_Pos) /*!< Bit mask of CH7LIMITL field. */ +#define SAADC_INTENSET_CH7LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH7LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH7LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for CH[7].LIMITH event */ +#define SAADC_INTENSET_CH7LIMITH_Pos (20UL) /*!< Position of CH7LIMITH field. */ +#define SAADC_INTENSET_CH7LIMITH_Msk (0x1UL << SAADC_INTENSET_CH7LIMITH_Pos) /*!< Bit mask of CH7LIMITH field. */ +#define SAADC_INTENSET_CH7LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH7LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH7LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for CH[6].LIMITL event */ +#define SAADC_INTENSET_CH6LIMITL_Pos (19UL) /*!< Position of CH6LIMITL field. */ +#define SAADC_INTENSET_CH6LIMITL_Msk (0x1UL << SAADC_INTENSET_CH6LIMITL_Pos) /*!< Bit mask of CH6LIMITL field. */ +#define SAADC_INTENSET_CH6LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH6LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH6LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for CH[6].LIMITH event */ +#define SAADC_INTENSET_CH6LIMITH_Pos (18UL) /*!< Position of CH6LIMITH field. */ +#define SAADC_INTENSET_CH6LIMITH_Msk (0x1UL << SAADC_INTENSET_CH6LIMITH_Pos) /*!< Bit mask of CH6LIMITH field. */ +#define SAADC_INTENSET_CH6LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH6LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH6LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for CH[5].LIMITL event */ +#define SAADC_INTENSET_CH5LIMITL_Pos (17UL) /*!< Position of CH5LIMITL field. */ +#define SAADC_INTENSET_CH5LIMITL_Msk (0x1UL << SAADC_INTENSET_CH5LIMITL_Pos) /*!< Bit mask of CH5LIMITL field. */ +#define SAADC_INTENSET_CH5LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH5LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH5LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable interrupt for CH[5].LIMITH event */ +#define SAADC_INTENSET_CH5LIMITH_Pos (16UL) /*!< Position of CH5LIMITH field. */ +#define SAADC_INTENSET_CH5LIMITH_Msk (0x1UL << SAADC_INTENSET_CH5LIMITH_Pos) /*!< Bit mask of CH5LIMITH field. */ +#define SAADC_INTENSET_CH5LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH5LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH5LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 15 : Write '1' to Enable interrupt for CH[4].LIMITL event */ +#define SAADC_INTENSET_CH4LIMITL_Pos (15UL) /*!< Position of CH4LIMITL field. */ +#define SAADC_INTENSET_CH4LIMITL_Msk (0x1UL << SAADC_INTENSET_CH4LIMITL_Pos) /*!< Bit mask of CH4LIMITL field. */ +#define SAADC_INTENSET_CH4LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH4LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH4LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for CH[4].LIMITH event */ +#define SAADC_INTENSET_CH4LIMITH_Pos (14UL) /*!< Position of CH4LIMITH field. */ +#define SAADC_INTENSET_CH4LIMITH_Msk (0x1UL << SAADC_INTENSET_CH4LIMITH_Pos) /*!< Bit mask of CH4LIMITH field. */ +#define SAADC_INTENSET_CH4LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH4LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH4LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 13 : Write '1' to Enable interrupt for CH[3].LIMITL event */ +#define SAADC_INTENSET_CH3LIMITL_Pos (13UL) /*!< Position of CH3LIMITL field. */ +#define SAADC_INTENSET_CH3LIMITL_Msk (0x1UL << SAADC_INTENSET_CH3LIMITL_Pos) /*!< Bit mask of CH3LIMITL field. */ +#define SAADC_INTENSET_CH3LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH3LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH3LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for CH[3].LIMITH event */ +#define SAADC_INTENSET_CH3LIMITH_Pos (12UL) /*!< Position of CH3LIMITH field. */ +#define SAADC_INTENSET_CH3LIMITH_Msk (0x1UL << SAADC_INTENSET_CH3LIMITH_Pos) /*!< Bit mask of CH3LIMITH field. */ +#define SAADC_INTENSET_CH3LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH3LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH3LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 11 : Write '1' to Enable interrupt for CH[2].LIMITL event */ +#define SAADC_INTENSET_CH2LIMITL_Pos (11UL) /*!< Position of CH2LIMITL field. */ +#define SAADC_INTENSET_CH2LIMITL_Msk (0x1UL << SAADC_INTENSET_CH2LIMITL_Pos) /*!< Bit mask of CH2LIMITL field. */ +#define SAADC_INTENSET_CH2LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH2LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH2LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for CH[2].LIMITH event */ +#define SAADC_INTENSET_CH2LIMITH_Pos (10UL) /*!< Position of CH2LIMITH field. */ +#define SAADC_INTENSET_CH2LIMITH_Msk (0x1UL << SAADC_INTENSET_CH2LIMITH_Pos) /*!< Bit mask of CH2LIMITH field. */ +#define SAADC_INTENSET_CH2LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH2LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH2LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for CH[1].LIMITL event */ +#define SAADC_INTENSET_CH1LIMITL_Pos (9UL) /*!< Position of CH1LIMITL field. */ +#define SAADC_INTENSET_CH1LIMITL_Msk (0x1UL << SAADC_INTENSET_CH1LIMITL_Pos) /*!< Bit mask of CH1LIMITL field. */ +#define SAADC_INTENSET_CH1LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH1LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH1LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for CH[1].LIMITH event */ +#define SAADC_INTENSET_CH1LIMITH_Pos (8UL) /*!< Position of CH1LIMITH field. */ +#define SAADC_INTENSET_CH1LIMITH_Msk (0x1UL << SAADC_INTENSET_CH1LIMITH_Pos) /*!< Bit mask of CH1LIMITH field. */ +#define SAADC_INTENSET_CH1LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH1LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH1LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for CH[0].LIMITL event */ +#define SAADC_INTENSET_CH0LIMITL_Pos (7UL) /*!< Position of CH0LIMITL field. */ +#define SAADC_INTENSET_CH0LIMITL_Msk (0x1UL << SAADC_INTENSET_CH0LIMITL_Pos) /*!< Bit mask of CH0LIMITL field. */ +#define SAADC_INTENSET_CH0LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH0LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH0LIMITL_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for CH[0].LIMITH event */ +#define SAADC_INTENSET_CH0LIMITH_Pos (6UL) /*!< Position of CH0LIMITH field. */ +#define SAADC_INTENSET_CH0LIMITH_Msk (0x1UL << SAADC_INTENSET_CH0LIMITH_Pos) /*!< Bit mask of CH0LIMITH field. */ +#define SAADC_INTENSET_CH0LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CH0LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CH0LIMITH_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for STOPPED event */ +#define SAADC_INTENSET_STOPPED_Pos (5UL) /*!< Position of STOPPED field. */ +#define SAADC_INTENSET_STOPPED_Msk (0x1UL << SAADC_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SAADC_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for CALIBRATEDONE event */ +#define SAADC_INTENSET_CALIBRATEDONE_Pos (4UL) /*!< Position of CALIBRATEDONE field. */ +#define SAADC_INTENSET_CALIBRATEDONE_Msk (0x1UL << SAADC_INTENSET_CALIBRATEDONE_Pos) /*!< Bit mask of CALIBRATEDONE field. */ +#define SAADC_INTENSET_CALIBRATEDONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_CALIBRATEDONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_CALIBRATEDONE_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for RESULTDONE event */ +#define SAADC_INTENSET_RESULTDONE_Pos (3UL) /*!< Position of RESULTDONE field. */ +#define SAADC_INTENSET_RESULTDONE_Msk (0x1UL << SAADC_INTENSET_RESULTDONE_Pos) /*!< Bit mask of RESULTDONE field. */ +#define SAADC_INTENSET_RESULTDONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_RESULTDONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_RESULTDONE_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for DONE event */ +#define SAADC_INTENSET_DONE_Pos (2UL) /*!< Position of DONE field. */ +#define SAADC_INTENSET_DONE_Msk (0x1UL << SAADC_INTENSET_DONE_Pos) /*!< Bit mask of DONE field. */ +#define SAADC_INTENSET_DONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_DONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_DONE_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for END event */ +#define SAADC_INTENSET_END_Pos (1UL) /*!< Position of END field. */ +#define SAADC_INTENSET_END_Msk (0x1UL << SAADC_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define SAADC_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for STARTED event */ +#define SAADC_INTENSET_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define SAADC_INTENSET_STARTED_Msk (0x1UL << SAADC_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SAADC_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Register: SAADC_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 21 : Write '1' to Disable interrupt for CH[7].LIMITL event */ +#define SAADC_INTENCLR_CH7LIMITL_Pos (21UL) /*!< Position of CH7LIMITL field. */ +#define SAADC_INTENCLR_CH7LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH7LIMITL_Pos) /*!< Bit mask of CH7LIMITL field. */ +#define SAADC_INTENCLR_CH7LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH7LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH7LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for CH[7].LIMITH event */ +#define SAADC_INTENCLR_CH7LIMITH_Pos (20UL) /*!< Position of CH7LIMITH field. */ +#define SAADC_INTENCLR_CH7LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH7LIMITH_Pos) /*!< Bit mask of CH7LIMITH field. */ +#define SAADC_INTENCLR_CH7LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH7LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH7LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for CH[6].LIMITL event */ +#define SAADC_INTENCLR_CH6LIMITL_Pos (19UL) /*!< Position of CH6LIMITL field. */ +#define SAADC_INTENCLR_CH6LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH6LIMITL_Pos) /*!< Bit mask of CH6LIMITL field. */ +#define SAADC_INTENCLR_CH6LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH6LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH6LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for CH[6].LIMITH event */ +#define SAADC_INTENCLR_CH6LIMITH_Pos (18UL) /*!< Position of CH6LIMITH field. */ +#define SAADC_INTENCLR_CH6LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH6LIMITH_Pos) /*!< Bit mask of CH6LIMITH field. */ +#define SAADC_INTENCLR_CH6LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH6LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH6LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for CH[5].LIMITL event */ +#define SAADC_INTENCLR_CH5LIMITL_Pos (17UL) /*!< Position of CH5LIMITL field. */ +#define SAADC_INTENCLR_CH5LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH5LIMITL_Pos) /*!< Bit mask of CH5LIMITL field. */ +#define SAADC_INTENCLR_CH5LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH5LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH5LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable interrupt for CH[5].LIMITH event */ +#define SAADC_INTENCLR_CH5LIMITH_Pos (16UL) /*!< Position of CH5LIMITH field. */ +#define SAADC_INTENCLR_CH5LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH5LIMITH_Pos) /*!< Bit mask of CH5LIMITH field. */ +#define SAADC_INTENCLR_CH5LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH5LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH5LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 15 : Write '1' to Disable interrupt for CH[4].LIMITL event */ +#define SAADC_INTENCLR_CH4LIMITL_Pos (15UL) /*!< Position of CH4LIMITL field. */ +#define SAADC_INTENCLR_CH4LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH4LIMITL_Pos) /*!< Bit mask of CH4LIMITL field. */ +#define SAADC_INTENCLR_CH4LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH4LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH4LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for CH[4].LIMITH event */ +#define SAADC_INTENCLR_CH4LIMITH_Pos (14UL) /*!< Position of CH4LIMITH field. */ +#define SAADC_INTENCLR_CH4LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH4LIMITH_Pos) /*!< Bit mask of CH4LIMITH field. */ +#define SAADC_INTENCLR_CH4LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH4LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH4LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 13 : Write '1' to Disable interrupt for CH[3].LIMITL event */ +#define SAADC_INTENCLR_CH3LIMITL_Pos (13UL) /*!< Position of CH3LIMITL field. */ +#define SAADC_INTENCLR_CH3LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH3LIMITL_Pos) /*!< Bit mask of CH3LIMITL field. */ +#define SAADC_INTENCLR_CH3LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH3LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH3LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for CH[3].LIMITH event */ +#define SAADC_INTENCLR_CH3LIMITH_Pos (12UL) /*!< Position of CH3LIMITH field. */ +#define SAADC_INTENCLR_CH3LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH3LIMITH_Pos) /*!< Bit mask of CH3LIMITH field. */ +#define SAADC_INTENCLR_CH3LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH3LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH3LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 11 : Write '1' to Disable interrupt for CH[2].LIMITL event */ +#define SAADC_INTENCLR_CH2LIMITL_Pos (11UL) /*!< Position of CH2LIMITL field. */ +#define SAADC_INTENCLR_CH2LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH2LIMITL_Pos) /*!< Bit mask of CH2LIMITL field. */ +#define SAADC_INTENCLR_CH2LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH2LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH2LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for CH[2].LIMITH event */ +#define SAADC_INTENCLR_CH2LIMITH_Pos (10UL) /*!< Position of CH2LIMITH field. */ +#define SAADC_INTENCLR_CH2LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH2LIMITH_Pos) /*!< Bit mask of CH2LIMITH field. */ +#define SAADC_INTENCLR_CH2LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH2LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH2LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for CH[1].LIMITL event */ +#define SAADC_INTENCLR_CH1LIMITL_Pos (9UL) /*!< Position of CH1LIMITL field. */ +#define SAADC_INTENCLR_CH1LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH1LIMITL_Pos) /*!< Bit mask of CH1LIMITL field. */ +#define SAADC_INTENCLR_CH1LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH1LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH1LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for CH[1].LIMITH event */ +#define SAADC_INTENCLR_CH1LIMITH_Pos (8UL) /*!< Position of CH1LIMITH field. */ +#define SAADC_INTENCLR_CH1LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH1LIMITH_Pos) /*!< Bit mask of CH1LIMITH field. */ +#define SAADC_INTENCLR_CH1LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH1LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH1LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for CH[0].LIMITL event */ +#define SAADC_INTENCLR_CH0LIMITL_Pos (7UL) /*!< Position of CH0LIMITL field. */ +#define SAADC_INTENCLR_CH0LIMITL_Msk (0x1UL << SAADC_INTENCLR_CH0LIMITL_Pos) /*!< Bit mask of CH0LIMITL field. */ +#define SAADC_INTENCLR_CH0LIMITL_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH0LIMITL_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH0LIMITL_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for CH[0].LIMITH event */ +#define SAADC_INTENCLR_CH0LIMITH_Pos (6UL) /*!< Position of CH0LIMITH field. */ +#define SAADC_INTENCLR_CH0LIMITH_Msk (0x1UL << SAADC_INTENCLR_CH0LIMITH_Pos) /*!< Bit mask of CH0LIMITH field. */ +#define SAADC_INTENCLR_CH0LIMITH_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CH0LIMITH_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CH0LIMITH_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for STOPPED event */ +#define SAADC_INTENCLR_STOPPED_Pos (5UL) /*!< Position of STOPPED field. */ +#define SAADC_INTENCLR_STOPPED_Msk (0x1UL << SAADC_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SAADC_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for CALIBRATEDONE event */ +#define SAADC_INTENCLR_CALIBRATEDONE_Pos (4UL) /*!< Position of CALIBRATEDONE field. */ +#define SAADC_INTENCLR_CALIBRATEDONE_Msk (0x1UL << SAADC_INTENCLR_CALIBRATEDONE_Pos) /*!< Bit mask of CALIBRATEDONE field. */ +#define SAADC_INTENCLR_CALIBRATEDONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_CALIBRATEDONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_CALIBRATEDONE_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for RESULTDONE event */ +#define SAADC_INTENCLR_RESULTDONE_Pos (3UL) /*!< Position of RESULTDONE field. */ +#define SAADC_INTENCLR_RESULTDONE_Msk (0x1UL << SAADC_INTENCLR_RESULTDONE_Pos) /*!< Bit mask of RESULTDONE field. */ +#define SAADC_INTENCLR_RESULTDONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_RESULTDONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_RESULTDONE_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for DONE event */ +#define SAADC_INTENCLR_DONE_Pos (2UL) /*!< Position of DONE field. */ +#define SAADC_INTENCLR_DONE_Msk (0x1UL << SAADC_INTENCLR_DONE_Pos) /*!< Bit mask of DONE field. */ +#define SAADC_INTENCLR_DONE_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_DONE_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_DONE_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for END event */ +#define SAADC_INTENCLR_END_Pos (1UL) /*!< Position of END field. */ +#define SAADC_INTENCLR_END_Msk (0x1UL << SAADC_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define SAADC_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for STARTED event */ +#define SAADC_INTENCLR_STARTED_Pos (0UL) /*!< Position of STARTED field. */ +#define SAADC_INTENCLR_STARTED_Msk (0x1UL << SAADC_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SAADC_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define SAADC_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define SAADC_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Register: SAADC_STATUS */ +/* Description: Status */ + +/* Bit 0 : Status */ +#define SAADC_STATUS_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define SAADC_STATUS_STATUS_Msk (0x1UL << SAADC_STATUS_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define SAADC_STATUS_STATUS_Ready (0UL) /*!< ADC is ready. No on-going conversion. */ +#define SAADC_STATUS_STATUS_Busy (1UL) /*!< ADC is busy. Conversion in progress. */ + +/* Register: SAADC_ENABLE */ +/* Description: Enable or disable ADC */ + +/* Bit 0 : Enable or disable ADC */ +#define SAADC_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SAADC_ENABLE_ENABLE_Msk (0x1UL << SAADC_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SAADC_ENABLE_ENABLE_Disabled (0UL) /*!< Disable ADC */ +#define SAADC_ENABLE_ENABLE_Enabled (1UL) /*!< Enable ADC */ + +/* Register: SAADC_CH_PSELP */ +/* Description: Description cluster[0]: Input positive pin selection for CH[0] */ + +/* Bits 4..0 : Analog positive input channel */ +#define SAADC_CH_PSELP_PSELP_Pos (0UL) /*!< Position of PSELP field. */ +#define SAADC_CH_PSELP_PSELP_Msk (0x1FUL << SAADC_CH_PSELP_PSELP_Pos) /*!< Bit mask of PSELP field. */ +#define SAADC_CH_PSELP_PSELP_NC (0UL) /*!< Not connected */ +#define SAADC_CH_PSELP_PSELP_AnalogInput0 (1UL) /*!< AIN0 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput1 (2UL) /*!< AIN1 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput2 (3UL) /*!< AIN2 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput3 (4UL) /*!< AIN3 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput4 (5UL) /*!< AIN4 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput5 (6UL) /*!< AIN5 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput6 (7UL) /*!< AIN6 */ +#define SAADC_CH_PSELP_PSELP_AnalogInput7 (8UL) /*!< AIN7 */ +#define SAADC_CH_PSELP_PSELP_VDD (9UL) /*!< VDD */ +#define SAADC_CH_PSELP_PSELP_VDDHDIV5 (0x11UL) /*!< VDDH/5 */ + +/* Register: SAADC_CH_PSELN */ +/* Description: Description cluster[0]: Input negative pin selection for CH[0] */ + +/* Bits 4..0 : Analog negative input, enables differential channel */ +#define SAADC_CH_PSELN_PSELN_Pos (0UL) /*!< Position of PSELN field. */ +#define SAADC_CH_PSELN_PSELN_Msk (0x1FUL << SAADC_CH_PSELN_PSELN_Pos) /*!< Bit mask of PSELN field. */ +#define SAADC_CH_PSELN_PSELN_NC (0UL) /*!< Not connected */ +#define SAADC_CH_PSELN_PSELN_AnalogInput0 (1UL) /*!< AIN0 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput1 (2UL) /*!< AIN1 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput2 (3UL) /*!< AIN2 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput3 (4UL) /*!< AIN3 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput4 (5UL) /*!< AIN4 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput5 (6UL) /*!< AIN5 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput6 (7UL) /*!< AIN6 */ +#define SAADC_CH_PSELN_PSELN_AnalogInput7 (8UL) /*!< AIN7 */ +#define SAADC_CH_PSELN_PSELN_VDD (9UL) /*!< VDD */ +#define SAADC_CH_PSELN_PSELN_VDDHDIV5 (0x11UL) /*!< VDDH/5 */ + +/* Register: SAADC_CH_CONFIG */ +/* Description: Description cluster[0]: Input configuration for CH[0] */ + +/* Bit 24 : Enable burst mode */ +#define SAADC_CH_CONFIG_BURST_Pos (24UL) /*!< Position of BURST field. */ +#define SAADC_CH_CONFIG_BURST_Msk (0x1UL << SAADC_CH_CONFIG_BURST_Pos) /*!< Bit mask of BURST field. */ +#define SAADC_CH_CONFIG_BURST_Disabled (0UL) /*!< Burst mode is disabled (normal operation) */ +#define SAADC_CH_CONFIG_BURST_Enabled (1UL) /*!< Burst mode is enabled. SAADC takes 2^OVERSAMPLE number of samples as fast as it can, and sends the average to Data RAM. */ + +/* Bit 20 : Enable differential mode */ +#define SAADC_CH_CONFIG_MODE_Pos (20UL) /*!< Position of MODE field. */ +#define SAADC_CH_CONFIG_MODE_Msk (0x1UL << SAADC_CH_CONFIG_MODE_Pos) /*!< Bit mask of MODE field. */ +#define SAADC_CH_CONFIG_MODE_SE (0UL) /*!< Single ended, PSELN will be ignored, negative input to ADC shorted to GND */ +#define SAADC_CH_CONFIG_MODE_Diff (1UL) /*!< Differential */ + +/* Bits 18..16 : Acquisition time, the time the ADC uses to sample the input voltage */ +#define SAADC_CH_CONFIG_TACQ_Pos (16UL) /*!< Position of TACQ field. */ +#define SAADC_CH_CONFIG_TACQ_Msk (0x7UL << SAADC_CH_CONFIG_TACQ_Pos) /*!< Bit mask of TACQ field. */ +#define SAADC_CH_CONFIG_TACQ_3us (0UL) /*!< 3 us */ +#define SAADC_CH_CONFIG_TACQ_5us (1UL) /*!< 5 us */ +#define SAADC_CH_CONFIG_TACQ_10us (2UL) /*!< 10 us */ +#define SAADC_CH_CONFIG_TACQ_15us (3UL) /*!< 15 us */ +#define SAADC_CH_CONFIG_TACQ_20us (4UL) /*!< 20 us */ +#define SAADC_CH_CONFIG_TACQ_40us (5UL) /*!< 40 us */ + +/* Bit 12 : Reference control */ +#define SAADC_CH_CONFIG_REFSEL_Pos (12UL) /*!< Position of REFSEL field. */ +#define SAADC_CH_CONFIG_REFSEL_Msk (0x1UL << SAADC_CH_CONFIG_REFSEL_Pos) /*!< Bit mask of REFSEL field. */ +#define SAADC_CH_CONFIG_REFSEL_Internal (0UL) /*!< Internal reference (0.6 V) */ +#define SAADC_CH_CONFIG_REFSEL_VDD1_4 (1UL) /*!< VDD/4 as reference */ + +/* Bits 10..8 : Gain control */ +#define SAADC_CH_CONFIG_GAIN_Pos (8UL) /*!< Position of GAIN field. */ +#define SAADC_CH_CONFIG_GAIN_Msk (0x7UL << SAADC_CH_CONFIG_GAIN_Pos) /*!< Bit mask of GAIN field. */ +#define SAADC_CH_CONFIG_GAIN_Gain1_6 (0UL) /*!< 1/6 */ +#define SAADC_CH_CONFIG_GAIN_Gain1_5 (1UL) /*!< 1/5 */ +#define SAADC_CH_CONFIG_GAIN_Gain1_4 (2UL) /*!< 1/4 */ +#define SAADC_CH_CONFIG_GAIN_Gain1_3 (3UL) /*!< 1/3 */ +#define SAADC_CH_CONFIG_GAIN_Gain1_2 (4UL) /*!< 1/2 */ +#define SAADC_CH_CONFIG_GAIN_Gain1 (5UL) /*!< 1 */ +#define SAADC_CH_CONFIG_GAIN_Gain2 (6UL) /*!< 2 */ +#define SAADC_CH_CONFIG_GAIN_Gain4 (7UL) /*!< 4 */ + +/* Bits 5..4 : Negative channel resistor control */ +#define SAADC_CH_CONFIG_RESN_Pos (4UL) /*!< Position of RESN field. */ +#define SAADC_CH_CONFIG_RESN_Msk (0x3UL << SAADC_CH_CONFIG_RESN_Pos) /*!< Bit mask of RESN field. */ +#define SAADC_CH_CONFIG_RESN_Bypass (0UL) /*!< Bypass resistor ladder */ +#define SAADC_CH_CONFIG_RESN_Pulldown (1UL) /*!< Pull-down to GND */ +#define SAADC_CH_CONFIG_RESN_Pullup (2UL) /*!< Pull-up to VDD */ +#define SAADC_CH_CONFIG_RESN_VDD1_2 (3UL) /*!< Set input at VDD/2 */ + +/* Bits 1..0 : Positive channel resistor control */ +#define SAADC_CH_CONFIG_RESP_Pos (0UL) /*!< Position of RESP field. */ +#define SAADC_CH_CONFIG_RESP_Msk (0x3UL << SAADC_CH_CONFIG_RESP_Pos) /*!< Bit mask of RESP field. */ +#define SAADC_CH_CONFIG_RESP_Bypass (0UL) /*!< Bypass resistor ladder */ +#define SAADC_CH_CONFIG_RESP_Pulldown (1UL) /*!< Pull-down to GND */ +#define SAADC_CH_CONFIG_RESP_Pullup (2UL) /*!< Pull-up to VDD */ +#define SAADC_CH_CONFIG_RESP_VDD1_2 (3UL) /*!< Set input at VDD/2 */ + +/* Register: SAADC_CH_LIMIT */ +/* Description: Description cluster[0]: High/low limits for event monitoring a channel */ + +/* Bits 31..16 : High level limit */ +#define SAADC_CH_LIMIT_HIGH_Pos (16UL) /*!< Position of HIGH field. */ +#define SAADC_CH_LIMIT_HIGH_Msk (0xFFFFUL << SAADC_CH_LIMIT_HIGH_Pos) /*!< Bit mask of HIGH field. */ + +/* Bits 15..0 : Low level limit */ +#define SAADC_CH_LIMIT_LOW_Pos (0UL) /*!< Position of LOW field. */ +#define SAADC_CH_LIMIT_LOW_Msk (0xFFFFUL << SAADC_CH_LIMIT_LOW_Pos) /*!< Bit mask of LOW field. */ + +/* Register: SAADC_RESOLUTION */ +/* Description: Resolution configuration */ + +/* Bits 2..0 : Set the resolution */ +#define SAADC_RESOLUTION_VAL_Pos (0UL) /*!< Position of VAL field. */ +#define SAADC_RESOLUTION_VAL_Msk (0x7UL << SAADC_RESOLUTION_VAL_Pos) /*!< Bit mask of VAL field. */ +#define SAADC_RESOLUTION_VAL_8bit (0UL) /*!< 8 bit */ +#define SAADC_RESOLUTION_VAL_10bit (1UL) /*!< 10 bit */ +#define SAADC_RESOLUTION_VAL_12bit (2UL) /*!< 12 bit */ +#define SAADC_RESOLUTION_VAL_14bit (3UL) /*!< 14 bit */ + +/* Register: SAADC_OVERSAMPLE */ +/* Description: Oversampling configuration. OVERSAMPLE should not be combined with SCAN. The RESOLUTION is applied before averaging, thus for high OVERSAMPLE a higher RESOLUTION should be used. */ + +/* Bits 3..0 : Oversample control */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Pos (0UL) /*!< Position of OVERSAMPLE field. */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Msk (0xFUL << SAADC_OVERSAMPLE_OVERSAMPLE_Pos) /*!< Bit mask of OVERSAMPLE field. */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Bypass (0UL) /*!< Bypass oversampling */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over2x (1UL) /*!< Oversample 2x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over4x (2UL) /*!< Oversample 4x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over8x (3UL) /*!< Oversample 8x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over16x (4UL) /*!< Oversample 16x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over32x (5UL) /*!< Oversample 32x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over64x (6UL) /*!< Oversample 64x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over128x (7UL) /*!< Oversample 128x */ +#define SAADC_OVERSAMPLE_OVERSAMPLE_Over256x (8UL) /*!< Oversample 256x */ + +/* Register: SAADC_SAMPLERATE */ +/* Description: Controls normal or continuous sample rate */ + +/* Bit 12 : Select mode for sample rate control */ +#define SAADC_SAMPLERATE_MODE_Pos (12UL) /*!< Position of MODE field. */ +#define SAADC_SAMPLERATE_MODE_Msk (0x1UL << SAADC_SAMPLERATE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define SAADC_SAMPLERATE_MODE_Task (0UL) /*!< Rate is controlled from SAMPLE task */ +#define SAADC_SAMPLERATE_MODE_Timers (1UL) /*!< Rate is controlled from local timer (use CC to control the rate) */ + +/* Bits 10..0 : Capture and compare value. Sample rate is 16 MHz/CC */ +#define SAADC_SAMPLERATE_CC_Pos (0UL) /*!< Position of CC field. */ +#define SAADC_SAMPLERATE_CC_Msk (0x7FFUL << SAADC_SAMPLERATE_CC_Pos) /*!< Bit mask of CC field. */ + +/* Register: SAADC_RESULT_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define SAADC_RESULT_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SAADC_RESULT_PTR_PTR_Msk (0xFFFFFFFFUL << SAADC_RESULT_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SAADC_RESULT_MAXCNT */ +/* Description: Maximum number of buffer words to transfer */ + +/* Bits 14..0 : Maximum number of buffer words to transfer */ +#define SAADC_RESULT_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SAADC_RESULT_MAXCNT_MAXCNT_Msk (0x7FFFUL << SAADC_RESULT_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SAADC_RESULT_AMOUNT */ +/* Description: Number of buffer words transferred since last START */ + +/* Bits 14..0 : Number of buffer words transferred since last START. This register can be read after an END or STOPPED event. */ +#define SAADC_RESULT_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SAADC_RESULT_AMOUNT_AMOUNT_Msk (0x7FFFUL << SAADC_RESULT_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + + +/* Peripheral: SPI */ +/* Description: Serial Peripheral Interface 0 */ + +/* Register: SPI_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 2 : Write '1' to Enable interrupt for READY event */ +#define SPI_INTENSET_READY_Pos (2UL) /*!< Position of READY field. */ +#define SPI_INTENSET_READY_Msk (0x1UL << SPI_INTENSET_READY_Pos) /*!< Bit mask of READY field. */ +#define SPI_INTENSET_READY_Disabled (0UL) /*!< Read: Disabled */ +#define SPI_INTENSET_READY_Enabled (1UL) /*!< Read: Enabled */ +#define SPI_INTENSET_READY_Set (1UL) /*!< Enable */ + +/* Register: SPI_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 2 : Write '1' to Disable interrupt for READY event */ +#define SPI_INTENCLR_READY_Pos (2UL) /*!< Position of READY field. */ +#define SPI_INTENCLR_READY_Msk (0x1UL << SPI_INTENCLR_READY_Pos) /*!< Bit mask of READY field. */ +#define SPI_INTENCLR_READY_Disabled (0UL) /*!< Read: Disabled */ +#define SPI_INTENCLR_READY_Enabled (1UL) /*!< Read: Enabled */ +#define SPI_INTENCLR_READY_Clear (1UL) /*!< Disable */ + +/* Register: SPI_ENABLE */ +/* Description: Enable SPI */ + +/* Bits 3..0 : Enable or disable SPI */ +#define SPI_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPI_ENABLE_ENABLE_Msk (0xFUL << SPI_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPI_ENABLE_ENABLE_Disabled (0UL) /*!< Disable SPI */ +#define SPI_ENABLE_ENABLE_Enabled (1UL) /*!< Enable SPI */ + +/* Register: SPI_PSEL_SCK */ +/* Description: Pin select for SCK */ + +/* Bit 31 : Connection */ +#define SPI_PSEL_SCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPI_PSEL_SCK_CONNECT_Msk (0x1UL << SPI_PSEL_SCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPI_PSEL_SCK_CONNECT_Connected (0UL) /*!< Connect */ +#define SPI_PSEL_SCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPI_PSEL_SCK_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPI_PSEL_SCK_PORT_Msk (0x3UL << SPI_PSEL_SCK_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPI_PSEL_SCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPI_PSEL_SCK_PIN_Msk (0x1FUL << SPI_PSEL_SCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPI_PSEL_MOSI */ +/* Description: Pin select for MOSI signal */ + +/* Bit 31 : Connection */ +#define SPI_PSEL_MOSI_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPI_PSEL_MOSI_CONNECT_Msk (0x1UL << SPI_PSEL_MOSI_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPI_PSEL_MOSI_CONNECT_Connected (0UL) /*!< Connect */ +#define SPI_PSEL_MOSI_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPI_PSEL_MOSI_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPI_PSEL_MOSI_PORT_Msk (0x3UL << SPI_PSEL_MOSI_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPI_PSEL_MOSI_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPI_PSEL_MOSI_PIN_Msk (0x1FUL << SPI_PSEL_MOSI_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPI_PSEL_MISO */ +/* Description: Pin select for MISO signal */ + +/* Bit 31 : Connection */ +#define SPI_PSEL_MISO_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPI_PSEL_MISO_CONNECT_Msk (0x1UL << SPI_PSEL_MISO_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPI_PSEL_MISO_CONNECT_Connected (0UL) /*!< Connect */ +#define SPI_PSEL_MISO_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPI_PSEL_MISO_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPI_PSEL_MISO_PORT_Msk (0x3UL << SPI_PSEL_MISO_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPI_PSEL_MISO_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPI_PSEL_MISO_PIN_Msk (0x1FUL << SPI_PSEL_MISO_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPI_RXD */ +/* Description: RXD register */ + +/* Bits 7..0 : RX data received. Double buffered */ +#define SPI_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define SPI_RXD_RXD_Msk (0xFFUL << SPI_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: SPI_TXD */ +/* Description: TXD register */ + +/* Bits 7..0 : TX data to send. Double buffered */ +#define SPI_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define SPI_TXD_TXD_Msk (0xFFUL << SPI_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: SPI_FREQUENCY */ +/* Description: SPI frequency. Accuracy depends on the HFCLK source selected. */ + +/* Bits 31..0 : SPI master data rate */ +#define SPI_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define SPI_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << SPI_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define SPI_FREQUENCY_FREQUENCY_K125 (0x02000000UL) /*!< 125 kbps */ +#define SPI_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps */ +#define SPI_FREQUENCY_FREQUENCY_K500 (0x08000000UL) /*!< 500 kbps */ +#define SPI_FREQUENCY_FREQUENCY_M1 (0x10000000UL) /*!< 1 Mbps */ +#define SPI_FREQUENCY_FREQUENCY_M2 (0x20000000UL) /*!< 2 Mbps */ +#define SPI_FREQUENCY_FREQUENCY_M4 (0x40000000UL) /*!< 4 Mbps */ +#define SPI_FREQUENCY_FREQUENCY_M8 (0x80000000UL) /*!< 8 Mbps */ + +/* Register: SPI_CONFIG */ +/* Description: Configuration register */ + +/* Bit 2 : Serial clock (SCK) polarity */ +#define SPI_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPI_CONFIG_CPOL_Msk (0x1UL << SPI_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPI_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high */ +#define SPI_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low */ + +/* Bit 1 : Serial clock (SCK) phase */ +#define SPI_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPI_CONFIG_CPHA_Msk (0x1UL << SPI_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPI_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of clock, shift serial data on trailing edge */ +#define SPI_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of clock, shift serial data on leading edge */ + +/* Bit 0 : Bit order */ +#define SPI_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPI_CONFIG_ORDER_Msk (0x1UL << SPI_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPI_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit shifted out first */ +#define SPI_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit shifted out first */ + + +/* Peripheral: SPIM */ +/* Description: Serial Peripheral Interface Master with EasyDMA 0 */ + +/* Register: SPIM_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 17 : Shortcut between END event and START task */ +#define SPIM_SHORTS_END_START_Pos (17UL) /*!< Position of END_START field. */ +#define SPIM_SHORTS_END_START_Msk (0x1UL << SPIM_SHORTS_END_START_Pos) /*!< Bit mask of END_START field. */ +#define SPIM_SHORTS_END_START_Disabled (0UL) /*!< Disable shortcut */ +#define SPIM_SHORTS_END_START_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: SPIM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 19 : Write '1' to Enable interrupt for STARTED event */ +#define SPIM_INTENSET_STARTED_Pos (19UL) /*!< Position of STARTED field. */ +#define SPIM_INTENSET_STARTED_Msk (0x1UL << SPIM_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SPIM_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for ENDTX event */ +#define SPIM_INTENSET_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define SPIM_INTENSET_ENDTX_Msk (0x1UL << SPIM_INTENSET_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define SPIM_INTENSET_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_ENDTX_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for END event */ +#define SPIM_INTENSET_END_Pos (6UL) /*!< Position of END field. */ +#define SPIM_INTENSET_END_Msk (0x1UL << SPIM_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define SPIM_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for ENDRX event */ +#define SPIM_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIM_INTENSET_ENDRX_Msk (0x1UL << SPIM_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIM_INTENSET_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_ENDRX_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define SPIM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define SPIM_INTENSET_STOPPED_Msk (0x1UL << SPIM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SPIM_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: SPIM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 19 : Write '1' to Disable interrupt for STARTED event */ +#define SPIM_INTENCLR_STARTED_Pos (19UL) /*!< Position of STARTED field. */ +#define SPIM_INTENCLR_STARTED_Msk (0x1UL << SPIM_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define SPIM_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for ENDTX event */ +#define SPIM_INTENCLR_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define SPIM_INTENCLR_ENDTX_Msk (0x1UL << SPIM_INTENCLR_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define SPIM_INTENCLR_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_ENDTX_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for END event */ +#define SPIM_INTENCLR_END_Pos (6UL) /*!< Position of END field. */ +#define SPIM_INTENCLR_END_Msk (0x1UL << SPIM_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define SPIM_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for ENDRX event */ +#define SPIM_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIM_INTENCLR_ENDRX_Msk (0x1UL << SPIM_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIM_INTENCLR_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define SPIM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define SPIM_INTENCLR_STOPPED_Msk (0x1UL << SPIM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define SPIM_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIM_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: SPIM_STALLSTAT */ +/* Description: Stall status for EasyDMA RAM accesses. The fields in this register is set to STALL by hardware whenever a stall occurres and can be cleared (set to NOSTALL) by the CPU. */ + +/* Bit 1 : Stall status for EasyDMA RAM writes */ +#define SPIM_STALLSTAT_RX_Pos (1UL) /*!< Position of RX field. */ +#define SPIM_STALLSTAT_RX_Msk (0x1UL << SPIM_STALLSTAT_RX_Pos) /*!< Bit mask of RX field. */ +#define SPIM_STALLSTAT_RX_NOSTALL (0UL) /*!< No stall */ +#define SPIM_STALLSTAT_RX_STALL (1UL) /*!< A stall has occurred */ + +/* Bit 0 : Stall status for EasyDMA RAM reads */ +#define SPIM_STALLSTAT_TX_Pos (0UL) /*!< Position of TX field. */ +#define SPIM_STALLSTAT_TX_Msk (0x1UL << SPIM_STALLSTAT_TX_Pos) /*!< Bit mask of TX field. */ +#define SPIM_STALLSTAT_TX_NOSTALL (0UL) /*!< No stall */ +#define SPIM_STALLSTAT_TX_STALL (1UL) /*!< A stall has occurred */ + +/* Register: SPIM_ENABLE */ +/* Description: Enable SPIM */ + +/* Bits 3..0 : Enable or disable SPIM */ +#define SPIM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPIM_ENABLE_ENABLE_Msk (0xFUL << SPIM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPIM_ENABLE_ENABLE_Disabled (0UL) /*!< Disable SPIM */ +#define SPIM_ENABLE_ENABLE_Enabled (7UL) /*!< Enable SPIM */ + +/* Register: SPIM_PSEL_SCK */ +/* Description: Pin select for SCK */ + +/* Bit 31 : Connection */ +#define SPIM_PSEL_SCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIM_PSEL_SCK_CONNECT_Msk (0x1UL << SPIM_PSEL_SCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIM_PSEL_SCK_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIM_PSEL_SCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPIM_PSEL_SCK_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPIM_PSEL_SCK_PORT_Msk (0x3UL << SPIM_PSEL_SCK_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPIM_PSEL_SCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIM_PSEL_SCK_PIN_Msk (0x1FUL << SPIM_PSEL_SCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIM_PSEL_MOSI */ +/* Description: Pin select for MOSI signal */ + +/* Bit 31 : Connection */ +#define SPIM_PSEL_MOSI_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIM_PSEL_MOSI_CONNECT_Msk (0x1UL << SPIM_PSEL_MOSI_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIM_PSEL_MOSI_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIM_PSEL_MOSI_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPIM_PSEL_MOSI_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPIM_PSEL_MOSI_PORT_Msk (0x3UL << SPIM_PSEL_MOSI_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPIM_PSEL_MOSI_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIM_PSEL_MOSI_PIN_Msk (0x1FUL << SPIM_PSEL_MOSI_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIM_PSEL_MISO */ +/* Description: Pin select for MISO signal */ + +/* Bit 31 : Connection */ +#define SPIM_PSEL_MISO_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIM_PSEL_MISO_CONNECT_Msk (0x1UL << SPIM_PSEL_MISO_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIM_PSEL_MISO_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIM_PSEL_MISO_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPIM_PSEL_MISO_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPIM_PSEL_MISO_PORT_Msk (0x3UL << SPIM_PSEL_MISO_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPIM_PSEL_MISO_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIM_PSEL_MISO_PIN_Msk (0x1FUL << SPIM_PSEL_MISO_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIM_PSEL_CSN */ +/* Description: Pin select for CSN */ + +/* Bit 31 : Connection */ +#define SPIM_PSEL_CSN_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIM_PSEL_CSN_CONNECT_Msk (0x1UL << SPIM_PSEL_CSN_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIM_PSEL_CSN_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIM_PSEL_CSN_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPIM_PSEL_CSN_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPIM_PSEL_CSN_PORT_Msk (0x3UL << SPIM_PSEL_CSN_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPIM_PSEL_CSN_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIM_PSEL_CSN_PIN_Msk (0x1FUL << SPIM_PSEL_CSN_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIM_FREQUENCY */ +/* Description: SPI frequency. Accuracy depends on the HFCLK source selected. */ + +/* Bits 31..0 : SPI master data rate */ +#define SPIM_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define SPIM_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << SPIM_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define SPIM_FREQUENCY_FREQUENCY_K125 (0x02000000UL) /*!< 125 kbps */ +#define SPIM_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps */ +#define SPIM_FREQUENCY_FREQUENCY_K500 (0x08000000UL) /*!< 500 kbps */ +#define SPIM_FREQUENCY_FREQUENCY_M16 (0x0A000000UL) /*!< 16 Mbps */ +#define SPIM_FREQUENCY_FREQUENCY_M1 (0x10000000UL) /*!< 1 Mbps */ +#define SPIM_FREQUENCY_FREQUENCY_M32 (0x14000000UL) /*!< 32 Mbps */ +#define SPIM_FREQUENCY_FREQUENCY_M2 (0x20000000UL) /*!< 2 Mbps */ +#define SPIM_FREQUENCY_FREQUENCY_M4 (0x40000000UL) /*!< 4 Mbps */ +#define SPIM_FREQUENCY_FREQUENCY_M8 (0x80000000UL) /*!< 8 Mbps */ + +/* Register: SPIM_RXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define SPIM_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIM_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIM_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIM_RXD_MAXCNT */ +/* Description: Maximum number of bytes in receive buffer */ + +/* Bits 15..0 : Maximum number of bytes in receive buffer */ +#define SPIM_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIM_RXD_MAXCNT_MAXCNT_Msk (0xFFFFUL << SPIM_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIM_RXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 15..0 : Number of bytes transferred in the last transaction */ +#define SPIM_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIM_RXD_AMOUNT_AMOUNT_Msk (0xFFFFUL << SPIM_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIM_RXD_LIST */ +/* Description: EasyDMA list type */ + +/* Bits 1..0 : List type */ +#define SPIM_RXD_LIST_LIST_Pos (0UL) /*!< Position of LIST field. */ +#define SPIM_RXD_LIST_LIST_Msk (0x3UL << SPIM_RXD_LIST_LIST_Pos) /*!< Bit mask of LIST field. */ +#define SPIM_RXD_LIST_LIST_Disabled (0UL) /*!< Disable EasyDMA list */ +#define SPIM_RXD_LIST_LIST_ArrayList (1UL) /*!< Use array list */ + +/* Register: SPIM_TXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define SPIM_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIM_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIM_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIM_TXD_MAXCNT */ +/* Description: Number of bytes in transmit buffer */ + +/* Bits 15..0 : Maximum number of bytes in transmit buffer */ +#define SPIM_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIM_TXD_MAXCNT_MAXCNT_Msk (0xFFFFUL << SPIM_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIM_TXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 15..0 : Number of bytes transferred in the last transaction */ +#define SPIM_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIM_TXD_AMOUNT_AMOUNT_Msk (0xFFFFUL << SPIM_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIM_TXD_LIST */ +/* Description: EasyDMA list type */ + +/* Bits 1..0 : List type */ +#define SPIM_TXD_LIST_LIST_Pos (0UL) /*!< Position of LIST field. */ +#define SPIM_TXD_LIST_LIST_Msk (0x3UL << SPIM_TXD_LIST_LIST_Pos) /*!< Bit mask of LIST field. */ +#define SPIM_TXD_LIST_LIST_Disabled (0UL) /*!< Disable EasyDMA list */ +#define SPIM_TXD_LIST_LIST_ArrayList (1UL) /*!< Use array list */ + +/* Register: SPIM_CONFIG */ +/* Description: Configuration register */ + +/* Bit 2 : Serial clock (SCK) polarity */ +#define SPIM_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPIM_CONFIG_CPOL_Msk (0x1UL << SPIM_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPIM_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high */ +#define SPIM_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low */ + +/* Bit 1 : Serial clock (SCK) phase */ +#define SPIM_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPIM_CONFIG_CPHA_Msk (0x1UL << SPIM_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPIM_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of clock, shift serial data on trailing edge */ +#define SPIM_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of clock, shift serial data on leading edge */ + +/* Bit 0 : Bit order */ +#define SPIM_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPIM_CONFIG_ORDER_Msk (0x1UL << SPIM_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPIM_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit shifted out first */ +#define SPIM_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit shifted out first */ + +/* Register: SPIM_IFTIMING_RXDELAY */ +/* Description: Sample delay for input serial data on MISO */ + +/* Bits 2..0 : Sample delay for input serial data on MISO. The value specifies the number of 64 MHz clock cycles (15.625 ns) delay from the the sampling edge of SCK (leading edge for CONFIG.CPHA = 0, trailing edge for CONFIG.CPHA = 1) until the input serial data is sampled. As en example, if RXDELAY = 0 and CONFIG.CPHA = 0, the input serial data is sampled on the rising edge of SCK. */ +#define SPIM_IFTIMING_RXDELAY_RXDELAY_Pos (0UL) /*!< Position of RXDELAY field. */ +#define SPIM_IFTIMING_RXDELAY_RXDELAY_Msk (0x7UL << SPIM_IFTIMING_RXDELAY_RXDELAY_Pos) /*!< Bit mask of RXDELAY field. */ + +/* Register: SPIM_IFTIMING_CSNDUR */ +/* Description: Minimum duration between edge of CSN and edge of SCK and minimum duration CSN must stay high between transactions */ + +/* Bits 7..0 : Minimum duration between edge of CSN and edge of SCK and minimum duration CSN must stay high between transactions. The value is specified in number of 64 MHz clock cycles (15.625 ns). */ +#define SPIM_IFTIMING_CSNDUR_CSNDUR_Pos (0UL) /*!< Position of CSNDUR field. */ +#define SPIM_IFTIMING_CSNDUR_CSNDUR_Msk (0xFFUL << SPIM_IFTIMING_CSNDUR_CSNDUR_Pos) /*!< Bit mask of CSNDUR field. */ + +/* Register: SPIM_ORC */ +/* Description: Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT */ + +/* Bits 7..0 : Byte transmitted after TXD.MAXCNT bytes have been transmitted in the case when RXD.MAXCNT is greater than TXD.MAXCNT. */ +#define SPIM_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ +#define SPIM_ORC_ORC_Msk (0xFFUL << SPIM_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ + + +/* Peripheral: SPIS */ +/* Description: SPI Slave 0 */ + +/* Register: SPIS_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 2 : Shortcut between END event and ACQUIRE task */ +#define SPIS_SHORTS_END_ACQUIRE_Pos (2UL) /*!< Position of END_ACQUIRE field. */ +#define SPIS_SHORTS_END_ACQUIRE_Msk (0x1UL << SPIS_SHORTS_END_ACQUIRE_Pos) /*!< Bit mask of END_ACQUIRE field. */ +#define SPIS_SHORTS_END_ACQUIRE_Disabled (0UL) /*!< Disable shortcut */ +#define SPIS_SHORTS_END_ACQUIRE_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: SPIS_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 10 : Write '1' to Enable interrupt for ACQUIRED event */ +#define SPIS_INTENSET_ACQUIRED_Pos (10UL) /*!< Position of ACQUIRED field. */ +#define SPIS_INTENSET_ACQUIRED_Msk (0x1UL << SPIS_INTENSET_ACQUIRED_Pos) /*!< Bit mask of ACQUIRED field. */ +#define SPIS_INTENSET_ACQUIRED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENSET_ACQUIRED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENSET_ACQUIRED_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for ENDRX event */ +#define SPIS_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIS_INTENSET_ENDRX_Msk (0x1UL << SPIS_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIS_INTENSET_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENSET_ENDRX_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for END event */ +#define SPIS_INTENSET_END_Pos (1UL) /*!< Position of END field. */ +#define SPIS_INTENSET_END_Msk (0x1UL << SPIS_INTENSET_END_Pos) /*!< Bit mask of END field. */ +#define SPIS_INTENSET_END_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENSET_END_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENSET_END_Set (1UL) /*!< Enable */ + +/* Register: SPIS_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 10 : Write '1' to Disable interrupt for ACQUIRED event */ +#define SPIS_INTENCLR_ACQUIRED_Pos (10UL) /*!< Position of ACQUIRED field. */ +#define SPIS_INTENCLR_ACQUIRED_Msk (0x1UL << SPIS_INTENCLR_ACQUIRED_Pos) /*!< Bit mask of ACQUIRED field. */ +#define SPIS_INTENCLR_ACQUIRED_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENCLR_ACQUIRED_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENCLR_ACQUIRED_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for ENDRX event */ +#define SPIS_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define SPIS_INTENCLR_ENDRX_Msk (0x1UL << SPIS_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define SPIS_INTENCLR_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for END event */ +#define SPIS_INTENCLR_END_Pos (1UL) /*!< Position of END field. */ +#define SPIS_INTENCLR_END_Msk (0x1UL << SPIS_INTENCLR_END_Pos) /*!< Bit mask of END field. */ +#define SPIS_INTENCLR_END_Disabled (0UL) /*!< Read: Disabled */ +#define SPIS_INTENCLR_END_Enabled (1UL) /*!< Read: Enabled */ +#define SPIS_INTENCLR_END_Clear (1UL) /*!< Disable */ + +/* Register: SPIS_SEMSTAT */ +/* Description: Semaphore status register */ + +/* Bits 1..0 : Semaphore status */ +#define SPIS_SEMSTAT_SEMSTAT_Pos (0UL) /*!< Position of SEMSTAT field. */ +#define SPIS_SEMSTAT_SEMSTAT_Msk (0x3UL << SPIS_SEMSTAT_SEMSTAT_Pos) /*!< Bit mask of SEMSTAT field. */ +#define SPIS_SEMSTAT_SEMSTAT_Free (0UL) /*!< Semaphore is free */ +#define SPIS_SEMSTAT_SEMSTAT_CPU (1UL) /*!< Semaphore is assigned to CPU */ +#define SPIS_SEMSTAT_SEMSTAT_SPIS (2UL) /*!< Semaphore is assigned to SPI slave */ +#define SPIS_SEMSTAT_SEMSTAT_CPUPending (3UL) /*!< Semaphore is assigned to SPI but a handover to the CPU is pending */ + +/* Register: SPIS_STATUS */ +/* Description: Status from last transaction */ + +/* Bit 1 : RX buffer overflow detected, and prevented */ +#define SPIS_STATUS_OVERFLOW_Pos (1UL) /*!< Position of OVERFLOW field. */ +#define SPIS_STATUS_OVERFLOW_Msk (0x1UL << SPIS_STATUS_OVERFLOW_Pos) /*!< Bit mask of OVERFLOW field. */ +#define SPIS_STATUS_OVERFLOW_NotPresent (0UL) /*!< Read: error not present */ +#define SPIS_STATUS_OVERFLOW_Present (1UL) /*!< Read: error present */ +#define SPIS_STATUS_OVERFLOW_Clear (1UL) /*!< Write: clear error on writing '1' */ + +/* Bit 0 : TX buffer over-read detected, and prevented */ +#define SPIS_STATUS_OVERREAD_Pos (0UL) /*!< Position of OVERREAD field. */ +#define SPIS_STATUS_OVERREAD_Msk (0x1UL << SPIS_STATUS_OVERREAD_Pos) /*!< Bit mask of OVERREAD field. */ +#define SPIS_STATUS_OVERREAD_NotPresent (0UL) /*!< Read: error not present */ +#define SPIS_STATUS_OVERREAD_Present (1UL) /*!< Read: error present */ +#define SPIS_STATUS_OVERREAD_Clear (1UL) /*!< Write: clear error on writing '1' */ + +/* Register: SPIS_ENABLE */ +/* Description: Enable SPI slave */ + +/* Bits 3..0 : Enable or disable SPI slave */ +#define SPIS_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define SPIS_ENABLE_ENABLE_Msk (0xFUL << SPIS_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define SPIS_ENABLE_ENABLE_Disabled (0UL) /*!< Disable SPI slave */ +#define SPIS_ENABLE_ENABLE_Enabled (2UL) /*!< Enable SPI slave */ + +/* Register: SPIS_PSEL_SCK */ +/* Description: Pin select for SCK */ + +/* Bit 31 : Connection */ +#define SPIS_PSEL_SCK_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIS_PSEL_SCK_CONNECT_Msk (0x1UL << SPIS_PSEL_SCK_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIS_PSEL_SCK_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIS_PSEL_SCK_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPIS_PSEL_SCK_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPIS_PSEL_SCK_PORT_Msk (0x3UL << SPIS_PSEL_SCK_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPIS_PSEL_SCK_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIS_PSEL_SCK_PIN_Msk (0x1FUL << SPIS_PSEL_SCK_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIS_PSEL_MISO */ +/* Description: Pin select for MISO signal */ + +/* Bit 31 : Connection */ +#define SPIS_PSEL_MISO_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIS_PSEL_MISO_CONNECT_Msk (0x1UL << SPIS_PSEL_MISO_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIS_PSEL_MISO_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIS_PSEL_MISO_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPIS_PSEL_MISO_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPIS_PSEL_MISO_PORT_Msk (0x3UL << SPIS_PSEL_MISO_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPIS_PSEL_MISO_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIS_PSEL_MISO_PIN_Msk (0x1FUL << SPIS_PSEL_MISO_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIS_PSEL_MOSI */ +/* Description: Pin select for MOSI signal */ + +/* Bit 31 : Connection */ +#define SPIS_PSEL_MOSI_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIS_PSEL_MOSI_CONNECT_Msk (0x1UL << SPIS_PSEL_MOSI_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIS_PSEL_MOSI_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIS_PSEL_MOSI_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPIS_PSEL_MOSI_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPIS_PSEL_MOSI_PORT_Msk (0x3UL << SPIS_PSEL_MOSI_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPIS_PSEL_MOSI_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIS_PSEL_MOSI_PIN_Msk (0x1FUL << SPIS_PSEL_MOSI_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIS_PSEL_CSN */ +/* Description: Pin select for CSN signal */ + +/* Bit 31 : Connection */ +#define SPIS_PSEL_CSN_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define SPIS_PSEL_CSN_CONNECT_Msk (0x1UL << SPIS_PSEL_CSN_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define SPIS_PSEL_CSN_CONNECT_Connected (0UL) /*!< Connect */ +#define SPIS_PSEL_CSN_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define SPIS_PSEL_CSN_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define SPIS_PSEL_CSN_PORT_Msk (0x3UL << SPIS_PSEL_CSN_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define SPIS_PSEL_CSN_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define SPIS_PSEL_CSN_PIN_Msk (0x1FUL << SPIS_PSEL_CSN_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: SPIS_RXD_PTR */ +/* Description: RXD data pointer */ + +/* Bits 31..0 : RXD data pointer */ +#define SPIS_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIS_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIS_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIS_RXD_MAXCNT */ +/* Description: Maximum number of bytes in receive buffer */ + +/* Bits 7..0 : Maximum number of bytes in receive buffer */ +#define SPIS_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIS_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIS_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIS_RXD_AMOUNT */ +/* Description: Number of bytes received in last granted transaction */ + +/* Bits 7..0 : Number of bytes received in the last granted transaction */ +#define SPIS_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIS_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIS_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIS_TXD_PTR */ +/* Description: TXD data pointer */ + +/* Bits 31..0 : TXD data pointer */ +#define SPIS_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define SPIS_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << SPIS_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: SPIS_TXD_MAXCNT */ +/* Description: Maximum number of bytes in transmit buffer */ + +/* Bits 7..0 : Maximum number of bytes in transmit buffer */ +#define SPIS_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define SPIS_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << SPIS_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SPIS_TXD_AMOUNT */ +/* Description: Number of bytes transmitted in last granted transaction */ + +/* Bits 7..0 : Number of bytes transmitted in last granted transaction */ +#define SPIS_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define SPIS_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << SPIS_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: SPIS_CONFIG */ +/* Description: Configuration register */ + +/* Bit 2 : Serial clock (SCK) polarity */ +#define SPIS_CONFIG_CPOL_Pos (2UL) /*!< Position of CPOL field. */ +#define SPIS_CONFIG_CPOL_Msk (0x1UL << SPIS_CONFIG_CPOL_Pos) /*!< Bit mask of CPOL field. */ +#define SPIS_CONFIG_CPOL_ActiveHigh (0UL) /*!< Active high */ +#define SPIS_CONFIG_CPOL_ActiveLow (1UL) /*!< Active low */ + +/* Bit 1 : Serial clock (SCK) phase */ +#define SPIS_CONFIG_CPHA_Pos (1UL) /*!< Position of CPHA field. */ +#define SPIS_CONFIG_CPHA_Msk (0x1UL << SPIS_CONFIG_CPHA_Pos) /*!< Bit mask of CPHA field. */ +#define SPIS_CONFIG_CPHA_Leading (0UL) /*!< Sample on leading edge of clock, shift serial data on trailing edge */ +#define SPIS_CONFIG_CPHA_Trailing (1UL) /*!< Sample on trailing edge of clock, shift serial data on leading edge */ + +/* Bit 0 : Bit order */ +#define SPIS_CONFIG_ORDER_Pos (0UL) /*!< Position of ORDER field. */ +#define SPIS_CONFIG_ORDER_Msk (0x1UL << SPIS_CONFIG_ORDER_Pos) /*!< Bit mask of ORDER field. */ +#define SPIS_CONFIG_ORDER_MsbFirst (0UL) /*!< Most significant bit shifted out first */ +#define SPIS_CONFIG_ORDER_LsbFirst (1UL) /*!< Least significant bit shifted out first */ + +/* Register: SPIS_DEF */ +/* Description: Default character. Character clocked out in case of an ignored transaction. */ + +/* Bits 7..0 : Default character. Character clocked out in case of an ignored transaction. */ +#define SPIS_DEF_DEF_Pos (0UL) /*!< Position of DEF field. */ +#define SPIS_DEF_DEF_Msk (0xFFUL << SPIS_DEF_DEF_Pos) /*!< Bit mask of DEF field. */ + +/* Register: SPIS_ORC */ +/* Description: Over-read character */ + +/* Bits 7..0 : Over-read character. Character clocked out after an over-read of the transmit buffer. */ +#define SPIS_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ +#define SPIS_ORC_ORC_Msk (0xFFUL << SPIS_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ + + +/* Peripheral: TEMP */ +/* Description: Temperature Sensor */ + +/* Register: TEMP_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 0 : Write '1' to Enable interrupt for DATARDY event */ +#define TEMP_INTENSET_DATARDY_Pos (0UL) /*!< Position of DATARDY field. */ +#define TEMP_INTENSET_DATARDY_Msk (0x1UL << TEMP_INTENSET_DATARDY_Pos) /*!< Bit mask of DATARDY field. */ +#define TEMP_INTENSET_DATARDY_Disabled (0UL) /*!< Read: Disabled */ +#define TEMP_INTENSET_DATARDY_Enabled (1UL) /*!< Read: Enabled */ +#define TEMP_INTENSET_DATARDY_Set (1UL) /*!< Enable */ + +/* Register: TEMP_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 0 : Write '1' to Disable interrupt for DATARDY event */ +#define TEMP_INTENCLR_DATARDY_Pos (0UL) /*!< Position of DATARDY field. */ +#define TEMP_INTENCLR_DATARDY_Msk (0x1UL << TEMP_INTENCLR_DATARDY_Pos) /*!< Bit mask of DATARDY field. */ +#define TEMP_INTENCLR_DATARDY_Disabled (0UL) /*!< Read: Disabled */ +#define TEMP_INTENCLR_DATARDY_Enabled (1UL) /*!< Read: Enabled */ +#define TEMP_INTENCLR_DATARDY_Clear (1UL) /*!< Disable */ + +/* Register: TEMP_TEMP */ +/* Description: Temperature in degC (0.25deg steps) */ + +/* Bits 31..0 : Temperature in degC (0.25deg steps) */ +#define TEMP_TEMP_TEMP_Pos (0UL) /*!< Position of TEMP field. */ +#define TEMP_TEMP_TEMP_Msk (0xFFFFFFFFUL << TEMP_TEMP_TEMP_Pos) /*!< Bit mask of TEMP field. */ + +/* Register: TEMP_A0 */ +/* Description: Slope of 1st piece wise linear function */ + +/* Bits 11..0 : Slope of 1st piece wise linear function */ +#define TEMP_A0_A0_Pos (0UL) /*!< Position of A0 field. */ +#define TEMP_A0_A0_Msk (0xFFFUL << TEMP_A0_A0_Pos) /*!< Bit mask of A0 field. */ + +/* Register: TEMP_A1 */ +/* Description: Slope of 2nd piece wise linear function */ + +/* Bits 11..0 : Slope of 2nd piece wise linear function */ +#define TEMP_A1_A1_Pos (0UL) /*!< Position of A1 field. */ +#define TEMP_A1_A1_Msk (0xFFFUL << TEMP_A1_A1_Pos) /*!< Bit mask of A1 field. */ + +/* Register: TEMP_A2 */ +/* Description: Slope of 3rd piece wise linear function */ + +/* Bits 11..0 : Slope of 3rd piece wise linear function */ +#define TEMP_A2_A2_Pos (0UL) /*!< Position of A2 field. */ +#define TEMP_A2_A2_Msk (0xFFFUL << TEMP_A2_A2_Pos) /*!< Bit mask of A2 field. */ + +/* Register: TEMP_A3 */ +/* Description: Slope of 4th piece wise linear function */ + +/* Bits 11..0 : Slope of 4th piece wise linear function */ +#define TEMP_A3_A3_Pos (0UL) /*!< Position of A3 field. */ +#define TEMP_A3_A3_Msk (0xFFFUL << TEMP_A3_A3_Pos) /*!< Bit mask of A3 field. */ + +/* Register: TEMP_A4 */ +/* Description: Slope of 5th piece wise linear function */ + +/* Bits 11..0 : Slope of 5th piece wise linear function */ +#define TEMP_A4_A4_Pos (0UL) /*!< Position of A4 field. */ +#define TEMP_A4_A4_Msk (0xFFFUL << TEMP_A4_A4_Pos) /*!< Bit mask of A4 field. */ + +/* Register: TEMP_A5 */ +/* Description: Slope of 6th piece wise linear function */ + +/* Bits 11..0 : Slope of 6th piece wise linear function */ +#define TEMP_A5_A5_Pos (0UL) /*!< Position of A5 field. */ +#define TEMP_A5_A5_Msk (0xFFFUL << TEMP_A5_A5_Pos) /*!< Bit mask of A5 field. */ + +/* Register: TEMP_B0 */ +/* Description: y-intercept of 1st piece wise linear function */ + +/* Bits 13..0 : y-intercept of 1st piece wise linear function */ +#define TEMP_B0_B0_Pos (0UL) /*!< Position of B0 field. */ +#define TEMP_B0_B0_Msk (0x3FFFUL << TEMP_B0_B0_Pos) /*!< Bit mask of B0 field. */ + +/* Register: TEMP_B1 */ +/* Description: y-intercept of 2nd piece wise linear function */ + +/* Bits 13..0 : y-intercept of 2nd piece wise linear function */ +#define TEMP_B1_B1_Pos (0UL) /*!< Position of B1 field. */ +#define TEMP_B1_B1_Msk (0x3FFFUL << TEMP_B1_B1_Pos) /*!< Bit mask of B1 field. */ + +/* Register: TEMP_B2 */ +/* Description: y-intercept of 3rd piece wise linear function */ + +/* Bits 13..0 : y-intercept of 3rd piece wise linear function */ +#define TEMP_B2_B2_Pos (0UL) /*!< Position of B2 field. */ +#define TEMP_B2_B2_Msk (0x3FFFUL << TEMP_B2_B2_Pos) /*!< Bit mask of B2 field. */ + +/* Register: TEMP_B3 */ +/* Description: y-intercept of 4th piece wise linear function */ + +/* Bits 13..0 : y-intercept of 4th piece wise linear function */ +#define TEMP_B3_B3_Pos (0UL) /*!< Position of B3 field. */ +#define TEMP_B3_B3_Msk (0x3FFFUL << TEMP_B3_B3_Pos) /*!< Bit mask of B3 field. */ + +/* Register: TEMP_B4 */ +/* Description: y-intercept of 5th piece wise linear function */ + +/* Bits 13..0 : y-intercept of 5th piece wise linear function */ +#define TEMP_B4_B4_Pos (0UL) /*!< Position of B4 field. */ +#define TEMP_B4_B4_Msk (0x3FFFUL << TEMP_B4_B4_Pos) /*!< Bit mask of B4 field. */ + +/* Register: TEMP_B5 */ +/* Description: y-intercept of 6th piece wise linear function */ + +/* Bits 13..0 : y-intercept of 6th piece wise linear function */ +#define TEMP_B5_B5_Pos (0UL) /*!< Position of B5 field. */ +#define TEMP_B5_B5_Msk (0x3FFFUL << TEMP_B5_B5_Pos) /*!< Bit mask of B5 field. */ + +/* Register: TEMP_T0 */ +/* Description: End point of 1st piece wise linear function */ + +/* Bits 7..0 : End point of 1st piece wise linear function */ +#define TEMP_T0_T0_Pos (0UL) /*!< Position of T0 field. */ +#define TEMP_T0_T0_Msk (0xFFUL << TEMP_T0_T0_Pos) /*!< Bit mask of T0 field. */ + +/* Register: TEMP_T1 */ +/* Description: End point of 2nd piece wise linear function */ + +/* Bits 7..0 : End point of 2nd piece wise linear function */ +#define TEMP_T1_T1_Pos (0UL) /*!< Position of T1 field. */ +#define TEMP_T1_T1_Msk (0xFFUL << TEMP_T1_T1_Pos) /*!< Bit mask of T1 field. */ + +/* Register: TEMP_T2 */ +/* Description: End point of 3rd piece wise linear function */ + +/* Bits 7..0 : End point of 3rd piece wise linear function */ +#define TEMP_T2_T2_Pos (0UL) /*!< Position of T2 field. */ +#define TEMP_T2_T2_Msk (0xFFUL << TEMP_T2_T2_Pos) /*!< Bit mask of T2 field. */ + +/* Register: TEMP_T3 */ +/* Description: End point of 4th piece wise linear function */ + +/* Bits 7..0 : End point of 4th piece wise linear function */ +#define TEMP_T3_T3_Pos (0UL) /*!< Position of T3 field. */ +#define TEMP_T3_T3_Msk (0xFFUL << TEMP_T3_T3_Pos) /*!< Bit mask of T3 field. */ + +/* Register: TEMP_T4 */ +/* Description: End point of 5th piece wise linear function */ + +/* Bits 7..0 : End point of 5th piece wise linear function */ +#define TEMP_T4_T4_Pos (0UL) /*!< Position of T4 field. */ +#define TEMP_T4_T4_Msk (0xFFUL << TEMP_T4_T4_Pos) /*!< Bit mask of T4 field. */ + + +/* Peripheral: TIMER */ +/* Description: Timer/Counter 0 */ + +/* Register: TIMER_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 13 : Shortcut between COMPARE[5] event and STOP task */ +#define TIMER_SHORTS_COMPARE5_STOP_Pos (13UL) /*!< Position of COMPARE5_STOP field. */ +#define TIMER_SHORTS_COMPARE5_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE5_STOP_Pos) /*!< Bit mask of COMPARE5_STOP field. */ +#define TIMER_SHORTS_COMPARE5_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE5_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 12 : Shortcut between COMPARE[4] event and STOP task */ +#define TIMER_SHORTS_COMPARE4_STOP_Pos (12UL) /*!< Position of COMPARE4_STOP field. */ +#define TIMER_SHORTS_COMPARE4_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE4_STOP_Pos) /*!< Bit mask of COMPARE4_STOP field. */ +#define TIMER_SHORTS_COMPARE4_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE4_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 11 : Shortcut between COMPARE[3] event and STOP task */ +#define TIMER_SHORTS_COMPARE3_STOP_Pos (11UL) /*!< Position of COMPARE3_STOP field. */ +#define TIMER_SHORTS_COMPARE3_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE3_STOP_Pos) /*!< Bit mask of COMPARE3_STOP field. */ +#define TIMER_SHORTS_COMPARE3_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE3_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 10 : Shortcut between COMPARE[2] event and STOP task */ +#define TIMER_SHORTS_COMPARE2_STOP_Pos (10UL) /*!< Position of COMPARE2_STOP field. */ +#define TIMER_SHORTS_COMPARE2_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE2_STOP_Pos) /*!< Bit mask of COMPARE2_STOP field. */ +#define TIMER_SHORTS_COMPARE2_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE2_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 9 : Shortcut between COMPARE[1] event and STOP task */ +#define TIMER_SHORTS_COMPARE1_STOP_Pos (9UL) /*!< Position of COMPARE1_STOP field. */ +#define TIMER_SHORTS_COMPARE1_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE1_STOP_Pos) /*!< Bit mask of COMPARE1_STOP field. */ +#define TIMER_SHORTS_COMPARE1_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE1_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 8 : Shortcut between COMPARE[0] event and STOP task */ +#define TIMER_SHORTS_COMPARE0_STOP_Pos (8UL) /*!< Position of COMPARE0_STOP field. */ +#define TIMER_SHORTS_COMPARE0_STOP_Msk (0x1UL << TIMER_SHORTS_COMPARE0_STOP_Pos) /*!< Bit mask of COMPARE0_STOP field. */ +#define TIMER_SHORTS_COMPARE0_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE0_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 5 : Shortcut between COMPARE[5] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE5_CLEAR_Pos (5UL) /*!< Position of COMPARE5_CLEAR field. */ +#define TIMER_SHORTS_COMPARE5_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE5_CLEAR_Pos) /*!< Bit mask of COMPARE5_CLEAR field. */ +#define TIMER_SHORTS_COMPARE5_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE5_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 4 : Shortcut between COMPARE[4] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE4_CLEAR_Pos (4UL) /*!< Position of COMPARE4_CLEAR field. */ +#define TIMER_SHORTS_COMPARE4_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE4_CLEAR_Pos) /*!< Bit mask of COMPARE4_CLEAR field. */ +#define TIMER_SHORTS_COMPARE4_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE4_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between COMPARE[3] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Pos (3UL) /*!< Position of COMPARE3_CLEAR field. */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE3_CLEAR_Pos) /*!< Bit mask of COMPARE3_CLEAR field. */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE3_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between COMPARE[2] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Pos (2UL) /*!< Position of COMPARE2_CLEAR field. */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE2_CLEAR_Pos) /*!< Bit mask of COMPARE2_CLEAR field. */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE2_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between COMPARE[1] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Pos (1UL) /*!< Position of COMPARE1_CLEAR field. */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE1_CLEAR_Pos) /*!< Bit mask of COMPARE1_CLEAR field. */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE1_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between COMPARE[0] event and CLEAR task */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Pos (0UL) /*!< Position of COMPARE0_CLEAR field. */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Msk (0x1UL << TIMER_SHORTS_COMPARE0_CLEAR_Pos) /*!< Bit mask of COMPARE0_CLEAR field. */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Disabled (0UL) /*!< Disable shortcut */ +#define TIMER_SHORTS_COMPARE0_CLEAR_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: TIMER_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 21 : Write '1' to Enable interrupt for COMPARE[5] event */ +#define TIMER_INTENSET_COMPARE5_Pos (21UL) /*!< Position of COMPARE5 field. */ +#define TIMER_INTENSET_COMPARE5_Msk (0x1UL << TIMER_INTENSET_COMPARE5_Pos) /*!< Bit mask of COMPARE5 field. */ +#define TIMER_INTENSET_COMPARE5_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE5_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE5_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for COMPARE[4] event */ +#define TIMER_INTENSET_COMPARE4_Pos (20UL) /*!< Position of COMPARE4 field. */ +#define TIMER_INTENSET_COMPARE4_Msk (0x1UL << TIMER_INTENSET_COMPARE4_Pos) /*!< Bit mask of COMPARE4 field. */ +#define TIMER_INTENSET_COMPARE4_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE4_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE4_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for COMPARE[3] event */ +#define TIMER_INTENSET_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define TIMER_INTENSET_COMPARE3_Msk (0x1UL << TIMER_INTENSET_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define TIMER_INTENSET_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE3_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for COMPARE[2] event */ +#define TIMER_INTENSET_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define TIMER_INTENSET_COMPARE2_Msk (0x1UL << TIMER_INTENSET_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define TIMER_INTENSET_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE2_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for COMPARE[1] event */ +#define TIMER_INTENSET_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define TIMER_INTENSET_COMPARE1_Msk (0x1UL << TIMER_INTENSET_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define TIMER_INTENSET_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE1_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable interrupt for COMPARE[0] event */ +#define TIMER_INTENSET_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define TIMER_INTENSET_COMPARE0_Msk (0x1UL << TIMER_INTENSET_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define TIMER_INTENSET_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENSET_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENSET_COMPARE0_Set (1UL) /*!< Enable */ + +/* Register: TIMER_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 21 : Write '1' to Disable interrupt for COMPARE[5] event */ +#define TIMER_INTENCLR_COMPARE5_Pos (21UL) /*!< Position of COMPARE5 field. */ +#define TIMER_INTENCLR_COMPARE5_Msk (0x1UL << TIMER_INTENCLR_COMPARE5_Pos) /*!< Bit mask of COMPARE5 field. */ +#define TIMER_INTENCLR_COMPARE5_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE5_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE5_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for COMPARE[4] event */ +#define TIMER_INTENCLR_COMPARE4_Pos (20UL) /*!< Position of COMPARE4 field. */ +#define TIMER_INTENCLR_COMPARE4_Msk (0x1UL << TIMER_INTENCLR_COMPARE4_Pos) /*!< Bit mask of COMPARE4 field. */ +#define TIMER_INTENCLR_COMPARE4_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE4_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE4_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for COMPARE[3] event */ +#define TIMER_INTENCLR_COMPARE3_Pos (19UL) /*!< Position of COMPARE3 field. */ +#define TIMER_INTENCLR_COMPARE3_Msk (0x1UL << TIMER_INTENCLR_COMPARE3_Pos) /*!< Bit mask of COMPARE3 field. */ +#define TIMER_INTENCLR_COMPARE3_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE3_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE3_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for COMPARE[2] event */ +#define TIMER_INTENCLR_COMPARE2_Pos (18UL) /*!< Position of COMPARE2 field. */ +#define TIMER_INTENCLR_COMPARE2_Msk (0x1UL << TIMER_INTENCLR_COMPARE2_Pos) /*!< Bit mask of COMPARE2 field. */ +#define TIMER_INTENCLR_COMPARE2_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE2_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE2_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for COMPARE[1] event */ +#define TIMER_INTENCLR_COMPARE1_Pos (17UL) /*!< Position of COMPARE1 field. */ +#define TIMER_INTENCLR_COMPARE1_Msk (0x1UL << TIMER_INTENCLR_COMPARE1_Pos) /*!< Bit mask of COMPARE1 field. */ +#define TIMER_INTENCLR_COMPARE1_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE1_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE1_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable interrupt for COMPARE[0] event */ +#define TIMER_INTENCLR_COMPARE0_Pos (16UL) /*!< Position of COMPARE0 field. */ +#define TIMER_INTENCLR_COMPARE0_Msk (0x1UL << TIMER_INTENCLR_COMPARE0_Pos) /*!< Bit mask of COMPARE0 field. */ +#define TIMER_INTENCLR_COMPARE0_Disabled (0UL) /*!< Read: Disabled */ +#define TIMER_INTENCLR_COMPARE0_Enabled (1UL) /*!< Read: Enabled */ +#define TIMER_INTENCLR_COMPARE0_Clear (1UL) /*!< Disable */ + +/* Register: TIMER_STATUS */ +/* Description: Timer status */ + +/* Bit 0 : Timer status */ +#define TIMER_STATUS_STATUS_Pos (0UL) /*!< Position of STATUS field. */ +#define TIMER_STATUS_STATUS_Msk (0x1UL << TIMER_STATUS_STATUS_Pos) /*!< Bit mask of STATUS field. */ +#define TIMER_STATUS_STATUS_Stopped (0UL) /*!< Timer is stopped */ +#define TIMER_STATUS_STATUS_Started (1UL) /*!< Timer is started */ + +/* Register: TIMER_MODE */ +/* Description: Timer mode selection */ + +/* Bits 1..0 : Timer mode */ +#define TIMER_MODE_MODE_Pos (0UL) /*!< Position of MODE field. */ +#define TIMER_MODE_MODE_Msk (0x3UL << TIMER_MODE_MODE_Pos) /*!< Bit mask of MODE field. */ +#define TIMER_MODE_MODE_Timer (0UL) /*!< Select Timer mode */ +#define TIMER_MODE_MODE_Counter (1UL) /*!< Deprecated enumerator - Select Counter mode */ +#define TIMER_MODE_MODE_LowPowerCounter (2UL) /*!< Select Low Power Counter mode */ + +/* Register: TIMER_BITMODE */ +/* Description: Configure the number of bits used by the TIMER */ + +/* Bits 1..0 : Timer bit width */ +#define TIMER_BITMODE_BITMODE_Pos (0UL) /*!< Position of BITMODE field. */ +#define TIMER_BITMODE_BITMODE_Msk (0x3UL << TIMER_BITMODE_BITMODE_Pos) /*!< Bit mask of BITMODE field. */ +#define TIMER_BITMODE_BITMODE_16Bit (0UL) /*!< 16 bit timer bit width */ +#define TIMER_BITMODE_BITMODE_08Bit (1UL) /*!< 8 bit timer bit width */ +#define TIMER_BITMODE_BITMODE_24Bit (2UL) /*!< 24 bit timer bit width */ +#define TIMER_BITMODE_BITMODE_32Bit (3UL) /*!< 32 bit timer bit width */ + +/* Register: TIMER_PRESCALER */ +/* Description: Timer prescaler register */ + +/* Bits 3..0 : Prescaler value */ +#define TIMER_PRESCALER_PRESCALER_Pos (0UL) /*!< Position of PRESCALER field. */ +#define TIMER_PRESCALER_PRESCALER_Msk (0xFUL << TIMER_PRESCALER_PRESCALER_Pos) /*!< Bit mask of PRESCALER field. */ + +/* Register: TIMER_CC */ +/* Description: Description collection[0]: Capture/Compare register 0 */ + +/* Bits 31..0 : Capture/Compare value */ +#define TIMER_CC_CC_Pos (0UL) /*!< Position of CC field. */ +#define TIMER_CC_CC_Msk (0xFFFFFFFFUL << TIMER_CC_CC_Pos) /*!< Bit mask of CC field. */ + + +/* Peripheral: TWI */ +/* Description: I2C compatible Two-Wire Interface 0 */ + +/* Register: TWI_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 1 : Shortcut between BB event and STOP task */ +#define TWI_SHORTS_BB_STOP_Pos (1UL) /*!< Position of BB_STOP field. */ +#define TWI_SHORTS_BB_STOP_Msk (0x1UL << TWI_SHORTS_BB_STOP_Pos) /*!< Bit mask of BB_STOP field. */ +#define TWI_SHORTS_BB_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TWI_SHORTS_BB_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between BB event and SUSPEND task */ +#define TWI_SHORTS_BB_SUSPEND_Pos (0UL) /*!< Position of BB_SUSPEND field. */ +#define TWI_SHORTS_BB_SUSPEND_Msk (0x1UL << TWI_SHORTS_BB_SUSPEND_Pos) /*!< Bit mask of BB_SUSPEND field. */ +#define TWI_SHORTS_BB_SUSPEND_Disabled (0UL) /*!< Disable shortcut */ +#define TWI_SHORTS_BB_SUSPEND_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: TWI_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 18 : Write '1' to Enable interrupt for SUSPENDED event */ +#define TWI_INTENSET_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWI_INTENSET_SUSPENDED_Msk (0x1UL << TWI_INTENSET_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWI_INTENSET_SUSPENDED_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_SUSPENDED_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_SUSPENDED_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for BB event */ +#define TWI_INTENSET_BB_Pos (14UL) /*!< Position of BB field. */ +#define TWI_INTENSET_BB_Msk (0x1UL << TWI_INTENSET_BB_Pos) /*!< Bit mask of BB field. */ +#define TWI_INTENSET_BB_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_BB_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_BB_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define TWI_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWI_INTENSET_ERROR_Msk (0x1UL << TWI_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWI_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for TXDSENT event */ +#define TWI_INTENSET_TXDSENT_Pos (7UL) /*!< Position of TXDSENT field. */ +#define TWI_INTENSET_TXDSENT_Msk (0x1UL << TWI_INTENSET_TXDSENT_Pos) /*!< Bit mask of TXDSENT field. */ +#define TWI_INTENSET_TXDSENT_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_TXDSENT_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_TXDSENT_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for RXDREADY event */ +#define TWI_INTENSET_RXDREADY_Pos (2UL) /*!< Position of RXDREADY field. */ +#define TWI_INTENSET_RXDREADY_Msk (0x1UL << TWI_INTENSET_RXDREADY_Pos) /*!< Bit mask of RXDREADY field. */ +#define TWI_INTENSET_RXDREADY_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_RXDREADY_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_RXDREADY_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define TWI_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWI_INTENSET_STOPPED_Msk (0x1UL << TWI_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWI_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: TWI_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 18 : Write '1' to Disable interrupt for SUSPENDED event */ +#define TWI_INTENCLR_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWI_INTENCLR_SUSPENDED_Msk (0x1UL << TWI_INTENCLR_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWI_INTENCLR_SUSPENDED_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_SUSPENDED_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_SUSPENDED_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for BB event */ +#define TWI_INTENCLR_BB_Pos (14UL) /*!< Position of BB field. */ +#define TWI_INTENCLR_BB_Msk (0x1UL << TWI_INTENCLR_BB_Pos) /*!< Bit mask of BB field. */ +#define TWI_INTENCLR_BB_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_BB_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_BB_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define TWI_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWI_INTENCLR_ERROR_Msk (0x1UL << TWI_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWI_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for TXDSENT event */ +#define TWI_INTENCLR_TXDSENT_Pos (7UL) /*!< Position of TXDSENT field. */ +#define TWI_INTENCLR_TXDSENT_Msk (0x1UL << TWI_INTENCLR_TXDSENT_Pos) /*!< Bit mask of TXDSENT field. */ +#define TWI_INTENCLR_TXDSENT_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_TXDSENT_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_TXDSENT_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for RXDREADY event */ +#define TWI_INTENCLR_RXDREADY_Pos (2UL) /*!< Position of RXDREADY field. */ +#define TWI_INTENCLR_RXDREADY_Msk (0x1UL << TWI_INTENCLR_RXDREADY_Pos) /*!< Bit mask of RXDREADY field. */ +#define TWI_INTENCLR_RXDREADY_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_RXDREADY_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_RXDREADY_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define TWI_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWI_INTENCLR_STOPPED_Msk (0x1UL << TWI_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWI_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWI_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWI_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: TWI_ERRORSRC */ +/* Description: Error source */ + +/* Bit 2 : NACK received after sending a data byte (write '1' to clear) */ +#define TWI_ERRORSRC_DNACK_Pos (2UL) /*!< Position of DNACK field. */ +#define TWI_ERRORSRC_DNACK_Msk (0x1UL << TWI_ERRORSRC_DNACK_Pos) /*!< Bit mask of DNACK field. */ +#define TWI_ERRORSRC_DNACK_NotPresent (0UL) /*!< Read: error not present */ +#define TWI_ERRORSRC_DNACK_Present (1UL) /*!< Read: error present */ + +/* Bit 1 : NACK received after sending the address (write '1' to clear) */ +#define TWI_ERRORSRC_ANACK_Pos (1UL) /*!< Position of ANACK field. */ +#define TWI_ERRORSRC_ANACK_Msk (0x1UL << TWI_ERRORSRC_ANACK_Pos) /*!< Bit mask of ANACK field. */ +#define TWI_ERRORSRC_ANACK_NotPresent (0UL) /*!< Read: error not present */ +#define TWI_ERRORSRC_ANACK_Present (1UL) /*!< Read: error present */ + +/* Bit 0 : Overrun error */ +#define TWI_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define TWI_ERRORSRC_OVERRUN_Msk (0x1UL << TWI_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define TWI_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Read: no overrun occured */ +#define TWI_ERRORSRC_OVERRUN_Present (1UL) /*!< Read: overrun occured */ + +/* Register: TWI_ENABLE */ +/* Description: Enable TWI */ + +/* Bits 3..0 : Enable or disable TWI */ +#define TWI_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define TWI_ENABLE_ENABLE_Msk (0xFUL << TWI_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define TWI_ENABLE_ENABLE_Disabled (0UL) /*!< Disable TWI */ +#define TWI_ENABLE_ENABLE_Enabled (5UL) /*!< Enable TWI */ + +/* Register: TWI_PSEL_SCL */ +/* Description: Pin select for SCL */ + +/* Bit 31 : Connection */ +#define TWI_PSEL_SCL_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWI_PSEL_SCL_CONNECT_Msk (0x1UL << TWI_PSEL_SCL_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWI_PSEL_SCL_CONNECT_Connected (0UL) /*!< Connect */ +#define TWI_PSEL_SCL_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define TWI_PSEL_SCL_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define TWI_PSEL_SCL_PORT_Msk (0x3UL << TWI_PSEL_SCL_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define TWI_PSEL_SCL_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWI_PSEL_SCL_PIN_Msk (0x1FUL << TWI_PSEL_SCL_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWI_PSEL_SDA */ +/* Description: Pin select for SDA */ + +/* Bit 31 : Connection */ +#define TWI_PSEL_SDA_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWI_PSEL_SDA_CONNECT_Msk (0x1UL << TWI_PSEL_SDA_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWI_PSEL_SDA_CONNECT_Connected (0UL) /*!< Connect */ +#define TWI_PSEL_SDA_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define TWI_PSEL_SDA_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define TWI_PSEL_SDA_PORT_Msk (0x3UL << TWI_PSEL_SDA_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define TWI_PSEL_SDA_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWI_PSEL_SDA_PIN_Msk (0x1FUL << TWI_PSEL_SDA_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWI_RXD */ +/* Description: RXD register */ + +/* Bits 7..0 : RXD register */ +#define TWI_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define TWI_RXD_RXD_Msk (0xFFUL << TWI_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: TWI_TXD */ +/* Description: TXD register */ + +/* Bits 7..0 : TXD register */ +#define TWI_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define TWI_TXD_TXD_Msk (0xFFUL << TWI_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: TWI_FREQUENCY */ +/* Description: TWI frequency. Accuracy depends on the HFCLK source selected. */ + +/* Bits 31..0 : TWI master clock frequency */ +#define TWI_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define TWI_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << TWI_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define TWI_FREQUENCY_FREQUENCY_K100 (0x01980000UL) /*!< 100 kbps */ +#define TWI_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps */ +#define TWI_FREQUENCY_FREQUENCY_K400 (0x06680000UL) /*!< 400 kbps (actual rate 410.256 kbps) */ + +/* Register: TWI_ADDRESS */ +/* Description: Address used in the TWI transfer */ + +/* Bits 6..0 : Address used in the TWI transfer */ +#define TWI_ADDRESS_ADDRESS_Pos (0UL) /*!< Position of ADDRESS field. */ +#define TWI_ADDRESS_ADDRESS_Msk (0x7FUL << TWI_ADDRESS_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ + + +/* Peripheral: TWIM */ +/* Description: I2C compatible Two-Wire Master Interface with EasyDMA 0 */ + +/* Register: TWIM_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 12 : Shortcut between LASTRX event and STOP task */ +#define TWIM_SHORTS_LASTRX_STOP_Pos (12UL) /*!< Position of LASTRX_STOP field. */ +#define TWIM_SHORTS_LASTRX_STOP_Msk (0x1UL << TWIM_SHORTS_LASTRX_STOP_Pos) /*!< Bit mask of LASTRX_STOP field. */ +#define TWIM_SHORTS_LASTRX_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTRX_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 10 : Shortcut between LASTRX event and STARTTX task */ +#define TWIM_SHORTS_LASTRX_STARTTX_Pos (10UL) /*!< Position of LASTRX_STARTTX field. */ +#define TWIM_SHORTS_LASTRX_STARTTX_Msk (0x1UL << TWIM_SHORTS_LASTRX_STARTTX_Pos) /*!< Bit mask of LASTRX_STARTTX field. */ +#define TWIM_SHORTS_LASTRX_STARTTX_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTRX_STARTTX_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 9 : Shortcut between LASTTX event and STOP task */ +#define TWIM_SHORTS_LASTTX_STOP_Pos (9UL) /*!< Position of LASTTX_STOP field. */ +#define TWIM_SHORTS_LASTTX_STOP_Msk (0x1UL << TWIM_SHORTS_LASTTX_STOP_Pos) /*!< Bit mask of LASTTX_STOP field. */ +#define TWIM_SHORTS_LASTTX_STOP_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTTX_STOP_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 8 : Shortcut between LASTTX event and SUSPEND task */ +#define TWIM_SHORTS_LASTTX_SUSPEND_Pos (8UL) /*!< Position of LASTTX_SUSPEND field. */ +#define TWIM_SHORTS_LASTTX_SUSPEND_Msk (0x1UL << TWIM_SHORTS_LASTTX_SUSPEND_Pos) /*!< Bit mask of LASTTX_SUSPEND field. */ +#define TWIM_SHORTS_LASTTX_SUSPEND_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTTX_SUSPEND_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 7 : Shortcut between LASTTX event and STARTRX task */ +#define TWIM_SHORTS_LASTTX_STARTRX_Pos (7UL) /*!< Position of LASTTX_STARTRX field. */ +#define TWIM_SHORTS_LASTTX_STARTRX_Msk (0x1UL << TWIM_SHORTS_LASTTX_STARTRX_Pos) /*!< Bit mask of LASTTX_STARTRX field. */ +#define TWIM_SHORTS_LASTTX_STARTRX_Disabled (0UL) /*!< Disable shortcut */ +#define TWIM_SHORTS_LASTTX_STARTRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: TWIM_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 24 : Enable or disable interrupt for LASTTX event */ +#define TWIM_INTEN_LASTTX_Pos (24UL) /*!< Position of LASTTX field. */ +#define TWIM_INTEN_LASTTX_Msk (0x1UL << TWIM_INTEN_LASTTX_Pos) /*!< Bit mask of LASTTX field. */ +#define TWIM_INTEN_LASTTX_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_LASTTX_Enabled (1UL) /*!< Enable */ + +/* Bit 23 : Enable or disable interrupt for LASTRX event */ +#define TWIM_INTEN_LASTRX_Pos (23UL) /*!< Position of LASTRX field. */ +#define TWIM_INTEN_LASTRX_Msk (0x1UL << TWIM_INTEN_LASTRX_Pos) /*!< Bit mask of LASTRX field. */ +#define TWIM_INTEN_LASTRX_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_LASTRX_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for TXSTARTED event */ +#define TWIM_INTEN_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIM_INTEN_TXSTARTED_Msk (0x1UL << TWIM_INTEN_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIM_INTEN_TXSTARTED_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_TXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for RXSTARTED event */ +#define TWIM_INTEN_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIM_INTEN_RXSTARTED_Msk (0x1UL << TWIM_INTEN_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIM_INTEN_RXSTARTED_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_RXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable interrupt for SUSPENDED event */ +#define TWIM_INTEN_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWIM_INTEN_SUSPENDED_Msk (0x1UL << TWIM_INTEN_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWIM_INTEN_SUSPENDED_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_SUSPENDED_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for ERROR event */ +#define TWIM_INTEN_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIM_INTEN_ERROR_Msk (0x1UL << TWIM_INTEN_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIM_INTEN_ERROR_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_ERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STOPPED event */ +#define TWIM_INTEN_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIM_INTEN_STOPPED_Msk (0x1UL << TWIM_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIM_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define TWIM_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Register: TWIM_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 24 : Write '1' to Enable interrupt for LASTTX event */ +#define TWIM_INTENSET_LASTTX_Pos (24UL) /*!< Position of LASTTX field. */ +#define TWIM_INTENSET_LASTTX_Msk (0x1UL << TWIM_INTENSET_LASTTX_Pos) /*!< Bit mask of LASTTX field. */ +#define TWIM_INTENSET_LASTTX_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_LASTTX_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_LASTTX_Set (1UL) /*!< Enable */ + +/* Bit 23 : Write '1' to Enable interrupt for LASTRX event */ +#define TWIM_INTENSET_LASTRX_Pos (23UL) /*!< Position of LASTRX field. */ +#define TWIM_INTENSET_LASTRX_Msk (0x1UL << TWIM_INTENSET_LASTRX_Pos) /*!< Bit mask of LASTRX field. */ +#define TWIM_INTENSET_LASTRX_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_LASTRX_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_LASTRX_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for TXSTARTED event */ +#define TWIM_INTENSET_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIM_INTENSET_TXSTARTED_Msk (0x1UL << TWIM_INTENSET_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIM_INTENSET_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_TXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for RXSTARTED event */ +#define TWIM_INTENSET_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIM_INTENSET_RXSTARTED_Msk (0x1UL << TWIM_INTENSET_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIM_INTENSET_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_RXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for SUSPENDED event */ +#define TWIM_INTENSET_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWIM_INTENSET_SUSPENDED_Msk (0x1UL << TWIM_INTENSET_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWIM_INTENSET_SUSPENDED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_SUSPENDED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_SUSPENDED_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define TWIM_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIM_INTENSET_ERROR_Msk (0x1UL << TWIM_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIM_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define TWIM_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIM_INTENSET_STOPPED_Msk (0x1UL << TWIM_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIM_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: TWIM_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 24 : Write '1' to Disable interrupt for LASTTX event */ +#define TWIM_INTENCLR_LASTTX_Pos (24UL) /*!< Position of LASTTX field. */ +#define TWIM_INTENCLR_LASTTX_Msk (0x1UL << TWIM_INTENCLR_LASTTX_Pos) /*!< Bit mask of LASTTX field. */ +#define TWIM_INTENCLR_LASTTX_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_LASTTX_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_LASTTX_Clear (1UL) /*!< Disable */ + +/* Bit 23 : Write '1' to Disable interrupt for LASTRX event */ +#define TWIM_INTENCLR_LASTRX_Pos (23UL) /*!< Position of LASTRX field. */ +#define TWIM_INTENCLR_LASTRX_Msk (0x1UL << TWIM_INTENCLR_LASTRX_Pos) /*!< Bit mask of LASTRX field. */ +#define TWIM_INTENCLR_LASTRX_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_LASTRX_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_LASTRX_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for TXSTARTED event */ +#define TWIM_INTENCLR_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIM_INTENCLR_TXSTARTED_Msk (0x1UL << TWIM_INTENCLR_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIM_INTENCLR_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_TXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for RXSTARTED event */ +#define TWIM_INTENCLR_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIM_INTENCLR_RXSTARTED_Msk (0x1UL << TWIM_INTENCLR_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIM_INTENCLR_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_RXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for SUSPENDED event */ +#define TWIM_INTENCLR_SUSPENDED_Pos (18UL) /*!< Position of SUSPENDED field. */ +#define TWIM_INTENCLR_SUSPENDED_Msk (0x1UL << TWIM_INTENCLR_SUSPENDED_Pos) /*!< Bit mask of SUSPENDED field. */ +#define TWIM_INTENCLR_SUSPENDED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_SUSPENDED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_SUSPENDED_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define TWIM_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIM_INTENCLR_ERROR_Msk (0x1UL << TWIM_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIM_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define TWIM_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIM_INTENCLR_STOPPED_Msk (0x1UL << TWIM_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIM_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIM_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIM_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: TWIM_ERRORSRC */ +/* Description: Error source */ + +/* Bit 2 : NACK received after sending a data byte (write '1' to clear) */ +#define TWIM_ERRORSRC_DNACK_Pos (2UL) /*!< Position of DNACK field. */ +#define TWIM_ERRORSRC_DNACK_Msk (0x1UL << TWIM_ERRORSRC_DNACK_Pos) /*!< Bit mask of DNACK field. */ +#define TWIM_ERRORSRC_DNACK_NotReceived (0UL) /*!< Error did not occur */ +#define TWIM_ERRORSRC_DNACK_Received (1UL) /*!< Error occurred */ + +/* Bit 1 : NACK received after sending the address (write '1' to clear) */ +#define TWIM_ERRORSRC_ANACK_Pos (1UL) /*!< Position of ANACK field. */ +#define TWIM_ERRORSRC_ANACK_Msk (0x1UL << TWIM_ERRORSRC_ANACK_Pos) /*!< Bit mask of ANACK field. */ +#define TWIM_ERRORSRC_ANACK_NotReceived (0UL) /*!< Error did not occur */ +#define TWIM_ERRORSRC_ANACK_Received (1UL) /*!< Error occurred */ + +/* Bit 0 : Overrun error */ +#define TWIM_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define TWIM_ERRORSRC_OVERRUN_Msk (0x1UL << TWIM_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define TWIM_ERRORSRC_OVERRUN_NotReceived (0UL) /*!< Error did not occur */ +#define TWIM_ERRORSRC_OVERRUN_Received (1UL) /*!< Error occurred */ + +/* Register: TWIM_ENABLE */ +/* Description: Enable TWIM */ + +/* Bits 3..0 : Enable or disable TWIM */ +#define TWIM_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define TWIM_ENABLE_ENABLE_Msk (0xFUL << TWIM_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define TWIM_ENABLE_ENABLE_Disabled (0UL) /*!< Disable TWIM */ +#define TWIM_ENABLE_ENABLE_Enabled (6UL) /*!< Enable TWIM */ + +/* Register: TWIM_PSEL_SCL */ +/* Description: Pin select for SCL signal */ + +/* Bit 31 : Connection */ +#define TWIM_PSEL_SCL_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWIM_PSEL_SCL_CONNECT_Msk (0x1UL << TWIM_PSEL_SCL_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWIM_PSEL_SCL_CONNECT_Connected (0UL) /*!< Connect */ +#define TWIM_PSEL_SCL_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define TWIM_PSEL_SCL_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define TWIM_PSEL_SCL_PORT_Msk (0x3UL << TWIM_PSEL_SCL_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define TWIM_PSEL_SCL_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWIM_PSEL_SCL_PIN_Msk (0x1FUL << TWIM_PSEL_SCL_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWIM_PSEL_SDA */ +/* Description: Pin select for SDA signal */ + +/* Bit 31 : Connection */ +#define TWIM_PSEL_SDA_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWIM_PSEL_SDA_CONNECT_Msk (0x1UL << TWIM_PSEL_SDA_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWIM_PSEL_SDA_CONNECT_Connected (0UL) /*!< Connect */ +#define TWIM_PSEL_SDA_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define TWIM_PSEL_SDA_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define TWIM_PSEL_SDA_PORT_Msk (0x3UL << TWIM_PSEL_SDA_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define TWIM_PSEL_SDA_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWIM_PSEL_SDA_PIN_Msk (0x1FUL << TWIM_PSEL_SDA_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWIM_FREQUENCY */ +/* Description: TWI frequency. Accuracy depends on the HFCLK source selected. */ + +/* Bits 31..0 : TWI master clock frequency */ +#define TWIM_FREQUENCY_FREQUENCY_Pos (0UL) /*!< Position of FREQUENCY field. */ +#define TWIM_FREQUENCY_FREQUENCY_Msk (0xFFFFFFFFUL << TWIM_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ +#define TWIM_FREQUENCY_FREQUENCY_K100 (0x01980000UL) /*!< 100 kbps */ +#define TWIM_FREQUENCY_FREQUENCY_K250 (0x04000000UL) /*!< 250 kbps */ +#define TWIM_FREQUENCY_FREQUENCY_K400 (0x06400000UL) /*!< 400 kbps */ + +/* Register: TWIM_RXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define TWIM_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define TWIM_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << TWIM_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: TWIM_RXD_MAXCNT */ +/* Description: Maximum number of bytes in receive buffer */ + +/* Bits 7..0 : Maximum number of bytes in receive buffer */ +#define TWIM_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define TWIM_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << TWIM_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: TWIM_RXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. */ +#define TWIM_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define TWIM_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << TWIM_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: TWIM_RXD_LIST */ +/* Description: EasyDMA list type */ + +/* Bits 2..0 : List type */ +#define TWIM_RXD_LIST_LIST_Pos (0UL) /*!< Position of LIST field. */ +#define TWIM_RXD_LIST_LIST_Msk (0x7UL << TWIM_RXD_LIST_LIST_Pos) /*!< Bit mask of LIST field. */ +#define TWIM_RXD_LIST_LIST_Disabled (0UL) /*!< Disable EasyDMA list */ +#define TWIM_RXD_LIST_LIST_ArrayList (1UL) /*!< Use array list */ + +/* Register: TWIM_TXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define TWIM_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define TWIM_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << TWIM_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: TWIM_TXD_MAXCNT */ +/* Description: Maximum number of bytes in transmit buffer */ + +/* Bits 7..0 : Maximum number of bytes in transmit buffer */ +#define TWIM_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define TWIM_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << TWIM_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: TWIM_TXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. */ +#define TWIM_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define TWIM_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << TWIM_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: TWIM_TXD_LIST */ +/* Description: EasyDMA list type */ + +/* Bits 2..0 : List type */ +#define TWIM_TXD_LIST_LIST_Pos (0UL) /*!< Position of LIST field. */ +#define TWIM_TXD_LIST_LIST_Msk (0x7UL << TWIM_TXD_LIST_LIST_Pos) /*!< Bit mask of LIST field. */ +#define TWIM_TXD_LIST_LIST_Disabled (0UL) /*!< Disable EasyDMA list */ +#define TWIM_TXD_LIST_LIST_ArrayList (1UL) /*!< Use array list */ + +/* Register: TWIM_ADDRESS */ +/* Description: Address used in the TWI transfer */ + +/* Bits 6..0 : Address used in the TWI transfer */ +#define TWIM_ADDRESS_ADDRESS_Pos (0UL) /*!< Position of ADDRESS field. */ +#define TWIM_ADDRESS_ADDRESS_Msk (0x7FUL << TWIM_ADDRESS_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ + + +/* Peripheral: TWIS */ +/* Description: I2C compatible Two-Wire Slave Interface with EasyDMA 0 */ + +/* Register: TWIS_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 14 : Shortcut between READ event and SUSPEND task */ +#define TWIS_SHORTS_READ_SUSPEND_Pos (14UL) /*!< Position of READ_SUSPEND field. */ +#define TWIS_SHORTS_READ_SUSPEND_Msk (0x1UL << TWIS_SHORTS_READ_SUSPEND_Pos) /*!< Bit mask of READ_SUSPEND field. */ +#define TWIS_SHORTS_READ_SUSPEND_Disabled (0UL) /*!< Disable shortcut */ +#define TWIS_SHORTS_READ_SUSPEND_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 13 : Shortcut between WRITE event and SUSPEND task */ +#define TWIS_SHORTS_WRITE_SUSPEND_Pos (13UL) /*!< Position of WRITE_SUSPEND field. */ +#define TWIS_SHORTS_WRITE_SUSPEND_Msk (0x1UL << TWIS_SHORTS_WRITE_SUSPEND_Pos) /*!< Bit mask of WRITE_SUSPEND field. */ +#define TWIS_SHORTS_WRITE_SUSPEND_Disabled (0UL) /*!< Disable shortcut */ +#define TWIS_SHORTS_WRITE_SUSPEND_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: TWIS_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 26 : Enable or disable interrupt for READ event */ +#define TWIS_INTEN_READ_Pos (26UL) /*!< Position of READ field. */ +#define TWIS_INTEN_READ_Msk (0x1UL << TWIS_INTEN_READ_Pos) /*!< Bit mask of READ field. */ +#define TWIS_INTEN_READ_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_READ_Enabled (1UL) /*!< Enable */ + +/* Bit 25 : Enable or disable interrupt for WRITE event */ +#define TWIS_INTEN_WRITE_Pos (25UL) /*!< Position of WRITE field. */ +#define TWIS_INTEN_WRITE_Msk (0x1UL << TWIS_INTEN_WRITE_Pos) /*!< Bit mask of WRITE field. */ +#define TWIS_INTEN_WRITE_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_WRITE_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for TXSTARTED event */ +#define TWIS_INTEN_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIS_INTEN_TXSTARTED_Msk (0x1UL << TWIS_INTEN_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIS_INTEN_TXSTARTED_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_TXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for RXSTARTED event */ +#define TWIS_INTEN_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIS_INTEN_RXSTARTED_Msk (0x1UL << TWIS_INTEN_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIS_INTEN_RXSTARTED_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_RXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for ERROR event */ +#define TWIS_INTEN_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIS_INTEN_ERROR_Msk (0x1UL << TWIS_INTEN_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIS_INTEN_ERROR_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_ERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STOPPED event */ +#define TWIS_INTEN_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIS_INTEN_STOPPED_Msk (0x1UL << TWIS_INTEN_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIS_INTEN_STOPPED_Disabled (0UL) /*!< Disable */ +#define TWIS_INTEN_STOPPED_Enabled (1UL) /*!< Enable */ + +/* Register: TWIS_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 26 : Write '1' to Enable interrupt for READ event */ +#define TWIS_INTENSET_READ_Pos (26UL) /*!< Position of READ field. */ +#define TWIS_INTENSET_READ_Msk (0x1UL << TWIS_INTENSET_READ_Pos) /*!< Bit mask of READ field. */ +#define TWIS_INTENSET_READ_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_READ_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_READ_Set (1UL) /*!< Enable */ + +/* Bit 25 : Write '1' to Enable interrupt for WRITE event */ +#define TWIS_INTENSET_WRITE_Pos (25UL) /*!< Position of WRITE field. */ +#define TWIS_INTENSET_WRITE_Msk (0x1UL << TWIS_INTENSET_WRITE_Pos) /*!< Bit mask of WRITE field. */ +#define TWIS_INTENSET_WRITE_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_WRITE_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_WRITE_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for TXSTARTED event */ +#define TWIS_INTENSET_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIS_INTENSET_TXSTARTED_Msk (0x1UL << TWIS_INTENSET_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIS_INTENSET_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_TXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for RXSTARTED event */ +#define TWIS_INTENSET_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIS_INTENSET_RXSTARTED_Msk (0x1UL << TWIS_INTENSET_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIS_INTENSET_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_RXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define TWIS_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIS_INTENSET_ERROR_Msk (0x1UL << TWIS_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIS_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STOPPED event */ +#define TWIS_INTENSET_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIS_INTENSET_STOPPED_Msk (0x1UL << TWIS_INTENSET_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIS_INTENSET_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENSET_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENSET_STOPPED_Set (1UL) /*!< Enable */ + +/* Register: TWIS_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 26 : Write '1' to Disable interrupt for READ event */ +#define TWIS_INTENCLR_READ_Pos (26UL) /*!< Position of READ field. */ +#define TWIS_INTENCLR_READ_Msk (0x1UL << TWIS_INTENCLR_READ_Pos) /*!< Bit mask of READ field. */ +#define TWIS_INTENCLR_READ_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_READ_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_READ_Clear (1UL) /*!< Disable */ + +/* Bit 25 : Write '1' to Disable interrupt for WRITE event */ +#define TWIS_INTENCLR_WRITE_Pos (25UL) /*!< Position of WRITE field. */ +#define TWIS_INTENCLR_WRITE_Msk (0x1UL << TWIS_INTENCLR_WRITE_Pos) /*!< Bit mask of WRITE field. */ +#define TWIS_INTENCLR_WRITE_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_WRITE_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_WRITE_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for TXSTARTED event */ +#define TWIS_INTENCLR_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define TWIS_INTENCLR_TXSTARTED_Msk (0x1UL << TWIS_INTENCLR_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define TWIS_INTENCLR_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_TXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for RXSTARTED event */ +#define TWIS_INTENCLR_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define TWIS_INTENCLR_RXSTARTED_Msk (0x1UL << TWIS_INTENCLR_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define TWIS_INTENCLR_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_RXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define TWIS_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define TWIS_INTENCLR_ERROR_Msk (0x1UL << TWIS_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define TWIS_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STOPPED event */ +#define TWIS_INTENCLR_STOPPED_Pos (1UL) /*!< Position of STOPPED field. */ +#define TWIS_INTENCLR_STOPPED_Msk (0x1UL << TWIS_INTENCLR_STOPPED_Pos) /*!< Bit mask of STOPPED field. */ +#define TWIS_INTENCLR_STOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define TWIS_INTENCLR_STOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define TWIS_INTENCLR_STOPPED_Clear (1UL) /*!< Disable */ + +/* Register: TWIS_ERRORSRC */ +/* Description: Error source */ + +/* Bit 3 : TX buffer over-read detected, and prevented */ +#define TWIS_ERRORSRC_OVERREAD_Pos (3UL) /*!< Position of OVERREAD field. */ +#define TWIS_ERRORSRC_OVERREAD_Msk (0x1UL << TWIS_ERRORSRC_OVERREAD_Pos) /*!< Bit mask of OVERREAD field. */ +#define TWIS_ERRORSRC_OVERREAD_NotDetected (0UL) /*!< Error did not occur */ +#define TWIS_ERRORSRC_OVERREAD_Detected (1UL) /*!< Error occurred */ + +/* Bit 2 : NACK sent after receiving a data byte */ +#define TWIS_ERRORSRC_DNACK_Pos (2UL) /*!< Position of DNACK field. */ +#define TWIS_ERRORSRC_DNACK_Msk (0x1UL << TWIS_ERRORSRC_DNACK_Pos) /*!< Bit mask of DNACK field. */ +#define TWIS_ERRORSRC_DNACK_NotReceived (0UL) /*!< Error did not occur */ +#define TWIS_ERRORSRC_DNACK_Received (1UL) /*!< Error occurred */ + +/* Bit 0 : RX buffer overflow detected, and prevented */ +#define TWIS_ERRORSRC_OVERFLOW_Pos (0UL) /*!< Position of OVERFLOW field. */ +#define TWIS_ERRORSRC_OVERFLOW_Msk (0x1UL << TWIS_ERRORSRC_OVERFLOW_Pos) /*!< Bit mask of OVERFLOW field. */ +#define TWIS_ERRORSRC_OVERFLOW_NotDetected (0UL) /*!< Error did not occur */ +#define TWIS_ERRORSRC_OVERFLOW_Detected (1UL) /*!< Error occurred */ + +/* Register: TWIS_MATCH */ +/* Description: Status register indicating which address had a match */ + +/* Bit 0 : Which of the addresses in {ADDRESS} matched the incoming address */ +#define TWIS_MATCH_MATCH_Pos (0UL) /*!< Position of MATCH field. */ +#define TWIS_MATCH_MATCH_Msk (0x1UL << TWIS_MATCH_MATCH_Pos) /*!< Bit mask of MATCH field. */ + +/* Register: TWIS_ENABLE */ +/* Description: Enable TWIS */ + +/* Bits 3..0 : Enable or disable TWIS */ +#define TWIS_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define TWIS_ENABLE_ENABLE_Msk (0xFUL << TWIS_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define TWIS_ENABLE_ENABLE_Disabled (0UL) /*!< Disable TWIS */ +#define TWIS_ENABLE_ENABLE_Enabled (9UL) /*!< Enable TWIS */ + +/* Register: TWIS_PSEL_SCL */ +/* Description: Pin select for SCL signal */ + +/* Bit 31 : Connection */ +#define TWIS_PSEL_SCL_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWIS_PSEL_SCL_CONNECT_Msk (0x1UL << TWIS_PSEL_SCL_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWIS_PSEL_SCL_CONNECT_Connected (0UL) /*!< Connect */ +#define TWIS_PSEL_SCL_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define TWIS_PSEL_SCL_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define TWIS_PSEL_SCL_PORT_Msk (0x3UL << TWIS_PSEL_SCL_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define TWIS_PSEL_SCL_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWIS_PSEL_SCL_PIN_Msk (0x1FUL << TWIS_PSEL_SCL_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWIS_PSEL_SDA */ +/* Description: Pin select for SDA signal */ + +/* Bit 31 : Connection */ +#define TWIS_PSEL_SDA_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define TWIS_PSEL_SDA_CONNECT_Msk (0x1UL << TWIS_PSEL_SDA_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define TWIS_PSEL_SDA_CONNECT_Connected (0UL) /*!< Connect */ +#define TWIS_PSEL_SDA_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define TWIS_PSEL_SDA_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define TWIS_PSEL_SDA_PORT_Msk (0x3UL << TWIS_PSEL_SDA_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define TWIS_PSEL_SDA_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define TWIS_PSEL_SDA_PIN_Msk (0x1FUL << TWIS_PSEL_SDA_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: TWIS_RXD_PTR */ +/* Description: RXD Data pointer */ + +/* Bits 31..0 : RXD Data pointer */ +#define TWIS_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define TWIS_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << TWIS_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: TWIS_RXD_MAXCNT */ +/* Description: Maximum number of bytes in RXD buffer */ + +/* Bits 7..0 : Maximum number of bytes in RXD buffer */ +#define TWIS_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define TWIS_RXD_MAXCNT_MAXCNT_Msk (0xFFUL << TWIS_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: TWIS_RXD_AMOUNT */ +/* Description: Number of bytes transferred in the last RXD transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last RXD transaction */ +#define TWIS_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define TWIS_RXD_AMOUNT_AMOUNT_Msk (0xFFUL << TWIS_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: TWIS_TXD_PTR */ +/* Description: TXD Data pointer */ + +/* Bits 31..0 : TXD Data pointer */ +#define TWIS_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define TWIS_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << TWIS_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: TWIS_TXD_MAXCNT */ +/* Description: Maximum number of bytes in TXD buffer */ + +/* Bits 7..0 : Maximum number of bytes in TXD buffer */ +#define TWIS_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define TWIS_TXD_MAXCNT_MAXCNT_Msk (0xFFUL << TWIS_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: TWIS_TXD_AMOUNT */ +/* Description: Number of bytes transferred in the last TXD transaction */ + +/* Bits 7..0 : Number of bytes transferred in the last TXD transaction */ +#define TWIS_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define TWIS_TXD_AMOUNT_AMOUNT_Msk (0xFFUL << TWIS_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: TWIS_ADDRESS */ +/* Description: Description collection[0]: TWI slave address 0 */ + +/* Bits 6..0 : TWI slave address */ +#define TWIS_ADDRESS_ADDRESS_Pos (0UL) /*!< Position of ADDRESS field. */ +#define TWIS_ADDRESS_ADDRESS_Msk (0x7FUL << TWIS_ADDRESS_ADDRESS_Pos) /*!< Bit mask of ADDRESS field. */ + +/* Register: TWIS_CONFIG */ +/* Description: Configuration register for the address match mechanism */ + +/* Bit 1 : Enable or disable address matching on ADDRESS[1] */ +#define TWIS_CONFIG_ADDRESS1_Pos (1UL) /*!< Position of ADDRESS1 field. */ +#define TWIS_CONFIG_ADDRESS1_Msk (0x1UL << TWIS_CONFIG_ADDRESS1_Pos) /*!< Bit mask of ADDRESS1 field. */ +#define TWIS_CONFIG_ADDRESS1_Disabled (0UL) /*!< Disabled */ +#define TWIS_CONFIG_ADDRESS1_Enabled (1UL) /*!< Enabled */ + +/* Bit 0 : Enable or disable address matching on ADDRESS[0] */ +#define TWIS_CONFIG_ADDRESS0_Pos (0UL) /*!< Position of ADDRESS0 field. */ +#define TWIS_CONFIG_ADDRESS0_Msk (0x1UL << TWIS_CONFIG_ADDRESS0_Pos) /*!< Bit mask of ADDRESS0 field. */ +#define TWIS_CONFIG_ADDRESS0_Disabled (0UL) /*!< Disabled */ +#define TWIS_CONFIG_ADDRESS0_Enabled (1UL) /*!< Enabled */ + +/* Register: TWIS_ORC */ +/* Description: Over-read character. Character sent out in case of an over-read of the transmit buffer. */ + +/* Bits 7..0 : Over-read character. Character sent out in case of an over-read of the transmit buffer. */ +#define TWIS_ORC_ORC_Pos (0UL) /*!< Position of ORC field. */ +#define TWIS_ORC_ORC_Msk (0xFFUL << TWIS_ORC_ORC_Pos) /*!< Bit mask of ORC field. */ + + +/* Peripheral: UART */ +/* Description: Universal Asynchronous Receiver/Transmitter */ + +/* Register: UART_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between NCTS event and STOPRX task */ +#define UART_SHORTS_NCTS_STOPRX_Pos (4UL) /*!< Position of NCTS_STOPRX field. */ +#define UART_SHORTS_NCTS_STOPRX_Msk (0x1UL << UART_SHORTS_NCTS_STOPRX_Pos) /*!< Bit mask of NCTS_STOPRX field. */ +#define UART_SHORTS_NCTS_STOPRX_Disabled (0UL) /*!< Disable shortcut */ +#define UART_SHORTS_NCTS_STOPRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between CTS event and STARTRX task */ +#define UART_SHORTS_CTS_STARTRX_Pos (3UL) /*!< Position of CTS_STARTRX field. */ +#define UART_SHORTS_CTS_STARTRX_Msk (0x1UL << UART_SHORTS_CTS_STARTRX_Pos) /*!< Bit mask of CTS_STARTRX field. */ +#define UART_SHORTS_CTS_STARTRX_Disabled (0UL) /*!< Disable shortcut */ +#define UART_SHORTS_CTS_STARTRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: UART_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 17 : Write '1' to Enable interrupt for RXTO event */ +#define UART_INTENSET_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UART_INTENSET_RXTO_Msk (0x1UL << UART_INTENSET_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UART_INTENSET_RXTO_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_RXTO_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_RXTO_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define UART_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UART_INTENSET_ERROR_Msk (0x1UL << UART_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UART_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for TXDRDY event */ +#define UART_INTENSET_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UART_INTENSET_TXDRDY_Msk (0x1UL << UART_INTENSET_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UART_INTENSET_TXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_TXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_TXDRDY_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for RXDRDY event */ +#define UART_INTENSET_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UART_INTENSET_RXDRDY_Msk (0x1UL << UART_INTENSET_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UART_INTENSET_RXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_RXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_RXDRDY_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for NCTS event */ +#define UART_INTENSET_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UART_INTENSET_NCTS_Msk (0x1UL << UART_INTENSET_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UART_INTENSET_NCTS_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_NCTS_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_NCTS_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for CTS event */ +#define UART_INTENSET_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UART_INTENSET_CTS_Msk (0x1UL << UART_INTENSET_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UART_INTENSET_CTS_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENSET_CTS_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENSET_CTS_Set (1UL) /*!< Enable */ + +/* Register: UART_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 17 : Write '1' to Disable interrupt for RXTO event */ +#define UART_INTENCLR_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UART_INTENCLR_RXTO_Msk (0x1UL << UART_INTENCLR_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UART_INTENCLR_RXTO_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_RXTO_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_RXTO_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define UART_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UART_INTENCLR_ERROR_Msk (0x1UL << UART_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UART_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for TXDRDY event */ +#define UART_INTENCLR_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UART_INTENCLR_TXDRDY_Msk (0x1UL << UART_INTENCLR_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UART_INTENCLR_TXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_TXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_TXDRDY_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for RXDRDY event */ +#define UART_INTENCLR_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UART_INTENCLR_RXDRDY_Msk (0x1UL << UART_INTENCLR_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UART_INTENCLR_RXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_RXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_RXDRDY_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for NCTS event */ +#define UART_INTENCLR_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UART_INTENCLR_NCTS_Msk (0x1UL << UART_INTENCLR_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UART_INTENCLR_NCTS_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_NCTS_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_NCTS_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for CTS event */ +#define UART_INTENCLR_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UART_INTENCLR_CTS_Msk (0x1UL << UART_INTENCLR_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UART_INTENCLR_CTS_Disabled (0UL) /*!< Read: Disabled */ +#define UART_INTENCLR_CTS_Enabled (1UL) /*!< Read: Enabled */ +#define UART_INTENCLR_CTS_Clear (1UL) /*!< Disable */ + +/* Register: UART_ERRORSRC */ +/* Description: Error source */ + +/* Bit 3 : Break condition */ +#define UART_ERRORSRC_BREAK_Pos (3UL) /*!< Position of BREAK field. */ +#define UART_ERRORSRC_BREAK_Msk (0x1UL << UART_ERRORSRC_BREAK_Pos) /*!< Bit mask of BREAK field. */ +#define UART_ERRORSRC_BREAK_NotPresent (0UL) /*!< Read: error not present */ +#define UART_ERRORSRC_BREAK_Present (1UL) /*!< Read: error present */ + +/* Bit 2 : Framing error occurred */ +#define UART_ERRORSRC_FRAMING_Pos (2UL) /*!< Position of FRAMING field. */ +#define UART_ERRORSRC_FRAMING_Msk (0x1UL << UART_ERRORSRC_FRAMING_Pos) /*!< Bit mask of FRAMING field. */ +#define UART_ERRORSRC_FRAMING_NotPresent (0UL) /*!< Read: error not present */ +#define UART_ERRORSRC_FRAMING_Present (1UL) /*!< Read: error present */ + +/* Bit 1 : Parity error */ +#define UART_ERRORSRC_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UART_ERRORSRC_PARITY_Msk (0x1UL << UART_ERRORSRC_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UART_ERRORSRC_PARITY_NotPresent (0UL) /*!< Read: error not present */ +#define UART_ERRORSRC_PARITY_Present (1UL) /*!< Read: error present */ + +/* Bit 0 : Overrun error */ +#define UART_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define UART_ERRORSRC_OVERRUN_Msk (0x1UL << UART_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define UART_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Read: error not present */ +#define UART_ERRORSRC_OVERRUN_Present (1UL) /*!< Read: error present */ + +/* Register: UART_ENABLE */ +/* Description: Enable UART */ + +/* Bits 3..0 : Enable or disable UART */ +#define UART_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define UART_ENABLE_ENABLE_Msk (0xFUL << UART_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define UART_ENABLE_ENABLE_Disabled (0UL) /*!< Disable UART */ +#define UART_ENABLE_ENABLE_Enabled (4UL) /*!< Enable UART */ + +/* Register: UART_PSEL_RTS */ +/* Description: Pin select for RTS */ + +/* Bit 31 : Connection */ +#define UART_PSEL_RTS_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UART_PSEL_RTS_CONNECT_Msk (0x1UL << UART_PSEL_RTS_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UART_PSEL_RTS_CONNECT_Connected (0UL) /*!< Connect */ +#define UART_PSEL_RTS_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define UART_PSEL_RTS_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UART_PSEL_RTS_PORT_Msk (0x3UL << UART_PSEL_RTS_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define UART_PSEL_RTS_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UART_PSEL_RTS_PIN_Msk (0x1FUL << UART_PSEL_RTS_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UART_PSEL_TXD */ +/* Description: Pin select for TXD */ + +/* Bit 31 : Connection */ +#define UART_PSEL_TXD_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UART_PSEL_TXD_CONNECT_Msk (0x1UL << UART_PSEL_TXD_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UART_PSEL_TXD_CONNECT_Connected (0UL) /*!< Connect */ +#define UART_PSEL_TXD_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define UART_PSEL_TXD_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UART_PSEL_TXD_PORT_Msk (0x3UL << UART_PSEL_TXD_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define UART_PSEL_TXD_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UART_PSEL_TXD_PIN_Msk (0x1FUL << UART_PSEL_TXD_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UART_PSEL_CTS */ +/* Description: Pin select for CTS */ + +/* Bit 31 : Connection */ +#define UART_PSEL_CTS_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UART_PSEL_CTS_CONNECT_Msk (0x1UL << UART_PSEL_CTS_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UART_PSEL_CTS_CONNECT_Connected (0UL) /*!< Connect */ +#define UART_PSEL_CTS_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define UART_PSEL_CTS_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UART_PSEL_CTS_PORT_Msk (0x3UL << UART_PSEL_CTS_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define UART_PSEL_CTS_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UART_PSEL_CTS_PIN_Msk (0x1FUL << UART_PSEL_CTS_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UART_PSEL_RXD */ +/* Description: Pin select for RXD */ + +/* Bit 31 : Connection */ +#define UART_PSEL_RXD_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UART_PSEL_RXD_CONNECT_Msk (0x1UL << UART_PSEL_RXD_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UART_PSEL_RXD_CONNECT_Connected (0UL) /*!< Connect */ +#define UART_PSEL_RXD_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define UART_PSEL_RXD_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UART_PSEL_RXD_PORT_Msk (0x3UL << UART_PSEL_RXD_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define UART_PSEL_RXD_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UART_PSEL_RXD_PIN_Msk (0x1FUL << UART_PSEL_RXD_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UART_RXD */ +/* Description: RXD register */ + +/* Bits 7..0 : RX data received in previous transfers, double buffered */ +#define UART_RXD_RXD_Pos (0UL) /*!< Position of RXD field. */ +#define UART_RXD_RXD_Msk (0xFFUL << UART_RXD_RXD_Pos) /*!< Bit mask of RXD field. */ + +/* Register: UART_TXD */ +/* Description: TXD register */ + +/* Bits 7..0 : TX data to be transferred */ +#define UART_TXD_TXD_Pos (0UL) /*!< Position of TXD field. */ +#define UART_TXD_TXD_Msk (0xFFUL << UART_TXD_TXD_Pos) /*!< Bit mask of TXD field. */ + +/* Register: UART_BAUDRATE */ +/* Description: Baud rate. Accuracy depends on the HFCLK source selected. */ + +/* Bits 31..0 : Baud rate */ +#define UART_BAUDRATE_BAUDRATE_Pos (0UL) /*!< Position of BAUDRATE field. */ +#define UART_BAUDRATE_BAUDRATE_Msk (0xFFFFFFFFUL << UART_BAUDRATE_BAUDRATE_Pos) /*!< Bit mask of BAUDRATE field. */ +#define UART_BAUDRATE_BAUDRATE_Baud1200 (0x0004F000UL) /*!< 1200 baud (actual rate: 1205) */ +#define UART_BAUDRATE_BAUDRATE_Baud2400 (0x0009D000UL) /*!< 2400 baud (actual rate: 2396) */ +#define UART_BAUDRATE_BAUDRATE_Baud4800 (0x0013B000UL) /*!< 4800 baud (actual rate: 4808) */ +#define UART_BAUDRATE_BAUDRATE_Baud9600 (0x00275000UL) /*!< 9600 baud (actual rate: 9598) */ +#define UART_BAUDRATE_BAUDRATE_Baud14400 (0x003B0000UL) /*!< 14400 baud (actual rate: 14414) */ +#define UART_BAUDRATE_BAUDRATE_Baud19200 (0x004EA000UL) /*!< 19200 baud (actual rate: 19208) */ +#define UART_BAUDRATE_BAUDRATE_Baud28800 (0x0075F000UL) /*!< 28800 baud (actual rate: 28829) */ +#define UART_BAUDRATE_BAUDRATE_Baud31250 (0x00800000UL) /*!< 31250 baud */ +#define UART_BAUDRATE_BAUDRATE_Baud38400 (0x009D5000UL) /*!< 38400 baud (actual rate: 38462) */ +#define UART_BAUDRATE_BAUDRATE_Baud56000 (0x00E50000UL) /*!< 56000 baud (actual rate: 55944) */ +#define UART_BAUDRATE_BAUDRATE_Baud57600 (0x00EBF000UL) /*!< 57600 baud (actual rate: 57762) */ +#define UART_BAUDRATE_BAUDRATE_Baud76800 (0x013A9000UL) /*!< 76800 baud (actual rate: 76923) */ +#define UART_BAUDRATE_BAUDRATE_Baud115200 (0x01D7E000UL) /*!< 115200 baud (actual rate: 115942) */ +#define UART_BAUDRATE_BAUDRATE_Baud230400 (0x03AFB000UL) /*!< 230400 baud (actual rate: 231884) */ +#define UART_BAUDRATE_BAUDRATE_Baud250000 (0x04000000UL) /*!< 250000 baud */ +#define UART_BAUDRATE_BAUDRATE_Baud460800 (0x075F7000UL) /*!< 460800 baud (actual rate: 470588) */ +#define UART_BAUDRATE_BAUDRATE_Baud921600 (0x0EBED000UL) /*!< 921600 baud (actual rate: 941176) */ +#define UART_BAUDRATE_BAUDRATE_Baud1M (0x10000000UL) /*!< 1Mega baud */ + +/* Register: UART_CONFIG */ +/* Description: Configuration of parity and hardware flow control */ + +/* Bits 3..1 : Parity */ +#define UART_CONFIG_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UART_CONFIG_PARITY_Msk (0x7UL << UART_CONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UART_CONFIG_PARITY_Excluded (0x0UL) /*!< Exclude parity bit */ +#define UART_CONFIG_PARITY_Included (0x7UL) /*!< Include parity bit */ + +/* Bit 0 : Hardware flow control */ +#define UART_CONFIG_HWFC_Pos (0UL) /*!< Position of HWFC field. */ +#define UART_CONFIG_HWFC_Msk (0x1UL << UART_CONFIG_HWFC_Pos) /*!< Bit mask of HWFC field. */ +#define UART_CONFIG_HWFC_Disabled (0UL) /*!< Disabled */ +#define UART_CONFIG_HWFC_Enabled (1UL) /*!< Enabled */ + + +/* Peripheral: UARTE */ +/* Description: UART with EasyDMA 0 */ + +/* Register: UARTE_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 6 : Shortcut between ENDRX event and STOPRX task */ +#define UARTE_SHORTS_ENDRX_STOPRX_Pos (6UL) /*!< Position of ENDRX_STOPRX field. */ +#define UARTE_SHORTS_ENDRX_STOPRX_Msk (0x1UL << UARTE_SHORTS_ENDRX_STOPRX_Pos) /*!< Bit mask of ENDRX_STOPRX field. */ +#define UARTE_SHORTS_ENDRX_STOPRX_Disabled (0UL) /*!< Disable shortcut */ +#define UARTE_SHORTS_ENDRX_STOPRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 5 : Shortcut between ENDRX event and STARTRX task */ +#define UARTE_SHORTS_ENDRX_STARTRX_Pos (5UL) /*!< Position of ENDRX_STARTRX field. */ +#define UARTE_SHORTS_ENDRX_STARTRX_Msk (0x1UL << UARTE_SHORTS_ENDRX_STARTRX_Pos) /*!< Bit mask of ENDRX_STARTRX field. */ +#define UARTE_SHORTS_ENDRX_STARTRX_Disabled (0UL) /*!< Disable shortcut */ +#define UARTE_SHORTS_ENDRX_STARTRX_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: UARTE_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 22 : Enable or disable interrupt for TXSTOPPED event */ +#define UARTE_INTEN_TXSTOPPED_Pos (22UL) /*!< Position of TXSTOPPED field. */ +#define UARTE_INTEN_TXSTOPPED_Msk (0x1UL << UARTE_INTEN_TXSTOPPED_Pos) /*!< Bit mask of TXSTOPPED field. */ +#define UARTE_INTEN_TXSTOPPED_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_TXSTOPPED_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for TXSTARTED event */ +#define UARTE_INTEN_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define UARTE_INTEN_TXSTARTED_Msk (0x1UL << UARTE_INTEN_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define UARTE_INTEN_TXSTARTED_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_TXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for RXSTARTED event */ +#define UARTE_INTEN_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define UARTE_INTEN_RXSTARTED_Msk (0x1UL << UARTE_INTEN_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define UARTE_INTEN_RXSTARTED_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_RXSTARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 17 : Enable or disable interrupt for RXTO event */ +#define UARTE_INTEN_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UARTE_INTEN_RXTO_Msk (0x1UL << UARTE_INTEN_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UARTE_INTEN_RXTO_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_RXTO_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for ERROR event */ +#define UARTE_INTEN_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UARTE_INTEN_ERROR_Msk (0x1UL << UARTE_INTEN_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UARTE_INTEN_ERROR_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_ERROR_Enabled (1UL) /*!< Enable */ + +/* Bit 8 : Enable or disable interrupt for ENDTX event */ +#define UARTE_INTEN_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define UARTE_INTEN_ENDTX_Msk (0x1UL << UARTE_INTEN_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define UARTE_INTEN_ENDTX_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_ENDTX_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for TXDRDY event */ +#define UARTE_INTEN_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UARTE_INTEN_TXDRDY_Msk (0x1UL << UARTE_INTEN_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UARTE_INTEN_TXDRDY_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_TXDRDY_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for ENDRX event */ +#define UARTE_INTEN_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define UARTE_INTEN_ENDRX_Msk (0x1UL << UARTE_INTEN_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define UARTE_INTEN_ENDRX_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_ENDRX_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for RXDRDY event */ +#define UARTE_INTEN_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UARTE_INTEN_RXDRDY_Msk (0x1UL << UARTE_INTEN_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UARTE_INTEN_RXDRDY_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_RXDRDY_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for NCTS event */ +#define UARTE_INTEN_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UARTE_INTEN_NCTS_Msk (0x1UL << UARTE_INTEN_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UARTE_INTEN_NCTS_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_NCTS_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for CTS event */ +#define UARTE_INTEN_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UARTE_INTEN_CTS_Msk (0x1UL << UARTE_INTEN_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UARTE_INTEN_CTS_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_CTS_Enabled (1UL) /*!< Enable */ + +/* Register: UARTE_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 22 : Write '1' to Enable interrupt for TXSTOPPED event */ +#define UARTE_INTENSET_TXSTOPPED_Pos (22UL) /*!< Position of TXSTOPPED field. */ +#define UARTE_INTENSET_TXSTOPPED_Msk (0x1UL << UARTE_INTENSET_TXSTOPPED_Pos) /*!< Bit mask of TXSTOPPED field. */ +#define UARTE_INTENSET_TXSTOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_TXSTOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_TXSTOPPED_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for TXSTARTED event */ +#define UARTE_INTENSET_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define UARTE_INTENSET_TXSTARTED_Msk (0x1UL << UARTE_INTENSET_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define UARTE_INTENSET_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_TXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for RXSTARTED event */ +#define UARTE_INTENSET_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define UARTE_INTENSET_RXSTARTED_Msk (0x1UL << UARTE_INTENSET_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define UARTE_INTENSET_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_RXSTARTED_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for RXTO event */ +#define UARTE_INTENSET_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UARTE_INTENSET_RXTO_Msk (0x1UL << UARTE_INTENSET_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UARTE_INTENSET_RXTO_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_RXTO_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_RXTO_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ERROR event */ +#define UARTE_INTENSET_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UARTE_INTENSET_ERROR_Msk (0x1UL << UARTE_INTENSET_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UARTE_INTENSET_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_ERROR_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for ENDTX event */ +#define UARTE_INTENSET_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define UARTE_INTENSET_ENDTX_Msk (0x1UL << UARTE_INTENSET_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define UARTE_INTENSET_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_ENDTX_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for TXDRDY event */ +#define UARTE_INTENSET_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UARTE_INTENSET_TXDRDY_Msk (0x1UL << UARTE_INTENSET_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UARTE_INTENSET_TXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_TXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_TXDRDY_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for ENDRX event */ +#define UARTE_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define UARTE_INTENSET_ENDRX_Msk (0x1UL << UARTE_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define UARTE_INTENSET_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_ENDRX_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for RXDRDY event */ +#define UARTE_INTENSET_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UARTE_INTENSET_RXDRDY_Msk (0x1UL << UARTE_INTENSET_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UARTE_INTENSET_RXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_RXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_RXDRDY_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for NCTS event */ +#define UARTE_INTENSET_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UARTE_INTENSET_NCTS_Msk (0x1UL << UARTE_INTENSET_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UARTE_INTENSET_NCTS_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_NCTS_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_NCTS_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for CTS event */ +#define UARTE_INTENSET_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UARTE_INTENSET_CTS_Msk (0x1UL << UARTE_INTENSET_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UARTE_INTENSET_CTS_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_CTS_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_CTS_Set (1UL) /*!< Enable */ + +/* Register: UARTE_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 22 : Write '1' to Disable interrupt for TXSTOPPED event */ +#define UARTE_INTENCLR_TXSTOPPED_Pos (22UL) /*!< Position of TXSTOPPED field. */ +#define UARTE_INTENCLR_TXSTOPPED_Msk (0x1UL << UARTE_INTENCLR_TXSTOPPED_Pos) /*!< Bit mask of TXSTOPPED field. */ +#define UARTE_INTENCLR_TXSTOPPED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_TXSTOPPED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_TXSTOPPED_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for TXSTARTED event */ +#define UARTE_INTENCLR_TXSTARTED_Pos (20UL) /*!< Position of TXSTARTED field. */ +#define UARTE_INTENCLR_TXSTARTED_Msk (0x1UL << UARTE_INTENCLR_TXSTARTED_Pos) /*!< Bit mask of TXSTARTED field. */ +#define UARTE_INTENCLR_TXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_TXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_TXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for RXSTARTED event */ +#define UARTE_INTENCLR_RXSTARTED_Pos (19UL) /*!< Position of RXSTARTED field. */ +#define UARTE_INTENCLR_RXSTARTED_Msk (0x1UL << UARTE_INTENCLR_RXSTARTED_Pos) /*!< Bit mask of RXSTARTED field. */ +#define UARTE_INTENCLR_RXSTARTED_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_RXSTARTED_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_RXSTARTED_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for RXTO event */ +#define UARTE_INTENCLR_RXTO_Pos (17UL) /*!< Position of RXTO field. */ +#define UARTE_INTENCLR_RXTO_Msk (0x1UL << UARTE_INTENCLR_RXTO_Pos) /*!< Bit mask of RXTO field. */ +#define UARTE_INTENCLR_RXTO_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_RXTO_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_RXTO_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ERROR event */ +#define UARTE_INTENCLR_ERROR_Pos (9UL) /*!< Position of ERROR field. */ +#define UARTE_INTENCLR_ERROR_Msk (0x1UL << UARTE_INTENCLR_ERROR_Pos) /*!< Bit mask of ERROR field. */ +#define UARTE_INTENCLR_ERROR_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_ERROR_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_ERROR_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for ENDTX event */ +#define UARTE_INTENCLR_ENDTX_Pos (8UL) /*!< Position of ENDTX field. */ +#define UARTE_INTENCLR_ENDTX_Msk (0x1UL << UARTE_INTENCLR_ENDTX_Pos) /*!< Bit mask of ENDTX field. */ +#define UARTE_INTENCLR_ENDTX_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_ENDTX_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_ENDTX_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for TXDRDY event */ +#define UARTE_INTENCLR_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UARTE_INTENCLR_TXDRDY_Msk (0x1UL << UARTE_INTENCLR_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UARTE_INTENCLR_TXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_TXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_TXDRDY_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for ENDRX event */ +#define UARTE_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ +#define UARTE_INTENCLR_ENDRX_Msk (0x1UL << UARTE_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ +#define UARTE_INTENCLR_ENDRX_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for RXDRDY event */ +#define UARTE_INTENCLR_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UARTE_INTENCLR_RXDRDY_Msk (0x1UL << UARTE_INTENCLR_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UARTE_INTENCLR_RXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_RXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_RXDRDY_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for NCTS event */ +#define UARTE_INTENCLR_NCTS_Pos (1UL) /*!< Position of NCTS field. */ +#define UARTE_INTENCLR_NCTS_Msk (0x1UL << UARTE_INTENCLR_NCTS_Pos) /*!< Bit mask of NCTS field. */ +#define UARTE_INTENCLR_NCTS_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_NCTS_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_NCTS_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for CTS event */ +#define UARTE_INTENCLR_CTS_Pos (0UL) /*!< Position of CTS field. */ +#define UARTE_INTENCLR_CTS_Msk (0x1UL << UARTE_INTENCLR_CTS_Pos) /*!< Bit mask of CTS field. */ +#define UARTE_INTENCLR_CTS_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_CTS_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_CTS_Clear (1UL) /*!< Disable */ + +/* Register: UARTE_ERRORSRC */ +/* Description: Error source Note : this register is read / write one to clear. */ + +/* Bit 3 : Break condition */ +#define UARTE_ERRORSRC_BREAK_Pos (3UL) /*!< Position of BREAK field. */ +#define UARTE_ERRORSRC_BREAK_Msk (0x1UL << UARTE_ERRORSRC_BREAK_Pos) /*!< Bit mask of BREAK field. */ +#define UARTE_ERRORSRC_BREAK_NotPresent (0UL) /*!< Read: error not present */ +#define UARTE_ERRORSRC_BREAK_Present (1UL) /*!< Read: error present */ + +/* Bit 2 : Framing error occurred */ +#define UARTE_ERRORSRC_FRAMING_Pos (2UL) /*!< Position of FRAMING field. */ +#define UARTE_ERRORSRC_FRAMING_Msk (0x1UL << UARTE_ERRORSRC_FRAMING_Pos) /*!< Bit mask of FRAMING field. */ +#define UARTE_ERRORSRC_FRAMING_NotPresent (0UL) /*!< Read: error not present */ +#define UARTE_ERRORSRC_FRAMING_Present (1UL) /*!< Read: error present */ + +/* Bit 1 : Parity error */ +#define UARTE_ERRORSRC_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UARTE_ERRORSRC_PARITY_Msk (0x1UL << UARTE_ERRORSRC_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UARTE_ERRORSRC_PARITY_NotPresent (0UL) /*!< Read: error not present */ +#define UARTE_ERRORSRC_PARITY_Present (1UL) /*!< Read: error present */ + +/* Bit 0 : Overrun error */ +#define UARTE_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define UARTE_ERRORSRC_OVERRUN_Msk (0x1UL << UARTE_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define UARTE_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Read: error not present */ +#define UARTE_ERRORSRC_OVERRUN_Present (1UL) /*!< Read: error present */ + +/* Register: UARTE_ENABLE */ +/* Description: Enable UART */ + +/* Bits 3..0 : Enable or disable UARTE */ +#define UARTE_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define UARTE_ENABLE_ENABLE_Msk (0xFUL << UARTE_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define UARTE_ENABLE_ENABLE_Disabled (0UL) /*!< Disable UARTE */ +#define UARTE_ENABLE_ENABLE_Enabled (8UL) /*!< Enable UARTE */ + +/* Register: UARTE_PSEL_RTS */ +/* Description: Pin select for RTS signal */ + +/* Bit 31 : Connection */ +#define UARTE_PSEL_RTS_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UARTE_PSEL_RTS_CONNECT_Msk (0x1UL << UARTE_PSEL_RTS_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UARTE_PSEL_RTS_CONNECT_Connected (0UL) /*!< Connect */ +#define UARTE_PSEL_RTS_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define UARTE_PSEL_RTS_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UARTE_PSEL_RTS_PORT_Msk (0x3UL << UARTE_PSEL_RTS_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define UARTE_PSEL_RTS_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UARTE_PSEL_RTS_PIN_Msk (0x1FUL << UARTE_PSEL_RTS_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UARTE_PSEL_TXD */ +/* Description: Pin select for TXD signal */ + +/* Bit 31 : Connection */ +#define UARTE_PSEL_TXD_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UARTE_PSEL_TXD_CONNECT_Msk (0x1UL << UARTE_PSEL_TXD_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UARTE_PSEL_TXD_CONNECT_Connected (0UL) /*!< Connect */ +#define UARTE_PSEL_TXD_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define UARTE_PSEL_TXD_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UARTE_PSEL_TXD_PORT_Msk (0x3UL << UARTE_PSEL_TXD_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define UARTE_PSEL_TXD_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UARTE_PSEL_TXD_PIN_Msk (0x1FUL << UARTE_PSEL_TXD_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UARTE_PSEL_CTS */ +/* Description: Pin select for CTS signal */ + +/* Bit 31 : Connection */ +#define UARTE_PSEL_CTS_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UARTE_PSEL_CTS_CONNECT_Msk (0x1UL << UARTE_PSEL_CTS_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UARTE_PSEL_CTS_CONNECT_Connected (0UL) /*!< Connect */ +#define UARTE_PSEL_CTS_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define UARTE_PSEL_CTS_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UARTE_PSEL_CTS_PORT_Msk (0x3UL << UARTE_PSEL_CTS_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define UARTE_PSEL_CTS_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UARTE_PSEL_CTS_PIN_Msk (0x1FUL << UARTE_PSEL_CTS_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UARTE_PSEL_RXD */ +/* Description: Pin select for RXD signal */ + +/* Bit 31 : Connection */ +#define UARTE_PSEL_RXD_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UARTE_PSEL_RXD_CONNECT_Msk (0x1UL << UARTE_PSEL_RXD_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UARTE_PSEL_RXD_CONNECT_Connected (0UL) /*!< Connect */ +#define UARTE_PSEL_RXD_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number */ +#define UARTE_PSEL_RXD_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UARTE_PSEL_RXD_PORT_Msk (0x3UL << UARTE_PSEL_RXD_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number */ +#define UARTE_PSEL_RXD_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UARTE_PSEL_RXD_PIN_Msk (0x1FUL << UARTE_PSEL_RXD_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UARTE_BAUDRATE */ +/* Description: Baud rate. Accuracy depends on the HFCLK source selected. */ + +/* Bits 31..0 : Baud rate */ +#define UARTE_BAUDRATE_BAUDRATE_Pos (0UL) /*!< Position of BAUDRATE field. */ +#define UARTE_BAUDRATE_BAUDRATE_Msk (0xFFFFFFFFUL << UARTE_BAUDRATE_BAUDRATE_Pos) /*!< Bit mask of BAUDRATE field. */ +#define UARTE_BAUDRATE_BAUDRATE_Baud1200 (0x0004F000UL) /*!< 1200 baud (actual rate: 1205) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud2400 (0x0009D000UL) /*!< 2400 baud (actual rate: 2396) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud4800 (0x0013B000UL) /*!< 4800 baud (actual rate: 4808) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud9600 (0x00275000UL) /*!< 9600 baud (actual rate: 9598) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud14400 (0x003AF000UL) /*!< 14400 baud (actual rate: 14401) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud19200 (0x004EA000UL) /*!< 19200 baud (actual rate: 19208) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud28800 (0x0075C000UL) /*!< 28800 baud (actual rate: 28777) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud31250 (0x00800000UL) /*!< 31250 baud */ +#define UARTE_BAUDRATE_BAUDRATE_Baud38400 (0x009D0000UL) /*!< 38400 baud (actual rate: 38369) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud56000 (0x00E50000UL) /*!< 56000 baud (actual rate: 55944) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud57600 (0x00EB0000UL) /*!< 57600 baud (actual rate: 57554) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud76800 (0x013A9000UL) /*!< 76800 baud (actual rate: 76923) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud115200 (0x01D60000UL) /*!< 115200 baud (actual rate: 115108) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud230400 (0x03B00000UL) /*!< 230400 baud (actual rate: 231884) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud250000 (0x04000000UL) /*!< 250000 baud */ +#define UARTE_BAUDRATE_BAUDRATE_Baud460800 (0x07400000UL) /*!< 460800 baud (actual rate: 457143) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud921600 (0x0F000000UL) /*!< 921600 baud (actual rate: 941176) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud1M (0x10000000UL) /*!< 1Mega baud */ + +/* Register: UARTE_RXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define UARTE_RXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define UARTE_RXD_PTR_PTR_Msk (0xFFFFFFFFUL << UARTE_RXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: UARTE_RXD_MAXCNT */ +/* Description: Maximum number of bytes in receive buffer */ + +/* Bits 9..0 : Maximum number of bytes in receive buffer */ +#define UARTE_RXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define UARTE_RXD_MAXCNT_MAXCNT_Msk (0x3FFUL << UARTE_RXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: UARTE_RXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 9..0 : Number of bytes transferred in the last transaction */ +#define UARTE_RXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define UARTE_RXD_AMOUNT_AMOUNT_Msk (0x3FFUL << UARTE_RXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: UARTE_TXD_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer */ +#define UARTE_TXD_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define UARTE_TXD_PTR_PTR_Msk (0xFFFFFFFFUL << UARTE_TXD_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: UARTE_TXD_MAXCNT */ +/* Description: Maximum number of bytes in transmit buffer */ + +/* Bits 9..0 : Maximum number of bytes in transmit buffer */ +#define UARTE_TXD_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define UARTE_TXD_MAXCNT_MAXCNT_Msk (0x3FFUL << UARTE_TXD_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: UARTE_TXD_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 9..0 : Number of bytes transferred in the last transaction */ +#define UARTE_TXD_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define UARTE_TXD_AMOUNT_AMOUNT_Msk (0x3FFUL << UARTE_TXD_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: UARTE_CONFIG */ +/* Description: Configuration of parity and hardware flow control */ + +/* Bit 4 : Stop bits */ +#define UARTE_CONFIG_STOP_Pos (4UL) /*!< Position of STOP field. */ +#define UARTE_CONFIG_STOP_Msk (0x1UL << UARTE_CONFIG_STOP_Pos) /*!< Bit mask of STOP field. */ +#define UARTE_CONFIG_STOP_One (0UL) /*!< One stop bit */ +#define UARTE_CONFIG_STOP_Two (1UL) /*!< Two stop bits */ + +/* Bits 3..1 : Parity */ +#define UARTE_CONFIG_PARITY_Pos (1UL) /*!< Position of PARITY field. */ +#define UARTE_CONFIG_PARITY_Msk (0x7UL << UARTE_CONFIG_PARITY_Pos) /*!< Bit mask of PARITY field. */ +#define UARTE_CONFIG_PARITY_Excluded (0x0UL) /*!< Exclude parity bit */ +#define UARTE_CONFIG_PARITY_Included (0x7UL) /*!< Include even parity bit */ + +/* Bit 0 : Hardware flow control */ +#define UARTE_CONFIG_HWFC_Pos (0UL) /*!< Position of HWFC field. */ +#define UARTE_CONFIG_HWFC_Msk (0x1UL << UARTE_CONFIG_HWFC_Pos) /*!< Bit mask of HWFC field. */ +#define UARTE_CONFIG_HWFC_Disabled (0UL) /*!< Disabled */ +#define UARTE_CONFIG_HWFC_Enabled (1UL) /*!< Enabled */ + + +/* Peripheral: UICR */ +/* Description: User Information Configuration Registers */ + +/* Register: UICR_NRFFW */ +/* Description: Description collection[0]: Reserved for Nordic firmware design */ + +/* Bits 31..0 : Reserved for Nordic firmware design */ +#define UICR_NRFFW_NRFFW_Pos (0UL) /*!< Position of NRFFW field. */ +#define UICR_NRFFW_NRFFW_Msk (0xFFFFFFFFUL << UICR_NRFFW_NRFFW_Pos) /*!< Bit mask of NRFFW field. */ + +/* Register: UICR_NRFHW */ +/* Description: Description collection[0]: Reserved for Nordic hardware design */ + +/* Bits 31..0 : Reserved for Nordic hardware design */ +#define UICR_NRFHW_NRFHW_Pos (0UL) /*!< Position of NRFHW field. */ +#define UICR_NRFHW_NRFHW_Msk (0xFFFFFFFFUL << UICR_NRFHW_NRFHW_Pos) /*!< Bit mask of NRFHW field. */ + +/* Register: UICR_CUSTOMER */ +/* Description: Description collection[0]: Reserved for customer */ + +/* Bits 31..0 : Reserved for customer */ +#define UICR_CUSTOMER_CUSTOMER_Pos (0UL) /*!< Position of CUSTOMER field. */ +#define UICR_CUSTOMER_CUSTOMER_Msk (0xFFFFFFFFUL << UICR_CUSTOMER_CUSTOMER_Pos) /*!< Bit mask of CUSTOMER field. */ + +/* Register: UICR_PSELRESET */ +/* Description: Description collection[0]: Mapping of the nRESET function */ + +/* Bit 31 : Connection */ +#define UICR_PSELRESET_CONNECT_Pos (31UL) /*!< Position of CONNECT field. */ +#define UICR_PSELRESET_CONNECT_Msk (0x1UL << UICR_PSELRESET_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define UICR_PSELRESET_CONNECT_Connected (0UL) /*!< Connect */ +#define UICR_PSELRESET_CONNECT_Disconnected (1UL) /*!< Disconnect */ + +/* Bits 6..5 : Port number onto which nRESET is exposed */ +#define UICR_PSELRESET_PORT_Pos (5UL) /*!< Position of PORT field. */ +#define UICR_PSELRESET_PORT_Msk (0x3UL << UICR_PSELRESET_PORT_Pos) /*!< Bit mask of PORT field. */ + +/* Bits 4..0 : Pin number of PORT onto which nRESET is exposed */ +#define UICR_PSELRESET_PIN_Pos (0UL) /*!< Position of PIN field. */ +#define UICR_PSELRESET_PIN_Msk (0x1FUL << UICR_PSELRESET_PIN_Pos) /*!< Bit mask of PIN field. */ + +/* Register: UICR_APPROTECT */ +/* Description: Access port protection */ + +/* Bits 7..0 : Enable or disable Access Port protection. */ +#define UICR_APPROTECT_PALL_Pos (0UL) /*!< Position of PALL field. */ +#define UICR_APPROTECT_PALL_Msk (0xFFUL << UICR_APPROTECT_PALL_Pos) /*!< Bit mask of PALL field. */ +#define UICR_APPROTECT_PALL_Enabled (0x00UL) /*!< Enable */ +#define UICR_APPROTECT_PALL_Disabled (0xFFUL) /*!< Disable */ + +/* Register: UICR_NFCPINS */ +/* Description: Setting of pins dedicated to NFC functionality: NFC antenna or GPIO */ + +/* Bit 0 : Setting of pins dedicated to NFC functionality */ +#define UICR_NFCPINS_PROTECT_Pos (0UL) /*!< Position of PROTECT field. */ +#define UICR_NFCPINS_PROTECT_Msk (0x1UL << UICR_NFCPINS_PROTECT_Pos) /*!< Bit mask of PROTECT field. */ +#define UICR_NFCPINS_PROTECT_Disabled (0UL) /*!< Operation as GPIO pins. Same protection as normal GPIO pins */ +#define UICR_NFCPINS_PROTECT_NFC (1UL) /*!< Operation as NFC antenna pins. Configures the protection for NFC operation */ + +/* Register: UICR_EXTSUPPLY */ +/* Description: Enable external circuitry to be supplied from VDD pin. Applicable in 'High voltage mode' only. */ + +/* Bit 0 : Enable external circuitry to be supplied from VDD pin (output of REG0 stage). */ +#define UICR_EXTSUPPLY_EXTSUPPLY_Pos (0UL) /*!< Position of EXTSUPPLY field. */ +#define UICR_EXTSUPPLY_EXTSUPPLY_Msk (0x1UL << UICR_EXTSUPPLY_EXTSUPPLY_Pos) /*!< Bit mask of EXTSUPPLY field. */ +#define UICR_EXTSUPPLY_EXTSUPPLY_Disabled (0UL) /*!< No current can be drawn from the VDD pin. */ +#define UICR_EXTSUPPLY_EXTSUPPLY_Enabled (1UL) /*!< It is allowed to supply external circuitry from the VDD pin. */ + +/* Register: UICR_REGOUT0 */ +/* Description: GPIO reference voltage / external output supply voltage in 'High voltage mode'. */ + +/* Bits 2..0 : Output voltage from of REG0 regulator stage. The maximum output voltage from this stage is given as VDDH - VEXDIF. */ +#define UICR_REGOUT0_VOUT_Pos (0UL) /*!< Position of VOUT field. */ +#define UICR_REGOUT0_VOUT_Msk (0x7UL << UICR_REGOUT0_VOUT_Pos) /*!< Bit mask of VOUT field. */ +#define UICR_REGOUT0_VOUT_1V8 (0UL) /*!< 1.8 V */ +#define UICR_REGOUT0_VOUT_2V1 (1UL) /*!< 2.1 V */ +#define UICR_REGOUT0_VOUT_2V4 (2UL) /*!< 2.4 V */ +#define UICR_REGOUT0_VOUT_2V7 (3UL) /*!< 2.7 V */ +#define UICR_REGOUT0_VOUT_3V0 (4UL) /*!< 3.0 V */ +#define UICR_REGOUT0_VOUT_3V3 (5UL) /*!< 3.3 V */ +#define UICR_REGOUT0_VOUT_DEFAULT (7UL) /*!< Default voltage: 1.8 V */ + + +/* Peripheral: USBD */ +/* Description: Universal Serial Bus device */ + +/* Register: USBD_SHORTS */ +/* Description: Shortcut register */ + +/* Bit 4 : Shortcut between ENDEPOUT[0] event and EP0RCVOUT task */ +#define USBD_SHORTS_ENDEPOUT0_EP0RCVOUT_Pos (4UL) /*!< Position of ENDEPOUT0_EP0RCVOUT field. */ +#define USBD_SHORTS_ENDEPOUT0_EP0RCVOUT_Msk (0x1UL << USBD_SHORTS_ENDEPOUT0_EP0RCVOUT_Pos) /*!< Bit mask of ENDEPOUT0_EP0RCVOUT field. */ +#define USBD_SHORTS_ENDEPOUT0_EP0RCVOUT_Disabled (0UL) /*!< Disable shortcut */ +#define USBD_SHORTS_ENDEPOUT0_EP0RCVOUT_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 3 : Shortcut between ENDEPOUT[0] event and EP0STATUS task */ +#define USBD_SHORTS_ENDEPOUT0_EP0STATUS_Pos (3UL) /*!< Position of ENDEPOUT0_EP0STATUS field. */ +#define USBD_SHORTS_ENDEPOUT0_EP0STATUS_Msk (0x1UL << USBD_SHORTS_ENDEPOUT0_EP0STATUS_Pos) /*!< Bit mask of ENDEPOUT0_EP0STATUS field. */ +#define USBD_SHORTS_ENDEPOUT0_EP0STATUS_Disabled (0UL) /*!< Disable shortcut */ +#define USBD_SHORTS_ENDEPOUT0_EP0STATUS_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 2 : Shortcut between EP0DATADONE event and EP0STATUS task */ +#define USBD_SHORTS_EP0DATADONE_EP0STATUS_Pos (2UL) /*!< Position of EP0DATADONE_EP0STATUS field. */ +#define USBD_SHORTS_EP0DATADONE_EP0STATUS_Msk (0x1UL << USBD_SHORTS_EP0DATADONE_EP0STATUS_Pos) /*!< Bit mask of EP0DATADONE_EP0STATUS field. */ +#define USBD_SHORTS_EP0DATADONE_EP0STATUS_Disabled (0UL) /*!< Disable shortcut */ +#define USBD_SHORTS_EP0DATADONE_EP0STATUS_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 1 : Shortcut between EP0DATADONE event and STARTEPOUT[0] task */ +#define USBD_SHORTS_EP0DATADONE_STARTEPOUT0_Pos (1UL) /*!< Position of EP0DATADONE_STARTEPOUT0 field. */ +#define USBD_SHORTS_EP0DATADONE_STARTEPOUT0_Msk (0x1UL << USBD_SHORTS_EP0DATADONE_STARTEPOUT0_Pos) /*!< Bit mask of EP0DATADONE_STARTEPOUT0 field. */ +#define USBD_SHORTS_EP0DATADONE_STARTEPOUT0_Disabled (0UL) /*!< Disable shortcut */ +#define USBD_SHORTS_EP0DATADONE_STARTEPOUT0_Enabled (1UL) /*!< Enable shortcut */ + +/* Bit 0 : Shortcut between EP0DATADONE event and STARTEPIN[0] task */ +#define USBD_SHORTS_EP0DATADONE_STARTEPIN0_Pos (0UL) /*!< Position of EP0DATADONE_STARTEPIN0 field. */ +#define USBD_SHORTS_EP0DATADONE_STARTEPIN0_Msk (0x1UL << USBD_SHORTS_EP0DATADONE_STARTEPIN0_Pos) /*!< Bit mask of EP0DATADONE_STARTEPIN0 field. */ +#define USBD_SHORTS_EP0DATADONE_STARTEPIN0_Disabled (0UL) /*!< Disable shortcut */ +#define USBD_SHORTS_EP0DATADONE_STARTEPIN0_Enabled (1UL) /*!< Enable shortcut */ + +/* Register: USBD_INTEN */ +/* Description: Enable or disable interrupt */ + +/* Bit 25 : Enable or disable interrupt for ACCESSFAULT event */ +#define USBD_INTEN_ACCESSFAULT_Pos (25UL) /*!< Position of ACCESSFAULT field. */ +#define USBD_INTEN_ACCESSFAULT_Msk (0x1UL << USBD_INTEN_ACCESSFAULT_Pos) /*!< Bit mask of ACCESSFAULT field. */ +#define USBD_INTEN_ACCESSFAULT_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ACCESSFAULT_Enabled (1UL) /*!< Enable */ + +/* Bit 24 : Enable or disable interrupt for EPDATA event */ +#define USBD_INTEN_EPDATA_Pos (24UL) /*!< Position of EPDATA field. */ +#define USBD_INTEN_EPDATA_Msk (0x1UL << USBD_INTEN_EPDATA_Pos) /*!< Bit mask of EPDATA field. */ +#define USBD_INTEN_EPDATA_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_EPDATA_Enabled (1UL) /*!< Enable */ + +/* Bit 23 : Enable or disable interrupt for EP0SETUP event */ +#define USBD_INTEN_EP0SETUP_Pos (23UL) /*!< Position of EP0SETUP field. */ +#define USBD_INTEN_EP0SETUP_Msk (0x1UL << USBD_INTEN_EP0SETUP_Pos) /*!< Bit mask of EP0SETUP field. */ +#define USBD_INTEN_EP0SETUP_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_EP0SETUP_Enabled (1UL) /*!< Enable */ + +/* Bit 22 : Enable or disable interrupt for USBEVENT event */ +#define USBD_INTEN_USBEVENT_Pos (22UL) /*!< Position of USBEVENT field. */ +#define USBD_INTEN_USBEVENT_Msk (0x1UL << USBD_INTEN_USBEVENT_Pos) /*!< Bit mask of USBEVENT field. */ +#define USBD_INTEN_USBEVENT_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_USBEVENT_Enabled (1UL) /*!< Enable */ + +/* Bit 21 : Enable or disable interrupt for SOF event */ +#define USBD_INTEN_SOF_Pos (21UL) /*!< Position of SOF field. */ +#define USBD_INTEN_SOF_Msk (0x1UL << USBD_INTEN_SOF_Pos) /*!< Bit mask of SOF field. */ +#define USBD_INTEN_SOF_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_SOF_Enabled (1UL) /*!< Enable */ + +/* Bit 20 : Enable or disable interrupt for ENDISOOUT event */ +#define USBD_INTEN_ENDISOOUT_Pos (20UL) /*!< Position of ENDISOOUT field. */ +#define USBD_INTEN_ENDISOOUT_Msk (0x1UL << USBD_INTEN_ENDISOOUT_Pos) /*!< Bit mask of ENDISOOUT field. */ +#define USBD_INTEN_ENDISOOUT_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDISOOUT_Enabled (1UL) /*!< Enable */ + +/* Bit 19 : Enable or disable interrupt for ENDEPOUT[7] event */ +#define USBD_INTEN_ENDEPOUT7_Pos (19UL) /*!< Position of ENDEPOUT7 field. */ +#define USBD_INTEN_ENDEPOUT7_Msk (0x1UL << USBD_INTEN_ENDEPOUT7_Pos) /*!< Bit mask of ENDEPOUT7 field. */ +#define USBD_INTEN_ENDEPOUT7_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPOUT7_Enabled (1UL) /*!< Enable */ + +/* Bit 18 : Enable or disable interrupt for ENDEPOUT[6] event */ +#define USBD_INTEN_ENDEPOUT6_Pos (18UL) /*!< Position of ENDEPOUT6 field. */ +#define USBD_INTEN_ENDEPOUT6_Msk (0x1UL << USBD_INTEN_ENDEPOUT6_Pos) /*!< Bit mask of ENDEPOUT6 field. */ +#define USBD_INTEN_ENDEPOUT6_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPOUT6_Enabled (1UL) /*!< Enable */ + +/* Bit 17 : Enable or disable interrupt for ENDEPOUT[5] event */ +#define USBD_INTEN_ENDEPOUT5_Pos (17UL) /*!< Position of ENDEPOUT5 field. */ +#define USBD_INTEN_ENDEPOUT5_Msk (0x1UL << USBD_INTEN_ENDEPOUT5_Pos) /*!< Bit mask of ENDEPOUT5 field. */ +#define USBD_INTEN_ENDEPOUT5_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPOUT5_Enabled (1UL) /*!< Enable */ + +/* Bit 16 : Enable or disable interrupt for ENDEPOUT[4] event */ +#define USBD_INTEN_ENDEPOUT4_Pos (16UL) /*!< Position of ENDEPOUT4 field. */ +#define USBD_INTEN_ENDEPOUT4_Msk (0x1UL << USBD_INTEN_ENDEPOUT4_Pos) /*!< Bit mask of ENDEPOUT4 field. */ +#define USBD_INTEN_ENDEPOUT4_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPOUT4_Enabled (1UL) /*!< Enable */ + +/* Bit 15 : Enable or disable interrupt for ENDEPOUT[3] event */ +#define USBD_INTEN_ENDEPOUT3_Pos (15UL) /*!< Position of ENDEPOUT3 field. */ +#define USBD_INTEN_ENDEPOUT3_Msk (0x1UL << USBD_INTEN_ENDEPOUT3_Pos) /*!< Bit mask of ENDEPOUT3 field. */ +#define USBD_INTEN_ENDEPOUT3_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPOUT3_Enabled (1UL) /*!< Enable */ + +/* Bit 14 : Enable or disable interrupt for ENDEPOUT[2] event */ +#define USBD_INTEN_ENDEPOUT2_Pos (14UL) /*!< Position of ENDEPOUT2 field. */ +#define USBD_INTEN_ENDEPOUT2_Msk (0x1UL << USBD_INTEN_ENDEPOUT2_Pos) /*!< Bit mask of ENDEPOUT2 field. */ +#define USBD_INTEN_ENDEPOUT2_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPOUT2_Enabled (1UL) /*!< Enable */ + +/* Bit 13 : Enable or disable interrupt for ENDEPOUT[1] event */ +#define USBD_INTEN_ENDEPOUT1_Pos (13UL) /*!< Position of ENDEPOUT1 field. */ +#define USBD_INTEN_ENDEPOUT1_Msk (0x1UL << USBD_INTEN_ENDEPOUT1_Pos) /*!< Bit mask of ENDEPOUT1 field. */ +#define USBD_INTEN_ENDEPOUT1_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPOUT1_Enabled (1UL) /*!< Enable */ + +/* Bit 12 : Enable or disable interrupt for ENDEPOUT[0] event */ +#define USBD_INTEN_ENDEPOUT0_Pos (12UL) /*!< Position of ENDEPOUT0 field. */ +#define USBD_INTEN_ENDEPOUT0_Msk (0x1UL << USBD_INTEN_ENDEPOUT0_Pos) /*!< Bit mask of ENDEPOUT0 field. */ +#define USBD_INTEN_ENDEPOUT0_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPOUT0_Enabled (1UL) /*!< Enable */ + +/* Bit 11 : Enable or disable interrupt for ENDISOIN event */ +#define USBD_INTEN_ENDISOIN_Pos (11UL) /*!< Position of ENDISOIN field. */ +#define USBD_INTEN_ENDISOIN_Msk (0x1UL << USBD_INTEN_ENDISOIN_Pos) /*!< Bit mask of ENDISOIN field. */ +#define USBD_INTEN_ENDISOIN_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDISOIN_Enabled (1UL) /*!< Enable */ + +/* Bit 10 : Enable or disable interrupt for EP0DATADONE event */ +#define USBD_INTEN_EP0DATADONE_Pos (10UL) /*!< Position of EP0DATADONE field. */ +#define USBD_INTEN_EP0DATADONE_Msk (0x1UL << USBD_INTEN_EP0DATADONE_Pos) /*!< Bit mask of EP0DATADONE field. */ +#define USBD_INTEN_EP0DATADONE_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_EP0DATADONE_Enabled (1UL) /*!< Enable */ + +/* Bit 9 : Enable or disable interrupt for ENDEPIN[7] event */ +#define USBD_INTEN_ENDEPIN7_Pos (9UL) /*!< Position of ENDEPIN7 field. */ +#define USBD_INTEN_ENDEPIN7_Msk (0x1UL << USBD_INTEN_ENDEPIN7_Pos) /*!< Bit mask of ENDEPIN7 field. */ +#define USBD_INTEN_ENDEPIN7_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPIN7_Enabled (1UL) /*!< Enable */ + +/* Bit 8 : Enable or disable interrupt for ENDEPIN[6] event */ +#define USBD_INTEN_ENDEPIN6_Pos (8UL) /*!< Position of ENDEPIN6 field. */ +#define USBD_INTEN_ENDEPIN6_Msk (0x1UL << USBD_INTEN_ENDEPIN6_Pos) /*!< Bit mask of ENDEPIN6 field. */ +#define USBD_INTEN_ENDEPIN6_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPIN6_Enabled (1UL) /*!< Enable */ + +/* Bit 7 : Enable or disable interrupt for ENDEPIN[5] event */ +#define USBD_INTEN_ENDEPIN5_Pos (7UL) /*!< Position of ENDEPIN5 field. */ +#define USBD_INTEN_ENDEPIN5_Msk (0x1UL << USBD_INTEN_ENDEPIN5_Pos) /*!< Bit mask of ENDEPIN5 field. */ +#define USBD_INTEN_ENDEPIN5_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPIN5_Enabled (1UL) /*!< Enable */ + +/* Bit 6 : Enable or disable interrupt for ENDEPIN[4] event */ +#define USBD_INTEN_ENDEPIN4_Pos (6UL) /*!< Position of ENDEPIN4 field. */ +#define USBD_INTEN_ENDEPIN4_Msk (0x1UL << USBD_INTEN_ENDEPIN4_Pos) /*!< Bit mask of ENDEPIN4 field. */ +#define USBD_INTEN_ENDEPIN4_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPIN4_Enabled (1UL) /*!< Enable */ + +/* Bit 5 : Enable or disable interrupt for ENDEPIN[3] event */ +#define USBD_INTEN_ENDEPIN3_Pos (5UL) /*!< Position of ENDEPIN3 field. */ +#define USBD_INTEN_ENDEPIN3_Msk (0x1UL << USBD_INTEN_ENDEPIN3_Pos) /*!< Bit mask of ENDEPIN3 field. */ +#define USBD_INTEN_ENDEPIN3_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPIN3_Enabled (1UL) /*!< Enable */ + +/* Bit 4 : Enable or disable interrupt for ENDEPIN[2] event */ +#define USBD_INTEN_ENDEPIN2_Pos (4UL) /*!< Position of ENDEPIN2 field. */ +#define USBD_INTEN_ENDEPIN2_Msk (0x1UL << USBD_INTEN_ENDEPIN2_Pos) /*!< Bit mask of ENDEPIN2 field. */ +#define USBD_INTEN_ENDEPIN2_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPIN2_Enabled (1UL) /*!< Enable */ + +/* Bit 3 : Enable or disable interrupt for ENDEPIN[1] event */ +#define USBD_INTEN_ENDEPIN1_Pos (3UL) /*!< Position of ENDEPIN1 field. */ +#define USBD_INTEN_ENDEPIN1_Msk (0x1UL << USBD_INTEN_ENDEPIN1_Pos) /*!< Bit mask of ENDEPIN1 field. */ +#define USBD_INTEN_ENDEPIN1_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPIN1_Enabled (1UL) /*!< Enable */ + +/* Bit 2 : Enable or disable interrupt for ENDEPIN[0] event */ +#define USBD_INTEN_ENDEPIN0_Pos (2UL) /*!< Position of ENDEPIN0 field. */ +#define USBD_INTEN_ENDEPIN0_Msk (0x1UL << USBD_INTEN_ENDEPIN0_Pos) /*!< Bit mask of ENDEPIN0 field. */ +#define USBD_INTEN_ENDEPIN0_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_ENDEPIN0_Enabled (1UL) /*!< Enable */ + +/* Bit 1 : Enable or disable interrupt for STARTED event */ +#define USBD_INTEN_STARTED_Pos (1UL) /*!< Position of STARTED field. */ +#define USBD_INTEN_STARTED_Msk (0x1UL << USBD_INTEN_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define USBD_INTEN_STARTED_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_STARTED_Enabled (1UL) /*!< Enable */ + +/* Bit 0 : Enable or disable interrupt for USBRESET event */ +#define USBD_INTEN_USBRESET_Pos (0UL) /*!< Position of USBRESET field. */ +#define USBD_INTEN_USBRESET_Msk (0x1UL << USBD_INTEN_USBRESET_Pos) /*!< Bit mask of USBRESET field. */ +#define USBD_INTEN_USBRESET_Disabled (0UL) /*!< Disable */ +#define USBD_INTEN_USBRESET_Enabled (1UL) /*!< Enable */ + +/* Register: USBD_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 25 : Write '1' to Enable interrupt for ACCESSFAULT event */ +#define USBD_INTENSET_ACCESSFAULT_Pos (25UL) /*!< Position of ACCESSFAULT field. */ +#define USBD_INTENSET_ACCESSFAULT_Msk (0x1UL << USBD_INTENSET_ACCESSFAULT_Pos) /*!< Bit mask of ACCESSFAULT field. */ +#define USBD_INTENSET_ACCESSFAULT_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ACCESSFAULT_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ACCESSFAULT_Set (1UL) /*!< Enable */ + +/* Bit 24 : Write '1' to Enable interrupt for EPDATA event */ +#define USBD_INTENSET_EPDATA_Pos (24UL) /*!< Position of EPDATA field. */ +#define USBD_INTENSET_EPDATA_Msk (0x1UL << USBD_INTENSET_EPDATA_Pos) /*!< Bit mask of EPDATA field. */ +#define USBD_INTENSET_EPDATA_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_EPDATA_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_EPDATA_Set (1UL) /*!< Enable */ + +/* Bit 23 : Write '1' to Enable interrupt for EP0SETUP event */ +#define USBD_INTENSET_EP0SETUP_Pos (23UL) /*!< Position of EP0SETUP field. */ +#define USBD_INTENSET_EP0SETUP_Msk (0x1UL << USBD_INTENSET_EP0SETUP_Pos) /*!< Bit mask of EP0SETUP field. */ +#define USBD_INTENSET_EP0SETUP_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_EP0SETUP_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_EP0SETUP_Set (1UL) /*!< Enable */ + +/* Bit 22 : Write '1' to Enable interrupt for USBEVENT event */ +#define USBD_INTENSET_USBEVENT_Pos (22UL) /*!< Position of USBEVENT field. */ +#define USBD_INTENSET_USBEVENT_Msk (0x1UL << USBD_INTENSET_USBEVENT_Pos) /*!< Bit mask of USBEVENT field. */ +#define USBD_INTENSET_USBEVENT_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_USBEVENT_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_USBEVENT_Set (1UL) /*!< Enable */ + +/* Bit 21 : Write '1' to Enable interrupt for SOF event */ +#define USBD_INTENSET_SOF_Pos (21UL) /*!< Position of SOF field. */ +#define USBD_INTENSET_SOF_Msk (0x1UL << USBD_INTENSET_SOF_Pos) /*!< Bit mask of SOF field. */ +#define USBD_INTENSET_SOF_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_SOF_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_SOF_Set (1UL) /*!< Enable */ + +/* Bit 20 : Write '1' to Enable interrupt for ENDISOOUT event */ +#define USBD_INTENSET_ENDISOOUT_Pos (20UL) /*!< Position of ENDISOOUT field. */ +#define USBD_INTENSET_ENDISOOUT_Msk (0x1UL << USBD_INTENSET_ENDISOOUT_Pos) /*!< Bit mask of ENDISOOUT field. */ +#define USBD_INTENSET_ENDISOOUT_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDISOOUT_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDISOOUT_Set (1UL) /*!< Enable */ + +/* Bit 19 : Write '1' to Enable interrupt for ENDEPOUT[7] event */ +#define USBD_INTENSET_ENDEPOUT7_Pos (19UL) /*!< Position of ENDEPOUT7 field. */ +#define USBD_INTENSET_ENDEPOUT7_Msk (0x1UL << USBD_INTENSET_ENDEPOUT7_Pos) /*!< Bit mask of ENDEPOUT7 field. */ +#define USBD_INTENSET_ENDEPOUT7_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPOUT7_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPOUT7_Set (1UL) /*!< Enable */ + +/* Bit 18 : Write '1' to Enable interrupt for ENDEPOUT[6] event */ +#define USBD_INTENSET_ENDEPOUT6_Pos (18UL) /*!< Position of ENDEPOUT6 field. */ +#define USBD_INTENSET_ENDEPOUT6_Msk (0x1UL << USBD_INTENSET_ENDEPOUT6_Pos) /*!< Bit mask of ENDEPOUT6 field. */ +#define USBD_INTENSET_ENDEPOUT6_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPOUT6_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPOUT6_Set (1UL) /*!< Enable */ + +/* Bit 17 : Write '1' to Enable interrupt for ENDEPOUT[5] event */ +#define USBD_INTENSET_ENDEPOUT5_Pos (17UL) /*!< Position of ENDEPOUT5 field. */ +#define USBD_INTENSET_ENDEPOUT5_Msk (0x1UL << USBD_INTENSET_ENDEPOUT5_Pos) /*!< Bit mask of ENDEPOUT5 field. */ +#define USBD_INTENSET_ENDEPOUT5_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPOUT5_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPOUT5_Set (1UL) /*!< Enable */ + +/* Bit 16 : Write '1' to Enable interrupt for ENDEPOUT[4] event */ +#define USBD_INTENSET_ENDEPOUT4_Pos (16UL) /*!< Position of ENDEPOUT4 field. */ +#define USBD_INTENSET_ENDEPOUT4_Msk (0x1UL << USBD_INTENSET_ENDEPOUT4_Pos) /*!< Bit mask of ENDEPOUT4 field. */ +#define USBD_INTENSET_ENDEPOUT4_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPOUT4_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPOUT4_Set (1UL) /*!< Enable */ + +/* Bit 15 : Write '1' to Enable interrupt for ENDEPOUT[3] event */ +#define USBD_INTENSET_ENDEPOUT3_Pos (15UL) /*!< Position of ENDEPOUT3 field. */ +#define USBD_INTENSET_ENDEPOUT3_Msk (0x1UL << USBD_INTENSET_ENDEPOUT3_Pos) /*!< Bit mask of ENDEPOUT3 field. */ +#define USBD_INTENSET_ENDEPOUT3_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPOUT3_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPOUT3_Set (1UL) /*!< Enable */ + +/* Bit 14 : Write '1' to Enable interrupt for ENDEPOUT[2] event */ +#define USBD_INTENSET_ENDEPOUT2_Pos (14UL) /*!< Position of ENDEPOUT2 field. */ +#define USBD_INTENSET_ENDEPOUT2_Msk (0x1UL << USBD_INTENSET_ENDEPOUT2_Pos) /*!< Bit mask of ENDEPOUT2 field. */ +#define USBD_INTENSET_ENDEPOUT2_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPOUT2_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPOUT2_Set (1UL) /*!< Enable */ + +/* Bit 13 : Write '1' to Enable interrupt for ENDEPOUT[1] event */ +#define USBD_INTENSET_ENDEPOUT1_Pos (13UL) /*!< Position of ENDEPOUT1 field. */ +#define USBD_INTENSET_ENDEPOUT1_Msk (0x1UL << USBD_INTENSET_ENDEPOUT1_Pos) /*!< Bit mask of ENDEPOUT1 field. */ +#define USBD_INTENSET_ENDEPOUT1_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPOUT1_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPOUT1_Set (1UL) /*!< Enable */ + +/* Bit 12 : Write '1' to Enable interrupt for ENDEPOUT[0] event */ +#define USBD_INTENSET_ENDEPOUT0_Pos (12UL) /*!< Position of ENDEPOUT0 field. */ +#define USBD_INTENSET_ENDEPOUT0_Msk (0x1UL << USBD_INTENSET_ENDEPOUT0_Pos) /*!< Bit mask of ENDEPOUT0 field. */ +#define USBD_INTENSET_ENDEPOUT0_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPOUT0_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPOUT0_Set (1UL) /*!< Enable */ + +/* Bit 11 : Write '1' to Enable interrupt for ENDISOIN event */ +#define USBD_INTENSET_ENDISOIN_Pos (11UL) /*!< Position of ENDISOIN field. */ +#define USBD_INTENSET_ENDISOIN_Msk (0x1UL << USBD_INTENSET_ENDISOIN_Pos) /*!< Bit mask of ENDISOIN field. */ +#define USBD_INTENSET_ENDISOIN_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDISOIN_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDISOIN_Set (1UL) /*!< Enable */ + +/* Bit 10 : Write '1' to Enable interrupt for EP0DATADONE event */ +#define USBD_INTENSET_EP0DATADONE_Pos (10UL) /*!< Position of EP0DATADONE field. */ +#define USBD_INTENSET_EP0DATADONE_Msk (0x1UL << USBD_INTENSET_EP0DATADONE_Pos) /*!< Bit mask of EP0DATADONE field. */ +#define USBD_INTENSET_EP0DATADONE_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_EP0DATADONE_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_EP0DATADONE_Set (1UL) /*!< Enable */ + +/* Bit 9 : Write '1' to Enable interrupt for ENDEPIN[7] event */ +#define USBD_INTENSET_ENDEPIN7_Pos (9UL) /*!< Position of ENDEPIN7 field. */ +#define USBD_INTENSET_ENDEPIN7_Msk (0x1UL << USBD_INTENSET_ENDEPIN7_Pos) /*!< Bit mask of ENDEPIN7 field. */ +#define USBD_INTENSET_ENDEPIN7_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPIN7_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPIN7_Set (1UL) /*!< Enable */ + +/* Bit 8 : Write '1' to Enable interrupt for ENDEPIN[6] event */ +#define USBD_INTENSET_ENDEPIN6_Pos (8UL) /*!< Position of ENDEPIN6 field. */ +#define USBD_INTENSET_ENDEPIN6_Msk (0x1UL << USBD_INTENSET_ENDEPIN6_Pos) /*!< Bit mask of ENDEPIN6 field. */ +#define USBD_INTENSET_ENDEPIN6_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPIN6_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPIN6_Set (1UL) /*!< Enable */ + +/* Bit 7 : Write '1' to Enable interrupt for ENDEPIN[5] event */ +#define USBD_INTENSET_ENDEPIN5_Pos (7UL) /*!< Position of ENDEPIN5 field. */ +#define USBD_INTENSET_ENDEPIN5_Msk (0x1UL << USBD_INTENSET_ENDEPIN5_Pos) /*!< Bit mask of ENDEPIN5 field. */ +#define USBD_INTENSET_ENDEPIN5_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPIN5_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPIN5_Set (1UL) /*!< Enable */ + +/* Bit 6 : Write '1' to Enable interrupt for ENDEPIN[4] event */ +#define USBD_INTENSET_ENDEPIN4_Pos (6UL) /*!< Position of ENDEPIN4 field. */ +#define USBD_INTENSET_ENDEPIN4_Msk (0x1UL << USBD_INTENSET_ENDEPIN4_Pos) /*!< Bit mask of ENDEPIN4 field. */ +#define USBD_INTENSET_ENDEPIN4_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPIN4_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPIN4_Set (1UL) /*!< Enable */ + +/* Bit 5 : Write '1' to Enable interrupt for ENDEPIN[3] event */ +#define USBD_INTENSET_ENDEPIN3_Pos (5UL) /*!< Position of ENDEPIN3 field. */ +#define USBD_INTENSET_ENDEPIN3_Msk (0x1UL << USBD_INTENSET_ENDEPIN3_Pos) /*!< Bit mask of ENDEPIN3 field. */ +#define USBD_INTENSET_ENDEPIN3_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPIN3_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPIN3_Set (1UL) /*!< Enable */ + +/* Bit 4 : Write '1' to Enable interrupt for ENDEPIN[2] event */ +#define USBD_INTENSET_ENDEPIN2_Pos (4UL) /*!< Position of ENDEPIN2 field. */ +#define USBD_INTENSET_ENDEPIN2_Msk (0x1UL << USBD_INTENSET_ENDEPIN2_Pos) /*!< Bit mask of ENDEPIN2 field. */ +#define USBD_INTENSET_ENDEPIN2_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPIN2_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPIN2_Set (1UL) /*!< Enable */ + +/* Bit 3 : Write '1' to Enable interrupt for ENDEPIN[1] event */ +#define USBD_INTENSET_ENDEPIN1_Pos (3UL) /*!< Position of ENDEPIN1 field. */ +#define USBD_INTENSET_ENDEPIN1_Msk (0x1UL << USBD_INTENSET_ENDEPIN1_Pos) /*!< Bit mask of ENDEPIN1 field. */ +#define USBD_INTENSET_ENDEPIN1_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPIN1_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPIN1_Set (1UL) /*!< Enable */ + +/* Bit 2 : Write '1' to Enable interrupt for ENDEPIN[0] event */ +#define USBD_INTENSET_ENDEPIN0_Pos (2UL) /*!< Position of ENDEPIN0 field. */ +#define USBD_INTENSET_ENDEPIN0_Msk (0x1UL << USBD_INTENSET_ENDEPIN0_Pos) /*!< Bit mask of ENDEPIN0 field. */ +#define USBD_INTENSET_ENDEPIN0_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_ENDEPIN0_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_ENDEPIN0_Set (1UL) /*!< Enable */ + +/* Bit 1 : Write '1' to Enable interrupt for STARTED event */ +#define USBD_INTENSET_STARTED_Pos (1UL) /*!< Position of STARTED field. */ +#define USBD_INTENSET_STARTED_Msk (0x1UL << USBD_INTENSET_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define USBD_INTENSET_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_STARTED_Set (1UL) /*!< Enable */ + +/* Bit 0 : Write '1' to Enable interrupt for USBRESET event */ +#define USBD_INTENSET_USBRESET_Pos (0UL) /*!< Position of USBRESET field. */ +#define USBD_INTENSET_USBRESET_Msk (0x1UL << USBD_INTENSET_USBRESET_Pos) /*!< Bit mask of USBRESET field. */ +#define USBD_INTENSET_USBRESET_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENSET_USBRESET_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENSET_USBRESET_Set (1UL) /*!< Enable */ + +/* Register: USBD_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 25 : Write '1' to Disable interrupt for ACCESSFAULT event */ +#define USBD_INTENCLR_ACCESSFAULT_Pos (25UL) /*!< Position of ACCESSFAULT field. */ +#define USBD_INTENCLR_ACCESSFAULT_Msk (0x1UL << USBD_INTENCLR_ACCESSFAULT_Pos) /*!< Bit mask of ACCESSFAULT field. */ +#define USBD_INTENCLR_ACCESSFAULT_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ACCESSFAULT_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ACCESSFAULT_Clear (1UL) /*!< Disable */ + +/* Bit 24 : Write '1' to Disable interrupt for EPDATA event */ +#define USBD_INTENCLR_EPDATA_Pos (24UL) /*!< Position of EPDATA field. */ +#define USBD_INTENCLR_EPDATA_Msk (0x1UL << USBD_INTENCLR_EPDATA_Pos) /*!< Bit mask of EPDATA field. */ +#define USBD_INTENCLR_EPDATA_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_EPDATA_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_EPDATA_Clear (1UL) /*!< Disable */ + +/* Bit 23 : Write '1' to Disable interrupt for EP0SETUP event */ +#define USBD_INTENCLR_EP0SETUP_Pos (23UL) /*!< Position of EP0SETUP field. */ +#define USBD_INTENCLR_EP0SETUP_Msk (0x1UL << USBD_INTENCLR_EP0SETUP_Pos) /*!< Bit mask of EP0SETUP field. */ +#define USBD_INTENCLR_EP0SETUP_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_EP0SETUP_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_EP0SETUP_Clear (1UL) /*!< Disable */ + +/* Bit 22 : Write '1' to Disable interrupt for USBEVENT event */ +#define USBD_INTENCLR_USBEVENT_Pos (22UL) /*!< Position of USBEVENT field. */ +#define USBD_INTENCLR_USBEVENT_Msk (0x1UL << USBD_INTENCLR_USBEVENT_Pos) /*!< Bit mask of USBEVENT field. */ +#define USBD_INTENCLR_USBEVENT_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_USBEVENT_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_USBEVENT_Clear (1UL) /*!< Disable */ + +/* Bit 21 : Write '1' to Disable interrupt for SOF event */ +#define USBD_INTENCLR_SOF_Pos (21UL) /*!< Position of SOF field. */ +#define USBD_INTENCLR_SOF_Msk (0x1UL << USBD_INTENCLR_SOF_Pos) /*!< Bit mask of SOF field. */ +#define USBD_INTENCLR_SOF_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_SOF_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_SOF_Clear (1UL) /*!< Disable */ + +/* Bit 20 : Write '1' to Disable interrupt for ENDISOOUT event */ +#define USBD_INTENCLR_ENDISOOUT_Pos (20UL) /*!< Position of ENDISOOUT field. */ +#define USBD_INTENCLR_ENDISOOUT_Msk (0x1UL << USBD_INTENCLR_ENDISOOUT_Pos) /*!< Bit mask of ENDISOOUT field. */ +#define USBD_INTENCLR_ENDISOOUT_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDISOOUT_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDISOOUT_Clear (1UL) /*!< Disable */ + +/* Bit 19 : Write '1' to Disable interrupt for ENDEPOUT[7] event */ +#define USBD_INTENCLR_ENDEPOUT7_Pos (19UL) /*!< Position of ENDEPOUT7 field. */ +#define USBD_INTENCLR_ENDEPOUT7_Msk (0x1UL << USBD_INTENCLR_ENDEPOUT7_Pos) /*!< Bit mask of ENDEPOUT7 field. */ +#define USBD_INTENCLR_ENDEPOUT7_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPOUT7_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPOUT7_Clear (1UL) /*!< Disable */ + +/* Bit 18 : Write '1' to Disable interrupt for ENDEPOUT[6] event */ +#define USBD_INTENCLR_ENDEPOUT6_Pos (18UL) /*!< Position of ENDEPOUT6 field. */ +#define USBD_INTENCLR_ENDEPOUT6_Msk (0x1UL << USBD_INTENCLR_ENDEPOUT6_Pos) /*!< Bit mask of ENDEPOUT6 field. */ +#define USBD_INTENCLR_ENDEPOUT6_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPOUT6_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPOUT6_Clear (1UL) /*!< Disable */ + +/* Bit 17 : Write '1' to Disable interrupt for ENDEPOUT[5] event */ +#define USBD_INTENCLR_ENDEPOUT5_Pos (17UL) /*!< Position of ENDEPOUT5 field. */ +#define USBD_INTENCLR_ENDEPOUT5_Msk (0x1UL << USBD_INTENCLR_ENDEPOUT5_Pos) /*!< Bit mask of ENDEPOUT5 field. */ +#define USBD_INTENCLR_ENDEPOUT5_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPOUT5_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPOUT5_Clear (1UL) /*!< Disable */ + +/* Bit 16 : Write '1' to Disable interrupt for ENDEPOUT[4] event */ +#define USBD_INTENCLR_ENDEPOUT4_Pos (16UL) /*!< Position of ENDEPOUT4 field. */ +#define USBD_INTENCLR_ENDEPOUT4_Msk (0x1UL << USBD_INTENCLR_ENDEPOUT4_Pos) /*!< Bit mask of ENDEPOUT4 field. */ +#define USBD_INTENCLR_ENDEPOUT4_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPOUT4_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPOUT4_Clear (1UL) /*!< Disable */ + +/* Bit 15 : Write '1' to Disable interrupt for ENDEPOUT[3] event */ +#define USBD_INTENCLR_ENDEPOUT3_Pos (15UL) /*!< Position of ENDEPOUT3 field. */ +#define USBD_INTENCLR_ENDEPOUT3_Msk (0x1UL << USBD_INTENCLR_ENDEPOUT3_Pos) /*!< Bit mask of ENDEPOUT3 field. */ +#define USBD_INTENCLR_ENDEPOUT3_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPOUT3_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPOUT3_Clear (1UL) /*!< Disable */ + +/* Bit 14 : Write '1' to Disable interrupt for ENDEPOUT[2] event */ +#define USBD_INTENCLR_ENDEPOUT2_Pos (14UL) /*!< Position of ENDEPOUT2 field. */ +#define USBD_INTENCLR_ENDEPOUT2_Msk (0x1UL << USBD_INTENCLR_ENDEPOUT2_Pos) /*!< Bit mask of ENDEPOUT2 field. */ +#define USBD_INTENCLR_ENDEPOUT2_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPOUT2_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPOUT2_Clear (1UL) /*!< Disable */ + +/* Bit 13 : Write '1' to Disable interrupt for ENDEPOUT[1] event */ +#define USBD_INTENCLR_ENDEPOUT1_Pos (13UL) /*!< Position of ENDEPOUT1 field. */ +#define USBD_INTENCLR_ENDEPOUT1_Msk (0x1UL << USBD_INTENCLR_ENDEPOUT1_Pos) /*!< Bit mask of ENDEPOUT1 field. */ +#define USBD_INTENCLR_ENDEPOUT1_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPOUT1_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPOUT1_Clear (1UL) /*!< Disable */ + +/* Bit 12 : Write '1' to Disable interrupt for ENDEPOUT[0] event */ +#define USBD_INTENCLR_ENDEPOUT0_Pos (12UL) /*!< Position of ENDEPOUT0 field. */ +#define USBD_INTENCLR_ENDEPOUT0_Msk (0x1UL << USBD_INTENCLR_ENDEPOUT0_Pos) /*!< Bit mask of ENDEPOUT0 field. */ +#define USBD_INTENCLR_ENDEPOUT0_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPOUT0_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPOUT0_Clear (1UL) /*!< Disable */ + +/* Bit 11 : Write '1' to Disable interrupt for ENDISOIN event */ +#define USBD_INTENCLR_ENDISOIN_Pos (11UL) /*!< Position of ENDISOIN field. */ +#define USBD_INTENCLR_ENDISOIN_Msk (0x1UL << USBD_INTENCLR_ENDISOIN_Pos) /*!< Bit mask of ENDISOIN field. */ +#define USBD_INTENCLR_ENDISOIN_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDISOIN_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDISOIN_Clear (1UL) /*!< Disable */ + +/* Bit 10 : Write '1' to Disable interrupt for EP0DATADONE event */ +#define USBD_INTENCLR_EP0DATADONE_Pos (10UL) /*!< Position of EP0DATADONE field. */ +#define USBD_INTENCLR_EP0DATADONE_Msk (0x1UL << USBD_INTENCLR_EP0DATADONE_Pos) /*!< Bit mask of EP0DATADONE field. */ +#define USBD_INTENCLR_EP0DATADONE_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_EP0DATADONE_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_EP0DATADONE_Clear (1UL) /*!< Disable */ + +/* Bit 9 : Write '1' to Disable interrupt for ENDEPIN[7] event */ +#define USBD_INTENCLR_ENDEPIN7_Pos (9UL) /*!< Position of ENDEPIN7 field. */ +#define USBD_INTENCLR_ENDEPIN7_Msk (0x1UL << USBD_INTENCLR_ENDEPIN7_Pos) /*!< Bit mask of ENDEPIN7 field. */ +#define USBD_INTENCLR_ENDEPIN7_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPIN7_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPIN7_Clear (1UL) /*!< Disable */ + +/* Bit 8 : Write '1' to Disable interrupt for ENDEPIN[6] event */ +#define USBD_INTENCLR_ENDEPIN6_Pos (8UL) /*!< Position of ENDEPIN6 field. */ +#define USBD_INTENCLR_ENDEPIN6_Msk (0x1UL << USBD_INTENCLR_ENDEPIN6_Pos) /*!< Bit mask of ENDEPIN6 field. */ +#define USBD_INTENCLR_ENDEPIN6_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPIN6_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPIN6_Clear (1UL) /*!< Disable */ + +/* Bit 7 : Write '1' to Disable interrupt for ENDEPIN[5] event */ +#define USBD_INTENCLR_ENDEPIN5_Pos (7UL) /*!< Position of ENDEPIN5 field. */ +#define USBD_INTENCLR_ENDEPIN5_Msk (0x1UL << USBD_INTENCLR_ENDEPIN5_Pos) /*!< Bit mask of ENDEPIN5 field. */ +#define USBD_INTENCLR_ENDEPIN5_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPIN5_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPIN5_Clear (1UL) /*!< Disable */ + +/* Bit 6 : Write '1' to Disable interrupt for ENDEPIN[4] event */ +#define USBD_INTENCLR_ENDEPIN4_Pos (6UL) /*!< Position of ENDEPIN4 field. */ +#define USBD_INTENCLR_ENDEPIN4_Msk (0x1UL << USBD_INTENCLR_ENDEPIN4_Pos) /*!< Bit mask of ENDEPIN4 field. */ +#define USBD_INTENCLR_ENDEPIN4_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPIN4_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPIN4_Clear (1UL) /*!< Disable */ + +/* Bit 5 : Write '1' to Disable interrupt for ENDEPIN[3] event */ +#define USBD_INTENCLR_ENDEPIN3_Pos (5UL) /*!< Position of ENDEPIN3 field. */ +#define USBD_INTENCLR_ENDEPIN3_Msk (0x1UL << USBD_INTENCLR_ENDEPIN3_Pos) /*!< Bit mask of ENDEPIN3 field. */ +#define USBD_INTENCLR_ENDEPIN3_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPIN3_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPIN3_Clear (1UL) /*!< Disable */ + +/* Bit 4 : Write '1' to Disable interrupt for ENDEPIN[2] event */ +#define USBD_INTENCLR_ENDEPIN2_Pos (4UL) /*!< Position of ENDEPIN2 field. */ +#define USBD_INTENCLR_ENDEPIN2_Msk (0x1UL << USBD_INTENCLR_ENDEPIN2_Pos) /*!< Bit mask of ENDEPIN2 field. */ +#define USBD_INTENCLR_ENDEPIN2_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPIN2_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPIN2_Clear (1UL) /*!< Disable */ + +/* Bit 3 : Write '1' to Disable interrupt for ENDEPIN[1] event */ +#define USBD_INTENCLR_ENDEPIN1_Pos (3UL) /*!< Position of ENDEPIN1 field. */ +#define USBD_INTENCLR_ENDEPIN1_Msk (0x1UL << USBD_INTENCLR_ENDEPIN1_Pos) /*!< Bit mask of ENDEPIN1 field. */ +#define USBD_INTENCLR_ENDEPIN1_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPIN1_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPIN1_Clear (1UL) /*!< Disable */ + +/* Bit 2 : Write '1' to Disable interrupt for ENDEPIN[0] event */ +#define USBD_INTENCLR_ENDEPIN0_Pos (2UL) /*!< Position of ENDEPIN0 field. */ +#define USBD_INTENCLR_ENDEPIN0_Msk (0x1UL << USBD_INTENCLR_ENDEPIN0_Pos) /*!< Bit mask of ENDEPIN0 field. */ +#define USBD_INTENCLR_ENDEPIN0_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_ENDEPIN0_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_ENDEPIN0_Clear (1UL) /*!< Disable */ + +/* Bit 1 : Write '1' to Disable interrupt for STARTED event */ +#define USBD_INTENCLR_STARTED_Pos (1UL) /*!< Position of STARTED field. */ +#define USBD_INTENCLR_STARTED_Msk (0x1UL << USBD_INTENCLR_STARTED_Pos) /*!< Bit mask of STARTED field. */ +#define USBD_INTENCLR_STARTED_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_STARTED_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_STARTED_Clear (1UL) /*!< Disable */ + +/* Bit 0 : Write '1' to Disable interrupt for USBRESET event */ +#define USBD_INTENCLR_USBRESET_Pos (0UL) /*!< Position of USBRESET field. */ +#define USBD_INTENCLR_USBRESET_Msk (0x1UL << USBD_INTENCLR_USBRESET_Pos) /*!< Bit mask of USBRESET field. */ +#define USBD_INTENCLR_USBRESET_Disabled (0UL) /*!< Read: Disabled */ +#define USBD_INTENCLR_USBRESET_Enabled (1UL) /*!< Read: Enabled */ +#define USBD_INTENCLR_USBRESET_Clear (1UL) /*!< Disable */ + +/* Register: USBD_EVENTCAUSE */ +/* Description: Details on event that caused the USBEVENT event */ + +/* Bit 11 : Wrapper has re-initialized SFRs to the proper values. MAC is ready for normal operation. Write '1' to clear. */ +#define USBD_EVENTCAUSE_READY_Pos (11UL) /*!< Position of READY field. */ +#define USBD_EVENTCAUSE_READY_Msk (0x1UL << USBD_EVENTCAUSE_READY_Pos) /*!< Bit mask of READY field. */ +#define USBD_EVENTCAUSE_READY_NotDetected (0UL) /*!< USBEVENT was not issued due to USBD peripheral ready */ +#define USBD_EVENTCAUSE_READY_Ready (1UL) /*!< USBD peripheral is ready */ + +/* Bit 9 : Signals that a RESUME condition (K state or activity restart) has been detected on the USB lines. Write '1' to clear. */ +#define USBD_EVENTCAUSE_RESUME_Pos (9UL) /*!< Position of RESUME field. */ +#define USBD_EVENTCAUSE_RESUME_Msk (0x1UL << USBD_EVENTCAUSE_RESUME_Pos) /*!< Bit mask of RESUME field. */ +#define USBD_EVENTCAUSE_RESUME_NotDetected (0UL) /*!< Resume not detected */ +#define USBD_EVENTCAUSE_RESUME_Detected (1UL) /*!< Resume detected */ + +/* Bit 8 : Signals that the USB lines have been seen idle long enough for the device to enter suspend. Write '1' to clear. */ +#define USBD_EVENTCAUSE_SUSPEND_Pos (8UL) /*!< Position of SUSPEND field. */ +#define USBD_EVENTCAUSE_SUSPEND_Msk (0x1UL << USBD_EVENTCAUSE_SUSPEND_Pos) /*!< Bit mask of SUSPEND field. */ +#define USBD_EVENTCAUSE_SUSPEND_NotDetected (0UL) /*!< Suspend not detected */ +#define USBD_EVENTCAUSE_SUSPEND_Detected (1UL) /*!< Suspend detected */ + +/* Bit 0 : CRC error was detected on isochronous OUT endpoint 8. Write '1' to clear. */ +#define USBD_EVENTCAUSE_ISOOUTCRC_Pos (0UL) /*!< Position of ISOOUTCRC field. */ +#define USBD_EVENTCAUSE_ISOOUTCRC_Msk (0x1UL << USBD_EVENTCAUSE_ISOOUTCRC_Pos) /*!< Bit mask of ISOOUTCRC field. */ +#define USBD_EVENTCAUSE_ISOOUTCRC_NotDetected (0UL) /*!< No error detected */ +#define USBD_EVENTCAUSE_ISOOUTCRC_Detected (1UL) /*!< Error detected */ + +/* Register: USBD_BUSSTATE */ +/* Description: Provides the logic state of the D+ and D- lines */ + +/* Bit 1 : State of the D+ line */ +#define USBD_BUSSTATE_DP_Pos (1UL) /*!< Position of DP field. */ +#define USBD_BUSSTATE_DP_Msk (0x1UL << USBD_BUSSTATE_DP_Pos) /*!< Bit mask of DP field. */ +#define USBD_BUSSTATE_DP_Low (0UL) /*!< Low */ +#define USBD_BUSSTATE_DP_High (1UL) /*!< High */ + +/* Bit 0 : State of the D- line */ +#define USBD_BUSSTATE_DM_Pos (0UL) /*!< Position of DM field. */ +#define USBD_BUSSTATE_DM_Msk (0x1UL << USBD_BUSSTATE_DM_Pos) /*!< Bit mask of DM field. */ +#define USBD_BUSSTATE_DM_Low (0UL) /*!< Low */ +#define USBD_BUSSTATE_DM_High (1UL) /*!< High */ + +/* Register: USBD_HALTED_EPIN */ +/* Description: Description collection[0]: IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. */ + +/* Bits 15..0 : IN endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. */ +#define USBD_HALTED_EPIN_GETSTATUS_Pos (0UL) /*!< Position of GETSTATUS field. */ +#define USBD_HALTED_EPIN_GETSTATUS_Msk (0xFFFFUL << USBD_HALTED_EPIN_GETSTATUS_Pos) /*!< Bit mask of GETSTATUS field. */ +#define USBD_HALTED_EPIN_GETSTATUS_NotHalted (0UL) /*!< Endpoint is not halted */ +#define USBD_HALTED_EPIN_GETSTATUS_Halted (1UL) /*!< Endpoint is halted */ + +/* Register: USBD_HALTED_EPOUT */ +/* Description: Description collection[0]: OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. */ + +/* Bits 15..0 : OUT endpoint halted status. Can be used as is as response to a GetStatus() request to endpoint. */ +#define USBD_HALTED_EPOUT_GETSTATUS_Pos (0UL) /*!< Position of GETSTATUS field. */ +#define USBD_HALTED_EPOUT_GETSTATUS_Msk (0xFFFFUL << USBD_HALTED_EPOUT_GETSTATUS_Pos) /*!< Bit mask of GETSTATUS field. */ +#define USBD_HALTED_EPOUT_GETSTATUS_NotHalted (0UL) /*!< Endpoint is not halted */ +#define USBD_HALTED_EPOUT_GETSTATUS_Halted (1UL) /*!< Endpoint is halted */ + +/* Register: USBD_EPSTATUS */ +/* Description: Provides information on which endpoint's EasyDMA registers have been captured */ + +/* Bit 24 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT8_Pos (24UL) /*!< Position of EPOUT8 field. */ +#define USBD_EPSTATUS_EPOUT8_Msk (0x1UL << USBD_EPSTATUS_EPOUT8_Pos) /*!< Bit mask of EPOUT8 field. */ +#define USBD_EPSTATUS_EPOUT8_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT8_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 23 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT7_Pos (23UL) /*!< Position of EPOUT7 field. */ +#define USBD_EPSTATUS_EPOUT7_Msk (0x1UL << USBD_EPSTATUS_EPOUT7_Pos) /*!< Bit mask of EPOUT7 field. */ +#define USBD_EPSTATUS_EPOUT7_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT7_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 22 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT6_Pos (22UL) /*!< Position of EPOUT6 field. */ +#define USBD_EPSTATUS_EPOUT6_Msk (0x1UL << USBD_EPSTATUS_EPOUT6_Pos) /*!< Bit mask of EPOUT6 field. */ +#define USBD_EPSTATUS_EPOUT6_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT6_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 21 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT5_Pos (21UL) /*!< Position of EPOUT5 field. */ +#define USBD_EPSTATUS_EPOUT5_Msk (0x1UL << USBD_EPSTATUS_EPOUT5_Pos) /*!< Bit mask of EPOUT5 field. */ +#define USBD_EPSTATUS_EPOUT5_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT5_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 20 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT4_Pos (20UL) /*!< Position of EPOUT4 field. */ +#define USBD_EPSTATUS_EPOUT4_Msk (0x1UL << USBD_EPSTATUS_EPOUT4_Pos) /*!< Bit mask of EPOUT4 field. */ +#define USBD_EPSTATUS_EPOUT4_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT4_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 19 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT3_Pos (19UL) /*!< Position of EPOUT3 field. */ +#define USBD_EPSTATUS_EPOUT3_Msk (0x1UL << USBD_EPSTATUS_EPOUT3_Pos) /*!< Bit mask of EPOUT3 field. */ +#define USBD_EPSTATUS_EPOUT3_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT3_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 18 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT2_Pos (18UL) /*!< Position of EPOUT2 field. */ +#define USBD_EPSTATUS_EPOUT2_Msk (0x1UL << USBD_EPSTATUS_EPOUT2_Pos) /*!< Bit mask of EPOUT2 field. */ +#define USBD_EPSTATUS_EPOUT2_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT2_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 17 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT1_Pos (17UL) /*!< Position of EPOUT1 field. */ +#define USBD_EPSTATUS_EPOUT1_Msk (0x1UL << USBD_EPSTATUS_EPOUT1_Pos) /*!< Bit mask of EPOUT1 field. */ +#define USBD_EPSTATUS_EPOUT1_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT1_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 16 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPOUT0_Pos (16UL) /*!< Position of EPOUT0 field. */ +#define USBD_EPSTATUS_EPOUT0_Msk (0x1UL << USBD_EPSTATUS_EPOUT0_Pos) /*!< Bit mask of EPOUT0 field. */ +#define USBD_EPSTATUS_EPOUT0_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPOUT0_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 8 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN8_Pos (8UL) /*!< Position of EPIN8 field. */ +#define USBD_EPSTATUS_EPIN8_Msk (0x1UL << USBD_EPSTATUS_EPIN8_Pos) /*!< Bit mask of EPIN8 field. */ +#define USBD_EPSTATUS_EPIN8_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN8_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 7 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN7_Pos (7UL) /*!< Position of EPIN7 field. */ +#define USBD_EPSTATUS_EPIN7_Msk (0x1UL << USBD_EPSTATUS_EPIN7_Pos) /*!< Bit mask of EPIN7 field. */ +#define USBD_EPSTATUS_EPIN7_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN7_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 6 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN6_Pos (6UL) /*!< Position of EPIN6 field. */ +#define USBD_EPSTATUS_EPIN6_Msk (0x1UL << USBD_EPSTATUS_EPIN6_Pos) /*!< Bit mask of EPIN6 field. */ +#define USBD_EPSTATUS_EPIN6_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN6_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 5 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN5_Pos (5UL) /*!< Position of EPIN5 field. */ +#define USBD_EPSTATUS_EPIN5_Msk (0x1UL << USBD_EPSTATUS_EPIN5_Pos) /*!< Bit mask of EPIN5 field. */ +#define USBD_EPSTATUS_EPIN5_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN5_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 4 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN4_Pos (4UL) /*!< Position of EPIN4 field. */ +#define USBD_EPSTATUS_EPIN4_Msk (0x1UL << USBD_EPSTATUS_EPIN4_Pos) /*!< Bit mask of EPIN4 field. */ +#define USBD_EPSTATUS_EPIN4_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN4_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 3 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN3_Pos (3UL) /*!< Position of EPIN3 field. */ +#define USBD_EPSTATUS_EPIN3_Msk (0x1UL << USBD_EPSTATUS_EPIN3_Pos) /*!< Bit mask of EPIN3 field. */ +#define USBD_EPSTATUS_EPIN3_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN3_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 2 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN2_Pos (2UL) /*!< Position of EPIN2 field. */ +#define USBD_EPSTATUS_EPIN2_Msk (0x1UL << USBD_EPSTATUS_EPIN2_Pos) /*!< Bit mask of EPIN2 field. */ +#define USBD_EPSTATUS_EPIN2_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN2_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 1 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN1_Pos (1UL) /*!< Position of EPIN1 field. */ +#define USBD_EPSTATUS_EPIN1_Msk (0x1UL << USBD_EPSTATUS_EPIN1_Pos) /*!< Bit mask of EPIN1 field. */ +#define USBD_EPSTATUS_EPIN1_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN1_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Bit 0 : Endpoint's EasyDMA registers captured state. Write '1' to clear. */ +#define USBD_EPSTATUS_EPIN0_Pos (0UL) /*!< Position of EPIN0 field. */ +#define USBD_EPSTATUS_EPIN0_Msk (0x1UL << USBD_EPSTATUS_EPIN0_Pos) /*!< Bit mask of EPIN0 field. */ +#define USBD_EPSTATUS_EPIN0_NoData (0UL) /*!< EasyDMA registers have not been captured for this endpoint */ +#define USBD_EPSTATUS_EPIN0_DataDone (1UL) /*!< EasyDMA registers have been captured for this endpoint */ + +/* Register: USBD_EPDATASTATUS */ +/* Description: Provides information on which endpoint(s) an acknowledged data transfer has occurred (EPDATA event) */ + +/* Bit 23 : Acknowledged data transfer on this OUT endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPOUT7_Pos (23UL) /*!< Position of EPOUT7 field. */ +#define USBD_EPDATASTATUS_EPOUT7_Msk (0x1UL << USBD_EPDATASTATUS_EPOUT7_Pos) /*!< Bit mask of EPOUT7 field. */ +#define USBD_EPDATASTATUS_EPOUT7_NotStarted (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPOUT7_Started (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 22 : Acknowledged data transfer on this OUT endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPOUT6_Pos (22UL) /*!< Position of EPOUT6 field. */ +#define USBD_EPDATASTATUS_EPOUT6_Msk (0x1UL << USBD_EPDATASTATUS_EPOUT6_Pos) /*!< Bit mask of EPOUT6 field. */ +#define USBD_EPDATASTATUS_EPOUT6_NotStarted (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPOUT6_Started (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 21 : Acknowledged data transfer on this OUT endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPOUT5_Pos (21UL) /*!< Position of EPOUT5 field. */ +#define USBD_EPDATASTATUS_EPOUT5_Msk (0x1UL << USBD_EPDATASTATUS_EPOUT5_Pos) /*!< Bit mask of EPOUT5 field. */ +#define USBD_EPDATASTATUS_EPOUT5_NotStarted (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPOUT5_Started (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 20 : Acknowledged data transfer on this OUT endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPOUT4_Pos (20UL) /*!< Position of EPOUT4 field. */ +#define USBD_EPDATASTATUS_EPOUT4_Msk (0x1UL << USBD_EPDATASTATUS_EPOUT4_Pos) /*!< Bit mask of EPOUT4 field. */ +#define USBD_EPDATASTATUS_EPOUT4_NotStarted (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPOUT4_Started (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 19 : Acknowledged data transfer on this OUT endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPOUT3_Pos (19UL) /*!< Position of EPOUT3 field. */ +#define USBD_EPDATASTATUS_EPOUT3_Msk (0x1UL << USBD_EPDATASTATUS_EPOUT3_Pos) /*!< Bit mask of EPOUT3 field. */ +#define USBD_EPDATASTATUS_EPOUT3_NotStarted (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPOUT3_Started (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 18 : Acknowledged data transfer on this OUT endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPOUT2_Pos (18UL) /*!< Position of EPOUT2 field. */ +#define USBD_EPDATASTATUS_EPOUT2_Msk (0x1UL << USBD_EPDATASTATUS_EPOUT2_Pos) /*!< Bit mask of EPOUT2 field. */ +#define USBD_EPDATASTATUS_EPOUT2_NotStarted (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPOUT2_Started (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 17 : Acknowledged data transfer on this OUT endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPOUT1_Pos (17UL) /*!< Position of EPOUT1 field. */ +#define USBD_EPDATASTATUS_EPOUT1_Msk (0x1UL << USBD_EPDATASTATUS_EPOUT1_Pos) /*!< Bit mask of EPOUT1 field. */ +#define USBD_EPDATASTATUS_EPOUT1_NotStarted (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPOUT1_Started (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 7 : Acknowledged data transfer on this IN endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPIN7_Pos (7UL) /*!< Position of EPIN7 field. */ +#define USBD_EPDATASTATUS_EPIN7_Msk (0x1UL << USBD_EPDATASTATUS_EPIN7_Pos) /*!< Bit mask of EPIN7 field. */ +#define USBD_EPDATASTATUS_EPIN7_NotDone (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPIN7_DataDone (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 6 : Acknowledged data transfer on this IN endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPIN6_Pos (6UL) /*!< Position of EPIN6 field. */ +#define USBD_EPDATASTATUS_EPIN6_Msk (0x1UL << USBD_EPDATASTATUS_EPIN6_Pos) /*!< Bit mask of EPIN6 field. */ +#define USBD_EPDATASTATUS_EPIN6_NotDone (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPIN6_DataDone (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 5 : Acknowledged data transfer on this IN endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPIN5_Pos (5UL) /*!< Position of EPIN5 field. */ +#define USBD_EPDATASTATUS_EPIN5_Msk (0x1UL << USBD_EPDATASTATUS_EPIN5_Pos) /*!< Bit mask of EPIN5 field. */ +#define USBD_EPDATASTATUS_EPIN5_NotDone (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPIN5_DataDone (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 4 : Acknowledged data transfer on this IN endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPIN4_Pos (4UL) /*!< Position of EPIN4 field. */ +#define USBD_EPDATASTATUS_EPIN4_Msk (0x1UL << USBD_EPDATASTATUS_EPIN4_Pos) /*!< Bit mask of EPIN4 field. */ +#define USBD_EPDATASTATUS_EPIN4_NotDone (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPIN4_DataDone (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 3 : Acknowledged data transfer on this IN endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPIN3_Pos (3UL) /*!< Position of EPIN3 field. */ +#define USBD_EPDATASTATUS_EPIN3_Msk (0x1UL << USBD_EPDATASTATUS_EPIN3_Pos) /*!< Bit mask of EPIN3 field. */ +#define USBD_EPDATASTATUS_EPIN3_NotDone (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPIN3_DataDone (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 2 : Acknowledged data transfer on this IN endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPIN2_Pos (2UL) /*!< Position of EPIN2 field. */ +#define USBD_EPDATASTATUS_EPIN2_Msk (0x1UL << USBD_EPDATASTATUS_EPIN2_Pos) /*!< Bit mask of EPIN2 field. */ +#define USBD_EPDATASTATUS_EPIN2_NotDone (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPIN2_DataDone (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Bit 1 : Acknowledged data transfer on this IN endpoint. Write '1' to clear. */ +#define USBD_EPDATASTATUS_EPIN1_Pos (1UL) /*!< Position of EPIN1 field. */ +#define USBD_EPDATASTATUS_EPIN1_Msk (0x1UL << USBD_EPDATASTATUS_EPIN1_Pos) /*!< Bit mask of EPIN1 field. */ +#define USBD_EPDATASTATUS_EPIN1_NotDone (0UL) /*!< No acknowledged data transfer on this endpoint */ +#define USBD_EPDATASTATUS_EPIN1_DataDone (1UL) /*!< Acknowledged data transfer on this endpoint has occurred */ + +/* Register: USBD_USBADDR */ +/* Description: Device USB address */ + +/* Bits 6..0 : Device USB address */ +#define USBD_USBADDR_ADDR_Pos (0UL) /*!< Position of ADDR field. */ +#define USBD_USBADDR_ADDR_Msk (0x7FUL << USBD_USBADDR_ADDR_Pos) /*!< Bit mask of ADDR field. */ + +/* Register: USBD_BMREQUESTTYPE */ +/* Description: SETUP data, byte 0, bmRequestType */ + +/* Bit 7 : Data transfer direction */ +#define USBD_BMREQUESTTYPE_DIRECTION_Pos (7UL) /*!< Position of DIRECTION field. */ +#define USBD_BMREQUESTTYPE_DIRECTION_Msk (0x1UL << USBD_BMREQUESTTYPE_DIRECTION_Pos) /*!< Bit mask of DIRECTION field. */ +#define USBD_BMREQUESTTYPE_DIRECTION_HostToDevice (0UL) /*!< Host-to-device */ +#define USBD_BMREQUESTTYPE_DIRECTION_DeviceToHost (1UL) /*!< Device-to-host */ + +/* Bits 6..5 : Data transfer type */ +#define USBD_BMREQUESTTYPE_TYPE_Pos (5UL) /*!< Position of TYPE field. */ +#define USBD_BMREQUESTTYPE_TYPE_Msk (0x3UL << USBD_BMREQUESTTYPE_TYPE_Pos) /*!< Bit mask of TYPE field. */ +#define USBD_BMREQUESTTYPE_TYPE_Standard (0UL) /*!< Standard */ +#define USBD_BMREQUESTTYPE_TYPE_Class (1UL) /*!< Class */ +#define USBD_BMREQUESTTYPE_TYPE_Vendor (2UL) /*!< Vendor */ + +/* Bits 4..0 : Data transfer type */ +#define USBD_BMREQUESTTYPE_RECIPIENT_Pos (0UL) /*!< Position of RECIPIENT field. */ +#define USBD_BMREQUESTTYPE_RECIPIENT_Msk (0x1FUL << USBD_BMREQUESTTYPE_RECIPIENT_Pos) /*!< Bit mask of RECIPIENT field. */ +#define USBD_BMREQUESTTYPE_RECIPIENT_Device (0UL) /*!< Device */ +#define USBD_BMREQUESTTYPE_RECIPIENT_Interface (1UL) /*!< Interface */ +#define USBD_BMREQUESTTYPE_RECIPIENT_Endpoint (2UL) /*!< Endpoint */ +#define USBD_BMREQUESTTYPE_RECIPIENT_Other (3UL) /*!< Other */ + +/* Register: USBD_BREQUEST */ +/* Description: SETUP data, byte 1, bRequest */ + +/* Bits 7..0 : SETUP data, byte 1, bRequest. Values provides for standard requests only, user must implement Class and Vendor values. */ +#define USBD_BREQUEST_BREQUEST_Pos (0UL) /*!< Position of BREQUEST field. */ +#define USBD_BREQUEST_BREQUEST_Msk (0xFFUL << USBD_BREQUEST_BREQUEST_Pos) /*!< Bit mask of BREQUEST field. */ +#define USBD_BREQUEST_BREQUEST_STD_GET_STATUS (0UL) /*!< Standard request GET_STATUS */ +#define USBD_BREQUEST_BREQUEST_STD_CLEAR_FEATURE (1UL) /*!< Standard request CLEAR_FEATURE */ +#define USBD_BREQUEST_BREQUEST_STD_SET_FEATURE (3UL) /*!< Standard request SET_FEATURE */ +#define USBD_BREQUEST_BREQUEST_STD_SET_ADDRESS (5UL) /*!< Standard request SET_ADDRESS */ +#define USBD_BREQUEST_BREQUEST_STD_GET_DESCRIPTOR (6UL) /*!< Standard request GET_DESCRIPTOR */ +#define USBD_BREQUEST_BREQUEST_STD_SET_DESCRIPTOR (7UL) /*!< Standard request SET_DESCRIPTOR */ +#define USBD_BREQUEST_BREQUEST_STD_GET_CONFIGURATION (8UL) /*!< Standard request GET_CONFIGURATION */ +#define USBD_BREQUEST_BREQUEST_STD_SET_CONFIGURATION (9UL) /*!< Standard request SET_CONFIGURATION */ +#define USBD_BREQUEST_BREQUEST_STD_GET_INTERFACE (10UL) /*!< Standard request GET_INTERFACE */ +#define USBD_BREQUEST_BREQUEST_STD_SET_INTERFACE (11UL) /*!< Standard request SET_INTERFACE */ +#define USBD_BREQUEST_BREQUEST_STD_SYNCH_FRAME (12UL) /*!< Standard request SYNCH_FRAME */ + +/* Register: USBD_WVALUEL */ +/* Description: SETUP data, byte 2, LSB of wValue */ + +/* Bits 7..0 : SETUP data, byte 2, LSB of wValue */ +#define USBD_WVALUEL_WVALUEL_Pos (0UL) /*!< Position of WVALUEL field. */ +#define USBD_WVALUEL_WVALUEL_Msk (0xFFUL << USBD_WVALUEL_WVALUEL_Pos) /*!< Bit mask of WVALUEL field. */ + +/* Register: USBD_WVALUEH */ +/* Description: SETUP data, byte 3, MSB of wValue */ + +/* Bits 7..0 : SETUP data, byte 3, MSB of wValue */ +#define USBD_WVALUEH_WVALUEH_Pos (0UL) /*!< Position of WVALUEH field. */ +#define USBD_WVALUEH_WVALUEH_Msk (0xFFUL << USBD_WVALUEH_WVALUEH_Pos) /*!< Bit mask of WVALUEH field. */ + +/* Register: USBD_WINDEXL */ +/* Description: SETUP data, byte 4, LSB of wIndex */ + +/* Bits 7..0 : SETUP data, byte 4, LSB of wIndex */ +#define USBD_WINDEXL_WINDEXL_Pos (0UL) /*!< Position of WINDEXL field. */ +#define USBD_WINDEXL_WINDEXL_Msk (0xFFUL << USBD_WINDEXL_WINDEXL_Pos) /*!< Bit mask of WINDEXL field. */ + +/* Register: USBD_WINDEXH */ +/* Description: SETUP data, byte 5, MSB of wIndex */ + +/* Bits 7..0 : SETUP data, byte 5, MSB of wIndex */ +#define USBD_WINDEXH_WINDEXH_Pos (0UL) /*!< Position of WINDEXH field. */ +#define USBD_WINDEXH_WINDEXH_Msk (0xFFUL << USBD_WINDEXH_WINDEXH_Pos) /*!< Bit mask of WINDEXH field. */ + +/* Register: USBD_WLENGTHL */ +/* Description: SETUP data, byte 6, LSB of wLength */ + +/* Bits 7..0 : SETUP data, byte 6, LSB of wLength */ +#define USBD_WLENGTHL_WLENGTHL_Pos (0UL) /*!< Position of WLENGTHL field. */ +#define USBD_WLENGTHL_WLENGTHL_Msk (0xFFUL << USBD_WLENGTHL_WLENGTHL_Pos) /*!< Bit mask of WLENGTHL field. */ + +/* Register: USBD_WLENGTHH */ +/* Description: SETUP data, byte 7, MSB of wLength */ + +/* Bits 7..0 : SETUP data, byte 7, MSB of wLength */ +#define USBD_WLENGTHH_WLENGTHH_Pos (0UL) /*!< Position of WLENGTHH field. */ +#define USBD_WLENGTHH_WLENGTHH_Msk (0xFFUL << USBD_WLENGTHH_WLENGTHH_Pos) /*!< Bit mask of WLENGTHH field. */ + +/* Register: USBD_SIZE_EPOUT */ +/* Description: Description collection[0]: Amount of bytes received last in the data stage of this OUT endpoint */ + +/* Bits 6..0 : Amount of bytes received last in the data stage of this OUT endpoint */ +#define USBD_SIZE_EPOUT_SIZE_Pos (0UL) /*!< Position of SIZE field. */ +#define USBD_SIZE_EPOUT_SIZE_Msk (0x7FUL << USBD_SIZE_EPOUT_SIZE_Pos) /*!< Bit mask of SIZE field. */ + +/* Register: USBD_SIZE_ISOOUT */ +/* Description: Amount of bytes received last on this iso OUT data endpoint */ + +/* Bit 16 : Zero-length data packet received */ +#define USBD_SIZE_ISOOUT_ZERO_Pos (16UL) /*!< Position of ZERO field. */ +#define USBD_SIZE_ISOOUT_ZERO_Msk (0x1UL << USBD_SIZE_ISOOUT_ZERO_Pos) /*!< Bit mask of ZERO field. */ +#define USBD_SIZE_ISOOUT_ZERO_Normal (0UL) /*!< No zero-length data received, use value in SIZE */ +#define USBD_SIZE_ISOOUT_ZERO_ZeroData (1UL) /*!< Zero-length data received, ignore value in SIZE */ + +/* Bits 9..0 : Amount of bytes received last on this iso OUT data endpoint */ +#define USBD_SIZE_ISOOUT_SIZE_Pos (0UL) /*!< Position of SIZE field. */ +#define USBD_SIZE_ISOOUT_SIZE_Msk (0x3FFUL << USBD_SIZE_ISOOUT_SIZE_Pos) /*!< Bit mask of SIZE field. */ + +/* Register: USBD_ENABLE */ +/* Description: Enable USB */ + +/* Bit 0 : Enable USB */ +#define USBD_ENABLE_ENABLE_Pos (0UL) /*!< Position of ENABLE field. */ +#define USBD_ENABLE_ENABLE_Msk (0x1UL << USBD_ENABLE_ENABLE_Pos) /*!< Bit mask of ENABLE field. */ +#define USBD_ENABLE_ENABLE_Disabled (0UL) /*!< USB peripheral is disabled */ +#define USBD_ENABLE_ENABLE_Enabled (1UL) /*!< USB peripheral is enabled */ + +/* Register: USBD_USBPULLUP */ +/* Description: Control of the USB pull-up */ + +/* Bit 0 : Control of the USB pull-up on the D+ line */ +#define USBD_USBPULLUP_CONNECT_Pos (0UL) /*!< Position of CONNECT field. */ +#define USBD_USBPULLUP_CONNECT_Msk (0x1UL << USBD_USBPULLUP_CONNECT_Pos) /*!< Bit mask of CONNECT field. */ +#define USBD_USBPULLUP_CONNECT_Disabled (0UL) /*!< Pull-up is disconnected */ +#define USBD_USBPULLUP_CONNECT_Enabled (1UL) /*!< Pull-up is connected to D+ */ + +/* Register: USBD_DPDMVALUE */ +/* Description: State at which the DPDMDRIVE task will force D+ and D-. The DPDMNODRIVE task reverts the control of the lines to MAC IP (no forcing). */ + +/* Bits 4..0 : State at which the DPDMDRIVE task will force D+ and D- */ +#define USBD_DPDMVALUE_STATE_Pos (0UL) /*!< Position of STATE field. */ +#define USBD_DPDMVALUE_STATE_Msk (0x1FUL << USBD_DPDMVALUE_STATE_Pos) /*!< Bit mask of STATE field. */ +#define USBD_DPDMVALUE_STATE_Resume (1UL) /*!< D+ forced low, D- forced high (K state) for a timing pre-set in hardware (50 us or 5 ms, depending on bus state) */ +#define USBD_DPDMVALUE_STATE_J (2UL) /*!< D+ forced high, D- forced low (J state) */ +#define USBD_DPDMVALUE_STATE_K (4UL) /*!< D+ forced low, D- forced high (K state) */ + +/* Register: USBD_DTOGGLE */ +/* Description: Data toggle control and status. */ + +/* Bits 9..8 : Data toggle value */ +#define USBD_DTOGGLE_VALUE_Pos (8UL) /*!< Position of VALUE field. */ +#define USBD_DTOGGLE_VALUE_Msk (0x3UL << USBD_DTOGGLE_VALUE_Pos) /*!< Bit mask of VALUE field. */ +#define USBD_DTOGGLE_VALUE_Nop (0UL) /*!< No action on data toggle when writing the register with this value */ +#define USBD_DTOGGLE_VALUE_Data0 (1UL) /*!< Data toggle is DATA0 on endpoint set by EP and IO */ +#define USBD_DTOGGLE_VALUE_Data1 (2UL) /*!< Data toggle is DATA1 on endpoint set by EP and IO */ + +/* Bit 7 : Selects IN or OUT endpoint */ +#define USBD_DTOGGLE_IO_Pos (7UL) /*!< Position of IO field. */ +#define USBD_DTOGGLE_IO_Msk (0x1UL << USBD_DTOGGLE_IO_Pos) /*!< Bit mask of IO field. */ +#define USBD_DTOGGLE_IO_Out (0UL) /*!< Selects OUT endpoint */ +#define USBD_DTOGGLE_IO_In (1UL) /*!< Selects IN endpoint */ + +/* Bits 2..0 : Select bulk endpoint number */ +#define USBD_DTOGGLE_EP_Pos (0UL) /*!< Position of EP field. */ +#define USBD_DTOGGLE_EP_Msk (0x7UL << USBD_DTOGGLE_EP_Pos) /*!< Bit mask of EP field. */ + +/* Register: USBD_EPINEN */ +/* Description: Endpoint IN enable */ + +/* Bit 8 : Enable iso IN endpoint */ +#define USBD_EPINEN_ISOIN_Pos (8UL) /*!< Position of ISOIN field. */ +#define USBD_EPINEN_ISOIN_Msk (0x1UL << USBD_EPINEN_ISOIN_Pos) /*!< Bit mask of ISOIN field. */ +#define USBD_EPINEN_ISOIN_Disable (0UL) /*!< Disable iso IN endpoint 8 */ +#define USBD_EPINEN_ISOIN_Enable (1UL) /*!< Enable iso IN endpoint 8 */ + +/* Bit 7 : Enable IN endpoint 7 */ +#define USBD_EPINEN_IN7_Pos (7UL) /*!< Position of IN7 field. */ +#define USBD_EPINEN_IN7_Msk (0x1UL << USBD_EPINEN_IN7_Pos) /*!< Bit mask of IN7 field. */ +#define USBD_EPINEN_IN7_Disable (0UL) /*!< Disable endpoint IN 7 (no response to IN tokens) */ +#define USBD_EPINEN_IN7_Enable (1UL) /*!< Enable endpoint IN 7 (response to IN tokens) */ + +/* Bit 6 : Enable IN endpoint 6 */ +#define USBD_EPINEN_IN6_Pos (6UL) /*!< Position of IN6 field. */ +#define USBD_EPINEN_IN6_Msk (0x1UL << USBD_EPINEN_IN6_Pos) /*!< Bit mask of IN6 field. */ +#define USBD_EPINEN_IN6_Disable (0UL) /*!< Disable endpoint IN 6 (no response to IN tokens) */ +#define USBD_EPINEN_IN6_Enable (1UL) /*!< Enable endpoint IN 6 (response to IN tokens) */ + +/* Bit 5 : Enable IN endpoint 5 */ +#define USBD_EPINEN_IN5_Pos (5UL) /*!< Position of IN5 field. */ +#define USBD_EPINEN_IN5_Msk (0x1UL << USBD_EPINEN_IN5_Pos) /*!< Bit mask of IN5 field. */ +#define USBD_EPINEN_IN5_Disable (0UL) /*!< Disable endpoint IN 5 (no response to IN tokens) */ +#define USBD_EPINEN_IN5_Enable (1UL) /*!< Enable endpoint IN 5 (response to IN tokens) */ + +/* Bit 4 : Enable IN endpoint 4 */ +#define USBD_EPINEN_IN4_Pos (4UL) /*!< Position of IN4 field. */ +#define USBD_EPINEN_IN4_Msk (0x1UL << USBD_EPINEN_IN4_Pos) /*!< Bit mask of IN4 field. */ +#define USBD_EPINEN_IN4_Disable (0UL) /*!< Disable endpoint IN 4 (no response to IN tokens) */ +#define USBD_EPINEN_IN4_Enable (1UL) /*!< Enable endpoint IN 4 (response to IN tokens) */ + +/* Bit 3 : Enable IN endpoint 3 */ +#define USBD_EPINEN_IN3_Pos (3UL) /*!< Position of IN3 field. */ +#define USBD_EPINEN_IN3_Msk (0x1UL << USBD_EPINEN_IN3_Pos) /*!< Bit mask of IN3 field. */ +#define USBD_EPINEN_IN3_Disable (0UL) /*!< Disable endpoint IN 3 (no response to IN tokens) */ +#define USBD_EPINEN_IN3_Enable (1UL) /*!< Enable endpoint IN 3 (response to IN tokens) */ + +/* Bit 2 : Enable IN endpoint 2 */ +#define USBD_EPINEN_IN2_Pos (2UL) /*!< Position of IN2 field. */ +#define USBD_EPINEN_IN2_Msk (0x1UL << USBD_EPINEN_IN2_Pos) /*!< Bit mask of IN2 field. */ +#define USBD_EPINEN_IN2_Disable (0UL) /*!< Disable endpoint IN 2 (no response to IN tokens) */ +#define USBD_EPINEN_IN2_Enable (1UL) /*!< Enable endpoint IN 2 (response to IN tokens) */ + +/* Bit 1 : Enable IN endpoint 1 */ +#define USBD_EPINEN_IN1_Pos (1UL) /*!< Position of IN1 field. */ +#define USBD_EPINEN_IN1_Msk (0x1UL << USBD_EPINEN_IN1_Pos) /*!< Bit mask of IN1 field. */ +#define USBD_EPINEN_IN1_Disable (0UL) /*!< Disable endpoint IN 1 (no response to IN tokens) */ +#define USBD_EPINEN_IN1_Enable (1UL) /*!< Enable endpoint IN 1 (response to IN tokens) */ + +/* Bit 0 : Enable IN endpoint 0 */ +#define USBD_EPINEN_IN0_Pos (0UL) /*!< Position of IN0 field. */ +#define USBD_EPINEN_IN0_Msk (0x1UL << USBD_EPINEN_IN0_Pos) /*!< Bit mask of IN0 field. */ +#define USBD_EPINEN_IN0_Disable (0UL) /*!< Disable endpoint IN 0 (no response to IN tokens) */ +#define USBD_EPINEN_IN0_Enable (1UL) /*!< Enable endpoint IN 0 (response to IN tokens) */ + +/* Register: USBD_EPOUTEN */ +/* Description: Endpoint OUT enable */ + +/* Bit 8 : Enable iso OUT endpoint 8 */ +#define USBD_EPOUTEN_ISOOUT_Pos (8UL) /*!< Position of ISOOUT field. */ +#define USBD_EPOUTEN_ISOOUT_Msk (0x1UL << USBD_EPOUTEN_ISOOUT_Pos) /*!< Bit mask of ISOOUT field. */ +#define USBD_EPOUTEN_ISOOUT_Disable (0UL) /*!< Disable iso OUT endpoint 8 */ +#define USBD_EPOUTEN_ISOOUT_Enable (1UL) /*!< Enable iso OUT endpoint 8 */ + +/* Bit 7 : Enable OUT endpoint 7 */ +#define USBD_EPOUTEN_OUT7_Pos (7UL) /*!< Position of OUT7 field. */ +#define USBD_EPOUTEN_OUT7_Msk (0x1UL << USBD_EPOUTEN_OUT7_Pos) /*!< Bit mask of OUT7 field. */ +#define USBD_EPOUTEN_OUT7_Disable (0UL) /*!< Disable endpoint OUT 7 (no response to OUT tokens) */ +#define USBD_EPOUTEN_OUT7_Enable (1UL) /*!< Enable endpoint OUT 7 (response to OUT tokens) */ + +/* Bit 6 : Enable OUT endpoint 6 */ +#define USBD_EPOUTEN_OUT6_Pos (6UL) /*!< Position of OUT6 field. */ +#define USBD_EPOUTEN_OUT6_Msk (0x1UL << USBD_EPOUTEN_OUT6_Pos) /*!< Bit mask of OUT6 field. */ +#define USBD_EPOUTEN_OUT6_Disable (0UL) /*!< Disable endpoint OUT 6 (no response to OUT tokens) */ +#define USBD_EPOUTEN_OUT6_Enable (1UL) /*!< Enable endpoint OUT 6 (response to OUT tokens) */ + +/* Bit 5 : Enable OUT endpoint 5 */ +#define USBD_EPOUTEN_OUT5_Pos (5UL) /*!< Position of OUT5 field. */ +#define USBD_EPOUTEN_OUT5_Msk (0x1UL << USBD_EPOUTEN_OUT5_Pos) /*!< Bit mask of OUT5 field. */ +#define USBD_EPOUTEN_OUT5_Disable (0UL) /*!< Disable endpoint OUT 5 (no response to OUT tokens) */ +#define USBD_EPOUTEN_OUT5_Enable (1UL) /*!< Enable endpoint OUT 5 (response to OUT tokens) */ + +/* Bit 4 : Enable OUT endpoint 4 */ +#define USBD_EPOUTEN_OUT4_Pos (4UL) /*!< Position of OUT4 field. */ +#define USBD_EPOUTEN_OUT4_Msk (0x1UL << USBD_EPOUTEN_OUT4_Pos) /*!< Bit mask of OUT4 field. */ +#define USBD_EPOUTEN_OUT4_Disable (0UL) /*!< Disable endpoint OUT 4 (no response to OUT tokens) */ +#define USBD_EPOUTEN_OUT4_Enable (1UL) /*!< Enable endpoint OUT 4 (response to OUT tokens) */ + +/* Bit 3 : Enable OUT endpoint 3 */ +#define USBD_EPOUTEN_OUT3_Pos (3UL) /*!< Position of OUT3 field. */ +#define USBD_EPOUTEN_OUT3_Msk (0x1UL << USBD_EPOUTEN_OUT3_Pos) /*!< Bit mask of OUT3 field. */ +#define USBD_EPOUTEN_OUT3_Disable (0UL) /*!< Disable endpoint OUT 3 (no response to OUT tokens) */ +#define USBD_EPOUTEN_OUT3_Enable (1UL) /*!< Enable endpoint OUT 3 (response to OUT tokens) */ + +/* Bit 2 : Enable OUT endpoint 2 */ +#define USBD_EPOUTEN_OUT2_Pos (2UL) /*!< Position of OUT2 field. */ +#define USBD_EPOUTEN_OUT2_Msk (0x1UL << USBD_EPOUTEN_OUT2_Pos) /*!< Bit mask of OUT2 field. */ +#define USBD_EPOUTEN_OUT2_Disable (0UL) /*!< Disable endpoint OUT 2 (no response to OUT tokens) */ +#define USBD_EPOUTEN_OUT2_Enable (1UL) /*!< Enable endpoint OUT 2 (response to OUT tokens) */ + +/* Bit 1 : Enable OUT endpoint 1 */ +#define USBD_EPOUTEN_OUT1_Pos (1UL) /*!< Position of OUT1 field. */ +#define USBD_EPOUTEN_OUT1_Msk (0x1UL << USBD_EPOUTEN_OUT1_Pos) /*!< Bit mask of OUT1 field. */ +#define USBD_EPOUTEN_OUT1_Disable (0UL) /*!< Disable endpoint OUT 1 (no response to OUT tokens) */ +#define USBD_EPOUTEN_OUT1_Enable (1UL) /*!< Enable endpoint OUT 1 (response to OUT tokens) */ + +/* Bit 0 : Enable OUT endpoint 0 */ +#define USBD_EPOUTEN_OUT0_Pos (0UL) /*!< Position of OUT0 field. */ +#define USBD_EPOUTEN_OUT0_Msk (0x1UL << USBD_EPOUTEN_OUT0_Pos) /*!< Bit mask of OUT0 field. */ +#define USBD_EPOUTEN_OUT0_Disable (0UL) /*!< Disable endpoint OUT 0 (no response to OUT tokens) */ +#define USBD_EPOUTEN_OUT0_Enable (1UL) /*!< Enable endpoint OUT 0 (response to OUT tokens) */ + +/* Register: USBD_EPSTALL */ +/* Description: STALL endpoints */ + +/* Bit 8 : Stall selected endpoint */ +#define USBD_EPSTALL_STALL_Pos (8UL) /*!< Position of STALL field. */ +#define USBD_EPSTALL_STALL_Msk (0x1UL << USBD_EPSTALL_STALL_Pos) /*!< Bit mask of STALL field. */ +#define USBD_EPSTALL_STALL_UnStall (0UL) /*!< Don't stall selected endpoint */ +#define USBD_EPSTALL_STALL_Stall (1UL) /*!< Stall selected endpoint */ + +/* Bit 7 : Selects IN or OUT endpoint */ +#define USBD_EPSTALL_IO_Pos (7UL) /*!< Position of IO field. */ +#define USBD_EPSTALL_IO_Msk (0x1UL << USBD_EPSTALL_IO_Pos) /*!< Bit mask of IO field. */ +#define USBD_EPSTALL_IO_Out (0UL) /*!< Selects OUT endpoint */ +#define USBD_EPSTALL_IO_In (1UL) /*!< Selects IN endpoint */ + +/* Bits 2..0 : Select endpoint number */ +#define USBD_EPSTALL_EP_Pos (0UL) /*!< Position of EP field. */ +#define USBD_EPSTALL_EP_Msk (0x7UL << USBD_EPSTALL_EP_Pos) /*!< Bit mask of EP field. */ + +/* Register: USBD_ISOSPLIT */ +/* Description: Controls the split of ISO buffers */ + +/* Bits 15..0 : Controls the split of ISO buffers */ +#define USBD_ISOSPLIT_SPLIT_Pos (0UL) /*!< Position of SPLIT field. */ +#define USBD_ISOSPLIT_SPLIT_Msk (0xFFFFUL << USBD_ISOSPLIT_SPLIT_Pos) /*!< Bit mask of SPLIT field. */ +#define USBD_ISOSPLIT_SPLIT_OneDir (0x0000UL) /*!< Full buffer dedicated to either iso IN or OUT */ +#define USBD_ISOSPLIT_SPLIT_HalfIN (0x0080UL) /*!< Lower half for IN, upper half for OUT */ + +/* Register: USBD_FRAMECNTR */ +/* Description: Returns the current value of the start of frame counter */ + +/* Bits 10..0 : Returns the current value of the start of frame counter */ +#define USBD_FRAMECNTR_FRAMECNTR_Pos (0UL) /*!< Position of FRAMECNTR field. */ +#define USBD_FRAMECNTR_FRAMECNTR_Msk (0x7FFUL << USBD_FRAMECNTR_FRAMECNTR_Pos) /*!< Bit mask of FRAMECNTR field. */ + +/* Register: USBD_ISOINCONFIG */ +/* Description: Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent */ + +/* Bit 0 : Controls the response of the ISO IN endpoint to an IN token when no data is ready to be sent */ +#define USBD_ISOINCONFIG_RESPONSE_Pos (0UL) /*!< Position of RESPONSE field. */ +#define USBD_ISOINCONFIG_RESPONSE_Msk (0x1UL << USBD_ISOINCONFIG_RESPONSE_Pos) /*!< Bit mask of RESPONSE field. */ +#define USBD_ISOINCONFIG_RESPONSE_NoResp (0UL) /*!< Endpoint does not respond in that case */ +#define USBD_ISOINCONFIG_RESPONSE_ZeroData (1UL) /*!< Endpoint responds with a zero-length data packet in that case */ + +/* Register: USBD_EPIN_PTR */ +/* Description: Description cluster[0]: Data pointer */ + +/* Bits 31..0 : Data pointer. Accepts any address in Data RAM. */ +#define USBD_EPIN_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define USBD_EPIN_PTR_PTR_Msk (0xFFFFFFFFUL << USBD_EPIN_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: USBD_EPIN_MAXCNT */ +/* Description: Description cluster[0]: Maximum number of bytes to transfer */ + +/* Bits 6..0 : Maximum number of bytes to transfer */ +#define USBD_EPIN_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define USBD_EPIN_MAXCNT_MAXCNT_Msk (0x7FUL << USBD_EPIN_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: USBD_EPIN_AMOUNT */ +/* Description: Description cluster[0]: Number of bytes transferred in the last transaction */ + +/* Bits 6..0 : Number of bytes transferred in the last transaction */ +#define USBD_EPIN_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define USBD_EPIN_AMOUNT_AMOUNT_Msk (0x7FUL << USBD_EPIN_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: USBD_ISOIN_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer. Accepts any address in Data RAM. */ +#define USBD_ISOIN_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define USBD_ISOIN_PTR_PTR_Msk (0xFFFFFFFFUL << USBD_ISOIN_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: USBD_ISOIN_MAXCNT */ +/* Description: Maximum number of bytes to transfer */ + +/* Bits 9..0 : Maximum number of bytes to transfer */ +#define USBD_ISOIN_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define USBD_ISOIN_MAXCNT_MAXCNT_Msk (0x3FFUL << USBD_ISOIN_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: USBD_ISOIN_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 9..0 : Number of bytes transferred in the last transaction */ +#define USBD_ISOIN_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define USBD_ISOIN_AMOUNT_AMOUNT_Msk (0x3FFUL << USBD_ISOIN_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: USBD_EPOUT_PTR */ +/* Description: Description cluster[0]: Data pointer */ + +/* Bits 31..0 : Data pointer. Accepts any address in Data RAM. */ +#define USBD_EPOUT_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define USBD_EPOUT_PTR_PTR_Msk (0xFFFFFFFFUL << USBD_EPOUT_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: USBD_EPOUT_MAXCNT */ +/* Description: Description cluster[0]: Maximum number of bytes to transfer */ + +/* Bits 6..0 : Maximum number of bytes to transfer */ +#define USBD_EPOUT_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define USBD_EPOUT_MAXCNT_MAXCNT_Msk (0x7FUL << USBD_EPOUT_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: USBD_EPOUT_AMOUNT */ +/* Description: Description cluster[0]: Number of bytes transferred in the last transaction */ + +/* Bits 6..0 : Number of bytes transferred in the last transaction */ +#define USBD_EPOUT_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define USBD_EPOUT_AMOUNT_AMOUNT_Msk (0x7FUL << USBD_EPOUT_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + +/* Register: USBD_ISOOUT_PTR */ +/* Description: Data pointer */ + +/* Bits 31..0 : Data pointer. Accepts any address in Data RAM. */ +#define USBD_ISOOUT_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ +#define USBD_ISOOUT_PTR_PTR_Msk (0xFFFFFFFFUL << USBD_ISOOUT_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ + +/* Register: USBD_ISOOUT_MAXCNT */ +/* Description: Maximum number of bytes to transfer */ + +/* Bits 9..0 : Maximum number of bytes to transfer */ +#define USBD_ISOOUT_MAXCNT_MAXCNT_Pos (0UL) /*!< Position of MAXCNT field. */ +#define USBD_ISOOUT_MAXCNT_MAXCNT_Msk (0x3FFUL << USBD_ISOOUT_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: USBD_ISOOUT_AMOUNT */ +/* Description: Number of bytes transferred in the last transaction */ + +/* Bits 9..0 : Number of bytes transferred in the last transaction */ +#define USBD_ISOOUT_AMOUNT_AMOUNT_Pos (0UL) /*!< Position of AMOUNT field. */ +#define USBD_ISOOUT_AMOUNT_AMOUNT_Msk (0x3FFUL << USBD_ISOOUT_AMOUNT_AMOUNT_Pos) /*!< Bit mask of AMOUNT field. */ + + +/* Peripheral: WDT */ +/* Description: Watchdog Timer */ + +/* Register: WDT_INTENSET */ +/* Description: Enable interrupt */ + +/* Bit 0 : Write '1' to Enable interrupt for TIMEOUT event */ +#define WDT_INTENSET_TIMEOUT_Pos (0UL) /*!< Position of TIMEOUT field. */ +#define WDT_INTENSET_TIMEOUT_Msk (0x1UL << WDT_INTENSET_TIMEOUT_Pos) /*!< Bit mask of TIMEOUT field. */ +#define WDT_INTENSET_TIMEOUT_Disabled (0UL) /*!< Read: Disabled */ +#define WDT_INTENSET_TIMEOUT_Enabled (1UL) /*!< Read: Enabled */ +#define WDT_INTENSET_TIMEOUT_Set (1UL) /*!< Enable */ + +/* Register: WDT_INTENCLR */ +/* Description: Disable interrupt */ + +/* Bit 0 : Write '1' to Disable interrupt for TIMEOUT event */ +#define WDT_INTENCLR_TIMEOUT_Pos (0UL) /*!< Position of TIMEOUT field. */ +#define WDT_INTENCLR_TIMEOUT_Msk (0x1UL << WDT_INTENCLR_TIMEOUT_Pos) /*!< Bit mask of TIMEOUT field. */ +#define WDT_INTENCLR_TIMEOUT_Disabled (0UL) /*!< Read: Disabled */ +#define WDT_INTENCLR_TIMEOUT_Enabled (1UL) /*!< Read: Enabled */ +#define WDT_INTENCLR_TIMEOUT_Clear (1UL) /*!< Disable */ + +/* Register: WDT_RUNSTATUS */ +/* Description: Run status */ + +/* Bit 0 : Indicates whether or not the watchdog is running */ +#define WDT_RUNSTATUS_RUNSTATUS_Pos (0UL) /*!< Position of RUNSTATUS field. */ +#define WDT_RUNSTATUS_RUNSTATUS_Msk (0x1UL << WDT_RUNSTATUS_RUNSTATUS_Pos) /*!< Bit mask of RUNSTATUS field. */ +#define WDT_RUNSTATUS_RUNSTATUS_NotRunning (0UL) /*!< Watchdog not running */ +#define WDT_RUNSTATUS_RUNSTATUS_Running (1UL) /*!< Watchdog is running */ + +/* Register: WDT_REQSTATUS */ +/* Description: Request status */ + +/* Bit 7 : Request status for RR[7] register */ +#define WDT_REQSTATUS_RR7_Pos (7UL) /*!< Position of RR7 field. */ +#define WDT_REQSTATUS_RR7_Msk (0x1UL << WDT_REQSTATUS_RR7_Pos) /*!< Bit mask of RR7 field. */ +#define WDT_REQSTATUS_RR7_DisabledOrRequested (0UL) /*!< RR[7] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR7_EnabledAndUnrequested (1UL) /*!< RR[7] register is enabled, and are not yet requesting reload */ + +/* Bit 6 : Request status for RR[6] register */ +#define WDT_REQSTATUS_RR6_Pos (6UL) /*!< Position of RR6 field. */ +#define WDT_REQSTATUS_RR6_Msk (0x1UL << WDT_REQSTATUS_RR6_Pos) /*!< Bit mask of RR6 field. */ +#define WDT_REQSTATUS_RR6_DisabledOrRequested (0UL) /*!< RR[6] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR6_EnabledAndUnrequested (1UL) /*!< RR[6] register is enabled, and are not yet requesting reload */ + +/* Bit 5 : Request status for RR[5] register */ +#define WDT_REQSTATUS_RR5_Pos (5UL) /*!< Position of RR5 field. */ +#define WDT_REQSTATUS_RR5_Msk (0x1UL << WDT_REQSTATUS_RR5_Pos) /*!< Bit mask of RR5 field. */ +#define WDT_REQSTATUS_RR5_DisabledOrRequested (0UL) /*!< RR[5] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR5_EnabledAndUnrequested (1UL) /*!< RR[5] register is enabled, and are not yet requesting reload */ + +/* Bit 4 : Request status for RR[4] register */ +#define WDT_REQSTATUS_RR4_Pos (4UL) /*!< Position of RR4 field. */ +#define WDT_REQSTATUS_RR4_Msk (0x1UL << WDT_REQSTATUS_RR4_Pos) /*!< Bit mask of RR4 field. */ +#define WDT_REQSTATUS_RR4_DisabledOrRequested (0UL) /*!< RR[4] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR4_EnabledAndUnrequested (1UL) /*!< RR[4] register is enabled, and are not yet requesting reload */ + +/* Bit 3 : Request status for RR[3] register */ +#define WDT_REQSTATUS_RR3_Pos (3UL) /*!< Position of RR3 field. */ +#define WDT_REQSTATUS_RR3_Msk (0x1UL << WDT_REQSTATUS_RR3_Pos) /*!< Bit mask of RR3 field. */ +#define WDT_REQSTATUS_RR3_DisabledOrRequested (0UL) /*!< RR[3] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR3_EnabledAndUnrequested (1UL) /*!< RR[3] register is enabled, and are not yet requesting reload */ + +/* Bit 2 : Request status for RR[2] register */ +#define WDT_REQSTATUS_RR2_Pos (2UL) /*!< Position of RR2 field. */ +#define WDT_REQSTATUS_RR2_Msk (0x1UL << WDT_REQSTATUS_RR2_Pos) /*!< Bit mask of RR2 field. */ +#define WDT_REQSTATUS_RR2_DisabledOrRequested (0UL) /*!< RR[2] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR2_EnabledAndUnrequested (1UL) /*!< RR[2] register is enabled, and are not yet requesting reload */ + +/* Bit 1 : Request status for RR[1] register */ +#define WDT_REQSTATUS_RR1_Pos (1UL) /*!< Position of RR1 field. */ +#define WDT_REQSTATUS_RR1_Msk (0x1UL << WDT_REQSTATUS_RR1_Pos) /*!< Bit mask of RR1 field. */ +#define WDT_REQSTATUS_RR1_DisabledOrRequested (0UL) /*!< RR[1] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR1_EnabledAndUnrequested (1UL) /*!< RR[1] register is enabled, and are not yet requesting reload */ + +/* Bit 0 : Request status for RR[0] register */ +#define WDT_REQSTATUS_RR0_Pos (0UL) /*!< Position of RR0 field. */ +#define WDT_REQSTATUS_RR0_Msk (0x1UL << WDT_REQSTATUS_RR0_Pos) /*!< Bit mask of RR0 field. */ +#define WDT_REQSTATUS_RR0_DisabledOrRequested (0UL) /*!< RR[0] register is not enabled, or are already requesting reload */ +#define WDT_REQSTATUS_RR0_EnabledAndUnrequested (1UL) /*!< RR[0] register is enabled, and are not yet requesting reload */ + +/* Register: WDT_CRV */ +/* Description: Counter reload value */ + +/* Bits 31..0 : Counter reload value in number of cycles of the 32.768 kHz clock */ +#define WDT_CRV_CRV_Pos (0UL) /*!< Position of CRV field. */ +#define WDT_CRV_CRV_Msk (0xFFFFFFFFUL << WDT_CRV_CRV_Pos) /*!< Bit mask of CRV field. */ + +/* Register: WDT_RREN */ +/* Description: Enable register for reload request registers */ + +/* Bit 7 : Enable or disable RR[7] register */ +#define WDT_RREN_RR7_Pos (7UL) /*!< Position of RR7 field. */ +#define WDT_RREN_RR7_Msk (0x1UL << WDT_RREN_RR7_Pos) /*!< Bit mask of RR7 field. */ +#define WDT_RREN_RR7_Disabled (0UL) /*!< Disable RR[7] register */ +#define WDT_RREN_RR7_Enabled (1UL) /*!< Enable RR[7] register */ + +/* Bit 6 : Enable or disable RR[6] register */ +#define WDT_RREN_RR6_Pos (6UL) /*!< Position of RR6 field. */ +#define WDT_RREN_RR6_Msk (0x1UL << WDT_RREN_RR6_Pos) /*!< Bit mask of RR6 field. */ +#define WDT_RREN_RR6_Disabled (0UL) /*!< Disable RR[6] register */ +#define WDT_RREN_RR6_Enabled (1UL) /*!< Enable RR[6] register */ + +/* Bit 5 : Enable or disable RR[5] register */ +#define WDT_RREN_RR5_Pos (5UL) /*!< Position of RR5 field. */ +#define WDT_RREN_RR5_Msk (0x1UL << WDT_RREN_RR5_Pos) /*!< Bit mask of RR5 field. */ +#define WDT_RREN_RR5_Disabled (0UL) /*!< Disable RR[5] register */ +#define WDT_RREN_RR5_Enabled (1UL) /*!< Enable RR[5] register */ + +/* Bit 4 : Enable or disable RR[4] register */ +#define WDT_RREN_RR4_Pos (4UL) /*!< Position of RR4 field. */ +#define WDT_RREN_RR4_Msk (0x1UL << WDT_RREN_RR4_Pos) /*!< Bit mask of RR4 field. */ +#define WDT_RREN_RR4_Disabled (0UL) /*!< Disable RR[4] register */ +#define WDT_RREN_RR4_Enabled (1UL) /*!< Enable RR[4] register */ + +/* Bit 3 : Enable or disable RR[3] register */ +#define WDT_RREN_RR3_Pos (3UL) /*!< Position of RR3 field. */ +#define WDT_RREN_RR3_Msk (0x1UL << WDT_RREN_RR3_Pos) /*!< Bit mask of RR3 field. */ +#define WDT_RREN_RR3_Disabled (0UL) /*!< Disable RR[3] register */ +#define WDT_RREN_RR3_Enabled (1UL) /*!< Enable RR[3] register */ + +/* Bit 2 : Enable or disable RR[2] register */ +#define WDT_RREN_RR2_Pos (2UL) /*!< Position of RR2 field. */ +#define WDT_RREN_RR2_Msk (0x1UL << WDT_RREN_RR2_Pos) /*!< Bit mask of RR2 field. */ +#define WDT_RREN_RR2_Disabled (0UL) /*!< Disable RR[2] register */ +#define WDT_RREN_RR2_Enabled (1UL) /*!< Enable RR[2] register */ + +/* Bit 1 : Enable or disable RR[1] register */ +#define WDT_RREN_RR1_Pos (1UL) /*!< Position of RR1 field. */ +#define WDT_RREN_RR1_Msk (0x1UL << WDT_RREN_RR1_Pos) /*!< Bit mask of RR1 field. */ +#define WDT_RREN_RR1_Disabled (0UL) /*!< Disable RR[1] register */ +#define WDT_RREN_RR1_Enabled (1UL) /*!< Enable RR[1] register */ + +/* Bit 0 : Enable or disable RR[0] register */ +#define WDT_RREN_RR0_Pos (0UL) /*!< Position of RR0 field. */ +#define WDT_RREN_RR0_Msk (0x1UL << WDT_RREN_RR0_Pos) /*!< Bit mask of RR0 field. */ +#define WDT_RREN_RR0_Disabled (0UL) /*!< Disable RR[0] register */ +#define WDT_RREN_RR0_Enabled (1UL) /*!< Enable RR[0] register */ + +/* Register: WDT_CONFIG */ +/* Description: Configuration register */ + +/* Bit 3 : Configure the watchdog to either be paused, or kept running, while the CPU is halted by the debugger */ +#define WDT_CONFIG_HALT_Pos (3UL) /*!< Position of HALT field. */ +#define WDT_CONFIG_HALT_Msk (0x1UL << WDT_CONFIG_HALT_Pos) /*!< Bit mask of HALT field. */ +#define WDT_CONFIG_HALT_Pause (0UL) /*!< Pause watchdog while the CPU is halted by the debugger */ +#define WDT_CONFIG_HALT_Run (1UL) /*!< Keep the watchdog running while the CPU is halted by the debugger */ + +/* Bit 0 : Configure the watchdog to either be paused, or kept running, while the CPU is sleeping */ +#define WDT_CONFIG_SLEEP_Pos (0UL) /*!< Position of SLEEP field. */ +#define WDT_CONFIG_SLEEP_Msk (0x1UL << WDT_CONFIG_SLEEP_Pos) /*!< Bit mask of SLEEP field. */ +#define WDT_CONFIG_SLEEP_Pause (0UL) /*!< Pause watchdog while the CPU is sleeping */ +#define WDT_CONFIG_SLEEP_Run (1UL) /*!< Keep the watchdog running while the CPU is sleeping */ + +/* Register: WDT_RR */ +/* Description: Description collection[0]: Reload request 0 */ + +/* Bits 31..0 : Reload request register */ +#define WDT_RR_RR_Pos (0UL) /*!< Position of RR field. */ +#define WDT_RR_RR_Msk (0xFFFFFFFFUL << WDT_RR_RR_Pos) /*!< Bit mask of RR field. */ +#define WDT_RR_RR_Reload (0x6E524635UL) /*!< Value to request a reload of the watchdog timer */ + + +/*lint --flb "Leave library region" */ +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840_peripherals.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840_peripherals.h new file mode 100644 index 0000000000..ae39be8f4f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52840_peripherals.h @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _NRF52840_PERIPHERALS_H +#define _NRF52840_PERIPHERALS_H + + +/* Floating Point Unit */ +#define FPU_PRESENT +#define FPU_COUNT 1 + +/* Systick timer */ +#define SYSTICK_PRESENT +#define SYSTICK_COUNT 1 + +/* Software Interrupts */ +#define SWI_PRESENT +#define SWI_COUNT 6 + +/* Memory Watch Unit */ +#define MWU_PRESENT +#define MWU_COUNT 1 + +/* GPIO */ +#define GPIO_PRESENT +#define GPIO_COUNT 2 + +#define P0_PIN_NUM 32 +#define P1_PIN_NUM 16 + +/* ACL */ +#define ACL_PRESENT + +#define ACL_REGIONS_COUNT 8 + +/* Radio */ +#define RADIO_PRESENT +#define RADIO_COUNT 1 + +/* Accelerated Address Resolver */ +#define AAR_PRESENT +#define AAR_COUNT 1 + +#define AAR_MAX_IRK_NUM 16 + +/* AES Electronic CodeBook mode encryption */ +#define ECB_PRESENT +#define ECB_COUNT 1 + +/* AES CCM mode encryption */ +#define CCM_PRESENT +#define CCM_COUNT 1 + +/* NFC Tag */ +#define NFCT_PRESENT +#define NFCT_COUNT 1 + +/* Peripheral to Peripheral Interconnect */ +#define PPI_PRESENT +#define PPI_COUNT 1 + +#define PPI_CH_NUM 20 +#define PPI_GROUP_NUM 6 +#define PPI_FEATURE_FORKS_PRESENT + +/* Event Generator Unit */ +#define EGU_PRESENT +#define EGU_COUNT 6 + +#define EGU0_CH_NUM 16 +#define EGU1_CH_NUM 16 +#define EGU2_CH_NUM 16 +#define EGU3_CH_NUM 16 +#define EGU4_CH_NUM 16 +#define EGU5_CH_NUM 16 + +/* Timer/Counter */ +#define TIMER_PRESENT +#define TIMER_COUNT 5 + +#define TIMER0_MAX_SIZE 32 +#define TIMER1_MAX_SIZE 32 +#define TIMER2_MAX_SIZE 32 +#define TIMER3_MAX_SIZE 32 +#define TIMER4_MAX_SIZE 32 + +#define TIMER0_CC_NUM 4 +#define TIMER1_CC_NUM 4 +#define TIMER2_CC_NUM 4 +#define TIMER3_CC_NUM 6 +#define TIMER4_CC_NUM 6 + +/* Real Time Counter */ +#define RTC_PRESENT +#define RTC_COUNT 3 + +#define RTC0_CC_NUM 3 +#define RTC1_CC_NUM 4 +#define RTC2_CC_NUM 4 + +/* RNG */ +#define RNG_PRESENT +#define RNG_COUNT 1 + +/* Watchdog Timer */ +#define WDT_PRESENT +#define WDT_COUNT 1 + +/* Temperature Sensor */ +#define TEMP_PRESENT +#define TEMP_COUNT 1 + +/* Serial Peripheral Interface Master */ +#define SPI_PRESENT +#define SPI_COUNT 3 + +/* Serial Peripheral Interface Master with DMA */ +#define SPIM_PRESENT +#define SPIM_COUNT 4 + +#define SPIM0_MAX_DATARATE 8 +#define SPIM1_MAX_DATARATE 8 +#define SPIM2_MAX_DATARATE 8 +#define SPIM3_MAX_DATARATE 32 + +#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0 +#define SPIM1_FEATURE_HARDWARE_CSN_PRESENT 0 +#define SPIM2_FEATURE_HARDWARE_CSN_PRESENT 0 +#define SPIM3_FEATURE_HARDWARE_CSN_PRESENT 1 + +/* Serial Peripheral Interface Slave with DMA*/ +#define SPIS_PRESENT +#define SPIS_COUNT 3 + +/* Two Wire Interface Master */ +#define TWI_PRESENT +#define TWI_COUNT 2 + +/* Two Wire Interface Master with DMA */ +#define TWIM_PRESENT +#define TWIM_COUNT 2 + +/* Two Wire Interface Slave with DMA */ +#define TWIS_PRESENT +#define TWIS_COUNT 2 + +/* Universal Asynchronous Receiver-Transmitter */ +#define UART_PRESENT +#define UART_COUNT 1 + +/* Universal Asynchronous Receiver-Transmitter with DMA */ +#define UARTE_PRESENT +#define UARTE_COUNT 2 + +/* Quadrature Decoder */ +#define QDEC_PRESENT +#define QDEC_COUNT 1 + +/* Successive Approximation Analog to Digital Converter */ +#define SAADC_PRESENT +#define SAADC_COUNT 1 + +/* GPIO Tasks and Events */ +#define GPIOTE_PRESENT +#define GPIOTE_COUNT 1 + +#define GPIOTE_CH_NUM 8 + +#define GPIOTE_FEATURE_SET_PRESENT +#define GPIOTE_FEATURE_CLR_PRESENT + +/* Low Power Comparator */ +#define LPCOMP_PRESENT +#define LPCOMP_COUNT 1 + +#define LPCOMP_REFSEL_RESOLUTION 16 + +#define LPCOMP_FEATURE_HYST_PRESENT + +/* Comparator */ +#define COMP_PRESENT +#define COMP_COUNT 1 + +/* Pulse Width Modulator */ +#define PWM_PRESENT +#define PWM_COUNT 4 + +#define PWM0_CH_NUM 4 +#define PWM1_CH_NUM 4 +#define PWM2_CH_NUM 4 +#define PWM3_CH_NUM 4 + +/* Pulse Density Modulator */ +#define PDM_PRESENT +#define PDM_COUNT 1 + +/* Inter-IC Sound Interface */ +#define I2S_PRESENT +#define I2S_COUNT 1 + +/* Universal Serial Bus Device */ +#define USBD_PRESENT +#define USBD_COUNT 1 + +/* ARM TrustZone Cryptocell 310 */ +#define CRYPTOCELL_PRESENT +#define CRYPTOCELL_COUNT 1 + +/* Quad SPI */ +#define QSPI_PRESENT +#define QSPI_COUNT 1 + +#endif // _NRF52840_PERIPHERALS_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_bitfields.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_bitfields.h index c7802c46a3..9debbb6a26 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_bitfields.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_bitfields.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,7 +35,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - + #ifndef __NRF52_BITS_H #define __NRF52_BITS_H @@ -137,2292 +137,6 @@ #define AAR_SCRATCHPTR_SCRATCHPTR_Msk (0xFFFFFFFFUL << AAR_SCRATCHPTR_SCRATCHPTR_Pos) /*!< Bit mask of SCRATCHPTR field. */ -/* Peripheral: AMLI */ -/* Description: AHB Multi-Layer Interface */ - -/* Register: AMLI_RAMPRI_CPU0 */ -/* Description: AHB bus master priority register for CPU0 */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_CPU0_RAM7_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CPU0_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_CPU0_RAM6_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CPU0_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_CPU0_RAM5_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CPU0_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_CPU0_RAM4_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CPU0_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_CPU0_RAM3_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CPU0_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_CPU0_RAM2_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CPU0_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_CPU0_RAM1_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CPU0_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_CPU0_RAM0_Msk (0xFUL << AMLI_RAMPRI_CPU0_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CPU0_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_SPIS1 */ -/* Description: AHB bus master priority register for SPIM1, SPIS1, TWIM1 and TWIS1 */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SPIS1_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SPIS1_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SPIS1_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SPIS1_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SPIS1_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SPIS1_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SPIS1_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Msk (0xFUL << AMLI_RAMPRI_SPIS1_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SPIS1_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_RADIO */ -/* Description: AHB bus master priority register for RADIO */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_RADIO_RAM7_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_RADIO_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_RADIO_RAM6_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_RADIO_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_RADIO_RAM5_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_RADIO_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_RADIO_RAM4_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_RADIO_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_RADIO_RAM3_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_RADIO_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_RADIO_RAM2_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_RADIO_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_RADIO_RAM1_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_RADIO_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_RADIO_RAM0_Msk (0xFUL << AMLI_RAMPRI_RADIO_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_RADIO_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_ECB */ -/* Description: AHB bus master priority register for ECB */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_ECB_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_ECB_RAM7_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_ECB_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_ECB_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_ECB_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_ECB_RAM6_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_ECB_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_ECB_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_ECB_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_ECB_RAM5_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_ECB_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_ECB_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_ECB_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_ECB_RAM4_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_ECB_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_ECB_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_ECB_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_ECB_RAM3_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_ECB_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_ECB_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_ECB_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_ECB_RAM2_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_ECB_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_ECB_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_ECB_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_ECB_RAM1_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_ECB_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_ECB_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_ECB_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_ECB_RAM0_Msk (0xFUL << AMLI_RAMPRI_ECB_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_ECB_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_ECB_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_CCM */ -/* Description: AHB bus master priority register for CCM */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_CCM_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_CCM_RAM7_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_CCM_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CCM_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_CCM_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_CCM_RAM6_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_CCM_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CCM_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_CCM_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_CCM_RAM5_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_CCM_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CCM_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_CCM_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_CCM_RAM4_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_CCM_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CCM_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_CCM_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_CCM_RAM3_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_CCM_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CCM_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_CCM_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_CCM_RAM2_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_CCM_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CCM_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_CCM_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_CCM_RAM1_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_CCM_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CCM_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_CCM_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_CCM_RAM0_Msk (0xFUL << AMLI_RAMPRI_CCM_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_CCM_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_CCM_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_AAR */ -/* Description: AHB bus master priority register for AAR */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_AAR_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_AAR_RAM7_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_AAR_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_AAR_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_AAR_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_AAR_RAM6_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_AAR_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_AAR_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_AAR_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_AAR_RAM5_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_AAR_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_AAR_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_AAR_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_AAR_RAM4_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_AAR_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_AAR_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_AAR_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_AAR_RAM3_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_AAR_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_AAR_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_AAR_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_AAR_RAM2_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_AAR_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_AAR_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_AAR_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_AAR_RAM1_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_AAR_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_AAR_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_AAR_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_AAR_RAM0_Msk (0xFUL << AMLI_RAMPRI_AAR_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_AAR_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_AAR_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_SAADC */ -/* Description: AHB bus master priority register for SAADC */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_SAADC_RAM7_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SAADC_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_SAADC_RAM6_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SAADC_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_SAADC_RAM5_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SAADC_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_SAADC_RAM4_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SAADC_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_SAADC_RAM3_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SAADC_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_SAADC_RAM2_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SAADC_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_SAADC_RAM1_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SAADC_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_SAADC_RAM0_Msk (0xFUL << AMLI_RAMPRI_SAADC_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SAADC_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_UARTE */ -/* Description: AHB bus master priority register for UARTE */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_UARTE_RAM7_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_UARTE_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_UARTE_RAM6_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_UARTE_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_UARTE_RAM5_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_UARTE_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_UARTE_RAM4_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_UARTE_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_UARTE_RAM3_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_UARTE_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_UARTE_RAM2_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_UARTE_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_UARTE_RAM1_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_UARTE_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_UARTE_RAM0_Msk (0xFUL << AMLI_RAMPRI_UARTE_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_UARTE_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_SERIAL0 */ -/* Description: AHB bus master priority register for SPIM0, SPIS0, TWIM0 and TWIS0 */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL0_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL0_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL0_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL0_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL0_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL0_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL0_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Msk (0xFUL << AMLI_RAMPRI_SERIAL0_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL0_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_SERIAL2 */ -/* Description: AHB bus master priority register for SPIM2 and SPIS2 */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL2_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL2_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL2_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL2_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL2_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL2_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL2_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Msk (0xFUL << AMLI_RAMPRI_SERIAL2_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_SERIAL2_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_NFCT */ -/* Description: AHB bus master priority register for NFCT */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_NFCT_RAM7_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_NFCT_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_NFCT_RAM6_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_NFCT_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_NFCT_RAM5_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_NFCT_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_NFCT_RAM4_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_NFCT_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_NFCT_RAM3_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_NFCT_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_NFCT_RAM2_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_NFCT_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_NFCT_RAM1_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_NFCT_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_NFCT_RAM0_Msk (0xFUL << AMLI_RAMPRI_NFCT_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_NFCT_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_I2S */ -/* Description: AHB bus master priority register for I2S */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_I2S_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_I2S_RAM7_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_I2S_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_I2S_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_I2S_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_I2S_RAM6_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_I2S_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_I2S_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_I2S_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_I2S_RAM5_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_I2S_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_I2S_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_I2S_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_I2S_RAM4_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_I2S_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_I2S_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_I2S_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_I2S_RAM3_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_I2S_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_I2S_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_I2S_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_I2S_RAM2_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_I2S_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_I2S_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_I2S_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_I2S_RAM1_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_I2S_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_I2S_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_I2S_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_I2S_RAM0_Msk (0xFUL << AMLI_RAMPRI_I2S_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_I2S_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_I2S_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_PDM */ -/* Description: AHB bus master priority register for PDM */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_PDM_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_PDM_RAM7_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_PDM_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PDM_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_PDM_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_PDM_RAM6_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_PDM_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PDM_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_PDM_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_PDM_RAM5_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_PDM_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PDM_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_PDM_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_PDM_RAM4_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_PDM_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PDM_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_PDM_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_PDM_RAM3_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_PDM_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PDM_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_PDM_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_PDM_RAM2_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_PDM_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PDM_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_PDM_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_PDM_RAM1_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_PDM_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PDM_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_PDM_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_PDM_RAM0_Msk (0xFUL << AMLI_RAMPRI_PDM_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_PDM_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PDM_RAM0_Pri15 (15UL) /*!< Priority 15 */ - -/* Register: AMLI_RAMPRI_PWM */ -/* Description: AHB bus master priority register for PWM0, PWM1 and PWM2 */ - -/* Bits 31..28 : Priority register for RAM AHB slave 7 */ -#define AMLI_RAMPRI_PWM_RAM7_Pos (28UL) /*!< Position of RAM7 field. */ -#define AMLI_RAMPRI_PWM_RAM7_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM7_Pos) /*!< Bit mask of RAM7 field. */ -#define AMLI_RAMPRI_PWM_RAM7_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PWM_RAM7_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 27..24 : Priority register for RAM AHB slave 6 */ -#define AMLI_RAMPRI_PWM_RAM6_Pos (24UL) /*!< Position of RAM6 field. */ -#define AMLI_RAMPRI_PWM_RAM6_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM6_Pos) /*!< Bit mask of RAM6 field. */ -#define AMLI_RAMPRI_PWM_RAM6_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PWM_RAM6_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 23..20 : Priority register for RAM AHB slave 5 */ -#define AMLI_RAMPRI_PWM_RAM5_Pos (20UL) /*!< Position of RAM5 field. */ -#define AMLI_RAMPRI_PWM_RAM5_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM5_Pos) /*!< Bit mask of RAM5 field. */ -#define AMLI_RAMPRI_PWM_RAM5_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PWM_RAM5_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 19..16 : Priority register for RAM AHB slave 4 */ -#define AMLI_RAMPRI_PWM_RAM4_Pos (16UL) /*!< Position of RAM4 field. */ -#define AMLI_RAMPRI_PWM_RAM4_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM4_Pos) /*!< Bit mask of RAM4 field. */ -#define AMLI_RAMPRI_PWM_RAM4_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PWM_RAM4_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 15..12 : Priority register for RAM AHB slave 3 */ -#define AMLI_RAMPRI_PWM_RAM3_Pos (12UL) /*!< Position of RAM3 field. */ -#define AMLI_RAMPRI_PWM_RAM3_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM3_Pos) /*!< Bit mask of RAM3 field. */ -#define AMLI_RAMPRI_PWM_RAM3_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PWM_RAM3_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 11..8 : Priority register for RAM AHB slave 2 */ -#define AMLI_RAMPRI_PWM_RAM2_Pos (8UL) /*!< Position of RAM2 field. */ -#define AMLI_RAMPRI_PWM_RAM2_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM2_Pos) /*!< Bit mask of RAM2 field. */ -#define AMLI_RAMPRI_PWM_RAM2_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PWM_RAM2_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 7..4 : Priority register for RAM AHB slave 1 */ -#define AMLI_RAMPRI_PWM_RAM1_Pos (4UL) /*!< Position of RAM1 field. */ -#define AMLI_RAMPRI_PWM_RAM1_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM1_Pos) /*!< Bit mask of RAM1 field. */ -#define AMLI_RAMPRI_PWM_RAM1_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PWM_RAM1_Pri15 (15UL) /*!< Priority 15 */ - -/* Bits 3..0 : Priority register for RAM AHB slave 0 */ -#define AMLI_RAMPRI_PWM_RAM0_Pos (0UL) /*!< Position of RAM0 field. */ -#define AMLI_RAMPRI_PWM_RAM0_Msk (0xFUL << AMLI_RAMPRI_PWM_RAM0_Pos) /*!< Bit mask of RAM0 field. */ -#define AMLI_RAMPRI_PWM_RAM0_Pri0 (0UL) /*!< Priority 0 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri1 (1UL) /*!< Priority 1 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri2 (2UL) /*!< Priority 2 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri3 (3UL) /*!< Priority 3 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri4 (4UL) /*!< Priority 4 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri5 (5UL) /*!< Priority 5 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri6 (6UL) /*!< Priority 6 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri7 (7UL) /*!< Priority 7 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri8 (8UL) /*!< Priority 8 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri9 (9UL) /*!< Priority 9 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri10 (10UL) /*!< Priority 10 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri11 (11UL) /*!< Priority 11 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri12 (12UL) /*!< Priority 12 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri13 (13UL) /*!< Priority 13 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri14 (14UL) /*!< Priority 14 */ -#define AMLI_RAMPRI_PWM_RAM0_Pri15 (15UL) /*!< Priority 15 */ - - /* Peripheral: BPROT */ /* Description: Block Protect */ @@ -3471,6 +1185,18 @@ /* Register: CLOCK_LFCLKSRC */ /* Description: Clock source for the LFCLK */ +/* Bit 17 : Enable or disable external source for LFCLK */ +#define CLOCK_LFCLKSRC_EXTERNAL_Pos (17UL) /*!< Position of EXTERNAL field. */ +#define CLOCK_LFCLKSRC_EXTERNAL_Msk (0x1UL << CLOCK_LFCLKSRC_EXTERNAL_Pos) /*!< Bit mask of EXTERNAL field. */ +#define CLOCK_LFCLKSRC_EXTERNAL_Disabled (0UL) /*!< Disable external source (use with Xtal) */ +#define CLOCK_LFCLKSRC_EXTERNAL_Enabled (1UL) /*!< Enable use of external source instead of Xtal (SRC needs to be set to Xtal) */ + +/* Bit 16 : Enable or disable bypass of LFCLK crystal oscillator with external clock source */ +#define CLOCK_LFCLKSRC_BYPASS_Pos (16UL) /*!< Position of BYPASS field. */ +#define CLOCK_LFCLKSRC_BYPASS_Msk (0x1UL << CLOCK_LFCLKSRC_BYPASS_Pos) /*!< Bit mask of BYPASS field. */ +#define CLOCK_LFCLKSRC_BYPASS_Disabled (0UL) /*!< Disable (use with Xtal or low-swing external source) */ +#define CLOCK_LFCLKSRC_BYPASS_Enabled (1UL) /*!< Enable (use with rail-to-rail external source) */ + /* Bits 1..0 : Clock source */ #define CLOCK_LFCLKSRC_SRC_Pos (0UL) /*!< Position of SRC field. */ #define CLOCK_LFCLKSRC_SRC_Msk (0x3UL << CLOCK_LFCLKSRC_SRC_Pos) /*!< Bit mask of SRC field. */ @@ -3479,7 +1205,7 @@ #define CLOCK_LFCLKSRC_SRC_Synth (2UL) /*!< 32.768 kHz synthesized from HFCLK */ /* Register: CLOCK_CTIV */ -/* Description: Calibration timer interval (retained register, same reset behaviour as RESETREAS) */ +/* Description: Calibration timer interval */ /* Bits 6..0 : Calibration timer interval in multiple of 0.25 seconds. Range: 0.25 seconds to 31.75 seconds. */ #define CLOCK_CTIV_CTIV_Pos (0UL) /*!< Position of CTIV field. */ @@ -4192,6 +1918,7 @@ #define FICR_INFO_PACKAGE_PACKAGE_Msk (0xFFFFFFFFUL << FICR_INFO_PACKAGE_PACKAGE_Pos) /*!< Bit mask of PACKAGE field. */ #define FICR_INFO_PACKAGE_PACKAGE_QF (0x2000UL) /*!< QFxx - 48-pin QFN */ #define FICR_INFO_PACKAGE_PACKAGE_CH (0x2001UL) /*!< CHxx - 7x8 WLCSP 56 balls */ +#define FICR_INFO_PACKAGE_PACKAGE_CI (0x2002UL) /*!< CIxx - 7x8 WLCSP 56 balls */ #define FICR_INFO_PACKAGE_PACKAGE_Unspecified (0xFFFFFFFFUL) /*!< Unspecified */ /* Register: FICR_INFO_RAM */ @@ -4963,7 +2690,7 @@ /* Bit 0 : Result of last compare. Decision point SAMPLE task. */ #define LPCOMP_RESULT_RESULT_Pos (0UL) /*!< Position of RESULT field. */ #define LPCOMP_RESULT_RESULT_Msk (0x1UL << LPCOMP_RESULT_RESULT_Pos) /*!< Bit mask of RESULT field. */ -#define LPCOMP_RESULT_RESULT_Bellow (0UL) /*!< Input voltage is below the reference threshold (VIN+ < VIN-). */ +#define LPCOMP_RESULT_RESULT_Below (0UL) /*!< Input voltage is below the reference threshold (VIN+ < VIN-). */ #define LPCOMP_RESULT_RESULT_Above (1UL) /*!< Input voltage is above the reference threshold (VIN+ > VIN-). */ /* Register: LPCOMP_ENABLE */ @@ -7104,193 +4831,193 @@ /* Register: GPIO_OUT */ /* Description: Write GPIO port */ -/* Bit 31 : P0.31 pin */ +/* Bit 31 : Pin 31 */ #define GPIO_OUT_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ #define GPIO_OUT_PIN31_Msk (0x1UL << GPIO_OUT_PIN31_Pos) /*!< Bit mask of PIN31 field. */ #define GPIO_OUT_PIN31_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN31_High (1UL) /*!< Pin driver is high */ -/* Bit 30 : P0.30 pin */ +/* Bit 30 : Pin 30 */ #define GPIO_OUT_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ #define GPIO_OUT_PIN30_Msk (0x1UL << GPIO_OUT_PIN30_Pos) /*!< Bit mask of PIN30 field. */ #define GPIO_OUT_PIN30_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN30_High (1UL) /*!< Pin driver is high */ -/* Bit 29 : P0.29 pin */ +/* Bit 29 : Pin 29 */ #define GPIO_OUT_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ #define GPIO_OUT_PIN29_Msk (0x1UL << GPIO_OUT_PIN29_Pos) /*!< Bit mask of PIN29 field. */ #define GPIO_OUT_PIN29_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN29_High (1UL) /*!< Pin driver is high */ -/* Bit 28 : P0.28 pin */ +/* Bit 28 : Pin 28 */ #define GPIO_OUT_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ #define GPIO_OUT_PIN28_Msk (0x1UL << GPIO_OUT_PIN28_Pos) /*!< Bit mask of PIN28 field. */ #define GPIO_OUT_PIN28_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN28_High (1UL) /*!< Pin driver is high */ -/* Bit 27 : P0.27 pin */ +/* Bit 27 : Pin 27 */ #define GPIO_OUT_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ #define GPIO_OUT_PIN27_Msk (0x1UL << GPIO_OUT_PIN27_Pos) /*!< Bit mask of PIN27 field. */ #define GPIO_OUT_PIN27_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN27_High (1UL) /*!< Pin driver is high */ -/* Bit 26 : P0.26 pin */ +/* Bit 26 : Pin 26 */ #define GPIO_OUT_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ #define GPIO_OUT_PIN26_Msk (0x1UL << GPIO_OUT_PIN26_Pos) /*!< Bit mask of PIN26 field. */ #define GPIO_OUT_PIN26_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN26_High (1UL) /*!< Pin driver is high */ -/* Bit 25 : P0.25 pin */ +/* Bit 25 : Pin 25 */ #define GPIO_OUT_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ #define GPIO_OUT_PIN25_Msk (0x1UL << GPIO_OUT_PIN25_Pos) /*!< Bit mask of PIN25 field. */ #define GPIO_OUT_PIN25_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN25_High (1UL) /*!< Pin driver is high */ -/* Bit 24 : P0.24 pin */ +/* Bit 24 : Pin 24 */ #define GPIO_OUT_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ #define GPIO_OUT_PIN24_Msk (0x1UL << GPIO_OUT_PIN24_Pos) /*!< Bit mask of PIN24 field. */ #define GPIO_OUT_PIN24_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN24_High (1UL) /*!< Pin driver is high */ -/* Bit 23 : P0.23 pin */ +/* Bit 23 : Pin 23 */ #define GPIO_OUT_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ #define GPIO_OUT_PIN23_Msk (0x1UL << GPIO_OUT_PIN23_Pos) /*!< Bit mask of PIN23 field. */ #define GPIO_OUT_PIN23_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN23_High (1UL) /*!< Pin driver is high */ -/* Bit 22 : P0.22 pin */ +/* Bit 22 : Pin 22 */ #define GPIO_OUT_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ #define GPIO_OUT_PIN22_Msk (0x1UL << GPIO_OUT_PIN22_Pos) /*!< Bit mask of PIN22 field. */ #define GPIO_OUT_PIN22_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN22_High (1UL) /*!< Pin driver is high */ -/* Bit 21 : P0.21 pin */ +/* Bit 21 : Pin 21 */ #define GPIO_OUT_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ #define GPIO_OUT_PIN21_Msk (0x1UL << GPIO_OUT_PIN21_Pos) /*!< Bit mask of PIN21 field. */ #define GPIO_OUT_PIN21_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN21_High (1UL) /*!< Pin driver is high */ -/* Bit 20 : P0.20 pin */ +/* Bit 20 : Pin 20 */ #define GPIO_OUT_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ #define GPIO_OUT_PIN20_Msk (0x1UL << GPIO_OUT_PIN20_Pos) /*!< Bit mask of PIN20 field. */ #define GPIO_OUT_PIN20_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN20_High (1UL) /*!< Pin driver is high */ -/* Bit 19 : P0.19 pin */ +/* Bit 19 : Pin 19 */ #define GPIO_OUT_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ #define GPIO_OUT_PIN19_Msk (0x1UL << GPIO_OUT_PIN19_Pos) /*!< Bit mask of PIN19 field. */ #define GPIO_OUT_PIN19_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN19_High (1UL) /*!< Pin driver is high */ -/* Bit 18 : P0.18 pin */ +/* Bit 18 : Pin 18 */ #define GPIO_OUT_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ #define GPIO_OUT_PIN18_Msk (0x1UL << GPIO_OUT_PIN18_Pos) /*!< Bit mask of PIN18 field. */ #define GPIO_OUT_PIN18_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN18_High (1UL) /*!< Pin driver is high */ -/* Bit 17 : P0.17 pin */ +/* Bit 17 : Pin 17 */ #define GPIO_OUT_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ #define GPIO_OUT_PIN17_Msk (0x1UL << GPIO_OUT_PIN17_Pos) /*!< Bit mask of PIN17 field. */ #define GPIO_OUT_PIN17_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN17_High (1UL) /*!< Pin driver is high */ -/* Bit 16 : P0.16 pin */ +/* Bit 16 : Pin 16 */ #define GPIO_OUT_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ #define GPIO_OUT_PIN16_Msk (0x1UL << GPIO_OUT_PIN16_Pos) /*!< Bit mask of PIN16 field. */ #define GPIO_OUT_PIN16_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN16_High (1UL) /*!< Pin driver is high */ -/* Bit 15 : P0.15 pin */ +/* Bit 15 : Pin 15 */ #define GPIO_OUT_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ #define GPIO_OUT_PIN15_Msk (0x1UL << GPIO_OUT_PIN15_Pos) /*!< Bit mask of PIN15 field. */ #define GPIO_OUT_PIN15_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN15_High (1UL) /*!< Pin driver is high */ -/* Bit 14 : P0.14 pin */ +/* Bit 14 : Pin 14 */ #define GPIO_OUT_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ #define GPIO_OUT_PIN14_Msk (0x1UL << GPIO_OUT_PIN14_Pos) /*!< Bit mask of PIN14 field. */ #define GPIO_OUT_PIN14_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN14_High (1UL) /*!< Pin driver is high */ -/* Bit 13 : P0.13 pin */ +/* Bit 13 : Pin 13 */ #define GPIO_OUT_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ #define GPIO_OUT_PIN13_Msk (0x1UL << GPIO_OUT_PIN13_Pos) /*!< Bit mask of PIN13 field. */ #define GPIO_OUT_PIN13_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN13_High (1UL) /*!< Pin driver is high */ -/* Bit 12 : P0.12 pin */ +/* Bit 12 : Pin 12 */ #define GPIO_OUT_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ #define GPIO_OUT_PIN12_Msk (0x1UL << GPIO_OUT_PIN12_Pos) /*!< Bit mask of PIN12 field. */ #define GPIO_OUT_PIN12_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN12_High (1UL) /*!< Pin driver is high */ -/* Bit 11 : P0.11 pin */ +/* Bit 11 : Pin 11 */ #define GPIO_OUT_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ #define GPIO_OUT_PIN11_Msk (0x1UL << GPIO_OUT_PIN11_Pos) /*!< Bit mask of PIN11 field. */ #define GPIO_OUT_PIN11_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN11_High (1UL) /*!< Pin driver is high */ -/* Bit 10 : P0.10 pin */ +/* Bit 10 : Pin 10 */ #define GPIO_OUT_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ #define GPIO_OUT_PIN10_Msk (0x1UL << GPIO_OUT_PIN10_Pos) /*!< Bit mask of PIN10 field. */ #define GPIO_OUT_PIN10_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN10_High (1UL) /*!< Pin driver is high */ -/* Bit 9 : P0.9 pin */ +/* Bit 9 : Pin 9 */ #define GPIO_OUT_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ #define GPIO_OUT_PIN9_Msk (0x1UL << GPIO_OUT_PIN9_Pos) /*!< Bit mask of PIN9 field. */ #define GPIO_OUT_PIN9_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN9_High (1UL) /*!< Pin driver is high */ -/* Bit 8 : P0.8 pin */ +/* Bit 8 : Pin 8 */ #define GPIO_OUT_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ #define GPIO_OUT_PIN8_Msk (0x1UL << GPIO_OUT_PIN8_Pos) /*!< Bit mask of PIN8 field. */ #define GPIO_OUT_PIN8_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN8_High (1UL) /*!< Pin driver is high */ -/* Bit 7 : P0.7 pin */ +/* Bit 7 : Pin 7 */ #define GPIO_OUT_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ #define GPIO_OUT_PIN7_Msk (0x1UL << GPIO_OUT_PIN7_Pos) /*!< Bit mask of PIN7 field. */ #define GPIO_OUT_PIN7_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN7_High (1UL) /*!< Pin driver is high */ -/* Bit 6 : P0.6 pin */ +/* Bit 6 : Pin 6 */ #define GPIO_OUT_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ #define GPIO_OUT_PIN6_Msk (0x1UL << GPIO_OUT_PIN6_Pos) /*!< Bit mask of PIN6 field. */ #define GPIO_OUT_PIN6_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN6_High (1UL) /*!< Pin driver is high */ -/* Bit 5 : P0.5 pin */ +/* Bit 5 : Pin 5 */ #define GPIO_OUT_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ #define GPIO_OUT_PIN5_Msk (0x1UL << GPIO_OUT_PIN5_Pos) /*!< Bit mask of PIN5 field. */ #define GPIO_OUT_PIN5_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN5_High (1UL) /*!< Pin driver is high */ -/* Bit 4 : P0.4 pin */ +/* Bit 4 : Pin 4 */ #define GPIO_OUT_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ #define GPIO_OUT_PIN4_Msk (0x1UL << GPIO_OUT_PIN4_Pos) /*!< Bit mask of PIN4 field. */ #define GPIO_OUT_PIN4_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN4_High (1UL) /*!< Pin driver is high */ -/* Bit 3 : P0.3 pin */ +/* Bit 3 : Pin 3 */ #define GPIO_OUT_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ #define GPIO_OUT_PIN3_Msk (0x1UL << GPIO_OUT_PIN3_Pos) /*!< Bit mask of PIN3 field. */ #define GPIO_OUT_PIN3_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN3_High (1UL) /*!< Pin driver is high */ -/* Bit 2 : P0.2 pin */ +/* Bit 2 : Pin 2 */ #define GPIO_OUT_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ #define GPIO_OUT_PIN2_Msk (0x1UL << GPIO_OUT_PIN2_Pos) /*!< Bit mask of PIN2 field. */ #define GPIO_OUT_PIN2_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN2_High (1UL) /*!< Pin driver is high */ -/* Bit 1 : P0.1 pin */ +/* Bit 1 : Pin 1 */ #define GPIO_OUT_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ #define GPIO_OUT_PIN1_Msk (0x1UL << GPIO_OUT_PIN1_Pos) /*!< Bit mask of PIN1 field. */ #define GPIO_OUT_PIN1_Low (0UL) /*!< Pin driver is low */ #define GPIO_OUT_PIN1_High (1UL) /*!< Pin driver is high */ -/* Bit 0 : P0.0 pin */ +/* Bit 0 : Pin 0 */ #define GPIO_OUT_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ #define GPIO_OUT_PIN0_Msk (0x1UL << GPIO_OUT_PIN0_Pos) /*!< Bit mask of PIN0 field. */ #define GPIO_OUT_PIN0_Low (0UL) /*!< Pin driver is low */ @@ -7299,224 +5026,224 @@ /* Register: GPIO_OUTSET */ /* Description: Set individual bits in GPIO port */ -/* Bit 31 : P0.31 pin */ +/* Bit 31 : Pin 31 */ #define GPIO_OUTSET_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ #define GPIO_OUTSET_PIN31_Msk (0x1UL << GPIO_OUTSET_PIN31_Pos) /*!< Bit mask of PIN31 field. */ #define GPIO_OUTSET_PIN31_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN31_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN31_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 30 : P0.30 pin */ +/* Bit 30 : Pin 30 */ #define GPIO_OUTSET_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ #define GPIO_OUTSET_PIN30_Msk (0x1UL << GPIO_OUTSET_PIN30_Pos) /*!< Bit mask of PIN30 field. */ #define GPIO_OUTSET_PIN30_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN30_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN30_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 29 : P0.29 pin */ +/* Bit 29 : Pin 29 */ #define GPIO_OUTSET_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ #define GPIO_OUTSET_PIN29_Msk (0x1UL << GPIO_OUTSET_PIN29_Pos) /*!< Bit mask of PIN29 field. */ #define GPIO_OUTSET_PIN29_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN29_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN29_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 28 : P0.28 pin */ +/* Bit 28 : Pin 28 */ #define GPIO_OUTSET_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ #define GPIO_OUTSET_PIN28_Msk (0x1UL << GPIO_OUTSET_PIN28_Pos) /*!< Bit mask of PIN28 field. */ #define GPIO_OUTSET_PIN28_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN28_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN28_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 27 : P0.27 pin */ +/* Bit 27 : Pin 27 */ #define GPIO_OUTSET_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ #define GPIO_OUTSET_PIN27_Msk (0x1UL << GPIO_OUTSET_PIN27_Pos) /*!< Bit mask of PIN27 field. */ #define GPIO_OUTSET_PIN27_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN27_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN27_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 26 : P0.26 pin */ +/* Bit 26 : Pin 26 */ #define GPIO_OUTSET_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ #define GPIO_OUTSET_PIN26_Msk (0x1UL << GPIO_OUTSET_PIN26_Pos) /*!< Bit mask of PIN26 field. */ #define GPIO_OUTSET_PIN26_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN26_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN26_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 25 : P0.25 pin */ +/* Bit 25 : Pin 25 */ #define GPIO_OUTSET_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ #define GPIO_OUTSET_PIN25_Msk (0x1UL << GPIO_OUTSET_PIN25_Pos) /*!< Bit mask of PIN25 field. */ #define GPIO_OUTSET_PIN25_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN25_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN25_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 24 : P0.24 pin */ +/* Bit 24 : Pin 24 */ #define GPIO_OUTSET_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ #define GPIO_OUTSET_PIN24_Msk (0x1UL << GPIO_OUTSET_PIN24_Pos) /*!< Bit mask of PIN24 field. */ #define GPIO_OUTSET_PIN24_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN24_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN24_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 23 : P0.23 pin */ +/* Bit 23 : Pin 23 */ #define GPIO_OUTSET_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ #define GPIO_OUTSET_PIN23_Msk (0x1UL << GPIO_OUTSET_PIN23_Pos) /*!< Bit mask of PIN23 field. */ #define GPIO_OUTSET_PIN23_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN23_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN23_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 22 : P0.22 pin */ +/* Bit 22 : Pin 22 */ #define GPIO_OUTSET_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ #define GPIO_OUTSET_PIN22_Msk (0x1UL << GPIO_OUTSET_PIN22_Pos) /*!< Bit mask of PIN22 field. */ #define GPIO_OUTSET_PIN22_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN22_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN22_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 21 : P0.21 pin */ +/* Bit 21 : Pin 21 */ #define GPIO_OUTSET_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ #define GPIO_OUTSET_PIN21_Msk (0x1UL << GPIO_OUTSET_PIN21_Pos) /*!< Bit mask of PIN21 field. */ #define GPIO_OUTSET_PIN21_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN21_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN21_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 20 : P0.20 pin */ +/* Bit 20 : Pin 20 */ #define GPIO_OUTSET_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ #define GPIO_OUTSET_PIN20_Msk (0x1UL << GPIO_OUTSET_PIN20_Pos) /*!< Bit mask of PIN20 field. */ #define GPIO_OUTSET_PIN20_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN20_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN20_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 19 : P0.19 pin */ +/* Bit 19 : Pin 19 */ #define GPIO_OUTSET_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ #define GPIO_OUTSET_PIN19_Msk (0x1UL << GPIO_OUTSET_PIN19_Pos) /*!< Bit mask of PIN19 field. */ #define GPIO_OUTSET_PIN19_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN19_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN19_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 18 : P0.18 pin */ +/* Bit 18 : Pin 18 */ #define GPIO_OUTSET_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ #define GPIO_OUTSET_PIN18_Msk (0x1UL << GPIO_OUTSET_PIN18_Pos) /*!< Bit mask of PIN18 field. */ #define GPIO_OUTSET_PIN18_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN18_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN18_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 17 : P0.17 pin */ +/* Bit 17 : Pin 17 */ #define GPIO_OUTSET_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ #define GPIO_OUTSET_PIN17_Msk (0x1UL << GPIO_OUTSET_PIN17_Pos) /*!< Bit mask of PIN17 field. */ #define GPIO_OUTSET_PIN17_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN17_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN17_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 16 : P0.16 pin */ +/* Bit 16 : Pin 16 */ #define GPIO_OUTSET_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ #define GPIO_OUTSET_PIN16_Msk (0x1UL << GPIO_OUTSET_PIN16_Pos) /*!< Bit mask of PIN16 field. */ #define GPIO_OUTSET_PIN16_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN16_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN16_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 15 : P0.15 pin */ +/* Bit 15 : Pin 15 */ #define GPIO_OUTSET_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ #define GPIO_OUTSET_PIN15_Msk (0x1UL << GPIO_OUTSET_PIN15_Pos) /*!< Bit mask of PIN15 field. */ #define GPIO_OUTSET_PIN15_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN15_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN15_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 14 : P0.14 pin */ +/* Bit 14 : Pin 14 */ #define GPIO_OUTSET_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ #define GPIO_OUTSET_PIN14_Msk (0x1UL << GPIO_OUTSET_PIN14_Pos) /*!< Bit mask of PIN14 field. */ #define GPIO_OUTSET_PIN14_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN14_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN14_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 13 : P0.13 pin */ +/* Bit 13 : Pin 13 */ #define GPIO_OUTSET_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ #define GPIO_OUTSET_PIN13_Msk (0x1UL << GPIO_OUTSET_PIN13_Pos) /*!< Bit mask of PIN13 field. */ #define GPIO_OUTSET_PIN13_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN13_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN13_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 12 : P0.12 pin */ +/* Bit 12 : Pin 12 */ #define GPIO_OUTSET_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ #define GPIO_OUTSET_PIN12_Msk (0x1UL << GPIO_OUTSET_PIN12_Pos) /*!< Bit mask of PIN12 field. */ #define GPIO_OUTSET_PIN12_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN12_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN12_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 11 : P0.11 pin */ +/* Bit 11 : Pin 11 */ #define GPIO_OUTSET_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ #define GPIO_OUTSET_PIN11_Msk (0x1UL << GPIO_OUTSET_PIN11_Pos) /*!< Bit mask of PIN11 field. */ #define GPIO_OUTSET_PIN11_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN11_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN11_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 10 : P0.10 pin */ +/* Bit 10 : Pin 10 */ #define GPIO_OUTSET_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ #define GPIO_OUTSET_PIN10_Msk (0x1UL << GPIO_OUTSET_PIN10_Pos) /*!< Bit mask of PIN10 field. */ #define GPIO_OUTSET_PIN10_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN10_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN10_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 9 : P0.9 pin */ +/* Bit 9 : Pin 9 */ #define GPIO_OUTSET_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ #define GPIO_OUTSET_PIN9_Msk (0x1UL << GPIO_OUTSET_PIN9_Pos) /*!< Bit mask of PIN9 field. */ #define GPIO_OUTSET_PIN9_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN9_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN9_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 8 : P0.8 pin */ +/* Bit 8 : Pin 8 */ #define GPIO_OUTSET_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ #define GPIO_OUTSET_PIN8_Msk (0x1UL << GPIO_OUTSET_PIN8_Pos) /*!< Bit mask of PIN8 field. */ #define GPIO_OUTSET_PIN8_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN8_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN8_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 7 : P0.7 pin */ +/* Bit 7 : Pin 7 */ #define GPIO_OUTSET_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ #define GPIO_OUTSET_PIN7_Msk (0x1UL << GPIO_OUTSET_PIN7_Pos) /*!< Bit mask of PIN7 field. */ #define GPIO_OUTSET_PIN7_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN7_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN7_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 6 : P0.6 pin */ +/* Bit 6 : Pin 6 */ #define GPIO_OUTSET_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ #define GPIO_OUTSET_PIN6_Msk (0x1UL << GPIO_OUTSET_PIN6_Pos) /*!< Bit mask of PIN6 field. */ #define GPIO_OUTSET_PIN6_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN6_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN6_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 5 : P0.5 pin */ +/* Bit 5 : Pin 5 */ #define GPIO_OUTSET_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ #define GPIO_OUTSET_PIN5_Msk (0x1UL << GPIO_OUTSET_PIN5_Pos) /*!< Bit mask of PIN5 field. */ #define GPIO_OUTSET_PIN5_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN5_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN5_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 4 : P0.4 pin */ +/* Bit 4 : Pin 4 */ #define GPIO_OUTSET_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ #define GPIO_OUTSET_PIN4_Msk (0x1UL << GPIO_OUTSET_PIN4_Pos) /*!< Bit mask of PIN4 field. */ #define GPIO_OUTSET_PIN4_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN4_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN4_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 3 : P0.3 pin */ +/* Bit 3 : Pin 3 */ #define GPIO_OUTSET_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ #define GPIO_OUTSET_PIN3_Msk (0x1UL << GPIO_OUTSET_PIN3_Pos) /*!< Bit mask of PIN3 field. */ #define GPIO_OUTSET_PIN3_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN3_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN3_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 2 : P0.2 pin */ +/* Bit 2 : Pin 2 */ #define GPIO_OUTSET_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ #define GPIO_OUTSET_PIN2_Msk (0x1UL << GPIO_OUTSET_PIN2_Pos) /*!< Bit mask of PIN2 field. */ #define GPIO_OUTSET_PIN2_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN2_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN2_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 1 : P0.1 pin */ +/* Bit 1 : Pin 1 */ #define GPIO_OUTSET_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ #define GPIO_OUTSET_PIN1_Msk (0x1UL << GPIO_OUTSET_PIN1_Pos) /*!< Bit mask of PIN1 field. */ #define GPIO_OUTSET_PIN1_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTSET_PIN1_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTSET_PIN1_Set (1UL) /*!< Write: writing a '1' sets the pin high; writing a '0' has no effect */ -/* Bit 0 : P0.0 pin */ +/* Bit 0 : Pin 0 */ #define GPIO_OUTSET_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ #define GPIO_OUTSET_PIN0_Msk (0x1UL << GPIO_OUTSET_PIN0_Pos) /*!< Bit mask of PIN0 field. */ #define GPIO_OUTSET_PIN0_Low (0UL) /*!< Read: pin driver is low */ @@ -7526,224 +5253,224 @@ /* Register: GPIO_OUTCLR */ /* Description: Clear individual bits in GPIO port */ -/* Bit 31 : P0.31 pin */ +/* Bit 31 : Pin 31 */ #define GPIO_OUTCLR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ #define GPIO_OUTCLR_PIN31_Msk (0x1UL << GPIO_OUTCLR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ #define GPIO_OUTCLR_PIN31_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN31_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN31_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 30 : P0.30 pin */ +/* Bit 30 : Pin 30 */ #define GPIO_OUTCLR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ #define GPIO_OUTCLR_PIN30_Msk (0x1UL << GPIO_OUTCLR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ #define GPIO_OUTCLR_PIN30_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN30_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN30_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 29 : P0.29 pin */ +/* Bit 29 : Pin 29 */ #define GPIO_OUTCLR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ #define GPIO_OUTCLR_PIN29_Msk (0x1UL << GPIO_OUTCLR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ #define GPIO_OUTCLR_PIN29_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN29_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN29_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 28 : P0.28 pin */ +/* Bit 28 : Pin 28 */ #define GPIO_OUTCLR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ #define GPIO_OUTCLR_PIN28_Msk (0x1UL << GPIO_OUTCLR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ #define GPIO_OUTCLR_PIN28_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN28_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN28_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 27 : P0.27 pin */ +/* Bit 27 : Pin 27 */ #define GPIO_OUTCLR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ #define GPIO_OUTCLR_PIN27_Msk (0x1UL << GPIO_OUTCLR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ #define GPIO_OUTCLR_PIN27_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN27_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN27_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 26 : P0.26 pin */ +/* Bit 26 : Pin 26 */ #define GPIO_OUTCLR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ #define GPIO_OUTCLR_PIN26_Msk (0x1UL << GPIO_OUTCLR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ #define GPIO_OUTCLR_PIN26_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN26_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN26_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 25 : P0.25 pin */ +/* Bit 25 : Pin 25 */ #define GPIO_OUTCLR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ #define GPIO_OUTCLR_PIN25_Msk (0x1UL << GPIO_OUTCLR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ #define GPIO_OUTCLR_PIN25_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN25_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN25_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 24 : P0.24 pin */ +/* Bit 24 : Pin 24 */ #define GPIO_OUTCLR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ #define GPIO_OUTCLR_PIN24_Msk (0x1UL << GPIO_OUTCLR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ #define GPIO_OUTCLR_PIN24_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN24_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN24_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 23 : P0.23 pin */ +/* Bit 23 : Pin 23 */ #define GPIO_OUTCLR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ #define GPIO_OUTCLR_PIN23_Msk (0x1UL << GPIO_OUTCLR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ #define GPIO_OUTCLR_PIN23_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN23_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN23_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 22 : P0.22 pin */ +/* Bit 22 : Pin 22 */ #define GPIO_OUTCLR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ #define GPIO_OUTCLR_PIN22_Msk (0x1UL << GPIO_OUTCLR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ #define GPIO_OUTCLR_PIN22_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN22_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN22_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 21 : P0.21 pin */ +/* Bit 21 : Pin 21 */ #define GPIO_OUTCLR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ #define GPIO_OUTCLR_PIN21_Msk (0x1UL << GPIO_OUTCLR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ #define GPIO_OUTCLR_PIN21_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN21_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN21_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 20 : P0.20 pin */ +/* Bit 20 : Pin 20 */ #define GPIO_OUTCLR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ #define GPIO_OUTCLR_PIN20_Msk (0x1UL << GPIO_OUTCLR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ #define GPIO_OUTCLR_PIN20_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN20_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN20_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 19 : P0.19 pin */ +/* Bit 19 : Pin 19 */ #define GPIO_OUTCLR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ #define GPIO_OUTCLR_PIN19_Msk (0x1UL << GPIO_OUTCLR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ #define GPIO_OUTCLR_PIN19_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN19_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN19_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 18 : P0.18 pin */ +/* Bit 18 : Pin 18 */ #define GPIO_OUTCLR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ #define GPIO_OUTCLR_PIN18_Msk (0x1UL << GPIO_OUTCLR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ #define GPIO_OUTCLR_PIN18_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN18_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN18_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 17 : P0.17 pin */ +/* Bit 17 : Pin 17 */ #define GPIO_OUTCLR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ #define GPIO_OUTCLR_PIN17_Msk (0x1UL << GPIO_OUTCLR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ #define GPIO_OUTCLR_PIN17_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN17_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN17_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 16 : P0.16 pin */ +/* Bit 16 : Pin 16 */ #define GPIO_OUTCLR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ #define GPIO_OUTCLR_PIN16_Msk (0x1UL << GPIO_OUTCLR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ #define GPIO_OUTCLR_PIN16_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN16_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN16_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 15 : P0.15 pin */ +/* Bit 15 : Pin 15 */ #define GPIO_OUTCLR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ #define GPIO_OUTCLR_PIN15_Msk (0x1UL << GPIO_OUTCLR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ #define GPIO_OUTCLR_PIN15_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN15_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN15_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 14 : P0.14 pin */ +/* Bit 14 : Pin 14 */ #define GPIO_OUTCLR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ #define GPIO_OUTCLR_PIN14_Msk (0x1UL << GPIO_OUTCLR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ #define GPIO_OUTCLR_PIN14_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN14_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN14_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 13 : P0.13 pin */ +/* Bit 13 : Pin 13 */ #define GPIO_OUTCLR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ #define GPIO_OUTCLR_PIN13_Msk (0x1UL << GPIO_OUTCLR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ #define GPIO_OUTCLR_PIN13_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN13_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN13_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 12 : P0.12 pin */ +/* Bit 12 : Pin 12 */ #define GPIO_OUTCLR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ #define GPIO_OUTCLR_PIN12_Msk (0x1UL << GPIO_OUTCLR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ #define GPIO_OUTCLR_PIN12_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN12_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN12_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 11 : P0.11 pin */ +/* Bit 11 : Pin 11 */ #define GPIO_OUTCLR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ #define GPIO_OUTCLR_PIN11_Msk (0x1UL << GPIO_OUTCLR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ #define GPIO_OUTCLR_PIN11_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN11_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN11_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 10 : P0.10 pin */ +/* Bit 10 : Pin 10 */ #define GPIO_OUTCLR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ #define GPIO_OUTCLR_PIN10_Msk (0x1UL << GPIO_OUTCLR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ #define GPIO_OUTCLR_PIN10_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN10_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN10_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 9 : P0.9 pin */ +/* Bit 9 : Pin 9 */ #define GPIO_OUTCLR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ #define GPIO_OUTCLR_PIN9_Msk (0x1UL << GPIO_OUTCLR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ #define GPIO_OUTCLR_PIN9_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN9_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN9_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 8 : P0.8 pin */ +/* Bit 8 : Pin 8 */ #define GPIO_OUTCLR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ #define GPIO_OUTCLR_PIN8_Msk (0x1UL << GPIO_OUTCLR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ #define GPIO_OUTCLR_PIN8_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN8_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN8_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 7 : P0.7 pin */ +/* Bit 7 : Pin 7 */ #define GPIO_OUTCLR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ #define GPIO_OUTCLR_PIN7_Msk (0x1UL << GPIO_OUTCLR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ #define GPIO_OUTCLR_PIN7_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN7_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN7_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 6 : P0.6 pin */ +/* Bit 6 : Pin 6 */ #define GPIO_OUTCLR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ #define GPIO_OUTCLR_PIN6_Msk (0x1UL << GPIO_OUTCLR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ #define GPIO_OUTCLR_PIN6_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN6_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN6_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 5 : P0.5 pin */ +/* Bit 5 : Pin 5 */ #define GPIO_OUTCLR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ #define GPIO_OUTCLR_PIN5_Msk (0x1UL << GPIO_OUTCLR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ #define GPIO_OUTCLR_PIN5_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN5_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN5_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 4 : P0.4 pin */ +/* Bit 4 : Pin 4 */ #define GPIO_OUTCLR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ #define GPIO_OUTCLR_PIN4_Msk (0x1UL << GPIO_OUTCLR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ #define GPIO_OUTCLR_PIN4_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN4_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN4_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 3 : P0.3 pin */ +/* Bit 3 : Pin 3 */ #define GPIO_OUTCLR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ #define GPIO_OUTCLR_PIN3_Msk (0x1UL << GPIO_OUTCLR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ #define GPIO_OUTCLR_PIN3_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN3_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN3_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 2 : P0.2 pin */ +/* Bit 2 : Pin 2 */ #define GPIO_OUTCLR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ #define GPIO_OUTCLR_PIN2_Msk (0x1UL << GPIO_OUTCLR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ #define GPIO_OUTCLR_PIN2_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN2_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN2_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 1 : P0.1 pin */ +/* Bit 1 : Pin 1 */ #define GPIO_OUTCLR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ #define GPIO_OUTCLR_PIN1_Msk (0x1UL << GPIO_OUTCLR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ #define GPIO_OUTCLR_PIN1_Low (0UL) /*!< Read: pin driver is low */ #define GPIO_OUTCLR_PIN1_High (1UL) /*!< Read: pin driver is high */ #define GPIO_OUTCLR_PIN1_Clear (1UL) /*!< Write: writing a '1' sets the pin low; writing a '0' has no effect */ -/* Bit 0 : P0.0 pin */ +/* Bit 0 : Pin 0 */ #define GPIO_OUTCLR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ #define GPIO_OUTCLR_PIN0_Msk (0x1UL << GPIO_OUTCLR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ #define GPIO_OUTCLR_PIN0_Low (0UL) /*!< Read: pin driver is low */ @@ -7753,193 +5480,193 @@ /* Register: GPIO_IN */ /* Description: Read GPIO port */ -/* Bit 31 : P0.31 pin */ +/* Bit 31 : Pin 31 */ #define GPIO_IN_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ #define GPIO_IN_PIN31_Msk (0x1UL << GPIO_IN_PIN31_Pos) /*!< Bit mask of PIN31 field. */ #define GPIO_IN_PIN31_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN31_High (1UL) /*!< Pin input is high */ -/* Bit 30 : P0.30 pin */ +/* Bit 30 : Pin 30 */ #define GPIO_IN_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ #define GPIO_IN_PIN30_Msk (0x1UL << GPIO_IN_PIN30_Pos) /*!< Bit mask of PIN30 field. */ #define GPIO_IN_PIN30_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN30_High (1UL) /*!< Pin input is high */ -/* Bit 29 : P0.29 pin */ +/* Bit 29 : Pin 29 */ #define GPIO_IN_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ #define GPIO_IN_PIN29_Msk (0x1UL << GPIO_IN_PIN29_Pos) /*!< Bit mask of PIN29 field. */ #define GPIO_IN_PIN29_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN29_High (1UL) /*!< Pin input is high */ -/* Bit 28 : P0.28 pin */ +/* Bit 28 : Pin 28 */ #define GPIO_IN_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ #define GPIO_IN_PIN28_Msk (0x1UL << GPIO_IN_PIN28_Pos) /*!< Bit mask of PIN28 field. */ #define GPIO_IN_PIN28_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN28_High (1UL) /*!< Pin input is high */ -/* Bit 27 : P0.27 pin */ +/* Bit 27 : Pin 27 */ #define GPIO_IN_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ #define GPIO_IN_PIN27_Msk (0x1UL << GPIO_IN_PIN27_Pos) /*!< Bit mask of PIN27 field. */ #define GPIO_IN_PIN27_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN27_High (1UL) /*!< Pin input is high */ -/* Bit 26 : P0.26 pin */ +/* Bit 26 : Pin 26 */ #define GPIO_IN_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ #define GPIO_IN_PIN26_Msk (0x1UL << GPIO_IN_PIN26_Pos) /*!< Bit mask of PIN26 field. */ #define GPIO_IN_PIN26_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN26_High (1UL) /*!< Pin input is high */ -/* Bit 25 : P0.25 pin */ +/* Bit 25 : Pin 25 */ #define GPIO_IN_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ #define GPIO_IN_PIN25_Msk (0x1UL << GPIO_IN_PIN25_Pos) /*!< Bit mask of PIN25 field. */ #define GPIO_IN_PIN25_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN25_High (1UL) /*!< Pin input is high */ -/* Bit 24 : P0.24 pin */ +/* Bit 24 : Pin 24 */ #define GPIO_IN_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ #define GPIO_IN_PIN24_Msk (0x1UL << GPIO_IN_PIN24_Pos) /*!< Bit mask of PIN24 field. */ #define GPIO_IN_PIN24_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN24_High (1UL) /*!< Pin input is high */ -/* Bit 23 : P0.23 pin */ +/* Bit 23 : Pin 23 */ #define GPIO_IN_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ #define GPIO_IN_PIN23_Msk (0x1UL << GPIO_IN_PIN23_Pos) /*!< Bit mask of PIN23 field. */ #define GPIO_IN_PIN23_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN23_High (1UL) /*!< Pin input is high */ -/* Bit 22 : P0.22 pin */ +/* Bit 22 : Pin 22 */ #define GPIO_IN_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ #define GPIO_IN_PIN22_Msk (0x1UL << GPIO_IN_PIN22_Pos) /*!< Bit mask of PIN22 field. */ #define GPIO_IN_PIN22_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN22_High (1UL) /*!< Pin input is high */ -/* Bit 21 : P0.21 pin */ +/* Bit 21 : Pin 21 */ #define GPIO_IN_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ #define GPIO_IN_PIN21_Msk (0x1UL << GPIO_IN_PIN21_Pos) /*!< Bit mask of PIN21 field. */ #define GPIO_IN_PIN21_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN21_High (1UL) /*!< Pin input is high */ -/* Bit 20 : P0.20 pin */ +/* Bit 20 : Pin 20 */ #define GPIO_IN_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ #define GPIO_IN_PIN20_Msk (0x1UL << GPIO_IN_PIN20_Pos) /*!< Bit mask of PIN20 field. */ #define GPIO_IN_PIN20_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN20_High (1UL) /*!< Pin input is high */ -/* Bit 19 : P0.19 pin */ +/* Bit 19 : Pin 19 */ #define GPIO_IN_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ #define GPIO_IN_PIN19_Msk (0x1UL << GPIO_IN_PIN19_Pos) /*!< Bit mask of PIN19 field. */ #define GPIO_IN_PIN19_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN19_High (1UL) /*!< Pin input is high */ -/* Bit 18 : P0.18 pin */ +/* Bit 18 : Pin 18 */ #define GPIO_IN_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ #define GPIO_IN_PIN18_Msk (0x1UL << GPIO_IN_PIN18_Pos) /*!< Bit mask of PIN18 field. */ #define GPIO_IN_PIN18_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN18_High (1UL) /*!< Pin input is high */ -/* Bit 17 : P0.17 pin */ +/* Bit 17 : Pin 17 */ #define GPIO_IN_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ #define GPIO_IN_PIN17_Msk (0x1UL << GPIO_IN_PIN17_Pos) /*!< Bit mask of PIN17 field. */ #define GPIO_IN_PIN17_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN17_High (1UL) /*!< Pin input is high */ -/* Bit 16 : P0.16 pin */ +/* Bit 16 : Pin 16 */ #define GPIO_IN_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ #define GPIO_IN_PIN16_Msk (0x1UL << GPIO_IN_PIN16_Pos) /*!< Bit mask of PIN16 field. */ #define GPIO_IN_PIN16_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN16_High (1UL) /*!< Pin input is high */ -/* Bit 15 : P0.15 pin */ +/* Bit 15 : Pin 15 */ #define GPIO_IN_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ #define GPIO_IN_PIN15_Msk (0x1UL << GPIO_IN_PIN15_Pos) /*!< Bit mask of PIN15 field. */ #define GPIO_IN_PIN15_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN15_High (1UL) /*!< Pin input is high */ -/* Bit 14 : P0.14 pin */ +/* Bit 14 : Pin 14 */ #define GPIO_IN_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ #define GPIO_IN_PIN14_Msk (0x1UL << GPIO_IN_PIN14_Pos) /*!< Bit mask of PIN14 field. */ #define GPIO_IN_PIN14_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN14_High (1UL) /*!< Pin input is high */ -/* Bit 13 : P0.13 pin */ +/* Bit 13 : Pin 13 */ #define GPIO_IN_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ #define GPIO_IN_PIN13_Msk (0x1UL << GPIO_IN_PIN13_Pos) /*!< Bit mask of PIN13 field. */ #define GPIO_IN_PIN13_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN13_High (1UL) /*!< Pin input is high */ -/* Bit 12 : P0.12 pin */ +/* Bit 12 : Pin 12 */ #define GPIO_IN_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ #define GPIO_IN_PIN12_Msk (0x1UL << GPIO_IN_PIN12_Pos) /*!< Bit mask of PIN12 field. */ #define GPIO_IN_PIN12_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN12_High (1UL) /*!< Pin input is high */ -/* Bit 11 : P0.11 pin */ +/* Bit 11 : Pin 11 */ #define GPIO_IN_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ #define GPIO_IN_PIN11_Msk (0x1UL << GPIO_IN_PIN11_Pos) /*!< Bit mask of PIN11 field. */ #define GPIO_IN_PIN11_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN11_High (1UL) /*!< Pin input is high */ -/* Bit 10 : P0.10 pin */ +/* Bit 10 : Pin 10 */ #define GPIO_IN_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ #define GPIO_IN_PIN10_Msk (0x1UL << GPIO_IN_PIN10_Pos) /*!< Bit mask of PIN10 field. */ #define GPIO_IN_PIN10_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN10_High (1UL) /*!< Pin input is high */ -/* Bit 9 : P0.9 pin */ +/* Bit 9 : Pin 9 */ #define GPIO_IN_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ #define GPIO_IN_PIN9_Msk (0x1UL << GPIO_IN_PIN9_Pos) /*!< Bit mask of PIN9 field. */ #define GPIO_IN_PIN9_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN9_High (1UL) /*!< Pin input is high */ -/* Bit 8 : P0.8 pin */ +/* Bit 8 : Pin 8 */ #define GPIO_IN_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ #define GPIO_IN_PIN8_Msk (0x1UL << GPIO_IN_PIN8_Pos) /*!< Bit mask of PIN8 field. */ #define GPIO_IN_PIN8_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN8_High (1UL) /*!< Pin input is high */ -/* Bit 7 : P0.7 pin */ +/* Bit 7 : Pin 7 */ #define GPIO_IN_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ #define GPIO_IN_PIN7_Msk (0x1UL << GPIO_IN_PIN7_Pos) /*!< Bit mask of PIN7 field. */ #define GPIO_IN_PIN7_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN7_High (1UL) /*!< Pin input is high */ -/* Bit 6 : P0.6 pin */ +/* Bit 6 : Pin 6 */ #define GPIO_IN_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ #define GPIO_IN_PIN6_Msk (0x1UL << GPIO_IN_PIN6_Pos) /*!< Bit mask of PIN6 field. */ #define GPIO_IN_PIN6_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN6_High (1UL) /*!< Pin input is high */ -/* Bit 5 : P0.5 pin */ +/* Bit 5 : Pin 5 */ #define GPIO_IN_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ #define GPIO_IN_PIN5_Msk (0x1UL << GPIO_IN_PIN5_Pos) /*!< Bit mask of PIN5 field. */ #define GPIO_IN_PIN5_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN5_High (1UL) /*!< Pin input is high */ -/* Bit 4 : P0.4 pin */ +/* Bit 4 : Pin 4 */ #define GPIO_IN_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ #define GPIO_IN_PIN4_Msk (0x1UL << GPIO_IN_PIN4_Pos) /*!< Bit mask of PIN4 field. */ #define GPIO_IN_PIN4_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN4_High (1UL) /*!< Pin input is high */ -/* Bit 3 : P0.3 pin */ +/* Bit 3 : Pin 3 */ #define GPIO_IN_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ #define GPIO_IN_PIN3_Msk (0x1UL << GPIO_IN_PIN3_Pos) /*!< Bit mask of PIN3 field. */ #define GPIO_IN_PIN3_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN3_High (1UL) /*!< Pin input is high */ -/* Bit 2 : P0.2 pin */ +/* Bit 2 : Pin 2 */ #define GPIO_IN_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ #define GPIO_IN_PIN2_Msk (0x1UL << GPIO_IN_PIN2_Pos) /*!< Bit mask of PIN2 field. */ #define GPIO_IN_PIN2_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN2_High (1UL) /*!< Pin input is high */ -/* Bit 1 : P0.1 pin */ +/* Bit 1 : Pin 1 */ #define GPIO_IN_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ #define GPIO_IN_PIN1_Msk (0x1UL << GPIO_IN_PIN1_Pos) /*!< Bit mask of PIN1 field. */ #define GPIO_IN_PIN1_Low (0UL) /*!< Pin input is low */ #define GPIO_IN_PIN1_High (1UL) /*!< Pin input is high */ -/* Bit 0 : P0.0 pin */ +/* Bit 0 : Pin 0 */ #define GPIO_IN_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ #define GPIO_IN_PIN0_Msk (0x1UL << GPIO_IN_PIN0_Pos) /*!< Bit mask of PIN0 field. */ #define GPIO_IN_PIN0_Low (0UL) /*!< Pin input is low */ @@ -7948,193 +5675,193 @@ /* Register: GPIO_DIR */ /* Description: Direction of GPIO pins */ -/* Bit 31 : P0.31 pin */ +/* Bit 31 : Pin 31 */ #define GPIO_DIR_PIN31_Pos (31UL) /*!< Position of PIN31 field. */ #define GPIO_DIR_PIN31_Msk (0x1UL << GPIO_DIR_PIN31_Pos) /*!< Bit mask of PIN31 field. */ #define GPIO_DIR_PIN31_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN31_Output (1UL) /*!< Pin set as output */ -/* Bit 30 : P0.30 pin */ +/* Bit 30 : Pin 30 */ #define GPIO_DIR_PIN30_Pos (30UL) /*!< Position of PIN30 field. */ #define GPIO_DIR_PIN30_Msk (0x1UL << GPIO_DIR_PIN30_Pos) /*!< Bit mask of PIN30 field. */ #define GPIO_DIR_PIN30_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN30_Output (1UL) /*!< Pin set as output */ -/* Bit 29 : P0.29 pin */ +/* Bit 29 : Pin 29 */ #define GPIO_DIR_PIN29_Pos (29UL) /*!< Position of PIN29 field. */ #define GPIO_DIR_PIN29_Msk (0x1UL << GPIO_DIR_PIN29_Pos) /*!< Bit mask of PIN29 field. */ #define GPIO_DIR_PIN29_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN29_Output (1UL) /*!< Pin set as output */ -/* Bit 28 : P0.28 pin */ +/* Bit 28 : Pin 28 */ #define GPIO_DIR_PIN28_Pos (28UL) /*!< Position of PIN28 field. */ #define GPIO_DIR_PIN28_Msk (0x1UL << GPIO_DIR_PIN28_Pos) /*!< Bit mask of PIN28 field. */ #define GPIO_DIR_PIN28_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN28_Output (1UL) /*!< Pin set as output */ -/* Bit 27 : P0.27 pin */ +/* Bit 27 : Pin 27 */ #define GPIO_DIR_PIN27_Pos (27UL) /*!< Position of PIN27 field. */ #define GPIO_DIR_PIN27_Msk (0x1UL << GPIO_DIR_PIN27_Pos) /*!< Bit mask of PIN27 field. */ #define GPIO_DIR_PIN27_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN27_Output (1UL) /*!< Pin set as output */ -/* Bit 26 : P0.26 pin */ +/* Bit 26 : Pin 26 */ #define GPIO_DIR_PIN26_Pos (26UL) /*!< Position of PIN26 field. */ #define GPIO_DIR_PIN26_Msk (0x1UL << GPIO_DIR_PIN26_Pos) /*!< Bit mask of PIN26 field. */ #define GPIO_DIR_PIN26_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN26_Output (1UL) /*!< Pin set as output */ -/* Bit 25 : P0.25 pin */ +/* Bit 25 : Pin 25 */ #define GPIO_DIR_PIN25_Pos (25UL) /*!< Position of PIN25 field. */ #define GPIO_DIR_PIN25_Msk (0x1UL << GPIO_DIR_PIN25_Pos) /*!< Bit mask of PIN25 field. */ #define GPIO_DIR_PIN25_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN25_Output (1UL) /*!< Pin set as output */ -/* Bit 24 : P0.24 pin */ +/* Bit 24 : Pin 24 */ #define GPIO_DIR_PIN24_Pos (24UL) /*!< Position of PIN24 field. */ #define GPIO_DIR_PIN24_Msk (0x1UL << GPIO_DIR_PIN24_Pos) /*!< Bit mask of PIN24 field. */ #define GPIO_DIR_PIN24_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN24_Output (1UL) /*!< Pin set as output */ -/* Bit 23 : P0.23 pin */ +/* Bit 23 : Pin 23 */ #define GPIO_DIR_PIN23_Pos (23UL) /*!< Position of PIN23 field. */ #define GPIO_DIR_PIN23_Msk (0x1UL << GPIO_DIR_PIN23_Pos) /*!< Bit mask of PIN23 field. */ #define GPIO_DIR_PIN23_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN23_Output (1UL) /*!< Pin set as output */ -/* Bit 22 : P0.22 pin */ +/* Bit 22 : Pin 22 */ #define GPIO_DIR_PIN22_Pos (22UL) /*!< Position of PIN22 field. */ #define GPIO_DIR_PIN22_Msk (0x1UL << GPIO_DIR_PIN22_Pos) /*!< Bit mask of PIN22 field. */ #define GPIO_DIR_PIN22_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN22_Output (1UL) /*!< Pin set as output */ -/* Bit 21 : P0.21 pin */ +/* Bit 21 : Pin 21 */ #define GPIO_DIR_PIN21_Pos (21UL) /*!< Position of PIN21 field. */ #define GPIO_DIR_PIN21_Msk (0x1UL << GPIO_DIR_PIN21_Pos) /*!< Bit mask of PIN21 field. */ #define GPIO_DIR_PIN21_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN21_Output (1UL) /*!< Pin set as output */ -/* Bit 20 : P0.20 pin */ +/* Bit 20 : Pin 20 */ #define GPIO_DIR_PIN20_Pos (20UL) /*!< Position of PIN20 field. */ #define GPIO_DIR_PIN20_Msk (0x1UL << GPIO_DIR_PIN20_Pos) /*!< Bit mask of PIN20 field. */ #define GPIO_DIR_PIN20_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN20_Output (1UL) /*!< Pin set as output */ -/* Bit 19 : P0.19 pin */ +/* Bit 19 : Pin 19 */ #define GPIO_DIR_PIN19_Pos (19UL) /*!< Position of PIN19 field. */ #define GPIO_DIR_PIN19_Msk (0x1UL << GPIO_DIR_PIN19_Pos) /*!< Bit mask of PIN19 field. */ #define GPIO_DIR_PIN19_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN19_Output (1UL) /*!< Pin set as output */ -/* Bit 18 : P0.18 pin */ +/* Bit 18 : Pin 18 */ #define GPIO_DIR_PIN18_Pos (18UL) /*!< Position of PIN18 field. */ #define GPIO_DIR_PIN18_Msk (0x1UL << GPIO_DIR_PIN18_Pos) /*!< Bit mask of PIN18 field. */ #define GPIO_DIR_PIN18_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN18_Output (1UL) /*!< Pin set as output */ -/* Bit 17 : P0.17 pin */ +/* Bit 17 : Pin 17 */ #define GPIO_DIR_PIN17_Pos (17UL) /*!< Position of PIN17 field. */ #define GPIO_DIR_PIN17_Msk (0x1UL << GPIO_DIR_PIN17_Pos) /*!< Bit mask of PIN17 field. */ #define GPIO_DIR_PIN17_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN17_Output (1UL) /*!< Pin set as output */ -/* Bit 16 : P0.16 pin */ +/* Bit 16 : Pin 16 */ #define GPIO_DIR_PIN16_Pos (16UL) /*!< Position of PIN16 field. */ #define GPIO_DIR_PIN16_Msk (0x1UL << GPIO_DIR_PIN16_Pos) /*!< Bit mask of PIN16 field. */ #define GPIO_DIR_PIN16_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN16_Output (1UL) /*!< Pin set as output */ -/* Bit 15 : P0.15 pin */ +/* Bit 15 : Pin 15 */ #define GPIO_DIR_PIN15_Pos (15UL) /*!< Position of PIN15 field. */ #define GPIO_DIR_PIN15_Msk (0x1UL << GPIO_DIR_PIN15_Pos) /*!< Bit mask of PIN15 field. */ #define GPIO_DIR_PIN15_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN15_Output (1UL) /*!< Pin set as output */ -/* Bit 14 : P0.14 pin */ +/* Bit 14 : Pin 14 */ #define GPIO_DIR_PIN14_Pos (14UL) /*!< Position of PIN14 field. */ #define GPIO_DIR_PIN14_Msk (0x1UL << GPIO_DIR_PIN14_Pos) /*!< Bit mask of PIN14 field. */ #define GPIO_DIR_PIN14_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN14_Output (1UL) /*!< Pin set as output */ -/* Bit 13 : P0.13 pin */ +/* Bit 13 : Pin 13 */ #define GPIO_DIR_PIN13_Pos (13UL) /*!< Position of PIN13 field. */ #define GPIO_DIR_PIN13_Msk (0x1UL << GPIO_DIR_PIN13_Pos) /*!< Bit mask of PIN13 field. */ #define GPIO_DIR_PIN13_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN13_Output (1UL) /*!< Pin set as output */ -/* Bit 12 : P0.12 pin */ +/* Bit 12 : Pin 12 */ #define GPIO_DIR_PIN12_Pos (12UL) /*!< Position of PIN12 field. */ #define GPIO_DIR_PIN12_Msk (0x1UL << GPIO_DIR_PIN12_Pos) /*!< Bit mask of PIN12 field. */ #define GPIO_DIR_PIN12_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN12_Output (1UL) /*!< Pin set as output */ -/* Bit 11 : P0.11 pin */ +/* Bit 11 : Pin 11 */ #define GPIO_DIR_PIN11_Pos (11UL) /*!< Position of PIN11 field. */ #define GPIO_DIR_PIN11_Msk (0x1UL << GPIO_DIR_PIN11_Pos) /*!< Bit mask of PIN11 field. */ #define GPIO_DIR_PIN11_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN11_Output (1UL) /*!< Pin set as output */ -/* Bit 10 : P0.10 pin */ +/* Bit 10 : Pin 10 */ #define GPIO_DIR_PIN10_Pos (10UL) /*!< Position of PIN10 field. */ #define GPIO_DIR_PIN10_Msk (0x1UL << GPIO_DIR_PIN10_Pos) /*!< Bit mask of PIN10 field. */ #define GPIO_DIR_PIN10_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN10_Output (1UL) /*!< Pin set as output */ -/* Bit 9 : P0.9 pin */ +/* Bit 9 : Pin 9 */ #define GPIO_DIR_PIN9_Pos (9UL) /*!< Position of PIN9 field. */ #define GPIO_DIR_PIN9_Msk (0x1UL << GPIO_DIR_PIN9_Pos) /*!< Bit mask of PIN9 field. */ #define GPIO_DIR_PIN9_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN9_Output (1UL) /*!< Pin set as output */ -/* Bit 8 : P0.8 pin */ +/* Bit 8 : Pin 8 */ #define GPIO_DIR_PIN8_Pos (8UL) /*!< Position of PIN8 field. */ #define GPIO_DIR_PIN8_Msk (0x1UL << GPIO_DIR_PIN8_Pos) /*!< Bit mask of PIN8 field. */ #define GPIO_DIR_PIN8_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN8_Output (1UL) /*!< Pin set as output */ -/* Bit 7 : P0.7 pin */ +/* Bit 7 : Pin 7 */ #define GPIO_DIR_PIN7_Pos (7UL) /*!< Position of PIN7 field. */ #define GPIO_DIR_PIN7_Msk (0x1UL << GPIO_DIR_PIN7_Pos) /*!< Bit mask of PIN7 field. */ #define GPIO_DIR_PIN7_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN7_Output (1UL) /*!< Pin set as output */ -/* Bit 6 : P0.6 pin */ +/* Bit 6 : Pin 6 */ #define GPIO_DIR_PIN6_Pos (6UL) /*!< Position of PIN6 field. */ #define GPIO_DIR_PIN6_Msk (0x1UL << GPIO_DIR_PIN6_Pos) /*!< Bit mask of PIN6 field. */ #define GPIO_DIR_PIN6_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN6_Output (1UL) /*!< Pin set as output */ -/* Bit 5 : P0.5 pin */ +/* Bit 5 : Pin 5 */ #define GPIO_DIR_PIN5_Pos (5UL) /*!< Position of PIN5 field. */ #define GPIO_DIR_PIN5_Msk (0x1UL << GPIO_DIR_PIN5_Pos) /*!< Bit mask of PIN5 field. */ #define GPIO_DIR_PIN5_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN5_Output (1UL) /*!< Pin set as output */ -/* Bit 4 : P0.4 pin */ +/* Bit 4 : Pin 4 */ #define GPIO_DIR_PIN4_Pos (4UL) /*!< Position of PIN4 field. */ #define GPIO_DIR_PIN4_Msk (0x1UL << GPIO_DIR_PIN4_Pos) /*!< Bit mask of PIN4 field. */ #define GPIO_DIR_PIN4_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN4_Output (1UL) /*!< Pin set as output */ -/* Bit 3 : P0.3 pin */ +/* Bit 3 : Pin 3 */ #define GPIO_DIR_PIN3_Pos (3UL) /*!< Position of PIN3 field. */ #define GPIO_DIR_PIN3_Msk (0x1UL << GPIO_DIR_PIN3_Pos) /*!< Bit mask of PIN3 field. */ #define GPIO_DIR_PIN3_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN3_Output (1UL) /*!< Pin set as output */ -/* Bit 2 : P0.2 pin */ +/* Bit 2 : Pin 2 */ #define GPIO_DIR_PIN2_Pos (2UL) /*!< Position of PIN2 field. */ #define GPIO_DIR_PIN2_Msk (0x1UL << GPIO_DIR_PIN2_Pos) /*!< Bit mask of PIN2 field. */ #define GPIO_DIR_PIN2_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN2_Output (1UL) /*!< Pin set as output */ -/* Bit 1 : P0.1 pin */ +/* Bit 1 : Pin 1 */ #define GPIO_DIR_PIN1_Pos (1UL) /*!< Position of PIN1 field. */ #define GPIO_DIR_PIN1_Msk (0x1UL << GPIO_DIR_PIN1_Pos) /*!< Bit mask of PIN1 field. */ #define GPIO_DIR_PIN1_Input (0UL) /*!< Pin set as input */ #define GPIO_DIR_PIN1_Output (1UL) /*!< Pin set as output */ -/* Bit 0 : P0.0 pin */ +/* Bit 0 : Pin 0 */ #define GPIO_DIR_PIN0_Pos (0UL) /*!< Position of PIN0 field. */ #define GPIO_DIR_PIN0_Msk (0x1UL << GPIO_DIR_PIN0_Pos) /*!< Bit mask of PIN0 field. */ #define GPIO_DIR_PIN0_Input (0UL) /*!< Pin set as input */ @@ -10440,24 +8167,24 @@ #define PWM_LOOP_CNT_Disabled (0UL) /*!< Looping disabled (stop at the end of the sequence) */ /* Register: PWM_SEQ_PTR */ -/* Description: Description cluster[0]: Beginning address in Data RAM of sequence A */ +/* Description: Description cluster[0]: Beginning address in Data RAM of this sequence */ -/* Bits 31..0 : Beginning address in Data RAM of sequence A */ +/* Bits 31..0 : Beginning address in Data RAM of this sequence */ #define PWM_SEQ_PTR_PTR_Pos (0UL) /*!< Position of PTR field. */ #define PWM_SEQ_PTR_PTR_Msk (0xFFFFFFFFUL << PWM_SEQ_PTR_PTR_Pos) /*!< Bit mask of PTR field. */ /* Register: PWM_SEQ_CNT */ -/* Description: Description cluster[0]: Amount of values (duty cycles) in sequence A */ +/* Description: Description cluster[0]: Amount of values (duty cycles) in this sequence */ -/* Bits 14..0 : Amount of values (duty cycles) in sequence A */ +/* Bits 14..0 : Amount of values (duty cycles) in this sequence */ #define PWM_SEQ_CNT_CNT_Pos (0UL) /*!< Position of CNT field. */ #define PWM_SEQ_CNT_CNT_Msk (0x7FFFUL << PWM_SEQ_CNT_CNT_Pos) /*!< Bit mask of CNT field. */ #define PWM_SEQ_CNT_CNT_Disabled (0UL) /*!< Sequence is disabled, and shall not be started as it is empty */ /* Register: PWM_SEQ_REFRESH */ -/* Description: Description cluster[0]: Amount of additional PWM periods between samples loaded to compare register (load every CNT+1 PWM periods) */ +/* Description: Description cluster[0]: Amount of additional PWM periods between samples loaded into compare register */ -/* Bits 23..0 : Amount of additional PWM periods between samples loaded to compare register (load every CNT+1 PWM periods) */ +/* Bits 23..0 : Amount of additional PWM periods between samples loaded into compare register (load every REFRESH.CNT+1 PWM periods) */ #define PWM_SEQ_REFRESH_CNT_Pos (0UL) /*!< Position of CNT field. */ #define PWM_SEQ_REFRESH_CNT_Msk (0xFFFFFFUL << PWM_SEQ_REFRESH_CNT_Pos) /*!< Bit mask of CNT field. */ #define PWM_SEQ_REFRESH_CNT_Continuous (0UL) /*!< Update every PWM period */ @@ -13375,18 +11102,21 @@ #define TWI_ERRORSRC_DNACK_Msk (0x1UL << TWI_ERRORSRC_DNACK_Pos) /*!< Bit mask of DNACK field. */ #define TWI_ERRORSRC_DNACK_NotPresent (0UL) /*!< Read: error not present */ #define TWI_ERRORSRC_DNACK_Present (1UL) /*!< Read: error present */ +#define TWI_ERRORSRC_DNACK_Clear (1UL) /*!< Write: clear error on writing '1' */ /* Bit 1 : NACK received after sending the address (write '1' to clear) */ #define TWI_ERRORSRC_ANACK_Pos (1UL) /*!< Position of ANACK field. */ #define TWI_ERRORSRC_ANACK_Msk (0x1UL << TWI_ERRORSRC_ANACK_Pos) /*!< Bit mask of ANACK field. */ #define TWI_ERRORSRC_ANACK_NotPresent (0UL) /*!< Read: error not present */ #define TWI_ERRORSRC_ANACK_Present (1UL) /*!< Read: error present */ +#define TWI_ERRORSRC_ANACK_Clear (1UL) /*!< Write: clear error on writing '1' */ /* Bit 0 : Overrun error */ #define TWI_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ #define TWI_ERRORSRC_OVERRUN_Msk (0x1UL << TWI_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ #define TWI_ERRORSRC_OVERRUN_NotPresent (0UL) /*!< Read: no overrun occured */ #define TWI_ERRORSRC_OVERRUN_Present (1UL) /*!< Read: overrun occured */ +#define TWI_ERRORSRC_OVERRUN_Clear (1UL) /*!< Write: clear error on writing '1' */ /* Register: TWI_ENABLE */ /* Description: Enable TWI */ @@ -13645,6 +11375,12 @@ #define TWIM_ERRORSRC_ANACK_NotReceived (0UL) /*!< Error did not occur */ #define TWIM_ERRORSRC_ANACK_Received (1UL) /*!< Error occurred */ +/* Bit 0 : Overrun error */ +#define TWIM_ERRORSRC_OVERRUN_Pos (0UL) /*!< Position of OVERRUN field. */ +#define TWIM_ERRORSRC_OVERRUN_Msk (0x1UL << TWIM_ERRORSRC_OVERRUN_Pos) /*!< Bit mask of OVERRUN field. */ +#define TWIM_ERRORSRC_OVERRUN_NotReceived (0UL) /*!< Error did not occur */ +#define TWIM_ERRORSRC_OVERRUN_Received (1UL) /*!< Error occurred */ + /* Register: TWIM_ENABLE */ /* Description: Enable TWIM */ @@ -14233,7 +11969,7 @@ /* Register: UART_BAUDRATE */ /* Description: Baud rate */ -/* Bits 31..0 : Baud-rate */ +/* Bits 31..0 : Baud rate */ #define UART_BAUDRATE_BAUDRATE_Pos (0UL) /*!< Position of BAUDRATE field. */ #define UART_BAUDRATE_BAUDRATE_Msk (0xFFFFFFFFUL << UART_BAUDRATE_BAUDRATE_Pos) /*!< Bit mask of BAUDRATE field. */ #define UART_BAUDRATE_BAUDRATE_Baud1200 (0x0004F000UL) /*!< 1200 baud (actual rate: 1205) */ @@ -14243,7 +11979,9 @@ #define UART_BAUDRATE_BAUDRATE_Baud14400 (0x003B0000UL) /*!< 14400 baud (actual rate: 14414) */ #define UART_BAUDRATE_BAUDRATE_Baud19200 (0x004EA000UL) /*!< 19200 baud (actual rate: 19208) */ #define UART_BAUDRATE_BAUDRATE_Baud28800 (0x0075F000UL) /*!< 28800 baud (actual rate: 28829) */ +#define UART_BAUDRATE_BAUDRATE_Baud31250 (0x00800000UL) /*!< 31250 baud */ #define UART_BAUDRATE_BAUDRATE_Baud38400 (0x009D5000UL) /*!< 38400 baud (actual rate: 38462) */ +#define UART_BAUDRATE_BAUDRATE_Baud56000 (0x00E50000UL) /*!< 56000 baud (actual rate: 55944) */ #define UART_BAUDRATE_BAUDRATE_Baud57600 (0x00EBF000UL) /*!< 57600 baud (actual rate: 57762) */ #define UART_BAUDRATE_BAUDRATE_Baud76800 (0x013A9000UL) /*!< 76800 baud (actual rate: 76923) */ #define UART_BAUDRATE_BAUDRATE_Baud115200 (0x01D7E000UL) /*!< 115200 baud (actual rate: 115942) */ @@ -14326,12 +12064,24 @@ #define UARTE_INTEN_ENDTX_Disabled (0UL) /*!< Disable */ #define UARTE_INTEN_ENDTX_Enabled (1UL) /*!< Enable */ +/* Bit 7 : Enable or disable interrupt for TXDRDY event */ +#define UARTE_INTEN_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UARTE_INTEN_TXDRDY_Msk (0x1UL << UARTE_INTEN_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UARTE_INTEN_TXDRDY_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_TXDRDY_Enabled (1UL) /*!< Enable */ + /* Bit 4 : Enable or disable interrupt for ENDRX event */ #define UARTE_INTEN_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ #define UARTE_INTEN_ENDRX_Msk (0x1UL << UARTE_INTEN_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ #define UARTE_INTEN_ENDRX_Disabled (0UL) /*!< Disable */ #define UARTE_INTEN_ENDRX_Enabled (1UL) /*!< Enable */ +/* Bit 2 : Enable or disable interrupt for RXDRDY event */ +#define UARTE_INTEN_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UARTE_INTEN_RXDRDY_Msk (0x1UL << UARTE_INTEN_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UARTE_INTEN_RXDRDY_Disabled (0UL) /*!< Disable */ +#define UARTE_INTEN_RXDRDY_Enabled (1UL) /*!< Enable */ + /* Bit 1 : Enable or disable interrupt for NCTS event */ #define UARTE_INTEN_NCTS_Pos (1UL) /*!< Position of NCTS field. */ #define UARTE_INTEN_NCTS_Msk (0x1UL << UARTE_INTEN_NCTS_Pos) /*!< Bit mask of NCTS field. */ @@ -14389,6 +12139,13 @@ #define UARTE_INTENSET_ENDTX_Enabled (1UL) /*!< Read: Enabled */ #define UARTE_INTENSET_ENDTX_Set (1UL) /*!< Enable */ +/* Bit 7 : Write '1' to Enable interrupt for TXDRDY event */ +#define UARTE_INTENSET_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UARTE_INTENSET_TXDRDY_Msk (0x1UL << UARTE_INTENSET_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UARTE_INTENSET_TXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_TXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_TXDRDY_Set (1UL) /*!< Enable */ + /* Bit 4 : Write '1' to Enable interrupt for ENDRX event */ #define UARTE_INTENSET_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ #define UARTE_INTENSET_ENDRX_Msk (0x1UL << UARTE_INTENSET_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ @@ -14396,6 +12153,13 @@ #define UARTE_INTENSET_ENDRX_Enabled (1UL) /*!< Read: Enabled */ #define UARTE_INTENSET_ENDRX_Set (1UL) /*!< Enable */ +/* Bit 2 : Write '1' to Enable interrupt for RXDRDY event */ +#define UARTE_INTENSET_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UARTE_INTENSET_RXDRDY_Msk (0x1UL << UARTE_INTENSET_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UARTE_INTENSET_RXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENSET_RXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENSET_RXDRDY_Set (1UL) /*!< Enable */ + /* Bit 1 : Write '1' to Enable interrupt for NCTS event */ #define UARTE_INTENSET_NCTS_Pos (1UL) /*!< Position of NCTS field. */ #define UARTE_INTENSET_NCTS_Msk (0x1UL << UARTE_INTENSET_NCTS_Pos) /*!< Bit mask of NCTS field. */ @@ -14455,6 +12219,13 @@ #define UARTE_INTENCLR_ENDTX_Enabled (1UL) /*!< Read: Enabled */ #define UARTE_INTENCLR_ENDTX_Clear (1UL) /*!< Disable */ +/* Bit 7 : Write '1' to Disable interrupt for TXDRDY event */ +#define UARTE_INTENCLR_TXDRDY_Pos (7UL) /*!< Position of TXDRDY field. */ +#define UARTE_INTENCLR_TXDRDY_Msk (0x1UL << UARTE_INTENCLR_TXDRDY_Pos) /*!< Bit mask of TXDRDY field. */ +#define UARTE_INTENCLR_TXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_TXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_TXDRDY_Clear (1UL) /*!< Disable */ + /* Bit 4 : Write '1' to Disable interrupt for ENDRX event */ #define UARTE_INTENCLR_ENDRX_Pos (4UL) /*!< Position of ENDRX field. */ #define UARTE_INTENCLR_ENDRX_Msk (0x1UL << UARTE_INTENCLR_ENDRX_Pos) /*!< Bit mask of ENDRX field. */ @@ -14462,6 +12233,13 @@ #define UARTE_INTENCLR_ENDRX_Enabled (1UL) /*!< Read: Enabled */ #define UARTE_INTENCLR_ENDRX_Clear (1UL) /*!< Disable */ +/* Bit 2 : Write '1' to Disable interrupt for RXDRDY event */ +#define UARTE_INTENCLR_RXDRDY_Pos (2UL) /*!< Position of RXDRDY field. */ +#define UARTE_INTENCLR_RXDRDY_Msk (0x1UL << UARTE_INTENCLR_RXDRDY_Pos) /*!< Bit mask of RXDRDY field. */ +#define UARTE_INTENCLR_RXDRDY_Disabled (0UL) /*!< Read: Disabled */ +#define UARTE_INTENCLR_RXDRDY_Enabled (1UL) /*!< Read: Enabled */ +#define UARTE_INTENCLR_RXDRDY_Clear (1UL) /*!< Disable */ + /* Bit 1 : Write '1' to Disable interrupt for NCTS event */ #define UARTE_INTENCLR_NCTS_Pos (1UL) /*!< Position of NCTS field. */ #define UARTE_INTENCLR_NCTS_Msk (0x1UL << UARTE_INTENCLR_NCTS_Pos) /*!< Bit mask of NCTS field. */ @@ -14565,9 +12343,9 @@ #define UARTE_PSEL_RXD_PIN_Msk (0x1FUL << UARTE_PSEL_RXD_PIN_Pos) /*!< Bit mask of PIN field. */ /* Register: UARTE_BAUDRATE */ -/* Description: Baud rate */ +/* Description: Baud rate. Accuracy depends on the HFCLK source selected. */ -/* Bits 31..0 : Baud-rate */ +/* Bits 31..0 : Baud rate */ #define UARTE_BAUDRATE_BAUDRATE_Pos (0UL) /*!< Position of BAUDRATE field. */ #define UARTE_BAUDRATE_BAUDRATE_Msk (0xFFFFFFFFUL << UARTE_BAUDRATE_BAUDRATE_Pos) /*!< Bit mask of BAUDRATE field. */ #define UARTE_BAUDRATE_BAUDRATE_Baud1200 (0x0004F000UL) /*!< 1200 baud (actual rate: 1205) */ @@ -14577,7 +12355,9 @@ #define UARTE_BAUDRATE_BAUDRATE_Baud14400 (0x003AF000UL) /*!< 14400 baud (actual rate: 14401) */ #define UARTE_BAUDRATE_BAUDRATE_Baud19200 (0x004EA000UL) /*!< 19200 baud (actual rate: 19208) */ #define UARTE_BAUDRATE_BAUDRATE_Baud28800 (0x0075C000UL) /*!< 28800 baud (actual rate: 28777) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud31250 (0x00800000UL) /*!< 31250 baud */ #define UARTE_BAUDRATE_BAUDRATE_Baud38400 (0x009D0000UL) /*!< 38400 baud (actual rate: 38369) */ +#define UARTE_BAUDRATE_BAUDRATE_Baud56000 (0x00E50000UL) /*!< 56000 baud (actual rate: 55944) */ #define UARTE_BAUDRATE_BAUDRATE_Baud57600 (0x00EB0000UL) /*!< 57600 baud (actual rate: 57554) */ #define UARTE_BAUDRATE_BAUDRATE_Baud76800 (0x013A9000UL) /*!< 76800 baud (actual rate: 76923) */ #define UARTE_BAUDRATE_BAUDRATE_Baud115200 (0x01D60000UL) /*!< 115200 baud (actual rate: 115108) */ @@ -14685,7 +12465,7 @@ /* Register: UICR_APPROTECT */ /* Description: Access Port protection */ -/* Bits 7..0 : Enable or disable Access Port protection. */ +/* Bits 7..0 : Enable or disable Access Port protection. Any other value than 0xFF being written to this field will enable protection. */ #define UICR_APPROTECT_PALL_Pos (0UL) /*!< Position of PALL field. */ #define UICR_APPROTECT_PALL_Msk (0xFFUL << UICR_APPROTECT_PALL_Pos) /*!< Bit mask of PALL field. */ #define UICR_APPROTECT_PALL_Enabled (0x00UL) /*!< Enable */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_name_change.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_name_change.h index 7f362a8fd9..39cd69d6df 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_name_change.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_name_change.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,8 +35,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - + #ifndef NRF52_NAME_CHANGE_H #define NRF52_NAME_CHANGE_H @@ -69,9 +68,9 @@ #define I2S_CONFIG_CHANNELS_CHANNELS_LEFT I2S_CONFIG_CHANNELS_CHANNELS_Left #define I2S_CONFIG_CHANNELS_CHANNELS_RIGHT I2S_CONFIG_CHANNELS_CHANNELS_Right - - - +/* LPCOMP */ +/* Corrected typo in RESULT register. */ +#define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below /*lint --flb "Leave library region" */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_to_nrf52840.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_to_nrf52840.h new file mode 100644 index 0000000000..95fdf12345 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/device/nrf52_to_nrf52840.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF52_TO_NRF52840_H +#define NRF52_TO_NRF52840_H + +/*lint ++flb "Enter library region */ + +/* This file is given to prevent your SW from not compiling with the name changes between nRF51 or nRF52832 and nRF52840 devices. + * It redefines the old nRF51 or nRF52832 names into the new ones as long as the functionality is still supported. If the + * functionality is gone, there old names are not defined, so compilation will fail. Note that also includes macros + * from the nrf52_namechange.h file. */ + +/* Differences between latest nRF52 headers and nRF52840 headers. */ + +/* UART */ +/* The registers PSELRTS, PSELTXD, PSELCTS, PSELRXD were restructured into a struct. */ +#define PSELRTS PSEL.RTS +#define PSELTXD PSEL.TXD +#define PSELCTS PSEL.CTS +#define PSELRXD PSEL.RXD + +/* TWI */ +/* The registers PSELSCL, PSELSDA were restructured into a struct. */ +#define PSELSCL PSEL.SCL +#define PSELSDA PSEL.SDA + + +/* From nrf52_name_change.h. Several macros changed in different versions of nRF52 headers. By defining the following, any code written for any version of nRF52 headers will still compile. */ + +/* I2S */ +/* Several enumerations changed case. Adding old macros to keep compilation compatibility. */ +#define I2S_ENABLE_ENABLE_DISABLE I2S_ENABLE_ENABLE_Disabled +#define I2S_ENABLE_ENABLE_ENABLE I2S_ENABLE_ENABLE_Enabled +#define I2S_CONFIG_MODE_MODE_MASTER I2S_CONFIG_MODE_MODE_Master +#define I2S_CONFIG_MODE_MODE_SLAVE I2S_CONFIG_MODE_MODE_Slave +#define I2S_CONFIG_RXEN_RXEN_DISABLE I2S_CONFIG_RXEN_RXEN_Disabled +#define I2S_CONFIG_RXEN_RXEN_ENABLE I2S_CONFIG_RXEN_RXEN_Enabled +#define I2S_CONFIG_TXEN_TXEN_DISABLE I2S_CONFIG_TXEN_TXEN_Disabled +#define I2S_CONFIG_TXEN_TXEN_ENABLE I2S_CONFIG_TXEN_TXEN_Enabled +#define I2S_CONFIG_MCKEN_MCKEN_DISABLE I2S_CONFIG_MCKEN_MCKEN_Disabled +#define I2S_CONFIG_MCKEN_MCKEN_ENABLE I2S_CONFIG_MCKEN_MCKEN_Enabled +#define I2S_CONFIG_SWIDTH_SWIDTH_8BIT I2S_CONFIG_SWIDTH_SWIDTH_8Bit +#define I2S_CONFIG_SWIDTH_SWIDTH_16BIT I2S_CONFIG_SWIDTH_SWIDTH_16Bit +#define I2S_CONFIG_SWIDTH_SWIDTH_24BIT I2S_CONFIG_SWIDTH_SWIDTH_24Bit +#define I2S_CONFIG_ALIGN_ALIGN_LEFT I2S_CONFIG_ALIGN_ALIGN_Left +#define I2S_CONFIG_ALIGN_ALIGN_RIGHT I2S_CONFIG_ALIGN_ALIGN_Right +#define I2S_CONFIG_FORMAT_FORMAT_ALIGNED I2S_CONFIG_FORMAT_FORMAT_Aligned +#define I2S_CONFIG_CHANNELS_CHANNELS_STEREO I2S_CONFIG_CHANNELS_CHANNELS_Stereo +#define I2S_CONFIG_CHANNELS_CHANNELS_LEFT I2S_CONFIG_CHANNELS_CHANNELS_Left +#define I2S_CONFIG_CHANNELS_CHANNELS_RIGHT I2S_CONFIG_CHANNELS_CHANNELS_Right + +/* LPCOMP */ +/* Corrected typo in RESULT register. */ +#define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below + + +/*lint --flb "Leave library region" */ + +#endif /* NRF51_TO_NRF52840_H */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.c index 5d5c843f8d..3e8bcdc224 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.c @@ -36,7 +36,6 @@ * */ - #include "ble_flash.h" #include #include @@ -69,7 +68,7 @@ uint16_t ble_flash_crc16_compute(uint8_t * p_data, uint16_t size, uint16_t * p_c /**@brief Function for erasing a page in flash. - * + * * @param[in] p_page Pointer to first word in page to be erased. */ static void flash_page_erase(uint32_t * p_page) @@ -116,7 +115,7 @@ static void flash_word_unprotected_write(uint32_t * p_address, uint32_t value) // Do nothing. } *p_address = value; - + // Wait flash write to finish while (NRF_NVMC->READY == NVMC_READY_READY_Busy) { @@ -264,7 +263,7 @@ uint32_t ble_flash_page_read(uint8_t page_num, uint32_t * p_out_array, uint8_t * uint16_t calc_crc; uint32_t tmp; - p_page = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num); + p_page = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num); p_curr_addr = p_page; // Check if block is valid diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.h index c3943438c1..9dc9c61505 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ble_flash/ble_flash.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup ble_flash_module Flash Manager @@ -61,16 +60,20 @@ #include #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + #define BLE_FLASH_PAGE_SIZE ((uint16_t)NRF_FICR->CODEPAGESIZE) /**< Size of one flash page. */ #define BLE_FLASH_MAGIC_NUMBER 0x45DE0000 /**< Magic value to identify if flash contains valid data. */ #define BLE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */ /**@brief Macro for getting the end of the flash available for application. - * - * @details The result flash page number indicates the end boundary of the flash available - * to the application. If a bootloader is used, the end will be the start of the - * bootloader region. Otherwise, the end will be the size of the flash. + * + * @details The result flash page number indicates the end boundary of the flash available + * to the application. If a bootloader is used, the end will be the start of the + * bootloader region. Otherwise, the end will be the size of the flash. */ #define BLE_FLASH_PAGE_END \ ((NRF_UICR->NRFFW[0] != BLE_FLASH_EMPTY_MASK) \ @@ -93,12 +96,12 @@ uint32_t ble_flash_page_write(uint8_t page_num, uint32_t * p_in_array, uint8_t w /**@brief Function for reading data from flash to RAM. * * @param[in] page_num Page number to read. - * @param[out] p_out_array Pointer to a RAM area where the found data will be written. + * @param[out] p_out_array Pointer to a RAM area where the found data will be written. * This area has to be 32 bits aligned. * @param[out] p_word_count Number of 32 bits words read. * * @return NRF_SUCCESS on successful upload, NRF_ERROR_NOT_FOUND if no valid data has been found - * in flash (first 32 bits not equal to the MAGIC_NUMBER+CRC). + * in flash (first 32 bits not equal to the MAGIC_NUMBER + CRC). */ uint32_t ble_flash_page_read(uint8_t page_num, uint32_t * p_out_array, uint8_t * p_word_count); @@ -145,7 +148,7 @@ uint32_t ble_flash_block_write(uint32_t * p_address, uint32_t * p_in_array, uint uint32_t ble_flash_page_addr(uint8_t page_num, uint32_t ** pp_page_addr); /**@brief Function for calculating a 16 bit CRC using the CRC-16-CCITT scheme. - * + * * @param[in] p_data Pointer to data on which the CRC is to be calulated. * @param[in] size Number of bytes on which the CRC is to be calulated. * @param[in] p_crc Initial CRC value (if NULL, a preset value is used as the initial value). @@ -164,6 +167,11 @@ uint16_t ble_flash_crc16_compute(uint8_t * p_data, uint16_t size, uint16_t * p_c */ void ble_flash_on_radio_active_evt(bool radio_active); + +#ifdef __cplusplus +} +#endif + #endif // BLE_FLASH_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.c index 00265d60b0..5a056b02e6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,19 +35,38 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(CLOCK) #include "nrf_drv_clock.h" #include "nrf_error.h" -#include "nordic_common.h" - +#include "app_util_platform.h" #ifdef SOFTDEVICE_PRESENT +#include "softdevice_handler.h" #include "nrf_sdm.h" #include "nrf_soc.h" -#include "app_util_platform.h" -#else -#include "app_util_platform.h" -#endif // SOFTDEVICE_PRESENT +#endif + +#define NRF_LOG_MODULE_NAME "CLOCK" + +#if CLOCK_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL CLOCK_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR CLOCK_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR CLOCK_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_CLOCK_EVENT_HFCLKSTARTED ? "NRF_CLOCK_EVENT_HFCLKSTARTED" : \ + (event == NRF_CLOCK_EVENT_LFCLKSTARTED ? "NRF_CLOCK_EVENT_LFCLKSTARTED" : \ + (event == NRF_CLOCK_EVENT_DONE ? "NRF_CLOCK_EVENT_DONE" : \ + (event == NRF_CLOCK_EVENT_CTTO ? "NRF_CLOCK_EVENT_CTTO" : "UNKNOWN EVENT")))) +#else //CLOCK_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //CLOCK_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + + +/* Validate configuration */ +INTERRUPT_PRIORITY_VALIDATION(CLOCK_CONFIG_IRQ_PRIORITY); /*lint -save -e652 */ #define NRF_CLOCK_LFCLK_RC CLOCK_LFCLKSRC_SRC_RC @@ -55,8 +74,6 @@ #define NRF_CLOCK_LFCLK_Synth CLOCK_LFCLKSRC_SRC_Synth /*lint -restore */ -#define INT_MAX 0xFFFFFFFF - #if (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LFCLK_RC) && !defined(SOFTDEVICE_PRESENT) #define CALIBRATION_SUPPORT 1 #else @@ -74,25 +91,23 @@ typedef enum /**@brief CLOCK control block. */ typedef struct { - volatile uint32_t hfclk_requests; /*< High-frequency clock request counter. */ - volatile nrf_drv_clock_handler_item_t * p_hf_head; bool module_initialized; /*< Indicate the state of module */ volatile bool hfclk_on; /*< High-frequency clock state. */ -#ifndef SOFTDEVICE_PRESENT volatile bool lfclk_on; /*< Low-frequency clock state. */ - uint32_t lfclk_requests; /*< Low-frequency clock request counter. */ + volatile uint32_t hfclk_requests; /*< High-frequency clock request counter. */ + volatile nrf_drv_clock_handler_item_t * p_hf_head; + volatile uint32_t lfclk_requests; /*< Low-frequency clock request counter. */ volatile nrf_drv_clock_handler_item_t * p_lf_head; #if CALIBRATION_SUPPORT nrf_drv_clock_handler_item_t cal_hfclk_started_handler_item; nrf_drv_clock_event_handler_t cal_done_handler; volatile nrf_drv_clock_cal_state_t cal_state; -#endif //CALIBRATION_SUPPORT -#endif //SOFTDEVICE_PRESENT -}nrf_drv_clock_cb_t; +#endif // CALIBRATION_SUPPORT +} nrf_drv_clock_cb_t; static nrf_drv_clock_cb_t m_clock_cb; -#ifndef SOFTDEVICE_PRESENT + /**@brief Function for starting LFCLK. This function will return immediately without waiting for start. */ static void lfclk_start(void) @@ -108,92 +123,117 @@ static void lfclk_stop(void) { #if CALIBRATION_SUPPORT (void)nrf_drv_clock_calibration_abort(); -#endif //CALIBRATION_SUPPORT +#endif + +#ifdef SOFTDEVICE_PRESENT + // If LFCLK is requested to stop while SD is still enabled, + // it indicates an error in the application. + // Enabling SD should increment the LFCLK request. + ASSERT(!softdevice_handler_is_enabled()); +#endif // SOFTDEVICE_PRESENT nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTOP); while (nrf_clock_lf_is_running()) {} + m_clock_cb.lfclk_on = false; } -#endif + static void hfclk_start(void) { -#ifndef SOFTDEVICE_PRESENT +#ifdef SOFTDEVICE_PRESENT + if (softdevice_handler_is_enabled()) + { + (void)sd_clock_hfclk_request(); + return; + } +#endif // SOFTDEVICE_PRESENT + nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED); nrf_clock_int_enable(NRF_CLOCK_INT_HF_STARTED_MASK); nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTART); -#else - UNUSED_VARIABLE(sd_clock_hfclk_request()); -#endif } static void hfclk_stop(void) { -#ifndef SOFTDEVICE_PRESENT +#ifdef SOFTDEVICE_PRESENT + if (softdevice_handler_is_enabled()) + { + (void)sd_clock_hfclk_release(); + return; + } +#endif // SOFTDEVICE_PRESENT + nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTOP); while (nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY)) {} -#else - UNUSED_VARIABLE(sd_clock_hfclk_release()); -#endif + m_clock_cb.hfclk_on = false; +} + +bool nrf_drv_clock_init_check(void) +{ + return m_clock_cb.module_initialized; } ret_code_t nrf_drv_clock_init(void) { - uint32_t result = NRF_SUCCESS; - + ret_code_t err_code = NRF_SUCCESS; if (m_clock_cb.module_initialized) { - return MODULE_ALREADY_INITIALIZED; + err_code = NRF_ERROR_MODULE_ALREADY_INITIALIZED; + } + else + { + m_clock_cb.p_hf_head = NULL; + m_clock_cb.hfclk_requests = 0; + m_clock_cb.p_lf_head = NULL; + m_clock_cb.lfclk_requests = 0; + nrf_drv_common_power_clock_irq_init(); +#ifdef SOFTDEVICE_PRESENT + if (!softdevice_handler_is_enabled()) +#endif + { + nrf_clock_lf_src_set((nrf_clock_lfclk_t)CLOCK_CONFIG_LF_SRC); + } + +#if CALIBRATION_SUPPORT + m_clock_cb.cal_state = CAL_STATE_IDLE; +#endif + + m_clock_cb.module_initialized = true; } - m_clock_cb.p_hf_head = NULL; - m_clock_cb.hfclk_requests = 0; -#ifndef SOFTDEVICE_PRESENT - m_clock_cb.p_lf_head = NULL; - m_clock_cb.lfclk_requests = 0; - nrf_clock_xtalfreq_set(CLOCK_CONFIG_XTAL_FREQ); - nrf_clock_lf_src_set((nrf_clock_lfclk_t)CLOCK_CONFIG_LF_SRC); - nrf_drv_common_irq_enable(POWER_CLOCK_IRQn, CLOCK_CONFIG_IRQ_PRIORITY); -#if CALIBRATION_SUPPORT - m_clock_cb.cal_state = CAL_STATE_IDLE; -#endif // CALIBRATION_SUPPORT -#else // SOFTDEVICE_PRESENT - uint8_t is_enabled; - result = sd_softdevice_is_enabled(&is_enabled); - if((result == NRF_SUCCESS) && !is_enabled) - { - result = NRF_ERROR_SOFTDEVICE_NOT_ENABLED; - } -#endif // SOFTDEVICE_PRESENT - m_clock_cb.module_initialized = true; - return result; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", + (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } void nrf_drv_clock_uninit(void) { ASSERT(m_clock_cb.module_initialized); -#ifndef SOFTDEVICE_PRESENT - nrf_drv_common_irq_disable(POWER_CLOCK_IRQn); + nrf_drv_common_clock_irq_disable(); nrf_clock_int_disable(0xFFFFFFFF); - lfclk_stop(); -#endif + + lfclk_stop(); hfclk_stop(); m_clock_cb.module_initialized = false; + NRF_LOG_INFO("Uninitialized.\r\n"); } static void item_enqueue(nrf_drv_clock_handler_item_t ** p_head, nrf_drv_clock_handler_item_t * p_item) { - if (*p_head) + nrf_drv_clock_handler_item_t * p_next = *p_head; + while(p_next) { - p_item->p_next = *p_head; - *p_head = p_item; - } - else - { - p_item->p_next = NULL; - *p_head = p_item; + if(p_next == p_item) + { + return; + } + p_next = p_next->p_next; } + + p_item->p_next = (*p_head ? *p_head : NULL); + *p_head = p_item; } static nrf_drv_clock_handler_item_t * item_dequeue(nrf_drv_clock_handler_item_t ** p_head) @@ -203,103 +243,101 @@ static nrf_drv_clock_handler_item_t * item_dequeue(nrf_drv_clock_handler_item_t { *p_head = p_item->p_next; } - return p_item; } void nrf_drv_clock_lfclk_request(nrf_drv_clock_handler_item_t * p_handler_item) { ASSERT(m_clock_cb.module_initialized); -#ifndef SOFTDEVICE_PRESENT - ASSERT(m_clock_cb.lfclk_requests != INT_MAX); - CRITICAL_REGION_ENTER(); + if (m_clock_cb.lfclk_on) { if (p_handler_item) { p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_LFCLK_STARTED); } + CRITICAL_REGION_ENTER(); + ++(m_clock_cb.lfclk_requests); + CRITICAL_REGION_EXIT(); } else { - + CRITICAL_REGION_ENTER(); if (p_handler_item) { - item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head, p_handler_item); + item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head, + p_handler_item); } if (m_clock_cb.lfclk_requests == 0) { lfclk_start(); } + ++(m_clock_cb.lfclk_requests); + CRITICAL_REGION_EXIT(); } - m_clock_cb.lfclk_requests++; - CRITICAL_REGION_EXIT(); -#else - if (p_handler_item) - { - p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_LFCLK_STARTED); - } -#endif // SOFTDEVICE_PRESENT -} + ASSERT(m_clock_cb.lfclk_requests > 0); +} void nrf_drv_clock_lfclk_release(void) { ASSERT(m_clock_cb.module_initialized); -#ifndef SOFTDEVICE_PRESENT ASSERT(m_clock_cb.lfclk_requests > 0); CRITICAL_REGION_ENTER(); - m_clock_cb.lfclk_requests--; + --(m_clock_cb.lfclk_requests); if (m_clock_cb.lfclk_requests == 0) { lfclk_stop(); - m_clock_cb.lfclk_on = false; - m_clock_cb.p_lf_head = NULL; } CRITICAL_REGION_EXIT(); -#endif // SOFTDEVICE_PRESENT } - bool nrf_drv_clock_lfclk_is_running(void) { ASSERT(m_clock_cb.module_initialized); - bool result; -#ifndef SOFTDEVICE_PRESENT - result = nrf_clock_lf_is_running(); -#else - result = true; -#endif - return result; + +#ifdef SOFTDEVICE_PRESENT + if (softdevice_handler_is_enabled()) + { + return true; + } +#endif // SOFTDEVICE_PRESENT + + return nrf_clock_lf_is_running(); } void nrf_drv_clock_hfclk_request(nrf_drv_clock_handler_item_t * p_handler_item) { ASSERT(m_clock_cb.module_initialized); - ASSERT(m_clock_cb.hfclk_requests != INT_MAX); - CRITICAL_REGION_ENTER(); if (m_clock_cb.hfclk_on) { if (p_handler_item) { p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_HFCLK_STARTED); } + CRITICAL_REGION_ENTER(); + ++(m_clock_cb.hfclk_requests); + CRITICAL_REGION_EXIT(); } else { + CRITICAL_REGION_ENTER(); if (p_handler_item) { - item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, p_handler_item); + item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, + p_handler_item); } if (m_clock_cb.hfclk_requests == 0) { hfclk_start(); } + ++(m_clock_cb.hfclk_requests); + CRITICAL_REGION_EXIT(); } - m_clock_cb.hfclk_requests++; - CRITICAL_REGION_EXIT(); + + ASSERT(m_clock_cb.hfclk_requests > 0); } void nrf_drv_clock_hfclk_release(void) @@ -307,31 +345,29 @@ void nrf_drv_clock_hfclk_release(void) ASSERT(m_clock_cb.module_initialized); ASSERT(m_clock_cb.hfclk_requests > 0); - //disable interrupts CLOCK or SoftDevice events CRITICAL_REGION_ENTER(); - m_clock_cb.hfclk_requests--; + --(m_clock_cb.hfclk_requests); if (m_clock_cb.hfclk_requests == 0) { hfclk_stop(); - m_clock_cb.hfclk_on = false; - m_clock_cb.p_hf_head = NULL; } CRITICAL_REGION_EXIT(); - //enable interrupts CLOCK or SoftDevice events } bool nrf_drv_clock_hfclk_is_running(void) { - bool result; ASSERT(m_clock_cb.module_initialized); -#ifndef SOFTDEVICE_PRESENT - result = nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY); -#else - uint32_t is_running; - UNUSED_VARIABLE(sd_clock_hfclk_is_running(&is_running)); - result = is_running ? true : false; -#endif - return result; + +#ifdef SOFTDEVICE_PRESENT + if (softdevice_handler_is_enabled()) + { + uint32_t is_running; + UNUSED_VARIABLE(sd_clock_hfclk_is_running(&is_running)); + return (is_running ? true : false); + } +#endif // SOFTDEVICE_PRESENT + + return nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY); } #if CALIBRATION_SUPPORT @@ -348,21 +384,22 @@ static void clock_calibration_hf_started(nrf_drv_clock_evt_type_t event) } else { + nrf_clock_event_clear(NRF_CLOCK_EVENT_DONE); nrf_clock_int_enable(NRF_CLOCK_INT_DONE_MASK); m_clock_cb.cal_state = CAL_STATE_CAL; nrf_clock_task_trigger(NRF_CLOCK_TASK_CAL); } } -#endif +#endif // CALIBRATION_SUPPORT ret_code_t nrf_drv_clock_calibration_start(uint8_t interval, nrf_drv_clock_event_handler_t handler) { + ret_code_t err_code = NRF_SUCCESS; #if CALIBRATION_SUPPORT ASSERT(m_clock_cb.cal_state == CAL_STATE_IDLE); - ret_code_t ret = NRF_SUCCESS; if (m_clock_cb.lfclk_on == false) { - ret = NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } else if (m_clock_cb.cal_state == CAL_STATE_IDLE) { @@ -377,26 +414,30 @@ ret_code_t nrf_drv_clock_calibration_start(uint8_t interval, nrf_drv_clock_event { m_clock_cb.cal_state = CAL_STATE_CT; nrf_clock_cal_timer_timeout_set(interval); + nrf_clock_event_clear(NRF_CLOCK_EVENT_CTTO); nrf_clock_int_enable(NRF_CLOCK_INT_CTTO_MASK); nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTART); } } else { - ret = NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; } - return ret; -#else //CALIBRATION_SUPPORT - return NRF_ERROR_FORBIDDEN; -#endif + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +#else + err_code = NRF_ERROR_FORBIDDEN; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +#endif // CALIBRATION_SUPPORT } - ret_code_t nrf_drv_clock_calibration_abort(void) { + ret_code_t err_code = NRF_SUCCESS; #if CALIBRATION_SUPPORT CRITICAL_REGION_ENTER(); - switch(m_clock_cb.cal_state) + switch (m_clock_cb.cal_state) { case CAL_STATE_CT: nrf_clock_int_disable(NRF_CLOCK_INT_CTTO_MASK); @@ -416,61 +457,82 @@ ret_code_t nrf_drv_clock_calibration_abort(void) break; } CRITICAL_REGION_EXIT(); - return NRF_SUCCESS; -#else //CALIBRATION_SUPPORT - return NRF_ERROR_FORBIDDEN; -#endif + + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +#else + err_code = NRF_ERROR_FORBIDDEN; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +#endif // CALIBRATION_SUPPORT } ret_code_t nrf_drv_clock_is_calibrating(bool * p_is_calibrating) { + ret_code_t err_code = NRF_SUCCESS; #if CALIBRATION_SUPPORT ASSERT(m_clock_cb.module_initialized); *p_is_calibrating = (m_clock_cb.cal_state != CAL_STATE_IDLE); - return NRF_SUCCESS; -#else //CALIBRATION_SUPPORT - return NRF_ERROR_FORBIDDEN; -#endif + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +#else + err_code = NRF_ERROR_FORBIDDEN; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +#endif // CALIBRATION_SUPPORT } -static __INLINE void clock_clk_started_notify(nrf_drv_clock_handler_item_t **p_head, - nrf_drv_clock_evt_type_t evt_type) +__STATIC_INLINE void clock_clk_started_notify(nrf_drv_clock_evt_type_t evt_type) { - while(1) + nrf_drv_clock_handler_item_t **p_head; + if (evt_type == NRF_DRV_CLOCK_EVT_HFCLK_STARTED) + { + p_head = (nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head; + } + else + { + p_head = (nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head; + } + + while (1) { nrf_drv_clock_handler_item_t * p_item = item_dequeue(p_head); - if (p_item) - { - p_item->event_handler(evt_type); - } - else + if (!p_item) { break; } + + p_item->event_handler(evt_type); } } -#ifndef SOFTDEVICE_PRESENT +#if NRF_DRV_COMMON_POWER_CLOCK_ISR +void nrf_drv_clock_onIRQ(void) +#else void POWER_CLOCK_IRQHandler(void) +#endif { if (nrf_clock_event_check(NRF_CLOCK_EVENT_HFCLKSTARTED)) { nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_CLOCK_EVENT_HFCLKSTARTED)); nrf_clock_int_disable(NRF_CLOCK_INT_HF_STARTED_MASK); m_clock_cb.hfclk_on = true; - clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, NRF_DRV_CLOCK_EVT_HFCLK_STARTED); + clock_clk_started_notify(NRF_DRV_CLOCK_EVT_HFCLK_STARTED); } if (nrf_clock_event_check(NRF_CLOCK_EVENT_LFCLKSTARTED)) { nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_CLOCK_EVENT_LFCLKSTARTED)); nrf_clock_int_disable(NRF_CLOCK_INT_LF_STARTED_MASK); m_clock_cb.lfclk_on = true; - clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head, NRF_DRV_CLOCK_EVT_LFCLK_STARTED); + clock_clk_started_notify(NRF_DRV_CLOCK_EVT_LFCLK_STARTED); } #if CALIBRATION_SUPPORT if (nrf_clock_event_check(NRF_CLOCK_EVENT_CTTO)) { nrf_clock_event_clear(NRF_CLOCK_EVENT_CTTO); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_CLOCK_EVENT_CTTO)); nrf_clock_int_disable(NRF_CLOCK_INT_CTTO_MASK); nrf_drv_clock_hfclk_request(&m_clock_cb.cal_hfclk_started_handler_item); } @@ -478,29 +540,58 @@ void POWER_CLOCK_IRQHandler(void) if (nrf_clock_event_check(NRF_CLOCK_EVENT_DONE)) { nrf_clock_event_clear(NRF_CLOCK_EVENT_DONE); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_CLOCK_EVENT_DONE)); nrf_clock_int_disable(NRF_CLOCK_INT_DONE_MASK); - nrf_drv_clock_hfclk_release(); - nrf_drv_clock_evt_type_t evt_type = (m_clock_cb.cal_state == CAL_STATE_ABORT) ? - NRF_DRV_CLOCK_EVT_CAL_ABORTED : NRF_DRV_CLOCK_EVT_CAL_DONE; + bool aborted = (m_clock_cb.cal_state == CAL_STATE_ABORT); m_clock_cb.cal_state = CAL_STATE_IDLE; if (m_clock_cb.cal_done_handler) { - m_clock_cb.cal_done_handler(evt_type); + m_clock_cb.cal_done_handler(aborted ? + NRF_DRV_CLOCK_EVT_CAL_ABORTED : NRF_DRV_CLOCK_EVT_CAL_DONE); } } -#endif //CALIBRATION_SUPPORT +#endif // CALIBRATION_SUPPORT } -#else + +#ifdef SOFTDEVICE_PRESENT + void nrf_drv_clock_on_soc_event(uint32_t evt_id) { if (evt_id == NRF_EVT_HFCLKSTARTED) { - clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, NRF_DRV_CLOCK_EVT_HFCLK_STARTED); + clock_clk_started_notify(NRF_DRV_CLOCK_EVT_HFCLK_STARTED); } } + +void nrf_drv_clock_on_sd_enable(void) +{ + CRITICAL_REGION_ENTER(); + /* Make sure that nrf_drv_clock module is initialized */ + if (!m_clock_cb.module_initialized) + { + (void)nrf_drv_clock_init(); + } + /* SD is one of the LFCLK requesters, but it will enable it by itself. */ + ++(m_clock_cb.lfclk_requests); + m_clock_cb.lfclk_on = true; + CRITICAL_REGION_EXIT(); +} + +void nrf_drv_clock_on_sd_disable(void) +{ + /* Reinit interrupts */ + ASSERT(m_clock_cb.module_initialized); + nrf_drv_common_irq_enable(POWER_CLOCK_IRQn, CLOCK_CONFIG_IRQ_PRIORITY); + + /* SD leaves LFCLK enabled - disable it if it is no longer required. */ + nrf_drv_clock_lfclk_release(); +} + #endif // SOFTDEVICE_PRESENT #undef NRF_CLOCK_LFCLK_RC #undef NRF_CLOCK_LFCLK_Xtal #undef NRF_CLOCK_LFCLK_Synth + +#endif // NRF_MODULE_ENABLED(CLOCK) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.h index 583902e4d8..763542b6a7 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/clock/nrf_drv_clock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,7 +36,6 @@ * */ - #ifndef NRF_DRV_CLOCK_H__ #define NRF_DRV_CLOCK_H__ @@ -45,18 +44,22 @@ #include "sdk_errors.h" #include "nrf_assert.h" #include "nrf_clock.h" -#include "nrf_drv_config.h" +#include "sdk_config.h" #include "nrf_drv_common.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * * @addtogroup nrf_clock Clock HAL and driver * @ingroup nrf_drivers * @brief Clock APIs. - * @details The clock HAL provides basic APIs for accessing the registers of the clock. + * @details The clock HAL provides basic APIs for accessing the registers of the clock. * The clock driver provides APIs on a higher level. * - * @defgroup nrf_clock_drv Clock driver + * @defgroup nrf_drv_clock Clock driver * @{ * @ingroup nrf_clock * @brief Driver for managing the low-frequency clock (LFCLK) and the high-frequency clock (HFCLK). @@ -89,14 +92,24 @@ struct nrf_drv_clock_handler_item_s nrf_drv_clock_event_handler_t event_handler; ///< Function to be called when the clock is started. }; +/** + * @brief Function for checking if driver is already initialized + * + * This function is used to check whatever common POWER_CLOCK common interrupt + * should be disabled or not if @ref nrf_drv_power tries to disable the interrupt. + * + * @retval true Driver is initialized + * @retval false Driver is uninitialized + */ +bool nrf_drv_clock_init_check(void); + /** * @brief Function for initializing the nrf_drv_clock module. * * After initialization, the module is in power off state (clocks are not requested). * - * @retval NRF_SUCCESS If the procedure was successful. - * @retval MODULE_ALREADY_INITIALIZED If the driver was already initialized. - * @retval NRF_ERROR_SOFTDEVICE_NOT_ENABLED If the SoftDevice was not enabled. + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_MODULE_ALREADY_INITIALIZED If the driver was already initialized. */ ret_code_t nrf_drv_clock_init(void); @@ -107,8 +120,8 @@ ret_code_t nrf_drv_clock_init(void); void nrf_drv_clock_uninit(void); /** - * @brief Function for requesting the LFCLK. - * + * @brief Function for requesting the LFCLK. + * * The low-frequency clock can be requested by different modules * or contexts. The driver ensures that the clock will be started only when it is requested * the first time. If the clock is not ready but it was already started, the handler item that is @@ -117,7 +130,7 @@ void nrf_drv_clock_uninit(void); * current context. * * The first request will start the selected LFCLK source. If an event handler is - * provided, it will be called once the LFCLK is started. If the LFCLK was already started at this + * provided, it will be called once the LFCLK is started. If the LFCLK was already started at this * time, the event handler will be called from the context of this function. Additionally, * the @ref nrf_drv_clock_lfclk_is_running function can be polled to check if the clock has started. * @@ -130,7 +143,7 @@ void nrf_drv_clock_uninit(void); void nrf_drv_clock_lfclk_request(nrf_drv_clock_handler_item_t * p_handler_item); /** - * @brief Function for releasing the LFCLK. + * @brief Function for releasing the LFCLK. * * If there are no more requests, the LFCLK source will be stopped. * @@ -147,9 +160,9 @@ void nrf_drv_clock_lfclk_release(void); bool nrf_drv_clock_lfclk_is_running(void); /** - * @brief Function for requesting the high-accuracy source HFCLK. + * @brief Function for requesting the high-accuracy source HFCLK. * - * The high-accuracy source + * The high-accuracy source * can be requested by different modules or contexts. The driver ensures that the high-accuracy * clock will be started only when it is requested the first time. If the clock is not ready * but it was already started, the handler item that is provided as an input parameter is added @@ -168,7 +181,7 @@ bool nrf_drv_clock_lfclk_is_running(void); void nrf_drv_clock_hfclk_request(nrf_drv_clock_handler_item_t * p_handler_item); /** - * @brief Function for releasing the high-accuracy source HFCLK. + * @brief Function for releasing the high-accuracy source HFCLK. * * If there are no more requests, the high-accuracy source will be released. */ @@ -219,7 +232,7 @@ ret_code_t nrf_drv_clock_calibration_start(uint8_t delay, nrf_drv_clock_event_ha ret_code_t nrf_drv_clock_calibration_abort(void); /** - * @brief Function for checking if calibration is in progress. + * @brief Function for checking if calibration is in progress. * * This function indicates that the system is * in calibration if it is in any of the calibration process phases (see @ref nrf_drv_clock_calibration_start). @@ -247,11 +260,33 @@ __STATIC_INLINE uint32_t nrf_drv_clock_ppi_task_addr(nrf_clock_task_t task); */ __STATIC_INLINE uint32_t nrf_drv_clock_ppi_event_addr(nrf_clock_event_t event); + +#ifdef SOFTDEVICE_PRESENT /** * @brief Function called by the SoftDevice handler if an @ref nrf_soc event is received from the SoftDevice. + * + * @param[in] evt_id One of NRF_SOC_EVTS values. */ -#ifdef SOFTDEVICE_PRESENT void nrf_drv_clock_on_soc_event(uint32_t evt_id); + +/** + * @brief Function called by the SoftDevice handler when the SoftDevice has been enabled. + * + * This function is called just after the SoftDevice has been properly enabled. + * Its main purpose is to mark that LFCLK has been requested by SD. + */ +void nrf_drv_clock_on_sd_enable(void); + +/** + * @brief Function called by the SoftDevice handler when the SoftDevice has been disabled. + * + * This function is called just after the SoftDevice has been properly disabled. + * It has two purposes: + * 1. Releases the LFCLK from the SD. + * 2. Reinitializes an interrupt after the SD releases POWER_CLOCK_IRQ. + */ +void nrf_drv_clock_on_sd_disable(void); + #endif /** *@} @@ -270,4 +305,9 @@ __STATIC_INLINE uint32_t nrf_drv_clock_ppi_event_addr(nrf_clock_event_t event) #endif //SUPPRESS_INLINE_IMPLEMENTATION /*lint --flb "Leave library region" */ + +#ifdef __cplusplus +} +#endif + #endif // NRF_CLOCK_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.c index 2150af0569..950efbf0cd 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.c @@ -36,18 +36,33 @@ * */ - #include #include "nrf_drv_common.h" #include "nrf_assert.h" #include "app_util_platform.h" +#include "nrf_peripherals.h" +#if NRF_DRV_COMMON_POWER_CLOCK_ISR +#include "nrf_drv_power.h" +#include "nrf_drv_clock.h" +#endif #ifdef SOFTDEVICE_PRESENT #include "nrf_soc.h" #endif +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#define NRF_LOG_MODULE_NAME "COMMON" + +#if COMMON_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL COMMON_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR COMMON_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR COMMON_CONFIG_DEBUG_COLOR +#else //COMMON_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif //COMMON_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" typedef struct { nrf_drv_irq_handler_t handler; @@ -55,7 +70,7 @@ typedef struct { } shared_resource_t; // SPIM0, SPIS0, SPI0, TWIM0, TWIS0, TWI0 -#if (SPI0_ENABLED || SPIS0_ENABLED || TWI0_ENABLED || TWIS0_ENABLED) +#if (NRF_MODULE_ENABLED(SPI0) || NRF_MODULE_ENABLED(SPIS0) || NRF_MODULE_ENABLED(TWI0) || NRF_MODULE_ENABLED(TWIS0)) #define SERIAL_BOX_0_IN_USE // [this checking may need a different form in unit tests, hence macro] #ifndef IS_SERIAL_BOX_0 @@ -68,10 +83,10 @@ typedef struct { ASSERT(m_serial_box_0.handler); m_serial_box_0.handler(); } -#endif // (SPI0_ENABLED || SPIS0_ENABLED || TWI0_ENABLED || TWIS0_ENABLED) +#endif // (NRF_MODULE_ENABLED(SPI0) || NRF_MODULE_ENABLED(SPIS0) || NRF_MODULE_ENABLED(TWI0) || NRF_MODULE_ENABLED(TWIS0)) // SPIM1, SPIS1, SPI1, TWIM1, TWIS1, TWI1 -#if (SPI1_ENABLED || SPIS1_ENABLED || TWI1_ENABLED || TWIS1_ENABLED) +#if (NRF_MODULE_ENABLED(SPI1) || NRF_MODULE_ENABLED(SPIS1) || NRF_MODULE_ENABLED(TWI1) || NRF_MODULE_ENABLED(TWIS1)) #define SERIAL_BOX_1_IN_USE // [this checking may need a different form in unit tests, hence macro] #ifndef IS_SERIAL_BOX_1 @@ -79,15 +94,19 @@ typedef struct { #endif static shared_resource_t m_serial_box_1 = { .acquired = false }; +#ifdef TWIM_PRESENT + void SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler(void) +#else void SPI1_TWI1_IRQHandler(void) +#endif { ASSERT(m_serial_box_1.handler); m_serial_box_1.handler(); } -#endif // (SPI1_ENABLED || SPIS1_ENABLED || TWI1_ENABLED || TWIS1_ENABLED) +#endif // (NRF_MODULE_ENABLED(SPI1) || NRF_MODULE_ENABLED(SPIS1) || NRF_MODULE_ENABLED(TWI1) || NRF_MODULE_ENABLED(TWIS1)) // SPIM2, SPIS2, SPI2 -#if (SPI2_ENABLED || SPIS2_ENABLED) +#if (NRF_MODULE_ENABLED(SPI2) || NRF_MODULE_ENABLED(SPIS2)) #define SERIAL_BOX_2_IN_USE // [this checking may need a different form in unit tests, hence macro] #ifndef IS_SERIAL_BOX_2 @@ -100,31 +119,33 @@ typedef struct { ASSERT(m_serial_box_2.handler); m_serial_box_2.handler(); } -#endif // (SPI2_ENABLED || SPIS2_ENABLED) +#endif // (NRF_MODULE_ENABLED(SPI2) || NRF_MODULE_ENABLED(SPIS2)) // COMP, LPCOMP -#if (COMP_ENABLED || LPCOMP_ENABLED) - #define COMP_LPCOMP_IN_USE +#if (NRF_MODULE_ENABLED(COMP) || NRF_MODULE_ENABLED(LPCOMP)) + #define COMP_LPCOMP_IN_USE - #ifndef IS_COMP_LPCOMP - #define IS_COMP_LPCOMP(p_per_base) ((p_per_base) == NRF_LPCOMP) - #endif + #ifndef IS_COMP_LPCOMP + #define IS_COMP_LPCOMP(p_per_base) ((p_per_base) == NRF_LPCOMP) + #endif static shared_resource_t m_comp_lpcomp = { .acquired = false }; void LPCOMP_IRQHandler(void) { - ASSERT(m_comp_lpcomp.handler); - m_comp_lpcomp.handler(); + ASSERT(m_comp_lpcomp.handler); + m_comp_lpcomp.handler(); } -#endif // (COMP_ENABLED || LPCOMP_ENABLED) +#endif // (NRF_MODULE_ENABLED(COMP) || NRF_MODULE_ENABLED(LPCOMP)) #if defined(SERIAL_BOX_0_IN_USE) || \ defined(SERIAL_BOX_1_IN_USE) || \ defined(SERIAL_BOX_2_IN_USE) || \ - defined(COMP_LPCOMP_IN_USE) + defined(COMP_LPCOMP_IN_USE) static ret_code_t acquire_shared_resource(shared_resource_t * p_resource, nrf_drv_irq_handler_t handler) { + ret_code_t err_code; + bool busy = false; CRITICAL_REGION_ENTER(); @@ -140,11 +161,15 @@ static ret_code_t acquire_shared_resource(shared_resource_t * p_resource, if (busy) { - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } p_resource->handler = handler; - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } #endif @@ -175,11 +200,14 @@ ret_code_t nrf_drv_common_per_res_acquire(void const * p_per_base, #ifdef COMP_LPCOMP_IN_USE if (IS_COMP_LPCOMP(p_per_base)) { - return acquire_shared_resource(&m_comp_lpcomp, handler); + return acquire_shared_resource(&m_comp_lpcomp, handler); } #endif - - return NRF_ERROR_INVALID_PARAM; + ret_code_t err_code; + + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } void nrf_drv_common_per_res_release(void const * p_per_base) @@ -209,29 +237,57 @@ void nrf_drv_common_per_res_release(void const * p_per_base) #endif #ifdef COMP_LPCOMP_IN_USE - if (IS_COMP_LPCOMP(p_per_base)) + if (IS_COMP_LPCOMP(p_per_base)) { m_comp_lpcomp.acquired = false; } - else + else #endif {} } -#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED +#endif // NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + +#if NRF_MODULE_ENABLED(POWER) +void nrf_drv_common_power_irq_disable(void) +{ +#if NRF_DRV_COMMON_POWER_CLOCK_ISR + if(!nrf_drv_clock_init_check()) +#endif + { + nrf_drv_common_irq_disable(POWER_CLOCK_IRQn); + } +} +#endif + +#if NRF_MODULE_ENABLED(CLOCK) +void nrf_drv_common_clock_irq_disable(void) +{ +#if NRF_DRV_COMMON_POWER_CLOCK_ISR + if(!nrf_drv_power_init_check()) +#endif + { + nrf_drv_common_irq_disable(POWER_CLOCK_IRQn); + } +} +#endif + +#if NRF_DRV_COMMON_POWER_CLOCK_ISR +void POWER_CLOCK_IRQHandler(void) +{ + extern void nrf_drv_clock_onIRQ(void); + extern void nrf_drv_power_onIRQ(void); + + nrf_drv_clock_onIRQ(); + nrf_drv_power_onIRQ(); +} +#endif // NRF_DRV_COMMON_POWER_CLOCK_ISR void nrf_drv_common_irq_enable(IRQn_Type IRQn, uint8_t priority) { - -#ifdef SOFTDEVICE_PRESENT - #ifdef NRF51 - ASSERT((priority == APP_IRQ_PRIORITY_LOW) || (priority == APP_IRQ_PRIORITY_HIGH)); - #elif defined(NRF52) - ASSERT((priority == APP_IRQ_PRIORITY_LOWEST) || (priority == APP_IRQ_PRIORITY_HIGH)); - #endif -#endif + INTERRUPT_PRIORITY_ASSERT(priority); NVIC_SetPriority(IRQn, priority); NVIC_ClearPendingIRQ(IRQn); diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.h index 1d211eaf9b..517822ab1e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/common/nrf_drv_common.h @@ -36,7 +36,6 @@ * */ - #ifndef NRF_DRV_COMMON_H__ #define NRF_DRV_COMMON_H__ @@ -44,24 +43,65 @@ #include #include "nrf.h" #include "sdk_errors.h" -#include "nrf_drv_config.h" +#include "sdk_common.h" +#include "nrf_assert.h" +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef NRF51 +#ifdef SOFTDEVICE_PRESENT +#define INTERRUPT_PRIORITY_IS_VALID(pri) (((pri) == 1) || ((pri) == 3)) +#else +#define INTERRUPT_PRIORITY_IS_VALID(pri) ((pri) < 4) +#endif //SOFTDEVICE_PRESENT +#else +#ifdef SOFTDEVICE_PRESENT +#define INTERRUPT_PRIORITY_IS_VALID(pri) ((((pri) > 1) && ((pri) < 4)) || (((pri) > 5) && ((pri) < 8))) +#else +#define INTERRUPT_PRIORITY_IS_VALID(pri) ((pri) < 8) +#endif //SOFTDEVICE_PRESENT +#endif //NRF52 + +#define INTERRUPT_PRIORITY_VALIDATION(pri) STATIC_ASSERT(INTERRUPT_PRIORITY_IS_VALID((pri))) +#define INTERRUPT_PRIORITY_ASSERT(pri) ASSERT(INTERRUPT_PRIORITY_IS_VALID((pri))) /** - * @brief Offset of event registers in every peripheral instance + * @defgroup nrf_drv_common Peripheral drivers common module + * @{ + * @ingroup nrf_drivers + */ + +/** + * @brief Offset of event registers in every peripheral instance. * - * This is the offset where event registers start in the every peripheral. + * This is the offset where event registers start in every peripheral. */ #define NRF_DRV_COMMON_EVREGS_OFFSET 0x100U +/** + * @brief The flag that is set when POWER_CLOCK ISR is implemented in common module + * + * This flag means that the function POWER_CLOCK_IRQHandler is implemented in + * nrf_drv_common.c file. In the @c clock and @c power modules functions + * nrf_drv_clock_onIRQ nrf_drv_power_onIRQ should be implemented + * and they would be called from common implementation. + * + * None of the checking is done here. + * The implementation functions in @c clock and @c power are required to handle + * correctly the case when they are called without any event bit set. + */ +#define NRF_DRV_COMMON_POWER_CLOCK_ISR (NRF_MODULE_ENABLED(CLOCK) && NRF_MODULE_ENABLED(POWER)) + /** * @brief Driver state. */ -typedef enum -{ - NRF_DRV_STATE_UNINITIALIZED, /**< Uninitialized. */ - NRF_DRV_STATE_INITIALIZED, /**< Initialized but powered off. */ - NRF_DRV_STATE_POWERED_ON +typedef enum +{ + NRF_DRV_STATE_UNINITIALIZED, /**< Uninitialized. */ + NRF_DRV_STATE_INITIALIZED, /**< Initialized but powered off. */ + NRF_DRV_STATE_POWERED_ON } nrf_drv_state_t; /** @@ -79,7 +119,7 @@ typedef enum typedef void (*nrf_drv_irq_handler_t)(void); -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) /** * @brief Function for acquiring shared peripheral resources associated with @@ -101,8 +141,8 @@ typedef void (*nrf_drv_irq_handler_t)(void); * * @retval NRF_SUCCESS If resources were acquired successfully. * @retval NRF_ERROR_BUSY If resources were already acquired. - * @retval NRF_ERROR_INVALID_PARAM If the specified peripheral is not enabled - * or the peripheral does not share resources + * @retval NRF_ERROR_INVALID_PARAM If the specified peripheral is not enabled + * or the peripheral does not share resources * with other peripherals. */ ret_code_t nrf_drv_common_per_res_acquire(void const * p_per_base, @@ -116,7 +156,7 @@ ret_code_t nrf_drv_common_per_res_acquire(void const * p_per_base, */ void nrf_drv_common_per_res_release(void const * p_per_base); -#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED +#endif // NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) /** @@ -129,6 +169,44 @@ void nrf_drv_common_per_res_release(void const * p_per_base); */ void nrf_drv_common_irq_enable(IRQn_Type IRQn, uint8_t priority); +#if NRF_MODULE_ENABLED(POWER) +/** + * @brief Disable power IRQ + * + * Power and clock peripheral uses the same IRQ. + * This function disables POWER_CLOCK IRQ only if CLOCK driver + * is uninitialized. + * + * @sa nrf_drv_common_power_clock_irq_init + */ +void nrf_drv_common_power_irq_disable(void); +#endif + +#if NRF_MODULE_ENABLED(CLOCK) +/** + * @brief Disable clock IRQ + * + * Power and clock peripheral uses the same IRQ. + * This function disables POWER_CLOCK IRQ only if POWER driver + * is uninitialized. + * + * @sa nrf_drv_common_power_clock_irq_init + */ +void nrf_drv_common_clock_irq_disable(void); +#endif + +/** + * @brief Check if interrupt is enabled + * + * Function that checks if selected interrupt is enabled. + * + * @param[in] IRQn Interrupt id + * + * @retval true Selected IRQ is enabled. + * @retval false Selected IRQ is disabled. + */ +__STATIC_INLINE bool nrf_drv_common_irq_enable_check(IRQn_Type IRQn); + /** * @brief Function disables NVIC interrupt * @@ -144,7 +222,7 @@ __STATIC_INLINE void nrf_drv_common_irq_disable(IRQn_Type IRQn); * of peripheral instance. * * For example the result of this function can be casted directly to - * the types like @ref nrf_twis_event_t or @ref nrf_rng_events_t... + * the types like @ref nrf_twis_event_t or @ref nrf_rng_event_t * * @param bit Bit position in INTEN register * @return Event code to be casted to the right enum type or to be used in functions like @@ -160,7 +238,7 @@ __STATIC_INLINE uint32_t nrf_drv_bitpos_to_event(uint32_t bit); * This function can be used to get bit position in INTEN register from event code. * * @param event Event code that may be casted from enum values from types like - * @ref nrf_twis_event_t or @ref nrf_rng_events_t + * @ref nrf_twis_event_t or @ref nrf_rng_event_t * @return Bit position in INTEN register that corresponds to the given code. * * @sa nrf_drv_bitpos_to_event @@ -176,6 +254,29 @@ __STATIC_INLINE uint32_t nrf_drv_event_to_bitpos(uint32_t event); */ __STATIC_INLINE IRQn_Type nrf_drv_get_IRQn(void const * const pinst); +#if NRF_MODULE_ENABLED(CLOCK) || NRF_MODULE_ENABLED(POWER) +/** + * @brief Enable and setup power clock IRQ + * + * This function would be called from @ref nrf_drv_clock and @ref nrf_drv_power + * to enable related interrupt. + * This function avoids multiple interrupt configuration. + * + * @note + * This function is aviable only if @ref nrf_drv_clock or @ref nrf_drv_power + * module is enabled. + * + * @note + * If both @ref nrf_drv_clock and @ref nrf_drv_power modules are enabled, + * during the compilation the check is made that + * @ref CLOCK_CONFIG_IRQ_PRIORITY equals @ref POWER_CONFIG_IRQ_PRIORITY. + * + * @sa nrf_drv_common_power_irq_disable + * @sa nrf_drv_common_clock_irq_disable + */ +__STATIC_INLINE void nrf_drv_common_power_clock_irq_init(void); +#endif + /** * @brief Check if given object is in RAM * @@ -187,9 +288,14 @@ __STATIC_INLINE IRQn_Type nrf_drv_get_IRQn(void const * const pinst); */ __STATIC_INLINE bool nrf_drv_is_in_RAM(void const * const ptr); - #ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE bool nrf_drv_common_irq_enable_check(IRQn_Type IRQn) +{ + return 0 != (NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] & + (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))); +} + __STATIC_INLINE void nrf_drv_common_irq_disable(IRQn_Type IRQn) { NVIC_DisableIRQ(IRQn); @@ -211,6 +317,28 @@ __STATIC_INLINE IRQn_Type nrf_drv_get_IRQn(void const * const pinst) return (IRQn_Type) ret; } +#if NRF_MODULE_ENABLED(CLOCK) || NRF_MODULE_ENABLED(POWER) +__STATIC_INLINE void nrf_drv_common_power_clock_irq_init(void) +{ + if(!nrf_drv_common_irq_enable_check(POWER_CLOCK_IRQn)) + { + nrf_drv_common_irq_enable( + POWER_CLOCK_IRQn, +#if NRF_DRV_COMMON_POWER_CLOCK_ISR + #if CLOCK_CONFIG_IRQ_PRIORITY != POWER_CONFIG_IRQ_PRIORITY + #error CLOCK_CONFIG_IRQ_PRIORITY and POWER_CONFIG_IRQ_PRIORITY have to be the same. + #endif + CLOCK_CONFIG_IRQ_PRIORITY +#elif NRF_MODULE_ENABLED(CLOCK) + CLOCK_CONFIG_IRQ_PRIORITY +#elif NRF_MODULE_ENABLED(POWER) + POWER_CONFIG_IRQ_PRIORITY +#endif + ); + } +} +#endif + __STATIC_INLINE bool nrf_drv_is_in_RAM(void const * const ptr) { return ((((uintptr_t)ptr) & 0xE0000000u) == 0x20000000u); @@ -218,4 +346,11 @@ __STATIC_INLINE bool nrf_drv_is_in_RAM(void const * const ptr) #endif // SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + #endif // NRF_DRV_COMMON_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/comp/nrf_drv_comp.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/comp/nrf_drv_comp.c new file mode 100644 index 0000000000..937e8005dc --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/comp/nrf_drv_comp.c @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(COMP) +#include "nrf_drv_comp.h" + +#include "nrf_assert.h" +#include "nrf_error.h" +#include "nrf_soc.h" +#include "nrf_drv_common.h" +#include "app_util_platform.h" +#include +#include +#include + +#define NRF_LOG_MODULE_NAME "COMP" + +#if COMP_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL COMP_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR COMP_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR COMP_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_COMP_EVENT_READY ? "NRF_COMP_EVENT_READY" : \ + (event == NRF_COMP_EVENT_DOWN ? "NRF_COMP_EVENT_DOWN" : \ + (event == NRF_COMP_EVENT_UP ? "NRF_COMP_EVENT_UP" : \ + (event == NRF_COMP_EVENT_CROSS ? "NRF_COMP_EVENT_CROSS" : "UNKNOWN ERROR")))) +#else //COMP_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //COMP_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + + + +static comp_events_handler_t m_comp_events_handler = NULL; +static nrf_drv_state_t m_state = NRF_DRV_STATE_UNINITIALIZED; + +static const nrf_drv_comp_config_t m_default_config = NRF_DRV_COMP_DEFAULT_CONFIG(NRF_COMP_INPUT_0); + +static void comp_execute_handler(nrf_comp_event_t event, uint32_t event_mask) +{ + if ( nrf_comp_event_check(event) && nrf_comp_int_enable_check(event_mask) ) + { + nrf_comp_event_clear(event); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(event)); + + m_comp_events_handler(event); + } +} + +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + #define IRQ_HANDLER_NAME irq_handler_for_comp + #define IRQ_HANDLER static void IRQ_HANDLER_NAME(void) + + IRQ_HANDLER; +#else + #define IRQ_HANDLER void COMP_LPCOMP_IRQHandler(void) +#endif // NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + +IRQ_HANDLER +{ + comp_execute_handler(NRF_COMP_EVENT_READY, COMP_INTENSET_READY_Msk); + comp_execute_handler(NRF_COMP_EVENT_DOWN, COMP_INTENSET_DOWN_Msk); + comp_execute_handler(NRF_COMP_EVENT_UP, COMP_INTENSET_UP_Msk); + comp_execute_handler(NRF_COMP_EVENT_CROSS, COMP_INTENSET_CROSS_Msk); +} + + +ret_code_t nrf_drv_comp_init(const nrf_drv_comp_config_t * p_config, + comp_events_handler_t event_handler) +{ + ret_code_t err_code; + + if (m_state != NRF_DRV_STATE_UNINITIALIZED) + { // COMP driver is already initialized + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + if (nrf_drv_common_per_res_acquire(NRF_COMP, IRQ_HANDLER_NAME) != NRF_SUCCESS) + { + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } +#endif + + nrf_comp_task_trigger(NRF_COMP_TASK_STOP); + nrf_comp_enable(); + + // Clear events to be sure there are no leftovers. + nrf_comp_event_clear(NRF_COMP_EVENT_READY); + nrf_comp_event_clear(NRF_COMP_EVENT_DOWN); + nrf_comp_event_clear(NRF_COMP_EVENT_UP); + nrf_comp_event_clear(NRF_COMP_EVENT_CROSS); + + nrf_comp_ref_set(p_config->reference); + + //If external source is chosen, write to appropriate register. + if (p_config->reference == COMP_REFSEL_REFSEL_ARef) + { + nrf_comp_ext_ref_set(p_config->ext_ref); + } + + nrf_comp_th_set(p_config->threshold); + nrf_comp_main_mode_set(p_config->main_mode); + nrf_comp_speed_mode_set(p_config->speed_mode); + nrf_comp_hysteresis_set(p_config->hyst); + nrf_comp_isource_set(p_config->isource); + nrf_comp_shorts_disable(NRF_DRV_COMP_SHORT_STOP_AFTER_CROSS_EVT | NRF_DRV_COMP_SHORT_STOP_AFTER_UP_EVT | + NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT); + nrf_comp_int_disable(COMP_INTENCLR_CROSS_Msk | COMP_INTENCLR_UP_Msk | + COMP_INTENCLR_DOWN_Msk | COMP_INTENCLR_READY_Msk); + + if (event_handler) + { + m_comp_events_handler = event_handler; + } + else + { + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + nrf_comp_input_select(p_config->input); + + nrf_drv_common_irq_enable(COMP_LPCOMP_IRQn, p_config->interrupt_priority); + + m_state = NRF_DRV_STATE_INITIALIZED; + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_comp_uninit(void) +{ + ASSERT(m_state != NRF_DRV_STATE_UNINITIALIZED); + nrf_drv_common_irq_disable(COMP_LPCOMP_IRQn); + nrf_comp_disable(); +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + nrf_drv_common_per_res_release(NRF_COMP); +#endif + m_state = NRF_DRV_STATE_UNINITIALIZED; + m_comp_events_handler = NULL; + NRF_LOG_INFO("Uninitialized.\r\n"); +} + +void nrf_drv_comp_pin_select(nrf_comp_input_t psel) +{ + bool comp_enable_state = nrf_comp_enable_check(); + nrf_comp_task_trigger(NRF_COMP_TASK_STOP); + if (m_state == NRF_DRV_STATE_POWERED_ON) + { + m_state = NRF_DRV_STATE_INITIALIZED; + } + nrf_comp_disable(); + nrf_comp_input_select(psel); + if (comp_enable_state == true) + { + nrf_comp_enable(); + } +} + +void nrf_drv_comp_start(uint32_t comp_int_mask, uint32_t comp_shorts_mask) +{ + ASSERT(m_state == NRF_DRV_STATE_INITIALIZED); + nrf_comp_int_enable(comp_int_mask); + nrf_comp_shorts_enable(comp_shorts_mask); + nrf_comp_task_trigger(NRF_COMP_TASK_START); + m_state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Enabled.\r\n"); +} + +void nrf_drv_comp_stop(void) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + nrf_comp_shorts_disable(UINT32_MAX); + nrf_comp_int_disable(UINT32_MAX); + nrf_comp_task_trigger(NRF_COMP_TASK_STOP); + m_state = NRF_DRV_STATE_INITIALIZED; + NRF_LOG_INFO("Disabled.\r\n"); +} + +uint32_t nrf_drv_comp_sample() +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + nrf_comp_task_trigger(NRF_COMP_TASK_SAMPLE); + return nrf_comp_result_get(); +} +#endif //NRF_MODULE_ENABLED(COMP) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/comp/nrf_drv_comp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/comp/nrf_drv_comp.h new file mode 100644 index 0000000000..c67d514e1c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/comp/nrf_drv_comp.h @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_DRV_COMP_H__ +#define NRF_DRV_COMP_H__ + +#include "sdk_config.h" +#include "nrf_comp.h" +#include "sdk_errors.h" +#include "nrf_drv_common.h" +#include "app_util_platform.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup nrf_comp COMP HAL and driver + * @ingroup nrf_drivers + * @brief @tagAPI52 Comparator (COMP) APIs. + * @details The COMP HAL provides basic APIs for accessing the registers of Comparator. + * The COMP driver provides APIs on a higher level. + * + * @defgroup nrf_drv_comp COMP driver + * @{ + * @ingroup nrf_comp + * @brief @tagAPI52 Comparator (COMP) driver. + */ + +/** + * @brief Macro to convert the threshold voltage to an integer value (needed by the COMP_TH register). + * + * @param[in] vol Voltage to be changed to COMP_TH register value. This value must not be smaller than + * reference voltage divided by 64. + * @param[in] ref Reference voltage. + */ +#define VOLTAGE_THRESHOLD_TO_INT(vol, ref) (uint8_t)(((vol) > ((ref) / 64)) ? (ROUNDED_DIV((vol) * 64,(ref)) - 1) : 0) + +/**@brief COMP event handler function type. + * @param[in] event COMP event. + */ +typedef void (* comp_events_handler_t)(nrf_comp_event_t event); + +/** + * @enum nrf_drv_comp_short_mask_t + * @brief COMP shortcut masks. + */ +typedef enum +{ + NRF_DRV_COMP_SHORT_STOP_AFTER_CROSS_EVT = COMP_SHORTS_CROSS_STOP_Msk, /*!< Shortcut between the CROSS event and the STOP task. */ + NRF_DRV_COMP_SHORT_STOP_AFTER_UP_EVT = COMP_SHORTS_UP_STOP_Msk, /*!< Shortcut between the UP event and the STOP task. */ + NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT = COMP_SHORTS_DOWN_STOP_Msk /*!< Shortcut between the DOWN event and the STOP task. */ +}nrf_drv_comp_short_mask_t; + +/** + * @enum nrf_drv_comp_evt_en_mask_t + * @brief COMP events masks. + */ +typedef enum +{ + NRF_DRV_COMP_EVT_EN_CROSS_MASK = COMP_INTENSET_CROSS_Msk, /*!< CROSS event (generated after VIN+ == VIN-). */ + NRF_DRV_COMP_EVT_EN_UP_MASK = COMP_INTENSET_UP_Msk, /*!< UP event (generated when VIN+ crosses VIN- while increasing). */ + NRF_DRV_COMP_EVT_EN_DOWN_MASK = COMP_INTENSET_DOWN_Msk, /*!< DOWN event (generated when VIN+ crosses VIN- while decreasing). */ + NRF_DRV_COMP_EVT_EN_READY_MASK = COMP_INTENSET_READY_Msk /*!< READY event (generated when the module is ready). */ +}nrf_drv_comp_evt_en_mask_t; + +/**@brief COMP configuration. + */ +typedef struct +{ + nrf_comp_ref_t reference; /**< Reference selection. */ + nrf_comp_ext_ref_t ext_ref; /**< External analog reference selection. */ + nrf_comp_main_mode_t main_mode; /**< Main operation mode. */ + nrf_comp_th_t threshold; /**< Structure holding THDOWN and THUP values needed by the COMP_TH register. */ + nrf_comp_sp_mode_t speed_mode; /**< Speed and power mode. */ + nrf_comp_hyst_t hyst; /**< Comparator hysteresis.*/ + nrf_isource_t isource; /**< Current source selected on analog input. */ + nrf_comp_input_t input; /**< Input to be monitored. */ + uint8_t interrupt_priority; /**< Interrupt priority. */ +} nrf_drv_comp_config_t; + +/** @brief COMP threshold default configuration. */ +#define COMP_CONFIG_TH \ +{ \ + .th_down = VOLTAGE_THRESHOLD_TO_INT(0.5, 1.8), \ + .th_up = VOLTAGE_THRESHOLD_TO_INT(1.5, 1.8) \ +} + +/** @brief COMP driver default configuration including the COMP HAL configuration. */ +#define NRF_DRV_COMP_DEFAULT_CONFIG(INPUT) \ +{ \ + .reference = (nrf_comp_ref_t)COMP_CONFIG_REF, \ + .main_mode = (nrf_comp_main_mode_t)COMP_CONFIG_MAIN_MODE, \ + .threshold = COMP_CONFIG_TH, \ + .speed_mode = (nrf_comp_sp_mode_t)COMP_CONFIG_SPEED_MODE, \ + .hyst = (nrf_comp_hyst_t)COMP_CONFIG_HYST, \ + .isource = (nrf_isource_t)COMP_CONFIG_ISOURCE, \ + .input = (nrf_comp_input_t)INPUT, \ + .interrupt_priority = COMP_CONFIG_IRQ_PRIORITY \ +} + +/** + * @brief Function for initializing the COMP driver. + * + * This function initializes the COMP driver, but does not enable the peripheral or any interrupts. + * To start the driver, call the function @ref nrf_drv_comp_start() after initialization. + * + * If no configuration structure is provided, the driver is initialized with the default settings. + * + * @param[in] p_config Initial configuration. If NULL, the default configuration is used. + * @param[in] event_handler Handler function. + * + * @retval NRF_ERROR_INVALID_PARAM If the configuration is invalid. + * @retval NRF_ERROR_INVALID_STATE If the driver has already been initialized. + * @retval NRF_ERROR_BUSY If the LPCOMP driver is initialized. + */ +ret_code_t nrf_drv_comp_init(const nrf_drv_comp_config_t * p_config, + comp_events_handler_t event_handler); + + +/** + * @brief Function for uninitializing the COMP driver. + * + * This function uninitializes the COMP driver. The COMP peripheral and + * its interrupts are disabled, and local variables are cleaned. After this call, you must + * initialize the driver again by calling nrf_drv_comp_init() if you want to use it. + * + * @sa nrf_drv_comp_stop() + */ +void nrf_drv_comp_uninit(void); + +/** + * @brief Function for setting the analog input. + * + * @param[in] psel COMP analog pin selection. + */ +void nrf_drv_comp_pin_select(nrf_comp_input_t psel); + +/** + * @brief Function for starting the COMP peripheral and interrupts. + * + * Before calling this function, the driver must be initialized. This function + * enables the COMP peripheral and its interrupts. + * + * @param[in] comp_evt_en_mask Mask of events to be enabled. This parameter should be built as + * 'or' of elements from @ref nrf_drv_comp_evt_en_mask_t. + * @param[in] comp_shorts_mask Mask of shorts to be enabled. This parameter should be built as + * 'or' of elements from @ref nrf_drv_comp_short_mask_t. + * + * @sa nrf_drv_comp_init() + * + */ +void nrf_drv_comp_start(uint32_t comp_evt_en_mask, uint32_t comp_shorts_mask); + +/**@brief Function for stopping the COMP peripheral. + * + * Before calling this function, the driver must be enabled. This function disables the COMP + * peripheral and its interrupts. + * + * @sa nrf_drv_comp_uninit() + * + */ +void nrf_drv_comp_stop(void); + +/** + * @brief Function for copying the current state of the comparator result to the RESULT register. + * + * @retval 0 If the input voltage is below the threshold (VIN+ < VIN-). + * @retval 1 If the input voltage is above the threshold (VIN+ > VIN-). + */ +uint32_t nrf_drv_comp_sample(void); + +/** + * @brief Function for getting the task address. + * + * Before calling this function, the driver must be enabled. + * + * @param[in] comp_task COMP task. + * + * @return Address of the given COMP task. + */ +__STATIC_INLINE uint32_t nrf_drv_comp_task_address_get(nrf_comp_task_t comp_task) +{ + return (uint32_t)nrf_comp_task_address_get(comp_task); +} + +/** + * @brief Function for getting the event address. + * + * @param[in] comp_event COMP event. + * + * @return Address of the given COMP event. + */ +__STATIC_INLINE uint32_t nrf_drv_comp_event_address_get(nrf_comp_event_t comp_event) +{ + return (uint32_t)nrf_comp_event_address_get(comp_event); +} + +/** + *@} + **/ + + +#ifdef __cplusplus +} +#endif +#endif /* NRF_DRV_COMP_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/config/nrf_drv_config_validation.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/config/nrf_drv_config_validation.h deleted file mode 100644 index aab66c7de2..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/config/nrf_drv_config_validation.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef NRF_DRV_CONFIG_VALIDATION_H -#define NRF_DRV_CONFIG_VALIDATION_H - -#ifdef NRF52 - -#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ - ((SPI0_ENABLED + SPIS0_ENABLED + TWI0_ENABLED + TWIS0_ENABLED) > 1) -#error "Peripherals overlap. SPI0, SPIS0, TWI0, TWIS0 - only one of these can be enabled." -#endif - -#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ - ((SPI1_ENABLED + SPIS1_ENABLED + TWI1_ENABLED + TWIS1_ENABLED) > 1) -#error "Peripherals overlap. SPI1, SPIS1, TWI1, TWIS1 - only one of these can be enabled." -#endif - -#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ - ((SPI2_ENABLED + SPIS2_ENABLED) > 1) -#error "Peripherals overlap. SPI2, SPIS2 - only one of these can be enabled." -#endif - -#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ - ((COMP_ENABLED + LPCOMP_ENABLED) > 1) -#error "COMP and LPCOMP cannot be enabled together. Peripherals overlap." -#endif - -#else //NRF51 - -#if (TWIS0_ENABLED + TWIS1_ENABLED) > 0 -#error "TWIS not present in nRF51." -#endif - -#if SPIS0_ENABLED > 0 -#error "SPIS0 instance not present in nRF51." -#endif - -#if (SPI2_ENABLED + SPIS2_ENABLED) > 0 -#error "SPI2/SPIS2 instance not present in nRF51." -#endif - -#if RTC2_ENABLED -#error "RTC2 not present in NRF51." -#endif - -#if (TIMER3_ENABLED + TIMER4_ENABLED) > 0 -#error "TIMER3 and TIMER4 not present in nRF51." -#endif - -#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ - ((SPI0_ENABLED + TWI0_ENABLED) > 1) -#error "Peripherals overlap. SPI0, TWI0 - only one of these can be enabled." -#endif - -#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ - ((SPI1_ENABLED + SPIS1_ENABLED + TWI1_ENABLED) > 1) -#error "Peripherals overlap. SPI1, SPIS1, TWI1 - only one of these can be enabled." -#endif - -#if SAADC_ENABLED > 0 -#error "SAADC not present in nRF51." -#endif - -#if I2S_ENABLED > 0 -#error "I2S not present in nRF51." -#endif -#if COMP_ENABLED > 0 -#error "COMP not present in nRF51." -#endif - -#endif //NRF51 - -#endif // NRF_DRV_CONFIG_VALIDATION_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.h index a9b110b092..1383fced84 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.h @@ -3,240 +3,222 @@ #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + +#define CLOCK_FREQ_16MHz (16000000UL) + /** * @brief Function for delaying execution for number of microseconds. * * @note NRF52 has instruction cache and because of that delay is not precise. * - * @param number_of_ms + * @param number_of_us + * */ -/*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */ +/*lint --e{438, 522, 40, 10, 563} "Variable not used" "Function lacks side-effects" */ +__STATIC_INLINE void nrf_delay_us(uint32_t number_of_us); + + +/** + * @brief Function for delaying execution for number of miliseconds. + * + * @note NRF52 has instruction cache and because of that delay is not precise. + * + * @note Function internally calls @ref nrf_delay_us so the maximum delay is the + * same as in case of @ref nrf_delay_us, approx. 71 minutes. + * + * @param number_of_ms + * + */ + +/*lint --e{438, 522, 40, 10, 563} "Variable not used" "Function lacks side-effects" */ +__STATIC_INLINE void nrf_delay_ms(uint32_t number_of_ms); + #if defined ( __CC_ARM ) - -static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us) +__STATIC_INLINE void nrf_delay_us(uint32_t number_of_us) { -loop - SUBS R0, R0, #1 - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP -#ifdef NRF52 - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP - NOP + if(!number_of_us) + return; +__asm + { +loop: + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + CMP SystemCoreClock, CLOCK_FREQ_16MHz + BEQ cond + NOP +#if defined(NRF52) || defined(NRF52840_XXAA) || defined(NRF52832) + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP + NOP #endif - BNE loop - BX LR -} - -#elif defined ( __ICCARM__ ) - -static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) -{ -__ASM ( -"loop:\n\t" - " SUBS R0, R0, #1\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" -#ifdef NRF52 - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" - " NOP\n\t" -#endif - " BNE.n loop\n\t"); +cond: + SUBS number_of_us,number_of_us, #1 + BNE loop + } } #elif defined ( _WIN32 ) || defined ( __unix ) || defined( __APPLE__ ) -__STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us); #ifndef CUSTOM_NRF_DELAY_US -__STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us) +__STATIC_INLINE void nrf_delay_us(uint32_t number_of_us) {} #endif -#elif defined ( __GNUC__ ) +#elif defined ( __GNUC__ ) || ( __ICCARM__ ) -static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline)); -static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) +__STATIC_INLINE void nrf_delay_us(uint32_t number_of_us) { -register uint32_t delay __ASM ("r0") = number_of_us; + const uint32_t clock16MHz = CLOCK_FREQ_16MHz; + if (number_of_us) + { __ASM volatile ( -#ifdef NRF51 +#if ( defined(__GNUC__) && (__CORTEX_M == (0x00U) ) ) ".syntax unified\n" #endif - "1:\n" - " SUBS %0, %0, #1\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" -#ifdef NRF52 - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" - " NOP\n" +"1:\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " CMP %[SystemCoreClock],%[clock16MHz]\n" + " BEQ.n 2f\n" + " NOP\n" +#if defined(NRF52) || defined(NRF52840_XXAA) || defined(NRF52832) + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" #endif - " BNE 1b\n" -#ifdef NRF51 +"2:\n" + " SUBS %0, %0, #1\n" + " BNE.n 1b\n" +#if __CORTEX_M == (0x00U) +#ifdef __GNUC__ ".syntax divided\n" #endif - : "+r" (delay)); + :"+l" (number_of_us) : +#else + :"+r" (number_of_us) : +#endif + [SystemCoreClock] "r" (SystemCoreClock), + [clock16MHz] "r" (clock16MHz) + ); +#ifdef __ICCARM__ + __DMB(); +#endif + } } #endif -void nrf_delay_ms(uint32_t volatile number_of_ms); +__STATIC_INLINE void nrf_delay_ms(uint32_t number_of_ms) +{ + nrf_delay_us(1000*number_of_ms); +} + + +#ifdef __cplusplus +} +#endif #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c index 752c89c9a7..f3adc28f0b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.c @@ -36,12 +36,29 @@ * */ - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(GPIOTE) #include "nrf_drv_gpiote.h" #include "nrf_drv_common.h" -#include "nrf_drv_config.h" #include "app_util_platform.h" #include "nrf_assert.h" +#include "nrf_bitmask.h" +#include + +#define NRF_LOG_MODULE_NAME "GPIOTE" + +#if GPIOTE_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL GPIOTE_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR GPIOTE_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR GPIOTE_CONFIG_DEBUG_COLOR +#else // GPIOTE_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif // GPIOTE_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + +/* Validate configuration */ +INTERRUPT_PRIORITY_VALIDATION(GPIOTE_CONFIG_IRQ_PRIORITY); #define FORBIDDEN_HANDLER_ADDRESS ((nrf_drv_gpiote_evt_handler_t)UINT32_MAX) #define PIN_NOT_USED (-1) @@ -51,23 +68,47 @@ #define SENSE_FIELD_MASK (0xC0) /** - * @brief Macro for conveting task-event index to an address of an event register. + * @brief Macro for converting task-event index to an address of an event register. * * Macro utilizes the fact that registers are grouped together in ascending order. */ -#define TE_IDX_TO_EVENT_ADDR(idx) (nrf_gpiote_events_t)((uint32_t)NRF_GPIOTE_EVENTS_IN_0+(sizeof(uint32_t)*(idx))) +#define TE_IDX_TO_EVENT_ADDR(idx) (nrf_gpiote_events_t)((uint32_t)NRF_GPIOTE_EVENTS_IN_0 + \ + (sizeof(uint32_t) * (idx))) /** - * @brief Macro for conveting task-event index to an address of a task register. + * @brief Macro for converting task-event index of OUT task to an address of a task register. * * Macro utilizes the fact that registers are grouped together in ascending order. */ -#define TE_IDX_TO_TASK_ADDR(idx) (nrf_gpiote_tasks_t)((uint32_t)NRF_GPIOTE_TASKS_OUT_0+(sizeof(uint32_t)*(idx))) +#define TE_OUT_IDX_TO_TASK_ADDR(idx) (nrf_gpiote_tasks_t)((uint32_t)NRF_GPIOTE_TASKS_OUT_0 + \ + (sizeof(uint32_t) * (idx))) -//lint -save -e661 +#if defined(GPIOTE_FEATURE_SET_PRESENT) || defined(__SDK_DOXYGEN__) +/** + * @brief Macro for converting task-event index of SET task to an address of a task register. + * + * Macro utilizes the fact that registers are grouped together in ascending order. + */ +#define TE_SET_IDX_TO_TASK_ADDR(idx) (nrf_gpiote_tasks_t)((uint32_t)NRF_GPIOTE_TASKS_SET_0 + \ + (sizeof(uint32_t) * (idx))) + +#endif // defined(GPIOTE_FEATURE_SET_PRESENT) || defined(__SDK_DOXYGEN__) + +#if defined(GPIOTE_FEATURE_CLR_PRESENT) || defined(__SDK_DOXYGEN__) +/** + * @brief Macro for converting task-event index of CLR task to an address of a task register. + * + * Macro utilizes the fact that registers are grouped together in ascending order. + */ +#define TE_CLR_IDX_TO_TASK_ADDR(idx) (nrf_gpiote_tasks_t)((uint32_t)NRF_GPIOTE_TASKS_CLR_0 + \ + (sizeof(uint32_t) * (idx))) + +#endif // defined(GPIOTE_FEATURE_CLR_PRESENT) || defined(__SDK_DOXYGEN__) + +/*lint -save -e661*/ typedef struct { - nrf_drv_gpiote_evt_handler_t handlers[NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS]; + nrf_drv_gpiote_evt_handler_t handlers[GPIOTE_CH_NUM + GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS]; int8_t pin_assignments[NUMBER_OF_PINS]; int8_t port_handlers_pins[GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS]; nrf_drv_state_t state; @@ -80,67 +121,80 @@ __STATIC_INLINE bool pin_in_use(uint32_t pin) return (m_cb.pin_assignments[pin] != PIN_NOT_USED); } + __STATIC_INLINE bool pin_in_use_as_non_task_out(uint32_t pin) { return (m_cb.pin_assignments[pin] == PIN_USED); } + __STATIC_INLINE bool pin_in_use_by_te(uint32_t pin) { - return (m_cb.pin_assignments[pin] >= 0 && m_cb.pin_assignments[pin] < NUMBER_OF_GPIO_TE) ? true : false; + return (m_cb.pin_assignments[pin] >= 0 && m_cb.pin_assignments[pin] < + GPIOTE_CH_NUM) ? true : false; } + __STATIC_INLINE bool pin_in_use_by_port(uint32_t pin) { - return (m_cb.pin_assignments[pin] >= NUMBER_OF_GPIO_TE); + return (m_cb.pin_assignments[pin] >= GPIOTE_CH_NUM); } + __STATIC_INLINE bool pin_in_use_by_gpiote(uint32_t pin) { return (m_cb.pin_assignments[pin] >= 0); } -__STATIC_INLINE void pin_in_use_by_te_set(uint32_t pin, - uint32_t channel_id, + +__STATIC_INLINE void pin_in_use_by_te_set(uint32_t pin, + uint32_t channel_id, nrf_drv_gpiote_evt_handler_t handler, - bool is_channel) + bool is_channel) { m_cb.pin_assignments[pin] = channel_id; m_cb.handlers[channel_id] = handler; if (!is_channel) { - m_cb.port_handlers_pins[channel_id-NUMBER_OF_GPIO_TE] = (int8_t)pin; + m_cb.port_handlers_pins[channel_id - GPIOTE_CH_NUM] = (int8_t)pin; } } + __STATIC_INLINE void pin_in_use_set(uint32_t pin) { m_cb.pin_assignments[pin] = PIN_USED; } + __STATIC_INLINE void pin_in_use_clear(uint32_t pin) { m_cb.pin_assignments[pin] = PIN_NOT_USED; } + __STATIC_INLINE int8_t channel_port_get(uint32_t pin) { return m_cb.pin_assignments[pin]; } + __STATIC_INLINE nrf_drv_gpiote_evt_handler_t channel_handler_get(uint32_t channel) { return m_cb.handlers[channel]; } -static int8_t channel_port_alloc(uint32_t pin,nrf_drv_gpiote_evt_handler_t handler, bool channel) + +static int8_t channel_port_alloc(uint32_t pin, nrf_drv_gpiote_evt_handler_t handler, bool channel) { - int8_t channel_id = NO_CHANNELS; + int8_t channel_id = NO_CHANNELS; uint32_t i; - uint32_t start_idx = channel ? 0 : NUMBER_OF_GPIO_TE; - uint32_t end_idx = channel ? NUMBER_OF_GPIO_TE : (NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS); - //critical section + uint32_t start_idx = channel ? 0 : GPIOTE_CH_NUM; + uint32_t end_idx = + channel ? GPIOTE_CH_NUM : (GPIOTE_CH_NUM + GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS); + + // critical section for (i = start_idx; i < end_idx; i++) { @@ -151,60 +205,77 @@ static int8_t channel_port_alloc(uint32_t pin,nrf_drv_gpiote_evt_handler_t handl break; } } - //critical section + // critical section return channel_id; } + static void channel_free(uint8_t channel_id) { m_cb.handlers[channel_id] = FORBIDDEN_HANDLER_ADDRESS; - if (channel_id >= NUMBER_OF_GPIO_TE) + if (channel_id >= GPIOTE_CH_NUM) { - m_cb.port_handlers_pins[channel_id-NUMBER_OF_GPIO_TE] = (int8_t)PIN_NOT_USED; + m_cb.port_handlers_pins[channel_id - GPIOTE_CH_NUM] = (int8_t)PIN_NOT_USED; } } + ret_code_t nrf_drv_gpiote_init(void) { + ret_code_t err_code; + if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", + (uint32_t)__func__, + (uint32_t)ERR_TO_STR(err_code)); + return err_code; } uint8_t i; + for (i = 0; i < NUMBER_OF_PINS; i++) { pin_in_use_clear(i); } - for (i = 0; i < (NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS); i++) + + for (i = 0; i < (GPIOTE_CH_NUM + GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS); i++) { channel_free(i); } nrf_drv_common_irq_enable(GPIOTE_IRQn, GPIOTE_CONFIG_IRQ_PRIORITY); + nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_PORT); nrf_gpiote_int_enable(GPIOTE_INTENSET_PORT_Msk); m_cb.state = NRF_DRV_STATE_INITIALIZED; - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, + (uint32_t)ERR_TO_STR(err_code)); + return err_code; } + bool nrf_drv_gpiote_is_init(void) { return (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) ? true : false; } + void nrf_drv_gpiote_uninit(void) { - ASSERT(m_cb.state!=NRF_DRV_STATE_UNINITIALIZED); + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); uint32_t i; + for (i = 0; i < NUMBER_OF_PINS; i++) { if (pin_in_use_as_non_task_out(i)) { nrf_drv_gpiote_out_uninit(i); } - else if( pin_in_use_by_gpiote(i)) + else if ( pin_in_use_by_gpiote(i)) { /* Disable gpiote_in is having the same effect on out pin as gpiote_out_uninit on * so it can be called on all pins used by GPIOTE. @@ -213,20 +284,22 @@ void nrf_drv_gpiote_uninit(void) } } m_cb.state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Uninitialized.\r\n"); } -ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, + +ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, nrf_drv_gpiote_out_config_t const * p_config) { ASSERT(pin < NUMBER_OF_PINS); ASSERT(m_cb.state == NRF_DRV_STATE_INITIALIZED); ASSERT(p_config); - ret_code_t result = NRF_SUCCESS; + ret_code_t err_code = NRF_SUCCESS; if (pin_in_use(pin)) { - result = NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } else { @@ -240,7 +313,7 @@ ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, } else { - result = NRF_ERROR_NO_MEM; + err_code = NRF_ERROR_NO_MEM; } } else @@ -248,7 +321,7 @@ ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, pin_in_use_set(pin); } - if (result == NRF_SUCCESS) + if (err_code == NRF_SUCCESS) { if (p_config->init_state == NRF_GPIOTE_INITIAL_VALUE_HIGH) { @@ -258,14 +331,17 @@ ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, { nrf_gpio_pin_clear(pin); } - + nrf_gpio_cfg_output(pin); } } - return result; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, + (uint32_t)ERR_TO_STR(err_code)); + return err_code; } + void nrf_drv_gpiote_out_uninit(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); @@ -281,6 +357,7 @@ void nrf_drv_gpiote_out_uninit(nrf_drv_gpiote_pin_t pin) nrf_gpio_cfg_default(pin); } + void nrf_drv_gpiote_out_set(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); @@ -290,6 +367,7 @@ void nrf_drv_gpiote_out_set(nrf_drv_gpiote_pin_t pin) nrf_gpio_pin_set(pin); } + void nrf_drv_gpiote_out_clear(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); @@ -299,6 +377,7 @@ void nrf_drv_gpiote_out_clear(nrf_drv_gpiote_pin_t pin) nrf_gpio_pin_clear(pin); } + void nrf_drv_gpiote_out_toggle(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); @@ -308,6 +387,7 @@ void nrf_drv_gpiote_out_toggle(nrf_drv_gpiote_pin_t pin) nrf_gpio_pin_toggle(pin); } + void nrf_drv_gpiote_out_task_enable(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); @@ -317,6 +397,7 @@ void nrf_drv_gpiote_out_task_enable(nrf_drv_gpiote_pin_t pin) nrf_gpiote_task_enable(m_cb.pin_assignments[pin]); } + void nrf_drv_gpiote_out_task_disable(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); @@ -326,45 +407,105 @@ void nrf_drv_gpiote_out_task_disable(nrf_drv_gpiote_pin_t pin) nrf_gpiote_task_disable(m_cb.pin_assignments[pin]); } + uint32_t nrf_drv_gpiote_out_task_addr_get(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); ASSERT(pin_in_use_by_te(pin)); - - nrf_gpiote_tasks_t task = TE_IDX_TO_TASK_ADDR(channel_port_get(pin)); + + nrf_gpiote_tasks_t task = TE_OUT_IDX_TO_TASK_ADDR(channel_port_get(pin)); return nrf_gpiote_task_addr_get(task); } + +#if defined(GPIOTE_FEATURE_SET_PRESENT) +uint32_t nrf_drv_gpiote_set_task_addr_get(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use_by_te(pin)); + + nrf_gpiote_tasks_t task = TE_SET_IDX_TO_TASK_ADDR(channel_port_get(pin)); + return nrf_gpiote_task_addr_get(task); +} + + +#endif // defined(GPIOTE_FEATURE_SET_PRESENT) + +#if defined(GPIOTE_FEATURE_CLR_PRESENT) +uint32_t nrf_drv_gpiote_clr_task_addr_get(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use_by_te(pin)); + + nrf_gpiote_tasks_t task = TE_CLR_IDX_TO_TASK_ADDR(channel_port_get(pin)); + return nrf_gpiote_task_addr_get(task); +} + + +#endif // defined(GPIOTE_FEATURE_CLR_PRESENT) + void nrf_drv_gpiote_out_task_force(nrf_drv_gpiote_pin_t pin, uint8_t state) { ASSERT(pin < NUMBER_OF_PINS); ASSERT(pin_in_use(pin)); ASSERT(pin_in_use_by_te(pin)); - - nrf_gpiote_outinit_t init_val = state ? NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW; + + nrf_gpiote_outinit_t init_val = + state ? NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW; nrf_gpiote_task_force(m_cb.pin_assignments[pin], init_val); } + void nrf_drv_gpiote_out_task_trigger(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); ASSERT(pin_in_use(pin)); ASSERT(pin_in_use_by_te(pin)); - nrf_gpiote_tasks_t task = TE_IDX_TO_TASK_ADDR(channel_port_get(pin));; + nrf_gpiote_tasks_t task = TE_OUT_IDX_TO_TASK_ADDR(channel_port_get(pin)); nrf_gpiote_task_set(task); } -ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, - nrf_drv_gpiote_in_config_t const * p_config, - nrf_drv_gpiote_evt_handler_t evt_handler) + +#if defined(GPIOTE_FEATURE_SET_PRESENT) +void nrf_drv_gpiote_set_task_trigger(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); - ret_code_t result = NRF_SUCCESS; + ASSERT(pin_in_use(pin)); + ASSERT(pin_in_use_by_te(pin)); + + nrf_gpiote_tasks_t task = TE_SET_IDX_TO_TASK_ADDR(channel_port_get(pin)); + nrf_gpiote_task_set(task); +} + + +#endif // defined(GPIOTE_FEATURE_SET_PRESENT) + +#if defined(GPIOTE_FEATURE_CLR_PRESENT) +void nrf_drv_gpiote_clr_task_trigger(nrf_drv_gpiote_pin_t pin) +{ + ASSERT(pin < NUMBER_OF_PINS); + ASSERT(pin_in_use(pin)); + ASSERT(pin_in_use_by_te(pin)); + + nrf_gpiote_tasks_t task = TE_CLR_IDX_TO_TASK_ADDR(channel_port_get(pin)); + nrf_gpiote_task_set(task); +} + + +#endif // defined(GPIOTE_FEATURE_CLR_PRESENT) + +ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, + nrf_drv_gpiote_in_config_t const * p_config, + nrf_drv_gpiote_evt_handler_t evt_handler) +{ + ASSERT(pin < NUMBER_OF_PINS); + ret_code_t err_code = NRF_SUCCESS; + /* Only one GPIOTE channel can be assigned to one physical pin. */ if (pin_in_use_by_gpiote(pin)) { - result = NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } else { @@ -377,39 +518,46 @@ ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, } else { - nrf_gpio_cfg_input(pin,p_config->pull); + nrf_gpio_cfg_input(pin, p_config->pull); } if (p_config->hi_accuracy) { - nrf_gpiote_event_configure(channel, pin,p_config->sense); + nrf_gpiote_event_configure(channel, pin, p_config->sense); } else { - m_cb.port_handlers_pins[channel-NUMBER_OF_GPIO_TE] |= (p_config->sense)<< SENSE_FIELD_POS; + m_cb.port_handlers_pins[channel - + GPIOTE_CH_NUM] |= (p_config->sense) << SENSE_FIELD_POS; } } else { - result = NRF_ERROR_NO_MEM; + err_code = NRF_ERROR_NO_MEM; } } - return result; + + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, + (uint32_t)ERR_TO_STR(err_code)); + return err_code; } + void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable) { ASSERT(pin < NUMBER_OF_PINS); ASSERT(pin_in_use_by_gpiote(pin)); if (pin_in_use_by_port(pin)) { - uint8_t pin_and_sense = m_cb.port_handlers_pins[channel_port_get(pin)-NUMBER_OF_GPIO_TE]; - nrf_gpiote_polarity_t polarity = (nrf_gpiote_polarity_t)(pin_and_sense >> SENSE_FIELD_POS); + uint8_t pin_and_sense = + m_cb.port_handlers_pins[channel_port_get(pin) - GPIOTE_CH_NUM]; + nrf_gpiote_polarity_t polarity = + (nrf_gpiote_polarity_t)(pin_and_sense >> SENSE_FIELD_POS); nrf_gpio_pin_sense_t sense; if (polarity == NRF_GPIOTE_POLARITY_TOGGLE) { /* read current pin state and set for next sense to oposit */ - sense = (nrf_gpio_pins_read() & (1 << pin)) ? + sense = (nrf_gpio_pin_read(pin)) ? NRF_GPIO_PIN_SENSE_LOW : NRF_GPIO_PIN_SENSE_HIGH; } else @@ -417,13 +565,13 @@ void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable) sense = (polarity == NRF_GPIOTE_POLARITY_LOTOHI) ? NRF_GPIO_PIN_SENSE_HIGH : NRF_GPIO_PIN_SENSE_LOW; } - nrf_gpio_cfg_sense_set(pin,sense); + nrf_gpio_cfg_sense_set(pin, sense); } - else if(pin_in_use_by_te(pin)) + else if (pin_in_use_by_te(pin)) { - int32_t channel = (int32_t)channel_port_get(pin); - nrf_gpiote_events_t event = TE_IDX_TO_EVENT_ADDR(channel); - + int32_t channel = (int32_t)channel_port_get(pin); + nrf_gpiote_events_t event = TE_IDX_TO_EVENT_ADDR(channel); + nrf_gpiote_event_enable(channel); nrf_gpiote_event_clear(event); @@ -439,15 +587,16 @@ void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable) } } + void nrf_drv_gpiote_in_event_disable(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); ASSERT(pin_in_use_by_gpiote(pin)); if (pin_in_use_by_port(pin)) { - nrf_gpio_cfg_sense_set(pin,NRF_GPIO_PIN_NOSENSE); + nrf_gpio_cfg_sense_set(pin, NRF_GPIO_PIN_NOSENSE); } - else if(pin_in_use_by_te(pin)) + else if (pin_in_use_by_te(pin)) { int32_t channel = (int32_t)channel_port_get(pin); nrf_gpiote_event_disable(channel); @@ -455,12 +604,13 @@ void nrf_drv_gpiote_in_event_disable(nrf_drv_gpiote_pin_t pin) } } + void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); ASSERT(pin_in_use_by_gpiote(pin)); nrf_drv_gpiote_in_event_disable(pin); - if(pin_in_use_by_te(pin)) + if (pin_in_use_by_te(pin)) { nrf_gpiote_te_default(channel_port_get(pin)); } @@ -469,31 +619,40 @@ void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin) pin_in_use_clear(pin); } + bool nrf_drv_gpiote_in_is_set(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); return nrf_gpio_pin_read(pin) ? true : false; } + uint32_t nrf_drv_gpiote_in_event_addr_get(nrf_drv_gpiote_pin_t pin) { ASSERT(pin < NUMBER_OF_PINS); - ASSERT(pin_in_use_by_te(pin)); - - nrf_gpiote_events_t event = TE_IDX_TO_EVENT_ADDR(channel_port_get(pin)); + ASSERT(pin_in_use_by_port(pin) || pin_in_use_by_te(pin)); + + nrf_gpiote_events_t event = NRF_GPIOTE_EVENTS_PORT; + + if (pin_in_use_by_te(pin)) + { + event = TE_IDX_TO_EVENT_ADDR(channel_port_get(pin)); + } return nrf_gpiote_event_addr_get(event); } + void GPIOTE_IRQHandler(void) { - uint32_t status = 0; - uint32_t input = 0; + uint32_t status = 0; + uint32_t input[GPIO_COUNT] = {0}; /* collect status of all GPIOTE pin events. Processing is done once all are collected and cleared.*/ - uint32_t i; + uint32_t i; nrf_gpiote_events_t event = NRF_GPIOTE_EVENTS_IN_0; - uint32_t mask = (uint32_t)NRF_GPIOTE_INT_IN0_MASK; - for (i = 0; i < NUMBER_OF_GPIO_TE; i++) + uint32_t mask = (uint32_t)NRF_GPIOTE_INT_IN0_MASK; + + for (i = 0; i < GPIOTE_CH_NUM; i++) { if (nrf_gpiote_event_is_set(event) && nrf_gpiote_int_is_enabled(mask)) { @@ -512,21 +671,27 @@ void GPIOTE_IRQHandler(void) { nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_PORT); status |= (uint32_t)NRF_GPIOTE_INT_PORT_MASK; - input = nrf_gpio_pins_read(); + nrf_gpio_ports_read(0, GPIO_COUNT, input); } /* Process pin events. */ if (status & NRF_GPIOTE_INT_IN_MASK) { mask = (uint32_t)NRF_GPIOTE_INT_IN0_MASK; - for (i = 0; i < NUMBER_OF_GPIO_TE; i++) + + for (i = 0; i < GPIOTE_CH_NUM; i++) { if (mask & status) { nrf_drv_gpiote_pin_t pin = nrf_gpiote_event_pin_get(i); - nrf_gpiote_polarity_t polarity = nrf_gpiote_event_polarity_get(i); - nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(i); - handler(pin,polarity); + NRF_LOG_DEBUG("Event in number: %d.\r\n", i); + nrf_gpiote_polarity_t polarity = nrf_gpiote_event_polarity_get(i); + nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(i); + NRF_LOG_DEBUG("Pin: %d, polarity: %d.\r\n", pin, polarity); + if (handler) + { + handler(pin, polarity); + } } mask <<= 1; } @@ -535,42 +700,56 @@ void GPIOTE_IRQHandler(void) if (status & (uint32_t)NRF_GPIOTE_INT_PORT_MASK) { /* Process port event. */ - uint8_t repeat = 0; - uint32_t toggle_mask = 0; - uint32_t pins_to_check = 0xFFFFFFFFuL; + uint32_t port_idx; + uint8_t repeat = 0; + uint32_t toggle_mask[GPIO_COUNT] = {0}; + uint32_t pins_to_check[GPIO_COUNT]; + + // Faster way of doing memset because in interrupt context. + for (port_idx = 0; port_idx < GPIO_COUNT; port_idx++) + { + pins_to_check[port_idx] = 0xFFFFFFFF; + } do { repeat = 0; + for (i = 0; i < GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS; i++) { - uint8_t pin_and_sense = m_cb.port_handlers_pins[i]; - nrf_drv_gpiote_pin_t pin = (pin_and_sense & ~SENSE_FIELD_MASK); + uint8_t pin_and_sense = m_cb.port_handlers_pins[i]; + nrf_drv_gpiote_pin_t pin = (pin_and_sense & ~SENSE_FIELD_MASK); if ((m_cb.port_handlers_pins[i] != PIN_NOT_USED) - && ((1UL << pin) & pins_to_check)) + && nrf_bitmask_bit_is_set(pin, pins_to_check)) { nrf_gpiote_polarity_t polarity = - (nrf_gpiote_polarity_t)((pin_and_sense & SENSE_FIELD_MASK) >> SENSE_FIELD_POS); - nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(channel_port_get(pin)); - if (handler || polarity == NRF_GPIOTE_POLARITY_TOGGLE) + (nrf_gpiote_polarity_t)((pin_and_sense & + SENSE_FIELD_MASK) >> SENSE_FIELD_POS); + nrf_drv_gpiote_evt_handler_t handler = + channel_handler_get(channel_port_get(pin)); + if (handler || (polarity == NRF_GPIOTE_POLARITY_TOGGLE)) { - mask = 1 << pin; if (polarity == NRF_GPIOTE_POLARITY_TOGGLE) { - toggle_mask |= mask; + nrf_bitmask_bit_set(pin, toggle_mask); } - nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(pin); - - if (((mask & input) && (sense==NRF_GPIO_PIN_SENSE_HIGH)) || - (!(mask & input) && (sense==NRF_GPIO_PIN_SENSE_LOW)) ) + nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(pin); + uint32_t pin_state = nrf_bitmask_bit_is_set(pin, input); + if ((pin_state && (sense == NRF_GPIO_PIN_SENSE_HIGH)) || + (!pin_state && (sense == NRF_GPIO_PIN_SENSE_LOW)) ) { + NRF_LOG_DEBUG("PORT event for pin: %d, polarity: %d.\r\n", pin, + polarity); if (polarity == NRF_GPIOTE_POLARITY_TOGGLE) { - nrf_gpio_pin_sense_t next_sense = (sense == NRF_GPIO_PIN_SENSE_HIGH) ? - NRF_GPIO_PIN_SENSE_LOW : NRF_GPIO_PIN_SENSE_HIGH; + nrf_gpio_pin_sense_t next_sense = + (sense == NRF_GPIO_PIN_SENSE_HIGH) ? + NRF_GPIO_PIN_SENSE_LOW : + NRF_GPIO_PIN_SENSE_HIGH; nrf_gpio_cfg_sense_set(pin, next_sense); ++repeat; + } if (handler) { @@ -588,20 +767,41 @@ void GPIOTE_IRQHandler(void) // State of any other enabled low-accuracy input in toggle mode must be checked // explicitly, because it does not trigger the interrput when SENSE signal is active. // For more information about SENSE functionality, refer to Product Specification. - uint32_t new_input = nrf_gpio_pins_read(); - if (new_input == input) + + uint32_t new_input[GPIO_COUNT]; + bool input_unchanged = true; + nrf_gpio_ports_read(0, GPIO_COUNT, new_input); + + // Faster way of doing memcmp because in interrupt context. + for (port_idx = 0; port_idx < GPIO_COUNT; port_idx++) { - //No change. + if (new_input[port_idx] != input[port_idx]) + { + input_unchanged = false; + break; + } + } + + if (input_unchanged) + { + // No change. repeat = 0; } else { - input = new_input; - pins_to_check = toggle_mask; + // Faster way of doing memcpy because in interrupt context. + for (port_idx = 0; port_idx < GPIO_COUNT; port_idx++) + { + input[port_idx] = new_input[port_idx]; + pins_to_check[port_idx] = toggle_mask[port_idx]; + } } } } while (repeat); } } -//lint -restore + + +/*lint -restore*/ +#endif // NRF_MODULE_ENABLED(GPIOTE) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h index 2af99b056e..e00240c3c3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/gpiote/nrf_drv_gpiote.h @@ -36,7 +36,6 @@ * */ - #ifndef NRF_DRV_GPIOTE__ #define NRF_DRV_GPIOTE__ @@ -52,10 +51,14 @@ #include "nrf_gpiote.h" #include "nrf_gpio.h" -#include "nrf_drv_config.h" #include "sdk_errors.h" #include #include +#include "sdk_config.h" + +#ifdef __cplusplus +extern "C" { +#endif /**@brief Input pin configuration. */ typedef struct @@ -151,7 +154,7 @@ typedef void (*nrf_drv_gpiote_evt_handler_t)(nrf_drv_gpiote_pin_t pin, nrf_gpiot /** * @brief Function for initializing the GPIOTE module. * - * @details Only static configuration is supported to prevent the shared + * @details Only static configuration is supported to prevent the shared * resource being customized by the initiator. * * @retval NRF_SUCCESS If initialization was successful. @@ -177,8 +180,8 @@ void nrf_drv_gpiote_uninit(void); /** * @brief Function for initializing a GPIOTE output pin. - * @details The output pin can be controlled by the CPU or by PPI. The initial - * configuration specifies which mode is used. If PPI mode is used, the driver + * @details The output pin can be controlled by the CPU or by PPI. The initial + * configuration specifies which mode is used. If PPI mode is used, the driver * attempts to allocate one of the available GPIOTE channels. If no channel is * available, an error is returned. * @@ -196,76 +199,100 @@ ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, * @brief Function for uninitializing a GPIOTE output pin. * @details The driver frees the GPIOTE channel if the output pin was using one. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_out_uninit(nrf_drv_gpiote_pin_t pin); /** * @brief Function for setting a GPIOTE output pin. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_out_set(nrf_drv_gpiote_pin_t pin); /** * @brief Function for clearing a GPIOTE output pin. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_out_clear(nrf_drv_gpiote_pin_t pin); /** * @brief Function for toggling a GPIOTE output pin. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_out_toggle(nrf_drv_gpiote_pin_t pin); /** * @brief Function for enabling a GPIOTE output pin task. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_out_task_enable(nrf_drv_gpiote_pin_t pin); /** * @brief Function for disabling a GPIOTE output pin task. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_out_task_disable(nrf_drv_gpiote_pin_t pin); /** * @brief Function for getting the address of a configurable GPIOTE task. * - * @param[in] pin Pin. + * @param[in] pin Pin. + * + * @return Address of OUT task. */ uint32_t nrf_drv_gpiote_out_task_addr_get(nrf_drv_gpiote_pin_t pin); +#if defined(GPIOTE_FEATURE_SET_PRESENT) +/** + * @brief Function for getting the address of a configurable GPIOTE task. + * + * @param[in] pin Pin. + * + * @return Address of SET task. + */ +uint32_t nrf_drv_gpiote_set_task_addr_get(nrf_drv_gpiote_pin_t pin); +#endif // defined(GPIOTE_FEATURE_SET_PRESENT) + +#if defined(GPIOTE_FEATURE_CLR_PRESENT) +/** + * @brief Function for getting the address of a configurable GPIOTE task. + * + * @param[in] pin Pin. + * + * @return Address of CLR task. + */ +uint32_t nrf_drv_gpiote_clr_task_addr_get(nrf_drv_gpiote_pin_t pin); +#endif // defined(GPIOTE_FEATURE_CLR_PRESENT) + /** * @brief Function for initializing a GPIOTE input pin. - * @details The input pin can act in two ways: + * @details The input pin can act in two ways: * - lower accuracy but low power (high frequency clock not needed) * - higher accuracy (high frequency clock required) * * The initial configuration specifies which mode is used. - * If high-accuracy mode is used, the driver attempts to allocate one - * of the available GPIOTE channels. If no channel is + * If high-accuracy mode is used, the driver attempts to allocate one + * of the available GPIOTE channels. If no channel is * available, an error is returned. * In low accuracy mode SENSE feature is used. In this case only one active pin * can be detected at a time. It can be worked around by setting all of the used * low accuracy pins to toggle mode. * For more information about SENSE functionality, refer to Product Specification. * - * @param[in] pin Pin. - * @param[in] p_config Initial configuration. - * @param[in] evt_handler User function to be called when the configured transition occurs. + * @param[in] pin Pin. + * @param[in] p_config Initial configuration. + * @param[in] evt_handler User function to be called when the configured transition occurs. * * @retval NRF_SUCCESS If initialization was successful. * @retval NRF_ERROR_INVALID_STATE If the driver is not initialized or the pin is already used. * @retval NRF_ERROR_NO_MEM If no GPIOTE channel is available. */ -ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, +ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, nrf_drv_gpiote_in_config_t const * p_config, nrf_drv_gpiote_evt_handler_t evt_handler); @@ -273,19 +300,19 @@ ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, * @brief Function for uninitializing a GPIOTE input pin. * @details The driver frees the GPIOTE channel if the input pin was using one. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin); /** * @brief Function for enabling sensing of a GPIOTE input pin. * - * @details If the input pin is configured as high-accuracy pin, the function + * @details If the input pin is configured as high-accuracy pin, the function * enables an IN_EVENT. Otherwise, the function enables the GPIO sense mechanism. - * Note that a PORT event is shared between multiple pins, therefore the + * Note that a PORT event is shared between multiple pins, therefore the * interrupt is always enabled. * - * @param[in] pin Pin. + * @param[in] pin Pin. * @param[in] int_enable True to enable the interrupt. Always valid for a high-accuracy pin. */ void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable); @@ -293,14 +320,14 @@ void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable); /** * @brief Function for disabling a GPIOTE input pin. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_in_event_disable(nrf_drv_gpiote_pin_t pin); /** * @brief Function for checking if a GPIOTE input pin is set. * - * @param[in] pin Pin. + * @param[in] pin Pin. * @retval true If the input pin is set. * @retval false If the input pin is not set. */ @@ -310,27 +337,48 @@ bool nrf_drv_gpiote_in_is_set(nrf_drv_gpiote_pin_t pin); * @brief Function for getting the address of a GPIOTE input pin event. * @details If the pin is configured to use low-accuracy mode, the address of the PORT event is returned. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ uint32_t nrf_drv_gpiote_in_event_addr_get(nrf_drv_gpiote_pin_t pin); /** * @brief Function for forcing a specific state on the pin configured as task. * - * @param[in] pin Pin. + * @param[in] pin Pin. * @param[in] state Pin state. */ void nrf_drv_gpiote_out_task_force(nrf_drv_gpiote_pin_t pin, uint8_t state); /** - * @brief Function for triggering the task manually. + * @brief Function for triggering the task OUT manually. * - * @param[in] pin Pin. + * @param[in] pin Pin. */ void nrf_drv_gpiote_out_task_trigger(nrf_drv_gpiote_pin_t pin); +#ifdef NRF52_SERIES +/** + * @brief Function for triggering the task SET manually. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_set_task_trigger(nrf_drv_gpiote_pin_t pin); + +/** + * @brief Function for triggering the task CLR manually. + * + * @param[in] pin Pin. + */ +void nrf_drv_gpiote_clr_task_trigger(nrf_drv_gpiote_pin_t pin); +#endif + /** *@} **/ + +#ifdef __cplusplus +} +#endif + #endif //NRF_DRV_GPIOTE__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.h deleted file mode 100644 index ea4e094cfa..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_adc.h +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Copyright (c) 2014 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef NRF_ADC_H_ -#define NRF_ADC_H_ - -/** - * @defgroup nrf_adc_hal ADC HAL - * @{ - * @ingroup nrf_adc - * @brief @tagAPI51 Hardware access layer for managing the analog-to-digital converter (ADC). - */ - -#include -#include - -#include "nrf.h" - -#ifndef NRF52 -/** - * @enum nrf_adc_config_resolution_t - * @brief Resolution of the analog-to-digital converter. - */ - -/** - * @brief ADC interrupts. - */ -typedef enum -{ - NRF_ADC_INT_END_MASK = ADC_INTENSET_END_Msk, /**< ADC interrupt on END event. */ -} nrf_adc_int_mask_t; - -typedef enum -{ - NRF_ADC_CONFIG_RES_8BIT = ADC_CONFIG_RES_8bit, /**< 8 bit resolution. */ - NRF_ADC_CONFIG_RES_9BIT = ADC_CONFIG_RES_9bit, /**< 9 bit resolution. */ - NRF_ADC_CONFIG_RES_10BIT = ADC_CONFIG_RES_10bit, /**< 10 bit resolution. */ -} nrf_adc_config_resolution_t; - - -/** - * @enum nrf_adc_config_scaling_t - * @brief Scaling factor of the analog-to-digital conversion. - */ -typedef enum -{ - NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE = ADC_CONFIG_INPSEL_AnalogInputNoPrescaling, /**< Full scale input. */ - NRF_ADC_CONFIG_SCALING_INPUT_TWO_THIRDS = ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling, /**< 2/3 scale input. */ - NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD = ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling, /**< 1/3 scale input. */ - NRF_ADC_CONFIG_SCALING_SUPPLY_TWO_THIRDS = ADC_CONFIG_INPSEL_SupplyTwoThirdsPrescaling, /**< 2/3 of supply. */ - NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD = ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling /**< 1/3 of supply. */ -} nrf_adc_config_scaling_t; - -/** - * @enum nrf_adc_config_reference_t - * @brief Reference selection of the analog-to-digital converter. - */ -typedef enum -{ - NRF_ADC_CONFIG_REF_VBG = ADC_CONFIG_REFSEL_VBG, /**< 1.2 V reference. */ - NRF_ADC_CONFIG_REF_SUPPLY_ONE_HALF = ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling, /**< 1/2 of power supply. */ - NRF_ADC_CONFIG_REF_SUPPLY_ONE_THIRD = ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling, /**< 1/3 of power supply. */ - NRF_ADC_CONFIG_REF_EXT_REF0 = ADC_CONFIG_REFSEL_External | - ADC_CONFIG_EXTREFSEL_AnalogReference0 << - ADC_CONFIG_EXTREFSEL_Pos, /**< External reference 0. */ - NRF_ADC_CONFIG_REF_EXT_REF1 = ADC_CONFIG_REFSEL_External | - ADC_CONFIG_EXTREFSEL_AnalogReference1 << ADC_CONFIG_EXTREFSEL_Pos, /**< External reference 0. */ -} nrf_adc_config_reference_t; - -/** - * @enum nrf_adc_config_input_t - * @brief Input selection of the analog-to-digital converter. - */ -typedef enum -{ - NRF_ADC_CONFIG_INPUT_DISABLED = ADC_CONFIG_PSEL_Disabled, /**< No input selected. */ - NRF_ADC_CONFIG_INPUT_0 = ADC_CONFIG_PSEL_AnalogInput0, /**< Input 0. */ - NRF_ADC_CONFIG_INPUT_1 = ADC_CONFIG_PSEL_AnalogInput1, /**< Input 1. */ - NRF_ADC_CONFIG_INPUT_2 = ADC_CONFIG_PSEL_AnalogInput2, /**< Input 2. */ - NRF_ADC_CONFIG_INPUT_3 = ADC_CONFIG_PSEL_AnalogInput3, /**< Input 3. */ - NRF_ADC_CONFIG_INPUT_4 = ADC_CONFIG_PSEL_AnalogInput4, /**< Input 4. */ - NRF_ADC_CONFIG_INPUT_5 = ADC_CONFIG_PSEL_AnalogInput5, /**< Input 5. */ - NRF_ADC_CONFIG_INPUT_6 = ADC_CONFIG_PSEL_AnalogInput6, /**< Input 6. */ - NRF_ADC_CONFIG_INPUT_7 = ADC_CONFIG_PSEL_AnalogInput7, /**< Input 7. */ -} nrf_adc_config_input_t; - -/** - * @enum nrf_adc_task_t - * @brief Analog-to-digital converter tasks. - */ -typedef enum -{ - /*lint -save -e30*/ - NRF_ADC_TASK_START = offsetof(NRF_ADC_Type, TASKS_START), /**< ADC start sampling task. */ - NRF_ADC_TASK_STOP = offsetof(NRF_ADC_Type, TASKS_STOP) /**< ADC stop sampling task. */ - /*lint -restore*/ -} nrf_adc_task_t; - -/** - * @enum nrf_adc_event_t - * @brief Analog-to-digital converter events. - */ -typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ -{ - /*lint -save -e30*/ - NRF_ADC_EVENT_END = offsetof(NRF_ADC_Type, EVENTS_END) /**< End of conversion event. */ - /*lint -restore*/ -} nrf_adc_event_t; - -/**@brief Analog-to-digital converter configuration. */ -typedef struct -{ - nrf_adc_config_resolution_t resolution; /**< ADC resolution. */ - nrf_adc_config_scaling_t scaling; /**< ADC scaling factor. */ - nrf_adc_config_reference_t reference; /**< ADC reference. */ -} nrf_adc_config_t; - -/** Default ADC configuration. */ -#define NRF_ADC_CONFIG_DEFAULT { NRF_ADC_CONFIG_RES_10BIT, \ - NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD, \ - NRF_ADC_CONFIG_REF_VBG } - -/** - * @brief Function for configuring ADC. - * - * This function powers on the analog-to-digital converter and configures it. - * After the configuration, the ADC is in DISABLE state and must be - * enabled before using it. - * - * @param[in] config Configuration parameters. - */ -void nrf_adc_configure(nrf_adc_config_t * config); - -/** - * @brief Blocking function for executing a single ADC conversion. - * - * This function selects the desired input, starts a single conversion, - * waits for it to finish, and returns the result. - * After the input is selected, the analog-to-digital converter - * is left in STOP state. - * The function does not check if the ADC is initialized and powered. - * - * @param[in] input Input to be selected. - * - * @return Conversion result. - */ -int32_t nrf_adc_convert_single(nrf_adc_config_input_t input); - -/** - * @brief Function for selecting ADC input. - * - * This function selects the active input of ADC. Ensure that - * the ADC is powered on and in IDLE state before calling this function. - * - * @param[in] input Input to be selected. - */ -__STATIC_INLINE void nrf_adc_input_select(nrf_adc_config_input_t input) -{ - NRF_ADC->CONFIG = - ((uint32_t)input << ADC_CONFIG_PSEL_Pos) | (NRF_ADC->CONFIG & ~ADC_CONFIG_PSEL_Msk); - - if (input != NRF_ADC_CONFIG_INPUT_DISABLED) - { - NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled << ADC_ENABLE_ENABLE_Pos; - } - else - { - NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Disabled << ADC_ENABLE_ENABLE_Pos; - } -} - - -/** - * @brief Function for retrieving the ADC conversion result. - * - * This function retrieves and returns the last analog-to-digital conversion result. - * - * @return Last conversion result. - */ -__STATIC_INLINE int32_t nrf_adc_result_get(void) -{ - return (int32_t)NRF_ADC->RESULT; -} - - -/** - * @brief Function for checking whether the ADC is busy. - * - * This function checks whether the analog-to-digital converter is busy with a conversion. - * - * @retval true If the ADC is busy. - * @retval false If the ADC is not busy. - */ -__STATIC_INLINE bool nrf_adc_is_busy(void) -{ - return ( (NRF_ADC->BUSY & ADC_BUSY_BUSY_Msk) == ADC_BUSY_BUSY_Msk); -} - -/** - * @brief Function for getting the ADC's enabled interrupts. - * - * @param[in] mask Mask of interrupts to check. - * - * @return State of the interrupts selected by the mask. - * - * @sa nrf_adc_int_enable() - * @sa nrf_adc_int_disable() - */ -__STATIC_INLINE uint32_t nrf_adc_int_get(uint32_t mask) -{ - return (NRF_ADC->INTENSET & mask); // when read this register will return the value of INTEN. -} - - -/** - * @brief Function for starting conversion. - * - * @sa nrf_adc_stop() - * - */ -__STATIC_INLINE void nrf_adc_start(void) -{ - NRF_ADC->TASKS_START = 1; -} - - -/** - * @brief Function for stopping conversion. - * - * If the analog-to-digital converter is in inactive state, power consumption is reduced. - * - * @sa nrf_adc_start() - * - */ -__STATIC_INLINE void nrf_adc_stop(void) -{ - NRF_ADC->TASKS_STOP = 1; -} - - -/** - * @brief Function for checking if the requested ADC conversion has ended. - * - * @retval true If the task has finished. - * @retval false If the task is still running. - */ -__STATIC_INLINE bool nrf_adc_conversion_finished(void) -{ - return ((bool)NRF_ADC->EVENTS_END); -} - -/** - * @brief Function for clearing the conversion END event. - */ -__STATIC_INLINE void nrf_adc_conversion_event_clean(void) -{ - NRF_ADC->EVENTS_END = 0; -} - -/** - * @brief Function for getting the address of an ADC task register. - * - * @param[in] adc_task ADC task. - * - * @return Address of the specified ADC task. - */ -__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task); - -/** - * @brief Function for getting the address of a specific ADC event register. - * - * @param[in] adc_event ADC event. - * - * @return Address of the specified ADC event. - */ -__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event); - -/** - * @brief Function for setting the CONFIG register in ADC. - * - * @param[in] configuration Value to be written to the CONFIG register. - */ -__STATIC_INLINE void nrf_adc_config_set(uint32_t configuration); - -/** - * @brief Function for clearing an ADC event. - * - * @param[in] event Event to clear. - */ -__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event); - -/** - * @brief Function for checking state of an ADC event. - * - * @param[in] event Event to check. - * - * @retval true If the event is set. - * @retval false If the event is not set. - */ -__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event); - -/** - * @brief Function for enabling specified interrupts. - * - * @param[in] int_mask Interrupts to enable. - */ -__STATIC_INLINE void nrf_adc_int_enable(uint32_t int_mask); - -/** - * @brief Function for disabling specified interrupts. - * - * @param[in] int_mask Interrupts to disable. - */ -__STATIC_INLINE void nrf_adc_int_disable(uint32_t int_mask); - -/** - * @brief Function for retrieving the state of a given interrupt. - * - * @param[in] int_mask Interrupt to check. - * - * @retval true If the interrupt is enabled. - * @retval false If the interrupt is not enabled. - */ -__STATIC_INLINE bool nrf_adc_int_enable_check(nrf_adc_int_mask_t int_mask); - -/** - * @brief Function for activating a specific ADC task. - * - * @param[in] task Task to activate. - */ -__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task); - -/** - * @brief Function for enabling ADC. - * - */ -__STATIC_INLINE void nrf_adc_enable(void); - -/** - * @brief Function for disabling ADC. - * - */ -__STATIC_INLINE void nrf_adc_disable(void); - -#ifndef SUPPRESS_INLINE_IMPLEMENTATION - -__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task) -{ - return (uint32_t)((uint8_t *)NRF_ADC + adc_task); -} - -__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event) -{ - return (uint32_t)((uint8_t *)NRF_ADC + adc_event); -} - -__STATIC_INLINE void nrf_adc_config_set(uint32_t configuration) -{ - NRF_ADC->CONFIG = configuration; -} - -__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event) -{ - *((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event)) = 0x0UL; -} - -__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event) -{ - return (bool)*(volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event); -} - -__STATIC_INLINE void nrf_adc_int_enable(uint32_t int_mask) -{ - NRF_ADC->INTENSET = int_mask; -} - -__STATIC_INLINE void nrf_adc_int_disable(uint32_t int_mask) -{ - NRF_ADC->INTENCLR = int_mask; -} - -__STATIC_INLINE bool nrf_adc_int_enable_check(nrf_adc_int_mask_t int_mask) -{ - return (bool)(NRF_ADC->INTENSET & int_mask); -} - -__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task) -{ - *((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)task)) = 0x1UL; -} - -__STATIC_INLINE void nrf_adc_enable(void) -{ - NRF_ADC->ENABLE = 1; -} - -__STATIC_INLINE void nrf_adc_disable(void) -{ - NRF_ADC->ENABLE = 0; -} -#endif -#endif /* NRF52 */ -/** - *@} - **/ - -#endif /* NRF_ADC_H_ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_clock.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_clock.h index 2471a317f6..da468a6db3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_clock.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_clock.h @@ -36,15 +36,18 @@ * */ - #ifndef NRF_CLOCK_H__ #define NRF_CLOCK_H__ #include #include - + #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup nrf_clock_hal Clock HAL * @{ @@ -85,20 +88,6 @@ typedef enum NRF_CLOCK_START_TASK_TRIGGERED = CLOCK_LFCLKRUN_STATUS_Triggered /**< Task LFCLKSTART/HFCLKSTART has been triggered. */ } nrf_clock_start_task_status_t; -/** - * @brief Crystal frequency selection. - */ -typedef enum -{ -#ifdef NRF51 - NRF_CLOCK_XTALFREQ_Default = CLOCK_XTALFREQ_XTALFREQ_16MHz, /**< Default. 32 MHz. */ - NRF_CLOCK_XTALFREQ_16MHz = CLOCK_XTALFREQ_XTALFREQ_16MHz, /**< 16 MHz crystal. */ - NRF_CLOCK_XTALFREQ_32MHz = CLOCK_XTALFREQ_XTALFREQ_32MHz /**< 32 MHz crystal. */ -#elif defined NRF52 - NRF_CLOCK_XTALFREQ_Default, /**< Default. 64MHz. */ -#endif -} nrf_clock_xtalfreq_t; - /** * @brief Interrupts. */ @@ -163,7 +152,7 @@ __STATIC_INLINE void nrf_clock_int_disable(uint32_t int_mask); __STATIC_INLINE bool nrf_clock_int_enable_check(nrf_clock_int_mask_t int_mask); /** - * @brief Function for retrieving the address of a specific task. + * @brief Function for retrieving the address of a specific task. * @details This function can be used by the PPI module. * * @param[in] task Task. @@ -180,7 +169,7 @@ __STATIC_INLINE uint32_t nrf_clock_task_address_get(nrf_clock_task_t task); __STATIC_INLINE void nrf_clock_task_trigger(nrf_clock_task_t task); /** - * @brief Function for retrieving the address of a specific event. + * @brief Function for retrieving the address of a specific event. * @details This function can be used by the PPI module. * * @param[in] event Event. @@ -284,21 +273,6 @@ __STATIC_INLINE bool nrf_clock_hf_is_running(nrf_clock_hfclk_t clk_src); */ __STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get(void); -/** - * @brief Function for retrieving the frequency selection of the external crystal. - * - * @retval NRF_CLOCK_XTALFREQ_16MHz If a 16 MHz crystal is used as source for the HFCLK oscillator. - * @retval NRF_CLOCK_XTALFREQ_32MHz If a 32 MHz crystal is used as source for the HFCLK oscillator. - */ -__STATIC_INLINE nrf_clock_xtalfreq_t nrf_clock_xtalfreq_get(void); - -/** - * @brief Function for changing the frequency selection of the external crystal. - * - * @param[in] xtalfreq New frequency selection for the external crystal. - */ -__STATIC_INLINE void nrf_clock_xtalfreq_set(nrf_clock_xtalfreq_t xtalfreq); - /** * @brief Function for changing the calibration timer interval. * @@ -408,26 +382,6 @@ __STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get CLOCK_HFCLKRUN_STATUS_Pos); } -__STATIC_INLINE nrf_clock_xtalfreq_t nrf_clock_xtalfreq_get(void) -{ -#ifdef NRF51 - return (nrf_clock_xtalfreq_t)((NRF_CLOCK->XTALFREQ & - CLOCK_XTALFREQ_XTALFREQ_Msk) >> CLOCK_XTALFREQ_XTALFREQ_Pos); -#elif defined NRF52 - return NRF_CLOCK_XTALFREQ_Default; -#endif -} - -__STATIC_INLINE void nrf_clock_xtalfreq_set(nrf_clock_xtalfreq_t xtalfreq) -{ -#ifdef NRF51 - NRF_CLOCK->XTALFREQ = - (uint32_t)((xtalfreq << CLOCK_XTALFREQ_XTALFREQ_Pos) & CLOCK_XTALFREQ_XTALFREQ_Msk); -#elif defined NRF52 - return; -#endif -} - __STATIC_INLINE void nrf_clock_cal_timer_timeout_set(uint32_t interval) { NRF_CLOCK->CTIV = ((interval << CLOCK_CTIV_CTIV_Pos) & CLOCK_CTIV_CTIV_Msk); @@ -438,4 +392,9 @@ __STATIC_INLINE void nrf_clock_cal_timer_timeout_set(uint32_t interval) /** *@} **/ + +#ifdef __cplusplus +} +#endif + #endif // NRF_CLOCK_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_comp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_comp.h new file mode 100644 index 0000000000..6bde8900eb --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_comp.h @@ -0,0 +1,508 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file + * @brief COMP HAL API. + */ + +#ifndef NRF_COMP_H_ +#define NRF_COMP_H_ + +/** + * @defgroup nrf_comp_hal COMP HAL + * @{ + * @ingroup nrf_comp + * @brief @tagAPI52 Hardware access layer for managing the Comparator (COMP). + */ + +#include "nrf.h" + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @enum nrf_comp_input_t + * @brief COMP analog pin selection. + */ +typedef enum +{ + NRF_COMP_INPUT_0 = COMP_PSEL_PSEL_AnalogInput0, /*!< AIN0 selected as analog input. */ + NRF_COMP_INPUT_1 = COMP_PSEL_PSEL_AnalogInput1, /*!< AIN1 selected as analog input. */ + NRF_COMP_INPUT_2 = COMP_PSEL_PSEL_AnalogInput2, /*!< AIN2 selected as analog input. */ + NRF_COMP_INPUT_3 = COMP_PSEL_PSEL_AnalogInput3, /*!< AIN3 selected as analog input. */ + NRF_COMP_INPUT_4 = COMP_PSEL_PSEL_AnalogInput4, /*!< AIN4 selected as analog input. */ + NRF_COMP_INPUT_5 = COMP_PSEL_PSEL_AnalogInput5, /*!< AIN5 selected as analog input. */ + NRF_COMP_INPUT_6 = COMP_PSEL_PSEL_AnalogInput6, /*!< AIN6 selected as analog input. */ + NRF_COMP_INPUT_7 = COMP_PSEL_PSEL_AnalogInput7 /*!< AIN7 selected as analog input. */ +}nrf_comp_input_t; + +/** + * @enum nrf_comp_ref_t + * @brief COMP reference selection. + */ +typedef enum +{ + NRF_COMP_REF_Int1V2 = COMP_REFSEL_REFSEL_Int1V2, /*!< VREF = internal 1.2 V reference (VDD >= 1.7 V). */ + NRF_COMP_REF_Int1V8 = COMP_REFSEL_REFSEL_Int1V8, /*!< VREF = internal 1.8 V reference (VDD >= VREF + 0.2 V). */ + NRF_COMP_REF_Int2V4 = COMP_REFSEL_REFSEL_Int2V4, /*!< VREF = internal 2.4 V reference (VDD >= VREF + 0.2 V). */ + NRF_COMP_REF_VDD = COMP_REFSEL_REFSEL_VDD, /*!< VREF = VDD. */ + NRF_COMP_REF_ARef = COMP_REFSEL_REFSEL_ARef /*!< VREF = AREF (VDD >= VREF >= AREFMIN). */ +}nrf_comp_ref_t; + +/** + * @enum nrf_comp_ext_ref_t + * @brief COMP external analog reference selection. + */ +typedef enum +{ + NRF_COMP_EXT_REF_0 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference0, /*!< Use AIN0 as external analog reference. */ + NRF_COMP_EXT_REF_1 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference1 /*!< Use AIN1 as external analog reference. */ +}nrf_comp_ext_ref_t; + +/** + * @brief COMP THDOWN and THUP values that are used to calculate the threshold voltages VDOWN and VUP. + */ +typedef struct +{ + uint8_t th_down; /*!< THDOWN value. */ + uint8_t th_up; /*!< THUP value. */ +}nrf_comp_th_t; + +/** + * @enum nrf_comp_main_mode_t + * @brief COMP main operation mode. + */ +typedef enum +{ + NRF_COMP_MAIN_MODE_SE = COMP_MODE_MAIN_SE, /*!< Single ended mode. */ + NRF_COMP_MAIN_MODE_Diff = COMP_MODE_MAIN_Diff /*!< Differential mode. */ +}nrf_comp_main_mode_t; + +/** + * @enum nrf_comp_sp_mode_t + * @brief COMP speed and power mode. + */ +typedef enum +{ + NRF_COMP_SP_MODE_Low = COMP_MODE_SP_Low, /*!< Low power mode. */ + NRF_COMP_SP_MODE_Normal = COMP_MODE_SP_Normal, /*!< Normal mode. */ + NRF_COMP_SP_MODE_High = COMP_MODE_SP_High /*!< High speed mode. */ +}nrf_comp_sp_mode_t; + +/** + * @enum nrf_comp_hyst_t + * @brief COMP comparator hysteresis. + */ +typedef enum +{ + NRF_COMP_HYST_NoHyst = COMP_HYST_HYST_NoHyst, /*!< Comparator hysteresis disabled. */ + NRF_COMP_HYST_50mV = COMP_HYST_HYST_Hyst50mV /*!< Comparator hysteresis enabled. */ +}nrf_comp_hyst_t; + +/** + * @brief COMP current source selection on analog input. + */ +typedef enum +{ + NRF_COMP_ISOURCE_Off = COMP_ISOURCE_ISOURCE_Off, /*!< Current source disabled. */ + NRF_COMP_ISOURCE_Ien2uA5 = COMP_ISOURCE_ISOURCE_Ien2mA5, /*!< Current source enabled (+/- 2.5 uA). */ + NRF_COMP_ISOURCE_Ien5uA = COMP_ISOURCE_ISOURCE_Ien5mA, /*!< Current source enabled (+/- 5 uA). */ + NRF_COMP_ISOURCE_Ien10uA = COMP_ISOURCE_ISOURCE_Ien10mA /*!< Current source enabled (+/- 10 uA). */ +}nrf_isource_t; + +/** + * @enum nrf_comp_task_t + * @brief COMP tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_COMP_TASK_START = offsetof(NRF_COMP_Type, TASKS_START), /*!< COMP start sampling task. */ + NRF_COMP_TASK_STOP = offsetof(NRF_COMP_Type, TASKS_STOP), /*!< COMP stop sampling task. */ + NRF_COMP_TASK_SAMPLE = offsetof(NRF_COMP_Type, TASKS_SAMPLE) /*!< Sample comparator value. */ + /*lint -restore*/ +}nrf_comp_task_t; + +/** + * @enum nrf_comp_event_t + * @brief COMP events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_COMP_EVENT_READY = offsetof(NRF_COMP_Type, EVENTS_READY), /*!< COMP is ready and output is valid. */ + NRF_COMP_EVENT_DOWN = offsetof(NRF_COMP_Type, EVENTS_DOWN), /*!< Input voltage crossed the threshold going down. */ + NRF_COMP_EVENT_UP = offsetof(NRF_COMP_Type, EVENTS_UP), /*!< Input voltage crossed the threshold going up. */ + NRF_COMP_EVENT_CROSS = offsetof(NRF_COMP_Type, EVENTS_CROSS) /*!< Input voltage crossed the threshold in any direction. */ + /*lint -restore*/ +}nrf_comp_event_t; + +/** + * @brief COMP reference configuration. + */ +typedef struct +{ + nrf_comp_ref_t reference; /*!< COMP reference selection. */ + nrf_comp_ext_ref_t external; /*!< COMP external analog reference selection. */ +}nrf_comp_ref_conf_t; + + +/** + * @brief Function for enabling the COMP peripheral. + */ +__STATIC_INLINE void nrf_comp_enable(void); + + +/** + * @brief Function for disabling the COMP peripheral. + */ + +__STATIC_INLINE void nrf_comp_disable(void); + +/** + * @brief Function for checking if the COMP peripheral is enabled. + * + * @retval true If the COMP peripheral is enabled. + * @retval false If the COMP peripheral is not enabled. + */ +__STATIC_INLINE bool nrf_comp_enable_check(void); + +/** + * @brief Function for setting the reference source. + * + * @param[in] reference COMP reference selection. + */ +__STATIC_INLINE void nrf_comp_ref_set(nrf_comp_ref_t reference); + + +/** + * @brief Function for setting the external analog reference source. + * + * @param[in] ext_ref COMP external analog reference selection. + */ +__STATIC_INLINE void nrf_comp_ext_ref_set(nrf_comp_ext_ref_t ext_ref); + + +/** + * @brief Function for setting threshold voltages. + * + * @param[in] threshold COMP VDOWN and VUP thresholds. + */ +__STATIC_INLINE void nrf_comp_th_set(nrf_comp_th_t threshold); + + +/** + * @brief Function for setting the main mode. + * + * @param[in] main_mode COMP main operation mode. + */ +__STATIC_INLINE void nrf_comp_main_mode_set(nrf_comp_main_mode_t main_mode); + + +/** + * @brief Function for setting the speed mode. + * + * @param[in] speed_mode COMP speed and power mode. + */ +__STATIC_INLINE void nrf_comp_speed_mode_set(nrf_comp_sp_mode_t speed_mode); + + +/** + * @brief Function for setting the hysteresis. + * + * @param[in] hyst COMP comparator hysteresis. + */ +__STATIC_INLINE void nrf_comp_hysteresis_set(nrf_comp_hyst_t hyst); + + +/** + * @brief Function for setting the current source on the analog input. + * + * @param[in] isource COMP current source selection on analog input. + */ +__STATIC_INLINE void nrf_comp_isource_set(nrf_isource_t isource); + + +/** + * @brief Function for selecting the active input of the COMP. + * + * @param[in] input Input to be selected. + */ +__STATIC_INLINE void nrf_comp_input_select(nrf_comp_input_t input); + + +/** + * @brief Function for getting the last COMP compare result. + * + * @return The last compare result. If 0, then VIN+ < VIN-. If 1, then VIN+ > VIN-. + * + * @note If VIN+ == VIN-, the return value depends on the previous result. + */ +__STATIC_INLINE uint32_t nrf_comp_result_get(void); + + +/** + * @brief Function for enabling interrupts from COMP. + * + * @param[in] comp_int_mask Mask of interrupts to be enabled. + * + * @sa nrf_comp_int_enable_check() + */ +__STATIC_INLINE void nrf_comp_int_enable(uint32_t comp_int_mask); + +/** + * @brief Function for disabling interrupts from COMP. + * + * @param[in] comp_int_mask Mask of interrupts to be disabled. + * + * @sa nrf_comp_int_enable_check() + */ +__STATIC_INLINE void nrf_comp_int_disable(uint32_t comp_int_mask); + + +/** + * @brief Function for getting the enabled interrupts of COMP. + * + * @param[in] comp_int_mask Mask of interrupts to be checked. + * + * @retval true If any interrupts of the specified mask are enabled. + */ +__STATIC_INLINE bool nrf_comp_int_enable_check(uint32_t comp_int_mask); + + + +/** + * @brief Function for getting the address of a specific COMP task register. + * + * @param[in] comp_task COMP task. + * + * @return Address of the specified COMP task. + */ +__STATIC_INLINE uint32_t * nrf_comp_task_address_get(nrf_comp_task_t comp_task); + + +/** + * @brief Function for getting the address of a specific COMP event register. + * + * @param[in] comp_event COMP event. + * + * @return Address of the specified COMP event. + */ +__STATIC_INLINE uint32_t * nrf_comp_event_address_get(nrf_comp_event_t comp_event); + + +/** + * @brief Function for setting COMP shorts. + * + * @param[in] comp_short_mask COMP shorts by mask. + * + */ +__STATIC_INLINE void nrf_comp_shorts_enable(uint32_t comp_short_mask); + + +/** + * @brief Function for clearing COMP shorts by mask. + * + * @param[in] comp_short_mask COMP shorts to be cleared. + * + */ +__STATIC_INLINE void nrf_comp_shorts_disable(uint32_t comp_short_mask); + + +/** + * @brief Function for setting a specific COMP task. + * + * @param[in] comp_task COMP task to be set. + * + */ +__STATIC_INLINE void nrf_comp_task_trigger(nrf_comp_task_t comp_task); + + +/** + * @brief Function for clearing a specific COMP event. + * + * @param[in] comp_event COMP event to be cleared. + * + */ +__STATIC_INLINE void nrf_comp_event_clear(nrf_comp_event_t comp_event); + + +/** + * @brief Function for getting the state of a specific COMP event. + * + * @retval true If the specified COMP event is active. + * + */ +__STATIC_INLINE bool nrf_comp_event_check(nrf_comp_event_t comp_event); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_comp_enable(void) +{ + NRF_COMP->ENABLE = (COMP_ENABLE_ENABLE_Enabled << COMP_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_comp_disable(void) +{ + NRF_COMP->ENABLE = (COMP_ENABLE_ENABLE_Disabled << COMP_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE bool nrf_comp_enable_check(void) +{ + return ((NRF_COMP->ENABLE) & COMP_ENABLE_ENABLE_Enabled); +} + +__STATIC_INLINE void nrf_comp_ref_set(nrf_comp_ref_t reference) +{ + NRF_COMP->REFSEL = (reference << COMP_REFSEL_REFSEL_Pos); +} + +__STATIC_INLINE void nrf_comp_ext_ref_set(nrf_comp_ext_ref_t ext_ref) +{ + NRF_COMP->EXTREFSEL = (ext_ref << COMP_EXTREFSEL_EXTREFSEL_Pos); +} + +__STATIC_INLINE void nrf_comp_th_set(nrf_comp_th_t threshold) +{ + NRF_COMP->TH = + ((threshold.th_down << COMP_TH_THDOWN_Pos) & COMP_TH_THDOWN_Msk) | + ((threshold.th_up << COMP_TH_THUP_Pos) & COMP_TH_THUP_Msk); +} + +__STATIC_INLINE void nrf_comp_main_mode_set(nrf_comp_main_mode_t main_mode) +{ + NRF_COMP->MODE |= (main_mode << COMP_MODE_MAIN_Pos); +} + +__STATIC_INLINE void nrf_comp_speed_mode_set(nrf_comp_sp_mode_t speed_mode) +{ + NRF_COMP->MODE |= (speed_mode << COMP_MODE_SP_Pos); +} + +__STATIC_INLINE void nrf_comp_hysteresis_set(nrf_comp_hyst_t hyst) +{ + NRF_COMP->HYST = (hyst << COMP_HYST_HYST_Pos) & COMP_HYST_HYST_Msk; +} + +__STATIC_INLINE void nrf_comp_isource_set(nrf_isource_t isource) +{ + NRF_COMP->ISOURCE = (isource << COMP_ISOURCE_ISOURCE_Pos) & COMP_ISOURCE_ISOURCE_Msk; +} + +__STATIC_INLINE void nrf_comp_input_select(nrf_comp_input_t input) +{ + NRF_COMP->PSEL = ((uint32_t)input << COMP_PSEL_PSEL_Pos); +} + +__STATIC_INLINE uint32_t nrf_comp_result_get(void) +{ + return (uint32_t)NRF_COMP->RESULT; +} + +__STATIC_INLINE void nrf_comp_int_enable(uint32_t comp_int_mask) +{ + NRF_COMP->INTENSET = comp_int_mask; +} + +__STATIC_INLINE void nrf_comp_int_disable(uint32_t comp_int_mask) +{ + NRF_COMP->INTENCLR = comp_int_mask; +} + +__STATIC_INLINE bool nrf_comp_int_enable_check(uint32_t comp_int_mask) +{ + return (NRF_COMP->INTENSET & comp_int_mask); // when read this register will return the value of INTEN. +} + +__STATIC_INLINE uint32_t * nrf_comp_task_address_get(nrf_comp_task_t comp_task) +{ + return (uint32_t *)((uint8_t *)NRF_COMP + (uint32_t)comp_task); +} + +__STATIC_INLINE uint32_t * nrf_comp_event_address_get(nrf_comp_event_t comp_event) +{ + return (uint32_t *)((uint8_t *)NRF_COMP + (uint32_t)comp_event); +} + +__STATIC_INLINE void nrf_comp_shorts_enable(uint32_t comp_short_mask) +{ + NRF_COMP->SHORTS |= comp_short_mask; +} + +__STATIC_INLINE void nrf_comp_shorts_disable(uint32_t comp_short_mask) +{ + NRF_COMP->SHORTS &= ~comp_short_mask; +} + +__STATIC_INLINE void nrf_comp_task_trigger(nrf_comp_task_t comp_task) +{ + *( (volatile uint32_t *)( (uint8_t *)NRF_COMP + comp_task) ) = 1; +} + +__STATIC_INLINE void nrf_comp_event_clear(nrf_comp_event_t comp_event) +{ + *( (volatile uint32_t *)( (uint8_t *)NRF_COMP + (uint32_t)comp_event) ) = 0; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_COMP + (uint32_t)comp_event)); + (void)dummy; +#endif +} + +__STATIC_INLINE bool nrf_comp_event_check(nrf_comp_event_t comp_event) +{ + return (bool) (*(volatile uint32_t *)( (uint8_t *)NRF_COMP + comp_event)); +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +/** + *@} + **/ + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_COMP_H_ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.c index e66f63f07d..b27ff293f4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.c @@ -35,9 +35,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -/** +/** * @file * @brief Implementation of AES ECB driver */ @@ -48,11 +47,11 @@ #include #include #include -#include "nrf.h" +#include "nrf.h" #include "nrf_ecb.h" static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. -static uint8_t* ecb_key; ///< Key: Starts at ecb_data +static uint8_t* ecb_key; ///< Key: Starts at ecb_data static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. @@ -70,22 +69,22 @@ bool nrf_ecb_init(void) bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) { uint32_t counter = 0x1000000; - if(src_buf != ecb_cleartext) + if (src_buf != ecb_cleartext) { memcpy(ecb_cleartext,src_buf,16); } NRF_ECB->EVENTS_ENDECB = 0; NRF_ECB->TASKS_STARTECB = 1; - while(NRF_ECB->EVENTS_ENDECB == 0) + while (NRF_ECB->EVENTS_ENDECB == 0) { counter--; - if(counter == 0) + if (counter == 0) { return false; } } NRF_ECB->EVENTS_ENDECB = 0; - if(dest_buf != ecb_ciphertext) + if (dest_buf != ecb_ciphertext) { memcpy(dest_buf,ecb_ciphertext,16); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.h index 7b4cbf1e4b..b82ba4b226 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ecb.h @@ -36,7 +36,6 @@ * */ - /** * @file * @brief ECB driver API. @@ -51,12 +50,16 @@ * @ingroup nrf_drivers * @brief Driver for the AES Electronic Code Book (ECB) peripheral. * - * To encrypt and decrypt data, the peripheral must first be powered on + * To encrypt data, the peripheral must first be powered on * using @ref nrf_ecb_init. Next, the key must be set using @ref nrf_ecb_set_key. */ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Function for initializing and powering on the ECB peripheral. * @@ -67,13 +70,13 @@ bool nrf_ecb_init(void); /** - * @brief Function for encrypting and decrypting 16-byte data using current key. + * @brief Function for encrypting 16-byte data using current key. * - * This function avoids unnecessary copying of data if the parameters point to the + * This function avoids unnecessary copying of data if the parameters point to the * correct locations in the ECB data structure. * - * @param dst Result of encryption/decryption. 16 bytes will be written. - * @param src Source with 16-byte data to be encrypted/decrypted. + * @param dst Result of encryption, 16 bytes will be written. + * @param src Source with 16-byte data to be encrypted. * * @retval true If the encryption operation completed. * @retval false If the encryption operation did not complete. @@ -81,12 +84,17 @@ bool nrf_ecb_init(void); bool nrf_ecb_crypt(uint8_t * dst, const uint8_t * src); /** - * @brief Function for setting the key to be used for encryption and decryption. + * @brief Function for setting the key to be used for encryption. * * @param key Pointer to the key. 16 bytes will be read. */ void nrf_ecb_set_key(const uint8_t * key); + +#ifdef __cplusplus +} +#endif + #endif // NRF_ECB_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_egu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_egu.h new file mode 100644 index 0000000000..0d0d0a2abb --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_egu.h @@ -0,0 +1,350 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_EGU_H__ +#define NRF_EGU_H__ + +/** +* @defgroup nrf_egu EGU (Event Generator Unit) abstraction +* @{ +* @ingroup nrf_drivers +* @brief @tagAPI52 EGU (Event Generator Unit) module functions. +* +*/ + +#include +#include +#include +#include "nrf_assert.h" +#include "nrf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @enum nrf_egu_task_t + * @brief EGU tasks. + */ +typedef enum +{ + /*lint -save -e30 -esym(628,__INTADDR__)*/ + NRF_EGU_TASK_TRIGGER0 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[0]), /**< Trigger 0 for triggering the corresponding TRIGGERED[0] event. */ + NRF_EGU_TASK_TRIGGER1 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[1]), /**< Trigger 1 for triggering the corresponding TRIGGERED[1] event. */ + NRF_EGU_TASK_TRIGGER2 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[2]), /**< Trigger 2 for triggering the corresponding TRIGGERED[2] event. */ + NRF_EGU_TASK_TRIGGER3 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[3]), /**< Trigger 3 for triggering the corresponding TRIGGERED[3] event. */ + NRF_EGU_TASK_TRIGGER4 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[4]), /**< Trigger 4 for triggering the corresponding TRIGGERED[4] event. */ + NRF_EGU_TASK_TRIGGER5 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[5]), /**< Trigger 5 for triggering the corresponding TRIGGERED[5] event. */ + NRF_EGU_TASK_TRIGGER6 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[6]), /**< Trigger 6 for triggering the corresponding TRIGGERED[6] event. */ + NRF_EGU_TASK_TRIGGER7 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[7]), /**< Trigger 7 for triggering the corresponding TRIGGERED[7] event. */ + NRF_EGU_TASK_TRIGGER8 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[8]), /**< Trigger 8 for triggering the corresponding TRIGGERED[8] event. */ + NRF_EGU_TASK_TRIGGER9 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[9]), /**< Trigger 9 for triggering the corresponding TRIGGERED[9] event. */ + NRF_EGU_TASK_TRIGGER10 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[10]), /**< Trigger 10 for triggering the corresponding TRIGGERED[10] event. */ + NRF_EGU_TASK_TRIGGER11 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[11]), /**< Trigger 11 for triggering the corresponding TRIGGERED[11] event. */ + NRF_EGU_TASK_TRIGGER12 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[12]), /**< Trigger 12 for triggering the corresponding TRIGGERED[12] event. */ + NRF_EGU_TASK_TRIGGER13 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[13]), /**< Trigger 13 for triggering the corresponding TRIGGERED[13] event. */ + NRF_EGU_TASK_TRIGGER14 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[14]), /**< Trigger 14 for triggering the corresponding TRIGGERED[14] event. */ + NRF_EGU_TASK_TRIGGER15 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[15]) /**< Trigger 15 for triggering the corresponding TRIGGERED[15] event. */ + /*lint -restore*/ +} nrf_egu_task_t; + + +/** + * @enum nrf_egu_event_t + * @brief EGU events. + */ +typedef enum +{ + /*lint -save -e30 -esym(628,__INTADDR__)*/ + NRF_EGU_EVENT_TRIGGERED0 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[0]), /**< Event number 0 generated by triggering the corresponding TRIGGER[0] task. */ + NRF_EGU_EVENT_TRIGGERED1 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[1]), /**< Event number 1 generated by triggering the corresponding TRIGGER[1] task. */ + NRF_EGU_EVENT_TRIGGERED2 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[2]), /**< Event number 2 generated by triggering the corresponding TRIGGER[2] task. */ + NRF_EGU_EVENT_TRIGGERED3 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[3]), /**< Event number 3 generated by triggering the corresponding TRIGGER[3] task. */ + NRF_EGU_EVENT_TRIGGERED4 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[4]), /**< Event number 4 generated by triggering the corresponding TRIGGER[4] task. */ + NRF_EGU_EVENT_TRIGGERED5 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[5]), /**< Event number 5 generated by triggering the corresponding TRIGGER[5] task. */ + NRF_EGU_EVENT_TRIGGERED6 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[6]), /**< Event number 6 generated by triggering the corresponding TRIGGER[6] task. */ + NRF_EGU_EVENT_TRIGGERED7 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[7]), /**< Event number 7 generated by triggering the corresponding TRIGGER[7] task. */ + NRF_EGU_EVENT_TRIGGERED8 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[8]), /**< Event number 8 generated by triggering the corresponding TRIGGER[8] task. */ + NRF_EGU_EVENT_TRIGGERED9 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[9]), /**< Event number 9 generated by triggering the corresponding TRIGGER[9] task. */ + NRF_EGU_EVENT_TRIGGERED10 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[10]), /**< Event number 10 generated by triggering the corresponding TRIGGER[10] task. */ + NRF_EGU_EVENT_TRIGGERED11 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[11]), /**< Event number 11 generated by triggering the corresponding TRIGGER[11] task. */ + NRF_EGU_EVENT_TRIGGERED12 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[12]), /**< Event number 12 generated by triggering the corresponding TRIGGER[12] task. */ + NRF_EGU_EVENT_TRIGGERED13 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[13]), /**< Event number 13 generated by triggering the corresponding TRIGGER[13] task. */ + NRF_EGU_EVENT_TRIGGERED14 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[14]), /**< Event number 14 generated by triggering the corresponding TRIGGER[14] task. */ + NRF_EGU_EVENT_TRIGGERED15 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[15]) /**< Event number 15 generated by triggering the corresponding TRIGGER[15] task. */ + /*lint -restore*/ +} nrf_egu_event_t; + + +/** + * @enum nrf_egu_int_mask_t + * @brief EGU interrupts. + */ +typedef enum +{ + NRF_EGU_INT_TRIGGERED0 = EGU_INTENSET_TRIGGERED0_Msk, /**< Interrupt on EVENTS_TRIGGERED[0] event. */ + NRF_EGU_INT_TRIGGERED1 = EGU_INTENSET_TRIGGERED1_Msk, /**< Interrupt on EVENTS_TRIGGERED[1] event. */ + NRF_EGU_INT_TRIGGERED2 = EGU_INTENSET_TRIGGERED2_Msk, /**< Interrupt on EVENTS_TRIGGERED[2] event. */ + NRF_EGU_INT_TRIGGERED3 = EGU_INTENSET_TRIGGERED3_Msk, /**< Interrupt on EVENTS_TRIGGERED[3] event. */ + NRF_EGU_INT_TRIGGERED4 = EGU_INTENSET_TRIGGERED4_Msk, /**< Interrupt on EVENTS_TRIGGERED[4] event. */ + NRF_EGU_INT_TRIGGERED5 = EGU_INTENSET_TRIGGERED5_Msk, /**< Interrupt on EVENTS_TRIGGERED[5] event. */ + NRF_EGU_INT_TRIGGERED6 = EGU_INTENSET_TRIGGERED6_Msk, /**< Interrupt on EVENTS_TRIGGERED[6] event. */ + NRF_EGU_INT_TRIGGERED7 = EGU_INTENSET_TRIGGERED7_Msk, /**< Interrupt on EVENTS_TRIGGERED[7] event. */ + NRF_EGU_INT_TRIGGERED8 = EGU_INTENSET_TRIGGERED8_Msk, /**< Interrupt on EVENTS_TRIGGERED[8] event. */ + NRF_EGU_INT_TRIGGERED9 = EGU_INTENSET_TRIGGERED9_Msk, /**< Interrupt on EVENTS_TRIGGERED[9] event. */ + NRF_EGU_INT_TRIGGERED10 = EGU_INTENSET_TRIGGERED10_Msk, /**< Interrupt on EVENTS_TRIGGERED[10] event. */ + NRF_EGU_INT_TRIGGERED11 = EGU_INTENSET_TRIGGERED11_Msk, /**< Interrupt on EVENTS_TRIGGERED[11] event. */ + NRF_EGU_INT_TRIGGERED12 = EGU_INTENSET_TRIGGERED12_Msk, /**< Interrupt on EVENTS_TRIGGERED[12] event. */ + NRF_EGU_INT_TRIGGERED13 = EGU_INTENSET_TRIGGERED13_Msk, /**< Interrupt on EVENTS_TRIGGERED[13] event. */ + NRF_EGU_INT_TRIGGERED14 = EGU_INTENSET_TRIGGERED14_Msk, /**< Interrupt on EVENTS_TRIGGERED[14] event. */ + NRF_EGU_INT_TRIGGERED15 = EGU_INTENSET_TRIGGERED15_Msk, /**< Interrupt on EVENTS_TRIGGERED[15] event. */ + NRF_EGU_INT_ALL = 0xFFFFuL +} nrf_egu_int_mask_t; + +/**@brief Function for getting max channel number of given EGU. + * + * @param NRF_EGUx EGU instance. + * + * @returns number of available channels. + */ +__STATIC_INLINE uint32_t nrf_egu_channel_count(NRF_EGU_Type * NRF_EGUx) +{ + if (NRF_EGUx == NRF_EGU0){ + return EGU0_CH_NUM; + } + if (NRF_EGUx == NRF_EGU1){ + return EGU1_CH_NUM; + } + if (NRF_EGUx == NRF_EGU2){ + return EGU2_CH_NUM; + } + if (NRF_EGUx == NRF_EGU3){ + return EGU3_CH_NUM; + } + if (NRF_EGUx == NRF_EGU4){ + return EGU4_CH_NUM; + } + if (NRF_EGUx == NRF_EGU5){ + return EGU5_CH_NUM; + } + return 0; +} + +/** + * @brief Function for triggering a specific EGU task. + * + * @param NRF_EGUx EGU instance. + * @param egu_task EGU task. + */ +__STATIC_INLINE void nrf_egu_task_trigger(NRF_EGU_Type * NRF_EGUx, nrf_egu_task_t egu_task) +{ + *((volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_task)) = 0x1UL; +} + + +/** + * @brief Function for returning the address of a specific EGU task register. + * + * @param NRF_EGUx EGU instance. + * @param egu_task EGU task. + */ +__STATIC_INLINE uint32_t * nrf_egu_task_address_get(NRF_EGU_Type * NRF_EGUx, + nrf_egu_task_t egu_task) +{ + return (uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_task); +} + + +/** + * @brief Function for returning the address of a specific EGU TRIGGER task register. + * + * @param NRF_EGUx EGU instance. + * @param channel Channel number. + */ +__STATIC_INLINE uint32_t * nrf_egu_task_trigger_addres_get(NRF_EGU_Type * NRF_EGUx, + uint8_t channel) +{ + ASSERT(channel < nrf_egu_channel_count(NRF_EGUx)); + return (uint32_t*)&NRF_EGUx->TASKS_TRIGGER[channel]; +} + + +/** + * @brief Function for returning the specific EGU TRIGGER task. + * + * @param NRF_EGUx EGU instance. + * @param channel Channel number. + */ +__STATIC_INLINE nrf_egu_task_t nrf_egu_task_trigger_get(NRF_EGU_Type * NRF_EGUx, uint8_t channel) +{ + ASSERT(channel < nrf_egu_channel_count(NRF_EGUx)); + return (nrf_egu_task_t)((uint32_t) NRF_EGU_TASK_TRIGGER0 + (channel * sizeof(uint32_t))); +} + + +/** + * @brief Function for returning the state of a specific EGU event. + * + * @param NRF_EGUx EGU instance. + * @param egu_event EGU event to check. + */ +__STATIC_INLINE bool nrf_egu_event_check(NRF_EGU_Type * NRF_EGUx, + nrf_egu_event_t egu_event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event); +} + + +/** + * @brief Function for clearing a specific EGU event. + * + * @param NRF_EGUx EGU instance. + * @param egu_event EGU event to clear. + */ +__STATIC_INLINE void nrf_egu_event_clear(NRF_EGU_Type * NRF_EGUx, + nrf_egu_event_t egu_event) +{ + *((volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event)); + (void)dummy; +#endif +} + + +/** + * @brief Function for returning the address of a specific EGU event register. + * + * @param NRF_EGUx EGU instance. + * @param egu_event EGU event. + */ +__STATIC_INLINE uint32_t * nrf_egu_event_address_get(NRF_EGU_Type * NRF_EGUx, + nrf_egu_event_t egu_event) +{ + return (uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event); +} + + +/** + * @brief Function for returning the address of a specific EGU TRIGGERED event register. + * + * @param NRF_EGUx EGU instance. + * @param channel Channel number. + */ +__STATIC_INLINE uint32_t * nrf_egu_event_triggered_addres_get(NRF_EGU_Type * NRF_EGUx, + uint8_t channel) +{ + ASSERT(channel < nrf_egu_channel_count(NRF_EGUx)); + return (uint32_t*)&NRF_EGUx->EVENTS_TRIGGERED[channel]; +} + + +/** + * @brief Function for returning the specific EGU TRIGGERED event. + * + * @param NRF_EGUx EGU instance. + * @param channel Channel number. + */ +__STATIC_INLINE nrf_egu_event_t nrf_egu_event_triggered_get(NRF_EGU_Type * NRF_EGUx, + uint8_t channel) +{ + ASSERT(channel < nrf_egu_channel_count(NRF_EGUx)); + return (nrf_egu_event_t)((uint32_t) NRF_EGU_EVENT_TRIGGERED0 + (channel * sizeof(uint32_t))); +} + + +/** + * @brief Function for enabling one or more specific EGU interrupts. + * + * @param NRF_EGUx EGU instance. + * @param egu_int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_egu_int_enable(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask) +{ + NRF_EGUx->INTENSET = egu_int_mask; +} + + +/** + * @brief Function for retrieving the state of one or more EGU interrupts. + * + * @param NRF_EGUx EGU instance. + * @param egu_int_mask Interrupts to check. + * + * @retval true If all of the specified interrupts are enabled. + * @retval false If at least one of the specified interrupts is disabled. + */ +__STATIC_INLINE bool nrf_egu_int_enable_check(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask) +{ + return (bool)(NRF_EGUx->INTENSET & egu_int_mask); +} + + +/** + * @brief Function for disabling one or more specific EGU interrupts. + * + * @param NRF_EGUx EGU instance. + * @param egu_int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_egu_int_disable(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask) +{ + NRF_EGUx->INTENCLR = egu_int_mask; +} + +/** + * @brief Function for retrieving one or more specific EGU interrupts. + * + * @param NRF_EGUx EGU instance. + * @param channel Channel number. + * + * @returns EGU interrupt mask. + */ +__STATIC_INLINE nrf_egu_int_mask_t nrf_egu_int_get(NRF_EGU_Type * NRF_EGUx, uint8_t channel) +{ + ASSERT(channel < nrf_egu_channel_count(NRF_EGUx)); + return (nrf_egu_int_mask_t)((uint32_t) (EGU_INTENSET_TRIGGERED0_Msk << channel)); +} + +/** @} */ + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpio.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpio.h index 3127568fb5..220ab207a4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpio.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpio.h @@ -35,89 +35,83 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - #ifndef NRF_GPIO_H__ #define NRF_GPIO_H__ #include "nrf.h" +#include "nrf_peripherals.h" +#include "nrf_assert.h" #include +#include + +#ifdef __cplusplus +extern "C" { +#endif /** * @defgroup nrf_gpio GPIO abstraction * @{ * @ingroup nrf_drivers * @brief GPIO pin abstraction and port abstraction for reading and writing byte-wise to GPIO ports. - * - * Here, the GPIO ports are defined as follows: - * - Port 0 -> pin 0-7 - * - Port 1 -> pin 8-15 - * - Port 2 -> pin 16-23 - * - Port 3 -> pin 24-31 */ -#define NUMBER_OF_PINS 32 +#if (GPIO_COUNT == 1) +#define NUMBER_OF_PINS (P0_PIN_NUM) +#define GPIO_REG_LIST {NRF_GPIO} +#elif (GPIO_COUNT == 2) +#define NUMBER_OF_PINS (P0_PIN_NUM + P1_PIN_NUM) +#define GPIO_REG_LIST {NRF_P0, NRF_P1} +#else +#error "Not supported." +#endif + /** - * @brief Enumerator used for selecting between port 0 - 3. + * @brief Macro for mapping port and pin numbers to values understandable for nrf_gpio functions. */ -typedef enum -{ - NRF_GPIO_PORT_SELECT_PORT0 = 0, ///< Port 0 (GPIO pin 0-7) - NRF_GPIO_PORT_SELECT_PORT1, ///< Port 1 (GPIO pin 8-15) - NRF_GPIO_PORT_SELECT_PORT2, ///< Port 2 (GPIO pin 16-23) - NRF_GPIO_PORT_SELECT_PORT3, ///< Port 3 (GPIO pin 24-31) -} nrf_gpio_port_select_t; - -/** - * @brief Enumerator used for setting the direction of a GPIO port. - */ -typedef enum -{ - NRF_GPIO_PORT_DIR_OUTPUT, ///< Output - NRF_GPIO_PORT_DIR_INPUT ///< Input -} nrf_gpio_port_dir_t; +#define NRF_GPIO_PIN_MAP(port, pin) ((port << 5) | (pin & 0x1F)) /** * @brief Pin direction definitions. */ typedef enum { - NRF_GPIO_PIN_DIR_INPUT = GPIO_PIN_CNF_DIR_Input, ///< Input - NRF_GPIO_PIN_DIR_OUTPUT = GPIO_PIN_CNF_DIR_Output ///< Output + NRF_GPIO_PIN_DIR_INPUT = GPIO_PIN_CNF_DIR_Input, ///< Input. + NRF_GPIO_PIN_DIR_OUTPUT = GPIO_PIN_CNF_DIR_Output ///< Output. } nrf_gpio_pin_dir_t; /** - * @brief Connection of input buffer + * @brief Connection of input buffer. */ typedef enum { - NRF_GPIO_PIN_INPUT_CONNECT = GPIO_PIN_CNF_INPUT_Connect, ///< Connect input buffer - NRF_GPIO_PIN_INPUT_DISCONNECT = GPIO_PIN_CNF_INPUT_Disconnect ///< Disconnect input buffer + NRF_GPIO_PIN_INPUT_CONNECT = GPIO_PIN_CNF_INPUT_Connect, ///< Connect input buffer. + NRF_GPIO_PIN_INPUT_DISCONNECT = GPIO_PIN_CNF_INPUT_Disconnect ///< Disconnect input buffer. } nrf_gpio_pin_input_t; /** - * @brief Enumerator used for selecting the pin to be pulled down or up at the time of pin configuration + * @brief Enumerator used for selecting the pin to be pulled down or up at the time of pin configuration. */ typedef enum { - NRF_GPIO_PIN_NOPULL = GPIO_PIN_CNF_PULL_Disabled, ///< Pin pullup resistor disabled - NRF_GPIO_PIN_PULLDOWN = GPIO_PIN_CNF_PULL_Pulldown, ///< Pin pulldown resistor enabled - NRF_GPIO_PIN_PULLUP = GPIO_PIN_CNF_PULL_Pullup, ///< Pin pullup resistor enabled + NRF_GPIO_PIN_NOPULL = GPIO_PIN_CNF_PULL_Disabled, ///< Pin pull-up resistor disabled. + NRF_GPIO_PIN_PULLDOWN = GPIO_PIN_CNF_PULL_Pulldown, ///< Pin pull-down resistor enabled. + NRF_GPIO_PIN_PULLUP = GPIO_PIN_CNF_PULL_Pullup, ///< Pin pull-up resistor enabled. } nrf_gpio_pin_pull_t; /** - * @brief Enumerator used for selecting output drive mode + * @brief Enumerator used for selecting output drive mode. */ typedef enum { - NRF_GPIO_PIN_S0S1 = GPIO_PIN_CNF_DRIVE_S0S1, ///< !< Standard '0', standard '1' - NRF_GPIO_PIN_H0S1 = GPIO_PIN_CNF_DRIVE_H0S1, ///< !< High drive '0', standard '1' - NRF_GPIO_PIN_S0H1 = GPIO_PIN_CNF_DRIVE_S0H1, ///< !< Standard '0', high drive '1' - NRF_GPIO_PIN_H0H1 = GPIO_PIN_CNF_DRIVE_H0H1, ///< !< High drive '0', high 'drive '1'' - NRF_GPIO_PIN_D0S1 = GPIO_PIN_CNF_DRIVE_D0S1, ///< !< Disconnect '0' standard '1' - NRF_GPIO_PIN_D0H1 = GPIO_PIN_CNF_DRIVE_D0H1, ///< !< Disconnect '0', high drive '1' - NRF_GPIO_PIN_S0D1 = GPIO_PIN_CNF_DRIVE_S0D1, ///< !< Standard '0'. disconnect '1' - NRF_GPIO_PIN_H0D1 = GPIO_PIN_CNF_DRIVE_H0D1, ///< !< High drive '0', disconnect '1' + NRF_GPIO_PIN_S0S1 = GPIO_PIN_CNF_DRIVE_S0S1, ///< !< Standard '0', standard '1'. + NRF_GPIO_PIN_H0S1 = GPIO_PIN_CNF_DRIVE_H0S1, ///< !< High-drive '0', standard '1'. + NRF_GPIO_PIN_S0H1 = GPIO_PIN_CNF_DRIVE_S0H1, ///< !< Standard '0', high-drive '1'. + NRF_GPIO_PIN_H0H1 = GPIO_PIN_CNF_DRIVE_H0H1, ///< !< High drive '0', high-drive '1'. + NRF_GPIO_PIN_D0S1 = GPIO_PIN_CNF_DRIVE_D0S1, ///< !< Disconnect '0' standard '1'. + NRF_GPIO_PIN_D0H1 = GPIO_PIN_CNF_DRIVE_D0H1, ///< !< Disconnect '0', high-drive '1'. + NRF_GPIO_PIN_S0D1 = GPIO_PIN_CNF_DRIVE_S0D1, ///< !< Standard '0', disconnect '1'. + NRF_GPIO_PIN_H0D1 = GPIO_PIN_CNF_DRIVE_H0D1, ///< !< High-drive '0', disconnect '1'. } nrf_gpio_pin_drive_t; /** @@ -125,92 +119,96 @@ typedef enum */ typedef enum { - NRF_GPIO_PIN_NOSENSE = GPIO_PIN_CNF_SENSE_Disabled, ///< Pin sense level disabled. - NRF_GPIO_PIN_SENSE_LOW = GPIO_PIN_CNF_SENSE_Low, ///< Pin sense low level. - NRF_GPIO_PIN_SENSE_HIGH = GPIO_PIN_CNF_SENSE_High, ///< Pin sense high level. + NRF_GPIO_PIN_NOSENSE = GPIO_PIN_CNF_SENSE_Disabled, ///< Pin sense level disabled. + NRF_GPIO_PIN_SENSE_LOW = GPIO_PIN_CNF_SENSE_Low, ///< Pin sense low level. + NRF_GPIO_PIN_SENSE_HIGH = GPIO_PIN_CNF_SENSE_High, ///< Pin sense high level. } nrf_gpio_pin_sense_t; +#if (__LINT__ != 1) + /** - * @brief Function for configuring the GPIO pin range as outputs with normal drive strength. + * @brief Function for configuring the GPIO pin range as output pins with normal drive strength. * This function can be used to configure pin range as simple output with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). * - * @param pin_range_start specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) + * @param pin_range_start Specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30). * - * @param pin_range_end specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) + * @param pin_range_end Specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30). * - * @note For configuring only one pin as output use @ref nrf_gpio_cfg_output - * Sense capability on the pin is disabled, and input is disconnected from the buffer as the pins are configured as output. + * @note For configuring only one pin as output, use @ref nrf_gpio_cfg_output. + * Sense capability on the pin is disabled and input is disconnected from the buffer as the pins are configured as output. */ __STATIC_INLINE void nrf_gpio_range_cfg_output(uint32_t pin_range_start, uint32_t pin_range_end); /** - * @brief Function for configuring the GPIO pin range as inputs with given initial value set, hiding inner details. + * @brief Function for configuring the GPIO pin range as input pins with given initial value set, hiding inner details. * This function can be used to configure pin range as simple input. * - * @param pin_range_start specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) + * @param pin_range_start Specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30). * - * @param pin_range_end specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) + * @param pin_range_end Specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30). * - * @param pull_config State of the pin range pull resistor (no pull, pulled down or pulled high) + * @param pull_config State of the pin range pull resistor (no pull, pulled down, or pulled high). * - * @note For configuring only one pin as input use @ref nrf_gpio_cfg_input - * Sense capability on the pin is disabled, and input is connected to buffer so that the GPIO->IN register is readable + * @note For configuring only one pin as input, use @ref nrf_gpio_cfg_input. + * Sense capability on the pin is disabled and input is connected to buffer so that the GPIO->IN register is readable. */ -__STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, uint32_t pin_range_end, nrf_gpio_pin_pull_t pull_config); +__STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, + uint32_t pin_range_end, + nrf_gpio_pin_pull_t pull_config); /** - * @brief Pin configuration function + * @brief Pin configuration function. * * The main pin configuration function. * This function allows to set any aspect in PIN_CNF register. - * @param pin_number Specifies the pin number (allowed values 0-31). - * @param dir Pin direction - * @param input Connect or disconnect input buffer - * @param pull Pull configuration - * @param drive Drive configuration - * @param sense Pin sensing mechanism + * @param pin_number Specifies the pin number. + * @param dir Pin direction. + * @param input Connect or disconnect the input buffer. + * @param pull Pull configuration. + * @param drive Drive configuration. + * @param sense Pin sensing mechanism. */ __STATIC_INLINE void nrf_gpio_cfg( - uint32_t pin_number, - nrf_gpio_pin_dir_t dir, - nrf_gpio_pin_input_t input, - nrf_gpio_pin_pull_t pull, - nrf_gpio_pin_drive_t drive, - nrf_gpio_pin_sense_t sense); + uint32_t pin_number, + nrf_gpio_pin_dir_t dir, + nrf_gpio_pin_input_t input, + nrf_gpio_pin_pull_t pull, + nrf_gpio_pin_drive_t drive, + nrf_gpio_pin_sense_t sense); /** - * @brief Function for configuring the given GPIO pin number as output with given initial value set, hiding inner details. - * This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). + * @brief Function for configuring the given GPIO pin number as output, hiding inner details. + * This function can be used to configure a pin as simple output with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). * - * @param pin_number specifies the pin number (allowed values 0-31) + * @param pin_number Specifies the pin number. * - * @note Sense capability on the pin is disabled, and input is disconnected from the buffer as the pins are configured as output. + * @note Sense capability on the pin is disabled and input is disconnected from the buffer as the pins are configured as output. */ __STATIC_INLINE void nrf_gpio_cfg_output(uint32_t pin_number); /** - * @brief Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. - * This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). + * @brief Function for configuring the given GPIO pin number as input, hiding inner details. + * This function can be used to configure a pin as simple input. * - * @param pin_number Specifies the pin number (allowed values 0-30). - * @param pull_config State of the pin range pull resistor (no pull, pulled down or pulled high). + * @param pin_number Specifies the pin number. + * @param pull_config State of the pin range pull resistor (no pull, pulled down, or pulled high). * - * @note Sense capability on the pin is disabled, and input is connected to buffer so that the GPIO->IN register is readable + * @note Sense capability on the pin is disabled and input is connected to buffer so that the GPIO->IN register is readable. */ __STATIC_INLINE void nrf_gpio_cfg_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config); /** - * @brief Function for reseting pin configuration to its default state. + * @brief Function for resetting pin configuration to its default state. * - * @param pin_number Specifies the pin number (allowed values 0-31). + * @param pin_number Specifies the pin number. */ __STATIC_INLINE void nrf_gpio_cfg_default(uint32_t pin_number); /** * @brief Function for configuring the given GPIO pin number as a watcher. Only input is connected. * - * @param pin_number Specifies the pin number (allowed values 0-31). + * @param pin_number Specifies the pin number. * */ __STATIC_INLINE void nrf_gpio_cfg_watcher(uint32_t pin_number); @@ -218,26 +216,28 @@ __STATIC_INLINE void nrf_gpio_cfg_watcher(uint32_t pin_number); /** * @brief Function for disconnecting input for the given GPIO. * - * @param pin_number Specifies the pin number (allowed values 0-31). + * @param pin_number Specifies the pin number. * */ __STATIC_INLINE void nrf_gpio_input_disconnect(uint32_t pin_number); /** - * @brief Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. - * This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). - * Sense capability on the pin is configurable, and input is connected to buffer so that the GPIO->IN register is readable. + * @brief Function for configuring the given GPIO pin number as input, hiding inner details. + * This function can be used to configure pin range as simple input. + * Sense capability on the pin is configurable and input is connected to buffer so that the GPIO->IN register is readable. * - * @param pin_number Specifies the pin number (allowed values 0-30). - * @param pull_config State of the pin pull resistor (no pull, pulled down or pulled high). - * @param sense_config Sense level of the pin (no sense, sense low or sense high). + * @param pin_number Specifies the pin number. + * @param pull_config State of the pin pull resistor (no pull, pulled down, or pulled high). + * @param sense_config Sense level of the pin (no sense, sense low, or sense high). */ -__STATIC_INLINE void nrf_gpio_cfg_sense_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config, nrf_gpio_pin_sense_t sense_config); +__STATIC_INLINE void nrf_gpio_cfg_sense_input(uint32_t pin_number, + nrf_gpio_pin_pull_t pull_config, + nrf_gpio_pin_sense_t sense_config); /** * @brief Function for configuring sense level for the given GPIO. * - * @param pin_number Specifies the pin number of gpio pin numbers to be configured (allowed values 0-30). + * @param pin_number Specifies the pin number. * @param sense_config Sense configuration. * */ @@ -246,85 +246,52 @@ __STATIC_INLINE void nrf_gpio_cfg_sense_set(uint32_t pin_number, nrf_gpio_pin_se /** * @brief Function for setting the direction for a GPIO pin. * - * @param pin_number specifies the pin number (0-31) for which to - * set the direction. + * @param pin_number Specifies the pin number for which to set the direction. * - * @param direction specifies the direction + * @param direction Specifies the direction. */ __STATIC_INLINE void nrf_gpio_pin_dir_set(uint32_t pin_number, nrf_gpio_pin_dir_t direction); /** * @brief Function for setting a GPIO pin. * - * Note that the pin must be configured as an output for this - * function to have any effect. + * Note that the pin must be configured as an output for this function to have any effect. * - * @param pin_number Specifies the pin number (0-31) to set. + * @param pin_number Specifies the pin number to set. */ __STATIC_INLINE void nrf_gpio_pin_set(uint32_t pin_number); -/** - * @brief Function for setting GPIO pins. - * - * Note that the pins must be configured as outputs for this - * function to have any effect. - * - * @param pin_mask Specifies the pins to set. - */ -__STATIC_INLINE void nrf_gpio_pins_set(uint32_t pin_mask); - /** * @brief Function for clearing a GPIO pin. * * Note that the pin must be configured as an output for this * function to have any effect. * - * @param pin_number Specifies the pin number (0-31) to clear. + * @param pin_number Specifies the pin number to clear. */ __STATIC_INLINE void nrf_gpio_pin_clear(uint32_t pin_number); -/** - * @brief Function for clearing GPIO pins. - * - * Note that the pins must be configured as outputs for this - * function to have any effect. - * - * @param pin_mask Specifies the pins to clear. - */ -__STATIC_INLINE void nrf_gpio_pins_clear(uint32_t pin_mask); - /** * @brief Function for toggling a GPIO pin. * * Note that the pin must be configured as an output for this * function to have any effect. * - * @param pin_number Specifies the pin number (0-31) to toggle. + * @param pin_number Specifies the pin number to toggle. */ __STATIC_INLINE void nrf_gpio_pin_toggle(uint32_t pin_number); -/** - * @brief Function for toggling GPIO pins. - * - * Note that the pins must be configured as outputs for this - * function to have any effect. - * - * @param pin_mask Specifies the pins to toggle. - */ -__STATIC_INLINE void nrf_gpio_pins_toggle(uint32_t pin_mask); - /** * @brief Function for writing a value to a GPIO pin. * * Note that the pin must be configured as an output for this * function to have any effect. * - * @param pin_number specifies the pin number (0-31) to - * write. + * @param pin_number Specifies the pin number to write. * - * @param value specifies the value to be written to the pin. - * @arg 0 clears the pin - * @arg >=1 sets the pin. + * @param value Specifies the value to be written to the pin. + * @arg 0 Clears the pin. + * @arg >=1 Sets the pin. */ __STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value); @@ -334,123 +301,182 @@ __STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value); * Note that the pin must have input connected for the value * returned from this function to be valid. * - * @param pin_number specifies the pin number (0-31) to - * read. + * @param pin_number Specifies the pin number to read. * - * @return - * @retval 0 if the pin input level is low. - * @retval 1 if the pin input level is high. - * @retval > 1 should never occur. + * @return 0 if the pin input level is low. Positive value if the pin is high. */ __STATIC_INLINE uint32_t nrf_gpio_pin_read(uint32_t pin_number); /** - * @brief Function for reading the input level of all GPIO pins. + * @brief Function for reading the output level of a GPIO pin. * - * Note that the pin must have input connected for the value - * returned from this function to be valid. + * @param pin_number Specifies the pin number to read. * - * @retval Status of input of all pins + * @return 0 if the pin output level is low. Positive value if pin output is high. */ -__STATIC_INLINE uint32_t nrf_gpio_pins_read(void); +__STATIC_INLINE uint32_t nrf_gpio_pin_out_read(uint32_t pin_number); /** * @brief Function for reading the sense configuration of a GPIO pin. * - * @param pin_number specifies the pin number (0-31) to - * read. + * @param pin_number Specifies the pin number to read. * - * @retval Sense configuration + * @retval Sense configuration. */ __STATIC_INLINE nrf_gpio_pin_sense_t nrf_gpio_pin_sense_get(uint32_t pin_number); /** - * @brief Generic function for writing a single byte of a 32 bit word at a given - * address. + * @brief Function for setting output direction on selected pins on a given port. * - * This function should not be called from outside the nrf_gpio - * abstraction layer. + * @param p_reg Pointer to the peripheral registers structure. + * @param out_mask Mask specifying the pins to set as output. * - * @param word_address is the address of the word to be written. - * - * @param byte_no is the word byte number (0-3) to be written. - * - * @param value is the value to be written to byte "byte_no" of word - * at address "word_address" */ -__STATIC_INLINE void nrf_gpio_word_byte_write(volatile uint32_t * word_address, uint8_t byte_no, uint8_t value); +__STATIC_INLINE void nrf_gpio_port_dir_output_set(NRF_GPIO_Type * p_reg, uint32_t out_mask); /** - * @brief Generic function for reading a single byte of a 32 bit word at a given - * address. + * @brief Function for setting input direction on selected pins on a given port. * - * This function should not be called from outside the nrf_gpio - * abstraction layer. + * @param p_reg Pointer to the peripheral registers structure. + * @param in_mask Mask specifying the pins to set as input. * - * @param word_address is the address of the word to be read. - * - * @param byte_no is the byte number (0-3) of the word to be read. - * - * @return byte "byte_no" of word at address "word_address". */ -__STATIC_INLINE uint8_t nrf_gpio_word_byte_read(const volatile uint32_t* word_address, uint8_t byte_no); +__STATIC_INLINE void nrf_gpio_port_dir_input_set(NRF_GPIO_Type * p_reg, uint32_t in_mask); /** - * @brief Function for setting the direction of a port. + * @brief Function for writing the direction configuration of GPIO pins in a given port. * - * @param port is the port for which to set the direction. + * @param p_reg Pointer to the peripheral registers structure. + * @param dir_mask Mask specifying the direction of pins. Bit set means that the given pin is configured as output. * - * @param dir direction to be set for this port. */ -__STATIC_INLINE void nrf_gpio_port_dir_set(nrf_gpio_port_select_t port, nrf_gpio_port_dir_t dir); +__STATIC_INLINE void nrf_gpio_port_dir_write(NRF_GPIO_Type * p_reg, uint32_t dir_mask); /** - * @brief Function for reading a GPIO port. + * @brief Function for reading the direction configuration of a GPIO port. * - * @param port is the port to read. + * @param p_reg Pointer to the peripheral registers structure. * - * @return the input value on this port. + * @retval Pin configuration of the current direction settings. Bit set means that the given pin is configured as output. */ -__STATIC_INLINE uint8_t nrf_gpio_port_read(nrf_gpio_port_select_t port); +__STATIC_INLINE uint32_t nrf_gpio_port_dir_read(NRF_GPIO_Type const * p_reg); /** - * @brief Function for writing to a GPIO port. + * @brief Function for reading the input signals of GPIO pins on a given port. * - * @param port is the port to write. + * @param p_reg Pointer to the peripheral registers structure. * - * @param value is the value to write to this port. - * - * @sa nrf_gpio_port_dir_set() + * @retval Port input values. */ -__STATIC_INLINE void nrf_gpio_port_write(nrf_gpio_port_select_t port, uint8_t value); +__STATIC_INLINE uint32_t nrf_gpio_port_in_read(NRF_GPIO_Type const * p_reg); /** - * @brief Function for setting individual pins on GPIO port. + * @brief Function for reading the output signals of GPIO pins of a given port. * - * @param port is the port for which to set the pins. + * @param p_reg Pointer to the peripheral registers structure. * - * @param set_mask is a mask specifying which pins to set. A bit - * set to 1 indicates that the corresponding port pin shall be - * set. - * - * @sa nrf_gpio_port_dir_set() + * @retval Port output values. */ -__STATIC_INLINE void nrf_gpio_port_set(nrf_gpio_port_select_t port, uint8_t set_mask); +__STATIC_INLINE uint32_t nrf_gpio_port_out_read(NRF_GPIO_Type const * p_reg); /** - * @brief Function for clearing individual pins on GPIO port. + * @brief Function for writing the GPIO pins output on a given port. * - * @param port is the port for which to clear the pins. + * @param p_reg Pointer to the peripheral registers structure. + * @param value Output port mask. * - * @param clr_mask is a mask specifying which pins to clear. A bit - * set to 1 indicates that the corresponding port pin shall be - * cleared. - * - * @sa nrf_gpio_port_dir_set() */ -__STATIC_INLINE void nrf_gpio_port_clear(nrf_gpio_port_select_t port, uint8_t clr_mask); +__STATIC_INLINE void nrf_gpio_port_out_write(NRF_GPIO_Type * p_reg, uint32_t value); + +/** + * @brief Function for setting high level on selected GPIO pins of a given port. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param set_mask Mask with pins to set as logical high level. + * + */ +__STATIC_INLINE void nrf_gpio_port_out_set(NRF_GPIO_Type * p_reg, uint32_t set_mask); + +/** + * @brief Function for setting low level on selected GPIO pins of a given port. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param clr_mask Mask with pins to set as logical low level. + * + */ +__STATIC_INLINE void nrf_gpio_port_out_clear(NRF_GPIO_Type * p_reg, uint32_t clr_mask); + +/** + * @brief Function for reading pins state of multiple consecutive ports. + * + * @param start_port Index of the first port to read. + * @param length Number of ports to read. + * @param p_masks Pointer to output array where port states will be stored. + */ +__STATIC_INLINE void nrf_gpio_ports_read(uint32_t start_port, uint32_t length, uint32_t * p_masks); + +#ifdef GPIO_DETECTMODE_DETECTMODE_LDETECT +/** + * @brief Function for reading latch state of multiple consecutive ports. + * + * @param start_port Index of the first port to read. + * @param length Number of ports to read. + * @param p_masks Pointer to output array where latch states will be stored. + */ +__STATIC_INLINE void nrf_gpio_latches_read(uint32_t start_port, uint32_t length, + uint32_t * p_masks); + +/** + * @brief Function for reading latch state of single pin. + * + * @param pin_number Pin number. + * @return 0 if latch is not set. Positive value otherwise. + * + */ +__STATIC_INLINE uint32_t nrf_gpio_pin_latch_get(uint32_t pin_number); + +/** + * @brief Function for clearing latch state of a single pin. + * + * @param pin_number Pin number. + * + */ +__STATIC_INLINE void nrf_gpio_pin_latch_clear(uint32_t pin_number); +#endif + + +#endif // #ifndef (__LINT__ != 1) #ifndef SUPPRESS_INLINE_IMPLEMENTATION + +/** + * @brief Function for extracting port and relative pin number from absolute pin number. + * + * @param[inout] Pointer to absolute pin number which is overriden by relative to port pin number. + * + * @return Pointer to port register set. + * + */ +__STATIC_INLINE NRF_GPIO_Type * nrf_gpio_pin_port_decode(uint32_t * p_pin) +{ + ASSERT(*p_pin < NUMBER_OF_PINS); +#if (GPIO_COUNT == 1) + // The oldest definition case + return NRF_GPIO; +#else + if (*p_pin < P0_PIN_NUM) + { + return NRF_P0; + } + else + { + *p_pin = *p_pin & (P0_PIN_NUM - 1); + return NRF_P1; + } +#endif +} + + __STATIC_INLINE void nrf_gpio_range_cfg_output(uint32_t pin_range_start, uint32_t pin_range_end) { /*lint -e{845} // A zero has been given as right argument to operator '|'" */ @@ -460,7 +486,10 @@ __STATIC_INLINE void nrf_gpio_range_cfg_output(uint32_t pin_range_start, uint32_ } } -__STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, uint32_t pin_range_end, nrf_gpio_pin_pull_t pull_config) + +__STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, + uint32_t pin_range_end, + nrf_gpio_pin_pull_t pull_config) { /*lint -e{845} // A zero has been given as right argument to operator '|'" */ for (; pin_range_start <= pin_range_end; pin_range_start++) @@ -469,136 +498,150 @@ __STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, uint32_t } } + __STATIC_INLINE void nrf_gpio_cfg( - uint32_t pin_number, - nrf_gpio_pin_dir_t dir, - nrf_gpio_pin_input_t input, - nrf_gpio_pin_pull_t pull, - nrf_gpio_pin_drive_t drive, - nrf_gpio_pin_sense_t sense) + uint32_t pin_number, + nrf_gpio_pin_dir_t dir, + nrf_gpio_pin_input_t input, + nrf_gpio_pin_pull_t pull, + nrf_gpio_pin_drive_t drive, + nrf_gpio_pin_sense_t sense) { - NRF_GPIO->PIN_CNF[pin_number] = ((uint32_t)dir << GPIO_PIN_CNF_DIR_Pos) - | ((uint32_t)input << GPIO_PIN_CNF_INPUT_Pos) - | ((uint32_t)pull << GPIO_PIN_CNF_PULL_Pos) - | ((uint32_t)drive << GPIO_PIN_CNF_DRIVE_Pos) - | ((uint32_t)sense << GPIO_PIN_CNF_SENSE_Pos); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + + reg->PIN_CNF[pin_number] = ((uint32_t)dir << GPIO_PIN_CNF_DIR_Pos) + | ((uint32_t)input << GPIO_PIN_CNF_INPUT_Pos) + | ((uint32_t)pull << GPIO_PIN_CNF_PULL_Pos) + | ((uint32_t)drive << GPIO_PIN_CNF_DRIVE_Pos) + | ((uint32_t)sense << GPIO_PIN_CNF_SENSE_Pos); } + __STATIC_INLINE void nrf_gpio_cfg_output(uint32_t pin_number) { nrf_gpio_cfg( - pin_number, - NRF_GPIO_PIN_DIR_OUTPUT, - NRF_GPIO_PIN_INPUT_DISCONNECT, - NRF_GPIO_PIN_NOPULL, - NRF_GPIO_PIN_S0S1, - NRF_GPIO_PIN_NOSENSE); + pin_number, + NRF_GPIO_PIN_DIR_OUTPUT, + NRF_GPIO_PIN_INPUT_DISCONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); } + __STATIC_INLINE void nrf_gpio_cfg_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config) { nrf_gpio_cfg( - pin_number, - NRF_GPIO_PIN_DIR_INPUT, - NRF_GPIO_PIN_INPUT_CONNECT, - pull_config, - NRF_GPIO_PIN_S0S1, - NRF_GPIO_PIN_NOSENSE); + pin_number, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + pull_config, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); } + __STATIC_INLINE void nrf_gpio_cfg_default(uint32_t pin_number) { nrf_gpio_cfg( - pin_number, - NRF_GPIO_PIN_DIR_INPUT, - NRF_GPIO_PIN_INPUT_DISCONNECT, - NRF_GPIO_PIN_NOPULL, - NRF_GPIO_PIN_S0S1, - NRF_GPIO_PIN_NOSENSE); + pin_number, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_DISCONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); } + __STATIC_INLINE void nrf_gpio_cfg_watcher(uint32_t pin_number) { + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); /*lint -e{845} // A zero has been given as right argument to operator '|'" */ - uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_INPUT_Msk; - NRF_GPIO->PIN_CNF[pin_number] = cnf | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos); + uint32_t cnf = reg->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_INPUT_Msk; + + reg->PIN_CNF[pin_number] = cnf | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos); } + __STATIC_INLINE void nrf_gpio_input_disconnect(uint32_t pin_number) { + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); /*lint -e{845} // A zero has been given as right argument to operator '|'" */ - uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_INPUT_Msk; - NRF_GPIO->PIN_CNF[pin_number] = cnf | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos); + uint32_t cnf = reg->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_INPUT_Msk; + + reg->PIN_CNF[pin_number] = cnf | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos); } -__STATIC_INLINE void nrf_gpio_cfg_sense_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config, nrf_gpio_pin_sense_t sense_config) + +__STATIC_INLINE void nrf_gpio_cfg_sense_input(uint32_t pin_number, + nrf_gpio_pin_pull_t pull_config, + nrf_gpio_pin_sense_t sense_config) { nrf_gpio_cfg( - pin_number, - NRF_GPIO_PIN_DIR_INPUT, - NRF_GPIO_PIN_INPUT_CONNECT, - pull_config, - NRF_GPIO_PIN_S0S1, - sense_config); + pin_number, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + pull_config, + NRF_GPIO_PIN_S0S1, + sense_config); } + __STATIC_INLINE void nrf_gpio_cfg_sense_set(uint32_t pin_number, nrf_gpio_pin_sense_t sense_config) { + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + /*lint -e{845} // A zero has been given as right argument to operator '|'" */ - //uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_SENSE_Msk; - NRF_GPIO->PIN_CNF[pin_number] &= ~GPIO_PIN_CNF_SENSE_Msk; - NRF_GPIO->PIN_CNF[pin_number] |= (sense_config << GPIO_PIN_CNF_SENSE_Pos); + reg->PIN_CNF[pin_number] &= ~GPIO_PIN_CNF_SENSE_Msk; + reg->PIN_CNF[pin_number] |= (sense_config << GPIO_PIN_CNF_SENSE_Pos); } + __STATIC_INLINE void nrf_gpio_pin_dir_set(uint32_t pin_number, nrf_gpio_pin_dir_t direction) { - if(direction == NRF_GPIO_PIN_DIR_INPUT) + if (direction == NRF_GPIO_PIN_DIR_INPUT) { nrf_gpio_cfg( - pin_number, - NRF_GPIO_PIN_DIR_INPUT, - NRF_GPIO_PIN_INPUT_CONNECT, - NRF_GPIO_PIN_NOPULL, - NRF_GPIO_PIN_S0S1, - NRF_GPIO_PIN_NOSENSE); + pin_number, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_CONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); } else { - NRF_GPIO->DIRSET = (1UL << pin_number); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + reg->DIRSET = (1UL << pin_number); } } + __STATIC_INLINE void nrf_gpio_pin_set(uint32_t pin_number) { - NRF_GPIO->OUTSET = (1UL << pin_number); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + + nrf_gpio_port_out_set(reg, 1UL << pin_number); } -__STATIC_INLINE void nrf_gpio_pins_set(uint32_t pin_mask) -{ - NRF_GPIO->OUTSET = pin_mask; -} __STATIC_INLINE void nrf_gpio_pin_clear(uint32_t pin_number) { - NRF_GPIO->OUTCLR = (1UL << pin_number); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + + nrf_gpio_port_out_clear(reg, 1UL << pin_number); } -__STATIC_INLINE void nrf_gpio_pins_clear(uint32_t pin_mask) -{ - NRF_GPIO->OUTCLR = pin_mask; -} __STATIC_INLINE void nrf_gpio_pin_toggle(uint32_t pin_number) { - nrf_gpio_pins_toggle(1UL << pin_number); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + uint32_t pins_state = reg->OUT; + + reg->OUTSET = (~pins_state & (1UL << pin_number)); + reg->OUTCLR = (pins_state & (1UL << pin_number)); } -__STATIC_INLINE void nrf_gpio_pins_toggle(uint32_t pin_mask) -{ - uint32_t pins_state = NRF_GPIO->OUT; - NRF_GPIO->OUTSET = (~pins_state & pin_mask); - NRF_GPIO->OUTCLR = ( pins_state & pin_mask); -} __STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value) { @@ -612,63 +655,139 @@ __STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value) } } + __STATIC_INLINE uint32_t nrf_gpio_pin_read(uint32_t pin_number) { - return ((NRF_GPIO->IN >> pin_number) & 1UL); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + + return ((nrf_gpio_port_in_read(reg) >> pin_number) & 1UL); } -__STATIC_INLINE uint32_t nrf_gpio_pins_read(void) + +__STATIC_INLINE uint32_t nrf_gpio_pin_out_read(uint32_t pin_number) { - return NRF_GPIO->IN; + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + + return ((nrf_gpio_port_out_read(reg) >> pin_number) & 1UL); } + __STATIC_INLINE nrf_gpio_pin_sense_t nrf_gpio_pin_sense_get(uint32_t pin_number) { - return (nrf_gpio_pin_sense_t)((NRF_GPIO->PIN_CNF[pin_number] & GPIO_PIN_CNF_SENSE_Msk) >> GPIO_PIN_CNF_SENSE_Pos); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + + return (nrf_gpio_pin_sense_t)((reg->PIN_CNF[pin_number] & + GPIO_PIN_CNF_SENSE_Msk) >> GPIO_PIN_CNF_SENSE_Pos); } -__STATIC_INLINE void nrf_gpio_word_byte_write(volatile uint32_t * word_address, uint8_t byte_no, uint8_t value) + +__STATIC_INLINE void nrf_gpio_port_dir_output_set(NRF_GPIO_Type * p_reg, uint32_t out_mask) { - *((volatile uint8_t*)(word_address) + byte_no) = value; + p_reg->DIRSET = out_mask; } -__STATIC_INLINE uint8_t nrf_gpio_word_byte_read(const volatile uint32_t* word_address, uint8_t byte_no) + +__STATIC_INLINE void nrf_gpio_port_dir_input_set(NRF_GPIO_Type * p_reg, uint32_t in_mask) { - return (*((const volatile uint8_t*)(word_address) + byte_no)); + p_reg->DIRCLR = in_mask; } -__STATIC_INLINE void nrf_gpio_port_dir_set(nrf_gpio_port_select_t port, nrf_gpio_port_dir_t dir) + +__STATIC_INLINE void nrf_gpio_port_dir_write(NRF_GPIO_Type * p_reg, uint32_t value) { - if (dir == NRF_GPIO_PORT_DIR_OUTPUT) + p_reg->DIR = value; +} + + +__STATIC_INLINE uint32_t nrf_gpio_port_dir_read(NRF_GPIO_Type const * p_reg) +{ + return p_reg->DIR; +} + + +__STATIC_INLINE uint32_t nrf_gpio_port_in_read(NRF_GPIO_Type const * p_reg) +{ + return p_reg->IN; +} + + +__STATIC_INLINE uint32_t nrf_gpio_port_out_read(NRF_GPIO_Type const * p_reg) +{ + return p_reg->OUT; +} + + +__STATIC_INLINE void nrf_gpio_port_out_write(NRF_GPIO_Type * p_reg, uint32_t value) +{ + p_reg->OUT = value; +} + + +__STATIC_INLINE void nrf_gpio_port_out_set(NRF_GPIO_Type * p_reg, uint32_t set_mask) +{ + p_reg->OUTSET = set_mask; +} + + +__STATIC_INLINE void nrf_gpio_port_out_clear(NRF_GPIO_Type * p_reg, uint32_t clr_mask) +{ + p_reg->OUTCLR = clr_mask; +} + + +__STATIC_INLINE void nrf_gpio_ports_read(uint32_t start_port, uint32_t length, uint32_t * p_masks) +{ + NRF_GPIO_Type * gpio_regs[GPIO_COUNT] = GPIO_REG_LIST; + + ASSERT(start_port + length <= GPIO_COUNT); + uint32_t i; + + for (i = start_port; i < (start_port + length); i++) { - nrf_gpio_word_byte_write(&NRF_GPIO->DIRSET, port, 0xFF); - } - else - { - nrf_gpio_range_cfg_input(port*8, (port+1)*8-1, NRF_GPIO_PIN_NOPULL); + *p_masks = nrf_gpio_port_in_read(gpio_regs[i]); + p_masks++; } } -__STATIC_INLINE uint8_t nrf_gpio_port_read(nrf_gpio_port_select_t port) + +#ifdef GPIO_DETECTMODE_DETECTMODE_LDETECT +__STATIC_INLINE void nrf_gpio_latches_read(uint32_t start_port, uint32_t length, uint32_t * p_masks) { - return nrf_gpio_word_byte_read(&NRF_GPIO->IN, port); + NRF_GPIO_Type * gpio_regs[GPIO_COUNT] = GPIO_REG_LIST; + uint32_t i; + + for (i = start_port; i < (start_port + length); i++) + { + *p_masks = gpio_regs[i]->LATCH; + p_masks++; + } } -__STATIC_INLINE void nrf_gpio_port_write(nrf_gpio_port_select_t port, uint8_t value) + +__STATIC_INLINE uint32_t nrf_gpio_pin_latch_get(uint32_t pin_number) { - nrf_gpio_word_byte_write(&NRF_GPIO->OUT, port, value); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + + return (reg->LATCH & (1 << pin_number)) ? 1 : 0; } -__STATIC_INLINE void nrf_gpio_port_set(nrf_gpio_port_select_t port, uint8_t set_mask) + +__STATIC_INLINE void nrf_gpio_pin_latch_clear(uint32_t pin_number) { - nrf_gpio_word_byte_write(&NRF_GPIO->OUTSET, port, set_mask); + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); + + reg->LATCH = (1 << pin_number); } -__STATIC_INLINE void nrf_gpio_port_clear(nrf_gpio_port_select_t port, uint8_t clr_mask) -{ - nrf_gpio_word_byte_write(&NRF_GPIO->OUTCLR, port, clr_mask); -} -#endif //SUPPRESS_INLINE_IMPLEMENTATION -/** @} */ + +#endif +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +/** @} */ + + +#ifdef __cplusplus +} +#endif #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpiote.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpiote.h index 7ad15e6398..68de203bd0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpiote.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_gpiote.h @@ -35,28 +35,30 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - #ifndef NRF_GPIOTE_H__ #define NRF_GPIOTE_H__ +#include "nrf_peripherals.h" #include "nrf.h" #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef GPIOTE_CONFIG_PORT_Msk +#define GPIOTE_CONFIG_PORT_PIN_Msk (GPIOTE_CONFIG_PORT_Msk | GPIOTE_CONFIG_PSEL_Msk) +#else +#define GPIOTE_CONFIG_PORT_PIN_Msk GPIOTE_CONFIG_PSEL_Msk +#endif /** * @defgroup nrf_gpiote_abs GPIOTE abstraction * @{ * @ingroup nrf_gpiote * @brief GPIOTE abstraction for configuration of channels. */ -#ifdef NRF51 -#define NUMBER_OF_GPIO_TE 4 -#elif defined(NRF52) -#define NUMBER_OF_GPIO_TE 8 -#else -#error "Chip family not specified" -#endif /** * @enum nrf_gpiote_polarity_t @@ -89,13 +91,13 @@ typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ NRF_GPIOTE_TASKS_OUT_1 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[1]), /**< Out task 1.*/ NRF_GPIOTE_TASKS_OUT_2 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[2]), /**< Out task 2.*/ NRF_GPIOTE_TASKS_OUT_3 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[3]), /**< Out task 3.*/ -#if (NUMBER_OF_GPIO_TE == 8) +#if (GPIOTE_CH_NUM > 4) || defined(__SDK_DOXYGEN__) NRF_GPIOTE_TASKS_OUT_4 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[4]), /**< Out task 4.*/ NRF_GPIOTE_TASKS_OUT_5 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[5]), /**< Out task 5.*/ NRF_GPIOTE_TASKS_OUT_6 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[6]), /**< Out task 6.*/ NRF_GPIOTE_TASKS_OUT_7 = offsetof(NRF_GPIOTE_Type, TASKS_OUT[7]), /**< Out task 7.*/ #endif -#ifdef NRF52 +#if defined(GPIOTE_FEATURE_SET_PRESENT) || defined(__SDK_DOXYGEN__) NRF_GPIOTE_TASKS_SET_0 = offsetof(NRF_GPIOTE_Type, TASKS_SET[0]), /**< Set task 0.*/ NRF_GPIOTE_TASKS_SET_1 = offsetof(NRF_GPIOTE_Type, TASKS_SET[1]), /**< Set task 1.*/ NRF_GPIOTE_TASKS_SET_2 = offsetof(NRF_GPIOTE_Type, TASKS_SET[2]), /**< Set task 2.*/ @@ -104,6 +106,8 @@ typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ NRF_GPIOTE_TASKS_SET_5 = offsetof(NRF_GPIOTE_Type, TASKS_SET[5]), /**< Set task 5.*/ NRF_GPIOTE_TASKS_SET_6 = offsetof(NRF_GPIOTE_Type, TASKS_SET[6]), /**< Set task 6.*/ NRF_GPIOTE_TASKS_SET_7 = offsetof(NRF_GPIOTE_Type, TASKS_SET[7]), /**< Set task 7.*/ +#endif +#if defined(GPIOTE_FEATURE_CLR_PRESENT) || defined(__SDK_DOXYGEN__) NRF_GPIOTE_TASKS_CLR_0 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[0]), /**< Clear task 0.*/ NRF_GPIOTE_TASKS_CLR_1 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[1]), /**< Clear task 1.*/ NRF_GPIOTE_TASKS_CLR_2 = offsetof(NRF_GPIOTE_Type, TASKS_CLR[2]), /**< Clear task 2.*/ @@ -125,7 +129,7 @@ typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ NRF_GPIOTE_EVENTS_IN_1 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[1]), /**< In event 1.*/ NRF_GPIOTE_EVENTS_IN_2 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[2]), /**< In event 2.*/ NRF_GPIOTE_EVENTS_IN_3 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[3]), /**< In event 3.*/ -#if (NUMBER_OF_GPIO_TE == 8) +#if (GPIOTE_CH_NUM > 4) || defined(__SDK_DOXYGEN__) NRF_GPIOTE_EVENTS_IN_4 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[4]), /**< In event 4.*/ NRF_GPIOTE_EVENTS_IN_5 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[5]), /**< In event 5.*/ NRF_GPIOTE_EVENTS_IN_6 = offsetof(NRF_GPIOTE_Type, EVENTS_IN[6]), /**< In event 6.*/ @@ -145,7 +149,7 @@ typedef enum NRF_GPIOTE_INT_IN1_MASK = GPIOTE_INTENSET_IN1_Msk, /**< GPIOTE interrupt from IN1. */ NRF_GPIOTE_INT_IN2_MASK = GPIOTE_INTENSET_IN2_Msk, /**< GPIOTE interrupt from IN2. */ NRF_GPIOTE_INT_IN3_MASK = GPIOTE_INTENSET_IN3_Msk, /**< GPIOTE interrupt from IN3. */ -#if (NUMBER_OF_GPIO_TE == 8) +#if (GPIOTE_CH_NUM > 4) || defined(__SDK_DOXYGEN__) NRF_GPIOTE_INT_IN4_MASK = GPIOTE_INTENSET_IN4_Msk, /**< GPIOTE interrupt from IN4. */ NRF_GPIOTE_INT_IN5_MASK = GPIOTE_INTENSET_IN5_Msk, /**< GPIOTE interrupt from IN5. */ NRF_GPIOTE_INT_IN6_MASK = GPIOTE_INTENSET_IN6_Msk, /**< GPIOTE interrupt from IN6. */ @@ -154,17 +158,16 @@ typedef enum NRF_GPIOTE_INT_PORT_MASK = (int)GPIOTE_INTENSET_PORT_Msk, /**< GPIOTE interrupt from PORT event. */ } nrf_gpiote_int_t; -#if (NUMBER_OF_GPIO_TE == 4) #define NRF_GPIOTE_INT_IN_MASK (NRF_GPIOTE_INT_IN0_MASK | NRF_GPIOTE_INT_IN1_MASK |\ NRF_GPIOTE_INT_IN2_MASK | NRF_GPIOTE_INT_IN3_MASK) -#elif (NUMBER_OF_GPIO_TE == 8) +#if (GPIOTE_CH_NUM > 4) +#undef NRF_GPIOTE_INT_IN_MASK #define NRF_GPIOTE_INT_IN_MASK (NRF_GPIOTE_INT_IN0_MASK | NRF_GPIOTE_INT_IN1_MASK |\ NRF_GPIOTE_INT_IN2_MASK | NRF_GPIOTE_INT_IN3_MASK |\ NRF_GPIOTE_INT_IN4_MASK | NRF_GPIOTE_INT_IN5_MASK |\ NRF_GPIOTE_INT_IN6_MASK | NRF_GPIOTE_INT_IN7_MASK) -#else -#error "Unexpected number of GPIO Tasks and Events" #endif + /** * @brief Function for activating a specific GPIOTE task. * @@ -279,7 +282,7 @@ __STATIC_INLINE void nrf_gpiote_task_disable(uint32_t idx); * @param[in] idx Task-Event index. * @param[in] pin Pin associated with event. * @param[in] polarity Transition that should generate an event. - * @param[in] init_val Initial value of pin. + * @param[in] init_val Initial value of the pin. */ __STATIC_INLINE void nrf_gpiote_task_configure(uint32_t idx, uint32_t pin, nrf_gpiote_polarity_t polarity, @@ -355,14 +358,14 @@ __STATIC_INLINE void nrf_gpiote_event_disable(uint32_t idx) __STATIC_INLINE void nrf_gpiote_event_configure(uint32_t idx, uint32_t pin, nrf_gpiote_polarity_t polarity) { - NRF_GPIOTE->CONFIG[idx] &= ~(GPIOTE_CONFIG_PSEL_Msk | GPIOTE_CONFIG_POLARITY_Msk); - NRF_GPIOTE->CONFIG[idx] |= ((pin << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk) | + NRF_GPIOTE->CONFIG[idx] &= ~(GPIOTE_CONFIG_PORT_PIN_Msk | GPIOTE_CONFIG_POLARITY_Msk); + NRF_GPIOTE->CONFIG[idx] |= ((pin << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PORT_PIN_Msk) | ((polarity << GPIOTE_CONFIG_POLARITY_Pos) & GPIOTE_CONFIG_POLARITY_Msk); } __STATIC_INLINE uint32_t nrf_gpiote_event_pin_get(uint32_t idx) { - return ((NRF_GPIOTE->CONFIG[idx] & GPIOTE_CONFIG_PSEL_Msk) >> GPIOTE_CONFIG_PSEL_Pos); + return ((NRF_GPIOTE->CONFIG[idx] & GPIOTE_CONFIG_PORT_PIN_Msk) >> GPIOTE_CONFIG_PSEL_Pos); } __STATIC_INLINE nrf_gpiote_polarity_t nrf_gpiote_event_polarity_get(uint32_t idx) @@ -373,14 +376,16 @@ __STATIC_INLINE nrf_gpiote_polarity_t nrf_gpiote_event_polarity_get(uint32_t idx __STATIC_INLINE void nrf_gpiote_task_enable(uint32_t idx) { uint32_t final_config = NRF_GPIOTE->CONFIG[idx] | GPIOTE_CONFIG_MODE_Task; +#ifdef NRF51 /* Workaround for the OUTINIT PAN. When nrf_gpiote_task_config() is called a glitch happens on the GPIO if the GPIO in question is already assigned to GPIOTE and the pin is in the correct state in GPIOTE but not in the OUT register. */ - /* Configure channel to Pin31, not connected to the pin, and configure as a tasks that will set it to proper level */ - NRF_GPIOTE->CONFIG[idx] = final_config | ((31 << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk); + /* Configure channel to not existing, not connected to the pin, and configure as a tasks that will set it to proper level */ + NRF_GPIOTE->CONFIG[idx] = final_config | (((31) << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PORT_PIN_Msk); __NOP(); __NOP(); __NOP(); +#endif NRF_GPIOTE->CONFIG[idx] = final_config; } @@ -393,18 +398,18 @@ __STATIC_INLINE void nrf_gpiote_task_configure(uint32_t idx, uint32_t pin, nrf_gpiote_polarity_t polarity, nrf_gpiote_outinit_t init_val) { - NRF_GPIOTE->CONFIG[idx] &= ~(GPIOTE_CONFIG_PSEL_Msk | + NRF_GPIOTE->CONFIG[idx] &= ~(GPIOTE_CONFIG_PORT_PIN_Msk | GPIOTE_CONFIG_POLARITY_Msk | GPIOTE_CONFIG_OUTINIT_Msk); - NRF_GPIOTE->CONFIG[idx] |= ((pin << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk) | + NRF_GPIOTE->CONFIG[idx] |= ((pin << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PORT_PIN_Msk) | ((polarity << GPIOTE_CONFIG_POLARITY_Pos) & GPIOTE_CONFIG_POLARITY_Msk) | ((init_val << GPIOTE_CONFIG_OUTINIT_Pos) & GPIOTE_CONFIG_OUTINIT_Msk); } __STATIC_INLINE void nrf_gpiote_task_force(uint32_t idx, nrf_gpiote_outinit_t init_val) { - NRF_GPIOTE->CONFIG[idx] = (NRF_GPIOTE->CONFIG[idx] & ~GPIOTE_CONFIG_OUTINIT_Msk) + NRF_GPIOTE->CONFIG[idx] = (NRF_GPIOTE->CONFIG[idx] & ~GPIOTE_CONFIG_OUTINIT_Msk) | ((init_val << GPIOTE_CONFIG_OUTINIT_Pos) & GPIOTE_CONFIG_OUTINIT_Msk); } @@ -415,4 +420,9 @@ __STATIC_INLINE void nrf_gpiote_te_default(uint32_t idx) #endif //SUPPRESS_INLINE_IMPLEMENTATION /** @} */ + +#ifdef __cplusplus +} +#endif + #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_i2s.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_i2s.h new file mode 100644 index 0000000000..586fc55fc8 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_i2s.h @@ -0,0 +1,562 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @defgroup nrf_i2s_hal I2S HAL + * @{ + * @ingroup nrf_i2s + * + * @brief @tagAPI52 Hardware access layer for managing the Inter-IC Sound (I2S) peripheral. + */ + +#ifndef NRF_I2S_H__ +#define NRF_I2S_H__ + +#include +#include +#include + +#include "nrf.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief This value can be provided as a parameter for the @ref nrf_i2s_pins_set + * function call to specify that a given I2S signal (SDOUT, SDIN, or MCK) + * shall not be connected to a physical pin. + */ +#define NRF_I2S_PIN_NOT_CONNECTED 0xFFFFFFFF + + +/** + * @brief I2S tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_I2S_TASK_START = offsetof(NRF_I2S_Type, TASKS_START), ///< Starts continuous I2S transfer. Also starts the MCK generator if this is enabled. + NRF_I2S_TASK_STOP = offsetof(NRF_I2S_Type, TASKS_STOP) ///< Stops I2S transfer. Also stops the MCK generator. + /*lint -restore*/ +} nrf_i2s_task_t; + +/** + * @brief I2S events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_I2S_EVENT_RXPTRUPD = offsetof(NRF_I2S_Type, EVENTS_RXPTRUPD), ///< The RXD.PTR register has been copied to internal double-buffers. + NRF_I2S_EVENT_TXPTRUPD = offsetof(NRF_I2S_Type, EVENTS_TXPTRUPD), ///< The TXD.PTR register has been copied to internal double-buffers. + NRF_I2S_EVENT_STOPPED = offsetof(NRF_I2S_Type, EVENTS_STOPPED) ///< I2S transfer stopped. + /*lint -restore*/ +} nrf_i2s_event_t; + +/** + * @brief I2S interrupts. + */ +typedef enum +{ + NRF_I2S_INT_RXPTRUPD_MASK = I2S_INTENSET_RXPTRUPD_Msk, ///< Interrupt on RXPTRUPD event. + NRF_I2S_INT_TXPTRUPD_MASK = I2S_INTENSET_TXPTRUPD_Msk, ///< Interrupt on TXPTRUPD event. + NRF_I2S_INT_STOPPED_MASK = I2S_INTENSET_STOPPED_Msk ///< Interrupt on STOPPED event. +} nrf_i2s_int_mask_t; + +/** + * @brief I2S modes of operation. + */ +typedef enum +{ + NRF_I2S_MODE_MASTER = I2S_CONFIG_MODE_MODE_Master, ///< Master mode. + NRF_I2S_MODE_SLAVE = I2S_CONFIG_MODE_MODE_Slave ///< Slave mode. +} nrf_i2s_mode_t; + +/** + * @brief I2S master clock generator settings. + */ +typedef enum +{ + NRF_I2S_MCK_DISABLED = 0, ///< MCK disabled. + // [conversion to 'int' needed to prevent compilers from complaining + // that the provided value (0x80000000UL) is out of range of "int"] + NRF_I2S_MCK_32MDIV2 = (int)I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2, ///< 32 MHz / 2 = 16.0 MHz. + NRF_I2S_MCK_32MDIV3 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV3, ///< 32 MHz / 3 = 10.6666667 MHz. + NRF_I2S_MCK_32MDIV4 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV4, ///< 32 MHz / 4 = 8.0 MHz. + NRF_I2S_MCK_32MDIV5 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV5, ///< 32 MHz / 5 = 6.4 MHz. + NRF_I2S_MCK_32MDIV6 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV6, ///< 32 MHz / 6 = 5.3333333 MHz. + NRF_I2S_MCK_32MDIV8 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV8, ///< 32 MHz / 8 = 4.0 MHz. + NRF_I2S_MCK_32MDIV10 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV10, ///< 32 MHz / 10 = 3.2 MHz. + NRF_I2S_MCK_32MDIV11 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV11, ///< 32 MHz / 11 = 2.9090909 MHz. + NRF_I2S_MCK_32MDIV15 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV15, ///< 32 MHz / 15 = 2.1333333 MHz. + NRF_I2S_MCK_32MDIV16 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV16, ///< 32 MHz / 16 = 2.0 MHz. + NRF_I2S_MCK_32MDIV21 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV21, ///< 32 MHz / 21 = 1.5238095 MHz. + NRF_I2S_MCK_32MDIV23 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV23, ///< 32 MHz / 23 = 1.3913043 MHz. + NRF_I2S_MCK_32MDIV31 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV31, ///< 32 MHz / 31 = 1.0322581 MHz. + NRF_I2S_MCK_32MDIV42 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV42, ///< 32 MHz / 42 = 0.7619048 MHz. + NRF_I2S_MCK_32MDIV63 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV63, ///< 32 MHz / 63 = 0.5079365 MHz. + NRF_I2S_MCK_32MDIV125 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV125 ///< 32 MHz / 125 = 0.256 MHz. +} nrf_i2s_mck_t; + +/** + * @brief I2S MCK/LRCK ratios. + */ +typedef enum +{ + NRF_I2S_RATIO_32X = I2S_CONFIG_RATIO_RATIO_32X, ///< LRCK = MCK / 32. + NRF_I2S_RATIO_48X = I2S_CONFIG_RATIO_RATIO_48X, ///< LRCK = MCK / 48. + NRF_I2S_RATIO_64X = I2S_CONFIG_RATIO_RATIO_64X, ///< LRCK = MCK / 64. + NRF_I2S_RATIO_96X = I2S_CONFIG_RATIO_RATIO_96X, ///< LRCK = MCK / 96. + NRF_I2S_RATIO_128X = I2S_CONFIG_RATIO_RATIO_128X, ///< LRCK = MCK / 128. + NRF_I2S_RATIO_192X = I2S_CONFIG_RATIO_RATIO_192X, ///< LRCK = MCK / 192. + NRF_I2S_RATIO_256X = I2S_CONFIG_RATIO_RATIO_256X, ///< LRCK = MCK / 256. + NRF_I2S_RATIO_384X = I2S_CONFIG_RATIO_RATIO_384X, ///< LRCK = MCK / 384. + NRF_I2S_RATIO_512X = I2S_CONFIG_RATIO_RATIO_512X ///< LRCK = MCK / 512. +} nrf_i2s_ratio_t; + +/** + * @brief I2S sample widths. + */ +typedef enum +{ + NRF_I2S_SWIDTH_8BIT = I2S_CONFIG_SWIDTH_SWIDTH_8Bit, ///< 8 bit. + NRF_I2S_SWIDTH_16BIT = I2S_CONFIG_SWIDTH_SWIDTH_16Bit, ///< 16 bit. + NRF_I2S_SWIDTH_24BIT = I2S_CONFIG_SWIDTH_SWIDTH_24Bit ///< 24 bit. +} nrf_i2s_swidth_t; + +/** + * @brief I2S alignments of sample within a frame. + */ +typedef enum +{ + NRF_I2S_ALIGN_LEFT = I2S_CONFIG_ALIGN_ALIGN_Left, ///< Left-aligned. + NRF_I2S_ALIGN_RIGHT = I2S_CONFIG_ALIGN_ALIGN_Right ///< Right-aligned. +} nrf_i2s_align_t; + +/** + * @brief I2S frame formats. + */ +typedef enum +{ + NRF_I2S_FORMAT_I2S = I2S_CONFIG_FORMAT_FORMAT_I2S, ///< Original I2S format. + NRF_I2S_FORMAT_ALIGNED = I2S_CONFIG_FORMAT_FORMAT_Aligned ///< Alternate (left- or right-aligned) format. +} nrf_i2s_format_t; + +/** + * @brief I2S enabled channels. + */ +typedef enum +{ + NRF_I2S_CHANNELS_STEREO = I2S_CONFIG_CHANNELS_CHANNELS_Stereo, ///< Stereo. + NRF_I2S_CHANNELS_LEFT = I2S_CONFIG_CHANNELS_CHANNELS_Left, ///< Left only. + NRF_I2S_CHANNELS_RIGHT = I2S_CONFIG_CHANNELS_CHANNELS_Right ///< Right only. +} nrf_i2s_channels_t; + + +/** + * @brief Function for activating a specific I2S task. + * + * @param[in] p_i2s I2S instance. + * @param[in] task Task to activate. + */ +__STATIC_INLINE void nrf_i2s_task_trigger(NRF_I2S_Type * p_i2s, + nrf_i2s_task_t task); + +/** + * @brief Function for getting the address of a specific I2S task register. + * + * @param[in] p_i2s I2S instance. + * @param[in] task Requested task. + * + * @return Address of the specified task register. + */ +__STATIC_INLINE uint32_t nrf_i2s_task_address_get(NRF_I2S_Type const * p_i2s, + nrf_i2s_task_t task); + +/** + * @brief Function for clearing a specific I2S event. + * + * @param[in] p_i2s I2S instance. + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_i2s_event_clear(NRF_I2S_Type * p_i2s, + nrf_i2s_event_t event); + +/** + * @brief Function for checking the state of a specific I2S event. + * + * @param[in] p_i2s I2S instance. + * @param[in] event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_i2s_event_check(NRF_I2S_Type const * p_i2s, + nrf_i2s_event_t event); + +/** + * @brief Function for getting the address of a specific I2S event register. + * + * @param[in] p_i2s I2S instance. + * @param[in] event Requested event. + * + * @return Address of the specified event register. + */ +__STATIC_INLINE uint32_t nrf_i2s_event_address_get(NRF_I2S_Type const * p_i2s, + nrf_i2s_event_t event); + +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] p_i2s I2S instance. + * @param[in] mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_i2s_int_enable(NRF_I2S_Type * p_i2s, uint32_t mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] p_i2s I2S instance. + * @param[in] mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_i2s_int_disable(NRF_I2S_Type * p_i2s, uint32_t mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param[in] p_i2s I2S instance. + * @param[in] i2s_int Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_i2s_int_enable_check(NRF_I2S_Type const * p_i2s, + nrf_i2s_int_mask_t i2s_int); + +/** + * @brief Function for enabling the I2S peripheral. + * + * @param[in] p_i2s I2S instance. + */ +__STATIC_INLINE void nrf_i2s_enable(NRF_I2S_Type * p_i2s); + +/** + * @brief Function for disabling the I2S peripheral. + * + * @param[in] p_i2s I2S instance. + */ +__STATIC_INLINE void nrf_i2s_disable(NRF_I2S_Type * p_i2s); + +/** + * @brief Function for configuring I2S pins. + * + * Usage of the SDOUT, SDIN, and MCK signals is optional. + * If a given signal is not needed, pass the @ref NRF_I2S_PIN_NOT_CONNECTED + * value instead of its pin number. + * + * @param[in] p_i2s I2S instance. + * @param[in] sck_pin SCK pin number. + * @param[in] lrck_pin LRCK pin number. + * @param[in] mck_pin MCK pin number. + * @param[in] sdout_pin SDOUT pin number. + * @param[in] sdin_pin SDIN pin number. + */ +__STATIC_INLINE void nrf_i2s_pins_set(NRF_I2S_Type * p_i2s, + uint32_t sck_pin, + uint32_t lrck_pin, + uint32_t mck_pin, + uint32_t sdout_pin, + uint32_t sdin_pin); + +/** + * @brief Function for setting the I2S peripheral configuration. + * + * @param[in] p_i2s I2S instance. + * @param[in] mode Mode of operation (master or slave). + * @param[in] format I2S frame format. + * @param[in] alignment Alignment of sample within a frame. + * @param[in] sample_width Sample width. + * @param[in] channels Enabled channels. + * @param[in] mck_setup Master clock generator setup. + * @param[in] ratio MCK/LRCK ratio. + * + * @retval true If the configuration has been set successfully. + * @retval false If the requested configuration is not allowed. + */ +__STATIC_INLINE bool nrf_i2s_configure(NRF_I2S_Type * p_i2s, + nrf_i2s_mode_t mode, + nrf_i2s_format_t format, + nrf_i2s_align_t alignment, + nrf_i2s_swidth_t sample_width, + nrf_i2s_channels_t channels, + nrf_i2s_mck_t mck_setup, + nrf_i2s_ratio_t ratio); + +/** + * @brief Function for setting up the I2S transfer. + * + * This function sets up the RX and TX buffers and enables reception and/or + * transmission accordingly. If the transfer in a given direction is not + * required, pass NULL instead of the pointer to the corresponding buffer. + * + * @param[in] p_i2s I2S instance. + * @param[in] size Size of the buffers (in 32-bit words). + * @param[in] p_rx_buffer Pointer to the receive buffer. + * Pass NULL to disable reception. + * @param[in] p_tx_buffer Pointer to the transmit buffer. + * Pass NULL to disable transmission. + */ +__STATIC_INLINE void nrf_i2s_transfer_set(NRF_I2S_Type * p_i2s, + uint16_t size, + uint32_t * p_rx_buffer, + uint32_t const * p_tx_buffer); + +/** + * @brief Function for setting the pointer to the receive buffer. + * + * @note The size of the buffer can be set only by calling + * @ref nrf_i2s_transfer_set. + * + * @param[in] p_i2s I2S instance. + * @param[in] p_buffer Pointer to the receive buffer. + */ +__STATIC_INLINE void nrf_i2s_rx_buffer_set(NRF_I2S_Type * p_i2s, + uint32_t * p_buffer); + +/** + * @brief Function for getting the pointer to the receive buffer. + * + * @param[in] p_i2s I2S instance. + * + * @return Pointer to the receive buffer. + */ +__STATIC_INLINE uint32_t * nrf_i2s_rx_buffer_get(NRF_I2S_Type const * p_i2s); + +/** + * @brief Function for setting the pointer to the transmit buffer. + * + * @note The size of the buffer can be set only by calling + * @ref nrf_i2s_transfer_set. + * + * @param[in] p_i2s I2S instance. + * @param[in] p_buffer Pointer to the transmit buffer. + */ +__STATIC_INLINE void nrf_i2s_tx_buffer_set(NRF_I2S_Type * p_i2s, + uint32_t const * p_buffer); + +/** + * @brief Function for getting the pointer to the transmit buffer. + * + * @param[in] p_i2s I2S instance. + * + * @return Pointer to the transmit buffer. + */ +__STATIC_INLINE uint32_t * nrf_i2s_tx_buffer_get(NRF_I2S_Type const * p_i2s); + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_i2s_task_trigger(NRF_I2S_Type * p_i2s, + nrf_i2s_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)p_i2s + (uint32_t)task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t nrf_i2s_task_address_get(NRF_I2S_Type const * p_i2s, + nrf_i2s_task_t task) +{ + return ((uint32_t)p_i2s + (uint32_t)task); +} + +__STATIC_INLINE void nrf_i2s_event_clear(NRF_I2S_Type * p_i2s, + nrf_i2s_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)p_i2s + (uint32_t)event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_i2s + (uint32_t)event)); + (void)dummy; +#endif +} + +__STATIC_INLINE bool nrf_i2s_event_check(NRF_I2S_Type const * p_i2s, + nrf_i2s_event_t event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_i2s + (uint32_t)event); +} + +__STATIC_INLINE uint32_t nrf_i2s_event_address_get(NRF_I2S_Type const * p_i2s, + nrf_i2s_event_t event) +{ + return ((uint32_t)p_i2s + (uint32_t)event); +} + +__STATIC_INLINE void nrf_i2s_int_enable(NRF_I2S_Type * p_i2s, uint32_t mask) +{ + p_i2s->INTENSET = mask; +} + +__STATIC_INLINE void nrf_i2s_int_disable(NRF_I2S_Type * p_i2s, uint32_t mask) +{ + p_i2s->INTENCLR = mask; +} + +__STATIC_INLINE bool nrf_i2s_int_enable_check(NRF_I2S_Type const * p_i2s, + nrf_i2s_int_mask_t i2s_int) +{ + return (bool)(p_i2s->INTENSET & i2s_int); +} + +__STATIC_INLINE void nrf_i2s_enable(NRF_I2S_Type * p_i2s) +{ + p_i2s->ENABLE = (I2S_ENABLE_ENABLE_Enabled << I2S_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_i2s_disable(NRF_I2S_Type * p_i2s) +{ + p_i2s->ENABLE = (I2S_ENABLE_ENABLE_Disabled << I2S_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_i2s_pins_set(NRF_I2S_Type * p_i2s, + uint32_t sck_pin, + uint32_t lrck_pin, + uint32_t mck_pin, + uint32_t sdout_pin, + uint32_t sdin_pin) +{ + p_i2s->PSEL.SCK = sck_pin; + p_i2s->PSEL.LRCK = lrck_pin; + p_i2s->PSEL.MCK = mck_pin; + p_i2s->PSEL.SDOUT = sdout_pin; + p_i2s->PSEL.SDIN = sdin_pin; +} + +__STATIC_INLINE bool nrf_i2s_configure(NRF_I2S_Type * p_i2s, + nrf_i2s_mode_t mode, + nrf_i2s_format_t format, + nrf_i2s_align_t alignment, + nrf_i2s_swidth_t sample_width, + nrf_i2s_channels_t channels, + nrf_i2s_mck_t mck_setup, + nrf_i2s_ratio_t ratio) +{ + if (mode == NRF_I2S_MODE_MASTER) + { + // The MCK/LRCK ratio shall be a multiple of 2 * sample width. + if (((sample_width == NRF_I2S_SWIDTH_16BIT) && + (ratio == NRF_I2S_RATIO_48X)) + || + ((sample_width == NRF_I2S_SWIDTH_24BIT) && + ((ratio == NRF_I2S_RATIO_32X) || + (ratio == NRF_I2S_RATIO_64X) || + (ratio == NRF_I2S_RATIO_128X) || + (ratio == NRF_I2S_RATIO_256X) || + (ratio == NRF_I2S_RATIO_512X)))) + { + return false; + } + } + + p_i2s->CONFIG.MODE = mode; + p_i2s->CONFIG.FORMAT = format; + p_i2s->CONFIG.ALIGN = alignment; + p_i2s->CONFIG.SWIDTH = sample_width; + p_i2s->CONFIG.CHANNELS = channels; + p_i2s->CONFIG.RATIO = ratio; + + if (mck_setup == NRF_I2S_MCK_DISABLED) + { + p_i2s->CONFIG.MCKEN = + (I2S_CONFIG_MCKEN_MCKEN_Disabled << I2S_CONFIG_MCKEN_MCKEN_Pos); + } + else + { + p_i2s->CONFIG.MCKFREQ = mck_setup; + p_i2s->CONFIG.MCKEN = + (I2S_CONFIG_MCKEN_MCKEN_Enabled << I2S_CONFIG_MCKEN_MCKEN_Pos); + } + + return true; +} + +__STATIC_INLINE void nrf_i2s_transfer_set(NRF_I2S_Type * p_i2s, + uint16_t size, + uint32_t * p_buffer_rx, + uint32_t const * p_buffer_tx) +{ + p_i2s->RXTXD.MAXCNT = size; + + nrf_i2s_rx_buffer_set(p_i2s, p_buffer_rx); + p_i2s->CONFIG.RXEN = (p_buffer_rx != NULL) ? 1 : 0; + + nrf_i2s_tx_buffer_set(p_i2s, p_buffer_tx); + p_i2s->CONFIG.TXEN = (p_buffer_tx != NULL) ? 1 : 0; +} + +__STATIC_INLINE void nrf_i2s_rx_buffer_set(NRF_I2S_Type * p_i2s, + uint32_t * p_buffer) +{ + p_i2s->RXD.PTR = (uint32_t)p_buffer; +} + +__STATIC_INLINE uint32_t * nrf_i2s_rx_buffer_get(NRF_I2S_Type const * p_i2s) +{ + return (uint32_t *)(p_i2s->RXD.PTR); +} + +__STATIC_INLINE void nrf_i2s_tx_buffer_set(NRF_I2S_Type * p_i2s, + uint32_t const * p_buffer) +{ + p_i2s->TXD.PTR = (uint32_t)p_buffer; +} + +__STATIC_INLINE uint32_t * nrf_i2s_tx_buffer_get(NRF_I2S_Type const * p_i2s) +{ + return (uint32_t *)(p_i2s->TXD.PTR); +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_I2S_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_lpcomp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_lpcomp.h new file mode 100644 index 0000000000..5dcf39b58f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_lpcomp.h @@ -0,0 +1,424 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file + * @brief LPCOMP HAL API. + */ + +#ifndef NRF_LPCOMP_H_ +#define NRF_LPCOMP_H_ + +/** + * @defgroup nrf_lpcomp_hal LPCOMP HAL + * @{ + * @ingroup nrf_lpcomp + * @brief Hardware access layer for managing the Low Power Comparator (LPCOMP). + */ + +#include "nrf.h" +#include "nrf_peripherals.h" + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @enum nrf_lpcomp_ref_t + * @brief LPCOMP reference selection. + */ +typedef enum +{ +#if (LPCOMP_REFSEL_RESOLUTION == 8) || defined(__SDK_DOXYGEN__) + NRF_LPCOMP_REF_SUPPLY_1_8 = LPCOMP_REFSEL_REFSEL_SupplyOneEighthPrescaling, /**< Use supply with a 1/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_2_8 = LPCOMP_REFSEL_REFSEL_SupplyTwoEighthsPrescaling, /**< Use supply with a 2/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_3_8 = LPCOMP_REFSEL_REFSEL_SupplyThreeEighthsPrescaling, /**< Use supply with a 3/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_4_8 = LPCOMP_REFSEL_REFSEL_SupplyFourEighthsPrescaling, /**< Use supply with a 4/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_5_8 = LPCOMP_REFSEL_REFSEL_SupplyFiveEighthsPrescaling, /**< Use supply with a 5/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_6_8 = LPCOMP_REFSEL_REFSEL_SupplySixEighthsPrescaling, /**< Use supply with a 6/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_7_8 = LPCOMP_REFSEL_REFSEL_SupplySevenEighthsPrescaling, /**< Use supply with a 7/8 prescaler as reference. */ +#elif (LPCOMP_REFSEL_RESOLUTION == 16) || defined(__SDK_DOXYGEN__) + NRF_LPCOMP_REF_SUPPLY_1_8 = LPCOMP_REFSEL_REFSEL_Ref1_8Vdd, /**< Use supply with a 1/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_2_8 = LPCOMP_REFSEL_REFSEL_Ref2_8Vdd, /**< Use supply with a 2/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_3_8 = LPCOMP_REFSEL_REFSEL_Ref3_8Vdd, /**< Use supply with a 3/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_4_8 = LPCOMP_REFSEL_REFSEL_Ref4_8Vdd, /**< Use supply with a 4/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_5_8 = LPCOMP_REFSEL_REFSEL_Ref5_8Vdd, /**< Use supply with a 5/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_6_8 = LPCOMP_REFSEL_REFSEL_Ref6_8Vdd, /**< Use supply with a 6/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_7_8 = LPCOMP_REFSEL_REFSEL_Ref7_8Vdd, /**< Use supply with a 7/8 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_1_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 1/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_3_16 = LPCOMP_REFSEL_REFSEL_Ref3_16Vdd, /**< Use supply with a 3/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_5_16 = LPCOMP_REFSEL_REFSEL_Ref5_16Vdd, /**< Use supply with a 5/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_7_16 = LPCOMP_REFSEL_REFSEL_Ref7_16Vdd, /**< Use supply with a 7/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_9_16 = LPCOMP_REFSEL_REFSEL_Ref9_16Vdd, /**< Use supply with a 9/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_11_16 = LPCOMP_REFSEL_REFSEL_Ref11_16Vdd, /**< Use supply with a 11/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_13_16 = LPCOMP_REFSEL_REFSEL_Ref13_16Vdd, /**< Use supply with a 13/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_15_16 = LPCOMP_REFSEL_REFSEL_Ref15_16Vdd, /**< Use supply with a 15/16 prescaler as reference. */ +#endif + NRF_LPCOMP_REF_EXT_REF0 = LPCOMP_REFSEL_REFSEL_ARef | + (LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference0 << 16), /**< External reference 0. */ + NRF_LPCOMP_CONFIG_REF_EXT_REF1 = LPCOMP_REFSEL_REFSEL_ARef | + (LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference1 << 16), /**< External reference 1. */ +} nrf_lpcomp_ref_t; + +/** + * @enum nrf_lpcomp_input_t + * @brief LPCOMP input selection. + */ +typedef enum +{ + NRF_LPCOMP_INPUT_0 = LPCOMP_PSEL_PSEL_AnalogInput0, /**< Input 0. */ + NRF_LPCOMP_INPUT_1 = LPCOMP_PSEL_PSEL_AnalogInput1, /**< Input 1. */ + NRF_LPCOMP_INPUT_2 = LPCOMP_PSEL_PSEL_AnalogInput2, /**< Input 2. */ + NRF_LPCOMP_INPUT_3 = LPCOMP_PSEL_PSEL_AnalogInput3, /**< Input 3. */ + NRF_LPCOMP_INPUT_4 = LPCOMP_PSEL_PSEL_AnalogInput4, /**< Input 4. */ + NRF_LPCOMP_INPUT_5 = LPCOMP_PSEL_PSEL_AnalogInput5, /**< Input 5. */ + NRF_LPCOMP_INPUT_6 = LPCOMP_PSEL_PSEL_AnalogInput6, /**< Input 6. */ + NRF_LPCOMP_INPUT_7 = LPCOMP_PSEL_PSEL_AnalogInput7 /**< Input 7. */ +} nrf_lpcomp_input_t; + +/** + * @enum nrf_lpcomp_detect_t + * @brief LPCOMP detection type selection. + */ +typedef enum +{ + NRF_LPCOMP_DETECT_CROSS = LPCOMP_ANADETECT_ANADETECT_Cross, /**< Generate ANADETEC on crossing, both upwards and downwards crossing. */ + NRF_LPCOMP_DETECT_UP = LPCOMP_ANADETECT_ANADETECT_Up, /**< Generate ANADETEC on upwards crossing only. */ + NRF_LPCOMP_DETECT_DOWN = LPCOMP_ANADETECT_ANADETECT_Down /**< Generate ANADETEC on downwards crossing only. */ +} nrf_lpcomp_detect_t; + +/** + * @enum nrf_lpcomp_task_t + * @brief LPCOMP tasks. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_LPCOMP_TASK_START = offsetof(NRF_LPCOMP_Type, TASKS_START), /**< LPCOMP start sampling task. */ + NRF_LPCOMP_TASK_STOP = offsetof(NRF_LPCOMP_Type, TASKS_STOP), /**< LPCOMP stop sampling task. */ + NRF_LPCOMP_TASK_SAMPLE = offsetof(NRF_LPCOMP_Type, TASKS_SAMPLE) /**< Sample comparator value. */ +} nrf_lpcomp_task_t; /*lint -restore*/ + + +/** + * @enum nrf_lpcomp_event_t + * @brief LPCOMP events. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_LPCOMP_EVENT_READY = offsetof(NRF_LPCOMP_Type, EVENTS_READY), /**< LPCOMP is ready and output is valid. */ + NRF_LPCOMP_EVENT_DOWN = offsetof(NRF_LPCOMP_Type, EVENTS_DOWN), /**< Input voltage crossed the threshold going down. */ + NRF_LPCOMP_EVENT_UP = offsetof(NRF_LPCOMP_Type, EVENTS_UP), /**< Input voltage crossed the threshold going up. */ + NRF_LPCOMP_EVENT_CROSS = offsetof(NRF_LPCOMP_Type, EVENTS_CROSS) /**< Input voltage crossed the threshold in any direction. */ +} nrf_lpcomp_event_t; /*lint -restore*/ + +/** + * @enum nrf_lpcomp_short_mask_t + * @brief LPCOMP shorts masks. + */ +typedef enum +{ + NRF_LPCOMP_SHORT_CROSS_STOP_MASK = LPCOMP_SHORTS_CROSS_STOP_Msk, /*!< Short between CROSS event and STOP task. */ + NRF_LPCOMP_SHORT_UP_STOP_MASK = LPCOMP_SHORTS_UP_STOP_Msk, /*!< Short between UP event and STOP task. */ + NRF_LPCOMP_SHORT_DOWN_STOP_MASK = LPCOMP_SHORTS_DOWN_STOP_Msk, /*!< Short between DOWN event and STOP task. */ + NRF_LPCOMP_SHORT_READY_STOP_MASK = LPCOMP_SHORTS_READY_STOP_Msk, /*!< Short between READY event and STOP task. */ + NRF_LPCOMP_SHORT_READY_SAMPLE_MASK = LPCOMP_SHORTS_READY_SAMPLE_Msk /*!< Short between READY event and SAMPLE task. */ +} nrf_lpcomp_short_mask_t; + +#ifdef NRF52_SERIES +/** + * @enum nrf_lpcomp_hysteresis_t + * @brief LPCOMP hysteresis. + */ +typedef enum +{ + NRF_LPCOMP_HYST_NOHYST = LPCOMP_HYST_HYST_NoHyst, /**< Comparator hysteresis disabled. */ + NRF_LPCOMP_HYST_50mV = LPCOMP_HYST_HYST_Hyst50mV /**< Comparator hysteresis enabled (typ. 50 mV). */ +}nrf_lpcomp_hysteresis_t; +#endif // NRF52 + +/** @brief LPCOMP configuration. */ +typedef struct +{ + nrf_lpcomp_ref_t reference; /**< LPCOMP reference. */ + nrf_lpcomp_detect_t detection; /**< LPCOMP detection type. */ +#ifdef NRF52_SERIES + nrf_lpcomp_hysteresis_t hyst; /**< LPCOMP hysteresis. */ +#endif // NRF52 +} nrf_lpcomp_config_t; + +/** Default LPCOMP configuration. */ +#define NRF_LPCOMP_CONFIG_DEFAULT { NRF_LPCOMP_REF_SUPPLY_FOUR_EIGHT, NRF_LPCOMP_DETECT_DOWN } + +/** + * @brief Function for configuring LPCOMP. + * + * This function powers on LPCOMP and configures it. LPCOMP is in DISABLE state after configuration, + * so it must be enabled before using it. All shorts are inactive, events are cleared, and LPCOMP is stopped. + * + * @param[in] p_config Configuration. + */ +__STATIC_INLINE void nrf_lpcomp_configure(const nrf_lpcomp_config_t * p_config) +{ + NRF_LPCOMP->TASKS_STOP = 1; + NRF_LPCOMP->ENABLE = LPCOMP_ENABLE_ENABLE_Disabled << LPCOMP_ENABLE_ENABLE_Pos; + NRF_LPCOMP->REFSEL = + (p_config->reference << LPCOMP_REFSEL_REFSEL_Pos) & LPCOMP_REFSEL_REFSEL_Msk; + + //If external source is choosen extract analog reference index. + if ((p_config->reference & LPCOMP_REFSEL_REFSEL_ARef)==LPCOMP_REFSEL_REFSEL_ARef) + { + uint32_t extref = p_config->reference >> 16; + NRF_LPCOMP->EXTREFSEL = (extref << LPCOMP_EXTREFSEL_EXTREFSEL_Pos) & LPCOMP_EXTREFSEL_EXTREFSEL_Msk; + } + + NRF_LPCOMP->ANADETECT = + (p_config->detection << LPCOMP_ANADETECT_ANADETECT_Pos) & LPCOMP_ANADETECT_ANADETECT_Msk; +#ifdef NRF52_SERIES + NRF_LPCOMP->HYST = ((p_config->hyst) << LPCOMP_HYST_HYST_Pos) & LPCOMP_HYST_HYST_Msk; +#endif + NRF_LPCOMP->SHORTS = 0; + NRF_LPCOMP->INTENCLR = LPCOMP_INTENCLR_CROSS_Msk | LPCOMP_INTENCLR_UP_Msk | + LPCOMP_INTENCLR_DOWN_Msk | LPCOMP_INTENCLR_READY_Msk; +} + + +/** + * @brief Function for selecting the LPCOMP input. + * + * This function selects the active input of LPCOMP. + * + * @param[in] input Input to be selected. + */ +__STATIC_INLINE void nrf_lpcomp_input_select(nrf_lpcomp_input_t input) +{ + uint32_t lpcomp_enable_state = NRF_LPCOMP->ENABLE; + + NRF_LPCOMP->ENABLE = LPCOMP_ENABLE_ENABLE_Disabled << LPCOMP_ENABLE_ENABLE_Pos; + NRF_LPCOMP->PSEL = + ((uint32_t)input << LPCOMP_PSEL_PSEL_Pos) | (NRF_LPCOMP->PSEL & ~LPCOMP_PSEL_PSEL_Msk); + NRF_LPCOMP->ENABLE = lpcomp_enable_state; +} + + +/** + * @brief Function for enabling the Low Power Comparator. + * + * This function enables LPCOMP. + * + */ +__STATIC_INLINE void nrf_lpcomp_enable(void) +{ + NRF_LPCOMP->ENABLE = LPCOMP_ENABLE_ENABLE_Enabled << LPCOMP_ENABLE_ENABLE_Pos; + NRF_LPCOMP->EVENTS_READY = 0; + NRF_LPCOMP->EVENTS_DOWN = 0; + NRF_LPCOMP->EVENTS_UP = 0; + NRF_LPCOMP->EVENTS_CROSS = 0; +} + + +/** + * @brief Function for disabling the Low Power Comparator. + * + * This function disables LPCOMP. + * + */ +__STATIC_INLINE void nrf_lpcomp_disable(void) +{ + NRF_LPCOMP->ENABLE = LPCOMP_ENABLE_ENABLE_Disabled << LPCOMP_ENABLE_ENABLE_Pos; +} + + +/** + * @brief Function for getting the last LPCOMP compare result. + * + * @return The last compare result. If 0 then VIN+ < VIN-, if 1 then the opposite. + */ +__STATIC_INLINE uint32_t nrf_lpcomp_result_get(void) +{ + return (uint32_t)NRF_LPCOMP->RESULT; +} + + +/** + * @brief Function for enabling interrupts from LPCOMP. + * + * @param[in] lpcomp_int_mask Mask of interrupts to be enabled. + * + * @sa nrf_lpcomp_int_disable() + * @sa nrf_lpcomp_int_enable_check() + */ +__STATIC_INLINE void nrf_lpcomp_int_enable(uint32_t lpcomp_int_mask) +{ + NRF_LPCOMP->INTENSET = lpcomp_int_mask; +} + + +/** + * @brief Function for disabling interrupts from LPCOMP. + * + * @param[in] lpcomp_int_mask Mask of interrupts to be disabled. + * + * @sa nrf_lpcomp_int_enable() + * @sa nrf_lpcomp_int_enable_check() + */ +__STATIC_INLINE void nrf_lpcomp_int_disable(uint32_t lpcomp_int_mask) +{ + NRF_LPCOMP->INTENCLR = lpcomp_int_mask; +} + + +/** + * @brief Function for getting the enabled interrupts of LPCOMP. + * + * @param[in] lpcomp_int_mask Mask of interrupts to be checked. + * + * @retval true If any of interrupts of the specified mask are enabled. + * + * @sa nrf_lpcomp_int_enable() + * @sa nrf_lpcomp_int_disable() + */ +__STATIC_INLINE bool nrf_lpcomp_int_enable_check(uint32_t lpcomp_int_mask) +{ + return (NRF_LPCOMP->INTENSET & lpcomp_int_mask); // when read this register will return the value of INTEN. +} + + +/** + * @brief Function for getting the address of a specific LPCOMP task register. + * + * @param[in] lpcomp_task LPCOMP task. + * + * @return The address of the specified LPCOMP task. + */ +__STATIC_INLINE uint32_t * nrf_lpcomp_task_address_get(nrf_lpcomp_task_t lpcomp_task) +{ + return (uint32_t *)((uint8_t *)NRF_LPCOMP + lpcomp_task); +} + + +/** + * @brief Function for getting the address of a specific LPCOMP event register. + * + * @param[in] lpcomp_event LPCOMP event. + * + * @return The address of the specified LPCOMP event. + */ +__STATIC_INLINE uint32_t * nrf_lpcomp_event_address_get(nrf_lpcomp_event_t lpcomp_event) +{ + return (uint32_t *)((uint8_t *)NRF_LPCOMP + lpcomp_event); +} + + +/** + * @brief Function for setting LPCOMP shorts. + * + * @param[in] lpcomp_short_mask LPCOMP shorts by mask. + * + */ +__STATIC_INLINE void nrf_lpcomp_shorts_enable(uint32_t lpcomp_short_mask) +{ + NRF_LPCOMP->SHORTS |= lpcomp_short_mask; +} + + +/** + * @brief Function for clearing LPCOMP shorts by mask. + * + * @param[in] lpcomp_short_mask LPCOMP shorts to be cleared. + * + */ +__STATIC_INLINE void nrf_lpcomp_shorts_disable(uint32_t lpcomp_short_mask) +{ + NRF_LPCOMP->SHORTS &= ~lpcomp_short_mask; +} + + +/** + * @brief Function for setting a specific LPCOMP task. + * + * @param[in] lpcomp_task LPCOMP task to be set. + * + */ +__STATIC_INLINE void nrf_lpcomp_task_trigger(nrf_lpcomp_task_t lpcomp_task) +{ + *( (volatile uint32_t *)( (uint8_t *)NRF_LPCOMP + lpcomp_task) ) = 1; +} + + +/** + * @brief Function for clearing a specific LPCOMP event. + * + * @param[in] lpcomp_event LPCOMP event to be cleared. + * + */ +__STATIC_INLINE void nrf_lpcomp_event_clear(nrf_lpcomp_event_t lpcomp_event) +{ + *( (volatile uint32_t *)( (uint8_t *)NRF_LPCOMP + lpcomp_event) ) = 0; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_LPCOMP + lpcomp_event)); + (void)dummy; +#endif +} + + +/** + * @brief Function for getting the state of a specific LPCOMP event. + * + * @retval true If the specified LPCOMP event is active. + * + */ +__STATIC_INLINE bool nrf_lpcomp_event_check(nrf_lpcomp_event_t lpcomp_event) +{ + return (bool) (*(volatile uint32_t *)( (uint8_t *)NRF_LPCOMP + lpcomp_event)); +} + + +/** + *@} + **/ + + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_LPCOMP_H_ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.c index de2a52db8c..c13dcd5c04 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.c @@ -35,11 +35,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -/** +/** *@file - *@brief NMVC driver implementation + *@brief NMVC driver implementation */ #include @@ -48,96 +47,96 @@ void nrf_nvmc_page_erase(uint32_t address) -{ - // Enable erase. - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy) - { - } +{ + // Enable erase. + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } - // Erase the page - NRF_NVMC->ERASEPAGE = address; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy) - { - } - - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy) - { - } + // Erase the page + NRF_NVMC->ERASEPAGE = address; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } + + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } } void nrf_nvmc_write_byte(uint32_t address, uint8_t value) { - uint32_t byte_shift = address & (uint32_t)0x03; - uint32_t address32 = address & ~byte_shift; // Address to the word this byte is in. - uint32_t value32 = (*(uint32_t*)address32 & ~((uint32_t)0xFF << (byte_shift << (uint32_t)3))); - value32 = value32 + ((uint32_t)value << (byte_shift << 3)); + uint32_t byte_shift = address & (uint32_t)0x03; + uint32_t address32 = address & ~byte_shift; // Address to the word this byte is in. + uint32_t value32 = (*(uint32_t*)address32 & ~((uint32_t)0xFF << (byte_shift << (uint32_t)3))); + value32 = value32 + ((uint32_t)value << (byte_shift << 3)); - // Enable write. - NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos); - while (NRF_NVMC->READY == NVMC_READY_READY_Busy) - { - } + // Enable write. + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos); + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } - *(uint32_t*)address32 = value32; - while(NRF_NVMC->READY == NVMC_READY_READY_Busy) - { - } + *(uint32_t*)address32 = value32; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } - NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); - { - } + NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); + { + } } void nrf_nvmc_write_word(uint32_t address, uint32_t value) { - // Enable write. - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } + // Enable write. + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ + } - *(uint32_t*)address = value; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } + *(uint32_t*)address = value; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ + } - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy) - { - } + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } } void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes) { - uint32_t i; - for(i=0;iCONFIG = NVMC_CONFIG_WEN_Wen; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy) - { - } - - for(i=0;iCONFIG = NVMC_CONFIG_WEN_Wen; while (NRF_NVMC->READY == NVMC_READY_READY_Busy) { } - } - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy) - { - } + for (i=0;iREADY == NVMC_READY_READY_Busy) + { + } + } + + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) + { + } } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.h index 59b23f1845..76c2690b9b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_nvmc.h @@ -36,7 +36,6 @@ * */ - /** * @file * @brief NMVC driver API. @@ -47,6 +46,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup nrf_nvmc Non-volatile memory controller @@ -65,7 +68,7 @@ * @brief Erase a page in flash. This is required before writing to any * address in the page. * - * @param address Start address of the page. + * @param address Start address of the page. */ void nrf_nvmc_page_erase(uint32_t address); @@ -83,7 +86,7 @@ void nrf_nvmc_write_byte(uint32_t address , uint8_t value); /** - * @brief Write a 32-bit word to flash. + * @brief Write a 32-bit word to flash. * @param address Address to write to. * @param value Value to write. */ @@ -102,7 +105,7 @@ void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_b /** * @brief Write consecutive words to flash. - * + * * @param address Address to write to. * @param src Pointer to data to copy from. * @param num_words Number of bytes in src to write. @@ -110,6 +113,11 @@ void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_b void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words); + +#ifdef __cplusplus +} +#endif + #endif // NRF_NVMC_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pdm.h index be41fdfae0..ab7d533f6a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pdm.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pdm.h @@ -37,7 +37,6 @@ */ - #ifndef NRF_PDM_H_ #define NRF_PDM_H_ @@ -54,6 +53,10 @@ #include "nrf.h" #include "nrf_assert.h" +#ifdef __cplusplus +extern "C" { +#endif + #define NRF_PDM_GAIN_MINIMUM 0x00 #define NRF_PDM_GAIN_DEFAULT 0x28 @@ -169,6 +172,10 @@ __STATIC_INLINE bool nrf_pdm_event_check(nrf_pdm_event_t pdm_event) __STATIC_INLINE void nrf_pdm_event_clear(nrf_pdm_event_t pdm_event) { *((volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_event)); + (void)dummy; +#endif } @@ -308,10 +315,8 @@ __STATIC_INLINE nrf_pdm_freq_t nrf_pdm_clock_get(void) */ __STATIC_INLINE void nrf_pdm_psel_connect(uint32_t psel_clk, uint32_t psel_din) { - NRF_PDM->PSEL.CLK = ((psel_clk << PDM_PSEL_CLK_PIN_Pos) & PDM_PSEL_CLK_PIN_Msk) - | ((PDM_PSEL_CLK_CONNECT_Connected << PDM_PSEL_CLK_CONNECT_Pos) & PDM_PSEL_CLK_CONNECT_Msk); - NRF_PDM->PSEL.DIN = ((psel_din << PDM_PSEL_DIN_PIN_Pos) & PDM_PSEL_DIN_PIN_Msk) - | ((PDM_PSEL_DIN_CONNECT_Connected << PDM_PSEL_CLK_CONNECT_Pos) & PDM_PSEL_DIN_CONNECT_Msk); + NRF_PDM->PSEL.CLK = psel_clk; + NRF_PDM->PSEL.DIN = psel_din; } /** @@ -319,9 +324,9 @@ __STATIC_INLINE void nrf_pdm_psel_connect(uint32_t psel_clk, uint32_t psel_din) */ __STATIC_INLINE void nrf_pdm_psel_disconnect() { - NRF_PDM->PSEL.CLK = ((PDM_PSEL_CLK_CONNECT_Disconnected << PDM_PSEL_CLK_CONNECT_Pos) + NRF_PDM->PSEL.CLK = ((PDM_PSEL_CLK_CONNECT_Disconnected << PDM_PSEL_CLK_CONNECT_Pos) & PDM_PSEL_CLK_CONNECT_Msk); - NRF_PDM->PSEL.DIN = ((PDM_PSEL_DIN_CONNECT_Disconnected << PDM_PSEL_DIN_CONNECT_Pos) + NRF_PDM->PSEL.DIN = ((PDM_PSEL_DIN_CONNECT_Disconnected << PDM_PSEL_DIN_CONNECT_Pos) & PDM_PSEL_DIN_CONNECT_Msk); } @@ -383,4 +388,9 @@ __STATIC_INLINE uint32_t * nrf_pdm_buffer_get() *@} **/ + +#ifdef __cplusplus +} +#endif + #endif /* NRF_PDM_H_ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_peripherals.h similarity index 79% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_peripherals.h index 8f5d83ba0c..0d8f6d538b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_peripherals.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,24 +36,33 @@ * */ - -/** @file - * - * @defgroup memory_pool_internal Memory Pool Internal - * @{ - * @ingroup memory_pool - * - * @brief Memory pool internal definitions - */ - -#ifndef MEM_POOL_INTERNAL_H__ -#define MEM_POOL_INTERNAL_H__ +#ifndef NRF_PERIPHERALS_H +#define NRF_PERIPHERALS_H -#define TX_BUF_SIZE 32u /**< TX buffer size in bytes. */ -#define RX_BUF_SIZE 600u /**< RX buffer size in bytes. */ +/*lint ++flb "Enter library region */ + +#ifdef NRF51422 +#include "nrf51422_peripherals.h" +#endif + +#ifdef NRF51802 +#include "nrf51802_peripherals.h" +#endif + +#ifdef NRF51822 +#include "nrf51822_peripherals.h" +#endif + +#ifdef NRF52832 +#include "nrf52832_peripherals.h" +#endif + +#ifdef NRF52840_XXAA +#include "nrf52840_peripherals.h" +#endif + + +/*lint --flb "Leave library region" */ + +#endif /* NRF_PERIPHERALS_H */ -#define RX_BUF_QUEUE_SIZE 2u /**< RX buffer element size. */ - -#endif // MEM_POOL_INTERNAL_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ppi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ppi.h index b501240fef..1380ae755b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ppi.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_ppi.h @@ -36,12 +36,16 @@ * */ - #ifndef NRF_PPI_H__ #define NRF_PPI_H__ #include #include "nrf.h" +#include "nrf_peripherals.h" + +#ifdef __cplusplus +extern "C" { +#endif /** * @defgroup nrf_ppi_hal PPI HAL @@ -74,7 +78,7 @@ typedef enum NRF_PPI_CHANNEL13 = PPI_CHEN_CH13_Pos, /**< Channel 13. */ NRF_PPI_CHANNEL14 = PPI_CHEN_CH14_Pos, /**< Channel 14. */ NRF_PPI_CHANNEL15 = PPI_CHEN_CH15_Pos, /**< Channel 15. */ -#ifdef NRF52 +#if (PPI_CH_NUM > 16) || defined(__SDK_DOXYGEN__) NRF_PPI_CHANNEL16 = PPI_CHEN_CH16_Pos, /**< Channel 16. */ NRF_PPI_CHANNEL17 = PPI_CHEN_CH17_Pos, /**< Channel 17. */ NRF_PPI_CHANNEL18 = PPI_CHEN_CH18_Pos, /**< Channel 18. */ @@ -104,7 +108,7 @@ typedef enum NRF_PPI_CHANNEL_GROUP1 = 1, /**< Channel group 1. */ NRF_PPI_CHANNEL_GROUP2 = 2, /**< Channel group 2. */ NRF_PPI_CHANNEL_GROUP3 = 3, /**< Channel group 3. */ -#ifdef NRF52 +#if (PPI_GROUP_NUM > 4) || defined(__SDK_DOXYGEN__) NRF_PPI_CHANNEL_GROUP4 = 4, /**< Channel group 4. */ NRF_PPI_CHANNEL_GROUP5 = 5 /**< Channel group 5. */ #endif @@ -145,7 +149,7 @@ typedef enum NRF_PPI_TASK_CHG2_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[2].DIS), /**< Task for disabling channel group 2 */ NRF_PPI_TASK_CHG3_EN = offsetof(NRF_PPI_Type, TASKS_CHG[3].EN), /**< Task for enabling channel group 3 */ NRF_PPI_TASK_CHG3_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[3].DIS), /**< Task for disabling channel group 3 */ -#ifdef NRF52 +#if (PPI_GROUP_NUM > 4) || defined(__SDK_DOXYGEN__) NRF_PPI_TASK_CHG4_EN = offsetof(NRF_PPI_Type, TASKS_CHG[4].EN), /**< Task for enabling channel group 4 */ NRF_PPI_TASK_CHG4_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[4].DIS), /**< Task for disabling channel group 4 */ NRF_PPI_TASK_CHG5_EN = offsetof(NRF_PPI_Type, TASKS_CHG[5].EN), /**< Task for enabling channel group 5 */ @@ -240,7 +244,7 @@ __STATIC_INLINE void nrf_ppi_channel_endpoint_setup(nrf_ppi_channel_t channel, NRF_PPI->CH[(uint32_t) channel].TEP = tep; } -#ifdef NRF52 +#if defined(PPI_FEATURE_FORKS_PRESENT) || defined(__SDK_DOXYGEN__) /** * @brief Function for setting up task endpoint for a given PPI fork. * @@ -426,4 +430,9 @@ __STATIC_INLINE uint32_t * nrf_ppi_task_group_disable_address_get(nrf_ppi_channe **/ /*lint --flb "Leave library region" */ + +#ifdef __cplusplus +} +#endif + #endif // NRF_PPI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pwm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pwm.h index 2dce14fd44..408f70bf65 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pwm.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_pwm.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ /** @@ -22,8 +48,6 @@ #ifndef NRF_PWM_H__ #define NRF_PWM_H__ -#ifdef NRF52 - #include #include #include @@ -31,6 +55,10 @@ #include "nrf.h" #include "nrf_assert.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief This value can be provided as a parameter for the @ref nrf_pwm_pins_set @@ -40,7 +68,7 @@ #define NRF_PWM_PIN_NOT_CONNECTED 0xFFFFFFFF /** - * @brief Number of channels in each PWM instance. + * @brief Number of channels in each Pointer to the peripheral registers structure. */ #define NRF_PWM_CHANNEL_COUNT 4 @@ -241,140 +269,140 @@ typedef struct * @brief Helper macro for calculating the number of 16-bit values in specified * array of duty cycle values. */ -#define NRF_PWM_VALUES_LENGTH(array) (sizeof(array)/sizeof(uint16_t)) +#define NRF_PWM_VALUES_LENGTH(array) (sizeof(array) / sizeof(uint16_t)) /** * @brief Function for activating a specific PWM task. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] task Task to activate. */ -__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_reg, nrf_pwm_task_t task); /** * @brief Function for getting the address of a specific PWM task register. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] task Requested task. * * @return Address of the specified task register. */ -__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_pwm, +__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_reg, nrf_pwm_task_t task); /** * @brief Function for clearing a specific PWM event. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Event to clear. */ -__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_reg, nrf_pwm_event_t event); /** * @brief Function for checking the state of a specific PWM event. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Event to check. * * @retval true If the event is set. * @retval false If the event is not set. */ -__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_pwm, +__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_reg, nrf_pwm_event_t event); /** * @brief Function for getting the address of a specific PWM event register. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Requested event. * * @return Address of the specified event register. */ -__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_pwm, +__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_reg, nrf_pwm_event_t event); /** * @brief Function for enabling specified shortcuts. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] pwm_shorts_mask Shortcuts to enable. */ -__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_reg, uint32_t pwm_shorts_mask); /** * @brief Function for disabling specified shortcuts. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] pwm_shorts_mask Shortcuts to disable. */ -__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_reg, uint32_t pwm_shorts_mask); /** * @brief Function for setting the configuration of PWM shortcuts. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] pwm_shorts_mask Shortcuts configuration to set. */ -__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_reg, uint32_t pwm_shorts_mask); /** * @brief Function for enabling specified interrupts. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] pwm_int_mask Interrupts to enable. */ -__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_reg, uint32_t pwm_int_mask); /** * @brief Function for disabling specified interrupts. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] pwm_int_mask Interrupts to disable. */ -__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_reg, uint32_t pwm_int_mask); /** * @brief Function for setting the configuration of PWM interrupts. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] pwm_int_mask Interrupts configuration to set. */ -__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_reg, uint32_t pwm_int_mask); /** * @brief Function for retrieving the state of a given interrupt. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] pwm_int Interrupt to check. * * @retval true If the interrupt is enabled. * @retval false If the interrupt is not enabled. */ -__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_pwm, +__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_reg, nrf_pwm_int_mask_t pwm_int); /** * @brief Function for enabling the PWM peripheral. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_pwm); +__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_reg); /** * @brief Function for disabling the PWM peripheral. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm); +__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_reg); /** * @brief Function for assigning pins to PWM output channels. @@ -383,21 +411,21 @@ __STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm); * needed, pass the @ref NRF_PWM_PIN_NOT_CONNECTED value instead of its pin * number. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] out_pins Array with pin numbers for individual PWM output channels. */ -__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_reg, uint32_t out_pins[NRF_PWM_CHANNEL_COUNT]); /** * @brief Function for configuring the PWM peripheral. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] base_clock Base clock frequency. * @param[in] mode Operating mode of the pulse generator counter. * @param[in] top_value Value up to which the pulse generator counter counts. */ -__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_reg, nrf_pwm_clk_t base_clock, nrf_pwm_mode_t mode, uint16_t top_value); @@ -405,11 +433,11 @@ __STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm, /** * @brief Function for defining a sequence of PWM duty cycles. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] seq_id Identifier of the sequence (0 or 1). * @param[in] p_seq Pointer to the sequence definition. */ -__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_reg, uint8_t seq_id, nrf_pwm_sequence_t const * p_seq); @@ -417,11 +445,11 @@ __STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm, * @brief Function for modifying the pointer to the duty cycle values * in the specified sequence. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] seq_id Identifier of the sequence (0 or 1). * @param[in] p_values Pointer to an array with duty cycle values. */ -__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_reg, uint8_t seq_id, uint16_t const * p_values); @@ -429,11 +457,11 @@ __STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm, * @brief Function for modifying the total number of duty cycle values * in the specified sequence. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] seq_id Identifier of the sequence (0 or 1). * @param[in] length Number of duty cycle values. */ -__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_reg, uint8_t seq_id, uint16_t length); @@ -441,11 +469,11 @@ __STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm, * @brief Function for modifying the additional number of PWM periods spent * on each duty cycle value in the specified sequence. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] seq_id Identifier of the sequence (0 or 1). * @param[in] refresh Number of additional PWM periods for each duty cycle value. */ -__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_reg, uint8_t seq_id, uint32_t refresh); @@ -453,11 +481,11 @@ __STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm, * @brief Function for modifying the additional time added after the sequence * is played. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] seq_id Identifier of the sequence (0 or 1). * @param[in] end_delay Number of PWM periods added at the end of the sequence. */ -__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_reg, uint8_t seq_id, uint32_t end_delay); @@ -465,11 +493,11 @@ __STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm, * @brief Function for setting the mode of loading sequence data from RAM * and advancing the sequence. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] dec_load Mode of loading sequence data from RAM. * @param[in] dec_step Mode of advancing the active sequence. */ -__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_reg, nrf_pwm_dec_load_t dec_load, nrf_pwm_dec_step_t dec_step); @@ -480,185 +508,192 @@ __STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm, * This function applies to two-sequence playback (concatenated sequence 0 and 1). * A single sequence can be played back only once. * - * @param[in] p_pwm PWM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] loop_count Number of times to perform the sequence playback. */ -__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_reg, uint16_t loop_count); #ifndef SUPPRESS_INLINE_IMPLEMENTATION -__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_reg, nrf_pwm_task_t task) { - *((volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)task)) = 0x1UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL; } -__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_pwm, +__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_reg, nrf_pwm_task_t task) { - return ((uint32_t)p_pwm + (uint32_t)task); + return ((uint32_t)p_reg + (uint32_t)task); } -__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_reg, nrf_pwm_event_t event) { - *((volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)event)) = 0x0UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)); + (void)dummy; +#endif } -__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_pwm, +__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_reg, nrf_pwm_event_t event) { - return (bool)*(volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)event); + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event); } -__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_pwm, +__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_reg, nrf_pwm_event_t event) { - return ((uint32_t)p_pwm + (uint32_t)event); + return ((uint32_t)p_reg + (uint32_t)event); } -__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_reg, uint32_t pwm_shorts_mask) { - p_pwm->SHORTS |= pwm_shorts_mask; + p_reg->SHORTS |= pwm_shorts_mask; } -__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_reg, uint32_t pwm_shorts_mask) { - p_pwm->SHORTS &= ~(pwm_shorts_mask); + p_reg->SHORTS &= ~(pwm_shorts_mask); } -__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_reg, uint32_t pwm_shorts_mask) { - p_pwm->SHORTS = pwm_shorts_mask; + p_reg->SHORTS = pwm_shorts_mask; } -__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_reg, uint32_t pwm_int_mask) { - p_pwm->INTENSET = pwm_int_mask; + p_reg->INTENSET = pwm_int_mask; } -__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_reg, uint32_t pwm_int_mask) { - p_pwm->INTENCLR = pwm_int_mask; + p_reg->INTENCLR = pwm_int_mask; } -__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_reg, uint32_t pwm_int_mask) { - p_pwm->INTEN = pwm_int_mask; + p_reg->INTEN = pwm_int_mask; } -__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_pwm, +__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_reg, nrf_pwm_int_mask_t pwm_int) { - return (bool)(p_pwm->INTENSET & pwm_int); + return (bool)(p_reg->INTENSET & pwm_int); } -__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_pwm) +__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_reg) { - p_pwm->ENABLE = (PWM_ENABLE_ENABLE_Enabled << PWM_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (PWM_ENABLE_ENABLE_Enabled << PWM_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm) +__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_reg) { - p_pwm->ENABLE = (PWM_ENABLE_ENABLE_Disabled << PWM_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (PWM_ENABLE_ENABLE_Disabled << PWM_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_reg, uint32_t out_pins[NRF_PWM_CHANNEL_COUNT]) { uint8_t i; for (i = 0; i < NRF_PWM_CHANNEL_COUNT; ++i) { - p_pwm->PSEL.OUT[i] = out_pins[i]; + p_reg->PSEL.OUT[i] = out_pins[i]; } } -__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_reg, nrf_pwm_clk_t base_clock, nrf_pwm_mode_t mode, uint16_t top_value) { ASSERT(top_value <= PWM_COUNTERTOP_COUNTERTOP_Msk); - p_pwm->PRESCALER = base_clock; - p_pwm->MODE = mode; - p_pwm->COUNTERTOP = top_value; + p_reg->PRESCALER = base_clock; + p_reg->MODE = mode; + p_reg->COUNTERTOP = top_value; } -__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_reg, uint8_t seq_id, nrf_pwm_sequence_t const * p_seq) { ASSERT(p_seq != NULL); - nrf_pwm_seq_ptr_set( p_pwm, seq_id, p_seq->values.p_raw); - nrf_pwm_seq_cnt_set( p_pwm, seq_id, p_seq->length); - nrf_pwm_seq_refresh_set( p_pwm, seq_id, p_seq->repeats); - nrf_pwm_seq_end_delay_set(p_pwm, seq_id, p_seq->end_delay); + nrf_pwm_seq_ptr_set( p_reg, seq_id, p_seq->values.p_raw); + nrf_pwm_seq_cnt_set( p_reg, seq_id, p_seq->length); + nrf_pwm_seq_refresh_set( p_reg, seq_id, p_seq->repeats); + nrf_pwm_seq_end_delay_set(p_reg, seq_id, p_seq->end_delay); } -__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_reg, uint8_t seq_id, uint16_t const * p_values) { ASSERT(seq_id <= 1); ASSERT(p_values != NULL); - p_pwm->SEQ[seq_id].PTR = (uint32_t)p_values; + p_reg->SEQ[seq_id].PTR = (uint32_t)p_values; } -__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_reg, uint8_t seq_id, uint16_t length) { ASSERT(seq_id <= 1); ASSERT(length != 0); ASSERT(length <= PWM_SEQ_CNT_CNT_Msk); - p_pwm->SEQ[seq_id].CNT = length; + p_reg->SEQ[seq_id].CNT = length; } -__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_reg, uint8_t seq_id, uint32_t refresh) { ASSERT(seq_id <= 1); ASSERT(refresh <= PWM_SEQ_REFRESH_CNT_Msk); - p_pwm->SEQ[seq_id].REFRESH = refresh; + p_reg->SEQ[seq_id].REFRESH = refresh; } -__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_reg, uint8_t seq_id, uint32_t end_delay) { ASSERT(seq_id <= 1); ASSERT(end_delay <= PWM_SEQ_ENDDELAY_CNT_Msk); - p_pwm->SEQ[seq_id].ENDDELAY = end_delay; + p_reg->SEQ[seq_id].ENDDELAY = end_delay; } -__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_reg, nrf_pwm_dec_load_t dec_load, nrf_pwm_dec_step_t dec_step) { - p_pwm->DECODER = ((uint32_t)dec_load << PWM_DECODER_LOAD_Pos) | + p_reg->DECODER = ((uint32_t)dec_load << PWM_DECODER_LOAD_Pos) | ((uint32_t)dec_step << PWM_DECODER_MODE_Pos); } -__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_pwm, +__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_reg, uint16_t loop_count) { - p_pwm->LOOP = loop_count; + p_reg->LOOP = loop_count; } #endif // SUPPRESS_INLINE_IMPLEMENTATION -#endif // NRF52 + +#ifdef __cplusplus +} +#endif #endif // NRF_PWM_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_qdec.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_qdec.h new file mode 100644 index 0000000000..bf13f40f06 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_qdec.h @@ -0,0 +1,502 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef NRF_QDEC_H__ +#define NRF_QDEC_H__ + +#include +#include "nrf_error.h" +#include "nrf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*lint ++flb "Enter library region" */ + +/** + * @defgroup nrf_qdec_hal QDEC HAL + * @{ + * @ingroup nrf_qdec + * @brief Hardware access layer for accessing the quadrature decoder (QDEC) peripheral. + */ + +/** + * @enum nrf_qdec_task_t + * @brief QDEC tasks. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_QDEC_TASK_START = offsetof(NRF_QDEC_Type, TASKS_START), /**< Starting the quadrature decoder. */ + NRF_QDEC_TASK_STOP = offsetof(NRF_QDEC_Type, TASKS_STOP), /**< Stopping the quadrature decoder. */ + NRF_QDEC_TASK_READCLRACC = offsetof(NRF_QDEC_Type, TASKS_READCLRACC) /**< Reading and clearing ACC and ACCDBL registers. */ +} nrf_qdec_task_t; + +/** + * @enum nrf_qdec_event_t + * @brief QDEC events. + */ +typedef enum +{ + NRF_QDEC_EVENT_SAMPLERDY = offsetof(NRF_QDEC_Type, EVENTS_SAMPLERDY), /**< Event generated for every new sample. */ + NRF_QDEC_EVENT_REPORTRDY = offsetof(NRF_QDEC_Type, EVENTS_REPORTRDY), /**< Event generated for every new report. */ + NRF_QDEC_EVENT_ACCOF = offsetof(NRF_QDEC_Type, EVENTS_ACCOF) /**< Event generated for every accumulator overflow. */ +} nrf_qdec_event_t; /*lint -restore */ + +/** + * @enum nrf_qdec_short_mask_t + * @brief QDEC shortcuts. + */ +typedef enum +{ + NRF_QDEC_SHORT_REPORTRDY_READCLRACC_MASK = QDEC_SHORTS_REPORTRDY_READCLRACC_Msk, /**< Shortcut between REPORTRDY event and READCLRACC task. */ + NRF_QDEC_SHORT_SAMPLERDY_STOP_MASK = QDEC_SHORTS_SAMPLERDY_STOP_Msk /**< Shortcut between SAMPLERDY event and STOP task. */ +} nrf_qdec_short_mask_t; + +/** + * @enum nrf_qdec_int_mask_t + * @brief QDEC interrupts. + */ +typedef enum +{ + NRF_QDEC_INT_SAMPLERDY_MASK = QDEC_INTENSET_SAMPLERDY_Msk, /**< Mask for enabling or disabling an interrupt on SAMPLERDY event. */ + NRF_QDEC_INT_REPORTRDY_MASK = QDEC_INTENSET_REPORTRDY_Msk, /**< Mask for enabling or disabling an interrupt on REPORTRDY event. */ + NRF_QDEC_INT_ACCOF_MASK = QDEC_INTENSET_ACCOF_Msk /**< Mask for enabling or disabling an interrupt on ACCOF event. */ +} nrf_qdec_int_mask_t; + +/** + * @enum nrf_qdec_enable_t + * @brief States of the enable bit. + */ +typedef enum +{ + NRF_QDEC_DISABLE = QDEC_ENABLE_ENABLE_Disabled, /**< Mask for disabling the QDEC periperal. When disabled, the QDEC decoder pins are not active. */ + NRF_QDEC_ENABLE = QDEC_ENABLE_ENABLE_Enabled /**< Mask for enabling the QDEC periperal. When enabled, the QDEC pins are active. */ +} nrf_qdec_enable_t; + + +/** + * @enum nrf_qdec_dbfen_t + * @brief States of the debounce filter enable bit. + */ +typedef enum +{ + NRF_QDEC_DBFEN_DISABLE = QDEC_DBFEN_DBFEN_Disabled, /**< Mask for disabling the debounce filter. */ + NRF_QDEC_DBFEN_ENABLE = QDEC_DBFEN_DBFEN_Enabled /**< Mask for enabling the debounce filter. */ +} nrf_qdec_dbfen_t; + +/** + * @enum nrf_qdec_ledpol_t + * @brief Active LED polarity. + */ +typedef enum +{ + NRF_QDEC_LEPOL_ACTIVE_LOW = QDEC_LEDPOL_LEDPOL_ActiveLow, /**< QDEC LED active on output pin low. */ + NRF_QDEC_LEPOL_ACTIVE_HIGH = QDEC_LEDPOL_LEDPOL_ActiveHigh /**< QDEC LED active on output pin high. */ +} nrf_qdec_ledpol_t; + + +/** + * @enum nrf_qdec_sampleper_t + * @brief Available sampling periods. + */ +typedef enum +{ + NRF_QDEC_SAMPLEPER_128us = QDEC_SAMPLEPER_SAMPLEPER_128us, /**< QDEC sampling period 128 microseconds. */ + NRF_QDEC_SAMPLEPER_256us = QDEC_SAMPLEPER_SAMPLEPER_256us, /**< QDEC sampling period 256 microseconds. */ + NRF_QDEC_SAMPLEPER_512us = QDEC_SAMPLEPER_SAMPLEPER_512us, /**< QDEC sampling period 512 microseconds. */ + NRF_QDEC_SAMPLEPER_1024us = QDEC_SAMPLEPER_SAMPLEPER_1024us, /**< QDEC sampling period 1024 microseconds. */ + NRF_QDEC_SAMPLEPER_2048us = QDEC_SAMPLEPER_SAMPLEPER_2048us, /**< QDEC sampling period 2048 microseconds. */ + NRF_QDEC_SAMPLEPER_4096us = QDEC_SAMPLEPER_SAMPLEPER_4096us, /**< QDEC sampling period 4096 microseconds. */ + NRF_QDEC_SAMPLEPER_8192us = QDEC_SAMPLEPER_SAMPLEPER_8192us, /**< QDEC sampling period 8192 microseconds. */ + NRF_QDEC_SAMPLEPER_16384us = QDEC_SAMPLEPER_SAMPLEPER_16384us /**< QDEC sampling period 16384 microseconds. */ +} nrf_qdec_sampleper_t; + +/** + * @enum nrf_qdec_reportper_t + * @brief Available report periods. + */ +typedef enum +{ + NRF_QDEC_REPORTPER_10 = QDEC_REPORTPER_REPORTPER_10Smpl, /**< QDEC report period 10 samples. */ + NRF_QDEC_REPORTPER_40 = QDEC_REPORTPER_REPORTPER_40Smpl, /**< QDEC report period 40 samples. */ + NRF_QDEC_REPORTPER_80 = QDEC_REPORTPER_REPORTPER_80Smpl, /**< QDEC report period 80 samples. */ + NRF_QDEC_REPORTPER_120 = QDEC_REPORTPER_REPORTPER_120Smpl, /**< QDEC report period 120 samples. */ + NRF_QDEC_REPORTPER_160 = QDEC_REPORTPER_REPORTPER_160Smpl, /**< QDEC report period 160 samples. */ + NRF_QDEC_REPORTPER_200 = QDEC_REPORTPER_REPORTPER_200Smpl, /**< QDEC report period 200 samples. */ + NRF_QDEC_REPORTPER_240 = QDEC_REPORTPER_REPORTPER_240Smpl, /**< QDEC report period 240 samples. */ + NRF_QDEC_REPORTPER_280 = QDEC_REPORTPER_REPORTPER_280Smpl, /**< QDEC report period 280 samples. */ + NRF_QDEC_REPORTPER_DISABLED /**< QDEC reporting disabled. */ +} nrf_qdec_reportper_t; + +/** + * @brief Function for enabling QDEC. + */ +__STATIC_INLINE void nrf_qdec_enable(void) +{ + NRF_QDEC->ENABLE = NRF_QDEC_ENABLE; +} + + +/** + * @brief Function for disabling QDEC. + */ +__STATIC_INLINE void nrf_qdec_disable(void) +{ + NRF_QDEC->ENABLE = NRF_QDEC_DISABLE; +} + + +/** + * @brief Function for returning the enable state of QDEC. + * @return State of the register. + */ +__STATIC_INLINE uint32_t nrf_qdec_enable_get(void) +{ + return NRF_QDEC->ENABLE; +} + + +/** + * @brief Function for enabling QDEC interrupts by mask. + * @param[in] qdec_int_mask Sources of the interrupts to enable. + */ +__STATIC_INLINE void nrf_qdec_int_enable(uint32_t qdec_int_mask) +{ + NRF_QDEC->INTENSET = qdec_int_mask; // writing 0 has no effect +} + + +/** + * @brief Function for disabling QDEC interrupts by mask. + * @param[in] qdec_int_mask Sources of the interrupts to disable. + * + */ +__STATIC_INLINE void nrf_qdec_int_disable(uint32_t qdec_int_mask) +{ + NRF_QDEC->INTENCLR = qdec_int_mask; // writing 0 has no effect +} + + +/** + * @brief Function for getting the enabled interrupts of the QDEC. + */ +__STATIC_INLINE uint32_t nrf_qdec_int_enable_check(nrf_qdec_int_mask_t qdec_int_mask) +{ + return NRF_QDEC->INTENSET & qdec_int_mask; // when read this register will return the value of INTEN. +} + + +/** + * @brief Function for enabling the debouncing filter of the QED. + */ +__STATIC_INLINE void nrf_qdec_dbfen_enable(void) +{ + NRF_QDEC->DBFEN = NRF_QDEC_DBFEN_ENABLE; +} + + +/** + * @brief Function for disabling the debouncing filter of the QED. + */ +__STATIC_INLINE void nrf_qdec_dbfen_disable(void) +{ + NRF_QDEC->DBFEN = NRF_QDEC_DBFEN_DISABLE; +} + + +/** + * @brief Function for getting the state of the QDEC's debouncing filter. + * @retval NRF_QDEC_DBFEN_DISABLE If the debouncing filter is disabled. + * @retval NRF_QDEC_DBFEN_ENABLE If the debouncing filter is enabled. + */ +__STATIC_INLINE uint32_t nrf_qdec_dbfen_get(void) +{ + return NRF_QDEC->DBFEN; +} + + +/** + * @brief Function for assigning QDEC pins. + * @param[in] psela Pin number. + * @param[in] pselb Pin number. + * @param[in] pselled Pin number. + */ +__STATIC_INLINE void nrf_qdec_pio_assign( uint32_t psela, uint32_t pselb, uint32_t pselled) +{ + NRF_QDEC->PSELA = psela; + NRF_QDEC->PSELB = pselb; + NRF_QDEC->PSELLED = pselled; + +} + +/** + * @brief Function for setting a specific QDEC task. + * @param[in] qdec_task QDEC task to be set. + */ +__STATIC_INLINE void nrf_qdec_task_trigger(nrf_qdec_task_t qdec_task) +{ + *( (volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_task) ) = 1; +} + + +/** + * @brief Function for retrieving the address of a QDEC task register. + * @param[in] qdec_task QDEC task. + */ +__STATIC_INLINE uint32_t * nrf_qdec_task_address_get(nrf_qdec_task_t qdec_task) +{ + return (uint32_t *)( (uint8_t *)NRF_QDEC + qdec_task); +} + + +/** + * @brief Function for clearing a specific QDEC event. + * @param[in] qdec_event QDEC event to clear. + */ +__STATIC_INLINE void nrf_qdec_event_clear(nrf_qdec_event_t qdec_event) +{ + *( (volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event) ) = 0; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_QDEC + qdec_event)); + (void)dummy; +#endif +} + + +/** + * @brief Function for retrieving the state of a specific QDEC event. + * @return State of the QDEC event. + */ +__STATIC_INLINE uint32_t nrf_qdec_event_check(nrf_qdec_event_t qdec_event) +{ + return *(volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event); +} + + +/** + * @brief Function for retrieving the address of a specific QDEC event register. + * @param[in] qdec_event QDEC event. + * @return Address of the specified QDEC event. + */ +__STATIC_INLINE uint32_t * nrf_qdec_event_address_get(nrf_qdec_event_t qdec_event) +{ + return (uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event); +} + + +/** + * @brief Function for setting QDEC shortcuts. + * @param[in] qdec_short_mask QDEC shortcut by mask. + */ +__STATIC_INLINE void nrf_qdec_shorts_enable(uint32_t qdec_short_mask) +{ + NRF_QDEC->SHORTS |= qdec_short_mask; +} + + +/** + * @brief Function for clearing shortcuts of the QDEC by mask. + * @param[in] qdec_short_mask QDEC shortcute to be cleared. + */ +__STATIC_INLINE void nrf_qdec_shorts_disable(uint32_t qdec_short_mask) +{ + NRF_QDEC->SHORTS &= ~qdec_short_mask; +} + + +/** + * @brief Function for retrieving the value of QDEC's SAMPLEPER register. + * @return Value of the SAMPLEPER register. + */ +__STATIC_INLINE int32_t nrf_qdec_sampleper_reg_get(void) +{ + return NRF_QDEC->SAMPLEPER; +} + + +/** + * @brief Function for converting the value of QDEC's SAMPLE PERIOD to microseconds. + * @retval sampling period in microseconds. + */ +__STATIC_INLINE uint32_t nrf_qdec_sampleper_to_value(uint32_t sampleper) +{ + return (1 << (7 + sampleper)); +} + +/** + * @brief Function for setting the value of QDEC's SAMPLEPER register. + * @param[in] sample_per Sampling period. + */ +__STATIC_INLINE void nrf_qdec_sampleper_set(nrf_qdec_sampleper_t sample_per) +{ + NRF_QDEC->SAMPLEPER = sample_per; +} + + +/** + * @brief Function for retrieving the value of QDEC's SAMPLE register. + * @return Value of the SAMPLE register. + */ +__STATIC_INLINE int32_t nrf_qdec_sample_get(void) +{ + return NRF_QDEC->SAMPLE; +} + + +/** + * @brief Function for retrieving the value of QDEC's ACC register. + * @return Value of the ACC register. + */ +__STATIC_INLINE int32_t nrf_qdec_acc_get(void) +{ + return NRF_QDEC->ACC; +} + + +/** + * @brief Function for retrieving the value of QDEC's ACCREAD register. + * @return Value of the ACCREAD register. + */ +__STATIC_INLINE int32_t nrf_qdec_accread_get(void) +{ + return NRF_QDEC->ACCREAD; +} + + +/** + * @brief Function for retrieving the value of QDEC's ACCDBL register. + * @return Value of the ACCDBL register. + */ +__STATIC_INLINE uint32_t nrf_qdec_accdbl_get(void) +{ + return NRF_QDEC->ACCDBL; +} + + +/** + * @brief Function for retrieving the value of QDEC's ACCDBLREAD register. + * @return Value of the ACCDBLREAD register. + */ +__STATIC_INLINE uint32_t nrf_qdec_accdblread_get(void) +{ + return NRF_QDEC->ACCDBLREAD; +} + + +/** + * @brief Function for setting how long the LED is switched on before sampling. + * @param[in] time_us Time (in microseconds) how long the LED is switched on before sampling. + */ +__STATIC_INLINE void nrf_qdec_ledpre_set(uint32_t time_us) +{ + NRF_QDEC->LEDPRE = time_us; +} + + +/** + * @brief Function for retrieving how long the LED is switched on before sampling. + * @retval time_us Time (in microseconds) how long the LED is switched on before sampling. + */ +__STATIC_INLINE uint32_t nrf_qdec_ledpre_get(void) +{ + return NRF_QDEC->LEDPRE; +} + + +/** + * @brief Function for setting the report period (in samples). + * @param[in] reportper Number of samples. + */ +__STATIC_INLINE void nrf_qdec_reportper_set(nrf_qdec_reportper_t reportper) +{ + NRF_QDEC->REPORTPER = reportper; +} + + +/** + * @brief Function for retrieving the report period. + * @retval reportper Number of samples as encoded in the register. + */ +__STATIC_INLINE uint32_t nrf_qdec_reportper_reg_get(void) +{ + return NRF_QDEC->REPORTPER; +} + + +/** + * @brief Function for retrieving the value of QDEC's SAMPLEPER register. + * @param [in] reportper Reportper to be converted to amount of samples per report. + + */ +__STATIC_INLINE uint32_t nrf_qdec_reportper_to_value(uint32_t reportper) +{ + return (reportper == NRF_QDEC_REPORTPER_10) ? 10 : reportper * 40; +} + + +/** + * @brief Function for setting the active level for the LED. + * @param[in] pol Active level for the LED. + */ +__STATIC_INLINE void nrf_qdec_ledpol_set(nrf_qdec_ledpol_t pol) +{ + NRF_QDEC->LEDPOL = pol; +} + + +/** + * @brief Function for retrieving the active level for the LED. + * @return Active level for the LED. + */ +__STATIC_INLINE uint32_t nrf_qdec_ledpol_get(void) +{ + return NRF_QDEC->LEDPOL; +} + + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rng.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rng.h new file mode 100644 index 0000000000..d1872b08e0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rng.h @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file + * @brief RNG HAL API. + */ + +#ifndef NRF_RNG_H__ +#define NRF_RNG_H__ +/** + * @defgroup nrf_rng_hal RNG HAL + * @{ + * @ingroup nrf_rng + * @brief Hardware access layer for managing the random number generator (RNG). + */ + +#include +#include +#include +#include "nrf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define NRF_RNG_TASK_SET (1UL) +#define NRF_RNG_EVENT_CLEAR (0UL) +/** + * @enum nrf_rng_task_t + * @brief RNG tasks. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_RNG_TASK_START = offsetof(NRF_RNG_Type, TASKS_START), /**< Start the random number generator. */ + NRF_RNG_TASK_STOP = offsetof(NRF_RNG_Type, TASKS_STOP) /**< Stop the random number generator. */ +} nrf_rng_task_t; /*lint -restore */ + +/** + * @enum nrf_rng_event_t + * @brief RNG events. + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_RNG_EVENT_VALRDY = offsetof(NRF_RNG_Type, EVENTS_VALRDY) /**< New random number generated event. */ +} nrf_rng_event_t; /*lint -restore */ + +/** + * @enum nrf_rng_int_mask_t + * @brief RNG interrupts. + */ +typedef enum +{ + NRF_RNG_INT_VALRDY_MASK = RNG_INTENSET_VALRDY_Msk /**< Mask for enabling or disabling an interrupt on VALRDY event. */ +} nrf_rng_int_mask_t; + +/** + * @enum nrf_rng_short_mask_t + * @brief Types of RNG shortcuts. + */ +typedef enum +{ + NRF_RNG_SHORT_VALRDY_STOP_MASK = RNG_SHORTS_VALRDY_STOP_Msk /**< Mask for setting shortcut between EVENT_VALRDY and TASK_STOP. */ +} nrf_rng_short_mask_t; + +/** + * @brief Function for enabling interrupts. + * + * @param[in] rng_int_mask Mask of interrupts. + */ +__STATIC_INLINE void nrf_rng_int_enable(uint32_t rng_int_mask); + +/** + * @brief Function for disabling interrupts. + * + * @param[in] rng_int_mask Mask of interrupts. + */ +__STATIC_INLINE void nrf_rng_int_disable(uint32_t rng_int_mask); + +/** + * @brief Function for getting the state of a specific interrupt. + * + * @param[in] rng_int_mask Interrupt. + * + * @retval true If the interrupt is not enabled. + * @retval false If the interrupt is enabled. + */ +__STATIC_INLINE bool nrf_rng_int_get(nrf_rng_int_mask_t rng_int_mask); + +/** + * @brief Function for getting the address of a specific task. + * + * This function can be used by the PPI module. + * + * @param[in] rng_task Task. + */ +__STATIC_INLINE uint32_t * nrf_rng_task_address_get(nrf_rng_task_t rng_task); + +/** + * @brief Function for setting a specific task. + * + * @param[in] rng_task Task. + */ +__STATIC_INLINE void nrf_rng_task_trigger(nrf_rng_task_t rng_task); + +/** + * @brief Function for getting address of a specific event. + * + * This function can be used by the PPI module. + * + * @param[in] rng_event Event. + */ +__STATIC_INLINE uint32_t * nrf_rng_event_address_get(nrf_rng_event_t rng_event); + +/** + * @brief Function for clearing a specific event. + * + * @param[in] rng_event Event. + */ +__STATIC_INLINE void nrf_rng_event_clear(nrf_rng_event_t rng_event); + +/** + * @brief Function for getting the state of a specific event. + * + * @param[in] rng_event Event. + * + * @retval true If the event is not set. + * @retval false If the event is set. + */ +__STATIC_INLINE bool nrf_rng_event_get(nrf_rng_event_t rng_event); + +/** + * @brief Function for setting shortcuts. + * + * @param[in] rng_short_mask Mask of shortcuts. + * + */ +__STATIC_INLINE void nrf_rng_shorts_enable(uint32_t rng_short_mask); + +/** + * @brief Function for clearing shortcuts. + * + * @param[in] rng_short_mask Mask of shortcuts. + * + */ +__STATIC_INLINE void nrf_rng_shorts_disable(uint32_t rng_short_mask); + +/** + * @brief Function for getting the previously generated random value. + * + * @return Previously generated random value. + */ +__STATIC_INLINE uint8_t nrf_rng_random_value_get(void); + +/** + * @brief Function for enabling digital error correction. + */ +__STATIC_INLINE void nrf_rng_error_correction_enable(void); + +/** + * @brief Function for disabling digital error correction. + */ +__STATIC_INLINE void nrf_rng_error_correction_disable(void); + +/** + *@} + **/ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_rng_int_enable(uint32_t rng_int_mask) +{ + NRF_RNG->INTENSET = rng_int_mask; +} + +__STATIC_INLINE void nrf_rng_int_disable(uint32_t rng_int_mask) +{ + NRF_RNG->INTENCLR = rng_int_mask; +} + +__STATIC_INLINE bool nrf_rng_int_get(nrf_rng_int_mask_t rng_int_mask) +{ + return (bool)(NRF_RNG->INTENCLR & rng_int_mask); +} + +__STATIC_INLINE uint32_t * nrf_rng_task_address_get(nrf_rng_task_t rng_task) +{ + return (uint32_t *)((uint8_t *)NRF_RNG + rng_task); +} + +__STATIC_INLINE void nrf_rng_task_trigger(nrf_rng_task_t rng_task) +{ + *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_task)) = NRF_RNG_TASK_SET; +} + +__STATIC_INLINE uint32_t * nrf_rng_event_address_get(nrf_rng_event_t rng_event) +{ + return (uint32_t *)((uint8_t *)NRF_RNG + rng_event); +} + +__STATIC_INLINE void nrf_rng_event_clear(nrf_rng_event_t rng_event) +{ + *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_event)) = NRF_RNG_EVENT_CLEAR; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_event)); + (void)dummy; +#endif +} + +__STATIC_INLINE bool nrf_rng_event_get(nrf_rng_event_t rng_event) +{ + return (bool) * ((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_event)); +} + +__STATIC_INLINE void nrf_rng_shorts_enable(uint32_t rng_short_mask) +{ + NRF_RNG->SHORTS |= rng_short_mask; +} + +__STATIC_INLINE void nrf_rng_shorts_disable(uint32_t rng_short_mask) +{ + NRF_RNG->SHORTS &= ~rng_short_mask; +} + +__STATIC_INLINE uint8_t nrf_rng_random_value_get(void) +{ + return (uint8_t)(NRF_RNG->VALUE & RNG_VALUE_VALUE_Msk); +} + +__STATIC_INLINE void nrf_rng_error_correction_enable(void) +{ + NRF_RNG->CONFIG |= RNG_CONFIG_DERCEN_Msk; +} + +__STATIC_INLINE void nrf_rng_error_correction_disable(void) +{ + NRF_RNG->CONFIG &= ~RNG_CONFIG_DERCEN_Msk; +} + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_RNG_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rtc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rtc.h index 39e7f57281..d635480b8b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rtc.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_rtc.h @@ -36,7 +36,6 @@ * */ - /** * @file * @brief RTC HAL API. @@ -57,24 +56,31 @@ #include #include "nrf.h" #include "nrf_assert.h" +#include "nrf_peripherals.h" + +#ifdef __cplusplus +extern "C" { +#endif /** * @brief Macro for getting the number of compare channels available * in a given RTC instance. */ -#ifdef NRF51 - #define NRF_RTC_CC_CHANNEL_COUNT(id) 4 -#else - #define NRF_RTC_CC_CHANNEL_COUNT(id) ((id) == 0 ? 3 : 4) -#endif + +#define NRF_RTC_CC_CHANNEL_COUNT(id) CONCAT_3(RTC, id, _CC_NUM) #define RTC_INPUT_FREQ 32768 /**< Input frequency of the RTC instance. */ +/** + * @brief Macro for converting expected frequency to prescaler setting. + */ +#define RTC_FREQ_TO_PRESCALER(FREQ) (uint16_t)((RTC_INPUT_FREQ / (FREQ)) - 1) + /**< Macro for wrapping values to RTC capacity. */ #define RTC_WRAP(val) (val & RTC_COUNTER_COUNTER_Msk) #define RTC_CHANNEL_INT_MASK(ch) ((uint32_t)NRF_RTC_INT_COMPARE0_MASK << ch) -#define RTC_CHANNEL_EVENT_ADDR(ch) (nrf_rtc_event_t)(NRF_RTC_EVENT_COMPARE_0 + ch*sizeof(uint32_t)) +#define RTC_CHANNEL_EVENT_ADDR(ch) (nrf_rtc_event_t)(NRF_RTC_EVENT_COMPARE_0 + ch * sizeof(uint32_t)) /** * @enum nrf_rtc_task_t * @brief RTC tasks. @@ -121,7 +127,7 @@ typedef enum /**@brief Function for setting a compare value for a channel. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] ch Channel. * @param[in] cc_val Compare value to set. */ @@ -129,7 +135,7 @@ __STATIC_INLINE void nrf_rtc_cc_set(NRF_RTC_Type * p_rtc, uint32_t ch, uint32_t /**@brief Function for returning the compare value for a channel. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] ch Channel. * * @return COMPARE[ch] value. @@ -138,21 +144,21 @@ __STATIC_INLINE uint32_t nrf_rtc_cc_get(NRF_RTC_Type * p_rtc, uint32_t ch); /**@brief Function for enabling interrupts. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] mask Interrupt mask to be enabled. */ __STATIC_INLINE void nrf_rtc_int_enable(NRF_RTC_Type * p_rtc, uint32_t mask); /**@brief Function for disabling interrupts. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] mask Interrupt mask to be disabled. */ __STATIC_INLINE void nrf_rtc_int_disable(NRF_RTC_Type * p_rtc, uint32_t mask); /**@brief Function for checking if interrupts are enabled. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] mask Mask of interrupt flags to check. * * @return Mask with enabled interrupts. @@ -161,7 +167,7 @@ __STATIC_INLINE uint32_t nrf_rtc_int_is_enabled(NRF_RTC_Type * p_rtc, uint32_t m /**@brief Function for returning the status of currently enabled interrupts. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * * @return Value in INTEN register. */ @@ -169,7 +175,7 @@ __STATIC_INLINE uint32_t nrf_rtc_int_get(NRF_RTC_Type * p_rtc); /**@brief Function for checking if an event is pending. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] event Address of the event. * * @return Mask of pending events. @@ -178,14 +184,14 @@ __STATIC_INLINE uint32_t nrf_rtc_event_pending(NRF_RTC_Type * p_rtc, nrf_rtc_eve /**@brief Function for clearing an event. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] event Event to clear. */ __STATIC_INLINE void nrf_rtc_event_clear(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event); /**@brief Function for returning a counter value. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * * @return Counter value. */ @@ -193,14 +199,14 @@ __STATIC_INLINE uint32_t nrf_rtc_counter_get(NRF_RTC_Type * p_rtc); /**@brief Function for setting a prescaler value. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] val Value to set the prescaler to. */ __STATIC_INLINE void nrf_rtc_prescaler_set(NRF_RTC_Type * p_rtc, uint32_t val); /**@brief Function for returning the address of an event. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] event Requested event. * * @return Address of the requested event register. @@ -209,7 +215,7 @@ __STATIC_INLINE uint32_t nrf_rtc_event_address_get(NRF_RTC_Type * p_rtc, nrf_rtc /**@brief Function for returning the address of a task. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] task Requested task. * * @return Address of the requested task register. @@ -218,21 +224,21 @@ __STATIC_INLINE uint32_t nrf_rtc_task_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_ /**@brief Function for starting a task. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] task Requested task. */ __STATIC_INLINE void nrf_rtc_task_trigger(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task); /**@brief Function for enabling events. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] mask Mask of event flags to enable. */ __STATIC_INLINE void nrf_rtc_event_enable(NRF_RTC_Type * p_rtc, uint32_t mask); /**@brief Function for disabling an event. * - * @param[in] p_rtc Pointer to the instance register structure. + * @param[in] p_rtc Pointer to the peripheral registers structure. * @param[in] event Requested event. */ __STATIC_INLINE void nrf_rtc_event_disable(NRF_RTC_Type * p_rtc, uint32_t event); @@ -328,4 +334,9 @@ __STATIC_INLINE void nrf_rtc_event_disable(NRF_RTC_Type * p_rtc, uint32_t mask) } #endif + +#ifdef __cplusplus +} +#endif + #endif /* NRF_RTC_H */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.c index c5b88ea077..03ca26e6b5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.c @@ -36,27 +36,26 @@ * */ - -#ifdef NRF52 /** * @file * @brief SAADC HAL implementation */ - +#include "sdk_config.h" +#if SAADC_ENABLED #include "nrf_saadc.h" void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) { - NRF_SAADC->CH[channel].CONFIG = + NRF_SAADC->CH[channel].CONFIG = ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) - | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); + | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk) + | ((config->burst << SAADC_CH_CONFIG_BURST_Pos) & SAADC_CH_CONFIG_BURST_Msk); nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); return; } - -#endif //NRF52 +#endif //SAADC_ENABLED diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.h index b3ea9d7ef7..febe8721d3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_saadc.h @@ -37,12 +37,9 @@ */ - #ifndef NRF_SAADC_H_ #define NRF_SAADC_H_ -#ifdef NRF52 - /** * @defgroup nrf_saadc_hal SAADC HAL * @{ @@ -56,7 +53,9 @@ #include "nrf.h" #include "nrf_assert.h" - +#ifdef __cplusplus +extern "C" { +#endif #define NRF_SAADC_CHANNEL_COUNT 8 @@ -169,6 +168,16 @@ typedef enum } nrf_saadc_mode_t; +/** + * @brief Analog-to-digital converter channel burst mode. + */ +typedef enum +{ + NRF_SAADC_BURST_DISABLED = SAADC_CH_CONFIG_BURST_Disabled, ///< Burst mode is disabled (normal operation). + NRF_SAADC_BURST_ENABLED = SAADC_CH_CONFIG_BURST_Enabled ///< Burst mode is enabled. SAADC takes 2^OVERSAMPLE number of samples as fast as it can, and sends the average to Data RAM. +} nrf_saadc_burst_t; + + /** * @brief Analog-to-digital converter tasks. */ @@ -188,6 +197,8 @@ typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ { NRF_SAADC_EVENT_STARTED = offsetof(NRF_SAADC_Type, EVENTS_STARTED), ///< The ADC has started. NRF_SAADC_EVENT_END = offsetof(NRF_SAADC_Type, EVENTS_END), ///< The ADC has filled up the result buffer. + NRF_SAADC_EVENT_DONE = offsetof(NRF_SAADC_Type, EVENTS_DONE), ///< A conversion task has been completed. + NRF_SAADC_EVENT_RESULTDONE = offsetof(NRF_SAADC_Type, EVENTS_RESULTDONE), ///< A result is ready to get transferred to RAM. NRF_SAADC_EVENT_CALIBRATEDONE = offsetof(NRF_SAADC_Type, EVENTS_CALIBRATEDONE), ///< Calibration is complete. NRF_SAADC_EVENT_STOPPED = offsetof(NRF_SAADC_Type, EVENTS_STOPPED), ///< The ADC has stopped. NRF_SAADC_EVENT_CH0_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITH), ///< Last result is equal or above CH[0].LIMIT.HIGH. @@ -214,26 +225,29 @@ typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ */ typedef enum { - NRF_SAADC_INT_STARTED = SAADC_INTENSET_STARTED_Msk, ///< Interrupt on EVENTS_STARTED event. - NRF_SAADC_INT_END = SAADC_INTENSET_END_Msk, ///< Interrupt on EVENTS_END event. - NRF_SAADC_INT_STOPPED = SAADC_INTENSET_STOPPED_Msk, ///< Interrupt on EVENTS_STOPPED event. - NRF_SAADC_INT_CH0LIMITH = SAADC_INTENSET_CH0LIMITH_Msk, ///< Interrupt on EVENTS_CH[0].LIMITH event. - NRF_SAADC_INT_CH0LIMITL = SAADC_INTENSET_CH0LIMITL_Msk, ///< Interrupt on EVENTS_CH[0].LIMITL event. - NRF_SAADC_INT_CH1LIMITH = SAADC_INTENSET_CH1LIMITH_Msk, ///< Interrupt on EVENTS_CH[1].LIMITH event. - NRF_SAADC_INT_CH1LIMITL = SAADC_INTENSET_CH1LIMITL_Msk, ///< Interrupt on EVENTS_CH[1].LIMITL event. - NRF_SAADC_INT_CH2LIMITH = SAADC_INTENSET_CH2LIMITH_Msk, ///< Interrupt on EVENTS_CH[2].LIMITH event. - NRF_SAADC_INT_CH2LIMITL = SAADC_INTENSET_CH2LIMITL_Msk, ///< Interrupt on EVENTS_CH[2].LIMITL event. - NRF_SAADC_INT_CH3LIMITH = SAADC_INTENSET_CH3LIMITH_Msk, ///< Interrupt on EVENTS_CH[3].LIMITH event. - NRF_SAADC_INT_CH3LIMITL = SAADC_INTENSET_CH3LIMITL_Msk, ///< Interrupt on EVENTS_CH[3].LIMITL event. - NRF_SAADC_INT_CH4LIMITH = SAADC_INTENSET_CH4LIMITH_Msk, ///< Interrupt on EVENTS_CH[4].LIMITH event. - NRF_SAADC_INT_CH4LIMITL = SAADC_INTENSET_CH4LIMITL_Msk, ///< Interrupt on EVENTS_CH[4].LIMITL event. - NRF_SAADC_INT_CH5LIMITH = SAADC_INTENSET_CH5LIMITH_Msk, ///< Interrupt on EVENTS_CH[5].LIMITH event. - NRF_SAADC_INT_CH5LIMITL = SAADC_INTENSET_CH5LIMITL_Msk, ///< Interrupt on EVENTS_CH[5].LIMITL event. - NRF_SAADC_INT_CH6LIMITH = SAADC_INTENSET_CH6LIMITH_Msk, ///< Interrupt on EVENTS_CH[6].LIMITH event. - NRF_SAADC_INT_CH6LIMITL = SAADC_INTENSET_CH6LIMITL_Msk, ///< Interrupt on EVENTS_CH[6].LIMITL event. - NRF_SAADC_INT_CH7LIMITH = SAADC_INTENSET_CH7LIMITH_Msk, ///< Interrupt on EVENTS_CH[7].LIMITH event. - NRF_SAADC_INT_CH7LIMITL = SAADC_INTENSET_CH7LIMITL_Msk, ///< Interrupt on EVENTS_CH[7].LIMITL event. - NRF_SAADC_INT_ALL = 0x7FFFFFFFUL ///< Mask of all interrupts. + NRF_SAADC_INT_STARTED = SAADC_INTENSET_STARTED_Msk, ///< Interrupt on EVENTS_STARTED event. + NRF_SAADC_INT_END = SAADC_INTENSET_END_Msk, ///< Interrupt on EVENTS_END event. + NRF_SAADC_INT_DONE = SAADC_INTENSET_DONE_Msk, ///< Interrupt on EVENTS_DONE event. + NRF_SAADC_INT_RESULTDONE = SAADC_INTENSET_RESULTDONE_Msk, ///< Interrupt on EVENTS_RESULTDONE event. + NRF_SAADC_INT_CALIBRATEDONE = SAADC_INTENSET_CALIBRATEDONE_Msk, ///< Interrupt on EVENTS_CALIBRATEDONE event. + NRF_SAADC_INT_STOPPED = SAADC_INTENSET_STOPPED_Msk, ///< Interrupt on EVENTS_STOPPED event. + NRF_SAADC_INT_CH0LIMITH = SAADC_INTENSET_CH0LIMITH_Msk, ///< Interrupt on EVENTS_CH[0].LIMITH event. + NRF_SAADC_INT_CH0LIMITL = SAADC_INTENSET_CH0LIMITL_Msk, ///< Interrupt on EVENTS_CH[0].LIMITL event. + NRF_SAADC_INT_CH1LIMITH = SAADC_INTENSET_CH1LIMITH_Msk, ///< Interrupt on EVENTS_CH[1].LIMITH event. + NRF_SAADC_INT_CH1LIMITL = SAADC_INTENSET_CH1LIMITL_Msk, ///< Interrupt on EVENTS_CH[1].LIMITL event. + NRF_SAADC_INT_CH2LIMITH = SAADC_INTENSET_CH2LIMITH_Msk, ///< Interrupt on EVENTS_CH[2].LIMITH event. + NRF_SAADC_INT_CH2LIMITL = SAADC_INTENSET_CH2LIMITL_Msk, ///< Interrupt on EVENTS_CH[2].LIMITL event. + NRF_SAADC_INT_CH3LIMITH = SAADC_INTENSET_CH3LIMITH_Msk, ///< Interrupt on EVENTS_CH[3].LIMITH event. + NRF_SAADC_INT_CH3LIMITL = SAADC_INTENSET_CH3LIMITL_Msk, ///< Interrupt on EVENTS_CH[3].LIMITL event. + NRF_SAADC_INT_CH4LIMITH = SAADC_INTENSET_CH4LIMITH_Msk, ///< Interrupt on EVENTS_CH[4].LIMITH event. + NRF_SAADC_INT_CH4LIMITL = SAADC_INTENSET_CH4LIMITL_Msk, ///< Interrupt on EVENTS_CH[4].LIMITL event. + NRF_SAADC_INT_CH5LIMITH = SAADC_INTENSET_CH5LIMITH_Msk, ///< Interrupt on EVENTS_CH[5].LIMITH event. + NRF_SAADC_INT_CH5LIMITL = SAADC_INTENSET_CH5LIMITL_Msk, ///< Interrupt on EVENTS_CH[5].LIMITL event. + NRF_SAADC_INT_CH6LIMITH = SAADC_INTENSET_CH6LIMITH_Msk, ///< Interrupt on EVENTS_CH[6].LIMITH event. + NRF_SAADC_INT_CH6LIMITL = SAADC_INTENSET_CH6LIMITL_Msk, ///< Interrupt on EVENTS_CH[6].LIMITL event. + NRF_SAADC_INT_CH7LIMITH = SAADC_INTENSET_CH7LIMITH_Msk, ///< Interrupt on EVENTS_CH[7].LIMITH event. + NRF_SAADC_INT_CH7LIMITL = SAADC_INTENSET_CH7LIMITL_Msk, ///< Interrupt on EVENTS_CH[7].LIMITL event. + NRF_SAADC_INT_ALL = 0x7FFFFFFFUL ///< Mask of all interrupts. } nrf_saadc_int_mask_t; @@ -273,6 +287,7 @@ typedef struct nrf_saadc_reference_t reference; nrf_saadc_acqtime_t acq_time; nrf_saadc_mode_t mode; + nrf_saadc_burst_t burst; nrf_saadc_input_t pin_p; nrf_saadc_input_t pin_n; } nrf_saadc_channel_config_t; @@ -323,6 +338,10 @@ __STATIC_INLINE bool nrf_saadc_event_check(nrf_saadc_event_t saadc_event) __STATIC_INLINE void nrf_saadc_event_clear(nrf_saadc_event_t saadc_event) { *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event)); + (void)dummy; +#endif } @@ -333,9 +352,9 @@ __STATIC_INLINE void nrf_saadc_event_clear(nrf_saadc_event_t saadc_event) * * @return Address of the specified SAADC event. */ -__STATIC_INLINE volatile uint32_t * nrf_saadc_event_address_get(nrf_saadc_event_t saadc_event) +__STATIC_INLINE uint32_t nrf_saadc_event_address_get(nrf_saadc_event_t saadc_event) { - return (volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event); + return (uint32_t )((uint8_t *)NRF_SAADC + (uint32_t)saadc_event); } @@ -371,13 +390,13 @@ __STATIC_INLINE nrf_saadc_event_t nrf_saadc_event_limit_get(uint8_t channel, nrf { if (limit_type == NRF_SAADC_LIMIT_HIGH) { - return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITH + + return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITH + (uint32_t) (NRF_SAADC_EVENT_CH1_LIMITH - NRF_SAADC_EVENT_CH0_LIMITH) * (uint32_t) channel ); } else { - return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITL + + return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITL + (uint32_t) (NRF_SAADC_EVENT_CH1_LIMITL - NRF_SAADC_EVENT_CH0_LIMITL) * (uint32_t) channel ); } @@ -453,7 +472,7 @@ __STATIC_INLINE void nrf_saadc_int_disable(uint32_t saadc_int_mask) /** * @brief Function for generating masks for SAADC channel limit interrupts. - * + * * @param[in] channel SAADC channel number. * @param[in] limit_type Limit type. * @@ -541,7 +560,7 @@ __STATIC_INLINE uint16_t nrf_saadc_amount_get(void) /** * @brief Function for setting the SAADC sample resolution. - * + * * @param[in] resolution Bit resolution. */ __STATIC_INLINE void nrf_saadc_resolution_set(nrf_saadc_resolution_t resolution) @@ -581,7 +600,10 @@ void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * /** *@} **/ - -#endif // NRF52 + + +#ifdef __cplusplus +} +#endif #endif /* NRF_SAADC_H_ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spi.h index 20dba2d598..38ac4f687e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spi.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spi.h @@ -36,11 +36,10 @@ * */ - /** * @defgroup nrf_spi_hal SPI HAL * @{ - * @ingroup nrf_spi_master + * @ingroup nrf_spi * * @brief Hardware access layer for accessing the SPI peripheral. */ @@ -54,6 +53,10 @@ #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief This value can be used as a parameter for the @ref nrf_spi_pins_set @@ -121,78 +124,78 @@ typedef enum /** * @brief Function for clearing a specific SPI event. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_event Event to clear. */ -__STATIC_INLINE void nrf_spi_event_clear(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_event_clear(NRF_SPI_Type * p_reg, nrf_spi_event_t spi_event); /** * @brief Function for checking the state of a specific SPI event. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_event Event to check. * * @retval true If the event is set. * @retval false If the event is not set. */ -__STATIC_INLINE bool nrf_spi_event_check(NRF_SPI_Type * p_spi, +__STATIC_INLINE bool nrf_spi_event_check(NRF_SPI_Type * p_reg, nrf_spi_event_t spi_event); /** * @brief Function for getting the address of a specific SPI event register. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_event Requested event. * * @return Address of the specified event register. */ -__STATIC_INLINE uint32_t * nrf_spi_event_address_get(NRF_SPI_Type * p_spi, +__STATIC_INLINE uint32_t * nrf_spi_event_address_get(NRF_SPI_Type * p_reg, nrf_spi_event_t spi_event); /** * @brief Function for enabling specified interrupts. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_int_mask Interrupts to enable. */ -__STATIC_INLINE void nrf_spi_int_enable(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_int_enable(NRF_SPI_Type * p_reg, uint32_t spi_int_mask); /** * @brief Function for disabling specified interrupts. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_int_mask Interrupts to disable. */ -__STATIC_INLINE void nrf_spi_int_disable(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_int_disable(NRF_SPI_Type * p_reg, uint32_t spi_int_mask); /** * @brief Function for retrieving the state of a given interrupt. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_int Interrupt to check. * * @retval true If the interrupt is enabled. * @retval false If the interrupt is not enabled. */ -__STATIC_INLINE bool nrf_spi_int_enable_check(NRF_SPI_Type * p_spi, +__STATIC_INLINE bool nrf_spi_int_enable_check(NRF_SPI_Type * p_reg, nrf_spi_int_mask_t spi_int); /** * @brief Function for enabling the SPI peripheral. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spi_enable(NRF_SPI_Type * p_spi); +__STATIC_INLINE void nrf_spi_enable(NRF_SPI_Type * p_reg); /** * @brief Function for disabling the SPI peripheral. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_spi); +__STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_reg); /** * @brief Function for configuring SPI pins. @@ -200,12 +203,12 @@ __STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_spi); * If a given signal is not needed, pass the @ref NRF_SPI_PIN_NOT_CONNECTED * value instead of its pin number. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] sck_pin SCK pin number. * @param[in] mosi_pin MOSI pin number. * @param[in] miso_pin MISO pin number. */ -__STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin); @@ -213,116 +216,120 @@ __STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_spi, /** * @brief Function for writing data to the SPI transmitter register. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] data TX data to send. */ -__STATIC_INLINE void nrf_spi_txd_set(NRF_SPI_Type * p_spi, uint8_t data); +__STATIC_INLINE void nrf_spi_txd_set(NRF_SPI_Type * p_reg, uint8_t data); /** * @brief Function for reading data from the SPI receiver register. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @return RX data received. */ -__STATIC_INLINE uint8_t nrf_spi_rxd_get(NRF_SPI_Type * p_spi); +__STATIC_INLINE uint8_t nrf_spi_rxd_get(NRF_SPI_Type * p_reg); /** * @brief Function for setting the SPI master data rate. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] frequency SPI frequency. */ -__STATIC_INLINE void nrf_spi_frequency_set(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_frequency_set(NRF_SPI_Type * p_reg, nrf_spi_frequency_t frequency); /** * @brief Function for setting the SPI configuration. * - * @param[in] p_spi SPI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_mode SPI mode. * @param[in] spi_bit_order SPI bit order. */ -__STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_reg, nrf_spi_mode_t spi_mode, nrf_spi_bit_order_t spi_bit_order); #ifndef SUPPRESS_INLINE_IMPLEMENTATION -__STATIC_INLINE void nrf_spi_event_clear(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_event_clear(NRF_SPI_Type * p_reg, nrf_spi_event_t spi_event) { - *((volatile uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event)) = 0x0UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spi_event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spi_event)); + (void)dummy; +#endif } -__STATIC_INLINE bool nrf_spi_event_check(NRF_SPI_Type * p_spi, +__STATIC_INLINE bool nrf_spi_event_check(NRF_SPI_Type * p_reg, nrf_spi_event_t spi_event) { - return (bool)*(volatile uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event); + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spi_event); } -__STATIC_INLINE uint32_t * nrf_spi_event_address_get(NRF_SPI_Type * p_spi, +__STATIC_INLINE uint32_t * nrf_spi_event_address_get(NRF_SPI_Type * p_reg, nrf_spi_event_t spi_event) { - return (uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event); + return (uint32_t *)((uint8_t *)p_reg + (uint32_t)spi_event); } -__STATIC_INLINE void nrf_spi_int_enable(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_int_enable(NRF_SPI_Type * p_reg, uint32_t spi_int_mask) { - p_spi->INTENSET = spi_int_mask; + p_reg->INTENSET = spi_int_mask; } -__STATIC_INLINE void nrf_spi_int_disable(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_int_disable(NRF_SPI_Type * p_reg, uint32_t spi_int_mask) { - p_spi->INTENCLR = spi_int_mask; + p_reg->INTENCLR = spi_int_mask; } -__STATIC_INLINE bool nrf_spi_int_enable_check(NRF_SPI_Type * p_spi, +__STATIC_INLINE bool nrf_spi_int_enable_check(NRF_SPI_Type * p_reg, nrf_spi_int_mask_t spi_int) { - return (bool)(p_spi->INTENSET & spi_int); + return (bool)(p_reg->INTENSET & spi_int); } -__STATIC_INLINE void nrf_spi_enable(NRF_SPI_Type * p_spi) +__STATIC_INLINE void nrf_spi_enable(NRF_SPI_Type * p_reg) { - p_spi->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_spi) +__STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_reg) { - p_spi->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin) { - p_spi->PSELSCK = sck_pin; - p_spi->PSELMOSI = mosi_pin; - p_spi->PSELMISO = miso_pin; + p_reg->PSELSCK = sck_pin; + p_reg->PSELMOSI = mosi_pin; + p_reg->PSELMISO = miso_pin; } -__STATIC_INLINE void nrf_spi_txd_set(NRF_SPI_Type * p_spi, uint8_t data) +__STATIC_INLINE void nrf_spi_txd_set(NRF_SPI_Type * p_reg, uint8_t data) { - p_spi->TXD = data; + p_reg->TXD = data; } -__STATIC_INLINE uint8_t nrf_spi_rxd_get(NRF_SPI_Type * p_spi) +__STATIC_INLINE uint8_t nrf_spi_rxd_get(NRF_SPI_Type * p_reg) { - return p_spi->RXD; + return p_reg->RXD; } -__STATIC_INLINE void nrf_spi_frequency_set(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_frequency_set(NRF_SPI_Type * p_reg, nrf_spi_frequency_t frequency) { - p_spi->FREQUENCY = frequency; + p_reg->FREQUENCY = frequency; } -__STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_spi, +__STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_reg, nrf_spi_mode_t spi_mode, nrf_spi_bit_order_t spi_bit_order) { @@ -351,11 +358,16 @@ __STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_spi, (SPI_CONFIG_CPHA_Trailing << SPI_CONFIG_CPHA_Pos); break; } - p_spi->CONFIG = config; + p_reg->CONFIG = config; } #endif // SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + #endif // NRF_SPI_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spim.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spim.h index 495b4dd316..a2789bcb14 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spim.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spim.h @@ -36,11 +36,10 @@ * */ - /** * @defgroup nrf_spim_hal SPIM HAL * @{ - * @ingroup nrf_spi_master + * @ingroup nrf_spi * * @brief Hardware access layer for accessing the SPIM peripheral. */ @@ -54,6 +53,10 @@ #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief This value can be used as a parameter for the @ref nrf_spim_pins_set @@ -84,15 +87,12 @@ typedef enum /*lint -save -e30*/ NRF_SPIM_EVENT_STOPPED = offsetof(NRF_SPIM_Type, EVENTS_STOPPED), ///< SPI transaction has stopped. NRF_SPIM_EVENT_ENDRX = offsetof(NRF_SPIM_Type, EVENTS_ENDRX), ///< End of RXD buffer reached. -#ifdef NRF52 NRF_SPIM_EVENT_END = offsetof(NRF_SPIM_Type, EVENTS_END), ///< End of RXD buffer and TXD buffer reached. -#endif NRF_SPIM_EVENT_ENDTX = offsetof(NRF_SPIM_Type, EVENTS_ENDTX), ///< End of TXD buffer reached. NRF_SPIM_EVENT_STARTED = offsetof(NRF_SPIM_Type, EVENTS_STARTED) ///< Transaction started. /*lint -restore*/ } nrf_spim_event_t; -#ifdef NRF52 /** * @brief SPIM shortcuts. */ @@ -100,7 +100,6 @@ typedef enum { NRF_SPIM_SHORT_END_START_MASK = SPIM_SHORTS_END_START_Msk ///< Shortcut between END event and START task. } nrf_spim_short_mask_t; -#endif /** * @brief SPIM interrupts. @@ -109,9 +108,7 @@ typedef enum { NRF_SPIM_INT_STOPPED_MASK = SPIM_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event. NRF_SPIM_INT_ENDRX_MASK = SPIM_INTENSET_ENDRX_Msk, ///< Interrupt on ENDRX event. -#ifdef NRF52 NRF_SPIM_INT_END_MASK = SPIM_INTENSET_END_Msk, ///< Interrupt on END event. -#endif NRF_SPIM_INT_ENDTX_MASK = SPIM_INTENSET_ENDTX_Msk, ///< Interrupt on ENDTX event. NRF_SPIM_INT_STARTED_MASK = SPIM_INTENSET_STARTED_Msk ///< Interrupt on STARTED event. } nrf_spim_int_mask_t; @@ -156,123 +153,122 @@ typedef enum /** * @brief Function for activating a specific SPIM task. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_task Task to activate. */ -__STATIC_INLINE void nrf_spim_task_trigger(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_task_trigger(NRF_SPIM_Type * p_reg, nrf_spim_task_t spim_task); /** * @brief Function for getting the address of a specific SPIM task register. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_task Requested task. * * @return Address of the specified task register. */ -__STATIC_INLINE uint32_t nrf_spim_task_address_get(NRF_SPIM_Type * p_spim, +__STATIC_INLINE uint32_t nrf_spim_task_address_get(NRF_SPIM_Type * p_reg, nrf_spim_task_t spim_task); /** * @brief Function for clearing a specific SPIM event. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_event Event to clear. */ -__STATIC_INLINE void nrf_spim_event_clear(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_event_clear(NRF_SPIM_Type * p_reg, nrf_spim_event_t spim_event); /** * @brief Function for checking the state of a specific SPIM event. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_event Event to check. * * @retval true If the event is set. * @retval false If the event is not set. */ -__STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_spim, +__STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_reg, nrf_spim_event_t spim_event); /** * @brief Function for getting the address of a specific SPIM event register. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_event Requested event. * * @return Address of the specified event register. */ -__STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type * p_spim, +__STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type * p_reg, nrf_spim_event_t spim_event); -#ifdef NRF52 /** * @brief Function for enabling specified shortcuts. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_shorts_mask Shortcuts to enable. */ -__STATIC_INLINE void nrf_spim_shorts_enable(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_shorts_enable(NRF_SPIM_Type * p_reg, uint32_t spim_shorts_mask); /** * @brief Function for disabling specified shortcuts. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_shorts_mask Shortcuts to disable. */ -__STATIC_INLINE void nrf_spim_shorts_disable(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_shorts_disable(NRF_SPIM_Type * p_reg, uint32_t spim_shorts_mask); /** * @brief Function for getting shorts setting. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE uint32_t nrf_spim_shorts_get(NRF_SPIM_Type * p_spim); -#endif +__STATIC_INLINE uint32_t nrf_spim_shorts_get(NRF_SPIM_Type * p_reg); + /** * @brief Function for enabling specified interrupts. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_int_mask Interrupts to enable. */ -__STATIC_INLINE void nrf_spim_int_enable(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_int_enable(NRF_SPIM_Type * p_reg, uint32_t spim_int_mask); /** * @brief Function for disabling specified interrupts. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_int_mask Interrupts to disable. */ -__STATIC_INLINE void nrf_spim_int_disable(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_int_disable(NRF_SPIM_Type * p_reg, uint32_t spim_int_mask); /** * @brief Function for retrieving the state of a given interrupt. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spim_int Interrupt to check. * * @retval true If the interrupt is enabled. * @retval false If the interrupt is not enabled. */ -__STATIC_INLINE bool nrf_spim_int_enable_check(NRF_SPIM_Type * p_spim, +__STATIC_INLINE bool nrf_spim_int_enable_check(NRF_SPIM_Type * p_reg, nrf_spim_int_mask_t spim_int); /** * @brief Function for enabling the SPIM peripheral. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spim_enable(NRF_SPIM_Type * p_spim); +__STATIC_INLINE void nrf_spim_enable(NRF_SPIM_Type * p_reg); /** * @brief Function for disabling the SPIM peripheral. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_spim); +__STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_reg); /** * @brief Function for configuring SPIM pins. @@ -280,12 +276,12 @@ __STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_spim); * If a given signal is not needed, pass the @ref NRF_SPIM_PIN_NOT_CONNECTED * value instead of its pin number. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] sck_pin SCK pin number. * @param[in] mosi_pin MOSI pin number. * @param[in] miso_pin MISO pin number. */ -__STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin); @@ -293,195 +289,197 @@ __STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_spim, /** * @brief Function for setting the SPI master data rate. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] frequency SPI frequency. */ -__STATIC_INLINE void nrf_spim_frequency_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_frequency_set(NRF_SPIM_Type * p_reg, nrf_spim_frequency_t frequency); /** * @brief Function for setting the transmit buffer. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] p_buffer Pointer to the buffer with data to send. * @param[in] length Maximum number of data bytes to transmit. */ -__STATIC_INLINE void nrf_spim_tx_buffer_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_tx_buffer_set(NRF_SPIM_Type * p_reg, uint8_t const * p_buffer, uint8_t length); /** * @brief Function for setting the receive buffer. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] p_buffer Pointer to the buffer for received data. * @param[in] length Maximum number of data bytes to receive. */ -__STATIC_INLINE void nrf_spim_rx_buffer_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_rx_buffer_set(NRF_SPIM_Type * p_reg, uint8_t * p_buffer, uint8_t length); /** * @brief Function for setting the SPI configuration. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_mode SPI mode. * @param[in] spi_bit_order SPI bit order. */ -__STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_reg, nrf_spim_mode_t spi_mode, nrf_spim_bit_order_t spi_bit_order); /** * @brief Function for setting the over-read character. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] orc Over-read character that is clocked out in case of * an over-read of the TXD buffer. */ -__STATIC_INLINE void nrf_spim_orc_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_orc_set(NRF_SPIM_Type * p_reg, uint8_t orc); -#ifdef NRF52 /** * @brief Function for enabling the TX list feature. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spim_tx_list_enable(NRF_SPIM_Type * p_spim); +__STATIC_INLINE void nrf_spim_tx_list_enable(NRF_SPIM_Type * p_reg); /** * @brief Function for disabling the TX list feature. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spim_tx_list_disable(NRF_SPIM_Type * p_spim); +__STATIC_INLINE void nrf_spim_tx_list_disable(NRF_SPIM_Type * p_reg); /** * @brief Function for enabling the RX list feature. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spim_rx_list_enable(NRF_SPIM_Type * p_spim); +__STATIC_INLINE void nrf_spim_rx_list_enable(NRF_SPIM_Type * p_reg); /** * @brief Function for disabling the RX list feature. * - * @param[in] p_spim SPIM instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spim_rx_list_disable(NRF_SPIM_Type * p_spim); -#endif +__STATIC_INLINE void nrf_spim_rx_list_disable(NRF_SPIM_Type * p_reg); + #ifndef SUPPRESS_INLINE_IMPLEMENTATION -__STATIC_INLINE void nrf_spim_task_trigger(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_task_trigger(NRF_SPIM_Type * p_reg, nrf_spim_task_t spim_task) { - *((volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_task)) = 0x1UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spim_task)) = 0x1UL; } -__STATIC_INLINE uint32_t nrf_spim_task_address_get(NRF_SPIM_Type * p_spim, +__STATIC_INLINE uint32_t nrf_spim_task_address_get(NRF_SPIM_Type * p_reg, nrf_spim_task_t spim_task) { - return (uint32_t)((uint8_t *)p_spim + (uint32_t)spim_task); + return (uint32_t)((uint8_t *)p_reg + (uint32_t)spim_task); } -__STATIC_INLINE void nrf_spim_event_clear(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_event_clear(NRF_SPIM_Type * p_reg, nrf_spim_event_t spim_event) { - *((volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_event)) = 0x0UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spim_event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spim_event)); + (void)dummy; +#endif } -__STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_spim, +__STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_reg, nrf_spim_event_t spim_event) { - return (bool)*(volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_event); + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spim_event); } -__STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type * p_spim, +__STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type * p_reg, nrf_spim_event_t spim_event) { - return (uint32_t)((uint8_t *)p_spim + (uint32_t)spim_event); + return (uint32_t)((uint8_t *)p_reg + (uint32_t)spim_event); } -#ifdef NRF52 -__STATIC_INLINE void nrf_spim_shorts_enable(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_shorts_enable(NRF_SPIM_Type * p_reg, uint32_t spim_shorts_mask) { - p_spim->SHORTS |= spim_shorts_mask; + p_reg->SHORTS |= spim_shorts_mask; } -__STATIC_INLINE void nrf_spim_shorts_disable(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_shorts_disable(NRF_SPIM_Type * p_reg, uint32_t spim_shorts_mask) { - p_spim->SHORTS &= ~(spim_shorts_mask); + p_reg->SHORTS &= ~(spim_shorts_mask); } -__STATIC_INLINE uint32_t nrf_spim_shorts_get(NRF_SPIM_Type * p_spim) +__STATIC_INLINE uint32_t nrf_spim_shorts_get(NRF_SPIM_Type * p_reg) { - return p_spim->SHORTS; + return p_reg->SHORTS; } -#endif -__STATIC_INLINE void nrf_spim_int_enable(NRF_SPIM_Type * p_spim, + +__STATIC_INLINE void nrf_spim_int_enable(NRF_SPIM_Type * p_reg, uint32_t spim_int_mask) { - p_spim->INTENSET = spim_int_mask; + p_reg->INTENSET = spim_int_mask; } -__STATIC_INLINE void nrf_spim_int_disable(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_int_disable(NRF_SPIM_Type * p_reg, uint32_t spim_int_mask) { - p_spim->INTENCLR = spim_int_mask; + p_reg->INTENCLR = spim_int_mask; } -__STATIC_INLINE bool nrf_spim_int_enable_check(NRF_SPIM_Type * p_spim, +__STATIC_INLINE bool nrf_spim_int_enable_check(NRF_SPIM_Type * p_reg, nrf_spim_int_mask_t spim_int) { - return (bool)(p_spim->INTENSET & spim_int); + return (bool)(p_reg->INTENSET & spim_int); } -__STATIC_INLINE void nrf_spim_enable(NRF_SPIM_Type * p_spim) +__STATIC_INLINE void nrf_spim_enable(NRF_SPIM_Type * p_reg) { - p_spim->ENABLE = (SPIM_ENABLE_ENABLE_Enabled << SPIM_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (SPIM_ENABLE_ENABLE_Enabled << SPIM_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_spim) +__STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_reg) { - p_spim->ENABLE = (SPIM_ENABLE_ENABLE_Disabled << SPIM_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (SPIM_ENABLE_ENABLE_Disabled << SPIM_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin) { - p_spim->PSEL.SCK = sck_pin; - p_spim->PSEL.MOSI = mosi_pin; - p_spim->PSEL.MISO = miso_pin; + p_reg->PSEL.SCK = sck_pin; + p_reg->PSEL.MOSI = mosi_pin; + p_reg->PSEL.MISO = miso_pin; } -__STATIC_INLINE void nrf_spim_frequency_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_frequency_set(NRF_SPIM_Type * p_reg, nrf_spim_frequency_t frequency) { - p_spim->FREQUENCY = frequency; + p_reg->FREQUENCY = frequency; } -__STATIC_INLINE void nrf_spim_tx_buffer_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_tx_buffer_set(NRF_SPIM_Type * p_reg, uint8_t const * p_buffer, uint8_t length) { - p_spim->TXD.PTR = (uint32_t)p_buffer; - p_spim->TXD.MAXCNT = length; + p_reg->TXD.PTR = (uint32_t)p_buffer; + p_reg->TXD.MAXCNT = length; } -__STATIC_INLINE void nrf_spim_rx_buffer_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_rx_buffer_set(NRF_SPIM_Type * p_reg, uint8_t * p_buffer, uint8_t length) { - p_spim->RXD.PTR = (uint32_t)p_buffer; - p_spim->RXD.MAXCNT = length; + p_reg->RXD.PTR = (uint32_t)p_buffer; + p_reg->RXD.MAXCNT = length; } -__STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_reg, nrf_spim_mode_t spi_mode, nrf_spim_bit_order_t spi_bit_order) { @@ -510,37 +508,42 @@ __STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_spim, (SPIM_CONFIG_CPHA_Trailing << SPIM_CONFIG_CPHA_Pos); break; } - p_spim->CONFIG = config; + p_reg->CONFIG = config; } -__STATIC_INLINE void nrf_spim_orc_set(NRF_SPIM_Type * p_spim, +__STATIC_INLINE void nrf_spim_orc_set(NRF_SPIM_Type * p_reg, uint8_t orc) { - p_spim->ORC = orc; + p_reg->ORC = orc; } -#ifdef NRF52 -__STATIC_INLINE void nrf_spim_tx_list_enable(NRF_SPIM_Type * p_spim) + +__STATIC_INLINE void nrf_spim_tx_list_enable(NRF_SPIM_Type * p_reg) { - p_spim->TXD.LIST = 1; + p_reg->TXD.LIST = 1; } -__STATIC_INLINE void nrf_spim_tx_list_disable(NRF_SPIM_Type * p_spim) +__STATIC_INLINE void nrf_spim_tx_list_disable(NRF_SPIM_Type * p_reg) { - p_spim->TXD.LIST = 0; + p_reg->TXD.LIST = 0; } -__STATIC_INLINE void nrf_spim_rx_list_enable(NRF_SPIM_Type * p_spim) +__STATIC_INLINE void nrf_spim_rx_list_enable(NRF_SPIM_Type * p_reg) { - p_spim->RXD.LIST = 1; + p_reg->RXD.LIST = 1; } -__STATIC_INLINE void nrf_spim_rx_list_disable(NRF_SPIM_Type * p_spim) +__STATIC_INLINE void nrf_spim_rx_list_disable(NRF_SPIM_Type * p_reg) { - p_spim->RXD.LIST = 0; + p_reg->RXD.LIST = 0; +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + + +#ifdef __cplusplus } #endif -#endif // SUPPRESS_INLINE_IMPLEMENTATION #endif // NRF_SPIM_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spis.h index 6312ce131c..2996bd180c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spis.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_spis.h @@ -36,7 +36,6 @@ * */ - /** * @defgroup nrf_spis_hal SPIS HAL * @{ @@ -53,6 +52,11 @@ #include #include "nrf.h" +#include "nrf_peripherals.h" + +#ifdef __cplusplus +extern "C" { +#endif /** @@ -145,134 +149,134 @@ typedef enum /** * @brief Function for activating a specific SPIS task. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_task Task to activate. */ -__STATIC_INLINE void nrf_spis_task_trigger(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_task_trigger(NRF_SPIS_Type * p_reg, nrf_spis_task_t spis_task); /** * @brief Function for getting the address of a specific SPIS task register. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_task Requested task. * * @return Address of the specified task register. */ -__STATIC_INLINE uint32_t nrf_spis_task_address_get(NRF_SPIS_Type const * p_spis, +__STATIC_INLINE uint32_t nrf_spis_task_address_get(NRF_SPIS_Type const * p_reg, nrf_spis_task_t spis_task); /** * @brief Function for clearing a specific SPIS event. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_event Event to clear. */ -__STATIC_INLINE void nrf_spis_event_clear(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_event_clear(NRF_SPIS_Type * p_reg, nrf_spis_event_t spis_event); /** * @brief Function for checking the state of a specific SPIS event. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_event Event to check. * * @retval true If the event is set. * @retval false If the event is not set. */ -__STATIC_INLINE bool nrf_spis_event_check(NRF_SPIS_Type const * p_spis, +__STATIC_INLINE bool nrf_spis_event_check(NRF_SPIS_Type const * p_reg, nrf_spis_event_t spis_event); /** * @brief Function for getting the address of a specific SPIS event register. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_event Requested event. * * @return Address of the specified event register. */ -__STATIC_INLINE uint32_t nrf_spis_event_address_get(NRF_SPIS_Type const * p_spis, +__STATIC_INLINE uint32_t nrf_spis_event_address_get(NRF_SPIS_Type const * p_reg, nrf_spis_event_t spis_event); /** * @brief Function for enabling specified shortcuts. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_shorts_mask Shortcuts to enable. */ -__STATIC_INLINE void nrf_spis_shorts_enable(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_shorts_enable(NRF_SPIS_Type * p_reg, uint32_t spis_shorts_mask); /** * @brief Function for disabling specified shortcuts. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_shorts_mask Shortcuts to disable. */ -__STATIC_INLINE void nrf_spis_shorts_disable(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_shorts_disable(NRF_SPIS_Type * p_reg, uint32_t spis_shorts_mask); /** * @brief Function for enabling specified interrupts. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_int_mask Interrupts to enable. */ -__STATIC_INLINE void nrf_spis_int_enable(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_int_enable(NRF_SPIS_Type * p_reg, uint32_t spis_int_mask); /** * @brief Function for disabling specified interrupts. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_int_mask Interrupts to disable. */ -__STATIC_INLINE void nrf_spis_int_disable(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_int_disable(NRF_SPIS_Type * p_reg, uint32_t spis_int_mask); /** * @brief Function for retrieving the state of a given interrupt. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spis_int Interrupt to check. * * @retval true If the interrupt is enabled. * @retval false If the interrupt is not enabled. */ -__STATIC_INLINE bool nrf_spis_int_enable_check(NRF_SPIS_Type const * p_spis, +__STATIC_INLINE bool nrf_spis_int_enable_check(NRF_SPIS_Type const * p_reg, nrf_spis_int_mask_t spis_int); /** * @brief Function for enabling the SPIS peripheral. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spis_enable(NRF_SPIS_Type * p_spis); +__STATIC_INLINE void nrf_spis_enable(NRF_SPIS_Type * p_reg); /** * @brief Function for disabling the SPIS peripheral. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_spis_disable(NRF_SPIS_Type * p_spis); +__STATIC_INLINE void nrf_spis_disable(NRF_SPIS_Type * p_reg); /** * @brief Function for retrieving the SPIS semaphore status. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @returns Current semaphore status. */ -__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get(NRF_SPIS_Type * p_spis); +__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get(NRF_SPIS_Type * p_reg); /** * @brief Function for retrieving the SPIS status. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @returns Current SPIS status. */ -__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_spis); +__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_reg); /** * @brief Function for configuring SPIS pins. @@ -280,13 +284,13 @@ __STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_spi * If a given signal is not needed, pass the @ref NRF_SPIS_PIN_NOT_CONNECTED * value instead of its pin number. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] sck_pin SCK pin number. * @param[in] mosi_pin MOSI pin number. * @param[in] miso_pin MISO pin number. * @param[in] csn_pin CSN pin number. */ -__STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin, @@ -295,22 +299,22 @@ __STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_spis, /** * @brief Function for setting the transmit buffer. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] p_buffer Pointer to the buffer that contains the data to send. * @param[in] length Maximum number of data bytes to transmit. */ -__STATIC_INLINE void nrf_spis_tx_buffer_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_tx_buffer_set(NRF_SPIS_Type * p_reg, uint8_t const * p_buffer, uint8_t length); /** * @brief Function for setting the receive buffer. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] p_buffer Pointer to the buffer for received data. * @param[in] length Maximum number of data bytes to receive. */ -__STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_reg, uint8_t * p_buffer, uint8_t length); @@ -318,176 +322,180 @@ __STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_spis, * @brief Function for getting the number of bytes transmitted * in the last granted transaction. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @returns Number of bytes transmitted. */ -__STATIC_INLINE uint8_t nrf_spis_tx_amount_get(NRF_SPIS_Type const * p_spis); +__STATIC_INLINE uint8_t nrf_spis_tx_amount_get(NRF_SPIS_Type const * p_reg); /** * @brief Function for getting the number of bytes received * in the last granted transaction. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @returns Number of bytes received. */ -__STATIC_INLINE uint8_t nrf_spis_rx_amount_get(NRF_SPIS_Type const * p_spis); +__STATIC_INLINE uint8_t nrf_spis_rx_amount_get(NRF_SPIS_Type const * p_reg); /** * @brief Function for setting the SPI configuration. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] spi_mode SPI mode. * @param[in] spi_bit_order SPI bit order. */ -__STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_reg, nrf_spis_mode_t spi_mode, nrf_spis_bit_order_t spi_bit_order); /** * @brief Function for setting the default character. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] def Default character that is clocked out in case of * an overflow of the RXD buffer. */ -__STATIC_INLINE void nrf_spis_def_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_def_set(NRF_SPIS_Type * p_reg, uint8_t def); /** * @brief Function for setting the over-read character. * - * @param[in] p_spis SPIS instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] orc Over-read character that is clocked out in case of * an over-read of the TXD buffer. */ -__STATIC_INLINE void nrf_spis_orc_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_orc_set(NRF_SPIS_Type * p_reg, uint8_t orc); #ifndef SUPPRESS_INLINE_IMPLEMENTATION -__STATIC_INLINE void nrf_spis_task_trigger(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_task_trigger(NRF_SPIS_Type * p_reg, nrf_spis_task_t spis_task) { - *((volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_task)) = 0x1UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spis_task)) = 0x1UL; } -__STATIC_INLINE uint32_t nrf_spis_task_address_get(NRF_SPIS_Type const * p_spis, +__STATIC_INLINE uint32_t nrf_spis_task_address_get(NRF_SPIS_Type const * p_reg, nrf_spis_task_t spis_task) { - return (uint32_t)p_spis + (uint32_t)spis_task; -} - -__STATIC_INLINE void nrf_spis_event_clear(NRF_SPIS_Type * p_spis, - nrf_spis_event_t spis_event) -{ - *((volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_event)) = 0x0UL; + return (uint32_t)p_reg + (uint32_t)spis_task; } -__STATIC_INLINE bool nrf_spis_event_check(NRF_SPIS_Type const * p_spis, +__STATIC_INLINE void nrf_spis_event_clear(NRF_SPIS_Type * p_reg, nrf_spis_event_t spis_event) { - return (bool)*(volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_event); + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spis_event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spis_event)); + (void)dummy; +#endif } -__STATIC_INLINE uint32_t nrf_spis_event_address_get(NRF_SPIS_Type const * p_spis, +__STATIC_INLINE bool nrf_spis_event_check(NRF_SPIS_Type const * p_reg, + nrf_spis_event_t spis_event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spis_event); +} + +__STATIC_INLINE uint32_t nrf_spis_event_address_get(NRF_SPIS_Type const * p_reg, nrf_spis_event_t spis_event) { - return (uint32_t)p_spis + (uint32_t)spis_event; + return (uint32_t)p_reg + (uint32_t)spis_event; } -__STATIC_INLINE void nrf_spis_shorts_enable(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_shorts_enable(NRF_SPIS_Type * p_reg, uint32_t spis_shorts_mask) { - p_spis->SHORTS |= spis_shorts_mask; + p_reg->SHORTS |= spis_shorts_mask; } -__STATIC_INLINE void nrf_spis_shorts_disable(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_shorts_disable(NRF_SPIS_Type * p_reg, uint32_t spis_shorts_mask) { - p_spis->SHORTS &= ~(spis_shorts_mask); + p_reg->SHORTS &= ~(spis_shorts_mask); } -__STATIC_INLINE void nrf_spis_int_enable(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_int_enable(NRF_SPIS_Type * p_reg, uint32_t spis_int_mask) { - p_spis->INTENSET = spis_int_mask; + p_reg->INTENSET = spis_int_mask; } -__STATIC_INLINE void nrf_spis_int_disable(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_int_disable(NRF_SPIS_Type * p_reg, uint32_t spis_int_mask) { - p_spis->INTENCLR = spis_int_mask; + p_reg->INTENCLR = spis_int_mask; } -__STATIC_INLINE bool nrf_spis_int_enable_check(NRF_SPIS_Type const * p_spis, +__STATIC_INLINE bool nrf_spis_int_enable_check(NRF_SPIS_Type const * p_reg, nrf_spis_int_mask_t spis_int) { - return (bool)(p_spis->INTENSET & spis_int); + return (bool)(p_reg->INTENSET & spis_int); } -__STATIC_INLINE void nrf_spis_enable(NRF_SPIS_Type * p_spis) +__STATIC_INLINE void nrf_spis_enable(NRF_SPIS_Type * p_reg) { - p_spis->ENABLE = (SPIS_ENABLE_ENABLE_Enabled << SPIS_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (SPIS_ENABLE_ENABLE_Enabled << SPIS_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_spis_disable(NRF_SPIS_Type * p_spis) +__STATIC_INLINE void nrf_spis_disable(NRF_SPIS_Type * p_reg) { - p_spis->ENABLE = (SPIS_ENABLE_ENABLE_Disabled << SPIS_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (SPIS_ENABLE_ENABLE_Disabled << SPIS_ENABLE_ENABLE_Pos); } -__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get(NRF_SPIS_Type * p_spis) +__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get(NRF_SPIS_Type * p_reg) { - return (nrf_spis_semstat_t) ((p_spis->SEMSTAT & SPIS_SEMSTAT_SEMSTAT_Msk) + return (nrf_spis_semstat_t) ((p_reg->SEMSTAT & SPIS_SEMSTAT_SEMSTAT_Msk) >> SPIS_SEMSTAT_SEMSTAT_Pos); } -__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_spis) +__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_reg) { - return (nrf_spis_status_mask_t) p_spis->STATUS; + return (nrf_spis_status_mask_t) p_reg->STATUS; } -__STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin, uint32_t csn_pin) { - p_spis->PSELSCK = sck_pin; - p_spis->PSELMOSI = mosi_pin; - p_spis->PSELMISO = miso_pin; - p_spis->PSELCSN = csn_pin; + p_reg->PSELSCK = sck_pin; + p_reg->PSELMOSI = mosi_pin; + p_reg->PSELMISO = miso_pin; + p_reg->PSELCSN = csn_pin; } -__STATIC_INLINE void nrf_spis_tx_buffer_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_tx_buffer_set(NRF_SPIS_Type * p_reg, uint8_t const * p_buffer, uint8_t length) { - p_spis->TXDPTR = (uint32_t)p_buffer; - p_spis->MAXTX = length; + p_reg->TXDPTR = (uint32_t)p_buffer; + p_reg->MAXTX = length; } -__STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_reg, uint8_t * p_buffer, uint8_t length) { - p_spis->RXDPTR = (uint32_t)p_buffer; - p_spis->MAXRX = length; + p_reg->RXDPTR = (uint32_t)p_buffer; + p_reg->MAXRX = length; } -__STATIC_INLINE uint8_t nrf_spis_tx_amount_get(NRF_SPIS_Type const * p_spis) +__STATIC_INLINE uint8_t nrf_spis_tx_amount_get(NRF_SPIS_Type const * p_reg) { - return (uint8_t) p_spis->AMOUNTRX; + return (uint8_t) p_reg->AMOUNTTX; } -__STATIC_INLINE uint8_t nrf_spis_rx_amount_get(NRF_SPIS_Type const * p_spis) +__STATIC_INLINE uint8_t nrf_spis_rx_amount_get(NRF_SPIS_Type const * p_reg) { - return (uint8_t) p_spis->AMOUNTTX; + return (uint8_t) p_reg->AMOUNTRX; } -__STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_reg, nrf_spis_mode_t spi_mode, nrf_spis_bit_order_t spi_bit_order) { @@ -517,23 +525,28 @@ __STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_spis, (SPIS_CONFIG_CPHA_Trailing << SPIS_CONFIG_CPHA_Pos); break; } - p_spis->CONFIG = config; + p_reg->CONFIG = config; } -__STATIC_INLINE void nrf_spis_orc_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_orc_set(NRF_SPIS_Type * p_reg, uint8_t orc) { - p_spis->ORC = orc; + p_reg->ORC = orc; } -__STATIC_INLINE void nrf_spis_def_set(NRF_SPIS_Type * p_spis, +__STATIC_INLINE void nrf_spis_def_set(NRF_SPIS_Type * p_reg, uint8_t def) { - p_spis->DEF = def; + p_reg->DEF = def; } #endif // SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + #endif // NRF_SPIS_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_temp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_temp.h index 001f7f0bc9..031cbd52b1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_temp.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_temp.h @@ -36,12 +36,15 @@ * */ - #ifndef NRF_TEMP_H__ #define NRF_TEMP_H__ #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup nrf_temperature TEMP (temperature) abstraction * @{ @@ -71,12 +74,17 @@ static __INLINE void nrf_temp_init(void) * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. */ static __INLINE int32_t nrf_temp_read(void) -{ +{ /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ - return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); + return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); } /**@endcond */ /** @} */ + +#ifdef __cplusplus +} +#endif + #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_timer.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_timer.h index 85d4ac5a1b..722da8ac44 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_timer.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_timer.h @@ -36,7 +36,6 @@ * */ - /** * @defgroup nrf_timer_hal Timer HAL * @{ @@ -52,37 +51,55 @@ #include #include +#include "nrf_peripherals.h" #include "nrf.h" #include "nrf_assert.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Macro for validating the correctness of the BIT_WIDTH setting. */ -#ifdef NRF51 - /** - * In the nRF51 Series, timer instance 0 supports all available bit widths. - * The other two instances support only 8 and 16 bits. - */ - #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_timer, bit_width) \ - ((p_timer == NRF_TIMER0) || (bit_width <= NRF_TIMER_BIT_WIDTH_16)) + +#define TIMER_MAX_SIZE(id) CONCAT_3(TIMER, id, _MAX_SIZE) + +#define TIMER_BIT_WIDTH_MAX(id, bit_width) \ + (TIMER_MAX_SIZE(id) == 8 ? (bit_width == NRF_TIMER_BIT_WIDTH_8) : \ + (TIMER_MAX_SIZE(id) == 16 ? (bit_width == NRF_TIMER_BIT_WIDTH_8) || \ + (bit_width == NRF_TIMER_BIT_WIDTH_16) : \ + (TIMER_MAX_SIZE(id) == 24 ? (bit_width == NRF_TIMER_BIT_WIDTH_8) || \ + (bit_width == NRF_TIMER_BIT_WIDTH_16) || \ + (bit_width == NRF_TIMER_BIT_WIDTH_24) : \ + (TIMER_MAX_SIZE(id) == 32 ? (bit_width == NRF_TIMER_BIT_WIDTH_8) || \ + (bit_width == NRF_TIMER_BIT_WIDTH_16) || \ + (bit_width == NRF_TIMER_BIT_WIDTH_24) || \ + (bit_width == NRF_TIMER_BIT_WIDTH_32) : \ + false)))) + +#if TIMER_COUNT > 3 +#define NRF_TIMER_IS_BIT_WIDTH_VALID(p_reg, bit_width) ( \ + ((p_reg == NRF_TIMER0) && (TIMER_BIT_WIDTH_MAX(0, bit_width))) \ + || ((p_reg == NRF_TIMER1) && (TIMER_BIT_WIDTH_MAX(1, bit_width))) \ + || ((p_reg == NRF_TIMER2) && (TIMER_BIT_WIDTH_MAX(2, bit_width))) \ + || ((p_reg == NRF_TIMER3) && (TIMER_BIT_WIDTH_MAX(3, bit_width))) \ + || ((p_reg == NRF_TIMER4) && (TIMER_BIT_WIDTH_MAX(4, bit_width))) ) + #else - /** - * In the nRF52 Series, all timer instances support all available bit widths. - */ - #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_timer, bit_width) true +#define NRF_TIMER_IS_BIT_WIDTH_VALID(p_reg, bit_width) ( \ + ((p_reg == NRF_TIMER0) && TIMER_BIT_WIDTH_MAX(0, bit_width)) \ + || ((p_reg == NRF_TIMER1) && TIMER_BIT_WIDTH_MAX(1, bit_width)) \ + || ((p_reg == NRF_TIMER2) && TIMER_BIT_WIDTH_MAX(2, bit_width)) ) + #endif /** * @brief Macro for getting the number of capture/compare channels available * in a given timer instance. */ -#ifdef NRF51 - #define NRF_TIMER_CC_CHANNEL_COUNT(id) 4 -#else - #define NRF_TIMER_CC_CHANNEL_COUNT(id) ((id) <= 2 ? 4 : 6) -#endif - +#define NRF_TIMER_CC_CHANNEL_COUNT(id) CONCAT_3(TIMER, id, _CC_NUM) /** * @brief Timer tasks. @@ -99,7 +116,7 @@ typedef enum NRF_TIMER_TASK_CAPTURE1 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[1]), ///< Task for capturing the timer value on channel 1. NRF_TIMER_TASK_CAPTURE2 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[2]), ///< Task for capturing the timer value on channel 2. NRF_TIMER_TASK_CAPTURE3 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[3]), ///< Task for capturing the timer value on channel 3. -#ifdef NRF52 +#if (TIMER_COUNT > 3) || defined(__SDK_DOXYGEN__) NRF_TIMER_TASK_CAPTURE4 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[4]), ///< Task for capturing the timer value on channel 4. NRF_TIMER_TASK_CAPTURE5 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[5]), ///< Task for capturing the timer value on channel 5. #endif @@ -116,7 +133,7 @@ typedef enum NRF_TIMER_EVENT_COMPARE1 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[1]), ///< Event from compare channel 1. NRF_TIMER_EVENT_COMPARE2 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[2]), ///< Event from compare channel 2. NRF_TIMER_EVENT_COMPARE3 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[3]), ///< Event from compare channel 3. -#ifdef NRF52 +#if (TIMER_COUNT > 3) || defined(__SDK_DOXYGEN__) NRF_TIMER_EVENT_COMPARE4 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[4]), ///< Event from compare channel 4. NRF_TIMER_EVENT_COMPARE5 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[5]), ///< Event from compare channel 5. #endif @@ -132,7 +149,7 @@ typedef enum NRF_TIMER_SHORT_COMPARE1_STOP_MASK = TIMER_SHORTS_COMPARE1_STOP_Msk, ///< Shortcut for stopping the timer based on compare 1. NRF_TIMER_SHORT_COMPARE2_STOP_MASK = TIMER_SHORTS_COMPARE2_STOP_Msk, ///< Shortcut for stopping the timer based on compare 2. NRF_TIMER_SHORT_COMPARE3_STOP_MASK = TIMER_SHORTS_COMPARE3_STOP_Msk, ///< Shortcut for stopping the timer based on compare 3. -#ifdef NRF52 +#if (TIMER_COUNT > 3) || defined(__SDK_DOXYGEN__) NRF_TIMER_SHORT_COMPARE4_STOP_MASK = TIMER_SHORTS_COMPARE4_STOP_Msk, ///< Shortcut for stopping the timer based on compare 4. NRF_TIMER_SHORT_COMPARE5_STOP_MASK = TIMER_SHORTS_COMPARE5_STOP_Msk, ///< Shortcut for stopping the timer based on compare 5. #endif @@ -140,7 +157,7 @@ typedef enum NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK = TIMER_SHORTS_COMPARE1_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 1. NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK = TIMER_SHORTS_COMPARE2_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 2. NRF_TIMER_SHORT_COMPARE3_CLEAR_MASK = TIMER_SHORTS_COMPARE3_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 3. -#ifdef NRF52 +#if (TIMER_COUNT > 3) || defined(__SDK_DOXYGEN__) NRF_TIMER_SHORT_COMPARE4_CLEAR_MASK = TIMER_SHORTS_COMPARE4_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 4. NRF_TIMER_SHORT_COMPARE5_CLEAR_MASK = TIMER_SHORTS_COMPARE5_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 5. #endif @@ -153,7 +170,7 @@ typedef enum { NRF_TIMER_MODE_TIMER = TIMER_MODE_MODE_Timer, ///< Timer mode: timer. NRF_TIMER_MODE_COUNTER = TIMER_MODE_MODE_Counter, ///< Timer mode: counter. -#ifdef NRF52 +#if defined(TIMER_MODE_MODE_LowPowerCounter) || defined(__SDK_DOXYGEN__) NRF_TIMER_MODE_LOW_POWER_COUNTER = TIMER_MODE_MODE_LowPowerCounter, ///< Timer mode: low-power counter. #endif } nrf_timer_mode_t; @@ -195,7 +212,7 @@ typedef enum NRF_TIMER_CC_CHANNEL1, ///< Timer capture/compare channel 1. NRF_TIMER_CC_CHANNEL2, ///< Timer capture/compare channel 2. NRF_TIMER_CC_CHANNEL3, ///< Timer capture/compare channel 3. -#ifdef NRF52 +#if (TIMER_COUNT > 3) || defined(__SDK_DOXYGEN__) NRF_TIMER_CC_CHANNEL4, ///< Timer capture/compare channel 4. NRF_TIMER_CC_CHANNEL5, ///< Timer capture/compare channel 5. #endif @@ -210,7 +227,7 @@ typedef enum NRF_TIMER_INT_COMPARE1_MASK = TIMER_INTENSET_COMPARE1_Msk, ///< Timer interrupt from compare event on channel 1. NRF_TIMER_INT_COMPARE2_MASK = TIMER_INTENSET_COMPARE2_Msk, ///< Timer interrupt from compare event on channel 2. NRF_TIMER_INT_COMPARE3_MASK = TIMER_INTENSET_COMPARE3_Msk, ///< Timer interrupt from compare event on channel 3. -#ifdef NRF52 +#if (TIMER_COUNT > 3) || defined(__SDK_DOXYGEN__) NRF_TIMER_INT_COMPARE4_MASK = TIMER_INTENSET_COMPARE4_Msk, ///< Timer interrupt from compare event on channel 4. NRF_TIMER_INT_COMPARE5_MASK = TIMER_INTENSET_COMPARE5_Msk, ///< Timer interrupt from compare event on channel 5. #endif @@ -220,177 +237,177 @@ typedef enum /** * @brief Function for activating a specific timer task. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] task Task to activate. */ -__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_reg, nrf_timer_task_t task); /** * @brief Function for getting the address of a specific timer task register. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] task Requested task. * * @return Address of the specified task register. */ -__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_timer, +__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_reg, nrf_timer_task_t task); /** * @brief Function for clearing a specific timer event. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Event to clear. */ -__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_reg, nrf_timer_event_t event); /** * @brief Function for checking the state of a specific timer event. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Event to check. * * @retval true If the event is set. * @retval false If the event is not set. */ -__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_timer, +__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_reg, nrf_timer_event_t event); /** * @brief Function for getting the address of a specific timer event register. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Requested event. * * @return Address of the specified event register. */ -__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_timer, +__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_reg, nrf_timer_event_t event); /** * @brief Function for enabling specified shortcuts. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] timer_shorts_mask Shortcuts to enable. */ -__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_reg, uint32_t timer_shorts_mask); /** * @brief Function for disabling specified shortcuts. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] timer_shorts_mask Shortcuts to disable. */ -__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_reg, uint32_t timer_shorts_mask); /** * @brief Function for enabling specified interrupts. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] timer_int_mask Interrupts to enable. */ -__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_reg, uint32_t timer_int_mask); /** * @brief Function for disabling specified interrupts. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] timer_int_mask Interrupts to disable. */ -__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_reg, uint32_t timer_int_mask); /** * @brief Function for retrieving the state of a given interrupt. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] timer_int Interrupt to check. * * @retval true If the interrupt is enabled. * @retval false If the interrupt is not enabled. */ -__STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_timer, +__STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_reg, uint32_t timer_int); /** * @brief Function for setting the timer mode. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] mode Timer mode. */ -__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_reg, nrf_timer_mode_t mode); /** * @brief Function for retrieving the timer mode. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @return Timer mode. */ -__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_timer); +__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_reg); /** * @brief Function for setting the timer bit width. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] bit_width Timer bit width. */ -__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_reg, nrf_timer_bit_width_t bit_width); /** * @brief Function for retrieving the timer bit width. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @return Timer bit width. */ -__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_timer); +__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_reg); /** * @brief Function for setting the timer frequency. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] frequency Timer frequency. */ -__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_reg, nrf_timer_frequency_t frequency); /** * @brief Function for retrieving the timer frequency. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @return Timer frequency. */ -__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_timer); +__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_reg); /** * @brief Function for writing the capture/compare register for a specified channel. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] cc_channel Requested capture/compare channel. * @param[in] cc_value Value to write to the capture/compare register. */ -__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_reg, nrf_timer_cc_channel_t cc_channel, uint32_t cc_value); /** * @brief Function for retrieving the capture/compare value for a specified channel. * - * @param[in] p_timer Timer instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] cc_channel Requested capture/compare channel. * * @return Value from the requested capture/compare register. */ -__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_timer, +__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_reg, nrf_timer_cc_channel_t cc_channel); /** @@ -447,115 +464,119 @@ __STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms, #ifndef SUPPRESS_INLINE_IMPLEMENTATION -__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_reg, nrf_timer_task_t task) { - *((volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)task)) = 0x1UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL; } -__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_timer, +__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_reg, nrf_timer_task_t task) { - return (uint32_t *)((uint8_t *)p_timer + (uint32_t)task); + return (uint32_t *)((uint8_t *)p_reg + (uint32_t)task); } -__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_reg, nrf_timer_event_t event) { - *((volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)event)) = 0x0UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)); + (void)dummy; +#endif } -__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_timer, +__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_reg, nrf_timer_event_t event) { - return (bool)*(volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)event); + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event); } -__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_timer, +__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_reg, nrf_timer_event_t event) { - return (uint32_t *)((uint8_t *)p_timer + (uint32_t)event); + return (uint32_t *)((uint8_t *)p_reg + (uint32_t)event); } -__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_reg, uint32_t timer_shorts_mask) { - p_timer->SHORTS |= timer_shorts_mask; + p_reg->SHORTS |= timer_shorts_mask; } -__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_reg, uint32_t timer_shorts_mask) { - p_timer->SHORTS &= ~(timer_shorts_mask); + p_reg->SHORTS &= ~(timer_shorts_mask); } -__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_reg, uint32_t timer_int_mask) { - p_timer->INTENSET = timer_int_mask; + p_reg->INTENSET = timer_int_mask; } -__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_reg, uint32_t timer_int_mask) { - p_timer->INTENCLR = timer_int_mask; + p_reg->INTENCLR = timer_int_mask; } -__STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_timer, +__STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_reg, uint32_t timer_int) { - return (bool)(p_timer->INTENSET & timer_int); + return (bool)(p_reg->INTENSET & timer_int); } -__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_reg, nrf_timer_mode_t mode) { - p_timer->MODE = (p_timer->MODE & ~TIMER_MODE_MODE_Msk) | + p_reg->MODE = (p_reg->MODE & ~TIMER_MODE_MODE_Msk) | ((mode << TIMER_MODE_MODE_Pos) & TIMER_MODE_MODE_Msk); } -__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_timer) +__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_reg) { - return (nrf_timer_mode_t)(p_timer->MODE); + return (nrf_timer_mode_t)(p_reg->MODE); } -__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_reg, nrf_timer_bit_width_t bit_width) { - p_timer->BITMODE = (p_timer->BITMODE & ~TIMER_BITMODE_BITMODE_Msk) | + p_reg->BITMODE = (p_reg->BITMODE & ~TIMER_BITMODE_BITMODE_Msk) | ((bit_width << TIMER_BITMODE_BITMODE_Pos) & TIMER_BITMODE_BITMODE_Msk); } -__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_timer) +__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_reg) { - return (nrf_timer_bit_width_t)(p_timer->BITMODE); + return (nrf_timer_bit_width_t)(p_reg->BITMODE); } -__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_reg, nrf_timer_frequency_t frequency) { - p_timer->PRESCALER = (p_timer->PRESCALER & ~TIMER_PRESCALER_PRESCALER_Msk) | + p_reg->PRESCALER = (p_reg->PRESCALER & ~TIMER_PRESCALER_PRESCALER_Msk) | ((frequency << TIMER_PRESCALER_PRESCALER_Pos) & TIMER_PRESCALER_PRESCALER_Msk); } -__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_timer) +__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_reg) { - return (nrf_timer_frequency_t)(p_timer->PRESCALER); + return (nrf_timer_frequency_t)(p_reg->PRESCALER); } -__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_timer, +__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_reg, nrf_timer_cc_channel_t cc_channel, uint32_t cc_value) { - p_timer->CC[cc_channel] = cc_value; + p_reg->CC[cc_channel] = cc_value; } -__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_timer, +__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_reg, nrf_timer_cc_channel_t cc_channel) { - return (uint32_t)p_timer->CC[cc_channel]; + return (uint32_t)p_reg->CC[cc_channel]; } __STATIC_INLINE nrf_timer_task_t nrf_timer_capture_task_get(uint32_t channel) @@ -598,6 +619,11 @@ __STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms, #endif // SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + #endif // NRF_TIMER_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twi.h index bd2198082a..d1ad8a911e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twi.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twi.h @@ -36,14 +36,13 @@ * */ - #ifndef NRF_TWI_H__ #define NRF_TWI_H__ - + /** * @defgroup nrf_twi_hal TWI HAL * @{ - * @ingroup nrf_twi_master + * @ingroup nrf_twi * * @brief Hardware access layer for managing the TWI peripheral. */ @@ -52,8 +51,13 @@ #include #include +#include "nrf_peripherals.h" #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief TWI tasks. */ @@ -131,136 +135,136 @@ typedef enum /** * @brief Function for activating a specific TWI task. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] task Task to activate. */ -__STATIC_INLINE void nrf_twi_task_trigger(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_task_trigger(NRF_TWI_Type * p_reg, nrf_twi_task_t task); /** * @brief Function for getting the address of a specific TWI task register. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] task Requested task. * * @return Address of the specified task register. */ -__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_twi, +__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_reg, nrf_twi_task_t task); /** * @brief Function for clearing a specific TWI event. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Event to clear. */ -__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type * p_reg, nrf_twi_event_t event); /** * @brief Function for checking the state of a specific event. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Event to check. * * @retval true If the event is set. * @retval false If the event is not set. */ -__STATIC_INLINE bool nrf_twi_event_check(NRF_TWI_Type * p_twi, +__STATIC_INLINE bool nrf_twi_event_check(NRF_TWI_Type * p_reg, nrf_twi_event_t event); /** * @brief Function for getting the address of a specific TWI event register. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Requested event. * * @return Address of the specified event register. */ -__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type * p_twi, +__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type * p_reg, nrf_twi_event_t event); /** * @brief Function for enabling specified shortcuts. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] shorts_mask Shortcuts to enable. */ -__STATIC_INLINE void nrf_twi_shorts_enable(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_shorts_enable(NRF_TWI_Type * p_reg, uint32_t shorts_mask); /** * @brief Function for disabling specified shortcuts. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] shorts_mask Shortcuts to disable. */ -__STATIC_INLINE void nrf_twi_shorts_disable(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_shorts_disable(NRF_TWI_Type * p_reg, uint32_t shorts_mask); /** * @brief Function for enabling specified interrupts. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] int_mask Interrupts to enable. */ -__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_reg, uint32_t int_mask); /** * @brief Function for disabling specified interrupts. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] int_mask Interrupts to disable. */ -__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_reg, uint32_t int_mask); /** * @brief Function for retrieving the state of a given interrupt. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] int_mask Interrupt to check. * * @retval true If the interrupt is enabled. * @retval false If the interrupt is not enabled. */ -__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_twi, +__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_reg, nrf_twi_int_mask_t int_mask); /** * @brief Function for enabling the TWI peripheral. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_twi); +__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_reg); /** * @brief Function for disabling the TWI peripheral. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. */ -__STATIC_INLINE void nrf_twi_disable(NRF_TWI_Type * p_twi); +__STATIC_INLINE void nrf_twi_disable(NRF_TWI_Type * p_reg); /** * @brief Function for configuring TWI pins. * * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] scl_pin SCL pin number. * @param[in] sda_pin SDA pin number. */ -__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_reg, uint32_t scl_pin, uint32_t sda_pin); /** * @brief Function for setting the TWI master clock frequency. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] frequency TWI frequency. */ -__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_reg, nrf_twi_frequency_t frequency); /** @@ -268,38 +272,38 @@ __STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_twi, * * The error flags are cleared after reading. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @return Mask with error source flags. */ -__STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear(NRF_TWI_Type * p_twi); +__STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear(NRF_TWI_Type * p_reg); /** * @brief Function for setting the address to be used in TWI transfers. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] address Address to be used in transfers. */ -__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_twi, uint8_t address); +__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_reg, uint8_t address); /** * @brief Function for reading data received by TWI. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * * @return Received data. */ -__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_twi); +__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_reg); /** * @brief Function for writing data to be transmitted by TWI. * - * @param[in] p_twi TWI instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] data Data to be transmitted. */ -__STATIC_INLINE void nrf_twi_txd_set(NRF_TWI_Type * p_twi, uint8_t data); +__STATIC_INLINE void nrf_twi_txd_set(NRF_TWI_Type * p_reg, uint8_t data); -__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_reg, uint32_t shorts_mask); /** @@ -309,121 +313,139 @@ __STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi, #ifndef SUPPRESS_INLINE_IMPLEMENTATION -__STATIC_INLINE void nrf_twi_task_trigger(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_task_trigger(NRF_TWI_Type * p_reg, nrf_twi_task_t task) { - *((volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)task)) = 0x1UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL; } -__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_twi, +__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_reg, nrf_twi_task_t task) { - return (uint32_t *)((uint8_t *)p_twi + (uint32_t)task); + return (uint32_t *)((uint8_t *)p_reg + (uint32_t)task); } -__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type * p_reg, nrf_twi_event_t event) { - *((volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)event)) = 0x0UL; + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)); + (void)dummy; +#endif } -__STATIC_INLINE bool nrf_twi_event_check(NRF_TWI_Type * p_twi, +__STATIC_INLINE bool nrf_twi_event_check(NRF_TWI_Type * p_reg, nrf_twi_event_t event) { - return (bool)*(volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)event); + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event); } -__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type * p_twi, +__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type * p_reg, nrf_twi_event_t event) { - return (uint32_t *)((uint8_t *)p_twi + (uint32_t)event); + return (uint32_t *)((uint8_t *)p_reg + (uint32_t)event); } -__STATIC_INLINE void nrf_twi_shorts_enable(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_shorts_enable(NRF_TWI_Type * p_reg, uint32_t shorts_mask) { - p_twi->SHORTS |= shorts_mask; + p_reg->SHORTS |= shorts_mask; } -__STATIC_INLINE void nrf_twi_shorts_disable(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_shorts_disable(NRF_TWI_Type * p_reg, uint32_t shorts_mask) { - p_twi->SHORTS &= ~(shorts_mask); + p_reg->SHORTS &= ~(shorts_mask); } -__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_reg, uint32_t int_mask) { - p_twi->INTENSET = int_mask; + p_reg->INTENSET = int_mask; } -__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_reg, uint32_t int_mask) { - p_twi->INTENCLR = int_mask; + p_reg->INTENCLR = int_mask; } -__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_twi, +__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_reg, nrf_twi_int_mask_t int_mask) { - return (bool)(p_twi->INTENSET & int_mask); + return (bool)(p_reg->INTENSET & int_mask); } -__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_twi) +__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_reg) { - p_twi->ENABLE = (TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_twi_disable(NRF_TWI_Type * p_twi) +__STATIC_INLINE void nrf_twi_disable(NRF_TWI_Type * p_reg) { - p_twi->ENABLE = (TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos); + p_reg->ENABLE = (TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos); } -__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_reg, uint32_t scl_pin, uint32_t sda_pin) { - p_twi->PSELSCL = scl_pin; - p_twi->PSELSDA = sda_pin; +#if defined(TWI_PSEL_SCL_CONNECT_Pos) + p_reg->PSEL.SCL = scl_pin; +#else + p_reg->PSELSCL = scl_pin; +#endif + +#if defined(TWI_PSEL_SDA_CONNECT_Pos) + p_reg->PSEL.SDA = sda_pin; +#else + p_reg->PSELSDA = sda_pin; +#endif } -__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_reg, nrf_twi_frequency_t frequency) { - p_twi->FREQUENCY = frequency; + p_reg->FREQUENCY = frequency; } -__STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear(NRF_TWI_Type * p_twi) +__STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear(NRF_TWI_Type * p_reg) { - uint32_t error_source = p_twi->ERRORSRC; + uint32_t error_source = p_reg->ERRORSRC; // [error flags are cleared by writing '1' on their position] - p_twi->ERRORSRC = error_source; + p_reg->ERRORSRC = error_source; return error_source; } -__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_twi, uint8_t address) +__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_reg, uint8_t address) { - p_twi->ADDRESS = address; + p_reg->ADDRESS = address; } -__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_twi) +__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_reg) { - return (uint8_t)p_twi->RXD; + return (uint8_t)p_reg->RXD; } -__STATIC_INLINE void nrf_twi_txd_set(NRF_TWI_Type * p_twi, uint8_t data) +__STATIC_INLINE void nrf_twi_txd_set(NRF_TWI_Type * p_reg, uint8_t data) { - p_twi->TXD = data; + p_reg->TXD = data; } -__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi, +__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_reg, uint32_t shorts_mask) { - p_twi->SHORTS = shorts_mask; + p_reg->SHORTS = shorts_mask; } #endif // SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + #endif // NRF_TWI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twim.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twim.h new file mode 100644 index 0000000000..98af5b6110 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twim.h @@ -0,0 +1,517 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_TWIM_H__ +#define NRF_TWIM_H__ + +/** + * @defgroup nrf_twim_hal TWIM HAL + * @{ + * @ingroup nrf_twi + * + * @brief Hardware access layer for managing the TWIM peripheral. + */ + +#include +#include +#include + +#include "nrf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief TWIM tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_TWIM_TASK_STARTRX = offsetof(NRF_TWIM_Type, TASKS_STARTRX), ///< Start TWI receive sequence. + NRF_TWIM_TASK_STARTTX = offsetof(NRF_TWIM_Type, TASKS_STARTTX), ///< Start TWI transmit sequence. + NRF_TWIM_TASK_STOP = offsetof(NRF_TWIM_Type, TASKS_STOP), ///< Stop TWI transaction. + NRF_TWIM_TASK_SUSPEND = offsetof(NRF_TWIM_Type, TASKS_SUSPEND), ///< Suspend TWI transaction. + NRF_TWIM_TASK_RESUME = offsetof(NRF_TWIM_Type, TASKS_RESUME) ///< Resume TWI transaction. + /*lint -restore*/ +} nrf_twim_task_t; + +/** + * @brief TWIM events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_TWIM_EVENT_STOPPED = offsetof(NRF_TWIM_Type, EVENTS_STOPPED), ///< TWI stopped. + NRF_TWIM_EVENT_ERROR = offsetof(NRF_TWIM_Type, EVENTS_ERROR), ///< TWI error. + NRF_TWIM_EVENT_SUSPENDED = 0x148, ///< TWI suspended. + NRF_TWIM_EVENT_RXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_RXSTARTED), ///< Receive sequence started. + NRF_TWIM_EVENT_TXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_TXSTARTED), ///< Transmit sequence started. + NRF_TWIM_EVENT_LASTRX = offsetof(NRF_TWIM_Type, EVENTS_LASTRX), ///< Byte boundary, starting to receive the last byte. + NRF_TWIM_EVENT_LASTTX = offsetof(NRF_TWIM_Type, EVENTS_LASTTX) ///< Byte boundary, starting to transmit the last byte. + /*lint -restore*/ +} nrf_twim_event_t; + +/** + * @brief TWIM shortcuts. + */ +typedef enum +{ + NRF_TWIM_SHORT_LASTTX_STARTRX_MASK = TWIM_SHORTS_LASTTX_STARTRX_Msk, ///< Shortcut between LASTTX event and STARTRX task. + NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK = TWIM_SHORTS_LASTTX_SUSPEND_Msk, ///< Shortcut between LASTTX event and SUSPEND task. + NRF_TWIM_SHORT_LASTTX_STOP_MASK = TWIM_SHORTS_LASTTX_STOP_Msk, ///< Shortcut between LASTTX event and STOP task. + NRF_TWIM_SHORT_LASTRX_STARTTX_MASK = TWIM_SHORTS_LASTRX_STARTTX_Msk, ///< Shortcut between LASTRX event and STARTTX task. + NRF_TWIM_SHORT_LASTRX_STOP_MASK = TWIM_SHORTS_LASTRX_STOP_Msk ///< Shortcut between LASTRX event and STOP task. +} nrf_twim_short_mask_t; + +/** + * @brief TWIM interrupts. + */ +typedef enum +{ + NRF_TWIM_INT_STOPPED_MASK = TWIM_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event. + NRF_TWIM_INT_ERROR_MASK = TWIM_INTENSET_ERROR_Msk, ///< Interrupt on ERROR event. + NRF_TWIM_INT_SUSPENDED_MASK = (1 << 18), ///< Interrupt on SUSPENDED event. + NRF_TWIM_INT_RXSTARTED_MASK = TWIM_INTENSET_RXSTARTED_Msk, ///< Interrupt on RXSTARTED event. + NRF_TWIM_INT_TXSTARTED_MASK = TWIM_INTENSET_TXSTARTED_Msk, ///< Interrupt on TXSTARTED event. + NRF_TWIM_INT_LASTRX_MASK = TWIM_INTENSET_LASTRX_Msk, ///< Interrupt on LASTRX event. + NRF_TWIM_INT_LASTTX_MASK = TWIM_INTENSET_LASTTX_Msk ///< Interrupt on LASTTX event. +} nrf_twim_int_mask_t; + +/** + * @brief TWIM master clock frequency. + */ +typedef enum +{ + NRF_TWIM_FREQ_100K = TWIM_FREQUENCY_FREQUENCY_K100, ///< 100 kbps. + NRF_TWIM_FREQ_250K = TWIM_FREQUENCY_FREQUENCY_K250, ///< 250 kbps. + NRF_TWIM_FREQ_400K = TWIM_FREQUENCY_FREQUENCY_K400 ///< 400 kbps. +} nrf_twim_frequency_t; + +/** + * @brief TWIM error source. + */ +typedef enum +{ + NRF_TWIM_ERROR_ADDRESS_NACK = TWIM_ERRORSRC_ANACK_Msk, ///< NACK received after sending the address. + NRF_TWIM_ERROR_DATA_NACK = TWIM_ERRORSRC_DNACK_Msk ///< NACK received after sending a data byte. +} nrf_twim_error_t; + + +/** + * @brief Function for activating a specific TWIM task. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] task Task to activate. + */ +__STATIC_INLINE void nrf_twim_task_trigger(NRF_TWIM_Type * p_reg, + nrf_twim_task_t task); + +/** + * @brief Function for getting the address of a specific TWIM task register. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] task Requested task. + * + * @return Address of the specified task register. + */ +__STATIC_INLINE uint32_t * nrf_twim_task_address_get(NRF_TWIM_Type * p_reg, + nrf_twim_task_t task); + +/** + * @brief Function for clearing a specific TWIM event. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_twim_event_clear(NRF_TWIM_Type * p_reg, + nrf_twim_event_t event); + +/** + * @brief Function for checking the state of a specific TWIM event. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] event Event to check. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_twim_event_check(NRF_TWIM_Type * p_reg, + nrf_twim_event_t event); + +/** + * @brief Function for getting the address of a specific TWIM event register. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] event Requested event. + * + * @return Address of the specified event register. + */ +__STATIC_INLINE uint32_t * nrf_twim_event_address_get(NRF_TWIM_Type * p_reg, + nrf_twim_event_t event); + +/** + * @brief Function for enabling specified shortcuts. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] shorts_mask Shortcuts to enable. + */ +__STATIC_INLINE void nrf_twim_shorts_enable(NRF_TWIM_Type * p_reg, + uint32_t shorts_mask); + +/** + * @brief Function for disabling specified shortcuts. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] shorts_mask Shortcuts to disable. + */ +__STATIC_INLINE void nrf_twim_shorts_disable(NRF_TWIM_Type * p_reg, + uint32_t shorts_mask); + +/** + * @brief Function for enabling specified interrupts. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_twim_int_enable(NRF_TWIM_Type * p_reg, + uint32_t int_mask); + +/** + * @brief Function for disabling specified interrupts. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_twim_int_disable(NRF_TWIM_Type * p_reg, + uint32_t int_mask); + +/** + * @brief Function for checking the state of a given interrupt. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] int_mask Interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_twim_int_enable_check(NRF_TWIM_Type * p_reg, + nrf_twim_int_mask_t int_mask); + +/** + * @brief Function for enabling the TWIM peripheral. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_twim_enable(NRF_TWIM_Type * p_reg); + +/** + * @brief Function for disabling the TWIM peripheral. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_twim_disable(NRF_TWIM_Type * p_reg); + +/** + * @brief Function for configuring TWI pins. + * + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] scl_pin SCL pin number. + * @param[in] sda_pin SDA pin number. + */ +__STATIC_INLINE void nrf_twim_pins_set(NRF_TWIM_Type * p_reg, + uint32_t scl_pin, + uint32_t sda_pin); + +/** + * @brief Function for setting the TWI master clock frequency. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] frequency TWI frequency. + */ +__STATIC_INLINE void nrf_twim_frequency_set(NRF_TWIM_Type * p_reg, + nrf_twim_frequency_t frequency); + +/** + * @brief Function for checking the TWI error source. + * + * The error flags are cleared after reading. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * + * @return Mask with error source flags. + */ +__STATIC_INLINE uint32_t nrf_twim_errorsrc_get_and_clear(NRF_TWIM_Type * p_reg); + +/** + * @brief Function for setting the address to be used in TWI transfers. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] address Address to be used in transfers. + */ +__STATIC_INLINE void nrf_twim_address_set(NRF_TWIM_Type * p_reg, + uint8_t address); + +/** + * @brief Function for setting the transmit buffer. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] p_buffer Pointer to the buffer with data to send. + * @param[in] length Maximum number of data bytes to transmit. + */ +__STATIC_INLINE void nrf_twim_tx_buffer_set(NRF_TWIM_Type * p_reg, + uint8_t const * p_buffer, + uint8_t length); + +/** + * @brief Function for setting the receive buffer. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] p_buffer Pointer to the buffer for received data. + * @param[in] length Maximum number of data bytes to receive. + */ +__STATIC_INLINE void nrf_twim_rx_buffer_set(NRF_TWIM_Type * p_reg, + uint8_t * p_buffer, + uint8_t length); + +__STATIC_INLINE void nrf_twim_shorts_set(NRF_TWIM_Type * p_reg, + uint32_t shorts_mask); + +__STATIC_INLINE uint32_t nrf_twim_txd_amount_get(NRF_TWIM_Type * p_reg); + +__STATIC_INLINE uint32_t nrf_twim_rxd_amount_get(NRF_TWIM_Type * p_reg); + +/** + * @brief Function for enabling the TX list feature. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_twim_tx_list_enable(NRF_TWIM_Type * p_reg); + +/** + * @brief Function for disabling the TX list feature. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_twim_tx_list_disable(NRF_TWIM_Type * p_reg); + +/** + * @brief Function for enabling the RX list feature. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_twim_rx_list_enable(NRF_TWIM_Type * p_reg); + +/** + * @brief Function for disabling the RX list feature. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_twim_rx_list_disable(NRF_TWIM_Type * p_reg); + +/** + * @} + */ + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_twim_task_trigger(NRF_TWIM_Type * p_reg, + nrf_twim_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t * nrf_twim_task_address_get(NRF_TWIM_Type * p_reg, + nrf_twim_task_t task) +{ + return (uint32_t *)((uint8_t *)p_reg + (uint32_t)task); +} + +__STATIC_INLINE void nrf_twim_event_clear(NRF_TWIM_Type * p_reg, + nrf_twim_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)); + (void)dummy; +#endif +} + +__STATIC_INLINE bool nrf_twim_event_check(NRF_TWIM_Type * p_reg, + nrf_twim_event_t event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event); +} + +__STATIC_INLINE uint32_t * nrf_twim_event_address_get(NRF_TWIM_Type * p_reg, + nrf_twim_event_t event) +{ + return (uint32_t *)((uint8_t *)p_reg + (uint32_t)event); +} + +__STATIC_INLINE void nrf_twim_shorts_enable(NRF_TWIM_Type * p_reg, + uint32_t shorts_mask) +{ + p_reg->SHORTS |= shorts_mask; +} + +__STATIC_INLINE void nrf_twim_shorts_disable(NRF_TWIM_Type * p_reg, + uint32_t shorts_mask) +{ + p_reg->SHORTS &= ~(shorts_mask); +} + +__STATIC_INLINE void nrf_twim_int_enable(NRF_TWIM_Type * p_reg, + uint32_t int_mask) +{ + p_reg->INTENSET = int_mask; +} + +__STATIC_INLINE void nrf_twim_int_disable(NRF_TWIM_Type * p_reg, + uint32_t int_mask) +{ + p_reg->INTENCLR = int_mask; +} + +__STATIC_INLINE bool nrf_twim_int_enable_check(NRF_TWIM_Type * p_reg, + nrf_twim_int_mask_t int_mask) +{ + return (bool)(p_reg->INTENSET & int_mask); +} + +__STATIC_INLINE void nrf_twim_enable(NRF_TWIM_Type * p_reg) +{ + p_reg->ENABLE = (TWIM_ENABLE_ENABLE_Enabled << TWIM_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_twim_disable(NRF_TWIM_Type * p_reg) +{ + p_reg->ENABLE = (TWIM_ENABLE_ENABLE_Disabled << TWIM_ENABLE_ENABLE_Pos); +} + +__STATIC_INLINE void nrf_twim_pins_set(NRF_TWIM_Type * p_reg, + uint32_t scl_pin, + uint32_t sda_pin) +{ + p_reg->PSEL.SCL = scl_pin; + p_reg->PSEL.SDA = sda_pin; +} + +__STATIC_INLINE void nrf_twim_frequency_set(NRF_TWIM_Type * p_reg, + nrf_twim_frequency_t frequency) +{ + p_reg->FREQUENCY = frequency; +} + +__STATIC_INLINE uint32_t nrf_twim_errorsrc_get_and_clear(NRF_TWIM_Type * p_reg) +{ + uint32_t error_source = p_reg->ERRORSRC; + + // [error flags are cleared by writing '1' on their position] + p_reg->ERRORSRC = error_source; + + return error_source; +} + +__STATIC_INLINE void nrf_twim_address_set(NRF_TWIM_Type * p_reg, + uint8_t address) +{ + p_reg->ADDRESS = address; +} + +__STATIC_INLINE void nrf_twim_tx_buffer_set(NRF_TWIM_Type * p_reg, + uint8_t const * p_buffer, + uint8_t length) +{ + p_reg->TXD.PTR = (uint32_t)p_buffer; + p_reg->TXD.MAXCNT = length; +} + +__STATIC_INLINE void nrf_twim_rx_buffer_set(NRF_TWIM_Type * p_reg, + uint8_t * p_buffer, + uint8_t length) +{ + p_reg->RXD.PTR = (uint32_t)p_buffer; + p_reg->RXD.MAXCNT = length; +} + +__STATIC_INLINE void nrf_twim_shorts_set(NRF_TWIM_Type * p_reg, + uint32_t shorts_mask) +{ + p_reg->SHORTS = shorts_mask; +} + +__STATIC_INLINE uint32_t nrf_twim_txd_amount_get(NRF_TWIM_Type * p_reg) +{ + return p_reg->TXD.AMOUNT; +} + +__STATIC_INLINE uint32_t nrf_twim_rxd_amount_get(NRF_TWIM_Type * p_reg) +{ + return p_reg->RXD.AMOUNT; +} + +__STATIC_INLINE void nrf_twim_tx_list_enable(NRF_TWIM_Type * p_reg) +{ + p_reg->TXD.LIST = 1; +} + +__STATIC_INLINE void nrf_twim_tx_list_disable(NRF_TWIM_Type * p_reg) +{ + p_reg->TXD.LIST = 0; +} + +__STATIC_INLINE void nrf_twim_rx_list_enable(NRF_TWIM_Type * p_reg) +{ + p_reg->RXD.LIST = 1; +} + +__STATIC_INLINE void nrf_twim_rx_list_disable(NRF_TWIM_Type * p_reg) +{ + p_reg->RXD.LIST = 0; +} +#endif // SUPPRESS_INLINE_IMPLEMENTATION + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_TWIM_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twis.h new file mode 100644 index 0000000000..7727a1f829 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_twis.h @@ -0,0 +1,705 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @ingroup nrf_twis + * @defgroup nrf_twis_hal TWIS HAL + * @{ + * + * @brief @tagAPI52 Hardware access layer for Two Wire Interface Slave with EasyDMA + * (TWIS) peripheral. + */ +#ifndef NRF_TWIS_H__ +#define NRF_TWIS_H__ + +#include "nrf.h" +#include "sdk_config.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief TWIS tasks + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_TWIS_TASK_STOP = offsetof(NRF_TWIS_Type, TASKS_STOP), /**< Stop TWIS transaction */ + NRF_TWIS_TASK_SUSPEND = offsetof(NRF_TWIS_Type, TASKS_SUSPEND), /**< Suspend TWIS transaction */ + NRF_TWIS_TASK_RESUME = offsetof(NRF_TWIS_Type, TASKS_RESUME), /**< Resume TWIS transaction */ + NRF_TWIS_TASK_PREPARERX = offsetof(NRF_TWIS_Type, TASKS_PREPARERX), /**< Prepare the TWIS slave to respond to a write command */ + NRF_TWIS_TASK_PREPARETX = offsetof(NRF_TWIS_Type, TASKS_PREPARETX) /**< Prepare the TWIS slave to respond to a read command */ + /*lint -restore*/ +} nrf_twis_task_t; + +/** + * @brief TWIS events + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_TWIS_EVENT_STOPPED = offsetof(NRF_TWIS_Type, EVENTS_STOPPED), /**< TWIS stopped */ + NRF_TWIS_EVENT_ERROR = offsetof(NRF_TWIS_Type, EVENTS_ERROR), /**< TWIS error */ + NRF_TWIS_EVENT_RXSTARTED = offsetof(NRF_TWIS_Type, EVENTS_RXSTARTED), /**< Receive sequence started */ + NRF_TWIS_EVENT_TXSTARTED = offsetof(NRF_TWIS_Type, EVENTS_TXSTARTED), /**< Transmit sequence started */ + NRF_TWIS_EVENT_WRITE = offsetof(NRF_TWIS_Type, EVENTS_WRITE), /**< Write command received */ + NRF_TWIS_EVENT_READ = offsetof(NRF_TWIS_Type, EVENTS_READ) /**< Read command received */ + /*lint -restore*/ +} nrf_twis_event_t; + +/** + * @brief TWIS shortcuts + */ +typedef enum +{ + NRF_TWIS_SHORT_WRITE_SUSPEND_MASK = TWIS_SHORTS_WRITE_SUSPEND_Msk, /**< Shortcut between WRITE event and SUSPEND task */ + NRF_TWIS_SHORT_READ_SUSPEND_MASK = TWIS_SHORTS_READ_SUSPEND_Msk, /**< Shortcut between READ event and SUSPEND task */ +} nrf_twis_short_mask_t; + +/** + * @brief TWIS interrupts + */ +typedef enum +{ + NRF_TWIS_INT_STOPPED_MASK = TWIS_INTEN_STOPPED_Msk, /**< Interrupt on STOPPED event */ + NRF_TWIS_INT_ERROR_MASK = TWIS_INTEN_ERROR_Msk, /**< Interrupt on ERROR event */ + NRF_TWIS_INT_RXSTARTED_MASK = TWIS_INTEN_RXSTARTED_Msk, /**< Interrupt on RXSTARTED event */ + NRF_TWIS_INT_TXSTARTED_MASK = TWIS_INTEN_TXSTARTED_Msk, /**< Interrupt on TXSTARTED event */ + NRF_TWIS_INT_WRITE_MASK = TWIS_INTEN_WRITE_Msk, /**< Interrupt on WRITE event */ + NRF_TWIS_INT_READ_MASK = TWIS_INTEN_READ_Msk, /**< Interrupt on READ event */ +} nrf_twis_int_mask_t; + +/** + * @brief TWIS error source + */ +typedef enum +{ + NRF_TWIS_ERROR_OVERFLOW = TWIS_ERRORSRC_OVERFLOW_Msk, /**< RX buffer overflow detected, and prevented */ + NRF_TWIS_ERROR_DATA_NACK = TWIS_ERRORSRC_DNACK_Msk, /**< NACK sent after receiving a data byte */ + NRF_TWIS_ERROR_OVERREAD = TWIS_ERRORSRC_OVERREAD_Msk /**< TX buffer over-read detected, and prevented */ +} nrf_twis_error_t; + +/** + * @brief TWIS address matching configuration + */ +typedef enum +{ + NRF_TWIS_CONFIG_ADDRESS0_MASK = TWIS_CONFIG_ADDRESS0_Msk, /**< Enable or disable address matching on ADDRESS[0] */ + NRF_TWIS_CONFIG_ADDRESS1_MASK = TWIS_CONFIG_ADDRESS1_Msk, /**< Enable or disable address matching on ADDRESS[1] */ + NRF_TWIS_CONFIG_ADDRESS01_MASK = TWIS_CONFIG_ADDRESS0_Msk | TWIS_CONFIG_ADDRESS1_Msk /**< Enable both address matching */ +} nrf_twis_config_addr_mask_t; + +/** + * @brief Variable type to hold amount of data for EasyDMA + * + * Variable of the minimum size that can hold the amount of data to transfer. + * + * @note + * Defined to make it simple to change if EasyDMA would be updated to support more data in + * the future devices to. + */ +typedef uint8_t nrf_twis_amount_t; + +/** + * @brief Smallest variable type to hold TWI address + * + * Variable of the minimum size that can hold single TWI address. + * + * @note + * Defined to make it simple to change if new TWI would support for example + * 10 bit addressing mode. + */ +typedef uint8_t nrf_twis_address_t; + + +/** + * @brief Function for activating a specific TWIS task. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param task Task. + */ +__STATIC_INLINE void nrf_twis_task_trigger(NRF_TWIS_Type * const p_reg, nrf_twis_task_t task); + +/** + * @brief Function for returning the address of a specific TWIS task register. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_twis_task_address_get( + NRF_TWIS_Type const * const p_reg, + nrf_twis_task_t task); + +/** + * @brief Function for clearing a specific event. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param event Event. + */ +__STATIC_INLINE void nrf_twis_event_clear( + NRF_TWIS_Type * const p_reg, + nrf_twis_event_t event); +/** + * @brief Function for returning the state of a specific event. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param event Event. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_twis_event_check( + NRF_TWIS_Type const * const p_reg, + nrf_twis_event_t event); + + +/** + * @brief Function for getting and clearing the state of specific event + * + * This function checks the state of the event and clears it. + * @param[in,out] p_reg Pointer to the peripheral registers structure. + * @param event Event. + * + * @retval true If the event was set. + * @retval false If the event was not set. + */ +__STATIC_INLINE bool nrf_twis_event_get_and_clear( + NRF_TWIS_Type * const p_reg, + nrf_twis_event_t event); + + +/** + * @brief Function for returning the address of a specific TWIS event register. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param event Event. + * + * @return Address. + */ +__STATIC_INLINE uint32_t nrf_twis_event_address_get( + NRF_TWIS_Type const * const p_reg, + nrf_twis_event_t event); + +/** + * @brief Function for setting a shortcut. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param short_mask Shortcuts mask. + */ +__STATIC_INLINE void nrf_twis_shorts_enable(NRF_TWIS_Type * const p_reg, uint32_t short_mask); + +/** + * @brief Function for clearing shortcuts. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param short_mask Shortcuts mask. + */ +__STATIC_INLINE void nrf_twis_shorts_disable(NRF_TWIS_Type * const p_reg, uint32_t short_mask); + +/** + * @brief Get the shorts mask + * + * Function returns shorts register. + * @param[in] p_reg Pointer to the peripheral registers structure. + * @return Flags of currently enabled shortcuts + */ +__STATIC_INLINE uint32_t nrf_twis_shorts_get(NRF_TWIS_Type * const p_reg); + +/** + * @brief Function for enabling selected interrupts. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param int_mask Interrupts mask. + */ +__STATIC_INLINE void nrf_twis_int_enable(NRF_TWIS_Type * const p_reg, uint32_t int_mask); + +/** + * @brief Function for retrieving the state of selected interrupts. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param int_mask Interrupts mask. + * + * @retval true If any of selected interrupts is enabled. + * @retval false If none of selected interrupts is enabled. + */ +__STATIC_INLINE bool nrf_twis_int_enable_check(NRF_TWIS_Type const * const p_reg, uint32_t int_mask); + +/** + * @brief Function for disabling selected interrupts. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param int_mask Interrupts mask. + */ +__STATIC_INLINE void nrf_twis_int_disable(NRF_TWIS_Type * const p_reg, uint32_t int_mask); + +/** + * @brief Function for retrieving and clearing the TWIS error source. + * + * @attention Error sources are cleared after read. + * @param[in] p_reg Pointer to the peripheral registers structure. + * @return Error source mask with values from @ref nrf_twis_error_t. + */ +__STATIC_INLINE uint32_t nrf_twis_error_source_get_and_clear(NRF_TWIS_Type * const p_reg); + +/** + * @brief Get information which of addresses matched + * + * Function returns index in the address table + * that points to the address that already matched. + * @param[in] p_reg Pointer to the peripheral registers structure. + * @return Index of matched address + */ +__STATIC_INLINE uint_fast8_t nrf_twis_match_get(NRF_TWIS_Type const * p_reg); + +/** + * @brief Function for enabling TWIS. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_twis_enable(NRF_TWIS_Type * const p_reg); + +/** + * @brief Function for disabling TWIS. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_twis_disable(NRF_TWIS_Type * const p_reg); + +/** + * @brief Function for configuring TWIS pins. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param scl SCL pin number. + * @param sda SDA pin number. + */ +__STATIC_INLINE void nrf_twis_pins_set(NRF_TWIS_Type * const p_reg, uint32_t scl, uint32_t sda); + +/** + * @brief Function for setting the receive buffer. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param p_buf Pointer to the buffer for received data. + * @param length Maximum number of data bytes to receive. + */ +__STATIC_INLINE void nrf_twis_rx_buffer_set( + NRF_TWIS_Type * const p_reg, + uint8_t * p_buf, + nrf_twis_amount_t length); + +/** + * @brief Function that prepares TWIS for receiving + * + * This function sets receive buffer and then sets NRF_TWIS_TASK_PREPARERX task. + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param p_buf Pointer to the buffer for received data. + * @param length Maximum number of data bytes to receive. + */ +__STATIC_INLINE void nrf_twis_rx_prepare( + NRF_TWIS_Type * const p_reg, + uint8_t * p_buf, + nrf_twis_amount_t length); + +/** + * @brief Function for getting number of bytes received in the last transaction. + * + * @param[in] p_reg TWIS instance. + * @return Amount of bytes received. + * */ +__STATIC_INLINE nrf_twis_amount_t nrf_twis_rx_amount_get(NRF_TWIS_Type const * const p_reg); + +/** + * @brief Function for setting the transmit buffer. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param p_buf Pointer to the buffer with data to send. + * @param length Maximum number of data bytes to transmit. + */ +__STATIC_INLINE void nrf_twis_tx_buffer_set( + NRF_TWIS_Type * const p_reg, + uint8_t const * p_buf, + nrf_twis_amount_t length); + +/** + * @brief Function that prepares TWIS for transmitting + * + * This function sets transmit buffer and then sets NRF_TWIS_TASK_PREPARETX task. + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param p_buf Pointer to the buffer with data to send. + * @param length Maximum number of data bytes to transmit. + */ +__STATIC_INLINE void nrf_twis_tx_prepare( + NRF_TWIS_Type * const p_reg, + uint8_t const * p_buf, + nrf_twis_amount_t length); + +/** + * @brief Function for getting number of bytes transmitted in the last transaction. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @return Amount of bytes transmitted. + */ +__STATIC_INLINE nrf_twis_amount_t nrf_twis_tx_amount_get(NRF_TWIS_Type const * const p_reg); + +/** + * @brief Function for setting slave address + * + * Function sets the selected address for this TWI interface. + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param n Index of address to set + * @param addr Addres to set + * @sa nrf_twis_config_address_set + * @sa nrf_twis_config_address_get + */ +__STATIC_INLINE void nrf_twis_address_set( + NRF_TWIS_Type * const p_reg, + uint_fast8_t n, + nrf_twis_address_t addr); + +/** + * @brief Function for retrieving configured slave address + * + * Function gets the selected address for this TWI interface. + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param n Index of address to get + */ +__STATIC_INLINE nrf_twis_address_t nrf_twis_address_get( + NRF_TWIS_Type const * const p_reg, + uint_fast8_t n); + +/** + * @brief Function for setting the device address configuration. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param addr_mask Mask of address indexes of what device should answer to. + * + * @sa nrf_twis_address_set + */ +__STATIC_INLINE void nrf_twis_config_address_set( + NRF_TWIS_Type * const p_reg, + nrf_twis_config_addr_mask_t addr_mask); + +/** + * @brief Function for retrieving the device address configuration. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * + * @return Mask of address indexes of what device should answer to. + */ +__STATIC_INLINE nrf_twis_config_addr_mask_t nrf_twis_config_address_get( + NRF_TWIS_Type const * const p_reg); + +/** + * @brief Function for setting the over-read character. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] orc Over-read character. Character clocked out in case of + * over-read of the TXD buffer. + */ +__STATIC_INLINE void nrf_twis_orc_set( + NRF_TWIS_Type * const p_reg, + uint8_t orc); + +/** + * @brief Function for setting the over-read character. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * + * @return Over-read character configured for selected instance. + */ +__STATIC_INLINE uint8_t nrf_twis_orc_get(NRF_TWIS_Type const * const p_reg); + + +/** @} */ /* End of nrf_twis_hal */ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +/* ------------------------------------------------------------------------------------------------ + * Internal functions + */ + +/** + * @internal + * @brief Internal function for getting task/event register address + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @oaram offset Offset of the register from the instance beginning + * + * @attention offset has to be modulo 4 value. In other case we can get hardware fault. + * @return Pointer to the register + */ +__STATIC_INLINE volatile uint32_t* nrf_twis_getRegPtr(NRF_TWIS_Type * const p_reg, uint32_t offset) +{ + return (volatile uint32_t*)((uint8_t *)p_reg + (uint32_t)offset); +} + +/** + * @internal + * @brief Internal function for getting task/event register address - constant version + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @oaram offset Offset of the register from the instance beginning + * + * @attention offset has to be modulo 4 value. In other case we can get hardware fault. + * @return Pointer to the register + */ +__STATIC_INLINE volatile const uint32_t* nrf_twis_getRegPtr_c(NRF_TWIS_Type const * const p_reg, uint32_t offset) +{ + return (volatile const uint32_t*)((uint8_t *)p_reg + (uint32_t)offset); +} + + +/* ------------------------------------------------------------------------------------------------ + * Interface functions definitions + */ + + +void nrf_twis_task_trigger(NRF_TWIS_Type * const p_reg, nrf_twis_task_t task) +{ + *(nrf_twis_getRegPtr(p_reg, (uint32_t)task)) = 1UL; +} + +uint32_t nrf_twis_task_address_get( + NRF_TWIS_Type const * const p_reg, + nrf_twis_task_t task) +{ + return (uint32_t)nrf_twis_getRegPtr_c(p_reg, (uint32_t)task); +} + +void nrf_twis_event_clear( + NRF_TWIS_Type * const p_reg, + nrf_twis_event_t event) +{ + *(nrf_twis_getRegPtr(p_reg, (uint32_t)event)) = 0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)); + (void)dummy; +#endif +} + +bool nrf_twis_event_check( + NRF_TWIS_Type const * const p_reg, + nrf_twis_event_t event) +{ + return (bool)*nrf_twis_getRegPtr_c(p_reg, (uint32_t)event); +} + +bool nrf_twis_event_get_and_clear( + NRF_TWIS_Type * const p_reg, + nrf_twis_event_t event) +{ + bool ret = nrf_twis_event_check(p_reg, event); + if (ret) + { + nrf_twis_event_clear(p_reg, event); + } + return ret; +} + +uint32_t nrf_twis_event_address_get( + NRF_TWIS_Type const * const p_reg, + nrf_twis_event_t event) +{ + return (uint32_t)nrf_twis_getRegPtr_c(p_reg, (uint32_t)event); +} + +void nrf_twis_shorts_enable(NRF_TWIS_Type * const p_reg, uint32_t short_mask) +{ + p_reg->SHORTS |= short_mask; +} + +void nrf_twis_shorts_disable(NRF_TWIS_Type * const p_reg, uint32_t short_mask) +{ + if (~0U == short_mask) + { + /* Optimized version for "disable all" */ + p_reg->SHORTS = 0; + } + else + { + p_reg->SHORTS &= ~short_mask; + } +} + +uint32_t nrf_twis_shorts_get(NRF_TWIS_Type * const p_reg) +{ + return p_reg->SHORTS; +} + +void nrf_twis_int_enable(NRF_TWIS_Type * const p_reg, uint32_t int_mask) +{ + p_reg->INTENSET = int_mask; +} + +bool nrf_twis_int_enable_check(NRF_TWIS_Type const * const p_reg, uint32_t int_mask) +{ + return (bool)(p_reg->INTENSET & int_mask); +} + +void nrf_twis_int_disable(NRF_TWIS_Type * const p_reg, uint32_t int_mask) +{ + p_reg->INTENCLR = int_mask; +} + +uint32_t nrf_twis_error_source_get_and_clear(NRF_TWIS_Type * const p_reg) +{ + uint32_t ret = p_reg->ERRORSRC; + p_reg->ERRORSRC = ret; + return ret; +} + +uint_fast8_t nrf_twis_match_get(NRF_TWIS_Type const * p_reg) +{ + return (uint_fast8_t)p_reg->MATCH; +} + +void nrf_twis_enable(NRF_TWIS_Type * const p_reg) +{ + p_reg->ENABLE = (TWIS_ENABLE_ENABLE_Enabled << TWIS_ENABLE_ENABLE_Pos); +} + +void nrf_twis_disable(NRF_TWIS_Type * const p_reg) +{ + p_reg->ENABLE = (TWIS_ENABLE_ENABLE_Disabled << TWIS_ENABLE_ENABLE_Pos); +} + +void nrf_twis_pins_set(NRF_TWIS_Type * const p_reg, uint32_t scl, uint32_t sda) +{ + p_reg->PSEL.SCL = scl; + p_reg->PSEL.SDA = sda; +} + +void nrf_twis_rx_buffer_set( + NRF_TWIS_Type * const p_reg, + uint8_t * p_buf, + nrf_twis_amount_t length) +{ + p_reg->RXD.PTR = (uint32_t)p_buf; + p_reg->RXD.MAXCNT = length; +} + +__STATIC_INLINE void nrf_twis_rx_prepare( + NRF_TWIS_Type * const p_reg, + uint8_t * p_buf, + nrf_twis_amount_t length) +{ + nrf_twis_rx_buffer_set(p_reg, p_buf, length); + nrf_twis_task_trigger(p_reg, NRF_TWIS_TASK_PREPARERX); +} + +nrf_twis_amount_t nrf_twis_rx_amount_get(NRF_TWIS_Type const * const p_reg) +{ + return (nrf_twis_amount_t)p_reg->RXD.AMOUNT; +} + +void nrf_twis_tx_buffer_set( + NRF_TWIS_Type * const p_reg, + uint8_t const * p_buf, + nrf_twis_amount_t length) +{ + p_reg->TXD.PTR = (uint32_t)p_buf; + p_reg->TXD.MAXCNT = length; +} + +__STATIC_INLINE void nrf_twis_tx_prepare( + NRF_TWIS_Type * const p_reg, + uint8_t const * p_buf, + nrf_twis_amount_t length) +{ + nrf_twis_tx_buffer_set(p_reg, p_buf, length); + nrf_twis_task_trigger(p_reg, NRF_TWIS_TASK_PREPARETX); +} + +nrf_twis_amount_t nrf_twis_tx_amount_get(NRF_TWIS_Type const * const p_reg) +{ + return (nrf_twis_amount_t)p_reg->TXD.AMOUNT; +} + +void nrf_twis_address_set( + NRF_TWIS_Type * const p_reg, + uint_fast8_t n, + nrf_twis_address_t addr) +{ + p_reg->ADDRESS[n] = addr; +} + +nrf_twis_address_t nrf_twis_address_get( + NRF_TWIS_Type const * const p_reg, + uint_fast8_t n) +{ + return (nrf_twis_address_t)p_reg->ADDRESS[n]; +} +void nrf_twis_config_address_set( + NRF_TWIS_Type * const p_reg, + nrf_twis_config_addr_mask_t addr_mask) +{ + /* This is the only configuration in TWIS - just write it without masking */ + p_reg->CONFIG = addr_mask; +} + +nrf_twis_config_addr_mask_t nrf_twis_config_address_get(NRF_TWIS_Type const * const p_reg) +{ + return (nrf_twis_config_addr_mask_t)(p_reg->CONFIG & TWIS_ADDRESS_ADDRESS_Msk); +} + +void nrf_twis_orc_set( + NRF_TWIS_Type * const p_reg, + uint8_t orc) +{ + p_reg->ORC = orc; +} + +uint8_t nrf_twis_orc_get(NRF_TWIS_Type const * const p_reg) +{ + return (uint8_t)p_reg->ORC; +} + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_TWIS_H__ */ + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uart.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uart.h index 1d09fe3846..7e3c86f459 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uart.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uart.h @@ -35,15 +35,22 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - #ifndef NRF_UART_H__ #define NRF_UART_H__ #include "nrf.h" +#include "nrf_peripherals.h" #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + +//Temporary defining legacy UART for instance 1 +#define NRF_UART1 (NRF_UART_Type *)NRF_UARTE1 + /** * @defgroup nrf_uart_hal UART HAL * @{ @@ -107,7 +114,7 @@ typedef enum */ typedef enum { -#ifdef NRF52 +#ifdef UARTE_PRESENT NRF_UART_BAUDRATE_1200 = UARTE_BAUDRATE_BAUDRATE_Baud1200, /**< 1200 baud. */ NRF_UART_BAUDRATE_2400 = UARTE_BAUDRATE_BAUDRATE_Baud2400, /**< 2400 baud. */ NRF_UART_BAUDRATE_4800 = UARTE_BAUDRATE_BAUDRATE_Baud4800, /**< 4800 baud. */ @@ -179,7 +186,7 @@ typedef enum /** * @brief Function for clearing a specific UART event. * - * @param[in] p_reg UART instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Event to clear. */ __STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_t event); @@ -187,7 +194,7 @@ __STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_ /** * @brief Function for checking the state of a specific UART event. * - * @param[in] p_reg UART instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Event to check. * * @retval True if event is set, False otherwise. @@ -197,7 +204,7 @@ __STATIC_INLINE bool nrf_uart_event_check(NRF_UART_Type * p_reg, nrf_uart_event_ /** * @brief Function for returning the address of a specific UART event register. * - * @param[in] p_reg UART instance. + * @param[in] p_reg Pointer to the peripheral registers structure. * @param[in] event Desired event. * * @retval Address of specified event register. @@ -208,7 +215,7 @@ __STATIC_INLINE uint32_t nrf_uart_event_address_get(NRF_UART_Type * p_reg, /** * @brief Function for enabling a specific interrupt. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param int_mask Interrupts to enable. */ __STATIC_INLINE void nrf_uart_int_enable(NRF_UART_Type * p_reg, uint32_t int_mask); @@ -216,7 +223,7 @@ __STATIC_INLINE void nrf_uart_int_enable(NRF_UART_Type * p_reg, uint32_t int_mas /** * @brief Function for retrieving the state of a given interrupt. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param int_mask Mask of interrupt to check. * * @retval true If the interrupt is enabled. @@ -227,7 +234,7 @@ __STATIC_INLINE bool nrf_uart_int_enable_check(NRF_UART_Type * p_reg, uint32_t i /** * @brief Function for disabling specific interrupts. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param int_mask Interrupts to disable. */ __STATIC_INLINE void nrf_uart_int_disable(NRF_UART_Type * p_reg, uint32_t int_mask); @@ -235,7 +242,7 @@ __STATIC_INLINE void nrf_uart_int_disable(NRF_UART_Type * p_reg, uint32_t int_ma /** * @brief Function for getting error source mask. Function is clearing error source flags after reading. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @return Mask with error source flags. */ __STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear(NRF_UART_Type * p_reg); @@ -243,21 +250,21 @@ __STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear(NRF_UART_Type * p_reg); /** * @brief Function for enabling UART. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. */ __STATIC_INLINE void nrf_uart_enable(NRF_UART_Type * p_reg); /** * @brief Function for disabling UART. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. */ __STATIC_INLINE void nrf_uart_disable(NRF_UART_Type * p_reg); /** * @brief Function for configuring TX/RX pins. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param pseltxd TXD pin number. * @param pselrxd RXD pin number. */ @@ -266,35 +273,35 @@ __STATIC_INLINE void nrf_uart_txrx_pins_set(NRF_UART_Type * p_reg, uint32_t psel /** * @brief Function for disconnecting TX/RX pins. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. */ __STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg); /** * @brief Function for getting TX pin. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. */ __STATIC_INLINE uint32_t nrf_uart_tx_pin_get(NRF_UART_Type * p_reg); /** * @brief Function for getting RX pin. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. */ __STATIC_INLINE uint32_t nrf_uart_rx_pin_get(NRF_UART_Type * p_reg); /** * @brief Function for getting RTS pin. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. */ __STATIC_INLINE uint32_t nrf_uart_rts_pin_get(NRF_UART_Type * p_reg); /** * @brief Function for getting CTS pin. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. */ __STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg); @@ -302,7 +309,7 @@ __STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg); /** * @brief Function for configuring flow control pins. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param pselrts RTS pin number. * @param pselcts CTS pin number. */ @@ -313,14 +320,14 @@ __STATIC_INLINE void nrf_uart_hwfc_pins_set(NRF_UART_Type * p_reg, /** * @brief Function for disconnecting flow control pins. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. */ __STATIC_INLINE void nrf_uart_hwfc_pins_disconnect(NRF_UART_Type * p_reg); /** * @brief Function for reading RX data. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @return Received byte. */ __STATIC_INLINE uint8_t nrf_uart_rxd_get(NRF_UART_Type * p_reg); @@ -328,7 +335,7 @@ __STATIC_INLINE uint8_t nrf_uart_rxd_get(NRF_UART_Type * p_reg); /** * @brief Function for setting Tx data. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param txd Byte. */ __STATIC_INLINE void nrf_uart_txd_set(NRF_UART_Type * p_reg, uint8_t txd); @@ -336,7 +343,7 @@ __STATIC_INLINE void nrf_uart_txd_set(NRF_UART_Type * p_reg, uint8_t txd); /** * @brief Function for starting an UART task. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param task Task. */ __STATIC_INLINE void nrf_uart_task_trigger(NRF_UART_Type * p_reg, nrf_uart_task_t task); @@ -344,7 +351,7 @@ __STATIC_INLINE void nrf_uart_task_trigger(NRF_UART_Type * p_reg, nrf_uart_task_ /** * @brief Function for returning the address of a specific task register. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param task Task. * * @return Task address. @@ -354,7 +361,7 @@ __STATIC_INLINE uint32_t nrf_uart_task_address_get(NRF_UART_Type * p_reg, nrf_ua /** * @brief Function for configuring UART. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param hwfc Hardware flow control. Enabled if true. * @param parity Parity. Included if true. */ @@ -365,7 +372,7 @@ __STATIC_INLINE void nrf_uart_configure(NRF_UART_Type * p_reg, /** * @brief Function for setting UART baudrate. * - * @param p_reg Instance. + * @param p_reg Pointer to the peripheral registers structure. * @param baudrate Baudrate. */ __STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type * p_reg, nrf_uart_baudrate_t baudrate); @@ -374,6 +381,10 @@ __STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type * p_reg, nrf_uart_bau __STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_t event) { *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)); + (void)dummy; +#endif } @@ -422,8 +433,16 @@ __STATIC_INLINE void nrf_uart_disable(NRF_UART_Type * p_reg) __STATIC_INLINE void nrf_uart_txrx_pins_set(NRF_UART_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd) { - p_reg->PSELTXD = pseltxd; +#if defined(UART_PSEL_RXD_CONNECT_Pos) + p_reg->PSEL.RXD = pselrxd; +#else p_reg->PSELRXD = pselrxd; +#endif +#if defined(UART_PSEL_TXD_CONNECT_Pos) + p_reg->PSEL.TXD = pseltxd; +#else + p_reg->PSELTXD = pseltxd; +#endif } __STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg) @@ -433,28 +452,53 @@ __STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg) __STATIC_INLINE uint32_t nrf_uart_tx_pin_get(NRF_UART_Type * p_reg) { +#if defined(UART_PSEL_TXD_CONNECT_Pos) + return p_reg->PSEL.TXD; +#else return p_reg->PSELTXD; +#endif } __STATIC_INLINE uint32_t nrf_uart_rx_pin_get(NRF_UART_Type * p_reg) { +#if defined(UART_PSEL_RXD_CONNECT_Pos) + return p_reg->PSEL.RXD; +#else return p_reg->PSELRXD; +#endif } __STATIC_INLINE uint32_t nrf_uart_rts_pin_get(NRF_UART_Type * p_reg) { +#if defined(UART_PSEL_RTS_CONNECT_Pos) + return p_reg->PSEL.RTS; +#else return p_reg->PSELRTS; +#endif } __STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg) { +#if defined(UART_PSEL_RTS_CONNECT_Pos) + return p_reg->PSEL.CTS; +#else return p_reg->PSELCTS; +#endif } __STATIC_INLINE void nrf_uart_hwfc_pins_set(NRF_UART_Type * p_reg, uint32_t pselrts, uint32_t pselcts) { +#if defined(UART_PSEL_RTS_CONNECT_Pos) + p_reg->PSEL.RTS = pselrts; +#else p_reg->PSELRTS = pselrts; +#endif + +#if defined(UART_PSEL_RTS_CONNECT_Pos) + p_reg->PSEL.CTS = pselcts; +#else p_reg->PSELCTS = pselcts; +#endif } __STATIC_INLINE void nrf_uart_hwfc_pins_disconnect(NRF_UART_Type * p_reg) @@ -495,4 +539,9 @@ __STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type * p_reg, nrf_uart_bau } #endif //SUPPRESS_INLINE_IMPLEMENTATION /** @} */ + +#ifdef __cplusplus +} +#endif + #endif //NRF_UART_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uarte.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uarte.h new file mode 100644 index 0000000000..9df3a71365 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_uarte.h @@ -0,0 +1,573 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef NRF_UARTE_H__ +#define NRF_UARTE_H__ + +#include "nrf.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define NRF_UARTE_PSEL_DISCONNECTED 0xFFFFFFFF + +/** + * @defgroup nrf_uarte_hal UARTE HAL + * @{ + * @ingroup nrf_uart + * + * @brief Hardware access layer for accessing the UARTE peripheral. + */ + +/** + * @enum nrf_uarte_task_t + * @brief UARTE tasks. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_UARTE_TASK_STARTRX = offsetof(NRF_UARTE_Type, TASKS_STARTRX),///< Start UART receiver. + NRF_UARTE_TASK_STOPRX = offsetof(NRF_UARTE_Type, TASKS_STOPRX), ///< Stop UART receiver. + NRF_UARTE_TASK_STARTTX = offsetof(NRF_UARTE_Type, TASKS_STARTTX),///< Start UART transmitter. + NRF_UARTE_TASK_STOPTX = offsetof(NRF_UARTE_Type, TASKS_STOPTX), ///< Stop UART transmitter. + NRF_UARTE_TASK_FLUSHRX = offsetof(NRF_UARTE_Type, TASKS_FLUSHRX) ///< Flush RX FIFO in RX buffer. + /*lint -restore*/ +} nrf_uarte_task_t; + +/** + * @enum nrf_uarte_event_t + * @brief UARTE events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_UARTE_EVENT_CTS = offsetof(NRF_UARTE_Type, EVENTS_CTS), ///< CTS is activated. + NRF_UARTE_EVENT_NCTS = offsetof(NRF_UARTE_Type, EVENTS_NCTS), ///< CTS is deactivated. + NRF_UARTE_EVENT_ENDRX = offsetof(NRF_UARTE_Type, EVENTS_ENDRX), ///< Receive buffer is filled up. + NRF_UARTE_EVENT_ENDTX = offsetof(NRF_UARTE_Type, EVENTS_ENDTX), ///< Last TX byte transmitted. + NRF_UARTE_EVENT_ERROR = offsetof(NRF_UARTE_Type, EVENTS_ERROR), ///< Error detected. + NRF_UARTE_EVENT_RXTO = offsetof(NRF_UARTE_Type, EVENTS_RXTO), ///< Receiver timeout. + NRF_UARTE_EVENT_RXSTARTED = offsetof(NRF_UARTE_Type, EVENTS_RXSTARTED),///< Receiver has started. + NRF_UARTE_EVENT_TXSTARTED = offsetof(NRF_UARTE_Type, EVENTS_TXSTARTED),///< Transmitter has started. + NRF_UARTE_EVENT_TXSTOPPED = offsetof(NRF_UARTE_Type, EVENTS_TXSTOPPED) ///< Transmitted stopped. + /*lint -restore*/ +} nrf_uarte_event_t; + +/** + * @brief Types of UARTE shortcuts. + */ +typedef enum +{ + NRF_UARTE_SHORT_ENDRX_STARTRX = UARTE_SHORTS_ENDRX_STARTRX_Msk,///< Shortcut between ENDRX event and STARTRX task. + NRF_UARTE_SHORT_ENDRX_STOPRX = UARTE_SHORTS_ENDRX_STOPRX_Msk, ///< Shortcut between ENDRX event and STOPRX task. +} nrf_uarte_short_t; + + +/** + * @enum nrf_uarte_int_mask_t + * @brief UARTE interrupts. + */ +typedef enum +{ + NRF_UARTE_INT_CTS_MASK = UARTE_INTENSET_CTS_Msk, ///< Interrupt on CTS event. + NRF_UARTE_INT_NCTSRX_MASK = UARTE_INTENSET_NCTS_Msk, ///< Interrupt on NCTS event. + NRF_UARTE_INT_ENDRX_MASK = UARTE_INTENSET_ENDRX_Msk, ///< Interrupt on ENDRX event. + NRF_UARTE_INT_ENDTX_MASK = UARTE_INTENSET_ENDTX_Msk, ///< Interrupt on ENDTX event. + NRF_UARTE_INT_ERROR_MASK = UARTE_INTENSET_ERROR_Msk, ///< Interrupt on ERROR event. + NRF_UARTE_INT_RXTO_MASK = UARTE_INTENSET_RXTO_Msk, ///< Interrupt on RXTO event. + NRF_UARTE_INT_RXSTARTED_MASK = UARTE_INTENSET_RXSTARTED_Msk,///< Interrupt on RXSTARTED event. + NRF_UARTE_INT_TXSTARTED_MASK = UARTE_INTENSET_TXSTARTED_Msk,///< Interrupt on TXSTARTED event. + NRF_UARTE_INT_TXSTOPPED_MASK = UARTE_INTENSET_TXSTOPPED_Msk ///< Interrupt on TXSTOPPED event. +} nrf_uarte_int_mask_t; + +/** + * @enum nrf_uarte_baudrate_t + * @brief Baudrates supported by UARTE. + */ +typedef enum +{ + NRF_UARTE_BAUDRATE_1200 = UARTE_BAUDRATE_BAUDRATE_Baud1200, ///< 1200 baud. + NRF_UARTE_BAUDRATE_2400 = UARTE_BAUDRATE_BAUDRATE_Baud2400, ///< 2400 baud. + NRF_UARTE_BAUDRATE_4800 = UARTE_BAUDRATE_BAUDRATE_Baud4800, ///< 4800 baud. + NRF_UARTE_BAUDRATE_9600 = UARTE_BAUDRATE_BAUDRATE_Baud9600, ///< 9600 baud. + NRF_UARTE_BAUDRATE_14400 = UARTE_BAUDRATE_BAUDRATE_Baud14400, ///< 14400 baud. + NRF_UARTE_BAUDRATE_19200 = UARTE_BAUDRATE_BAUDRATE_Baud19200, ///< 19200 baud. + NRF_UARTE_BAUDRATE_28800 = UARTE_BAUDRATE_BAUDRATE_Baud28800, ///< 28800 baud. + NRF_UARTE_BAUDRATE_38400 = UARTE_BAUDRATE_BAUDRATE_Baud38400, ///< 38400 baud. + NRF_UARTE_BAUDRATE_57600 = UARTE_BAUDRATE_BAUDRATE_Baud57600, ///< 57600 baud. + NRF_UARTE_BAUDRATE_76800 = UARTE_BAUDRATE_BAUDRATE_Baud76800, ///< 76800 baud. + NRF_UARTE_BAUDRATE_115200 = UARTE_BAUDRATE_BAUDRATE_Baud115200, ///< 115200 baud. + NRF_UARTE_BAUDRATE_230400 = UARTE_BAUDRATE_BAUDRATE_Baud230400, ///< 230400 baud. + NRF_UARTE_BAUDRATE_250000 = UARTE_BAUDRATE_BAUDRATE_Baud250000, ///< 250000 baud. + NRF_UARTE_BAUDRATE_460800 = UARTE_BAUDRATE_BAUDRATE_Baud460800, ///< 460800 baud. + NRF_UARTE_BAUDRATE_921600 = UARTE_BAUDRATE_BAUDRATE_Baud921600, ///< 921600 baud. + NRF_UARTE_BAUDRATE_1000000 = UARTE_BAUDRATE_BAUDRATE_Baud1M, ///< 1000000 baud. +} nrf_uarte_baudrate_t; + +/** + * @enum nrf_uarte_error_mask_t + * @brief Types of UARTE error masks. + */ +typedef enum +{ + NRF_UARTE_ERROR_OVERRUN_MASK = UARTE_ERRORSRC_OVERRUN_Msk, ///< Overrun error. + NRF_UARTE_ERROR_PARITY_MASK = UARTE_ERRORSRC_PARITY_Msk, ///< Parity error. + NRF_UARTE_ERROR_FRAMING_MASK = UARTE_ERRORSRC_FRAMING_Msk, ///< Framing error. + NRF_UARTE_ERROR_BREAK_MASK = UARTE_ERRORSRC_BREAK_Msk, ///< Break error. +} nrf_uarte_error_mask_t; + +/** + * @enum nrf_uarte_parity_t + * @brief Types of UARTE parity modes. + */ +typedef enum +{ + NRF_UARTE_PARITY_EXCLUDED = UARTE_CONFIG_PARITY_Excluded << UARTE_CONFIG_PARITY_Pos, ///< Parity excluded. + NRF_UARTE_PARITY_INCLUDED = UARTE_CONFIG_PARITY_Included << UARTE_CONFIG_PARITY_Pos, ///< Parity included. +} nrf_uarte_parity_t; + +/** + * @enum nrf_uarte_hwfc_t + * @brief Types of UARTE flow control modes. + */ +typedef enum +{ + NRF_UARTE_HWFC_DISABLED = UARTE_CONFIG_HWFC_Disabled << UARTE_CONFIG_HWFC_Pos, ///< HW flow control disabled. + NRF_UARTE_HWFC_ENABLED = UARTE_CONFIG_HWFC_Enabled << UARTE_CONFIG_HWFC_Pos, ///< HW flow control enabled. +} nrf_uarte_hwfc_t; + + +/** + * @brief Function for clearing a specific UARTE event. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] event Event to clear. + */ +__STATIC_INLINE void nrf_uarte_event_clear(NRF_UARTE_Type * p_reg, nrf_uarte_event_t event); + +/** + * @brief Function for checking the state of a specific UARTE event. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] event Event to check. + * + * @retval True if event is set, False otherwise. + */ +__STATIC_INLINE bool nrf_uarte_event_check(NRF_UARTE_Type * p_reg, nrf_uarte_event_t event); + +/** + * @brief Function for returning the address of a specific UARTE event register. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] event Desired event. + * + * @retval Address of specified event register. + */ +__STATIC_INLINE uint32_t nrf_uarte_event_address_get(NRF_UARTE_Type * p_reg, + nrf_uarte_event_t event); + +/** + * @brief Function for enabling UARTE shortcuts. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param shorts_mask Shortcuts to enable. + */ +__STATIC_INLINE void nrf_uarte_shorts_enable(NRF_UARTE_Type * p_reg, uint32_t shorts_mask); + +/** + * @brief Function for disabling UARTE shortcuts. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param shorts_mask Shortcuts to disable. + */ +__STATIC_INLINE void nrf_uarte_shorts_disable(NRF_UARTE_Type * p_reg, uint32_t shorts_mask); + +/** + * @brief Function for enabling UARTE interrupts. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param int_mask Interrupts to enable. + */ +__STATIC_INLINE void nrf_uarte_int_enable(NRF_UARTE_Type * p_reg, uint32_t int_mask); + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param int_mask Mask of interrupt to check. + * + * @retval true If the interrupt is enabled. + * @retval false If the interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_uarte_int_enable_check(NRF_UARTE_Type * p_reg, nrf_uarte_int_mask_t int_mask); + +/** + * @brief Function for disabling specific interrupts. + * + * @param p_reg Instance. + * @param int_mask Interrupts to disable. + */ +__STATIC_INLINE void nrf_uarte_int_disable(NRF_UARTE_Type * p_reg, uint32_t int_mask); + +/** + * @brief Function for getting error source mask. Function is clearing error source flags after reading. + * + * @param p_reg Pointer to the peripheral registers structure. + * @return Mask with error source flags. + */ +__STATIC_INLINE uint32_t nrf_uarte_errorsrc_get_and_clear(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for enabling UARTE. + * + * @param p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_uarte_enable(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for disabling UARTE. + * + * @param p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_uarte_disable(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for configuring TX/RX pins. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param pseltxd TXD pin number. + * @param pselrxd RXD pin number. + */ +__STATIC_INLINE void nrf_uarte_txrx_pins_set(NRF_UARTE_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd); + +/** + * @brief Function for disconnecting TX/RX pins. + * + * @param p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_uarte_txrx_pins_disconnect(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for getting TX pin. + * + * @param p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE uint32_t nrf_uarte_tx_pin_get(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for getting RX pin. + * + * @param p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE uint32_t nrf_uarte_rx_pin_get(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for getting RTS pin. + * + * @param p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE uint32_t nrf_uarte_rts_pin_get(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for getting CTS pin. + * + * @param p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE uint32_t nrf_uarte_cts_pin_get(NRF_UARTE_Type * p_reg); + + +/** + * @brief Function for configuring flow control pins. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param pselrts RTS pin number. + * @param pselcts CTS pin number. + */ +__STATIC_INLINE void nrf_uarte_hwfc_pins_set(NRF_UARTE_Type * p_reg, + uint32_t pselrts, + uint32_t pselcts); + +/** + * @brief Function for disconnecting flow control pins. + * + * @param p_reg Pointer to the peripheral registers structure. + */ +__STATIC_INLINE void nrf_uarte_hwfc_pins_disconnect(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for starting an UARTE task. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param task Task. + */ +__STATIC_INLINE void nrf_uarte_task_trigger(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task); + +/** + * @brief Function for returning the address of a specific task register. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_uarte_task_address_get(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task); + +/** + * @brief Function for configuring UARTE. + * + * @param p_reg Pointer to the peripheral registers structure. + * @param hwfc Hardware flow control. Enabled if true. + * @param parity Parity. Included if true. + */ +__STATIC_INLINE void nrf_uarte_configure(NRF_UARTE_Type * p_reg, + nrf_uarte_parity_t parity, + nrf_uarte_hwfc_t hwfc); + + +/** + * @brief Function for setting UARTE baudrate. + * + * @param p_reg Instance. + * @param baudrate Baudrate. + */ +__STATIC_INLINE void nrf_uarte_baudrate_set(NRF_UARTE_Type * p_reg, nrf_uarte_baudrate_t baudrate); + +/** + * @brief Function for setting the transmit buffer. + * + * @param[in] p_reg Instance. + * @param[in] p_buffer Pointer to the buffer with data to send. + * @param[in] length Maximum number of data bytes to transmit. + */ +__STATIC_INLINE void nrf_uarte_tx_buffer_set(NRF_UARTE_Type * p_reg, + uint8_t const * p_buffer, + uint8_t length); + +/** + * @brief Function for getting number of bytes transmitted in the last transaction. + * + * @param[in] p_reg Instance. + * + * @retval Amount of bytes transmitted. + */ +__STATIC_INLINE uint32_t nrf_uarte_tx_amount_get(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for setting the receive buffer. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * @param[in] p_buffer Pointer to the buffer for received data. + * @param[in] length Maximum number of data bytes to receive. + */ +__STATIC_INLINE void nrf_uarte_rx_buffer_set(NRF_UARTE_Type * p_reg, + uint8_t * p_buffer, + uint8_t length); + +/** + * @brief Function for getting number of bytes received in the last transaction. + * + * @param[in] p_reg Pointer to the peripheral registers structure. + * + * @retval Amount of bytes received. + */ +__STATIC_INLINE uint32_t nrf_uarte_rx_amount_get(NRF_UARTE_Type * p_reg); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE void nrf_uarte_event_clear(NRF_UARTE_Type * p_reg, nrf_uarte_event_t event) +{ + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)); + (void)dummy; +#endif + +} + +__STATIC_INLINE bool nrf_uarte_event_check(NRF_UARTE_Type * p_reg, nrf_uarte_event_t event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event); +} + +__STATIC_INLINE uint32_t nrf_uarte_event_address_get(NRF_UARTE_Type * p_reg, + nrf_uarte_event_t event) +{ + return (uint32_t)((uint8_t *)p_reg + (uint32_t)event); +} + +__STATIC_INLINE void nrf_uarte_shorts_enable(NRF_UARTE_Type * p_reg, uint32_t shorts_mask) +{ + p_reg->SHORTS |= shorts_mask; +} + +__STATIC_INLINE void nrf_uarte_shorts_disable(NRF_UARTE_Type * p_reg, uint32_t shorts_mask) +{ + p_reg->SHORTS &= ~(shorts_mask); +} + +__STATIC_INLINE void nrf_uarte_int_enable(NRF_UARTE_Type * p_reg, uint32_t int_mask) +{ + p_reg->INTENSET = int_mask; +} + +__STATIC_INLINE bool nrf_uarte_int_enable_check(NRF_UARTE_Type * p_reg, nrf_uarte_int_mask_t int_mask) +{ + return (bool)(p_reg->INTENSET & int_mask); +} + +__STATIC_INLINE void nrf_uarte_int_disable(NRF_UARTE_Type * p_reg, uint32_t int_mask) +{ + p_reg->INTENCLR = int_mask; +} + +__STATIC_INLINE uint32_t nrf_uarte_errorsrc_get_and_clear(NRF_UARTE_Type * p_reg) +{ + uint32_t errsrc_mask = p_reg->ERRORSRC; + p_reg->ERRORSRC = errsrc_mask; + return errsrc_mask; +} + +__STATIC_INLINE void nrf_uarte_enable(NRF_UARTE_Type * p_reg) +{ + p_reg->ENABLE = UARTE_ENABLE_ENABLE_Enabled; +} + +__STATIC_INLINE void nrf_uarte_disable(NRF_UARTE_Type * p_reg) +{ + p_reg->ENABLE = UARTE_ENABLE_ENABLE_Disabled; +} + +__STATIC_INLINE void nrf_uarte_txrx_pins_set(NRF_UARTE_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd) +{ + p_reg->PSEL.TXD = pseltxd; + p_reg->PSEL.RXD = pselrxd; +} + +__STATIC_INLINE void nrf_uarte_txrx_pins_disconnect(NRF_UARTE_Type * p_reg) +{ + nrf_uarte_txrx_pins_set(p_reg, NRF_UARTE_PSEL_DISCONNECTED, NRF_UARTE_PSEL_DISCONNECTED); +} + +__STATIC_INLINE uint32_t nrf_uarte_tx_pin_get(NRF_UARTE_Type * p_reg) +{ + return p_reg->PSEL.TXD; +} + +__STATIC_INLINE uint32_t nrf_uarte_rx_pin_get(NRF_UARTE_Type * p_reg) +{ + return p_reg->PSEL.RXD; +} + +__STATIC_INLINE uint32_t nrf_uarte_rts_pin_get(NRF_UARTE_Type * p_reg) +{ + return p_reg->PSEL.RTS; +} + +__STATIC_INLINE uint32_t nrf_uarte_cts_pin_get(NRF_UARTE_Type * p_reg) +{ + return p_reg->PSEL.CTS; +} + +__STATIC_INLINE void nrf_uarte_hwfc_pins_set(NRF_UARTE_Type * p_reg, uint32_t pselrts, uint32_t pselcts) +{ + p_reg->PSEL.RTS = pselrts; + p_reg->PSEL.CTS = pselcts; +} + +__STATIC_INLINE void nrf_uarte_hwfc_pins_disconnect(NRF_UARTE_Type * p_reg) +{ + nrf_uarte_hwfc_pins_set(p_reg, NRF_UARTE_PSEL_DISCONNECTED, NRF_UARTE_PSEL_DISCONNECTED); +} + +__STATIC_INLINE void nrf_uarte_task_trigger(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task) +{ + *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL; +} + +__STATIC_INLINE uint32_t nrf_uarte_task_address_get(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task) +{ + return (uint32_t)p_reg + (uint32_t)task; +} + +__STATIC_INLINE void nrf_uarte_configure(NRF_UARTE_Type * p_reg, + nrf_uarte_parity_t parity, + nrf_uarte_hwfc_t hwfc) +{ + p_reg->CONFIG = (uint32_t)parity | (uint32_t)hwfc; +} + +__STATIC_INLINE void nrf_uarte_baudrate_set(NRF_UARTE_Type * p_reg, nrf_uarte_baudrate_t baudrate) +{ + p_reg->BAUDRATE = baudrate; +} + +__STATIC_INLINE void nrf_uarte_tx_buffer_set(NRF_UARTE_Type * p_reg, + uint8_t const * p_buffer, + uint8_t length) +{ + p_reg->TXD.PTR = (uint32_t)p_buffer; + p_reg->TXD.MAXCNT = length; +} + +__STATIC_INLINE uint32_t nrf_uarte_tx_amount_get(NRF_UARTE_Type * p_reg) +{ + return p_reg->TXD.AMOUNT; +} + +__STATIC_INLINE void nrf_uarte_rx_buffer_set(NRF_UARTE_Type * p_reg, + uint8_t * p_buffer, + uint8_t length) +{ + p_reg->RXD.PTR = (uint32_t)p_buffer; + p_reg->RXD.MAXCNT = length; +} + +__STATIC_INLINE uint32_t nrf_uarte_rx_amount_get(NRF_UARTE_Type * p_reg) +{ + return p_reg->RXD.AMOUNT; +} +#endif //SUPPRESS_INLINE_IMPLEMENTATION +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif //NRF_UARTE_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_wdt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_wdt.h index 4b6f9a5609..72c8ce48e9 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_wdt.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_wdt.h @@ -36,7 +36,6 @@ * */ - /** * @defgroup nrf_wdt_hal WDT HAL * @{ @@ -54,6 +53,10 @@ #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + #define NRF_WDT_CHANNEL_NUMBER 0x8UL #define NRF_WDT_RR_VALUE 0x6E524635UL /* Fixed value, shouldn't be modified.*/ @@ -149,6 +152,10 @@ __STATIC_INLINE void nrf_wdt_task_trigger(nrf_wdt_task_t task) __STATIC_INLINE void nrf_wdt_event_clear(nrf_wdt_event_t event) { *((volatile uint32_t *)((uint8_t *)NRF_WDT + (uint32_t)event)) = NRF_WDT_EVENT_CLEAR; +#if __CORTEX_M == 0x04 + volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_WDT + (uint32_t)event)); + (void)dummy; +#endif } @@ -321,6 +328,11 @@ __STATIC_INLINE void nrf_wdt_reload_request_set(nrf_wdt_rr_register_t rr_registe } + +#ifdef __cplusplus +} +#endif + #endif /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/i2s/nrf_drv_i2s.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/i2s/nrf_drv_i2s.c new file mode 100644 index 0000000000..0243d531ee --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/i2s/nrf_drv_i2s.c @@ -0,0 +1,436 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(I2S) +#include "nrf_drv_i2s.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" +#include "nrf_assert.h" +#include "app_util_platform.h" + +#define NRF_LOG_MODULE_NAME "I2S" + +#if I2S_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL I2S_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR I2S_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR I2S_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_I2S_EVENT_RXPTRUPD ? "NRF_I2S_EVENT_RXPTRUPD" : \ + (event == NRF_I2S_EVENT_TXPTRUPD ? "NRF_I2S_EVENT_TXPTRUPD" : \ + (event == NRF_I2S_EVENT_STOPPED ? "NRF_I2S_EVENT_STOPPED" : "UNKNOWN EVENT"))) +#else //I2S_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //I2S_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + +#define MODULE_INITIALIZED (m_cb.state == NRF_DRV_STATE_INITIALIZED) /**< Macro designating whether the module has been initialized properly. */ + +// Control block - driver instance local data. +typedef struct +{ + nrf_drv_i2s_data_handler_t handler; + nrf_drv_state_t state; + + bool synchronized_mode : 1; + bool rx_ready : 1; + bool tx_ready : 1; + bool just_started : 1; + uint16_t buffer_half_size; + uint32_t * p_rx_buffer; + uint32_t * p_tx_buffer; +} i2s_control_block_t; +static i2s_control_block_t m_cb; + + +static nrf_drv_i2s_config_t const m_default_config = NRF_DRV_I2S_DEFAULT_CONFIG; + + +static void configure_pins(nrf_drv_i2s_config_t const * p_config) +{ + uint32_t mck_pin, sdout_pin, sdin_pin; + + // Configure pins used by the peripheral: + + // - SCK and LRCK (required) - depending on the mode of operation these + // pins are configured as outputs (in Master mode) or inputs (in Slave + // mode). + if (p_config->mode == NRF_I2S_MODE_MASTER) + { + nrf_gpio_cfg_output(p_config->sck_pin); + nrf_gpio_cfg_output(p_config->lrck_pin); + } + else + { + nrf_gpio_cfg_input(p_config->sck_pin, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_input(p_config->lrck_pin, NRF_GPIO_PIN_NOPULL); + } + + // - MCK (optional) - always output, + if (p_config->mck_pin != NRF_DRV_I2S_PIN_NOT_USED) + { + mck_pin = p_config->mck_pin; + nrf_gpio_cfg_output(mck_pin); + } + else + { + mck_pin = NRF_I2S_PIN_NOT_CONNECTED; + } + + // - SDOUT (optional) - always output, + if (p_config->sdout_pin != NRF_DRV_I2S_PIN_NOT_USED) + { + sdout_pin = p_config->sdout_pin; + nrf_gpio_cfg_output(sdout_pin); + } + else + { + sdout_pin = NRF_I2S_PIN_NOT_CONNECTED; + } + + // - SDIN (optional) - always input. + if (p_config->sdin_pin != NRF_DRV_I2S_PIN_NOT_USED) + { + sdin_pin = p_config->sdin_pin; + nrf_gpio_cfg_input(sdin_pin, NRF_GPIO_PIN_NOPULL); + } + else + { + sdin_pin = NRF_I2S_PIN_NOT_CONNECTED; + } + + nrf_i2s_pins_set(NRF_I2S, p_config->sck_pin, p_config->lrck_pin, + mck_pin, sdout_pin, sdin_pin); +} + + +ret_code_t nrf_drv_i2s_init(nrf_drv_i2s_config_t const * p_config, + nrf_drv_i2s_data_handler_t handler) +{ + ASSERT(handler); + + ret_code_t err_code; + + if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + if (!nrf_i2s_configure(NRF_I2S, p_config->mode, + p_config->format, + p_config->alignment, + p_config->sample_width, + p_config->channels, + p_config->mck_setup, + p_config->ratio)) + { + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + configure_pins(p_config); + + m_cb.handler = handler; + + nrf_drv_common_irq_enable(I2S_IRQn, p_config->irq_priority); + + m_cb.state = NRF_DRV_STATE_INITIALIZED; + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_i2s_uninit(void) +{ + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_drv_i2s_stop(); + + nrf_drv_common_irq_disable(I2S_IRQn); + + m_cb.state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Initialized.\r\n"); +} + + +ret_code_t nrf_drv_i2s_start(uint32_t * p_rx_buffer, + uint32_t * p_tx_buffer, + uint16_t buffer_size, + uint8_t flags) +{ + ASSERT((p_rx_buffer != NULL) || (p_tx_buffer != NULL)); + + uint16_t buffer_half_size = buffer_size / 2; + ASSERT(buffer_half_size != 0); + + VERIFY_MODULE_INITIALIZED(); + + ret_code_t err_code; + + if ((p_rx_buffer != NULL) && !nrf_drv_is_in_RAM(p_rx_buffer)) + { + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if ((p_tx_buffer != NULL) && !nrf_drv_is_in_RAM(p_tx_buffer)) + { + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + // Initially we set up the peripheral to use the first half of each buffer, + // then in 'I2S_IRQHandler' we will switch to the second half. + nrf_i2s_transfer_set(NRF_I2S, buffer_half_size, p_rx_buffer, p_tx_buffer); + + m_cb.p_rx_buffer = p_rx_buffer; + m_cb.p_tx_buffer = p_tx_buffer; + m_cb.buffer_half_size = buffer_half_size; + m_cb.just_started = true; + + if ((flags & NRF_DRV_I2S_FLAG_SYNCHRONIZED_MODE) && + // [synchronized mode makes sense only when both RX and TX are enabled] + (m_cb.p_rx_buffer != NULL) && (m_cb.p_tx_buffer != NULL)) + { + m_cb.synchronized_mode = true; + m_cb.rx_ready = false; + m_cb.tx_ready = false; + } + else + { + m_cb.synchronized_mode = false; + } + + nrf_i2s_enable(NRF_I2S); + + m_cb.state = NRF_DRV_STATE_POWERED_ON; + + if (m_cb.p_tx_buffer != NULL) + { + // Get from the application the first portion of data to be sent - we + // need to have it in the transmit buffer before we start the transfer. + // Unless the synchronized mode is active. In this mode we must wait + // with this until the first portion of data is received, so here we + // just make sure that there will be silence on the SDOUT line prior + // to that moment. + if (m_cb.synchronized_mode) + { + memset(m_cb.p_tx_buffer, 0, buffer_size); + } + else + { + m_cb.handler(NULL, m_cb.p_tx_buffer, m_cb.buffer_half_size); + } + } + + nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD); + nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD); + nrf_i2s_int_enable(NRF_I2S, + NRF_I2S_INT_RXPTRUPD_MASK | NRF_I2S_INT_TXPTRUPD_MASK); + nrf_i2s_task_trigger(NRF_I2S, NRF_I2S_TASK_START); + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_i2s_stop(void) +{ + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + + // First disable interrupts, then trigger the STOP task, so no spurious + // RXPTRUPD and TXPTRUPD events (see FTPAN-55) will be processed. + nrf_i2s_int_disable(NRF_I2S, + NRF_I2S_INT_RXPTRUPD_MASK | NRF_I2S_INT_TXPTRUPD_MASK); + + nrf_i2s_task_trigger(NRF_I2S, NRF_I2S_TASK_STOP); + + nrf_i2s_disable(NRF_I2S); + + m_cb.state = NRF_DRV_STATE_INITIALIZED; + + NRF_LOG_INFO("Disabled."); +} + + +void I2S_IRQHandler(void) +{ + uint32_t * p_data_received = NULL; + uint32_t * p_data_to_send = NULL; + + if (nrf_i2s_event_check(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD)) + { + nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_I2S_EVENT_TXPTRUPD)); + + // If transmission is not enabled, but for some reason the TXPTRUPD + // event has been generated, just ignore it. + if (m_cb.p_tx_buffer != NULL) + { + uint32_t * p_tx_buffer_next; + if (nrf_i2s_tx_buffer_get(NRF_I2S) == m_cb.p_tx_buffer) + { + p_tx_buffer_next = m_cb.p_tx_buffer + m_cb.buffer_half_size; + } + else + { + p_tx_buffer_next = m_cb.p_tx_buffer; + } + nrf_i2s_tx_buffer_set(NRF_I2S, p_tx_buffer_next); + + m_cb.tx_ready = true; + + // Now the part of the buffer that we've configured as "next" should + // be filled by the application with proper data to be sent; + // the peripheral is sending data from the other part of the buffer + // (but it will finish soon...). + p_data_to_send = p_tx_buffer_next; + + } + } + + if (nrf_i2s_event_check(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD)) + { + nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_I2S_EVENT_RXPTRUPD)); + + // If reception is not enabled, but for some reason the RXPTRUPD event + // has been generated, just ignore it. + if (m_cb.p_rx_buffer != NULL) + { + uint32_t * p_rx_buffer_next; + if (nrf_i2s_rx_buffer_get(NRF_I2S) == m_cb.p_rx_buffer) + { + p_rx_buffer_next = m_cb.p_rx_buffer + m_cb.buffer_half_size; + } + else + { + p_rx_buffer_next = m_cb.p_rx_buffer; + } + nrf_i2s_rx_buffer_set(NRF_I2S, p_rx_buffer_next); + + m_cb.rx_ready = true; + + // The RXPTRUPD event is generated for the first time right after + // the transfer is started. Since there is no data received yet at + // this point we only update the buffer pointer (it is done above), + // there is no callback to the application. + // [for synchronized mode this has to be handled differently - + // see below] + if (m_cb.just_started && !m_cb.synchronized_mode) + { + m_cb.just_started = false; + } + else + { + // The RXPTRUPD event indicates that from now on the peripheral + // will be filling the part of the buffer that was pointed at + // the time the event has been generated, hence now we can let + // the application process the data stored in the other part of + // the buffer - the one that we've just set to be filled next. + p_data_received = p_rx_buffer_next; + } + } + } + + // Call the data handler passing received data to the application and/or + // requesting data to be sent. + if (!m_cb.synchronized_mode) + { + if ((p_data_received != NULL) || (p_data_to_send != NULL)) + { + if (p_data_received != NULL) + { + NRF_LOG_DEBUG("Rx data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_data_received, + m_cb.buffer_half_size * sizeof(p_data_received)); + } + m_cb.handler(p_data_received, p_data_to_send, + m_cb.buffer_half_size); + if (p_data_to_send != NULL) + { + NRF_LOG_DEBUG("Tx data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_data_to_send, + m_cb.buffer_half_size * sizeof(p_data_to_send)); + } + } + } + // In the synchronized mode wait until the events for both RX and TX occur. + // And ignore the initial occurrences of these events, since they only + // indicate that the transfer has started - no data is received yet at + // that moment, so we have got nothing to pass to the application. + else + { + if (m_cb.rx_ready && m_cb.tx_ready) + { + m_cb.rx_ready = false; + m_cb.tx_ready = false; + + if (m_cb.just_started) + { + m_cb.just_started = false; + } + else + { + NRF_LOG_DEBUG("Rx data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)nrf_i2s_rx_buffer_get(NRF_I2S), + m_cb.buffer_half_size * sizeof(p_data_to_send)); + m_cb.handler(nrf_i2s_rx_buffer_get(NRF_I2S), + nrf_i2s_tx_buffer_get(NRF_I2S), + m_cb.buffer_half_size); + NRF_LOG_DEBUG("Tx data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)nrf_i2s_tx_buffer_get(NRF_I2S), + m_cb.buffer_half_size * sizeof(p_data_to_send)); + } + } + } +} +#endif //NRF_MODULE_ENABLED(I2S) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/i2s/nrf_drv_i2s.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/i2s/nrf_drv_i2s.h new file mode 100644 index 0000000000..58987d042a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/i2s/nrf_drv_i2s.h @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * @addtogroup nrf_i2s I2S HAL and driver + * @ingroup nrf_drivers + * @brief @tagAPI52 Inter-IC Sound (I2S) interface APIs. + * + * @defgroup nrf_drv_i2s I2S driver + * @{ + * @ingroup nrf_i2s + * @brief @tagAPI52 Inter-IC Sound (I2S) interface driver. + */ + + +#ifndef NRF_DRV_I2S_H__ +#define NRF_DRV_I2S_H__ + +#include "nordic_common.h" +#include "sdk_config.h" +#include "nrf_i2s.h" +#include "sdk_errors.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief This value can be provided instead of a pin number for the signals + * SDOUT, SDIN, and MCK to specify that a given signal is not used + * and therefore does not need to be connected to a pin. + */ +#define NRF_DRV_I2S_PIN_NOT_USED 0xFF + +/** + * @brief Flag indicating that calls to the data handler for RX and TX should + * be synchronized, thus always combined into one call. + * + * Use this flag when calling @ref nrf_drv_i2s_start to force a common call + * to the @ref nrf_drv_i2s_data_handler_t "data handler" for RX and TX data. + * This is useful, for example, when received data should be processed and + * then be sent back. Obviously, this flag is only applicable when both + * directions (RX and TX) are enabled. + */ +#define NRF_DRV_I2S_FLAG_SYNCHRONIZED_MODE 0x01 + +/** + * @brief I2S driver configuration structure. + */ +typedef struct +{ + uint8_t sck_pin; ///< SCK pin number. + uint8_t lrck_pin; ///< LRCK pin number. + uint8_t mck_pin; ///< MCK pin number. + /**< Optional. Use @ref NRF_DRV_I2S_PIN_NOT_USED + * if this signal is not needed. */ + uint8_t sdout_pin; ///< SDOUT pin number. + /**< Optional. Use @ref NRF_DRV_I2S_PIN_NOT_USED + * if this signal is not needed. */ + uint8_t sdin_pin; ///< SDIN pin number. + /**< Optional. Use @ref NRF_DRV_I2S_PIN_NOT_USED + * if this signal is not needed. */ + uint8_t irq_priority; ///< Interrupt priority. + + nrf_i2s_mode_t mode; ///< Mode of operation. + nrf_i2s_format_t format; ///< Frame format. + nrf_i2s_align_t alignment; ///< Alignment of sample within a frame. + nrf_i2s_swidth_t sample_width; ///< Sample width. + nrf_i2s_channels_t channels; ///< Enabled channels. + nrf_i2s_mck_t mck_setup; ///< Master clock setup. + nrf_i2s_ratio_t ratio; ///< MCK/LRCK ratio. +} nrf_drv_i2s_config_t; + +/** + * @brief I2S driver default configuration. + */ +#define NRF_DRV_I2S_DEFAULT_CONFIG \ +{ \ + .sck_pin = I2S_CONFIG_SCK_PIN, \ + .lrck_pin = I2S_CONFIG_LRCK_PIN, \ + .mck_pin = I2S_CONFIG_MCK_PIN, \ + .sdout_pin = I2S_CONFIG_SDOUT_PIN, \ + .sdin_pin = I2S_CONFIG_SDIN_PIN, \ + .irq_priority = I2S_CONFIG_IRQ_PRIORITY, \ + .mode = (nrf_i2s_mode_t)I2S_CONFIG_MASTER, \ + .format = (nrf_i2s_format_t)I2S_CONFIG_FORMAT, \ + .alignment = (nrf_i2s_align_t)I2S_CONFIG_ALIGN, \ + .sample_width = (nrf_i2s_swidth_t)I2S_CONFIG_SWIDTH, \ + .channels = (nrf_i2s_channels_t)I2S_CONFIG_CHANNELS, \ + .mck_setup = (nrf_i2s_mck_t)I2S_CONFIG_MCK_SETUP, \ + .ratio = (nrf_i2s_ratio_t)I2S_CONFIG_RATIO, \ +} + +/** + * @brief I2S driver data handler type. + * + * A data handling function of this type must be specified during initialization + * of the driver. The driver will call this function when a new portion of data + * is received or a new portion of data should be prepared for transmission. + * The first case is indicated by a non-NULL value in the @p p_data_received + * parameter (which points to the memory containing the received data). + * Similarly, the second case is indicated by a non-NULL value in the + * @p p_data_to_send parameter (which points to where the data to be transmitted + * should be placed). + * + * @note The two cases mentioned above may be indicated separately or combined + * into one call (depending on the environment in which the driver is + * used). Therefore, both parameters should be checked and handled + * properly in every call. @ref NRF_DRV_I2S_FLAG_SYNCHRONIZED_MODE + * "Synchronized mode" can be used to always combine these indications. + * + * @param[in] p_data_received Pointer to the buffer with received data, + * or NULL if the handler is called to prepare + * transmission only. + * @param[out] p_data_to_send Pointer to the buffer where data to be sent + * should be written, or NULL if the handler is + * called for received data only. + * @param[in] number_of_words Length of data received and/or to be written + * (in 32-bit words). This value is always equal to + * half the size of the buffers set by the call + * to the @ref nrf_drv_i2s_start function. + */ +typedef void (* nrf_drv_i2s_data_handler_t)(uint32_t const * p_data_received, + uint32_t * p_data_to_send, + uint16_t number_of_words); + + +/** + * @brief Function for initializing the I2S driver. + * + * @param[in] p_config Pointer to the structure with initial configuration. + * If NULL, the default configuration is used. + * @param[in] handler Data handler provided by the user. Must not be NULL. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver was already initialized. + * @retval NRF_ERROR_INVALID_PARAM If the requested combination of configuration + * options is not allowed by the I2S peripheral. + */ +ret_code_t nrf_drv_i2s_init(nrf_drv_i2s_config_t const * p_config, + nrf_drv_i2s_data_handler_t handler); + +/** + * @brief Function for uninitializing the I2S driver. + */ +void nrf_drv_i2s_uninit(void); + +/** + * @brief Function for starting the continuous I2S transfer. + * + * The I2S data transfer can be performed in one of three modes: RX (reception) + * only, TX (transmission) only, or in both directions simultaneously. + * The mode is selected by specifying a proper buffer for a given direction + * in the call to this function or by passing NULL instead if this direction + * should be disabled. + * + * The length of the buffer (which is a common value for RX and TX if both + * directions are enabled) is specified in 32-bit words. One 32-bit memory + * word can either contain four 8-bit samples, two 16-bit samples, or one + * right-aligned 24-bit sample sign-extended to a 32-bit value. + * For a detailed memory mapping for different supported configurations, + * see the @linkProductSpecification52. + * + * The provided buffers are logically divided into two parts of equal size. + * One of them is in use by the peripheral (for storing received data or for + * getting data to be transmitted, respectively). The other part is provided + * to the application via a call to the defined @ref nrf_drv_i2s_data_handler_t + * "data handling function", so that the application can process the received + * data or prepare the next portion of data to be sent. The two parts are + * swapped every time @p buffer_size/2 data words are received or transmitted. + * + * Additional options are provided using the @p flags parameter: + * - @ref NRF_DRV_I2S_FLAG_SYNCHRONIZED_MODE - the calls to data handler should + * be done in a synchronized manner (one common call for TX and RX). + * Applicable only when both RX and TX are enabled. + * + * @attention All data exchange is done in the data handler only. In particular, + * no data should be written to the transmit buffer before calling + * this function (a proper call to the data handler to get the first + * portion of data to be sent will be done before the actual transfer + * starts). + * + * @note Peripherals using EasyDMA (like I2S) require the transfer buffers + * to be placed in the Data RAM region. If this condition is not met, + * this function will fail with the error code NRF_ERROR_INVALID_ADDR. + * + * @param[in] p_rx_buffer Pointer to the receive buffer. + * Pass NULL if reception is not required. + * @param[in] p_tx_buffer Pointer to the transmit buffer. + * Pass NULL if transmission is not required. + * @param[in] buffer_size Size of the buffers (in 32-bit words). + * The size must be an even number greater than 0. + * @param[in] flags Transfer options (0 for default settings). + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INVALID_STATE If a transfer was already started or + * the driver has not been initialized. + * @retval NRF_ERROR_INVALID_ADDR If the provided buffers are not placed + * in the Data RAM region. + */ +ret_code_t nrf_drv_i2s_start(uint32_t * p_rx_buffer, + uint32_t * p_tx_buffer, + uint16_t buffer_size, + uint8_t flags); + +/** + * @brief Function for stopping the I2S transfer. + */ +void nrf_drv_i2s_stop(void); + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DRV_I2S_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.c new file mode 100644 index 0000000000..bfbd37d183 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.c @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(LPCOMP) +#include "nrf_drv_lpcomp.h" +#include "nrf_assert.h" +#include "nrf_error.h" +#include "nrf_soc.h" +#include "nrf_drv_common.h" +#include "app_util_platform.h" +#include +#include +#include + +#define NRF_LOG_MODULE_NAME "LPCOMP" + +#if LPCOMP_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL LPCOMP_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR LPCOMP_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR LPCOMP_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_LPCOMP_EVENT_READY ? "NRF_LPCOMP_EVENT_READY" : \ + (event == NRF_LPCOMP_EVENT_DOWN ? "NRF_LPCOMP_EVENT_DOWN" : \ + (event == NRF_LPCOMP_EVENT_UP ? "NRF_LPCOMP_EVENT_UP" : \ + (event == NRF_LPCOMP_EVENT_CROSS ? "NRF_LPCOMP_EVENT_CROSS" : "UNKNOWN EVENT")))) +#else //LPCOMP_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //LPCOMP_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + + +static lpcomp_events_handler_t m_lpcomp_events_handler = NULL; +static nrf_drv_state_t m_state = NRF_DRV_STATE_UNINITIALIZED; + +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + #define IRQ_HANDLER_NAME irq_handler_for_lpcomp + #define IRQ_HANDLER static void IRQ_HANDLER_NAME(void) + + IRQ_HANDLER; +#else + #define IRQ_HANDLER void LPCOMP_IRQHandler(void) +#endif // NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + +static void lpcomp_execute_handler(nrf_lpcomp_event_t event, uint32_t event_mask) +{ + if ( nrf_lpcomp_event_check(event) && nrf_lpcomp_int_enable_check(event_mask) ) + { + nrf_lpcomp_event_clear(event); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(event)); + + m_lpcomp_events_handler(event); + } +} + + +IRQ_HANDLER +{ + lpcomp_execute_handler(NRF_LPCOMP_EVENT_READY, LPCOMP_INTENSET_READY_Msk); + lpcomp_execute_handler(NRF_LPCOMP_EVENT_DOWN, LPCOMP_INTENSET_DOWN_Msk); + lpcomp_execute_handler(NRF_LPCOMP_EVENT_UP, LPCOMP_INTENSET_UP_Msk); + lpcomp_execute_handler(NRF_LPCOMP_EVENT_CROSS, LPCOMP_INTENSET_CROSS_Msk); +} + + +ret_code_t nrf_drv_lpcomp_init(const nrf_drv_lpcomp_config_t * p_config, + lpcomp_events_handler_t events_handler) +{ + ASSERT(p_config); + ret_code_t err_code; + + if (m_state != NRF_DRV_STATE_UNINITIALIZED) + { // LPCOMP driver is already initialized + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + if (nrf_drv_common_per_res_acquire(NRF_LPCOMP, IRQ_HANDLER_NAME) != NRF_SUCCESS) + { + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } +#endif + + nrf_lpcomp_configure(&(p_config->hal) ); + + if (events_handler) + { + m_lpcomp_events_handler = events_handler; + } + else + { + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + nrf_lpcomp_input_select(p_config->input); + + switch (p_config->hal.detection) + { + case NRF_LPCOMP_DETECT_UP: + nrf_lpcomp_int_enable(LPCOMP_INTENSET_UP_Msk); + break; + + case NRF_LPCOMP_DETECT_DOWN: + nrf_lpcomp_int_enable(LPCOMP_INTENSET_DOWN_Msk); + break; + + case NRF_LPCOMP_DETECT_CROSS: + nrf_lpcomp_int_enable(LPCOMP_INTENSET_CROSS_Msk); + break; + + default: + break; + } + nrf_lpcomp_shorts_enable(NRF_LPCOMP_SHORT_READY_SAMPLE_MASK); + + nrf_drv_common_irq_enable(LPCOMP_IRQn, p_config->interrupt_priority); + + m_state = NRF_DRV_STATE_INITIALIZED; + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_lpcomp_uninit(void) +{ + ASSERT(m_state != NRF_DRV_STATE_UNINITIALIZED); + nrf_drv_common_irq_disable(LPCOMP_IRQn); + nrf_drv_lpcomp_disable(); +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + nrf_drv_common_per_res_release(NRF_LPCOMP); +#endif + m_state = NRF_DRV_STATE_UNINITIALIZED; + m_lpcomp_events_handler = NULL; + NRF_LOG_INFO("Uninitialized.\r\n"); +} + +void nrf_drv_lpcomp_enable(void) +{ + ASSERT(m_state == NRF_DRV_STATE_INITIALIZED); + nrf_lpcomp_enable(); + nrf_lpcomp_task_trigger(NRF_LPCOMP_TASK_START); + m_state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Enabled.\r\n"); +} + +void nrf_drv_lpcomp_disable(void) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + nrf_lpcomp_disable(); + nrf_lpcomp_task_trigger(NRF_LPCOMP_TASK_STOP); + m_state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Disabled.\r\n"); +} + +void nrf_drv_lpcomp_event_handler_register(lpcomp_events_handler_t lpcomp_events_handler) +{ + m_lpcomp_events_handler = lpcomp_events_handler; +} + +#endif //NRF_MODULE_ENABLED(LPCOMP) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.h new file mode 100644 index 0000000000..ae3e0e095a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/lpcomp/nrf_drv_lpcomp.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_DRV_LPCOMP_H__ +#define NRF_DRV_LPCOMP_H__ + +#include "nrf_lpcomp.h" +#include "sdk_errors.h" +#include "nrf_drv_common.h" +#include "sdk_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup nrf_lpcomp LPCOMP HAL and driver + * @ingroup nrf_drivers + * @brief Low Power Comparator (LPCOMP) APIs. + * @details The LPCOMP HAL provides basic APIs for accessing the registers of Low Power Comparator. + * The LPCOMP driver provides APIs on a higher level. + * + * @defgroup nrf_drv_lpcomp LPCOMP driver + * @{ + * @ingroup nrf_lpcomp + * @brief Low Power Comparator (LPCOMP) driver. + */ + +/**@brief LPCOMP event handler function type. + * @param[in] event LPCOMP event. + */ +typedef void (* lpcomp_events_handler_t)(nrf_lpcomp_event_t event); + +/**@brief LPCOMP configuration. + */ +typedef struct +{ + nrf_lpcomp_config_t hal; /**< LPCOMP HAL configuration. */ + nrf_lpcomp_input_t input; /**< Input to be monitored. */ + uint8_t interrupt_priority; /**< LPCOMP interrupt priority. */ +} nrf_drv_lpcomp_config_t; + +/** @brief LPCOMP driver default configuration including the LPCOMP HAL configuration. */ +#ifdef NRF52_SERIES +#define NRF_DRV_LPCOMP_DEFAULT_CONFIG \ + { \ + .hal = {(nrf_lpcomp_ref_t)LPCOMP_CONFIG_REFERENCE , (nrf_lpcomp_detect_t)LPCOMP_CONFIG_DETECTION, \ + (nrf_lpcomp_hysteresis_t)LPCOMP_CONFIG_HYST}, \ + .input = (nrf_lpcomp_input_t)LPCOMP_CONFIG_INPUT, \ + .interrupt_priority = LPCOMP_CONFIG_IRQ_PRIORITY \ + } +#else +#define NRF_DRV_LPCOMP_DEFAULT_CONFIG \ + { \ + .hal = {(nrf_lpcomp_ref_t)LPCOMP_CONFIG_REFERENCE , (nrf_lpcomp_detect_t)LPCOMP_CONFIG_DETECTION}, \ + .input = (nrf_lpcomp_input_t)LPCOMP_CONFIG_INPUT, \ + .interrupt_priority = LPCOMP_CONFIG_IRQ_PRIORITY \ + } +#endif + +/** + * @brief Function for initializing the LPCOMP driver. + * + * This function initializes the LPCOMP driver, but does not enable the peripheral or any interrupts. + * To start the driver, call the function nrf_drv_lpcomp_enable() after initialization. + * + * If no configuration structure is provided, the driver is initialized with the default settings. + * + * @param[in] p_config Initial configuration. If NULL, the default configuration is used. + * @param[in] events_handler Handler function. + * @retval NRF_ERROR_INVALID_PARAM If the configuration is invalid. + * @retval NRF_ERROR_INVALID_STATE If the driver has already been initialized. + */ +ret_code_t nrf_drv_lpcomp_init(const nrf_drv_lpcomp_config_t * p_config, + lpcomp_events_handler_t events_handler); + + +/** + * @brief Function for uninitializing the LCOMP driver. + * + * This function uninitializes the LPCOMP driver. The LPCOMP peripheral and + * its interrupts are disabled, and local variables are cleaned. After this call, you must + * initialize the driver again by calling nrf_drv_lpcomp_init() if you want to use it. + * + * @sa nrf_drv_lpcomp_disable() + * @sa nrf_drv_lpcomp_init() + */ +void nrf_drv_lpcomp_uninit(void); + +/**@brief Function for enabling the LPCOMP peripheral and interrupts. + * + * Before calling this function, the driver must be initialized. This function + * enables the LPCOMP peripheral and its interrupts. + * + * @sa nrf_drv_lpcomp_disable() + */ +void nrf_drv_lpcomp_enable(void); + +/**@brief Function for disabling the LPCOMP peripheral. + * + * Before calling this function, the driver must be initialized. This function disables the LPCOMP + * peripheral and its interrupts. + * + * @sa nrf_drv_lpcomp_enable() + */ +void nrf_drv_lpcomp_disable(void); + +/** + *@} + **/ + + +#ifdef __cplusplus +} +#endif + + #endif /* NRF_DRV_LPCOMP_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_error.h new file mode 100644 index 0000000000..4d4a715f49 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_error.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Header guard */ +#ifndef NRF_ERROR_H__ +#define NRF_ERROR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/// @cond Make doxygen skip this file + +/** @defgroup NRF_ERRORS_BASE Error Codes Base number definitions + * @{ */ +#define NRF_ERROR_BASE_NUM (0x0) ///< Global error base +#define NRF_ERROR_SDM_BASE_NUM (0x1000) ///< SDM error base +#define NRF_ERROR_SOC_BASE_NUM (0x2000) ///< SoC error base +#define NRF_ERROR_STK_BASE_NUM (0x3000) ///< STK error base +/** @} */ + +#define NRF_SUCCESS (NRF_ERROR_BASE_NUM + 0) ///< Successful command +#define NRF_ERROR_SVC_HANDLER_MISSING (NRF_ERROR_BASE_NUM + 1) ///< SVC handler is missing +#define NRF_ERROR_SOFTDEVICE_NOT_ENABLED (NRF_ERROR_BASE_NUM + 2) ///< SoftDevice has not been enabled +#define NRF_ERROR_INTERNAL (NRF_ERROR_BASE_NUM + 3) ///< Internal Error +#define NRF_ERROR_NO_MEM (NRF_ERROR_BASE_NUM + 4) ///< No Memory for operation +#define NRF_ERROR_NOT_FOUND (NRF_ERROR_BASE_NUM + 5) ///< Not found +#define NRF_ERROR_NOT_SUPPORTED (NRF_ERROR_BASE_NUM + 6) ///< Not supported +#define NRF_ERROR_INVALID_PARAM (NRF_ERROR_BASE_NUM + 7) ///< Invalid Parameter +#define NRF_ERROR_INVALID_STATE (NRF_ERROR_BASE_NUM + 8) ///< Invalid state, operation disallowed in this state +#define NRF_ERROR_INVALID_LENGTH (NRF_ERROR_BASE_NUM + 9) ///< Invalid Length +#define NRF_ERROR_INVALID_FLAGS (NRF_ERROR_BASE_NUM + 10) ///< Invalid Flags +#define NRF_ERROR_INVALID_DATA (NRF_ERROR_BASE_NUM + 11) ///< Invalid Data +#define NRF_ERROR_DATA_SIZE (NRF_ERROR_BASE_NUM + 12) ///< Data size exceeds limit +#define NRF_ERROR_TIMEOUT (NRF_ERROR_BASE_NUM + 13) ///< Operation timed out +#define NRF_ERROR_NULL (NRF_ERROR_BASE_NUM + 14) ///< Null Pointer +#define NRF_ERROR_FORBIDDEN (NRF_ERROR_BASE_NUM + 15) ///< Forbidden Operation +#define NRF_ERROR_INVALID_ADDR (NRF_ERROR_BASE_NUM + 16) ///< Bad Memory Address +#define NRF_ERROR_BUSY (NRF_ERROR_BASE_NUM + 17) ///< Busy + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_ERROR_H__ + +/// @endcond +/** + @} +*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.c new file mode 100644 index 0000000000..4d354c3eb9 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.c @@ -0,0 +1,122 @@ + /* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include "nrf_soc.h" +#include "nrf_error.h" + +static uint8_t m_in_critical_region = 0; + +uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn) +{ + NVIC_EnableIRQ(IRQn); + return NRF_SUCCESS; +} + +uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn) +{ + NVIC_DisableIRQ(IRQn); + return NRF_SUCCESS; +} + +uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq) +{ + if (p_pending_irq != NULL) + { + *p_pending_irq = NVIC_GetPendingIRQ(IRQn); + return NRF_SUCCESS; + } + return NRF_ERROR_NULL; +} + +uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn) +{ + NVIC_SetPendingIRQ(IRQn); + return NRF_SUCCESS; +} + +uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn) +{ + NVIC_ClearPendingIRQ(IRQn); + return NRF_SUCCESS; +} + +uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + NVIC_SetPriority(IRQn, priority); + return NRF_SUCCESS; +} + +uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority) +{ + if (p_priority != NULL) + { + *p_priority = NVIC_GetPriority(IRQn); + return NRF_SUCCESS; + } + + return NRF_ERROR_NULL; +} + +uint32_t sd_nvic_SystemReset(void) +{ + NVIC_SystemReset(); + return NRF_SUCCESS; +} + +uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region) +{ + __disable_irq(); + + *p_is_nested_critical_region = (m_in_critical_region != 0); + m_in_critical_region++; + + return NRF_SUCCESS; +} + +uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region) +{ + m_in_critical_region--; + + if (is_nested_critical_region == 0) + { + m_in_critical_region = 0; + __enable_irq(); + } + return NRF_SUCCESS; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.h new file mode 100644 index 0000000000..7b3ad74844 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_nvic.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_SOC_H__ +#define NRF_SOC_H__ + +#include +#include "nrf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Enable External Interrupt. + * @note Corresponds to NVIC_EnableIRQ in CMSIS. + * + * @pre{IRQn is valid and not reserved by the stack} + * + * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt was enabled. + */ +uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn); + +/**@brief Disable External Interrupt. + * @note Corresponds to NVIC_DisableIRQ in CMSIS. + * + * @pre{IRQn is valid and not reserved by the stack} + * + * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS + * + * @retval ::NRF_SUCCESS The interrupt was disabled. + */ +uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn); + +/**@brief Get Pending Interrupt. + * @note Corresponds to NVIC_GetPendingIRQ in CMSIS. + * + * @pre{IRQn is valid and not reserved by the stack} + * + * @param[in] IRQn See the NVIC_GetPendingIRQ documentation in CMSIS. + * @param[out] p_pending_irq Return value from NVIC_GetPendingIRQ. + * + * @retval ::NRF_SUCCESS The interrupt is available for the application. + */ +uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq); + +/**@brief Set Pending Interrupt. + * @note Corresponds to NVIC_SetPendingIRQ in CMSIS. + * + * @pre{IRQn is valid and not reserved by the stack} + * + * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt is set pending. + */ +uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn); + +/**@brief Clear Pending Interrupt. + * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS. + * + * @pre{IRQn is valid and not reserved by the stack} + * + * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS. + * + * @retval ::NRF_SUCCESS The interrupt pending flag is cleared. + */ +uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn); + +/**@brief Set Interrupt Priority. + * @note Corresponds to NVIC_SetPriority in CMSIS. + * + * @pre{IRQn is valid and not reserved by the stack} + * @pre{priority is valid and not reserved by the stack} + * + * @param[in] IRQn See the NVIC_SetPriority documentation in CMSIS. + * @param[in] priority A valid IRQ priority for use by the application. + * + * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application. + */ +uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority); + +/**@brief Get Interrupt Priority. + * @note Corresponds to NVIC_GetPriority in CMSIS. + * + * @pre{IRQn is valid and not reserved by the stack} + * + * @param[in] IRQn See the NVIC_GetPriority documentation in CMSIS. + * @param[out] p_priority Return value from NVIC_GetPriority. + * + * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority. + */ +uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority); + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +uint32_t sd_nvic_SystemReset(void); + +/**@brief Enters critical region. + * + * @post Application interrupts will be disabled. + * @sa sd_nvic_critical_region_exit + * + * @param[out] p_is_nested_critical_region 1: If in a nested critical region. + * 0: Otherwise. + * + * @retval ::NRF_SUCCESS + */ +uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region); + +/**@brief Exit critical region. + * + * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter. + * @post If not in a nested critical region, the application interrupts will restored to the state before ::sd_nvic_critical_region_enter was called. + * + * @param[in] is_nested_critical_region If this is set to 1, the critical region won't be exited. @sa sd_nvic_critical_region_enter. + * + * @retval ::NRF_SUCCESS + */ +uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region); + + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_SOC_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_soc.c similarity index 80% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_soc.c index d4804f5348..83a3f9018e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_soc.c @@ -1,4 +1,4 @@ -/* + /* * Copyright (c) 2014 Nordic Semiconductor ASA * All rights reserved. * @@ -36,35 +36,12 @@ * */ +#include +#include "nrf_soc.h" +#include "nrf_error.h" -#include -#include -#include -#include - - -#ifdef ENABLE_DEBUG_LOG_SUPPORT -#include "app_trace.h" -#include "nrf_log.h" - -void app_trace_init(void) +uint32_t sd_app_evt_wait(void) { - (void)NRF_LOG_INIT(); + __WFE(); + return NRF_SUCCESS; } - -void app_trace_dump(uint8_t * p_buffer, uint32_t len) -{ - app_trace_log("\r\n"); - for (uint32_t index = 0; index < len; index++) - { - app_trace_log("0x%02X ", p_buffer[index]); - } - app_trace_log("\r\n"); -} - -#endif // ENABLE_DEBUG_LOG_SUPPORT - -/** - *@} - **/ - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_settings.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_soc.h similarity index 58% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_settings.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_soc.h index c8964f42dc..aaeb3d98bd 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_settings.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/nrf_soc_nosd/nrf_soc.h @@ -36,27 +36,44 @@ * */ - - /**@file - * - * @defgroup nrf_bootloader_settings Bootloader settings API. - * @{ - * - * @brief Bootloader settings module interface. - */ - -#ifndef BOOTLOADER_SETTINGS_H__ -#define BOOTLOADER_SETTINGS_H__ +#ifndef NRF_SOC_H__ +#define NRF_SOC_H__ #include -#include "bootloader_types.h" +#include "nrf.h" -/**@brief Function for getting the bootloader settings. - * - * @param[out] pp_bootloader_settings Bootloader settings. +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Waits for an application event. + * + * 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). @sa CMSIS_SCB + * + * @note If an application interrupt has happened since the last time sd_app_evt_wait was + * called this function will return immediately and not go to sleep. This is to avoid race + * conditions that can occur when a flag is updated in the interrupt handler and processed + * in the main loop. + * + * @post An application interrupt has happened or a interrupt pending flag is set. + * + * @retval ::NRF_SUCCESS */ -void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings); +uint32_t sd_app_evt_wait(void); -#endif // BOOTLOADER_SETTINGS_H__ -/**@} */ +#ifdef __cplusplus +} +#endif + +#endif /* NRF_SOC_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pdm/nrf_drv_pdm.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pdm/nrf_drv_pdm.c new file mode 100644 index 0000000000..1ab1cf7825 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pdm/nrf_drv_pdm.c @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PDM) +#include "nrf_drv_pdm.h" +#include "nrf_assert.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" + +#define NRF_LOG_MODULE_NAME "PDM" + +#if PDM_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL PDM_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR PDM_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR PDM_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_PDM_EVENT_STARTED ? "NRF_PDM_EVENT_STARTED" : \ + (event == NRF_PDM_EVENT_STOPPED ? "NRF_COMP_EVENT_DOWN" : \ + (event == NRF_PDM_EVENT_END ? "NRF_COMP_EVENT_CROSS" : "UNKNOWN EVENT"))) +#else //PDM_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //PDM_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + + +/** @brief PDM interface status. */ +typedef enum +{ + NRF_PDM_STATE_IDLE, + NRF_PDM_STATE_RUNNING, + NRF_PDM_STATE_TRANSITION +} nrf_drv_pdm_state_t; + + +/** @brief PDM interface control block.*/ +typedef struct +{ + nrf_drv_state_t drv_state; ///< Driver state. + nrf_drv_pdm_state_t status; ///< Sampling state. + nrf_drv_pdm_event_handler_t event_handler; ///< Event handler function pointer. + uint16_t buffer_length; ///< Length of a single buffer in 16-bit words. + uint32_t * buffers[2]; ///< Sample buffers. +} nrf_drv_pdm_cb_t; + +static nrf_drv_pdm_cb_t m_cb; + + +void PDM_IRQHandler(void) +{ + if (nrf_pdm_event_check(NRF_PDM_EVENT_END)) + { + nrf_pdm_event_clear(NRF_PDM_EVENT_END); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_PDM_EVENT_END)); + + //Buffer is ready to process. + if (nrf_pdm_buffer_get() == m_cb.buffers[0]) + { + NRF_LOG_DEBUG("PDM data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)m_cb.buffers[1], m_cb.buffer_length * sizeof(m_cb.buffers[1])); + m_cb.event_handler(m_cb.buffers[1], m_cb.buffer_length); + } + else + { + NRF_LOG_DEBUG("PDM data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)m_cb.buffers[0], m_cb.buffer_length * sizeof(m_cb.buffers[0])); + m_cb.event_handler(m_cb.buffers[0], m_cb.buffer_length); + } + } + else if (nrf_pdm_event_check(NRF_PDM_EVENT_STARTED)) + { + nrf_pdm_event_clear(NRF_PDM_EVENT_STARTED); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_PDM_EVENT_STARTED)); + m_cb.status = NRF_PDM_STATE_RUNNING; + + //Swap buffer. + if (nrf_pdm_buffer_get() == m_cb.buffers[0]) + { + nrf_pdm_buffer_set(m_cb.buffers[1],m_cb.buffer_length); + } + else + { + nrf_pdm_buffer_set(m_cb.buffers[0],m_cb.buffer_length); + } + } + else if (nrf_pdm_event_check(NRF_PDM_EVENT_STOPPED)) + { + nrf_pdm_event_clear(NRF_PDM_EVENT_STOPPED); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_PDM_EVENT_STOPPED)); + nrf_pdm_disable(); + m_cb.status = NRF_PDM_STATE_IDLE; + } +} + + +ret_code_t nrf_drv_pdm_init(nrf_drv_pdm_config_t const * p_config, + nrf_drv_pdm_event_handler_t event_handler) +{ + ret_code_t err_code; + + if (m_cb.drv_state != NRF_DRV_STATE_UNINITIALIZED) + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + if ((p_config == NULL) + || (event_handler == NULL)) + { + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + if (p_config->gain_l > NRF_PDM_GAIN_MAXIMUM + || p_config->gain_r > NRF_PDM_GAIN_MAXIMUM + || p_config->buffer_length > NRF_PDM_MAX_BUFFER_SIZE) + { + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + m_cb.buffers[0] = (uint32_t*)p_config->buffer_a; + m_cb.buffers[1] = (uint32_t*)p_config->buffer_b; + m_cb.buffer_length = p_config->buffer_length; + m_cb.event_handler = event_handler; + m_cb.status = NRF_PDM_STATE_IDLE; + + nrf_pdm_buffer_set(m_cb.buffers[0],m_cb.buffer_length); + nrf_pdm_clock_set(p_config->clock_freq); + nrf_pdm_mode_set(p_config->mode, p_config->edge); + nrf_pdm_gain_set(p_config->gain_l, p_config->gain_r); + + nrf_gpio_cfg_output(p_config->pin_clk); + nrf_gpio_pin_clear(p_config->pin_clk); + nrf_gpio_cfg_input(p_config->pin_din, NRF_GPIO_PIN_NOPULL); + nrf_pdm_psel_connect(p_config->pin_clk, p_config->pin_din); + + m_cb.drv_state = NRF_DRV_STATE_INITIALIZED; + nrf_pdm_int_enable(NRF_PDM_INT_STARTED | NRF_PDM_INT_END | NRF_PDM_INT_STOPPED); + nrf_drv_common_irq_enable(PDM_IRQn, p_config->interrupt_priority); + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_pdm_uninit(void) +{ + nrf_pdm_disable(); + nrf_pdm_psel_disconnect(); + m_cb.drv_state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Uninitialized.\r\n"); +} + + +ret_code_t nrf_drv_pdm_start(void) +{ + ASSERT(m_cb.drv_state != NRF_DRV_STATE_UNINITIALIZED); + ret_code_t err_code; + + if (m_cb.status != NRF_PDM_STATE_IDLE) + { + if (m_cb.status == NRF_PDM_STATE_RUNNING) + { + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + m_cb.status = NRF_PDM_STATE_TRANSITION; + m_cb.drv_state = NRF_DRV_STATE_POWERED_ON; + nrf_pdm_enable(); + nrf_pdm_event_clear(NRF_PDM_EVENT_STARTED); + nrf_pdm_task_trigger(NRF_PDM_TASK_START); + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +ret_code_t nrf_drv_pdm_stop(void) +{ + ASSERT(m_cb.drv_state != NRF_DRV_STATE_UNINITIALIZED); + ret_code_t err_code; + + if (m_cb.status != NRF_PDM_STATE_RUNNING) + { + if (m_cb.status == NRF_PDM_STATE_IDLE) + { + nrf_pdm_disable(); + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + m_cb.status = NRF_PDM_STATE_TRANSITION; + m_cb.drv_state = NRF_DRV_STATE_INITIALIZED; + nrf_pdm_task_trigger(NRF_PDM_TASK_STOP); + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} +#endif //NRF_MODULE_ENABLED(PDM) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pdm/nrf_drv_pdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pdm/nrf_drv_pdm.h new file mode 100644 index 0000000000..96a5bb596c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pdm/nrf_drv_pdm.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @addtogroup nrf_pdm PDM HAL and driver + * @ingroup nrf_drivers + * @brief @tagAPI52 Pulse density modulation (PDM) interface APIs. + * + * The PDM HAL provides basic APIs for accessing the registers of the PDM interface peripheral. + * The PDM driver provides APIs on a higher level. + * + * @defgroup nrf_drv_pdm PDM driver + * @{ + * @ingroup nrf_pdm + * + * @brief @tagAPI52 Pulse density modulation (PDM) interface driver. + */ + + +#ifndef NRF_DRV_PDM_H__ +#define NRF_DRV_PDM_H__ + +#include "sdk_config.h" +#include "nrf_pdm.h" +#include "sdk_errors.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define NRF_PDM_MAX_BUFFER_SIZE 32768 + + +/** + * @brief PDM interface driver configuration structure. + */ +typedef struct +{ + nrf_pdm_mode_t mode; ///< Interface operation mode. + nrf_pdm_edge_t edge; ///< Sampling mode. + uint8_t pin_clk; ///< CLK pin. + uint8_t pin_din; ///< DIN pin. + nrf_pdm_freq_t clock_freq; ///< Clock frequency. + nrf_pdm_gain_t gain_l; ///< Left channel gain. + nrf_pdm_gain_t gain_r; ///< Right channel gain. + uint8_t interrupt_priority; ///< Interrupt priority. + uint16_t buffer_length; ///< Length of a single buffer (in 16-bit words). + int16_t * buffer_a; ///< Sample buffer A (filled first). + int16_t * buffer_b; ///< Sample buffer B (filled after buffer A). +} nrf_drv_pdm_config_t; + + +/** + * @brief Macro for setting @ref nrf_drv_pdm_config_t to default settings + * in single ended mode. + * + * @param PIN_CLK CLK output pin. + * @param PIN_DIN DIN input pin. + * @param BUFF_A Sample buffer A (filled first). + * @param BUFF_B Sample buffer B (filled after buffer A). + * @param BUFF_LEN Length of a single buffer (in 16-bit words). + */ +#define NRF_DRV_PDM_DEFAULT_CONFIG(PIN_CLK, PIN_DIN, BUFF_A, BUFF_B, BUFF_LEN) \ +{ \ + .mode = (nrf_pdm_mode_t)PDM_CONFIG_MODE, \ + .edge = (nrf_pdm_edge_t)PDM_CONFIG_EDGE, \ + .pin_clk = PIN_CLK, \ + .pin_din = PIN_DIN, \ + .clock_freq = (nrf_pdm_freq_t)PDM_CONFIG_CLOCK_FREQ, \ + .gain_l = NRF_PDM_GAIN_DEFAULT, \ + .gain_r = NRF_PDM_GAIN_DEFAULT, \ + .interrupt_priority = PDM_CONFIG_IRQ_PRIORITY, \ + .buffer_length = BUFF_LEN, \ + .buffer_a = BUFF_A, \ + .buffer_b = BUFF_B \ +} + + +/** + * @brief Handler for PDM interface ready events. + * + * This event handler is called when a buffer is full and ready to be processed. + * + * @param[in] p_buffer Sample buffer pointer. + * @param[in] length Buffer length in 16-bit words. + */ +typedef void (*nrf_drv_pdm_event_handler_t)(uint32_t * buffer, uint16_t length); + + +/** + * @brief Function for initializing the PDM interface. + * + * @param[in] p_config Pointer to a configuration structure. If NULL, the default one is used. + * @param[in] event_handler Event handler provided by the user. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver is already initialized. + * @retval NRF_ERROR_INVALID_PARAM If invalid parameters were specified. + */ +ret_code_t nrf_drv_pdm_init(nrf_drv_pdm_config_t const * p_config, + nrf_drv_pdm_event_handler_t event_handler); + + +/** + * @brief Function for uninitializing the PDM interface. + * + * This function stops PDM sampling, if it is in progress. + */ +void nrf_drv_pdm_uninit(void); + + +/** + * @brief Function for getting the address of a PDM interface task. + * + * @param[in] task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_pdm_task_address_get(nrf_pdm_task_t task) +{ + return nrf_pdm_task_address_get(task); +} + + +/** + * @brief Function for getting the state of the PDM interface. + * + * @retval TRUE If the PDM interface is enabled. + * @retval FALSE If the PDM interface is disabled. + */ +__STATIC_INLINE bool nrf_drv_pdm_enable_check() +{ + return nrf_pdm_enable_check(); +} + + +/** + * @brief Function for starting PDM sampling. + * + * @retval NRF_SUCCESS If sampling was started successfully or was already in progress. + * @retval NRF_ERROR_BUSY If a previous start/stop operation is in progress. + */ +ret_code_t nrf_drv_pdm_start(void); + + +/** + * @brief Function for stopping PDM sampling. + * + * When this function is called, the PDM interface is stopped after finishing + * the current frame. + * The event handler function might be called once more after calling this function. + * + * @retval NRF_SUCCESS If sampling was stopped successfully or was already stopped before. + * @retval NRF_ERROR_BUSY If a previous start/stop operation is in progress. + */ +ret_code_t nrf_drv_pdm_stop(void); + + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DRV_PDM_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.c index 12b36d1acb..1674563992 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.c @@ -35,8 +35,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PPI) #include #include "nrf.h" @@ -44,7 +44,18 @@ #include "nrf_drv_common.h" #include "nrf_ppi.h" #include "app_util_platform.h" -#include "sdk_common.h" + +#define NRF_LOG_MODULE_NAME "PPI" + +#if PPI_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL PPI_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR PPI_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR PPI_CONFIG_DEBUG_COLOR +#else //PPI_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif //PPI_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" static nrf_drv_state_t m_drv_state; /**< Driver state */ @@ -193,23 +204,28 @@ uint32_t nrf_drv_ppi_init(void) } else { - err_code = MODULE_ALREADY_INITIALIZED; + + err_code = NRF_ERROR_MODULE_ALREADY_INITIALIZED; } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); return err_code; } uint32_t nrf_drv_ppi_uninit(void) { + ret_code_t err_code = NRF_SUCCESS; uint32_t mask = NRF_PPI_ALL_APP_GROUPS_MASK; nrf_ppi_channel_group_t group; if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } - + m_drv_state = NRF_DRV_STATE_UNINITIALIZED; // Disable all channels and groups @@ -217,20 +233,21 @@ uint32_t nrf_drv_ppi_uninit(void) for (group = NRF_PPI_CHANNEL_GROUP0; mask != 0; mask &= ~group_to_mask(group), group++) { - if(mask & group_to_mask(group)) + if (mask & group_to_mask(group)) { nrf_ppi_channel_group_clear(group); } } channel_allocated_clr_all(); group_allocated_clr_all(); - return NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } uint32_t nrf_drv_ppi_channel_alloc(nrf_ppi_channel_t * p_channel) { - uint32_t err_code; + uint32_t err_code = NRF_SUCCESS; nrf_ppi_channel_t channel; uint32_t mask = 0; @@ -249,26 +266,34 @@ uint32_t nrf_drv_ppi_channel_alloc(nrf_ppi_channel_t * p_channel) CRITICAL_REGION_EXIT(); if (err_code == NRF_SUCCESS) { + NRF_LOG_INFO("Allocated channel: %d.\r\n", channel); break; } } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); return err_code; } uint32_t nrf_drv_ppi_channel_free(nrf_ppi_channel_t channel) { + ret_code_t err_code = NRF_SUCCESS; + if (!is_programmable_app_channel(channel)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - // First disable this channel - nrf_ppi_channel_disable(channel); - CRITICAL_REGION_ENTER(); - channel_allocated_clr(channel); - CRITICAL_REGION_EXIT(); - return NRF_SUCCESS; + else + { + // First disable this channel + nrf_ppi_channel_disable(channel); + CRITICAL_REGION_ENTER(); + channel_allocated_clr(channel); + CRITICAL_REGION_EXIT(); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } @@ -277,64 +302,91 @@ uint32_t nrf_drv_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uin VERIFY_PARAM_NOT_NULL((uint32_t *)eep); VERIFY_PARAM_NOT_NULL((uint32_t *)tep); + ret_code_t err_code = NRF_SUCCESS; + if (!is_programmable_app_channel(channel)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - if (!is_allocated_channel(channel)) + else if (!is_allocated_channel(channel)) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } - - nrf_ppi_channel_endpoint_setup(channel, eep, tep); - return NRF_SUCCESS; + else + { + nrf_ppi_channel_endpoint_setup(channel, eep, tep); + NRF_LOG_INFO("Assigned channel: %d, event end point: %x, task end point: %x.\r\n", channel, eep, tep); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } uint32_t nrf_drv_ppi_channel_fork_assign(nrf_ppi_channel_t channel, uint32_t fork_tep) { -#ifdef NRF51 - return NRF_ERROR_NOT_SUPPORTED; -#else + ret_code_t err_code = NRF_SUCCESS; +#ifdef PPI_FEATURE_FORKS_PRESENT if (!is_programmable_app_channel(channel)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - if (!is_allocated_channel(channel)) + else if (!is_allocated_channel(channel)) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } - nrf_ppi_fork_endpoint_setup(channel, fork_tep); - return NRF_SUCCESS; + else + { + nrf_ppi_fork_endpoint_setup(channel, fork_tep); + NRF_LOG_INFO("Fork assigned channel: %d, task end point: %d.\r\n", channel, fork_tep); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +#else + err_code = NRF_ERROR_NOT_SUPPORTED; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; #endif } uint32_t nrf_drv_ppi_channel_enable(nrf_ppi_channel_t channel) { + ret_code_t err_code = NRF_SUCCESS; + if (!is_app_channel(channel)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - if (is_programmable_app_channel(channel) && !is_allocated_channel(channel)) + else if (is_programmable_app_channel(channel) && !is_allocated_channel(channel)) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } - nrf_ppi_channel_enable(channel); - return NRF_SUCCESS; + else + { + nrf_ppi_channel_enable(channel); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } uint32_t nrf_drv_ppi_channel_disable(nrf_ppi_channel_t channel) { + ret_code_t err_code = NRF_SUCCESS; + if (!is_app_channel(channel)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - if (is_programmable_app_channel(channel) && !is_allocated_channel(channel)) + else if (is_programmable_app_channel(channel) && !is_allocated_channel(channel)) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } - nrf_ppi_channel_disable(channel); - return NRF_SUCCESS; + else + { + nrf_ppi_channel_disable(channel); + err_code = NRF_SUCCESS; + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } @@ -359,96 +411,128 @@ uint32_t nrf_drv_ppi_group_alloc(nrf_ppi_channel_group_t * p_group) CRITICAL_REGION_EXIT(); if (err_code == NRF_SUCCESS) { + NRF_LOG_INFO("Allocated group: %d.\r\n", group); break; } } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); return err_code; } uint32_t nrf_drv_ppi_group_free(nrf_ppi_channel_group_t group) { + ret_code_t err_code = NRF_SUCCESS; + if (!is_app_group(group)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } if (!is_allocated_group(group)) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } else - nrf_ppi_group_disable(group); - CRITICAL_REGION_ENTER(); - group_allocated_clr(group); - CRITICAL_REGION_EXIT(); - return NRF_SUCCESS; + { + nrf_ppi_group_disable(group); + CRITICAL_REGION_ENTER(); + group_allocated_clr(group); + CRITICAL_REGION_EXIT(); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } uint32_t nrf_drv_ppi_group_enable(nrf_ppi_channel_group_t group) { + ret_code_t err_code = NRF_SUCCESS; + if (!is_app_group(group)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - if (!is_allocated_group(group)) + else if (!is_allocated_group(group)) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } - nrf_ppi_group_enable(group); - return NRF_SUCCESS; + else + { + nrf_ppi_group_enable(group); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } uint32_t nrf_drv_ppi_group_disable(nrf_ppi_channel_group_t group) { + ret_code_t err_code = NRF_SUCCESS; + if (!is_app_group(group)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - nrf_ppi_group_disable(group); - return NRF_SUCCESS; + else + { + nrf_ppi_group_disable(group); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } uint32_t nrf_drv_ppi_channels_remove_from_group(uint32_t channel_mask, nrf_ppi_channel_group_t group) { + ret_code_t err_code = NRF_SUCCESS; + if (!is_app_group(group)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - if (!is_allocated_group(group)) + else if (!is_allocated_group(group)) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } - if (!are_app_channels(channel_mask)) + else if (!are_app_channels(channel_mask)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - CRITICAL_REGION_ENTER(); - nrf_ppi_channels_remove_from_group(channel_mask, group); - CRITICAL_REGION_EXIT(); - return NRF_SUCCESS; + else + { + CRITICAL_REGION_ENTER(); + nrf_ppi_channels_remove_from_group(channel_mask, group); + CRITICAL_REGION_EXIT(); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } uint32_t nrf_drv_ppi_channels_include_in_group(uint32_t channel_mask, nrf_ppi_channel_group_t group) { + ret_code_t err_code = NRF_SUCCESS; + if (!is_app_group(group)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - if (!is_allocated_group(group)) + else if (!is_allocated_group(group)) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; } - if (!are_app_channels(channel_mask)) + else if (!are_app_channels(channel_mask)) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; } - CRITICAL_REGION_ENTER(); - nrf_ppi_channels_include_in_group(channel_mask, group); - CRITICAL_REGION_EXIT(); - return NRF_SUCCESS; + else + { + CRITICAL_REGION_ENTER(); + nrf_ppi_channels_include_in_group(channel_mask, group); + CRITICAL_REGION_EXIT(); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } +#endif //NRF_MODULE_ENABLED(PPI) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.h index 55cd93346c..193dd8ef10 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/ppi/nrf_drv_ppi.h @@ -36,7 +36,6 @@ * */ - #ifndef NRF_DRV_PPI_H #define NRF_DRV_PPI_H @@ -52,10 +51,10 @@ * @ingroup nrf_drivers * @brief Programmable Peripheral Interconnect (PPI) APIs. * - * @details The PPI HAL provides basic APIs for accessing the registers of the PPI. + * @details The PPI HAL provides basic APIs for accessing the registers of the PPI. * The PPI driver provides APIs on a higher level. * - * @defgroup lib_driver_ppi PPI driver + * @defgroup nrf_drv_ppi PPI driver * @{ * @ingroup nrf_ppi * @@ -64,29 +63,29 @@ #include "sdk_resources.h" -#ifdef NRF52 - - #define NRF_PPI_ALL_APP_CHANNELS_MASK ((uint32_t)0xFFFFFFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< All PPI channels available to the application. */ - #define NRF_PPI_PROG_APP_CHANNELS_MASK ((uint32_t)0x000FFFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< Programmable PPI channels available to the application. */ - #define NRF_PPI_ALL_APP_GROUPS_MASK ((uint32_t)0x0000003FuL & ~(NRF_PPI_GROUPS_USED)) /**< All PPI groups available to the application. */ - -#else - - #define NRF_PPI_ALL_APP_CHANNELS_MASK ((uint32_t)0xFFF0FFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< All PPI channels available to the application. */ - #define NRF_PPI_PROG_APP_CHANNELS_MASK ((uint32_t)0x0000FFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< Programmable PPI channels available to the application. */ - #define NRF_PPI_ALL_APP_GROUPS_MASK ((uint32_t)0x0000000FuL & ~(NRF_PPI_GROUPS_USED)) /**< All PPI groups available to the application. */ - +#ifdef __cplusplus +extern "C" { #endif +#if PPI_CH_NUM > 16 +#define NRF_PPI_ALL_APP_CHANNELS_MASK ((uint32_t)0xFFFFFFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< All PPI channels available to the application. */ +#define NRF_PPI_PROG_APP_CHANNELS_MASK ((uint32_t)0x000FFFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< Programmable PPI channels available to the application. */ +#else +#define NRF_PPI_ALL_APP_CHANNELS_MASK ((uint32_t)0xFFF0FFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< All PPI channels available to the application. */ +#define NRF_PPI_PROG_APP_CHANNELS_MASK ((uint32_t)0x0000FFFFuL & ~(NRF_PPI_CHANNELS_USED)) /**< Programmable PPI channels available to the application. */ +#endif + +#define NRF_PPI_ALL_APP_GROUPS_MASK (((1uL << PPI_GROUP_NUM) - 1) & ~(NRF_PPI_GROUPS_USED)) /**< All PPI groups available to the application. */ + /**@brief Function for initializing PPI module. * - * @retval NRF_SUCCESS If the module was successfully initialized. - * @retval MODULE_ALREADY_INITIALIZED If the module has already been initialized. + * @retval NRF_SUCCESS If the module was successfully initialized. + * @retval NRF_ERROR_MODULE_ALREADY_INITIALIZED If the module has already been initialized. */ uint32_t nrf_drv_ppi_init(void); -/**@brief Function for uninitializing the PPI module. +/**@brief Function for uninitializing the PPI module. * * This function also disables all channels and clears the channel groups. * @@ -308,4 +307,9 @@ __STATIC_INLINE uint32_t nrf_drv_ppi_task_addr_group_disable_get(nrf_ppi_channel **/ /*lint --flb "Leave library region" */ + +#ifdef __cplusplus +} +#endif + #endif // NRF_DRV_PPI_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/config/pstorage_platform.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/config/pstorage_platform.h deleted file mode 100644 index 113fd637fc..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/config/pstorage_platform.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - - /** @cond To make doxygen skip this file */ - -/** @file - * This header contains defines with respect persistent storage that are specific to - * persistent storage implementation and application use case. - */ -#ifndef PSTORAGE_PL_H__ -#define PSTORAGE_PL_H__ - -#include -#include "nrf.h" - -static __INLINE uint16_t pstorage_flash_page_size() -{ - return (uint16_t)NRF_FICR->CODEPAGESIZE; -} - -#define PSTORAGE_FLASH_PAGE_SIZE pstorage_flash_page_size() /**< Size of one flash page. */ -#define PSTORAGE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */ - -static __INLINE uint32_t pstorage_flash_page_end() -{ - uint32_t bootloader_addr = NRF_UICR->NRFFW[0]; - - return ((bootloader_addr != PSTORAGE_FLASH_EMPTY_MASK) ? - (bootloader_addr/ PSTORAGE_FLASH_PAGE_SIZE) : NRF_FICR->CODESIZE); -} - -#define PSTORAGE_FLASH_PAGE_END pstorage_flash_page_end() - -#define PSTORAGE_NUM_OF_PAGES 1 /**< Number of flash pages allocated for the pstorage module excluding the swap page, configurable based on system requirements. */ -#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. */ - -#define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \ - * PSTORAGE_FLASH_PAGE_SIZE) /**< Start address for persistent data, configurable according to system requirements. */ -#define PSTORAGE_DATA_END_ADDR ((PSTORAGE_FLASH_PAGE_END - 1) * PSTORAGE_FLASH_PAGE_SIZE) /**< End address for persistent data, configurable according to system requirements. */ -#define PSTORAGE_SWAP_ADDR PSTORAGE_DATA_END_ADDR /**< Top-most page is used as swap area for clear and update. */ - -#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. */ -#define PSTORAGE_CMD_QUEUE_SIZE 10 /**< Maximum number of flash access commands that can be maintained by the module for all applications. Configurable. */ - - -/** Abstracts persistently memory block identifier. */ -typedef uint32_t pstorage_block_t; - -typedef struct -{ - uint32_t module_id; /**< Module ID.*/ - pstorage_block_t block_id; /**< Block ID.*/ -} pstorage_handle_t; - -typedef uint16_t pstorage_size_t; /** Size of length and offset fields. */ - -/**@brief Handles Flash Access Result Events. To be called in the system event dispatcher of the application. */ -void pstorage_sys_event_handler (uint32_t sys_evt); - -#endif // PSTORAGE_PL_H__ - -/** @} */ -/** @endcond */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.c deleted file mode 100644 index f39fe2c1e7..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.c +++ /dev/null @@ -1,1599 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#include "pstorage.h" -#include -#include -#include -#include "nordic_common.h" -#include "nrf_error.h" -#include "nrf_assert.h" -#include "nrf.h" -#include "nrf_soc.h" -#include "app_util.h" -#include "app_error.h" - -#define INVALID_OPCODE 0x00 /**< Invalid op code identifier. */ -#define SOC_MAX_WRITE_SIZE PSTORAGE_FLASH_PAGE_SIZE /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API. */ -#define RAW_MODE_APP_ID (PSTORAGE_NUM_OF_PAGES + 1) /**< Application id for raw mode. */ - -#if defined(NRF52) -#define SD_CMD_MAX_TRIES 1000 /**< Number of times to try a softdevice flash operatoion, specific for nRF52 to account for longest time of flash page erase*/ -#else -#define SD_CMD_MAX_TRIES 3 /**< Number of times to try a softdevice flash operation when the @ref NRF_EVT_FLASH_OPERATION_ERROR sys_evt is received. */ -#endif /* defined(NRF52) */ - -#define MASK_TAIL_SWAP_DONE (1 << 0) /**< Flag for checking if the tail restore area has been written to swap page. */ -#define MASK_SINGLE_PAGE_OPERATION (1 << 1) /**< Flag for checking if command is a single flash page operation. */ -#define MASK_MODULE_INITIALIZED (1 << 2) /**< Flag for checking if the module has been initialized. */ -#define MASK_FLASH_API_ERR_BUSY (1 << 3) /**< Flag for checking if flash API returned NRF_ERROR_BUSY. */ - -/** - * @defgroup api_param_check API Parameters check macros. - * - * @details Macros that verify parameters passed to the module in the APIs. These macros - * could be mapped to nothing in final code versions to save execution and size. - * - * @{ - */ - -/**@brief Check if the input pointer is NULL, if so it returns NRF_ERROR_NULL. - */ -#define NULL_PARAM_CHECK(PARAM) \ - if ((PARAM) == NULL) \ - { \ - return NRF_ERROR_NULL; \ - } - -/**@brief Verifies that the module identifier supplied by the application is within permissible - * range. - */ -#define MODULE_ID_RANGE_CHECK(ID) \ - if ((((ID)->module_id) >= PSTORAGE_NUM_OF_PAGES) || \ - (m_app_table[(ID)->module_id].cb == NULL)) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } - -/**@brief Verifies that the block identifier supplied by the application is within the permissible - * range. - */ -#define BLOCK_ID_RANGE_CHECK(ID) \ - if (((ID)->block_id) >= (m_app_table[(ID)->module_id].base_id + \ - (m_app_table[(ID)->module_id].block_count * MODULE_BLOCK_SIZE(ID)))) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } - -/**@brief Verifies that the block size requested by the application can be supported by the module. - */ -#define BLOCK_SIZE_CHECK(X) \ - if (((X) > PSTORAGE_MAX_BLOCK_SIZE) || ((X) < PSTORAGE_MIN_BLOCK_SIZE)) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } - -/**@brief Verifies the block size requested by the application in registration API. - */ -#define BLOCK_COUNT_CHECK(COUNT, SIZE) \ - if (((COUNT) == 0) || \ - ((m_next_page_addr + ((COUNT) *(SIZE)) > PSTORAGE_SWAP_ADDR))) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } - -/**@brief Verifies the size parameter provided by the application in API. - */ -#define SIZE_CHECK(ID, SIZE) \ - if(((SIZE) == 0) || ((SIZE) > MODULE_BLOCK_SIZE(ID))) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } - -/**@brief Verifies the offset parameter provided by the application in API. - */ -#define OFFSET_CHECK(ID, OFFSET, SIZE) \ - if(((SIZE) + (OFFSET)) > MODULE_BLOCK_SIZE(ID)) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } - -#ifdef PSTORAGE_RAW_MODE_ENABLE - -/**@brief Verifies the module identifier supplied by the application. - */ -#define MODULE_RAW_HANDLE_CHECK(ID) \ - if ((((ID)->module_id) != RAW_MODE_APP_ID)) \ - { \ - return NRF_ERROR_INVALID_PARAM; \ - } - -#endif // PSTORAGE_RAW_MODE_ENABLE - -/**@} */ - - -/**@brief Verify module's initialization status. - * - * @details Verify module's initialization status. Returns NRF_ERROR_INVALID_STATE when a - * module API is called without initializing the module. - */ -#define VERIFY_MODULE_INITIALIZED() \ - do \ - { \ - if (!(m_flags & MASK_MODULE_INITIALIZED)) \ - { \ - return NRF_ERROR_INVALID_STATE; \ - } \ - } while(0) - -/**@brief Macro to fetch the block size registered for the module. */ -#define MODULE_BLOCK_SIZE(ID) (m_app_table[(ID)->module_id].block_size) - -/**@brief Main state machine of the component. */ -typedef enum -{ - STATE_IDLE, /**< State for being idle (no command execution in progress). */ - STATE_STORE, /**< State for storing data when using store/update API. */ - STATE_DATA_ERASE_WITH_SWAP, /**< State for erasing the data page when using update/clear API when use of swap page is required. */ - STATE_DATA_ERASE, /**< State for erasing the data page when using update/clear API without the need to use the swap page. */ - STATE_ERROR /**< State entered when command processing is terminated abnormally. */ -} pstorage_state_t; - -/**@brief Sub state machine contained by @ref STATE_DATA_ERASE_WITH_SWAP super state machine. */ -typedef enum -{ - STATE_ERASE_SWAP, /**< State for erasing the swap page when using the update/clear API. */ - STATE_WRITE_DATA_TO_SWAP, /**< State for writing the data page into the swap page when using update/clear API. */ - STATE_ERASE_DATA_PAGE, /**< State for erasing data page when using update/clear API. */ - STATE_RESTORE_TAIL, /**< State for restoring tail (end) of backed up data from swap to data page when using update/clear API. */ - STATE_RESTORE_HEAD, /**< State for restoring head (beginning) of backed up data from swap to data page when using update/clear API. */ - SWAP_SUB_STATE_MAX /**< Enumeration upper bound. */ -} flash_swap_sub_state_t; - -/**@brief Application registration information. - * - * @details Defines application specific information that the application needs to maintain to be able - * to process requests from each one of them. - */ -typedef struct -{ - pstorage_ntf_cb_t cb; /**< Callback registered with the module to be notified of result of flash access. */ - pstorage_block_t base_id; /**< Base block ID assigned to the module. */ - pstorage_size_t block_size; /**< Size of block for the module. */ - pstorage_size_t block_count; /**< Number of blocks requested by the application. */ -} pstorage_module_table_t; - - -#ifdef PSTORAGE_RAW_MODE_ENABLE -/**@brief Application registration information. - * - * @details Defines application specific information that the application registered for raw mode. - */ -typedef struct -{ - pstorage_ntf_cb_t cb; /**< Callback registered with the module to be notified of the result of flash access. */ -} pstorage_raw_module_table_t; -#endif // PSTORAGE_RAW_MODE_ENABLE - - -/**@brief Defines command queue element. - * - * @details Defines command queue element. Each element encapsulates needed information to process - * a flash access command. - */ -typedef struct -{ - uint8_t op_code; /**< Identifies the flash access operation being queued. Element is free if op-code is INVALID_OPCODE. */ - pstorage_size_t size; /**< Identifies the size in bytes requested for the operation. */ - pstorage_size_t offset; /**< Offset requested by the application for the access operation. */ - pstorage_handle_t storage_addr; /**< Address/Identifier for persistent memory. */ - uint8_t * p_data_addr; /**< Address/Identifier for data memory. This is assumed to be resident memory. */ -} cmd_queue_element_t; - - -/**@brief Defines command queue, an element is free if the op_code field is not invalid. - * - * @details Defines commands enqueued for flash access. At any point in time, this queue has one or - * more flash access operations pending if the count field is not zero. When the queue is - * not empty, the rp (read pointer) field points to the flash access command in progress - * or, if none is in progress, the command to be requested next. The queue implements a - * simple first in first out algorithm. Data addresses are assumed to be resident. - */ -typedef struct -{ - uint8_t rp; /**< Read pointer, pointing to flash access that is ongoing or to be requested next. */ - uint8_t count; /**< Number of elements in the queue. */ - cmd_queue_element_t cmd[PSTORAGE_CMD_QUEUE_SIZE]; /**< Array to maintain flash access operation details. */ -} cmd_queue_t; - -static cmd_queue_t m_cmd_queue; /**< Flash operation request queue. */ -static pstorage_size_t m_next_app_instance; /**< Points to the application module instance that can be allocated next. */ -static uint32_t m_next_page_addr; /**< Points to the flash address that can be allocated to a module next. This is needed as blocks of a module that can span across flash pages. */ -static pstorage_state_t m_state; /**< Main state tracking variable. */ -static flash_swap_sub_state_t m_swap_sub_state; /**< Flash swap erase when swap used state tracking variable. */ -static uint32_t m_head_word_size; /**< Head restore area size in words. */ -static uint32_t m_tail_word_size; /**< Tail restore area size in words. */ -static uint32_t m_current_page_id; /**< Variable for tracking the flash page being processed. */ -static uint32_t m_num_of_command_retries; /**< Variable for tracking flash operation retries upon flash operation failures. */ -static pstorage_module_table_t m_app_table[PSTORAGE_NUM_OF_PAGES]; /**< Registered application information table. */ -static uint32_t m_num_of_bytes_written; /**< Variable for tracking the number of bytes written by the store operation. */ -static uint32_t m_app_data_size; /**< Variable for storing the application command size parameter internally. */ -static uint32_t m_flags = 0; /**< Storage for boolean flags for state tracking. */ - -#ifdef PSTORAGE_RAW_MODE_ENABLE -static pstorage_raw_module_table_t m_raw_app_table; /**< Registered application information table for raw mode. */ -#endif // PSTORAGE_RAW_MODE_ENABLE - -// Required forward declarations. -static void cmd_process(void); -static void store_operation_execute(void); -static void app_notify(uint32_t result, cmd_queue_element_t * p_elem); -static void cmd_queue_element_init(uint32_t index); -static void cmd_queue_dequeue(void); -static void sm_state_change(pstorage_state_t new_state); -static void swap_sub_state_state_change(flash_swap_sub_state_t new_state); - -/**@brief Function for consuming a command queue element. - * - * @details Function for consuming a command queue element, which has been fully processed. - */ -static void command_queue_element_consume(void) -{ - // Initialize/free the element as it is now processed. - cmd_queue_element_init(m_cmd_queue.rp); - - // Adjust command queue state tracking variables. - --(m_cmd_queue.count); - if (++(m_cmd_queue.rp) == PSTORAGE_CMD_QUEUE_SIZE) - { - m_cmd_queue.rp = 0; - } -} - - -/**@brief Function for executing the finalization procedure for the command executed. - * - * @details Function for executing the finalization procedure for command executed, which includes - * notifying the application of command completion, consuming the command queue element, - * and changing the internal state. - */ -static void command_end_procedure_run(void) -{ - app_notify(NRF_SUCCESS, &m_cmd_queue.cmd[m_cmd_queue.rp]); - - command_queue_element_consume(); - - sm_state_change(STATE_IDLE); -} - - -/**@brief Function for idle state entry actions. - * - * @details Function for idle state entry actions, which include resetting relevant state data and - * scheduling any possible queued flash access operation. - */ -static void state_idle_entry_run(void) -{ - m_num_of_command_retries = 0; - m_num_of_bytes_written = 0; - - // Schedule any possible queued flash access operation. - cmd_queue_dequeue(); -} - - -/**@brief Function for notifying an application of command completion and transitioning to an error - * state. - * - * @param[in] result Result code of the operation for the application. - */ -static void app_notify_error_state_transit(uint32_t result) -{ - app_notify(result, &m_cmd_queue.cmd[m_cmd_queue.rp]); - sm_state_change(STATE_ERROR); -} - - -/**@brief Function for processing flash API error code. - * - * @param[in] err_code Error code from the flash API. - */ -static void flash_api_err_code_process(uint32_t err_code) -{ - switch (err_code) - { - case NRF_SUCCESS: - break; - - case NRF_ERROR_BUSY: - // Flash access operation was not accepted and must be reissued upon flash operation - // complete event. - m_flags |= MASK_FLASH_API_ERR_BUSY; - break; - - default: - // Complete the operation with appropriate result code and transit to an error state. - app_notify_error_state_transit(err_code); - break; - } -} - -/**@brief Function for writing data to flash. - * - * @param[in] p_dst Pointer to start of flash location to be written. - * @param[in] p_src Pointer to buffer with data to be written. - * @param[in] size_in_words Number of 32-bit words to write. - */ -static void flash_write(uint32_t * const p_dst, - uint32_t const * const p_src, - uint32_t size_in_words) -{ - flash_api_err_code_process(sd_flash_write(p_dst, p_src, size_in_words)); -} - - -/**@brief Function for writing data to flash upon store command. - * - * @details Function for writing data to flash upon executing store command. Data is written to - * flash in reverse order, meaning starting at the end. If the data that is to be written - * is greater than the flash page size, it will be fragmented to fit the flash page size. - */ -static void store_cmd_flash_write_execute(void) -{ - const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - - if (p_cmd->size > SOC_MAX_WRITE_SIZE) - { - const uint32_t offset = p_cmd->size - PSTORAGE_FLASH_PAGE_SIZE; - flash_write((uint32_t *)(p_cmd->storage_addr.block_id + p_cmd->offset + offset), - (uint32_t *)(p_cmd->p_data_addr + offset), - PSTORAGE_FLASH_PAGE_SIZE / sizeof(uint32_t)); - - m_num_of_bytes_written = PSTORAGE_FLASH_PAGE_SIZE; - } - else - { - flash_write((uint32_t *)(p_cmd->storage_addr.block_id + p_cmd->offset), - (uint32_t *)(p_cmd->p_data_addr), - p_cmd->size / sizeof(uint32_t)); - - m_num_of_bytes_written = p_cmd->size; - } -} - - -/**@brief Function for store state entry action. - * - * @details Function for store state entry action, which includes writing data to a flash page. - */ -static void state_store_entry_run(void) -{ - store_cmd_flash_write_execute(); -} - - -/**@brief Function for data erase with swap state entry actions. - * - * @details Function for data erase with swap state entry actions. This includes adjusting relevant - * state and data variables and transitioning to the correct sub state. - */ -static void state_data_erase_swap_entry_run(void) -{ - m_flags &= ~MASK_TAIL_SWAP_DONE; - - const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; - - const uint32_t clear_start_page_id = cmd_block_id / PSTORAGE_FLASH_PAGE_SIZE; - m_current_page_id = clear_start_page_id; - - // @note: No need to include p_cmd->offset when calculating clear_end_page_id as: - // - clear API does not include offset parameter - // - update and store APIs are limited to operate on single block boundary thus the boolean - // clause ((m_head_word_size == 0) && is_more_than_one_page) below in this function will never - // evaluate as true as if is_more_than_one_page == true m_head_word_size is always != 0 - const uint32_t clear_end_page_id = (cmd_block_id + p_cmd->size - 1u) / - PSTORAGE_FLASH_PAGE_SIZE; - - if (clear_start_page_id == clear_end_page_id) - { - m_flags |= MASK_SINGLE_PAGE_OPERATION; - } - else - { - m_flags &= ~MASK_SINGLE_PAGE_OPERATION; - } - - if ((m_head_word_size == 0) && !(m_flags & MASK_SINGLE_PAGE_OPERATION)) - { - // No head restore required and clear/update area is shared by multiple flash pages, which - // means the current flash page does not have any tail area to restore. You can proceed with - // data page erase directly as no swap is needed for the current flash page. - swap_sub_state_state_change(STATE_ERASE_DATA_PAGE); - } - else - { - swap_sub_state_state_change(STATE_ERASE_SWAP); - } -} - - -/**@brief Function for erasing flash page. - * - * @param[in] page_number Page number of the page to be erased. - */ -static void flash_page_erase(uint32_t page_number) -{ - flash_api_err_code_process(sd_flash_page_erase(page_number)); -} - - -/**@brief Function for data erase state entry action. - * - * @details Function for data erase state entry action, which includes erasing the data flash page. - */ -static void state_data_erase_entry_run(void) -{ - flash_page_erase(m_current_page_id); -} - - -/**@brief Function for dispatching the correct application main state entry action. - */ -static void state_entry_action_run(void) -{ - switch (m_state) - { - case STATE_IDLE: - state_idle_entry_run(); - break; - - case STATE_STORE: - state_store_entry_run(); - break; - - case STATE_DATA_ERASE_WITH_SWAP: - state_data_erase_swap_entry_run(); - break; - - case STATE_DATA_ERASE: - state_data_erase_entry_run(); - break; - - default: - // No action needed. - break; - } -} - - -/**@brief Function for changing application main state and dispatching state entry action. - * - * @param[in] new_state New application main state to transit to. - */ -static void sm_state_change(pstorage_state_t new_state) -{ - m_state = new_state; - state_entry_action_run(); -} - - -/**@brief Function for swap erase state entry action. - * - * @details Function for swap erase state entry action, which includes erasing swap flash - * page. - */ -static void state_swap_erase_entry_run(void) -{ - flash_page_erase(PSTORAGE_SWAP_ADDR / PSTORAGE_FLASH_PAGE_SIZE); -} - - -/**@brief Function for write data to the swap state entry action. - * - * @details Function for write data to the swap state entry action, which includes writing the - * current data page to the swap flash page. - */ -static void state_write_data_swap_entry_run(void) -{ - // @note: There is room for further optimization here as there is only need to write the - // whole flash page to swap area if there is both head and tail area to be restored. In any - // other case we can omit some data from the head or end of the page as that is the clear area. - flash_write((uint32_t *)(PSTORAGE_SWAP_ADDR), - (uint32_t *)(m_current_page_id * PSTORAGE_FLASH_PAGE_SIZE), - PSTORAGE_FLASH_PAGE_SIZE / sizeof(uint32_t)); -} - - -/**@brief Function for erase data page state entry action. - * - * @details Function for erase data page state entry action, which includes erasing the data flash - * page. - */ -static void state_erase_data_page_entry_run(void) -{ - flash_page_erase(m_current_page_id); -} - - -/**@brief Function for restore tail state entry action. - * - * @details Function for restore tail state entry action, which includes writing the tail section - * back from swap to the data page. - */ -static void state_restore_tail_entry_run(void) -{ - const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; - - const uint32_t tail_offset = (cmd_block_id + p_cmd->size + p_cmd->offset) % - PSTORAGE_FLASH_PAGE_SIZE; - - flash_write((uint32_t *)(cmd_block_id + p_cmd->size + p_cmd->offset), - (uint32_t *)(PSTORAGE_SWAP_ADDR + tail_offset), - m_tail_word_size); -} - - -/**@brief Function for restore head state entry action. - * - * @details Function for restore head state entry action, which includes writing the head section - * back from swap to the data page. - */ -static void state_restore_head_entry_run(void) -{ - flash_write((uint32_t *)((m_current_page_id - 1u) * PSTORAGE_FLASH_PAGE_SIZE), - (uint32_t *)PSTORAGE_SWAP_ADDR, - m_head_word_size); -} - - -/**@brief Function for dispatching the correct swap sub state entry action. - */ -static void swap_sub_state_entry_action_run(void) -{ - static void (* const swap_sub_state_sm_lut[SWAP_SUB_STATE_MAX])(void) = - { - state_swap_erase_entry_run, - state_write_data_swap_entry_run, - state_erase_data_page_entry_run, - state_restore_tail_entry_run, - state_restore_head_entry_run - }; - - swap_sub_state_sm_lut[m_swap_sub_state](); -} - - -/**@brief Function for changing the swap sub state and dispatching state entry action. - * - * @param[in] new_state New swap sub state to transit to. - */ -static void swap_sub_state_state_change(flash_swap_sub_state_t new_state) -{ - m_swap_sub_state = new_state; - swap_sub_state_entry_action_run(); -} - - -/**@brief Function for initializing the command queue element. - * - * @param[in] index Index of the element to be initialized. - */ -static void cmd_queue_element_init(uint32_t index) -{ - // Internal function and checks on range of index can be avoided. - m_cmd_queue.cmd[index].op_code = INVALID_OPCODE; - m_cmd_queue.cmd[index].size = 0; - m_cmd_queue.cmd[index].storage_addr.module_id = PSTORAGE_NUM_OF_PAGES; - m_cmd_queue.cmd[index].storage_addr.block_id = 0; - m_cmd_queue.cmd[index].p_data_addr = NULL; - m_cmd_queue.cmd[index].offset = 0; -} - - -/**@brief Function for initializing the command queue. - */ -static void cmd_queue_init(void) -{ - m_cmd_queue.rp = 0; - m_cmd_queue.count = 0; - - for (uint32_t cmd_index = 0; cmd_index < PSTORAGE_CMD_QUEUE_SIZE; ++cmd_index) - { - cmd_queue_element_init(cmd_index); - } -} - - -/**@brief Function for enqueuing, and possibly dispatching, a flash access operation. - * - * @param[in] opcode Identifies the operation requested to be enqueued. - * @param[in] p_storage_addr Identifies the module and flash address on which the operation is - * requested. - * @param[in] p_data_addr Identifies the data address for flash access. - * @param[in] size Size in bytes of data requested for the access operation. - * @param[in] offset Offset within the flash memory block at which operation is requested. - * - * @retval NRF_SUCCESS Upon success. - * @retval NRF_ERROR_NO_MEM Upon failure, when no space is available in the command queue. - */ -static uint32_t cmd_queue_enqueue(uint8_t opcode, - pstorage_handle_t * p_storage_addr, - uint8_t * p_data_addr, - pstorage_size_t size, - pstorage_size_t offset) -{ - uint32_t err_code; - - if (m_cmd_queue.count != PSTORAGE_CMD_QUEUE_SIZE) - { - // Enqueue the command if it the queue is not full. - uint32_t write_index = m_cmd_queue.rp + m_cmd_queue.count; - - if (write_index >= PSTORAGE_CMD_QUEUE_SIZE) - { - write_index -= PSTORAGE_CMD_QUEUE_SIZE; - } - - m_cmd_queue.cmd[write_index].op_code = opcode; - m_cmd_queue.cmd[write_index].p_data_addr = p_data_addr; - m_cmd_queue.cmd[write_index].storage_addr = (*p_storage_addr); - m_cmd_queue.cmd[write_index].size = size; - m_cmd_queue.cmd[write_index].offset = offset; - - m_cmd_queue.count++; - - if (m_state == STATE_IDLE) - { - cmd_process(); - } - - err_code = NRF_SUCCESS; - } - else - { - err_code = NRF_ERROR_NO_MEM; - } - - return err_code; -} - - -/**@brief Function for dequeing a possible pending flash access operation. - */ -static void cmd_queue_dequeue(void) -{ - if ((m_cmd_queue.count != 0)) - { - cmd_process(); - } -} - - -/**@brief Function for notifying an application of command completion. - * - * @param[in] result Result code of the operation for the application. - * @param[in] p_elem Pointer to the command queue element for which this result was received. - */ -static void app_notify(uint32_t result, cmd_queue_element_t * p_elem) -{ - pstorage_ntf_cb_t ntf_cb; - const uint8_t op_code = p_elem->op_code; - -#ifdef PSTORAGE_RAW_MODE_ENABLE - if (p_elem->storage_addr.module_id == RAW_MODE_APP_ID) - { - ntf_cb = m_raw_app_table.cb; - } - else -#endif // PSTORAGE_RAW_MODE_ENABLE - { - ntf_cb = m_app_table[p_elem->storage_addr.module_id].cb; - } - - ntf_cb(&p_elem->storage_addr, op_code, result, p_elem->p_data_addr, m_app_data_size); -} - - -/**@brief Function for evaluating if a data page swap is required for the tail section on the - * current page. - * - * @retval true If data page swap is required. - * @retval false If data page swap is not required. - */ -static bool is_tail_data_page_swap_required(void) -{ - bool ret_value; - - // Extract id of the last page command is executed upon. - const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; - const uint32_t last_page_id = (cmd_block_id + p_cmd->size + p_cmd->offset - 1u) / - PSTORAGE_FLASH_PAGE_SIZE; - - // If tail section area exists and the current page is the last page then tail data page swap is - // required. - if ((m_tail_word_size != 0) && (m_current_page_id == last_page_id)) - { - ret_value = true; - } - else - { - ret_value = false; - } - - return ret_value; -} - - -/**@brief Function for performing post processing for the update and clear commands. - * - * @details Function for performing post processing for the update and clear commands, which implies - * executing the correct execution path depending on the command. - */ -static void clear_post_processing_run(void) -{ - const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - - if (p_cmd->op_code != PSTORAGE_UPDATE_OP_CODE) - { - command_end_procedure_run(); - } - else - { - store_operation_execute(); - } -} - - -/**@brief Function for doing swap sub state exit action. - */ -static void swap_sub_sm_exit_action_run(void) -{ - clear_post_processing_run(); -} - - -/**@brief Function for evaluating if the page erase operation is required for the current page. - * - * @retval true If page erase is required. - * @retval false If page erase is not required. - */ -static bool is_page_erase_required(void) -{ - bool ret; - - const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; - const uint32_t id_last_page_to_be_cleared = (cmd_block_id + p_cmd->size + - p_cmd->offset - 1u) / - PSTORAGE_FLASH_PAGE_SIZE; - - // True if: - // - current page is not the last page OR - // - current page is the last page AND no tail exists - if ((m_current_page_id < id_last_page_to_be_cleared) || - ((m_current_page_id == id_last_page_to_be_cleared) && (m_tail_word_size == 0))) - { - ret = true; - } - else - { - ret = false; - } - - return ret; -} - - -/**@brief Function for reissuing the last flash operation request, which was rejected by the flash - * API, in swap sub sate. - */ -static void swap_sub_state_err_busy_process(void) -{ - // Reissue the request by doing a self transition to the current state. - m_flags &= ~MASK_FLASH_API_ERR_BUSY; - swap_sub_state_state_change(m_swap_sub_state); -} - - -/**@brief Function for doing restore head state action upon flash operation success event. - * - * @details Function for doing restore head state action upon flash operation success event, which - * includes making a state transition depending on the current state. - */ -static void head_restore_state_run(void) -{ - if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) - { - if (is_tail_data_page_swap_required()) - { - // Additional data page needs to be swapped for tail section as we are clearing a block, - // which is shared between 2 flash pages. - - // Adjust variables to ensure correct state transition path is taken after the tail - // section swap has completed. - m_head_word_size = 0; - m_flags |= MASK_TAIL_SWAP_DONE; - - swap_sub_state_state_change(STATE_ERASE_SWAP); - } - else if (is_page_erase_required()) - { - // Additional page erase operation is required. - - // Adjust variable to ensure correct state transition path is taken after the additional - // page erase operation has completed. - m_head_word_size = 0; - swap_sub_state_state_change(STATE_ERASE_DATA_PAGE); - } - else if (m_tail_word_size != 0) - { - // Proceed with restoring tail from swap to data page. - swap_sub_state_state_change(STATE_RESTORE_TAIL); - } - else - { - // Swap statemachine execution end reached. - swap_sub_sm_exit_action_run(); - } - } - else - { - // As operation request was rejected by the flash API reissue the request. - swap_sub_state_err_busy_process(); - } -} - - -/**@brief Function for doing restore tail state action upon flash operation success event. - */ -static void tail_restore_state_run(void) -{ - if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) - { - swap_sub_sm_exit_action_run(); - } - else - { - // As operation request was rejected by the flash API reissue the request. - swap_sub_state_err_busy_process(); - } -} - - -/**@brief Function for doing data page erase state action upon a flash operation success event. - * - * @details Function for doing data page erase state action upon a flash operation success event, - * which includes making a state transit to a new state depending on the current state. - */ -static void data_page_erase_state_run(void) -{ - if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) - { - ++m_current_page_id; - - if (m_head_word_size != 0) - { - swap_sub_state_state_change(STATE_RESTORE_HEAD); - } - else if (is_page_erase_required()) - { - // Additional page erase operation is required. - swap_sub_state_state_change(STATE_ERASE_DATA_PAGE); - } - else if (m_tail_word_size != 0) - { - if (!(m_flags & MASK_TAIL_SWAP_DONE)) - { - // Tail area restore is required and we have not yet written the relevant data page - // to swap area. Start the process of writing the data page to swap. - m_flags |= MASK_TAIL_SWAP_DONE; - - swap_sub_state_state_change(STATE_ERASE_SWAP); - } - else - { - // Tail area restore is required and we have already written the relevant data page - // to swap area. Proceed by restoring the tail area. - swap_sub_state_state_change(STATE_RESTORE_TAIL); - } - } - else - { - swap_sub_sm_exit_action_run(); - } - } - else - { - // As operation request was rejected by the flash API reissue the request. - swap_sub_state_err_busy_process(); - } -} - - -/**@brief Function for doing data to swap write state action upon flash operation success event. - */ -static void data_to_swap_write_state_run(void) -{ - if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) - { - // If the operation is executed only on 1 single flash page it automatically means that tail - // area is written to the swap, which we store to flags. - if (m_flags & MASK_SINGLE_PAGE_OPERATION) - { - m_flags |= MASK_TAIL_SWAP_DONE; - } - - swap_sub_state_state_change(STATE_ERASE_DATA_PAGE); - } - else - { - // As operation request was rejected by the flash API reissue the request. - swap_sub_state_err_busy_process(); - } -} - - -/**@brief Function for doing swap erase state action upon flash operation success event. - */ -static void swap_erase_state_run(void) -{ - if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) - { - swap_sub_state_state_change(STATE_WRITE_DATA_TO_SWAP); - } - else - { - // As operation request was rejected by the flash API reissue the request. - swap_sub_state_err_busy_process(); - } -} - - -/**@brief Function for dispatching the correct state action for data erase with a swap composite -* state upon a flash operation success event. - */ -static void swap_sub_state_sm_run(void) -{ - static void (* const swap_sub_state_sm_lut[SWAP_SUB_STATE_MAX])(void) = - { - swap_erase_state_run, - data_to_swap_write_state_run, - data_page_erase_state_run, - tail_restore_state_run, - head_restore_state_run - }; - - swap_sub_state_sm_lut[m_swap_sub_state](); -} - - -/**@brief Function for reissuing the last flash operation request, which was rejected by the flash - * API, in main sate. - */ -static void main_state_err_busy_process(void) -{ - // Reissue the request by doing a self transition to the current state. - m_flags &= ~MASK_FLASH_API_ERR_BUSY; - sm_state_change(m_state); -} - - -/**@brief Function for doing erase state action upon flash operation success event. - * - * @details Function for doing erase state action upon flash operation success event, which includes - * making a state transition depending on the current state. - */ -static void erase_sub_state_sm_run(void) -{ - if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) - { - // Clear operation request has succeeded. - ++m_current_page_id; - - if (!is_page_erase_required()) - { - clear_post_processing_run(); - } - else - { - // All required flash pages have not yet been erased, issue erase by doing a self - // transit. - sm_state_change(m_state); - } - } - else - { - // As operation request was rejected by the flash API reissue the request. - main_state_err_busy_process(); - } -} - - -/**@brief Function for doing store state action upon flash operation success event. - */ -static void store_sub_state_sm_run(void) -{ - if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) - { - // As write operation request has succeeded, adjust the size tracking state information - // accordingly. - cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - p_cmd->size -= m_num_of_bytes_written; - - if (p_cmd->size == 0) - { - command_end_procedure_run(); - } - else - { - store_cmd_flash_write_execute(); - } - } - else - { - // As operation request was rejected by the flash API reissue the request. - main_state_err_busy_process(); - } -} - - -/**@brief Function for doing action upon flash operation success event. - */ -static void flash_operation_success_run(void) -{ - switch (m_state) - { - case STATE_STORE: - store_sub_state_sm_run(); - break; - - case STATE_DATA_ERASE: - erase_sub_state_sm_run(); - break; - - case STATE_DATA_ERASE_WITH_SWAP: - swap_sub_state_sm_run(); - break; - - default: - // No implementation needed. - break; - } -} - - -/**@brief Function for doing action upon flash operation failure event. - * - * @details Function for doing action upon flash operation failure event, which includes retrying - * the last operation or if retry count has been reached completing the operation with - * appropriate result code and transitioning to an error state. - * - * @note The command is not removed from the command queue, which will result to stalling of the - * command pipeline and the appropriate application recovery procedure for this is to reset - * the system by issuing @ref pstorage_init which will also result to flushing of the - * command queue. - */ -static void flash_operation_failure_run(void) -{ - if (++m_num_of_command_retries != SD_CMD_MAX_TRIES) - { - // Retry the last operation by doing a self transition to the current state. - - if (m_state != STATE_DATA_ERASE_WITH_SWAP) - { - sm_state_change(m_state); - } - else - { - swap_sub_state_state_change(m_swap_sub_state); - } - } - else - { - // Complete the operation with appropriate result code and transit to an error state. - app_notify_error_state_transit(NRF_ERROR_TIMEOUT); - } -} - - -/**@brief Function for handling flash access result events. - * - * @param[in] sys_evt System event to be handled. - */ -void pstorage_sys_event_handler(uint32_t sys_evt) -{ - if (m_state != STATE_IDLE && m_state != STATE_ERROR) - { - switch (sys_evt) - { - case NRF_EVT_FLASH_OPERATION_SUCCESS: - flash_operation_success_run(); - break; - - case NRF_EVT_FLASH_OPERATION_ERROR: - if (!(m_flags & MASK_FLASH_API_ERR_BUSY)) - { - flash_operation_failure_run(); - } - else - { - // As our last flash operation request was rejected by the flash API reissue the - // request by doing same code execution path as for flash operation sucess - // event. This will promote code reuse in the implementation. - flash_operation_success_run(); - } - break; - - default: - // No implementation needed. - break; - } - - } -} - - -/**@brief Function for calculating the tail area size in number of 32-bit words. - * - * @param[in] cmd_end_of_storage_address End of storage area within the scope of the command. - * @param[in] end_of_storage_address End of allocated storage area for the application. - */ -static void tail_word_size_calculate(pstorage_size_t cmd_end_of_storage_address, - pstorage_size_t end_of_storage_address) -{ - // Two different cases to resolve when calculating correct size for restore tail section: - // 1) End of storage area and command end area are in the same page. - // 2) End of storage area and command end area are not in the same page. - - const uint32_t end_of_storage_area_page = end_of_storage_address / - PSTORAGE_FLASH_PAGE_SIZE; - const uint32_t command_end_of_storage_area_page = cmd_end_of_storage_address / - PSTORAGE_FLASH_PAGE_SIZE; - - if (end_of_storage_area_page == command_end_of_storage_area_page) - { - //lint -e{573} suppress "Signed-unsigned mix with divide". - m_tail_word_size = (end_of_storage_address - cmd_end_of_storage_address) / sizeof(uint32_t); - } - else - { - //lint -e{573} suppress "Signed-unsigned mix with divide". - m_tail_word_size = (PSTORAGE_FLASH_PAGE_SIZE - - (cmd_end_of_storage_address % PSTORAGE_FLASH_PAGE_SIZE)) / - sizeof(uint32_t); - } -} - - -/**@brief Function for executing the clear operation. - */ -static void clear_operation_execute(void) -{ - const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; - - const pstorage_size_t block_size = m_app_table[p_cmd->storage_addr.module_id].block_size; - const pstorage_size_t block_count = m_app_table[p_cmd->storage_addr.module_id].block_count; - const pstorage_block_t block_base_id = m_app_table[p_cmd->storage_addr.module_id].base_id; - - const bool is_start_address_page_aligned = (cmd_block_id % PSTORAGE_FLASH_PAGE_SIZE) == 0; - - // Calculate the end (1 beyond allocated area) for complete storage area and to the area only - // within scope of this command. - const pstorage_block_t end_of_storage_address = block_base_id + (block_size * block_count); - const pstorage_block_t cmd_end_of_storage_address = cmd_block_id + p_cmd->size + p_cmd->offset; - - // Zero tail to make sure no extra erase is done erroneously. - m_tail_word_size = 0; - - // If the following is true no swap access is needed: - // - 1st logical test covers the case of: clear/update 1 complete single page. - // - 2nd logical test covers the case of: - // 1) Clear/update last allocated page and page is not full (page can't be shared between - // multiple clients so the end of the page is unused area). - // 2) Clear/update all allocated storage. - if ((is_start_address_page_aligned && (p_cmd->size == PSTORAGE_FLASH_PAGE_SIZE)) || - (is_start_address_page_aligned && (cmd_end_of_storage_address == end_of_storage_address) && - (p_cmd->offset == 0)) || (p_cmd->storage_addr.module_id == RAW_MODE_APP_ID)) - { - // Nothing to put to the swap and we can just erase the pages(s). - - m_current_page_id = cmd_block_id / PSTORAGE_FLASH_PAGE_SIZE; - - sm_state_change(STATE_DATA_ERASE); - } - else - { - // Not all the blocks for the module can be cleared, we need to use swap page for storing - // data temporarily. - - m_head_word_size = ((cmd_block_id + p_cmd->offset) % PSTORAGE_FLASH_PAGE_SIZE) / - sizeof(uint32_t); - - const bool is_cmd_end_address_page_aligned = ((cmd_end_of_storage_address % - PSTORAGE_FLASH_PAGE_SIZE) == 0); - if ((cmd_end_of_storage_address != end_of_storage_address) && - !is_cmd_end_address_page_aligned) - { - // When command area is not equal to end of the storage allocation area and not ending - // to page boundary there is a need to restore the tail area. - tail_word_size_calculate(cmd_end_of_storage_address, end_of_storage_address); - } - - sm_state_change(STATE_DATA_ERASE_WITH_SWAP); - } -} - - -/**@brief Function for executing the store operation. - */ -static void store_operation_execute(void) -{ - sm_state_change(STATE_STORE); -} - - -/**@brief Function for executing the update operation. - */ -static void update_operation_execute(void) -{ - clear_operation_execute(); -} - - -/**@brief Function for dispatching the flash access operation. - */ -static void cmd_process(void) -{ - const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; - m_app_data_size = p_cmd->size; - - switch (p_cmd->op_code) - { - case PSTORAGE_STORE_OP_CODE: - store_operation_execute(); - break; - - case PSTORAGE_CLEAR_OP_CODE: - clear_operation_execute(); - break; - - case PSTORAGE_UPDATE_OP_CODE: - update_operation_execute(); - break; - - default: - // No action required. - break; - } -} - - -uint32_t pstorage_init(void) -{ - cmd_queue_init(); - - m_next_app_instance = 0; - m_next_page_addr = PSTORAGE_DATA_START_ADDR; - m_current_page_id = 0; - - for (uint32_t index = 0; index < PSTORAGE_NUM_OF_PAGES; index++) - { - m_app_table[index].cb = NULL; - m_app_table[index].block_size = 0; - m_app_table[index].block_count = 0; - } - -#ifdef PSTORAGE_RAW_MODE_ENABLE - m_raw_app_table.cb = NULL; -#endif //PSTORAGE_RAW_MODE_ENABLE - - m_state = STATE_IDLE; - m_num_of_command_retries = 0; - m_flags = 0; - m_num_of_bytes_written = 0; - m_flags |= MASK_MODULE_INITIALIZED; - - return NRF_SUCCESS; -} - - -uint32_t pstorage_register(pstorage_module_param_t * p_module_param, - pstorage_handle_t * p_block_id) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_module_param); - NULL_PARAM_CHECK(p_block_id); - NULL_PARAM_CHECK(p_module_param->cb); - BLOCK_SIZE_CHECK(p_module_param->block_size); - BLOCK_COUNT_CHECK(p_module_param->block_count, p_module_param->block_size); - - if (!((p_module_param->block_size % sizeof(uint32_t)) == 0)) - { - return NRF_ERROR_INVALID_PARAM; - } - - if (m_next_app_instance == PSTORAGE_NUM_OF_PAGES) - { - return NRF_ERROR_NO_MEM; - } - - p_block_id->module_id = m_next_app_instance; - p_block_id->block_id = m_next_page_addr; - - m_app_table[m_next_app_instance].base_id = p_block_id->block_id; - m_app_table[m_next_app_instance].cb = p_module_param->cb; - m_app_table[m_next_app_instance].block_size = p_module_param->block_size; - m_app_table[m_next_app_instance].block_count = p_module_param->block_count; - - // Calculate number of flash pages allocated for the device and adjust next free page address. - /*lint -save -e666 */ - const uint32_t page_count = CEIL_DIV((p_module_param->block_size * p_module_param->block_count), - PSTORAGE_FLASH_PAGE_SIZE); - /*lint -restore */ - m_next_page_addr += page_count * PSTORAGE_FLASH_PAGE_SIZE; - - ++m_next_app_instance; - - return NRF_SUCCESS; -} - - -uint32_t pstorage_block_identifier_get(pstorage_handle_t * p_base_id, - pstorage_size_t block_num, - pstorage_handle_t * p_block_id) -{ - pstorage_handle_t temp_id; - - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_base_id); - NULL_PARAM_CHECK(p_block_id); - MODULE_ID_RANGE_CHECK(p_base_id); - - temp_id = (*p_base_id); - temp_id.block_id += (block_num * MODULE_BLOCK_SIZE(p_base_id)); - - BLOCK_ID_RANGE_CHECK(&temp_id); - - (*p_block_id) = temp_id; - - return NRF_SUCCESS; -} - - -uint32_t pstorage_store(pstorage_handle_t * p_dest, - uint8_t * p_src, - pstorage_size_t size, - pstorage_size_t offset) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_src); - NULL_PARAM_CHECK(p_dest); - MODULE_ID_RANGE_CHECK(p_dest); - BLOCK_ID_RANGE_CHECK(p_dest); - SIZE_CHECK(p_dest, size); - OFFSET_CHECK(p_dest, offset, size); - - if ((!is_word_aligned(p_src)) || - (!is_word_aligned((void *)(uint32_t)offset)) || - (!is_word_aligned((uint32_t *)p_dest->block_id))) - { - return NRF_ERROR_INVALID_ADDR; - } - - return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset); -} - - -uint32_t pstorage_update(pstorage_handle_t * p_dest, - uint8_t * p_src, - pstorage_size_t size, - pstorage_size_t offset) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_src); - NULL_PARAM_CHECK(p_dest); - MODULE_ID_RANGE_CHECK(p_dest); - BLOCK_ID_RANGE_CHECK(p_dest); - SIZE_CHECK(p_dest, size); - OFFSET_CHECK(p_dest, offset, size); - - if ((!is_word_aligned(p_src)) || - (!is_word_aligned((void *)(uint32_t)offset)) || - (!is_word_aligned((uint32_t *)p_dest->block_id))) - { - return NRF_ERROR_INVALID_ADDR; - } - - return cmd_queue_enqueue(PSTORAGE_UPDATE_OP_CODE, p_dest, p_src, size, offset); -} - - -uint32_t pstorage_load(uint8_t * p_dest, - pstorage_handle_t * p_src, - pstorage_size_t size, - pstorage_size_t offset) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_src); - NULL_PARAM_CHECK(p_dest); - MODULE_ID_RANGE_CHECK(p_src); - BLOCK_ID_RANGE_CHECK(p_src); - SIZE_CHECK(p_src, size); - OFFSET_CHECK(p_src, offset, size); - - if ((!is_word_aligned(p_dest)) || - (!is_word_aligned((void *)(uint32_t)offset)) || - (!is_word_aligned((uint32_t *)p_src->block_id))) - { - return NRF_ERROR_INVALID_ADDR; - } - - memcpy(p_dest, (((uint8_t *)p_src->block_id) + offset), size); - - m_app_table[p_src->module_id].cb(p_src, PSTORAGE_LOAD_OP_CODE, NRF_SUCCESS, p_dest, size); - - return NRF_SUCCESS; -} - - -uint32_t pstorage_clear(pstorage_handle_t * p_dest, pstorage_size_t size) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_dest); - MODULE_ID_RANGE_CHECK(p_dest); - BLOCK_ID_RANGE_CHECK(p_dest); - - if ((!is_word_aligned((uint32_t *)p_dest->block_id))) - { - return NRF_ERROR_INVALID_ADDR; - } - - // Check is the area starting from block_id multiple of block_size. - if ( - !( - ((p_dest->block_id - m_app_table[p_dest->module_id].base_id) % - m_app_table[p_dest->module_id].block_size) == 0 - ) - ) - { - return NRF_ERROR_INVALID_PARAM; - } - - // Check is requested size multiple of registered block size or 0. - if (((size % m_app_table[p_dest->module_id].block_size) != 0) || (size == 0)) - { - return NRF_ERROR_INVALID_PARAM; - } - - const uint32_t registered_allocation_size = m_app_table[p_dest->module_id].block_size * - m_app_table[p_dest->module_id].block_count; - - const pstorage_block_t clear_request_end_address = p_dest->block_id + size; - const pstorage_block_t allocation_end_address = m_app_table[p_dest->module_id].base_id + - registered_allocation_size; - // Check if request would lead to a buffer overrun. - if (clear_request_end_address > allocation_end_address) - { - return NRF_ERROR_INVALID_PARAM; - } - - return cmd_queue_enqueue(PSTORAGE_CLEAR_OP_CODE, p_dest, NULL, size, 0); -} - - -uint32_t pstorage_access_status_get(uint32_t * p_count) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_count); - - (*p_count) = m_cmd_queue.count; - - return NRF_SUCCESS; -} - -#ifdef PSTORAGE_RAW_MODE_ENABLE - -uint32_t pstorage_raw_register(pstorage_module_param_t * p_module_param, - pstorage_handle_t * p_block_id) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_module_param); - NULL_PARAM_CHECK(p_block_id); - NULL_PARAM_CHECK(p_module_param->cb); - - if (m_raw_app_table.cb != NULL) - { - return NRF_ERROR_NO_MEM; - } - - p_block_id->module_id = RAW_MODE_APP_ID; - m_raw_app_table.cb = p_module_param->cb; - - return NRF_SUCCESS; -} - - -uint32_t pstorage_raw_store(pstorage_handle_t * p_dest, - uint8_t * p_src, - pstorage_size_t size, - pstorage_size_t offset) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_src); - NULL_PARAM_CHECK(p_dest); - MODULE_RAW_HANDLE_CHECK(p_dest); - - if (size == 0) - { - return NRF_ERROR_INVALID_PARAM; - } - - // Verify word alignment. - if ((!is_word_aligned(p_src)) || - (!is_word_aligned((void *)(uint32_t)size)) || - (!is_word_aligned((void *)(uint32_t)offset)) || - (!is_word_aligned((void *)(p_dest->block_id)))) - { - return NRF_ERROR_INVALID_ADDR; - } - - return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset); -} - - -uint32_t pstorage_raw_clear(pstorage_handle_t * p_dest, pstorage_size_t size) -{ - VERIFY_MODULE_INITIALIZED(); - NULL_PARAM_CHECK(p_dest); - MODULE_RAW_HANDLE_CHECK(p_dest); - - if ((!is_word_aligned((uint32_t *)p_dest->block_id))) - { - return NRF_ERROR_INVALID_ADDR; - } - - return cmd_queue_enqueue(PSTORAGE_CLEAR_OP_CODE, p_dest, NULL, size, 0); -} - -#endif // PSTORAGE_RAW_MODE_ENABLE diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.h deleted file mode 100644 index 0a5884cd52..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pstorage/pstorage.h +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup persistent_storage Persistent Storage Interface - * @{ - * @ingroup app_common - * @brief Abstracted flash interface. - * - * @details An abstracted interface is provided by the module to easily port the application and - * SDK modules to an alternate option. This ensures that the SDK and application are moved - * to alternate persistent storage instead of the one provided by default. - */ - -#ifndef PSTORAGE_H__ -#define PSTORAGE_H__ - -#include "pstorage_platform.h" - - -/**@defgroup ps_opcode Persistent Storage Access Operation Codes - * @{ - * @brief Persistent Storage Access Operation Codes. - * - * @details Persistent Storage Access Operation Codes are used by Persistent storage operation - * completion callback @ref pstorage_ntf_cb_t to identify the operation type requested by - * the application. - */ -#define PSTORAGE_STORE_OP_CODE 0x01 /**< Store Operation type. */ -#define PSTORAGE_LOAD_OP_CODE 0x02 /**< Load Operation type. */ -#define PSTORAGE_CLEAR_OP_CODE 0x03 /**< Clear Operation type. */ -#define PSTORAGE_UPDATE_OP_CODE 0x04 /**< Update Operation type. */ - -/**@} */ - -/**@defgroup pstorage_data_types Persistent Memory Interface Data Types - * @{ - * @brief Data Types needed for interfacing with persistent memory. - * - * @details Data Types needed for interfacing with persistent memory. - */ - -/**@brief Persistent storage operation completion callback function type. - * - * @details The persistent storage operation completion callback is used by the interface to report - * success or failure of a flash operation. Since data is not copied for a store operation, - * a callback is an indication that the resident memory can now be reused or freed. - * - * @param[in] handle Identifies the module and block for the callback that is received. - * @param[in] op_code Identifies the operation for the event that is notified. - * @param[in] result Identifies the result of a flash access operation. NRF_SUCCESS implies - * operation succeeded. - * - * @note Unmanaged (abnormal behaviour) error codes from the SoftDevice flash - * access API are forwarded as is and are expected to be handled by the - * application. For details refer to the implementation file and corresponding - * SoftDevice flash API documentation. - * - * @param[in] p_data Identifies the application data pointer. For a store operation, this points - * to the resident source of application memory that the application can now - * free or reuse. When there is a clear operation, this is NULL since no - * application pointer is needed for this operation. - * @param[in] data_len Length data the application provided for the operation. - */ -typedef void (*pstorage_ntf_cb_t)(pstorage_handle_t * p_handle, - uint8_t op_code, - uint32_t result, - uint8_t * p_data, - uint32_t data_len); - -/**@brief Struct containing module registration context. */ -typedef struct -{ - pstorage_ntf_cb_t cb; /**< Persistent storage operation completion callback function @ref pstorage_ntf_cb_t. */ - pstorage_size_t block_size; /**< Desired block size for persistent memory storage. For example, if a module has a table with 10 entries, and each entry is 64 bytes in size, - * it can request 10 blocks with a block size of 64 bytes. The module can also request one block that is 640 bytes depending - * on how it would like to access or alter the memory in persistent memory. - * The first option is preferred when it is a single entry that needs to be updated often and doesn't impact the other entries. - * The second option is preferred when table entries are not changed individually but have a common point of loading and storing - * data. */ - pstorage_size_t block_count; /** Number of blocks requested by the module; minimum values is 1. */ -} pstorage_module_param_t; - -/**@} */ - -/**@defgroup pstorage_routines Persistent Storage Access Routines - * @{ - * @brief Functions/Interface SDK modules used to persistently store data. - * - * @details Interface for the Application and SDK modules to load/store information persistently. - * Note: While implementation of each of the persistent storage access functions - * depends on the system and is specific to system/solution, the signature of the - * interface routines should not be altered. - */ - -/**@brief Function for initializing the module. - * - * @details Function for initializing the module. This function is called once before any other APIs - * of the module are used. - * - * @retval NRF_SUCCESS Operation success. - */ -uint32_t pstorage_init(void); - -/**@brief Function for registering with persistent storage interface. - * - * @param[in] p_module_param Module registration parameter. - * @param[out] p_block_id Block identifier to identify persistent memory blocks when - * registration succeeds. Application is expected to use the block IDs - * for subsequent operations on requested persistent memory. Maximum - * registrations permitted is determined by the configuration of the - * parameter PSTORAGE_NUM_OF_PAGES. If more than one memory block is - * requested, the identifier provided here is the base identifier for the - * first block and used to identify the subsequent block. The application - * uses \@ref pstorage_block_identifier_get with this base identifier and - * block number. Therefore if 10 blocks of size 64 are requested and the - * application wishes to store memory in the 6th block, it shall use - * \@ref pstorage_block_identifier_get with the base ID and provide a - * block number of 5. This way the application is only expected to - * remember the base block identifier. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - * @retval NRF_ERROR_NO_MEM Operation failure. Additional registrations can't be - * supported. - */ -uint32_t pstorage_register(pstorage_module_param_t * p_module_param, - pstorage_handle_t * p_block_id); - -/**@brief Function for getting block ID with reference to base block identifier provided at the time - * of registration. - * - * @details Function to get the block ID with reference to base block identifier provided at the - * time of registration. - * If more than one memory block was requested when registering, the identifier provided - * here is the base identifier for the first block which is used to identify subsequent - * blocks. The application shall use this routine to get the block identifier, providing - * input as base identifier and block number. Therefore, if 10 blocks of size 64 are - * requested and the application wishes to store memory in the 6th block, it shall use - * \@ref pstorage_block_identifier_get with the base ID and provide a block number of 5. - * This way the application is only expected to remember the base block identifier. - * - * @param[in] p_base_id Base block ID received at the time of registration. - * @param[in] block_num Block Number, with first block numbered zero. - * @param[out] p_block_id Block identifier for the block number requested when the API succeeds. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - */ -uint32_t pstorage_block_identifier_get(pstorage_handle_t * p_base_id, - pstorage_size_t block_num, - pstorage_handle_t * p_block_id); - -/**@brief Function for persistently storing data of length 'size' contained in the 'p_src' address - * in the storage module at 'p_dest' address. Equivalent to Storage Write. - * - * @param[in] p_dest Destination address where data is to be stored persistently. - * @param[in] p_src Source address containing data to be stored. API assumes this to be resident - * memory and no intermediate copy of data is made by the API. Must be word - * aligned. - * @param[in] size Size of data to be stored expressed in bytes. Must be word aligned and size + - * offset must be <= block size. - * @param[in] offset Offset in bytes to be applied when writing to the block. - * For example, if within a block of 100 bytes, the application wishes to - * write 20 bytes at an offset of 12, then this field should be set to 12. - * Must be word aligned. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. - * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. - * - * @warning No copy of the data is made, meaning memory provided for the data source that is to - * be written to flash cannot be freed or reused by the application until this procedure - * is complete. The application is notified when the procedure is finished using the - * notification callback registered by the application. - */ -uint32_t pstorage_store(pstorage_handle_t * p_dest, - uint8_t * p_src, - pstorage_size_t size, - pstorage_size_t offset); - -/**@brief Function for updating persistently stored data of length 'size' contained in the 'p_src' - * address in the storage module at 'p_dest' address. - * - * @param[in] p_dest Destination address where data is to be updated. - * @param[in] p_src Source address containing data to be stored. API assumes this to be resident - * memory and no intermediate copy of data is made by the API. - * @param[in] size Size of data to be stored expressed in bytes. Must be word aligned and size + - * offset must be <= block size. - * @param[in] offset Offset in bytes to be applied when writing to the block. - * For example, if within a block of 100 bytes, the application wishes to - * write 20 bytes at an offset of 12 bytes, then this field should be set to 12. - * Must be word aligned. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. - * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. - * - * @warning No copy of the data is made, meaning memory provided for the data source that is to - * be written to flash cannot be freed or reused by the application until this procedure - * is complete. The application is notified when the procedure is finished using the - * notification callback registered by the application. - */ -uint32_t pstorage_update(pstorage_handle_t * p_dest, - uint8_t * p_src, - pstorage_size_t size, - pstorage_size_t offset); - -/**@brief Function for loading persistently stored data of length 'size' from 'p_src' address - * to 'p_dest' address. Equivalent to Storage Read. - * - * @param[in] p_dest Destination address where persistently stored data is to be loaded. - * @param[in] p_src Source where data is loaded from persistent memory. - * @param[in] size Size of data to be loaded from persistent memory expressed in bytes. - * Should be word aligned. - * @param[in] offset Offset in bytes, to be applied when loading from the block. - * For example, if within a block of 100 bytes, the application wishes to - * load 20 bytes from offset of 12 bytes, then this field should be set to 12. - * Should be word aligned. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. - * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. - */ -uint32_t pstorage_load(uint8_t * p_dest, - pstorage_handle_t * p_src, - pstorage_size_t size, - pstorage_size_t offset); - -/**@brief Function for clearing data in persistent memory. - * - * @param[in] p_base_id Base block identifier in persistent memory that needs to be cleared; - * equivalent to an Erase Operation. - * @param[in] size Size of data to be cleared from persistent memory expressed in bytes. - * This parameter is to provision for clearing of certain blocks - * of memory, or all memory blocks in a registered module. If the total size - * of the application module is used (blocks * block size) in combination with - * the identifier for the first block in the module, all blocks in the - * module will be erased. Must be multiple of block size. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. - * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. - * - * @note Clear operations may take time. This API however, does not block until the clear - * procedure is complete. The application is notified of procedure completion using - * a notification callback registered by the application. The 'result' parameter of the - * callback indicates if the procedure was successful or not. - */ -uint32_t pstorage_clear(pstorage_handle_t * p_base_id, pstorage_size_t size); - -/**@brief Function for getting the number of pending operations with the module. - * - * @param[out] p_count Number of storage operations pending with the module. If 0, there are no - * outstanding requests. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - */ -uint32_t pstorage_access_status_get(uint32_t * p_count); - -#ifdef PSTORAGE_RAW_MODE_ENABLE - -/**@brief Function for registering with the persistent storage interface. - * - * @param[in] p_module_param Module registration parameter. - * @param[out] p_block_id Block identifier used to identify persistent memory blocks upon - * successful registration. The application is expected to use the block - * IDs for subsequent operations on requested persistent memory. When - * more than one memory block is requested, this identifier is the base - * identifier for the first block and used to identify subsequent blocks. - * The application shall use \@ref pstorage_block_identifier_get with - * this base identifier and block number. Therefore if 10 blocks of size - * 64 are requested and the application wishes to store memory in the 6th - * block, it shall use \@ref pstorage_block_identifier_get with the base - * ID and provide a block number of 5. Therefore, the application is only - * expected to remember the base block identifier. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. - */ -uint32_t pstorage_raw_register(pstorage_module_param_t * p_module_param, - pstorage_handle_t * p_block_id); - -/**@brief Function for persistently storing data of length 'size' contained in 'p_src' address in - * storage module at 'p_dest' address. Equivalent to Storage Write. - * - * @param[in] p_dest Destination address where data is to be stored persistently. - * @param[in] p_src Source address containing data to be stored. The API assumes this is resident - * memory and no intermediate copy of data is made by the API. Must be word - * aligned. - * @param[in] size Size of data to be stored expressed in bytes. Must be word aligned. - * @param[in] offset Offset in bytes to be applied when writing to the block. - * For example, if within a block of 100 bytes, the application wishes to - * write 20 bytes at an offset of 12 bytes, this field should be set to 12. - * Must be word aligned. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Parameter is not aligned. - * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. - * - * @warning No copy of the data is made, meaning memory provided for data source that is to be - * written to flash cannot be freed or reused by the application until this procedure - * is complete. The application is notified when the procedure is finished using the - * notification callback registered by the application. - */ -uint32_t pstorage_raw_store(pstorage_handle_t * p_dest, - uint8_t * p_src, - pstorage_size_t size, - pstorage_size_t offset); - -/**@brief Function for clearing data in persistent memory in raw mode. - * - * @param[in] p_dest Base block identifier in persistent memory that needs to be cleared. - * Equivalent to an Erase Operation. - * @param[in] size Size of data to be cleared from persistent memory expressed in bytes. - * Not used. - * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_INVALID_STATE Operation failure. API is called without module - * initialization. - * @retval NRF_ERROR_NULL Operation failure. NULL parameter has been passed. - * @retval NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed. - * @retval NRF_ERROR_NO_MEM Operation failure. No storage space available. - * - * @note Clear operations may take time. This API, however, does not block until the clear - * procedure is complete. The application is notified of procedure completion using - * a notification callback registered by the application. The 'result' parameter of the - * callback indicates if the procedure was successful or not. - */ -uint32_t pstorage_raw_clear(pstorage_handle_t * p_dest, pstorage_size_t size); - -#endif // PSTORAGE_RAW_MODE_ENABLE - -/**@} */ -/**@} */ - -#endif // PSTORAGE_H__ - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.c index df4ec49659..cd5364ee3b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.c @@ -1,25 +1,62 @@ -/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(PWM) +#define ENABLED_PWM_COUNT (PWM0_ENABLED+PWM1_ENABLED+PWM2_ENABLED) +#if ENABLED_PWM_COUNT #include #include "nrf_drv_pwm.h" #include "nrf_drv_common.h" #include "nrf_gpio.h" #include "app_util_platform.h" -#if (PWM_COUNT == 0) - #error "No PWM instances enabled in the driver configuration file." -#endif +#define NRF_LOG_MODULE_NAME "PWM" +#if PWM_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL PWM_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR PWM_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR PWM_CONFIG_DEBUG_COLOR +#else //PWM_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif //PWM_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" // Control block - driver instance local data. typedef struct @@ -27,20 +64,7 @@ typedef struct nrf_drv_pwm_handler_t handler; nrf_drv_state_t volatile state; } pwm_control_block_t; -static pwm_control_block_t m_cb[PWM_COUNT]; - -static nrf_drv_pwm_config_t const m_default_config[PWM_COUNT] = { -#if PWM0_ENABLED - NRF_DRV_PWM_DEFAULT_CONFIG(0), -#endif -#if PWM1_ENABLED - NRF_DRV_PWM_DEFAULT_CONFIG(1), -#endif -#if PWM2_ENABLED - NRF_DRV_PWM_DEFAULT_CONFIG(2), -#endif -}; - +static pwm_control_block_t m_cb[ENABLED_PWM_COUNT]; static void configure_pins(nrf_drv_pwm_t const * const p_instance, nrf_drv_pwm_config_t const * p_config) @@ -81,16 +105,17 @@ ret_code_t nrf_drv_pwm_init(nrf_drv_pwm_t const * const p_instance, nrf_drv_pwm_config_t const * p_config, nrf_drv_pwm_handler_t handler) { + ASSERT(p_config); + + ret_code_t err_code; + pwm_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) { - return NRF_ERROR_INVALID_STATE; - } - - if (p_config == NULL) - { - p_config = &m_default_config[p_instance->drv_inst_idx]; + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } p_cb->handler = handler; @@ -118,7 +143,9 @@ ret_code_t nrf_drv_pwm_init(nrf_drv_pwm_t const * const p_instance, p_cb->state = NRF_DRV_STATE_INITIALIZED; - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } @@ -187,7 +214,7 @@ void nrf_drv_pwm_simple_playback(nrf_drv_pwm_t const * const p_instance, nrf_pwm_sequence_set(p_instance->p_registers, 0, p_sequence); nrf_pwm_sequence_set(p_instance->p_registers, 1, p_sequence); bool odd = (playback_count & 1); - nrf_pwm_loop_set(p_instance->p_registers, playback_count/2 + (odd ? 1 : 0)); + nrf_pwm_loop_set(p_instance->p_registers, playback_count / 2 + (odd ? 1 : 0)); uint32_t shorts_mask; if (flags & NRF_DRV_PWM_FLAG_STOP) @@ -205,6 +232,10 @@ void nrf_drv_pwm_simple_playback(nrf_drv_pwm_t const * const p_instance, } nrf_pwm_shorts_set(p_instance->p_registers, shorts_mask); + NRF_LOG_INFO("Function: %s, sequence length: %d.\r\n", (uint32_t)__func__, + p_sequence->length * sizeof(p_sequence->values)); + NRF_LOG_DEBUG("Sequence data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_sequence->values.p_raw, p_sequence->length * sizeof(p_sequence->values)); start_playback(p_instance, p_cb, flags, odd ? NRF_PWM_TASK_SEQSTART1 : NRF_PWM_TASK_SEQSTART0); } @@ -241,6 +272,16 @@ void nrf_drv_pwm_complex_playback(nrf_drv_pwm_t const * const p_instance, } nrf_pwm_shorts_set(p_instance->p_registers, shorts_mask); + NRF_LOG_INFO("Function: %s, sequence 0 length: %d.\r\n", (uint32_t)__func__, + p_sequence_0->length * sizeof(p_sequence_0->values)); + NRF_LOG_INFO("Function: %s, sequence 1 length: %d.\r\n", (uint32_t)__func__, + p_sequence_1->length * sizeof(p_sequence_1->values)); + NRF_LOG_DEBUG("Sequence 0 data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_sequence_0->values.p_raw, + p_sequence_0->length * sizeof(p_sequence_0->values)); + NRF_LOG_DEBUG("Sequence 1 data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_sequence_1->values.p_raw, + p_sequence_1->length * sizeof(p_sequence_1->values)); start_playback(p_instance, p_cb, flags, NRF_PWM_TASK_SEQSTART0); } @@ -250,21 +291,27 @@ bool nrf_drv_pwm_stop(nrf_drv_pwm_t const * const p_instance, { ASSERT(m_cb[p_instance->drv_inst_idx].state != NRF_DRV_STATE_UNINITIALIZED); + bool ret_val = false; + if (nrf_drv_pwm_is_stopped(p_instance)) { - return true; + ret_val = true; + } + else + { + nrf_pwm_task_trigger(p_instance->p_registers, NRF_PWM_TASK_STOP); + + do { + if (nrf_drv_pwm_is_stopped(p_instance)) + { + ret_val = true; + break; + } + } while (wait_until_stopped); } - nrf_pwm_task_trigger(p_instance->p_registers, NRF_PWM_TASK_STOP); - - do { - if (nrf_drv_pwm_is_stopped(p_instance)) - { - return true; - } - } while (wait_until_stopped); - - return false; + NRF_LOG_INFO("%s returned %d.\r\n", (uint32_t)__func__, ret_val); + return ret_val; } @@ -273,20 +320,24 @@ bool nrf_drv_pwm_is_stopped(nrf_drv_pwm_t const * const p_instance) pwm_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + bool ret_val = false; + // If the event handler is used (interrupts are enabled), the state will // be changed in interrupt handler when the STOPPED event occurs. if (p_cb->state != NRF_DRV_STATE_POWERED_ON) { - return true; + ret_val = true; } // If interrupts are disabled, we must check the STOPPED event here. if (nrf_pwm_event_check(p_instance->p_registers, NRF_PWM_EVENT_STOPPED)) { p_cb->state = NRF_DRV_STATE_INITIALIZED; - return true; + NRF_LOG_INFO("Disabled.\r\n"); + ret_val = true; } - return false; + NRF_LOG_INFO("%s returned %d.\r\n", (uint32_t)__func__, ret_val); + return ret_val; } @@ -328,23 +379,32 @@ static void irq_handler(NRF_PWM_Type * p_pwm, pwm_control_block_t * p_cb) } -#if PWM0_ENABLED +#if NRF_MODULE_ENABLED(PWM0) void PWM0_IRQHandler(void) { irq_handler(NRF_PWM0, &m_cb[PWM0_INSTANCE_INDEX]); } #endif -#if PWM1_ENABLED +#if NRF_MODULE_ENABLED(PWM1) void PWM1_IRQHandler(void) { irq_handler(NRF_PWM1, &m_cb[PWM1_INSTANCE_INDEX]); } #endif -#if PWM2_ENABLED +#if NRF_MODULE_ENABLED(PWM2) void PWM2_IRQHandler(void) { irq_handler(NRF_PWM2, &m_cb[PWM2_INSTANCE_INDEX]); } #endif + +#if PWM3_ENABLED +void PWM3_IRQHandler(void) +{ + irq_handler(NRF_PWM3, &m_cb[PWM3_INSTANCE_INDEX]); +} +#endif +#endif //ENABLED_PWM_COUNT +#endif //NRF_MODULE_ENABLED(PWM) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.h index f8b1c1bc97..7f083bf911 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/pwm/nrf_drv_pwm.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ /**@file @@ -26,11 +52,26 @@ #define NRF_DRV_PWM_H__ #include "nordic_common.h" -#include "nrf_drv_config.h" +#include "sdk_config.h" #include "nrf_pwm.h" #include "sdk_errors.h" +#ifdef __cplusplus +extern "C" { +#endif +#ifndef PWM0_ENABLED +#define PWM0_ENABLED 0 +#endif +#ifndef PWM1_ENABLED +#define PWM1_ENABLED 0 +#endif +#ifndef PWM2_ENABLED +#define PWM2_ENABLED 0 +#endif +#ifndef PWM3_ENABLED +#define PWM3_ENABLED 0 +#endif /** * @brief PWM driver instance data structure. */ @@ -40,6 +81,11 @@ typedef struct uint8_t drv_inst_idx; ///< Driver instance index. } nrf_drv_pwm_t; +#define PWM0_INSTANCE_INDEX 0 +#define PWM1_INSTANCE_INDEX PWM0_INSTANCE_INDEX+PWM0_ENABLED +#define PWM2_INSTANCE_INDEX PWM1_INSTANCE_INDEX+PWM1_ENABLED +#define PWM3_INSTANCE_INDEX PWM2_INSTANCE_INDEX+PWM2_ENABLED + /** * @brief Macro for creating a PWM driver instance. */ @@ -58,7 +104,7 @@ typedef struct #define NRF_DRV_PWM_PIN_NOT_USED 0xFF /** - * @brief This value can be added to a pin number to inverse its polarity + * @brief This value can be added to a pin number to inverse its polarity * (set idle state = 1). */ #define NRF_DRV_PWM_PIN_INVERTED 0x80 @@ -68,7 +114,7 @@ typedef struct */ typedef struct { - uint8_t output_pins[NRF_PWM_CHANNEL_COUNT]; ///< Pin numbers for individual output channels (optional). + uint8_t output_pins[NRF_PWM_CHANNEL_COUNT]; ///< Pin numbers for individual output channels (optional). /**< Use @ref NRF_DRV_PWM_PIN_NOT_USED * if a given output channel is not needed. */ uint8_t irq_priority; ///< Interrupt priority. @@ -82,18 +128,18 @@ typedef struct /** * @brief PWM driver default configuration. */ -#define NRF_DRV_PWM_DEFAULT_CONFIG(id) \ -{ \ - .output_pins = { CONCAT_3(PWM, id, _CONFIG_OUT0_PIN), \ - CONCAT_3(PWM, id, _CONFIG_OUT1_PIN), \ - CONCAT_3(PWM, id, _CONFIG_OUT2_PIN), \ - CONCAT_3(PWM, id, _CONFIG_OUT3_PIN) }, \ - .irq_priority = CONCAT_3(PWM, id, _CONFIG_IRQ_PRIORITY), \ - .base_clock = CONCAT_3(PWM, id, _CONFIG_BASE_CLOCK), \ - .count_mode = CONCAT_3(PWM, id, _CONFIG_COUNT_MODE), \ - .top_value = CONCAT_3(PWM, id, _CONFIG_TOP_VALUE), \ - .load_mode = CONCAT_3(PWM, id, _CONFIG_LOAD_MODE), \ - .step_mode = CONCAT_3(PWM, id, _CONFIG_STEP_MODE), \ +#define NRF_DRV_PWM_DEFAULT_CONFIG \ +{ \ + .output_pins = {PWM_DEFAULT_CONFIG_OUT0_PIN, \ + PWM_DEFAULT_CONFIG_OUT1_PIN, \ + PWM_DEFAULT_CONFIG_OUT2_PIN, \ + PWM_DEFAULT_CONFIG_OUT3_PIN }, \ + .irq_priority = PWM_DEFAULT_CONFIG_IRQ_PRIORITY, \ + .base_clock = (nrf_pwm_clk_t)PWM_DEFAULT_CONFIG_BASE_CLOCK, \ + .count_mode = (nrf_pwm_mode_t)PWM_DEFAULT_CONFIG_COUNT_MODE, \ + .top_value = PWM_DEFAULT_CONFIG_TOP_VALUE, \ + .load_mode = (nrf_pwm_dec_load_t)PWM_DEFAULT_CONFIG_LOAD_MODE, \ + .step_mode = (nrf_pwm_dec_step_t)PWM_DEFAULT_CONFIG_STEP_MODE, \ } @@ -421,6 +467,11 @@ __STATIC_INLINE uint32_t nrf_drv_pwm_event_address_get( #endif // SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + #endif // NRF_DRV_PWM_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/qdec/nrf_drv_qdec.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/qdec/nrf_drv_qdec.c new file mode 100644 index 0000000000..a00abc61ef --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/qdec/nrf_drv_qdec.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(QDEC) +#include +#include + +#include "nrf.h" +#include "nrf_gpio.h" +#include "nrf_error.h" +#include "nrf_assert.h" +#include "nrf_drv_common.h" +#include "nrf_drv_qdec.h" +#include "app_util_platform.h" +#include "nrf_assert.h" + +#define NRF_LOG_MODULE_NAME "QDEC" + +#if QDEC_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL QDEC_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR QDEC_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR QDEC_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_QDEC_EVENT_SAMPLERDY ? "NRF_QDEC_EVENT_SAMPLERDY" : \ + (event == NRF_QDEC_EVENT_REPORTRDY ? "NRF_QDEC_EVENT_REPORTRDY" : \ + (event == NRF_QDEC_EVENT_ACCOF ? "NRF_QDEC_EVENT_ACCOF" : "UNKNOWN EVENT"))) +#else //QDEC_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //QDEC_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + + +static qdec_event_handler_t m_qdec_event_handler = NULL; +static const nrf_drv_qdec_config_t m_default_config = NRF_DRV_QDEC_DEFAULT_CONFIG; +static nrf_drv_state_t m_state = NRF_DRV_STATE_UNINITIALIZED; + +void QDEC_IRQHandler(void) +{ + nrf_drv_qdec_event_t event; + if ( nrf_qdec_event_check(NRF_QDEC_EVENT_SAMPLERDY) && + nrf_qdec_int_enable_check(NRF_QDEC_INT_SAMPLERDY_MASK) ) + { + nrf_qdec_event_clear(NRF_QDEC_EVENT_SAMPLERDY); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_QDEC_EVENT_SAMPLERDY)); + + event.type = NRF_QDEC_EVENT_SAMPLERDY; + event.data.sample.value = (int8_t)nrf_qdec_sample_get(); + m_qdec_event_handler(event); + } + + if ( nrf_qdec_event_check(NRF_QDEC_EVENT_REPORTRDY) && + nrf_qdec_int_enable_check(NRF_QDEC_INT_REPORTRDY_MASK) ) + { + nrf_qdec_event_clear(NRF_QDEC_EVENT_REPORTRDY); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_QDEC_INT_REPORTRDY_MASK)); + + event.type = NRF_QDEC_EVENT_REPORTRDY; + + event.data.report.acc = (int16_t)nrf_qdec_accread_get(); + event.data.report.accdbl = (uint16_t)nrf_qdec_accdblread_get(); + m_qdec_event_handler(event); + } + + if ( nrf_qdec_event_check(NRF_QDEC_EVENT_ACCOF) && + nrf_qdec_int_enable_check(NRF_QDEC_INT_ACCOF_MASK) ) + { + nrf_qdec_event_clear(NRF_QDEC_EVENT_ACCOF); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_QDEC_EVENT_ACCOF)); + + event.type = NRF_QDEC_EVENT_ACCOF; + m_qdec_event_handler(event); + } +} + + +ret_code_t nrf_drv_qdec_init(const nrf_drv_qdec_config_t * p_config, + qdec_event_handler_t event_handler) +{ + ret_code_t err_code; + + if (m_state != NRF_DRV_STATE_UNINITIALIZED) + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + if (event_handler) + { + m_qdec_event_handler = event_handler; + } + else + { + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + nrf_qdec_sampleper_set(p_config->sampleper); + nrf_gpio_cfg_input(p_config->pselled, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_input(p_config->psela, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_input(p_config->pselb, NRF_GPIO_PIN_NOPULL); + nrf_qdec_pio_assign( p_config->psela, p_config->pselb, p_config->pselled); + nrf_qdec_ledpre_set(p_config->ledpre); + nrf_qdec_ledpol_set(p_config->ledpol); + nrf_qdec_shorts_enable(NRF_QDEC_SHORT_REPORTRDY_READCLRACC_MASK); + + if (p_config->dbfen) + { + nrf_qdec_dbfen_enable(); + } + else + { + nrf_qdec_dbfen_disable(); + } + + uint32_t int_mask = NRF_QDEC_INT_ACCOF_MASK; + + if (p_config->reportper != NRF_QDEC_REPORTPER_DISABLED) + { + nrf_qdec_reportper_set(p_config->reportper); + int_mask |= NRF_QDEC_INT_REPORTRDY_MASK; + } + + if (p_config->sample_inten) + { + int_mask |= NRF_QDEC_INT_SAMPLERDY_MASK; + } + + nrf_qdec_int_enable(int_mask); + nrf_drv_common_irq_enable(QDEC_IRQn, p_config->interrupt_priority); + + m_state = NRF_DRV_STATE_INITIALIZED; + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + +void nrf_drv_qdec_uninit(void) +{ + ASSERT(m_state != NRF_DRV_STATE_UNINITIALIZED); + nrf_drv_qdec_disable(); + nrf_drv_common_irq_disable(QDEC_IRQn); + m_state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Uninitialized.\r\n"); +} + +void nrf_drv_qdec_enable(void) +{ + ASSERT(m_state == NRF_DRV_STATE_INITIALIZED); + nrf_qdec_enable(); + nrf_qdec_task_trigger(NRF_QDEC_TASK_START); + m_state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Enabled.\r\n"); +} + +void nrf_drv_qdec_disable(void) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + nrf_qdec_task_trigger(NRF_QDEC_TASK_STOP); + nrf_qdec_disable(); + m_state = NRF_DRV_STATE_INITIALIZED; + NRF_LOG_INFO("Disabled.\r\n"); +} + +void nrf_drv_qdec_accumulators_read(int16_t * p_acc, int16_t * p_accdbl) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + nrf_qdec_task_trigger(NRF_QDEC_TASK_READCLRACC); + + *p_acc = (int16_t)nrf_qdec_accread_get(); + *p_accdbl = (int16_t)nrf_qdec_accdblread_get(); + + NRF_LOG_DEBUG("Accumulators data, ACC register:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_acc, sizeof(p_acc)); + NRF_LOG_DEBUG("Accumulators data, ACCDBL register:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_accdbl, sizeof(p_accdbl)); +} + +void nrf_drv_qdec_task_address_get(nrf_qdec_task_t task, uint32_t * p_task) +{ + *p_task = (uint32_t)nrf_qdec_task_address_get(task); +} + +void nrf_drv_qdec_event_address_get(nrf_qdec_event_t event, uint32_t * p_event) +{ + *p_event = (uint32_t)nrf_qdec_event_address_get(event); +} + +#endif //NRF_MODULE_ENABLED(QDEC) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/qdec/nrf_drv_qdec.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/qdec/nrf_drv_qdec.h new file mode 100644 index 0000000000..5a50cf0ba0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/qdec/nrf_drv_qdec.h @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_DRV_QDEC_H__ +#define NRF_DRV_QDEC_H__ + +#include "nrf_qdec.h" +#include "sdk_config.h" +#include "sdk_errors.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup nrf_qdec QDEC HAL and driver + * @ingroup nrf_drivers + * @brief Quadrature decoder (QDEC) APIs. + * @details The QDEC HAL provides basic APIs for accessing the registers of the QDEC. + * The QDEC driver provides APIs on a higher level. + * + * @defgroup nrf_drv_qdec QDEC driver + * @{ + * @ingroup nrf_qdec + * @brief Quadrature decoder (QDEC) driver. + */ + +/**@brief QDEC configuration structure.*/ +typedef struct +{ + nrf_qdec_reportper_t reportper; /**< Report period in samples. */ + nrf_qdec_sampleper_t sampleper; /**< Sampling period in microseconds. */ + uint32_t psela; /**< Pin number for A input. */ + uint32_t pselb; /**< Pin number for B input. */ + uint32_t pselled; /**< Pin number for LED output. */ + uint32_t ledpre; /**< Time (in microseconds) how long LED is switched on before sampling. */ + nrf_qdec_ledpol_t ledpol; /**< Active LED polarity. */ + bool dbfen; /**< State of debouncing filter. */ + bool sample_inten; /**< Enabling sample ready interrupt. */ + uint8_t interrupt_priority; /**< QDEC interrupt priority. */ +} nrf_drv_qdec_config_t; + +/**@brief QDEC default configuration. */ +#define NRF_DRV_QDEC_DEFAULT_CONFIG \ + { \ + .reportper = (nrf_qdec_reportper_t)QDEC_CONFIG_REPORTPER, \ + .sampleper = (nrf_qdec_sampleper_t)QDEC_CONFIG_SAMPLEPER, \ + .psela = QDEC_CONFIG_PIO_A, \ + .pselb = QDEC_CONFIG_PIO_B, \ + .pselled = QDEC_CONFIG_PIO_LED, \ + .ledpre = QDEC_CONFIG_LEDPRE, \ + .ledpol = (nrf_qdec_ledpol_t)QDEC_CONFIG_LEDPOL, \ + .interrupt_priority = QDEC_CONFIG_IRQ_PRIORITY, \ + .dbfen = QDEC_CONFIG_DBFEN, \ + .sample_inten = QDEC_CONFIG_SAMPLE_INTEN \ + } + +/**@brief QDEC sample event data.*/ +typedef struct +{ + int8_t value; /**< Sample value. */ +} nrf_drv_qdec_sample_data_evt_t; + +/**@brief QDEC report event data.*/ +typedef struct +{ + int16_t acc; /**< Accumulated transitions. */ + uint16_t accdbl; /**< Accumulated double transitions. */ +} nrf_drv_qdec_report_data_evt_t; + +/**@brief QDEC event handler structure. */ +typedef struct +{ + nrf_qdec_event_t type; + union + { + nrf_drv_qdec_sample_data_evt_t sample; /**< Sample event data. */ + nrf_drv_qdec_report_data_evt_t report; /**< Report event data. */ + } data; +} nrf_drv_qdec_event_t; + +/**@brief QDEC event handler. + * @param[in] event QDEC event structure. + */ +typedef void (*qdec_event_handler_t)(nrf_drv_qdec_event_t event); + +/**@brief Function for initializing QDEC. + * + * @param[in] p_config Pointer to configuration parameters. + * @param[in] event_handler Event handler function. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_PARAM If invalid parameters were supplied. + * @retval NRF_ERROR_INVALID_STATE If QDEC was already initialized. + */ +ret_code_t nrf_drv_qdec_init(nrf_drv_qdec_config_t const * p_config, + qdec_event_handler_t event_handler); + +/**@brief Function for uninitializing QDEC. + * @note Function asserts if module is uninitialized. + */ +void nrf_drv_qdec_uninit(void); + +/**@brief Function for enabling QDEC. + * @note Function asserts if module is uninitialized or enabled. + */ +void nrf_drv_qdec_enable(void); + +/**@brief Function for disabling QDEC. + * @note Function asserts if module is uninitialized or disabled. + */ +void nrf_drv_qdec_disable(void); + +/**@brief Function for reading accumulated transitions QDEC. + * @note Function asserts if module is not enabled. + * @note Accumulators are cleared after reading. + * + * @param[out] p_acc Pointer to store accumulated transitions. + * @param[out] p_accdbl Pointer to store accumulated double transitions. + */ +void nrf_drv_qdec_accumulators_read(int16_t * p_acc, int16_t * p_accdbl); + +/** + * @brief Function for returning the address of a specific timer task. + * + * @param[in] task QDEC task. + * @param[out] p_task Task address. + */ +void nrf_drv_qdec_task_address_get(nrf_qdec_task_t task, uint32_t * p_task); + +/** + * @brief Function for returning the address of a specific timer event. + * + * @param[in] event QDEC event. + * @param[out] p_event Event address. + */ +void nrf_drv_qdec_event_address_get(nrf_qdec_event_t event, uint32_t * p_event); + +/** + *@} + **/ + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_DRV_QDEC_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/radio_config/radio_config.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/radio_config/radio_config.c new file mode 100644 index 0000000000..a5a5c067d0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/radio_config/radio_config.c @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2009 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/** @file +* @addtogroup nrf_dev_radio_rx_example_main nrf_dev_radio_tx_example_main +* @{ +*/ + +#include "radio_config.h" +#include "nrf_delay.h" + +/* These are set to zero as ShockBurst packets don't have corresponding fields. */ +#define PACKET_S1_FIELD_SIZE (0UL) /**< Packet S1 field size in bits. */ +#define PACKET_S0_FIELD_SIZE (0UL) /**< Packet S0 field size in bits. */ +#define PACKET_LENGTH_FIELD_SIZE (0UL) /**< Packet length field size in bits. */ + +/** + * @brief Function for swapping/mirroring bits in a byte. + * + *@verbatim + * output_bit_7 = input_bit_0 + * output_bit_6 = input_bit_1 + * : + * output_bit_0 = input_bit_7 + *@endverbatim + * + * @param[in] inp is the input byte to be swapped. + * + * @return + * Returns the swapped/mirrored input byte. + */ +static uint32_t swap_bits(uint32_t inp); + +/** + * @brief Function for swapping bits in a 32 bit word for each byte individually. + * + * The bits are swapped as follows: + * @verbatim + * output[31:24] = input[24:31] + * output[23:16] = input[16:23] + * output[15:8] = input[8:15] + * output[7:0] = input[0:7] + * @endverbatim + * @param[in] input is the input word to be swapped. + * + * @return + * Returns the swapped input byte. + */ +static uint32_t bytewise_bitswap(uint32_t inp); + +static uint32_t swap_bits(uint32_t inp) +{ + uint32_t i; + uint32_t retval = 0; + + inp = (inp & 0x000000FFUL); + + for (i = 0; i < 8; i++) + { + retval |= ((inp >> i) & 0x01) << (7 - i); + } + + return retval; +} + + +static uint32_t bytewise_bitswap(uint32_t inp) +{ + return (swap_bits(inp >> 24) << 24) + | (swap_bits(inp >> 16) << 16) + | (swap_bits(inp >> 8) << 8) + | (swap_bits(inp)); +} + + +/** + * @brief Function for configuring the radio to operate in ShockBurst compatible mode. + * + * To configure the application running on nRF24L series devices: + * + * @verbatim + * uint8_t tx_address[5] = { 0xC0, 0x01, 0x23, 0x45, 0x67 }; + * hal_nrf_set_rf_channel(7); + * hal_nrf_set_address_width(HAL_NRF_AW_5BYTES); + * hal_nrf_set_address(HAL_NRF_TX, tx_address); + * hal_nrf_set_address(HAL_NRF_PIPE0, tx_address); + * hal_nrf_open_pipe(0, false); + * hal_nrf_set_datarate(HAL_NRF_1MBPS); + * hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT); + * hal_nrf_setup_dynamic_payload(0xFF); + * hal_nrf_enable_dynamic_payload(false); + * @endverbatim + * + * When transmitting packets with hal_nrf_write_tx_payload(const uint8_t *tx_pload, uint8_t length), + * match the length with PACKET_STATIC_LENGTH. + * hal_nrf_write_tx_payload(payload, PACKET_STATIC_LENGTH); + * +*/ +void radio_configure() +{ + // Radio config + NRF_RADIO->TXPOWER = (RADIO_TXPOWER_TXPOWER_0dBm << RADIO_TXPOWER_TXPOWER_Pos); + NRF_RADIO->FREQUENCY = 7UL; // Frequency bin 7, 2407MHz + NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_1Mbit << RADIO_MODE_MODE_Pos); + + // Radio address config + NRF_RADIO->PREFIX0 = + ((uint32_t)swap_bits(0xC3) << 24) // Prefix byte of address 3 converted to nRF24L series format + | ((uint32_t)swap_bits(0xC2) << 16) // Prefix byte of address 2 converted to nRF24L series format + | ((uint32_t)swap_bits(0xC1) << 8) // Prefix byte of address 1 converted to nRF24L series format + | ((uint32_t)swap_bits(0xC0) << 0); // Prefix byte of address 0 converted to nRF24L series format + + NRF_RADIO->PREFIX1 = + ((uint32_t)swap_bits(0xC7) << 24) // Prefix byte of address 7 converted to nRF24L series format + | ((uint32_t)swap_bits(0xC6) << 16) // Prefix byte of address 6 converted to nRF24L series format + | ((uint32_t)swap_bits(0xC4) << 0); // Prefix byte of address 4 converted to nRF24L series format + + NRF_RADIO->BASE0 = bytewise_bitswap(0x01234567UL); // Base address for prefix 0 converted to nRF24L series format + NRF_RADIO->BASE1 = bytewise_bitswap(0x89ABCDEFUL); // Base address for prefix 1-7 converted to nRF24L series format + + NRF_RADIO->TXADDRESS = 0x00UL; // Set device address 0 to use when transmitting + NRF_RADIO->RXADDRESSES = 0x01UL; // Enable device address 0 to use to select which addresses to receive + + // Packet configuration + NRF_RADIO->PCNF0 = (PACKET_S1_FIELD_SIZE << RADIO_PCNF0_S1LEN_Pos) | + (PACKET_S0_FIELD_SIZE << RADIO_PCNF0_S0LEN_Pos) | + (PACKET_LENGTH_FIELD_SIZE << RADIO_PCNF0_LFLEN_Pos); //lint !e845 "The right argument to operator '|' is certain to be 0" + + // Packet configuration + NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | + (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | + (PACKET_BASE_ADDRESS_LENGTH << RADIO_PCNF1_BALEN_Pos) | + (PACKET_STATIC_LENGTH << RADIO_PCNF1_STATLEN_Pos) | + (PACKET_PAYLOAD_MAXSIZE << RADIO_PCNF1_MAXLEN_Pos); //lint !e845 "The right argument to operator '|' is certain to be 0" + + // CRC Config + NRF_RADIO->CRCCNF = (RADIO_CRCCNF_LEN_Two << RADIO_CRCCNF_LEN_Pos); // Number of checksum bits + if ((NRF_RADIO->CRCCNF & RADIO_CRCCNF_LEN_Msk) == (RADIO_CRCCNF_LEN_Two << RADIO_CRCCNF_LEN_Pos)) + { + NRF_RADIO->CRCINIT = 0xFFFFUL; // Initial value + NRF_RADIO->CRCPOLY = 0x11021UL; // CRC poly: x^16 + x^12^x^5 + 1 + } + else if ((NRF_RADIO->CRCCNF & RADIO_CRCCNF_LEN_Msk) == (RADIO_CRCCNF_LEN_One << RADIO_CRCCNF_LEN_Pos)) + { + NRF_RADIO->CRCINIT = 0xFFUL; // Initial value + NRF_RADIO->CRCPOLY = 0x107UL; // CRC poly: x^8 + x^2^x^1 + 1 + } +} + +/** + * @} + */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_mem_pool_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/radio_config/radio_config.h similarity index 79% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_mem_pool_internal.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/radio_config/radio_config.h index 92594915ac..e51b9db2c5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_mem_pool_internal.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/radio_config/radio_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Nordic Semiconductor ASA + * Copyright (c) 2009 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,25 +35,22 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#ifndef RADIO_CONFIG_H +#define RADIO_CONFIG_H - -/** @file - * - * @defgroup memory_pool_internal Memory Pool Internal - * @{ - * @ingroup memory_pool - * - * @brief Memory pool internal definitions - */ - -#ifndef MEM_POOL_INTERNAL_H__ -#define MEM_POOL_INTERNAL_H__ +#ifdef __cplusplus +extern "C" { +#endif -#define TX_BUF_SIZE 600u /**< TX buffer size in bytes. */ -#define RX_BUF_SIZE TX_BUF_SIZE /**< RX buffer size in bytes. */ +#define PACKET_BASE_ADDRESS_LENGTH (4UL) //!< Packet base address length field size in bytes +#define PACKET_STATIC_LENGTH (1UL) //!< Packet static length in bytes +#define PACKET_PAYLOAD_MAXSIZE (PACKET_STATIC_LENGTH) //!< Packet payload maximum size in bytes -#define RX_BUF_QUEUE_SIZE 4u /**< RX buffer element size. */ +void radio_configure(void); -#endif // MEM_POOL_INTERNAL_H__ - -/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rng/nrf_drv_rng.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rng/nrf_drv_rng.c new file mode 100644 index 0000000000..b49f9896f1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rng/nrf_drv_rng.c @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(RNG) + +#include +#include +#include "nrf_drv_rng.h" +#include "nrf_drv_common.h" +#include "nordic_common.h" +#include "nrf_assert.h" +#include "nrf_queue.h" + +#ifdef SOFTDEVICE_PRESENT + #include "softdevice_handler.h" + #include "nrf_soc.h" + #include "app_util_platform.h" +#endif // SOFTDEVICE_PRESENT + +#define NRF_LOG_MODULE_NAME "RNG" + +#if RNG_CONFIG_LOG_ENABLED + #define NRF_LOG_LEVEL RNG_CONFIG_LOG_LEVEL + #define NRF_LOG_INFO_COLOR RNG_CONFIG_INFO_COLOR + #define NRF_LOG_DEBUG_COLOR RNG_CONFIG_DEBUG_COLOR +#else //RNG_CONFIG_LOG_ENABLED + #define NRF_LOG_LEVEL 0 +#endif //RNG_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + +/* Validate configuration */ +INTERRUPT_PRIORITY_VALIDATION(RNG_CONFIG_IRQ_PRIORITY); + +typedef struct +{ + nrf_drv_state_t state; + nrf_drv_rng_config_t config; +} nrf_drv_rng_cb_t; + +static nrf_drv_rng_cb_t m_rng_cb; +NRF_QUEUE_DEF(uint8_t, m_rand_pool, RNG_CONFIG_POOL_SIZE, NRF_QUEUE_MODE_OVERFLOW); +static const nrf_drv_rng_config_t m_default_config = NRF_DRV_RNG_DEFAULT_CONFIG; + +#ifdef SOFTDEVICE_PRESENT + #define SD_RAND_POOL_SIZE (32) + STATIC_ASSERT(RNG_CONFIG_POOL_SIZE == SD_RAND_POOL_SIZE); + + #define NRF_DRV_RNG_LOCK() CRITICAL_REGION_ENTER() + #define NRF_DRV_RNG_RELEASE() CRITICAL_REGION_EXIT() + #define NRF_DRV_RNG_SD_IS_ENABLED() softdevice_handler_is_enabled() +#else + #define NRF_DRV_RNG_LOCK() do { } while (0) + #define NRF_DRV_RNG_RELEASE() do { } while (0) + #define NRF_DRV_RNG_SD_IS_ENABLED() false +#endif // SOFTDEVICE_PRESENT + +/** + * @brief Function for starting generation. + */ +static void nrf_drv_rng_start(void) +{ + ASSERT(!NRF_DRV_RNG_SD_IS_ENABLED()); + + nrf_rng_event_clear(NRF_RNG_EVENT_VALRDY); + nrf_rng_int_enable(NRF_RNG_INT_VALRDY_MASK); + nrf_rng_task_trigger(NRF_RNG_TASK_START); +} + +/** + * @brief Function for stoping generation. + */ +static void nrf_drv_rng_stop(void) +{ + ASSERT(!NRF_DRV_RNG_SD_IS_ENABLED()); + + nrf_rng_int_disable(NRF_RNG_INT_VALRDY_MASK); + nrf_rng_task_trigger(NRF_RNG_TASK_STOP); +} + +/** + * @brief Function for setting up RNG hardware. + */ +static void nrf_drv_rng_setup(void) +{ + ASSERT(!NRF_DRV_RNG_SD_IS_ENABLED()); + + if (m_rng_cb.config.error_correction) + { + nrf_rng_error_correction_enable(); + } + nrf_rng_shorts_disable(NRF_RNG_SHORT_VALRDY_STOP_MASK); + nrf_drv_common_irq_enable(RNG_IRQn, m_rng_cb.config.interrupt_priority); +} + +ret_code_t nrf_drv_rng_init(nrf_drv_rng_config_t const * p_config) +{ + if (m_rng_cb.state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_MODULE_ALREADY_INITIALIZED; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + m_rng_cb.config = *p_config; + + NRF_DRV_RNG_LOCK(); + + if (!NRF_DRV_RNG_SD_IS_ENABLED()) + { + nrf_drv_rng_setup(); + nrf_drv_rng_start(); + } + + NRF_DRV_RNG_RELEASE(); + + m_rng_cb.state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + +void nrf_drv_rng_uninit(void) +{ + ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED); + + NRF_DRV_RNG_LOCK(); + + if (!NRF_DRV_RNG_SD_IS_ENABLED()) + { + nrf_drv_rng_stop(); + nrf_drv_common_irq_disable(RNG_IRQn); + } + + NRF_DRV_RNG_RELEASE(); + + nrf_queue_reset(&m_rand_pool); + m_rng_cb.state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Uninitialized.\r\n"); +} + +void nrf_drv_rng_bytes_available(uint8_t * p_bytes_available) +{ + ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED); + +#ifdef SOFTDEVICE_PRESENT + if (NRF_DRV_RNG_SD_IS_ENABLED()) + { + if (NRF_SUCCESS == sd_rand_application_bytes_available_get(p_bytes_available)) + { + return; + } + } +#endif // SOFTDEVICE_PRESENT + + *p_bytes_available = nrf_queue_utilization_get(&m_rand_pool); + + NRF_LOG_INFO("Function: %s, available bytes: %d.\r\n", (uint32_t)__func__, *p_bytes_available); +} + +ret_code_t nrf_drv_rng_rand(uint8_t * p_buff, uint8_t length) +{ + ret_code_t err_code = NRF_SUCCESS; + ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED); + +#ifdef SOFTDEVICE_PRESENT + do { + bool sd_is_enabled; + NRF_DRV_RNG_LOCK(); + sd_is_enabled = NRF_DRV_RNG_SD_IS_ENABLED(); + if (!sd_is_enabled) +#endif // SOFTDEVICE_PRESENT + { + err_code = nrf_queue_read(&m_rand_pool, p_buff, (uint32_t)length); + nrf_drv_rng_start(); + } +#ifdef SOFTDEVICE_PRESENT + NRF_DRV_RNG_RELEASE(); + + if (sd_is_enabled) + { + err_code = sd_rand_application_vector_get(p_buff, length); + if (err_code == NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES) + { + err_code = NRF_ERROR_NOT_FOUND; + } + } + } while (err_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED); +#endif // SOFTDEVICE_PRESENT + ASSERT((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NOT_FOUND)); + + NRF_LOG_DEBUG("Rand buffer data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_buff, length); + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", + (uint32_t)__func__, + (uint32_t)ERR_TO_STR(err_code)); + + return err_code; +} + +void nrf_drv_rng_block_rand(uint8_t * p_buff, uint32_t length) +{ + ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED); + + while (length) + { + uint32_t len = MIN(length, RNG_CONFIG_POOL_SIZE); + ret_code_t err_code; + + do { + err_code = nrf_drv_rng_rand(p_buff, len); + } while(err_code != NRF_SUCCESS); + + length -= len; + p_buff += len; + } + + NRF_LOG_DEBUG("Rand buffer data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_buff, length); +} + +#ifdef SOFTDEVICE_PRESENT +void nrf_drv_rng_on_sd_disable(void) +{ + NRF_DRV_RNG_LOCK(); + if (m_rng_cb.state == NRF_DRV_STATE_INITIALIZED) + { + nrf_drv_rng_setup(); + nrf_drv_rng_start(); + } + NRF_DRV_RNG_RELEASE(); +} +#endif // SOFTDEVICE_PRESENT + +void RNG_IRQHandler(void) +{ + NRF_DRV_RNG_LOCK(); + if ( + !NRF_DRV_RNG_SD_IS_ENABLED() && + nrf_rng_event_get(NRF_RNG_EVENT_VALRDY) && + nrf_rng_int_get(NRF_RNG_INT_VALRDY_MASK)) + { + nrf_rng_event_clear(NRF_RNG_EVENT_VALRDY); + + uint8_t new_value = nrf_rng_random_value_get(); + UNUSED_RETURN_VALUE(nrf_queue_push(&m_rand_pool, &new_value)); + + if (nrf_queue_is_full(&m_rand_pool)) + { + nrf_drv_rng_stop(); + } + + NRF_LOG_DEBUG("Event: NRF_RNG_EVENT_VALRDY.\r\n"); + } + NRF_DRV_RNG_RELEASE(); +} + +#endif // NRF_MODULE_ENABLED(RNG) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rng/nrf_drv_rng.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rng/nrf_drv_rng.h new file mode 100644 index 0000000000..3600c6f9b0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rng/nrf_drv_rng.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_DRV_RNG_H__ +#define NRF_DRV_RNG_H__ + +#include +#include + +#include "nrf_rng.h" +#include "sdk_errors.h" +#include "sdk_config.h" +#include "nrf_drv_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup nrf_rng RNG HAL and driver + * @ingroup nrf_drivers + * @brief Random number generator (RNG) APIs. + * @details The RNG HAL provides basic APIs for accessing the registers of the random number + * generator. The RNG driver provides APIs on a higher level. + * + * @defgroup nrf_drv_rng RNG driver + * @{ + * @ingroup nrf_rng + * @brief Driver for managing the random number generator (RNG). + */ + +/**@brief Struct for RNG configuration. */ +typedef struct +{ + bool error_correction : 1; /**< Error correction flag. */ + uint8_t interrupt_priority; /**< interrupt priority */ +} nrf_drv_rng_config_t; + +/**@brief RNG default configuration. */ +#define NRF_DRV_RNG_DEFAULT_CONFIG \ + { \ + .error_correction = RNG_CONFIG_ERROR_CORRECTION, \ + .interrupt_priority = RNG_CONFIG_IRQ_PRIORITY, \ + } + +/** + * @brief Function for initializing the nrf_drv_rng module. + * + * @param[in] p_config Initial configuration. Default configuration used if NULL. + * + * @retval NRF_SUCCESS Driver was successfully initialized. + * @retval NRF_ERROR_MODULE_ALREADY_INITIALIZED Driver was already initialized. + */ +ret_code_t nrf_drv_rng_init(nrf_drv_rng_config_t const * p_config); + +/** + * @brief Function for uninitializing the nrf_drv_rng module. + */ +void nrf_drv_rng_uninit(void); + +/** + * @brief Function for getting the number of currently available random bytes. + * + * @param[out] p_bytes_available The number of bytes currently available in the pool. + */ +void nrf_drv_rng_bytes_available(uint8_t * p_bytes_available); + +/** + * @brief Function for getting the vector of random numbers. + * + * @param[out] p_buff Pointer to uint8_t buffer for storing the bytes. + * @param[in] length Number of bytes to take from the pool and place in p_buff. + * + * @retval NRF_SUCCESS If the requested bytes were written to p_buff. + * @retval NRF_ERROR_NOT_FOUND If no bytes were written to the buffer because there were + * not enough bytes available in the pool. + */ +ret_code_t nrf_drv_rng_rand(uint8_t * p_buff, uint8_t length); + +/** + * @brief Blocking function for getting an arbitrary array of random numbers. + * + * @note This function may execute for a substantial amount of time depending on the length + * of the buffer required and on the state of the current internal pool of random numbers. + * + * @param[out] p_buff Pointer to uint8_t buffer for storing the bytes. + * @param[in] length Number of bytes place in p_buff. + */ +void nrf_drv_rng_block_rand(uint8_t * p_buff, uint32_t length); + +#ifdef SOFTDEVICE_PRESENT +/** + * @brief Function called by the SoftDevice handler when the SoftDevice has been disabled. + * + * This function is called just after the SoftDevice has been properly disabled. + * It has two purposes: + * 1. Reinitializes RNG hardware. + * 2. Trigger new random numbers generation. + */ +void nrf_drv_rng_on_sd_disable(void); + +#endif +/** + *@} + **/ + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DRV_RNG_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rtc/nrf_drv_rtc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rtc/nrf_drv_rtc.c new file mode 100644 index 0000000000..6d7fcfbd51 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rtc/nrf_drv_rtc.c @@ -0,0 +1,355 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(RTC) +#define ENABLED_RTC_COUNT (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED) +#if ENABLED_RTC_COUNT + +#include "nrf_drv_rtc.h" +#include "nrf_rtc.h" +#include "nrf_assert.h" +#include "app_util_platform.h" + +#define NRF_LOG_MODULE_NAME "RTC" + +#if RTC_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL RTC_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR RTC_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR RTC_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_RTC_EVENT_TICK ? "NRF_RTC_EVENT_TICK" : \ + (event == NRF_RTC_EVENT_OVERFLOW ? "NRF_RTC_EVENT_OVERFLOW" : \ + (event == NRF_RTC_EVENT_COMPARE_0 ? "NRF_RTC_EVENT_COMPARE_0" : \ + (event == NRF_RTC_EVENT_COMPARE_1 ? "NRF_RTC_EVENT_COMPARE_1" : \ + (event == NRF_RTC_EVENT_COMPARE_2 ? "NRF_RTC_EVENT_COMPARE_2" : \ + (event == NRF_RTC_EVENT_COMPARE_3 ? "NRF_RTC_EVENT_COMPARE_3" : "UNKNOWN EVENT") +#else //RTC_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //RTC_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + +/**@brief RTC driver instance control block structure. */ +typedef struct +{ + nrf_drv_state_t state; /**< Instance state. */ + bool reliable; /**< Reliable mode flag. */ + uint8_t tick_latency; /**< Maximum length of interrupt handler in ticks (max 7.7 ms). */ +} nrf_drv_rtc_cb_t; + +// User callbacks local storage. +static nrf_drv_rtc_handler_t m_handlers[ENABLED_RTC_COUNT]; +static nrf_drv_rtc_cb_t m_cb[ENABLED_RTC_COUNT]; + +ret_code_t nrf_drv_rtc_init(nrf_drv_rtc_t const * const p_instance, + nrf_drv_rtc_config_t const * p_config, + nrf_drv_rtc_handler_t handler) +{ + ASSERT(p_config); + + ret_code_t err_code; + + if (handler) + { + m_handlers[p_instance->instance_id] = handler; + } + else + { + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if (m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED) + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + nrf_drv_common_irq_enable(p_instance->irq, p_config->interrupt_priority); + nrf_rtc_prescaler_set(p_instance->p_reg, p_config->prescaler); + m_cb[p_instance->instance_id].reliable = p_config->reliable; + m_cb[p_instance->instance_id].tick_latency = p_config->tick_latency; + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED; + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + +void nrf_drv_rtc_uninit(nrf_drv_rtc_t const * const p_instance) +{ + uint32_t mask = NRF_RTC_INT_TICK_MASK | + NRF_RTC_INT_OVERFLOW_MASK | + NRF_RTC_INT_COMPARE0_MASK | + NRF_RTC_INT_COMPARE1_MASK | + NRF_RTC_INT_COMPARE2_MASK | + NRF_RTC_INT_COMPARE3_MASK; + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_drv_common_irq_disable(p_instance->irq); + + nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_STOP); + nrf_rtc_event_disable(p_instance->p_reg, mask); + nrf_rtc_int_disable(p_instance->p_reg, mask); + + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Uninitialized.\r\n"); +} + +void nrf_drv_rtc_enable(nrf_drv_rtc_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_INITIALIZED); + + nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_START); + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Enabled.\r\n"); +} + +void nrf_drv_rtc_disable(nrf_drv_rtc_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_STOP); + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED; + NRF_LOG_INFO("Disabled.\r\n"); +} + +ret_code_t nrf_drv_rtc_cc_disable(nrf_drv_rtc_t const * const p_instance, uint32_t channel) +{ + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(channelcc_channel_count); + + ret_code_t err_code; + uint32_t int_mask = RTC_CHANNEL_INT_MASK(channel); + nrf_rtc_event_t event = RTC_CHANNEL_EVENT_ADDR(channel); + + nrf_rtc_event_disable(p_instance->p_reg,int_mask); + if (nrf_rtc_int_is_enabled(p_instance->p_reg,int_mask)) + { + nrf_rtc_int_disable(p_instance->p_reg,int_mask); + if (nrf_rtc_event_pending(p_instance->p_reg,event)) + { + nrf_rtc_event_clear(p_instance->p_reg,event); + err_code = NRF_ERROR_TIMEOUT; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + } + NRF_LOG_INFO("RTC id: %d, channel disabled: %d.\r\n", p_instance->instance_id, channel); + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + +ret_code_t nrf_drv_rtc_cc_set(nrf_drv_rtc_t const * const p_instance, + uint32_t channel, + uint32_t val, + bool enable_irq) +{ + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(channelcc_channel_count); + + ret_code_t err_code; + uint32_t int_mask = RTC_CHANNEL_INT_MASK(channel); + nrf_rtc_event_t event = RTC_CHANNEL_EVENT_ADDR(channel); + + nrf_rtc_event_disable(p_instance->p_reg, int_mask); + nrf_rtc_int_disable(p_instance->p_reg, int_mask); + + val = RTC_WRAP(val); + if (m_cb[p_instance->instance_id].reliable) + { + nrf_rtc_cc_set(p_instance->p_reg,channel,val); + uint32_t cnt = nrf_rtc_counter_get(p_instance->p_reg); + int32_t diff = cnt - val; + if (cnt < val) + { + diff += RTC_COUNTER_COUNTER_Msk; + } + if (diff < m_cb[p_instance->instance_id].tick_latency) + { + err_code = NRF_ERROR_TIMEOUT; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + } + else + { + nrf_rtc_cc_set(p_instance->p_reg,channel,val); + } + + if (enable_irq) + { + nrf_rtc_event_clear(p_instance->p_reg,event); + nrf_rtc_int_enable(p_instance->p_reg, int_mask); + } + nrf_rtc_event_enable(p_instance->p_reg,int_mask); + + NRF_LOG_INFO("RTC id: %d, channel enabled: %d, compare value: %d.\r\n", p_instance->instance_id, channel, val); + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + +void nrf_drv_rtc_tick_enable(nrf_drv_rtc_t const * const p_instance, bool enable_irq) +{ + nrf_rtc_event_t event = NRF_RTC_EVENT_TICK; + uint32_t mask = NRF_RTC_INT_TICK_MASK; + + nrf_rtc_event_clear(p_instance->p_reg, event); + nrf_rtc_event_enable(p_instance->p_reg, mask); + if (enable_irq) + { + nrf_rtc_int_enable(p_instance->p_reg, mask); + } + NRF_LOG_INFO("Tick events enabled.\r\n"); +} + +void nrf_drv_rtc_tick_disable(nrf_drv_rtc_t const * const p_instance) +{ + uint32_t mask = NRF_RTC_INT_TICK_MASK; + + nrf_rtc_event_disable(p_instance->p_reg, mask); + nrf_rtc_int_disable(p_instance->p_reg, mask); + NRF_LOG_INFO("Tick events disabled.\r\n"); +} + +void nrf_drv_rtc_overflow_enable(nrf_drv_rtc_t const * const p_instance, bool enable_irq) +{ + nrf_rtc_event_t event = NRF_RTC_EVENT_OVERFLOW; + uint32_t mask = NRF_RTC_INT_OVERFLOW_MASK; + + nrf_rtc_event_clear(p_instance->p_reg, event); + nrf_rtc_event_enable(p_instance->p_reg, mask); + if (enable_irq) + { + nrf_rtc_int_enable(p_instance->p_reg, mask); + } +} +void nrf_drv_rtc_overflow_disable(nrf_drv_rtc_t const * const p_instance) +{ + uint32_t mask = NRF_RTC_INT_OVERFLOW_MASK; + nrf_rtc_event_disable(p_instance->p_reg, mask); + nrf_rtc_int_disable(p_instance->p_reg, mask); +} + +uint32_t nrf_drv_rtc_max_ticks_get(nrf_drv_rtc_t const * const p_instance) +{ + uint32_t ticks; + if (m_cb[p_instance->instance_id].reliable) + { + ticks = RTC_COUNTER_COUNTER_Msk - m_cb[p_instance->instance_id].tick_latency; + } + else + { + ticks = RTC_COUNTER_COUNTER_Msk; + } + return ticks; +} + +/**@brief Generic function for handling RTC interrupt + * + * @param[in] p_reg Pointer to instance register structure. + * @param[in] instance_id Index of instance. + */ +__STATIC_INLINE void nrf_drv_rtc_int_handler(NRF_RTC_Type * p_reg, + uint32_t instance_id, + uint32_t channel_count) +{ + uint32_t i; + uint32_t int_mask = (uint32_t)NRF_RTC_INT_COMPARE0_MASK; + nrf_rtc_event_t event = NRF_RTC_EVENT_COMPARE_0; + + for (i = 0; i < channel_count; i++) + { + if (nrf_rtc_int_is_enabled(p_reg,int_mask) && nrf_rtc_event_pending(p_reg,event)) + { + nrf_rtc_event_disable(p_reg,int_mask); + nrf_rtc_int_disable(p_reg,int_mask); + nrf_rtc_event_clear(p_reg,event); + NRF_LOG_DEBUG("Event: %s, instance id: %d.\r\n", + (uint32_t)EVT_TO_STR(event), (uint32_t)instance_id); + m_handlers[instance_id]((nrf_drv_rtc_int_type_t)i); + } + int_mask <<= 1; + event = (nrf_rtc_event_t)((uint32_t)event + sizeof(uint32_t)); + } + event = NRF_RTC_EVENT_TICK; + if (nrf_rtc_int_is_enabled(p_reg,NRF_RTC_INT_TICK_MASK) && + nrf_rtc_event_pending(p_reg, event)) + { + nrf_rtc_event_clear(p_reg, event); + NRF_LOG_DEBUG("Event: %s, instance id: %d.\r\n", (uint32_t)EVT_TO_STR(event), instance_id); + m_handlers[instance_id](NRF_DRV_RTC_INT_TICK); + } + + event = NRF_RTC_EVENT_OVERFLOW; + if (nrf_rtc_int_is_enabled(p_reg,NRF_RTC_INT_OVERFLOW_MASK) && + nrf_rtc_event_pending(p_reg, event)) + { + nrf_rtc_event_clear(p_reg,event); + NRF_LOG_DEBUG("Event: %s, instance id: %d.\r\n", (uint32_t)EVT_TO_STR(event), instance_id); + m_handlers[instance_id](NRF_DRV_RTC_INT_OVERFLOW); + } +} + +#if NRF_MODULE_ENABLED(RTC0) +void RTC0_IRQHandler(void) +{ + nrf_drv_rtc_int_handler(NRF_RTC0,RTC0_INSTANCE_INDEX, NRF_RTC_CC_CHANNEL_COUNT(0)); +} +#endif + +#if NRF_MODULE_ENABLED(RTC1) +void RTC1_IRQHandler(void) +{ + nrf_drv_rtc_int_handler(NRF_RTC1,RTC1_INSTANCE_INDEX, NRF_RTC_CC_CHANNEL_COUNT(1)); +} +#endif + +#if NRF_MODULE_ENABLED(RTC2) +void RTC2_IRQHandler(void) +{ + nrf_drv_rtc_int_handler(NRF_RTC2,RTC2_INSTANCE_INDEX, NRF_RTC_CC_CHANNEL_COUNT(2)); +} +#endif +#endif //ENABLED_RTC_COUNT +#endif //NRF_MODULE_ENABLED(RTC) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rtc/nrf_drv_rtc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rtc/nrf_drv_rtc.h new file mode 100644 index 0000000000..a16857eacb --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/rtc/nrf_drv_rtc.h @@ -0,0 +1,364 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_DRV_RTC_H +#define NRF_DRV_RTC_H + + +#include "sdk_config.h" +#include "nordic_common.h" +#include "nrf_drv_common.h" +#include "nrf_rtc.h" +#include "sdk_errors.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup nrf_rtc RTC HAL and driver + * @ingroup nrf_drivers + * @brief Real timer counter (RTC) APIs. + * @details The RTC HAL provides basic APIs for accessing the registers of the real time counter (RTC). + * The RTC driver provides APIs on a higher level. + * + * @defgroup nrf_drv_rtc RTC driver + * @{ + * @ingroup nrf_rtc + * @brief Real timer counter (RTC) driver. + */ + +/**@brief Macro to convert microseconds into ticks. */ +#define RTC_US_TO_TICKS(us,freq) ((us * freq) / 1000000) + +/** + * @enum nrf_drv_rtc_int_type_t + * @brief RTC driver interrupt types. + */ +typedef enum +{ + NRF_DRV_RTC_INT_COMPARE0 = 0, /**< Interrupt from COMPARE0 event. */ + NRF_DRV_RTC_INT_COMPARE1 = 1, /**< Interrupt from COMPARE1 event. */ + NRF_DRV_RTC_INT_COMPARE2 = 2, /**< Interrupt from COMPARE2 event. */ + NRF_DRV_RTC_INT_COMPARE3 = 3, /**< Interrupt from COMPARE3 event. */ + NRF_DRV_RTC_INT_TICK = 4, /**< Interrupt from TICK event. */ + NRF_DRV_RTC_INT_OVERFLOW = 5 /**< Interrupt from OVERFLOW event. */ +} nrf_drv_rtc_int_type_t; + +/**@brief RTC driver instance structure. */ +typedef struct +{ + NRF_RTC_Type * p_reg; /**< Pointer to instance register set. */ + IRQn_Type irq; /**< Instance IRQ ID. */ + uint8_t instance_id; /**< Instance index. */ + uint8_t cc_channel_count; /**< Number of capture/compare channels. */ +} nrf_drv_rtc_t; + +#define RTC0_INSTANCE_INDEX 0 +#define RTC1_INSTANCE_INDEX RTC0_INSTANCE_INDEX+RTC0_ENABLED +#define RTC2_INSTANCE_INDEX RTC1_INSTANCE_INDEX+RTC1_ENABLED + +/**@brief Macro for creating RTC driver instance.*/ +#define NRF_DRV_RTC_INSTANCE(id) \ +{ \ + .p_reg = CONCAT_2(NRF_RTC, id), \ + .irq = CONCAT_3(RTC, id, _IRQn), \ + .instance_id = CONCAT_3(RTC, id, _INSTANCE_INDEX),\ + .cc_channel_count = NRF_RTC_CC_CHANNEL_COUNT(id), \ +} + +/**@brief RTC driver instance configuration structure. */ +typedef struct +{ + uint16_t prescaler; /**< Prescaler. */ + uint8_t interrupt_priority; /**< Interrupt priority. */ + uint8_t tick_latency; /**< Maximum length of interrupt handler in ticks (max 7.7 ms). */ + bool reliable; /**< Reliable mode flag. */ +} nrf_drv_rtc_config_t; + +/**@brief RTC instance default configuration. */ +#define NRF_DRV_RTC_DEFAULT_CONFIG \ +{ \ + .prescaler = RTC_FREQ_TO_PRESCALER(RTC_DEFAULT_CONFIG_FREQUENCY), \ + .interrupt_priority = RTC_DEFAULT_CONFIG_IRQ_PRIORITY, \ + .reliable = RTC_DEFAULT_CONFIG_RELIABLE, \ + .tick_latency = RTC_US_TO_TICKS(NRF_MAXIMUM_LATENCY_US, RTC_DEFAULT_CONFIG_FREQUENCY), \ +} + +/**@brief RTC driver instance handler type. */ +typedef void (*nrf_drv_rtc_handler_t)(nrf_drv_rtc_int_type_t int_type); + +/**@brief Function for initializing the RTC driver instance. + * + * After initialization, the instance is in power off state. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_config Initial configuration. Default configuration used if NULL. + * @param[in] handler User's event handler. + * + * @retval NRF_SUCCESS If successfully initialized. + * @retval NRF_ERROR_INVALID_PARAM If no handler was provided. + * @retval NRF_ERROR_INVALID_STATE If the instance is already initialized. + */ +ret_code_t nrf_drv_rtc_init(nrf_drv_rtc_t const * const p_instance, + nrf_drv_rtc_config_t const * p_config, + nrf_drv_rtc_handler_t handler); + +/**@brief Function for uninitializing the RTC driver instance. + * + * After uninitialization, the instance is in idle state. The hardware should return to the state + * before initialization. The function asserts if the instance is in idle state. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_rtc_uninit(nrf_drv_rtc_t const * const p_instance); + +/**@brief Function for enabling the RTC driver instance. + * + * @note Function asserts if instance is enabled. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_rtc_enable(nrf_drv_rtc_t const * const p_instance); + +/**@brief Function for disabling the RTC driver instance. + * + * @note Function asserts if instance is disabled. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_rtc_disable(nrf_drv_rtc_t const * const p_instance); + +/**@brief Function for setting a compare channel. + * + * The function asserts if the instance is not initialized or if the channel parameter is + * wrong. The function powers on the instance if the instance was in power off state. + * + * The driver is not entering a critical section when configuring RTC, which means that it can be + * preempted for a certain amount of time. When the driver was preempted and the value to be set + * is short in time, there is a risk that the driver sets a compare value that is + * behind. If RTCn_CONFIG_RELIABLE is 1 for the given instance, the Reliable mode handles that case. + * However, to detect if the requested value is behind, this mode makes the following assumptions: + * - The maximum preemption time in ticks (8 - bit value) is known and is less than 7.7 ms + * (for prescaler = 0, RTC frequency 32 kHz). + * - The requested absolute compare value is not bigger than (0x00FFFFFF) - tick_latency. It is + * the user's responsibility to ensure that. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] channel One of the instance's channels. + * @param[in] val Absolute value to be set in the compare register. + * @param[in] enable_irq True to enable the interrupt. False to disable the interrupt. + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_TIMEOUT If the compare was not set because the request value is behind the current counter + * value. This error can only be reported if RTCn_CONFIG_RELIABLE = 1. + */ +ret_code_t nrf_drv_rtc_cc_set(nrf_drv_rtc_t const * const p_instance, + uint32_t channel, + uint32_t val, + bool enable_irq); + +/**@brief Function for disabling a channel. + * + * This function disables channel events and channel interrupts. The function asserts if the instance is not + * initialized or if the channel parameter is wrong. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] channel One of the instance's channels. + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_TIMEOUT If an interrupt was pending on the requested channel. + */ +ret_code_t nrf_drv_rtc_cc_disable(nrf_drv_rtc_t const * const p_instance, uint32_t channel); + +/**@brief Function for enabling tick. + * + * This function enables the tick event and optionally the interrupt. The function asserts if the instance is not + * powered on. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] enable_irq True to enable the interrupt. False to disable the interrupt. + */ +void nrf_drv_rtc_tick_enable(nrf_drv_rtc_t const * const p_instance, bool enable_irq); + +/**@brief Function for disabling tick. + * + * This function disables the tick event and interrupt. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_rtc_tick_disable(nrf_drv_rtc_t const * const p_instance); + +/**@brief Function for enabling overflow. + * + * This function enables the overflow event and optionally the interrupt. The function asserts if the instance is + * not powered on. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] enable_irq True to enable the interrupt. False to disable the interrupt. + */ +void nrf_drv_rtc_overflow_enable(nrf_drv_rtc_t const * const p_instance, bool enable_irq); + +/**@brief Function for disabling overflow. + * + * This function disables the overflow event and interrupt. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_rtc_overflow_disable(nrf_drv_rtc_t const * const p_instance); + +/**@brief Function for getting the maximum relative ticks value that can be set in the compare channel. + * + * When a SoftDevice is used, it occupies the highest level interrupt, so that the application code can be + * interrupted at any moment for a certain period of time. If Reliable mode is enabled, the provided + * maximum latency is taken into account and the return value is smaller than the RTC counter + * resolution. If Reliable mode is disabled, the return value equals the counter resolution. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval ticks Maximum ticks value. + */ +uint32_t nrf_drv_rtc_max_ticks_get(nrf_drv_rtc_t const * const p_instance); + +/**@brief Function for disabling all instance interrupts. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_mask Pointer to the location where the mask is filled. + */ +__STATIC_INLINE void nrf_drv_rtc_int_disable(nrf_drv_rtc_t const * const p_instance, + uint32_t * p_mask); + +/**@brief Function for enabling instance interrupts. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] mask Mask of interrupts to enable. + */ +__STATIC_INLINE void nrf_drv_rtc_int_enable(nrf_drv_rtc_t const * const p_instance, uint32_t mask); + +/**@brief Function for retrieving the current counter value. + * + * This function asserts if the instance is not powered on or if p_val is NULL. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval value Counter value. + */ +__STATIC_INLINE uint32_t nrf_drv_rtc_counter_get(nrf_drv_rtc_t const * const p_instance); + +/**@brief Function for clearing the counter value. + * + * This function asserts if the instance is not powered on. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +__STATIC_INLINE void nrf_drv_rtc_counter_clear(nrf_drv_rtc_t const * const p_instance); + +/**@brief Function for returning a requested task address for the RTC driver instance. + * + * This function asserts if the output pointer is NULL. The task address can be used by the PPI module. + * + * @param[in] p_instance Pointer to the instance. + * @param[in] task One of the peripheral tasks. + * + * @retval Address of task register. + */ +__STATIC_INLINE uint32_t nrf_drv_rtc_task_address_get(nrf_drv_rtc_t const * const p_instance, + nrf_rtc_task_t task); + +/**@brief Function for returning a requested event address for the RTC driver instance. + * + * This function asserts if the output pointer is NULL. The event address can be used by the PPI module. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] event One of the peripheral events. + * + * @retval Address of event register. + */ +__STATIC_INLINE uint32_t nrf_drv_rtc_event_address_get(nrf_drv_rtc_t const * const p_instance, + nrf_rtc_event_t event); +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_drv_rtc_int_disable(nrf_drv_rtc_t const * const p_instance, + uint32_t * p_mask) +{ + *p_mask = nrf_rtc_int_get(p_instance->p_reg); + nrf_rtc_int_disable(p_instance->p_reg, NRF_RTC_INT_TICK_MASK | + NRF_RTC_INT_OVERFLOW_MASK | + NRF_RTC_INT_COMPARE0_MASK | + NRF_RTC_INT_COMPARE1_MASK | + NRF_RTC_INT_COMPARE2_MASK | + NRF_RTC_INT_COMPARE3_MASK); +} + +__STATIC_INLINE void nrf_drv_rtc_int_enable(nrf_drv_rtc_t const * const p_instance, uint32_t mask) +{ + nrf_rtc_int_enable(p_instance->p_reg, mask); +} + +__STATIC_INLINE uint32_t nrf_drv_rtc_counter_get(nrf_drv_rtc_t const * const p_instance) +{ + return nrf_rtc_counter_get(p_instance->p_reg); +} + +__STATIC_INLINE void nrf_drv_rtc_counter_clear(nrf_drv_rtc_t const * const p_instance) +{ + nrf_rtc_task_trigger(p_instance->p_reg,NRF_RTC_TASK_CLEAR); +} + +__STATIC_INLINE uint32_t nrf_drv_rtc_task_address_get(nrf_drv_rtc_t const * const p_instance, + nrf_rtc_task_t task) +{ + return nrf_rtc_task_address_get(p_instance->p_reg, task); +} + +__STATIC_INLINE uint32_t nrf_drv_rtc_event_address_get(nrf_drv_rtc_t const * const p_instance, + nrf_rtc_event_t event) +{ + return nrf_rtc_event_address_get(p_instance->p_reg, event); +} +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + +/** + *@} + **/ + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_DRV_RTC_H */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.c index 0412f1bcdf..62312c9a65 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.c @@ -35,19 +35,40 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(SAADC) #include "nrf_drv_saadc.h" #include "nrf_assert.h" -#include "nordic_common.h" #include "nrf_drv_common.h" #include "app_util_platform.h" +#define NRF_LOG_MODULE_NAME "SAADC" + +#if SAADC_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL SAADC_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR SAADC_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR SAADC_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_SAADC_EVENT_STARTED ? "NRF_SAADC_EVENT_STARTED" : \ + (event == NRF_SAADC_EVENT_END ? "NRF_SAADC_EVENT_END" : \ + (event == NRF_SAADC_EVENT_DONE ? "NRF_SAADC_EVENT_DONE" : \ + (event == NRF_SAADC_EVENT_RESULTDONE ? "NRF_SAADC_EVENT_RESULTDONE" : \ + (event == NRF_SAADC_EVENT_CALIBRATEDONE ? "NRF_SAADC_EVENT_CALIBRATEDONE" : \ + (event == NRF_SAADC_EVENT_STOPPED ? "NRF_SAADC_EVENT_STOPPED" : "UNKNOWN EVENT")))))) +#define EVT_TO_STR_LIMIT(event) (event == NRF_SAADC_LIMIT_LOW ? "NRF_SAADC_LIMIT_LOW" : \ + (event == NRF_SAADC_LIMIT_HIGH ? "NRF_SAADC_LIMIT_HIGH" : "UNKNOWN EVENT")) +#else //SAADC_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //SAADC_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + typedef enum { - NRF_SAADC_STATE_IDLE = 0, - NRF_SAADC_STATE_BUSY = 1 + NRF_SAADC_STATE_IDLE = 0, + NRF_SAADC_STATE_BUSY = 1, + NRF_SAADC_STATE_CALIBRATION = 2 } nrf_saadc_state_t; @@ -63,47 +84,45 @@ static const nrf_drv_saadc_config_t m_default_config = NRF_DRV_SAADC_DEFAULT_CON typedef struct { nrf_drv_saadc_event_handler_t event_handler; ///< Event handler function pointer. - volatile nrf_saadc_value_t * p_buffer; ///< Sample buffer. + volatile nrf_saadc_value_t * p_buffer; ///< Sample buffer. volatile uint16_t buffer_size; ///< Size of the sample buffer. -#ifdef NRF52_PAN_28 - volatile uint16_t buffer_pos; ///< Current sample buffer position. -#endif - volatile nrf_saadc_value_t * p_secondary_buffer; ///< Secondary sample buffer. + volatile nrf_saadc_value_t * p_secondary_buffer; ///< Secondary sample buffer. uint32_t limits_enabled_flags; ///< Enabled limits flags. uint16_t secondary_buffer_size; ///< Size of the secondary buffer. + uint16_t buffer_size_left; ///< When low power mode is active indicates how many samples left to convert on current buffer. nrf_saadc_psel_buffer psel[NRF_SAADC_CHANNEL_COUNT]; ///< Pin configurations of SAADC channels. nrf_drv_state_t state; ///< Driver initialization state. nrf_saadc_state_t adc_state; ///< State of the SAADC. -#ifdef NRF52_PAN_28 - uint8_t scan_pos; ///< Current channel scanning position. -#endif uint8_t active_channels; ///< Number of enabled SAADC channels. + bool low_power_mode; ///< Indicates if low power mode is active. + bool conversions_end; ///< When low power mode is active indicates end of conversions on current buffer. } nrf_drv_saadc_cb_t; static nrf_drv_saadc_cb_t m_cb; -#define LOW_LIMIT_TO_FLAG(channel) ((2*channel+1)) -#define HIGH_LIMIT_TO_FLAG(channel) ((2*channel)) -#define FLAG_IDX_TO_EVENT(idx) ((nrf_saadc_event_t)((uint32_t)NRF_SAADC_EVENT_CH0_LIMITH+4*idx)) -#define LIMIT_EVENT_TO_CHANNEL(event)(uint8_t)(((uint32_t)event-(uint32_t)NRF_SAADC_EVENT_CH0_LIMITH)/8) -#define LIMIT_EVENT_TO_LIMIT_TYPE(event)((((uint32_t)event-(uint32_t)NRF_SAADC_EVENT_CH0_LIMITH) & 4) ? \ - NRF_SAADC_LIMIT_LOW : NRF_SAADC_LIMIT_HIGH) +#define LOW_LIMIT_TO_FLAG(channel) ((2 * channel + 1)) +#define HIGH_LIMIT_TO_FLAG(channel) ((2 * channel)) +#define FLAG_IDX_TO_EVENT(idx) ((nrf_saadc_event_t)((uint32_t)NRF_SAADC_EVENT_CH0_LIMITH + \ + 4 * idx)) +#define LIMIT_EVENT_TO_CHANNEL(event) (uint8_t)(((uint32_t)event - \ + (uint32_t)NRF_SAADC_EVENT_CH0_LIMITH) / 8) +#define LIMIT_EVENT_TO_LIMIT_TYPE(event)((((uint32_t)event - (uint32_t)NRF_SAADC_EVENT_CH0_LIMITH) & 4) \ + ? NRF_SAADC_LIMIT_LOW : NRF_SAADC_LIMIT_HIGH) #define HW_TIMEOUT 10000 - void SAADC_IRQHandler(void) { if (nrf_saadc_event_check(NRF_SAADC_EVENT_END)) { nrf_saadc_event_clear(NRF_SAADC_EVENT_END); -#ifdef NRF52_PAN_28 - if (m_cb.active_channels == 1) + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_SAADC_EVENT_END)); + + if (!m_cb.low_power_mode || m_cb.conversions_end) { -#endif nrf_drv_saadc_evt_t evt; - evt.type = NRF_DRV_SAADC_EVT_DONE; + evt.type = NRF_DRV_SAADC_EVT_DONE; evt.data.done.p_buffer = (nrf_saadc_value_t *)m_cb.p_buffer; - evt.data.done.size = nrf_saadc_amount_get(); + evt.data.done.size = m_cb.buffer_size; if (m_cb.p_secondary_buffer == NULL) { @@ -111,96 +130,94 @@ void SAADC_IRQHandler(void) } else { - m_cb.p_buffer = m_cb.p_secondary_buffer; - m_cb.buffer_size = m_cb.secondary_buffer_size; + m_cb.p_buffer = m_cb.p_secondary_buffer; + m_cb.buffer_size = m_cb.secondary_buffer_size; m_cb.p_secondary_buffer = NULL; - nrf_saadc_task_trigger(NRF_SAADC_TASK_START); + if (!m_cb.low_power_mode) + { + nrf_saadc_task_trigger(NRF_SAADC_TASK_START); + } } - m_cb.event_handler(&evt); -#ifdef NRF52_PAN_28 + m_cb.conversions_end = false; } - else + } + if (m_cb.low_power_mode && nrf_saadc_event_check(NRF_SAADC_EVENT_STARTED)) + { + nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_SAADC_EVENT_STARTED)); + + if (m_cb.buffer_size_left == 0) { - //PAN-28: scan mode is not working correctly, emulated by interrupts - ++(m_cb.buffer_pos); - uint16_t buffer_pos = m_cb.buffer_pos; - if (buffer_pos == m_cb.buffer_size) - { - nrf_drv_saadc_evt_t evt; - evt.type = NRF_DRV_SAADC_EVT_DONE; - evt.data.done.p_buffer = (nrf_saadc_value_t *)(m_cb.p_buffer); - evt.data.done.size = m_cb.buffer_size; - - m_cb.adc_state = NRF_SAADC_STATE_IDLE; - if (m_cb.p_secondary_buffer == NULL) - { - m_cb.adc_state = NRF_SAADC_STATE_IDLE; - } - else - { - (void)nrf_drv_saadc_buffer_convert((nrf_saadc_value_t *)m_cb.p_secondary_buffer, (uint16_t)m_cb.secondary_buffer_size); - } - m_cb.event_handler(&evt); - } - else - { - uint8_t current_scan_pos = m_cb.scan_pos; - - nrf_saadc_channel_input_set(current_scan_pos, - NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); - - nrf_saadc_buffer_init((nrf_saadc_value_t *)(m_cb.p_buffer + m_cb.buffer_pos), 1); - // Find the next enabled channel. - for (++m_cb.scan_pos; m_cb.scan_pos < NRF_SAADC_CHANNEL_COUNT; ++m_cb.scan_pos) - { - if (m_cb.psel[m_cb.scan_pos].pselp) - { - nrf_saadc_channel_input_set(m_cb.scan_pos, - m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln); - nrf_saadc_task_trigger(NRF_SAADC_TASK_START); - nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); - return; - } - } - //if scanning is done prepare for next round. - for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i) - { - if (m_cb.psel[i].pselp) - { - m_cb.scan_pos = i; - break; - } - } - nrf_saadc_channel_input_set(m_cb.scan_pos, - m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln); - nrf_saadc_task_trigger(NRF_SAADC_TASK_START); - } + // Sampling finished, next buffer in progress. + m_cb.buffer_size_left = m_cb.buffer_size - m_cb.active_channels; + nrf_saadc_buffer_init((nrf_saadc_value_t *)&m_cb.p_buffer[m_cb.buffer_size - + m_cb.buffer_size_left], + m_cb.active_channels); } -#endif + else if (m_cb.buffer_size_left > m_cb.active_channels) + { + // More samples to convert than for single event. + m_cb.buffer_size_left -= m_cb.active_channels; + nrf_saadc_buffer_init((nrf_saadc_value_t *)&m_cb.p_buffer[m_cb.buffer_size - + m_cb.buffer_size_left], + m_cb.active_channels); + } + else if ((m_cb.buffer_size_left == m_cb.active_channels) && + + (m_cb.p_secondary_buffer != NULL)) + { + // Samples to convert for one event, prepare next buffer. + m_cb.conversions_end = true; + m_cb.buffer_size_left = 0; + nrf_saadc_buffer_init((nrf_saadc_value_t *)m_cb.p_secondary_buffer, + m_cb.active_channels); + } + + else if (m_cb.buffer_size_left == m_cb.active_channels) + { + // Samples to convert for one event, but no second buffer. + m_cb.conversions_end = true; + m_cb.buffer_size_left = 0; + } + nrf_saadc_event_clear(NRF_SAADC_EVENT_END); + nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); + } + if (nrf_saadc_event_check(NRF_SAADC_EVENT_CALIBRATEDONE)) + { + nrf_saadc_event_clear(NRF_SAADC_EVENT_CALIBRATEDONE); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_SAADC_EVENT_CALIBRATEDONE)); + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + + nrf_drv_saadc_evt_t evt; + evt.type = NRF_DRV_SAADC_EVT_CALIBRATEDONE; + m_cb.event_handler(&evt); } if (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED)) { nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_SAADC_EVENT_STOPPED)); m_cb.adc_state = NRF_SAADC_STATE_IDLE; } else { - uint32_t limit_flags = m_cb.limits_enabled_flags; - uint32_t flag_idx; + uint32_t limit_flags = m_cb.limits_enabled_flags; + uint32_t flag_idx; nrf_saadc_event_t event; + while (limit_flags) { - flag_idx = __CLZ(limit_flags); - limit_flags &= ~((1UL<<31) >> flag_idx); - event = FLAG_IDX_TO_EVENT(flag_idx); + flag_idx = __CLZ(limit_flags); + limit_flags &= ~((1UL << 31) >> flag_idx); + event = FLAG_IDX_TO_EVENT(flag_idx); if (nrf_saadc_event_check(event)) { nrf_saadc_event_clear(event); nrf_drv_saadc_evt_t evt; - evt.type = NRF_DRV_SAADC_EVT_LIMIT; - evt.data.limit.channel = LIMIT_EVENT_TO_CHANNEL(event); + evt.type = NRF_DRV_SAADC_EVT_LIMIT; + evt.data.limit.channel = LIMIT_EVENT_TO_CHANNEL(event); evt.data.limit.limit_type = LIMIT_EVENT_TO_LIMIT_TYPE(event); + NRF_LOG_DEBUG("Event limit, channel: %d, limit type: %s.\r\n", evt.data.limit.channel, (uint32_t)EVT_TO_STR(evt.data.limit.limit_type)); m_cb.event_handler(&evt); } } @@ -209,15 +226,23 @@ void SAADC_IRQHandler(void) ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config, - nrf_drv_saadc_event_handler_t event_handler) + nrf_drv_saadc_event_handler_t event_handler) { + ret_code_t err_code; + if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", + (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } if (event_handler == NULL) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", + (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } if (p_config == NULL) @@ -228,42 +253,48 @@ ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config, m_cb.event_handler = event_handler; nrf_saadc_resolution_set(p_config->resolution); nrf_saadc_oversample_set(p_config->oversample); - m_cb.state = NRF_DRV_STATE_INITIALIZED; - m_cb.adc_state = NRF_SAADC_STATE_IDLE; - m_cb.active_channels = 0; + m_cb.low_power_mode = p_config->low_power_mode; + m_cb.state = NRF_DRV_STATE_INITIALIZED; + m_cb.adc_state = NRF_SAADC_STATE_IDLE; + m_cb.active_channels = 0; m_cb.limits_enabled_flags = 0; -#ifdef NRF52_PAN_28 - m_cb.buffer_pos = 0; -#endif + m_cb.conversions_end = false; nrf_saadc_int_disable(NRF_SAADC_INT_ALL); nrf_saadc_event_clear(NRF_SAADC_EVENT_END); nrf_drv_common_irq_enable(SAADC_IRQn, p_config->interrupt_priority); nrf_saadc_int_enable(NRF_SAADC_INT_END); + if (m_cb.low_power_mode) + { + nrf_saadc_int_enable(NRF_SAADC_INT_STARTED); + } nrf_saadc_enable(); - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } void nrf_drv_saadc_uninit(void) { ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_saadc_int_disable(NRF_SAADC_INT_ALL); nrf_drv_common_irq_disable(SAADC_IRQn); nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP); // Wait for ADC being stopped. uint32_t timeout = HW_TIMEOUT; + while (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED) == 0 && timeout > 0) { --timeout; } ASSERT(timeout > 0); - - nrf_saadc_disable(); - nrf_saadc_int_disable(NRF_SAADC_INT_ALL); + nrf_saadc_disable(); m_cb.adc_state = NRF_SAADC_STATE_IDLE; for (uint8_t channel = 0; channel < NRF_SAADC_CHANNEL_COUNT; ++channel) @@ -278,20 +309,27 @@ void nrf_drv_saadc_uninit(void) } -ret_code_t nrf_drv_saadc_channel_init(uint8_t channel, +ret_code_t nrf_drv_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const p_config) { ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); ASSERT(channel < NRF_SAADC_CHANNEL_COUNT); - //Oversampling can be used only with one channel. - ASSERT((nrf_saadc_oversample_get()==NRF_SAADC_OVERSAMPLE_DISABLED) || (m_cb.active_channels == 0)); - ASSERT((p_config->pin_p <= NRF_SAADC_INPUT_VDD) && (p_config->pin_p > NRF_SAADC_INPUT_DISABLED)); + // Oversampling can be used only with one channel. + ASSERT((nrf_saadc_oversample_get() == NRF_SAADC_OVERSAMPLE_DISABLED) || + (m_cb.active_channels == 0)); + ASSERT((p_config->pin_p <= NRF_SAADC_INPUT_VDD) && + (p_config->pin_p > NRF_SAADC_INPUT_DISABLED)); ASSERT(p_config->pin_n <= NRF_SAADC_INPUT_VDD); + ret_code_t err_code; + // A channel can only be initialized if the driver is in the idle state. - if (m_cb.adc_state == NRF_SAADC_STATE_BUSY) + if (m_cb.adc_state != NRF_SAADC_STATE_IDLE) { - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", + (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } if (!m_cb.psel[channel].pselp) @@ -301,25 +339,28 @@ ret_code_t nrf_drv_saadc_channel_init(uint8_t channel, m_cb.psel[channel].pselp = p_config->pin_p; m_cb.psel[channel].pseln = p_config->pin_n; nrf_saadc_channel_init(channel, p_config); - -#ifdef NRF52_PAN_28 - nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); -#else nrf_saadc_channel_input_set(channel, p_config->pin_p, p_config->pin_n); -#endif - return NRF_SUCCESS; + NRF_LOG_INFO("Channel initialized: %d.\r\n", channel); + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } ret_code_t nrf_drv_saadc_channel_uninit(uint8_t channel) { - ASSERT(channel <= NRF_SAADC_CHANNEL_COUNT) + ASSERT(channel < NRF_SAADC_CHANNEL_COUNT) ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + ret_code_t err_code; + // A channel can only be uninitialized if the driver is in the idle state. - if (m_cb.adc_state == NRF_SAADC_STATE_BUSY) + if (m_cb.adc_state != NRF_SAADC_STATE_IDLE) { - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", + (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } if (m_cb.psel[channel].pselp) @@ -330,20 +371,35 @@ ret_code_t nrf_drv_saadc_channel_uninit(uint8_t channel) m_cb.psel[channel].pseln = NRF_SAADC_INPUT_DISABLED; nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); nrf_drv_saadc_limits_set(channel, NRF_DRV_SAADC_LIMITL_DISABLED, NRF_DRV_SAADC_LIMITH_DISABLED); + NRF_LOG_INFO("Channel denitialized: %d.\r\n", channel); - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", + (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } + +uint32_t nrf_drv_saadc_sample_task_get(void) +{ + return nrf_saadc_task_address_get( + m_cb.low_power_mode ? NRF_SAADC_TASK_START : NRF_SAADC_TASK_SAMPLE); +} + + ret_code_t nrf_drv_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_value) { + ret_code_t err_code; + if (m_cb.adc_state != NRF_SAADC_STATE_IDLE) { - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } m_cb.adc_state = NRF_SAADC_STATE_BUSY; - nrf_saadc_int_disable(NRF_SAADC_INT_END); + nrf_saadc_int_disable(NRF_SAADC_INT_STARTED | NRF_SAADC_INT_END); nrf_saadc_buffer_init(p_value, 1); -#ifndef NRF52_PAN_28 if (m_cb.active_channels > 1) { for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i) @@ -351,22 +407,21 @@ ret_code_t nrf_drv_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_v nrf_saadc_channel_input_set(i, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); } } -#endif nrf_saadc_channel_input_set(channel, - m_cb.psel[channel].pselp, m_cb.psel[channel].pseln); + m_cb.psel[channel].pselp, m_cb.psel[channel].pseln); nrf_saadc_task_trigger(NRF_SAADC_TASK_START); nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); uint32_t timeout = HW_TIMEOUT; + while (0 == nrf_saadc_event_check(NRF_SAADC_EVENT_END) && timeout > 0) { timeout--; } nrf_saadc_event_clear(NRF_SAADC_EVENT_END); -#ifdef NRF52_PAN_28 - nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); -#else + NRF_LOG_INFO("Conversion value: %d, channel.\r\n", *p_value, channel); + if (m_cb.active_channels > 1) { for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i) @@ -374,140 +429,182 @@ ret_code_t nrf_drv_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_v nrf_saadc_channel_input_set(i, m_cb.psel[i].pselp, m_cb.psel[i].pseln); } } -#endif - nrf_saadc_int_enable(NRF_SAADC_INT_END); + if (m_cb.low_power_mode) + { + nrf_saadc_int_enable(NRF_SAADC_INT_STARTED | NRF_SAADC_INT_END); + } + else + { + nrf_saadc_int_enable(NRF_SAADC_INT_END); + } + m_cb.adc_state = NRF_SAADC_STATE_IDLE; - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } + ret_code_t nrf_drv_saadc_buffer_convert(nrf_saadc_value_t * p_buffer, uint16_t size) { ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT((size % m_cb.active_channels) == 0); + ret_code_t err_code; - nrf_saadc_int_disable(NRF_SAADC_INT_END); + + nrf_saadc_int_disable(NRF_SAADC_INT_END | NRF_SAADC_INT_CALIBRATEDONE); + if (m_cb.adc_state == NRF_SAADC_STATE_CALIBRATION) + { + nrf_saadc_int_enable(NRF_SAADC_INT_END | NRF_SAADC_INT_CALIBRATEDONE); + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } if (m_cb.adc_state == NRF_SAADC_STATE_BUSY) { if ( m_cb.p_secondary_buffer) { nrf_saadc_int_enable(NRF_SAADC_INT_END); - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } else { - m_cb.p_secondary_buffer = p_buffer; + m_cb.p_secondary_buffer = p_buffer; m_cb.secondary_buffer_size = size; -#ifdef NRF52_PAN_28 - if (m_cb.active_channels == 1) -#endif + if (!m_cb.low_power_mode) { while (nrf_saadc_event_check(NRF_SAADC_EVENT_STARTED) == 0); nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED); nrf_saadc_buffer_init(p_buffer, size); } nrf_saadc_int_enable(NRF_SAADC_INT_END); - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } } nrf_saadc_int_enable(NRF_SAADC_INT_END); m_cb.adc_state = NRF_SAADC_STATE_BUSY; -#ifdef NRF52_PAN_28 - m_cb.scan_pos = NRF_SAADC_CHANNEL_COUNT; - for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i) - { - if (m_cb.psel[i].pselp) - { - m_cb.scan_pos = i; - break; - } - } - - // Find the first enabled channel. - if (m_cb.scan_pos >= NRF_SAADC_CHANNEL_COUNT) - { - return NRF_ERROR_INVALID_STATE; - } - - m_cb.buffer_pos = 0; -#endif - m_cb.p_buffer = p_buffer; - m_cb.buffer_size = size; + m_cb.p_buffer = p_buffer; + m_cb.buffer_size = size; m_cb.p_secondary_buffer = NULL; -#ifdef NRF52_PAN_28 - nrf_saadc_channel_input_set(m_cb.scan_pos, - m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln); + NRF_LOG_INFO("Function: %d, buffer length: %d, active channels: %d.\r\n", + (uint32_t)__func__, size, m_cb.active_channels); - if (m_cb.active_channels == 1) + if (m_cb.low_power_mode) { - nrf_saadc_buffer_init(p_buffer, size); + m_cb.buffer_size_left = size; + nrf_saadc_buffer_init(p_buffer, m_cb.active_channels); } else { - nrf_saadc_buffer_init(p_buffer, 1); + nrf_saadc_buffer_init(p_buffer, size); + nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED); + nrf_saadc_task_trigger(NRF_SAADC_TASK_START); } -#else - nrf_saadc_buffer_init(p_buffer, size); -#endif - nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED); - nrf_saadc_task_trigger(NRF_SAADC_TASK_START); - - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } + ret_code_t nrf_drv_saadc_sample() { ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); ret_code_t err_code = NRF_SUCCESS; - if (m_cb.adc_state == NRF_SAADC_STATE_IDLE) + if (m_cb.adc_state != NRF_SAADC_STATE_BUSY) { - err_code = NRF_ERROR_BUSY; + err_code = NRF_ERROR_INVALID_STATE; + } + else if (m_cb.low_power_mode) + { + nrf_saadc_task_trigger(NRF_SAADC_TASK_START); } else { nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); } - + + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +ret_code_t nrf_drv_saadc_calibrate_offset() +{ + ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); + + ret_code_t err_code; + + if (m_cb.adc_state != NRF_SAADC_STATE_IDLE) + { + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + m_cb.adc_state = NRF_SAADC_STATE_CALIBRATION; + + nrf_saadc_event_clear(NRF_SAADC_EVENT_CALIBRATEDONE); + nrf_saadc_int_enable(NRF_SAADC_EVENT_CALIBRATEDONE); + nrf_saadc_task_trigger(NRF_SAADC_TASK_CALIBRATEOFFSET); + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); return err_code; } bool nrf_drv_saadc_is_busy(void) { - return (m_cb.adc_state == NRF_SAADC_STATE_BUSY); + return (m_cb.adc_state != NRF_SAADC_STATE_IDLE); } + void nrf_drv_saadc_abort(void) { if (nrf_drv_saadc_is_busy()) { nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED); nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP); - - // Wait for ADC being stopped. - uint32_t timeout = HW_TIMEOUT; - while ((m_cb.adc_state != NRF_SAADC_STATE_IDLE) && (timeout > 0)) + + if (m_cb.adc_state == NRF_SAADC_STATE_CALIBRATION) { - --timeout; + m_cb.adc_state = NRF_SAADC_STATE_IDLE; } - ASSERT(timeout > 0); - - m_cb.p_buffer = 0; + else + { + // Wait for ADC being stopped. + uint32_t timeout = HW_TIMEOUT; + + while ((m_cb.adc_state != NRF_SAADC_STATE_IDLE) && (timeout > 0)) + { + --timeout; + } + ASSERT(timeout > 0); + } + + m_cb.p_buffer = 0; m_cb.p_secondary_buffer = 0; + NRF_LOG_INFO("Conversion aborted.\r\n"); } } + void nrf_drv_saadc_limits_set(uint8_t channel, int16_t limit_low, int16_t limit_high) { ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED); ASSERT(m_cb.event_handler); // only non blocking mode supported - ASSERT(limit_low>=NRF_DRV_SAADC_LIMITL_DISABLED); - ASSERT(limit_high<=NRF_DRV_SAADC_LIMITH_DISABLED); - ASSERT(limit_low= NRF_DRV_SAADC_LIMITL_DISABLED); + ASSERT(limit_high <= NRF_DRV_SAADC_LIMITH_DISABLED); + ASSERT(limit_low < limit_high); nrf_saadc_channel_limits_set(channel, limit_low, limit_high); uint32_t int_mask = nrf_saadc_limit_int_get(channel, NRF_SAADC_LIMIT_LOW); @@ -534,3 +631,4 @@ void nrf_drv_saadc_limits_set(uint8_t channel, int16_t limit_low, int16_t limit_ nrf_saadc_int_enable(int_mask); } } +#endif //NRF_MODULE_ENABLED(SAADC) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.h index 661177c424..add41dd0ba 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/saadc/nrf_drv_saadc.h @@ -36,12 +36,11 @@ * */ - /** * @addtogroup nrf_saadc SAADC HAL and driver * @ingroup nrf_drivers * @brief @tagAPI52 Successive Approximation Analog-to-Digital Converter (SAADC) APIs. - * @details The SAADC HAL provides basic APIs for accessing the registers of the SAADC peripheral. + * @details The SAADC HAL provides basic APIs for accessing the registers of the SAADC peripheral. * The SAADC driver provides APIs on a higher level. * * @defgroup nrf_drv_saadc SAADC driver @@ -54,9 +53,14 @@ #ifndef NRF_DRV_SAADC_H__ #define NRF_DRV_SAADC_H__ -#include "nrf_drv_config.h" +#include "sdk_config.h" #include "nrf_saadc.h" #include "sdk_errors.h" +#include "nrf_drv_common.h" + +#ifdef __cplusplus +extern "C" { +#endif /** * @brief Value that should be set as high limit to disable limit detection. @@ -70,12 +74,13 @@ /** * @brief Macro for setting @ref nrf_drv_saadc_config_t to default settings. */ -#define NRF_DRV_SAADC_DEFAULT_CONFIG \ -{ \ - .resolution = SAADC_CONFIG_RESOLUTION, \ - .oversample = SAADC_CONFIG_OVERSAMPLE, \ - .interrupt_priority = SAADC_CONFIG_IRQ_PRIORITY \ -} +#define NRF_DRV_SAADC_DEFAULT_CONFIG \ + { \ + .resolution = (nrf_saadc_resolution_t)SAADC_CONFIG_RESOLUTION, \ + .oversample = (nrf_saadc_oversample_t)SAADC_CONFIG_OVERSAMPLE, \ + .interrupt_priority = SAADC_CONFIG_IRQ_PRIORITY, \ + .low_power_mode = SAADC_CONFIG_LP_MODE \ + } /** * @brief Macro for setting @ref nrf_saadc_channel_config_t to default settings @@ -84,16 +89,17 @@ * @param PIN_P Analog input. */ #define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P) \ -{ \ - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \ - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \ - .gain = NRF_SAADC_GAIN1_6, \ - .reference = NRF_SAADC_REFERENCE_INTERNAL, \ - .acq_time = NRF_SAADC_ACQTIME_10US, \ - .mode = NRF_SAADC_MODE_SINGLE_ENDED, \ - .pin_p = (nrf_saadc_input_t)(PIN_P), \ - .pin_n = NRF_SAADC_INPUT_DISABLED \ -} + { \ + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \ + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \ + .gain = NRF_SAADC_GAIN1_6, \ + .reference = NRF_SAADC_REFERENCE_INTERNAL, \ + .acq_time = NRF_SAADC_ACQTIME_10US, \ + .mode = NRF_SAADC_MODE_SINGLE_ENDED, \ + .burst = NRF_SAADC_BURST_DISABLED, \ + .pin_p = (nrf_saadc_input_t)(PIN_P), \ + .pin_n = NRF_SAADC_INPUT_DISABLED \ + } /** * @brief Macro for setting @ref nrf_saadc_channel_config_t to default settings @@ -103,16 +109,16 @@ * @param PIN_N Negative analog input. */ #define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(PIN_P, PIN_N) \ -{ \ - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \ - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \ - .gain = NRF_SAADC_GAIN1_6, \ - .reference = NRF_SAADC_REFERENCE_INTERNAL, \ - .acq_time = NRF_SAADC_ACQTIME_10US, \ - .mode = NRF_SAADC_MODE_DIFFERENTIAL, \ - .pin_p = (nrf_saadc_input_t)(PIN_P), \ - .pin_n = (nrf_saadc_input_t)(PIN_N) \ -} + { \ + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, \ + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, \ + .gain = NRF_SAADC_GAIN1_6, \ + .reference = NRF_SAADC_REFERENCE_INTERNAL, \ + .acq_time = NRF_SAADC_ACQTIME_10US, \ + .mode = NRF_SAADC_MODE_DIFFERENTIAL, \ + .pin_p = (nrf_saadc_input_t)(PIN_P), \ + .pin_n = (nrf_saadc_input_t)(PIN_N) \ + } /** * @brief Analog-to-digital converter driver configuration structure. @@ -122,6 +128,7 @@ typedef struct nrf_saadc_resolution_t resolution; ///< Resolution configuration. nrf_saadc_oversample_t oversample; ///< Oversampling configuration. uint8_t interrupt_priority; ///< Interrupt priority. + bool low_power_mode; ///< Indicates if low power mode is active. } nrf_drv_saadc_config_t; /** @@ -129,8 +136,9 @@ typedef struct */ typedef enum { - NRF_DRV_SAADC_EVT_DONE, ///< Event generated when the buffer is filled with samples. - NRF_DRV_SAADC_EVT_LIMIT, ///< Event generated after one of the limits is reached. + NRF_DRV_SAADC_EVT_DONE, ///< Event generated when the buffer is filled with samples. + NRF_DRV_SAADC_EVT_LIMIT, ///< Event generated after one of the limits is reached. + NRF_DRV_SAADC_EVT_CALIBRATEDONE ///< Event generated when the calibration is complete. } nrf_drv_saadc_evt_type_t; /** @@ -138,8 +146,8 @@ typedef enum */ typedef struct { - nrf_saadc_value_t * p_buffer; ///< Pointer to buffer with converted samples. - uint16_t size; ///< Number of samples in the buffer. + nrf_saadc_value_t * p_buffer; ///< Pointer to buffer with converted samples. + uint16_t size; ///< Number of samples in the buffer. } nrf_drv_saadc_done_evt_t; /** @@ -147,8 +155,8 @@ typedef struct */ typedef struct { - uint8_t channel; ///< Channel on which the limit was detected. - nrf_saadc_limit_t limit_type; ///< Type of limit detected. + uint8_t channel; ///< Channel on which the limit was detected. + nrf_saadc_limit_t limit_type; ///< Type of limit detected. } nrf_drv_saadc_limit_evt_t; /** @@ -156,11 +164,11 @@ typedef struct */ typedef struct { - nrf_drv_saadc_evt_type_t type; ///< Event type. + nrf_drv_saadc_evt_type_t type; ///< Event type. union { - nrf_drv_saadc_done_evt_t done; ///< Data for @ref NRF_DRV_SAADC_EVT_DONE event. - nrf_drv_saadc_limit_evt_t limit;///< Data for @ref NRF_DRV_SAADC_EVT_LIMIT event. + nrf_drv_saadc_done_evt_t done; ///< Data for @ref NRF_DRV_SAADC_EVT_DONE event. + nrf_drv_saadc_limit_evt_t limit; ///< Data for @ref NRF_DRV_SAADC_EVT_LIMIT event. } data; } nrf_drv_saadc_evt_t; @@ -171,7 +179,7 @@ typedef struct * the stack, so it is valid only within the context of * the event handler. */ -typedef void (*nrf_drv_saadc_event_handler_t)(nrf_drv_saadc_evt_t const * p_event); +typedef void (* nrf_drv_saadc_event_handler_t)(nrf_drv_saadc_evt_t const * p_event); /** * @brief Function for initializing the SAADC. @@ -184,7 +192,7 @@ typedef void (*nrf_drv_saadc_event_handler_t)(nrf_drv_saadc_evt_t const * p_even * @retval NRF_ERROR_INVALID_PARAM If event_handler is NULL. */ ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config, - nrf_drv_saadc_event_handler_t event_handler); + nrf_drv_saadc_event_handler_t event_handler); /** * @brief Function for uninitializing the SAADC. @@ -193,16 +201,13 @@ ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config, */ void nrf_drv_saadc_uninit(void); + /** * @brief Function for getting the address of a SAMPLE SAADC task. * * @return Task address. */ -__STATIC_INLINE uint32_t nrf_drv_saadc_sample_task_get(void) -{ - return nrf_saadc_task_address_get(NRF_SAADC_TASK_SAMPLE); -} - +uint32_t nrf_drv_saadc_sample_task_get(void); /** * @brief Function for initializing an SAADC channel. @@ -213,7 +218,7 @@ __STATIC_INLINE uint32_t nrf_drv_saadc_sample_task_get(void) * @retval NRF_ERROR_INVALID_STATE If the ADC was not initialized. * @retval NRF_ERROR_NO_MEM If the specified channel was already allocated. */ -ret_code_t nrf_drv_saadc_channel_init(uint8_t channel, +ret_code_t nrf_drv_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const p_config); @@ -228,8 +233,8 @@ ret_code_t nrf_drv_saadc_channel_uninit(uint8_t channel); /** * @brief Function for starting SAADC sampling. * - * @retval NRF_SUCCESS If ADC sampling was triggered. - * @retval NRF_ERROR_BUSY If ADC is in idle state. + * @retval NRF_SUCCESS If ADC sampling was triggered. + * @retval NRF_ERROR_INVALID_STATE If ADC is in idle state. */ ret_code_t nrf_drv_saadc_sample(void); @@ -258,16 +263,30 @@ ret_code_t nrf_drv_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_v * triggered manually by the @ref nrf_drv_saadc_sample function or by PPI using the @ref NRF_SAADC_TASK_SAMPLE * task. If one buffer is already set and the conversion is ongoing, calling this function will * result in queuing the given buffer. The driver will start filling the issued buffer when the first one is - * completed. If the function is called again before the first buffer is filled, it will return with error. + * completed. If the function is called again before the first buffer is filled or calibration is in progress, + * it will return with error. * * @param[in] buffer Result buffer. * @param[in] size Buffer size in words. * * @retval NRF_SUCCESS If conversion was successful. - * @retval NRF_ERROR_BUSY If the driver already has two buffers set. + * @retval NRF_ERROR_BUSY If the driver already has two buffers set or calibration is in progress. */ ret_code_t nrf_drv_saadc_buffer_convert(nrf_saadc_value_t * buffer, uint16_t size); +/** + * @brief Function for triggering the ADC offset calibration. + * + * This function is non-blocking. The application is notified about completion by the event handler. + * Calibration will also trigger DONE and RESULTDONE events. + * + * The function will fail if ADC is busy or calibration is already in progress. + * + * @retval NRF_SUCCESS If calibration was started successfully. + * @retval NRF_ERROR_BUSY If the ADC driver is busy. + */ +ret_code_t nrf_drv_saadc_calibrate_offset(void); + /** * @brief Function for retrieving the SAADC state. * @@ -297,33 +316,9 @@ void nrf_drv_saadc_abort(void); */ void nrf_drv_saadc_limits_set(uint8_t channel, int16_t limit_low, int16_t limit_high); -/** - * @brief Function for converting a GPIO pin number to an analog input pin number used in the channel - * configuration. - * - * @param[in] pin GPIO pin. - * - * @return Value representing an analog input pin. The function returns @ref NRF_SAADC_INPUT_DISABLED - * if the specified pin is not an analog input. - */ -__STATIC_INLINE nrf_saadc_input_t nrf_drv_saadc_gpio_to_ain(uint32_t pin) -{ - // AIN0 - AIN3 - if (pin >= 2 && pin <= 5) - { - //0 means "not connected", hence this "+ 1" - return (nrf_saadc_input_t)(pin - 2 + 1); - } - // AIN4 - AIN7 - else if (pin >= 28 && pin <= 31) - { - return (nrf_saadc_input_t)(pin - 24 + 1); - } - else - { - return NRF_SAADC_INPUT_DISABLED; - } +#ifdef __cplusplus } +#endif #endif // NRF_DRV_SAADC_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio.c new file mode 100644 index 0000000000..e4ce58d141 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio.c @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2009 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "nrf.h" +#include "nrf_delay.h" +#include "sdio.h" +#include "nrf_gpio.h" + +#include "sdio_config.h" + +/*lint ++flb "Enter library region" */ + +/*lint -e717 -save "Suppress do {} while (0) for these macros" */ +#define SDIO_CLOCK_HIGH() do { NRF_GPIO->OUTSET = (1UL << SDIO_CONFIG_CLOCK_PIN_NUMBER); } while (0) /*!< Pulls SCL line high */ +#define SDIO_CLOCK_LOW() do { NRF_GPIO->OUTCLR = (1UL << SDIO_CONFIG_CLOCK_PIN_NUMBER); } while (0) /*!< Pulls SCL line low */ +#define SDIO_DATA_HIGH() do { NRF_GPIO->OUTSET = (1UL << SDIO_CONFIG_DATA_PIN_NUMBER); } while (0) /*!< Pulls SDA line high */ +#define SDIO_DATA_LOW() do { NRF_GPIO->OUTCLR = (1UL << SDIO_CONFIG_DATA_PIN_NUMBER); } while (0) /*!< Pulls SDA line low */ +#define SDIO_DATA_OUTPUT() do { NRF_GPIO->DIRSET = (1UL << SDIO_CONFIG_DATA_PIN_NUMBER); } while (0) /*!< Configures SDA pin as output */ +#define SDIO_CLOCK_OUTPUT() do { NRF_GPIO->DIRSET = (1UL << SDIO_CONFIG_CLOCK_PIN_NUMBER); } while (0) /*!< Configures SCL pin as output */ +/*lint -restore */ + +/*lint -emacro(845,SDIO_DATA_INPUT) // A zero has been given as right argument to operator '|'" */ + +#define SDIO_DATA_INPUT() do { \ + nrf_gpio_cfg_input(25, NRF_GPIO_PIN_NOPULL); \ +} while (0) + +#define SDIO_DATA_READ() ((NRF_GPIO->IN >> SDIO_CONFIG_DATA_PIN_NUMBER) & 0x1UL) /*!< Reads current state of SDA */ +#define SDIO_CLOCK_READ() ((NRF_GPIO->IN >> SDIO_CONFIG_CLOCK_PIN_NUMBER) & 0x1UL) /*!< Reads current state of SCL */ +#define SDIO_DELAY() nrf_delay_us(10) /*!< Time to wait when pin states are changed. For fast-mode the delay can be zero and for standard-mode 4 us delay is sufficient. */ + +void sdio_init(void) +{ + SDIO_CLOCK_HIGH(); + SDIO_DATA_HIGH(); + SDIO_CLOCK_OUTPUT(); + SDIO_DATA_INPUT(); + + // If slave is stuck in the middle of transfer, clock out bits until the slave ACKs the transfer + for (uint_fast8_t i = 16; i--;) + { + SDIO_DELAY(); + SDIO_CLOCK_LOW(); + SDIO_DELAY(); + SDIO_CLOCK_HIGH(); + SDIO_DELAY(); + + if (SDIO_DATA_READ()) + { + break; + } + } + + for (uint_fast8_t i = 5; i--;) + { + SDIO_DELAY(); + SDIO_CLOCK_LOW(); + SDIO_DELAY(); + SDIO_CLOCK_HIGH(); + } + + SDIO_DATA_OUTPUT(); + SDIO_DATA_HIGH(); + + SDIO_DELAY(); +} + +uint8_t sdio_read_byte(uint8_t address) +{ + uint8_t data_byte = 0; + + SDIO_DATA_OUTPUT(); + + for (uint_fast8_t i = 8; i--;) + { + SDIO_DELAY(); + + SDIO_CLOCK_LOW(); + + if (address & (1U << i)) + { + SDIO_DATA_HIGH(); + } + else + { + SDIO_DATA_LOW(); + } + + SDIO_DELAY(); + + SDIO_CLOCK_HIGH(); + } + + nrf_delay_us(20); + + SDIO_DATA_INPUT(); + + for (uint_fast8_t i = 8; i--;) + { + SDIO_CLOCK_LOW(); + SDIO_DELAY(); + SDIO_CLOCK_HIGH(); + SDIO_DELAY(); + data_byte |= (uint8_t)(SDIO_DATA_READ() << i); + } + + SDIO_DATA_HIGH(); + SDIO_DATA_OUTPUT(); + + SDIO_DELAY(); + + return data_byte; +} + +void sdio_read_burst(uint8_t * target_buffer, uint8_t target_buffer_size) +{ + uint_fast8_t address = 0x63; + + SDIO_DATA_OUTPUT(); + + for (uint_fast8_t bit_index=8; bit_index--;) + { + SDIO_CLOCK_LOW(); + + if (address & (1U << bit_index)) + { + SDIO_DATA_HIGH(); + } + else + { + SDIO_DATA_LOW(); + } + + SDIO_CLOCK_HIGH(); + } + + SDIO_DATA_INPUT(); + + for (uint_fast8_t target_buffer_index = 0; target_buffer_index < target_buffer_size; target_buffer_index++) + { + target_buffer[target_buffer_index] = 0; + + for (uint_fast8_t bit_index = 8; bit_index--;) + { + SDIO_CLOCK_LOW(); + SDIO_CLOCK_HIGH(); + target_buffer[target_buffer_index] |= (uint8_t)(SDIO_DATA_READ() << bit_index); + } + } +} + +void sdio_write_byte(uint8_t address, uint8_t data_byte) +{ + // Add write indication bit + address |= 0x80; + + SDIO_DATA_OUTPUT(); + + for (uint_fast8_t i = 8; i--;) + { + SDIO_DELAY(); + + SDIO_CLOCK_LOW(); + + if (address & (1U << i)) + { + SDIO_DATA_HIGH(); + } + else + { + SDIO_DATA_LOW(); + } + + SDIO_DELAY(); + + SDIO_CLOCK_HIGH(); + } + + SDIO_DELAY(); + + for (uint_fast8_t i = 8; i--;) + { + SDIO_CLOCK_LOW(); + + if (data_byte & (1U << i)) + { + SDIO_DATA_HIGH(); + } + else + { + SDIO_DATA_LOW(); + } + + SDIO_DELAY(); + + SDIO_CLOCK_HIGH(); + + SDIO_DELAY(); + } + + SDIO_DATA_HIGH(); + + SDIO_DELAY(); +} + +/*lint --flb "Leave library region" */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio.h new file mode 100644 index 0000000000..9ef9fd4360 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio.h @@ -0,0 +1,104 @@ + /* + * Copyright (c) 2009 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef SDIO_H +#define SDIO_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** @file +* @brief 2-wire serial interface driver (compatible with ADNS2080 mouse sensor driver) +* +* +* @defgroup nrf_drivers_sdio SDIO driver +* @{ +* @ingroup nrf_drivers +* @brief 2-wire serial interface driver. +*/ + +/** + * @brief Function for initializing 2-wire serial interface and trying to handle stuck slaves. + * + */ +void sdio_init(void); + +/** + * @brief Function for reading a byte over 2-wire serial interface. + * + * Developer needs to implement this function in a way that suits the hardware. + * @param address Register address to read from + * @return Byte read + */ +uint8_t sdio_read_byte(uint8_t address); + +/** + * @brief Function for reading several bytes over 2-wire serial interface using burst mode. + * + * Developer needs to implement this function in a way that suits the hardware. + * @param target_buffer Buffer location to store read bytes to + * @param target_buffer_size Bytes allocated for target_buffer + */ +void sdio_read_burst(uint8_t *target_buffer, uint8_t target_buffer_size); + +/** + * @brief Function for writing a byte over 2-wire serial interface. + * + * Developer needs to implement this function in a way that suits the hardware. + * @param address Register address to write to + * @param data_byte Data byte to write + */ +void sdio_write_byte(uint8_t address, uint8_t data_byte); + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio_config.h similarity index 88% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio_config.h index 28cfa1322e..bd1fc2afea 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/delay/nrf_delay.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio_config.h @@ -35,19 +35,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#ifndef SDIO_CONFIG_H +#define SDIO_CONFIG_H - -#include -#include "compiler_abstraction.h" -#include "nrf.h" -#include "nrf_delay.h" +#ifdef __cplusplus +extern "C" { +#endif -/*lint --e{438} "Variable not used" */ -void nrf_delay_ms(uint32_t volatile number_of_ms) -{ - while(number_of_ms != 0) - { - number_of_ms--; - nrf_delay_us(999); - } +#define SDIO_CONFIG_CLOCK_PIN_NUMBER 24 +#define SDIO_CONFIG_DATA_PIN_NUMBER 25 + + +#ifdef __cplusplus } +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c index de1f287232..e7ffa06acb 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c @@ -36,6 +36,10 @@ * */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(SPI) +#define ENABLED_SPI_COUNT (SPI0_ENABLED+SPI1_ENABLED+SPI2_ENABLED) +#if ENABLED_SPI_COUNT #include "nrf_drv_spi.h" #include "nrf_drv_common.h" @@ -43,8 +47,18 @@ #include "nrf_assert.h" #include "app_util_platform.h" +#define NRF_LOG_MODULE_NAME "SPI" -#ifndef NRF52 +#if SPI_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL SPI_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR SPI_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR SPI_CONFIG_DEBUG_COLOR +#else //SPI_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif //SPI_CONFIG_LOG_ENABLED +#include "nrf_log.h" + +#ifndef SPIM_PRESENT // Make sure SPIx_USE_EASY_DMA is 0 for nRF51 (if a common // "nrf_drv_config.h" file is provided for nRF51 and nRF52). #undef SPI0_USE_EASY_DMA @@ -55,16 +69,28 @@ #define SPI2_USE_EASY_DMA 0 #endif +#ifndef SPI0_USE_EASY_DMA +#define SPI0_USE_EASY_DMA 0 +#endif + +#ifndef SPI1_USE_EASY_DMA +#define SPI1_USE_EASY_DMA 0 +#endif + +#ifndef SPI2_USE_EASY_DMA +#define SPI2_USE_EASY_DMA 0 +#endif + // This set of macros makes it possible to exclude parts of code when one type // of supported peripherals is not used. -#if ((SPI0_ENABLED && SPI0_USE_EASY_DMA) || \ - (SPI1_ENABLED && SPI1_USE_EASY_DMA) || \ - (SPI2_ENABLED && SPI2_USE_EASY_DMA)) +#if ((NRF_MODULE_ENABLED(SPI0) && SPI0_USE_EASY_DMA) || \ + (NRF_MODULE_ENABLED(SPI1) && SPI1_USE_EASY_DMA) || \ + (NRF_MODULE_ENABLED(SPI2) && SPI2_USE_EASY_DMA)) #define SPIM_IN_USE #endif -#if ((SPI0_ENABLED && !SPI0_USE_EASY_DMA) || \ - (SPI1_ENABLED && !SPI1_USE_EASY_DMA) || \ - (SPI2_ENABLED && !SPI2_USE_EASY_DMA)) +#if ((NRF_MODULE_ENABLED(SPI0) && !SPI0_USE_EASY_DMA) || \ + (NRF_MODULE_ENABLED(SPI1) && !SPI1_USE_EASY_DMA) || \ + (NRF_MODULE_ENABLED(SPI2) && !SPI2_USE_EASY_DMA)) #define SPI_IN_USE #endif #if defined(SPIM_IN_USE) && defined(SPI_IN_USE) @@ -84,12 +110,8 @@ #endif #ifdef SPIM_IN_USE -#ifdef NRF52_PAN_23 -#define END_INT_MASK (NRF_SPIM_INT_ENDTX_MASK | NRF_SPIM_INT_ENDRX_MASK) -#else #define END_INT_MASK NRF_SPIM_INT_END_MASK #endif -#endif // Control block - driver instance local data. typedef struct @@ -107,75 +129,63 @@ typedef struct bool tx_done : 1; bool rx_done : 1; - bool abort : 1; } spi_control_block_t; -static spi_control_block_t m_cb[SPI_COUNT]; +static spi_control_block_t m_cb[ENABLED_SPI_COUNT]; -static nrf_drv_spi_config_t const m_default_config[SPI_COUNT] = { -#if SPI0_ENABLED - NRF_DRV_SPI_DEFAULT_CONFIG(0), -#endif -#if SPI1_ENABLED - NRF_DRV_SPI_DEFAULT_CONFIG(1), -#endif -#if SPI2_ENABLED - NRF_DRV_SPI_DEFAULT_CONFIG(2), -#endif -}; - -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n #define IRQ_HANDLER(n) static void IRQ_HANDLER_NAME(n)(void) - #if SPI0_ENABLED + #if NRF_MODULE_ENABLED(SPI0) IRQ_HANDLER(0); #endif - #if SPI1_ENABLED + #if NRF_MODULE_ENABLED(SPI1) IRQ_HANDLER(1); #endif - #if SPI2_ENABLED + #if NRF_MODULE_ENABLED(SPI2) IRQ_HANDLER(2); #endif - static nrf_drv_irq_handler_t const m_irq_handlers[SPI_COUNT] = { - #if SPI0_ENABLED + static nrf_drv_irq_handler_t const m_irq_handlers[ENABLED_SPI_COUNT] = { + #if NRF_MODULE_ENABLED(SPI0) IRQ_HANDLER_NAME(0), #endif - #if SPI1_ENABLED + #if NRF_MODULE_ENABLED(SPI1) IRQ_HANDLER_NAME(1), #endif - #if SPI2_ENABLED + #if NRF_MODULE_ENABLED(SPI2) IRQ_HANDLER_NAME(2), #endif }; #else #define IRQ_HANDLER(n) void SPI##n##_IRQ_HANDLER(void) -#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED +#endif // NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance, nrf_drv_spi_config_t const * p_config, nrf_drv_spi_handler_t handler) { + ASSERT(p_config); spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - + ret_code_t err_code; + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) if (nrf_drv_common_per_res_acquire(p_instance->p_registers, m_irq_handlers[p_instance->drv_inst_idx]) != NRF_SUCCESS) { - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } #endif - if (p_config == NULL) - { - p_config = &m_default_config[p_instance->drv_inst_idx]; - } - p_cb->handler = handler; uint32_t mosi_pin; @@ -230,7 +240,7 @@ ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance, CODE_FOR_SPIM ( - NRF_SPIM_Type * p_spim = (NRF_SPIM_Type * ) p_instance->p_registers; + NRF_SPIM_Type * p_spim = p_instance->p_registers; nrf_spim_pins_set(p_spim, p_config->sck_pin, mosi_pin, miso_pin); nrf_spim_frequency_set(p_spim, (nrf_spim_frequency_t)p_config->frequency); @@ -242,14 +252,14 @@ ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance, if (p_cb->handler) { - nrf_spim_int_enable(p_spim, END_INT_MASK | NRF_SPIM_INT_STOPPED_MASK); + nrf_spim_int_enable(p_spim, END_INT_MASK); } nrf_spim_enable(p_spim); ) CODE_FOR_SPI ( - NRF_SPI_Type * p_spi = (NRF_SPI_Type * ) p_instance->p_registers; + NRF_SPI_Type * p_spi = p_instance->p_registers; nrf_spi_pins_set(p_spi, p_config->sck_pin, mosi_pin, miso_pin); nrf_spi_frequency_set(p_spi, (nrf_spi_frequency_t)p_config->frequency); @@ -275,7 +285,11 @@ ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance, p_cb->transfer_in_progress = false; p_cb->state = NRF_DRV_STATE_INITIALIZED; - return NRF_SUCCESS; + NRF_LOG_INFO("Init\r\n"); + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance) @@ -292,7 +306,7 @@ void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance) CODE_FOR_SPIM ( - NRF_SPIM_Type * p_spim = (NRF_SPIM_Type * ) p_instance->p_registers; + NRF_SPIM_Type * p_spim = p_instance->p_registers; if (p_cb->handler) { nrf_spim_int_disable(p_spim, DISABLE_ALL); @@ -308,7 +322,7 @@ void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance) ) CODE_FOR_SPI ( - NRF_SPI_Type * p_spi = (NRF_SPI_Type * ) p_instance->p_registers; + NRF_SPI_Type * p_spi = p_instance->p_registers; if (p_cb->handler) { nrf_spi_int_disable(p_spi, DISABLE_ALL); @@ -317,7 +331,7 @@ void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance) ) #undef DISABLE_ALL -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) nrf_drv_common_per_res_release(p_instance->p_registers); #endif @@ -336,6 +350,9 @@ ret_code_t nrf_drv_spi_transfer(nrf_drv_spi_t const * const p_instance, xfer_desc.tx_length = tx_buffer_length; xfer_desc.rx_length = rx_buffer_length; + NRF_LOG_INFO("Transfer tx_len:%d, rx_len:%d.\r\n", tx_buffer_length, rx_buffer_length); + NRF_LOG_DEBUG("Tx data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_tx_buffer, tx_buffer_length * sizeof(p_tx_buffer)); return nrf_drv_spi_xfer(p_instance, &xfer_desc, 0); } @@ -351,6 +368,10 @@ static void finish_transfer(spi_control_block_t * p_cb) // transfers to be started directly from the handler function. p_cb->transfer_in_progress = false; p_cb->evt.type = NRF_DRV_SPI_EVENT_DONE; + NRF_LOG_INFO("Transfer rx_len:%d.\r\n", p_cb->evt.data.done.rx_length); + NRF_LOG_DEBUG("Rx data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_cb->evt.data.done.p_rx_buffer, + p_cb->evt.data.done.rx_length * sizeof(p_cb->evt.data.done.p_rx_buffer)); p_cb->handler(&p_cb->evt); } @@ -380,19 +401,6 @@ static bool transfer_byte(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb) // see how the transfer is started in the 'nrf_drv_spi_transfer' // function. uint16_t bytes_used = p_cb->bytes_transferred + 1; - - if (p_cb->abort) - { - if (bytes_used < p_cb->evt.data.done.tx_length) - { - p_cb->evt.data.done.tx_length = bytes_used; - } - if (bytes_used < p_cb->evt.data.done.rx_length) - { - p_cb->evt.data.done.rx_length = bytes_used; - } - } - if (bytes_used < p_cb->evt.data.done.tx_length) { nrf_spi_txd_set(p_spi, p_cb->evt.data.done.p_tx_buffer[bytes_used]); @@ -412,8 +420,8 @@ static void spi_xfer(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb, nrf_drv_spi_xfer_desc_t const * p_xfer_desc) { - nrf_spi_int_disable(p_spi, NRF_SPI_INT_READY_MASK); p_cb->bytes_transferred = 0; + nrf_spi_int_disable(p_spi, NRF_SPI_INT_READY_MASK); nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY); @@ -450,6 +458,7 @@ static void spi_xfer(NRF_SPI_Type * p_spi, do { while (!nrf_spi_event_check(p_spi, NRF_SPI_EVENT_READY)) {} nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY); + NRF_LOG_DEBUG("SPI: Event: NRF_SPI_EVENT_READY.\r\n"); } while (transfer_byte(p_spi, p_cb)); if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) { @@ -464,17 +473,16 @@ __STATIC_INLINE void spim_int_enable(NRF_SPIM_Type * p_spim, bool enable) { if (!enable) { - nrf_spim_int_disable(p_spim, END_INT_MASK | NRF_SPIM_INT_STOPPED_MASK); + nrf_spim_int_disable(p_spim, END_INT_MASK); } else { - nrf_spim_int_enable(p_spim, END_INT_MASK | NRF_SPIM_INT_STOPPED_MASK); + nrf_spim_int_enable(p_spim, END_INT_MASK); } } __STATIC_INLINE void spim_list_enable_handle(NRF_SPIM_Type * p_spim, uint32_t flags) { -#ifndef NRF52_PAN_46 if (NRF_DRV_SPI_FLAG_TX_POSTINC & flags) { nrf_spim_tx_list_enable(p_spim); @@ -492,7 +500,6 @@ __STATIC_INLINE void spim_list_enable_handle(NRF_SPIM_Type * p_spim, uint32_t fl { nrf_spim_rx_list_disable(p_spim); } -#endif } static ret_code_t spim_xfer(NRF_SPIM_Type * p_spim, @@ -500,25 +507,22 @@ static ret_code_t spim_xfer(NRF_SPIM_Type * p_spim, nrf_drv_spi_xfer_desc_t const * p_xfer_desc, uint32_t flags) { + ret_code_t err_code; // EasyDMA requires that transfer buffers are placed in Data RAM region; // signal error if they are not. if ((p_xfer_desc->p_tx_buffer != NULL && !nrf_drv_is_in_RAM(p_xfer_desc->p_tx_buffer)) || (p_xfer_desc->p_rx_buffer != NULL && !nrf_drv_is_in_RAM(p_xfer_desc->p_rx_buffer))) { p_cb->transfer_in_progress = false; - return NRF_ERROR_INVALID_ADDR; + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } nrf_spim_tx_buffer_set(p_spim, p_xfer_desc->p_tx_buffer, p_xfer_desc->tx_length); nrf_spim_rx_buffer_set(p_spim, p_xfer_desc->p_rx_buffer, p_xfer_desc->rx_length); -#ifdef NRF52_PAN_23 - nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDTX); - nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDRX); -#else nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_END); -#endif - nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_STOPPED); spim_list_enable_handle(p_spim, flags); @@ -529,25 +533,19 @@ static ret_code_t spim_xfer(NRF_SPIM_Type * p_spim, if (!p_cb->handler) { -#ifdef NRF52_PAN_23 - while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDTX) || - !nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDRX)) {} -#else while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){} -#endif - // Stop the peripheral after transaction is finished. - nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP); - while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) {} if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) { nrf_gpio_pin_set(p_cb->ss_pin); } } - else - { - spim_int_enable(p_spim, !(flags & NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER)); - } - return NRF_SUCCESS; + else + { + spim_int_enable(p_spim, !(flags & NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER)); + } + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } #endif @@ -560,9 +558,13 @@ ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t const * const p_instance, ASSERT(p_xfer_desc->p_tx_buffer != NULL || p_xfer_desc->tx_length == 0); ASSERT(p_xfer_desc->p_rx_buffer != NULL || p_xfer_desc->rx_length == 0); + ret_code_t err_code = NRF_SUCCESS; + if (p_cb->transfer_in_progress) { - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } else { @@ -575,7 +577,6 @@ ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t const * const p_instance, p_cb->evt.data.done = *p_xfer_desc; p_cb->tx_done = false; p_cb->rx_done = false; - p_cb->abort = false; if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) { @@ -583,72 +584,34 @@ ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t const * const p_instance, } CODE_FOR_SPIM ( - return spim_xfer((NRF_SPIM_Type * ) p_instance->p_registers, p_cb, p_xfer_desc, flags); + return spim_xfer(p_instance->p_registers, p_cb, p_xfer_desc, flags); ) CODE_FOR_SPI ( if (flags) { p_cb->transfer_in_progress = false; - return NRF_ERROR_NOT_SUPPORTED; + err_code = NRF_ERROR_NOT_SUPPORTED; } - spi_xfer((NRF_SPI_Type * ) p_instance->p_registers, p_cb, p_xfer_desc); - return NRF_SUCCESS; + else + { + spi_xfer(p_instance->p_registers, p_cb, p_xfer_desc); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; ) } - -void nrf_drv_spi_abort(nrf_drv_spi_t const * p_instance) -{ - spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); - - CODE_FOR_SPIM - ( - nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP); - while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) {} - p_cb->transfer_in_progress = false; - ) - CODE_FOR_SPI - ( - p_cb->abort = true; - ) -} - #ifdef SPIM_IN_USE static void irq_handler_spim(NRF_SPIM_Type * p_spim, spi_control_block_t * p_cb) { ASSERT(p_cb->handler); -#ifdef NRF52_PAN_23 - if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) - { - nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_STOPPED); - finish_transfer(p_cb); - } - else - { - if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDTX)) - { - nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDTX); - p_cb->tx_done = true; - } - if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDRX)) - { - nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDRX); - p_cb->rx_done = true; - } - if (p_cb->tx_done && p_cb->rx_done) - { - nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP); - } - } -#else if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)) { nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_END); + NRF_LOG_DEBUG("SPIM: Event: NRF_SPIM_EVENT_END.\r\n"); finish_transfer(p_cb); } -#endif } uint32_t nrf_drv_spi_start_task_get(nrf_drv_spi_t const * p_instance) @@ -670,6 +633,7 @@ static void irq_handler_spi(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb) ASSERT(p_cb->handler); nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY); + NRF_LOG_DEBUG("SPI: Event: NRF_SPI_EVENT_READY.\r\n"); if (!transfer_byte(p_spi, p_cb)) { @@ -678,7 +642,7 @@ static void irq_handler_spi(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb) } #endif // SPI_IN_USE -#if SPI0_ENABLED +#if NRF_MODULE_ENABLED(SPI0) IRQ_HANDLER(0) { spi_control_block_t * p_cb = &m_cb[SPI0_INSTANCE_INDEX]; @@ -688,9 +652,9 @@ IRQ_HANDLER(0) irq_handler_spi(NRF_SPI0, p_cb); #endif } -#endif // SPI0_ENABLED +#endif // NRF_MODULE_ENABLED(SPI0) -#if SPI1_ENABLED +#if NRF_MODULE_ENABLED(SPI1) IRQ_HANDLER(1) { spi_control_block_t * p_cb = &m_cb[SPI1_INSTANCE_INDEX]; @@ -700,9 +664,9 @@ IRQ_HANDLER(1) irq_handler_spi(NRF_SPI1, p_cb); #endif } -#endif // SPI1_ENABLED +#endif // NRF_MODULE_ENABLED(SPI1) -#if SPI2_ENABLED +#if NRF_MODULE_ENABLED(SPI2) IRQ_HANDLER(2) { spi_control_block_t * p_cb = &m_cb[SPI2_INSTANCE_INDEX]; @@ -712,4 +676,6 @@ IRQ_HANDLER(2) irq_handler_spi(NRF_SPI2, p_cb); #endif } -#endif // SPI2_ENABLED +#endif // NRF_MODULE_ENABLED(SPI2) +#endif // ENABLED_SPI_COUNT +#endif // NRF_MODULE_ENABLED(SPI) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h index 17ae6536f4..9b4ab898fd 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h @@ -36,28 +36,30 @@ * */ - /**@file - * @addtogroup nrf_spi Serial peripheral interface (SPI) + * @addtogroup nrf_spi Serial peripheral interface (SPI/SPIM) * @ingroup nrf_drivers - * @brief Serial peripheral interface (SPI) APIs. + * @brief Serial peripheral interface (SPI/SPIM) APIs. * - * - * @addtogroup nrf_spi_master SPI master HAL and driver - * @ingroup nrf_spi - * @brief SPI master APIs. */ #ifndef NRF_DRV_SPI_H__ #define NRF_DRV_SPI_H__ #include "nordic_common.h" -#include "nrf_drv_config.h" +#include "sdk_config.h" +#include "nrf_peripherals.h" #include "nrf_spi.h" +#ifdef SPIM_PRESENT #include "nrf_spim.h" +#endif #include "sdk_errors.h" -#if defined(NRF52) +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(SPIM_PRESENT) #define NRF_DRV_SPI_PERIPHERAL(id) \ (CONCAT_3(SPI, id, _USE_EASY_DMA) == 1 ? \ (void *)CONCAT_2(NRF_SPIM, id) \ @@ -74,9 +76,9 @@ /** - * @defgroup nrf_drv_spi_master SPI master driver + * @defgroup nrf_drv_spi SPI master driver * @{ - * @ingroup nrf_spi_master + * @ingroup nrf_spi * * @brief Multi-instance SPI master driver. */ @@ -92,6 +94,10 @@ typedef struct bool use_easy_dma; ///< True if the peripheral with EasyDMA (SPIM) shall be used. } nrf_drv_spi_t; +#define SPI0_INSTANCE_INDEX 0 +#define SPI1_INSTANCE_INDEX SPI0_INSTANCE_INDEX+SPI0_ENABLED +#define SPI2_INSTANCE_INDEX SPI1_INSTANCE_INDEX+SPI1_ENABLED + /** * @brief Macro for creating an SPI master driver instance. */ @@ -158,8 +164,8 @@ typedef struct * if this signal is not needed. */ uint8_t ss_pin; ///< Slave Select pin number (optional). /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED - * if this signal is not needed. The driver - * supports only active low for this signal. + * if this signal is not needed. The driver + * supports only active low for this signal. * If the signal should be active high, * it must be controlled externally. */ uint8_t irq_priority; ///< Interrupt priority. @@ -174,13 +180,13 @@ typedef struct /** * @brief SPI master instance default configuration. */ -#define NRF_DRV_SPI_DEFAULT_CONFIG(id) \ +#define NRF_DRV_SPI_DEFAULT_CONFIG \ { \ - .sck_pin = CONCAT_3(SPI, id, _CONFIG_SCK_PIN), \ - .mosi_pin = CONCAT_3(SPI, id, _CONFIG_MOSI_PIN), \ - .miso_pin = CONCAT_3(SPI, id, _CONFIG_MISO_PIN), \ + .sck_pin = NRF_DRV_SPI_PIN_NOT_USED, \ + .mosi_pin = NRF_DRV_SPI_PIN_NOT_USED, \ + .miso_pin = NRF_DRV_SPI_PIN_NOT_USED, \ .ss_pin = NRF_DRV_SPI_PIN_NOT_USED, \ - .irq_priority = CONCAT_3(SPI, id, _CONFIG_IRQ_PRIORITY), \ + .irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY, \ .orc = 0xFF, \ .frequency = NRF_DRV_SPI_FREQ_4M, \ .mode = NRF_DRV_SPI_MODE_0, \ @@ -265,7 +271,7 @@ typedef void (*nrf_drv_spi_handler_t)(nrf_drv_spi_evt_t const * p_event); * * This function configures and enables the specified peripheral. * - * @param[in] p_instance Pointer to the instance structure. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_config Pointer to the structure with the initial configuration. * If NULL, the default configuration is used. * @param handler Event handler provided by the user. If NULL, transfers @@ -274,8 +280,8 @@ typedef void (*nrf_drv_spi_handler_t)(nrf_drv_spi_evt_t const * p_event); * @retval NRF_SUCCESS If initialization was successful. * @retval NRF_ERROR_INVALID_STATE If the driver was already initialized. * @retval NRF_ERROR_BUSY If some other peripheral with the same - * instance ID is already in use. This is - * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED + * instance ID is already in use. This is + * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED * is set to a value other than zero. */ ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance, @@ -285,7 +291,7 @@ ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance, /** * @brief Function for uninitializing the SPI master driver instance. * - * @param[in] p_instance Pointer to the instance structure. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance); @@ -301,7 +307,7 @@ void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance); * to be placed in the Data RAM region. If they are not and an SPIM instance is * used, this function will fail with the error code NRF_ERROR_INVALID_ADDR. * - * @param[in] p_instance Pointer to the instance structure. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_tx_buffer Pointer to the transmit buffer. Can be NULL * if there is nothing to send. * @param tx_buffer_length Length of the transmit buffer. @@ -353,7 +359,7 @@ ret_code_t nrf_drv_spi_transfer(nrf_drv_spi_t const * const p_instance, * transfers are set up when SPIM is not active. Supported only by SPIM. * @note Function is intended to be used only in non-blocking mode. * - * @param p_instance SPI instance. + * @param p_instance Pointer to the driver instance structure. * @param p_xfer_desc Pointer to the transfer descriptor. * @param flags Transfer options (0 for default settings). * @@ -373,7 +379,7 @@ ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t const * const p_instance, * This function should be used if @ref nrf_drv_spi_xfer was called with the flag @ref NRF_DRV_SPI_FLAG_HOLD_XFER. * In that case, the transfer is not started by the driver, but it must be started externally by PPI. * - * @param[in] p_instance SPI instance. + * @param[in] p_instance Pointer to the driver instance structure. * * @return Start task address. */ @@ -385,13 +391,15 @@ uint32_t nrf_drv_spi_start_task_get(nrf_drv_spi_t const * p_instance); * A END event can be used to detect the end of a transfer if the @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER * option is used. * - * @param[in] p_instance SPI instance. + * @param[in] p_instance Pointer to the driver instance structure. * * @return END event address. */ uint32_t nrf_drv_spi_end_event_get(nrf_drv_spi_t const * p_instance); -void nrf_drv_spi_abort(nrf_drv_spi_t const * p_instance); +#ifdef __cplusplus +} +#endif #endif // NRF_DRV_SPI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.c index 75d261b69f..bbe72b39b1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.c @@ -1,4 +1,4 @@ -/* + /* * Copyright (c) 2013 Nordic Semiconductor ASA * All rights reserved. * @@ -36,7 +36,10 @@ * */ - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(SPIS) +#define ENABLED_SPIS_COUNT (SPIS0_ENABLED+SPIS1_ENABLED+SPIS2_ENABLED) +#if ENABLED_SPIS_COUNT #include "nrf_drv_spis.h" #include #include @@ -44,47 +47,57 @@ #include "nrf_gpio.h" #include "app_error.h" #include "app_util_platform.h" -#include "nrf_drv_config.h" #include "nrf_drv_common.h" -#include "nordic_common.h" -#include "sdk_common.h" #include "nrf_assert.h" -#if !SPIS_COUNT - #warning No SPIS instances enabled. -#else +#define NRF_LOG_MODULE_NAME "SPIS" + +#if SPIS_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL SPIS_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR SPIS_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR SPIS_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_SPIS_EVENT_ACQUIRED ? "NRF_SPIS_EVENT_ACQUIRED" : \ + (event == NRF_SPIS_EVENT_END ? "NRF_SPIS_EVENT_END" : "UNKNOWN ERROR")) + +#else //SPIS_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //SPIS_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + /**@brief States of the SPI transaction state machine. */ typedef enum { - SPIS_STATE_INIT, /**< Initialization state. In this state the module waits for a call to @ref spi_slave_buffers_set. */ + SPIS_STATE_INIT, /**< Initialization state. In this state the module waits for a call to @ref spi_slave_buffers_set. */ SPIS_BUFFER_RESOURCE_REQUESTED, /**< State where the configuration of the memory buffers, which are to be used in SPI transaction, has started. */ SPIS_BUFFER_RESOURCE_CONFIGURED, /**< State where the configuration of the memory buffers, which are to be used in SPI transaction, has completed. */ SPIS_XFER_COMPLETED /**< State where SPI transaction has been completed. */ } nrf_drv_spis_state_t; -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n #define IRQ_HANDLER(n) static void IRQ_HANDLER_NAME(n)(void) - #if SPIS0_ENABLED + #if NRF_MODULE_ENABLED(SPIS0) IRQ_HANDLER(0); #endif - #if SPIS1_ENABLED + #if NRF_MODULE_ENABLED(SPIS1) IRQ_HANDLER(1); #endif - #if SPIS2_ENABLED + #if NRF_MODULE_ENABLED(SPIS2) IRQ_HANDLER(2); #endif - static nrf_drv_irq_handler_t const m_irq_handlers[SPIS_COUNT] = { - #if SPIS0_ENABLED + static nrf_drv_irq_handler_t const m_irq_handlers[ENABLED_SPIS_COUNT] = { + #if NRF_MODULE_ENABLED(SPIS0) IRQ_HANDLER_NAME(0), #endif - #if SPIS1_ENABLED + #if NRF_MODULE_ENABLED(SPIS1) IRQ_HANDLER_NAME(1), #endif - #if SPIS2_ENABLED + #if NRF_MODULE_ENABLED(SPIS2) IRQ_HANDLER_NAME(2), #endif }; @@ -111,57 +124,51 @@ typedef struct volatile nrf_drv_spis_state_t spi_state; //!< SPI slave state. } spis_cb_t; -static spis_cb_t m_cb[SPIS_COUNT]; - -static nrf_drv_spis_config_t const m_default_config[SPIS_COUNT] = { -#if SPIS0_ENABLED - NRF_DRV_SPIS_DEFAULT_CONFIG(0), -#endif -#if SPIS1_ENABLED - NRF_DRV_SPIS_DEFAULT_CONFIG(1), -#endif -#if SPIS2_ENABLED - NRF_DRV_SPIS_DEFAULT_CONFIG(2), -#endif -}; - +static spis_cb_t m_cb[ENABLED_SPIS_COUNT]; ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance, nrf_drv_spis_config_t const * p_config, nrf_drv_spis_event_handler_t event_handler) { + ASSERT(p_config); spis_cb_t * p_cb = &m_cb[p_instance->instance_id]; + ret_code_t err_code; NRF_SPIS_Type * p_spis = p_instance->p_reg; if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) { - return NRF_ERROR_INVALID_STATE; - } - if (p_config == NULL) - { - p_config = &m_default_config[p_instance->instance_id]; + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } + if ((uint32_t)p_config->mode > (uint32_t)NRF_DRV_SPIS_MODE_3) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } if (!event_handler) { - return NRF_ERROR_NULL; + err_code = NRF_ERROR_NULL; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) if (nrf_drv_common_per_res_acquire(p_spis, m_irq_handlers[p_instance->instance_id]) != NRF_SUCCESS) { - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } #endif // Configure the SPI pins for input. uint32_t mosi_pin; uint32_t miso_pin; - + if (p_config->miso_pin != NRF_DRV_SPIS_PIN_NOT_USED) { nrf_gpio_cfg(p_config->miso_pin, @@ -176,7 +183,7 @@ ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance, { miso_pin = NRF_SPIS_PIN_NOT_CONNECTED; } - + if (p_config->mosi_pin != NRF_DRV_SPIS_PIN_NOT_USED) { nrf_gpio_cfg(p_config->mosi_pin, @@ -191,14 +198,14 @@ ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance, { mosi_pin = NRF_SPIS_PIN_NOT_CONNECTED; } - + nrf_gpio_cfg(p_config->csn_pin, NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_CONNECT, p_config->csn_pullup, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE); - + nrf_gpio_cfg(p_config->sck_pin, NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_CONNECT, @@ -207,39 +214,41 @@ ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance, NRF_GPIO_PIN_NOSENSE); nrf_spis_pins_set(p_spis, p_config->sck_pin, mosi_pin, miso_pin, p_config->csn_pin); - + nrf_spis_rx_buffer_set(p_spis, NULL, 0); nrf_spis_tx_buffer_set(p_spis, NULL, 0); - + // Configure SPI mode. nrf_spis_configure(p_spis, (nrf_spis_mode_t) p_config->mode, (nrf_spis_bit_order_t) p_config->bit_order); - + // Configure DEF and ORC characters. nrf_spis_def_set(p_spis, p_config->def); nrf_spis_orc_set(p_spis, p_config->orc); - + // Clear possible pending events. nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_END); nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_ACQUIRED); - - // Enable END_ACQUIRE shortcut. + + // Enable END_ACQUIRE shortcut. nrf_spis_shorts_enable(p_spis, NRF_SPIS_SHORT_END_ACQUIRE); - + m_cb[p_instance->instance_id].spi_state = SPIS_STATE_INIT; m_cb[p_instance->instance_id].handler = event_handler; - + // Enable IRQ. nrf_spis_int_enable(p_spis, NRF_SPIS_INT_ACQUIRED_MASK | NRF_SPIS_INT_END_MASK); nrf_drv_common_irq_enable(p_instance->irq, p_config->irq_priority); - + p_cb->state = NRF_DRV_STATE_INITIALIZED; - - // Enable SPI slave device. + + // Enable SPI slave device. nrf_spis_enable(p_spis); - - return NRF_SUCCESS; + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } @@ -247,7 +256,7 @@ void nrf_drv_spis_uninit(nrf_drv_spis_t const * const p_instance) { spis_cb_t * p_cb = &m_cb[p_instance->instance_id]; ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); - + NRF_SPIS_Type * p_spis = p_instance->p_reg; #define DISABLE_ALL 0xFFFFFFFF @@ -256,11 +265,12 @@ void nrf_drv_spis_uninit(nrf_drv_spis_t const * const p_instance) nrf_spis_int_disable(p_spis, DISABLE_ALL); #undef DISABLE_ALL -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) nrf_drv_common_per_res_release(p_spis); #endif p_cb->state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Initialized.\r\n"); } @@ -269,32 +279,35 @@ static void spis_state_entry_action_execute(NRF_SPIS_Type * p_spis, spis_cb_t * p_cb) { nrf_drv_spis_event_t event; - + switch (p_cb->spi_state) - { + { case SPIS_BUFFER_RESOURCE_REQUESTED: nrf_spis_task_trigger(p_spis, NRF_SPIS_TASK_ACQUIRE); - break; - + break; + case SPIS_BUFFER_RESOURCE_CONFIGURED: event.evt_type = NRF_DRV_SPIS_BUFFERS_SET_DONE; event.rx_amount = 0; - event.tx_amount = 0; - + event.tx_amount = 0; + APP_ERROR_CHECK_BOOL(p_cb->handler != NULL); p_cb->handler(event); break; - - case SPIS_XFER_COMPLETED: + + case SPIS_XFER_COMPLETED: event.evt_type = NRF_DRV_SPIS_XFER_DONE; event.rx_amount = nrf_spis_rx_amount_get(p_spis); - event.tx_amount = nrf_spis_tx_amount_get(p_spis); + event.tx_amount = nrf_spis_tx_amount_get(p_spis); + NRF_LOG_INFO("Transfer rx_len:%d.\r\n", event.rx_amount); + NRF_LOG_DEBUG("Rx data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_cb->rx_buffer, event.rx_amount * sizeof(p_cb->rx_buffer)); APP_ERROR_CHECK_BOOL(p_cb->handler != NULL); p_cb->handler(event); break; - + default: - // No implementation required. + // No implementation required. break; } } @@ -331,59 +344,63 @@ ret_code_t nrf_drv_spis_buffers_set(nrf_drv_spis_t const * const p_instance, if ((p_tx_buffer != NULL && !nrf_drv_is_in_RAM(p_tx_buffer)) || (p_rx_buffer != NULL && !nrf_drv_is_in_RAM(p_rx_buffer))) { - return NRF_ERROR_INVALID_ADDR; + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } - + switch (p_cb->spi_state) { case SPIS_STATE_INIT: case SPIS_XFER_COMPLETED: - case SPIS_BUFFER_RESOURCE_CONFIGURED: + case SPIS_BUFFER_RESOURCE_CONFIGURED: p_cb->tx_buffer = p_tx_buffer; p_cb->rx_buffer = p_rx_buffer; p_cb->tx_buffer_size = tx_buffer_length; - p_cb->rx_buffer_size = rx_buffer_length; - err_code = NRF_SUCCESS; - - spis_state_change(p_instance->p_reg, p_cb, SPIS_BUFFER_RESOURCE_REQUESTED); + p_cb->rx_buffer_size = rx_buffer_length; + err_code = NRF_SUCCESS; + + spis_state_change(p_instance->p_reg, p_cb, SPIS_BUFFER_RESOURCE_REQUESTED); break; case SPIS_BUFFER_RESOURCE_REQUESTED: - err_code = NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; break; - + default: // @note: execution of this code path would imply internal error in the design. - err_code = NRF_ERROR_INTERNAL; + err_code = NRF_ERROR_INTERNAL; break; } - + + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); return err_code; } static void spis_irq_handler(NRF_SPIS_Type * p_spis, spis_cb_t * p_cb) { - // @note: as multiple events can be pending for processing, the correct event processing order + // @note: as multiple events can be pending for processing, the correct event processing order // is as follows: // - SPI semaphore acquired event. // - SPI transaction complete event. - + // Check for SPI semaphore acquired event. if (nrf_spis_event_check(p_spis, NRF_SPIS_EVENT_ACQUIRED)) { nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_ACQUIRED); - + NRF_LOG_DEBUG("SPIS: Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_SPIS_EVENT_ACQUIRED)); + switch (p_cb->spi_state) - { - case SPIS_BUFFER_RESOURCE_REQUESTED: + { + case SPIS_BUFFER_RESOURCE_REQUESTED: nrf_spis_tx_buffer_set(p_spis, (uint8_t *)p_cb->tx_buffer, p_cb->tx_buffer_size); nrf_spis_rx_buffer_set(p_spis, (uint8_t *)p_cb->rx_buffer, p_cb->rx_buffer_size); - + nrf_spis_task_trigger(p_spis, NRF_SPIS_TASK_RELEASE); - - spis_state_change(p_spis, p_cb, SPIS_BUFFER_RESOURCE_CONFIGURED); + + spis_state_change(p_spis, p_cb, SPIS_BUFFER_RESOURCE_CONFIGURED); break; - + default: // No implementation required. break; @@ -394,30 +411,32 @@ static void spis_irq_handler(NRF_SPIS_Type * p_spis, spis_cb_t * p_cb) if (nrf_spis_event_check(p_spis, NRF_SPIS_EVENT_END)) { nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_END); - + NRF_LOG_DEBUG("SPIS: Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_SPIS_EVENT_END)); + switch (p_cb->spi_state) { - case SPIS_BUFFER_RESOURCE_CONFIGURED: + case SPIS_BUFFER_RESOURCE_CONFIGURED: spis_state_change(p_spis, p_cb, SPIS_XFER_COMPLETED); break; default: - // No implementation required. - break; - } + // No implementation required. + break; + } } } -#if SPIS0_ENABLED +#if NRF_MODULE_ENABLED(SPIS0) SPIS_IRQHANDLER_TEMPLATE(0) #endif -#if SPIS1_ENABLED +#if NRF_MODULE_ENABLED(SPIS1) SPIS_IRQHANDLER_TEMPLATE(1) #endif -#if SPIS2_ENABLED +#if NRF_MODULE_ENABLED(SPIS2) SPIS_IRQHANDLER_TEMPLATE(2) #endif #endif // SPI_COUNT > 0 +#endif // NRF_MODULE_ENABLED(SPIS) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.h index a761f66717..c94d227e9a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_slave/nrf_drv_spis.h @@ -36,14 +36,12 @@ * */ - /**@file - * @defgroup nrf_spis SPI slave HAL and driver - * @ingroup nrf_spi - * @brief SPI slave API. - * @details The SPIS HAL provides basic APIs for accessing the registers - * of the SPIS. The SPIS driver provides APIs on a higher level. - **/ + * @addtogroup nrf_spis SPIS HAL and driver + * @ingroup nrf_drivers + * @brief SPIS APIs. + * + */ #ifndef SPI_SLAVE_H__ #define SPI_SLAVE_H__ @@ -51,39 +49,38 @@ #include #include "nrf.h" #include "nrf_error.h" -#include "nrf_drv_config.h" +#include "sdk_config.h" #include "nrf_spis.h" #include "nrf_gpio.h" #include "sdk_common.h" #include "app_util_platform.h" +#include "nrf_peripherals.h" + +#ifdef __cplusplus +extern "C" { +#endif + -#if defined(NRF52) - #define SPIS2_IRQ SPIM2_SPIS2_SPI2_IRQn - #define SPIS2_IRQ_HANDLER SPIM2_SPIS2_SPI2_IRQHandler - #define SPIS0_IRQ SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn - #define SPIS0_IRQ_HANDLER SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler - #define SPIS1_IRQ SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn - #define SPIS1_IRQ_HANDLER SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler -#else #define SPIS0_IRQ SPI0_TWI0_IRQn #define SPIS0_IRQ_HANDLER SPI0_TWI0_IRQHandler #define SPIS1_IRQ SPI1_TWI1_IRQn #define SPIS1_IRQ_HANDLER SPI1_TWI1_IRQHandler + +#if SPIS_COUNT > 2 + #define SPIS2_IRQ SPIM2_SPIS2_SPI2_IRQn + #define SPIS2_IRQ_HANDLER SPIM2_SPIS2_SPI2_IRQHandler #endif /** - * @defgroup nrf_drv_spi_slave SPI slave driver + * @defgroup nrf_drv_spis SPI slave driver * @{ * @ingroup nrf_spis - * * @brief Multi-instance SPI slave driver. */ - + #define NRF_DRV_SPIS_DEFAULT_CSN_PULLUP NRF_GPIO_PIN_NOPULL /**< Default pull-up configuration of the SPI CS. */ #define NRF_DRV_SPIS_DEFAULT_MISO_DRIVE NRF_GPIO_PIN_S0S1 /**< Default drive configuration of the SPI MISO. */ -#define NRF_DRV_SPIS_DEFAULT_DEF 0xFF /**< Default DEF character. */ -#define NRF_DRV_SPIS_DEFAULT_ORC 0xFF /**< Default ORC character. */ - + /** * @brief This value can be provided instead of a pin number for the signals MOSI * and MISO to specify that the given signal is not used and therefore @@ -111,8 +108,8 @@ typedef enum typedef enum { NRF_DRV_SPIS_BUFFERS_SET_DONE, /**< Memory buffer set event. Memory buffers have been set successfully to the SPI slave device, and SPI transactions can be done. */ - NRF_DRV_SPIS_XFER_DONE, /**< SPI transaction event. SPI transaction has been completed. */ - NRF_DRV_SPIS_EVT_TYPE_MAX /**< Enumeration upper bound. */ + NRF_DRV_SPIS_XFER_DONE, /**< SPI transaction event. SPI transaction has been completed. */ + NRF_DRV_SPIS_EVT_TYPE_MAX /**< Enumeration upper bound. */ } nrf_drv_spis_event_type_t; /** @brief Structure containing the event context from the SPI slave driver. */ @@ -131,6 +128,10 @@ typedef struct IRQn_Type irq; //!< IRQ of the specific instance. } nrf_drv_spis_t; +#define SPIS0_INSTANCE_INDEX 0 +#define SPIS1_INSTANCE_INDEX SPIS0_INSTANCE_INDEX+SPIS0_ENABLED +#define SPIS2_INSTANCE_INDEX SPIS1_INSTANCE_INDEX+SPIS1_ENABLED + /** @brief Macro for creating an SPI slave driver instance. */ #define NRF_DRV_SPIS_INSTANCE(id) \ { \ @@ -140,23 +141,23 @@ typedef struct } /** @brief SPI slave instance default configuration. */ -#define NRF_DRV_SPIS_DEFAULT_CONFIG(id) \ -{ \ - .sck_pin = CONCAT_3(SPIS, id, _CONFIG_SCK_PIN), \ - .mosi_pin = CONCAT_3(SPIS, id, _CONFIG_MOSI_PIN), \ - .miso_pin = CONCAT_3(SPIS, id, _CONFIG_MISO_PIN), \ - .csn_pin = NRF_DRV_SPIS_PIN_NOT_USED, \ - .miso_drive = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE, \ - .csn_pullup = NRF_DRV_SPIS_DEFAULT_CSN_PULLUP, \ - .orc = NRF_DRV_SPIS_DEFAULT_ORC, \ - .def = NRF_DRV_SPIS_DEFAULT_DEF, \ - .mode = NRF_DRV_SPIS_MODE_0, \ - .bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST, \ - .irq_priority = CONCAT_3(SPIS, id, _CONFIG_IRQ_PRIORITY), \ +#define NRF_DRV_SPIS_DEFAULT_CONFIG \ +{ \ + .sck_pin = NRF_DRV_SPIS_PIN_NOT_USED, \ + .mosi_pin = NRF_DRV_SPIS_PIN_NOT_USED, \ + .miso_pin = NRF_DRV_SPIS_PIN_NOT_USED, \ + .csn_pin = NRF_DRV_SPIS_PIN_NOT_USED, \ + .miso_drive = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE, \ + .csn_pullup = NRF_DRV_SPIS_DEFAULT_CSN_PULLUP, \ + .orc = SPIS_DEFAULT_ORC, \ + .def = SPIS_DEFAULT_DEF, \ + .mode = (nrf_drv_spis_mode_t)SPIS_DEFAULT_MODE, \ + .bit_order = (nrf_drv_spis_endian_t)SPIS_DEFAULT_BIT_ORDER, \ + .irq_priority = SPIS_DEFAULT_CONFIG_IRQ_PRIORITY, \ } /** @brief SPI peripheral device configuration data. */ -typedef struct +typedef struct { uint32_t miso_pin; //!< SPI MISO pin (optional). /**< Set @ref NRF_DRV_SPIS_PIN_NOT_USED @@ -178,13 +179,13 @@ typedef struct /** @brief SPI slave event callback function type. * - * @param[in] event SPI slave driver event. + * @param[in] event SPI slave driver event. */ typedef void (*nrf_drv_spis_event_handler_t)(nrf_drv_spis_event_t event); /** @brief Function for initializing the SPI slave driver instance. * - * @param[in] p_instance Pointer to the instance structure. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_config Pointer to the structure with the initial configuration. * If NULL, the default configuration will be used. * @param[in] event_handler Function to be called by the SPI slave driver upon event. @@ -192,8 +193,8 @@ typedef void (*nrf_drv_spis_event_handler_t)(nrf_drv_spis_event_t event); * @retval NRF_SUCCESS If the initialization was successful. * @retval NRF_ERROR_INVALID_PARAM If an invalid parameter is supplied. * @retval NRF_ERROR_BUSY If some other peripheral with the same - * instance ID is already in use. This is - * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED + * instance ID is already in use. This is + * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED * is set to a value other than zero. */ ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance, @@ -203,48 +204,53 @@ ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const p_instance, /** * @brief Function for uninitializing the SPI slave driver instance. * - * @param[in] p_instance Pointer to the instance structure. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_spis_uninit(nrf_drv_spis_t const * const p_instance); /** @brief Function for preparing the SPI slave instance for a single SPI transaction. - * - * This function prepares the SPI slave device to be ready for a single SPI transaction. It configures - * the SPI slave device to use the memory supplied with the function call in SPI transactions. - * - * When either the memory buffer configuration or the SPI transaction has been - * completed, the event callback function will be called with the appropriate event - * @ref nrf_drv_spis_event_type_t. Note that the callback function can be called before returning from + * + * This function prepares the SPI slave device to be ready for a single SPI transaction. It configures + * the SPI slave device to use the memory supplied with the function call in SPI transactions. + * + * When either the memory buffer configuration or the SPI transaction has been + * completed, the event callback function will be called with the appropriate event + * @ref nrf_drv_spis_event_type_t. Note that the callback function can be called before returning from * this function, because it is called from the SPI slave interrupt context. * * @note This function can be called from the callback function context. * - * @note Client applications must call this function after every @ref NRF_DRV_SPIS_XFER_DONE event if - * the SPI slave driver should be prepared for a possible new SPI transaction. + * @note Client applications must call this function after every @ref NRF_DRV_SPIS_XFER_DONE event if + * the SPI slave driver should be prepared for a possible new SPI transaction. * * @note Peripherals that are using EasyDMA (for example, SPIS) require the transfer buffers * to be placed in the Data RAM region. Otherwise, this function will fail * with the error code NRF_ERROR_INVALID_ADDR. * - * @param[in] p_instance SPIS instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_tx_buffer Pointer to the TX buffer. * @param[in] p_rx_buffer Pointer to the RX buffer. * @param[in] tx_buffer_length Length of the TX buffer in bytes. - * @param[in] rx_buffer_length Length of the RX buffer in bytes. + * @param[in] rx_buffer_length Length of the RX buffer in bytes. * * @retval NRF_SUCCESS If the operation was successful. - * @retval NRF_ERROR_NULL If the operation failed because a NULL pointer was supplied. + * @retval NRF_ERROR_NULL If the operation failed because a NULL pointer was supplied. * @retval NRF_ERROR_INVALID_STATE If the operation failed because the SPI slave device is in an incorrect state. * @retval NRF_ERROR_INVALID_ADDR If the provided buffers are not placed in the Data * RAM region. * @retval NRF_ERROR_INTERNAL If the operation failed because of an internal error. */ ret_code_t nrf_drv_spis_buffers_set(nrf_drv_spis_t const * const p_instance, - const uint8_t * p_tx_buffer, - uint8_t tx_buffer_length, - uint8_t * p_rx_buffer, + const uint8_t * p_tx_buffer, + uint8_t tx_buffer_length, + uint8_t * p_rx_buffer, uint8_t rx_buffer_length); + +#ifdef __cplusplus +} +#endif + #endif // SPI_SLAVE_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.c new file mode 100644 index 0000000000..0794726951 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.c @@ -0,0 +1,407 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_drv_common.h" +#include "nrf_error.h" +#include "nrf_assert.h" +#include +#include +#include +#include "nrf_drv_swi.h" +#include "app_util_platform.h" + +#define NRF_LOG_MODULE_NAME "SWI" + +#if EGU_ENABLED +#if SWI_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL SWI_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR SWI_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR SWI_CONFIG_DEBUG_COLOR +#else //SWI_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif //SWI_CONFIG_LOG_ENABLED +#endif //EGU_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + +STATIC_ASSERT(SWI_COUNT > 0); +STATIC_ASSERT(SWI_COUNT <= SWI_MAX); + +#ifdef SWI_DISABLE0 + #undef SWI_DISABLE0 + #define SWI_DISABLE0 1uL +#else + #if SWI_COUNT > 0 + #define SWI_DISABLE0 0uL + #else + #define SWI_DISABLE0 1uL + #endif +#endif + +#ifdef SWI_DISABLE1 + #undef SWI_DISABLE1 + #define SWI_DISABLE1 1uL +#else + #if SWI_COUNT > 1 + #define SWI_DISABLE1 0uL + #else + #define SWI_DISABLE1 1uL + #endif +#endif + +#ifdef SWI_DISABLE2 + #undef SWI_DISABLE2 + #define SWI_DISABLE2 1uL +#else + #if SWI_COUNT > 2 + #define SWI_DISABLE2 0uL + #else + #define SWI_DISABLE2 1uL + #endif +#endif + +#ifdef SWI_DISABLE3 + #undef SWI_DISABLE3 + #define SWI_DISABLE3 1uL +#else + #if SWI_COUNT > 3 + #define SWI_DISABLE3 0uL + #else + #define SWI_DISABLE3 1uL + #endif +#endif + +#ifdef SWI_DISABLE4 + #undef SWI_DISABLE4 + #define SWI_DISABLE4 1uL +#else + #if SWI_COUNT > 4 + #define SWI_DISABLE4 0uL + #else + #define SWI_DISABLE4 1uL + #endif +#endif + +#ifdef SWI_DISABLE5 + #undef SWI_DISABLE5 + #define SWI_DISABLE5 1uL +#else + #if SWI_COUNT > 5 + #define SWI_DISABLE5 0uL + #else + #define SWI_DISABLE5 1uL + #endif +#endif + +#define SWI_START_NUMBER ( (SWI_DISABLE0) \ + + (SWI_DISABLE0 * SWI_DISABLE1) \ + + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2) \ + + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3) \ + + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3 * SWI_DISABLE4) \ + + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3 * SWI_DISABLE4 \ + * SWI_DISABLE5) ) + +#define SWI_ARRAY_SIZE (SWI_COUNT - SWI_START_NUMBER) + +#if (SWI_COUNT <= SWI_START_NUMBER) + #undef SWI_ARRAY_SIZE + #define SWI_ARRAY_SIZE 1 +#endif + +static nrf_drv_state_t m_drv_state = NRF_DRV_STATE_UNINITIALIZED; +static nrf_swi_handler_t m_swi_handlers[SWI_ARRAY_SIZE]; + +#if !EGU_ENABLED +static nrf_swi_flags_t m_swi_flags[SWI_ARRAY_SIZE]; +#endif + +/**@brief Function for getting max channel number of given SWI. + * + * @param[in] swi SWI number. + * @return number of available channels. + */ +#if NRF_MODULE_ENABLED(EGU) +__STATIC_INLINE uint32_t swi_channel_number(nrf_swi_t swi) +{ + uint32_t retval = 0; + switch(swi){ + case 0: + retval = EGU0_CH_NUM; + break; + case 1: + retval = EGU1_CH_NUM; + break; + case 2: + retval = EGU2_CH_NUM; + break; + case 3: + retval = EGU3_CH_NUM; + break; + case 4: + retval = EGU4_CH_NUM; + break; + case 5: + retval = EGU5_CH_NUM; + break; + default: + retval = 0; + } + + return retval; +} +#else +#define swi_channel_number(swi) SWI_MAX_FLAGS +#endif + +#if NRF_MODULE_ENABLED(EGU) + +/**@brief Get the specific EGU instance. */ +__STATIC_INLINE NRF_EGU_Type * egu_instance_get(nrf_swi_t swi) +{ + return (NRF_EGU_Type*) (NRF_EGU0_BASE + (((uint32_t) swi) * (NRF_EGU1_BASE - NRF_EGU0_BASE))); +} + +/**@brief Software interrupt handler (using EGU). */ +static void nrf_drv_swi_process(nrf_swi_t swi) +{ + ASSERT(m_swi_handlers[swi - SWI_START_NUMBER]); + nrf_swi_flags_t flags = 0; + NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); + + for (uint8_t i = 0; i < swi_channel_number(swi); ++i) + { + nrf_egu_event_t egu_event = nrf_egu_event_triggered_get(NRF_EGUx, i); + if (nrf_egu_event_check(NRF_EGUx, egu_event)) + { + flags |= (1u << i); + nrf_egu_event_clear(NRF_EGUx, egu_event); + } + } + + m_swi_handlers[swi - SWI_START_NUMBER](swi, flags); +} + +#define SWI_HANDLER_TEMPLATE(NUM) void SWI##NUM##_EGU##NUM##_IRQHandler(void) \ + { \ + nrf_drv_swi_process(NUM); \ + } + +#else + +/**@brief Software interrupt handler (without EGU). */ +static void nrf_drv_swi_process(nrf_swi_t swi, nrf_swi_flags_t flags) +{ + ASSERT(m_swi_handlers[swi - SWI_START_NUMBER]); + m_swi_flags[swi - SWI_START_NUMBER] &= ~flags; + m_swi_handlers[swi - SWI_START_NUMBER](swi, flags); +} + + +#define SWI_HANDLER_TEMPLATE(NUM) void SWI##NUM##_IRQHandler(void) \ + { \ + nrf_drv_swi_process((NUM), m_swi_flags[(NUM) - SWI_START_NUMBER]); \ + } + +#endif + +#if SWI_DISABLE0 == 0 +SWI_HANDLER_TEMPLATE(0) +#endif + +#if SWI_DISABLE1 == 0 +SWI_HANDLER_TEMPLATE(1) +#endif + +#if SWI_DISABLE2 == 0 +SWI_HANDLER_TEMPLATE(2) +#endif + +#if SWI_DISABLE3 == 0 +SWI_HANDLER_TEMPLATE(3) +#endif + +#if SWI_DISABLE4 == 0 +SWI_HANDLER_TEMPLATE(4) +#endif + +#if SWI_DISABLE5 == 0 +SWI_HANDLER_TEMPLATE(5) +#endif + +#define AVAILABLE_SWI (0x3FuL & ~( \ + (SWI_DISABLE0 << 0) | (SWI_DISABLE1 << 1) | (SWI_DISABLE2 << 2) \ + | (SWI_DISABLE3 << 3) | (SWI_DISABLE4 << 4) | (SWI_DISABLE5 << 5) \ + )) + +#if (AVAILABLE_SWI == 0) + #warning No available SWIs. +#endif + +/**@brief Function for converting SWI number to system interrupt number. + * + * @param[in] swi SWI number. + * + * @retval IRQ number. + */ +__STATIC_INLINE IRQn_Type nrf_drv_swi_irq_of(nrf_swi_t swi) +{ + return (IRQn_Type)((uint32_t)SWI0_IRQn + (uint32_t)swi); +} + + +/**@brief Function for checking if given SWI is allocated. + * + * @param[in] swi SWI number. + */ +__STATIC_INLINE bool swi_is_allocated(nrf_swi_t swi) +{ + ASSERT(swi < SWI_COUNT); +#if SWI_START_NUMBER > 0 + if (swi < SWI_START_NUMBER) + { + return false; + } +#endif + /*lint -e(661) out of range case handled by assert above*/ + return m_swi_handlers[swi - SWI_START_NUMBER]; +} + +ret_code_t nrf_drv_swi_init(void) +{ + ret_code_t err_code; + + if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED) + { + m_drv_state = NRF_DRV_STATE_INITIALIZED; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + err_code = NRF_ERROR_MODULE_ALREADY_INITIALIZED; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_swi_uninit(void) +{ + ASSERT(m_drv_state != NRF_DRV_STATE_UNINITIALIZED) + + for (uint32_t i = SWI_START_NUMBER; i < SWI_COUNT; ++i) + { + m_swi_handlers[i - SWI_START_NUMBER] = NULL; + nrf_drv_common_irq_disable(nrf_drv_swi_irq_of((nrf_swi_t) i)); +#if NRF_MODULE_ENABLED(EGU) + NRF_EGU_Type * NRF_EGUx = egu_instance_get(i); + nrf_egu_int_disable(NRF_EGUx, NRF_EGU_INT_ALL); +#endif + } + m_drv_state = NRF_DRV_STATE_UNINITIALIZED; + return; +} + + +void nrf_drv_swi_free(nrf_swi_t * p_swi) +{ + ASSERT(swi_is_allocated(*p_swi)); + nrf_drv_common_irq_disable(nrf_drv_swi_irq_of(*p_swi)); + m_swi_handlers[(*p_swi) - SWI_START_NUMBER] = NULL; + *p_swi = NRF_SWI_UNALLOCATED; +} + + +ret_code_t nrf_drv_swi_alloc(nrf_swi_t * p_swi, nrf_swi_handler_t event_handler, uint32_t priority) +{ + ASSERT(event_handler); + uint32_t err_code = NRF_ERROR_NO_MEM; + + for (uint32_t i = SWI_START_NUMBER; i < SWI_COUNT; i++) + { + CRITICAL_REGION_ENTER(); + if ((!swi_is_allocated(i)) && (AVAILABLE_SWI & (1 << i))) + { + m_swi_handlers[i - SWI_START_NUMBER] = event_handler; + *p_swi = (nrf_swi_t) i; + nrf_drv_common_irq_enable(nrf_drv_swi_irq_of(*p_swi), priority); +#if NRF_MODULE_ENABLED(EGU) + NRF_EGU_Type * NRF_EGUx = egu_instance_get(i); + nrf_egu_int_enable(NRF_EGUx, NRF_EGU_INT_ALL); +#endif + err_code = NRF_SUCCESS; + } + CRITICAL_REGION_EXIT(); + if (err_code == NRF_SUCCESS) + { + NRF_LOG_INFO("SWI channel allocated: %d.\r\n", (*p_swi)); + break; + } + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_swi_trigger(nrf_swi_t swi, uint8_t flag_number) +{ + ASSERT(swi_is_allocated((uint32_t) swi)); + ASSERT(flag_number < swi_channel_number(swi)); +#if NRF_MODULE_ENABLED(EGU) + NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); + nrf_egu_task_trigger(NRF_EGUx, nrf_egu_task_trigger_get(NRF_EGUx, flag_number)); +#else + m_swi_flags[swi - SWI_START_NUMBER] |= (1 << flag_number); + NVIC_SetPendingIRQ(nrf_drv_swi_irq_of(swi)); +#endif +} + + +#if NRF_MODULE_ENABLED(EGU) + +uint32_t nrf_drv_swi_task_trigger_address_get(nrf_swi_t swi, uint8_t channel) +{ + NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); + return (uint32_t) nrf_egu_task_trigger_addres_get(NRF_EGUx, channel); +} + +uint32_t nrf_drv_swi_event_triggered_address_get(nrf_swi_t swi, uint8_t channel) +{ + NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); + return (uint32_t) nrf_egu_event_triggered_addres_get(NRF_EGUx, channel); +} + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.h new file mode 100644 index 0000000000..d7b3e384e5 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.h @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup nrf_drv_swi SWI driver + * @{ + * @ingroup nrf_drivers + * + * @brief Driver for software interrupts (SWI). + * @details The SWI driver allows the user to allocate SWIs and pass extra flags to interrupt handler functions. + */ + +#ifndef NRF_DRV_SWI_H__ +#define NRF_DRV_SWI_H__ + +#include +#include +#include "app_util.h" +#include "app_util_platform.h" +#include "sdk_common.h" +#include "sdk_errors.h" +#include "nrf_peripherals.h" + +#ifndef EGU_ENABLED + #define EGU_ENABLED 0 +#endif + +#if NRF_MODULE_ENABLED(EGU) +#include "nrf_egu.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint8_t nrf_swi_t; ///< @brief SWI channel (unsigned integer). + +/** @brief SWI user flags (unsigned integer). + * + * User flags are set during the SWI trigger and passed to the callback function as an argument. + */ +typedef uint16_t nrf_swi_flags_t; + +/** @brief Unallocated channel value. */ +#define NRF_SWI_UNALLOCATED ((nrf_swi_t) 0xFFFFFFFFuL) + +/** @brief SWI handler function. + * + * Takes two arguments: SWI number (nrf_swi_t) and flags (nrf_swi_flags_t). + */ +typedef void (* nrf_swi_handler_t)(nrf_swi_t, nrf_swi_flags_t); + +/**@brief Maximum numbers of SWIs. This number is fixed for a specific chip. */ +#if NRF_MODULE_ENABLED(EGU) +#define SWI_MAX EGU_COUNT +#else +#define SWI_MAX SWI_COUNT +/**@brief Number of flags per SWI (fixed number). */ +#define SWI_MAX_FLAGS 16 +#endif + +#ifdef SOFTDEVICE_PRESENT + #if SWI_COUNT > 2 + #undef SWI_COUNT + #define SWI_COUNT 2 + #endif +#else + #ifdef SVCALL_AS_NORMAL_FUNCTION + // Serialization is enabled. + #if SWI_COUNT > 2 + #undef SWI_COUNT + #define SWI_COUNT 2 + #endif + #endif +#endif + +/**@brief Default SWI priority. */ +#define SWI_DEFAULT_PRIORITY APP_IRQ_PRIORITY_LOWEST + + +/**@brief Function for initializing the SWI module. + * + * @retval NRF_SUCCESS If the module was successfully initialized. + * @retval NRF_ERROR_MODULE_ALREADY_INITIALIZED If the module has already been initialized. + */ +ret_code_t nrf_drv_swi_init(void); + + +/**@brief Function for uninitializing the SWI module. + * + * This function also disables all SWIs. + */ +void nrf_drv_swi_uninit(void); + + +/**@brief Function for allocating a first unused SWI instance and setting a handler. + * @details The event handler function returns void and takes one uint32_t argument (SWI number). + * + * @param[out] p_swi Pointer to the SWI that has been allocated. + * @param[in] event_handler Event handler function (must not be NULL). + * @param[in] priority Interrupt priority. + * + * @retval NRF_SUCCESS If the SWI was successfully allocated. + * @retval NRF_ERROR_NO_MEM If there is no available SWI to be used. + */ +ret_code_t nrf_drv_swi_alloc(nrf_swi_t * p_swi, nrf_swi_handler_t event_handler, uint32_t priority); + + +/**@brief Function for freeing a previously allocated SWI. + * + * @param[in,out] p_swi SWI to free. The value is changed to NRF_SWI_UNALLOCATED on success. + */ +void nrf_drv_swi_free(nrf_swi_t * p_swi); + + +/**@brief Function for triggering the SWI. + * + * @param[in] swi SWI to trigger. + * @param[in] flag_number Number of user flag to trigger. + */ +void nrf_drv_swi_trigger(nrf_swi_t swi, uint8_t flag_number); + + +#if (EGU_ENABLED > 0) || defined(__SDK_DOXYGEN__) + + +/**@brief Function for returning the EGU trigger task address. + * + * @param[in] swi SWI instance. + * @param[in] channel Number of the EGU channel. + * + * @returns EGU trigger task address. + */ +uint32_t nrf_drv_swi_task_trigger_address_get(nrf_swi_t swi, uint8_t channel); + +/**@brief Function for returning the EGU triggered event address. + * + * @param[in] swi SWI instance. + * @param[in] channel Number of the EGU channel. + * + * @returns EGU triggered event address. + */ +uint32_t nrf_drv_swi_event_triggered_address_get(nrf_swi_t swi, uint8_t channel); + +#endif // NRF_MODULE_ENABLED(EGU) + + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DRV_SWI_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.c index 2ffdd36d6c..059bbd5d93 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.c @@ -36,15 +36,25 @@ * */ - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(TIMER) +#define ENABLED_TIMER_COUNT (TIMER0_ENABLED+TIMER1_ENABLED+TIMER2_ENABLED+TIMER3_ENABLED+TIMER4_ENABLED) +#if ENABLED_TIMER_COUNT #include "nrf_drv_timer.h" #include "nrf_drv_common.h" #include "app_util_platform.h" -#if (TIMER_COUNT == 0) - #error "No TIMER instances enabled in the driver configuration file." -#endif +#define NRF_LOG_MODULE_NAME "TIMER" +#if TIMER_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL TIMER_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR TIMER_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR TIMER_CONFIG_DEBUG_COLOR +#else //TIMER_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif //TIMER_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" /**@brief Timer control block. */ typedef struct @@ -54,52 +64,50 @@ typedef struct nrf_drv_state_t state; } timer_control_block_t; -static timer_control_block_t m_cb[TIMER_COUNT]; - -static const nrf_drv_timer_config_t m_default_config[TIMER_COUNT] = { -#if TIMER0_ENABLED - NRF_DRV_TIMER_DEFAULT_CONFIG(0), -#endif -#if TIMER1_ENABLED - NRF_DRV_TIMER_DEFAULT_CONFIG(1), -#endif -#if TIMER2_ENABLED - NRF_DRV_TIMER_DEFAULT_CONFIG(2), -#endif -#if TIMER3_ENABLED - NRF_DRV_TIMER_DEFAULT_CONFIG(3), -#endif -#if TIMER4_ENABLED - NRF_DRV_TIMER_DEFAULT_CONFIG(4), -#endif -}; - +static timer_control_block_t m_cb[ENABLED_TIMER_COUNT]; ret_code_t nrf_drv_timer_init(nrf_drv_timer_t const * const p_instance, nrf_drv_timer_config_t const * p_config, nrf_timer_event_handler_t timer_event_handler) { timer_control_block_t * p_cb = &m_cb[p_instance->instance_id]; - + ASSERT(((p_instance->p_reg == NRF_TIMER0) && TIMER0_ENABLED) || (p_instance->p_reg != NRF_TIMER0)); + ASSERT(((p_instance->p_reg == NRF_TIMER1) && TIMER1_ENABLED) || (p_instance->p_reg != NRF_TIMER1)); + ASSERT(((p_instance->p_reg == NRF_TIMER2) && TIMER2_ENABLED) || (p_instance->p_reg != NRF_TIMER2)); +#if TIMER_COUNT == 5 + ASSERT(((p_instance->p_reg == NRF_TIMER3) && TIMER3_ENABLED) || (p_instance->p_reg != NRF_TIMER3)); + ASSERT(((p_instance->p_reg == NRF_TIMER4) && TIMER4_ENABLED) || (p_instance->p_reg != NRF_TIMER4)); +#endif //TIMER_COUNT #ifdef SOFTDEVICE_PRESENT ASSERT(p_instance->p_reg != NRF_TIMER0); + ASSERT(p_config); #endif - ASSERT(NRF_TIMER_IS_BIT_WIDTH_VALID(p_instance->p_reg, p_config->bit_width)); + ret_code_t err_code; if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } if (timer_event_handler == NULL) { - return NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } - if (p_config == NULL) - { - p_config = &m_default_config[p_instance->instance_id]; - } + /* Warning 685: Relational operator '<=' always evaluates to 'true'" + * Warning in NRF_TIMER_IS_BIT_WIDTH_VALID macro. Macro validate timers resolution. + * Not necessary in nRF52 based systems. Obligatory in nRF51 based systems. + */ + + /*lint -save -e685 */ + + ASSERT(NRF_TIMER_IS_BIT_WIDTH_VALID(p_instance->p_reg, p_config->bit_width)); + + //lint -restore p_cb->handler = timer_event_handler; p_cb->context = p_config->p_context; @@ -120,7 +128,9 @@ ret_code_t nrf_drv_timer_init(nrf_drv_timer_t const * const p_instance, p_cb->state = NRF_DRV_STATE_INITIALIZED; - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance) @@ -132,9 +142,13 @@ void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance) nrf_timer_int_disable(p_instance->p_reg, DISABLE_ALL); #undef DISABLE_ALL - nrf_drv_timer_disable(p_instance); + if (m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON) + { + nrf_drv_timer_disable(p_instance); + } m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Uninitialized instance: %d.\r\n", p_instance->instance_id); } void nrf_drv_timer_enable(nrf_drv_timer_t const * const p_instance) @@ -142,6 +156,7 @@ void nrf_drv_timer_enable(nrf_drv_timer_t const * const p_instance) ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_INITIALIZED); nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_START); m_cb[p_instance->instance_id].state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Enabled instance: %d.\r\n", p_instance->instance_id); } void nrf_drv_timer_disable(nrf_drv_timer_t const * const p_instance) @@ -149,18 +164,21 @@ void nrf_drv_timer_disable(nrf_drv_timer_t const * const p_instance) ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_SHUTDOWN); m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED; + NRF_LOG_INFO("Disabled instance: %d.\r\n", p_instance->instance_id); } void nrf_drv_timer_resume(nrf_drv_timer_t const * const p_instance) { ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_START); + NRF_LOG_INFO("Resumed instance: %d.\r\n", p_instance->instance_id); } void nrf_drv_timer_pause(nrf_drv_timer_t const * const p_instance) { ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_STOP); + NRF_LOG_INFO("Paused instance: %d.\r\n", p_instance->instance_id); } void nrf_drv_timer_clear(nrf_drv_timer_t const * const p_instance) @@ -205,6 +223,7 @@ void nrf_drv_timer_compare(nrf_drv_timer_t const * const p_instance, } nrf_timer_cc_write(p_instance->p_reg, cc_channel, cc_value); + NRF_LOG_INFO("Timer id: %d, capture value set: %d, channel: %d.\r\n", p_instance->instance_id, cc_value, cc_channel); } void nrf_drv_timer_extended_compare(nrf_drv_timer_t const * const p_instance, @@ -223,6 +242,7 @@ void nrf_drv_timer_extended_compare(nrf_drv_timer_t const * const p_instance, cc_channel, cc_value, enable_int); + NRF_LOG_INFO("Timer id: %d, capture value set: %d, channel: %d.\r\n", p_instance->instance_id, cc_value, cc_channel); } void nrf_drv_timer_compare_int_enable(nrf_drv_timer_t const * const p_instance, @@ -261,12 +281,13 @@ static void irq_handler(NRF_TIMER_Type * p_reg, nrf_timer_int_enable_check(p_reg, int_mask)) { nrf_timer_event_clear(p_reg, event); + NRF_LOG_DEBUG("Compare event, channel: %d.\r\n", i); p_cb->handler(event, p_cb->context); } } } -#if TIMER0_ENABLED +#if NRF_MODULE_ENABLED(TIMER0) void TIMER0_IRQHandler(void) { irq_handler(NRF_TIMER0, &m_cb[TIMER0_INSTANCE_INDEX], @@ -274,7 +295,7 @@ void TIMER0_IRQHandler(void) } #endif -#if TIMER1_ENABLED +#if NRF_MODULE_ENABLED(TIMER1) void TIMER1_IRQHandler(void) { irq_handler(NRF_TIMER1, &m_cb[TIMER1_INSTANCE_INDEX], @@ -282,7 +303,7 @@ void TIMER1_IRQHandler(void) } #endif -#if TIMER2_ENABLED +#if NRF_MODULE_ENABLED(TIMER2) void TIMER2_IRQHandler(void) { irq_handler(NRF_TIMER2, &m_cb[TIMER2_INSTANCE_INDEX], @@ -290,7 +311,7 @@ void TIMER2_IRQHandler(void) } #endif -#if TIMER3_ENABLED +#if NRF_MODULE_ENABLED(TIMER3) void TIMER3_IRQHandler(void) { irq_handler(NRF_TIMER3, &m_cb[TIMER3_INSTANCE_INDEX], @@ -298,10 +319,12 @@ void TIMER3_IRQHandler(void) } #endif -#if TIMER4_ENABLED +#if NRF_MODULE_ENABLED(TIMER4) void TIMER4_IRQHandler(void) { irq_handler(NRF_TIMER4, &m_cb[TIMER4_INSTANCE_INDEX], NRF_TIMER_CC_CHANNEL_COUNT(4)); } #endif +#endif // ENABLED_TIMER_COUNT +#endif // NRF_MODULE_ENABLED(TIMER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.h index bc6385c84c..7579f0bf36 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/timer/nrf_drv_timer.h @@ -36,7 +36,6 @@ * */ - /**@file * @addtogroup nrf_timer Timer HAL and driver * @ingroup nrf_drivers @@ -44,7 +43,7 @@ * @details The timer HAL provides basic APIs for accessing the registers * of the timer. The timer driver provides APIs on a higher level. * - * @defgroup lib_driver_timer Timer driver + * @defgroup nrf_drv_timer Timer driver * @{ * @ingroup nrf_timer * @brief Multi-instance timer driver. @@ -54,11 +53,15 @@ #define NRF_DRV_TIMER_H__ #include "nordic_common.h" -#include "nrf_drv_config.h" +#include "sdk_config.h" #include "nrf_timer.h" #include "sdk_errors.h" #include "nrf_assert.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Timer driver instance data structure. */ @@ -69,6 +72,14 @@ typedef struct uint8_t cc_channel_count; ///< Number of capture/compare channels. } nrf_drv_timer_t; +#define ENABLED_TIMER_COUNT (TIMER0_ENABLED+TIMER1_ENABLED+TIMER2_ENABLED+TIMER3_ENABLED+TIMER4_ENABLED) + +#define TIMER0_INSTANCE_INDEX 0 +#define TIMER1_INSTANCE_INDEX TIMER0_INSTANCE_INDEX+TIMER0_ENABLED +#define TIMER2_INSTANCE_INDEX TIMER1_INSTANCE_INDEX+TIMER1_ENABLED +#define TIMER3_INSTANCE_INDEX TIMER2_INSTANCE_INDEX+TIMER2_ENABLED +#define TIMER4_INSTANCE_INDEX TIMER3_INSTANCE_INDEX+TIMER3_ENABLED + /** * @brief Macro for creating a timer driver instance. */ @@ -91,21 +102,16 @@ typedef struct void * p_context; ///< Context passed to interrupt handler. } nrf_drv_timer_config_t; -#define TIMER_CONFIG_FREQUENCY(id) CONCAT_3(TIMER, id, _CONFIG_FREQUENCY) -#define TIMER_CONFIG_MODE(id) CONCAT_3(TIMER, id, _CONFIG_MODE) -#define TIMER_CONFIG_BIT_WIDTH(id) CONCAT_3(TIMER, id, _CONFIG_BIT_WIDTH) -#define TIMER_CONFIG_IRQ_PRIORITY(id) CONCAT_3(TIMER, id, _CONFIG_IRQ_PRIORITY) - /** * @brief Timer driver instance default configuration. */ -#define NRF_DRV_TIMER_DEFAULT_CONFIG(id) \ -{ \ - .frequency = TIMER_CONFIG_FREQUENCY(id), \ - .mode = (nrf_timer_mode_t)TIMER_CONFIG_MODE(id), \ - .bit_width = (nrf_timer_bit_width_t)TIMER_CONFIG_BIT_WIDTH(id), \ - .interrupt_priority = TIMER_CONFIG_IRQ_PRIORITY(id), \ - .p_context = NULL \ +#define NRF_DRV_TIMER_DEFAULT_CONFIG \ +{ \ + .frequency = (nrf_timer_frequency_t)TIMER_DEFAULT_CONFIG_FREQUENCY,\ + .mode = (nrf_timer_mode_t)TIMER_DEFAULT_CONFIG_MODE, \ + .bit_width = (nrf_timer_bit_width_t)TIMER_DEFAULT_CONFIG_BIT_WIDTH,\ + .interrupt_priority = TIMER_DEFAULT_CONFIG_IRQ_PRIORITY, \ + .p_context = NULL \ } /** @@ -113,8 +119,8 @@ typedef struct * * @param[in] event_type Timer event. * @param[in] p_context General purpose parameter set during initialization of - * the timer. This parameter can be used to pass - * additional information to the handler function, for + * the timer. This parameter can be used to pass + * additional information to the handler function, for * example, the timer ID. */ typedef void (* nrf_timer_event_handler_t)(nrf_timer_event_t event_type, @@ -123,7 +129,7 @@ typedef void (* nrf_timer_event_handler_t)(nrf_timer_event_t event_type, /** * @brief Function for initializing the timer. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_config Initial configuration. * If NULL, the default configuration is used. * @param[in] timer_event_handler Event handler provided by the user. @@ -140,59 +146,59 @@ ret_code_t nrf_drv_timer_init(nrf_drv_timer_t const * const p_instance, /** * @brief Function for uninitializing the timer. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance); /** * @brief Function for turning on the timer. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_timer_enable(nrf_drv_timer_t const * const p_instance); /** * @brief Function for turning off the timer. * - * Note that the timer will allow to enter the lowest possible SYSTEM_ON state + * Note that the timer will allow to enter the lowest possible SYSTEM_ON state * only after this function is called. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_timer_disable(nrf_drv_timer_t const * const p_instance); /** * @brief Function for pausing the timer. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_timer_pause(nrf_drv_timer_t const * const p_instance); /** * @brief Function for resuming the timer. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_timer_resume(nrf_drv_timer_t const * const p_instance); /** * @brief Function for clearing the timer. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_timer_clear(nrf_drv_timer_t const * const p_instance); /** * @brief Function for incrementing the timer. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_timer_increment(nrf_drv_timer_t const * const p_instance); /** * @brief Function for returning the address of a specific timer task. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] timer_task Timer task. * * @return Task address. @@ -204,7 +210,7 @@ __STATIC_INLINE uint32_t nrf_drv_timer_task_address_get( /** * @brief Function for returning the address of a specific timer capture task. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] channel Capture channel number. * * @return Task address. @@ -216,7 +222,7 @@ __STATIC_INLINE uint32_t nrf_drv_timer_capture_task_address_get( /** * @brief Function for returning the address of a specific timer event. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] timer_event Timer event. * * @return Event address. @@ -228,7 +234,7 @@ __STATIC_INLINE uint32_t nrf_drv_timer_event_address_get( /** * @brief Function for returning the address of a specific timer compare event. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] channel Compare channel number. * * @return Event address. @@ -240,7 +246,7 @@ __STATIC_INLINE uint32_t nrf_drv_timer_compare_event_address_get( /** * @brief Function for capturing the timer value. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] cc_channel Capture channel number. * * @return Captured value. @@ -253,7 +259,7 @@ uint32_t nrf_drv_timer_capture(nrf_drv_timer_t const * const p_instance, * * Use this function to read channel values when PPI is used for capturing. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] cc_channel Capture channel number. * * @return Captured value. @@ -265,7 +271,7 @@ __STATIC_INLINE uint32_t nrf_drv_timer_capture_get( /** * @brief Function for setting the timer channel in compare mode. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] cc_channel Compare channel number. * @param[in] cc_value Compare value. * @param[in] enable_int Enable or disable the interrupt for the compare channel. @@ -278,7 +284,7 @@ void nrf_drv_timer_compare(nrf_drv_timer_t const * const p_instance, /** * @brief Function for setting the timer channel in extended compare mode. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] cc_channel Compare channel number. * @param[in] cc_value Compare value. * @param[in] timer_short_mask Shortcut between the compare event on the channel @@ -295,7 +301,7 @@ void nrf_drv_timer_extended_compare(nrf_drv_timer_t const * const p_instance, /** * @brief Function for converting time in microseconds to timer ticks. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] time_us Time in microseconds. * * @return Number of ticks. @@ -307,7 +313,7 @@ __STATIC_INLINE uint32_t nrf_drv_timer_us_to_ticks( /** * @brief Function for converting time in milliseconds to timer ticks. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] time_ms Time in milliseconds. * * @return Number of ticks. @@ -319,7 +325,7 @@ __STATIC_INLINE uint32_t nrf_drv_timer_ms_to_ticks( /** * @brief Function for enabling timer compare interrupt. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] channel Compare channel. */ void nrf_drv_timer_compare_int_enable(nrf_drv_timer_t const * const p_instance, @@ -328,7 +334,7 @@ void nrf_drv_timer_compare_int_enable(nrf_drv_timer_t const * const p_instance, /** * @brief Function for disabling timer compare interrupt. * - * @param[in] p_instance Timer instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] channel Compare channel. */ void nrf_drv_timer_compare_int_disable(nrf_drv_timer_t const * const p_instance, @@ -394,6 +400,11 @@ __STATIC_INLINE uint32_t nrf_drv_timer_ms_to_ticks( #endif // SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + #endif // NRF_DRV_TIMER_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c index a70c39e73d..fde2cefa11 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c @@ -36,7 +36,10 @@ * */ - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(TWI) +#define ENABLED_TWI_COUNT (TWI0_ENABLED+TWI1_ENABLED) +#if ENABLED_TWI_COUNT #include "nrf_drv_twi.h" #include "nrf_drv_common.h" #include "nrf_gpio.h" @@ -46,6 +49,43 @@ #include +#define NRF_LOG_MODULE_NAME "TWI" + +#if TWI_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL TWI_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR TWI_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR TWI_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_DRV_TWI_EVT_DONE ? "EVT_DONE" : \ + (event == NRF_DRV_TWI_EVT_ADDRESS_NACK ? "EVT_ADDRESS_NACK" : \ + (event == NRF_DRV_TWI_EVT_DATA_NACK ? "EVT_DATA_NACK" : "UNKNOWN ERROR")))))) +#define EVT_TO_STR_TWI(event) (event == NRF_TWI_EVENT_STOPPED ? "NRF_TWI_EVENT_STOPPED" : \ + (event == NRF_TWI_EVENT_RXDREADY ? "NRF_TWI_EVENT_RXDREADY" : \ + (event == NRF_TWI_EVENT_TXDSENT ? "NRF_TWI_EVENT_TXDSENT" : \ + (event == NRF_TWI_EVENT_ERROR ? "NRF_TWI_EVENT_ERROR" : \ + (event == NRF_TWI_EVENT_BB ? "NRF_TWI_EVENT_BB" : \ + (event == NRF_TWI_EVENT_SUSPENDED ? "NRF_TWI_EVENT_SUSPENDED" : "UNKNOWN ERROR")))))) +#define EVT_TO_STR_TWIM(event) (event == NRF_TWIM_EVENT_STOPPED ? "NRF_TWIM_EVENT_STOPPED" : \ + (event == NRF_TWIM_EVENT_ERROR ? "NRF_TWIM_EVENT_ERROR" : \ + (event == NRF_TWIM_EVENT_SUSPENDED ? "NRF_TWIM_EVENT_SUSPENDED" : \ + (event == NRF_TWIM_EVENT_RXSTARTED ? "NRF_TWIM_EVENT_RXSTARTED" : \ + (event == NRF_TWIM_EVENT_TXSTARTED ? "NRF_TWIM_EVENT_TXSTARTED" : \ + (event == NRF_TWIM_EVENT_LASTRX ? "NRF_TWIM_EVENT_LASTRX" : \ + (event == NRF_TWIM_EVENT_LASTTX ? "NRF_TWIM_EVENT_LASTTX" : "UNKNOWN ERROR"))))))) +#define TRANSFER_TO_STR(type) (type == NRF_DRV_TWI_XFER_TX ? "XFER_TX" : \ + (type == NRF_DRV_TWI_XFER_RX ? "XFER_RX" : \ + (type == NRF_DRV_TWI_XFER_TXRX ? "XFER_TXRX" : \ + (type == NRF_DRV_TWI_XFER_TXTX ? "XFER_TXTX" : "UNKNOWN TRANSFER TYPE")))) +#else //TWI_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define EVT_TO_STR_TWI(event) "" +#define EVT_TO_STR_TWIM(event) "" +#define TRANSFER_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //TWI_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + + #define TWI0_IRQ_HANDLER SPI0_TWI0_IRQHandler #define TWI1_IRQ_HANDLER SPI1_TWI1_IRQHandler @@ -66,23 +106,29 @@ #endif // All interrupt flags -#define DISABLE_ALL 0xFFFFFFFF +#define DISABLE_ALL_INT_SHORT 0xFFFFFFFF -#define SCL_PIN_CONF ((GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \ - | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) \ - | (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) \ - | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \ - | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)) +#define SCL_PIN_INIT_CONF ( (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \ + | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) \ + | (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) \ + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \ + | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)) +#define SDA_PIN_INIT_CONF SCL_PIN_INIT_CONF -#define SDA_PIN_CONF SCL_PIN_CONF +#define SDA_PIN_UNINIT_CONF ( (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \ + | (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) \ + | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) \ + | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) \ + | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos)) +#define SCL_PIN_UNINIT_CONF SDA_PIN_UNINIT_CONF -#define SCL_PIN_CONF_CLR ((GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \ - | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) \ - | (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) \ - | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \ - | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos)) +#define SCL_PIN_INIT_CONF_CLR ( (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \ + | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) \ + | (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) \ + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \ + | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos)) +#define SDA_PIN_INIT_CONF_CLR SCL_PIN_INIT_CONF_CLR -#define SDA_PIN_CONF_CLR SCL_PIN_CONF_CLR // Control block - driver instance local data. typedef struct @@ -100,60 +146,73 @@ typedef struct volatile bool busy; bool repeated; uint8_t bytes_transferred; + bool hold_bus_uninit; } twi_control_block_t; -static twi_control_block_t m_cb[TWI_COUNT]; +static twi_control_block_t m_cb[ENABLED_TWI_COUNT]; -static nrf_drv_twi_config_t const m_default_config[TWI_COUNT] = { -#if TWI0_ENABLED - NRF_DRV_TWI_DEFAULT_CONFIG(0), -#endif -#if TWI1_ENABLED - NRF_DRV_TWI_DEFAULT_CONFIG(1), -#endif -}; - -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n #define IRQ_HANDLER(n) static void IRQ_HANDLER_NAME(n)(void) - #if TWI0_ENABLED + #if NRF_MODULE_ENABLED(TWI0) IRQ_HANDLER(0); #endif - #if TWI1_ENABLED + #if NRF_MODULE_ENABLED(TWI1) IRQ_HANDLER(1); #endif - static nrf_drv_irq_handler_t const m_irq_handlers[TWI_COUNT] = { - #if TWI0_ENABLED + static nrf_drv_irq_handler_t const m_irq_handlers[ENABLED_TWI_COUNT] = { + #if NRF_MODULE_ENABLED(TWI0) IRQ_HANDLER_NAME(0), #endif - #if TWI1_ENABLED + #if NRF_MODULE_ENABLED(TWI1) IRQ_HANDLER_NAME(1), #endif }; #else #define IRQ_HANDLER(n) void SPI##n##_TWI##n##_IRQHandler(void) -#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED +#endif // NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) -static void twi_clear_bus(nrf_drv_twi_t const * const p_instance, - nrf_drv_twi_config_t const * p_config) +static ret_code_t twi_process_error(uint32_t errorsrc) { - NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF; - NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF; + ret_code_t ret = NRF_ERROR_INTERNAL; + + if (errorsrc & NRF_TWI_ERROR_OVERRUN) + { + ret = NRF_ERROR_DRV_TWI_ERR_OVERRUN; + } + + if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) + { + ret = NRF_ERROR_DRV_TWI_ERR_ANACK; + } + + if (errorsrc & NRF_TWI_ERROR_DATA_NACK) + { + ret = NRF_ERROR_DRV_TWI_ERR_DNACK; + } + + return ret; +} + +static void twi_clear_bus(nrf_drv_twi_config_t const * p_config) +{ + NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_INIT_CONF; + NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_INIT_CONF; nrf_gpio_pin_set(p_config->scl); nrf_gpio_pin_set(p_config->sda); - NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF_CLR; - NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF_CLR; + NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_INIT_CONF_CLR; + NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_INIT_CONF_CLR; nrf_delay_us(4); - for(int i = 0; i < 9; i++) + for (int i = 0; i < 9; i++) { if (nrf_gpio_pin_read(p_config->sda)) { - if(i == 0) + if (i == 0) { return; } @@ -177,40 +236,47 @@ ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * p_instance, nrf_drv_twi_evt_handler_t event_handler, void * p_context) { + ASSERT(p_config); + ASSERT(p_config->scl != p_config->sda); twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ret_code_t err_code; if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) { - return NRF_ERROR_INVALID_STATE; + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } - if (p_config == NULL) - { - p_config = &m_default_config[p_instance->drv_inst_idx]; - } - -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) if (nrf_drv_common_per_res_acquire(p_instance->reg.p_twi, m_irq_handlers[p_instance->drv_inst_idx]) != NRF_SUCCESS) { - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } -#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED +#endif // NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) - p_cb->handler = event_handler; - p_cb->p_context = p_context; - p_cb->int_mask = 0; - p_cb->repeated = false; - p_cb->busy = false; + p_cb->handler = event_handler; + p_cb->p_context = p_context; + p_cb->int_mask = 0; + p_cb->repeated = false; + p_cb->busy = false; + p_cb->hold_bus_uninit = p_config->hold_bus_uninit; - twi_clear_bus(p_instance, p_config); + if(p_config->clear_bus_init) + { + /* Send clocks (max 9) until slave device back from stuck mode */ + twi_clear_bus(p_config); + } /* To secure correct signal levels on the pins used by the TWI master when the system is in OFF mode, and when the TWI master is disabled, these pins must be configured in the GPIO peripheral. */ - NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF; - NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF; + NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_INIT_CONF; + NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_INIT_CONF; CODE_FOR_TWIM ( @@ -243,7 +309,9 @@ ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * p_instance, p_cb->state = NRF_DRV_STATE_INITIALIZED; - return NRF_SUCCESS; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } void nrf_drv_twi_uninit(nrf_drv_twi_t const * p_instance) @@ -264,11 +332,26 @@ void nrf_drv_twi_uninit(nrf_drv_twi_t const * p_instance) } nrf_drv_twi_disable(p_instance); -#if PERIPHERAL_RESOURCE_SHARING_ENABLED +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) nrf_drv_common_per_res_release(p_instance->reg.p_twi); #endif + if (!p_cb->hold_bus_uninit) + { + CODE_FOR_TWIM + ( + NRF_GPIO->PIN_CNF[p_instance->reg.p_twim->PSEL.SCL] = SCL_PIN_UNINIT_CONF; + NRF_GPIO->PIN_CNF[p_instance->reg.p_twim->PSEL.SDA] = SDA_PIN_UNINIT_CONF; + ) + CODE_FOR_TWI + ( + NRF_GPIO->PIN_CNF[p_instance->reg.p_twi->PSELSCL] = SCL_PIN_UNINIT_CONF; + NRF_GPIO->PIN_CNF[p_instance->reg.p_twi->PSELSDA] = SDA_PIN_UNINIT_CONF; + ) + } + p_cb->state = NRF_DRV_STATE_UNINITIALIZED; + NRF_LOG_INFO("Instance uninitialized: %d.\r\n", p_instance->drv_inst_idx); } void nrf_drv_twi_enable(nrf_drv_twi_t const * p_instance) @@ -290,6 +373,7 @@ void nrf_drv_twi_enable(nrf_drv_twi_t const * p_instance) ) p_cb->state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Instance enabled: %d.\r\n", p_instance->drv_inst_idx); } void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance) @@ -301,19 +385,20 @@ void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance) ( NRF_TWIM_Type * p_twim = p_instance->reg.p_twim; p_cb->int_mask = 0; - nrf_twim_int_disable(p_twim, DISABLE_ALL); - nrf_twim_shorts_disable(p_twim, DISABLE_ALL); + nrf_twim_int_disable(p_twim, DISABLE_ALL_INT_SHORT); + nrf_twim_shorts_disable(p_twim, DISABLE_ALL_INT_SHORT); nrf_twim_disable(p_twim); ) CODE_FOR_TWI ( NRF_TWI_Type * p_twi = p_instance->reg.p_twi; - nrf_twi_int_disable(p_twi, DISABLE_ALL); - nrf_twi_shorts_disable(p_twi, DISABLE_ALL); + nrf_twi_int_disable(p_twi, DISABLE_ALL_INT_SHORT); + nrf_twi_shorts_disable(p_twi, DISABLE_ALL_INT_SHORT); nrf_twi_disable(p_twi); ) p_cb->state = NRF_DRV_STATE_INITIALIZED; + NRF_LOG_INFO("Instance disabled: %d.\r\n", p_instance->drv_inst_idx); } #ifdef TWI_IN_USE @@ -354,7 +439,7 @@ static void twi_receive_byte(NRF_TWI_Type * p_twi, ++(*p_bytes_transferred); - if (*p_bytes_transferred == length-1) + if (*p_bytes_transferred == length - 1) { nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_STOP_MASK); } @@ -374,16 +459,7 @@ static bool twi_transfer(NRF_TWI_Type * p_twi, uint8_t length, bool no_stop) { - bool do_stop_check; - - if ((*p_error == true) || (*p_bytes_transferred == length)) - { - do_stop_check = true; - } - else - { - do_stop_check = false; - } + bool do_stop_check = ((*p_error) || ((*p_bytes_transferred) == length)); if (*p_error) { @@ -394,6 +470,7 @@ static bool twi_transfer(NRF_TWI_Type * p_twi, else if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR)) { nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); + NRF_LOG_DEBUG("TWI: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWI(NRF_TWI_EVENT_ERROR)); nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP); *p_error = true; } @@ -402,9 +479,11 @@ static bool twi_transfer(NRF_TWI_Type * p_twi, if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_TXDSENT)) { nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT); + NRF_LOG_DEBUG("TWI: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWI(NRF_TWI_EVENT_TXDSENT)); if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR)) { nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); + NRF_LOG_DEBUG("TWI: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWI(NRF_TWI_EVENT_ERROR)); nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP); *p_error = true; } @@ -419,8 +498,10 @@ static bool twi_transfer(NRF_TWI_Type * p_twi, else if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_RXDREADY)) { nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY); + NRF_LOG_DEBUG("TWI: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWI(NRF_TWI_EVENT_RXDREADY)); if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR)) { + NRF_LOG_DEBUG("TWI: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWI(NRF_TWI_EVENT_ERROR)); nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP); *p_error = true; @@ -435,6 +516,7 @@ static bool twi_transfer(NRF_TWI_Type * p_twi, if (do_stop_check && nrf_twi_event_check(p_twi, NRF_TWI_EVENT_STOPPED)) { nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED); + NRF_LOG_DEBUG("TWI: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWI(NRF_TWI_EVENT_STOPPED)); return false; } @@ -479,8 +561,14 @@ static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb, if (p_cb->error) { - ret_code = NRF_ERROR_INTERNAL; + uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(p_twi); + + if (errorsrc) + { + ret_code = twi_process_error(errorsrc); + } } + } return ret_code; } @@ -527,7 +615,12 @@ static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb, if (p_cb->error) { - ret_code = NRF_ERROR_INTERNAL; + uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(p_twi); + + if (errorsrc) + { + ret_code = twi_process_error(errorsrc); + } } } return ret_code; @@ -538,15 +631,18 @@ __STATIC_INLINE ret_code_t twi_xfer(twi_control_block_t * p_cb, nrf_drv_twi_xfer_desc_t const * p_xfer_desc, uint32_t flags) { - ret_code_t ret = NRF_SUCCESS; + + ret_code_t err_code = NRF_SUCCESS; /* Block TWI interrupts to ensure that function is not interrupted by TWI interrupt. */ - nrf_twi_int_disable(p_twi, DISABLE_ALL); + nrf_twi_int_disable(p_twi, DISABLE_ALL_INT_SHORT); if (p_cb->busy) { nrf_twi_int_enable(p_twi, p_cb->int_mask); - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } else { @@ -555,7 +651,9 @@ __STATIC_INLINE ret_code_t twi_xfer(twi_control_block_t * p_cb, if (flags & NRF_DRV_TWI_FLAG_HOLD_XFER) { - return NRF_ERROR_NOT_SUPPORTED; + err_code = NRF_ERROR_NOT_SUPPORTED; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } p_cb->flags = flags; @@ -568,18 +666,20 @@ __STATIC_INLINE ret_code_t twi_xfer(twi_control_block_t * p_cb, { p_cb->curr_no_stop = ((p_xfer_desc->type == NRF_DRV_TWI_XFER_TX) && !(flags & NRF_DRV_TWI_FLAG_TX_NO_STOP)) ? false : true; - ret = twi_tx_start_transfer(p_cb, p_twi, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length, p_cb->curr_no_stop); + + err_code = twi_tx_start_transfer(p_cb, p_twi, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length, p_cb->curr_no_stop); } else { p_cb->curr_no_stop = false; - ret = twi_rx_start_transfer(p_cb, p_twi, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); + + err_code = twi_rx_start_transfer(p_cb, p_twi, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); } if (p_cb->handler == NULL) { p_cb->busy = false; } - return ret; + return err_code; } #endif @@ -603,32 +703,33 @@ __STATIC_INLINE void twim_list_enable_handle(NRF_TWIM_Type * p_twim, uint32_t fl { nrf_twim_rx_list_disable(p_twim); } -#ifndef NRF52_PAN_46 -#endif } __STATIC_INLINE ret_code_t twim_xfer(twi_control_block_t * p_cb, NRF_TWIM_Type * p_twim, nrf_drv_twi_xfer_desc_t const * p_xfer_desc, uint32_t flags) { - ret_code_t ret = NRF_SUCCESS; + ret_code_t err_code = NRF_SUCCESS; nrf_twim_task_t start_task = NRF_TWIM_TASK_STARTTX; nrf_twim_event_t evt_to_wait = NRF_TWIM_EVENT_STOPPED; if (!nrf_drv_is_in_RAM(p_xfer_desc->p_primary_buf)) { - return NRF_ERROR_INVALID_ADDR; + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } /* Block TWI interrupts to ensure that function is not interrupted by TWI interrupt. */ - nrf_twim_int_disable(p_twim, DISABLE_ALL); + nrf_twim_int_disable(p_twim, DISABLE_ALL_INT_SHORT); if (p_cb->busy) { nrf_twim_int_enable(p_twim, p_cb->int_mask); - return NRF_ERROR_BUSY; + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } else { - p_cb->busy = ((NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER & flags) || (NRF_DRV_TWI_FLAG_REPEATED_XFER & flags)) ? false: true; } @@ -649,7 +750,9 @@ __STATIC_INLINE ret_code_t twim_xfer(twi_control_block_t * p_cb, ASSERT(!(flags & NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER)); if (!nrf_drv_is_in_RAM(p_xfer_desc->p_secondary_buf)) { - return NRF_ERROR_INVALID_ADDR; + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK); nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); @@ -658,14 +761,21 @@ __STATIC_INLINE ret_code_t twim_xfer(twi_control_block_t * p_cb, nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_SUSPENDED); nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STARTTX); - while(!nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_TXSTARTED)) + while (!nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_TXSTARTED)) {} + NRF_LOG_DEBUG("TWIM: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWIM(NRF_TWIM_EVENT_TXSTARTED)); nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_TXSTARTED); nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_secondary_buf, p_xfer_desc->secondary_length); p_cb->int_mask = NRF_TWIM_INT_SUSPENDED_MASK | NRF_TWIM_INT_ERROR_MASK; break; case NRF_DRV_TWI_XFER_TXRX: nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length); + if (!nrf_drv_is_in_RAM(p_xfer_desc->p_secondary_buf)) + { + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } nrf_twim_rx_buffer_set(p_twim, p_xfer_desc->p_secondary_buf, p_xfer_desc->secondary_length); nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_STARTRX_MASK | NRF_TWIM_SHORT_LASTRX_STOP_MASK); @@ -695,7 +805,7 @@ __STATIC_INLINE ret_code_t twim_xfer(twi_control_block_t * p_cb, nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); break; default: - ret = NRF_ERROR_INVALID_PARAM; + err_code = NRF_ERROR_INVALID_PARAM; break; } @@ -718,6 +828,7 @@ __STATIC_INLINE ret_code_t twim_xfer(twi_control_block_t * p_cb, { if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_ERROR)) { + NRF_LOG_DEBUG("TWIM: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWIM(NRF_TWIM_EVENT_ERROR)); nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR); nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STOP); @@ -731,10 +842,10 @@ __STATIC_INLINE ret_code_t twim_xfer(twi_control_block_t * p_cb, if (errorsrc) { - ret = NRF_ERROR_INTERNAL; + err_code = twi_process_error(errorsrc); } } - return ret; + return err_code; } #endif @@ -742,32 +853,39 @@ ret_code_t nrf_drv_twi_xfer(nrf_drv_twi_t const * p_instance, nrf_drv_twi_xfer_desc_t const * p_xfer_desc, uint32_t flags) { - ret_code_t ret = NRF_SUCCESS; + + ret_code_t err_code = NRF_SUCCESS; twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; // TXRX and TXTX transfers are support only in non-blocking mode. ASSERT( !((p_cb->handler == NULL) && (p_xfer_desc->type == NRF_DRV_TWI_XFER_TXRX))); ASSERT( !((p_cb->handler == NULL) && (p_xfer_desc->type == NRF_DRV_TWI_XFER_TXTX))); + NRF_LOG_INFO("Transfer type: %s.\r\n", (uint32_t)TRANSFER_TO_STR(p_xfer_desc->type)); + NRF_LOG_INFO("Transfer buffers length: primary: %d, secondary: %d.\r\n", p_xfer_desc->primary_length, p_xfer_desc->secondary_length); + NRF_LOG_DEBUG("Primary buffer data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length * sizeof(p_xfer_desc->p_primary_buf)); + NRF_LOG_DEBUG("Secondary buffer data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_xfer_desc->p_secondary_buf, p_xfer_desc->secondary_length * sizeof(p_xfer_desc->p_secondary_buf)); + CODE_FOR_TWIM ( - ret = twim_xfer(p_cb, (NRF_TWIM_Type *)p_instance->reg.p_twim, p_xfer_desc, flags); + + err_code = twim_xfer(p_cb, (NRF_TWIM_Type *)p_instance->reg.p_twim, p_xfer_desc, flags); ) CODE_FOR_TWI ( if ( (NRF_DRV_TWI_FLAG_TX_POSTINC | NRF_DRV_TWI_FLAG_RX_POSTINC) & flags) { - return NRF_ERROR_NOT_SUPPORTED; + err_code = NRF_ERROR_NOT_SUPPORTED; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } - ret = twi_xfer(p_cb, (NRF_TWI_Type *)p_instance->reg.p_twi, p_xfer_desc, flags); - ) - return ret; -} -bool nrf_drv_twi_is_busy(nrf_drv_twi_t const * p_instance) -{ - twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - return p_cb->busy; + err_code = twi_xfer(p_cb, (NRF_TWI_Type *)p_instance->reg.p_twi, p_xfer_desc, flags); + ) + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; } ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance, @@ -836,6 +954,7 @@ static void irq_handler_twim(NRF_TWIM_Type * p_twim, twi_control_block_t * p_cb) if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_ERROR)) { nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR); + NRF_LOG_DEBUG("TWIM: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWIM(NRF_TWIM_EVENT_ERROR)); if (!nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_STOPPED)) { nrf_twim_int_disable(p_twim, p_cb->int_mask); @@ -852,6 +971,7 @@ static void irq_handler_twim(NRF_TWIM_Type * p_twim, twi_control_block_t * p_cb) if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_STOPPED)) { + NRF_LOG_DEBUG("TWIM: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWIM(NRF_TWIM_EVENT_STOPPED)); nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_STOPPED); event.xfer_desc = p_cb->xfer_desc; if (p_cb->error) @@ -869,12 +989,13 @@ static void irq_handler_twim(NRF_TWIM_Type * p_twim, twi_control_block_t * p_cb) { nrf_twim_shorts_set(p_twim, 0); p_cb->int_mask = 0; - nrf_twim_int_disable(p_twim, DISABLE_ALL); + nrf_twim_int_disable(p_twim, DISABLE_ALL_INT_SHORT); } } else { nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_SUSPENDED); + NRF_LOG_DEBUG("TWIM: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWIM(NRF_TWIM_EVENT_SUSPENDED)); if (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TX) { event.xfer_desc = p_cb->xfer_desc; @@ -882,14 +1003,14 @@ static void irq_handler_twim(NRF_TWIM_Type * p_twim, twi_control_block_t * p_cb) { nrf_twim_shorts_set(p_twim, 0); p_cb->int_mask = 0; - nrf_twim_int_disable(p_twim, DISABLE_ALL); + nrf_twim_int_disable(p_twim, DISABLE_ALL_INT_SHORT); } } else { nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_STOP_MASK); p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK; - nrf_twim_int_disable(p_twim, DISABLE_ALL); + nrf_twim_int_disable(p_twim, DISABLE_ALL_INT_SHORT); nrf_twim_int_enable(p_twim, p_cb->int_mask); nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STARTTX); nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME); @@ -901,14 +1022,17 @@ static void irq_handler_twim(NRF_TWIM_Type * p_twim, twi_control_block_t * p_cb) if (errorsrc & NRF_TWIM_ERROR_ADDRESS_NACK) { event.type = NRF_DRV_TWI_EVT_ADDRESS_NACK; + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_DRV_TWI_EVT_ADDRESS_NACK)); } else if (errorsrc & NRF_TWIM_ERROR_DATA_NACK) { event.type = NRF_DRV_TWI_EVT_DATA_NACK; + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_DRV_TWI_EVT_DATA_NACK)); } else { event.type = NRF_DRV_TWI_EVT_DONE; + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_DRV_TWI_EVT_DONE)); } if (!p_cb->repeated) @@ -958,15 +1082,18 @@ static void irq_handler_twi(NRF_TWI_Type * p_twi, twi_control_block_t * p_cb) if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) { event.type = NRF_DRV_TWI_EVT_ADDRESS_NACK; + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_DRV_TWI_EVT_ADDRESS_NACK)); } else if (errorsrc & NRF_TWI_ERROR_DATA_NACK) { event.type = NRF_DRV_TWI_EVT_DATA_NACK; + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_DRV_TWI_EVT_DATA_NACK)); } } else { event.type = NRF_DRV_TWI_EVT_DONE; + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_DRV_TWI_EVT_DONE)); } p_cb->busy = false; @@ -980,19 +1107,19 @@ static void irq_handler_twi(NRF_TWI_Type * p_twi, twi_control_block_t * p_cb) } #endif // TWI_IN_USE -#if TWI0_ENABLED +#if NRF_MODULE_ENABLED(TWI0) IRQ_HANDLER(0) { - #if (TWI0_USE_EASY_DMA == 1) && defined(NRF52) + #if (TWI0_USE_EASY_DMA == 1) irq_handler_twim(NRF_TWIM0, #else irq_handler_twi(NRF_TWI0, #endif &m_cb[TWI0_INSTANCE_INDEX]); } -#endif // TWI0_ENABLED +#endif // NRF_MODULE_ENABLED(TWI0) -#if TWI1_ENABLED +#if NRF_MODULE_ENABLED(TWI1) IRQ_HANDLER(1) { #if (TWI1_USE_EASY_DMA == 1) @@ -1002,4 +1129,6 @@ IRQ_HANDLER(1) #endif &m_cb[TWI1_INSTANCE_INDEX]); } -#endif // TWI1_ENABLED +#endif // NRF_MODULE_ENABLED(TWI1) +#endif // TWI_COUNT +#endif // NRF_MODULE_ENABLED(TWI) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h index 83f37ea4be..52916c563c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h @@ -36,27 +36,22 @@ * */ - -/** +/**@file + * @addtogroup nrf_twi Two Wire master interface (TWI/TWIM) + * @ingroup nrf_drivers + * @brief Two Wire master interface (TWI/TWIM) APIs. * - * @defgroup nrf_twi Two-wire interface (TWI) - * @ingroup nrf_drivers - * @brief Two-wire interface (TWI) APIs. - * - * @defgroup nrf_twi_master TWI master HAL and driver - * @ingroup nrf_twi - * @brief TWI master APIs. - * @details The TWI and TWIM HALs provide basic APIs for accessing the registers of the TWI and TWIM peripherals, respectively. - * - * The TWI master driver provides APIs on a higher level. * + * @defgroup nrf_drv_twi TWIS driver + * @{ + * @ingroup nrf_twi + * @brief TWI master APIs. */ - #ifndef NRF_DRV_TWI_H__ #define NRF_DRV_TWI_H__ #include "nordic_common.h" -#include "nrf_drv_config.h" +#include "sdk_config.h" // This set of macros makes it possible to exclude parts of code when one type // of supported peripherals is not used. @@ -75,7 +70,11 @@ #endif #include "sdk_errors.h" -#if defined(NRF52) +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(TWIM_IN_USE) #define NRF_DRV_TWI_PERIPHERAL(id) \ (CONCAT_3(TWI, id, _USE_EASY_DMA) == 1 ? \ (void *)CONCAT_2(NRF_TWIM, id) \ @@ -84,12 +83,6 @@ #define NRF_DRV_TWI_PERIPHERAL(id) (void *)CONCAT_2(NRF_TWI, id) #endif -/** - * @defgroup nrf_drv_twi TWI master driver - * @{ - * @ingroup nrf_twi_master - * @brief Multi-instance TWI master driver. - */ /** * @brief Structure for the TWI master driver instance. @@ -107,6 +100,9 @@ typedef struct bool use_easy_dma; ///< True if the peripheral with EasyDMA (TWIM) shall be used. } nrf_drv_twi_t; +#define TWI0_INSTANCE_INDEX 0 +#define TWI1_INSTANCE_INDEX TWI0_INSTANCE_INDEX+TWI0_ENABLED + /** * @brief Macro for creating a TWI master driver instance. */ @@ -122,21 +118,25 @@ typedef struct */ typedef struct { - uint32_t scl; ///< SCL pin number. - uint32_t sda; ///< SDA pin number. - nrf_twi_frequency_t frequency; ///< TWI frequency. - uint8_t interrupt_priority; ///< Interrupt priority. + uint32_t scl; ///< SCL pin number. + uint32_t sda; ///< SDA pin number. + nrf_twi_frequency_t frequency; ///< TWI frequency. + uint8_t interrupt_priority; ///< Interrupt priority. + bool clear_bus_init; ///< Clear bus during init. + bool hold_bus_uninit; ///< Hold pull up state on gpio pins after uninit. } nrf_drv_twi_config_t; /** * @brief TWI master driver instance default configuration. */ -#define NRF_DRV_TWI_DEFAULT_CONFIG(id) \ -{ \ - .frequency = CONCAT_3(TWI, id, _CONFIG_FREQUENCY), \ - .scl = CONCAT_3(TWI, id, _CONFIG_SCL), \ - .sda = CONCAT_3(TWI, id, _CONFIG_SDA), \ - .interrupt_priority = CONCAT_3(TWI, id, _CONFIG_IRQ_PRIORITY) \ +#define NRF_DRV_TWI_DEFAULT_CONFIG \ +{ \ + .frequency = (nrf_twi_frequency_t)TWI_DEFAULT_CONFIG_FREQUENCY, \ + .scl = 31, \ + .sda = 31, \ + .interrupt_priority = TWI_DEFAULT_CONFIG_IRQ_PRIORITY, \ + .clear_bus_init = TWI_DEFAULT_CONFIG_CLR_BUS_INIT, \ + .hold_bus_uninit = TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT, \ } #define NRF_DRV_TWI_FLAG_TX_POSTINC (1UL << 0) /**< TX buffer address incremented after transfer. */ @@ -237,9 +237,9 @@ typedef void (* nrf_drv_twi_evt_handler_t)(nrf_drv_twi_evt_t const * p_event, void * p_context); /** - * @brief Function for initializing the TWI instance. + * @brief Function for initializing the TWI driver instance. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_config Initial configuration. If NULL, the default configuration is used. * @param[in] event_handler Event handler provided by the user. If NULL, blocking mode is enabled. * @param[in] p_context Context passed to event handler. @@ -247,8 +247,8 @@ typedef void (* nrf_drv_twi_evt_handler_t)(nrf_drv_twi_evt_t const * p_event, * @retval NRF_SUCCESS If initialization was successful. * @retval NRF_ERROR_INVALID_STATE If the driver is in invalid state. * @retval NRF_ERROR_BUSY If some other peripheral with the same - * instance ID is already in use. This is - * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED + * instance ID is already in use. This is + * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED * is set to a value other than zero. */ ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * p_instance, @@ -259,21 +259,21 @@ ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * p_instance, /** * @brief Function for uninitializing the TWI instance. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_twi_uninit(nrf_drv_twi_t const * p_instance); /** * @brief Function for enabling the TWI instance. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_twi_enable(nrf_drv_twi_t const * p_instance); /** * @brief Function for disabling the TWI instance. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. */ void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance); @@ -283,7 +283,7 @@ void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance); * The transmission will be stopped when an error occurs. If a transfer is ongoing, * the function returns the error code @ref NRF_ERROR_BUSY. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] address Address of a specific slave device (only 7 LSB). * @param[in] p_data Pointer to a transmit buffer. * @param[in] length Number of bytes to send. @@ -291,9 +291,12 @@ void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance); * after the transfer has completed successfully (allowing * for a repeated start in the next transfer). * - * @retval NRF_SUCCESS If the procedure was successful. - * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. - * @retval NRF_ERROR_INTERNAL If an error was detected by hardware. + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. + * @retval NRF_ERROR_INTERNAL If an error was detected by hardware. + * @retval NRF_ERROR_INVALID_ADDR If the EasyDMA is used and memory adress in not in RAM. + * @retval NRF_ERROR_DRV_TWI_ERR_ANACK If NACK received after sending the address. + * @retval NRF_ERROR_DRV_TWI_ERR_DNACK If NACK received after sending a data byte. */ ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance, uint8_t address, @@ -305,16 +308,19 @@ ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance, * @brief Function for reading data from a TWI slave. * * The transmission will be stopped when an error occurs. If a transfer is ongoing, - * the function returns the error code @ref NRF_ERROR_BUSY. + * the function returns the error code @ref NRF_ERROR_BUSY. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] address Address of a specific slave device (only 7 LSB). * @param[in] p_data Pointer to a receive buffer. * @param[in] length Number of bytes to be received. * - * @retval NRF_SUCCESS If the procedure was successful. - * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. - * @retval NRF_ERROR_INTERNAL If an error was detected by hardware. + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. + * @retval NRF_ERROR_INTERNAL If an error was detected by hardware. + * @retval NRF_ERROR_DRV_TWI_ERR_OVERRUN If the unread data was replaced by new data + * @retval NRF_ERROR_DRV_TWI_ERR_ANACK If NACK received after sending the address. + * @retval NRF_ERROR_DRV_TWI_ERR_DNACK If NACK received after sending a data byte. */ ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * p_instance, uint8_t address, @@ -340,7 +346,7 @@ ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * p_instance, * After the transfer is set up, a set of transfers can be triggered by PPI that will read, for example, the same register of an * external component and put it into a RAM buffer without any interrupts. @ref nrf_drv_twi_stopped_event_get can be used to get the * address of the STOPPED event, which can be used to count the number of transfers. If @ref NRF_DRV_TWI_FLAG_REPEATED_XFER is used, - * the driver does not set the instance into busy state, so you must ensure that the next transfers are set up + * the driver does not set the driver instance into busy state, so you must ensure that the next transfers are set up * when TWIM is not active. Supported only by TWIM. * - @ref NRF_DRV_TWI_FLAG_TX_NO_STOP: No stop condition after TX transfer. * @@ -357,34 +363,29 @@ ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * p_instance, * This function should be used only if the instance is configured to work in non-blocking mode. If the function is used in blocking mode, the driver asserts. * @note If you are using this function with TWI, the only supported flag is @ref NRF_DRV_TWI_FLAG_TX_NO_STOP. All other flags require TWIM. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_xfer_desc Pointer to the transfer descriptor. * @param[in] flags Transfer options (0 for default settings). * - * @retval NRF_SUCCESS If the procedure was successful. - * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. - * @retval NRF_ERROR_NOT_SUPPORTED If the provided parameters are not supported. + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_BUSY If the driver is not ready for a new transfer. + * @retval NRF_ERROR_NOT_SUPPORTED If the provided parameters are not supported. + * @retval NRF_ERROR_INTERNAL If an error was detected by hardware. + * @retval NRF_ERROR_INVALID_ADDR If the EasyDMA is used and memory adress in not in RAM + * @retval NRF_ERROR_DRV_TWI_ERR_OVERRUN If the unread data was replaced by new data (TXRX and RX) + * @retval NRF_ERROR_DRV_TWI_ERR_ANACK If NACK received after sending the address. + * @retval NRF_ERROR_DRV_TWI_ERR_DNACK If NACK received after sending a data byte. */ ret_code_t nrf_drv_twi_xfer(nrf_drv_twi_t const * p_instance, nrf_drv_twi_xfer_desc_t const * p_xfer_desc, uint32_t flags); -/** - * @brief Function for checking the TWI driver state. - * - * @param[in] p_instance TWI instance. - * - * @retval true If the TWI driver is currently busy performing a transfer. - * @retval false If the TWI driver is ready for a new transfer. - */ -bool nrf_drv_twi_is_busy(nrf_drv_twi_t const * p_instance); - /** * @brief Function for getting the transferred data count. * * This function provides valid results only in legacy mode. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. * * @return Data count. */ @@ -396,7 +397,7 @@ uint32_t nrf_drv_twi_data_count_get(nrf_drv_twi_t const * const p_instance); * This function should be used if @ref nrf_drv_twi_xfer was called with the flag @ref NRF_DRV_TWI_FLAG_HOLD_XFER. * In that case, the transfer is not started by the driver, but it must be started externally by PPI. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. * @param[in] xfer_type Transfer type used in the last call of the @ref nrf_drv_twi_xfer function. * * @return Start task address (TX or RX) depending on the value of xfer_type. @@ -409,7 +410,7 @@ uint32_t nrf_drv_twi_start_task_get(nrf_drv_twi_t const * p_instance, nrf_drv_tw * A STOPPED event can be used to detect the end of a transfer if the @ref NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER * option is used. * - * @param[in] p_instance TWI instance. + * @param[in] p_instance Pointer to the driver instance structure. * * @return STOPPED event address. */ @@ -418,4 +419,9 @@ uint32_t nrf_drv_twi_stopped_event_get(nrf_drv_twi_t const * p_instance); *@} **/ + +#ifdef __cplusplus +} +#endif + #endif // NRF_DRV_TWI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis.c new file mode 100644 index 0000000000..e4561c3404 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis.c @@ -0,0 +1,940 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(TWIS) +#define ENABLED_TWIS_COUNT (TWIS0_ENABLED+TWIS1_ENABLED) +#if ENABLED_TWIS_COUNT +#include "nrf_drv_twis.h" +#include "nrf_assert.h" +#include "app_util_platform.h" +#include "compiler_abstraction.h" + +#define NRF_LOG_MODULE_NAME "TWIS" + +#if TWIS_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL TWIS_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR TWIS_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR TWIS_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_TWIS_EVENT_STOPPED ? "NRF_TWIS_EVENT_STOPPED" : \ + (event == NRF_TWIS_EVENT_ERROR ? "NRF_TWIS_EVENT_ERROR" : \ + (event == NRF_TWIS_EVENT_RXSTARTED ? "NRF_TWIS_EVENT_RXSTARTED" : \ + (event == NRF_TWIS_EVENT_TXSTARTED ? "NRF_TWIS_EVENT_TXSTARTED" : \ + (event == NRF_TWIS_EVENT_WRITE ? "NRF_TWIS_EVENT_WRITE" : \ + (event == NRF_TWIS_EVENT_READ ? "NRF_TWIS_EVENT_READ" : "UNKNOWN EVENT")))))) +#else //TWIS_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //TWIS_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + +/** + * @internal + * @ingroup lib_twis_drv + * @defgroup lib_twis_drv_ivars Software controlled TWI Slave internal variables + * + * Internal variables for TWIS. + * @{ + */ + +/** + * @brief Actual state of internal state machine + * + * Current substate of powered on state. + */ +typedef enum +{ + NRF_DRV_TWIS_SUBSTATE_IDLE, ///< No ongoing transmission + NRF_DRV_TWIS_SUBSTATE_READ_WAITING, ///< Read request received, waiting for data + NRF_DRV_TWIS_SUBSTATE_READ_PENDING, ///< Reading is actually pending (data sending) + NRF_DRV_TWIS_SUBSTATE_WRITE_WAITING, ///< Write request received, waiting for data buffer + NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING, ///< Writing is actually pending (data receiving) +}nrf_drv_twis_substate_t; + +/** + * @brief Constant instance part + * + * Instance data that have not to change. + * It may be placed in FLASH memory. + */ +typedef struct +{ + NRF_TWIS_Type * const p_reg; ///< Peripheral registry address +} nrf_drv_twis_const_inst_t; + +/** + * @brief Variable instance part + * + * There are all informations for the instance that may change. + */ +typedef struct +{ + nrf_drv_state_t state; ///< Actual driver state + volatile nrf_drv_twis_substate_t substate; ///< Actual driver substate + nrf_drv_twis_event_handler_t ev_handler; ///< Event handler functiomn + volatile uint32_t error; ///< Internal error flags + /**< Internal copy of hardware errors flags merged + * with specific internal driver errors flags. + * + * @note This value can be changed in the interrupt + * and cleared in the main program. + * Always use Atomic load-store when updating + * this value in main loop. + */ +}nrf_drv_twis_var_inst_t; + + +/** The constant instance part implementation */ +static const nrf_drv_twis_const_inst_t m_const_inst[ENABLED_TWIS_COUNT] = +{ + #define X(n) { .p_reg = NRF_TWIS##n }, + #include "nrf_drv_twis_inst.def" +}; + +/** The variable instance part implementation */ +static nrf_drv_twis_var_inst_t m_var_inst[ENABLED_TWIS_COUNT] = +{ + #define X(n) { .state = NRF_DRV_STATE_UNINITIALIZED, \ + .substate = NRF_DRV_TWIS_SUBSTATE_IDLE, \ + .ev_handler = NULL, \ + .error = 0 }, + #include "nrf_drv_twis_inst.def" +}; + +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n + #define IRQ_HANDLER(n) static void IRQ_HANDLER_NAME(n)(void) + + #if NRF_MODULE_ENABLED(TWIS0) + IRQ_HANDLER(0); + #endif + #if NRF_MODULE_ENABLED(TWIS1) + IRQ_HANDLER(1); + #endif + static nrf_drv_irq_handler_t const m_irq_handlers[ENABLED_TWIS_COUNT] = { + #if NRF_MODULE_ENABLED(TWIS0) + IRQ_HANDLER_NAME(0), + #endif + #if NRF_MODULE_ENABLED(TWIS1) + IRQ_HANDLER_NAME(1), + #endif + }; +#else + #define IRQ_HANDLER(n) \ + void SPIM##n##_SPIS##n##_TWIM##n##_TWIS##n##_SPI##n##_TWI##n##_IRQHandler(void) +#endif // NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + +/** + * @brief State processing semaphore + * + * There are semaphores used when when working in synchronous mode (without interrupts activated). + * @note + * In synchronous mode before every state checking the state machine is executed. + * But the situation where state checking function is called from main task and in the same from + * interrupt task has to be considered. + * In such a situation the @ref nrf_drv_twis_state_machine function may be interrupted by second + * call to the same function. + * If in this second call any event will be detected it may be lost because new substate would be + * overwritten when interrupted function finishes. + * In the same time information about event would be lost because it is cleared in interrupting + * function. + * @note + * To make situation described above safe, simple semaphore is implemented. + * It is just a binary flag that informs that state machine is actually executing and should not + * be processed in any interrupting function. + * Because of how it is used no atomic instructions are required to support this kind of semaphore. + * It is not waitable semaphore - function executed or not depending of its state. + */ +static uint8_t m_sm_semaphore[ENABLED_TWIS_COUNT]; + +/** + * @brief Used interrupts mask + * + * Mask for all interrupts used by this library + */ +static const uint32_t m_used_ints_mask = + NRF_TWIS_INT_STOPPED_MASK | + NRF_TWIS_INT_ERROR_MASK | + NRF_TWIS_INT_RXSTARTED_MASK | + NRF_TWIS_INT_TXSTARTED_MASK | + NRF_TWIS_INT_WRITE_MASK | + NRF_TWIS_INT_READ_MASK; + + +/** @} */ /* End of lib_driver_twis_slave_ivars */ + +/** + * @internal + * @ingroup lib_twis_drv + * @defgroup lib_twis_drv_ifunc Software controlled TWI Slave auxiliary internal functions + * + * Internal variables for TWIS. + * @{ + */ + +/** + * @brief Clear all events + * + * Function clears all actually pending events + */ +static void nrf_drv_twis_clear_all_events(NRF_TWIS_Type * const p_reg) +{ + /* Clear all events */ + nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_STOPPED); + nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_ERROR); + nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_RXSTARTED); + nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_TXSTARTED); + nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_WRITE); + nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_READ); +} + +/** + * @brief Reset all the registers to known state + * + * This function clears all registers that requires it to known state. + * TWIS is left disabled after this function. + * All events are cleared. + * @param[out] p_reg TWIS to reset register address + */ +static inline void nrf_drv_twis_swreset(NRF_TWIS_Type * const p_reg) +{ + /* Disable TWIS */ + nrf_twis_disable(p_reg); + + /* Disconnect pins */ + nrf_twis_pins_set(p_reg, ~0U, ~0U); + + /* Disable interrupt global for the instance */ + nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_reg)); + + /* Disable interrupts */ + nrf_twis_int_disable(p_reg, ~0U); +} + +/** + * @brief Configure pin + * + * Function configures selected for work as SDA or SCL. + * @param pin Pin number to configure + */ +static inline void nrf_drv_twis_config_pin(uint32_t pin, nrf_gpio_pin_pull_t pull) +{ + nrf_gpio_cfg(pin, + NRF_GPIO_PIN_DIR_INPUT, + NRF_GPIO_PIN_INPUT_DISCONNECT, + pull, + NRF_GPIO_PIN_S0D1, + NRF_GPIO_PIN_NOSENSE); +} + +/** + * @brief Call event handler + * + * Function that calls event handler. + * The event handler would be only called if its value is != NULL. + * @param instNr Driver instance number that has called this runtime. + * @param[in] pev Event structure to pass to event handler + * @note + * Remember about possible multithreading. + * It is acceptable to call old event function if it was already disabled. + * What is unacceptable is jump into NULL pointer. + */ +static void nrf_drv_call_event_handler(uint8_t instNr, nrf_drv_twis_evt_t const * const pev) +{ + nrf_drv_twis_event_handler_t evh = m_var_inst[instNr].ev_handler; + if (NULL != evh) + { + evh(pev); + } +} + +/** + * @brief Auxiliary function for getting event state on right bit possition + * + * This function calls @ref nrf_twis_event_get function but the the result + * is shifted to match INTEN register scheme. + * + * @param[in,out] p_reg TWIS to read event from + * @param ev Event code + * + * @return Selected event state shifted by @ref nrf_drv_event_to_bitpos + * + * @sa nrf_twis_event_get + * @sa nrf_drv_event_to_bitpos + */ +static inline uint32_t nrf_drv_twis_event_bit_get(NRF_TWIS_Type * const p_reg, nrf_twis_event_t ev) +{ + return (uint32_t)nrf_twis_event_get_and_clear(p_reg, ev) << nrf_drv_event_to_bitpos(ev); +} + +/** + * @brief Auxiliary function for checking event bit inside given flags value + * + * Function used here to check presence of the event inside given flags value. + * It transforms given event to bit possition and then checks if in given variable it is cleared. + * + * @param flags Flags to test + * @param ev Event code + * + * @retval true Flag for selected event is set + * @retval false Flag for selected event is cleared + */ +static inline bool nrf_drv_twis_check_bit(uint32_t flags, nrf_twis_event_t ev) +{ + return 0 != (flags & (1U<TXD.PTR, evdata.data.tx_amount * sizeof(p_reg->TXD.PTR)); + nrf_drv_call_event_handler(instNr, &evdata); + /* Go to idle and repeat the state machine if READ or WRITE events detected. + * This time READ or WRITE would be started */ + substate = NRF_DRV_TWIS_SUBSTATE_IDLE; + ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_STOPPED); + } + else + { + nrf_drv_twis_process_error(instNr, TWIS_EVT_READ_ERROR, nrf_twis_error_source_get_and_clear(p_reg)); + substate = NRF_DRV_TWIS_SUBSTATE_IDLE; + ev = 0; + } + break; + case NRF_DRV_TWIS_SUBSTATE_WRITE_WAITING: + if (nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_RXSTARTED) || + nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_WRITE) || + nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_READ) || + nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_STOPPED)) + { + substate = NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING; + /* Any other bits requires further processing in PENDING substate */ + ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_RXSTARTED); + } + else + { + nrf_drv_twis_process_error(instNr, TWIS_EVT_WRITE_ERROR, nrf_twis_error_source_get_and_clear(p_reg)); + substate = NRF_DRV_TWIS_SUBSTATE_IDLE; + ev = 0; + } + break; + case NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING: + if (nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_WRITE)|| + nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_READ) || + nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_STOPPED)) + { + evdata.type = TWIS_EVT_WRITE_DONE; + evdata.data.rx_amount = nrf_twis_rx_amount_get(p_reg); + nrf_drv_call_event_handler(instNr, &evdata); + /* Go to idle and repeat the state machine if READ or WRITE events detected. + * This time READ or WRITE would be started */ + substate = NRF_DRV_TWIS_SUBSTATE_IDLE; + ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_STOPPED); + } + else + { + nrf_drv_twis_process_error(instNr, TWIS_EVT_WRITE_ERROR, nrf_twis_error_source_get_and_clear(p_reg)); + substate = NRF_DRV_TWIS_SUBSTATE_IDLE; + ev = 0; + } + break; + default: + substate = NRF_DRV_TWIS_SUBSTATE_IDLE; + /* Do not clear any events and repeat the machine */ + break; + } + } + + m_var_inst[instNr].substate = substate; + if (!TWIS_NO_SYNC_MODE) + { + m_sm_semaphore[instNr] = 0; + } +} + +/** + * @brief This function + */ +static inline void nrf_drv_twis_preprocess_status(uint8_t instNr) +{ + if (!TWIS_NO_SYNC_MODE) + { + if (NULL == m_var_inst[instNr].ev_handler) + { + nrf_drv_twis_state_machine(instNr); + } + } +} + +/** + * @brief Interrupt service + * + * This function is called by all interrupts runtime for instances enabled in this library. + * @param instNr Driver instance number that has called this runtime. + */ +static inline void nrf_drv_twis_on_ISR(uint8_t instNr) +{ + nrf_drv_twis_state_machine(instNr); +} + +/** @} */ /* End of lib_driver_twis_slave_ifunc */ + + +/* ------------------------------------------------------------------------- + * Implementation of IRQ Handlers + */ +#define X(n) \ + IRQ_HANDLER(n) \ + { \ + nrf_drv_twis_on_ISR(TWIS##n##_INSTANCE_INDEX); \ + } +#include "nrf_drv_twis_inst.def" + +/* ------------------------------------------------------------------------- + * Implementation of interface functions + * + */ + + +ret_code_t nrf_drv_twis_init( + nrf_drv_twis_t const * const p_instance, + nrf_drv_twis_config_t const * p_config, + nrf_drv_twis_event_handler_t const event_handler) +{ + ASSERT(p_config); + ASSERT(p_config->scl != p_config->sda); + uint8_t instNr = p_instance->instNr; + NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg; + nrf_twis_config_addr_mask_t addr_mask = (nrf_twis_config_addr_mask_t)0; + ret_code_t err_code; + + if ( m_var_inst[instNr].state != NRF_DRV_STATE_UNINITIALIZED) + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + if (nrf_drv_common_per_res_acquire(p_reg, m_irq_handlers[instNr]) != + NRF_SUCCESS) + { + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } +#endif + + if (!TWIS_ASSUME_INIT_AFTER_RESET_ONLY) + { + nrf_drv_twis_swreset(p_reg); + } + + nrf_drv_twis_config_pin(p_config->scl, p_config->scl_pull); + nrf_drv_twis_config_pin(p_config->sda, p_config->sda_pull); + + if (0 == (p_config->addr[0] | p_config->addr[1])) + addr_mask = NRF_TWIS_CONFIG_ADDRESS0_MASK; + else + { + if (0 != p_config->addr[0]) + { + addr_mask |= NRF_TWIS_CONFIG_ADDRESS0_MASK; + } + if (0 != p_config->addr[1]) + { + addr_mask |= NRF_TWIS_CONFIG_ADDRESS1_MASK; + } + } + + /* Peripheral interrupt configure + * (note - interrupts still needs to be configured in INTEN register. + * This is done in enable function) */ + nrf_drv_common_irq_enable(nrf_drv_get_IRQn(p_reg), p_config->interrupt_priority); + + /* Configure */ + nrf_twis_pins_set (p_reg, p_config->scl, p_config->sda); + nrf_twis_address_set (p_reg, 0, p_config->addr[0]); + nrf_twis_address_set (p_reg, 1, p_config->addr[1]); + nrf_twis_config_address_set(p_reg, addr_mask); + + /* Clear semaphore */ + if (!TWIS_NO_SYNC_MODE) + { + m_sm_semaphore[instNr] = 0; + } + /* Set internal instance variables */ + m_var_inst[instNr].substate = NRF_DRV_TWIS_SUBSTATE_IDLE; + m_var_inst[instNr].ev_handler = event_handler; + m_var_inst[instNr].state = NRF_DRV_STATE_INITIALIZED; + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_twis_uninit(nrf_drv_twis_t const * const p_instance) +{ + uint8_t instNr = p_instance->instNr; + NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg; + TWIS_PSEL_Type psel = p_reg->PSEL; + + ASSERT(m_var_inst[instNr].state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_drv_twis_swreset(p_reg); + + /* Clear pins state if */ + if (!(TWIS_PSEL_SCL_CONNECT_Msk & psel.SCL)) + { + nrf_gpio_cfg_default(psel.SCL); + } + if (!(TWIS_PSEL_SDA_CONNECT_Msk & psel.SDA)) + { + nrf_gpio_cfg_default(psel.SDA); + } + +#if NRF_MODULE_ENABLED(PERIPHERAL_RESOURCE_SHARING) + nrf_drv_common_per_res_release(p_reg); +#endif + + /* Clear variables */ + m_var_inst[instNr].ev_handler = NULL; + m_var_inst[instNr].state = NRF_DRV_STATE_UNINITIALIZED; +} + + +void nrf_drv_twis_enable(nrf_drv_twis_t const * const p_instance) +{ + uint8_t instNr = p_instance->instNr; + NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg; + nrf_drv_twis_var_inst_t * const p_var_inst = &m_var_inst[instNr]; + + ASSERT(m_var_inst[instNr].state == NRF_DRV_STATE_INITIALIZED); + + nrf_drv_twis_clear_all_events(p_reg); + + /* Enable interrupts */ + if (NULL != p_var_inst->ev_handler) + { + nrf_twis_int_enable(p_reg, m_used_ints_mask); + } + + nrf_twis_enable(p_reg); + p_var_inst->error = 0; + p_var_inst->state = NRF_DRV_STATE_POWERED_ON; + p_var_inst->substate = NRF_DRV_TWIS_SUBSTATE_IDLE; +} + + +void nrf_drv_twis_disable(nrf_drv_twis_t const * const p_instance) +{ + uint8_t instNr = p_instance->instNr; + NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg; + + ASSERT(m_var_inst[instNr].state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_twis_int_disable(p_reg, m_used_ints_mask); + + nrf_twis_disable(p_reg); + m_var_inst[instNr].state = NRF_DRV_STATE_INITIALIZED; +} + +/* ARM recommends not using the LDREX and STREX instructions in C code. + * This is because the compiler might generate loads and stores between + * LDREX and STREX, potentially clearing the exclusive monitor set by LDREX. + * This recommendation also applies to the byte, halfword, and doubleword + * variants LDREXB, STREXB, LDREXH, STREXH, LDREXD, and STREXD. + * + * This is the reason for the function below to be implemented in assembly. + */ +//lint -save -e578 +#if defined (__CC_ARM ) +static __ASM uint32_t nrf_drv_twis_error_get_and_clear_internal(uint32_t volatile * const perror) +{ + mov r3, r0 + mov r1, #0 +nrf_drv_twis_error_get_and_clear_internal_try + ldrex r0, [r3] + strex r2, r1, [r3] + cmp r2, r1 /* did this succeed? */ + bne nrf_drv_twis_error_get_and_clear_internal_try /* no – try again */ + bx lr +} +#elif defined ( __GNUC__ ) +static uint32_t nrf_drv_twis_error_get_and_clear_internal(uint32_t volatile * const perror) +{ + uint32_t ret; + uint32_t temp; + __ASM volatile( + " .syntax unified \n" + "nrf_drv_twis_error_get_and_clear_internal_try: \n" + " ldrex %[ret], [%[perror]] \n" + " strex %[temp], %[zero], [%[perror]] \n" + " cmp %[temp], %[zero] \n" + " bne nrf_drv_twis_error_get_and_clear_internal_try \n" + : /* Output */ + [ret]"=&l"(ret), + [temp]"=&l"(temp) + : /* Input */ + [zero]"l"(0), + [perror]"l"(perror) + ); + UNUSED_VARIABLE(temp); + return ret; +} +#elif defined ( __ICCARM__ ) +static uint32_t nrf_drv_twis_error_get_and_clear_internal(uint32_t volatile * const perror) +{ + uint32_t ret; + uint32_t temp; + __ASM volatile( + "1: \n" + " ldrex %[ret], [%[perror]] \n" + " strex %[temp], %[zero], [%[perror]] \n" + " cmp %[temp], %[zero] \n" + " bne.n 1b \n" + : /* Output */ + [ret]"=&l"(ret), + [temp]"=&l"(temp) + : /* Input */ + [zero]"l"(0), + [perror]"l"(perror) + ); + UNUSED_VARIABLE(temp); + return ret; +} +#else + #error Unknown compiler +#endif +//lint -restore + +uint32_t nrf_drv_twis_error_get_and_clear(nrf_drv_twis_t const * const p_instance) +{ + nrf_drv_twis_var_inst_t * const p_var_inst = &m_var_inst[p_instance->instNr]; + nrf_drv_twis_preprocess_status(p_instance->instNr); + /* Make sure that access to error member is atomic + * so there is no bit that is cleared if it is not copied to local variable already. */ + return nrf_drv_twis_error_get_and_clear_internal(&p_var_inst->error); +} + + +ret_code_t nrf_drv_twis_tx_prepare( + nrf_drv_twis_t const * const p_instance, + void const * const p_buf, + size_t size) +{ + ret_code_t err_code = NRF_SUCCESS; + uint8_t instNr = p_instance->instNr; + NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg; + nrf_drv_twis_var_inst_t * const p_var_inst = &m_var_inst[instNr]; + + /* Check power state*/ + if (p_var_inst->state != NRF_DRV_STATE_POWERED_ON) + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + /* Check data address */ + if (!nrf_drv_is_in_RAM(p_buf)) + { + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + /* Check data size */ + if ((size & TWIS_TXD_MAXCNT_MAXCNT_Msk) != size) + { + err_code = NRF_ERROR_INVALID_LENGTH; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + nrf_twis_tx_prepare(p_reg, (uint8_t const *)p_buf, (nrf_twis_amount_t)size); + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + +} + + +size_t nrf_drv_twis_tx_amount(nrf_drv_twis_t const * const p_instance) +{ + uint8_t instNr = p_instance->instNr; + NRF_TWIS_Type const * const p_reg = m_const_inst[instNr].p_reg; + + return nrf_twis_tx_amount_get(p_reg); +} + + +ret_code_t nrf_drv_twis_rx_prepare( + nrf_drv_twis_t const * const p_instance, + void * const p_buf, + size_t size) +{ + ret_code_t err_code; + uint8_t instNr = p_instance->instNr; + NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg; + nrf_drv_twis_var_inst_t * const p_var_inst = &m_var_inst[instNr]; + + /* Check power state*/ + if (p_var_inst->state != NRF_DRV_STATE_POWERED_ON) + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + /* Check data address */ + if (!nrf_drv_is_in_RAM(p_buf)) + { + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + /* Check data size */ + if ((size & TWIS_RXD_MAXCNT_MAXCNT_Msk) != size) + { + err_code = NRF_ERROR_INVALID_LENGTH; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + nrf_twis_rx_prepare(p_reg, (uint8_t *)p_buf, (nrf_twis_amount_t)size); + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +size_t nrf_drv_twis_rx_amount(nrf_drv_twis_t const * const p_instance) +{ + uint8_t instNr = p_instance->instNr; + NRF_TWIS_Type const * const p_reg = m_const_inst[instNr].p_reg; + + return nrf_twis_rx_amount_get(p_reg); +} + + +bool nrf_drv_twis_is_busy(nrf_drv_twis_t const * const p_instance) +{ + nrf_drv_twis_preprocess_status(p_instance->instNr); + return NRF_DRV_TWIS_SUBSTATE_IDLE != m_var_inst[(p_instance->instNr)].substate; +} + +bool nrf_drv_twis_is_waiting_tx_buff(nrf_drv_twis_t const * const p_instance) +{ + nrf_drv_twis_preprocess_status(p_instance->instNr); + return NRF_DRV_TWIS_SUBSTATE_READ_WAITING == m_var_inst[(p_instance->instNr)].substate; +} + +bool nrf_drv_twis_is_waiting_rx_buff(nrf_drv_twis_t const * const p_instance) +{ + nrf_drv_twis_preprocess_status(p_instance->instNr); + return NRF_DRV_TWIS_SUBSTATE_WRITE_WAITING == m_var_inst[(p_instance->instNr)].substate; +} + +bool nrf_drv_twis_is_pending_tx(nrf_drv_twis_t const * const p_instance) +{ + nrf_drv_twis_preprocess_status(p_instance->instNr); + return NRF_DRV_TWIS_SUBSTATE_READ_PENDING == m_var_inst[(p_instance->instNr)].substate; +} + +bool nrf_drv_twis_is_pending_rx(nrf_drv_twis_t const * const p_instance) +{ + nrf_drv_twis_preprocess_status(p_instance->instNr); + return NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING == m_var_inst[(p_instance->instNr)].substate; +} +#endif // TWIS_COUNT +#endif // NRF_MODULE_ENABLED(TWIS) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis.h new file mode 100644 index 0000000000..d54caeb461 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis.h @@ -0,0 +1,394 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef NRF_DRV_TWIS_H__ +#define NRF_DRV_TWIS_H__ + +#include "sdk_config.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" +#include "sdk_errors.h" +#include "nrf_twis.h" +#include +#include "app_util.h" + +#ifdef __cplusplus +extern "C" { +#endif +/**@file + * @addtogroup nrf_twis Two Wire slave interface (TWIS) + * @ingroup nrf_drivers + * @brief Two Wire slave interface (TWIS) APIs. + * + * + * @defgroup nrf_drv_twis TWIS driver + * @{ + * @ingroup nrf_twis + * @brief TWI slave APIs. + */ + +/** + * @brief Event callback function event definitions. + */ +typedef enum +{ + TWIS_EVT_READ_REQ, ///< Read request detected + /**< If there is no buffer prepared, buf_req flag in the even will be set. + Call then @ref nrf_drv_twis_tx_prepare to give parameters for buffer. + */ + TWIS_EVT_READ_DONE, ///< Read request has finished - free any data + TWIS_EVT_READ_ERROR, ///< Read request finished with error + TWIS_EVT_WRITE_REQ, ///< Write request detected + /**< If there is no buffer prepared, buf_req flag in the even will be set. + Call then @ref nrf_drv_twis_rx_prepare to give parameters for buffer. + */ + TWIS_EVT_WRITE_DONE, ///< Write request has finished - process data + TWIS_EVT_WRITE_ERROR, ///< Write request finished with error + TWIS_EVT_GENERAL_ERROR ///< Error that happens not inside WRITE or READ transaction +} nrf_drv_twis_evt_type_t; + +/** + * @brief TWIS driver instance structure + * + * @note We only need instance number here so we could really use just a number + * that would be send to every driver function. + * But for compatibility reason this number is inserted into the structure. + */ +typedef struct +{ + uint8_t instNr; /**< Instance number */ +}nrf_drv_twis_t; + +/** + * @brief TWIS driver event structure + */ +typedef struct +{ + nrf_drv_twis_evt_type_t type; ///< Event type + union + { + bool buf_req; ///< Flag for @ref TWIS_EVT_READ_REQ and @ref TWIS_EVT_WRITE_REQ + /**< Information if transmission buffer requires to be prepared */ + uint32_t tx_amount; ///< Data for @ref TWIS_EVT_READ_DONE + uint32_t rx_amount; ///< Data for @ref TWIS_EVT_WRITE_DONE + uint32_t error; ///< Data for @ref TWIS_EVT_GENERAL_ERROR + }data; +}nrf_drv_twis_evt_t; + +/** + * @brief TWI slave event callback function type. + * + * @param[in] p_event Event information structure. + */ +typedef void (*nrf_drv_twis_event_handler_t)(nrf_drv_twis_evt_t const * const p_event); + +/** + * @brief Structure for TWIS configuration + */ +typedef struct +{ + uint32_t addr[2]; //!< Set addresses that this slave should respond. Set 0 to disable. + uint32_t scl; //!< SCL pin number + nrf_gpio_pin_pull_t scl_pull; //!< SCL pin pull + uint32_t sda; //!< SDA pin number + nrf_gpio_pin_pull_t sda_pull; //!< SDA pin pull + uint8_t interrupt_priority; //!< The priority of interrupt for the module to set +}nrf_drv_twis_config_t; + +/** + * @brief Possible error sources + * + * This is flag enum - values from this enum can be connected using logical or operator. + * @note + * We could use directly @ref nrf_twis_error_t. Error type enum is redefined here becouse + * of possible future extension (eg. supporting timeouts and synchronous mode). + */ +typedef enum +{ + NRF_DRV_TWIS_ERROR_OVERFLOW = NRF_TWIS_ERROR_OVERFLOW, /**< RX buffer overflow detected, and prevented */ + NRF_DRV_TWIS_ERROR_DATA_NACK = NRF_TWIS_ERROR_DATA_NACK, /**< NACK sent after receiving a data byte */ + NRF_DRV_TWIS_ERROR_OVERREAD = NRF_TWIS_ERROR_OVERREAD, /**< TX buffer over-read detected, and prevented */ + NRF_DRV_TWIS_ERROR_UNEXPECTED_EVENT = 1 << 8 /**< Unexpected event detected by state machine */ +}nrf_drv_twis_error_t; + +/** + * @internal + * @brief Internal macro for creating TWIS driver instance + * + * Second level of indirection in creating the instance. + * Do not use this macro directly. + * Use @ref NRF_DRV_TWIS_INSTANCE instead. + */ +#define NRF_DRV_TWIS_INSTANCE_x(id) \ + { \ + TWIS##id##_INSTANCE_INDEX \ + } + +/** + * @brief Macro for creating TWIS driver instance + * + * @param[in] id Instance index. Use 0 for TWIS0 and 1 for TWIS1 + */ +#define NRF_DRV_TWIS_INSTANCE(id) NRF_DRV_TWIS_INSTANCE_x(id) + +#define TWIS0_INSTANCE_INDEX 0 +#define TWIS1_INSTANCE_INDEX TWIS0_INSTANCE_INDEX+TWIS0_ENABLED + +/** + * @brief Generate default configuration for TWIS driver instance + */ +#define NRF_DRV_TWIS_DEFAULT_CONFIG \ +{ \ + .addr = { TWIS_DEFAULT_CONFIG_ADDR0, TWIS_DEFAULT_CONFIG_ADDR1 }, \ + .scl = 31, \ + .scl_pull = (nrf_gpio_pin_pull_t)TWIS_DEFAULT_CONFIG_SCL_PULL, \ + .sda = 31, \ + .sda_pull = (nrf_gpio_pin_pull_t)TWIS_DEFAULT_CONFIG_SDA_PULL, \ + .interrupt_priority = TWIS_DEFAULT_CONFIG_IRQ_PRIORITY \ +} + +/** + * @brief Function for initializing the TWIS driver instance. + * + * Function initializes and enables TWIS driver. + * @attention After driver initialization enable it by @ref nrf_drv_twis_enable + * + * @param[in] p_instance Pointer to the driver instance structure. + * @attention @em p_instance has to be global object. + * It would be used by interrupts so make it sure that object + * would not be destroyed when function is leaving. + * @param[in] p_config Initial configuration. + * @param[in] event_handler Event handler provided by the user. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver is already initialized. + * @retval NRF_ERROR_BUSY If some other peripheral with the same + * instance ID is already in use. This is + * possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED + * is set to a value other than zero. + */ +ret_code_t nrf_drv_twis_init( + nrf_drv_twis_t const * const p_instance, + nrf_drv_twis_config_t const * p_config, + nrf_drv_twis_event_handler_t const event_handler); + +/** + * @brief Function for uninitializing the TWIS driver instance. + * + * Function initializes the peripheral and resets all registers to default values. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @note + * It is safe to call nrf_drv_twis_uninit even before initialization. + * Actually @ref nrf_drv_twis_init function calls this function to + * make sure that TWIS state is known. + * @note + * If TWIS driver was in uninitialized state before calling this function, + * selected pins would not be reset to default configuration. + */ +void nrf_drv_twis_uninit(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Enable TWIS instance + * + * This function enables TWIS instance. + * Function defined if there is needs for dynamically enabling and disabling the peripheral. + * Use @ref nrf_drv_twis_enable and @ref nrf_drv_twis_disable functions. + * They do not change any configuration registers. + * + * @param p_instance Pointer to the driver instance structure. + */ +void nrf_drv_twis_enable(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Disable TWIS instance + * + * Disabling TWIS instance gives possibility to turn off the TWIS while + * holding configuration done by @ref nrf_drv_twis_init + * + * @param p_instance Pointer to the driver instance structure. + */ +void nrf_drv_twis_disable(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Get and clear last error flags + * + * Function gets information about errors. + * This is also the only possibility to exit from error substate of the internal state machine. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @return Error flags defined in @ref nrf_drv_twis_error_t + * @attention + * This function clears error state and flags. + */ +uint32_t nrf_drv_twis_error_get_and_clear(nrf_drv_twis_t const * const p_instance); + + +/** + * @brief Prepare data for sending + * + * This function should be used in response for @ref TWIS_EVT_READ_REQ event. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_buf Transmission buffer + * @attention Transmission buffer has to be placed in RAM. + * @param size Maximum number of bytes that master may read from buffer given. + * + * @retval NRF_SUCCESS Preparation finished properly + * @retval NRF_ERROR_INVALID_ADDR Given @em p_buf is not placed inside the RAM + * @retval NRF_ERROR_INVALID_LENGTH Wrong value in @em size parameter + * @retval NRF_ERROR_INVALID_STATE Module not initialized or not enabled + */ +ret_code_t nrf_drv_twis_tx_prepare( + nrf_drv_twis_t const * const p_instance, + void const * const p_buf, + size_t size); + +/** + * @brief Get number of transmitted bytes + * + * Function returns number of bytes sent. + * This function may be called after @ref TWIS_EVT_READ_DONE or @ref TWIS_EVT_READ_ERROR events. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @return Number of bytes sent. + */ +size_t nrf_drv_twis_tx_amount(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Prepare data for receiving + * + * This function should be used in response for @ref TWIS_EVT_WRITE_REQ event. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_buf Buffer that would be filled with received data + * @attention Receiving buffer has to be placed in RAM. + * @param size Size of the buffer (maximum amount of data to receive) + * + * @retval NRF_SUCCESS Preparation finished properly + * @retval NRF_ERROR_INVALID_ADDR Given @em p_buf is not placed inside the RAM + * @retval NRF_ERROR_INVALID_LENGTH Wrong value in @em size parameter + * @retval NRF_ERROR_INVALID_STATE Module not initialized or not enabled + */ +ret_code_t nrf_drv_twis_rx_prepare( + nrf_drv_twis_t const * const p_instance, + void * const p_buf, + size_t size); + +/** + * @brief Get number of received bytes + * + * Function returns number of bytes received. + * This function may be called after @ref TWIS_EVT_WRITE_DONE or @ref TWIS_EVT_WRITE_ERROR events. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @return Number of bytes received. + */ +size_t nrf_drv_twis_rx_amount(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Function checks if driver is busy right now + * + * Actual driver substate is tested. + * If driver is in any other state than IDLE or ERROR this function returns true. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval true Driver is in state other than ERROR or IDLE + * @retval false There is no transmission pending. + */ +bool nrf_drv_twis_is_busy(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Function checks if driver is waiting for tx buffer + * + * If this function returns true, it means that driver is stalled expecting + * of the @ref nrf_drv_twis_tx_prepare function call. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval true Driver waits for @ref nrf_drv_twis_tx_prepare + * @retval false Driver is not in the state where it waits for preparing tx buffer. + */ +bool nrf_drv_twis_is_waiting_tx_buff(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Function checks if driver is waiting for rx buffer + * + * If this function returns true, it means that driver is staled expecting + * of the @ref nrf_drv_twis_rx_prepare function call. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval true Driver waits for @ref nrf_drv_twis_rx_prepare + * @retval false Driver is not in the state where it waits for preparing rx buffer. + */ +bool nrf_drv_twis_is_waiting_rx_buff(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Check if driver is sending data + * + * If this function returns true, it means that there is ongoing output transmission. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval true There is ongoing output transmission. + * @retval false Driver is in other state. + */ +bool nrf_drv_twis_is_pending_tx(nrf_drv_twis_t const * const p_instance); + +/** + * @brief Check if driver is receiving data + * + * If this function returns true, it means that there is ongoing input transmission. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval true There is ongoing input transmission. + * @retval false Driver is in other state. + */ +bool nrf_drv_twis_is_pending_rx(nrf_drv_twis_t const * const p_instance); + +/** @} */ /* End of lib_twis_drv group */ + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_DRV_TWIS_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.c new file mode 100644 index 0000000000..d6e916b0a9 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.c @@ -0,0 +1,972 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(UART) +#include "nrf_drv_uart.h" +#include "nrf_assert.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" +#include "app_util_platform.h" + +#define NRF_LOG_MODULE_NAME "UART" + +#if UART_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL UART_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR UART_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR UART_CONFIG_DEBUG_COLOR +#define EVT_TO_STR(event) (event == NRF_UART_EVENT_ERROR ? "NRF_UART_EVENT_ERROR" : "UNKNOWN EVENT") +#else //UART_CONFIG_LOG_ENABLED +#define EVT_TO_STR(event) "" +#define NRF_LOG_LEVEL 0 +#endif //UART_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + +#if (defined(UARTE_IN_USE) && defined(UART_IN_USE)) + // UARTE and UART combined + #define CODE_FOR_UARTE(code) if (m_cb[p_instance->drv_inst_idx].use_easy_dma) { code } + #define CODE_FOR_UARTE_INT(idx, code) if (m_cb[idx].use_easy_dma) { code } + #define CODE_FOR_UART(code) else { code } +#elif (defined(UARTE_IN_USE) && !defined(UART_IN_USE)) + // UARTE only + #define CODE_FOR_UARTE(code) { code } + #define CODE_FOR_UARTE_INT(idx, code) { code } + #define CODE_FOR_UART(code) +#elif (!defined(UARTE_IN_USE) && defined(UART_IN_USE)) + // UART only + #define CODE_FOR_UARTE(code) + #define CODE_FOR_UARTE_INT(idx, code) + #define CODE_FOR_UART(code) { code } +#else + #error "Wrong configuration." +#endif + +#define TX_COUNTER_ABORT_REQ_VALUE 256 + +typedef struct +{ + void * p_context; + nrf_uart_event_handler_t handler; + uint8_t const * p_tx_buffer; + uint8_t * p_rx_buffer; + uint8_t * p_rx_secondary_buffer; + volatile uint16_t tx_counter; + uint8_t tx_buffer_length; + uint8_t rx_buffer_length; + uint8_t rx_secondary_buffer_length; + volatile uint8_t rx_counter; + bool rx_enabled; + nrf_drv_state_t state; +#if (defined(UARTE_IN_USE) && defined(UART_IN_USE)) + bool use_easy_dma; +#endif +} uart_control_block_t; + +static uart_control_block_t m_cb[UART_ENABLED_COUNT]; + +__STATIC_INLINE void apply_config(nrf_drv_uart_t const * p_instance, nrf_drv_uart_config_t const * p_config) +{ + if (p_config->pseltxd != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_pin_set(p_config->pseltxd); + nrf_gpio_cfg_output(p_config->pseltxd); + } + if (p_config->pselrxd != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_cfg_input(p_config->pselrxd, NRF_GPIO_PIN_NOPULL); + } + + CODE_FOR_UARTE + ( + nrf_uarte_baudrate_set(p_instance->reg.p_uarte, (nrf_uarte_baudrate_t)p_config->baudrate); + nrf_uarte_configure(p_instance->reg.p_uarte, (nrf_uarte_parity_t)p_config->parity, + (nrf_uarte_hwfc_t)p_config->hwfc); + nrf_uarte_txrx_pins_set(p_instance->reg.p_uarte, p_config->pseltxd, p_config->pselrxd); + if (p_config->hwfc == NRF_UART_HWFC_ENABLED) + { + if (p_config->pselcts != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_NOPULL); + } + if (p_config->pselrts != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_pin_set(p_config->pselrts); + nrf_gpio_cfg_output(p_config->pselrts); + } + nrf_uarte_hwfc_pins_set(p_instance->reg.p_uarte, p_config->pselrts, p_config->pselcts); + } + ) + CODE_FOR_UART + ( + nrf_uart_baudrate_set(p_instance->reg.p_uart, p_config->baudrate); + nrf_uart_configure(p_instance->reg.p_uart, p_config->parity, p_config->hwfc); + nrf_uart_txrx_pins_set(p_instance->reg.p_uart, p_config->pseltxd, p_config->pselrxd); + if (p_config->hwfc == NRF_UART_HWFC_ENABLED) + { + if (p_config->pselcts != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_NOPULL); + } + if (p_config->pselrts != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_pin_set(p_config->pselrts); + nrf_gpio_cfg_output(p_config->pselrts); + } + nrf_uart_hwfc_pins_set(p_instance->reg.p_uart, p_config->pselrts, p_config->pselcts); + } + ) +} + +__STATIC_INLINE void interrupts_enable(const nrf_drv_uart_t * p_instance, uint8_t interrupt_priority) +{ + CODE_FOR_UARTE + ( + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDRX); + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDTX); + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ERROR); + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_RXTO); + nrf_uarte_int_enable(p_instance->reg.p_uarte, NRF_UARTE_INT_ENDRX_MASK | + NRF_UARTE_INT_ENDTX_MASK | + NRF_UARTE_INT_ERROR_MASK | + NRF_UARTE_INT_RXTO_MASK); + nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uarte), interrupt_priority); + ) + CODE_FOR_UART + ( + nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY); + nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_RXTO); + nrf_uart_int_enable(p_instance->reg.p_uart, NRF_UART_INT_MASK_TXDRDY | + NRF_UART_INT_MASK_RXTO); + nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uart), interrupt_priority); + ) +} + +__STATIC_INLINE void interrupts_disable(const nrf_drv_uart_t * p_instance) +{ + CODE_FOR_UARTE + ( + nrf_uarte_int_disable(p_instance->reg.p_uarte, NRF_UARTE_INT_ENDRX_MASK | + NRF_UARTE_INT_ENDTX_MASK | + NRF_UARTE_INT_ERROR_MASK | + NRF_UARTE_INT_RXTO_MASK); + nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uarte)); + ) + CODE_FOR_UART + ( + nrf_uart_int_disable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | + NRF_UART_INT_MASK_TXDRDY | + NRF_UART_INT_MASK_ERROR | + NRF_UART_INT_MASK_RXTO); + nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uart)); + ) + +} + +__STATIC_INLINE void pins_to_default(const nrf_drv_uart_t * p_instance) +{ + /* Reset pins to default states */ + uint32_t txd; + uint32_t rxd; + uint32_t rts; + uint32_t cts; + + CODE_FOR_UARTE + ( + txd = nrf_uarte_tx_pin_get(p_instance->reg.p_uarte); + rxd = nrf_uarte_rx_pin_get(p_instance->reg.p_uarte); + rts = nrf_uarte_rts_pin_get(p_instance->reg.p_uarte); + cts = nrf_uarte_cts_pin_get(p_instance->reg.p_uarte); + nrf_uarte_txrx_pins_disconnect(p_instance->reg.p_uarte); + nrf_uarte_hwfc_pins_disconnect(p_instance->reg.p_uarte); + ) + CODE_FOR_UART + ( + txd = nrf_uart_tx_pin_get(p_instance->reg.p_uart); + rxd = nrf_uart_rx_pin_get(p_instance->reg.p_uart); + rts = nrf_uart_rts_pin_get(p_instance->reg.p_uart); + cts = nrf_uart_cts_pin_get(p_instance->reg.p_uart); + nrf_uart_txrx_pins_disconnect(p_instance->reg.p_uart); + nrf_uart_hwfc_pins_disconnect(p_instance->reg.p_uart); + ) + + if (txd != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_cfg_default(txd); + } + + if (rxd != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_cfg_default(rxd); + } + + if (cts != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_cfg_default(cts); + } + + if (rts != NRF_UART_PSEL_DISCONNECTED) + { + nrf_gpio_cfg_default(rts); + } + +} + +__STATIC_INLINE void uart_enable(const nrf_drv_uart_t * p_instance) +{ + CODE_FOR_UARTE(nrf_uarte_enable(p_instance->reg.p_uarte);) + CODE_FOR_UART(nrf_uart_enable(p_instance->reg.p_uart);); +} + +__STATIC_INLINE void uart_disable(const nrf_drv_uart_t * p_instance) +{ + CODE_FOR_UARTE(nrf_uarte_disable(p_instance->reg.p_uarte);) + CODE_FOR_UART(nrf_uart_disable(p_instance->reg.p_uart);); +} + +ret_code_t nrf_drv_uart_init(const nrf_drv_uart_t * p_instance, nrf_drv_uart_config_t const * p_config, + nrf_uart_event_handler_t event_handler) +{ + ASSERT(p_config); + uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ret_code_t err_code = NRF_SUCCESS; + + if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + +#if (defined(UARTE_IN_USE) && defined(UART_IN_USE)) + p_cb->use_easy_dma = p_config->use_easy_dma; +#endif + apply_config(p_instance, p_config); + + p_cb->handler = event_handler; + p_cb->p_context = p_config->p_context; + + if (p_cb->handler) + { + interrupts_enable(p_instance, p_config->interrupt_priority); + } + + uart_enable(p_instance); + p_cb->rx_buffer_length = 0; + p_cb->rx_secondary_buffer_length = 0; + p_cb->tx_buffer_length = 0; + p_cb->state = NRF_DRV_STATE_INITIALIZED; + p_cb->rx_enabled = false; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + +void nrf_drv_uart_uninit(const nrf_drv_uart_t * p_instance) +{ + uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + + uart_disable(p_instance); + + if (p_cb->handler) + { + interrupts_disable(p_instance); + } + + pins_to_default(p_instance); + + p_cb->state = NRF_DRV_STATE_UNINITIALIZED; + p_cb->handler = NULL; + NRF_LOG_INFO("Instance uninitialized: %d.\r\n", p_instance->drv_inst_idx); +} + +#if defined(UART_IN_USE) +__STATIC_INLINE void tx_byte(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) +{ + nrf_uart_event_clear(p_uart, NRF_UART_EVENT_TXDRDY); + uint8_t txd = p_cb->p_tx_buffer[p_cb->tx_counter]; + p_cb->tx_counter++; + nrf_uart_txd_set(p_uart, txd); +} + +__STATIC_INLINE ret_code_t nrf_drv_uart_tx_for_uart(const nrf_drv_uart_t * p_instance) +{ + uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ret_code_t err_code = NRF_SUCCESS; + + nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY); + nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STARTTX); + + tx_byte(p_instance->reg.p_uart, p_cb); + + if (p_cb->handler == NULL) + { + while (p_cb->tx_counter < (uint16_t) p_cb->tx_buffer_length) + { + while (!nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY) && + p_cb->tx_counter != TX_COUNTER_ABORT_REQ_VALUE) + { + } + if (p_cb->tx_counter != TX_COUNTER_ABORT_REQ_VALUE) + { + tx_byte(p_instance->reg.p_uart, p_cb); + } + } + + if (p_cb->tx_counter == TX_COUNTER_ABORT_REQ_VALUE) + { + err_code = NRF_ERROR_FORBIDDEN; + } + else + { + while (!nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY)) + { + } + nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPTX); + } + p_cb->tx_buffer_length = 0; + } + + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} +#endif + +#if defined(UARTE_IN_USE) +__STATIC_INLINE ret_code_t nrf_drv_uart_tx_for_uarte(const nrf_drv_uart_t * p_instance) +{ + uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ret_code_t err_code = NRF_SUCCESS; + + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDTX); + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_TXSTOPPED); + nrf_uarte_tx_buffer_set(p_instance->reg.p_uarte, p_cb->p_tx_buffer, p_cb->tx_buffer_length); + nrf_uarte_task_trigger(p_instance->reg.p_uarte, NRF_UARTE_TASK_STARTTX); + + if (p_cb->handler == NULL) + { + bool endtx; + bool txstopped; + do + { + endtx = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDTX); + txstopped = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_TXSTOPPED); + } + while ((!endtx) && (!txstopped)); + + if (txstopped) + { + err_code = NRF_ERROR_FORBIDDEN; + } + p_cb->tx_buffer_length = 0; + } + + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} +#endif + +ret_code_t nrf_drv_uart_tx(const nrf_drv_uart_t * p_instance, uint8_t const * const p_data, uint8_t length) +{ + uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state == NRF_DRV_STATE_INITIALIZED); + ASSERT(length>0); + ASSERT(p_data); + + ret_code_t err_code; + + CODE_FOR_UARTE + ( + // EasyDMA requires that transfer buffers are placed in DataRAM, + // signal error if the are not. + if (!nrf_drv_is_in_RAM(p_data)) + { + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + ) + + if (nrf_drv_uart_tx_in_progress(p_instance)) + { + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + p_cb->tx_buffer_length = length; + p_cb->p_tx_buffer = p_data; + p_cb->tx_counter = 0; + + NRF_LOG_INFO("Transfer tx_len: %d.\r\n", p_cb->tx_buffer_length); + NRF_LOG_DEBUG("Tx data:\r\n"); + NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_cb->p_tx_buffer, p_cb->tx_buffer_length * sizeof(p_cb->p_tx_buffer)); + + CODE_FOR_UARTE + ( + return nrf_drv_uart_tx_for_uarte(p_instance); + ) + CODE_FOR_UART + ( + return nrf_drv_uart_tx_for_uart(p_instance); + ) +} + +bool nrf_drv_uart_tx_in_progress(const nrf_drv_uart_t * p_instance) +{ + return (m_cb[p_instance->drv_inst_idx].tx_buffer_length != 0); +} + +#if defined(UART_IN_USE) +__STATIC_INLINE void rx_enable(const nrf_drv_uart_t * p_instance) +{ + nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_ERROR); + nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_RXDRDY); + nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STARTRX); +} + +__STATIC_INLINE void rx_byte(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) +{ + if (!p_cb->rx_buffer_length) + { + nrf_uart_event_clear(p_uart, NRF_UART_EVENT_RXDRDY); + // Byte received when buffer is not set - data lost. + (void) nrf_uart_rxd_get(p_uart); + return; + } + nrf_uart_event_clear(p_uart, NRF_UART_EVENT_RXDRDY); + p_cb->p_rx_buffer[p_cb->rx_counter] = nrf_uart_rxd_get(p_uart); + p_cb->rx_counter++; +} + +__STATIC_INLINE ret_code_t nrf_drv_uart_rx_for_uart(const nrf_drv_uart_t * p_instance, uint8_t * p_data, uint8_t length, bool second_buffer) +{ + ret_code_t err_code; + + uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + + if ((!p_cb->rx_enabled) && (!second_buffer)) + { + rx_enable(p_instance); + } + + if (p_cb->handler == NULL) + { + nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_RXTO); + + bool rxrdy; + bool rxto; + bool error; + do + { + do + { + error = nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_ERROR); + rxrdy = nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_RXDRDY); + rxto = nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_RXTO); + } while ((!rxrdy) && (!rxto) && (!error)); + + if (error || rxto) + { + break; + } + rx_byte(p_instance->reg.p_uart, p_cb); + } while (p_cb->rx_buffer_length > p_cb->rx_counter); + + p_cb->rx_buffer_length = 0; + if (error) + { + err_code = NRF_ERROR_INTERNAL; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if (rxto) + { + err_code = NRF_ERROR_FORBIDDEN; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if (p_cb->rx_enabled) + { + nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STARTRX); + } + else + { + // Skip stopping RX if driver is forced to be enabled. + nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPRX); + } + } + else + { + nrf_uart_int_enable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + } + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} +#endif + +#if defined(UARTE_IN_USE) +__STATIC_INLINE ret_code_t nrf_drv_uart_rx_for_uarte(const nrf_drv_uart_t * p_instance, uint8_t * p_data, uint8_t length, bool second_buffer) +{ + ret_code_t err_code = NRF_SUCCESS; + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDRX); + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_RXTO); + nrf_uarte_rx_buffer_set(p_instance->reg.p_uarte, p_data, length); + if (!second_buffer) + { + nrf_uarte_task_trigger(p_instance->reg.p_uarte, NRF_UARTE_TASK_STARTRX); + } + else + { + nrf_uarte_shorts_enable(p_instance->reg.p_uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + } + + if (m_cb[p_instance->drv_inst_idx].handler == NULL) + { + bool endrx; + bool rxto; + bool error; + do { + endrx = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDRX); + rxto = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_RXTO); + error = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ERROR); + }while ((!endrx) && (!rxto) && (!error)); + + m_cb[p_instance->drv_inst_idx].rx_buffer_length = 0; + + if (error) + { + err_code = NRF_ERROR_INTERNAL; + } + + if (rxto) + { + err_code = NRF_ERROR_FORBIDDEN; + } + } + else + { + nrf_uarte_int_enable(p_instance->reg.p_uarte, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK); + } + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} +#endif + +ret_code_t nrf_drv_uart_rx(const nrf_drv_uart_t * p_instance, uint8_t * p_data, uint8_t length) +{ + uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + + ASSERT(m_cb[p_instance->drv_inst_idx].state == NRF_DRV_STATE_INITIALIZED); + ASSERT(length>0); + + ret_code_t err_code; + + CODE_FOR_UARTE + ( + // EasyDMA requires that transfer buffers are placed in DataRAM, + // signal error if the are not. + if (!nrf_drv_is_in_RAM(p_data)) + { + err_code = NRF_ERROR_INVALID_ADDR; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + ) + + bool second_buffer = false; + + if (p_cb->handler) + { + CODE_FOR_UARTE + ( + nrf_uarte_int_disable(p_instance->reg.p_uarte, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK); + ) + CODE_FOR_UART + ( + nrf_uart_int_disable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + ) + } + if (p_cb->rx_buffer_length != 0) + { + if (p_cb->rx_secondary_buffer_length != 0) + { + if (p_cb->handler) + { + CODE_FOR_UARTE + ( + nrf_uarte_int_enable(p_instance->reg.p_uarte, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK); + ) + CODE_FOR_UART + ( + nrf_uart_int_enable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + ) + } + err_code = NRF_ERROR_BUSY; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + second_buffer = true; + } + + if (!second_buffer) + { + p_cb->rx_buffer_length = length; + p_cb->p_rx_buffer = p_data; + p_cb->rx_counter = 0; + p_cb->rx_secondary_buffer_length = 0; + } + else + { + p_cb->p_rx_secondary_buffer = p_data; + p_cb->rx_secondary_buffer_length = length; + } + + NRF_LOG_INFO("Transfer rx_len: %d.\r\n", length); + + + CODE_FOR_UARTE + ( + return nrf_drv_uart_rx_for_uarte(p_instance, p_data, length, second_buffer); + ) + CODE_FOR_UART + ( + return nrf_drv_uart_rx_for_uart(p_instance, p_data, length, second_buffer); + ) +} + +void nrf_drv_uart_rx_enable(const nrf_drv_uart_t * p_instance) +{ + //Easy dma mode does not support enabling receiver without setting up buffer. + CODE_FOR_UARTE + ( + ASSERT(false); + ) + CODE_FOR_UART + ( + if (!m_cb[p_instance->drv_inst_idx].rx_enabled) + { + rx_enable(p_instance); + m_cb[p_instance->drv_inst_idx].rx_enabled = true; + } + ) +} + +void nrf_drv_uart_rx_disable(const nrf_drv_uart_t * p_instance) +{ + //Easy dma mode does not support enabling receiver without setting up buffer. + CODE_FOR_UARTE + ( + ASSERT(false); + ) + CODE_FOR_UART + ( + nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPRX); + m_cb[p_instance->drv_inst_idx].rx_enabled = false; + ) +} + +uint32_t nrf_drv_uart_errorsrc_get(const nrf_drv_uart_t * p_instance) +{ + uint32_t errsrc; + CODE_FOR_UARTE + ( + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ERROR); + errsrc = nrf_uarte_errorsrc_get_and_clear(p_instance->reg.p_uarte); + ) + CODE_FOR_UART + ( + nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_ERROR); + errsrc = nrf_uart_errorsrc_get_and_clear(p_instance->reg.p_uart); + ) + return errsrc; +} + +__STATIC_INLINE void rx_done_event(uart_control_block_t * p_cb, uint8_t bytes, uint8_t * p_data) +{ + nrf_drv_uart_event_t event; + + event.type = NRF_DRV_UART_EVT_RX_DONE; + event.data.rxtx.bytes = bytes; + event.data.rxtx.p_data = p_data; + + p_cb->handler(&event, p_cb->p_context); +} + +__STATIC_INLINE void tx_done_event(uart_control_block_t * p_cb, uint8_t bytes) +{ + nrf_drv_uart_event_t event; + + event.type = NRF_DRV_UART_EVT_TX_DONE; + event.data.rxtx.bytes = bytes; + event.data.rxtx.p_data = (uint8_t *)p_cb->p_tx_buffer; + + p_cb->tx_buffer_length = 0; + + p_cb->handler(&event, p_cb->p_context); +} + +void nrf_drv_uart_tx_abort(const nrf_drv_uart_t * p_instance) +{ + uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + + CODE_FOR_UARTE + ( + nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_TXSTOPPED); + nrf_uarte_task_trigger(p_instance->reg.p_uarte, NRF_UARTE_TASK_STOPTX); + if (p_cb->handler == NULL) + { + while (!nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_TXSTOPPED)); + } + ) + CODE_FOR_UART + ( + nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPTX); + if (p_cb->handler) + { + tx_done_event(p_cb, p_cb->tx_counter); + } + else + { + p_cb->tx_counter = TX_COUNTER_ABORT_REQ_VALUE; + } + ) + NRF_LOG_INFO("TX transaction aborted.\r\n"); +} + +void nrf_drv_uart_rx_abort(const nrf_drv_uart_t * p_instance) +{ + CODE_FOR_UARTE + ( + nrf_uarte_task_trigger(p_instance->reg.p_uarte, NRF_UARTE_TASK_STOPRX); + ) + CODE_FOR_UART + ( + nrf_uart_int_disable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPRX); + ) + NRF_LOG_INFO("RX transaction aborted.\r\n"); +} + + +#if defined(UART_IN_USE) +__STATIC_INLINE void uart_irq_handler(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) +{ + if (nrf_uart_int_enable_check(p_uart, NRF_UART_INT_MASK_ERROR) && + nrf_uart_event_check(p_uart, NRF_UART_EVENT_ERROR)) + { + nrf_drv_uart_event_t event; + nrf_uart_event_clear(p_uart, NRF_UART_EVENT_ERROR); + NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_UART_EVENT_ERROR)); + nrf_uart_int_disable(p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + if (!p_cb->rx_enabled) + { + nrf_uart_task_trigger(p_uart, NRF_UART_TASK_STOPRX); + } + event.type = NRF_DRV_UART_EVT_ERROR; + event.data.error.error_mask = nrf_uart_errorsrc_get_and_clear(p_uart); + event.data.error.rxtx.bytes = p_cb->rx_buffer_length; + event.data.error.rxtx.p_data = p_cb->p_rx_buffer; + + //abort transfer + p_cb->rx_buffer_length = 0; + p_cb->rx_secondary_buffer_length = 0; + + p_cb->handler(&event,p_cb->p_context); + } + else if (nrf_uart_int_enable_check(p_uart, NRF_UART_INT_MASK_RXDRDY) && + nrf_uart_event_check(p_uart, NRF_UART_EVENT_RXDRDY)) + { + rx_byte(p_uart, p_cb); + if (p_cb->rx_buffer_length == p_cb->rx_counter) + { + if (p_cb->rx_secondary_buffer_length) + { + uint8_t * p_data = p_cb->p_rx_buffer; + uint8_t rx_counter = p_cb->rx_counter; + + //Switch to secondary buffer. + p_cb->rx_buffer_length = p_cb->rx_secondary_buffer_length; + p_cb->p_rx_buffer = p_cb->p_rx_secondary_buffer; + p_cb->rx_secondary_buffer_length = 0; + p_cb->rx_counter = 0; + rx_done_event(p_cb, rx_counter, p_data); + } + else + { + if (!p_cb->rx_enabled) + { + nrf_uart_task_trigger(p_uart, NRF_UART_TASK_STOPRX); + } + nrf_uart_int_disable(p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + p_cb->rx_buffer_length = 0; + rx_done_event(p_cb, p_cb->rx_counter, p_cb->p_rx_buffer); + } + } + } + + if (nrf_uart_event_check(p_uart, NRF_UART_EVENT_TXDRDY)) + { + if (p_cb->tx_counter < (uint16_t) p_cb->tx_buffer_length) + { + tx_byte(p_uart, p_cb); + } + else + { + nrf_uart_event_clear(p_uart, NRF_UART_EVENT_TXDRDY); + if (p_cb->tx_buffer_length) + { + tx_done_event(p_cb, p_cb->tx_buffer_length); + } + } + } + + if (nrf_uart_event_check(p_uart, NRF_UART_EVENT_RXTO)) + { + nrf_uart_event_clear(p_uart, NRF_UART_EVENT_RXTO); + + // RXTO event may be triggered as a result of abort call. In th + if (p_cb->rx_enabled) + { + nrf_uart_task_trigger(p_uart, NRF_UART_TASK_STARTRX); + } + if (p_cb->rx_buffer_length) + { + p_cb->rx_buffer_length = 0; + rx_done_event(p_cb, p_cb->rx_counter, p_cb->p_rx_buffer); + } + } +} +#endif + +#if defined(UARTE_IN_USE) +__STATIC_INLINE void uarte_irq_handler(NRF_UARTE_Type * p_uarte, uart_control_block_t * p_cb) +{ + if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ERROR)) + { + nrf_drv_uart_event_t event; + + nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_ERROR); + + event.type = NRF_DRV_UART_EVT_ERROR; + event.data.error.error_mask = nrf_uarte_errorsrc_get_and_clear(p_uarte); + event.data.error.rxtx.bytes = nrf_uarte_rx_amount_get(p_uarte); + event.data.error.rxtx.p_data = p_cb->p_rx_buffer; + + //abort transfer + p_cb->rx_buffer_length = 0; + p_cb->rx_secondary_buffer_length = 0; + + p_cb->handler(&event, p_cb->p_context); + } + else if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ENDRX)) + { + nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_ENDRX); + uint8_t amount = nrf_uarte_rx_amount_get(p_uarte); + // If the transfer was stopped before completion, amount of transfered bytes + // will not be equal to the buffer length. Interrupted trunsfer is ignored. + if (amount == p_cb->rx_buffer_length) + { + if (p_cb->rx_secondary_buffer_length) + { + uint8_t * p_data = p_cb->p_rx_buffer; + nrf_uarte_shorts_disable(p_uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); + p_cb->rx_buffer_length = p_cb->rx_secondary_buffer_length; + p_cb->p_rx_buffer = p_cb->p_rx_secondary_buffer; + p_cb->rx_secondary_buffer_length = 0; + rx_done_event(p_cb, amount, p_data); + } + else + { + p_cb->rx_buffer_length = 0; + rx_done_event(p_cb, amount, p_cb->p_rx_buffer); + } + } + } + + if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_RXTO)) + { + nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_RXTO); + if (p_cb->rx_buffer_length) + { + p_cb->rx_buffer_length = 0; + rx_done_event(p_cb, nrf_uarte_rx_amount_get(p_uarte), p_cb->p_rx_buffer); + } + } + + if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ENDTX)) + { + nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_ENDTX); + if (p_cb->tx_buffer_length) + { + tx_done_event(p_cb, nrf_uarte_tx_amount_get(p_uarte)); + } + } +} +#endif + +#if UART0_ENABLED +void UART0_IRQHandler(void) +{ + CODE_FOR_UARTE_INT + ( + UART0_INSTANCE_INDEX, + uarte_irq_handler(NRF_UARTE0, &m_cb[UART0_INSTANCE_INDEX]); + ) + CODE_FOR_UART + ( + uart_irq_handler(NRF_UART0, &m_cb[UART0_INSTANCE_INDEX]); + ) +} +#endif + +#if UART1_ENABLED +void UARTE1_IRQHandler(void) +{ + CODE_FOR_UARTE_INT + ( + UART1_INSTANCE_INDEX, + uarte_irq_handler(NRF_UARTE1, &m_cb[UART1_INSTANCE_INDEX]); + ) + CODE_FOR_UART + ( + uart_irq_handler(NRF_UART1, &m_cb[UART1_INSTANCE_INDEX]); + ) +} +#endif +#endif //NRF_MODULE_ENABLED(UART) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.h new file mode 100644 index 0000000000..5cbec57107 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.h @@ -0,0 +1,429 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * @addtogroup nrf_uart UART driver and HAL + * @ingroup nrf_drivers + * @brief UART API. + * @details The UART driver provides APIs for utilizing the UART peripheral. + * + * @defgroup nrf_drv_uart UART driver + * @{ + * @ingroup nrf_uart + * + * @brief UART driver. + */ + +#ifndef NRF_DRV_UART_H +#define NRF_DRV_UART_H + +#include "nrf_uart.h" +#ifdef UARTE_PRESENT +#include "nrf_uarte.h" +#endif + +#include "sdk_errors.h" +#include "sdk_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef UART1_ENABLED +#define UART1_ENABLED 0 +#endif + +#ifndef UART0_ENABLED +#define UART0_ENABLED 0 +#endif + +#define UART0_INSTANCE_INDEX 0 +#define UART1_INSTANCE_INDEX UART0_ENABLED +#define UART_ENABLED_COUNT UART0_ENABLED + UART1_ENABLED + +#if defined(UARTE_PRESENT) + #define NRF_DRV_UART_PERIPHERAL(id) \ + (CONCAT_3(UART, id, _CONFIG_USE_EASY_DMA) == 1 ? \ + (void *)CONCAT_2(NRF_UARTE, id) \ + : (void *)CONCAT_2(NRF_UART, id)) +#else + #define NRF_DRV_UART_PERIPHERAL(id) (void *)CONCAT_2(NRF_UART, id) +#endif + +// This set of macros makes it possible to exclude parts of code, when one type +// of supported peripherals is not used. + +#if defined(UARTE_PRESENT) + +#if (UART_EASY_DMA_SUPPORT == 1) +#define UARTE_IN_USE +#endif + +#if (UART_LEGACY_SUPPORT == 1) +#define UART_IN_USE +#endif + +#if (UART_ENABLED == 1) && ((!defined(UARTE_IN_USE) && !defined(UART_IN_USE)) || ((UART_EASY_DMA_SUPPORT == 0) && (UART_LEGACY_SUPPORT == 0))) +#error "Illegal settings in uart module!" +#endif + +#elif defined(UART_PRESENT) +#define UART_IN_USE +#endif + +/** + * @brief Structure for the UART driver instance. + */ +typedef struct +{ + union + { +#if (defined(UARTE_IN_USE)) + NRF_UARTE_Type * p_uarte; ///< Pointer to a structure with UARTE registers. +#endif +#if (defined(UART_IN_USE) || (UART_ENABLED == 0)) + NRF_UART_Type * p_uart; ///< Pointer to a structure with UART registers. +#endif + } reg; + uint8_t drv_inst_idx; ///< Driver instance index. +} nrf_drv_uart_t; + +/** + * @brief Macro for creating an UART driver instance. + */ +#define NRF_DRV_UART_INSTANCE(id) \ +{ \ + .reg = {NRF_DRV_UART_PERIPHERAL(id)}, \ + .drv_inst_idx = CONCAT_3(UART, id, _INSTANCE_INDEX),\ +} + +/** + * @brief Types of UART driver events. + */ +typedef enum +{ + NRF_DRV_UART_EVT_TX_DONE, ///< Requested TX transfer completed. + NRF_DRV_UART_EVT_RX_DONE, ///< Requested RX transfer completed. + NRF_DRV_UART_EVT_ERROR, ///< Error reported by UART peripheral. +} nrf_drv_uart_evt_type_t; + +/**@brief Structure for UART configuration. */ +typedef struct +{ + uint32_t pseltxd; ///< TXD pin number. + uint32_t pselrxd; ///< RXD pin number. + uint32_t pselcts; ///< CTS pin number. + uint32_t pselrts; ///< RTS pin number. + void * p_context; ///< Context passed to interrupt handler. + nrf_uart_hwfc_t hwfc; ///< Flow control configuration. + nrf_uart_parity_t parity; ///< Parity configuration. + nrf_uart_baudrate_t baudrate; ///< Baudrate. + uint8_t interrupt_priority; ///< Interrupt priority. +#ifdef UARTE_PRESENT + bool use_easy_dma; +#endif +} nrf_drv_uart_config_t; + +/**@brief UART default configuration. */ +#ifdef UARTE_PRESENT +#if !UART_LEGACY_SUPPORT +#define DEFAULT_CONFIG_USE_EASY_DMA true +#elif !UART_EASY_DMA_SUPPORT +#define DEFAULT_CONFIG_USE_EASY_DMA false +#else +#define DEFAULT_CONFIG_USE_EASY_DMA UART0_USE_EASY_DMA +#endif +#define NRF_DRV_UART_DEFAULT_CONFIG \ + { \ + .pseltxd = NRF_UART_PSEL_DISCONNECTED, \ + .pselrxd = NRF_UART_PSEL_DISCONNECTED, \ + .pselcts = NRF_UART_PSEL_DISCONNECTED, \ + .pselrts = NRF_UART_PSEL_DISCONNECTED, \ + .p_context = NULL, \ + .hwfc = (nrf_uart_hwfc_t)UART_DEFAULT_CONFIG_HWFC, \ + .parity = (nrf_uart_parity_t)UART_DEFAULT_CONFIG_PARITY, \ + .baudrate = (nrf_uart_baudrate_t)UART_DEFAULT_CONFIG_BAUDRATE, \ + .interrupt_priority = UART_DEFAULT_CONFIG_IRQ_PRIORITY, \ + .use_easy_dma = true \ + } +#else +#define NRF_DRV_UART_DEFAULT_CONFIG \ + { \ + .pseltxd = NRF_UART_PSEL_DISCONNECTED, \ + .pselrxd = NRF_UART_PSEL_DISCONNECTED, \ + .pselcts = NRF_UART_PSEL_DISCONNECTED, \ + .pselrts = NRF_UART_PSEL_DISCONNECTED, \ + .p_context = NULL, \ + .hwfc = (nrf_uart_hwfc_t)UART_DEFAULT_CONFIG_HWFC, \ + .parity = (nrf_uart_parity_t)UART_DEFAULT_CONFIG_PARITY, \ + .baudrate = (nrf_uart_baudrate_t)UART_DEFAULT_CONFIG_BAUDRATE, \ + .interrupt_priority = UART_DEFAULT_CONFIG_IRQ_PRIORITY, \ + } +#endif + +/**@brief Structure for UART transfer completion event. */ +typedef struct +{ + uint8_t * p_data; ///< Pointer to memory used for transfer. + uint8_t bytes; ///< Number of bytes transfered. +} nrf_drv_uart_xfer_evt_t; + +/**@brief Structure for UART error event. */ +typedef struct +{ + nrf_drv_uart_xfer_evt_t rxtx; ///< Transfer details includes number of bytes transfered. + uint32_t error_mask;///< Mask of error flags that generated the event. +} nrf_drv_uart_error_evt_t; + +/**@brief Structure for UART event. */ +typedef struct +{ + nrf_drv_uart_evt_type_t type; ///< Event type. + union + { + nrf_drv_uart_xfer_evt_t rxtx; ///< Data provided for transfer completion events. + nrf_drv_uart_error_evt_t error;///< Data provided for error event. + } data; +} nrf_drv_uart_event_t; + +/** + * @brief UART interrupt event handler. + * + * @param[in] p_event Pointer to event structure. Event is allocated on the stack so it is available + * only within the context of the event handler. + * @param[in] p_context Context passed to interrupt handler, set on initialization. + */ +typedef void (*nrf_uart_event_handler_t)(nrf_drv_uart_event_t * p_event, void * p_context); + +/** + * @brief Function for initializing the UART driver. + * + * This function configures and enables UART. After this function GPIO pins are controlled by UART. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_config Initial configuration. Default configuration used if NULL. + * @param[in] event_handler Event handler provided by the user. If not provided driver works in + * blocking mode. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If driver is already initialized. + */ +ret_code_t nrf_drv_uart_init(nrf_drv_uart_t const * p_instance, + nrf_drv_uart_config_t const * p_config, + nrf_uart_event_handler_t event_handler); + +/** + * @brief Function for uninitializing the UART driver. + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_uart_uninit(nrf_drv_uart_t const * p_instance); + +/** + * @brief Function for getting the address of a specific UART task. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_drv_uart_t const * p_instance, + nrf_uart_task_t task); + +/** + * @brief Function for getting the address of a specific UART event. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] event Event. + * + * @return Event address. + */ +__STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(nrf_drv_uart_t const * p_instance, + nrf_uart_event_t event); + +/** + * @brief Function for sending data over UART. + * + * If an event handler was provided in nrf_drv_uart_init() call, this function + * returns immediately and the handler is called when the transfer is done. + * Otherwise, the transfer is performed in blocking mode, i.e. this function + * returns when the transfer is finished. Blocking mode is not using interrupt so + * there is no context switching inside the function. + * + * @note Peripherals using EasyDMA (i.e. UARTE) require that the transfer buffers + * are placed in the Data RAM region. If they are not and UARTE instance is + * used, this function will fail with error code NRF_ERROR_INVALID_ADDR. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_data Pointer to data. + * @param[in] length Number of bytes to send. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_BUSY If driver is already transferring. + * @retval NRF_ERROR_FORBIDDEN If the transfer was aborted from a different context + * (blocking mode only, also see @ref nrf_drv_uart_rx_disable). + * @retval NRF_ERROR_INVALID_ADDR If p_data does not point to RAM buffer (UARTE only). + */ +ret_code_t nrf_drv_uart_tx(nrf_drv_uart_t const * p_instance, + uint8_t const * const p_data, uint8_t length); + +/** + * @brief Function for checking if UART is currently transmitting. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval true If UART is transmitting. + * @retval false If UART is not transmitting. + */ +bool nrf_drv_uart_tx_in_progress(nrf_drv_uart_t const * p_instance); + +/** + * @brief Function for aborting any ongoing transmission. + * @note @ref NRF_DRV_UART_EVT_TX_DONE event will be generated in non-blocking mode. Event will + * contain number of bytes sent until abort was called. If Easy DMA is not used event will be + * called from the function context. If Easy DMA is used it will be called from UART interrupt + * context. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_uart_tx_abort(nrf_drv_uart_t const * p_instance); + +/** + * @brief Function for receiving data over UART. + * + * If an event handler was provided in the nrf_drv_uart_init() call, this function + * returns immediately and the handler is called when the transfer is done. + * Otherwise, the transfer is performed in blocking mode, i.e. this function + * returns when the transfer is finished. Blocking mode is not using interrupt so + * there is no context switching inside the function. + * The receive buffer pointer is double buffered in non-blocking mode. The secondary + * buffer can be set immediately after starting the transfer and will be filled + * when the primary buffer is full. The double buffering feature allows + * receiving data continuously. + * + * @note Peripherals using EasyDMA (i.e. UARTE) require that the transfer buffers + * are placed in the Data RAM region. If they are not and UARTE driver instance + * is used, this function will fail with error code NRF_ERROR_INVALID_ADDR. + * + * @param[in] p_instance Pointer to the driver instance structure. + * @param[in] p_data Pointer to data. + * @param[in] length Number of bytes to receive. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_BUSY If the driver is already receiving + * (and the secondary buffer has already been set + * in non-blocking mode). + * @retval NRF_ERROR_FORBIDDEN If the transfer was aborted from a different context + * (blocking mode only, also see @ref nrf_drv_uart_rx_disable). + * @retval NRF_ERROR_INTERNAL If UART peripheral reported an error. + * @retval NRF_ERROR_INVALID_ADDR If p_data does not point to RAM buffer (UARTE only). + */ +ret_code_t nrf_drv_uart_rx(nrf_drv_uart_t const * p_instance, + uint8_t * p_data, uint8_t length); + +/** + * @brief Function for enabling receiver. + * + * UART has 6 byte long RX FIFO and it will be used to store incoming data. If user will not call + * UART receive function before FIFO is filled, overrun error will encounter. Enabling receiver + * without specifying RX buffer is supported only in UART mode (without Easy DMA). Receiver must be + * explicitly closed by the user @sa nrf_drv_uart_rx_disable. Function asserts if mode is wrong. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_uart_rx_enable(nrf_drv_uart_t const * p_instance); + +/** + * @brief Function for disabling receiver. + * + * Function must be called to close the receiver after it has been explicitly enabled by + * @sa nrf_drv_uart_rx_enable. Feature is supported only in UART mode (without Easy DMA). Function + * asserts if mode is wrong. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_uart_rx_disable(nrf_drv_uart_t const * p_instance); + +/** + * @brief Function for aborting any ongoing reception. + * @note @ref NRF_DRV_UART_EVT_RX_DONE event will be generated in non-blocking mode. The event will + * contain the number of bytes received until abort was called. The event is called from UART interrupt + * context. + * + * @param[in] p_instance Pointer to the driver instance structure. + */ +void nrf_drv_uart_rx_abort(nrf_drv_uart_t const * p_instance); + +/** + * @brief Function for reading error source mask. Mask contains values from @ref nrf_uart_error_mask_t. + * @note Function should be used in blocking mode only. In case of non-blocking mode error event is + * generated. Function clears error sources after reading. + * + * @param[in] p_instance Pointer to the driver instance structure. + * + * @retval Mask of reported errors. + */ +uint32_t nrf_drv_uart_errorsrc_get(nrf_drv_uart_t const * p_instance); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_drv_uart_t const * p_instance, + nrf_uart_task_t task) +{ +#ifdef UART_IN_USE + return nrf_uart_task_address_get(p_instance->reg.p_uart, task); +#else + return nrf_uarte_task_address_get(p_instance->reg.p_uarte, (nrf_uarte_task_t)task); +#endif +} + +__STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(nrf_drv_uart_t const * p_instance, + nrf_uart_event_t event) +{ +#ifdef UART_IN_USE + return nrf_uart_event_address_get(p_instance->reg.p_uart, event); +#else + return nrf_uarte_event_address_get(p_instance->reg.p_uarte, (nrf_uarte_event_t)event); +#endif +} +#endif //SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + +#endif //NRF_DRV_UART_H +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/wdt/nrf_drv_wdt.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/wdt/nrf_drv_wdt.c new file mode 100644 index 0000000000..d51c24dcf2 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/wdt/nrf_drv_wdt.c @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(WDT) +#include "nrf_drv_wdt.h" +#include "nrf_drv_common.h" +#include "nrf_error.h" +#include "nrf_assert.h" +#include "nrf_wdt.h" +#include "app_util_platform.h" +#include +#include + +#define NRF_LOG_MODULE_NAME "WDT" + +#if WDT_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL WDT_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR WDT_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR WDT_CONFIG_DEBUG_COLOR +#else //WDT_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif //WDT_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + + +/**@brief WDT event handler. */ +static nrf_wdt_event_handler_t m_wdt_event_handler; + +/**@brief WDT state. */ +static nrf_drv_state_t m_state; + +/**@brief WDT alloc table. */ +static uint32_t m_alloc_index; + +static const nrf_drv_wdt_config_t m_default_config = NRF_DRV_WDT_DEAFULT_CONFIG; + +/**@brief WDT interrupt handler. */ +void WDT_IRQHandler(void) +{ + if (nrf_wdt_int_enable_check(NRF_WDT_INT_TIMEOUT_MASK) == true) + { + nrf_wdt_event_clear(NRF_WDT_EVENT_TIMEOUT); + m_wdt_event_handler(); + } +} + + +ret_code_t nrf_drv_wdt_init(nrf_drv_wdt_config_t const * p_config, + nrf_wdt_event_handler_t wdt_event_handler) +{ + ASSERT(wdt_event_handler != NULL); + ret_code_t err_code; + m_wdt_event_handler = wdt_event_handler; + + if (m_state == NRF_DRV_STATE_UNINITIALIZED) + { + m_state = NRF_DRV_STATE_INITIALIZED; + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + nrf_wdt_behaviour_set(p_config->behaviour); + + + + + + + + nrf_wdt_reload_value_set((p_config->reload_value * 32768) / 1000); + + nrf_drv_common_irq_enable(WDT_IRQn, p_config->interrupt_priority); + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_wdt_enable(void) +{ + ASSERT(m_alloc_index != 0); + ASSERT(m_state == NRF_DRV_STATE_INITIALIZED); + nrf_wdt_int_enable(NRF_WDT_INT_TIMEOUT_MASK); + nrf_wdt_task_trigger(NRF_WDT_TASK_START); + m_state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Enabled.\r\n"); +} + + +void nrf_drv_wdt_feed(void) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + for (uint32_t i = 0; i < m_alloc_index; i++) + { + nrf_wdt_reload_request_set((nrf_wdt_rr_register_t)(NRF_WDT_RR0 + i)); + } +} + +ret_code_t nrf_drv_wdt_channel_alloc(nrf_drv_wdt_channel_id * p_channel_id) +{ + ret_code_t result; + ASSERT(p_channel_id); + ASSERT(m_state == NRF_DRV_STATE_INITIALIZED); + + CRITICAL_REGION_ENTER(); + if (m_alloc_index < NRF_WDT_CHANNEL_NUMBER) + { + *p_channel_id = (nrf_drv_wdt_channel_id)(NRF_WDT_RR0 + m_alloc_index); + m_alloc_index++; + nrf_wdt_reload_request_enable(*p_channel_id); + result = NRF_SUCCESS; + } + else + { + result = NRF_ERROR_NO_MEM; + } + CRITICAL_REGION_EXIT(); + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(result)); + return result; +} + +void nrf_drv_wdt_channel_feed(nrf_drv_wdt_channel_id channel_id) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + nrf_wdt_reload_request_set(channel_id); +} +#endif //NRF_MODULE_ENABLED(WDT) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/wdt/nrf_drv_wdt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/wdt/nrf_drv_wdt.h new file mode 100644 index 0000000000..7435a9908b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/wdt/nrf_drv_wdt.h @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * @addtogroup nrf_wdt WDT HAL and driver + * @ingroup nrf_drivers + * @brief Watchdog timer (WDT) APIs. + * @details The WDT HAL provides basic APIs for accessing the registers of the watchdog timer. + * The WDT driver provides APIs on a higher level. + * @defgroup nrf_drv_wdt WDT driver + * @{ + * @ingroup nrf_wdt + * + * @brief Driver for managing the watchdog timer (WDT). + */ + +#ifndef NRF_DRV_WDT_H__ +#define NRF_DRV_WDT_H__ + +#include +#include +#include "sdk_errors.h" +#include "nrf_wdt.h" +#include "sdk_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Struct for WDT initialization. */ +typedef struct +{ + nrf_wdt_behaviour_t behaviour; /**< WDT behaviour when CPU in sleep/halt mode. */ + uint32_t reload_value; /**< WDT reload value in ms. */ + uint8_t interrupt_priority; /**< WDT interrupt priority */ +} nrf_drv_wdt_config_t; + +/**@brief WDT event handler function type. */ +typedef void (*nrf_wdt_event_handler_t)(void); + +/**@brief WDT channel id type. */ +typedef nrf_wdt_rr_register_t nrf_drv_wdt_channel_id; + +#define NRF_DRV_WDT_DEAFULT_CONFIG \ + { \ + .behaviour = (nrf_wdt_behaviour_t)WDT_CONFIG_BEHAVIOUR, \ + .reload_value = WDT_CONFIG_RELOAD_VALUE, \ + .interrupt_priority = WDT_CONFIG_IRQ_PRIORITY, \ + } +/** + * @brief This function initializes watchdog. + * + * @param[in] p_config Initial configuration. Default configuration used if NULL. + * @param[in] wdt_event_handler specifies event handler provided by user. + * + * @note Function asserts if wdt_event_handler is NULL. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +ret_code_t nrf_drv_wdt_init(nrf_drv_wdt_config_t const * p_config, + nrf_wdt_event_handler_t wdt_event_handler); + +/** + * @brief This function allocate watchdog channel. + * + * @note This function can not be called after nrf_drv_wdt_start(void). + * + * @param[out] p_channel_id ID of granted channel. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +ret_code_t nrf_drv_wdt_channel_alloc(nrf_drv_wdt_channel_id * p_channel_id); + +/** + * @brief This function starts watchdog. + * + * @note After calling this function the watchdog is started, so the user needs to feed all allocated + * watchdog channels to avoid reset. At least one watchdog channel has to be allocated. + */ +void nrf_drv_wdt_enable(void); + +/** + * @brief This function feeds the watchdog. + * + * @details Function feeds all allocated watchdog channels. + */ +void nrf_drv_wdt_feed(void); + +/** + * @brief This function feeds the invidual watchdog channel. + * + * @param[in] channel_id ID of watchdog channel. + */ +void nrf_drv_wdt_channel_feed(nrf_drv_wdt_channel_id channel_id); + +/**@brief Function for returning a requested task address for the wdt driver module. + * + * @param[in] task One of the peripheral tasks. + * + * @retval Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_wdt_ppi_task_addr(nrf_wdt_task_t task) +{ + return nrf_wdt_task_address_get(task); +} + +/**@brief Function for returning a requested event address for the wdt driver module. + * + * @param[in] event One of the peripheral events. + * + * @retval Event address + */ +__STATIC_INLINE uint32_t nrf_drv_wdt_ppi_event_addr(nrf_wdt_event_t event) +{ + return nrf_wdt_event_address_get(event); +} + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.c new file mode 100644 index 0000000000..535bbc5bd7 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.c @@ -0,0 +1,1037 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_ble_dfu.h" + +#include +#include "sdk_common.h" +#include "nrf_dfu_req_handler.h" +#include "nrf_dfu_transport.h" +#include "nrf_dfu_mbr.h" +#include "nrf_bootloader_info.h" +#include "ble_conn_params.h" +#include "boards.h" +#include "nrf_log.h" +#include "ble_hci.h" +#include "app_timer.h" +#include "softdevice_handler_appsh.h" +#include "nrf_log.h" +#include "nrf_delay.h" + +#define ADVERTISING_LED_PIN_NO BSP_LED_0 /**< Is on when device is advertising. */ +#define CONNECTED_LED_PIN_NO BSP_LED_1 /**< Is on when device has connected. */ + +#define DEVICE_NAME "DfuTarg" /**< Name of device. Will be included in the advertising data. */ +#define MANUFACTURER_NAME "NordicSemiconductor" /**< Manufacturer. Will be passed to Device Information Service. */ + +#define MIN_CONN_INTERVAL (uint16_t)(MSEC_TO_UNITS(15, UNIT_1_25_MS)) /**< Minimum acceptable connection interval. */ +#define MAX_CONN_INTERVAL_MS 30 /**< Maximum acceptable connection interval in milliseconds. */ +#define MAX_CONN_INTERVAL (uint16_t)(MSEC_TO_UNITS(MAX_CONN_INTERVAL_MS, UNIT_1_25_MS)) /**< Maximum acceptable connection interval . */ +#define SLAVE_LATENCY 0 /**< Slave latency. */ +#define CONN_SUP_TIMEOUT (4 * 100) /**< Connection supervisory timeout (4 seconds). */ + +#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ + +#define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(100, APP_TIMER_PRESCALER) /**< Time from the Connected event to first time sd_ble_gap_conn_param_update is called (100 milliseconds). */ +#define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(500, APP_TIMER_PRESCALER) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (500 milliseconds). */ +#define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */ + +#define MAX_ADV_DATA_LENGTH 20 /**< Maximum length of advertising data. */ + +#define APP_ADV_INTERVAL MSEC_TO_UNITS(25, UNIT_0_625_MS) /**< The advertising interval (25 ms.). */ +#define APP_ADV_TIMEOUT_IN_SECONDS BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED /**< The advertising timeout in units of seconds. This is set to @ref BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED so that the advertisement is done as long as there there is a call to @ref dfu_transport_close function.*/ + +#define APP_FEATURE_NOT_SUPPORTED BLE_GATT_STATUS_ATTERR_APP_BEGIN + 2 /**< Reply when unsupported features are requested. */ + +#define MAX_DFU_PKT_LEN (20) /**< Maximum length (in bytes) of the DFU Packet characteristic. */ +#define PKT_CREATE_PARAM_LEN (6) /**< Length (in bytes) of the parameters for Create Object request. */ +#define PKT_SET_PRN_PARAM_LEN (3) /**< Length (in bytes) of the parameters for Set Packet Receipt Notification request. */ +#define PKT_READ_OBJECT_INFO_PARAM_LEN (2) /**< Length (in bytes) of the parameters for Read Object Info request. */ +#define MAX_RESPONSE_LEN (15) /**< Maximum length (in bytes) of the response to a Control Point command. */ + + +#if (NRF_SD_BLE_API_VERSION <= 3) + #define NRF_BLE_MAX_MTU_SIZE GATT_MTU_SIZE_DEFAULT /**< MTU size used in the softdevice enabling and to reply to a BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST event. */ +#else + #define NRF_BLE_MAX_MTU_SIZE BLE_GATT_MTU_SIZE_DEFAULT /**< MTU size used in the softdevice enabling and to reply to a BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST event. */ +#endif + + +static ble_dfu_t m_dfu; /**< Structure used to identify the Device Firmware Update service. */ +static uint16_t m_pkt_notif_target; /**< Number of packets of firmware data to be received before transmitting the next Packet Receipt Notification to the DFU Controller. */ +static uint16_t m_pkt_notif_target_cnt; /**< Number of packets of firmware data received after sending last Packet Receipt Notification or since the receipt of a @ref BLE_DFU_PKT_RCPT_NOTIF_ENABLED event from the DFU service, which ever occurs later.*/ +static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current connection. */ + +#define DFU_BLE_FLAG_NONE (0) +#define DFU_BLE_FLAG_SERVICE_INITIALIZED (1 << 0) /**< Flag to check if the DFU service was initialized by the application.*/ +#define DFU_BLE_FLAG_IS_ADVERTISING (1 << 1) /**< Flag to indicate if advertising is ongoing.*/ +#define DFU_BLE_FLAG_TEAR_DOWN_IN_PROGRESS (1 << 2) /**< Flag to indicate whether a tear down is in progress. A tear down could be because the application has initiated it or the peer has disconnected. */ + +static uint32_t m_flags; + +static uint8_t m_notif_buffer[MAX_RESPONSE_LEN]; /**< Buffer used for sending notifications to peer. */ + +//lint -save -e545 -esym(526, dfu_trans) -esym(528, dfu_trans) +DFU_TRANSPORT_REGISTER(nrf_dfu_transport_t const dfu_trans) = +{ + .init_func = ble_dfu_transport_init, + .close_func = ble_dfu_transport_close +}; +//lint -restore + + +/**@brief Function for handling a Connection Parameters error. + * + * @param[in] nrf_error Error code. + */ +static void conn_params_error_handler(uint32_t nrf_error) +{ + APP_ERROR_HANDLER(nrf_error); +} + + +/**@brief Function for initializing the Connection Parameters module. + */ +static uint32_t conn_params_init(void) +{ + ble_conn_params_init_t cp_init = {0}; + + cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY; + cp_init.next_conn_params_update_delay = NEXT_CONN_PARAMS_UPDATE_DELAY; + cp_init.max_conn_params_update_count = MAX_CONN_PARAMS_UPDATE_COUNT; + cp_init.start_on_notify_cccd_handle = BLE_GATT_HANDLE_INVALID; + cp_init.disconnect_on_fail = false; + cp_init.error_handler = conn_params_error_handler; + + return ble_conn_params_init(&cp_init); +} + + +/**@brief Function for the Advertising functionality initialization. + * + * @details Encodes the required advertising data and passes it to the stack. + * The advertising data encoded here is specific for DFU. + * Setting advertising data can by done by calling @ref ble_advdata_set. + */ +static uint32_t advertising_init(uint8_t adv_flags) +{ + uint32_t err_code; + uint16_t len_advdata = 9; + uint16_t max_device_name_length = MAX_ADV_DATA_LENGTH - len_advdata; + uint16_t actual_device_name_length = max_device_name_length; + + uint8_t p_encoded_advdata[MAX_ADV_DATA_LENGTH]; + + // Encode flags. + p_encoded_advdata[0] = 0x2; + p_encoded_advdata[1] = BLE_GAP_AD_TYPE_FLAGS; + p_encoded_advdata[2] = adv_flags; + + // Encode 'more available' uuid list. + p_encoded_advdata[3] = 0x3; + p_encoded_advdata[4] = BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE; + p_encoded_advdata[5] = LSB_16(BLE_DFU_SERVICE_UUID); + p_encoded_advdata[6] = MSB_16(BLE_DFU_SERVICE_UUID); + + // Get GAP device name and length + err_code = sd_ble_gap_device_name_get(&p_encoded_advdata[9], &actual_device_name_length); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Set GAP device in advertising data. + if (actual_device_name_length <= max_device_name_length) + { + p_encoded_advdata[7] = actual_device_name_length + 1; // (actual_length + ADV_AD_TYPE_FIELD_SIZE(1)) + p_encoded_advdata[8] = BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME; + len_advdata += actual_device_name_length; + } + else + { + // Must use a shorter advertising name than the actual name of the device + p_encoded_advdata[7] = max_device_name_length + 1; // (length + ADV_AD_TYPE_FIELD_SIZE(1)) + p_encoded_advdata[8] = BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME; + len_advdata = MAX_ADV_DATA_LENGTH; + } + return sd_ble_gap_adv_data_set(p_encoded_advdata, len_advdata, NULL, 0); +} + + +/**@brief Function for starting advertising. + */ +static uint32_t advertising_start(void) +{ + uint32_t err_code; + ble_gap_adv_params_t adv_params; + + if ((m_flags & DFU_BLE_FLAG_IS_ADVERTISING) != 0) + { + return NRF_SUCCESS; + } + + // Initialize advertising parameters (used when starting advertising). + memset(&adv_params, 0, sizeof(adv_params)); + + err_code = advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE); + VERIFY_SUCCESS(err_code); + + adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND; + adv_params.p_peer_addr = NULL; + adv_params.fp = BLE_GAP_ADV_FP_ANY; + adv_params.interval = APP_ADV_INTERVAL; + adv_params.timeout = APP_ADV_TIMEOUT_IN_SECONDS; + + err_code = sd_ble_gap_adv_start(&adv_params); + VERIFY_SUCCESS(err_code); + + nrf_gpio_pin_clear(ADVERTISING_LED_PIN_NO); + nrf_gpio_pin_set(CONNECTED_LED_PIN_NO); + + m_flags |= DFU_BLE_FLAG_IS_ADVERTISING; + return NRF_SUCCESS; +} + + +/**@brief Function for stopping advertising. + */ +static uint32_t advertising_stop(void) +{ + uint32_t err_code; + + if ((m_flags & DFU_BLE_FLAG_IS_ADVERTISING) == 0) + { + return NRF_SUCCESS; + } + + err_code = sd_ble_gap_adv_stop(); + VERIFY_SUCCESS(err_code); + + nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO); + + m_flags |= DFU_BLE_FLAG_IS_ADVERTISING; + return NRF_SUCCESS; +} + + +static bool is_cccd_configured(ble_dfu_t * p_dfu) +{ + uint8_t cccd_val_buf[BLE_CCCD_VALUE_LEN]; + ble_gatts_value_t gatts_value = {0}; + + gatts_value.len = BLE_CCCD_VALUE_LEN; + gatts_value.p_value = cccd_val_buf; + + // Check the CCCD Value of DFU Control Point. + uint32_t err_code = sd_ble_gatts_value_get(m_conn_handle, + p_dfu->dfu_ctrl_pt_handles.cccd_handle, + &gatts_value); + VERIFY_SUCCESS(err_code); + + return ble_srv_is_notification_enabled(cccd_val_buf); +} + + +static uint32_t send_hvx(uint16_t conn_handle, uint16_t value_handle, uint16_t len) +{ + ble_gatts_hvx_params_t hvx_params = {0}; + + hvx_params.handle = value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.p_len = &len; + hvx_params.p_data = m_notif_buffer; + + return sd_ble_gatts_hvx(conn_handle, &hvx_params); +} + + +static uint32_t response_send(ble_dfu_t * p_dfu, + uint8_t op_code, + nrf_dfu_res_code_t resp_val) +{ + uint16_t index = 0; + + NRF_LOG_INFO("Sending Response: [0x%01x, 0x%01x]\r\n", op_code, resp_val); + +#ifndef NRF51 + if (p_dfu == NULL) + { + return NRF_ERROR_NULL; + } +#endif + + if ((m_conn_handle == BLE_CONN_HANDLE_INVALID) || (m_flags & DFU_BLE_FLAG_SERVICE_INITIALIZED) == 0) + { + return NRF_ERROR_INVALID_STATE; + } + + m_notif_buffer[index++] = BLE_DFU_OP_CODE_RESPONSE; + + // Encode the Request Op code + m_notif_buffer[index++] = op_code; + + // Encode the Response Value. + m_notif_buffer[index++] = (uint8_t)resp_val; + + return send_hvx(m_conn_handle, p_dfu->dfu_ctrl_pt_handles.value_handle, index); +} + + +static uint32_t response_crc_cmd_send(ble_dfu_t * p_dfu, + uint32_t offset, + uint32_t crc) +{ + uint16_t index = 0; + + NRF_LOG_INFO("Sending CRC: [0x60, 0x03, 0x01, 0:x%08x, CRC:0x%08x]\r\n", offset, crc); + +#ifndef NRF51 + if (p_dfu == NULL) + { + return NRF_ERROR_NULL; + } +#endif + + if ((m_conn_handle == BLE_CONN_HANDLE_INVALID) || (m_flags & DFU_BLE_FLAG_SERVICE_INITIALIZED) == 0) + { + return NRF_ERROR_INVALID_STATE; + } + + m_notif_buffer[index++] = BLE_DFU_OP_CODE_RESPONSE; + + // Encode the Request Op code + m_notif_buffer[index++] = BLE_DFU_OP_CODE_CALCULATE_CRC; + + // Encode the Response Value. + m_notif_buffer[index++] = (uint8_t)NRF_DFU_RES_CODE_SUCCESS; + + // Encode the Offset Value. + index += uint32_encode(offset, &m_notif_buffer[index]); + + // Encode the Crc Value. + index += uint32_encode(crc, &m_notif_buffer[index]); + + return send_hvx(m_conn_handle, p_dfu->dfu_ctrl_pt_handles.value_handle, index); +} + + +static uint32_t response_select_object_cmd_send(ble_dfu_t * p_dfu, + uint32_t max_size, + uint32_t offset, + uint32_t crc) +{ + uint16_t index = 0; + + NRF_LOG_INFO("Sending Object Info: [0x60, 0x06, 0x01 max: 0:x%08x 0:x%08x, CRC:0x%08x]\r\n", max_size, offset, crc); +#ifndef NRF51 + if (p_dfu == NULL) + { + return NRF_ERROR_NULL; + } +#endif + + if ((m_conn_handle == BLE_CONN_HANDLE_INVALID) || (m_flags & DFU_BLE_FLAG_SERVICE_INITIALIZED) == 0) + { + return NRF_ERROR_INVALID_STATE; + } + + m_notif_buffer[index++] = BLE_DFU_OP_CODE_RESPONSE; + + // Encode the Request Op code + m_notif_buffer[index++] = BLE_DFU_OP_CODE_SELECT_OBJECT; + + // Encode the Success Response Value. + m_notif_buffer[index++] = (uint8_t)NRF_DFU_RES_CODE_SUCCESS; + + // Encode the Max Size Value. + index += uint32_encode(max_size, &m_notif_buffer[index]); + + // Encode the Offset Value. + index += uint32_encode(offset, &m_notif_buffer[index]); + + // Encode the Crc Value. + index += uint32_encode(crc, &m_notif_buffer[index]); + + return send_hvx(m_conn_handle, p_dfu->dfu_ctrl_pt_handles.value_handle, index); +} + + +/**@brief Function for handling a Write event on the Control Point characteristic. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_ble_write_evt Pointer to the write event received from BLE stack. + * + * @return NRF_SUCCESS on successful processing of control point write. Otherwise an error code. + */ +static uint32_t on_ctrl_pt_write(ble_dfu_t * p_dfu, ble_gatts_evt_write_t * p_ble_write_evt) +{ + nrf_dfu_res_code_t res_code; + nrf_dfu_req_t dfu_req; + nrf_dfu_res_t dfu_res = {{{0}}}; + + memset(&dfu_req, 0, sizeof(nrf_dfu_req_t)); + + switch (p_ble_write_evt->data[0]) + { + case BLE_DFU_OP_CODE_CREATE_OBJECT: + + if (p_ble_write_evt->len != PKT_CREATE_PARAM_LEN) + { + return response_send(p_dfu, + BLE_DFU_OP_CODE_CREATE_OBJECT, + NRF_DFU_RES_CODE_INVALID_PARAMETER); + } + + NRF_LOG_INFO("Received create object\r\n"); + + // Reset the packet receipt notification on create object + m_pkt_notif_target_cnt = m_pkt_notif_target; + + // Get type parameter + //lint -save -e415 + dfu_req.obj_type = p_ble_write_evt->data[1]; + //lint -restore + + // Get length value + //lint -save -e416 + dfu_req.object_size = uint32_decode(&(p_ble_write_evt->data[2])); + //lint -restore + + // Set req type + dfu_req.req_type = NRF_DFU_OBJECT_OP_CREATE; + + res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); + return response_send(p_dfu, BLE_DFU_OP_CODE_CREATE_OBJECT, res_code); + + case BLE_DFU_OP_CODE_EXECUTE_OBJECT: + NRF_LOG_INFO("Received execute object\r\n"); + + // Set req type + dfu_req.req_type = NRF_DFU_OBJECT_OP_EXECUTE; + + res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); + return response_send(p_dfu, BLE_DFU_OP_CODE_EXECUTE_OBJECT, res_code); + + case BLE_DFU_OP_CODE_SET_RECEIPT_NOTIF: + NRF_LOG_INFO("Set receipt notif\r\n"); + if (p_ble_write_evt->len != PKT_SET_PRN_PARAM_LEN) + { + return (response_send(p_dfu, + BLE_DFU_OP_CODE_SET_RECEIPT_NOTIF, + NRF_DFU_RES_CODE_INVALID_PARAMETER)); + } + + //lint -save -e415 + m_pkt_notif_target = uint16_decode(&(p_ble_write_evt->data[1])); + //lint -restore + m_pkt_notif_target_cnt = m_pkt_notif_target; + + return response_send(p_dfu, BLE_DFU_OP_CODE_SET_RECEIPT_NOTIF, NRF_DFU_RES_CODE_SUCCESS); + + case BLE_DFU_OP_CODE_CALCULATE_CRC: + NRF_LOG_INFO("Received calculate CRC\r\n"); + + dfu_req.req_type = NRF_DFU_OBJECT_OP_CRC; + + res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); + if (res_code == NRF_DFU_RES_CODE_SUCCESS) + { + return response_crc_cmd_send(p_dfu, dfu_res.offset, dfu_res.crc); + } + else + { + return response_send(p_dfu, BLE_DFU_OP_CODE_CALCULATE_CRC, res_code); + } + + case BLE_DFU_OP_CODE_SELECT_OBJECT: + + NRF_LOG_INFO("Received select object\r\n"); + if (p_ble_write_evt->len != PKT_READ_OBJECT_INFO_PARAM_LEN) + { + return response_send(p_dfu, + BLE_DFU_OP_CODE_SELECT_OBJECT, + NRF_DFU_RES_CODE_INVALID_PARAMETER); + } + + // Set object type to read info about + //lint -save -e415 + dfu_req.obj_type = p_ble_write_evt->data[1]; + //lint -restore + + dfu_req.req_type = NRF_DFU_OBJECT_OP_SELECT; + + res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); + if (res_code == NRF_DFU_RES_CODE_SUCCESS) + { + return response_select_object_cmd_send(p_dfu, dfu_res.max_size, dfu_res.offset, dfu_res.crc); + } + else + { + return response_send(p_dfu, BLE_DFU_OP_CODE_SELECT_OBJECT, res_code); + } + + default: + NRF_LOG_INFO("Received unsupported OP code\r\n"); + // Unsupported op code. + return response_send(p_dfu, + p_ble_write_evt->data[0], + NRF_DFU_RES_CODE_INVALID_PARAMETER); + } +} + + +/**@brief Function for handling the @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event from the + * SoftDevice. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static bool on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) +{ + uint32_t err_code; + ble_gatts_rw_authorize_reply_params_t auth_reply = {0}; + ble_gatts_evt_rw_authorize_request_t * p_authorize_request; + ble_gatts_evt_write_t * p_ble_write_evt; + + p_authorize_request = &(p_ble_evt->evt.gatts_evt.params.authorize_request); + p_ble_write_evt = &(p_ble_evt->evt.gatts_evt.params.authorize_request.request.write); + + if ((p_authorize_request->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) && + (p_authorize_request->request.write.handle == p_dfu->dfu_ctrl_pt_handles.value_handle) && + (p_authorize_request->request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ) && + (p_authorize_request->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) && + (p_authorize_request->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) ) + { + auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + auth_reply.params.write.update = 1; + auth_reply.params.write.offset = p_ble_write_evt->offset; + auth_reply.params.write.len = p_ble_write_evt->len; + auth_reply.params.write.p_data = p_ble_write_evt->data; + + if (!is_cccd_configured(p_dfu)) + { + // Send an error response to the peer indicating that the CCCD is improperly configured. + auth_reply.params.write.gatt_status = BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR; + + // Ignore response of auth reply + (void)sd_ble_gatts_rw_authorize_reply(m_conn_handle, &auth_reply); + return false; + } + + auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + + err_code = sd_ble_gatts_rw_authorize_reply(m_conn_handle, &auth_reply); + return err_code == NRF_SUCCESS ? true: false; + } + else + { + return false; + } +} + + +/**@brief Function for handling the @ref BLE_GATTS_EVT_WRITE event from the SoftDevice. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_write(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) +{ + if (p_ble_evt->evt.gatts_evt.params.write.handle == p_dfu->dfu_pkt_handles.value_handle) + { + nrf_dfu_res_code_t res_code; + nrf_dfu_req_t dfu_req; + nrf_dfu_res_t dfu_res = {{{0}}}; + + memset(&dfu_req, 0, sizeof(nrf_dfu_req_t)); + + // Set req type + dfu_req.req_type = NRF_DFU_OBJECT_OP_WRITE; + + // Set data and length + dfu_req.p_req = p_ble_evt->evt.gatts_evt.params.write.data; + dfu_req.req_len = p_ble_evt->evt.gatts_evt.params.write.len; + + res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); + if(res_code != NRF_DFU_RES_CODE_SUCCESS) + { + NRF_LOG_ERROR("Failure to run packet write\r\n"); + } + + // Check if a packet receipt notification is needed to be sent. + if (m_pkt_notif_target != 0 && --m_pkt_notif_target_cnt == 0) + { + (void)response_crc_cmd_send(p_dfu, dfu_res.offset, dfu_res.crc); + + // Reset the counter for the number of firmware packets. + m_pkt_notif_target_cnt = m_pkt_notif_target; + } + } +} + + +/**@brief Function for the Application's SoftDevice event handler. + * + * @param[in] p_ble_evt SoftDevice event. + */ +static void on_ble_evt(ble_evt_t * p_ble_evt) +{ + uint32_t err_code; + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + nrf_gpio_pin_clear(CONNECTED_LED_PIN_NO); + nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO); + + m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + m_flags &= ~DFU_BLE_FLAG_IS_ADVERTISING; + break; + + case BLE_GAP_EVT_DISCONNECTED: + // Restart advertising so that the DFU Controller can reconnect if possible. + err_code = advertising_start(); + APP_ERROR_CHECK(err_code); + + m_conn_handle = BLE_CONN_HANDLE_INVALID; + + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + { + err_code = sd_ble_gap_sec_params_reply(m_conn_handle, + BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, + NULL, + NULL); + APP_ERROR_CHECK(err_code); + } + break; + + case BLE_GATTS_EVT_TIMEOUT: + if (p_ble_evt->evt.gatts_evt.params.timeout.src == BLE_GATT_TIMEOUT_SRC_PROTOCOL) + { + err_code = sd_ble_gap_disconnect(m_conn_handle, + BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); + APP_ERROR_CHECK(err_code); + } + break; + + case BLE_EVT_USER_MEM_REQUEST: + err_code = sd_ble_user_mem_reply(m_conn_handle, NULL); + APP_ERROR_CHECK(err_code); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + if (p_ble_evt->evt.gatts_evt.params.authorize_request.type + != BLE_GATTS_AUTHORIZE_TYPE_INVALID) + { + if (on_rw_authorize_req(&m_dfu, p_ble_evt)) + { + err_code = on_ctrl_pt_write(&m_dfu, + &(p_ble_evt->evt.gatts_evt.params.authorize_request.request.write)); +#ifdef NRF_DFU_DEBUG_VERSION + if (err_code != NRF_SUCCESS) + { + NRF_LOG_ERROR("Could not handle on_ctrl_pt_write. err_code: 0x%04x\r\n", err_code); + } +#else + // Swallow result + (void) err_code; +#endif + } + } + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + err_code = sd_ble_gap_sec_info_reply(p_ble_evt->evt.gap_evt.conn_handle, NULL, NULL, NULL); + APP_ERROR_CHECK(err_code); + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + err_code = sd_ble_gatts_sys_attr_set(p_ble_evt->evt.gap_evt.conn_handle, NULL, 0, 0); + APP_ERROR_CHECK(err_code); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(&m_dfu, p_ble_evt); + break; + +#if (NRF_SD_BLE_API_VERSION >= 3) + case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST: + err_code = sd_ble_gatts_exchange_mtu_reply(p_ble_evt->evt.gatts_evt.conn_handle, + NRF_BLE_MAX_MTU_SIZE); + APP_ERROR_CHECK(err_code); + break; // BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST +#endif + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for dispatching a SoftDevice event. + * + * @details This function is called from the SoftDevice event interrupt handler after a + * SoftDevice event has been received. + * + * @param[in] p_ble_evt SoftDevice event. + */ +static void ble_evt_dispatch(ble_evt_t * p_ble_evt) +{ + ble_conn_params_on_ble_evt(p_ble_evt); + on_ble_evt(p_ble_evt); +} + + +/**@brief Function for the LEDs initialization. + * + * @details Initializes all LEDs used by this application. + */ +static void leds_init(void) +{ + nrf_gpio_cfg_output(ADVERTISING_LED_PIN_NO); + nrf_gpio_cfg_output(CONNECTED_LED_PIN_NO); + nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO); + nrf_gpio_pin_set(CONNECTED_LED_PIN_NO); +} + + +static uint32_t gap_address_change(void) +{ + uint32_t err_code; + ble_gap_addr_t addr; + +#if (NRF_SD_BLE_API_VERSION < 3) + err_code = sd_ble_gap_address_get(&addr); +#else + err_code = sd_ble_gap_addr_get(&addr); +#endif + + VERIFY_SUCCESS(err_code); + + // Increase the BLE address by one when advertising openly. + addr.addr[0] += 1; + +#if (NRF_SD_BLE_API_VERSION < 3) + err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr); +#else + err_code = sd_ble_gap_addr_set(&addr); +#endif + + VERIFY_SUCCESS(err_code); + + return NRF_SUCCESS; +} + + +/**@brief Function for the GAP initialization. + * + * @details This function will setup all the necessary GAP (Generic Access Profile) parameters of + * the device. It also sets the permissions and appearance. + */ +static uint32_t gap_params_init(void) +{ + uint32_t err_code; + ble_gap_conn_params_t gap_conn_params = {0}; + ble_gap_conn_sec_mode_t sec_mode; + + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); + + // This seems to not be implemented on Graviton + err_code = gap_address_change(); + VERIFY_SUCCESS(err_code); + + err_code = sd_ble_gap_device_name_set(&sec_mode, + (const uint8_t *)DEVICE_NAME, + strlen(DEVICE_NAME)); + + + VERIFY_SUCCESS(err_code); + + gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL; + gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL; + gap_conn_params.slave_latency = SLAVE_LATENCY; + gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT; + + err_code = sd_ble_gap_ppcp_set(&gap_conn_params); + return err_code; +} + + +static uint32_t ble_stack_init(bool init_softdevice) +{ + uint32_t err_code; + nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; + + if (init_softdevice) + { + err_code = nrf_dfu_mbr_init_sd(); + VERIFY_SUCCESS(err_code); + } + + NRF_LOG_INFO("vector table: 0x%08x\r\n", BOOTLOADER_START_ADDR); + err_code = sd_softdevice_vector_table_base_set(BOOTLOADER_START_ADDR); + VERIFY_SUCCESS(err_code); + NRF_LOG_INFO("vector table: 0x%08x\r\n", BOOTLOADER_START_ADDR); + + NRF_LOG_INFO("Error code - sd_softdevice_vector_table_base_set: 0x%08x\r\n", err_code); + //err_code = sd_softdevice_vector_table_base_set(BOOTLOADER_START_ADDR); + + NRF_LOG_INFO("Before SOFTDEVICE_HANDLER_APPSH_INIT\r\n"); + SOFTDEVICE_HANDLER_APPSH_INIT(&clock_lf_cfg, true); + NRF_LOG_INFO("After SOFTDEVICE_HANDLER_APPSH_INIT\r\n"); + + ble_enable_params_t ble_enable_params; + // Only one connection as a central is used when performing dfu. + err_code = softdevice_enable_get_default_config(1, 1, &ble_enable_params); + NRF_LOG_INFO("Error code - softdevice_enable_get_default_config: 0x%08x\r\n", err_code); + VERIFY_SUCCESS(err_code); + +#if (NRF_SD_BLE_API_VERSION >= 3) + ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_MAX_MTU_SIZE; +#endif + + NRF_LOG_INFO("Enabling softdevice.\r\n"); + // Enable BLE stack. + err_code = softdevice_enable(&ble_enable_params); + if (err_code != NRF_SUCCESS) + { + NRF_LOG_ERROR("Failed softdevice_enable: 0x%08x\r\n", err_code); + } + else + { + NRF_LOG_INFO("Softdevice enabled\r\n"); + } + + return err_code; +} + + +/**@brief Function for adding DFU Packet characteristic to the BLE Stack. + * + * @param[in] p_dfu DFU Service structure. + * + * @return NRF_SUCCESS on success. Otherwise an error code. + */ +static uint32_t dfu_pkt_char_add(ble_dfu_t * const p_dfu) +{ + ble_gatts_char_md_t char_md = {{0}}; + ble_gatts_attr_t attr_char_value = {0}; + ble_gatts_attr_md_t attr_md = {{0}}; + ble_uuid_t char_uuid; + + char_md.char_props.write_wo_resp = 1; + + char_uuid.type = p_dfu->uuid_type; + char_uuid.uuid = BLE_DFU_PKT_CHAR_UUID; + + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.vlen = 1; + + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.max_len = MAX_DFU_PKT_LEN; + attr_char_value.p_value = NULL; + + return sd_ble_gatts_characteristic_add(p_dfu->service_handle, + &char_md, + &attr_char_value, + &p_dfu->dfu_pkt_handles); +} + + +/**@brief Function for adding DFU Control Point characteristic to the BLE Stack. + * + * @param[in] p_dfu DFU Service structure. + * + * @return NRF_SUCCESS on success. Otherwise an error code. + */ +static uint32_t dfu_ctrl_pt_add(ble_dfu_t * const p_dfu) +{ + ble_gatts_char_md_t char_md = {{0}}; + ble_gatts_attr_t attr_char_value = {0}; + ble_gatts_attr_md_t attr_md = {{0}}; + ble_uuid_t char_uuid; + + char_md.char_props.write = 1; + char_md.char_props.notify = 1; + + char_uuid.type = p_dfu->uuid_type; + char_uuid.uuid = BLE_DFU_CTRL_PT_UUID; + + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.wr_auth = 1; + attr_md.vlen = 1; + + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.max_len = BLE_L2CAP_MTU_DEF; + attr_char_value.p_value = NULL; + + return sd_ble_gatts_characteristic_add(p_dfu->service_handle, + &char_md, + &attr_char_value, + &p_dfu->dfu_ctrl_pt_handles); +} + + +/**@brief Function for checking if the CCCD of DFU Control point is configured for Notification. + * + * @details This function checks if the CCCD of DFU Control Point characteristic is configured + * for Notification by the DFU Controller. + * + * @param[in] p_dfu DFU Service structure. + * + * @return True if the CCCD of DFU Control Point characteristic is configured for Notification. + * False otherwise. + */ +uint32_t ble_dfu_init(ble_dfu_t * p_dfu) +{ + ble_uuid_t service_uuid; + uint32_t err_code; + +#ifndef NRF51 + if (p_dfu == NULL) + { + return NRF_ERROR_NULL; + } +#endif + + m_conn_handle = BLE_CONN_HANDLE_INVALID; + + BLE_UUID_BLE_ASSIGN(service_uuid, BLE_DFU_SERVICE_UUID); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &service_uuid, + &(p_dfu->service_handle)); + VERIFY_SUCCESS(err_code); + + const ble_uuid128_t base_uuid128 = + { + { + 0x50, 0xEA, 0xDA, 0x30, 0x88, 0x83, 0xB8, 0x9F, + 0x60, 0x4F, 0x15, 0xF3, 0x00, 0x00, 0xC9, 0x8E + } + }; + err_code = sd_ble_uuid_vs_add(&base_uuid128, &p_dfu->uuid_type); + VERIFY_SUCCESS(err_code); + + err_code = dfu_pkt_char_add(p_dfu); + VERIFY_SUCCESS(err_code); + + err_code = dfu_ctrl_pt_add(p_dfu); + VERIFY_SUCCESS(err_code); + + m_flags |= DFU_BLE_FLAG_SERVICE_INITIALIZED; + + return NRF_SUCCESS; +} + + +uint32_t ble_dfu_transport_init(void) +{ + uint32_t err_code; + + m_flags &= ~DFU_BLE_FLAG_NONE; + + leds_init(); + + err_code = ble_stack_init(true); + VERIFY_SUCCESS(err_code); + + err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); + VERIFY_SUCCESS(err_code); + + err_code = gap_params_init(); + VERIFY_SUCCESS(err_code); + + // Initialize the Device Firmware Update Service. + err_code = ble_dfu_init(&m_dfu); + VERIFY_SUCCESS(err_code); + + err_code = conn_params_init(); + VERIFY_SUCCESS(err_code); + + err_code = advertising_start(); + VERIFY_SUCCESS(err_code); + + return NRF_SUCCESS; +} + + +uint32_t ble_dfu_transport_close(void) +{ + uint32_t err_code = NRF_SUCCESS; + + if ((m_flags & DFU_BLE_FLAG_TEAR_DOWN_IN_PROGRESS) != 0) + { + return NRF_SUCCESS; + } + + m_flags |= DFU_BLE_FLAG_TEAR_DOWN_IN_PROGRESS; + + NRF_LOG_INFO("Waiting for buffers to be cleared before disconnect\r\n"); + nrf_delay_ms(MAX_CONN_INTERVAL_MS*4); + NRF_LOG_INFO("Disconnecting\r\n"); + + if (m_conn_handle != BLE_CONN_HANDLE_INVALID) + { + // Disconnect from peer. + err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); + VERIFY_SUCCESS(err_code); + } + else if ((m_flags & DFU_BLE_FLAG_IS_ADVERTISING) != 0) + { + // If not connected, then the device will be advertising. Hence stop the advertising. + err_code = advertising_stop(); + VERIFY_SUCCESS(err_code); + } + + // Stop the timer, disregard the result. + (void)ble_conn_params_stop(); + return err_code; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.h new file mode 100644 index 0000000000..4882acfa2a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.h @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup nrf_ble_dfu DFU BLE Service + * @{ + * @ingroup sdk_nrf_bootloader + * @brief Device Firmware Update (DFU) transport layer for Bluetooth low energy. + * + * @details The Device Firmware Update (DFU) Service is a GATT-based service that can be used for + * performing firmware updates over BLE. Note that this implementation uses + * vendor-specific UUIDs for the service and characteristics and is intended to demonstrate + * firmware updates over BLE. See @ref lib_dfu_transport_ble "DFU Transport: BLE" for more information on the service and the profile. + */ + +#ifndef NRF_BLE_DFU_H__ +#define NRF_BLE_DFU_H__ + +#include +#include "ble_gatts.h" +#include "ble.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +// This is a 16-bit UUID. +#define BLE_DFU_SERVICE_UUID 0xFE59 //!< The UUID of the DFU Service. + +// These UUIDs are used with the Nordic base address to create a 128-bit UUID (0x8EC9XXXXF3154F609FB8838830DAEA50). +#define BLE_DFU_CTRL_PT_UUID 0x0001 //!< The UUID of the DFU Control Point. +#define BLE_DFU_PKT_CHAR_UUID 0x0002 //!< The UUID of the DFU Packet Characteristic. + + +/**@brief BLE DFU opcodes. + * + * @details These types of opcodes are used in control point access. + */ +typedef enum +{ + BLE_DFU_OP_CODE_CREATE_OBJECT = 0x01, /**< Value of the opcode field for a 'Create object' request. */ + BLE_DFU_OP_CODE_SET_RECEIPT_NOTIF = 0x02, /**< Value of the opcode field for a 'Set Packet Receipt Notification' request. */ + BLE_DFU_OP_CODE_CALCULATE_CRC = 0x03, /**< Value of the opcode field for a 'Calculating checksum' request. */ + BLE_DFU_OP_CODE_EXECUTE_OBJECT = 0x04, /**< Value of the opcode field for an 'Initialize DFU parameters' request. */ + BLE_DFU_OP_CODE_SELECT_OBJECT = 0x06, /**< Value of the opcode field for a 'Select object' request. */ + BLE_DFU_OP_CODE_RESPONSE = 0x60 /**< Value of the opcode field for a response.*/ +} ble_dfu_op_code_t; + + +/**@brief DFU Service. + * + * @details This structure contains status information related to the service. + */ +typedef struct +{ + uint16_t service_handle; /**< Handle of the DFU Service (as provided by the SoftDevice). */ + uint8_t uuid_type; /**< UUID type assigned to the DFU Service by the SoftDevice. */ + ble_gatts_char_handles_t dfu_pkt_handles; /**< Handles related to the DFU Packet Characteristic. */ + ble_gatts_char_handles_t dfu_ctrl_pt_handles; /**< Handles related to the DFU Control Point Characteristic. */ +} ble_dfu_t; + + +/**@brief Function for initializing the DFU Service. + * + * @retval NRF_SUCCESS If the DFU Service and its characteristics were successfully added to the + * SoftDevice. Otherwise, an error code is returned. + */ +uint32_t ble_dfu_transport_init(void); + + +/**@brief Function for closing down the DFU Service and disconnecting from the host. + * + * @retval NRF_SUCCESS If the DFU Service was correctly closed down. + */ +uint32_t ble_dfu_transport_close(void); + +#ifdef __cplusplus +} +#endif + +#endif // NRF_BLE_DFU_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.c new file mode 100644 index 0000000000..0144d960df --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.c @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_bootloader.h" + +#include "compiler_abstraction.h" +#include "nrf.h" +#include "nrf_bootloader_app_start.h" +#include "nrf_log.h" +#include "nrf_dfu.h" +#include "nrf_error.h" + + +/** @brief Weak implemenation of nrf_dfu_init + * + * @note This function will be overridden if nrf_dfu.c is + * compiled and linked with the project + */ + #if (__LINT__ != 1) +__WEAK uint32_t nrf_dfu_init(void) +{ + NRF_LOG_INFO("in weak nrf_dfu_init\r\n"); + return NRF_SUCCESS; +} +#endif + + +/** @brief Weak implementation of nrf_dfu_init + * + * @note This function must be overridden in application if + * user-specific initialization is needed. + */ +__WEAK uint32_t nrf_dfu_init_user(void) +{ + NRF_LOG_INFO("in weak nrf_dfu_init_user\r\n"); + return NRF_SUCCESS; +} + + +uint32_t nrf_bootloader_init(void) +{ + NRF_LOG_INFO("In nrf_bootloader_init\r\n"); + + uint32_t ret_val = NRF_SUCCESS; + + #if 0 + // Call user-defined init function if implemented + ret_val = nrf_dfu_init_user(); + if (ret_val != NRF_SUCCESS) + { + return ret_val; + } + #endif + + // Call DFU init function if implemented + ret_val = nrf_dfu_init(); + if (ret_val != NRF_SUCCESS) + { + return ret_val; + } + + NRF_LOG_INFO("After nrf_bootloader_init\r\n"); + return ret_val; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.h new file mode 100644 index 0000000000..abfb3f7b7f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_nrf_bootloader Bootloader modules + * @ingroup app_common + * @brief Modules for creating a bootloader. + * + * @defgroup sdk_bootloader Bootloader + * @{ + * @ingroup sdk_nrf_bootloader + * @brief Basic bootloader. + * + * The bootloader module can be used to implement a basic bootloader that + * can be extended with, for example, Device Firmware Update (DFU) support + * or custom functionality. + */ + +#ifndef NRF_BOOTLOADER_H__ +#define NRF_BOOTLOADER_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief Function for initializing the bootloader. + * + * @details This function is the entry point of all bootloader operations. + * If DFU functionality is compiled in, the DFU process is initialized + * when running this function. + * + * @retval NRF_SUCCESS If the bootloader was successfully initialized. + * Any other return code indicates that the operation failed. + */ +uint32_t nrf_bootloader_init(void); + + +/** @brief Function for customizing the bootloader initialization. + * + * @details This function is called during the initialization of the bootloader. + * It is implemented as weak function that can be overridden in the main file of the application. + * + * @retval NRF_SUCCESS If the user initialization was run successfully. + */ +uint32_t nrf_bootloader_user_init(void); + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_BOOTLOADER_H__ +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.c similarity index 87% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.c index 39eb64efbc..e8b390ce5c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,28 +36,15 @@ * */ - -#include "bootloader_util.h" #include -#include +#include "nrf_bootloader_app_start.h" +#include "compiler_abstraction.h" +#include "nrf_log.h" +#include "nrf_dfu_mbr.h" +#include "nrf_sdm.h" - -/** - * @brief Function for aborting current application/bootloader jump to to other app/bootloader. - * - * @details This functions will use the address provide to swap the stack pointer and then load - * the address of the reset handler to be executed. It will check current system mode - * (thread/handler) and if in thread mode it will reset into other application. - * If in handler mode \ref isr_abort will be executed to ensure correct exit of handler - * mode and jump into reset handler of other application. - * - * @param[in] start_addr Start address of other application. This address must point to the - initial stack pointer of the application. - * - * @note This function will never return but issue a reset into provided application. - */ #if defined ( __CC_ARM ) -__asm static void bootloader_util_reset(uint32_t start_addr) +__ASM static void nrf_bootloader_app_start_impl(uint32_t start_addr) { LDR R5, [R0] ; Get App initial MSP for bootloader. MSR MSP, R5 ; Set the main stack pointer to the applications MSP. @@ -91,10 +78,12 @@ isr_abort BX R0 ; No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application. ALIGN } + #elif defined ( __GNUC__ ) -static inline void bootloader_util_reset(uint32_t start_addr) + +static void __attribute__ ((noinline)) nrf_bootloader_app_start_impl(uint32_t start_addr) { - __asm volatile( + __ASM volatile( "ldr r0, [%0]\t\n" // Get App initial MSP for bootloader. "msr msp, r0\t\n" // Set the main stack pointer to the applications MSP. "ldr r0, [%0, #0x04]\t\n" // Load Reset handler into R0. @@ -131,17 +120,19 @@ static inline void bootloader_util_reset(uint32_t start_addr) : "r0", "r4", "r5", "r6", "r7" // List of register maintained manually. ); } + #elif defined ( __ICCARM__ ) -static inline void bootloader_util_reset(uint32_t start_addr) + +static inline void nrf_bootloader_app_start_impl(uint32_t start_addr) { - asm("ldr r5, [%0]\n" // Get App initial MSP for bootloader. + __ASM("ldr r5, [%0]\n" // Get App initial MSP for bootloader. "msr msp, r5\n" // Set the main stack pointer to the applications MSP. "ldr r0, [%0, #0x04]\n" // Load Reset handler into R0. "movs r4, #0x00\n" // Load zero into R4. "mvns r4, r4\n" // Invert R4 to ensure it contain ones. - "mrs r5, IPSR\n" // Load IPSR to R5 to check for handler or thread mode + "mrs r5, IPSR\n" // Load IPSR to R5 to check for handler or thread mode "cmp r5, #0x00\n" // Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader. "bne.n isr_abort\n" // If not zero we need to exit current ISR and jump to reset handler of bootloader. @@ -168,12 +159,51 @@ static inline void bootloader_util_reset(uint32_t start_addr) :: "r" (start_addr) // Argument list for the IAR assembly. start_addr is %0. : "r0", "r4", "r5", "r6", "r7"); // List of register maintained manually. } + #else + #error Compiler not supported. + #endif -void bootloader_util_app_start(uint32_t start_addr) +void nrf_bootloader_app_start(uint32_t start_addr) { - bootloader_util_reset(start_addr); + NRF_LOG_INFO("Running nrf_bootloader_app_start with address: 0x%08x\r\n", start_addr); + +#ifdef BLE_STACK_SUPPORT_REQD + uint32_t err_code; + + //NRF_LOG_INFO("Initializing SD in mbr\r\n"); + err_code = nrf_dfu_mbr_init_sd(); + if(err_code != NRF_SUCCESS) + { + NRF_LOG_ERROR("Failed running nrf_dfu_mbr_init_sd\r\n"); + return; + } + +#endif + + // Disable interrupts + NRF_LOG_INFO("Disabling interrupts\r\n"); + + NVIC->ICER[0]=0xFFFFFFFF; +#if defined(__NRF_NVIC_ISER_COUNT) && __NRF_NVIC_ISER_COUNT == 2 + NVIC->ICER[1]=0xFFFFFFFF; +#endif + +#ifdef BLE_STACK_SUPPORT_REQD + // Set the sd softdevice vector table base address + NRF_LOG_INFO("Setting SD vector table base: 0x%08x\r\n", start_addr); + err_code = sd_softdevice_vector_table_base_set(start_addr); + if(err_code != NRF_SUCCESS) + { + NRF_LOG_ERROR("Failed running sd_softdevice_vector_table_base_set\r\n"); + return; + } +#endif + + // Run application + nrf_bootloader_app_start_impl(start_addr); } + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.h similarity index 65% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc_internal.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.h index e737a2ef1e..891d3c828b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc_internal.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,35 +36,35 @@ * */ - -/** @file + +/**@file * - * @defgroup nrf_dfu_ble_svc_internal DFU BLE SVC internal + * @defgroup sdk_bootloader_app Application start * @{ - * - * @brief DFU BLE SVC internal functions in bootloader. The DFU BLE SuperVisor Calls allow an - * application to execute functions in the installed bootloader. This interface provides - * internal Bootloader DFU functions for retrieving data exchanged through SuperVisor Calls. - * + * @ingroup sdk_bootloader */ -#ifndef DFU_BLE_SVC_INTERNAL_H__ -#define DFU_BLE_SVC_INTERNAL_H__ +#ifndef NRF_BOOTLOADER_APP_START_H__ +#define NRF_BOOTLOADER_APP_START_H__ #include -#include "dfu_ble_svc.h" -#include "ble_gap.h" -/**@brief Internal bootloader/DFU function for retrieving peer data provided from application. +/**@brief Function for starting another application (and aborting the current one). * - * @param[out] p_peer_data Peer data set by application to be used for DFU connection. + * @details This function uses the provided address to swap the stack pointer and then load + * the address of the reset handler to be executed. It checks the current system mode + * (thread/handler). If in thread mode, it resets into the other application. + * If in handler mode, isr_abort is executed to ensure that handler mode is left correctly. + * It then jumps into the reset handler of the other application. + * + * @note This function will never return, but issues a reset into the provided application. + * + * @param[in] start_addr Start address of the other application. This address must point to the + initial stack pointer of the application. * - * @retval NRF_SUCCESS If peer data is valid and can be used for connection. - * @retval NRF_ERROR_NULL If p_peer_data is a NULL pointer. - * @retval NRF_ERROR_INVALID_DATA If peer data is not available or invalid. */ -uint32_t dfu_ble_peer_data_get(dfu_ble_peer_data_t * p_peer_data); +void nrf_bootloader_app_start(uint32_t start_addr); -#endif // DFU_BLE_SVC_INTERNAL_H__ +#endif // NRF_BOOTLOADER_APP_START_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.c new file mode 100644 index 0000000000..628e4e9f4e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_bootloader_info.h" + + +/** @brief This variable ensures that the linker script will write the bootloader start address + * to the UICR register. This value will be written in the HEX file and thus written to + * UICR when the bootloader is flashed into the chip. + */ +#if defined (__CC_ARM ) + #pragma push + #pragma diag_suppress 1296 + uint32_t m_uicr_bootloader_start_address __attribute__((at(NRF_UICR_BOOTLOADER_START_ADDRESS))) + = BOOTLOADER_START_ADDR; + #pragma pop +#elif defined ( __GNUC__ ) + volatile uint32_t m_uicr_bootloader_start_address __attribute__ ((section(".uicrBootStartAddress"))) + = BOOTLOADER_START_ADDR; +#elif defined ( __ICCARM__ ) + __root const uint32_t m_uicr_bootloader_start_address @ NRF_UICR_BOOTLOADER_START_ADDRESS + = BOOTLOADER_START_ADDR; +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.h new file mode 100644 index 0000000000..dd861fb12e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_bootloader_info Information + * @{ + * @ingroup sdk_bootloader + */ + +#ifndef NRF_BOOTLOADER_INFO_H__ +#define NRF_BOOTLOADER_INFO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "nrf.h" + +#ifdef SOFTDEVICE_PRESENT +#include "nrf_sdm.h" +#endif + +/** @brief External definitions of symbols for the start of the application image. + */ +#if (__LINT__ == 1) + // No implementation +#elif defined ( __CC_ARM ) + extern uint32_t* Image$$ER_IROM1$$Base __attribute__((used)); +#elif defined ( __GNUC__ ) + extern uint32_t * __isr_vector; +#elif defined ( __ICCARM__ ) + extern void * __vector_table; +#else + #error Not a valid compiler/linker for application image symbols. +#endif + + +/** @brief Macro for getting the start address of the application image. + * + * This macro is valid only when absolute placement is used for the application + * image. The macro is not a compile time symbol. It cannot be used as a + * constant expression, for example, inside a static assert or linker script + * at-placement. + */ +#if (__LINT__ == 1) + #define BOOTLOADER_START_ADDR (0x3AC00) +#elif BOOTLOADER_START_ADDR + // Bootloader start address is defined at project level +#elif defined (__CC_ARM) + #define BOOTLOADER_START_ADDR (uint32_t)&Image$$ER_IROM1$$Base +#elif defined (__GNUC__) + #define BOOTLOADER_START_ADDR (uint32_t)&__isr_vector +#elif defined (__ICCARM__) + #define BOOTLOADER_START_ADDR (uint32_t)&__vector_table +#else + #error Not a valid compiler/linker for BOOTLOADER_START_ADDR. +#endif + + +/** + * @brief Bootloader start address in UICR. + * + * Register location in UICR where the bootloader start address is stored. + * + * @note If the value at the given location is 0xFFFFFFFF, the bootloader address is not set. + */ +#define NRF_UICR_BOOTLOADER_START_ADDRESS (NRF_UICR_BASE + 0x14) + + +#ifndef MAIN_APPLICATION_START_ADDR + + +#ifdef SOFTDEVICE_PRESENT + +/** @brief Main application start address (if the project uses a SoftDevice). + * + * @note The start address is equal to the end address of the SoftDevice. + */ +#define MAIN_APPLICATION_START_ADDR (SD_SIZE_GET(MBR_SIZE)) + +#else + +/** @brief Main application start address if the project does not use a SoftDevice. + * + * @note The MBR is required for the @ref sdk_bootloader to function. + */ +#define MAIN_APPLICATION_START_ADDR (MBR_SIZE) + +#endif + +#endif // #ifndef MAIN_APPLICATION_START_ADDR + + +#ifdef __cplusplus +} +#endif + +#endif // #ifndef NRF_BOOTLOADER_INFO_H__ +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.c new file mode 100644 index 0000000000..43a80a07a0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_dfu.h" +#include "nrf_dfu_transport.h" +#include "nrf_dfu_utils.h" +#include "nrf_bootloader_app_start.h" +#include "nrf_dfu_settings.h" +#include "nrf_gpio.h" +#include "app_scheduler.h" +#include "app_timer_appsh.h" +#include "nrf_log.h" +#include "boards.h" +#include "nrf_bootloader_info.h" +#include "nrf_dfu_req_handler.h" + +#define SCHED_MAX_EVENT_DATA_SIZE MAX(APP_TIMER_SCHED_EVT_SIZE, 0) /**< Maximum size of scheduler events. */ + +#define SCHED_QUEUE_SIZE 20 /**< Maximum number of events in the scheduler queue. */ + +#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ +#define APP_TIMER_OP_QUEUE_SIZE 4 /**< Size of timer operation queues. */ + +// Weak function implementation + +/** @brief Weak implemenation of nrf_dfu_check_enter. + * + * @note This function must be overridden to enable entering DFU mode at will. + * Default behaviour is to enter DFU when BOOTLOADER_BUTTON is pressed. + */ +__WEAK bool nrf_dfu_enter_check(void) +{ + if (nrf_gpio_pin_read(BOOTLOADER_BUTTON) == 0) + { + return true; + } + + if (s_dfu_settings.enter_buttonless_dfu == 1) + { + s_dfu_settings.enter_buttonless_dfu = 0; + APP_ERROR_CHECK(nrf_dfu_settings_write(NULL)); + return true; + } + return false; +} + + +// Internal Functions + +/**@brief Function for initializing the timer handler module (app_timer). + */ +static void timers_init(void) +{ + // Initialize timer module, making it use the scheduler. + APP_TIMER_APPSH_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, true); +} + + +/** @brief Function for event scheduler initialization. + */ +static void scheduler_init(void) +{ + APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE); +} + + +static void wait_for_event() +{ + // Transport is waiting for event? + while(true) + { + // Can't be emptied like this because of lack of static variables + (void)sd_app_evt_wait(); + app_sched_execute(); + } +} + + +void nrf_dfu_wait() +{ + app_sched_execute(); + (void)sd_app_evt_wait(); +} + + +uint32_t nrf_dfu_init() +{ + uint32_t ret_val = NRF_SUCCESS; + uint32_t enter_bootloader_mode = 0; + + NRF_LOG_INFO("In real nrf_dfu_init\r\n"); + + nrf_dfu_settings_init(); + + // Continue ongoing DFU operations + // Note that this part does not rely on SoftDevice interaction + ret_val = nrf_dfu_continue(&enter_bootloader_mode); + if(ret_val != NRF_SUCCESS) + { + NRF_LOG_INFO("Could not continue DFU operation: 0x%08x\r\n", ret_val); + enter_bootloader_mode = 1; + } + + // Check if there is a reason to enter DFU mode + // besides the effect of the continuation + if (nrf_dfu_enter_check()) + { + NRF_LOG_INFO("Application sent bootloader request\n"); + enter_bootloader_mode = 1; + } + + if(enter_bootloader_mode != 0 || !nrf_dfu_app_is_valid()) + { + timers_init(); + scheduler_init(); + + // Initializing transports + ret_val = nrf_dfu_transports_init(); + if (ret_val != NRF_SUCCESS) + { + NRF_LOG_ERROR("Could not initalize DFU transport: 0x%08x\r\n", ret_val); + return ret_val; + } + + (void)nrf_dfu_req_handler_init(); + + // This function will never return + NRF_LOG_INFO("Waiting for events\r\n"); + wait_for_event(); + NRF_LOG_INFO("After waiting for events\r\n"); + } + + if (nrf_dfu_app_is_valid()) + { + NRF_LOG_INFO("Jumping to: 0x%08x\r\n", MAIN_APPLICATION_START_ADDR); + nrf_bootloader_app_start(MAIN_APPLICATION_START_ADDR); + } + + // Should not be reached! + NRF_LOG_INFO("After real nrf_dfu_init\r\n"); + return NRF_SUCCESS; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.h new file mode 100644 index 0000000000..eb3bc9134b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_nrf_dfu DFU bootloader + * @{ + * @ingroup sdk_nrf_bootloader + * @brief Bootloader with Device Firmware Update (DFU) functionality. + * + * The DFU bootloader module, in combination with the @ref sdk_bootloader module, + * can be used to implement a bootloader that supports Device Firmware Updates. + */ + + +#ifndef NRF_DFU_H__ +#define NRF_DFU_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define BOOTLOADER_BUTTON (BSP_BUTTON_3) /**< Button for entering DFU mode. */ + +/** @brief Function for initializing a DFU operation. + * + * This function initializes a DFU operation and any transports that are registered + * in the system. + * + * @retval NRF_SUCCESS If the DFU operation was successfully initialized. + */ +uint32_t nrf_dfu_init(void); + + +/** @brief Function for checking if DFU mode should be entered. + * + * This function checks whether DFU mode is required. + * + * @retval true If DFU mode must be entered. + * @retval false If there is no need to enter DFU mode. + */ +bool nrf_dfu_enter_check(void); + + +/** @brief Function for checking if DFU should be reset (failsafe). + * + * This function will check if DFU should be reset (failsafe). + * + * If this returns true, DFU mode will be entered and DFU will be reset. + * + * @retval true If DFU must be reset (failsafe). + * @retval false If there is no need to reset DFU. + */ +bool nrf_dfu_check_failsafe_reset(void); + + +/** @brief Function for blocking until an event (i.e. incoming BLE packet) arrives. + */ +void nrf_dfu_wait(void); + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DFU_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.c new file mode 100644 index 0000000000..22b13baa5f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.c @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_dfu_flash.h" +#include "nrf_dfu_types.h" +#include "softdevice_handler.h" +#include "nrf_nvmc.h" +#include "nrf_log.h" + +#ifdef SOFTDEVICE_PRESENT +// Only include fstorage if SD interaction is required +#include "fstorage.h" +#endif + +#define FLASH_FLAG_NONE (0) +#define FLASH_FLAG_OPER (1<<0) +#define FLASH_FLAG_FAILURE_SINCE_LAST (1<<1) +#define FLASH_FLAG_SD_ENABLED (1<<2) + +static uint32_t m_flags; + +#ifdef BLE_STACK_SUPPORT_REQD + +// Function prototypes +static void fs_evt_handler(fs_evt_t const * const evt, fs_ret_t result); + +FS_REGISTER_CFG(fs_config_t fs_dfu_config) = +{ + .callback = fs_evt_handler, // Function for event callbacks. + .p_start_addr = (uint32_t*)MBR_SIZE, + .p_end_addr = (uint32_t*)BOOTLOADER_SETTINGS_ADDRESS + CODE_PAGE_SIZE +}; + + +static void fs_evt_handler(fs_evt_t const * const evt, fs_ret_t result) +{ + // Clear the operation flag + m_flags &= ~FLASH_FLAG_OPER; + + if (result == FS_SUCCESS) + { + // Clear flag for ongoing operation and failure since last + m_flags &= ~FLASH_FLAG_FAILURE_SINCE_LAST; + } + else + { + NRF_LOG_ERROR("Generating failure\r\n"); + m_flags |= FLASH_FLAG_FAILURE_SINCE_LAST; + } + + if (evt->p_context) + { + //lint -e611 + ((dfu_flash_callback_t)evt->p_context)(evt, result); + } +} + +#endif + + +uint32_t nrf_dfu_flash_init(bool sd_enabled) +{ + uint32_t err_code = NRF_SUCCESS; + +#ifdef BLE_STACK_SUPPORT_REQD + // Only run this initialization if SD is enabled + if(sd_enabled) + { + NRF_LOG_INFO("------- nrf_dfu_flash_init-------\r\n"); + if (fs_fake_init() != FS_SUCCESS) + { + NRF_LOG_ERROR("Not initializing the thing\r\n"); + return NRF_ERROR_INVALID_STATE; + } + + // Enable access to the whole range + + + err_code = softdevice_sys_evt_handler_set(fs_sys_event_handler); + if (err_code != NRF_SUCCESS) + { + NRF_LOG_ERROR("Not initializing the thing 2\r\n"); + return NRF_ERROR_INVALID_STATE; + } + + // Setting flag to indicate that SD is enabled to ensure fstorage is use in calls + // to do flash operations. + m_flags = FLASH_FLAG_SD_ENABLED; + } + else +#endif + { + m_flags = FLASH_FLAG_NONE; + } + + return err_code; +} + + +fs_ret_t nrf_dfu_flash_store(uint32_t const * p_dest, uint32_t const * const p_src, uint32_t len_words, dfu_flash_callback_t callback) +{ + fs_ret_t ret_val = FS_SUCCESS; + +#ifdef BLE_STACK_SUPPORT_REQD + if ((m_flags & FLASH_FLAG_SD_ENABLED) != 0) + { + // Check if there is a pending error + if ((m_flags & FLASH_FLAG_FAILURE_SINCE_LAST) != 0) + { + NRF_LOG_ERROR("Flash: Failure since last\r\n"); + return FS_ERR_FAILURE_SINCE_LAST; + } + + // Set the flag to indicate ongoing operation + m_flags |= FLASH_FLAG_OPER; + //lint -e611 + ret_val = fs_store(&fs_dfu_config, p_dest, p_src, len_words, (void*)callback); + + if (ret_val != FS_SUCCESS) + { + NRF_LOG_ERROR("Flash: failed %d\r\n", ret_val); + return ret_val; + } + + // Set the flag to indicate ongoing operation + m_flags |= FLASH_FLAG_OPER; + } + else +#endif + { + +#ifndef NRF51 + if ((p_src == NULL) || (p_dest == NULL)) + { + return FS_ERR_NULL_ARG; + } + + // Check that both pointers are word aligned. + if (((uint32_t)p_src & 0x03) || + ((uint32_t)p_dest & 0x03)) + { + return FS_ERR_UNALIGNED_ADDR; + } + + if (len_words == 0) + { + NRF_LOG_ERROR("Flash: Invalid length (NVMC)\r\n"); + return FS_ERR_INVALID_ARG; + } +#endif + + nrf_nvmc_write_words((uint32_t)p_dest, p_src, len_words); + + #if (__LINT__ != 1) + if (callback) + { + fs_evt_t evt = + { + .id = FS_EVT_STORE, + .p_context = (void*)callback, + .store = + { + .length_words = len_words, + .p_data = p_dest + } + }; + callback(&evt, FS_SUCCESS); + } + #endif + } + + return ret_val; +} + + +/** @brief Internal function to initialize DFU BLE transport + */ +fs_ret_t nrf_dfu_flash_erase(uint32_t const * p_dest, uint32_t num_pages, dfu_flash_callback_t callback) +{ + fs_ret_t ret_val = FS_SUCCESS; + NRF_LOG_INFO("Erasing: 0x%08x, num: %d\r\n", (uint32_t)p_dest, num_pages); + +#ifdef BLE_STACK_SUPPORT_REQD + + if ((m_flags & FLASH_FLAG_SD_ENABLED) != 0) + { + // Check if there is a pending error + if ((m_flags & FLASH_FLAG_FAILURE_SINCE_LAST) != 0) + { + NRF_LOG_ERROR("Erase: Failure since last\r\n"); + return FS_ERR_FAILURE_SINCE_LAST; + } + + m_flags |= FLASH_FLAG_OPER; + ret_val = fs_erase(&fs_dfu_config, p_dest, num_pages, (void*)callback); + + if (ret_val != FS_SUCCESS) + { + NRF_LOG_ERROR("Erase failed: %d\r\n", ret_val); + m_flags &= ~FLASH_FLAG_OPER; + return ret_val; + } + + // Set the flag to indicate ongoing operation + m_flags |= FLASH_FLAG_OPER; + } + else +#endif + { +#ifndef NRF51 + // Softdevice is not present or activated. Run the NVMC instead + if (((uint32_t)p_dest & (CODE_PAGE_SIZE-1)) != 0) + { + NRF_LOG_ERROR("Invalid address\r\n"); + return FS_ERR_UNALIGNED_ADDR; + } +#endif + + uint16_t first_page = ((uint32_t)p_dest / CODE_PAGE_SIZE); + do + { + nrf_nvmc_page_erase((uint32_t)p_dest); + p_dest += CODE_PAGE_SIZE/sizeof(uint32_t); + } + while(--num_pages > 0); + + + if (callback) + { + #if (__LINT__ != 1) + fs_evt_t evt = + { + .id = FS_EVT_ERASE, + .p_context = (void*)callback, + .erase = + { + .first_page = first_page, + .last_page = ((uint32_t)p_dest / CODE_PAGE_SIZE) + } + }; + callback(&evt, FS_SUCCESS); + #else + (void)first_page; + #endif + } + } + + return ret_val; +} + + +void nrf_dfu_flash_error_clear(void) +{ + m_flags &= ~FLASH_FLAG_FAILURE_SINCE_LAST; +} + + +fs_ret_t nrf_dfu_flash_wait(void) +{ + NRF_LOG_INFO("Waiting for finished...\r\n"); + +#ifdef BLE_STACK_SUPPORT_REQD + if ((m_flags & FLASH_FLAG_SD_ENABLED) != 0) + { + while ((m_flags & FLASH_FLAG_OPER) != 0) + { + (void)sd_app_evt_wait(); + } + + if ((m_flags & FLASH_FLAG_FAILURE_SINCE_LAST) != 0) + { + NRF_LOG_ERROR("Failure since last\r\n"); + return FS_ERR_FAILURE_SINCE_LAST; + } + } +#endif + + NRF_LOG_INFO("After wait!\r\n"); + return FS_SUCCESS; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.h new file mode 100644 index 0000000000..725ff9258a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.h @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_nrf_dfu_flash Flash operations + * @{ + * @ingroup sdk_nrf_dfu + */ + +#ifndef NRF_DFU_FLASH_H__ +#define NRF_DFU_FLASH_H__ + +#include +#include +#include "fstorage.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/**@brief fstorage event handler function for DFU fstorage operations. + * + * This function is intended to be registered to the fstorage module as the event handler for all DFU flash operations. + * When each flash operation has completed or failed this function will be called. + * + * See ::fs_cb_t for implementation details. + */ +typedef fs_cb_t dfu_flash_callback_t; + +/**@brief Function for initializing the flash module. + * + * You can use this module with or without a SoftDevice: + * - If the module is initialized with the SoftDevice enabled flag set, the @ref fstorage + * module is used as back end for all flash operations. Flash storage calls + * are asynchronous; the SoftDevice manages when the actual operation in + * flash is done. + * - If the module is initialized with the SoftDevice enabled flag not set, + * the non-volatile memory controller (NVMC) driver handles the flash operations + * by directly accessing flash. These operations are synchronous. + * + * @param[in] sd_enabled Set the flash handling to run with or without the SoftDevice enabled. + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INVALID_STATE If the fstorage module could not be initiated or the SoftDevice could not set the event handler. + */ +uint32_t nrf_dfu_flash_init(bool sd_enabled); + + +/**@brief Function for storing data to flash (with or without the SoftDevice enabled). + * + * @warning The content to be stored must be kept at @p p_src until the operation is + * complete. Without SoftDevice, the operation is complete when the function + * returns. With SoftDevice, the operation is complete when the fstorage event is received. + * + * @param[in] p_dest Pointer to the address where the data should be stored. + * @param[in] p_src Pointer to the address where the data should be copied from. + * This address can be in flash or RAM. + * @param[in] len_words The number of words to be copied from @p p_src to @p p_dest. + * @param[in] callback Pointer to the callback function. + * + * @retval FS_SUCCESS If the operation was successful. + * @retval FS_ERR_FAILURE_SINCE_LAST If an error occurred in another transaction and fstorage cannot continue before + * the event has been dealt with. + * @retval FS_ERR_UNALIGNED_ADDR If @p p_src or @p p_dest is not word-aligned. Ensure that the address pointed to is divisible by four. + * @retval FS_ERR_INVALID_ARG If @p len_words is zero. It is not possible to write zero words. + * @retval FS_ERR_NULL_ARG If @p p_src or @p p_dest is NULL. + * + * @retval FS_ERR_NOT_INITIALIZED If the fstorage module is not initialized. + * @retval FS_ERR_INVALID_CFG If the initialization of the fstorage module is invalid. + * @retval FS_ERR_QUEUE_FULL If the internal operation queue of the fstorage module is full. + */ +fs_ret_t nrf_dfu_flash_store(uint32_t const * p_dest, uint32_t const * const p_src, uint32_t len_words, dfu_flash_callback_t callback); + + +/**@brief Function for erasing data from flash (with or without the SoftDevice enabled). + * + * @param[in] p_dest The address of the first byte to be deleted. + * @param[in] num_pages The number of flash pages to be deleted. + * @param[in] callback Pointer to the callback function. + * + * @retval FS_SUCCESS If the operation was successful. + * @retval FS_ERR_UNALIGNED_ADDR If @p p_dest is not aligned to a page boundary. + * @retval FS_ERR_INVALID_ADDR If @p p_dest does not point to the start of a flash page or the operation would + * go beyond the flash memory boundary. + * @retval FS_ERR_NOT_INITIALIZED If the fstorage module is not initialized. + * @retval FS_ERR_INVALID_CFG If the initialization of the fstorage module is invalid. + * @retval FS_ERR_NULL_ARG If @p p_dest is NULL. + * @retval FS_ERR_INVALID_ARG If @p num_pages is zero. + * @retval FS_ERR_QUEUE_FULL If the internal operation queue of the fstorage module is full. + */ +fs_ret_t nrf_dfu_flash_erase(uint32_t const * p_dest, uint32_t num_pages, dfu_flash_callback_t callback); + + +/**@brief Function for clearing an error that has occurred during fstorage operations. + */ +void nrf_dfu_flash_error_clear(void); + + +/**@brief Function for waiting for an event from fstorage. + * + * This function halts execution until an event is received from the SoftDevice. + * You can use this function to halt execution until a flash operation has completed, to prevent + * tampering with the source data until fstorage is done with it. + * + * @retval FS_SUCCESS If the operation was successful. + * @retval FS_ERR_FAILURE_SINCE_LAST If an error has occurred in another transaction and fstorage cannot continue before + * the event has been dealt with. + */ +fs_ret_t nrf_dfu_flash_wait(void); + + +#ifdef __cplusplus +} +#endif + + +#endif // NRF_DFU_FLASH_H__ +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.c new file mode 100644 index 0000000000..6871b8ac6c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.c @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_dfu_mbr.h" +#include "nrf_mbr.h" +#include "nrf_dfu_types.h" +#include "nrf_log.h" + +uint32_t nrf_dfu_mbr_copy_bl(uint32_t * p_src, uint32_t len) +{ + uint32_t ret_val; + uint32_t const len_words = len / sizeof(uint32_t); + + sd_mbr_command_t command = + { + .command = SD_MBR_COMMAND_COPY_BL, + .params.copy_bl.bl_src = p_src, + .params.copy_bl.bl_len = len_words + }; + + ret_val = sd_mbr_command(&command); + + return ret_val; +} + + +uint32_t nrf_dfu_mbr_copy_sd(uint32_t * p_dst, uint32_t * p_src, uint32_t len) +{ + uint32_t ret_val; + uint32_t const len_words = len / sizeof(uint32_t); + + if((len_words & (CODE_PAGE_SIZE / sizeof(uint32_t) - 1)) != 0) + return NRF_ERROR_INVALID_LENGTH; + + sd_mbr_command_t command = + { + .command = SD_MBR_COMMAND_COPY_SD, + .params.copy_sd.src = p_src, + .params.copy_sd.dst = p_dst, + .params.copy_sd.len = len_words + }; + + ret_val = sd_mbr_command(&command); + + return ret_val; +} + + +uint32_t nrf_dfu_mbr_init_sd(void) +{ + uint32_t ret_val; + + sd_mbr_command_t command = + { + .command = SD_MBR_COMMAND_INIT_SD + }; + + ret_val = sd_mbr_command(&command); + + return ret_val; +} + + +uint32_t nrf_dfu_mbr_compare(uint32_t * p_ptr1, uint32_t * p_ptr2, uint32_t len) +{ + uint32_t ret_val; + uint32_t const len_words = len / sizeof(uint32_t); + + sd_mbr_command_t command = + { + .command = SD_MBR_COMMAND_COMPARE, + .params.compare.ptr1 = p_ptr1, + .params.compare.ptr2 = p_ptr2, + .params.compare.len = len_words + }; + + ret_val = sd_mbr_command(&command); + + return ret_val; +} + + +uint32_t nrf_dfu_mbr_vector_table_set(uint32_t address) +{ + uint32_t ret_val; + + NRF_LOG_INFO("running vector table set\r\n"); + sd_mbr_command_t command = + { + .command = SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, + .params.base_set.address = address + }; + + ret_val = sd_mbr_command(&command); + NRF_LOG_INFO("After running vector table set\r\n"); + + return ret_val; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.h new file mode 100644 index 0000000000..0d99e14e7d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_nrf_dfu_mbr MBR functions + * @{ + * @ingroup sdk_nrf_dfu + */ + +#ifndef NRF_DFU_MBR_H__ +#define NRF_DFU_MBR_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief Function for copying the bootloader using an MBR command. + * + * @param[in] p_src Source address of the bootloader data to copy. + * @param[in] len Length of the data to copy in bytes. + * + * @return This function will return only if the command request could not be run. + * See @ref sd_mbr_command_copy_bl_t for possible return values. + */ +uint32_t nrf_dfu_mbr_copy_bl(uint32_t * p_src, uint32_t len); + + +/** @brief Function for copying the SoftDevice using an MBR command. + * + * @param[in] p_dst Target of the SoftDevice copy. + * @param[in] p_src Source address of the SoftDevice image to copy. + * @param[in] len Length of the data to copy in bytes. + * + * @retval NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly. + * @retval NRF_ERROR_INVALID_LENGTH Invalid len + * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). + * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. + * @retval NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. + */ +uint32_t nrf_dfu_mbr_copy_sd(uint32_t * p_dst, uint32_t * p_src, uint32_t len); + + +/** @brief Function for initializing the SoftDevice using an MBR command. + * + * @retval NRF_SUCCESS If the SoftDevice was copied successfully. + * Any other return value indicates that the SoftDevice + * could not be copied. + */ +uint32_t nrf_dfu_mbr_init_sd(void); + + +/** @brief Function for comparing source and target using an MBR command. + * + * @param[in] p_ptr1 First pointer to data to compare. + * @param[in] p_ptr2 Second pointer to data to compare. + * @param[in] len Length of the data to compare in bytes. + * + * @retval NRF_SUCCESS If the content of both memory blocks is equal. + * @retval NRF_ERROR_NULL If the content of the memory blocks differs. + */ +uint32_t nrf_dfu_mbr_compare(uint32_t * p_ptr1, uint32_t * p_ptr2, uint32_t len); + + +/** @brief Function for setting the address of the vector table using an MBR command. + * + * @param[in] address Address of the new vector table. + * + * @retval NRF_SUCCESS If the address of the new vector table was set. Any other + * return value indicates that the address could not be set. + */ +uint32_t nrf_dfu_mbr_vector_table_set(uint32_t address); + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DFU_MBR_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_req_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_req_handler.h new file mode 100644 index 0000000000..b06bdb88bf --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_req_handler.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_nrf_dfu_req_handler Request handling + * @{ + * @ingroup sdk_nrf_dfu + */ + +#ifndef NRF_DFU_REQ_HANDLER_H__ +#define NRF_DFU_REQ_HANDLER_H__ + +#include +#include +#include "nrf_dfu_types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**@brief DFU object types. + */ +typedef enum +{ + NRF_DFU_OBJ_TYPE_INVALID, /**< Invalid object type.*/ + NRF_DFU_OBJ_TYPE_COMMAND, /**< Command object packet.*/ + NRF_DFU_OBJ_TYPE_DATA, /**< Data object.*/ +} nrf_dfu_obj_type_t; + + +/**@brief DFU request operation codes. + * + * @details The DFU transport layer creates request events of these types. The implementation of @ref nrf_dfu_req_handler_on_req handles requests of these types. + */ +typedef enum +{ + + NRF_DFU_OBJECT_OP_NONE = 0, /**< No operation set. */ + NRF_DFU_OBJECT_OP_CREATE = 1, /**< Create operation. The length of the request indicates the required size. When called, the created object is selected. */ + NRF_DFU_OBJECT_OP_WRITE = 2, /**< Write operation. When called, offset and CRC of the selected object are reported back. */ + NRF_DFU_OBJECT_OP_EXECUTE = 3, /**< Execute operation. When called, the selected object is executed. */ + NRF_DFU_OBJECT_OP_CRC = 4, /**< Calculate checksum operation. When called, offset and CRC of the selected object are reported back. */ + NRF_DFU_OBJECT_OP_SELECT = 6, /**< Select operation. When called, the object of the given type is selected, and information about the object is reported back. */ + NRF_DFU_OBJECT_OP_OTHER = 7, /**< A user-defined DFU request type. The application must define how to interpret the request. */ +} nrf_dfu_req_op_t; + + +/**@brief DFU request result codes. + * + * @details The DFU transport layer creates request events of types @ref nrf_dfu_req_op_t, + * which are handled by @ref nrf_dfu_req_handler_on_req. That functions returns one of these result codes. + */ +typedef enum +{ + NRF_DFU_RES_CODE_INVALID = 0x00, /**< Invalid opcode. */ + NRF_DFU_RES_CODE_SUCCESS = 0x01, /**< Operation successful. */ + NRF_DFU_RES_CODE_OP_CODE_NOT_SUPPORTED = 0x02, /**< Opcode not supported. */ + NRF_DFU_RES_CODE_INVALID_PARAMETER = 0x03, /**< Missing or invalid parameter value. */ + NRF_DFU_RES_CODE_INSUFFICIENT_RESOURCES = 0x04, /**< Not enough memory for the data object. */ + NRF_DFU_RES_CODE_INVALID_OBJECT = 0x05, /**< Data object does not match the firmware and hardware requirements, the signature is missing, or parsing the command failed. */ + NRF_DFU_RES_CODE_UNSUPPORTED_TYPE = 0x07, /**< Not a valid object type for a Create request. */ + NRF_DFU_RES_CODE_OPERATION_NOT_PERMITTED = 0x08, /**< The state of the DFU process does not allow this operation. */ + NRF_DFU_RES_CODE_OPERATION_FAILED = 0x0A, /**< Operation failed. */ + NRF_DFU_RES_CODE_EXT_ERROR = 0x0B, /**< Extended error. */ +} nrf_dfu_res_code_t; + + +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__ICCARM__) + #pragma language=extended +#elif defined(__GNUC__) + // Anonymous unions are enabled by default. +#endif + + +/** @brief Definition of a DFU request sent from the transport layer. + * + * @details When the transport layer gets a DFU event, it calls the function @ref nrf_dfu_req_handler_on_req to handle the DFU request. + */ +typedef struct +{ + nrf_dfu_req_op_t req_type; /**< Request operation type. */ + + union + { + struct + { + uint32_t obj_type; /**< Object type of the object to be created for a request of type @ref NRF_DFU_OBJECT_OP_CREATE. */ + uint32_t object_size; /**< Size of the object to be created for a request of type @ref NRF_DFU_OBJECT_OP_CREATE. Note that the object size is not the same as the size of the firmware. */ + }; + + struct + { + uint8_t * p_req; /**< Pointer to an array holding the serialized version of the request. */ + uint32_t req_len; /**< Length of the request array. */ + }; + }; +} nrf_dfu_req_t; + + +/** @brief Response used during DFU operations. + */ +typedef struct +{ + union + { + struct + { + uint8_t * p_res; /**< Pointer to an array holding the serialized version of the response. */ + uint32_t res_len; /**< Length of the response array. */ + }; + + struct + { + uint32_t max_size; /**< Maximum size of the object of a given type. */ + uint32_t offset; /**< Current offset. */ + uint32_t crc; /**< Current CRC. */ + }; + }; +} nrf_dfu_res_t; + +#if defined(__CC_ARM) + #pragma pop +#elif defined(__ICCARM__) + // Leave anonymous unions enabled. +#elif defined(__GNUC__) + // Anonymous unions are enabled by default. +#endif + + +/** @brief Function for initializing the request handling module. + * + * @details This function initializes the flash with or without the SoftDevice, depending on the project configuration. + * + * @retval NRF_SUCCESS If the operation was successful. + * @retval NRF_ERROR_INVALID_STATE If the fstorage module could not be initiated or the SoftDevice could not set the event handler. + */ +uint32_t nrf_dfu_req_handler_init(void); + + +/** @brief Function type for handling a DFU request. + * + * @param[in,out] p_context Pointer to context-specific RAM required for + * running the command request. + * This value may be NULL if the command request + * does not require context-specific RAM. + * @param[in,out] p_req Pointer to the structure holding the DFU request. + * @param[in,out] p_res Pointer to the structure holding the DFU response. + * + * @retval NRF_DFU_RES_CODE_SUCCESS If the command request was executed successfully. + * Any other error code indicates that the request + * could not be handled. + */ +nrf_dfu_res_code_t nrf_dfu_req_handler_on_req(void * p_context, nrf_dfu_req_t * p_req, nrf_dfu_res_t * p_res); + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DFU_REQ_HANDLER_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.c new file mode 100644 index 0000000000..f5661ebdfb --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.c @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_dfu_settings.h" +#include "nrf_dfu_flash.h" +#include "nrf_log.h" +#include "crc32.h" +#include +#include "app_scheduler.h" +#include "nrf_delay.h" + +/** @brief This variable reserves a codepage for bootloader specific settings, + * to ensure the compiler doesn't locate any code or variables at his location. + */ +#if defined (__CC_ARM ) + + uint8_t m_dfu_settings_buffer[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) + __attribute__((used)); + +#elif defined ( __GNUC__ ) + + uint8_t m_dfu_settings_buffer[CODE_PAGE_SIZE] __attribute__ ((section(".bootloaderSettings"))) + __attribute__((used)); + +#elif defined ( __ICCARM__ ) + + __no_init __root uint8_t m_dfu_settings_buffer[CODE_PAGE_SIZE] @ BOOTLOADER_SETTINGS_ADDRESS; + +#else + + #error Not a valid compiler/linker for m_dfu_settings placement. + +#endif // Compiler specific + +#ifndef BL_SETTINGS_ACCESS_ONLY +#if defined( NRF52_SERIES ) + +/**@brief This variable reserves a codepage for mbr parameters, to ensure the compiler doesn't + * locate any code or variables at his location. + */ +#if defined ( __CC_ARM ) + + uint8_t m_mbr_params_page[CODE_PAGE_SIZE] __attribute__((at(NRF_MBR_PARAMS_PAGE_ADDRESS))) __attribute__((used)); + +#elif defined ( __GNUC__ ) + + uint8_t m_mbr_params_page[CODE_PAGE_SIZE] __attribute__ ((section(".mbrParamsPage"))); + +#elif defined ( __ICCARM__ ) + + __no_init uint8_t m_mbr_params_page[CODE_PAGE_SIZE] @ NRF_MBR_PARAMS_PAGE_ADDRESS; + +#else + + #error Not a valid compiler/linker for m_mbr_params_page placement. + +#endif // Compiler specific + + +/**@brief This variable makes the linker script write the mbr parameters page address to the + * UICR register. This value will be written in the HEX file and thus written to the + * UICR when the bootloader is flashed into the chip. + */ +#if defined ( __CC_ARM ) + uint32_t m_uicr_mbr_params_page_address __attribute__((at(NRF_UICR_MBR_PARAMS_PAGE_ADDRESS))) + = NRF_MBR_PARAMS_PAGE_ADDRESS; + +#elif defined ( __GNUC__ ) + volatile uint32_t m_uicr_mbr_params_page_address __attribute__ ((section(".uicrMbrParamsPageAddress"))) + = NRF_MBR_PARAMS_PAGE_ADDRESS; +#elif defined ( __ICCARM__ ) + + __root const uint32_t m_uicr_mbr_params_page_address @ NRF_UICR_MBR_PARAMS_PAGE_ADDRESS + = NRF_MBR_PARAMS_PAGE_ADDRESS; + +#else + + #error Not a valid compiler/linker for m_mbr_params_page placement. + +#endif // Compiler specific + +#endif // #if defined( NRF52_SERIES ) + +#endif // #ifndef BL_SETTINGS_ACCESS_ONLY + +nrf_dfu_settings_t s_dfu_settings; + +//lint -save -esym(551, flash_operation_pending) +static bool flash_operation_pending; // barrier for reading flash +//lint -restore + +static dfu_flash_callback_t m_callback; + + +static void dfu_settings_write_callback(fs_evt_t const * const evt, fs_ret_t result) +{ + if (result == FS_SUCCESS) + { + flash_operation_pending = false; + } + if (m_callback != NULL) + { + m_callback(evt, result); + } +} + +static void delay_operation(void) +{ + nrf_delay_ms(100); + app_sched_execute(); +} + +static void wait_for_pending(void) +{ + while (flash_operation_pending == true) + { + NRF_LOG_INFO("Waiting for other flash operation to finish.\r\n"); + delay_operation(); + } +} + +static void wait_for_queue(void) +{ + while (fs_queue_is_full()) + { + NRF_LOG_INFO("Waiting for available space on flash queue.\r\n"); + delay_operation(); + } +} + + +uint32_t nrf_dfu_settings_calculate_crc(void) +{ + // the crc is calculated from the s_dfu_settings struct, except the crc itself and the init command + return crc32_compute((uint8_t*)&s_dfu_settings + 4, sizeof(nrf_dfu_settings_t) - 4 - sizeof(s_dfu_settings.init_command), NULL); +} + + +void nrf_dfu_settings_init(void) +{ + NRF_LOG_INFO("running nrf_dfu_settings_init\r\n"); + + uint32_t crc; + + flash_operation_pending = false; + + // Copy the DFU settings out of flash and into a buffer in RAM. + memcpy((void*)&s_dfu_settings, &m_dfu_settings_buffer[0], sizeof(nrf_dfu_settings_t)); + + if(s_dfu_settings.crc != 0xFFFFFFFF) + { + // CRC is set. Content must be valid + crc = nrf_dfu_settings_calculate_crc(); + if(crc == s_dfu_settings.crc) + { + return; + } + } + + // Reached if nothing is configured or if CRC was wrong + NRF_LOG_INFO("!!!!!!!!!!!!!!! Resetting bootloader settings !!!!!!!!!!!\r\n"); + memset(&s_dfu_settings, 0x00, sizeof(nrf_dfu_settings_t)); + s_dfu_settings.settings_version = NRF_DFU_SETTINGS_VERSION; + APP_ERROR_CHECK(nrf_dfu_settings_write(NULL)); +} + + +ret_code_t nrf_dfu_settings_write(dfu_flash_callback_t callback) +{ + ret_code_t err_code = FS_SUCCESS; + NRF_LOG_INFO("Erasing old settings at: 0x%08x\r\n", (uint32_t)&m_dfu_settings_buffer[0]); + + // Wait for any ongoing operation (because of multiple calls to nrf_dfu_settings_write) + wait_for_pending(); + + flash_operation_pending = true; + m_callback = callback; + + do + { + wait_for_queue(); + + // Not setting the callback function because ERASE is required before STORE + // Only report completion on successful STORE. + err_code = nrf_dfu_flash_erase((uint32_t*)&m_dfu_settings_buffer[0], 1, NULL); + + } while (err_code == FS_ERR_QUEUE_FULL); + + + if (err_code != FS_SUCCESS) + { + NRF_LOG_ERROR("Erasing from flash memory failed.\r\n"); + flash_operation_pending = false; + return NRF_ERROR_INTERNAL; + } + + s_dfu_settings.crc = nrf_dfu_settings_calculate_crc(); + + NRF_LOG_INFO("Writing 0x%08x words\r\n", sizeof(nrf_dfu_settings_t)/4); + + static nrf_dfu_settings_t temp_dfu_settings; + memcpy(&temp_dfu_settings, &s_dfu_settings, sizeof(nrf_dfu_settings_t)); + + do + { + wait_for_queue(); + + err_code = nrf_dfu_flash_store((uint32_t*)&m_dfu_settings_buffer[0], + (uint32_t*)&temp_dfu_settings, + sizeof(nrf_dfu_settings_t)/4, + dfu_settings_write_callback); + + } while (err_code == FS_ERR_QUEUE_FULL); + + if (err_code != FS_SUCCESS) + { + NRF_LOG_ERROR("Storing to flash memory failed.\r\n"); + flash_operation_pending = false; + return NRF_ERROR_INTERNAL; + } + + NRF_LOG_INFO("Writing settings...\r\n"); + return NRF_SUCCESS; +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.h similarity index 67% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.h index a1d3f4e47d..da9f1fb1f3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_util.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,30 +36,52 @@ * */ - /**@file * - * @defgroup nrf_bootloader_util Bootloader util API. - * @{ - * - * @brief Bootloader util module interface. + * @defgroup nrf_dfu_settings DFU settings + * @{ + * @ingroup sdk_nrf_dfu */ - -#ifndef BOOTLOADER_UTIL_H__ -#define BOOTLOADER_UTIL_H__ + +#ifndef NRF_DFU_SETTINGS_H__ +#define NRF_DFU_SETTINGS_H__ #include -#include "bootloader_types.h" +#include "app_util_platform.h" +#include "nrf_dfu_types.h" +#include "nrf_dfu_flash.h" -/**@brief Function for starting the application (or bootloader) at the provided address. - * - * @param[in] start_addr Start address. +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Global DFU settings. + * + * @note Using this variable is not thread-safe. * - * @note This function will never retrun. Instead it will reset into the application of the - * provided address. */ -void bootloader_util_app_start(uint32_t start_addr); +extern nrf_dfu_settings_t s_dfu_settings; -#endif // BOOTLOADER_UTIL_H__ + +/** @brief Function for writing DFU settings to flash. + * + * @param[in] callback Pointer to a function that is called after completing the write operation. + * + * @retval NRF_SUCCESS If the write process was successfully initiated. + * @retval NRF_ERROR_INTERNAL If a flash error occurred. + */ +ret_code_t nrf_dfu_settings_write(dfu_flash_callback_t callback); + + +/** @brief Function for initializing the DFU settings module. + */ +void nrf_dfu_settings_init(void); + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DFU_SETTINGS_H__ /**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.c new file mode 100644 index 0000000000..b7be18694b --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_dfu_transport.h" +#include "nrf_log.h" + + +#define DFU_TRANS_SECTION_VARS_GET(i) NRF_SECTION_VARS_GET((i), nrf_dfu_transport_t, dfu_trans) +#define DFU_TRANS_SECTION_VARS_COUNT NRF_SECTION_VARS_COUNT(nrf_dfu_transport_t, dfu_trans) + + //lint -save -e19 -e526 +NRF_SECTION_VARS_CREATE_SECTION(dfu_trans, const nrf_dfu_transport_t); +//lint -restore + +uint32_t nrf_dfu_transports_init(void) +{ + uint32_t const num_transports = DFU_TRANS_SECTION_VARS_COUNT; + uint32_t ret_val = NRF_SUCCESS; + + NRF_LOG_INFO("In nrf_dfu_transports_init\r\n"); + + NRF_LOG_INFO("num transports: %d\r\n", num_transports); + + for (uint32_t i = 0; i < num_transports; i++) + { + nrf_dfu_transport_t * const trans = DFU_TRANS_SECTION_VARS_GET(i); + ret_val = trans->init_func(); + if (ret_val != NRF_SUCCESS) + { + break; + } + } + + NRF_LOG_INFO("After nrf_dfu_transports_init\r\n"); + + return ret_val; +} + + +uint32_t nrf_dfu_transports_close(void) +{ + uint32_t const num_transports = DFU_TRANS_SECTION_VARS_COUNT; + uint32_t ret_val = NRF_SUCCESS; + + NRF_LOG_INFO("In nrf_dfu_transports_close\r\n"); + + NRF_LOG_INFO("num transports: %d\r\n", num_transports); + + for (uint32_t i = 0; i < num_transports; i++) + { + nrf_dfu_transport_t * const trans = DFU_TRANS_SECTION_VARS_GET(i); + ret_val = trans->close_func(); + if (ret_val != NRF_SUCCESS) + { + break; + } + } + + NRF_LOG_INFO("After nrf_dfu_transports_init\r\n"); + + return ret_val; +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.h new file mode 100644 index 0000000000..b1a12a8cf6 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_nrf_dfu_transport DFU transport + * @{ + * @ingroup sdk_nrf_bootloader + * @brief Generic Device Firmware Update (DFU) transport interface. + * + * @details The DFU transport module defines a generic interface that must + * be implemented for each transport layer. + */ + +#ifndef NRF_DFU_TRANSPORT_H__ +#define NRF_DFU_TRANSPORT_H__ + +#include +#include "section_vars.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** @brief Function type for initializing a DFU transport. + * + * @details This function initializes a DFU transport. The implementation + * of the function must initialize DFU mode and stay in service + * until either the device is reset or the DFU operation is finalized. + * When the DFU transport receives requests, it should call @ref nrf_dfu_req_handler_on_req for handling the requests. + * + * @retval NRF_SUCCESS If initialization was successful for the transport. Any other return code indicates that the DFU transport could not be initialized. + */ +typedef uint32_t (*nrf_dfu_init_fn_t)(void); + + +/** @brief Function type for closing down a DFU transport. + * + * @details This function closes down a DFU transport in a gentle way. + * + * @retval NRF_SUCCESS If closing was successful for the transport. Any other return code indicates that the DFU transport could not be closed closed down. + */ +typedef uint32_t (*nrf_dfu_disconnect_fn_t)(void); + + +/** @brief DFU transport registration. + * + * @details Every DFU transport must provide a registration of the initialization function. + */ +typedef struct +{ + nrf_dfu_init_fn_t init_func; /**< Registration of the init function to run to initialize a DFU transport. */ + nrf_dfu_disconnect_fn_t close_func; /**< Registration of the close function to close down a DFU transport. */ +} nrf_dfu_transport_t; + + +/** @brief Function for initializing all the registered DFU transports. + * + * @retval NRF_SUCCESS If all DFU transport were initialized successfully. + * Any other error code indicates that at least one DFU + * transport could not be initialized. + */ +uint32_t nrf_dfu_transports_init(void); + +/** @brief Function for closing down all the registered DFU transports. + * + * @retval NRF_SUCCESS If all DFU transport were closed down successfully. + * Any other error code indicates that at least one DFU + * transport could not be closed down. + */ +uint32_t nrf_dfu_transports_close(void); + + +/** @brief Macro for registering a DFU transport by using section variables. + * + * @details This macro places a variable in a section named "dfu_trans", which + * is initialized by @ref nrf_dfu_transports_init. + */ +#define DFU_TRANSPORT_REGISTER(trans_var) NRF_SECTION_VARS_REGISTER_VAR(dfu_trans, trans_var) + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DFU_TRANSPORT_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_types.h new file mode 100644 index 0000000000..f21f787ce1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_types.h @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_nrf_dfu_types DFU types + * @{ + * @ingroup sdk_nrf_dfu + */ + +#ifndef NRF_DFU_TYPES_H__ +#define NRF_DFU_TYPES_H__ + +#include +#include +#include "nrf_mbr.h" +#include "nrf_sdm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define INIT_COMMAND_MAX_SIZE 256 /**< Maximum size of the init command stored in dfu_settings. */ + + +/** @brief Size of a flash codepage. This value is used for calculating the size of the reserved + * flash space in the bootloader region. It is checked against NRF_UICR->CODEPAGESIZE + * at run time to ensure that the region is correct. + */ +#if defined(NRF51) + #define CODE_PAGE_SIZE (PAGE_SIZE_IN_WORDS * sizeof(uint32_t)) +#elif defined(NRF52) || defined(NRF52840_XXAA) + #define CODE_PAGE_SIZE (MBR_PAGE_SIZE_IN_WORDS * sizeof(uint32_t)) +#else + #error "Architecture not set." +#endif + + +/** @brief Maximum size of a data object.*/ +#if defined( NRF51 ) + #define DATA_OBJECT_MAX_SIZE (CODE_PAGE_SIZE * 4) +#elif defined( NRF52_SERIES ) || defined ( __SDK_DOXYGEN__ ) + #define DATA_OBJECT_MAX_SIZE (CODE_PAGE_SIZE) +#else + #error "Architecture not set." +#endif + +/** @brief Page location of the bootloader settings address. + */ + +#if defined ( NRF51 ) + #define BOOTLOADER_SETTINGS_ADDRESS (0x0003FC00UL) +#elif defined( NRF52832_XXAA ) + #define BOOTLOADER_SETTINGS_ADDRESS (0x0007F000UL) +#elif defined( NRF52840_XXAA ) + #define BOOTLOADER_SETTINGS_ADDRESS (0x000FF000UL) +#else + #error No valid target set for BOOTLOADER_SETTINGS_ADDRESS. +#endif + + + +#if defined(NRF52) || defined(NRF52832) + +/** + * @brief MBR parameters page in UICR. + * + * Register location in UICR where the page address of the MBR parameters page is stored (only used by the nRF52 MBR). + * + * @note If the value at the given location is 0xFFFFFFFF, no MBR parameters page is set. + */ +#define NRF_UICR_MBR_PARAMS_PAGE_ADDRESS (NRF_UICR_BASE + 0x18) + + +/** @brief Page location of the MBR parameters page address. + * + */ +#define NRF_MBR_PARAMS_PAGE_ADDRESS (0x0007E000UL) + +#endif + +#if defined(NRF52840_XXAA) + +/** + * @brief MBR parameters page in UICR. + * + * Register location in UICR where the page address of the MBR parameters page is stored (only used by the nRF52 MBR). + * + * @note If the value at the given location is 0xFFFFFFFF, no MBR parameters page is set. + */ +#define NRF_UICR_MBR_PARAMS_PAGE_ADDRESS (NRF_UICR_BASE + 0x18) + + +/** @brief Page location of the MBR parameters page address. + * + */ +#define NRF_MBR_PARAMS_PAGE_ADDRESS (0x000FE000UL) + +#endif + + +/** @brief Size of the flash space reserved for application data. + */ +#ifndef DFU_APP_DATA_RESERVED +#define DFU_APP_DATA_RESERVED CODE_PAGE_SIZE * 3 +#endif + + +/** @brief Total size of the region between the SoftDevice and the bootloader. + */ +#define DFU_REGION_TOTAL_SIZE ((* (uint32_t *)NRF_UICR_BOOTLOADER_START_ADDRESS) - CODE_REGION_1_START) + + +/** @brief Start address of the SoftDevice (excluding the area for the MBR). + */ +#define SOFTDEVICE_REGION_START MBR_SIZE + + +/** @brief Size of the Code Region 0, found in the UICR.CLEN0 register. + * + * @details This value is identical to the start of Code Region 1. This value is used for + * compilation safety, because the linker will fail if the application expands + * into the bootloader. At run time, the bootloader uses the value found in UICR.CLEN0. + */ + +#ifndef CODE_REGION_1_START +#define CODE_REGION_1_START SD_SIZE_GET(MBR_SIZE) +#endif + +#define NRF_DFU_CURRENT_BANK_0 0x00 +#define NRF_DFU_CURRENT_BANK_1 0x01 + +#define NRF_DFU_BANK_LAYOUT_DUAL 0x00 +#define NRF_DFU_BANK_LAYOUT_SINGLE 0x01 + + +/** @brief DFU bank state codes. + * + * @details The DFU bank state indicates the content of a bank: + * A valid image of a certain type or an invalid image. + */ + +#define NRF_DFU_BANK_INVALID 0x00 /**< Invalid image. */ +#define NRF_DFU_BANK_VALID_APP 0x01 /**< Valid application. */ +#define NRF_DFU_BANK_VALID_SD 0xA5 /**< Valid SoftDevice. */ +#define NRF_DFU_BANK_VALID_BL 0xAA /**< Valid bootloader. */ +#define NRF_DFU_BANK_VALID_SD_BL 0xAC /**< Valid SoftDevice and bootloader. */ + + +/** @brief Description of a single bank. */ +#pragma pack(4) +typedef struct +{ + uint32_t image_size; /**< Size of the image in the bank. */ + uint32_t image_crc; /**< CRC of the image. If set to 0, the CRC is ignored. */ + uint32_t bank_code; /**< Identifier code for the bank. */ +} nrf_dfu_bank_t; + +/**@brief DFU progress. + * + * Be aware of the difference between objects and firmware images. A firmware image consists of multiple objects, each of a maximum size @ref DATA_OBJECT_MAX_SIZE. + */ +typedef struct +{ + uint32_t command_size; /**< The size of the current init command stored in the DFU settings. */ + uint32_t command_offset; /**< The offset of the currently received init command data. The offset will increase as the init command is received. */ + uint32_t command_crc; /**< The calculated CRC of the init command (calculated after the transfer is completed). */ + + uint32_t data_object_size; /**< The size of the last object created. Note that this size is not the size of the whole firmware image.*/ + + uint32_t firmware_image_crc; /**< CRC value of the current firmware (continuously calculated as data is received). */ + uint32_t firmware_image_crc_last; /**< The CRC of the last executed object. */ + uint32_t firmware_image_offset; /**< The offset of the current firmware image being transferred. Note that this offset is the offset in the entire firmware image and not only the current object. */ + uint32_t firmware_image_offset_last;/**< The offset of the last executed object from the start of the firmware image. */ +} dfu_progress_t; + + +/**@brief DFU settings for application and bank data. + */ +typedef struct +{ + uint32_t crc; /**< CRC for the stored DFU settings, not including the CRC itself. If 0xFFFFFFF, the CRC has never been calculated. */ + uint32_t settings_version; /**< Version of the currect dfu settings struct layout.*/ + uint32_t app_version; /**< Version of the last stored application. */ + uint32_t bootloader_version; /**< Version of the last stored bootloader. */ + + uint32_t bank_layout; /**< Bank layout: single bank or dual bank. This value can change. */ + uint32_t bank_current; /**< The bank that is currently used. */ + + nrf_dfu_bank_t bank_0; /**< Bank 0. */ + nrf_dfu_bank_t bank_1; /**< Bank 1. */ + + uint32_t write_offset; /**< Write offset for the current operation. */ + uint32_t sd_size; /**< SoftDevice size (if combined BL and SD). */ + + dfu_progress_t progress; /**< Current DFU progress. */ + + uint32_t enter_buttonless_dfu; + uint8_t init_command[INIT_COMMAND_MAX_SIZE]; /**< Buffer for storing the init command. */ +} nrf_dfu_settings_t; +#pragma pack() // revert pack settings + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DFU_TYPES_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.c new file mode 100644 index 0000000000..8892391567 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.c @@ -0,0 +1,572 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "nrf_dfu_utils.h" + +#include +#include "nrf_dfu_settings.h" +#include "nrf_dfu_mbr.h" +#include "nrf_bootloader_app_start.h" +#include "nrf_bootloader_info.h" +#include "crc32.h" +#include "nrf_log.h" + + +static uint32_t align_to_page(uint32_t val, uint32_t page_size) +{ + return ((val + page_size - 1 ) &~ (page_size - 1)); +} + + +static void nrf_dfu_invalidate_bank(nrf_dfu_bank_t * p_bank) +{ + // Set the bank-code to invalid, and reset size/CRC + memset(p_bank, 0, sizeof(nrf_dfu_bank_t)); + + // Reset write pointer after completed operation + s_dfu_settings.write_offset = 0; + + // Reset SD size + s_dfu_settings.sd_size = 0; + + // Promote dual bank layout + s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_DUAL; + + // Signify that bank 0 is empty + s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_0; +} + + +/** @brief Function to continue App update + * + * @details This function will be called after reset if there is a valid application in Bank1 + * required to be copied down to bank0. + * + * @param[in] src_addr Source address of the application to copy from Bank1 to Bank0. + * + * @retval NRF_SUCCESS Continuation was successful. + * @retval NRF_ERROR_NULL Invalid data during compare. + * @retval FS_ERR_UNALIGNED_ADDR A call to fstorage was not aligned to a page boundary or the address was not word aliged. + * @retval FS_ERR_INVALID_ADDR The destination of a call to fstorage does not point to + * the start of a flash page or the operation would + * go beyond the flash memory boundary. + * @retval FS_ERR_NOT_INITIALIZED The fstorage module is not initialized. + * @retval FS_ERR_INVALID_CFG The initialization of the fstorage module is invalid. + * @retval FS_ERR_NULL_ARG A call to fstorage had an invalid NULL argument. + * @retval FS_ERR_INVALID_ARG A call to fstorage had invalid arguments. + * @retval FS_ERR_QUEUE_FULL If the internal operation queue of the fstorage module is full. + * @retval FS_ERR_FAILURE_SINCE_LAST If an error occurred in another transaction and fstorage cannot continue before + * the event has been dealt with. + */ +static uint32_t nrf_dfu_app_continue(uint32_t src_addr) +{ + // This function only in use when new app is present in bank 1 + uint32_t const image_size = s_dfu_settings.bank_1.image_size; + uint32_t const split_size = CODE_PAGE_SIZE; // Arbitrary number that must be page aligned + + uint32_t ret_val = NRF_SUCCESS; + uint32_t target_addr = MAIN_APPLICATION_START_ADDR + s_dfu_settings.write_offset; + uint32_t length_left = (image_size - s_dfu_settings.write_offset); + uint32_t cur_len; + uint32_t crc; + + NRF_LOG_INFO("Enter nrf_dfu_app_continue\r\n"); + + // Copy the application down safely + do + { + cur_len = (length_left > split_size) ? split_size : length_left; + + // Erase the target page + ret_val = nrf_dfu_flash_erase((uint32_t*) target_addr, split_size / CODE_PAGE_SIZE, NULL); + if (ret_val != NRF_SUCCESS) + { + return ret_val; + } + + // Flash one page + ret_val = nrf_dfu_flash_store((uint32_t*)target_addr, (uint32_t*)src_addr, cur_len, NULL); + if (ret_val != NRF_SUCCESS) + { + return ret_val; + } + + ret_val = nrf_dfu_mbr_compare((uint32_t*)target_addr, (uint32_t*)src_addr, cur_len); + if (ret_val != NRF_SUCCESS) + { + // We will not retry the copy + NRF_LOG_ERROR("Invalid data during compare: target: 0x%08x, src: 0x%08x\r\n", target_addr, src_addr); + return ret_val; + } + + // Erase the head (to handle growing bank 0) + ret_val = nrf_dfu_flash_erase((uint32_t*) src_addr, split_size / CODE_PAGE_SIZE, NULL); + if (ret_val != NRF_SUCCESS) + { + NRF_LOG_ERROR("App update: Failure erasing page at addr: 0x%08x\r\n", src_addr); + return ret_val; + } + + s_dfu_settings.write_offset += cur_len; + ret_val = nrf_dfu_settings_write(NULL); + + target_addr += cur_len; + src_addr += cur_len; + + length_left -= cur_len; + } + while(length_left > 0); + + // Check the crc of the copied data. Enable if so. + crc = crc32_compute((uint8_t*)MAIN_APPLICATION_START_ADDR, image_size, NULL); + + if (crc == s_dfu_settings.bank_1.image_crc) + { + NRF_LOG_INFO("Setting app as valid\r\n"); + s_dfu_settings.bank_0.bank_code = NRF_DFU_BANK_VALID_APP; + s_dfu_settings.bank_0.image_crc = crc; + s_dfu_settings.bank_0.image_size = image_size; + } + else + { + NRF_LOG_ERROR("CRC computation failed for copied app: src crc: 0x%08x, res crc: 0x08x\r\n", s_dfu_settings.bank_1.image_crc, crc); + } + + nrf_dfu_invalidate_bank(&s_dfu_settings.bank_1); + ret_val = nrf_dfu_settings_write(NULL); + + return ret_val; +} + +/** @brief Function to execute the continuation of a SoftDevice update. + * + * @param[in] src_addr Source address of the SoftDevice to copy from. + * @param[in] p_bank Pointer to the bank where the SoftDevice resides. + * + * @retval NRF_SUCCESS Continuation was successful. + * @retval NRF_ERROR_INVALID_LENGTH Invalid len + * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). + * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. + * @retval NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. + * @retval NRF_ERROR_NULL If the content of the memory blocks differs after copying. + */ +static uint32_t nrf_dfu_sd_continue_impl(uint32_t src_addr, + nrf_dfu_bank_t * p_bank) +{ + uint32_t ret_val = NRF_SUCCESS; + uint32_t target_addr = SOFTDEVICE_REGION_START + s_dfu_settings.write_offset; + uint32_t length_left = align_to_page(s_dfu_settings.sd_size - s_dfu_settings.write_offset, CODE_PAGE_SIZE); + uint32_t split_size = align_to_page(length_left / 4, CODE_PAGE_SIZE); + + NRF_LOG_INFO("Enter nrf_bootloader_dfu_sd_continue\r\n"); + + // This can be a continuation due to a power failure + src_addr += s_dfu_settings.write_offset; + + if (s_dfu_settings.sd_size != 0 && s_dfu_settings.write_offset == s_dfu_settings.sd_size) + { + NRF_LOG_INFO("SD already copied\r\n"); + return NRF_SUCCESS; + } + + NRF_LOG_INFO("Updating SD. Old SD ver: 0x%04x\r\n", SD_FWID_GET(MBR_SIZE)); + + do + { + NRF_LOG_INFO("Copying [0x%08x-0x%08x] to [0x%08x-0x%08x]: Len: 0x%08x\r\n", src_addr, src_addr + split_size, target_addr, target_addr + split_size, split_size); + + // Copy a chunk of the SD. Size in words + ret_val = nrf_dfu_mbr_copy_sd((uint32_t*)target_addr, (uint32_t*)src_addr, split_size); + if (ret_val != NRF_SUCCESS) + { + NRF_LOG_ERROR("Failed to copy SD: target: 0x%08x, src: 0x%08x, len: 0x%08x\r\n", target_addr, src_addr, split_size); + return ret_val; + } + + NRF_LOG_INFO("Finished copying [0x%08x-0x%08x] to [0x%08x-0x%08x]: Len: 0x%08x\r\n", src_addr, src_addr + split_size, target_addr, target_addr + split_size, split_size); + + // Validate copy. Size in words + ret_val = nrf_dfu_mbr_compare((uint32_t*)target_addr, (uint32_t*)src_addr, split_size); + if (ret_val != NRF_SUCCESS) + { + NRF_LOG_ERROR("Failed to Compare SD: target: 0x%08x, src: 0x%08x, len: 0x%08x\r\n", target_addr, src_addr, split_size); + return ret_val; + } + + NRF_LOG_INFO("Validated 0x%08x-0x%08x to 0x%08x-0x%08x: Size: 0x%08x\r\n", src_addr, src_addr + split_size, target_addr, target_addr + split_size, split_size); + + target_addr += split_size; + src_addr += split_size; + + if (split_size > length_left) + { + length_left = 0; + } + else + { + length_left -= split_size; + } + + NRF_LOG_INFO("Finished with the SD update.\r\n"); + + // Save the updated point of writes in case of power loss + s_dfu_settings.write_offset = s_dfu_settings.sd_size - length_left; + ret_val = nrf_dfu_settings_write(NULL); + } + while (length_left > 0); + + return ret_val; +} + + +/** @brief Function to continue SoftDevice update + * + * @details This function will be called after reset if there is a valid SoftDevice in Bank0 or Bank1 + * required to be relocated and activated through MBR commands. + * + * @param[in] src_addr Source address of the SoftDevice to copy from. + * @param[in] p_bank Pointer to the bank where the SoftDevice resides. + * + * @retval NRF_SUCCESS Continuation was successful. + * @retval NRF_ERROR_INVALID_LENGTH Invalid len + * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). + * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. + * @retval NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. + * @retval NRF_ERROR_NULL If the content of the memory blocks differs after copying. + */ +static uint32_t nrf_dfu_sd_continue(uint32_t src_addr, + nrf_dfu_bank_t * p_bank) +{ + uint32_t ret_val; + + ret_val = nrf_dfu_sd_continue_impl(src_addr, p_bank); + if (ret_val != NRF_SUCCESS) + { + NRF_LOG_ERROR("SD update continuation failed\r\n"); + return ret_val; + } + + nrf_dfu_invalidate_bank(p_bank); + ret_val = nrf_dfu_settings_write(NULL); + + return ret_val; +} + + +/** @brief Function to continue Bootloader update + * + * @details This function will be called after reset if there is a valid Bootloader in Bank0 or Bank1 + * required to be relocated and activated through MBR commands. + * + * @param[in] src_addr Source address of the BL to copy from. + * @param[in] p_bank Pointer to the bank where the SoftDevice resides. + * + * @return This fucntion will not return if the bootloader is copied succesfully. + * After the copy is verified the device will reset and start the new bootloader. + * + * @retval NRF_SUCCESS Continuation was successful. + * @retval NRF_ERROR_INVALID_LENGTH Invalid length of flash operation. + * @retval NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info). + * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. + * @retval NRF_ERROR_INTERNAL internal error that should not happen. + * @retval NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. + */ +static uint32_t nrf_dfu_bl_continue(uint32_t src_addr, nrf_dfu_bank_t * p_bank) +{ + uint32_t ret_val = NRF_SUCCESS; + uint32_t const len = (p_bank->image_size - s_dfu_settings.sd_size); + + // if the update is a combination of BL + SD, offset with SD size to get BL start address + src_addr += s_dfu_settings.sd_size; + + NRF_LOG_INFO("Verifying BL: Addr: 0x%08x, Src: 0x%08x, Len: 0x%08x\r\n", MAIN_APPLICATION_START_ADDR, src_addr, len); + + + // If the bootloader is the same as the banked version, the copy is finished + ret_val = nrf_dfu_mbr_compare((uint32_t*)BOOTLOADER_START_ADDR, (uint32_t*)src_addr, len); + if (ret_val == NRF_SUCCESS) + { + NRF_LOG_INFO("Bootloader was verified\r\n"); + + // Invalidate bank, marking completion + nrf_dfu_invalidate_bank(p_bank); + ret_val = nrf_dfu_settings_write(NULL); + } + else + { + NRF_LOG_INFO("Bootloader not verified, copying: Src: 0x%08x, Len: 0x%08x\r\n", src_addr, len); + // Bootloader is different than the banked version. Continue copy + // Note that if the SD and BL was combined, then the split point between them is in s_dfu_settings.sd_size + ret_val = nrf_dfu_mbr_copy_bl((uint32_t*)src_addr, len); + if(ret_val != NRF_SUCCESS) + { + NRF_LOG_ERROR("Request to copy BL failed\r\n"); + } + } + + return ret_val; +} + + +/** @brief Function to continue combined Bootloader and SoftDevice update + * + * @details This function will be called after reset if there is a valid Bootloader and SoftDevice in Bank0 or Bank1 + * required to be relocated and activated through MBR commands. + * + * @param[in] src_addr Source address of the combined Bootloader and SoftDevice to copy from. + * @param[in] p_bank Pointer to the bank where the SoftDevice resides. + * + * @retval NRF_SUCCESS Continuation was successful. + * @retval NRF_ERROR_INVALID_LENGTH Invalid len + * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). + * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. + * @retval NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. + * @retval NRF_ERROR_NULL If the content of the memory blocks differs after copying. + * @retval NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. + */ +static uint32_t nrf_dfu_sd_bl_continue(uint32_t src_addr, nrf_dfu_bank_t * p_bank) +{ + uint32_t ret_val = NRF_SUCCESS; + + NRF_LOG_INFO("Enter nrf_dfu_sd_bl_continue\r\n"); + + ret_val = nrf_dfu_sd_continue_impl(src_addr, p_bank); + if (ret_val != NRF_SUCCESS) + { + NRF_LOG_ERROR("SD+BL: SD copy failed\r\n"); + return ret_val; + } + + ret_val = nrf_dfu_bl_continue(src_addr, p_bank); + if (ret_val != NRF_SUCCESS) + { + NRF_LOG_ERROR("SD+BL: BL copy failed\r\n"); + return ret_val; + } + + return ret_val; +} + + +static uint32_t nrf_dfu_continue_bank(nrf_dfu_bank_t * p_bank, uint32_t src_addr, uint32_t * p_enter_dfu_mode) +{ + uint32_t ret_val = NRF_SUCCESS; + + switch (p_bank->bank_code) + { + case NRF_DFU_BANK_VALID_APP: + NRF_LOG_INFO("Valid App\r\n"); + if(s_dfu_settings.bank_current == NRF_DFU_CURRENT_BANK_1) + { + // Only continue copying if valid app in bank1 + ret_val = nrf_dfu_app_continue(src_addr); + } + break; + + case NRF_DFU_BANK_VALID_SD: + NRF_LOG_INFO("Valid SD\r\n"); + // There is a valid SD that needs to be copied (or continued) + ret_val = nrf_dfu_sd_continue(src_addr, p_bank); + (*p_enter_dfu_mode) = 1; + break; + + case NRF_DFU_BANK_VALID_BL: + NRF_LOG_INFO("Valid BL\r\n"); + // There is a valid BL that must be copied (or continued) + ret_val = nrf_dfu_bl_continue(src_addr, p_bank); + break; + + case NRF_DFU_BANK_VALID_SD_BL: + NRF_LOG_INFO("Single: Valid SD + BL\r\n"); + // There is a valid SD + BL that must be copied (or continued) + ret_val = nrf_dfu_sd_bl_continue(src_addr, p_bank); + // Set the bank-code to invalid, and reset size/CRC + (*p_enter_dfu_mode) = 1; + break; + + case NRF_DFU_BANK_INVALID: + default: + NRF_LOG_ERROR("Single: Invalid bank\r\n"); + break; + } + + return ret_val; +} + + +uint32_t nrf_dfu_continue(uint32_t * p_enter_dfu_mode) +{ + uint32_t ret_val; + nrf_dfu_bank_t * p_bank; + uint32_t src_addr = CODE_REGION_1_START; + + NRF_LOG_INFO("Enter nrf_dfu_continue\r\n"); + + if (s_dfu_settings.bank_layout == NRF_DFU_BANK_LAYOUT_SINGLE ) + { + p_bank = &s_dfu_settings.bank_0; + } + else if(s_dfu_settings.bank_current == NRF_DFU_CURRENT_BANK_0) + { + p_bank = &s_dfu_settings.bank_0; + } + else + { + p_bank = &s_dfu_settings.bank_1; + src_addr += align_to_page(s_dfu_settings.bank_0.image_size, CODE_PAGE_SIZE); + } + + ret_val = nrf_dfu_continue_bank(p_bank, src_addr, p_enter_dfu_mode); + return ret_val; +} + + +bool nrf_dfu_app_is_valid(void) +{ + NRF_LOG_INFO("Enter nrf_dfu_app_is_valid\r\n"); + if (s_dfu_settings.bank_0.bank_code != NRF_DFU_BANK_VALID_APP) + { + // Bank 0 has no valid app. Nothing to boot + NRF_LOG_INFO("Return false in valid app check\r\n"); + return false; + } + + // If CRC == 0, this means CRC check is skipped. + if (s_dfu_settings.bank_0.image_crc != 0) + { + uint32_t crc = crc32_compute((uint8_t*) CODE_REGION_1_START, + s_dfu_settings.bank_0.image_size, + NULL); + + if (crc != s_dfu_settings.bank_0.image_crc) + { + // CRC does not match with what is stored. + NRF_LOG_INFO("Return false in CRC\r\n"); + return false; + } + } + + NRF_LOG_INFO("Return true. App was valid\r\n"); + return true; +} + + +uint32_t nrf_dfu_find_cache(uint32_t size_req, bool dual_bank_only, uint32_t * p_address) +{ + // TODO: Prevalidate p_address and p_bank + + uint32_t free_size = DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED; + nrf_dfu_bank_t * p_bank; + + NRF_LOG_INFO("Enter nrf_dfu_find_cache\r\n"); + + // Simple check if size requirement can me met + if(free_size < size_req) + { + NRF_LOG_INFO("No way to fit the new firmware on device\r\n"); + return NRF_ERROR_NO_MEM; + } + + NRF_LOG_INFO("Bank content\r\n"); + NRF_LOG_INFO("Bank type: %d\r\n", s_dfu_settings.bank_layout); + NRF_LOG_INFO("Bank 0 code: 0x%02x: Size: %d\r\n", s_dfu_settings.bank_0.bank_code, s_dfu_settings.bank_0.image_size); + NRF_LOG_INFO("Bank 1 code: 0x%02x: Size: %d\r\n", s_dfu_settings.bank_1.bank_code, s_dfu_settings.bank_1.image_size); + + // Setting bank_0 as candidate + p_bank = &s_dfu_settings.bank_0; + + // Setting candidate address + (*p_address) = MAIN_APPLICATION_START_ADDR; + + // Calculate free size + if (s_dfu_settings.bank_0.bank_code == NRF_DFU_BANK_VALID_APP) + { + // Valid app present. + + NRF_LOG_INFO("free_size before bank select: %d\r\n", free_size); + + free_size -= align_to_page(p_bank->image_size, CODE_PAGE_SIZE); + + NRF_LOG_INFO("free_size: %d, size_req: %d\r\n", free_size, size_req); + + // Check if we can fit the new in the free space or if removal of old app is required. + if(size_req > free_size) + { + // Not enough room in free space (bank_1) + if ((dual_bank_only)) + { + NRF_LOG_ERROR("Failure: dual bank restriction\r\n"); + return NRF_ERROR_NO_MEM; + } + + // Can only support single bank update, clearing old app. + s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_SINGLE; + s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_0; + p_bank = &s_dfu_settings.bank_0; + NRF_LOG_INFO("Enforcing single bank\r\n"); + } + else + { + // Room in bank_1 for update + // Ensure we are using dual bank layout + s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_DUAL; + s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_1; + p_bank = &s_dfu_settings.bank_1; + // Set to first free page boundry after previous app + (*p_address) += align_to_page(s_dfu_settings.bank_0.image_size, CODE_PAGE_SIZE); + NRF_LOG_INFO("Using second bank\r\n"); + } + } + else + { + // No valid app present. Promoting dual bank. + s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_DUAL; + s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_0; + + p_bank = &s_dfu_settings.bank_0; + NRF_LOG_INFO("No previous, using bank 0\r\n"); + } + + // Set the bank-code to invalid, and reset size/CRC + memset(p_bank, 0, sizeof(nrf_dfu_bank_t)); + + // Store the Firmware size in the bank for continuations + p_bank->image_size = size_req; + return NRF_SUCCESS; +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.h new file mode 100644 index 0000000000..a1d49dde77 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup sdk_nrf_dfu_utils DFU utilities + * @{ + * @ingroup sdk_nrf_dfu + */ + +#ifndef NRF_DFU_UTILS_H__ +#define NRF_DFU_UTILS_H__ + +#include +#include +#include "nrf_dfu_types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/** @brief Function for continuing an ongoing DFU operation. + * + * @details This function initiates or continues the DFU copy-back + * routines. These routines are fail-safe operations to activate + * either a new SoftDevice, Bootloader, combination of SoftDevice and + * Bootloader, or a new application. + * + * @details This function relies on accessing MBR commands through supervisor calls. + * It does not rely on the SoftDevice for flash operations. + * + * @note When updating the bootloader or both bootloader and SoftDevice in combination, + * this function does not return, but rather initiate a reboot to activate + * the new bootloader. + * + * @param[in,out] p_enter_dfu_mode True if the continuation failed or the update requires DFU mode. + * + * @retval NRF_SUCCESS If the DFU operation was continued successfully. + * Any other error code indicates that the DFU operation could + * not be continued. + */ +uint32_t nrf_dfu_continue(uint32_t * p_enter_dfu_mode); + + +/** @brief Function for checking if the main application is valid. + * + * @details This function checks if there is a valid application + * located at Bank 0. + * + * @retval true If a valid application has been detected. + * @retval false If there is no valid application. + */ +bool nrf_dfu_app_is_valid(void); + + +/** @brief Function for finding a cache write location for the DFU process. + * + * @details This function checks the size requirements and selects a location for + * placing the cache of the DFU images. + * The function tries to find enough space in Bank 1. If there is not enough space, + * the present application is erased. + * + * @param[in] size_req Requirements for the size of the new image. + * @param[in] dual_bank_only True to enforce dual-bank updates. In this case, if there + * is not enough space for caching the DFU image, the existing + * application is retained and the function returns an error. + * @param[out] p_address Updated to the cache address if a cache location is found. + * + * @retval NRF_SUCCESS If a cache location was found for the DFU process. + * @retval NRF_ERROR_NO_MEM If there is no space available on the device to continue the DFU process. + */ +uint32_t nrf_dfu_find_cache(uint32_t size_req, bool dual_bank_only, uint32_t * p_address); + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_DFU_UTILS_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader.h deleted file mode 100644 index f2f35bee60..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup nrf_bootloader Bootloader API. - * @{ - * - * @brief Bootloader module interface. - */ - -#ifndef BOOTLOADER_H__ -#define BOOTLOADER_H__ - -#include -#include -#include "bootloader_types.h" -#include - -/**@brief Function for initializing the Bootloader. - * - * @retval NRF_SUCCESS If bootloader was succesfully initialized. - */ -uint32_t bootloader_init(void); - -/**@brief Function for validating application region in flash. - * - * @param[in] app_addr Address to the region in flash where the application is stored. - * - * @retval true If Application region is valid. - * @retval false If Application region is not valid. - */ -bool bootloader_app_is_valid(uint32_t app_addr); - -/**@brief Function for starting the Device Firmware Update. - * - * @retval NRF_SUCCESS If new application image was successfully transferred. - */ -uint32_t bootloader_dfu_start(void); - -/**@brief Function for exiting bootloader and booting into application. - * - * @details This function will disable SoftDevice and all interrupts before jumping to application. - * The SoftDevice vector table base for interrupt forwarding will be set the application - * address. - * - * @param[in] app_addr Address to the region where the application is stored. - */ -void bootloader_app_start(uint32_t app_addr); - -/**@brief Function for retrieving the bootloader settings. - * - * @param[out] p_settings A copy of the current bootloader settings is returned in the structure - * provided. - */ -void bootloader_settings_get(bootloader_settings_t * const p_settings); - -/**@brief Function for processing DFU status update. - * - * @param[in] update_status DFU update status. - */ -void bootloader_dfu_update_process(dfu_update_status_t update_status); - -/**@brief Function getting state of SoftDevice update in progress. - * After a successfull SoftDevice transfer the system restarts in orderto disable SoftDevice - * and complete the update. - * - * @retval true A SoftDevice update is in progress. This indicates that second stage - * of a SoftDevice update procedure can be initiated. - * @retval false No SoftDevice update is in progress. - */ -bool bootloader_dfu_sd_in_progress(void); - -/**@brief Function for continuing the Device Firmware Update of a SoftDevice. - * - * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful. - */ -uint32_t bootloader_dfu_sd_update_continue(void); - -/**@brief Function for finalizing the Device Firmware Update of a SoftDevice. - * - * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful. - */ -uint32_t bootloader_dfu_sd_update_finalize(void); - -#endif // BOOTLOADER_H__ - -/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_types.h deleted file mode 100644 index 5d342b0ade..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/bootloader_types.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup nrf_bootloader_types Types and definitions. - * @{ - * - * @ingroup nrf_bootloader - * - * @brief Bootloader module type and definitions. - */ - -#ifndef BOOTLOADER_TYPES_H__ -#define BOOTLOADER_TYPES_H__ - -#include - -#define BOOTLOADER_DFU_START 0xB1 - -#define BOOTLOADER_SVC_APP_DATA_PTR_GET 0x02 - -/**@brief DFU Bank state code, which indicates wether the bank contains: A valid image, invalid image, or an erased flash. - */ -typedef enum -{ - BANK_VALID_APP = 0x01, - BANK_VALID_SD = 0xA5, - BANK_VALID_BOOT = 0xAA, - BANK_ERASED = 0xFE, - BANK_INVALID_APP = 0xFF, -} bootloader_bank_code_t; - -/**@brief Structure holding bootloader settings for application and bank data. - */ -typedef struct -{ - bootloader_bank_code_t bank_0; /**< Variable to store if bank 0 contains a valid application. */ - uint16_t bank_0_crc; /**< If bank is valid, this field will contain a valid CRC of the total image. */ - bootloader_bank_code_t bank_1; /**< Variable to store if bank 1 has been erased/prepared for new image. Bank 1 is only used in Banked Update scenario. */ - uint32_t bank_0_size; /**< Size of active image in bank0 if present, otherwise 0. */ - uint32_t sd_image_size; /**< Size of SoftDevice image in bank0 if bank_0 code is BANK_VALID_SD. */ - uint32_t bl_image_size; /**< Size of Bootloader image in bank0 if bank_0 code is BANK_VALID_SD. */ - uint32_t app_image_size; /**< Size of Application image in bank0 if bank_0 code is BANK_VALID_SD. */ - uint32_t sd_image_start; /**< Location in flash where SoftDevice image is stored for SoftDevice update. */ -} bootloader_settings_t; - -#endif // BOOTLOADER_TYPES_H__ - -/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu.h deleted file mode 100644 index e0dda11040..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup nrf_dfu Device Firmware Update API. - * @{ - * - * @brief Device Firmware Update module interface. - */ - -#ifndef DFU_H__ -#define DFU_H__ - -#include -#include -#include - - -/**@brief DFU event callback for asynchronous calls. - * - * @param[in] packet Packet type for which this callback is related. START_PACKET, DATA_PACKET. - * @param[in] result Operation result code. NRF_SUCCESS when a queued operation was successful. - * @param[in] p_data Pointer to the data to which the operation is related. - */ -typedef void (*dfu_callback_t)(uint32_t packet, uint32_t result, uint8_t * p_data); - -/**@brief Function for initializing the Device Firmware Update module. - * - * @return NRF_SUCCESS on success, an error_code otherwise. - */ -uint32_t dfu_init(void); - -/**@brief Function for registering a callback listener for \ref dfu_data_pkt_handle callbacks. - * - * @param[in] callback_handler Callback handler for receiving DFU events on completed operations - * of DFU packets. - */ -void dfu_register_callback(dfu_callback_t callback_handler); - -/**@brief Function for setting the DFU image size. - * - * @details Function sets the DFU image size. This function must be called when an update is started - * in order to notify the DFU of the new image size. If multiple images are to be - * transferred within the same update context then this function must be called with size - * information for each image being transfered. - * If an image type is not being transfered, e.g. SoftDevice but no Application , then the - * image size for application must be zero. - * - * @param[in] p_packet Pointer to the DFU packet containing information on DFU update process to - * be started. - * - * @return NRF_SUCCESS on success, an error_code otherwise. - */ -uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet); - -/**@brief Function for handling DFU data packets. - * - * @param[in] p_packet Pointer to the DFU packet. - * - * @return NRF_SUCCESS on success, an error_code otherwise. - */ -uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet); - -/**@brief Function for handling DFU init packets. - * - * @return NRF_SUCCESS on success, an error_code otherwise. - */ -uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet); - -/**@brief Function for validating a transferred image after the transfer has completed. - * - * @return NRF_SUCCESS on success, an error_code otherwise. - */ -uint32_t dfu_image_validate(void); - -/**@brief Function for activating the transfered image after validation has successfully completed. - * - * @return NRF_SUCCESS on success, an error_code otherwise. - */ -uint32_t dfu_image_activate(void); - -/**@brief Function for reseting the current update procedure and return to initial state. - * - * @details This function call will result in a system reset to ensure correct system behavior. - * The reset will might be scheduled to execute at a later point in time to ensure pending - * flash operations has completed. - */ -void dfu_reset(void); - -/**@brief Function for validating that new bootloader has been correctly installed. - * - * @return NRF_SUCCESS if install was successful. NRF_ERROR_NULL if the images differs. - */ -uint32_t dfu_bl_image_validate(void); - -/**@brief Function for validating that new SoftDevicehas been correctly installed. - * - * @return NRF_SUCCESS if install was successful. NRF_ERROR_NULL if the images differs. - */ -uint32_t dfu_sd_image_validate(void); - -/**@brief Function for swapping existing bootloader with newly received. - * - * @return NRF_SUCCESS on succesfull swapping. For error code please refer to - * \ref sd_mbr_command_copy_bl_t. - */ -uint32_t dfu_bl_image_swap(void); - -/**@brief Function for swapping existing SoftDevice with newly received. - * - * @return NRF_SUCCESS on succesfull swapping. For error code please refer to - * \ref sd_mbr_command_copy_sd_t. - */ -uint32_t dfu_sd_image_swap(void); - -/**@brief Function for handling DFU init packet complete. - * - * @return NRF_SUCCESS on success, an error_code otherwise. - */ -uint32_t dfu_init_pkt_complete(void); - -#endif // DFU_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.c deleted file mode 100644 index 38b3ca4770..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2014 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#include "dfu_app_handler.h" -#include -#include "bootloader_util.h" -#include "nrf.h" -#include "nrf_sdm.h" -#include "nrf_ble_gatt.h" -#include "nrf_ble_gatts.h" -#include "app_error.h" -#include "dfu_ble_svc.h" -#include "device_manager.h" -#include "nrf_delay.h" - -#define IRQ_ENABLED 0x01 /**< Field that identifies if an interrupt is enabled. */ -#define MAX_NUMBER_INTERRUPTS 32 /**< Maximum number of interrupts available. */ - -static void dfu_app_reset_prepare(void); /**< Forward declaration of default reset handler. */ -static dfu_app_reset_prepare_t m_reset_prepare = dfu_app_reset_prepare; /**< Callback function to application to prepare for system reset. Allows application to clean up service and memory before reset. */ -static dfu_ble_peer_data_t m_peer_data; /**< Peer data to be used for data exchange when resetting into DFU mode. */ -static dm_handle_t m_dm_handle; /**< Device Manager handle with instance IDs of current BLE connection. */ - - -/**@brief Function for reset_prepare handler if the application has not registered a handler. - */ -static void dfu_app_reset_prepare(void) -{ - // Reset prepare should be handled by application. - // This function can be extended to include default handling if application does not implement - // own handler. -} - - -/**@brief Function for disabling all interrupts before jumping from bootloader to application. - */ -static void interrupts_disable(void) -{ - uint32_t interrupt_setting_mask; - uint32_t irq; - - // Fetch the current interrupt settings. - interrupt_setting_mask = NVIC->ISER[0]; - - // Loop from interrupt 0 for disabling of all interrupts. - for (irq = 0; irq < MAX_NUMBER_INTERRUPTS; irq++) - { - if (interrupt_setting_mask & (IRQ_ENABLED << irq)) - { - // The interrupt was enabled, hence disable it. - NVIC_DisableIRQ((IRQn_Type)irq); - } - } -} - - -/**@brief Function for providing peer information to DFU for re-establishing a bonded connection in - * DFU mode. - * - * @param[in] conn_handle Connection handle for the connection requesting DFU mode. - */ -static void dfu_app_peer_data_set(uint16_t conn_handle) -{ - uint32_t err_code; - dm_sec_keyset_t key_set; - uint32_t app_context_data = 0; - dm_application_context_t app_context; - - -/** [DFU bond sharing] */ - err_code = dm_handle_get(conn_handle, &m_dm_handle); - if (err_code == NRF_SUCCESS) - { - err_code = dm_distributed_keys_get(&m_dm_handle, &key_set); - if (err_code == NRF_SUCCESS) - { - APP_ERROR_CHECK(err_code); - - m_peer_data.addr = key_set.keys_central.p_id_key->id_addr_info; - m_peer_data.irk = key_set.keys_central.p_id_key->id_info; - m_peer_data.enc_key.enc_info = key_set.keys_periph.enc_key.p_enc_key->enc_info; - m_peer_data.enc_key.master_id = key_set.keys_periph.enc_key.p_enc_key->master_id; - - err_code = dfu_ble_svc_peer_data_set(&m_peer_data); - APP_ERROR_CHECK(err_code); - - app_context_data = (DFU_APP_ATT_TABLE_CHANGED << DFU_APP_ATT_TABLE_POS); - app_context.len = sizeof(app_context_data); - app_context.p_data = (uint8_t *)&app_context_data; - app_context.flags = 0; - - err_code = dm_application_context_set(&m_dm_handle, &app_context); - APP_ERROR_CHECK(err_code); - } - else - { - // Keys were not available, thus we have a non-encrypted connection. - err_code = dm_peer_addr_get(&m_dm_handle, &m_peer_data.addr); - APP_ERROR_CHECK(err_code); - - err_code = dfu_ble_svc_peer_data_set(&m_peer_data); - APP_ERROR_CHECK(err_code); - } - } -/** [DFU bond sharing] */ -} - - -/**@brief Function for preparing the reset, disabling SoftDevice, and jumping to the bootloader. - * - * @param[in] conn_handle Connection handle for peer requesting to enter DFU mode. - */ -static void bootloader_start(uint16_t conn_handle) -{ - uint32_t err_code; - uint16_t sys_serv_attr_len = sizeof(m_peer_data.sys_serv_attr); - - err_code = sd_ble_gatts_sys_attr_get(conn_handle, - m_peer_data.sys_serv_attr, - &sys_serv_attr_len, - BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS); - if (err_code != NRF_SUCCESS) - { - // Any error at this stage means the system service attributes could not be fetched. - // This means the service changed indication cannot be sent in DFU mode, but connection - // is still possible to establish. - } - - m_reset_prepare(); - - err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START); - APP_ERROR_CHECK(err_code); - - err_code = sd_softdevice_disable(); - APP_ERROR_CHECK(err_code); - - err_code = sd_softdevice_vector_table_base_set(NRF_UICR->NRFFW[0]); - APP_ERROR_CHECK(err_code); - - dfu_app_peer_data_set(conn_handle); - - NVIC_ClearPendingIRQ(SWI2_IRQn); - interrupts_disable(); - bootloader_util_app_start(NRF_UICR->NRFFW[0]); -} - - -void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt) -{ - switch (p_evt->ble_dfu_evt_type) - { - case BLE_DFU_START: - // Starting the bootloader - will cause reset. - bootloader_start(p_dfu->conn_handle); - break; - - default: - { - // Unsupported event received from DFU Service. - // Send back BLE_DFU_RESP_VAL_NOT_SUPPORTED message to peer. - uint32_t err_code = ble_dfu_response_send(p_dfu, - BLE_DFU_START_PROCEDURE, - BLE_DFU_RESP_VAL_NOT_SUPPORTED); - APP_ERROR_CHECK(err_code); - } - break; - } -} - - -void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func) -{ - m_reset_prepare = reset_prepare_func; -} - - -void dfu_app_dm_appl_instance_set(dm_application_instance_t app_instance) -{ - uint32_t err_code; - - err_code = dm_application_instance_set(&app_instance, &m_dm_handle); - APP_ERROR_CHECK(err_code); -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.h deleted file mode 100644 index 6f208f1d43..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_app_handler.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2014 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/** @file - * - * @defgroup nrf_dfu_app_handler DFU BLE packet handling in application - * @{ - * - * @brief Handling of DFU BLE packets in the application. - * - * @details This module implements the handling of DFU packets for switching - * from an application to the bootloader and start DFU mode. The DFU - * packets are transmitted over BLE. - * This module handles only the StartDFU packet, which allows a BLE - * application to expose support for the DFU Service. - * The actual DFU Service runs in a dedicated environment after a BLE - * disconnect and reset of the \nRFXX device. - * The host must reconnect and continue the update procedure with - * access to the full DFU Service. - * - * @note The application must propagate DFU events to this module by calling - * @ref dfu_app_on_dfu_evt from the @ref ble_dfu_evt_handler_t callback. - */ - -#ifndef DFU_APP_HANDLER_H__ -#define DFU_APP_HANDLER_H__ - -#include "ble_dfu.h" -#include "nrf_svc.h" -#include "bootloader_types.h" -#include "device_manager.h" - -#define DFU_APP_ATT_TABLE_POS 0 /**< Position for the ATT table changed setting. */ -#define DFU_APP_ATT_TABLE_CHANGED 1 /**< Value indicating that the ATT table might have changed. This value will be set in the application-specific context in Device Manager when entering DFU mode. */ - -/**@brief DFU application reset_prepare function. This function is a callback that allows the - * application to prepare for an upcoming application reset. - */ -typedef void (*dfu_app_reset_prepare_t)(void); - -/**@brief Function for handling events from the DFU Service. - * - * @details The application must inject this function into the DFU Service or propagate DFU events - * to the dfu_app_handler module by calling this function in the application-specific DFU event - * handler. - * - * @param[in] p_dfu Pointer to the DFU Service structure to which the include event relates. - * @param[in] p_evt Pointer to the DFU event. - */ -void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt); - -/**@brief Function for registering a function to prepare a reset. - * - * @details The provided function is executed before resetting the system into bootloader/DFU - * mode. By registering this function, the caller is notified before the reset and can - * thus prepare the application for reset. For example, the application can gracefully - * disconnect any peers on BLE, turn of LEDS, ensure that all pending flash operations - * have completed, and so on. - * - * @param[in] reset_prepare_func Function to be executed before a reset. - */ -void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func); - -/**@brief Function for setting the Device Manager application instance. - * - * @details This function allows to set the @ref dm_application_instance_t value that is returned by the - * Device Manager when the application registers using @ref dm_register. - * If this function is not called, it is not be possible to share bonding information - * from the application to the bootloader/DFU when entering DFU mode. - * - * @param[in] app_instance Value for the application instance in use. - */ -void dfu_app_dm_appl_instance_set(dm_application_instance_t app_instance); - -#endif // DFU_APP_HANDLER_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_bank_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_bank_internal.h deleted file mode 100644 index a2dbb80b09..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_bank_internal.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2014 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup dfu_bank_internal Device Firmware Update internal header for bank handling in DFU. - * @{ - * - * @brief Device Firmware Update Bank handling module interface. - * - * @details This header is intended for shared definition and functions between single and dual bank - * implementations used for DFU support. It is not supposed to be used for external access - * to the DFU module. - * - */ -#ifndef DFU_BANK_INTERNAL_H__ -#define DFU_BANK_INTERNAL_H__ - -#include - -/**@brief States of the DFU state machine. */ -typedef enum -{ - DFU_STATE_INIT_ERROR, /**< State for: dfu_init(...) error. */ - DFU_STATE_IDLE, /**< State for: idle. */ - DFU_STATE_PREPARING, /**< State for: preparing, indicates that the flash is being erased and no data packets can be processed. */ - DFU_STATE_RDY, /**< State for: ready. */ - DFU_STATE_RX_INIT_PKT, /**< State for: receiving initialization packet. */ - DFU_STATE_RX_DATA_PKT, /**< State for: receiving data packet. */ - DFU_STATE_VALIDATE, /**< State for: validate. */ - DFU_STATE_WAIT_4_ACTIVATE /**< State for: waiting for dfu_image_activate(). */ -} dfu_state_t; - -#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ -#define DFU_TIMEOUT_INTERVAL APP_TIMER_TICKS(120000, APP_TIMER_PRESCALER) /**< DFU timeout interval in units of timer ticks. */ - -#define IS_UPDATING_SD(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_SD) /**< Macro for determining if a SoftDevice update is ongoing. */ -#define IS_UPDATING_BL(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_BL) /**< Macro for determining if a Bootloader update is ongoing. */ -#define IS_UPDATING_APP(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_APP) /**< Macro for determining if a Application update is ongoing. */ -#define IMAGE_WRITE_IN_PROGRESS() (m_data_received > 0) /**< Macro for determining if an image write is in progress. */ -#define IS_WORD_SIZED(SIZE) ((SIZE & (sizeof(uint32_t) - 1)) == 0) /**< Macro for checking that the provided is word sized. */ - -/**@cond NO_DOXYGEN */ -static uint32_t m_data_received; /**< Amount of received data. */ -/**@endcond */ - -/**@brief Type definition of function used for preparing of the bank before receiving of a - * software image. - * - * @param[in] image_size Size of software image being received. - */ -typedef void (*dfu_bank_prepare_t)(uint32_t image_size); - -/**@brief Type definition of function used for handling clear complete of the bank before - * receiving of a software image. - */ -typedef void (*dfu_bank_cleared_t)(void); - -/**@brief Type definition of function used for activating of the software image received. - * - * @return NRF_SUCCESS If the image has been successfully activated any other NRF_ERROR code in - * case of a failure. - */ -typedef uint32_t (*dfu_bank_activate_t)(void); - -/**@brief Structure for holding of function pointers for needed prepare and activate procedure for - * the requested update procedure. - */ -typedef struct -{ - dfu_bank_prepare_t prepare; /**< Function pointer to the prepare function called on start of update procedure. */ - dfu_bank_cleared_t cleared; /**< Function pointer to the cleared function called after prepare function completes. */ - dfu_bank_activate_t activate; /**< Function pointer to the activate function called on finalizing the update procedure. */ -} dfu_bank_func_t; - -#endif // DFU_BANK_INTERNAL_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc.h deleted file mode 100644 index fe44c98e1a..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_ble_svc.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2014 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/** @file - * - * @defgroup nrf_dfu_ble_svc DFU BLE SVC - * @{ - * - * @brief DFU BLE SVC in bootloader. The DFU BLE SuperVisor Calls allow an application to execute - * functions in the installed bootloader. - * - * @details This module implements handling of SuperVisor Calls in the bootloader. - * SuperVisor Calls allow for an application to execute calls into the bootloader. - * Currently, it is possible to exchange bonding information (like keys) from the - * application to a bootloader supporting DFU OTA using BLE, so the update process can be - * done through an already existing bond. - * - * @note The application must make sure that all SuperVisor Calls (SVC) are forwarded to the - * bootloader to ensure correct behavior. Forwarding of SVCs to the bootloader is - * done using the SoftDevice SVC @ref sd_softdevice_vector_table_base_set with the value - * present in @c NRF_UICR->NRFFW[0]. - */ - -#ifndef DFU_BLE_SVC_H__ -#define DFU_BLE_SVC_H__ - -#include "nrf_svc.h" -#include -#include "nrf_ble_gap.h" -#include "nrf.h" -#include "nrf_soc.h" -#include "nrf_error_sdm.h" - -#define BOOTLOADER_SVC_BASE 0x0 /**< The number of the lowest SVC number reserved for the bootloader. */ -#define SYSTEM_SERVICE_ATT_SIZE 8 /**< Size of the system service attribute length including CRC-16 at the end. */ - -/**@brief The SVC numbers used by the SVC functions in the SoC library. */ -enum BOOTLOADER_SVCS -{ - DFU_BLE_SVC_PEER_DATA_SET = BOOTLOADER_SVC_BASE, /**< SVC number for the setting of peer data call. */ - BOOTLOADER_SVC_LAST -}; - -/**@brief DFU Peer data structure. - * - * @details This structure contains peer data needed for connection to a bonded device during DFU. - * The peer data must be provided by the application to the bootloader during buttonless - * update. See @ref dfu_ble_svc_peer_data_set. It contains bond information about the - * desired DFU peer. - */ -typedef struct -{ - ble_gap_addr_t addr; /**< BLE GAP address of the device that initiated the DFU process. */ - ble_gap_irk_t irk; /**< IRK of the device that initiated the DFU process if this device uses Private Resolvable Addresses. */ - ble_gap_enc_key_t enc_key; /**< Encryption key structure containing encrypted diversifier and LTK for re-establishing the bond. */ - uint8_t sys_serv_attr[SYSTEM_SERVICE_ATT_SIZE]; /**< System service attributes for restoring of Service Changed Indication setting in DFU mode. */ -} dfu_ble_peer_data_t; - -/**@brief SVC Function for setting peer data containing address, IRK, and LTK to establish bonded - * connection in DFU mode. - * - * @param[in] p_peer_data Pointer to the peer data containing keys for the connection. - * - * @retval NRF_ERROR_NULL If a NULL pointer was provided as argument. - * @retval NRF_SUCCESS If the function completed successfully. - */ -SVCALL(DFU_BLE_SVC_PEER_DATA_SET, uint32_t, dfu_ble_svc_peer_data_set(dfu_ble_peer_data_t * p_peer_data)); - -#endif // DFU_BLE_SVC_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init.h deleted file mode 100644 index a567576d4e..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2014 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup nrf_dfu_init Init packet handling in DFU - * @{ - * - * @brief Device Firmware Update module type and function declaration for init packet handling. - * - * @details This header contains basic functionality for performing safety checks on software - * updates for \nRFXX based devices. It provides a skeleton for pre-checking an init packet - * to ensure the following image is compatible with this device. A safety check should - * always be performed to prevent accidental flashing of unsupported applications or a - * wrong combination of application and SoftDevice. - * The device information contains information such as: - * - Device type (2 bytes), for example Heart Rate. The device type is a number defined by - * the customer. It can be located in UICR or FICR. - * - Device revision (2 bytes), for example major revision 1, minor revision 0. The device - * revision is a number defined by the customer. It can be located in UICR or FICR. - * - List of SoftDevices supported by this application, for example - * 0x0049 = S110v6_0_0 - * 0xFFFE = S110 development (any SoftDevice accepted), - * - CRC or hash of firmware image - * - * @note This module does not support security features such as image signing, but the corresponding - * implementation allows for such extensions. - * If the init packet is signed by a trusted source, it must be decrypted before it can be - * processed. - */ - -#ifndef DFU_INIT_H__ -#define DFU_INIT_H__ - -#include -#include "nrf.h" - -/**@brief Structure contained in an init packet. Contains information on device type, revision, and - * supported SoftDevices. - */ -typedef struct -{ - uint16_t device_type; /**< Device type (2 bytes), for example Heart Rate. This number must be defined by the customer before production. It can be located in UICR or FICR. */ - uint16_t device_rev; /**< Device revision (2 bytes), for example major revision 1, minor revision 0. This number must be defined by the customer before production. It can be located in UICR or FICR. */ - uint32_t app_version; /**< Application version for the image software. This field allows for additional checking, for example ensuring that a downgrade is not allowed. */ - uint16_t softdevice_len; /**< Number of different SoftDevice revisions compatible with this application. The list of SoftDevice firmware IDs is defined in @ref softdevice. */ - uint16_t softdevice[1]; /**< Variable length array of SoftDevices compatible with this application. The length of the array is specified in the length field. SoftDevice firmware id 0xFFFE indicates any SoftDevice. */ -} dfu_init_packet_t; - -/**@brief Structure holding basic device information settings. - */ -typedef struct -{ - uint16_t device_type; /**< Device type (2 bytes), for example Heart Rate. This number must be defined by the customer before production. It can be located in UICR or FICR. */ - uint16_t device_rev; /**< Device revision (2 bytes), for example major revision 1, minor revision 0. This number must be defined by the customer before production. It can be located in UICR or FICR. */ -} dfu_device_info_t; - -/** The device info offset can be modified to place the device info settings at a different location. - * If the customer reserved UICR location is used for other application specific data, the offset - * must be updated to avoid collision with that data. - */ -/** [DFU UICR DEV offset] */ -#define UICR_CUSTOMER_DEVICE_INFO_OFFSET 0x0 /**< Device info offset inside the customer UICR reserved area. Customers may change this value to place the device information in a user-preferred location. */ -/** [DFU UICR DEV offset] */ - -#define UICR_CUSTOMER_RESERVED_OFFSET 0x80 /**< Customer reserved area in the UICR. The area from UICR + 0x80 is reserved for customer usage. */ -#define DFU_DEVICE_INFO_BASE (NRF_UICR_BASE + \ - UICR_CUSTOMER_RESERVED_OFFSET + \ - UICR_CUSTOMER_DEVICE_INFO_OFFSET) /**< The device information base address inside of UICR. */ -#define DFU_DEVICE_INFO ((dfu_device_info_t *)DFU_DEVICE_INFO_BASE) /**< The memory mapped structure for device information data. */ - -#define DFU_DEVICE_TYPE_EMPTY ((uint16_t)0xFFFF) /**< Mask indicating no device type is present in UICR. 0xFFFF is default flash pattern when not written with data. */ -#define DFU_DEVICE_REVISION_EMPTY ((uint16_t)0xFFFF) /**< Mask indicating no device revision is present in UICR. 0xFFFF is default flash pattern when not written with data. */ -#define DFU_SOFTDEVICE_ANY ((uint16_t)0xFFFE) /**< Mask indicating that any SoftDevice is allowed for updating this application. Allows for easy development. Not to be used in production images. */ - - -/**@brief DFU prevalidate call for pre-checking the received init packet. - * - * @details Pre-validation will safety check the firmware image to be transfered in second stage. - * The function currently checks the device type, device revision, application firmware - * version, and supported SoftDevices. More checks should be added according to - * customer-specific requirements. - * - * @param[in] p_init_data Pointer to the init packet. If the init packet is encrypted or signed, - * it must first be decrypted before being checked. - * @param[in] init_data_len Length of the init data. - * - * @retval NRF_SUCCESS If the pre-validation succeeded, that means the image is - * supported by the device and it is considered to come from a - * trusted source (signing). - * @retval NRF_ERROR_INVALID_DATA If the pre-validation failed, that means the image is not - * supported by the device or comes from an un-trusted source - * (signing). - * @retval NRF_ERROR_INVALID_LENGTH If the size of the init packet is not within the limits of - * the init packet handler. - */ -uint32_t dfu_init_prevalidate(uint8_t * p_init_data, uint32_t init_data_len); - -/**@brief DFU postvalidate call for post-checking the received image using the init packet. - * - * @details Post-validation can verify the integrity check the firmware image received before - * activating the image. - * Checks performed can be: - * - A simple CRC as shown in the corresponding implementation of this API in the file - * dfu_init_template.c - * - A hash for better verification of the image. - * - A signature to ensure the image originates from a trusted source. - * Checks are intended to be expanded for customer-specific requirements. - * - * @param[in] p_image Pointer to the received image. The init data provided in the call - * \ref dfu_init_prevalidate will be used for validating the image. - * @param[in] image_len Length of the image data. - * - * @retval NRF_SUCCESS If the post-validation succeeded, that meant the integrity of the - * image has been verified and the image originates from a trusted - * source (signing). - * @retval NRF_ERROR_INVALID_DATA If the post-validation failed, that meant the post check of the - * image failed such as the CRC is not matching the image transfered - * or the verification of the image fails (signing). - */ -uint32_t dfu_init_postvalidate(uint8_t * p_image, uint32_t image_len); - -#endif // DFU_INIT_H__ - -/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init_template.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init_template.c deleted file mode 100644 index cb9e145455..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_init_template.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2014 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup nrf_dfu_init_template Template file with an DFU init packet handling example. - * @{ - * - * @ingroup nrf_dfu - * - * @brief This file contains a template on how to implement DFU init packet handling. - * - * @details The template shows how device type and revision can be used for a safety check of the - * received image. It shows how validation can be performed in two stages: - * - Stage 1: Pre-check of firmware image before transfer to ensure the firmware matches: - * - Device Type. - * - Device Revision. - * Installed SoftDevice. - * This template can be extended with additional checks according to needs. - * For example, such a check could be the origin of the image (trusted source) - * based on a signature scheme. - * - Stage 2: Post-check of the image after image transfer but before installing firmware. - * For example, such a check could be an integrity check in form of hashing or - * verification of a signature. - * In this template, a simple CRC check is carried out. - * The CRC check can be replaced with other mechanisms, like signing. - * - * @note This module does not support security features such as image signing, but the - * implementation allows for such extension. - * If the init packet is signed by a trusted source, it must be decrypted before it can be - * processed. - */ - -#include "dfu_init.h" -#include -#include -#include -#include "nrf_error.h" -#include "crc16.h" - -#define DFU_INIT_PACKET_EXT_LENGTH_MIN 2 //< Minimum length of the extended init packet. The extended init packet may contain a CRC, a HASH, or other data. This value must be changed according to the requirements of the system. The template uses a minimum value of two in order to hold a CRC. */ -#define DFU_INIT_PACKET_EXT_LENGTH_MAX 10 //< Maximum length of the extended init packet. The extended init packet may contain a CRC, a HASH, or other data. This value must be changed according to the requirements of the system. The template uses a maximum value of 10 in order to hold a CRC and any padded data on transport layer without overflow. */ - -static uint8_t m_extended_packet[DFU_INIT_PACKET_EXT_LENGTH_MAX]; //< Data array for storage of the extended data received. The extended data follows the normal init data of type \ref dfu_init_packet_t. Extended data can be used for a CRC, hash, signature, or other data. */ -static uint8_t m_extended_packet_length; //< Length of the extended data received with init packet. */ - - -uint32_t dfu_init_prevalidate(uint8_t * p_init_data, uint32_t init_data_len) -{ - uint32_t i = 0; - - // In order to support signing or encryption then any init packet decryption function / library - // should be called from here or implemented at this location. - - // Length check to ensure valid data are parsed. - if (init_data_len < sizeof(dfu_init_packet_t)) - { - return NRF_ERROR_INVALID_LENGTH; - } - - // Current template uses clear text data so they can be casted for pre-check. - dfu_init_packet_t * p_init_packet = (dfu_init_packet_t *)p_init_data; - - m_extended_packet_length = ((uint32_t)p_init_data + init_data_len) - - (uint32_t)&p_init_packet->softdevice[p_init_packet->softdevice_len]; - if (m_extended_packet_length < DFU_INIT_PACKET_EXT_LENGTH_MIN) - { - return NRF_ERROR_INVALID_LENGTH; - } - - if (((uint32_t)p_init_data + init_data_len) < - (uint32_t)&p_init_packet->softdevice[p_init_packet->softdevice_len]) - { - return NRF_ERROR_INVALID_LENGTH; - } - - memcpy(m_extended_packet, - &p_init_packet->softdevice[p_init_packet->softdevice_len], - m_extended_packet_length); - -/** [DFU init application version] */ - // To support application versioning, this check should be updated. - // This template allows for any application to be installed. However, - // customers can place a revision number at the bottom of the application - // to be verified by the bootloader. This can be done at a location - // relative to the application, for example the application start - // address + 0x0100. -/** [DFU init application version] */ - - // First check to verify the image to be transfered matches the device type. - // If no Device type is present in DFU_DEVICE_INFO then any image will be accepted. - if ((DFU_DEVICE_INFO->device_type != DFU_DEVICE_TYPE_EMPTY) && - (p_init_packet->device_type != DFU_DEVICE_INFO->device_type)) - { - return NRF_ERROR_INVALID_DATA; - } - - // Second check to verify the image to be transfered matches the device revision. - // If no Device revision is present in DFU_DEVICE_INFO then any image will be accepted. - if ((DFU_DEVICE_INFO->device_rev != DFU_DEVICE_REVISION_EMPTY) && - (p_init_packet->device_rev != DFU_DEVICE_INFO->device_rev)) - { - return NRF_ERROR_INVALID_DATA; - } - - // Third check: Check the array of supported SoftDevices by this application. - // If the installed SoftDevice does not match any SoftDevice in the list then an - // error is returned. - while (i < p_init_packet->softdevice_len) - { - if (p_init_packet->softdevice[i] == DFU_SOFTDEVICE_ANY || - p_init_packet->softdevice[i++] == SD_FWID_GET(MBR_SIZE)) - { - return NRF_SUCCESS; - } - } - - // No matching SoftDevice found - Return NRF_ERROR_INVALID_DATA. - return NRF_ERROR_INVALID_DATA; -} - - -uint32_t dfu_init_postvalidate(uint8_t * p_image, uint32_t image_len) -{ - uint16_t image_crc; - uint16_t received_crc; - - // In order to support hashing (and signing) then the (decrypted) hash should be fetched and - // the corresponding hash should be calculated over the image at this location. - // If hashing (or signing) is added to the system then the CRC validation should be removed. - - // calculate CRC from active block. - image_crc = crc16_compute(p_image, image_len, NULL); - - // Decode the received CRC from extended data. - received_crc = uint16_decode((uint8_t *)&m_extended_packet[0]); - - // Compare the received and calculated CRC. - if (image_crc != received_crc) - { - return NRF_ERROR_INVALID_DATA; - } - - return NRF_SUCCESS; -} - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_types.h deleted file mode 100644 index 7a7421d878..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/dfu_types.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup nrf_dfu_types Types and definitions. - * @{ - * - * @ingroup nrf_dfu - * - * @brief Device Firmware Update module type and definitions. - */ - -#ifndef DFU_TYPES_H__ -#define DFU_TYPES_H__ - -#include -#include "nrf_sdm.h" -#include "nrf_mbr.h" -#include "nrf.h" -#include "app_util.h" - -#define NRF_UICR_BOOT_START_ADDRESS (NRF_UICR_BASE + 0x14) /**< Register where the bootloader start address is stored in the UICR register. */ - -#if defined(NRF52) -#define NRF_UICR_MBR_PARAMS_PAGE_ADDRESS (NRF_UICR_BASE + 0x18) /**< Register where the mbr params page is stored in the UICR register. (Only in use in nRF52 MBR).*/ -#endif - -#define CODE_REGION_1_START SD_SIZE_GET(MBR_SIZE) /**< This field should correspond to the size of Code Region 0, (which is identical to Start of Code Region 1), found in UICR.CLEN0 register. This value is used for compile safety, as the linker will fail if application expands into bootloader. Runtime, the bootloader will use the value found in UICR.CLEN0. */ -#define SOFTDEVICE_REGION_START MBR_SIZE /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */ - -#ifdef NRF51 - -#define CODE_PAGE_SIZE 0x0400 /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */ - -#ifdef SIGNING - -#define BOOTLOADER_REGION_START 0x00039C00 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */ -#define BOOTLOADER_SETTINGS_ADDRESS 0x0003D800 /**< The field specifies the page location of the bootloader settings address. */ - -#else - -#define BOOTLOADER_REGION_START 0x0003C000 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */ -#define BOOTLOADER_SETTINGS_ADDRESS 0x0003FC00 /**< The field specifies the page location of the bootloader settings address. */ - -#endif - - - -#elif NRF52 - -#define BOOTLOADER_REGION_START 0x0007A000 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */ -#define BOOTLOADER_SETTINGS_ADDRESS 0x0007F000 /**< The field specifies the page location of the bootloader settings address. */ -#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x0007E000 /**< The field specifies the page location of the mbr params page address. */ - -#define CODE_PAGE_SIZE 0x1000 /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */ - -#else - -#error No target defined - -#endif - -#define DFU_REGION_TOTAL_SIZE (BOOTLOADER_REGION_START - CODE_REGION_1_START) /**< Total size of the region between SD and Bootloader. */ - -#ifndef DFU_APP_DATA_RESERVED -#define DFU_APP_DATA_RESERVED CODE_PAGE_SIZE * 0 /**< Size of Application Data that must be preserved between application updates. This value must be a multiple of page size. Page size is 0x400 (1024d) bytes, thus this value must be 0x0000, 0x0400, 0x0800, 0x0C00, 0x1000, etc. */ -#endif - -#define DFU_IMAGE_MAX_SIZE_FULL (DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED) /**< Maximum size of an application, excluding save data from the application. */ - -#define DFU_IMAGE_MAX_SIZE_BANKED (((DFU_IMAGE_MAX_SIZE_FULL) - \ - (DFU_IMAGE_MAX_SIZE_FULL % (2 * CODE_PAGE_SIZE)))/2) /**< Maximum size of an application, excluding save data from the application. */ - -#define DFU_BL_IMAGE_MAX_SIZE (BOOTLOADER_SETTINGS_ADDRESS - BOOTLOADER_REGION_START) /**< Maximum size of a bootloader, excluding save data from the current bootloader. */ - -#define DFU_BANK_0_REGION_START CODE_REGION_1_START /**< Bank 0 region start. */ -#define DFU_BANK_1_REGION_START (DFU_BANK_0_REGION_START + DFU_IMAGE_MAX_SIZE_BANKED) /**< Bank 1 region start. */ - -#define EMPTY_FLASH_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */ - -#define INVALID_PACKET 0x00 /**< Invalid packet identifies. */ -#define INIT_PACKET 0x01 /**< Packet identifies for initialization packet. */ -#define STOP_INIT_PACKET 0x02 /**< Packet identifies for stop initialization packet. Used when complete init packet has been received so that the init packet can be used for pre validaiton. */ -#define START_PACKET 0x03 /**< Packet identifies for the Data Start Packet. */ -#define DATA_PACKET 0x04 /**< Packet identifies for a Data Packet. */ -#define STOP_DATA_PACKET 0x05 /**< Packet identifies for the Data Stop Packet. */ - -#define DFU_UPDATE_SD 0x01 /**< Bit field indicating update of SoftDevice is ongoing. */ -#define DFU_UPDATE_BL 0x02 /**< Bit field indicating update of bootloader is ongoing. */ -#define DFU_UPDATE_APP 0x04 /**< Bit field indicating update of application is ongoing. */ - -#define DFU_INIT_RX 0x00 /**< Op Code identifies for receiving init packet. */ -#define DFU_INIT_COMPLETE 0x01 /**< Op Code identifies for transmission complete of init packet. */ - -// Safe guard to ensure during compile time that the DFU_APP_DATA_RESERVED is a multiple of page size. -STATIC_ASSERT((((DFU_APP_DATA_RESERVED) & (CODE_PAGE_SIZE - 1)) == 0x00)); - -/**@brief Structure holding a start packet containing update mode and image sizes. - */ -typedef struct -{ - uint8_t dfu_update_mode; /**< Packet type, used to identify the content of the received packet referenced by data packet. */ - uint32_t sd_image_size; /**< Size of the SoftDevice image to be transferred. Zero if no SoftDevice image will be transfered. */ - uint32_t bl_image_size; /**< Size of the Bootloader image to be transferred. Zero if no Bootloader image will be transfered. */ - uint32_t app_image_size; /**< Size of the application image to be transmitted. Zero if no Bootloader image will be transfered. */ -} dfu_start_packet_t; - -/**@brief Structure holding a bootloader init/data packet received. - */ -typedef struct -{ - uint32_t packet_length; /**< Packet length of the data packet. Each data is word size, meaning length of 4 is 4 words, not bytes. */ - uint32_t * p_data_packet; /**< Data Packet received. Each data is a word size entry. */ -} dfu_data_packet_t; - -/**@brief Structure for holding dfu update packet. Packet type indicate the type of packet. - */ -typedef struct -{ - uint32_t packet_type; /**< Packet type, used to identify the content of the received packet referenced by data packet. */ - union - { - dfu_data_packet_t data_packet; /**< Used when packet type is INIT_PACKET or DATA_PACKET. Packet contains data received for init or data. */ - dfu_start_packet_t * start_packet; /**< Used when packet type is START_DATA_PACKET. Will contain information on software to be updtaed, i.e. SoftDevice, Bootloader and/or Application along with image sizes. */ - } params; -} dfu_update_packet_t; - -/**@brief DFU status error codes. -*/ -typedef enum -{ - DFU_UPDATE_APP_COMPLETE, /**< Status update of application complete.*/ - DFU_UPDATE_SD_COMPLETE, /**< Status update of SoftDevice update complete. Note that this solely indicates that a new SoftDevice has been received and stored in bank 0 and 1. */ - DFU_UPDATE_SD_SWAPPED, /**< Status update of SoftDevice update complete. Note that this solely indicates that a new SoftDevice has been received and stored in bank 0 and 1. */ - DFU_UPDATE_BOOT_COMPLETE, /**< Status update complete.*/ - DFU_BANK_0_ERASED, /**< Status bank 0 erased.*/ - DFU_TIMEOUT, /**< Status timeout.*/ - DFU_RESET /**< Status Reset to indicate current update procedure has been aborted and system should reset. */ -} dfu_update_status_code_t; - -/**@brief Structure holding DFU complete event. -*/ -typedef struct -{ - dfu_update_status_code_t status_code; /**< Device Firmware Update status. */ - uint16_t app_crc; /**< CRC of the recieved application. */ - uint32_t sd_size; /**< Size of the recieved SoftDevice. */ - uint32_t bl_size; /**< Size of the recieved BootLoader. */ - uint32_t app_size; /**< Size of the recieved Application. */ - uint32_t sd_image_start; /**< Location in flash where the received SoftDevice image is stored. */ -} dfu_update_status_t; - -/**@brief Update complete handler type. */ -typedef void (*dfu_complete_handler_t)(dfu_update_status_t dfu_update_status); - -#endif // DFU_TYPES_H__ - -/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_transport_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_transport_config.h deleted file mode 100644 index 8b7a4f41c2..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader_dfu/hci_transport/hci_transport_config.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup ble_sdk_bootloader_hci_congfig HCI Transport Layer Configuration - * @{ - * @ingroup dfu_bootloader_api - * @brief Definition of HCI Transport Layer configurable parameters - */ - -#ifndef HCI_TRANSPORT_CONFIG_H__ -#define HCI_TRANSPORT_CONFIG_H__ - -#include "boards.h" /**< Default include for boards.h which means that default pin numbers will be used for RX, TX, CTS, and RTS on the UART. Other pin number can be used if desired. */ - -/** This section covers configurable parameters for the HCI Transport SLIP layer. */ -#define HCI_SLIP_UART_RX_PIN_NUMBER RX_PIN_NUMBER /**< Defines the UART RX pin number. The default pin for the board is chosen, but can be overwritten. */ - -#define HCI_SLIP_UART_TX_PIN_NUMBER TX_PIN_NUMBER /**< Defines the UART TX pin number. The default pin for the board is chosen, but can be overwritten. */ - -#define HCI_SLIP_UART_RTS_PIN_NUMBER RTS_PIN_NUMBER /**< Defines the UART RTS pin number. The default pin for the board is chosen, but can be overwritten. */ - -#define HCI_SLIP_UART_CTS_PIN_NUMBER CTS_PIN_NUMBER /**< Defines the UART CTS pin number. The default pin for the board is chosen, but can be overwritten. */ - -#define HCI_SLIP_UART_MODE APP_UART_FLOW_CONTROL_DISABLED /**< Defines the UART mode to be used. Use UART Low Power with Flow Control - Valid values are defined in \ref app_uart_flow_control_t. For further information on the UART Low Power mode, please refer to: \ref app_uart . */ - -#define HCI_SLIP_UART_BAUDRATE UART_BAUDRATE_BAUDRATE_Baud38400 /**< Defines the UART Baud rate. Default is 38400 baud. */ - -/** This section covers configurable parameters for the HCI Transport layer that are used for calculating correct value for the retransmission timer timeout. */ -#define MAX_PACKET_SIZE_IN_BITS 8000u /**< Maximum size of a single application packet in bits. */ -#define USED_BAUD_RATE 38400u /**< The used uart baudrate. */ - -#endif // HCI_TRANSPORT_CONFIG_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.c index 76180a86e8..e00395a917 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.c @@ -35,8 +35,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(CRC16) #include "crc16.h" #include @@ -56,3 +56,4 @@ uint16_t crc16_compute(uint8_t const * p_data, uint32_t size, uint16_t const * p return crc; } +#endif //NRF_MODULE_ENABLED(CRC16) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.h index d57197ed9c..20e203f7be 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc16/crc16.h @@ -36,22 +36,25 @@ * */ - /** @file * - * @defgroup crc_compute CRC compute + * @defgroup crc16 CRC16 compute * @{ * @ingroup hci_transport * * @brief This module implements CRC-16-CCITT (polynomial 0x1021) with 0xFFFF initial value. * The data can be passed in multiple blocks. */ - + #ifndef CRC16_H__ #define CRC16_H__ #include +#ifdef __cplusplus +extern "C" { +#endif + /**@brief Function for calculating CRC-16 in blocks. * * Feed each consecutive data block into this function, along with the current value of p_crc as @@ -66,6 +69,11 @@ */ uint16_t crc16_compute(uint8_t const * p_data, uint32_t size, uint16_t const * p_crc); + +#ifdef __cplusplus +} +#endif + #endif // CRC16_H__ - + /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/experimental_section_vars/section_vars.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/experimental_section_vars/section_vars.h index abd489b06c..1479db5c80 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/experimental_section_vars/section_vars.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/experimental_section_vars/section_vars.h @@ -36,10 +36,13 @@ * */ - #ifndef SECTION_VARS_H__ #define SECTION_VARS_H__ +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup section_vars Section variables @@ -49,6 +52,7 @@ * @brief Section variables. */ + #if defined(__ICCARM__) // Enable IAR language extensions #pragma language=extended @@ -56,33 +60,13 @@ // Macro to delay macro expansion. -#define NRF_PRAGMA(x) _Pragma(#x) +#define NRF_PRAGMA(x) _Pragma(#x) -/**@brief Macro to register a named section. - * - * @param[in] section_name Name of the section to register. - */ -#if defined(__CC_ARM) - -// Not required by this compiler. -#define NRF_SECTION_VARS_REGISTER_SECTION(section_name) - -#elif defined(__GNUC__) - -// Not required by this compiler. -#define NRF_SECTION_VARS_REGISTER_SECTION(section_name) - -#elif defined(__ICCARM__) - -#define NRF_SECTION_VARS_REGISTER_SECTION(section_name) NRF_PRAGMA(section = #section_name) - -#endif +//lint -save -e27 Illegal character (0x24) -/*lint -save -e27 */ - -/**@brief Macro to obtain the linker symbol for the beginning of a given section. +/**@brief Macro to obtain the symbol marking the beginning of a given section. * * @details The symbol that this macro resolves to is used to obtain a section start address. * @@ -103,9 +87,9 @@ #endif -/**@brief Macro to obtain the linker symbol for the end of a given section. +/**@brief Macro to obtain the symbol marking the end of a given section. * - * @details The symbol that this macro resolves to is used to obtain a section end address. + * @details The symbol that this macro resolves to is used to obtain a section stop address. * * @param[in] section_name Name of the section. */ @@ -123,7 +107,8 @@ #endif -/*lint -restore */ + +//lint -restore /**@brief Macro for retrieving the length of a given section, in bytes. @@ -146,9 +131,9 @@ ((uint32_t)NRF_SECTION_VARS_END_SYMBOL(section_name) - (uint32_t)NRF_SECTION_VARS_START_SYMBOL(section_name)) #endif - -/**@brief Macro to obtain the start address of a named section. + +/**@brief Macro to obtain the address of the beginning of a section. * * param[in] section_name Name of the section. */ @@ -166,8 +151,8 @@ #endif - -/*@brief Macro to obtain the end address of a named section. + +/**@brief Macro to obtain the address of end of a section. * * @param[in] section_name Name of the section. */ @@ -186,105 +171,112 @@ #endif -/**@brief Macro to extern a named section start and stop symbols. +//lint -save -e19 -esym(526, fs_dataBase) -esym(526, fs_dataLimit) -esym(526, dfu_transBase) -esym(526, dfu_transLimit) + +/**@brief Macro to create a section to register variables in. * - * @note These declarations are required for GCC and Keil linkers (but not for IAR's). - * - * @param[in] type_name Name of the type stored in the section. + * @param[in] data_type The data type of the variables to be registered in the section. * @param[in] section_name Name of the section. + * + * @warning The data type must be word aligned to prevent padding. */ #if defined(__CC_ARM) -#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name) \ - extern type_name * NRF_SECTION_VARS_START_SYMBOL(section_name); \ +#define NRF_SECTION_VARS_CREATE_SECTION(section_name, data_type) \ + extern data_type * NRF_SECTION_VARS_START_SYMBOL(section_name); \ extern void * NRF_SECTION_VARS_END_SYMBOL(section_name) #elif defined(__GNUC__) -#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name) \ - extern type_name * NRF_SECTION_VARS_START_SYMBOL(section_name); \ +#define NRF_SECTION_VARS_CREATE_SECTION(section_name, data_type) \ + extern data_type * NRF_SECTION_VARS_START_SYMBOL(section_name); \ extern void * NRF_SECTION_VARS_END_SYMBOL(section_name) #elif defined(__ICCARM__) // No symbol registration required for IAR. -#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name) \ +#define NRF_SECTION_VARS_CREATE_SECTION(section_name, data_type) \ + NRF_PRAGMA(section = #section_name); \ extern void * iar_ ## section_name ## _start = __section_begin(#section_name); \ extern void * iar_ ## section_name ## _end = __section_end(#section_name) #endif +//lint -restore -/**@brief Macro to declare a variable to be placed in a named section. + +/**@brief Macro to declare a variable and register it in a section. * - * @details Declares a variable to be placed in a named section. This macro ensures that its symbol - * is not stripped by the linker because of optimizations. + * @details Declares a variable and registers it in a named section. This macro ensures that the + * variable is not stripped away when using optimizations. * - * @warning The order with which variables are placed in a section is implementation dependant. - * Generally, variables are placed in a section depending on the order with which they - * are found by the linker. - * - * @warning The symbols added in the named section must be word aligned to prevent padding. + * @note The order with which variables are placed in a section is dependant on the order with + * which the linker encouters the variables during linking. * * @param[in] section_name Name of the section. - * @param[in] type_def Datatype of the variable to place in the given section. + * @param[in] section_var The variable to register in the given section. */ #if defined(__CC_ARM) - -#define NRF_SECTION_VARS_ADD(section_name, type_def) \ - static type_def __attribute__ ((section(#section_name))) __attribute__((used)) + +#define NRF_SECTION_VARS_REGISTER_VAR(section_name, section_var) \ + static section_var __attribute__ ((section(#section_name))) __attribute__((used)) #elif defined(__GNUC__) -#define NRF_SECTION_VARS_ADD(section_name, type_def) \ - static type_def __attribute__ ((section("."#section_name))) __attribute__((used)) +#define NRF_SECTION_VARS_REGISTER_VAR(section_name, section_var) \ + static section_var __attribute__ ((section("."#section_name))) __attribute__((used)) #elif defined(__ICCARM__) -#define NRF_SECTION_VARS_ADD(section_name, type_def) \ - __root type_def @ #section_name +#define NRF_SECTION_VARS_REGISTER_VAR(section_name, section_var) \ + __root section_var @ #section_name #endif -/**@brief Macro to get symbol from named section. +/**@brief Macro to retrieve a variable from a section. * - * @warning The stored symbol can only be resolved using this macro if the - * type of the data is word aligned. The operation of acquiring - * the stored symbol relies on sizeof of the stored type, no - * padding can exist in the named section in between individual + * @warning The stored symbol can only be resolved using this macro if the + * type of the data is word aligned. The operation of acquiring + * the stored symbol relies on sizeof of the stored type, no + * padding can exist in the named section in between individual * stored items or this macro will fail. * - * @param[in] i Index of item in section. - * @param[in] type_name Type name of item in section. + * @param[in] i Index of the variable in section. + * @param[in] data_type Data type of the variable. * @param[in] section_name Name of the section. */ #if defined(__CC_ARM) -#define NRF_SECTION_VARS_GET(i, type_name, section_name) \ - (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name)) - +#define NRF_SECTION_VARS_GET(i, data_type, section_name) \ + (data_type*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(data_type)) + #elif defined(__GNUC__) -#define NRF_SECTION_VARS_GET(i, type_name, section_name) \ - (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name)) - +#define NRF_SECTION_VARS_GET(i, data_type, section_name) \ + (data_type*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(data_type)) + #elif defined(__ICCARM__) -#define NRF_SECTION_VARS_GET(i, type_name, section_name) \ - (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name)) +#define NRF_SECTION_VARS_GET(i, data_type, section_name) \ + (data_type*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(data_type)) #endif -/**@brief Macro to get number of items in named section. +/**@brief Macro to get number of variables registered in a section. * - * @param[in] type_name Type name of item in section. + * @param[in] data_type Data type of the variables in the section. * @param[in] section_name Name of the section. */ -#define NRF_SECTION_VARS_COUNT(type_name, section_name) \ - NRF_SECTION_VARS_LENGTH(section_name) / sizeof(type_name) +#define NRF_SECTION_VARS_COUNT(data_type, section_name) \ + NRF_SECTION_VARS_LENGTH(section_name) / sizeof(data_type) /** @} */ + +#ifdef __cplusplus +} +#endif + #endif // SECTION_VARS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c index 309a306d0d..fc61dbeb5a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.c @@ -35,17 +35,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(FDS) #include "fds.h" -#include "fds_config.h" #include "fds_internal_defs.h" #include #include #include #include "fstorage.h" -#include "app_util.h" #include "nrf_error.h" #if defined(FDS_CRC_ENABLED) @@ -328,7 +326,7 @@ static ret_code_t page_tag_write_swap() { // Needs to be statically allocated since it will be written to flash. static uint32_t const page_tag_swap[] = {FDS_PAGE_TAG_MAGIC, FDS_PAGE_TAG_SWAP}; - return fs_store(&fs_config, m_swap_page.p_addr, page_tag_swap, FDS_PAGE_TAG_SIZE); + return fs_store(&fs_config, m_swap_page.p_addr, page_tag_swap, FDS_PAGE_TAG_SIZE, NULL); } @@ -337,7 +335,7 @@ static ret_code_t page_tag_write_data(uint32_t const * const p_page_addr) { // Needs to be statically allocated since it will be written to flash. static uint32_t const page_tag_data[] = {FDS_PAGE_TAG_MAGIC, FDS_PAGE_TAG_DATA}; - return fs_store(&fs_config, p_page_addr, page_tag_data, FDS_PAGE_TAG_SIZE); + return fs_store(&fs_config, p_page_addr, page_tag_data, FDS_PAGE_TAG_SIZE, NULL); } @@ -551,12 +549,10 @@ static void dirty_records_stat(uint16_t page, if (!header_is_valid(p_header)) { (*p_dirty_records) += 1; - (*p_word_count) += p_header->tl.length_words; - } - else - { - p_rec += (FDS_HEADER_SIZE + (p_header->tl.length_words)); + (*p_word_count) += FDS_HEADER_SIZE + p_header->tl.length_words; } + + p_rec += (FDS_HEADER_SIZE + (p_header->tl.length_words)); } } @@ -666,6 +662,7 @@ static fds_init_opts_t pages_init() uint32_t ret = NO_PAGES; // The index of the page being initialized in m_pages[]. uint16_t page = 0; + bool swap_set_but_not_found = false; for (uint16_t i = 0; i < FDS_VIRTUAL_PAGES; i++) { @@ -695,10 +692,16 @@ static fds_init_opts_t pages_init() // If there is no swap page yet, use this one. m_swap_page.p_addr = p_page_addr; m_swap_page.write_offset = FDS_PAGE_TAG_SIZE; + swap_set_but_not_found = true; } ret |= PAGE_ERASED; } + else + { + // Do not initialize or use this page. + m_pages[page++].page_type = FDS_PAGE_UNDEFINED; + } break; case FDS_PAGE_DATA: @@ -714,6 +717,15 @@ static fds_init_opts_t pages_init() break; case FDS_PAGE_SWAP: + if (swap_set_but_not_found) + { + m_pages[page].page_type = FDS_PAGE_ERASED; + m_pages[page].p_addr = m_swap_page.p_addr; + m_pages[page].write_offset = FDS_PAGE_TAG_SIZE; + + page++; + } + m_swap_page.p_addr = p_page_addr; // If the swap is promoted, this offset should be kept, otherwise, // it should be set to FDS_PAGE_TAG_SIZE. @@ -738,7 +750,7 @@ static ret_code_t record_header_write_begin(fds_op_t * const p_op, uint32_t * co { ret_code_t ret; ret = fs_store(&fs_config, p_addr + FDS_OFFSET_TL, - (uint32_t*)&p_op->write.header.tl, FDS_HEADER_SIZE_TL); + (uint32_t*)&p_op->write.header.tl, FDS_HEADER_SIZE_TL, NULL); // Write the record ID next. p_op->write.step = FDS_OP_WRITE_RECORD_ID; @@ -751,7 +763,7 @@ static ret_code_t record_header_write_id(fds_op_t * const p_op, uint32_t * const { ret_code_t ret; ret = fs_store(&fs_config, p_addr + FDS_OFFSET_ID, - (uint32_t*)&p_op->write.header.record_id, FDS_HEADER_SIZE_ID); + (uint32_t*)&p_op->write.header.record_id, FDS_HEADER_SIZE_ID, NULL); // If this record has zero chunk, write the last part of the header directly. // Otherwise, write the record chunks next. @@ -766,7 +778,7 @@ static ret_code_t record_header_write_finalize(fds_op_t * const p_op, uint32_t * { ret_code_t ret; ret = fs_store(&fs_config, p_addr + FDS_OFFSET_IC, - (uint32_t*)&p_op->write.header.ic, FDS_HEADER_SIZE_IC); + (uint32_t*)&p_op->write.header.ic, FDS_HEADER_SIZE_IC, NULL); // If this is a simple write operation, then this is the last step. // If this is an update instead, delete the old record next. @@ -777,19 +789,26 @@ static ret_code_t record_header_write_finalize(fds_op_t * const p_op, uint32_t * } -static ret_code_t record_header_flag_dirty(uint32_t * const p_record) +static ret_code_t record_header_flag_dirty(uint32_t * const p_record, uint16_t page_to_gc) { // Flag the record as dirty. fs_ret_t ret = fs_store(&fs_config, p_record, - (uint32_t*)&m_fds_tl_dirty, FDS_HEADER_SIZE_TL); + (uint32_t*)&m_fds_tl_dirty, FDS_HEADER_SIZE_TL, NULL); - return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY; + if (ret != FS_SUCCESS) + { + return FDS_ERR_BUSY; + } + + m_pages[page_to_gc].can_gc = true; + + return FDS_SUCCESS; } static ret_code_t record_find_and_delete(fds_op_t * const p_op) { - ret_code_t ret; + ret_code_t ret; uint16_t page; fds_record_desc_t desc = {0}; @@ -808,10 +827,7 @@ static ret_code_t record_find_and_delete(fds_op_t * const p_op) p_op->del.record_key = p_header->tl.record_key; // Flag the record as dirty. - ret = record_header_flag_dirty((uint32_t*)desc.p_record); - - // This page can now be garbage collected. - m_pages[page].can_gc = true; + ret = record_header_flag_dirty((uint32_t*)desc.p_record, page); } else { @@ -838,10 +854,7 @@ static ret_code_t file_find_and_delete(fds_op_t * const p_op) if (ret == FDS_SUCCESS) { // A record was found: flag it as dirty. - ret = record_header_flag_dirty((uint32_t*)desc.p_record); - - // This page can now be garbage collected. - m_pages[tok.page].can_gc = true; + ret = record_header_flag_dirty((uint32_t*)desc.p_record, tok.page); } else // FDS_ERR_NOT_FOUND { @@ -864,7 +877,7 @@ static ret_code_t record_write_chunk(fds_op_t * const p_op, uint32_t * const p_a chunk_queue_get_and_advance(&p_chunk); ret = fs_store(&fs_config, p_addr + p_op->write.chunk_offset, - p_chunk->p_data, p_chunk->length_words); + p_chunk->p_data, p_chunk->length_words, NULL); // Accumulate the offset. p_op->write.chunk_offset += p_chunk->length_words; @@ -953,7 +966,7 @@ static ret_code_t gc_swap_erase(void) m_gc.state = GC_DISCARD_SWAP; m_swap_page.write_offset = FDS_PAGE_TAG_SIZE; - return fs_erase(&fs_config, m_swap_page.p_addr, FDS_PHY_PAGES_IN_VPAGE); + return fs_erase(&fs_config, m_swap_page.p_addr, FDS_PHY_PAGES_IN_VPAGE, NULL); } @@ -966,7 +979,7 @@ static ret_code_t gc_page_erase(void) if (m_pages[gc].records_open == 0) { - ret = fs_erase(&fs_config, m_pages[gc].p_addr, FDS_PHY_PAGES_IN_VPAGE); + ret = fs_erase(&fs_config, m_pages[gc].p_addr, FDS_PHY_PAGES_IN_VPAGE, NULL); m_gc.state = GC_ERASE_PAGE; } else @@ -991,7 +1004,7 @@ static ret_code_t gc_record_copy(void) // Copy the record to swap; it is guaranteed to fit in the destination page, // so there is no need to check its size. This will either succeed or timeout. - return fs_store(&fs_config, p_dest, m_gc.p_record_src, record_len); + return fs_store(&fs_config, p_dest, m_gc.p_record_src, record_len, NULL); } @@ -1156,7 +1169,7 @@ static ret_code_t init_execute(uint32_t prev_ret, fds_op_t * const p_op) break; case FDS_OP_INIT_ERASE_SWAP: - ret = fs_erase(&fs_config, m_swap_page.p_addr, FDS_PHY_PAGES_IN_VPAGE); + ret = fs_erase(&fs_config, m_swap_page.p_addr, FDS_PHY_PAGES_IN_VPAGE, NULL); // If the swap is going to be discarded then reset its write_offset. m_swap_page.write_offset = FDS_PAGE_TAG_SIZE; p_op->init.step = FDS_OP_INIT_TAG_SWAP; @@ -1166,7 +1179,7 @@ static ret_code_t init_execute(uint32_t prev_ret, fds_op_t * const p_op) { // When promoting the swap, keep the write_offset set by pages_init(). ret = page_tag_write_data(m_swap_page.p_addr); - + uint16_t const gc = m_gc.cur_page; uint32_t const * const p_old_swap = m_swap_page.p_addr; @@ -1208,6 +1221,10 @@ static ret_code_t write_execute(uint32_t prev_ret, fds_op_t * const p_op) // This must persist across calls. static fds_record_desc_t desc = {0}; + // When a record is updated, this variable will hold the page where the old + // copy was stored. This will be used to set the can_gc flag when the header is + // invalidated (FDS_OP_WRITE_FLAG_DIRTY). + static uint16_t page; if (prev_ret != FS_SUCCESS) { @@ -1227,8 +1244,6 @@ static ret_code_t write_execute(uint32_t prev_ret, fds_op_t * const p_op) // The first step of updating a record constists of locating the copy to be deleted. // If the old copy couldn't be found for any reason then the update should fail. // This prevents duplicates when queuing multiple updates of the same record. - - uint16_t page; desc.p_record = NULL; desc.record_id = p_op->write.record_to_delete; @@ -1257,7 +1272,7 @@ static ret_code_t write_execute(uint32_t prev_ret, fds_op_t * const p_op) break; case FDS_OP_WRITE_FLAG_DIRTY: - ret = record_header_flag_dirty((uint32_t*)desc.p_record); + ret = record_header_flag_dirty((uint32_t*)desc.p_record, page); p_op->write.step = FDS_OP_WRITE_DONE; break; @@ -2023,7 +2038,7 @@ ret_code_t fds_record_id_from_desc(fds_record_desc_t const * const p_desc, ret_code_t fds_stat(fds_stat_t * const p_stat) { - uint16_t const words_in_page = FDS_PAGE_SIZE - FDS_PAGE_TAG_SIZE; + uint16_t const words_in_page = FDS_PAGE_SIZE; // The largest number of free contiguous words on any page. uint16_t contig_words = 0; @@ -2044,9 +2059,10 @@ ret_code_t fds_stat(fds_stat_t * const p_stat) uint32_t const * p_record = NULL; uint16_t const words_used = m_pages[i].write_offset + m_pages[i].words_reserved; - p_stat->open_records += m_pages[i].records_open; - p_stat->words_used += words_used; - contig_words = (words_in_page - words_used); + p_stat->open_records += m_pages[i].records_open; + p_stat->words_reserved += m_pages[i].words_reserved; + p_stat->words_used += words_used; + contig_words = (words_in_page - words_used); if (contig_words > p_stat->largest_contig) { @@ -2082,4 +2098,4 @@ ret_code_t fds_verify_crc_on_writes(bool enable) } #endif - +#endif //NRF_MODULE_ENABLED(FDS) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h index b655566fab..3021e16619 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds.h @@ -36,12 +36,11 @@ * */ - #ifndef FDS_H__ #define FDS_H__ /** - * @defgroup flash_data_storage Flash Data Storage + * @defgroup fds Flash Data Storage * @ingroup app_common * @{ * @@ -56,6 +55,11 @@ #include #include #include "sdk_errors.h" +#include "app_util_platform.h" + +#ifdef __cplusplus +extern "C" { +#endif /**@brief Invalid file ID. @@ -152,7 +156,7 @@ typedef struct /**@brief Structure that can be used to read the contents of a record stored in flash. * - * This structure does not reflect the physical layout of a record in flash, but it points + * This structure does not reflect the physical layout of a record in flash, but it points * to the locations where the record header (metadata) and the record data are stored. */ typedef struct @@ -164,7 +168,7 @@ typedef struct /**@brief A chunk of record data to be written to flash. * - * @p p_data must be aligned to a word boundary. Make sure to keep it in + * @p p_data must be aligned to a word boundary. Make sure to keep it in * memory until the operation has completed, which is indicated by the respective FDS event. */ typedef struct @@ -226,14 +230,7 @@ typedef enum } fds_evt_id_t; -#if defined(__CC_ARM) - #pragma push - #pragma anon_unions -#elif defined(__ICCARM__) - #pragma language=extended -#elif defined(__GNUC__) - /* anonymous unions are enabled by default */ -#endif +ANON_UNIONS_ENABLE /**@brief An FDS event. */ @@ -271,13 +268,7 @@ typedef struct }; } fds_evt_t; -#if defined(__CC_ARM) - #pragma pop -#elif defined(__ICCARM__) - /* leave anonymous unions enabled */ -#elif defined(__GNUC__) - /* anonymous unions are enabled by default */ -#endif +ANON_UNIONS_DISABLE /**@brief File system statistics. */ @@ -319,7 +310,7 @@ typedef void (*fds_cb_t)(fds_evt_t const * const p_evt); * * The maximum amount of handlers that can be registered can be configured by changing the value * of @ref FDS_MAX_USERS in fds_config.h. - * + * * @param[in] cb The event handler function. * * @retval FDS_SUCCESS If the event handler was registered successfully. @@ -352,6 +343,9 @@ ret_code_t fds_init(void); * If no file with the specified ID exists, it is created. There can be multiple records with the * same record key in a file. * + * Some modules need exclusive use of certain file IDs and record keys. See @ref lib_fds_functionality_keys + * for details. + * * Record data can consist of multiple chunks. The data must be aligned to a 4 byte boundary, and * because it is not buffered internally, it must be kept in memory until the callback for the * operation has been received. The length of the data must not exceed @ref FDS_VIRTUAL_PAGE_SIZE @@ -517,8 +511,8 @@ ret_code_t fds_file_delete(uint16_t file_id); * * This function is asynchronous. Completion is reported through an event that is sent to the * registered event handler function. - * - * @param[in, out] p_desc The descriptor of the record to update. When the function + * + * @param[in, out] p_desc The descriptor of the record to update. When the function * returns with FDS_SUCCESS, this parameter contains the * descriptor of the newly written record. * @param[in] p_record The updated record to be written to flash. @@ -757,4 +751,9 @@ ret_code_t fds_verify_crc_on_writes(bool enabled); /** @} */ + +#ifdef __cplusplus +} +#endif + #endif // FDS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds_internal_defs.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds_internal_defs.h index b7c2e3a3d5..2a2735ffde 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds_internal_defs.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/fds_internal_defs.h @@ -36,19 +36,21 @@ * */ - #ifndef FDS_INTERNAL_DEFS_H__ #define FDS_INTERNAL_DEFS_H__ - +#include "sdk_config.h" #include #include -#include "fds_config.h" #if defined (FDS_THREADS) #include "nrf_soc.h" #include "app_util_platform.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + #define FDS_PAGE_TAG_SIZE (2) // Page tag size, in 4-byte words. #define FDS_PAGE_TAG_WORD_0 (0) // Offset of the first word in the page tag from the page address. #define FDS_PAGE_TAG_WORD_1 (1) // Offset of the second word in the page tag from the page address. @@ -74,9 +76,9 @@ #define FDS_OP_COMPLETED (0x1D1D) // The size of a physical page, in 4-byte words. -#if defined(NRF51) +#if defined(NRF51) #define FDS_PHY_PAGE_SIZE (256) -#elif defined(NRF52) + #elif (defined(NRF52) || defined(NRF52840_XXAA)) #define FDS_PHY_PAGE_SIZE (1024) #endif @@ -329,4 +331,9 @@ typedef struct #endif + +#ifdef __cplusplus +} +#endif + #endif // FDS_INTERNAL_DEFS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.c index 5cf3d8d426..79a9724612 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.c @@ -35,10 +35,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(FSTORAGE) #include "fstorage.h" -#include "fstorage_config.h" #include "fstorage_internal_defs.h" #include @@ -52,7 +51,6 @@ static uint8_t m_flags; // fstorage status flags. static fs_op_queue_t m_queue; // Queue of requested operations. static uint8_t m_retry_count; // Number of times the last flash operation was retried. - // Sends events to the application. static void send_event(fs_op_t const * const p_op, fs_ret_t result) { @@ -77,6 +75,7 @@ static void send_event(fs_op_t const * const p_op, fs_ret_t result) // Should not happen. break; } + evt.p_context = p_op->p_context; p_op->p_config->callback(&evt, result); } @@ -85,14 +84,18 @@ static void send_event(fs_op_t const * const p_op, fs_ret_t result) // Checks that a configuration is non-NULL and within section variable bounds. static bool check_config(fs_config_t const * const config) { +#ifndef DFU_SUPPORT_SIGNING if ((config != NULL) && (FS_SECTION_VARS_START_ADDR <= (uint32_t)config) && (FS_SECTION_VARS_END_ADDR > (uint32_t)config)) { return true; } - + return false; +#else + return true; +#endif } @@ -273,7 +276,7 @@ static bool queue_get_next_free(fs_op_t ** p_op) } idx = ((m_queue.rp + m_queue.count) < FS_QUEUE_SIZE) ? - (m_queue.rp + m_queue.count) : 0; + (m_queue.rp + m_queue.count) : ((m_queue.rp + m_queue.count)-FS_QUEUE_SIZE); m_queue.count++; @@ -288,66 +291,79 @@ static bool queue_get_next_free(fs_op_t ** p_op) fs_ret_t fs_init(void) { - uint32_t const users = FS_SECTION_VARS_COUNT; - uint32_t const * p_current_end = FS_PAGE_END_ADDR; - uint32_t index_max = 0x00; - uint32_t index_last = 0xFFFFFFFF; + uint32_t const total_users = FS_SECTION_VARS_COUNT; + uint32_t configs_to_init = FS_SECTION_VARS_COUNT; + uint32_t const * p_current_end = FS_PAGE_END_ADDR; if (m_flags & FS_FLAG_INITIALIZED) { return FS_SUCCESS; } - #if 0 - // Check for configurations with duplicate priority. - for (uint32_t i = 0; i < users; i++) - { - for (uint32_t j = i + 1; j < users; j++) - { - fs_config_t const * const p_config_i = FS_SECTION_VARS_GET(i); - fs_config_t const * const p_config_j = FS_SECTION_VARS_GET(j); + // Each fstorage user has registered one configuration. + // The total number of users (and thus the total number of configurations) is + // kept in total_users. Some of these users might have specified their flash + // boundaries in their configurations. This function sets the flash boundaries + // for the remaining user configurations without further user interaction. - if (p_config_i->page_order == p_config_j->page_order) - { - // Error. - return FS_ERR_INVALID_CFG; - } + // First, determine how many user configurations this function has to initialize, + // out of the total. This number will be kept in configs_to_init. + + for (uint32_t i = 0; i < total_users; i++) + { + fs_config_t const * const p_config = FS_SECTION_VARS_GET(i); + + if ((p_config->p_start_addr != NULL) && + (p_config->p_end_addr != NULL)) + { + configs_to_init--; } } - #endif - // Assign pages to registered users, beginning with the ones with the highest - // priority, which will be assigned pages with the highest memory address. + // For each configuration to initialize, assign flash space based on the priority + // specified. Higher priority means a higher memory address. - for (uint32_t i = 0; i < users; i++) + for (uint32_t i = 0; i < configs_to_init; i++) { - uint8_t max_priority = 0x00; + fs_config_t * p_config_i = FS_SECTION_VARS_GET(i); + uint8_t max_priority = 0; + uint8_t max_index = i; - for (uint32_t j = 0; j < users; j++) + for (uint32_t j = 0; j < total_users; j++) { - fs_config_t * const p_config = FS_SECTION_VARS_GET(j); + fs_config_t const * const p_config_j = FS_SECTION_VARS_GET(j); - // Skip the one assigned during last iteration. - if (j == index_last) + #if 0 + if (p_config_j->priority == p_config_i->priority) { + // Duplicated priorities are not allowed. + return FS_ERR_INVALID_CFG; + } + #endif + + if ((p_config_j->p_start_addr != NULL) && + (p_config_j->p_end_addr != NULL)) + { + // When calculating the configuration with the next highest priority + // skip configurations which were already set during a previous iteration. + // This check needs to be here to prevent re-using the configurations + // with higher priorities which we used in previous iterations. continue; } - if (p_config->priority >= max_priority) + if (p_config_j->priority > max_priority) { - max_priority = p_config->priority; - index_max = j; + max_priority = p_config_j->priority; + max_index = j; } } - fs_config_t * const p_config = FS_SECTION_VARS_GET(index_max); + p_config_i = FS_SECTION_VARS_GET(max_index); - p_config->p_end_addr = p_current_end; - p_config->p_start_addr = p_current_end - (p_config->num_pages * FS_PAGE_SIZE_WORDS); + p_config_i->p_end_addr = p_current_end; + p_config_i->p_start_addr = p_current_end - (p_config_i->num_pages * FS_PAGE_SIZE_WORDS); - p_current_end = p_config->p_start_addr; - - index_last = index_max; + p_current_end = p_config_i->p_start_addr; } m_flags |= FS_FLAG_INITIALIZED; @@ -356,10 +372,18 @@ fs_ret_t fs_init(void) } +fs_ret_t fs_fake_init(void) +{ + m_flags |= FS_FLAG_INITIALIZED; + return FS_SUCCESS; +} + + fs_ret_t fs_store(fs_config_t const * const p_config, uint32_t const * const p_dest, uint32_t const * const p_src, - uint16_t const length_words) + uint16_t const length_words, + void * p_context) { fs_op_t * p_op; @@ -403,6 +427,7 @@ fs_ret_t fs_store(fs_config_t const * const p_config, } // Initialize the operation. + p_op->p_context = p_context; p_op->p_config = p_config; p_op->op_code = FS_OP_STORE; p_op->store.p_src = p_src; @@ -417,7 +442,8 @@ fs_ret_t fs_store(fs_config_t const * const p_config, fs_ret_t fs_erase(fs_config_t const * const p_config, uint32_t const * const p_page_addr, - uint16_t const num_pages) + uint16_t const num_pages, + void * p_context) { fs_op_t * p_op; @@ -437,7 +463,7 @@ fs_ret_t fs_erase(fs_config_t const * const p_config, } // Check that the page is aligned to a page boundary. - if (((uint32_t)p_page_addr % FS_PAGE_SIZE) != 0) + if (((uint32_t)p_page_addr & (FS_PAGE_SIZE-1)) != 0) { return FS_ERR_UNALIGNED_ADDR; } @@ -460,6 +486,7 @@ fs_ret_t fs_erase(fs_config_t const * const p_config, } // Initialize the operation. + p_op->p_context = p_context; p_op->p_config = p_config; p_op->op_code = FS_OP_ERASE; p_op->erase.page = ((uint32_t)p_page_addr / FS_PAGE_SIZE); @@ -487,7 +514,7 @@ fs_ret_t fs_queued_op_count_get(uint32_t * const p_op_count) void fs_sys_event_handler(uint32_t sys_evt) { fs_op_t * const p_op = &m_queue.op[m_queue.rp]; - + if (m_flags & FS_FLAG_PROCESSING) { // A flash operation was initiated by this module. Handle the result. @@ -519,3 +546,14 @@ void fs_sys_event_handler(uint32_t sys_evt) queue_process(); } +bool fs_queue_is_full(void) +{ + return (m_queue.count == FS_QUEUE_SIZE); +} + +bool fs_queue_is_empty(void) +{ + return (m_queue.count == 0); +} + +#endif //NRF_MODULE_ENABLED(FSTORAGE) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.h index 718406abf0..b170464306 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage.h @@ -36,7 +36,6 @@ * */ - #ifndef FSTORAGE_H__ #define FSTORAGE_H__ @@ -49,8 +48,13 @@ */ #include +#include #include "section_vars.h" +#ifdef __cplusplus +extern "C" { +#endif + /**@brief fstorage return values. */ typedef enum @@ -65,6 +69,7 @@ typedef enum FS_ERR_QUEUE_FULL, //!< Error. Queue is full. FS_ERR_OPERATION_TIMEOUT, //!< Error. The operation has timed out. FS_ERR_INTERNAL, //!< Error. Internal error. + FS_ERR_FAILURE_SINCE_LAST //!< Error. Uncleared error since last call } fs_ret_t; @@ -89,6 +94,7 @@ typedef enum typedef struct { fs_evt_id_t id; //!< The event ID. + void * p_context; //!< User-defined context passed to the interrupt handler. union { struct @@ -135,12 +141,12 @@ typedef void (*fs_cb_t)(fs_evt_t const * const evt, fs_ret_t result); typedef struct { /**@brief The beginning of the flash space assigned to the application which registered this - * configuration. This field is set by @ref fs_init. + * configuration. This field is set by @ref fs_init. It can also be set manually. */ uint32_t const * p_start_addr; /**@brief The end of the flash space assigned to the application which registered this - * configuration. This field is set by @ref fs_init. + * configuration. This field is set by @ref fs_init. It can also be set manually. */ uint32_t const * p_end_addr; @@ -156,7 +162,7 @@ typedef struct } fs_config_t; -/**@brief Macro for registering with an fstorage configuration. +/**@brief Macro for registering an fstorage configuration variable. * Applications which use fstorage must register with the module using this macro. * Registering involves defining a variable which holds the configuration of fstorage * specific to the application which invokes the macro. @@ -166,7 +172,7 @@ typedef struct * * @param[in] cfg_var A @e definition of a @ref fs_config_t variable. */ -#define FS_REGISTER_CFG(cfg_var) NRF_SECTION_VARS_ADD(fs_data, cfg_var) +#define FS_REGISTER_CFG(cfg_var) NRF_SECTION_VARS_REGISTER_VAR(fs_data, cfg_var) /**@brief Function for initializing the module. @@ -178,6 +184,9 @@ typedef struct fs_ret_t fs_init(void); +fs_ret_t fs_fake_init(void); + + /**@brief Function for storing data in flash. * * @details Copies @p length_words words from @p p_src to the location pointed by @p p_dest. @@ -194,6 +203,7 @@ fs_ret_t fs_init(void); * @param[in] p_dest The address in flash memory where to store the data. * @param[in] p_src Pointer to the data to store in flash. * @param[in] length_words Length of the data to store, in words. + * @param[in] p_context User-defined context passed to the interrupt handler. * * @retval FS_SUCCESS If the operation was queued successfully. * @retval FS_ERR_NOT_INITIALIZED If the module is not initialized. @@ -208,7 +218,8 @@ fs_ret_t fs_init(void); fs_ret_t fs_store(fs_config_t const * const p_config, uint32_t const * const p_dest, uint32_t const * const p_src, - uint16_t length_words); + uint16_t length_words, + void * p_context); /**@brief Function for erasing flash pages. @@ -221,6 +232,7 @@ fs_ret_t fs_store(fs_config_t const * const p_config, * @param[in] p_config fstorage configuration registered by the application. * @param[in] p_page_addr Address of the page to erase. Must be aligned to a page boundary. * @param[in] num_pages Number of pages to erase. May not be zero. + * @param[in] p_context User-defined context passed to the interrupt handler. * * @retval FS_SUCCESS If the operation was queued successfully. * @retval FS_ERR_NOT_INITIALIZED If the module is not initialized. @@ -234,7 +246,8 @@ fs_ret_t fs_store(fs_config_t const * const p_config, */ fs_ret_t fs_erase(fs_config_t const * const p_config, uint32_t const * const p_page_addr, - uint16_t num_pages); + uint16_t num_pages, + void * p_context); /**@brief Function for retrieving the number of queued flash operations. @@ -247,6 +260,22 @@ fs_ret_t fs_erase(fs_config_t const * const p_config, fs_ret_t fs_queued_op_count_get(uint32_t * const p_op_count); +/**@brief Function for checking if the queue for flash operations is full. + * + * @retval true If the queue is full. + * @retval false If there is space for more operations in the queue. + */ +bool fs_queue_is_full(void); + + +/**@brief Function for checking if the queue for flash operations is empty. + * + * @retval true If the queue is empty. + * @retval false If there are flash operations in the queue. + */ +bool fs_queue_is_empty(void); + + /**@brief Function for handling system events from the SoftDevice. * * @details If any of the modules used by the application rely on fstorage, the application should @@ -259,4 +288,9 @@ void fs_sys_event_handler(uint32_t sys_evt); /** @} */ + +#ifdef __cplusplus +} +#endif + #endif // FSTORAGE_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_internal_defs.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_internal_defs.h index 8f8e4bbea2..f6d87571bc 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_internal_defs.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fstorage/fstorage_internal_defs.h @@ -36,12 +36,15 @@ * */ - #ifndef FSTORAGE_INTERNAL_DEFS_H__ #define FSTORAGE_INTERNAL_DEFS_H__ #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + #define FS_FLAG_INITIALIZED (1 << 0) // The module has been initialized. #define FS_FLAG_PROCESSING (1 << 1) // The module is processing flash operations. @@ -57,15 +60,8 @@ #define FS_SECTION_VARS_END_ADDR NRF_SECTION_VARS_END_ADDR(fs_data) -// Register the section 'fs_data'. -//lint -save -e19 -NRF_SECTION_VARS_REGISTER_SECTION(fs_data); -//lint -restore - -// Declare symbols into the 'fs_data' section. -NRF_SECTION_VARS_REGISTER_SYMBOLS(fs_config_t, fs_data); -//lint -esym(526,fs_dataBase) -//lint -esym(526,fs_dataLimit) +// Create section 'fs_data'. +NRF_SECTION_VARS_CREATE_SECTION(fs_data, fs_config_t); // fstorage op-codes. @@ -91,6 +87,7 @@ typedef enum typedef struct { fs_config_t const * p_config; // Application-specific fstorage configuration. + void * p_context; // User-defined context passed to the interrupt handler. fs_op_code_t op_code; // ID of the operation. union { @@ -132,9 +129,9 @@ typedef struct // Size of a flash page in bytes. -#if defined (NRF51) +#if defined (NRF51) #define FS_PAGE_SIZE (1024) -#elif defined (NRF52) +#elif (defined (NRF52) || defined(NRF52840_XXAA)) #define FS_PAGE_SIZE (4096) #endif @@ -159,4 +156,9 @@ static uint32_t const * fs_flash_page_end_addr() #define FS_PAGE_END_ADDR (fs_flash_page_end_addr()) + +#ifdef __cplusplus +} +#endif + #endif //__FSTORAGE_INTERNAL_DEFS_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_transport_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_transport_config.h deleted file mode 100644 index fdff490056..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/config/hci_transport_config.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/** @file - * - * @brief Definition of HCI Transport Layer configurable parameters - */ - -#ifndef HCI_TRANSPORT_CFG_H__ -#define HCI_TRANSPORT_CFG_H__ - -/** This section covers configurable parameters for the HCI Transport SLIP layer. */ -#define HCI_SLIP_UART_RX_PIN_NUMBER 1 /**< Defines the UART RX pin number. The default pin for the board is chosen, but can be overwritten. */ - -#define HCI_SLIP_UART_TX_PIN_NUMBER 2 /**< Defines the UART TX pin number. The default pin for the board is chosen, but can be overwritten. */ - -#define HCI_SLIP_UART_RTS_PIN_NUMBER 3 /**< Defines the UART RTS pin number. The default pin for the board is chosen, but can be overwritten. */ - -#define HCI_SLIP_UART_CTS_PIN_NUMBER 4 /**< Defines the UART CTS pin number. The default pin for the board is chosen, but can be overwritten. */ - -#define HCI_SLIP_UART_MODE APP_UART_FLOW_CONTROL_ENABLED /**< Defines the UART mode to be used. Use UART Low Power with Flow Control - Valid values are defined in \ref app_uart_flow_control_t. For further information on the UART Low Power mode, please refer to: \ref app_uart . */ - -#define HCI_SLIP_UART_BAUDRATE UART_BAUDRATE_BAUDRATE_Baud38400 /**< Defines the UART Baud rate. Default is 38400 baud. */ - -/** This section covers configurable parameters for the HCI Transport layer that are used for calculating correct value for the retransmission timer timeout. */ -#define MAX_PACKET_SIZE_IN_BITS 8000u /**< Maximum size of a single application packet in bits. */ -#define USED_BAUD_RATE 38400u /**< The used uart baudrate. */ - -#endif // HCI_TRANSPORT_CFG_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.c index cefb91eb2f..b42260674b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.c @@ -35,73 +35,72 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(HCI_MEM_POOL) #include "hci_mem_pool.h" -#include "hci_mem_pool_internal.h" #include #include -/**@brief RX buffer element instance structure. +/**@brief RX buffer element instance structure. */ -typedef struct +typedef struct { - uint8_t rx_buffer[RX_BUF_SIZE]; /**< RX buffer memory array. */ + uint8_t rx_buffer[HCI_RX_BUF_SIZE]; /**< RX buffer memory array. */ uint32_t length; /**< Length of the RX buffer memory array. */ } rx_buffer_elem_t; -/**@brief RX buffer queue element instance structure. +/**@brief RX buffer queue element instance structure. */ -typedef struct +typedef struct { rx_buffer_elem_t * p_buffer; /**< Pointer to RX buffer element. */ uint32_t free_window_count; /**< Free space element count. */ uint32_t free_available_count; /**< Free area element count. */ uint32_t read_available_count; /**< Read area element count. */ - uint32_t write_index; /**< Write position index. */ - uint32_t read_index; /**< Read position index. */ - uint32_t free_index; /**< Free position index. */ + uint32_t write_index; /**< Write position index. */ + uint32_t read_index; /**< Read position index. */ + uint32_t free_index; /**< Free position index. */ } rx_buffer_queue_t; static bool m_is_tx_allocated; /**< Boolean value to determine if the TX buffer is allocated. */ -static rx_buffer_elem_t m_rx_buffer_elem_queue[RX_BUF_QUEUE_SIZE]; /**< RX buffer element instances. */ +static rx_buffer_elem_t m_rx_buffer_elem_queue[HCI_RX_BUF_QUEUE_SIZE]; /**< RX buffer element instances. */ static rx_buffer_queue_t m_rx_buffer_queue; /**< RX buffer queue element instance. */ uint32_t hci_mem_pool_open(void) { - m_is_tx_allocated = false; + m_is_tx_allocated = false; m_rx_buffer_queue.p_buffer = m_rx_buffer_elem_queue; - m_rx_buffer_queue.free_window_count = RX_BUF_QUEUE_SIZE; + m_rx_buffer_queue.free_window_count = HCI_RX_BUF_QUEUE_SIZE; m_rx_buffer_queue.free_available_count = 0; m_rx_buffer_queue.read_available_count = 0; - m_rx_buffer_queue.write_index = 0; - m_rx_buffer_queue.read_index = 0; - m_rx_buffer_queue.free_index = 0; - + m_rx_buffer_queue.write_index = 0; + m_rx_buffer_queue.read_index = 0; + m_rx_buffer_queue.free_index = 0; + return NRF_SUCCESS; } uint32_t hci_mem_pool_close(void) -{ +{ return NRF_SUCCESS; } uint32_t hci_mem_pool_tx_alloc(void ** pp_buffer) { - static uint8_t tx_buffer[TX_BUF_SIZE]; + static uint8_t tx_buffer[HCI_TX_BUF_SIZE]; uint32_t err_code; - + if (pp_buffer == NULL) { return NRF_ERROR_NULL; } - + if (!m_is_tx_allocated) - { + { m_is_tx_allocated = true; *pp_buffer = tx_buffer; err_code = NRF_SUCCESS; @@ -110,7 +109,7 @@ uint32_t hci_mem_pool_tx_alloc(void ** pp_buffer) { err_code = NRF_ERROR_NO_MEM; } - + return err_code; } @@ -118,51 +117,51 @@ uint32_t hci_mem_pool_tx_alloc(void ** pp_buffer) uint32_t hci_mem_pool_tx_free(void) { m_is_tx_allocated = false; - + return NRF_SUCCESS; } uint32_t hci_mem_pool_rx_produce(uint32_t length, void ** pp_buffer) { - uint32_t err_code; + uint32_t err_code; if (pp_buffer == NULL) { return NRF_ERROR_NULL; - } + } *pp_buffer = NULL; - - if (m_rx_buffer_queue.free_window_count != 0) - { - if (length <= RX_BUF_SIZE) - { - --(m_rx_buffer_queue.free_window_count); - ++(m_rx_buffer_queue.read_available_count); - *pp_buffer = + if (m_rx_buffer_queue.free_window_count != 0) + { + if (length <= HCI_RX_BUF_SIZE) + { + --(m_rx_buffer_queue.free_window_count); + ++(m_rx_buffer_queue.read_available_count); + + *pp_buffer = m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.write_index].rx_buffer; m_rx_buffer_queue.free_index |= (1u << m_rx_buffer_queue.write_index); - // @note: Adjust the write_index making use of the fact that the buffer size is of - // power of two and two's complement arithmetic. For details refer example to book + // @note: Adjust the write_index making use of the fact that the buffer size is of + // power of two and two's complement arithmetic. For details refer example to book // "Making embedded systems: Elicia White". - m_rx_buffer_queue.write_index = - (m_rx_buffer_queue.write_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); - + m_rx_buffer_queue.write_index = + (m_rx_buffer_queue.write_index + 1u) & (HCI_RX_BUF_QUEUE_SIZE - 1u); + err_code = NRF_SUCCESS; } else { - err_code = NRF_ERROR_DATA_SIZE; - } + err_code = NRF_ERROR_DATA_SIZE; + } } else { - err_code = NRF_ERROR_NO_MEM; + err_code = NRF_ERROR_NO_MEM; } - + return err_code; } @@ -172,16 +171,16 @@ uint32_t hci_mem_pool_rx_consume(uint8_t * p_buffer) uint32_t err_code; uint32_t consume_index; uint32_t start_index; - + if (m_rx_buffer_queue.free_available_count != 0) { // Find the buffer that has been freed - // Start at read_index minus free_available_count and then increment until read index. err_code = NRF_ERROR_INVALID_ADDR; - consume_index = (m_rx_buffer_queue.read_index - m_rx_buffer_queue.free_available_count) & - (RX_BUF_QUEUE_SIZE - 1u); + consume_index = (m_rx_buffer_queue.read_index - m_rx_buffer_queue.free_available_count) & + (HCI_RX_BUF_QUEUE_SIZE - 1u); start_index = consume_index; - + do { if (m_rx_buffer_queue.p_buffer[consume_index].rx_buffer == p_buffer) @@ -192,36 +191,36 @@ uint32_t hci_mem_pool_rx_consume(uint8_t * p_buffer) } else { - consume_index = (consume_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); + consume_index = (consume_index + 1u) & (HCI_RX_BUF_QUEUE_SIZE - 1u); } } while (consume_index != m_rx_buffer_queue.read_index); - while (!(m_rx_buffer_queue.free_index & (1 << start_index)) && + while (!(m_rx_buffer_queue.free_index & (1 << start_index)) && (m_rx_buffer_queue.free_available_count != 0)) { --(m_rx_buffer_queue.free_available_count); - ++(m_rx_buffer_queue.free_window_count); - start_index = (consume_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); + ++(m_rx_buffer_queue.free_window_count); + start_index = (consume_index + 1u) & (HCI_RX_BUF_QUEUE_SIZE - 1u); } } else { err_code = NRF_ERROR_NO_MEM; } - - return err_code; + + return err_code; } uint32_t hci_mem_pool_rx_data_size_set(uint32_t length) { // @note: Adjust the write_index making use of the fact that the buffer size is of power - // of two and two's complement arithmetic. For details refer example to book + // of two and two's complement arithmetic. For details refer example to book // "Making embedded systems: Elicia White". - const uint32_t index = (m_rx_buffer_queue.write_index - 1u) & (RX_BUF_QUEUE_SIZE - 1u); - m_rx_buffer_queue.p_buffer[index].length = length; - + const uint32_t index = (m_rx_buffer_queue.write_index - 1u) & (HCI_RX_BUF_QUEUE_SIZE - 1u); + m_rx_buffer_queue.p_buffer[index].length = length; + return NRF_SUCCESS; } @@ -229,34 +228,35 @@ uint32_t hci_mem_pool_rx_data_size_set(uint32_t length) uint32_t hci_mem_pool_rx_extract(uint8_t ** pp_buffer, uint32_t * p_length) { uint32_t err_code; - + if ((pp_buffer == NULL) || (p_length == NULL)) { return NRF_ERROR_NULL; } - + if (m_rx_buffer_queue.read_available_count != 0) { --(m_rx_buffer_queue.read_available_count); - ++(m_rx_buffer_queue.free_available_count); - - *pp_buffer = + ++(m_rx_buffer_queue.free_available_count); + + *pp_buffer = m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.read_index].rx_buffer; - *p_length = + *p_length = m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.read_index].length; - + // @note: Adjust the write_index making use of the fact that the buffer size is of power - // of two and two's complement arithmetic. For details refer example to book - // "Making embedded systems: Elicia White". - m_rx_buffer_queue.read_index = - (m_rx_buffer_queue.read_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); - + // of two and two's complement arithmetic. For details refer example to book + // "Making embedded systems: Elicia White". + m_rx_buffer_queue.read_index = + (m_rx_buffer_queue.read_index + 1u) & (HCI_RX_BUF_QUEUE_SIZE - 1u); + err_code = NRF_SUCCESS; } else { - err_code = NRF_ERROR_NO_MEM; + err_code = NRF_ERROR_NO_MEM; } - + return err_code; } +#endif //NRF_MODULE_ENABLED(HCI_MEM_POOL) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.h index e4f7358b8f..215fe7f756 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/hci/hci_mem_pool.h @@ -36,22 +36,21 @@ * */ - /** @file * - * @defgroup memory_pool Memory pool + * @defgroup hci_mem_pool Memory pool * @{ * @ingroup app_common * * @brief Memory pool implementation * - * Memory pool implementation, based on circular buffer data structure, which supports asynchronous + * Memory pool implementation, based on circular buffer data structure, which supports asynchronous * processing of RX data. The current default implementation supports 1 TX buffer and 4 RX buffers. - * The memory managed by the pool is allocated from static storage instead of heap. The internal - * design of the circular buffer implementing the RX memory layout is illustrated in the picture - * below. + * The memory managed by the pool is allocated from static storage instead of heap. The internal + * design of the circular buffer implementing the RX memory layout is illustrated in the picture + * below. * - * @image html memory_pool.png "Circular buffer design" + * @image html memory_pool.svg "Circular buffer design" * * The expected call order for the RX APIs is as follows: * - hci_mem_pool_rx_produce @@ -64,26 +63,30 @@ * \par Component specific configuration options * * The following compile time configuration options are available to suit various implementations: - * - TX_BUF_SIZE TX buffer size in bytes. - * - RX_BUF_SIZE RX buffer size in bytes. + * - TX_BUF_SIZE TX buffer size in bytes. + * - RX_BUF_SIZE RX buffer size in bytes. * - RX_BUF_QUEUE_SIZE RX buffer element size. */ - + #ifndef HCI_MEM_POOL_H__ #define HCI_MEM_POOL_H__ #include #include "nrf_error.h" +#ifdef __cplusplus +extern "C" { +#endif + /**@brief Function for opening the module. * - * @retval NRF_SUCCESS Operation success. + * @retval NRF_SUCCESS Operation success. */ uint32_t hci_mem_pool_open(void); /**@brief Function for closing the module. * - * @retval NRF_SUCCESS Operation success. + * @retval NRF_SUCCESS Operation success. */ uint32_t hci_mem_pool_close(void); @@ -93,37 +96,37 @@ uint32_t hci_mem_pool_close(void); * * @retval NRF_SUCCESS Operation success. Memory was allocated. * @retval NRF_ERROR_NO_MEM Operation failure. No memory available for allocation. - * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. */ uint32_t hci_mem_pool_tx_alloc(void ** pp_buffer); - + /**@brief Function for freeing previously allocated TX memory. * - * @note Memory management follows the FIFO principle meaning that free() order must match the - * alloc(...) order, which is the reason for omitting exact memory block identifier as an + * @note Memory management follows the FIFO principle meaning that free() order must match the + * alloc(...) order, which is the reason for omitting exact memory block identifier as an * input parameter. * * @retval NRF_SUCCESS Operation success. Memory was freed. */ uint32_t hci_mem_pool_tx_free(void); - + /**@brief Function for producing a free RX memory block for usage. * - * @note Upon produce request amount being 0, NRF_SUCCESS is returned. + * @note Upon produce request amount being 0, NRF_SUCCESS is returned. * * @param[in] length Amount, in bytes, of free memory to be produced. * @param[out] pp_buffer Pointer to the allocated memory. * * @retval NRF_SUCCESS Operation success. Free RX memory block produced. * @retval NRF_ERROR_NO_MEM Operation failure. No suitable memory available for allocation. - * @retval NRF_ERROR_DATA_SIZE Operation failure. Request size exceeds limit. - * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Operation failure. Request size exceeds limit. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. */ uint32_t hci_mem_pool_rx_produce(uint32_t length, void ** pp_buffer); /**@brief Function for setting the length of the last produced RX memory block. * - * @warning If call to this API is omitted the end result is that the following call to + * @warning If call to this API is omitted the end result is that the following call to * mem_pool_rx_extract will return incorrect data in the p_length output parameter. * * @param[in] length Amount, in bytes, of actual memory used. @@ -131,29 +134,34 @@ uint32_t hci_mem_pool_rx_produce(uint32_t length, void ** pp_buffer); * @retval NRF_SUCCESS Operation success. Length was set. */ uint32_t hci_mem_pool_rx_data_size_set(uint32_t length); - -/**@brief Function for extracting a packet, which has been filled with read data, for further + +/**@brief Function for extracting a packet, which has been filled with read data, for further * processing. * * @param[out] pp_buffer Pointer to the packet data. - * @param[out] p_length Length of packet data in bytes. + * @param[out] p_length Length of packet data in bytes. * - * @retval NRF_SUCCESS Operation success. + * @retval NRF_SUCCESS Operation success. * @retval NRF_ERROR_NO_MEM Operation failure. No packet available to extract. - * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. */ uint32_t hci_mem_pool_rx_extract(uint8_t ** pp_buffer, uint32_t * p_length); - + /**@brief Function for freeing previously extracted packet, which has been filled with read data. * * @param[in] p_buffer Pointer to consumed buffer. * - * @retval NRF_SUCCESS Operation success. - * @retval NRF_ERROR_NO_MEM Operation failure. No packet available to free. - * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer. + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NO_MEM Operation failure. No packet available to free. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer. */ uint32_t hci_mem_pool_rx_consume(uint8_t * p_buffer); - + + +#ifdef __cplusplus +} +#endif + #endif // HCI_MEM_POOL_H__ - + /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log.h new file mode 100644 index 0000000000..f890448a48 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log.h @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * + * @defgroup nrf_log Logger module + * @{ + * @ingroup app_common + * + * @brief The nrf_log module interface. + */ + +#ifndef NRF_LOG_H_ +#define NRF_LOG_H_ + +#include "sdk_config.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief Default module name prefix. + * + * The prefix can be defined in a module to override the default. + */ +#ifndef NRF_LOG_MODULE_NAME + #define NRF_LOG_MODULE_NAME "" +#endif + +/** @brief Severity level for the module. + * + * The severity level can be defined in a module to override the default. + */ +#ifndef NRF_LOG_LEVEL + #define NRF_LOG_LEVEL NRF_LOG_DEFAULT_LEVEL +#endif + +/** @brief Color prefix of debug logs for the module. + * + * This color prefix can be defined in a module to override the default. + */ +#ifndef NRF_LOG_DEBUG_COLOR + #define NRF_LOG_DEBUG_COLOR NRF_LOG_COLOR_DEFAULT +#endif + +/** @brief Color prefix of info logs for the module. + * + * This color prefix can be defined in a module to override the default. + */ +#ifndef NRF_LOG_INFO_COLOR + #define NRF_LOG_INFO_COLOR NRF_LOG_COLOR_DEFAULT +#endif + +#include "nrf_log_internal.h" + +/** @def NRF_LOG_ERROR + * @brief Macro for logging error messages. It takes a printf-like, formatted + * string with up to seven arguments. + * + * @details This macro is compiled only if @ref NRF_LOG_LEVEL includes error logs. + */ + +/** @def NRF_LOG_WARNING + * @brief Macro for logging error messages. It takes a printf-like, formatted + * string with up to seven arguments. + * + * @details This macro is compiled only if @ref NRF_LOG_LEVEL includes warning logs. + */ + +/** @def NRF_LOG_INFO + * @brief Macro for logging error messages. It takes a printf-like, formatted + * string with up to seven arguments. + * + * @details This macro is compiled only if @ref NRF_LOG_LEVEL includes info logs. + */ + +/** @def NRF_LOG_DEBUG + * @brief Macro for logging error messages. It takes a printf-like, formatted + * string with up to seven arguments. + * + * @details This macro is compiled only if @ref NRF_LOG_LEVEL includes debug logs. + */ + +#define NRF_LOG_ERROR(...) NRF_LOG_INTERNAL_ERROR(__VA_ARGS__) +#define NRF_LOG_WARNING(...) NRF_LOG_INTERNAL_WARNING( __VA_ARGS__) +#define NRF_LOG_INFO(...) NRF_LOG_INTERNAL_INFO( __VA_ARGS__) +#define NRF_LOG_DEBUG(...) NRF_LOG_INTERNAL_DEBUG( __VA_ARGS__) + +/** + * @brief A macro for logging a formatted string without any prefix or timestamp. + */ +#define NRF_LOG_RAW_INFO(...) NRF_LOG_INTERNAL_RAW_INFO( __VA_ARGS__) + +/** @def NRF_LOG_HEXDUMP_ERROR + * @brief Macro for logging raw bytes. + * @details It is compiled in only if @ref NRF_LOG_LEVEL includes error logs. + * + * @param p_data Pointer to data. + * @param len Data length in bytes. + */ +/** @def NRF_LOG_HEXDUMP_WARNING + * @brief Macro for logging raw bytes. + * @details This macro is compiled only if @ref NRF_LOG_LEVEL includes warning logs. + * + * @param p_data Pointer to data. + * @param len Data length in bytes. + */ +/** @def NRF_LOG_HEXDUMP_INFO + * @brief Macro for logging raw bytes. + * @details This macro is compiled only if @ref NRF_LOG_LEVEL includes info logs. + * + * @param p_data Pointer to data. + * @param len Data length in bytes. + */ +/** @def NRF_LOG_HEXDUMP_DEBUG + * @brief Macro for logging raw bytes. + * @details This macro is compiled only if @ref NRF_LOG_LEVEL includes debug logs. + * + * @param p_data Pointer to data. + * @param len Data length in bytes. + */ +#define NRF_LOG_HEXDUMP_ERROR(p_data, len) NRF_LOG_INTERNAL_HEXDUMP_ERROR(p_data, len) +#define NRF_LOG_HEXDUMP_WARNING(p_data, len) NRF_LOG_INTERNAL_HEXDUMP_WARNING(p_data, len) +#define NRF_LOG_HEXDUMP_INFO(p_data, len) NRF_LOG_INTERNAL_HEXDUMP_INFO(p_data, len) +#define NRF_LOG_HEXDUMP_DEBUG(p_data, len) NRF_LOG_INTERNAL_HEXDUMP_DEBUG(p_data, len) + +/** + * @brief Macro for logging hexdump without any prefix or timestamp. + */ +#define NRF_LOG_RAW_HEXDUMP_INFO(p_data, len) NRF_LOG_INTERNAL_RAW_HEXDUMP_INFO(p_data, len) + +/** + * @brief A macro for blocking reading from bidirectional backend used for logging. + * + * Macro call is blocking and returns when single byte is received. + */ +#define NRF_LOG_GETCHAR() NRF_LOG_INTERNAL_GETCHAR() + +/** + * @brief Function for copying a string to the internal logger buffer if logs are deferred. + * + * Use this function to store a string that is volatile (for example allocated + * on stack) or that may change before the deferred logs are processed. Such string is copied + * into the internal logger buffer and is persistent until the log is processed. + * + * @note If the logs are not deferred, then this function returns the input parameter. + * + * @param p_str Pointer to the user string. + * + * @return Address to the location where the string is stored in the internal logger buffer. + */ +uint32_t nrf_log_push(char * const p_str); + +/** + * @brief Macro to be used in a formatted string to a pass float number to the log. + * + * Macro should be used in formatted string instead of the %f specifier together with + * @ref NRF_LOG_FLOAT macro. + * Example: NRF_LOG_INFO("My float number" NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(f))) + */ +#define NRF_LOG_FLOAT_MARKER "%d.%02d" + +/** + * @brief Macro for dissecting a float number into two numbers (integer and residuum). + */ +#define NRF_LOG_FLOAT(val) (int32_t)(val), \ + (int32_t)(((val > 0) ? (val) - (int32_t)(val) \ + : (int32_t)(val) - (val))*100) + +#ifdef __cplusplus +} +#endif + +#endif // NRF_LOG_H_ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend.h new file mode 100644 index 0000000000..8939742e6f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/**@file + * @addtogroup nrf_log Logger module + * @ingroup app_common + * + * @defgroup nrf_log_backend Backend of nrf_log + * @{ + * @ingroup nrf_log + * @brief The nrf_log backend interface. + */ + + +#ifndef NRF_LOG_BACKEND_H__ +#define NRF_LOG_BACKEND_H__ + +#include "nrf_log_ctrl.h" +#include "sdk_errors.h" +#include + +/** + * @brief Function for initializing the logger backend. + * + * param blocking Set true if handler functions should block until completion. + * + * @return NRF_SUCCESS after successful initialization, error code otherwise. + */ +ret_code_t nrf_log_backend_init(bool blocking); + +/** + * @brief Function for returning a pointer to a function for handling standard + * log entries (@ref NRF_LOG_ERROR, etc.). + * + * @return Pointer to a handler. + */ +nrf_log_std_handler_t nrf_log_backend_std_handler_get(void); + +/** + * @brief Function for returning a pointer to a function for handling + * hexdumps (@ref NRF_LOG_HEXDUMP_ERROR, etc.). + * + * @return Pointer to a handler. + */ +nrf_log_hexdump_handler_t nrf_log_backend_hexdump_handler_get(void); + +/** + * @brief Function for blocking reading of a byte from the backend. + * + * @return Byte. + */ +uint8_t nrf_log_backend_getchar(void); +#endif // NRF_LOG_BACKEND_H__ +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend_serial.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend_serial.c new file mode 100644 index 0000000000..bdc0b5cce7 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend_serial.c @@ -0,0 +1,494 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(NRF_LOG) +#include "nrf_log_backend.h" +#include "nrf_error.h" +#include +#include +#include +#include + +#if NRF_LOG_BACKEND_SERIAL_USES_RTT +#include +#include +#endif + +#if NRF_LOG_BACKEND_SERIAL_USES_UART +#include "nrf_drv_uart.h" +#endif + +#if NRF_LOG_BACKEND_SERIAL_USES_UART +static char m_uart_buffer[NRF_LOG_BACKEND_MAX_STRING_LENGTH]; +static nrf_drv_uart_t m_uart = NRF_DRV_UART_INSTANCE(NRF_LOG_BACKEND_UART_INSTANCE); + +#if !NRF_MODULE_ENABLED(UART) +#error "UART driver must be enabled to use UART in nrf_log." +#endif + +#endif //NRF_LOG_BACKEND_SERIAL_USES_UART + +#define HEXDUMP_BYTES_PER_LINE 16 +#define HEXDUMP_HEXBYTE_AREA 3 // Two bytes for hexbyte and space to separate +#define TIMESTAMP_STR(val) "[%0" NUM_TO_STR(val) "d]" + +#define RTT_RETRY_COUNTER 10 //Number of retries before skipping processing + +#define HEXDUMP_MAX_STR_LEN (NRF_LOG_BACKEND_MAX_STRING_LENGTH - \ + (HEXDUMP_HEXBYTE_AREA*HEXDUMP_BYTES_PER_LINE +\ + NRF_LOG_TIMESTAMP_DIGITS + \ + 4 +/* Color ANSI Escape Code */ \ + 2)) /* Separators */ + +static bool m_initialized = false; +static bool m_blocking_mode = false; +static const char m_default_color[] = "\x1B[0m"; + +#if (NRF_LOG_BACKEND_SERIAL_USES_UART) +static volatile bool m_rx_done = false; +#endif + +#if (NRF_LOG_BACKEND_SERIAL_USES_UART) +static void uart_event_handler(nrf_drv_uart_event_t * p_event, void * p_context) +{ + // Dummy handler since is_busy feature is used for determining readiness. + if (p_event->type == NRF_DRV_UART_EVT_RX_DONE) + { + m_rx_done = true; + } +} +#endif //NRF_LOG_BACKEND_SERIAL_USES_UART + + +ret_code_t nrf_log_backend_init(bool blocking) +{ + + if (m_initialized && (blocking == m_blocking_mode)) + { + return NRF_SUCCESS; + } +#if (NRF_LOG_BACKEND_SERIAL_USES_RTT) + SEGGER_RTT_Init(); +#endif + +#if (NRF_LOG_BACKEND_SERIAL_USES_UART) + uint32_t ret_code; + nrf_drv_uart_config_t uart_config = NRF_DRV_UART_DEFAULT_CONFIG; + uart_config.hwfc = + (nrf_uart_hwfc_t)NRF_LOG_BACKEND_SERIAL_UART_FLOW_CONTROL; + uart_config.pseltxd = NRF_LOG_BACKEND_SERIAL_UART_TX_PIN; + uart_config.pselrxd = NRF_LOG_BACKEND_SERIAL_UART_RX_PIN; + uart_config.pselrts = NRF_LOG_BACKEND_SERIAL_UART_RTS_PIN; + uart_config.pselcts = NRF_LOG_BACKEND_SERIAL_UART_CTS_PIN; + uart_config.baudrate = + (nrf_uart_baudrate_t)NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE; + nrf_drv_uart_uninit(&m_uart); + ret_code = nrf_drv_uart_init(&m_uart, &uart_config, + blocking ? NULL : uart_event_handler); + if (ret_code != NRF_SUCCESS) + { + return ret_code; + } +#endif //NRF_LOG_BACKEND_SERIAL_USES_UART + + m_initialized = true; + m_blocking_mode = blocking; + return NRF_SUCCESS; +} + + +static bool serial_is_busy(void) +{ + bool res = false; + +#if (NRF_LOG_BACKEND_SERIAL_USES_UART) + res = nrf_drv_uart_tx_in_progress(&m_uart); +#endif + +#if (NRF_LOG_BACKEND_SERIAL_USES_RTT) + +#endif + + return res; +} + + +static bool serial_tx(uint8_t * p_buf, uint32_t len) +{ + bool ret = true; + +#if NRF_LOG_BACKEND_SERIAL_USES_UART + memcpy(m_uart_buffer, p_buf, len); + uint32_t ret_code = nrf_drv_uart_tx(&m_uart, (uint8_t *)m_uart_buffer, len); + if (ret_code != NRF_SUCCESS) + { + ret = false; + } +#endif //NRF_LOG_BACKEND_SERIAL_USES_UART + +#if NRF_LOG_BACKEND_SERIAL_USES_RTT + uint32_t idx = 0; + uint32_t length = len; + uint32_t processed; + uint32_t watchdog_counter = RTT_RETRY_COUNTER; + do + { + processed = SEGGER_RTT_WriteNoLock(0, &p_buf[idx], length); + idx += processed; + length -= processed; + if (processed == 0) + { + // If RTT is not connected then ensure that logger does not block + watchdog_counter--; + if (watchdog_counter == 0) + { + break; + } + } + } while (length); +#endif //NRF_LOG_BACKEND_SERIAL_USES_RTT + return ret; +} + + +static uint8_t serial_get_byte(void) +{ + uint8_t data; +#if NRF_LOG_BACKEND_SERIAL_USES_UART + if (m_blocking_mode) + { + (void)nrf_drv_uart_rx(&m_uart, &data, 1); + } + else + { + m_rx_done = false; + (void)nrf_drv_uart_rx(&m_uart, &data, 1); + while(!m_rx_done); + } +#elif NRF_LOG_BACKEND_SERIAL_USES_RTT + data = (uint8_t)SEGGER_RTT_WaitKey(); +#endif //NRF_LOG_BACKEND_SERIAL_USES_RTT + return data; +} + + +static bool buf_len_update(uint32_t * p_buf_len, int32_t new_len) +{ + bool ret; + if (new_len < 0) + { + ret = false; + } + else + { + *p_buf_len += (uint32_t)new_len; + ret = true; + } + return ret; +} + + +static bool timestamp_process(const uint32_t * const p_timestamp, char * p_str, uint32_t * p_len) +{ + int32_t len = 0; + bool ret = true; + if (p_timestamp) + { +#if NRF_LOG_USES_COLORS + len = sizeof(m_default_color) - 1; + memcpy(p_str, m_default_color, len); + *p_len += len; +#endif //NRF_LOG_USES_COLORS + len = snprintf(&p_str[len],NRF_LOG_BACKEND_MAX_STRING_LENGTH, TIMESTAMP_STR(NRF_LOG_TIMESTAMP_DIGITS), (int)*p_timestamp); + ret = buf_len_update(p_len, len); + } + else + { + *p_len = 0; + } + return ret; +} + + +static bool nrf_log_backend_serial_std_handler( + uint8_t severity_level, + const uint32_t * const p_timestamp, + const char * const p_str, + uint32_t * p_args, + uint32_t nargs) +{ + char str[NRF_LOG_BACKEND_MAX_STRING_LENGTH]; + int32_t tmp_str_len = 0; + uint32_t buffer_len = 0; + bool status = true; + + if (serial_is_busy()) + { + return false; + } + + if (!timestamp_process(p_timestamp, &str[buffer_len], &buffer_len)) + { + return false; + } + + switch (nargs) + { + case 0: + { + tmp_str_len = strlen(p_str); + if ((tmp_str_len + buffer_len) < NRF_LOG_BACKEND_MAX_STRING_LENGTH) + { + memcpy(&str[buffer_len], p_str, tmp_str_len); + } + break; + } + + case 1: + tmp_str_len = snprintf(&str[buffer_len], NRF_LOG_BACKEND_MAX_STRING_LENGTH-buffer_len, p_str, p_args[0]); + + break; + + case 2: + tmp_str_len = snprintf(&str[buffer_len], NRF_LOG_BACKEND_MAX_STRING_LENGTH-buffer_len, p_str, p_args[0], p_args[1]); + break; + + case 3: + tmp_str_len = snprintf(&str[buffer_len], NRF_LOG_BACKEND_MAX_STRING_LENGTH-buffer_len, p_str, p_args[0], p_args[1], p_args[2]); + break; + + case 4: + tmp_str_len = + snprintf(&str[buffer_len], NRF_LOG_BACKEND_MAX_STRING_LENGTH-buffer_len, p_str, p_args[0], p_args[1], p_args[2], p_args[3]); + break; + + case 5: + tmp_str_len = + snprintf(&str[buffer_len], + NRF_LOG_BACKEND_MAX_STRING_LENGTH-buffer_len, + p_str, + p_args[0], + p_args[1], + p_args[2], + p_args[3], + p_args[4]); + break; + + case 6: + tmp_str_len = + snprintf(&str[buffer_len], + NRF_LOG_BACKEND_MAX_STRING_LENGTH-buffer_len, + p_str, + p_args[0], + p_args[1], + p_args[2], + p_args[3], + p_args[4], + p_args[5]); + break; + + default: + break; + } + status = buf_len_update(&buffer_len, tmp_str_len); + uint32_t full_buff_len = NRF_LOG_USES_COLORS ? + buffer_len + sizeof(m_default_color)-1 : buffer_len; + if (status && (full_buff_len <= NRF_LOG_BACKEND_MAX_STRING_LENGTH)) + { + if (NRF_LOG_USES_COLORS) + { + memcpy(&str[buffer_len], m_default_color, sizeof(m_default_color)-1); + buffer_len = full_buff_len; + } + return serial_tx((uint8_t *)str, buffer_len); + } + else + { + // error, snprintf failed. + return false; + } +} + + +static void byte2hex(const uint8_t c, char * p_out) +{ + uint8_t nibble; + uint32_t i = 2; + + while (i-- != 0) + { + nibble = (c >> (4 * i)) & 0x0F; + p_out[1 - i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); + } +} + + +static uint32_t nrf_log_backend_serial_hexdump_handler( + uint8_t severity_level, + const uint32_t * const p_timestamp, + const char * const p_str, + uint32_t offset, + const uint8_t * const p_buf0, + uint32_t buf0_length, + const uint8_t * const p_buf1, + uint32_t buf1_length) +{ + char str[NRF_LOG_BACKEND_MAX_STRING_LENGTH]; + uint32_t slen; + char * p_hex_part; + char * p_char_part; + uint8_t c; + uint32_t byte_in_line; + uint32_t buffer_len = 0; + uint32_t byte_cnt = offset; + uint32_t length = buf0_length + buf1_length; + uint32_t timestamp_len = p_timestamp ? + NRF_LOG_TIMESTAMP_DIGITS+2 : 0; //+2 since timestamp is in brackets + + if (serial_is_busy()) + { + return offset; + } + + // If it is the first part of hexdump print the header + if (offset == 0) + { + if (!timestamp_process(p_timestamp, &str[buffer_len], &buffer_len)) + { + return offset; + } + slen = strlen(p_str); + // Saturate string if it's too long. + slen = (slen > HEXDUMP_MAX_STR_LEN) ? HEXDUMP_MAX_STR_LEN : slen; + memcpy(&str[buffer_len], p_str, slen); + buffer_len += slen; + } + + do + { + + uint32_t i; + uint32_t hex_part_offset = buffer_len; + uint32_t char_part_offset = hex_part_offset + + (HEXDUMP_BYTES_PER_LINE * HEXDUMP_HEXBYTE_AREA + 1) + // +1 - separator between hexdump and characters. + timestamp_len; + + p_hex_part = &str[hex_part_offset]; + p_char_part = &str[char_part_offset]; + + // Fill the blanks to align to timestamp print + for (i = 0; i < timestamp_len; i++) + { + *p_hex_part = ' '; + ++p_hex_part; + } + + for (byte_in_line = 0; byte_in_line < HEXDUMP_BYTES_PER_LINE; byte_in_line++) + { + if (byte_cnt >= length) + { + // file the blanks + *p_hex_part++ = ' '; + *p_hex_part++ = ' '; + *p_hex_part++ = ' '; + *p_char_part++ = ' '; + } + else + { + if (byte_cnt < buf0_length) + { + c = p_buf0[byte_cnt]; + } + else + { + c = p_buf1[byte_cnt - buf0_length]; + } + byte2hex(c, p_hex_part); + p_hex_part += 2; // move the pointer since byte in hex was added. + *p_hex_part++ = ' '; + *p_char_part++ = isprint(c) ? c : '.'; + byte_cnt++; + } + } + *p_char_part++ = '\r'; + *p_char_part++ = '\n'; + *p_hex_part++ = ' '; + buffer_len += timestamp_len + + (HEXDUMP_BYTES_PER_LINE * HEXDUMP_HEXBYTE_AREA + 1) + // space for hex dump and separator between hexdump and string + HEXDUMP_BYTES_PER_LINE + // space for stringS dump + 2; // space for new line + if (NRF_LOG_USES_COLORS) + { + memcpy(&str[buffer_len], m_default_color, sizeof(m_default_color)-1); + buffer_len += sizeof(m_default_color)-1; + } + + if (!serial_tx((uint8_t *)str, buffer_len)) + { + return byte_cnt; + } + + if (serial_is_busy()) + { + return byte_cnt; + } + buffer_len = 0; + } + while (byte_cnt < length); + return byte_cnt; +} + + +nrf_log_std_handler_t nrf_log_backend_std_handler_get(void) +{ + return nrf_log_backend_serial_std_handler; +} + + +nrf_log_hexdump_handler_t nrf_log_backend_hexdump_handler_get(void) +{ + return nrf_log_backend_serial_hexdump_handler; +} + + +uint8_t nrf_log_backend_getchar(void) +{ + return serial_get_byte(); +} + +#endif // NRF_MODULE_ENABLED(NRF_LOG) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl.h new file mode 100644 index 0000000000..39ade0a568 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl.h @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef NRF_LOG_CTRL_H +#define NRF_LOG_CTRL_H + +/**@file + * @addtogroup nrf_log Logger module + * @ingroup app_common + * + * @defgroup nrf_log_ctrl Functions for controlling nrf_log + * @{ + * @ingroup nrf_log + * @brief The nrf_log control interface. + */ + +#include "sdk_config.h" +#include "sdk_errors.h" +#include +#include +#include "nrf_log_ctrl_internal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Timestamp function prototype. + * + * @return Timestamp value. + */ +typedef uint32_t (*nrf_log_timestamp_func_t)(void); + +/**@brief Macro for initializing the logs. + * + * @note If timestamps are disabled in the configuration, then the provided pointer + * can be NULL. Otherwise, it is expected that timestamp_getter is not NULL. + * + * @param timestamp_func Function that returns the timestamp. + * + * @return NRF_SUCCESS after successful initialization, otherwise an error code. + */ +#define NRF_LOG_INIT(timestamp_func) NRF_LOG_INTERNAL_INIT(timestamp_func) + + +/**@brief Macro for processing a single log entry from a queue of deferred logs. + * + * You can call this macro from the main context or from the error handler to process + * log entries one by one. + * + * @note If logs are not deferred, this call has no use and is defined as 'false'. + * + * @retval true There are more logs to process in the buffer. + * @retval false No more logs in the buffer. + */ +#define NRF_LOG_PROCESS() NRF_LOG_INTERNAL_PROCESS() + +/** @brief Macro for processing all log entries from the buffer. + * It blocks until all buffered entries are processed by the backend. + * + * @note If logs are not deferred, this call has no use and is empty. + */ +#define NRF_LOG_FLUSH() NRF_LOG_INTERNAL_FLUSH() + +/** @brief Macro for flushing log data before reset. + * + * @note If logs are not deferred, this call has no use and is empty. + * + * @note If RTT is used, then a breakpoint is hit once flushed. + */ +#define NRF_LOG_FINAL_FLUSH() NRF_LOG_INTERNAL_FINAL_FLUSH() + +/** @brief Macro for changing functions that are used to handle log entries. + * + * @param default_handler Function for handling log entries. + * @param bytes_handler Function for handling hexdump entries. + * + */ +#define NRF_LOG_HANDLERS_SET(default_handler, bytes_handler) \ + NRF_LOG_INTERNAL_HANDLERS_SET(default_handler, bytes_handler) + +/** + * @brief Function prototype for handling a log entry. + * + * The backend must implement such prototype. + * + * @param severity_level Severity level of the entry. + * @param p_timestamp Pointer to the timestamp value. No timestamp if NULL. + * @param p_str Pointer to a formatted string. + * @param p_args Pointer to an array of arguments for a formatted string. + * @param nargs Number of arguments in p_args. + * + * @retval true If entry is successfully processed. + * @retval false If entry is not processed. + */ +typedef bool (*nrf_log_std_handler_t)( + uint8_t severity_level, + const uint32_t * const p_timestamp, + const char * const p_str, + uint32_t * p_args, + uint32_t nargs); + +/** + * @brief Function prototype for handling a bytes-dumping log entry. + * + * The backend must implement such prototype. Two buffers are needed because data + * is stored internally in a circular buffer so it can be fragmented into up to + * two pieces. + * + * @param severity_level Severity level of the entry. + * @param p_timestamp Pointer to a timestamp value. No timestamp if NULL. + * @param p_str Prefix string for the bytes dump. + * @param offset Indication of how many bytes have already been processed. + * @param p_buf0 Pointer to the first part of data. + * @param buf0_length Number of bytes in the first part. + * @param p_buf1 Pointer to the second part of data. Optional. + * @param buf1_length Number of bytes in the second part. + * + * @return Number of bytes processed. If all bytes are processed, it should be a sum of + * buf0_length and buf1_length + */ +typedef uint32_t (*nrf_log_hexdump_handler_t)( + uint8_t severity_level, + const uint32_t * const p_timestamp, + const char * const p_str, + uint32_t offset, + const uint8_t * const p_buf0, + uint32_t buf0_length, + const uint8_t * const p_buf1, + uint32_t buf1_length); + + +/** + * @brief Function for initializing the frontend and the default backend. + * + * @ref NRF_LOG_INIT calls this function to initialize the frontend and the backend. + * If custom backend is used, then @ref NRF_LOG_INIT should not be called. + * Instead, frontend and user backend should be verbosely initialized. + * + * @param timestamp_func Function for getting a 32-bit timestamp. + * + * @return Error status. + * + */ +ret_code_t nrf_log_init(nrf_log_timestamp_func_t timestamp_func); + +/** + * @brief Function for reinitializing the backend in blocking mode. + */ +ret_code_t nrf_log_blocking_backend_set(void); + +/** + * @brief Function for initializing the logger frontend. + * + * The frontend is initialized with functions for handling log entries. Those + * functions are provided by the backend. + * + * @note This function needs to be called directly only if the @ref NRF_LOG_INIT macro + * is not used to initialize the logger. + * + * @param std_handler Function for handling standard log entries. + * @param hexdump_handler Function for handling hexdump log entries. + * @param timestamp_func Function for getting a timestamp. It cannot be NULL + * unless timestamping is disabled. + */ +void nrf_log_frontend_init(nrf_log_std_handler_t std_handler, + nrf_log_hexdump_handler_t hexdump_handler, + nrf_log_timestamp_func_t timestamp_func); + +/** + * @brief Function for updating functions that handle log entries. + * + * @note Use this feature to change the log handling behavior in certain + * situations, like in a fault handler. + * + * @param std_handler Function for handling standard log entries. + * @param hexdump_handler Function for handling hexdump log entries. + */ +void nrf_log_handlers_set(nrf_log_std_handler_t std_handler, + nrf_log_hexdump_handler_t hexdump_handler); + +/** + * @brief Function for handling a single log entry. + * + * Use this function only if the logs are buffered. It takes a single entry from the + * buffer and attempts to process it. + * + * @retval true If there are more entries to process. + * @retval false If there are no more entries to process. + */ +bool nrf_log_frontend_dequeue(void); + +#ifdef __cplusplus +} +#endif + +#endif // NRF_LOG_CTRL_H + +/** + *@} + **/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/config/fds_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl_internal.h similarity index 54% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/config/fds_config.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl_internal.h index dbcf872748..290ac65f96 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/fds/config/fds_config.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nordic Semiconductor ASA + * Copyright (c) 2016 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -35,56 +35,61 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - -#ifndef FDS_CONFIG_H__ -#define FDS_CONFIG_H__ - - /** - * @file fds_config.h - * - * @defgroup flash_data_storage_config Configuration options - * @ingroup flash_data_storage +#ifndef NRF_LOG_CTRL_INTERNAL_H +#define NRF_LOG_CTRL_INTERNAL_H +/** + * @cond (NODOX) + * @defgroup nrf_log_ctrl_internal Auxiliary internal types declarations * @{ - * @brief Configuration options for FDS. + * @internal */ -/**@brief Configures the size of the internal queue. */ -#define FDS_OP_QUEUE_SIZE (4) +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(NRF_LOG) +#include "app_util_platform.h" -/**@brief Determines how many @ref fds_record_chunk_t structures can be buffered at any time. */ -#define FDS_CHUNK_QUEUE_SIZE (8) +#define NRF_LOG_INTERNAL_INIT(timestamp_func) \ + nrf_log_init(timestamp_func) -/**@brief Configures the maximum number of callbacks that can be registered. */ -#define FDS_MAX_USERS (3) +#if (NRF_LOG_DEFERRED == 0) +#define NRF_LOG_INTERNAL_PROCESS() false +#define NRF_LOG_INTERNAL_FLUSH() +#define NRF_LOG_INTERNAL_FINAL_FLUSH() +#else +#define NRF_LOG_INTERNAL_PROCESS() nrf_log_frontend_dequeue() +#define NRF_LOG_INTERNAL_FLUSH() \ + do { \ + while (NRF_LOG_INTERNAL_PROCESS()); \ + } while(0) -/**@brief Configures the number of virtual flash pages to use. - * - * The total amount of flash memory that is used by FDS amounts to - * @ref FDS_VIRTUAL_PAGES * @ref FDS_VIRTUAL_PAGE_SIZE * 4 bytes. - * On nRF51 ICs, this defaults to 3 * 256 * 4 bytes = 3072 bytes. - * On nRF52 ICs, it defaults to 3 * 1024 * 4 bytes = 12288 bytes. - * - * One of the virtual pages is reserved by the system for garbage collection. Therefore, the - * minimum is two virtual pages: one page to store data and one page to be used by the system for - * garbage collection. - */ -#define FDS_VIRTUAL_PAGES (3) - -/**@brief Configures the size of a virtual page of flash memory, expressed in number of - * 4-byte words. - * - * By default, a virtual page is the same size as a physical page. Therefore, the default size - * is 1024 bytes for nRF51 ICs and 4096 bytes for nRF52 ICs. - * - * The size of a virtual page must be a multiple of the size of a physical page. - */ -#if defined(NRF51) - #define FDS_VIRTUAL_PAGE_SIZE (256) -#elif defined(NRF52) - #define FDS_VIRTUAL_PAGE_SIZE (1024) +#if NRF_LOG_BACKEND_SERIAL_USES_RTT +#define NRF_LOG_INTERNAL_BACKEND_FINAL NRF_BREAKPOINT_COND +#else +#define NRF_LOG_INTERNAL_BACKEND_FINAL #endif -/** @} */ +#define NRF_LOG_INTERNAL_FINAL_FLUSH() \ + do { \ + (void)nrf_log_blocking_backend_set(); \ + NRF_LOG_INTERNAL_FLUSH(); \ + NRF_LOG_INTERNAL_BACKEND_FINAL; \ + } while(0) -#endif // FDS_CONFIG_H__ +#endif + +#define NRF_LOG_INTERNAL_HANDLERS_SET(default_handler, bytes_handler) \ + nrf_log_handlers_set(default_handler, bytes_handler) + +#else // NRF_MODULE_ENABLED(NRF_LOG) +#define NRF_LOG_INTERNAL_PROCESS() false +#define NRF_LOG_INTERNAL_FLUSH() +#define NRF_LOG_INTERNAL_INIT(timestamp_func) NRF_SUCCESS +#define NRF_LOG_INTERNAL_HANDLERS_SET(default_handler, bytes_handler) \ + UNUSED_PARAMETER(default_handler); UNUSED_PARAMETER(bytes_handler) +#define NRF_LOG_INTERNAL_FINAL_FLUSH() +#endif // NRF_MODULE_ENABLED(NRF_LOG) + +/** @} + * @endcond + */ +#endif // NRF_LOG_CTRL_INTERNAL_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_frontend.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_frontend.c new file mode 100644 index 0000000000..e7ba0895e6 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_frontend.c @@ -0,0 +1,824 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(NRF_LOG) +#include "app_util.h" +#include "app_util_platform.h" +#include "nrf_log.h" +#include "nrf_log_internal.h" +#include "nrf_log_backend.h" +#include "nrf_log_ctrl.h" +#include + +#if NRF_LOG_DEFERRED +STATIC_ASSERT((NRF_LOG_DEFERRED_BUFSIZE == 0) || IS_POWER_OF_TWO(NRF_LOG_DEFERRED_BUFSIZE)); +#else +#define NRF_LOG_DEFERRED_BUFSIZE 1 +#endif + +/** + * brief An internal control block of the logger + * + * @note Circular buffer is using never cleared indexes and a mask. It means + * that logger may break when indexes overflows. However, it is quite unlikely. + * With rate of 1000 log entries with 2 parameters per second such situation + * would happen after 12 days. + */ +typedef struct +{ + uint32_t wr_idx; // Current write index (never reset) + uint32_t rd_idx; // Current read index (never_reset) + uint32_t mask; // Size of buffer (must be power of 2) presented as mask + uint32_t buffer[NRF_LOG_DEFERRED_BUFSIZE]; + nrf_log_timestamp_func_t timestamp_func; // A pointer to function that returns timestamp + nrf_log_std_handler_t std_handler; // A handler used for processing standard log calls + nrf_log_hexdump_handler_t hexdump_handler; // A handler for processing hex dumps +} log_data_t; + +static log_data_t m_log_data; +#if (NRF_LOG_DEFERRED == 1) +static const char * m_overflow_info = NRF_LOG_ERROR_COLOR_CODE "Overflow\r\n"; +#endif //(NRF_LOG_DEFERRED == 1) + +/** + * Set of macros for encoding and decoding header for log entries. + * There are 3 types of entries: + * 1. Standard entry (STD) + * An entry consists of header, pointer to string and values. Header contains + * severity leveland determines number of arguments and thus size of the entry. + * Since flash address space starts from 0x00000000 and is limited to kB rather + * than MB 22 bits are used to store the address (4MB). It is used that way to + * save one RAM memory. + * + * -------------------------------- + * |TYPE|SEVERITY|NARGS| P_STR | + * |------------------------------| + * | TIMESTAMP (optional) | + * |------------------------------| + * | ARG0 | + * |------------------------------| + * | .... | + * |------------------------------| + * | ARG(nargs-1) | + * -------------------------------- + * + * 2. Hexdump entry (HEXDUMP) is used for dumping raw data. An entry consists of + * header, optional timestamp, pointer to string and data. A header contains + * length (10bit) and offset which is updated after backend processes part of + * data. + * + * -------------------------------- + * |TYPE|SEVERITY|NARGS|OFFSET|LEN| + * |------------------------------| + * | TIMESTAMP (optional) | + * |------------------------------| + * | P_STR | + * |------------------------------| + * | data | + * |------------------------------| + * | data | dummy | + * -------------------------------- + * + * 3. Pushed string. If string is pushed into the logger internal buffer it is + * stored as PUSHED entry. It consists of header, unused data (optional) and + * string. Unused data is present if string does not not fit into a buffer + * without wrapping (and string cannot be wrapped). In that case header + * contains information about offset. + * + * -------------------------------- + * |TYPE| OFFSET | LEN | + * |------------------------------| + * | OFFSET | + * |------------------------------| + * end| OFFSET | + * 0|------------------------------| + * | STRING | + * |------------------------------| + * | STRING | dummy | + * -------------------------------- + */ +#define HEADER_SIZE ((NRF_LOG_USES_TIMESTAMP) ? 2 : 1) + +#define STD_ADDR_MASK ((uint32_t)(1U << 22) - 1U) +#define HEADER_TYPE_STD 1U +#define HEADER_TYPE_HEXDUMP 2U +#define HEADER_TYPE_PUSHED 0U + +typedef struct +{ + uint32_t type : 2; + uint32_t raw : 1; + uint32_t data : 29; +} nrf_log_generic_header_t; + +typedef struct +{ + uint32_t type : 2; + uint32_t raw : 1; + uint32_t severity : 3; + uint32_t nargs : 4; + uint32_t addr : 22; +} nrf_log_std_header_t; + +typedef struct +{ + uint32_t type : 2; + uint32_t raw : 1; + uint32_t severity : 3; + uint32_t offset : 10; + uint32_t reserved : 6; + uint32_t len : 10; +} nrf_log_hexdump_header_t; + +typedef struct +{ + uint32_t type : 2; + uint32_t reserved0 : 4; + uint32_t offset : 10; + uint32_t reserved1 : 6; + uint32_t len : 10; +} nrf_log_pushed_header_t; + +typedef union +{ + nrf_log_generic_header_t generic; + nrf_log_std_header_t std; + nrf_log_hexdump_header_t hexdump; + nrf_log_pushed_header_t pushed; + uint32_t raw; +} nrf_log_header_t; + +/* IAR does not support initialization with non-constant variables */ +#if defined ( __ICCARM__ ) +#define STD_HEADER_DEF(NAME, P_STR, SEVERITY, NARGS) \ + nrf_log_header_t NAME = { \ + .std = { \ + .type = HEADER_TYPE_STD, \ + } \ + }; \ + NAME.std.type = HEADER_TYPE_STD; \ + NAME.std.raw = ((SEVERITY) & NRF_LOG_RAW); \ + NAME.std.severity = (SEVERITY) & NRF_LOG_LEVEL_MASK; \ + NAME.std.nargs = (NARGS); \ + NAME.std.addr = ((uint32_t)(P_STR) & STD_ADDR_MASK) +#else +#define STD_HEADER_DEF(NAME, P_STR, SEVERITY, NARGS) \ + nrf_log_header_t NAME = { \ + .std = { \ + .type = HEADER_TYPE_STD, \ + .raw = ((SEVERITY) & NRF_LOG_RAW), \ + .severity = (SEVERITY) & NRF_LOG_LEVEL_MASK, \ + .nargs = (NARGS), \ + .addr = ((uint32_t)(P_STR) & STD_ADDR_MASK)\ + } \ + } +#endif + +#if defined ( __ICCARM__ ) +#define HEXDUMP_HEADER_DEF(NAME, SEVERITY, LENGTH) \ + nrf_log_header_t NAME = { \ + .hexdump = { \ + .type = HEADER_TYPE_HEXDUMP, \ + .offset = 0, \ + } \ + }; \ + NAME.hexdump.raw = ((SEVERITY) & NRF_LOG_RAW); \ + NAME.hexdump.severity = (SEVERITY) & NRF_LOG_LEVEL_MASK;\ + NAME.hexdump.len = (LENGTH) + +#else +#define HEXDUMP_HEADER_DEF(NAME, SEVERITY, LENGTH) \ + nrf_log_header_t NAME = { \ + .hexdump = { \ + .type = HEADER_TYPE_HEXDUMP, \ + .raw = ((SEVERITY) & NRF_LOG_RAW), \ + .severity = (SEVERITY) & NRF_LOG_LEVEL_MASK, \ + .offset = 0, \ + .len = LENGTH, \ + } \ + } +#endif + +#if defined ( __ICCARM__ ) +#define PUSHED_HEADER_DEF(NAME, OFFSET, LENGTH) \ + nrf_log_header_t NAME = { \ + .pushed = { \ + .type = HEADER_TYPE_PUSHED, \ + } \ + }; \ + NAME.pushed.offset = (OFFSET); \ + NAME.pushed.len = (LENGTH) + +#else +#define PUSHED_HEADER_DEF(NAME, OFFSET, LENGTH) \ + nrf_log_header_t NAME = { \ + .pushed = { \ + .type = HEADER_TYPE_PUSHED, \ + .offset = (OFFSET), \ + .len = (LENGTH), \ + } \ + } + +#endif + +ret_code_t nrf_log_init(nrf_log_timestamp_func_t timestamp_func) +{ + if (NRF_LOG_USES_TIMESTAMP && (timestamp_func == NULL)) + { + return NRF_ERROR_INVALID_PARAM; + } + + ret_code_t err_code = nrf_log_backend_init(NRF_LOG_DEFERRED ? false : true); + + if (err_code == NRF_SUCCESS) + { + nrf_log_frontend_init(nrf_log_backend_std_handler_get(), + nrf_log_backend_hexdump_handler_get(), + timestamp_func); + } + return err_code; +} + + +ret_code_t nrf_log_blocking_backend_set(void) +{ + // Return value is ommited because + return nrf_log_backend_init(true); +} + + +void nrf_log_frontend_init(nrf_log_std_handler_t std_handler, + nrf_log_hexdump_handler_t hexdump_handler, + nrf_log_timestamp_func_t timestamp_func) +{ +#if NRF_LOG_DEFERRED + m_log_data.mask = NRF_LOG_DEFERRED_BUFSIZE - 1; + m_log_data.wr_idx = 0; + m_log_data.rd_idx = 0; +#endif //NRF_LOG_DEFERRED +#if NRF_LOG_USES_TIMESTAMP + m_log_data.timestamp_func = timestamp_func; +#endif //NRF_LOG_USES_TIMESTAMP + nrf_log_handlers_set(std_handler, hexdump_handler); +} + + +void nrf_log_handlers_set(nrf_log_std_handler_t std_handler, + nrf_log_hexdump_handler_t hexdump_handler) +{ + m_log_data.std_handler = std_handler; + m_log_data.hexdump_handler = hexdump_handler; +} + +#if (NRF_LOG_DEFERRED == 1) +/** + * @brief Allocates chunk in a buffer for one entry and injects overflow if + * there is no room for requested entry. + * + * @param nargs Number of 32bit arguments. In case of allocating for hex dump it + * is the size of the buffer in 32bit words (ceiled). + * @param p_wr_idx Pointer to write index. + * + * @return True if successful allocation, false otherwise. + * + */ +static inline bool buf_prealloc(uint32_t nargs, uint32_t * p_wr_idx) +{ + nargs += HEADER_SIZE; + uint32_t ovflw_tag_size = HEADER_SIZE; + bool ret = true; + CRITICAL_REGION_ENTER(); + *p_wr_idx = m_log_data.wr_idx; + uint32_t available_words = (m_log_data.mask + 1) - (m_log_data.wr_idx - m_log_data.rd_idx); + uint32_t required_words = nargs + ovflw_tag_size; // room for current entry and overflow + if (required_words > available_words) + { + if (available_words >= HEADER_SIZE) + { + // Overflow entry is injected + STD_HEADER_DEF(header, m_overflow_info, NRF_LOG_LEVEL_INTERNAL, 0); + m_log_data.buffer[m_log_data.wr_idx++ & m_log_data.mask] = + header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[m_log_data.wr_idx++ & m_log_data.mask] = + m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + } + // overflow case + ret = false; + } + else + { + m_log_data.wr_idx += nargs; + } + CRITICAL_REGION_EXIT(); + return ret; +} + + +/** + * @brief Function for preallocating a continuous chunk of memory from circular buffer. + * + * If buffer does not fit starting from current position it will be allocated at + * the beginning of the circular buffer and offset will be returned indicating + * how much memory has been ommited at the end of the buffer. Function is + * using critical section. + * + * @param len32 Length of buffer to allocate. Given in words. + * @param p_offset Offset of the buffer. + * @param p_wr_idx Pointer to write index. + * + * @return A pointer to the allocated buffer. NULL if allocation failed. + */ +static inline uint32_t * cont_buf_prealloc(uint32_t len32, + uint32_t * p_offset, + uint32_t * p_wr_idx) +{ + uint32_t * p_buf = NULL; + + len32++; // Increment because 32bit header is needed to be stored. + + CRITICAL_REGION_ENTER(); + *p_wr_idx = m_log_data.wr_idx; + uint32_t available_words = (m_log_data.mask + 1) - + (m_log_data.wr_idx & m_log_data.mask); + if (len32 <= available_words) + { + // buffer will fit as is + p_buf = &m_log_data.buffer[(m_log_data.wr_idx + 1) & m_log_data.mask]; + m_log_data.wr_idx += len32; + *p_offset = 0; + } + else if (len32 < (m_log_data.rd_idx & m_log_data.mask)) + { + // wraping to the begining of the buffer + m_log_data.wr_idx += (len32 + available_words - 1); + *p_offset = available_words - 1; + p_buf = m_log_data.buffer; + } + available_words = (m_log_data.mask + 1) - (m_log_data.wr_idx - m_log_data.rd_idx); + // If there is no more room for even overflow tag indicate failed allocation. + if (available_words < HEADER_SIZE) + { + p_buf = NULL; + } + CRITICAL_REGION_EXIT(); + + return p_buf; +} +#endif //(NRF_LOG_DEFERRED == 1) + + +#if (NRF_LOG_DEFERRED == 0) +static inline void nrf_log_direct_feed(uint8_t type, + char const * const p_str, + uint32_t * p_args, + uint32_t nargs) +{ + uint32_t timestamp = 0; + uint32_t * p_timestamp = NRF_LOG_USES_TIMESTAMP ? ×tamp : NULL; + +#if NRF_LOG_USES_TIMESTAMP + timestamp = m_log_data.timestamp_func(); +#else //NRF_LOG_USES_TIMESTAMP + UNUSED_VARIABLE(timestamp); +#endif //NRF_LOG_USES_TIMESTAMP + + UNUSED_VARIABLE + (m_log_data.std_handler(type, p_timestamp, (char *)p_str, p_args, nargs)); + +} +#endif //(NRF_LOG_DEFERRED == 0) + + +uint32_t nrf_log_push(char * const p_str) +{ +#if (NRF_LOG_DEFERRED == 0) + return (uint32_t)p_str; +#else //(NRF_LOG_DEFERRED == 0) + uint32_t mask = m_log_data.mask; + uint32_t slen = strlen(p_str) + 1; + uint32_t buflen = CEIL_DIV(slen, 4); + uint32_t offset = 0; + uint32_t wr_idx; + char * p_dst_str = (char *)cont_buf_prealloc(buflen, &offset, &wr_idx); + if (p_dst_str) + { + PUSHED_HEADER_DEF(header, offset, buflen); + m_log_data.buffer[wr_idx++ & mask] = header.raw; + memcpy(p_dst_str, p_str, slen); + } + return (uint32_t)p_dst_str; +#endif //(NRF_LOG_DEFERRED == 0) +} + + +void nrf_log_frontend_std_0(uint8_t severity, char const * const p_str) +{ +#if (NRF_LOG_DEFERRED == 0) + nrf_log_direct_feed(severity, p_str, NULL, 0); +#else //(NRF_LOG_DEFERRED == 0) + uint32_t nargs = 0; + uint32_t mask = m_log_data.mask; + uint32_t wr_idx; + if (buf_prealloc(nargs, &wr_idx)) + { + // Proceed only if buffer was successfully preallocated. + STD_HEADER_DEF(header, p_str, severity, nargs); + m_log_data.buffer[wr_idx++ & mask] = header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + } +#endif //(NRF_LOG_DEFERRED == 0) +} + + +void nrf_log_frontend_std_1(uint8_t severity, + char const * const p_str, + uint32_t val0) +{ +#if (NRF_LOG_DEFERRED == 0) + uint32_t args[] = {val0}; + nrf_log_direct_feed(severity, p_str, args, ARRAY_SIZE(args)); +#else //(NRF_LOG_DEFERRED == 0) + uint32_t nargs = 1; + uint32_t mask = m_log_data.mask; + uint32_t wr_idx; + if (buf_prealloc(nargs, &wr_idx)) + { + // Proceed only if buffer was successfully preallocated. + STD_HEADER_DEF(header, p_str, severity, nargs); + m_log_data.buffer[wr_idx++ & mask] = header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx & mask] = val0; + } +#endif //(NRF_LOG_DEFERRED == 0) +} + + +void nrf_log_frontend_std_2(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1) +{ +#if (NRF_LOG_DEFERRED == 0) + uint32_t args[] = {val0, val1}; + nrf_log_direct_feed(severity, p_str, args, ARRAY_SIZE(args)); +#else //(NRF_LOG_DEFERRED == 0) + uint32_t nargs = 2; + uint32_t mask = m_log_data.mask; + uint32_t wr_idx; + if (buf_prealloc(nargs, &wr_idx)) + { + // Proceed only if buffer was successfully preallocated. + STD_HEADER_DEF(header, p_str, severity, nargs); + m_log_data.buffer[wr_idx++ & mask] = header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = val0; + m_log_data.buffer[wr_idx & mask] = val1; + } +#endif //(NRF_LOG_DEFERRED == 0) +} + + +void nrf_log_frontend_std_3(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1, + uint32_t val2) +{ +#if (NRF_LOG_DEFERRED == 0) + uint32_t args[] = {val0, val1, val2}; + nrf_log_direct_feed(severity, p_str, args, ARRAY_SIZE(args)); +#else //(NRF_LOG_DEFERRED == 0) + uint32_t nargs = 3; + uint32_t mask = m_log_data.mask; + uint32_t wr_idx; + if (buf_prealloc(nargs, &wr_idx)) + { + // Proceed only if buffer was successfully preallocated. + STD_HEADER_DEF(header, p_str, severity, nargs); + m_log_data.buffer[wr_idx++ & mask] = header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = val0; + m_log_data.buffer[wr_idx++ & mask] = val1; + m_log_data.buffer[wr_idx & mask] = val2; + } +#endif //(NRF_LOG_DEFERRED == 0) +} + + +void nrf_log_frontend_std_4(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1, + uint32_t val2, + uint32_t val3) +{ +#if (NRF_LOG_DEFERRED == 0) + uint32_t args[] = {val0, val1, val2, val3}; + nrf_log_direct_feed(severity, p_str, args, ARRAY_SIZE(args)); +#else //(NRF_LOG_DEFERRED == 0) + uint32_t nargs = 4; + uint32_t mask = m_log_data.mask; + uint32_t wr_idx; + if (buf_prealloc(nargs, &wr_idx)) + { + // Proceed only if buffer was successfully preallocated. + STD_HEADER_DEF(header, p_str, severity, nargs); + m_log_data.buffer[wr_idx++ & mask] = header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = val0; + m_log_data.buffer[wr_idx++ & mask] = val1; + m_log_data.buffer[wr_idx++ & mask] = val2; + m_log_data.buffer[wr_idx & mask] = val3; + } +#endif //(NRF_LOG_DEFERRED == 0) +} + + +void nrf_log_frontend_std_5(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1, + uint32_t val2, + uint32_t val3, + uint32_t val4) +{ +#if (NRF_LOG_DEFERRED == 0) + uint32_t args[] = {val0, val1, val2, val3, val4}; + nrf_log_direct_feed(severity, p_str, args, ARRAY_SIZE(args)); +#else //(NRF_LOG_DEFERRED == 0) + uint32_t nargs = 5; + uint32_t mask = m_log_data.mask; + uint32_t wr_idx; + if (buf_prealloc(nargs, &wr_idx)) + { + // Proceed only if buffer was successfully preallocated. + STD_HEADER_DEF(header, p_str, severity, nargs); + m_log_data.buffer[wr_idx++ & mask] = header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = val0; + m_log_data.buffer[wr_idx++ & mask] = val1; + m_log_data.buffer[wr_idx++ & mask] = val2; + m_log_data.buffer[wr_idx++ & mask] = val3; + m_log_data.buffer[wr_idx & mask] = val4; + } +#endif //(NRF_LOG_DEFERRED == 0) +} + + +void nrf_log_frontend_std_6(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1, + uint32_t val2, + uint32_t val3, + uint32_t val4, + uint32_t val5) +{ +#if (NRF_LOG_DEFERRED == 0) + uint32_t args[] = {val0, val1, val2, val3, val4, val5}; + nrf_log_direct_feed(severity, p_str, args, ARRAY_SIZE(args)); +#else //(NRF_LOG_DEFERRED == 0) + uint32_t nargs = 6; + uint32_t mask = m_log_data.mask; + uint32_t wr_idx; + if (buf_prealloc(nargs, &wr_idx)) + { + // Proceed only if buffer was successfully preallocated. + STD_HEADER_DEF(header, p_str, severity, nargs); + m_log_data.buffer[wr_idx++ & mask] = header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = val0; + m_log_data.buffer[wr_idx++ & mask] = val1; + m_log_data.buffer[wr_idx++ & mask] = val2; + m_log_data.buffer[wr_idx++ & mask] = val3; + m_log_data.buffer[wr_idx++ & mask] = val4; + m_log_data.buffer[wr_idx & mask] = val5; + } +#endif //(NRF_LOG_DEFERRED == 0) +} + + +void nrf_log_frontend_hexdump(uint8_t severity, + char const * const p_str, + const void * const p_data, + uint16_t length) +{ +#if (NRF_LOG_DEFERRED == 0) + uint32_t timestamp = 0; +#if NRF_LOG_USES_TIMESTAMP + timestamp = m_log_data.timestamp_func(); +#else //NRF_LOG_USES_TIMESTAMP + (void) timestamp; +#endif //NRF_LOG_USES_TIMESTAMP + + uint32_t curr_offset = 0; + + do + { + curr_offset = m_log_data.hexdump_handler(severity, + NRF_LOG_USES_TIMESTAMP ? ×tamp : NULL, + p_str, + curr_offset, + p_data, + length, + NULL, + 0); + } + while (curr_offset < length); +#else //(NRF_LOG_DEFERRED == 0) + uint32_t mask = m_log_data.mask; + + uint32_t wr_idx; + if (buf_prealloc(CEIL_DIV(length, 4) + 1, &wr_idx)) + { + HEXDUMP_HEADER_DEF(header, severity, length); + m_log_data.buffer[wr_idx++ & mask] = header.raw; +#if NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = m_log_data.timestamp_func(); +#endif //NRF_LOG_USES_TIMESTAMP + m_log_data.buffer[wr_idx++ & mask] = (uint32_t)p_str; + uint32_t space0 = sizeof(uint32_t) * (m_log_data.mask + 1 - (wr_idx & mask)); + if (length <= space0) + { + memcpy(&m_log_data.buffer[wr_idx & mask], p_data, length); + } + else + { + memcpy(&m_log_data.buffer[wr_idx & mask], p_data, space0); + length -= space0; + memcpy(&m_log_data.buffer[0], &((uint8_t *)p_data)[space0], length); + } + } +#endif //(NRF_LOG_DEFERRED == 0) +} + + +bool buffer_is_empty(void) +{ + return (m_log_data.rd_idx == m_log_data.wr_idx); +} + + +bool nrf_log_frontend_dequeue(void) +{ + if (buffer_is_empty()) + { + return false; + } + + uint32_t rd_idx = m_log_data.rd_idx; + uint32_t mask = m_log_data.mask; + uint32_t header_rd_idx = rd_idx; + // uint32_t header = m_log_data.buffer[rd_idx++ & mask]; + nrf_log_header_t header; + header.raw = m_log_data.buffer[rd_idx++ & mask]; + + // Skip any string that is pushed to the circular buffer. + while (header.generic.type == HEADER_TYPE_PUSHED) + { + rd_idx += (header.pushed.len + header.pushed.offset); + header_rd_idx = rd_idx; + header.raw = m_log_data.buffer[rd_idx++ & mask]; + } + + uint32_t * p_timestamp = NRF_LOG_USES_TIMESTAMP ? + &m_log_data.buffer[rd_idx++ & mask] : NULL; + + if (header.generic.raw) + { + p_timestamp = NULL; + } + + bool ret = false; + if (header.generic.type == HEADER_TYPE_HEXDUMP) + { + // buffer + char * p_str = (char *)m_log_data.buffer[rd_idx++ & mask]; + uint32_t length = header.hexdump.len; + uint32_t offset = header.hexdump.offset; + uint32_t space0 = sizeof(uint32_t) * (mask + 1 - (rd_idx & mask)); + if (length > space0) + { + uint8_t * ptr0 = space0 ? + (uint8_t *)&m_log_data.buffer[rd_idx & mask] : + (uint8_t *)&m_log_data.buffer[0]; + uint8_t len0 = space0 ? space0 : length; + uint8_t * ptr1 = space0 ? + (uint8_t *)&m_log_data.buffer[0] : NULL; + uint8_t len1 = space0 ? length - space0 : 0; + + offset = m_log_data.hexdump_handler(header.hexdump.severity, + p_timestamp, p_str, + offset, + ptr0, len0, + ptr1, len1); + } + else + { + offset = m_log_data.hexdump_handler( + header.hexdump.severity, + p_timestamp, + p_str, + offset, + (uint8_t *)&m_log_data.buffer[rd_idx & mask], + length, + NULL, 0); + } + + if (offset == length) + { + rd_idx += CEIL_DIV(length, 4); + ret = true; + } + else + { + // If there is more log to process just updated the offset but + // do not move rd_idx. + header.hexdump.offset = offset; + m_log_data.buffer[header_rd_idx & mask] = header.raw; + } + } + else // standard entry + { + uint32_t args[6]; + uint32_t * p_arg = args; + char * p_str = (char *)((uint32_t)header.std.addr); + uint32_t nargs = header.std.nargs; + + uint32_t i; + + for (i = 0; i < nargs; i++) + { + *p_arg = m_log_data.buffer[rd_idx++ & mask]; + p_arg++; + } + + ret = m_log_data.std_handler(header.std.severity, + p_timestamp, + p_str, args, nargs); + } + if (ret) + { + m_log_data.rd_idx = rd_idx; + } + return buffer_is_empty() ? false : true; + +} + +uint8_t nrf_log_getchar(void) +{ + return nrf_log_backend_getchar(); +} + +#endif // NRF_MODULE_ENABLED(NRF_LOG) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_internal.h new file mode 100644 index 0000000000..cb05edf124 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_internal.h @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef NRF_LOG_INTERNAL_H__ +#define NRF_LOG_INTERNAL_H__ +#include "sdk_common.h" +#include "nrf.h" +#include "nrf_error.h" +#include "app_util.h" +#include +#include + +#ifndef NRF_LOG_DEFAULT_LEVEL +#define NRF_LOG_DEFAULT_LEVEL 0 +#endif + +#ifndef NRF_LOG_USES_COLORS +#define NRF_LOG_USES_COLORS 0 +#endif + +#define NRF_LOG_LEVEL_ERROR 1U +#define NRF_LOG_LEVEL_WARNING 2U +#define NRF_LOG_LEVEL_INFO 3U +#define NRF_LOG_LEVEL_DEBUG 4U +#define NRF_LOG_LEVEL_INTERNAL 5U +#define NRF_LOG_LEVEL_MASK 0x07 +#define NRF_LOG_RAW_POS 4U +#define NRF_LOG_RAW (1U << NRF_LOG_RAW_POS) +#define NRF_LOG_LEVEL_INFO_RAW (NRF_LOG_RAW | NRF_LOG_LEVEL_INFO) + + +#define NRF_LOG_COLOR_CODE_DEFAULT "\x1B[0m" +#define NRF_LOG_COLOR_CODE_BLACK "\x1B[1;30m" +#define NRF_LOG_COLOR_CODE_RED "\x1B[1;31m" +#define NRF_LOG_COLOR_CODE_GREEN "\x1B[1;32m" +#define NRF_LOG_COLOR_CODE_YELLOW "\x1B[1;33m" +#define NRF_LOG_COLOR_CODE_BLUE "\x1B[1;34m" +#define NRF_LOG_COLOR_CODE_MAGENTA "\x1B[1;35m" +#define NRF_LOG_COLOR_CODE_CYAN "\x1B[1;36m" +#define NRF_LOG_COLOR_CODE_WHITE "\x1B[1;37m" + +#define NRF_LOG_COLOR_0 NRF_LOG_COLOR_CODE_DEFAULT +#define NRF_LOG_COLOR_1 NRF_LOG_COLOR_CODE_BLACK +#define NRF_LOG_COLOR_2 NRF_LOG_COLOR_CODE_RED +#define NRF_LOG_COLOR_3 NRF_LOG_COLOR_CODE_GREEN +#define NRF_LOG_COLOR_4 NRF_LOG_COLOR_CODE_YELLOW +#define NRF_LOG_COLOR_5 NRF_LOG_COLOR_CODE_BLUE +#define NRF_LOG_COLOR_6 NRF_LOG_COLOR_CODE_MAGENTA +#define NRF_LOG_COLOR_7 NRF_LOG_COLOR_CODE_CYAN +#define NRF_LOG_COLOR_8 NRF_LOG_COLOR_CODE_WHITE + +#define NRF_LOG_COLOR_DECODE(N) CONCAT_2(NRF_LOG_COLOR_, N) +#if NRF_LOG_USES_COLORS +#define NRF_LOG_ERROR_COLOR_CODE NRF_LOG_COLOR_DECODE(NRF_LOG_ERROR_COLOR) +#define NRF_LOG_WARNING_COLOR_CODE NRF_LOG_COLOR_DECODE(NRF_LOG_WARNING_COLOR) +#define NRF_LOG_INFO_COLOR_CODE NRF_LOG_COLOR_DECODE(NRF_LOG_INFO_COLOR) +#define NRF_LOG_DEBUG_COLOR_CODE NRF_LOG_COLOR_DECODE(NRF_LOG_DEBUG_COLOR) +#else // NRF_LOG_USES_COLORS +#define NRF_LOG_ERROR_COLOR_CODE +#define NRF_LOG_WARNING_COLOR_CODE +#define NRF_LOG_INFO_COLOR_CODE +#define NRF_LOG_DEBUG_COLOR_CODE +#endif // NRF_LOG_USES_COLORS + +#define LOG_INTERNAL_0(type, prefix, str) \ + nrf_log_frontend_std_0(type, prefix str) +#define LOG_INTERNAL_1(type, prefix, str, arg0) \ + nrf_log_frontend_std_1(type, prefix str, arg0) +#define LOG_INTERNAL_2(type, prefix, str, arg0, arg1) \ + nrf_log_frontend_std_2(type, prefix str, arg0, arg1) +#define LOG_INTERNAL_3(type, prefix, str, arg0, arg1, arg2) \ + nrf_log_frontend_std_3(type, prefix str, arg0, arg1, arg2) +#define LOG_INTERNAL_4(type, prefix, str, arg0, arg1, arg2, arg3) \ + nrf_log_frontend_std_4(type, prefix str, arg0, arg1, arg2, arg3) +#define LOG_INTERNAL_5(type, prefix, str, arg0, arg1, arg2, arg3, arg4) \ + nrf_log_frontend_std_5(type, prefix str, arg0, arg1, arg2, arg3, arg4) +#define LOG_INTERNAL_6(type, prefix, str, arg0, arg1, arg2, arg3, arg4, arg5) \ + nrf_log_frontend_std_6(type, prefix str, arg0, arg1, arg2, arg3, arg4, arg5) + +#define LOG_INTERNAL_X(N, ...) CONCAT_2(LOG_INTERNAL_, N) (__VA_ARGS__) +#define LOG_INTERNAL(type, prefix, ...) LOG_INTERNAL_X(NUM_VA_ARGS_LESS_1( \ + __VA_ARGS__), type, prefix, __VA_ARGS__) + +#define NRF_LOG_BREAK ":" + +#define LOG_ERROR_PREFIX NRF_LOG_ERROR_COLOR_CODE NRF_LOG_MODULE_NAME NRF_LOG_BREAK "ERROR:" +#define LOG_WARNING_PREFIX NRF_LOG_WARNING_COLOR_CODE NRF_LOG_MODULE_NAME NRF_LOG_BREAK "WARNING:" +#define LOG_INFO_PREFIX NRF_LOG_INFO_COLOR_CODE NRF_LOG_MODULE_NAME NRF_LOG_BREAK "INFO:" +#define LOG_DEBUG_PREFIX NRF_LOG_DEBUG_COLOR_CODE NRF_LOG_MODULE_NAME NRF_LOG_BREAK "DEBUG:" + +#define NRF_LOG_INTERNAL_ERROR(...) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_ERROR) && \ + (NRF_LOG_LEVEL_ERROR <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + LOG_INTERNAL(NRF_LOG_LEVEL_ERROR, LOG_ERROR_PREFIX, __VA_ARGS__); \ + } +#define NRF_LOG_INTERNAL_HEXDUMP_ERROR(p_data, len) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_ERROR) && \ + (NRF_LOG_LEVEL_ERROR <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + nrf_log_frontend_hexdump(NRF_LOG_LEVEL_ERROR, LOG_ERROR_PREFIX "\r\n", (p_data), (len)); \ + } + +#define NRF_LOG_INTERNAL_WARNING(...) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_WARNING) && \ + (NRF_LOG_LEVEL_WARNING <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + LOG_INTERNAL(NRF_LOG_LEVEL_WARNING, LOG_WARNING_PREFIX, __VA_ARGS__); \ + } +#define NRF_LOG_INTERNAL_HEXDUMP_WARNING(p_data, len) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_WARNING) && \ + (NRF_LOG_LEVEL_WARNING <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + nrf_log_frontend_hexdump(NRF_LOG_LEVEL_WARNING, LOG_WARNING_PREFIX "\r\n", (p_data), (len)); \ + } + +#define NRF_LOG_INTERNAL_INFO(...) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_INFO) && \ + (NRF_LOG_LEVEL_INFO <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + LOG_INTERNAL(NRF_LOG_LEVEL_INFO, LOG_INFO_PREFIX, __VA_ARGS__); \ + } + +#define NRF_LOG_INTERNAL_RAW_INFO(...) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_INFO) && \ + (NRF_LOG_LEVEL_INFO <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + LOG_INTERNAL(NRF_LOG_LEVEL_INFO | NRF_LOG_RAW, "", __VA_ARGS__); \ + } + +#define NRF_LOG_INTERNAL_HEXDUMP_INFO(p_data, len) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_INFO) && \ + (NRF_LOG_LEVEL_INFO <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + nrf_log_frontend_hexdump(NRF_LOG_LEVEL_INFO, LOG_INFO_PREFIX "\r\n", (p_data), (len)); \ + } + +#define NRF_LOG_INTERNAL_RAW_HEXDUMP_INFO(p_data, len) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_INFO) && \ + (NRF_LOG_LEVEL_INFO <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + nrf_log_frontend_hexdump(NRF_LOG_LEVEL_INFO | NRF_LOG_RAW, "", (p_data), (len)); \ + } + +#define NRF_LOG_INTERNAL_DEBUG(...) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_DEBUG) && \ + (NRF_LOG_LEVEL_DEBUG <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + LOG_INTERNAL(NRF_LOG_LEVEL_DEBUG, LOG_DEBUG_PREFIX, __VA_ARGS__); \ + } +#define NRF_LOG_INTERNAL_HEXDUMP_DEBUG(p_data, len) \ + if ((NRF_LOG_LEVEL >= NRF_LOG_LEVEL_DEBUG) && \ + (NRF_LOG_LEVEL_DEBUG <= NRF_LOG_DEFAULT_LEVEL)) \ + { \ + nrf_log_frontend_hexdump(NRF_LOG_LEVEL_DEBUG, LOG_DEBUG_PREFIX "\r\n", (p_data), (len)); \ + } + +#if NRF_MODULE_ENABLED(NRF_LOG) +#define NRF_LOG_INTERNAL_GETCHAR() nrf_log_getchar() +#else +#define NRF_LOG_INTERNAL_GETCHAR() (void) +#endif + +/** + * @brief A function for logging raw string. + * + * @param severity Severity. + * @param p_str A pointer to a string. + */ +void nrf_log_frontend_std_0(uint8_t severity, char const * const p_str); + +/** + * @brief A function for logging a formatted string with one argument. + * + * @param severity Severity. + * @param p_str A pointer to a formatted string. + * @param val0 An argument. + */ +void nrf_log_frontend_std_1(uint8_t severity, + char const * const p_str, + uint32_t val0); + +/** + * @brief A function for logging a formatted string with 2 arguments. + * + * @param severity Severity. + * @param p_str A pointer to a formatted string. + * @param val0, val1 Arguments for formatting string. + */ +void nrf_log_frontend_std_2(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1); + +/** + * @brief A function for logging a formatted string with 3 arguments. + * + * @param severity Severity. + * @param p_str A pointer to a formatted string. + * @param val0, val1, val2 Arguments for formatting string. + */ +void nrf_log_frontend_std_3(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1, + uint32_t val2); + +/** + * @brief A function for logging a formatted string with 4 arguments. + * + * @param severity Severity. + * @param p_str A pointer to a formatted string. + * @param val0, val1, val2, val3 Arguments for formatting string. + */ +void nrf_log_frontend_std_4(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1, + uint32_t val2, + uint32_t val3); + +/** + * @brief A function for logging a formatted string with 5 arguments. + * + * @param severity Severity. + * @param p_str A pointer to a formatted string. + * @param val0, val1, val2, val3, val4 Arguments for formatting string. + */ +void nrf_log_frontend_std_5(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1, + uint32_t val2, + uint32_t val3, + uint32_t val4); + +/** + * @brief A function for logging a formatted string with 6 arguments. + * + * @param severity Severity. + * @param p_str A pointer to a formatted string. + * @param val0, val1, val2, val3, val4, val5 Arguments for formatting string. + */ +void nrf_log_frontend_std_6(uint8_t severity, + char const * const p_str, + uint32_t val0, + uint32_t val1, + uint32_t val2, + uint32_t val3, + uint32_t val4, + uint32_t val5); + +/** + * @brief A function for logging raw data. + * + * @param severity Severity. + * @param p_str A pointer to a string which is prefixing the data. + * @param p_data A pointer to data to be dumped. + * @param length Length of data (in bytes). + * + */ +void nrf_log_frontend_hexdump(uint8_t severity, + char const * const p_str, + const void * const p_data, + uint16_t length); + +/** + * @brief A function for reading a byte from log backend. + * + * @return Byte. + */ +uint8_t nrf_log_getchar(void); +#endif // NRF_LOG_INTERNAL_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.c index 0a090efc65..bb789dd9b4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.c @@ -35,8 +35,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(APP_PWM) #include "app_pwm.h" #include "nrf_drv_timer.h" #include "nrf_drv_ppi.h" @@ -44,7 +44,6 @@ #include "nrf_drv_gpiote.h" #include "nrf_gpiote.h" #include "nrf_gpio.h" -#include "app_util.h" #include "app_util_platform.h" #include "nrf_assert.h" @@ -57,7 +56,9 @@ #define TIMER_PRESCALER_MAX 9 #define TIMER_MAX_PULSEWIDTH_US_ON_16M 4095 +#ifndef GPIOTE_SET_CLEAR_TASKS #define APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE 2 +#endif #define APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL 2 #define UNALLOCATED 0xFFFFFFFFUL @@ -67,8 +68,8 @@ #define PWM_MAIN_CC_CHANNEL 2 #define PWM_SECONDARY_CC_CHANNEL 3 -#ifdef NRF52 - static bool m_use_ppi_delay_workaround; +#ifdef GPIOTE_SET_CLEAR_TASKS +static bool m_use_ppi_delay_workaround; #endif @@ -114,6 +115,7 @@ static const app_pwm_t * m_instances[TIMER_COUNT]; //lint -save -e534 + /** * @brief Workaround for PAN-73. * @@ -122,7 +124,7 @@ static const app_pwm_t * m_instances[TIMER_COUNT]; */ static void pan73_workaround(NRF_TIMER_Type * p_timer, bool enable) { -#ifdef NRF51 +#ifndef GPIOTE_SET_CLEAR_TASKS if (p_timer == NRF_TIMER0) { *(uint32_t *)0x40008C0C = (enable ? 1 : 0); @@ -135,8 +137,10 @@ static void pan73_workaround(NRF_TIMER_Type * p_timer, bool enable) { *(uint32_t *)0x4000AC0C = (enable ? 1 : 0); } +#else + UNUSED_PARAMETER(p_timer); + UNUSED_PARAMETER(enable); #endif - return; } bool app_pwm_busy_check(app_pwm_t const * const p_instance) @@ -147,7 +151,7 @@ bool app_pwm_busy_check(app_pwm_t const * const p_instance) { if (busy_state != BUSY_STATE_CHANGING) { - if (nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) busy_state) + if (nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) busy_state) == m_pwm_target_value[p_instance->p_timer->instance_id]) { m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; @@ -184,7 +188,7 @@ __STATIC_INLINE void pwm_irq_disable(app_pwm_t const * const p_instance) nrf_drv_timer_compare_int_disable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL); } - +#ifndef GPIOTE_SET_CLEAR_TASKS /** * @brief Function for disabling PWM channel PPI. * @@ -211,7 +215,7 @@ __STATIC_INLINE void pwm_ppi_disable(app_pwm_t const * const p_instance) nrf_drv_ppi_channel_disable(p_cb->ppi_channels[0]); nrf_drv_ppi_channel_disable(p_cb->ppi_channels[1]); } - +#endif /** * @brief This function is called on interrupt after duty set. @@ -223,7 +227,7 @@ void pwm_ready_tick(nrf_timer_event_t event_type, void * p_context) { uint32_t timer_instance_id = (uint32_t)p_context; uint8_t disable = 1; - + for (uint8_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel) { if (m_pwm_ready_counter[timer_instance_id][channel]) @@ -240,7 +244,7 @@ void pwm_ready_tick(nrf_timer_event_t event_type, void * p_context) } } } - + if (disable) { pwm_irq_disable(m_instances[timer_instance_id]); @@ -258,6 +262,9 @@ static void pwm_dealloc(app_pwm_t const * const p_instance) { app_pwm_cb_t * p_cb = p_instance->p_cb; +#ifdef GPIOTE_SET_CLEAR_TASKS + nrf_drv_ppi_channel_free(p_cb->ppi_channel); +#else for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++i) { if (p_cb->ppi_channels[i] != (nrf_ppi_channel_t)(uint8_t)(UNALLOCATED)) @@ -269,7 +276,7 @@ static void pwm_dealloc(app_pwm_t const * const p_instance) { nrf_drv_ppi_group_free(p_cb->ppi_group); } - +#endif //GPIOTE_SET_CLEAR_TASKS for (uint8_t ch = 0; ch < APP_PWM_CHANNELS_PER_INSTANCE; ++ch) { for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL; ++i) @@ -291,7 +298,7 @@ static void pwm_dealloc(app_pwm_t const * const p_instance) return; } - +#ifndef GPIOTE_SET_CLEAR_TASKS /** * @brief PWM state transition from (0%, 100%) to 0% or 100%. * @@ -309,7 +316,7 @@ static void pwm_transition_n_to_0or100(app_pwm_t const * const p_instance, pwm_ppi_disable(p_instance); nrf_drv_ppi_group_clear(p_ppigrp); nrf_drv_ppi_channels_include_in_group( - nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[0]) | + nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[0]) | nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[1]), p_ppigrp); @@ -339,10 +346,10 @@ static void pwm_transition_n_to_0or100(app_pwm_t const * const p_instance, nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL), nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL)); } - + nrf_drv_ppi_channel_enable(p_cb->ppi_channels[0]); nrf_drv_ppi_channel_enable(p_cb->ppi_channels[1]); - + p_ch_cb->pulsewidth = ticks; m_pwm_busy[p_instance->p_timer->instance_id] = PWM_SECONDARY_CC_CHANNEL; } @@ -365,7 +372,7 @@ static void pwm_transition_n_to_m(app_pwm_t const * const p_instance, pwm_ppi_disable(p_instance); nrf_drv_ppi_group_clear(p_ppigrp); nrf_drv_ppi_channels_include_in_group( - nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[0]) | + nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[0]) | nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[1]), p_ppigrp); @@ -373,14 +380,9 @@ static void pwm_transition_n_to_m(app_pwm_t const * const p_instance, nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL), nrf_drv_timer_capture_task_address_get(p_instance->p_timer, channel)); -#ifdef NRF52 - if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == - (m_use_ppi_delay_workaround ? NRF_TIMER_FREQ_8MHz : NRF_TIMER_FREQ_16MHz) ) ? 1U : 0U) + + if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == NRF_TIMER_FREQ_16MHz) ? 1 : 0) < p_ch_cb->pulsewidth) -#else - if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == NRF_TIMER_FREQ_16MHz) ? 1U : 0U) - < p_ch_cb->pulsewidth) -#endif { // For lower value, we need one more transition. Timer task delay is included. // If prescaler is disabled, one tick must be added because of 1 PCLK16M clock cycle delay. @@ -395,7 +397,7 @@ static void pwm_transition_n_to_m(app_pwm_t const * const p_instance, p_ch_cb->pulsewidth = ticks; nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, ticks, false); nrf_drv_ppi_group_enable(p_ppigrp); - + m_pwm_target_value[p_instance->p_timer->instance_id] = ticks; m_pwm_busy[p_instance->p_timer->instance_id] = channel; } @@ -433,12 +435,12 @@ static void pwm_transition_0or100_to_n(app_pwm_t const * const p_instance, nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), nrf_drv_ppi_task_addr_group_enable_get(p_ppigrp)); nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 0, false); - m_pwm_target_value[p_instance->p_timer->instance_id] = + m_pwm_target_value[p_instance->p_timer->instance_id] = nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) channel); nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1], nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL)); - + } else { @@ -456,7 +458,7 @@ static void pwm_transition_0or100_to_n(app_pwm_t const * const p_instance, } nrf_drv_ppi_channel_enable(p_cb->ppi_channels[0]); nrf_drv_ppi_channel_enable(p_cb->ppi_channels[1]); - + p_ch_cb->pulsewidth = ticks; m_pwm_busy[p_instance->p_timer->instance_id] = PWM_SECONDARY_CC_CHANNEL; } @@ -491,40 +493,16 @@ static void pwm_transition_0or100_to_0or100(app_pwm_t const * const p_instance, } nrf_drv_timer_compare(p_instance->p_timer, pwm_ch_cc, ticks, false); p_ch_cb->pulsewidth = ticks; - + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; return; } - -ret_code_t app_pwm_channel_duty_ticks_set(app_pwm_t const * const p_instance, - uint8_t channel, - uint16_t ticks) +static void pwm_transition(app_pwm_t const * const p_instance, + uint8_t channel, uint16_t ticks) { - app_pwm_cb_t * p_cb = p_instance->p_cb; - app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; - - ASSERT(channel < APP_PWM_CHANNELS_PER_INSTANCE); - ASSERT(p_ch_cb->initialized == APP_PWM_CHANNEL_INITIALIZED); - - if (p_cb->state != NRF_DRV_STATE_POWERED_ON) - { - return NRF_ERROR_INVALID_STATE; - } - if (ticks == p_ch_cb->pulsewidth) - { - if (p_cb->p_ready_callback) - { - p_cb->p_ready_callback(p_instance->p_timer->instance_id); - } - return NRF_SUCCESS; // No action required. - } - if (app_pwm_busy_check(p_instance)) - { - return NRF_ERROR_BUSY; // PPI channels for synchronization are still in use. - } - - m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_CHANGING; + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_instance->p_cb->channels_cb[channel]; // Pulse width change sequence: if (!p_ch_cb->pulsewidth || p_ch_cb->pulsewidth >= p_cb->period) @@ -555,6 +533,98 @@ ret_code_t app_pwm_channel_duty_ticks_set(app_pwm_t const * const p_instance, pwm_transition_n_to_m(p_instance, channel, ticks); } } +} +#else //GPIOTE_SET_CLEAR_TASKS +/** + * @brief PWM state transition. + * + * @param[in] p_instance PWM instance. + * @param[in] channel PWM channel number. + * @param[in] ticks Number of clock ticks. + */ +static void pwm_transition(app_pwm_t const * const p_instance, + uint8_t channel, uint16_t ticks) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + nrf_timer_cc_channel_t pwm_ch_cc = (nrf_timer_cc_channel_t)(channel); + + nrf_drv_ppi_channel_disable(p_cb->ppi_channel); + + if (!ticks) + { + nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[1]); + nrf_drv_ppi_channel_enable(p_ch_cb->ppi_channels[0]); + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; + } + else if (ticks >= p_cb->period) + { + ticks = p_cb->period; + nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[0]); + nrf_drv_ppi_channel_enable(p_ch_cb->ppi_channels[1]); + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; + } + else + { + // Set to any other value. + if ((p_ch_cb->pulsewidth != p_cb->period) && (p_ch_cb->pulsewidth != 0) && (ticks < p_ch_cb->pulsewidth)) + { + nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t)PWM_SECONDARY_CC_CHANNEL, p_ch_cb->pulsewidth, false); + nrf_drv_ppi_channel_assign(p_cb->ppi_channel, + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, (nrf_timer_cc_channel_t)PWM_SECONDARY_CC_CHANNEL), + p_ch_cb->polarity ? nrf_drv_gpiote_clr_task_addr_get(p_ch_cb->gpio_pin) : nrf_drv_gpiote_set_task_addr_get(p_ch_cb->gpio_pin)); + nrf_drv_ppi_channel_enable(p_cb->ppi_channel); + m_pwm_busy[p_instance->p_timer->instance_id] = channel; + m_pwm_target_value[p_instance->p_timer->instance_id] = ticks; + } + else + { + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; + } + + nrf_drv_timer_compare(p_instance->p_timer, pwm_ch_cc, ticks, false); + + nrf_drv_ppi_channel_enable(p_ch_cb->ppi_channels[0]); + nrf_drv_ppi_channel_enable(p_ch_cb->ppi_channels[1]); + } + p_ch_cb->pulsewidth = ticks; + return; +} +#endif //GPIOTE_SET_CLEAR_TASKS + +ret_code_t app_pwm_channel_duty_ticks_set(app_pwm_t const * const p_instance, + uint8_t channel, + uint16_t ticks) +{ + app_pwm_cb_t * p_cb = p_instance->p_cb; + app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; + + ASSERT(channel < APP_PWM_CHANNELS_PER_INSTANCE); + ASSERT(p_ch_cb->initialized == APP_PWM_CHANNEL_INITIALIZED); + + if (p_cb->state != NRF_DRV_STATE_POWERED_ON) + { + return NRF_ERROR_INVALID_STATE; + } + if (ticks == p_ch_cb->pulsewidth) + { + if (p_cb->p_ready_callback) + { + p_cb->p_ready_callback(p_instance->p_timer->instance_id); + } + return NRF_SUCCESS; // No action required. + } + if (app_pwm_busy_check(p_instance)) + { + return NRF_ERROR_BUSY; // PPI channels for synchronization are still in use. + } + + m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_CHANGING; + + // Set new value. + + pwm_transition(p_instance, channel, ticks); + if (p_instance->p_cb->p_ready_callback) { //PWM ready interrupt handler will be called after one full period. @@ -653,13 +723,25 @@ static ret_code_t app_pwm_channel_init(app_pwm_t const * const p_instance, uint8 nrf_drv_ppi_channel_disable(p_channel_cb->ppi_channels[0]); nrf_drv_ppi_channel_disable(p_channel_cb->ppi_channels[1]); + +#ifdef GPIOTE_SET_CLEAR_TASKS + uint32_t deactivate_task_addr = polarity ? nrf_drv_gpiote_clr_task_addr_get(p_channel_cb->gpio_pin) : nrf_drv_gpiote_set_task_addr_get(p_channel_cb->gpio_pin); + uint32_t activate_task_addr = polarity ? nrf_drv_gpiote_set_task_addr_get(p_channel_cb->gpio_pin) : nrf_drv_gpiote_clr_task_addr_get(p_channel_cb->gpio_pin); + + nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[0], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), + deactivate_task_addr); + nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[1], + nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL), + activate_task_addr); +#else //GPIOTE_SET_CLEAR_TASKS nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[0], nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel), nrf_drv_gpiote_out_task_addr_get(p_channel_cb->gpio_pin)); nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[1], nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL), nrf_drv_gpiote_out_task_addr_get(p_channel_cb->gpio_pin)); - +#endif //GPIOTE_SET_CLEAR_TASKS p_channel_cb->initialized = APP_PWM_CHANNEL_INITIALIZED; m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 0; @@ -685,12 +767,12 @@ __STATIC_INLINE nrf_timer_frequency_t pwm_calculate_timer_frequency(uint32_t per ++f; } -#ifdef NRF52 +#ifdef GPIOTE_SET_CLEAR_TASKS if ((m_use_ppi_delay_workaround) && (f == (uint32_t) NRF_TIMER_FREQ_16MHz)) { f = (uint32_t) NRF_TIMER_FREQ_8MHz; } -#endif +#endif // GPIOTE_SET_CLEAR_TASKS return (nrf_timer_frequency_t) f; } @@ -714,7 +796,7 @@ ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t con } uint32_t err_code = nrf_drv_ppi_init(); - if ((err_code != NRF_SUCCESS) && (err_code != MODULE_ALREADY_INITIALIZED)) + if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_MODULE_ALREADY_INITIALIZED)) { return NRF_ERROR_NO_MEM; } @@ -724,12 +806,12 @@ ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t con { err_code = nrf_drv_gpiote_init(); if (err_code != NRF_SUCCESS) - { - return NRF_ERROR_INTERNAL; - } + { + return NRF_ERROR_INTERNAL; + } } -#ifdef NRF52 +#ifdef GPIOTE_SET_CLEAR_TASKS if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) { m_use_ppi_delay_workaround = false; @@ -739,11 +821,15 @@ ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t con m_use_ppi_delay_workaround = true; } #endif - + // Innitialize resource status: +#ifdef GPIOTE_SET_CLEAR_TASKS + p_cb->ppi_channel = (nrf_ppi_channel_t)UNALLOCATED; +#else p_cb->ppi_channels[0] = (nrf_ppi_channel_t)UNALLOCATED; p_cb->ppi_channels[1] = (nrf_ppi_channel_t)UNALLOCATED; p_cb->ppi_group = (nrf_ppi_channel_group_t)UNALLOCATED; +#endif //GPIOTE_SET_CLEAR_TASKS for (uint8_t i = 0; i < APP_PWM_CHANNELS_PER_INSTANCE; ++i) { @@ -754,6 +840,20 @@ ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t con } // Allocate PPI channels and groups: + +#ifdef GPIOTE_SET_CLEAR_TASKS + if (nrf_drv_ppi_channel_alloc(&p_cb->ppi_channel) != NRF_SUCCESS) + { + pwm_dealloc(p_instance); + return NRF_ERROR_NO_MEM; + } +#else //GPIOTE_SET_CLEAR_TASKS + if (nrf_drv_ppi_group_alloc(&p_cb->ppi_group) != NRF_SUCCESS) + { + pwm_dealloc(p_instance); + return NRF_ERROR_NO_MEM; + } + for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++i) { if (nrf_drv_ppi_channel_alloc(&p_cb->ppi_channels[i]) != NRF_SUCCESS) @@ -762,12 +862,7 @@ ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t con return NRF_ERROR_NO_MEM; } } - if (nrf_drv_ppi_group_alloc(&p_cb->ppi_group) != NRF_SUCCESS) - { - pwm_dealloc(p_instance); - return NRF_ERROR_NO_MEM; - } - +#endif //GPIOTE_SET_CLEAR_TASKS // Initialize channels: for (uint8_t i = 0; i < APP_PWM_CHANNELS_PER_INSTANCE; ++i) { @@ -789,11 +884,7 @@ ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t con .frequency = timer_freq, .mode = NRF_TIMER_MODE_TIMER, .bit_width = NRF_TIMER_BIT_WIDTH_16, -#ifdef NRF51 - .interrupt_priority = APP_IRQ_PRIORITY_LOW, -#elif defined(NRF52) .interrupt_priority = APP_IRQ_PRIORITY_LOWEST, -#endif .p_context = (void *) (uint32_t) p_instance->p_timer->instance_id }; err_code = nrf_drv_timer_init(p_instance->p_timer, &timer_cfg, @@ -838,7 +929,9 @@ void app_pwm_enable(app_pwm_t const * const p_instance) } } m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE; + pan73_workaround(p_instance->p_timer->p_reg, true); + nrf_drv_timer_clear(p_instance->p_timer); nrf_drv_timer_enable(p_instance->p_timer); @@ -855,10 +948,16 @@ void app_pwm_disable(app_pwm_t const * const p_instance) nrf_drv_timer_disable(p_instance->p_timer); pwm_irq_disable(p_instance); + +#ifdef GPIOTE_SET_CLEAR_TASKS + nrf_drv_ppi_channel_disable(p_cb->ppi_channel); +#else for (uint8_t ppi_channel = 0; ppi_channel < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++ppi_channel) { nrf_drv_ppi_channel_disable(p_cb->ppi_channels[ppi_channel]); } +#endif //GPIOTE_SET_CLEAR_TASKS + for (uint8_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel) { app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel]; @@ -878,6 +977,7 @@ void app_pwm_disable(app_pwm_t const * const p_instance) nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[1]); } } + pan73_workaround(p_instance->p_timer->p_reg, false); p_cb->state = NRF_DRV_STATE_INITIALIZED; @@ -905,3 +1005,4 @@ ret_code_t app_pwm_uninit(app_pwm_t const * const p_instance) //lint -restore +#endif //NRF_MODULE_ENABLED(APP_PWM) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.h index de9c8e0fad..7fcc9ecfd9 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/pwm/app_pwm.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup app_pwm Pulse-width modulation (PWM) @@ -52,7 +51,7 @@ * - 1 PPI group per instance. * - 1 GPIOTE channel per PWM channel. * - * For example, a PWM instance with two channels will consume 2+4 PPI channels, 1 PPI group, and 2 GPIOTE channels. + * For example, a PWM instance with two channels will consume 2 + 4 PPI channels, 1 PPI group, and 2 GPIOTE channels. * * The maximum number of PWM channels per instance is 2. */ @@ -65,7 +64,15 @@ #include "nrf_drv_timer.h" #include "nrf_drv_common.h" #include "nrf_drv_ppi.h" +#include "nrf_peripherals.h" +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(GPIOTE_FEATURE_SET_PRESENT) && defined(GPIOTE_FEATURE_CLR_PRESENT) +#define GPIOTE_SET_CLEAR_TASKS +#endif #define APP_PWM_NOPIN 0xFFFFFFFF @@ -137,9 +144,9 @@ typedef struct * * @brief Module for internal usage inside the library only * - * There are some definitions that must be included in the header file because + * There are some definitions that must be included in the header file because * of the way the library is set up. In this way, the are accessible to the user. - * However, any functions and variables defined here may change at any time + * However, any functions and variables defined here may change at any time * without a warning, so you should not access them directly. */ @@ -167,8 +174,12 @@ typedef struct app_pwm_channel_cb_t channels_cb[APP_PWM_CHANNELS_PER_INSTANCE]; //!< Channels data uint32_t period; //!< Selected period in ticks app_pwm_callback_t p_ready_callback; //!< Callback function called on PWM readiness +#ifdef GPIOTE_SET_CLEAR_TASKS + nrf_ppi_channel_t ppi_channel; //!< PPI channel used temporary while changing duty +#else nrf_ppi_channel_t ppi_channels[2]; //!< PPI channels used temporary while changing duty nrf_ppi_channel_group_t ppi_group; //!< PPI group used to synchronize changes on channels +#endif nrf_drv_state_t state; //!< Current driver status } app_pwm_cb_t; /** @} @@ -317,6 +328,11 @@ app_pwm_duty_t app_pwm_channel_duty_get(app_pwm_t const * const p_instance, uint /** @} */ + +#ifdef __cplusplus +} +#endif + #endif /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.c index d927ead696..442a4355bf 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.c @@ -35,15 +35,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(APP_SCHEDULER) #include "app_scheduler.h" #include #include #include #include "nrf_soc.h" #include "nrf_assert.h" -#include "app_util.h" #include "app_util_platform.h" /**@brief Structure for holding a scheduled event header. */ @@ -62,10 +61,15 @@ static volatile uint8_t m_queue_end_index; /**< Index of queue entry at the static uint16_t m_queue_event_size; /**< Maximum event size in queue. */ static uint16_t m_queue_size; /**< Number of queue entries. */ -#ifdef APP_SCHEDULER_WITH_PROFILER +#if APP_SCHEDULER_WITH_PROFILER static uint16_t m_max_queue_utilization; /**< Maximum observed queue utilization. */ #endif +#if APP_SCHEDULER_WITH_PAUSE +static uint32_t m_scheduler_paused_counter = 0; /**< Counter storing the difference between pausing + and resuming the scheduler. */ +#endif + /**@brief Function for incrementing a queue index, and handle wrap-around. * * @param[in] index Old index. @@ -116,7 +120,7 @@ uint32_t app_sched_init(uint16_t event_size, uint16_t queue_size, void * p_event m_queue_event_size = event_size; m_queue_size = queue_size; -#ifdef APP_SCHEDULER_WITH_PROFILER +#if APP_SCHEDULER_WITH_PROFILER m_max_queue_utilization = 0; #endif @@ -124,7 +128,17 @@ uint32_t app_sched_init(uint16_t event_size, uint16_t queue_size, void * p_event } -#ifdef APP_SCHEDULER_WITH_PROFILER +uint16_t app_sched_queue_space_get() +{ + uint16_t start = m_queue_start_index; + uint16_t end = m_queue_end_index; + uint16_t free_space = m_queue_size - ((end >= start) ? + (end - start) : (m_queue_size + 1 - start + end)); + return free_space; +} + + +#if APP_SCHEDULER_WITH_PROFILER static void queue_utilization_check(void) { uint16_t start = m_queue_start_index; @@ -142,7 +156,7 @@ uint16_t app_sched_queue_utilization_get(void) { return m_max_queue_utilization; } -#endif +#endif // APP_SCHEDULER_WITH_PROFILER uint32_t app_sched_event_put(void * p_event_data, @@ -162,7 +176,7 @@ uint32_t app_sched_event_put(void * p_event_data, event_index = m_queue_end_index; m_queue_end_index = next_index(m_queue_end_index); - #ifdef APP_SCHEDULER_WITH_PROFILER + #if APP_SCHEDULER_WITH_PROFILER // This function call must be protected with critical region because // it modifies 'm_max_queue_utilization'. queue_utilization_check(); @@ -204,51 +218,69 @@ uint32_t app_sched_event_put(void * p_event_data, } -/**@brief Function for reading the next event from specified event queue. - * - * @param[out] pp_event_data Pointer to pointer to event data. - * @param[out] p_event_data_size Pointer to size of event data. - * @param[out] p_event_handler Pointer to event handler function pointer. - * - * @return NRF_SUCCESS if new event, NRF_ERROR_NOT_FOUND if event queue is empty. - */ -static uint32_t app_sched_event_get(void ** pp_event_data, - uint16_t * p_event_data_size, - app_sched_event_handler_t * p_event_handler) +#if APP_SCHEDULER_WITH_PAUSE +void app_sched_pause(void) { - uint32_t err_code = NRF_ERROR_NOT_FOUND; + CRITICAL_REGION_ENTER(); - if (!APP_SCHED_QUEUE_EMPTY()) + if (m_scheduler_paused_counter < UINT32_MAX) { - uint16_t event_index; - - // NOTE: There is no need for a critical region here, as this function will only be called - // from app_sched_execute() from inside the main loop, so it will never interrupt - // app_sched_event_put(). Also, updating of (i.e. writing to) the start index will be - // an atomic operation. - event_index = m_queue_start_index; - m_queue_start_index = next_index(m_queue_start_index); - - *pp_event_data = &m_queue_event_data[event_index * m_queue_event_size]; - *p_event_data_size = m_queue_event_headers[event_index].event_data_size; - *p_event_handler = m_queue_event_headers[event_index].handler; - - err_code = NRF_SUCCESS; + m_scheduler_paused_counter++; } + CRITICAL_REGION_EXIT(); +} - return err_code; +void app_sched_resume(void) +{ + CRITICAL_REGION_ENTER(); + + if (m_scheduler_paused_counter > 0) + { + m_scheduler_paused_counter--; + } + CRITICAL_REGION_EXIT(); +} +#endif //APP_SCHEDULER_WITH_PAUSE + + +/**@brief Function for checking if scheduler is paused which means that should break processing + * events. + * + * @return Boolean value - true if scheduler is paused, false otherwise. + */ +static __INLINE bool is_app_sched_paused(void) +{ +#if APP_SCHEDULER_WITH_PAUSE + return (m_scheduler_paused_counter > 0); +#else + return false; +#endif } void app_sched_execute(void) { - void * p_event_data; - uint16_t event_data_size; - app_sched_event_handler_t event_handler; - - // Get next event (if any), and execute handler - while ((app_sched_event_get(&p_event_data, &event_data_size, &event_handler) == NRF_SUCCESS)) + while (!is_app_sched_paused() && !APP_SCHED_QUEUE_EMPTY()) { + // Since this function is only called from the main loop, there is no + // need for a critical region here, however a special care must be taken + // regarding update of the queue start index (see the end of the loop). + uint16_t event_index = m_queue_start_index; + + void * p_event_data; + uint16_t event_data_size; + app_sched_event_handler_t event_handler; + + p_event_data = &m_queue_event_data[event_index * m_queue_event_size]; + event_data_size = m_queue_event_headers[event_index].event_data_size; + event_handler = m_queue_event_headers[event_index].handler; + event_handler(p_event_data, event_data_size); + + // Event processed, now it is safe to move the queue start index, + // so the queue entry occupied by this event can be used to store + // a next one. + m_queue_start_index = next_index(m_queue_start_index); } } +#endif //NRF_MODULE_ENABLED(APP_SCHEDULER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.h index 82c90b9180..9b956dff27 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/scheduler/app_scheduler.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup app_scheduler Scheduler @@ -71,16 +70,21 @@ * @ref ble_sdk_app_hids_mouse and @ref ble_sdk_app_hids_keyboard. * @endif * - * @image html scheduler_working.jpg The high level design of the scheduler + * @image html scheduler_working.svg The high level design of the scheduler */ #ifndef APP_SCHEDULER_H__ #define APP_SCHEDULER_H__ +#include "sdk_config.h" #include #include "app_error.h" #include "app_util.h" +#ifdef __cplusplus +extern "C" { +#endif + #define APP_SCHED_EVENT_HEADER_SIZE 8 /**< Size of app_scheduler.event_header_t (only for use inside APP_SCHED_BUF_SIZE()). */ /**@brief Compute number of bytes required to hold the scheduler buffer. @@ -93,7 +97,7 @@ */ #define APP_SCHED_BUF_SIZE(EVENT_SIZE, QUEUE_SIZE) \ (((EVENT_SIZE) + APP_SCHED_EVENT_HEADER_SIZE) * ((QUEUE_SIZE) + 1)) - + /**@brief Scheduler event handler type. */ typedef void (*app_sched_event_handler_t)(void * p_event_data, uint16_t event_size); @@ -150,7 +154,7 @@ void app_sched_execute(void); * @details Puts an event into the event queue. * * @param[in] p_event_data Pointer to event data to be scheduled. - * @param[in] event_size Size of event data to be scheduled. + * @param[in] event_size Size of event data to be scheduled. * @param[in] handler Event handler to receive the event. * * @return NRF_SUCCESS on success, otherwise an error code. @@ -159,22 +163,32 @@ uint32_t app_sched_event_put(void * p_event_data, uint16_t event_size, app_sched_event_handler_t handler); -#ifdef APP_SCHEDULER_WITH_PROFILER /**@brief Function for getting the maximum observed queue utilization. * * Function for tuning the module and determining QUEUE_SIZE value and thus module RAM usage. * + * @note @ref APP_SCHEDULER_WITH_PROFILER must be enabled to use this functionality. + * * @return Maximum number of events in queue observed so far. */ uint16_t app_sched_queue_utilization_get(void); -#endif -#ifdef APP_SCHEDULER_WITH_PAUSE +/**@brief Function for getting the current amount of free space in the queue. + * + * @details The real amount of free space may be less if entries are being added from an interrupt. + * To get the sxact value, this function should be called from the critical section. + * + * @return Amount of free space in the queue. + */ +uint16_t app_sched_queue_space_get(void); + /**@brief A function to pause the scheduler. * * @details When the scheduler is paused events are not pulled from the scheduler queue for * processing. The function can be called multiple times. To unblock the scheduler the * function @ref app_sched_resume has to be called the same number of times. + * + * @note @ref APP_SCHEDULER_WITH_PAUSE must be enabled to use this functionality. */ void app_sched_pause(void); @@ -182,9 +196,15 @@ void app_sched_pause(void); * * @details To unblock the scheduler this function has to be called the same number of times as * @ref app_sched_pause function. + * + * @note @ref APP_SCHEDULER_WITH_PAUSE must be enabled to use this functionality. */ void app_sched_resume(void); + +#ifdef __cplusplus +} #endif + #endif // APP_SCHEDULER_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_function.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_function.h new file mode 100644 index 0000000000..83ca8d6740 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_function.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_SVC_FUNCTION_H__ +#define NRF_SVC_FUNCTION_H__ + +#include +#include "section_vars.h" +#include "app_util.h" +#include "nrf_svci.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** @brief Function to be called from an SVC handler. + * + * @warning The function prototype must be limited to a maximum of four arguments, due to the nature of SVC calls. + */ +typedef uint32_t (*nrf_svc_func_t)(); + +/** @brief Type holding the SVC number and the pointer to the corresponding function. + * + * Not that the function that is pointed to must not change version. + */ +typedef struct +{ + uint32_t svc_num; /**< Supervisor call number (actually 8-bit, padded for alignment). */ + uint32_t svci_num; /**< Supervisor call indirect number. */ + nrf_svc_func_t func_ptr; +} nrf_svc_func_reg_t; + + +// Verify that the size of nrf_svc_func_t is aligned. +STATIC_ASSERT(sizeof(nrf_svc_func_reg_t) % 4 == 0); + + +/** @brief Macro for registering a structure holding SVC number and function pointer. + * + * @details This macro places the variable in a section named "svc_data" that + the SVC handler uses during regular operation. + */ +#define SVC_REGISTER_FUNCTION(svc_var) NRF_SECTION_VARS_ADD(svc_data, svc_var) + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_SVC_FUNCTION_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_handler.c new file mode 100644 index 0000000000..8d21e9bd85 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_handler.c @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include "nrf_svc_function.h" +#include "nrf_error.h" + +#include "nrf_log.h" + + + //lint -save -e19 -e526 +NRF_SECTION_VARS_CREATE_SECTION(svc_data, const nrf_svc_func_t); +//lint -restore + + +#define SVC_DATA_SECTION_VARS_GET(i) NRF_SECTION_VARS_GET((i), nrf_svc_func_reg_t, svc_data) +#define SVC_DATA_SECTION_VARS_COUNT NRF_SECTION_VARS_COUNT(nrf_svc_func_reg_t, svc_data) + + +/**@brief Function for handling second stage of SuperVisor Calls (SVC). +* +* @details The function will use loop through the registered svc functions stored +* in the named section "svc_data" and will call the registered function +* if the svn_num corresponds with the registration. +* +* @param[in] svc_num SVC number for function to be executed +* @param[in] p_svc_args Argument list for the SVC. +* +* @return This function returns by updating p_svc_arsg[0]. This will be reported back to the caller of SVC +* @ref NRF_ERROR_SVC_HANDLER_MISSING is returned if no SVC handler is implemented for the +* provided svc_num. +*/ +void nrf_svc_handler_c(uint8_t svc_num, uint32_t * p_svc_args) +{ + uint32_t const num_funcs = SVC_DATA_SECTION_VARS_COUNT; + bool handled = false; + uint32_t svci_num = NRF_SVCI_SVC_NUM_INVALID; + + if(svc_num == NRF_SVCI_SVC_NUM) + { + /* load the stacked R12 as the svci_num */ + svci_num = p_svc_args[4]; + } + + for (int i = 0; i < num_funcs; i++) + { + nrf_svc_func_reg_t const * func_reg = SVC_DATA_SECTION_VARS_GET(i); + if (func_reg->svc_num != svc_num) + { + continue; + } + + if(svci_num != NRF_SVCI_SVC_NUM_INVALID && func_reg->svci_num != svci_num) + { + continue; + } + + p_svc_args[0] = func_reg->func_ptr(p_svc_args[0], p_svc_args[1], p_svc_args[2], p_svc_args[3]); + handled = true; + } + + if (handled == false) + { + p_svc_args[0] = NRF_ERROR_SVC_HANDLER_MISSING; + } +} + +/**@brief Function for handling the first stage of SuperVisor Calls (SVC) in assembly. +* +* @details The function will use the link register (LR) to determine the stack (PSP or MSP) to be +* used and then decode the SVC number afterwards. After decoding the SVC number then +* @ref C_SVC_Handler is called for further processing of the SVC. +*/ +#if defined ( __CC_ARM ) +__ASM void SVC_Handler(void) +{ +EXC_RETURN_CMD_PSP EQU 0xFFFFFFFD ; EXC_RETURN using PSP for ARM Cortex.If Link register contains this value it indicates the PSP was used before the SVC, otherwise the MSP was used. + + IMPORT nrf_svc_handler_c + LDR R0, =EXC_RETURN_CMD_PSP ; Load the EXC_RETURN into R0 to be able to compare against LR to determine stack pointer used. + CMP R0, LR ; Compare the link register with R0.If equal then PSP was used, otherwise MSP was used before SVC. + BNE UseMSP ; Branch to code fetching SVC arguments using MSP. + MRS R1, PSP ; Move PSP into R1. + B Call_nrf_svc_handler_c ; Branch to call_nrf_svc_handler_c below. +UseMSP ; + MRS R1, MSP ; MSP was used, therefore Move MSP into R1. +Call_nrf_svc_handler_c ; + LDR R0, [R1, #24] ; The arguments for the SVC was stacked.R1 contains Stack Pointer, the values stacked before SVC are R0, R1, R2, R3, R12, LR, PC(Return address), xPSR. + ; R1 contains current SP so the PC of the stacked frame is at SP + 6 words(24 bytes).We load the PC into R0. + SUBS R0, #2 ; The PC before the SVC is in R0.We subtract 2 to get the address prior to the instruction executed where the SVC number is located. + LDRB R0, [R0] ; SVC instruction low octet : Load the byte at the address before the PC to fetch the SVC number. + LDR R2, =nrf_svc_handler_c ; Load address of C implementation of SVC handler. + BX R2 ; Branch to C implementation of SVC handler.R0 is now the SVC number, R1 is the StackPointer where the arguments(R0 - R3) of the original SVC are located. + ALIGN +} +#elif defined ( __GNUC__ ) +void __attribute__((naked)) SVC_Handler(void) +{ + const uint32_t exc_return = 0xFFFFFFFD; // EXC_RETURN using PSP for ARM Cortex. If Link register contains this value it indicates the PSP was used before the SVC, otherwise the MSP was used. + + __ASM volatile( + "cmp lr, %0\t\n" // Compare the link register with argument 0 (%0), which is exc_return. If equal then PSP was used, otherwise MSP was used before SVC. + "bne UseMSP\t\n" // Branch to code fetching SVC arguments using MSP. + "mrs r1, psp\t\n" // Move PSP into R1. + "b Call_nrf_svc_handler_c\t\n" // Branch to Call_nrf_svc_handler_c below. + "UseMSP:\t\n" // + "mrs r1, msp\t\n" // MSP was used, therefore Move MSP into R1. + "Call_nrf_svc_handler_c:\t\n" // + "ldr r0, [r1, #24]\t\n" // The arguments for the SVC was stacked. R1 contains Stack Pointer, the values stacked before SVC are R0, R1, R2, R3, R12, LR, PC (Return address), xPSR. + // R1 contains current SP so the PC of the stacked frame is at SP + 6 words (24 bytes). We load the PC into R0. + "sub r0, r0, #2\t\n" // The PC before the SVC is in R0. We subtract 2 to get the address prior to the instruction executed where the SVC number is located. + "ldrb r0, [r0]\t\n" // SVC instruction low octet: Load the byte at the address before the PC to fetch the SVC number. + "bx %1\t\n" // Branch to C implementation of SVC handler, argument 1 (%1). R0 is now the SVC number, R1 is the StackPointer where the arguments (R0-R3) of the original SVC are located. + ".align\t\n" // + :: "r" (exc_return), "r" (nrf_svc_handler_c) // Argument list for the gcc assembly. exc_return is %0, nrf_svc_handler_c is %1. + : "r0", "r1" // List of register maintained manually. + ); +} +#elif defined ( __ICCARM__ ) +void SVC_Handler(void) +{ + __ASM("movs r0, #0x02\n" // Load 0x02 into R6 to prepare for exec return test. + "mvns r0, r0\n" // Invert R0 to obtain exec return code using PSP for ARM Cortex. + "cmp lr, r0\n" // Compare the link register with argument 0 (%0), which is exc_return. If equal then PSP was used, otherwise MSP was used before SVC. + "bne.n UseMSP\n" // Branch to code fetching SVC arguments using MSP. + "mrs r1, psp\n" // Move PSP into R1. + "b.n Call_nrf_svc_handler_c\t\n" // Branch to Call_nrf_svc_handler_c below. + "UseMSP: \n" // + "mrs r1, msp\n" // MSP was used, therefore Move MSP into R1. + "Call_nrf_svc_handler_c: \n" // + "ldr r0, [r1, #24]\n" // The arguments for the SVC was stacked. R1 contains Stack Pointer, the values stacked before SVC are R0, R1, R2, R3, R12, LR, PC (Return address), xPSR. + // R1 contains current SP so the PC of the stacked frame is at SP + 6 words (24 bytes). We load the PC into R0. + "subs r0, #0x02\n" // The PC before the SVC is in R0. We subtract 2 to get the address prior to the instruction executed where the SVC number is located. + "ldrb r0, [r0]\n" // SVC instruction low octet: Load the byte at the address before the PC to fetch the SVC number. + "bx %0\n" // Branch to C implementation of SVC handler, argument 1 (%1). R0 is now the SVC number, R1 is the StackPointer where the arguments (R0-R3) of the original SVC are located. + :: "r" (nrf_svc_handler_c) // Argument list for the gcc assembly. nrf_svc_handler_c is %0. + : "r0", "r1" // List of register maintained manually. + ); +} +#else + +#error Compiler not supported. + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svci.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svci.h new file mode 100644 index 0000000000..ed62f084ee --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svci.h @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_SVCI_H__ +#define NRF_SVCI_H__ + +#include "stdint.h" +#include "compiler_abstraction.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define NRF_SVCI_SVC_NUM 0 /**< SVC number used for all SVCI functions. */ +#define NRF_SVCI_SVC_NUM_INVALID (0xFFFFFFFF) /**< Invalid SVCI number. */ + + +#if defined (__CC_ARM) + + #define SVCI_DECL(svci_num, return_type, function_name, ...) \ + return_type __svc_indirect(NRF_SVCI_SVC_NUM) svci_##function_name(uint32_t _svci_num, ##__VA_ARGS__); + +#elif defined (__GNUC__) + + #ifdef __cplusplus + #define GCC_CAST_CPP (uint8_t) + #else + #define GCC_CAST_CPP + #endif + + #define SVCI_DECL(svci_num, return_type, function_name, ...) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + __attribute__((naked, unused)) \ + static return_type function_name(uint32_t svci_num, \ + __VA_ARGS__) \ + { \ + __asm __volatile ( \ + "mov r12, %1\n\t" \ + "svc %0\n\t" \ + "bx r14\n\t" \ + : /* no output */ \ + : "I" (GCC_CAST_CPP NRF_SVCI_SVC_NUM), "r" (svci_num) \ + : "r12" /* do we need to clobber? */ \ + ); \ + } \ + _Pragma("GCC diagnostic pop") + +#elif defined (__ICCARM__) + + #define SVCI_DECL(svci_num, return_type, function_name, ...) \ + /* Suppress return value warming. */ \ + _Pragma("diag_suppress=Pe940") \ + static return_type function_name(uint32_t svci_num, \ + __VA_ARGS__) \ + { \ + __asm volatile ( \ + "mov r12, %1\n\t" \ + "svc %0\n\t" \ + "bx r14\n\t" \ + : /* no output */ \ + : "I" (NRF_SVCI_SVC_NUM), "r" (svci_num) \ + : "r12" /* do we need to clobber? */ \ + ); \ + } + +#else + + #define SVCI_DECL(svci_number, return_type, function_name, ...) + +#endif + +#define VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, N, ...) N +#define VA_NARGS(...) VA_NARGS_IMPL(__VA_ARGS__, 4, 4, 3, 3, 2, 2, 1, 1, 0) + +#ifdef SVC_INTERFACE_CALL_AS_NORMAL_FUNCTION + +#define SVCI_0(svci_num, return_type, function_name) \ + return_type function_name(void) +#define SVCI_1(svci_num, return_type, function_name, p0t, p0n) \ + return_type function_name(p0t p0n) +#define SVCI_2(svci_num, return_type, function_name, p0t, p0n, p1t, p1n) \ + return_type function_name(p0t p0n, p1t p1n) +#define SVCI_3(svci_num, return_type, function_name, p0t, p0n, p1t, p1n, p2t, p2n) \ + return_type function_name(p0t p0n, p1t p1n, p2t p2n) +#define SVCI_4(svci_num, return_type, function_name, p0t, p0n, p1t, p1n, p2t, p2n, p3t, p3n) \ + return_type function_name(p0t p0n, p1t p1n, p2t p2n, p3t p3n) + +#else + +#define SVCI_0(svci_num, return_type, function_name) \ + SVCI_DECL(svci_num, return_type, function_name) \ + static __INLINE return_type function_name(void) {return svci_##function_name(svci_num);} + +#define SVCI_1(svci_num, return_type, function_name, p0t, p0n) \ + SVCI_DECL(svci_num, return_type, function_name, p0t p0n) \ + static __INLINE return_type function_name(p0t p0n) {return svci_##function_name(svci_num, p0n);} + +#define SVCI_2(svci_num, return_type, function_name, p0t, p0n, p1t, p1n) \ + SVCI_DECL(svci_num, return_type, function_name, p0t p0n, p1t p1n) \ + static __INLINE return_type function_name(p0t p0n, p1t p1n) {return svci_##function_name(svci_num, p0n, p1n);} + +#define SVCI_3(svci_num, return_type, function_name, p0t, p0n, p1t, p1n, p2t, p2n) \ + SVCI_DECL(svci_num, return_type, function_name, p0t p0n, p1t p1n, p2t p2n) \ + static __INLINE return_type function_name(p0t p0n, p1t p1n, p2t p2n) {return svci_##function_name(svci_num, p0n, p1n, p2n);} + +#define SVCI_4(svci_num, return_type, function_name, p0t, p0n, p1t, p1n, p2t, p2n, p3t, p3n) \ + SVCI_DECL(svci_num, return_type, function_name, p0t p0n, p1t p1n, p2t p2n, p3t p3n) \ + static __INLINE return_type function_name(p0t p0n, p1t p1n, p2t p2n, p3t p3n) {return svci_##function_name(svci_num, p0n, p1n, p2n, p3n);} + +#endif // SVCALL_AS_NORMAL_FUNCTION + +#define SVCI_IMPLI(count, svci_num, return_type, function_name, ...) SVCI##_##count (svci_num, return_type, function_name, ##__VA_ARGS__) +#define SVCI_IMPL(count, svci_num, return_type, function_name, ...) SVCI_IMPLI(count, svci_num, return_type, function_name, ##__VA_ARGS__) +#define SVCI(svci_num, return_type, function_name, ...) SVCI_IMPL(VA_NARGS(__VA_ARGS__), svci_num, return_type, function_name, ##__VA_ARGS__) + + + +#ifdef __cplusplus +} +#endif + +#endif // NRF_SVCI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.h deleted file mode 100644 index bdf439ab36..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/trace/app_trace.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __DEBUG_H_ -#define __DEBUG_H_ - -#include -#include - -/** - * @defgroup app_trace Debug Logger - * @ingroup app_common - * @{ - * @brief Enables debug logs/ trace over UART. - * @details Enables debug logs/ trace over UART. Tracing is enabled only if - * ENABLE_DEBUG_LOG_SUPPORT is defined in the project. - */ -#ifdef ENABLE_DEBUG_LOG_SUPPORT -#include "nrf_log.h" -/** - * @brief Module Initialization. - * - * @details Initializes the module to use UART as trace output. - * - * @warning This function will configure UART using default board configuration. - * Do not call this function if UART is configured from a higher level in the application. - */ -void app_trace_init(void); - -/** - * @brief Log debug messages. - * - * @details This API logs messages over UART. The module must be initialized before using this API. - * - * @note Though this is currently a macro, it should be used used and treated as function. - */ -#define app_trace_log NRF_LOG_PRINTF - -/** - * @brief Dump auxiliary byte buffer to the debug trace. - * - * @details This API logs messages over UART. The module must be initialized before using this API. - * - * @param[in] p_buffer Buffer to be dumped on the debug trace. - * @param[in] len Size of the buffer. - */ -void app_trace_dump(uint8_t * p_buffer, uint32_t len); - -#else // ENABLE_DEBUG_LOG_SUPPORT - -#define app_trace_init(...) -#define app_trace_log(...) -#define app_trace_dump(...) - -#endif // ENABLE_DEBUG_LOG_SUPPORT - -/** @} */ - -#endif //__DEBUG_H_ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c index 986e711fbd..3b39ac3657 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup app_error Common application error handler @@ -52,13 +51,7 @@ #include "nordic_common.h" #include "sdk_errors.h" #include "nrf_log.h" - -#ifdef DEBUG -#include "bsp.h" -#endif - - - +#include "nrf_log_ctrl.h" /**@brief Function for error handling, which is called when an error has occurred. * * @warning This handler is an example only and does not fit a final product. You need to analyze @@ -70,7 +63,6 @@ */ /*lint -save -e14 */ -#if 0 void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name) { error_info_t error_info = @@ -83,7 +75,6 @@ void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * UNUSED_VARIABLE(error_info); } -#endif /*lint -save -e14 */ void app_error_handler_bare(ret_code_t error_code) @@ -94,6 +85,7 @@ void app_error_handler_bare(ret_code_t error_code) .p_file_name = NULL, .err_code = error_code, }; + app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info)); UNUSED_VARIABLE(error_info); @@ -144,8 +136,7 @@ void app_error_save_and_stop(uint32_t id, uint32_t pc, uint32_t info) // If printing is disrupted, remove the irq calls, or set the loop variable to 0 in the debugger. __disable_irq(); - - while(loop); + while (loop); __enable_irq(); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.h index 66cd551d53..01e3a025d6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup app_error Common application error handler @@ -55,8 +54,14 @@ #include "nrf.h" #include "sdk_errors.h" #include "nordic_common.h" -#include "nrf_log.h" #include "app_error_weak.h" +#ifdef ANT_STACK_SUPPORT_REQD +#include "ant_error.h" +#endif // ANT_STACK_SUPPORT_REQD + +#ifdef __cplusplus +extern "C" { +#endif #define NRF_FAULT_ID_SDK_RANGE_START 0x00004000 /**< The start of the range of error IDs defined in the SDK. */ @@ -123,23 +128,23 @@ static __INLINE void app_error_log(uint32_t id, uint32_t pc, uint32_t info) switch (id) { case NRF_FAULT_ID_SDK_ASSERT: - NRF_LOG(NRF_LOG_COLOR_RED "\n*** ASSERTION FAILED ***\n"); + //NRF_LOG_INFO(NRF_LOG_COLOR_RED "\r\n*** ASSERTION FAILED ***\r\n"); if (((assert_info_t *)(info))->p_file_name) { - NRF_LOG_PRINTF(NRF_LOG_COLOR_WHITE "Line Number: %u\n", (unsigned int) ((assert_info_t *)(info))->line_num); - NRF_LOG_PRINTF("File Name: %s\n", ((assert_info_t *)(info))->p_file_name); + // NRF_LOG_INFO(NRF_LOG_COLOR_WHITE "Line Number: %u\r\n", (unsigned int) ((assert_info_t *)(info))->line_num); + //NRF_LOG_INFO("File Name: %s\r\n", ((assert_info_t *)(info))->p_file_name); } - NRF_LOG_PRINTF(NRF_LOG_COLOR_DEFAULT "\n"); + //NRF_LOG_INFO(NRF_LOG_COLOR_DEFAULT "\r\n"); break; case NRF_FAULT_ID_SDK_ERROR: - NRF_LOG(NRF_LOG_COLOR_RED "\n*** APPLICATION ERROR *** \n" NRF_LOG_COLOR_WHITE); + //NRF_LOG_INFO(NRF_LOG_COLOR_RED "\r\n*** APPLICATION ERROR *** \r\n" NRF_LOG_COLOR_WHITE); if (((error_info_t *)(info))->p_file_name) { - NRF_LOG_PRINTF("Line Number: %u\n", (unsigned int) ((error_info_t *)(info))->line_num); - NRF_LOG_PRINTF("File Name: %s\n", ((error_info_t *)(info))->p_file_name); + //NRF_LOG_INFO("Line Number: %u\r\n", (unsigned int) ((error_info_t *)(info))->line_num); + //NRF_LOG_INFO("File Name: %s\r\n", ((error_info_t *)(info))->p_file_name); } - NRF_LOG_PRINTF("Error Code: 0x%X\n" NRF_LOG_COLOR_DEFAULT "\n", (unsigned int) ((error_info_t *)(info))->err_code); + //NRF_LOG_INFO("Error Code: 0x%X\r\n" NRF_LOG_COLOR_DEFAULT "\r\n", (unsigned int) ((error_info_t *)(info))->err_code); break; } } @@ -223,6 +228,11 @@ static __INLINE void app_error_print(uint32_t id, uint32_t pc, uint32_t info) } \ } while (0) + +#ifdef __cplusplus +} +#endif + #endif // APP_ERROR_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.c index 65351d9e65..0e5738c729 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.c @@ -36,13 +36,11 @@ * */ - #include "app_error.h" -#ifdef DEBUG -#include "bsp.h" -#endif - +//#define NRF_LOG_MODULE_NAME "APP_ERROR" +#include "nrf_log.h" +#include "nrf_log_ctrl.h" /*lint -save -e14 */ /** @@ -51,27 +49,14 @@ */ __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info) { + NRF_LOG_ERROR("Fatal\r\n"); + NRF_LOG_FINAL_FLUSH(); // On assert, the system can only recover with a reset. #ifndef DEBUG + NRF_LOG_INFO("Hit weak handler\r\n"); NVIC_SystemReset(); #else - -#ifdef BSP_DEFINES_ONLY - LEDS_ON(LEDS_MASK); -#else - UNUSED_VARIABLE(bsp_indication_set(BSP_INDICATE_FATAL_ERROR)); - // This call can be used for debug purposes during application development. - // @note CAUTION: Activating this code will write the stack to flash on an error. - // This function should NOT be used in a final product. - // It is intended STRICTLY for development/debugging purposes. - // The flash write will happen EVEN if the radio is active, thus interrupting - // any communication. - // Use with care. Uncomment the line below to use. - //ble_debug_assert_handler(error_code, line_num, p_file_name); -#endif // BSP_DEFINES_ONLY - app_error_save_and_stop(id, pc, info); - #endif // DEBUG } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.h index 1bc784acde..e1629a674d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error_weak.h @@ -36,10 +36,13 @@ * */ - #ifndef APP_ERROR_WEAK_H__ #define APP_ERROR_WEAK_H__ +#ifdef __cplusplus +extern "C" { +#endif + /** @file * * @defgroup app_error Common application error handler @@ -48,31 +51,34 @@ * * @brief Common application error handler. */ - -/**@brief Callback function for asserts in the SoftDevice. + +/**@brief Callback function for errors, asserts, and faults. * - * @details A pointer to this function will be passed to the SoftDevice. This function will be - * called by the SoftDevice if certain unrecoverable errors occur within the - * application or SoftDevice. + * @details This function is called every time an error is raised in app_error, nrf_assert, or + * in the SoftDevice. Information about the error can be found in the @p info + * parameter. * - * See @ref nrf_fault_handler_t for more details. + * See also @ref nrf_fault_handler_t for more details. + * + * @note The function is implemented as weak so that it can be redefined by a custom error + * handler when needed. * * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if * unavailable. - * @param[in] info Optional additional information regarding the fault. Refer to each fault - * identifier for details. - * - * @remarks Function is implemented as weak so that it can be overwritten by custom application - * error handler when needed. + * @param[in] info Optional additional information regarding the fault. The value of the @p id + * parameter dictates how to interpret this parameter. Refer to the documentation + * for each fault identifier (@ref NRF_FAULT_IDS and @ref APP_ERROR_FAULT_IDS) for + * details about interpreting @p info. */ -#ifdef __CC_ARM - void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); -#else -__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); -#endif +void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); /** @} */ + +#ifdef __cplusplus +} +#endif + #endif // APP_ERROR_WEAK_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util.h index 146bff37a6..523c8c14f9 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup app_util Utility Functions and Definitions @@ -54,6 +53,10 @@ #include "compiler_abstraction.h" #include "nrf.h" +#ifdef __cplusplus +extern "C" { +#endif + //lint -save -e27 -e10 -e19 #if defined ( __CC_ARM ) extern char STACK$$Base; @@ -99,23 +102,45 @@ enum #define STRING_CONCATENATE(lhs, rhs) STRING_CONCATENATE_IMPL(lhs, rhs) -// Disable lint-warnings/errors for STATIC_ASSERT -//lint --emacro(10,STATIC_ASSERT) -//lint --emacro(18,STATIC_ASSERT) -//lint --emacro(19,STATIC_ASSERT) -//lint --emacro(30,STATIC_ASSERT) -//lint --emacro(37,STATIC_ASSERT) -//lint --emacro(42,STATIC_ASSERT) -//lint --emacro(26,STATIC_ASSERT) -//lint --emacro(102,STATIC_ASSERT) -//lint --emacro(533,STATIC_ASSERT) -//lint --emacro(534,STATIC_ASSERT) -//lint --emacro(132,STATIC_ASSERT) -//lint --emacro(414,STATIC_ASSERT) -//lint --emacro(578,STATIC_ASSERT) -//lint --emacro(628,STATIC_ASSERT) -//lint --emacro(648,STATIC_ASSERT) -//lint --emacro(830,STATIC_ASSERT) +// Disable lint-warnings/errors for STATIC_ASSERT_MSG +//lint --emacro(10, STATIC_ASSERT_MSG) +//lint --emacro(18, STATIC_ASSERT_MSG) +//lint --emacro(19, STATIC_ASSERT_MSG) +//lint --emacro(30, STATIC_ASSERT_MSG) +//lint --emacro(37, STATIC_ASSERT_MSG) +//lint --emacro(42, STATIC_ASSERT_MSG) +//lint --emacro(26, STATIC_ASSERT_MSG) +//lint --emacro(102,STATIC_ASSERT_MSG) +//lint --emacro(533,STATIC_ASSERT_MSG) +//lint --emacro(534,STATIC_ASSERT_MSG) +//lint --emacro(132,STATIC_ASSERT_MSG) +//lint --emacro(414,STATIC_ASSERT_MSG) +//lint --emacro(578,STATIC_ASSERT_MSG) +//lint --emacro(628,STATIC_ASSERT_MSG) +//lint --emacro(648,STATIC_ASSERT_MSG) +//lint --emacro(830,STATIC_ASSERT_MSG) + + +/**@brief Macro for doing static (i.e. compile time) assertion. +* +* @note If the EXPR isn't resolvable, then the error message won't be shown. +* +* @note The output of STATIC_ASSERT_MSG will be different across different compilers. +* +* @param[in] EXPR Constant expression to be verified. +* @param[in] MSG Name of the static assert. +*/ +#if defined(__COUNTER__) + + #define STATIC_ASSERT_MSG(EXPR, MSG) \ + ;enum { STRING_CONCATENATE(MSG, __COUNTER__) = 1 / (!!(EXPR)) } + +#else + + #define STATIC_ASSERT_MSG(EXPR, MSG) \ + ;enum { STRING_CONCATENATE(MSG, __LINE__) = 1 / (!!(EXPR)) } + +#endif /**@brief Macro for doing static (i.e. compile time) assertion. @@ -126,17 +151,7 @@ enum * * @param[in] EXPR Constant expression to be verified. */ -#if defined ( __COUNTER__ ) - -#define STATIC_ASSERT(EXPR) \ - ;enum { STRING_CONCATENATE(static_assert_, __COUNTER__) = 1/(!!(EXPR)) } - -#else - -#define STATIC_ASSERT(EXPR) \ - ;enum { STRING_CONCATENATE(assert_line_, __LINE__) = 1/(!!(EXPR)) } - -#endif +#define STATIC_ASSERT(EXPR) STATIC_ASSERT_MSG((EXPR), static_assert_) /**@brief Implementation details for NUM_VAR_ARGS */ @@ -164,6 +179,32 @@ enum 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) +/**@brief Implementation details for NUM_VAR_ARGS */ +#define NUM_VA_ARGS_LESS_1_IMPL( \ + _ignored, \ + _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \ + _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \ + _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \ + _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \ + _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \ + _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \ + _61, _62, N, ...) N + +/**@brief Macro to get the number of arguments in a call variadic macro call. + * First argument is not counted. + * + * param[in] ... List of arguments + * + * @retval Number of variadic arguments in the argument list + */ +#define NUM_VA_ARGS_LESS_1(...) NUM_VA_ARGS_LESS_1_IMPL(__VA_ARGS__, 63, 62, 61, \ + 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \ + 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \ + 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \ + 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \ + 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \ + 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, ~) + /**@brief type for holding an encoded (i.e. little endian) 16 bit unsigned integer. */ typedef uint8_t uint16_le_t[2]; @@ -254,6 +295,447 @@ typedef struct */ #define ALIGN_NUM(alignment, number) ((number - 1) + alignment - ((number - 1) % alignment)) +/**@brief Macro for getting first of 2 parameters. + * + * @param[in] a1 First parameter. + * @param[in] a2 Second parameter. + */ +#define GET_ARG_1(a1, a2) a1 + +/**@brief Macro for getting second of 2 parameters. + * + * @param[in] a1 First parameter. + * @param[in] a2 Second parameter. + */ +#define GET_ARG_2(a1, a2) a2 + + +/**@brief Container of macro (borrowed from Linux kernel). + * + * This macro returns parent structure address basing on child member address. + * + * @param ptr Address of child type. + * @param type Type of parent structure. + * @param member Name of child field in parent structure. + * + * @return Parent structure address. + * */ +#define CONTAINER_OF(ptr, type, member) \ + (type *)((char *)ptr - offsetof(type, member)) + + +/** + * @brief Define Bit-field mask + * + * Macro that defined the mask with selected number of bits set, starting from + * provided bit number. + * + * @param[in] bcnt Number of bits in the bit-field + * @param[in] boff Lowest bit number + */ +#define BF_MASK(bcnt, boff) ( ((1U << (bcnt)) - 1U) << (boff) ) + +/** + * @brief Get bit-field + * + * Macro that extracts selected bit-field from provided value + * + * @param[in] val Value from witch selected bit-field would be extracted + * @param[in] bcnt Number of bits in the bit-field + * @param[in] boff Lowest bit number + * + * @return Value of the selected bits + */ +#define BF_GET(val, bcnt, boff) ( ( (val) & BF_MASK((bcnt), (boff)) ) >> (boff) ) + +/** + * @brief Create bit-field value + * + * Value is masked and shifted to match given bit-field + * + * @param[in] val Value to set on bit-field + * @param[in] bcnt Number of bits for bit-field + * @param[in] boff Offset of bit-field + * + * @return Value positioned of given bit-field. + */ +#define BF_VAL(val, bcnt, boff) ( (((uint32_t)(val)) << (boff)) & BF_MASK(bcnt, boff) ) + +/** + * @name Configuration of complex bit-field + * + * @sa BF_CX + * @{ + */ +/** @brief Position of bit count in complex bit-field value */ +#define BF_CX_BCNT_POS 0U +/** @brief Mask of bit count in complex bit-field value */ +#define BF_CX_BCNT_MASK (0xffU << BF_CX_BCNT_POS) +/** @brief Position of bit position in complex bit-field value */ +#define BF_CX_BOFF_POS 8U +/** @brief Mask of bit position in complex bit-field value */ +#define BF_CX_BOFF_MASK (0xffU << BF_CX_BOFF_POS) +/** @} */ + +/** + * @brief Define complex bit-field + * + * Complex bit-field would contain its position and size in one number. + * @sa BF_CX_MASK + * @sa BF_CX_POS + * @sa BF_CX_GET + * + * @param[in] bcnt Number of bits in the bit-field + * @param[in] boff Lowest bit number + * + * @return The single number that describes the bit-field completely. + */ +#define BF_CX(bcnt, boff) ( ((((uint32_t)(bcnt)) << BF_CX_BCNT_POS) & BF_CX_BCNT_MASK) | ((((uint32_t)(boff)) << BF_CX_BOFF_POS) & BF_CX_BOFF_MASK) ) + +/** + * @brief Get number of bits in bit-field + * + * @sa BF_CX + * + * @param bf_cx Complex bit-field + * + * @return Number of bits in given bit-field + */ +#define BF_CX_BCNT(bf_cx) ( ((bf_cx) & BF_CX_BCNT_MASK) >> BF_CX_BCNT_POS ) + +/** + * @brief Get lowest bit number in the field + * + * @sa BF_CX + * + * @param[in] bf_cx Complex bit-field + * + * @return Lowest bit number in given bit-field + */ +#define BF_CX_BOFF(bf_cx) ( ((bf_cx) & BF_CX_BOFF_MASK) >> BF_CX_BOFF_POS ) + +/** + * @brief Get bit mask of the selected field + * + * @sa BF_CX + * + * @param[in] bf_cx Complex bit-field + * + * @return Mask of given bit-field + */ +#define BF_CX_MASK(bf_cx) BF_MASK(BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) + +/** + * @brief Get bit-field + * + * Macro that extracts selected bit-field from provided value. + * Bit-field is given as a complex value. + * + * @sa BF_CX + * @sa BF_GET + * + * @param[in] val Value from witch selected bit-field would be extracted + * @param[in] bf_cx Complex bit-field + * + * @return Value of the selected bits. + */ +#define BF_CX_GET(val, bf_cx) BF_GET(val, BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) + +/** + * @brief Create bit-field value + * + * Value is masked and shifted to match given bit-field. + * + * @param[in] val Value to set on bit-field + * @param[in] bf_cx Complex bit-field + * + * @return Value positioned of given bit-field. + */ +#define BF_CX_VAL(val, bf_cx) BF_VAL(val, BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) + +/** + * @brief Extracting data from the brackets + * + * This macro get rid of brackets around the argument. + * It can be used to pass multiple arguments in logical one argument to a macro. + * Call it with arguments inside brackets: + * @code + * #define ARGUMENTS (a, b, c) + * BRACKET_EXTRACT(ARGUMENTS) + * @endcode + * It would produce: + * @code + * a, b, c + * @endcode + * + * @param a Argument with anything inside brackets + * @return Anything that appears inside the brackets of the argument + * + * @note + * The argument of the macro have to be inside brackets. + * In other case the compilation would fail. + */ +#define BRACKET_EXTRACT(a) BRACKET_EXTRACT_(a) +#define BRACKET_EXTRACT_(a) BRACKET_EXTRACT__ a +#define BRACKET_EXTRACT__(...) __VA_ARGS__ + + +/** + * @brief Check if number of parameters is more than 1 + * + * @param ... Arguments to count + * + * @return 0 If argument count is <= 1 + * @return 1 If argument count is > 1 + * + * @sa NUM_VA_ARGS + * @sa NUM_IS_MORE_THAN_1 + */ +#define NUM_VA_ARGS_IS_MORE_THAN_1(...) NUM_IS_MORE_THAN_1(NUM_VA_ARGS(__VA_ARGS__)) + +/** + * @brief Check if given numeric value is bigger than 1 + * + * This macro accepts numeric value, that may be the result of argument expansion. + * This numeric value is then converted to 0 if it is lover than 1 or to 1 if + * its value is higher than 1. + * The generated result can be used to glue it into other macro mnemonic name. + * + * @param N Numeric value to check + * + * @return 0 If argument is <= 1 + * @return 1 If argument is > 1 + * + * @note Any existing definition of a form NUM_IS_MORE_THAN_1_PROBE_[N] can + * broke the result of this macro + */ +#define NUM_IS_MORE_THAN_1(N) NUM_IS_MORE_THAN_1_(N) +#define NUM_IS_MORE_THAN_1_(N) NUM_IS_MORE_THAN_1_PROBE_(NUM_IS_MORE_THAN_1_PROBE_ ## N, 1) +#define NUM_IS_MORE_THAN_1_PROBE_(...) GET_VA_ARG_1(GET_ARGS_AFTER_1(__VA_ARGS__)) +#define NUM_IS_MORE_THAN_1_PROBE_0 ~, 0 +#define NUM_IS_MORE_THAN_1_PROBE_1 ~, 0 + +/** + * @brief Get the first argument + * + * @param ... Arguments to select + * + * @return First argument or empty if no arguments are provided + */ +#define GET_VA_ARG_1(...) GET_VA_ARG_1_(__VA_ARGS__, ) // Make sure that also for 1 argument it works +#define GET_VA_ARG_1_(a1, ...) a1 + +/** + * @brief Get all the arguments but the first one + * + * @param ... Arguments to select + * + * @return All arguments after the first one or empty if less than 2 arguments are provided + */ +#define GET_ARGS_AFTER_1(...) GET_ARGS_AFTER_1_(__VA_ARGS__, ) // Make sure that also for 1 argument it works +#define GET_ARGS_AFTER_1_(a1, ...) __VA_ARGS__ + +/** + * @brief Size of a field in declared structure + * + * Macro that returns the size of the structure field. + * @param struct_type Variable type to get the field size from + * @param field Field name to analyze. It can be even field inside field (field.somethingelse.and_another). + * + * @return Size of the field + */ +#define FIELD_SIZE(struct_type, field) sizeof(((struct struct_type*)NULL)->field) + +/** + * @brief Number of elements in field array in declared structure + * + * Macro that returns number of elementy in structure field. + * @param struct_type Variable type to get the field size from + * @param field Field name to analyze. + * + * @return Number of elements in field array + * + * @sa FIELD_SIZE + */ +#define FIELD_ARRAY_SIZE(struct_type, field) (FIELD_SIZE(struct_type, field) / FIELD_SIZE(struct_type, field[0])) + +/** + * @brief Mapping macro + * + * Macro that process all arguments using given macro + * + * @param ... Macro name to be used for argument processing followed by arguments to process. + * Macro should have following form: MACRO(argument) + * + * @return All arguments processed by given macro + */ +#define MACRO_MAP(...) MACRO_MAP_(__VA_ARGS__) +#define MACRO_MAP_(...) MACRO_MAP_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), __VA_ARGS__) // To make sure it works also for 2 arguments in total + +/** + * @brief Mapping macro, recursive version + * + * Can be used in @ref MACRO_MAP macro + */ +#define MACRO_MAP_REC(...) MACRO_MAP_REC_(__VA_ARGS__) +#define MACRO_MAP_REC_(...) MACRO_MAP_REC_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), __VA_ARGS__) // To make sure it works also for 2 arguments in total +/** + * @brief Mapping N arguments macro + * + * Macro similar to @ref MACRO_MAP but maps exact number of arguments. + * If there is more arguments given, the rest would be ignored. + * + * @param N Number of arguments to map + * @param ... Macro name to be used for argument processing followed by arguments to process. + * Macro should have following form: MACRO(argument) + * + * @return Selected number of arguments processed by given macro + */ +#define MACRO_MAP_N(N, ...) MACRO_MAP_N_(N, __VA_ARGS__) +#define MACRO_MAP_N_(N, ...) CONCAT_2(MACRO_MAP_, N)(__VA_ARGS__, ) + +/** + * @brief Mapping N arguments macro, recursive version + * + * Can be used in @ref MACRO_MAP_N macro + */ +#define MACRO_MAP_REC_N(N, ...) MACRO_MAP_REC_N_(N, __VA_ARGS__) +#define MACRO_MAP_REC_N_(N, ...) CONCAT_2(MACRO_MAP_REC_, N)(__VA_ARGS__, ) + +#define MACRO_MAP_0( ...) +#define MACRO_MAP_1( macro, a, ...) macro(a) +#define MACRO_MAP_2( macro, a, ...) macro(a) MACRO_MAP_1 (macro, __VA_ARGS__, ) +#define MACRO_MAP_3( macro, a, ...) macro(a) MACRO_MAP_2 (macro, __VA_ARGS__, ) +#define MACRO_MAP_4( macro, a, ...) macro(a) MACRO_MAP_3 (macro, __VA_ARGS__, ) +#define MACRO_MAP_5( macro, a, ...) macro(a) MACRO_MAP_4 (macro, __VA_ARGS__, ) +#define MACRO_MAP_6( macro, a, ...) macro(a) MACRO_MAP_5 (macro, __VA_ARGS__, ) +#define MACRO_MAP_7( macro, a, ...) macro(a) MACRO_MAP_6 (macro, __VA_ARGS__, ) +#define MACRO_MAP_8( macro, a, ...) macro(a) MACRO_MAP_7 (macro, __VA_ARGS__, ) +#define MACRO_MAP_9( macro, a, ...) macro(a) MACRO_MAP_8 (macro, __VA_ARGS__, ) +#define MACRO_MAP_10(macro, a, ...) macro(a) MACRO_MAP_9 (macro, __VA_ARGS__, ) +#define MACRO_MAP_11(macro, a, ...) macro(a) MACRO_MAP_10(macro, __VA_ARGS__, ) +#define MACRO_MAP_12(macro, a, ...) macro(a) MACRO_MAP_11(macro, __VA_ARGS__, ) +#define MACRO_MAP_13(macro, a, ...) macro(a) MACRO_MAP_12(macro, __VA_ARGS__, ) +#define MACRO_MAP_14(macro, a, ...) macro(a) MACRO_MAP_13(macro, __VA_ARGS__, ) +#define MACRO_MAP_15(macro, a, ...) macro(a) MACRO_MAP_14(macro, __VA_ARGS__, ) + +#define MACRO_MAP_REC_0( ...) +#define MACRO_MAP_REC_1( macro, a, ...) macro(a) +#define MACRO_MAP_REC_2( macro, a, ...) macro(a) MACRO_MAP_REC_1 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_3( macro, a, ...) macro(a) MACRO_MAP_REC_2 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_4( macro, a, ...) macro(a) MACRO_MAP_REC_3 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_5( macro, a, ...) macro(a) MACRO_MAP_REC_4 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_6( macro, a, ...) macro(a) MACRO_MAP_REC_5 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_7( macro, a, ...) macro(a) MACRO_MAP_REC_6 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_8( macro, a, ...) macro(a) MACRO_MAP_REC_7 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_9( macro, a, ...) macro(a) MACRO_MAP_REC_8 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_10(macro, a, ...) macro(a) MACRO_MAP_REC_9 (macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_11(macro, a, ...) macro(a) MACRO_MAP_REC_10(macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_12(macro, a, ...) macro(a) MACRO_MAP_REC_11(macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_13(macro, a, ...) macro(a) MACRO_MAP_REC_12(macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_14(macro, a, ...) macro(a) MACRO_MAP_REC_13(macro, __VA_ARGS__, ) +#define MACRO_MAP_REC_15(macro, a, ...) macro(a) MACRO_MAP_REC_14(macro, __VA_ARGS__, ) + +/** + * @brief Mapping macro with current index + * + * Basically macro similar to @ref MACRO_MAP, but the processing function would get an argument + * and current argument index (beginning from 0). + * + * @param ... Macro name to be used for argument processing followed by arguments to process. + * Macro should have following form: MACRO(argument, index) + * @return All arguments processed by given macro + */ +#define MACRO_MAP_FOR(...) MACRO_MAP_FOR_(__VA_ARGS__) +#define MACRO_MAP_FOR_N_LIST 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +#define MACRO_MAP_FOR_(...) MACRO_MAP_FOR_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), __VA_ARGS__) + +/** + * @brief Mapping N arguments macro with current index + * + * Macro is similar to @ref MACRO_MAP_FOR but maps exact number of arguments. + * If there is more arguments given, the rest would be ignored. + * + * @param N Number of arguments to map + * @param ... Macro name to be used for argument processing followed by arguments to process. + * Macro should have following form: MACRO(argument, index) + * + * @return Selected number of arguments processed by given macro + */ +#define MACRO_MAP_FOR_N(N, ...) MACRO_MAP_FOR_N_(N, __VA_ARGS__) +#define MACRO_MAP_FOR_N_(N, ...) CONCAT_2(MACRO_MAP_FOR_, N)((MACRO_MAP_FOR_N_LIST), __VA_ARGS__, ) + +#define MACRO_MAP_FOR_0( n_list, ...) +#define MACRO_MAP_FOR_1( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) +#define MACRO_MAP_FOR_2( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_1 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_3( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_2 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_4( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_3 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_5( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_4 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_6( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_5 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_7( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_6 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_8( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_7 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_9( n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_8 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_10(n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_9 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_11(n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_10((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_12(n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_11((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_13(n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_12((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_14(n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_13((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_15(n_list, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_14((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) + + +/** + * @brief Mapping macro with current index and parameter + * + * Version of @ref MACRO_MAP_FOR that passes also the same parameter to all macros. + * + * @param param Parameter that would be passed to each macro call during mapping. + * @param ... Macro name to be used for argument processing followed by arguments to process. + * Macro should have following form: MACRO(argument, index, param) + * + * @return All arguments processed by given macro + */ +#define MACRO_MAP_FOR_PARAM(param, ...) MACRO_MAP_FOR_PARAM_(param, __VA_ARGS__) +#define MACRO_MAP_FOR_PARAM_(param, ...) MACRO_MAP_FOR_PARAM_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), param, __VA_ARGS__) + +/** + * @brief Mapping N arguments macro with with current index and parameter + * + * @param N Number of arguments to map + * @param param Parameter that would be passed to each macro call during mapping. + * @param ... Macro name to be used for argument processing followed by arguments to process. + * Macro should have following form: MACRO(argument, index, param) + * + * @return All arguments processed by given macro + */ +#define MACRO_MAP_FOR_PARAM_N(N, param, ...) MACRO_MAP_FOR_PARAM_N_(N, param, __VA_ARGS__) +#define MACRO_MAP_FOR_PARAM_N_(N, param, ...) CONCAT_2(MACRO_MAP_FOR_PARAM_, N)((MACRO_MAP_FOR_N_LIST), param, __VA_ARGS__, ) + + +#define MACRO_MAP_FOR_PARAM_0( n_list, param, ...) +#define MACRO_MAP_FOR_PARAM_1( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) +#define MACRO_MAP_FOR_PARAM_2( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_1 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_3( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_2 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_4( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_3 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_5( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_4 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_6( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_5 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_7( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_6 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_8( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_7 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_9( n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_8 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_10(n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_9 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_11(n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_10((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_12(n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_11((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_13(n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_12((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_14(n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_13((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) +#define MACRO_MAP_FOR_PARAM_15(n_list, param, macro, a, ...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_14((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) + + +/**@brief Adding curly brace to macro parameter + * + * Useful in array of structures initialization. + * + * @param p parameter to put into the curly brace*/ +#define PARAM_CBRACE(p) { p }, + /**@brief Function for changing the value unit. * @@ -396,6 +878,22 @@ static __INLINE uint32_t uint32_big_decode(const uint8_t * p_encoded_data) (((uint32_t)((uint8_t *)p_encoded_data)[3]) << 0) ); } +/** + * @brief Function for encoding an uint16 value in big-endian format. + * + * @param[in] value Value to be encoded. + * @param[out] p_encoded_data Buffer where the encoded data will be written. + * + * @return Number of bytes written. + */ +static __INLINE uint8_t uint16_big_encode(uint16_t value, uint8_t * p_encoded_data) +{ + p_encoded_data[0] = (uint8_t) (value >> 8); + p_encoded_data[1] = (uint8_t) (value & 0xFF); + + return sizeof(uint16_t); +} + /**@brief Function for encoding a uint32 value in big-endian format. * * @param[in] value Value to be encoded. @@ -405,14 +903,7 @@ static __INLINE uint32_t uint32_big_decode(const uint8_t * p_encoded_data) */ static __INLINE uint8_t uint32_big_encode(uint32_t value, uint8_t * p_encoded_data) { -#ifdef NRF51 - p_encoded_data[0] = (uint8_t) ((value & 0xFF000000) >> 24); - p_encoded_data[1] = (uint8_t) ((value & 0x00FF0000) >> 16); - p_encoded_data[2] = (uint8_t) ((value & 0x0000FF00) >> 8); - p_encoded_data[3] = (uint8_t) ((value & 0x000000FF) >> 0); -#elif NRF52 *(uint32_t *)p_encoded_data = __REV(value); -#endif return sizeof(uint32_t); } @@ -515,6 +1006,11 @@ static __INLINE bool is_address_from_stack(void * ptr) } } + +#ifdef __cplusplus +} +#endif + #endif // APP_UTIL_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_bds.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_bds.h index 96467e3d89..fb1bcf45a0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_bds.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_bds.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup app_util Utility Functions and Definitions @@ -56,7 +55,11 @@ #include "app_util.h" #include "ble_srv_common.h" #include "nordic_common.h" - + +#ifdef __cplusplus +extern "C" { +#endif + typedef uint8_t nibble_t; typedef uint32_t uint24_t; typedef uint64_t uint40_t; @@ -122,7 +125,7 @@ static __INLINE uint8_t bds_uint24_encode(const uint32_t * p_value, uint8_t * p_ return (3); } - + /**@brief Function for encoding a uint32 value. * * @param[in] p_value Value to be encoded. @@ -139,7 +142,7 @@ static __INLINE uint8_t bds_uint32_encode(const uint32_t * p_value, uint8_t * p_ return sizeof(uint32_t); } - + /**@brief Function for encoding a uint40 value. * * @param[in] p_value Value to be encoded. @@ -180,12 +183,12 @@ static __INLINE uint8_t bds_sfloat_encode(const sfloat_t * p_value, uint8_t * p_ * @param[in] p_value Value to be encoded. * @param[out] p_encoded_data Buffer where the encoded data is to be written. */ -static __INLINE uint8_t bds_uint8_array_encode(const uint8_array_t * p_value, +static __INLINE uint8_t bds_uint8_array_encode(const uint8_array_t * p_value, uint8_t * p_encoded_data) { memcpy(p_encoded_data, p_value->p_data, p_value->size); return p_value->size; -} +} /**@brief Function for encoding a utf8_str value. @@ -199,7 +202,7 @@ static __INLINE uint8_t bds_ble_srv_utf8_str_encode(const ble_srv_utf8_str_t * p { memcpy(p_encoded_data, p_value->p_str, p_value->length); return p_value->length; -} +} /**@brief Function for encoding a regcertdatalist value. * @@ -207,12 +210,12 @@ static __INLINE uint8_t bds_ble_srv_utf8_str_encode(const ble_srv_utf8_str_t * p * @param[out] p_encoded_data Buffer where the encoded data is to be written. */ -static __INLINE uint8_t bds_regcertdatalist_encode(const regcertdatalist_t * p_value, +static __INLINE uint8_t bds_regcertdatalist_encode(const regcertdatalist_t * p_value, uint8_t * p_encoded_data) { memcpy(p_encoded_data, p_value->p_list, p_value->list_len); return p_value->list_len; -} +} /**@brief Function for decoding a date_time value. @@ -225,13 +228,13 @@ static __INLINE uint8_t bds_ble_date_time_encode(const ble_date_time_t * p_date_ uint8_t * p_encoded_data) { uint8_t len = bds_uint16_encode(&p_date_time->year, &p_encoded_data[0]); - + p_encoded_data[len++] = p_date_time->month; p_encoded_data[len++] = p_date_time->day; p_encoded_data[len++] = p_date_time->hours; p_encoded_data[len++] = p_date_time->minutes; p_encoded_data[len++] = p_date_time->seconds; - + return len; } @@ -243,12 +246,12 @@ static __INLINE uint8_t bds_ble_date_time_encode(const ble_date_time_t * p_date_ * @param[in] p_decoded_val pointer to the decoded value * @return length of the decoded field. */ -static __INLINE uint8_t bds_uint16_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_uint16_decode(const uint8_t len, + const uint8_t * p_encoded_data, uint16_t * p_decoded_val) { UNUSED_VARIABLE(len); - *p_decoded_val = (((uint16_t)((uint8_t *)p_encoded_data)[0])) | + *p_decoded_val = (((uint16_t)((uint8_t *)p_encoded_data)[0])) | (((uint16_t)((uint8_t *)p_encoded_data)[1]) << 8 ); return (sizeof(uint16_t)); } @@ -261,8 +264,8 @@ static __INLINE uint8_t bds_uint16_decode(const uint8_t len, * @param[in] p_decoded_val pointer to the decoded value * @return length of the decoded field. */ -static __INLINE uint8_t bds_int16_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_int16_decode(const uint8_t len, + const uint8_t * p_encoded_data, int16_t * p_decoded_val) { UNUSED_VARIABLE(len); @@ -281,8 +284,8 @@ static __INLINE uint8_t bds_int16_decode(const uint8_t len, * * @return length of the decoded field. */ -static __INLINE uint8_t bds_uint24_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_uint24_decode(const uint8_t len, + const uint8_t * p_encoded_data, uint32_t * p_decoded_val) { UNUSED_VARIABLE(len); @@ -301,8 +304,8 @@ static __INLINE uint8_t bds_uint24_decode(const uint8_t len, * * @return length of the decoded field. */ -static __INLINE uint8_t bds_uint32_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_uint32_decode(const uint8_t len, + const uint8_t * p_encoded_data, uint32_t * p_decoded_val) { UNUSED_VARIABLE(len); @@ -322,8 +325,8 @@ static __INLINE uint8_t bds_uint32_decode(const uint8_t len, * * @return length of the decoded field. */ -static __INLINE uint8_t bds_uint40_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_uint40_decode(const uint8_t len, + const uint8_t * p_encoded_data, uint64_t * p_decoded_val) { UNUSED_VARIABLE(len); @@ -345,11 +348,11 @@ static __INLINE uint8_t bds_uint40_decode(const uint8_t len, * @return length of the decoded field. */ -static __INLINE uint8_t bds_sfloat_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_sfloat_decode(const uint8_t len, + const uint8_t * p_encoded_data, sfloat_t * p_decoded_val) { - + p_decoded_val->exponent = 0; bds_uint16_decode(len, p_encoded_data, (uint16_t*)&p_decoded_val->mantissa); p_decoded_val->exponent = (uint8_t)((p_decoded_val->mantissa & 0xF000) >> 12); @@ -366,14 +369,14 @@ static __INLINE uint8_t bds_sfloat_decode(const uint8_t len, * * @return length of the decoded field. */ -static __INLINE uint8_t bds_uint8_array_decode(const uint8_t len, +static __INLINE uint8_t bds_uint8_array_decode(const uint8_t len, const uint8_t * p_encoded_data, uint8_array_t * p_decoded_val) { memcpy(p_decoded_val->p_data, p_encoded_data, len); p_decoded_val->size = len; return p_decoded_val->size; -} +} /**@brief Function for decoding a utf8_str value. @@ -384,14 +387,14 @@ static __INLINE uint8_t bds_uint8_array_decode(const uint8_t len, * * @return length of the decoded field. */ -static __INLINE uint8_t bds_ble_srv_utf8_str_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_ble_srv_utf8_str_decode(const uint8_t len, + const uint8_t * p_encoded_data, ble_srv_utf8_str_t * p_decoded_val) { p_decoded_val->p_str = (uint8_t*)p_encoded_data; p_decoded_val->length = len; return p_decoded_val->length; -} +} /**@brief Function for decoding a regcertdatalist value. @@ -402,14 +405,14 @@ static __INLINE uint8_t bds_ble_srv_utf8_str_decode(const uint8_t len, * * @return length of the decoded field. */ -static __INLINE uint8_t bds_regcertdatalist_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_regcertdatalist_decode(const uint8_t len, + const uint8_t * p_encoded_data, regcertdatalist_t * p_decoded_val) { memcpy(p_decoded_val->p_list, p_encoded_data, len); p_decoded_val->list_len = len; return p_decoded_val->list_len; -} +} /**@brief Function for decoding a date_time value. @@ -420,8 +423,8 @@ static __INLINE uint8_t bds_regcertdatalist_decode(const uint8_t len, * * @return length of the decoded field. */ -static __INLINE uint8_t bds_ble_date_time_decode(const uint8_t len, - const uint8_t * p_encoded_data, +static __INLINE uint8_t bds_ble_date_time_decode(const uint8_t len, + const uint8_t * p_encoded_data, ble_date_time_t * p_date_time) { UNUSED_VARIABLE(len); @@ -435,6 +438,11 @@ static __INLINE uint8_t bds_ble_date_time_decode(const uint8_t len, return pos; } + +#ifdef __cplusplus +} +#endif + #endif // APP_UTIL_BDS_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.c index 8683b50efc..84c85275ab 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.c @@ -36,20 +36,24 @@ * */ - #include "app_util_platform.h" +#ifdef SOFTDEVICE_PRESENT +/* Global nvic state instance, required by nrf_nvic.h */ +nrf_nvic_state_t nrf_nvic_state; +#endif + static uint32_t m_in_critical_region = 0; void app_util_disable_irq(void) { - __disable_irq(); - m_in_critical_region++; + __disable_irq(); + m_in_critical_region++; } void app_util_enable_irq(void) { - m_in_critical_region--; + m_in_critical_region--; if (m_in_critical_region == 0) { __enable_irq(); @@ -58,7 +62,7 @@ void app_util_enable_irq(void) void app_util_critical_region_enter(uint8_t *p_nested) { -#ifdef NRF52 +#if __CORTEX_M == (0x04U) ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) #endif @@ -72,7 +76,7 @@ void app_util_critical_region_enter(uint8_t *p_nested) void app_util_critical_region_exit(uint8_t nested) { -#ifdef NRF52 +#if __CORTEX_M == (0x04U) ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) #endif @@ -85,3 +89,38 @@ void app_util_critical_region_exit(uint8_t nested) } +uint8_t privilege_level_get(void) +{ +#if __CORTEX_M == (0x00U) || defined(_WIN32) || defined(__unix) || defined(__APPLE__) + /* the Cortex-M0 has no concept of privilege */ + return APP_LEVEL_PRIVILEGED; +#elif __CORTEX_M == (0x04U) + uint32_t isr_vector_num = __get_IPSR() & IPSR_ISR_Msk ; + if (0 == isr_vector_num) + { + /* Thread Mode, check nPRIV */ + int32_t control = __get_CONTROL(); + return control & CONTROL_nPRIV_Msk ? APP_LEVEL_UNPRIVILEGED : APP_LEVEL_PRIVILEGED; + } + else + { + /* Handler Mode, always privileged */ + return APP_LEVEL_PRIVILEGED; + } +#endif +} + + +uint8_t current_int_priority_get(void) +{ + uint32_t isr_vector_num = __get_IPSR() & IPSR_ISR_Msk ; + if (isr_vector_num > 0) + { + int32_t irq_type = ((int32_t)isr_vector_num - EXTERNAL_INT_VECTOR_OFFSET); + return (NVIC_GetPriority((IRQn_Type)irq_type) & 0xFF); + } + else + { + return APP_IRQ_PRIORITY_THREAD; + } +} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h index 0d082e2e65..ae345af544 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h @@ -36,7 +36,6 @@ * */ - /**@file * * @defgroup app_util_platform Utility Functions and Definitions (Platform) @@ -59,7 +58,11 @@ #include "nrf_assert.h" #include "app_error.h" -#if defined(NRF51) +#ifdef __cplusplus +extern "C" { +#endif + +#if __CORTEX_M == (0x00U) #define _PRIO_SD_HIGH 0 #define _PRIO_APP_HIGH 1 #define _PRIO_APP_MID 1 @@ -67,7 +70,7 @@ #define _PRIO_APP_LOW 3 #define _PRIO_APP_LOWEST 3 #define _PRIO_THREAD 4 -#elif defined(NRF52) +#elif __CORTEX_M == (0x04U) #define _PRIO_SD_HIGH 0 #define _PRIO_SD_MID 1 #define _PRIO_APP_HIGH 2 @@ -81,10 +84,12 @@ #error "No platform defined" #endif + +//lint -save -e113 -e452 /**@brief The interrupt priorities available to the application while the SoftDevice is active. */ typedef enum { -#ifdef SOFTDEVICE_PRESENT +#ifndef SOFTDEVICE_PRESENT APP_IRQ_PRIORITY_HIGHEST = _PRIO_SD_HIGH, #else APP_IRQ_PRIORITY_HIGHEST = _PRIO_APP_HIGH, @@ -99,6 +104,8 @@ typedef enum APP_IRQ_PRIORITY_LOWEST = _PRIO_APP_LOWEST, APP_IRQ_PRIORITY_THREAD = _PRIO_THREAD /**< "Interrupt level" when running in Thread Mode. */ } app_irq_priority_t; +//lint -restore + /*@brief The privilege levels available to applications in Thread Mode */ typedef enum @@ -111,6 +118,40 @@ typedef enum #define EXTERNAL_INT_VECTOR_OFFSET 16 /**@endcond */ +/**@brief Macro for setting a breakpoint. + */ +#if defined(__GNUC__) +#define NRF_BREAKPOINT __builtin_trap() +#else +#define NRF_BREAKPOINT __BKPT(0) +#endif + +/** @brief Macro for setting a breakpoint. + * + * If it is possible to detect debugger presence then it is set only in that case. + * + */ +#if __CORTEX_M == 0x04 +#define NRF_BREAKPOINT_COND do { \ + /* C_DEBUGEN == 1 -> Debugger Connected */ \ + if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) \ + { \ + /* Generate breakpoint if debugger is connected */ \ + NRF_BREAKPOINT; \ + } \ + }while (0) +#else +#define NRF_BREAKPOINT_COND NRF_BREAKPOINT +#endif // __CORTEX_M == 0x04 + +#if defined ( __CC_ARM ) +#define PACKED(TYPE) __packed TYPE +#define PACKED_STRUCT PACKED(struct) +#elif defined ( __GNUC__ ) +#define PACKED __attribute__((packed)) +#define PACKED_STRUCT struct PACKED +#endif + void app_util_critical_region_enter (uint8_t *p_nested); void app_util_critical_region_exit (uint8_t nested); @@ -141,13 +182,13 @@ void app_util_critical_region_exit (uint8_t nested); } #else #define CRITICAL_REGION_EXIT() app_util_critical_region_exit(0) -#endif +#endif /* Workaround for Keil 4 */ #ifndef IPSR_ISR_Msk #define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ #endif - + /**@brief Macro to enable anonymous unions from a certain point in the code. @@ -177,12 +218,12 @@ void app_util_critical_region_exit (uint8_t nested); // For GCC anonymous unions are enabled by default. #endif - /* Workaround for Keil 4 */ #ifndef CONTROL_nPRIV_Msk #define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ #endif + /**@brief Function for finding the current interrupt level. * * @return Current interrupt level. @@ -190,19 +231,8 @@ void app_util_critical_region_exit (uint8_t nested); * @retval APP_IRQ_PRIORITY_LOW We are running in Application Low interrupt level. * @retval APP_IRQ_PRIORITY_THREAD We are running in Thread Mode. */ -static __INLINE uint8_t current_int_priority_get(void) -{ - uint32_t isr_vector_num = __get_IPSR() & IPSR_ISR_Msk ; - if (isr_vector_num > 0) - { - int32_t irq_type = ((int32_t)isr_vector_num - EXTERNAL_INT_VECTOR_OFFSET); - return (NVIC_GetPriority((IRQn_Type)irq_type) & 0xFF); - } - else - { - return APP_IRQ_PRIORITY_THREAD; - } -} +uint8_t current_int_priority_get(void); + /**@brief Function for finding out the current privilege level. * @@ -210,26 +240,12 @@ static __INLINE uint8_t current_int_priority_get(void) * @retval APP_LEVEL_UNPRIVILEGED We are running in unprivileged level. * @retval APP_LEVEL_PRIVILEGED We are running in privileged level. */ -static __INLINE uint8_t privilege_level_get(void) -{ -#if defined(NRF51) - /* the Cortex-M0 has no concept of privilege */ - return APP_LEVEL_PRIVILEGED; -#elif defined(NRF52) - uint32_t isr_vector_num = __get_IPSR() & IPSR_ISR_Msk ; - if (0 == isr_vector_num) - { - /* Thread Mode, check nPRIV */ - int32_t control = __get_CONTROL(); - return control & CONTROL_nPRIV_Msk ? APP_LEVEL_UNPRIVILEGED : APP_LEVEL_PRIVILEGED; - } - else - { - /* Handler Mode, always privileged */ - return APP_LEVEL_PRIVILEGED; - } -#endif +uint8_t privilege_level_get(void); + + +#ifdef __cplusplus } +#endif #endif // APP_UTIL_PLATFORM_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nordic_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nordic_common.h index f0e725bc06..995526c170 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nordic_common.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nordic_common.h @@ -36,7 +36,6 @@ * */ - /** @file * @brief Common defines and macros for firmware developed by Nordic Semiconductor. */ @@ -44,6 +43,38 @@ #ifndef NORDIC_COMMON_H__ #define NORDIC_COMMON_H__ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Check if selected module is enabled + * + * This is save function for driver enable checking. + * Correct from Lint point of view (not using default of undefined value). + * + * Usage: + * @code + #if NRF_MODULE_ENABLED(UART) + ... + #endif + * @endcode + * + * @param module The module name. + * + * @retval 1 The macro _ENABLE is defined and is non-zero. + * @retval 0 The macro _ENABLE is not defined or it equals zero. + * + * @note + * This macro intentionally does not implement second expansion level. + * The name of the module to be checked has to be given directly as a parameter. + * And given parameter would be connected with @c _ENABLED postfix directly + * without evaluating its value. + */ +//lint -e491 // Suppers warning 491 "non-standard use of 'defined' preprocessor operator" +#define NRF_MODULE_ENABLED(module) \ + ((defined(module ## _ENABLED) && (module ## _ENABLED)) ? 1 : 0) + /** The upper 8 bits of a 32 bit value */ //lint -emacro(572,MSB) // Suppress warning 572 "Excessive shift value" #define MSB_32(a) (((a) & 0xFF000000) >> 24) @@ -63,12 +94,51 @@ /*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */ #define MAX(a, b) ((a) < (b) ? (b) : (a)) -/** Concatenates two parameters. Useful as a second level of indirection, - * when a parameter can be macro itself. */ -#define CONCAT_2(p1, p2) p1##p2 -/** Concatenates three parameters. Useful as a second level of indirection, - * when a parameter can be macro itself. */ -#define CONCAT_3(p1, p2, p3) p1##p2##p3 +/**@brief Concatenates two parameters. + * + * It realizes two level expansion to make it sure that all the parameters + * are actually expanded before gluing them together. + * + * @param p1 First parameter to concatenating + * @param p2 Second parameter to concatenating + * + * @return Two parameters glued together. + * They have to create correct C mnemonic in other case + * preprocessor error would be generated. + * + * @sa CONCAT_3 + */ +#define CONCAT_2(p1, p2) CONCAT_2_(p1, p2) +/** Auxiliary macro used by @ref CONCAT_2 */ +#define CONCAT_2_(p1, p2) p1##p2 + +/**@brief Concatenates three parameters. + * + * It realizes two level expansion to make it sure that all the parameters + * are actually expanded before gluing them together. + * + * @param p1 First parameter to concatenating + * @param p2 Second parameter to concatenating + * @param p3 Third parameter to concatenating + * + * @return Three parameters glued together. + * They have to create correct C mnemonic in other case + * preprocessor error would be generated. + * + * @sa CONCAT_2 + */ +#define CONCAT_3(p1, p2, p3) CONCAT_3_(p1, p2, p3) +/** Auxiliary macro used by @ref CONCAT_3 */ +#define CONCAT_3_(p1, p2, p3) p1##p2##p3 + +#define NUM_TO_STR_INTERNAL(val) #val +/** Converts numeric value to string. + */ +#define NUM_TO_STR(val) NUM_TO_STR_INTERNAL(val) + +/** Counts number of elements inside the array + */ +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) /**@brief Set a bit in the uint32 word. * @@ -133,4 +203,8 @@ #define UNUSED_PARAMETER(X) UNUSED_VARIABLE(X) #define UNUSED_RETURN_VALUE(X) UNUSED_VARIABLE(X) +#ifdef __cplusplus +} +#endif + #endif // NORDIC_COMMON_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.c index 23ba8f76cb..1b9f7ce44e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.c @@ -35,13 +35,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - #include "nrf_assert.h" #include "app_error.h" #include "nordic_common.h" -#if defined(DEBUG_NRF) -void assert_nrf_callback(uint16_t line_num, const uint8_t * file_name) +__WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t * file_name) { assert_info_t assert_info = { @@ -52,4 +50,3 @@ void assert_nrf_callback(uint16_t line_num, const uint8_t * file_name) UNUSED_VARIABLE(assert_info); } -#endif /* DEBUG_NRF */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.h index 8ef5a5d501..57a132a413 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_assert.h @@ -36,7 +36,6 @@ * */ - /** @file * @brief Utilities for verifying program logic */ @@ -52,14 +51,16 @@ extern "C" { #endif -#if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) - /** @brief Function for handling assertions. * * * @note * This function is called when an assertion has triggered. * + * @note + * This function is deprecated and will be removed in future releases. + * Use app_error_fault_handler instead. + * * * @post * All hardware is put into an idle non-emitting state (in particular the radio is highly @@ -70,7 +71,17 @@ extern "C" { * @param line_num The line number where the assertion is called * @param file_name Pointer to the file name */ +//lint -save -esym(14, assert_nrf_callback) void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); +//lint -restore + +#if (defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)) +#define NRF_ASSERT_PRESENT 1 +#else +#define NRF_ASSERT_PRESENT 0 +#endif + +//#if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \ @@ -78,20 +89,30 @@ void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); /** @brief Function for checking intended for production code. * * Check passes if "expr" evaluates to true. */ + +#ifdef _lint #define ASSERT(expr) \ if (expr) \ { \ } \ else \ { \ - assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ + while(1); \ +} +#else //_lint +#define ASSERT(expr) \ +if (NRF_ASSERT_PRESENT) \ +{ \ + if (expr) \ + { \ + } \ + else \ + { \ + assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ + } \ } -#else -#ifndef ASSERT -#define ASSERT(expr) //!< Assert empty when disabled -__WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); #endif -#endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */ + #ifdef __cplusplus } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.c deleted file mode 100644 index 3c26bf540e..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.c +++ /dev/null @@ -1,429 +0,0 @@ -#include "nrf.h" -#include "nrf_log.h" -#include "nrf_error.h" -#include -#include -#include - -#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 - -#include -#include - -static char buf_normal_up[BUFFER_SIZE_UP]; -static char buf_down[BUFFER_SIZE_DOWN]; - -uint32_t log_rtt_init(void) -{ - static bool initialized = false; - if (initialized) - { - return NRF_SUCCESS; - } - - if (SEGGER_RTT_ConfigUpBuffer(LOG_TERMINAL_NORMAL, - "Normal", - buf_normal_up, - BUFFER_SIZE_UP, - SEGGER_RTT_MODE_NO_BLOCK_TRIM - ) - != 0) - { - return NRF_ERROR_INVALID_STATE; - } - - if (SEGGER_RTT_ConfigDownBuffer(LOG_TERMINAL_INPUT, - "Input", - buf_down, - BUFFER_SIZE_DOWN, - SEGGER_RTT_MODE_NO_BLOCK_SKIP - ) - != 0) - { - return NRF_ERROR_INVALID_STATE; - } - - initialized = true; - - return NRF_SUCCESS; -} - -// Forward declaration of SEGGER RTT vprintf function -int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList); - -void log_rtt_printf(int terminal_index, char * format_msg, ...) -{ - //lint -save -e526 -e628 -e530 - va_list p_args; - va_start(p_args, format_msg); - (void)SEGGER_RTT_vprintf(terminal_index, format_msg, &p_args); - va_end(p_args); - //lint -restore -} - -__INLINE void log_rtt_write_string(int terminal_index, int num_args, ...) -{ - const char* msg; - //lint -save -e516 -e530 - va_list p_args; - va_start(p_args, num_args); - //lint -restore - - for (int i = 0; i < num_args; i++) - { - //lint -save -e26 -e10 -e64 -e526 -e628 -e530 - msg = va_arg(p_args, const char*); - //lint -restore - (void)SEGGER_RTT_WriteString(terminal_index, msg); - } - va_end(p_args); -} - -void log_rtt_write_hex(int terminal_index, uint32_t value) -{ - char temp[11]; - temp[0] = '0'; - temp[1] = 'x'; - temp[10] = 0; // Null termination - uint8_t nibble; - uint8_t i = 8; - - while(i-- != 0) - { - nibble = (value >> (4 * i)) & 0x0F; - temp[9-i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); - } - - (void)SEGGER_RTT_WriteString(terminal_index, temp); -} - -void log_rtt_write_hex_char(int terminal_index, uint8_t value) -{ - char temp[3]; - temp[2] = 0; // Null termination - uint8_t nibble; - uint8_t i = 2; - - while(i-- != 0) - { - nibble = (value >> (4 * i)) & 0x0F; - temp[1-i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); - } - - (void)SEGGER_RTT_WriteString(terminal_index, temp); -} - -__INLINE int log_rtt_has_input() -{ - return SEGGER_RTT_HasKey(); -} - -uint32_t log_rtt_read_input(char * c) -{ - int r; - - r = SEGGER_RTT_Read(LOG_TERMINAL_INPUT, c, 1); - if (r == 1) - return NRF_SUCCESS; - else - return NRF_ERROR_NULL; -} - -#elif defined(NRF_LOG_USES_UART) && NRF_LOG_USES_UART == 1 - -#include "app_uart.h" -#include "app_error.h" -#include -#include -#include "nrf.h" -#include "bsp.h" - -#define MAX_TEST_DATA_BYTES (15U) /**< max number of test bytes to be used for tx and rx. */ -#define UART_TX_BUF_SIZE 512 /**< UART TX buffer size. */ -#define UART_RX_BUF_SIZE 1 /**< UART RX buffer size. */ - -static uint8_t m_uart_data; -static bool m_uart_has_input; - -void uart_error_cb(app_uart_evt_t * p_event) -{ - if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR) - { - APP_ERROR_HANDLER(p_event->data.error_communication); - } - else if (p_event->evt_type == APP_UART_FIFO_ERROR) - { - APP_ERROR_HANDLER(p_event->data.error_code); - } -} - -uint32_t log_uart_init() -{ - static bool initialized = false; - if (initialized) - { - return NRF_SUCCESS; - } - - uint32_t err_code; - const app_uart_comm_params_t comm_params = - { - RX_PIN_NUMBER, - TX_PIN_NUMBER, - RTS_PIN_NUMBER, - CTS_PIN_NUMBER, - APP_UART_FLOW_CONTROL_ENABLED, - false, - UART_BAUDRATE_BAUDRATE_Baud115200 - }; - - APP_UART_FIFO_INIT(&comm_params, - UART_RX_BUF_SIZE, - UART_TX_BUF_SIZE, - uart_error_cb, -#ifdef NRF51 - APP_IRQ_PRIORITY_LOW -#elif defined(NRF52) - APP_IRQ_PRIORITY_LOWEST -#endif - err_code); - - initialized = true; - - return err_code; -} - -//lint -save -e530 -e64 -void log_uart_printf(const char * format_msg, ...) -{ - va_list p_args; - va_start(p_args, format_msg); - (void)vprintf(format_msg, p_args); - va_end(p_args); -} - -__INLINE void log_uart_write_string_many(int num_args, ...) -{ - const char* msg; - va_list p_args; - va_start(p_args, num_args); - - for (int i = 0; i < num_args; i++) - { - msg = va_arg(p_args, const char*); - log_uart_write_string(msg); - } - va_end(p_args); -} - -__INLINE void log_uart_write_string(const char* msg) -{ - while( *msg ) - { - (void)app_uart_put(*msg++); - } -} -//lint -restore - -void log_uart_write_hex(uint32_t value) -{ - uint8_t nibble; - uint8_t i = 8; - - (void)app_uart_put('0'); - (void)app_uart_put('x'); - while( i-- != 0 ) - { - nibble = (value >> (4 * i)) & 0x0F; - (void)app_uart_put( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); - } -} - -void log_uart_write_hex_char(uint8_t c) -{ - uint8_t nibble; - uint8_t i = 2; - - while( i-- != 0 ) - { - nibble = (c >> (4 * i)) & 0x0F; - (void)app_uart_put( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); - } -} - -__INLINE int log_uart_has_input() -{ - if (m_uart_has_input) return 1; - if (app_uart_get(&m_uart_data) == NRF_SUCCESS) - { - m_uart_has_input = true; - return 1; - } - return 0; -} - -uint32_t log_uart_read_input(char * c) -{ - if (m_uart_has_input) - { - *c = (char)m_uart_data; - m_uart_has_input = false; - return NRF_SUCCESS; - } - if (app_uart_get((uint8_t *)c) == NRF_SUCCESS) - { - return NRF_SUCCESS; - } - return NRF_ERROR_NULL; -} - -#elif defined(NRF_LOG_USES_RAW_UART) && NRF_LOG_USES_RAW_UART == 1 - -#include "app_uart.h" -#include -#include -#include "bsp.h" - -uint32_t log_raw_uart_init() -{ - // Disable UART - NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Disabled; - - // Configure RX/TX pins - nrf_gpio_cfg_output( TX_PIN_NUMBER ); - nrf_gpio_cfg_input(RX_PIN_NUMBER, NRF_GPIO_PIN_NOPULL); - - // Set a default baud rate of UART0_CONFIG_BAUDRATE - NRF_UART0->PSELTXD = TX_PIN_NUMBER; - NRF_UART0->BAUDRATE = UART0_CONFIG_BAUDRATE; - - NRF_UART0->PSELRTS = 0xFFFFFFFF; - NRF_UART0->PSELCTS = 0xFFFFFFFF; - - // Disable parity and interrupt - NRF_UART0->CONFIG = (UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos ); - NRF_UART0->CONFIG |= (UART_CONFIG_HWFC_Disabled << UART_CONFIG_HWFC_Pos ); - - // Re-enable the UART - NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Enabled; - NRF_UART0->INTENSET = 0; - NRF_UART0->TASKS_STARTTX = 1; - NRF_UART0->TASKS_STARTRX = 1; - - return NRF_SUCCESS; -} - -void log_raw_uart_printf(const char * format_msg, ...) -{ - static char buffer[256]; - - va_list p_args; - va_start(p_args, format_msg); - sprintf(buffer, format_msg, p_args); - va_end(p_args); - - log_raw_uart_write_string(buffer); -} - -__INLINE void log_raw_uart_write_char(const char c) -{ - NRF_UART0->TXD = c; - while( NRF_UART0->EVENTS_TXDRDY != 1 ); - NRF_UART0->EVENTS_TXDRDY = 0; -} - -__INLINE void log_raw_uart_write_string_many(int num_args, ...) -{ - - const char* msg; - va_list p_args; - va_start(p_args, num_args); - - for (int i = 0; i < num_args; i++) - { - msg = va_arg(p_args, const char*); - log_raw_uart_write_string(msg); - } - va_end(p_args); -} - -__INLINE void log_raw_uart_write_string(const char* msg) -{ - while( *msg ) - { - NRF_UART0->TXD = *msg++; - while( NRF_UART0->EVENTS_TXDRDY != 1 ); - NRF_UART0->EVENTS_TXDRDY = 0; - } -} - -void log_raw_uart_write_hex(uint32_t value) -{ - uint8_t nibble; - uint8_t i = 8; - - log_raw_uart_write_string( "0x" ); - while( i-- != 0 ) - { - nibble = (value >> (4 * i)) & 0x0F; - log_raw_uart_write_char( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); - } -} - -void log_raw_uart_write_hex_char(uint8_t c) -{ - uint8_t nibble; - uint8_t i = 2; - - while( i-- != 0 ) - { - nibble = (c >> (4 * i)) & 0x0F; - log_raw_uart_write_hex( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); - } -} - -__INLINE int log_raw_uart_has_input() -{ - return 0; -} - -uint32_t log_raw_uart_read_input(char * c) -{ - return NRF_ERROR_NULL; -} - -#endif // NRF_LOG_USES_RAW_UART == 1 - - -const char* log_hex_char(const char c) -{ - static volatile char hex_string[3]; - hex_string[2] = 0; // Null termination - uint8_t nibble; - uint8_t i = 2; - while(i-- != 0) - { - nibble = (c >> (4 * i)) & 0x0F; - hex_string[1-i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); - } - return (const char*) hex_string; -} - -const char* log_hex(uint32_t value) -{ - static volatile char hex_string[11]; - hex_string[0] = '0'; - hex_string[1] = 'x'; - hex_string[10] = 0; - uint8_t nibble; - uint8_t i = 8; - - while(i-- != 0) - { - nibble = (value >> (4 * i)) & 0x0F; - hex_string[9-i] = (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble); - } - - return (const char*)hex_string; -} - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.h deleted file mode 100644 index 2019e81b3b..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_log.h +++ /dev/null @@ -1,699 +0,0 @@ -#ifndef NRF_LOG_H_ -#define NRF_LOG_H_ - -#ifndef DOXYGEN - -#include -#include -#include - -#ifndef NRF_LOG_USES_RTT -#define NRF_LOG_USES_RTT 0 -#endif - -#ifndef NRF_LOG_USES_UART -#define NRF_LOG_USES_UART 0 -#endif - -#ifndef NRF_LOG_USES_RAW_UART -#define NRF_LOG_USES_RAW_UART 0 -#endif - -#ifndef NRF_LOG_USES_COLORS - #define NRF_LOG_USES_COLORS 1 -#endif - -#if NRF_LOG_USES_COLORS == 1 - #define NRF_LOG_COLOR_DEFAULT "\x1B[0m" - #define NRF_LOG_COLOR_BLACK "\x1B[1;30m" - #define NRF_LOG_COLOR_RED "\x1B[1;31m" - #define NRF_LOG_COLOR_GREEN "\x1B[1;32m" - #define NRF_LOG_COLOR_YELLOW "\x1B[1;33m" - #define NRF_LOG_COLOR_BLUE "\x1B[1;34m" - #define NRF_LOG_COLOR_MAGENTA "\x1B[1;35m" - #define NRF_LOG_COLOR_CYAN "\x1B[1;36m" - #define NRF_LOG_COLOR_WHITE "\x1B[1;37m" -#else - #define NRF_LOG_COLOR_DEFAULT - #define NRF_LOG_COLOR_BLACK - #define NRF_LOG_COLOR_RED - #define NRF_LOG_COLOR_GREEN - #define NRF_LOG_COLOR_YELLOW - #define NRF_LOG_COLOR_BLUE - #define NRF_LOG_COLOR_MAGENTA - #define NRF_LOG_COLOR_CYAN - #define NRF_LOG_COLOR_WHITE -#endif - -#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 - -#define LOG_TERMINAL_NORMAL (0) -#define LOG_TERMINAL_ERROR (1) -#define LOG_TERMINAL_INPUT (0) - -/**@brief Function for initializing the SEGGER RTT logger. - * - * @details See segger.com - * for information about SEGGER Real Time Transfer (RTT). - * - * This function is available only when NRF_LOG_USES_RTT is defined as 1. - * - * @note Do not call this function directly. Use the macro @ref NRF_LOG_INIT instead. - * - * @retval NRF_SUCCESS If initialization was successful. - * @retval NRF_ERROR Otherwise. - */ -uint32_t log_rtt_init(void); - -/**@brief Function for writing a printf string using RTT. - * - * @details The printf implementation in SEGGER's RTT is more efficient than - * the standard implementation. However, printf requires more processor time - * than other logging functions. Therefore, applications that require logging - * but need it to interfere as little as possible with the execution, should - * avoid using printf. - * - * This function is available only when NRF_LOG_USES_RTT is defined as 1. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_PRINTF - * - @ref NRF_LOG_PRINTF_DEBUG - * - @ref NRF_LOG_PRINTF_ERROR - * - * @param terminal_index Segger RTT terminal index to use as output. - * @param format_msg Printf format string. - */ -void log_rtt_printf(int terminal_index, char * format_msg, ...); - -/**@brief Function for writing a string using RTT. - * - * @details The string to write must be null-terminated, but the null termination will not be stored - * in the ring buffer. - * The impact of running this function should be very low compared to writing to UART. - * - * This function is available only when NRF_LOG_USES_RTT is defined as 1. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG - * - @ref NRF_LOG_DEBUG - * - @ref NRF_LOG_ERROR - * - * @param terminal_index Segger RTT terminal index to use as output. - * @param num_args Number of arguments. - */ -void log_rtt_write_string(int terminal_index, int num_args, ...); - -/**@brief Function for writing an integer as HEX using RTT. - * - * The output data is formatted as, for example, 0x89ABCDEF. - * - * This function is available only when NRF_LOG_USES_RTT is defined as 1. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_HEX - * - @ref NRF_LOG_HEX_DEBUG - * - @ref NRF_LOG_HEX_ERROR - * - * @param terminal_index Segger RTT terminal index to use as output. - * @param value Integer value to be printed as HEX. - */ -void log_rtt_write_hex(int terminal_index, uint32_t value); - -/**@brief Function for writing a single character as HEX using RTT. - * - * The output string is formatted as, for example, AA. - * - * This function is available only when NRF_LOG_USES_RTT is defined as 1. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_HEX_CHAR - * - @ref NRF_LOG_HEX_CHAR_DEBUG - * - @ref NRF_LOG_HEX_CHAR_ERROR - * - * @param terminal_index Segger RTT terminal index to use as output. - * @param value Character to print as HEX. - */ -void log_rtt_write_hex_char(int terminal_index, uint8_t value); - -/**@brief Function for checking if data is available in the input buffer. - * - * This function is available only when NRF_LOG_USES_RTT is defined as 1. - * - * @note Do not call this function directly. Use @ref NRF_LOG_HAS_INPUT instead. - * - * @retval 1 If characters are available to read. - * @retval 0 If no characters are available. - */ -int log_rtt_has_input(void); - -/**@brief Function for reading one character from the input buffer. - * - * @param[out] p_char Pointer where to store the character. - * - * This function is available only when NRF_LOG_USES_RTT is defined as 1. - * - * @note Do not call this function directly. Use @ref NRF_LOG_READ_INPUT instead. - * - * @retval NRF_SUCCESS If the character was read out. - * @retval NRF_ERROR_INVALID_DATA If no character could be read. - */ -uint32_t log_rtt_read_input(char* p_char); - -#define NRF_LOG_INIT() log_rtt_init() /*!< Initialize the module. */ - -#define NRF_LOG_PRINTF(...) log_rtt_printf(LOG_TERMINAL_NORMAL, ##__VA_ARGS__) /*!< Print a log message using printf. */ -#define NRF_LOG_PRINTF_DEBUG(...) log_rtt_printf(LOG_TERMINAL_NORMAL, ##__VA_ARGS__) /*!< If DEBUG is set, print a log message using printf. */ -#define NRF_LOG_PRINTF_ERROR(...) log_rtt_printf(LOG_TERMINAL_ERROR, ##__VA_ARGS__) /*!< Print a log message using printf to the error stream. */ - -#define NRF_LOG(...) log_rtt_write_string(LOG_TERMINAL_NORMAL, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message. The input string must be null-terminated. */ -#define NRF_LOG_DEBUG(...) log_rtt_write_string(LOG_TERMINAL_NORMAL, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< If DEBUG is set, print a log message. The input string must be null-terminated. */ -#define NRF_LOG_ERROR(...) log_rtt_write_string(LOG_TERMINAL_ERROR, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message to the error stream. The input string must be null-terminated. */ - -#define NRF_LOG_HEX(val) log_rtt_write_hex(LOG_TERMINAL_NORMAL, val) /*!< Log an integer as HEX value (example output: 0x89ABCDEF). */ -#define NRF_LOG_HEX_DEBUG(val) log_rtt_write_hex(LOG_TERMINAL_NORMAL, val) /*!< If DEBUG is set, log an integer as HEX value (example output: 0x89ABCDEF). */ -#define NRF_LOG_HEX_ERROR(val) log_rtt_write_hex(LOG_TERMINAL_ERROR, val) /*!< Log an integer as HEX value to the error stream (example output: 0x89ABCDEF). */ - -#define NRF_LOG_HEX_CHAR(val) log_rtt_write_hex_char(LOG_TERMINAL_NORMAL, val) /*!< Log a character as HEX value (example output: AA). */ -#define NRF_LOG_HEX_CHAR_DEBUG(val) log_rtt_write_hex_char(LOG_TERMINAL_NORMAL, val) /*!< If DEBUG is set, log a character as HEX value (example output: AA). */ -#define NRF_LOG_HEX_CHAR_ERROR(val) log_rtt_write_hex_char(LOG_TERMINAL_ERROR, val) /*!< Log a character as HEX value to the error stream (example output: AA). */ - -#define NRF_LOG_HAS_INPUT() log_rtt_has_input() /*!< Check if the input buffer has unconsumed characters. */ -#define NRF_LOG_READ_INPUT(p_char) log_rtt_read_input(p_char) /*!< Consume a character from the input buffer. */ - -#if !defined(DEBUG) && !defined(DOXYGEN) - -#undef NRF_LOG_DEBUG -#define NRF_LOG_DEBUG(...) - -#undef NRF_LOG_STR_DEBUG -#define NRF_LOG_STR_DEBUG(...) - -#undef NRF_LOG_HEX_DEBUG -#define NRF_LOG_HEX_DEBUG(...) - -#undef NRF_LOG_HEX_CHAR_DEBUG -#define NRF_LOG_HEX_CHAR_DEBUG(...) - -#endif // !defined(DEBUG) && !defined(DOXYGEN) - -#elif defined(NRF_LOG_USES_UART) && NRF_LOG_USES_UART == 1 - -/**@brief Function for initializing the UART logger. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @note Do not call this function directly. Use the macro @ref NRF_LOG_INIT instead. - * - * @retval NRF_SUCCESS If initialization was successful. - * @retval NRF_ERROR Otherwise. - */ -uint32_t log_uart_init(void); - -/**@brief Function for logging a printf string to UART. - * - * @details Printf requires more processor time - * than other logging functions. Therefore, applications that require logging - * but need it to interfere as little as possible with the execution, should - * avoid using printf. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @note This function is non-blocking. If too much data is sent to the UART, - * some characters might be skipped. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_PRINTF - * - @ref NRF_LOG_PRINTF_DEBUG - * - @ref NRF_LOG_PRINTF_ERROR - * - * @param format_msg Printf format string. - */ -void log_uart_printf(const char * format_msg, ...); - -/**@brief Function for logging a single character to UART. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @param c Character. - */ -void log_uart_write_char(const char c); - -/**@brief Function for logging null-terminated strings to UART. - * - * @details This function is more efficient than using printf. - * The null termination will not be logged. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG - * - @ref NRF_LOG_DEBUG - * - @ref NRF_LOG_ERROR - * - * @param num_args Number of arguments. - */ -void log_uart_write_string_many(int num_args, ...); - - -/**@brief Function for logging a null-terminated string to UART. - * - * @details This function is more efficient than using printf. - * The null termination will not be logged. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG - * - @ref NRF_LOG_DEBUG - * - @ref NRF_LOG_ERROR - * - * @param msg Null-terminated string. - */ -void log_uart_write_string(const char* msg); - - -/**@brief Function for logging an integer value as HEX to UART. - * - * @details The output data is formatted as, for example, 0x89ABCDEF. - * This function is more efficient than printf. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @note This function is non-blocking. If too much data is sent to the UART, - * some characters might be skipped. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_HEX - * - @ref NRF_LOG_HEX_DEBUG - * - @ref NRF_LOG_HEX_ERROR - * - * @param value Integer value to be printed as HEX. - */ -void log_uart_write_hex(uint32_t value); - -/**@brief Function for logging a single character as HEX to UART. - * - * @details The output string is formatted as, for example, AA. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @note This function is non-blocking. If too much data is sent to the UART, - * some characters might be skipped. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_HEX_CHAR - * - @ref NRF_LOG_HEX_CHAR_DEBUG - * - @ref NRF_LOG_HEX_CHAR_ERROR - * - * @param c Character. - */ -void log_uart_write_hex_char(uint8_t c); - -/**@brief Function for checking if data is available in the input buffer. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @note Do not call this function directly. Use @ref NRF_LOG_HAS_INPUT instead. - * - * @retval 1 If characters are available to read. - * @retval 0 If no characters are available. - */ -int log_uart_has_input(void); - -/**@brief Function for reading one character from the input buffer. - * - * @param[out] p_char Pointer where to store the character. - * - * This function is available only when NRF_LOG_USES_UART is defined as 1. - * - * @note Do not call this function directly. Use NRF_LOG_READ_INPUT instead. - * - * @retval NRF_SUCCESS If the character was read out. - * @retval NRF_ERROR_INVALID_DATA If no character could be read. - */ -uint32_t log_uart_read_input(char* p_char); - - -#define NRF_LOG_INIT() log_uart_init() /*!< Initialize the module. */ - -#define NRF_LOG_PRINTF(...) log_uart_printf(__VA_ARGS__) /*!< Print a log message using printf. */ -#define NRF_LOG_PRINTF_DEBUG(...) log_uart_printf(__VA_ARGS__) /*!< If DEBUG is set, print a log message using printf. */ -#define NRF_LOG_PRINTF_ERROR(...) log_uart_printf(__VA_ARGS__) /*!< Print a log message using printf to the error stream. */ - -#define NRF_LOG(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message. The input string must be null-terminated. */ -#define NRF_LOG_DEBUG(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< If DEBUG is set, print a log message. The input string must be null-terminated. */ -#define NRF_LOG_ERROR(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message to the error stream. The input string must be null-terminated. */ - -#define NRF_LOG_HEX(val) log_uart_write_hex(val) /*!< Log an integer as HEX value (example output: 0x89ABCDEF). */ -#define NRF_LOG_HEX_DEBUG(val) log_uart_write_hex(val) /*!< If DEBUG is set, log an integer as HEX value (example output: 0x89ABCDEF). */ -#define NRF_LOG_HEX_ERROR(val) log_uart_write_hex(val) /*!< Log an integer as HEX value to the error stream (example output: 0x89ABCDEF). */ - -#define NRF_LOG_HEX_CHAR(val) log_uart_write_hex_char(val) /*!< Log a character as HEX value (example output: AA). */ -#define NRF_LOG_HEX_CHAR_DEBUG(val) log_uart_write_hex_char(val) /*!< If DEBUG is set, log a character as HEX value (example output: AA). */ -#define NRF_LOG_HEX_CHAR_ERROR(val) log_uart_write_hex_char(val) /*!< Log a character as HEX value to the error stream (example output: AA). */ - -#define NRF_LOG_HAS_INPUT() log_uart_has_input() /*!< Check if the input buffer has unconsumed characters. */ -#define NRF_LOG_READ_INPUT(p_char) log_uart_read_input(p_char) /*!< Consume a character from the input buffer. */ - -#if !defined(DEBUG) && !defined(DOXYGEN) - -#undef NRF_LOG_DEBUG -#define NRF_LOG_DEBUG(...) - -#undef NRF_LOG_PRINTF_DEBUG -#define NRF_LOG_PRINTF_DEBUG(...) - -#undef NRF_LOG_STR_DEBUG -#define NRF_LOG_STR_DEBUG(...) - -#undef NRF_LOG_HEX_DEBUG -#define NRF_LOG_HEX_DEBUG(...) - -#undef NRF_LOG_HEX_CHAR_DEBUG -#define NRF_LOG_HEX_CHAR_DEBUG(...) - -#endif // !defined(DEBUG) && !defined(DOXYGEN) - -#elif defined(NRF_LOG_USES_RAW_UART) && NRF_LOG_USES_RAW_UART == 1 - -/**@brief Function for initializing the raw UART logger. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @note Do not call this function directly. Use the macro @ref NRF_LOG_INIT instead. - * - * @retval NRF_SUCCESS If initialization was successful. - * @retval NRF_ERROR Otherwise. - */ -uint32_t log_raw_uart_init(void); - -/**@brief Function for logging a printf string to raw UART. - * - * @details Printf requires more processor time - * than other logging functions. Therefore, applications that require logging - * but need it to interfere as little as possible with the execution, should - * avoid using printf. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @note This function is non-blocking. If too much data is sent to the UART, - * some characters might be skipped. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_PRINTF - * - @ref NRF_LOG_PRINTF_DEBUG - * - @ref NRF_LOG_PRINTF_ERROR - * - * @param format_msg Printf format string. - */ -void log_raw_uart_printf(const char * format_msg, ...); - -/**@brief Function for logging a single character to raw UART. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @param c Character. - */ -void log_raw_uart_write_char(const char c); - -/**@brief Function for logging null-terminated strings to raw UART. - * - * @details This function is more efficient than using printf. - * The null termination will not be logged. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG - * - @ref NRF_LOG_DEBUG - * - @ref NRF_LOG_ERROR - * - * @param num_args Number of arguments. - */ -void log_raw_uart_write_string_many(int num_args, ...); - - -/**@brief Function for logging a null-terminated string to raw UART. - * - * @details This function is more efficient than using printf. - * The null termination will not be logged. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG - * - @ref NRF_LOG_DEBUG - * - @ref NRF_LOG_ERROR - * - * @param str Null-terminated string. - */ -void log_raw_uart_write_string(const char * str); - -/**@brief Function for logging an integer value as HEX to raw UART. - * - * @details The output data is formatted as, for example, 0x89ABCDEF. - * This function is more efficient than printf. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @note This function is non-blocking. If too much data is sent to the UART, - * some characters might be skipped. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_HEX - * - @ref NRF_LOG_HEX_DEBUG - * - @ref NRF_LOG_HEX_ERROR - * - * @param value Integer value to be printed as HEX. - */ -void log_raw_uart_write_hex(uint32_t value); - -/**@brief Function for logging a single character as HEX to raw UART. - * - * @details The output string is formatted as, for example, AA. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @note This function is non-blocking. If too much data is sent to the UART, - * some characters might be skipped. - * - * @note Do not call this function directly. Use one of the following macros instead: - * - @ref NRF_LOG_HEX_CHAR - * - @ref NRF_LOG_HEX_CHAR_DEBUG - * - @ref NRF_LOG_HEX_CHAR_ERROR - * - * @param c Character. - */ -void log_raw_uart_write_hex_char(uint8_t c); - -/**@brief Function for checking if data is available in the input buffer. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @note Do not call this function directly. Use @ref NRF_LOG_HAS_INPUT instead. - * - * @retval 1 If characters are available to read. - * @retval 0 If no characters are available. - */ -int log_raw_uart_has_input(void); - -/**@brief Function for reading one character from the input buffer. - * - * @param[out] p_char Pointer where to store the character. - * - * This function is available only when NRF_LOG_USES_RAW_UART is defined as 1. - * - * @note Do not call this function directly. Use NRF_LOG_READ_INPUT instead. - * - * @retval NRF_SUCCESS If the character was read out. - * @retval NRF_ERROR_INVALID_DATA If no character could be read. - */ - -uint32_t log_raw_uart_read_input(char* p_char); - -#define NRF_LOG_INIT() log_raw_uart_init() /*!< nitialize the module. */ - -#define NRF_LOG_PRINTF(...) log_raw_uart_printf(__VA_ARGS__) /*!< Print a log message using printf. */ -#define NRF_LOG_PRINTF_DEBUG(...) log_raw_uart_printf(__VA_ARGS__) /*!< If DEBUG is set, print a log message using printf. */ -#define NRF_LOG_PRINTF_ERROR(...) log_raw_uart_printf(__VA_ARGS__) /*!< Print a log message using printf to the error stream. */ - -#define NRF_LOG(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message. The input string must be null-terminated. */ -#define NRF_LOG_DEBUG(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< If DEBUG is set, print a log message. The input string must be null-terminated. */ -#define NRF_LOG_ERROR(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< Print a log message to the error stream. The input string must be null-terminated. */ - -#define NRF_LOG_HEX(val) log_raw_uart_write_hex(val) /*!< Log an integer as HEX value (example output: 0x89ABCDEF). */ -#define NRF_LOG_HEX_DEBUG(val) log_raw_uart_write_hex(val) /*!< If DEBUG is set, log an integer as HEX value (example output: 0x89ABCDEF). */ -#define NRF_LOG_HEX_ERROR(val) log_raw_uart_write_hex(val) /*!< Log an integer as HEX value to the error stream (example output: 0x89ABCDEF). */ - -#define NRF_LOG_HEX_CHAR(val) log_raw_uart_write_hex_char(val) /*!< Log a character as HEX value (example output: AA). */ -#define NRF_LOG_HEX_CHAR_DEBUG(val) log_raw_uart_write_hex_char(val) /*!< If DEBUG is set, log a character as HEX value (example output: AA). */ -#define NRF_LOG_HEX_CHAR_ERROR(val) log_raw_uart_write_hex_char(val) /*!< Log a character as HEX value to the error stream (example output: AA). */ - -#define NRF_LOG_HAS_INPUT() log_raw_uart_has_input() /*!< Check if the input buffer has unconsumed characters. */ -#define NRF_LOG_READ_INPUT(p_char) log_raw_uart_read_input(p_char) /*!< Consume a character from the input buffer. */ - -#if !defined(DEBUG) && !defined(DOXYGEN) - -#undef NRF_LOG_DEBUG -#define NRF_LOG_DEBUG(...) - -#undef NRF_LOG_PRINTF_DEBUG -#define NRF_LOG_PRINTF_DEBUG(...) - -#undef NRF_LOG_STR_DEBUG -#define NRF_LOG_STR_DEBUG(...) - -#undef NRF_LOG_HEX_DEBUG -#define NRF_LOG_HEX_DEBUG(...) - -#undef NRF_LOG_HEX_CHAR_DEBUG -#define NRF_LOG_HEX_CHAR_DEBUG(...) - -#endif // !defined(DEBUG) && !defined(DOXYGEN) - -#else - -#include "nrf_error.h" -#include "nordic_common.h" - -// Empty definitions - -#define NRF_LOG_INIT() NRF_SUCCESS -#define NRF_LOG(...) -#define NRF_LOG_DEBUG(...) -#define NRF_LOG_ERROR(...) - -#define NRF_LOG_PRINTF(...) -#define NRF_LOG_PRINTF_DEBUG(...) -#define NRF_LOG_PRINTF_ERROR(...) - -#define NRF_LOG_HEX(val) -#define NRF_LOG_HEX_DEBUG(val) -#define NRF_LOG_HEX_ERROR(val) - -#define NRF_LOG_HEX_CHAR(val) -#define NRF_LOG_HEX_CHAR_DEBUG(val) -#define NRF_LOG_HEX_CHAR_ERROR(val) - -#define NRF_LOG_HAS_INPUT() 0 -#define NRF_LOG_READ_INPUT(ignore) NRF_SUCCESS - -#endif - -/**@brief Function for writing HEX values. - * - * @note This function not thread-safe. It is written for convenience. - * If you log from different application contexts, you might get different results. - * - * @retval NULL By default. - */ -const char* log_hex(uint32_t value); - -/**@brief Function for writing HEX characters. - * - * @note This function not thread-safe. It is written for convenience. - * If you log from different application contexts, you might get different results. - * - * @retval NULL By default. - */ -const char* log_hex_char(const char value); - - - - -#else // DOXYGEN - -/** @defgroup nrf_log UART/RTT logging - * @{ - * @ingroup app_common - * - * @brief Library to output logging information over SEGGER's Real Time Transfer - * (RTT), UART, or raw UART. - * - * This library provides macros that call the respective functions depending on - * which protocol is used. Define LOG_USES_RTT=1 to enable logging over RTT, - * NRF_LOG_USES_UART=1 to enable logging over UART, or NRF_LOG_USES_RAW_UART=1 - * to enable logging over raw UART. One of these defines must be set for any of - * the macros to have effect. If you choose to not output information, all - * logging macros can be left in the code without any cost; they will just be - * ignored. - */ - - - -/**@brief Macro for initializing the logger. - * - * @retval NRF_SUCCESS If initialization was successful. - * @retval NRF_ERROR Otherwise. - */ -uint32_t NRF_LOG_INIT(void); - -/**@brief Macro for logging null-terminated strings. - * - * @details This function is more efficient than using printf. - * The null termination will not be logged. - * - * @param msg Null-terminated string. - */ -void NRF_LOG(const char* msg); - -/**@brief Macro for logging a printf string. - * - * @details Printf requires more processor time - * than other logging functions. Therefore, applications that require logging - * but need it to interfere as little as possible with the execution, should - * avoid using printf. - * - * @note When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. - * If too much data is sent, some characters might be skipped. - * - * @param format_msg Printf format string. - * @param ... Additional arguments replacing format specifiers in format_msg. - */ -void NRF_LOG_PRINTF(const char * format_msg, ...); - -/**@brief Macro for logging an integer value as HEX. - * - * @details The output data is formatted as, for example, 0x89ABCDEF. - * This function is more efficient than printf. - * - * @note When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. - * If too much data is sent, some characters might be skipped. - * - * @param value Integer value to be printed as HEX. - */ -void NRF_LOG_HEX(uint32_t value); - -/**@brief Macro for logging a single character as HEX. - * - * @details The output string is formatted as, for example, AA. - * - * @note When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. - * If too much data is sent, some characters might be skipped. - * - * @param c Character. - */ -void NRF_LOG_HEX_CHAR(uint8_t c); - -/**@brief Macro for checking if data is available in the input buffer. - * - * @note When NRF_LOG_USES_UART is set to 1, this macro is non-blocking. - * If too much data is sent, some characters might be skipped. - * - * @retval 1 If characters are available to read. - * @retval 0 If no characters are available. - */ -int NRF_LOG_HAS_INPUT(void); - -/**@brief Macro for reading one character from the input buffer. - * - * @param[out] p_char Pointer where to store the character. - * - * @retval NRF_SUCCESS If the character was read out. - * @retval NRF_ERROR_INVALID_DATA If no character could be read. - */ -uint32_t NRF_LOG_READ_INPUT(char* p_char); - -/** @} */ -#endif // DOXYGEN -#endif // NRF_LOG_H_ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_common.h index f7e8302973..fd2064c178 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_common.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_common.h @@ -36,13 +36,12 @@ * */ - /** @cond */ /**@file * * @ingroup experimental_api * @defgroup sdk_common SDK Common Header - * @breif All common headers needed for SDK examples will be included here so that application + * @brief All common headers needed for SDK examples will be included here so that application * developer does not have to include headers on him/herself. * @{ */ @@ -53,149 +52,25 @@ #include #include #include +#include "sdk_config.h" #include "nordic_common.h" #include "compiler_abstraction.h" #include "sdk_os.h" #include "sdk_errors.h" #include "app_util.h" +#include "sdk_macros.h" -/**@brief Macro for verifying that the module is initialized. It will cause the function to return - * if not. - * - * @param[in] param The variable to check if is NULL. - */ -#ifndef DISABLE_PARAM_CHECK -#define VERIFY_PARAM_NOT_NULL(param) \ -do \ -{ \ - if (param == NULL) \ - { \ - return NRF_ERROR_NULL; \ - } \ -} while(0) -#else -#define VERIFY_PARAM_NOT_NULL() -#endif /* DISABLE_PARAM_CHECK */ +#ifdef __cplusplus +extern "C" { +#endif -/**@brief Macro for verifying that the module is initialized. It will cause the function to return - * if not. - * - * @param[in] param The variable to check if is NULL. - */ -#ifndef DISABLE_PARAM_CHECK -#define VERIFY_PARAM_NOT_NULL_VOID(param) \ -do \ -{ \ - if (param == NULL) \ - { \ - return; \ - } \ -} while(0) -#else -#define VERIFY_PARAM_NOT_NULL_VOID() -#endif /* DISABLE_PARAM_CHECK */ - - -/**@brief Macro for verifying that a function returned NRF_SUCCESS. Will return the err code - * if not. - * - * @param[in] err_code The error code to check. - */ -#ifndef DISABLE_PARAM_CHECK -#define VERIFY_SUCCESS(err_code) \ -do \ -{ \ - if (err_code != NRF_SUCCESS) \ - { \ - return err_code; \ - } \ -} while(0) -#else -#define VERIFY_SUCCESS() -#endif /* DISABLE_PARAM_CHECK */ - - -/**@brief Macro for verifying that a function returned NRF_SUCCESS. Will return if not. - * - * @param[in] err_code The error code to check. - */ -#ifndef DISABLE_PARAM_CHECK -#define VERIFY_SUCCESS_VOID(err_code) \ -do \ -{ \ - if (err_code != NRF_SUCCESS) \ - { \ - return; \ - } \ -} while(0) -#else -#define VERIFY_SUCCESS_VOID() -#endif /* DISABLE_PARAM_CHECK */ - - -/**@brief Macro for verifying statement to be true. Will return err_code if not. -* -* @param[in] statement Statement to test. -* @param[in] err_code Error value to return if test was invalid. -* -* @retval err_code if test fails. -*/ -#define VERIFY_TRUE(statement, err_code) \ -do \ -{ \ - if (!(statement)) \ - { \ - return err_code; \ - } \ -} while(0) - - -/**@brief Macro for verifying statement to be true. Will return if not. -* -* @param[in] statement Statement to test. -*/ -#define VERIFY_TRUE_VOID(statement) \ -do \ -{ \ - if (!(statement)) \ - { \ - return; \ - } \ -} while(0) - - -/**@brief Macro for verifying statement to be false. Will return err_code if not. -* -* @param[in] statement Statement to test. -* @param[in] err_code Error value to return if test was invalid. -* -* @retval err_code if test fails. -*/ -#define VERIFY_FALSE(statement, err_code) \ -do \ -{ \ - if ((statement)) \ - { \ - return err_code; \ - } \ -} while(0) - - -/**@brief Macro for verifying statement to be false. Will return if not. -* -* @param[in] statement Statement to test. -*/ -#define VERIFY_FALSE_VOID(statement) \ -do \ -{ \ - if ((statement)) \ - { \ - return; \ - } \ -} while(0) - /** @} */ /** @endcond */ + +#ifdef __cplusplus +} +#endif + #endif // SDK_COMMON_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_errors.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_errors.h index dc7ef99ae4..e2ac91434b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_errors.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_errors.h @@ -36,7 +36,6 @@ * */ - /**@file * * @defgroup sdk_error SDK Error codes @@ -48,9 +47,9 @@ * are used to provide the cause or nature of error. Each module is assigned a 16-bit * unsigned integer. Which it will use to identify all errors that occurred in it. 16-bit * LSB range is with module id as the MSB in the 32-bit error code is reserved for the - * module. As an example, if 0x8800 identifies a certain SDK module, all values from + * module. As an example, if 0x8800 identifies a certain SDK module, all values from * 0x88000000 - 0x8800FFFF are reserved for this module. - * It should be noted that common error reasons have been assigned values to make it + * It should be noted that common error reasons have been assigned values to make it * possible to decode error reason easily. As an example, lets module uninitialized has * been assigned an error code 0x000A0. Then, if application encounters an error code * 0xZZZZ00A0, it knows that it accessing a certain module without initializing it. @@ -62,7 +61,7 @@ * A range is reserved for application as well, it can use this range for defining * application specific errors. * - * @note Success code, NRF_SUCCESS, does not include any module identifier. + * @note Success code, NRF_SUCCESS, does not include any module identifier. */ @@ -71,21 +70,27 @@ #include #include "nrf_error.h" +#include "sdk_config.h" + +#ifdef __cplusplus +extern "C" { +#endif /** * @defgroup sdk_err_base Base defined for SDK Modules * @{ */ -#define SDK_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x8000) /**< Base value defined for SDK module identifiers. */ -#define SDK_COMMON_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x0080) /**< Base error value to be used for SDK error values. */ +#define NRF_ERROR_SDK_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x8000) /**< Base value defined for SDK module identifiers. */ +#define NRF_ERROR_SDK_COMMON_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x0080) /**< Base error value to be used for SDK error values. */ /* @} */ /** * @defgroup sdk_module_codes Codes reserved as identification for module where the error occurred. * @{ */ -#define DEVICE_MANAGER_ERR_BASE (0x8000) -#define MEMORY_MANAGER_ERR_BASE (0x8100) +#define NRF_ERROR_MEMORY_MANAGER_ERR_BASE (0x8100) +#define NRF_ERROR_PERIPH_DRIVERS_ERR_BASE (0x8200) +#define NRF_ERROR_GAZELLE_ERR_BASE (0x8300) /* @} */ @@ -93,34 +98,34 @@ * @defgroup sdk_iot_errors Codes reserved as identification for IoT errors. * @{ */ -#define IOT_ERR_BASE_START (0xA000) -#define IOT_ERR_BASE_STOP (0xAFFF) +#define NRF_ERROR_IOT_ERR_BASE_START (0xA000) +#define NRF_ERROR_IOT_ERR_BASE_STOP (0xAFFF) /* @} */ - + /** * @defgroup sdk_common_errors Codes reserved as identification for common errors. * @{ */ -#define MODULE_NOT_INITIALZED (SDK_COMMON_ERROR_BASE + 0x0000) -#define MUTEX_INIT_FAILED (SDK_COMMON_ERROR_BASE + 0x0001) -#define MUTEX_LOCK_FAILED (SDK_COMMON_ERROR_BASE + 0x0002) -#define MUTEX_UNLOCK_FAILED (SDK_COMMON_ERROR_BASE + 0x0003) -#define MUTEX_COND_INIT_FAILED (SDK_COMMON_ERROR_BASE + 0x0004) -#define MODULE_ALREADY_INITIALIZED (SDK_COMMON_ERROR_BASE + 0x0005) -#define API_NOT_IMPLEMENTED (SDK_COMMON_ERROR_BASE + 0x0010) -#define FEATURE_NOT_ENABLED (SDK_COMMON_ERROR_BASE + 0x0011) +#define NRF_ERROR_MODULE_NOT_INITIALZED (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0000) +#define NRF_ERROR_MUTEX_INIT_FAILED (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0001) +#define NRF_ERROR_MUTEX_LOCK_FAILED (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0002) +#define NRF_ERROR_MUTEX_UNLOCK_FAILED (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0003) +#define NRF_ERROR_MUTEX_COND_INIT_FAILED (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0004) +#define NRF_ERROR_MODULE_ALREADY_INITIALIZED (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0005) +#define NRF_ERROR_STORAGE_FULL (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0006) +#define NRF_ERROR_API_NOT_IMPLEMENTED (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0010) +#define NRF_ERROR_FEATURE_NOT_ENABLED (NRF_ERROR_SDK_COMMON_ERROR_BASE + 0x0011) /* @} */ /** - * @defgroup dm_specific_errors Error / status codes specific to device manager. + * @defgroup drv_specific_errors Error / status codes specific to drivers. * @{ */ -#define DM_NO_APP_CONTEXT (DEVICE_MANAGER_ERR_BASE + 0x0040) -#define DM_SERVICE_CONTEXT_NOT_APPLIED (DEVICE_MANAGER_ERR_BASE + 0x0041) -#define DM_CONTEXT_INFO_LOST (DEVICE_MANAGER_ERR_BASE + 0x0042) -#define DM_DEVICE_CONTEXT_FULL (DEVICE_MANAGER_ERR_BASE + 0x0043) +#define NRF_ERROR_DRV_TWI_ERR_OVERRUN (NRF_ERROR_PERIPH_DRIVERS_ERR_BASE + 0x0000) +#define NRF_ERROR_DRV_TWI_ERR_ANACK (NRF_ERROR_PERIPH_DRIVERS_ERR_BASE + 0x0001) +#define NRF_ERROR_DRV_TWI_ERR_DNACK (NRF_ERROR_PERIPH_DRIVERS_ERR_BASE + 0x0002) /* @} */ /** @@ -135,8 +140,41 @@ * an indicative of whether the procedure has been requested successfully. */ typedef uint32_t ret_code_t; + +#if defined(NRF_LOG_ENABLED) && NRF_LOG_ENABLED +/** + * @defgroup err_sizes Sizes of error code arrays. + * @{ + */ +#define ERR_NAMES_SIZE 18 +#define ERR_NAMES_COMMON_SIZE 9 +#define ERR_NAMES_TWI_SIZE 3 +/* @} */ + +extern const char * m_sdk_errors_name[ERR_NAMES_SIZE]; +extern const char * m_sdk_errors_name_common[ERR_NAMES_COMMON_SIZE]; +extern const char * m_sdk_errors_name_twi[ERR_NAMES_TWI_SIZE]; + +/** + * @defgroup err_to_string Macros for converting error codes to strings. + * @{ + */ +#define ERR_TO_STR(err_code) m_sdk_errors_name[err_code] +#define ERR_TO_STR_COMMON(err_code) m_sdk_errors_name_common[err_code - NRF_ERROR_SDK_COMMON_ERROR_BASE] +#define ERR_TO_STR_TWI(err_code) m_sdk_errors_name_twi[err_code - NRF_ERROR_PERIPH_DRIVERS_ERR_BASE] +#else +#define ERR_TO_STR(err_code) "" +#define ERR_TO_STR_COMMON(err_code) "" +#define ERR_TO_STR_TWI(err_code) "" +#endif // NRF_LOG_ENABLED + +/* @} */ /** @} */ /** @} */ +#ifdef __cplusplus +} +#endif + #endif // SDK_ERRORS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_macros.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_macros.h index 166073e579..53300fbe5b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_macros.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_macros.h @@ -36,64 +36,155 @@ * */ - -/** @cond */ /**@file * - * @ingroup sdk_util + * @defgroup sdk_common_macros SDK Common Header - * @breif Macros for parameter checking and similar tasks + * @ingroup app_common + * @brief Macros for parameter checking and similar tasks * @{ */ #ifndef SDK_MACROS_H__ #define SDK_MACROS_H__ -/**@brief Macro for verifying that the module is initialized. It will cause the function to return - * @ref NRF_ERROR_INVALID_STATE if not. +#ifdef __cplusplus +extern "C" { +#endif + + +/**@brief Macro for verifying statement to be true. It will cause the exterior function to return + * err_code if the statement is not true. + * + * @param[in] statement Statement to test. + * @param[in] err_code Error value to return if test was invalid. + * + * @retval nothing, but will cause the exterior function to return @p err_code if @p statement + * is false. */ -#ifdef DISABLE_PARAM_CHECK -#define VERIFY_MODULE_INITIALIZED() -#else -#ifdef MODULE_INITIALIZED -#define VERIFY_MODULE_INITIALIZED() \ +#define VERIFY_TRUE(statement, err_code) \ do \ { \ - if (!MODULE_INITIALIZED) \ + if (!(statement)) \ { \ - return NRF_ERROR_INVALID_STATE; \ + return err_code; \ } \ -} while(0) +} while (0) + + +/**@brief Macro for verifying statement to be true. It will cause the exterior function to return + * if the statement is not true. + * + * @param[in] statement Statement to test. + */ +#define VERIFY_TRUE_VOID(statement) VERIFY_TRUE((statement), ) + + +/**@brief Macro for verifying statement to be false. It will cause the exterior function to return + * err_code if the statement is not false. + * + * @param[in] statement Statement to test. + * @param[in] err_code Error value to return if test was invalid. + * + * @retval nothing, but will cause the exterior function to return @p err_code if @p statement + * is true. + */ +#define VERIFY_FALSE(statement, err_code) \ +do \ +{ \ + if ((statement)) \ + { \ + return err_code; \ + } \ +} while (0) + + +/**@brief Macro for verifying statement to be false. It will cause the exterior function to return + * if the statement is not false. + * + * @param[in] statement Statement to test. + */ +#define VERIFY_FALSE_VOID(statement) VERIFY_FALSE((statement), ) + + +/**@brief Macro for verifying that a function returned NRF_SUCCESS. It will cause the exterior + * function to return err_code if the err_code is not @ref NRF_SUCCESS. + * + * @param[in] err_code The error code to check. + */ +#ifdef DISABLE_PARAM_CHECK +#define VERIFY_SUCCESS() #else -#define VERIFY_MODULE_INITIALIZED() -#endif /* MODULE_INITIALIZED */ +#define VERIFY_SUCCESS(err_code) VERIFY_TRUE((err_code) == NRF_SUCCESS, (err_code)) #endif /* DISABLE_PARAM_CHECK */ -/**@brief Macro for verifying that the module is initialized. It will cause the function to return - * if not. +/**@brief Macro for verifying that a function returned NRF_SUCCESS. It will cause the exterior + * function to return if the err_code is not @ref NRF_SUCCESS. + * + * @param[in] err_code The error code to check. + */ +#ifdef DISABLE_PARAM_CHECK +#define VERIFY_SUCCESS_VOID() +#else +#define VERIFY_SUCCESS_VOID(err_code) VERIFY_TRUE_VOID((err_code) == NRF_SUCCESS) +#endif /* DISABLE_PARAM_CHECK */ + + +/**@brief Macro for verifying that the module is initialized. It will cause the exterior function to + * return @ref NRF_ERROR_INVALID_STATE if not. + * + * @note MODULE_INITIALIZED must be defined in each module using this macro. MODULE_INITIALIZED + * should be true if the module is initialized, false if not. + */ +#ifdef DISABLE_PARAM_CHECK +#define VERIFY_MODULE_INITIALIZED() +#else +#define VERIFY_MODULE_INITIALIZED() VERIFY_TRUE((MODULE_INITIALIZED), NRF_ERROR_INVALID_STATE) +#endif /* DISABLE_PARAM_CHECK */ + + +/**@brief Macro for verifying that the module is initialized. It will cause the exterior function to + * return if not. + * + * @note MODULE_INITIALIZED must be defined in each module using this macro. MODULE_INITIALIZED + * should be true if the module is initialized, false if not. */ #ifdef DISABLE_PARAM_CHECK #define VERIFY_MODULE_INITIALIZED_VOID() #else -#ifdef MODULE_INITIALIZED -#define VERIFY_MODULE_INITIALIZED_VOID() \ -do \ -{ \ - if (!MODULE_INITIALIZED) \ - { \ - return; \ - } \ -} while(0) -#else -#define VERIFY_MODULE_INITIALIZED_VOID() -#endif /* MODULE_INITIALIZED */ +#define VERIFY_MODULE_INITIALIZED_VOID() VERIFY_TRUE_VOID((MODULE_INITIALIZED)) #endif /* DISABLE_PARAM_CHECK */ +/**@brief Macro for verifying that the module is initialized. It will cause the exterior function to + * return if not. + * + * @param[in] param The variable to check if is NULL. + */ +#ifdef DISABLE_PARAM_CHECK +#define VERIFY_PARAM_NOT_NULL() +#else +#define VERIFY_PARAM_NOT_NULL(param) VERIFY_FALSE(((param) == NULL), NRF_ERROR_NULL) +#endif /* DISABLE_PARAM_CHECK */ +/**@brief Macro for verifying that the module is initialized. It will cause the exterior function to + * return if not. + * + * @param[in] param The variable to check if is NULL. + */ +#ifdef DISABLE_PARAM_CHECK +#define VERIFY_PARAM_NOT_NULL_VOID() +#else +#define VERIFY_PARAM_NOT_NULL_VOID(param) VERIFY_FALSE_VOID(((param) == NULL)) +#endif /* DISABLE_PARAM_CHECK */ + /** @} */ -/** @endcond */ + +#ifdef __cplusplus +} +#endif + #endif // SDK_MACROS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.c index c92dbc973f..f8aad10efb 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.c @@ -36,7 +36,6 @@ * */ - #include "sdk_mapped_flags.h" #include #include diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.h index 780a9b61e3..4c86d9f5a4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_mapped_flags.h @@ -36,7 +36,6 @@ * */ - #ifndef SDK_MAPPED_FLAGS_H__ #define SDK_MAPPED_FLAGS_H__ @@ -45,6 +44,10 @@ #include "app_util.h" #include "compiler_abstraction.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @file * @defgroup sdk_mapped_flags Mapped flags @@ -74,7 +77,7 @@ typedef uint8_t sdk_mapped_flags_t; /**< The bitmap to hold flags. Each flag is // Test whether the flag collection type is large enough to hold all the flags. If this fails, // reduce SDK_MAPPED_FLAGS_N_KEYS or increase the size of sdk_mapped_flags_t. STATIC_ASSERT(( - sizeof(sdk_mapped_flags_t)*SDK_MAPPED_FLAGS_N_KEYS_PER_BYTE) >= SDK_MAPPED_FLAGS_N_KEYS); + sizeof(sdk_mapped_flags_t) * SDK_MAPPED_FLAGS_N_KEYS_PER_BYTE) >= SDK_MAPPED_FLAGS_N_KEYS); /**@brief Type used to present a subset of the registered keys. @@ -177,4 +180,9 @@ static __INLINE bool sdk_mapped_flags_any_set(sdk_mapped_flags_t flags) /** @} */ + +#ifdef __cplusplus +} +#endif + #endif /* SDK_MAPPED_FLAGS_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_os.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_os.h index 760822ff35..ad97e2fcc1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_os.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_os.h @@ -36,7 +36,6 @@ * */ - /** @cond */ /**@file * @@ -52,6 +51,10 @@ #ifndef SDK_OS_H__ #define SDK_OS_H__ +#ifdef __cplusplus +extern "C" { +#endif + #define SDK_MUTEX_DEFINE(X) #define SDK_MUTEX_INIT(X) #define SDK_MUTEX_LOCK(X) @@ -60,8 +63,13 @@ /** * @defgroup os_data_type Data types. */ - + /** @} */ /** @endcond */ + +#ifdef __cplusplus +} +#endif + #endif // SDK_OS_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_resources.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_resources.h index 27b0863856..5e32763eb1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_resources.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/sdk_resources.h @@ -36,7 +36,6 @@ * */ - /** @file * @brief Definition file for resource usage by SoftDevice, ESB and Gazell. */ @@ -45,29 +44,33 @@ #define APP_RESOURCES_H__ #ifdef SOFTDEVICE_PRESENT - #include "nrf_sd_def.h" + #include "nrf_sd_def.h" #else - #define SD_PPI_RESTRICTED 0uL /**< 1 if PPI peripheral is restricted, 0 otherwise. */ - #define SD_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by SotfDevice (not available to th spplication). */ - #define SD_PPI_GROUPS_USED 0uL /**< PPI groups utilized by SotfDevice (not available to th spplication). */ - #define SD_TIMERS_USED 0uL /**< Timers used by SoftDevice. */ - #define SD_SWI_USED 0uL /**< Software interrupts used by SoftDevice. */ + #define SD_PPI_RESTRICTED 0uL /**< 1 if PPI peripheral is restricted, 0 otherwise. */ + #define SD_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by SotfDevice (not available to th spplication). */ + #define SD_PPI_GROUPS_USED 0uL /**< PPI groups utilized by SotfDevice (not available to th spplication). */ + #define SD_TIMERS_USED 0uL /**< Timers used by SoftDevice. */ + #define SD_SWI_USED 0uL /**< Software interrupts used by SoftDevice. */ #endif #ifdef GAZELL_PRESENT - #include "nrf_gzll_resources.h" + #include "nrf_gzll_resources.h" #else - #define GZLL_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by Gazell (not available to th spplication). */ - #define GZLL_TIMERS_USED 0uL /**< Timers used by Gazell. */ - #define GZLL_SWI_USED 0uL /**< Software interrupts used by Gazell */ + #define GZLL_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by Gazell (not available to th spplication). */ + #define GZLL_TIMERS_USED 0uL /**< Timers used by Gazell. */ + #define GZLL_SWI_USED 0uL /**< Software interrupts used by Gazell */ #endif + +#ifdef __cplusplus +extern "C" { +#endif #ifdef ESB_PRESENT - #include "nrf_esb_resources.h" + #include "nrf_esb_resources.h" #else - #define ESB_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by ESB (not available to th spplication). */ - #define ESB_TIMERS_USED 0uL /**< Timers used by ESB. */ - #define ESB_SWI_USED 0uL /**< Software interrupts used by ESB */ + #define ESB_PPI_CHANNELS_USED 0uL /**< PPI channels utilized by ESB (not available to th spplication). */ + #define ESB_TIMERS_USED 0uL /**< Timers used by ESB. */ + #define ESB_SWI_USED 0uL /**< Software interrupts used by ESB */ #endif #define NRF_PPI_CHANNELS_USED (SD_PPI_CHANNELS_USED | GZLL_PPI_CHANNELS_USED | ESB_PPI_CHANNELS_USED) @@ -75,4 +78,9 @@ #define NRF_SWI_USED (SD_SWI_USED | GZLL_SWI_USED | ESB_SWI_USED) #define NRF_TIMERS_USED (SD_TIMERS_USED | GZLL_TIMERS_USED | ESB_TIMERS_USED) + +#ifdef __cplusplus +} +#endif + #endif // APP_RESOURCES_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/sdk_validation.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/sdk_validation.h new file mode 100644 index 0000000000..0cf60a1b03 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/sdk_validation.h @@ -0,0 +1,304 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef SDK_VALIDATION_H +#define SDK_VALIDATION_H + +#include "nrf_peripherals.h" +#include "sdk_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Validate peripheral availibility + +#if ((defined(SAADC_ENABLED)) && (SAADC_ENABLED > 0) && (!defined(SAADC_PRESENT))) +#error "SAADC not present in selected MCU." +#endif + +#if ((defined(ADC_ENABLED)) && (ADC_ENABLED > 0) && (!defined(ADC_PRESENT))) +#error "SAADC not present in selected MCU." +#endif + +#if ((defined(I2S_ENABLED)) && (I2S_ENABLED > 0) && (!defined(I2S_PRESENT))) +#error "I2S not present in selected MCU." +#endif + +#if ((defined(COMP_ENABLED)) && (COMP_ENABLED > 0) && (!defined(COMP_PRESENT))) +#error "COMP not present in selected MCU." +#endif + +#if ((defined(LPCOMP_ENABLED)) && (LPCOMP_ENABLED > 0) && (!defined(LPCOMP_PRESENT))) +#error "LPCOMP not present in selected MCU." +#endif + +#if ((defined(SPIS0_ENABLED)) && (SPIS0_ENABLED > 0) && (!defined(SPIS_PRESENT))) +#error "SPIS0 instance not present in selected MCU." +#endif + +#if ((defined(EGU_ENABLED)) && (EGU_ENABLED > 0) && (!defined(EGU_PRESENT))) +#error "EGU instance not present in selected MCU." +#endif + +#if ((defined(NFC_HAL_ENABLED)) && (NFC_HAL_ENABLED > 0) && (!defined(NFCT_PRESENT))) +#error "NFC TAG not present in selected MCU." +#endif + +// Validate count of instances + +#if ((defined(RTC2_ENABLED)) && (RTC2_ENABLED > 0) && (RTC_COUNT < 2)) +#error "RTC2 not present in selected MCU." +#endif + +#if ((defined(TWIS0_ENABLED) || defined(TWIS1_ENABLED)) &&\ + ((TWIS0_ENABLED + TWIS1_ENABLED) > 0) &&\ + (!defined(TWIS_PRESENT))) +#error "TWIS not present in selected MCU." +#endif + +#if ((defined(SPIS2_ENABLED)) && (SPIS2_ENABLED > 0) && (SPIS_COUNT < 2)) +#error "SPI2/SPIS2 instance not present in selected MCU." +#endif + +#if ((defined(TIMER3_ENABLED) || defined(TIMER4_ENABLED)) &&\ + ((TIMER3_ENABLED + TIMER4_ENABLED ) > 0) &&\ + (TIMER_COUNT < 5)) +#error "TIMER3 and TIMER4 not present in selected MCU." +#endif + +// Validate peripheral sharing feature +#if ((defined(PERIPHERAL_RESOURCE_SHARING_ENABLED)) && (!PERIPHERAL_RESOURCE_SHARING_ENABLED)) + +#if ((defined(TWIM0_ENABLED) && defined(TWIS0_ENABLED)) &&\ + ((TWIM0_ENABLED + TWIS0_ENABLED) > 1)) +#error "Peripherals overlap. TWIM0, TWIS0 - only one of these can be enabled." +#endif + +#if ((defined(TWIM0_ENABLED) && defined(SPIM0_ENABLED)) &&\ + ((TWIM0_ENABLED + SPIM0_ENABLED) > 1)) +#error "Peripherals overlap. TWIM0, SPIM0 - only one of these can be enabled." +#endif + +#if ((defined(TWIM0_ENABLED) && defined(SPIS0_ENABLED)) &&\ + ((TWIM0_ENABLED + SPIS0_ENABLED) > 1)) +#error "Peripherals overlap. TWIM0, SPIS0 - only one of these can be enabled." +#endif + +#if ((defined(TWIM0_ENABLED) && defined(SPI0_ENABLED)) &&\ + ((TWIM0_ENABLED + SPI0_ENABLED) > 1)) +#error "Peripherals overlap. TWIM0, SPI0 - only one of these can be enabled." +#endif + +#if ((defined(TWIM0_ENABLED) && defined(TWI0_ENABLED)) &&\ + ((TWIM0_ENABLED + TWI0_ENABLED) > 1)) +#error "Peripherals overlap. TWIM0, TWI0 - only one of these can be enabled." +#endif + +#if ((defined(TWIS0_ENABLED) && defined(SPIM0_ENABLED)) &&\ + ((TWIS0_ENABLED + SPIM0_ENABLED) > 1)) +#error "Peripherals overlap. TWIS0, SPIM0 - only one of these can be enabled." +#endif + +#if ((defined(TWIS0_ENABLED) && defined(SPIS0_ENABLED)) &&\ + ((TWIS0_ENABLED + SPIS0_ENABLED) > 1)) +#error "Peripherals overlap. TWIS0, SPIS0 - only one of these can be enabled." +#endif + +#if ((defined(TWIS0_ENABLED) && defined(SPI0_ENABLED)) &&\ + ((TWIS0_ENABLED + SPI0_ENABLED) > 1)) +#error "Peripherals overlap. TWIS0, SPI0 - only one of these can be enabled." +#endif + +#if ((defined(TWIS0_ENABLED) && defined(TWI0_ENABLED)) &&\ + ((TWIS0_ENABLED + TWI0_ENABLED) > 1)) +#error "Peripherals overlap. TWIS0, TWI0 - only one of these can be enabled." +#endif + +#if ((defined(SPIM0_ENABLED) && defined(SPIS0_ENABLED)) &&\ + ((SPIM0_ENABLED + SPIS0_ENABLED) > 1)) +#error "Peripherals overlap. SPIM0, SPIS0 - only one of these can be enabled." +#endif + +#if ((defined(SPIM0_ENABLED) && defined(SPI0_ENABLED)) &&\ + ((SPIM0_ENABLED + SPI0_ENABLED) > 1)) +#error "Peripherals overlap. SPIM0, SPI0 - only one of these can be enabled." +#endif + +#if ((defined(SPIM0_ENABLED) && defined(TWI0_ENABLED)) &&\ + ((SPIM0_ENABLED + TWI0_ENABLED) > 1)) +#error "Peripherals overlap. SPIM0, TWI0 - only one of these can be enabled." +#endif + +#if ((defined(SPIS0_ENABLED) && defined(SPI0_ENABLED)) &&\ + ((SPIS0_ENABLED + SPI0_ENABLED) > 1)) +#error "Peripherals overlap. SPIS0, SPI0 - only one of these can be enabled." +#endif + +#if ((defined(SPIS0_ENABLED) && defined(TWI0_ENABLED)) &&\ + ((SPIS0_ENABLED + TWI0_ENABLED) > 1)) +#error "Peripherals overlap. SPIS0, TWI0 - only one of these can be enabled." +#endif + +#if ((defined(SPI0_ENABLED) && defined(TWI0_ENABLED)) &&\ + ((SPI0_ENABLED + TWI0_ENABLED) > 1)) +#error "Peripherals overlap. SPI0, TWI0 - only one of these can be enabled." +#endif + +#if ((defined(TWIM1_ENABLED) && defined(TWIS1_ENABLED)) &&\ + ((TWIM1_ENABLED + TWIS1_ENABLED) > 1)) +#error "Peripherals overlap. TWIM1, TWIS1 - only one of these can be enabled." +#endif + +#if ((defined(TWIM1_ENABLED) && defined(SPIM1_ENABLED)) &&\ + ((TWIM1_ENABLED + SPIM1_ENABLED) > 1)) +#error "Peripherals overlap. TWIM1, SPIM1 - only one of these can be enabled." +#endif + +#if ((defined(TWIM1_ENABLED) && defined(SPIS1_ENABLED)) &&\ + ((TWIM1_ENABLED + SPIS1_ENABLED) > 1)) +#error "Peripherals overlap. TWIM1, SPIS1 - only one of these can be enabled." +#endif + +#if ((defined(TWIM1_ENABLED) && defined(SPI1_ENABLED)) &&\ + ((TWIM1_ENABLED + SPI1_ENABLED) > 1)) +#error "Peripherals overlap. TWIM1, SPI1 - only one of these can be enabled." +#endif + +#if ((defined(TWIM1_ENABLED) && defined(TWI1_ENABLED)) &&\ + ((TWIM1_ENABLED + TWI1_ENABLED) > 1)) +#error "Peripherals overlap. TWIM1, TWI1 - only one of these can be enabled." +#endif + +#if ((defined(TWIS1_ENABLED) && defined(SPIM1_ENABLED)) &&\ + ((TWIS1_ENABLED + SPIM1_ENABLED) > 1)) +#error "Peripherals overlap. TWIS1, SPIM1 - only one of these can be enabled." +#endif + +#if ((defined(TWIS1_ENABLED) && defined(SPIS1_ENABLED)) &&\ + ((TWIS1_ENABLED + SPIS1_ENABLED) > 1)) +#error "Peripherals overlap. TWIS1, SPIS1 - only one of these can be enabled." +#endif + +#if ((defined(TWIS1_ENABLED) && defined(SPI1_ENABLED)) &&\ + ((TWIS1_ENABLED + SPI1_ENABLED) > 1)) +#error "Peripherals overlap. TWIS1, SPI1 - only one of these can be enabled." +#endif + +#if ((defined(TWIS1_ENABLED) && defined(TWI1_ENABLED)) &&\ + ((TWIS1_ENABLED + TWI1_ENABLED) > 1)) +#error "Peripherals overlap. TWIS1, TWI1 - only one of these can be enabled." +#endif + +#if ((defined(SPIM1_ENABLED) && defined(SPIS1_ENABLED)) &&\ + ((SPIM1_ENABLED + SPIS1_ENABLED) > 1)) +#error "Peripherals overlap. SPIM1, SPIS1 - only one of these can be enabled." +#endif + +#if ((defined(SPIM1_ENABLED) && defined(SPI1_ENABLED)) &&\ + ((SPIM1_ENABLED + SPI1_ENABLED) > 1)) +#error "Peripherals overlap. SPIM1, SPI1 - only one of these can be enabled." +#endif + +#if ((defined(SPIM1_ENABLED) && defined(TWI1_ENABLED)) &&\ + ((SPIM1_ENABLED + TWI1_ENABLED) > 1)) +#error "Peripherals overlap. SPIM1, TWI1 - only one of these can be enabled." +#endif + +#if ((defined(SPIS1_ENABLED) && defined(SPI1_ENABLED)) &&\ + ((SPIS1_ENABLED + SPI1_ENABLED) > 1)) +#error "Peripherals overlap. SPIS1, SPI1 - only one of these can be enabled." +#endif + +#if ((defined(SPIS1_ENABLED) && defined(TWI1_ENABLED)) &&\ + ((SPIS1_ENABLED + TWI1_ENABLED) > 1)) +#error "Peripherals overlap. SPIS1, TWI1 - only one of these can be enabled." +#endif + +#if ((defined(SPI1_ENABLED) && defined(TWI1_ENABLED)) &&\ + ((SPI1_ENABLED + TWI1_ENABLED) > 1)) +#error "Peripherals overlap. SPI1, TWI1 - only one of these can be enabled." +#endif + +#if ((defined(SPI2_ENABLED) && defined(SPIS2_ENABLED)) &&\ + ((SPI2_ENABLED + SPIS2_ENABLED) > 1)) +#error "Peripherals overlap. SPI2, SPIS2 - only one of these can be enabled." +#endif + +#if ((defined(SPIM2_ENABLED) && defined(SPIS2_ENABLED)) &&\ + ((SPI2_ENABLED + SPIS2_ENABLED) > 1)) +#error "Peripherals overlap. SPIM2, SPIS2 - only one of these can be enabled." +#endif + +#if ((defined(SPIM2_ENABLED) && defined(SPI2_ENABLED)) &&\ + ((SPI2_ENABLED + SPIS2_ENABLED) > 1)) +#error "Peripherals overlap. SPIM2, SPI2 - only one of these can be enabled." +#endif + +#endif + +#ifdef NFCT_PRESENT + +#if ((defined(NFC_HAL_ENABLED) && defined(CLOCK_ENABLED)) &&\ + ((NFC_HAL_ENABLED) && (!CLOCK_ENABLED))) +#error "NFC_HAL requires CLOCK to work. NFC_HAL can not be enabled without CLOCK." +#endif + +#if ((defined(NFC_HAL_ENABLED) && defined(TIMER4_ENABLED)) &&\ + ((NFC_HAL_ENABLED + TIMER4_ENABLED) > 1)) +#error "TIMER4 is used by NFC_HAL. NFC_HAL, TIMER4 - only one of these can be enabled." +#endif + +#endif +// Complex driver validation +#ifdef LPCOMP_PRESENT + +#if ((defined(COMP_ENABLED) && defined(LPCOMP_ENABLED)) &&\ + (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \ + ((COMP_ENABLED + LPCOMP_ENABLED) > 1)) +#error "Peripherals overlap. SPIM2, SPI2 - only one of these can be enabled." +#endif + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif // SDK_VALIDATION_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ant_stack_handler_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ant_stack_handler_types.h index a74ed1800d..a3a7ab3148 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ant_stack_handler_types.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ant_stack_handler_types.h @@ -36,7 +36,6 @@ * */ - /**@file * * @defgroup ant_stack_handler_types Types definitions for ANT support in SoftDevice handler. @@ -49,9 +48,14 @@ #ifndef ANT_STACK_HANDLER_TYPES_H__ #define ANT_STACK_HANDLER_TYPES_H__ +#ifdef __cplusplus +extern "C" { +#endif + #ifdef ANT_STACK_SUPPORT_REQD #include +#include #define ANT_STACK_EVT_MSG_BUF_SIZE 32 /**< Size of ANT event message buffer. This will be provided to the SoftDevice while fetching an event. */ #define ANT_STACK_EVT_STRUCT_SIZE (sizeof(ant_evt_t)) /**< Size of the @ref ant_evt_t structure. This will be used by the @ref softdevice_handler to internal event buffer size needed. */ @@ -95,6 +99,11 @@ uint32_t softdevice_ant_evt_handler_set(ant_evt_handler_t ant_evt_handler); #endif // ANT_STACK_SUPPORT_REQD + +#ifdef __cplusplus +} +#endif + #endif // ANT_STACK_HANDLER_TYPES_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/app_ram_base.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/app_ram_base.h index 5722bfd97b..3136605ebd 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/app_ram_base.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/app_ram_base.h @@ -36,168 +36,151 @@ * */ - // ble_enable param app_ram_base -#define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20001870 -#define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20001870 -#define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20001fe8 -#define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20001fe8 -#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20001ce0 -#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20001c98 -#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20001eb0 -#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20001e68 -#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20002418 -#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x200023d0 -#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x200025e0 -#define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x200025a0 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20002110 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20002080 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x200022d8 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20002250 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x200024a8 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20002418 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20002840 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x200027b8 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20002a10 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20002980 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20002bd8 -#define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20002b50 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20002538 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20002468 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20002708 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20002638 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x200028d0 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20002800 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20002aa0 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x200029d0 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20002c70 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20002ba0 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20002e40 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20002d68 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003008 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20002f38 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x200031d8 -#define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x20003100 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20002968 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20002850 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20002b30 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20002a18 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20002d00 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20002be8 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20002ec8 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20002db0 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x20003098 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20002f80 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x200030a0 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20002f88 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003268 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20003150 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003438 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20003320 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x20003600 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x200034e8 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x200037d0 -#define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_4_LOW_BW 0x200036b8 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20002d98 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20002c38 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20002f60 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x20002e00 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20003130 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20002fd0 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x200032f8 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20003198 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x200034c8 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20003368 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_5_MID_BW 0x20003690 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_5_LOW_BW 0x20003530 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x200034c8 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20003370 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003698 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20003538 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003860 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20003708 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x20003a30 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x200038d0 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x20003bf8 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_4_LOW_BW 0x20003aa0 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_5_MID_BW 0x20003dc8 -#define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_5_LOW_BW 0x20003c68 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x200031c0 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20003020 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20003390 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x200031e8 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20003558 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x200033b8 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20003728 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20003580 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x200038f0 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20003750 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_5_MID_BW 0x20003ac0 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_5_LOW_BW 0x20003918 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_6_MID_BW 0x20003c88 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_6_LOW_BW 0x20003ae8 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x200038f8 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20003750 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003ac0 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20003920 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003c90 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20003ae8 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x20003e58 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x20003cb8 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x20004028 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_4_LOW_BW 0x20003e80 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_5_MID_BW 0x200041f0 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_5_LOW_BW 0x20004050 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_6_MID_BW 0x200043c0 -#define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_6_LOW_BW 0x20004218 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x200035f0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x20003408 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x200037b8 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x200035d0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20003988 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x200037a0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20003b50 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20003968 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x20003d20 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20003b38 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_5_MID_BW 0x20003ee8 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_5_LOW_BW 0x20003d00 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_6_MID_BW 0x200040b8 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_6_LOW_BW 0x20003ed0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_7_MID_BW 0x20004280 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_7_LOW_BW 0x20004098 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20003d28 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_0_LOW_BW 0x20003b38 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003ef0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_LOW_BW 0x20003d08 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x200040c0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_2_LOW_BW 0x20003ed0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_3_MID_BW 0x20004288 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_3_LOW_BW 0x200040a0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x20004458 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_4_LOW_BW 0x20004268 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_5_MID_BW 0x20004620 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_5_LOW_BW 0x20004438 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_6_MID_BW 0x200047f0 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_6_LOW_BW 0x20004600 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_7_MID_BW 0x200049b8 -#define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_7_LOW_BW 0x200047d0 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_0_MID_BW 0x20003a18 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_0_LOW_BW 0x200037e8 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_1_MID_BW 0x20003be8 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_1_LOW_BW 0x200039b8 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_2_MID_BW 0x20003db0 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_2_LOW_BW 0x20003b80 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_3_MID_BW 0x20003f80 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_3_LOW_BW 0x20003d50 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_4_MID_BW 0x20004148 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_4_LOW_BW 0x20003f18 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_5_MID_BW 0x20004318 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_5_LOW_BW 0x200040e8 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_6_MID_BW 0x200044e0 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_6_LOW_BW 0x200042b0 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_7_MID_BW 0x200046b0 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_7_LOW_BW 0x20004480 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_8_MID_BW 0x20004878 -#define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_8_LOW_BW 0x20004648 +#ifndef APP_RAM_BASE_H__ +#define APP_RAM_BASE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef S130 + #define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20001870 + #define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20001900 + #define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20001fe8 + #define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20002078 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20001ce0 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20001d70 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20001eb0 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20001f40 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002418 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200024a8 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x200025e0 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002670 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002110 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200021a0 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x200022d8 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002368 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002840 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200028d0 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002a10 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002aa0 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002538 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200025c8 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002708 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002798 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002c70 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20002d00 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002e40 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002ed0 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002968 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200029f8 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002b30 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002bc0 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200030a0 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003130 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003268 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x200032f8 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002d98 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20002e28 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002f60 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002ff0 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200034c8 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003558 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003698 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003728 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200031c0 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003250 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003390 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003420 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200038f8 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003988 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003ac0 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003b50 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200035f0 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003680 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x200037b8 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003848 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20003d28 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003db8 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003ef0 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003f80 + #define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20003a18 + #define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003aa8 + #define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003be8 + #define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003c78 +#elif defined(S132) || defined(S332) + #define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20001930 + #define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200019c0 + #define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002128 + #define APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200021b8 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20001e18 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20001ea8 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20001fe8 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002078 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200025d0 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20002660 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002798 + #define APP_RAM_BASE_CENTRAL_LINKS_1_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002828 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200022c0 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20002350 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002490 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002520 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002a78 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20002b08 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002c40 + #define APP_RAM_BASE_CENTRAL_LINKS_2_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002cd0 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002768 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200027f8 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002938 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x200029c8 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002f20 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20002fb0 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x200030e8 + #define APP_RAM_BASE_CENTRAL_LINKS_3_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003178 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20002c10 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20002ca0 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20002de0 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20002e70 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200033c8 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003458 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003590 + #define APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003620 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200030b8 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003148 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003288 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003318 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20003870 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003900 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003a38 + #define APP_RAM_BASE_CENTRAL_LINKS_5_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003ac8 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20003560 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x200035f0 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003730 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x200037c0 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20003d18 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003da8 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003ee0 + #define APP_RAM_BASE_CENTRAL_LINKS_6_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003f70 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20003a08 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003a98 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20003bd8 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20003c68 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x200041c0 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20004250 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20004388 + #define APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20004418 + #define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20003eb0 + #define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_0_VS_UUID_COUNT_10_MID_BW 0x20003f40 + #define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW 0x20004080 + #define APP_RAM_BASE_CENTRAL_LINKS_8_PERIPH_LINKS_0_SEC_COUNT_1_VS_UUID_COUNT_10_MID_BW 0x20004110 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif // APP_RAM_BASE_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h index f40e4576e2..7e308ded64 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h @@ -36,7 +36,6 @@ * */ - /**@file * * @defgroup ble_stack_handler_types Types definitions for BLE support in SoftDevice handler. @@ -49,16 +48,33 @@ #ifndef BLE_STACK_HANDLER_TYPES_H__ #define BLE_STACK_HANDLER_TYPES_H__ +#ifdef __cplusplus +extern "C" { +#endif + #ifdef BLE_STACK_SUPPORT_REQD #include -#include "nrf_ble.h" +#include "ble.h" #include "nrf_sdm.h" #include "app_error.h" #include "app_util.h" +#include "sdk_config.h" -#define BLE_STACK_EVT_MSG_BUF_SIZE (sizeof(ble_evt_t) + (GATT_MTU_SIZE_DEFAULT)) /**< Size of BLE event message buffer. This will be provided to the SoftDevice while fetching an event. */ -#define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0 /**< The size of the scheduler event used by SoftDevice handler when passing BLE events using the @ref app_scheduler. */ +/** @brief Default Maximum ATT MTU size. + * + * This define should be defined in the sdk_config.h file to override the default. + */ +#ifndef NRF_BLE_GATT_MAX_MTU_SIZE + #if ((NRF_SD_BLE_API_VERSION == 2) || (NRF_SD_BLE_API_VERSION == 3)) + #define NRF_BLE_GATT_MAX_MTU_SIZE GATT_MTU_SIZE_DEFAULT + #else + #define NRF_BLE_GATT_MAX_MTU_SIZE BLE_GATT_MTU_SIZE_DEFAULT + #endif +#endif + +#define BLE_STACK_EVT_MSG_BUF_SIZE (sizeof(ble_evt_t) + (NRF_BLE_GATT_MAX_MTU_SIZE)) /**< Size of BLE event message buffer. This will be provided to the SoftDevice while fetching an event. */ +#define BLE_STACK_HANDLER_SCHED_EVT_SIZE 0 /**< The size of the scheduler event used by SoftDevice handler when passing BLE events using the @ref app_scheduler. */ /**@brief Application stack event handler type. */ typedef void (*ble_evt_handler_t) (ble_evt_t * p_ble_evt); @@ -86,6 +102,11 @@ uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler); #endif // BLE_STACK_SUPPORT_REQD + +#ifdef __cplusplus +} +#endif + #endif // BLE_STACK_HANDLER_TYPES_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c index 5534ae6dae..f5d1416e02 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c @@ -35,52 +35,40 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - #include "softdevice_handler.h" #include #include #include #include -#include "nordic_common.h" -#include "app_error.h" -#include "nrf_assert.h" -#include "nrf_nvic.h" #include "nrf.h" -#include "nrf_log.h" +#include "nrf_assert.h" +#include "nrf_soc.h" +#include "nrf_nvic.h" #include "sdk_common.h" -#include "nrf_drv_config.h" -#if CLOCK_ENABLED -#include "nrf_drv_clock.h" -#endif +#if NRF_MODULE_ENABLED(CLOCK) +#include "nrf_drv_clock.h" +#endif // NRF_MODULE_ENABLED(CLOCK) +#include "app_error.h" + +#if NRF_MODULE_ENABLED(RNG) +#include "nrf_drv_rng.h" +#endif // NRF_MODULE_ENABLED(RNG) + +#define NRF_LOG_MODULE_NAME "SDH" +#include "nrf_log.h" #if defined(ANT_STACK_SUPPORT_REQD) && defined(BLE_STACK_SUPPORT_REQD) #include "ant_interface.h" #elif defined(ANT_STACK_SUPPORT_REQD) #include "ant_interface.h" #elif defined(BLE_STACK_SUPPORT_REQD) - #include "nrf_ble.h" + #include "ble.h" #endif - -#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 -#define SD_HANDLER_LOG(...) NRF_LOG_PRINTF(__VA_ARGS__) -#else -#define SD_HANDLER_LOG(...) -#endif - -#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 -#define SD_HANDLER_LOG_INIT() NRF_LOG_INIT() -#else -#define SD_HANDLER_LOG_INIT() -#endif - - - #define RAM_START_ADDRESS 0x20000000 #define SOFTDEVICE_EVT_IRQ SD_EVT_IRQn /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ #define SOFTDEVICE_EVT_IRQHandler SD_EVT_IRQHandler -#define RAM_TOTAL_SIZE ((NRF_FICR->INFO.RAM)*1024) +#define RAM_TOTAL_SIZE ((NRF_FICR->INFO.RAM) * 1024) #define RAM_END_ADDRESS (RAM_START_ADDRESS + RAM_TOTAL_SIZE) @@ -91,13 +79,10 @@ #define SOFTDEVICE_CENTRAL_CONN_COUNT 4 #define SOFTDEVICE_CENTRAL_SEC_COUNT 1 -/* Global nvic state instance, required by nrf_nvic.h */ -nrf_nvic_state_t nrf_nvic_state; - static softdevice_evt_schedule_func_t m_evt_schedule_func; /**< Pointer to function for propagating SoftDevice events to the scheduler. */ static volatile bool m_softdevice_enabled = false; /**< Variable to indicate whether the SoftDevice is enabled. */ - +static volatile bool m_suspended; /**< Current state of the event handler. */ #ifdef BLE_STACK_SUPPORT_REQD // The following three definitions is needed only if BLE events are needed to be pulled from the stack. static uint8_t * mp_ble_evt_buffer; /**< Buffer for receiving BLE events from the SoftDevice. */ @@ -106,14 +91,13 @@ static ble_evt_handler_t m_ble_evt_handler; /**< App #endif #ifdef ANT_STACK_SUPPORT_REQD -// The following two definition is needed only if ANT events are needed to be pulled from the stack. +// The following two definitions are needed only if ANT events are needed to be pulled from the stack. static ant_evt_t m_ant_evt_buffer; /**< Buffer for receiving ANT events from the SoftDevice. */ static ant_evt_handler_t m_ant_evt_handler; /**< Application event handler for handling ANT events. */ #endif static sys_evt_handler_t m_sys_evt_handler; /**< Application event handler for handling System (SOC) events. */ - /**@brief Callback function for asserts in the SoftDevice. * * @details A pointer to this function will be passed to the SoftDevice. This function will be @@ -132,7 +116,6 @@ void softdevice_fault_handler(uint32_t id, uint32_t pc, uint32_t info) app_error_fault_handler(id, pc, info); } - void intern_softdevice_events_execute(void) { if (!m_softdevice_enabled) @@ -142,7 +125,7 @@ void intern_softdevice_events_execute(void) return; } -#if CLOCK_ENABLED +#if NRF_MODULE_ENABLED(CLOCK) bool no_more_soc_evts = false; #else bool no_more_soc_evts = (m_sys_evt_handler == NULL); @@ -160,6 +143,12 @@ void intern_softdevice_events_execute(void) if (!no_more_soc_evts) { + if (m_suspended) + { + // Cancel pulling next event if event handler was suspended by user. + return; + } + uint32_t evt_id; // Pull event from SOC. @@ -176,7 +165,7 @@ void intern_softdevice_events_execute(void) else { // Call application's SOC event handler. -#if CLOCK_ENABLED +#if (NRF_MODULE_ENABLED(CLOCK) && defined(SOFTDEVICE_PRESENT)) nrf_drv_clock_on_soc_event(evt_id); if (m_sys_evt_handler) { @@ -192,6 +181,12 @@ void intern_softdevice_events_execute(void) // Fetch BLE Events. if (!no_more_ble_evts) { + if (m_suspended) + { + // Cancel pulling next event if event handler was suspended by user. + return; + } + // Pull event from stack uint16_t evt_len = m_ble_evt_buffer_size; @@ -216,6 +211,12 @@ void intern_softdevice_events_execute(void) // Fetch ANT Events. if (!no_more_ant_evts) { + if (m_suspended) + { + // Cancel pulling next event if event handler was suspended by user. + return; + } + // Pull event from stack err_code = sd_ant_event_get(&m_ant_evt_buffer.channel, &m_ant_evt_buffer.event, @@ -266,20 +267,18 @@ void intern_softdevice_events_execute(void) } } -bool softdevice_handler_isEnabled(void) +bool softdevice_handler_is_enabled(void) { return m_softdevice_enabled; } -uint32_t softdevice_handler_init(nrf_clock_lf_cfg_t * p_clock_lf_cfg, +uint32_t softdevice_handler_init(nrf_clock_lf_cfg_t * p_clock_lf_cfg, void * p_ble_evt_buffer, uint16_t ble_evt_buffer_size, softdevice_evt_schedule_func_t evt_schedule_func) { uint32_t err_code; - SD_HANDLER_LOG_INIT(); - // Save configuration. #if defined (BLE_STACK_SUPPORT_REQD) // Check that buffer is not NULL. @@ -306,21 +305,54 @@ uint32_t softdevice_handler_init(nrf_clock_lf_cfg_t * p_clock_lf_cfg, m_evt_schedule_func = evt_schedule_func; // Initialize SoftDevice. +#if (NRF_MODULE_ENABLED(CLOCK) && defined(SOFTDEVICE_PRESENT)) + bool power_clock_isr_enabled = nrf_drv_common_irq_enable_check(POWER_CLOCK_IRQn); + if (power_clock_isr_enabled) + { + NVIC_DisableIRQ(POWER_CLOCK_IRQn); + } +#endif + +#if (NRF_MODULE_ENABLED(RNG) && defined(SOFTDEVICE_PRESENT)) + bool rng_isr_enabled = nrf_drv_common_irq_enable_check(RNG_IRQn); + if (rng_isr_enabled) + { + NVIC_DisableIRQ(RNG_IRQn); + } +#endif #if defined(S212) || defined(S332) err_code = sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler, ANT_LICENSE_KEY); #else err_code = sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler); #endif + if (err_code != NRF_SUCCESS) { +#if (NRF_MODULE_ENABLED(RNG) && defined(SOFTDEVICE_PRESENT)) + if (rng_isr_enabled) + { + NVIC_EnableIRQ(RNG_IRQn); + } +#endif +#if (NRF_MODULE_ENABLED(CLOCK) && defined(SOFTDEVICE_PRESENT)) + if (power_clock_isr_enabled) + { + NVIC_EnableIRQ(POWER_CLOCK_IRQn); + } +#endif return err_code; } m_softdevice_enabled = true; +#if (NRF_MODULE_ENABLED(CLOCK) && defined(SOFTDEVICE_PRESENT)) + nrf_drv_clock_on_sd_enable(); +#endif // Enable BLE event interrupt (interrupt priority has already been set by the stack). #ifdef SOFTDEVICE_PRESENT - return sd_nvic_EnableIRQ((IRQn_Type)SOFTDEVICE_EVT_IRQ); + err_code = sd_nvic_EnableIRQ((IRQn_Type)SOFTDEVICE_EVT_IRQ); + return err_code; + #else //In case of Serialization NVIC must be accessed directly. NVIC_EnableIRQ(SOFTDEVICE_EVT_IRQ); @@ -332,13 +364,21 @@ uint32_t softdevice_handler_init(nrf_clock_lf_cfg_t * p_clock_lf_cfg, uint32_t softdevice_handler_sd_disable(void) { uint32_t err_code = sd_softdevice_disable(); + if (err_code == NRF_SUCCESS) + { + m_softdevice_enabled = false; - m_softdevice_enabled = !(err_code == NRF_SUCCESS); +#if (NRF_MODULE_ENABLED(CLOCK) && defined(SOFTDEVICE_PRESENT)) + nrf_drv_clock_on_sd_disable(); +#endif +#if (NRF_MODULE_ENABLED(RNG) && defined(SOFTDEVICE_PRESENT)) + nrf_drv_rng_on_sd_disable(); +#endif + } return err_code; } - #ifdef BLE_STACK_SUPPORT_REQD uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler) { @@ -390,6 +430,45 @@ void SOFTDEVICE_EVT_IRQHandler(void) } } +void softdevice_handler_suspend() +{ +#ifdef SOFTDEVICE_PRESENT + ret_code_t err_code = sd_nvic_DisableIRQ((IRQn_Type)SOFTDEVICE_EVT_IRQ); + APP_ERROR_CHECK(err_code); +#else + NVIC_DisableIRQ(SOFTDEVICE_EVT_IRQ); +#endif + m_suspended = true; + return; +} + +void softdevice_handler_resume() +{ + if (!m_suspended) return; + m_suspended = false; + +#ifdef SOFTDEVICE_PRESENT + ret_code_t err_code; + + // Force calling ISR again to make sure that events not pulled previously + // has been processed. + err_code = sd_nvic_SetPendingIRQ((IRQn_Type)SOFTDEVICE_EVT_IRQ); + APP_ERROR_CHECK(err_code); + err_code = sd_nvic_EnableIRQ((IRQn_Type)SOFTDEVICE_EVT_IRQ); + APP_ERROR_CHECK(err_code); +#else + NVIC_SetPendingIRQ((IRQn_Type)SOFTDEVICE_EVT_IRQ); + NVIC_EnableIRQ(SOFTDEVICE_EVT_IRQ); +#endif + + return; +} + +bool softdevice_handler_is_suspended() +{ + return m_suspended; +} + #if defined(BLE_STACK_SUPPORT_REQD) uint32_t softdevice_enable_get_default_config(uint8_t central_links_count, uint8_t periph_links_count, @@ -410,19 +489,19 @@ uint32_t softdevice_enable_get_default_config(uint8_t central_links_count, } -#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 static inline uint32_t ram_total_size_get(void) { #ifdef NRF51 uint32_t size_ram_blocks = (uint32_t)NRF_FICR->SIZERAMBLOCKS; uint32_t total_ram_size = size_ram_blocks; - total_ram_size = total_ram_size*(NRF_FICR->NUMRAMBLOCK); + total_ram_size = total_ram_size * (NRF_FICR->NUMRAMBLOCK); return total_ram_size; -#elif defined (NRF52) +#elif (defined (NRF52) || defined(NRF52840_XXAA)) return RAM_TOTAL_SIZE; #endif /* NRF51 */ } + /*lint --e{528} -save suppress 528: symbol not referenced */ /**@brief Function for finding the end address of the RAM. * @@ -431,46 +510,15 @@ static inline uint32_t ram_total_size_get(void) static inline uint32_t ram_end_address_get(void) { uint32_t ram_end_address = (uint32_t)RAM_START_ADDRESS; - ram_end_address+= ram_total_size_get(); + ram_end_address += ram_total_size_get(); return ram_end_address; } /*lint -restore*/ -#endif //ENABLE_DEBUG_LOG_SUPPORT - -/*lint --e{10} --e{19} --e{27} --e{40} --e{529} -save suppress Error 27: Illegal character */ -uint32_t sd_check_ram_start(uint32_t sd_req_ram_start) -{ -#if (defined(S130) || defined(S132) || defined(S332)) -#if defined ( __CC_ARM ) - extern uint32_t Image$$RW_IRAM1$$Base; - const volatile uint32_t ram_start = (uint32_t) &Image$$RW_IRAM1$$Base; -#elif defined ( __ICCARM__ ) - extern uint32_t __ICFEDIT_region_RAM_start__; - volatile uint32_t ram_start = (uint32_t) &__ICFEDIT_region_RAM_start__; -#elif defined ( __GNUC__ ) - extern uint32_t __data_start__; - volatile uint32_t ram_start = (uint32_t) &__data_start__; -#endif//__CC_ARM - if (ram_start != sd_req_ram_start) - { -#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 - uint32_t app_ram_size= ram_end_address_get(); - SD_HANDLER_LOG("RAM START ADDR 0x%x should be adjusted to 0x%x\r\n", - ram_start, - sd_req_ram_start); - app_ram_size -= sd_req_ram_start; - SD_HANDLER_LOG("RAM SIZE should be adjusted to 0x%x \r\n", - app_ram_size); -#endif //NRF_LOG_USES_RTT - return NRF_SUCCESS; - } -#endif//defined(S130) || defined(S132) || defined(S332) - return NRF_SUCCESS; -} +/*lint --e{10} --e{27} --e{40} --e{529} -save */ uint32_t softdevice_enable(ble_enable_params_t * p_ble_enable_params) { -#if (defined(S130) || defined(S132) || defined(S332)) +#if (defined(S130) || defined(S132) || defined(S332) || defined(S140)) uint32_t err_code; uint32_t app_ram_base; @@ -486,31 +534,25 @@ uint32_t softdevice_enable(ble_enable_params_t * p_ble_enable_params) #endif app_ram_base = ram_start; - SD_HANDLER_LOG("sd_ble_enable: RAM START at 0x%x\r\n", + NRF_LOG_DEBUG("sd_ble_enable: RAM start at 0x%x\r\n", app_ram_base); err_code = sd_ble_enable(p_ble_enable_params, &app_ram_base); -#if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1 if (app_ram_base != ram_start) { - uint32_t app_ram_size= ram_end_address_get(); - SD_HANDLER_LOG("sd_ble_enable: app_ram_base should be adjusted to 0x%x\r\n", - app_ram_base); - app_ram_size -= app_ram_base; - SD_HANDLER_LOG("ram size should be adjusted to 0x%x \r\n", - app_ram_size); + NRF_LOG_WARNING("sd_ble_enable: RAM start should be adjusted to 0x%x\r\n", + app_ram_base); + NRF_LOG_WARNING("RAM size should be adjusted to 0x%x \r\n", + ram_end_address_get() - app_ram_base); } else if (err_code != NRF_SUCCESS) { - SD_HANDLER_LOG("sd_ble_enable: error 0x%x\r\n", err_code); - while(1); + NRF_LOG_ERROR("sd_ble_enable: error 0x%x\r\n", err_code); } -#endif // NRF_LOG_USES_RTT return err_code; #else return NRF_SUCCESS; -#endif //defined(S130) || defined(S132) || defined(S332) - +#endif //defined(S130) || defined(S132) || defined(S332) || defined(S140) } /*lint -restore*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h index 588ce1626a..1b8e4fca9b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h @@ -36,7 +36,6 @@ * */ - /** @file * * @defgroup softdevice_handler SoftDevice Event Handler @@ -67,22 +66,22 @@ #include "ble_stack_handler_types.h" #include "ant_stack_handler_types.h" #if defined(BLE_STACK_SUPPORT_REQD) - #include "nrf_ble.h" + #include "ble.h" #endif #include "app_ram_base.h" + +#ifdef __cplusplus +extern "C" { +#endif #define SOFTDEVICE_SCHED_EVT_SIZE 0 /**< Size of button events being passed through the scheduler (is to be used for computing the maximum size of scheduler events). For SoftDevice events, this size is 0, since the events are being pulled in the event handler. */ #define SYS_EVT_MSG_BUF_SIZE sizeof(uint32_t) /**< Size of System (SOC) event message buffer. */ +#if defined(BLE_GATT_MTU_SIZE_DEFAULT) && !defined(GATT_MTU_SIZE_DEFAULT) +#define GATT_MTU_SIZE_DEFAULT BLE_GATT_MTU_SIZE_DEFAULT +#endif -#define CHECK_RAM_START_ADDR_INTERN(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT) \ - do{ \ - uint32_t app_ram_start_addr = APP_RAM_BASE_CENTRAL_LINKS_##CENTRAL_LINK_COUNT##_PERIPH_LINKS_##PERIPHERAL_LINK_COUNT##_SEC_COUNT_0_MID_BW; \ - err_code = sd_check_ram_start(app_ram_start_addr); \ - APP_ERROR_CHECK(err_code); \ - } while (0) - -/** @brief Macro for checking the RAM requirement of the SoftDevice */ -#define CHECK_RAM_START_ADDR(C_LINK_CNT, P_LINK_CNT) CHECK_RAM_START_ADDR_INTERN(C_LINK_CNT, P_LINK_CNT) +/** @brief Macro for checking the RAM requirement of the SoftDevice. */ +#define CHECK_RAM_START_ADDR(C_LINK_CNT, P_LINK_CNT) /**@brief Function for checking the RAM requirement of the SoftDevice. @@ -135,7 +134,7 @@ typedef void (*sys_evt_handler_t) (uint32_t evt_id); * @retval false SD is not initialized and SD commands should not be called. * @retval true SD is already initialized */ -bool softdevice_handler_isEnabled(void); +bool softdevice_handler_is_enabled(void); /**@brief Function for initializing the stack handler module. * @@ -177,6 +176,24 @@ uint32_t softdevice_handler_init(nrf_clock_lf_cfg_t * p_clock_lf_cf */ uint32_t softdevice_handler_sd_disable(void); +/**@brief Function for suspending the event handler. + * + * @details When event handler is disabled, no new events are pulled from SoftDevice. + * Application can suspend pulling incoming events when its event queue is full. + */ +void softdevice_handler_suspend(void); + +/**@brief Function for re-enabling the event handler after suspending. + */ +void softdevice_handler_resume(void); + +/**@brief Function for retrieving the information about the event handler state + * + * @retval false Event handler is active. + * @retval true Event handler is suspended and events from SD will not be pulled. + */ +bool softdevice_handler_is_suspended(void); + /**@brief Function for registering for System (SOC) events. * @@ -235,6 +252,11 @@ void intern_softdevice_events_execute(void); /**@endcond */ + +#ifdef __cplusplus +} +#endif + #endif // SOFTDEVICE_HANDLER_H__ /** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.c index bb4c2f95d4..b0546e38ec 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.c @@ -36,7 +36,6 @@ * */ - #include "softdevice_handler_appsh.h" #include "app_scheduler.h" #include diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.h index dcde1c9b96..f6683bfa39 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler_appsh.h @@ -36,16 +36,24 @@ * */ - #ifndef SOFTDEVICE_HANDLER_APPSH_H #define SOFTDEVICE_HANDLER_APPSH_H #include "softdevice_handler.h" #include +#ifdef __cplusplus +extern "C" { +#endif + #define SOFTDEVICE_HANDLER_APPSH_INIT(CLOCK_SOURCE,USE_SCHEDULER) \ SOFTDEVICE_HANDLER_INIT(CLOCK_SOURCE,(USE_SCHEDULER) ? softdevice_evt_schedule : NULL) uint32_t softdevice_evt_schedule(void); + +#ifdef __cplusplus +} +#endif + #endif //SOFTDEVICE_HANDLER_APPSH_H From decf835475979ddcb864d95ae97ae9767971110c Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 14 Dec 2016 14:56:04 +0100 Subject: [PATCH 04/31] move s140 headers to headers directory add softdevices compiled inetl-hex files --- .../s132_nrf52_5.0.0-1.alpha_softdevice.hex | 8052 ++++++++++++++++ .../sdk/softdevice/s140/{ => headers}/ble.h | 0 .../softdevice/s140/{ => headers}/ble_err.h | 0 .../softdevice/s140/{ => headers}/ble_gap.h | 0 .../softdevice/s140/{ => headers}/ble_gatt.h | 0 .../softdevice/s140/{ => headers}/ble_gattc.h | 0 .../softdevice/s140/{ => headers}/ble_gatts.h | 0 .../softdevice/s140/{ => headers}/ble_hci.h | 0 .../softdevice/s140/{ => headers}/ble_l2cap.h | 0 .../s140/{ => headers}/ble_ranges.h | 0 .../softdevice/s140/{ => headers}/ble_types.h | 0 .../s140/{ => headers}/nrf52/nrf_mbr.h | 0 .../softdevice/s140/{ => headers}/nrf_error.h | 0 .../s140/{ => headers}/nrf_error_sdm.h | 0 .../s140/{ => headers}/nrf_error_soc.h | 0 .../softdevice/s140/{ => headers}/nrf_nvic.h | 0 .../s140/{ => headers}/nrf_sd_def.h | 0 .../softdevice/s140/{ => headers}/nrf_sdm.h | 0 .../softdevice/s140/{ => headers}/nrf_soc.h | 0 .../softdevice/s140/{ => headers}/nrf_svc.h | 0 ...s140_nrf52840_5.0.0-1.alpha_softdevice.hex | 8202 +++++++++++++++++ .../sdk/softdevice/s140/nrf_mbr.h | 219 - 22 files changed, 16254 insertions(+), 219 deletions(-) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_5.0.0-1.alpha_softdevice.hex rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_err.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_gap.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_gatt.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_gattc.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_gatts.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_hci.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_l2cap.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_ranges.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/ble_types.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf52/nrf_mbr.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf_error.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf_error_sdm.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf_error_soc.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf_nvic.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf_sd_def.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf_sdm.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf_soc.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/{ => headers}/nrf_svc.h (100%) create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/hex/s140_nrf52840_5.0.0-1.alpha_softdevice.hex delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_mbr.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_5.0.0-1.alpha_softdevice.hex b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_5.0.0-1.alpha_softdevice.hex new file mode 100644 index 0000000000..6890ab4de5 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_5.0.0-1.alpha_softdevice.hex @@ -0,0 +1,8052 @@ +:020000040000FA +:1000000000040020E508000079050000C508000094 +:10001000830500008D05000097050000000000002A +:1000200000000000000000000000000009090000BE +:10003000A105000000000000AB050000B5050000B0 +:10004000BF050000C9050000D3050000DD05000064 +:10005000E7050000F1050000FB05000005060000B3 +:100060000F06000019060000230600002D06000000 +:1000700037060000410600004B0600005506000050 +:100080005F06000069060000730600007D060000A0 +:1000900087060000910600009B060000A5060000F0 +:1000A000AF060000B9060000C3060000CD06000040 +:1000B000D7060000E1060000EB060000F506000090 +:1000C000FF06000009070000130700001D070000DD +:1000D00027070000310700003B070000450700002C +:1000E0004F07000059070000630700006D0700007C +:1000F00077070000810700008B07000095070000CC +:100100009F0700001FB500F003F88DE80F001FBD2A +:1001100000F0DEBB1FB56FF00100009040100390AF +:10012000029001904FF010208069000B420900F00E +:100130001F045DF822300120A04083434DF8223097 +:10014000684600F044F91FBDF0B54FF6FF734FF459 +:10015000B4751A466E1E11E0A94201D3344600E080 +:100160000C46091B30F8027B641E3B441A44F9D14B +:100170009CB204EB134394B204EB12420029EBD17E +:1001800098B200EB134002EB124140EA0140F0BD8F +:10019000DD4992B00446D1E90001CDE91001FF220A +:1001A0004021684600F03AFB94E80F008DE80F000C +:1001B000684610A902E004C841F8042D8842FAD12B +:1001C00010216846FFF7C0FF1090AA208DF8440068 +:1001D000FFF7A0FF00F0F2F84FF01024A069102202 +:1001E0006946803000F001F9A069082210A900F0EA +:1001F000FCF800F0D7F84FF080510A6949690068AF +:100200004A43824201D8102070470020704710B541 +:10021000D0E900214FF0805002EB8103026944696C +:100220006243934209D84FF01022536903EB8103D4 +:100230000169406941438B4201D9092010BD5069D1 +:10024000401C01D0002010BD0F2010BD70B501680A +:100250000446AE4D4FF01020062951D2DFE801F0E0 +:10026000320318283B1DD4E90265646829463046EC +:1002700000F0CDF82A462146304600F0B6F8AA0034 +:100280002146304600F09EFA002800D0032070BDC1 +:1002900000F050FB4FF4805007E0201DFFF7ABFF4C +:1002A0000028F4D100F046FB60682860002070BD93 +:1002B000241D94E80700920000F084FA0028F6D08C +:1002C0000E2070BD8069401C12D0201DFFF79FFFDB +:1002D0000028F6D109E08069401C09D0201DFFF7F5 +:1002E0008AFF0028EDD1606820B12046FFF750FF5B +:1002F000042070BDFFF70EFF00F060F800F052F828 +:10030000072070BD10B50C46182802D001200860E7 +:1003100010BD2068FFF79AFF206010BD4FF0102439 +:10032000A069401C05D0A569A66980353079AA2846 +:1003300008D06069401C2DD060690068401C29D03D +:1003400060692CE010212846FFF7FEFE31688142EB +:100350001CD1A16901F18002C03105E030B108CAA9 +:1003600051F8040D984201D1012000E000208A429A +:10037000F4D158B1286810B1042803D0FEE728460C +:1003800000F057F861496868086008E000F016F866 +:1003900000F008F84FF480500168491C01D000F0CB +:1003A000A3FAFEE7BFF34F8F59480168594A01F499 +:1003B000E06111430160BFF34F8FFEE74FF0102063 +:1003C0008169491C02D0806900F0ADB87047524A7B +:1003D00001681160121D416811604F4A8168103236 +:1003E0001160111DC068086070472DE9F041174683 +:1003F0000D460646002406E03046296800F0A6F8BF +:10040000641C2D1D361DBC42F6D3BDE8F08170B5CD +:100410000C4605464FF4806608E0284600F083F855 +:10042000B44205D3A4F5806405F58055002CF4D1C1 +:1004300070BD4168044609B1012500E000254FF078 +:1004400010267069A268920000F0BCF9C8B120467D +:1004500000F01AF89DB17669A56864684FF4002031 +:1004600084420AD2854208D229463046FFF7CFFFA0 +:100470002A4621463046FFF7B8FFFFF79FFFFFF7F8 +:1004800091FFFFF747FEF8E72DE9FF414FF01024F9 +:10049000616980680D0B01EB800000F6FF70010BB5 +:1004A00000200090019002900246039068460123CC +:1004B0000BE0560902F01F0C50F8267003FA0CFCF2 +:1004C00047EA0C0740F82670521CAA42F1D30AE012 +:1004D0004A0901F01F0650F8225003FA06F6354388 +:1004E00040F82250491C8029F2D3A169090B4A091E +:1004F00001F01F0150F822408B409C4340F82240FD +:10050000FFF765FFBDE8FF815809000000000020EB +:100510000CED00E00400FA050006004014480168F4 +:100520000029FCD07047134A0221116010490B6862 +:10053000002BFCD00F4B1B1D186008680028FCD056 +:100540000020106008680028FCD07047094B10B5E7 +:1005500001221A60064A1468002CFCD00160106861 +:100560000028FCD00020186010680028FCD010BDC6 +:1005700000E4014004E5014008208F49096809585A +:10058000084710208C4909680958084714208A49EF +:100590000968095808471820874909680958084711 +:1005A0003020854909680958084738208249096878 +:1005B000095808473C2080490968095808474020E5 +:1005C0007D4909680958084744207B49096809584A +:1005D0000847482078490968095808474C20764957 +:1005E000096809580847502073490968095808479D +:1005F0005420714909680958084758206E4909680C +:10060000095808475C206C49096809580847602068 +:100610006949096809580847642067490968095801 +:100620000847682064490968095808476C206249EE +:1006300009680958084770205F4909680958084740 +:1006400074205D4909680958084778205A490968A3 +:10065000095808477C2058490968095808478020EC +:1006600055490968095808478420534909680958B9 +:100670000847882050490968095808478C204E4986 +:1006800009680958084790204B49096809580847E4 +:10069000942049490968095808479820464909683B +:1006A000095808479C204449096809580847A02070 +:1006B0004149096809580847A4203F490968095871 +:1006C0000847A8203C49096809580847AC203A491E +:1006D000096809580847B020374909680958084788 +:1006E000B4203549096809580847B82032490968D3 +:1006F00009580847BC203049096809580847C020F4 +:100700002D49096809580847C4202B490968095828 +:100710000847C8202849096809580847CC202649B5 +:10072000096809580847D02023490968095808472B +:10073000D4202149096809580847D8201E4909686A +:1007400009580847DC201C49096809580847E02077 +:100750001949096809580847E420174909680958E0 +:100760000847E8201449096809580847EC2012494D +:10077000096809580847F0200F49096809580847CF +:10078000F4200D49096809580847F8200A49096802 +:1007900009580847FC2008490968095808475FF4C8 +:1007A0008070054909680958084700000348044952 +:1007B000024A034B70470000000000206809000057 +:1007C0006809000040EA010310B59B070FD1042A15 +:1007D0000DD310C808C9121F9C42F8D020BA19BA0C +:1007E000884201D9012010BD4FF0FF3010BD1AB171 +:1007F000D30703D0521C07E0002010BD10F8013BC6 +:1008000011F8014B1B1B07D110F8013B11F8014BEC +:100810001B1B01D1921EF1D1184610BD02F0FF033F +:1008200043EA032242EA024200F005B870477047EB +:1008300070474FF000020429C0F0128010F0030C42 +:1008400000F01B80CCF1040CBCF1020F18BF00F8C3 +:10085000012BA8BF20F8022BA1EB0C0100F00DB872 +:100860005FEAC17C24BF00F8012B00F8012B48BFD0 +:1008700000F8012B70474FF0000200B51346944674 +:100880009646203922BFA0E80C50A0E80C50B1F1E8 +:100890002001BFF4F7AF090728BFA0E80C5048BFFC +:1008A0000CC05DF804EB890028BF40F8042B08BF9A +:1008B000704748BF20F8022B11F0804F18BF00F896 +:1008C000012B7047014B1B68DB68184700000020B4 +:1008D00009480A497047FFF7FBFFFFF713FC00BD0B +:1008E00020BFFDE7064B1847064A1060016881F3F8 +:1008F0000888406800470000680900006809000097 +:100900001D030000000000201EF0040F0CBFEFF3D9 +:100910000881EFF30981886902380078182803D12B +:1009200000E00000074A1047074A12682C3212689C +:100930001047000000B5054B1B68054A9B589847B7 +:1009400000BD000005030000000000205409000065 +:1009500004000000001000000000000000FFFFFF86 +:040960000090D00330 +:101000004812002001F701007D9F00006FF60100EB +:101010007D9F00007D9F00007D9F0000000000007C +:1010200000000000000000000000000059F701006F +:101030007D9F0000000000007D9F00007D9F00005C +:10104000C1F70100C7F701007D9F00007D9F0000F0 +:101050007D9F00007D9F00007D9F00007D9F000020 +:10106000CDF701007D9F00007D9F0000D3F70100B8 +:101070007D9F0000D9F70100DFF70100E5F70100CF +:101080007D9F00007D9F00007D9F00007D9F0000F0 +:101090007D9F00007D9F00007D9F00007D9F0000E0 +:1010A000EBF70100F1F701007D9F00007D9F00003C +:1010B0007D9F00007D9F00007D9F00007D9F0000C0 +:1010C000F7F701007D9F00007D9F00007D9F0000DD +:1010D0007D9F00007D9F00007D9F00007D9F0000A0 +:1010E0007D9F00007D9F00007D9F00007D9F000090 +:1010F0007D9F00007D9F00007D9F00007D9F000080 +:101100007D9F00007D9F000000F002F81EF0E5FAD0 +:101110000AA090E8000C82448344AAF10107DA4552 +:1011200001D11EF0DAFAAFF2090EBAE80F0013F09F +:10113000010F18BFFB1A43F00103184718EC010018 +:1011400038EC01000A4410F8014B14F00F0508BFF9 +:1011500010F8015B240908BF10F8014B6D1E05D083 +:1011600010F8013B6D1E01F8013BF9D1641E03D05C +:10117000641E01F8015BFBD19142E4D3704700008B +:101180000023002400250026103A28BF78C1FBD890 +:10119000520728BF30C148BF0B6070471FB500F031 +:1011A0003DF88DE80F001FBD1EF0040F0CBFEFF3DC +:1011B0000880EFF30980014A10470000CF9D00002E +:1011C0008269034981614FF00100104470470000BB +:1011D000D511000001B41EB400B511F057F801B4E8 +:1011E0000198864601BC01B01EBD0000F0B4404627 +:1011F000494652465B460FB402A0013001B506488D +:10120000004700BF01BC86460FBC80468946924617 +:101210009B46F0BC70470000091100001EF05ABA4E +:1012200070B51C4C054608202070A01C00F065F825 +:101230005920A08029462046BDE8704006F092BFA4 +:1012400010B506F09AFF13490020891E087010BDE2 +:1012500070B50C460F49891E097829B1A0F16001CB +:10126000532906D3012011E0602802D043F2010087 +:101270000CE020CC084E94E80E0006EB8000A0F5B0 +:101280008050241FD0F8806E2846B047206070BD83 +:10129000012070470A00002050F8010010B50446F4 +:1012A0000021012000F03FF80021182000F03BF859 +:1012B00000210B2000F037F80421192000F033F84A +:1012C00004210D2000F02FF804210E2000F02BF84F +:1012D00004210F2000F027F80421C84300F023F870 +:1012E0000721162000F01FF80721152000F01BF839 +:1012F0002046FFF795FF002010BD90210180704728 +:10130000FFF79EBF10487047104A10B514680F4B86 +:101310000F4A08331A60FFF79BFF0C48001D04605A +:1013200010BD704770474907090E002806DA00F023 +:101330000F0000F1E02080F8141D704700F1E0205C +:1013400080F800147047000003F9004310050240C4 +:101350000100000130B5F74D044610280AD0112CC9 +:1013600006D02846122C817806D0132C08D0FFDF37 +:10137000AC7030BDFFDFFBE71129F9D0FFDFF7E7E5 +:101380001129F5D0FFDFF3E770B50FF06CF90446D3 +:1013900010F044FD201AC4B206200DF047FB0546AC +:1013A00006200DF04BFB2E1A07200DF03FFB0546E3 +:1013B00007200DF043FBDF49281A321888781228DD +:1013C0000DD000231A4413280BD0002002440878C3 +:1013D000022808D000201044201AC0B270BD01239A +:1013E000F0E70120F2E70120F5E7D24800B50079E7 +:1013F000D049420897B051F8050F89880CD01722C0 +:101400008DF80020CDF80200ADF806100BA9684653 +:101410000AF0F8FE17B000BD4322F1E702210DF0FB +:101420005ABB2DE9F04196B01D4690460E46074640 +:10143000FFF7F4FF04000BD02078222804D3A07F0C +:10144000C0F34010A84206D1082016B0BDE8F081D4 +:1014500043F20200F9E748208DF80000ADF8027071 +:101460003DB101208DF804008DF805608DF80680EF +:1014700002E000208DF804000BA968460AF0C2FEC5 +:10148000A07F65F34510A0770020DEE730B5044665 +:10149000A1F120000D460A284AD2DFE800F0050736 +:1014A0000C1C2328353A3F44FFDF42E020782028F7 +:1014B0003FD1FFDF3DE09F480178032939D0807894 +:1014C000132836D02078242833D0252831D023285B +:1014D0002FD0FFDF2DE0207822282AD0232828D8FB +:1014E000FFDF26E02078222823D0FFDF21E02078CC +:1014F00022281ED024281CD026281AD0272818D00D +:10150000292816D0FFDF14E02078252811D0FFDF2E +:101510000FE0207825280CD0FFDF0AE0207825286E +:1015200007D0FFDF05E02078282802D0FFDF00E0A9 +:10153000FFDF257030BD30B50B8840F67B444FF699 +:10154000FF72022801D0934204D09D1FA54224D2ED +:10155000022802D04D88954203D04D88AD1FA54288 +:101560001BD24C88A34218D88B88B3F5FA7F14D2CB +:10157000022802D0C888904205D0C88840F6774536 +:101580000A38A84209D2C888904208D0944206D0AE +:101590005B1C6343B3EB800F01DB072030BD0020F1 +:1015A00030BD70B514460D46064611F0DDF860B941 +:1015B0000DB1A54201D90C2070BD002409E000BF87 +:1015C00056F8240011F0D0F808B1102070BD641C4A +:1015D000E4B2AC42F4D3002070BDF0B50024059D08 +:1015E00010B1A94203D851E009B90020F0BD09208B +:1015F000F0BD055D8DB107197E78112E3FD00FDC4F +:101600000A2E3CD2DFE806F03B1624242A2A2C2C92 +:101610003333025D72BB641CE4B28C42F9D3E4E75D +:101620001D2E2CDAA6F11206042E28D2DFE806F0D1 +:1016300027271018022DDAD1BD781D70072D01D291 +:101640006D0701D40A20F0BD157845F0010515E0BD +:10165000EE43F60707E0012D07D010E00620F0BDAD +:101660002E07A6F18056002EF5D06046F0BD157805 +:10167000AE0701D50B20F0BD45F002051570055DE4 +:10168000641C2C44E4B28C4202D9B0E74FF4485CAD +:101690008C42AED3A9E710B50278540809D00122D4 +:1016A00043F20223012C07D0022C0DD0032C13D1BE +:1016B0000FE00020087005E080790324B4EB901F50 +:1016C0000AD10A70002010BD8079B2EB901F03D1BF +:1016D000F7E780798009F4D0184610BD154A917B50 +:1016E00039B1D17B022908D0032908D043F2022066 +:1016F00070470146101D01F0BFBB032100E001212E +:1017000001700020704738B50C460546694601F067 +:10171000B3FB00280DD19DF80010207861F347003D +:10172000207055F8010FC4F80100A888A4F805003E +:10173000002038BDB401002038B51378C0B10228AC +:1017400016D0FAA46D46246800944C7905EB9414E5 +:10175000247864F34703137003280ED003F0FE00CF +:1017600010700868C2F801008888A2F8050038BD2A +:1017700023F0FE0313700228EED1D8B240F001002E +:10178000EEE730B50C46097897B0222902D208203E +:1017900017B030BD28218DF80010ADF80200132AD3 +:1017A00003D03B2A01D00720F2E78DF804200BA9D3 +:1017B00068460AF027FD050003D121212046FFF7E6 +:1017C00065FE2846E4E700B597B023218DF80010A8 +:1017D000ADF802001088ADF804005088ADF806009E +:1017E000D088ADF80A009088ADF808000020ADF868 +:1017F0000C00ADF80E000BA968460AF003FD09E6DF +:101800002DE9FF470220CA4E8DF804000027708A98 +:10181000ADF80600B84643F202094DE001A80DF00C +:10182000C4F8050006D0708AA8B3A6F81280ADF8F7 +:1018300006803FE0039CA07F01072DD504F1240022 +:101840000090A28EBDF80800214604F1360301F095 +:10185000A2FF050005D04D452BD0112D3DD0FFDF57 +:101860003BE0A07F20F00800A077E07F810861F3D3 +:101870000000C10861F34100E07794F8210000F016 +:101880001F0084F820002078282827D1292120460D +:10189000FFF7FCFD22E015E040070BD5BDF808007E +:1018A000214604F10E02FFF78EFF05000DD04D45D5 +:1018B00010D100257F1CFFB202200DF0B7F8401CAC +:1018C000B842ABD8052D12D008E0A07F20F004006C +:1018D000A07703E0112D00D0FFDF0025BDF8060042 +:1018E0007082052D05D0284604B0BDE8F087A6F823 +:1018F00012800020F8E72DE9F047040000D1FFDF57 +:1019000020788B4E20F00F00801C20F0F00070300B +:10191000207060680178091F1529E6D2DFE801F020 +:10192000580B0C5CF80C0DF8F835580C0C587F5817 +:10193000580C0C585800FFDFD7E785882846FFF77A +:101940006DFD040000D1FFDF06F0BEFC707C21219C +:1019500040F0040070742046FFF798FD284607F019 +:10196000A1F9284603F05AFF284604F0B3FF2946A0 +:10197000022010F0B6FEA07F20F01000A077FFF745 +:101980003FFF0028B1D0FFDFAFE786883046FFF782 +:1019900045FD00B9FFDF60688078012800D0FFDFD7 +:1019A00060688179304607F0D9FB05009DD006F0CC +:1019B00088FC040000D1FFDF207820F00F00801C9D +:1019C00020F0F000203020706680062020726572C2 +:1019D000BDE8F04706F078BC86883046FFF71EFD6C +:1019E000050000D1FFDF06F06FFC60683146C0885B +:1019F000288160680089688160684089A881022028 +:101A000010F06FFE0020A875A87F00F003000228E8 +:101A100092D1FFF7F5FE00288ED0FFDF65E78078D2 +:101A20003C2803D0002502280AD000E00125002729 +:101A300020B13C2802D0022800D0FFDF17B1A0E07F +:101A40000127F5E706F040FC707C002D40F008000F +:101A500070746AD165680221B5F80480AD1C4746F0 +:101A600038460DF02FF80446032138460DF02AF8C9 +:101A70008246052138460DF025F881460421384676 +:101A80000DF020F8074604B9FFDFBAF1000F00D1CE +:101A9000FFDFB9F1000F00D1FFDF07B9FFDF22211F +:101AA0002046FFF7F3FC2879012832D00227A07FD7 +:101AB000062167F30100A077288B2081688B608165 +:101AC000A88BA08105F1120001F00DFA18B3687916 +:101AD000800700D5FFDF6979E07D61F34700E0759D +:101AE000D5F80600A0616889A083062105F10C00E5 +:101AF00001F0F9F9F0B130794108607861F34700FD +:101B00006070D6F80500C4F80200B6F809001AE0C3 +:101B100044E00127CBE7E07D20F0FE00801CE0756B +:101B2000D5F81200A061E88ADEE71DE00302FF019C +:101B3000B4010020607820F0FE00801C6070E8682E +:101B4000C4F80200288AE080F948007884F822006E +:101B5000A07F00F00301404607F096F8012F03D064 +:101B6000022F0ED0FFDFC0E63078032800D0FFDF61 +:101B70000021084610F0B5FDBDE8F047012001F056 +:101B800055B9B078132800D0FFDF0021072010F0EE +:101B9000A8FDBDE8F0471120FFF7DCBB2046BDE8FB +:101BA000F04702F0BBB82DE9F047054600780C4637 +:101BB00000270109DFF87CA391463E46012974D035 +:101BC00000234FF6FF70022970D0072909D00A2997 +:101BD0006DD0FFDFA9F800600CB12780668000207F +:101BE00083E6D5F804C004F108029CF8001012291D +:101BF00067D00EDC04F118080A2913D004DC04298C +:101C00007ED007297DD13FE00E2951D01129F9D18D +:101C1000BAE0132976D0142975D017293CD0182999 +:101C2000F0D1D4E011270926002C76D0BCF804802E +:101C3000A4F804806868807920729AF811104046F0 +:101C400021F004018AF8111004210CF056FF05213F +:101C500040460CF052FF002140460CF04EFF01219F +:101C600040460CF04AFF032140460CF046FF02219B +:101C700040460CF042FF062140460CF03EFF072193 +:101C800040460CF03AFFA5E712271026BCF80400E6 +:101C9000214601F009F99DE71C270926A4B3BCF8E9 +:101CA0000200A0806868007934E1D8E003E1D0E068 +:101CB0001B27092644B30420207268684088A0804E +:101CC00088E79CF802003C282AD0102718260CF13F +:101CD000020CCCB1BCF80200A080BCF818006082F5 +:101CE000BCF818002082BCF81A00A082BCF81C00C6 +:101CF000E0829CF805000CF10601FFF71DFD04E0F1 +:101D000018E0A5E090E072E007E09CF8040010B154 +:101D10000120E07309E00220FBE7A9F800605EE71C +:101D20001B270926002CF8D023729AF8111021F0F5 +:101D30000801D4E01D273726002CEED0A08069686A +:101D40000879491DFFF7F8FC686890F82B00A0752A +:101D50006868C0780428E07D13D020F00100E075A9 +:101D600069681F22C97861F34200E0756968C97A21 +:101D700061F3C700E075696840460C311DF0B2FBA5 +:101D800028E740F00100EAE71D273726002CC4D0E1 +:101D9000A0806968481D0B7901461846FFF7CCFC06 +:101DA000696804F10F02C87A0C31FFF7C5FC686856 +:101DB000807CA0756868C178E07D61F3420020F006 +:101DC000F900E0751F2140461DF025FC02E72027A1 +:101DD0001026002CA1D0A080686804F10902407A86 +:101DE00020726868C11C8078FFF7A6FCF2E6212704 +:101DF0000B26002C91D0BCF80400A0806868807885 +:101E0000207268688079012803D0022801D0FFDFA2 +:101E1000002060726868C079012803D0022801D0D0 +:101E2000FFDF0020A072D5E604271026002C84D006 +:101E3000BCF80200A0806868808820816868C0883B +:101E4000608168680089A08168684089E081C1E696 +:101E50004A4621462846BDE8F04702F0D4B8287A21 +:101E6000012803D0022814D0FFDFB3E61F27102675 +:101E7000002C8CD06888A08068892081A889608126 +:101E8000E889A081288AE0819AF8111021F02001C8 +:101E900025E0122710266888214601F005F8002C5D +:101EA00098D0687800F0070005288FD19AF81110B3 +:101EB00021F0020113E0297A07292DD2DFE801F091 +:101EC0000512120404042300C2E71B270926002C74 +:101ED00090D0A08023729AF8111021F001018AF8A5 +:101EE000111077E61B270926002CA0D0A080287AA5 +:101EF000012806D0032020729AF8111021F0100159 +:101F0000EDE70220F7E701270926002C8FD068882B +:101F1000A080687A20725DE6FFDF5BE610B50548B9 +:101F200096B08078132807D0082016B010BD0000A6 +:101F300010000020B401002022208DF800000BA921 +:101F400068460AF05FF904460021072010F0C9FB3B +:101F50002046EAE700B5FF4897B08078122801D004 +:101F600008204CE41E208DF8000000208DF80200AF +:101F70008DF803000BA968460AF044F90028F0D157 +:101F80000021072010F0ADFB1120FFF7E3F900203E +:101F900035E400B5EF4897B00078012814D01B2035 +:101FA0008DF8000000208DF802000BA968460AF0A9 +:101FB00029F9002807D10021084610F092FB0120E2 +:101FC00000F034FF00201AE4082018E42DE9F04165 +:101FD000E04C002740B102281DD0072842D0082835 +:101FE00000D0FFDFBDE8F081FFF7D3FF0028F9D173 +:101FF00006F067F90028F5D0017821F00F01891C5F +:1020000021F0F00120310170077206F05DF9607C6B +:1020100040F001001DE08EB23046FFF7FFF90500E9 +:1020200000D1FFDF28782128DCD006F04AF990B1F2 +:10203000017821F00F01891C21F0F00110310170AD +:10204000022101724680AF7506F03EF9607C40F0D7 +:1020500002006074C6E729463046BDE8F04113220D +:10206000FFF78FBBA578122D03D0132D04D0FFDF0F +:10207000B8E7FFF76FFF01E0FFF750FF0028B1D18D +:1020800006F01FF90028ADD0017821F00F01891C5E +:1020900021F0F00120310170122D07D002210172D0 +:1020A00006F012F9607C40F01000D2E70121F6E75B +:1020B0002DE9F04116460C00074600D1FFDF3078CD +:1020C00020F00F00801C20F0F000103030702078DD +:1020D000012803D0022817D0FFDF83E73846FFF737 +:1020E0009DF9050000D1FFDF0220A87506F0ECF88D +:1020F0002068B0606068F060208930829548417C3B +:1021000041F0200141746DE73846FFF787F905007B +:1021100000D1FFDF61884FF6FF70814209D1A288AC +:10212000824206D129463846BDE8F0411322FFF726 +:1021300028BB814201D1A08848B106F0C5F82068CB +:10214000B0606068F06020893082002006E078236B +:1021500000223946022010F027FA0120A87541E735 +:1021600030B5054697B00C46084610F0FDFA80BB26 +:1021700000200121203D082D6CD2DFE805F0042667 +:102180004145505765730021082010F083FA10B1C3 +:10219000112017B030BD24208DF80000D4F80200C3 +:1021A000CDF80200A0798DF806000BA968460AF068 +:1021B00029F8050054D1082300221146184610F0D2 +:1021C000F3F908284CD0FFDF4AE0606810F00EFBFE +:1021D00008B11020DDE74B208DF800002088ADF815 +:1021E00002006088ADF804000BA968460AF00AF8FE +:1021F000050035D1606870B3BDF8301001802FE064 +:10220000206802F0A1F908E04C2209E08DF80210E4 +:1022100015E000BF8DF8020011E0054620E04522E0 +:102220008DF800202278D207F4D0EFE738208DF81F +:1022300000002088ADF802006088ADF804000BA90A +:10224000684609F0DFFFE8E7207828B1A0F11B011C +:10225000E12902D3072503E01B203F490025087030 +:10226000284696E72078800802D16078800801D05F +:1022700007208EE73F208DF8000020788DF80300BE +:1022800060788DF80400207830B100208DF80200CD +:10229000617819B1002102E00120F7E7022108432B +:1022A000B8E730B5054697B00C46084610F080FAFE +:1022B00008B110206DE7202D07D0212D25D0222D2B +:1022C00023D0232D21D0072063E72088FFF7A6F82D +:1022D00020B10078222804D208205AE743F20200F5 +:1022E00057E725208DF800002088ADF802000BA9E3 +:1022F000684609F087FF0028DCD1DDF83210C4F809 +:1023000002109DF83610A17143E7062041E71148FD +:10231000001D70470F49087470470E48007C00F09C +:102320000100704738B514210A481DF052F9012008 +:1023300000F07CFD1120FFF70DF80749FB20054C4C +:102340000870611D684605F01CFF9DF8001020799B +:1023500004E00000B40100201000002061F34700F9 +:1023600020F0010020710020A0734FF46170A08163 +:102370000220E073FFF739F800B1FFDF00F04CFEF8 +:1023800001F087FC38BD10B50C463E2120461DF0FB +:1023900020F9A07F20F00300A077202020700020EB +:1023A000A07584F82300C1E570477CB5054610F0A0 +:1023B000DBF908B110207CBDFE4C211D6068009047 +:1023C000A06801902846FFF79EF90028F3D1FFF797 +:1023D0000CF80028EFD000996160BDF8041021814D +:1023E0009DF80610A1727CBD10B5044610F0E0F90E +:1023F00008B110209AE5EF4922460879491D4008A6 +:10240000FFF79AF9002091E52DE9F0479CB00D46C1 +:1024100004004FF0000812D00822FFF7C2F800288D +:102420001CD1002609E000BF54F8260004A9FFF7DC +:1024300032F9002812D1761CF6B2AE42F4D32F4600 +:102440000A2006AD0DF1440A8DF8180026465146C3 +:10245000284609F0D7FE20B143F203201CB0BDE8A6 +:10246000F0874046DFF84C8388F803002EB3002441 +:102470004FF00B091DE000BF56F8240005A9FFF737 +:102480000AF900B1FFDF9DF81400A87056F8240087 +:1024900050F8011FC5F803108088A5F8070085F8DB +:1024A00000905146284609F0ADFE00B1FFDF641CE4 +:1024B000E4B2BC42E0D388F803700020CEE72DE9F7 +:1024C000F0479EB01546894604001ED00F460822EC +:1024D0002946FFF766F8002811D1002613E000BF57 +:1024E00054F8260005A9103000F0C6FC002806D1DB +:1024F0003FB157F8260010F037F910B110201EB088 +:10250000ADE7761CF6B2AE42EAD30026A5F101088B +:102510001CE000BF06F1010A0AF0FF0712E000BF4D +:1025200054F82600017C4A0854F827100B7CB2EBC3 +:10253000530F05D10622113011311CF0A7FFC0B195 +:102540007F1CFFB2AF42EBD30AF0FF064645E1DB4A +:10255000C8462F46342007AD0DF148098DF81C0000 +:1025600026464946284609F04DFE28B143F204208C +:10257000C5E743F20520C2E796B300242CE000BF74 +:1025800056F82400A91C103000F076FC00B1FFDFE3 +:1025900056F82400102250F8111FC5F80310808847 +:1025A000A5F8070056F8241005F109001CF09AFF61 +:1025B000B8F1000F15D058F82410102205F11900B9 +:1025C0001CF090FF322028704946284609F01AFE78 +:1025D00000B1FFDF641CE4B2BC42D1D3012206E0AB +:1025E00004E005F1190001F0A3FFEBE700224946E2 +:1025F000284600F06CFC002081E770B596B00446D8 +:1026000010F0B2F818B9606810F0F9F810B11020A5 +:1026100016B070BD60884AF2B811884205D820789B +:10262000644D6E4618B1012804D00720F0E7FEF78C +:10263000DCFE1AE06078022804D0032802D043F2BE +:102640000220E5E7E87317208DF80000E97B002001 +:10265000CDF80200ADF80600022932D003292DD0B2 +:10266000FFDF0BA9684609F0CDFD0028D0D16068D6 +:1026700001F051FF207870B101208DF80200F01CAC +:1026800001F056FF4E208DF800000BA9684609F0B6 +:10269000B9FD00B1FFDF6088A8B1A88180B2ADF8B4 +:1026A000020030208DF800000BA9684609F0AAFD51 +:1026B00000B1FFDF2078A8730020A9E78DF807009C +:1026C000CFE74020FAE74FF46170E6E710B5044623 +:1026D00010F06EF820B9606838B110F087F808B1D2 +:1026E000102023E4606801F023FF32488189618073 +:1026F000C17B6170807B2070002017E42DE9F041E0 +:102700009CB0054600208DF864008DF860008DF8BF +:1027100030008DF868001E4614468846284610F0A2 +:102720006EF818B9204610F06AF810B110201CB0ED +:1027300058E455EA040018D01F270CAB19AA4146EB +:1027400028460097FEF749FF0028F0D11AAB18AAD7 +:10275000314620460097FEF740FF0028E7D19DF85C +:102760006000C00703D00A20E1E70720DFE701AFE0 +:102770007DB11A208DF804008DF806804246294666 +:10278000F81C1CF0AFFE0DA901A809F03BFD0028C4 +:10279000CDD194B120208DF804008DF8066032462A +:1027A0002146F81C1CF09EFE0DA901A809F02AFD87 +:1027B000002801E0B4010020B9D1FF499DF83000A4 +:1027C00048700020B3E72DE9F0439BB04FF00008BC +:1027D000FAA104468DF83480D1E90001CDE9190150 +:1027E00020460FF0C1FF90B92078012803D160681E +:1027F0000FF0BAFF58B9F04D4FF00109A87B50B166 +:10280000E87B022807D160680FF0F9FF18B11020AB +:102810001BB0BDE8F0832878012801D00820F7E735 +:1028200007200CF00BF918B9207848B1012807D01F +:10283000FEF7AAFD30B1687C10F00C0F08D103E060 +:102840001220E5E71320E3E7C10701D1800701D596 +:102850001120DDE7608943F6E172A0F12001914289 +:10286000217807D301297CD100287AD1A1890029B8 +:1028700077D10FE0022901D0032901D1A02870D31C +:10288000012907D06978C90704D0A189002968D037 +:10289000B42966D8217831B1012908D0022904D0A1 +:1028A00003295ED10AE0002609E0022607E008B904 +:1028B000A08908B1042609E0012607E00326A87BC9 +:1028C00050B1E87B022807D1606828B10DA9606883 +:1028D000FEF7E1FE00289BD1207A30B1012806D016 +:1028E000022806D003286DD105E0002704E0012767 +:1028F00002E0022700E003270EB1022E0ED16FB1D5 +:10290000E87870B36878800702D043F201207FE74F +:10291000022E03D1022F55D0032F53D018208DF84B +:1029200038006089ADF83A006089ADF83C008DF858 +:102930003E600DF13F00FEF7D1FE00B1FFDF9DF8D4 +:1029400034008DF840002078012806D0A87B68B1BB +:10295000E87B02280AD1606840B1606850F8011F26 +:1029600000E02FE0CDF84110808802E04046CDF82D +:102970004180ADF845008DF84870A07BC0F340025F +:10298000014662F35F01C0F3800041EA800019A9AB +:10299000085C8DF84700A8B169460EA809F032FC22 +:1029A0000028B4D11B208DF838008DF83A90694684 +:1029B0000EA809F027FC0028A9D19DF801001B28CA +:1029C00019D101E0072023E7052E09D2DFE806F040 +:1029D000030305050300032000E0022000F026FAAF +:1029E000012E0AD0A08940B1002283001146104672 +:1029F0000FF0DAFD08B103200AE7002008E72DE90F +:102A0000FC4107460D46032608460FF0F8FE002855 +:102A100064D13846FEF702FD040005D02078222854 +:102A200005D20820BDE8FC8143F20200FAE7A07F4E +:102A300000F0030C2DB129466046FEF77CFD060030 +:102A4000F0D15D48BCF1010F05D0BCF1020F17D0E9 +:102A5000FFDF3046E6E7A27D2946012A02D0407C0E +:102A6000800701D51120DDE729B9684600F0E1FBB8 +:102A70000028D7D16946384606F0F3FA0646E8E75B +:102A8000A17D022914D1407C800611D425B1A07FFC +:102A900040070BD4002100E00121384606F029FB55 +:102AA0000600D6D1A075002DD3D002E01126D0E7C4 +:102AB000A5B12A4621463846FEF785FE064611286E +:102AC000C7D1A07F4107C4D4296844F80E1F6968A4 +:102AD000616040F0040020740026BAE71020A1E7EE +:102AE00070B50C460546FEF799FC010005D022465C +:102AF0002846BDE87040FEF744BE43F2020070BDB8 +:102B000000B597B042218DF800108DF802000BA996 +:102B1000684609F077FB17B000BD0123FEF781BCC2 +:102B200000231A461946FEF77CBC30B597B0044620 +:102B30000FF01AFE10B1102017B030BD204600F083 +:102B400089F90028F8D11C4DA878112801D0082057 +:102B5000F2E7FEF719FC20B1687CC00603D511200E +:102B6000EAE71320E8E72078800701D5E87848B342 +:102B70001D208DF800002078022200F001008DF861 +:102B800002006088ADF80400A088ADF80600207847 +:102B9000C0F3400102EA500001438DF8091002A879 +:102BA000FEF79CFD00B1FFDF0BA9684609F02AFB88 +:102BB0000028C1D11E2006E0B4010020070605044C +:102BC0000302010017E08DF8000001208DF80200DB +:102BD00000208DF803000BA9684609F013FB0028BC +:102BE000AAD1E08800F052F90400A5D11220FEF726 +:102BF000B1FB2046A0E707209EE7F0B597B0154649 +:102C00000C4607460FF0FBFD38B920460FF0ACFD2F +:102C100018B928460FF0A8FD10B1102017B0F0BD6C +:102C2000B84E707C10F0180F01D1400701D511206B +:102C3000F4E7204600F00EF90028EFD129460220E3 +:102C4000FEF779FC0028E9D1B078112803D01228CA +:102C500001D00820E2E72078C0F34001394311D0C9 +:102C6000800700D577B906200BF0E8FE40B1207848 +:102C7000800701D5F07828B1B078122804D007E099 +:102C80001220CBE70720C9E7FFF764F90028C5D178 +:102C9000FEF77AFB022801D21320BFE721208DF82E +:102CA00000006088ADF80200A088ADF8040020782C +:102CB000C0F340008DF806002078800716D43878DD +:102CC000420808D0012A18D043F20221022A18D063 +:102CD000032A18D115E0C00700D002208DF80700A4 +:102CE00057F8010F0290B888ADF80C000DF10E00F6 +:102CF000FEF7F4FC58B1032090E7C00705D003208D +:102D0000ECE7C00701D0084688E70120E6E72888FD +:102D1000ADF810006888ADF81200A888ADF814006E +:102D2000E888ADF816000020ADF81800ADF81A00DC +:102D30000BA9684609F066FA00288BD1E08800F0FC +:102D4000A5F8040086D11320FEF704FB204665E7B2 +:102D500030B5054697B00C4608460FF029FD08B17E +:102D60001020E9E62846FEF759FB38B10178222900 +:102D700002D3807F800604D40820DDE643F20200FF +:102D8000DAE613208DF80000ADF802500BA9684672 +:102D900009F038FA0028E4D19DF932107F2901D0DA +:102DA0002170C9E60520C7E630B5054697B00C4648 +:102DB00008460FF0D9FC08B11020BDE62846FEF702 +:102DC0002DFB20B10078222804D20820B4E643F27B +:102DD0000200B1E62178E8B2890802D16178890859 +:102DE00001D00720A8E652218DF80010ADF80200AE +:102DF00020788DF8050060788DF80600207838B1CD +:102E00005FF000008DF80400617819B1002102E044 +:102E10000120F7E7022108438DF804000020ADF8F7 +:102E200008000BA9684609F0EDF985E630B5354D87 +:102E3000040008D0012C04D0022C06D0032C04D0AE +:102E4000FFDF2C7030BDFFDFFBE728780128F8D0CA +:102E5000FFDFF6E7418843F6FD730A1F9A4209D265 +:102E60008088042806D3B0F5804F03D8884201D863 +:102E700000207047072070470278520804D0012ACA +:102E800002D043F202207047FEF705BC10B548B1EE +:102E900083000022114607200FF086FB072801D08F +:102EA00003201EE400201CE470B50C0006460DD083 +:102EB000FEF7B4FA050000D1FFDFA6802889208143 +:102EC000288960816889A081A889E08170BD10B5DA +:102ED00002F0010282703122027009F093F9002899 +:102EE00000D0FFDF09E410B500231A4603E0845C3C +:102EF0002343521CD2B28A42F9D30BB10020D0E74F +:102F00000120CEE7B40100204FF0E0224FF4004151 +:102F10000020C2F880112049087020499002086002 +:102F2000704730B51C4D04462878A04218BF002CCD +:102F300002D0002818BFFFDF2878A04208BF30BDAC +:102F40002C701749154A0020ECB1164DDFF858C017 +:102F5000131F012C0DD0022C1CBFFFDF30BD0860F9 +:102F600003200860CCF800504FF400001060186097 +:102F700030BD086002200860CCF800504FF040706F +:102F80001060186030BD086008604FF0607010601D +:102F900030BD00B5FFDF00BD1A00002008F501407C +:102FA00000F50040FC02002014F50040094810B56F +:102FB00004680A49084808600EF091F8084804605F +:102FC00010BD0849002008604FF0E0210220C1F840 +:102FD0008002704710050240010000011805024000 +:102FE00014050240FC1F004010B50FF095FDFFF7DF +:102FF0008BFF0FF035FCBDE810400FF0E7BC7047C9 +:1030000018FFFFFFDBE5B151000002009000FFFF59 +:1030100084000000404B4C00FE48002101604160EC +:1030200070472DE9F743044692B091460120FFF71F +:1030300071F960680FF0DAFB58B160680FF0DFFBE0 +:1030400038B9607800F00300022802D10020FFF7B1 +:1030500061F94D4648460FF087FB18B1102015B0B6 +:10306000BDE8F08329460120FEF765FA0028F6D175 +:1030700001258DF842504FF4C050ADF840000022B9 +:1030800010A9284603F0B8FE0028E8D18DF8425078 +:103090004FF42850ADF8400000261C2168460796E2 +:1030A0001CF0B9FA9DF81C0007AF20F00F00401C7F +:1030B00020F0F00010308DF81C0020788DF81D00F5 +:1030C00061789DF81E000DF1400861F3420040F068 +:1030D00001008DF81E009DF8000008AA40F00200D3 +:1030E0008DF800002089ADF83000ADF832606089BD +:1030F000ADF834000B9760680E900AA9CDF82880CF +:10310000684603F078FC0028A9D1C24CBDF8200025 +:1031100008AA20808DF8425042F60120ADF8400008 +:103120009DF81E000AA920F00600801C20F0010076 +:103130008DF81E000220ADF83000ADF8340013A861 +:103140000E90684603F057FC002888D1BDF8200097 +:103150006080211D484600F032F9002887D18DF8A3 +:10316000425042F6A620ADF840001C216846079662 +:103170001CF051FA9DF81C00ADF8345020F00F00FF +:10318000401C20F0F00010308DF81C009DF81D0050 +:1031900008AA20F0FF008DF81D009DF81E000AA966 +:1031A00020F0060040F00100801C8DF81E009DF804 +:1031B00000008DF8445040F002008DF80000CDE989 +:1031C0000A8711A80E90ADF83050684603F013FC42 +:1031D000002899D1BDF82000E08000203FE73EB5EF +:1031E00004460820ADF8000020460FF0BDFA08B1F3 +:1031F00010203EBD21460120FEF79DF90028F8D1A0 +:103200002088ADF804006088ADF80600A088ADF80D +:103210000800E088ADF80A007E4801AB6A46808865 +:10322000002103F0E3FFBDF800100829E1D00320DE +:103230003EBD1FB50446002002900820ADF80800EE +:10324000CDF80CD020460FF08FFA10B1102004B04A +:1032500010BD704802AA81884FF6FF7004F09EF9F5 +:103260000028F4D1BDF80810082901D00320EEE7AA +:10327000BDF800102180BDF802106180BDF8041077 +:10328000A180BDF80610E180E1E701B582B002201F +:10329000ADF800005F4802AB6A464088002103F0A9 +:1032A000A5FFBDF80010022900D003200EBD1CB5FB +:1032B000002100910221ADF8001001900FF078FA82 +:1032C00008B110201CBD53486A4641884FF6FF7074 +:1032D00004F064F9BDF800100229F3D003201CBDEE +:1032E000FEB514460E460746FFF717F828B13046DC +:1032F0000FF03AFA18B11020FEBD0F20FEBDF82CD9 +:1033000001D90C20FEBD38460FF02EFA414D18BBF6 +:10331000288801A903F0F8F80028F3D138788DF84F +:103320000500288801A903F03FFF0028EAD100909A +:103330009DF800009DF8051040F002008DF8000097 +:10334000090703D040F008008DF80000288869467E +:1033500003F0C7FE0028D5D1ADF8084028883346D1 +:1033600002AA002103F042FFBDF80810A142C9D013 +:103370000320FEBD7CB50546002000900190088822 +:10338000ADF800000C46284601950FF02FFA18B949 +:1033900020460FF00DFA08B110207CBD15B1BDF824 +:1033A000000050B11B486A4601884FF6FF7004F0D8 +:1033B000F5F8BDF8001021807CBD0C207CBD30B537 +:1033C00093B0044600200D460090142101A81CF083 +:1033D00022F91C2108A81CF01EF99DF80000CDF868 +:1033E00008D020F00F00401C20F0F00010308DF8C5 +:1033F00000009DF8010020F0FF008DF801009DF80D +:10340000200040F002008DF8200001208DF84600D9 +:1034100002E000001200002042F60420ADF8440053 +:1034200011A801902088ADF83C006088ADF83E00FE +:10343000A088ADF84000E088ADF842009DF8020099 +:1034400006AA20F00600801C20F001008DF8020082 +:103450000820ADF80C00ADF810000FA8059001A9E8 +:1034600008A803F0C8FA002803D1BDF81800288086 +:10347000002013B030BD000010B504460FF074F901 +:1034800008B1102010BD2078C0F30210042807D81E +:103490006078072804D3A178102901D8814201D28D +:1034A000072010BDE078410706D421794A0703D4EC +:1034B000000701D4080701D5062010BD002010BD6B +:1034C00010B513785C08C37F64F30003C3771478E6 +:1034D000A40864F34103C3771078C309887863F3C1 +:1034E0004100887013781C094B7864F347134B70C4 +:1034F0001378DB0863F3000088705078487110BDC2 +:1035000010B5C4780B7864F300030B70C4786408BA +:1035100064F341030B70C478A40864F382030B7056 +:10352000C478E40864F3C3030B700379117863F380 +:103530000001117003795B0863F341011170037995 +:103540009B0863F3820111700079C00860F3C30126 +:10355000117010BD70B514460D46064604F0B1FE5C +:1035600080B10178142221F00F01891C21F0F001B3 +:10357000A03100F8081B21461BF0F9FFBDE87040A0 +:1035800004F0A2BE29463046BDE870401322FEF783 +:10359000F8B870B514460E46054604F092FE70B1B8 +:1035A000017821F00F01891C21F0F0012031017018 +:1035B000458021688160BDE8704004F085BE3146D9 +:1035C0002846BDE870401322FEF7DBB810B5FE4C6C +:1035D00094F8300000280CD104F120014FF6FF725E +:1035E000A1F110000CF0B5FE00B1FFDF012084F85E +:1035F000300010BD2DE9F047064608A8894690E83E +:1036000030041F469046142128461CF004F800217F +:10361000CAF80010B8F1000F03D0B9F1000F03D1C0 +:1036200014E03878C00711D020680FF0C1F8E8BB6B +:10363000B8F1000F07D120681230286020681430DC +:1036400068602068A8602168CAF800103878800790 +:1036500028D560680FF0CAF840BBB9F1000F2DD033 +:10366000FEF755FE0168C6F8B4118188A6F8B811B6 +:10367000807986F8BA01FFF7A9FFDFF84C8308F1DB +:103680002008C5F80C80626862B196F8B40106F2B1 +:10369000B51140081032FEF74FF81022414660681D +:1036A0001BF020FF3878400712D500E003E0A06847 +:1036B0000FF07EF850B11020BDE8F0876068002858 +:1036C000F9D0E8606068C6F8B001EBE7A06828614F +:1036D0000020F1E730B5054608780C4620F00F00D1 +:1036E000401C20F0F001103121700020607095F82E +:1036F000230030B104280FD0052811D0062814D09B +:10370000FFDF20780121B1EB101F04D295F82000D3 +:1037100000F01F00607030BD21F0F000203002E0AA +:1037200021F0F00030302070EBE721F0F000403065 +:10373000F9E710B510B190F8A94044B1A24890F84B +:10374000354000205CB108601060186010BD00F1C9 +:10375000A8040C6000F1D001F8301160F5E79A4C34 +:1037600034340C60F0E700B58BB00723CDE90212CA +:103770008DF801300191944900236431059109933A +:1037800001468DF8103068460CF0BBFD002800D0D3 +:10379000FFDF0BB000BD30B597B00C462C251A9951 +:1037A0008DF80050ADF80200B3B118680190586868 +:1037B0000290ADF80C2010220DF10E001BF092FECD +:1037C0000BA9684608F01EFD002803D1A17F41F037 +:1037D0001001A17717B030BD00200190E8E72DE976 +:1037E000F0470646008A8CB080B20D468246FDF74F +:1037F00015FE0446744F3078283FDFF8CC814FF037 +:103800000009122873D2DFE800F072E93509367733 +:103810007E98A8F3E7E6E5E4E35BE3E3A07F00F04E +:103820000300012806D0002150460BF054F9050092 +:1038300003D101E00121F7E7FFDF98F85C100906EA +:1038400002D5D8F860000BE0032105F121000EF04D +:1038500037FCD5F821005D49B0FBF1F201FB120005 +:10386000C5F8210070686866B068A86620782528C9 +:1038700000D0FFDFECE0A07F00F00300012806D0BD +:10388000002150460BF027F9060003D101E0012189 +:10389000F7E7FFDF7078810702D52178252904D06A +:1038A00040F0010070700CB006E70220287096F816 +:1038B0002000287106F121003136C5E90206F2E741 +:1038C000A07F00F00300012806D0002150460BF035 +:1038D00002F9040003D101E00121F7E7FFDF60787E +:1038E000C10605D51320287041346C60DBE7CEE1BA +:1038F00040F008006070D6E73348082128380EF001 +:10390000DFFB032016E02A208DF8000010220DF1C5 +:10391000020071681BF0E6FD10220DF11200B16883 +:103920001BF0E0FD284968462C3908F06BFC00B11B +:10393000FFDF042028706F60B5E7E07FC00600D588 +:10394000FFDFB0680090B38806220321504605F0DF +:1039500002FA0028A7D0FFDFA5E704B9FFDF7168EE +:1039600021B1102204F124001BF0BCFD28212046C7 +:10397000FDF78CFDA07F00F0030002280ED104F1BA +:103980002400002300901A4621465046FFF703FF0B +:10399000112807D029212046FDF778FD307A84F8D8 +:1039A000200080E7A07F000700D5FFDF14F81E0F7E +:1039B00040F008002070A4F81690C4F81890C4F8DD +:1039C0001C90617808460AE0F401002040420F0094 +:1039D00030E058E196E08CE062E009E03FE061F31E +:1039E0008200410861F3C3006070307AE0705AE7EA +:1039F000A07F00F00300012806D0002150460BF004 +:103A00006AF8040003D101E00121F7E7FFDF02219A +:103A100004F175000EF054FB1020287004F5DA70E4 +:103A20006860B4F875002882FE486C346C61C5E9A2 +:103A3000028038E7A07F00F00300012805D00021B4 +:103A400050460BF048F818B901E00121F8E7FFDF14 +:103A50000CB0324621465046BDE8F0477AE504B93D +:103A6000FFDF207821289CD93079012802D0022854 +:103A70000AD103E0E07F40F01000E07798F85C1096 +:103A800041F0010188F85C10324621465046FFF7AC +:103A900061FD0CB02046BDE8F0472321FDF7F6BCE0 +:103AA000327901230321504605F004F878B1112042 +:103AB0002870327905F10800AA80031D00900321C7 +:103AC000504605F074F8002891D0FFDFEBE6A07FA8 +:103AD00000F00300012806D0002150460AF0FBFF49 +:103AE000040003D101E00121F7E7FFDF3079207006 +:103AF000D9E60321504605F0CFFB002899D11220CA +:103B00002870D0E6A07F00F00300012806D0002135 +:103B100050460AF0E0FF050003D101E00121F7E77C +:103B2000FFDF95F8740000F00300012878D1A07F32 +:103B300000F00307E07FC0F3400616B1012F04D068 +:103B40002BE095F89000C0072AD0D5F8AC1119B336 +:103B500095F87320087C62F387000874E27FD5F83B +:103B6000AC1162F341000874D5F8AC1166F30000A3 +:103B70000874AEB1D5F8AC01102204F124017835F7 +:103B80001BF0B0FC287E40F001002876287820F059 +:103B9000010005F8780900E016B1022F04D02CE0EE +:103BA00095F87800C00726D0D5F8A81119B395F874 +:103BB0007320087C62F387000874E27FD5F8A811AF +:103BC00062F341000874D5F8A81166F30000087488 +:103BD0008EB1D5F8A801102204F1240178351BF02C +:103BE00081FC287840F0010005F8180B287820F0B7 +:103BF000010005F89009022F41D0002000EB4000A1 +:103C000005EBC00090F87800800709D595F86C00A6 +:103C1000D5F8B021400805F16D011032FDF78CFD9B +:103C200005208DF8000015F8740F6A4600F00300B7 +:103C30008DF8010028798DF80200287F8DF80300A7 +:103C400021465046FFF7A5FC2078252805D02128DD +:103C500007D0FFDF2078222803D922212046FDF754 +:103C600015FCA07F00F0030001280AD00021504677 +:103C70000AF043FF00283FF422AEFFDF13E60120E5 +:103C8000BCE70121F3E7716881F801900BE6FFDFE3 +:103C900009E670B5634C0025103C14F85C0F20F069 +:103CA0008000207065600CF0F4FA5E49A1F110000C +:103CB00004F099FA04F82C5C0620607259487C30B4 +:103CC00020615030A0611030E06170BD70B50D46CC +:103CD000FDF7A4FB040000D1FFDF4FF4DE7128469E +:103CE0001BF099FC4F485430686104F124002861AE +:103CF000A07F00F00300012808D0022105F5907094 +:103D00000CF0C8FA002800D0FFDF70BD0121F5E7F4 +:103D10000A46014602F590700CF0DCBA70B5054613 +:103D200040689CB0017808290DD00B2903D00C29DC +:103D300036D101218171686886883046FDF76EFBB7 +:103D4000040033D131E046883046FDF767FB0400BC +:103D500000D1FFDF2078212822D0282822D16868CE +:103D600002210C3001F0B2F9E0B168680821001DB1 +:103D700001F0ACF9B0B12D208DF80000ADF8026073 +:103D8000102204F1240101A81BF0ACFB0BA968462A +:103D900008F038FA00B1FFDF29212046FDF776FB55 +:103DA0001CB070BD04F090FAFAE7FFDFA07F00F0CE +:103DB0000301022902D120F01000A07720782128E9 +:103DC0000AD06868817909B1807880B1A07F00F05D +:103DD0000300022859D0FFDFA07F00F00300022873 +:103DE000DED1FDF70DFD0028DAD0FFDFD8E704F0C3 +:103DF0006BFAE07FC10723D0800701D5062000E0E1 +:103E0000052084F82300207829281BD02428E3D11A +:103E1000314606200EF065FC22212046FDF736FBD8 +:103E2000A07F01E00402002000F0030001282AD056 +:103E3000002130460AF061FE0028CDD0FFDFCBE73D +:103E40000420DEE7A07F00F00300012806D0002157 +:103E500030460AF040FE050003D101E00121F7E7FA +:103E6000FFDF25212046FDF711FB0F208DF85800BC +:103E700016A905F590700CF024FA0228ACD00028A1 +:103E8000AAD0FFDFA8E70121D3E704F01DFAA3E7DA +:103E90002DE9F0438BB09946154688460646FDF756 +:103EA000BDFA04004ED0207822284BD3232849D0D5 +:103EB000E07FC00646D4A07F00F00300012806D0B2 +:103EC000002130460AF007FE070002D00BE0012176 +:103ED000F7E7A07F00F00300012804D1012130465C +:103EE0000AF0F0FD074601AB02AA03A93846FFF726 +:103EF00020FC039800B9FFDF4FB1039807F59077D6 +:103F000087612078222806D0242804D007E003996E +:103F10000020886103E025212046FDF7B7FA0398C9 +:103F20000B21417046628580C0E9028902990161D6 +:103F30000199416104A90CF0E4F9022802D000289B +:103F400000D0FFDF0BB0BDE8F08330B587B0054689 +:103F5000FDF764FA017822292FD9807F00F0030051 +:103F6000012806D0002128460AF0B5FD040003D13F +:103F700001E00121F7E7FFDF227801230321284632 +:103F800004F098FD002818D011208DF80400227844 +:103F900003A80090ADF8082004AB0321284604F0E4 +:103FA00006FE00B1FFDF01A904F590700CF089F95D +:103FB000022802D0002800D0FFDF07B030BD10B5C6 +:103FC00086B00446FDF72AFA0178222919D9807FA4 +:103FD00000F00300012806D0002120460AF07BFDF6 +:103FE000040003D101E00121F7E7FFDF12208DF883 +:103FF0000000694604F590700CF063F9002800D0C9 +:10400000FFDF06B010BD2DE9F05F05460C46002726 +:104010000078904601093E46BB4604F1080A022991 +:104020007ED0072902D00A2909D142E068680178C8 +:10403000082905D00B292CD00C292AD0FFDFC6E196 +:1040400014271C26002C6CD04088A080FDF7E6F9D0 +:104050005FEA000900D1FFDF99F8170052464008D7 +:1040600009F11801FDF768FB68688089208268689B +:104070004168C4F812108068C4F81600A07E20F0D1 +:10408000060040F00100A07699F81E0040F04001C3 +:104090004DE01A270A26002CD5D08088A080FDF795 +:1040A000BDF9050000D1FFDF51462846FFF712FB9E +:1040B0008DE10CB1288BA080287A0E287ED006DCFA +:1040C00001287CD0022808D0032804D135E010282C +:1040D00076D0112875D0FFDF79E11E270926002C44 +:1040E000B1D0A088FDF79AF95FEA000900D1FFDF9F +:1040F000287B00F003000128207A1BD020F001006B +:104100002072297B890861F341002072297BC9084C +:1041100061F382002072297B090961F3C30001E089 +:104120004AE117E1207299F81E0040F0800189F8F9 +:104130001E104CE140F00100E2E713270D26002C91 +:10414000AAD0A088FDF76AF98146807F00F00300BD +:10415000012806D00021A0880AF0BDFC050003D18B +:1041600001E00121F7E7FFDF99F81E0000F00302EC +:10417000012A59D0A86E817801F003010129217A22 +:1041800054D021F00101217283789B0863F341012F +:1041900021728378DB0863F38201217283781B0923 +:1041A00063F3C3012172037863F30611217243782C +:1041B00063F3C711217284F809B003E05EE0A4E064 +:1041C0008CE09CE0C178A172012A32D04279E17A78 +:1041D00062F30001E1724279520862F34101E17237 +:1041E0004279920862F38201E1724279D20862F365 +:1041F000C301E1720279217B62F30001217302792C +:10420000520862F3410121730279920862F382013C +:1042100021730079C00860F3C301217399F800008D +:1042200023285AD9262168E0686EA4E741F00101ED +:10423000A9E70279E17A62F30001E172027952089A +:1042400062F34101E1720279920862F38201E17244 +:104250000279D20862F3C301E1724279217B62F3F1 +:10426000000121734279520862F3410121734279BE +:10427000920862F3820121734079CBE71827102658 +:10428000002C67D0A088FDF7C9F88246807F00F037 +:104290000300012807D00021A0880AF01CFC5FEA77 +:1042A000000903D101E00121F6E7FFDFE868A06023 +:1042B00099F8010040F0040189F8011099F8020012 +:1042C000800708D5012020739AF8000023287ED9A2 +:1042D0002721504663E084F80CB078E015270F26BC +:1042E000C4B3A088FDF79AF8814606225146E868D3 +:1042F00007F0F0FF0120A073AEE048464FE016271C +:1043000009263CB3287B207261E0297BFE48022904 +:104310000CD019270E26ECB101290DD003291AD093 +:1043200004291BD0052919D0FFDF23E01B2709260C +:10433000BCB30121217205E001212172617A21F0D3 +:104340000301617210F85C1F4A08520062F3060113 +:1043500001700FE02BE00220207207E0687B052946 +:1043600000F00F0040F0800020721BD0607A20F037 +:1043700003006072A088FDF751F8054600782128F7 +:1043800025D0232800D0FFDFA87F00F003000128FC +:1043900010D00021A0880AF0B0FB22212846FDF7AA +:1043A00075F814E0607A20F00300401CE1E7A8F8FB +:1043B000006011E00121EDE70CB16888A080287A47 +:1043C00003282BD004280AD005284BD0FFDFA8F8FB +:1043D00000600CB1278066800020BDE8F09F1527A3 +:1043E0000F26002CE3D0A088FDF718F8807F00F09E +:1043F0000300012806D00021A0880AF06CFB05000C +:1044000003D101E00121F7E7FFDFD5F82100062203 +:10441000514607F05FFF84F80EB0D8E7172709264A +:10442000002CC4D0A088FCF7F9FF8146807F00F003 +:104430000300012806D00021A0880AF04CFB0500EB +:1044400003D101E00121F7E7FFDFA878800701D55C +:10445000022000E00120207299F800002328B6D93C +:1044600027214AE719270E26002CA0D0A088FCF7A8 +:10447000D5FF5FEA000900D1FFDFC4F808B0A4F857 +:104480000CB084F808B0A07A40F00300A07299F84C +:104490001F1061F38200A07299F81F1001EA510108 +:1044A00061F3C300A072687A00F0030001288ED186 +:1044B000607A40F00400607299F81E00E97A00F01A +:1044C0000300012813D0607B61F300006073AA7AB7 +:1044D000217B62F300012173EA7A520862F3410002 +:1044E0006073A87A400860F3410121736FE7207B75 +:1044F00061F300002073AA7A617B62F300016173AB +:10450000EA7A520862F341002073A87A400860F307 +:10451000410161735BE710B57B4C30B1014610225D +:1045200004F120001AF0DEFF012084F8300010BDF5 +:1045300010B50446FFF74AF8734920461022BDE83B +:10454000104020311AF0CEBF70B56F4C06004FF00E +:10455000000514D00EF008F908B110250DE0062171 +:10456000304607F09EFE411C06D0206614F85C0F12 +:1045700040F08000207000E00725284670BD14F848 +:104580005C0F20F08000F5E7007810F00F0204D0F7 +:10459000012A05D0022A0CD110E0000909D10AE055 +:1045A0000009012807D0022805D0032803D00428D9 +:1045B00001D0072070470870002070470620704720 +:1045C00005282AD2DFE800F003070F171F0008783C +:1045D00020F0FF001EE0087820F00F00401C20F0C3 +:1045E000F000103016E0087820F00F00401C20F09A +:1045F000F00020300EE0087820F00F00401C20F082 +:10460000F000303006E0087820F00F00401C20F069 +:10461000F0004030087000207047072070472DE9F7 +:10462000F041804688B00D46002708460EF0E7F8B6 +:10463000A8B94046FCF7F2FE040003D020782228F7 +:1046400015D104E043F2020008B0BDE8F08145B99D +:10465000A07F010603D500F00300022801D010203E +:10466000F2E7A07FC10601D4010702D50DB10820F1 +:10467000EAE7254991F85C10C90701D01120E3E76A +:10468000E17FC90601D50D20DEE700F00300022816 +:1046900005D125B12846FEF7EFFE0700D4D1A07F53 +:1046A00000F00300012806D0002140460AF013FA6A +:1046B000060002D00CE00121F7E7A07F00F0030024 +:1046C00001280BD0002140460AF0FCF9060007D073 +:1046D000A07F00F00300022804D009E00121F2E7E6 +:1046E0000420B1E725B12A4631462046FEF7E8FE10 +:1046F00007AB1A4669463046FFF71BF8009800B929 +:10470000FFDF0C20009901E0F4010020487006F55D +:104710009070C1F82480486100200881A07F00F0DB +:104720000300012828D0EDB302200871301D8861F4 +:10473000707840090877B078C0F34000487728784F +:1047400000F00102887F62F301008877E27F62F364 +:1047500082008877E27F520862F3C3008877B278DC +:1047600062F304108877A878C87701F121022846FF +:104770002031FEF7C5FE22E001200871287800F004 +:104780000102087E62F3010008762A78520862F37B +:10479000820008762A78920862F3C30008762A78A5 +:1047A000D20800E007E062F30410087624212046D6 +:1047B000FCF76CFE0BE0032008710520087625212C +:1047C0002046FCF763FEA07F20F08000A07701A9BF +:1047D00000980BF096FD022801D000B1FFDF3846AB +:1047E00032E72DE9FF4FF94A0D4699B09A4607CABC +:1047F00014AB002783E807001998FCF70FFE0600AA +:1048000006D03078262806D008201DB0BDE8F08FED +:1048100043F20200F9E7B07F00F00309B9F1010F9C +:1048200003D0B9F1020F07D008E03DB91B98FEF79D +:1048300023FE0028E9D101E01B9878BBB07F00F08F +:104840000300012806D0002119980AF044F9040059 +:1048500003D101E00121F7E7FFDF852D25D007DC3B +:10486000D5B1812D1BD0822D1BD0832D08D11AE00C +:10487000862D1CD0882D1CD0892D1CD08A2D1CD0B3 +:104880000F2020710F281AD001208DF83400201D30 +:104890000E902079A8B158E10020F2E70FE0012046 +:1048A000EFE70220EDE70320EBE70520E9E706202C +:1048B000E7E70820E5E70920E3E70A20E1E707202A +:1048C000A3E7B9F1010F17D0D4E9195080460220AF +:1048D000019001200090A87898F80210C0F3C00061 +:1048E000C1F3C00108405FEA000B5DD050460DF0F7 +:1048F0003BFF00286CD12DE0D4E9198501200190FF +:1049000002200090214630461B9AFEF7D9FD1B98E5 +:10491000007800F00101A87861F30100A870F17F30 +:1049200061F38200A870F17F490861F3C300A870A9 +:10493000A17861F30410A870607840092870A0780D +:10494000C0F3400068701B988078E87000206871A0 +:104950002871C0E7DAF80C000DF006FFC0BBDAF8EA +:104960001C000DF001FF98BBDAF80C00A060DAF82B +:104970001C00E06098F80100A17800F0010041EA15 +:104980004000A07098F80210C0B2C1F30011891E57 +:104990000840A070002084F82000009906F117005C +:1049A00002290BD001210AE098F80110A07801F04B +:1049B0000101FD2242EA41010840E2E7002104EB47 +:1049C000810188610199701C022902D0012101E056 +:1049D00028E0002104EB81018861A87800F0030041 +:1049E000012849D198F8020000F00300012843D1C2 +:1049F000B9F1010F04D12A1D691D1B98FEF780FD36 +:104A0000297998F8040001408DF82C10687998F8FD +:104A1000052010408DF8300001432DD050460DF098 +:104A2000A3FE08B11020F0E60AF1100004F5D471DD +:104A300004F17C020490B9F1020F3CD00090CDE962 +:104A4000012100210BAB5A462046FEF7D3FD00287A +:104A5000E9D104F5D67104F19402B9F1010F30D017 +:104A600004980090CDE9012100210CAB5A46204664 +:104A7000FEF7C0FD0028D6D1A078800740D4A878E2 +:104A800098F80210C0F38000C1F38001084337D0CA +:104A9000297898F8000014AAB9F1010F17D032F85C +:104AA00010204B00DA4012F0030718D0012F1ED05F +:104AB000022F12D11DE0CDF800A0CDE90121012186 +:104AC000C0E7CDF800A0CDE901210121CDE732F802 +:104AD00011204300DA4002F00307032F07D0BBF197 +:104AE000000F0DD0012906D0042904D008E00227C8 +:104AF000F5E70127F3E7012801D0042800D10427B6 +:104B0000F07F40F001006BF34100F077A07881075F +:104B10004FF003000CD5A071BBF1000F15D100BF01 +:104B20008DF85C0017AA31461998FEF732FD0CE0AB +:104B30000221022F18D0012F18D0042F22D00020DC +:104B4000A071F07F20F00100F07725213046FCF7BE +:104B50009DFC0DA904F590700BF0B3FB10B1022879 +:104B600000D0FFDF002050E6A171D9E7A1710D212F +:104B700004F124001AF04FFD607840F002006070EC +:104B80000420CDE70120A071DFE72DE9F04387B0D5 +:104B9000914688460446FCF741FC070006D0387869 +:104BA000272806D0082007B0BDE8F08343F20200B2 +:104BB000F9E7B87F00F00300012809D00021204662 +:104BC00009F089FF040006D104E000009CF901000F +:104BD0000121F4E7FFDFA679012E08D0B8F1000F1C +:104BE0000FD048460DF0C0FDB8B11020DBE7B9F199 +:104BF000000F25D1B8F1000F09D0B8F1010F1FD176 +:104C000020E0022E05D0032E05D0FFDF28E00C2582 +:104C100026E0012524E0022522E0B8F1020F03D0AE +:104C2000B8F1010F0AD00BE0032E09D100251022A4 +:104C3000494604F121001AF055FC11E0022E01D082 +:104C40000720B0E70025102104F121001AF0C1FC73 +:104C50005FEA090004D0062107F023FBC4F8210015 +:104C60006078252140F0020060703846FCF70EFCA9 +:104C70006078C10713D020F00100607002208DF829 +:104C8000000004F1210002908DF804506946FF30C5 +:104C90000BF017FB022804D018B1FFDF01E084F805 +:104CA000205000207FE730B587B00D460446FCF762 +:104CB000B5FB88B1807F00F0030001280FD00021F0 +:104CC000204609F008FF04000ED028460DF04CFDE8 +:104CD00038B1102007B030BD43F20200FAE70121DD +:104CE000EEE76078400701D40820F3E7294604F195 +:104CF0004100202205461AF0F5FB607840F01000D4 +:104D0000607001070FD520F00800607013208DF847 +:104D10000000694604F5907001950BF0D2FA022864 +:104D200001D000B1FFDF0020D4E770B592B00D468E +:104D30000646FCF773FB18B10178272940D103E040 +:104D400043F2020012B070BD807F00F00300012822 +:104D500006D00021304609F0BEFE040003D101E078 +:104D60000121F7E7FFDFA079022829D1A078C00749 +:104D700026D0002302220321304603F09BFE08B315 +:104D80000C208DF805000A9604A804F59074022200 +:104D900000900694ADF80C2005AB0321304603F0DB +:104DA00006FF00B1FFDF04208DF808008DF81C50CD +:104DB0000BA901A80BF0A5FA00B1FFDF0020C1E7A5 +:104DC0000820BFE71120BDE770B5064686B014463F +:104DD0000D4608460DF0C8FC18B920460DF0E8FC59 +:104DE00010B1102006B070BDA6F57F40FF380ED080 +:104DF0003046FCF713FB38B1417822464B08811C42 +:104E00001846FCF799FC07E043F20200EAE7204667 +:104E1000FDF7EAFA0028E5D11021E01D0DF050F968 +:104E2000E21D29466846FEF79EFC102204F1170099 +:104E300001991AF057FB0020D4E72DE9F041044610 +:104E400090B015468846002708460DF0D8FC18B9E2 +:104E500028460DF0D4FC18B1102010B0BDE8F08148 +:104E60002046FCF7DBFA060003D03078272818D15B +:104E700002E043F20200F0E7B07F00F003000128F7 +:104E800006D00021204609F026FE040003D101E0EF +:104E90000121F7E7FFDF6078400702D5A07880079F +:104EA00001D40820D9E7B07F00F00300012818D012 +:104EB000D4E91901407800B1B5B1487810B1B8F122 +:104EC000000F11D0C5B1EA1D02A8E168FEF74BFC46 +:104ED000102205F1170003991AF0D8FA30B104270F +:104EE0000AE0D4E91910E5E70720B6E71022E91D2A +:104EF00004F131001AF0F6FAB8F1000F06D01022D2 +:104F000008F1070104F121001AF0ECFA607825217C +:104F100040F0020060703046FCF7B8FA6078C107D4 +:104F200015D020F00100607002208DF8200004F1FF +:104F300021000A9010300B908DF8247008A9EF30F2 +:104F40000BF0BFF9022804D018B1FFDF01E084F8AC +:104F50002070002081E7F8B515460E460746FCF79D +:104F60005DFA040004D02078222804D00820F8BD7F +:104F700043F20200F8BDA07F00F00300022802D037 +:104F800043F20500F8BD30460DF0EEFB18B9284697 +:104F90000DF0EAFB08B11020F8BD00953288B31C73 +:104FA00021463846FEF7F7FB112814D00028F3D12C +:104FB000297C4A08E17F62F30001E1772A7C62F3F1 +:104FC0004101E177297C890884F82010A17F21F034 +:104FD0008001A177F8BDA17F0907FBD4D6F80200B4 +:104FE000C4F83600D6F80600C4F83A003088A08627 +:104FF0001022294604F124001AF074FA287C410892 +:10500000E07F61F38200E077297C61F3C300E07701 +:10501000287C800884F82100A07F40F00800A07759 +:105020000020D3E770B596B00D46064613B10720B1 +:1050300016B070BDFCF7F2F9040007D020782228E2 +:1050400002D3A07F400604D40820F1E743F2020017 +:10505000EEE7C5B12D208DF80000ADF802601022FA +:10506000294601A81AF03EFA287C4108E07F61F346 +:105070000000E077297C61F34100E077287C80081C +:1050800084F8200004E02E208DF80000ADF80260C6 +:105090000BA9684607F0B6F8A17F21F04001A1777F +:1050A000C6E770B50D46FCF7B9F9040005D02846EF +:1050B0000DF07EFB20B1102070BD43F2020070BDE8 +:1050C00029462046FEF706FB002070BD05E000BF24 +:1050D00010F8012B0AB100207047491E89B2F7D29F +:1050E00001207047F0B50078059F1E4614460D4616 +:1050F000012800D0FFDF0C2030803A203880002CBF +:1051000008D0287A052806D0287B012800D0FFDFA8 +:1051100017206081F0BDA889FBE72DE9F04786B034 +:10512000144691F80C900E9A0D46B9F1010F0BD070 +:10513000102100782E8A8846052807D0062833D00B +:10514000FFDF06B0BDE8F0870221F2E7E8890C2115 +:1051500000EB400001EB4000188033201080002C51 +:10516000EFD0E889608100271AE00096688808F18E +:10517000020301AA696900F06FFE06EB0800801CBB +:1051800007EB470186B204EB4102BDF804009081B1 +:105190000DF1060140460E320BF054F97F1CBFB2F0 +:1051A0006089B842E1D8CCE734201080E889B9F1B1 +:1051B000010F11D0122148430E301880002CC0D0AE +:1051C000E88960814846B9F1010F00D002202073C0 +:1051D00000270DF1040A1FE00621ECE7009668881D +:1051E00008F1020301AA696900F036FE06EB080027 +:1051F000801C86B2B9F1010F12D007EBC70004EB97 +:105200004000BDF80410C18110220AF102011030E3 +:105210001AF068F97F1CBFB26089B842DED890E707 +:1052200007EB470104EB4102BDF80400D0810AF10D +:105230000201404610320BF005F9EBE72DE9F0478B +:105240000E4688B090F800C096F80C80378AF58931 +:105250000C20109902F10C044FF0000ABCF1030F6E +:1052600008D0BCF1040F3ED0BCF1070F7DD0FFDFAA +:1052700008B067E705EB850C00EB4C001880312087 +:105280000880002AF4D0A8F1060000F0FF0955813B +:1052900025E0182101A81AF0BEF90097708843464E +:1052A00001AA716900F0D8FDBDF804002080BDF8A6 +:1052B0000600E080BDF808002081A21C0DF10A0163 +:1052C00048460BF0BFF8B9F1000F00D018B184F8D0 +:1052D00004A0A4F802A007EB080087B20A346D1EF0 +:1052E000ADB2D6D2C4E705EB850C00EB4C001880BC +:1052F00032200880002ABBD0A8F1050000F0FF0989 +:10530000558137E000977088434601AA716900F023 +:10531000A3FD9DF80600BDF80410E1802179420844 +:1053200060F3000162F34101820862F38201C20866 +:1053300062F3C301020962F30411420962F34511E9 +:10534000820962F386112171C0096071BDF80700FE +:10535000208122460DF1090148460BF073F818B17F +:1053600084F802A0A4F800A000E007E007EB080022 +:1053700087B20A346D1EADB2C4D279E7A8F102003B +:1053800084B205FB08F000F10E0CA3F800C0352331 +:105390000B80002AA6D055819481009783B2708833 +:1053A0000E32716900F058FD62E72DE9F84F1E4694 +:1053B0000A9D0C4681462AB1607A00F58070D08043 +:1053C000E089108199F800000C274FF000084FF099 +:1053D0000E0A0D2873D2DFE800F09E070E1C28305D +:1053E0003846556A73737300214648460095FFF7A7 +:1053F00079FEBDE8F88F207B9146082802D003286B +:1054000000D0FFDF378030200AE000BFA9F80A8013 +:10541000EFE7207B9146042800D0FFDF3780312062 +:105420002880B9F1000FF1D1E3E7207B91460428F1 +:1054300000D0FFDF37803220F2E7207B9146022840 +:1054400000D0FFDF37803320EAE7207B17460228B1 +:1054500000D0FFDF3420A6F800A02880002FC8D09D +:10546000A7F80A80C5E7207B1746042800D0FFDF95 +:105470003520A6F800A02880002FBAD04046A7F813 +:105480000A8012E0207B1746052802D0062800D0AB +:10549000FFDF1020308036202880002FA9D0E0893F +:1054A0007881A7F80E80B9F80200B881A1E7207BC7 +:1054B0009146072800D0FFDF37803720B0E72AE089 +:1054C0004FF0120018804FF038001700288090D05D +:1054D000E0897881A7F80E80A7F8108099F800007D +:1054E0000A2805D00B2809D00C280DD0FFDF80E753 +:1054F000207B0C2800D0FFDF01200AE0207B0D2854 +:1055000000D0FFDF042004E0207B0E2800D0FFDF66 +:10551000052038736DE7FFDF6BE770B50C46054675 +:10552000FBF77CFF20B10078222804D2082070BD50 +:1055300043F2020070BD0521284609F0CCFA206034 +:1055400008B1002070BD032070BDFFB585B00746CF +:10555000089814460D46022628B908A93846FFF7D0 +:10556000DCFF002840D108980121801D04F093FD44 +:10557000ADF8080002464DB100233146384603F02D +:1055800099FA98B30898007880BB05E0207809283C +:1055900020D00F282BD0FFDF03A8009004ABBDF86C +:1055A00008203146384603F002FB00281CD1089839 +:1055B00002A9801D60606780DDE90332204604F0A7 +:1055C00077FD40B3072824D2DFE800F01A18232320 +:1055D000211C1E00072600233146384603F06AFAD4 +:1055E0000028D9D143F2040009B0F0BD06E0002341 +:1055F0003146384603F05EFA0028CDD11120F3E79A +:105600000020F1E70820EFE743F20300ECE7072072 +:10561000EAE70320E8E703980090BDF80830042289 +:105620003146384603F097FB0028DDD1002DDBD052 +:1056300008990D70D8E710B586B01C46AAB10423AE +:105640008DF800301388ADF808305288ADF80A2084 +:105650008A788DF80E200988ADF80C1000236A4670 +:105660002146FFF772FF06B010BD1020FBE770B5B2 +:105670000D46052109F02FFA040000D1FFDF29466D +:10568000A01DBDE8704004F0EFBC70B596B00C46AC +:105690000646FFF7ECFF05462146304601F0CFFDF8 +:1056A0000121304601F0E9FD002D25D13046FBF700 +:1056B000B5FE050000D1FFDF95F822001B281BD99D +:1056C000172C19D93A208DF80000ADF8026095F832 +:1056D0002200211D884201D9241D00E00446ADF8B6 +:1056E000044040F64800ADF806000BA9684606F0F5 +:1056F00089FD002800D0FFDF16B070BD2DE9F8430A +:105700000D468046002602F0DCFD0446287812286B +:1057100078D2DFE800F07753533C355532321332FC +:1057200032320932323232322879001FC0B20228B6 +:1057300001D0102810D114BBFFDF34E004B9FFDF23 +:105740000521404609F0C7F90078032806D004284F +:105750000BD0072827D0FFDF072654E02879801FC9 +:10576000C0B202281FD050B1F6E72879401FC0B25E +:10577000022818D0102816D0EEE704B9FFDF12E097 +:1057800004B9FFDF287901280DD1172136E0052162 +:10579000404609F0A0F9070000D1FFDFB91D4046DF +:1057A00004F03BFC2CB12A462146404600F064FB45 +:1057B00029E013214046FDF793F924E0FFDF22E0C2 +:1057C00004B9FFDF0521404609F085F9070000D143 +:1057D000FFDF6946B81D04F028FC00B1FFDFA9888F +:1057E000172901D2172200E00A46BDF800008242C4 +:1057F00002D9014602E005E01729C6D34046FFF76B +:1058000044FFD0E7FFDF3046BDE8F8830020087092 +:10581000881D04F0F6BB891D04F006BC70B5054672 +:10582000052109F058F9040000D1FFDFA11D284629 +:10583000BDE8704004F0F1BB2DE9F74F90B04FF098 +:10584000000AADF830A0ADF804A047880C46054624 +:105850000521384609F03FF9060000D1FFDF24B1E9 +:10586000A780A4F806A0A4F808A0297A04F11000E3 +:105870003827C91E4FF00C0B4FF001084FF01209EA +:1058800002900F297ED2DFE801F0F2F1F08008D318 +:10589000898EA03DDCF3EEB7B7003078022800D047 +:1058A000FFDFA8890BEBC001ADF804103021ADF883 +:1058B0003010002C25D06081B5F80E8000271DE047 +:1058C00004EBC709317989F80E107188A9F80C101A +:1058D000CDF800806888042305AA296900F0BCFA85 +:1058E000BDF81410A9F8101008F10400BDF8161046 +:1058F0007F1C1FFA80F8A9F81210BFB26089B84265 +:10590000DED809E13078022800D0FFDFE9890BEB0F +:10591000C100ADF804003020ADF8300095F80CB0AF +:10592000002CABF10400C0B20F90EAD06181B5F851 +:105930001090002723E000BFCDF8009068885B46F8 +:1059400003AA696900F088FA09EB0B001FFA80F9D5 +:1059500004EBC70808F10C0204A90F980AF072FDC5 +:1059600018B188F80EA0A8F80CA0BDF80C10A8F883 +:105970001010BDF80E107F1CA8F81210BFB260897D +:10598000B84200E0C7E0D7D8C6E00CA8009001AB51 +:10599000224629463046FFF7C0FBBDE03078082894 +:1059A00005D0FFDF03E03078082800D0FFDFE8896A +:1059B0001030ADF804003620ADF83000002C3FD098 +:1059C000A98961817188A18127E03078092800D0F8 +:1059D000FFDFA88900F10C01ADF804103721ADF804 +:1059E0003010002C2CD06081E8890090AB89688849 +:1059F00004F10C02296955E0E8893921103080B2A0 +:105A0000ADF80400ADF83010002C72D0A989618186 +:105A1000287A10280AD002212173E989E181288A95 +:105A20000090EB8968886969029A3BE00121F3E7FD +:105A30000CA8009001AB224629463046FFF7FEFB3A +:105A40006AE030780A2800D0FFDFADF80490ADF8A6 +:105A500030704CB3A9896181A4F810A0A4F80EA0FD +:105A600084F80C8058E020E002E030E038E041E0CB +:105A700030780B2800D0FFDF288AADF83070123064 +:105A8000ADF8040084B104212173A9896181E989F9 +:105A9000E181298A2182688A00902B8A688804F132 +:105AA0001202696900F0D8F936E030780C2800D08D +:105AB000FFDFADF80490ADF8307044B305212173D9 +:105AC000A4F80AA0A4F80EA0A4F810A024E00CA842 +:105AD000009001AB224629463046FFF703FB1BE04E +:105AE0000CA8009001AB224629463046FFF75DFC2A +:105AF00012E00DE00B203B21ADF80400ADF83010B2 +:105B000034B1A4F80680A4F808A084F80AA003E041 +:105B10001299088014E0FFDF1299BDF80400088094 +:105B200074B1BDF830002080BDF804006080287A90 +:105B3000032805D0102803D0112801D086F800A032 +:105B400013B00020BDE8F08F2DE9F84356880F46CA +:105B5000804615460521304608F0BDFF040000D1FF +:105B6000FFDFA41D00943B46414630466A6804F0BE +:105B700053FC49E670B50D46052108F0ACFF040062 +:105B800000D1FFDF2946A01DBDE8704004F058BADF +:105B900070B50D46052108F09EFF040000D1FFDF1F +:105BA0002946A01DBDE8704004F07DBA2DE9F04300 +:105BB0008BB00D461446814606A9FFF7AEFC0028BF +:105BC00014D14FF6FF7601274FF420588CB10320F3 +:105BD0008DF800001020ADF8100007A8059007AA66 +:105BE000204604A90AF04DFC78B107200BB0BDE8AF +:105BF000F0830820ADF808508DF80E708DF8000085 +:105C0000ADF80A60ADF80C800CE00698A17801713F +:105C1000218841808DF80E70ADF80850ADF80C80E9 +:105C2000ADF80A606A4602214846069BFFF78DFCE4 +:105C3000DCE708B501228DF8022042F60202ADF839 +:105C400000200A4603236946FFF7F5FC08BD08B5A6 +:105C500001228DF8022042F60302ADF800200A4628 +:105C600004236946FFF7E7FC08BD00B587B079B1AA +:105C700002228DF800200A88ADF808204988ADF886 +:105C80000A1000236A460521FFF75FFC07B000BD3C +:105C90001020FBE709B10723CDE40720704770B55A +:105CA00088B00D461446064606A9FFF736FC0028C4 +:105CB0000ED17CB10620ADF808508DF80000ADF88B +:105CC0000A40069B6A4608215C803046FFF73DFC8F +:105CD00008B070BD05208DF80000ADF80850F0E761 +:105CE00000B587B059B107238DF80030ADF8082012 +:105CF000039100236A460921FFF727FCC6E710201D +:105D0000C4E770B588B00C460646002506A9FFF723 +:105D100004FC0028DCD106980121801D04F0BBF9A9 +:105D20009CB12178062921D2DFE801F02005051673 +:105D30000318801E80B2C01EE28880B20AB1A36838 +:105D40001BB1824203D90C20C2E71020C0E704290E +:105D500004D0A08850B901E00620B9E7012913D08A +:105D6000022905D004291CD005292AD00720AFE735 +:105D700009208DF800006088ADF80800E088ADF8D3 +:105D80000A00A068039023E00C208DF800006088D2 +:105D9000ADF80800E088ADF80A00A0680A25039075 +:105DA00016E00D208DF800006088ADF80800A0888E +:105DB000ADF80A00E088ADF80C00A0680B2504904F +:105DC00006E00E208DF8000060788DF808000C25A4 +:105DD0006A4629463046069BFFF7B7FB78E700B5D1 +:105DE00087B00F228DF80020ADF8081000236A4616 +:105DF0001946FFF7AAFB49E700B587B071B1022247 +:105E00008DF800200A88ADF808204988ADF80A10FE +:105E100000236A460621FFF798FB37E7102035E795 +:105E200070B586B0064601200D46ADF808108DF815 +:105E30000000014600236A463046FFF786FB040057 +:105E400008D12946304601F0EBF90021304601F037 +:105E500014FA204606B070BDF8B51C4615460E462D +:105E6000069F08F093FF2346FF1DBCB231462A4629 +:105E7000009408F07AFBF8BD10B548800878144605 +:105E800020F00F00C01C20F0F00090300B4608708E +:105E90001822214603F1080019F069FBBDE8104003 +:105EA00002F012BA18B18178012938D101E010202E +:105EB0007047018842F60112881A914231D018DCED +:105EC00042F60102A1EB020091422AD00CDC41B360 +:105ED000B1F5C05F25D06FF4C050081821D0A0F5EF +:105EE0007060FF381BD11CE001281AD002280AD1AB +:105EF00017E0B0F5807F14D008DC012811D002280B +:105F00000FD003280DD0FF2809D10AE0B0F5817F1A +:105F100007D0A0F58070033803D0012801D00020FD +:105F200070470F2070470B2826D008DC1BD2DFE813 +:105F300000F01C2025251A25292325271E001128BD +:105F40001CD008DC0C2817D00D281DD00F2815D028 +:105F5000102808D110E0822809D0842810D0852884 +:105F600010D0872812D003207047002070470520EA +:105F7000704743F203007047072070470F207047B7 +:105F800004207047062070470C20704743F202003F +:105F9000704708280DD2DFE800F00406040C0C0856 +:105FA0000C0A002070471120704707207047082016 +:105FB00070470320704738B50C46050041D069464C +:105FC000FEF7E2FA002819D19DF80010607861F31D +:105FD000020060706946681CFEF7D6FA00280DD1F1 +:105FE0009DF80010607861F3C5006070A978C1F376 +:105FF0004101012903D0022905D0072038BD2178AD +:1060000021F0200102E0217841F0200121704107B8 +:1060100004D0A978C90861F386106070607810F028 +:10602000380F07D0A978090961F3C710607010F024 +:10603000380F02D16078400603D5207840F0400048 +:106040002070002038BD70B5044600200880154639 +:106050006068FFF7B0FF002816D12089A189884227 +:1060600011D860688078C0070AD0B1F5007F0AD8DF +:1060700040F20120B1FBF0F200FB1210288007E093 +:10608000B1F5FF7F01D90C2070BD01F201212980FB +:10609000002070BD10B50478137864F3000313700A +:1060A0000478640864F3410313700478A40864F36B +:1060B000820313700478E40864F3C3031370047854 +:1060C000240964F3041313700478640964F345131A +:1060D00013700078800960F38613137031B108786B +:1060E000C10701D1800701D5012000E0002060F345 +:1060F000C713137010BD4278530702D002F0070394 +:1061000006E012F0380F02D0C2F3C20300E0012310 +:106110004A7863F302024A70407810F0380F02D0D8 +:10612000C0F3C20005E0430702D000F0070000E022 +:10613000012060F3C5024A7070472DE9F04F95B019 +:106140000D00804615D0B8F1000F16D01221284658 +:1061500019F03FFA4FF6FF7B05AA0121584605F0DA +:106160008DFE0024264637464FF420596FF4205AFE +:1061700075E0102015B0BDE8F08F0720FAE700BFEA +:106180009DF81E0001280AD1BDF81C0048450BD01F +:1061900010EB0A000AD001280CD002280CD0042CE5 +:1061A0000ED0052C0FD10DE0012400E00224BDF833 +:1061B0001A6008E0032406E00424BDF81A7002E027 +:1061C000052400E00624BDF81A10414547D12C747F +:1061D000BEB34FF0000810AA4FF0070ACDE90282C3 +:1061E000CDE900A80DF13C091023CDF810904246EE +:1061F0003146584605F0F5FE08BBBDF83C002A467E +:10620000C0B210A90AF01EF9C8B9AE81CFB1CDE96C +:1062100000A80DF1080C0AAE40468CE84102132399 +:1062200000223946584605F0DCFE40B9BDF83C0076 +:10623000F11CC01EC0B22A1D0AF004F910B10320DF +:1062400098E70AE0BDF82900E881062C05D19DF801 +:106250001E00A872BDF81C00288100208AE705A84E +:1062600005F018FE00288BD0FFF75DFE82E72DE9D0 +:10627000F8439846DDE9087614460D00814600D1C2 +:10628000FFDF0CB1012100E0002105F1080004F05E +:10629000FCFC3080024600232146484602F00AFCFE +:1062A00040B10097328843462146484602F07FFCC1 +:1062B000BDE8F883072C01D01120F9E743F2040070 +:1062C000F6E72DE9F0438BB00D46DDE912878146F4 +:1062D0001C461646142103A819F09DF9012002213D +:1062E0008DF810108DF80C008DF81170ADF8146059 +:1062F00064B1A178C90709D08DF81600E088ADF81F +:106300001A00A088ADF81800A06807900AA908A88C +:10631000CDE9000109AB002229464846FFF7A7FF57 +:1063200000280ED1DDE90801CDE9001008350AABDF +:106330004246029503A9484605F062F820B1FFF7EE +:1063400028FE0BB0BDE8F08308980090BDF8283017 +:1063500004220021484602F0FEFCF2E7F0B58BB0C3 +:1063600000240646069407940727089405A8099474 +:10637000019400970294CDE903400D461023224674 +:10638000304605F02EFE78B90AA806A901940097B8 +:106390000294CDE90310BDF814300022294630469E +:1063A00005F0F5FB002801D0FFF7BDFD0BB0F0BDF7 +:1063B00005F09DBA2DE9FC410C468046002601F00F +:1063C00080FF054620780D2871D2DFE800F099079C +:1063D0000B90189A3C3C55768C7B8100404601F02E +:1063E0009FFF8EE00421404608F075FB070000D1B6 +:1063F000FFDF07F10801404604F0DEFB50E0042116 +:10640000404608F068FB070000D1FFDFE088ADF8E8 +:106410000000002038809DF80000010704D5C00668 +:1064200002D5A088388005E09DF80100400668D5B7 +:10643000A088788005B9FFDF22462946404601F052 +:10644000CFFB02265DE0E188ADF800109DF8011059 +:1064500009060ED5072802D0062809D009E0042134 +:10646000404608F038FB060000D1FFDFA0887080AE +:106470000226B5B9FFDF14E00421404608F02BFBEB +:10648000070000D1FFDF07F1080005F067FA90F080 +:10649000010F02D1E079000633D50226A7F8048067 +:1064A00035B122462946404601F09AFB29E027E013 +:1064B00013214046FCF714FB23E00226002DF0D107 +:1064C000FFDFEEE702260121404601F06DFF18E0F4 +:1064D000606800902089ADF80400012269464046BA +:1064E00001F083FF0DE0002DDBD1FFDFD9E70226AD +:1064F00000214046FFF74CFB002DD2D1FFDFD0E753 +:10650000FFDF3046BDE8FC813EB50C0009D00146F6 +:106510006B4601AA002005F0E6FD20B1FFF703FD60 +:106520003EBD10203EBD00202080A0709DF80500DB +:1065300002A900F00700FEF743F850B99DF80800E3 +:1065400020709DF8050002A9C0F3C200FEF738F8DC +:1065500008B103203EBD9DF8080060709DF805005D +:10656000C109A07861F30410A0709DF80510890995 +:1065700061F3C300A0709DF80410890601D50221C3 +:1065800000E0012161F342009DF8001061F300007A +:10659000A07000203EBD70B5144606460D4651EA77 +:1065A000040005D075B108460CF020F978B901E077 +:1065B000072070BD2946304605F0F6FD10B1BDE854 +:1065C0007040B0E454B120460CF010F908B110202E +:1065D00070BD21463046BDE8704095E7002070BD93 +:1065E0002DE9FE4F05460C46007A0A31009104F170 +:1065F00008010291904600270C31821E3E464FF062 +:10660000020B4FF0010A0191092A75D2DFE802F06E +:10661000F3F20574252577B6F4006888042108F0A4 +:106620005AFA060000D1FFDF308810B15227072642 +:10663000E9E051271026002C7ED06888A08084F8DD +:1066400006A0A88900220099FFF7A5FF002874D1B1 +:10665000A8892081288AE081F8E0B5F812900728FF +:1066600025D1E87B000622D5512709F1140086B216 +:10667000002CE1D0A88900220099FFF78CFF0028A8 +:106680007AD16888A08084F806B0A889208184F82F +:106690000EA0288A2082A4F81290A88A0090688808 +:1066A0004B46A969DDF8042001F077FACEE05027C7 +:1066B00009F1120086B2002C3ED0A889002202996E +:1066C000FFF769FF002857D16888A080A889E0807B +:1066D000287A072811D002202073288AE081E87BDD +:1066E0004B46C0096073A4F81090A88A009068888F +:1066F00004F11202A969D7E7A7E00120ECE7688856 +:10670000042108F0E8F9B5F812A05FEA000900D109 +:10671000FFDF09F1080005F021F990F0010F02D127 +:10672000E87B000627D50AF11400512786B2002C19 +:106730007FD06888A08001E070E01DE0A889002279 +:106740000099FFF728FF002816D184F806B0A88921 +:1067500020810420A073288A2082A4F812A0A88A8D +:10676000009068885346A969019A01F016FAA98930 +:10677000A9F802106AE00320BDE8FE8F6888FAF7E6 +:106780004DFE82466888042108F0A5F98146BAF1D9 +:10679000000F00D1FFDFB9F1000F00D1FFDFB9F822 +:1067A0000400A0F57F41FF3902D05127142601E0F3 +:1067B0005027122694B36888A080502F06D084F802 +:1067C00006B0287B029901F0F8F93FE0287BA11D73 +:1067D00001F0F3F900219AF82300CDE900010B46FE +:1067E000B9F8022068884946FFF76BFD0028C3D13D +:1067F0002CE001E013E01FE0FE49A889C98881422E +:1068000005D1542706264CB16888A0801EE0532786 +:106810000CE06888A080A889E08017E009E068881B +:10682000042108F058F900B9FFDF55270826002C8D +:10683000EFD1A8F800600EE056270726002CF8D00C +:106840006888A0800020A07100E0FFDFA8F8006049 +:106850000CB12780668000208EE7E6490020087092 +:10686000704710B586B0002221F8022B044621F8AB +:10687000022B4FF6FF7021F8040B204604F083F939 +:106880006A460121204605F0F9FA19E09DF8030057 +:10689000000715D5BDF806102046FFF75FFD9DF8EF +:1068A0000300BDF8061040F010008DF80300BDF89D +:1068B0000300ADF81400FF232046059A05F03FFCC5 +:1068C000684605F0E7FA0028E0D006B010BD0831B0 +:1068D00004F079B970B50546042108F0FCF804000D +:1068E00000D1FFDF04F108012846BDE8704004F044 +:1068F00063B970B58EB00C460646FAF78FFD0500F9 +:1069000005D02878222805D208200EB070BD43F2A9 +:106910000200FAE70CB1A08870B101208DF81400D4 +:1069200003208DF8180000208DF8190034B1A088DC +:10693000ADF82000206803E00920E6E7ADF820006C +:1069400007900421304608F0C6F8040000D1FFDFAC +:106950000AA903A8CDE9000104AB00222146304674 +:10696000FFF785FC0028D0D1DDE9031004F108020F +:106970008DE8070095F823200AAB05A9304604F0FE +:106980003FFD10B1FFF705FBBFE703980090BDF88E +:10699000283004220021304602F0DDF94FF6FF7165 +:1069A000A180B2E72DE9FF4F85B01F46DDE91390C6 +:1069B000904646888B463046DDF848A0FAF72EFD13 +:1069C00005460421304608F086F8044605B9FFDF85 +:1069D00004B9FFDF0834CDF808A0CDE90394CDE970 +:1069E000008795F823205B463046059904F05DF951 +:1069F00009B0BDE8F08F2DE9F04F9BB004464FF091 +:106A000000087C48ADF85480ADF82C80ADF850807B +:106A1000A0F80480ADF81480ADF81880ADF820809F +:106A2000ADF81C80007816460D464746012808D070 +:106A3000022806D0032804D0042802D008201BB066 +:106A4000D7E720460BF090FED0BB28460BF08CFE1B +:106A5000B0BB60680BF0D3FE90BB606848B1608942 +:106A60002189884202D8B1F5007F01D90C20E6E7E0 +:106A700080460AAA06A92846FFF7E5FA0028DED1D3 +:106A800068688078C0F34100022808D19DF8190099 +:106A900010F0380F03D028690BF0A8FE80B905A9C3 +:106AA0002069FFF788FA0028C9D1206950B16078C1 +:106AB00080079DF8150000F0380002D5E8B301E02A +:106AC00011E0D0BB9DF8140080060ED59DF815008E +:106AD00010F0380F03D060680BF088FE18B96068BA +:106AE0000BF08DFE08B11020A9E707A96069FFF738 +:106AF00062FA0028A3D1606940B19DF81D0000F042 +:106B0000070101293BD110F0380F38D008A9A0693E +:106B1000FFF751FA002892D19DF81C0080062ED470 +:106B20009DF8200080062AD4A06950B19DF821006C +:106B300000F00701012922D100E020E010F0380F19 +:106B40001DD0E06818B10078C8B11C2817D20EAA71 +:106B5000611C2046FFF79EFA0120B94660F30F271B +:106B6000BA4607468DF84E0042F60300ADF84C00D9 +:106B70000DF13B0217A9286809F083FC08B1072032 +:106B80005DE79DF85C0016A9CDF80090C01CCDE92A +:106B9000019100F0FF0B00230BF20122514613A8D4 +:106BA00005F0AFF840BBBDF858000D9011492A8997 +:106BB0002869091D0092CDE901016B89BDF82820E3 +:106BC0002868069905F09DF801007DD120784FF0E6 +:106BD000020AC10601D480062DD5ADF80C9060697B +:106BE00070B907A906A8FFF786FA9DF81D0020F0E6 +:106BF000070002E0F002002036E0401C8DF81D0086 +:106C00009DF81C008DF84E7040F0C8008DF81C00F7 +:106C100042F60210ADF84C000BA903AACDF800A073 +:106C2000CDE90121002340F2032213A8079905F0C2 +:106C300068F8010048D1FC484D465B468088ADF8B5 +:106C400039000EA8CDE90290CDF80490CDF810904F +:106C50004FF007090022CDF80090BDF858104FF60C +:106C6000FF7004F094FF10B1FFF75DF9E7E69DF8BF +:106C70003800000625D52946012060F30F218DF844 +:106C80004E704FF42450ADF84C00ADF810506278BF +:106C90009DF81000002362F300008DF81000627868 +:106CA000CDF800A0520862F341008DF8100004AA4C +:106CB000CDE9012540F2032213A805F022F80100D6 +:106CC00002D1606850B300E081E0206960B905A995 +:106CD00006A8FFF710FA6078800705D49DF8150024 +:106CE00020F038008DF815008DF84E7042F6011036 +:106CF000ADF84C00208940F20121B0FBF1F201FB1C +:106D00001202606814ABCDF80080CDE901030023C6 +:106D100013A8059904F0F5FF010058D12078C007A9 +:106D200029D0ADF80C50A06950B908A906A8FFF702 +:106D3000E2F99DF8210020F00700401C8DF82100A9 +:106D40009DF820008DF84E7040F040008DF8200036 +:106D500042F60310ADF84C0015A903AACDF800A027 +:106D6000CDE90121002340F2032213A8089904F081 +:106D7000C8FF01002BD1E06868B32946012060F309 +:106D80000F218DF84E7042F60410ADF84C00E0680B +:106D9000002302788DF8602040788DF86100E0686B +:106DA00018AA4088ADF86200E06800798DF86400A8 +:106DB000E068C088ADF86500CDF80090CDE9012508 +:106DC0004FF4027213A804F09CFF010003D00D9849 +:106DD00000F01CFF33E694480321017056B180880F +:106DE0003080BDF850007080BDF82C00B080BDF838 +:106DF0005400F080002022E670B501258AB01646C6 +:106E00000B46012802D0022816D104E08DF80E505E +:106E10004FF4205003E08DF80E5042F60100ADF81B +:106E20000C0063B10024601C60F30F2404AA08A9BD +:106E3000184609F026FB20B107200AB070BD1020CB +:106E4000FBE704A99DF820207748CDE90021801CAC +:106E500002900023214603A802F2012204F051FF10 +:106E600010B1FFF760F8E8E76F480EB14188318054 +:106E700005700020E1E770B594B0044601268DF856 +:106E80003E6041F60100ADF83C0012AA0FA9304661 +:106E9000FFF7B2FF002848D12078634CC0074FF0BD +:106EA000000544D01C2102A818F0B5FB9DF808008D +:106EB0008DF83E6040F020008DF8080042F6052075 +:106EC000ADF83C000E959DF83A00119520F00600B3 +:106ED000801C8DF83A009DF838006A4620F0FF00CB +:106EE0008DF838009DF8390009A920F0FF008DF8D1 +:106EF00039000420ADF82C00ADF830000EA80A903F +:106F000011A80D900FA80990ADF82E5002A8FFF718 +:106F100072FD002809D1BDF80000E080BDF8040032 +:106F20002081401C60812570002014B070BDE58078 +:106F30002581BDF84800F4E72DE9F74F3A49A0B0A4 +:106F40004FF000090A78012A04D0022A02D0082052 +:106F500023B04EE54A88824201D00620F8E7219806 +:106F60008A46824201D10720F2E70024012021460F +:106F7000621CADF848004FF6FF7862F30F218DF8E0 +:106F80006E000691ADF84A8042F6020B8DF8724011 +:106F90001CA9ADF86CB0ADF870401391ADF85080FD +:106FA00012A804F09BFF00252E462F460DAB0722AA +:106FB00012A9404604F095FF78B182285FD195B3BD +:106FC0008EB3ADF86450ADF866609DF85E008DF844 +:106FD000144019AC012866D06DE09DF83A002FB33B +:106FE00001285BD1BDF83810594521D118A809A94D +:106FF00001940294CDE9031007200090BDF83610EB +:1070000010230022404604F0ECFFC0BBBDF8600036 +:10701000042801D006284CD1BDF8241021988142C3 +:107020003CD10F2094E73CE0F0020020012835D14C +:10703000BDF83800B0F5205F03D042F60101884268 +:107040002CD1BAF80200BDF83610884201D10127D0 +:1070500000E0002705B19EB1219881421ED118A8F9 +:1070600009AA01940294CDE90320072000900D465F +:1070700010230022404604F0B4FF00B902E02DE0E6 +:107080004E460BE0BDF86000022801D0102810D158 +:10709000C0B217AA09A909F0D5F950B9BDF83690C0 +:1070A00084E7052054E705A917A8221D09F0E9F98E +:1070B00008B103204CE79DF814000023001DC2B264 +:1070C0008DF8142022980092CDE901401BA8069962 +:1070D00004F017FE10B902228AF80020FEF723FF01 +:1070E00036E710B50B46401E88B084B205AA0021D1 +:1070F0001846FEF7CFFF00200DF1080C06AA05A9DF +:1071000001908CE80700072000900123002221460F +:107110004FF6FF7004F03BFD0446BDF8180001284F +:1071200000D0FFDF2046FEF7FEFE08B010BDF0B530 +:10713000FE4F044687B038780E46032804D0042852 +:1071400002D0082007B0F0BD04AA03A92046FEF72C +:107150007AFF0500F6D160688078C0F3410002280C +:107160000AD19DF80D0010F0380F05D020690BF002 +:107170003DFB08B11020E5E7208905AA21698DE8CB +:1071800007006389BDF810202068039904F0B9FD59 +:1071900010B1FEF7C8FED5E716B1BDF81400308077 +:1071A000042038702846CDE7F8B50C0006460CD010 +:1071B00001464FF6FF7500236A46284604F093FF08 +:1071C00028B100BFFEF7AFFEF8BD1020F8BD69463C +:1071D0002046FEF7F0FE0028F8D1A078314600F0F6 +:1071E00001032846009A04F0AAFFEBE730B587B008 +:1071F000144600220DF1080C05AD01928CE82C001C +:10720000072200920A46014623884FF6FF7004F0D9 +:10721000BEFCBDF814102180FEF785FE07B030BD1E +:1072200070B50D46042107F056FC040000D1FFDFC5 +:10723000294604F10800BDE8704003F0E3BC70B5D6 +:107240000D46042107F047FC040000D1FFDF29466A +:1072500004F10800BDE8704003F0FABC70B50D46BB +:10726000042107F038FC040000D1FFDF294604F1B7 +:107270000800BDE8704003F008BD70B50D4604215C +:1072800007F029FC040000D1FFDF294604F10800C3 +:10729000BDE8704003F003BD0121FEF779BC2DE984 +:1072A000F04194B04FF000060C008046ADF8146039 +:1072B0001AD0E06828B1A068B0B10188ADF8141008 +:1072C00006804046FAF7AAF8050043F2020757D0B5 +:1072D0002878222852D3A078012807D0022805D088 +:1072E000072014B0BDE8F0811020FAE7208878B1BB +:1072F000401C81B208AA404604F0C0FD08A804F072 +:10730000C9FD9DF82A204FF45051012A0DD102E009 +:1073100043F20300E5E7BDF82820A2F52453023B21 +:1073200003D1822801D098B901E00846D9E7E06886 +:10733000A8B105A901960296CDE9030107200090A6 +:10734000A2882188BDF81430404604F020FC10B11A +:10735000FEF7E9FDC5E7A168BDF8140008809DF8B7 +:107360002300C00602D543F20140BAE70C9838B1B9 +:10737000A1780078012905D0800708D40820B0E75B +:107380003846AEE7C007F9D00726022001E0012603 +:1073900003208DF834009DF8240010F0380F00D140 +:1073A000FFDF9DF824006249C0F3C200084495F84D +:1073B000231010F8010C884201D90F2091E7208892 +:1073C000ADF838000421404607F085FB040000D1E9 +:1073D000FFDF12A907A8CDE9000106AB324621461E +:1073E0004046FEF744FF002894D1DDE90601083449 +:1073F0008DE8130012AB07220DA9404604F000F8F7 +:1074000010B1FEF7C6FD6CE707980090BDF8483054 +:1074100004223146404601F09EFC62E770B5064604 +:1074200015460C460846FEF73DFD002805D12A46C4 +:1074300021463046BDE87040DEE470BD7CE570B5A5 +:107440001E4614460D0009D044B1616831B138B10F +:1074500036494988814203D0072070BD102070BD95 +:107460002068FEF71FFD0028F9D132462146284644 +:10747000BDE87040FFF7BFBA70B515460C0006D0E6 +:1074800038B12A498988814203D0072070BD102075 +:1074900070BD2068FEF706FD0028F9D12946204678 +:1074A000BDE8704043E670B5064686B00D4614460A +:1074B00010460BF07DF9E8BB60680BF0A0F9C8BB83 +:1074C000A6F57F40FF3803D03046F9F7A7FF80B11B +:1074D00028466946FEF731FE00280CD19DF81010B1 +:1074E0000F20082940D2DFE801F008060606060A48 +:1074F0000A0843F2020006B070BD0320FBE79DF8C6 +:107500000210012908D1BDF80010B1F5C05FF2D01A +:107510006FF4C052D142EED09DF80610012911D16E +:10752000BDF80410A1F52851062904E0F00200205E +:10753000A6F9010029E005D2DFE801F00303040306 +:107540000303D8E79DF80A1001290ED1BDF80810F1 +:10755000B1F5245FCFD0A1F524510239CBD0012958 +:10756000C9D0022901D1C6E7FFDF606878B90023DE +:1075700005AA2946304604F0B6FD10B1FEF7D3FC4B +:10758000B9E79DF81400800601D41020B3E76188A4 +:10759000224628466368FFF729FEACE72DE9F04351 +:1075A000814687B08846144610460BF001F918B1A1 +:1075B000102007B0BDE8F083002306AA41464846E4 +:1075C00004F091FD18B100BFFEF7ADFCF1E79DF8A6 +:1075D0001800C00602D543F20140EAE7002507275C +:1075E00005A8019500970295CDE9035062884FF6F2 +:1075F000FF734146484604F0F4FC060013D160686E +:107600000BF0D6F860B960680195CDE9025000979B +:107610000495238862884146484604F0E2FC064609 +:10762000BDF8140020803046CEE739B1F84B0A8807 +:107630001B899A4202D843F2030070472FE610B527 +:1076400086B0F34C0423ADF81430E38843B12489A9 +:107650008C4201D2914205D943F2030006B010BD1D +:107660000620FBE7ADF81010002100910191ADF864 +:10767000003002218DF8021005A9029104A903919E +:10768000ADF812206946FFF70AFEE7E72DE9FC474F +:1076900081460F4608460BF067F888BB4846F9F765 +:1076A000BDFE5FEA00080AD098F80000222829D31E +:1076B0000421484607F00FFA060005D103E043F223 +:1076C0000200BDE8FC87FFDF06F1080003F0A1FA25 +:1076D00005463878012803D0022804D00720F0E7B7 +:1076E000A8070FD502E015F0340F0BD0B8793C1D78 +:1076F000C00709D0E08838B1A0680BF035F818B1A0 +:107700001020DEE70820DCE73A782088002128B343 +:10771000A0F201130721112B18D20CD2DFE803F0DD +:107720000B090D0B1D0B121D100B0B1D1D1D1D0B31 +:107730001D00022A11D10846C3E7012AFBD00CE044 +:10774000EA0600E0AA06002AF5DA06E0A0F5C07213 +:107750001F2A02D97D3A022AEDD8C1B298F8230037 +:10776000CDE900017288234631464846FEF7A9FD5F +:10777000A7E72DE9FF4F8BB01E4615460C464FF08C +:1077800000080F460B98F9F749FE30B1007822281F +:1077900006D208200FB0BDE8F08F43F20200F9E7EF +:1077A000B00801D00720F5E7032E00D100264FF6E0 +:1077B000FF7ACCB1022D70D320460BF020F830B9FF +:1077C00004EB0509A9F101000BF019F808B110202C +:1077D000E0E7AD1EAAB22146504604F08CFD39F810 +:1077E000021C884259D1ADB28948B10702D501893E +:1077F000491C00E001211FFA81F9F10701D0068937 +:1078000000E0564605AA49460B9804F037FB4FF0B6 +:10781000070B4FF0000A0BE0788810283DD808F1DC +:10782000040108441FFA80F8A84536D804EB08077D +:10783000AFB339884945EFD351E000BF9DF8170039 +:1078400002074CD564B304EB080708F104027B88F7 +:107850001FFA82F8102B20D803EB0802AA421CD88A +:107860003A88914219D1C0061BD5CDE900BA0DF175 +:1078700008090AAA04EB0801504689E8070039887C +:1078800000220B9804F083F910B1FEF74CFB81E75E +:107890007888BDF82810884203D00B207AE71EE0D4 +:1078A00005E0798801EB08001FFA80F806E0C006C1 +:1078B00004D50B98FEF752FD002889D19DF81700DA +:1078C000BDF81A1020F010008DF81700BDF8170051 +:1078D000ADF80000FF23009A0B9804F030FC05A8D7 +:1078E00004F0D8FA18B9BDF81A10B142A6D904218B +:1078F0000B9807F0F0F8040000D1FFDF22885AB19E +:10790000CDE900BA5546002321460B98FEF7D9FC75 +:107910000028BCD125803DE700203BE72DE9FF4F43 +:107920008BB01E4617000D464FF0000411D0B00872 +:1079300001D007202EE7032E00D100265DB10846B6 +:107940000AF054FF28B93888691E08440AF04EFF2F +:1079500008B110201EE72E4AB00701D5518900E07A +:107960000121F0074FF6FF7802D05089401E00E059 +:10797000404686B206AA0B9804F080FA4FF0000940 +:107980004FF0070B0DF1140A39E000BF9DF81B0002 +:10799000000734D5CDF80490CDF800B0CDF80890AC +:1079A000CDE9039A434600220B9804F01AFB60BB12 +:1079B00005B3BDF814103A8821442819091D8A42DC +:1079C00032D3BDF81E2020F8022BBDF8142020F879 +:1079D000022BCDE900B9CDE90290CDF810A0BDF899 +:1079E0001E10BDF8143000220B9804F0FAFA08B10A +:1079F0000320CFE6BDF814002044001D84B206A881 +:107A000004F048FA30B1822808D0FEF78CFAC1E6BB +:107A1000F0020020BDF81E10B142B7D934B17DB1DB +:107A20003888A11C884203D20C20B3E60520B1E6B9 +:107A300022462946404604F05EFC01462819018092 +:107A4000A41C3C800020A5E610B504460AF0B0FE58 +:107A500008B1102010BD734840892080002010BD5F +:107A6000F0B5A3B00C4606460025142105A817F072 +:107A7000D2FD01208DF814008DF8180000208DF83B +:107A80001900ADF81C403046F9F7C8FC28B1007861 +:107A9000222805D2082023B0F0BD43F20200FAE705 +:107AA0000421304607F017F8070000D1FFDF0AA9CC +:107AB00003A8CDE9000104AB002239463046FEF7A9 +:107AC000D6FB0028E7D1DDE90301CDE90010083736 +:107AD0000AAB0722029705A9304603F091FC10B1CA +:107AE000FEF757FAD7E703980090BDF82830042234 +:107AF0002946304601F02FF900B1FFDF214630461C +:107B0000FEF738F816A9384603F072F800B1FFDF27 +:107B1000BDF85800172801D2172100E00146A14204 +:107B200004D8172801D2172400E004462146304625 +:107B3000FFF785FB074621463046FDF798FD2946AD +:107B4000304601F0A9FB00B9FFDF27BB3046F9F74B +:107B500065FC050000D1FFDF95F822001B281AD92B +:107B6000172C18D93A208DF82C00ADF82E6095F816 +:107B70002200211D884201D9241D00E00446ADF8F1 +:107B8000304040F64800ADF8320017A90BA804F0C9 +:107B900039FB00B1FFDF00207DE7F8B51C46154634 +:107BA0000E46069F07F0F2F82346FF1DBCB2314691 +:107BB0002A46009406F0D9FCF8BD70B50C4605467F +:107BC0000E21204617F005FD002020802DB1012D4B +:107BD00001D0FFDF70BD062000E00520A07170BD60 +:107BE00010B548800878144620F00F00001D20F0E2 +:107BF000F00080300B4608701422214603F1080083 +:107C000017F0B5FCBDE8104000F05EBB10B50C46A7 +:107C100004F000F900B1FFDF2046BDE81040FEF798 +:107C200082B90000F002002010B50446007896B03A +:107C3000022805D0012803D043F2050016B010BD7C +:107C4000A17889290AD06078892807D021B1032931 +:107C500002D808B1032801D90720EFE750208DF89A +:107C600000002078022801D0012000E000208DF8DB +:107C70000200607800F016FEC01D8DF80300A078A9 +:107C8000012815D000F00EFE10F101008DF804005F +:107C9000607800F007FE8DF80500A07800F002FE85 +:107CA0008DF806009DF805200621102A04D005E075 +:107CB000022000F0F7FDE9E78DF80510102801D14A +:107CC0008DF806102078012804D19DF80300401C8F +:107CD0008DF8030002F07EF9001DADF808000BA935 +:107CE000684604F08FFA00B1FFDF0020A6E72DE917 +:107CF000FF4FF94991B00600D1E900010396CDE9A3 +:107D00000C01507A117A15460844C7B222D00024DB +:107D10004FF00009CDF81C904FF0050BADF81CB0EA +:107D20001F20ADF81E00EDA00690CDF81490F01DB8 +:107D30008DF814904FF0010A20F007008DF815A07F +:107D4000B04200D0FFDF28880399401C1FFA80F85A +:107D500014B107E00124DBE708F0FF0008F018FB8E +:107D600000B1FFDF03993A4601EB0810C01C20F078 +:107D70000301D5F8188003913CB981F800901FFAEF +:107D800088F003F0CBFE00B1FFDF0399234601EB3F +:107D900008000390A87A297A3A460844C1B203A899 +:107DA00000F0CEFD0398C01C20F003000390697A18 +:107DB00000912B7AAA7A04B1002002A906F067FD8F +:107DC00000B1FFDFBDF8081003983A460844DDE92A +:107DD0001F31C01C20F00300DDF850C01E9FCDE90C +:107DE0000210CDE9007304B10020634608A906F033 +:107DF000D9FE00B1FFDF089903980844C01D20F0A8 +:107E0000070003901299821B002C0A6040D1B64AE9 +:107E1000B4491160111D401E086001232C220EA9D7 +:107E2000B24806F0B4FC00F04BFD00211E220846CB +:107E300002F0E0F8FAF776FA00F0EAFEFEF70DFD40 +:107E4000E8680CAA214620B1FBF7EBF830B1FFDF60 +:107E500004E005A8FBF7E5F800B1FFDF05F1140029 +:107E6000FFF709F800B1FFDF4FF4A871A04817F041 +:107E7000D2FB9F48022180F849A180F84AA180F8EE +:107E80004B1180F84C91062180F84D1180F804B018 +:107E900015B0BDE8F08F70B5954D0646287805EB16 +:107EA0004014E8780834A0B9A81990F848010028CF +:107EB00010D0A8780A2800D3FFDF207820F0FF0038 +:107EC0002070607866F3020020F0080060700120E6 +:107ED000E870204670BD2DE9F04105460C460027AC +:107EE0000078052190463E46B1EB101F00D0FFDF21 +:107EF000287A58B101280FD0FFDF00BFA8F8006032 +:107F00000CB1278066800020BDE8F0810227092699 +:107F100074B16888A08008E00327142644B16888FB +:107F2000A0802869E060A88A2082287B2072E5E78B +:107F3000A8F80060E7E700B597B051218DF8001070 +:107F400000780BA900F001008DF80200684604F0EB +:107F500059F917B000BD00B5017897B001F00101E3 +:107F60008DF80210417801F001018DF803100178BD +:107F7000C1F340018DF804104178C1F340018DF840 +:107F80000510017889088DF80610417889088DF868 +:107F9000071081788DF80810C1788DF809100079E4 +:107FA0008DF80A004D208DF800000BA9684604F0FA +:107FB00029F9CEE72DE9F04F4D4E97B04FF6FF7AF5 +:107FC0004FF0000996F8490108B3022000F044FD83 +:107FD0000120FFF760FF0446444806F009FC60609A +:107FE00000B9FFDF606804F05AF960B12046F9F784 +:107FF00082FC204600F035FD0028E3D13B48616853 +:1080000006F0FFFBDEE73948616806F0FAFB49201D +:108010008DF82C0069460BA804F0F4F800B1FFDFDE +:10802000002581E068460DEB050400EB4501A07DCD +:10803000B1F80680C10704D0400702D4404601F0E1 +:108040000DF9A07D80076DD5404606F09FFE040027 +:1080500000D1FFDF0321404606F03DFD070050D16F +:10806000FFDF4EE0786810B10078FF2851D004207F +:1080700000F0F2FC0320FFF70EFF8346204606F0D7 +:1080800005FACBF8040000B9FFDFDBF8040006F0C6 +:10809000DFFA00210B900170ABF80280584600F027 +:1080A000AEFE204606F0D6FA00B9FFDFC2465846BB +:1080B00000F0D7FC18B99BF80100000702D50B9817 +:1080C00078601EE07868A8B10178491C11F0FF01C2 +:1080D000017016D1FFDF14E0ACF901006E52463595 +:1080E0007800000000000020000602407C0500200F +:1080F0002C04002000221146204600F0D1FB00B9DC +:10810000FFDF96F84B0120B1404600F03CFE00280E +:10811000A8D196F8490128B1204606F011FB08B114 +:108120004FF001096D1CEDB29DF80400A8423FF626 +:1081300079AFB9F1000F7FF443AFAAF57F41FF3962 +:108140000AD04A218DF80010ADF802A00BA96846AC +:1081500004F058F800B1FFDF17B00520BDE8F04F7C +:1081600000F07ABC10B5FC4CA0600868E060AFF28B +:10817000BB1001F088FE607010BDF7490020087048 +:10818000704730B505464FF080500C46D0F8A4102B +:1081900097B0491C05D1D0F8A810C9430904090CAF +:1081A00008D050F8A01F01F001012970416821603A +:1081B00080680EE02B208DF800000BA9684604F0C3 +:1081C00021F800B1FFDF012028700C982060BDF875 +:1081D0003400A0802878002803D0607940F0C000E7 +:1081E000607117B030BDF0B54FF080540746D4F839 +:1081F000800097B00D462B26401C0BD1D4F884008C +:10820000401C07D1D4F88800401C03D1D4F88C005E +:10821000401C0BD0D4F880003860D4F8840078601B +:10822000D4F88800B860D4F88C0016E08DF82C6083 +:1082300069460BA803F0E6FF00B1FFDF0198386044 +:10824000029878608DF82C6069460BA803F0DAFF7D +:1082500000B1FFDF0198B8600298F860D4F8900090 +:10826000401C0BD1D4F89400401C07D1D4F89800DE +:10827000401C03D1D4F89C00401C08D054F8900F47 +:10828000286060686860A068A860E06816E08DF803 +:1082900000600BA9684603F0B5FF00B1FFDF0C9842 +:1082A00028600D9868608DF800600BA9684603F09F +:1082B000A9FF00B1FFDF0C98A8600D98E86017B027 +:1082C000F0BDA6480079E6E570B5A44CE07828B387 +:1082D000207804EB4010407A00F00700204490F82A +:1082E000480100B9FFDF2078002504EB4010407AF8 +:1082F00000F00700011991F84801401E81F848017B +:108300002078401CC0B220700A2800D12570A078C7 +:10831000401CA07009F0C3FDE57070BDFFDF70BDAB +:108320003EB50546032106F0D6FB0446284606F076 +:108330002DFD054604B9FFDF606818B10078FF28FD +:1083400000D1FFDF01AA6946284600F0A9FA60B90A +:10835000FFDF0AE0002202A9284600F0A1FA00B9D6 +:10836000FFDF9DF8080000B1FFDF9DF80000411E0F +:108370008DF80010EED260680199884201D100208A +:108380006060764C94F84B01022800D3FFDF94F82C +:108390004B0118B97048407801F094FD94F84B01F6 +:1083A000401C84F84B013EBD70B50546A0F57F40EA +:1083B0000C46FF3800D1FFDF012C01D0FFDF70BD7C +:1083C000FFF77FFF040000D1FFDF207820F00F00CF +:1083D000401D20F0F0005030207065800020207299 +:1083E00001202073BDE870406EE770B515460C465D +:1083F0000646FFF766FF90B1017821F00F01491D95 +:1084000021F0F00150310170468001210172216894 +:108410000161A18881820573BDE8704054E7304650 +:10842000BDE870401321FAF75BBB70B505460C46FA +:1084300008460AF0BDF908B1102070BD2846F8F7CB +:10844000EDFF28B1284600F018FF2070002070BD15 +:1084500043F2020070BD2DE9F04F04463E488946C4 +:1084600087B0017811B1082007B012E53A483C49BD +:10847000416020460AF09CF900287DD148460AF068 +:1084800097F9002878D1637A217A5818FF286AD89A +:108490002088FE2867D800B90A202080A06908B982 +:1084A0004FF4B060A0616068A0B14578827805EBB8 +:1084B00045052A440578067905EB450502EB45029A +:1084C0004579C07805EB450505EB8605C0EBC00096 +:1084D000284409E003EB430001EB410200EB4202B8 +:1084E000C1EBC10505EB830086B2C3EBC3001044AA +:1084F000C1EBC1021044084487B2208A01F060FD3C +:108500000028B1D101F066FD001D7843059001F00F +:1085100061FD001D00FB06F8E168A06900F05CFA4F +:108520005FEA000AA0D1A17A607A814236D84FF082 +:10853000120B08280ED8207A01280BD808F093F8DF +:10854000054609F06BFC2A1A217A607A521E0B1834 +:108550009A4209DA584687E71C0000202C040020C4 +:108560004813002008E019E065688B460090BDB113 +:1085700028460AF044F908B1102075E7A978687810 +:1085800008442978421800985844904206D16A79E4 +:1085900029791144EA781144884201D0072063E721 +:1085A000CDF80080CDE90176224603A90020059B85 +:1085B000FFF79DFBF84D039AD9F800306868111851 +:1085C000994202D8B2F5803F03D30420C9F80010C5 +:1085D0004AE7CDF80080CDE90176224604A9059B43 +:1085E000FFF785FBDDE90301884200D0FFDF049837 +:1085F000696808446860C9F80000E84901202870EB +:108600000870504630E72DE9F04707460C4608460B +:108610000AF0CEF840B938460AF0E8F820B9F81C5C +:1086200020F00300B84202D01020BDE8F087DC48FB +:108630004FF00008817889B14178824600EB4115FE +:10864000B4F8009015F8080F234600F00F00002240 +:10865000294600F013FA060004D013E0A4F80080C5 +:108660000520E2E797B12188494501D90C260DE0A4 +:108670002878234600F00F003A46294600F0FEF91C +:10868000060005D00C2E01D0A4F800803046CCE7BF +:108690009AF801005446401CC0B28AF801000A282A +:1086A00001D184F80180A078401EA070697801F0A3 +:1086B0000700062827D2DFE800F026091E031E1E49 +:1086C0000807E3D46888FFF72BFEDFE7B548696841 +:1086D00006F097F894F8490130B9AF48407801F0B6 +:1086E000F1FB94F8490100B1FFDF94F84901401C07 +:1086F00084F84901CAE700EB0A0191F84801401CDF +:1087000081F84801C2E7FFDFC0E770B50D460446B7 +:108710000AF02AF818B928460AF04AF808B11020D9 +:1087200070BD29462046BDE8704007F068BE70B5B0 +:10873000044615460E4608460AF016F818B92846AB +:108740000AF036F808B1102070BD022C03D0102CAE +:1087500001D0092070BD2A463146204607F072FE3E +:108760000028F7D0052070BD70B514460D460646AA +:1087700009F0FAFF38B928460AF01AF818B9204665 +:108780000AF034F808B1102070BD22462946304660 +:1087900007F077FE0028F7D0072070BD10B596B01F +:1087A00004460AF005F810B1102016B010BD0F20D5 +:1087B0008DF800000BA9684603F024FD0028F4D1D1 +:1087C0009DF834002070BDF836006080BDF8380098 +:1087D000A0800020E9E770B505460C4608460AF07F +:1087E00005F820B93CB1206809F0E2FF08B110207B +:1087F00070BDA08828B121462846BDE87040FEF72C +:1088000078B8092070BD70B504460D46084609F0D9 +:10881000ABFF30B9601E1E2814D8284609F0A4FF0B +:1088200008B1102070BD032C01D9072070BD04B918 +:10883000FFDF5D4800EB840050F8041C2846BDE8CB +:1088400070400847A4F120001F28EED82946204692 +:10885000BDE87040F9F784BC70B504460D46084683 +:1088600009F0A6FF30B9601E1E280FD8284609F06F +:108870007BFF08B1102070BD012C03D0022C01D069 +:10888000032C01D1062070BD072070BDA4F120008B +:108890001F28F9D829462046BDE87040F9F701BDE8 +:1088A00005F07DBC892805D0032805D0022805D015 +:1088B0000120704710207047062070470320704742 +:1088C00010B596B0FAF790FB33484178806803F012 +:1088D00089FE314801240C300178012916D141214B +:1088E0008DF80010C0788DF8020010B1012803D077 +:1088F00005E08DF8024002E000208DF80200684695 +:1089000005F0EEF910B10BA803F02DFF02208DF851 +:108910002C008DF82D008DF82E000BA8FFF784F9A0 +:1089200000B1FFDF8DF82C4003208DF82D008DF86D +:108930002E000BA8FFF778F9002800D0FFDF34E7FE +:108940002DE9F0410646022012B101EB4200401D24 +:10895000C7B23068C01C20F003023260DBB9104897 +:108960003B460921243809F0F0FD002408E0092CD9 +:1089700024D2DFE804F005070509090B0B05050003 +:108980000A4804E00A4802E00A4800E00A4809F000 +:10899000FBFD054613E019E01C0000200800002044 +:1089A0002C0400207C050020CCF90100CD1F000024 +:1089B000AD8C0000DB9F000045010100FFDFA542F8 +:1089C00000D0FFDF641CE4B2092CD0D3306800EB88 +:1089D00007103060BDE8F08138B50C00054604D0C2 +:1089E000084609F0C1FE10BB02E0F62830D331E0A2 +:1089F000606809F0B9FED0B9607800F00300012882 +:108A000003D0022801D0072038BD69462046FBF775 +:108A1000BBFD0028F8D1607800F00300022808D1DF +:108A20009DF8000028B1606809F0E0FE08B1102050 +:108A300038BD6089F8280BD82189814208D861782F +:108A400001F00301012905D1D73080B2A84201D934 +:108A5000092038BD002038BD144908710020C870B5 +:108A600070471249CA782AB10A7801EB42110831DD +:108A7000814201D001207047002070472DE9F0416C +:108A8000044600201880601E1D4616460F46052825 +:108A900000D3FFDF06482A4600EB8400314650F839 +:108AA000043C3846BDE8F041184700002C04002083 +:108AB000B4F901002DE9F0478A4698461546064666 +:108AC000032106F008F80446304606F071F90D352A +:108AD000AFB2002581462E4604B9FFDFB9F1000F81 +:108AE00000D1FFDF04EB8A000189B94200D30125E0 +:108AF000218CB94202D2BAF1060F00D3012638EA1E +:108B0000050104D0817A41F0020181720BE038EA5C +:108B1000060108D0817A41F00401817214F8220F15 +:108B200040F00400207005EA0600BDE8F0872DE95A +:108B3000F0478246DDE90846174604F10D009946E4 +:108B40000D461FFA80F80023224639465046FFF7AB +:108B5000B1FF60B1A87800061BD426F8044C26F8B3 +:108B6000029C504606F024F9060008D106E0072FC3 +:108B700001D01120D9E743F20400D6E7FFDF241D1E +:108B80003046A1B205F002FA00B9FFDF504603F00B +:108B90008BFC05EB8700062F0289A2EB08010181FF +:108BA00003D2298CA1EB080028840020BDE72DE921 +:108BB000F8431D4617460E46DDF8208006F0F8F80B +:108BC00004001BD03F1DB9B205F090F92860C0B178 +:108BD00005F03EFD067020466A46296805F077FCE0 +:108BE000009800210A460180817003F01FFD009863 +:108BF000C01DC8F800000020BDE8F88343F2020061 +:108C0000FAE7072E01D01120F6E743F20400F3E75C +:108C100010B501F0DFF90021F74B0A4623F81120C7 +:108C2000491C0829FAD3F44A00F10D011032400022 +:108C3000118051801A3090804E20D0801181518156 +:108C4000C1EBC100908110BD70B50C46897821F050 +:108C5000FF01A170217821F00F01217001216170C5 +:108C60000021616006F0A4F8050000D1FFDF28466E +:108C700005F03AF9E04910318989401A20852046EB +:108C8000BDE8704000F0A0BB70B50D46032105F0B3 +:108C900022FF040000D1FFDFA07865F30600A0707A +:108CA00070BD70470146012009F01BBD3EB58DB275 +:108CB0000321284605F00FFF040000D1FFDF2078D4 +:108CC000002220F00F00207002208DF800004FF6E7 +:108CD000FF70ADF80200ADF8040069462846F9F7C8 +:108CE000E7F93EBD2DE9F84F05460C460027007810 +:108CF000012192463E46B1EB101F00D0FFDF287ADB +:108D0000032809D0FFDF00BFAAF800600CB127805C +:108D100066800020BDE8F88FB5F80C80702708F158 +:108D20000A0086B2A4B16888A08068892081A4F86E +:108D300006806888D5F8049004F10A0506F026F844 +:108D40002A46072549464346009505F00EFCDBE719 +:108D5000AAF80060DDE72DE9FC410F461C461646E7 +:108D600080460321089D05F0B6FE010008D0334679 +:108D70003A464046CDE90045FFF7D9FEBDE8FC8103 +:108D800043F20200FAE7F8B50546A0F57F40FF3848 +:108D900015D0284605F0FAFF040000D1FFDF204679 +:108DA00005F074FB00280BD001466A46204605F00A +:108DB0008EFB009CB4F80500E41C052801D00120BE +:108DC000F8BD2E460321284605F085FE050000D19A +:108DD000FFDF2079122807D120880C2804D1A87839 +:108DE00000F07F00022806D000230622042130462E +:108DF000FFF760FEF8BD002306220521F7E72DE905 +:108E0000F04F044689B0408805F0C0FF050000D14E +:108E1000FFDF06AA2846616800F0C7FA069D001F1A +:108E200035F8032F6E8882421FD14FF0010B4FF0AF +:108E30000008042E1CD0052E79D0062E71D0402EAD +:108E400013D31546304600F0B2FA08280DD020782A +:108E500020F00F00401C20F0F000103020700320A4 +:108E600020726681A581FFF72FFA09B0BDE8F08F67 +:108E700016462D1D224629463046FCF765FEC0B237 +:108E80000828F2D1ADF81080CDF80C80608803215D +:108E900005F021FE070000D1FFDF57483989103067 +:108EA000008881420FD360880021FEF7D7F9ADF822 +:108EB0001000024603A80090608805AB0021FFF770 +:108EC00076FE00B1FFDF03980599CDE9001002940A +:108ED00004AB2A4630466168FDF764FDC0B2052840 +:108EE0001DD2DFE800F0041C03150300BDE7BDF848 +:108EF00010000028B9D003990423CDE9000160884F +:108F000000223946FFF713FE0028AED0FFDFACE7A2 +:108F1000607840F008006070A7E708E001E0FFDF3C +:108F2000A3E76088291D6368FAF7B2FF9DE716463C +:108F300027466088032105F0CEFD040000D1FFDF45 +:108F40008DF80880A078C146400600D1FFDF042ECE +:108F50008BD3297941F30000401C06D162786B79EC +:108F60009A4282D122781207D1D04FF002081429F8 +:108F700039DA4FF6FF7A012933D0122902D01329AA +:108F800031D11CE00C2E2ED1A17801F07F010129F6 +:108F900029D0207820F00F00401C20706879607084 +:108FA0008DF808B02889ADF80A006889ADF80C0082 +:108FB000A889ADF80E00E889ADF8100016E0062E7D +:108FC00011D1207820F00F0020707988012009F05D +:108FD00088FB8DF80880ADF80AA02889ADF80C0050 +:108FE00004E0062E0AD09DF80810B9B178883A46F8 +:108FF00002A9F9F75DF838E7AC050020207820F0E9 +:109000000F0020707988012009F06BFB8DF8088033 +:109010002889ADF80A00ADF80CA0E7E7002885D054 +:109020007E8805A8009007AB062204213046FFF792 +:10903000BEFD00B1FFDF05980523042280F800B0D3 +:1090400069794170A0F80280A0F804900621CDE96A +:10905000001021463046FFF76AFD0028CBD0FFDF25 +:1090600003E77FB50D460646032105F034FD0400F5 +:109070003AD0207800F00F00012838D002A80090E4 +:1090800003AB0C2205213046FFF791FD002829D1C2 +:10909000029812210523017061781A46891C4170DB +:1090A00008214180298881806988C180A98801813F +:1090B000E98841810C21CDE9001021463046FFF7B7 +:1090C00036FD00B1FFDFF02300223146012009F018 +:1090D0006BFA207820F00F00401C20706078801C14 +:1090E0006070002004B070BD43F20200FAE7112066 +:1090F000F8E77FB50D460646032105F0ECFC0400B9 +:1091000006D0207800F00F00012804D00820E9E7FD +:1091100043F20200E6E702A8009003AB0622052115 +:109120003046FFF744FD0028DCD1029813210523C7 +:109130000170617841700221418085800621CDE96E +:1091400000101A4621463046FFF7F1FC00B1FFDF60 +:10915000207820F00F0020700020C3E72DE9F84FA1 +:109160000E468146032105F0B6FC0546484605F04B +:109170001FFE80464FF0000B05B9FFDFB8F1000F6E +:109180005AD1FFDF58E040466946002205F007F853 +:109190009DF800408246082C00D3FFDF05EB8407D2 +:1091A0000AF109003989062C0144398102D2298C3F +:1091B00008442884072C03D10BF1010000F0FF0BB9 +:1091C000B97AC80711D0072C03D0894A32F81400A5 +:1091D00000E0288D3A89824207D321F00100B8725D +:1091E000484674B3032C2DD0FFDFB87A810706D52B +:1091F00020F00200B8724846032C29D0FFDF062C6D +:109200001AD800BF95F82200410715D520F00400B8 +:1092100085F822005FF0000405EB84018A7A50078C +:1092200006D522F0040088724846032C13D0FFDFD5 +:10923000641CE4B2062CEFD3761EF6B2A3D25846D5 +:1092400068E502E0FAF7BBFECFE7FEF725F8CCE7CA +:10925000FAF77BFED6E7FAF778FEE9E710B50321C7 +:1092600005F039FC040000D1FFDF204600F0ACF827 +:10927000A07840F08000A07010BD10B5032105F06B +:109280002AFC040000D1FFDF00F0A4FE218D0D3088 +:10929000B1FBF0F0C0B210BD70B50D46032105F072 +:1092A0001AFC040000D1FFDF062D00D9FFDF072DD7 +:1092B00003D04F4830F8150000E0208D04EB850105 +:1092C0000A89824205D28A7A012042F001028A721A +:1092D00070BD002070BD10B50446402801D20720A3 +:1092E00010BD00F064F8082802D04FF4445010BDBF +:1092F0003F480021103802E0491C082903D230F809 +:109300001120002AF8D1082903D020F811400020AC +:1093100010BD042010BD10B5402801D2072010BD9B +:1093200000F045F8082806D0314A0021103A22F80A +:109330001010084610BD052010BD2DE9FE4315464E +:109340000C00804606D02DB16088402804D207204A +:10935000BDE8FE831020FBE7218811B300F027F859 +:10936000082820D002A80090228801AB072140469F +:10937000FFF71DFC0028EBD140462788019E05F031 +:1093800017FD2A46072531463B46009505F026F98C +:10939000029800902388628807214046FFF7DBFC93 +:1093A000D6E70C20D4E70520D2E705F090B80146B7 +:1093B0000F4A0020103A02E0401C082803D232F87D +:1093C00010308B42F8D1704710B504462021083088 +:1093D00016F021F90648002104EB810330F8112032 +:1093E000491C1A810629F7D9208DA08410BD0000E0 +:1093F000BC05002030B44FF0E02001234FF4006C96 +:109400000021C0F880C11D02C0F880511C06C0F8C0 +:109410008041F34A82F80014D21E82F80014F14A07 +:1094200082F80014F04A53609360C2F84011C2F809 +:109430004411C2F84811C0F880C2C0F88052C0F888 +:109440008042C0F800C1C0F80041136030BC7047D2 +:1094500070B401204FF0E023C6024FF0000CC3F8B7 +:1094600080610402C3F880410506C3F88051DE4ADA +:1094700050609060DD4801680029FCD1C2F840C10D +:10948000C2F844C1C2F848C1C3F88062C3F8804240 +:10949000C3F8805270BC70474FF0E0204FF4006179 +:1094A000C0F88012C910C0F880127047002804BFAD +:1094B000CF487047012804BFCE487047022804BF38 +:1094C000CD48704700B5FFDF002000BD08B5C64994 +:1094D000002298B101282FD002281CBFFFDF08BD51 +:1094E0004FF48020C1F80803C1F84803C348026064 +:1094F000C1F84821C0480068009008BD4FF4803092 +:10950000C1F80803C1F84803BD4B1A60C1F84021F7 +:10951000BC4BC1031960BC49C1F80803BB480260D9 +:10952000C1F840214FF0E0238015C3F88001C1F855 +:109530000022B748027008BD4FF40030C1F808039C +:10954000C1F84803B3480260C1F84421A948006843 +:10955000009008BD70B5DFF890C2042600240125F4 +:10956000B0B101284CD002281CBFFFDF70BDAA4853 +:109570004FF48022012BC0F8401518BFCCF8082307 +:10958000C0F8404108BFCCF80423CCF8442370BD98 +:10959000881E20F07F40CCF840054FF48030CCF896 +:1095A0000803CCF84041CCF84403012B14BF002140 +:1095B0000121974B597094490D61DFF860C2CCF8D6 +:1095C0000040974C4FF0020CC4F800C0DFF854C2C2 +:1095D000CCF80060DFF834C23D32CCF80020C1F88E +:1095E00000524FF0E0224FF4807CC2F880C2C1F8F4 +:1095F0000403C2F800C108048B4908601D7070BDE7 +:109600008A4A4FF40030012BC2F8401518BFCCF83D +:109610000803C2F8404108BFCCF80403CCF8440367 +:1096200070BD72480068704770B58148056882490E +:10963000804808606C4CD4F84001002601280AD10B +:10964000D4F8080310F4803F05D04FF48030C4F8FC +:109650000803C4F84061D4F8440101280DD1D4F8BE +:10966000080310F4003F08D04FF40030C4F808039A +:10967000C4F84461012007F034FCD4F84801012803 +:109680000DD1D4F8080310F4802F08D04FF48020B7 +:10969000C4F80803C4F84861022007F022FC6748B8 +:1096A000056070BD624810B5046863496148086090 +:1096B00057490878002808BF03201AD0514A4FF0B4 +:1096C00000401060504AC00BC2F808034F4B002006 +:1096D0001860C2F840014FF0E02C9315CCF88031AF +:1096E000C2F8000208704A78002A1CBF48700020A7 +:1096F00001D007F0F6FB5148046010BD4FF0E021A7 +:109700004FF08070C1F8000270474FF0E0214FF039 +:109710008070C1F8800270474FF0E0214FF40010D4 +:10972000C1F8000270474FF0E0214FF40010C1F87B +:10973000800270473449012008614FF0E0210002A7 +:10974000C1F88002704730494FF47C10C1F808031B +:1097500000200146820002F1804202F50042C2F878 +:109760004015C2F84011401CC0B20628F2D3704721 +:10977000410A43F609525143C0F3080010FB02F0BE +:1097800000F5807001EB50207047430B48F2376CB6 +:1097900003FB0CF31B0C4FEA432CC1F800C0DFF8AD +:1097A000A0C003FB0C0327484CF2F72C5843400D94 +:1097B00010FB0CFC0CEB432303F580735B1213705E +:1097C0000A68104408607047194810B504681A49BF +:1097D0001848086007F01EFF1848046010BD00001C +:1097E0000BE000E018E000E000B0004004B50040ED +:1097F0004081004044B1004048B1004048B50040BD +:1098000040B5004008F50140008000404085004020 +:109810002C00002044B5004008B000400485004002 +:10982000088500401085004004F5014004B0004068 +:109830001005024001000001180502401405024015 +:10984000F7C2FFFF6F0C010010B5EFF3108000F0BE +:10985000010472B6EB484178491C417040780128F8 +:1098600001D108F03BFB002C00D162B610BD70B5F1 +:10987000E44CE07848B90125E570FFF7E5FF08F012 +:1098800035FB20B1002008F011FB002070BD4FF027 +:1098900080406571C0F80453F7E770B5EFF31080AE +:1098A00000F0010572B6D74C607800B9FFDF607830 +:1098B000401E6070607808B908F014FB002D00D1DC +:1098C00062B670BDCF4810B5C17821B10021417199 +:1098D000C170FFF7E2FF002010BD10B5044608F08C +:1098E00005FBC849C978084000D00120206000204D +:1098F00010BD2DE9F05FDFF80C934278817889F88C +:109900000620002589F80710064689F808500078D7 +:109910002F4620B101280FD002280FD0FFDF08F01A +:10992000F2FA98B108F0F6FAA8420FD1284608F0EA +:10993000F5FA0028FAD047E00125F0E7FFF784FFA9 +:1099400008F0D4FA0028FBD00225E8E701208407BC +:10995000E060C4F80471AC490D600107D1F844120D +:10996000A94AC1F3423124321160A7494FF0020BDA +:1099700034310860C4F804B3A060DFF890A2DAF8CC +:109980000010C94341F3001101F10108DAF8001099 +:1099900041F01001CAF8001000E020BFD4F8040123 +:1099A0000028FAD0284608F0B9FA0028FAD0B8F111 +:1099B000000F05D1DAF8001021F01001CAF80010EC +:1099C000C4F808B3C4F8047199F807004C4670B1A4 +:1099D000307860B908F08AFA064608F07BFC6FF030 +:1099E000004116B1C4E9031001E0C4E9030115B157 +:1099F0002771BDE8F09F01202071BDE8F05F00F005 +:109A0000DFB870B5050000D1FFDF4FF080424FF0A6 +:109A1000FF30C2F808030021C2F80011C2F8041197 +:109A2000C2F80C11C2F81011764C617008F064FA9B +:109A300010B10120E07060702846BDE8704058E722 +:109A40002DE9F0410125AF077D616E4CE079F0B161 +:109A5000012803D0217A401E814218DA08F046FA24 +:109A6000064608F037FCE179012902D9217A491C20 +:109A700021720EB1216900E0E168411A022902DA7F +:109A800011F1020F0EDC0EB1206100E0E060FFF783 +:109A9000DBFE08F02BFA10B13D61A57000E02570E7 +:109AA00000202072BDE8F0812DE9F05F5848D0F821 +:109AB00000B0574A5749083211608406D4F80801AB +:109AC00010B14FF0010801E04FF00008D4F8000198 +:109AD00000B101208146D4F8040108B1012600E05C +:109AE0000026D4F80C0100B101208246D4F8100100 +:109AF00008B1012700E0002748EA090126EA010031 +:109B000020EA0A00B84300D0FFDF0025B8F1000FBB +:109B100004D0C4F80851012008F0C8F9DFF8E48047 +:109B2000B9F1000F13D0C4F8005198F8050020B126 +:109B300088F80550002008F0B9F998F8000030B115 +:109B400008F0D4F918B1012088F8020020610EB1A4 +:109B5000C4F80451BAF1000F0AD0C4F80C5198F8B7 +:109B60000200464600B9FFDFB5703570FFF795FE7D +:109B700037B1C4F8105198F8040008B1FFF760FF3E +:109B80002349091DC1F800B033E770B51D4DE878D1 +:109B900008B908F0A7F901208407A061A87850B19E +:109BA000D4F80C0120B9002008F0B8F90028F7D14A +:109BB0000020C4F80C014FF0FF30C4F8080370BD5A +:109BC0002DE9F0411926B507C5F808630124AC61F9 +:109BD0000020C5F80001C5F80C01C5F8100108F017 +:109BE00085F9084F10B1BC702C6100E03C70FFF7A4 +:109BF0002BFE0549B87920310860C5F804636C6113 +:109C000050E70000300000201805004010ED00E093 +:109C1000100502400100000110B50D2000F06FF8A2 +:109C2000C4B26FF0040000F06AF8C0B2844200D001 +:109C3000FFDF3A490120086010BD70B50D2000F02B +:109C400048F8374C0020C4F800010125C4F804533B +:109C50000D2000F049F825604FF0E0216014C1F8B4 +:109C6000000170BD10B50D2000F033F82C48012123 +:109C700041600021C0F80011BDE810400D2000F047 +:109C800033B8284810B504682649274808310860C9 +:109C90002349D1F80001012804D0FFDF2148001D2D +:109CA000046010BD1D48001D00680022C0B2C1F84C +:109CB000002108F024FAF1E710B51948D0F8001196 +:109CC0000029FBD0FFF7DDFFBDE810400D2000F0BC +:109CD0000BB800F01F02012191404009800000F103 +:109CE000E020C0F88011704700F01F020121914070 +:109CF0004009800000F1E020C0F880127047002881 +:109D000006DA00F00F0000F1E02090F8140D03E0F7 +:109D100000F1E02090F800044009704704D50040AD +:109D200000D00040100502400100000110B52020C5 +:109D300000F075F8202000F07DF84449202081F8DB +:109D40000004434900060860091D42480860F7F70F +:109D5000D9FA3F49C83108603F48D0F8041341F0B0 +:109D60000101C0F80413D0F8041341F08071C0F869 +:109D70000413364901201C39C1F8000110BD10B58B +:109D8000202000F04CF8324800210160001D0160E5 +:109D90002F4A481EE83A10602F4AC2F808032C4B9D +:109DA000C8331960C2F80001C2F860012B4908608D +:109DB000BDE81040202000F03DB825492848EC3986 +:109DC0000860704722492648E8390860704770B536 +:109DD0001F4A8069E83A224911601F49D1F80061A1 +:109DE0000023204D1D4A5C1E1EB1A84206D300214F +:109DF0000FE0D1F8606186B1A84209D2C1F8003104 +:109E0000C1F860311460BDE87040202000F012B845 +:109E10001168BDE8704015F029BCFFDF70BD00F08F +:109E20001F02012191404009800000F1E020C0F8AC +:109E30008011704700F01F0201219140400980000D +:109E400000F1E020C0F880127047000020E000E040 +:109E500000060240441300200000024000040240BB +:109E600001000001000002004FF0E0214FF00070FF +:109E7000C1F88001C1F88002384B802283F80024A9 +:109E8000C1F80001704700B502460420344903E0E0 +:109E900001EBC0031B792BB1401EC0B2F8D2FFDF2B +:109EA000FF2000BD41F8302001EBC00100224A71C3 +:109EB0008A7101220A7100BD294A002102EBC0000B +:109EC0000171704710B50446042800D3FFDF244811 +:109ED00000EBC4042079012800D0FFDF6079A1796C +:109EE000401CC0B2814200D060714FF0E0214FF0C1 +:109EF0000070C1F8000210BD2DE9F0411948056855 +:109F000018491948083108601448042690F80004DC +:109F1000134F4009154C042818D0FFDF16E02178B4 +:109F200007EBC1000279012A08D1427983799A426C +:109F300004D04279827157F8310080472078401C64 +:109F4000C0B22070042801D300202070761EF6B223 +:109F5000E5D20448001D0560BDE8F08119E000E08D +:109F6000CC05002010050240010000014400002043 +:109F70000F4A12680D498A420CD118470C4A1268E0 +:109F80000A4B9A4206D101B508F072F9FFF715FFA6 +:109F9000BDE80140074909680958084706480749CC +:109FA000054A064B7047000000000000BEBAFECA1A +:109FB000A0000020040000204812002048120020C9 +:109FC00018B1172802D207207047172008490880C7 +:109FD0000020704706480088704770B50C4605465B +:109FE00000F0B7FB21462846BDE8704001F072BC86 +:109FF00046000020FE4B586019721A80C90015F007 +:10A000000ABB10B504460E2115F0E3FA1720208193 +:10A01000207B40F00A00207310BD4FF6FF720A80CB +:10A020000146032008F05DBB7047027BD30701D1D6 +:10A03000920703D4408908800020704705207047AC +:10A04000027B920700D541817047014600200988B4 +:10A0500047F2FE12114200D00120E549497A002959 +:10A0600001D040F00800704700B50346007BC007F0 +:10A0700001D0052000BD19811846FFF7E6FFC00793 +:10A0800003D0187B40F004001873187B40F00100E7 +:10A090001873002000BD027B520700D509B100896A +:10A0A000704717207047027B61F3C3020273704749 +:10A0B0002DE9F04F0E46017804464FF0010B0BFAE4 +:10A0C00001F047F2FF1100EA010961681D464FF6F1 +:10A0D000FF73088887B09646984206D0B9F1000F02 +:10A0E00007D047F2FE12104203D0012007B0BDE8AE +:10A0F000F08F40EA090008804FF0000A8DB185F822 +:10A1000000A02078002705220221102874D2DFE861 +:10A1100000F0730D323C516B747E51C8C49ACCFD73 +:10A12000FCFB20780B28ECD00420DFE76068B4F853 +:10A130000880007B80077DD5B8F1170F4CD3FFF75F +:10A1400049FF4045FAD360684089172801D340454C +:10A1500042D1287820F03F00801C2870A5F80180AB +:10A16000032030806168A1F80A806068017B21F0DB +:10A170000201017334E1042028702089A5F8010050 +:10A180006089A5F8030032802AE1208A3188C01D49 +:10A190001FFA80F84145D1D3062005F8010B20892C +:10A1A000288060896880A089A88007200090238A81 +:10A1B000626941E0082810D0082028702089A5F89D +:10A1C00001006089A5F8030032806A1D694604F128 +:10A1D0000C0006F056F910B1CCE01020EDE7308805 +:10A1E0009DF80010084456E00A2028702089A5F840 +:10A1F000010003203080B2E004E10C2028702089A7 +:10A20000A5F801006089A5F803003280A7E0208945 +:10A21000B6F800C00BEB40021FFA82F8C44576D3B3 +:10A22000B8F1050F73D30E222A7003EA4003CDF86C +:10A2300000B000E08AE0E2686088714600F095FABC +:10A24000A6F80080CCE06A48427A002A7ED0521EEE +:10A2500042724068227AE36800EBC205AA88286847 +:10A26000D3F800C01044A0F1080240F808CC5868A8 +:10A2700050608DF800108DF801A028680290A88821 +:10A28000ADF8040060886946FBF738FAA5F804A029 +:10A29000002E01D050463080A2E0287840F08001A6 +:10A2A0002970287840F04001297060893188C01CED +:10A2B0001FFA80F841455DD3287820F03F00123026 +:10A2C00028702189A5F80110032000906389608817 +:10A2D0007146E26800F049FAA6F800802878410645 +:10A2E0003DD500067CD58DF800B08DF801A03188F1 +:10A2F000CDE9025A091DDFF8F8800420ADF80410FA +:10A30000049098F8080003E055E04BE02BE031E0C2 +:10A310008DF8140060886946FBF7F0F9074630882D +:10A320000C303080022F01D0DFB36EE09DF8142096 +:10A33000D8F8041098F80830404601EBC2019A4260 +:10A3400018D28A88B2B9427A521C00E037E088F805 +:10A3500009200D6030888880A6F800A055E061686B +:10A36000208988803CE0A0893188401D1FFA80F850 +:10A37000414501D2042748E02878714620F03F008B +:10A38000163028702089A5F801006089A5F803001F +:10A390000092A3896088226900F0E7F9A6F800809E +:10A3A000DDE71DE0287820F03F0018302870207A83 +:10A3B0006870318014E060680188090401D40527C1 +:10A3C00023E0C0882189884201D006271DE01E2095 +:10A3D0002870A6F800B06068018821F4004101806F +:10A3E000B9F1000F11D0024861880088830001E0B4 +:10A3F000EC0500200022032008F0D6F861682078E0 +:10A40000887007E0A6F800A003276068018821EAA9 +:10A4100009010180384669E62DE9F04F87B01746FB +:10A42000109C0D0083461E461AD03078C10703D019 +:10A4300000F03F00192801D9012100E00021204649 +:10A44000FFF729FEA8420BD32088A0F57F41FF39F2 +:10A4500006D03078410601D4000603D5082045E631 +:10A46000072043E600208DF800008DF801003078C9 +:10A470006B1E00F03F0C0122A81E4FF0050A4FF0A2 +:10A48000020999B2BCF1200F76D2DFE80CF08C10F3 +:10A49000755F7569758D759E75B875BD75CB75D70A +:10A4A00075E4757575F475F275F175F0758C052D9B +:10A4B00079D104208DF80000A0788DF80400708810 +:10A4C000ADF8060030798DF80100707800F03F009B +:10A4D0000C2829D00ADCA0F10200092863D2DFE8A9 +:10A4E00000F0126215621A621D622000122824D048 +:10A4F00004DC0E281BD01028DAD11BE016281FD050 +:10A500001828D5D11FE02078800701E02078400787 +:10A51000002848DAF1E020780007F9E72078C00643 +:10A52000F6E720788006F3E720784006F0E7207809 +:10A530000006EDE72088C005EAE72088C004E7E7C9 +:10A5400020888004E4E720884004E1E72078800741 +:10A5500029D5032D27D18DF800A0B6F8010083E09E +:10A56000217849071FD5062D1DD381B270780128A7 +:10A5700003D0022817D102E0CCE0022000E0102036 +:10A5800006228DF8002072788DF80420801CB1FB23 +:10A59000F0F2ADF8062092B242438A4203D103970B +:10A5A000ADF80890A9E07BE02078000778D5072176 +:10A5B00098B28DF800108108ADF80410B0EB810F4F +:10A5C0006ED10297ADF8062097E02178C90667D5CD +:10A5D000022D65D381B208208DF800007078022822 +:10A5E0005ED300BFB1FBF0F28DF80400ADF8062099 +:10A5F00092B242438A4253D1ADF808907CE0207871 +:10A6000080064DD5092003E02078400648D50A2071 +:10A610008DF80000A088ADF80400ADF80610ADF884 +:10A62000082069E02078000672D50B20ADF80410F0 +:10A630008DF80000ADF8062002975EE02188C9057C +:10A6400066D5022D64D381B20C208DF8000070789D +:10A6500004285DD3C6E72088C00459D5012D57D101 +:10A660000D208DF80000A088ADF8040045E021E041 +:10A6700026E016E0FFE72088800449D5052D47D362 +:10A680000E208DF80000A088ADF80400B6F8030095 +:10A690006D1FADF80850ADF80600ADF80AA02BE02C +:10A6A00036E02088400433D5012D31D10F208DF8BC +:10A6B000000022E0208800042AD4B6F80100E080DF +:10A6C000207B000724D5032D22D3307800F03F00F3 +:10A6D0001B2819D011208DF80000208840F400407C +:10A6E000A4F80000B6F80100ADF80400ED1E032048 +:10A6F000ADF80650ADF80800039769465846FAF7DA +:10A70000FDFF050008D016E010208DF80000E9E7F5 +:10A71000072510E008250EE0307800F03F001B28E8 +:10A7200009D01D2807D05946032007F0DAFF2088FA +:10A7300000F400402080207B400708D52046FFF72A +:10A7400084FCC00703D1207B20F00400207328463E +:10A75000CCE400B587B0032805D18DF8000088B29D +:10A760006946FAF7CBFF07B000BDF8B51C461546A1 +:10A770000E46069F04F01CFB2346FF1DBCB231466B +:10A780002A46009403F02AFFF8BD00002DE9FF4F90 +:10A790008DB09B46DDE91B47DDF87CA00D46082BFC +:10A7A00005D0E86901F0EFF850B11020C8E020882A +:10A7B000092140F0100020808AF80010022017E0E4 +:10A7C000E96901208871EA694FF420519180E969B3 +:10A7D0008872E96942F601000881E96900208873FE +:10A7E000208840F02000208011208AF800000420FA +:10A7F000804638780A900A2038704FF0020905F137 +:10A8000018004E460C9001F069FB444678E000BF0A +:10A81000BBF1100F0CD1022E0AD0A9EB0400801C52 +:10A8200080B20090022305AA1E990D9801F09BF8B2 +:10A83000BDF816101A98814203D9FE4800790F908E +:10A8400004E003D10A9808B138702DE0CDF80090EB +:10A850004FF002030DF116021E990D9801F083F8D6 +:10A860001D980088811BA1EB080083B2C8F1FF008E +:10A87000984200D2034609EB0801002089B2CDE9D5 +:10A8800002101E9A0F9800900DF12C0C0192CDF839 +:10A8900010C0BDF8161000220D9801F0A2FB387010 +:10A8A00050B1C0B2832803D0BDF81600288334E02D +:10A8B000022011B0BDE8F08FBDF82C00022E00EB95 +:10A8C0000801CCB20CD09AF80110A14205D1BDF814 +:10A8D0002010814206D0FF2C04D09AF801401EE0DF +:10A8E0008AF80140D34800680178052902D1BDF8F3 +:10A8F0001610818009EB04001FFA80F9301986B226 +:10A90000DDE90C1005AB0F9A01F0EBFA28B91D98A0 +:10A910000088801BA042BFF67BAF022E11D0BBF196 +:10A92000100F0AD1A9EB0400801C80B20090022312 +:10A9300005AA1E990D9801F016F81D9806800020B2 +:10A9400038700020B5E72DE9F8439C46089E134671 +:10A950000027B26B9AB3491F8CB2F18FA1F57F45E6 +:10A96000FF3D05D05518AD882944891D8DB200E002 +:10A9700000252919B6F83C800831414520D82A44E1 +:10A98000BCF8011022F8021BBCF8031022F8021BCD +:10A99000984622F8024B914604F0F8F94FF00C0C5F +:10A9A00041464A462346CDF800C003F0DEFDF58758 +:10A9B000B16B00202944A41D2144088003E001E07C +:10A9C000092700E083273846BDE8F88310B50B88D7 +:10A9D000848F9C420CD9846BE018048844B184882D +:10A9E00024F40044A41D23440B801060002010BDFB +:10A9F000822010BD2DE9F0478AB000259046894697 +:10AA00008246ADF8185007274BE0059806888088E5 +:10AA1000000446D4A8F8006007A8019500970295A5 +:10AA2000CDE903504FF4007300223146504601F047 +:10AA3000D8FA04003CD1BDF81800ADF82000059804 +:10AA400004888188B44216D10A0414D40195029571 +:10AA5000039521F400410097049541F48043428816 +:10AA60002146504601F093F804000BD105988188E7 +:10AA700041F40041818005AA08A94846FFF7A6FFD6 +:10AA80000400DCD000970598029501950395049584 +:10AA90000188BDF81C300022504601F078F8822C65 +:10AAA00006D105AA06A94846FFF790FF0400ACD0DE +:10AAB000ADF8185004E00598818821F400418180A8 +:10AAC00005AA06A94846FFF781FF0028F3D0822C8B +:10AAD00003D020460AB0BDE8F0870020FAE710B5A1 +:10AAE0000C46896B86B051B10C218DF80010A18FF6 +:10AAF000ADF80810A16B01916946FBF75BFC0020E3 +:10AB00004FF6FF71A063E187A08706B010BD2DE965 +:10AB1000F0410D460746896B0020069E1446002929 +:10AB200011D0012B0FD1324629463846FFF762FF7C +:10AB3000002808D1002C06D0324629463846BDE808 +:10AB4000F04100F02FBFBDE8F081F8B51D46DDE90A +:10AB5000067CDDE90864531DBCF800E09BB29E450D +:10AB600001D20720F8BDACF80030172304F8013BF0 +:10AB7000134621806580052100913A46314600F058 +:10AB8000F2FE0020F8BD10B50C464821204614F016 +:10AB900042FD04F1080044F81C0F00204FF6FF713D +:10ABA000E061618420841720A08494F8280040F09C +:10ABB0000A0084F8280010BD4FF6FF720A80014693 +:10ABC000042007F08EBD30B585B00C460546FFF772 +:10ABD00086FFA18E284629B101218DF80010694613 +:10ABE000FBF7E8FB0020E0622063606305B030BD46 +:10ABF00090F84420920703D44088088000207047D2 +:10AC00000620704790F84420920701D5A0F8421022 +:10AC100070470146002009880A0700D5012011F07D +:10AC2000F00F01D040F00200CA0501D540F0040049 +:10AC30008A0501E04800002001D540F010004A05D7 +:10AC400001D540F02000090501D540F040007047D3 +:10AC500000B5034690F84400C00701D0062000BDAF +:10AC6000A3F840101846FFF7D4FF10F0760F05D078 +:10AC700093F8440040F0040083F8440013F8440FB4 +:10AC800040F001001870002000BD90F844205207E9 +:10AC900000D511B1B0F8400070471720704710F888 +:10ACA000442F61F3C302027070472DE9FF4F9DB03E +:10ACB0000E00DDE92D34DDE92A5725D02878C107BB +:10ACC00003D000F03F00192801D9012100E0002144 +:10ACD0002046FFF7DAFFB04216D3287841060FD49A +:10ACE00000F03F011E2909D0228812F47F6F0BD19A +:10ACF000398849B1A2F57F41FF3905D0010606D553 +:10AD000000F03F00122802D0042021B0D2E5F9491A +:10AD10001F984FF0000908718DF818908DF8309049 +:10AD20000CAA0A60ADF81C90ADF8289029789A46D4 +:10AD300001F03F0C701F032204F11803CB464FF0C3 +:10AD400004084FF0060E1693BCF11F0F7DD2DFE80A +:10AD50000CF07C7C107C257CA57CEF7CEE7CED7C73 +:10AD6000EC7CEF7CEB7C7C7CEA7CE97C7C7C7C7CF6 +:10AD7000E80094F84410B5F80100890701D5032EC6 +:10AD800002D08DF8188025E34FF40061ADF828104B +:10AD900060808DF83020ADF83400F3E2052EF0D15C +:10ADA000B5F801002083ADF81C00B5F803106183ED +:10ADB00008B1884201D9012077E184F80AB0A4F8EB +:10ADC00008B04FF6FF702084169801F087F8052030 +:10ADD0008AF8000002208046039011AB1F9A169952 +:10ADE0001D9801F07EF888BB9DF84A00012804D028 +:10ADF00002218AF80110102003E001208AF80100E6 +:10AE000002208346002201A912A805F03AFBD8BB14 +:10AE10009DF80400834537D13A88801CA2EB0801D5 +:10AE2000814231DB0398009002230DF146022C99F8 +:10AE30001D9800F098FD039808F10208801C80B26C +:10AE4000039018AA01A912A801E0A4E21FE005F0EE +:10AE500018FB039800909DF8043018AA2C991D98AF +:10AE600000F081FD9DF8041011AB08EB01001FFA02 +:10AE700080F803981F9A084480B2039016991D9891 +:10AE800001F02FF80028BDD0B8F1020F03D10A203D +:10AE90008DF8180071E2A7F800806EE2072EFFF42B +:10AEA00070AFB5F801002083ADF81C00B5F80310B1 +:10AEB000618300283FF47FAF88423FF67CAF4FF0BC +:10AEC000010884F80A80B5F8050020810020A073ED +:10AED000E06900F058FD80B9E16942F6010081F8AF +:10AEE0000680E2694FF420519180E16981F80A807F +:10AEF000E1690881E16900208873F01F20842098AF +:10AF00004FF007086062A4F82280169800F0E6FF70 +:10AF10008AF800804FF0010B0020D846ADF84600BB +:10AF200029E016E2AAE13FE1E6E00FE2ACE087E0CB +:10AF300048E000BFB8F1010F13D0E0698079012823 +:10AF400003D1BDF84400ADF80E00042303AACDF8E8 +:10AF500000B02C991D9800F006FD0BF104001FFABB +:10AF600080FBBDF84600ADF80C00ADF80E0008F10E +:10AF700004001FFA80F811AB1F9A16991D9800F073 +:10AF8000B0FF20B93988A1EB08000428D2D2B8F16B +:10AF9000010F3FF47CAFE0698079012805D0BDF84E +:10AFA0004410A1F57F40FF3803D1BDF84400ADF84F +:10AFB0000E00042303AACDF800B02C991D9800F0D0 +:10AFC000D2FC68E7072E02D0152E7FF4DAAEB5F872 +:10AFD00001102183ADF81C10B5F80320628300290D +:10AFE0003FF4E9AE91423FF6E6AE0121A172A4F82A +:10AFF00008B084F80EB0052E07D0C0B2691DE26912 +:10B0000005F020FA00287FF442AF4FF6FF7020844D +:10B010002C99CDF814A0CDE9037106AA0AA9CDF8A0 +:10B0200000B0CDE901122878214600F03F031F9AB5 +:10B030001D98FFF7ABFB8146208BADF81C009CE10F +:10B04000032EC2D14020ADF82800B5F801102183AD +:10B05000ADF81C1005A8DDF8B0C0CDE903B00123A0 +:10B06000CDE901C31F98009038880022401E83B2AA +:10B070001D9800F0B6FF8DF8180080BB0B218AF8F0 +:10B080000010BDF8140033E0052E9ED18020ADF8ED +:10B090002800B5F801102183B5F803002084ADF82D +:10B0A0001C10B0F5007F03D907208DF8180091E13E +:10B0B00040F47C42228412A8DDF8B080CDE903B0D0 +:10B0C0004FF0010CCDE9018C1F9800903888401E8C +:10B0D00083B21D9800F085FF8DF8180018B1832801 +:10B0E000ADD10220C8E00D218AF80010BDF848005B +:10B0F000401C29E148000020C80900EB400002EB99 +:10B100008000B04204D948067FF53BAE58461BE1AB +:10B11000B5F801C0ADF81CC02978490607D58DF8EF +:10B1200030E02978090605D58DF830B036E10721E1 +:10B130008DF83010209B03220193CDE9022B1F993B +:10B14000A6EB0008CDF810B000911FFA88F300229A +:10B1500061461D9800F01BFD8DF818008DF830B089 +:10B16000297849060DD52088C00506D5208BBDF865 +:10B170001C10884201D1C4F824B058468DF818B08C +:10B18000E2E0832801D14FF002094FF48070ADF85E +:10B190002800BDF81C002083A4F82080209860625D +:10B1A000032060841321CCE0052EFFF4EAADB5F84E +:10B1B0000110ADF81C10A28F5AB3A2F57F43FE3BDD +:10B1C00027D008228DF83020DDF880C00523CDE996 +:10B1D000023BCDF804C0CDF810B01F9A80B240F405 +:10B1E00000430092D846B5F803201D9800F0CFFC2C +:10B1F0004FF400718DF818008DF83080ADF82810EC +:10B20000832810D0F8B1A08FA0F57F41FE3907D078 +:10B21000E0E00B228DF830204FF6FE72A287D3E7D4 +:10B22000A4F83C80D6E02B4600943146209A1D9825 +:10B23000FFF789FB8DF8180008B183284CD1BDF8C1 +:10B240001C0020834DE72B4600943146209A1D9820 +:10B25000FFF779FB8DF81800F0BBE18FA06B084475 +:10B26000831D2C99CDE90037CDE9021A43888288E5 +:10B2700001881D98FFF769FC81467EE095F8018002 +:10B28000022E7DD15FEA080002D0B8F1010F77D11C +:10B2900009208DF8300007A800908DF834804346CF +:10B2A000002221461D98FFF732FC8DF835008DF8FD +:10B2B00036B050B9B8F1010F12D0B8F1000F04D177 +:10B2C000A18FA1F57F40FF380AD0A08F40B18DF843 +:10B2D00030B04FF4806000E04FE0ADF828000DE0A2 +:10B2E0000CA91D98FBF766F881464FF480608DF835 +:10B2F00030B0ADF82800B9F1020F06D0FE48006862 +:10B30000807928B18DF8180041E0A4F8188047E052 +:10B31000B9F1000F03D081208DF8180040E007A894 +:10B3200000904346012221461D98FFF7F0FB8DF85F +:10B33000180021461D98FFF7D2FB9DF81800E0B9D0 +:10B3400019218AF800100120388016E08DF818E0E5 +:10B3500040E02078000721D5012E1FD10A208DF86A +:10B360003000E088ADF8340004201D9907F0B9F9E9 +:10B370000820ADF82800A7F800B09DF8300000E0E4 +:10B380000CE020B10CA91D98FBF714F88146B9F127 +:10B39000000F1CD004E048067FF5F3AC4FF0040921 +:10B3A0002088BDF8281008432080BDF828008005BB +:10B3B0000BD5A18FA1F57F40FE3806D12098E06221 +:10B3C0002A982063A6864FF0030948469DE49DF81D +:10B3D000180078B101208AF8000029788AF8011055 +:10B3E000BDF81C10AAF802109DF818008AF8040095 +:10B3F000052038802188BDF8280081432180E4E7BA +:10B400002DE9FF4F8846097895B0012088404FF21A +:10B410000901249C0840ADF820002188DDF888A0AF +:10B42000A1F57F424FF00009FF3A02D028B108078A +:10B4300003D5012019B0BDE8F08F239E4FF0000B1B +:10B440000EA886F800B018995D460988ADF834104A +:10B45000A9498DF81CB0179A0A718DF838B00860A8 +:10B4600098F80000012834D0022809D003287DD1A3 +:10B47000307820F03F001D303070B8F80400E080D4 +:10B4800098F80000022804D1307820F03F001B30EB +:10B49000307094F84400000768D503210720CDE9F7 +:10B4A000000ACDE9021B05ABBDF834000493C01EB1 +:10B4B00083B2B8F804100022159800F092FD00281D +:10B4C000D5D1B8F80400A6F80100BDF81400C01CDE +:10B4D000FAE098F805108DF81C1098F8040001287F +:10B4E00006D04FF4007902282BD00328BFD163E1A6 +:10B4F0002088B8F8087010F40060ADF8200035D04E +:10B50000172F1CD3FEF766FDB84218D3B4F84200DB +:10B51000172801D3B84212D1307820F03F00C01C68 +:10B520003070A6F801700320ADF83400A4F8427022 +:10B5300094F8440020F0020084F844005AE1052504 +:10B5400073E1208808F1080700F4FE60ADF82000E0 +:10B5500010F0F00F1DD010F0C00F03D03888228BF0 +:10B560009042ECD1A9B9B878C00700E057E110D0FB +:10B57000B9680720CDE902B1CDF804B00090CDF84C +:10B5800010B0FB88BA883988159800F000FB0028B5 +:10B59000D5D1BDF8200080284AD006DC10280DD077 +:10B5A00020280BD040288BD124E0B0F5807F66D0D6 +:10B5B00048457DD0B0F5806F98D1D6E0C00601D562 +:10B5C000082000E0102081460DA907AA0520CDE93A +:10B5D00002218DF83800ADF83CB0CDE904A608A9E9 +:10B5E0003888CDE900014B46072221461598FFF720 +:10B5F000CDF89FE09DF81C004FF00A0900289DD16E +:10B6000001210720CDE9000ACDE9021B05ABBDF8F9 +:10B6100034000493401E83B2218B0022159800F061 +:10B62000E0FC8DF81C000B203070BDF814001CE00D +:10B630009DF81C004FF00C0900281FD101210720A4 +:10B64000CDE9000ACDE9021B13AB0493BDF8340029 +:10B65000228C401E83B2218B159800F0C2FC8DF81D +:10B660001C000D203070BDF84C00401CADF83400BB +:10B6700005208DF83800208BADF83C00BAE0388802 +:10B68000218B884284D19DF81C004FF012090028BC +:10B690001CD1606AA8B1B878C0073FF450AFBA684F +:10B6A000CDF804B0CDE902B20720CDF810B000E02B +:10B6B0000DE00090FB88BA88159800F068FA8DF8C4 +:10B6C0001C00132030700120ADF8340092E039885E +:10B6D000208B8142D6D19DF81C004FF0160900281E +:10B6E000A06B0BD0F0B34FF6FF7100205F46ADF8B2 +:10B6F00008B0009129E000004800002068B1B97846 +:10B70000C907BFD1E18F0DAB0844821D03968DE8B8 +:10B710000C0443888288018809E0B878C007BCD04F +:10B72000BA680DAB03968DE80C04BB88FA881598AF +:10B73000FFF70BFA05005DD0072D71D075E0009181 +:10B7400005AA02A92046FFF741F9E28FBDF80810CB +:10B750008A4201D00028F2D0E08FA16B0844078014 +:10B76000009800E046E0E08744E09DF81C004FF0C0 +:10B77000180940B1208BC8B138882083214615981C +:10B78000FFF7ADF936E004F118000090237E0122A6 +:10B7900021461598FFF7BBF98DF81C000028EDD164 +:10B7A000192030700120ADF83400E7E70525214667 +:10B7B0001598FFF794F938E0208800F40070ADF890 +:10B7C000200048452BD1A08FA0F57F41FE3998D1AC +:10B7D000D8F808004FF0160948B1A063B8F80C106B +:10B7E000A1874FF6FF71E187A0F800B002E04FF6A5 +:10B7F000FF70A087BDF8200030F47F611AD0782355 +:10B8000000220420159906F0CFFE98F80000207160 +:10B810002088BDF82010084320800EE000E00725B6 +:10B820002088BDF8201088432080208810F47F6F86 +:10B830001CD03AE02188814321809DF8380020B156 +:10B840000EA91598FAF7B6FD05469DF81C000028CC +:10B85000EBD086F8019001203070208B70809DF82D +:10B860001C0030710520ADF83400DEE7A18EE1B197 +:10B8700018980DAB0088ADF834002398CDE9030487 +:10B88000CDE9013A206B0090E36A179A1598FFF70B +:10B890000CFA054601208DF838000EA91598FAF724 +:10B8A00089FD00B10546A4F834B094F8440040077F +:10B8B0000AD52046FFF7ADF910F0760F04D114F841 +:10B8C000440F20F0040020701898BDF83410018057 +:10B8D0002846AFE500B585B0042806D102208DF8D2 +:10B8E000000088B26946FAF765FD05B000BD10B5E5 +:10B8F0003F4C0B782268012B02D0022B2AD111E099 +:10B9000013780BB1052B01D10423137023688A88A7 +:10B910009A802268CB88D38022680B891381498959 +:10B9200051810DE08B8893802268CB88D380226878 +:10B930000B8913814B8953818B899381096911612B +:10B940002168FAF737FD226800210228117003D020 +:10B95000002800D0812010BD832010BD806B0028FE +:10B9600000D001207047F8B51C4615460E46069FCC +:10B9700003F01EFA2346FF1DBCB231462A4600944E +:10B9800002F02CFEF8BD8178012909D10088B0F5BC +:10B99000205F03D042F60101884201D100207047A8 +:10B9A00007207047F0B587B0002415460E460746BD +:10B9B000ADF8144010E0069801882980811DCDE97A +:10B9C00002410721019404940091838842880188F0 +:10B9D000384600F0DCF830B906AA05A93046FEF773 +:10B9E000F5FF0028E7D0822800D1002007B0F0BD85 +:10B9F0004800002010B58B7883B102789A4205D1B7 +:10BA00000B885BB102E08B79091D4BB18B789A42B0 +:10BA1000F9D1B0F801300C88A342F4D1002010BD58 +:10BA2000812010BD072826D012B1012A27D103E0BA +:10BA3000497801F0070102E04978C1F3C201052904 +:10BA40001DD2DFE801F00318080C12000AB1032030 +:10BA500070470220704704280DD250B10DE0052830 +:10BA600009D2801E022808D303E0062803D0032849 +:10BA700003D005207047002070470F2070478120B9 +:10BA8000704710B513880B800B781C061FD5FA4C35 +:10BA9000A47A844204D843F010000870002010BD3E +:10BAA00094682478C44064F304130B701378D1783D +:10BAB00003F0030341EA032140F20123B1FBF3F455 +:10BAC00003FB1411926800FB0120401C10BD90681C +:10BAD00010BD37B5BDF8041011809DF8045029063B +:10BAE0001BD5E54901239468897A814209D8FE284B +:10BAF0000FD1E80602D58B405B1E00E000232370C7 +:10BB000007E0217883409943C5F30013834019432C +:10BB10002170107820F0100010703EBD2DE9F0412A +:10BB20000746C81C0E4620F00300B04202D0862013 +:10BB3000BDE8F081082A01D90E20F9E7CE4D00209A +:10BB400034462E60AF802881AA72E8801AE0E98826 +:10BB5000491CE980810614D4E17800F0030041EA31 +:10BB6000002040F20121B0FBF1F201FB120120683C +:10BB700000F037FB2989084480B22881381A304404 +:10BB8000A0600C3420784107E1D40020D0E72DE9F3 +:10BB9000FF4F89B01646DDE9168A0F46994623F411 +:10BBA0004045084600F00DFB04000FD0099802F054 +:10BBB0005BFF0290207800060AD5AF48817A029890 +:10BBC000814205D887200DB0BDE8F08F0120FAE74B +:10BBD000224601A90298FFF754FF834600208DF802 +:10BBE0000C004046B8F1070F1AD001222146FFF79A +:10BBF00019FF0028E7D12078400611D502208DF8E2 +:10BC00000C00ADF81070BDF80400ADF81200ADF8EE +:10BC100014601898ADF81650CDF81CA0ADF81800B7 +:10BC20005FEA094004D500252E46A84601270CE00E +:10BC30002178E07801F0030140EA012040F201217F +:10BC4000B0FBF1F2804601FB12875FEA494009D55B +:10BC5000B84507D1A178207901F0030140EA01201D +:10BC6000B04201D3BE4201D90720ACE7A8191FFAA0 +:10BC700080F9B94501D90D20A5E79DF80C0028B140 +:10BC800003A90998FAF794FB00289CD1B84507D17D +:10BC9000A0784FEA192161F30100A07084F80490A4 +:10BCA0001A9800B10580199850EA0A0027D019980F +:10BCB00030B10BEB06002A46199913F013FC0EE085 +:10BCC0000BEB06085746189E099803F05FF82B46C1 +:10BCD000F61DB5B239464246009502F046FC2246B2 +:10BCE00001A90298FFF7CDFE9DF80400224620F03E +:10BCF00010008DF80400DDE90110FFF7EAFE0020D6 +:10BD000061E72DE9FF4FDFF8709182461746B9F8D9 +:10BD10000610D9F8000001EB410100EB810440F26C +:10BD20000120B2FBF0F185B000FB11764D46DDF845 +:10BD30004C803146069800F054FA29682A898B46CF +:10BD4000611A0C3101441144AB8889B28B4202D88C +:10BD5000842009B038E70699CDB2290603D5A90693 +:10BD600001D58520F5E7B9F806C00CF1010C1FFAE2 +:10BD70008CFCA9F806C0149909B1A1F800C0A90665 +:10BD800002D5C4F8088007E0104480B2A9F8080082 +:10BD9000191A01EB0B00A0602246FE200699FFF75E +:10BDA00098FEE77026712078390A61F30100320AA3 +:10BDB000A17840F0040062F30101A17020709AF8AC +:10BDC00002006071BAF80000E080002626732806A1 +:10BDD00002D599F80A7000E00127A80601D54FF0B6 +:10BDE00000084D4600244FF007090FE0CDE9026836 +:10BDF0000196CDF800900496E9882046129B089A97 +:10BE0000FFF7C5FE0028A4D1641CE4B2BC42EDD308 +:10BE100000209EE72DE9F047804600F0D2F90700A8 +:10BE200005D000264446144D40F2012916E00120B9 +:10BE3000BDE8F087204600F0C4F90278C17802F02E +:10BE4000030241EA0222B2FBF9F309FB1321006865 +:10BE500000F0C7F93044641C86B2A4B2E988601EC1 +:10BE60008142E7DCA8F10100E8802889801B288155 +:10BE700000203870DCE70000F805002010B51446FB +:10BE800031B1491E218002F0EFFDA070002010BDED +:10BE9000012010BD10B5DA4904460088CA889042D6 +:10BEA00001D3822010BD096800EB400001EB800245 +:10BEB0005079A072D08820819178107901F0030127 +:10BEC00040EA0120A081A078E11CFFF7DAFD2061A3 +:10BED0002088401C2080E080002010BD01210182CC +:10BEE00070472DE9FF4F85B04FF6FF788246A3F8E3 +:10BEF000008048681F460D4680788DF80600486827 +:10BF00000088ADF8040000208DF80A00088A0C882B +:10BF1000A04200D304462C8241E0288A401C28829B +:10BF2000701D6968FFF766FDB8BB3988414501D1CE +:10BF3000601E38806888A04236D3B178307901F02D +:10BF4000030140EA012901A9701DFFF753FD20BB41 +:10BF5000298941452CD0002231460798FFF762FD20 +:10BF6000D8B92989494518D1E9680391B5F80AC0BB +:10BF7000D6F808B05046CDF800C002F007FFDDF853 +:10BF800000C05A460CF1070C1FFA8CFC4B46039973 +:10BF9000CDF800C002F0ACFA50B1641CA4B2204647 +:10BFA00000F00FF90600B8D1641E2C828220D0E682 +:10BFB0007C807079B871F088B8803178F07801F0C1 +:10BFC000030140EA01207881A7F80C90504602F066 +:10BFD0004BFD324607F10801FFF753FD38610020A1 +:10BFE000B7E62DE9FF4F87B081461C469246DDF843 +:10BFF00060B0DDF85480089800F0E3F805000CD03C +:10C00000484602F031FD2978090608D57C49897A2D +:10C01000814204D887200BB0D6E50120FBE7CAF3A4 +:10C0200009062A4601A9FFF72CFD074614980728A0 +:10C030001CD000222946FFF7F5FC0028EBD1287818 +:10C04000400613D501208DF808000898ADF80C00C3 +:10C05000BDF80400ADF80E00ADF81060ADF8124068 +:10C0600002A94846FAF7A4F90028D4D12978E8783B +:10C0700001F0030140EA0121AA78287902F00302C5 +:10C0800040EA0220564507D0B1F5007F04D9611E71 +:10C09000814201DD0B20BEE7864201D90720BAE7C5 +:10C0A000801B85B2A54200D92546BBF1000F01D007 +:10C0B000ABF80050179818B1B9192A4613F012FAC4 +:10C0C000B8F1000F0DD03E4448464446169F02F09A +:10C0D0006FFE2146FF1DBCB232462B46009402F093 +:10C0E0007DFA002097E72DE9F04107461D461646E8 +:10C0F000084600F066F804000BD0384602F0B4FCA5 +:10C100002178090607D53E49897A814203D88720DC +:10C110000EE501200CE522463146FFF7B2FC65B181 +:10C120002178E07801F0030140EA0120B0F5007FBA +:10C1300001D8012000E0002028700020F8E42DE95B +:10C14000F04107461D461646084600F03AF804003E +:10C150000BD0384602F088FC2178090607D528491B +:10C16000897A814203D88720E2E40120E0E4224674 +:10C170003146FFF7AEFCFF2D14D02178E07801F0B6 +:10C18000030240EA022040F20122B0FBF2F302FB7C +:10C19000130015B900F2012080B2E070000A60F3CC +:10C1A000010121700020C3E410B50C4600F009F82D +:10C1B00028B1C18821804079A070002010BD0120E5 +:10C1C00010BD0F49CA88824209D340B1096800EB0B +:10C1D00040006FF00B0202EB800008447047002023 +:10C1E0007047C0B2820609D4000605D50448807A9B +:10C1F0004843401C80B27047084670470020704793 +:10C20000F805002010B50C4601F06AFD80B3204609 +:10C2100000F0A9FA68B322780F2A09D0102A07D0B3 +:10C22000022A05D0032A03D0152A2ED0FFDF1DE0F5 +:10C23000A0781E282DD00EDC0C2824D008DC09287C +:10C2400027D2DFE800F013261726261E1E1A1C0030 +:10C2500012281ED11BE0302819D01ADDA0F13A00B7 +:10C26000032816D2DFE800F011150B00002010BDE6 +:10C2700013E010E043F20200F9E70420F7E70D2095 +:10C28000F5E70F20F3E70820F1E71120EFE707209B +:10C29000EDE70320EBE7FFDFE8E7FFDFE6E700F08D +:10C2A00062BA70B50346002002466FF02F050EE01B +:10C2B0009C5CA4F130060A2E02D34FF0FF3070BD13 +:10C2C00000EB800005EB4000521C2044D2B28A42B1 +:10C2D000EED370BD30B50A240AE0B0FBF4F304FBE2 +:10C2E00013008D18303005F8010C521E1846D2B2DA +:10C2F000002AF2D130BD30B500234FF6FF7510E0B3 +:10C30000040A44EA002084B2C85C6040C0F303140D +:10C31000604005EA00344440E0B25B1C84EA40100F +:10C320009BB29342ECD330BD10B50AF024FA042836 +:10C3300003D00AF020FA052802D108F015FD50B903 +:10C340000AF024FA032803D00AF026FA032804D1BD +:10C3500007F0C2FC08B1012010BD002010BD70B56F +:10C360000C460546062102F0B6FB606008B10020CD +:10C3700006E00721284602F0AEFB606018B10120FC +:10C380002070002070BD022070BD2DE9FC470C46D6 +:10C3900006466946FFF7E3FF00287DD19DF80000BF +:10C3A00050B107F02BFCB0427CD0214630460DF056 +:10C3B000A6FF002873D115E008F022FAB04271D030 +:10C3C000214630460CF089FC002868D1019D95F883 +:10C3D000C800503518B9687E08B1012000E000207F +:10C3E000804603E0019D95F8698050354FF0010AC1 +:10C3F00095F835004FF00009A0B195F83600800798 +:10C4000010D584F8019084F800A084F80290A680EA +:10C4100095F83710A171298F2181698F618185F885 +:10C4200035903CE0304602F0C3FC070000D1FFDF4E +:10C43000384601F068FE10F0FF0008D084F8019043 +:10C440000D212170A680E08084F802A027E030460C +:10C4500002F09CFC070000D1FFDFB8F1000F21D0F3 +:10C46000384601F0E1FEB8B19DF8000038B90198F6 +:10C47000D0F8F0004188B14201D180F800903046F8 +:10C4800007F076FA84F801900A21217084F802906E +:10C49000A680A97EA17100E004E085F81990012032 +:10C4A000BDE8FC870020FBE71CB56946FFF757FF96 +:10C4B00000B1FFDF684601F06CFCFA490020896892 +:10C4C000A1F8CA001CBD2DE9FC4104460E46062019 +:10C4D00002F0ACFA0546072002F0A8FA2844C7B2D9 +:10C4E0000025A8463E4417E02088401C80B22080EA +:10C4F000B04202D34046A4F8008080B2B84204D3D0 +:10C50000B04202D20020BDE8FC816946FFF727FF58 +:10C510000028F8D06D1CEDB2AE42E5D84FF6FF70A2 +:10C5200020801220EFE738B54FF6FF70ADF800001D +:10C530000DE00621BDF8000002F0DFFA04460721F5 +:10C54000BDF8000002F0D9FA0CB100B1FFDF002104 +:10C550006846FFF7B8FF0028EBD038BD2DE9F04161 +:10C56000D1A00679076807F071FA0FF0A5FED04C4C +:10C570004FF00408102024F8388F002560804FF613 +:10C58000FF70208484F82250A08404F8075C04F82B +:10C59000385C04F80A5C04F8045CC5492571C4F8E9 +:10C5A00005703D316672481E0CF04BFDA5721B20D4 +:10C5B000A0814FF4A471E181208261820121217563 +:10C5C00061750A21A17584F81780032121766176AF +:10C5D0000E21A1760721E176062121776177E0839C +:10C5E000BDE8F08170B5AF4C0D466060217007F07A +:10C5F000A7F9FFF798FFFFF7B1FF207809F00DFECC +:10C6000008F0ECF9217860680CF032FC20780EF02C +:10C61000A1FF28460AF006FE07F0FAFA21786068C2 +:10C620000DF04CFFBDE870400FF046BE10B5012480 +:10C630000AB1002010BD21B1012903D000242046F9 +:10C6400010BD022111F00CF9F9E72DE9F0470400C3 +:10C6500000D1FFDF964D002695F8310058B1667085 +:10C660001520207095F83200A07095F83300E07026 +:10C6700085F8316068E0287840B12C22A91C20465A +:10C6800012F030FF0F2020702E705DE095F82E0024 +:10C6900060B10120E07095F82F00A07095F830008F +:10C6A00060701020207085F82E604DE080480221D7 +:10C6B0005C308246FFF707FF00B1FFDFB5F85C9002 +:10C6C000062002F0B3F90746072002F0AFF938441C +:10C6D000C7B2781C00F0FF08B5F85C00B84212D170 +:10C6E000204608F019F850BB95F8340078B366700E +:10C6F000122020702021A01C12F06BFF0220A070DD +:10C7000085F8346020E040451AD1204607F044FA0D +:10C71000E8B12078122817D1A0783C2814D1A0883D +:10C72000072102F0D8F9050000D1FFDF288807F0C3 +:10C730001FF9A088072102F0E0F900B1FFDF03E054 +:10C740002146FFF722FE10B10120BDE8F087FFE788 +:10C7500002215046FFF7B7FE18B9B5F85C104945FD +:10C76000BAD10020F1E770E710B5514C207828B11C +:10C770000A21BDE810400F2001F0D0BAFFF7D4FD28 +:10C7800008B10C2002E00FF0DDFD00202071012037 +:10C7900060710A21E170207010BD70B5444D0446EF +:10C7A000287828B1BDE8704032210F2001F0B6BAD8 +:10C7B000207818B1012801D0122010E001F0BBFA56 +:10C7C00020B10FF00AFF08B10C2008E0207801F03A +:10C7D00095FA04F11703E21D611C0FF00BFE28719E +:10C7E000012068713221E970287070BD70B5304C3D +:10C7F0000546207828B1BDE870400B210F2001F0DC +:10C800008DBA287818B1012801D012200EE0FFF768 +:10C810008BFD08B10C2009E0287801F06FFA691C43 +:10C820000FF057FD08B1002000E007202071012023 +:10C8300060710B21E170207070BD10B51C4C217827 +:10C8400029B13021BDE810400F2001F067BA0088FF +:10C850000FF0C6FE302110B10020207100E02171E0 +:10C8600001206071E170207010BD70B5104C05465C +:10C87000207828B1BDE8704031210F2001F04EBA78 +:10C8800001F059FA08B10C2005E0287800F0010009 +:10C890000FF0A0FE00202071012060713121E170B5 +:10C8A000207070BD50000020FFFFFFFF1F00000040 +:10C8B0000406002010B5F94C207828B13421BDE8D9 +:10C8C00010400F2001F02ABA01F035FA20B10FF024 +:10C8D00084FE08B10C2002E00FF0E3FD002020717F +:10C8E000012060713421E170207010BDEB480178A7 +:10C8F00019B10F21084601F011BA002101710F2171 +:10C900008170C170FF2181714FF6FF710181E4498F +:10C9100049680A7882728A8882814988C1810121A6 +:10C92000417101707047DD490A781AB14A210F2020 +:10C9300001F0F4B90088A1F85800012081F85A00EC +:10C9400000220A7148714A22CA700870704710B5F7 +:10C95000D24C207828B12B21BDE810400F2001F0E7 +:10C96000DDB90821A01D05F0ABFB002020710120DE +:10C9700060712B21E170207010BD70B5C74C21781B +:10C9800029B1BDE8704042210F2001F0C7B990F9EC +:10C990000000042816D0032814D098B1011D11D02E +:10C9A00010F1080F0ED010F10C0F0BD010F1100F7A +:10C9B00008D010F1140F05D010F1280F02D012206A +:10C9C000207103E0002506F0E5F925714220E070B2 +:10C9D00001206071207064E710B5B04C217829B156 +:10C9E0002A21BDE810400F2001F098B9A31D0122B3 +:10C9F00000F1100110F067FB002020710F20A070E3 +:10CA00002A20E07001206071207010BD2DE9FF41E7 +:10CA1000A24C207828B149210F2001F07FF9BDE810 +:10CA2000FF814FF0000884F80680B4F85800ADF894 +:10CA3000040002A9FFF793FC20B1002101A8FFF731 +:10CA400042FDE8BBBDF80400ADF8000002A980B2C9 +:10CA5000FFF785FC00B1FFDFBDF8000002F0A8F988 +:10CA6000050000D1FFDF2846039F01F0E4FB80F0C2 +:10CA7000010697F86950BDF8000002F087F9070039 +:10CA800000D1FFDF384601F0CFFB80F0010255EA0C +:10CA9000020019D0A179BDF8000004EB4101088122 +:10CAA0007E49A3791831585C65F300005854A37986 +:10CAB00062F341005854A27966F38200505400E0BA +:10CAC0000DE0A079401CA07100216846FFF7FBFC37 +:10CAD00028B9BDF80000BDF804108842B6D1012085 +:10CAE00084F8048060714921E170207097E770B587 +:10CAF0006A4C0546207828B1BDE8704045210F20DA +:10CB000001F00CB909F037FE052804D0284609F0D9 +:10CB100071FB002000E00C20207101206071452194 +:10CB2000E1702070BDE670B55C4C0546207828B1F8 +:10CB3000BDE8704043210F2001F0F0B801F0FBF890 +:10CB400038B10C202071012060714321E170207008 +:10CB5000A7E62946002006F07AFF0020F2E770B52C +:10CB60004E4C0546207828B1BDE8704041210F2089 +:10CB700001F0D4B809F0FBFB10B90AF020FE68B14F +:10CB800028780AF09EFB287808F025F9002020710B +:10CB9000012060714121E170207082E60C20F6E7EF +:10CBA00070B53E4C0546207828B1BDE8704017218D +:10CBB0000F2001F0B3B801F0BEF838B10C2020719D +:10CBC000012060711721E17020706AE6294601207A +:10CBD00006F03DFF0020F2E738B5304D04462878D6 +:10CBE00028B1BDE838404D210F2001F097B82279D7 +:10CBF00061798A4215D0A079E379984211D01F2A31 +:10CC00000FD81F290DD80022114611F095FF40B909 +:10CC10000022E079114611F08FFF10B9207A072821 +:10CC200001D9122015E04FF6FF70ADF8000009F0B1 +:10CC3000ADFDA8B909F0B0FD90B909F09CFD78B937 +:10CC400000216846FFF73FFC50B1204605F09EFFEB +:10CC500000202871012068714D21E970287038BDCD +:10CC60000C20F6E72DE9FC470C4C054694F82E0005 +:10CC700020B12821102001F051F811E4282084F877 +:10CC80003000012184F82E10A8784FF000091A28EE +:10CC90002BD014DC162837D204E000000406002054 +:10CCA00050000020DFE800F03030303030213030EC +:10CCB00030303030303030303030302121212A28AF +:10CCC00022D00BDCA0F11E000C281DD2DFE800F002 +:10CCD0001C1C1C1C1C1C1C1C1C1C1C0D3A38042875 +:10CCE00012D2DFE800F0110211022888B0F5706F4F +:10CCF0000AD21F20884684F82F0028886946FFF74B +:10CD00002EFB18B1022019E0122017E09DF8000058 +:10CD1000019F002806D007F58377019E05D106F113 +:10CD2000E90604E007F1E807F7E706F207166846A8 +:10CD300001F024F808B1387818B10C2084F82F00DD +:10CD40009BE787F80080A878307084F82F906846B9 +:10CD500001F01FF891E77CB5FD4C0546207820B125 +:10CD600025210F2000F0DAFF7CBD28886946FFF7F7 +:10CD7000F6FA002160B102202071A1602173E180E8 +:10CD80000F20A0702520E0700120607120707CBD14 +:10CD9000019A104612F1500282F83F108368A36096 +:10CDA000037B237392F83F30002BF5D12888E08075 +:10CDB000E6E710B540B10478406813B1B0F844001C +:10CDC00003E0B0F8460000E0FB201B2908D38142B5 +:10CDD00006D8B2F5A47F03D340F64800824201D9B9 +:10CDE000122010BD002010BD7CB5D94D0446287816 +:10CDF00020B13A210F2000F091FF7CBD01266E7119 +:10CE00001F2028710F20A8703A20E8702E7020880B +:10CE10006946FFF7A4FA08B102200DE0A2886188F4 +:10CE200001236846FFF7C5FF30B9A2886188002357 +:10CE30006846FFF7BEFF08B128717CBD9DF8001061 +:10CE40000020002901990988E9802871019918D0EA +:10CE500081F82961019A6188A2F82E11019AA188AE +:10CE6000A2F83011019A6188A2F82A11019AA188CA +:10CE7000A2F82C11019981F82861019981F8290102 +:10CE80007CBD81F80161019A6188A2F80611019ABE +:10CE9000A188A2F80811019A6188A2F80211019AEA +:10CEA000A188A2F80411019981F80061019981F823 +:10CEB00001017CBD034600200AB1012200E00222EC +:10CEC0001A4204D14A0703D0890700D111207047C4 +:10CED000122070477CB59E4D0446287820B13F2132 +:10CEE0000F2000F01BFF7CBD012068711F212971FC +:10CEF0000F21A9703F21E970287061782078012204 +:10CF0000FFF7D8FF28B9A17820780022FFF7D2FFD9 +:10CF100008B128717CBD617820786B46012200F051 +:10CF200046FFA178207801AB002200F040FF9DF879 +:10CF3000000085F84C009DF8040085F84D000020A5 +:10CF4000E7E770B5824D86B004461F200E4685F88F +:10CF50002F00208803A9FFF702FA08B102200BE096 +:10CF6000E178A0780122FFF7A5FF28B92179A07800 +:10CF70000022FFF79FFF18B185F82F0006B090E45C +:10CF8000E178A07802AB012200F011FF2179A078AE +:10CF90006B46002200F00BFF9DF80C3001203A2276 +:10CFA0000021002B049B93F891301AD0012B31D033 +:10CFB000049A82F83401049A82F83201049880F8C5 +:10CFC0003361049A9DF8080082F83501049A9DF8AF +:10CFD000000082F83601049880F8341185F82F108B +:10CFE000CCE7012B16D0049A82F80C01049A82F83F +:10CFF0000A01049880F80B61049A9DF8080082F8F1 +:10D000000D01049A9DF8000082F80E01049880F842 +:10D010000C11E3E785F82F20B0E71CB54C4991F8D7 +:10D020002E202AB1BDE81C405221102000F076BE0F +:10D03000522281F83020012281F82E200188ADF89B +:10D04000001081788DF80210C1788DF803100179F5 +:10D050008DF80410C088ADF8060000216846FFF77F +:10D0600070FF1CBD2DE9F041394C0546207828B1F0 +:10D07000BDE8F0411D210F2000F050BE1F2020719F +:10D08000012060711D21E170207009F074FB0C26F5 +:10D0900004283CD005283AD0A9791220012904D0CF +:10D0A00019B1022901D0032926D1297809B1012912 +:10D0B00022D1E97929B1012903D0022901D003291C +:10D0C0001AD1698843F6FD720B1F3020934213D2A8 +:10D0D000AB881B1F93420FD22187A8886087002747 +:10D0E000A87907F0B2FD90B1E87907F005FE28783D +:10D0F000012804D030B10CE02071BDE8F08100219E +:10D10000022001E00021012007F025FE08B1267170 +:10D11000F3E72771F1E770B50D4C217829B1BDE82F +:10D1200070401E210F2000F0F9BD1F212171012147 +:10D1300061711E22E270217002781221012A00D052 +:10D140001AB9407830B1012804D0217143E40000BD +:10D150000406002000260C25012A08D009F00BFB4C +:10D16000052802D008F072FF40B1257133E407F0C2 +:10D1700083FD618F208F09F007F9F5E726712AE416 +:10D180002DE9F047FD4C0646B0F84600B4F844508F +:10D190000F46854200D3054696F84D1000F0B5FDC8 +:10D1A0000146B4F84600814205D896F84D10B6F80D +:10D1B000460000F0AAFD8046A146B4F84840B6F803 +:10D1C0004400844200D3044696F84C1000F09DFDC4 +:10D1D0000146B9F84A00814205D896F84C10B6F8D5 +:10D1E000440000F092FD4FF4A4721B2C01D0904239 +:10D1F00003D11B2D08D0904506D0FD80A7F80880EC +:10D200007C80B88001203870BDE8F0872DE9FC5F94 +:10D210000646AFF66C11D94DD1E900A195F82E0064 +:10D22000884628B1BDE8FC5F2121102000F076BDC2 +:10D230001F2085F82F00212085F830004FF0010BCA +:10D2400085F82EB0304600F0BEFD002811D109F05F +:10D2500092FA05280CD009F08EFA042808D095F827 +:10D26000340028B907F0CCFAA0F57F41FF3901D08E +:10D270000C20D4E0062101A801F0FEFB04007CD0C4 +:10D2800003210FF04CFDB5F85600A4F84400B5F8A2 +:10D290005600A4F8460095F84C0084F84A0095F82A +:10D2A0004D0084F84B0095F84F000090B5F85610EB +:10D2B00095F84E3020880A4601F0BFFC04287DD046 +:10D2C00000B1FFDF208806F052FB04F10D07B4F82F +:10D2D00000900421384604F0F3FE494638460FF02A +:10D2E00066FEA7A03F1D006800900321684604F079 +:10D2F00072FE002069460A5C3A54401CC0B2032802 +:10D30000F9D3308A6080708AA080B08AE08095F876 +:10D31000512095F85010012320460FF0FAFF0146E6 +:10D32000204610F05CF84FF0000984F8569084F81D +:10D3300057904F46707900F0E1FC6076D6F8060011 +:10D34000C4F81A007089E083C4F808A084F80C803F +:10D3500084F8F8B004F580712046FFF711FF8DF8CE +:10D3600000700121684604F036FE9DF8000000F0D0 +:10D370000701C0F3C102114400E01DE0C0F34010FA +:10D3800008448DF80000401D2076092801D208309D +:10D390002076002120460FF0C2FC307B07F055FCC0 +:10D3A000A0B107F069FC71793079B21D07F0AFFCCC +:10D3B000070017D023E001E0092030E02088062193 +:10D3C00001F09BFB00B1FFDF072028E0208806F07A +:10D3D000CFFA2088062101F090FB00283FF448AFE7 +:10D3E000FFDF45E72146032007F0B5FC070006D123 +:10D3F00072883188204608F03CFF07000CD0208856 +:10D4000006F0B6FA2088062101F077FB00B1FFDFB5 +:10D4100085F82F70BDE8FC9F484684F8EC9085F8AD +:10D420002F00F7E738B5554C207820B122210F2086 +:10D4300000F074FC38BD1F20207101256571222089 +:10D44000E070257094F8340010BB09F094F90528B9 +:10D4500005D007F0D5F9A0F57F41FF3918D000209D +:10D460002071684608F0D1FF0028E3D100980088B9 +:10D4700006F07EFA00980621008801F03EFB00B11C +:10D48000FFDF404884F834500078FCF71BFD38BDBE +:10D490000C20207138BD2DE9F041384D044695F837 +:10D4A0002E0028B1BDE8F0412321102000F036BC49 +:10D4B0001F2085F82F00232085F83000012085F8F3 +:10D4C0002E00618840F67B438A1F30209A4251D259 +:10D4D000A288961F9E424DD291424BD8E188B1F569 +:10D4E000FA7F47D2218940F67746A1F10A03B34279 +:10D4F00040D2B1EBD20F3DD96189A289914239D88E +:10D500004FF000082088062101F0E5FA06004FF0F0 +:10D51000020707D000F024FC20B1D6F8F000017813 +:10D5200039B902E085F82F70E7E5D6F82C110978B3 +:10D5300009B13A201EE005218171D6F8F00041467C +:10D54000A0F80880D6F8F020A0885081D6F8F02006 +:10D55000E0889081D6F8F0202089D081D6F8F000BC +:10D56000028943899A4204D88279082A01D89A42CA +:10D570000AD3122085F82F00BFE500000406002022 +:10D58000112233005000002022884280D6F8F0009B +:10D59000077085F82F10B0E52DE9FE43FE4C0646D6 +:10D5A000207830B103B02421BDE8F0430F2000F013 +:10D5B000B5BB012565712420E070257030460FF061 +:10D5C00018FD08B1002000E01220207100282BD1A6 +:10D5D00084F83C503068C4F83D00307984F841004C +:10D5E0004FF0000884F83C806946062001F0FFF9FE +:10D5F00000B1FFDF684601F0D8F998B9BDF80470B2 +:10D60000BDF80400062101F066FA060000D1FFDF34 +:10D6100086F8F850684601F0C8F918B9BDF804005A +:10D62000B842EDD184F80480BDE8FE832DE9F041D5 +:10D63000D94D064695F82E0028B1BDE8F0412C21C1 +:10D64000102000F06BBB1F2085F82F002C2085F8E0 +:10D650003000012085F82E003088062101F03BFAC9 +:10D66000040007D000F07CFB20B1D4F8F01008785B +:10D6700030B901E0022026E0D4F82C01007808B18E +:10D680003A2020E08C200027005D10F0010F19D017 +:10D69000D6F802004860D6F80600886054F8F00F0B +:10D6A000718910228181206806F10C010E3011F081 +:10D6B00019FF21680320087021683088488085F8A8 +:10D6C0002F701AE50C2085F82F0016E570B5B24DC5 +:10D6D00004460C26287828B1BDE8704018210F2098 +:10D6E00000F01CBB09F052F803284BD009F054F8A5 +:10D6F000032847D0A07908B101282DD1607928B13D +:10D70000012803D0022801D0032825D1A07B28B10D +:10D71000012803D0022801D003281DD1607BD8B195 +:10D72000C00819D162884FF48040824202D8218813 +:10D73000814203D9207901280ED118E0207930B137 +:10D74000012814D0022805D0032805D102E0202AA0 +:10D750000BD30CE0A0290AD22079042805D1208817 +:10D76000202802D36188884201D912260AE0607914 +:10D7700006F0B9FA30B1207985F83600204606F077 +:10D780001CFB064601202E7168711821E970287073 +:10D79000DCE410B5804C217829B11A21BDE8104095 +:10D7A0000F2000F0BBBA01781F2902D91220207186 +:10D7B00006E0002121710278411C104606F074FB3E +:10D7C000012060711A21E170207010BD10B5724CFB +:10D7D000217829B12021BDE810400F2000F09EBA29 +:10D7E00001781F2902D91220207106E00021217141 +:10D7F0000278411C104606F046FB01206071202192 +:10D80000E170207010BD2DE9FC41634C217829B1F5 +:10D81000BDE8FC411B210F2000F080BA0127677191 +:10D820000C21217100780026012804D0002875D031 +:10D830001220207197E006F020FA002819D006F097 +:10D8400065FA94F83600A8B1012813D0042811D045 +:10D8500008F0A2FF00280CD108F098FF18B108F0DA +:10D8600095FF02287FD1002009F02EFD00B1FFDFD7 +:10D87000267178E008F08AFF002874D108F08CFF48 +:10D88000002870D106F0BAF9A0F57F41FF396AD1BE +:10D89000072101A801F0F0F84049054688602800FA +:10D8A00000D1FFDF032128460FF032F9284606F0A9 +:10D8B00034FC34F8560FA5F8440034F80A09A5F8EA +:10D8C0004600207885F84A00607885F84B00627A37 +:10D8D000217A002328460FF01CFD0146002228462D +:10D8E0000FF098FDE07900906189A37928880A46B5 +:10D8F0004C3C01F0A2F990B1042800D0FFDF288849 +:10D90000072101F0FAF800B1FFDF072084F80400D6 +:10D9100005F594712846FFF733FC24E009E02888D8 +:10D9200006F025F8284609F0CFFC00B1FFDF26718C +:10D93000EEE708F02BFF032803D008F02DFF0328A3 +:10D9400011D108F026FF0546002009F0F7FB50B979 +:10D95000267145B1288806F00BF82888072101F0C8 +:10D96000CCF800B1FFDF1B20E0702770BDE8FC8120 +:10D970002DE9F041084C0646207828B1BDE8F04179 +:10D980002D210F2000F0CAB93088072101F0A3F83B +:10D9900005004FF0010703E00406002050000020BE +:10D9A00020D095F8090140B995F85C00112801D004 +:10D9B000122802D195F84C0150B10C2020710F2093 +:10D9C000A0702D20E0703088E08067712770ABE593 +:10D9D0001022B11C05F5857011F084FD85F80971E0 +:10D9E0000020EBE70220E9E770B5FF4C0546207800 +:10D9F00028B1BDE870402E210F2000F08FB9288893 +:10DA0000072101F068F8022178B190F809212AB9BC +:10DA100090F85C20112A04D0122A02D00C20207128 +:10DA200004E080F809110020F9E721710F20A070AF +:10DA30002E20E0702888E080012060712070A7E629 +:10DA40002DE9FC47E84C0646207828B138210F2004 +:10DA500000F064F9BDE8FC8770884BF68032122133 +:10DA600090420AD848B14FF0000830886946FEF766 +:10DA700076FC20B10220207110E021710EE00198A7 +:10DA800000F15009851C2F887288394648460FF0EE +:10DA900035F82888B842F6D184F8048001206071F6 +:10DAA0003821E1702070D5E77CB5CF4C0546207851 +:10DAB00020B148210F2000F031F97CBD288869464B +:10DAC000FEF74DFC38B10220207101206071482121 +:10DAD000E17020707CBD01987F22014680F85820BB +:10DAE00080F85920002280F85A20A87801F8280FE1 +:10DAF000E8784870287988702271E6E71CB5BA4C3E +:10DB0000217821B113210F2000F008F91CBD0088F5 +:10DB10006946FEF724FC08B1022005E0019890F860 +:10DB20002810012902D00C20207106E05821002283 +:10DB30002271095C21720088E0800120607113214C +:10DB4000E1700F21A17020701CBD2DE9F041A64CA1 +:10DB50000546207828B1BDE8F0414B210F2000F0A8 +:10DB6000DDB82888072100F0B6FF012358B382886A +:10DB70006D88C688418803EB4207BD4217D342F245 +:10DB800010777E43BF107943B6FBF1F1491E89B28D +:10DB90004FF4FA76B14200D931468D4200D229467F +:10DBA000491C521CB1FBF2F15143491E8AB290F854 +:10DBB000381101B90284E2800020207163714B208A +:10DBC000E0702370B0E40220F7E787490A781AB1C1 +:10DBD00050210F2000F0A2B8427862B1827852B191 +:10DBE000C27842B1027932B1C2881B2A03D30378CA +:10DBF0001BB1012B01D0122008E0A1F856200278B9 +:10DC0000D0F801004AB1C1F852000020087101208B +:10DC100048715022CA7008707047C1F84E00F4E78E +:10DC200070B5714C0546207828B1BDE8704051218F +:10DC30000F2000F073B8287800F0010008F010FC05 +:10DC4000287800F0010009F05DFC0020207101201F +:10DC500060715121E17020709AE570B5624D044603 +:10DC6000287828B1BDE870404E210F2000F056B84A +:10DC700000F061F808B10C200DE0601C0EF0E8FD2A +:10DC8000207800F0010006F03DF8207800F0010057 +:10DC900006F0EEFF00202871012068714E21E97026 +:10DCA000287075E570B5504C0546207828B1BDE860 +:10DCB00070404C210F2000F031B808F067FD10B91A +:10DCC00008F06AFD08B10C2003E0287806F0FCF8A3 +:10DCD00000202071012060714C21E170207057E517 +:10DCE00010B50178532907D2404A52F8211019B1D2 +:10DCF000801C8847012010BD002010BD18B10228EB +:10DD000001D00120704700207047022903D0C000D5 +:10DD1000703080B2704780003C30FAE7324A92F8A7 +:10DD20003130002B06D182F8320082F83310012006 +:10DD300082F83100704710B508F01DFD04280DD0A1 +:10DD400008F019FD052809D008F020FD032805D0AA +:10DD500008F022FD032801D0002010BD012010BDD5 +:10DD600090F8691041B990F8C81029B190F8C8002E +:10DD7000042801D0012070470020704701784068D6 +:10DD800021B190F8690010B100207047E8E7012048 +:10DD900070470178012909D1406890F8D510002911 +:10DDA00004D0002180F8D51009F0E3BB70470AB118 +:10DDB000012200E00222024201D0032001E001F032 +:10DDC00003001870704710B5038843F6FD711A1FE1 +:10DDD0008A4229D24288141F8C4225D29A4223D8E3 +:10DDE000C289911F04E0000004060020D8F9010058 +:10DDF00040F67B43994217D2018A8C1F9C4213D272 +:10DE00008A4211D8428AB2F5FA7F0DD2828A40F650 +:10DE10007744A2F10A03A34206D2B2EBD10F03D991 +:10DE2000C18A028B914201D9302010BD017911B114 +:10DE3000012910D107E0417929B1012903D0022934 +:10DE400001D0032907D1007B38B1012805D0022871 +:10DE500003D0032801D0122010BD002010BD000007 +:10DE60004A30704708440830424301F14A001044E8 +:10DE700080B27047F0B51D460446A818059B0830CF +:10DE800000FB03F205F14A00104487B2B94238BFE3 +:10DE9000FFDF002626606660A660E6602661666198 +:10DEA000A661E66126624FF6FF706662A082A7F166 +:10DEB000280080B265776080B0F5004F88BFFFDF33 +:10DEC000608805F13C01884238BFFFDF6088401B55 +:10DED000A0F13C011B2934BF1B203C382080A677D1 +:10DEE000F0BD816188617047408870472DE9F04F2F +:10DEF0000D46C188044600F12808008921F400433A +:10DF000020F4004221F4004620F400474FF0010ABB +:10DF10004FF000099A4208D100F4004001F400419A +:10DF200088421CBF0020BDE8F08FB7420BD9617F4B +:10DF3000B81B401A083885421BDC08EB060000219C +:10DF4000058041801EE06088617F801B401AB0F12F +:10DF5000080B0ED4BBF11B0FB8BFFFDF5D45D4BF6C +:10DF600029461FFA8BF1681A0204120C18BFBA4234 +:10DF700004DD84F817900020BDE8F08F08EB060060 +:10DF80000180428084F817A0BDE8F08F2DE9F041B0 +:10DF9000044600F12802C08820F40043E07D0028F8 +:10DFA00008BFBDE8F081D0180288438813448B4233 +:10DFB0003CBF0020BDE8F081002791429CBF01805A +:10DFC000478013D9891A0D042D0C45800ED0E088A6 +:10DFD000A61D20F40040854288BFFFDF30884FF443 +:10DFE000004121EA0000284330800AE0627F008877 +:10DFF00002F108031044083081B26288A01D00F0CD +:10E00000A8FBE7750120BDE8F08130B4B0F804C08A +:10E01000C488034600F128052CF400402844A44598 +:10E0200003D10020188230BC7047B3F80CC00488BC +:10E03000A44509D34088ACEB040CA0EB0C0084B2DF +:10E040000CEB0500C01E06E0A4EB0C045D7FA4B23F +:10E05000AC446044401DB1F800C0A44588BF0C80AA +:10E06000B3F80CC0BCF1000F0CBF4FF0010C4FF027 +:10E07000000C82F800C00988198230BC70472DE975 +:10E08000F041044600F12801808820F40040451842 +:10E09000208A002808BFBDE8F081A08910B9A069D6 +:10E0A000807F2871A089218A084480B2A0812988B4 +:10E0B0006A881144814238BFFFDF28886D88A289B1 +:10E0C0004119002791421AD175B1A088261D20F46C +:10E0D0000040A84238BFFFDF30884FF4004121EAFA +:10E0E00000002843308009E0627F1044083081B28C +:10E0F00002F108036288201D00F02BFBA781278214 +:10E100000120BDE8F0812DE9F0474189B0F8048095 +:10E110000027044600F1280A414518BF4FF4004982 +:10E120003AD000BF21F40040504446886EB1608967 +:10E1300004F10A0520F40040B04238BFFFDF288810 +:10E1400029EA00003043288021E0637F008803F142 +:10E15000080C18446389083023F400456288284479 +:10E1600080B204F10A0190420BD2121A92B20CF161 +:10E170001B0C62452CBF03F4004229EA030004D2C1 +:10E1800004E0801A80B229EA030210430880781C58 +:10E19000618987B24145C5D13846BDE8F0872DE990 +:10E1A000F047B0F808800B46044600F12801B0F8AB +:10E1B0000A90808828F4004C01EB0C05804504BFD0 +:10E1C0000020BDE8F087002A1CBF681D106023B145 +:10E1D000627F691D184611F085F92F886D888DB111 +:10E1E000E81987B2208904F1080620F40040A8420B +:10E1F00038BFFFDF30884FF4004121EA0000284398 +:10E2000030800AE0607F6288C119083100F108039C +:10E2100089B204F1080000F09CFAC84504BF2089C7 +:10E2200060813846BDE8F0878188C08881420CBF94 +:10E230000120002070478188008988420CBF01209E +:10E240000020704730B48488C28800F1280324F489 +:10E25000004C22F40041634494421BD08289048A1A +:10E2600015191C885A88A3189D4216D312B18A42E8 +:10E2700010D212E0437F0CF1080C1A196244408856 +:10E2800092B2801A80B22333984201D211B104E0D5 +:10E290008A4202D130BC0020704730BC0120704758 +:10E2A0002DE9F007B0F806C0048900F128070246FE +:10E2B0002CF400457E1924F400492CF4004A002077 +:10E2C00024F400434FF00108D1450AD104F400447E +:10E2D0000CF4004C644504D05082BDE8F0070020E7 +:10E2E0007047AB4208D992F81DC05B1BA3EB0C032F +:10E2F000A3F10804002308E0B2F802C0547FACEB9D +:10E30000050CACEB040CACF10804002CE4DBB2F817 +:10E310000EC0BCF1000F0DD0B6F800C075884DB12D +:10E320005B1B10778B42D7DBD0893844A0EB0C0005 +:10E33000C01E09E0A4EB0C0410778C4208DB507F70 +:10E34000D38918443044401D5182BDE8F00770471E +:10E350008B42A8BF82F81C80E6DABDE72DE9F05FAA +:10E36000044600F1280AC088934620F400400AEBD6 +:10E370000005608A894608B1484502D20020BDE800 +:10E38000F09FE08980B1B5F800806E8808EB060147 +:10E39000884218BFFFDF207F4FF0000750EA0601D8 +:10E3A00008D0002840D04AE04FF00008A17F464640 +:10E3B0002971F0E7E08948B1617F01444819B4F858 +:10E3C0001F10A0F8051094F82110C171E18908EB25 +:10E3D00009004944E18128806F80BBF1000F19D00A +:10E3E000607F298800F108030144083189B26288FE +:10E3F000A01D00F0AEF9E781A07F401CA077A07DB2 +:10E4000000281CBFE088A082A7756782E7750120FD +:10E41000BDE8F09F607FE18908442844B0F805100A +:10E42000A4F81F10C0792EE0E089B4F81F10504402 +:10E43000A0EB080020F8031D94F82110817006EB72 +:10E44000090086B2E089BBF1000F4844E081A5F8DD +:10E4500000806E800ED0E088A51D20F40040B04200 +:10E4600038BFFFDF28884FF4004121EA0000304325 +:10E470002880C0E7E0895044A0EB080030F8031D75 +:10E48000A4F81F10807884F82100BEE7818800F18D +:10E49000280221F4004C6244B0F814C0C3886145DE +:10E4A00018BF99420FD0818969B9806968B18388A2 +:10E4B0000189994209D021F400412830084411799A +:10E4C0000079884201D1002070471046704700F162 +:10E4D0002803407F01F1050C604410600888002883 +:10E4E00004BFD81E106008884988084480B270476D +:10E4F0002DE9F04115460A4600F128061C46407FEA +:10E50000531D034410885788069900281CBFC01C5F +:10E5100080B226D088429CBF081A80B213D9401A14 +:10E52000A042A8BF20461FFA80F858184246294644 +:10E5300010F0ACFF002818BFBDE8F0814544A4EB03 +:10E54000080084B2002001198F423CBF4FF0FF3019 +:10E55000BDE8F081304422462946BDE8F04110F084 +:10E5600095BFFA1C97B2F61ED4E72DE9F04100F1F1 +:10E5700028071D46407F4B1D03441646088800248B +:10E58000B1F80280069A00281CBFC01C80B21FD0C0 +:10E5900090429CBF101A80B20DD9801AA842A8BF21 +:10E5A000284684B299182246304610F09BFF281B5B +:10E5B00085B2264400204119414506D839182A461B +:10E5C000304610F08FFF601984B22046BDE8F0811C +:10E5D00008F103011FFA81F8FF1ED9E72DE9F04188 +:10E5E00016460A4600F128071D46407F531D034486 +:10E5F00010880024B2F80280069900281CBFC01CB5 +:10E6000080B21FD088429CBF081A80B20DD9401A30 +:10E61000A842A8BF284684B258182246314610F0B6 +:10E6200061FF281B85B2264400204119414506D8C8 +:10E6300038442A46314610F055FF601984B220460E +:10E64000BDE8F08108F103021FFA82F8FF1ED9E746 +:10E65000401D704770B5044600F12801C2888088CB +:10E6600020F400431944904208D0A289002A04BF34 +:10E67000228A002A02D1A28A904201D1002070BDD4 +:10E68000B1F800C04D8885B1261D20F40040A84295 +:10E6900038BFFFDF30884FF4004121EA00002843F3 +:10E6A000308000202082012070BD607F0CF10801C5 +:10E6B00000F10803084481B26288201D00F049F887 +:10E6C000EFE70021C18101774182C17581757047F3 +:10E6D00003881380C289002A04BF00207047C288C3 +:10E6E00000F1280322F400421A440A60C0897047EE +:10E6F00010B50446808AA0F57F41FF3918BFFFDFBF +:10E70000E088A082E089002818BF0120A07510BD14 +:10E710004FF6FF71818200218175704710B5044664 +:10E72000808AA0F57F41FF3908BFFFDFA07D28B9AF +:10E73000A088A18A884204BF002010BD012010BD1E +:10E740008188828A914205BF807D002800200120B7 +:10E75000704710B4B0F800C02CF40044214489B2D2 +:10E760004FF4004491420AD2521A92B21B339A4299 +:10E770002CBF0CF4004224EA0C0104D204E0891AF4 +:10E7800089B224EA0C021143018010BC70472DE9C4 +:10E79000F04188464FF6FC7102F103021E46040068 +:10E7A00002EA010509D00027E01C20F00300A04286 +:10E7B00000D0FFDF201D01210CE00127F4E7024615 +:10E7C00028442FB9B14201D2034600E00023136070 +:10E7D000491CC9B2B142F2D9011BC8F80010002F80 +:10E7E00004D10EB1201D00E000202060BDE8F081C2 +:10E7F000024600201168002902D00846096811600D +:10E80000704702680A60016070474FF6FC73C91CCC +:10E810001940101A001F90FBF1F0C0B270474FF67C +:10E82000FC73C91C1940001D01FB02007047000069 +:10E83000F8B5D24D04460E46A878A04200D8FFDFB6 +:10E8400005EB8607B86A50F8240000B1FFDFB8680E +:10E85000FFF7CEFF05000DD0B86A062E40F8245011 +:10E860000AD0082E00D3FFDFC548294650F82620DD +:10E87000204690472846F8BDC048C24B7A30A0F1E8 +:10E880002E020090294620460AF011FAF2E72DE9FF +:10E89000F84F8046DDF828901E4603EB09009346AA +:10E8A0008A46C4B25FEA080707D00025FF2800D9CE +:10E8B000FFDFBAF1000F03D101E00125F6E7FFDF2A +:10E8C00008F1030020F00301414500D0FFDFCB45F4 +:10E8D00000D9FFDF65B9A94A00204C324FF6FF711D +:10E8E00010705180A74A1070A44A7A32107051807B +:10E8F000A24880F800B046708470C47004714471FE +:10E9000080F80690DFF878B2C67100260BF1400B54 +:10E910008146FF1C27F003000746002D02D109EBBA +:10E92000860188603BF8162019F8063001D04FF0B8 +:10E9300000006946FFF72BFF0098761CF6B20744EB +:10E94000082EE6D3FF1C27F003002346064675B1C8 +:10E95000002002226946FFF71AFF009831180020B4 +:10E9600003464E46C91C21F003021DB110E0C9F850 +:10E970004800EEE706EB80070021BA6206E000BF20 +:10E98000D7F828C04CF82130491CC9B2A142F7D3AE +:10E99000401CC0B202EB84010828E3D3A1EB0800BD +:10E9A000AAF800000020BDE8F88F10B5044603F077 +:10E9B000FFFE08B1102010BD2078704A618802EB7C +:10E9C000800092780EE0836A53F8213043B14A1CEC +:10E9D0006280A180806A50F82100A060002010BDF4 +:10E9E000491C89B28A42EED86180052010BD70B5FD +:10E9F00005460C46084603F0DBFE08B1102070BD4A +:10EA0000082D01D3072070BD25700020608070BDE7 +:10EA10000EB56946FFF7EBFF00B1FFDF6846FFF771 +:10EA2000C4FF08B100200EBD01200EBD10B5044684 +:10EA3000082800D3FFDF5148005D10BD3EB50546F4 +:10EA400000246946FFF7D3FF18B1FFDF01E0641C23 +:10EA5000E4B26846FFF7A9FF0028F8D02846FFF780 +:10EA6000E5FF001BC0B23EBD44498978814201D90F +:10EA7000C0B27047FF2070472DE9F0410C460546B3 +:10EA8000062901D0072C10D13C4FB86CFFF7B0FE1F +:10EA900002004FF6FF7604D00221B86CFFF7B5FEF6 +:10EAA00000E030462880B04202D10020BDE8F0816D +:10EAB0002146FFF7BDFE040002D1288800F050F87F +:10EAC0002046F3E7A0F57F42FF3A01D0082901D3A1 +:10EAD00000207047ACE6A0F57F42FF3A0BD0082932 +:10EAE00009D2264A9378834205D902EB8101896ACB +:10EAF00051F820007047002070472DE9F04104468E +:10EB00000D46A4F57F4143F20200FF39CED0082D17 +:10EB100001D30720CAE719494FF000088A78A242BA +:10EB2000C4D901EB85072146BA6A52F82460002E49 +:10EB3000BCD0134A08462032314652F8252090476F +:10EB4000B96A062D41F8248001D0072D02D1204654 +:10EB500000F006F83146B868FFF753FE0020A5E73D +:10EB600010B5064CC2B20221A06CFFF758FE014658 +:10EB7000A06CBDE81040FFF744BE00006406002012 +:10EB800024FB01005C00002001469B480022006835 +:10EB90000260037A00EB830040F80C2F818011465D +:10EBA00000F01AB92DE9F05F9846DDF828B0DDF8DD +:10EBB00030A01546894604004FF0000627D00027F4 +:10EBC000E01C20F00300A04200D0FFDF85B301204D +:10EBD000FFF746F900FB05610AEBCA0202EB0B00E6 +:10EBE0000E180120FFF73CF900FB05610B9800EBC4 +:10EBF000C00202EB0800084405EB450100EB4100B0 +:10EC0000143000EB850000EB850617B110E00127FA +:10EC1000D6E77948A6EB8507A9000460257204F1C0 +:10EC20000C000C3F606010F0F6FCB8B2FFF7ACFFD0 +:10EC30000020C9F80060BDE8F09F2DE9FF4F6E4C41 +:10EC4000814681B020689A468B4600B9FFDF206874 +:10EC5000027A4A4503D9426852F8291021B143F299 +:10EC6000020005B0BDE8F08F006800B9FFDF0121A8 +:10EC70000E9A0398FFF7F6F8C61C4FF6FC752E4067 +:10EC8000584601215246FFF7EDF8C01C00EA05087E +:10EC900008EB0600001D85B257480027006804688D +:10ECA00001E027460446206838B1A188A942F8D17E +:10ECB0003946204600F098F813E005F10800A188D5 +:10ECC00080B281422ED33946204600F08DF8A088CC +:10ECD0000022411B601902608180394600F07CF8F7 +:10ECE000A580A08860802680251D0E9F0123039AA1 +:10ECF000314628460097FFF7BDF820884146284452 +:10ED00005A460123CDF800A0FFF7B4F82088411936 +:10ED10002846FFF7E6F8384800684168002041F8C7 +:10ED200029409EE704209CE770B5334C05462068D7 +:10ED300000B9FFDF2068017AA94210D9426852F871 +:10ED4000250060B14188002342F8253003608180AE +:10ED5000194600F041F8216800200A7A08E043F2E1 +:10ED6000020070BD4B6853F820306BB9401CC0B234 +:10ED70008242F7D8002002E08A88104480B20968F5 +:10ED80000029F9D1FFF700FF002070BD70B51A4EC1 +:10ED900005460024306800B9FFDF3068017AA942D7 +:10EDA00004D9406850F8250000B1041D204670BD0C +:10EDB00070B5114E05460024306800B9FFDF306899 +:10EDC000017AA94206D9406850F8251011B131F8EE +:10EDD000040B4418204670BD19B10A68026008602F +:10EDE000704705490968F8E7006809B1086070478D +:10EDF00001490968FAE700006400002070B5044684 +:10EE000000780E4601281AD0072802D00C281AD103 +:10EE100015E0A068216905780B2D0CD0052003F0C2 +:10EE200060FC052D0FD0782300220520D4F81010A7 +:10EE300003F0BAFB07E0782300220620F8E705205C +:10EE4000216903F04EFC31462046BDE8704001F0D8 +:10EE5000A7B910B500F13902C3799478411D64F067 +:10EE600003042340C371DB070DD04B795479234051 +:10EE70004B710B79127913400B718278C9788A42F1 +:10EE800000D9817010BD00224A710A71F5E74178FE +:10EE9000012900D00C21017070472DE9F74F86B091 +:10EEA00000208C690D468DF8040009780127FA4886 +:10EEB00016464FF0070A4FF011094FF00A0B2A29A6 +:10EEC00078D2DFE811F02A00110352036903A80386 +:10EED000B303CC03FA030F043B04620481049A04D5 +:10EEE000D504E604050510053005540577059C0595 +:10EEF000C605E005EE050F06270630066306850603 +:10EF0000D6060D071B074B076A0779078A07C40750 +:10EF1000FB072708E407E807ED0714B120781D2850 +:10EF200029D0D5F808805FEA080043D001208DF889 +:10EF30000400686A059003208DF808008DF809B078 +:10EF4000286A0390A8880028EFD098F8001091B1A3 +:10EF50000F2910D27ED2DFE801F07D144CDCFDFCDD +:10EF6000FBFAF9F8F7089FF6F500022822D124B140 +:10EF700020780C2801D0002770E302208DF80400CF +:10EF8000ACE10620696A03F0ACFBA8880728EDD144 +:10EF9000204601F000F9022809D0204601F0FBF8D4 +:10EFA000032808D9204601F0F6F8072803D20120EB +:10EFB000207005E011E2002CB7D020780128D5D1CF +:10EFC00098F80400C11F0A2903D300BF85F81CB0BC +:10EFD00089E2A070D8F80010A163B8F80410A187E6 +:10EFE00098F8060084F83E00012028700320207065 +:10EFF00046E00728BAD1002C97D020780D28B5D14B +:10F0000098F8031094F83B20C1F3C000C2F3C0028B +:10F01000104201D00E2000E00F20890707D198F898 +:10F0200005100142D2D198F806100142CED194F8D1 +:10F030003D2098F8051020EA02021142C6D194F84A +:10F040003E2098F8061090430142BFD198F8040082 +:10F05000C11F00E045E20A29B8D2617F814201D98F +:10F060000620C2E3D8F800106160B8F804102181CE +:10F0700098F80600A072012028700E20207003204E +:10F080008DF80400686A059004F139000290601D53 +:10F0900003901730049067E2412890D1204601F098 +:10F0A0007AF8042802D1E078C00704D1204601F0A4 +:10F0B00072F80F289ED1A88CEF6880B24FF0400AFA +:10F0C000D4F82480FFF762FE3946082742465346AB +:10F0D0000097FFF74AFA0E208DF80400686A059041 +:10F0E000606A0290002101A8FFF788FE20780428BA +:10F0F00006D0A07F38B1012805D0032806D0AEE3A2 +:10F10000052020700BE284F8009034E71220207074 +:10F1100066E01128C1D1204601F03DF8042802D153 +:10F12000E078C00719D0204601F035F8062805D14F +:10F13000E078C00711D1A07F02280ED0204601F050 +:10F140002AF808E0AFE07DE09AE16EE14EE106E1E9 +:10F15000E5E0CBE01CE011289FD1102208F101016D +:10F1600004F1480010F0BEF9607801280DD012209B +:10F170002070E078C00703D0A07F88B301282FD08B +:10F1800085F800B08DF804B0F0E384F800A027E023 +:10F1900011288FD1204600F0FEFF082804D0204619 +:10F1A00000F0F9FF132885D12869D8B16869C8B182 +:10F1B00004F17800102208F10101074610F092F9DD +:10F1C0002078082812D014202070E078C0070FD0D3 +:10F1D000A07F022818D06178022912D00328CFD14D +:10F1E0000420FDE300208DF80400F6E00920EBE7A1 +:10F1F0000B202870296901204870206CC1E90107A3 +:10F2000092E208B1012870D10B202870296981F899 +:10F2100001A0606A4860206AC1E9020778E2206CB8 +:10F22000E2780068C2F34402521ED04000F00100B0 +:10F2300040F0800000E000200874E06A48617CE251 +:10F240000746F9E31128D0D1204600F0A4FF0A2890 +:10F2500002D1E078C00704D1204600F09CFF1528B9 +:10F26000C3D1102208F1010104F1480010F03AF96D +:10F2700020780A2812D016202070122028702969C0 +:10F280000920487004F15800486020308860103828 +:10F29000C860206C0861ACE370FC01000B2020709A +:10F2A000E4E22870D9E102289FD1204600F073FFE4 +:10F2B000042804D3204600F06EFF082809D3204616 +:10F2C00000F069FF0E2890D3204600F064FF12285A +:10F2D0008BD2A07F022888D18DF80490686A0590AF +:10F2E00098F801008DF80800FBE36CE20228AAD12F +:10F2F000204600F050FF00286FD0204600F04BFF62 +:10F300000128F9D0204600F046FF0C28F4D0052053 +:10F310008DF8080098F801008DF8090065E71128BC +:10F32000FCD1002CFAD020781728F7D16178E06A58 +:10F33000022912D05FF0000101EB4101182606EB13 +:10F34000C1011022405808F1010110F0CBF805204E +:10F35000696A00F013FF26700DE60121ECE70B2827 +:10F36000DCD1002CDAD020781828D7D16178E06A77 +:10F3700002292CD05FF0000101EB4101102202EBC9 +:10F38000C1014158B8F8010008806078E16A02289C +:10F3900020D0002000EB4002142000EBC2000958EE +:10F3A000404650F8032F0A60406848600520696AAB +:10F3B00000F0E4FE6078022810D04FF000002044F6 +:10F3C000407A20F001000CD14FF001010BE04FF02A +:10F3D0000101D1E74FF00100DCE77FE24FF00100CF +:10F3E000EDE74FF000012144487279E3112895D1EF +:10F3F000002C93D02078192890D16078E16A0228F7 +:10F4000011D0002000EB40021C2000EBC2001022B3 +:10F41000085808F1010110F065F80520696A00F04C +:10F42000ADFE1A20F5E00120ECE7082898D1002C69 +:10F4300098D020781A2893D1E06A98F801200178B2 +:10F4400062F347010170E16AD8F8022041F8012F08 +:10F45000B8F8060088800520696A00F08FFE6078A1 +:10F46000022807D04FF000002044407A20F002012B +:10F470002BD033E04FF00100F6E7204441722FE338 +:10F480001128B4D1002CB4D020781B28AFD16178DA +:10F49000E06A02291CD0002101EB4101202202EB8D +:10F4A000C1011022405808F1010110F01BF805209D +:10F4B000696A00F063FE607802280CD04FF000000B +:10F4C0002044407A20F0040108D14FF00100D4E735 +:10F4D0004FF00101E0E74FF00100F1E74FF00000CD +:10F4E000CBE785F81CA0FAE33078012884D11C22F0 +:10F4F00004F11C00716810F03AF8E079C10894F842 +:10F500003B0001EAD001E07861F30000E070217F68 +:10F51000F1BB217803290AD0C0073FF4F9AD0320DD +:10F5200028708DF804B0686A059041209EE3607FE2 +:10F53000A17888423FF694AD02272771E1792046F1 +:10F5400021F0E001E171617A21F0F0016172A17AAC +:10F5500021F0F001A172FFF77CFC2F708DF804B050 +:10F56000686A05908DF808A0F2E33078112888D1F8 +:10F570008DF804A0696A0591B1680391ADF808A0FF +:10F5800008466168016021898180A17A817100E06B +:10F590006AE004202070A4E230781128A6D18DF80A +:10F5A00004A0686A0590301D02AB07C883E8070015 +:10F5B0004120ADF8080008460C210170A88CD6F84F +:10F5C0000C8080B24027D4F82090FFF7F1FB414631 +:10F5D0004FF008084A463B46CDF80080FEF7FEFF94 +:10F5E000002101A8FFF70AFCE07820F03E00801C13 +:10F5F000E0702078052801D00F200AE0A07F0028C5 +:10F600003FF4C3AD0128FBD003287DD184F80080EE +:10F61000B1E42070AFE430780328A8D170680168A5 +:10F62000A1664068E0660520287035E2317803293C +:10F630009DD171680A68226749686167216C51B978 +:10F64000A17F19B1012901D0062029E185F800A088 +:10F650002064606401E085F800A00327F3E33178BB +:10F66000022984D1317909B1297737E1A17F0229B3 +:10F6700010D00329EFD16178012910D0A17994F835 +:10F680003A2001290FD02064E178C90713D0012A5C +:10F690000ED010E0B0680028E7D020640BE0A2791B +:10F6A00094F83A10EDE7B1680029DED02164EBE769 +:10F6B000F0680028D9D06064CDE78DF804B0696A9D +:10F6C0000591E1785846C90709D06178022903D12C +:10F6D000A17F29B1012903D0A17F032900D00820EF +:10F6E000287012E230781128BFD1B0682862092052 +:10F6F0002870E0782969C0070FD081F801A0206A3E +:10F700004860606A886000E0ABE004F16800C860AF +:10F71000A07F02287FF48FAD81E501204870206C26 +:10F72000486004F16800886004F13800C860201D5A +:10F730000861206B4861606B88611FE2E178307876 +:10F74000C90701D0062100E00A2188428DD1207826 +:10F75000072817D084F800908DF804A0686A0590F7 +:10F76000286A0390ADF80890032100F8011B1022CD +:10F7700071680FF0B7FE002101A8FFF73FFB0020E2 +:10F780002862C2E408202070E6E730781128ABD167 +:10F790008DF804A0686A0590B0680390ADF80890F1 +:10F7A000042100F8011B102204F168010FF09AFEF9 +:10F7B000002101A8FFF722FB2078092801D013209F +:10F7C00027E784F800B016E0E1783078C90701D067 +:10F7D000062100E00A21884286D1102204F1480067 +:10F7E00071680FF053FE10B104202877A2E320784F +:10F7F00009283FF4C5AC0C2053E5E078C10735D0AB +:10F80000A17F012902D002291BD02CE00D202870F5 +:10F81000296981F801B06078012809D0206A486020 +:10F82000606A886004F16800C8601030086104E50F +:10F83000606A4860206A886004F17800C860103807 +:10F84000F4E7C0F3440114290DD24FF0006101EB3D +:10F85000B0104FEAB060E0706078012801D010204D +:10F8600055E40620D5E6607801288AD00E2018E5F8 +:10F87000307809288BD185F800B010208DF804006D +:10F88000686A059070680290002101A8FFF7B6FA37 +:10F89000E9E7E078C00706D0A07F01281FD10F203C +:10F8A00028700420F8E0152028702969022048708B +:10F8B000206C48606078012805D004F178008860E9 +:10F8C0001038C8605AE104F1680088601030F8E729 +:10F8D00030780228CED1307908B1287728E310207B +:10F8E00028700F20D8E030781328F7D185F80090E1 +:10F8F00029690820487070684860607801280DD038 +:10F9000004F1680088601030C860206B0861606B8B +:10F91000486104F158008861A06A21E004F1780090 +:10F9200088601038F0E730780728D7D16078012850 +:10F930001AD1A078A16A0A18C0F1100110460FF080 +:10F9400048FE1220287029690920487004F15800E7 +:10F950004860203088601038C860206C086141E041 +:10F96000C861E06A086209E11320C9E0CBE03078A1 +:10F970000828B3D1102204F1480071680FF086FD09 +:10F9800008B10B2031E720780B28EDD02046FFF797 +:10F9900060FAA078A16A0A18C0F1100110460FF0B1 +:10F9A00018FE1620287008208DF80400686A05905B +:10F9B000002049E03078112890D1B06828621420E6 +:10F9C000287029690920487004F1580048601030F7 +:10F9D00088601030C860606C08616078012800E0C1 +:10F9E0009EE006D004F139004861206B8861606BAD +:10F9F000B6E7601D4861606B8861206BB0E73078C6 +:10FA0000082892D18DF804A0686A0590286A0390AE +:10FA1000ADF808900D2100F8011B102271680FF05D +:10FA200061FD002101A8FFF7E9F900202862617853 +:10FA3000012902D01520ECE569E216212970082180 +:10FA40008DF80410696A05910290A0788DF80C0079 +:10FA50007EE130780B288CD116202870607802283F +:10FA600002D12046FFF7F5F9A07871680A18C0F1B5 +:10FA7000100110460FF0ADFD08208DF80400686AF3 +:10FA800005907068E0E730780F2895D1E079C007DD +:10FA90007BD01720287009208DF80400686A059033 +:10FAA00056E13078102887D11422311D04F11C0052 +:10FAB0000FF05DFDE16A208DA1F80900E16AA078F0 +:10FAC000C871E179E26A01F003011172E16A627AB8 +:10FAD0000A73E16AA07A81F824006078012876D060 +:10FAE000B3E13EE26078022801D0012000E000206E +:10FAF0002044407AC0070BD0E078C00708D1192015 +:10FB000028708DF804B0686A05908DF808901FE1A0 +:10FB10001E2071E63078112874D1B06828621A204E +:10FB200028700520B8E7307803286BD16078E26A46 +:10FB3000022801D0012000E0002000EB4001142049 +:10FB400000EBC1015158726813680B6052684A603B +:10FB50001B212970D5E9041205234B70636A4B60A1 +:10FB60006778E36A022F01D0012700E0002707EB46 +:10FB7000470700EBC7001858C1E90202686A4862EB +:10FB8000069800F024FBFFF75BBB87E130780E2876 +:10FB900038D16078E26A022801D0012000E000201C +:10FBA00000EB4000102101EBC00002231058093285 +:10FBB00071680EF05DF81C202870296904204870D7 +:10FBC000206A4860E06A09308860F84879E65AE1BE +:10FBD00030780D2816D16178E06A022901D0012120 +:10FBE00000E0002101EB4101182707EBC101A278D9 +:10FBF000405871680FF076FC6178E06A022902D003 +:10FC0000012101E0A9E0002101EB410107EBC10165 +:10FC10004058A1780844C1F110010FF0DAFC8DF8CA +:10FC200004A0686A0590286A0390ADF80890062140 +:10FC300001706278E16A022A01D0012200E000220C +:10FC400002EB420207EBC202401C895810220FF05F +:10FC500049FC002101A8FFF7D1F8002028621D20EF +:10FC600028708DF804B0686A05900B208DF80800A4 +:10FC70006EE03078112870D18DF804A0686A059084 +:10FC8000B06803900B20ADF80800039880F800A03E +:10FC90006278E16A022A01D0012200E0002202EB30 +:10FCA0004202102303EBC20289580988A0F8011010 +:10FCB0006178E26A022901D0012100E0002101EB14 +:10FCC0004103142101EBC30151580A6840F8032F86 +:10FCD00049684160002101A8FFF790F818E729E181 +:10FCE0006078022801D0012000E000202044407A02 +:10FCF000800701D51F2003E721207DE530781128FA +:10FD00002BD18DF804A0686A0590B0680390ADF817 +:10FD10000890082707706178E26A022901D0012162 +:10FD200000E0002101EB41031C2101EBC301401C59 +:10FD3000515810220FF0D6FB002101A8FFF75EF802 +:10FD4000202028708DF804B0686A05908DF808703E +:10FD5000314601A8FFF752F815E775E03078112811 +:10FD600072D18DF804A0686A0590B06803900820ED +:10FD7000ADF80800039809210170E1690978490884 +:10FD80004170E16951F8012FC0F802208988C180D3 +:10FD9000002101A8FFF732F8AEE76078022801D011 +:10FDA000012100E000212144497A490701D52220A0 +:10FDB000A6E6012849D068E03078112844D1B0681F +:10FDC000286223202870296904204870206A48602E +:10FDD000E06A09308860764873E530780D2833D1C1 +:10FDE0006178E06A022901D0012100E0002101EBE5 +:10FDF0004101202707EBC1011022405871680FF024 +:10FE000071FB8DF804A0686A0590286A0390ADF82C +:10FE1000089080F800B06278E16A022A01D00122DD +:10FE200000E0002202EB420207EBC202401C8958AC +:10FE300010220FF057FB002101A8FEF7DFFF002082 +:10FE400028626078B5E791E037E02420D4E4607858 +:10FE500002280BD000202044407AC10702D0E1786C +:10FE6000C90705D0810705D51920A9E40120F2E7CB +:10FE70001720A5E4400701D51B20A1E41C20207019 +:10FE80006078012801D01820B6E42720B4E42820A7 +:10FE900028700B2000E63078122849D12920ABE4E5 +:10FEA0002078012844D00C2842D02046FEF7EFFFEE +:10FEB0000C208DF80400686A059039E030784FF026 +:10FEC0002608112805D012203070032785F80080FD +:10FED0004CE08DF804A0686A0590B0680390022099 +:10FEE000ADF80800039805210170297F41700021B9 +:10FEF00001A8FEF783FF0B208DF80400686A0590C7 +:10FF0000314601A8FEF77AFF074685F80080012FE9 +:10FF10000ED02BE001208DF80400686A05900420C3 +:10FF20008DF80800287F8DF809000020287712E05E +:10FF3000287F80B11D202070252028708DF804B006 +:10FF4000686A059002208DF80800314601A8FEF786 +:10FF500055FF07460AE00CB1FE2020709DF8040012 +:10FF600020B1002101A8FEF749FF0AE409B0384694 +:10FF7000BDE8F08F2DE9F04F0C4601274E69097856 +:10FF800085B09046BA464FF00209072021B10129F9 +:10FF90004ED002291FD1C8E0217901290AD00229B7 +:10FFA00015D0032910D0042915D11BE068FC0100ED +:10FFB00074FB0100707801280CD10620616A02F000 +:10FFC00069FB002807D11AE01D20307017E0717816 +:10FFD000022901D0052796E031780C2927D18DF828 +:10FFE00004000EE03078011F042902D30E380328E4 +:10FFF0001DD2B07F02281AD12089022817D38DF88C +:020000040001F9 +:10000000049084F800A020899DF80410884203D24F +:100010000A208DF800003FE01121083488F8001014 +:1000200094E80E00C8E901120327C8F80C306AE012 +:1000300098F80010112966D18DF80000616A0491CA +:10004000D8F80850029521794FF00B0B012906D002 +:10005000022929D0032911D0042954D15AE0ADF83E +:10006000049085F800B0207E4F4600F01F006870B5 +:1000700000216846FEF7C2FE377043E0ADF80490F9 +:1000800005202870207E68704E4600216846FEF7E5 +:10009000B5FE26708DF800B0606A0490414668464F +:1000A000FEF7ACFE07462EE0ADF8040085F800A090 +:1000B000207F6870607F00F00100A870A07F00F0D2 +:1000C0001F00E870E17F2971C0071FD094F820005D +:1000D00000F00F00687194F8210000F00F00A87183 +:1000E00000216846FEF78AFE2868B063A888B087BA +:1000F000A87986F83E00A069407870772879B070BA +:100100000D2030700027384605B031E70020A87177 +:100110006871E5E7ADF804900E202870207E6870C5 +:1001200000216846FEF76AFEECE7FE2030708DF88D +:1001300000A0606A049004208DF80400207E8DF8F1 +:100140000500EDE700B50023012285B005280FD09A +:1001500006280BD102208DF8002004918DF80400B0 +:100160008DF8053000216846FEF748FE05B000BD59 +:100170008DF8002004918DF80420F1E770B50C464D +:10018000054602F0AEFA21462846BDE870407823C5 +:10019000002202F009BA08B1007870470C207047BD +:1001A00070B50C0005784FF000010CD0217021468D +:1001B000F3F715FB74482178405D884201D1032094 +:1001C00070BD022070BDF3F70AFB002070BD027BFA +:1001D000032A05D000220A704B780B2B02D003E0D3 +:1001E000042070470A770A62027B9300521C027354 +:1001F000C15003207047F0B585B00F460546012475 +:10020000287B05EB800050F8046C7078411E0C29A7 +:100210000AD25D493A46123101EB8000314650F86E +:10022000043C2846984704460CB1012C11D1287B88 +:10023000401E10F0FF00287301D00324E0E70D20DA +:100240008DF80000706A0490002101966846FFF75F +:10025000A7FF032CD4D005B02046F0BD70B51546DD +:100260000A46044629461046FFF7C5FF064674B104 +:100270002078FE280BD1207E30B10020287029463E +:1002800004F10C00FFF7B7FF2046FEF700FE3046F2 +:1002900070BD704770B50E46044688210FF0BBF95B +:1002A0000225012E03D0022E04D0052070BD0120AE +:1002B000607000E065702046FEF7E9FDA57700203C +:1002C00070BD28B1027E1AB10A4600F10C01C5E7E3 +:1002D0000120704730B5044687B00D46062002F075 +:1002E00000FA2946052002F0FCF92078FE2806D005 +:1002F00000208DF8000069462046FFF7E2FF07B0B6 +:1003000030BD7FB50E4600218DF80C1041780B29C9 +:1003100003D00C2903D0002405E0846900E044697F +:100320000CB1217E91B16D4601462846FFF74FFF83 +:10033000032809D1324629462046FFF78FFF9DF852 +:100340000C10002900D0042004B070BD04F10C058D +:10035000EAE710B590B00C4607900B480421801EC8 +:1003600008900A488DF8191009900F92694606A85E +:10037000FFF7C7FF002805D11022204601990FF092 +:10038000B1F8002010B010BD7AFB010068FC01003C +:1003900070B50D46040011D085B1210128460FF03B +:1003A00018F910224E4928460FF09CF84C480121BC +:1003B0000838018044804560002070BD012070BD78 +:1003C00070B5474E00240546083E10E07068AA7BD1 +:1003D00000EB0410817B914208D1C17BEA7B914202 +:1003E00004D10C2229460FF051F830B1641C30883A +:1003F0008442EBDB4FF0FF3070BD204670BD70B51E +:100400000D46060006D02DB1FFF7DAFF002803DB0A +:10041000401C14E0102070BD314C083C20886288DC +:10042000411C914201D9042070BD6168102201EB8A +:10043000001031460FF056F82088401C20802870AC +:10044000002070BD70B514460D0018D0BCB100215D +:10045000A170022802D0102811D105E0288870B1BF +:100460000121A170108008E02846FFF7A9FF0028AD +:1004700005DB401CA070A8892080002070BD0120F1 +:1004800070BD70B5054614460E000BD000203070CC +:10049000A878012808D005D91149A1F108010A88D6 +:1004A00090420AD9012070BD24B128782070288894 +:1004B000000A5070022008700FE064B149681022F1 +:1004C00001EB0011204610390FF00CF8287820734A +:1004D0002888000A607310203070002070BD000072 +:1004E000700000202DE9F041FE4C207EE17D884225 +:1004F00008BFBDE8F0810126FB4D0027E07D215CAF +:1005000001EB810205EB8200037C052B18D0037CF4 +:10051000062B23D0037C072B34D0437C002B08BF51 +:10052000FFDF29D04774E07D16280EBF0020E07D54 +:10053000401CE075481CC0B255F8222007211AE083 +:100540000674E07D16281ABFE07D401C0020E0758F +:10055000481CC0B255F8222002210CE00674E07D50 +:1005600016281ABFE07D401C0020E075481C55F895 +:100570002220C0B203219047207EE17D8842BDD178 +:10058000BDE8F0810674E07D16281ABFE07D401CAE +:100590000020E075481CC0B255F822200821EAE787 +:1005A00070B5D24D0C2085F82900A5F53B700024CC +:1005B00080F8CD4180F8CC4100F5F4700476C47524 +:1005C00005F12C000EF0B0F9A5F58E70047585F8D4 +:1005D0002B40601E2C60A86085F8254085F82240DD +:1005E00085F8234085F8244085F82140C048A5F1CE +:1005F000E80104704470002000EB800201EB8202ED +:100600001474401CC0B20B28F6D30120F8F75EFF2B +:100610000020F8F75BFF012085F82600F9F724FC9D +:10062000B448F9F730FCB44C2070B448F9F72BFC0F +:100630006070BDE87040F8F7DDBE10B5F8F708FF50 +:10064000AD4C2078F9F738FC6078F9F735FCA74C09 +:1006500094F82800002808BF10BDF9F71EF9002003 +:1006600084F8280010BD0B20704770B59F4C94F89B +:10067000260000281CBFFFDF70BD94F82B00002867 +:1006800008BFFFDFF8F7CDFF62690025811A6FF020 +:100690007F43B1F5800F24BFA2EB000CBCF5800FA7 +:1006A0000DD38B4203D2991A0844411C07E06345DD +:1006B00028BFFFDF05D2181A1044401C4142002910 +:1006C00000DBFFDF012684F8266084F82B5094F8C5 +:1006D00029100420844A01EB810102EB8101087496 +:1006E000A068B0F1FF3F04D0B01EA0600120F8F771 +:1006F000EDFE0020F8F7EAFEF9F725F8F8F7CCFE52 +:1007000025600EF0B5FAF9F715F87D48056005602B +:100710004FF0E0214FF40040C1F88002F2F751FCA5 +:1007200073480078022804D0032805D194F82300E8 +:1007300010B184F8226001E084F82250BDE87040D6 +:10074000F8F7DCBF034668490B2000BF00EB8002CE +:1007500001EB820212F8042C22B1401E10F0FF00BF +:10076000F4D1704700EB800201EB8201012241F8D5 +:10077000143C01F8042C7047012804D0032808BF5A +:10078000002926D000E021B3584B4FF0000C83F82D +:1007900021C0574A0028907014BF022882F803C075 +:1007A0000BD0072915D2DFE801F01404060C0E1057 +:1007B00012001B2000E03A20D070012083F82100B5 +:1007C00070475820F8E77720F6E79620F4E7B52041 +:1007D000F2E700207047464810B54078F8F7C8FFA8 +:1007E00080B210BD30B5421E3F49002500EB8000AD +:1007F00001EB80040A2A02D814F8040C00B9FFDFC8 +:1008000014F8040C012818BFFFDF04F8045C30BDA5 +:1008100070B53C4C94F8CD0194F8CC1188420CBFD3 +:1008200001250025F8F7FDFEF8F7A2FF94F8CD1199 +:1008300094F8CC2191420CBF01210021A942E9D1B9 +:1008400070BD30B50D46304A44190021101A71EBC5 +:10085000010038BFFFDF2D488542C8BFFFDF2C48AD +:100860008542B8BFFFDF2B488442A8BF2A4804DA7C +:10087000002CAABF2046274830BD201830BD70B5D7 +:10088000194900EB800001EB8004244A54F8101D44 +:10089000607A002852F8202011440CBF0420022066 +:1008A000084420F07F40F8F763FF94F90850164A97 +:1008B00044190021101A71EB010038BFFFDF134803 +:1008C0008542C8BFFFDF12488542B8BFFFDF11482D +:1008D0008442A8BF104804DA002CAABF20460D4865 +:1008E00070BD1DE0D8080020F4080020DC090020BD +:1008F000820000205524010080000020E504010052 +:1009000000F50040F0060020FF7F841E0020A107B4 +:1009100000E05EF80080841E00807BE1BCFB0100EB +:10092000201870BD2DE9F04F0646FF4885B00068DD +:10093000C005C00D11D0103840B20028B8BF00F07B +:100940000F0000F1E020B4BF90F8140D90F80004FF +:10095000400908BF4FF0010A01D04FF0000A30787B +:1009600000281FBF0128002005B0BDE8F08F3079B6 +:1009700000280CBF04210221EC4ABAF1000F52F802 +:10098000200001EB000903D1E949002081F827008C +:100990006C4602AA2146B068F8F7F7FE9DF90820D8 +:1009A000F068211D10440122C01C1F28B8BF01920D +:1009B00008DB03AAF8F7E9FE9DF80C0010B10198D6 +:1009C000401C0190DDE900100844401D20F07F40EC +:1009D0000190A1EB090020F07F40009070798DF824 +:1009E0000A0000980390F8F71CFE009A019B121A67 +:1009F000181AD04922F07F4220F07F40B2F5800FD4 +:100A000026D2814224D3CA4890F82950009CCA4F6C +:100A1000181B20F07F486FF07F40001BAB4604900E +:100A20000C2D24D005EB850007EB80026FF07F438F +:100A30005068011BB1F5800F12D3A4EB000CBCF57C +:100A4000800F0DD38B4205D204990844411C07E066 +:100A500000205FE0634509D2191A0819401C414281 +:100A60000029BCBFAB46957CDADB00E0FFDF5D45CB +:100A700025D00BEB8B0007EB80026FF07F40916875 +:100A80000B1BB3F5800F12D3A4EB010CBCF5800F48 +:100A90000DD3984203D204980844431C07E06045F4 +:100AA00028BFFFDF0BD2431A1819401C4342002B0A +:100AB00005DD9DF80A00927B904228BF0C460C2D64 +:100AC00018BF9DF80A1010D005EB850007EB8000D9 +:100AD0004268121B22F07F42424506D2827B91423D +:100AE00028BF8468857C0C2DEED10098A04205D0EB +:100AF00004EB080020F07F400094019000990398D7 +:100B0000814206D001EB090020F07F40F8F730FE6B +:100B1000B0600120864991F82710002904BF05B074 +:100B2000BDE8F08FBAF1000F3FF42EAF05B0BDE87D +:100B3000F08F2DE9F04F064687B00C467F480DF048 +:100B4000FBFE4FF00108002835D07D4F387D00288E +:100B500018BFFFDF3E742079794D05F10C02287231 +:100B6000607968722946A068F8F70FFE95F90C00C5 +:100B70000F2804DD1F3828732868401C286095F969 +:100B80000C00E1682E1D0844C01C1F28B8BFC6F821 +:100B9000008009DB6A463146F8F7F7FD9DF8000052 +:100BA00010B13068401C30602078A87287F814803B +:100BB00007B0BDE8F08F634D95F8CD0116281ED023 +:100BC00095F8CD0195F8CC11401C884200D1FFDF8B +:100BD00055480068C005C00D1AD0103841B2002930 +:100BE000BDBF01F00F0000F1E02090F8140D01F1FD +:100BF000E020A8BF90F80004400909D104E095F86E +:100C0000CC010028E4D1E2E72078002818BFFFDFFC +:100C10004C4890F8CD1101EB810100EB8100067486 +:100C20002078012800F04A81022843D0454890F8F6 +:100C3000CD1101EB810100EB8105207928726079EB +:100C4000687205F10C022946A068F8F79EFD95F937 +:100C50000C000F2804DD1F3828732868401C28600A +:100C600095F90C10E0682E1D0844C01C1F28B8BF61 +:100C7000C6F8008009DB6A463146F8F786FD9DF824 +:100C8000000010B13068401C30602078A8722D48F8 +:100C900090F8CD1116290EBF002190F8CD11491CF6 +:100CA00080F8CD1125480DF05DFE07B0BDE8F04F8E +:100CB000F8F724BD234890F8CD1101AA01EB81017A +:100CC00000EB81076946E068F8F75FFD9DF90400D5 +:100CD0000F28CCBF0120002000993D1D0844019041 +:100CE000A068C01C1F28B8BFC5F8008009DB6A4691 +:100CF0002946F8F74AFD9DF8000010B12868401C0D +:100D000028600220B87260797872207938720028E1 +:100D10000CBF04210221054A52F82000014403912E +:100D20007A68481D10440FE004ED00E0BCFB0100B0 +:100D3000DC090020FFFF3F00F4080020080A002023 +:100D4000C0080020F0060020019900900844039993 +:100D5000401A0590FD4C002084F82700F8F761FC4C +:100D6000386001998046084420F07F40F86094F88C +:100D700029000C287ED0214691F8290000EB800242 +:100D8000A1F1E80000EB82025668009A324422F09A +:100D90007F42029297F809B091F829503446111B0E +:100DA00021F07F4A6FF07F41891BA94604910C2DE9 +:100DB00023D0E74805EB850100EB81026FF07F430C +:100DC0005068011BB1F5800F24BFA4EB000CBCF5EB +:100DD000800F0BD38B4203D204990844411C05E0D9 +:100DE000634509D2191A0819401C41420029BCBFA9 +:100DF000A946957CDBDB00E0FFDF4D4524D0D448DD +:100E000009EB890100EB81036FF07F429868011BB9 +:100E1000B1F5800F12D3A4EB000CBCF5800F0DD3FD +:100E20008A4203D204990144491C07E0624528BF65 +:100E3000FFDF09D2121A1119491C4942002903DDAA +:100E4000997B8B4528BF04460C2D18BFC04910D094 +:100E500005EB850001EB80004268121B22F07F4207 +:100E6000524506D2827B934528BF8468857C0C2D31 +:100E7000EED100E01BE0A64205D004EB0A0020F012 +:100E80007F4026460290029AA6EB080020F07F40A1 +:100E9000A2EB0802059922F07F42B0F5800F06D23E +:100EA000914204D30398304420F07F403860A74833 +:100EB00090F8270000287FF44DAFE8E6A548851993 +:100EC00015F8010C002818BFFFDF05F8018CADE60E +:100ED0000020F8F7EBBA0120F8F7E8BA9E4800784E +:100EE00070472DE9F0419A4E00274FF00308012585 +:100EF00006F1E80450B301285BD0022800F0E98035 +:100F000003281CBFFFDFBDE8F08194F829000C28FE +:100F100008BFFFDF84F8267084F82B5094F829006E +:100F200000EB800006EB800080F81080F8F7EDFB06 +:100F300094F8290094F82910401CC0B201EB8101FB +:100F400056F82120BDE8F0410521104794F829000A +:100F50000C2808BFFFDF84F8267084F82B5094F823 +:100F6000290000EB800006EB800080F81080F8F785 +:100F7000CCFB207F002818BFFFDF84F8255000201D +:100F8000F8F7A4FAA168B1F1FF3F04D001230022D1 +:100F90001846F8F7DFFA94F8290094F82910401C55 +:100FA000C0B201EB810156F82120BDE8F0410121DA +:100FB000104794F829000C2808BFFFDF84F826703A +:100FC00084F82B5094F8290000EB800006EB800099 +:100FD00080F81080F8F799FB0120F8F777FA94F879 +:100FE000250000281CBFA068B0F1FF3F0DD094F889 +:100FF000290094F82910401CC0B201EB810156F879 +:101000002120BDE8F04106211047207F012815D09E +:1010100002281FD0032833D004281CBFFFDFBDE8FF +:10102000F08194F8201060680123411A00221846CC +:10103000F8F790FA94F82800B8BB37E094F8240049 +:1010400028B184F82470F8F767FB84F823502777D9 +:10105000BDE8F08194F8280018B9F8F7F5FB84F89A +:10106000285094F8290094F82910401CC0B201EBD4 +:10107000810156F82120002190472777BDE8F081B3 +:10108000217B60680123411A00221846F8F762FAB2 +:1010900094F8240028B184F82470F8F73DFB84F814 +:1010A000235002202077BDE8F08103E0F8F7CCFB65 +:1010B00084F8285094F8290094F82910401CC0B2F4 +:1010C00001EB810156F82120002190472577BDE8EA +:1010D000F08121480078BDE8F041F8F7F3BE10B583 +:1010E0001A4C94F829000C2808BFFFDF94F8290057 +:1010F00094F82910401CC0B2154A01EB810152F846 +:101100002120BDE81040042110472DE9F84F80460A +:10111000087C104C401EC6B20D46A05D01281DD0B3 +:10112000022825D0297CDFF828A0481EC4B204EB91 +:1011300084020AEB8206371D0A2821D801EB8100C0 +:101140000AEB800010F8040CD8B919E0DC09002083 +:10115000F4080020D009002080000020A87A01288F +:1011600014BF02200020A05518BFBDE8F88FD9E7B2 +:10117000A87A012818BFFFDF0021A972A155D1E785 +:10118000FFDF307CDFF8289407280BD11720009070 +:1011900099F8172009F11803494620460DF018F96F +:1011A00001203074307C012804D0A87A012818BFAF +:1011B000FFDF02D0A87A01284BD1FE4B307C0228F9 +:1011C00018D099F81800162872D099F8180099F8D4 +:1011D0001710401C884200D1FFDF0120707499F87D +:1011E000180009F8004099F81800162800F09E81B0 +:1011F00000F093B9F04A92F829000146A04207D0C6 +:10120000014600EB810003EB8000807CA042F7D117 +:1012100092F829C084450CD192F8291001EB810184 +:1012200003EB8101897C82F82910012182F82A10C0 +:1012300009E000EB800203EB820201EB810103EB8A +:101240008101927C8A7400EB800003EB80000C210A +:101250008174287AD949002851F820A02968A1EB87 +:101260000A010CBF04200220081A20F07F423A60D5 +:10127000D5E90001084420F07F407860A87A022870 +:1012800018BF287B1ED038727868401D20F07F4040 +:101290007860687AB872287A06257872032872D244 +:1012A000002870D000F022FE00286DD0A1E0FFE7FA +:1012B00099F81700002890D18EE700BF89F8180030 +:1012C000BDE8F88F287A00280CBF0420022000EB2C +:1012D0000A036868591D00EB010BB9484078504576 +:1012E00003D9B54991F8231011B10BF1060003E0C1 +:1012F000A0EB0A005844801DAF4991F829C0BCF109 +:101300000C0F25D091F829C00CEB8C0EA1F1E80C44 +:101310000CEB8E0CDCF804C0624519D0DFF8A4C2D7 +:1013200091F8291001EB8102A24901EB82014A6880 +:101330008968A2EB080222F07F42A1EB080121F0AC +:101340007F41904298BFB2F5800F9DD28C459BD3D0 +:101350004044A0EB0B0020F07F4139601944E8685D +:1013600021F07F410A1A6FF07F4CB2F5800F24BF45 +:10137000431AB3F5800F11D3944506D2ACEB0000AD +:101380000844421C0AE034E02FE09C4528BFFFDF00 +:101390001DD2ACEB01010844401C4242002A16DD7C +:1013A0000520307499F81800162819D099F81800FB +:1013B00099F81710401C884200D1FFDF99F81800F7 +:1013C00009F8004099F8180016287BD0A5E0386885 +:1013D000ABF10501084420F07F407860002052E71F +:1013E00099F817000028E9D1E7E7CAF138054FF06E +:1013F000320A73480178012918BF03290AD14078BD +:10140000504507D96C4991F82310002904BFA0EB7F +:101410000A0005446B4B3868A0EB0802786822F09C +:101420007F41A0EB080020F07F4C8D4298BFB1F5C2 +:10143000800F1BD2634519D35F4991F829300C2BDB +:1014400030D091F829504FF00C0BDA46594905EB92 +:10145000850301EB8303D3F808C0ACEB080C94457B +:1014600031D8AB469D7C0C2DF0D193E00520307433 +:1014700099F81800162810D099F8180099F8171044 +:10148000401C884200D1FFDF99F8180009F800409D +:1014900099F81800162849D03FE099F8170000285D +:1014A000F2D1F0E70220307491F829000C2818BF1F +:1014B00091F82900B07481F82940012081F82A00B0 +:1014C000BDE8F88F32E00C2D1CBFAA46002261D087 +:1014D0000AEB8A0301EB8303D3F804C0ACEB080CDE +:1014E00084452CD29A7B97F80AC0944520D30520D6 +:1014F000307499F81800162813D099F8180099F844 +:101500001710401C884200D1FFDF99F8180009F835 +:10151000004099F81800162808D099F81800401CC7 +:10152000CCE699F817000028EFD1EDE70020C5E6DA +:1015300093F812A00122BAF10C0FC9D103E0002ADE +:1015400008BFAA4626D02F461A4807EB870100EBB2 +:101550008108062288F8102099F81800162838D03B +:1015600099F81800411C99F81700814200D1FFDF5B +:1015700099F8180009F8007099F8180016280EBF9D +:10158000002099F81800401C89F8180098F812708B +:10159000BA45D9D10220074F307407F1E80090F81E +:1015A0002910A9421AD186F812A080F829400BE030 +:1015B000D8080020F4080020DC090020BCFB010052 +:1015C00082000020FFFF3F00012180F82A10BDE8C3 +:1015D000F88F99F817000028CAD1C8E70C2D0CD055 +:1015E000BBF10C0F08BFFFDF0BEB8B0007EB80009C +:1015F000847486F812A0BDE8F88FBBF10C0F08BF09 +:10160000FFDF0BEB8B0007EB800084740C20B074C1 +:10161000BDE8F88F2DE9F04F83B0F8F702F80546E2 +:101620004FF00C0BFE4C94F829100026A4F1E809A9 +:101630004FF001080C292FD094F82920214602EB05 +:10164000820209EB8202127C042A25D091F829201B +:1016500002EB820209EB8202127C032A04BF03B070 +:10166000BDE8F08F2A4620696169801A491BED4B5D +:1016700020F07F4021F07F4106283CBF03B0BDE849 +:10168000F08FB0F5800F24BF03B0BDE8F08F8B4220 +:101690003CBF03B0BDE8F08FA068B0F1FF3F18BFBA +:1016A000FFDF84F8256094F82900DF4F0C2809D06B +:1016B00094F8290000EB800009EB8000007C0428EE +:1016C00008D01AE094F82100B8B1F8787870B878AA +:1016D000387012E094F829B00BEB8B0009EB800016 +:1016E00080F8108094F8290000EB800009EB80005E +:1016F000807C84F8290084F82A80DFF830A39AF8E7 +:10170000CD019AF8CC11884219D000BF9AF8CC01CB +:1017100000EB80000AEB80012846FFF7F6FC9AF800 +:10172000CC0116280EBF00209AF8CC01401C8AF884 +:10173000CC019AF8CD019AF8CC118842E6D1DFF8B5 +:10174000F0A29AF8140028B151462846FFF7DDFCB4 +:101750008AF81460BBF10C0F06D00BEB8B0009EB81 +:101760008000017C01292BD094F829000C2800F07E +:10177000ED8094F82A00002800F0F78084F82A60B1 +:1017800094F8290000EB8001AA4800EB8102A0F543 +:101790000173D2E90101D268C3F80423C3E9BF0190 +:1017A000607E00280CBF4FF004094FF00209A249E7 +:1017B000022811F82010217318BF012834D123E02A +:1017C00007210174DFF874A29AF81800162816D0C1 +:1017D0009AF818009AF81710401C884200D1FFDFD1 +:1017E0009AF818000AF800B09AF8180016280EBFE8 +:1017F00000209AF81800401C8AF81800B4E79AF8FC +:1018000017000028ECD1EAE720690844421B22F0C7 +:101810007F42382A08D903213238617620F07F4090 +:1018200020613220207309E0322907D294F8280081 +:1018300058B9F8F709F884F8288006E094F82800E9 +:1018400018B1F8F72AF884F828607B7884F82030FB +:1018500094F80CA038780621A3EB0A02012818BFDF +:10186000032804D184F82480002AC8BF911D94F86D +:1018700022B0BBF1000F18BF891C206901905044B1 +:10188000484420F07F406060BAF1000F14BF02208E +:101890000020207794F82400002808BFBBF1000F37 +:1018A00037D060480090D4F810E0D4F814C0AEEB04 +:1018B000050E2EF07F4EACEB050C20462CF07F4C35 +:1018C000714598BFBEF5800F1FD2009961451CD3AA +:1018D000002A0FDD0199BAF1000FA1EB02010161AD +:1018E0001944494421F07F4141600CBF012103218B +:1018F00021770EE004DA002B0CBF02210421F7E768 +:10190000BBF1000F08BFFFDF03E080F8246084F81C +:101910002260207F40B12069012300EB09010022F1 +:101920001846F7F717FE02E00120F7F7CFFD94F80D +:101930002900012300EB80013E4800EB8100616833 +:1019400090F90C200020F7F705FE0EE00120F7F7D4 +:10195000BDFD0020F7F7BAFDF7F79EFD94F82800CB +:1019600018B1F7F79AFF84F8286094F8220028B19C +:10197000F7F7D2FE84F8236084F8226094F82100FF +:1019800018B1F8787870B878387094F8240030B1CD +:1019900084F823603878002808BF84F8246027483A +:1019A000017EC07D814203D025484078F8F78AFA4D +:1019B00084F8278003B0BDE8F08F70B5184C054659 +:1019C00082B094F829000C2808BFFFDF94F82900A2 +:1019D00000EB8000174E06EB8000007C032818BF48 +:1019E000FFDFA068B0F1FF3F18BFFFDF94F82900C8 +:1019F00001AA00EB800006EB8000694690F90C001C +:101A00002844F7F7C2FE9DF904000F28CCBF01203F +:101A10000020009908446168084420F07F4111E0EB +:101A2000DC090020FFFF3F0082000020F0060020BC +:101A3000C0080020F4080020BCFB0100D8080020EA +:101A400080000020A16094F82500002804BF02B0A7 +:101A500070BD012302B00022BDE870401846F7F7C0 +:101A600079BD744A0B1A02F1010CB3EB9C0F3CBF19 +:101A70001846704710B5441AB4EB9C0F3CBF18468B +:101A800010BD9A4203D2101A0844401C10BD944263 +:101A90009EBFFFDF002010BD511A0844401C404289 +:101AA00010BD0123002201460220F7F753BD02209A +:101AB000F7F70CBDF7F7B5BD2DE9F0415E4C0546D3 +:101AC00082B094F82B00002808BFFFDF642D50D3AC +:101AD0005A480022401B72EB02004AD3584890F843 +:101AE000CD1190F8CC01814243D15648007D0028A9 +:101AF0003FD194F82900DFF8508100EB800008EB1B +:101B00008006206801AA28446946F7F73EFE9DF941 +:101B10000400002802DD0098401C0090B168009885 +:101B200072680F18BA1A22F07F42B2F5800F20D2E5 +:101B3000B27C0C2A09D002EB820208EB82025268C6 +:101B4000511A21F07F41814213D3A068B0F1FF3FC9 +:101B500005D00120F7F7BAFC4FF0FF30A0602068F5 +:101B60002844206027F07F40606102B00120BDE87A +:101B7000F08102B00020BDE8F0812DE9F84306466F +:101B8000401EC7B2304807EB870100EB8104207C80 +:101B9000002808BFFFDF2A4A92F8CC1192F8CD0145 +:101BA00081420DD001EB810302EB83031B7CB34226 +:101BB00010D016290CBF0021491CC9B28142F1D1B5 +:101BC00020484FF0170800F11805017D29B3007C6B +:101BD000B04222D10020BDE8F883207C05281FBF39 +:101BE000207C0628207C07280AD184F81090CDF8A4 +:101BF0000080EA7D05F11803144938460CF0E8FB33 +:101C0000607C68B16674CDF80080EA7D05F1180348 +:101C10000E4938460CF0DCFB02E04FF001090026CB +:101C2000207C012804BF607C0028D6D10120BDE8BB +:101C3000F8830000FF7F841EDC090020FF1FA1073E +:101C4000F0060020C0080020F4080020D80800207A +:101C5000F0B5734AD2F80032724D002401212E787B +:101C600056B9714E3460704F03263F1D3E606E4F73 +:101C700004260C373E602970C2F80042D160116022 +:101C8000694C4834D16425688542FBD35160D160EA +:101C9000C2F80032F0BD2DE9F041044680074FF054 +:101CA00000054FF0010604D560480560066024F089 +:101CB0000204E0044FF0FF3705D55D484660C0F8E8 +:101CC000087324F48054600003D55A48056024F05A +:101CD0008044E0050FD55248C0F80052C0F80873A0 +:101CE00051490D60091D0D604F4A04210C321160ED +:101CF000066124F48074A00409D54F484660C0F8FA +:101D00000052C0F808734D48056024F40054C4F331 +:101D10008030C4F3C031884200D0FFDF14F4404F5C +:101D200014D047484660C0F8087346488660C0F83B +:101D30000052C0F8087344490D600A1D16608660A1 +:101D4000C0F808730D60166024F4404420050AD5DD +:101D50003E4846608660C0F80873C0F848733C4847 +:101D6000056024F400640CF05DFF3A48044200D0A2 +:101D7000FFDFBDE8F08170B5202500224FEA0203A5 +:101D800020FA02F1C90719D051B201F01F0601244F +:101D9000B4404E09B60006F1E026C6F88041C6F808 +:101DA0008042002906DA01F00F0101F1E02181F8FB +:101DB000143D03E001F1E02181F80034521CAA42F5 +:101DC000DED370BD70B5174C0D466060FFF763FF42 +:101DD0006068FFF7D0FF2846F7F713FE0CF052FBC0 +:101DE00000F0D5F80CF01EFF0CF069FEF8F73CF897 +:101DF000BDE870400CF0F4BB10B50A4C6068FFF70A +:101E00004AFF6068FFF7B7FF0CF00CFFF7F7BDFE65 +:101E10000020606010BD0348406870470220704792 +:101E2000008000408800002004850040FC1F004026 +:101E300000C0004004E5014000D0004004D500404F +:101E400000E0004000F0004000F5004000B000401D +:101E500008B50040FEFF0FFC70B51F490A68BAB113 +:101E600000231D4601244A68521C4A60092A00D3F7 +:101E70004D600E7904FA06F20E6816420AD072B668 +:101E80000B6893430B6062B649680160002070BD27 +:101E9000052070BD5B1C092BE5D3FFDFF8E74FF091 +:101EA000E0214FF48000C1F800027047EFF3108189 +:101EB00011F0010F72B64FF0010202FA00F206486B +:101EC000036842EA0302026000D162B6E7E7024813 +:101ED00000210160416070479000002001208107CF +:101EE0000860704701208107486070471248006809 +:101EF000C00700D0012070470F48001F0068C007CE +:101F000000D0012070470C4808300068C00700D09E +:101F100001207047084810300068704706490C31AE +:101F20000A68D20306D5096801F00301814201D194 +:101F300001207047002070470C040040C84911F888 +:101F4000210F4978884201D3401A02E0C1F12101F2 +:101F50000844C0B27047C249233111F8210F4978B3 +:101F6000884201D3401A02E0C1F121010844C0B205 +:101F70007047BB49463111F8210F4978884201D397 +:101F8000401A02E0C1F121010844C0B27047B549CE +:101F900010B5802081F80004B1490020233101F8F8 +:101FA000210F4870AE4901F8210F4870AC49463105 +:101FB00001F8210F4870AC480CF0B6FCAA48401C50 +:101FC0000CF0B2FCF7F728FEBDE8104000F03DB978 +:101FD00020207047B2E770B50C4605460026FFF793 +:101FE000ADFF01469E48A14212D30022641EE4B216 +:101FF0000DD390F82210435C491CC9B205F8013B8F +:1020000080F822102129F1D180F82220EEE7012664 +:1020100000F01BF9304670BD202070479BE770B57B +:102020000C4605460026FFF796FF01468C482330F4 +:10203000A14212D30022641EE4B20DD390F8221004 +:10204000435C491CC9B205F8013B80F822102129E4 +:10205000F1D180F82220EEE7012600F0F6F83046B4 +:1020600070BD202101700020704710B50446FFF7B5 +:1020700080FF2070002010BD70B50C460546FFF7AC +:1020800078FF014676484630A14213D30022641EF1 +:10209000E4B20DD390F82210435C491CC9B205F894 +:1020A000013B80F822102129F1D180F82220EEE7AF +:1020B000002401E042F2070400F0C7F8204670BD9A +:1020C00070B50C460546212900D9FFDF6748006836 +:1020D000103840B200F0A0F8C6B20D2000F09CF815 +:1020E000C0B2864204D2FFDF02E000BFF7F7E4FD92 +:1020F00021462846FFF76FFF0028F7D070BD2DE975 +:10210000F047DFF86481564CA8F1010807462334F4 +:1021100098F80000DFF84891002604F1230A38B946 +:1021200094F8221094F82100212200F084F890B154 +:102130004D4699F8221099F82100212200F07BF8F1 +:10214000B8B155469AF822109AF82100212200F0E1 +:1021500072F848B335E094F82100275494F8210030 +:10216000401CC0B284F8210021282AD184F82160C3 +:1021700027E095F821002F5495F82100401CC0B2AB +:1021800085F82100212801D185F8216098F8000008 +:102190004746B0B195F8221095F82100212200F0B1 +:1021A0004AF870B13E700CE095F821002F5495F874 +:1021B0002100401CC0B285F82100212801D185F8FA +:1021C000216094F8221094F82100212200F033F8C5 +:1021D00000281FD099F8221099F82100212200F040 +:1021E0002AF8002816D09AF822109AF82100212205 +:1021F00000F021F800280DD0F7F734FD1A480CF054 +:102200009BFBB0F5005F00D0FFDFBDE8F04716484C +:102210000CF0A8BBBDE8F087002806DA00F00F003C +:1022200000F1E02090F8140D03E000F1E02090F8B8 +:10223000000440097047401C884204D0904200D1FD +:1022400009B1002070470120704710B506480CF016 +:1022500073FB002803D1BDE81040F7F7EEBC10BDBA +:102260000C0A00200DE000E09900002004ED00E0E1 +:10227000164908784A78401CC0B2904205D0144BE9 +:1022800001221A60BFF34F8F087070472DE9F041AB +:102290000E4C4FF0E02600BFF7F794FD20BF40BF83 +:1022A00020BF677820786070D6F80052EFF72AF8E0 +:1022B000854305D1D6F8040210B92078B842EBD096 +:1022C000F7F77BFD0020BDE8F08100009B000020B7 +:1022D000180502402DE9F041012528034FF0E021C7 +:1022E0000026C1F880011E4CC4F800610C2000F0EB +:1022F0002CF81C4801680268C94341F3001142F000 +:1023000010020260C4F804532560491C00E020BF9D +:10231000D4F80021002AFAD019B9016821F010017F +:102320000160114807686560C4F80853C4F800618B +:102330000C2000F00AF83846BDE8F08110B50446DC +:10234000FFF7C8FF2060002010BD00F01F02012130 +:1023500091404009800000F1E020C0F880127047F1 +:1023600000C0004010ED00E008C500402DE9F04736 +:10237000F84C0646FF21606800EB061211702178C8 +:10238000FF2916D04FF0080909EB011109EB0617D8 +:102390004158C059491E21F07F4100F0DDF918B1C4 +:1023A00094F80080454614E06168207801EB06113E +:1023B00008702670BDE8F087626809EB0510D159F6 +:1023C000105800F0C9F930B96068A84600EB081051 +:1023D0000578FF2DF0D1606800EB061100EB0810C6 +:1023E0000D700670E6E7F0B5DA4B044600200125D3 +:1023F0005A680C261B7A0BE005EB0017D75DA74245 +:1024000004D106EB0017D7598F4204D0401CC0B24C +:102410008342F1D8FF20F0BD70B5FFF74BFBCD4CE8 +:10242000014608252278606805EB0212805800F00A +:1024300093F9012808D92178606805EB011140580B +:10244000BDE87040FFF72DBBFEF748FDBDE87040CA +:10245000F7F738BD2DE9F041BE4C2578FFF72AFB90 +:102460000146FF2D6FD04FF00808626808EB051693 +:10247000905900F071F90228606801D980595EE036 +:1024800000EB051109782170022101EB0511425C76 +:102490005AB1521E4254815901F5000121F07F4189 +:1024A00081512846FFF762FF34E00423012203EB49 +:1024B000051302EB051250F803C0875CBCF1000F56 +:1024C00010D0BCF5806F10D9CCF3090250F806C0CB +:1024D0000CEB423C2CF07F4C40F806C0C3589A1AD3 +:1024E000920A09E0FF2181540AE0825902EB4C3242 +:1024F00022F07F428251002242542846FFF736FFE5 +:102500000C21606801EB05114158E06850F8272064 +:10251000384690472078FF2815D0FFF7CBFA0146C0 +:102520002278606808EB02124546805800F014F9E2 +:10253000012891D92178606805EB01114058BDE868 +:10254000F041FFF7AEBABDE8F081F0B51D46144684 +:102550000E460746FF2B00D3FFDFA00700D0FFDFAA +:102560007C48FF210022C760446005720674017038 +:1025700042701046012204E002EB0013401CE154BB +:10258000C0B2A842F8D3F0BD70B5724C064665786B +:10259000207C854200D3FFDFE06840F8256060784A +:1025A000401C6070284670BD2DE9FF5F1D468B46BC +:1025B0000746FF24FFF77EFADFF89891064699F860 +:1025C0000100B84200D8FFDF00214FF001084FF0B2 +:1025D0000C0A99F80820D9F804000EE008EB011362 +:1025E000C35CFF2B27D0BB4205D10AEB011350F887 +:1025F00003C0DC4521D0491CC9B28A42EED8FF2C69 +:102600001BD008EB04110AEB0412475440F802B047 +:102610000421029B0022012B01EB041111D0425036 +:102620004FF4806808234FF0020C454519D9A905DD +:10263000890D08D008E00C46DDE7FF2004B0BDE8B6 +:10264000F09F4550ECE7414606EB413203EB0413A3 +:1026500022F07F42C250691A0CEB0412890A81549D +:102660000BE005B9012506EB453103EB041321F01E +:102670007F41C1500CEB0411425499F800502046A0 +:10268000FFF774FE99F80000A84201D0FFF7C4FEDE +:102690003846D3E770B50C460546FFF70BFA0646F9 +:1026A00021462846FFF79FFE0446FF2817D0294DF4 +:1026B000082101EB041168684058314600F04CF8DD +:1026C00000F58050400B02216A6801EB0411515C57 +:1026D00009B100EB8120002800D1012070BD00204D +:1026E00070BD2DE9F0410F468046FFF77CFEFF28C4 +:1026F0001BD0184E357871682A462C4605E0844276 +:1027000006D0254601EB05131C78FF2CF7D10CE011 +:10271000FF2C0AD0A5420CD101EB021000783070DA +:10272000FF2804D0FFF778FE03E000200BE7FFF757 +:10273000BEF939464046FFF7ADFFFF22012371681D +:1027400003EB0413CA5401EB041201EB05111278D8 +:102750000A70F8E6780A0020401A20F07F40B0F5B1 +:10276000000F00D90020704770B50446A0F50000A6 +:102770002C4EB0F1786F02D23444A4F500042A48FC +:10278000844201D2012500E0002500F041F830B17B +:10279000B4420BD32548006804E0284370BDB4421E +:1027A00004D32348844201D20120F6E70020F4E755 +:1027B00010B50446A0F50000B0F1786F03D21948B7 +:1027C0000444A4F5000400F023F84FF0804130B138 +:1027D0001648006804E08C4204D2012003E014484B +:1027E0008442F8D2002080F0010010BD10B520B165 +:1027F000FFF7DEFF08B1012010BD002010BD10B5AD +:1028000020B1FFF7B1FF08B1012010BD002010BDBD +:10281000084809490068884201D10120704700201A +:10282000704700000000002000000200200000208F +:1028300008000020A0000020BEBAFECA0548064AD3 +:102840000168914201D10021016004490120086022 +:1028500070470000A0000020BEBAFECA40E501405B +:10286000534800210170417010218170704770B58C +:10287000054616460C460220F0F753FB4C49012052 +:1028800008704C49F01E08604B480560001F04604A +:1028900070BD10B50220F0F744FB454901200870D7 +:1028A00046480021C0F80011C0F80411C0F8081112 +:1028B00043494FF40000086010BD3D480178C9B19C +:1028C000404A4FF4000111603C49D1F80031002228 +:1028D000002B1CBFD1F80431002B02D0D1F8081115 +:1028E00011B14270102103E001214170364909689D +:1028F000817002700020F0F714BB2D480178002988 +:1029000004BF407870472D48D0F80011002904BF5B +:1029100002207047D0F8001100291CBFD0F8041124 +:10292000002905D0D0F80801002804BF0120704715 +:10293000002070471E4800B50278204B4078C8211F +:10294000491EC9B282B1D3F800C1BCF1000F10D04A +:10295000D3F8000100281CBFD3F8040100280BD0D5 +:10296000D3F8080150B107E0022802D0012805D0B1 +:1029700002E00029E4D1FFDF002000BD012000BDFE +:102980000B480178002904BF807870470B48D0F8C5 +:10299000001100291CBFD0F80411002902D0D0F882 +:1029A000080108B11020704707480068C0B270479E +:1029B000A400002010F5004008F5004000F00040A1 +:1029C00004F5014008F5014000F400404A480021A8 +:1029D00001704170704770B5064614460D460120DF +:1029E000F0F79FFA45480660001D0460001D056071 +:1029F00070BD70B5404A012540EA01411570404A5A +:102A000041F0807111603F4C0026C4F804613E4AD9 +:102A10004FF040711160002802BFC4F800522560D9 +:102A200070BD012818BFFFDFC4F8006225604FF0B9 +:102A300000703649086070BD2F48017879B1324A7C +:102A40004FF0407111602F49D1F804210021002A74 +:102A500008BF417002D02E4A1268427001700020F7 +:102A6000F0F75FBA24480178002904BF4078704726 +:102A70002448D0F80401002808BF704724480068A3 +:102A8000C0B27047002808BF704730B51A480078B8 +:102A9000002808BFFFDF1B48D0F80411002918BF29 +:102AA00030BD0224C0F80443DFF868C0DCF8001031 +:102AB000C1F30015DCF8001041F01001CCF8001053 +:102AC000D0F80411002904BF4FF400414FF0E02278 +:102AD00007D100BFC2F8801220BFD0F80431002B0C +:102AE000F8D02DB9DCF8001021F01001CCF800105E +:102AF000C0F8084330BD0000A700002008F50040E2 +:102B000004F5004000F0004008F5014004F50140E4 +:102B100000F4004010ED00E070B5F74C00250120F6 +:102B20006570257025626572A572E07284F829507F +:102B3000256304F13C00A5630BF0F6FE002818BFE6 +:102B4000FFDF84F82450ED480CF072FEEC494FF0A2 +:102B500011300860091D0860091D0860091D086022 +:102B6000091D0D60091D0860091D0860091D086028 +:102B7000091D0860091D0860091D0860091D08601D +:102B8000091D0860091D0860657770BD30B4DA4919 +:102B90000268DFF874C34A6142688A61007A087784 +:102BA0000A7DD84BACF1040401204AB10A7E00FA38 +:102BB00002F21A608D7D002D0CBF2260CCF800203F +:102BC0004A7D002A04BF30BC70474A7E904018609E +:102BD000C97D00290CBF2060CCF8000030BC7047D4 +:102BE000CB49CA480860091DCA480860704730B51B +:102BF0000546002908BF002404D0012914BFFFDFC7 +:102C00004FF0807444F4847040F48010C049086030 +:102C1000E8B240F44030091D40F000700860BE4842 +:102C2000D0F80001002818BFFFDF30BD002800B534 +:102C3000BA4908BF032004D0012816BFFFDF0420D3 +:102C400000BD086000BD70B502244FF0E0250120F2 +:102C50000022C5F88041B2490A600860B14BC10743 +:102C60001960B1490B6823F0770343F0880343F000 +:102C700000430B60AD4B40F25B6119601B1F40F2DB +:102C800003111960191F0860A44803230360A849B1 +:102C900096200860984EA74896F9241011F1080F65 +:102CA00008BFF8213CD014DC11F1280F08BFD8214F +:102CB00036D011F1140F08BFEC2131D011F1100FF3 +:102CC00008BFF0212CD011F10C0F08BFF42127D040 +:102CD00010E011F1040F08BFFC2121D0002908BF2A +:102CE000026008D0032908BF036004D0042908BF8C +:102CF000016000D0FFDF707F002814BF4FF4C020B8 +:102D00008D488E4908608F498D480860091F8E489C +:102D10000860C5F8804280491020C1F8040370BDE6 +:102D20000160E8E7744A0368C2F802308088D08006 +:102D300011727047704890F8290070476E4A5170C0 +:102D400010707047F0B50546800000F1804000F536 +:102D500080508B88C0F820360B78D1F8011043EAF8 +:102D60000121C0F8001605F10800012707FA00F656 +:102D7000764C002A04BF2068B04304D0012A18BF53 +:102D8000FFDF206830432060206807FA05F1084320 +:102D90002060F0BD10B56749044610F1080F08BF68 +:102DA000F8202CD014DC14F1280F08BFD82026D02E +:102DB00014F1140F08BFEC2021D014F1100F08BF3C +:102DC000F0201CD014F10C0F08BFF42017D011E034 +:102DD00014F1040F08BFFC2011D0002C08BF002004 +:102DE0000DD0032C08BF032009D0042C04BF0420FD +:102DF000086000D0FFDF404880F8244010BD086024 +:102E0000F9E73D4890F8340070473B4890F83600A9 +:102E100070474F4AC178116000684E49000208604F +:102E20007047252808BF02210ED0262808BF1A2186 +:102E30000AD0272808BF502106D00A2894BF0422B0 +:102E4000062202EB4001C9B2434A116043490860BF +:102E5000704729490862704727498A7A012A4AD06F +:102E6000022A18BF70474B7D002B08BF7047DFF860 +:102E7000F0C0012A7ED0CA7D4B7E002A18BF0122F5 +:102E800010F17D00CCF80000DFF8D8C00020CCF8AD +:102E90004C01180282F0010240EA025040F0031295 +:102EA000087F830003F1804303F5C043C3F8102576 +:102EB0002D4A02EB8002887EC30003F1804303F5B4 +:102EC000F833C3F81425DFF8A4C0C3F810C5C97ED1 +:102ED000CB0003F1804303F5F833C3F814251A4AF5 +:102EE000C3F81025012202FA00F002FA01F10843AA +:102EF0001F49086070473EE08C0A0020A00A0020AD +:102F0000000E0040180500500C050050060102009C +:102F10001415004025000302001000401015004069 +:102F2000FC1F0040741700403C170040381500405B +:102F3000441500400C1500400000040408F5014051 +:102F400040800040A4F501401011004040160040B0 +:102F5000241500401C150040081500405415004081 +:102F60004C85004000800040006000404C810040E3 +:102F700004F5014004E00B7D002B7FF478AF70472F +:102F80008A7D0B7E002A18BF01227E307AE72DE968 +:102F9000F84F00280CBF01220222FC4DFC4C0320FC +:102FA000AA72C4F80002687F002814BF4FF4C02042 +:102FB000F848F94F38604FF00108002933D0012953 +:102FC0004ED002291CBFFFDFBDE8F88F286A002819 +:102FD00008BFFFDF296A286B0844F0490860F149FF +:102FE000EF480860A97AF04801290EBF0460EF4954 +:102FF0000160A86B40F40020A863D4F800924FF061 +:10300000100AC4F808A30026C4F80062E8484FF488 +:10301000802BC0F800B0FF208DF80000C4F81061CC +:10302000C4F810803BE0012A13D0C4F80480022ABF +:1030300018BFBDE8F88F687D002808BFBDE8F88F8D +:10304000DC48C0F84C80DC480068BDE8F84F0A3026 +:1030500002E7C4F80080287D0028F1D1BDE8F88F90 +:10306000CA48012A806B07D0022A18BFFFDF09D0A7 +:10307000BDE8F84F0A20EFE640F48010A8634FF453 +:10308000801004E040F40010A8634FF40010386092 +:10309000EEE700BF9DF80000401E8DF800009DF88F +:1030A000000018B1D4F810010028F3D09DF80000FA +:1030B000002808BFFFDFC4F80061C4F80C61C4F841 +:1030C0001061C4F80461C4F81461C4F81861C4F84C +:1030D0002861BA4800680090C4F80092C7F800B0B0 +:1030E000C4F804A34FF400203860296A286BBDE8B7 +:1030F000F84F08440A30AFE62DE9F847A44CD4F85D +:10310000000220F00309D4F804034FF0100AC0F3C2 +:103110000018C4F808A30026C4F800629B4D687F1D +:10312000002814BF4FF4C0209A48A1490860A87A2B +:103130000127012802D0022803D014E0287D10B90D +:1031400011E0687D78B1A87EEA7E07FA00F007FA00 +:1031500002F210430860287F800000F1804000F5F3 +:10316000C040C0F81065FF208DF80000C4F8106161 +:10317000276104E09DF80000401E8DF800009DF8D6 +:10318000000018B1D4F810010028F3D09DF8000019 +:10319000002808BFFFDFC4F81061C4F828616E7210 +:1031A000AE72EF72C4F80092B8F1000F18BFC4F805 +:1031B00004A3BDE8F8870068814920F07F400860DB +:1031C00070474FF0E0200221C0F88011C0F8801253 +:1031D00070474FF0E0210220C1F8000170477949A3 +:1031E0000870704710B578480BF0A6FB002818BF90 +:1031F000FFDF10BD74480BF0B5BB74490860704721 +:1032000030B5624C0546206BA84228BFFFDF012085 +:1032100020732561607F40B1A81C20615C48D0F814 +:10322000001241F04001C0F8001262490020C1F8CC +:103230004401674920690860A06B574940F4800049 +:10324000A0634FF48000086030BD002804BF282030 +:103250007047012804BF1820704700B5FFDF282001 +:1032600000BD002804BF41F2D4707047012804BF9C +:1032700041F20400704700B5FFDF41F2D47000BD99 +:10328000002804BF42F2B8407047012804BF41F251 +:103290008830704700B5FFDF42F2B84000BDF0B59E +:1032A0003A4C06464FF002000D00207308BF42F270 +:1032B000B84706D0012D1ABFFFDF42F2B84741F2EE +:1032C0008837002E08BF41F2D47006D0012E1ABFF5 +:1032D000FFDF41F2D47041F20400381A3D49002D5D +:1032E00008444FF47A71B0FBF1F608BF282004D0EF +:1032F000012D1ABFFFDF282018203044801D2061D7 +:10330000617F41B1801C20612148D0F8001241F05A +:103310004001C0F8001227490020C1F8440121698A +:10332000206B08442A490860F0BD184901204877FD +:103330002949022008602A4928480860091F2948AD +:1033400008607047114900204877704718494FF4CA +:10335000800008600D48816B21F4800181630021A9 +:103360000173704778B514460D460646022994BF8E +:10337000022CFFDF1C481D4900680090684600EBE6 +:1033800045000057301A086078BD00008C0A002004 +:10339000001000400000040404F50140488500408E +:1033A00048810040A8F50140ACF501400410004000 +:1033B00008F50140008000404C8500401811004095 +:1033C0003C150040A9000020C80A00200415004058 +:1033D00044850040FF5702006015004044800040D3 +:1033E0009CF5014028110040D4FB01004415004029 +:1033F00078B514460D460646022A94BF022DFFDF1B +:10340000F948FA4940680090684600EB45000057CB +:10341000301A086078BDF64801214160C160002182 +:10342000C0F84411F3480160F34801637047F24863 +:1034300000B5407F002818BFFFDF4020EF4908603B +:10344000EF48D0F8001241F04001C0F8001200BD72 +:10345000E94800B5407F002818BFFFDFE848D0F8F2 +:10346000001221F04001C0F80012E4490020086079 +:1034700000BDE348D0F8001221F01001C0F800129E +:10348000012181617047DE480021C0F81C11D0F88D +:10349000001241F01001C0F800127047D84981B005 +:1034A000D1F81C21012A1EBF002001B07047D54A67 +:1034B000126802F07F02524202700020C1F81C0123 +:1034C000D14800680090012001B0704730B50C0071 +:1034D000054608BFFFDF14F0010F1CBF012CFFDF02 +:1034E000002D0CBF01200220C34901284872CC7274 +:1034F000C34904BFD1F8000240F0040007D00228FD +:1035000007BFD1F8000240F00800FFDF30BDC1F86E +:10351000000230BD70B5B84C0022E17A11F0020F04 +:1035200018BF10F0040F16D111F0100F1CBF94F843 +:103530003530002B02D094F8373063B111F0080F0A +:103540001CBF94F82830002B05D111F0040F03D0D4 +:1035500094F8291001B90122657AA94900234FF096 +:10356000010C35B100F00200104314D0BDE87040EA +:10357000C2E5607F002814BF4FF4C020A348A44ACE +:103580001060D1F8000220F00300C1F80002A3721D +:1035900084F80BC070BD012D14D0022D18BFFFDFC1 +:1035A0001CD0A07A01280CBF9A489B484FF47A712E +:1035B00000F2E730B0FBF1F0216BBDE87040081A73 +:1035C0008C3049E4D1F8000220F00400C1F8000278 +:1035D000637284F80BC084F80AC0E2E7D1F80002F5 +:1035E00020F00800C1F80002637284F80BC00220CA +:1035F000A072D6E72DE9F84F7D4FD7F84C217E4CCD +:1036000083494FF00108A07A0026CAB1012802D0F0 +:10361000022803D014E0227D12B911E0627D7AB154 +:10362000A27EE37E08FA02F208FA03F31A430A6064 +:10363000227F920002F1804202F5C042C2F810657A +:10364000A26B0A60A663217B29B1D7F84411012936 +:1036500008BF012200D00022694DD5F810110129C0 +:103660000CBF40210021012805BFD5F80C31012BEA +:10367000002320231943012805BFD5F80431012B6D +:10368000002310231943654B022804BFD3F800C060 +:10369000BCF1010F07D1D5F80CC1BCF1010F08BF77 +:1036A0004FF0080C01D04FF0000C4CEA0101022849 +:1036B00004BF1B68002B05D1D5F80C31012B08BFC6 +:1036C000042300D000231943022803D1002A18BF85 +:1036D000022200D100221143022804BFD5F80401C0 +:1036E000012805D1D7F84401012818BF012000D1D5 +:1036F000002040EA01094A48016811F0FF0F03D099 +:10370000D5F81411012900D0002184F83410006884 +:1037100010F0FF0F03D0D5F81801012800D00020C9 +:1037200084F835003F48006884F836003348006864 +:1037300018B1FFF7E2F8012800D0002084F8370024 +:10374000C5F80061C5F80C61C5F81061C5F80461E1 +:10375000C5F81461C5F81861C5F8286132480068D9 +:103760000090C7F84461314800684D46DFF8849006 +:103770000090D9F80000E062617F00291CBF801E24 +:10378000E0622B4800682063A07ADFF8A8A0022836 +:103790000CD1607850B1DAF800100978084021782F +:1037A00031EA000008BF84F8288001D084F828603E +:1037B000DFF8848015F0010F44D098F800101F4AFC +:1037C0004908E06A52F82110884701211C4A98F8FC +:1037D0000030206B52F82320904700BF98F800007B +:1037E00010F0010F39D04DE0D4FB0100441500402A +:1037F00000800040448500408C0A00206015004095 +:1038000000100040481500401C1100400000040456 +:1038100008F50140F0FE0100B0F80100001400407E +:103820004016004008140040181100404481004038 +:103830004085004004150040A9000020DCFB010089 +:1038400014FC010015F0200F18BF0221BED115F0A5 +:10385000020F18BF0021B9D1C0E7DAF80000062234 +:1038600000F10901A01C0BF011FE40B9207ADAF832 +:1038700000100978B0EBD11F08BF012000D0002054 +:1038800084F829002846FFF745FE15F0020F05D001 +:10389000274898F8001050F82100804715F00C0FC9 +:1038A00007D0244898F8001050F82110C5F3C00044 +:1038B000884715F0200F05D01F4898F8001050F8E1 +:1038C0002100804798F80000022805D105F06E001D +:1038D000402806D101F083FA98F80000042828BF98 +:1038E000FFDFA07A022818BFBDE8F88F207B0028F0 +:1038F00008BFBDE8F88FC7F84461022814D001283A +:1039000018BFFFDF216B2069884298BFFFDF206965 +:10391000C9F80000A06B094940F48000A0634FF48F +:1039200080000860BDE8F88F2169206B0844EFE74C +:10393000E4FB0100F4FB010004FC010004F501407C +:1039400010B53F4809F089FF00213D4809F0B4FF58 +:1039500001213B4809F084FF3A49002081F8220008 +:103960004FF6FF70888438490880488010BD704742 +:1039700034498A8C824218BF7047002081F82200A7 +:103980004FF6FF70888470472D49016070472E49BB +:10399000088070472B498A8CA2F57F43FF3B03D0F8 +:1039A000002101600846704791F822202549012A2C +:1039B0001ABF0160012000207047224901F1220056 +:1039C00091F82220012A04BF0020704701220270D2 +:1039D0001D4800888884104670471B4948807047FE +:1039E0001849194B8A8C5B889A4206D191F822209B +:1039F000002A1EBF01600120704700207047114857 +:103A0000114A818C5288914209D14FF6FF7181840D +:103A100010F8221F19B10021017001207047002009 +:103A200070470848084A818C5288914205D190F825 +:103A3000220000281CBF00207047012070470000B2 +:103A4000F20A0020CC0A0020AA0000207047514A48 +:103A5000012340B1012818BF7047137008689060B7 +:103A600088889081704753700868C2F8020088887F +:103A7000D0807047474A10B1012807D00EE0507837 +:103A800060B1D2F802000860D08804E0107828B154 +:103A900090680860908988800120704700207047F6 +:103AA0003C4910B1012803D006E0487810B903E082 +:103AB000087808B1012070470020704730B58DB0FC +:103AC0000C4605460D2104A80BF0A5FDE0788DF805 +:103AD0001F0020798DF81E0060798DF81D00286880 +:103AE000009068680190A8680290E86803906846B2 +:103AF0000AF062FD20789DF82F1088420CD1607882 +:103B00009DF82E10884207D1A0789DF82D1088428C +:103B100002BF01200DB030BD00200DB030BD30B56A +:103B20000C4605468DB00321E01CFEF778FA60795B +:103B30000D2120F0C00040F04000607104A80BF09F +:103B40006AFDE0788DF81F0020798DF81E006079FD +:103B50008DF81D002868009068680190A8680290A0 +:103B6000E868039068460AF027FD9DF82F00207052 +:103B70009DF82E0060709DF82D00A0700DB030BD36 +:103B800010B504460621FEF74AFA607920F0C0001D +:103B9000607110BDAE00002070B5FF4C054694F872 +:103BA0008C00002601281BD094F86A0001281CBF55 +:103BB000002070BD6E7012202870202204F16C016C +:103BC000A81C0BF08FFC0120A87184F86A60F348F0 +:103BD00040680088FBF7DAF8FAF79AFD012070BD1B +:103BE0006E7018202870D4F88D00C5F80200D4F843 +:103BF0009100C5F8060084F88C60EFE7E64890F87D +:103C00006A10002914BFB0F86E004FF6FF707047BD +:103C100070B5E24800240470017800291CBFFFDF62 +:103C200070BDDD4D85F8624085F8634085F86440DD +:103C300085F8654085F8664085F85E4085F8604007 +:103C400085F8564085F8364085F868407F218170B8 +:103C500095F8670028B1FFF7FBFBFEF72EFE85F80D +:103C6000674085F86A4085F88C40CD4809F098FC9B +:103C7000BDE87040CB4809F093BCC74890F862009B +:103C80007047C54900B591F8580091F85710C0F336 +:103C90008002C0F340031A4400F0010010440529DB +:103CA00010D2DFE801F00B070B030900BE4931F821 +:103CB000100000BDBD4800BDBD4900E0BD4931F860 +:103CC000100000BDFFDF002000BDB34840F27121AD +:103CD000B0F85A0048437047AF4890F86900002890 +:103CE00018BF0120704710B5040016BF022C002039 +:103CF0000120FFF7D5FE002808BF10BDA6480472BA +:103D0000012010BDA44981F86000704710B5A24C95 +:103D1000207A002816BF022800200120607204F1DA +:103D20000A01FFF7A7FE207A022816BF0328012107 +:103D3000002184F85F10082084F85D00607A04F1A7 +:103D40000A02012804BF527912F0C00F0AD004F110 +:103D50000A02012804D1507900F0C000402801D0A7 +:103D6000002000E0012084F85E0029B994F8570093 +:103D7000012818BF042806D1207C04F1110108F0A5 +:103D80003DFC84F85D004AF2B8102060FCF740FD6D +:103D9000606004F10A01824809F028FC617A8048D9 +:103DA00009F040FC04F10A017E4809F01FFC617A29 +:103DB000BDE810407B4809F035BC70B5764C417BBE +:103DC00084F85810017984F8571001290CBF00229B +:103DD0000288A4F85A20827B84F869208279002A1C +:103DE00016BF022A002201222274D0F80720C4F84C +:103DF0001120B0F80B00A4F8150094F85600012526 +:103E0000002818BF84F8635094F83600002818BFC3 +:103E100084F8645005292DD2DFE801F00308222739 +:103E2000080000215E4809F0BEFB24E001215C4847 +:103E300009F0B9FB04F11101594809F0E5FB207CB8 +:103E400020B1012818BFFFDF05D014E0002154483D +:103E500009F0F5FB0FE00121514809F0F0FB0AE001 +:103E600006214F4809F09FFB05E002214C4809F06C +:103E70009AFB00E0FFDF04214A4809F094FB84F834 +:103E80006250002070BD70B5434C0546002084F898 +:103E900064002A4604F117000BF024FB84F8365026 +:103EA000012084F8640070BD10B53B4C002284F8FA +:103EB000632084F85600024604F137000BF012FB31 +:103EC000012084F8630010BD334981F86800704711 +:103ED000F0B5324E83B0307828BB2F4C94F8620096 +:103EE00008B3FFF77FF9002584F861507570284604 +:103EF000FFF775F9FEF7A7FEFEF772FE2E48FEF7F4 +:103F000088FF2E48FFF757F900210846FFF7C7F949 +:103F100094F85800002610F0010F07D02520FEF776 +:103F200080FF012611E003B00C20F0BD10F0020F5D +:103F300004D02620FEF775FF022606E010F0040FDD +:103F400003D02720FEF76DFF0426FEF749FE84F814 +:103F50005C60FFF73EF901210020FFF718F80F2100 +:103F60000520FEF7EBFE94F85E00002804BF94F8ED +:103F70005F00002805D194F85700012818BF0428D5 +:103F80007ED1FCF745FC064631466068FDF769FDC9 +:103F90000B49B0FBF1F715E0140B0020BC0000202A +:103FA000AC0B0020D40B002034FC010091891300DD +:103FB0003CFC01002CFC010027FC010024FC01005A +:103FC00040420F0001FB170041423046FCF739FC2C +:103FD000606020683844206008F00DFB216888424A +:103FE0006CD8C4E9005694F85D0008F023FB06463F +:103FF00094F85F000127002818BF002E04D010217C +:10400000304609F02CF868B194F8600000281CBF15 +:1040100094F85E0000281AD0607A04F10A010128A1 +:104020000DD011E0677204F10A013046FFF777FD09 +:1040300094F85D1004F10A0008F0DBFB07E0487912 +:1040400000F0C00040281CD00846FFF799FD04F19D +:104050000A01FE4809F0CAFA617AFC4809F0E2FA5E +:1040600004F10A01FA4809F0C1FA617AF84809F046 +:10407000D9FA94F85700012818BF04281ED107E088 +:104080001CE008F0EAFB04F10A01FFF748FDDEE757 +:1040900094F85D0008F0D7FA06000FD0102108F060 +:1040A000DEFF58B969463046FFF739FD6946E748F3 +:1040B00009F0AAFA0121E54809F0C1FA617A04F190 +:1040C0000A00FEF72FFE94F8570001281EBF0428AF +:1040D00094F86300002808D094F8562004F13701C2 +:1040E000DA4809F0CAFA84F8635094F8640040B1E1 +:1040F00094F8362004F11701D54809F0EAFA84F85B +:10410000645008F0EAFAD34808F064FB84F86700CA +:10411000FFF770F803B00020F0BDCF49486070474A +:1041200070B5CE4C05002BD094F8580094F85C1074 +:10413000002620EA010212F0010F04D02520FEF72C +:1041400070FE012615E010F0020F02D011F0020FF0 +:1041500006D010F0040F0CD011F0040F05D008E0C9 +:104160002620FEF75EFE022603E02720FEF759FE1A +:104170000426FEF735FD94F85C00304384F85C00BB +:1041800094F8610040B194F85700012808BFFFDFA0 +:10419000BDE8704000F06EBA1DB102210020FEF7AC +:1041A000F6FE94F86500A948FFF727F894F8570041 +:1041B000052809D2DFE800F0030303090300012109 +:1041C0000846FFF783F900E0FFDF94F8580094F801 +:1041D0005C1030EA01014FF0010002D09E490870E6 +:1041E00070BD94F85710012912BF84F861000021B6 +:1041F00084F85C10F2E710B5FEF7F4FF96480078FB +:1042000040B9964890F8620020B10020FFF788FF7F +:10421000002010BDFFF7FFF8FFF798F8FEF76CFFDE +:10422000FEF7CFFFFEF7E6FF0C2010BD8A49012004 +:1042300048707047894981F86600704770B500255D +:1042400003F064F968B14FF49670FEF702FE824EF7 +:104250003078012809D0022801D003282ED0FFDFB2 +:1042600070BDBDE8704000F005BA7C4C94F8570072 +:10427000032823D094F8670018B1FEF70AFBFFF774 +:10428000D6F87448FEF7B9FF94F85700012818BF14 +:1042900004280AD094F86900012814BF03281025C7 +:1042A00045F00E010020FFF711F994F8680001288D +:1042B00008BFFFF7E8F80220307070BDBDE870401D +:1042C00001202DE770B5654C634D94F86800012816 +:1042D00020D000BF94F8670018B1FFF7B9F8FEF7D7 +:1042E000ECFA03F013F9F8B12878022818BFFFDFC1 +:1042F00094F85700012804BF4FF41970FEF7A9FD88 +:104300000120FFF70DFF287800281EBF287801281C +:10431000FFDF70BD5248FFF7C1F8002804BF7F20BF +:10432000A870FFF7A6F8D5E7BDE8704000F0A2B985 +:104330002DE9F05F07464FF00009FEF762FD464E9B +:1043400082463078022818BFFFDF444D7F2495F85D +:10435000680001282CD03F4809F044F983464FF00B +:10436000FF08002F71D03B4809F043FA00286CD0B9 +:10437000FEF7E0FC002868D095F86700354F68B17B +:1043800008F090F98046FF2808D00146F81C08F094 +:104390007AF9404608F091F940EA0A0A58464FF087 +:1043A000010B062851D2DFE800F09494940C94633A +:1043B0002B48FFF773F8002808BFB470FFF759F8CF +:1043C000C9E795F85700012818BF04283DD0BAF175 +:1043D000000F05D195F86900002818BF022878D190 +:1043E00095F86800012804BF95F88C00002805D0D6 +:1043F0001748FEF702FF032030706CE085F88CB0A0 +:10440000B8F1FF0F0FD005F18E02511E404608F0A3 +:1044100023F9002808BFFFDF95F88D0040F0020067 +:1044200085F88D000CE03878C0F3801085F88D0099 +:10443000D5F8EB00C5F88E00B5F8EF00A5F89200AE +:10444000B07805F194077F280CE042E0AC0B002027 +:10445000D40B0020FC0B0020BC000020140B00201B +:10446000BE00002008BFFFDFB0783870B470BFE72F +:104470003878297CC0F38010884209D1062205F1E2 +:104480001101F81C0BF002F8002808BF012000D031 +:10449000002095F85D102C46414504D1B8F1FF0F7E +:1044A00018BF012100D10021014394F857000128D1 +:1044B00018BF042800D149B958B9BAF1000F05D185 +:1044C00094F86900002818BF012802D194F866000A +:1044D000D8B14FF0010995F8670018B1FEF7B8FFA1 +:1044E000FEF7EBF9B9F1000F1CBF0120FFF718FE32 +:1044F000307800281ABF30780128BDE8F09F307866 +:10450000032818BFFFDFBDE8F09F7068D4F8F710EC +:10451000C0F80D10B4F8FB10A0F8111094F8FD10BD +:10452000C174B97D0175B7F81710C182B7F81910B9 +:104530004180B7F81B108180B7F81D10C180724907 +:1045400008300BF07AF997F8240000F01F0170682A +:10455000017697F82410490980F8041194F86A004C +:10456000002818BFFFDF4FF0000A204684F86CA037 +:1045700074682188A0F86E106188A0F88410A18862 +:10458000A0F88610E188A0F8881094F8041180F84B +:104590008A1090F85F1049B1427A00F10A01012AAD +:1045A00004D1497901F0C001402934D090F860105D +:1045B00041B1417A00F10A02012904BF517911F099 +:1045C000C00F28D0C0F878A0A0F87CA039780546A4 +:1045D000C1F380116176D0F8EB00C4F81A00B5F889 +:1045E000EF10E183B8F1FF0F1CD0C5F87E00E08B1F +:1045F000A5F8820005F172022F46511E404608F0D0 +:104600002BF8002808BFFFDF97F8710040F0020088 +:1046100087F8710013E0D0F80A108167C189A0F80B +:104620007C10D3E739480BF0FFF8617E85F87110F4 +:10463000D4F81A10C5F87210E18BA5F8761085F839 +:104640006AB070680088FAF7A1FBFAF751F886F8AB +:1046500000A0FEF7E0FEFEF779FEFEF74DFDFEF747 +:10466000B0FDFEF7C7FD012003F023F833E7002279 +:1046700003F087B870B5FEF7CEFEFEF767FEFEF7D3 +:104680003BFDFEF79EFD224C002694F8670028B102 +:10469000FEF7DEFEFEF711F984F867601D4D2E70FF +:1046A000FEF7A8FD94F85700012804D0BDE870403B +:1046B000002002F0FEBF022002F0FBFF94F86A0027 +:1046C000002818BFFFDF6878002808BF70BD207C75 +:1046D00084F87100D4F81100C4F87200B4F8150021 +:1046E000A4F876003C2084F86C0068680188A4F87F +:1046F0006E10012184F86A100088FAF747FBF9F779 +:10470000F7FF6E7070BD00001B0C0020920B0020A4 +:10471000140B0020BC0000202DE9F041FF4F04469F +:1047200000207978FE4D4FF00108064611B10129AD +:1047300025D007E095F84D10002918BF87F80180B3 +:1047400000D0012079782B2211FB02F1294491F845 +:10475000222010431AD02A22A01C23310AF0C2FEC4 +:1047600066700420207084F8028078782B2110FB7A +:1047700001F0284480F822600120BDE8F08195F81E +:104780002210002918BF7E70DBD1DBE795F8780096 +:10479000D0B1D5F87900C4F80200D5F87D00C4F88E +:1047A0000600D5F88100C4F80A00D5F88500C4F8E1 +:1047B0000E0095F88900A07466701120207084F8AE +:1047C000028085F8786018E0287801281CBF002056 +:1047D000BDE8F0816670122020702022A91CA01C68 +:1047E0000AF080FEA6712E7085F8A860D5F89800B2 +:1047F0000088FAF7CBFAF9F78BFF0120BDE8F081CA +:10480000C7480178002914BF80884FF6FF707047B1 +:104810002DE9F041C24C064694F82200002818BF4A +:10482000BDE8F081304608F0DDFE0146012500209C +:10483000072937D2DFE801F00A04073636360900C7 +:1048400084F8245009E0032000E0022084F82400CA +:1048500004F12D01304608F026FF84F82C0094F86E +:10486000AD0018B1FEF749F801281FD0304608F016 +:10487000E2FE84F8250004F12601304608F0BDFE72 +:10488000A64E04F14C0730787F2808BFFFDF307850 +:1048900038707F20307084F82250BDE8F04103204A +:1048A00001F06CBE84F82C00BDE8F081FEF768F8DA +:1048B00004F12602511E07F0CFFE002808BFFFDFDB +:1048C00094F8251041F0020184F82510D8E710B5BE +:1048D000002001F0C8FD924CA0B1FEF77AFC002147 +:1048E0000120FEF754FB04F1BC00FEF786FCD4F86F +:1048F000B400FEF785FC94F89C00032818BF02283A +:104900001FD022E0FEF787FDFEF720FDFEF7F4FB47 +:10491000FEF757FC94F8AD0030B1FEF799FDFDF7B6 +:10492000CCFF002084F8AD00012084F8B8000220FC +:1049300084F8B000FEF75EFCBDE81040002001F0F6 +:104940001DBE01210020FEF7C1FDFEF79CFD94F87D +:10495000AD0018B1FDF79DFFFEF769FD032084F857 +:10496000B00010BD6E490028B1F8BA202DD0FF2A42 +:104970000CD24FF6FF7000EA4200A1F8BA00FF28FF +:1049800088BFFF2002D900BFA1F8BA00634842687F +:10499000012A12BF002A0D224260D243C2EBC20399 +:1049A00003EB021291F8B930DB4303EB830CCCEB41 +:1049B00083131A444260900CB1F8BA20B0FBF2F3B2 +:1049C00002FB130081F8B9007047012ADED95008B4 +:1049D000A1F8BA0008BF0120D8D1D5E770B5504C76 +:1049E000002584F8B050012684F8B06094F8B00037 +:1049F00002281BBF94F8B00001280020FFDF18BF79 +:104A000070BD2B2101FB004181F82250401CC0B237 +:104A10000228F6D3257094F8AD0028B1FEF718FDF2 +:104A2000FDF74BFF84F8AD5084F8A85084F8A950E6 +:104A300084F8AC5084F89760394884F89C5084F826 +:104A4000AF5040F2011120F8941F817070BD2DE924 +:104A5000F041334C05460C2794F8B00001281FBFE5 +:104A600094F8B00002280C20BDE8F081FEF7BAFBF4 +:104A7000FEF7E9F8FEF7B4F894F894000126002850 +:104A800001BF94F89500002894F8960000281CBFF8 +:104A900094F8A900002877D094F89C00032802D04D +:104AA000022805D008E005211E4800F082FE03E040 +:104AB00003211C4800F07DFE94F8AA00002804BFE2 +:104AC00094F8AB00002845D0FBF7A2FE0746394614 +:104AD000D4F8A400FCF7C5FF1349B0FBF1F801FBC3 +:104AE000180041423846FBF7ACFEC4F8A400D4F8E5 +:104AF000A0004044C4F8A00007F07DFDD4F8A01049 +:104B0000884227D80020C4E9280794F8AB00002881 +:104B100018BF07F07AFE94F8AC0007E0C40000204C +:104B2000240C0020080D002040420F0000281CBF6C +:104B300094F8AA0000280DD094F88D0004F18E019D +:104B4000012804D1487900F0C00040280ED0084662 +:104B5000FFF716F894F88D1004F18E00FEF7E2F8D6 +:104B600094F8B0000027012817D107E007F075FE80 +:104B700004F18E01FEF7D3FFECE705E084F8B8609E +:104B8000022084F8B00008E094F8B000022802BFC8 +:104B900084F8B0600C20BDE8F08194F89700A0B1D3 +:104BA00094F89C00032818BF07F0B8FDFE4807F0F2 +:104BB00011FE84F8AD00FD48C4F8B450FEF7FBFACE +:104BC000FEF718FB3846BDE8F08107F086FDEDE7FB +:104BD00070B5FEF707FBF64C94F8B000022803D03E +:104BE000FEF708FB0C2070BD012084F8B900A4F882 +:104BF000BA000220FEF7F3FAEE48FEF70AF9EE4B90 +:104C0000002004F1940200BF94F8AF10491CA3FBEC +:104C1000015C4FEA5C0CACEB8C0C6144C9B284F8CB +:104C2000AF10895C012907D0401CC0B20328EBD328 +:104C3000FFF74DFE002070BD94F8AF00DF49085C1F +:104C4000FEF7EFF8FDF7CCFFF2E710B5040016BF52 +:104C5000022C00200120FEF723FF002808BF10BD12 +:104C6000D348002180F88C4080F8A910012010BDA5 +:104C7000CF4981F8AC00704710B5CD4C94F88C004A +:104C8000002816BF02280020012084F88D0004F1BE +:104C90008E01FEF7EFFE012084F8A90094F88C0045 +:104CA000022816BF03280121002184F8AB1094F8D4 +:104CB0008D0004F18E02012804BF527912F0C00F5A +:104CC0000AD004F18E02012804D1507900F0C0000E +:104CD000402801D0002000E0012084F8AA0000282C +:104CE00004BF002910BDFBF793FDC4F8A4004AF2ED +:104CF000B810C4F8A00010BD002816BF0228012279 +:104D00000022AB4981F8972081F89D00704770B56B +:104D1000A74D0C4600280CBF0121002185F89710F3 +:104D200085F89E004FF0080085F89F000BD1002CFD +:104D30001ABF022C01200020114607F05FFC85F805 +:104D40009F00082801D0002070BD022C14BF032C46 +:104D50001220F8D170BD964A032808BFC2F89810F7 +:104D600082F89C0000207047914991F89C0003282C +:104D700004D0012818BF022807D004E091F89E0053 +:104D8000012808BF70470020704791F89D00012856 +:104D900014BF03280120F6D1704710B5FEF73BFB86 +:104DA000FEF7D4FAFEF7A8F9FEF70BFA804C94F858 +:104DB000AD0030B1FEF74CFBFDF77FFD002084F81D +:104DC000AD00012084F8B800022084F8B000FEF79E +:104DD00011FA002010BD764981F8B100704710B576 +:104DE000FEF719FBFEF7B2FAFEF786F9FEF7E9F9CE +:104DF0006F4C94F8AD0030B1FEF72AFBFDF75DFD76 +:104E0000002084F8AD00012084F8B800022084F866 +:104E1000B000FEF7EFF9BDE81040002001F0AEBB96 +:104E20002DE9F84F624DFF2100247F27DFF89081A4 +:104E300085F8AE10002800F0CD8205F1BC0008F026 +:104E4000A8FC30B905F1BC0008F0C3FC002800F054 +:104E5000C18295F8B000544E052880F0B882DFE892 +:104E600000F0F3F3F303F2004F4808F0BBFB88F8BF +:104E7000020095F8970028B9FDF7C3FF002808BF86 +:104E8000002400D0012495F8AD0070B107F00AFCB1 +:104E900085F8AE00FF280CD00146F01C07F0F3FBAC +:104EA00095F8AE0007F009FC044395F8AE00FF2822 +:104EB0000AD195F8970090B195F89C00032803D08B +:104EC00007F07DFC85F8AE0098F80200072880F016 +:104ED000C181DFE800F03FBA07FCFCFC240007F0CA +:104EE0003CFCEFE795F8AD0018B1FEF7B1FAFDF71D +:104EF000E4FC3348FEF7D2FA002808BF88F80070B7 +:104F0000FEF7B7FA002C00F04F8195F89C000128BD +:104F100018BF022840F04881FEF7EEF877E095F8D8 +:104F2000AD0018B1FEF794FAFDF7C7FC2448FEF770 +:104F3000B5FA002808BF88F80070FEF79AFA002C2E +:104F400000F0328195F89C00022859D001285ED0EB +:104F500000F02AB995F8AD0018B1FEF779FAFDF71F +:104F6000ACFC1748FEF79AFA002808BF88F80070D2 +:104F7000FEF77FFA002C00F0178195F89C000228BC +:104F80003ED0012843D003281CBFFFDFBDE8F88FC7 +:104F9000F178D5F89800827E91422AD13179C27E8B +:104FA000914226D171790DE0E00C002044FC010013 +:104FB000240C00204AFC0100ABAAAAAA47FC01006D +:104FC000C4000020027F914213D1B179427F914207 +:104FD0000FD1F179827F91420BD1317AC27F914218 +:104FE00007D13178427EC1F38011914208BF01217F +:104FF00000D0002195F89E20012A0ED0E1B1CFE02B +:10500000FA48FFF705FCBDE8F84F00F001BBF74890 +:10501000FFF7FEFBBDE8F84F59E4002972D100BF4D +:1050200000F11A01F14808F0E8FAF04808F003FB33 +:10503000D5F898104876B3E095F8AE0095F89F1033 +:1050400088427CD1ACE014E1C1E195F8AD0018B123 +:10505000FEF7FEF9FDF731FCE548FEF71FFA0028E0 +:1050600008BF88F80070FEF704FA95F8AB00002836 +:105070000CBF4FF0010B4FF0000B4FF000093078E0 +:1050800006F10901C00907D0487900F0C0004028A6 +:1050900008BF4FF0010A01D04FF0000A95F89C00BC +:1050A000032806D195F89700002818BF95F89F00AF +:1050B00001D195F8AE0007F0BDFA009088B110213B +:1050C00007F0CDFF002818BF4FF0010B00E0C1E052 +:1050D000BAF1000F05D006F109010098FEF7EEFCC9 +:1050E000814695F89C0003280DD0FEF705F83CB3E7 +:1050F000FDF720FE50EA09005CD0BC48FFF788FBB2 +:1051000000F039B94CE0D5F89800F178827E9142F0 +:105110001ED13179C27E91421AD17179027F9142BA +:1051200016D1B179427F914212D1F179827F9142B9 +:105130000ED1317AC27F91420AD1317801E033E059 +:1051400038E0407EC1F38011814208BF012600D0C3 +:105150000026B9F1000F05D1BBF1000F04D0FDF717 +:10516000E9FD08B1012200E0002295F89E00012827 +:1051700001D010B10AE03CB908E02EB995F8AE10A4 +:1051800095F89F30994201D1012100E000210A42A7 +:105190000AD0012804BF002ED5F898003FF440AF94 +:1051A000BDE8F84F00F097BAFDF7A6FFBDE8F84F4D +:1051B000FFF78DBB95F89D00032818BF02287DD10D +:1051C000BAF1000F7AD0B9F1000F77D1874E95F878 +:1051D0007800002872D1012485F87A4095F8AD0056 +:1051E00018B1FDF78AFB012823D0304608F023FAD6 +:1051F00085F87B0005F17C01304608F0FEF9304669 +:1052000008F026FA85F8820005F18301304608F09F +:1052100002FA98F8000005F189067F2808BFFFDF31 +:1052200098F80000307088F8007085F87840032006 +:105230009FE0FDF7A5FB05F17C02511E07F00CFA7B +:10524000002808BFFFDF95F87B0040F0020085F8DA +:105250007B00D4E795F8AD0018B1FEF7F9F8FDF73B +:105260002CFB6348FEF71AF9002871D188F800700A +:10527000D1E05E4808F0B6F988F802005D48F178A0 +:10528000427A91421ED13179827A91421AD1717952 +:10529000C27A914216D1B179027B914212D1F17951 +:1052A000427B91420ED1317A827B91420AD1317890 +:1052B0000078C1F38011B1EBD01F00E049E008BFD6 +:1052C000012600D00026FDF717FF98F802000428F9 +:1052D00067D1E6B34648FEF7E1F8002808BF88F832 +:1052E0000070FEF7C6F895F8B80000281CBF002033 +:1052F000FFF738FB4FF0010985F8B8903B4E95F861 +:105300004D0030BB042085F84F0095F8AD00A6F1A4 +:10531000910418B1FDF7F1FA012830D0304608F0B9 +:105320008AF9354981F8500004F12601304608F029 +:1053300064F900BF05F15801304608F0E0F985F83E +:1053400057001F2884BF1F2085F8570002E028E07F +:1053500061E010E098F8000005F177047F2808BFAD +:10536000FFDF98F80000207088F8007085F84D90F5 +:10537000042001F003F9BDE8F84FFFF7A8BAFDF7E4 +:10538000FFFA04F12602511E07F066F9002808BF53 +:10539000FFDF194890F8500040F0020084F8250023 +:1053A000C8E71348FEF77AF8002808BF88F80070AD +:1053B000FEF75FF895F8B800002804BF0120FFF75A +:1053C000D1FA85F8B840BDE8F84FFFF780BAFFDFA3 +:1053D000BDE8F88F95F8B000052828BFBDE8F88F24 +:1053E000DFE800F00303030C2100F1E7E00C0020EC +:1053F000C4000020080D0020240C002095F8AD000A +:1054000018B1FEF725F8FDF758FAFE48FEF746F802 +:1054100000283FF42BAFFEF72CF8FDF76DFEBDE83A +:10542000F84FFFF754BAF748FEF738F8002808BFDE +:1054300088F80070FEF71DF895F8B800002804BF42 +:105440000120FFF78FFA85F8B840FDF755FEBDE85B +:10545000F84FFFF73CBA70B5EB4C94F8B000072852 +:1054600077D2DFE800F08C8C8C8C8C040D00E74840 +:10547000FDF7C3FEFEF707F8042084F8B00070BD06 +:10548000FDF7C9FFFDF762FFFDF736FEFDF799FE58 +:10549000012584F8B850022084F8B000FDF7AAFE78 +:1054A0002078002818BFFFDF0026A670D4F89800E7 +:1054B0000188A180418861838188A183C088E083BD +:1054C00094F8B10084F8200094F8AB10D04849B1AA +:1054D0000178C21CC1F3801121B1517901F0C001E2 +:1054E00040292ED094F8AC1041B110F8031BC1F341 +:1054F000801119B1407910F0C00F22D0C5480AF0D0 +:1055000093F900BF94F8AD0018B1FDF7F6F9012842 +:1055100020D0D4F89800417EE171D0F81A10A16033 +:10552000C08BA081666126832570D4F8980000881E +:10553000F9F72CFCF9F7DCF8BDE87040022001F027 +:105540001DB8D4F8E700C4F80E00B4F8EB00608290 +:10555000D8E714E0FDF714FA04F10802E11D07F0A2 +:105560007BF8002808BFFFDFE07940F00200E0711F +:10557000D4F8BF006061B4F8C3002083D4E7FFDF34 +:1055800070BD70B5A04C94F8B0000025052828BF68 +:1055900070BDDFE800F03939391B03009948FDF789 +:1055A0007DFF10B997497F200870FDF762FF94F8DE +:1055B000B800002804BF0120FFF7D4F984F8B850E0 +:1055C000FDF79AFDBDE87040FFF781B9FDF723FFB5 +:1055D000FDF7BCFEFDF790FDFDF7F3FD94F8AD007F +:1055E00028B1FDF735FFFDF768F984F8AD500120CB +:1055F00084F8B800022084F8B000FDF7FBFDBDE898 +:105600007040002000F0BABF70BD002201F098B8D1 +:1056100070B5012000F027FF7B4CC8B104F1E40114 +:10562000A1F1280008F017F804F1E40694F88D10B1 +:10563000304607F0F7FF04F18E01304607F0D6FF41 +:1056400094F8AB00C0B394F89C0003281FD025E069 +:10565000FDF7E1FEFDF77AFEFDF74EFDFDF7B1FD2A +:1056600094F8AD0030B1FDF7F3FEFDF726F9002008 +:1056700084F8AD00012084F8B800022084F8B0005E +:10568000FDF7B8FDBDE87040002000F077BF94F84A +:105690009700002818BF94F89F0001D194F8AE003D +:1056A00007F0DDF8050007D00121304607F0BAFF0A +:1056B0002946304607F09AFF5548FDF79EFD012127 +:1056C0000846FDF703FF00210846FDF7E8FD052029 +:1056D00084F8B00070BD2DE9F041022000F0C3FE57 +:1056E000494C0126E0B1012000F048FF04F1E4013B +:1056F000A1F1280007F0AFFF04F1E40794F88D1042 +:10570000384607F08FFF04F18E01384607F06EFF30 +:1057100094F8AB00B8B394F89C0003281ED024E0A2 +:10572000FDF779FEFDF712FEFDF7E6FCFDF749FDFA +:1057300094F8AD0030B1FDF78BFEFDF7BEF8002008 +:1057400084F8AD0084F8B860022084F8B000FDF75A +:1057500051FDBDE8F041002000F010BF94F8970023 +:10576000002818BF94F89F0001D194F8AE0007F00C +:1057700076F8050007D00121384607F053FF294687 +:10578000384607F033FFD4F89800C18A204807F064 +:10579000E2FFD4F89800017D1D4807F0E0FF1C48A7 +:1057A000FDF72BFD84F8A860062084F8B000BDE862 +:1057B000F08170B50C46054607F0F2FE032C53D07D +:1057C000052C18BF70BD0521284607F0ECFE0E4CD5 +:1057D000D4F8980000F10D01284607F0A6FFD4F890 +:1057E000980000F11101284607F0A3FFD4F89800B3 +:1057F000017D284607F0B3FFD4F89800C18A2846F7 +:105800000AE00000C4000020240C0020E00C00206E +:10581000080D0020320C002007F09DFFD4F89800FE +:105820004188284607F08BFFD4F8980081882846E5 +:1058300007F089FFD4F89800C188284607F087FF51 +:10584000D4F8980000F10801284607F09FFFD4F82B +:105850009800017E284607F084FF94F8B11028468E +:10586000BDE8704007F087BF2846BDE870400321BF +:1058700007F099BE2DE9FF5F06460C46488840F2C6 +:10588000E24100FB01FBE08A002500FB01FA94F8ED +:105890005B001746082816BF07284FF001084FF095 +:1058A0000008039818B10121204603F0E5FA94F8A6 +:1058B000C800DFF8149448B1012878D002285DD0E0 +:1058C000032818BFFFDF72D000F0CFB8002F08BF49 +:1058D000FFDFFE4D6868002808BFFFDF94F84C002A +:1058E000012808BF002004D002281ABFFFDF0020D3 +:1058F0000120FDF7B6FC00F2E7314FF47A70B1FBFE +:10590000F0F1F24840680D1894F84C00012808BFE7 +:10591000002004D002281ABFFFDF00200120FDF77D +:10592000A0FC074694F84C00012804D002280CBFC4 +:10593000CB46FFDF01D0DFF898B394F84C00012884 +:1059400005D002280CBF4FF47A70FFDF01D04FF46E +:10595000C860584438444AF2531101444FF47A70F5 +:10596000B1FBF0F040F2E241081A00EB0A01D7481F +:10597000006928440844051D012014E0DFF84CB3F9 +:10598000791EDBF80400084308BFFFDFD148006838 +:1059900000EB0A0537B1DBF8040000F20F30A84233 +:1059A00088BFFFDF032084F8C8005DE0FFE794F8BC +:1059B0005B005D4620281CBF94F85C00202845D180 +:1059C000B4F85000B4F8FE10401A401C00B2002891 +:1059D0003CDB94F8FC00C8B394F84C00012804D0D8 +:1059E00002280CBFCA46FFDF01D0DFF8E4A294F81A +:1059F0004C00012805D002280CBF4FF47A70FFDF5D +:105A000001D04FF4C8600AEB000B94F8FC000128A9 +:105A100004D002280CBFCA46FFDF01D0DFF8B0A2D5 +:105A200094F8FC00012805D002280CBF4FF47A70CE +:105A3000FFDF01D04FF4C8605044ABEB000000F230 +:105A4000E7314FF47A7091FBF0F0054467B19F4F56 +:105A5000786818B97888002818BFFFDF786800F2E6 +:105A60000F30A84288BFFFDF05B9FFDF2946D4F811 +:105A7000CC00FAF7E6FEC4F8CC00B060002030702D +:105A800001273771204603F0E0FAA8F1010108422E +:105A900008BF777106D094F8C80001280CBF022017 +:105AA0000320707194F84C00012803D0022818BF1D +:105AB000FFDF01D0DFF8189294F84C00012805D0E0 +:105AC00002280CBF4FF47A70FFDF01D04FF4C8609A +:105AD000814494F84D00012808BF002004D002281A +:105AE0001ABFFFDF00200120FDF7CAFB48444AF23D +:105AF000AB3101444FF47A70B1FBF0F0616A00F20F +:105B00003D100844F060039830EA080004BF04B078 +:105B1000BDE8F09F2946304607F096FB1FFA80F853 +:105B2000204603F092FA40450FD88046777105FB76 +:105B300008F1D4F8CC00FAF784FEB060294630466C +:105B400007F082FB40441FFA80F84146204603F0EC +:105B500093F9B068C4F8CC0004B0BDE8F09F2DE91B +:105B6000F0475D4E054684B096F800040C46DFF819 +:105B70006CA140099AF800144909884218BFFFDF58 +:105B800096F800044009564991F8001449098842E2 +:105B900018BFFFDF4D4E6F1E06F13C0909EB4508AB +:105BA0000025092C80F00A81DFE804F0056D777785 +:105BB00072FEFEFEB4000B2FA8BFFFDF38F8020C08 +:105BC0000621F8F788FF040008BFFFDF0B2FA8BFEE +:105BD000FFDF38F8020C2188884218BFFFDF94F8F5 +:105BE000C800002808BFFFDF204602F012FF7560E2 +:105BF000758021460020356107F061FB00F19807B0 +:105C0000606AB8422ED994F84C00012804D00228CA +:105C10000CBF2D4DFFDF00D02D4D94F84C00012816 +:105C200005D002280CBF4FF47A70FFDF01D04FF48B +:105C3000C860054494F84D00012808BF002004D036 +:105C400002281ABFFFDF00200120FDF719FB2844BE +:105C50004AF2AB3108444FF47A71B0FBF1F1606A5B +:105C60000844C51B21460020B56007F028FB618869 +:105C700040F2E24251439830081AA0F20F30F0602F +:105C800004B0BDE8F08704B0BDE8F04702F0E6BF1D +:105C900004B0BDE8F047FDF7ADBC9AF8140D11490A +:105CA000400991F800144909884218BFFFDF0B2F03 +:105CB000A8BFFFDF38F8020C0621F8F70CFF04003C +:105CC00008BFFFDF0B2F0FE0E46A0100300D00205A +:105CD000445B0100D000002001E000E00BE000E0A8 +:105CE00018E000E019E000E0A8BFFFDF38F8020C80 +:105CF0002188884218BFFFDF002201232146684621 +:105D0000FFF7B8FD94F8D2006946FAF712FF04B025 +:105D1000BDE8F0870B2FA8BFFFDF38F8020C062183 +:105D2000F8F7D9FE040008BFFFDF0B2FA8BFFFDF85 +:105D300038F8020C2188884218BFFFDF94F8C800A9 +:105D4000042818BFFFDF84F8C85094F8D2704FF6CB +:105D5000FF78781E0B28A8BFFFDF09EB470020F86B +:105D6000028C94F8D200FAF73DFD84F8D250D4F8B2 +:105D7000D800002804BFD4F8D400706108D0D4E95A +:105D800037121144826911448161D4E93501C86038 +:105D9000D4F8D40000281CBFD4F8D810016106D173 +:105DA000D4F8D800002800E008E018BF8561FE485C +:105DB000007804B0BDE8F047F4F784B8FFDF04B022 +:105DC000BDE8F0872DE9F047F84D0746E88B6C6891 +:105DD000401CE88328784FF00008002808BFFFDF48 +:105DE00007D0DFF8CCA3042814D0052818BFFFDFA4 +:105DF00040D021462869FAF724FDB86087F8008072 +:105E000001203871A86800F22710F860287804286B +:105E10007CD185E00029ECD02E69DAF8141039B372 +:105E20008946C9680029FBD1B9F1000F20D099F843 +:105E30000000002808BFFFDFD9F81410D9F80400CB +:105E400001443046FBF70DFE002807DA211A4A1EEE +:105E500092FBF4F202FB0406214604E090FBF4F20C +:105E600002FB140621468E4288BFFFDF3446C0E79E +:105E70004446BEE70029BCD0D5F81890B9F1000F10 +:105E800008BFFFDF0026D9F8DC10DAF814403046EE +:105E9000721E5CB1A069884228BF824284BF02465C +:105EA00026462046E468002CF4D106B9064609F1DE +:105EB000C804C9F8D860002E04BFC4F80C80CAF822 +:105EC000144005D0F068F460E060002818BF046159 +:105ED000D4F81090C4F81880B9F1000F0ED0D9F89A +:105EE000180048B1D4F814A0504538BFFFDFD9F8E6 +:105EF0001800A0EB0A00A061C9F81880002E08BFA6 +:105F0000C5F8208009D03078002800E00DE008BFF7 +:105F1000FFDF716970680844286240F6B83468E7AA +:105F2000E88B0A2838BF032000D302207871E88B61 +:105F3000012806D93846696807F086F9E98B0844D4 +:105F4000E883B8682861BDE8F0872DE9F041994CF5 +:105F5000804684B094F800040E46974F410997F8A4 +:105F600000044009814218BFFFDF94F80004400993 +:105F7000924991F800144909884218BFFFDF0025B3 +:105F80000122092E894C5DD2DFE806F0051B36366A +:105F9000315C5C184B0062732273607800281CBF70 +:105FA00004B0BDE8F0818248456005612573A068B2 +:105FB000CD38FEF74CFD002818BFFFDF04B0BDE868 +:105FC000F081607850B1207B002808BFFEF7E5FE25 +:105FD000657304B0BDE8F041FAF747BBA273FEF762 +:105FE000F7FD002818BFFFDF04B0BDE8F08104B062 +:105FF000BDE8F041FDF7FEBA97F8140D704940096D +:1060000091F800144909884218BFFFDF0021684653 +:10601000FFF7D8FE69464046FAF78BFD04B0BDE8AD +:10602000F0812078052818BFFFDF207F002808BFF7 +:10603000FFDF25772570207DFAF7D4FB257504B0A6 +:10604000BDE8F081FFDF04B0BDE8F0812DE9F0414B +:10605000564C84B00025207804281FBF20780528DE +:106060000C2004B018BFBDE8F08101276770607B89 +:10607000002690B172B6607B00281CBFA07B002870 +:1060800005D0FEF78AFE6673A673FAF7EEFA62B6DB +:10609000207DFBF772FDD0B913E094F81480032043 +:1060A0008DF804008DF80500FAF7B2FB02904FF06E +:1060B000FF3003908DF8007069464046FAF739FDCD +:1060C000E6E720BF207DFBF758FD0028F9D0207FB0 +:1060D00028B126772078052818BFFFDF0C256670C9 +:1060E0002670207DFAF77EFB267504B02846BDE8B1 +:1060F000F0812DE9F0472D4884B00078002818BFC2 +:10610000FFF7A4FF01202A4E307069460620F8F7F9 +:106110006EFC002818BFFFDF00254FF6FF7718E060 +:10612000029800281CBF90F8C810002911D00088E0 +:10613000B84218BFDFF88C8056D00621F8F7CBFCA8 +:10614000040008BFFFDF94F8D200FBF716FD68B922 +:1061500005E06846F8F729FC0028E1D044E020BFBC +:1061600094F8D200FBF709FD0028F8D084F8C85055 +:1061700094F8D2904FF6FF7AA9F101000B28A8BF3E +:10618000FFDF08EB490020F802AC94F8D200FAF7E0 +:1061900029FB84F8D25069460620F8F728FC00282D +:1061A00018BFFFDF1BE00000CC000020480D0020DE +:1061B000300D002001E000E00BE000E018E000E01E +:1061C00019E000E06C0D0020029800281CBF90F838 +:1061D000C810002903D00088B842AED104E0684658 +:1061E000F8F7E3FB0028EFD03570756104B00020AC +:1061F000BDE8F08710B50078FE4C60B101280CBFF7 +:1062000040F6C410FFDF06D0A06841F66A0188425C +:1062100028BFFFDF10BDA060F6E710B5F54C0023E6 +:106220002070F548037043700377037343738373DF +:1062300083610375183843703C304FF6FF7101805D +:106240000522418020F8041F521EFAD1180008BF11 +:10625000A36005D0002B0EBFFFDF40F6C410A06086 +:10626000A06841F66A01884228BFFFDFBDE8104000 +:106270003FE72DE9F043E04C054685B0207817460E +:10628000884600281EBF0C2005B0BDE8F08395F8B5 +:106290004C000026012805D002280CBFDFF85C93D3 +:1062A000FFDF01D0DFF8589395F84C00012805D0A6 +:1062B00002280CBF4FF47A70FFDF01D04FF4C860A2 +:1062C000814495F84D00012808BF002004D0022821 +:1062D0001ABFFFDF00200120FCF7D2FF48444AF23A +:1062E000AB3108444FF47A79B0FBF9F0696A00F2F7 +:1062F0000A300844C5F8DC00A56195F8C8000028FC +:1063000018BFFFDF40F2712008FB00F06060002042 +:10631000FCF7B6FF00F2E730B0FBF9F040F2712174 +:1063200007FB0100A0606168A1F53D71884298BF3C +:106330000146B448A160066105202070667026778A +:10634000E683B148FAF7FEF92075002808BFFFDFA1 +:10635000FAF75EFA206101216846FFF733FD207DE0 +:106360006946FAF7E6FB05B00020BDE8F083A248D5 +:10637000007800281CBF0020704710B50620F8F7F1 +:1063800047FB80F0010010BD30B59B4C85B02278F2 +:10639000002A1EBF0C2005B030BD0D4640F2712111 +:1063A000484360600020FCF76BFF4FF47A7100F205 +:1063B000E730B0FBF1F040F2712105FB0100A06075 +:1063C0006168A1F53D71884298BF01460020A16037 +:1063D000607004212170E0838B48FAF7B3F92075CF +:1063E000002808BFFFDFFAF713FA40F6B831FAF7D2 +:1063F00028FA206101216846FFF7E4FC207D694608 +:10640000FAF797FB05B0002030BD70B57A4CA16952 +:106410000160FFF71BFE002300BBA169D1F8D82063 +:106420005AB1D1E937C5AC449569AC44C2F818C03B +:10643000D1E9352CCCF80C2005E0DFF8C8C1D1F843 +:10644000D420CCF81420D1F8D420D1F8D810002AC8 +:1064500018BF116102D1002918BF8B61A36170BD03 +:10646000684948707047674910B54968002801F1CC +:10647000980408BF04F5BC7409D0012808BF04F5CE +:10648000317404D0022814BFFFDF04F5B0745A48F9 +:106490008068A0428CBF0120002010BD10B5594C6F +:1064A000607828B1D4E90201626806F0F4FEA060C9 +:1064B000D4E9010188429CBF2078002814BF002045 +:1064C000012010BD042210B584B0002938D0012964 +:1064D00001BF032180F8C81004B010BD022928D0E4 +:1064E00003291EBFFFDF04B010BD0446408840F200 +:1064F000E241484345490860D4F8F0000089E08251 +:10650000D4F8F00080792075D4F8F00040896080DC +:10651000D4F8F0008089A080D4F8F000C089E08031 +:106520002046616A06F05BFF022084F8C80004B0D0 +:1065300010BD80F8C82004B0BDE81040FAF795B847 +:10654000044630480078002818BF84F8C82004D0DA +:1065500004B0BDE81040FAF788B8012200232146B4 +:106560006846FFF787F994F8D2006946FAF7E1FA2E +:10657000B4F85000401CA4F85000E9E72DE9F041C0 +:106580001C4F00251C4C397884B0052880F0D3803E +:10659000DFE800F003137FCBCB00E5830846F3F779 +:1065A00091FC6078002873D100216846FFF70AFC4F +:1065B000207D6946FAF7BDFA7CE00020FCF760FE1A +:1065C0001349DFF8408008444FF47A71B0FBF1F0D2 +:1065D0002169D8F8042040F2E2431144081AA16965 +:1065E00000F2DE604A88C83102FB03F5D8F81420B7 +:1065F0008A420FE0CC000020480D0020E46A010030 +:10660000445B0100300D00204B5F0100D0000020F2 +:10661000D702020008BF002614D0216AFBF721FA36 +:10662000002807DA291A4A1E92FBF5F202FB05063A +:10663000294604E090FBF5F202FB150629468E423E +:1066400088BFFFDFB868864208D2A06940F2712295 +:106650004188C1824A4306EB420605E040F2E2402F +:10666000B6FBF0F0A169C882A06905210175C08A56 +:106670006FF41C71484306EB400040F63541C8F802 +:106680001000B0EB410F28BFFFDF04B0BDE8F08180 +:1066900010E0E5830846F3F715FC01202077A06998 +:1066A0002169C0F8CC1080F8C8502178052918BF9E +:1066B000FFDF06D0F9F7D9FF6573A57304B0BDE815 +:1066C000F081002808BFFFDFA06990F8C80000280B +:1066D00018BFFFDFA06990F8D200002818BFFFDFC5 +:1066E0002648FAF72FF8A169064681F8D2000F88EC +:1066F000401E0B28A8BFFFDF214800EB460020F812 +:10670000027CA06990F8D200002808BFFFDF0023B8 +:1067100001226846A169FFF7ADF8A069694690F8C3 +:10672000D200FAF706FAA561C4E704B00846BDE84E +:10673000F041F3F7C7BBFFDF04B0BDE8F08170475D +:1067400070B5104D0446A1B1012908BF401E10D0FC +:1067500002291CBFFFDF70BD6888401C688010469E +:10676000FCF77FFD4FF47A7100F2E730B0FBF1F0F7 +:10677000201A686070BD0448007870475F5B0100B4 +:106780006C0D0020300D0020480D0020F748C07E21 +:106790007047F74840687047F648C07E70472DE95B +:1067A000FF4FDFF8C88391B09A46D8F82400D8F894 +:1067B0000050934604680F464FF0000994F84D00CE +:1067C0000A901E9840EA0A000E9094F85C0008288F +:1067D0000CBF012000200B90BAF1000F04BF1198EC +:1067E00003284CD10B98002849D0B4F81C01584517 +:1067F00045D1DE482646CDE90450204604F0F1FAA2 +:106800000598B6F8DE10DE4A008B014404988160DA +:10681000D94840680068816904980160708840F236 +:10682000E241414304984160B6F82001F08296F8B5 +:106830001E013075B6F822017080B6F82411B180BF +:10684000B6F82611F180CD490B79096832F813307A +:1068500091F8041132F8111019440A04120C4FF087 +:10686000000105D002FB00F1C648B1FBF0F0411C6D +:106870008AB23046716A06F0CDFD02201190D8F838 +:106880000000BAF1000F00690F90D8F820000890BE +:10689000B4F8DE000490B4F8FC00D4F8F8100791C6 +:1068A00006D095F8341061B115B00220BDE8F08F24 +:1068B00004F1D801059120310C9108F10406091D5D +:1068C00007E005F148010591091D0C9105F1380615 +:1068D000091D0D91B4F85010ABEB0000ABEB0101BA +:1068E00009B200B20991002806DAA348006840699D +:1068F000079001200E9008461199002969D00129BE +:1069000000F09781022900F0CE80032918BFFFDF35 +:1069100000F0E98149460798F9F793FF0C99BAF11D +:10692000000F08600D98A0F800B00C980068B060E7 +:1069300014BF032001203071D5E90710814287BFC1 +:1069400005990860059801600598616A0068084427 +:1069500000F24F10F060012070710B99002900F0D7 +:106960005B821E99C9B100BFB4F8F020002A0CBFA9 +:106970000021B4F8F210A4F8F21094F8F430491C95 +:106980005943914209D27179491E002905DD707180 +:10699000B4F8F200401CA4F8F20086F800A0BAF1A6 +:1069A000000F1CBF95F8340000287FF47DAF8AF0FB +:1069B000010085F8350098F81C0098F81B20314636 +:1069C00098F81A309A4200F04E82FAF7B2F800F0C6 +:1069D00053BA0898002808BFFFDFE08A40F271210F +:1069E0004843490001EB40010020002F06D06548D4 +:1069F00007FB01F1B1FBF0F000F101006861608874 +:106A000040F2E24100FB01F14FF0000006D05D488A +:106A100007FB01F1B1FBF0F000F10100A86108985B +:106A200000F101094FF00000FCF72AFC00F5AC3042 +:106A30004AF2B12100F5517001444FF47A70B1FB74 +:106A4000F0F0E18A40F2712251436F69C0EB4100DE +:106A5000C01B484400F2C249207D510010FB01F0E8 +:106A600004900020FCF70CFC00F5AC3101F55171ED +:106A70004AF2531001444FF47A70B1FBF0F000EB8E +:106A8000470104980F180020FCF7DFFB3844623000 +:106A9000E86128620898A9EB0000401EB0F5387F35 +:106AA00098BFFFDF36E7E08A40F271216A68484309 +:106AB00002EB40010020002F06D0324807FB01F115 +:106AC000B1FBF0F000F101006861618840F2E2433F +:106AD00001FB03F34FF0000106D02A4907FB03F343 +:106AE000B3FBF1F101F10101A9610499E9BB1E9920 +:106AF000D9B394F84D00012804D002280CBF224FCE +:106B0000FFDF00D0214F94F84D00012808BF00207E +:106B100004D002281ABFFFDF00200120FCF7B0FBE1 +:106B200039184AF2531001444FF47A70B1FBF0F077 +:106B30006969E28A014440F2712368685A4300EBB4 +:106B40004200471A94F84D00012808BF002004D0E5 +:106B500002281ABFFFDF00200120FCF776FB0F9907 +:106B6000081A3844A0F120091AE011E0840D002031 +:106B7000F0000020AC0D0020E0000020E800002024 +:106B80004EFC010040420F00E46A0100445B01003A +:106B9000E18A40F27123594302EB4101A1EB000964 +:106BA000AA682968686901FB02000990207D40F20B +:106BB000E24110FB01F0089094F84D000490012888 +:106BC00008BFF84F08D002281BBFFFDFF54FF64F74 +:106BD000FFDF08BF012001D04FF00000FCF750FBA1 +:106BE00039184AF2531001444FF47A70B1FBF0F1B6 +:106BF000099801EB400108980F180498012808BF74 +:106C0000002004D002281ABFFFDF00200120FCF77B +:106C10001CFB38446030E861618840F27122A86949 +:106C20005143C0EB4100A0F5477028620120287352 +:106C300070E6628840F27123A9695A43C1EB4202AF +:106C400002FB00F9099A0498D5F800C00244A8682C +:106C50006B69121A0CFB0030521E02FB01000A90F5 +:106C6000207D40F2E24110FB01F0099094F84D00C4 +:106C70000490012808BFCB4F08D002281BBFFFDFBC +:106C8000C84FC94FFFDF08BF012001D04FF00000FF +:106C9000FCF7F6FA39184AF2531001444FF47A70AF +:106CA000B1FBF0F10A9801EB400109980F18049824 +:106CB000012808BF002004D002281ABFFFDF0020EF +:106CC0000120FCF7C2FA38446030E861A9F547704A +:106CD0002862B648406800283FF41CAE0898002897 +:106CE00008BFFFDF16E6628840F27123A9695A43A4 +:106CF000C1EB420101FB00F994F85B0020281CBFA6 +:106D000094F85C0020280BD1B4F81C01ABEB000018 +:106D100000B2002804DB94F81F01002818BF0A9075 +:106D20000E9830B1049800280F9840D0002818BF62 +:106D3000FFDF099904980844A969484304900A9818 +:106D40000890012808BF974F08D002281BBFFFDF1B +:106D5000944F954FFFDF08BF012001D04FF0000096 +:106D6000FCF78EFA39184AF2531001444FF47A7046 +:106D7000B1FBF0F1049801EB40070898012808BF27 +:106D8000002004D002281ABFFFDF00200120FCF7FA +:106D90005CFA38446030E861618840F27122A86989 +:106DA0005143C0EB4100A0F547702862B2E50028CE +:106DB0001ABF08980028FFDF0A98012808BF794FFA +:106DC00008D002281BBFFFDF764F774FFFDF08BFD9 +:106DD000012001D04FF00000FCF752FA39184AF2B6 +:106DE000531001444FF47A70B1FBF0F0A9EB0007A7 +:106DF00094F84D00012808BF002004D002281ABFD3 +:106E0000FFDF00200120FCF720FA0F99081A384410 +:106E1000A0F120098DE700BFB4F8C810A1EB0B0169 +:106E200009B20029C4BF03217171119900293FF4EF +:106E300098AD1E9900297FF497AD618840F27122C8 +:106E4000A8695143C0EB4101304606F0FDF900044A +:106E5000000C3FF4A2AD1F99002918BF0880012043 +:106E600015B0BDE8F08F002088F81B0088F81A00E4 +:106E7000C8F80000C8F8240015B00020BDE8F08F65 +:106E800070B54A4D0929D5E900327BD2DFE801F01F +:106E9000056981907DA3A3669F0000201062D17ECA +:106EA00004295CD2DFE801F05B5B0253516A0C6895 +:106EB0001168C88111680861106890F8350040B900 +:106EC000F9F7A6FC69680968096CFAF7CAFD002899 +:106ED0001BDC686801684A8EB4F850108A4207D1FA +:106EE000B4F8CC20511AA4F8CE10A4F8502006E033 +:106EF000511AA4F8CE100168498EA4F85010026807 +:106F0000C1681164C16841611CE068680168098E4C +:106F1000B4F85020891AA4F8CE100168098EA4F89C +:106F2000501001680A6CC2600A6C4261896CC4F836 +:106F3000D8100168C96CC4F8F8100068B0F85000A7 +:106F4000A4F8FC002046BDE8704003F089BDD0687D +:106F50005061FCF7BDFF002818BFFFDF70BDFFDFE9 +:106F600070BDD07E04280ED2DFE800F00D0D0206C1 +:106F7000BDE8704003F033BFFDF73DF9002818BFAE +:106F8000FFDF70BD27E0FFDF70BDBDE87040FCF79C +:106F900031BBD87E022816D0D87E032818BFFFDF69 +:106FA0000DE00000445B0100E46A0100E000002005 +:106FB000D87E022807D0D87E032818BFFFDFBDE89F +:106FC000704000F009BCBDE8704000F075BCBDE841 +:106FD0007040F9F707BCFFDF70BD2DE9F047FB4DAE +:106FE0000026FB4F82460C464FF00109092979D251 +:106FF000DFE801F005657171657878717100686886 +:10700000DFF8CC83002818BFFFDF21465046C5F8C3 +:107010000480FFF735FFF87E022818BFBDE8F0872F +:107020006868D0F80080406A0568F9F7D4FB044628 +:1070300095F84D00DFF89CA3012808BF002008D078 +:10704000022817BFFFDFDFF890A3FFDF002008BF93 +:107050000120FCF715F950444AF2531108444FF44B +:107060007A71B0FBF1F0D8F8181040F271220844A0 +:1070700069885143C0EB4100A0F1200AB72C98BFAA +:10708000B7242946012006F01AF92044AAEB000093 +:10709000A0F201342946012006F011F9696A9C30FA +:1070A000814288BF0E1AC8F82C40A64238BF344629 +:1070B000C8F82840386880F83490BDE8F08750461A +:1070C000FFF7DEFEF87E022804BF386880F83490AF +:1070D000BDE8F08706E050462F60FFF7D1FE2E6036 +:1070E000BDE8F087FFDFBDE8F0872DE9F041B74C40 +:1070F00007460D4609291ED2DFE801F005101414D9 +:10710000101D1D1414006068B44E002818BFFFDF66 +:10711000294638466660BDE8F041B1E63846BDE82C +:10712000F041ADE6AD4820603846FFF7A9FE0020EB +:107130002060BDE8F081FFDFBDE8F081F0B5A44933 +:1071400085B00026CA7EA14C032A03D02831CA7E0E +:10715000032A64D10025216000B3012806BF032063 +:107160008876FFDF0AD02068002E05604562256022 +:1071700055D09B48456005B00020F0BD2068C17E19 +:1071800029B1C17E827E914208BF20BFF6D0C17E68 +:1071900000290CBF012600268576E4E70026032798 +:1071A00008468F76C97E032904D0C07E002808BF18 +:1071B000012631E00120FDF73DF82068007F00281E +:1071C00008BFFFDF2068067F8DF804708DF805701A +:1071D000F9F71EFB02904FF4FA70039001208DF82E +:1071E000000069463046F9F7A4FC2068007FFAF7F2 +:1071F000C4FC30B920BF2068007FFAF7BEFC00282D +:10720000F8D02068007FF9F7EDFA20680577C57699 +:10721000857605600126456220688576A3E705B07E +:107220000C20F0BD2DE9F0416E4E054696F80004A5 +:107230006D4C400994F800144909884218BFFFDFDB +:1072400096F800044009694991F8001449098842F8 +:1072500018BFFFDF94F8140D4009654991F8001438 +:107260004909884218BFFFDF624800240570584D65 +:10727000EC76AC7605F12806F476B4760121103070 +:1072800000F10807017104606C6274622C60346064 +:1072900005F150087C6088F83740284600F01EFC55 +:1072A00005F1280000F01AFC88F80C407C706C6135 +:1072B0007461AC76B476A7F1100044600460BDE858 +:1072C000F0814D49087170472DE9F8434049054662 +:1072D000CA7E3E4C01F12800002A04BFC27E002A6B +:1072E00072D0C97E022907BFC17E00290C20BDE8EB +:1072F000F88320604148F9F725FA21680877384873 +:1073000045602168086014384862ADB1012105F17B +:10731000F400FAF7D5FE0620F7F788FB06460720AB +:10732000F7F784FB95F8F4103044B1FBF0F200FB62 +:107330001210401C85F8F4002068007F002808BF68 +:10734000FFDFF9F748FA2E49091838BF40F2F65026 +:1073500000F26B1087B220680326C676FCF791FC1A +:1073600021680861FCF7B1FC00254FF001080028F6 +:107370004FD0FCF7AAFC21684A6A10600868012116 +:1073800080F800806846FAF726FE9DF8000042F279 +:1073900010710002B0FBF1F201FB12000744F9F793 +:1073A00037FA3946F9F74DFA2168C8602268167233 +:1073B00056721571107FD37E111D92F81AC0634565 +:1073C00034D0F9F7B6FB35E01CE00000E000002007 +:1073D000840D0020445B0100E46A0100AC0D002034 +:1073E000F000002001E000E00BE000E018E000E029 +:1073F00019E000E0D8000020E8000020EB70010058 +:107400000AFAFFFFFE482160F9F79CF92168087726 +:1074100075E7F9F7FDF93946F9F713FA2168C860FD +:1074200008680570086880F80180BFE7D576957612 +:1074300015605562206805830020FCF7FBFE0020E4 +:107440002560BDE8F8832DE9F041EE4E82B0F17E73 +:1074500019B906F12801C97E19B102B00C20BDE8A6 +:10746000F0810221F176DFF8A483E74DC6F824808D +:1074700035600024C8F800002C73A0F8FC40E44FED +:1074800098F8041090F80421438837F8111037F861 +:10749000122011440A04120C214605D002FB03F10C +:1074A000DC4AB1FBF2F1491C8AB2416A05F0B2FF35 +:1074B00000940194D8F8001098F80400002391F883 +:1074C000041137F810001A4637F81110084481B239 +:1074D0001846FFF764F9002818BFFFDFAC600120F1 +:1074E0002C6028736C862C8685F83640D8F800000E +:1074F000B0F85010491EA0F85010348302B000209C +:10750000BDE8F081C04981F837007047C24810B526 +:1075100040680124817E032908BF002409D0016846 +:10752000497831B1006ABD49884284BF0024FCF724 +:107530007DFE204610BD70B5B74844682068C189FB +:10754000491CC1812268D2E90A0192F83720256AD4 +:10755000002A1CBF2A4605F09EFE216885428862EB +:1075600005D82068007B01281CBF012070BD0020C9 +:1075700070BD2DE9F043A84CA24883B02060416A59 +:10758000006800260D6880F8346095F8D610002950 +:1075900004BF007B032856D1F9F73AF90146206869 +:1075A0004069FAF75EFA00F2617000284BDD21684D +:1075B00040F271274A6A0B681268D3F818C05288E3 +:1075C0007A43CCEB4202B0FBF2F0B5F85020401CFD +:1075D000104418860868B5F8CC20018E511A09B2FB +:1075E000002930DD012180F83610B5F87600B5F8B5 +:1075F0007410DFF81C82401AB5F85010401E084481 +:1076000087B20DF1080917E0516A097938F81110AD +:10761000CDE90069028E95F80431007B38F813300B +:10762000194489B20123FFF7BAF860B101280ED0DE +:10763000022818BFFFDF06D022681068018E791A71 +:1076400009B20029E0DA266003B0BDE8F0832068C3 +:107650000068018EBDF8082011440186ECE770B582 +:1076600000256D4C052822D2DFE800F0141C030E23 +:107670000D00002000F0A6F96068C57685760560EB +:10768000456268B1656070BD2068C5768576056025 +:10769000456270BD012000F095F960680028F1D1C5 +:1076A000FFDFEFE7616803200968087370BDFFDF43 +:1076B00070BD2DE9F041584D002478B1012814D057 +:1076C00002281CBFFFDFBDE8F08100F0C0F9686848 +:1076D000C47684760460446220B929E000F0B7F9EA +:1076E000686828B36C60BDE8F08168684669016825 +:1076F0004C70C47684764A4F0460446200217868F6 +:1077000005F006FA786880F81A4180F81B41C0F845 +:10771000F860FFF798FE002818BFFFDFF8F7A5FF15 +:1077200040486C600078F2F7CDFB6C60BDE8F081FA +:10773000FFDFD7E7384910B54C68E17E022918BF52 +:1077400010BD2168CA89002A18BF10BD0861606A8F +:10775000006890F84D00012808BF002004D00228DE +:107760001ABFFFDF00200120FBF76FFD21680A69C7 +:10777000101A8A6A02448A622168CA6A1044C8627E +:1077800010BD70B5244D04460029686804BF04622A +:1077900070BD012902BF611E016270BD02291CBFBC +:1077A000FFDF70BD1046FBF75CFD4FF47A7100F20D +:1077B000E140B0FBF1F06968201A086270BD1A4818 +:1077C000C07E00281CBF0020704710B50720F7F7C7 +:1077D0001FF980F0010010BD2DE9F8430E4D4FF068 +:1077E0000308002728680126041D80F80880077117 +:1077F0000068407801284ED00121684616E000005C +:10780000DB6F0100840D0020D40D0020E800002073 +:107810004EFC010040420F00E0000020CF82130028 +:10782000F0000020D8000020AC0D0020FAF7D3FBB8 +:107830009DF8000042F210710002B0FBF1F201FB72 +:1078400012002968496A09680E183146A068F8F7DD +:10785000F8FFA0603146204605F0F6FC461C28687B +:10786000018B0A299CBF31440183984988421CBF7F +:10787000018B0A2992BF84F8058002216171027F81 +:10788000C37E214690F81AC063450FD0BDE8F84387 +:107890001046F9F74EB94FF47A71A068F8F7D1FFA6 +:1078A000A0600021204605F0CFFCD8E7C776877698 +:1078B00007604762BDE8F8832DE9F047844E84B045 +:1078C0003068416A04680D68F8F7A2FF32685269AF +:1078D00001461046FAF7C5F83168002700284A6AC1 +:1078E000126808BF38460AD00B68528840F2712CE3 +:1078F0009B6902FB0CF2C3EB4202B0FBF2F095F87D +:107900005C20082A0ED0B5F85020638E02EB000CE4 +:107910006345AEBF581C401C1044608694F8360086 +:1079200058B903E0608E401C608606E0608EB5F8B2 +:10793000CC20904204BF401C6086088BDFF8948105 +:10794000401C0883B5F87600B5F874100DF1080AEC +:10795000401AB5F85010401E08441FFA80F919E08B +:107960003068406A007938F81000CDE9007A95F85F +:10797000041138F81110084481B2207B0023FEF76F +:107980000EFF002804BF04B0BDE8F087012818BF2F +:10799000FFDF11D0628EA9EB020000B20028DFDA0F +:1079A000082085F86A00012085F8690004B028469F +:1079B000BDE8F04702F086BD608EBDF808100844AF +:1079C0006086E7E7F0B5424E002483B07168012875 +:1079D0004A6A15682ED110793E4B0A6833F81000B8 +:1079E000177B4FF0010C032F03D0117B012910D01E +:1079F00020E0946009680C60CDE900C495F804119A +:107A0000B5F8CC2033F811100023084481B20320CC +:107A10000BE0CDE900C495F80411B5F8CC2033F89B +:107A200011100023084481B20120FEF7B8FE00289F +:107A300018BFFFDFF8F719FE706804830268B5F815 +:107A400050105186006880F8364003B0F0BD38B55C +:107A50001F4C00200546616809684A78002A18BF53 +:107A60004D702AD1097861B101216846FAF7D7FA39 +:107A70009DF8000042F210710002B0FBF1F201FB30 +:107A800012006268516A09680144D068F8F7D9FEAB +:107A90006268D060157103205072107FD37E111D73 +:107AA00092F81AC0634502D0F9F743F803E0D5769F +:107AB00095761560556260680583F8F7D6FD06482F +:107AC0000078BDE83840F2F7FDB90000AC0D0020A9 +:107AD000E00000204EFC0100D80000202DE9F04716 +:107AE000DFF874801D4C05464FF01F090027EE7E1D +:107AF000042E23D2DFE806F02922021D454518BFD7 +:107B0000FFDF02202560A8762168C87E28B1C87EE4 +:107B10008A7E904208BF20BFF6D0C87E8F760028AC +:107B20001CBF4FF00C0927600CD10F604F6227601B +:107B30000BE00120FFF702FB814600E0FFDFB9F117 +:107B4000000F02D0E87EB042D1D1E87E002818BFF5 +:107B5000FFDFBDE8F0870000840D0020E00000207A +:107B600010B584B004466846FBF714FF002808BF30 +:107B7000FFDF009805F071FE0321009805F084FEF8 +:107B80000098017821F010010170214605F0F9FEFE +:107B9000192C80F02B81DFE804F03A2A0D65FAFAFF +:107BA000F91C9FFAF9F988FAFAFAFAF8F9F9ADC965 +:107BB000E5FAFC00FD48806890F8E910009805F0AF +:107BC00065FFFBF7FAFE00281CBF04B010BD00F0F3 +:107BD000F9B8F648806890F8C110009805F0A6FF43 +:107BE000FBF7EBFE002840F0258100F022B9EF48BA +:107BF0008068D0F8F400411C009805F038FFFBF7CE +:107C0000DCFE00281CBF04B010BD00F0DBB8E74C60 +:107C1000A068D0F8F0008179009805F0FCFEA0681B +:107C2000D0F8F0000189009805F0EEFEA068D0F8C9 +:107C3000F0004189009805F0D2FEA068D0F8F0006D +:107C40008189009805F0D2FEA068D0F8F000C189C3 +:107C5000009805F0D2FEFBF7B0FE00281CBF04B070 +:107C600010BDAFE0D14CA068D0F8F000011D009825 +:107C700005F010FFA068D0F8F00000F10C010098AA +:107C800005F012FFA068D0F8F00000F11E01009886 +:107C900005F010FFA06800F1B801009805F018FF8A +:107CA000FBF78BFE002873D1C1E0C04C60690178FE +:107CB000009805F025FF60698188009805F022FF93 +:107CC00060694188009805F021FFFBF776FE0028E7 +:107CD0001CBF04B010BD75E0B549D1E90001CDE984 +:107CE000020102A9009805F025FFFBF766FE0028B7 +:107CF0004ED19CE0AD4CA068B0F84010009805F063 +:107D000023FFA068B0F84210009805F021FFA0689A +:107D1000818F009805F020FFA068C18F009805F0C2 +:107D20001FFFFBF74AFE002877D180E09F4CA06838 +:107D3000818F009805F010FFA068C18F009805F0B2 +:107D40000FFFA068B0F84010009805F0FDFEA06895 +:107D5000B0F84210009805F0FBFEFBF72EFE00285D +:107D600068D166E0914CA06890F80D11009805F07C +:107D700027FFA06890F80E11009805F025FFFBF78B +:107D80001CFE002849D152E003E01EE02FE02DE068 +:107D900043E0864CA06890F8FC0005F0A0FB01468B +:107DA000009805F015FFA06890F8FD0005F097FB1E +:107DB0000146009805F010FFFBF7FFFD00281CBFEF +:107DC00004B010BDFFDF04B010BD784CA06890F87F +:107DD000E510009805F024FFA06890F8E4100098E2 +:107DE00005F022FFFBF7E9FD20BB22E0FFDFFBF7F8 +:107DF000E4FD002808BFFFDF0C2C19BF132C182C42 +:107E000004B010BD112C1CBF072C152C12D0012C56 +:107E100019BF002C022C04B010BD002163488068FB +:107E2000A0F87A10012180F87E1004B010BDFFDFA9 +:107E3000F3E7FFDF5D4900208968A1F8800004B006 +:107E400010BD2DE9F043594C83B0207910F0010F9B +:107E500004BF03B0BDE8F083206900230521C57885 +:107E6000A06890F85B20503005F098F9002818BF02 +:107E7000022D0CD00B2D18BF042D08D0052D1CBFD2 +:107E8000062D0D2D03D0607840F0080060706078FA +:107E900000281CBF03B0BDE8F0832069C078801EB5 +:107EA000162880F0E683DFE810F01600E4038F0068 +:107EB000AD0006012E00E403C801E4038500500173 +:107EC000C800E403E403E403E40337021E024F02A4 +:107ED000B9022F03A403A0680023012190F85D20BC +:107EE000503005F05BF9002840F0D183206905F09F +:107EF000CFFDA16881F8EA00022081F85D00002032 +:107F000081F882003CE0A0680921002390F85B2002 +:107F1000503005F043F920B1206905F009FE122820 +:107F200014D0A0680A21002390F85B20503005F09F +:107F300035F920B1206905F0FBFD14281AD020691D +:107F400005F0F6FD162840F0A2831DE0A06801258B +:107F5000002390F85B200921503005F01FF900281C +:107F600008BF657000F093836078002800F0CA8134 +:107F700000F08DBBA168002081F8900081F85B00C3 +:107F800081F87E0000F083BBA06890F85B101C298C +:107F900040F07D83002180F8911080F85B1080F81C +:107FA0007E101A2001F089F800F071BBF800002063 +:107FB00060FC0100A06890F85B100C2947D10021FB +:107FC00080F85F100F2134E0A06890F85B10102952 +:107FD0003DD1D0F8F01000884988814218BFFFDFFA +:107FE000A068D0F8F00000F12601206905F07DFDC1 +:107FF000A06800F1BC01206905F07FFD1320A16895 +:1080000000F07ABAA26892F85B0013281FD1D2F868 +:10801000F00002F1A80300F11E0100220E3005F06D +:1080200052F8A0680021C0E92611012180F85F10F4 +:10803000152180F85B1000F02ABBA16891F85B0065 +:10804000132812BF102891F88400002802D00220C3 +:1080500000F073BA206905F067FDA168002581F87A +:10806000C00081F8835081F87E50D1F8F000098873 +:108070004088884218BFFFDFA068D0F8F0100D706C +:10808000D0F82C110A78002A18BFFFDF40F02681B3 +:108090000288CA80D0F82C2190F8C0101171D0F855 +:1080A0002C110D72D0F82C210B211170D0F82C213D +:1080B0000188518040E0A06890F85B101829C6D173 +:1080C000002580F8835080F87E50D0F8F0100088AA +:1080D0004988814218BFFFDFA068D0F8F0100D700A +:1080E000D0F82C110A78002A18BFFFDF40F0F68084 +:1080F00090F884207AB180F884500288CA80D0F841 +:108100002C110D71D0F82C210C211170D0F82C21DC +:108110000188518010E00288CA80D0F82C110D71BE +:10812000D0F82C2101211172D0F82C210B211170D3 +:10813000D0F82C21018851800088F6F727FEF6F749 +:10814000D7FAE078F1F7BEFEC8E0A0680023194630 +:1081500090F85C20503005F021F850B9A068002359 +:10816000082190F85B20503005F018F8002800F046 +:1081700045826078002840F08A82A06890F88600E6 +:1081800010F0020F17D1206905F0C4FCA16881F836 +:108190008700206905F0C0FCA168A1F8880020696B +:1081A00005F0BDFCA168A1F88A0091F8860040F0B6 +:1081B000020081F88600A06890F8861011F0010F87 +:1081C00015D190F85C2000231946503004F0E6FFEA +:1081D000002808BFFFDF0121A068042280F85C109E +:1081E00080F8EC2080F882100021A0F88010A068B0 +:1081F00090F85B10012907D1002180F85B1080F80E +:108200007E10E078F1F75EFEA168D1F8F0000988F1 +:1082100042888A4204BF0178042940F03882002550 +:108220000570E078F1F74EFEA06890F85B10002929 +:1082300008BF80F87E5000F02ABAA068002307210A +:1082400090F85B20503004F0A9FF002800F0D681A0 +:108250006078002840F01B826946206905F0ABFC7D +:10826000A0689DF80020002590F88C10114001F0C6 +:108270002F0180F88C1090F88D109DF8012011408E +:1082800001F02F0180F88D1080F87E50D0F8F010AA +:1082900000884988814218BFFFDFA068D0F8F0103D +:1082A0000D70D0F82C110A78002A18BFFFDF15D105 +:1082B0000288CA80D0F82C110D71D0F82C11009AC8 +:1082C0008A60019ACA60D0F82C21062111700188B9 +:1082D000D0F82C014180E078F1F7F4FDA06880F837 +:1082E0005B5000F0D4B9A0680023092190F85B200E +:1082F000503004F053FF002800F08081607800289F +:1083000040F0C581A168002081F8720081F87E00EC +:1083100081F85B0000F0BBB9A0680023194690F813 +:108320005C20503004F03AFF002800F0678160784C +:10833000002840F0AC81A0680021A0F88010012145 +:1083400080F882100B2165E0A0680023194690F8A0 +:108350005C20503004F022FF00287DD0206905F019 +:108360000BFC28B3206905F0FFFB0646206905F0E9 +:10837000FDFB0546206905F0FBFB0746206905F07B +:10838000F9FBA1688F86CE8608874D8791F890000B +:1083900000281CBF91F85B001A2833D06846FBF711 +:1083A0001FFB58B3009805F018FB142820D025E0D7 +:1083B000A0680023194690F85C20503004F0EEFECF +:1083C000002800F01B816078002840F0608120695F +:1083D00005F003FBA16881F8C100052081F85C006D +:1083E0000020A1F88000012081F8820000F04FB940 +:1083F000A168002081F87E00FBF701FBA168002046 +:1084000081F89000A0680021A0F88010012180F878 +:1084100082101B2180F85C1000F039B9A06800239D +:108420000A2190F85B20503004F0B8FEA0B120691A +:1084300005F0A2FBE8B3206905F09AFB0746206926 +:1084400005F098FB0546206905F08EFB064620697D +:1084500005F08CFBA16800E051E0B1F82C80CB8DD9 +:10846000B1F830C04A8E8F86CE860D874887B1F826 +:108470003C90B14598BF4E468E85B1F84090B945C5 +:1084800098BF4F46CF85B1F83E90814598BF48468A +:108490000886B1F84290A94598BF4D464D869F4247 +:1084A00038BF1F46CF85954238BF15464D86464595 +:1084B00000E01BE008BF9F4203D1604508BF954222 +:1084C00014D00A88A1F81A218A8DA1F81C210A8EDD +:1084D000A1F81E21CA8D01F58870A1F82021498ECE +:1084E000418201210172E078F1F7ECFCA1680020E3 +:1084F00081F8900081F87E0081F85B00C7E0607829 +:1085000040F001006070C2E0A0680023194690F8B6 +:108510005C20503004F042FEC0B3A06890F85B20AD +:108520001C2A0CD000230B21503004F037FE002809 +:108530001CBF607840F0200011D06070A7E02321BC +:1085400080F8E410162280F8E520172180F85C10EE +:10855000012180F882100021A0F8801097E0A06827 +:1085600090F85B0005F013F888B1A0682A22162164 +:1085700080F8E42080F8E510172180F85C100121D4 +:1085800080F882100021A0F8801080E036E0206999 +:1085900005F018FB00F0070060F30705206905F0FF +:1085A00015FB00F0070060F30F25A06801210026ED +:1085B00080F88210A0F880601D2180F85C10B0F86F +:1085C0004A10ADF800102946C56C009804F08CFFE5 +:1085D000EAB2C1B28A4219BFA26882F8FC10A1684F +:1085E00081F8FC60C5F30721C0F30720814238D130 +:1085F0003BE0A06890F85B001C2801D001209CE7BC +:10860000206905F0DFFA00F0070060F30705206934 +:1086100005F0DCFA00F0070060F30F25A0680121E7 +:10862000002680F87E10A0F87A601F2180F85B1089 +:10863000B0F80D11ADF800102946C56C009804F093 +:1086400053FFEAB2C1B28A4219BFA26882F8FC1095 +:10865000A16881F8FC60C5F30721C0F307208142BF +:1086600003D0A16881F8FD0011E0A06880F8FD60EA +:108670000DE0A0680023194690F85C20503004F00B +:108680008DFD0028BAD0607800283FF4A0AEA06825 +:10869000D0E92812491C42F10002C0E9281203B0B7 +:1086A000BDE8F0832DE9F047FE4D04464FF000078A +:1086B000687808436870287910F0200F2846806891 +:1086C00018BFA0F8747004D1B0F87410491CA0F859 +:1086D000741090F86010012639B990F85B200023DF +:1086E0000621503004F05AFD58B3A88810F4006FEA +:1086F00007D0A86890F86010002918BFA0F86C7027 +:108700001FD1A868B0F86C10491C89B2A0F86C1091 +:10871000B0F86E208A422CBF511A00218288521D67 +:108720008A4228BF80F87260B0F86C10B0F86E20F2 +:10873000914206D3A0F86C7080F81661E878F1F7E2 +:10874000C1FB287910F0600F08D0A86890F85E107F +:1087500021B980F85E600121FDF7B4FE4FF00808F2 +:10876000002C47D16878002842D1287910F0040FF6 +:108770000DD0A86890F85B00052808BFFFDFA86847 +:1087800090F85D10022904BF2E7080F85D7000F033 +:108790000CFF287910F0080F0AD0687840B9A86853 +:1087A00090F85D10032903D10221297080F85D70D3 +:1087B000FFF747FBA87810F0080F16D0A868002331 +:1087C000052190F85B20503004F0E8FC50B185F8AA +:1087D0000180A868D0F82C1108780B2808BF002069 +:1087E000087002E0002003F01BFAA86800F066FEA3 +:1087F00000F097FCA868A14600F1500490F8E8004A +:1088000030B9627B00230121204604F0C7FC10B17F +:10881000208D401C20853D21B9F1000F18D128780A +:10882000022808BF16200ED0012804BFA86890F8BF +:10883000EA0008D06878E8B110F0140F1CBF1E20C1 +:10884000A07602D005E0A07603E010F0080F02D079 +:10885000A176667641E010F0030F03D02A20A076BF +:1088600066763AE010F0200F08BFFFDF2320A076E5 +:10887000667632E094F82E0028B1608D411C618547 +:10888000A18D884213D294F8320028B1208E411C69 +:108890002186A18D88420AD2218DE08C814203D3AA +:1088A000AA6892F8E82012B9A28D914203D322203F +:1088B000A076667611E0A17B31B1A18C814228BF00 +:1088C00084F81A80C5D206E0A08C062803D33E2087 +:1088D000A076667601E0607E58B1E7722773A773D1 +:1088E0000221A868FDF7EEFDE878BDE8F047F1F752 +:1088F000E9BAA868BDE8F0470021FDF7E3BD694982 +:108900004A788B781A430ED101280AD0087910F0E2 +:10891000040F04D0886890F85D00022803D001207D +:108920007047FDF7BBBD0020704770B55D4C054634 +:108930000E46A0882843A08015F0020F04D015F041 +:10894000010F18BFFFDFE66015F0010F18BF2661A9 +:1089500015F0020F12D0304605F03FF8062802D07D +:108960000B283BD00AE0A06890F85B10152905D1D0 +:108970000021C0E92811012180F8601015F0800F56 +:108980001CBF0820A07015F4806F08BF70BDA168DF +:10899000B1F8500089880844801D85B2304605F042 +:1089A0001CF8012822D0304605F017F838B33046BD +:1089B00005F013F8182818BF70BDA06890F8FC10D7 +:1089C000002902BF90F8FD1000290025A0F8FE50F4 +:1089D00029463046BDE8704005F002B9A06890F81D +:1089E0005B100F2908BF0021C8D1C5E7A068294640 +:1089F000A0F8FA503046BDE8704005F040B8A068D5 +:108A00002946D0F8F00085803046BDE8704005F07A +:108A100006B8F8B5234D00260446A860AE806E70F7 +:108A2000AE702E7037460088FAF7B1FFA86800884C +:108A3000FAF7D3FFB4F8D000A968401C82B201F164 +:108A4000500004F058FA002818BFFFDF94F85C00CB +:108A500020280AD1B4F85010B4F8FE00081A00B269 +:108A60000028A4BF6878002804D094F85B00202870 +:108A70003DD119E0A86890F8FC10002908BF90F8D3 +:108A80004C1080F84C1090F8FD10002908BF90F8A9 +:108A90004D1080F84D10002000F00FFB84F85C6052 +:108AA00025E00000F8000020B4F85010B4F8FE00F3 +:108AB000081A00B20028A4BF6878002817D1A86857 +:108AC00090F8FC10002908BF90F84C1080F84C106A +:108AD00090F8FD10002908BF90F84D1080F84D1057 +:108AE000002000F0EAFA84F8916084F85B60A4F852 +:108AF000D060A86890F87E1029B1B0F87A10B0F86C +:108B00007C20914229D290F8821029B1B0F88010CF +:108B1000B0F87C20914220D2B0F87820B0F87610DE +:108B20008A421AD290F85E20B0F874001AB38842D4 +:108B300013D2FD480090FD4BFD4A2146384602F015 +:108B400045FFA8680023052190F85B20503004F011 +:108B500025FB002818BF02F006FDA86890F8001158 +:108B6000012411B390F80111002904BF90F890106E +:108B7000002903D019E00628EFD2DAE790F85C105C +:108B80001B2912D0B0F802118187B0F80411C187F7 +:108B9000B0F8061129B1A0F84010B0F80811A0F8FB +:108BA000421080F8904080F8006190F80A11002986 +:108BB00008BFF8BD90F80C11002906BF90F891107D +:108BC0000029F8BD90F85B2000230B21503004F001 +:108BD000E5FA002818BFF8BDA86800230B2190F81B +:108BE0005C20503004F0DAFA002818BFF8BDA868FD +:108BF00090F84C2090F80D11012A06D0022A07D0D7 +:108C0000032A08BF042905D016E0012914D101E088 +:108C1000022911D190F84D2090F80E11012A06D0AA +:108C2000022A07D0032A08BF042913D004E001292F +:108C300002D10FE002290DD080F89140A86890F889 +:108C40000B1100291CBFB0F80D11A0F84A1080F8D4 +:108C50000A61F8BD002000F030FAEFE7B5488068FF +:108C600090F87E1029B1B0F87A10B0F87C209142CB +:108C70001AD290F8821029B1B0F88010B0F87C2098 +:108C8000914211D2B0F87820B0F876108A420BD217 +:108C900090F85E20B0F8740022B1884204D200BF80 +:108CA00002F04BBF0628FBD300200146FAE42DE971 +:108CB000F0410C4607461D4616464FF49871204673 +:108CC000DDF8188006F0A7FC2780C4F82C81C4E9E1 +:108CD0003C65BDE8F081F6F727B82DE9F0410D4677 +:108CE00007460621F5F7F7FE040008BFBDE8F0814E +:108CF000D4F82C012188002642888A4208D10078C5 +:108D0000072810D00C281FD00B2835D0062850D0AB +:108D100094F8160100285ED06E700E20287084F83A +:108D200016616F8042E06E7007202870D4F82C0125 +:108D30004168C5F802108168C5F80610808968810D +:108D4000D4F82C01067031E00846F6F71FF8074604 +:108D5000F5F7E4FCB8B96E700C202870D4F82C013B +:108D60004068C5F80200D4F82C0106703846F5F7C3 +:108D7000CFFC0120BDE8F0810846F6F707F807466A +:108D8000F5F7CCFC10B10020BDE8F0816E700B202F +:108D90002870D4F82C014168C5F802100089E880D9 +:108DA000D4F82C0106703846F5F7B2FC0120BDE876 +:108DB000F0816E7006202870D4F82C01416882681A +:108DC000C068C5F80210C5F80620C5F80A00D4F836 +:108DD0002C010670EAE794F81801C8B16E701320F0 +:108DE000287094F818010028E0D000BF84F81861BA +:108DF000D4F81A01C5F80200D4F81E01C5F806001F +:108E0000B4F82201688194F818010028EED1CDE76A +:108E100094F8100188B16E701720287094F8100132 +:108E20000028C3D084F81061D4F81201C5F80200FC +:108E300094F810010028F5D1B8E794F8240100282F +:108E400008BFBDE8F0816E701420287094F82401EA +:108E50000028ABD084F82461D4F82601C5F80200BC +:108E6000B4F82A01E88094F824010028F2D19DE7A3 +:108E7000304A5061D17070472DE9F0470446481ED2 +:108E800085B238BFBDE8F0870127DFF8A89004F16C +:108E900008084FF0070A0026B4F8D000401CA4F8D8 +:108EA000D000B4F87400401CA4F8740094F860007A +:108EB00040B994F85B200023062104F1500004F02F +:108EC0006DF9D8B1B4F86C00401C80B2A4F86C0005 +:108ED000B4F86E1081422CBF0A1A0022A3885B1DD1 +:108EE000934228BF84F87270884207D3A4F86C605C +:108EF00084F8167199F80300F0F7E4FF94F87E0007 +:108F000020B1B4F87A00401CA4F87A0094F88200EA +:108F100020B1B4F88000401CA4F8800094F8E80068 +:108F200088B994F85D2007E0A5860100FF8801005C +:108F30002B890100F80000200023012104F15000DA +:108F400004F02CF920B1B4F87800401CA4F87800A3 +:108F500094F85B0007281FD1B4F85000411CB4F806 +:108F6000FA00814262D1D4F8F400411C404606F078 +:108F700064FC0221204603F0D2FE84F85B6084F892 +:108F80008F70D4F8F4000078002808BFFFDFD4F811 +:108F9000F4000178491E017094F85B00082845D15F +:108FA000B4F85000411CD4F8F000808881423DD1D3 +:108FB000D4F82C010178002918BFFFDF22D12188C5 +:108FC000C180D4F8F0004189D4F82C010181D4F893 +:108FD000F0008189D4F82C014181D4F8F000C189D6 +:108FE000D4F82C018181D4F82C010671D4F82C011D +:108FF00080F800A0D4F82C012188418099F8030062 +:10900000F0F760FF0121204603F089FE032120468E +:10901000FDF758FAD4F8F00041882088814218BF43 +:10902000FFDFD4F8F000067084F85B60B4F85000FD +:10903000401C691EA4F850008DB2BFF42DAFBDE8EE +:10904000F087FE4AC2E90601704770B50446B0F8E1 +:10905000740094F85E10002908BFC0F1020503D027 +:10906000B4F87610081A051F94F8720040B194F80D +:109070005B200023092104F1500004F08FF8A0B117 +:10908000B4F86C6094F8600058B994F85B20002341 +:10909000062104F1500004F081F8002808BF28469A +:1090A00003D0B4F86E00801B001F8542C8BF054680 +:1090B000002DD4BF0020A8B270BD10B5DF4CA16850 +:1090C0000A88A1F8282181F8260191F84C0001288E +:1090D00008BF012108D0022808BF022104D00328BC +:1090E0001ABFFFDF00210321A06880F82A1190F841 +:1090F0004D00012808BF012108D0022808BF022125 +:1091000004D003281ABFFFDF00210321A06880F8E4 +:109110002B11012180F82411E078BDE81040F0F710 +:10912000D1BE2DE9F84F6846FAF734FC002808BF95 +:10913000BDE8F88FC14C6078002818BFBDE8F88FF3 +:10914000A0680023012190F85D20503004F026F83B +:10915000002818BFBDE8F88FA06890F8E810002933 +:1091600018BF02204DD190F85B20002319465030E3 +:1091700004F014F840B1A06890F8720020B11220F9 +:10918000FEF7EEFCBDE8F88FA06890F85B200E2A91 +:1091900021D00F2A08BF0B2033D0152A08BF062084 +:1091A0002FD000251F2A30D000230421503003F097 +:1091B000F5FF002818BFBDE8F88FA068012690F8D9 +:1091C0005C1017297DD028DC012952D005294BD00D +:1091D0000B295BD025E0F8F721FF0C2838BFBDE84C +:1091E000F88FA0680821D0F8F0001E30F8F717FFBC +:1091F00028B1A0680421B830F8F711FF00B9FFDFEB +:109200000320FEF7ADFCBDE8F88F1820FEF7A8FCA0 +:10921000A068A0F87A50BDE8F88F1B293DD01D2921 +:109220007ED0D0F8F020117800297AD051880288B9 +:10923000914276D190F85B2000231946503003F01C +:10924000ADFF00286DD0A168D1F8F00000780228A9 +:1092500008BF002066D0032865D0042874D00528F4 +:1092600008BF08205ED0B4E00720FEF779FCA068B4 +:1092700066E00C20FEF774FCA068A0F8805090F81F +:10928000861041F0010180F8861059E01320FEF7A6 +:1092900067FCA068A0F8805052E0C18EB0F83CC0D6 +:1092A000B0F82CA0B0F82E80B0F83090478E614511 +:1092B00038BF8C46A0F82CC0838EB0F840108B428B +:1092C00000E04AE028BF0B46C385028FB0F8421089 +:1092D0008A4228BF0A464286B0F83AB0C18F8B4511 +:1092E00038BF59460186434538BF4346C385BA4215 +:1092F00038BF3A464286D44508BF434503D1494565 +:1093000008BFBA4218D00288A0F81A21828DA0F8AE +:109310001C21028EA0F81E2100F58871C28D03E089 +:1093200013E056E02AE020E0A0F82021408E488299 +:109330000E72E078F0F7C6FD1520FEF711FCA0686C +:1093400080F85C50BDE8F88F30E01820FEF708FC8C +:10935000A068A0F88050BDE8F88F1120FEF700FC4F +:10936000A06880F85C50BDE8F88F91F85F0040B1CC +:1093700091F86000002808BFFFDF0A20FEF7F0FB2D +:1093800027E0F8F74BFE0C2823D3A0680821D0F87B +:10939000F0001E30F8F743FE28B1A0680421B83071 +:1093A000F8F73DFE00B9FFDF0320E7E791F88600FC +:1093B00010F0030F0DD10C20FEF7D2FBA068A0F82F +:1093C0007A5080F87E6090F8861041F0010180F8B4 +:1093D00086106846FAF7DEFA002808BFBDE8F88F65 +:1093E000A0680023194690F85B20503003F0D6FEA9 +:1093F000002808BFBDE8F88FA06890F8F810E9B31E +:10940000A1690978D1BBB0F850100A2937D900F109 +:1094100008010522E06906F039F80028A06804BFB9 +:1094200080F8F850BDE8F88FD0F8F400017881B1E9 +:10943000411C0522E06906F029F801E0F80000204F +:10944000002818BFBDE8F88FA068D0F8F4000078B5 +:1094500030B9A068E169D0F8F400401C06F0EDF9DD +:10946000A068D0F8F4000178491C01700120FEF7D3 +:1094700077FBA06880F8F850BDE8F88FFFE790F818 +:10948000901039B190F85C001B2814BF1420BDE87F +:10949000F88FB6E690F89110002908BFBDE8F88F64 +:1094A00090F85C2000230B21503003F077FE002859 +:1094B00008BF16203FF4A5AEBDE8F88F70B504468E +:1094C00090F85B000025072822D1B4F85000B4F8CA +:1094D000FA10401C884218BF70BDD4F8F400411C3B +:1094E00004F1080006F0A9F90221204603F017FC58 +:1094F00084F85B50012084F88F00D4F8F4000078E1 +:10950000002808BFFFDFD4F8F4000178491E01707D +:1095100094F85B00082818BF70BDB4F85000D4F868 +:10952000F010401C8988884218BF70BDD4F82C0107 +:109530000178002918BFFFDF22D12188C180D4F82B +:10954000F000D4F82C1140890881D4F8F000D4F848 +:109550002C1180894881D4F8F000D4F82C11C089EE +:109560008881D4F82C010571D4F82C1107200870DB +:10957000D4F82C1120884880C348C078F0F7A2FCAA +:109580000121204603F0CBFB03212046FCF79AFF84 +:10959000D4F8F00021884088884218BFFFDFD4F853 +:1095A000F000057084F85B5070BD10B5B64C2079A2 +:1095B00010F0020F08BF10BD6078002818BF10BD62 +:1095C000E068C078192880F05C81DFE800F0514144 +:1095D0000D80FCFC972231FC6174A2FCFCFCFCFBBE +:1095E000D22DE2FDF9FCF800A0680023012190F8DB +:1095F0005D20503003F0D2FD002818BF10BD0321BC +:10960000A06880F85D10002180F87E1080F882103C +:1096100010BDA0680023194690F85C20503003F07C +:10962000BDFD002808BF10BD0020A16800F026B9CC +:10963000A0680023194690F85B20503003F0AEFD7F +:10964000002808BFFFDF0920A16881F85B0010BD7A +:10965000A0680023194690F85B20503003F09EFD6F +:10966000002808BFFFDF0720A16881F85B0010BD5C +:10967000A0680023194690F85B20503003F08EFD5F +:10968000002808BFFFDF0820A16881F85B0010BD3B +:10969000A0680023194690F85B20503003F07EFD4F +:1096A000002808BFFFDF0121A06880F883100C218B +:1096B00080F85B1010BDA06890F85B000F2818BF01 +:1096C000FFDF0121A06880F884100E21F0E7A06878 +:1096D0000023194690F85B20503003F05FFD28B955 +:1096E000A06890F88400002808BFFFDF0121A0686F +:1096F00080F88310102180F85B1010BDA06890F8EE +:109700005B00152818BFFFDF1820A16881F85B00F7 +:1097100010BDA068D0F8F01003884A889A4204BFB0 +:109720000978042919D190F85B200023194650309C +:1097300003F034FD002808BFFFDFA06890F8861012 +:1097400011F0020F04BF012180F85B1005D0002149 +:1097500080F87E10D0F8F0000170A0680023194650 +:1097600090F85C20503003F019FD00287FF45CAFC6 +:1097700010BDA0680023194690F85B20503003F01C +:109780000DFD002808BFFFDF0A20A16881F85B00FB +:1097900010BDA06890F89000012818BFFFDFA068F6 +:1097A0000023194690F85B20503003F0F7FC0028A6 +:1097B00008BFFFDF1A20A16881F85B0010BD25E01B +:1097C0000EE001E04CE05CE0A0680023194690F850 +:1097D0005C20503003F0E2FC002808BFFFDF23E7E5 +:1097E000A06890F89100012818BFFFDFA06800234F +:1097F000194690F85B20503003F0D0FC002808BFD9 +:10980000FFDF1C20A16881F85B00D7E7A06890F813 +:109810005C101D2912D090F85B101F2918BFFFDFC4 +:10982000CCD1B0F8FE1000291CBF202180F85B10BD +:109830000DD0A168002081F87E00BFE7B0F8FE10CF +:10984000002918BF202180F85C100021DEE60021ED +:1098500080F85B1080F891100846FFF72EFCE8E7CF +:10986000A06890F85B001C2818BF072802D00828C1 +:1098700018BFFFDF0020A16881F85C0081F882003A +:109880009CE7FFDF9AE70000F80000202DE9F04197 +:10989000FC4C0646606904F0A0F8E168002701F17D +:1098A0005B02012581F8C1004FF0050896420ED1F8 +:1098B00005FA00F010F0807F08BFFFDFE06880F855 +:1098C0005B80A0F87A7080F87E50BDE8F08101F1ED +:1098D0005C0086421CBFFFDFBDE8F08181F85C8040 +:1098E000A1F8807081F88250BDE8F0812DE9F04345 +:1098F000E44C83B0207910F0010F04BF03B0BDE841 +:10990000F083606901230521C578E06890F85C2048 +:10991000503003F043FC002818BF022D0BD00A2D55 +:1099200018BF0B2D07D0032D18BF062D03D060786C +:1099300040F008006070607800281CBF03B0BDE8EC +:10994000F0836069C078192880F0BF83DFE800F0F9 +:109950004C260DC5FDFDFCFBFAFDA1BDF9FDFDFD8D +:10996000FDF8F7F6F5F4F3FDF200E068012319467F +:1099700090F85D20503003F011FC002840F09A83ED +:10998000606904F085F8E16881F80801022081F837 +:109990005D00002081F8820000F07ABBE0680123BE +:1099A000002190F85C20503003F0F8FB00287DD0B7 +:1099B0006078002840F07E83606904F064F8E16814 +:1099C000A1F81C01B1F85020801A00B247F6FE72CF +:1099D0008242A8BF002853DD01F58F71606904F051 +:1099E00049F80620E16840E0E0680123002190F892 +:1099F0005C20503003F0D2FB002857D0607800285C +:109A000040F05883606904F011F890B3606904F085 +:109A10000AF8E168A1F81C01B1F85020801A00B2E0 +:109A200047F6FE728242A8BF002829DD606903F074 +:109A3000F4FFE16881F81E01606903F0E9FFE16865 +:109A4000A1F82001606903F0CEFFE168A1F82201CE +:109A5000606903F0CFFFE168A1F82401606903F0B9 +:109A6000D0FFE168A1F82601082081F85C0000F031 +:109A700021BBFFE7E0685C30FFF708FF00F01ABB8E +:109A8000282081F86A00012081F8690000F012BBEB +:109A90000CE0E0680123002190F85C20503003F0D6 +:109AA0007DFB18B1607820B100F004BB012000F00C +:109AB0008DB9E0680021A0F88010012180F88210A3 +:109AC0000D2180F85C1000F0F5BAE06890F85C10A9 +:109AD0000E2908BF0F2156D15CE0E0680123002168 +:109AE00090F85C20503003F059FB20B9E06890F802 +:109AF00084000028DAD06078002840F0DB82E0683B +:109B000000210125A0F8801080F8825000F1E001CA +:109B1000606903F0D6FFE06800F1B801606903F006 +:109B2000DBFFE06890F84C01002818BFFFDFE06819 +:109B300001880BE0E6E1C1E14BE103E1D2E0E9E0BD +:109B400052E22BE0A0E062E218E0BEE2A0F84E1183 +:109B500000F5A871606903F0A2FFE06800F5AC7140 +:109B6000606903F0A4FFE06880F84C51112180F88F +:109B70005C10E078F0F7A6F900F09CBAE06890F885 +:109B80005C10142902D0022000F020B9002180F8D6 +:109B90008210192180F85C1000F08CBAE068012373 +:109BA000002190F85C20503003F0F8FA50B9E068DA +:109BB0000123082190F85B20503003F0EFFA0028D1 +:109BC0003FF474AF6078002840F07482E06890F849 +:109BD000860010F0020F17D1606903F09BFFE16867 +:109BE00081F88700606903F097FFE168A1F88800B9 +:109BF000606903F094FFE168A1F88A0091F886009B +:109C000040F0020081F88600E06890F8861011F0BC +:109C1000010F15D190F85C2001230021503003F092 +:109C2000BDFA002808BFFFDF0121E068042280F8A8 +:109C30005C1080F81B2180F882100021A0F88010B1 +:109C4000E06890F85B10012907D1002180F85B10D3 +:109C500080F87E10E078F0F735F9E06890F81A1196 +:109C6000042940F02782002580F81A51E078F0F7A7 +:109C700029F9E06890F85B10002908BF80F87E5051 +:109C800000F018BA18010020E0680123002190F8C4 +:109C90005C20503003F082FA00283FF407AF607870 +:109CA000002840F007826946606903F048FFE068D9 +:109CB0009DF8002090F88C10114001F02F0180F8E1 +:109CC0008C1090F88D109DF80120114001F02F01AB +:109CD00080F88D100021A0F88010012180F88210FA +:109CE000092157E7E0680123092190F85B205030F3 +:109CF00003F054FA00283FF4D9AE6078002840F011 +:109D0000D981E16881F8720081F87E0081F85B00FA +:109D100000F0D0B9E0680123002190F85C205030B9 +:109D200003F03CFA00283FF4C1AE6078002840F010 +:109D3000C181E0680021A0F88010012180F8821024 +:109D40000B2127E7E0680123002190F85C205030C8 +:109D500003F024FA00287DD0606903F00DFF00288D +:109D600004BFE0685C3000F01D81606903F0FCFE18 +:109D70000646606903F0FAFE0546606903F0F8FEE6 +:109D80000746606903F0F6FEE1688F86CE86088795 +:109D90004D8791F8900000281CBF91F85B001A28AD +:109DA0000BD06846F9F71CFE38B10098C07814282B +:109DB00003D0E168002081F89000E0680021A0F85D +:109DC0008010012180F882101B21E3E6607000F012 +:109DD00071B9E06801230A2190F85B20503003F04C +:109DE000DDF9B8B3606903F0C7FEA0B3606903F0A2 +:109DF000BFFE0746606903F0BDFE0546606903F0DB +:109E0000B3FE0646606903F0B1FEE168B1F82C804C +:109E1000CB8DB1F830C04A8E8F86CE860D874887AD +:109E2000B1F83C90B14598BF4E468E85B1F8409050 +:109E3000B94598BF4F46CF85B1F84290A94598BF24 +:109E40004D464D86B1F83E90814598BF48460886FC +:109E50009F4201E02EE024E038BF1F46CF859542A7 +:109E600038BF15464D86464508BF9F4203D1604521 +:109E700008BF954215D00A88A1F860218A8DA1F803 +:109E800062210A8EA1F86421CA8D01F59C70A1F8A7 +:109E90006621498E0186012180F82610E078F0F7CE +:109EA00011F8E168002081F8900081F87E0081F8C7 +:109EB0005B00FFE0607840F0010087E7E068012385 +:109EC000002190F85C20503003F068F900283FF43E +:109ED000EDADE06890F85B0020283FF4E7AD6078D6 +:109EE000002861D1606903F071FE00F00701E068AD +:109EF00080F805110021A0F88010012180F882105F +:109F00001D2147E6E06890F85C1090F85B201E2960 +:109F100002D01C2A2ED036E61C2A2BD01E2908BFC0 +:109F200000F15C05606903F061FE58B36169E068A7 +:109F300003F08DFA064610F0FF0704BFC6F30720B2 +:109F4000002832D0606903F04FFEE168A1F81C01DF +:109F5000B1F85020801A00B247F6FE728242A8BFC4 +:109F600000282FDD81F81E71300A81F81F012020A2 +:109F700028702DE01D291CBF1E2900F15B053FF450 +:109F800002AECFE7E06890F85B101C2909D10021F0 +:109F900080F89110302000F051FFE168182081F81E +:109FA000C2002846FFF772FC84E000212970E068B7 +:109FB00000F15B0295420BD180F89110002000F077 +:109FC0003DFF05E0282081F86A00012081F8690042 +:109FD000E06800F15C018D424FF000010CBF80F899 +:109FE000821080F87E1065E0606903F01BFE162881 +:109FF00060D1E06890F85B101C295BD1002180F8EB +:10A000005B1080F8911080F87E10232050E0E0680B +:10A010000921012390F85B20503003F0BFF820B1F4 +:10A02000606903F085FD122813D0E0680A2101233E +:10A0300090F85B20503003F0B1F820B1606903F074 +:10A0400077FD14281DD0606903F072FD162831D108 +:10A0500021E0E06801252B4690F85B200921503073 +:10A0600003F09CF8002808BF657023D0607808BB17 +:10A07000E068002180F8721080F87E1080F85B1094 +:10A0800018E0E168002081F8900081F85B0000BFD3 +:10A0900081F87E000EE0E16891F85B001C2809D190 +:10A0A000002081F8910081F85B0081F87E001A2081 +:10A0B00000F0C4FEE068D0E928134A1C43F1000117 +:10A0C000C0E9282103B0BDE8F083E0680123002146 +:10A0D00090F85C20503003F061F8002801BF0120A7 +:10A0E000607003B0BDE8F083607800283FF4C2AC34 +:10A0F00003B0BDE8F08330B585B004466846F9F793 +:10A1000049FC002808BFFFDF009803F0A6FB0321ED +:10A11000009803F0B9FB0098017821F0100101705C +:10A12000214603F02EFCA01E162876D2DFE800F0B0 +:10A130000BAA23ABAB1BAA47AAAB3631AAAAAAAA81 +:10A14000ABAB5D768E9CFE48C06890F88E1021B156 +:10A150000621009803F09AFC95E090F8071100980A +:10A1600003F094FC8FE0F648C06890F8C1100098A6 +:10A1700003F0DCFC87E0F24DE86800F1E8010098AC +:10A1800003F0AEFCE86800F1BC01009803F0B2FCFB +:10A1900079E00621009803F0C5FC74E0E84DA8685A +:10A1A0000178009803F0ACFCA8688188009803F05F +:10A1B000A9FCA8684188009803F0A8FC63E000208F +:10A1C00002900390DE48C06890F88C1001F0F50111 +:10A1D0008DF8081090F88D0002A900F001008DF8AC +:10A1E0000900009803F0E2FC4DE0D54DE868B0F8B6 +:10A1F0004010009803F0A8FCE868B0F842100098FE +:10A2000003F0A6FCE868818F009803F0A5FCE868DD +:10A21000C18F009803F0A4FC35E033E0C84DE86836 +:10A22000818F009803F098FCE868C18F009803F0D4 +:10A2300097FCE868B0F84010009803F085FCE868E7 +:10A24000B0F84210009803F083FC1CE0BC4DE868B5 +:10A2500090F83511009803F0B3FCE86890F83611D7 +:10A26000009803F0B1FC0EE0B54DE86890F84A1094 +:10A27000009803F0A5FCE86890F84B10009803F0F4 +:10A28000A3FC00E0FFDFF9F798FB002808BFFFDF21 +:10A290000C2C12BF072C05B030BD122C1CBF142C87 +:10A2A000162C0DD0022C04BF05B030BD0021A448EF +:10A2B000C068A0F88010012180F8821005B030BD80 +:10A2C0009F480021C068A0F87A10012180F87E1014 +:10A2D00005B030BD70B50C4605464FF4C071204640 +:10A2E00005F099F92580002084F8380184F84401AC +:10A2F00084F84C0184F85A0170BDF4F715BD2DE9BE +:10A30000F0410D4607460721F4F7E5FB040008BFBE +:10A31000BDE8F08194F838010026C8B16E700720BE +:10A32000287094F8380188B1268484F83861D4F80C +:10A330003A01C5F80200D4F83E01C5F80600B4F8A9 +:10A340004201688194F838010028EDD1AE7044E0F4 +:10A3500094F84401002837D094F844010B2818D011 +:10A360000C2818BFFFDF38D12088F4F70FFD07460F +:10A37000F4F7D4F9A0B96E700C20287094F8460157 +:10A38000A8702088A88084F844613846F4F7C0F9A2 +:10A3900023E02088F4F7FAFC0746F4F7BFF910B180 +:10A3A0000020BDE8F0816E700B20287094F8460103 +:10A3B000A8702088A88094F84A01A87184F84461A4 +:10A3C0003846F4F7A5F908E094F8700140B16E70D2 +:10A3D0000E20287084F870616F800120BDE8F08144 +:10A3E00094F84C0180B16E70082028702088688035 +:10A3F000D4F85001D4F854116860A960B4F8580139 +:10A40000A88184F84C61E8E794F85A0140B16E7075 +:10A4100016202870B4F85C01688084F85A61DCE783 +:10A4200094F86A0188B16E701720287094F86A0158 +:10A430000028D2D084F86A61D4F86C01C5F8020013 +:10A4400094F86A010028F5D1C7E794F85E01C8B115 +:10A450006E701320287094F85E010028BDD000BFF4 +:10A4600084F85E61D4F86001C5F80200D4F8640194 +:10A47000C5F80600B4F86801688194F85E01002808 +:10A48000EED1AAE794F87201002808BFBDE8F08178 +:10A490006E701420287094F8720100289DD000BFBF +:10A4A00084F87261D4F87401C5F80200B4F8780138 +:10A4B000E88094F872010028F2D18EE7204A90607B +:10A4C000D170704710B5002180F85B1080F85C10E7 +:10A4D00080F85E1090F8D600002814BF02200320F8 +:10A4E000FDF7BDF81648C078BDE81040EFF7EABCAC +:10A4F0002DE9F047124C80460D46E0680088F4F7DD +:10A5000057FC060008BFFFDF6078284360702079A1 +:10A510004FF0000510F0200FE0681CBFA0F8745049 +:10A5200080F8DC5004D1B0F87410491CA0F8741005 +:10A53000E068012790F8601051B990F85C2001E0C4 +:10A540001801002001230621503002F027FE48B3F5 +:10A55000A08810F4006F07D0E06890F86010002920 +:10A5600018BFA0F86C501DD1E168B1F86C00401C18 +:10A5700080B2A1F86C00B1F86E3083422CBF1A1A79 +:10A580000022B4F806C00CF1050C624598BF81F8B2 +:10A590007270984206D3A1F86C5081F87071E0781F +:10A5A000EFF790FC20794FF0020910F0600F11D006 +:10A5B000E06890F85E1011B1032906D00AE080F837 +:10A5C0005E700120FDF74BF804E080F85E900120FA +:10A5D000FDF745F8E06890F85E10012905D1A188E3 +:10A5E00011F4807F18BF80F85E90B8F1000F7DD124 +:10A5F000A18811F4007F18BFA0F8F05004D1B0F882 +:10A60000F010491CA0F8F01000F04CFC00F005FE22 +:10A6100001F0FCFA0028E06818BFA0F8D05004D17F +:10A62000B0F8D010491CA0F8D01001F0F2FA40B1F7 +:10A63000E06890F8DC1002299CBF491C80F8DC100F +:10A6400004D8E06890F8DC00022806D9E068A0F899 +:10A65000D050A0F8D25080F8DC50E06801230021EF +:10A6600090F85C20503002F099FD20B9E06890F835 +:10A670005C00072859D1E0680123002190F85B2095 +:10A68000503002F08BFD00284FD0E06801230021FC +:10A6900090F85D20503002F081FD002845D0E06840 +:10A6A00090F85E10022904BF90F8DC0000283CD12D +:10A6B0003046F3F7B9FDB8B3F9F7B3F9A0B3E068E2 +:10A6C000B0F8CA10012930D980F8D570B0F87620DA +:10A6D000B0F87410931E9942AFBF0121511A491E60 +:10A6E00089B2B0F8D020E3889A4200E034E02FBF6E +:10A6F00001229A1A521C92B2914288BF1146012936 +:10A7000008BF80F8D55090F8002192B1B0F8D2205F +:10A71000B0F8020182422FBF0120801A401C80B293 +:10A72000814288BF014604E0FFE7E068012180F82C +:10A73000D550D4F80CC0BCF85020501880B2ACF8FA +:10A74000CC009CF85E10002918BF01290ED0022908 +:10A750001CBF0329FFDF0CD0A088C0F340200028D5 +:10A76000E06818BFA0F8DE505FD157E0ACF8C80031 +:10A77000F2E79CF85D10032922D0BCF87400BCF805 +:10A7800076100026821C914206D3081A801E060409 +:10A79000360C1CBF701E86B29CF8720058B19CF833 +:10A7A0005B20012309210CF1500002F0F7FC002886 +:10A7B00008BF00262BD0E06890F8601099B90AE035 +:10A7C000BCF874100329D1D3BCF876001044401CA7 +:10A7D000ACF8C800C0E790F85C2001230621503097 +:10A7E00002F0DCFC78B1E1680020B1F86E20B1F82D +:10A7F0006C108B1C9A4203D3501A801E18BF401E47 +:10A80000B04238BF86B2002E1CBF701E86B2E06810 +:10A81000B0F8CC103144A0F8C8109DE7B0F8DE10B5 +:10A82000B0F8CE201144A0F8DE10E06890F80611D0 +:10A8300039B990F85D2001231946503002F0AEFC82 +:10A8400038B1E068B0F87810B0F8CE201144A0F824 +:10A850007810E06890F87EC0BCF1000F06D0B0F828 +:10A860007A10B0F8CE201144A0F87A1090F8823017 +:10A8700033B1B0F88010B0F8CE201144A0F88010A9 +:10A880003D22B8F1000F02D080F86A2010E0217854 +:10A89000022910D0012908BF90F8081106D061786C +:10A8A000F1B111F0140F18BF1E210BD080F86A10FF +:10A8B00080F869704DE090F88E10002914BF0621D1 +:10A8C0001621F3E711F0080FDED111F0030F08BFD6 +:10A8D000FFDF2A21E06880F86A1080F8697038E0AC +:10A8E000BCF1000F05D0B0F87A10B0F87C2091428E +:10A8F0000FD22BB1B0F88010B0F87C20914208D272 +:10A90000B0F87820B0F876108A4208D390F8062183 +:10A910002AB1222180F86A1080F8697019E090F855 +:10A920005E204AB1B0F874208A420FD3082180F823 +:10A930006A1080F869700CE0B0F87410062905D32D +:10A940003E2180F86A1080F8697002E090F8690092 +:10A9500090B1E06880F85B5080F85C5080F85E5001 +:10A9600090F8D600002814BF02200320FCF777FEE1 +:10A97000E078EFF7A7FA02E00020FCF770FEE0684D +:10A9800080F8D650BDE8F087FB494A788B781A43A7 +:10A990000DD150B1087910F0080F04D0C86890F8B4 +:10A9A0005D00032803D001207047FCF7C4BD0020E0 +:10A9B00070472DE9F041F04C05460E46A08828432B +:10A9C000A08015F0020F04D015F0010F18BFFFDFB3 +:10A9D000266115F0010F4FF000084FF001071CD061 +:10A9E0003046666102F0F9FF062802D00B280BD032 +:10A9F00013E0E06890F85C1014290ED10021C0E942 +:10AA0000261180F85F7008E0E06890F85C100E296D +:10AA100004BF80F85F8080F8847015F0020F18D0B2 +:10AA20002069C078052802D00B280BD011E0E0681F +:10AA300090F85C1012290CD10021C0E9281180F88F +:10AA4000607006E0E06890F85C100D2908BF80F89F +:10AA5000608015F0800F1CBF0820A070BDE8F08159 +:10AA60002DE9F047C44C82B00126216900250191EF +:10AA7000A5806570A5702570E06066F307098046C3 +:10AA800080F8D6600088F4F793F95FEA000A08BFFF +:10AA9000FFDFE0680088F8F77AFFE0680088F8F7E1 +:10AAA0009CFFE068B0F8CA00D0B101A8F8F772FFC7 +:10AAB000B0B1E06890F8061191B190F85D200123E3 +:10AAC0001946503002F06AFB50B9E068A0F878509F +:10AAD00080F88E500220FFF70EFBE06880F8D5501A +:10AAE000D4F80CC09CF8380138B9BCF82000BCF888 +:10AAF0000410884288BFE08002D8BCF80400E080DF +:10AB0000BCF8CE00401E87B2BCF8D0003844ACF888 +:10AB1000D0009CF8D40000281CBFACF8D2508CF8B0 +:10AB2000D45004D1BCF8D2003844ACF8D200BCF800 +:10AB300074003844ACF874009CF8600040B99CF88C +:10AB40005C20012306210CF1500002F027FB28B104 +:10AB5000E068B0F86C103944A0F86C10E068B0F808 +:10AB6000CA1001299CBF491CA0F8CA10002F18BFA9 +:10AB700080F8DC5090F8D510A1B1B0F8D000E18891 +:10AB800088420FD25046F3F74FFB58B1E06890F877 +:10AB9000001139B1B0F8D210B0F80201814228BFDB +:10ABA00001F03AF8E26882F8D55092F85C00062885 +:10ABB00018BF072819D1B2F85010B2F81C31C91AC1 +:10ABC00009B2002911DB02F58F7102F1080004F0CF +:10ABD00034FE0221E06801F09BFFE06880F81B5121 +:10ABE00080F85C5080F88F6048E0202820D1B2F8CF +:10ABF0005000B2F81C11401A00B2002818DB92F87D +:10AC00001E01002808BF92F84C0082F84C0092F810 +:10AC10001F01002808BF92F84D0082F84D00002067 +:10AC200000F00CF9E06880F81B5180F85C5025E0DA +:10AC300092F85B00202821D1B2F85000B2F81C1124 +:10AC4000401A00B2002819DB92F81E01002808BF44 +:10AC500092F84C0082F84C0092F81F01002808BFBF +:10AC600092F84D0082F84D00002000F0E7F8E0680F +:10AC700080F8915080F81B5180F85B50E16801F139 +:10AC80005000B1F8CE2002F036F9E06890F80011DB +:10AC9000002918BFA0F8D25038480090384B394AE4 +:10ACA0004146484600F092FEE0680123052190F8F5 +:10ACB0005C20503002F072FA002818BF00F053FCFC +:10ACC000E06890F82811F1B190F82911002904BF2B +:10ACD00090F89010002916D190F85C101B2912D022 +:10ACE000B0F82A118187B0F82C11C187B0F82E1165 +:10ACF00029B1A0F84010B0F83011A0F8421080F847 +:10AD0000906080F8285190F83211002904BF02B0F9 +:10AD1000BDE8F08790F83411002907BF90F8911032 +:10AD2000002902B0BDE8F08790F85B2001230B21D9 +:10AD3000503002F033FA00281CBF02B0BDE8F087A3 +:10AD4000E06801230B2190F85C20503002F026FAD5 +:10AD500000281CBF02B0BDE8F087E06890F84C20E6 +:10AD600090F83511012A0FD0022A10D0032A08BF0B +:10AD700004290ED01FE0000018010020F1A40100FA +:10AD800089A90100B3A90100012914D101E0022918 +:10AD900011D190F84D2090F83611012A06D0022AE0 +:10ADA00007D0032A08BF042915D004E0012902D1E5 +:10ADB00011E002290FD080F89160E06890F833111B +:10ADC00000291CBFB0F83511A0F84A1080F83251A4 +:10ADD00002B0BDE8F087002000F030F8EDE700F0A9 +:10ADE000ACBE10B50446B0F822214388B0F8241157 +:10ADF000B0F826019A4201BFA3889942E38898429D +:10AE00000FD02388A4F83C31A4F83E21A4F84011C7 +:10AE1000A4F84201012084F83801FC48C078EFF71B +:10AE200051F80121204601F073FE002084F81B0137 +:10AE300084F85C00032084F85E0010BD10B5F34C6C +:10AE4000E1680A88A1F8762181F8740191F84C0034 +:10AE5000012808BF012108D0022808BF022104D020 +:10AE600003281ABFFFDF00210321E06880F8781172 +:10AE700090F84D00012808BF012108D0022808BF22 +:10AE8000022104D003281ABFFFDF00210321E0685C +:10AE900080F87911012180F87211E078BDE8104046 +:10AEA000EFF710B82DE9F041D84C4FF002084FF001 +:10AEB0000005207910F0080F14D0607890B9E06890 +:10AEC00090F85C10162905D180F8835080F88250E4 +:10AED00080F85C5090F85D10032904BF84F800806E +:10AEE00080F85D50FEF702FDA1884FF0010611F0D9 +:10AEF000040F4FF0070719D06078B8B9E06890F8F0 +:10AF00005C20062A08BF80F81B6108D0082A08BF09 +:10AF100080F81B8103D0202A08BF80F81B7190F8AD +:10AF20005D20022A04BF267080F85D5011F0020FE8 +:10AF300000F049816078002840F045812069C078A0 +:10AF4000801E162880F03E81DFE800F00BF9646F68 +:10AF5000851EF948F955B97AF9F9F9F9E4F8FDF6D9 +:10AF6000F5F4E0680123194690F85D20503002F0B6 +:10AF700015F9002840F02781E068032180F85D1072 +:10AF800080F87E5000F0DCB8206902F0D1FD064662 +:10AF9000E06890F85C10052905D090F85B00052862 +:10AFA00018BFFFDF04D0E06890F85B0005280AD1E5 +:10AFB000E06890F8C210B14204BF80F85B5080F89E +:10AFC0007E5000F00081E06890F85C1005290CBF0D +:10AFD00080F85C50FFDF40F0F680B1E0E06890F868 +:10AFE0005C00092818BFFFDFE06880F8825080F815 +:10AFF0005C5000F0E8B8E06890F85C000D2818BFDD +:10B00000FFDFE0685FF00E0180F8836080F85C107D +:10B0100000F0D9B8E06890F85C00112818BFFFDF95 +:10B02000E068122180F88360F0E7E06890F85C0047 +:10B03000122818BFFFDF1420E16881F85C00C2E02D +:10B04000E06890F85C00122818BFFFDF1620E16866 +:10B0500081F85C00B7E0E06890F85C00192818BF40 +:10B06000FFDFE06880F8835080F8825090F8440158 +:10B07000002818BFFFDFE06890F8841041B180F825 +:10B0800084500188A0F8481180F846510C2107E04F +:10B090000188A0F8481180F8465180F84A610B21D8 +:10B0A00080F844110088F3F771FEF3F721FBE07894 +:10B0B000EEF708FFD4F80C0080F85C5083E0E068FD +:10B0C00090F81A1104290ED0E0680123082190F8A5 +:10B0D0005C20503002F062F800281CBFE06880F865 +:10B0E000825070D0E8E790F85B20012300215030B7 +:10B0F00002F054F8002808BFFFDFE06890F88610DF +:10B1000011F0020F0EBF80F85B6080F87E5080F86F +:10B110001A51D9E7E0680123002190F85B205030F4 +:10B1200002F03CF8002808BFFFDF0A20E16881F840 +:10B130005B0048E03BE024E01BE004E01FE041E06E +:10B1400080F882503FE0E06890F89000012818BF36 +:10B15000FFDFE0680123002190F85B20503002F00F +:10B160001DF8002808BFFFDF1A20E16881F85B00A6 +:10B1700029E0E06890F85C00002818BFFFDFE06875 +:10B18000DEE7E06890F89100012818BFFFDFE06873 +:10B190000123002190F85B20503001F0FFFF0028D0 +:10B1A00008BFFFDF1C20E16881F85B000BE0E0686E +:10B1B00090F85C001D2818BFFFDF1E20E16881F8B1 +:10B1C0005C0000E0FFDF207910F0100F08D06078FD +:10B1D00030B9E06890F85C10062908BF80F85C7010 +:10B1E000A07810F0080F08BFBDE8F081E0680123E7 +:10B1F000052190F85C20503001F0D0FF40B10820CC +:10B200006070E06880F84451BDE8F08118010020CA +:10B21000BDE8F041002000F003BD2DE9F84F68467D +:10B22000F8F7B8FB002808BFBDE8F88FC84C607875 +:10B23000002818BFBDE8F88FE0680123194690F890 +:10B240005D20503001F0AAFF002818BFBDE8F88F3C +:10B25000E068002590F8061129B1A0F8785080F830 +:10B260008E50022083E090F85B20012300215030B3 +:10B2700001F094FF78B1E0680123042190F85C208C +:10B28000503001F08BFF30B9E06890F87200002870 +:10B2900018BF12206BD1E06890F85B1005290FD021 +:10B2A00090F85C200126112A4DD018DC092A08BF2D +:10B2B00009205CD00CDC012A74D0052A3BD018E0B0 +:10B2C0000720FEF718FFE068A0F87A50BDE8F88F75 +:10B2D0000B2A68D00D2A08BF0B2048D009E0122A9B +:10B2E00049D0192A79D01B2A76D01D2A08BF1720E9 +:10B2F0003DD001230421503001F050FF002818BF39 +:10B30000BDE8F88FE06890F81A1100297BD090F81A +:10B310005B2001230021503001F040FF002872D053 +:10B32000E06890F81A11042904BF90F8860010F024 +:10B33000030F69D0D0E00720FEF7DDFEE068A0F83B +:10B340008050BDE8F88FF6F769FE0C2838BFBDE8DD +:10B35000F88F0821E068E830F6F761FE28B1E06870 +:10B360000421BC30F6F75BFE00B9FFDF0420FEF7D6 +:10B37000C2FEBDE8F88F90F80911012914D0022906 +:10B3800018BFBDE8F88F90F8841000291ABF80F824 +:10B390008E6002200D20FEF7AEFEE06880F80951B5 +:10B3A000BDE8F88F21E030E090F84411002918BF83 +:10B3B000BDE8F88F00F1A80300F1E001002200F5DC +:10B3C000857001F080FE0520FEF795FEE06880F8AC +:10B3D0000951BDE8F88F00E01EE00620FEF78BFE65 +:10B3E000E06880F88250BDE8F88F0C20FEF783FEFD +:10B3F000E068A0F8805090F8861041F0010180F8D4 +:10B400008610BDE8F88F67E058E01320FEF773FE62 +:10B41000E068A0F880504DE0C18E838FB0F82CA07A +:10B42000B0F82E80B0F83090478E994238BF0B4666 +:10B430008385828EB0F840108A4228BF0A46C285B2 +:10B44000B0F838C0B0F842108C4538BF614641862C +:10B45000B0F83AC0B0F83EB0DC4528BFDC46A0F8F2 +:10B4600030C0424538BF4246C285B94238BF39462E +:10B470004186534508BF424503D1CC4508BFB94278 +:10B4800014D00288A0F86021828DA0F86221028E7B +:10B49000A0F86421C28D00F59C71A0F86621408E51 +:10B4A000088681F82660E078EEF70CFD1520FEF79F +:10B4B00022FEE06880F85C50BDE8F88F0C20FEF7B3 +:10B4C0001AFEE068A0F87A5080F87E6090F8861046 +:10B4D00041F0010180F886106846F8F75BFA002811 +:10B4E00008BFBDE8F88FE0680123002190F85B20D9 +:10B4F000503001F053FE50B1E06890F890100029F0 +:10B500001EBF90F85C001B2814207FF430AFE06869 +:10B510000123002190F85B20503001F03FFE00280D +:10B5200008BFBDE8F88FE06890F89110002908BFC7 +:10B53000BDE8F88F90F85C2001230B21503001F01A +:10B540002DFE002808BF16203FF411AFBDE8F88F8C +:10B550001801002030B5F84C05462078002818BFA7 +:10B56000FFDFA57230BDF449012048727047F348EF +:10B5700010B541680278406891F85B408C4690F8BD +:10B580004C0001F15003202C1CBF1B7B202B12D040 +:10B590001C2C2DD01E2B18BF10BD002A08BF10BDBB +:10B5A0009CF84A2091F80511114011F0010F35D097 +:10B5B00003283DD03FE06AB191F81E11002908BF71 +:10B5C00010BD032818BF032932D0012818BF012954 +:10B5D00031D02BE091F8FC10002908BF10BD0328E2 +:10B5E00018BF032924D0012818BF012923D01DE04A +:10B5F0001E2BD2D0002A08BF10BD91F8351111F0D2 +:10B60000010F02D0032813D015E011F0020F08BF7C +:10B6100010BD03280CD001280DD007E011F0020F57 +:10B6200008BF10BD032803D0012804D0022010BD9C +:10B63000FFDF002010BD012010BD2DE9F047BF4FF6 +:10B640004FF0000839464FF001094E686FF00E03C5 +:10B650006FF00D0C708E96F84D10024602290CBF4B +:10B6600003EB92020CEBD20292B2F58DAA4206D8FD +:10B67000022914BF0CEBD00003EB900085B2AE4C56 +:10B680002946606BF2F70CFEDFF8B4A2E0620028F6 +:10B6900019BF84F80280A06284F80290C4F828A040 +:10B6A0003878786800F15008012000F03DFD98F8E6 +:10B6B0001000002838D008F15801A14891E80E1078 +:10B6C00000F5027989E80E10D8F86810C0F8211248 +:10B6D000D8F86C10C0F8251200F58170F7F78DFDD1 +:10B6E000387800280CBF0120002080F00101954827 +:10B6F0000176D8E91412C0E90412C4F828A0514612 +:10B70000A581A0F58372F7F766F996F84D00012838 +:10B7100008BF002104D002281ABFFFDF0021012149 +:10B720000120F7F766F904E0A06AF7F766FDF7F77E +:10B7300083F901210020F7F7C9FE02202070BDE83F +:10B74000F0872DE9F04FDFF8F48183B04146A1F195 +:10B7500014004C680090012794F8550004F150053E +:10B76000A1F1380670B301287DD002287FD00328CC +:10B7700018BFFFDF76D0706A0823017821F0080136 +:10B780000170AA7903EAC202114321F00401017099 +:10B79000EA79042303EA8202114321F010010170C7 +:10B7A00095F805A0306BF2F74DFD8146F8F739F9B1 +:10B7B000BAF1020F73D0BAF1010F74D0BAF1030FCE +:10B7C00075D079E0B4F830B0FFF7D1FE6FF00E0914 +:10B7D0006FF00D0A022814BF0AEBDB0009EB9B0097 +:10B7E00081B2A08D81420AD8B4F830B0FFF7BFFE15 +:10B7F000022814BF0AEBDB0009EB9B0080B2ADF816 +:10B800000800A4F848000098F8F7EAF838B1716A1F +:10B81000F770B2694FF48060904703201EE001AAE0 +:10B8200002A9306BF2F7F1FB706210B195F833109A +:10B8300021B10098F8F7A8F86F719CE79DF8041003 +:10B8400029B9002101808170012102F01DF8BDF8A5 +:10B850000800C1B2706A02F0E9F9022068718AE753 +:10B8600001E004E011E00098F8F78EF883E7B4F8FF +:10B870004800ADF8000001AA6946306BF2F7C5FB3D +:10B880007062002808BFFFDF75E70098F8F7A8F896 +:10B89000002808BFFFDF6EE701E004E007E030EAC0 +:10B8A000090009D106E030EA090005D102E0B9F14A +:10B8B000000F01D0012100E00021706A027842EA05 +:10B8C00001110170E97B00291CBF697901293BD076 +:10B8D00005F158011A4891E80E1000F5027989E83F +:10B8E0000E10A96EC0F82112E96EC0F8251200F5FD +:10B8F0008170F7F782FC98F8000000280CBF012146 +:10B90000002110480176D5E91212C0E90412A0F511 +:10B910008371726AF7F75FF894F84C00012808BF4A +:10B92000002104D002281ABFFFDF002101210020DE +:10B93000F7F75FF80CE000003001002068010020FC +:10B94000280E002030100020F7F757FCF7F774F8A6 +:10B9500098F8000028B1706A007810F0100F05D038 +:10B960000CE001210846F7F7B1FD0AE0FE48007837 +:10B9700010F0100F04BF7079002802D0F078002872 +:10B98000EFD0B079C8B9B77194F84D00012808BF5D +:10B99000002504D002281ABFFFDF0025012594F8F6 +:10B9A0004C00012808BF002004D002281ABFFFDF86 +:10B9B000002001202946F7F772FC706A0188318265 +:10B9C0008078B074377003B0BDE8F08F2DE9F04790 +:10B9D000E64C8146DDF8208020781E4617460D464D +:10B9E00028B9002F1CBF002EB8F1000F00D1FFDFD7 +:10B9F000C4F82080C4E90E95C4E906760020607280 +:10BA0000207260712071A071E071D94EE070E08108 +:10BA1000307805F150092888F3F7CAF9206328889F +:10BA2000F3F7B4F96063F7F7DDFBF7F70CF9F7F715 +:10BA30007CFC05F11100F7F7BEFB05F10D00F7F7EF +:10BA4000E8F9307800280CBF03200120F7F7C7FB86 +:10BA500099F81800F7F7E5F9F7F7BBFB30786FF0C6 +:10BA60000E076FF00D08F8B1698E95F84D0099F842 +:10BA70001020EC8D02280B460CBF07EB930308EB5C +:10BA8000D3039BB2A34206D8022814BF08EBD1010E +:10BA900007EB91018CB2002A1CBF211D8CB201283A +:10BAA00041D0022841D023E099F80F90B5F82CA09E +:10BAB0002C8EFFF75CFD022814BF08EBD40107EBC6 +:10BAC000940189B2514588BF544606D802280CBF5C +:10BAD00007EB940008EBD40084B2B9F1000F1CBF4F +:10BAE000201D84B295F84C0001281CD002281CD0DF +:10BAF000FFDF00252846F7F799F829462046F7F793 +:10BB000076F830784FF0010188B10120F7F73FFA5D +:10BB10007068D0F8D800F7F773FBFFF78EFDBDE82B +:10BB2000F047F7F767BB0025E4E70125E2E70020CF +:10BB3000F7F72DFAFFF705FEF1E770B58C488B4D4E +:10BB400005F1380100784C68002834D094F84C0096 +:10BB5000012808BF002604D002281ABFFFDF0026F4 +:10BB6000012694F84D00012808BF002104D00228C6 +:10BB70001ABFFFDF0021012132469620F7F7F2FBC2 +:10BB80002878022818BFFFDF94F84C50F7F72AFBFB +:10BB900094F82800012808BFF7F775FC012D08BFAD +:10BBA000002004D0022D1ABFFFDF00200120BDE8D5 +:10BBB0007040F7F73BB894F84D00012808BF002605 +:10BBC00004D002281ABFFFDF0026012694F84C009B +:10BBD000012808BF002104D002281ABFFFDF00217E +:10BBE000012132469620F7F703FC2878012818BF78 +:10BBF000FFDF94F84D50C9E75C4810B50078022883 +:10BC000018BFFFDFBDE8104000F0EABA574880795E +:10BC1000704756484079704754490120C8717047B1 +:10BC20002DE9F04706005248504D4FF0010740689B +:10BC30004FF0000800F15004A86A90F8019018BF76 +:10BC4000012E03D1696B03F023F968706878A0B105 +:10BC5000012830D0022848D003281CBFFFDFBDE8F0 +:10BC6000F087012E08BFBDE8F087686BF2F729FD69 +:10BC7000A87ABDE8F047EEF725B9012E08D00122D9 +:10BC80004946686BF2F76AFB022E08BFBDE8F087F1 +:10BC9000D4E91402411C42F10000C4E91410E07917 +:10BCA000012802D184F8078000E0E771A87ABDE896 +:10BCB000F047EEF707B9012E08D000224946686B1D +:10BCC000F2F74CFB022E08BFBDE8F087D4E914015F +:10BCD000401C41F10001C4E91401E07901280CBFC6 +:10BCE00084F80780E771BDE8F087012E06D0686B05 +:10BCF000F2F7E7FC022E08BFBDE8F087D4E9140193 +:10BD0000401C41F10001C4E91401E0790128CCD1C3 +:10BD1000C8E72DE9F041164F4FF000083846A7F16B +:10BD200038044068012600F150052078012818BF2A +:10BD3000FFDFA87850B185F80280E670A26941461D +:10BD4000042090473878002818BF2E71606A0321BC +:10BD5000007831EA000004BFE87800280CD1EE70CA +:10BD6000616A0220E67005E04301002030010020F6 +:10BD700068010020A26990470121002000F053FAD9 +:10BD8000002808BF7C6803D0BDE8F04100F028BA65 +:10BD9000FFF753FC94F84C00012808BF002004D0A2 +:10BDA00002281ABFFFDF00200120F6F73FFF94F8BA +:10BDB0004C00012808BF002504D002281ABFFFDF6D +:10BDC0000025012594F84D00012808BF002104D06A +:10BDD00002281ABFFFDF002101212A46BDE8F041F9 +:10BDE0009620F7F7BFBA2DE9F84FFB4E8346304651 +:10BDF000A6F138054068317800F1500A002728780C +:10BE00004FF00108B946022818BFFFDFE88940F467 +:10BE10000070E881002000F087F99AF81000BBF16B +:10BE2000000F00F0ED80F6F72DFEF6F71BFE90B93F +:10BE30009AF8100078B1A86A417861B100789AF850 +:10BE40000710C0F3C000884205D185F80480BDE822 +:10BE5000F84F00F0C5B9A86A0188A5F813108078DA +:10BE60006875E88940F02000E8816F71307870686B +:10BE700050300090746894F82800012818D1F7F722 +:10BE8000F8FA2046009901F05EF988B13078002870 +:10BE900070680CBF00F5887000F5B570218841808E +:10BEA0000099097A017180F80080A87AEEF70AF803 +:10BEB000A86A9AF806100078C0F38000884233D050 +:10BEC0003078706800F1500490F8550040B30228B3 +:10BED00044D06771307840B12079394628B121715A +:10BEE00085F80380AA6910209047E07890B1E77048 +:10BEF000F7F785FD002808BFFFDF082085F80380DD +:10BF0000AA6900219047D4E91202411C42F10000C5 +:10BF1000C4E91210A07901280CBFA77184F806802B +:10BF2000E88940F48070E881A86A9AF807300178BF +:10BF3000C1F3C0029A4250D13278726801F0030115 +:10BF400002F15004012918BF022933D003291CBF74 +:10BF5000287A40F0040012D028723EE0286BF2F7F5 +:10BF60008EF8002808BFFFDFD4E91210491C40F109 +:10BF70000000C4E91210A87AEDF7A4FFA9E701F0C8 +:10BF8000A4FC98B184F80280E989404641F400613C +:10BF9000E981A96A85F80380AA699047E0790128B8 +:10BFA00001D1E77119E084F8078016E0287A40F0A3 +:10BFB0001000D1E74078F8B1E98941F40061E981E6 +:10BFC000A97851B9FB28F1D8687A002808BFC14682 +:10BFD00003D08020AA69002190475946012000F033 +:10BFE00022F960B39AF81000002818BFBBF1000FC7 +:10BFF0001BD0A87868B118E0E0790128D3D1D0E748 +:10C00000002818BF03F01EFCE88940F04000E881DA +:10C01000E3E7A96AAA894878904288BF1046C21C03 +:10C02000E86A03F05FFAE86AA862B9F1000F1CBF82 +:10C030000020FFF7F5FDBDE8F84F00F0D1B83078EB +:10C040007468B9F1000F1CBF0120FFF7E9FDFFF78D +:10C0500078FB9AF81000002818BFBBF1000F0DD034 +:10C06000A87858B9A96AAA894878904288BF10462A +:10C07000C21CE86A03F036FAE86AA862B9F1000F58 +:10C080001CBF0220FFF7CCFD94F84D00012808BF2B +:10C09000002004D002281ABFFFDF00200120F6F79D +:10C0A000C5FD94F84D00012808BF002504D00228E2 +:10C0B0001ABFFFDF0025012594F84C00012808BFB6 +:10C0C000002104D002281ABFFFDF002101212A46E7 +:10C0D000BDE8F84F9620F7F78BB970B505463E4896 +:10C0E0000C460178406890F84C2071B1012A08BFD5 +:10C0F000002204D0022A1ABFFFDF002201222146BB +:10C100002846BDE87040FBF73CBB012A08BF00226F +:10C1100004D0022A1ABFFFDF00220122214628464E +:10C12000BDE87040FAF70CBB2DE9F0472A496FF0E3 +:10C130000E06771C4D680A7805F15001F0B10A7CB3 +:10C14000688E95F84D10EC8D022903460CBF06EB66 +:10C15000930307EBD3039BB2A34206D8022914BF73 +:10C1600007EBD00006EB900084B2002A1CBF201D14 +:10C1700084B201292DD0022930D023E091F80F801C +:10C18000B5F82C902C8EFFF7F2F9022814BF07EBBC +:10C19000D40106EB940189B2494588BF4C4606D8C4 +:10C1A00002280CBF06EB940007EBD40084B2B8F170 +:10C1B000000F1CBF201D84B295F84C00012808D048 +:10C1C00002280BD0FFDF00212046BDE8F047F6F73C +:10C1D0000EBD0021F8E70000680100200121F3E70F +:10C1E00070B5314900254C68F7F715F9F7F7AEF847 +:10C1F000F6F782FFF6F7E5FFF6F71EFCF7F7A2F871 +:10C20000F6F7F8FF94F82800012808BFF7F731F98E +:10C21000264C0021A269E0899047226A217A207980 +:10C220009047257070BD70B5204C0546002908BFA9 +:10C23000012D05D16079401CC0B26071012830D851 +:10C24000E1692846884700282BD0E179184839B1A0 +:10C25000012D01BF41780029017811F0100F20D085 +:10C26000217AF1B910490978002918BF002102D0BC +:10C27000294304D013E0012D18BF0121F8D10D4945 +:10C28000097811F0100F04BF007810F0100F08D0DB +:10C29000E07830B9A07810B111F0100F01D0002073 +:10C2A00070BD012070BD0000680100203001002039 +:10C2B000430100204001002010B540F2BB11F748B7 +:10C2C00003F087F9F648002141704FF46171418015 +:10C2D00010BD2DE9F0410F46064600F0D6FAEF4CAE +:10C2E000102817D004EBC00191F8421111F0010F92 +:10C2F0001CBF0120BDE8F081617808291FD2617858 +:10C3000004EBC000491C6170012180F8421108460D +:10C31000BDE8F0816178082911D22578681C207069 +:10C3200004EBC5083868C8F83C01B888A8F8400193 +:10C33000102D28BFFFDF88F83B612846DFE700208B +:10C34000BDE8F081D5480178491E4BB2002BB8BF3B +:10C35000704770B45FF0000500EBC30191F8421123 +:10C3600011F0010F3BD04278D9B2521E427000EB5F +:10C37000C10282F8425190F802C00022BCF1000FC5 +:10C380000BD9841894F803618E4202D1102A26D169 +:10C3900003E0521CD2B29445F3D80278521ED2B2B6 +:10C3A00002708A421BD000EBC20200EBC10CD2F833 +:10C3B0003B41CCF83B41D2F83F21CCF83F21847877 +:10C3C00090F800C00022002C09D9861896F8036165 +:10C3D00066450AD1102A1CBF024482F80311591E77 +:10C3E0004BB2002BB8DA70BC7047521CD2B29442E8 +:10C3F000EBD8F4E72DE9F0471E46174688468146FC +:10C4000000F043FAA54C0546102831D0A078002151 +:10C4100000280ED9621892F80331AB4205D11029D9 +:10C420001CBF1220BDE8F08703E0491CC9B2884256 +:10C43000F0D8082832D2102D1DD000BF94F8028009 +:10C44000102208F10100A07004EB081909F10300A3 +:10C45000394600F027FE09F183001022314600F032 +:10C4600021FE04EB080080F803510020BDE8F087AE +:10C47000A078082812D22578681C207004EBC50A21 +:10C48000D8F80000CAF83C01B8F80400AAF8400146 +:10C49000102D28BFFFDF8AF83B91CFE70720BDE8CA +:10C4A000F08770B47D488178491E4BB2002BBCBF29 +:10C4B00070BC704703F0FF0C8178491ECAB28270CD +:10C4C00050FA83F191F8031194453AD000EB02142D +:10C4D00000EB0C15D4F80360C5F80360D4F80760CE +:10C4E000C5F80760D4F80B60C5F80B60D4F80F608E +:10C4F000C5F80F60D4F88360C5F88360D4F887600E +:10C50000C5F88760D4F88B60C5F88B60D4F88F408D +:10C51000C5F88F40841800EB0C0502EB420294F83A +:10C5200003410CEB4C0C00EB420285F8034100EB9D +:10C530004C0CD2F80B41CCF80B41B2F80F21ACF8FF +:10C540000F2100EBC10292F8422112F0010F35D108 +:10C5500090F802C000220C46BCF1000F0BD98518E0 +:10C5600095F803518D4202D1102A27D103E0521CC5 +:10C57000D2B29445F3D80178491EC9B20170A142E4 +:10C580001CD000EBC10100EBC402D1F83BC1C2F8E2 +:10C590003BC1D1F83F11C2F83F1190F802C00278B8 +:10C5A0000021BCF1000F09D9451895F803519542B7 +:10C5B0000BD110291CBF014481F80341591E4BB215 +:10C5C000002BBFF677AF70BC7047491CC9B28C45D1 +:10C5D000EAD8F3E7324948707047314840787047ED +:10C5E00038B14AF2B811884203D82D494880012059 +:10C5F0007047002070472A484088704710B500F007 +:10C6000044F9102814D0254A0146002092F802C0AF +:10C61000BCF1000F0CD9131893F803318B4203D1EE +:10C62000102818BF10BD03E0401CC0B28445F2D8EA +:10C63000082010BD19498A78824286BF01EB00109C +:10C6400083300020704715498A78824286BF01EB0B +:10C650000010C01C00207047104B93F802C08445A6 +:10C660009CBF00207047184490F8030103EBC00002 +:10C6700090F83B310B70D0F83C111160B0F84001DC +:10C68000908001207047054A114491F80321044924 +:10C690000A7002684A60808808817047581000203C +:10C6A0007001002010B5F6F745F9002804BFFF20FF +:10C6B00010BDBDE81040F6F763B9F1498A788242AF +:10C6C0009CBF00207047084490F8030101EBC000B4 +:10C6D00090F8420100F00100704770B5E84E002468 +:10C6E00025463078002814D906EBC50090F8421191 +:10C6F00011F0010F08D090F83B2100F59E71204603 +:10C70000631CDCB2F6F71EFB681CC5B23078A84289 +:10C71000EAD87078A04218BFFFDF70BD70B5D84C62 +:10C7200000263546A078002812D96019731C90F8AD +:10C73000030104EBC00000F59E7190F83B213046E8 +:10C74000DEB2F6F7FFFA681CC5B2A078A842ECD8B2 +:10C75000C0B2B04218BFFFDF70BD10B5F6F751FB95 +:10C7600058B30024F6F751FBC54A00211378002B7B +:10C7700023D900BF02EBC10C9CF842C11CF0010F91 +:10C7800017D084421CBF04F1010C0CF0FF0410D13F +:10C7900093780020002B0AD902EB000C9CF803C10F +:10C7A0008C4508BF10BD401CC0B28342F4D8102095 +:10C7B00010BD491CC9B28B42DCD8082010BD10B591 +:10C7C000F6F71FFB002804BF082010BDBDE810408D +:10C7D000F6F71BBBAB4910B5497841B1A84B997826 +:10C7E00029B1C21CD81CF6F742F8012010BD002068 +:10C7F00010BDA34A01EB410102EB41010268C1F8FF +:10C800000B218088A1F80F01704770B59C4D002462 +:10C81000A878002898BF70BDC0B2A04212D905EB1D +:10C82000041010F183060DD01021304600F017FCE3 +:10C8300040B904EB440005EB400000F20B11304618 +:10C84000F7F76DF9601CC4B2A878A042E4D870BDB7 +:10C85000014610228C4800F025BC8B48704770B50B +:10C86000874D0446A878A04206D905EB0410102194 +:10C87000833000F0F4FB08B1002070BD04EB4400ED +:10C8800005EB400000F20B1070BD2DE9F0417C4D2E +:10C890000646002428780F46002811D905EBC4006D +:10C8A00090F83B11B14206D10622394600F59E7040 +:10C8B00002F0ECFD38B1601CC4B22878A042EDD87B +:10C8C0001020BDE8F0812046BDE8F0816C4910B42D +:10C8D0004A7801EBC003521E4A70002283F84221BD +:10C8E00091F802C0BCF1000F0DD98B1893F80341E9 +:10C8F000844204D1102A1CBF10BC704703E0521CB4 +:10C90000D2B29445F1D80A78521ED2B20A7082424D +:10C9100004BF10BC704701EBC00301EBC202D2F8A8 +:10C920003BC1C3F83BC1D2F83F21C3F83F218C780B +:10C9300091F800C00022002C9CBF10BC70478B18DF +:10C9400093F80331634506D1102A1CBF114481F8C6 +:10C95000030110BC7047521CD2B29442EFD810BCF5 +:10C96000704770B446490D188A78521ED3B28B7046 +:10C9700095F80321984239D001EB001C01EB031418 +:10C9800000EB4000D4F80360CCF80360D4F80760F3 +:10C99000CCF80760D4F80B60CCF80B60D4F80F60CB +:10C9A000CCF80F60D4F88360CCF88360D4F887604B +:10C9B000CCF88760D4F88B60CCF88B60D4F88F40CB +:10C9C000CCF88F4001EB030C03EB43039CF803C14D +:10C9D00001EB430385F803C101EB4000D3F80BC121 +:10C9E000C0F80BC1B3F80F31A0F80F3101EBC20052 +:10C9F00090F8420110F0010F1CBF70BC704700207E +:10CA00008C78002C0DD90B1893F803C1944504D1F0 +:10CA100010281CBF70BC704703E0401CC0B28442A9 +:10CA2000F1D80878401EC0B20870904204BF70BCB4 +:10CA3000704701EBC20301EBC000D0F83BC1C3F863 +:10CA40003BC1D0F83F01C3F83F018C780B78002040 +:10CA5000002C9CBF70BC704701EB000C9CF803C11C +:10CA60009C4506D110281CBF084480F8032170BCE7 +:10CA70007047401CC0B28442EED870BC70470000C2 +:10CA800058100020700100201312002010B50A7BFE +:10CA900002F01F020A73002282758B181B7A03F0C2 +:10CAA000010C5B0803F00104A4445B0803F00104DB +:10CAB000A4445B0803F00104A4445B0803F00104F0 +:10CAC00064444FEA530C0CF0010323444FEA5C0C1E +:10CAD0000CF00104234403EB5C0300EB020C521C3A +:10CAE0008CF8113090F816C0D2B263448375052AD1 +:10CAF000D3D3D8B2252888BFFFDF10BD002383839E +:10CB0000028401EBC202521EB2FBF1F1C1837047F5 +:10CB10000A4630B40021032A0DD04FF4FA4C002A03 +:10CB20007DD0012A7CD0022A1CBF30BC7047014650 +:10CB300030BC5030AAE7A0F8501080F8561080F8AA +:10CB4000571080F85B1080F85C1080F85D1080F85A +:10CB50005E1080F8521080F8531080F8541080F85E +:10CB6000551080F86910A0F86C1080F87210A0F8C9 +:10CB70007410A0F87A1080F87E10A0F8801080F869 +:10CB8000821080F8671080F8681080F85F1080F8D5 +:10CB9000601080F8831080F8841080F88610F522E9 +:10CBA00080F88C20012280F88D20A0F8781080F881 +:10CBB0008F10A0F8C810A0F8CA10A0F8CC10A0F8E8 +:10CBC000CE10A0F8D010A0F8D21080F8D510A0F8A0 +:10CBD000DE1080F8DC10A0F8F010A0F8F21080F859 +:10CBE0002810018480F84C2080F84D204FF44862D2 +:10CBF00042801B228286C2864FF4A4734387038738 +:10CC00008285C28543860386A0F84020A0F8423082 +:10CC10008287C387A0F84420A0F8462001E012E0F4 +:10CC20004FE0A0F8482080F8901080F8281180F894 +:10CC3000911080F8321180F8001180F8061180F808 +:10CC4000091130BC7047A0F8DE1080F8D610428879 +:10CC5000FE4B1344B3FBF2F3A0F86E304BF6803377 +:10CC6000A0F87030C488A0F87410B0F8781000F103 +:10CC70005003514391FBF2F1A0F87810E100B1FBB1 +:10CC8000F2F1491C89B201FB02F4A0F87610B4F568 +:10CC9000C84FC4BF491ED984BCFBF2F1491C998519 +:10CCA00002F5802101F5EE31A1F1010CBCFBF2F19E +:10CCB000D983B3F81CC00CFB02F1B1FBF2F19983EC +:10CCC00035E7A0F8DE1000F150024488B0F82231B8 +:10CCD000B0F826019184118DC0006143B0FBF3F0E0 +:10CCE00091FBF3F1401C118580B200FB03F1D0846D +:10CCF000B1F5C84FC4BF401ED084BCFBF3F0401C4C +:10CD00009085108C03EBC000401EB0FBF3F0D08385 +:10CD1000908B6043B0FBF3F0908330BC70470A46C1 +:10CD200030B40021032A0DD04FF4FA4C002A7CD0F5 +:10CD3000012A79D0022A1CBF30BC7047014630BCA2 +:10CD40005030A3E6A0F8501080F8561080F8571025 +:10CD500080F85B1080F85C1080F85D1080F85E1041 +:10CD600080F8521080F8531080F8541080F8551055 +:10CD700080F86910A0F86C1080F87210A0F8741098 +:10CD8000A0F87A1080F87E10A0F8801080F8821049 +:10CD900080F8671080F8681080F85F1080F86010E5 +:10CDA00080F8831080F8841080F88610F52280F8CF +:10CDB0008C20012280F88D20A0F8781080F88F1048 +:10CDC000A0F8D01080F8D21080F8C810C0F8CC10AD +:10CDD00080F8281080F84C2080F84D201B22828695 +:10CDE000C2864FF4A473438703878285C285438636 +:10CDF0000386A0F84020A0F842308287C387A0F8BD +:10CE00004420A0F84620A0F8482080F8901080F830 +:10CE1000001180F8911080F80A1180F8E81080F86D +:10CE2000F81030BC704700E039E04288874B13446B +:10CE3000B3FBF2F3A0F86E304BF68033A0F87030FD +:10CE4000C488A0F87410B0F8781000F15003514372 +:10CE500091FBF2F1A0F87810E100B1FBF2F1491C6E +:10CE600089B201FB02F4A0F87610B4F5C84FC4BF34 +:10CE7000491ED984BCFBF2F1491C998502F5802139 +:10CE800001F5EE31A1F1010CBCFBF2F1D983B3F84D +:10CE90001CC00CFB02F1B1FBF2F199834EE7D0F814 +:10CEA000F04000F1500243886089E4899184118D3B +:10CEB000594391FBF0F11185E100B1FBF0F1491C00 +:10CEC00089B201FB00F4D184B4F5C84FC4BF491E38 +:10CED000D184BCFBF0F1491C9185118C00EBC101A0 +:10CEE000491EB1FBF0F1D183918B5943B1FBF0F0B6 +:10CEF000908330BC7047837D0BB1252B01D9122064 +:10CF00007047002A04BF0020704770B490F817C023 +:10CF10000C7E4F4D04FB02C22C464FF0000CE2FB8E +:10CF2000054C4FEA1C1C6FF024040CFB0422D2B207 +:10CF300001EBD20CC27502F007059CF808C0012471 +:10CF400004FA05F51CEA050F18BF02762CD1B2FBD6 +:10CF5000F3FC03FB1C22521CD2B24FF0000C00BFAA +:10CF600000EB0C035B7C93423CBFD21AD2B20ED3CF +:10CF700001EB0C0500232D7A04FA03F635421CBFA1 +:10CF8000521ED2B26AB15B1CDBB2082BF4D30CF197 +:10CF9000010303F0FF0CBCF1050FE1D370BC1F20AF +:10CFA000704703EBCC01017670BC0020704730B5B0 +:10CFB0000D460446072988BFFFDFE07805F007012A +:10CFC00000F05000084340F08800E070A07800F0C6 +:10CFD000A70040F01800A070607800F05E0040F0FC +:10CFE00020006070207800F0BC0040F0400020700D +:10CFF00030BD017931F01F0113BF0020002211461E +:10D00000704710B4435C491C03F0010C5B0803F04B +:10D010000104A4445B0803F00104A4445B0803F08A +:10D020000104A4445B0803F00104A4445B0803F07A +:10D0300001045B08A44403F00104A4440CEB530373 +:10D040001A44D2B20529DDDB012A03E0FFDB05002B +:10D0500053E4B36E8CBF0120002010BC704730B485 +:10D060000022A1F1010CBCF1000F11DD431E11F0F3 +:10D07000010F08BF13F8012F5C785FEA6C0C07D032 +:10D0800013F8025F22435C782A43BCF1010CF7D10C +:10D09000491E5CBF405C0243002A0CBF01200020F7 +:10D0A00030BC7047130008BF704710B401EB030C8D +:10D0B000D41A1CF801CC5B1E00F804C013F0FF0367 +:10D0C000F4D110BC7047F0B58DB0164610251C4643 +:10D0D0006A46AC4600EB0C03A5EB0C0713F8013CC9 +:10D0E000D355ACF1010313F0FF0CF3D11546103208 +:10D0F000102084460B18ACEB000713F8013C401ECF +:10D10000D35510F0FF00F5D1284601F055FA86B14D +:10D11000102005F1200201461318A1EB000C13F8B2 +:10D12000013C401E04F80C3010F0FF00F4D10DB0AB +:10D13000F0BD08982060099860600A98A0600B987C +:10D14000E0600DB0F0BD38B505460C466846F6F710 +:10D15000A5F9002808BF38BD9DF90020227294F976 +:10D1600009100020511A48BF494295F829308B42D6 +:10D17000C8BF38BDFF2B08BF38BDA17A491CC9B252 +:10D18000A17295F82A30994203D8617A7F2918BF95 +:10D1900038BD62720020A072012038BD0C294FD228 +:10D1A000DFE801F006090E13161B323C3F4C4247E4 +:10D1B000002A47D044E0022A18BF032A42D03FE0A9 +:10D1C000072A18BF062A3DD03AE0082A3AD037E0AD +:10D1D000A2F10C000D2835D932E023B1A2F10D00E7 +:10D1E0000C282FD92CE00F2A18BF0E2A2AD090F82D +:10D1F000340020B10F2A23D3182A23D920E0132A80 +:10D200001ED3182A1ED91BE0A2F10C01032919D93B +:10D2100090F83400A0B1192A14D911E0092A11D0CC +:10D220000EE0012A0ED00BE01A2A18BF1B2A09D0E3 +:10D2300006E0A2F11C00042804D901E00A2A01D06A +:10D2400000207047012070472DE9F04187680D46A6 +:10D2500004462046F3F766FB90B1CDB13846A1688D +:10D26000F4F7FFFBA0B1401EB0FBF5F0461C06FB37 +:10D2700005F13846F3F7E5FAA0603046BDE8F081E5 +:10D28000F3F7C6FA40F26171F3F7DBFAA060E0E76A +:10D290000020BDE8F081904228BF704770B5044679 +:10D2A000101B642838BF642025188D4205D8F4F778 +:10D2B00003FC00281CBF284670BD204670BD91F8B5 +:10D2C0004C308A8D022B07BF92003C32D200703264 +:10D2D00092B20B8E934238BF1A46CB8D91F84DC057 +:10D2E000BCF1020F07BF9B003C33DB0070339BB2E5 +:10D2F000498E994238BF0B46012100280CBF0120FE +:10D30000002003FB01219831002818BF04200844A5 +:10D310007047F0B4B0F844C0BCF1FB0F28BF4FF029 +:10D32000FB0C90F84C40022C07BF4FEA8C0C0CF120 +:10D330003C0C4FEACC0C0CF1700C1FFA8CF6B0F8D8 +:10D340004650FB2D28BFFB2590F84DC0BCF1020FC5 +:10D3500007BFA8003C30E800703085B20020022CE6 +:10D360000CBF3C247024BCF1020F0CBF4FF03C0CEE +:10D370004FF0700C914234BF012700270F44FFB2D9 +:10D380008A4234BF012100211144C9B28F4234BF07 +:10D390000A463A46002A04BFF0BC704706FB07F075 +:10D3A00005FB01008F4205D93944C1EB42011CFB4A +:10D3B000010005E004D23944C1EB420114FB010035 +:10D3C0004FF04D0112FB01F100EB8100A0F19C0038 +:10D3D000002B14BF042100210844F0BC704730B575 +:10D3E0000C46054601460020FFF769FF698840F2B8 +:10D3F00071225143694A844202EB410134BF024623 +:10D4000022468A4228BF084602D2844228BF2046CC +:10D41000686230BD70B50C460546014616460120CF +:10D42000FFF74DFF698840F271225143C6EB41017D +:10D43000A1F22131844234BF024622468A4228BFEB +:10D44000084602D2844228BF2046686270BDF8B503 +:10D4500005460E46084600F0BDFB0446304600F087 +:10D46000BDFB014610F0010F18BF012008D111F0DB +:10D47000020F18BF022003D111F0040018BF0320CF +:10D480008DF8000014F0010F18BF012208D114F02C +:10D49000020F18BF022203D114F0040218BF0322A6 +:10D4A0008DF8012011F0030F08BF00208DF8000057 +:10D4B00014F0030F08BF00228DF8012095F84C10DE +:10D4C000884208BF00208DF8000095F84D00824288 +:10D4D00008BF00228DF80120BDF80000F8BD01282A +:10D4E0001CBF02280020704718B4CBB2C1F3072C30 +:10D4F000C1B2C0F30720012B07D0022B09D0042BA7 +:10D5000008BFBCF1040F24D006E0BCF1010F03D129 +:10D510001FE0BCF1020F1CD0012906D0022907D060 +:10D52000042908BF042814D004E0012802D110E027 +:10D5300002280ED001EA0C0161F3070210EA030091 +:10D5400060F30F22D0B210F0020F18BF02200BD1EF +:10D5500006E0084003EA0C01084060F30702EFE729 +:10D5600010F0010018BF01208DF80000C2F3072061 +:10D5700010F0020F18BF022003D110F0010018BFF5 +:10D5800001208DF80100BDF8000018BC7047072885 +:10D5900016BF08280120002070470000F1FCFFFFA3 +:10D5A000282102F016B830B50546007801F00F02C8 +:10D5B00020F00F001043287007290BD2DFE801F09C +:10D5C0000406040604080400062405E00C2403E015 +:10D5D000222401E00024FFDF687820F03F00204390 +:10D5E000687030BD007800F00F0070470A68C0F81E +:10D5F00003208988A0F807107047D0F803200A603C +:10D60000B0F80700888070470A68C0F80920898848 +:10D61000A0F80D107047D0F809200A60B0F80D008E +:10D62000888070470278402322F0400203EA81118B +:10D630001143017070470078C0F380107047027882 +:10D64000802322F0800203EAC11111430170704768 +:10D650000078C0097047D0F80320C1F80920B0F85D +:10D660000720A1F80D200A7822F080020A700078C5 +:10D67000800942EAC0100870704770B515460E4622 +:10D6800004461F2A88BFFFDF2A46314604F10900FD +:10D6900001F028FF6078A91D20F03F0001F03F0154 +:10D6A0000843607070BD70B5054640780E4600F0C6 +:10D6B0003F04062C38BFFFDFA01FC4B21F2C88BF59 +:10D6C0001F24224605F10901304601F00BFF2046D8 +:10D6D00070BD70B515460E4604461F2A88BFFFDF91 +:10D6E0002A46314604F1090001F0FCFE6078A91DCC +:10D6F00020F03F0001F03F010843607070BD70B53D +:10D70000054640780E4600F03F04062C38BFFFDF88 +:10D71000A01FC4B21F2C88BFFFDF224605F10901FC +:10D72000304601F0DFFE204670BD0968C0F80F10DA +:10D7300070470A88A0F813208978417570474176B0 +:10D74000090A81767047C176090A017770474177E7 +:10D75000090A81777047C175090A0176704781759A +:10D76000704790F8242001F01F0122F01F0211439E +:10D7700080F82410704790F82420E02322F0E00283 +:10D7800003EA4111114380F8241070471F3002F062 +:10D7900054B84178007801F03F0110F00F0006D036 +:10D7A000012808D0022809D006280BD00FE0881FD6 +:10D7B0001F280AD90BE00C2909D106E0881F1F2871 +:10D7C00003D904E0881F1F2801D8012070470020DA +:10D7D00070474178007801F03F0100F00F00042805 +:10D7E00005D1062903D325299CBF012070470020BD +:10D7F000704710B4017801F00F01032922D00529E8 +:10D8000025D14478B0F81910B0F81BC0B0F8173023 +:10D81000827D04F03F04222C19D1062917D3B1F5DB +:10D82000486F98BFBCF5FA7F11D282B1082A98BF21 +:10D830008A420CD28B429CBFB0F81D00B0F5486FF5 +:10D8400005D807E0407800F03F000C2802D010BC5B +:10D850000020704710BC01207047222101F0B9BEA2 +:10D8600000B5027801F0030322F003021A430270AC +:10D8700000224270012914BF022900BD032912BFF2 +:10D88000FFDF0121417000BD01F0030300B5027804 +:10D8900022F003021A43027000224270012914BFD1 +:10D8A000022900BD032912BFFFDF0121417000BD25 +:10D8B000007800F0030070470278102322F0100275 +:10D8C00003EA01111143017070474178F9B1C07842 +:10D8D000192850D2DFE800F00D101316191C1F2272 +:10D8E00025282B2E31344F4F4F4C373A3D4043467D +:10D8F00049000C2941D042E008293ED03FE00229EE +:10D900003BD03CE0172938D039E00D2935D036E03E +:10D91000012932D033E001292FD030E002292CD068 +:10D920002DE0092929D02AE0092926D027E001295C +:10D9300023D024E0012920D021E006291DD01EE0BB +:10D9400002291AD01BE0012917D018E0012914D0B0 +:10D9500015E0092911D012E009290ED00FE00329A2 +:10D960000BD00CE0032908D009E0052905D006E01A +:10D97000032902D003E0FB2901D8012070470020D1 +:10D98000704730B50546C170192922D2DFE801F091 +:10D990000D0F111315171711191917171B11212125 +:10D9A000211D171719191D1D1F000C2413E0082431 +:10D9B00011E002240FE017240DE00D240BE00124F8 +:10D9C00009E0092407E0062405E0032403E0052418 +:10D9D00001E00024FFDF6C7030BDC0787047C1717A +:10D9E000090A01727047B0F8070070474172090ACE +:10D9F00081727047B0F809007047C172090A01735B +:10DA00007047B0F80B0070474171090A8171704787 +:10DA1000B0F8050070470171704700797047417395 +:10DA2000090A81737047B0F80D00704730B4B0F840 +:10DA30000720824DB0F809C0B0F805300179941F75 +:10DA40002D1998BFBCF5FA7F0ED269B1082998BF8D +:10DA5000914209D293429FBFB0F80B00B0F5486FD6 +:10DA6000012030BC98BF7047002030BC7047001DBB +:10DA700001F0E3BE021D0846114601F0DEBE417210 +:10DA8000090A81727047B0F8090070470171704748 +:10DA9000007970470A68426049688160704742684F +:10DAA0000A60806848607047098881817047808972 +:10DAB000088070470A68C0F80E204968C0F8121044 +:10DAC0007047D0F80E200A60D0F812004860704706 +:10DAD0000968C0F816107047D0F816000860704743 +:10DAE0000A68426049688160704742680A608068DD +:10DAF000486070470968C1607047C0680860704737 +:10DB0000017170474171090A81717047C171090A39 +:10DB10000172704700797047B0F805007047B0F89F +:10DB200007007047017170470079704701717047B5 +:10DB3000007970470A6842604968816070474268AE +:10DB40000A608068486070470171090A4171704736 +:10DB50008171090AC17170470172090A41727047E7 +:10DB60008172090AC172704780887047C088704707 +:10DB7000008970474089704701891B2914D3FB290C +:10DB800012D84189B1F5A47F21BF40F648028A42EC +:10DB900081881B2908D3FB2906D8C088B0F5A47F4B +:10DBA00022BF824201207047002070470A6842600D +:10DBB00049688160704742680A60806848607047C1 +:10DBC0000171704700797047417170474079704723 +:10DBD0000171704700797047417170474079704713 +:10DBE0008171090AC1717047C088704714A282B060 +:10DBF000D2E90012CDE900120179407901F0070263 +:10DC000069461DF80220012A07D800F00700085CC9 +:10DC100001289EBF012002B07047002002B070476B +:10DC200001717047007970474171704730B50C46FB +:10DC30000546FB2988BFFFDF6C7030BD86F3FFFF10 +:10DC4000000101020102020370B50446C2F1100591 +:10DC5000281901F047FC15F0FF0108D0491EC9B290 +:10DC6000802060542046BDE8704001F0B2BC70BD19 +:10DC700030B505E05B1EDBB2CC5CD55C6C40C454B7 +:10DC8000002BF7D130BD10B5002409E00B78521EEF +:10DC900044EA430300F8013B11F8013BD2B2DC092E +:10DCA000002AF3D110BD2DE9F0410C46012009787E +:10DCB000FF4E92B0154602274FF006084FF0040CB5 +:10DCC00071B101291ED0022945D0032905D1297837 +:10DCD000042902D105201070002012B0BDE8F081A7 +:10DCE000606850B1CDE90106012020708DF80080F8 +:10DCF000606A04901146684663E0277085F800C0AA +:10DD0000566026E029780429E7D169681022206945 +:10DD1000FFF7B9FF6868C07B000606D5E44A2069B2 +:10DD2000102310320146FFF7A3FFD4E9041010229C +:10DD3000FFF7A9FF2069C07B000606D5DC4A6069B1 +:10DD4000102310320146FFF793FF277085F800C0BB +:10DD50006E600320C1E729780429BED1A08910286C +:10DD60000CD9A0F1100080B2A081A1684FF010037F +:10DD7000014468466A68FFF77BFF18E004D14FF062 +:10DD800010032269A16807E0C2B20DA8A168FFF7DD +:10DD90005BFF626910230DA909A8FFF769FF102333 +:10DDA00009A968466A68FFF763FF0320207060686E +:10DDB0000590CDF818D08DF81080606A089029463B +:10DDC00004A8F2F7EDF988E72DE9F04107460D4682 +:10DDD00001200B7806213BB1012B04D11378052BD0 +:10DDE00001D11170002079E76C6901262022617051 +:10DDF000E8686060686A6062A168287C0870A68133 +:10DE0000A068A968401C01F06DFBA0892022203089 +:10DE1000A081A0686968213001F064FBA0892146D7 +:10DE20002030A0812E703846BDE8F041F2F7CFB91E +:10DE30002DE9F05F0D468346012009781746064616 +:10DE40004FF00608D1B1DFF868A24FF00009AAF13F +:10DE5000080A012923D002297ED003290CD1397860 +:10DE6000052909D179681022E86901F03BFB0720F8 +:10DE70003870183500207D60BDE8F09F2C6A8C4812 +:10DE8000202284F80180203060602020A081686A10 +:10DE900060626968A06801F025FB2E70D4E03978D3 +:10DEA0000529E9D12C6A84F80180686A60625168AA +:10DEB0001022E86901F016FBE8696060A0684F462F +:10DEC00080F80090A681A0684670A089401C80B2AE +:10DED000A081A1680844696951F8012F026089880E +:10DEE0008180A089801D80B2A0816969A2680978BB +:10DEF000C1F340011154A089401C80B2A081A168E7 +:10DF00000844296951F8012F026089888180A0891D +:10DF1000801D80B2A0812969A2680978C1F34001FF +:10DF20001154A0891022401C80B2A081A16808442D +:10DF3000E96801F0D7FAA0891022103080B2A081E0 +:10DF4000A1680844A96801F0CDFAA089103080B218 +:10DF5000A081A168014400E00DE0DAF80400086047 +:10DF6000A089001D80B2A081A1680F54A089401C27 +:10DF7000A081022067E03978052992D151681022EA +:10DF8000A86901F0AFFA2C6A84F80180E869606042 +:10DF9000686A6062A16881F80090A681A0684670F6 +:10DFA000A089401C80B2A081A1680844696951F829 +:10DFB000012F026089888180A089801D80B2A081A4 +:10DFC0006969A2680978C1F340011154A089401C15 +:10DFD00080B2A081A1680844296951F8012F02602C +:10DFE00089888180A089801D80B2A0812969A2686A +:10DFF0000978C1F340011154A0891022401C80B25D +:10E00000A081A1680844E96801F06CFAA089102297 +:10E01000103080B2A081A1680844A96801F062FABA +:10E02000A089103080B2A081A1680144DAF8040010 +:10E030000860A089001D80B2A081A1680E54A0894B +:10E04000401CA0810320287021465846BDE8F05F9F +:10E05000F2F7BDB870B50D4606460978012041B10A +:10E06000012905D11178052902D10820107000205E +:10E0700070BD2C6A0620607069686160696A6162BF +:10E08000EA69A16852F8013F0B6092888A80A081FA +:10E09000E869A1680078C0F340008871A089401C3D +:10E0A00080B2A081A1680844A96951F8012F01E05C +:10E0B00070FC0100026089888180A089801D80B287 +:10E0C000A081A969A2680978C1F340011154A0890F +:10E0D000401C80B2A081A168084469690A88028056 +:10E0E00089788170A0891022C01C80B2A081A168AB +:10E0F0000844296901F0F6F9A0891022103080B295 +:10E10000A081A1680844E96801F0ECF9A089102217 +:10E11000103080B2A081A1680844A96801F0E2F93A +:10E12000A08921461030A081012028703046BDE82A +:10E130007040F2F74CB870B50D46064609780120DC +:10E1400059B1012908D11178052905D1092010708C +:10E15000506800685060002070BD6C690620102275 +:10E160006070E8686060686A60622969A06801F0B0 +:10E17000B9F91020A081A06820221030A96801F010 +:10E18000B1F9A0892022203080B2A081A168084482 +:10E19000696801F0A7F9A08921462030A0810120FB +:10E1A00028703046BDE87040F2F711B870B50C46E3 +:10E1B000012009788EB01546062659B1012934D0C0 +:10E1C000022905D12978042902D10A2010700020E3 +:10E1D0000EB070BD606910236A460078C0F340003D +:10E1E0008DF80000A0690078C0F340008DF80100B0 +:10E1F000E0680168CDF802108188ADF806108079DA +:10E200008DF8080020690168CDF809108188ADF803 +:10E210000D1080798DF80F006068059009A80690B0 +:10E22000A168FFF725FD01201DE029780429CFD141 +:10E23000A06910236A4650F8011F00918088ADF84C +:10E240000400606950F8011FCDF806108088ADF811 +:10E250000A00002003906068059009A8069069688C +:10E26000FFF706FD022020708DF81060606A0890AC +:10E27000294604A8F1F794FFAAE700B50B7889B006 +:10E2800001204BB1012B05D11178042902D10B20BB +:10E290001070002009B000BD4868019005A80290E8 +:10E2A000C868036805934068069088680368079308 +:10E2B000406808900120087006208DF80000486A28 +:10E2C000049011466846F1F76BFFE3E700B50B7861 +:10E2D00089B0012043B1012BDCD111780429D9D1B7 +:10E2E0000C2010700020D5E74868019005A8029026 +:10E2F000886803680593406806900020079008909E +:10E300000120087006208DF80000486A049011462C +:10E310006846F1F745FFBDE700B50B7889B00120ED +:10E3200043B1012BB6D111780429B3D10D2010705F +:10E330000020AFE748680590CDF818D088680088BD +:10E34000ADF80000C8680088ADF802000020019018 +:10E35000029003900120087006208DF81000486A92 +:10E360000890114604A8F1F71BFF93E730B4034669 +:10E370000C7801205CB1012C15D0022C05D111784C +:10E380000C2902D10E201070002030BC70470120F3 +:10E390000870C868042242704A6842600B4A826072 +:10E3A000921EC2600BE014780D2CEED10220087092 +:10E3B000C86803244470526842608A688260496A6F +:10E3C0004162014630BC1846F1F701BF6AFC01000A +:10E3D00070B41D78039C4FF0000CAA4204BF70BCBF +:10E3E00070478E5C864208BF4FF0010C02D0BCF132 +:10E3F000000F05D0561CA64208BF00268E5D8E5425 +:10E40000561CA6420CBF0022521CD2B2AA42E8D12E +:10E41000BCF1000F04BF70BC70471878411E197022 +:10E420003CBF601E187070BC704700002DE9F041C1 +:10E430000C4611490D68104A104908321160A0F1CC +:10E4400020012A2901D301200CE03E2810D040CC25 +:10E450000B4F94E80E0007EB8000241F50F8807CDF +:10E460003046B84720600448001D0560BDE8F081D3 +:10E470002046E2F7A5FEF5E7100502400100000185 +:10E48000A0FC010010B5524800F04EFA00B1FFDFC9 +:10E490004F48401C00F048FA002800D0FFDF10BDB4 +:10E4A0002DE9F14F4B4ED6F800B00127484800F057 +:10E4B00043FADFF81C8128B95FF0000708F101007A +:10E4C00000F050FA444C00254FF003090120606031 +:10E4D000C4F80051C4F80451009931602060DFF89D +:10E4E000FCA018E0DAF80000C00614D50E2000F0F9 +:10E4F00064F8EFF3108010F0010072B600D0012034 +:10E50000C4F80493D4F8001119B9D4F8041101B96E +:10E5100020BF00B962B6D4F8000118B9D4F80401DC +:10E520000028DFD0D4F804010028CFD137B1C6F8D5 +:10E5300000B008F1010000F0FFF911E008F101005E +:10E5400000F0FAF90028B9D1C4F80893C4F80451CE +:10E55000C4F800510E2000F030F81D4800F002FA17 +:10E560000020BDE8F88F2DE9F0438DB00D4606463A +:10E5700000240DF110090DF1200817E004EB440709 +:10E58000102255F82710684600F0ACFF05EB87070E +:10E5900010224846796800F0A5FF6846FFF780FF23 +:10E5A00010224146B86800F09DFF641CB442E5DBD0 +:10E5B0000DB00020BDE8F08372E700F01F020121DA +:10E5C00091404009800000F1E020C0F880127047BF +:10E5D0007A01002004E5004000E0004010ED00E07A +:10E5E000C748002101708170704770B5C54D012387 +:10E5F0002B60C54B1C68002CFCD0002407E00E6883 +:10E6000006601E68002EFCD0001D091D641C94428B +:10E61000F5D30020286018680028FCD070BD70B5C4 +:10E62000B74E0446B94D3078022800D0FFDFAC4227 +:10E6300000D3FFDF7169B648012903D847F2305291 +:10E64000944201DD03224271491C7161291BC160A2 +:10E65000AF497078BDE87040F2F76BBA70B5A84C5E +:10E660000D466178884200D0FFDFA84E092D4FD2B9 +:10E67000DFE805F04E0522314E4E4E4E3C0020782C +:10E68000022800D0FFDF03202070A078022802D0EB +:10E69000012804D008E0A06800F036FC04E004F192 +:10E6A000080007C8FFF7A1FF052020700020A07018 +:10E6B000BDE87040F1F7D9BFF2F7AAF801466068EB +:10E6C000F3F7CFF9B04202D2616902290BD30320DC +:10E6D000F3F7ECFB12E0F2F79BF801466068F3F702 +:10E6E000C0F9B042F3D2BDE8704098E72078022824 +:10E6F0000AD0052806D0FFDF04202070BDE8704056 +:10E7000000F0F4B8022000E00320F3F7CFFBF3E7BA +:10E71000FFDF70BD70B50546F2F77AF8784C60609F +:10E720002078012800D0FFDF7949022008700022FC +:10E730000A718D6004224A71744ACA602070607840 +:10E74000BDE87040F2F7F5B910B56D4CA07808B986 +:10E75000207808B1112010BD6E48F1F7F3FF60700A +:10E76000607820B1012020700020606110BD03207E +:10E7700010BD0246010B0120B2F5003F02D28840D5 +:10E7800000F03CBEB2F5802F03D22039884000F063 +:10E790003DBEB2F5C02F03D24039884000F03FBEE5 +:10E7A000B2F5002F03D26039884000F041BE00204E +:10E7B00070472DE9F041144600EB84070E460546EC +:10E7C0003F1F00F0B4FB4FF080510A69504306EB45 +:10E7D0008402121FB24201D2012200E000221CB1C9 +:10E7E0000969B4EB910F02D90920BDE8F0814A49CB +:10E7F0008D4216D3AF4214D3854205D2874203D24D +:10E8000045EA0600800701D01020EEE78E4208D3CB +:10E810003AB92846FFF7ADFF18B93846FFF7A9FF08 +:10E8200008B10F20E1E73D483D490068884205D026 +:10E83000224631462846FFF7D8FE10E0FFF784FF56 +:10E840000028D2D12E4801218560C0E9036481707F +:10E850004FF4A97104FB01F01830FFF75BFF0020B3 +:10E86000C3E770B54FF08055044628692A49B1FBCB +:10E87000F0F084420AD300F05AFBA04201D81020E5 +:10E8800070BD28696043FFF774FF08B10F2070BDA9 +:10E89000224823490068884204D02869604300F078 +:10E8A00033FB0CE0FFF750FF0028F0D12969144832 +:10E8B00061438160022181701A48FFF72BFF00201D +:10E8C00070BD1548010B01208840401E704770B58F +:10E8D0000D460446FFF7F5FF204201D00F2070BD22 +:10E8E00029462046BDE8704000F0ABBD10B5044C91 +:10E8F0006078F1F777FF00202070A07010BD000055 +:10E900007C01002004E5014000E40140105C0C00A3 +:10E91000241200205DE6010000000200A00000209B +:10E92000BEBAFECA7C5E0100002101700846704735 +:10E930000146002008707047EFF3108101F00101DB +:10E9400072B60278012A01D0012200E000220123E0 +:10E95000037001B962B60AB1002070474FF400504D +:10E960007047E9E7EFF3108111F0010F72B64FF035 +:10E970000002027000D162B600207047F2E700008A +:10E98000564909680160002070475449086000201A +:10E99000704701218A0720B1012804D042F2040007 +:10E9A0007047916700E0D167002070474C49012013 +:10E9B000086042F20600704708B50423484A190768 +:10E9C000103230B1C1F80433106840F0010010601B +:10E9D0000BE0106820F001001060C1F8083300203F +:10E9E000C1F808013F4800680090002008BD3C497C +:10E9F000103140B101280CD0022812D0032816D0C3 +:10EA000042F205007047086820F01E0040F0100038 +:10EA100004E0086820F01E0040F0140008600020A8 +:10EA20007047086820F01E0040F01800F6E70868FC +:10EA300020F01E0040F01C00F0E7294924310A684C +:10EA400002430A6000207047254924310A68824346 +:10EA50000A600020704722492431096801600020C3 +:10EA60007047012801D9072070471F4A52F820003B +:10EA700002680A43026000207047012801D907207C +:10EA80007047194A52F8200002688A430260002049 +:10EA90007047012801D907207047134A52F8200017 +:10EAA0000068086000207047020010494FF0000025 +:10EAB00003D0012A01D0072070470A6070474FF049 +:10EAC00080410020C1F808014FF0E020802180F84B +:10EAD00000140121C0F8001170470000000400403C +:10EAE000000500400801004048FD01007805004095 +:10EAF0006249634B0A6863499A42096801D1C1F3CC +:10EB000010010160002070475C495D4B0A685D4957 +:10EB1000091D9A4201D1C0F310000860002070471F +:10EB20005649574B0A68574908319A4201D1C0F3F8 +:10EB3000100008600020704730B5504B504D1C68E5 +:10EB400042F20803AC4202D0142802D203E011289A +:10EB500001D3184630BDC3004B481844C0F8101507 +:10EB6000C0F81425002030BD4449454B0A6842F2E4 +:10EB700009019A4202D0062802D203E0042801D3F8 +:10EB800008467047404A012142F830100020704783 +:10EB90003A493B4B0A6842F209019A4202D00628E0 +:10EBA00002D203E0042801D308467047364A012107 +:10EBB00002EBC00041600020704770B52F4A304E14 +:10EBC000314C156842F2090304EB8002B54204D0CF +:10EBD000062804D2C2F8001807E0042801D318461A +:10EBE00070BDC1F31000C2F80008002070BD70B500 +:10EBF000224A234E244C156842F2090304EB80029A +:10EC0000B54204D0062804D2D2F8000807E0042850 +:10EC100001D3184670BDD2F80008C0F31000086098 +:10EC2000002070BD174910B5083118480860112040 +:10EC3000154A002102EBC003C3F81015C3F81415E0 +:10EC4000401C1428F6D3002006E0042804D302EB6D +:10EC50008003C3F8001807E002EB8003D3F80048F4 +:10EC6000C4F31004C3F80048401C0628EDD310BDBF +:10EC7000044906480831086070470000A0000020E1 +:10EC8000BEBAFECA00F5014000F001400000FEFFE0 +:10EC9000754B1B6803B19847BFF34F8F73480168EA +:10ECA000734A01F4E06111430160BFF34F8FFEE747 +:10ECB00010B572B600F0CEF850B1E2F721FBF1F7D3 +:10ECC000BCFCF3F799F8EBF75AF86A4900200860A2 +:10ECD00062B6002010BD70B50C46054672B600F055 +:10ECE000B9F810B162B6082070BDE2F77FFAE2F71A +:10ECF00009FB0246002043099B0003F1E02300F0DA +:10ED00001F01D3F80031CB40D9071DD0202803D2F2 +:10ED100022FA00F1C90724D141B2002906DA01F034 +:10ED20000F0101F1E02191F8141D03E001F1E02150 +:10ED300091F800144909082913D291B1012910D082 +:10ED400004290ED005290CD0401C6428D3D3EAF73F +:10ED5000EDFF4849484808602046F3F705FD58B9DB +:10ED600003E062B641F2010070BD3F4804602DB17E +:10ED70002846F3F744FD18B110242BE03F4D18E06E +:10ED80002878022802D94FF4805423E00724002871 +:10ED9000687801D058B908E0E0B120281AD8A878DE +:10EDA000212817D8012815D003E0A87808B162B649 +:10EDB00012E03349802081F8140DE2F7A3FA2946C6 +:10EDC000F3F700F8F1F7ECFB00F0E8F82846E2F77B +:10EDD00065FA044662B61CB1FFF76AFF204670BDB3 +:10EDE000002070BD10B5044600F034F800B10120D9 +:10EDF0002070002010BD234908600020704770B5C6 +:10EE00000C4621490D682049204E08310E6010281B +:10EE100007D011280CD012280FD0132811D00120B0 +:10EE200013E0D4E90001FFF756FF354620600DE0FE +:10EE3000FFF73EFF0025206008E02068FFF7D2FFC3 +:10EE400003E0104920680860002020600E48001D83 +:10EE5000056070BD074808490068884201D101205B +:10EE60007047002070470000940100200CED00E086 +:10EE70000400FA05A0000020BEBAFECA50FD010041 +:10EE80000BE000E00400002010050240010000013A +:10EE90002DE9F04184B088460746FEF709FD054696 +:10EEA0007E786A4601A94046EFF712FC04000ED0B6 +:10EEB000012D1EBF032004B0BDE8F08102AA404628 +:10EEC0000199EFF704FB0298B0F803000AE0022D65 +:10EED00014D1042E12D3B7F80300BDF80020011D91 +:10EEE0008A420BD3001D80B2A119814238BF012094 +:10EEF00008BF00209CBF04B0BDE8F0814FF00200C5 +:10EF000004B0BDE8F08100000B4A022111600B49FA +:10EF10000B68002BFCD0084B1B1D186008680028EC +:10EF2000FCD00020106008680028FCD070474FF02B +:10EF3000805040697047000004E5014000E4014052 +:10EF400010B54FF000040B460200204621461ED0AB +:10EF5000012A04D0022A04D0032A1DD103E0012093 +:10EF600002E0022013E00320072B15D2DFE803F0B4 +:10EF7000140406080A0C0E00012108E0022106E034 +:10EF8000032104E0042102E0052100E00621F1F75D +:10EF9000F3FB08B1204610BD0724FBE7FE4805211E +:10EFA0008170002101704170C17081607047FB4920 +:10EFB0000A78022A06D0CA681044C860C868323885 +:10EFC000F2F7FBBC8A68104488608868F7E703782A +:10EFD000F349F44A13B1012B0ED011E00379012B50 +:10EFE00000D06BB943790BB1012B09D18368643B25 +:10EFF0008B4205D2C0680EE00379012B02D00BB121 +:10F000000020704743790BB1012BF9D1C368643BF1 +:10F010008B42F5D280689042F2D8012070472DE9EA +:10F02000F04704460226F1F756FF006800B1FFDF03 +:10F03000D94D01273CB12078B0B1012805D0022874 +:10F0400010D0032813D02F710CE06068C82807D3B4 +:10F05000F2F732FD20B16068FFF7A9FF012603E057 +:10F06000002601E000F0AFF93046BDE8F0872878CF +:10F070000028F7D16068FFF7AAFF0028E3D0606896 +:10F08000DFF81883007810B3A878042800D0FFDFD9 +:10F090000020474688F8000060680079C0B300206F +:10F0A000387160684079A0B3042078716068816825 +:10F0B000E868F1F7C6FBB8606068C0683230F86095 +:10F0C0000320A870B549E878F1F733FDCAE74FF09F +:10F0D0000209404688F8009061680979D1B10021A1 +:10F0E000017161684979B9B1042141716168896828 +:10F0F000323181606168C968C160C068A64C14344F +:10F100006060F1F785FB20606F7085F80290A9E7D9 +:10F1100004E005E00321E3E70321E6E70120BFE780 +:10F120000320C2E72DE9F0479B4C8846E1788842EE +:10F1300000D0FFDFDFF8609200250127974E09F12C +:10F140001409B8F1090F76D2DFE808F0050D2A3D61 +:10F15000646A769E7E00A078032886D0A078022874 +:10F1600083D0FFDF81E7A078032803D0A0780228AE +:10F1700000D0FFDF0420A0702571207800285FD127 +:10F18000FFF715FF3078022806D0B068E06000F085 +:10F190006CF92061002048E0E078F1F770FBF5E7BA +:10F1A000A078032803D0A078022800D0FFDF2078C1 +:10F1B00078BBA078032812D1042026E00420F2F7BF +:10F1C00075FEA57051E7A078032803D0A078022827 +:10F1D00000D0FFDF2078E0B9A078032814D0F1F741 +:10F1E00017FB01464F46D9F80000F2F73AFC002819 +:10F1F000E4DB79688142E1DB081AF0606749E07876 +:10F20000BDE8F047F1F795BC0520F2F74FFEA77077 +:10F210002BE724E0A078042800D0FFDF022004E0E0 +:10F22000A078042800D0FFDF0120A1688847FFF7FD +:10F23000F6FE05462EE027E0A078042800D0FFDF88 +:10F24000BDE8F04700F0BFB8A078042805D060788A +:10F2500010B1A078022800D0FFDF207818B1BDE8F7 +:10F26000F04700F0B9B8207920B10620F2F71EFE71 +:10F270002571CCE7607828B14849E078F1F759FC6E +:10F280006570F2E60720C0E7FFDFEEE63DB1012D35 +:10F2900003D0FFDF022DF9D1E7E60420C5E7032004 +:10F2A000C3E770B5050005D03B4CA078052803D016 +:10F2B000112070BD102070BD3B48F1F743FAE0709B +:10F2C000E07818B1A5600020A07070BD032070BD6B +:10F2D000314810B5017809B1112010BD8178052998 +:10F2E0000CD0817801290BD0817849B101210170BE +:10F2F0008178012904D0807810B103E00F2010BD7F +:10F3000000F06AF8002010BD2DE9F041224E0446BD +:10F31000B07808B101280AD164B12046FFF757FE42 +:10F3200050B120781D4D48B1B078012822D00F206F +:10F33000BDE8F0811020FBE70720F9E702272F70D6 +:10F34000207998B100202871607988B10420687113 +:10F35000A0683230A860E068E860E8680E4C1434B9 +:10F360006060F1F755FA2060B77022E00320EAE709 +:10F370000320ECE700202870207900B300202871DA +:10F380006079F0B104206871A168F068F1F759FA6A +:10F39000A860E068323009E09801002034120020B3 +:10F3A0003D860100FF1FA10725F10100E860032051 +:10F3B000B0701049F078F1F7BCFB0020B8E70320EB +:10F3C000DDE70320DFE70C4810B5006900F045F8E1 +:10F3D000BDE81040F1F749B910B5074CE078F1F7F6 +:10F3E00001FA0820F2F762FD0520A07000202070CD +:10F3F000607010BD34120020980100201F49096878 +:10F40000014201D001207047002070471B49091DAF +:10F410000968014201D00120704700207047174958 +:10F4200010310968014201D0012070470020704767 +:10F43000124914310968014201D0012070470020AF +:10F44000704710B50D4C2060201D01600B48103036 +:10F450000260001D0360002010BD09490A6848F2DF +:10F4600002139A4302430A607047054A116848F242 +:10F47000021301EA0300994311607047000600403F +:10F48000C8060240704770477047704740EA010362 +:10F4900010B59B070FD1042A0DD310C808C9121F3D +:10F4A0009C42F8D020BA19BA884201D9012010BD77 +:10F4B0004FF0FF3010BD1AB1D30703D0521C07E044 +:10F4C000002010BD10F8013B11F8014B1B1B07D1A8 +:10F4D00010F8013B11F8014B1B1B01D1921EF1D119 +:10F4E000184610BD032A40F2308010F0030C00F0E3 +:10F4F000158011F8013BBCF1020F624498BF11F86E +:10F5000001CB00F8013B38BF11F8013BA2F1040226 +:10F5100098BF00F801CB38BF00F8013B11F003039E +:10F5200000F02580083AC0F0088051F8043B083A02 +:10F5300051F804CBA0E80810F5E7121D5CBF51F8A4 +:10F54000043B40F8043BAFF30080D20724BF11F81E +:10F55000013B11F801CB48BF11F8012B24BF00F883 +:10F56000013B00F801CB48BF00F8012B704710B5F4 +:10F57000203AC0F00B80B1E81850203AA0E81850AB +:10F58000B1E81850A0E81850BFF4F5AF5FEA027C6C +:10F5900024BFB1E81850A0E8185044BF18C918C0DB +:10F5A000BDE810405FEA827C24BF51F8043B40F87C +:10F5B000043B08BF7047D20728BF31F8023B48BF61 +:10F5C00011F8012B28BF20F8023B48BF00F8012B9F +:10F5D00070474FF000020429C0F0128010F0030CB5 +:10F5E00000F01B80CCF1040CBCF1020F18BF00F836 +:10F5F000012BA8BF20F8022BA1EB0C0100F00DB8E5 +:10F600005FEAC17C24BF00F8012B00F8012B48BF42 +:10F6100000F8012B70474FF0000200B513469446E6 +:10F620009646203922BFA0E80C50A0E80C50B1F15A +:10F630002001BFF4F7AF090728BFA0E80C5048BF6E +:10F640000CC05DF804EB890028BF40F8042B08BF0C +:10F65000704748BF20F8022B11F0804F18BF00F808 +:10F66000012B70477047704770477047FEDF0420DA +:10F670007146084219D10699134A914215DC069940 +:10F6800002394878DF2810D10878FE2807D0FF28F3 +:10F690000BD14FF001004FF000020C4B184741F224 +:10F6A00001000099019A094B184706980599084BE3 +:10F6B000002B02D01B68DB6818474FF0FF304FF07B +:10F6C00000017246014B18470000020091EC010056 +:10F6D00004000020184819497047FFF7FBFFE1F7C5 +:10F6E0005DFD00BD4FF4805015490968884203D183 +:10F6F000144A13605B68184700BD000020BFFDE797 +:10F700004FF480500E490968884210D10E4B18689A +:10F710004FF0FF318842F1D080F308884FF020216C +:10F72000884204DD0948026802210A430260084851 +:10F73000804708488047FFDF481200204812002019 +:10F74000000000200400002000000200240500400A +:10F750003D280100E5F6010004207146084202D070 +:10F76000EFF3098101E0EFF308818869023800783E +:10F77000102813DB20280FDB2B280BDB0A4A12682A +:10F780000A4B9A4203D1602804DB094A1047022041 +:10F7900008607047074A1047074A1047074A12682F +:10F7A0002C32126810470000A0000020BEBAFECA2A +:10F7B000091300002DE40100FFED0100040000200A +:10F7C0000E4B0F4908470F4B0D4908470E4B0C498C +:10F7D00008470E4B0A4908470D4B094908470D4B8E +:10F7E000074908470C4B064908470C4B0449084792 +:10F7F0000B4B034908470B4B01490847A99A0000E6 +:10F80000719F0000AD2F0000A59600002996000012 +:10F81000839C000025130000932F0000C99700006F +:10F82000F99E0000A911000000210160818070474D +:10F83000002101604160017270470A6802600B7923 +:10F8400003717047014901208860704700F0004053 +:10F8500057840000078600002B8400000B870000FF +:10F860002F870000698700009D870000D787000070 +:10F8700007880000598800009112000091120000D2 +:10F88000AB230000E923000009240000BF2400008E +:10F89000FB250000CD260000FD260000C727000044 +:10F8A000931F0000FF290000E12A0000012B000047 +:10F8B0008B320000AF320000DF3100003332000035 +:10F8C000E1320000753300001F460000E3470000EE +:10F8D0008B4B0000A74C00002B4D0000C94D0000D1 +:10F8E0003B4E0000574F000025500000A350000081 +:10F8F0001B2B0000212B00002B2B0000551F0000AC +:10F90000FB2B00001D1F0000512D0000A92D000041 +:10F91000911200009112000091120000911200005B +:10F92000AD5B0000335C00004F5C00006B5C0000CE +:10F93000F95D0000955C00009F5C0000E15C000048 +:10F94000035D0000DF5D0000215E000091120000F9 +:10F950001D7400003D7400003F74000079740000C5 +:10F96000A77400009D7500002B7600003F76000014 +:10F970008D760000737700001D790000497A000041 +:10F9800097650000617A000091120000911200005A +:10F99000D7920000179300003B9300001001100164 +:10F9A0003A0200001A02000405060000FFFFFFFFF4 +:10F9B0000000FFFFE58C0000A71B00003958000085 +:10F9C000E1650000D77E000000000000297C0000F7 +:10F9D000577F0000377F000000000000000000009B +:10F9E0000000000000000000000000000000000017 +:10F9F0000000000000000000000000000000000007 +:10FA000069C70000EDC70000000000000000000012 +:10FA100000000000EDC80000000000000000000031 +:10FA200000000000FDDA00000000000000000000FF +:10FA300000000000A1CB0000CDD6000000000000B7 +:10FA400093D7000007D800000000000065D0000038 +:10FA500017D1000000000000CDD700000DD200003B +:10FA600025D4000097D4000099D5000057CD0000A0 +:10FA7000000000000000000065CC00000000000055 +:10FA8000D9C900004FC900002DD6000071D900006F +:10FA9000E9D90000000000003BC800006BC800006E +:10FAA0009BC7000000000000B5C800000000000077 +:10FAB000000000000000000041DA0000000000002B +:10FAC000E9CD000000000000000000000000000080 +:10FAD00000000000D5CE0000000000005FCB000059 +:10FAE0007BC9000027CB000000000000EFCA000027 +:10FAF0000000000000000000A9DA00000DCA0000AC +:10FB000027C900004BDB0000A5DC0000D9CB0000BA +:10FB10005BDC000000000000CBDB000021DC00000B +:10FB20001BD00000CD3C0000CD3C0000872300002E +:10FB3000498C0000636800000D58000000000000C0 +:10FB4000D5A20100113D0000113D0000A9230000D5 +:10FB5000A38C0000CF68000017580000D78C01006C +:10FB6000FBA20100BC01BC013E002C0050001400AF +:10FB700030018001010000000100000000010203CB +:10FB800004000F101112000000130000ADE101008D +:10FB90007BE20100CDE2010019E301006DE3010009 +:10FBA000A7DC0100C9DD010031DE010055E00100E4 +:10FBB00037E101009BEE000075FF0000000000002F +:10FBC000060000000A000000320000007300000080 +:10FBD000B40000000004FD000000FC0235770100C5 +:10FBE0003F670100C5420100F9BB010083550100D8 +:10FBF000F9BB010031430100E7BD0100214E0100C6 +:10FC0000E7BD01003D42010013BD01005754010052 +:10FC100013BD01006F460100DBC001000B5601005F +:10FC2000DBC00100555555D6BE898E000000660622 +:10FC3000F30C801300000A033B066C090000560415 +:10FC4000D308500D555555252627D6BE898EF4016B +:10FC5000FA00960064004B0032001E001400000001 +:10FC6000250100000000000000000300656C7462C4 +:10FC70000000000000000000000000000000000084 +:10FC800087000000000000000000000000000000ED +:10FC9000BE83605ADB0B376038A5F5AA9183886C68 +:10FCA000F1EA010009EB010021EB010039EB010051 +:10FCB00069EB010091EB0100BBEB0100EFEB0100F0 +:10FCC00063E80100B3E70100CFE8010029E9010082 +:10FCD00039E9010065E90100632001006B200100A2 +:10FCE0007920010093E90100ADE9010081E90100FB +:10FCF0008BE90100B9E90100EFE901003BEA0100ED +:10FD000049EA010057EA010063EA01007BEA0100C9 +:10FD100093EA0100A9EA0100000000006F980000CA +:10FD2000C5980000DB98000041EF0100A1E401004C +:10FD300067E50100A3F20100D1F2010009F301001F +:10FD4000591E01003D2301001C0500402005004014 +:10FD50000010020074FD010008000020AC0100004A +:10FD60004411000098FD0100B4010020941000002F +:10FD700080110000013F0222173601000100703798 +:10FD800020FB349B5F80041F800010022C01337F16 +:08FD90000102A8290244100041 +:00000001FF diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_err.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_err.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_err.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_err.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_gap.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gap.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_gap.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_gatt.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatt.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_gatt.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gattc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_gattc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gattc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_gattc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatts.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_gatts.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_gatts.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_gatts.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_hci.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_hci.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_hci.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_hci.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_l2cap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_l2cap.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_l2cap.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_l2cap.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_ranges.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_ranges.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_ranges.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_ranges.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_types.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/ble_types.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/ble_types.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf52/nrf_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf52/nrf_mbr.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf52/nrf_mbr.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf52/nrf_mbr.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_error.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_error.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_error_sdm.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_sdm.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_error_sdm.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_error_soc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_error_soc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_error_soc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_nvic.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_nvic.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_nvic.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sd_def.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_sd_def.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sd_def.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_sd_def.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_sdm.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_sdm.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_sdm.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_soc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_soc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_soc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_svc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_svc.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_svc.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/headers/nrf_svc.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/hex/s140_nrf52840_5.0.0-1.alpha_softdevice.hex b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/hex/s140_nrf52840_5.0.0-1.alpha_softdevice.hex new file mode 100644 index 0000000000..5dc50e841e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/hex/s140_nrf52840_5.0.0-1.alpha_softdevice.hex @@ -0,0 +1,8202 @@ +:020000040000FA +:1000000000040020E508000079050000C508000094 +:10001000830500008D05000097050000000000002A +:1000200000000000000000000000000009090000BE +:10003000A105000000000000AB050000B5050000B0 +:10004000BF050000C9050000D3050000DD05000064 +:10005000E7050000F1050000FB05000005060000B3 +:100060000F06000019060000230600002D06000000 +:1000700037060000410600004B0600005506000050 +:100080005F06000069060000730600007D060000A0 +:1000900087060000910600009B060000A5060000F0 +:1000A000AF060000B9060000C3060000CD06000040 +:1000B000D7060000E1060000EB060000F506000090 +:1000C000FF06000009070000130700001D070000DD +:1000D00027070000310700003B070000450700002C +:1000E0004F07000059070000630700006D0700007C +:1000F00077070000810700008B07000095070000CC +:100100009F0700001FB500F003F88DE80F001FBD2A +:1001100000F0DEBB1FB56FF00100009040100390AF +:10012000029001904FF010208069000B420900F00E +:100130001F045DF822300120A04083434DF8223097 +:10014000684600F044F91FBDF0B54FF6FF734FF459 +:10015000B4751A466E1E11E0A94201D3344600E080 +:100160000C46091B30F8027B641E3B441A44F9D14B +:100170009CB204EB134394B204EB12420029EBD17E +:1001800098B200EB134002EB124140EA0140F0BD8F +:10019000DD4992B00446D1E90001CDE91001FF220A +:1001A0004021684600F03AFB94E80F008DE80F000C +:1001B000684610A902E004C841F8042D8842FAD12B +:1001C00010216846FFF7C0FF1090AA208DF8440068 +:1001D000FFF7A0FF00F0F2F84FF01024A069102202 +:1001E0006946803000F001F9A069082210A900F0EA +:1001F000FCF800F0D7F84FF080510A6949690068AF +:100200004A43824201D8102070470020704710B541 +:10021000D0E900214FF0805002EB8103026944696C +:100220006243934209D84FF01022536903EB8103D4 +:100230000169406941438B4201D9092010BD5069D1 +:10024000401C01D0002010BD0F2010BD70B501680A +:100250000446AE4D4FF01020062951D2DFE801F0E0 +:10026000320318283B1DD4E90265646829463046EC +:1002700000F0CDF82A462146304600F0B6F8AA0034 +:100280002146304600F09EFA002800D0032070BDC1 +:1002900000F050FB4FF4805007E0201DFFF7ABFF4C +:1002A0000028F4D100F046FB60682860002070BD93 +:1002B000241D94E80700920000F084FA0028F6D08C +:1002C0000E2070BD8069401C12D0201DFFF79FFFDB +:1002D0000028F6D109E08069401C09D0201DFFF7F5 +:1002E0008AFF0028EDD1606820B12046FFF750FF5B +:1002F000042070BDFFF70EFF00F060F800F052F828 +:10030000072070BD10B50C46182802D001200860E7 +:1003100010BD2068FFF79AFF206010BD4FF0102439 +:10032000A069401C05D0A569A66980353079AA2846 +:1003300008D06069401C2DD060690068401C29D03D +:1003400060692CE010212846FFF7FEFE31688142EB +:100350001CD1A16901F18002C03105E030B108CAA9 +:1003600051F8040D984201D1012000E000208A429A +:10037000F4D158B1286810B1042803D0FEE728460C +:1003800000F057F861496868086008E000F016F866 +:1003900000F008F84FF480500168491C01D000F0CB +:1003A000A3FAFEE7BFF34F8F59480168594A01F499 +:1003B000E06111430160BFF34F8FFEE74FF0102063 +:1003C0008169491C02D0806900F0ADB87047524A7B +:1003D00001681160121D416811604F4A8168103236 +:1003E0001160111DC068086070472DE9F041174683 +:1003F0000D460646002406E03046296800F0A6F8BF +:10040000641C2D1D361DBC42F6D3BDE8F08170B5CD +:100410000C4605464FF4806608E0284600F083F855 +:10042000B44205D3A4F5806405F58055002CF4D1C1 +:1004300070BD4168044609B1012500E000254FF078 +:1004400010267069A268920000F0BCF9C8B120467D +:1004500000F01AF89DB17669A56864684FF4002031 +:1004600084420AD2854208D229463046FFF7CFFFA0 +:100470002A4621463046FFF7B8FFFFF79FFFFFF7F8 +:1004800091FFFFF747FEF8E72DE9FF414FF01024F9 +:10049000616980680D0B01EB800000F6FF70010BB5 +:1004A00000200090019002900246039068460123CC +:1004B0000BE0560902F01F0C50F8267003FA0CFCF2 +:1004C00047EA0C0740F82670521CAA42F1D30AE012 +:1004D0004A0901F01F0650F8225003FA06F6354388 +:1004E00040F82250491C8029F2D3A169090B4A091E +:1004F00001F01F0150F822408B409C4340F82240FD +:10050000FFF765FFBDE8FF815809000000000020EB +:100510000CED00E00400FA050006004014480168F4 +:100520000029FCD07047134A0221116010490B6862 +:10053000002BFCD00F4B1B1D186008680028FCD056 +:100540000020106008680028FCD07047094B10B5E7 +:1005500001221A60064A1468002CFCD00160106861 +:100560000028FCD00020186010680028FCD010BDC6 +:1005700000E4014004E5014008208F49096809585A +:10058000084710208C4909680958084714208A49EF +:100590000968095808471820874909680958084711 +:1005A0003020854909680958084738208249096878 +:1005B000095808473C2080490968095808474020E5 +:1005C0007D4909680958084744207B49096809584A +:1005D0000847482078490968095808474C20764957 +:1005E000096809580847502073490968095808479D +:1005F0005420714909680958084758206E4909680C +:10060000095808475C206C49096809580847602068 +:100610006949096809580847642067490968095801 +:100620000847682064490968095808476C206249EE +:1006300009680958084770205F4909680958084740 +:1006400074205D4909680958084778205A490968A3 +:10065000095808477C2058490968095808478020EC +:1006600055490968095808478420534909680958B9 +:100670000847882050490968095808478C204E4986 +:1006800009680958084790204B49096809580847E4 +:10069000942049490968095808479820464909683B +:1006A000095808479C204449096809580847A02070 +:1006B0004149096809580847A4203F490968095871 +:1006C0000847A8203C49096809580847AC203A491E +:1006D000096809580847B020374909680958084788 +:1006E000B4203549096809580847B82032490968D3 +:1006F00009580847BC203049096809580847C020F4 +:100700002D49096809580847C4202B490968095828 +:100710000847C8202849096809580847CC202649B5 +:10072000096809580847D02023490968095808472B +:10073000D4202149096809580847D8201E4909686A +:1007400009580847DC201C49096809580847E02077 +:100750001949096809580847E420174909680958E0 +:100760000847E8201449096809580847EC2012494D +:10077000096809580847F0200F49096809580847CF +:10078000F4200D49096809580847F8200A49096802 +:1007900009580847FC2008490968095808475FF4C8 +:1007A0008070054909680958084700000348044952 +:1007B000024A034B70470000000000206809000057 +:1007C0006809000040EA010310B59B070FD1042A15 +:1007D0000DD310C808C9121F9C42F8D020BA19BA0C +:1007E000884201D9012010BD4FF0FF3010BD1AB171 +:1007F000D30703D0521C07E0002010BD10F8013BC6 +:1008000011F8014B1B1B07D110F8013B11F8014BEC +:100810001B1B01D1921EF1D1184610BD02F0FF033F +:1008200043EA032242EA024200F005B870477047EB +:1008300070474FF000020429C0F0128010F0030C42 +:1008400000F01B80CCF1040CBCF1020F18BF00F8C3 +:10085000012BA8BF20F8022BA1EB0C0100F00DB872 +:100860005FEAC17C24BF00F8012B00F8012B48BFD0 +:1008700000F8012B70474FF0000200B51346944674 +:100880009646203922BFA0E80C50A0E80C50B1F1E8 +:100890002001BFF4F7AF090728BFA0E80C5048BFFC +:1008A0000CC05DF804EB890028BF40F8042B08BF9A +:1008B000704748BF20F8022B11F0804F18BF00F896 +:1008C000012B7047014B1B68DB68184700000020B4 +:1008D00009480A497047FFF7FBFFFFF713FC00BD0B +:1008E00020BFFDE7064B1847064A1060016881F3F8 +:1008F0000888406800470000680900006809000097 +:100900001D030000000000201EF0040F0CBFEFF3D9 +:100910000881EFF30981886902380078182803D12B +:1009200000E00000074A1047074A12682C3212689C +:100930001047000000B5054B1B68054A9B589847B7 +:1009400000BD000005030000000000205409000065 +:1009500004000000001000000000000000FFFFFF86 +:040960000090D00330 +:10100000481200202D000200B99F00009BFF010044 +:10101000B99F0000B99F0000B99F000000000000C8 +:101020000000000000000000000000008500020039 +:10103000B99F000000000000B99F0000B99F0000A8 +:10104000ED000200F3000200B99F0000B99F00000C +:10105000B99F0000B99F0000B99F0000B99F000030 +:10106000F9000200B99F0000B99F0000FF000200D4 +:10107000B99F0000050102000B01020011010200EE +:10108000B99F0000B99F0000B99F0000B99F000000 +:10109000B99F0000B99F0000B99F0000B99F0000F0 +:1010A000170102001D010200B99F0000B99F000056 +:1010B000B99F0000B99F0000B99F0000B99F0000D0 +:1010C00023010200B99F0000B99F0000B99F0000F2 +:1010D000B99F0000B99F0000B99F0000B99F0000B0 +:1010E000B99F0000B99F0000B99F0000B99F0000A0 +:1010F000B99F0000B99F0000B99F0000B99F000090 +:10110000B99F0000B99F000000F002F81EF07BFFBD +:101110000AA090E8000C82448344AAF10107DA4552 +:1011200001D11EF070FFAFF2090EBAE80F0013F004 +:10113000010F18BFFB1A43F00103184770F50100B7 +:1011400090F501000A4410F8014B14F00F0508BF98 +:1011500010F8015B240908BF10F8014B6D1E05D083 +:1011600010F8013B6D1E01F8013BF9D1641E03D05C +:10117000641E01F8015BFBD19142E4D3704700008B +:101180000023002400250026103A28BF78C1FBD890 +:10119000520728BF30C148BF0B6070471FB500F031 +:1011A0003DF88DE80F001FBD1EF0040F0CBFEFF3DC +:1011B0000880EFF30980014A104700000B9E0000F1 +:1011C0008269034981614FF00100104470470000BB +:1011D000D511000001B41EB400B511F095F801B4AA +:1011E0000198864601BC01B01EBD0000F0B4404627 +:1011F000494652465B460FB402A0013001B506488D +:10120000004700BF01BC86460FBC80468946924617 +:101210009B46F0BC70470000091100001EF0F0BEB4 +:1012200070B51C4C054608202070A01C00F065F825 +:101230005920A08029462046BDE8704006F092BFA4 +:1012400010B506F09AFF13490020891E087010BDE2 +:1012500070B50C460F49891E097829B1A0F16001CB +:10126000532906D3012011E0602802D043F2010087 +:101270000CE020CC084E94E80E0006EB8000A0F5B0 +:101280008050241FD0F8806E2846B047206070BD83 +:10129000012070470A0000209001020010B50446AA +:1012A0000021012000F03FF80021182000F03BF859 +:1012B00000210B2000F037F80421192000F033F84A +:1012C00004210D2000F02FF804210E2000F02BF84F +:1012D00004210F2000F027F80421C84300F023F870 +:1012E0000721162000F01FF80721152000F01BF839 +:1012F0002046FFF795FF002010BD8F210180704729 +:10130000FFF79EBF10487047104A10B514680F4B86 +:101310000F4A08331A60FFF79BFF0C48001D04605A +:1013200010BD704770474907090E002806DA00F023 +:101330000F0000F1E02080F8141D704700F1E0205C +:1013400080F800147047000003F9004310050240C4 +:101350000100000130B5F74D044610280AD0112CC9 +:1013600006D02846122C817806D0132C08D0FFDF37 +:10137000AC7030BDFFDFFBE71129F9D0FFDFF7E7E5 +:101380001129F5D0FFDFF3E770B50FF0AAF9044695 +:1013900010F082FD201AC4B206200DF085FB054630 +:1013A00006200DF089FB2E1A07200DF07DFB054667 +:1013B00007200DF081FBDF49281A3218887812289F +:1013C0000DD000231A4413280BD0002002440878C3 +:1013D000022808D000201044201AC0B270BD01239A +:1013E000F0E70120F2E70120F5E7D24800B50079E7 +:1013F000D049420897B051F8050F89880CD01722C0 +:101400008DF80020CDF80200ADF806100BA9684653 +:101410000AF007FF17B000BD4322F1E702210DF0EB +:1014200098BB2DE9F04196B01D4690460E46074602 +:10143000FFF7F4FF04000BD02078222804D3A07F0C +:10144000C0F34010A84206D1082016B0BDE8F081D4 +:1014500043F20200F9E748208DF80000ADF8027071 +:101460003DB101208DF804008DF805608DF80680EF +:1014700002E000208DF804000BA968460AF0D1FEB6 +:10148000A07F65F34510A0770020DEE730B5044665 +:10149000A1F120000D460A284AD2DFE800F0050736 +:1014A0000C1C2328353A3F44FFDF42E020782028F7 +:1014B0003FD1FFDF3DE09F480178032939D0807894 +:1014C000132836D02078242833D0252831D023285B +:1014D0002FD0FFDF2DE0207822282AD0232828D8FB +:1014E000FFDF26E02078222823D0FFDF21E02078CC +:1014F00022281ED024281CD026281AD0272818D00D +:10150000292816D0FFDF14E02078252811D0FFDF2E +:101510000FE0207825280CD0FFDF0AE0207825286E +:1015200007D0FFDF05E02078282802D0FFDF00E0A9 +:10153000FFDF257030BD30B50B8840F67B444FF699 +:10154000FF72022801D0934204D09D1FA54224D2ED +:10155000022802D04D88954203D04D88AD1FA54288 +:101560001BD24C88A34218D88B88B3F5FA7F14D2CB +:10157000022802D0C888904205D0C88840F6774536 +:101580000A38A84209D2C888904208D0944206D0AE +:101590005B1C6343B3EB800F01DB072030BD0020F1 +:1015A00030BD70B514460D46064611F01BF960B902 +:1015B0000DB1A54201D90C2070BD002409E000BF87 +:1015C00056F8240011F00EF908B1102070BD641C0B +:1015D000E4B2AC42F4D3002070BDF0B50024059D08 +:1015E00010B1A94203D851E009B90020F0BD09208B +:1015F000F0BD055D8DB107197E78112E3FD00FDC4F +:101600000A2E3CD2DFE806F03B1624242A2A2C2C92 +:101610003333025D72BB641CE4B28C42F9D3E4E75D +:101620001D2E2CDAA6F11206042E28D2DFE806F0D1 +:1016300027271018022DDAD1BD781D70072D01D291 +:101640006D0701D40A20F0BD157845F0010515E0BD +:10165000EE43F60707E0012D07D010E00620F0BDAD +:101660002E07A6F18056002EF5D06046F0BD157805 +:10167000AE0701D50B20F0BD45F002051570055DE4 +:10168000641C2C44E4B28C4202D9B0E74FF4485CAD +:101690008C42AED3A9E710B50278540809D00122D4 +:1016A00043F20223012C07D0022C0DD0032C13D1BE +:1016B0000FE00020087005E080790324B4EB901F50 +:1016C0000AD10A70002010BD8079B2EB901F03D1BF +:1016D000F7E780798009F4D0184610BD154A917B50 +:1016E00039B1D17B022908D0032908D043F2022066 +:1016F00070470146101D01F0CFBB032100E001211E +:1017000001700020704738B50C460546694601F067 +:10171000C3FB00280DD19DF80010207861F347002D +:10172000207055F8010FC4F80100A888A4F805003E +:10173000002038BDB401002038B51378C0B10228AC +:1017400016D0FAA46D46246800944C7905EB9414E5 +:10175000247864F34703137003280ED003F0FE00CF +:1017600010700868C2F801008888A2F8050038BD2A +:1017700023F0FE0313700228EED1D8B240F001002E +:10178000EEE730B50C46097897B0222902D208203E +:1017900017B030BD28218DF80010ADF80200132AD3 +:1017A00003D03B2A01D00720F2E78DF804200BA9D3 +:1017B00068460AF036FD050003D121212046FFF7D7 +:1017C00065FE2846E4E700B597B023218DF80010A8 +:1017D000ADF802001088ADF804005088ADF806009E +:1017E000D088ADF80A009088ADF808000020ADF868 +:1017F0000C00ADF80E000BA968460AF012FD09E6D0 +:101800002DE9FF470220CA4E8DF804000027708A98 +:10181000ADF80600B84643F202094DE001A80DF00C +:1018200002F9050006D0708AA8B3A6F81280ADF8B8 +:1018300006803FE0039CA07F01072DD504F1240022 +:101840000090A28EBDF80800214604F1360301F095 +:10185000A2FF050005D04D452BD0112D3DD0FFDF57 +:101860003BE0A07F20F00800A077E07F810861F3D3 +:101870000000C10861F34100E07794F8210000F016 +:101880001F0084F820002078282827D1292120460D +:10189000FFF7FCFD22E015E040070BD5BDF808007E +:1018A000214604F10E02FFF78EFF05000DD04D45D5 +:1018B00010D100257F1CFFB202200DF0F5F8401C6E +:1018C000B842ABD8052D12D008E0A07F20F004006C +:1018D000A07703E0112D00D0FFDF0025BDF8060042 +:1018E0007082052D05D0284604B0BDE8F087A6F823 +:1018F00012800020F8E72DE9F047040000D1FFDF57 +:1019000020788B4E20F00F00801C20F0F00070300B +:10191000207060680178091F1529E6D2DFE801F020 +:10192000580B0C5CF80C0DF8F835580C0C587F5817 +:10193000580C0C585800FFDFD7E785882846FFF77A +:101940006DFD040000D1FFDF06F0BEFC707C21219C +:1019500040F0040070742046FFF798FD284607F019 +:10196000A1F9284603F05AFF284604F0B3FF2946A0 +:10197000022010F0F4FEA07F20F01000A077FFF707 +:101980003FFF0028B1D0FFDFAFE786883046FFF782 +:1019900045FD00B9FFDF60688078012800D0FFDFD7 +:1019A00060688179304607F0D9FB05009DD006F0CC +:1019B00088FC040000D1FFDF207820F00F00801C9D +:1019C00020F0F000203020706680062020726572C2 +:1019D000BDE8F04706F078BC86883046FFF71EFD6C +:1019E000050000D1FFDF06F06FFC60683146C0885B +:1019F000288160680089688160684089A881022028 +:101A000010F0ADFE0020A875A87F00F003000228AA +:101A100092D1FFF7F5FE00288ED0FFDF65E78078D2 +:101A20003C2803D0002502280AD000E00125002729 +:101A300020B13C2802D0022800D0FFDF17B1A0E07F +:101A40000127F5E706F040FC707C002D40F008000F +:101A500070746AD165680221B5F80480AD1C4746F0 +:101A600038460DF06DF80446032138460DF068F84D +:101A70008246052138460DF063F881460421384638 +:101A80000DF05EF8074604B9FFDFBAF1000F00D190 +:101A9000FFDFB9F1000F00D1FFDF07B9FFDF22211F +:101AA0002046FFF7F3FC2879012832D00227A07FD7 +:101AB000062167F30100A077288B2081688B608165 +:101AC000A88BA08105F1120001F01DFA18B3687906 +:101AD000800700D5FFDF6979E07D61F34700E0759D +:101AE000D5F80600A0616889A083062105F10C00E5 +:101AF00001F009FAF0B130794108607861F34700EC +:101B00006070D6F80500C4F80200B6F809001AE0C3 +:101B100044E00127CBE7E07D20F0FE00801CE0756B +:101B2000D5F81200A061E88ADEE71DE00302FF019C +:101B3000B4010020607820F0FE00801C6070E8682E +:101B4000C4F80200288AE080F748007884F8220070 +:101B5000A07F00F00301404607F096F8012F03D064 +:101B6000022F0ED0FFDFC0E63078032800D0FFDF61 +:101B70000021084610F0F3FDBDE8F047012001F018 +:101B800065B9B078132800D0FFDF0021072010F0DE +:101B9000E6FDBDE8F0471120FFF7DCBB2046BDE8BD +:101BA000F04702F0BBB82DE9F047054600780C4637 +:101BB00000270109DFF874A391463E46012974D03D +:101BC00000234FF6FF70022970D0072909D00A2997 +:101BD0006DD0FFDFA9F800600CB12780668000207F +:101BE00083E6D5F804C004F108029CF8001012291D +:101BF00067D00EDC04F118080A2913D004DC04298C +:101C00007ED007297DD13FE00E2951D01129F9D18D +:101C1000BAE0132976D0142975D017293CD0182999 +:101C2000F0D1D4E011270926002C76D0BCF804802E +:101C3000A4F804806868807920729AF811104046F0 +:101C400021F004018AF8111004210CF094FF052101 +:101C500040460CF090FF002140460CF08CFF012123 +:101C600040460CF088FF032140460CF084FF02211F +:101C700040460CF080FF062140460CF07CFF072117 +:101C800040460CF078FFA5E712271026BCF80400A8 +:101C9000214601F019F99DE71C270926A4B3BCF8D9 +:101CA0000200A080686800793CE1E0E00BE1D8E048 +:101CB0001B27092644B30420207268684088A0804E +:101CC00088E79CF802003C282AD0102718260CF13F +:101CD000020CCCB1BCF80200A080BCF818006082F5 +:101CE000BCF818002082BCF81A00A082BCF81C00C6 +:101CF000E0829CF805000CF10601FFF71DFD04E0F1 +:101D000018E0ADE098E072E007E09CF8040010B144 +:101D10000120E07309E00220FBE7A9F800605EE71C +:101D20001B270926002CF8D023729AF8111021F0F5 +:101D30000801DCE01D273726002CEED0A080696862 +:101D40000879491DFFF7F8FC686890F82B00A0752A +:101D50006868C0780428E07D13D020F00100E075A9 +:101D600069681F22C97861F34200E0756968C97A21 +:101D700061F3C700E075696840460C311EF047F812 +:101D800028E740F00100EAE71D273726002CC4D0E1 +:101D9000A0806968481D0B7901461846FFF7CCFC06 +:101DA000696804F10F02C87A0C31FFF7C5FC686856 +:101DB000807CA0756868C178E07D61F3420020F006 +:101DC000F900E0751F2140461EF0BAF802E720270F +:101DD0001026002CA1D0A080686804F10902407A86 +:101DE00020726868C11C8078FFF7A6FCF2E6212704 +:101DF0000B26002C91D0BCF80400A0806868807885 +:101E0000207268688079012805D0022803D0032851 +:101E10000ED0FFDF002060726868C079012805D00D +:101E2000022803D0032805D0FFDF0020A072D1E6EE +:101E30000420F0E70420F9E704271026002CA6D0A0 +:101E4000BCF80200A0806868808820816868C0882B +:101E5000608168680089A08168684089E081B9E68E +:101E60004A4621462846BDE8F04702F0CCB8287A19 +:101E7000012803D0022814D0FFDFABE61F2710266D +:101E8000002C84D06888A08068892081A88960811E +:101E9000E889A081288AE0819AF8111021F02001B8 +:101EA00025E0122710266888214601F00DF8002C45 +:101EB00090D0687800F00700052887D19AF81110B3 +:101EC00021F0020113E0297A072931D2DFE801F07D +:101ED0000512120404042300C2E71B270926002C64 +:101EE00088D0A08023729AF8111021F001018AF89D +:101EF00011106FE61B270926002CA0D0A080287A9D +:101F0000012806D0032020729AF8111021F0100148 +:101F1000EDE70220F7E701270926002C8FD068881B +:101F2000A080687A207255E610000020B4010020DD +:101F3000FFDF4FE610B5F94896B08078132802D03D +:101F4000082016B010BD22208DF800000BA96846AD +:101F50000AF067F904460021072010F000FC204633 +:101F6000EFE700B5ED4897B08078122801D008203F +:101F700045E41E208DF8000000208DF802008DF849 +:101F800003000BA968460AF04CF90028F0D10021A3 +:101F9000072010F0E4FB1120FFF7DCF900202EE40D +:101FA00000B5DE4897B00078012814D01B208DF8CA +:101FB000000000208DF802000BA968460AF031F9F4 +:101FC000002807D10021084610F0C9FB012000F0CD +:101FD0003DFF002013E4082011E42DE9F041CF4C2F +:101FE000002740B102281DD0072842D0082800D081 +:101FF000FFDFBDE8F081FFF7D3FF0028F9D106F03D +:1020000060F90028F5D0017821F00F01891C21F03A +:10201000F00120310170077206F056F9607C40F043 +:1020200001001DE08EB23046FFF7F8F9050000D13F +:10203000FFDF28782128DCD006F043F990B1017841 +:1020400021F00F01891C21F0F001103101700221F3 +:1020500001724680AF7506F037F9607C40F00200EF +:102060006074C6E729463046BDE8F0411322FFF709 +:1020700088BBA578122D03D0132D04D0FFDFB8E75D +:10208000FFF76FFF01E0FFF755FF0028B1D106F021 +:1020900018F90028ADD0017821F00F01891C21F03A +:1020A000F00120310170122D07D00221017206F0DB +:1020B0000BF9607C40F01000D2E70121F6E72DE932 +:1020C000F04116460C00074600D1FFDF307820F0C3 +:1020D0000F00801C20F0F0001030307020780128B4 +:1020E00003D0022817D0FFDF83E73846FFF796F9C1 +:1020F000050000D1FFDF0220A87506F0E5F8206892 +:10210000B0606068F060208930828448417C41F092 +:10211000200141746DE73846FFF780F9050000D1D2 +:10212000FFDF61884FF6FF70814209D1A2888242A9 +:1021300006D129463846BDE8F0411322FFF721BBFE +:10214000814201D1A08848B106F0BEF82068B06095 +:102150006068F06020893082002006E07823002249 +:102160003946022010F05EFA0120A87541E730B52B +:10217000054697B00C46084610F034FB80BB0020A3 +:102180000121203D082D6DD2DFE805F004264145F0 +:10219000515866740021082010F0BAFA10B11120CD +:1021A00017B030BD24208DF80000D4F80200CDF81F +:1021B0000200A0798DF806000BA968460AF031F8F4 +:1021C000050055D1082300221146184610F02AFABE +:1021D00008284DD0FFDF4BE0606810F045FB08B1E8 +:1021E0001020DDE74B208DF800002088ADF80200BC +:1021F0006088ADF804000BA968460AF012F80500E3 +:1022000036D1606878B3BDF83010018030E02068C6 +:1022100002F09AF909E04C220AE000BF8DF80210A2 +:1022200015E000BF8DF8020011E0054620E04522D0 +:102230008DF800202278D207F4D0EFE738208DF80F +:1022400000002088ADF802006088ADF804000BA9FA +:10225000684609F0E6FFE8E7207828B1A0F11B0105 +:10226000E12902D3072503E01B202D490025087032 +:10227000284695E72078C00802D16078C00801D0D0 +:1022800007208DE73F208DF8000020788DF80300AF +:1022900060788DF80400207830B100208DF80200BD +:1022A000617819B1002102E00120F7E7022108431B +:1022B000B8E730B5054697B00C46084610F0B6FAB8 +:1022C00008B110206CE7202D07D0212D2AD0222D17 +:1022D00028D0232D26D0072062E72088FFF79EF81C +:1022E00020B10078222804D2082059E743F20200E6 +:1022F00056E725208DF800002088ADF802000BA9D4 +:10230000684609F08EFF0028DCD1DDF83210C4F8F1 +:1023100002109DF83610A17142E70000B4010020C0 +:102320001000002006203BE7FC487047FB49091FCE +:1023300008747047F948001F007C00F001007047E6 +:1023400038B5F6481421001F1DF0D8FD012000F01B +:102350007DFD1120FEF7FEFFF149FB20EF4C0870D8 +:10236000241F611D684605F00CFF9DF800102079C0 +:1023700061F3470020F0010020710020A0734FF4AA +:102380006170A0810220E073FFF72FF800B1FFDF3A +:1023900000F042FE01F07DFC38BD10B50C463E2138 +:1023A00020461DF0ABFDA07F20F00300A077202089 +:1023B00020700020A07584F8230010BD70477CB504 +:1023C000054610F00FFA08B110207CBDD34C241F35 +:1023D000211D60680090A06801902846FFF793F9DE +:1023E0000028F2D1FFF701F80028EED000996160D3 +:1023F000BDF8041021819DF80610A1727CBD10B5B6 +:10240000044610F013FA08B1102010BDC34922464B +:10241000091F0879491D4008FFF78EF9002010BDFB +:102420002DE9F0479CB00D4604004FF0000812D093 +:102430000822FFF7B6F800281CD1002609E000BFEB +:1024400054F8260004A9FFF726F9002812D1761CBB +:10245000F6B2AE42F4D32F460A2006AD0DF1440A7F +:102460008DF8180026465146284609F0DAFE20B1BC +:1024700043F203201CB0BDE8F0874046DFF89C82A1 +:10248000A8F1040888F803002EB300244FF00B09CC +:102490001DE000BF56F8240005A9FFF7FCF800B1C5 +:1024A000FFDF9DF81400A87056F8240050F8011FB3 +:1024B000C5F803108088A5F8070085F800905146FC +:1024C000284609F0AEFE00B1FFDF641CE4B2BC4256 +:1024D000E0D388F803700020CCE72DE9F0479EB0E8 +:1024E0001546894604001ED00F4608222946FFF7EC +:1024F00058F8002811D1002613E000BF54F8260038 +:1025000005A9103000F0C8FC002806D13FB157F8EB +:10251000260010F067F910B110201EB0ABE7761C52 +:10252000F6B2AE42EAD30026A5F101081CE000BFD6 +:1025300006F1010A0AF0FF0712E000BF54F8260076 +:10254000017C4A0854F827100B7CB2EB530F05D1DD +:102550000622113011311DF02EFCC0B17F1CFFB2DC +:10256000AF42EBD30AF0FF064645E1DBC8462F46F3 +:10257000342007AD0DF148098DF81C002646494668 +:10258000284609F04EFE28B143F20420C5E743F285 +:102590000520C2E796B300242CE000BF56F82400C3 +:1025A000A91C103000F078FC00B1FFDF56F82400C1 +:1025B000102250F8111FC5F803108088A5F80700F5 +:1025C00056F8241005F109001DF021FCB8F1000FA8 +:1025D00015D058F82410102205F119001DF017FC31 +:1025E000322028704946284609F01BFE00B1FFDF63 +:1025F000641CE4B2BC42D1D3012206E004E005F140 +:10260000190001F095FFEBE700224946284600F04B +:102610006EFC002081E770B596B0044610F0E2F839 +:1026200018B9606810F029F910B1102016B070BD0B +:1026300060884AF2B811884206D8384D20786E4634 +:102640002D1F18B1012804D00720EFE7FEF7CDFEBB +:102650001AE06078022804D0032802D043F2022056 +:10266000E4E7E87317208DF80000E97B0020CDF83F +:102670000200ADF80600022932D003292DD0FFDF79 +:102680000BA9684609F0CDFD0028CFD1606801F0A4 +:1026900042FF207870B101208DF80200F01C01F09B +:1026A00047FF4E208DF800000BA9684609F0B9FDE0 +:1026B00000B1FFDF6088A8B1A88180B2ADF8020048 +:1026C00030208DF800000BA9684609F0AAFD00B182 +:1026D000FFDF2078A8730020A8E78DF80700CFE778 +:1026E0004020FAE74FF46170E6E710B5044610F0B9 +:1026F0009DF820B9606838B110F0B6F808B1102024 +:1027000010BD606801F014FF0448001F81896180DA +:10271000C17B6170807B2070002010BDB80100205B +:10272000100000202DE9F0419CB0054600208DF8F6 +:1027300064008DF860008DF830008DF868001E464A +:1027400014468846284610F098F818B9204610F02C +:1027500094F810B110201CB04BE455EA040018D0D6 +:102760001F270CAB19AA414628460097FEF735FFF4 +:102770000028F0D11AAB18AA314620460097FEF780 +:102780002CFF0028E7D19DF86000C00703D00A2085 +:10279000E1E70720DFE701AF7DB11A208DF80400E3 +:1027A0008DF8068042462946F81C1DF030FB0DA925 +:1027B00001A809F036FD0028CDD17CB120208DF88C +:1027C00004008DF8066032462146F81C1DF01FFB00 +:1027D0000DA901A809F025FD0028BCD1FF499DF8ED +:1027E000300048700020B6E72DE9F0439BB04FF071 +:1027F0000008FBA104468DF83480D1E90001CDE941 +:10280000190120460FF0EEFF90B92078012803D17E +:1028100060680FF0E7FF58B9F04D4FF00109A87B51 +:1028200050B1E87B022807D1606810F026F818B193 +:1028300010201BB0BDE8F0832878012801D00820C3 +:10284000F7E707200CF038F918B9207848B10128CB +:1028500007D0FEF799FD30B1687C10F00C0F08D15D +:1028600003E01220E5E71320E3E7C10701D1800769 +:1028700001D51120DDE7608943F6E172A0F1200166 +:102880009142217807D301297ED100287CD1A189EA +:10289000002979D10FE0022901D0032901D1A02814 +:1028A00072D3012907D06978C90704D0A18900290A +:1028B0006AD0B42968D8217831B1012908D0022919 +:1028C00004D0032960D10AE0002609E0022607E0CF +:1028D00008B9A08908B1042609E0012607E003260B +:1028E000A87B50B1E87B022807D1606828B10DA908 +:1028F0006068FEF7D0FE00289BD1207A30B1012815 +:1029000006D0022806D003286DD105E0002704E098 +:10291000012702E0022700E003270EB1022E0ED1AC +:102920006FB1E87880B36878800702D043F2012065 +:102930007FE7022E03D1022F55D0032F53D018204A +:102940008DF838006089ADF83A006089ADF83C0038 +:102950008DF83E600DF13F00FEF7C0FE00B1FFDFD5 +:102960009DF834008DF840002078012806D0A87B1F +:1029700068B1E87B02280AD1606840B1606850F80D +:10298000011FCDF8411000E02DE0808802E04046B4 +:10299000CDF84180ADF845008DF84870A07BC0F3BC +:1029A0004002014662F35F01C0F3800041EA80000B +:1029B00019A9085C8DF84700A8B169460EA809F06E +:1029C00030FC0028B4D11B208DF838008DF83A90E7 +:1029D00069460EA809F025FC0028A9D19DF8010040 +:1029E0001B2819D101E0072023E7052E09D2DFE8D3 +:1029F00006F0030305050300032000E0022000F0B9 +:102A000025FA012E0AD0A08940B100228300114688 +:102A100010460FF007FE08B103200AE7002008E780 +:102A20002DE9FC4107460D46032608460FF025FF19 +:102A3000002864D13846FEF7F1FC040005D0207868 +:102A4000222805D20820BDE8FC8143F20200FAE703 +:102A5000A07F00F0030C2DB129466046FEF76BFD08 +:102A60000600F0D15D48BCF1010F05D0BCF1020FAA +:102A700017D0FFDF3046E6E7A27D2946012A02D0C3 +:102A8000407C800701D51120DDE729B9684600F0B8 +:102A9000D0FB0028D7D16946384606F0E2FA064650 +:102AA000E8E7A17D022914D1407C800611D425B12C +:102AB000A07F40070BD4002100E00121384606F03A +:102AC00018FB0600D6D1A075002DD3D002E0112648 +:102AD000D0E7A5B12A4621463846FEF774FE0646E1 +:102AE0001128C7D1A07F4107C4D4296844F80E1F1C +:102AF0006968616040F0040020740026BAE7102085 +:102B0000A1E770B50C460546FEF788FC010005D02C +:102B100022462846BDE87040FEF733BE43F202006D +:102B200070BD00B597B042218DF800108DF80200FD +:102B30000BA9684609F075FB17B000BD0123FEF72D +:102B400070BC00231A461946FEF76BBC30B597B02F +:102B500004460FF047FE10B1102017B030BD2046DC +:102B600000F088F90028F8D11C4DA878112801D070 +:102B70000820F2E7FEF708FC20B1687CC00603D508 +:102B80001120EAE71320E8E72078800701D5E878EC +:102B900018B31D208DF800002078022200F00100FB +:102BA0008DF802006088ADF80400A088ADF806003A +:102BB0002078C0F3400102EA500001438DF809106B +:102BC00002A8FEF78BFD00B1FFDF0BA9684609F0F4 +:102BD00028FB0028C1D11E2006E01DE0B401002022 +:102BE00007060504030201008DF8000001208DF89E +:102BF000020000208DF803000BA9684609F011FBC4 +:102C00000028AAD1E08800F051F90400A5D11220D3 +:102C1000FEF7A0FB2046A0E707209EE7F0B597B09F +:102C200015460C4607460FF028FE38B920460FF02F +:102C3000D9FD18B928460FF0D5FD10B1102017B0F6 +:102C4000F0BDB84E707C10F0180F01D1400701D5CF +:102C50001120F4E7204600F00DF90028EFD12946B5 +:102C60000220FEF768FC0028E9D1B078112803D0D3 +:102C7000122801D00820E2E72078C0F34001394350 +:102C800011D0800700D577B906200BF015FF40B1B1 +:102C90002078800701D5F07828B1B078122804D0C8 +:102CA00007E01220CBE70720C9E7FFF75AF9002811 +:102CB000C5D1FEF769FB022801D21320BFE721200E +:102CC0008DF800006088ADF80200A088ADF804001F +:102CD0002078C0F340008DF806002078800716D4D5 +:102CE0003878420808D0012A18D043F20221022A7B +:102CF00018D0032A18D115E0C00700D002208DF8A3 +:102D0000070057F8010F0290B888ADF80C000DF1DC +:102D10000E00FEF7E3FC58B1032090E7C00705D092 +:102D20000320ECE7C00701D0084688E70120E6E76A +:102D30002888ADF810006888ADF81200A888ADF8B2 +:102D40001400E888ADF816000020ADF81800ADF8C2 +:102D50001A000BA9684609F064FA00288BD1E088B4 +:102D600000F0A4F8040086D11320FEF7F3FA204601 +:102D700065E730B5054697B00C4608460FF056FD9E +:102D800008B11020E9E62846FEF748FB38B1017883 +:102D9000222902D3807F800604D40820DDE643F296 +:102DA0000200DAE613208DF80000ADF802500BA9FE +:102DB000684609F036FA0028E4D19DF932107F29DF +:102DC00001D02170C9E60520C7E630B5054697B0A9 +:102DD0000C4608460FF006FD08B11020BDE6284657 +:102DE000FEF71CFB20B10078222804D20820B4E6AC +:102DF00043F20200B1E62178E8B2C90802D1617855 +:102E0000C90801D00720A8E652218DF80010ADF8BE +:102E1000020020788DF8050060788DF80600207893 +:102E200030B100208DF80400617819B1002102E072 +:102E30000120F7E7022108438DF804000020ADF8D7 +:102E400008000BA9684609F0ECF986E630B5354D67 +:102E5000040008D0012C04D0022C06D0032C04D08E +:102E6000FFDF2C7030BDFFDFFBE728780128F8D0AA +:102E7000FFDFF6E7418843F6FD730A1F9A4209D245 +:102E80008088042806D3B0F5804F03D8884201D843 +:102E900000207047072070470278520804D0012AAA +:102EA00002D043F202207047FEF7F5BB10B548B1DF +:102EB00083000022114607200FF0B4FB072801D041 +:102EC00003202AE4002028E470B50C0006460DD04B +:102ED000FEF7A4FA050000D1FFDFA6802889208133 +:102EE000288960816889A081A889E08170BD10B5BA +:102EF00002F0010282703122027009F092F900287A +:102F000000D0FFDF09E410B500231A4603E0845C1B +:102F10002343521CD2B28A42F9D30BB10020D0E72E +:102F20000120CEE7B40100204FF0E0224FF4004131 +:102F30000020C2F8801120490870204990020860E2 +:102F4000704730B51C4D04462878A04218BF002CAD +:102F500002D0002818BFFFDF2878A04208BF30BD8C +:102F60002C701749154A0020ECB1164DDFF858C0F7 +:102F7000131F012C0DD0022C1CBFFFDF30BD0860D9 +:102F800003200860CCF800504FF400001060186077 +:102F900030BD086002200860CCF800504FF040704F +:102FA0001060186030BD086008604FF060701060FD +:102FB00030BD00B5FFDF00BD1A00002008F501405C +:102FC00000F50040FC02002014F5004018B117285D +:102FD00002D2072070471720084908800020704758 +:102FE00006480088704770B50C46054607F0B5FBEB +:102FF00021462846BDE8704008F070BC460000201D +:1030000018FFFFFFDBE5B151001002008F00FFFF4A +:1030100084000000404B4C00FE48002101604160EC +:1030200070472DE9F743044692B091460120FFF71F +:103030007DF960680FF018FC58B160680FF01DFC56 +:1030400038B9607800F00300022802D10020FFF7B1 +:103050006DF94D4648460FF0C5FB18B1102015B06C +:10306000BDE8F08329460120FEF765FA0028F6D175 +:1030700001258DF842504FF4C050ADF840000022B9 +:1030800010A9284603F0B8FE0028E8D18DF8425078 +:103090004FF42850ADF8400000261C2168460796E2 +:1030A0001CF04EFF9DF81C0007AF20F00F00401CE5 +:1030B00020F0F00010308DF81C0020788DF81D00F5 +:1030C00061789DF81E000DF1400861F3420040F068 +:1030D00001008DF81E009DF8000008AA40F00200D3 +:1030E0008DF800002089ADF83000ADF832606089BD +:1030F000ADF834000B9760680E900AA9CDF82880CF +:10310000684603F078FC0028A9D1C24CBDF8200025 +:1031100008AA20808DF8425042F60120ADF8400008 +:103120009DF81E000AA920F00600801C20F0010076 +:103130008DF81E000220ADF83000ADF8340013A861 +:103140000E90684603F057FC002888D1BDF8200097 +:103150006080211D484600F032F9002887D18DF8A3 +:10316000425042F6A620ADF840001C216846079662 +:103170001CF0E6FE9DF81C00ADF8345020F00F0066 +:10318000401C20F0F00010308DF81C009DF81D0050 +:1031900008AA20F0FF008DF81D009DF81E000AA966 +:1031A00020F0060040F00100801C8DF81E009DF804 +:1031B00000008DF8445040F002008DF80000CDE989 +:1031C0000A8711A80E90ADF83050684603F013FC42 +:1031D000002899D1BDF82000E08000203FE73EB5EF +:1031E00004460820ADF8000020460FF0FBFA08B1B5 +:1031F00010203EBD21460120FEF79DF90028F8D1A0 +:103200002088ADF804006088ADF80600A088ADF80D +:103210000800E088ADF80A007E4801AB6A46808865 +:10322000002103F0E3FFBDF800100829E1D00320DE +:103230003EBD1FB50446002002900820ADF80800EE +:10324000CDF80CD020460FF0CDFA10B1102004B00C +:1032500010BD704802AA81884FF6FF7004F09EF9F5 +:103260000028F4D1BDF80810082901D00320EEE7AA +:10327000BDF800102180BDF802106180BDF8041077 +:10328000A180BDF80610E180E1E701B582B002201F +:10329000ADF800005F4802AB6A464088002103F0A9 +:1032A000A5FFBDF80010022900D003200EBD1CB5FB +:1032B000002100910221ADF8001001900FF0B6FA44 +:1032C00008B110201CBD53486A4641884FF6FF7074 +:1032D00004F064F9BDF800100229F3D003201CBDEE +:1032E000FEB514460E460746FFF724F828B13046CF +:1032F0000FF078FA18B11020FEBD0F20FEBDF82C9B +:1033000001D90C20FEBD38460FF06CFA414D18BBB8 +:10331000288801A903F0F8F80028F3D138788DF84F +:103320000500288801A903F03FFF0028EAD100909A +:103330009DF800009DF8051040F002008DF8000097 +:10334000090703D040F008008DF80000288869467E +:1033500003F0C7FE0028D5D1ADF8084028883346D1 +:1033600002AA002103F042FFBDF80810A142C9D013 +:103370000320FEBD7CB50546002000900190088822 +:10338000ADF800000C46284601950FF06DFA18B90B +:1033900020460FF04BFA08B110207CBD15B1BDF8E6 +:1033A000000050B11B486A4601884FF6FF7004F0D8 +:1033B000F5F8BDF8001021807CBD0C207CBD30B537 +:1033C00093B0044600200D460090142101A81CF083 +:1033D000B7FD1C2108A81CF0B3FD9DF80000CDF836 +:1033E00008D020F00F00401C20F0F00010308DF8C5 +:1033F00000009DF8010020F0FF008DF801009DF80D +:10340000200040F002008DF8200001208DF84600D9 +:1034100002E000001200002042F60420ADF8440053 +:1034200011A801902088ADF83C006088ADF83E00FE +:10343000A088ADF84000E088ADF842009DF8020099 +:1034400006AA20F00600801C20F001008DF8020082 +:103450000820ADF80C00ADF810000FA8059001A9E8 +:1034600008A803F0C8FA002803D1BDF81800288086 +:10347000002013B030BD000010B504460FF0B2F9C3 +:1034800008B1102010BD2078C0F30210042807D81E +:103490006078072804D3A178102901D8814201D28D +:1034A000072010BDE078410706D421794A0703D4EC +:1034B000000701D4080701D5062010BD002010BD6B +:1034C00010B513785C08C37F64F30003C3771478E6 +:1034D000A40864F34103C3771078C309887863F3C1 +:1034E0004100887013781C094B7864F347134B70C4 +:1034F0001378DB0863F3000088705078487110BDC2 +:1035000010B5C4780B7864F300030B70C4786408BA +:1035100064F341030B70C478A40864F382030B7056 +:10352000C478E40864F3C3030B700379117863F380 +:103530000001117003795B0863F341011170037995 +:103540009B0863F3820111700079C00860F3C30126 +:10355000117010BD70B514460D46064604F0B1FE5C +:1035600080B10178142221F00F01891C21F0F001B3 +:10357000A03100F8081B21461CF08EFCBDE870400D +:1035800004F0A2BE29463046BDE870401322FEF783 +:10359000F8B870B514460E46054604F092FE70B1B8 +:1035A000017821F00F01891C21F0F0012031017018 +:1035B000458021688160BDE8704004F085BE3146D9 +:1035C0002846BDE870401322FEF7DBB810B5FE4C6C +:1035D00094F8300000280CD104F120014FF6FF725E +:1035E000A1F110000CF0F3FE00B1FFDF012084F820 +:1035F000300010BD2DE9F047064608A8894690E83E +:1036000030041F469046142128461CF099FC0021E6 +:10361000CAF80010B8F1000F03D0B9F1000F03D1C0 +:1036200014E03878C00711D020680FF0FFF8E8BB2D +:10363000B8F1000F07D120681230286020681430DC +:1036400068602068A8602168CAF800103878800790 +:1036500028D560680FF008F940BBB9F1000F2DD0F4 +:10366000FEF762FE0168C6F8B4118188A6F8B811A9 +:10367000807986F8BA01FFF7A9FFDFF84C8308F1DB +:103680002008C5F80C80626862B196F8B40106F2B1 +:10369000B51140081032FEF74FF81022414660681D +:1036A0001CF0B5FB3878400712D500E003E0A068B5 +:1036B0000FF0BCF850B11020BDE8F087606800281A +:1036C000F9D0E8606068C6F8B001EBE7A06828614F +:1036D0000020F1E730B5054608780C4620F00F00D1 +:1036E000401C20F0F001103121700020607095F82E +:1036F000230030B104280FD0052811D0062814D09B +:10370000FFDF20780121B1EB101F04D295F82000D3 +:1037100000F01F00607030BD21F0F000203002E0AA +:1037200021F0F00030302070EBE721F0F000403065 +:10373000F9E710B510B190F8A94044B1A24890F84B +:10374000354000205CB108601060186010BD00F1C9 +:10375000A8040C6000F1D001F8301160F5E79A4C34 +:1037600034340C60F0E700B58BB00723CDE90212CA +:103770008DF801300191944900236431059109933A +:1037800001468DF8103068460CF0F9FD002800D095 +:10379000FFDF0BB000BD30B597B00C462C251A9951 +:1037A0008DF80050ADF80200B3B118680190586868 +:1037B0000290ADF80C2010220DF10E001CF027FB3A +:1037C0000BA9684608F02DFD002803D1A17F41F028 +:1037D0001001A17717B030BD00200190E8E72DE976 +:1037E000F0470646008A8CB080B20D468246FDF74F +:1037F00015FE0446744F3078283FDFF8CC814FF037 +:103800000009122873D2DFE800F072E93509367733 +:103810007E98A8F3E7E6E5E4E35BE3E3A07F00F04E +:103820000300012806D0002150460BF092F9050054 +:1038300003D101E00121F7E7FFDF98F85C100906EA +:1038400002D5D8F860000BE0032105F121000EF04D +:1038500075FCD5F821005D49B0FBF1F201FB1200C7 +:10386000C5F8210070686866B068A86620782528C9 +:1038700000D0FFDFECE0A07F00F00300012806D0BD +:10388000002150460BF065F9060003D101E001214B +:10389000F7E7FFDF7078810702D52178252904D06A +:1038A00040F0010070700CB006E70220287096F816 +:1038B0002000287106F121003136C5E90206F2E741 +:1038C000A07F00F00300012806D0002150460BF035 +:1038D00040F9040003D101E00121F7E7FFDF607840 +:1038E000C10605D51320287041346C60DBE7CEE1BA +:1038F00040F008006070D6E73348082128380EF001 +:103900001DFC032016E02A208DF8000010220DF186 +:10391000020071681CF07BFA10220DF11200B168F0 +:103920001CF075FA284968462C3908F07AFC00B179 +:10393000FFDF042028706F60B5E7E07FC00600D588 +:10394000FFDFB0680090B38806220321504605F0DF +:1039500002FA0028A7D0FFDFA5E704B9FFDF7168EE +:1039600021B1102204F124001CF051FA2821204634 +:10397000FDF78CFDA07F00F0030002280ED104F1BA +:103980002400002300901A4621465046FFF703FF0B +:10399000112807D029212046FDF778FD307A84F8D8 +:1039A000200080E7A07F000700D5FFDF14F81E0F7E +:1039B00040F008002070A4F81690C4F81890C4F8DD +:1039C0001C90617808460AE0F401002040420F0094 +:1039D00030E058E196E08CE062E009E03FE061F31E +:1039E0008200410861F3C3006070307AE0705AE7EA +:1039F000A07F00F00300012806D0002150460BF004 +:103A0000A8F8040003D101E00121F7E7FFDF02215C +:103A100004F175000EF092FB1020287004F5DA70A6 +:103A20006860B4F875002882FE486C346C61C5E9A2 +:103A3000028038E7A07F00F00300012805D00021B4 +:103A400050460BF086F818B901E00121F8E7FFDFD6 +:103A50000CB0324621465046BDE8F0477AE504B93D +:103A6000FFDF207821289CD93079012802D0022854 +:103A70000AD103E0E07F40F01000E07798F85C1096 +:103A800041F0010188F85C10324621465046FFF7AC +:103A900061FD0CB02046BDE8F0472321FDF7F6BCE0 +:103AA000327901230321504605F004F878B1112042 +:103AB0002870327905F10800AA80031D00900321C7 +:103AC000504605F074F8002891D0FFDFEBE6A07FA8 +:103AD00000F00300012806D0002150460BF039F811 +:103AE000040003D101E00121F7E7FFDF3079207006 +:103AF000D9E60321504605F0CFFB002899D11220CA +:103B00002870D0E6A07F00F00300012806D0002135 +:103B100050460BF01EF8050003D101E00121F7E744 +:103B2000FFDF95F8740000F00300012878D1A07F32 +:103B300000F00307E07FC0F3400616B1012F04D068 +:103B40002BE095F89000C0072AD0D5F8AC1119B336 +:103B500095F87320087C62F387000874E27FD5F83B +:103B6000AC1162F341000874D5F8AC1166F30000A3 +:103B70000874AEB1D5F8AC01102204F124017835F7 +:103B80001CF045F9287E40F001002876287820F0C6 +:103B9000010005F8780900E016B1022F04D02CE0EE +:103BA00095F87800C00726D0D5F8A81119B395F874 +:103BB0007320087C62F387000874E27FD5F8A811AF +:103BC00062F341000874D5F8A81166F30000087488 +:103BD0008EB1D5F8A801102204F1240178351CF02B +:103BE00016F9287840F0010005F8180B287820F025 +:103BF000010005F89009022F41D0002000EB4000A1 +:103C000005EBC00090F87800800709D595F86C00A6 +:103C1000D5F8B021400805F16D011032FDF78CFD9B +:103C200005208DF8000015F8740F6A4600F00300B7 +:103C30008DF8010028798DF80200287F8DF80300A7 +:103C400021465046FFF7A5FC2078252805D02128DD +:103C500007D0FFDF2078222803D922212046FDF754 +:103C600015FCA07F00F0030001280AD00021504677 +:103C70000AF081FF00283FF422AEFFDF13E60120A7 +:103C8000BCE70121F3E7716881F801900BE6FFDFE3 +:103C900009E670B5634C0025103C14F85C0F20F069 +:103CA0008000207065600CF032FB5E49A1F11000CD +:103CB00004F099FA04F82C5C0620607259487C30B4 +:103CC00020615030A0611030E06170BD70B50D46CC +:103CD000FDF7A4FB040000D1FFDF4FF4DE7128469E +:103CE0001CF02EF94F485430686104F1240028611B +:103CF000A07F00F00300012808D0022105F5907094 +:103D00000CF006FB002800D0FFDF70BD0121F5E7B5 +:103D10000A46014602F590700CF01ABB70B50546D4 +:103D200040689CB0017808290DD00B2903D00C29DC +:103D300036D101218171686886883046FDF76EFBB7 +:103D4000040033D131E046883046FDF767FB0400BC +:103D500000D1FFDF2078212822D0282822D16868CE +:103D600002210C3001F0B2F9E0B168680821001DB1 +:103D700001F0ACF9B0B12D208DF80000ADF8026073 +:103D8000102204F1240101A81CF041F80BA9684697 +:103D900008F047FA00B1FFDF29212046FDF776FB46 +:103DA0001CB070BD04F090FAFAE7FFDFA07F00F0CE +:103DB0000301022902D120F01000A07720782128E9 +:103DC0000AD06868817909B1807880B1A07F00F05D +:103DD0000300022859D0FFDFA07F00F00300022873 +:103DE000DED1FDF70DFD0028DAD0FFDFD8E704F0C3 +:103DF0006BFAE07FC10723D0800701D5062000E0E1 +:103E0000052084F82300207829281BD02428E3D11A +:103E1000314606200EF0A3FC22212046FDF736FB9A +:103E2000A07F01E00402002000F0030001282AD056 +:103E3000002130460AF09FFE0028CDD0FFDFCBE7FF +:103E40000420DEE7A07F00F00300012806D0002157 +:103E500030460AF07EFE050003D101E00121F7E7BC +:103E6000FFDF25212046FDF711FB0F208DF85800BC +:103E700016A905F590700CF062FA0228ACD0002863 +:103E8000AAD0FFDFA8E70121D3E704F01DFAA3E7DA +:103E90002DE9F0438BB09946154688460646FDF756 +:103EA000BDFA04004ED0207822284BD3232849D0D5 +:103EB000E07FC00646D4A07F00F00300012806D0B2 +:103EC000002130460AF045FE070002D00BE0012138 +:103ED000F7E7A07F00F00300012804D1012130465C +:103EE0000AF02EFE074601AB02AA03A93846FFF7E7 +:103EF00020FC039800B9FFDF4FB1039807F59077D6 +:103F000087612078222806D0242804D007E003996E +:103F10000020886103E025212046FDF7B7FA0398C9 +:103F20000B21417046628580C0E9028902990161D6 +:103F30000199416104A90CF022FA022802D000285C +:103F400000D0FFDF0BB0BDE8F08330B587B0054689 +:103F5000FDF764FA017822292FD9807F00F0030051 +:103F6000012806D0002128460AF0F3FD040003D101 +:103F700001E00121F7E7FFDF227801230321284632 +:103F800004F098FD002818D011208DF80400227844 +:103F900003A80090ADF8082004AB0321284604F0E4 +:103FA00006FE00B1FFDF01A904F590700CF0C7F91F +:103FB000022802D0002800D0FFDF07B030BD10B5C6 +:103FC00086B00446FDF72AFA0178222919D9807FA4 +:103FD00000F00300012806D0002120460AF0B9FDB8 +:103FE000040003D101E00121F7E7FFDF12208DF883 +:103FF0000000694604F590700CF0A1F9002800D08B +:10400000FFDF06B010BD2DE9F05F05460C46002726 +:104010000078904601093E46BB4604F1080A022991 +:104020007ED0072902D00A2909D142E068680178C8 +:10403000082905D00B292CD00C292AD0FFDFC6E196 +:1040400014271C26002C6CD04088A080FDF7E6F9D0 +:104050005FEA000900D1FFDF99F8170052464008D7 +:1040600009F11801FDF768FB68688089208268689B +:104070004168C4F812108068C4F81600A07E20F0D1 +:10408000060040F00100A07699F81E0040F04001C3 +:104090004DE01A270A26002CD5D08088A080FDF795 +:1040A000BDF9050000D1FFDF51462846FFF712FB9E +:1040B0008DE10CB1288BA080287A0E287ED006DCFA +:1040C00001287CD0022808D0032804D135E010282C +:1040D00076D0112875D0FFDF79E11E270926002C44 +:1040E000B1D0A088FDF79AF95FEA000900D1FFDF9F +:1040F000287B00F003000128207A1BD020F001006B +:104100002072297B890861F341002072297BC9084C +:1041100061F382002072297B090961F3C30001E089 +:104120004AE117E1207299F81E0040F0800189F8F9 +:104130001E104CE140F00100E2E713270D26002C91 +:10414000AAD0A088FDF76AF98146807F00F00300BD +:10415000012806D00021A0880AF0FBFC050003D14D +:1041600001E00121F7E7FFDF99F81E0000F00302EC +:10417000012A59D0A86E817801F003010129217A22 +:1041800054D021F00101217283789B0863F341012F +:1041900021728378DB0863F38201217283781B0923 +:1041A00063F3C3012172037863F30611217243782C +:1041B00063F3C711217284F809B003E05EE0A4E064 +:1041C0008CE09CE0C178A172012A32D04279E17A78 +:1041D00062F30001E1724279520862F34101E17237 +:1041E0004279920862F38201E1724279D20862F365 +:1041F000C301E1720279217B62F30001217302792C +:10420000520862F3410121730279920862F382013C +:1042100021730079C00860F3C301217399F800008D +:1042200023285AD9262168E0686EA4E741F00101ED +:10423000A9E70279E17A62F30001E172027952089A +:1042400062F34101E1720279920862F38201E17244 +:104250000279D20862F3C301E1724279217B62F3F1 +:10426000000121734279520862F3410121734279BE +:10427000920862F3820121734079CBE71827102658 +:10428000002C67D0A088FDF7C9F88246807F00F037 +:104290000300012807D00021A0880AF05AFC5FEA39 +:1042A000000903D101E00121F6E7FFDFE868A06023 +:1042B00099F8010040F0040189F8011099F8020012 +:1042C000800708D5012020739AF8000023287ED9A2 +:1042D0002721504663E084F80CB078E015270F26BC +:1042E000C4B3A088FDF79AF8814606225146E868D3 +:1042F00007F0FFFF0120A073AEE048464FE016270D +:1043000009263CB3287B207261E0297BFE48022904 +:104310000CD019270E26ECB101290DD003291AD093 +:1043200004291BD0052919D0FFDF23E01B2709260C +:10433000BCB30121217205E001212172617A21F0D3 +:104340000301617210F85C1F4A08520062F3060113 +:1043500001700FE02BE00220207207E0687B052946 +:1043600000F00F0040F0800020721BD0607A20F037 +:1043700003006072A088FDF751F8054600782128F7 +:1043800025D0232800D0FFDFA87F00F003000128FC +:1043900010D00021A0880AF0EEFB22212846FDF76C +:1043A00075F814E0607A20F00300401CE1E7A8F8FB +:1043B000006011E00121EDE70CB16888A080287A47 +:1043C00003282BD004280AD005284BD0FFDFA8F8FB +:1043D00000600CB1278066800020BDE8F09F1527A3 +:1043E0000F26002CE3D0A088FDF718F8807F00F09E +:1043F0000300012806D00021A0880AF0AAFB0500CE +:1044000003D101E00121F7E7FFDFD5F82100062203 +:10441000514607F06EFF84F80EB0D8E7172709263B +:10442000002CC4D0A088FCF7F9FF8146807F00F003 +:104430000300012806D00021A0880AF08AFB0500AD +:1044400003D101E00121F7E7FFDFA878800701D55C +:10445000022000E00120207299F800002328B6D93C +:1044600027214AE719270E26002CA0D0A088FCF7A8 +:10447000D5FF5FEA000900D1FFDFC4F808B0A4F857 +:104480000CB084F808B0A07A40F00300A07299F84C +:104490001F1061F38200A07299F81F1001EA510108 +:1044A00061F3C300A072687A00F0030001288ED186 +:1044B000607A40F00400607299F81E00E97A00F01A +:1044C0000300012813D0607B61F300006073AA7AB7 +:1044D000217B62F300012173EA7A520862F3410002 +:1044E0006073A87A400860F3410121736FE7207B75 +:1044F00061F300002073AA7A617B62F300016173AB +:10450000EA7A520862F341002073A87A400860F307 +:10451000410161735BE710B57B4C30B1014610225D +:1045200004F120001BF073FC012084F8300010BD62 +:1045300010B50446FFF74AF8734920461022BDE83B +:10454000104020311BF063BC70B56F4C06004FF07B +:10455000000514D00EF046F908B110250DE0062133 +:10456000304607F0ADFE411C06D0206614F85C0F03 +:1045700040F08000207000E00725284670BD14F848 +:104580005C0F20F08000F5E7007810F00F0204D0F7 +:10459000012A05D0022A0CD110E0000909D10AE055 +:1045A0000009012807D0022805D0032803D00428D9 +:1045B00001D0072070470870002070470620704720 +:1045C00005282AD2DFE800F003070F171F0008783C +:1045D00020F0FF001EE0087820F00F00401C20F0C3 +:1045E000F000103016E0087820F00F00401C20F09A +:1045F000F00020300EE0087820F00F00401C20F082 +:10460000F000303006E0087820F00F00401C20F069 +:10461000F0004030087000207047072070472DE9F7 +:10462000F041804688B00D46002708460EF025F977 +:10463000A8B94046FCF7F2FE040003D020782228F7 +:1046400015D104E043F2020008B0BDE8F08145B99D +:10465000A07F010603D500F00300022801D010203E +:10466000F2E7A07FC10601D4010702D50DB10820F1 +:10467000EAE7254991F85C10C90701D01120E3E76A +:10468000E17FC90601D50D20DEE700F00300022816 +:1046900005D125B12846FEF7EFFE0700D4D1A07F53 +:1046A00000F00300012806D0002140460AF051FA2C +:1046B000060002D00CE00121F7E7A07F00F0030024 +:1046C00001280BD0002140460AF03AFA060007D034 +:1046D000A07F00F00300022804D009E00121F2E7E6 +:1046E0000420B1E725B12A4631462046FEF7E8FE10 +:1046F00007AB1A4669463046FFF71BF8009800B929 +:10470000FFDF0C20009901E0F4010020487006F55D +:104710009070C1F82480486100200881A07F00F0DB +:104720000300012828D0EDB302200871301D8861F4 +:10473000707840090877B078C0F34000487728784F +:1047400000F00102887F62F301008877E27F62F364 +:1047500082008877E27F520862F3C3008877B278DC +:1047600062F304108877A878C87701F121022846FF +:104770002031FEF7C5FE22E001200871287800F004 +:104780000102087E62F3010008762A78520862F37B +:10479000820008762A78920862F3C30008762A78A5 +:1047A000D20800E007E062F30410087624212046D6 +:1047B000FCF76CFE0BE0032008710520087625212C +:1047C0002046FCF763FEA07F20F08000A07701A9BF +:1047D00000980BF0D4FD022801D000B1FFDF38466D +:1047E00032E72DE9FF4FF94A0D4699B09A4607CABC +:1047F00014AB002783E807001998FCF70FFE0600AA +:1048000006D03078262806D008201DB0BDE8F08FED +:1048100043F20200F9E7B07F00F00309B9F1010F9C +:1048200003D0B9F1020F07D008E03DB91B98FEF79D +:1048300023FE0028E9D101E01B9878BBB07F00F08F +:104840000300012806D0002119980AF082F904001B +:1048500003D101E00121F7E7FFDF852D25D007DC3B +:10486000D5B1812D1BD0822D1BD0832D08D11AE00C +:10487000862D1CD0882D1CD0892D1CD08A2D1CD0B3 +:104880000F2020710F281AD001208DF83400201D30 +:104890000E902079A8B158E10020F2E70FE0012046 +:1048A000EFE70220EDE70320EBE70520E9E706202C +:1048B000E7E70820E5E70920E3E70A20E1E707202A +:1048C000A3E7B9F1010F17D0D4E9195080460220AF +:1048D000019001200090A87898F80210C0F3C00061 +:1048E000C1F3C00108405FEA000B5DD050460DF0F7 +:1048F00079FF00286CD12DE0D4E9198501200190C1 +:1049000002200090214630461B9AFEF7D9FD1B98E5 +:10491000007800F00101A87861F30100A870F17F30 +:1049200061F38200A870F17F490861F3C300A870A9 +:10493000A17861F30410A870607840092870A0780D +:10494000C0F3400068701B988078E87000206871A0 +:104950002871C0E7DAF80C000DF044FFC0BBDAF8AC +:104960001C000DF03FFF98BBDAF80C00A060DAF8ED +:104970001C00E06098F80100A17800F0010041EA15 +:104980004000A07098F80210C0B2C1F30011891E57 +:104990000840A070002084F82000009906F117005C +:1049A00002290BD001210AE098F80110A07801F04B +:1049B0000101FD2242EA41010840E2E7002104EB47 +:1049C000810188610199701C022902D0012101E056 +:1049D00028E0002104EB81018861A87800F0030041 +:1049E000012849D198F8020000F00300012843D1C2 +:1049F000B9F1010F04D12A1D691D1B98FEF780FD36 +:104A0000297998F8040001408DF82C10687998F8FD +:104A1000052010408DF8300001432DD050460DF098 +:104A2000E1FE08B11020F0E60AF1100004F5D4719F +:104A300004F17C020490B9F1020F3CD00090CDE962 +:104A4000012100210BAB5A462046FEF7D3FD00287A +:104A5000E9D104F5D67104F19402B9F1010F30D017 +:104A600004980090CDE9012100210CAB5A46204664 +:104A7000FEF7C0FD0028D6D1A078800740D4A878E2 +:104A800098F80210C0F38000C1F38001084337D0CA +:104A9000297898F8000014AAB9F1010F17D032F85C +:104AA00010204B00DA4012F0030718D0012F1ED05F +:104AB000022F12D11DE0CDF800A0CDE90121012186 +:104AC000C0E7CDF800A0CDE901210121CDE732F802 +:104AD00011204300DA4002F00307032F07D0BBF197 +:104AE000000F0DD0012906D0042904D008E00227C8 +:104AF000F5E70127F3E7012801D0042800D10427B6 +:104B0000F07F40F001006BF34100F077A07881075F +:104B10004FF003000CD5A071BBF1000F15D100BF01 +:104B20008DF85C0017AA31461998FEF732FD0CE0AB +:104B30000221022F18D0012F18D0042F22D00020DC +:104B4000A071F07F20F00100F07725213046FCF7BE +:104B50009DFC0DA904F590700BF0F1FB10B102283B +:104B600000D0FFDF002050E6A171D9E7A1710D212F +:104B700004F124001BF0E4F9607840F0020060705A +:104B80000420CDE70120A071DFE72DE9F04387B0D5 +:104B9000914688460446FCF741FC070006D0387869 +:104BA000272806D0082007B0BDE8F08343F20200B2 +:104BB000F9E7B87F00F00300012809D00021204662 +:104BC00009F0C7FF040006D104E00000DC02020087 +:104BD0000121F4E7FFDFA679012E08D0B8F1000F1C +:104BE0000FD048460DF0FEFDB8B11020DBE7B9F15B +:104BF000000F25D1B8F1000F09D0B8F1010F1FD176 +:104C000020E0022E05D0032E05D0FFDF28E00C2582 +:104C100026E0012524E0022522E0B8F1020F03D0AE +:104C2000B8F1010F0AD00BE0032E09D100251022A4 +:104C3000494604F121001BF0EAF811E0022E01D0F0 +:104C40000720B0E70025102104F121001BF056F9E0 +:104C50005FEA090004D0062107F032FBC4F8210006 +:104C60006078252140F0020060703846FCF70EFCA9 +:104C70006078C10713D020F00100607002208DF829 +:104C8000000004F1210002908DF804506946FF30C5 +:104C90000BF055FB022804D018B1FFDF01E084F8C7 +:104CA000205000207FE730B587B00D460446FCF762 +:104CB000B5FB88B1807F00F0030001280FD00021F0 +:104CC000204609F046FF04000ED028460DF08AFD6C +:104CD00038B1102007B030BD43F20200FAE70121DD +:104CE000EEE76078400701D40820F3E7294604F195 +:104CF0004100202205461BF08AF8607840F0100041 +:104D0000607001070FD520F00800607013208DF847 +:104D10000000694604F5907001950BF010FB022825 +:104D200001D000B1FFDF0020D4E770B592B00D468E +:104D30000646FCF773FB18B10178272940D103E040 +:104D400043F2020012B070BD807F00F00300012822 +:104D500006D00021304609F0FCFE040003D101E03A +:104D60000121F7E7FFDFA079022829D1A078C00749 +:104D700026D0002302220321304603F09BFE08B315 +:104D80000C208DF805000A9604A804F59074022200 +:104D900000900694ADF80C2005AB0321304603F0DB +:104DA00006FF00B1FFDF04208DF808008DF81C50CD +:104DB0000BA901A80BF0E3FA00B1FFDF0020C1E767 +:104DC0000820BFE71120BDE770B5064686B014463F +:104DD0000D4608460DF006FD18B920460DF026FDDB +:104DE00010B1102006B070BDA6F57F40FF380ED080 +:104DF0003046FCF713FB38B1417822464B08811C42 +:104E00001846FCF799FC07E043F20200EAE7204667 +:104E1000FDF7F5FA0028E5D11021E01D0DF08EF91F +:104E2000E21D29466846FEF79EFC102204F1170099 +:104E300001991AF0ECFF0020D4E72DE9F041044677 +:104E400090B015468846002708460DF016FD18B9A3 +:104E500028460DF012FD18B1102010B0BDE8F08109 +:104E60002046FCF7DBFA060003D03078272818D15B +:104E700002E043F20200F0E7B07F00F003000128F7 +:104E800006D00021204609F064FE040003D101E0B1 +:104E90000121F7E7FFDF6078400702D5A07880079F +:104EA00001D40820D9E7B07F00F00300012818D012 +:104EB000D4E91901407800B1B5B1487810B1B8F122 +:104EC000000F11D0C5B1EA1D02A8E168FEF74BFC46 +:104ED000102205F1170003991AF06DFF30B1042775 +:104EE0000AE0D4E91910E5E70720B6E71022E91D2A +:104EF00004F131001AF08BFFB8F1000F06D0102238 +:104F000008F1070104F121001AF081FF60782521E2 +:104F100040F0020060703046FCF7B8FA6078C107D4 +:104F200015D020F00100607002208DF8200004F1FF +:104F300021000A9010300B908DF8247008A9EF30F2 +:104F40000BF0FDF9022804D018B1FFDF01E084F86E +:104F50002070002081E7F8B515460E460746FCF79D +:104F60005DFA040004D02078222804D00820F8BD7F +:104F700043F20200F8BDA07F00F00300022802D037 +:104F800043F20500F8BD30460DF02CFC18B9284658 +:104F90000DF028FC08B11020F8BD00953288B31C34 +:104FA00021463846FEF7F7FB112814D00028F3D12C +:104FB000297C4A08E17F62F30001E1772A7C62F3F1 +:104FC0004101E177297C890884F82010A17F21F034 +:104FD0008001A177F8BDA17F0907FBD4D6F80200B4 +:104FE000C4F83600D6F80600C4F83A003088A08627 +:104FF0001022294604F124001AF009FF287C4108F8 +:10500000E07F61F38200E077297C61F3C300E07701 +:10501000287C800884F82100A07F40F00800A07759 +:105020000020D3E770B596B00D46064613B10720B1 +:1050300016B070BDFCF7F2F9040007D020782228E2 +:1050400002D3A07F400604D40820F1E743F2020017 +:10505000EEE7C5B12D208DF80000ADF802601022FA +:10506000294601A81AF0D3FE287C4108E07F61F3AD +:105070000000E077297C61F34100E077287C80081C +:1050800084F8200004E02E208DF80000ADF80260C6 +:105090000BA9684607F0C5F8A17F21F04001A17770 +:1050A000C6E770B50D46FCF7B9F9040005D02846EF +:1050B0000DF0BCFB20B1102070BD43F2020070BDAA +:1050C00029462046FEF706FB002070BD05E000BF24 +:1050D00010F8012B0AB100207047491E89B2F7D29F +:1050E00001207047F0B50078059F1E4614460D4616 +:1050F000012800D0FFDF0C2030803A203880002CBF +:1051000008D0287A052806D0287B012800D0FFDFA8 +:1051100017206081F0BDA889FBE72DE9F04786B034 +:10512000144691F80C900E9A0D46B9F1010F0BD070 +:10513000102100782E8A8846052807D0062833D00B +:10514000FFDF06B0BDE8F0870221F2E7E8890C2115 +:1051500000EB400001EB4000188033201080002C51 +:10516000EFD0E889608100271AE00096688808F18E +:10517000020301AA696900F06FFE06EB0800801CBB +:1051800007EB470186B204EB4102BDF804009081B1 +:105190000DF1060140460E320BF092F97F1CBFB2B2 +:1051A0006089B842E1D8CCE734201080E889B9F1B1 +:1051B000010F11D0122148430E301880002CC0D0AE +:1051C000E88960814846B9F1010F00D002202073C0 +:1051D00000270DF1040A1FE00621ECE7009668881D +:1051E00008F1020301AA696900F036FE06EB080027 +:1051F000801C86B2B9F1010F12D007EBC70004EB97 +:105200004000BDF80410C18110220AF102011030E3 +:105210001AF0FDFD7F1CBFB26089B842DED890E76E +:1052200007EB470104EB4102BDF80400D0810AF10D +:105230000201404610320BF043F9EBE72DE9F0474D +:105240000E4688B090F800C096F80C80378AF58931 +:105250000C20109902F10C044FF0000ABCF1030F6E +:1052600008D0BCF1040F3ED0BCF1070F7DD0FFDFAA +:1052700008B067E705EB850C00EB4C001880312087 +:105280000880002AF4D0A8F1060000F0FF0955813B +:1052900025E0182101A81AF053FE009770884346B4 +:1052A00001AA716900F0D8FDBDF804002080BDF8A6 +:1052B0000600E080BDF808002081A21C0DF10A0163 +:1052C00048460BF0FDF8B9F1000F00D018B184F892 +:1052D00004A0A4F802A007EB080087B20A346D1EF0 +:1052E000ADB2D6D2C4E705EB850C00EB4C001880BC +:1052F00032200880002ABBD0A8F1050000F0FF0989 +:10530000558137E000977088434601AA716900F023 +:10531000A3FD9DF80600BDF80410E1802179420844 +:1053200060F3000162F34101820862F38201C20866 +:1053300062F3C301020962F30411420962F34511E9 +:10534000820962F386112171C0096071BDF80700FE +:10535000208122460DF1090148460BF0B1F818B141 +:1053600084F802A0A4F800A000E007E007EB080022 +:1053700087B20A346D1EADB2C4D279E7A8F102003B +:1053800084B205FB08F000F10E0CA3F800C0352331 +:105390000B80002AA6D055819481009783B2708833 +:1053A0000E32716900F058FD62E72DE9F84F1E4694 +:1053B0000A9D0C4681462AB1607A00F58070D08043 +:1053C000E089108199F800000C274FF000084FF099 +:1053D0000E0A0D2873D2DFE800F09E070E1C28305D +:1053E0003846556A73737300214648460095FFF7A7 +:1053F00079FEBDE8F88F207B9146082802D003286B +:1054000000D0FFDF378030200AE000BFA9F80A8013 +:10541000EFE7207B9146042800D0FFDF3780312062 +:105420002880B9F1000FF1D1E3E7207B91460428F1 +:1054300000D0FFDF37803220F2E7207B9146022840 +:1054400000D0FFDF37803320EAE7207B17460228B1 +:1054500000D0FFDF3420A6F800A02880002FC8D09D +:10546000A7F80A80C5E7207B1746042800D0FFDF95 +:105470003520A6F800A02880002FBAD04046A7F813 +:105480000A8012E0207B1746052802D0062800D0AB +:10549000FFDF1020308036202880002FA9D0E0893F +:1054A0007881A7F80E80B9F80200B881A1E7207BC7 +:1054B0009146072800D0FFDF37803720B0E72AE089 +:1054C0004FF0120018804FF038001700288090D05D +:1054D000E0897881A7F80E80A7F8108099F800007D +:1054E0000A2805D00B2809D00C280DD0FFDF80E753 +:1054F000207B0C2800D0FFDF01200AE0207B0D2854 +:1055000000D0FFDF042004E0207B0E2800D0FFDF66 +:10551000052038736DE7FFDF6BE770B50C46054675 +:10552000FBF77CFF20B10078222804D2082070BD50 +:1055300043F2020070BD0521284609F00AFB2060F5 +:1055400008B1002070BD032070BDFFB585B00746CF +:10555000089814460D46022628B908A93846FFF7D0 +:10556000DCFF002840D108980121801D04F097FD40 +:10557000ADF8080002464DB100233146384603F02D +:1055800099FA98B30898007880BB05E0207809283C +:1055900020D00F282BD0FFDF03A8009004ABBDF86C +:1055A00008203146384603F002FB00281CD1089839 +:1055B00002A9801D60606780DDE90332204604F0A7 +:1055C0007BFD40B3072824D2DFE800F01A1823231C +:1055D000211C1E00072600233146384603F06AFAD4 +:1055E0000028D9D143F2040009B0F0BD06E0002341 +:1055F0003146384603F05EFA0028CDD11120F3E79A +:105600000020F1E70820EFE743F20300ECE7072072 +:10561000EAE70320E8E703980090BDF80830042289 +:105620003146384603F097FB0028DDD1002DDBD052 +:1056300008990D70D8E710B586B01C46AAB10423AE +:105640008DF800301388ADF808305288ADF80A2084 +:105650008A788DF80E200988ADF80C1000236A4670 +:105660002146FFF772FF06B010BD1020FBE770B5B2 +:105670000D46052109F06DFA040000D1FFDF29462F +:10568000A01DBDE8704004F0F3BC70B596B00C46A8 +:105690000646FFF7ECFF05462146304601F0CFFDF8 +:1056A0000121304601F0E9FD002D25D13046FBF700 +:1056B000B5FE050000D1FFDF95F822001B281BD99D +:1056C000172C19D93A208DF80000ADF8026095F832 +:1056D0002200211D884201D9241D00E00446ADF8B6 +:1056E000044040F64800ADF806000BA9684606F0F5 +:1056F00098FD002800D0FFDF16B070BD2DE9F843FB +:105700000D468046002602F0DCFD0446287812286B +:1057100078D2DFE800F07753533C355532321332FC +:1057200032320932323232322879001FC0B20228B6 +:1057300001D0102810D114BBFFDF34E004B9FFDF23 +:105740000521404609F005FA0078032806D0042810 +:105750000BD0072827D0FFDF072654E02879801FC9 +:10576000C0B202281FD050B1F6E72879401FC0B25E +:10577000022818D0102816D0EEE704B9FFDF12E097 +:1057800004B9FFDF287901280DD1172136E0052162 +:10579000404609F0DEF9070000D1FFDFB91D4046A1 +:1057A00004F03FFC2CB12A462146404600F064FB41 +:1057B00029E013214046FDF7A4F924E0FFDF22E0B1 +:1057C00004B9FFDF0521404609F0C3F9070000D105 +:1057D000FFDF6946B81D04F02CFC00B1FFDFA9888B +:1057E000172901D2172200E00A46BDF800008242C4 +:1057F00002D9014602E005E01729C6D34046FFF76B +:1058000044FFD0E7FFDF3046BDE8F8830020087092 +:10581000881D04F0FABB891D04F00ABC70B505466A +:10582000052109F096F9040000D1FFDFA11D2846EB +:10583000BDE8704004F0F5BB2DE9F74F90B04FF094 +:10584000000AADF830A0ADF804A047880C46054624 +:105850000521384609F07DF9060000D1FFDF24B1AB +:10586000A780A4F806A0A4F808A0297A04F11000E3 +:105870003827C91E4FF00C0B4FF001084FF01209EA +:1058800002900F297ED2DFE801F0F2F1F08008D318 +:10589000898EA03DDCF3EEB7B7003078022800D047 +:1058A000FFDFA8890BEBC001ADF804103021ADF883 +:1058B0003010002C25D06081B5F80E8000271DE047 +:1058C00004EBC709317989F80E107188A9F80C101A +:1058D000CDF800806888042305AA296900F0BCFA85 +:1058E000BDF81410A9F8101008F10400BDF8161046 +:1058F0007F1C1FFA80F8A9F81210BFB26089B84265 +:10590000DED809E13078022800D0FFDFE9890BEB0F +:10591000C100ADF804003020ADF8300095F80CB0AF +:10592000002CABF10400C0B20F90EAD06181B5F851 +:105930001090002723E000BFCDF8009068885B46F8 +:1059400003AA696900F088FA09EB0B001FFA80F9D5 +:1059500004EBC70808F10C0204A90F980AF0B0FD87 +:1059600018B188F80EA0A8F80CA0BDF80C10A8F883 +:105970001010BDF80E107F1CA8F81210BFB260897D +:10598000B84200E0C7E0D7D8C6E00CA8009001AB51 +:10599000224629463046FFF7C0FBBDE03078082894 +:1059A00005D0FFDF03E03078082800D0FFDFE8896A +:1059B0001030ADF804003620ADF83000002C3FD098 +:1059C000A98961817188A18127E03078092800D0F8 +:1059D000FFDFA88900F10C01ADF804103721ADF804 +:1059E0003010002C2CD06081E8890090AB89688849 +:1059F00004F10C02296955E0E8893921103080B2A0 +:105A0000ADF80400ADF83010002C72D0A989618186 +:105A1000287A10280AD002212173E989E181288A95 +:105A20000090EB8968886969029A3BE00121F3E7FD +:105A30000CA8009001AB224629463046FFF7FEFB3A +:105A40006AE030780A2800D0FFDFADF80490ADF8A6 +:105A500030704CB3A9896181A4F810A0A4F80EA0FD +:105A600084F80C8058E020E002E030E038E041E0CB +:105A700030780B2800D0FFDF288AADF83070123064 +:105A8000ADF8040084B104212173A9896181E989F9 +:105A9000E181298A2182688A00902B8A688804F132 +:105AA0001202696900F0D8F936E030780C2800D08D +:105AB000FFDFADF80490ADF8307044B305212173D9 +:105AC000A4F80AA0A4F80EA0A4F810A024E00CA842 +:105AD000009001AB224629463046FFF703FB1BE04E +:105AE0000CA8009001AB224629463046FFF75DFC2A +:105AF00012E00DE00B203B21ADF80400ADF83010B2 +:105B000034B1A4F80680A4F808A084F80AA003E041 +:105B10001299088014E0FFDF1299BDF80400088094 +:105B200074B1BDF830002080BDF804006080287A90 +:105B3000032805D0102803D0112801D086F800A032 +:105B400013B00020BDE8F08F2DE9F84356880F46CA +:105B5000804615460521304608F0FBFF040000D1C1 +:105B6000FFDFA41D00943B46414630466A6804F0BE +:105B700057FC49E670B50D46052108F0EAFF040020 +:105B800000D1FFDF2946A01DBDE8704004F05CBADB +:105B900070B50D46052108F0DCFF040000D1FFDFE1 +:105BA0002946A01DBDE8704004F081BA2DE9F043FC +:105BB0008BB00D461446814606A9FFF7AEFC0028BF +:105BC00014D14FF6FF7601274FF420588CB10320F3 +:105BD0008DF800001020ADF8100007A8059007AA66 +:105BE000204604A90AF08BFC78B107200BB0BDE871 +:105BF000F0830820ADF808508DF80E708DF8000085 +:105C0000ADF80A60ADF80C800CE00698A17801713F +:105C1000218841808DF80E70ADF80850ADF80C80E9 +:105C2000ADF80A606A4602214846069BFFF78DFCE4 +:105C3000DCE708B501228DF8022042F60202ADF839 +:105C400000200A4603236946FFF7F5FC08BD08B5A6 +:105C500001228DF8022042F60302ADF800200A4628 +:105C600004236946FFF7E7FC08BD00B587B079B1AA +:105C700002228DF800200A88ADF808204988ADF886 +:105C80000A1000236A460521FFF75FFC07B000BD3C +:105C90001020FBE709B10723CDE40720704770B55A +:105CA00088B00D461446064606A9FFF736FC0028C4 +:105CB0000ED17CB10620ADF808508DF80000ADF88B +:105CC0000A40069B6A4608215C803046FFF73DFC8F +:105CD00008B070BD05208DF80000ADF80850F0E761 +:105CE00000B587B059B107238DF80030ADF8082012 +:105CF000039100236A460921FFF727FCC6E710201D +:105D0000C4E770B588B00C460646002506A9FFF723 +:105D100004FC0028DCD106980121801D04F0BFF9A5 +:105D20009CB12178062921D2DFE801F02005051673 +:105D30000318801E80B2C01EE28880B20AB1A36838 +:105D40001BB1824203D90C20C2E71020C0E704290E +:105D500004D0A08850B901E00620B9E7012913D08A +:105D6000022905D004291CD005292AD00720AFE735 +:105D700009208DF800006088ADF80800E088ADF8D3 +:105D80000A00A068039023E00C208DF800006088D2 +:105D9000ADF80800E088ADF80A00A0680A25039075 +:105DA00016E00D208DF800006088ADF80800A0888E +:105DB000ADF80A00E088ADF80C00A0680B2504904F +:105DC00006E00E208DF8000060788DF808000C25A4 +:105DD0006A4629463046069BFFF7B7FB78E700B5D1 +:105DE00087B00F228DF80020ADF8081000236A4616 +:105DF0001946FFF7AAFB49E700B587B071B1022247 +:105E00008DF800200A88ADF808204988ADF80A10FE +:105E100000236A460621FFF798FB37E7102035E795 +:105E200070B586B0064601200D46ADF808108DF815 +:105E30000000014600236A463046FFF786FB040057 +:105E400008D12946304601F0EBF90021304601F037 +:105E500014FA204606B070BDF8B51C4615460E462D +:105E6000069F08F0D1FF2346FF1DBCB231462A46EB +:105E7000009408F0B8FBF8BD10B5488008781446C7 +:105E800020F00F00C01C20F0F00090300B4608708E +:105E90001822214603F1080019F0FEFFBDE810406A +:105EA00002F012BA18B18178012938D101E010202E +:105EB0007047018842F60112881A914231D018DCED +:105EC00042F60102A1EB020091422AD00CDC41B360 +:105ED000B1F5C05F25D06FF4C050081821D0A0F5EF +:105EE0007060FF381BD11CE001281AD002280AD1AB +:105EF00017E0B0F5807F14D008DC012811D002280B +:105F00000FD003280DD0FF2809D10AE0B0F5817F1A +:105F100007D0A0F58070033803D0012801D00020FD +:105F200070470F2070470B2826D008DC1BD2DFE813 +:105F300000F01C2025251A25292325271E001128BD +:105F40001CD008DC0C2817D00D281DD00F2815D028 +:105F5000102808D110E0822809D0842810D0852884 +:105F600010D0872812D003207047002070470520EA +:105F7000704743F203007047072070470F207047B7 +:105F800004207047062070470C20704743F202003F +:105F9000704708280DD2DFE800F00406040C0C0856 +:105FA0000C0A002070471120704707207047082016 +:105FB00070470320704738B50C46050041D069464C +:105FC000FEF7E2FA002819D19DF80010607861F31D +:105FD000020060706946681CFEF7D6FA00280DD1F1 +:105FE0009DF80010607861F3C5006070A978C1F376 +:105FF0004101012903D0022905D0072038BD2178AD +:1060000021F0200102E0217841F0200121704107B8 +:1060100004D0A978C90861F386106070607810F028 +:10602000380F07D0A978090961F3C710607010F024 +:10603000380F02D16078400603D5207840F0400048 +:106040002070002038BD70B5044600200880154639 +:106050006068FFF7B0FF002816D12089A189884227 +:1060600011D860688078C0070AD0B1F5007F0AD8DF +:1060700040F20120B1FBF0F200FB1210288007E093 +:10608000B1F5FF7F01D90C2070BD01F201212980FB +:10609000002070BD10B50478137864F3000313700A +:1060A0000478640864F3410313700478A40864F36B +:1060B000820313700478E40864F3C3031370047854 +:1060C000240964F3041313700478640964F345131A +:1060D00013700078800960F38613137031B108786B +:1060E000C10701D1800701D5012000E0002060F345 +:1060F000C713137010BD4278530702D002F0070394 +:1061000006E012F0380F02D0C2F3C20300E0012310 +:106110004A7863F302024A70407810F0380F02D0D8 +:10612000C0F3C20005E0430702D000F0070000E022 +:10613000012060F3C5024A7070472DE9F04F95B019 +:106140000D00804615D0B8F1000F16D01221284658 +:1061500019F0D4FE4FF6FF7B05AA0121584605F041 +:1061600091FE0024264637464FF420596FF4205AFA +:1061700075E0102015B0BDE8F08F0720FAE700BFEA +:106180009DF81E0001280AD1BDF81C0048450BD01F +:1061900010EB0A000AD001280CD002280CD0042CE5 +:1061A0000ED0052C0FD10DE0012400E00224BDF833 +:1061B0001A6008E0032406E00424BDF81A7002E027 +:1061C000052400E00624BDF81A10414547D12C747F +:1061D000BEB34FF0000810AA4FF0070ACDE90282C3 +:1061E000CDE900A80DF13C091023CDF810904246EE +:1061F0003146584605F0F9FE08BBBDF83C002A467A +:10620000C0B210A90AF05CF9C8B9AE81CFB1CDE92E +:1062100000A80DF1080C0AAE40468CE84102132399 +:1062200000223946584605F0E0FE40B9BDF83C0072 +:10623000F11CC01EC0B22A1D0AF042F910B10320A1 +:1062400098E70AE0BDF82900E881062C05D19DF801 +:106250001E00A872BDF81C00288100208AE705A84E +:1062600005F01CFE00288BD0FFF75DFE82E72DE9CC +:10627000F8439846DDE9087614460D00814600D1C2 +:10628000FFDF0CB1012100E0002105F1080004F05E +:1062900000FD3080024600232146484602F00AFCF9 +:1062A00040B10097328843462146484602F07FFCC1 +:1062B000BDE8F883072C01D01120F9E743F2040070 +:1062C000F6E72DE9F0438BB00D46DDE912878146F4 +:1062D0001C461646142103A819F032FE01200221A3 +:1062E0008DF810108DF80C008DF81170ADF8146059 +:1062F00064B1A178C90709D08DF81600E088ADF81F +:106300001A00A088ADF81800A06807900AA908A88C +:10631000CDE9000109AB002229464846FFF7A7FF57 +:1063200000280ED1DDE90801CDE9001008350AABDF +:106330004246029503A9484605F066F820B1FFF7EA +:1063400028FE0BB0BDE8F08308980090BDF8283017 +:1063500004220021484602F0FEFCF2E7F0B58BB0C3 +:1063600000240646069407940727089405A8099474 +:10637000019400970294CDE903400D461023224674 +:10638000304605F032FE78B90AA806A901940097B4 +:106390000294CDE90310BDF814300022294630469E +:1063A00005F0F9FB002801D0FFF7BDFD0BB0F0BDF3 +:1063B00005F0A1BA2DE9FC410C468046002601F00B +:1063C00080FF054620780D2871D2DFE800F099079C +:1063D0000B90189A3C3C55768C7B8100404601F02E +:1063E0009FFF8EE00421404608F0B3FB070000D178 +:1063F000FFDF07F10801404604F0E2FB50E0042112 +:10640000404608F0A6FB070000D1FFDFE088ADF8AA +:106410000000002038809DF80000010704D5C00668 +:1064200002D5A088388005E09DF80100400668D5B7 +:10643000A088788005B9FFDF22462946404601F052 +:10644000CFFB02265DE0E188ADF800109DF8011059 +:1064500009060ED5072802D0062809D009E0042134 +:10646000404608F076FB060000D1FFDFA088708070 +:106470000226B5B9FFDF14E00421404608F069FBAD +:10648000070000D1FFDF07F1080005F06BFA90F07C +:10649000010F02D1E079000633D50226A7F8048067 +:1064A00035B122462946404601F09AFB29E027E013 +:1064B00013214046FCF725FB23E00226002DF0D1F6 +:1064C000FFDFEEE702260121404601F06DFF18E0F4 +:1064D000606800902089ADF80400012269464046BA +:1064E00001F083FF0DE0002DDBD1FFDFD9E70226AD +:1064F00000214046FFF74CFB002DD2D1FFDFD0E753 +:10650000FFDF3046BDE8FC813EB50C0009D00146F6 +:106510006B4601AA002005F0EAFD20B1FFF703FD5C +:106520003EBD10203EBD00202080A0709DF80500DB +:1065300002A900F00700FEF743F850B99DF80800E3 +:1065400020709DF8050002A9C0F3C200FEF738F8DC +:1065500008B103203EBD9DF8080060709DF805005D +:10656000C109A07861F30410A0709DF80510890995 +:1065700061F3C300A0709DF80410890601D50221C3 +:1065800000E0012161F342009DF8001061F300007A +:10659000A07000203EBD70B5144606460D4651EA77 +:1065A000040005D075B108460CF05EF978B901E039 +:1065B000072070BD2946304605F0FAFD10B1BDE850 +:1065C0007040B0E454B120460CF04EF908B11020F0 +:1065D00070BD21463046BDE8704095E7002070BD93 +:1065E0002DE9FE4F05460C46007A0A31009104F170 +:1065F00008010291904600270C31821E3E464FF062 +:10660000020B4FF0010A0191092A75D2DFE802F06E +:10661000F3F20574252577B6F4006888042108F0A4 +:1066200098FA060000D1FFDF308810B15227072604 +:10663000E9E051271026002C7ED06888A08084F8DD +:1066400006A0A88900220099FFF7A5FF002874D1B1 +:10665000A8892081288AE081F8E0B5F812900728FF +:1066600025D1E87B000622D5512709F1140086B216 +:10667000002CE1D0A88900220099FFF78CFF0028A8 +:106680007AD16888A08084F806B0A889208184F82F +:106690000EA0288A2082A4F81290A88A0090688808 +:1066A0004B46A969DDF8042001F077FACEE05027C7 +:1066B00009F1120086B2002C3ED0A889002202996E +:1066C000FFF769FF002857D16888A080A889E0807B +:1066D000287A072811D002202073288AE081E87BDD +:1066E0004B46C0096073A4F81090A88A009068888F +:1066F00004F11202A969D7E7A7E00120ECE7688856 +:10670000042108F026FAB5F812A05FEA000900D1CA +:10671000FFDF09F1080005F025F990F0010F02D123 +:10672000E87B000627D50AF11400512786B2002C19 +:106730007FD06888A08001E070E01DE0A889002279 +:106740000099FFF728FF002816D184F806B0A88921 +:1067500020810420A073288A2082A4F812A0A88A8D +:10676000009068885346A969019A01F016FAA98930 +:10677000A9F802106AE00320BDE8FE8F6888FAF7E6 +:106780004DFE82466888042108F0E3F98146BAF19B +:10679000000F00D1FFDFB9F1000F00D1FFDFB9F822 +:1067A0000400A0F57F41FF3902D05127142601E0F3 +:1067B0005027122694B36888A080502F06D084F802 +:1067C00006B0287B029901F0F8F93FE0287BA11D73 +:1067D00001F0F3F900219AF82300CDE900010B46FE +:1067E000B9F8022068884946FFF76BFD0028C3D13D +:1067F0002CE001E013E01FE0FE49A889C98881422E +:1068000005D1542706264CB16888A0801EE0532786 +:106810000CE06888A080A889E08017E009E068881B +:10682000042108F096F900B9FFDF55270826002C4F +:10683000EFD1A8F800600EE056270726002CF8D00C +:106840006888A0800020A07100E0FFDFA8F8006049 +:106850000CB12780668000208EE7E6490020087092 +:10686000704710B586B0002221F8022B044621F8AB +:10687000022B4FF6FF7021F8040B204604F087F935 +:106880006A460121204605F0FDFA19E09DF8030053 +:10689000000715D5BDF806102046FFF75FFD9DF8EF +:1068A0000300BDF8061040F010008DF80300BDF89D +:1068B0000300ADF81400FF232046059A05F043FCC1 +:1068C000684605F0EBFA0028E0D006B010BD0831AC +:1068D00004F07DB970B50546042108F03AF90400CA +:1068E00000D1FFDF04F108012846BDE8704004F044 +:1068F00067B970B58EB00C460646FAF78FFD0500F5 +:1069000005D02878222805D208200EB070BD43F2A9 +:106910000200FAE70CB1A08870B101208DF81400D4 +:1069200003208DF8180000208DF8190034B1A088DC +:10693000ADF82000206803E00920E6E7ADF820006C +:1069400007900421304608F004F9040000D1FFDF6D +:106950000AA903A8CDE9000104AB00222146304674 +:10696000FFF785FC0028D0D1DDE9031004F108020F +:106970008DE8070095F823200AAB05A9304604F0FE +:1069800043FD10B1FFF705FBBFE703980090BDF88A +:10699000283004220021304602F0DDF94FF6FF7165 +:1069A000A180B2E72DE9FF4F85B01F46DDE91390C6 +:1069B000904646888B463046DDF848A0FAF72EFD13 +:1069C00005460421304608F0C4F8044605B9FFDF47 +:1069D00004B9FFDF0834CDF808A0CDE90394CDE970 +:1069E000008795F823205B463046059904F061F94D +:1069F00009B0BDE8F08F2DE9F04F9BB004464FF091 +:106A000000087C48ADF85480ADF82C80ADF850807B +:106A1000A0F80480ADF81480ADF81880ADF820809F +:106A2000ADF81C80007816460D464746012808D070 +:106A3000022806D0032804D0042802D008201BB066 +:106A4000D7E720460BF0CEFED0BB28460BF0CAFE9F +:106A5000B0BB60680BF011FF90BB606848B1608903 +:106A60002189884202D8B1F5007F01D90C20E6E7E0 +:106A700080460AAA06A92846FFF7E5FA0028DED1D3 +:106A800068688078C0F34100022808D19DF8190099 +:106A900010F0380F03D028690BF0E6FE80B905A985 +:106AA0002069FFF788FA0028C9D1206950B16078C1 +:106AB00080079DF8150000F0380002D5E8B301E02A +:106AC00011E0D0BB9DF8140080060ED59DF815008E +:106AD00010F0380F03D060680BF0C6FE18B960687C +:106AE0000BF0CBFE08B11020A9E707A96069FFF7FA +:106AF00062FA0028A3D1606940B19DF81D0000F042 +:106B0000070101293BD110F0380F38D008A9A0693E +:106B1000FFF751FA002892D19DF81C0080062ED470 +:106B20009DF8200080062AD4A06950B19DF821006C +:106B300000F00701012922D100E020E010F0380F19 +:106B40001DD0E06818B10078C8B11C2817D20EAA71 +:106B5000611C2046FFF79EFA0120B94660F30F271B +:106B6000BA4607468DF84E0042F60300ADF84C00D9 +:106B70000DF13B0217A9286809F0C1FC08B10720F4 +:106B80005DE79DF85C0016A9CDF80090C01CCDE92A +:106B9000019100F0FF0B00230BF20122514613A8D4 +:106BA00005F0B3F840BBBDF858000D9011492A8993 +:106BB0002869091D0092CDE901016B89BDF82820E3 +:106BC0002868069905F0A1F801007DD120784FF0E2 +:106BD000020AC10601D480062DD5ADF80C9060697B +:106BE00070B907A906A8FFF786FA9DF81D0020F0E6 +:106BF000070002E0F002002036E0401C8DF81D0086 +:106C00009DF81C008DF84E7040F0C8008DF81C00F7 +:106C100042F60210ADF84C000BA903AACDF800A073 +:106C2000CDE90121002340F2032213A8079905F0C2 +:106C30006CF8010048D1FC484D465B468088ADF8B1 +:106C400039000EA8CDE90290CDF80490CDF810904F +:106C50004FF007090022CDF80090BDF858104FF60C +:106C6000FF7004F098FF10B1FFF75DF9E7E69DF8BB +:106C70003800000625D52946012060F30F218DF844 +:106C80004E704FF42450ADF84C00ADF810506278BF +:106C90009DF81000002362F300008DF81000627868 +:106CA000CDF800A0520862F341008DF8100004AA4C +:106CB000CDE9012540F2032213A805F026F80100D2 +:106CC00002D1606850B300E081E0206960B905A995 +:106CD00006A8FFF710FA6078800705D49DF8150024 +:106CE00020F038008DF815008DF84E7042F6011036 +:106CF000ADF84C00208940F20121B0FBF1F201FB1C +:106D00001202606814ABCDF80080CDE901030023C6 +:106D100013A8059904F0F9FF010058D12078C007A5 +:106D200029D0ADF80C50A06950B908A906A8FFF702 +:106D3000E2F99DF8210020F00700401C8DF82100A9 +:106D40009DF820008DF84E7040F040008DF8200036 +:106D500042F60310ADF84C0015A903AACDF800A027 +:106D6000CDE90121002340F2032213A8089904F081 +:106D7000CCFF01002BD1E06868B32946012060F305 +:106D80000F218DF84E7042F60410ADF84C00E0680B +:106D9000002302788DF8602040788DF86100E0686B +:106DA00018AA4088ADF86200E06800798DF86400A8 +:106DB000E068C088ADF86500CDF80090CDE9012508 +:106DC0004FF4027213A804F0A0FF010003D00D9845 +:106DD00000F01CFF33E694480321017056B180880F +:106DE0003080BDF850007080BDF82C00B080BDF838 +:106DF0005400F080002022E670B501258AB01646C6 +:106E00000B46012802D0022816D104E08DF80E505E +:106E10004FF4205003E08DF80E5042F60100ADF81B +:106E20000C0063B10024601C60F30F2404AA08A9BD +:106E3000184609F064FB20B107200AB070BD10208D +:106E4000FBE704A99DF820207748CDE90021801CAC +:106E500002900023214603A802F2012204F055FF0C +:106E600010B1FFF760F8E8E76F480EB14188318054 +:106E700005700020E1E770B594B0044601268DF856 +:106E80003E6041F60100ADF83C0012AA0FA9304661 +:106E9000FFF7B2FF002848D12078634CC0074FF0BD +:106EA000000544D01C2102A819F04AF89DF80800FA +:106EB0008DF83E6040F020008DF8080042F6052075 +:106EC000ADF83C000E959DF83A00119520F00600B3 +:106ED000801C8DF83A009DF838006A4620F0FF00CB +:106EE0008DF838009DF8390009A920F0FF008DF8D1 +:106EF00039000420ADF82C00ADF830000EA80A903F +:106F000011A80D900FA80990ADF82E5002A8FFF718 +:106F100072FD002809D1BDF80000E080BDF8040032 +:106F20002081401C60812570002014B070BDE58078 +:106F30002581BDF84800F4E72DE9F74F3A49A0B0A4 +:106F40004FF000090A78012A04D0022A02D0082052 +:106F500023B04EE54A88824201D00620F8E7219806 +:106F60008A46824201D10720F2E70024012021460F +:106F7000621CADF848004FF6FF7862F30F218DF8E0 +:106F80006E000691ADF84A8042F6020B8DF8724011 +:106F90001CA9ADF86CB0ADF870401391ADF85080FD +:106FA00012A804F09FFF00252E462F460DAB0722A6 +:106FB00012A9404604F099FF78B182285FD195B3B9 +:106FC0008EB3ADF86450ADF866609DF85E008DF844 +:106FD000144019AC012866D06DE09DF83A002FB33B +:106FE00001285BD1BDF83810594521D118A809A94D +:106FF00001940294CDE9031007200090BDF83610EB +:1070000010230022404604F0F0FFC0BBBDF8600032 +:10701000042801D006284CD1BDF8241021988142C3 +:107020003CD10F2094E73CE0F0020020012835D14C +:10703000BDF83800B0F5205F03D042F60101884268 +:107040002CD1BAF80200BDF83610884201D10127D0 +:1070500000E0002705B19EB1219881421ED118A8F9 +:1070600009AA01940294CDE90320072000900D465F +:1070700010230022404604F0B8FF00B902E02DE0E2 +:107080004E460BE0BDF86000022801D0102810D158 +:10709000C0B217AA09A909F013FA50B9BDF8369081 +:1070A00084E7052054E705A917A8221D09F027FA4F +:1070B00008B103204CE79DF814000023001DC2B264 +:1070C0008DF8142022980092CDE901401BA8069962 +:1070D00004F01BFE10B902228AF80020FEF723FFFD +:1070E00036E710B50B46401E88B084B205AA0021D1 +:1070F0001846FEF7CFFF00200DF1080C06AA05A9DF +:1071000001908CE80700072000900123002221460F +:107110004FF6FF7004F03FFD0446BDF8180001284B +:1071200000D0FFDF2046FEF7FEFE08B010BDF0B530 +:10713000FE4F044687B038780E46032804D0042852 +:1071400002D0082007B0F0BD04AA03A92046FEF72C +:107150007AFF0500F6D160688078C0F3410002280C +:107160000AD19DF80D0010F0380F05D020690BF002 +:107170007BFB08B11020E5E7208905AA21698DE88D +:1071800007006389BDF810202068039904F0BDFD55 +:1071900010B1FEF7C8FED5E716B1BDF81400308077 +:1071A000042038702846CDE7F8B50C0006460CD010 +:1071B00001464FF6FF7500236A46284604F097FF04 +:1071C00028B100BFFEF7AFFEF8BD1020F8BD69463C +:1071D0002046FEF7F0FE0028F8D1A078314600F0F6 +:1071E00001032846009A04F0AEFFEBE730B587B004 +:1071F000144600220DF1080C05AD01928CE82C001C +:10720000072200920A46014623884FF6FF7004F0D9 +:10721000C2FCBDF814102180FEF785FE07B030BD1A +:1072200070B50D46042107F094FC040000D1FFDF87 +:10723000294604F10800BDE8704003F0E7BC70B5D2 +:107240000D46042107F085FC040000D1FFDF29462C +:1072500004F10800BDE8704003F0FEBC70B50D46B7 +:10726000042107F076FC040000D1FFDF294604F179 +:107270000800BDE8704003F00CBD70B50D46042158 +:1072800007F067FC040000D1FFDF294604F1080085 +:10729000BDE8704003F007BD0121FEF779BC2DE980 +:1072A000F04194B04FF000060C008046ADF8146039 +:1072B0001AD0E06828B1A068B0B10188ADF8141008 +:1072C00006804046FAF7AAF8050043F2020757D0B5 +:1072D0002878222852D3A078012807D0022805D088 +:1072E000072014B0BDE8F0811020FAE7208878B1BB +:1072F000401C81B208AA404604F0C4FD08A804F06E +:10730000CDFD9DF82A204FF45051012A0DD102E005 +:1073100043F20300E5E7BDF82820A2F52453023B21 +:1073200003D1822801D098B901E00846D9E7E06886 +:10733000A8B105A901960296CDE9030107200090A6 +:10734000A2882188BDF81430404604F024FC10B116 +:10735000FEF7E9FDC5E7A168BDF8140008809DF8B7 +:107360002300C00602D543F20140BAE70C9838B1B9 +:10737000A1780078012905D0800708D40820B0E75B +:107380003846AEE7C007F9D00726022001E0012603 +:1073900003208DF834009DF8240010F0380F00D140 +:1073A000FFDF9DF824006249C0F3C200084495F84D +:1073B000231010F8010C884201D90F2091E7208892 +:1073C000ADF838000421404607F0C3FB040000D1AB +:1073D000FFDF12A907A8CDE9000106AB324621461E +:1073E0004046FEF744FF002894D1DDE90601083449 +:1073F0008DE8130012AB07220DA9404604F004F8F3 +:1074000010B1FEF7C6FD6CE707980090BDF8483054 +:1074100004223146404601F09EFC62E770B5064604 +:1074200015460C460846FEF73DFD002805D12A46C4 +:1074300021463046BDE87040DEE470BD7CE570B5A5 +:107440001E4614460D0009D044B1616831B138B10F +:1074500036494988814203D0072070BD102070BD95 +:107460002068FEF71FFD0028F9D132462146284644 +:10747000BDE87040FFF7BFBA70B515460C0006D0E6 +:1074800038B12A498988814203D0072070BD102075 +:1074900070BD2068FEF706FD0028F9D12946204678 +:1074A000BDE8704043E670B5064686B00D4614460A +:1074B00010460BF0BBF9E8BB60680BF0DEF9C8BB07 +:1074C000A6F57F40FF3803D03046F9F7A7FF80B11B +:1074D00028466946FEF731FE00280CD19DF81010B1 +:1074E0000F20082940D2DFE801F008060606060A48 +:1074F0000A0843F2020006B070BD0320FBE79DF8C6 +:107500000210012908D1BDF80010B1F5C05FF2D01A +:107510006FF4C052D142EED09DF80610012911D16E +:10752000BDF80410A1F52851062904E0F00200205E +:10753000E602020029E005D2DFE801F003030403BC +:107540000303D8E79DF80A1001290ED1BDF80810F1 +:10755000B1F5245FCFD0A1F524510239CBD0012958 +:10756000C9D0022901D1C6E7FFDF606878B90023DE +:1075700005AA2946304604F0BAFD10B1FEF7D3FC47 +:10758000B9E79DF81400800601D41020B3E76188A4 +:10759000224628466368FFF729FEACE72DE9F04351 +:1075A000814687B08846144610460BF03FF918B163 +:1075B000102007B0BDE8F083002306AA41464846E4 +:1075C00004F095FD18B100BFFEF7ADFCF1E79DF8A2 +:1075D0001800C00602D543F20140EAE7002507275C +:1075E00005A8019500970295CDE9035062884FF6F2 +:1075F000FF734146484604F0F8FC060013D160686A +:107600000BF014F960B960680195CDE9025000975C +:107610000495238862884146484604F0E6FC064605 +:10762000BDF8140020803046CEE739B1F84B0A8807 +:107630001B899A4202D843F2030070472FE610B527 +:1076400086B0F34C0423ADF81430E38843B12489A9 +:107650008C4201D2914205D943F2030006B010BD1D +:107660000620FBE7ADF81010002100910191ADF864 +:10767000003002218DF8021005A9029104A903919E +:10768000ADF812206946FFF70AFEE7E72DE9FC474F +:1076900081460F4608460BF0A5F888BB4846F9F727 +:1076A000BDFE5FEA00080AD098F80000222829D31E +:1076B0000421484607F04DFA060005D103E043F2E5 +:1076C0000200BDE8FC87FFDF06F1080003F0A5FA21 +:1076D00005463878012803D0022804D00720F0E7B7 +:1076E000A8070FD502E015F0340F0BD0B8793C1D78 +:1076F000C00709D0E08838B1A0680BF073F818B162 +:107700001020DEE70820DCE73A782088002128B343 +:10771000A0F201130721112B18D20CD2DFE803F0DD +:107720000B090D0B1D0B121D100B0B1D1D1D1D0B31 +:107730001D00022A11D10846C3E7012AFBD00CE044 +:10774000EA0600E0AA06002AF5DA06E0A0F5C07213 +:107750001F2A02D97D3A022AEDD8C1B298F8230037 +:10776000CDE900017288234631464846FEF7A9FD5F +:10777000A7E72DE9FF4F8BB01E4615460C464FF08C +:1077800000080F460B98F9F749FE30B1007822281F +:1077900006D208200FB0BDE8F08F43F20200F9E7EF +:1077A000B00801D00720F5E7032E00D100264FF6E0 +:1077B000FF7ACCB1022D70D320460BF05EF830B9C1 +:1077C00004EB0509A9F101000BF057F808B11020EE +:1077D000E0E7AD1EAAB22146504604F09BFD39F801 +:1077E000021C884259D1ADB28948B10702D501893E +:1077F000491C00E001211FFA81F9F10701D0068937 +:1078000000E0564605AA49460B9804F03BFB4FF0B2 +:10781000070B4FF0000A0BE0788810283DD808F1DC +:10782000040108441FFA80F8A84536D804EB08077D +:10783000AFB339884945EFD351E000BF9DF8170039 +:1078400002074CD564B304EB080708F104027B88F7 +:107850001FFA82F8102B20D803EB0802AA421CD88A +:107860003A88914219D1C0061BD5CDE900BA0DF175 +:1078700008090AAA04EB0801504689E8070039887C +:1078800000220B9804F087F910B1FEF74CFB81E75A +:107890007888BDF82810884203D00B207AE71EE0D4 +:1078A00005E0798801EB08001FFA80F806E0C006C1 +:1078B00004D50B98FEF752FD002889D19DF81700DA +:1078C000BDF81A1020F010008DF81700BDF8170051 +:1078D000ADF80000FF23009A0B9804F034FC05A8D3 +:1078E00004F0DCFA18B9BDF81A10B142A6D9042187 +:1078F0000B9807F02EF9040000D1FFDF22885AB15F +:10790000CDE900BA5546002321460B98FEF7D9FC75 +:107910000028BCD125803DE700203BE72DE9FF4F43 +:107920008BB01E4617000D464FF0000411D0B00872 +:1079300001D007202EE7032E00D100265DB10846B6 +:107940000AF092FF28B93888691E08440AF08CFFB3 +:1079500008B110201EE72E4AB00701D5518900E07A +:107960000121F0074FF6FF7802D05089401E00E059 +:10797000404686B206AA0B9804F084FA4FF000093C +:107980004FF0070B0DF1140A39E000BF9DF81B0002 +:10799000000734D5CDF80490CDF800B0CDF80890AC +:1079A000CDE9039A434600220B9804F01EFB60BB0E +:1079B00005B3BDF814103A8821442819091D8A42DC +:1079C00032D3BDF81E2020F8022BBDF8142020F879 +:1079D000022BCDE900B9CDE90290CDF810A0BDF899 +:1079E0001E10BDF8143000220B9804F0FEFA08B106 +:1079F0000320CFE6BDF814002044001D84B206A881 +:107A000004F04CFA30B1822808D0FEF78CFAC1E6B7 +:107A1000F0020020BDF81E10B142B7D934B17DB1DB +:107A20003888A11C884203D20C20B3E60520B1E6B9 +:107A300022462946404604F06DFC01462819018083 +:107A4000A41C3C800020A5E610B504460AF0EEFE1A +:107A500008B1102010BD734840892080002010BD5F +:107A6000F0B5A3B00C4606460025142105A818F071 +:107A700067FA01208DF814008DF8180000208DF8A9 +:107A80001900ADF81C403046F9F7C8FC28B1007861 +:107A9000222805D2082023B0F0BD43F20200FAE705 +:107AA0000421304607F055F8070000D1FFDF0AA98E +:107AB00003A8CDE9000104AB002239463046FEF7A9 +:107AC000D6FB0028E7D1DDE90301CDE90010083736 +:107AD0000AAB0722029705A9304603F095FC10B1C6 +:107AE000FEF757FAD7E703980090BDF82830042234 +:107AF0002946304601F02FF900B1FFDF214630461C +:107B0000FEF738F816A9384603F076F800B1FFDF23 +:107B1000BDF85800172801D2172100E00146A14204 +:107B200004D8172801D2172400E004462146304625 +:107B3000FFF785FB074621463046FDF798FD2946AD +:107B4000304601F0A9FB00B9FFDF27BB3046F9F74B +:107B500065FC050000D1FFDF95F822001B281AD92B +:107B6000172C18D93A208DF82C00ADF82E6095F816 +:107B70002200211D884201D9241D00E00446ADF8F1 +:107B8000304040F64800ADF8320017A90BA804F0C9 +:107B900048FB00B1FFDF00207DE7F8B51C46154625 +:107BA0000E46069F07F030F92346FF1DBCB2314652 +:107BB0002A46009406F017FDF8BD70B50C46054640 +:107BC0000E21204618F09AF9002020802DB1012DB9 +:107BD00001D0FFDF70BD062000E00520A07170BD60 +:107BE00010B548800878144620F00F00001D20F0E2 +:107BF000F00080300B4608701422214603F1080083 +:107C000018F04AF9BDE8104000F05EBB10B50C4614 +:107C100004F004F900B1FFDF2046BDE81040FEF794 +:107C200082B90000F002002010B50446007896B03A +:107C3000022805D0012803D043F2050016B010BD7C +:107C4000A17889290AD06078892807D021B1032931 +:107C500002D808B1032801D90720EFE750208DF89A +:107C600000002078022801D0012000E000208DF8DB +:107C70000200607800F016FEC01D8DF80300A078A9 +:107C8000012815D000F00EFE10F101008DF804005F +:107C9000607800F007FE8DF80500A07800F002FE85 +:107CA0008DF806009DF805200621102A04D005E075 +:107CB000022000F0F7FDE9E78DF80510102801D14A +:107CC0008DF806102078012804D19DF80300401C8F +:107CD0008DF80300FBF784F9001DADF808000BA92F +:107CE000684604F09EFA00B1FFDF0020A6E72DE908 +:107CF000FF4FF94991B00600D1E900010396CDE9A3 +:107D00000C01507A117A15460844C7B222D00024DB +:107D10004FF00009CDF81C904FF0050BADF81CB0EA +:107D20001F20ADF81E00EDA00690CDF81490F01DB8 +:107D30008DF814904FF0010A20F007008DF815A07F +:107D4000B04200D0FFDF28880399401C1FFA80F85A +:107D500014B107E00124DBE708F0FF0008F056FB50 +:107D600000B1FFDF03993A4601EB0810C01C20F078 +:107D70000301D5F8188003913CB981F800901FFAEF +:107D800088F003F0CFFE00B1FFDF0399234601EB3B +:107D900008000390A87A297A3A460844C1B203A899 +:107DA00000F0CEFD0398C01C20F003000390697A18 +:107DB00000912B7AAA7A04B1002002A906F0A5FD51 +:107DC00000B1FFDFBDF8081003983A460844DDE92A +:107DD0001F31C01C20F00300DDF850C01E9FCDE90C +:107DE0000210CDE9007304B10020634608A906F033 +:107DF00017FF00B1FFDF089903980844C01D20F069 +:107E0000070003901299821B002C0A6040D1B64AE9 +:107E1000B4491160111D401E086001232C220EA9D7 +:107E2000B24806F0F2FC00F04BFD00211E2208468D +:107E300002F0E4F8FAF784FA00F0EAFEFEF70DFD2E +:107E4000E8680CAA214620B1FBF7EBF830B1FFDF60 +:107E500004E005A8FBF7E5F800B1FFDF05F1140029 +:107E6000FFF709F800B1FFDF4FF4A871A04818F040 +:107E700067F89F48022180F849A180F84AA180F85C +:107E80004B1180F84C91062180F84D1180F804B018 +:107E900015B0BDE8F08F70B5954D0646287805EB16 +:107EA0004014E8780834A0B9A81990F848010028CF +:107EB00010D0A8780A2800D3FFDF207820F0FF0038 +:107EC0002070607866F3020020F0080060700120E6 +:107ED000E870204670BD2DE9F04105460C460027AC +:107EE0000078052190463E46B1EB101F00D0FFDF21 +:107EF000287A58B101280FD0FFDF00BFA8F8006032 +:107F00000CB1278066800020BDE8F0810227092699 +:107F100074B16888A08008E00327142644B16888FB +:107F2000A0802869E060A88A2082287B2072E5E78B +:107F3000A8F80060E7E700B597B051218DF8001070 +:107F400000780BA900F001008DF80200684604F0EB +:107F500068F917B000BD00B5017897B001F00101D4 +:107F60008DF80210417801F001018DF803100178BD +:107F7000C1F340018DF804104178C1F340018DF840 +:107F80000510017889088DF80610417889088DF868 +:107F9000071081788DF80810C1788DF809100079E4 +:107FA0008DF80A004D208DF800000BA9684604F0FA +:107FB00038F9CEE72DE9F04F4D4E97B04FF6FF7AE6 +:107FC0004FF0000996F8490108B3022000F044FD83 +:107FD0000120FFF760FF0446444806F047FC60605C +:107FE00000B9FFDF606804F069F960B12046F9F775 +:107FF00082FC204600F035FD0028E3D13B48616853 +:1080000006F03DFCDEE73948616806F038FC49209F +:108010008DF82C0069460BA804F003F900B1FFDFCE +:10802000002581E068460DEB050400EB4501A07DCD +:10803000B1F80680C10704D0400702D4404601F0E1 +:108040000DF9A07D80076DD5404606F0DDFE0400E9 +:1080500000D1FFDF0321404606F07BFD070050D131 +:10806000FFDF4EE0786810B10078FF2851D004207F +:1080700000F0F2FC0320FFF70EFF8346204606F0D7 +:1080800043FACBF8040000B9FFDFDBF8040006F088 +:108090001DFB00210B900170ABF80280584600F0E8 +:1080A000AEFE204606F014FB00B9FFDFC24658467C +:1080B00000F0D7FC18B99BF80100000702D50B9817 +:1080C00078601EE07868A8B10178491C11F0FF01C2 +:1080D000017016D1FFDF14E0EC0202006E5246354B +:1080E0007800000000000020000602407C0500200F +:1080F0002C04002000221146204600F0D1FB00B9DC +:10810000FFDF96F84B0120B1404600F03CFE00280E +:10811000A8D196F8490128B1204606F04FFB08B1D6 +:108120004FF001096D1CEDB29DF80400A8423FF626 +:1081300079AFB9F1000F7FF443AFAAF57F41FF3962 +:108140000AD04A218DF80010ADF802A00BA96846AC +:1081500004F067F800B1FFDF17B00520BDE8F04F6D +:1081600000F07ABC10B5FC4CA0600868E060AFF28B +:10817000BB1001F0A6FE607010BDF749002008702A +:10818000704730B505464FF080500C46D0F8A4102B +:1081900097B0491C05D1D0F8A810C9430904090CAF +:1081A00008D050F8A01F01F001012970416821603A +:1081B00080680EE02B208DF800000BA9684604F0C3 +:1081C00030F800B1FFDF012028700C982060BDF866 +:1081D0003400A0802878002803D0607940F0C000E7 +:1081E000607117B030BDF0B54FF080540746D4F839 +:1081F000800097B00D462B26401C0BD1D4F884008C +:10820000401C07D1D4F88800401C03D1D4F88C005E +:10821000401C0BD0D4F880003860D4F8840078601B +:10822000D4F88800B860D4F88C0016E08DF82C6083 +:1082300069460BA803F0F5FF00B1FFDF0198386035 +:10824000029878608DF82C6069460BA803F0E9FF6E +:1082500000B1FFDF0198B8600298F860D4F8900090 +:10826000401C0BD1D4F89400401C07D1D4F89800DE +:10827000401C03D1D4F89C00401C08D054F8900F47 +:10828000286060686860A068A860E06816E08DF803 +:1082900000600BA9684603F0C4FF00B1FFDF0C9833 +:1082A00028600D9868608DF800600BA9684603F09F +:1082B000B8FF00B1FFDF0C98A8600D98E86017B018 +:1082C000F0BDA6480079E6E570B5A44CE07828B387 +:1082D000207804EB4010407A00F00700204490F82A +:1082E000480100B9FFDF2078002504EB4010407AF8 +:1082F00000F00700011991F84801401E81F848017B +:108300002078401CC0B220700A2800D12570A078C7 +:10831000401CA07009F001FEE57070BDFFDF70BD6C +:108320003EB50546032106F014FC0446284606F037 +:108330006BFD054604B9FFDF606818B10078FF28BF +:1083400000D1FFDF01AA6946284600F0A9FA60B90A +:10835000FFDF0AE0002202A9284600F0A1FA00B9D6 +:10836000FFDF9DF8080000B1FFDF9DF80000411E0F +:108370008DF80010EED260680199884201D100208A +:108380006060764C94F84B01022800D3FFDF94F82C +:108390004B0118B97048407801F0B2FD94F84B01D8 +:1083A000401C84F84B013EBD70B50546A0F57F40EA +:1083B0000C46FF3800D1FFDF012C01D0FFDF70BD7C +:1083C000FFF77FFF040000D1FFDF207820F00F00CF +:1083D000401D20F0F0005030207065800020207299 +:1083E00001202073BDE870406EE770B515460C465D +:1083F0000646FFF766FF90B1017821F00F01491D95 +:1084000021F0F00150310170468001210172216894 +:108410000161A18881820573BDE8704054E7304650 +:10842000BDE870401321FAF76CBB70B505460C46E9 +:1084300008460AF0FBF908B1102070BD2846F8F78D +:10844000EDFF28B1284600F018FF2070002070BD15 +:1084500043F2020070BD2DE9F04F04463E488946C4 +:1084600087B0017811B1082007B012E53A483C49BD +:10847000416020460AF0DAF900287DD148460AF02A +:10848000D5F9002878D1637A217A5818FF286AD85C +:108490002088FE2867D800B90A202080A06908B982 +:1084A0004FF4B060A0616068A0B14578827805EBB8 +:1084B00045052A440578067905EB450502EB45029A +:1084C0004579C07805EB450505EB8605C0EBC00096 +:1084D000284409E003EB430001EB410200EB4202B8 +:1084E000C1EBC10505EB830086B2C3EBC3001044AA +:1084F000C1EBC1021044084487B2208AFAF766FD36 +:108500000028B1D1FAF76CFD001D78430590FAF709 +:1085100067FD001D00FB06F8E168A06900F05CFA49 +:108520005FEA000AA0D1A17A607A814236D84FF082 +:10853000120B08280ED8207A01280BD808F0D1F8A1 +:10854000054609F0A9FC2A1A217A607A521E0B18F6 +:108550009A4209DA584687E71C0000202C040020C4 +:108560004813002008E019E065688B460090BDB113 +:1085700028460AF082F908B1102075E7A9786878D2 +:1085800008442978421800985844904206D16A79E4 +:1085900029791144EA781144884201D0072063E721 +:1085A000CDF80080CDE90176224603A90020059B85 +:1085B000FFF79DFBF84D039AD9F800306868111851 +:1085C000994202D8B2F5803F03D30420C9F80010C5 +:1085D0004AE7CDF80080CDE90176224604A9059B43 +:1085E000FFF785FBDDE90301884200D0FFDF049837 +:1085F000696808446860C9F80000E84901202870EB +:108600000870504630E72DE9F04707460C4608460B +:108610000AF00CF940B938460AF026F920B9F81CDE +:1086200020F00300B84202D01020BDE8F087DC48FB +:108630004FF00008817889B14178824600EB4115FE +:10864000B4F8009015F8080F234600F00F00002240 +:10865000294600F013FA060004D013E0A4F80080C5 +:108660000520E2E797B12188494501D90C260DE0A4 +:108670002878234600F00F003A46294600F0FEF91C +:10868000060005D00C2E01D0A4F800803046CCE7BF +:108690009AF801005446401CC0B28AF801000A282A +:1086A00001D184F80180A078401EA070697801F0A3 +:1086B0000700062827D2DFE800F026091E031E1E49 +:1086C0000807E3D46888FFF72BFEDFE7B548696841 +:1086D00006F0D5F894F8490130B9AF48407801F078 +:1086E0000FFC94F8490100B1FFDF94F84901401CE8 +:1086F00084F84901CAE700EB0A0191F84801401CDF +:1087000081F84801C2E7FFDFC0E770B50D460446B7 +:108710000AF068F818B928460AF088F808B110205D +:1087200070BD29462046BDE8704007F0A6BE70B572 +:10873000044615460E4608460AF054F818B928466D +:108740000AF074F808B1102070BD022C03D0102C70 +:1087500001D0092070BD2A463146204607F0B0FE00 +:108760000028F7D0052070BD70B514460D460646AA +:108770000AF038F838B928460AF058F818B92046EF +:108780000AF072F808B1102070BD22462946304622 +:1087900007F0B5FE0028F7D0072070BD10B596B0E1 +:1087A00004460AF043F810B1102016B010BD0F2097 +:1087B0008DF800000BA9684603F033FD0028F4D1C2 +:1087C0009DF834002070BDF836006080BDF8380098 +:1087D000A0800020E9E770B505460C4608460AF07F +:1087E00043F820B93CB120680AF020F808B1102005 +:1087F00070BDA08828B121462846BDE87040FEF72C +:1088000078B8092070BD70B504460D46084609F0D9 +:10881000E9FF30B9601E1E2814D8284609F0E2FF8F +:1088200008B1102070BD032C01D9072070BD04B918 +:10883000FFDF5D4800EB840050F8041C2846BDE8CB +:1088400070400847A4F120001F28EED82946204692 +:10885000BDE87040F9F78BBC70B504460D4608467C +:1088600009F0E4FF30B9601E1E280FD8284609F031 +:10887000B9FF08B1102070BD012C03D0022C01D02B +:10888000032C01D1062070BD072070BDA4F120008B +:108890001F28F9D829462046BDE87040F9F709BDE0 +:1088A00005F0BBBC892805D0032805D0022805D0D7 +:1088B0000120704710207047062070470320704742 +:1088C00010B596B003F0A2FC33484178806803F0FD +:1088D00099FE314801240C300178012916D141213B +:1088E0008DF80010C0788DF8020010B1012803D077 +:1088F00005E08DF8024002E000208DF80200684695 +:1089000005F028FA10B10BA803F03DFF02208DF806 +:108910002C008DF82D008DF82E000BA8FFF784F9A0 +:1089200000B1FFDF8DF82C4003208DF82D008DF86D +:108930002E000BA8FFF778F9002800D0FFDF34E7FE +:108940002DE9F0410646022012B101EB4200401D24 +:10895000C7B23068C01C20F003023260DBB9104897 +:108960003B460921243809F02EFE002408E0092C9A +:1089700024D2DFE804F005070509090B0B05050003 +:108980000A4804E00A4802E00A4800E00A4809F000 +:1089900039FE054613E019E01C0000200800002005 +:1089A0002C0400207C0500200C030200DB1F0000CB +:1089B000AD8C0000E72F0000C1010100FFDFA542E0 +:1089C00000D0FFDF641CE4B2092CD0D3306800EB88 +:1089D00007103060BDE8F08138B50C00054604D0C2 +:1089E000084609F0FFFE10BB02E0F62830D331E064 +:1089F000606809F0F7FED0B9607800F00300012844 +:108A000003D0022801D0072038BD69462046FBF775 +:108A1000BBFD0028F8D1607800F00300022808D1DF +:108A20009DF8000028B1606809F01EFF08B1102011 +:108A300038BD6089F8280BD82189814208D861782F +:108A400001F00301012905D1D73080B2A84201D934 +:108A5000092038BD002038BD144908710020C870B5 +:108A600070471249CA782AB10A7801EB42110831DD +:108A7000814201D001207047002070472DE9F0416C +:108A8000044600201880601E1D4616460F46052825 +:108A900000D3FFDF06482A4600EB8400314650F839 +:108AA000043C3846BDE8F041184700002C04002083 +:108AB000F40202002DE9F0478A469846154606461C +:108AC000032106F046F80446304606F0AFF90D35AE +:108AD000AFB2002581462E4604B9FFDFB9F1000F81 +:108AE00000D1FFDF04EB8A000189B94200D30125E0 +:108AF000218CB94202D2BAF1060F00D3012638EA1E +:108B0000050104D0817A41F0020181720BE038EA5C +:108B1000060108D0817A41F00401817214F8220F15 +:108B200040F00400207005EA0600BDE8F0872DE95A +:108B3000F0478246DDE90846174604F10D009946E4 +:108B40000D461FFA80F80023224639465046FFF7AB +:108B5000B1FF60B1A87800061BD426F8044C26F8B3 +:108B6000029C504606F062F9060008D106E0072F85 +:108B700001D01120D9E743F20400D6E7FFDF241D1E +:108B80003046A1B205F040FA00B9FFDF504603F0CD +:108B90009BFC05EB8700062F0289A2EB08010181EF +:108BA00003D2298CA1EB080028840020BDE72DE921 +:108BB000F8431D4617460E46DDF8208006F036F9CC +:108BC00004001BD03F1DB9B205F0CEF92860C0B13A +:108BD00005F07CFD067020466A46296805F0B5FC64 +:108BE000009800210A460180817003F02FFD009853 +:108BF000C01DC8F800000020BDE8F88343F2020061 +:108C0000FAE7072E01D01120F6E743F20400F3E75C +:108C100010B5FAF7E5F90021F74B0A4623F81120C1 +:108C2000491C0829FAD3F44A00F10D011032400022 +:108C3000118051801A3090804E20D0801181518156 +:108C4000C1EBC100908110BD70B50C46897821F050 +:108C5000FF01A170217821F00F01217001216170C5 +:108C60000021616006F0E2F8050000D1FFDF284630 +:108C700005F078F9E04910318989401A20852046AD +:108C8000BDE8704000F0A0BB70B50D46032105F0B3 +:108C900060FF040000D1FFDFA07865F30600A0703C +:108CA00070BD70470146012009F059BD3EB58DB237 +:108CB0000321284605F04DFF040000D1FFDF207896 +:108CC000002220F00F00207002208DF800004FF6E7 +:108CD000FF70ADF80200ADF8040069462846F9F7C8 +:108CE000EEF93EBD2DE9F84F05460C460027007809 +:108CF000012192463E46B1EB101F00D0FFDF287ADB +:108D0000032809D0FFDF00BFAAF800600CB127805C +:108D100066800020BDE8F88FB5F80C80702708F158 +:108D20000A0086B2A4B16888A08068892081A4F86E +:108D300006806888D5F8049004F10A0506F064F806 +:108D40002A46072549464346009505F04CFCDBE7DB +:108D5000AAF80060DDE72DE9FC410F461C461646E7 +:108D600080460321089D05F0F4FE010008D033463B +:108D70003A464046CDE90045FFF7D9FEBDE8FC8103 +:108D800043F20200FAE7F8B50546A0F57F40FF3848 +:108D900015D0284606F038F8040000D1FFDF204641 +:108DA00005F0B2FB00280BD001466A46204605F0CC +:108DB000CCFB009CB4F80500E41C052801D0012080 +:108DC000F8BD2E460321284605F0C3FE050000D15C +:108DD000FFDF2079122807D120880C2804D1A87839 +:108DE00000F07F00022806D000230622042130462E +:108DF000FFF760FEF8BD002306220521F7E72DE905 +:108E0000F04F044689B0408805F0FEFF050000D110 +:108E1000FFDF06AA2846616800F0C7FA069D001F1A +:108E200035F8032F6E8882421FD14FF0010B4FF0AF +:108E30000008042E1CD0052E79D0062E71D0402EAD +:108E400013D31546304600F0B2FA08280DD020782A +:108E500020F00F00401C20F0F000103020700320A4 +:108E600020726681A581FFF72FFA09B0BDE8F08F67 +:108E700016462D1D224629463046FCF765FEC0B237 +:108E80000828F2D1ADF81080CDF80C80608803215D +:108E900005F05FFE070000D1FFDF57483989103029 +:108EA000008881420FD360880021FEF7D7F9ADF822 +:108EB0001000024603A80090608805AB0021FFF770 +:108EC00076FE00B1FFDF03980599CDE9001002940A +:108ED00004AB2A4630466168FDF764FDC0B2052840 +:108EE0001DD2DFE800F0041C03150300BDE7BDF848 +:108EF00010000028B9D003990423CDE9000160884F +:108F000000223946FFF713FE0028AED0FFDFACE7A2 +:108F1000607840F008006070A7E708E001E0FFDF3C +:108F2000A3E76088291D6368FAF7B2FF9DE716463C +:108F300027466088032105F00CFE040000D1FFDF06 +:108F40008DF80880A078C146400600D1FFDF042ECE +:108F50008BD3297941F30000401C06D162786B79EC +:108F60009A4282D122781207D1D04FF002081429F8 +:108F700039DA4FF6FF7A012933D0122902D01329AA +:108F800031D11CE00C2E2ED1A17801F07F010129F6 +:108F900029D0207820F00F00401C20706879607084 +:108FA0008DF808B02889ADF80A006889ADF80C0082 +:108FB000A889ADF80E00E889ADF8100016E0062E7D +:108FC00011D1207820F00F0020707988012009F05D +:108FD000C6FB8DF80880ADF80AA02889ADF80C0012 +:108FE00004E0062E0AD09DF80810B9B178883A46F8 +:108FF00002A9F9F764F838E7AC050020207820F0E2 +:109000000F0020707988012009F0A9FB8DF80880F5 +:109010002889ADF80A00ADF80CA0E7E7002885D054 +:109020007E8805A8009007AB062204213046FFF792 +:10903000BEFD00B1FFDF05980523042280F800B0D3 +:1090400069794170A0F80280A0F804900621CDE96A +:10905000001021463046FFF76AFD0028CBD0FFDF25 +:1090600003E77FB50D460646032105F072FD0400B7 +:109070003AD0207800F00F00012838D002A80090E4 +:1090800003AB0C2205213046FFF791FD002829D1C2 +:10909000029812210523017061781A46891C4170DB +:1090A00008214180298881806988C180A98801813F +:1090B000E98841810C21CDE9001021463046FFF7B7 +:1090C00036FD00B1FFDFF02300223146012009F018 +:1090D000A9FA207820F00F00401C20706078801CD6 +:1090E0006070002004B070BD43F20200FAE7112066 +:1090F000F8E77FB50D460646032105F02AFD04007A +:1091000006D0207800F00F00012804D00820E9E7FD +:1091100043F20200E6E702A8009003AB0622052115 +:109120003046FFF744FD0028DCD1029813210523C7 +:109130000170617841700221418085800621CDE96E +:1091400000101A4621463046FFF7F1FC00B1FFDF60 +:10915000207820F00F0020700020C3E72DE9F84FA1 +:109160000E468146032105F0F4FC0546484605F00D +:109170005DFE80464FF0000B05B9FFDFB8F1000F30 +:109180005AD1FFDF58E040466946002205F045F815 +:109190009DF800408246082C00D3FFDF05EB8407D2 +:1091A0000AF109003989062C0144398102D2298C3F +:1091B00008442884072C03D10BF1010000F0FF0BB9 +:1091C000B97AC80711D0072C03D0894A32F81400A5 +:1091D00000E0288D3A89824207D321F00100B8725D +:1091E000484674B3032C2DD0FFDFB87A810706D52B +:1091F00020F00200B8724846032C29D0FFDF062C6D +:109200001AD800BF95F82200410715D520F00400B8 +:1092100085F822005FF0000405EB84018A7A50078C +:1092200006D522F0040088724846032C13D0FFDFD5 +:10923000641CE4B2062CEFD3761EF6B2A3D25846D5 +:1092400068E502E0FAF7BBFECFE7FEF725F8CCE7CA +:10925000FAF77BFED6E7FAF778FEE9E710B50321C7 +:1092600005F077FC040000D1FFDF204600F0ACF8E9 +:10927000A07840F08000A07010BD10B5032105F06B +:1092800068FC040000D1FFDFF9F7AAFE218D0D3044 +:10929000B1FBF0F0C0B210BD70B50D46032105F072 +:1092A00058FC040000D1FFDF062D00D9FFDF072D99 +:1092B00003D04F4830F8150000E0208D04EB850105 +:1092C0000A89824205D28A7A012042F001028A721A +:1092D00070BD002070BD10B50446402801D20720A3 +:1092E00010BD00F064F8082802D04FF4445010BDBF +:1092F0003F480021103802E0491C082903D230F809 +:109300001120002AF8D1082903D020F811400020AC +:1093100010BD042010BD10B5402801D2072010BD9B +:1093200000F045F8082806D0314A0021103A22F80A +:109330001010084610BD052010BD2DE9FE4315464E +:109340000C00804606D02DB16088402804D207204A +:10935000BDE8FE831020FBE7218811B300F027F859 +:10936000082820D002A80090228801AB072140469F +:10937000FFF71DFC0028EBD140462788019E05F031 +:1093800055FD2A46072531463B46009505F064F910 +:10939000029800902388628807214046FFF7DBFC93 +:1093A000D6E70C20D4E70520D2E705F0CEB8014679 +:1093B0000F4A0020103A02E0401C082803D232F87D +:1093C00010308B42F8D1704710B504462021083088 +:1093D00016F0B6FD0648002104EB810330F8112099 +:1093E000491C1A810629F7D9208DA08410BD0000E0 +:1093F000BC05002030B44FF0E02001234FF4006C96 +:109400000021C0F880C11D02C0F880511C06C0F8C0 +:109410008041F34A82F80014D21E82F80014F14A07 +:1094200082F80014F04A53609360C2F84011C2F809 +:109430004411C2F84811C0F880C2C0F88052C0F888 +:109440008042C0F800C1C0F80041136030BC7047D2 +:1094500070B401204FF0E023C6024FF0000CC3F8B7 +:1094600080610402C3F880410506C3F88051DE4ADA +:1094700050609060DD4801680029FCD1C2F840C10D +:10948000C2F844C1C2F848C1C3F88062C3F8804240 +:10949000C3F8805270BC70474FF0E0204FF4006179 +:1094A000C0F88012C910C0F880127047002804BFAD +:1094B000CF487047012804BFCE487047022804BF38 +:1094C000CD48704700B5FFDF002000BD08B5C64994 +:1094D000002298B101282FD002281CBFFFDF08BD51 +:1094E0004FF48020C1F80803C1F84803C348026064 +:1094F000C1F84821C0480068009008BD4FF4803092 +:10950000C1F80803C1F84803BD4B1A60C1F84021F7 +:10951000BC4BC1031960BC49C1F80803BB480260D9 +:10952000C1F840214FF0E0238015C3F88001C1F855 +:109530000022B748027008BD4FF40030C1F808039C +:10954000C1F84803B3480260C1F84421A948006843 +:10955000009008BD70B5DFF890C2042600240125F4 +:10956000B0B101284CD002281CBFFFDF70BDAA4853 +:109570004FF48022012BC0F8401518BFCCF8082307 +:10958000C0F8404108BFCCF80423CCF8442370BD98 +:10959000881E20F07F40CCF840054FF48030CCF896 +:1095A0000803CCF84041CCF84403012B14BF002140 +:1095B0000121974B597094490D61DFF860C2CCF8D6 +:1095C0000040974C4FF0020CC4F800C0DFF854C2C2 +:1095D000CCF80060DFF834C23D32CCF80020C1F88E +:1095E00000524FF0E0224FF4807CC2F880C2C1F8F4 +:1095F0000403C2F800C108048B4908601D7070BDE7 +:109600008A4A4FF40030012BC2F8401518BFCCF83D +:109610000803C2F8404108BFCCF80403CCF8440367 +:1096200070BD72480068704770B58148056882490E +:10963000804808606C4CD4F84001002601280AD10B +:10964000D4F8080310F4803F05D04FF48030C4F8FC +:109650000803C4F84061D4F8440101280DD1D4F8BE +:10966000080310F4003F08D04FF40030C4F808039A +:10967000C4F84461012007F072FCD4F848010128C5 +:109680000DD1D4F8080310F4802F08D04FF48020B7 +:10969000C4F80803C4F84861022007F060FC67487A +:1096A000056070BD624810B5046863496148086090 +:1096B00057490878002808BF03201AD0514A4FF0B4 +:1096C00000401060504AC00BC2F808034F4B002006 +:1096D0001860C2F840014FF0E02C9315CCF88031AF +:1096E000C2F8000208704A78002A1CBF48700020A7 +:1096F00001D007F034FC5148046010BD4FF0E02168 +:109700004FF08070C1F8000270474FF0E0214FF039 +:109710008070C1F8800270474FF0E0214FF40010D4 +:10972000C1F8000270474FF0E0214FF40010C1F87B +:10973000800270473449012008614FF0E0210002A7 +:10974000C1F88002704730494FF47C10C1F808031B +:1097500000200146820002F1804202F50042C2F878 +:109760004015C2F84011401CC0B20628F2D3704721 +:10977000410A43F609525143C0F3080010FB02F0BE +:1097800000F5807001EB50207047430B48F2376CB6 +:1097900003FB0CF31B0C4FEA432CC1F800C0DFF8AD +:1097A000A0C003FB0C0327484CF2F72C5843400D94 +:1097B00010FB0CFC0CEB432303F580735B1213705E +:1097C0000A68104408607047194810B504681A49BF +:1097D0001848086007F05CFF1848046010BD0000DE +:1097E0000BE000E018E000E000B0004004B50040ED +:1097F0004081004044B1004048B1004048B50040BD +:1098000040B5004008F50140008000404085004020 +:109810002C00002044B5004008B000400485004002 +:10982000088500401085004004F5014004B0004068 +:109830001005024001000001180502401405024015 +:10984000F7C2FFFF6F0C0100094810B504680A4910 +:109850000848086007F081FC0848046010BD08490A +:10986000002008604FF0E0210220C1F8800270471C +:1098700010050240010000011805024014050240D5 +:10988000FC1F004010B5EFF3108000F0010472B629 +:10989000EB484178491C41704078012801D108F01B +:1098A0005BFB002C00D162B610BD70B5E44CE078D3 +:1098B00048B90125E570FFF7E5FF08F055FB20B139 +:1098C000002008F031FB002070BD4FF08040657132 +:1098D000C0F80453F7E770B5EFF3108000F001050E +:1098E00072B6D74C607800B9FFDF6078401E6070B8 +:1098F000607808B908F034FB002D00D162B670BD65 +:10990000CF4810B5C17821B100214171C170FFF776 +:10991000E2FF002010BD10B5044608F025FBC84941 +:10992000C978084000D001202060002010BD2DE93A +:10993000F05FDFF80C934278817889F806200025E3 +:1099400089F80710064689F8085000782F4620B19C +:1099500001280FD002280FD0FFDF08F012FB98B1CA +:1099600008F016FBA8420FD1284608F015FB002886 +:10997000FAD047E00125F0E7FFF784FF08F0F4FA9A +:109980000028FBD00225E8E701208407E060C4F846 +:109990000471AC490D600107D1F84412A94AC1F322 +:1099A000423124321160A7494FF0020B3431086074 +:1099B000C4F804B3A060DFF890A2DAF80010C9433D +:1099C00041F3001101F10108DAF8001041F0100133 +:1099D000CAF8001000E020BFD4F804010028FAD033 +:1099E000284608F0D9FA0028FAD0B8F1000F05D1BE +:1099F000DAF8001021F01001CAF80010C4F808B31A +:109A0000C4F8047199F807004C4670B1307860B919 +:109A100008F0AAFA064608F09BFC6FF0004116B168 +:109A2000C4E9031001E0C4E9030115B12771BDE8E1 +:109A3000F09F01202071BDE8F05F00F0DFB870B545 +:109A4000050000D1FFDF4FF080424FF0FF30C2F839 +:109A500008030021C2F80011C2F80411C2F80C1169 +:109A6000C2F81011764C617008F084FA10B1012030 +:109A7000E07060702846BDE8704058E72DE9F0417D +:109A80000125AF077D616E4CE079F0B1012803D06C +:109A9000217A401E814218DA08F066FA064608F07C +:109AA00057FCE179012902D9217A491C21720EB1B2 +:109AB000216900E0E168411A022902DA11F1020F7E +:109AC0000EDC0EB1206100E0E060FFF7DBFE08F085 +:109AD0004BFA10B13D61A57000E0257000202072A6 +:109AE000BDE8F0812DE9F05F5848D0F800B0574A42 +:109AF0005749083211608406D4F8080110B14FF0BC +:109B0000010801E04FF00008D4F8000100B1012085 +:109B10008146D4F8040108B1012600E00026D4F8FB +:109B20000C0100B101208246D4F8100108B10127D0 +:109B300000E0002748EA090126EA010020EA0A00BD +:109B4000B84300D0FFDF0025B8F1000F04D0C4F8FF +:109B50000851012008F0E8F9DFF8E480B9F1000FBE +:109B600013D0C4F8005198F8050020B188F80550CA +:109B7000002008F0D9F998F8000030B108F0F4F9A5 +:109B800018B1012088F8020020610EB1C4F8045118 +:109B9000BAF1000F0AD0C4F80C5198F802004646FA +:109BA00000B9FFDFB5703570FFF795FE37B1C4F827 +:109BB000105198F8040008B1FFF760FF2349091D10 +:109BC000C1F800B033E770B51D4DE87808B908F06A +:109BD000C7F901208407A061A87850B1D4F80C011E +:109BE00020B9002008F0D8F90028F7D10020C4F8E7 +:109BF0000C014FF0FF30C4F8080370BD2DE9F041AF +:109C00001926B507C5F808630124AC610020C5F822 +:109C10000001C5F80C01C5F8100108F0A5F9084FBE +:109C200010B1BC702C6100E03C70FFF72BFE0549C1 +:109C3000B87920310860C5F804636C6150E7000012 +:109C4000300000201805004010ED00E01005024033 +:109C50000100000110B50D2000F06FF8C4B26FF0E4 +:109C6000040000F06AF8C0B2844200D0FFDF3A4935 +:109C70000120086010BD70B50D2000F048F8374C89 +:109C80000020C4F800010125C4F804530D2000F0A1 +:109C900049F825604FF0E0216014C1F8000170BD63 +:109CA00010B50D2000F033F82C480121416000214F +:109CB000C0F80011BDE810400D2000F033B828486E +:109CC00010B5046826492748083108602349D1F8AF +:109CD0000001012804D0FFDF2148001D046010BDF1 +:109CE0001D48001D00680022C0B2C1F8002108F024 +:109CF00044FAF1E710B51948D0F800110029FBD05B +:109D0000FFF7DDFFBDE810400D2000F00BB800F0BC +:109D10001F02012191404009800000F1E020C0F8BD +:109D20008011704700F01F0201219140400980001E +:109D300000F1E020C0F880127047002806DA00F039 +:109D40000F0000F1E02090F8140D03E000F1E02096 +:109D500090F800044009704704D5004000D000404E +:109D6000100502400100000110B5202000F075F838 +:109D7000202000F07DF84449202081F80004434968 +:109D800000060860091D42480860F7F7BBFA3F4922 +:109D9000C83108603F48D0F8041341F00101C0F811 +:109DA0000413D0F8041341F08071C0F8041336494D +:109DB00001201C39C1F8000110BD10B5202000F0B1 +:109DC0004CF8324800210160001D01602F4A481EF6 +:109DD000E83A10602F4AC2F808032C4BC8331960C8 +:109DE000C2F80001C2F860012B490860BDE81040CC +:109DF000202000F03DB825492848EC39086070471C +:109E000022492648E8390860704770B51F4A8069C2 +:109E1000E83A224911601F49D1F800610023204D22 +:109E20001D4A5C1E1EB1A84206D300210FE0D1F8E6 +:109E3000606186B1A84209D2C1F80031C1F8603131 +:109E40001460BDE87040202000F012B81168BDE831 +:109E5000704016F0A1B8FFDF70BD00F01F020121B5 +:109E600091404009800000F1E020C0F88011704767 +:109E700000F01F02012191404009800000F1E02024 +:109E8000C0F880127047000020E000E000060240A9 +:109E900044130020000002400004024001000001C1 +:109EA000001002004FF0E0214FF00070C1F8800177 +:109EB000C1F88002384B802283F80024C1F80001E9 +:109EC000704700B502460420344903E001EBC003AB +:109ED0001B792BB1401EC0B2F8D2FFDFFF2000BDBE +:109EE00041F8302001EBC00100224A718A71012241 +:109EF0000A7100BD294A002102EBC00001717047C0 +:109F000010B50446042800D3FFDF244800EBC40446 +:109F10002079012800D0FFDF6079A179401CC0B210 +:109F2000814200D060714FF0E0214FF00070C1F825 +:109F3000000210BD2DE9F04119480568184919487B +:109F4000083108601448042690F80004134F4009B3 +:109F5000154C042818D0FFDF16E0217807EBC1006C +:109F60000279012A08D1427983799A4204D0427950 +:109F7000827157F8310080472078401CC0B22070B1 +:109F8000042801D300202070761EF6B2E5D20448E2 +:109F9000001D0560BDE8F08119E000E0CC0500205F +:109FA0001005024001000001440000200F4A126821 +:109FB0000D498A420CD118470C4A12680A4B9A4242 +:109FC00006D101B508F092F9FFF715FFBDE8014091 +:109FD000074909680958084706480749054A064BD2 +:109FE0007047000000000000BEBAFECAA0000020BA +:109FF000040000204812002048120020FE4B586048 +:10A0000019721A80C90015F09BBF10B504460E21C5 +:10A0100015F074FF17202081207B40F00A00207388 +:10A0200010BD4FF6FF720A800146032008F097BB6F +:10A030007047027BD30701D1920703D4408908807F +:10A040000020704705207047027B920700D54181B0 +:10A05000704701460020098847F2FE12114200D0E5 +:10A060000120E549497A002901D040F008007047F5 +:10A0700000B50346007BC00701D0052000BD198153 +:10A080001846FFF7E6FFC00703D0187B40F0040036 +:10A090001873187B40F001001873002000BD027B8C +:10A0A000520700D509B10089704717207047027B1D +:10A0B00061F3C302027370472DE9F04F0E46017839 +:10A0C00004464FF0010B0BFA01F047F2FF1100EAD2 +:10A0D000010961681D464FF6FF73088887B09646F0 +:10A0E000984206D0B9F1000F07D047F2FE12104295 +:10A0F00003D0012007B0BDE8F08F40EA09000880D6 +:10A100004FF0000A8DB185F800A0207800270522C5 +:10A110000221102874D2DFE800F0730D323C516B3D +:10A12000747E51C8C49ACCFDFCFB20780B28ECD07F +:10A130000420DFE76068B4F80880007B80077DD5E5 +:10A14000B8F1170F4CD3F8F74BFF4045FAD36068CE +:10A150004089172801D3404542D1287820F03F009C +:10A16000801C2870A5F80180032030806168A1F868 +:10A170000A806068017B21F00201017334E1042050 +:10A1800028702089A5F801006089A5F803003280B5 +:10A190002AE1208A3188C01D1FFA80F84145D1D3B9 +:10A1A000062005F8010B2089288060896880A08935 +:10A1B000A88007200090238A626941E0082810D017 +:10A1C000082028702089A5F801006089A5F80300FF +:10A1D00032806A1D694604F10C0006F090F910B156 +:10A1E000CCE01020EDE730889DF80010084456E0E0 +:10A1F0000A2028702089A5F8010003203080B2E0F1 +:10A2000004E10C2028702089A5F801006089A5F8D8 +:10A2100003003280A7E02089B6F800C00BEB4002B3 +:10A220001FFA82F8C44576D3B8F1050F73D30E2216 +:10A230002A7003EA4003CDF800B000E08AE0E2684B +:10A240006088714600F095FAA6F80080CCE06A4874 +:10A25000427A002A7ED0521E42724068227AE36817 +:10A2600000EBC205AA882868D3F800C01044A0F10A +:10A27000080240F808CC586850608DF800108DF83E +:10A2800001A028680290A888ADF80400608869469B +:10A29000FBF734FAA5F804A0002E01D05046308018 +:10A2A000A2E0287840F080012970287840F0400131 +:10A2B000297060893188C01C1FFA80F841455DD340 +:10A2C000287820F03F00123028702189A5F801106D +:10A2D00003200090638960887146E26800F049FAC3 +:10A2E000A6F80080287841063DD500067CD58DF87B +:10A2F00000B08DF801A03188CDE9025A091DDFF8C0 +:10A30000F8800420ADF80410049098F8080003E0E9 +:10A3100055E04BE02BE031E08DF814006088694691 +:10A32000FBF7ECF9074630880C303080022F01D063 +:10A33000DFB36EE09DF81420D8F8041098F80830C8 +:10A34000404601EBC2019A4218D28A88B2B9427AD9 +:10A35000521C00E037E088F809200D6030888880C2 +:10A36000A6F800A055E06168208988803CE0A089BB +:10A370003188401D1FFA80F8414501D2042748E08A +:10A380002878714620F03F00163028702089A5F803 +:10A3900001006089A5F803000092A3896088226902 +:10A3A00000F0E7F9A6F80080DDE71DE0287820F04E +:10A3B0003F0018302870207A6870318014E060689F +:10A3C0000188090401D4052723E0C0882189884237 +:10A3D00001D006271DE01E202870A6F800B0606896 +:10A3E000018821F400410180B9F1000F11D0024829 +:10A3F00061880088830001E0EC0500200022032032 +:10A4000008F010F961682078887007E0A6F800A0CD +:10A4100003276068018821EA09010180384669E65E +:10A420002DE9F04F87B01746109C0D0083461E465D +:10A430001AD03078C10703D000F03F00192801D9A5 +:10A44000012100E000212046FFF729FEA8420BD39E +:10A450002088A0F57F41FF3906D03078410601D42D +:10A46000000603D5082045E6072043E600208DF8C6 +:10A4700000008DF8010030786B1E00F03F0C0122C7 +:10A48000A81E4FF0050A4FF0020999B2BCF1200F47 +:10A4900076D2DFE80CF08C10755F7569758D759E4E +:10A4A00075B875BD75CB75D775E4757575F475F2AE +:10A4B00075F175F0758C052D79D104208DF80000AB +:10A4C000A0788DF804007088ADF8060030798DF81A +:10A4D0000100707800F03F000C2829D00ADCA0F1C0 +:10A4E0000200092863D2DFE800F0126215621A62E6 +:10A4F0001D622000122824D004DC0E281BD0102856 +:10A50000DAD11BE016281FD01828D5D11FE02078FB +:10A51000800701E020784007002848DAF1E0207841 +:10A520000007F9E72078C006F6E720788006F3E711 +:10A5300020784006F0E720780006EDE72088C00587 +:10A54000EAE72088C004E7E720888004E4E7208861 +:10A550004004E1E72078800729D5032D27D18DF825 +:10A5600000A0B6F8010083E0217849071FD5062D29 +:10A570001DD381B27078012803D0022817D102E0E0 +:10A58000CCE0022000E0102006228DF80020727836 +:10A590008DF80420801CB1FBF0F2ADF8062092B2D9 +:10A5A00042438A4203D10397ADF80890A9E07BE0CB +:10A5B0002078000778D5072198B28DF8001081081F +:10A5C000ADF80410B0EB810F6ED10297ADF8062004 +:10A5D00097E02178C90667D5022D65D381B208209E +:10A5E0008DF80000707802285ED300BFB1FBF0F256 +:10A5F0008DF80400ADF8062092B242438A4253D14E +:10A60000ADF808907CE0207880064DD5092003E065 +:10A610002078400648D50A208DF80000A088ADF8C3 +:10A620000400ADF80610ADF8082069E020780006B7 +:10A6300072D50B20ADF804108DF80000ADF806209F +:10A6400002975EE02188C90566D5022D64D381B2E8 +:10A650000C208DF80000707804285DD3C6E72088B0 +:10A66000C00459D5012D57D10D208DF80000A088C8 +:10A67000ADF8040045E021E026E016E0FFE7208881 +:10A68000800449D5052D47D30E208DF80000A08801 +:10A69000ADF80400B6F803006D1FADF80850ADF832 +:10A6A0000600ADF80AA02BE036E02088400433D540 +:10A6B000012D31D10F208DF8000022E02088000408 +:10A6C0002AD4B6F80100E080207B000724D5032DB2 +:10A6D00022D3307800F03F001B2819D011208DF8CC +:10A6E0000000208840F40040A4F80000B6F8010003 +:10A6F000ADF80400ED1E0320ADF80650ADF80800DB +:10A70000039769465846FAF7F9FF050008D016E0A6 +:10A7100010208DF80000E9E7072510E008250EE07D +:10A72000307800F03F001B2809D01D2807D059467B +:10A73000032008F014F8208800F400402080207BDB +:10A74000400708D52046FFF784FCC00703D1207BD3 +:10A7500020F0040020732846CCE400B587B003281D +:10A7600005D18DF8000088B26946FAF7C7FF07B037 +:10A7700000BDF8B51C4615460E46069F04F056FB74 +:10A780002346FF1DBCB231462A46009403F064FF05 +:10A79000F8BD00002DE9FF4F8DB09B46DDE91B475A +:10A7A000DDF87CA00D46082B05D0E86901F0EFF834 +:10A7B00050B11020C8E02088092140F0100020800E +:10A7C0008AF80010022017E0E96901208871EA691F +:10A7D0004FF420519180E9698872E96942F60100DD +:10A7E0000881E96900208873208840F020002080DB +:10A7F00011208AF800000420804638780A900A2048 +:10A8000038704FF0020905F118004E460C9001F027 +:10A8100069FB444678E000BFBBF1100F0CD1022E5B +:10A820000AD0A9EB0400801C80B20090022305AA84 +:10A830001E990D9801F09BF8BDF816101A988142E8 +:10A8400003D9FE4800790F9004E003D10A9808B1BB +:10A8500038702DE0CDF800904FF002030DF1160294 +:10A860001E990D9801F083F81D980088811BA1EBBB +:10A87000080083B2C8F1FF00984200D2034609EBFA +:10A880000801002089B2CDE902101E9A0F980090AD +:10A890000DF12C0C0192CDF810C0BDF8161000225D +:10A8A0000D9801F0A2FB387050B1C0B2832803D0DC +:10A8B000BDF81600288334E0022011B0BDE8F08F07 +:10A8C000BDF82C00022E00EB0801CCB20CD09AF897 +:10A8D0000110A14205D1BDF82010814206D0FF2C05 +:10A8E00004D09AF801401EE08AF80140D34800687D +:10A8F0000178052902D1BDF81610818009EB04000A +:10A900001FFA80F9301986B2DDE90C1005AB0F9AF9 +:10A9100001F0EBFA28B91D980088801BA042BFF611 +:10A920007BAF022E11D0BBF1100F0AD1A9EB0400AE +:10A93000801C80B20090022305AA1E990D9801F098 +:10A9400016F81D980680002038700020B5E72DE924 +:10A95000F8439C46089E13460027B26B9AB3491FE2 +:10A960008CB2F18FA1F57F45FF3D05D05518AD881C +:10A970002944891D8DB200E000252919B6F83C80D4 +:10A980000831414520D82A44BCF8011022F8021BA6 +:10A99000BCF8031022F8021B984622F8024B91469D +:10A9A00004F032FA4FF00C0C41464A462346CDF8EB +:10A9B00000C003F018FEF587B16B00202944A41DE8 +:10A9C0002144088003E001E0092700E0832738469E +:10A9D000BDE8F88310B50B88848F9C420CD9846B3A +:10A9E000E018048844B1848824F40044A41D23445E +:10A9F0000B801060002010BD822010BD2DE9F047B3 +:10AA00008AB00025904689468246ADF8185007273F +:10AA10004BE0059806888088000446D4A8F80060BA +:10AA200007A8019500970295CDE903504FF40073F4 +:10AA300000223146504601F0D8FA04003CD1BDF85E +:10AA40001800ADF82000059804888188B44216D11A +:10AA50000A0414D401950295039521F4004100974E +:10AA6000049541F4804342882146504601F093F812 +:10AA700004000BD10598818841F40041818005AA2A +:10AA800008A94846FFF7A6FF0400DCD00097059808 +:10AA900002950195039504950188BDF81C300022AC +:10AAA000504601F078F8822C06D105AA06A948463E +:10AAB000FFF790FF0400ACD0ADF8185004E0059803 +:10AAC000818821F40041818005AA06A94846FFF744 +:10AAD00081FF0028F3D0822C03D020460AB0BDE8C5 +:10AAE000F0870020FAE710B50C46896B86B051B1AB +:10AAF0000C218DF80010A18FADF80810A16B019109 +:10AB00006946FBF757FC00204FF6FF71A063E18711 +:10AB1000A08706B010BD2DE9F0410D460746896BB0 +:10AB20000020069E1446002911D0012B0FD1324679 +:10AB300029463846FFF762FF002808D1002C06D0CE +:10AB4000324629463846BDE8F04100F02FBFBDE847 +:10AB5000F081F8B51D46DDE9067CDDE90864531D8A +:10AB6000BCF800E09BB29E4501D20720F8BDACF8CE +:10AB70000030172304F8013B13462180658005212E +:10AB800000913A46314600F0F2FE0020F8BD10B5C3 +:10AB90000C464821204615F0D3F904F1080044F88A +:10ABA0001C0F00204FF6FF71E061618420841720A4 +:10ABB000A08494F8280040F00A0084F8280010BD12 +:10ABC0004FF6FF720A800146042007F0C8BD30B579 +:10ABD00085B00C460546FFF786FFA18E284629B1B1 +:10ABE00001218DF800106946FBF7E4FB0020E062CC +:10ABF0002063606305B030BD90F84420920703D411 +:10AC000040880880002070470620704790F8442054 +:10AC1000920701D5A0F8421070470146002009882C +:10AC20000A0700D5012011F0F00F01D040F002001A +:10AC3000CA0501D540F004008A0501E04800002063 +:10AC400001D540F010004A0501D540F0200009056B +:10AC500001D540F04000704700B5034690F844002D +:10AC6000C00701D0062000BDA3F840101846FFF72A +:10AC7000D4FF10F0760F05D093F8440040F00400A4 +:10AC800083F8440013F8440F40F0010018700020CE +:10AC900000BD90F84420520700D511B1B0F8400033 +:10ACA00070471720704710F8442F61F3C3020270F9 +:10ACB00070472DE9FF4F9DB00E00DDE92D34DDE931 +:10ACC0002A5725D02878C10703D000F03F00192863 +:10ACD00001D9012100E000212046FFF7DAFFB04250 +:10ACE00016D3287841060FD400F03F011E2909D061 +:10ACF000228812F47F6F0BD1398849B1A2F57F41C8 +:10AD0000FF3905D0010606D500F03F00122802D019 +:10AD1000042021B0D2E5F9491F984FF000090871CD +:10AD20008DF818908DF830900CAA0A60ADF81C9040 +:10AD3000ADF8289029789A4601F03F0C701F032245 +:10AD400004F11803CB464FF004084FF0060E16939B +:10AD5000BCF11F0F7DD2DFE80CF07C7C107C257CE1 +:10AD6000A57CEF7CEE7CED7CEC7CEF7CEB7C7C7C52 +:10AD7000EA7CE97C7C7C7C7CE80094F84410B5F8A3 +:10AD80000100890701D5032E02D08DF8188025E334 +:10AD90004FF40061ADF8281060808DF83020ADF8D8 +:10ADA0003400F3E2052EF0D1B5F801002083ADF8B0 +:10ADB0001C00B5F80310618308B1884201D9012055 +:10ADC00077E184F80AB0A4F808B04FF6FF70208449 +:10ADD000169801F087F805208AF8000002208046C6 +:10ADE000039011AB1F9A16991D9801F07EF888BB4D +:10ADF0009DF84A00012804D002218AF80110102091 +:10AE000003E001208AF8010002208346002201A904 +:10AE100012A805F074FBD8BB9DF80400834537D118 +:10AE20003A88801CA2EB0801814231DB0398009034 +:10AE300002230DF146022C991D9800F098FD03980D +:10AE400008F10208801C80B2039018AA01A912A878 +:10AE500001E0A4E21FE005F052FB039800909DF88A +:10AE6000043018AA2C991D9800F081FD9DF804105B +:10AE700011AB08EB01001FFA80F803981F9A0844F1 +:10AE800080B2039016991D9801F02FF80028BDD0CC +:10AE9000B8F1020F03D10A208DF8180071E2A7F86B +:10AEA00000806EE2072EFFF470AFB5F8010020833A +:10AEB000ADF81C00B5F80310618300283FF47FAFA4 +:10AEC00088423FF67CAF4FF0010884F80A80B5F85D +:10AED000050020810020A073E06900F058FD80B9D2 +:10AEE000E16942F6010081F80680E2694FF42051E1 +:10AEF0009180E16981F80A80E1690881E1690020B7 +:10AF00008873F01F208420984FF007086062A4F82F +:10AF10002280169800F0E6FF8AF800804FF0010BBF +:10AF20000020D846ADF8460029E016E2AAE13FE14C +:10AF3000E6E00FE2ACE087E048E000BFB8F1010FC7 +:10AF400013D0E0698079012803D1BDF84400ADF841 +:10AF50000E00042303AACDF800B02C991D9800F030 +:10AF600006FD0BF104001FFA80FBBDF84600ADF8AA +:10AF70000C00ADF80E0008F104001FFA80F811ABC8 +:10AF80001F9A16991D9800F0B0FF20B93988A1EBDF +:10AF900008000428D2D2B8F1010F3FF47CAFE06979 +:10AFA0008079012805D0BDF84410A1F57F40FF3815 +:10AFB00003D1BDF84400ADF80E00042303AACDF878 +:10AFC00000B02C991D9800F0D2FC68E7072E02D043 +:10AFD000152E7FF4DAAEB5F801102183ADF81C1000 +:10AFE000B5F80320628300293FF4E9AE91423FF6B1 +:10AFF000E6AE0121A172A4F808B084F80EB0052EC7 +:10B0000007D0C0B2691DE26905F05AFA00287FF442 +:10B0100042AF4FF6FF7020842C99CDF814A0CDE9F3 +:10B02000037106AA0AA9CDF800B0CDE9011228786B +:10B03000214600F03F031F9A1D98FFF7ABFB8146A6 +:10B04000208BADF81C009CE1032EC2D14020ADF84E +:10B050002800B5F801102183ADF81C1005A8DDF813 +:10B06000B0C0CDE903B00123CDE901C31F98009022 +:10B0700038880022401E83B21D9800F0B6FF8DF87C +:10B08000180080BB0B218AF80010BDF8140033E0D3 +:10B09000052E9ED18020ADF82800B5F8011021833F +:10B0A000B5F803002084ADF81C10B0F5007F03D97B +:10B0B00007208DF8180091E140F47C42228412A808 +:10B0C000DDF8B080CDE903B04FF0010CCDE9018C83 +:10B0D0001F9800903888401E83B21D9800F085FFAD +:10B0E0008DF8180018B18328ADD10220C8E00D21D9 +:10B0F0008AF80010BDF84800401C29E148000020F3 +:10B10000C80900EB400002EB8000B04204D94806B9 +:10B110007FF53BAE58461BE1B5F801C0ADF81CC049 +:10B120002978490607D58DF830E02978090605D534 +:10B130008DF830B036E107218DF83010209B0322C6 +:10B140000193CDE9022B1F99A6EB0008CDF810B0B2 +:10B1500000911FFA88F3002261461D9800F01BFD44 +:10B160008DF818008DF830B0297849060DD5208863 +:10B17000C00506D5208BBDF81C10884201D1C4F84B +:10B1800024B058468DF818B0E2E0832801D14FF082 +:10B1900002094FF48070ADF82800BDF81C00208330 +:10B1A000A4F8208020986062032060841321CCE002 +:10B1B000052EFFF4EAADB5F80110ADF81C10A28F12 +:10B1C0005AB3A2F57F43FE3B27D008228DF83020EA +:10B1D000DDF880C00523CDE9023BCDF804C0CDF8F1 +:10B1E00010B01F9A80B240F400430092D846B5F8E0 +:10B1F00003201D9800F0CFFC4FF400718DF818006B +:10B200008DF83080ADF82810832810D0F8B1A08FC9 +:10B21000A0F57F41FE3907D0E0E00B228DF8302009 +:10B220004FF6FE72A287D3E7A4F83C80D6E02B4607 +:10B2300000943146209A1D98FFF789FB8DF818007D +:10B2400008B183284CD1BDF81C0020834DE72B4664 +:10B2500000943146209A1D98FFF779FB8DF818006D +:10B26000F0BBE18FA06B0844831D2C99CDE900371A +:10B27000CDE9021A4388828801881D98FFF769FC8E +:10B2800081467EE095F80180022E7DD15FEA0800BC +:10B2900002D0B8F1010F77D109208DF8300007A84E +:10B2A00000908DF834804346002221461D98FFF718 +:10B2B00032FC8DF835008DF836B050B9B8F1010F79 +:10B2C00012D0B8F1000F04D1A18FA1F57F40FF3853 +:10B2D0000AD0A08F40B18DF830B04FF4806000E00C +:10B2E0004FE0ADF828000DE00CA91D98FBF762F8BF +:10B2F00081464FF480608DF830B0ADF82800B9F188 +:10B30000020F06D0FE480068807928B18DF8180039 +:10B3100041E0A4F8188047E0B9F1000F03D0812084 +:10B320008DF8180040E007A800904346012221460E +:10B330001D98FFF7F0FB8DF8180021461D98FFF7C8 +:10B34000D2FB9DF81800E0B919218AF800100120FD +:10B35000388016E08DF818E040E02078000721D50D +:10B36000012E1FD10A208DF83000E088ADF834009E +:10B3700004201D9907F0F3F90820ADF82800A7F87C +:10B3800000B09DF8300000E00CE020B10CA91D9841 +:10B39000FBF710F88146B9F1000F1CD004E0480615 +:10B3A0007FF5F3AC4FF004092088BDF8281008435E +:10B3B0002080BDF8280080050BD5A18FA1F57F4026 +:10B3C000FE3806D12098E0622A982063A6864FF0C6 +:10B3D000030948469DE49DF8180078B101208AF8D9 +:10B3E000000029788AF80110BDF81C10AAF8021094 +:10B3F0009DF818008AF80400052038802188BDF8DF +:10B40000280081432180E4E72DE9FF4F8846097831 +:10B4100095B0012088404FF20901249C0840ADF806 +:10B4200020002188DDF888A0A1F57F424FF00009B7 +:10B43000FF3A02D028B1080703D5012019B0BDE8B2 +:10B44000F08F239E4FF0000B0EA886F800B01899DD +:10B450005D460988ADF83410A9498DF81CB0179ADB +:10B460000A718DF838B0086098F80000012834D0CF +:10B47000022809D003287DD1307820F03F001D300C +:10B480003070B8F80400E08098F80000022804D179 +:10B49000307820F03F001B30307094F844000007F3 +:10B4A00068D503210720CDE9000ACDE9021B05ABD1 +:10B4B000BDF834000493C01E83B2B8F80410002213 +:10B4C000159800F092FD0028D5D1B8F80400A6F830 +:10B4D0000100BDF81400C01CFAE098F805108DF8C2 +:10B4E0001C1098F80400012806D04FF400790228B7 +:10B4F0002BD00328BFD163E12088B8F8087010F47E +:10B500000060ADF8200035D0172F1CD3F7F768FD89 +:10B51000B84218D3B4F84200172801D3B84212D168 +:10B52000307820F03F00C01C3070A6F80170032076 +:10B53000ADF83400A4F8427094F8440020F0020002 +:10B5400084F844005AE1052573E1208808F10807D2 +:10B5500000F4FE60ADF8200010F0F00F1DD010F0E8 +:10B56000C00F03D03888228B9042ECD1A9B9B878AB +:10B57000C00700E057E110D0B9680720CDE902B15B +:10B58000CDF804B00090CDF810B0FB88BA883988A7 +:10B59000159800F000FB0028D5D1BDF820008028C8 +:10B5A0004AD006DC10280DD020280BD040288BD1A3 +:10B5B00024E0B0F5807F66D048457DD0B0F5806F3F +:10B5C00098D1D6E0C00601D5082000E010208146C1 +:10B5D0000DA907AA0520CDE902218DF83800ADF8A4 +:10B5E0003CB0CDE904A608A93888CDE900014B4656 +:10B5F000072221461598FFF7CDF89FE09DF81C0023 +:10B600004FF00A0900289DD101210720CDE9000A49 +:10B61000CDE9021B05ABBDF834000493401E83B294 +:10B62000218B0022159800F0E0FC8DF81C000B2007 +:10B630003070BDF814001CE09DF81C004FF00C09A0 +:10B6400000281FD101210720CDE9000ACDE9021B06 +:10B6500013AB0493BDF83400228C401E83B2218BBF +:10B66000159800F0C2FC8DF81C000D203070BDF85C +:10B670004C00401CADF8340005208DF83800208BBC +:10B68000ADF83C00BAE03888218B884284D19DF81F +:10B690001C004FF0120900281CD1606AA8B1B878CC +:10B6A000C0073FF450AFBA68CDF804B0CDE902B29C +:10B6B0000720CDF810B000E00DE00090FB88BA88BC +:10B6C000159800F068FA8DF81C00132030700120E6 +:10B6D000ADF8340092E03988208B8142D6D19DF8B4 +:10B6E0001C004FF016090028A06B0BD0F0B34FF6EA +:10B6F000FF7100205F46ADF808B0009129E000001E +:10B700004800002068B1B978C907BFD1E18F0DABFF +:10B710000844821D03968DE80C04438882880188C2 +:10B7200009E0B878C007BCD0BA680DAB03968DE8C5 +:10B730000C04BB88FA881598FFF70BFA05005DD05A +:10B74000072D71D075E0009105AA02A92046FFF7E8 +:10B7500041F9E28FBDF808108A4201D00028F2D0EA +:10B76000E08FA16B08440780009800E046E0E08786 +:10B7700044E09DF81C004FF0180940B1208BC8B17F +:10B780003888208321461598FFF7ADF936E004F19B +:10B7900018000090237E012221461598FFF7BBF97F +:10B7A0008DF81C000028EDD1192030700120ADF873 +:10B7B0003400E7E7052521461598FFF794F938E0AE +:10B7C000208800F40070ADF8200048452BD1A08FF0 +:10B7D000A0F57F41FE3998D1D8F808004FF016093E +:10B7E00048B1A063B8F80C10A1874FF6FF71E1874C +:10B7F000A0F800B002E04FF6FF70A087BDF820006F +:10B8000030F47F611AD0782300220420159906F0C5 +:10B8100009FF98F8000020712088BDF82010084327 +:10B8200020800EE000E007252088BDF82010884326 +:10B830002080208810F47F6F1CD03AE0218881435B +:10B8400021809DF8380020B10EA91598FAF7B2FDB5 +:10B8500005469DF81C000028EBD086F801900120D9 +:10B860003070208B70809DF81C0030710520ADF881 +:10B870003400DEE7A18EE1B118980DAB0088ADF879 +:10B8800034002398CDE90304CDE9013A206B009000 +:10B89000E36A179A1598FFF70CFA054601208DF810 +:10B8A00038000EA91598FAF785FD00B10546A4F8F1 +:10B8B00034B094F8440040070AD52046FFF7ADF9AC +:10B8C00010F0760F04D114F8440F20F0040020701B +:10B8D0001898BDF8341001802846AFE500B585B052 +:10B8E000042806D102208DF8000088B26946FAF7D4 +:10B8F00061FD05B000BD10B53F4C0B782268012BEF +:10B9000002D0022B2AD111E013780BB1052B01D103 +:10B910000423137023688A889A802268CB88D38096 +:10B9200022680B891381498951810DE08B889380AE +:10B930002268CB88D38022680B8913814B8953817D +:10B940008B899381096911612168FAF733FD2268B7 +:10B9500000210228117003D0002800D0812010BDE2 +:10B96000832010BD806B002800D001207047F8B5FF +:10B970001C4615460E46069F03F058FA2346FF1D47 +:10B98000BCB231462A46009402F066FEF8BD8178CA +:10B99000012909D10088B0F5205F03D042F60101EA +:10B9A000884201D10020704707207047F0B587B06A +:10B9B000002415460E460746ADF8144010E00698E0 +:10B9C00001882980811DCDE9024107210194049459 +:10B9D0000091838842880188384600F0DCF830B94D +:10B9E00006AA05A93046FEF7F5FF0028E7D0822811 +:10B9F00000D1002007B0F0BD4800002010B58B78C2 +:10BA000083B102789A4205D10B885BB102E08B7951 +:10BA1000091D4BB18B789A42F9D1B0F801300C88EE +:10BA2000A342F4D1002010BD812010BD072826D0EC +:10BA300012B1012A27D103E0497801F0070102E0A1 +:10BA40004978C1F3C20105291DD2DFE801F00318CE +:10BA5000080C12000AB10320704702207047042826 +:10BA60000DD250B10DE0052809D2801E022808D35E +:10BA700003E0062803D0032803D0052070470020E8 +:10BA800070470F2070478120704710B513880B80D6 +:10BA90000B781C061FD5FA4CA47A844204D843F0D4 +:10BAA00010000870002010BD94682478C44064F32E +:10BAB00004130B701378D17803F0030341EA0321D8 +:10BAC00040F20123B1FBF3F403FB1411926800FB75 +:10BAD0000120401C10BD906810BD37B5BDF80410A2 +:10BAE00011809DF8045029061BD5E549012394686F +:10BAF000897A814209D8FE280FD1E80602D58B4009 +:10BB00005B1E00E00023237007E021788340994307 +:10BB1000C5F30013834019432170107820F0100002 +:10BB200010703EBD2DE9F0410746C81C0E4620F0BE +:10BB30000300B04202D08620BDE8F081082A01D976 +:10BB40000E20F9E7CE4D002034462E60AF802881CC +:10BB5000AA72E8801AE0E988491CE980810614D4B9 +:10BB6000E17800F0030041EA002040F20121B0FB3F +:10BB7000F1F201FB1201206800F037FB298908442B +:10BB800080B22881381A3044A0600C3420784107F4 +:10BB9000E1D40020D0E72DE9FF4F89B01646DDE95A +:10BBA000168A0F46994623F44045084600F00DFBDF +:10BBB00004000FD0099802F095FF0290207800064B +:10BBC0000AD5AF48817A0298814205D887200DB006 +:10BBD000BDE8F08F0120FAE7224601A90298FFF79D +:10BBE00054FF834600208DF80C004046B8F1070F43 +:10BBF0001AD001222146FFF719FF0028E7D120784B +:10BC0000400611D502208DF80C00ADF81070BDF87B +:10BC10000400ADF81200ADF814601898ADF8165095 +:10BC2000CDF81CA0ADF818005FEA094004D5002546 +:10BC30002E46A84601270CE02178E07801F00301A8 +:10BC400040EA012040F20121B0FBF1F2804601FB05 +:10BC500012875FEA494009D5B84507D1A178207914 +:10BC600001F0030140EA0120B04201D3BE4201D9F4 +:10BC70000720ACE7A8191FFA80F9B94501D90D20B2 +:10BC8000A5E79DF80C0028B103A90998FAF790FBE5 +:10BC900000289CD1B84507D1A0784FEA192161F35B +:10BCA0000100A07084F804901A9800B105801998DA +:10BCB00050EA0A0027D0199830B10BEB06002A464B +:10BCC000199914F0A4F80EE00BEB06085746189EDD +:10BCD000099803F099F82B46F61DB5B2394642464D +:10BCE000009502F080FC224601A90298FFF7CDFEE4 +:10BCF0009DF80400224620F010008DF80400DDE9D4 +:10BD00000110FFF7EAFE002061E72DE9FF4FDFF8A1 +:10BD1000709182461746B9F80610D9F8000001EB79 +:10BD2000410100EB810440F20120B2FBF0F185B04B +:10BD300000FB11764D46DDF84C803146069800F048 +:10BD400054FA29682A898B46611A0C31014411443E +:10BD5000AB8889B28B4202D8842009B038E70699B3 +:10BD6000CDB2290603D5A90601D58520F5E7B9F896 +:10BD700006C00CF1010C1FFA8CFCA9F806C014993E +:10BD800009B1A1F800C0A90602D5C4F8088007E0EF +:10BD9000104480B2A9F80800191A01EB0B00A0604A +:10BDA0002246FE200699FFF798FEE770267120785C +:10BDB000390A61F30100320AA17840F0040062F30D +:10BDC0000101A17020709AF802006071BAF80000B9 +:10BDD000E08000262673280602D599F80A7000E054 +:10BDE0000127A80601D54FF000084D4600244FF06A +:10BDF00007090FE0CDE902680196CDF8009004969E +:10BE0000E9882046129B089AFFF7C5FE0028A4D1B6 +:10BE1000641CE4B2BC42EDD300209EE72DE9F0475C +:10BE2000804600F0D2F9070005D000264446144DA4 +:10BE300040F2012916E00120BDE8F087204600F01D +:10BE4000C4F90278C17802F0030241EA0222B2FB8F +:10BE5000F9F309FB1321006800F0C7F93044641CB2 +:10BE600086B2A4B2E988601E8142E7DCA8F1010035 +:10BE7000E8802889801B288100203870DCE70000DA +:10BE8000F805002010B5144631B1491E218002F09A +:10BE900029FEA070002010BD012010BD10B5DA49A8 +:10BEA00004460088CA88904201D3822010BD0968E8 +:10BEB00000EB400001EB80025079A072D088208115 +:10BEC0009178107901F0030140EA0120A081A07867 +:10BED000E11CFFF7DAFD20612088401C2080E08013 +:10BEE000002010BD0121018270472DE9FF4F85B070 +:10BEF0004FF6FF788246A3F8008048681F460D463B +:10BF000080788DF8060048680088ADF804000020AD +:10BF10008DF80A00088A0C88A04200D304462C82BF +:10BF200041E0288A401C2882701D6968FFF766FD81 +:10BF3000B8BB3988414501D1601E38806888A0426D +:10BF400036D3B178307901F0030140EA012901A923 +:10BF5000701DFFF753FD20BB298941452CD00022DD +:10BF600031460798FFF762FDD8B92989494518D1AC +:10BF7000E9680391B5F80AC0D6F808B05046CDF884 +:10BF800000C002F041FFDDF800C05A460CF1070C7A +:10BF90001FFA8CFC4B460399CDF800C002F0E6FA7C +:10BFA00050B1641CA4B2204600F00FF90600B8D1CD +:10BFB000641E2C828220D0E67C807079B871F08873 +:10BFC000B8803178F07801F0030140EA01207881EF +:10BFD000A7F80C90504602F085FD324607F10801A3 +:10BFE000FFF753FD38610020B7E62DE9FF4F87B01A +:10BFF00081461C469246DDF860B0DDF85480089812 +:10C0000000F0E3F805000CD0484602F06BFD2978FB +:10C01000090608D57C49897A814204D887200BB06B +:10C02000D6E50120FBE7CAF309062A4601A9FFF776 +:10C030002CFD0746149807281CD000222946FFF73C +:10C04000F5FC0028EBD12878400613D501208DF8A7 +:10C0500008000898ADF80C00BDF80400ADF80E001B +:10C06000ADF81060ADF8124002A94846FAF7A0F901 +:10C070000028D4D12978E87801F0030140EA0121B1 +:10C08000AA78287902F0030240EA0220564507D038 +:10C09000B1F5007F04D9611E814201DD0B20BEE7AE +:10C0A000864201D90720BAE7801B85B2A54200D994 +:10C0B0002546BBF1000F01D0ABF80050179818B11E +:10C0C000B9192A4613F0A3FEB8F1000F0DD03E4473 +:10C0D00048464446169F02F0A9FE2146FF1DBCB209 +:10C0E00032462B46009402F0B7FA002097E72DE97C +:10C0F000F04107461D461646084600F066F8040063 +:10C100000BD0384602F0EEFC2178090607D53E49EF +:10C11000897A814203D887200EE501200CE522466A +:10C120003146FFF7B2FC65B12178E07801F00301F8 +:10C1300040EA0120B0F5007F01D8012000E0002096 +:10C1400028700020F8E42DE9F04107461D46164608 +:10C15000084600F03AF804000BD0384602F0C2FC62 +:10C160002178090607D52849897A814203D8872092 +:10C17000E2E40120E0E422463146FFF7AEFCFF2D69 +:10C1800014D02178E07801F0030240EA022040F266 +:10C190000122B0FBF2F302FB130015B900F20120FB +:10C1A00080B2E070000A60F3010121700020C3E456 +:10C1B00010B50C4600F009F828B1C18821804079FB +:10C1C000A070002010BD012010BD0F49CA88824216 +:10C1D00009D340B1096800EB40006FF00B0202EB9D +:10C1E00080000844704700207047C0B2820609D41E +:10C1F000000605D50448807A4843401C80B2704749 +:10C200000846704700207047F805002010B506F07A +:10C21000C5FCF6F789FE06F061FBBDE8104006F0AC +:10C2200013BC10B50C4601F095FD78B3204600F024 +:10C23000AAFA60B322780F2A09D0102A07D0022A5E +:10C2400005D0032A03D0152A2DD0FFDF1CE0A078EB +:10C250001A2817D00DDC132814D2DFE800F01513CC +:10C2600019131320201C1E28131322131313131346 +:10C2700026002A2806DD3C280FD003DC302814D005 +:10C280003A2810D0032010BD002010BD14E011E0AA +:10C2900043F20200F9E70420F7E70D20F5E70F204D +:10C2A000F3E70820F1E71120EFE70720EDE743F27D +:10C2B0000600EAE7FFDFE7E7FFDFE5E700F063BA44 +:10C2C00070B50346002002466FF02F050EE09C5C1F +:10C2D000A4F130060A2E02D34FF0FF3070BD00EB00 +:10C2E000800005EB4000521C2044D2B28A42EED3BB +:10C2F00070BD30B50A240AE0B0FBF4F304FB130070 +:10C300008D18303005F8010C521E1846D2B2002AA2 +:10C31000F2D130BD30B500234FF6FF7510E0040AAE +:10C3200044EA002084B2C85C6040C0F3031460405B +:10C3300005EA00344440E0B25B1C84EA40109BB242 +:10C340009342ECD330BD000010B50AF0BCFB0428CA +:10C3500003D00AF0B8FB052802D108F07DFD50B9E2 +:10C360000AF0B8FB032803D00AF0BAFB032804D173 +:10C3700007F02AFD08B1012010BD002010BD70B5E6 +:10C380000C460546062102F0E4FB606008B100207F +:10C3900006E00721284602F0DCFB606018B10120AE +:10C3A0002070002070BD022070BD2DE9FC470C46B6 +:10C3B00006466946FFF7E3FF00287DD19DF800009F +:10C3C00050B107F093FCB0427CD0214630460EF0CD +:10C3D000FAF9002873D115E008F08AFAB04271D05A +:10C3E000214630460CF0DDFE002868D1019D95F80D +:10C3F000C800503518B9687E08B1012000E000205F +:10C40000804603E0019D95F8698050354FF0010AA0 +:10C4100095F835004FF00009A0B195F83600800777 +:10C4200010D584F8019084F800A084F80290A680CA +:10C4300095F83710A171298F2181698F618185F865 +:10C4400035903CE0304602F0F1FC070000D1FFDF00 +:10C45000384601F096FE10F0FF0008D084F80190F5 +:10C460000D212170A680E08084F802A027E03046EC +:10C4700002F0CAFC070000D1FFDFB8F1000F21D0A5 +:10C48000384601F00FFFB8B19DF8000038B90198A7 +:10C49000D0F8F0004188B14201D180F800903046D8 +:10C4A00007F0DEFA84F801900A21217084F80290E6 +:10C4B000A680A97EA17100E004E085F81990012012 +:10C4C000BDE8FC870020FBE71CB56946FFF757FF76 +:10C4D00000B1FFDF684601F09DFCFA490020896841 +:10C4E000A1F8CA001CBD2DE9FC4104460E460620F9 +:10C4F00002F0DAFA0546072002F0D6FA2844C7B25D +:10C500000025A8463E4417E02088401C80B22080C9 +:10C51000B04202D34046A4F8008080B2B84204D3AF +:10C52000B04202D20020BDE8FC816946FFF727FF38 +:10C530000028F8D06D1CEDB2AE42E5D84FF6FF7082 +:10C5400020801220EFE738B54FF6FF70ADF80000FD +:10C550000DE00621BDF8000002F00DFB04460721A6 +:10C56000BDF8000002F007FB0CB100B1FFDF0021B5 +:10C570006846FFF7B8FF0028EBD038BD2DE9F04141 +:10C58000D1A00679076807F0D9FA10F013FAD04C59 +:10C590004FF00408102024F8388F002560804FF6F3 +:10C5A000FF70208484F82250A08404F8075C04F80B +:10C5B000385C04F80A5C04F8045CC5492571C4F8C9 +:10C5C00005703D316672481E0CF09FFFA5721B205E +:10C5D000A0814FF4A471E181208261820121217543 +:10C5E00061750A21A17584F817800321217661768F +:10C5F0000E21A1760721E176062121776177E0837C +:10C60000BDE8F08170B5AF4C0D466060217007F059 +:10C610000FFAFFF798FFFFF7B1FF207809F056FFF8 +:10C6200008F054FA217860680CF086FE20780FF04C +:10C63000F7F928460BF04DF807F062FB21786068A7 +:10C640000EF0A0F9BDE8704010F0B4B910B50124A7 +:10C650000AB1002010BD21B1012903D000242046D9 +:10C6600010BD022111F0BAFDF9E72DE9F0470400F1 +:10C6700000D1FFDF964D002695F8310058B1667065 +:10C680001520207095F83200A07095F83300E07006 +:10C6900085F8316068E0287840B12C22A91C20463A +:10C6A00013F0B5FB0F2020702E705DE095F82E0082 +:10C6B00060B10120E07095F82F00A07095F830006F +:10C6C00060701020207085F82E604DE080480221B7 +:10C6D0005C308246FFF707FF00B1FFDFB5F85C90E2 +:10C6E000062002F0E1F90746072002F0DDF93844A0 +:10C6F000C7B2781C00F0FF08B5F85C00B84212D150 +:10C70000204608F081F850BB95F8340078B3667085 +:10C71000122020702021A01C13F0F0FB0220A0703A +:10C7200085F8346020E040451AD1204607F0ACFA85 +:10C73000E8B12078122817D1A0783C2814D1A0881D +:10C74000072102F006FA050000D1FFDF288807F074 +:10C7500087F9A088072102F00EFA00B1FFDF03E09D +:10C760002146FFF722FE10B10120BDE8F087FFE768 +:10C7700002215046FFF7B7FE18B9B5F85C104945DD +:10C78000BAD10020F1E770E710B5514C207828B1FC +:10C790000A21BDE810400F2001F001BBFFF7D4FDD6 +:10C7A00008B10C2002E010F04BF9002020710120AC +:10C7B00060710A21E170207010BD70B5444D0446CF +:10C7C000287828B1BDE8704032210F2001F0E7BA87 +:10C7D000207818B1012801D0122010E001F0ECFA05 +:10C7E00020B110F078FA08B10C2008E0207801F0B0 +:10C7F000BFFA04F11703E21D611C10F079F92871EA +:10C80000012068713221E970287070BD70B5304C1C +:10C810000546207828B1BDE870400B210F2001F0BB +:10C82000BEBA287818B1012801D012200EE0FFF717 +:10C830008BFD08B10C2009E0287801F099FA691CF9 +:10C8400010F0C5F808B1002000E007202071012099 +:10C8500060710B21E170207070BD10B51C4C217807 +:10C8600029B13021BDE810400F2001F098BA0088AE +:10C8700010F034FA302110B10020207100E0217155 +:10C8800001206071E170207010BD70B5104C05463C +:10C89000207828B1BDE8704031210F2001F07FBA27 +:10C8A00001F08AFA08B10C2005E0287800F00100B8 +:10C8B00010F00EFA00202071012060713121E1702A +:10C8C000207070BD50000020FFFFFFFF1F00000020 +:10C8D0000406002010B5F74C207828B13421BDE8BB +:10C8E00010400F2001F05BBA01F066FA20B110F0A1 +:10C8F000F2F908B10C2002E010F051F9002020718B +:10C90000012060713421E170207010BDE948017888 +:10C9100019B10F21084601F042BA002101710F211F +:10C920008170C170FF2181714FF6FF710181E24971 +:10C9300049680A7882728A8882814988C181012186 +:10C94000417101707047DB490A781AB14A210F2002 +:10C9500001F025BA0088A1F85800012081F85A009A +:10C9600000220A7148714A22CA700870704710B5D7 +:10C97000D04C207828B12B21BDE810400F2001F0C9 +:10C980000EBA0821A01D05F0D9FB0020207101205E +:10C9900060712B21E170207010BD70B5C54C2178FD +:10C9A00029B1BDE8704042210F2001F0F8B990F99B +:10C9B0000000042822D0092820D008281ED00728EB +:10C9C0001CD006281AD0052818D0022816D0032813 +:10C9D00014D098B1011D11D010F1080F0ED010F134 +:10C9E0000C0F0BD010F1100F08D010F1140F05D060 +:10C9F00010F1280F02D01220207103E0002506F06C +:10CA0000DFF925714220E07001206071207058E745 +:10CA100010B5A84C217829B12A21BDE810400F207B +:10CA200001F0BDB9A31D012200F1100110F0DBFFE0 +:10CA3000002020710F20A0702A20E070012060717A +:10CA4000207010BD2DE9FF419A4C207828B1492172 +:10CA50000F2001F0A4F9BDE8FF814FF0000884F831 +:10CA60000680B4F85800ADF8040002A9FFF787FC6F +:10CA700020B1002101A8FFF736FDE8BBBDF8040096 +:10CA8000ADF8000002A980B2FFF779FC00B1FFDF2A +:10CA9000BDF8000002F0CAF9050000D1FFDF28460A +:10CAA000039F01F006FC80F0010697F86950BDF87D +:10CAB000000002F0A9F9070000D1FFDF384601F0BD +:10CAC000F1FB80F0010255EA020019D0A179BDF80E +:10CAD000000004EB410108817649A3791831585CC4 +:10CAE00065F300005854A37962F341005854A279C9 +:10CAF00066F38200505400E00DE0A079401CA07164 +:10CB000000216846FFF7EFFC28B9BDF80000BDF82A +:10CB100004108842B6D1012084F804806071492154 +:10CB2000E170207097E770B5624C0546207828B117 +:10CB3000BDE8704045210F2001F031B909F0C3FF75 +:10CB4000052804D0284609F0AEFC002000E00C20A7 +:10CB50002071012060714521E1702070B1E670B54F +:10CB6000544C0546207828B1BDE8704043210F2081 +:10CB700001F015B901F020F938B10C202071012025 +:10CB800060714321E17020709BE62946002006F089 +:10CB9000D6FF0020F2E770B5464C0546207828B154 +:10CBA000BDE8704041210F2001F0F9B809F07DFD8A +:10CBB00010B90BF069F868B128780AF0D9FD287827 +:10CBC00008F081F900202071012060714121E1709D +:10CBD000207076E60C20F6E770B5364C05462078D6 +:10CBE00028B1BDE8704017210F2001F0D8B801F03E +:10CBF000E3F838B10C202071012060711721E17039 +:10CC000020705EE62946012006F099FF0020F2E739 +:10CC100038B5284D0446287828B1BDE838404D2164 +:10CC20000F2001F0BCB8227961798A4215D0A07931 +:10CC3000E379984211D01F2A0FD81F290DD800225E +:10CC4000114612F00DFC40B90022E079114612F0B5 +:10CC500007FC10B9207A072801D9122015E04FF6F9 +:10CC6000FF70ADF8000009F035FFA8B909F038FFF2 +:10CC700090B909F028FF78B900216846FFF733FC26 +:10CC800050B1204605F0C4FF0020287101206871D2 +:10CC90004D21E970287038BD0C20F6E72DE9FC47DE +:10CCA000044C054694F82E0040B12821102001F0D4 +:10CCB00076F805E40406002050000020282084F8BF +:10CCC0003000012184F82E10A8784FF000091A28AE +:10CCD00025D00EDC162831D2DFE800F030303030BD +:10CCE0003021303030303030303030303030302162 +:10CCF00021212A2822D00BDCA0F11E000C281DD2F5 +:10CD0000DFE800F01C1C1C1C1C1C1C1C1C1C1C0D2B +:10CD10003A38042812D2DFE800F011021102288804 +:10CD2000B0F5706F0AD21F20884684F82F0028883B +:10CD30006946FFF724FB18B1022019E0122017E022 +:10CD40009DF80000019F002806D007F58377019E1B +:10CD500005D106F1E90604E007F1E807F7E706F276 +:10CD60000716684601F04BF808B1387818B10C2066 +:10CD700084F82F009DE787F80080A878307084F849 +:10CD80002F90684601F046F893E77CB5F84C0546CD +:10CD9000207820B125210F2001F001F87CBD2888E2 +:10CDA0006946FFF7ECFA002160B102202071A16012 +:10CDB0002173E1800F20A0702520E07001206071B8 +:10CDC00020707CBD019A104612F1500282F83F108B +:10CDD0008368A360037B237392F83F30002BF5D167 +:10CDE0002888E080E6E710B540B10478406813B1C8 +:10CDF000B0F8440003E0B0F8460000E0FB201B2937 +:10CE000008D3814206D8B2F5A47F03D340F6480088 +:10CE1000824201D9122010BD002010BD7CB5D44D36 +:10CE20000446287820B13A210F2000F0B8FF7CBDDD +:10CE300001266E711F2028710F20A8703A20E8701B +:10CE40002E7020886946FFF79AFA08B102200DE09B +:10CE5000A288618801236846FFF7C5FF30B9A28820 +:10CE6000618800236846FFF7BEFF08B128717CBDCA +:10CE70009DF800100020002901990988E980287197 +:10CE8000019918D081F82961019A6188A2F82E11C0 +:10CE9000019AA188A2F83011019A6188A2F82A119A +:10CEA000019AA188A2F82C11019981F828610199B1 +:10CEB00081F829017CBD81F80161019A6188A2F89D +:10CEC0000611019AA188A2F80811019A6188A2F8B6 +:10CED0000211019AA188A2F80411019981F8006158 +:10CEE000019981F801017CBD034600200AB10122AD +:10CEF00000E002221A4202D1490700D112207047F5 +:10CF00007CB59B4D0446287820B13F210F2000F0CE +:10CF100046FF7CBD012068711F2129710F21A97076 +:10CF20003F21E9702870617820780122FFF7DCFF4B +:10CF300028B9A17820780022FFF7D6FF08B1287120 +:10CF40007CBD617820786B46012200F071FFA178EA +:10CF5000207801AB002200F06BFF9DF8000085F8FF +:10CF60004C009DF8040085F84D000020E7E770B5FF +:10CF70007F4D86B004461F200E4685F82F0020887E +:10CF800003A9FFF7FCF908B102200BE0E178A078D3 +:10CF90000122FFF7A9FF28B92179A0780022FFF725 +:10CFA000A3FF18B185F82F0006B08AE4E178A078D5 +:10CFB00002AB012200F03CFF2179A0786B460022F1 +:10CFC00000F036FF9DF808009DF800100843400768 +:10CFD00019D59DF80C00092438B90020049910F0E7 +:10CFE000BAF90499496A88420AD89DF80C000128C8 +:10CFF00009D1049910F0AFF90499496A884202D91D +:10D0000085F82F40D0E79DF80C3001203A2200210E +:10D01000002B049B93F891301BD0012B32D0049A43 +:10D0200082F83401049A82F83201049880F833615E +:10D03000049A9DF8080082F83501049A9DF80000D2 +:10D0400082F83601049880F8341100BF85F82F105B +:10D05000AAE7012B16D0049A82F80C01049A82F8F0 +:10D060000A01049880F80B61049A9DF8080082F880 +:10D070000D01049A9DF8000082F80E01049880F8D2 +:10D080000C11E3E785F82F208EE71CB5384991F89D +:10D090002E202AB1BDE81C405221102000F07FBE96 +:10D0A000522281F83020012281F82E200188ADF82B +:10D0B000001081788DF80210C1788DF80310017985 +:10D0C0008DF80410C088ADF8060000216846FFF70F +:10D0D0004EFF1CBD2DE9F041254C0546207828B1B6 +:10D0E000BDE8F0411D210F2000F059BE1F20207126 +:10D0F000012060711D21E170207009F0E4FC0C2614 +:10D1000004283FD005283DD0A9791220012904D058 +:10D1100019B1022901D0032926D1297809B10129A1 +:10D1200022D1E97929B1012903D0022901D00329AB +:10D130001AD1698843F6FD720B1F3020934213D237 +:10D14000AB881B1F93420FD22187A88860870027D6 +:10D15000A87907F0F2FDA8B1E87907F045FE287834 +:10D16000012807D048B10FE02071BDE8F081000030 +:10D17000040600200021022001E00021012007F028 +:10D1800062FE08B12671F0E72771EEE770B5FE4C3C +:10D19000217829B1BDE870401E210F2000F0FFBDAD +:10D1A0001F212171012161711E22E270217002781C +:10D1B0001221012A00D01AB9407818B1012801D0F3 +:10D1C000217124E400260C25012A08D009F07BFCFB +:10D1D000052802D009F0A4F840B1257117E407F042 +:10D1E000C3FD618F208F09F06DFAF5E726710EE41B +:10D1F0002DE9F047E44C0646B0F84600B4F8445038 +:10D200000F46854200D3054696F84D1000F0B7FD55 +:10D210000146B4F84600814205D896F84D10B6F89C +:10D22000460000F0ACFD8046A146B4F84840B6F890 +:10D230004400844200D3044696F84C1000F09FFD51 +:10D240000146B9F84A00814205D896F84C10B6F864 +:10D25000440000F094FD4FF4A4721B2C01D09042C6 +:10D2600003D11B2D08D0904506D0FD80A7F808807B +:10D270007C80B88001203870BDE8F0872DE9FC5F24 +:10D280000646AFF6BC11C04DD1E900A195F82E00BD +:10D29000884628B1BDE8FC5F2121102000F07FBD49 +:10D2A0001F2085F82F00212085F830004FF0010B5A +:10D2B00085F82EB0304600F0CBFD002811D109F0E2 +:10D2C00002FC05280CD009F0FEFB042808D095F8D4 +:10D2D000340028B907F00CFBA0F57F41FF3901D0DD +:10D2E0000C20D4E0062101A801F004FC04007CD04D +:10D2F000032110F0A3F9B5F85600A4F84400B5F8DE +:10D300005600A4F8460095F84C0084F84A0095F8B9 +:10D310004D0084F84B0095F84F000090B5F856107A +:10D3200095F84E3020880A4601F0C5FC04287DD0CF +:10D3300000B1FFDF208806F092FB04F10D07B4F87E +:10D3400000900421384604F0F9FE4946384610F0B2 +:10D35000BEFA8EA03F1D006800900321684604F0CD +:10D3600078FE002069460A5C3A54401CC0B203288B +:10D37000F9D3308A6080708AA080B08AE08095F806 +:10D38000512095F850100123204610F028FC01464A +:10D39000204610F09DFC4FF0000984F8569084F868 +:10D3A00057904F46707900F0E3FC6076D6F806009F +:10D3B000C4F81A007089E083C4F808A084F80C80CF +:10D3C00084F8F8B004F580712046FFF711FF8DF85E +:10D3D00000700121684604F03CFE9DF8000000F05A +:10D3E0000701C0F3C102114400E01DE0C0F340108A +:10D3F00008448DF80000401D2076092801D208302D +:10D4000020760021204610F019F9307B07F095FCBA +:10D41000A0B107F0A9FC71793079B21D07F0EFFCDB +:10D42000070017D023E001E0092030E02088062122 +:10D4300001F0A1FB00B1FFDF072028E0208806F003 +:10D440000FFB2088062101F096FB00283FF448AF2F +:10D45000FFDF45E72146032007F0F5FC070006D172 +:10D4600072883188204609F05DF807000CD02088CA +:10D4700006F0F6FA2088062101F07DFB00B1FFDFFF +:10D4800085F82F70BDE8FC9F484684F8EC9085F83D +:10D490002F00F7E738B53C4C207820B122210F202F +:10D4A00000F07DFC38BD1F20207101256571222010 +:10D4B000E070257094F8340010BB09F004FB0528D7 +:10D4C00005D007F015FAA0F57F41FF3918D00020EC +:10D4D0002071684609F037F90028E3D100980088E8 +:10D4E00006F0BEFA00980621008801F044FB00B166 +:10D4F000FFDF274884F834500078FCF701FD38BD81 +:10D500000C20207138BD2DE9F0411F4D044695F8DF +:10D510002E0028B1BDE8F0412321102000F03FBCCF +:10D520001F2085F82F00232085F83000012085F882 +:10D530002E00618840F67B438A1F30209A4259D2E0 +:10D54000A288961F9E4255D2914253D8E188B1F5E8 +:10D55000FA7F4FD2218940F67746A1F10A03B34200 +:10D5600048D2B1EBD20F45D96189A289914241D805 +:10D570004FF000082088062101F0EBFA06004FF07A +:10D5800002070FD006E0000004060020112233003D +:10D590005000002000F025FC20B1D6F8F000017802 +:10D5A00039B902E085F82F70DFE5D6F82C1109783B +:10D5B00009B13A201EE005218171D6F8F0004146FC +:10D5C000A0F80880D6F8F020A0885081D6F8F02086 +:10D5D000E0889081D6F8F0202089D081D6F8F0003C +:10D5E000028943899A4204D88279082A01D89A424A +:10D5F00003D3122085F82F00B7E522884280D6F8A1 +:10D60000F000077085F82F10AFE52DE9FE43FF4CC1 +:10D610000646207830B103B02421BDE8F0430F2046 +:10D6200000F0BDBB012565712420E07025703046F7 +:10D6300010F06FF908B1002000E0122020710028DE +:10D640002CD184F83C503068C4F83D00307984F81F +:10D6500041004FF0000884F83C806946062001F044 +:10D6600004FA00B1FFDF684601F0DDF9A0B9BDF8AA +:10D67000047000BFBDF80400062101F06AFA06003C +:10D6800000D1FFDF86F8F850684601F0CCF918B9F0 +:10D69000BDF80400B842EDD184F80480BDE8FE83F3 +:10D6A0002DE9F041D94D064695F82E0028B1BDE888 +:10D6B000F0412C21102000F072BB1F2085F82F00B4 +:10D6C0002C2085F83000012085F82E0030880621B6 +:10D6D00001F03FFA040007D000F083FB20B1D4F83A +:10D6E000F010087830B901E0022026E0D4F82C01CF +:10D6F000007808B13A2020E08C200027005D10F06F +:10D70000010F19D0D6F802004860D6F806008860EC +:10D7100054F8F00F718910228181206806F10C0104 +:10D720000E3012F074FB21680320087021683088E5 +:10D73000488085F82F7018E50C2085F82F0014E537 +:10D7400070B5B24D04460C26287828B1BDE870406B +:10D7500018210F2000F023BB09F0BCF903284BD09F +:10D7600009F0BEF9032847D0A07908B101282DD1CE +:10D77000607928B1012803D0022801D0032825D1DF +:10D78000A07B28B1012803D0022801D003281DD195 +:10D79000607BD8B1C00819D162884FF480408242C2 +:10D7A00002D82188814203D9207901280ED118E0BE +:10D7B000207930B1012814D0022805D0032805D1E2 +:10D7C00002E0202A0BD30CE0A0290AD220790428F9 +:10D7D00005D12088202802D36188884201D91226E9 +:10D7E0000AE0607906F0F7FA30B1207985F8360062 +:10D7F000204606F05AFB064601202E71687118215A +:10D80000E9702870DDE410B5804C217829B11A2127 +:10D81000BDE810400F2000F0C2BA01781F2902D9DC +:10D820001220207106E0002121710278411C10466F +:10D8300006F0B2FB012060711A21E170207010BD6A +:10D8400010B5724C217829B12021BDE810400F207D +:10D8500000F0A5BA01781F2902D91220207106E034 +:10D86000002121710278411C104606F084FB012042 +:10D8700060712021E170207010BD2DE9FC41634CE6 +:10D88000217829B1BDE8FC411B210F2000F087BAA7 +:10D89000012767710C21217100780026012804D02E +:10D8A000002875D01220207197E006F05EFA00285B +:10D8B00019D006F0A3FA94F83600A8B1012813D0C5 +:10D8C000042811D009F00CF900280CD109F002F954 +:10D8D00018B109F0FFF802287FD1002009F04BFFB2 +:10D8E00000B1FFDF267178E009F0F4F8002874D168 +:10D8F00009F0F6F8002870D106F0F8F9A0F57F419C +:10D90000FF396AD1072101A801F0F4F84049054622 +:10D910008860280000D1FFDF032128460FF086FD34 +:10D92000284606F072FC34F8560FA5F8440034F887 +:10D930000A09A5F84600207885F84A00607885F83D +:10D940004B00627A217A0023284610F048F90146FC +:10D950000022284610F0F2F9E07900906189A3795D +:10D9600028880A464C3C01F0A6F990B1042800D062 +:10D97000FFDF2888072101F0FEF800B1FFDF072054 +:10D9800084F8040005F594712846FFF731FC24E083 +:10D9900009E0288806F063F8284609F0ECFE00B19B +:10D9A000FFDF2671EEE709F095F8032803D009F0B0 +:10D9B00097F8032811D109F090F80546002009F0E6 +:10D9C00014FE50B9267145B1288806F049F8288818 +:10D9D000072101F0D0F800B1FFDF1B20E0702770B5 +:10D9E000BDE8FC812DE9F041084C0646207828B1BD +:10D9F000BDE8F0412D210F2000F0D1B9308807217A +:10DA000001F0A7F805004FF0010703E0040600202D +:10DA10005000002020D095F8090140B995F85C002D +:10DA2000112801D0122802D195F84C0150B10C20D8 +:10DA300020710F20A0702D20E0703088E080677189 +:10DA40002770B1E51022B11C05F5857012F0DFF9E1 +:10DA500085F809710020EBE70220E9E770B5F84C82 +:10DA60000546207828B1BDE870402E210F2000F037 +:10DA700096B92888072101F06CF8022178B190F856 +:10DA800009212AB990F85C20112A04D0122A02D068 +:10DA90000C20207104E080F809110020F9E72171C1 +:10DAA0000F20A0702E20E0702888E0800120607197 +:10DAB0002070A7E62DE9FC47E14C0646207828B106 +:10DAC00038210F2000F06BF9BDE8FC8770884BF619 +:10DAD0008032122190420AD848B14FF000083088B5 +:10DAE0006946FEF74CFC20B10220207110E0217144 +:10DAF0000EE0019800F15009851C2F887288394684 +:10DB000048460FF089FC2888B842F6D184F8048092 +:10DB1000012060713821E1702070D5E77CB5C84CD8 +:10DB20000546207820B148210F2000F038F97CBD4F +:10DB300028886946FEF723FC38B1022020710120B5 +:10DB400060714821E17020707CBD01987F22014600 +:10DB500080F8582080F85920002280F85A20A878B0 +:10DB600001F8280FE8784870287988702271E6E774 +:10DB70001CB5B34C217821B113210F2000F00FF90F +:10DB80001CBD00886946FEF7FAFB08B1022005E0DB +:10DB9000019890F82810012902D00C20207106E08D +:10DBA000582100222271095C21720088E080012046 +:10DBB00060711321E1700F21A17020701CBD2DE94F +:10DBC000F0419F4C0546207828B1BDE8F0414B213B +:10DBD0000F2000F0E4B82888072100F0BAFF0123E5 +:10DBE00058B382886D88C688418803EB4207BD42DE +:10DBF00017D342F210777E43BF107943B6FBF1F1A1 +:10DC0000491E89B24FF4FA76B14200D931468D42AD +:10DC100000D22946491C521CB1FBF2F15143491E66 +:10DC20008AB290F8381101B90284E2800020207194 +:10DC300063714B20E0702370B6E40220F7E780495F +:10DC40000A781AB150210F2000F0A9B8427862B1C9 +:10DC5000827852B1C27842B1027932B1C2881B2AAD +:10DC600003D303781BB1012B01D0122008E0A1F8E7 +:10DC700056200278D0F801004AB1C1F852000020C5 +:10DC80000871012048715022CA7008707047C1F8AD +:10DC90004E00F4E770B56A4C0546207828B1BDE81F +:10DCA000704051210F2000F07AB8287800F0010070 +:10DCB00008F074FD287800F0010009F07DFE0020D6 +:10DCC0002071012060715121E17020709AE570B5DA +:10DCD0005B4D0446287828B1BDE870404E210F20E6 +:10DCE00000F05DB800F068F808B10C200DE0601C91 +:10DCF0000FF02CF9207800F0010006F07BF8207876 +:10DD000000F0010007F02CF8002028710120687154 +:10DD10004E21E970287075E570B5494C05462078AC +:10DD200028B1BDE870404C210F2000F038B808F051 +:10DD3000D1FE10B908F0D4FE08B10C2003E0287819 +:10DD400006F03AF900202071012060714C21E17049 +:10DD5000207057E510B50178532907D2394A52F897 +:10DD6000211019B1801C8847012010BD002010BD72 +:10DD700018B1022801D00120704700207047032904 +:10DD800004D0022907D0C000703006E04FF474714F +:10DD900001EB801001E080003C3080B27047284ADF +:10DDA00092F83130002B06D182F8320082F833101D +:10DDB000012082F83100704710B508F084FE042875 +:10DDC0000DD008F080FE052809D008F083FE032856 +:10DDD00005D008F085FE032801D0002010BD0120E9 +:10DDE00010BD90F8691041B990F8C81029B190F8A9 +:10DDF000C800042801D00120704700207047017836 +:10DE0000406821B190F8690010B100207047E8E740 +:10DE1000012070470178012909D1406890F8D51098 +:10DE2000002904D0002180F8D51009F0FCBD70470E +:10DE30000AB1012200E00222024205D0072005E0DB +:10DE4000040600201803020001F007001870704754 +:10DE500010B5038843F6FD711A1F8A4223D2428807 +:10DE6000141F8C421FD29A421DD8C28940F67B43B0 +:10DE7000911F994217D2018A8C1F9C4213D28A4269 +:10DE800011D8428AB2F5FA7F0DD2828A40F67744E1 +:10DE9000A2F10A03A34206D2B2EBD10F03D9C18A81 +:10DEA000028B914201D9302010BD017911B10129B5 +:10DEB00010D107E0417929B1012903D0022901D00D +:10DEC000032907D1007B38B1012805D0022803D0EF +:10DED000032801D0122010BD002010BD4A30704729 +:10DEE00008440830424301F14A00104480B27047B0 +:10DEF000F0B51D460446A818059B083000FB03F248 +:10DF000005F14A00104487B2B94238BFFFDF00264E +:10DF100026606660A660E66026616661A661E661CD +:10DF200026624FF6FF706662A082A7F1280080B2D9 +:10DF300065776080B0F5004F88BFFFDF608805F12E +:10DF40003C01884238BFFFDF6088401BA0F13C01E4 +:10DF50001B2934BF1B203C382080A677F0BD81618F +:10DF600088617047408870472DE9F04F0D46C188A1 +:10DF7000044600F12808008921F4004320F40042FF +:10DF800021F4004620F400474FF0010A4FF0000949 +:10DF90009A4208D100F4004001F4004188421CBFBD +:10DFA0000020BDE8F08FB7420BD9617FB81B401A43 +:10DFB000083885421BDC08EB060000210580418003 +:10DFC0001EE06088617F801B401AB0F1080B0ED400 +:10DFD000BBF11B0FB8BFFFDF5D45D4BF29461FFA59 +:10DFE0008BF1681A0204120C18BFBA4204DD84F8DF +:10DFF00017900020BDE8F08F08EB060001804280FA +:10E0000084F817A0BDE8F08F2DE9F041044600F137 +:10E010002802C08820F40043E07D002808BFBDE846 +:10E02000F081D0180288438813448B423CBF002003 +:10E03000BDE8F081002791429CBF0180478013D941 +:10E04000891A0D042D0C45800ED0E088A61D20F401 +:10E050000040854288BFFFDF30884FF4004121EA4D +:10E060000000284330800AE0627F008802F1080344 +:10E070001044083081B26288A01D00F0A8FBE7754B +:10E080000120BDE8F08130B4B0F804C0C488034674 +:10E0900000F128052CF400402844A44503D10020B9 +:10E0A000188230BC7047B3F80CC00488A44509D36B +:10E0B0004088ACEB040CA0EB0C0084B20CEB050028 +:10E0C000C01E06E0A4EB0C045D7FA4B2AC44604427 +:10E0D000401DB1F800C0A44588BF0C80B3F80CC047 +:10E0E000BCF1000F0CBF4FF0010C4FF0000C82F898 +:10E0F00000C00988198230BC70472DE9F041044600 +:10E1000000F12801808820F400404518208A00286A +:10E1100008BFBDE8F081A08910B9A069807F28718F +:10E12000A089218A084480B2A08129886A88114484 +:10E13000814238BFFFDF28886D88A28941190027F6 +:10E1400091421AD175B1A088261D20F40040A84242 +:10E1500038BFFFDF30884FF4004121EA0000284338 +:10E16000308009E0627F1044083081B202F1080378 +:10E170006288201D00F02BFBA78127820120BDE8CB +:10E18000F0812DE9F0474189B0F80480002704466A +:10E1900000F1280A414518BF4FF400493AD000BFAA +:10E1A00021F40040504446886EB1608904F10A05AC +:10E1B00020F40040B04238BFFFDF288829EA000081 +:10E1C0003043288021E0637F008803F1080C184465 +:10E1D0006389083023F400456288284480B204F142 +:10E1E0000A0190420BD2121A92B20CF11B0C62453A +:10E1F0002CBF03F4004229EA030004D204E0801A91 +:10E2000080B229EA030210430880781C618987B232 +:10E210004145C5D13846BDE8F0872DE9F047B0F853 +:10E2200008800B46044600F12801B0F80A90808867 +:10E2300028F4004C01EB0C05804504BF0020BDE82C +:10E24000F087002A1CBF681D106023B1627F691D22 +:10E25000184611F0DCFD2F886D888DB1E81987B262 +:10E26000208904F1080620F40040A84238BFFFDFEF +:10E2700030884FF4004121EA0000284330800AE052 +:10E28000607F6288C119083100F1080389B204F186 +:10E29000080000F09CFAC84504BF20896081384618 +:10E2A000BDE8F0878188C08881420CBF0120002032 +:10E2B00070478188008988420CBF01200020704788 +:10E2C00030B48488C28800F1280324F4004C22F47E +:10E2D0000041634494421BD08289048A15191C882A +:10E2E0005A88A3189D4216D312B18A4210D212E066 +:10E2F000437F0CF1080C1A196244408892B2801ACC +:10E3000080B22333984201D211B104E08A4202D193 +:10E3100030BC0020704730BC012070472DE9F00769 +:10E32000B0F806C0048900F1280702462CF4004525 +:10E330007E1924F400492CF4004A002024F4004300 +:10E340004FF00108D1450AD104F400440CF4004C0C +:10E35000644504D05082BDE8F00700207047AB420E +:10E3600008D992F81DC05B1BA3EB0C03A3F10804B2 +:10E37000002308E0B2F802C0547FACEB050CACEB14 +:10E38000040CACF10804002CE4DBB2F80EC0BCF1C4 +:10E39000000F0DD0B6F800C075884DB15B1B10772B +:10E3A0008B42D7DBD0893844A0EB0C00C01E09E0BB +:10E3B000A4EB0C0410778C4208DB507FD3891844FF +:10E3C0003044401D5182BDE8F00770478B42A8BF22 +:10E3D00082F81C80E6DABDE72DE9F05F044600F123 +:10E3E000280AC088934620F400400AEB0005608AA2 +:10E3F000894608B1484502D20020BDE8F09FE08977 +:10E4000080B1B5F800806E8808EB0601884218BF1D +:10E41000FFDF207F4FF0000750EA060108D00028F8 +:10E4200040D04AE04FF00008A17F46462971F0E74E +:10E43000E08948B1617F01444819B4F81F10A0F881 +:10E44000051094F82110C171E18908EB09004944D5 +:10E45000E18128806F80BBF1000F19D0607F29888F +:10E4600000F108030144083189B26288A01D00F060 +:10E47000AEF9E781A07F401CA077A07D00281CBFDB +:10E48000E088A082A7756782E7750120BDE8F09F4C +:10E49000607FE18908442844B0F80510A4F81F10F3 +:10E4A000C0792EE0E089B4F81F105044A0EB0800BA +:10E4B00020F8031D94F82110817006EB090086B244 +:10E4C000E089BBF1000F4844E081A5F800806E8030 +:10E4D0000ED0E088A51D20F40040B04238BFFFDF19 +:10E4E00028884FF4004121EA000030432880C0E72B +:10E4F000E0895044A0EB080030F8031DA4F81F1079 +:10E50000807884F82100BEE7818800F1280221F498 +:10E51000004C6244B0F814C0C388614518BF9942EA +:10E520000FD0818969B9806968B18388018999426E +:10E5300009D021F40041283008441179007988423B +:10E5400001D1002070471046704700F12803407F3A +:10E5500001F1050C604410600888002804BFD81E33 +:10E56000106008884988084480B270472DE9F0415E +:10E5700015460A4600F128061C46407F531D0344F9 +:10E5800010885788069900281CBFC01C80B226D06E +:10E5900088429CBF081A80B213D9401AA042A8BF73 +:10E5A00020461FFA80F858184246294611F003FC0D +:10E5B000002818BFBDE8F0814544A4EB080084B2F0 +:10E5C000002001198F423CBF4FF0FF30BDE8F081C1 +:10E5D000304422462946BDE8F04111F0ECBBFA1C5C +:10E5E00097B2F61ED4E72DE9F04100F128071D4649 +:10E5F000407F4B1D0344164608880024B1F8028072 +:10E60000069A00281CBFC01C80B21FD090429CBF3D +:10E61000101A80B20DD9801AA842A8BF284684B229 +:10E6200099182246304611F0F2FB281B85B2264489 +:10E6300000204119414506D839182A46304611F0C4 +:10E64000E6FB601984B22046BDE8F08108F10301C1 +:10E650001FFA81F8FF1ED9E72DE9F04116460A4658 +:10E6600000F128071D46407F531D034410880024F5 +:10E67000B2F80280069900281CBFC01C80B21FD0CF +:10E6800088429CBF081A80B20DD9401AA842A8BF80 +:10E69000284684B258182246314611F0B8FB281B90 +:10E6A00085B2264400204119414506D838442A46FF +:10E6B000314611F0ACFB601984B22046BDE8F08110 +:10E6C00008F103021FFA82F8FF1ED9E7401D7047C8 +:10E6D00070B5044600F12801C288808820F4004308 +:10E6E0001944904208D0A289002A04BF228A002A35 +:10E6F00002D1A28A904201D1002070BDB1F800C0C1 +:10E700004D8885B1261D20F40040A84238BFFFDFA8 +:10E7100030884FF4004121EA000028433080002077 +:10E720002082012070BD607F0CF1080100F1080318 +:10E73000084481B26288201D00F049F8EFE700210B +:10E74000C18101774182C17581757047038813804B +:10E75000C289002A04BF00207047C28800F1280344 +:10E7600022F400421A440A60C089704710B504467A +:10E77000808AA0F57F41FF3918BFFFDFE088A082C3 +:10E78000E089002818BF0120A07510BD4FF6FF7169 +:10E79000818200218175704710B50446808AA0F5FA +:10E7A0007F41FF3908BFFFDFA07D28B9A088A18A7B +:10E7B000884204BF002010BD012010BD8188828ADC +:10E7C000914205BF807D002800200120704710B4D1 +:10E7D000B0F800C02CF40044214489B24FF4004446 +:10E7E00091420AD2521A92B21B339A422CBF0CF4B5 +:10E7F000004224EA0C0104D204E0891A89B224EA16 +:10E800000C021143018010BC70472DE9F04188468D +:10E810004FF6FC7102F103021E46040002EA0105F4 +:10E8200009D00027E01C20F00300A04200D0FFDF49 +:10E83000201D01210CE00127F4E7024628442FB9EE +:10E84000B14201D2034600E000231360491CC9B263 +:10E85000B142F2D9011BC8F80010002F04D10EB14B +:10E86000201D00E000202060BDE8F081024600206D +:10E870001168002902D008460968116070470268D3 +:10E880000A60016070474FF6FC73C91C1940101AEA +:10E89000001F90FBF1F0C0B270474FF6FC73C91C2B +:10E8A0001940001D01FB020070470000F8B5D24D71 +:10E8B00004460E46A878A04200D8FFDF05EB860785 +:10E8C000B86A50F8240000B1FFDFB868FFF7CEFF48 +:10E8D00005000DD0B86A062E40F824500AD0082E44 +:10E8E00000D3FFDFC548294650F826202046904730 +:10E8F0002846F8BDC048C24B7A30A0F12E020090E5 +:10E90000294620460AF037FCF2E72DE9F84F804609 +:10E91000DDF828901E4603EB090093468A46C4B2F0 +:10E920005FEA080707D00025FF2800D9FFDFBAF10A +:10E93000000F03D101E00125F6E7FFDF08F1030036 +:10E9400020F00301414500D0FFDFCB4500D9FFDFB8 +:10E9500065B9A94A00204C324FF6FF711070518002 +:10E96000A74A1070A44A7A3210705180A24880F8E9 +:10E9700000B046708470C4700471447180F80690D1 +:10E98000DFF878B2C67100260BF1400B8146FF1C00 +:10E9900027F003000746002D02D109EB86018860AD +:10E9A0003BF8162019F8063001D04FF000006946F8 +:10E9B000FFF72BFF0098761CF6B20744082EE6D32B +:10E9C000FF1C27F003002346064675B100200222F3 +:10E9D0006946FFF71AFF00983118002003464E469B +:10E9E000C91C21F003021DB110E0C9F84800EEE790 +:10E9F00006EB80070021BA6206E000BFD7F828C006 +:10EA00004CF82130491CC9B2A142F7D3401CC0B216 +:10EA100002EB84010828E3D3A1EB0800AAF8000068 +:10EA20000020BDE8F88F10B5044603F0FFFE08B1E2 +:10EA3000102010BD2078704A618802EB8000927827 +:10EA40000EE0836A53F8213043B14A1C6280A180F2 +:10EA5000806A50F82100A060002010BD491C89B2D6 +:10EA60008A42EED86180052010BD70B505460C467F +:10EA7000084603F0DBFE08B1102070BD082D01D35D +:10EA8000072070BD25700020608070BD0EB56946FE +:10EA9000FFF7EBFF00B1FFDF6846FFF7C4FF08B1E7 +:10EAA00000200EBD01200EBD10B50446082800D37D +:10EAB000FFDF5148005D10BD3EB5054600246946A4 +:10EAC000FFF7D3FF18B1FFDF01E0641CE4B2684632 +:10EAD000FFF7A9FF0028F8D02846FFF7E5FF001B45 +:10EAE000C0B23EBD44498978814201D9C0B2704765 +:10EAF000FF2070472DE9F0410C460546062901D05C +:10EB0000072C10D13C4FB86CFFF7B0FE02004FF657 +:10EB1000FF7604D00221B86CFFF7B5FE00E0304666 +:10EB20002880B04202D10020BDE8F0812146FFF7E5 +:10EB3000BDFE040002D1288800F050F82046F3E71B +:10EB4000A0F57F42FF3A01D0082901D30020704789 +:10EB5000ACE6A0F57F42FF3A0BD0082909D2264A3D +:10EB60009378834205D902EB8101896A51F820002C +:10EB70007047002070472DE9F04104460D46A4F58A +:10EB80007F4143F20200FF39CED0082D01D3072088 +:10EB9000CAE719494FF000088A78A242C4D901EBAC +:10EBA00085072146BA6A52F82460002EBCD0134A69 +:10EBB00008462032314652F825209047B96A062D82 +:10EBC00041F8248001D0072D02D1204600F006F83C +:10EBD0003146B868FFF753FE0020A5E710B5064C94 +:10EBE000C2B20221A06CFFF758FE0146A06CBDE83E +:10EBF0001040FFF744BE00006406002064040200D9 +:10EC00005C00002001469B48002200680260037AF5 +:10EC100000EB830040F80C2F8180114600F01AB9F8 +:10EC20002DE9F05F9846DDF828B0DDF830A01546F4 +:10EC3000894604004FF0000627D00027E01C20F092 +:10EC40000300A04200D0FFDF85B30120FFF746F9A3 +:10EC500000FB05610AEBCA0202EB0B000E18012053 +:10EC6000FFF73CF900FB05610B9800EBC00202EBDB +:10EC70000800084405EB450100EB4100143000EBAF +:10EC8000850000EB850617B110E00127D6E779482B +:10EC9000A6EB8507A9000460257204F10C000C3F67 +:10ECA000606011F04DF9B8B2FFF7ACFF0020C9F871 +:10ECB0000060BDE8F09F2DE9FF4F6E4C814681B0AA +:10ECC00020689A468B4600B9FFDF2068027A4A45E1 +:10ECD00003D9426852F8291021B143F2020005B06D +:10ECE000BDE8F08F006800B9FFDF01210E9A03989C +:10ECF000FFF7F6F8C61C4FF6FC752E40584601216A +:10ED00005246FFF7EDF8C01C00EA050808EB0600C4 +:10ED1000001D85B2574800270068046801E02746B7 +:10ED20000446206838B1A188A942F8D13946204666 +:10ED300000F098F813E005F10800A18880B2814244 +:10ED40002ED33946204600F08DF8A0880022411BC2 +:10ED5000601902608180394600F07CF8A580A088A7 +:10ED600060802680251D0E9F0123039A3146284688 +:10ED70000097FFF7BDF82088414628445A460123F2 +:10ED8000CDF800A0FFF7B4F8208841192846FFF716 +:10ED9000E6F8384800684168002041F829409EE7BD +:10EDA00004209CE770B5334C0546206800B9FFDFAE +:10EDB0002068017AA94210D9426852F8250060B152 +:10EDC0004188002342F8253003608180194600F015 +:10EDD00041F8216800200A7A08E043F2020070BD81 +:10EDE0004B6853F820306BB9401CC0B28242F7D850 +:10EDF000002002E08A88104480B209680029F9D115 +:10EE0000FFF700FF002070BD70B51A4E05460024C4 +:10EE1000306800B9FFDF3068017AA94204D9406840 +:10EE200050F8250000B1041D204670BD70B5114E8C +:10EE300005460024306800B9FFDF3068017AA94236 +:10EE400006D9406850F8251011B131F8040B441868 +:10EE5000204670BD19B10A68026008607047054914 +:10EE60000968F8E7006809B1086070470149096856 +:10EE7000FAE700006400002070B5044600780E46F2 +:10EE800001281AD0072802D00C281AD115E0A06852 +:10EE9000216905780B2D0CD0052003F060FC052DB1 +:10EEA0000FD0782300220520D4F8101003F0BAFB0D +:10EEB00007E0782300220620F8E70520216903F007 +:10EEC0004EFC31462046BDE8704001F0A7B910B5B0 +:10EED00000F13902C3799478411D64F003042340A2 +:10EEE000C371DB070DD04B79547923404B710B79FB +:10EEF000127913400B718278C9788A4200D98170E7 +:10EF000010BD00224A710A71F5E74178012900D04D +:10EF10000C21017070472DE9F74F86B000208C69F5 +:10EF20000D468DF8040009780127FA4816464FF07F +:10EF3000070A4FF011094FF00A0B2A2978D2DFE8AF +:10EF400011F02A00110352036903A803B303CC0391 +:10EF5000FA030F043B04620481049A04D504E60416 +:10EF6000050510053005540577059C05C605E00527 +:10EF7000EE050F062706300663068506D6060D0742 +:10EF80001B074B076A0779078A07C407FB0727088F +:10EF9000E407E807ED0714B120781D2829D0D5F83B +:10EFA00008805FEA080043D001208DF80400686AF9 +:10EFB000059003208DF808008DF809B0286A0390A9 +:10EFC000A8880028EFD098F8001091B10F2910D22E +:10EFD0007ED2DFE801F07D144CDCFDFCFBFAF9F891 +:10EFE000F7089FF6F500022822D124B120780C28DA +:10EFF00001D0002770E302208DF80400ACE1062068 +:10F00000696A03F0ACFBA8880728EDD1204601F01F +:10F0100000F9022809D0204601F0FBF8032808D99E +:10F02000204601F0F6F8072803D20120207005E001 +:10F0300011E2002CB7D020780128D5D198F804002F +:10F04000C11F0A2903D300BF85F81CB089E2A07054 +:10F05000D8F80010A163B8F80410A18798F806004A +:10F0600084F83E00012028700320207046E0072825 +:10F07000BAD1002C97D020780D28B5D198F803107C +:10F0800094F83B20C1F3C000C2F3C002104201D08B +:10F090000E2000E00F20890707D198F805100142E3 +:10F0A000D2D198F806100142CED194F83D2098F8BC +:10F0B000051020EA02021142C6D194F83E2098F8C9 +:10F0C000061090430142BFD198F80400C11F00E030 +:10F0D00045E20A29B8D2617F814201D90620C2E304 +:10F0E000D8F800106160B8F80410218198F8060083 +:10F0F000A072012028700E20207003208DF80400DB +:10F10000686A059004F139000290601D0390173081 +:10F11000049067E2412890D1204601F07AF8042853 +:10F1200002D1E078C00704D1204601F072F80F2820 +:10F130009ED1A88CEF6880B24FF0400AD4F82480AA +:10F14000FFF762FE39460827424653460097FFF70D +:10F150004AFA0E208DF80400686A0590606A0290F1 +:10F16000002101A8FFF788FE2078042806D0A07FA0 +:10F1700038B1012805D0032806D0AEE30520207061 +:10F180000BE284F8009034E71220207066E011282A +:10F19000C1D1204601F03DF8042802D1E078C00733 +:10F1A00019D0204601F035F8062805D1E078C007CF +:10F1B00011D1A07F02280ED0204601F02AF808E0E5 +:10F1C000AFE07DE09AE16EE14EE106E1E5E0CBE003 +:10F1D0001CE011289FD1102208F1010104F1480020 +:10F1E00010F015FE607801280DD012202070E07814 +:10F1F000C00703D0A07F88B301282FD085F800B0C6 +:10F200008DF804B0F0E384F800A027E011288FD136 +:10F21000204600F0FEFF082804D0204600F0F9FF49 +:10F22000132885D12869D8B16869C8B104F178007C +:10F23000102208F10101074610F0E9FD20780828A6 +:10F2400012D014202070E078C0070FD0A07F0228D1 +:10F2500018D06178022912D00328CFD10420FDE311 +:10F2600000208DF80400F6E00920EBE70B20287061 +:10F27000296901204870206CC1E9010792E208B1B8 +:10F28000012870D10B202870296981F801A0606ADB +:10F290004860206AC1E9020778E2206CE2780068E1 +:10F2A000C2F34402521ED04000F0010040F0800042 +:10F2B00000E000200874E06A48617CE20746F9E358 +:10F2C0001128D0D1204600F0A4FF0A2802D1E0780E +:10F2D000C00704D1204600F09CFF1528C3D110229E +:10F2E00008F1010104F1480010F091FD20780A288E +:10F2F00012D0162020701220287029690920487029 +:10F3000004F158004860203088601038C860206CD4 +:10F310000861ACE3C80502000B202070E4E228700D +:10F32000D9E102289FD1204600F073FF042804D3BE +:10F33000204600F06EFF082809D3204600F069FF40 +:10F340000E2890D3204600F064FF12288BD2A07FB5 +:10F35000022888D18DF80490686A059098F8010019 +:10F360008DF80800FBE36CE20228AAD1204600F0E9 +:10F3700050FF00286FD0204600F04BFF0128F9D045 +:10F38000204600F046FF0C28F4D005208DF8080038 +:10F3900098F801008DF8090065E71128FCD1002CD0 +:10F3A000FAD020781728F7D16178E06A022912D0C4 +:10F3B0005FF0000101EB4101182606EBC1011022AC +:10F3C000405808F1010110F022FD0520696A00F0A3 +:10F3D00013FF26700DE60121ECE70B28DCD1002C91 +:10F3E000DAD020781828D7D16178E06A02292CD0A9 +:10F3F0005FF0000101EB4101102202EBC101415815 +:10F40000B8F8010008806078E16A022820D0002066 +:10F4100000EB4002142000EBC2000958404650F8AF +:10F42000032F0A60406848600520696A00F0E4FE26 +:10F430006078022810D04FF000002044407A20F07D +:10F4400001000CD14FF001010BE04FF00101D1E7B9 +:10F450004FF00100DCE77FE24FF00100EDE74FF0F5 +:10F4600000012144487279E3112895D1002C93D0F2 +:10F470002078192890D16078E16A022811D0002004 +:10F4800000EB40021C2000EBC2001022085808F1DB +:10F49000010110F0BCFC0520696A00F0ADFE1A20E5 +:10F4A000F5E00120ECE7082898D1002C98D02078CE +:10F4B0001A2893D1E06A98F80120017862F3470195 +:10F4C0000170E16AD8F8022041F8012FB8F806006F +:10F4D00088800520696A00F08FFE6078022807D0D6 +:10F4E0004FF000002044407A20F002012BD033E09E +:10F4F0004FF00100F6E7204441722FE31128B4D108 +:10F50000002CB4D020781B28AFD16178E06A0229A2 +:10F510001CD0002101EB4101202202EBC10110228D +:10F52000405808F1010110F072FC0520696A00F0F2 +:10F5300063FE607802280CD04FF000002044407A2F +:10F5400020F0040108D14FF00100D4E74FF0010191 +:10F55000E0E74FF00100F1E74FF00000CBE785F85E +:10F560001CA0FAE33078012884D11C2204F11C008D +:10F57000716810F091FCE079C10894F83B0001EA51 +:10F58000D001E07861F30000E070217FF1BB2178C9 +:10F5900003290AD0C0073FF4F9AD032028708DF885 +:10F5A00004B0686A059041209EE3607FA17888429C +:10F5B0003FF694AD02272771E179204621F0E00162 +:10F5C000E171617A21F0F0016172A17A21F0F0011C +:10F5D000A172FFF77CFC2F708DF804B0686A05906B +:10F5E0008DF808A0F2E33078112888D18DF804A0B6 +:10F5F000696A0591B1680391ADF808A00846616891 +:10F60000016021898180A17A817100E06AE0042093 +:10F610002070A4E230781128A6D18DF804A0686A81 +:10F620000590301D02AB07C883E807004120ADF804 +:10F63000080008460C210170A88CD6F80C8080B216 +:10F640004027D4F82090FFF7F1FB41464FF008081F +:10F650004A463B46CDF80080FEF7FEFF002101A898 +:10F66000FFF70AFCE07820F03E00801CE070207874 +:10F67000052801D00F200AE0A07F00283FF4C3AD89 +:10F680000128FBD003287DD184F80080B1E42070EC +:10F69000AFE430780328A8D170680168A16640689B +:10F6A000E0660520287035E2317803299DD1716824 +:10F6B0000A68226749686167216C51B9A17F19B155 +:10F6C000012901D0062029E185F800A020646064AA +:10F6D00001E085F800A00327F3E33178022984D103 +:10F6E000317909B1297737E1A17F022910D00329A7 +:10F6F000EFD16178012910D0A17994F83A2001293D +:10F700000FD02064E178C90713D0012A0ED010E091 +:10F71000B0680028E7D020640BE0A27994F83A1092 +:10F72000EDE7B1680029DED02164EBE7F06800283E +:10F73000D9D06064CDE78DF804B0696A0591E178AD +:10F740005846C90709D06178022903D1A17F29B1A0 +:10F75000012903D0A17F032900D00820287012E2DC +:10F7600030781128BFD1B068286209202870E0786D +:10F770002969C0070FD081F801A0206A4860606A3B +:10F78000886000E0ABE004F16800C860A07F022858 +:10F790007FF48FAD81E501204870206C486004F152 +:10F7A0006800886004F13800C860201D0861206B83 +:10F7B0004861606B88611FE2E1783078C90701D049 +:10F7C000062100E00A2188428DD12078072817D031 +:10F7D00084F800908DF804A0686A0590286A039068 +:10F7E000ADF80890032100F8011B1022716810F099 +:10F7F0000EFB002101A8FFF73FFB00202862C2E4B6 +:10F8000008202070E6E730781128ABD18DF804A0ED +:10F81000686A0590B0680390ADF80890042100F87C +:10F82000011B102204F1680110F0F1FA002101A877 +:10F83000FFF722FB2078092801D0132027E784F85E +:10F8400000B016E0E1783078C90701D0062100E069 +:10F850000A21884286D1102204F14800716810F014 +:10F86000AAFA10B104202877A2E3207809283FF4EF +:10F87000C5AC0C2053E5E078C10735D0A17F012944 +:10F8800002D002291BD02CE00D202870296981F8B4 +:10F8900001B06078012809D0206A4860606A8860F9 +:10F8A00004F16800C8601030086104E5606A4860CF +:10F8B000206A886004F17800C8601038F4E7C0F36B +:10F8C000440114290DD24FF0006101EBB0104FEA52 +:10F8D000B060E0706078012801D0102055E4062067 +:10F8E000D5E6607801288AD00E2018E530780928FE +:10F8F0008BD185F800B010208DF80400686A05905F +:10F9000070680290002101A8FFF7B6FAE9E7E078F5 +:10F91000C00706D0A07F01281FD10F202870042027 +:10F92000F8E015202870296902204870206C486092 +:10F930006078012805D004F1780088601038C8602C +:10F940005AE104F1680088601030F8E73078022846 +:10F95000CED1307908B1287728E3102028700F2005 +:10F96000D8E030781328F7D185F80090296908206D +:10F97000487070684860607801280DD004F1680014 +:10F9800088601030C860206B0861606B486104F1CA +:10F9900058008861A06A21E004F17800886010387E +:10F9A000F0E730780728D7D1607801281AD1A078FD +:10F9B000A16A0A18C0F11001104610F09FFA122037 +:10F9C000287029690920487004F1580048602030E7 +:10F9D00088601038C860206C086141E0C861E06A46 +:10F9E000086209E11320C9E0CBE030780828B3D1E0 +:10F9F000102204F14800716810F0DDF908B10B2005 +:10FA000031E720780B28EDD02046FFF760FAA07888 +:10FA1000A16A0A18C0F11001104610F06FFA162002 +:10FA2000287008208DF80400686A0590002049E0DD +:10FA30003078112890D1B068286214202870296984 +:10FA40000920487004F15800486010308860103078 +:10FA5000C860606C08616078012800E09EE006D014 +:10FA600004F139004861206B8861606BB6E7601D66 +:10FA70004861606B8861206BB0E73078082892D1CC +:10FA80008DF804A0686A0590286A0390ADF8089084 +:10FA90000D2100F8011B1022716810F0B8F9002147 +:10FAA00001A8FFF7E9F9002028626178012902D056 +:10FAB0001520ECE569E21621297008218DF8041063 +:10FAC000696A05910290A0788DF80C007EE130788B +:10FAD0000B288CD1162028706078022802D120468D +:10FAE000FFF7F5F9A07871680A18C0F11001104607 +:10FAF00010F004FA08208DF80400686A0590706818 +:10FB0000E0E730780F2895D1E079C0077BD0172047 +:10FB1000287009208DF80400686A059056E1307855 +:10FB2000102887D11422311D04F11C0010F0B4F903 +:10FB3000E16A208DA1F80900E16AA078C871E17935 +:10FB4000E26A01F003011172E16A627A0A73E16A02 +:10FB5000A07A81F824006078012876D0B3E13EE2F3 +:10FB60006078022801D0012000E000202044407A83 +:10FB7000C0070BD0E078C00708D1192028708DF895 +:10FB800004B0686A05908DF808901FE11E2071E6A8 +:10FB90003078112874D1B06828621A2028700520A6 +:10FBA000B8E7307803286BD16078E26A022801D088 +:10FBB000012000E0002000EB4001142000EBC10117 +:10FBC0005158726813680B6052684A601B21297093 +:10FBD000D5E9041205234B70636A4B606778E36ACA +:10FBE000022F01D0012700E0002707EB470700EBB9 +:10FBF000C7001858C1E90202686A4862069800F016 +:10FC000024FBFFF75BBB87E130780E2838D16078A2 +:10FC1000E26A022801D0012000E0002000EB400051 +:10FC2000102101EBC00002231058093271680EF058 +:10FC3000DDFC1C202870296904204870206A486077 +:10FC4000E06A09308860F84879E65AE130780D2892 +:10FC500016D16178E06A022901D0012100E000217B +:10FC600001EB4101182707EBC101A27840587168E8 +:10FC700010F0CDF86178E06A022902D0012101E09C +:10FC8000A9E0002101EB410107EBC1014058A17837 +:10FC90000844C1F1100110F031F98DF804A0686A30 +:10FCA0000590286A0390ADF80890062101706278EB +:10FCB000E16A022A01D0012200E0002202EB4202A6 +:10FCC00007EBC202401C8958102210F0A0F8002156 +:10FCD00001A8FFF7D1F8002028621D2028708DF8B8 +:10FCE00004B0686A05900B208DF808006EE030784B +:10FCF000112870D18DF804A0686A0590B06803904F +:10FD00000B20ADF80800039880F800A06278E16A43 +:10FD1000022A01D0012200E0002202EB420210235D +:10FD200003EBC20289580988A0F801106178E26AE1 +:10FD3000022901D0012100E0002101EB410314213F +:10FD400001EBC30151580A6840F8032F496841602C +:10FD5000002101A8FFF790F818E729E16078022850 +:10FD600001D0012000E000202044407A800701D526 +:10FD70001F2003E721207DE5307811282BD18DF855 +:10FD800004A0686A0590B0680390ADF80890082751 +:10FD900007706178E26A022901D0012100E00021A8 +:10FDA00001EB41031C2101EBC301401C51581022FF +:10FDB00010F02DF8002101A8FFF75EF82020287030 +:10FDC0008DF804B0686A05908DF80870314601A876 +:10FDD000FFF752F815E775E03078112872D18DF8E9 +:10FDE00004A0686A0590B06803900820ADF8080088 +:10FDF000039809210170E169097849084170E169B6 +:10FE000051F8012FC0F802208988C180002101A883 +:10FE1000FFF732F8AEE76078022801D0012100E058 +:10FE200000212144497A490701D52220A6E601286C +:10FE300049D068E03078112844D1B0682862232086 +:10FE40002870296904204870206A4860E06A0930F7 +:10FE50008860764873E530780D2833D16178E06AA0 +:10FE6000022901D0012100E0002101EB41012027FE +:10FE700007EBC1011022405871680FF0C8FF8DF8E0 +:10FE800004A0686A0590286A0390ADF8089080F88D +:10FE900000B06278E16A022A01D0012200E000226B +:10FEA00002EB420207EBC202401C895810220FF0FD +:10FEB000AEFF002101A8FEF7DFFF00202862607876 +:10FEC000B5E791E037E02420D4E4607802280BD035 +:10FED00000202044407AC10702D0E178C90705D04C +:10FEE000810705D51920A9E40120F2E71720A5E430 +:10FEF000400701D51B20A1E41C2020706078012858 +:10FF000001D01820B6E42720B4E4282028700B2064 +:10FF100000E63078122849D12920ABE42078012866 +:10FF200044D00C2842D02046FEF7EFFF0C208DF87D +:10FF30000400686A059039E030784FF026081128EF +:10FF400005D012203070032785F800804CE08DF832 +:10FF500004A0686A0590B06803900220ADF808001C +:10FF6000039805210170297F4170002101A8FEF747 +:10FF700083FF0B208DF80400686A0590314601A8C4 +:10FF8000FEF77AFF074685F80080012F0ED02BE0A0 +:10FF900001208DF80400686A059004208DF808009F +:10FFA000287F8DF809000020287712E0287F80B193 +:10FFB0001D202070252028708DF804B0686A0590F7 +:10FFC00002208DF80800314601A8FEF755FF0746CC +:10FFD0000AE00CB1FE2020709DF8040020B1002141 +:10FFE00001A8FEF749FF0AE409B03846BDE8F08FE2 +:10FFF0002DE9F04F0C4601274E69097885B09046EF +:020000040001F9 +:10000000BA464FF00209072021B101294ED002293A +:100010001FD1C8E0217901290AD0022915D003296E +:1000200010D0042915D11BE0C0050200B404020061 +:10003000707801280CD10620616A02F069FB002863 +:1000400007D11AE01D20307017E07178022901D025 +:10005000052796E031780C2927D18DF804000EE0B1 +:100060003078011F042902D30E3803281DD2B07F37 +:1000700002281AD12089022817D38DF8049084F819 +:1000800000A020899DF80410884203D20A208DF830 +:1000900000003FE01121083488F8001094E80E00B9 +:1000A000C8E901120327C8F80C306AE098F800107C +:1000B000112966D18DF80000616A0491D8F80850C2 +:1000C000029521794FF00B0B012906D0022929D086 +:1000D000032911D0042954D15AE0ADF8049085F8D1 +:1000E00000B0207E4F4600F01F0068700021684677 +:1000F000FEF7C2FE377043E0ADF80490052028708B +:10010000207E68704E4600216846FEF7B5FE2670D8 +:100110008DF800B0606A049041466846FEF7ACFE78 +:1001200007462EE0ADF8040085F800A0207F687037 +:10013000607F00F00100A870A07F00F01F00E87051 +:10014000E17F2971C0071FD094F8200000F00F0054 +:10015000687194F8210000F00F00A8710021684632 +:10016000FEF78AFE2868B063A888B087A87986F869 +:100170003E00A069407870772879B0700D2030700B +:100180000027384605B031E70020A8716871E5E71F +:10019000ADF804900E202870207E6870002168461B +:1001A000FEF76AFEECE7FE2030708DF800A0606A72 +:1001B000049004208DF80400207E8DF80500EDE702 +:1001C00000B50023012285B005280FD006280BD1E9 +:1001D00002208DF8002004918DF804008DF8053080 +:1001E00000216846FEF748FE05B000BD8DF80020EE +:1001F00004918DF80420F1E770B50C46054602F035 +:10020000AEFA21462846BDE870407823002202F06D +:1002100009BA08B1007870470C20704770B50C001F +:1002200005784FF000010CD021702146F3F7D7FA82 +:1002300074482178405D884201D1032070BD0220BE +:1002400070BDF3F7CCFA002070BD027B032A05D005 +:1002500000220A704B780B2B02D003E00420704779 +:100260000A770A62027B9300521C0273C15003207A +:100270007047F0B585B00F4605460124287B05EB95 +:10028000800050F8046C7078411E0C290AD25D4938 +:100290003A46123101EB8000314650F8043C2846C2 +:1002A000984704460CB1012C11D1287B401E10F058 +:1002B000FF00287301D00324E0E70D208DF8000033 +:1002C000706A0490002101966846FFF7A7FF032C8F +:1002D000D4D005B02046F0BD70B515460A46044698 +:1002E00029461046FFF7C5FF064674B12078FE2860 +:1002F0000BD1207E30B100202870294604F10C007B +:10030000FFF7B7FF2046FEF700FE304670BD70478E +:1003100070B50E46044688210FF012FE0225012E0C +:1003200003D0022E04D0052070BD0120607000E0D3 +:1003300065702046FEF7E9FDA577002070BD28B165 +:10034000027E1AB10A4600F10C01C5E70120704790 +:1003500030B5044687B00D46062002F000FA294663 +:10036000052002F0FCF92078FE2806D000208DF848 +:10037000000069462046FFF7E2FF07B030BD7FB5B9 +:100380000E4600218DF80C1041780B2903D00C2962 +:1003900003D0002405E0846900E044690CB1217EAB +:1003A00091B16D4601462846FFF74FFF032809D15A +:1003B000324629462046FFF78FFF9DF80C10002992 +:1003C00000D0042004B070BD04F10C05EAE710B5BC +:1003D00090B00C4607900B480421801E08900A48F4 +:1003E0008DF8191009900F92694606A8FFF7C7FF0C +:1003F000002805D11022204601990FF008FD0020A9 +:1004000010B010BDBA040200C005020070B50D4660 +:10041000040011D085B1210128460FF06FFD102294 +:100420004E4928460FF0F3FC4C4801210838018062 +:1004300044804560002070BD012070BD70B5474EFE +:1004400000240546083E10E07068AA7B00EB04100B +:10045000817B914208D1C17BEA7B914204D10C227D +:1004600029460FF0A8FC30B1641C30888442EBDBD5 +:100470004FF0FF3070BD204670BD70B50D460600D0 +:1004800006D02DB1FFF7DAFF002803DB401C14E093 +:10049000102070BD314C083C20886288411C91427C +:1004A00001D9042070BD6168102201EB00103146B3 +:1004B0000FF0ADFC2088401C20802870002070BD0B +:1004C00070B514460D0018D0BCB10021A1700228EF +:1004D00002D0102811D105E0288870B10121A17047 +:1004E000108008E02846FFF7A9FF002805DB401C24 +:1004F000A070A8892080002070BD012070BD70B55B +:10050000054614460E000BD000203070A878012854 +:1005100008D005D91149A1F108010A8890420AD9E9 +:10052000012070BD24B1287820702888000A5070FE +:10053000022008700FE064B14968102201EB00113D +:10054000204610390FF063FC287820732888000AB1 +:10055000607310203070002070BD0000700000201B +:100560002DE9F041FE4C207EE17D884208BFBDE8C8 +:10057000F0810126FB4D0027E07D215C01EB81022B +:1005800005EB8200037C052B18D0037C062B23D0BF +:10059000037C072B34D0437C002B08BFFFDF29D01E +:1005A0004774E07D16280EBF0020E07D401CE075FA +:1005B000481CC0B255F8222007211AE00674E07DDD +:1005C00016281ABFE07D401C0020E075481CC0B210 +:1005D00055F8222002210CE00674E07D16281ABF8F +:1005E000E07D401C0020E075481C55F82220C0B278 +:1005F00003219047207EE17D8842BDD1BDE8F08196 +:100600000674E07D16281ABFE07D401C0020E075CE +:10061000481CC0B255F822200821EAE770B5D24D37 +:100620000C2085F82900A5F53B70002480F8CD4109 +:1006300080F8CC4100F5F4700476C47505F12C0007 +:100640000EF006FEA5F58E70047585F82B40601E31 +:100650002C60A86085F8254085F8224085F8234065 +:1006600085F8244085F82140C048A5F1E8010470D0 +:100670004470002000EB800201EB82021474401CE5 +:10068000C0B20B28F6D30120F8F720FF0020F8F7BE +:100690001DFF012085F82600F9F704FCB448F9F79E +:1006A00010FCB44C2070B448F9F70BFC6070BDE846 +:1006B0007040F8F79FBE10B5F8F7CAFEAD4C207831 +:1006C000F9F718FC6078F9F715FCA74C94F82800A6 +:1006D000002808BF10BDF9F7FEF8002084F82800B4 +:1006E00010BD0B20704770B59F4C94F82600002871 +:1006F0001CBFFFDF70BD94F82B00002808BFFFDF90 +:10070000F8F78FFF62690025811A6FF07F43B1F51A +:10071000800F24BFA2EB000CBCF5800F0DD38B42E1 +:1007200003D2991A0844411C07E0634528BFFFDF44 +:1007300005D2181A1044401C4142002900DBFFDF9B +:10074000012684F8266084F82B5094F829100420A0 +:10075000844A01EB810102EB81010874A068B0F1C9 +:10076000FF3F04D0B01EA0600120F8F7AFFE0020CC +:10077000F8F7ACFEF8F7E7FFF8F78EFE25600EF00D +:100780000BFFF8F7D7FF7D48056005604FF0E021CB +:100790004FF40040C1F88002F9F761F8734800781F +:1007A000022804D0032805D194F8230010B184F85E +:1007B000226001E084F82250BDE87040F8F79EBF47 +:1007C000034668490B2000BF00EB800201EB820268 +:1007D00012F8042C22B1401E10F0FF00F4D1704733 +:1007E00000EB800201EB8201012241F8143C01F888 +:1007F000042C7047012804D0032808BF002926D004 +:1008000000E021B3584B4FF0000C83F821C0574A49 +:100810000028907014BF022882F803C00BD007296B +:1008200015D2DFE801F01404060C0E1012001B2094 +:1008300000E03A20D070012083F821007047582052 +:10084000F8E77720F6E79620F4E7B520F2E70020F6 +:100850007047464810B54078F8F78AFF80B210BD5F +:1008600030B5421E3F49002500EB800001EB8004BB +:100870000A2A02D814F8040C00B9FFDF14F8040C9B +:10088000012818BFFFDF04F8045C30BD70B53C4C94 +:1008900094F8CD0194F8CC1188420CBF01250025B5 +:1008A000F8F7BFFEF8F764FF94F8CD1194F8CC2167 +:1008B00091420CBF01210021A942E9D170BD30B5A0 +:1008C0000D46304A44190021101A71EB010038BF5F +:1008D000FFDF2D488542C8BFFFDF2C488542B8BFE7 +:1008E000FFDF2B488442A8BF2A4804DA002CAABFA5 +:1008F0002046274830BD201830BD70B5194900EB9F +:10090000800001EB8004244A54F8101D607A00280E +:1009100052F8202011440CBF04200220084420F08B +:100920007F40F8F725FF94F90850164A4419002132 +:10093000101A71EB010038BFFFDF13488542C8BFB2 +:10094000FFDF12488542B8BFFFDF11488442A8BFCD +:10095000104804DA002CAABF20460D4870BD1DE0E7 +:10096000D8080020F4080020DC09002082000020C4 +:10097000D1240100800000206105010000F5004045 +:10098000F0060020FF7F841E0020A10700E05EF833 +:100990000080841E00807BE1FC040200201870BDF2 +:1009A0002DE9F04F0646FF4885B00068C005C00D30 +:1009B00011D0103840B20028B8BF00F00F0000F18D +:1009C000E020B4BF90F8140D90F80004400908BF6F +:1009D0004FF0010A01D04FF0000A307800281FBF05 +:1009E0000128002005B0BDE8F08F307900280CBF49 +:1009F00004210221EC4ABAF1000F52F8200001EB69 +:100A0000000903D1E949002081F827006C4602AAB9 +:100A10002146B068F8F7B9FE9DF90820F068211D5D +:100A200010440122C01C1F28B8BF019208DB03AA92 +:100A3000F8F7ABFE9DF80C0010B10198401C019036 +:100A4000DDE900100844401D20F07F400190A1EB3B +:100A5000090020F07F40009070798DF80A0000981E +:100A60000390F8F7DEFD009A019B121A181AD0497C +:100A700022F07F4220F07F40B2F5800F26D28142E3 +:100A800024D3CA4890F82950009CCA4F181B20F064 +:100A90007F486FF07F40001BAB4604900C2D24D0A4 +:100AA00005EB850007EB80026FF07F435068011B68 +:100AB000B1F5800F12D3A4EB000CBCF5800F0DD361 +:100AC0008B4205D204990844411C07E000205FE0F6 +:100AD000634509D2191A0819401C41420029BCBFBC +:100AE000AB46957CDADB00E0FFDF5D4525D00BEB04 +:100AF0008B0007EB80026FF07F4091680B1BB3F512 +:100B0000800F12D3A4EB010CBCF5800F0DD39842DB +:100B100003D204980844431C07E0604528BFFFDF68 +:100B20000BD2431A1819401C4342002B05DD9DF8D7 +:100B30000A00927B904228BF0C460C2D18BF9DF8EE +:100B40000A1010D005EB850007EB80004268121BED +:100B500022F07F42424506D2827B914228BF8468C0 +:100B6000857C0C2DEED10098A04205D004EB080046 +:100B700020F07F400094019000990398814206D0B4 +:100B800001EB090020F07F40F8F7F2FDB060012092 +:100B9000864991F82710002904BF05B0BDE8F08F01 +:100BA000BAF1000F3FF42EAF05B0BDE8F08F2DE98C +:100BB000F04F064687B00C467F480EF051FB4FF0D1 +:100BC0000108002835D07D4F387D002818BFFFDF91 +:100BD0003E742079794D05F10C02287260796872B3 +:100BE0002946A068F8F7D1FD95F90C000F2804DD1F +:100BF0001F3828732868401C286095F90C00E168AC +:100C00002E1D0844C01C1F28B8BFC6F8008009DB91 +:100C10006A463146F8F7B9FD9DF8000010B130681A +:100C2000401C30602078A87287F8148007B0BDE8B7 +:100C3000F08F634D95F8CD0116281ED095F8CD01A3 +:100C400095F8CC11401C884200D1FFDF5548006860 +:100C5000C005C00D1AD0103841B20029BDBF01F047 +:100C60000F0000F1E02090F8140D01F1E020A8BF82 +:100C700090F80004400909D104E095F8CC0100285F +:100C8000E4D1E2E72078002818BFFFDF4C4890F855 +:100C9000CD1101EB810100EB810006742078012861 +:100CA00000F04A81022843D0454890F8CD1101EB6D +:100CB000810100EB8105207928726079687205F165 +:100CC0000C022946A068F8F760FD95F90C000F2882 +:100CD00004DD1F3828732868401C286095F90C1023 +:100CE000E0682E1D0844C01C1F28B8BFC6F800804D +:100CF00009DB6A463146F8F748FD9DF8000010B15F +:100D00003068401C30602078A8722D4890F8CD11D2 +:100D100016290EBF002190F8CD11491C80F8CD1185 +:100D200025480EF0B3FA07B0BDE8F04FF8F7E6BC7F +:100D3000234890F8CD1101AA01EB810100EB810756 +:100D40006946E068F8F721FD9DF904000F28CCBF43 +:100D50000120002000993D1D08440190A068C01C9E +:100D60001F28B8BFC5F8008009DB6A462946F8F796 +:100D70000CFD9DF8000010B12868401C286002207E +:100D8000B872607978722079387200280CBF04211B +:100D90000221054A52F82000014403917A68481D57 +:100DA00010440FE004ED00E0FC040200DC09002028 +:100DB000FFFF3F00F4080020080A0020C0080020C0 +:100DC000F00600200199009008440399401A05900C +:100DD000FD4C002084F82700F8F723FC38600199C7 +:100DE0008046084420F07F40F86094F829000C28E1 +:100DF0007ED0214691F8290000EB8002A1F1E800A5 +:100E000000EB82025668009A324422F07F4202923E +:100E100097F809B091F829503446111B21F07F4A08 +:100E20006FF07F41891BA94604910C2D23D0E74820 +:100E300005EB850100EB81026FF07F435068011BD9 +:100E4000B1F5800F24BFA4EB000CBCF5800F0BD3D1 +:100E50008B4203D204990844411C05E0634509D242 +:100E6000191A0819401C41420029BCBFA946957CAB +:100E7000DBDB00E0FFDF4D4524D0D44809EB8901DE +:100E800000EB81036FF07F429868011BB1F5800F82 +:100E900012D3A4EB000CBCF5800F0DD38A4203D211 +:100EA00004990144491C07E0624528BFFFDF09D2CD +:100EB000121A1119491C4942002903DD997B8B45FF +:100EC00028BF04460C2D18BFC04910D005EB850083 +:100ED00001EB80004268121B22F07F42524506D28D +:100EE000827B934528BF8468857C0C2DEED100E081 +:100EF0001BE0A64205D004EB0A0020F07F40264606 +:100F00000290029AA6EB080020F07F40A2EB0802B4 +:100F1000059922F07F42B0F5800F06D2914204D3AA +:100F20000398304420F07F403860A74890F82700AD +:100F300000287FF44DAFE8E6A548851915F8010CA7 +:100F4000002818BFFFDF05F8018CADE60020F8F798 +:100F5000ADBA0120F8F7AABA9E48007870472DE98B +:100F6000F0419A4E00274FF00308012506F1E804EE +:100F700050B301285BD0022800F0E98003281CBF91 +:100F8000FFDFBDE8F08194F829000C2808BFFFDFDF +:100F900084F8267084F82B5094F8290000EB800028 +:100FA00006EB800080F81080F8F7AFFB94F829007A +:100FB00094F82910401CC0B201EB810156F82120A1 +:100FC000BDE8F0410521104794F829000C2808BF1E +:100FD000FFDF84F8267084F82B5094F8290000EB8A +:100FE000800006EB800080F81080F8F78EFB207FF1 +:100FF000002818BFFFDF84F825500020F8F766FAB4 +:10100000A168B1F1FF3F04D0012300221846F8F790 +:10101000A1FA94F8290094F82910401CC0B201EB01 +:10102000810156F82120BDE8F0410121104794F8D4 +:1010300029000C2808BFFFDF84F8267084F82B50A5 +:1010400094F8290000EB800006EB800080F8108007 +:10105000F8F75BFB0120F8F739FA94F8250000282F +:101060001CBFA068B0F1FF3F0DD094F8290094F8A0 +:101070002910401CC0B201EB810156F82120BDE8C7 +:10108000F04106211047207F012815D002281FD0EB +:10109000032833D004281CBFFFDFBDE8F08194F89B +:1010A000201060680123411A00221846F8F752FA0E +:1010B00094F82800B8BB37E094F8240028B184F8ED +:1010C0002470F8F729FB84F823502777BDE8F081D6 +:1010D00094F8280018B9F8F7D5FB84F8285094F84C +:1010E000290094F82910401CC0B201EB810156F888 +:1010F0002120002190472777BDE8F081217B60689F +:101100000123411A00221846F8F724FA94F8240023 +:1011100028B184F82470F8F7FFFA84F823500220ED +:101120002077BDE8F08103E0F8F7ACFB84F82850A5 +:1011300094F8290094F82910401CC0B201EB8101F9 +:1011400056F82120002190472577BDE8F0812148FD +:101150000078BDE8F041F8F7D3BE10B51A4C94F80A +:1011600029000C2808BFFFDF94F8290094F8291003 +:10117000401CC0B2154A01EB810152F82120BDE8A4 +:101180001040042110472DE9F84F8046087C104C90 +:10119000401EC6B20D46A05D01281DD0022825D0F4 +:1011A000297CDFF828A0481EC4B204EB84020AEBB5 +:1011B0008206371D0A2821D801EB81000AEB800046 +:1011C00010F8040CD8B919E0DC090020F40800205C +:1011D000D009002080000020A87A012814BF022036 +:1011E0000020A05518BFBDE8F88FD9E7A87A0128DC +:1011F00018BFFFDF0021A972A155D1E7FFDF307CC6 +:10120000DFF8289407280BD11720009099F81720B1 +:1012100009F11803494620460DF098FD012030746D +:10122000307C012804D0A87A012818BFFFDF02D043 +:10123000A87A01284BD1FE4B307C022818D099F8AF +:101240001800162872D099F8180099F81710401C49 +:10125000884200D1FFDF0120707499F8180009F866 +:10126000004099F81800162800F09E8100F093B90C +:10127000F04A92F829000146A04207D0014600EB4F +:10128000810003EB8000807CA042F7D192F829C056 +:1012900084450CD192F8291001EB810103EB810107 +:1012A000897C82F82910012182F82A1009E000EBDC +:1012B000800203EB820201EB810103EB8101927C4E +:1012C0008A7400EB800003EB80000C218174287A83 +:1012D000D949002851F820A02968A1EB0A010CBFC8 +:1012E00004200220081A20F07F423A60D5E900016C +:1012F000084420F07F407860A87A022818BF287B35 +:101300001ED038727868401D20F07F407860687A7F +:10131000B872287A06257872032872D2002870D015 +:1013200000F022FE00286DD0A1E0FFE799F8170039 +:10133000002890D18EE700BF89F81800BDE8F88F2B +:10134000287A00280CBF0420022000EB0A036868FA +:10135000591D00EB010BB9484078504503D9B549F8 +:1013600091F8231011B10BF1060003E0A0EB0A0085 +:101370005844801DAF4991F829C0BCF10C0F25D00D +:1013800091F829C00CEB8C0EA1F1E80C0CEB8E0C43 +:10139000DCF804C0624519D0DFF8A4C291F8291026 +:1013A00001EB8102A24901EB82014A688968A2EB44 +:1013B000080222F07F42A1EB080121F07F41904218 +:1013C00098BFB2F5800F9DD28C459BD34044A0EBD3 +:1013D0000B0020F07F4139601944E86821F07F411B +:1013E0000A1A6FF07F4CB2F5800F24BF431AB3F591 +:1013F000800F11D3944506D2ACEB00000844421C88 +:101400000AE034E02FE09C4528BFFFDF1DD2ACEBA3 +:1014100001010844401C4242002A16DD05203074B8 +:1014200099F81800162819D099F8180099F817108B +:10143000401C884200D1FFDF99F8180009F80040ED +:1014400099F8180016287BD0A5E03868ABF10501A3 +:10145000084420F07F407860002052E799F8170098 +:101460000028E9D1E7E7CAF138054FF0320A73489E +:101470000178012918BF03290AD14078504507D9BE +:101480006C4991F82310002904BFA0EB0A00054421 +:101490006B4B3868A0EB0802786822F07F41A0EB24 +:1014A000080020F07F4C8D4298BFB1F5800F1BD211 +:1014B000634519D35F4991F829300C2B30D091F84E +:1014C00029504FF00C0BDA46594905EB850301EB27 +:1014D0008303D3F808C0ACEB080C944531D8AB4675 +:1014E0009D7C0C2DF0D193E00520307499F8180004 +:1014F000162810D099F8180099F81710401C884247 +:1015000000D1FFDF99F8180009F8004099F8180099 +:10151000162849D03FE099F817000028F2D1F0E7EB +:101520000220307491F829000C2818BF91F8290086 +:10153000B07481F82940012081F82A00BDE8F88FB5 +:1015400032E00C2D1CBFAA46002261D00AEB8A03B0 +:1015500001EB8303D3F804C0ACEB080C84452CD218 +:101560009A7B97F80AC0944520D30520307499F8E7 +:101570001800162813D099F8180099F81710401C75 +:10158000884200D1FFDF99F8180009F8004099F867 +:101590001800162808D099F81800401CCCE699F8D5 +:1015A00017000028EFD1EDE70020C5E693F812A060 +:1015B0000122BAF10C0FC9D103E0002A08BFAA46E4 +:1015C00026D02F461A4807EB870100EB8108062238 +:1015D00088F8102099F81800162838D099F81800C3 +:1015E000411C99F81700814200D1FFDF99F81800DB +:1015F00009F8007099F8180016280EBF002099F815 +:101600001800401C89F8180098F81270BA45D9D112 +:101610000220074F307407F1E80090F82910A94222 +:101620001AD186F812A080F829400BE0D8080020D3 +:10163000F4080020DC090020FC04020082000020E5 +:10164000FFFF3F00012180F82A10BDE8F88F99F8CC +:1016500017000028CAD1C8E70C2D0CD0BBF10C0F25 +:1016600008BFFFDF0BEB8B0007EB8000847486F86C +:1016700012A0BDE8F88FBBF10C0F08BFFFDF0BEB2A +:101680008B0007EB800084740C20B074BDE8F88FE9 +:101690002DE9F04F83B0F7F7C4FF05464FF00C0B70 +:1016A000FE4C94F829100026A4F1E8094FF0010837 +:1016B0000C292FD094F82920214602EB820209EB55 +:1016C0008202127C042A25D091F8292002EB8202A2 +:1016D00009EB8202127C032A04BF03B0BDE8F08F3D +:1016E0002A4620696169801A491BED4B20F07F4032 +:1016F00021F07F4106283CBF03B0BDE8F08FB0F574 +:10170000800F24BF03B0BDE8F08F8B423CBF03B015 +:10171000BDE8F08FA068B0F1FF3F18BFFFDF84F88D +:10172000256094F82900DF4F0C2809D094F829008F +:1017300000EB800009EB8000007C042808D01AE050 +:1017400094F82100B8B1F8787870B878387012E061 +:1017500094F829B00BEB8B0009EB800080F8108027 +:1017600094F8290000EB800009EB8000807C84F86D +:10177000290084F82A80DFF830A39AF8CD019AF87E +:10178000CC11884219D000BF9AF8CC0100EB800040 +:101790000AEB80012846FFF7F6FC9AF8CC011628E0 +:1017A0000EBF00209AF8CC01401C8AF8CC019AF8B0 +:1017B000CD019AF8CC118842E6D1DFF8F0A29AF870 +:1017C000140028B151462846FFF7DDFC8AF8146062 +:1017D000BBF10C0F06D00BEB8B0009EB8000017CFA +:1017E00001292BD094F829000C2800F0ED8094F802 +:1017F0002A00002800F0F78084F82A6094F8290075 +:1018000000EB8001AA4800EB8102A0F50173D2E948 +:101810000101D268C3F80423C3E9BF01607E002838 +:101820000CBF4FF004094FF00209A249022811F839 +:101830002010217318BF012834D123E0072101743F +:10184000DFF874A29AF81800162816D09AF8180033 +:101850009AF81710401C884200D1FFDF9AF8180050 +:101860000AF800B09AF8180016280EBF00209AF85F +:101870001800401C8AF81800B4E79AF817000028EE +:10188000ECD1EAE720690844421B22F07F42382A63 +:1018900008D903213238617620F07F402061322060 +:1018A000207309E0322907D294F8280058B9F7F7D5 +:1018B000E9FF84F8288006E094F8280018B1F8F7CA +:1018C0000AF884F828607B7884F8203094F80CA01B +:1018D00038780621A3EB0A02012818BF032804D197 +:1018E00084F82480002AC8BF911D94F822B0BBF16F +:1018F000000F18BF891C206901905044484420F013 +:101900007F406060BAF1000F14BF022000202077F2 +:1019100094F82400002808BFBBF1000F37D06048BE +:101920000090D4F810E0D4F814C0AEEB050E2EF001 +:101930007F4EACEB050C20462CF07F4C714598BFD8 +:10194000BEF5800F1FD2009961451CD3002A0FDD20 +:101950000199BAF1000FA1EB020101611944494458 +:1019600021F07F4141600CBF0121032121770EE06E +:1019700004DA002B0CBF02210421F7E7BBF1000FB2 +:1019800008BFFFDF03E080F8246084F82260207F36 +:1019900040B12069012300EB090100221846F7F746 +:1019A000D9FD02E00120F7F791FD94F82900012309 +:1019B00000EB80013E4800EB8100616890F90C204B +:1019C0000020F7F7C7FD0EE00120F7F77FFD0020AC +:1019D000F7F77CFDF7F760FD94F8280018B1F7F7EA +:1019E0007AFF84F8286094F8220028B1F7F794FE73 +:1019F00084F8236084F8226094F8210018B1F87804 +:101A00007870B878387094F8240030B184F8236086 +:101A10003878002808BF84F824602748017EC07DFC +:101A2000814203D025484078F8F76AFA84F8278085 +:101A300003B0BDE8F08F70B5184C054682B094F83D +:101A400029000C2808BFFFDF94F8290000EB800074 +:101A5000174E06EB8000007C032818BFFFDFA0684C +:101A6000B0F1FF3F18BFFFDF94F8290001AA00EB97 +:101A7000800006EB8000694690F90C002844F7F7D7 +:101A800084FE9DF904000F28CCBF0120002000999E +:101A900008446168084420F07F4111E0DC0900201F +:101AA000FFFF3F0082000020F0060020C008002059 +:101AB000F4080020FC040200D80800208000002068 +:101AC000A16094F82500002804BF02B070BD012376 +:101AD00002B00022BDE870401846F7F73BBD744ADB +:101AE0000B1A02F1010CB3EB9C0F3CBF1846704778 +:101AF00010B5441AB4EB9C0F3CBF184610BD9A4277 +:101B000003D2101A0844401C10BD94429EBFFFDF50 +:101B1000002010BD511A0844401C404210BD012352 +:101B2000002201460220F7F715BD0220F7F7CEBCD0 +:101B3000F7F777BD2DE9F0415E4C054682B094F889 +:101B40002B00002808BFFFDF642D50D35A48002225 +:101B5000401B72EB02004AD3584890F8CD1190F820 +:101B6000CC01814243D15648007D00283FD194F8F2 +:101B70002900DFF8508100EB800008EB8006206828 +:101B800001AA28446946F7F700FE9DF904000028E1 +:101B900002DD0098401C0090B168009872680F1830 +:101BA000BA1A22F07F42B2F5800F20D2B27C0C2A02 +:101BB00009D002EB820208EB82025268511A21F02E +:101BC0007F41814213D3A068B0F1FF3F05D00120CF +:101BD000F7F77CFC4FF0FF30A060206828442060BD +:101BE00027F07F40606102B00120BDE8F08102B0C3 +:101BF0000020BDE8F0812DE9F8430646401EC7B23B +:101C0000304807EB870100EB8104207C002808BFE7 +:101C1000FFDF2A4A92F8CC1192F8CD0181420DD013 +:101C200001EB810302EB83031B7CB34210D0162926 +:101C30000CBF0021491CC9B28142F1D120484FF0AC +:101C4000170800F11805017D29B3007CB04222D1AC +:101C50000020BDE8F883207C05281FBF207C0628D3 +:101C6000207C07280AD184F81090CDF80080EA7D06 +:101C700005F11803144938460DF068F8607C68B126 +:101C80006674CDF80080EA7D05F118030E493846E8 +:101C90000DF05CF802E04FF001090026207C0128DD +:101CA00004BF607C0028D6D10120BDE8F883000085 +:101CB000FF7F841EDC090020FF1FA107F006002023 +:101CC000C0080020F4080020D8080020F0B5734AAE +:101CD000D2F80032724D002401212E7856B9714E8F +:101CE0003460704F03263F1D3E606E4F04260C3754 +:101CF0003E602970C2F80042D1601160694C4834DE +:101D0000D16425688542FBD35160D160C2F80032AE +:101D1000F0BD2DE9F041044680074FF000054FF07B +:101D2000010604D560480560066024F00204E00462 +:101D30004FF0FF3705D55D484660C0F8087324F4BE +:101D40008054600003D55A48056024F08044E005C3 +:101D50000FD55248C0F80052C0F8087351490D60C1 +:101D6000091D0D604F4A04210C321160066124F4F4 +:101D70008074A00409D54F484660C0F80052C0F8EE +:101D800008734D48056024F40054C4F38030C4F354 +:101D9000C031884200D0FFDF14F4404F14D04748D0 +:101DA0004660C0F8087346488660C0F80052C0F824 +:101DB000087344490D600A1D16608660C0F80873F8 +:101DC0000D60166024F4404420050AD53E48466064 +:101DD0008660C0F80873C0F848733C48056024F476 +:101DE00000640DF0B3FB3A48044200D0FFDFBDE8C9 +:101DF000F08170B5202500224FEA020320FA02F19B +:101E0000C90719D051B201F01F060124B4404E0990 +:101E1000B60006F1E026C6F88041C6F880420029E7 +:101E200006DA01F00F0101F1E02181F8143D03E031 +:101E300001F1E02181F80034521CAA42DED370BDCA +:101E400070B5174C0D466060FFF763FF6068FFF7E1 +:101E5000D0FF2846F7F7F3FD0CF0D2FF00F0D5F8DD +:101E60000DF074FB0DF0BFFAF8F71CF8BDE87040F8 +:101E70000DF074B810B50A4C6068FFF74AFF60684F +:101E8000FFF7B7FF0DF062FBF7F79DFE00206060E3 +:101E900010BD034840687047022070470080004032 +:101EA0008800002004850040FC1F004000C0004066 +:101EB00004E5014000D0004004D5004000E00040AF +:101EC00000F0004000F5004000B0004008B50040C0 +:101ED000FEFF0FFC70B51F490A68BAB100231D460A +:101EE00001244A68521C4A60092A00D34D600E79C9 +:101EF00004FA06F20E6816420AD072B60B689343D3 +:101F00000B6062B649680160002070BD052070BD9D +:101F10005B1C092BE5D3FFDFF8E74FF0E0214FF41E +:101F20008000C1F800027047EFF3108111F0010F3B +:101F300072B64FF0010202FA00F20648036842EA64 +:101F40000302026000D162B6E7E7024800210160A7 +:101F500041607047900000200120810708607047B1 +:101F6000012081074860704712480068C00700D010 +:101F7000012070470F48001F0068C00700D00120F3 +:101F800070470C4808300068C00700D00120704737 +:101F9000084810300068704706490C310A68D203BF +:101FA00006D5096801F00301814201D10120704783 +:101FB000002070470C040040C84911F8210F4978EF +:101FC000884201D3401A02E0C1F121010844C0B2A5 +:101FD0007047C249233111F8210F4978884201D353 +:101FE000401A02E0C1F121010844C0B27047BB4968 +:101FF000463111F8210F4978884201D3401A02E096 +:10200000C1F121010844C0B27047B54910B5802024 +:1020100081F80004B1490020233101F8210F4870F4 +:10202000AE4901F8210F4870AC49463101F8210F43 +:102030004870AC480DF00CF9AA48401C0DF008F9A6 +:10204000F7F708FEBDE8104000F03DB920207047CA +:10205000B2E770B50C4605460026FFF7ADFF014616 +:102060009E48A14212D30022641EE4B20DD390F820 +:102070002210435C491CC9B205F8013B80F82210CC +:102080002129F1D180F82220EEE7012600F01BF98A +:10209000304670BD202070479BE770B50C46054662 +:1020A0000026FFF796FF01468C482330A14212D349 +:1020B0000022641EE4B20DD390F82210435C491C48 +:1020C000C9B205F8013B80F822102129F1D180F82E +:1020D0002220EEE7012600F0F6F8304670BD202100 +:1020E00001700020704710B50446FFF780FF207094 +:1020F000002010BD70B50C460546FFF778FF01467D +:1021000076484630A14213D30022641EE4B20DD3B8 +:1021100090F82210435C491CC9B205F8013B80F8D5 +:1021200022102129F1D180F82220EEE7002401E0DD +:1021300042F2070400F0C7F8204670BD70B50C46A7 +:102140000546212900D9FFDF67480068103840B2F2 +:1021500000F0A0F8C6B20D2000F09CF8C0B2864294 +:1021600004D2FFDF02E000BFF7F7C4FD2146284696 +:10217000FFF76FFF0028F7D070BD2DE9F047DFF8BB +:102180006481564CA8F101080746233498F80000F2 +:10219000DFF84891002604F1230A38B994F8221098 +:1021A00094F82100212200F084F890B14D4699F86E +:1021B000221099F82100212200F07BF8B8B1554691 +:1021C0009AF822109AF82100212200F072F848B300 +:1021D00035E094F82100275494F82100401CC0B247 +:1021E00084F8210021282AD184F8216027E095F87D +:1021F00021002F5495F82100401CC0B285F8210021 +:10220000212801D185F8216098F800004746B0B137 +:1022100095F8221095F82100212200F04AF870B1BB +:102220003E700CE095F821002F5495F82100401CD9 +:10223000C0B285F82100212801D185F8216094F8E9 +:10224000221094F82100212200F033F800281FD03A +:1022500099F8221099F82100212200F02AF800288C +:1022600016D09AF822109AF82100212200F021F8C5 +:1022700000280DD0F7F714FD1A480CF0F1FFB0F567 +:10228000005F00D0FFDFBDE8F04716480CF0FEBF4E +:10229000BDE8F087002806DA00F00F0000F1E0202A +:1022A00090F8140D03E000F1E02090F800044009DC +:1022B0007047401C884204D0904200D109B10020F0 +:1022C00070470120704710B506480CF0C9FF002880 +:1022D00003D1BDE81040F7F7CEBC10BD0C0A0020BA +:1022E0000DE000E09900002004ED00E016490878B8 +:1022F0004A78401CC0B2904205D0144B01221A60AB +:10230000BFF34F8F087070472DE9F0410E4C4FF02E +:10231000E02600BFF7F774FD20BF40BF20BF6778FD +:1023200020786070D6F80052EEF7ECFF854305D1B7 +:10233000D6F8040210B92078B842EBD0F7F75BFD6D +:102340000020BDE8F08100009B000020180502403D +:102350002DE9F041012528034FF0E0210026C1F8C6 +:1023600080011E4CC4F800610C2000F02CF81C48C1 +:1023700001680268C94341F3001142F01002026093 +:10238000C4F804532560491C00E020BFD4F80021A4 +:10239000002AFAD019B9016821F010010160114832 +:1023A00007686560C4F80853C4F800610C2000F0A9 +:1023B0000AF83846BDE8F08110B50446FFF7C8FFBB +:1023C0002060002010BD00F01F0201219140400953 +:1023D000800000F1E020C0F88012704700C000408B +:1023E00010ED00E008C500402DE9F047F84C064626 +:1023F000FF21606800EB061211702178FF2916D0CA +:102400004FF0080909EB011109EB06174158C059B3 +:10241000491E21F07F4100F0DDF918B194F80080E9 +:10242000454614E06168207801EB061108702670BB +:10243000BDE8F087626809EB0510D159105800F02B +:10244000C9F930B96068A84600EB08100578FF2D7F +:10245000F0D1606800EB061100EB08100D700670FB +:10246000E6E7F0B5DA4B0446002001255A680C2651 +:102470001B7A0BE005EB0017D75DA74204D106EBF2 +:102480000017D7598F4204D0401CC0B28342F1D804 +:10249000FF20F0BD70B5FFF74BFBCD4C0146082582 +:1024A0002278606805EB0212805800F093F9012849 +:1024B00008D92178606805EB01114058BDE87040EB +:1024C000FFF72DBBFEF748FDBDE87040F7F718BDDC +:1024D0002DE9F041BE4C2578FFF72AFB0146FF2D80 +:1024E0006FD04FF00808626808EB0516905900F0AD +:1024F00071F90228606801D980595EE000EB05118E +:1025000009782170022101EB0511425C5AB1521E7B +:102510004254815901F5000121F07F418151284643 +:10252000FFF762FF34E00423012203EB051302EB03 +:10253000051250F803C0875CBCF1000F10D0BCF549 +:10254000806F10D9CCF3090250F806C00CEB423C66 +:102550002CF07F4C40F806C0C3589A1A920A09E042 +:10256000FF2181540AE0825902EB4C3222F07F4273 +:102570008251002242542846FFF736FF0C21606842 +:1025800001EB05114158E06850F827203846904784 +:102590002078FF2815D0FFF7CBFA01462278606833 +:1025A00008EB02124546805800F014F9012891D931 +:1025B0002178606805EB01114058BDE8F041FFF754 +:1025C000AEBABDE8F081F0B51D4614460E4607468A +:1025D000FF2B00D3FFDFA00700D0FFDF7C48FF21E7 +:1025E0000022C76044600572067401704270104694 +:1025F000012204E002EB0013401CE154C0B2A842E7 +:10260000F8D3F0BD70B5724C06466578207C8542E3 +:1026100000D3FFDFE06840F825606078401C607000 +:10262000284670BD2DE9FF5F1D468B460746FF24F7 +:10263000FFF77EFADFF89891064699F80100B84254 +:1026400000D8FFDF00214FF001084FF00C0A99F885 +:102650000820D9F804000EE008EB0113C35CFF2B3F +:1026600027D0BB4205D10AEB011350F803C0DC456B +:1026700021D0491CC9B28A42EED8FF2C1BD008EBEE +:1026800004110AEB0412475440F802B00421029BE3 +:102690000022012B01EB041111D042504FF480684D +:1026A00008234FF0020C454519D9A905890D08D01A +:1026B00008E00C46DDE7FF2004B0BDE8F09F455080 +:1026C000ECE7414606EB413203EB041322F07F4274 +:1026D000C250691A0CEB0412890A81540BE005B947 +:1026E000012506EB453103EB041321F07F41C15076 +:1026F0000CEB0411425499F800502046FFF774FE89 +:1027000099F80000A84201D0FFF7C4FE3846D3E78D +:1027100070B50C460546FFF70BFA064621462846DB +:10272000FFF79FFE0446FF2817D0294D082101EB33 +:10273000041168684058314600F04CF800F58050AC +:10274000400B02216A6801EB0411515C09B100EBF6 +:102750008120002800D1012070BD002070BD2DE92E +:10276000F0410F468046FFF77CFEFF281BD0184E35 +:10277000357871682A462C4605E0844206D0254605 +:1027800001EB05131C78FF2CF7D10CE0FF2C0AD0CD +:10279000A5420CD101EB021000783070FF2804D064 +:1027A000FFF778FE03E000200BE7FFF7BEF939469C +:1027B0004046FFF7ADFFFF220123716803EB0413CE +:1027C000CA5401EB041201EB051112780A70F8E605 +:1027D000780A0020401A20F07F40B0F5000F00D9A1 +:1027E0000020704770B50446A0F500002C4EB0F1F3 +:1027F000786F02D23444A4F500042A48844201D2FE +:10280000012500E0002500F041F830B1B4420BD3BF +:102810002548006804E0284370BDB44204D323482F +:10282000844201D20120F6E70020F4E710B5044607 +:10283000A0F50000B0F1786F03D219480444A4F564 +:10284000000400F023F84FF0804130B116480068D2 +:1028500004E08C4204D2012003E014488442F8D200 +:10286000002080F0010010BD10B520B1FFF7DEFFA1 +:1028700008B1012010BD002010BD10B520B1FFF738 +:10288000B1FF08B1012010BD002010BD0848094962 +:102890000068884201D10120704700207047000085 +:1028A000000000200010020020000020080000208E +:1028B000A0000020BEBAFECA0548064A016891423F +:1028C00001D1002101600449012008607047000027 +:1028D000A0000020BEBAFECA40E5014053480021D6 +:1028E0000170417010218170704770B50546164621 +:1028F0000C460220F0F725FB4C49012008704C499A +:10290000F01E08604B480560001F046070BD10B5E4 +:102910000220F0F716FB45490120087046480021C7 +:10292000C0F80011C0F80411C0F8081143494FF471 +:102930000000086010BD3D480178C9B1404A4FF41D +:10294000000111603C49D1F800310022002B1CBF6E +:10295000D1F80431002B02D0D1F8081111B1427026 +:10296000102103E00121417036490968817002702D +:102970000020F0F7E6BA2D480178002904BF40781E +:1029800070472D48D0F80011002904BF022070477D +:10299000D0F8001100291CBFD0F80411002905D07F +:1029A000D0F80801002804BF0120704700207047BC +:1029B0001E4800B50278204B4078C821491EC9B294 +:1029C00082B1D3F800C1BCF1000F10D0D3F80001E0 +:1029D00000281CBFD3F8040100280BD0D3F808014D +:1029E00050B107E0022802D0012805D002E00029FA +:1029F000E4D1FFDF002000BD012000BD0B480178BD +:102A0000002904BF807870470B48D0F800110029D6 +:102A10001CBFD0F80411002902D0D0F8080108B179 +:102A20001020704707480068C0B27047A40000201B +:102A300010F5004008F5004000F0004004F50140AA +:102A400008F5014000F400404B480021017041703E +:102A5000704770B5064614460D460120F0F771FA2E +:102A600046480660001D0460001D056070BD70B51D +:102A7000414B012540EA02421D70414B42F08072F9 +:102A80001A60404A404C00261160C4F804613F4A75 +:102A90004FF040711160002802BFC4F80052256059 +:102AA00070BD012818BFFFDFC4F8006225604FF039 +:102AB00000703749086070BD2F48017879B1334AFA +:102AC0004FF0407111603049D1F804210021002AF3 +:102AD00008BF417002D02F4A126842700170002076 +:102AE000F0F72FBA24480178002904BF40787047D6 +:102AF0002548D0F80401002808BF70472548006821 +:102B0000C0B27047002808BF704730B51A48007837 +:102B1000002808BFFFDF1C48D0F80411002918BFA7 +:102B200030BD0224C0F80443DFF86CC0DCF80010AC +:102B3000C1F30015DCF8001041F01001CCF80010D2 +:102B4000D0F80411002904BF4FF400414FF0E022F7 +:102B500007D100BFC2F8801220BFD0F80431002B8B +:102B6000F8D02DB9DCF8001021F01001CCF80010DD +:102B7000C0F8084330BD0000A700002008F5004061 +:102B800004F5004018F5004000F0004008F5014051 +:102B900004F5014000F4004010ED00E070B5FF4C7A +:102BA000002501206570257025626572A572E072AE +:102BB00084F82950256304F13C00A5630CF048FB20 +:102BC000002818BFFFDF84F82450F5480DF0C6FA3E +:102BD000F4494FF011300860091D0860091D0860B4 +:102BE000091D0860091D0D60091D0860091D0860A8 +:102BF000091D0860091D0860091D0860091D08609D +:102C0000091D0860091D0860091D0860657770BD11 +:102C100030B4E2490268DFF894C34A6142688A61CD +:102C2000007A08770A7DE04BACF1040401204AB138 +:102C30000A7E00FA02F21A608D7D002D0CBF226020 +:102C4000CCF800204A7D002A04BF30BC70474A7E81 +:102C500090401860C97D00290CBF2060CCF80000AE +:102C600030BC7047D349D2480860091DD24808607B +:102C7000704730B50546002908BF00240AD0012955 +:102C800008BF4FF0807405D0022916BF03294FF00A +:102C9000C744FFDF44F4847040F48010C5490860E5 +:102CA000E8B240F44030091D40F000700860C348AD +:102CB000D0F80001002818BFFFDF30BD002800B5A4 +:102CC000BF4908BF03200CD0012808BF042008D04A +:102CD000022808BF062004D0032816BFFFDF052006 +:102CE00000BD086000BD70B502244FF0E025012052 +:102CF0000022C5F88041B3490A600860B24A40F238 +:102D00005B611160121F40F203111160111F086016 +:102D1000AB4903200860AD49962008609F4E96F9A4 +:102D2000240000F03AFE707F002814BF4FF4C0204A +:102D3000A748A8490860A949A7480860091FA848EA +:102D40000860C5F880429D491020C1F8040370BD99 +:102D5000924A0368C2F802308088D08011727047AE +:102D60008E4890F8290070478C4A51701070704757 +:102D7000F0B50546800000F1804000F580508B885A +:102D8000C0F820360B78D1F8011043EA0121C0F8D1 +:102D9000001605F10800012707FA00F6914C002AF9 +:102DA00004BF2068B04304D0012A18BFFFDF2068A9 +:102DB00030432060206807FA05F108432060F0BD29 +:102DC00010B5044600F0E9FD744880F8244010BDB9 +:102DD000724890F834007047704890F83600704799 +:102DE000814AC1781160006880490002086070471C +:102DF000252808BF02210ED0262808BF1A210AD094 +:102E0000272808BF502106D00A2894BF0422062292 +:102E100002EB4001C9B2764A1160764908607047FA +:102E20005E49086270475D498A7A012A49D0022AC0 +:102E300018BF70474B7D002B08BF7047DFF8B8C143 +:102E4000012A42D0CA7D4B7E002A18BF01227D3064 +:102E5000CCF80000DFF8A4C10020CCF84C01180227 +:102E600082F0010240EA025040F00312087F830022 +:102E700003F1804303F5C043C3F81025604A02EB19 +:102E80008002887EC30003F1804303F5F833C3F862 +:102E90001425DFF870C1C3F810C5C97ECB0003F15B +:102EA000804303F5F833C3F814254D4AC3F81025C1 +:102EB000012202FA00F002FA01F1084352490860C7 +:102EC00070470B7D002BB9D170478A7D0B7E002A9D +:102ED00018BF01227E30BBE72DE9F84F00280CBF58 +:102EE000012202222D4D354C0320AA72C4F80002A3 +:102EF000687F002814BF4FF4C0203548424F386027 +:102F00004FF00108002933D0012945D002291CBF08 +:102F1000FFDFBDE8F88F286A002808BFFFDF296AB5 +:102F2000286B0844394908603A4939480860A97A49 +:102F3000394801290EBF046038490160A86B40F48C +:102F40000020A863D4F800924FF0100AC4F808A338 +:102F50000026C4F800621F484FF4802BC0F800B070 +:102F6000FF208DF80000C4F81061C4F8108080E0E4 +:102F7000012A58D0C4F80480022A18BFBDE8F88F8F +:102F8000687D002808BFBDE8F88F1C48C0F84C8059 +:102F9000194800680A3043E04CE000008C0A002029 +:102FA000A00A0020000E0040180500500C0500503B +:102FB0000601020014150040250003020010004025 +:102FC00010150040FC1F004038150040441500401B +:102FD0000000040408F5014040800040A4F50140D1 +:102FE0001011004040160040241500401C15004000 +:102FF00008150040541500404C85004000800040FA +:10300000006000404C81004004F5014048850040CC +:1030100048810040A8F50140ACF501400410004093 +:10302000BDE8F84FFFE6C4F80080287D0028ACD149 +:10303000BDE8F88FFC48012A806B07D0022A18BF30 +:10304000FFDF09D0BDE8F84F0A20ECE640F480101D +:10305000A8634FF4801004E040F40010A8634FF41C +:1030600000103860EEE700BF9DF80000401E8DF8AC +:1030700000009DF8000018B1D4F810010028F3D02A +:103080009DF80000002808BFFFDFC4F80061C4F805 +:103090000C61C4F81061C4F80461C4F81461C4F888 +:1030A0001861C4F82861E14800680090C4F80092F3 +:1030B000C7F800B0C4F804A34FF400203860296AB0 +:1030C000286BBDE8F84F08440A30ACE62DE9F84714 +:1030D000D74CD4F8000220F00309D4F804034FF0D1 +:1030E000100AC0F30018C4F808A30026C4F8006250 +:1030F000CD4D687F002814BF4FF4C020CD48CE4985 +:103100000860A87A0127012802D0022803D014E021 +:10311000287D10B911E0687D78B1A87EEA7E07FAB3 +:1031200000F007FA02F210430860287F800000F1E7 +:10313000804000F5C040C0F81065FF208DF8000009 +:10314000C4F81061276104E09DF80000401E8DF86E +:1031500000009DF8000018B1D4F810010028F3D049 +:103160009DF80000002808BFFFDFC4F81061C4F814 +:1031700028616E72AE72EF72C4F80092B8F1000F5F +:1031800018BFC4F804A3BDE8F8870068AB4920F075 +:103190007F40086070474FF0E0200221C0F88011A6 +:1031A000C0F8801270474FF0E0210220C1F8000102 +:1031B0007047A3490870704710B5A2480CF050F84A +:1031C000002818BFFFDF10BD9E480CF05FB89E4975 +:1031D0000860704730B5944C0546206BA84228BF64 +:1031E000FFDF012020732561607F40B1A81C2061B2 +:1031F0008F48D0F8001241F04001C0F80012934906 +:103200000020C1F84401924920690860A06B9149EF +:1032100040F48000A0634FF48000086030BD0028B7 +:1032200004BF28207047012804BF182070470228D7 +:1032300012BF03284FF4A870704700B5FFDF2820A5 +:1032400000BD002804BF41F2D4707047012804BFBC +:1032500041F204007047022812BF032842F6A00082 +:10326000704700B5FFDF41F2D47000BD002804BFF5 +:1032700042F2B8407047012804BF41F288307047DD +:10328000022804BF44F690407047032804BF47F269 +:10329000A030704700B5FFDF42F2B84000BDF0B586 +:1032A0000646614C02200D462073032914BF022DEF +:1032B0004EF634170BD0002D08BF42F2B84706D0A7 +:1032C000012D1ABFFFDF42F2B84741F28837002EC6 +:1032D00008BF41F2D4700CD0012E08BF41F20400A7 +:1032E00007D0022E17BF032E42F6A000FFDF41F2E7 +:1032F000D470381A002D584908444FF47A71B0FB45 +:10330000F1F708BF28200AD0012D08BF182006D0E9 +:10331000022D17BF032D4FF4A870FFDF282038447B +:10332000032E16BF022E062101210844401D2061F4 +:10333000617F41B1801C20613D48D0F8001241F00E +:103340004001C0F8001241490020C1F84401216940 +:10335000206B08443E490860F0BD3349012048779E +:103360003E49022008603F493D480860091F3E4829 +:10337000086070472C490020487770472E494FF469 +:10338000800008602848816B21F48001816300215E +:103390000173704770B584B014460D460646042983 +:1033A00094BF042CFFDF314B0FCB8DE80F00684634 +:1033B00000EB85002E490057301A086004B070BD3C +:1033C00070B584B014460D460646042A94BF042DF9 +:1033D000FFDF284B0FCB8DE80F00684600EB850020 +:1033E00023490057301A086004B070BD1748012106 +:1033F0004160C1600021C0F84411154801600A48CD +:1034000001637047084800B5407F002818BFFFDF00 +:103410004020124908600648D0F8001241F04001EF +:10342000C0F8001200BD00008C0A002018110040F6 +:10343000001000400000040408F501403C15004065 +:10344000A9000020C80A00200415004000800040A8 +:103450004485004004F50140FF570200601500401C +:10346000448000409CF50140281100405C050200AA +:10347000441500406C050200FE4800B5407F00285E +:1034800018BFFFDFFC48D0F8001221F04001C0F85F +:103490000012FA490020086000BDF748D0F8001279 +:1034A00021F01001C0F80012012181617047F2483B +:1034B0000021C0F81C11D0F8001241F01001C0F832 +:1034C00000127047EC4981B0D1F81C21012A1EBFBF +:1034D000002001B07047EA4A126802F07F025242AF +:1034E00002700020C1F81C01E6480068009001202D +:1034F00001B0704730B50C00054608BFFFDF14F07F +:10350000010F1CBF012CFFDF002D0CBF012002208A +:10351000D84901284872CC72D74904BFD1F80002BB +:1035200040F0040007D0022807BFD1F8000240F0A5 +:103530000800FFDF30BDC1F8000230BD70B5CD4CD2 +:103540000022E17A11F0020F18BF10F0040F16D11B +:1035500011F0100F1CBF94F83530002B02D094F8F6 +:10356000373063B111F0080F1CBF94F82830002BDE +:1035700005D111F0040F03D094F8291001B90122EC +:10358000657ABD4900234FF0010C35B100F002000F +:10359000104314D0BDE8704098E5607F002814BF48 +:1035A0004FF4C020B848B94A1060D1F8000220F0AA +:1035B0000300C1F80002A37284F80BC070BD012D96 +:1035C00014D0022D18BFFFDF1CD0A07A01280CBF39 +:1035D000AF48B0484FF47A7100F2E730B0FBF1F039 +:1035E000216BBDE87040081A8C301CE4D1F8000251 +:1035F00020F00400C1F80002637284F80BC084F864 +:103600000AC0E2E7D1F8000220F00800C1F8000289 +:10361000637284F80BC00220A072D6E72DE9F84F40 +:103620009D4FD7F84C21934C98494FF00108A07A50 +:103630000026CAB1012802D0022803D014E0227D5E +:1036400012B911E0627D7AB1A27EE37E08FA02F23D +:1036500008FA03F31A430A60227F920002F18042C3 +:1036600002F5C042C2F81065A26B0A60A663217B16 +:1036700029B1D7F84411012908BF012200D0002246 +:103680007D4DD5F8101101290CBF402100210128E2 +:1036900005BFD5F80C31012B002320231943012845 +:1036A00005BFD5F80431012B0023102319437B4BB0 +:1036B000022804BFD3F800C0BCF1010F07D1D5F830 +:1036C0000CC1BCF1010F08BF4FF0080C01D04FF046 +:1036D000000C4CEA0101022804BF1B68002B05D135 +:1036E000D5F80C31012B08BF042300D00023194367 +:1036F000022803D1002A18BF022200D10022114360 +:10370000022804BFD5F80401012805D1D7F84401E7 +:10371000012818BF012000D1002040EA01096048BB +:10372000016811F0FF0F03D0D5F81411012900D062 +:10373000002184F83410006810F0FF0F03D0D5F892 +:103740001801012800D0002084F835005548006891 +:1037500084F836004948006818B1FFF70CF90128D1 +:1037600000D0002084F83700C5F80061C5F80C616E +:10377000C5F81061C5F80461C5F81461C5F8186191 +:10378000C5F82861484800680090C7F84461474878 +:1037900000684D46DFF818910090D9F80000E0620B +:1037A000617F00291CBF801EE062424800682063E0 +:1037B000A07ADFF804A102280CD1607850B1DAF8C1 +:1037C000001009780840217831EA000008BF84F829 +:1037D000288001D084F82860DFF8E08015F0010F20 +:1037E00016D098F80010364A4908E06A52F82110BD +:1037F00088470121334A98F80030206B52F8232083 +:10380000904700BF98F8000010F0010F0BD01FE0A8 +:1038100015F0200F18BF0221ECD115F0020F18BFD0 +:103820000021E7D1EEE7DAF80000062200F10901F5 +:10383000A01C0CF0C0FA40B9207ADAF80010097820 +:10384000B0EBD11F08BF012000D0002084F8290070 +:103850002846FFF773FE15F0020F05D01A4898F8B6 +:10386000001050F82100804715F00C0F37D0174892 +:103870002EE000008C0A002000100040601500407F +:10388000481500401C1100400000040408F50140E8 +:10389000F0FE0100B0F8010000800040001400407C +:1038A00040160040081400401811004044810040B8 +:1038B000448500404085004004150040A9000020D8 +:1038C000140502004C0502001C0502002C05020034 +:1038D00098F8001050F82110C5F3C000884715F083 +:1038E000200F05D04E4898F8001050F8210080476E +:1038F00098F80000022805D105F06E00402806D196 +:1039000001F0E5FA98F80000042828BFFFDFA07A4C +:10391000022818BFBDE8F88F207B002808BFBDE84B +:10392000F88FC7F84461022814D0012818BFFFDFC0 +:10393000216B2069884298BFFFDF2069C9F8000029 +:10394000A06B384940F48000A0634FF48000086009 +:10395000BDE8F88F2169206B0844EFE7002812BF0B +:10396000012864207047022812BF03284FF4C87052 +:10397000704700B5FFDF642000BD2B49032818BF46 +:103980000228086803BF20F0B30040F04C0040F06C +:10399000004020F000400860704700B5234902282D +:1039A00039D022DC10F10C0F08BFF42033D010DC2A +:1039B00010F1280F02BFD820086000BD10F1140FCD +:1039C00008BFEC2027D010F1100F08BFF02022D044 +:1039D00023E010F1080F08BFF8201CD010F1040FED +:1039E0000CBFFC20002816D017E0C01E072814D2F8 +:1039F000DFE800F0100E0C0A0806040009200AE0B7 +:103A0000082008E0072006E0062004E0052002E088 +:103A1000042000E00320086000BDFFDF00BD0000BF +:103A20003C05020004F501403C1700400C15004025 +:103A300010B53F480AF0CFFB00213D480AF0FAFBE1 +:103A400001213B480AF0CAFB3A49002081F82200D4 +:103A50004FF6FF70888438490880488010BD704751 +:103A600034498A8C824218BF7047002081F82200B6 +:103A70004FF6FF70888470472D49016070472E49CA +:103A8000088070472B498A8CA2F57F43FF3B03D007 +:103A9000002101600846704791F822202549012A3B +:103AA0001ABF0160012000207047224901F1220065 +:103AB00091F82220012A04BF0020704701220270E1 +:103AC0001D4800888884104670471B49488070470D +:103AD0001849194B8A8C5B889A4206D191F82220AA +:103AE000002A1EBF01600120704700207047114866 +:103AF000114A818C5288914209D14FF6FF7181841D +:103B000010F8221F19B10021017001207047002018 +:103B100070470848084A818C5288914205D190F834 +:103B2000220000281CBF00207047012070470000C1 +:103B3000F20A0020CC0A0020AA0000207047514A57 +:103B4000012340B1012818BF7047137008689060C6 +:103B500088889081704753700868C2F8020088888E +:103B6000D0807047474A10B1012807D00EE0507846 +:103B700060B1D2F802000860D08804E0107828B163 +:103B80009068086090898880012070470020704705 +:103B90003C4910B1012803D006E0487810B903E091 +:103BA000087808B1012070470020704730B58DB00B +:103BB0000C4605460D2104A80CF0C2F9E0788DF8FA +:103BC0001F0020798DF81E0060798DF81D0028688F +:103BD000009068680190A8680290E86803906846C1 +:103BE0000BF0A8F920789DF82F1088420CD160784E +:103BF0009DF82E10884207D1A0789DF82D1088429C +:103C000002BF01200DB030BD00200DB030BD30B579 +:103C10000C4605468DB00321E01CFEF73EFA6079A4 +:103C20000D2120F0C00040F04000607104A80CF0AD +:103C300087F9E0788DF81F0020798DF81E006079F3 +:103C40008DF81D002868009068680190A8680290AF +:103C5000E868039068460BF06DF99DF82F0020701E +:103C60009DF82E0060709DF82D00A0700DB030BD45 +:103C700010B504460621FEF710FA607920F0C00066 +:103C8000607110BDAE00002070B5FF4C054694F881 +:103C90008C00002601281BD094F86A0001281CBF64 +:103CA000002070BD6E7012202870202204F16C017B +:103CB000A81C0CF0ACF80120A87184F86A60F348E5 +:103CC00040680088FBF7A0F8FAF760FD012070BD9E +:103CD0006E7018202870D4F88D00C5F80200D4F852 +:103CE0009100C5F8060084F88C60EFE7E64890F88C +:103CF0006A10002914BFB0F86E004FF6FF707047CD +:103D000070B5E24800240470017800291CBFFFDF71 +:103D100070BDDD4D85F8624085F8634085F86440EC +:103D200085F8654085F8664085F85E4085F8604016 +:103D300085F8564085F8364085F868407F218170C7 +:103D400095F8670028B1FFF797FBFEF7F4FD85F8BB +:103D5000674085F86A4085F88C40CD480AF0DEF867 +:103D6000BDE87040CB480AF0D9B8C74890F8620067 +:103D70007047C54900B591F8580091F85710C0F345 +:103D80008002C0F340031A4400F0010010440529EA +:103D900010D2DFE801F00B070B030900BE4931F830 +:103DA000100000BDBD4800BDBD4900E0BD4931F86F +:103DB000100000BDFFDF002000BDB34840F27121BC +:103DC000B0F85A0048437047AF4890F8690000289F +:103DD00018BF0120704710B5040016BF022C002048 +:103DE0000120FFF7D5FE002808BF10BDA6480472C9 +:103DF000012010BDA44981F86000704710B5A24CA5 +:103E0000207A002816BF022800200120607204F1E9 +:103E10000A01FFF7A7FE207A022816BF0328012116 +:103E2000002184F85F10082084F85D00607A04F1B6 +:103E30000A02012804BF527912F0C00F0AD004F11F +:103E40000A02012804D1507900F0C000402801D0B6 +:103E5000002000E0012084F85E0029B994F85700A2 +:103E6000012818BF042806D1207C04F1110108F0B4 +:103E700043FF84F85D004AF2B8102060FCF706FDAD +:103E8000606004F10A0182480AF06EF8617A8048A5 +:103E90000AF086F804F10A017E480AF065F8617AB2 +:103EA000BDE810407B480AF07BB870B5764C417B8A +:103EB00084F85810017984F8571001290CBF0022AA +:103EC0000288A4F85A20827B84F869208279002A2B +:103ED00016BF022A002201222274D0F80720C4F85B +:103EE0001120B0F80B00A4F8150094F85600012535 +:103EF000002818BF84F8635094F83600002818BFD3 +:103F000084F8645005292DD2DFE801F00308222748 +:103F1000080000215E480AF004F824E001215C4812 +:103F200009F0FFFF04F1110159480AF02BF8207C39 +:103F300020B1012818BFFFDF05D014E0002154484C +:103F40000AF03BF80FE0012151480AF036F80AE088 +:103F500006214F4809F0E5FF05E002214C4809F031 +:103F6000E0FF00E0FFDF04214A4809F0DAFF84F8AF +:103F70006250002070BD70B5434C0546002084F8A7 +:103F800064002A4604F117000BF041FF84F8365014 +:103F9000012084F8640070BD10B53B4C002284F809 +:103FA000632084F85600024604F137000BF02FFF1F +:103FB000012084F8630010BD334981F86800704720 +:103FC000F0B5324E83B0307828BB2F4C94F86200A5 +:103FD00008B3FFF7F1F8002584F8615075702846A2 +:103FE000FFF7E7F8FEF77FFEFEF73CFE2E48FEF7F0 +:103FF000F7FE2E48FFF7C9F800210846FFF74FF9F2 +:1040000094F85800002610F0010F07D02520FEF785 +:10401000EFFE012611E003B00C20F0BD10F0020FFE +:1040200004D02620FEF7E4FE022606E010F0040F7E +:1040300003D02720FEF7DCFE0426FEF713FE84F8EB +:104040005C60FFF7B0F801210020FEF745FF0F216B +:104050000520FEF789FE94F85E00002804BF94F85E +:104060005F00002805D194F85700012818BF0428E4 +:104070007ED1FCF70BFC064631466068FDF72FFD4C +:104080000B49B0FBF1F715E0140B0020BC00002039 +:10409000AC0B0020D40B00208C050200918913008A +:1040A00094050200840502007F0502007C050200E1 +:1040B00040420F0001FB170041423046FCF7FFFB76 +:1040C000606020683844206008F013FE2168884250 +:1040D0006CD8C4E9005694F85D0008F029FE064645 +:1040E00094F85F000127002818BF002E04D010218B +:1040F000304609F044FC68B194F8600000281CBF09 +:1041000094F85E0000281AD0607A04F10A010128B0 +:104110000DD011E0677204F10A013046FFF777FD18 +:1041200094F85D1004F10A0008F0E1FE07E0487918 +:1041300000F0C00040281CD00846FFF799FD04F1AC +:104140000A01FE4809F010FF617AFC4809F028FFD7 +:1041500004F10A01FA4809F007FF617AF84809F00A +:104160001FFF94F85700012818BF04281ED107E04C +:104170001CE008F0F0FE04F10A01FFF748FDDEE75D +:1041800094F85D0008F0DDFD06000FD0102109F065 +:10419000F6FB58B969463046FFF739FD6946E748EE +:1041A00009F0F0FE0121E54809F007FF617A04F10A +:1041B0000A00FEF7CDFD94F8570001281EBF042821 +:1041C00094F86300002808D094F8562004F13701D1 +:1041D000DA4809F010FF84F8635094F8640040B1A5 +:1041E00094F8362004F11701D54809F030FF84F81F +:1041F000645008F0F0FDD34808F06AFE84F86700C8 +:10420000FEF7E2FF03B00020F0BDCF4948607047E1 +:1042100070B5CE4C05002BD094F8580094F85C1083 +:10422000002620EA010212F0010F04D02520FEF73B +:10423000DFFD012615E010F0020F02D011F0020F91 +:1042400006D010F0040F0CD011F0040F05D008E0D8 +:104250002620FEF7CDFD022603E02720FEF7C8FD4D +:104260000426FEF7FFFC94F85C00304384F85C0001 +:1042700094F8610040B194F85700012808BFFFDFAF +:10428000BDE8704000F06FBA1DB102210020FEF7BA +:1042900023FE94F86500A948FEF799FF94F85700AB +:1042A000052809D2DFE800F0030303090300012118 +:1042B0000846FFF71FF900E0FFDF94F8580094F874 +:1042C0005C1030EA01014FF0010002D09E490870F5 +:1042D00070BD94F85710012912BF84F861000021C5 +:1042E00084F85C10F2E710B5FEF766FF9648007898 +:1042F00040B9964890F8620020B10020FFF788FF8F +:10430000002010BDFFF772F8FFF738F8FEF7DEFE69 +:10431000FEF741FFFEF758FF0C2010BD8A4901202F +:1043200048707047894981F86600704770B500256C +:1043300003F046FB68B14FF49670FEF771FD824EB4 +:104340003078012809D0022801D003282ED0FFDFC1 +:1043500070BDBDE8704000F006BA7C4C94F8570080 +:10436000032823D094F8670018B1FEF7D0FAFFF7BE +:1043700049F87448FEF72BFF94F85700012818BF3E +:1043800004280AD094F86900012814BF03281025D6 +:1043900045F00E010020FFF7ADF894F86800012801 +:1043A00008BFFFF784F80220307070BDBDE8704090 +:1043B00001202DE770B5654C634D94F86800012825 +:1043C00020D000BF94F8670018B1FFF755F8FEF74A +:1043D000B2FA03F0F5FAF8B12878022818BFFFDF27 +:1043E00094F85700012804BF4FF41970FEF718FD28 +:1043F0000120FFF70DFF287800281EBF287801282C +:10440000FFDF70BD5248FFF75DF8002804BF7F2032 +:10441000A870FFF742F8D5E7BDE8704000F0A3B9F7 +:104420002DE9F05F07464FF00009FEF7D1FC464E3C +:1044300082463078022818BFFFDF444D7F2495F86C +:10444000680001282CD03F4809F08AFD83464FF0D0 +:10445000FF08002F71D03B4809F089FE00286CD07E +:10446000FEF77EFC002868D095F86700354F68B1EC +:1044700008F096FC8046FF2808D00146F81C08F09A +:1044800080FC404608F097FC40EA0A0A58464FF084 +:10449000010B062851D2DFE800F09494940C946349 +:1044A0002B48FFF70FF8002808BFB470FEF7F5FFA0 +:1044B000C9E795F85700012818BF04283DD0BAF184 +:1044C000000F05D195F86900002818BF022878D19F +:1044D00095F86800012804BF95F88C00002805D0E5 +:1044E0001748FEF774FE032030706CE085F88CB03E +:1044F000B8F1FF0F0FD005F18E02511E404608F0B3 +:1045000029FC002808BFFFDF95F88D0040F002006D +:1045100085F88D000CE03878C0F3801085F88D00A8 +:10452000D5F8EB00C5F88E00B5F8EF00A5F89200BD +:10453000B07805F194077F280CE042E0AC0B002036 +:10454000D40B0020FC0B0020BC000020140B00202A +:10455000BE00002008BFFFDFB0783870B470BFE73E +:104560003878297CC0F38010884209D1062205F1F1 +:104570001101F81C0BF01FFC002808BF012000D01F +:10458000002095F85D102C46414504D1B8F1FF0F8D +:1045900018BF012100D10021014394F857000128E0 +:1045A00018BF042800D149B958B9BAF1000F05D194 +:1045B00094F86900002818BF012802D194F8660019 +:1045C000D8B14FF0010995F8670018B1FEF754FF14 +:1045D000FEF7B1F9B9F1000F1CBF0120FFF718FE7B +:1045E000307800281ABF30780128BDE8F09F307875 +:1045F000032818BFFFDFBDE8F09F7068D4F8F710FC +:10460000C0F80D10B4F8FB10A0F8111094F8FD10CC +:10461000C174B97D0175B7F81710C182B7F81910C8 +:104620004180B7F81B108180B7F81D10C180724916 +:1046300008300BF098FD97F8240000F01F01706817 +:10464000017697F82410490980F8041194F86A005B +:10465000002818BFFFDF4FF0000A204684F86CA046 +:1046600074682188A0F86E106188A0F88410A18871 +:10467000A0F88610E188A0F8881094F8041180F85A +:104680008A1090F85F1049B1427A00F10A01012ABC +:1046900004D1497901F0C001402934D090F860106C +:1046A00041B1417A00F10A02012904BF517911F0A8 +:1046B000C00F28D0C0F878A0A0F87CA039780546B3 +:1046C000C1F380116176D0F8EB00C4F81A00B5F898 +:1046D000EF10E183B8F1FF0F1CD0C5F87E00E08B2E +:1046E000A5F8820005F172022F46511E404608F0DF +:1046F00031FB002808BFFFDF97F8710040F002008F +:1047000087F8710013E0D0F80A108167C189A0F81A +:104710007C10D3E739480BF01DFD617E85F87110E0 +:10472000D4F81A10C5F87210E18BA5F8761085F848 +:104730006AB070680088FAF767FBFAF717F886F82E +:1047400000A0FEF753FEFEF719FEFEF7BFFCFEF7D2 +:1047500022FDFEF739FD012003F005FA33E70023BF +:104760001A4603F06BBA70B5FEF740FEFEF706FE80 +:10477000FEF7ACFCFEF70FFD214C002694F8670015 +:1047800028B1FEF779FEFEF7D6F884F867601D4D74 +:104790002E70FEF719FD94F85700012804D0BDE8EB +:1047A0007040002003F0DFB9022003F0DCF994F838 +:1047B0006A00002818BFFFDF6878002808BF70BDB6 +:1047C000207C84F87100D4F81100C4F87200B4F8A9 +:1047D0001500A4F876003C2084F86C006868018815 +:1047E000A4F86E10012184F86A100088FAF70CFB17 +:1047F000F9F7BCFF6E7070BD1B0C0020920B0020FF +:10480000140B0020BC0000202DE9F041FF4F0446AE +:1048100000207978FE4D4FF00108064611B10129BC +:1048200025D007E095F84D10002918BF87F80180C2 +:1048300000D0012079782B2211FB02F1294491F854 +:10484000222010431AD02A22A01C23310BF0DFFAB9 +:1048500066700420207084F8028078782B2110FB89 +:1048600001F0284480F822600120BDE8F08195F82D +:104870002210002918BF7E70DBD1DBE795F87800A5 +:10488000D0B1D5F87900C4F80200D5F87D00C4F89D +:104890000600D5F88100C4F80A00D5F88500C4F8F0 +:1048A0000E0095F88900A07466701120207084F8BD +:1048B000028085F8786018E0287801281CBF002065 +:1048C000BDE8F0816670122020702022A91CA01C77 +:1048D0000BF09DFAA6712E7085F8A860D5F89800A7 +:1048E0000088FAF791FAF9F751FF0120BDE8F0814D +:1048F000C7480178002914BF80884FF6FF707047C1 +:104900002DE9F041C24C064694F82200002818BF59 +:10491000BDE8F081304609F023FB01460125002067 +:10492000072937D2DFE801F00A04073636360900D6 +:1049300084F8245009E0032000E0022084F82400D9 +:1049400004F12D01304609F06CFB84F82C0094F83A +:10495000AD0018B1FEF70FF801281FD0304609F05E +:1049600028FB84F8250004F12601304609F003FBFA +:10497000A64E04F14C0730787F2808BFFFDF30785F +:1049800038707F20307084F82250BDE8F041032059 +:1049900001F092BF84F82C00BDE8F081FEF72EF8FC +:1049A00004F12602511E08F0D5F9002808BFFFDFE8 +:1049B00094F8251041F0020184F82510D8E710B5CD +:1049C000002001F0EEFE924CA0B1FEF7ECFB0021BE +:1049D0000120FEF781FA04F1BC00FEF7F8FBD4F8E1 +:1049E000B400FEF7F7FB94F89C00032818BF0228D8 +:1049F0001FD022E0FEF7FAFCFEF7C0FCFEF766FBD4 +:104A0000FEF7C9FB94F8AD0030B1FEF735FDFDF7B8 +:104A100092FF002084F8AD00012084F8B800022045 +:104A200084F8B000FEF7D0FBBDE81040002001F094 +:104A300043BF01210020FEF75DFDFEF738FD94F82D +:104A4000AD0018B1FDF763FFFEF7DCFC032084F82E +:104A5000B00010BD6E490028B1F8BA202DD0FF2A51 +:104A60000CD24FF6FF7000EA4200A1F8BA00FF280E +:104A700088BFFF2002D900BFA1F8BA00634842688E +:104A8000012A12BF002A0D224260D243C2EBC203A8 +:104A900003EB021291F8B930DB4303EB830CCCEB50 +:104AA00083131A444260900CB1F8BA20B0FBF2F3C1 +:104AB00002FB130081F8B9007047012ADED95008C3 +:104AC000A1F8BA0008BF0120D8D1D5E770B5504C85 +:104AD000002584F8B050012684F8B06094F8B00046 +:104AE00002281BBF94F8B00001280020FFDF18BF88 +:104AF00070BD2B2101FB004181F82250401CC0B247 +:104B00000228F6D3257094F8AD0028B1FEF7B4FC66 +:104B1000FDF711FF84F8AD5084F8A85084F8A9502F +:104B200084F8AC5084F89760394884F89C5084F835 +:104B3000AF5040F2011120F8941F817070BD2DE933 +:104B4000F041334C05460C2794F8B00001281FBFF4 +:104B500094F8B00002280C20BDE8F081FEF72CFB91 +:104B6000FEF7C1F8FEF77EF894F8940001260028BD +:104B700001BF94F89500002894F8960000281CBF07 +:104B800094F8A900002877D094F89C00032802D05C +:104B9000022805D008E005211E4800F083FE03E04E +:104BA00003211C4800F07EFE94F8AA00002804BFF0 +:104BB00094F8AB00002845D0FBF768FE074639465D +:104BC000D4F8A400FCF78BFF1349B0FBF1F801FB0C +:104BD000180041423846FBF772FEC4F8A400D4F82E +:104BE000A0004044C4F8A00008F083F8D4F8A01056 +:104BF000884227D80020C4E9280794F8AB00002891 +:104C000018BF08F080F994F8AC0007E0C400002059 +:104C1000240C0020080D002040420F0000281CBF7B +:104C200094F8AA0000280DD094F88D0004F18E01AC +:104C3000012804D1487900F0C00040280ED0084671 +:104C4000FFF716F894F88D1004F18E00FEF780F847 +:104C500094F8B0000027012817D107E008F07BF98D +:104C600004F18E01FEF7D3FFECE705E084F8B860AD +:104C7000022084F8B00008E094F8B000022802BFD7 +:104C800084F8B0600C20BDE8F08194F89700A0B1E2 +:104C900094F89C00032818BF08F0BEF8FE4808F0FE +:104CA00017F984F8AD00FD48C4F8B450FEF76DFA6A +:104CB000FEF78AFA3846BDE8F08108F08CF8EDE797 +:104CC00070B5FEF779FAF64C94F8B000022803D0DC +:104CD000FEF77AFA0C2070BD012084F8B900A4F820 +:104CE000BA000220FEF765FAEE48FEF779F8EE4BBF +:104CF000002004F1940200BF94F8AF10491CA3FBFC +:104D0000015C4FEA5C0CACEB8C0C6144C9B284F8DA +:104D1000AF10895C012907D0401CC0B20328EBD337 +:104D2000FFF74DFE002070BD94F8AF00DF49085C2E +:104D3000FEF75EF8FDF796FFF2E710B5040016BF28 +:104D4000022C00200120FEF723FF002808BF10BD21 +:104D5000D348002180F88C4080F8A910012010BDB4 +:104D6000CF4981F8AC00704710B5CD4C94F88C0059 +:104D7000002816BF02280020012084F88D0004F1CD +:104D80008E01FEF7EFFE012084F8A90094F88C0054 +:104D9000022816BF03280121002184F8AB1094F8E3 +:104DA0008D0004F18E02012804BF527912F0C00F69 +:104DB0000AD004F18E02012804D1507900F0C0001D +:104DC000402801D0002000E0012084F8AA0000283B +:104DD00004BF002910BDFBF759FDC4F8A4004AF236 +:104DE000B810C4F8A00010BD002816BF0228012288 +:104DF0000022AB4981F8972081F89D00704770B57B +:104E0000A74D0C4600280CBF0121002185F8971002 +:104E100085F89E004FF0080085F89F000BD1002C0C +:104E20001ABF022C01200020114607F065FF85F80B +:104E30009F00082801D0002070BD022C14BF032C55 +:104E40001220F8D170BD964A032808BFC2F8981006 +:104E500082F89C0000207047914991F89C0003283B +:104E600004D0012818BF022807D004E091F89E0062 +:104E7000012808BF70470020704791F89D00012865 +:104E800014BF03280120F6D1704710B5FEF7AEFA23 +:104E9000FEF774FAFEF71AF9FEF77DF9804C94F8E4 +:104EA000AD0030B1FEF7E8FAFDF745FD002084F8CB +:104EB000AD00012084F8B800022084F8B000FEF7AD +:104EC00083F9002010BD764981F8B100704710B514 +:104ED000FEF78CFAFEF752FAFEF7F8F8FEF75BF9E8 +:104EE0006F4C94F8AD0030B1FEF7C6FAFDF723FD24 +:104EF000002084F8AD00012084F8B800022084F876 +:104F0000B000FEF761F9BDE81040002001F0D4BC0C +:104F10002DE9F84F624DFF2100247F27DFF89081B3 +:104F200085F8AE10002800F0CD8205F1BC0009F034 +:104F3000EEF830B905F1BC0009F009F9002800F0DD +:104F4000C18295F8B000544E052880F0B882DFE8A1 +:104F500000F0F3F3F303F2004F4809F001F888F88A +:104F6000020095F8970028B9FDF732FF002808BF26 +:104F7000002400D0012495F8AD0070B107F010FFB7 +:104F800085F8AE00FF280CD00146F01C07F0F9FEB2 +:104F900095F8AE0007F00FFF044395F8AE00FF2828 +:104FA0000AD195F8970090B195F89C00032803D09A +:104FB00007F083FF85F8AE0098F80200072880F01C +:104FC000C181DFE800F03FBA07FCFCFC240007F0D9 +:104FD00042FFEFE795F8AD0018B1FEF74DFAFDF787 +:104FE000AAFC3348FEF76EFA002808BF88F8007064 +:104FF000FEF753FA002C00F04F8195F89C00012831 +:1050000018BF022840F04881FEF760F877E095F875 +:10501000AD0018B1FEF730FAFDF78DFC2448FEF71D +:1050200051FA002808BF88F80070FEF736FA002C05 +:1050300000F0328195F89C00022859D001285ED0FA +:1050400000F02AB995F8AD0018B1FEF715FAFDF792 +:1050500072FC1748FEF736FA002808BF88F800707F +:10506000FEF71BFA002C00F0178195F89C0002282F +:105070003ED0012843D003281CBFFFDFBDE8F88FD6 +:10508000F178D5F89800827E91422AD13179C27E9A +:10509000914226D171790DE0E00C00209C050200C0 +:1050A000240C0020A2050200ABAAAAAA9F050200B8 +:1050B000C4000020027F914213D1B179427F914216 +:1050C0000FD1F179827F91420BD1317AC27F914227 +:1050D00007D13178427EC1F38011914208BF01218E +:1050E00000D0002195F89E20012A0ED0E1B1CFE03A +:1050F000FA48FFF705FCBDE8F84F00F002BBF7489F +:10510000FFF7FEFBBDE8F84F59E4002972D100BF5C +:1051100000F11A01F14808F02EFFF04808F049FFAD +:10512000D5F898104876B3E095F8AE0095F89F1042 +:1051300088427CD1ACE014E1C1E195F8AD0018B132 +:10514000FEF79AF9FDF7F7FBE548FEF7BBF90028F3 +:1051500008BF88F80070FEF7A0F995F8AB000028AA +:105160000CBF4FF0010B4FF0000B4FF000093078EF +:1051700006F10901C00907D0487900F0C0004028B5 +:1051800008BF4FF0010A01D04FF0000A95F89C00CB +:10519000032806D195F89700002818BF95F89F00BE +:1051A00001D195F8AE0007F0C3FD009088B1102141 +:1051B00008F0E5FB002818BF4FF0010B00E0C1E04C +:1051C000BAF1000F05D006F109010098FEF7EEFCD8 +:1051D000814695F89C0003280DD0FDF777FF3CB37E +:1051E000FDF7BEFD50EA09005CD0BC48FFF788FB24 +:1051F00000F039B94CE0D5F89800F178827E914200 +:105200001ED13179C27E91421AD17179027F9142C9 +:1052100016D1B179427F914212D1F179827F9142C8 +:105220000ED1317AC27F91420AD1317801E033E068 +:1052300038E0407EC1F38011814208BF012600D0D2 +:105240000026B9F1000F05D1BBF1000F04D0FDF726 +:1052500087FD08B1012200E0002295F89E00012898 +:1052600001D010B10AE03CB908E02EB995F8AE10B3 +:1052700095F89F30994201D1012100E000210A42B6 +:105280000AD0012804BF002ED5F898003FF440AFA3 +:10529000BDE8F84F00F098BAFDF718FFBDE8F84FE9 +:1052A000FFF78DBB95F89D00032818BF02287DD11C +:1052B000BAF1000F7AD0B9F1000F77D1874E95F887 +:1052C0007800002872D1012485F87A4095F8AD0065 +:1052D00018B1FDF750FB012823D0304608F069FED5 +:1052E00085F87B0005F17C01304608F044FE30462D +:1052F00008F06CFE85F8820005F18301304608F065 +:1053000048FE98F8000005F189067F2808BFFFDFF6 +:1053100098F80000307088F8007085F87840032015 +:105320009FE0FDF76BFB05F17C02511E07F012FDBB +:10533000002808BFFFDF95F87B0040F0020085F8E9 +:105340007B00D4E795F8AD0018B1FEF795F8FDF7AE +:10535000F2FA6348FEF7B6F8002871D188F80070B9 +:10536000D1E05E4808F0FCFD88F802005D48F17865 +:10537000427A91421ED13179827A91421AD1717961 +:10538000C27A914216D1B179027B914212D1F17960 +:10539000427B91420ED1317A827B91420AD131789F +:1053A0000078C1F38011B1EBD01F00E049E008BFE5 +:1053B000012600D00026FDF789FE98F80200042897 +:1053C00067D1E6B34648FEF77DF8002808BF88F8A5 +:1053D0000070FEF762F895F8B80000281CBF0020A6 +:1053E000FFF738FB4FF0010985F8B8903B4E95F870 +:1053F0004D0030BB042085F84F0095F8AD00A6F1B4 +:10540000910418B1FDF7B7FA012830D0304608F002 +:10541000D0FD354981F8500004F12601304608F0EE +:10542000AAFD00BF05F15801304608F026FE85F8B8 +:1054300057001F2884BF1F2085F8570002E028E08E +:1054400061E010E098F8000005F177047F2808BFBC +:10545000FFDF98F80000207088F8007085F84D9004 +:10546000042001F029FABDE8F84FFFF7A8BAFDF7CC +:10547000C5FA04F12602511E07F06CFC002808BF93 +:10548000FFDF194890F8500040F0020084F8250032 +:10549000C8E71348FEF716F8002808BF88F8007020 +:1054A000FDF7FBFF95F8B800002804BF0120FFF7C7 +:1054B000D1FA85F8B840BDE8F84FFFF780BAFFDFB2 +:1054C000BDE8F88F95F8B000052828BFBDE8F88F33 +:1054D000DFE800F00303030C2100F1E7E00C0020FB +:1054E000C4000020080D0020240C002095F8AD0019 +:1054F00018B1FDF7C1FFFDF71EFAFE48FDF7E2FF08 +:1055000000283FF42BAFFDF7C8FFFDF7DFFDBDE836 +:10551000F84FFFF754BAF748FDF7D4FF002808BF4B +:1055200088F80070FDF7B9FF95F8B800002804BFAF +:105530000120FFF78FFA85F8B840FDF7C7FDBDE8F9 +:10554000F84FFFF73CBA70B5EB4C94F8B000072861 +:1055500077D2DFE800F08C8C8C8C8C040D00E7484F +:10556000FDF735FEFDF7A3FF042084F8B00070BD01 +:10557000FDF73CFFFDF702FFFDF7A8FDFDF70BFE71 +:10558000012584F8B850022084F8B000FDF71CFE15 +:105590002078002818BFFFDF0026A670D4F89800F6 +:1055A0000188A180418861838188A183C088E083CC +:1055B00094F8B10084F8200094F8AB10D04849B1B9 +:1055C0000178C21CC1F3801121B1517901F0C001F1 +:1055D00040292ED094F8AC1041B110F8031BC1F350 +:1055E000801119B1407910F0C00F22D0C5480AF0DF +:1055F000B1FD00BF94F8AD0018B1FDF7BCF901286A +:1056000020D0D4F89800417EE171D0F81A10A16042 +:10561000C08BA081666126832570D4F8980000882D +:10562000F9F7F2FBF9F7A2F8BDE87040022001F0AB +:1056300043B9D4F8E700C4F80E00B4F8EB00608278 +:10564000D8E714E0FDF7DAF904F10802E11D07F0EC +:1056500081FB002808BFFFDFE07940F00200E07125 +:10566000D4F8BF006061B4F8C3002083D4E7FFDF43 +:1056700070BD70B5A04C94F8B0000025052828BF77 +:1056800070BDDFE800F03939391B03009948FDF798 +:1056900019FF10B997497F200870FDF7FEFE94F8B6 +:1056A000B800002804BF0120FFF7D4F984F8B850EF +:1056B000FDF70CFDBDE87040FFF781B9FDF796FEE0 +:1056C000FDF75CFEFDF702FDFDF765FD94F8AD000A +:1056D00028B1FDF7D1FEFDF72EF984F8AD50012079 +:1056E00084F8B800022084F8B000FDF76DFDBDE835 +:1056F0007040002001F0E0B870BD00231A4601F0B0 +:10570000BCB970B5012001F04CF87B4CC8B104F174 +:10571000E401A1F1280008F05CFC04F1E40694F82F +:105720008D10304608F03CFC04F18E01304608F044 +:105730001BFC94F8AB00C0B394F89C0003281FD066 +:1057400025E0FDF753FEFDF719FEFDF7BFFCFDF761 +:1057500022FD94F8AD0030B1FDF78EFEFDF7EBF8B9 +:10576000002084F8AD00012084F8B800022084F8FD +:10577000B000FDF729FDBDE87040002001F09CB8A5 +:1057800094F89700002818BF94F89F0001D194F86E +:10579000AE0007F0E2FB050007D00121304608F01B +:1057A000FFFB2946304608F0DFFB5548FDF70FFDAB +:1057B00001210846FDF79EFE00210846FDF76FFD1A +:1057C000052084F8B00070BD2DE9F041022000F002 +:1057D000E8FF494C0126E0B1012001F06DF804F129 +:1057E000E401A1F1280008F0F4FB04F1E40794F8C7 +:1057F0008D10384608F0D4FB04F18E01384608F0CD +:10580000B3FB94F8AB00B8B394F89C0003281ED007 +:1058100024E0FDF7EBFDFDF7B1FDFDF757FCFDF7CB +:10582000BAFC94F8AD0030B1FDF726FEFDF783F821 +:10583000002084F8AD0084F8B860022084F8B0003D +:10584000FDF7C2FCBDE8F041002001F035B894F846 +:105850009700002818BF94F89F0001D194F8AE007B +:1058600007F07BFB050007D00121384608F098FBC4 +:105870002946384608F078FBD4F89800C18A2048B9 +:1058800008F027FCD4F89800017D1D4808F025FC9D +:105890001B48FDF79CFC84F8A860062084F8B00043 +:1058A000BDE8F08170B50C46054608F037FB032CC7 +:1058B00052D0052C18BF70BD0521284608F031FBD9 +:1058C0000D4CD4F8980000F10D01284608F0EBFBD0 +:1058D000D4F8980000F11101284608F0E8FBD4F84C +:1058E0009800017D284608F0F8FBD4F89800C18A9A +:1058F000284609E0C4000020240C0020E00C002011 +:10590000080D0020320C002008F0E3FBD4F89800CA +:105910004188284608F0D1FBD4F8980081882846B1 +:1059200008F0CFFBD4F89800C188284608F0CDFBDA +:10593000D4F8980000F10801284608F0E5FBD4F8F7 +:105940009800017E284608F0CAFB94F8B11028465A +:10595000BDE8704008F0CDBB2846BDE8704003218B +:1059600008F0DFBA2DE9FF5F06460C46488840F292 +:10597000E24100FB01FBE08A002500FB01FA94F8FC +:105980005B001746082816BF07284FF001094FF0A3 +:105990000009039818B10121204603F0D1FC94F8C6 +:1059A000C800DFF8FC8358B1012800F0A980022864 +:1059B0007DD0032818BFFFDF00F0A28000F052B9AD +:1059C000002F08BFFFDFF74D6868002808BFFFDF22 +:1059D00094F84C00012808BF002007D0022808BF17 +:1059E000012003D003281CBFFFDF0020FDF729FCA6 +:1059F00000F2E7314FF47A70B1FBF0F1E94840680A +:105A00000D1894F84C00012808BF002007D0022888 +:105A100008BF012003D003281CBFFFDF0020FDF7D3 +:105A200010FC074694F84C00012806D0022808BF55 +:105A3000C34618D0032818BFFFDF94F84C00012894 +:105A400004D002281CBF0328FFDF02D0DFF858B3C0 +:105A500009E0022805D003280CBFDFF850B3FFDFB0 +:105A600001D0DFF84CB394F84C00012807D002288D +:105A700008BF4FF496600DD0032818BFFFDF94F8DD +:105A80004C00012804D002281CBF0328FFDF18D0D7 +:105A90004FF4C860584438444AF2531101444FF45B +:105AA0007A70B1FBF0F040F2E241081A00E00FE03A +:105AB00000EB0A01BB48006928440844051D012089 +:105AC0001BE002281CBF0328FFDF40F69800E1E737 +:105AD000DFF8D0B2791EDBF80400084308BFFFDF0F +:105AE000B448006800EB0A0537B1DBF8040000F2A7 +:105AF0000F30A84288BFFFDF032084F8C800B0E061 +:105B000094F85B005D4620281CBF94F85C002028B8 +:105B10007ED1B4F85000B4F8FE10401A401C00B218 +:105B2000002875DB94F8FC00002871D094F84C0034 +:105B3000012806D0022808BFC24618D0032818BF83 +:105B4000FFDF94F84C00012804D002281CBF032872 +:105B5000FFDF02D0DFF850A209E0022805D00328B9 +:105B60000CBFDFF848A2FFDF01D0DFF844A294F8B1 +:105B70004C00012807D0022808BF4FF496600DD0D2 +:105B8000032818BFFFDF94F84C00012804D0022836 +:105B90001CBF0328FFDF1AD04FF4C8600AEB000BCC +:105BA00094F8FC00012806D0022808BFC2461FD086 +:105BB000032818BFFFDF94F8FC00012804D0022856 +:105BC0001CBF0328FFDF09D0DFF8DCA110E00228AA +:105BD0001CBF0328FFDF40F69800DFE7022805D04E +:105BE00003280CBFDFF8C4A1FFDF01D0DFF8C0A19C +:105BF00094F8FC00012807D0022808BF4FF49660F3 +:105C00000FD0032818BFFFDF94F8FC00012800E044 +:105C100011E004D002281CBF0328FFDF10D04FF48E +:105C2000C8605044ABEB000000F2E7314FF47A70EB +:105C300091FBF0F00544A7B15A4F786838B10AE0FB +:105C400002281CBF0328FFDF40F69800E9E77888A8 +:105C5000002818BFFFDF786800F20F30A84288BF25 +:105C6000FFDF05B9FFDF2946D4F8CC00FAF727FE9D +:105C7000C4F8CC00B0600020307001273771204696 +:105C800003F047FCA9F10101084208BF777106D073 +:105C900094F8C80001280CBF02200320707194F80A +:105CA0004C00012804D0022818D0032818BFFFDFB9 +:105CB00094F84C00012804D002281CBF0328FFDF01 +:105CC00002D0DFF8E48009E0022805D003280CBFE9 +:105CD000DFF8D880FFDF01D0DFF8D48094F84C00E3 +:105CE000012807D0022808BF4FF496600DD0032882 +:105CF00018BFFFDF94F84C00012804D002281CBF15 +:105D00000328FFDF58D04FF4C860804494F84D005A +:105D1000012808BF002007D0022808BF012003D0B7 +:105D200003281CBFFFDF0020FDF7A0FA40444AF221 +:105D3000AB3101444FF47A70B1FBF0F0616A00F2CC +:105D40003D100844F060039830EA090004BF04B035 +:105D5000BDE8F09F2946304607F006FF1FFA80F89D +:105D6000204603F0D6FB40450FD88046777105FBEF +:105D700008F1D4F8CC00FAF7A2FDB060294630460D +:105D800007F0F2FE40441FFA80F84146204603F037 +:105D9000D7FAB068C4F8CC0004B0BDE8F09F0000AA +:105DA000FC660100300D0020445B01000C11010075 +:105DB0002C5F0100D000002002281CBF0328FFDF59 +:105DC00040F69800A1E72DE9F047FF4E054684B064 +:105DD00096F800040C46DFF8F4A340099AF8001482 +:105DE0004909884218BFFFDF96F800044009F849C6 +:105DF00091F800144909884218BFFFDFDFF8D48307 +:105E00006E1E08F13C09002709EB4505092C80F0BE +:105E10002881DFE804F0059BA5A5A0FDFDFDD100CC +:105E20000B2EA8BFFFDF35F8020C0621F8F791FE14 +:105E3000040008BFFFDF0B2EA8BFFFDF35F8020C00 +:105E40002188884218BFFFDF94F8C800002808BFE7 +:105E5000FFDF204603F041F8C8F80470A8F802708C +:105E600021460020C8F8107007F0C6F900F1980527 +:105E7000606AA84250D994F84C00012806D0022844 +:105E800008BFD54E15D0032818BFFFDF94F84C008B +:105E9000012804D002281CBF0328FFDF01D0CF4E09 +:105EA00007E0022804D003280CBFCD4EFFDF00D04E +:105EB000CC4E94F84C00012807D0022808BF4FF4BC +:105EC00096600DD0032818BFFFDF94F84C0001281E +:105ED00004D002281CBF0328FFDF30D04FF4C86075 +:105EE000064494F84D00012808BF002007D002287E +:105EF00008BF012003D003281CBFFFDF0020FDF7EF +:105F0000B5F930444AF2AB3108444FF47A71B0FB32 +:105F1000F1F1606A0844471B21460020C8F8087068 +:105F200007F06AF9618840F2E24251439830081A5A +:105F3000A0F20F30C8F80C0004B0BDE8F0870228CA +:105F40001CBF0328FFDF40F69800C9E704B0BDE896 +:105F5000F04703F0E7B804B0BDE8F047FDF75EBBDB +:105F60009AF8140DA049400991F800144909884293 +:105F700018BFFFDF0B2EA8BFFFDF35F8020C06218C +:105F8000F8F7E7FD040008BFFFDF0B2EA8BFFFDF17 +:105F900035F8020C2188884218BFFFDF0022012358 +:105FA00021466846FFF7DEFC94F8D2006946FAF70E +:105FB000FEFD04B0BDE8F0870B2EA8BFFFDF35F86B +:105FC000020C0621F8F7C5FD040008BFFFDF0B2E09 +:105FD000A8BFFFDF35F8020C2188884218BFFFDF19 +:105FE00094F8C800042818BFFFDF84F8C87094F83C +:105FF000D2504FF6FF76681E0B28A8BFFFDF09EBD3 +:10600000450020F8026C94F8D200FAF729FC00E071 +:1060100027E084F8D270D4F8D800002804BFD4F860 +:10602000D400C8F8140008D0D4E9371211448269AA +:1060300011448161D4E93501C860D4F8D400002846 +:106040001CBFD4F8D810016104D1D4F8D8000028BE +:1060500018BF87616548007804B0BDE8F047F3F7E2 +:106060004FBFFFDF04B0BDE8F0872DE9F047604D7A +:106070000746E88B6C68401CE88328784FF00008DE +:10608000002808BFFFDF07D0DFF848A1042814D09C +:10609000052818BFFFDF40D021462869FAF70FFC1A +:1060A000B86087F8008001203871A86800F22710D6 +:1060B000F860287804287CD19CE00029ECD02E6977 +:1060C000DAF8141039B38946C9680029FBD1B9F14F +:1060D000000F20D099F80000002808BFFFDFD9F892 +:1060E0001410D9F8040001443046FBF7F8FC0028EE +:1060F00007DA211A4A1E92FBF4F202FB040621463B +:1061000004E090FBF4F202FB140621468E4288BFA5 +:10611000FFDF3446C0E74446BEE70029BCD0D5F8CF +:106120001890B9F1000F08BFFFDF0026D9F8DC1086 +:10613000DAF814403046721E5CB1A069884228BF6C +:10614000824284BF024626462046E468002CF4D1F1 +:1061500006B9064609F1C804C9F8D860002E04BF84 +:10616000C4F80C80CAF8144005D0F068F460E06010 +:10617000002818BF0461D4F81090C4F81880B9F151 +:10618000000F0ED0D9F8180048B1D4F814A050452B +:1061900038BFFFDFD9F81800A0EB0A00A061C9F8EA +:1061A0001880002E08BFC5F8208009D0307800285C +:1061B00000E024E008BFFFDF7169706808442862CE +:1061C00040F6B83468E7000001E000E00BE000E0D2 +:1061D00018E000E0300D0020FC660100445B010087 +:1061E0000C1101002C5F010019E000E0CC00002040 +:1061F000480D0020E88B0A2838BF032000D3022076 +:106200007871E88B012806D93846696807F0ACFC3C +:10621000E98B0844E883B8682861BDE8F0872DE978 +:10622000F04184B00E468046FE4C94F80004FE4FC8 +:10623000410997F800044009814218BFFFDF94F834 +:1062400000044009F94991F800144909884218BF2F +:10625000FFDF00250122092EF54C5DD2DFE806F0B4 +:10626000051B3636315C5C184B0062732273607814 +:1062700000281CBF04B0BDE8F081EE484560056110 +:106280002573A068CD38FEF75AFC002818BFFFDF41 +:1062900004B0BDE8F081607850B1207B002808BFD1 +:1062A000FEF7F3FD657304B0BDE8F041FAF71BBAE1 +:1062B000A273FEF705FD002818BFFFDF04B0BDE89C +:1062C000F08104B0BDE8F041FDF7A8B997F8140DCE +:1062D000D949400991F800144909884218BFFFDFE5 +:1062E00000216846FFF7C1FE69464046FAF75FFCA9 +:1062F00004B0BDE8F0812078052818BFFFDF207FBB +:10630000002808BFFFDF25772570207DFAF7A8FA5F +:10631000257504B0BDE8F081FFDF04B0BDE8F08171 +:106320002DE9F041C24C84B00025207804281FBF1D +:10633000207805280C2004B018BFBDE8F0810127A3 +:106340006770607B002690B172B6607B00281CBF2E +:10635000A07B002805D0FEF798FD6673A673FAF7B8 +:10636000C2F962B6207DFBF746FCD0B913E094F881 +:10637000148003208DF804008DF80500FAF786FAE2 +:1063800002904FF0FF3003908DF800706946404650 +:10639000FAF70DFCE6E720BF207DFBF72CFC002878 +:1063A000F9D0207F28B126772078052818BFFFDF95 +:1063B0000C2566702670207DFAF752FA267504B017 +:1063C0002846BDE8F0812DE9F047994884B000786F +:1063D000002818BFFFF7A4FF0120964E30706946D1 +:1063E0000620F8F742FB002818BFFFDF00254FF614 +:1063F000FF7718E0029800281CBF90F8C810002909 +:1064000011D00088B84218BFDFF8308245D006218D +:10641000F8F79FFB040008BFFFDF94F8D200FBF7FA +:10642000EAFB68B905E06846F8F7FDFA0028E1D014 +:1064300033E020BF94F8D200FBF7DDFB0028F8D052 +:1064400084F8C85094F8D2904FF6FF7AA9F1010071 +:106450000B28A8BFFFDF08EB490020F802AC94F836 +:10646000D200FAF7FDF984F8D25069460620F8F711 +:10647000FCFA002818BFFFDF0AE0029800281CBFC2 +:1064800090F8C810002903D00088B842BFD104E0BA +:106490006846F8F7C8FA0028EFD03570756104B087 +:1064A0000020BDE8F08710B50078654C60B1012888 +:1064B0000CBF40F6C410FFDF06D0A06841F66A01A9 +:1064C000884228BFFFDF10BDA060F6E710B55C4C26 +:1064D000002320705648037043700377037343739F +:1064E000837383610375183843703C304FF6FF7136 +:1064F00001800522418020F8041F521EFAD11800A5 +:1065000008BFA36005D0002B0EBFFFDF40F6C4100C +:10651000A060A06841F66A01884228BFFFDFBDE89D +:10652000104050E72DE9F043414D044685B02878EE +:106530001746884600281EBF0C2005B0BDE8F08332 +:1065400094F84C000026012807D0022808BFDFF885 +:10655000F49018D0032818BFFFDF94F84C000128EE +:1065600004D002281CBF0328FFDF02D0DFF8D89038 +:1065700009E0022805D003280CBFDFF8D090FFDF28 +:1065800001D0DFF8CC9094F84C00012807D0022805 +:1065900008BF4FF496600DD0032818BFFFDF94F8B2 +:1065A0004C00012804D002281CBF0328FFDF75D04F +:1065B0004FF4C860814494F84D00012808BF0020C2 +:1065C00007D0022808BF012003D003281CBFFFDF2B +:1065D0000020FCF74BFE48444AF2AB3108444FF42C +:1065E0007A79B0FBF9F0616A00F20A300844C4F825 +:1065F000DC00AC6194F8C800002818BFFFDF40F24F +:10660000712008FB00F068600020FCF72FFE00F20C +:10661000E730B0FBF9F040F2712107FB0100A86000 +:10662000696817E001E000E00BE000E018E000E03E +:10663000480D0020300D002019E000E06C0D002016 +:10664000CC000020FC660100445B01000C1101003D +:106650002C5F0100A1F53D71884298BF0146F948C1 +:10666000A9600661052028706E702E77EE83F648CB +:10667000FAF7A6F82875002808BFFFDFFAF706F931 +:10668000286101216846FFF7F0FC287D6946FAF78A +:106690008EFA05B00020BDE8F083FFE702281CBF9A +:1066A0000328FFDF40F6980084E7E84800780028D8 +:1066B0001CBF0020704710B50620F8F7E7F980F0FE +:1066C000010010BD30B5E14C85B02278002A1EBF14 +:1066D0000C2005B030BD0D4640F27121484360608A +:1066E0000020FCF7C3FD4FF47A7100F2E730B0FBF5 +:1066F000F1F040F2712105FB0100A0606168A1F595 +:106700003D71884298BF01460020A160607004215D +:106710002170E083CC48FAF753F82075002808BFB1 +:10672000FFDFFAF7B3F840F6B831FAF7C8F820619E +:1067300001216846FFF799FC207D6946FAF737FA90 +:1067400005B0002030BD70B5C04CA1690160FFF7F5 +:10675000E7FD002300BBA169D1F8D8205AB1D1E9E7 +:1067600037C5AC449569AC44C2F818C0D1E9352CA2 +:10677000CCF80C2005E0DFF8CCC2D1F8D420CCF85E +:106780001420D1F8D420D1F8D810002A18BF1161F4 +:1067900002D1002918BF8B61A36170BDA94948705F +:1067A0007047A84910B54968002801F1980408BF4E +:1067B00004F5BC7409D0012808BF04F5317404D075 +:1067C000022814BFFFDF04F5B074A0488068A0421F +:1067D0008CBF0120002010BD10B59A4C607828B104 +:1067E000D4E90201626807F0E6F9A060D4E901018A +:1067F00088429CBF2078002814BF0020012010BDD3 +:10680000042210B584B0002938D0012901BF03212A +:1068100080F8C81004B010BD022928D003291EBF7B +:10682000FFDF04B010BD0446408840F2E241484317 +:1068300087490860D4F8F0000089E082D4F8F000BD +:1068400080792075D4F8F00040896080D4F8F00099 +:106850008089A080D4F8F000C089E0802046616A79 +:1068600007F036FA022084F8C80004B010BD80F8A2 +:10687000C82004B0BDE81040F9F735BF04467148A0 +:106880000078002818BF84F8C82004D004B0BDE800 +:106890001040F9F728BF0122002321466846FFF780 +:1068A00061F894F8D2006946FAF781F9B4F850001B +:1068B000401CA4F85000E9E72DE9F041654F0025A0 +:1068C000624C397884B0052880F0D280DFE800F08F +:1068D00003136DCACA00E5830846F3F711FB60781D +:1068E000002873D100216846FFF7BFFB207D694671 +:1068F000FAF75DF96AE00020FCF7B8FC5649DFF8CA +:10690000448108444FF47A71B0FBF1F02169D8F862 +:10691000042040F2E2431144081AA16900F2DE604B +:106920004A88C83102FB03F5D8F814208A4208BF10 +:10693000002614D0216AFBF7D2F8002807DA291ABA +:106940004A1E92FBF5F202FB0506294604E090FB85 +:10695000F5F202FB150629468E4288BFFFDFB868B4 +:10696000864208D2A06940F271224188C1824A431E +:1069700006EB420605E040F2E240B6FBF0F0A1690A +:10698000C882A06905210175C08A6FF41C71484353 +:1069900006EB400040F63541C8F81000B0EB410F5F +:1069A00028BFFFDF04B0BDE8F081E5830846F3F7B8 +:1069B000A7FA01202077A0692169C0F8CC1080F8DF +:1069C000C8502178052918BFFFDF06D0F9F78BFEE4 +:1069D0006573A57304B0BDE8F081002808BFFFDF30 +:1069E000A06990F8C800002818BFFFDFA06990F8E0 +:1069F000D200002818BFFFDF1848F9F7E1FEA169AF +:106A0000064681F8D2000F88401E0B28A8BFFFDF82 +:106A1000134800EB460020F8027CA06990F8D200F1 +:106A2000002808BFFFDF002301226846A169FEF7A6 +:106A300099FFA069694690F8D200FAF7B8F8A56105 +:106A4000C4E70000300D00201F620100480D002047 +:106A5000D0000020CC000020D7020200C75D01005A +:106A60006C0D002004B00846BDE8F041F3F748BAC9 +:106A7000FFDF04B0BDE8F081704770B5134D0446E8 +:106A8000002904BF686070BD4FF47A76012910D0E8 +:106A900002291CBFFFDF70BD6888401C688010465B +:106AA000FCF7CFFB00F2E730B0FBF6F0201A68608D +:106AB00070BD1846FCF752FF00F2E730B0FBF6F06D +:106AC000201A686070BD024800787047300D0020C1 +:106AD000480D0020FE48C07E7047FE484068704761 +:106AE000FD48C07E70472DE9FF4FDFF8E4838BB08F +:106AF0009A46D8F82400D8F80050934604680F4608 +:106B00004FF0000994F84D000390189840EA0A00ED +:106B10000A9094F85C0008280CBF0120002009901E +:106B2000BAF1000F04BF0B9803284CD10998002834 +:106B300049D0B4F81C01584545D1E5482646CDE971 +:106B40000050204604F0B1FB0198B6F8DE10E54A8B +:106B5000008B014400988160E048406800688169CA +:106B600000980160708840F2E24141430098416022 +:106B7000B6F82001F08296F81E013075B6F82201B1 +:106B80007080B6F82411B180B6F82611F180D4498E +:106B90000B79096832F8133091F8041132F81110AA +:106BA00019440A04120C4FF0000105D002FB00F159 +:106BB000CD48B1FBF0F0411C8AB23046716A07F053 +:106BC000BDF802200B90D8F80000BAF1000F006960 +:106BD0000790D8F820000290B4F8DE000090B4F8D6 +:106BE000FC00D4F8F810059106D095F8341061B186 +:106BF0000FB00220BDE8F08F04F1D80104912031DC +:106C0000089108F10406091D07E005F14801049107 +:106C1000091D089105F13806091D0691B4F85010B8 +:106C2000ABEB0000ABEB010109B200B2019100280F +:106C300006DAAA4800684069059001200A900846D3 +:106C40000B99002969D0012900F0F281022900F096 +:106C5000E480032918BFFFDF00F0688249460598E9 +:106C6000F9F72DFE0899BAF1000F08600698A0F810 +:106C700000B008980068B06014BF03200120307194 +:106C8000D5E90710814287BF049908600498016024 +:106C90000498616A0068084400F24F10F060012017 +:106CA00070710999002900F0FD821899C9B100BFDF +:106CB000B4F8F020002A0CBF0021B4F8F210A4F8B8 +:106CC000F21094F8F430491C5943914209D2717979 +:106CD000491E002905DD7071B4F8F200401CA4F8CB +:106CE000F20086F800A0BAF1000F1CBF95F834003E +:106CF00000287FF47DAF8AF0010085F8350098F810 +:106D00001C0098F81B20314698F81A309A4200F07F +:106D1000F082F9F74CFF00F0F5BA0298002808BF9E +:106D2000FFDFE08A40F271214843490001EB400156 +:106D30000020002F06D06C4807FB01F1B1FBF0F0FA +:106D400000F101006861608840F2E24100FB01F15E +:106D50004FF0000006D0644807FB01F1B1FBF0F0F2 +:106D600000F10100A8614FF00000FCF7F7FD4FF4BF +:106D70007A7700F2E140B0FBF7F102980844009006 +:106D80000020FCF7EBFD014601F5AC39002009F5C8 +:106D90005179FCF76BFA48444AF24D210844B0FBA4 +:106DA000F7F1E08A40F2712250436F69C1EB400075 +:106DB000C11B0098084400F2C249207D510010FB1D +:106DC00001F000900020FCF751FA00F5AC3101F51C +:106DD00051714AF2531001444FF47A70B1FBF0F054 +:106DE00000EB470100980F180020FCF718FA384410 +:106DF0006230E86128620020FCF7B0FD00F2E1415A +:106E00004FF47A70B1FBF0F102980844A9EB00004E +:106E1000B0F5387F98BFFFDF20E7E08A40F27121AC +:106E20006A68484302EB40010020002F06D02E483C +:106E300007FB01F1B1FBF0F000F10100686161882E +:106E400040F2E24301FB03F34FF0000106D0264974 +:106E500007FB03F3B3FBF1F101F10101A961009913 +:106E6000002970D1189900296DD094F84D0001289F +:106E700006D0022808BF1D4F15D0032818BFFFDF1A +:106E800094F84D00012804D002281CBF0328FFDF1E +:106E900001D0174F07E0022804D003280CBF154F7C +:106EA000FFDF00D0144F94F84D00012808BF0020E8 +:106EB00007D0022808BF012003D003281CBFFFDF32 +:106EC0000020FCF7D3F939184AF25310014415E0B9 +:106ED000840D0020F0000020AC0D0020E000002018 +:106EE000E8000020A605020040420F00FC660100F9 +:106EF000445B01001C3801002C5F01004FF47A70E4 +:106F0000B1FBF0F16869E28A014440F271236868DC +:106F10005A4300EB4200471A94F84D00012808BF7D +:106F2000002007D0022808BF012003D003281CBF7F +:106F3000FFDF0020FCF773F90799081A3844A0F125 +:106F4000200908E0FFE7E18A40F27123594302EB90 +:106F50004101A1EB0009AA682968686901FB0200E8 +:106F60000290217D40F2E24011FB00F0019094F884 +:106F70004D000090012810D0022808BFFE4F16D007 +:106F8000032818BFFFDF0098012806D002281EBF83 +:106F90000328FFDFF94F02D00FE0F84F0DE0022881 +:106FA00004D003280CBFF64FFFDF00D0F54F009848 +:106FB000032808BF4EF634100ED00098012808BFF1 +:106FC000002007D0022808BF012003D003281CBFDF +:106FD000FFDF0020FCF74AF939184AF25310014448 +:106FE0004FF47A70B1FBF0F1029801EB4001019887 +:106FF0000F180098012808BF002007D0022808BFFA +:10700000012003D003281CBFFFDF0020FCF707F995 +:1070100038446030E861618840F27122A8695143C8 +:10702000C0EB4100A0F5477028620120287315E6E7 +:10703000628840F27123A9695A43C1EB420202FB04 +:1070400000F9DDE900021044AA68D5F800C0801AF2 +:107050006B69401E0CFB023200FB01200390217D76 +:1070600040F2E24011FB00F0019094F84D000090D6 +:10707000012810D0022808BFBF4F16D0032818BF20 +:10708000FFDF0098012806D002281EBF0328FFDF7B +:10709000BA4F02D00FE0B94F0DE0022804D0032808 +:1070A0000CBFB74FFFDF00D0B64F0098032808BFD2 +:1070B0004EF634100ED00098012808BF002007D0EB +:1070C000022808BF012003D003281CBFFFDF0020D7 +:1070D000FCF7CCF839184AF2531001444FF47A7097 +:1070E000B1FBF0F1039801EB400101980F180098F3 +:1070F000012808BF002007D0022808BF012003D0C4 +:1071000003281CBFFFDF0020FCF789F838446030FB +:10711000E861A9F5477028629B48406800283FF461 +:107120009DAD0298002808BFFFDF97E5628840F216 +:107130007123A9695A43C1EB420101FB00F994F89C +:107140005B0020281CBF94F85C0020280BD1B4F809 +:107150001C01ABEB000000B2002804DB94F81F0117 +:10716000002818BF03900A9830B1009800280798AB +:1071700052D0002818BFFFDFDDE900010844A969EB +:10718000484300900398012808BF7C4F0DD0022887 +:1071900008BF794F09D003281DBFFFDFFFDF774FFE +:1071A000774F08BF4EF634100ED00398012808BF61 +:1071B000002007D0022808BF012003D003281CBFED +:1071C000FFDF0020FCF752F839184AF2531001444F +:1071D0004FF47A70B1FBF0F1009801EB400703988F +:1071E000012808BF002007D0022808BF012003D0D3 +:1071F00003281CBFFFDF0020FCF711F83844603083 +:10720000E861618840F27122A8695143C0EB4100F6 +:10721000A0F54770286221E500281ABF02980028CF +:10722000FFDF0398012809D0022808BF524F06D07B +:1072300003281ABFFFDFFFDF514F00D04F4F94F8F4 +:107240004D00032808BF4EF634100AD0012808BFAD +:10725000002004D002281ABFFFDF00200120FCF725 +:1072600005F839184AF2531001444FF47A70B1FB13 +:10727000F0F0A9EB000794F84D00012808BF0020AA +:1072800007D0022808BF012003D003281CBFFFDF5E +:107290000020FBF7C4FF0799081A3844A0F1200921 +:1072A0006AE700BFB4F8C810A1EB0B0109B20029CE +:1072B000C4BF032171710B9900293FF4F6AC1899F2 +:1072C00000297FF4F5AC618840F27122A86951432E +:1072D000C0EB4101304606F047FC0004000C3FF4CF +:1072E00000AD1999002918BF088001200FB0BDE832 +:1072F000F08F002088F81B0088F81A00C8F80000FA +:10730000C8F824000FB00020BDE8F08F70B51E4D06 +:107310000929D5E9003273D2DFE801F005768D95B1 +:1073200089A8A871A40000201062D17E042969D226 +:10733000DFE801F06868025E516A0C681168C88174 +:1073400011680861106890F8350040B9F9F79EFAA5 +:1073500069680968096CFAF7C2FB002826DC6868CE +:1073600001684A8EB4F850108A4212D1B4F8CC2089 +:10737000511AA4F8CE1009E0FC660100445B01003C +:107380001C3801002C5F0100E0000020A4F8502010 +:1073900006E0511AA4F8CE100168498EA4F85010E6 +:1073A0000268C1681164C16841611CE068680168D5 +:1073B000098EB4F85020891AA4F8CE100168098EFD +:1073C000A4F8501001680A6CC2600A6C4261896CB2 +:1073D000C4F8D8100168C96CC4F8F8100068B0F897 +:1073E0005000A4F8FC002046BDE8704003F09CBDAE +:1073F000D0685061FCF7E4FD002818BFFFDF70BDC6 +:1074000034E0FFE7FFDF70BDD07E04280DD2DFE857 +:1074100000F00C0C0206BDE8704003F044BFFCF71E +:1074200062FF002818BFFFDF70BDFFDF70BDBDE841 +:107430007040FCF7F3B8D87E02280FD0D87E03281E +:1074400018BFFFDF06E0D87E022807D0D87E0328C9 +:1074500018BFFFDFBDE8704000F03ABCBDE87040E7 +:1074600000F08EBCBDE87040F9F7FAB9FFDF70BDDF +:107470002DE9F05FFF4D0026FF4F82460C464FF08E +:107480000109092972D2DFE801F005727D7D72845D +:10749000847D7D006868DFF8E083002818BFFFDF87 +:1074A00021465046C5F80480FFF730FFF87E0228D9 +:1074B00018BFBDE8F09F6868D0F800A0406A056872 +:1074C000F9F7C7F995F84D40DFF8B0B38046012CC5 +:1074D00008BF002013D0022C08BFDFF8A4B305D0EA +:1074E000032C1ABFFFDFFFDFDFF898B3022C08BFC1 +:1074F000012004D0032C1ABFFFDF00200320FBF77C +:10750000B5FE58444AF2531108444FF47A71B0FB67 +:10751000F1F0DAF8181040F27122084469885143FA +:10752000C0EB4100A0F12004B8F1B70F98BF4FF0B5 +:10753000B7082946012005F05FFE4044201AA0F25A +:1075400001342946012005F057FE696A9C308142CA +:1075500088BF0E1ACAF82C40A64238BF3446CAF873 +:107560002840386880F83490BDE8F09F11E050461C +:10757000FFF7CCFEF87E022804BF386880F834900C +:10758000BDE8F09F50462F60FFF7C0FE2E60BDE8BB +:10759000F09FFFDFBDE8F09F2DE9F041B54C0746B5 +:1075A0000D4609291ED2DFE801F005101414101D44 +:1075B0001D1414006068B44E002818BFFFDF294670 +:1075C00038466660BDE8F041A0E63846BDE8F041C7 +:1075D0009CE6AD4820603846FFF798FE002020600A +:1075E000BDE8F081FFDFBDE8F081F0B5A24985B0CC +:1075F0000026CA7E9F4C032A03D02831CA7E032A64 +:1076000064D10025216000B3012806BF03208876DD +:10761000FFDF0AD02068002E05604562256055D046 +:107620009A48456005B00020F0BD2068C17E29B1B0 +:10763000C17E827E914208BF20BFF6D0C17E002964 +:107640000CBF012600268576E4E7002603270846BE +:107650008F76C97E032904D0C07E002808BF01268A +:1076600031E00120FCF75EFE2068007F002808BFA3 +:10767000FFDF2068067F8DF804708DF80570F9F73C +:1076800005F902904FF4FA70039001208DF8000084 +:1076900069463046F9F78BFA2068007FFAF7ABFAB3 +:1076A00030B920BF2068007FFAF7A5FA0028F8D08B +:1076B0002068007FF9F7D4F820680577C5768576CD +:1076C00005600126456220688576A3E705B00C2099 +:1076D000F0BD2DE9F0416E4E054696F800046D4C64 +:1076E000400994F800144909884218BFFFDF96F852 +:1076F00000044009684991F800144909884218BFFC +:10770000FFDF94F8140D4009644991F80014490909 +:10771000884218BFFFDF624800240570564DEC76A2 +:10772000AC7605F12806F476B4760121103000F12C +:107730000807017104606C6274622C60346005F1AA +:1077400050087C6088F83740284600F02BFC05F193 +:10775000280000F027FC88F80C407C706C61746194 +:10776000AC76B476A7F1100044600460BDE8F08107 +:107770004C49087170472DE9F8433F490546CA7ED8 +:107780003C4C01F12800002A04BFC27E002A6FD0C1 +:10779000C97E022907BFC17E00290C20BDE8F883FD +:1077A00020604148F9F70CF82168087737484560B0 +:1077B0002168086014384862ADB1012105F1F40078 +:1077C000FAF7BCFC0620F7F76FF906460720F7F733 +:1077D0006BF995F8F4103044B1FBF0F200FB121095 +:1077E000401C85F8F4002068007F002808BFFFDFF8 +:1077F000F9F72FF82D49091838BF40F2F65000F27A +:107800006B1087B220680326C676FCF7B2FA2168AF +:107810000861FCF7D2FA00254FF00108002852D089 +:10782000FCF7CBFA21684A6A10600868012180F8E9 +:1078300000806846FAF70DFC9DF8000042F21071D6 +:107840000002B0FBF1F201FB12000744F9F71EF849 +:107850003946F9F734F82168C86022681672567202 +:107860001571107FD37E111D92F81AC063451FE079 +:1078700022E00000E0000020840D0020445B0100B5 +:10788000FC6601001C380100AC0D0020F000002057 +:1078900001E000E00BE000E018E000E019E000E0AB +:1078A000D8000020E8000020997501000AFAFFFFC7 +:1078B00016D0F9F77CF917E0FA482160F8F780FF55 +:1078C0002168087772E7F8F7E1FF3946F8F7F7FF24 +:1078D0002168C86008680570086880F80180BCE706 +:1078E000D576957615605562206805830020FCF7F3 +:1078F00019FD00202560BDE8F8832DE9F041EA4E2E +:1079000082B0F17E19B906F12801C97E19B102B021 +:107910000C20BDE8F0810221F176DFF89483E34D7D +:10792000C6F8248035600024C8F800002C73A0F845 +:10793000FC40E04F98F8041090F80421438837F891 +:10794000111037F8122011440A04120C214605D0F8 +:1079500002FB03F1D84AB1FBF2F1491C8AB2416A39 +:1079600006F0ECF900940194D8F8001098F804009F +:10797000002391F8041137F810001A4637F8111057 +:10798000084481B21846FFF7AEF8002818BFFFDFA1 +:10799000AC6001202C6028736C862C8685F83640FC +:1079A000D8F80000B0F85010491EA0F850103483E9 +:1079B00002B00020BDE8F081BC4981F83700704773 +:1079C000BE4810B540680124817E032908BF002409 +:1079D00009D00168497831B1006AB949884284BF49 +:1079E0000024FCF79BFC204610BD70B5B3484468EA +:1079F0002068C189491CC1812268D2E90A0192F834 +:107A00003720256A002A1CBF2A4606F0D4F82168D0 +:107A10008542886205D82068007B01281CBF0120B0 +:107A200070BD002070BD2DE9F043A44C9E4883B08A +:107A30002060416A006800260D6880F8346095F87F +:107A4000D610002904BF007B032856D1F8F71EFF8B +:107A5000014620684069FAF742F800F26170002898 +:107A60004BDD216840F271274A6A0B681268D3F82F +:107A700018C052887A43CCEB4202B0FBF2F0B5F862 +:107A80005020401C104418860868B5F8CC20018EA0 +:107A9000511A09B2002930DD012180F83610B5F8FD +:107AA0007600B5F87410DFF80C82401AB5F8501063 +:107AB000401E084487B20DF1080917E0516A0979A0 +:107AC00038F81110CDE90069028E95F80431007B79 +:107AD00038F81330194489B20123FFF704F860B174 +:107AE00001280ED0022818BFFFDF06D022681068D8 +:107AF000018E791A09B20029E0DA266003B0BDE8E8 +:107B0000F08320680068018EBDF8082011440186CA +:107B1000ECE770B50025694C052822D2DFE800F0BB +:107B2000141C030E0D00002000F0B0F96068C5764B +:107B300085760560456268B1656070BD2068C57670 +:107B400085760560456270BD012000F09FF9606890 +:107B50000028F1D1FFDFEFE76168032009680873AF +:107B600070BDFFDF70BD2DE9F041544D002478B1A8 +:107B7000012814D002281CBFFFDFBDE8F08100F00F +:107B8000CAF96868C47684760460446220B929E042 +:107B900000F0C1F9686828B36C60BDE8F0816868DE +:107BA000466901684C70C4768476464F046044622E +:107BB0000021786805F03AFC786880F81A4180F86E +:107BC0001B41C0F8F860FFF798FE002818BFFFDFE0 +:107BD000F8F789FD3C486C600078F2F791F96C6029 +:107BE000BDE8F081FFDFD7E7344910B54C68E17E8E +:107BF000022918BF10BD2168CA89002A18BF10BD0C +:107C00000861606A006890F84D00012808BF0020F4 +:107C100007D0022808BF012003D003281CBFFFDFC4 +:107C20000020FBF7FCFA21680A69101A8A6A0244EC +:107C30008A622168CA6A1044C86210BD70B51F4DBF +:107C40000446002902BF6868046270BD4FF47A766A +:107C500001290ED002291CBFFFDF70BD1046FBF7C3 +:107C6000F0FA00F2E140B0FBF6F06968201A086211 +:107C700070BD1846FBF772FE00F2E140B0FBF6F073 +:107C80006968201A086270BD1048C07E00281CBFB9 +:107C90000020704710B50720F6F7F8FE80F00100CD +:107CA00010BD000071740100840D0020D40D00206F +:107CB000E8000020A605020040420F00E00000207E +:107CC000CF821300F0000020D8000020AC0D00206F +:107CD0002DE9F843AF4D4FF003080027286801262F +:107CE000041D80F80880077100684078012836D0AC +:107CF00001216846FAF7ADF99DF8000042F21071D3 +:107D00000002B0FBF1F201FB12002968496A096820 +:107D10000E183146A068F8F7D2FDA0603146204623 +:107D200005F022FF461C2868018B0A299CBF3144BC +:107D30000183994988421CBF018B0A2992BF84F8AC +:107D4000058002216171027FC37E214690F81AC02E +:107D500063450FD0BDE8F8431046F8F728BF4FF44D +:107D60007A71A068F8F7ABFDA0600021204605F00D +:107D7000FBFED8E7C776877607604762BDE8F883E1 +:107D80002DE9F047834E84B03068416A04680D687D +:107D9000F8F77CFD3268526901461046F9F79FFEFC +:107DA0003168002700284A6A126808BF38460AD09E +:107DB0000B68528840F2712C9B6902FB0CF2C3EBFA +:107DC0004202B0FBF2F095F85C20082A0ED0B5F81C +:107DD0005020638E02EB000C6345AEBF581C401C64 +:107DE0001044608694F8360058B903E0608E401C59 +:107DF000608606E0608EB5F8CC20904204BF401C3F +:107E00006086088BDFF89481401C0883B5F8760003 +:107E1000B5F874100DF1080A401AB5F85010401E5C +:107E200008441FFA80F919E03068406A007938F890 +:107E30001000CDE9007A95F8041138F811100844C3 +:107E400081B2207B0023FEF74EFE002804BF04B061 +:107E5000BDE8F087012818BFFFDF11D0628EA9EBC3 +:107E6000020000B20028DFDA082085F86A0001204D +:107E700085F8690004B02846BDE8F04702F086BDE9 +:107E8000608EBDF8081008446086E7E7F0B5414E03 +:107E9000002483B0716801284A6A15682ED11079D0 +:107EA0003E4B0A6833F81000177B4FF0010C032F8C +:107EB00003D0117B012910D020E0946009680C6088 +:107EC000CDE900C495F80411B5F8CC2033F81110B1 +:107ED0000023084481B203200BE0CDE900C495F8EB +:107EE0000411B5F8CC2033F811100023084481B2F6 +:107EF0000120FEF7F8FD002818BFFFDFF8F7F3FBBD +:107F0000706804830268B5F850105186006880F8E4 +:107F1000364003B0F0BD38B51E4C00200546616800 +:107F200009684A78002A18BF4D702AD1097861B1D2 +:107F300001216846FAF7B1F89DF8000042F210718D +:107F40000002B0FBF1F201FB12006268516A09689D +:107F50000144D068F8F7B3FC6268D0601571032063 +:107F60005072107FD37E111D92F81AC0634502D063 +:107F7000F8F71DFE03E0D5769576156055626068CA +:107F80000583F8F7B0FB06480078BDE83840F1F704 +:107F9000B7BF0000E0000020AC0D0020A6050200E5 +:107FA000D80000202DE9F047DFF874801D4C05460D +:107FB0004FF01F090027EE7E042E23D2DFE806F0E3 +:107FC0002922021D454518BFFFDF02202560A87643 +:107FD0002168C87E28B1C87E8A7E904208BF20BF33 +:107FE000F6D0C87E8F7600281CBF4FF00C092760A2 +:107FF0000CD10F604F6227600BE00120FFF7F5FA0C +:10800000814600E0FFDFB9F1000F02D0E87EB04208 +:10801000D1D1E87E002818BFFFDFBDE8F08700005F +:10802000840D0020E000002010B584B004466846AE +:10803000FBF728FD002808BFFFDF009806F0CBF80B +:108040000321009806F0DEF80098017821F0100175 +:108050000170214606F053F9192C80F02B81DFE8DE +:1080600004F03A2A0D65FAFAF91C9FFAF9F988FA30 +:10807000FAFAFAF8F9F9ADC9E5FAFC00FD488068AA +:1080800090F8E910009806F0BFF9FBF70EFD002804 +:108090001CBF04B010BD00F0F9B8F648806890F835 +:1080A000C110009806F000FAFBF7FFFC002840F032 +:1080B000258100F022B9EF488068D0F8F400411C17 +:1080C000009806F092F9FBF7F0FC00281CBF04B002 +:1080D00010BD00F0DBB8E74CA068D0F8F000817963 +:1080E000009806F056F9A068D0F8F00001890098D1 +:1080F00006F048F9A068D0F8F0004189009806F031 +:108100002CF9A068D0F8F0008189009806F02CF9CD +:10811000A068D0F8F000C189009806F02CF9FBF7B0 +:10812000C4FC00281CBF04B010BDAFE0D14CA06857 +:10813000D0F8F000011D009806F06AF9A068D0F8A8 +:10814000F00000F10C01009806F06CF9A068D0F87E +:10815000F00000F11E01009806F06AF9A06800F135 +:10816000B801009806F072F9FBF79FFC002873D164 +:10817000C1E0C04C60690178009806F07FF9606941 +:108180008188009806F07CF960694188009806F0C3 +:108190007BF9FBF78AFC00281CBF04B010BD75E01A +:1081A000B549D1E90001CDE9020102A9009806F024 +:1081B0007FF9FBF77AFC00284ED19CE0AD4CA0681B +:1081C000B0F84010009806F07DF9A068B0F84210B1 +:1081D000009806F07BF9A068818F009806F07AF984 +:1081E000A068C18F009806F079F9FBF75EFC0028C3 +:1081F00077D180E09F4CA068818F009806F06AF9E3 +:10820000A068C18F009806F069F9A068B0F8401026 +:10821000009806F057F9A068B0F84210009806F0F0 +:1082200055F9FBF742FC002868D166E0914CA06844 +:1082300090F80D11009806F081F9A06890F80E11E1 +:10824000009806F07FF9FBF730FC002849D152E096 +:1082500003E01EE02FE02DE043E0864CA06890F89C +:10826000FC0005F0EDFD0146009806F06FF9A068EE +:1082700090F8FD0005F0E4FD0146009806F06AF96B +:10828000FBF713FC00281CBF04B010BDFFDF04B0D7 +:1082900010BD784CA06890F8E510009806F07EF9C3 +:1082A000A06890F8E410009806F07CF9FBF7FDFB5D +:1082B00020BB22E0FFDFFBF7F8FB002808BFFFDF51 +:1082C0000C2C19BF132C182C04B010BD112C1CBF82 +:1082D000072C152C12D0012C19BF002C022C04B035 +:1082E00010BD002163488068A0F87A10012180F851 +:1082F0007E1004B010BDFFDFF3E7FFDF5D49002013 +:108300008968A1F8800004B010BD2DE9F043594CF4 +:1083100083B0207910F0010F04BF03B0BDE8F083F3 +:10832000206900230521C578A06890F85B205030B3 +:1083300005F0C4FB002818BF022D0CD00B2D18BF70 +:10834000042D08D0052D1CBF062D0D2D03D06078FF +:1083500040F008006070607800281CBF03B0BDE8E2 +:10836000F0832069C078801E162880F0E683DFE85D +:1083700010F01600E4038F00AD0006012E00E403A8 +:10838000C801E40385005001C800E403E403E403EA +:10839000E40337021E024F02B9022F03A403A068B0 +:1083A0000023012190F85D20503005F087FB002864 +:1083B00040F0D183206906F029F8A16881F8EA002D +:1083C000022081F85D00002081F882003CE0A06876 +:1083D0000921002390F85B20503005F06FFB20B19D +:1083E000206906F063F8122814D0A0680A2100233F +:1083F00090F85B20503005F061FB20B1206906F059 +:1084000055F814281AD0206906F050F8162840F0C4 +:10841000A2831DE0A0680125002390F85B200921BC +:10842000503005F04BFB002808BF657000F09383C7 +:108430006078002800F0CA8100F08DBBA1680020A0 +:1084400081F8900081F85B0081F87E0000F083BB2A +:10845000A06890F85B101C2940F07D83002180F813 +:10846000911080F85B1080F87E101A2001F089F8D6 +:1084700000F071BBF8000020B8050200A06890F879 +:108480005B100C2947D1002180F85F100F2134E0E8 +:10849000A06890F85B1010293DD1D0F8F01000884A +:1084A0004988814218BFFFDFA068D0F8F00000F1D2 +:1084B0002601206905F0D7FFA06800F1BC01206902 +:1084C00005F0D9FF1320A16800F07ABAA26892F8EB +:1084D0005B0013281FD1D2F8F00002F1A80300F1CD +:1084E0001E0100220E3005F07EFAA0680021C0E9CE +:1084F0002611012180F85F10152180F85B1000F033 +:108500002ABBA16891F85B00132812BF102891F8CC +:108510008400002802D0022000F073BA206905F020 +:10852000C1FFA168002581F8C00081F8835081F85F +:108530007E50D1F8F00009884088884218BFFFDFDC +:10854000A068D0F8F0100D70D0F82C110A78002A2D +:1085500018BFFFDF40F026810288CA80D0F82C21A6 +:1085600090F8C0101171D0F82C110D72D0F82C2198 +:108570000B211170D0F82C210188518040E0A068B7 +:1085800090F85B101829C6D1002580F8835080F838 +:108590007E50D0F8F01000884988814218BFFFDF74 +:1085A000A068D0F8F0100D70D0F82C110A78002ACD +:1085B00018BFFFDF40F0F68090F884207AB180F891 +:1085C00084500288CA80D0F82C110D71D0F82C216B +:1085D0000C211170D0F82C210188518010E0028804 +:1085E000CA80D0F82C110D71D0F82C210121117204 +:1085F000D0F82C210B211170D0F82C21018851804A +:108600000088F6F701FCF6F7B1F8E078F1F778FCAE +:10861000C8E0A0680023194690F85C20503005F0AF +:108620004DFA50B9A0680023082190F85B20503023 +:1086300005F044FA002800F045826078002840F0F8 +:108640008A82A06890F8860010F0020F17D1206986 +:1086500005F01EFFA16881F88700206905F01AFF68 +:10866000A168A1F88800206905F017FFA168A1F8AA +:108670008A0091F8860040F0020081F88600A06828 +:1086800090F8861011F0010F15D190F85C200023AE +:108690001946503005F012FA002808BFFFDF01210B +:1086A000A068042280F85C1080F8EC2080F882102A +:1086B0000021A0F88010A06890F85B10012907D174 +:1086C000002180F85B1080F87E10E078F1F718FC4C +:1086D000A168D1F8F000098842888A4204BF017875 +:1086E000042940F0388200250570E078F1F708FC95 +:1086F000A06890F85B10002908BF80F87E5000F059 +:108700002ABAA0680023072190F85B20503005F0BA +:10871000D5F9002800F0D6816078002840F01B824F +:108720006946206905F005FFA0689DF80020002536 +:1087300090F88C10114001F02F0180F88C1090F807 +:108740008D109DF80120114001F02F0180F88D104F +:1087500080F87E50D0F8F01000884988814218BF18 +:10876000FFDFA068D0F8F0100D70D0F82C110A7857 +:10877000002A18BFFFDF15D10288CA80D0F82C115B +:108780000D71D0F82C11009A8A60019ACA60D0F855 +:108790002C21062111700188D0F82C014180E0784D +:1087A000F1F7AEFBA06880F85B5000F0D4B9A06888 +:1087B0000023092190F85B20503005F07FF9002854 +:1087C00000F080816078002840F0C581A168002019 +:1087D00081F8720081F87E0081F85B0000F0BBB97F +:1087E000A0680023194690F85C20503005F066F927 +:1087F000002800F067816078002840F0AC81A06814 +:108800000021A0F88010012180F882100B2165E082 +:10881000A0680023194690F85C20503005F04EF90E +:1088200000287DD0206905F065FE28B3206905F099 +:1088300059FE0646206905F057FE0546206905F0F9 +:1088400055FE0746206905F053FEA1688F86CE8647 +:1088500008874D8791F8900000281CBF91F85B00B5 +:108860001A2833D06846FBF733F958B3009805F05F +:1088700072FD142820D025E0A0680023194690F846 +:108880005C20503005F01AF9002800F01B81607858 +:10889000002840F06081206905F05DFDA16881F845 +:1088A000C100052081F85C000020A1F880000120B3 +:1088B00081F8820000F04FB9A168002081F87E00A5 +:1088C000FBF715F9A168002081F89000A06800214D +:1088D000A0F88010012180F882101B2180F85C1024 +:1088E00000F039B9A06800230A2190F85B205030CD +:1088F00005F0E4F8A0B1206905F0FCFDE8B32069BB +:1089000005F0F4FD0746206905F0F2FD05462069F3 +:1089100005F0E8FD0646206905F0E6FDA16800E0E7 +:1089200051E0B1F82C80CB8DB1F830C04A8E8F86E3 +:10893000CE860D874887B1F83C90B14598BF4E462A +:108940008E85B1F84090B94598BF4F46CF85B1F8B4 +:108950003E90814598BF48460886B1F84290A945A7 +:1089600098BF4D464D869F4238BF1F46CF859542E2 +:1089700038BF15464D86464500E01BE008BF9F42C4 +:1089800003D1604508BF954214D00A88A1F81A2186 +:108990008A8DA1F81C210A8EA1F81E21CA8D01F52D +:1089A0008870A1F82021498E418201210172E0786E +:1089B000F1F7A6FAA168002081F8900081F87E0006 +:1089C00081F85B00C7E0607840F001006070C2E0B1 +:1089D000A0680023194690F85C20503005F06EF82E +:1089E000C0B3A06890F85B201C2A0CD000230B2198 +:1089F000503005F063F800281CBF607840F020007C +:108A000011D06070A7E0232180F8E410162280F8CE +:108A1000E520172180F85C10012180F882100021E8 +:108A2000A0F8801097E0A06890F85B0005F06DFA60 +:108A300088B1A0682A22162180F8E42080F8E51089 +:108A4000172180F85C10012180F882100021A0F825 +:108A5000801080E036E0206905F072FD00F007002C +:108A600060F30705206905F06FFD00F0070060F373 +:108A70000F25A0680121002680F88210A0F88060F0 +:108A80001D2180F85C10B0F84A10ADF8001029469E +:108A9000C56C009805F0DDF9EAB2C1B28A4219BF8F +:108AA000A26882F8FC10A16881F8FC60C5F3072178 +:108AB000C0F30720814238D13BE0A06890F85B000A +:108AC0001C2801D001209CE7206905F039FD00F049 +:108AD000070060F30705206905F036FD00F0070088 +:108AE00060F30F25A0680121002680F87E10A0F811 +:108AF0007A601F2180F85B10B0F80D11ADF80010FE +:108B00002946C56C009805F0A4F9EAB2C1B28A42C0 +:108B100019BFA26882F8FC10A16881F8FC60C5F357 +:108B20000721C0F30720814203D0A16881F8FD002E +:108B300011E0A06880F8FD600DE0A06800231946F0 +:108B400090F85C20503004F0B9FF0028BAD060786B +:108B500000283FF4A0AEA068D0E92812491C42F1D9 +:108B60000002C0E9281203B0BDE8F0832DE9F04708 +:108B7000FE4D04464FF00007687808436870287976 +:108B800010F0200F2846806818BFA0F8747004D138 +:108B9000B0F87410491CA0F8741090F86010012609 +:108BA00039B990F85B2000230621503004F086FF8D +:108BB00058B3A88810F4006F07D0A86890F8601028 +:108BC000002918BFA0F86C701FD1A868B0F86C100D +:108BD000491C89B2A0F86C10B0F86E208A422CBFF4 +:108BE000511A00218288521D8A4228BF80F8726083 +:108BF000B0F86C10B0F86E20914206D3A0F86C70FB +:108C000080F81661E878F1F77BF9287910F0600FA9 +:108C100008D0A86890F85E1021B980F85E60012144 +:108C2000FDF7EEFD4FF00808002C47D168780028CA +:108C300042D1287910F0040F0DD0A86890F85B009D +:108C4000052808BFFFDFA86890F85D10022904BF5F +:108C50002E7080F85D7000F00CFF287910F0080F7E +:108C60000AD0687840B9A86890F85D10032903D14C +:108C70000221297080F85D70FFF747FBA87810F09B +:108C8000080F16D0A8680023052190F85B2050300B +:108C900004F014FF50B185F80180A868D0F82C11B9 +:108CA00008780B2808BF0020087002E0002003F0BD +:108CB000CFFAA86800F066FE00F097FCA868A1460D +:108CC00000F1500490F8E80030B9627B00230121E4 +:108CD000204604F0F3FE10B1208D401C20853D217C +:108CE000B9F1000F18D12878022808BF16200ED03D +:108CF000012804BFA86890F8EA0008D06878E8B1B5 +:108D000010F0140F1CBF1E20A07602D005E0A07644 +:108D100003E010F0080F02D0A176667641E010F073 +:108D2000030F03D02A20A07666763AE010F0200FD9 +:108D300008BFFFDF2320A076667632E094F82E008D +:108D400028B1608D411C6185A18D884213D294F8B1 +:108D5000320028B1208E411C2186A18D88420AD282 +:108D6000218DE08C814203D3AA6892F8E82012B9E1 +:108D7000A28D914203D32220A076667611E0A17BDA +:108D800031B1A18C814228BF84F81A80C5D206E097 +:108D9000A08C062803D33E20A076667601E0607E94 +:108DA00058B1E7722773A7730221A868FDF728FD61 +:108DB000E878BDE8F047F1F7A3B8A868BDE8F04748 +:108DC0000021FDF71DBD69494A788B781A430ED101 +:108DD00001280AD0087910F0040F04D0886890F8B0 +:108DE0005D00022803D001207047FDF7F5BC00208C +:108DF000704770B55D4C05460E46A0882843A0809C +:108E000015F0020F04D015F0010F18BFFFDFE66068 +:108E100015F0010F18BF266115F0020F12D0304671 +:108E200005F099FA062802D00B283BD00AE0A0688A +:108E300090F85B10152905D10021C0E92811012106 +:108E400080F8601015F0800F1CBF0820A07015F48A +:108E5000806F08BF70BDA168B1F8500089880844D0 +:108E6000801D85B2304605F076FA012822D03046C2 +:108E700005F071FA38B3304605F06DFA182818BFBE +:108E800070BDA06890F8FC10002902BF90F8FD109A +:108E900000290025A0F8FE5029463046BDE8704064 +:108EA00005F05CBBA06890F85B100F2908BF00219B +:108EB000C8D1C5E7A0682946A0F8FA503046BDE8F9 +:108EC000704005F09ABAA0682946D0F8F000858075 +:108ED0003046BDE8704005F060BAF8B5234D002675 +:108EE0000446A860AE806E70AE702E703746008863 +:108EF000FAF7C5FDA8680088FAF7E7FDB4F8D000D6 +:108F0000A968401C82B201F1500004F084FC0028E2 +:108F100018BFFFDF94F85C0020280AD1B4F8501085 +:108F2000B4F8FE00081A00B20028A4BF6878002830 +:108F300004D094F85B0020283DD119E0A86890F88F +:108F4000FC10002908BF90F84C1080F84C1090F8E5 +:108F5000FD10002908BF90F84D1080F84D1000203A +:108F600000F00FFB84F85C6025E00000F8000020B2 +:108F7000B4F85010B4F8FE00081A00B20028A4BFDC +:108F80006878002817D1A86890F8FC10002908BF5D +:108F900090F84C1080F84C1090F8FD10002908BF94 +:108FA00090F84D1080F84D10002000F0EAFA84F897 +:108FB000916084F85B60A4F8D060A86890F87E1097 +:108FC00029B1B0F87A10B0F87C20914229D290F8FB +:108FD000821029B1B0F88010B0F87C20914220D2E4 +:108FE000B0F87820B0F876108A421AD290F85E2055 +:108FF000B0F874001AB3884213D2FD480090FD4BBC +:10900000FD4A2146384602F0E3FFA8680023052107 +:1090100090F85B20503004F051FD002818BF02F09A +:1090200008FDA86890F80011012411B390F801110F +:10903000002904BF90F89010002903D019E00628F9 +:10904000EFD2DAE790F85C101B2912D0B0F80211C9 +:109050008187B0F80411C187B0F8061129B1A0F8D2 +:109060004010B0F80811A0F8421080F8904080F845 +:10907000006190F80A11002908BFF8BD90F80C11A2 +:10908000002906BF90F891100029F8BD90F85B20E8 +:1090900000230B21503004F011FD002818BFF8BD4B +:1090A000A86800230B2190F85C20503004F006FDE6 +:1090B000002818BFF8BDA86890F84C2090F80D1152 +:1090C000012A06D0022A07D0032A08BF042905D0A6 +:1090D00016E0012914D101E0022911D190F84D20A8 +:1090E00090F80E11012A06D0022A07D0032A08BFE1 +:1090F000042913D004E0012902D10FE002290DD088 +:1091000080F89140A86890F80B1100291CBFB0F8B6 +:109110000D11A0F84A1080F80A61F8BD002000F097 +:1091200030FAEFE7B548806890F87E1029B1B0F8C2 +:109130007A10B0F87C2091421AD290F8821029B1AE +:10914000B0F88010B0F87C20914211D2B0F87820AD +:10915000B0F876108A420BD290F85E20B0F8740016 +:1091600022B1884204D200BF02F0EABF0628FBD336 +:1091700000200146FAE42DE9F0410C4607461D4661 +:1091800016464FF498712046DDF8188006F0D8FE98 +:109190002780C4F82C81C4E93C65BDE8F081F5F76F +:1091A00001BE2DE9F0410D4607460621F5F7D1FC39 +:1091B000040008BFBDE8F081D4F82C012188002606 +:1091C00042888A4208D10078072810D00C281FD086 +:1091D0000B2835D0062850D094F8160100285ED010 +:1091E0006E700E20287084F816616F8042E06E70F9 +:1091F00007202870D4F82C014168C5F80210816856 +:10920000C5F8061080896881D4F82C01067031E019 +:109210000846F5F7F9FD0746F5F7BEFAB8B96E70DE +:109220000C202870D4F82C014068C5F80200D4F84E +:109230002C0106703846F5F7A9FA0120BDE8F08147 +:109240000846F5F7E1FD0746F5F7A6FA10B100204C +:10925000BDE8F0816E700B202870D4F82C014168B5 +:10926000C5F802100089E880D4F82C010670384651 +:10927000F5F78CFA0120BDE8F0816E7006202870A9 +:10928000D4F82C0141688268C068C5F80210C5F89E +:109290000620C5F80A00D4F82C010670EAE794F815 +:1092A0001801C8B16E701320287094F818010028B6 +:1092B000E0D000BF84F81861D4F81A01C5F80200A4 +:1092C000D4F81E01C5F80600B4F82201688194F8AC +:1092D00018010028EED1CDE794F8100188B16E7026 +:1092E0001720287094F810010028C3D084F810616A +:1092F000D4F81201C5F8020094F810010028F5D145 +:10930000B8E794F82401002808BFBDE8F0816E702A +:109310001420287094F824010028ABD084F824612C +:10932000D4F82601C5F80200B4F82A01E88094F8C0 +:1093300024010028F2D19DE7304A5061D170704776 +:109340002DE9F0470446481E85B238BFBDE8F087D6 +:109350000127DFF8A89004F108084FF0070A00265B +:10936000B4F8D000401CA4F8D000B4F87400401C3D +:10937000A4F8740094F8600040B994F85B200023CE +:10938000062104F1500004F099FBD8B1B4F86C0048 +:10939000401C80B2A4F86C00B4F86E1081422CBF5F +:1093A0000A1A0022A3885B1D934228BF84F87270BA +:1093B000884207D3A4F86C6084F8167199F803000A +:1093C000F0F79EFD94F87E0020B1B4F87A00401CBE +:1093D000A4F87A0094F8820020B1B4F88000401C10 +:1093E000A4F8800094F8E80088B994F85D2007E0BC +:1093F0006D8B0100C78D0100F38D0100F800002086 +:109400000023012104F1500004F058FB20B1B4F80E +:109410007800401CA4F8780094F85B0007281FD15E +:10942000B4F85000411CB4F8FA00814262D1D4F87B +:10943000F400411C404606F096FE0221204604F04E +:10944000FDF884F85B6084F88F70D4F8F40000783D +:10945000002808BFFFDFD4F8F4000178491E01702E +:1094600094F85B00082845D1B4F85000411CD4F8AA +:10947000F000808881423DD1D4F82C010178002988 +:1094800018BFFFDF22D12188C180D4F8F0004189C4 +:10949000D4F82C010181D4F8F0008189D4F82C0192 +:1094A0004181D4F8F000C189D4F82C018181D4F82D +:1094B0002C010671D4F82C0180F800A0D4F82C01FE +:1094C0002188418099F80300F0F71AFD0121204618 +:1094D00004F0B4F803212046FDF792F9D4F8F00027 +:1094E00041882088814218BFFFDFD4F8F000067061 +:1094F00084F85B60B4F85000401C691EA4F850006A +:109500008DB2BFF42DAFBDE8F087FE4AC2E9060177 +:10951000704770B50446B0F8740094F85E100029E6 +:1095200008BFC0F1020503D0B4F87610081A051F71 +:1095300094F8720040B194F85B200023092104F1F3 +:10954000500004F0BBFAA0B1B4F86C6094F860006D +:1095500058B994F85B200023062104F1500004F070 +:10956000ADFA002808BF284603D0B4F86E00801B6F +:10957000001F8542C8BF0546002DD4BF0020A8B2F9 +:1095800070BD10B5DF4CA1680A88A1F8282181F8C8 +:10959000260191F84C00012808BF012108D00228BB +:1095A00008BF022104D003281ABFFFDF00210321D6 +:1095B000A06880F82A1190F84D00012808BF012109 +:1095C00008D0022808BF022104D003281ABFFFDFF9 +:1095D00000210321A06880F82B11012180F82411BB +:1095E000E078BDE81040F0F78BBC2DE9F84F6846F5 +:1095F000FAF748FA002808BFBDE8F88FC14C607838 +:10960000002818BFBDE8F88FA0680023012190F85A +:109610005D20503004F052FA002818BFBDE8F88FE2 +:10962000A06890F8E810002918BF02204DD190F8EA +:109630005B2000231946503004F040FA40B1A06886 +:1096400090F8720020B11220FEF7EEFCBDE8F88F12 +:10965000A06890F85B200E2A21D00F2A08BF0B20AB +:1096600033D0152A08BF06202FD000251F2A30D05E +:1096700000230421503004F021FA002818BFBDE86F +:10968000F88FA068012690F85C1017297DD028DC9F +:10969000012952D005294BD00B295BD025E0F8F7E2 +:1096A000FBFC0C2838BFBDE8F88FA0680821D0F873 +:1096B000F0001E30F8F7F1FC28B1A0680421B830A2 +:1096C000F8F7EBFC00B9FFDF0320FEF7ADFCBDE8C7 +:1096D000F88F1820FEF7A8FCA068A0F87A50BDE823 +:1096E000F88F1B293DD01D297ED0D0F8F0201178AD +:1096F00000297AD051880288914276D190F85B2077 +:1097000000231946503004F0D9F900286DD0A16823 +:10971000D1F8F0000078022808BF002066D00328A6 +:1097200065D0042874D0052808BF08205ED0B4E0B6 +:109730000720FEF779FCA06866E00C20FEF774FCB9 +:10974000A068A0F8805090F8861041F0010180F8E0 +:10975000861059E01320FEF767FCA068A0F880503F +:1097600052E0C18EB0F83CC0B0F82CA0B0F82E800A +:10977000B0F83090478E614538BF8C46A0F82CC0B9 +:10978000838EB0F840108B4200E04AE028BF0B46C1 +:10979000C385028FB0F842108A4228BF0A4642862B +:1097A000B0F83AB0C18F8B4538BF59460186434562 +:1097B00038BF4346C385BA4238BF3A464286D4458D +:1097C00008BF434503D1494508BFBA4218D00288B3 +:1097D000A0F81A21828DA0F81C21028EA0F81E216B +:1097E00000F58871C28D03E013E056E02AE020E026 +:1097F000A0F82021408E48820E72E078F0F780FBBE +:109800001520FEF711FCA06880F85C50BDE8F88FC9 +:1098100030E01820FEF708FCA068A0F88050BDE8F2 +:10982000F88F1120FEF700FCA06880F85C50BDE8BE +:10983000F88F91F85F0040B191F86000002808BFF0 +:10984000FFDF0A20FEF7F0FB27E0F8F725FC0C28E5 +:1098500023D3A0680821D0F8F0001E30F8F71DFCD3 +:1098600028B1A0680421B830F8F717FC00B9FFDF71 +:109870000320E7E791F8860010F0030F0DD10C20CC +:10988000FEF7D2FBA068A0F87A5080F87E6090F8CE +:10989000861041F0010180F886106846FAF7F2F868 +:1098A000002808BFBDE8F88FA0680023194690F88B +:1098B0005B20503004F002F9002808BFBDE8F88FA3 +:1098C000A06890F8F810E9B3A1690978D1BBB0F8A5 +:1098D00050100A2937D900F108010522E06906F085 +:1098E0006AFA0028A06804BF80F8F850BDE8F88F35 +:1098F000D0F8F400017881B1411C0522E06906F03E +:109900005AFA01E0F8000020002818BFBDE8F88FDF +:10991000A068D0F8F400007830B9A068E169D0F808 +:10992000F400401C06F01FFCA068D0F8F400017899 +:10993000491C01700120FEF777FBA06880F8F85001 +:10994000BDE8F88FFFE790F8901039B190F85C000F +:109950001B2814BF1420BDE8F88FB6E690F89110CC +:10996000002908BFBDE8F88F90F85C2000230B2188 +:10997000503004F0A3F8002808BF16203FF4A5AE2D +:10998000BDE8F88F70B5044690F85B000025072805 +:1099900022D1B4F85000B4F8FA10401C884218BF25 +:1099A00070BDD4F8F400411C04F1080006F0DBFBA4 +:1099B0000221204603F042FE84F85B50012084F827 +:1099C0008F00D4F8F4000078002808BFFFDFD4F837 +:1099D000F4000178491E017094F85B00082818BF54 +:1099E00070BDB4F85000D4F8F010401C898888424B +:1099F00018BF70BDD4F82C010178002918BFFFDF13 +:109A000022D12188C180D4F8F000D4F82C114089EB +:109A10000881D4F8F000D4F82C1180894881D4F85A +:109A2000F000D4F82C11C0898881D4F82C0105717C +:109A3000D4F82C1107200870D4F82C112088488005 +:109A4000C348C078F0F75CFA0121204603F0F6FD28 +:109A500003212046FCF7D4FED4F8F000218840888A +:109A6000884218BFFFDFD4F8F000057084F85B501F +:109A700070BD10B5B64C207910F0020F08BF10BDB4 +:109A80006078002818BF10BDE068C078192880F001 +:109A90005C81DFE800F051410D80FCFC972231FC35 +:109AA0006174A2FCFCFCFCFBD22DE2FDF9FCF80089 +:109AB000A0680023012190F85D20503003F0FEFFE4 +:109AC000002818BF10BD0321A06880F85D10002198 +:109AD00080F87E1080F8821010BDA068002319461F +:109AE00090F85C20503003F0E9FF002808BF10BD5B +:109AF0000020A16800F026B9A0680023194690F85C +:109B00005B20503003F0DAFF002808BFFFDF092098 +:109B1000A16881F85B0010BDA0680023194690F889 +:109B20005B20503003F0CAFF002808BFFFDF07208A +:109B3000A16881F85B0010BDA0680023194690F869 +:109B40005B20503003F0BAFF002808BFFFDF082079 +:109B5000A16881F85B0010BDA0680023194690F849 +:109B60005B20503003F0AAFF002808BFFFDF01216F +:109B7000A06880F883100C2180F85B1010BDA068ED +:109B800090F85B000F2818BFFFDF0121A06880F864 +:109B900084100E21F0E7A0680023194690F85B209E +:109BA000503003F08BFF28B9A06890F8840000289B +:109BB00008BFFFDF0121A06880F88310102180F822 +:109BC0005B1010BDA06890F85B00152818BFFFDF80 +:109BD0001820A16881F85B0010BDA068D0F8F010D3 +:109BE00003884A889A4204BF0978042919D190F859 +:109BF0005B2000231946503003F060FF002808BFA7 +:109C0000FFDFA06890F8861011F0020F04BF012159 +:109C100080F85B1005D0002180F87E10D0F8F000AD +:109C20000170A0680023194690F85C20503003F0C2 +:109C300045FF00287FF45CAF10BDA06800231946E3 +:109C400090F85B20503003F039FF002808BFFFDF99 +:109C50000A20A16881F85B0010BDA06890F8900010 +:109C6000012818BFFFDFA0680023194690F85B2089 +:109C7000503003F023FF002808BFFFDF1A20A1683F +:109C800081F85B0010BD25E00EE001E04CE05CE0F7 +:109C9000A0680023194690F85C20503003F00EFFB6 +:109CA000002808BFFFDF23E7A06890F89100012893 +:109CB00018BFFFDFA0680023194690F85B205030E2 +:109CC00003F0FCFE002808BFFFDF1C20A16881F81C +:109CD0005B00D7E7A06890F85C101D2912D090F8BF +:109CE0005B101F2918BFFFDFCCD1B0F8FE10002990 +:109CF0001CBF202180F85B100DD0A168002081F8E6 +:109D00007E00BFE7B0F8FE10002918BF202180F8C0 +:109D10005C100021DEE6002180F85B1080F89110D5 +:109D20000846FFF72EFCE8E7A06890F85B001C28C7 +:109D300018BF072802D0082818BFFFDF0020A1683D +:109D400081F85C0081F882009CE7FFDF9AE7000061 +:109D5000F80000202DE9F041FC4C0646606904F053 +:109D6000FAFAE168002701F15B02012581F8C100E0 +:109D70004FF0050896420ED105FA00F010F0807FF2 +:109D800008BFFFDFE06880F85B80A0F87A7080F899 +:109D90007E50BDE8F08101F15C0086421CBFFFDF10 +:109DA000BDE8F08181F85C80A1F8807081F8825074 +:109DB000BDE8F0812DE9F043E44C83B0207910F048 +:109DC000010F04BF03B0BDE8F083606901230521E2 +:109DD000C578E06890F85C20503003F06FFE0028F2 +:109DE00018BF022D0BD00A2D18BF0B2D07D0032D45 +:109DF00018BF062D03D0607840F0080060706078CE +:109E000000281CBF03B0BDE8F0836069C078192842 +:109E100080F0BF83DFE800F04C260DC5FDFDFCFBA4 +:109E2000FAFDA1BDF9FDFDFDFDF8F7F6F5F4F3FD32 +:109E3000F200E0680123194690F85D20503003F0ED +:109E40003DFE002840F09A83606904F0DFFAE16883 +:109E500081F80801022081F85D00002081F882006D +:109E600000F07ABBE0680123002190F85C205030BC +:109E700003F024FE00287DD06078002840F07E8327 +:109E8000606904F0BEFAE168A1F81C01B1F8502045 +:109E9000801A00B247F6FE728242A8BF002853DD46 +:109EA00001F58F71606904F0A3FA0620E16840E0D3 +:109EB000E0680123002190F85C20503003F0FEFDA3 +:109EC000002857D06078002840F05883606904F07B +:109ED0006BFA90B3606904F064FAE168A1F81C01C0 +:109EE000B1F85020801A00B247F6FE728242A8BF35 +:109EF000002829DD606904F04EFAE16881F81E014E +:109F0000606904F043FAE168A1F82001606904F097 +:109F100028FAE168A1F82201606904F029FAE168F1 +:109F2000A1F82401606904F02AFAE168A1F8260189 +:109F3000082081F85C0000F021BBFFE7E0685C309E +:109F4000FFF708FF00F01ABB282081F86A00012003 +:109F500081F8690000F012BB0CE0E06801230021E9 +:109F600090F85C20503003F0A9FD18B1607820B162 +:109F700000F004BB012000F08DB9E0680021A0F8DA +:109F80008010012180F882100D2180F85C1000F013 +:109F9000F5BAE06890F85C100E2908BF0F2156D181 +:109FA0005CE0E0680123002190F85C20503003F071 +:109FB00085FD20B9E06890F884000028DAD0607848 +:109FC000002840F0DB82E06800210125A0F8801025 +:109FD00080F8825000F1E001606904F030FAE06836 +:109FE00000F1B801606904F035FAE06890F84C01BE +:109FF000002818BFFFDFE06801880BE0E6E1C1E15F +:10A000004BE103E1D2E0E9E052E22BE0A0E062E2C2 +:10A0100018E0BEE2A0F84E1100F5A871606904F0E6 +:10A02000FCF9E06800F5AC71606904F0FEF9E068E5 +:10A0300080F84C51112180F85C10E078EFF760FF58 +:10A0400000F09CBAE06890F85C10142902D002205D +:10A0500000F020B9002180F88210192180F85C10EE +:10A0600000F08CBAE0680123002190F85C205030A9 +:10A0700003F024FD50B9E0680123082190F85B202B +:10A08000503003F01BFD00283FF474AF60780028C7 +:10A0900040F07482E06890F8860010F0020F17D14B +:10A0A000606904F0F5F9E16881F88700606904F0FF +:10A0B000F1F9E168A1F88800606904F0EEF9E1685F +:10A0C000A1F88A0091F8860040F0020081F886002D +:10A0D000E06890F8861011F0010F15D190F85C201F +:10A0E00001230021503003F0E9FC002808BFFFDF06 +:10A0F0000121E068042280F85C1080F81B2180F8C0 +:10A1000082100021A0F88010E06890F85B1001290F +:10A1100007D1002180F85B1080F87E10E078EFF71F +:10A12000EFFEE06890F81A11042940F0278200251C +:10A1300080F81A51E078EFF7E3FEE06890F85B10E2 +:10A14000002908BF80F87E5000F018BA18010020DE +:10A15000E0680123002190F85C20503003F0AEFC51 +:10A1600000283FF407AF6078002840F00782694676 +:10A17000606904F0A2F9E0689DF8002090F88C1066 +:10A18000114001F02F0180F88C1090F88D109DF88F +:10A190000120114001F02F0180F88D100021A0F85E +:10A1A0008010012180F88210092157E7E06801231F +:10A1B000092190F85B20503003F080FC00283FF428 +:10A1C000D9AE6078002840F0D981E16881F872004A +:10A1D00081F87E0081F85B0000F0D0B9E0680123CF +:10A1E000002190F85C20503003F068FC00283FF418 +:10A1F000C1AE6078002840F0C181E0680021A0F87D +:10A200008010012180F882100B2127E7E0680123EC +:10A21000002190F85C20503003F050FC00287DD0E5 +:10A22000606904F067F9002804BFE0685C3000F062 +:10A230001D81606904F056F90646606904F054F91E +:10A240000546606904F052F90746606904F050F968 +:10A25000E1688F86CE8608874D8791F890000028A8 +:10A260001CBF91F85B001A280BD06846F9F730FC48 +:10A2700038B10098C078142803D0E168002081F834 +:10A280009000E0680021A0F88010012180F8821081 +:10A290001B21E3E6607000F071B9E06801230A2138 +:10A2A00090F85B20503003F009FCB8B3606904F00B +:10A2B00021F9A0B3606904F019F90746606904F058 +:10A2C00017F90546606904F00DF90646606904F067 +:10A2D0000BF9E168B1F82C80CB8DB1F830C04A8E13 +:10A2E0008F86CE860D874887B1F83C90B14598BFE0 +:10A2F0004E468E85B1F84090B94598BF4F46CF8500 +:10A30000B1F84290A94598BF4D464D86B1F83E90B0 +:10A31000814598BF484608869F4201E02EE024E030 +:10A3200038BF1F46CF85954238BF15464D864645F6 +:10A3300008BF9F4203D1604508BF954215D00A88E7 +:10A34000A1F860218A8DA1F862210A8EA1F864210A +:10A35000CA8D01F59C70A1F86621498E0186012104 +:10A3600080F82610E078EFF7CBFDE168002081F857 +:10A37000900081F87E0081F85B00FFE0607840F09B +:10A38000010087E7E0680123002190F85C2050304D +:10A3900003F094FB00283FF4EDADE06890F85B001B +:10A3A00020283FF4E7AD6078002861D1606904F0AF +:10A3B000CBF800F00701E06880F805110021A0F853 +:10A3C0008010012180F882101D2147E6E06890F896 +:10A3D0005C1090F85B201E2902D01C2A2ED036E695 +:10A3E0001C2A2BD01E2908BF00F15C05606904F00F +:10A3F000BBF858B36169E06803F0DAFC064610F078 +:10A40000FF0704BFC6F30720002832D0606904F0BC +:10A41000A9F8E168A1F81C01B1F85020801A00B237 +:10A4200047F6FE728242A8BF00282FDD81F81E7118 +:10A43000300A81F81F01202028702DE01D291CBF43 +:10A440001E2900F15B053FF402AECFE7E06890F80B +:10A450005B101C2909D1002180F89110302000F0F8 +:10A4600051FFE168182081F8C2002846FFF772FC0E +:10A4700084E000212970E06800F15B0295420BD175 +:10A4800080F89110002000F03DFF05E0282081F8C1 +:10A490006A00012081F86900E06800F15C018D42EA +:10A4A0004FF000010CBF80F8821080F87E1065E04C +:10A4B000606904F075F8162860D1E06890F85B10C8 +:10A4C0001C295BD1002180F85B1080F8911080F886 +:10A4D0007E10232050E0E0680921012390F85B20E2 +:10A4E000503003F0EBFA20B1606903F0DFFF12286F +:10A4F00013D0E0680A21012390F85B20503003F06C +:10A50000DDFA20B1606903F0D1FF14281DD0606925 +:10A5100003F0CCFF162831D121E0E06801252B465D +:10A5200090F85B200921503003F0C8FA002808BFDA +:10A53000657023D0607808BBE068002180F8721055 +:10A5400080F87E1080F85B1018E0E168002081F848 +:10A55000900081F85B0000BF81F87E000EE0E168AA +:10A5600091F85B001C2809D1002081F8910081F846 +:10A570005B0081F87E001A2000F0C4FEE068D0E99C +:10A5800028134A1C43F10001C0E9282103B0BDE8AB +:10A59000F083E0680123002190F85C20503003F044 +:10A5A0008DFA002801BF0120607003B0BDE8F08380 +:10A5B000607800283FF4C2AC03B0BDE8F08330B54A +:10A5C00085B004466846F9F75DFA002808BFFFDF4A +:10A5D000009803F000FE0321009803F013FE00989A +:10A5E000017821F010010170214603F088FEA01EC1 +:10A5F000162876D2DFE800F00BAA23ABAB1BAA47E4 +:10A60000AAAB3631AAAAAAAAABAB5D768E9CFE484D +:10A61000C06890F88E1021B10621009803F0F4FE76 +:10A6200095E090F80711009803F0EEFE8FE0F648F1 +:10A63000C06890F8C110009803F036FF87E0F24D33 +:10A64000E86800F1E801009803F008FFE86800F10D +:10A65000BC01009803F00CFF79E00621009803F09C +:10A660001FFF74E0E84DA8680178009803F006FF2A +:10A67000A8688188009803F003FFA86841880098C3 +:10A6800003F002FF63E0002002900390DE48C06800 +:10A6900090F88C1001F0F5018DF8081090F88D00FD +:10A6A00002A900F009008DF80900009803F03CFFB2 +:10A6B0004DE0D54DE868B0F84010009803F002FF77 +:10A6C000E868B0F84210009803F000FFE868818F56 +:10A6D000009803F0FFFEE868C18F009803F0FEFECB +:10A6E00035E033E0C84DE868818F009803F0F2FE52 +:10A6F000E868C18F009803F0F1FEE868B0F84010F8 +:10A70000009803F0DFFEE868B0F84210009803F00C +:10A71000DDFE1CE0BC4DE86890F83511009803F0B0 +:10A720000DFFE86890F83611009803F00BFF0EE07B +:10A73000B54DE86890F84A10009803F0FFFEE8680D +:10A7400090F84B10009803F0FDFE00E0FFDFF9F7F2 +:10A75000ACF9002808BFFFDF0C2C12BF072C05B096 +:10A7600030BD122C1CBF142C162C0DD0022C04BF93 +:10A7700005B030BD0021A448C068A0F880100121B8 +:10A7800080F8821005B030BD9F480021C068A0F855 +:10A790007A10012180F87E1005B030BD70B50C46EE +:10A7A00005464FF4C071204605F0CAFB2580002005 +:10A7B00084F8380184F8440184F84C0184F85A0183 +:10A7C00070BDF4F7EFBA2DE9F0410D4607460721B9 +:10A7D000F4F7BFF9040008BFBDE8F08194F8380130 +:10A7E0000026C8B16E700720287094F8380188B12F +:10A7F000268484F83861D4F83A01C5F80200D4F808 +:10A800003E01C5F80600B4F84201688194F83801A9 +:10A810000028EDD1AE7044E094F84401002837D010 +:10A8200094F844010B2818D00C2818BFFFDF38D14A +:10A830002088F4F7E9FA0746F3F7AEFFA0B96E7087 +:10A840000C20287094F84601A8702088A88084F80D +:10A8500044613846F3F79AFF23E02088F4F7D4FAEE +:10A860000746F3F799FF10B10020BDE8F0816E7044 +:10A870000B20287094F84601A8702088A88094F8CE +:10A880004A01A87184F844613846F3F77FFF08E075 +:10A8900094F8700140B16E700E20287084F87061D9 +:10A8A0006F800120BDE8F08194F84C0180B16E709A +:10A8B0000820287020886880D4F85001D4F85411FA +:10A8C0006860A960B4F85801A88184F84C61E8E791 +:10A8D00094F85A0140B16E7016202870B4F85C01EB +:10A8E000688084F85A61DCE794F86A0188B16E7078 +:10A8F0001720287094F86A010028D2D084F86A6181 +:10A90000D4F86C01C5F8020094F86A010028F5D16A +:10A91000C7E794F85E01C8B16E701320287094F8F0 +:10A920005E010028BDD000BF84F85E61D4F86001EC +:10A93000C5F80200D4F86401C5F80600B4F868014F +:10A94000688194F85E010028EED1AAE794F87201BC +:10A95000002808BFBDE8F0816E701420287094F8BC +:10A96000720100289DD000BF84F87261D4F8740190 +:10A97000C5F80200B4F87801E88094F87201002864 +:10A98000F2D18EE7204A9060D170704710B5002157 +:10A9900080F85B1080F85C1080F85E1090F8D600AC +:10A9A000002814BF02200320FDF7B3F81648C07832 +:10A9B000BDE81040EFF7A4BA2DE9F047124C8046ED +:10A9C0000D46E0680088F4F731FA060008BFFFDFA3 +:10A9D00060782843607020794FF0000510F0200F58 +:10A9E000E0681CBFA0F8745080F8DC5004D1B0F8C7 +:10A9F0007410491CA0F87410E068012790F86010EA +:10AA000051B990F85C2001E01801002001230621D3 +:10AA1000503003F053F848B3A08810F4006F07D00B +:10AA2000E06890F86010002918BFA0F86C501DD1A4 +:10AA3000E168B1F86C00401C80B2A1F86C00B1F87C +:10AA40006E3083422CBF1A1A0022B4F806C00CF1F3 +:10AA5000050C624598BF81F87270984206D3A1F840 +:10AA60006C5081F87071E078EFF74AFA20794FF076 +:10AA7000020910F0600F11D0E06890F85E1011B17B +:10AA8000032906D00AE080F85E700120FDF741F846 +:10AA900004E080F85E900120FDF73BF8E06890F854 +:10AAA0005E10012905D1A18811F4807F18BF80F8BC +:10AAB0005E90B8F1000F7DD1A18811F4007F18BF1E +:10AAC000A0F8F05004D1B0F8F010491CA0F8F01034 +:10AAD00000F04CFC00F005FE01F0B0FB0028E0683F +:10AAE00018BFA0F8D05004D1B0F8D010491CA0F87D +:10AAF000D01001F0A6FB40B1E06890F8DC1002290C +:10AB00009CBF491C80F8DC1004D8E06890F8DC0099 +:10AB1000022806D9E068A0F8D050A0F8D25080F8FA +:10AB2000DC50E0680123002190F85C20503002F0F6 +:10AB3000C5FF20B9E06890F85C00072859D1E068AB +:10AB40000123002190F85B20503002F0B7FF00286D +:10AB50004FD0E0680123002190F85D20503002F0D2 +:10AB6000ADFF002845D0E06890F85E10022904BFD0 +:10AB700090F8DC0000283CD13046F3F793FBB8B3E3 +:10AB8000F8F7C7FFA0B3E068B0F8CA10012930D9C0 +:10AB900080F8D570B0F87620B0F87410931E994202 +:10ABA000AFBF0121511A491E89B2B0F8D020E38805 +:10ABB0009A4200E034E02FBF01229A1A521C92B24E +:10ABC000914288BF1146012908BF80F8D55090F8FE +:10ABD000002192B1B0F8D220B0F8020182422FBF1A +:10ABE0000120801A401C80B2814288BF014604E0E7 +:10ABF000FFE7E068012180F8D550D4F80CC0BCF81C +:10AC00005020501880B2ACF8CC009CF85E1000299F +:10AC100018BF01290ED002291CBF0329FFDF0CD069 +:10AC2000A088C0F340200028E06818BFA0F8DE50DC +:10AC30005FD157E0ACF8C800F2E79CF85D1003293B +:10AC400022D0BCF87400BCF876100026821C914219 +:10AC500006D3081A801E0604360C1CBF701E86B26E +:10AC60009CF8720058B19CF85B20012309210CF17B +:10AC7000500002F023FF002808BF00262BD0E06818 +:10AC800090F8601099B90AE0BCF874100329D1D388 +:10AC9000BCF876001044401CACF8C800C0E790F83F +:10ACA0005C2001230621503002F008FF78B1E168F2 +:10ACB0000020B1F86E20B1F86C108B1C9A4203D3BF +:10ACC000501A801E18BF401EB04238BF86B2002EF8 +:10ACD0001CBF701E86B2E068B0F8CC103144A0F8FA +:10ACE000C8109DE7B0F8DE10B0F8CE201144A0F8EF +:10ACF000DE10E06890F8061139B990F85D20012364 +:10AD00001946503002F0DAFE38B1E068B0F8781039 +:10AD1000B0F8CE201144A0F87810E06890F87EC01A +:10AD2000BCF1000F06D0B0F87A10B0F8CE20114474 +:10AD3000A0F87A1090F8823033B1B0F88010B0F8F3 +:10AD4000CE201144A0F880103D22B8F1000F02D0AF +:10AD500080F86A2010E02178022910D0012908BF6C +:10AD600090F8081106D06178F1B111F0140F18BFF6 +:10AD70001E210BD080F86A1080F869704DE090F8C1 +:10AD80008E10002914BF06211621F3E711F0080FD9 +:10AD9000DED111F0030F08BFFFDF2A21E06880F841 +:10ADA0006A1080F8697038E0BCF1000F05D0B0F887 +:10ADB0007A10B0F87C2091420FD22BB1B0F88010FD +:10ADC000B0F87C20914208D2B0F87820B0F8761024 +:10ADD0008A4208D390F806212AB1222180F86A100D +:10ADE00080F8697019E090F85E204AB1B0F87420DC +:10ADF0008A420FD3082180F86A1080F869700CE04D +:10AE0000B0F87410062905D33E2180F86A1080F846 +:10AE1000697002E090F8690090B1E06880F85B50DA +:10AE200080F85C5080F85E5090F8D600002814BF7F +:10AE300002200320FCF76DFEE078EFF761F802E0F6 +:10AE40000020FCF766FEE06880F8D650BDE8F08789 +:10AE5000FB494A788B781A430DD150B1087910F02C +:10AE6000080F04D0C86890F85D00032803D00120C3 +:10AE70007047FCF7BABD002070472DE9F041F04C57 +:10AE800005460E46A0882843A08015F0020F04D086 +:10AE900015F0010F18BFFFDF266115F0010F4FF00D +:10AEA00000084FF001071CD03046666103F053FAEA +:10AEB000062802D00B280BD013E0E06890F85C1055 +:10AEC00014290ED10021C0E9261180F85F7008E036 +:10AED000E06890F85C100E2904BF80F85F8080F86D +:10AEE000847015F0020F18D02069C078052802D0B0 +:10AEF0000B280BD011E0E06890F85C1012290CD1FF +:10AF00000021C0E9281180F8607006E0E06890F840 +:10AF10005C100D2908BF80F8608015F0800F1CBF01 +:10AF20000820A070BDE8F0812DE9F047C44C82B044 +:10AF30000126216900250191A5806570A570257005 +:10AF4000E06066F30709804680F8D6600088F3F772 +:10AF50006DFF5FEA000A08BFFFDFE0680088F8F7CE +:10AF60008EFDE0680088F8F7B0FDE068B0F8CA0030 +:10AF7000D0B101A8F8F786FDB0B1E06890F80611ED +:10AF800091B190F85D2001231946503002F096FDF2 +:10AF900050B9E068A0F8785080F88E500220FFF792 +:10AFA0000EFBE06880F8D550D4F80CC09CF838014E +:10AFB00038B9BCF82000BCF80410884288BFE08093 +:10AFC00002D8BCF80400E080BCF8CE00401E87B276 +:10AFD000BCF8D0003844ACF8D0009CF8D40000286D +:10AFE0001CBFACF8D2508CF8D45004D1BCF8D200BD +:10AFF0003844ACF8D200BCF874003844ACF87400A3 +:10B000009CF8600040B99CF85C20012306210CF1FB +:10B01000500002F053FD28B1E068B0F86C103944DC +:10B02000A0F86C10E068B0F8CA1001299CBF491C58 +:10B03000A0F8CA10002F18BF80F8DC5090F8D51087 +:10B04000A1B1B0F8D000E18888420FD25046F3F7A2 +:10B0500029F958B1E06890F8001139B1B0F8D21070 +:10B06000B0F80201814228BF01F0EEF8E26882F8F0 +:10B07000D55092F85C00062818BF072819D1B2F8FD +:10B080005010B2F81C31C91A09B2002911DB02F5BF +:10B090008F7102F1080005F066F80221E06802F005 +:10B0A000C5F9E06880F81B5180F85C5080F88F602B +:10B0B00048E0202820D1B2F85000B2F81C11401A04 +:10B0C00000B2002818DB92F81E01002808BF92F891 +:10B0D0004C0082F84C0092F81F01002808BF92F83B +:10B0E0004D0082F84D00002000F00CF9E06880F877 +:10B0F0001B5180F85C5025E092F85B00202821D19C +:10B10000B2F85000B2F81C11401A00B2002819DB46 +:10B1100092F81E01002808BF92F84C0082F84C00FB +:10B1200092F81F01002808BF92F84D0082F84D00E8 +:10B13000002000F0E7F8E06880F8915080F81B519B +:10B1400080F85B50E16801F15000B1F8CE2002F0C8 +:10B1500062FBE06890F80011002918BFA0F8D250F7 +:10B1600038480090384B394A4146484600F030FF95 +:10B17000E0680123052190F85C20503002F09EFC2D +:10B18000002818BF00F055FCE06890F82811F1B1D4 +:10B1900090F82911002904BF90F89010002916D1C9 +:10B1A00090F85C101B2912D0B0F82A118187B0F8F2 +:10B1B0002C11C187B0F82E1129B1A0F84010B0F8B9 +:10B1C0003011A0F8421080F8906080F8285190F873 +:10B1D0003211002904BF02B0BDE8F08790F83411A5 +:10B1E000002907BF90F89110002902B0BDE8F08750 +:10B1F00090F85B2001230B21503002F05FFC002807 +:10B200001CBF02B0BDE8F087E06801230B2190F875 +:10B210005C20503002F052FC00281CBF02B0BDE898 +:10B22000F087E06890F84C2090F83511012A0FD093 +:10B23000022A10D0032A08BF04290ED01FE0000004 +:10B2400018010020B9A9010051AE01007BAE010038 +:10B25000012914D101E0022911D190F84D2090F874 +:10B260003611012A06D0022A07D0032A08BF042972 +:10B2700015D004E0012902D111E002290FD080F895 +:10B280009160E06890F8331100291CBFB0F83511C7 +:10B29000A0F84A1080F8325102B0BDE8F0870020D3 +:10B2A00000F030F8EDE700F04BBF10B50446B0F801 +:10B2B00022214388B0F82411B0F826019A4201BF38 +:10B2C000A3889942E38898420FD02388A4F83C31A0 +:10B2D000A4F83E21A4F84011A4F84201012084F80A +:10B2E0003801FC48C078EEF70BFE0121204602F041 +:10B2F0009DF8002084F81B0184F85C00032084F88A +:10B300005E0010BD10B5F34CE1680A88A1F8762103 +:10B3100081F8740191F84C00012808BF012108D080 +:10B32000022808BF022104D003281ABFFFDF002132 +:10B330000321E06880F8781190F84D00012808BFDB +:10B34000012108D0022808BF022104D003281ABF17 +:10B35000FFDF00210321E06880F87911012180F8E6 +:10B360007211E078BDE81040EEF7CABD2DE9F0415A +:10B37000D84C4FF002084FF00005207910F0080F6C +:10B3800014D0607890B9E06890F85C10162905D167 +:10B3900080F8835080F8825080F85C5090F85D10FF +:10B3A000032904BF84F8008080F85D50FEF702FD99 +:10B3B000A1884FF0010611F0040F4FF0070719D0D4 +:10B3C0006078B8B9E06890F85C20062A08BF80F879 +:10B3D0001B6108D0082A08BF80F81B8103D0202AEF +:10B3E00008BF80F81B7190F85D20022A04BF267008 +:10B3F00080F85D5011F0020F00F04981607800285C +:10B4000040F045812069C078801E162880F03E817A +:10B41000DFE800F00BF9646F851EF948F955B97A39 +:10B42000F9F9F9F9E4F8FDF6F5F4E06801231946B5 +:10B4300090F85D20503002F041FB002840F0278159 +:10B44000E068032180F85D1080F87E5000F0DCB8E1 +:10B45000206903F02BF80646E06890F85C10052997 +:10B4600005D090F85B00052818BFFFDF04D0E06826 +:10B4700090F85B0005280AD1E06890F8C210B1424C +:10B4800004BF80F85B5080F87E5000F00081E068D7 +:10B4900090F85C1005290CBF80F85C50FFDF40F08D +:10B4A000F680B1E0E06890F85C00092818BFFFDF83 +:10B4B000E06880F8825080F85C5000F0E8B8E068FE +:10B4C00090F85C000D2818BFFFDFE0685FF00E0108 +:10B4D00080F8836080F85C1000F0D9B8E06890F8DC +:10B4E0005C00112818BFFFDFE068122180F883603C +:10B4F000F0E7E06890F85C00122818BFFFDF142026 +:10B50000E16881F85C00C2E0E06890F85C00122815 +:10B5100018BFFFDF1620E16881F85C00B7E0E06843 +:10B5200090F85C00192818BFFFDFE06880F88350AE +:10B5300080F8825090F84401002818BFFFDFE068CF +:10B5400090F8841041B180F884500188A0F8481127 +:10B5500080F846510C2107E00188A0F8481180F8D6 +:10B56000465180F84A610B2180F844110088F3F7B6 +:10B570004BFCF3F7FBF8E078EEF7C2FCD4F80C00D4 +:10B5800080F85C5083E0E06890F81A1104290ED02E +:10B59000E0680123082190F85C20503002F08EFA18 +:10B5A00000281CBFE06880F8825070D0E8E790F86F +:10B5B0005B2001230021503002F080FA002808BFF0 +:10B5C000FFDFE06890F8861011F0020F0EBF80F8E0 +:10B5D0005B6080F87E5080F81A51D9E7E06801235B +:10B5E000002190F85B20503002F068FA002808BF74 +:10B5F000FFDF0A20E16881F85B0048E03BE024E0DF +:10B600001BE004E01FE041E080F882503FE0E0688A +:10B6100090F89000012818BFFFDFE06801230021A7 +:10B6200090F85B20503002F049FA002808BFFFDF95 +:10B630001A20E16881F85B0029E0E06890F85C007E +:10B64000002818BFFFDFE068DEE7E06890F89100AF +:10B65000012818BFFFDFE0680123002190F85B207C +:10B66000503002F02BFA002808BFFFDF1C20E168F1 +:10B6700081F85B000BE0E06890F85C001D2818BFC3 +:10B68000FFDF1E20E16881F85C0000E0FFDF207929 +:10B6900010F0100F08D0607830B9E06890F85C10B6 +:10B6A000062908BF80F85C70A07810F0080F08BF6A +:10B6B000BDE8F081E0680123052190F85C2050305E +:10B6C00002F0FCF940B108206070E06880F8445155 +:10B6D000BDE8F08118010020BDE8F041002000F035 +:10B6E000B7BD2DE9F84F6846F8F7CCF9002808BF38 +:10B6F000BDE8F88FC94C6078002818BFBDE8F88F06 +:10B70000E0680123194690F85D20503002F0D6F928 +:10B71000002818BFBDE8F88FE068002590F80611F2 +:10B7200029B1A0F8785080F88E50022085E090F87A +:10B730005B2001230021503002F0C0F988B1E0689D +:10B740000123042190F85C20503002F0B7F940B991 +:10B75000E06890F8720020B11220FEF730FFBDE8DB +:10B76000F88FE06890F85B1005290FD090F85C2006 +:10B770000126112A4DD018DC092A08BF09205CD007 +:10B780000CDC012A74D0052A3BD018E00720FEF714 +:10B7900016FFE068A0F87A50BDE8F88F0B2A68D051 +:10B7A0000D2A08BF0B2048D009E0122A49D0192AD7 +:10B7B00079D01B2A76D01D2A08BF17203DD001233F +:10B7C0000421503002F07AF9002818BFBDE8F88F44 +:10B7D000E06890F81A1100297BD090F85B200123D3 +:10B7E0000021503002F06AF9002872D0E06890F829 +:10B7F0001A11042904BF90F8860010F0030F69D0D5 +:10B80000D0E00720FEF7DBFEE068A0F88050BDE83E +:10B81000F88FF6F741FC0C2838BFBDE8F88F0821F7 +:10B82000E068E830F6F739FC28B1E0680421BC3064 +:10B83000F6F733FC00B9FFDF0420FEF7C0FEBDE8D9 +:10B84000F88F90F80911012914D0022918BFBDE81A +:10B85000F88F90F8841000291ABF80F88E600220BB +:10B860000D20FEF7ACFEE06880F80951BDE8F88FC6 +:10B8700021E030E090F84411002918BFBDE8F88FAE +:10B8800000F1A80300F1E001002200F5857002F04C +:10B89000AAF80520FEF793FEE06880F80951BDE89C +:10B8A000F88F00E01EE00620FEF789FEE06880F8D1 +:10B8B0008250BDE8F88F0C20FEF781FEE068A0F80A +:10B8C000805090F8861041F0010180F88610BDE8A4 +:10B8D000F88F67E058E01320FEF771FEE068A0F8EB +:10B8E00080504DE0C18E838FB0F82CA0B0F82E8030 +:10B8F000B0F83090478E994238BF0B468385828ED0 +:10B90000B0F840108A4228BF0A46C285B0F838C055 +:10B91000B0F842108C4538BF61464186B0F83AC055 +:10B92000B0F83EB0DC4528BFDC46A0F830C0424548 +:10B9300038BF4246C285B94238BF39464186534571 +:10B9400008BF424503D1CC4508BFB94214D0028894 +:10B95000A0F86021828DA0F86221028EA0F86421F7 +:10B96000C28D00F59C71A0F86621408E088681F892 +:10B970002660E078EEF7C4FA1520FEF720FEE068B6 +:10B9800080F85C50BDE8F88F0C20FEF718FEE068E8 +:10B99000A0F87A5080F87E6090F8861041F001019E +:10B9A00080F886106846F8F76DF8002808BFBDE8F3 +:10B9B000F88FE0680123002190F85B20503002F0FE +:10B9C0007DF850B1E06890F8901000291FBF90F802 +:10B9D0005C001B281420FEF7F2FDE0680123002123 +:10B9E00090F85B20503002F069F8002808BFBDE8ED +:10B9F000F88FE06890F89110002908BFBDE8F88F33 +:10BA000090F85C2001230B21503002F057F80028F9 +:10BA100008BF16203FF411AFBDE8F88F18010020D1 +:10BA200030B5F94C05462078002818BFFFDFA57215 +:10BA300030BDF54901204872704770B4F3480121C8 +:10BA4000426890F800C0406892F85B60154690F834 +:10BA50004C0002F15003202E1CBF1C7B202C22D056 +:10BA600003231C2E40D01E2C1CBF70BC704700BF8F +:10BA7000BCF1000F04BF70BC704795F84AC092F843 +:10BA800005210CEA020212F0040F14BF194612F04D +:10BA9000010F4CD0032818BF032954D0012818BF28 +:10BAA000012953D04CE0BCF1000F0ED092F81E11CA +:10BAB000002904BF70BC7047032818BF032942D077 +:10BAC000012818BF012941D03AE092F8FC10002962 +:10BAD00004BF70BC7047032818BF032933D0012866 +:10BAE00018BF012932D02BE01E2CC1D0BCF1000FB1 +:10BAF00004BF70BC704792F8352112F0040F14BFD8 +:10BB0000194612F0010F08D0032818BF03291AD0D4 +:10BB1000012818BF012919D012E012F0020F04BF4A +:10BB200070BC704703280ED001280FD008E012F037 +:10BB3000020F04BF70BC7047032804D0012805D051 +:10BB400070BC0220704770BC0320704770BC01209D +:10BB500070472DE9F047AD4F4FF0000839464FF0E0 +:10BB6000010A4E6896F84D10708E04F007FB96F8A7 +:10BB70004D1080B26FF00E096FF00D04032976D0DE +:10BB800002290EBF09EB900004EBD00080B279D0FF +:10BB9000F58DA8420FD8708E04F0F0FA96F84D108B +:10BBA00080B2032972D002290EBF09EB900004EB8A +:10BBB000D00085B275D0944C2946606BF2F7AEFB8D +:10BBC000DFF84C92E062002819BF84F80280A0627E +:10BBD00084F802A0C4F828903878786800F15008FA +:10BBE000012000F038FE98F8100000285BD008F122 +:10BBF0005801874891E80E1000F5027A8AE80E1085 +:10BC0000D8F86810C0F82112D8F86C10C0F82512C6 +:10BC100000F58170F7F7DBFA387800280CBF0120B7 +:10BC2000002080F001017B480176D8E91412C0E9B8 +:10BC30000412C4F828904946A581A0F58372F6F74E +:10BC400008FF96F84D00012808BF002208D00228FE +:10BC500008BF012204D003281ABFFFDF00220222FE +:10BC6000217B0120F6F703FF22E000E00AE0B0F5B7 +:10BC7000747F38BF40468BD35038C21700EB9260B8 +:10BC800004EBA01080B283E700E00AE0B0F5747F17 +:10BC900038BF45468FD35038C11700EB916004EB95 +:10BCA000A01085B287E7A06AF7F791FAF6F704FFCC +:10BCB00001210020F7F71EFC02202070BDE8F0876C +:10BCC0002DE9F04FDFF8448183B04146A1F1140023 +:10BCD0004E6800904FF0000996F85500012706F1D4 +:10BCE0005004A1F1380570B301286ED002286DD040 +:10BCF000032818BFFFDF6AD0686A0823017821F0A3 +:10BD000008010170A27903EAC202114321F0040183 +:10BD10000170E279042303EA8202114321F0100149 +:10BD2000017094F805A0286BF2F7CAFA8146F7F77C +:10BD3000F0FEBAF1020F6FD0BAF1010F6ED0BAF176 +:10BD4000030F6CD0B4E0FFE7FFF777FE0146304603 +:10BD500001F01AFA1FFA80FBFFF76FFE6FF00D0A71 +:10BD6000032835D0022807BF6FF00E0000EB9B00C0 +:10BD70000AEBDB0081B237D0B08D814215D8FFF7D6 +:10BD80005CFE0146304601F0FFF91FFA80FBFFF729 +:10BD900054FE03282AD0022807BF6FF00E0000EBE4 +:10BDA0009B000AEBDB0080B22CD0ADF80800A6F8AF +:10BDB00048000098F7F78CFE78B3696AEF70AA69BB +:10BDC0004FF48060904703204AE04BE04EE05BE098 +:10BDD000BBF5747F38BF4946CED3ABF15001C817CD +:10BDE00001EB90600AEBA01081B2C5E7BBF5747F50 +:10BDF00038BF4846D9D3ABF15000C11700EB916072 +:10BE00000AEBA01080B2D0E73001002068010020CA +:10BE1000280E0020301000203DE001E03FE042E02D +:10BE200001AA02A9286BF2F72EF9686210B194F802 +:10BE3000331021B10098F7F71FFE67715CE79DF89A +:10BE4000041031B9A0F8009080F80290012102F0AE +:10BE5000D9F9BDF80800C1B2686A02F0A5FB02205A +:10BE6000607149E70098F7F707FE45E7B6F8480024 +:10BE7000ADF8000001AA6946286BF2F704F9686280 +:10BE8000002808BFFFDF37E70098F7F721FE0028FA +:10BE900008BFFFDF30E730EA090009D106E030EAE9 +:10BEA000090005D102E0B9F1000F01D0012000E046 +:10BEB00000206A6A117841EA00101070E07B0028C7 +:10BEC0001CBF6079012839D004F15800DFF80CC498 +:10BED0000FC80CF5027989E80F00A06ECCF821029A +:10BEE000E06ECCF825020CF58170F7F770F998F840 +:10BEF000000000280CBF01200020F9490876D4E991 +:10BF00001202C1E90402A1F5837101F583706A6A26 +:10BF1000F6F79FFD96F84C00012808BF002208D0D4 +:10BF2000022808BF012204D003281ABFFFDF002225 +:10BF30000222FB210020F6F79AFD04E01046F7F7F5 +:10BF400046F9F6F7B9FD98F8000028B1686A00785C +:10BF500010F0100F05D00CE001210846F7F7CAFADF +:10BF60000AE0E048007810F0100F04BF687900285C +:10BF700002D0E8780028EFD0A87900BBAF7196F81E +:10BF80004D00012808BF002408D0022808BF012462 +:10BF900004D003281ABFFFDF0024032496F84C00C6 +:10BFA000012808BF002007D0022808BF012003D0C5 +:10BFB00003281CBFFFDF00202146F7F770F9686AED +:10BFC000018829828078A8742F7003B0BDE8F08FB3 +:10BFD0002DE9F047C44D8146DDF8208028781E46C3 +:10BFE00017460C4628B9002F1CBF002EB8F1000FD1 +:10BFF00000D1FFDFC5F82080C5E90E94C5E90676BB +:10C0000000206872287268712871A871E871B74EB3 +:10C01000E870E881307804F150072088F2F706FFD5 +:10C0200028632088F2F7F0FE6863F7F7C5F8F6F7A3 +:10C030005AFEF7F792F904F11100F7F7A6F804F1A8 +:10C040000D00F6F7CDFE307800280CBF032001204C +:10C05000F7F7AFF8387EF6F7CBFEF7F7A4F894F8C9 +:10C060004D00012808BF002007D0022808BF01208A +:10C0700003D003281CBFFFDF0020F7F77EFC3078D9 +:10C08000A8B194F84D10608E04F078F882B294F85C +:10C090004D30E18D387C00F0A7FB054694F84D004B +:10C0A00001283ED002283ED003283ED017E0FFF7FB +:10C0B000C4FC0546FFF7C1FC0146204601F064F8C8 +:10C0C00082B2A18DF87B2B4600F08EFB054694F8DA +:10C0D0004C00012825D0022825D0032825D0FFDFD9 +:10C0E00000242046F6F7EAFD21462846F6F7C1FD72 +:10C0F00030784FF00002002811464FF0960016D01D +:10C10000F7F748F901210846F6F7E6FE7068D0F81F +:10C11000D800F7F75FF8FFF71CFDBDE8F047F7F729 +:10C1200053B80024DDE70124DBE70324D9E7F7F760 +:10C1300047F901210020F6F7CFFEFFF7C1FDECE73C +:10C1400070B56A48684D05F1380100784C680028E0 +:10C1500041D094F84C00012808BF002608D00228DE +:10C1600008BF012604D003281ABFFFDF00260326DC +:10C1700094F84D00012808BF002108D0022808BF0C +:10C18000012104D003281ABFFFDF0021032132461A +:10C190009620F7F7FFF82878022818BFFFDF94F8F9 +:10C1A0004C5000BFF7F708F894F82800012808BFA2 +:10C1B000F7F77DF9012D08BF002008D0022D08BF38 +:10C1C000012004D0032D1ABFFFDF00200320BDE8AB +:10C1D0007040F6F773BD94F84D00012808BF0026A3 +:10C1E00008D0022808BF012604D003281ABFFFDFA9 +:10C1F0000026032694F84C00012808BF002108D02F +:10C20000022808BF012104D003281ABFFFDF002144 +:10C21000032132469620F7F7D3F82878012818BF73 +:10C22000FFDF94F84D50BDE72F4810B50078022885 +:10C2300018BFFFDFBDE8104000F050BB2A488079EE +:10C24000704729484079704727490120C8717047D5 +:10C250002DE9F04706002548234D4FF001074068BF +:10C260004FF0000800F15004A86A90F8019018BF40 +:10C27000012E03D1696B03F09FFA68706878A0B152 +:10C2800001283BD0022853D003281CBFFFDFBDE8A4 +:10C29000F087012E08BFBDE8F087686BF2F74FFA10 +:10C2A000A87ABDE8F047EDF72BBE012E08D0012299 +:10C2B0004946686BF2F790F8022E08BFBDE8F08798 +:10C2C000D4E91402411C42F10000C4E91410E079E1 +:10C2D00001280DD184F807800BE00000280E002013 +:10C2E00030100020430100203001002068010020B0 +:10C2F000E771A87ABDE8F047EDF702BE012E08D03D +:10C3000000224946686BF2F767F8022E08BFBDE8C5 +:10C31000F087D4E91401401C41F10001C4E9140183 +:10C32000E07901280CBF84F80780E771BDE8F08749 +:10C33000012E06D0686BF2F702FA022E08BFBDE8A4 +:10C34000F087D4E91401401C41F10001C4E9140153 +:10C35000E0790128CCD1BDE72DE9F041F84F4FF04D +:10C3600000083846A7F138044068012600F150055E +:10C370002078012818BFFFDFA87850B185F8028027 +:10C38000E670A2694146042090473878002818BF1B +:10C390002E71606A0321007831EA000004BFE8785A +:10C3A000002805D1EE70616AE670A269022090470C +:10C3B0000121002000F0B5FA002808BF7C6803D0F6 +:10C3C000BDE8F04100F08ABAFFF7C3FB94F84C00D7 +:10C3D000012808BF002007D0022808BF012003D091 +:10C3E00003281CBFFFDF0020F6F768FC94F84C0020 +:10C3F000012808BF002508D0022808BF012504D065 +:10C4000003281ABFFFDF0025032594F84D000128FB +:10C4100008BF002108D0022808BF012104D003284A +:10C420001ABFFFDF002103212A46BDE8F041962014 +:10C43000F6F7B0BF2DE9F84FC14E83463046A6F15E +:10C4400038054068317800F1500A002728784FF00D +:10C450000108B946022818BFFFDFE88940F40070E0 +:10C46000E881002000F0F7F99AF81000BBF1000F06 +:10C4700000F0ED80F6F746FBF6F734FB90B99AF83A +:10C48000100078B1A86A417861B100789AF8071075 +:10C49000C0F3C000884205D185F80480BDE8F84F9C +:10C4A00000F01CBAA86A0188A5F813108078687596 +:10C4B000E88940F02000E8816F7130787068503072 +:10C4C0000090746894F82800012818D1F6F7E5FF69 +:10C4D0002046009901F0C7FA88B1307800287068CA +:10C4E0000CBF00F5887000F5B57021884180009977 +:10C4F000097A017180F80080A87AEDF701FDA86A39 +:10C500009AF806100078C0F38000884233D0307863 +:10C51000706800F1500490F8550040B3022844D0F0 +:10C520006771307840B12079394628B1217185F89A +:10C530000380AA6910209047E07890B1E770F7F780 +:10C54000D6FA002808BFFFDF082085F80380AA6913 +:10C5500000219047D4E91202411C42F10000C4E9D5 +:10C560001210A07901280CBFA77184F80680E88911 +:10C5700040F48070E881A86A9AF807300178C1F326 +:10C58000C0029A4250D13278726801F0030102F180 +:10C590005004012918BF022933D003291CBF287A6F +:10C5A00040F0040012D028723EE0286BF1F7A5FDA0 +:10C5B000002808BFFFDFD4E91210491C40F1000039 +:10C5C000C4E91210A87AEDF79BFCA9E701F03BFE45 +:10C5D00098B184F80280E989404641F40061E9811C +:10C5E000A96A85F80380AA699047E079012801D1FA +:10C5F000E77119E084F8078016E0287A40F010000F +:10C60000D1E74078F8B1E98941F40061E981A9787E +:10C6100051B9FB28F1D8687A002808BFC14603D079 +:10C620008020AA69002190475946012000F079F93D +:10C6300060B39AF81000002818BFBBF1000F1BD0A0 +:10C64000A87868B118E0E0790128D3D1D0E70028B4 +:10C6500018BF03F08DFDE88940F04000E881E3E772 +:10C66000A96AAA894878904288BF1046C21CE86A25 +:10C6700003F0CDFBE86AA862B9F1000F1CBF0020EF +:10C68000FFF7E6FDBDE8F84F00F028B93078746890 +:10C69000B9F1000F1CBF0120FFF7DAFDFFF710FB17 +:10C6A0009AF81000002818BFBBF1000F0DD0A87831 +:10C6B00058B9A96AAA894878904288BF1046C21C16 +:10C6C000E86A03F0A4FBE86AA862B9F1000F1CBF96 +:10C6D0000220FFF7BDFD94F84D00012808BF00209F +:10C6E00007D0022808BF012003D003281CBFFFDFAA +:10C6F0000020F6F7E3FA94F84D00012808BF002562 +:10C7000008D0022808BF012504D003281ABFFFDF84 +:10C710000025032594F84C00012808BF002108D00B +:10C72000022808BF012104D003281ABFFFDF00211F +:10C7300003212A46BDE8F84F9620F6F741BE0000D7 +:10C74000680100202DE9F0410D46964906469548BE +:10C750004C68007894F84D20002822D0012A08BFA8 +:10C76000002708D0022A08BF012704D0032A1ABFD5 +:10C77000FFDF0027032794F84C00012808BF0022A0 +:10C7800008D0022808BF012204D003281ABFFFDF07 +:10C79000002203223B4629463046BDE8F041FBF724 +:10C7A0004DBA012A08BF002708D0022A08BF012776 +:10C7B00004D0032A1ABFFFDF0027032794F84C0098 +:10C7C000012808BF002208D0022808BF012204D097 +:10C7D00003281ABFFFDF002203223B4629463046CA +:10C7E000BDE8F041FAF749B9F0B4A2F1500C4FEAB4 +:10C7F000EC740CEB94646FF00D0C06460CEBA41576 +:10C8000000206FF00E0404EB92040CEBD207032B14 +:10C8100014D0022B0CBF1FFA84FC1FFA87FC8C4536 +:10C8200005D8032B11D0022B0CBFA1B2B9B2084618 +:10C83000002E1CBF001D80B2F0BC7047B2F5747FA3 +:10C8400034BF84461FFA85FCE9E7B2F5747F28BF40 +:10C85000A9B2EDD3EBE770B50146524844680278BF +:10C8600004F15005A9B194F84D10608E03F086FCD8 +:10C8700082B294F84D30E18D287CFFF7B5FF054674 +:10C8800094F84D00012823D0022823D0032823D078 +:10C8900017E0FFF7D2F80646FFF7CFF8014620462B +:10C8A00000F072FC82B2A18DE87B3346FFF79CFF5B +:10C8B000054694F84C0001280AD002280AD0032823 +:10C8C0000AD0FFDF00212846BDE87040F6F7D1B955 +:10C8D0000021F8E70121F6E70321F4E770B53149BB +:10C8E00000254C68F6F782FDF6F748FDF6F7EEFBFB +:10C8F000F6F751FCF6F7E0F8F6F73CFDF6F764FCC6 +:10C9000094F82800012808BFF6F7C7FD264C00213F +:10C91000A269E0899047226A217A207990472570A0 +:10C9200070BD70B5204C0546002908BF012D05D10A +:10C930006079401CC0B26071012830D8E169284696 +:10C94000884700282BD0E179184839B1012D01BF63 +:10C9500041780029017811F0100F20D0217AF1B927 +:10C9600010490978002918BF002102D0294304D0BA +:10C9700013E0012D18BF0121F8D10D49097811F0FC +:10C98000100F04BF007810F0100F08D0E07830B915 +:10C99000A07810B111F0100F01D0002070BD01205F +:10C9A00070BD00006801002030010020430100201C +:10C9B0004001002010B540F2BB11F74803F09EFA89 +:10C9C000F648002141704FF46171418010BD2DE99E +:10C9D000F0410F46064600F0D6FAEF4C102817D06B +:10C9E00004EBC00191F8421111F0010F1CBF0120AE +:10C9F000BDE8F081617808291FD2617804EBC0009E +:10CA0000491C6170012180F842110846BDE8F0819F +:10CA10006178082911D22578681C207004EBC508BC +:10CA20003868C8F83C01B888A8F84001102D28BF24 +:10CA3000FFDF88F83B612846DFE70020BDE8F08192 +:10CA4000D5480178491E4BB2002BB8BF704770B46F +:10CA50005FF0000500EBC30191F8421111F0010FE6 +:10CA60003BD04278D9B2521E427000EBC10282F82C +:10CA7000425190F802C00022BCF1000F0BD984187B +:10CA800094F803618E4202D1102A26D103E0521C91 +:10CA9000D2B29445F3D80278521ED2B202708A42C2 +:10CAA0001BD000EBC20200EBC10CD2F83B41CCF82A +:10CAB0003B41D2F83F21CCF83F21847890F800C068 +:10CAC0000022002C09D9861896F8036166450AD120 +:10CAD000102A1CBF024482F80311591E4BB2002BCE +:10CAE000B8DA70BC7047521CD2B29442EBD8F4E76B +:10CAF0002DE9F0471E4617468846814600F043FA66 +:10CB0000A54C0546102831D0A078002100280ED968 +:10CB1000621892F80331AB4205D110291CBF1220D4 +:10CB2000BDE8F08703E0491CC9B28842F0D8082864 +:10CB300032D2102D1DD000BF94F80280102208F1CF +:10CB40000100A07004EB081909F10300394600F058 +:10CB500039FF09F183001022314600F033FF04EB66 +:10CB6000080080F803510020BDE8F087A07808286D +:10CB700012D22578681C207004EBC50AD8F8000092 +:10CB8000CAF83C01B8F80400AAF84001102D28BFEB +:10CB9000FFDF8AF83B91CFE70720BDE8F08770B44C +:10CBA0007D488178491E4BB2002BBCBF70BC7047DA +:10CBB00003F0FF0C8178491ECAB2827050FA83F1EB +:10CBC00091F8031194453AD000EB021400EB0C15D8 +:10CBD000D4F80360C5F80360D4F80760C5F80760AF +:10CBE000D4F80B60C5F80B60D4F80F60C5F80F607F +:10CBF000D4F88360C5F88360D4F88760C5F887608F +:10CC0000D4F88B60C5F88B60D4F88F40C5F88F409E +:10CC1000841800EB0C0502EB420294F803410CEB84 +:10CC20004C0C00EB420285F8034100EB4C0CD2F8AF +:10CC30000B41CCF80B41B2F80F21ACF80F2100EBFF +:10CC4000C10292F8422112F0010F35D190F802C0D2 +:10CC500000220C46BCF1000F0BD9851895F8035142 +:10CC60008D4202D1102A27D103E0521CD2B2944542 +:10CC7000F3D80178491EC9B20170A1421CD000EB63 +:10CC8000C10100EBC402D1F83BC1C2F83BC1D1F8ED +:10CC90003F11C2F83F1190F802C002780021BCF1A8 +:10CCA000000F09D9451895F8035195420BD1102969 +:10CCB0001CBF014481F80341591E4BB2002BBFF643 +:10CCC00077AF70BC7047491CC9B28C45EAD8F3E70E +:10CCD00032494870704731484078704738B14AF25D +:10CCE000B811884203D82D494880012070470020A0 +:10CCF00070472A484088704710B500F044F9102862 +:10CD000014D0254A0146002092F802C0BCF1000F61 +:10CD10000CD9131893F803318B4203D1102818BF94 +:10CD200010BD03E0401CC0B28445F2D8082010BDFD +:10CD300019498A78824286BF01EB001083300020B7 +:10CD4000704715498A78824286BF01EB0010C01CEB +:10CD500000207047104B93F802C084459CBF002010 +:10CD60007047184490F8030103EBC00090F83B3182 +:10CD70000B70D0F83C111160B0F840019080012098 +:10CD80007047054A114491F8032104490A7002686A +:10CD90004A60808808817047581000207001002088 +:10CDA00010B5F5F705FE002804BFFF2010BDBDE853 +:10CDB0001040F5F723BEF1498A7882429CBF0020DB +:10CDC0007047084490F8030101EBC00090F842015D +:10CDD00000F00100704770B5E84E00242546307819 +:10CDE000002814D906EBC50090F8421111F0010F8C +:10CDF00008D090F83B2100F59E712046631CDCB200 +:10CE0000F5F7B6FF681CC5B23078A842EAD870784A +:10CE1000A04218BFFFDF70BD70B5D84C0026354664 +:10CE2000A078002812D96019731C90F8030104EB54 +:10CE3000C00000F59E7190F83B213046DEB2F5F758 +:10CE400097FF681CC5B2A078A842ECD8C0B2B04227 +:10CE500018BFFFDF70BD10B5F5F7BAFF58B3002457 +:10CE6000F5F7BAFFC54A00211378002B23D900BF7C +:10CE700002EBC10C9CF842C11CF0010F17D0844298 +:10CE80001CBF04F1010C0CF0FF0410D193780020BA +:10CE9000002B0AD902EB000C9CF803C18C4508BF9B +:10CEA00010BD401CC0B28342F4D8102010BD491CF4 +:10CEB000C9B28B42DCD8082010BD10B5F5F788FF49 +:10CEC000002804BF082010BDBDE81040F5F784BF5E +:10CED000AB4910B5497841B1A84B997829B1C21C2A +:10CEE000D81CF5F702FD012010BD002010BDA34A9B +:10CEF00001EB410102EB41010268C1F80B2180887E +:10CF0000A1F80F01704770B59C4D0024A878002847 +:10CF100098BF70BDC0B2A04212D905EB041010F149 +:10CF200083060DD01021304600F029FD40B904EBF6 +:10CF3000440005EB400000F20B113046F6F767FEA7 +:10CF4000601CC4B2A878A042E4D870BD014610228B +:10CF50008C4800F037BD8B48704770B5874D04464C +:10CF6000A878A04206D905EB04101021833000F008 +:10CF700006FD08B1002070BD04EB440005EB400045 +:10CF800000F20B1070BD2DE9F0417C4D06460024E7 +:10CF900028780F46002811D905EBC40090F83B1102 +:10CFA000B14206D10622394600F59E7002F003FF19 +:10CFB00038B1601CC4B22878A042EDD81020BDE87A +:10CFC000F0812046BDE8F0816C4910B44A7801EB4D +:10CFD000C003521E4A70002283F8422191F802C019 +:10CFE000BCF1000F0DD98B1893F80341844204D192 +:10CFF000102A1CBF10BC704703E0521CD2B29445EB +:10D00000F1D80A78521ED2B20A70824204BF10BC14 +:10D01000704701EBC00301EBC202D2F83BC1C3F879 +:10D020003BC1D2F83F21C3F83F218C7891F800C072 +:10D030000022002C9CBF10BC70478B1893F8033162 +:10D04000634506D1102A1CBF114481F8030110BCAE +:10D050007047521CD2B29442EFD810BC704770B4E3 +:10D0600046490D188A78521ED3B28B7095F8032169 +:10D07000984239D001EB001C01EB031400EB400097 +:10D08000D4F80360CCF80360D4F80760CCF80760EC +:10D09000D4F80B60CCF80B60D4F80F60CCF80F60BC +:10D0A000D4F88360CCF88360D4F88760CCF88760CC +:10D0B000D4F88B60CCF88B60D4F88F40CCF88F40DC +:10D0C00001EB030C03EB43039CF803C101EB4303A7 +:10D0D00085F803C101EB4000D3F80BC1C0F80BC1C8 +:10D0E000B3F80F31A0F80F3101EBC20090F8420104 +:10D0F00010F0010F1CBF70BC704700208C78002C12 +:10D100000DD90B1893F803C1944504D110281CBF06 +:10D1100070BC704703E0401CC0B28442F1D808786C +:10D12000401EC0B20870904204BF70BC704701EB53 +:10D13000C20301EBC000D0F83BC1C3F83BC1D0F83B +:10D140003F01C3F83F018C780B780020002C9CBF76 +:10D1500070BC704701EB000C9CF803C19C4506D1E4 +:10D1600010281CBF084480F8032170BC7047401C85 +:10D17000C0B28442EED870BC704700005810002046 +:10D18000700100201312002030B40346008E0329E2 +:10D190001CBF30BC7047598840F2E24201FB02FCE0 +:10D1A00093F84D20598E032A05D1B1F5296F38BF68 +:10D1B0004FF4296400D30C46DB8D4FF4747505EBF6 +:10D1C0008315AC4224BF990101F5747106D2032A7C +:10D1D00004D1B1F5296F38BF4FF42961ACEB0101DF +:10D1E000A1F59671884228BF0846B0F5296F38BF6F +:10D1F0004FF4296030BC70472DE9F00791F84C607E +:10D200008A8D4FF47478032E04BF08EB821297B214 +:10D2100006D0022E07BF92003C32D200703297B285 +:10D22000CC8D0B8E4A8E91F84DC0032E18BF1D4633 +:10D230001AD0BD4228BF3B4601D2032E42D09BB23A +:10D24000BCF1030F04BF08EB841189B207D0BCF115 +:10D25000020F07BFA1003C31E100703189B2BCF17F +:10D26000030F14465DD157E04D8840F2E24905FBBB +:10D2700009F9BCF1030F05D1B2F5296F38BF4FF49E +:10D28000296500D3154608EB841A554524BFA5012E +:10D2900005F5747509D2BCF1030F05D1B2F5296FFC +:10D2A00038BF4FF4296500D31546A9EB0505A5F550 +:10D2B0009675AB4238BF1D46B5F5296F38BF4FF4A0 +:10D2C0002965B6E7498840F2E2454D43BCF1030FBA +:10D2D000114604D1B2F5296F38BF4FF4296108EB2C +:10D2E0008417B94224BFA10101F5747108D2BCF1C1 +:10D2F000030F114604D1B2F5296F38BF4FF42961ED +:10D30000691AA1F596718B4228BF0B46B3F5296FB8 +:10D3100038BF4FF4296392E7B2F5296F38BF4FF455 +:10D3200029648C4208D21146BCF1030F04D1B1F537 +:10D33000296F38BF4FF42961012200280CBF01205A +:10D34000002001FB02319831002818BF0420084456 +:10D35000BDE8F007704710B44A8E0123B2F5296F7B +:10D3600034BF4FF4296C9446C98D4FF4747404EBA8 +:10D370008114A44524BF890101F5747204D2B2F569 +:10D38000296F38BF4FF4296291B200280CBF0120E9 +:10D3900000204FF4296201FB03219831002818BFB7 +:10D3A0000420084410BC704710B50A7B02F01F022D +:10D3B0000A73002282758B181B7A03F0010C5B083C +:10D3C00003F00104A4445B0803F00104A4445B08D7 +:10D3D00003F00104A4445B0803F0010464444FEA31 +:10D3E000530C0CF0010323444FEA5C0C0CF00104D5 +:10D3F000234403EB5C0300EB020C521C8CF811304D +:10D4000090F816C0D2B263448375052AD3D3D8B23C +:10D41000252888BFFFDF10BD00238383028401EB32 +:10D42000C202521EB2FBF1F1C18370470A4630B40A +:10D430000021032A0DD04FF4FA4C002A7ED0012A95 +:10D440007DD0022A1CBF30BC7047014630BC503032 +:10D45000AAE7A0F8501080F8561080F8571080F80E +:10D460005B1080F85C1080F85D1080F85E1080F82A +:10D47000521080F8531080F8541080F8551080F83E +:10D480006910A0F86C1080F87210A0F87410A0F861 +:10D490007A1080F87E10A0F8801080F8821080F852 +:10D4A000671080F8681080F85F1080F8601080F8CE +:10D4B000831080F8841080F88610F52280F88C2084 +:10D4C000092280F88D20A0F8781080F88F10A0F83D +:10D4D000C810A0F8CA10A0F8CC10A0F8CE10A0F880 +:10D4E000D010A0F8D21080F8D510A0F8DE1080F887 +:10D4F000DC10A0F8F010A0F8F21080F828100184D9 +:10D50000012280F84C2080F84D204FF44862428080 +:10D510001B228286C2864FF4A473438703878285C9 +:10D52000C28543860386A0F84020A0F84230828757 +:10D53000C387A0F84420A0F8462001E012E04FE0A5 +:10D54000A0F8482080F8901080F8281180F89110F9 +:10D5500080F8321180F8001180F8061180F8091166 +:10D5600030BC7047A0F8DE1080F8D6104288FE4B21 +:10D570001344B3FBF2F3A0F86E304BF68033A0F8FF +:10D580007030C488A0F87410B0F8781000F150031F +:10D59000514391FBF2F1A0F87810E100B1FBF2F1F8 +:10D5A000491C89B201FB02F4A0F87610B4F5C84F0B +:10D5B000C4BF491ED984BCFBF2F1491C998502F510 +:10D5C000802101F5EE31A1F1010CBCFBF2F1D98310 +:10D5D000B3F81CC00CFB02F1B1FBF2F1998334E704 +:10D5E000A0F8DE1000F150024488B0F82231B0F803 +:10D5F00026019184118DC0006143B0FBF3F091FBD3 +:10D60000F3F1401C118580B200FB03F1D084B1F529 +:10D61000C84FC4BF401ED084BCFBF3F0401C9085B3 +:10D62000108C03EBC000401EB0FBF3F0D083908B56 +:10D630006043B0FBF3F0908330BC70470A4630B4CF +:10D640000021032A0DD04FF4FA4C002A7DD0012A84 +:10D650007AD0022A1CBF30BC7047014630BC503023 +:10D66000A2E6A0F8501080F8561080F8571080F805 +:10D670005B1080F85C1080F85D1080F85E1080F818 +:10D68000521080F8531080F8541080F8551080F82C +:10D690006910A0F86C1080F87210A0F87410A0F84F +:10D6A0007A1080F87E10A0F8801080F8821080F840 +:10D6B000671080F8681080F85F1080F8601080F8BC +:10D6C000831080F8841080F88610F52280F88C2072 +:10D6D000092280F88D20A0F8781080F88F10A0F82B +:10D6E000D01080F8D21080F8C810C0F8CC1080F8A4 +:10D6F0002810012280F84C2080F84D201B228286C1 +:10D70000C2864FF4A473438703878285C28543860C +:10D710000386A0F84020A0F842308287C387A0F893 +:10D720004420A0F84620A0F8482080F8901080F807 +:10D73000001180F8911080F80A1180F8E81080F844 +:10D74000F81030BC704700E039E04288864B134443 +:10D75000B3FBF2F3A0F86E304BF68033A0F87030D4 +:10D76000C488A0F87410B0F8781000F15003514349 +:10D7700091FBF2F1A0F87810E100B1FBF2F1491C45 +:10D7800089B201FB02F4A0F87610B4F5C84FC4BF0B +:10D79000491ED984BCFBF2F1491C998502F5802110 +:10D7A00001F5EE31A1F1010CBCFBF2F1D983B3F824 +:10D7B0001CC00CFB02F1B1FBF2F199834DE7D0F8EC +:10D7C000F04000F1500243886089E4899184118D12 +:10D7D000594391FBF0F11185E100B1FBF0F1491CD7 +:10D7E00089B201FB00F4D184B4F5C84FC4BF491E0F +:10D7F000D184BCFBF0F1491C9185118C00EBC10177 +:10D80000491EB1FBF0F1D183918B5943B1FBF0F08C +:10D81000908330BC7047837D0BB1252B01D912203A +:10D820007047002A04BF0020704770B490F817C0FA +:10D830000C7E4E4D04FB02C22C464FF0000CE2FB66 +:10D84000054C4FEA1C1C6FF024040CFB0422D2B2DE +:10D8500001EBD20CC27502F007059CF808C0012448 +:10D8600004FA05F51CEA050F18BF02762CD1B2FBAD +:10D87000F3FC03FB1C22521CD2B24FF0000C00BF81 +:10D8800000EB0C035B7C93423CBFD21AD2B20ED3A6 +:10D8900001EB0C0500232D7A04FA03F635421CBF78 +:10D8A000521ED2B26AB15B1CDBB2082BF4D30CF16E +:10D8B000010303F0FF0CBCF1050FE1D370BC1F2086 +:10D8C000704703EBCC01017670BC0020704730B587 +:10D8D0000D460446072988BFFFDFE07805F0070101 +:10D8E00000F05000084340F08800E070A07800F09D +:10D8F000A70040F01800A070607800F05E0040F0D3 +:10D9000020006070207800F0BC0040F040002070E3 +:10D9100030BD017931F01F0113BF002000221146F4 +:10D92000704710B4435C491C03F0010C5B0803F022 +:10D930000104A4445B0803F00104A4445B0803F061 +:10D940000104A4445B0803F00104A4445B0803F051 +:10D9500001045B08A44403F00104A4440CEB53034A +:10D960001A44D2B2052903E0FFDB050053E4B36E8D +:10D97000D8DB012A8CBF0120002010BC704730B4D6 +:10D980000022A1F1010CBCF1000F11DD431E11F0CA +:10D99000010F08BF13F8012F5C785FEA6C0C07D009 +:10D9A00013F8025F22435C782A43BCF1010CF7D1E3 +:10D9B000491E5CBF405C0243002A0CBF01200020CE +:10D9C00030BC7047130008BF704710B401EB030C64 +:10D9D000D41A1CF801CC5B1E00F804C013F0FF033E +:10D9E000F4D110BC7047F0B58DB0164610251C461A +:10D9F0006A46AC4600EB0C03A5EB0C0713F8013CA0 +:10DA0000D355ACF1010313F0FF0CF3D115461032DE +:10DA1000102084460B18ACEB000713F8013C401EA5 +:10DA2000D35510F0FF00F5D1284601F083FA86B1F6 +:10DA3000102005F1200201461318A1EB000C13F889 +:10DA4000013C401E04F80C3010F0FF00F4D10DB082 +:10DA5000F0BD08982060099860600A98A0600B9853 +:10DA6000E0600DB0F0BD38B505460C466846F5F7E8 +:10DA700029FD002808BF38BD9DF90020227294F9C5 +:10DA800009100020511A48BF494295F829308B42AD +:10DA9000C8BF38BDFF2B08BF38BDA17A491CC9B229 +:10DAA000A17295F82A30994203D8617A7F2918BF6C +:10DAB00038BD62720020A072012038BD0C294FD2FF +:10DAC000DFE801F006090E13161B323C3F4C4247BB +:10DAD000002A47D044E0022A18BF032A42D03FE080 +:10DAE000072A18BF062A3DD03AE0082A3AD037E084 +:10DAF000A2F10C000D2835D932E023B1A2F10D00BE +:10DB00000C282FD92CE00F2A18BF0E2A2AD090F803 +:10DB1000340020B10F2A23D3182A23D920E0132A56 +:10DB20001ED3182A1ED91BE0A2F10C01032919D912 +:10DB300090F83400A0B1192A14D911E0092A11D0A3 +:10DB40000EE0012A0ED00BE01A2A18BF1B2A09D0BA +:10DB500006E0A2F11C00042804D901E00A2A01D041 +:10DB600000207047012070472DE9F04187680D467D +:10DB700004462046F2F714FF90B1CDB13846A168B3 +:10DB8000F3F7ADFFA0B1401EB0FBF5F0461C06FB5D +:10DB900005F13846F2F793FEA0603046BDE8F0810B +:10DBA000F2F774FE40F26171F2F789FEA060E0E7DF +:10DBB0000020BDE8F081904228BF704770B5044650 +:10DBC000101B642838BF642025188D4205D8F3F750 +:10DBD000B1FF00281CBF284670BD204670BDF0B4C0 +:10DBE000B0F84440FB2C28BFFB2490F84CC04FF405 +:10DBF0007477BCF1030F04BF07EB8414A5B207D000 +:10DC0000BCF1020F07BFA4003C34E4007034A5B29D +:10DC1000B0F84640FB2C28BFFB2490F84D60032E43 +:10DC200004BF07EB841084B206D0022E07BFA00009 +:10DC30003C30E000703084B20020BCF1030F08BF1C +:10DC40004FF4747C06D0BCF1020F0CBF4FF03C0CBB +:10DC50004FF0700C032E08BF4FF4747603D0022EE1 +:10DC60000CBF3C267026914234BF012700270F4489 +:10DC7000FFB28A4234BF012100211144C9B28F4250 +:10DC800034BF0A463A46002A04BFF0BC704705FB81 +:10DC900007F004FB01008F4205D93944C1EB420172 +:10DCA00016FB010005E004D23944C1EB42011CFB24 +:10DCB00001004FF04D0112FB01F100EB8100A0F1DA +:10DCC0009C00002B14BF042100210844F0BC7047C5 +:10DCD000F0B5054690F84A0000260C4610F0040FF7 +:10DCE00004BF95F84B0010F0040F0FD029463046C2 +:10DCF000FFF782FA074629463046FFF72CFBB84269 +:10DD000004D929463046FFF726FB03E02946304672 +:10DD1000FFF772FA698840F2712251437E4A8442C9 +:10DD200002EB410134BF024622468A4228BF084620 +:10DD300002D2844228BF20466862F0BD2DE9F0413E +:10DD4000054690F84A00012716460C4610F0040FCD +:10DD500004BF95F84B0010F0040F0FD02946384649 +:10DD6000FFF74AFA804629463846FFF7F4FA40455D +:10DD700004D929463846FFF7EEFA03E0294638462B +:10DD8000FFF73AFA698840F271225143C6EB41012C +:10DD9000A1F22131844234BF024622468A4228BF82 +:10DDA000084602D2844228BF20466862BDE8F0815E +:10DDB000F8B505460E46084600F0CAFB0446304654 +:10DDC00000F0CAFB014610F0010F18BF012008D176 +:10DDD00011F0020F18BF022003D111F0040018BF88 +:10DDE00003208DF8000014F0010F18BF012208D1A4 +:10DDF00014F0020F18BF022203D114F0040218BF5E +:10DE000003228DF8012011F0070F08BF00208DF8C4 +:10DE1000000014F0070F08BF00228DF8012095F8CC +:10DE20004C10884208BF00208DF8000095F84D0086 +:10DE3000824208BF00228DF80120BDF80000F8BD25 +:10DE4000012814BF0228704703280CBF04200020BB +:10DE5000704718B4CBB2C1F3072CC1B2C0F307208E +:10DE6000012B07D0022B09D0042B08BFBCF1040FF3 +:10DE700023D006E0BCF1010F03D11EE0BCF1020F7C +:10DE80001BD0012906D0022907D0042908BF042885 +:10DE900013D004E0012802D10FE002280DD001EADE +:10DEA0000C0161F30702184060F30F22D0B210F0AA +:10DEB000020F18BF022010D106E0084003EA0C014F +:10DEC000084060F30702EFE710F0010F18BF0120D0 +:10DED00003D110F0040018BF03208DF80000C2F336 +:10DEE000072010F0020F18BF022008D110F0010F18 +:10DEF00018BF012003D110F0040018BF03208DF8D3 +:10DF00000100BDF8000018BC7047072816BF08289C +:10DF10000120002070470000F1FCFFFF282101F0E4 +:10DF2000EDBF30B50546007801F00F0220F00F007C +:10DF30001043287007290BD2DFE801F0040604061D +:10DF400004080400062405E00C2403E0222401E078 +:10DF50000024FFDF687820F03F002043687030BD68 +:10DF6000007800F00F0070470A68C0F80320898825 +:10DF7000A0F807107047D0F803200A60B0F8070037 +:10DF8000888070470A68C0F809208988A0F80D10B9 +:10DF90007047D0F809200A60B0F80D0088807047FB +:10DFA0000278402322F0400203EA811111430170FC +:10DFB00070470078C0F3801070470278802322F009 +:10DFC000800203EAC1111143017070470078C00953 +:10DFD0007047D0F80320C1F80920B0F80720A1F855 +:10DFE0000D200A7822F080020A700078800942EA47 +:10DFF000C0100870704770B515460E4604461F2ABB +:10E0000088BFFFDF2A46314604F1090001F0FFFE18 +:10E010006078A91D20F03F0001F03F0108436070C7 +:10E0200070BD70B5054640780E4600F03F04062CE2 +:10E0300038BFFFDFA01FC4B21F2C88BF1F24224699 +:10E0400005F10901304601F0E2FE204670BD70B5D1 +:10E0500015460E4604461F2A88BFFFDF2A46314672 +:10E0600004F1090001F0D3FE6078A91D20F03F0003 +:10E0700001F03F010843607070BD70B505464078FF +:10E080000E4600F03F04062C38BFFFDFA01FC4B2CD +:10E090001F2C88BFFFDF224605F10901304601F041 +:10E0A000B6FE204670BD0968C0F80F1070470A8898 +:10E0B000A0F813208978417570474176090A817666 +:10E0C0007047C176090A017770474177090A81775D +:10E0D0007047C175090A017670478175704790F8DD +:10E0E000242001F01F0122F01F02114380F82410A8 +:10E0F000704790F82420E02322F0E00203EA411167 +:10E10000114380F8241070471F3002F02CB841787A +:10E11000007801F03F0110F00F0006D0012808D070 +:10E12000022809D006280BD00FE0881F1F280AD923 +:10E130000BE00C2909D106E0881F1F2803D904E051 +:10E14000881F1F2801D801207047002070474178A0 +:10E15000007801F03F0100F00F00042805D10629E6 +:10E1600003D325299CBF012070470020704710B4BD +:10E17000017801F00F01032922D0052925D1447827 +:10E18000B0F81910B0F81BC0B0F81730827D04F059 +:10E190003F04222C19D1062917D3B1F5486F98BF37 +:10E1A000BCF5FA7F11D282B1082A98BF8A420CD2FC +:10E1B0008B429CBFB0F81D00B0F5486F05D807E052 +:10E1C000407800F03F000C2802D010BC00207047BF +:10E1D00010BC01207047222101F090BE00B50278EA +:10E1E00001F0030322F003021A430270002242707E +:10E1F000012914BF022900BD032912BFFFDF01213D +:10E20000417000BD01F0030300B5027822F0030263 +:10E210001A43027000224270012914BF022900BD76 +:10E22000032912BFFFDF0121417000BD007800F01B +:10E23000030070470278102322F0100203EA011154 +:10E240001143017070474178F9B1C078192850D254 +:10E25000DFE800F00D101316191C1F2225282B2EA5 +:10E2600031344F4F4F4C373A3D40434649000C291B +:10E2700041D042E008293ED03FE002293BD03CE0BB +:10E28000172938D039E00D2935D036E0012932D0B0 +:10E2900033E001292FD030E002292CD02DE00929CC +:10E2A00029D02AE0092926D027E0012923D024E01B +:10E2B000012920D021E006291DD01EE002291AD014 +:10E2C0001BE0012917D018E0012914D015E0092915 +:10E2D00011D012E009290ED00FE003290BD00CE079 +:10E2E000032908D009E0052905D006E0032902D05A +:10E2F00003E0FB2901D8012070470020704730B5AA +:10E300000546C170192922D2DFE801F00D0F111363 +:10E3100015171711191917171B112121211D17176F +:10E3200019191D1D1F000C2413E0082411E00224FC +:10E330000FE017240DE00D240BE0012409E009246F +:10E3400007E0062405E0032403E0052401E000249F +:10E35000FFDF6C7030BDC0787047C171090A01726F +:10E360007047B0F8070070474172090A8172704720 +:10E37000B0F809007047C172090A01737047B0F81C +:10E380000B0070474171090A81717047B0F80500B0 +:10E39000704701717047007970474173090A8173B2 +:10E3A0007047B0F80D00704730B4B0F80720824DC8 +:10E3B000B0F809C0B0F805300179941F2D1998BF45 +:10E3C000BCF5FA7F0ED269B1082998BF914209D2F3 +:10E3D00093429FBFB0F80B00B0F5486F012030BCEE +:10E3E00098BF7047002030BC7047001D01F0BBBED5 +:10E3F000021D0846114601F0B6BE4172090A81723B +:10E400007047B0F809007047017170470079704794 +:10E410000A68426049688160704742680A608068A3 +:10E4200048607047098881817047808908807047FB +:10E430000A68C0F80E204968C0F812107047D0F87A +:10E440000E200A60D0F81200486070470968C0F8D2 +:10E4500016107047D0F81600086070470A684260CE +:10E4600049688160704742680A6080684860704708 +:10E470000968C1607047C0680860704701717047E3 +:10E480004171090A81717047C171090A01727047AF +:10E4900000797047B0F805007047B0F80700704782 +:10E4A00001717047007970470171704700797047BA +:10E4B0000A68426049688160704742680A60806803 +:10E4C000486070470171090A417170478171090AFA +:10E4D000C17170470172090A417270478172090A5D +:10E4E000C172704780887047C08870470089704744 +:10E4F0004089704701891B2914D3FB2912D841890F +:10E50000B1F5A47F21BF40F648028A4281881B29C9 +:10E5100008D3FB2906D8C088B0F5A47F22BF824269 +:10E5200001207047002070470A6842604968816096 +:10E53000704742680A6080684860704701717047A0 +:10E540000079704741717047407970470171704799 +:10E550000079704741717047407970478171090AAD +:10E56000C1717047C088704714A282B0D2E900120E +:10E57000CDE900120179407901F0070269461DF8E2 +:10E580000220012A07D800F00700085C01289EBF7E +:10E59000012002B07047002002B07047017170473F +:10E5A000007970474171704730B50C460546FB292C +:10E5B00088BFFFDF6C7030BD86F3FFFF00010102F2 +:10E5C0000102020370B50446C2F11005281901F0DA +:10E5D0001EFC15F0FF0108D0491EC9B2802060540E +:10E5E0002046BDE8704001F089BC70BD30B505E043 +:10E5F0005B1EDBB2CC5CD55C6C40C454002BF7D105 +:10E6000030BD10B5002409E00B78521E44EA4303E4 +:10E6100000F8013B11F8013BD2B2DC09002AF3D12A +:10E6200010BD2DE9F0410C4601200978FF4E92B053 +:10E63000154602274FF006084FF0040C71B101296E +:10E640001ED0022945D0032905D12978042902D1F9 +:10E6500005201070002012B0BDE8F081606850B154 +:10E66000CDE90106012020708DF80080606A0490D9 +:10E670001146684663E0277085F800C0566026E0C2 +:10E6800029780429E7D1696810222069FFF7B9FFCA +:10E690006868C07B000606D5E44A20691023103262 +:10E6A0000146FFF7A3FFD4E904101022FFF7A9FFEA +:10E6B0002069C07B000606D5DC4A60691023103251 +:10E6C0000146FFF793FF277085F800C06E600320B6 +:10E6D000C1E729780429BED1A08910280CD9A0F15E +:10E6E000100080B2A081A1684FF010030144684679 +:10E6F0006A68FFF77BFF18E004D14FF0100322692E +:10E70000A16807E0C2B20DA8A168FFF75BFF6269CC +:10E7100010230DA909A8FFF769FF102309A968466E +:10E720006A68FFF763FF0320207060680590CDF8EA +:10E7300018D08DF81080606A0890294604A8F1F777 +:10E740006DFD88E72DE9F04107460D4601200B7865 +:10E7500006213BB1012B04D11378052B01D1117097 +:10E76000002079E76C69012620226170E86860600A +:10E77000686A6062A168287C0870A681A068A968A0 +:10E78000401C01F044FBA08920222030A081A06819 +:10E790006968213001F03BFBA08921462030A0812F +:10E7A0002E703846BDE8F041F1F74FBD2DE9F05F1E +:10E7B0000D46834601200978174606464FF00608A5 +:10E7C000D1B1DFF868A24FF00009AAF1080A0129C7 +:10E7D00023D002297ED003290CD13978052909D10B +:10E7E00079681022E86901F012FB072038701835AB +:10E7F00000207D60BDE8F09F2C6A8C48202284F8C0 +:10E800000180203060602020A081686A60626968B1 +:10E81000A06801F0FCFA2E70D4E039780529E9D11E +:10E820002C6A84F80180686A606251681022E86985 +:10E8300001F0EDFAE8696060A0684F4680F800904A +:10E84000A681A0684670A089401C80B2A081A16802 +:10E850000844696951F8012F026089888180A08984 +:10E86000801D80B2A0816969A2680978C1F3400166 +:10E870001154A089401C80B2A081A1680844296974 +:10E8800051F8012F026089888180A089801D80B2A3 +:10E89000A0812969A2680978C1F340011154A089B7 +:10E8A0001022401C80B2A081A1680844E96801F0F0 +:10E8B000AEFAA0891022103080B2A081A16808446D +:10E8C000A96801F0A4FAA089103080B2A081A168E3 +:10E8D000014400E00DE0DAF804000860A089001DA2 +:10E8E00080B2A081A1680F54A089401CA0810220A1 +:10E8F00067E03978052992D151681022A86901F0A2 +:10E9000086FA2C6A84F80180E8696060686A60624F +:10E91000A16881F80090A681A0684670A089401C7B +:10E9200080B2A081A1680844696951F8012F026092 +:10E9300089888180A089801D80B2A0816969A268D0 +:10E940000978C1F340011154A089401C80B2A08114 +:10E95000A1680844296951F8012F026089888180E3 +:10E96000A089801D80B2A0812969A2680978C1F3BD +:10E9700040011154A0891022401C80B2A081A168DE +:10E980000844E96801F043FAA0891022103080B2EF +:10E99000A081A1680844A96801F039FAA089103063 +:10E9A00080B2A081A1680144DAF804000860A0895F +:10E9B000001D80B2A081A1680E54A089401CA081D6 +:10E9C0000320287021465846BDE8F05FF1F73DBCB2 +:10E9D00070B50D4606460978012041B1012905D1DF +:10E9E0001178052902D108201070002070BD2C6A12 +:10E9F0000620607069686160696A6162EA69A1689D +:10EA000052F8013F0B6092888A80A081E869A16872 +:10EA10000078C0F340008871A089401C80B2A081BA +:10EA2000A1680844A96951F8012F01E0C805020056 +:10EA3000026089888180A089801D80B2A081A96937 +:10EA4000A2680978C1F340011154A089401C80B22A +:10EA5000A081A168084469690A8802808978817068 +:10EA6000A0891022C01C80B2A081A1680844296935 +:10EA700001F0CDF9A0891022103080B2A081A168E8 +:10EA80000844E96801F0C3F9A0891022103080B26F +:10EA9000A081A1680844A96801F0B9F9A0892146BC +:10EAA0001030A081012028703046BDE87040F1F799 +:10EAB000CCBB70B50D4606460978012059B1012935 +:10EAC00008D11178052905D1092010705068006817 +:10EAD0005060002070BD6C69062010226070E868EC +:10EAE0006060686A60622969A06801F090F910208E +:10EAF000A081A06820221030A96801F088F9A089BF +:10EB00002022203080B2A081A1680844696801F009 +:10EB10007EF9A08921462030A0810120287030464E +:10EB2000BDE87040F1F791BB70B50C460120097843 +:10EB30008EB01546062659B1012934D0022905D1D7 +:10EB40002978042902D10A20107000200EB070BD6F +:10EB5000606910236A460078C0F340008DF8000019 +:10EB6000A0690078C0F340008DF80100E0680168FA +:10EB7000CDF802108188ADF8061080798DF8080074 +:10EB800020690168CDF809108188ADF80D108079F1 +:10EB90008DF80F006068059009A80690A168FFF73E +:10EBA00025FD01201DE029780429CFD1A06910237B +:10EBB0006A4650F8011F00918088ADF80400606932 +:10EBC00050F8011FCDF806108088ADF80A0000202B +:10EBD00003906068059009A806906968FFF706FD34 +:10EBE000022020708DF81060606A0890294604A801 +:10EBF000F1F714FBAAE700B50B7889B001204BB1FF +:10EC0000012B05D11178042902D10B2010700020AE +:10EC100009B000BD4868019005A80290C868036863 +:10EC200005934068069088680368079340680890D9 +:10EC30000120087006208DF80000486A04901146F3 +:10EC40006846F1F7EBFAE3E700B50B7889B00120ED +:10EC500043B1012BDCD111780429D9D10C201070DB +:10EC60000020D5E74868019005A8029088680368ED +:10EC700005934068069000200790089001200870D6 +:10EC800006208DF80000486A049011466846F1F7A6 +:10EC9000C5FABDE700B50B7889B0012043B1012B5F +:10ECA000B6D111780429B3D10D2010700020AFE740 +:10ECB00048680590CDF818D088680088ADF8000045 +:10ECC000C8680088ADF8020000200190029003900F +:10ECD0000120087006208DF81000486A089011463F +:10ECE00004A8F1F79BFA93E730B403460C780120AF +:10ECF0005CB1012C15D0022C05D111780C2902D160 +:10ED00000E201070002030BC704701200870C868C9 +:10ED1000042242704A6842600B4A8260921EC260BE +:10ED20000BE014780D2CEED102200870C868032483 +:10ED30004470526842608A688260496A4162014652 +:10ED400030BC1846F1F781BAC205020070B41D78D4 +:10ED5000039C4FF0000CAA4204BF70BC70478E5C4D +:10ED6000864208BF4FF0010C02D0BCF1000F05D065 +:10ED7000561CA64208BF00268E5D8E54561CA64225 +:10ED80000CBF0022521CD2B2AA42E8D1BCF1000F43 +:10ED900004BF70BC70471878411E19703CBF601EDC +:10EDA000187070BC704700002DE9F0410C46114905 +:10EDB0000D68104A104908321160A0F120012A297B +:10EDC00001D301200CE03E2810D040CC0B4F94E83A +:10EDD0000E0007EB8000241F50F8807C3046B847B7 +:10EDE00020600448001D0560BDE8F0812046E2F780 +:10EDF000E7F9F5E71005024001000001F8050200FF +:10EE000010B5524800F024FA00B1FFDF4F48401C13 +:10EE100000F01EFA002800D0FFDF10BD2DE9F14FF1 +:10EE20004B4ED6F800B00127484800F019FADFF839 +:10EE30001C8128B95FF0000708F1010000F026FAF4 +:10EE4000444C00254FF0030901206060C4F80051D4 +:10EE5000C4F80451009931602060DFF8FCA018E08C +:10EE6000DAF80000C00614D50E2000F064F8EFF3C5 +:10EE7000108010F0010072B600D00120C4F8049395 +:10EE8000D4F8001119B9D4F8041101B920BF00B9A0 +:10EE900062B6D4F8000118B9D4F804010028DFD014 +:10EEA000D4F804010028CFD137B1C6F800B008F17A +:10EEB000010000F0D5F911E008F1010000F0D0F9EF +:10EEC0000028B9D1C4F80893C4F80451C4F800511B +:10EED0000E2000F030F81D4800F0D8F90020BDE801 +:10EEE000F88F2DE9F0438DB00D46064600240DF154 +:10EEF00010090DF1200817E004EB4407102255F823 +:10EF00002710684600F083FF05EB8707102248466C +:10EF1000796800F07CFF6846FFF780FF10224146C9 +:10EF2000B86800F074FF641CB442E5DB0DB000204B +:10EF3000BDE8F08372E700F01F0201219140400913 +:10EF4000800000F1E020C0F8801270477A010020B4 +:10EF500004E5004000E0004010ED00E0B248002170 +:10EF600001708170704770B5B04D01232B60B04BBC +:10EF70001C68002CFCD0002407E00E6806601E68A8 +:10EF8000002EFCD0001D091D641C9442F5D3002006 +:10EF9000286018680028FCD070BD70B5A24E0446E9 +:10EFA000A44D3078022800D0FFDFAC4200D3FFDF51 +:10EFB0007169A148012903D847F23052944201DD1A +:10EFC00003224271491C7161291BC1609A49707802 +:10EFD000BDE87040F1F7EBBD70B5934C0D4661781C +:10EFE000884200D0FFDF934E092D4FD2DFE805F0B5 +:10EFF0004E0522314E4E4E4E3C002078022800D065 +:10F00000FFDF03202070A078022802D0012804D05E +:10F0100008E0A06800F00CFC04E004F1080007C858 +:10F02000FFF7A1FF052020700020A070BDE8704010 +:10F03000F1F759BBF1F72AFC01466068F2F74FFD82 +:10F04000B04202D2616902290BD30320F2F76CFFB0 +:10F0500012E0F1F71BFC01466068F2F740FDB04298 +:10F06000F3D2BDE8704098E7207802280AD005283E +:10F0700006D0FFDF04202070BDE8704000F0CAB861 +:10F08000022000E00320F2F74FFFF3E7FFDF70BD3F +:10F0900070B50546F1F7FAFB634C606020780128F3 +:10F0A00000D0FFDF64490220087000220A718D60E1 +:10F0B00004224A715F4ACA6020706078BDE87040DF +:10F0C000F1F775BD10B5584CA07808B9207808B193 +:10F0D000112010BD5948F1F773FB6070607820B1C2 +:10F0E000012020700020606110BD032010BD0020B1 +:10F0F00070472DE9F041144600EB84070E460546A3 +:10F100003F1F00F0A8FB4FF080521169484306EB07 +:10F110008401091FB14201D2012100E000211CB18C +:10F120001269B4EB920F02D90920BDE8F081444A7C +:10F1300095420ED3AF420CD3854205D2874203D20B +:10F1400045EA0600800701D01020EEE7964200D382 +:10F1500009B10F20E9E73B483B490068884205D0E8 +:10F16000224631462846FFF7FEFE10E0FFF7AAFFD1 +:10F170000028DAD12C4801218560C0E90364817040 +:10F180004FF4A97104FB01F01830FFF781FF002054 +:10F19000CBE770B54FF08055044628692849B1FB8C +:10F1A000F0F0844201D20F2070BD00F054FBA04269 +:10F1B00001D8102070BD2869224823490068884280 +:10F1C00004D02869604300F033FB0CE0FFF77AFFBE +:10F1D0000028EFD1296914486143816002218170C0 +:10F1E0001A48FFF755FF002070BD1548010B01209C +:10F1F0008840401E704770B50D460446FFF7F5FF86 +:10F20000204201D00F2070BD29462046BDE8704045 +:10F2100000F0ABBD10B5044C6078F1F721FB002085 +:10F220002070A07010BD00007C01002004E50140AA +:10F2300000E40140105C0C0024120020D9EF010012 +:10F2400000100200A0000020BEBAFECA7C5E0100D1 +:10F250000021017008467047014600200870704781 +:10F26000EFF3108101F0010172B60278012A01D09A +:10F27000012200E000220123037001B962B60AB145 +:10F28000002070474FF400507047E9E7EFF310811A +:10F2900011F0010F72B64FF00002027000D162B699 +:10F2A00000207047F2E7000056490968016000201D +:10F2B0007047544908600020704701218A0720B137 +:10F2C000012804D042F204007047916700E0D16742 +:10F2D000002070474C490120086042F20600704748 +:10F2E00008B50423484A1907103230B1C1F8043375 +:10F2F000106840F0010010600BE0106820F0010081 +:10F300001060C1F808330020C1F808013F480068C8 +:10F310000090002008BD3C49103140B101280CD0BC +:10F32000022812D0032816D042F205007047086860 +:10F3300020F01E0040F0100004E0086820F01E00DD +:10F3400040F01400086000207047086820F01E009C +:10F3500040F01800F6E7086820F01E0040F01C009E +:10F36000F0E7294924310A6802430A600020704707 +:10F37000254924310A6882430A60002070472249E7 +:10F3800024310968016000207047012801D9072055 +:10F3900070471F4A52F8200002680A4302600020AA +:10F3A0007047012801D907207047194A52F82000F8 +:10F3B00002688A43026000207047012801D90720B3 +:10F3C0007047134A52F82000006808600020704718 +:10F3D000020010494FF0000003D0012A01D007209D +:10F3E00070470A6070474FF080410020C1F8080163 +:10F3F0004FF0E020802180F800140121C0F80011B6 +:10F400007047000000040040000500400801004073 +:10F41000A0060200780500406249634B0A68634910 +:10F420009A42096801D1C1F31001016000207047C0 +:10F430005C495D4B0A685D49091D9A4201D1C0F3E0 +:10F4400010000860002070475649574B0A6857491A +:10F4500008319A4201D1C0F31000086000207047C3 +:10F4600030B5504B504D1C6842F20803AC4202D0FC +:10F47000142802D203E0112801D3184630BDC3007E +:10F480004B481844C0F81015C0F81425002030BDB2 +:10F490004449454B0A6842F209019A4202D00628C3 +:10F4A00002D203E0042801D308467047404A0121F4 +:10F4B00042F83010002070473A493B4B0A6842F24C +:10F4C00009019A4202D0062802D203E0042801D39F +:10F4D00008467047364A012102EBC0004160002017 +:10F4E000704770B52F4A304E314C156842F209030F +:10F4F00004EB8002B54204D0062804D2C2F80018FA +:10F5000007E0042801D3184670BDC1F31000C2F80B +:10F510000008002070BD70B5224A234E244C1568A7 +:10F5200042F2090304EB8002B54204D0062804D25B +:10F53000D2F8000807E0042801D3184670BDD2F8BD +:10F540000008C0F310000860002070BD174910B516 +:10F550000831184808601120154A002102EBC00349 +:10F56000C3F81015C3F81415401C1428F6D3002056 +:10F5700006E0042804D302EB8003C3F8001807E078 +:10F5800002EB8003D3F80048C4F31004C3F800482A +:10F59000401C0628EDD310BD044906480831086018 +:10F5A00070470000A0000020BEBAFECA00F501406E +:10F5B00000F001400000FEFF754B1B6803B1984747 +:10F5C000BFF34F8F73480168734A01F4E061114340 +:10F5D0000160BFF34F8FFEE710B572B600F0CEF8B2 +:10F5E00050B1E1F78DFEF1F766F8F2F743FCEAF768 +:10F5F000E4FB6A490020086062B6002010BD70B5C7 +:10F600000C46054672B600F0B9F810B162B6082093 +:10F6100070BDE1F7EBFDE1F775FE024600204309FE +:10F620009B0003F1E02300F01F01D3F80031CB4031 +:10F63000D9071DD0202803D222FA00F1C90724D10E +:10F6400041B2002906DA01F00F0101F1E02191F841 +:10F65000141D03E001F1E02191F800144909082983 +:10F6600013D291B1012910D004290ED005290CD054 +:10F67000401C6428D3D3EAF777FB48494848086020 +:10F680002046F3F7AFF858B903E062B641F2010043 +:10F6900070BD3F4804602DB12846F3F7EEF818B16D +:10F6A00010242BE03F4D18E02878022802D94FF4AF +:10F6B000805423E007240028687801D058B908E076 +:10F6C000E0B120281AD8A878212817D8012815D009 +:10F6D00003E0A87808B162B612E03349802081F8CF +:10F6E000140DE1F70FFE2946F2F7AAFBF0F796FF9B +:10F6F00000F0E8F82846E1F7D1FD044662B61CB1F7 +:10F70000FFF76AFF204670BD002070BD10B50446AB +:10F7100000F034F800B101202070002010BD234912 +:10F7200008600020704770B50C4621490D682049DB +:10F73000204E08310E60102807D011280CD0122856 +:10F740000FD0132811D0012013E0D4E90001FFF7F6 +:10F7500056FF354620600DE0FFF73EFF0025206094 +:10F7600008E02068FFF7D2FF03E010492068086036 +:10F77000002020600E48001D056070BD0748084944 +:10F780000068884201D101207047002070470000C6 +:10F79000940100200CED00E00400FA05A000002018 +:10F7A000BEBAFECAA80602000BE000E0040000207A +:10F7B00010050240010000012DE9F04184B08846A7 +:10F7C0000746FEF733FD05467E786A4601A94046A6 +:10F7D000EEF7BCFF04000ED0012D1EBF032004B0C5 +:10F7E000BDE8F08102AA40460199EEF7AEFE02980C +:10F7F000B0F803000AE0022D14D1042E12D3B7F89A +:10F800000300BDF80020011D8A420BD3001D80B209 +:10F81000A119814238BF012008BF00209CBF04B05D +:10F82000BDE8F0814FF0020004B0BDE8F0810000B7 +:10F830000B4A022111600B490B68002BFCD0084BCE +:10F840001B1D186008680028FCD0002010600868A4 +:10F850000028FCD070474FF080504069704700008E +:10F8600004E5014000E4014010B54FF000040B46F0 +:10F870000200204621461ED0012A04D0022A04D0CC +:10F88000032A1DD103E0012002E0022013E003203F +:10F89000072B15D2DFE803F0140406080A0C0E004B +:10F8A000012108E0022106E0032104E0042102E036 +:10F8B000052100E00621F0F79DFF08B1204610BDAC +:10F8C0000724FBE7FE48052181700021017041708B +:10F8D000C17081607047FB490A78022A06D0CA6865 +:10F8E0001044C860C8683238F2F7A5B88A68104476 +:10F8F00088608868F7E70378F349F44A13B1012B6D +:10F900000ED011E00379012B00D06BB943790BB114 +:10F91000012B09D18368643B8B4205D2C0680EE09D +:10F920000379012B02D00BB10020704743790BB152 +:10F93000012BF9D1C368643B8B42F5D280689042B9 +:10F94000F2D8012070472DE9F04704460226F1F76E +:10F9500000FB006800B1FFDFD94D01273CB12078E2 +:10F96000B0B1012805D0022810D0032813D02F7180 +:10F970000CE06068C82807D3F2F7DCF820B16068B3 +:10F98000FFF7A9FF012603E0002601E000F0AFF930 +:10F990003046BDE8F08728780028F7D16068FFF787 +:10F9A000AAFF0028E3D06068DFF81883007810B35E +:10F9B000A878042800D0FFDF0020474688F8000020 +:10F9C00060680079C0B30020387160684079A0B3E6 +:10F9D0000420787160688168E868F0F770FFB860AB +:10F9E0006068C0683230F8600320A870B549E878D4 +:10F9F000F1F7DDF8CAE74FF00209404688F80090B9 +:10FA000061680979D1B10021017161684979B9B1A1 +:10FA10000421417161688968323181606168C96817 +:10FA2000C160C068A64C14346060F0F72FFF2060FE +:10FA30006F7085F80290A9E704E005E00321E3E791 +:10FA40000321E6E70120BFE70320C2E72DE9F047E5 +:10FA50009B4C8846E178884200D0FFDFDFF8609257 +:10FA600000250127974E09F11409B8F1090F76D244 +:10FA7000DFE808F0050D2A3D646A769E7E00A078D6 +:10FA8000032886D0A078022883D0FFDF81E7A07802 +:10FA9000032803D0A078022800D0FFDF0420A07044 +:10FAA0002571207800285FD1FFF715FF30780228F4 +:10FAB00006D0B068E06000F06CF92061002048E0FA +:10FAC000E078F0F71AFFF5E7A078032803D0A078D4 +:10FAD000022800D0FFDF207878BBA078032812D15D +:10FAE000042026E00420F2F71FFAA57051E7A07861 +:10FAF000032803D0A078022800D0FFDF2078E0B9E7 +:10FB0000A078032814D0F0F7C1FE01464F46D9F87B +:10FB10000000F1F7E4FF0028E4DB79688142E1DBD3 +:10FB2000081AF0606749E078BDE8F047F1F73FB8A0 +:10FB30000520F2F7F9F9A7702BE724E0A078042854 +:10FB400000D0FFDF022004E0A078042800D0FFDF0F +:10FB50000120A1688847FFF7F6FE05462EE027E062 +:10FB6000A078042800D0FFDFBDE8F04700F0BFB860 +:10FB7000A078042805D0607810B1A078022800D0C1 +:10FB8000FFDF207818B1BDE8F04700F0B9B8207960 +:10FB900020B10620F2F7C8F92571CCE7607828B1CA +:10FBA0004849E078F1F703F86570F2E60720C0E70E +:10FBB000FFDFEEE63DB1012D03D0FFDF022DF9D1CD +:10FBC000E7E60420C5E70320C3E770B5050005D0CC +:10FBD0003B4CA078052803D0112070BD102070BDCB +:10FBE0003B48F0F7EDFDE070E07818B1A56000202B +:10FBF000A07070BD032070BD314810B5017809B107 +:10FC0000112010BD817805290CD0817801290BD0F5 +:10FC1000817849B1012101708178012904D080786F +:10FC200010B103E00F2010BD00F06AF8002010BDF5 +:10FC30002DE9F041224E0446B07808B101280AD1DE +:10FC400064B12046FFF757FE50B120781D4D48B1F2 +:10FC5000B078012822D00F20BDE8F0811020FBE70A +:10FC60000720F9E702272F70207998B1002028712A +:10FC7000607988B104206871A0683230A860E068BB +:10FC8000E860E8680E4C14346060F0F7FFFD206017 +:10FC9000B77022E00320EAE70320ECE70020287099 +:10FCA000207900B3002028716079F0B104206871D8 +:10FCB000A168F068F0F703FEA860E068323009E060 +:10FCC00098010020341200203D860100FF1FA1078B +:10FCD0004DFA0100E8600320B0701049F078F0F7A9 +:10FCE00066FF0020B8E70320DDE70320DFE70C48CC +:10FCF00010B5006900F045F8BDE81040F0F7F3BC1E +:10FD000010B5074CE078F0F7ABFD0820F2F70CF9DE +:10FD10000520A07000202070607010BD34120020FB +:10FD2000980100201F490968014201D00120704755 +:10FD3000002070471B49091D0968014201D00120BC +:10FD4000704700207047174910310968014201D0FF +:10FD500001207047002070471249143109680142A0 +:10FD600001D0012070470020704710B50D4C206075 +:10FD7000201D01600B4810300260001D0360002050 +:10FD800010BD09490A6848F202139A4302430A6007 +:10FD90007047054A116848F2021301EA03009943CB +:10FDA0001160704700060040C80602407047704767 +:10FDB00070477047704740EA010310B59B070FD1A9 +:10FDC000042A0DD310C808C9121F9C42F8D020BACB +:10FDD00019BA884201D9012010BD4FF0FF3010BD83 +:10FDE0001AB1D30703D0521C07E0002010BD10F851 +:10FDF000013B11F8014B1B1B07D110F8013B11F817 +:10FE0000014B1B1B01D1921EF1D1184610BD032AD4 +:10FE100040F2308010F0030C00F0158011F8013B27 +:10FE2000BCF1020F624498BF11F801CB00F8013B0E +:10FE300038BF11F8013BA2F1040298BF00F801CBD2 +:10FE400038BF00F8013B11F0030300F02580083AA9 +:10FE5000C0F0088051F8043B083A51F804CBA0E800 +:10FE60000810F5E7121D5CBF51F8043B40F8043B55 +:10FE7000AFF30080D20724BF11F8013B11F801CB8A +:10FE800048BF11F8012B24BF00F8013B00F801CB5B +:10FE900048BF00F8012B704710B5203AC0F00B8026 +:10FEA000B1E81850203AA0E81850B1E81850A0E87E +:10FEB0001850BFF4F5AF5FEA027C24BFB1E81850D8 +:10FEC000A0E8185044BF18C918C0BDE810405FEA48 +:10FED000827C24BF51F8043B40F8043B08BF7047C4 +:10FEE000D20728BF31F8023B48BF11F8012B28BFC9 +:10FEF00020F8023B48BF00F8012B70474FF000028A +:10FF00000429C0F0128010F0030C00F01B80CCF12B +:10FF1000040CBCF1020F18BF00F8012BA8BF20F899 +:10FF2000022BA1EB0C0100F00DB85FEAC17C24BFED +:10FF300000F8012B00F8012B48BF00F8012B704797 +:10FF40004FF0000200B5134694469646203922BF72 +:10FF5000A0E80C50A0E80C50B1F12001BFF4F7AFBD +:10FF6000090728BFA0E80C5048BF0CC05DF804EB9F +:10FF7000890028BF40F8042B08BF704748BF20F80D +:10FF8000022B11F0804F18BF00F8012B704770470B +:10FF90007047704770470000FEDF0420714608423A +:10FFA00019D10699134A914215DC0699023948780D +:10FFB000DF2810D10878FE2807D0FF280BD14FF09A +:10FFC00001004FF000020C4B184741F2010000996C +:10FFD000019A094B184706980599084B002B02D047 +:10FFE0001B68DB6818474FF0FF304FF00001724686 +:10FFF000014B184700100200B9F501000400002071 +:020000040002F8 +:10000000184819497047FFF7FBFFE1F7C7F800BD33 +:100010004FF4805015490968884203D1144A13608F +:100020005B68184700BD000020BFFDE74FF480501B +:100030000E490968884210D10E4B18684FF0FF3105 +:100040008842F1D080F308884FF02021884204DDF7 +:100050000948026802210A430260084880470848AC +:100060008047FFDF481200204812002000000020D7 +:10007000040000200010020024050040B9280100FF +:100080001100020004207146084202D0EFF30981FA +:1000900001E0EFF30881886902380078102813DB4B +:1000A00020280FDB2B280BDB0A4A12680A4B9A42E6 +:1000B00003D1602804DB094A10470220086070471A +:1000C000074A1047074A1047074A12682C3212683D +:1000D00010470000A0000020BEBAFECA09130000AD +:1000E000A9ED010027F70100040000200E4B0F4985 +:1000F00008470F4B0D4908470E4B0C4908470E4B5C +:100100000A4908470D4B094908470D4B074908475D +:100110000C4B064908470C4B044908470B4B034955 +:1001200008470B4B01490847E59A0000AD9F0000C6 +:1001300049980000A596000029960000BF9C000089 +:1001400025130000B32F0000C9970000359F000061 +:10015000A911000000210160818070470021016029 +:100160004160017270470A6802600B790371704741 +:10017000014901208860704700F00040032918BF42 +:100180007047B0F5296F38BF4FF429607047000001 +:1001900057840000078600002B8400000B870000B6 +:1001A0002F870000698700009D870000D787000027 +:1001B0000788000059880000911200009112000089 +:1001C000BF230000FF23000021240000DB240000E7 +:1001D00017260000EB26000025270000E927000075 +:1001E000A11F0000212A0000032B0000232B000088 +:1001F0008B320000AF320000DF31000033320000EC +:10020000E1320000753300001F460000E3470000A4 +:100210008B4B0000A74C00002B4D0000C94D000087 +:100220003B4E0000574F000025500000A350000037 +:100230003D2B0000432B00004D2B0000631F0000EE +:100240001D2C0000351F0000732D0000CB2D000079 +:100250009112000091120000911200009112000012 +:10026000AD5B0000335C00004F5C00006B5C000085 +:10027000F95D0000955C00009F5C0000E15C0000FF +:10028000035D0000DF5D0000215E000091120000B0 +:100290001D7400003D7400003F740000797400007C +:1002A000A77400009D7500002B7600003F760000CB +:1002B0008D760000737700001D790000497A0000F8 +:1002C00097650000617A0000911200009112000011 +:1002D000D7920000179300003B930000100110011B +:1002E0003A0200001A02000405060000FFFFFFFFAB +:1002F0000000FFFFE58C0000A71B0000395800003C +:10030000E1650000D77E000000000000297C0000AD +:10031000577F0000377F0000000000000000000051 +:1003200000000000000000000000000000000000CD +:1003300000000000000000000000000000000000BD +:1003400089C700000DC80000000000000000000088 +:10035000000000000DC900000000000000000000C7 +:100360000000000071DB0000000000000000000041 +:1003700000000000D9CB000041D7000000000000C1 +:1003800007D800007BD8000000000000D5D0000096 +:100390008DD100000000000041D800007DD2000097 +:1003A00095D4000007D500000BD600008BCD0000CF +:1003B00000000000000000009DCC000000000000D4 +:1003C00011CA00006FC90000A1D60000E5D90000E5 +:1003D0005DDA0000000000005BC800008BC8000070 +:1003E000BBC7000000000000D5C8000000000000EE +:1003F0000000000000000000B5DA0000000000006E +:100400001DCE000000000000000000000000000001 +:100410000000000001CF00000000000097CB0000AA +:100420009BC900005FCB00000000000027CB00004C +:1004300000000000000000001DDB000045CA0000B5 +:1004400047C90000BFDB000019DD000011CC00002F +:10045000CFDC0000000000003FDC000095DC000065 +:100460008BD00000CD3C0000CD3C00009B23000061 +:10047000498C0000636800000D5800000000000077 +:100480009DA70100113D0000113D0000BD230000AB +:10049000A38C0000CF680000175800009F91010056 +:1004A000C3A70100BC01BC013E002C005000140099 +:1004B0003001800101000000010000000001020382 +:1004C00004000F10111200000013000029EB0100BE +:1004D000F7EB010049EC010095EC0100E9EC0100AB +:1004E00023E6010045E70100ADE70100D1E9010085 +:1004F000B3EA010017EF0000F1FF00000000000068 +:10050000060000000A000000320000007300000036 +:10051000B4000000E97B0100796A0100B5430100E5 +:1005200029C201007356010029C2010021440100C3 +:1005300035C40100114F010035C401002D430100F5 +:1005400059C301004755010059C301005F4701002D +:1005500045C70100FB56010045C701000004F4F443 +:10056000FE00F1F1FF000000131708080000E8E8A2 +:10057000FC02E8E800000000F8FF0808555555D6D1 +:10058000BE898E0000006606F30C801300000A038B +:100590003B066C0900005604D308500D55555525EF +:1005A0002627D6BE898EF401FA00960064004B001F +:1005B00032001E00140000002509000000000000A9 +:1005C00000000300656C7462000000000000000081 +:1005D0000000000000000000870000000000000094 +:1005E0000000000000000000BE83605ADB0B376093 +:1005F00038A5F5AA9183886C19F4010031F4010043 +:1006000049F4010061F4010091F40100B9F4010022 +:10061000E3F4010017F5010093F10100F3F001008C +:10062000F7F1010051F2010061F201008DF20100C9 +:10063000DF200100E7200100F5200100BBF20100EE +:10064000D5F20100A9F20100B3F20100E1F20100CC +:1006500017F3010063F3010071F301007FF3010060 +:100660008BF30100A3F30100BBF30100D1F3010000 +:1006700000000000AB9800000199000017990000ED +:1006800069F801001DEE0100E3EE0100CBFB010063 +:10069000F9FB010031FC0100D51E0100B923010066 +:1006A0001C0500402005004000100200CC0602009E +:1006B00008000020AC01000044110000F006020018 +:1006C000B40100209410000080110000013F0222BC +:1006D000173601000100703720FB349B5F80041F38 +:1006E000800010022C01337F0102A829024410006F +:00000001FF diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_mbr.h deleted file mode 100644 index db75b1d2c9..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/softdevice/s140/nrf_mbr.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -/** - @defgroup nrf_mbr_api Master Boot Record API - @{ - - @brief APIs for updating SoftDevice and BootLoader - -*/ - -/* Header guard */ -#ifndef NRF_MBR_H__ -#define NRF_MBR_H__ - -#include "nrf_svc.h" -#include - -#ifndef NRF52840_XXAA -#error "This header file shall only be included for nRF52 projects" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup NRF_MBR_DEFINES Defines - * @{ */ - -/**@brief MBR SVC Base number. */ -#define MBR_SVC_BASE (0x18) - -/**@brief Page size in words. */ -#define MBR_PAGE_SIZE_IN_WORDS (1024) - -/** @brief The size that must be reserved for the MBR when a softdevice is written to flash. -This is the offset where the first byte of the softdevice hex file is written.*/ -#define MBR_SIZE (0x1000) - -/** @} */ - -/** @addtogroup NRF_MBR_ENUMS Enumerations - * @{ */ - -/**@brief nRF Master Boot Record API SVC numbers. */ -enum NRF_MBR_SVCS -{ - SD_MBR_COMMAND = MBR_SVC_BASE, /**< ::sd_mbr_command */ -}; - -/**@brief Possible values for ::sd_mbr_command_t.command */ -enum NRF_MBR_COMMANDS -{ - SD_MBR_COMMAND_COPY_BL, /**< Copy a new BootLoader. @see sd_mbr_command_copy_bl_t */ - SD_MBR_COMMAND_COPY_SD, /**< Copy a new SoftDevice. @see ::sd_mbr_command_copy_sd_t*/ - SD_MBR_COMMAND_INIT_SD, /**< Init forwarding interrupts to SD, and run reset function in SD*/ - SD_MBR_COMMAND_COMPARE, /**< This command works like memcmp. @see ::sd_mbr_command_compare_t*/ - SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, /**< Start forwarding all exception to this address @see ::sd_mbr_command_vector_table_base_set_t*/ -}; - -/** @} */ - -/** @addtogroup NRF_MBR_TYPES Types - * @{ */ - -/**@brief This command copies part of a new SoftDevice - * The destination area is erased before copying. - * If dst is in the middle of a flash page, that whole flash page will be erased. - * If (dst+len) is in the middle of a flash page, that whole flash page will be erased. - * - * The user of this function is responsible for setting the BPROT registers. - * - * @retval ::NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly. - * @retval ::NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. - */ -typedef struct -{ - uint32_t *src; /**< Pointer to the source of data to be copied.*/ - uint32_t *dst; /**< Pointer to the destination where the content is to be copied.*/ - uint32_t len; /**< Number of 32 bit words to copy. Must be a multiple of @ref MBR_PAGE_SIZE_IN_WORDS words.*/ -} sd_mbr_command_copy_sd_t; - - -/**@brief This command works like memcmp, but takes the length in words. - * - * @retval ::NRF_SUCCESS indicates that the contents of both memory blocks are equal. - * @retval ::NRF_ERROR_NULL indicates that the contents of the memory blocks are not equal. - */ -typedef struct -{ - uint32_t *ptr1; /**< Pointer to block of memory. */ - uint32_t *ptr2; /**< Pointer to block of memory. */ - uint32_t len; /**< Number of 32 bit words to compare.*/ -} sd_mbr_command_compare_t; - - -/**@brief This command copies a new BootLoader. - * With this command, destination of BootLoader is always the address written in NRF_UICR->BOOTADDR. - * - * Destination is erased by this function. - * If (destination+bl_len) is in the middle of a flash page, that whole flash page will be erased. - * - * This function will use PROTENSET to protect the flash that is not intended to be written. - * - * On Success, this function will not return. It will start the new BootLoader from reset-vector as normal. - * - * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. - * @retval ::NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. - * @retval ::NRF_ERROR_INVALID_LENGTH if parameters attempts to read or write outside flash area. - * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) - */ -typedef struct -{ - uint32_t *bl_src; /**< Pointer to the source of the Bootloader to be be copied.*/ - uint32_t bl_len; /**< Number of 32 bit words to copy for BootLoader. */ -} sd_mbr_command_copy_bl_t; - -/**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the MBR - * - * Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset. - * - * To restore default forwarding this function should be called with @param address set to 0. - * The MBR will then start forwarding to interrupts to the address in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. - * - * On Success, this function will not return. It will reset the device. - * - * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. - * @retval ::NRF_ERROR_INVALID_ADDR if parameter address is outside of the flash size. - * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) - */ -typedef struct -{ - uint32_t address; /**< The base address of the interrupt vector table for forwarded interrupts.*/ -} sd_mbr_command_vector_table_base_set_t; - - -typedef struct -{ - uint32_t command; /**< type of command to be issued see @ref NRF_MBR_COMMANDS. */ - union - { - sd_mbr_command_copy_sd_t copy_sd; /**< Parameters for copy SoftDevice.*/ - sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ - sd_mbr_command_copy_bl_t copy_bl; /**< Parameters for copy BootLoader. Requires parameter page. */ - sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set. Requires parameter page.*/ - } params; -} sd_mbr_command_t; - -/** @} */ - -/** @addtogroup NRF_MBR_FUNCTIONS Functions - * @{ */ - -/**@brief Issue Master Boot Record commands - * - * Commands used when updating a SoftDevice and bootloader. - * - * The SD_MBR_COMMAND_COPY_BL and SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET requires parameters to be - * retained by the MBR when resetting the IC. This is done in a separate flash page - * provided by the application. The uicr register UICR.NRFFW[1] must be set - * to an address corresponding to a page in the application flash space. This page will be cleared - * by the MBR and used to store the command before reset. When the UICR.NRFFW[1] field is set - * the page it refers to must not be used by the application. If the UICR.NRFFW[1] is set to - * 0xFFFFFFFF (the default) MBR commands which use flash will be unavailable and return - * NRF_ERROR_NO_MEM. - * - * @param[in] param Pointer to a struct describing the command. - * - * @note for retvals see ::sd_mbr_command_copy_sd_t ::sd_mbr_command_copy_bl_t ::sd_mbr_command_compare_t ::sd_mbr_command_vector_table_base_set_t - * - * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). - * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. -*/ -SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); - -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif // NRF_MBR_H__ - -/** - @} -*/ From 5ebcb3ec125c63b8e41c2d7f04fe93eb538afe0e Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 15 Dec 2016 09:52:33 +0100 Subject: [PATCH 05/31] fix- sdk updste script bug causing losing of nested directory when coping file by forced directory. --- .../TARGET_NRF5_SDK13/porting_tools/sdk_update.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py index c37d0e68e4..a02ea559de 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py @@ -158,7 +158,16 @@ def upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, verb if 0 == string.find(pathes_sdk["cutted_root"], hard_copy_dir["sdk_dir"]): make_hard_copy = True - upgrade_copying_list(copy_list, pathes_sdk, hard_copy_dir["mbed_dir"], print_list) + + post_path = os.path.relpath(pathes_sdk["cutted_root"], hard_copy_dir["sdk_dir"]) + + if post_path == '.': + corect_hard_copy_dir = hard_copy_dir["mbed_dir"] + if post_path != '.': # destynation is a nested directory + corect_hard_copy_dir = os.path.join(hard_copy_dir["mbed_dir"], post_path) + + + upgrade_copying_list(copy_list, pathes_sdk, corect_hard_copy_dir, print_list) break From 9bf209ef00ad3c68898257e67b01b98ec315275f Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 15 Dec 2016 13:46:29 +0100 Subject: [PATCH 06/31] fix: align nRF5 v13 sdk struct to origin --- .../porting_tools/sdk_update.py | 49 +++++++++++-------- .../porting_tools/update_desc.json | 2 + .../sdio/{ => config}/sdio_config.h | 0 .../bootloader/{ => ble_dfu}/nrf_ble_dfu.c | 0 .../bootloader/{ => ble_dfu}/nrf_ble_dfu.h | 0 .../libraries/bootloader/{ => dfu}/nrf_dfu.c | 0 .../libraries/bootloader/{ => dfu}/nrf_dfu.h | 0 .../bootloader/{ => dfu}/nrf_dfu_flash.c | 0 .../bootloader/{ => dfu}/nrf_dfu_flash.h | 0 .../bootloader/{ => dfu}/nrf_dfu_mbr.c | 0 .../bootloader/{ => dfu}/nrf_dfu_mbr.h | 0 .../{ => dfu}/nrf_dfu_req_handler.h | 0 .../bootloader/{ => dfu}/nrf_dfu_settings.c | 0 .../bootloader/{ => dfu}/nrf_dfu_settings.h | 0 .../bootloader/{ => dfu}/nrf_dfu_transport.c | 0 .../bootloader/{ => dfu}/nrf_dfu_transport.h | 0 .../bootloader/{ => dfu}/nrf_dfu_types.h | 0 .../bootloader/{ => dfu}/nrf_dfu_utils.c | 0 .../bootloader/{ => dfu}/nrf_dfu_utils.h | 0 .../log/{ => src}/nrf_log_backend_serial.c | 0 .../log/{ => src}/nrf_log_ctrl_internal.h | 0 .../log/{ => src}/nrf_log_frontend.c | 0 .../log/{ => src}/nrf_log_internal.h | 0 23 files changed, 31 insertions(+), 20 deletions(-) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/{ => config}/sdio_config.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => ble_dfu}/nrf_ble_dfu.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => ble_dfu}/nrf_ble_dfu.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_flash.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_flash.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_mbr.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_mbr.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_req_handler.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_settings.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_settings.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_transport.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_transport.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_types.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_utils.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/{ => dfu}/nrf_dfu_utils.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/{ => src}/nrf_log_backend_serial.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/{ => src}/nrf_log_ctrl_internal.h (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/{ => src}/nrf_log_frontend.c (100%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/{ => src}/nrf_log_internal.h (100%) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py index a02ea559de..752afaa2a4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/sdk_update.py @@ -145,7 +145,7 @@ def upgrade_copying_list(copy_list, pathes_sdk, dest_mbed_dir_path, print_list): -def upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, verbose = False): +def upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, port_relative_dir = '',verbose = False): print_list = [] for pathes_sdk in list_sdk: @@ -166,6 +166,7 @@ def upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, verb if post_path != '.': # destynation is a nested directory corect_hard_copy_dir = os.path.join(hard_copy_dir["mbed_dir"], post_path) + corect_hard_copy_dir = os.path.join(port_relative_dir, corect_hard_copy_dir) upgrade_copying_list(copy_list, pathes_sdk, corect_hard_copy_dir, print_list) break @@ -178,7 +179,7 @@ def upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, verb str_verbose = "{0} --> {1}" print(str_verbose.format(item["id"], item["dest_path"])) -def upgrade_copying_list_by_files(copy_list, list_sdk, force_copy_files_list, verbose = False): +def upgrade_copying_list_by_files(copy_list, list_sdk, force_copy_files_list, port_relative_dir ='',verbose = False): print_list = [] for pathes_sdk in list_sdk: @@ -189,7 +190,10 @@ def upgrade_copying_list_by_files(copy_list, list_sdk, force_copy_files_list, ve for hard_copy_file in force_copy_files_list: if pathes_sdk["id"] == hard_copy_file["sdk_file"]: make_hard_copy = True - upgrade_copying_list(copy_list, pathes_sdk, hard_copy_file["mbed_dir"], print_list) + + corect_hard_copy_dir = os.path.join(port_relative_dir, hard_copy_file["mbed_dir"]) + + upgrade_copying_list(copy_list, pathes_sdk, corect_hard_copy_dir, print_list) break print("\r\nforced copy of files by files: {0:#d}".format(len(print_list))) @@ -199,22 +203,27 @@ def upgrade_copying_list_by_files(copy_list, list_sdk, force_copy_files_list, ve str_verbose = "{0} --> {1}" print(str_verbose.format(item["id"], item["dest_path"])) -def copy_one_file(src, dest, verbose=False): +def copy_one_file(src, dest, verbose=False,dry_run=False): dirs_to_created = os.path.dirname(dest) if not os.path.exists(dirs_to_created): - os.makedirs(dirs_to_created) - print('makerdirs: {0}'.format(dirs_to_created)) + if not dry_run: + os.makedirs(dirs_to_created) + + if verbose: + print('makerdirs: {0}'.format(dirs_to_created)) - shutil.copyfile(src, dest) - print('copy: {0} --> {1}'.format(src, dest)) - - + if not dry_run: + shutil.copyfile(src, dest) + + if verbose: + print('copy: {0} --> {1}'.format(src, dest)) + if __name__ == '__main__': argument_parser = argparse.ArgumentParser() - argument_parser.add_argument('-n', '--dry_run', help='Dry run', action='store_true') + argument_parser.add_argument('-r', '--run', help='run', action='store_true') argument_parser.add_argument('-v', '--verbose', help='Verbose mode', action='store_true') #argument_parser.add_argument('-r', '--rename_only', help='rename only', action='store_true') @@ -222,7 +231,7 @@ if __name__ == '__main__': verbose = False - if parser_args['verbose'] or parser_args['dry_run']: + if parser_args['verbose'] or not parser_args['run']: verbose = True with open('update_desc.json') as data_file: @@ -237,6 +246,7 @@ if __name__ == '__main__': force_copy_dirs_list = update_desc['force_copy_dirs_list'] sdk_dirs_in_mbed = update_desc['sdk_dirs_in_mbed'] sdk_component_path = update_desc['sdk_component_path'] + port_relative_dir = update_desc['port_relative_dir_in_mbed'] list_sdk = get_file_pathes_couples(sdk_component_path, ignore_dirs_list, @@ -252,17 +262,16 @@ if __name__ == '__main__': copy_list = get_copying_automatic_list(list_mbed, list_sdk, mbed_port_path, verbose) - upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, verbose) - upgrade_copying_list_by_files(copy_list, list_sdk, force_copy_files_list, verbose) + upgrade_copying_list_by_dirs(copy_list, list_sdk, force_copy_dirs_list, port_relative_dir, verbose) + upgrade_copying_list_by_files(copy_list, list_sdk, force_copy_files_list, port_relative_dir, verbose) - rename_dirs(sdk_dirs_in_mbed, '_old_sdk', parser_args['dry_run']) + rename_dirs(sdk_dirs_in_mbed, '_old_sdk', not parser_args['run']) - if not parser_args['dry_run']: - for copy_item in copy_list: - src = os.path.join('.',copy_item["src_path"]) - dest = os.path.join('.',copy_item["dest_path"]) + for copy_item in copy_list: + src = os.path.join('.',copy_item["src_path"]) + dest = os.path.join('.',copy_item["dest_path"]) - copy_one_file(src, dest, verbose) + copy_one_file(src, dest, verbose, not parser_args['run']) with open('sdk_update_result.json', 'w') as fp: json.dump(copy_list, fp) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/update_desc.json b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/update_desc.json index 0caeea001f..abbb58c4bb 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/update_desc.json +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/update_desc.json @@ -116,5 +116,7 @@ "..\\TARGET_MCU_NRF52832\\sdk" ], + "port_relative_dir_in_mbed" : "..", + "sdk_component_path": "C:\\nRF5_SDK_13.0.0-1.alpha_055eef3\\components" } \ No newline at end of file diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/config/sdio_config.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/sdio_config.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/sdio/config/sdio_config.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_ble_dfu.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_flash.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_flash.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_flash.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_flash.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_flash.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_mbr.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_req_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_req_handler.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_req_handler.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_req_handler.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_settings.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_transport.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_transport.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_transport.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_transport.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_transport.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_types.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_types.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_types.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_dfu_utils.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend_serial.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/src/nrf_log_backend_serial.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_backend_serial.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/src/nrf_log_backend_serial.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/src/nrf_log_ctrl_internal.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_ctrl_internal.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/src/nrf_log_ctrl_internal.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_frontend.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/src/nrf_log_frontend.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_frontend.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/src/nrf_log_frontend.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/src/nrf_log_internal.h similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/nrf_log_internal.h rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/log/src/nrf_log_internal.h From a175e2ce316dbf9460e5b7a19c231a63b187e2da Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 19 Dec 2016 11:31:15 +0100 Subject: [PATCH 07/31] + description of the NRF52840_DK target + mbed RTx setings for nRF52840 fix build of test for NRF52840 + few sdk's missing filess - few sdk's unvanted files corect mbed HAL implementation to changes made in sdk v13 --- rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h | 3 +- .../{NRF52832.ld => NRF52840.ld} | 4 +- .../TARGET_MCU_NRF52840/device/cmsis_nvic.h | 2 +- .../TARGET_MCU_NRF52840/device/system_nrf52.c | 321 -- .../TARGET_MCU_NRF52840/device/system_nrf52.h | 78 - .../device/system_nrf52840.c | 209 + .../device/system_nrf52840.h | 69 + .../TARGET_MCU_NRF52840/pwmout_api.c | 2 +- .../TARGET_MCU_NRF52840/sdk/nrf_drv_config.h | 495 --- .../TARGET_MCU_NRF52840/sdk/sdk_config.h | 3494 +++++++++++++++++ .../TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c | 2 +- .../sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c | 119 - .../sdk/ble/ble_services/ble_dfu/ble_dfu.c | 414 -- .../sdk/ble/ble_services/ble_dfu/ble_dfu.h | 152 - .../sdk/boards/arduino_primo.h | 89 + .../TARGET_NRF5_SDK13/sdk/boards/boards.c | 137 + .../TARGET_NRF5_SDK13/sdk/boards/boards.h | 291 ++ .../sdk/boards/d52_starterkit.h | 98 + .../sdk/boards/n5_starterkit.h | 97 + .../TARGET_NRF5_SDK13/sdk/boards/nrf6310.h | 158 + .../TARGET_NRF5_SDK13/sdk/boards/pca10000.h | 75 + .../TARGET_NRF5_SDK13/sdk/boards/pca10001.h | 142 + .../TARGET_NRF5_SDK13/sdk/boards/pca10003.h | 70 + .../TARGET_NRF5_SDK13/sdk/boards/pca10028.h | 152 + .../TARGET_NRF5_SDK13/sdk/boards/pca10031.h | 69 + .../TARGET_NRF5_SDK13/sdk/boards/pca10036.h | 154 + .../TARGET_NRF5_SDK13/sdk/boards/pca10040.h | 154 + .../TARGET_NRF5_SDK13/sdk/boards/pca10056.h | 138 + .../TARGET_NRF5_SDK13/sdk/boards/pca20006.h | 71 + .../TARGET_NRF5_SDK13/sdk/boards/wt51822.h | 66 + .../TARGET_NRF5_SDK13/sdk/device/nrf.h | 1 + .../sdk/drivers_nrf/hal/nrf_power.h | 1011 +++++ .../sdk/drivers_nrf/power/nrf_drv_power.c | 244 ++ .../sdk/drivers_nrf/power/nrf_drv_power.h | 321 ++ .../sdk/drivers_nrf/swi/nrf_drv_swi.c | 407 -- .../sdk/drivers_nrf/swi/nrf_drv_swi.h | 191 - .../twis_slave/nrf_drv_twis_inst.def | 20 + .../sdk/drivers_nrf/uart/nrf_drv_uart.c | 972 ----- .../sdk/drivers_nrf/uart/nrf_drv_uart.h | 429 -- .../sdk/libraries/crc32/crc32.c | 33 + .../sdk/libraries/crc32/crc32.h | 52 + .../sdk/libraries/queue/nrf_queue.c | 407 ++ .../sdk/libraries/queue/nrf_queue.h | 374 ++ .../sdk/libraries/svc/nrf_svc_function.h | 86 - .../sdk/libraries/svc/nrf_svc_handler.c | 180 - .../sdk/libraries/svc/nrf_svci.h | 158 - .../sdk/libraries/timer/app_timer.c | 1050 +++++ .../sdk/libraries/timer/app_timer.h | 295 ++ .../sdk/libraries/timer/app_timer_appsh.c | 34 + .../sdk/libraries/timer/app_timer_appsh.h | 53 + .../sdk/libraries/timer/app_timer_ble_gzll.c | 1050 +++++ .../libraries/timer/app_timer_dox_config.h | 37 + .../sdk/libraries/timer/app_timer_freertos.c | 230 ++ .../sdk/libraries/timer/app_timer_rtx.c | 256 ++ .../sdk/libraries/util/nrf_bitmask.h | 118 + .../TARGET_NRF5_SDK13/serial_api.c | 15 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c | 4 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c | 12 +- .../TARGET_NRF5_SDK13/us_ticker.c | 3 +- targets/TARGET_NORDIC/mbed_rtx.h | 17 +- targets/targets.json | 46 + 61 files changed, 11404 insertions(+), 4027 deletions(-) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/{NRF52832.ld => NRF52840.ld} (97%) delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52840.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52840.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/nrf_drv_config.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/arduino_primo.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/d52_starterkit.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/n5_starterkit.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/nrf6310.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10000.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10001.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10003.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10028.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10031.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10036.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10040.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10056.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca20006.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/wt51822.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_power.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis_inst.def delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_function.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_handler.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svci.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_ble_gzll.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_dox_config.h create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_freertos.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c create mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_bitmask.h diff --git a/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h b/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h index b96ef812c3..410007facb 100644 --- a/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h +++ b/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h @@ -354,7 +354,8 @@ __attribute__((used)) void _mutex_release (OS_ID *mutex) { /* Main Thread definition */ extern void pre_main (void); -#if defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832) || defined (TARGET_STM32F334R8) ||\ +#if defined(TARGET_MCU_NRF52832) ||\ + defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832) || defined (TARGET_STM32F334R8) ||\ defined(TARGET_STM32F070RB) || defined(TARGET_STM32F072RB) || \ defined(TARGET_STM32F302R8) || defined(TARGET_STM32F303K8) || defined (TARGET_STM32F334C8) ||\ defined(TARGET_STM32F103RB) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52832.ld b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld similarity index 97% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52832.ld rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld index d049cd8818..bc606efb0a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52832.ld +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld @@ -18,8 +18,8 @@ MEMORY { - FLASH (rx) : ORIGIN = 0x1C000, LENGTH = 0x64000 - RAM (rwx) : ORIGIN = 0x20002ef8, LENGTH = 0xd108 + FLASH (rx) : ORIGIN = 0x21000, LENGTH = 0xDF000 + RAM (rwx) : ORIGIN = 0x20002ef8, LENGTH = 0x3d108 } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h index 0837075c40..1c3b6809e0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h @@ -35,7 +35,7 @@ #define NVIC_NUM_VECTORS (16 + 38) // CORE + MCU Peripherals #define NVIC_USER_IRQ_OFFSET 16 -#include "nrf52.h" +#include "nrf.h" #include "cmsis.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.c deleted file mode 100644 index 89d125a37d..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#include -#include -#include "nrf.h" -#include "system_nrf52.h" -#include "nrf5x_lf_clk_helper.h" - -/*lint ++flb "Enter library region" */ - -#define __SYSTEM_CLOCK_64M (64000000UL) - -static bool errata_16(void); -static bool errata_31(void); -static bool errata_32(void); -static bool errata_36(void); -static bool errata_37(void); -static bool errata_57(void); -static bool errata_66(void); - - -#if defined ( __CC_ARM ) - uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; -#elif defined ( __ICCARM__ ) - __root uint32_t SystemCoreClock = __SYSTEM_CLOCK_64M; -#elif defined ( __GNUC__ ) - uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; -#endif - -void SystemCoreClockUpdate(void) -{ - SystemCoreClock = __SYSTEM_CLOCK_64M; -} - -void SystemInit(void) -{ - /* Workaround for Errata 16 "System: RAM may be corrupt on wakeup from CPU IDLE" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_16()){ - *(volatile uint32_t *)0x4007C074 = 3131961357ul; - } - - /* Workaround for Errata 31 "CLOCK: Calibration values are not correctly loaded from FICR at reset" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_31()){ - *(volatile uint32_t *)0x4000053C = ((*(volatile uint32_t *)0x10000244) & 0x0000E000) >> 13; - } - - /* Workaround for Errata 32 "DIF: Debug session automatically enables TracePort pins" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_32()){ - CoreDebug->DEMCR &= ~CoreDebug_DEMCR_TRCENA_Msk; - } - - /* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_36()){ - NRF_CLOCK->EVENTS_DONE = 0; - NRF_CLOCK->EVENTS_CTTO = 0; - NRF_CLOCK->CTIV = 0; - } - - /* Workaround for Errata 37 "RADIO: Encryption engine is slow by default" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_37()){ - *(volatile uint32_t *)0x400005A0 = 0x3; - } - - /* Workaround for Errata 57 "NFCT: NFC Modulation amplitude" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_57()){ - *(volatile uint32_t *)0x40005610 = 0x00000005; - *(volatile uint32_t *)0x40005688 = 0x00000001; - *(volatile uint32_t *)0x40005618 = 0x00000000; - *(volatile uint32_t *)0x40005614 = 0x0000003F; - } - - /* Workaround for Errata 66 "TEMP: Linearity specification not met with default settings" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_66()){ - NRF_TEMP->A0 = NRF_FICR->TEMP.A0; - NRF_TEMP->A1 = NRF_FICR->TEMP.A1; - NRF_TEMP->A2 = NRF_FICR->TEMP.A2; - NRF_TEMP->A3 = NRF_FICR->TEMP.A3; - NRF_TEMP->A4 = NRF_FICR->TEMP.A4; - NRF_TEMP->A5 = NRF_FICR->TEMP.A5; - NRF_TEMP->B0 = NRF_FICR->TEMP.B0; - NRF_TEMP->B1 = NRF_FICR->TEMP.B1; - NRF_TEMP->B2 = NRF_FICR->TEMP.B2; - NRF_TEMP->B3 = NRF_FICR->TEMP.B3; - NRF_TEMP->B4 = NRF_FICR->TEMP.B4; - NRF_TEMP->B5 = NRF_FICR->TEMP.B5; - NRF_TEMP->T0 = NRF_FICR->TEMP.T0; - NRF_TEMP->T1 = NRF_FICR->TEMP.T1; - NRF_TEMP->T2 = NRF_FICR->TEMP.T2; - NRF_TEMP->T3 = NRF_FICR->TEMP.T3; - NRF_TEMP->T4 = NRF_FICR->TEMP.T4; - } - - /* Enable the FPU if the compiler used floating point unit instructions. __FPU_USED is a MACRO defined by the - * compiler. Since the FPU consumes energy, remember to disable FPU use in the compiler if floating point unit - * operations are not used in your code. */ - #if (__FPU_USED == 1) - SCB->CPACR |= (3UL << 20) | (3UL << 22); - __DSB(); - __ISB(); - #endif - - /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined, - two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as - normal GPIOs. */ - #if defined (CONFIG_NFCT_PINS_AS_GPIOS) - if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){ - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NVIC_SystemReset(); - } - #endif - - /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not - defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be - reserved for PinReset and not available as normal GPIO. */ - #if defined (CONFIG_GPIO_AS_PINRESET) - if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) || - ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){ - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_UICR->PSELRESET[0] = 21; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_UICR->PSELRESET[1] = 21; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NVIC_SystemReset(); - } - #endif - - /* Enable SWO trace functionality. If ENABLE_SWO is not defined, SWO pin will be used as GPIO (see Product - Specification to see which one). */ - #if defined (ENABLE_SWO) - CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; - NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos; - NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - #endif - - /* Enable Trace functionality. If ENABLE_TRACE is not defined, TRACE pins will be used as GPIOs (see Product - Specification to see which ones). */ - #if defined (ENABLE_TRACE) - CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; - NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Parallel << CLOCK_TRACECONFIG_TRACEMUX_Pos; - NRF_P0->PIN_CNF[14] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - NRF_P0->PIN_CNF[15] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - NRF_P0->PIN_CNF[16] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - NRF_P0->PIN_CNF[20] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - #endif - - SystemCoreClockUpdate(); - - // Start the LF oscilator according to the mbed configuration (over the nrf5x_lf_clk_helper.h file) - NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_TO_USE << CLOCK_LFCLKSRC_SRC_Pos); - NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; - NRF_CLOCK->TASKS_LFCLKSTART = 1; - - // Wait for the external oscillator to start up. - while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) { - // Do nothing. - } -} - - -static bool errata_16(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - } - - return false; -} - -static bool errata_31(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) - { - return true; - } - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) - { - return true; - } - } - - return false; -} - -static bool errata_32(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - } - - return false; -} - -static bool errata_36(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) - { - return true; - } - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) - { - return true; - } - } - - return false; -} - -static bool errata_37(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - } - - return false; -} - -static bool errata_57(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - } - - return false; -} - -static bool errata_66(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) - { - return true; - } - } - - return false; -} - - -/*lint --flb "Leave library region" */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.h deleted file mode 100644 index 5ecc271059..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef SYSTEM_NRF52_H -#define SYSTEM_NRF52_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - -extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ - -/** - * Initialize the system - * - * @param none - * @return none - * - * @brief Setup the microcontroller system. - * Initialize the System and update the SystemCoreClock variable. - */ -extern void SystemInit (void); - -/** - * Update SystemCoreClock variable - * - * @param none - * @return none - * - * @brief Updates the SystemCoreClock with current core Clock - * retrieved from cpu registers. - */ -extern void SystemCoreClockUpdate (void); - -#ifdef __cplusplus -} -#endif - -#endif /* SYSTEM_NRF52_H */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52840.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52840.c new file mode 100644 index 0000000000..de2aa1d8c0 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52840.c @@ -0,0 +1,209 @@ +/* Copyright (c) 2012 ARM LIMITED + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of ARM nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include "nrf.h" +#include "system_nrf52840.h" + +/*lint ++flb "Enter library region" */ + +#define __SYSTEM_CLOCK_64M (64000000UL) + +static bool errata_36(void); +static bool errata_98(void); +static bool errata_103(void); +static bool errata_115(void); +static bool errata_120(void); + + +#if defined ( __CC_ARM ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; +#elif defined ( __ICCARM__ ) + __root uint32_t SystemCoreClock = __SYSTEM_CLOCK_64M; +#elif defined ( __GNUC__ ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; +#endif + +void SystemCoreClockUpdate(void) +{ + SystemCoreClock = __SYSTEM_CLOCK_64M; +} + +void SystemInit(void) +{ + /* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_36()){ + NRF_CLOCK->EVENTS_DONE = 0; + NRF_CLOCK->EVENTS_CTTO = 0; + NRF_CLOCK->CTIV = 0; + } + + /* Workaround for Errata 98 "NFCT: Not able to communicate with the peer" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_98()){ + *(volatile uint32_t *)0x4000568Cul = 0x00038148ul; + } + + /* Workaround for Errata 103 "CCM: Wrong reset value of CCM MAXPACKETSIZE" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_103()){ + NRF_CCM->MAXPACKETSIZE = 0xFBul; + } + + /* Workaround for Errata 115 "RAM: RAM content cannot be trusted upon waking up from System ON Idle or System OFF mode" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_115()){ + *(volatile uint32_t *)0x40000EE4 = (*(volatile uint32_t *)0x40000EE4 & 0xFFFFFFF0) | (*(uint32_t *)0x10000258 & 0x0000000F); + } + + /* Workaround for Errata 120 "QSPI: Data read or written is corrupted" found at the Errata document + for your device located at https://infocenter.nordicsemi.com/ */ + if (errata_120()){ + *(volatile uint32_t *)0x40029640ul = 0x200ul; + } + + /* Enable the FPU if the compiler used floating point unit instructions. __FPU_USED is a MACRO defined by the + * compiler. Since the FPU consumes energy, remember to disable FPU use in the compiler if floating point unit + * operations are not used in your code. */ + #if (__FPU_USED == 1) + SCB->CPACR |= (3UL << 20) | (3UL << 22); + __DSB(); + __ISB(); + #endif + + /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined, + two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as + normal GPIOs. */ + #if defined (CONFIG_NFCT_PINS_AS_GPIOS) + if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){ + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NVIC_SystemReset(); + } + #endif + + /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not + defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be + reserved for PinReset and not available as normal GPIO. */ + #if defined (CONFIG_GPIO_AS_PINRESET) + if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) || + ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){ + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->PSELRESET[0] = 18; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_UICR->PSELRESET[1] = 18; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; + while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} + NVIC_SystemReset(); + } + #endif + + /* Enable SWO trace functionality. If ENABLE_SWO is not defined, SWO pin will be used as GPIO (see Product + Specification to see which one). */ + #if defined (ENABLE_SWO) + CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; + NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos; + NRF_P1->PIN_CNF[0] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + #endif + + /* Enable Trace functionality. If ENABLE_TRACE is not defined, TRACE pins will be used as GPIOs (see Product + Specification to see which ones). */ + #if defined (ENABLE_TRACE) + CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; + NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Parallel << CLOCK_TRACECONFIG_TRACEMUX_Pos; + NRF_P0->PIN_CNF[7] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P1->PIN_CNF[0] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[12] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P0->PIN_CNF[11] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + NRF_P1->PIN_CNF[9] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + #endif + + SystemCoreClockUpdate(); +} + + +static bool errata_36(void) +{ + if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){ + return true; + } + + return false; +} + + +static bool errata_98(void) +{ + if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){ + return true; + } + + return false; +} + + +static bool errata_103(void) +{ + if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){ + return true; + } + + return false; +} + + +static bool errata_115(void) +{ + if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){ + return true; + } + + return false; +} + + +static bool errata_120(void) +{ + if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){ + return true; + } + + return false; +} + +/*lint --flb "Leave library region" */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52840.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52840.h new file mode 100644 index 0000000000..e4fb74a3b5 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/system_nrf52840.h @@ -0,0 +1,69 @@ +/* Copyright (c) 2012 ARM LIMITED + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of ARM nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef SYSTEM_NRF52840_H +#define SYSTEM_NRF52840_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + + +extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ + +/** + * Initialize the system + * + * @param none + * @return none + * + * @brief Setup the microcontroller system. + * Initialize the System and update the SystemCoreClock variable. + */ +extern void SystemInit (void); + +/** + * Update SystemCoreClock variable + * + * @param none + * @return none + * + * @brief Updates the SystemCoreClock with current core Clock + * retrieved from cpu registers. + */ +extern void SystemCoreClockUpdate (void); + +#ifdef __cplusplus +} +#endif + +#endif /* SYSTEM_NRF52840_H */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c index 97e29f256d..230ca3e9fe 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c @@ -369,7 +369,7 @@ static void internal_pwmout_exe(pwmout_t *obj, bool new_period, bool initializat NRF_DRV_PWM_PIN_NOT_USED, // channel 2 NRF_DRV_PWM_PIN_NOT_USED, // channel 3 }, - .irq_priority = PWM0_CONFIG_IRQ_PRIORITY, + .irq_priority = PWM_DEFAULT_CONFIG_IRQ_PRIORITY, .base_clock = pulsewidth_set.pwm_clk, .count_mode = NRF_PWM_MODE_UP, .top_value = pulsewidth_set.period_hwu, diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/nrf_drv_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/nrf_drv_config.h deleted file mode 100644 index 4443e68e64..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/nrf_drv_config.h +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef NRF_DRV_CONFIG_H -#define NRF_DRV_CONFIG_H - -/** - * Provide a non-zero value here in applications that need to use several - * peripherals with the same ID that are sharing certain resources - * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used - * simultaneously. Therefore, this definition allows to initialize the driver - * for another peripheral from a given group only after the previously used one - * is uninitialized. Normally, this is not possible, because interrupt handlers - * are implemented in individual drivers. - * This functionality requires a more complicated interrupt handling and driver - * initialization, hence it is not always desirable to use it. - */ -#define PERIPHERAL_RESOURCE_SHARING_ENABLED 1 - -/* CLOCK */ -#define CLOCK_ENABLED 1 - -#if (CLOCK_ENABLED == 1) -#define CLOCK_CONFIG_XTAL_FREQ NRF_CLOCK_XTALFREQ_Default -#define CLOCK_CONFIG_LF_SRC NRF_CLOCK_LFCLK_Xtal -#define CLOCK_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - -/* GPIOTE */ -#define GPIOTE_ENABLED 1 - -#if (GPIOTE_ENABLED == 1) -#define GPIOTE_CONFIG_USE_SWI_EGU false -#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 8 -#endif - -/* TIMER */ -#ifdef SOFTDEVICE_PRESENT -#define TIMER0_ENABLED 0 -#else -#define TIMER0_ENABLED 1 -#endif - -#if (TIMER0_ENABLED == 1) -#define TIMER0_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER0_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER0_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_32Bit -#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER0_INSTANCE_INDEX 0 -#endif - -#define TIMER1_ENABLED 1 - -#if (TIMER1_ENABLED == 1) -#define TIMER1_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER1_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER1_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER1_INSTANCE_INDEX (TIMER0_ENABLED) -#endif - -#define TIMER2_ENABLED 1 - -#if (TIMER2_ENABLED == 1) -#define TIMER2_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER2_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER2_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER2_INSTANCE_INDEX (TIMER1_ENABLED+TIMER0_ENABLED) -#endif - -#define TIMER3_ENABLED 0 - -#if (TIMER3_ENABLED == 1) -#define TIMER3_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER3_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER3_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER3_INSTANCE_INDEX (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED) -#endif - -#define TIMER4_ENABLED 0 - -#if (TIMER4_ENABLED == 1) -#define TIMER4_CONFIG_FREQUENCY NRF_TIMER_FREQ_16MHz -#define TIMER4_CONFIG_MODE TIMER_MODE_MODE_Timer -#define TIMER4_CONFIG_BIT_WIDTH TIMER_BITMODE_BITMODE_16Bit -#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TIMER4_INSTANCE_INDEX (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED) -#endif - - -#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED) - -/* RTC */ -#define RTC0_ENABLED 0 - -#if (RTC0_ENABLED == 1) -#define RTC0_CONFIG_FREQUENCY 32678 -#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define RTC0_CONFIG_RELIABLE false - -#define RTC0_INSTANCE_INDEX 0 -#endif - -#define RTC1_ENABLED 0 - -#if (RTC1_ENABLED == 1) -#define RTC1_CONFIG_FREQUENCY 32768 -#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define RTC1_CONFIG_RELIABLE false - -#define RTC1_INSTANCE_INDEX (RTC0_ENABLED) -#endif - -#define RTC2_ENABLED 0 - -#if (RTC2_ENABLED == 1) -#define RTC2_CONFIG_FREQUENCY 32768 -#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define RTC2_CONFIG_RELIABLE false - -#define RTC2_INSTANCE_INDEX (RTC0_ENABLED+RTC1_ENABLED) -#endif - - -#define RTC_COUNT (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED) - -#define NRF_MAXIMUM_LATENCY_US 2000 - -/* RNG */ -#define RNG_ENABLED 0 - -#if (RNG_ENABLED == 1) -#define RNG_CONFIG_ERROR_CORRECTION true -#define RNG_CONFIG_POOL_SIZE 8 -#define RNG_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - -/* PWM */ - -#define PWM0_ENABLED 1 - -#if (PWM0_ENABLED == 1) -#define PWM0_CONFIG_OUT0_PIN 2 -#define PWM0_CONFIG_OUT1_PIN 3 -#define PWM0_CONFIG_OUT2_PIN 4 -#define PWM0_CONFIG_OUT3_PIN 5 -#define PWM0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define PWM0_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz -#define PWM0_CONFIG_COUNT_MODE NRF_PWM_MODE_UP -#define PWM0_CONFIG_TOP_VALUE 1000 -#define PWM0_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON -#define PWM0_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO - -#define PWM0_INSTANCE_INDEX 0 -#endif - -#define PWM1_ENABLED 1 - -#if (PWM1_ENABLED == 1) -#define PWM1_CONFIG_OUT0_PIN 2 -#define PWM1_CONFIG_OUT1_PIN 3 -#define PWM1_CONFIG_OUT2_PIN 4 -#define PWM1_CONFIG_OUT3_PIN 5 -#define PWM1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define PWM1_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz -#define PWM1_CONFIG_COUNT_MODE NRF_PWM_MODE_UP -#define PWM1_CONFIG_TOP_VALUE 1000 -#define PWM1_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON -#define PWM1_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO - -#define PWM1_INSTANCE_INDEX (PWM0_ENABLED) -#endif - -#define PWM2_ENABLED 1 - -#if (PWM2_ENABLED == 1) -#define PWM2_CONFIG_OUT0_PIN 2 -#define PWM2_CONFIG_OUT1_PIN 3 -#define PWM2_CONFIG_OUT2_PIN 4 -#define PWM2_CONFIG_OUT3_PIN 5 -#define PWM2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define PWM2_CONFIG_BASE_CLOCK NRF_PWM_CLK_1MHz -#define PWM2_CONFIG_COUNT_MODE NRF_PWM_MODE_UP -#define PWM2_CONFIG_TOP_VALUE 1000 -#define PWM2_CONFIG_LOAD_MODE NRF_PWM_LOAD_COMMON -#define PWM2_CONFIG_STEP_MODE NRF_PWM_STEP_AUTO - -#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED) -#endif - -#define PWM_COUNT (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED) - -/* SPI */ -#define SPI0_ENABLED 1 - -#if (SPI0_ENABLED == 1) -#define SPI0_USE_EASY_DMA 0 - -#define SPI0_CONFIG_SCK_PIN 2 -#define SPI0_CONFIG_MOSI_PIN 3 -#define SPI0_CONFIG_MISO_PIN 4 -#define SPI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPI0_INSTANCE_INDEX 0 -#endif - -#define SPI1_ENABLED 1 - -#if (SPI1_ENABLED == 1) -#define SPI1_USE_EASY_DMA 0 - -#define SPI1_CONFIG_SCK_PIN 2 -#define SPI1_CONFIG_MOSI_PIN 3 -#define SPI1_CONFIG_MISO_PIN 4 -#define SPI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPI1_INSTANCE_INDEX (SPI0_ENABLED) -#endif - -#define SPI2_ENABLED 1 - -#if (SPI2_ENABLED == 1) -#define SPI2_USE_EASY_DMA 0 - -#define SPI2_CONFIG_SCK_PIN 2 -#define SPI2_CONFIG_MOSI_PIN 3 -#define SPI2_CONFIG_MISO_PIN 4 -#define SPI2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED) -#endif - -#define SPI_COUNT (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED) - -/* SPIS */ -#define SPIS0_ENABLED 1 - -#if (SPIS0_ENABLED == 1) -#define SPIS0_CONFIG_SCK_PIN 2 -#define SPIS0_CONFIG_MOSI_PIN 3 -#define SPIS0_CONFIG_MISO_PIN 4 -#define SPIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPIS0_INSTANCE_INDEX 0 -#endif - -#define SPIS1_ENABLED 1 - -#if (SPIS1_ENABLED == 1) -#define SPIS1_CONFIG_SCK_PIN 2 -#define SPIS1_CONFIG_MOSI_PIN 3 -#define SPIS1_CONFIG_MISO_PIN 4 -#define SPIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED -#endif - -#define SPIS2_ENABLED 1 - -#if (SPIS2_ENABLED == 1) -#define SPIS2_CONFIG_SCK_PIN 2 -#define SPIS2_CONFIG_MOSI_PIN 3 -#define SPIS2_CONFIG_MISO_PIN 4 -#define SPIS2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED) -#endif - -#define SPIS_COUNT (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED) - -/* UART */ -#define UART0_ENABLED 1 - -#if (UART0_ENABLED == 1) -#define UART0_CONFIG_HWFC NRF_UART_HWFC_ENABLED -#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED -#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_9600 -#define UART0_CONFIG_PSEL_TXD 6 -#define UART0_CONFIG_PSEL_RXD 8 -#define UART0_CONFIG_PSEL_CTS 7 -#define UART0_CONFIG_PSEL_RTS 5 -#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH -#ifdef NRF52 -#define UART0_CONFIG_USE_EASY_DMA false -//Compile time flag -#define UART_EASY_DMA_SUPPORT 1 -#define UART_LEGACY_SUPPORT 1 -#endif //NRF52 -#endif - -#define TWI0_ENABLED 1 - -#if (TWI0_ENABLED == 1) -#define TWI0_USE_EASY_DMA 0 - -#define TWI0_CONFIG_FREQUENCY NRF_TWI_FREQ_100K -#define TWI0_CONFIG_SCL 0 -#define TWI0_CONFIG_SDA 1 -#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TWI0_INSTANCE_INDEX 0 -#endif - -#define TWI1_ENABLED 1 - -#if (TWI1_ENABLED == 1) -#define TWI1_USE_EASY_DMA 0 - -#define TWI1_CONFIG_FREQUENCY NRF_TWI_FREQ_100K -#define TWI1_CONFIG_SCL 0 -#define TWI1_CONFIG_SDA 1 -#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - -#define TWI1_INSTANCE_INDEX (TWI0_ENABLED) -#endif - -#define TWI_COUNT (TWI0_ENABLED + TWI1_ENABLED) - -/* TWIS */ -#define TWIS0_ENABLED 0 - -#if (TWIS0_ENABLED == 1) - #define TWIS0_CONFIG_ADDR0 0 - #define TWIS0_CONFIG_ADDR1 0 /* 0: Disabled */ - #define TWIS0_CONFIG_SCL 0 - #define TWIS0_CONFIG_SDA 1 - #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - - #define TWIS0_INSTANCE_INDEX 0 -#endif - -#define TWIS1_ENABLED 0 - -#if (TWIS1_ENABLED == 1) - #define TWIS1_CONFIG_ADDR0 0 - #define TWIS1_CONFIG_ADDR1 0 /* 0: Disabled */ - #define TWIS1_CONFIG_SCL 0 - #define TWIS1_CONFIG_SDA 1 - #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST - - #define TWIS1_INSTANCE_INDEX (TWIS0_ENABLED) -#endif - -#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED) -/* For more documentation see nrf_drv_twis.h file */ -#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 -/* For more documentation see nrf_drv_twis.h file */ -#define TWIS_NO_SYNC_MODE 0 - -/* QDEC */ -#define QDEC_ENABLED 0 - -#if (QDEC_ENABLED == 1) -#define QDEC_CONFIG_REPORTPER NRF_QDEC_REPORTPER_10 -#define QDEC_CONFIG_SAMPLEPER NRF_QDEC_SAMPLEPER_16384us -#define QDEC_CONFIG_PIO_A 1 -#define QDEC_CONFIG_PIO_B 2 -#define QDEC_CONFIG_PIO_LED 3 -#define QDEC_CONFIG_LEDPRE 511 -#define QDEC_CONFIG_LEDPOL NRF_QDEC_LEPOL_ACTIVE_HIGH -#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define QDEC_CONFIG_DBFEN false -#define QDEC_CONFIG_SAMPLE_INTEN false -#endif - -/* ADC */ -#define ADC_ENABLED 0 - -#if (ADC_ENABLED == 1) -#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - - -/* SAADC */ -#define SAADC_ENABLED 1 - -#if (SAADC_ENABLED == 1) -#define SAADC_CONFIG_RESOLUTION NRF_SAADC_RESOLUTION_10BIT -#define SAADC_CONFIG_OVERSAMPLE NRF_SAADC_OVERSAMPLE_DISABLED -#define SAADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - -/* PDM */ -#define PDM_ENABLED 0 - -#if (PDM_ENABLED == 1) -#define PDM_CONFIG_MODE NRF_PDM_MODE_MONO -#define PDM_CONFIG_EDGE NRF_PDM_EDGE_LEFTFALLING -#define PDM_CONFIG_CLOCK_FREQ NRF_PDM_FREQ_1032K -#define PDM_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#endif - -/* COMP */ -#define COMP_ENABLED 0 - -#if (COMP_ENABLED == 1) -#define COMP_CONFIG_REF NRF_COMP_REF_Int1V8 -#define COMP_CONFIG_MAIN_MODE NRF_COMP_MAIN_MODE_SE -#define COMP_CONFIG_SPEED_MODE NRF_COMP_SP_MODE_High -#define COMP_CONFIG_HYST NRF_COMP_HYST_NoHyst -#define COMP_CONFIG_ISOURCE NRF_COMP_ISOURCE_Off -#define COMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define COMP_CONFIG_INPUT NRF_COMP_INPUT_0 -#endif - -/* LPCOMP */ -#define LPCOMP_ENABLED 0 - -#if (LPCOMP_ENABLED == 1) -#define LPCOMP_CONFIG_REFERENCE NRF_LPCOMP_REF_SUPPLY_4_8 -#define LPCOMP_CONFIG_DETECTION NRF_LPCOMP_DETECT_DOWN -#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST -#define LPCOMP_CONFIG_INPUT NRF_LPCOMP_INPUT_0 -#endif - -/* WDT */ -#define WDT_ENABLED 0 - -#if (WDT_ENABLED == 1) -#define WDT_CONFIG_BEHAVIOUR NRF_WDT_BEHAVIOUR_RUN_SLEEP -#define WDT_CONFIG_RELOAD_VALUE 2000 -#define WDT_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH -#endif - -/* SWI EGU */ -#ifdef NRF52 - #define EGU_ENABLED 0 -#endif - -/* I2S */ -#define I2S_ENABLED 0 - -#if (I2S_ENABLED == 1) -#define I2S_CONFIG_SCK_PIN 22 -#define I2S_CONFIG_LRCK_PIN 23 -#define I2S_CONFIG_MCK_PIN NRF_DRV_I2S_PIN_NOT_USED -#define I2S_CONFIG_SDOUT_PIN 24 -#define I2S_CONFIG_SDIN_PIN 25 -#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH -#define I2S_CONFIG_MASTER NRF_I2S_MODE_MASTER -#define I2S_CONFIG_FORMAT NRF_I2S_FORMAT_I2S -#define I2S_CONFIG_ALIGN NRF_I2S_ALIGN_LEFT -#define I2S_CONFIG_SWIDTH NRF_I2S_SWIDTH_16BIT -#define I2S_CONFIG_CHANNELS NRF_I2S_CHANNELS_STEREO -#define I2S_CONFIG_MCK_SETUP NRF_I2S_MCK_32MDIV8 -#define I2S_CONFIG_RATIO NRF_I2S_RATIO_256X -#endif - -#include "nrf_drv_config_validation.h" - -#endif // NRF_DRV_CONFIG_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h new file mode 100644 index 0000000000..41f30d9df1 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h @@ -0,0 +1,3494 @@ + + +#ifndef SDK_CONFIG_H +#define SDK_CONFIG_H +// <<< Use Configuration Wizard in Context Menu >>>\n +#ifdef USE_APP_CONFIG +#include "app_config.h" +#endif +// nRF_Drivers + +//========================================================== +// APP_USBD_ENABLED - app_usbd - USB Device library +//========================================================== +#ifndef APP_USBD_ENABLED +#define APP_USBD_ENABLED 0 +#endif +#if APP_USBD_ENABLED +// APP_USBD_VID - Vendor ID + +// Vendor ID ordered from USB IF: http://www.usb.org/developers/vendor/ +#ifndef APP_USBD_VID +#define APP_USBD_VID 0x1915 +#endif + +// APP_USBD_PID - Product ID + +// Selected Product ID +#ifndef APP_USBD_PID +#define APP_USBD_PID 0x520C +#endif + +// APP_USBD_DEVICE_VER_MAJOR - Device version, major part <0-99> + + +// Device version, will be converted automatically to BCD notation. Use just decimal values. + +#ifndef APP_USBD_DEVICE_VER_MAJOR +#define APP_USBD_DEVICE_VER_MAJOR 1 +#endif + +// APP_USBD_DEVICE_VER_MINOR - Device version, minor part <0-99> + + +// Device version, will be converted automatically to BCD notation. Use just decimal values. + +#ifndef APP_USBD_DEVICE_VER_MINOR +#define APP_USBD_DEVICE_VER_MINOR 0 +#endif + +#endif //APP_USBD_ENABLED +// + +// CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver +//========================================================== +#ifndef CLOCK_ENABLED +#define CLOCK_ENABLED 1 +#endif +#if CLOCK_ENABLED +// CLOCK_CONFIG_XTAL_FREQ - HF XTAL Frequency + +// <0=> Default (64 MHz) + +#ifndef CLOCK_CONFIG_XTAL_FREQ +#define CLOCK_CONFIG_XTAL_FREQ 0 +#endif + +// CLOCK_CONFIG_LF_SRC - LF Clock Source + +// <0=> RC +// <1=> XTAL +// <2=> Synth + +#ifndef CLOCK_CONFIG_LF_SRC +#define CLOCK_CONFIG_LF_SRC 1 +#endif + +// CLOCK_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef CLOCK_CONFIG_IRQ_PRIORITY +#define CLOCK_CONFIG_IRQ_PRIORITY 7 +#endif + +// CLOCK_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef CLOCK_CONFIG_LOG_ENABLED +#define CLOCK_CONFIG_LOG_ENABLED 0 +#endif +#if CLOCK_CONFIG_LOG_ENABLED +// CLOCK_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef CLOCK_CONFIG_LOG_LEVEL +#define CLOCK_CONFIG_LOG_LEVEL 3 +#endif + +// CLOCK_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef CLOCK_CONFIG_INFO_COLOR +#define CLOCK_CONFIG_INFO_COLOR 0 +#endif + +// CLOCK_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef CLOCK_CONFIG_DEBUG_COLOR +#define CLOCK_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //CLOCK_CONFIG_LOG_ENABLED +// + +#endif //CLOCK_ENABLED +// + +// COMP_ENABLED - nrf_drv_comp - COMP peripheral driver +//========================================================== +#ifndef COMP_ENABLED +#define COMP_ENABLED 0 +#endif +#if COMP_ENABLED +// COMP_CONFIG_REF - Reference voltage + +// <0=> Internal 1.2V +// <1=> Internal 1.8V +// <2=> Internal 2.4V +// <4=> VDD +// <7=> ARef + +#ifndef COMP_CONFIG_REF +#define COMP_CONFIG_REF 1 +#endif + +// COMP_CONFIG_MAIN_MODE - Main mode + +// <0=> Single ended +// <1=> Differential + +#ifndef COMP_CONFIG_MAIN_MODE +#define COMP_CONFIG_MAIN_MODE 0 +#endif + +// COMP_CONFIG_SPEED_MODE - Speed mode + +// <0=> Low power +// <1=> Normal +// <2=> High speed + +#ifndef COMP_CONFIG_SPEED_MODE +#define COMP_CONFIG_SPEED_MODE 2 +#endif + +// COMP_CONFIG_HYST - Hystheresis + +// <0=> No +// <1=> 50mV + +#ifndef COMP_CONFIG_HYST +#define COMP_CONFIG_HYST 0 +#endif + +// COMP_CONFIG_ISOURCE - Current Source + +// <0=> Off +// <1=> 2.5 uA +// <2=> 5 uA +// <3=> 10 uA + +#ifndef COMP_CONFIG_ISOURCE +#define COMP_CONFIG_ISOURCE 0 +#endif + +// COMP_CONFIG_INPUT - Analog input + +// <0=> 0 +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef COMP_CONFIG_INPUT +#define COMP_CONFIG_INPUT 0 +#endif + +// COMP_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef COMP_CONFIG_IRQ_PRIORITY +#define COMP_CONFIG_IRQ_PRIORITY 7 +#endif + +// COMP_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef COMP_CONFIG_LOG_ENABLED +#define COMP_CONFIG_LOG_ENABLED 0 +#endif +#if COMP_CONFIG_LOG_ENABLED +// COMP_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef COMP_CONFIG_LOG_LEVEL +#define COMP_CONFIG_LOG_LEVEL 3 +#endif + +// COMP_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef COMP_CONFIG_INFO_COLOR +#define COMP_CONFIG_INFO_COLOR 0 +#endif + +// COMP_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef COMP_CONFIG_DEBUG_COLOR +#define COMP_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //COMP_CONFIG_LOG_ENABLED +// + +#endif //COMP_ENABLED +// + +// EGU_ENABLED - nrf_drv_swi - SWI(EGU) peripheral driver +//========================================================== +#ifndef EGU_ENABLED +#define EGU_ENABLED 1 +#endif +#if EGU_ENABLED +// SWI_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef SWI_CONFIG_LOG_ENABLED +#define SWI_CONFIG_LOG_ENABLED 0 +#endif +#if SWI_CONFIG_LOG_ENABLED +// SWI_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef SWI_CONFIG_LOG_LEVEL +#define SWI_CONFIG_LOG_LEVEL 3 +#endif + +// SWI_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef SWI_CONFIG_INFO_COLOR +#define SWI_CONFIG_INFO_COLOR 0 +#endif + +// SWI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef SWI_CONFIG_DEBUG_COLOR +#define SWI_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //SWI_CONFIG_LOG_ENABLED +// + +#endif //EGU_ENABLED +// + +// GPIOTE_ENABLED - nrf_drv_gpiote - GPIOTE peripheral driver +//========================================================== +#ifndef GPIOTE_ENABLED +#define GPIOTE_ENABLED 1 +#endif +#if GPIOTE_ENABLED +// GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins +#ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS +#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4 +#endif + +// GPIOTE_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef GPIOTE_CONFIG_IRQ_PRIORITY +#define GPIOTE_CONFIG_IRQ_PRIORITY 7 +#endif + +// GPIOTE_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef GPIOTE_CONFIG_LOG_ENABLED +#define GPIOTE_CONFIG_LOG_ENABLED 0 +#endif +#if GPIOTE_CONFIG_LOG_ENABLED +// GPIOTE_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef GPIOTE_CONFIG_LOG_LEVEL +#define GPIOTE_CONFIG_LOG_LEVEL 3 +#endif + +// GPIOTE_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef GPIOTE_CONFIG_INFO_COLOR +#define GPIOTE_CONFIG_INFO_COLOR 0 +#endif + +// GPIOTE_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef GPIOTE_CONFIG_DEBUG_COLOR +#define GPIOTE_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //GPIOTE_CONFIG_LOG_ENABLED +// + +#endif //GPIOTE_ENABLED +// + +// I2S_ENABLED - nrf_drv_i2s - I2S peripheral driver +//========================================================== +#ifndef I2S_ENABLED +#define I2S_ENABLED 0 +#endif +#if I2S_ENABLED +// I2S_CONFIG_SCK_PIN - SCK pin <0-31> + + +#ifndef I2S_CONFIG_SCK_PIN +#define I2S_CONFIG_SCK_PIN 31 +#endif + +// I2S_CONFIG_LRCK_PIN - LRCK pin <1-31> + + +#ifndef I2S_CONFIG_LRCK_PIN +#define I2S_CONFIG_LRCK_PIN 30 +#endif + +// I2S_CONFIG_MCK_PIN - MCK pin +#ifndef I2S_CONFIG_MCK_PIN +#define I2S_CONFIG_MCK_PIN 255 +#endif + +// I2S_CONFIG_SDOUT_PIN - SDOUT pin <0-31> + + +#ifndef I2S_CONFIG_SDOUT_PIN +#define I2S_CONFIG_SDOUT_PIN 29 +#endif + +// I2S_CONFIG_SDIN_PIN - SDIN pin <0-31> + + +#ifndef I2S_CONFIG_SDIN_PIN +#define I2S_CONFIG_SDIN_PIN 28 +#endif + +// I2S_CONFIG_MASTER - Mode + +// <0=> Master +// <1=> Slave + +#ifndef I2S_CONFIG_MASTER +#define I2S_CONFIG_MASTER 0 +#endif + +// I2S_CONFIG_FORMAT - Format + +// <0=> I2S +// <1=> Aligned + +#ifndef I2S_CONFIG_FORMAT +#define I2S_CONFIG_FORMAT 0 +#endif + +// I2S_CONFIG_ALIGN - Alignment + +// <0=> Left +// <1=> Right + +#ifndef I2S_CONFIG_ALIGN +#define I2S_CONFIG_ALIGN 0 +#endif + +// I2S_CONFIG_SWIDTH - Sample width (bits) + +// <0=> 8 +// <1=> 16 +// <2=> 24 + +#ifndef I2S_CONFIG_SWIDTH +#define I2S_CONFIG_SWIDTH 1 +#endif + +// I2S_CONFIG_CHANNELS - Channels + +// <0=> Stereo +// <1=> Left +// <2=> Right + +#ifndef I2S_CONFIG_CHANNELS +#define I2S_CONFIG_CHANNELS 1 +#endif + +// I2S_CONFIG_MCK_SETUP - MCK behavior + +// <0=> Disabled +// <2147483648=> 32MHz/2 +// <1342177280=> 32MHz/3 +// <1073741824=> 32MHz/4 +// <805306368=> 32MHz/5 +// <671088640=> 32MHz/6 +// <536870912=> 32MHz/8 +// <402653184=> 32MHz/10 +// <369098752=> 32MHz/11 +// <285212672=> 32MHz/15 +// <268435456=> 32MHz/16 +// <201326592=> 32MHz/21 +// <184549376=> 32MHz/23 +// <142606336=> 32MHz/30 +// <138412032=> 32MHz/31 +// <134217728=> 32MHz/32 +// <100663296=> 32MHz/42 +// <68157440=> 32MHz/63 +// <34340864=> 32MHz/125 + +#ifndef I2S_CONFIG_MCK_SETUP +#define I2S_CONFIG_MCK_SETUP 536870912 +#endif + +// I2S_CONFIG_RATIO - MCK/LRCK ratio + +// <0=> 32x +// <1=> 48x +// <2=> 64x +// <3=> 96x +// <4=> 128x +// <5=> 192x +// <6=> 256x +// <7=> 384x +// <8=> 512x + +#ifndef I2S_CONFIG_RATIO +#define I2S_CONFIG_RATIO 2000 +#endif + +// I2S_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef I2S_CONFIG_IRQ_PRIORITY +#define I2S_CONFIG_IRQ_PRIORITY 7 +#endif + +// I2S_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef I2S_CONFIG_LOG_ENABLED +#define I2S_CONFIG_LOG_ENABLED 0 +#endif +#if I2S_CONFIG_LOG_ENABLED +// I2S_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef I2S_CONFIG_LOG_LEVEL +#define I2S_CONFIG_LOG_LEVEL 3 +#endif + +// I2S_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef I2S_CONFIG_INFO_COLOR +#define I2S_CONFIG_INFO_COLOR 0 +#endif + +// I2S_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef I2S_CONFIG_DEBUG_COLOR +#define I2S_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //I2S_CONFIG_LOG_ENABLED +// + +#endif //I2S_ENABLED +// + +// LPCOMP_ENABLED - nrf_drv_lpcomp - LPCOMP peripheral driver +//========================================================== +#ifndef LPCOMP_ENABLED +#define LPCOMP_ENABLED 0 +#endif +#if LPCOMP_ENABLED +// LPCOMP_CONFIG_REFERENCE - Reference voltage + +// <0=> Supply 1/8 +// <1=> Supply 2/8 +// <2=> Supply 3/8 +// <3=> Supply 4/8 +// <4=> Supply 5/8 +// <5=> Supply 6/8 +// <6=> Supply 7/8 +// <8=> Supply 1/16 (nRF52) +// <9=> Supply 3/16 (nRF52) +// <10=> Supply 5/16 (nRF52) +// <11=> Supply 7/16 (nRF52) +// <12=> Supply 9/16 (nRF52) +// <13=> Supply 11/16 (nRF52) +// <14=> Supply 13/16 (nRF52) +// <15=> Supply 15/16 (nRF52) +// <7=> External Ref 0 +// <65543=> External Ref 1 + +#ifndef LPCOMP_CONFIG_REFERENCE +#define LPCOMP_CONFIG_REFERENCE 3 +#endif + +// LPCOMP_CONFIG_DETECTION - Detection + +// <0=> Crossing +// <1=> Up +// <2=> Down + +#ifndef LPCOMP_CONFIG_DETECTION +#define LPCOMP_CONFIG_DETECTION 2 +#endif + +// LPCOMP_CONFIG_INPUT - Analog input + +// <0=> 0 +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef LPCOMP_CONFIG_INPUT +#define LPCOMP_CONFIG_INPUT 0 +#endif + +// LPCOMP_CONFIG_HYST - Hysteresis + + +#ifndef LPCOMP_CONFIG_HYST +#define LPCOMP_CONFIG_HYST 0 +#endif + +// LPCOMP_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef LPCOMP_CONFIG_IRQ_PRIORITY +#define LPCOMP_CONFIG_IRQ_PRIORITY 7 +#endif + +// LPCOMP_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef LPCOMP_CONFIG_LOG_ENABLED +#define LPCOMP_CONFIG_LOG_ENABLED 0 +#endif +#if LPCOMP_CONFIG_LOG_ENABLED +// LPCOMP_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef LPCOMP_CONFIG_LOG_LEVEL +#define LPCOMP_CONFIG_LOG_LEVEL 3 +#endif + +// LPCOMP_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef LPCOMP_CONFIG_INFO_COLOR +#define LPCOMP_CONFIG_INFO_COLOR 0 +#endif + +// LPCOMP_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef LPCOMP_CONFIG_DEBUG_COLOR +#define LPCOMP_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //LPCOMP_CONFIG_LOG_ENABLED +// + +#endif //LPCOMP_ENABLED +// + +// PDM_ENABLED - nrf_drv_pdm - PDM peripheral driver +//========================================================== +#ifndef PDM_ENABLED +#define PDM_ENABLED 0 +#endif +#if PDM_ENABLED +// PDM_CONFIG_MODE - Mode + +// <0=> Stereo +// <1=> Mono + +#ifndef PDM_CONFIG_MODE +#define PDM_CONFIG_MODE 1 +#endif + +// PDM_CONFIG_EDGE - Edge + +// <0=> Left falling +// <1=> Left rising + +#ifndef PDM_CONFIG_EDGE +#define PDM_CONFIG_EDGE 0 +#endif + +// PDM_CONFIG_CLOCK_FREQ - Clock frequency + +// <134217728=> 1000k +// <138412032=> 1032k (default) +// <142606336=> 1067k + +#ifndef PDM_CONFIG_CLOCK_FREQ +#define PDM_CONFIG_CLOCK_FREQ 138412032 +#endif + +// PDM_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef PDM_CONFIG_IRQ_PRIORITY +#define PDM_CONFIG_IRQ_PRIORITY 7 +#endif + +// PDM_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef PDM_CONFIG_LOG_ENABLED +#define PDM_CONFIG_LOG_ENABLED 0 +#endif +#if PDM_CONFIG_LOG_ENABLED +// PDM_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef PDM_CONFIG_LOG_LEVEL +#define PDM_CONFIG_LOG_LEVEL 3 +#endif + +// PDM_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef PDM_CONFIG_INFO_COLOR +#define PDM_CONFIG_INFO_COLOR 0 +#endif + +// PDM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef PDM_CONFIG_DEBUG_COLOR +#define PDM_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //PDM_CONFIG_LOG_ENABLED +// + +#endif //PDM_ENABLED +// + +// PERIPHERAL_RESOURCE_SHARING_ENABLED - nrf_drv_common - Peripheral drivers common module +//========================================================== +#ifndef PERIPHERAL_RESOURCE_SHARING_ENABLED +#define PERIPHERAL_RESOURCE_SHARING_ENABLED 1 +#endif +#if PERIPHERAL_RESOURCE_SHARING_ENABLED +// COMMON_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef COMMON_CONFIG_LOG_ENABLED +#define COMMON_CONFIG_LOG_ENABLED 0 +#endif +#if COMMON_CONFIG_LOG_ENABLED +// COMMON_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef COMMON_CONFIG_LOG_LEVEL +#define COMMON_CONFIG_LOG_LEVEL 3 +#endif + +// COMMON_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef COMMON_CONFIG_INFO_COLOR +#define COMMON_CONFIG_INFO_COLOR 0 +#endif + +// COMMON_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef COMMON_CONFIG_DEBUG_COLOR +#define COMMON_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //COMMON_CONFIG_LOG_ENABLED +// + +#endif //PERIPHERAL_RESOURCE_SHARING_ENABLED +// + +// POWER_ENABLED - nrf_drv_power - POWER peripheral driver +//========================================================== +#ifndef POWER_ENABLED +#define POWER_ENABLED 1 +#endif +#if POWER_ENABLED +// POWER_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef POWER_CONFIG_IRQ_PRIORITY +#define POWER_CONFIG_IRQ_PRIORITY 7 +#endif + +// POWER_CONFIG_DEFAULT_DCDCEN - The default configuration of main DCDC regulator + + +// This settings means only that components for DCDC regulator are installed and it can be enabled. + +#ifndef POWER_CONFIG_DEFAULT_DCDCEN +#define POWER_CONFIG_DEFAULT_DCDCEN 0 +#endif + +// POWER_CONFIG_DEFAULT_DCDCENHV - The default configuration of High Voltage DCDC regulator + + +// This settings means only that components for DCDC regulator are installed and it can be enabled. + +#ifndef POWER_CONFIG_DEFAULT_DCDCENHV +#define POWER_CONFIG_DEFAULT_DCDCENHV 0 +#endif + +#endif //POWER_ENABLED +// + +// PPI_ENABLED - nrf_drv_ppi - PPI peripheral driver +//========================================================== +#ifndef PPI_ENABLED +#define PPI_ENABLED 1 +#endif +#if PPI_ENABLED +// PPI_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef PPI_CONFIG_LOG_ENABLED +#define PPI_CONFIG_LOG_ENABLED 0 +#endif +#if PPI_CONFIG_LOG_ENABLED +// PPI_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef PPI_CONFIG_LOG_LEVEL +#define PPI_CONFIG_LOG_LEVEL 3 +#endif + +// PPI_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef PPI_CONFIG_INFO_COLOR +#define PPI_CONFIG_INFO_COLOR 0 +#endif + +// PPI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef PPI_CONFIG_DEBUG_COLOR +#define PPI_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //PPI_CONFIG_LOG_ENABLED +// + +#endif //PPI_ENABLED +// + +// PWM_ENABLED - nrf_drv_pwm - PWM peripheral driver +//========================================================== +#ifndef PWM_ENABLED +#define PWM_ENABLED 1 +#endif +#if PWM_ENABLED +// PWM_DEFAULT_CONFIG_OUT0_PIN - Out0 pin <0-31> + + +#ifndef PWM_DEFAULT_CONFIG_OUT0_PIN +#define PWM_DEFAULT_CONFIG_OUT0_PIN 31 +#endif + +// PWM_DEFAULT_CONFIG_OUT1_PIN - Out1 pin <0-31> + + +#ifndef PWM_DEFAULT_CONFIG_OUT1_PIN +#define PWM_DEFAULT_CONFIG_OUT1_PIN 31 +#endif + +// PWM_DEFAULT_CONFIG_OUT2_PIN - Out2 pin <0-31> + + +#ifndef PWM_DEFAULT_CONFIG_OUT2_PIN +#define PWM_DEFAULT_CONFIG_OUT2_PIN 31 +#endif + +// PWM_DEFAULT_CONFIG_OUT3_PIN - Out3 pin <0-31> + + +#ifndef PWM_DEFAULT_CONFIG_OUT3_PIN +#define PWM_DEFAULT_CONFIG_OUT3_PIN 31 +#endif + +// PWM_DEFAULT_CONFIG_BASE_CLOCK - Base clock + +// <0=> 16 MHz +// <1=> 8 MHz +// <2=> 4 MHz +// <3=> 2 MHz +// <4=> 1 MHz +// <5=> 500 kHz +// <6=> 250 kHz +// <7=> 125 MHz + +#ifndef PWM_DEFAULT_CONFIG_BASE_CLOCK +#define PWM_DEFAULT_CONFIG_BASE_CLOCK 4 +#endif + +// PWM_DEFAULT_CONFIG_COUNT_MODE - Count mode + +// <0=> Up +// <1=> Up and Down + +#ifndef PWM_DEFAULT_CONFIG_COUNT_MODE +#define PWM_DEFAULT_CONFIG_COUNT_MODE 0 +#endif + +// PWM_DEFAULT_CONFIG_TOP_VALUE - Top value +#ifndef PWM_DEFAULT_CONFIG_TOP_VALUE +#define PWM_DEFAULT_CONFIG_TOP_VALUE 1000 +#endif + +// PWM_DEFAULT_CONFIG_LOAD_MODE - Load mode + +// <0=> Common +// <1=> Grouped +// <2=> Individual +// <3=> Waveform + +#ifndef PWM_DEFAULT_CONFIG_LOAD_MODE +#define PWM_DEFAULT_CONFIG_LOAD_MODE 0 +#endif + +// PWM_DEFAULT_CONFIG_STEP_MODE - Step mode + +// <0=> Auto +// <1=> Triggered + +#ifndef PWM_DEFAULT_CONFIG_STEP_MODE +#define PWM_DEFAULT_CONFIG_STEP_MODE 0 +#endif + +// PWM_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef PWM_DEFAULT_CONFIG_IRQ_PRIORITY +#define PWM_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#endif + +// PWM0_ENABLED - Enable PWM0 instance + + +#ifndef PWM0_ENABLED +#define PWM0_ENABLED 1 +#endif + +// PWM1_ENABLED - Enable PWM1 instance + + +#ifndef PWM1_ENABLED +#define PWM1_ENABLED 1 +#endif + +// PWM2_ENABLED - Enable PWM2 instance + + +#ifndef PWM2_ENABLED +#define PWM2_ENABLED 1 +#endif + +// PWM3_ENABLED - Enable PWM3 instance + + +#ifndef PWM3_ENABLED +#define PWM3_ENABLED 1 +#endif + +// PWM_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef PWM_CONFIG_LOG_ENABLED +#define PWM_CONFIG_LOG_ENABLED 0 +#endif +#if PWM_CONFIG_LOG_ENABLED +// PWM_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef PWM_CONFIG_LOG_LEVEL +#define PWM_CONFIG_LOG_LEVEL 3 +#endif + +// PWM_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef PWM_CONFIG_INFO_COLOR +#define PWM_CONFIG_INFO_COLOR 0 +#endif + +// PWM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef PWM_CONFIG_DEBUG_COLOR +#define PWM_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //PWM_CONFIG_LOG_ENABLED +// + +#endif //PWM_ENABLED +// + +// QDEC_ENABLED - nrf_drv_qdec - QDEC peripheral driver +//========================================================== +#ifndef QDEC_ENABLED +#define QDEC_ENABLED 0 +#endif +#if QDEC_ENABLED +// QDEC_CONFIG_REPORTPER - Report period + +// <0=> 10 Samples +// <1=> 40 Samples +// <2=> 80 Samples +// <3=> 120 Samples +// <4=> 160 Samples +// <5=> 200 Samples +// <6=> 240 Samples +// <7=> 280 Samples + +#ifndef QDEC_CONFIG_REPORTPER +#define QDEC_CONFIG_REPORTPER 0 +#endif + +// QDEC_CONFIG_SAMPLEPER - Sample period + +// <0=> 128 us +// <1=> 256 us +// <2=> 512 us +// <3=> 1024 us +// <4=> 2048 us +// <5=> 4096 us +// <6=> 8192 us +// <7=> 16384 us + +#ifndef QDEC_CONFIG_SAMPLEPER +#define QDEC_CONFIG_SAMPLEPER 7 +#endif + +// QDEC_CONFIG_PIO_A - A pin <0-31> + + +#ifndef QDEC_CONFIG_PIO_A +#define QDEC_CONFIG_PIO_A 31 +#endif + +// QDEC_CONFIG_PIO_B - B pin <0-31> + + +#ifndef QDEC_CONFIG_PIO_B +#define QDEC_CONFIG_PIO_B 31 +#endif + +// QDEC_CONFIG_PIO_LED - LED pin <0-31> + + +#ifndef QDEC_CONFIG_PIO_LED +#define QDEC_CONFIG_PIO_LED 31 +#endif + +// QDEC_CONFIG_LEDPRE - LED pre +#ifndef QDEC_CONFIG_LEDPRE +#define QDEC_CONFIG_LEDPRE 511 +#endif + +// QDEC_CONFIG_LEDPOL - LED polarity + +// <0=> Active low +// <1=> Active high + +#ifndef QDEC_CONFIG_LEDPOL +#define QDEC_CONFIG_LEDPOL 1 +#endif + +// QDEC_CONFIG_DBFEN - Debouncing enable + + +#ifndef QDEC_CONFIG_DBFEN +#define QDEC_CONFIG_DBFEN 0 +#endif + +// QDEC_CONFIG_SAMPLE_INTEN - Sample ready interrupt enable + + +#ifndef QDEC_CONFIG_SAMPLE_INTEN +#define QDEC_CONFIG_SAMPLE_INTEN 0 +#endif + +// QDEC_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef QDEC_CONFIG_IRQ_PRIORITY +#define QDEC_CONFIG_IRQ_PRIORITY 7 +#endif + +// QDEC_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef QDEC_CONFIG_LOG_ENABLED +#define QDEC_CONFIG_LOG_ENABLED 0 +#endif +#if QDEC_CONFIG_LOG_ENABLED +// QDEC_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef QDEC_CONFIG_LOG_LEVEL +#define QDEC_CONFIG_LOG_LEVEL 3 +#endif + +// QDEC_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef QDEC_CONFIG_INFO_COLOR +#define QDEC_CONFIG_INFO_COLOR 0 +#endif + +// QDEC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef QDEC_CONFIG_DEBUG_COLOR +#define QDEC_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //QDEC_CONFIG_LOG_ENABLED +// + +#endif //QDEC_ENABLED +// + +// RNG_ENABLED - nrf_drv_rng - RNG peripheral driver +//========================================================== +#ifndef RNG_ENABLED +#define RNG_ENABLED 1 +#endif +#if RNG_ENABLED +// RNG_CONFIG_ERROR_CORRECTION - Error correction + + +#ifndef RNG_CONFIG_ERROR_CORRECTION +#define RNG_CONFIG_ERROR_CORRECTION 0 +#endif + +// RNG_CONFIG_POOL_SIZE - Pool size +#ifndef RNG_CONFIG_POOL_SIZE +#define RNG_CONFIG_POOL_SIZE 32 +#endif + +// RNG_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef RNG_CONFIG_IRQ_PRIORITY +#define RNG_CONFIG_IRQ_PRIORITY 7 +#endif + +// RNG_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef RNG_CONFIG_LOG_ENABLED +#define RNG_CONFIG_LOG_ENABLED 0 +#endif +#if RNG_CONFIG_LOG_ENABLED +// RNG_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef RNG_CONFIG_LOG_LEVEL +#define RNG_CONFIG_LOG_LEVEL 3 +#endif + +// RNG_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef RNG_CONFIG_INFO_COLOR +#define RNG_CONFIG_INFO_COLOR 0 +#endif + +// RNG_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef RNG_CONFIG_DEBUG_COLOR +#define RNG_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //RNG_CONFIG_LOG_ENABLED +// + +#endif //RNG_ENABLED +// + +// RTC_ENABLED - nrf_drv_rtc - RTC peripheral driver +//========================================================== +#ifndef RTC_ENABLED +#define RTC_ENABLED 1 +#endif +#if RTC_ENABLED +// RTC_DEFAULT_CONFIG_FREQUENCY - Frequency <16-32768> + + +#ifndef RTC_DEFAULT_CONFIG_FREQUENCY +#define RTC_DEFAULT_CONFIG_FREQUENCY 32768 +#endif + +// RTC_DEFAULT_CONFIG_RELIABLE - Ensures safe compare event triggering + + +#ifndef RTC_DEFAULT_CONFIG_RELIABLE +#define RTC_DEFAULT_CONFIG_RELIABLE 0 +#endif + +// RTC_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef RTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define RTC_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#endif + +// RTC0_ENABLED - Enable RTC0 instance + + +#ifndef RTC0_ENABLED +#define RTC0_ENABLED 1 +#endif + +// RTC1_ENABLED - Enable RTC1 instance + + +#ifndef RTC1_ENABLED +#define RTC1_ENABLED 0 +#endif + +// RTC2_ENABLED - Enable RTC2 instance + + +#ifndef RTC2_ENABLED +#define RTC2_ENABLED 1 +#endif + +// NRF_MAXIMUM_LATENCY_US - Maximum possible time[us] in highest priority interrupt +#ifndef NRF_MAXIMUM_LATENCY_US +#define NRF_MAXIMUM_LATENCY_US 2000 +#endif + +// RTC_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef RTC_CONFIG_LOG_ENABLED +#define RTC_CONFIG_LOG_ENABLED 0 +#endif +#if RTC_CONFIG_LOG_ENABLED +// RTC_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef RTC_CONFIG_LOG_LEVEL +#define RTC_CONFIG_LOG_LEVEL 3 +#endif + +// RTC_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef RTC_CONFIG_INFO_COLOR +#define RTC_CONFIG_INFO_COLOR 0 +#endif + +// RTC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef RTC_CONFIG_DEBUG_COLOR +#define RTC_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //RTC_CONFIG_LOG_ENABLED +// + +#endif //RTC_ENABLED +// + +// SAADC_ENABLED - nrf_drv_saadc - SAADC peripheral driver +//========================================================== +#ifndef SAADC_ENABLED +#define SAADC_ENABLED 1 +#endif +#if SAADC_ENABLED +// SAADC_CONFIG_RESOLUTION - Resolution + +// <0=> 8 bit +// <1=> 10 bit +// <2=> 12 bit +// <3=> 14 bit + +#ifndef SAADC_CONFIG_RESOLUTION +#define SAADC_CONFIG_RESOLUTION 1 +#endif + +// SAADC_CONFIG_OVERSAMPLE - Sample period + +// <0=> Disabled +// <1=> 2x +// <2=> 4x +// <3=> 8x +// <4=> 16x +// <5=> 32x +// <6=> 64x +// <7=> 128x +// <8=> 256x + +#ifndef SAADC_CONFIG_OVERSAMPLE +#define SAADC_CONFIG_OVERSAMPLE 0 +#endif + +// SAADC_CONFIG_LP_MODE - Enabling low power mode + + +#ifndef SAADC_CONFIG_LP_MODE +#define SAADC_CONFIG_LP_MODE 0 +#endif + +// SAADC_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef SAADC_CONFIG_IRQ_PRIORITY +#define SAADC_CONFIG_IRQ_PRIORITY 7 +#endif + +// SAADC_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef SAADC_CONFIG_LOG_ENABLED +#define SAADC_CONFIG_LOG_ENABLED 0 +#endif +#if SAADC_CONFIG_LOG_ENABLED +// SAADC_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef SAADC_CONFIG_LOG_LEVEL +#define SAADC_CONFIG_LOG_LEVEL 3 +#endif + +// SAADC_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef SAADC_CONFIG_INFO_COLOR +#define SAADC_CONFIG_INFO_COLOR 0 +#endif + +// SAADC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef SAADC_CONFIG_DEBUG_COLOR +#define SAADC_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //SAADC_CONFIG_LOG_ENABLED +// + +#endif //SAADC_ENABLED +// + +// SPIS_ENABLED - nrf_drv_spis - SPI Slave driver +//========================================================== +#ifndef SPIS_ENABLED +#define SPIS_ENABLED 1 +#endif +#if SPIS_ENABLED +// SPIS_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef SPIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define SPIS_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#endif + +// SPIS_DEFAULT_MODE - Mode + +// <0=> MODE_0 +// <1=> MODE_1 +// <2=> MODE_2 +// <3=> MODE_3 + +#ifndef SPIS_DEFAULT_MODE +#define SPIS_DEFAULT_MODE 0 +#endif + +// SPIS_DEFAULT_BIT_ORDER - SPIS default bit order + +// <0=> MSB first +// <1=> LSB first + +#ifndef SPIS_DEFAULT_BIT_ORDER +#define SPIS_DEFAULT_BIT_ORDER 0 +#endif + +// SPIS_DEFAULT_DEF - SPIS default DEF character <0-255> + + +#ifndef SPIS_DEFAULT_DEF +#define SPIS_DEFAULT_DEF 255 +#endif + +// SPIS_DEFAULT_ORC - SPIS default ORC character <0-255> + + +#ifndef SPIS_DEFAULT_ORC +#define SPIS_DEFAULT_ORC 255 +#endif + +// SPIS0_ENABLED - Enable SPIS0 instance + + +#ifndef SPIS0_ENABLED +#define SPIS0_ENABLED 1 +#endif + +// SPIS1_ENABLED - Enable SPIS1 instance + + +#ifndef SPIS1_ENABLED +#define SPIS1_ENABLED 1 +#endif + +// SPIS2_ENABLED - Enable SPIS2 instance + + +#ifndef SPIS2_ENABLED +#define SPIS2_ENABLED 1 +#endif + +// SPIS_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef SPIS_CONFIG_LOG_ENABLED +#define SPIS_CONFIG_LOG_ENABLED 0 +#endif +#if SPIS_CONFIG_LOG_ENABLED +// SPIS_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef SPIS_CONFIG_LOG_LEVEL +#define SPIS_CONFIG_LOG_LEVEL 3 +#endif + +// SPIS_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef SPIS_CONFIG_INFO_COLOR +#define SPIS_CONFIG_INFO_COLOR 0 +#endif + +// SPIS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef SPIS_CONFIG_DEBUG_COLOR +#define SPIS_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //SPIS_CONFIG_LOG_ENABLED +// + +#endif //SPIS_ENABLED +// + +// SPI_ENABLED - nrf_drv_spi - SPI/SPIM peripheral driver +//========================================================== +#ifndef SPI_ENABLED +#define SPI_ENABLED 1 +#endif +#if SPI_ENABLED +// SPI_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef SPI_DEFAULT_CONFIG_IRQ_PRIORITY +#define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#endif + +// SPI0_ENABLED - Enable SPI0 instance +//========================================================== +#ifndef SPI0_ENABLED +#define SPI0_ENABLED 1 +#endif +#if SPI0_ENABLED +// SPI0_USE_EASY_DMA - Use EasyDMA + + +#ifndef SPI0_USE_EASY_DMA +#define SPI0_USE_EASY_DMA 1 +#endif + +// SPI0_DEFAULT_FREQUENCY - SPI frequency + +// <33554432=> 125 kHz +// <67108864=> 250 kHz +// <134217728=> 500 kHz +// <268435456=> 1 MHz +// <536870912=> 2 MHz +// <1073741824=> 4 MHz +// <2147483648=> 8 MHz + +#ifndef SPI0_DEFAULT_FREQUENCY +#define SPI0_DEFAULT_FREQUENCY 1073741824 +#endif + +#endif //SPI0_ENABLED +// + +// SPI1_ENABLED - Enable SPI1 instance +//========================================================== +#ifndef SPI1_ENABLED +#define SPI1_ENABLED 1 +#endif +#if SPI1_ENABLED +// SPI1_USE_EASY_DMA - Use EasyDMA + + +#ifndef SPI1_USE_EASY_DMA +#define SPI1_USE_EASY_DMA 1 +#endif + +// SPI1_DEFAULT_FREQUENCY - SPI frequency + +// <33554432=> 125 kHz +// <67108864=> 250 kHz +// <134217728=> 500 kHz +// <268435456=> 1 MHz +// <536870912=> 2 MHz +// <1073741824=> 4 MHz +// <2147483648=> 8 MHz + +#ifndef SPI1_DEFAULT_FREQUENCY +#define SPI1_DEFAULT_FREQUENCY 1073741824 +#endif + +#endif //SPI1_ENABLED +// + +// SPI2_ENABLED - Enable SPI2 instance +//========================================================== +#ifndef SPI2_ENABLED +#define SPI2_ENABLED 1 +#endif +#if SPI2_ENABLED +// SPI2_USE_EASY_DMA - Use EasyDMA + + +#ifndef SPI2_USE_EASY_DMA +#define SPI2_USE_EASY_DMA 1 +#endif + +// SPI2_DEFAULT_FREQUENCY - Use EasyDMA + + +#ifndef SPI2_DEFAULT_FREQUENCY +#define SPI2_DEFAULT_FREQUENCY 1 +#endif + +#endif //SPI2_ENABLED +// + +// SPI_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef SPI_CONFIG_LOG_ENABLED +#define SPI_CONFIG_LOG_ENABLED 0 +#endif +#if SPI_CONFIG_LOG_ENABLED +// SPI_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef SPI_CONFIG_LOG_LEVEL +#define SPI_CONFIG_LOG_LEVEL 3 +#endif + +// SPI_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef SPI_CONFIG_INFO_COLOR +#define SPI_CONFIG_INFO_COLOR 0 +#endif + +// SPI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef SPI_CONFIG_DEBUG_COLOR +#define SPI_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //SPI_CONFIG_LOG_ENABLED +// + +#endif //SPI_ENABLED +// + +// SYSTICK_ENABLED - nrf_drv_systick - SysTick driver + + +#ifndef SYSTICK_ENABLED +#define SYSTICK_ENABLED 1 +#endif + +// TIMER_ENABLED - nrf_drv_timer - TIMER periperal driver +//========================================================== +#ifndef TIMER_ENABLED +#define TIMER_ENABLED 1 +#endif +#if TIMER_ENABLED +// TIMER_DEFAULT_CONFIG_FREQUENCY - Timer frequency if in Timer mode + +// <0=> 16 MHz +// <1=> 8 MHz +// <2=> 4 MHz +// <3=> 2 MHz +// <4=> 1 MHz +// <5=> 500 kHz +// <6=> 250 kHz +// <7=> 125 kHz +// <8=> 62.5 kHz +// <9=> 31.25 kHz + +#ifndef TIMER_DEFAULT_CONFIG_FREQUENCY +#define TIMER_DEFAULT_CONFIG_FREQUENCY 0 +#endif + +// TIMER_DEFAULT_CONFIG_MODE - Timer mode or operation + +// <0=> Timer +// <1=> Counter + +#ifndef TIMER_DEFAULT_CONFIG_MODE +#define TIMER_DEFAULT_CONFIG_MODE 0 +#endif + +// TIMER_DEFAULT_CONFIG_BIT_WIDTH - Timer counter bit width + +// <0=> 16 bit +// <1=> 8 bit +// <2=> 24 bit +// <3=> 32 bit + +#ifndef TIMER_DEFAULT_CONFIG_BIT_WIDTH +#define TIMER_DEFAULT_CONFIG_BIT_WIDTH 0 +#endif + +// TIMER_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef TIMER_DEFAULT_CONFIG_IRQ_PRIORITY +#define TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#endif + +// TIMER0_ENABLED - Enable TIMER0 instance + + +#ifndef TIMER0_ENABLED +#define TIMER0_ENABLED 1 +#endif + +// TIMER1_ENABLED - Enable TIMER1 instance + + +#ifndef TIMER1_ENABLED +#define TIMER1_ENABLED 1 +#endif + +// TIMER2_ENABLED - Enable TIMER2 instance + + +#ifndef TIMER2_ENABLED +#define TIMER2_ENABLED 1 +#endif + +// TIMER3_ENABLED - Enable TIMER3 instance + + +#ifndef TIMER3_ENABLED +#define TIMER3_ENABLED 1 +#endif + +// TIMER4_ENABLED - Enable TIMER4 instance + + +#ifndef TIMER4_ENABLED +#define TIMER4_ENABLED 1 +#endif + +// TIMER_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef TIMER_CONFIG_LOG_ENABLED +#define TIMER_CONFIG_LOG_ENABLED 0 +#endif +#if TIMER_CONFIG_LOG_ENABLED +// TIMER_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef TIMER_CONFIG_LOG_LEVEL +#define TIMER_CONFIG_LOG_LEVEL 3 +#endif + +// TIMER_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef TIMER_CONFIG_INFO_COLOR +#define TIMER_CONFIG_INFO_COLOR 0 +#endif + +// TIMER_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef TIMER_CONFIG_DEBUG_COLOR +#define TIMER_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //TIMER_CONFIG_LOG_ENABLED +// + +#endif //TIMER_ENABLED +// + +// TWIS_ENABLED - nrf_drv_twis - TWIS peripheral driver +//========================================================== +#ifndef TWIS_ENABLED +#define TWIS_ENABLED 1 +#endif +#if TWIS_ENABLED +// TWIS_DEFAULT_CONFIG_ADDR0 - Address0 +#ifndef TWIS_DEFAULT_CONFIG_ADDR0 +#define TWIS_DEFAULT_CONFIG_ADDR0 0 +#endif + +// TWIS_DEFAULT_CONFIG_ADDR1 - Address1 +#ifndef TWIS_DEFAULT_CONFIG_ADDR1 +#define TWIS_DEFAULT_CONFIG_ADDR1 0 +#endif + +// TWIS_DEFAULT_CONFIG_SCL_PULL - SCL pin pull configuration + +// <0=> Disabled +// <1=> Pull down +// <3=> Pull up + +#ifndef TWIS_DEFAULT_CONFIG_SCL_PULL +#define TWIS_DEFAULT_CONFIG_SCL_PULL 0 +#endif + +// TWIS_DEFAULT_CONFIG_SDA_PULL - SDA pin pull configuration + +// <0=> Disabled +// <1=> Pull down +// <3=> Pull up + +#ifndef TWIS_DEFAULT_CONFIG_SDA_PULL +#define TWIS_DEFAULT_CONFIG_SDA_PULL 0 +#endif + +// TWIS_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef TWIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define TWIS_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#endif + +// TWIS0_ENABLED - Enable TWIS0 instance + + +#ifndef TWIS0_ENABLED +#define TWIS0_ENABLED 1 +#endif + +// TWIS1_ENABLED - Enable TWIS1 instance + + +#ifndef TWIS1_ENABLED +#define TWIS1_ENABLED 1 +#endif + +// TWIS_ASSUME_INIT_AFTER_RESET_ONLY - Assume that any instance would be initialized only once + + +// Optimization flag. Registers used by TWIS are shared by other peripherals. Normally, during initialization driver tries to clear all registers to known state before doing the initialization itself. This gives initialization safe procedure, no matter when it would be called. If you activate TWIS only once and do never uninitialize it - set this flag to 1 what gives more optimal code. + +#ifndef TWIS_ASSUME_INIT_AFTER_RESET_ONLY +#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 +#endif + +// TWIS_NO_SYNC_MODE - Remove support for synchronous mode + + +// Synchronous mode would be used in specific situations. And it uses some additional code and data memory to safely process state machine by polling it in status functions. If this functionality is not required it may be disabled to free some resources. + +#ifndef TWIS_NO_SYNC_MODE +#define TWIS_NO_SYNC_MODE 0 +#endif + +// TWIS_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef TWIS_CONFIG_LOG_ENABLED +#define TWIS_CONFIG_LOG_ENABLED 0 +#endif +#if TWIS_CONFIG_LOG_ENABLED +// TWIS_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef TWIS_CONFIG_LOG_LEVEL +#define TWIS_CONFIG_LOG_LEVEL 3 +#endif + +// TWIS_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef TWIS_CONFIG_INFO_COLOR +#define TWIS_CONFIG_INFO_COLOR 0 +#endif + +// TWIS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef TWIS_CONFIG_DEBUG_COLOR +#define TWIS_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //TWIS_CONFIG_LOG_ENABLED +// + +#endif //TWIS_ENABLED +// + +// TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver +//========================================================== +#ifndef TWI_ENABLED +#define TWI_ENABLED 1 +#endif +#if TWI_ENABLED +// TWI_DEFAULT_CONFIG_FREQUENCY - Frequency + +// <26738688=> 100k +// <67108864=> 250k +// <104857600=> 400k + +#ifndef TWI_DEFAULT_CONFIG_FREQUENCY +#define TWI_DEFAULT_CONFIG_FREQUENCY 26738688 +#endif + +// TWI_DEFAULT_CONFIG_CLR_BUS_INIT - Enables bus clearing procedure during init + + +#ifndef TWI_DEFAULT_CONFIG_CLR_BUS_INIT +#define TWI_DEFAULT_CONFIG_CLR_BUS_INIT 0 +#endif + +// TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT - Enables bus holding after uninit + + +#ifndef TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT +#define TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0 +#endif + +// TWI_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef TWI_DEFAULT_CONFIG_IRQ_PRIORITY +#define TWI_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#endif + +// TWI0_ENABLED - Enable TWI0 instance +//========================================================== +#ifndef TWI0_ENABLED +#define TWI0_ENABLED 1 +#endif +#if TWI0_ENABLED +// TWI0_USE_EASY_DMA - Use EasyDMA (if present) + + +#ifndef TWI0_USE_EASY_DMA +#define TWI0_USE_EASY_DMA 0 +#endif + +#endif //TWI0_ENABLED +// + +// TWI1_ENABLED - Enable TWI1 instance +//========================================================== +#ifndef TWI1_ENABLED +#define TWI1_ENABLED 1 +#endif +#if TWI1_ENABLED +// TWI1_USE_EASY_DMA - Use EasyDMA (if present) + + +#ifndef TWI1_USE_EASY_DMA +#define TWI1_USE_EASY_DMA 0 +#endif + +#endif //TWI1_ENABLED +// + +// TWI_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef TWI_CONFIG_LOG_ENABLED +#define TWI_CONFIG_LOG_ENABLED 0 +#endif +#if TWI_CONFIG_LOG_ENABLED +// TWI_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef TWI_CONFIG_LOG_LEVEL +#define TWI_CONFIG_LOG_LEVEL 3 +#endif + +// TWI_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef TWI_CONFIG_INFO_COLOR +#define TWI_CONFIG_INFO_COLOR 0 +#endif + +// TWI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef TWI_CONFIG_DEBUG_COLOR +#define TWI_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //TWI_CONFIG_LOG_ENABLED +// + +#endif //TWI_ENABLED +// + +// UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver +//========================================================== +#ifndef UART_ENABLED +#define UART_ENABLED 1 +#endif +#if UART_ENABLED +// UART_DEFAULT_CONFIG_HWFC - Hardware Flow Control + +// <0=> Disabled +// <1=> Enabled + +#ifndef UART_DEFAULT_CONFIG_HWFC +#define UART_DEFAULT_CONFIG_HWFC 0 +#endif + +// UART_DEFAULT_CONFIG_PARITY - Parity + +// <0=> Excluded +// <14=> Included + +#ifndef UART_DEFAULT_CONFIG_PARITY +#define UART_DEFAULT_CONFIG_PARITY 0 +#endif + +// UART_DEFAULT_CONFIG_BAUDRATE - Default Baudrate + +// <323584=> 1200 baud +// <643072=> 2400 baud +// <1290240=> 4800 baud +// <2576384=> 9600 baud +// <3862528=> 14400 baud +// <5152768=> 19200 baud +// <7716864=> 28800 baud +// <10289152=> 38400 baud +// <15400960=> 57600 baud +// <20615168=> 76800 baud +// <30801920=> 115200 baud +// <61865984=> 230400 baud +// <67108864=> 250000 baud +// <121634816=> 460800 baud +// <251658240=> 921600 baud +// <268435456=> 57600 baud + +#ifndef UART_DEFAULT_CONFIG_BAUDRATE +#define UART_DEFAULT_CONFIG_BAUDRATE 30801920 +#endif + +// UART_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef UART_DEFAULT_CONFIG_IRQ_PRIORITY +#define UART_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#endif + +// UART_EASY_DMA_SUPPORT - Driver supporting EasyDMA + + +#ifndef UART_EASY_DMA_SUPPORT +#define UART_EASY_DMA_SUPPORT 1 +#endif + +// UART_LEGACY_SUPPORT - Driver supporting Legacy mode + + +#ifndef UART_LEGACY_SUPPORT +#define UART_LEGACY_SUPPORT 1 +#endif + +// UART0_ENABLED - Enable UART0 instance +//========================================================== +#ifndef UART0_ENABLED +#define UART0_ENABLED 1 +#endif +#if UART0_ENABLED +// UART0_CONFIG_USE_EASY_DMA - Default setting for using EasyDMA + + +#ifndef UART0_CONFIG_USE_EASY_DMA +#define UART0_CONFIG_USE_EASY_DMA 1 +#endif + +#endif //UART0_ENABLED +// + +// UART1_ENABLED - Enable UART1 instance +//========================================================== +#ifndef UART1_ENABLED +#define UART1_ENABLED 0 +#endif +#if UART1_ENABLED +// UART1_CONFIG_USE_EASY_DMA - Default setting for using EasyDMA + + +#ifndef UART1_CONFIG_USE_EASY_DMA +#define UART1_CONFIG_USE_EASY_DMA 1 +#endif + +#endif //UART1_ENABLED +// + +// UART_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef UART_CONFIG_LOG_ENABLED +#define UART_CONFIG_LOG_ENABLED 0 +#endif +#if UART_CONFIG_LOG_ENABLED +// UART_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef UART_CONFIG_LOG_LEVEL +#define UART_CONFIG_LOG_LEVEL 3 +#endif + +// UART_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef UART_CONFIG_INFO_COLOR +#define UART_CONFIG_INFO_COLOR 0 +#endif + +// UART_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef UART_CONFIG_DEBUG_COLOR +#define UART_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //UART_CONFIG_LOG_ENABLED +// + +#endif //UART_ENABLED +// + +// USBD_ENABLED - nrf_drv_usbd - USB driver +//========================================================== +#ifndef USBD_ENABLED +#define USBD_ENABLED 0 +#endif +#if USBD_ENABLED +// USBD_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef USBD_CONFIG_IRQ_PRIORITY +#define USBD_CONFIG_IRQ_PRIORITY 7 +#endif + +// NRF_DRV_USBD_DMASCHEDULER_MODE - USBD SMA scheduler working scheme + +// <0=> Prioritized access +// <1=> Round Robin + +#ifndef NRF_DRV_USBD_DMASCHEDULER_MODE +#define NRF_DRV_USBD_DMASCHEDULER_MODE 0 +#endif + +// NRF_USBD_DRV_LOG_ENABLED - Enable logging. + + +#ifndef NRF_USBD_DRV_LOG_ENABLED +#define NRF_USBD_DRV_LOG_ENABLED 0 +#endif + +#endif //USBD_ENABLED +// + +// WDT_ENABLED - nrf_drv_wdt - WDT peripheral driver +//========================================================== +#ifndef WDT_ENABLED +#define WDT_ENABLED 0 +#endif +#if WDT_ENABLED +// WDT_CONFIG_BEHAVIOUR - WDT behavior in CPU SLEEP or HALT mode + +// <1=> Run in SLEEP, Pause in HALT +// <8=> Pause in SLEEP, Run in HALT +// <9=> Run in SLEEP and HALT +// <0=> Pause in SLEEP and HALT + +#ifndef WDT_CONFIG_BEHAVIOUR +#define WDT_CONFIG_BEHAVIOUR 1 +#endif + +// WDT_CONFIG_RELOAD_VALUE - Reload value <15-4294967295> + + +#ifndef WDT_CONFIG_RELOAD_VALUE +#define WDT_CONFIG_RELOAD_VALUE 2000 +#endif + +// WDT_CONFIG_IRQ_PRIORITY - Interrupt priority + + +// Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef WDT_CONFIG_IRQ_PRIORITY +#define WDT_CONFIG_IRQ_PRIORITY 7 +#endif + +// WDT_CONFIG_LOG_ENABLED - Enables logging in the module. +//========================================================== +#ifndef WDT_CONFIG_LOG_ENABLED +#define WDT_CONFIG_LOG_ENABLED 0 +#endif +#if WDT_CONFIG_LOG_ENABLED +// WDT_CONFIG_LOG_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef WDT_CONFIG_LOG_LEVEL +#define WDT_CONFIG_LOG_LEVEL 3 +#endif + +// WDT_CONFIG_INFO_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef WDT_CONFIG_INFO_COLOR +#define WDT_CONFIG_INFO_COLOR 0 +#endif + +// WDT_CONFIG_DEBUG_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef WDT_CONFIG_DEBUG_COLOR +#define WDT_CONFIG_DEBUG_COLOR 0 +#endif + +#endif //WDT_CONFIG_LOG_ENABLED +// + +#endif //WDT_ENABLED +// + +// +//========================================================== + +// nRF_Libraries + +//========================================================== +// APP_FIFO_ENABLED - app_fifo - Software FIFO implementation + + +#ifndef APP_FIFO_ENABLED +#define APP_FIFO_ENABLED 0 +#endif + +// APP_GPIOTE_ENABLED - app_gpiote - GPIOTE events dispatcher + + +#ifndef APP_GPIOTE_ENABLED +#define APP_GPIOTE_ENABLED 0 +#endif + +// APP_PWM_ENABLED - app_pwm - PWM functionality + + +#ifndef APP_PWM_ENABLED +#define APP_PWM_ENABLED 0 +#endif + +// APP_SCHEDULER_ENABLED - app_scheduler - Events scheduler +//========================================================== +#ifndef APP_SCHEDULER_ENABLED +#define APP_SCHEDULER_ENABLED 0 +#endif +#if APP_SCHEDULER_ENABLED +// APP_SCHEDULER_WITH_PAUSE - Enabling pause feature + + +#ifndef APP_SCHEDULER_WITH_PAUSE +#define APP_SCHEDULER_WITH_PAUSE 0 +#endif + +// APP_SCHEDULER_WITH_PROFILER - Enabling scheduler profiling + + +#ifndef APP_SCHEDULER_WITH_PROFILER +#define APP_SCHEDULER_WITH_PROFILER 0 +#endif + +#endif //APP_SCHEDULER_ENABLED +// + +// APP_TIMER_ENABLED - app_timer - Application timer functionality +//========================================================== +#ifndef APP_TIMER_ENABLED +#define APP_TIMER_ENABLED 0 +#endif +#if APP_TIMER_ENABLED +// APP_TIMER_WITH_PROFILER - Enable app_timer profiling + + +#ifndef APP_TIMER_WITH_PROFILER +#define APP_TIMER_WITH_PROFILER 0 +#endif + +// APP_TIMER_KEEPS_RTC_ACTIVE - Enable RTC always on + + +// If option is enabled RTC is kept running even if there is no active timers. +// This option can be used when app_timer is used for timestamping. + +#ifndef APP_TIMER_KEEPS_RTC_ACTIVE +#define APP_TIMER_KEEPS_RTC_ACTIVE 0 +#endif + +#endif //APP_TIMER_ENABLED +// + +// APP_TWI_ENABLED - app_twi - TWI transaction manager + + +#ifndef APP_TWI_ENABLED +#define APP_TWI_ENABLED 0 +#endif + +// APP_UART_ENABLED - app_uart - UART driver +//========================================================== +#ifndef APP_UART_ENABLED +#define APP_UART_ENABLED 0 +#endif +#if APP_UART_ENABLED +// APP_UART_DRIVER_INSTANCE - UART instance used + +// <0=> 0 + +#ifndef APP_UART_DRIVER_INSTANCE +#define APP_UART_DRIVER_INSTANCE 0 +#endif + +#endif //APP_UART_ENABLED +// + +// APP_USBD_CLASS_AUDIO_ENABLED - app_usbd_audio - USB AUDIO class + + +#ifndef APP_USBD_CLASS_AUDIO_ENABLED +#define APP_USBD_CLASS_AUDIO_ENABLED 0 +#endif + +// APP_USBD_CLASS_HID_ENABLED - app_usbd_hid - USB HID class + + +#ifndef APP_USBD_CLASS_HID_ENABLED +#define APP_USBD_CLASS_HID_ENABLED 0 +#endif + +// APP_USBD_HID_GENERIC_ENABLED - app_usbd_hid_generic - USB HID generic + + +#ifndef APP_USBD_HID_GENERIC_ENABLED +#define APP_USBD_HID_GENERIC_ENABLED 0 +#endif + +// APP_USBD_HID_KBD_ENABLED - app_usbd_hid_kbd - USB HID keyboard + + +#ifndef APP_USBD_HID_KBD_ENABLED +#define APP_USBD_HID_KBD_ENABLED 0 +#endif + +// APP_USBD_HID_MOUSE_ENABLED - app_usbd_hid_mouse - USB HID mouse + + +#ifndef APP_USBD_HID_MOUSE_ENABLED +#define APP_USBD_HID_MOUSE_ENABLED 0 +#endif + +// BUTTON_ENABLED - app_button - buttons handling module + + +#ifndef BUTTON_ENABLED +#define BUTTON_ENABLED 0 +#endif + +// CRC16_ENABLED - crc16 - CRC16 calculation routines + + +#ifndef CRC16_ENABLED +#define CRC16_ENABLED 1 +#endif + +// CRC32_ENABLED - crc32 - CRC32 calculation routines + + +#ifndef CRC32_ENABLED +#define CRC32_ENABLED 1 +#endif + +// ECC_ENABLED - ecc - Elliptic Curve Cryptography Library + + +#ifndef ECC_ENABLED +#define ECC_ENABLED 0 +#endif + +// HARDFAULT_HANDLER_ENABLED - hardfault_default - HardFault default handler for debugging and release + + +#ifndef HARDFAULT_HANDLER_ENABLED +#define HARDFAULT_HANDLER_ENABLED 1 +#endif + +// HCI_MEM_POOL_ENABLED - hci_mem_pool - memory pool implementation used by HCI +//========================================================== +#ifndef HCI_MEM_POOL_ENABLED +#define HCI_MEM_POOL_ENABLED 0 +#endif +#if HCI_MEM_POOL_ENABLED +// HCI_TX_BUF_SIZE - TX buffer size in bytes. +#ifndef HCI_TX_BUF_SIZE +#define HCI_TX_BUF_SIZE 600 +#endif + +// HCI_RX_BUF_SIZE - RX buffer size in bytes. +#ifndef HCI_RX_BUF_SIZE +#define HCI_RX_BUF_SIZE 600 +#endif + +// HCI_RX_BUF_QUEUE_SIZE - RX buffer queue size. +#ifndef HCI_RX_BUF_QUEUE_SIZE +#define HCI_RX_BUF_QUEUE_SIZE 4 +#endif + +#endif //HCI_MEM_POOL_ENABLED +// + +// HCI_SLIP_ENABLED - hci_slip - SLIP protocol implementation used by HCI +//========================================================== +#ifndef HCI_SLIP_ENABLED +#define HCI_SLIP_ENABLED 0 +#endif +#if HCI_SLIP_ENABLED +// HCI_UART_BAUDRATE - Default Baudrate + +// <323584=> 1200 baud +// <643072=> 2400 baud +// <1290240=> 4800 baud +// <2576384=> 9600 baud +// <3862528=> 14400 baud +// <5152768=> 19200 baud +// <7716864=> 28800 baud +// <10289152=> 38400 baud +// <15400960=> 57600 baud +// <20615168=> 76800 baud +// <30801920=> 115200 baud +// <61865984=> 230400 baud +// <67108864=> 250000 baud +// <121634816=> 460800 baud +// <251658240=> 921600 baud +// <268435456=> 57600 baud + +#ifndef HCI_UART_BAUDRATE +#define HCI_UART_BAUDRATE 30801920 +#endif + +// HCI_UART_FLOW_CONTROL - Hardware Flow Control + +// <0=> Disabled +// <1=> Enabled + +#ifndef HCI_UART_FLOW_CONTROL +#define HCI_UART_FLOW_CONTROL 0 +#endif + +// HCI_UART_RX_PIN - UART RX pin +#ifndef HCI_UART_RX_PIN +#define HCI_UART_RX_PIN 8 +#endif + +// HCI_UART_TX_PIN - UART TX pin +#ifndef HCI_UART_TX_PIN +#define HCI_UART_TX_PIN 6 +#endif + +// HCI_UART_RTS_PIN - UART RTS pin +#ifndef HCI_UART_RTS_PIN +#define HCI_UART_RTS_PIN 5 +#endif + +// HCI_UART_CTS_PIN - UART CTS pin +#ifndef HCI_UART_CTS_PIN +#define HCI_UART_CTS_PIN 7 +#endif + +#endif //HCI_SLIP_ENABLED +// + +// HCI_TRANSPORT_ENABLED - hci_transport - HCI transport +//========================================================== +#ifndef HCI_TRANSPORT_ENABLED +#define HCI_TRANSPORT_ENABLED 0 +#endif +#if HCI_TRANSPORT_ENABLED +// HCI_MAX_PACKET_SIZE_IN_BITS - Maximum size of a single application packet in bits. +#ifndef HCI_MAX_PACKET_SIZE_IN_BITS +#define HCI_MAX_PACKET_SIZE_IN_BITS 8000 +#endif + +#endif //HCI_TRANSPORT_ENABLED +// + +// LED_SOFTBLINK_ENABLED - led_softblink - led_softblink module + + +#ifndef LED_SOFTBLINK_ENABLED +#define LED_SOFTBLINK_ENABLED 0 +#endif + +// LOW_POWER_PWM_ENABLED - low_power_pwm - low_power_pwm module + + +#ifndef LOW_POWER_PWM_ENABLED +#define LOW_POWER_PWM_ENABLED 0 +#endif + +// MEM_MANAGER_ENABLED - mem_manager - Dynamic memory allocator +//========================================================== +#ifndef MEM_MANAGER_ENABLED +#define MEM_MANAGER_ENABLED 0 +#endif +#if MEM_MANAGER_ENABLED +// MEMORY_MANAGER_SMALL_BLOCK_COUNT - Size of each memory blocks identified as 'small' block. <0-255> + + +#ifndef MEMORY_MANAGER_SMALL_BLOCK_COUNT +#define MEMORY_MANAGER_SMALL_BLOCK_COUNT 1 +#endif + +// MEMORY_MANAGER_SMALL_BLOCK_SIZE - Size of each memory blocks identified as 'small' block. +// Size of each memory blocks identified as 'small' block. Memory block are recommended to be word-sized. + +#ifndef MEMORY_MANAGER_SMALL_BLOCK_SIZE +#define MEMORY_MANAGER_SMALL_BLOCK_SIZE 32 +#endif + +// MEMORY_MANAGER_MEDIUM_BLOCK_COUNT - Size of each memory blocks identified as 'medium' block. <0-255> + + +#ifndef MEMORY_MANAGER_MEDIUM_BLOCK_COUNT +#define MEMORY_MANAGER_MEDIUM_BLOCK_COUNT 0 +#endif + +// MEMORY_MANAGER_MEDIUM_BLOCK_SIZE - Size of each memory blocks identified as 'medium' block. +// Size of each memory blocks identified as 'medium' block. Memory block are recommended to be word-sized. + +#ifndef MEMORY_MANAGER_MEDIUM_BLOCK_SIZE +#define MEMORY_MANAGER_MEDIUM_BLOCK_SIZE 256 +#endif + +// MEMORY_MANAGER_LARGE_BLOCK_COUNT - Size of each memory blocks identified as 'large' block. <0-255> + + +#ifndef MEMORY_MANAGER_LARGE_BLOCK_COUNT +#define MEMORY_MANAGER_LARGE_BLOCK_COUNT 0 +#endif + +// MEMORY_MANAGER_LARGE_BLOCK_SIZE - Size of each memory blocks identified as 'large' block. +// Size of each memory blocks identified as 'large' block. Memory block are recommended to be word-sized. + +#ifndef MEMORY_MANAGER_LARGE_BLOCK_SIZE +#define MEMORY_MANAGER_LARGE_BLOCK_SIZE 256 +#endif + +// MEM_MANAGER_ENABLE_LOGS - Enable debug trace in the module. + + +#ifndef MEM_MANAGER_ENABLE_LOGS +#define MEM_MANAGER_ENABLE_LOGS 0 +#endif + +// MEM_MANAGER_DISABLE_API_PARAM_CHECK - Disable API parameter checks in the module. + + +#ifndef MEM_MANAGER_DISABLE_API_PARAM_CHECK +#define MEM_MANAGER_DISABLE_API_PARAM_CHECK 0 +#endif + +#endif //MEM_MANAGER_ENABLED +// + +// NRF_CSENSE_ENABLED - nrf_csense - nrf_csense module +//========================================================== +#ifndef NRF_CSENSE_ENABLED +#define NRF_CSENSE_ENABLED 0 +#endif +#if NRF_CSENSE_ENABLED +// NRF_CSENSE_PAD_HYSTERESIS - Minimal value of change to decide that pad was touched. +#ifndef NRF_CSENSE_PAD_HYSTERESIS +#define NRF_CSENSE_PAD_HYSTERESIS 15 +#endif + +// NRF_CSENSE_PAD_DEVIATION - Minimal value measured on pad to take its value while calculating step. +#ifndef NRF_CSENSE_PAD_DEVIATION +#define NRF_CSENSE_PAD_DEVIATION 70 +#endif + +// NRF_CSENSE_MIN_PAD_VALUE - Minimum normalized value on pad to take its value into account. +#ifndef NRF_CSENSE_MIN_PAD_VALUE +#define NRF_CSENSE_MIN_PAD_VALUE 20 +#endif + +// NRF_CSENSE_MAX_PADS_NUMBER - Maximum number of pads used for one instance. +#ifndef NRF_CSENSE_MAX_PADS_NUMBER +#define NRF_CSENSE_MAX_PADS_NUMBER 20 +#endif + +// NRF_CSENSE_MAX_VALUE - Maximum normalized value got from measurement. +#ifndef NRF_CSENSE_MAX_VALUE +#define NRF_CSENSE_MAX_VALUE 1000 +#endif + +// NRF_CSENSE_OUTPUT_PIN - Output pin used by lower module. +// This is only used when running on NRF51. + +#ifndef NRF_CSENSE_OUTPUT_PIN +#define NRF_CSENSE_OUTPUT_PIN 30 +#endif + +#endif //NRF_CSENSE_ENABLED +// + +// NRF_DRV_CSENSE_ENABLED - nrf_drv_csense - Capacitive sensor module +//========================================================== +#ifndef NRF_DRV_CSENSE_ENABLED +#define NRF_DRV_CSENSE_ENABLED 0 +#endif +#if NRF_DRV_CSENSE_ENABLED +// TIMER0_FOR_CSENSE - First TIMER instance used by the driver (except nRF51) +#ifndef TIMER0_FOR_CSENSE +#define TIMER0_FOR_CSENSE 1 +#endif + +// TIMER1_FOR_CSENSE - Second TIMER instance used by the driver (except nRF51) +#ifndef TIMER1_FOR_CSENSE +#define TIMER1_FOR_CSENSE 2 +#endif + +// MEASUREMENT_PERIOD - Single measurement period. +// Time of single measurement can be calculated as T = (1/2)*MEASUREMENT_PERIOD*(1/f_OSC) where f_OSC = I_SOURCE / (2C*(VUP-VDOWN) ). I_SOURCE, VUP and VDOWN are values used to initialize COMP and C is capacitance of used pad. + +#ifndef MEASUREMENT_PERIOD +#define MEASUREMENT_PERIOD 20 +#endif + +#endif //NRF_DRV_CSENSE_ENABLED +// + +// NRF_QUEUE_ENABLED - nrf_queue - Queue module + + +#ifndef NRF_QUEUE_ENABLED +#define NRF_QUEUE_ENABLED 1 +#endif + +// SLIP_ENABLED - slip - SLIP encoding decoding + + +#ifndef SLIP_ENABLED +#define SLIP_ENABLED 0 +#endif + +// app_usbd_cdc_acm - USB CDC ACM class + +//========================================================== +// APP_USBD_CLASS_CDC_ACM_ENABLED - Enabling USBD CDC ACM Class library + + +#ifndef APP_USBD_CLASS_CDC_ACM_ENABLED +#define APP_USBD_CLASS_CDC_ACM_ENABLED 0 +#endif + +// APP_USBD_CDC_ACM_LOG_ENABLED - Enables logging in the module. + + +#ifndef APP_USBD_CDC_ACM_LOG_ENABLED +#define APP_USBD_CDC_ACM_LOG_ENABLED 0 +#endif + +// +//========================================================== + +// app_usbd_msc - USB MSC class + +//========================================================== +// APP_USBD_CLASS_MSC_ENABLED - Enabling USBD MSC Class library + + +#ifndef APP_USBD_CLASS_MSC_ENABLED +#define APP_USBD_CLASS_MSC_ENABLED 0 +#endif + +// APP_USBD_MSC_CLASS_LOG_ENABLED - Enables logging in the module. + + +#ifndef APP_USBD_MSC_CLASS_LOG_ENABLED +#define APP_USBD_MSC_CLASS_LOG_ENABLED 0 +#endif + +// +//========================================================== + +// +//========================================================== + +// nRF_Log + +//========================================================== +// NRF_LOG_ENABLED - nrf_log - Logging +//========================================================== +#ifndef NRF_LOG_ENABLED +#define NRF_LOG_ENABLED 0 +#endif +#if NRF_LOG_ENABLED +// NRF_LOG_USES_COLORS - If enabled then ANSI escape code for colors is prefixed to every string +//========================================================== +#ifndef NRF_LOG_USES_COLORS +#define NRF_LOG_USES_COLORS 0 +#endif +#if NRF_LOG_USES_COLORS +// NRF_LOG_COLOR_DEFAULT - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef NRF_LOG_COLOR_DEFAULT +#define NRF_LOG_COLOR_DEFAULT 0 +#endif + +// NRF_LOG_ERROR_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef NRF_LOG_ERROR_COLOR +#define NRF_LOG_ERROR_COLOR 0 +#endif + +// NRF_LOG_WARNING_COLOR - ANSI escape code prefix. + +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White + +#ifndef NRF_LOG_WARNING_COLOR +#define NRF_LOG_WARNING_COLOR 0 +#endif + +#endif //NRF_LOG_USES_COLORS +// + +// NRF_LOG_DEFAULT_LEVEL - Default Severity level + +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug + +#ifndef NRF_LOG_DEFAULT_LEVEL +#define NRF_LOG_DEFAULT_LEVEL 3 +#endif + +// NRF_LOG_DEFERRED - Enable deffered logger. + +// Log data is buffered and can be processed in idle. +//========================================================== +#ifndef NRF_LOG_DEFERRED +#define NRF_LOG_DEFERRED 1 +#endif +#if NRF_LOG_DEFERRED +// NRF_LOG_DEFERRED_BUFSIZE - Size of the buffer for logs in words. +// Must be power of 2 + +#ifndef NRF_LOG_DEFERRED_BUFSIZE +#define NRF_LOG_DEFERRED_BUFSIZE 256 +#endif + +#endif //NRF_LOG_DEFERRED +// + +// NRF_LOG_USES_TIMESTAMP - Enable timestamping + + +// Function for getting the timestamp is provided by the user + +#ifndef NRF_LOG_USES_TIMESTAMP +#define NRF_LOG_USES_TIMESTAMP 0 +#endif + +#endif //NRF_LOG_ENABLED +// + +// nrf_log_backend - Logging sink + +//========================================================== +// NRF_LOG_BACKEND_MAX_STRING_LENGTH - Buffer for storing single output string +// Logger backend RAM usage is determined by this value. + +#ifndef NRF_LOG_BACKEND_MAX_STRING_LENGTH +#define NRF_LOG_BACKEND_MAX_STRING_LENGTH 256 +#endif + +// NRF_LOG_TIMESTAMP_DIGITS - Number of digits for timestamp +// If higher resolution timestamp source is used it might be needed to increase that + +#ifndef NRF_LOG_TIMESTAMP_DIGITS +#define NRF_LOG_TIMESTAMP_DIGITS 8 +#endif + +// NRF_LOG_BACKEND_SERIAL_USES_UART - If enabled data is printed over UART +//========================================================== +#ifndef NRF_LOG_BACKEND_SERIAL_USES_UART +#define NRF_LOG_BACKEND_SERIAL_USES_UART 1 +#endif +#if NRF_LOG_BACKEND_SERIAL_USES_UART +// NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE - Default Baudrate + +// <323584=> 1200 baud +// <643072=> 2400 baud +// <1290240=> 4800 baud +// <2576384=> 9600 baud +// <3862528=> 14400 baud +// <5152768=> 19200 baud +// <7716864=> 28800 baud +// <10289152=> 38400 baud +// <15400960=> 57600 baud +// <20615168=> 76800 baud +// <30801920=> 115200 baud +// <61865984=> 230400 baud +// <67108864=> 250000 baud +// <121634816=> 460800 baud +// <251658240=> 921600 baud +// <268435456=> 57600 baud + +#ifndef NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE +#define NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE 30801920 +#endif + +// NRF_LOG_BACKEND_SERIAL_UART_TX_PIN - UART TX pin +#ifndef NRF_LOG_BACKEND_SERIAL_UART_TX_PIN +#define NRF_LOG_BACKEND_SERIAL_UART_TX_PIN 6 +#endif + +// NRF_LOG_BACKEND_SERIAL_UART_RX_PIN - UART RX pin +#ifndef NRF_LOG_BACKEND_SERIAL_UART_RX_PIN +#define NRF_LOG_BACKEND_SERIAL_UART_RX_PIN 8 +#endif + +// NRF_LOG_BACKEND_SERIAL_UART_RTS_PIN - UART RTS pin +#ifndef NRF_LOG_BACKEND_SERIAL_UART_RTS_PIN +#define NRF_LOG_BACKEND_SERIAL_UART_RTS_PIN 5 +#endif + +// NRF_LOG_BACKEND_SERIAL_UART_CTS_PIN - UART CTS pin +#ifndef NRF_LOG_BACKEND_SERIAL_UART_CTS_PIN +#define NRF_LOG_BACKEND_SERIAL_UART_CTS_PIN 7 +#endif + +// NRF_LOG_BACKEND_SERIAL_UART_FLOW_CONTROL - Hardware Flow Control + +// <0=> Disabled +// <1=> Enabled + +#ifndef NRF_LOG_BACKEND_SERIAL_UART_FLOW_CONTROL +#define NRF_LOG_BACKEND_SERIAL_UART_FLOW_CONTROL 0 +#endif + +// NRF_LOG_BACKEND_UART_INSTANCE - UART instance used + +// <0=> 0 + +#ifndef NRF_LOG_BACKEND_UART_INSTANCE +#define NRF_LOG_BACKEND_UART_INSTANCE 0 +#endif + +#endif //NRF_LOG_BACKEND_SERIAL_USES_UART +// + +// NRF_LOG_BACKEND_SERIAL_USES_RTT - If enabled data is printed using RTT +//========================================================== +#ifndef NRF_LOG_BACKEND_SERIAL_USES_RTT +#define NRF_LOG_BACKEND_SERIAL_USES_RTT 0 +#endif +#if NRF_LOG_BACKEND_SERIAL_USES_RTT +// NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE - RTT output buffer size. +// Should be equal or bigger than \ref NRF_LOG_BACKEND_MAX_STRING_LENGTH. +// This value is used in Segger RTT configuration to set the buffer size +// if it is bigger than default RTT buffer size. + +#ifndef NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE +#define NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE 512 +#endif + +#endif //NRF_LOG_BACKEND_SERIAL_USES_RTT +// + +// +//========================================================== + +// +//========================================================== + +// nRF_Segger_RTT + +//========================================================== +// segger_rtt - SEGGER RTT + +//========================================================== +// SEGGER_RTT_CONFIG_BUFFER_SIZE_UP - Size of upstream buffer. +// Note that either @ref NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE +// or this value is actually used. It depends on which one is bigger. + +#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP +#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 64 +#endif + +// SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Size of upstream buffer. +#ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS +#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2 +#endif + +// SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of upstream buffer. +#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN +#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16 +#endif + +// SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS - Size of upstream buffer. +#ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS +#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2 +#endif + +// SEGGER_RTT_CONFIG_DEFAULT_MODE - RTT behavior if the buffer is full. + + +// The following modes are supported: +// - SKIP - Do not block, output nothing. +// - TRIM - Do not block, output as much as fits. +// - BLOCK - Wait until there is space in the buffer. +// <0=> SKIP +// <1=> TRIM +// <2=> BLOCK_IF_FIFO_FULL + +#ifndef SEGGER_RTT_CONFIG_DEFAULT_MODE +#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0 +#endif + +// +//========================================================== + +// +//========================================================== + +// <<< end of configuration section >>> +#endif //SDK_CONFIG_H + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c index 548aeebe9d..1ac470a227 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c @@ -146,7 +146,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) .frequency = NRF_TWI_FREQ_100K, #ifdef NRF51 .interrupt_priority = APP_IRQ_PRIORITY_LOW -#elif defined(NRF52) +#elif defined(NRF52) || defined(NRF52840_XXAA) .interrupt_priority = APP_IRQ_PRIORITY_LOWEST #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c deleted file mode 100644 index e3bd06ea88..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_dtm/ble_dtm_hw_nrf51.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "ble_dtm_hw.h" -#include "ble_dtm.h" -#include -#include -#include "nrf.h" - - -void dtm_turn_off_test() -{ - NRF_RADIO->TEST = 0; -} - - -void dtm_constant_carrier() -{ - NRF_RADIO->TEST = (RADIO_TEST_PLL_LOCK_Enabled << RADIO_TEST_PLL_LOCK_Pos) | - (RADIO_TEST_CONST_CARRIER_Enabled << RADIO_TEST_CONST_CARRIER_Pos); -} - - -uint32_t dtm_radio_validate(int32_t m_tx_power, uint8_t m_radio_mode) -{ - // Handle BLE Radio tuning parameters from production for DTM if required. - // Only needed for DTM without SoftDevice, as the SoftDevice normally handles this. - // PCN-083. - if ( ((NRF_FICR->OVERRIDEEN) & FICR_OVERRIDEEN_BLE_1MBIT_Msk) == FICR_OVERRIDEEN_BLE_1MBIT_Override) - { - NRF_RADIO->OVERRIDE0 = NRF_FICR->BLE_1MBIT[0]; - NRF_RADIO->OVERRIDE1 = NRF_FICR->BLE_1MBIT[1]; - NRF_RADIO->OVERRIDE2 = NRF_FICR->BLE_1MBIT[2]; - NRF_RADIO->OVERRIDE3 = NRF_FICR->BLE_1MBIT[3]; - NRF_RADIO->OVERRIDE4 = NRF_FICR->BLE_1MBIT[4]; - } - - // Initializing code below is quite generic - for BLE, the values are fixed, and expressions - // are constant. Non-constant values are essentially set in radio_prepare(). - if (!(m_tx_power == RADIO_TXPOWER_TXPOWER_0dBm || - m_tx_power == RADIO_TXPOWER_TXPOWER_Pos4dBm || - m_tx_power == RADIO_TXPOWER_TXPOWER_Neg30dBm || - m_tx_power == RADIO_TXPOWER_TXPOWER_Neg20dBm || - m_tx_power == RADIO_TXPOWER_TXPOWER_Neg16dBm || - m_tx_power == RADIO_TXPOWER_TXPOWER_Neg12dBm || - m_tx_power == RADIO_TXPOWER_TXPOWER_Neg8dBm || - m_tx_power == RADIO_TXPOWER_TXPOWER_Neg4dBm - ) || - (m_radio_mode > RADIO_MODE_MODE_Ble_1Mbit) // Values 0 - 2: Proprietary mode, 3 (last valid): BLE - ) - { - return DTM_ERROR_ILLEGAL_CONFIGURATION; - } - - return DTM_SUCCESS; -} - - -bool dtm_hw_set_timer(NRF_TIMER_Type ** mp_timer, IRQn_Type * m_timer_irq, uint32_t new_timer) -{ - if (new_timer == 0) - { - *mp_timer = NRF_TIMER0; - *m_timer_irq = TIMER0_IRQn; - } - else if (new_timer == 1) - { - *mp_timer = NRF_TIMER1; - *m_timer_irq = TIMER1_IRQn; - } - else if (new_timer == 2) - { - *mp_timer = NRF_TIMER2; - *m_timer_irq = TIMER2_IRQn; - } - else - { - // Parameter error: Only TIMER 0, 1, 2 provided by nRF51 - return false; - } - // New timer has been selected: - return true; -} - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c deleted file mode 100644 index ac2369eb78..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.c +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (c) 2012 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* Attention! -* To maintain compliance with Nordic Semiconductor ASA’s Bluetooth profile -* qualification listings, this section of source code must not be modified. -*/ - -#include "ble_dfu.h" -#include "nrf_log.h" -#include -#include "ble_hci.h" -#include "sdk_macros.h" -#include "ble_srv_common.h" -#include "nrf_dfu_settings.h" - -#define MAX_CTRL_POINT_RESP_PARAM_LEN 3 - -ble_dfu_t * p_m_dfu; - - -void flash_callback(fs_evt_t const * const evt, fs_ret_t result) -{ - if (result == FS_SUCCESS) - { - NRF_LOG_INFO("Obtained settings, enter dfu is %d\n", s_dfu_settings.enter_buttonless_dfu); - - (void)sd_ble_gap_disconnect(p_m_dfu->conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); - - p_m_dfu->is_waiting_for_disconnection = true; - } -} - -static void enter_bootloader(ble_dfu_t * p_dfu) -{ - if (p_dfu->evt_handler != NULL) - { - ble_dfu_evt_t evt; - - evt.type = BLE_DFU_EVT_ENTERING_BOOTLOADER; - - p_dfu->evt_handler(p_dfu, &evt); - } - - s_dfu_settings.enter_buttonless_dfu = true; - - (void)nrf_dfu_settings_write(flash_callback); - - /* - TODO: - - Save bond data - */ -} - - -/**@brief Function for adding RX characteristic. - * - * @param[in] p_nus Nordic UART Service structure. - * @param[in] p_nus_init Information needed to initialize the service. - * - * @return NRF_SUCCESS on success, otherwise an error code. - */ -static uint32_t rx_char_add(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init) -{ - /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */ - ble_gatts_char_md_t char_md; - ble_gatts_attr_md_t cccd_md; - ble_gatts_attr_t attr_char_value; - ble_uuid_t ble_uuid; - ble_gatts_attr_md_t attr_md; - - memset(&cccd_md, 0, sizeof(cccd_md)); - - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); - - cccd_md.vloc = BLE_GATTS_VLOC_STACK; - - memset(&char_md, 0, sizeof(char_md)); - - char_md.char_props.notify = 1; - char_md.char_props.write = 1; - char_md.p_char_user_desc = NULL; - char_md.p_char_pf = NULL; - char_md.p_user_desc_md = NULL; - char_md.p_cccd_md = &cccd_md; - char_md.p_sccd_md = NULL; - - ble_uuid.type = p_dfu->uuid_type; - ble_uuid.uuid = 0x0001; - - memset(&attr_md, 0, sizeof(attr_md)); - - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); - - attr_md.vloc = BLE_GATTS_VLOC_STACK; - attr_md.rd_auth = 0; - attr_md.wr_auth = 1; - attr_md.vlen = 1; - - memset(&attr_char_value, 0, sizeof(attr_char_value)); - - attr_char_value.p_uuid = &ble_uuid; - attr_char_value.p_attr_md = &attr_md; - attr_char_value.init_len = 0; - attr_char_value.init_offs = 0; - attr_char_value.max_len = BLE_L2CAP_MTU_DEF; - - return sd_ble_gatts_characteristic_add(p_dfu->service_handle, - &char_md, - &attr_char_value, - &p_dfu->control_point_char); - /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */ -} - - - -uint32_t ble_dfu_init(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init) -{ - uint32_t err_code; - ble_uuid_t ble_uuid; - ble_uuid128_t nus_base_uuid = BLE_DFU_BASE_UUID; - - VERIFY_PARAM_NOT_NULL(p_dfu); - VERIFY_PARAM_NOT_NULL(p_dfu_init); - - p_m_dfu = p_dfu; // TODO: find a nicer solution to this - - // Initialize the service structure. - p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; - p_dfu->evt_handler = p_dfu_init->evt_handler; - p_dfu->is_waiting_for_disconnection = false; - p_dfu->is_ctrlpt_notification_enabled = false; - - /**@snippet [Adding proprietary Service to S110 SoftDevice] */ - // Add a custom base UUID. - err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_dfu->uuid_type); - VERIFY_SUCCESS(err_code); - - ble_uuid.type = p_dfu->uuid_type; - ble_uuid.uuid = BLE_UUID_DFU_SERVICE; - - // Add the service. - err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, - &ble_uuid, - &p_dfu->service_handle); - /**@snippet [Adding proprietary Service to S110 SoftDevice] */ - VERIFY_SUCCESS(err_code); - - // Add the RX Characteristic. - err_code = rx_char_add(p_dfu, p_dfu_init); - VERIFY_SUCCESS(err_code); - - err_code = nrf_dfu_flash_init(true); - VERIFY_SUCCESS(err_code); - - nrf_dfu_settings_init(); - - return NRF_SUCCESS; -} - -static void resp_send(ble_dfu_t * p_dfu, ble_dfu_buttonless_op_code_t op_code, ble_dfu_rsp_code_t rsp_code) -{ - // Send notification - uint16_t hvx_len; - uint8_t hvx_data[MAX_CTRL_POINT_RESP_PARAM_LEN]; - ble_gatts_hvx_params_t hvx_params; - - memset(&hvx_params, 0, sizeof(hvx_params)); - - hvx_len = 3; - hvx_data[0] = DFU_OP_RESPONSE_CODE; - hvx_data[1] = (uint8_t)op_code; - hvx_data[2] = (uint8_t)rsp_code; - - hvx_params.handle = p_dfu->control_point_char.value_handle; - hvx_params.type = BLE_GATT_HVX_NOTIFICATION; - hvx_params.offset = 0; - hvx_params.p_len = &hvx_len; - hvx_params.p_data = hvx_data; - - (void)sd_ble_gatts_hvx(p_dfu->conn_handle, &hvx_params); -} - - - -/**@brief Handle write events to the Location and Navigation Service Control Point characteristic. - * - * @param[in] p_dfu DFU Service structure. - * @param[in] p_evt_write Write event received from the BLE stack. - */ -static void on_ctrlpt_write(ble_dfu_t * p_dfu, ble_gatts_evt_write_t const * p_evt_write) -{ - uint32_t err_code; - ble_dfu_rsp_code_t rsp_code = DFU_RSP_OPERATION_FAILED; - - ble_gatts_rw_authorize_reply_params_t write_authorize_reply; - memset(&write_authorize_reply, 0, sizeof(write_authorize_reply)); - - write_authorize_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; - - if (p_dfu->is_ctrlpt_notification_enabled) - { - write_authorize_reply.params.write.update = 1; - write_authorize_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; - } - else - { - write_authorize_reply.params.write.gatt_status = DFU_RSP_CCCD_CONFIG_IMPROPER; - } - - // reply to the write authorization - do { - err_code = sd_ble_gatts_rw_authorize_reply(p_dfu->conn_handle, &write_authorize_reply); - } while (err_code == NRF_ERROR_BUSY); - - - if (write_authorize_reply.params.write.gatt_status != BLE_GATT_STATUS_SUCCESS) - { - return; - } - - // Start executing the control point write action - - switch (p_evt_write->data[0]) - { - case BLE_DFU_ENTER_BOOTLOADER: - rsp_code = DFU_RSP_SUCCESS; - break; - - // Unrecognized Op Code - default: - rsp_code = DFU_RSP_OP_CODE_NOT_SUPPORTED; - break; - } - - resp_send(p_dfu, (ble_dfu_buttonless_op_code_t)p_evt_write->data[0], rsp_code); - - if (rsp_code == BLE_DFU_ENTER_BOOTLOADER - && p_evt_write->data[0] == BLE_DFU_ENTER_BOOTLOADER) - { - enter_bootloader(p_dfu); - } -} - - -/**@brief Write authorization request event handler. - * - * @details The write authorization request event handler is called when writing to the control point. - * - * @param[in] p_dfu DFU structure. - * @param[in] p_ble_evt Event received from the BLE stack. - */ -static void on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) -{ - if (p_ble_evt->evt.gatts_evt.conn_handle != p_dfu->conn_handle) - { - return; - } - - const ble_gatts_evt_rw_authorize_request_t * p_auth_req = - &p_ble_evt->evt.gatts_evt.params.authorize_request; - - if ( - (p_auth_req->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) - && - (p_auth_req->request.write.handle == p_dfu->control_point_char.value_handle) - && - (p_auth_req->request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ) - && - (p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) - && - (p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) - ) - { - on_ctrlpt_write(p_dfu, &p_auth_req->request.write); - } - -} - -/**@brief Connect event handler. - * - * @param[in] p_dfu DFU Service structure. - * @param[in] p_ble_evt Event received from the BLE stack. - */ -static void on_connect(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) -{ - p_dfu->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; -} - - -/**@brief Disconnect event handler. - * - * @param[in] p_dfu DFU Service structure. - * @param[in] p_ble_evt Event received from the BLE stack. - */ -static void on_disconnect(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) -{ - if (p_dfu->conn_handle != p_ble_evt->evt.gatts_evt.conn_handle) - { - return; - } - - p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; - - if (p_dfu->is_waiting_for_disconnection) - { - NVIC_SystemReset(); - } -} - -/**@brief Write event handler. - * - * @param[in] p_dfu DFU Service structure. - * @param[in] p_ble_evt Event received from the BLE stack.rtt - */ -static void on_write(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) -{ - const ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; - - if (p_evt_write->handle != p_dfu->control_point_char.cccd_handle) - { - return; - } - - if (p_evt_write->len == BLE_CCCD_VALUE_LEN) - { - // CCCD written, update indications state - p_dfu->is_ctrlpt_notification_enabled = ble_srv_is_notification_enabled(p_evt_write->data); - - if (p_dfu->evt_handler != NULL) - { - ble_dfu_evt_t evt; - - if (p_dfu->is_ctrlpt_notification_enabled) - { - evt.type = BLE_DFU_EVT_INDICATION_ENABLED; - } - else - { - evt.type = BLE_DFU_EVT_INDICATION_DISABLED; - } - - p_dfu->evt_handler(p_dfu, &evt); - } - } -} - - -void ble_dfu_on_ble_evt(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) -{ - VERIFY_PARAM_NOT_NULL_VOID(p_dfu); - VERIFY_PARAM_NOT_NULL_VOID(p_ble_evt); - - switch (p_ble_evt->header.evt_id) - { - case BLE_GAP_EVT_CONNECTED: - on_connect(p_dfu, p_ble_evt); - break; - - case BLE_GAP_EVT_DISCONNECTED: - on_disconnect(p_dfu, p_ble_evt); - break; - - case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: - on_rw_authorize_req(p_dfu, p_ble_evt); - break; - - case BLE_GATTS_EVT_WRITE: - on_write(p_dfu, p_ble_evt); - break; - - default: - // no implementation - break; - } - -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h deleted file mode 100644 index 04d154d94f..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_services/ble_dfu/ble_dfu.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2012 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** @file - * - * @defgroup ble_dfu Buttonless DFU Service - * @{ - * @ingroup ble_sdk_srv - * @brief Buttonless DFU Service module. - * - * @details - * - * @note Attention! - * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile - * qualification listings, this section of source code must not be modified. - */ - -#ifndef BLE_DFU_H__ -#define BLE_DFU_H__ - -#include -#include "ble_srv_common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define BLE_UUID_DFU_SERVICE 0x0001 -#define BLE_DFU_BASE_UUID {{0x50, 0xEA, 0xDA, 0x30, 0x88, 0x83, 0xB8, 0x9F, 0x60, 0x4F, 0x15, 0xF3, 0x00, 0x00, 0x40, 0x8E}} /**< Used vendor specific UUID. */ - -#define BLE_DFU_ENTER_BOOTLOADER 0x01 - -typedef enum { - BLE_DFU_EVT_ENTERING_BOOTLOADER, /**< Event indicating that the bootloader will be entered after return of this event.*/ - BLE_DFU_EVT_INDICATION_ENABLED, /**< Indication that the control point is enabled.*/ - BLE_DFU_EVT_INDICATION_DISABLED /**< Indication that the control point is disabled.*/ -} ble_dfu_evt_type_t; - -typedef struct { - ble_dfu_evt_type_t type; -} ble_dfu_evt_t; -/* Forward declaration of the ble_nus_t type. */ -typedef struct ble_dfu_s ble_dfu_t; - -/**@brief Nordic UART Service event handler type. */ -typedef void (*ble_dfu_evt_handler_t) (ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt); - - - -// Control Point response values -typedef enum -{ - DFU_RSP_RESERVED = 0x00, /**< Reserved for future use. */ - DFU_RSP_SUCCESS = 0x01, /**< Success. */ - DFU_RSP_OP_CODE_NOT_SUPPORTED = 0x02, /**< Op Code not supported. */ - DFU_RSP_OPERATION_FAILED = 0x04, /**< Operation Failed. */ - DFU_RSP_CCCD_CONFIG_IMPROPER = BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR /**< CCCD is improperly configured. */ -} ble_dfu_rsp_code_t; - -// Control Point Op Code values -typedef enum -{ - DFU_OP_RESERVED = 0x00, /**< Reserved for future use. */ - DFU_OP_ENTER_BOOTLOADER = 0x01, /**< Enter bootloader. */ - DFU_OP_RESPONSE_CODE = 0x20 /**< Response code. */ -} ble_dfu_buttonless_op_code_t; - - - -struct ble_dfu_s { - uint8_t uuid_type; /**< UUID type for DFU UUID. */ - uint16_t service_handle; /**< Handle of DFU (as provided by the SoftDevice). */ - uint16_t conn_handle; - ble_gatts_char_handles_t control_point_char; /**< Handles related to the DFU Control Point characteristic. */ - bool is_ctrlpt_notification_enabled; - - ble_dfu_evt_handler_t evt_handler; /**< Event handler which is called right before. */ - - bool is_waiting_for_disconnection; -}; - -typedef struct { - ble_dfu_evt_handler_t evt_handler; /**< Event handler which is called right before. */ - security_req_t ctrl_point_security_req_write_perm; /**< Read security level of the LN Control Point characteristic. */ - security_req_t ctrl_point_security_req_cccd_write_perm; /**< CCCD write security level of the LN Control Point characteristic. */ -} ble_dfu_init_t; - - -/**@brief Function for initializing the Device Firmware Update module - * - * - * @param[in] p_dfu DFU Service structure. - * @param[in] p_dfu_init The structure containing the values of characteristics needed by the - * service. - * - * @return NRF_SUCCESS on successful initialization of service. - */ -uint32_t ble_dfu_init(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init); - - -/**@brief Function for handling the Application's BLE Stack events. - * - * @details Handles all events from the BLE stack of interest to the Battery Service. - * - * @param[in] p_dfu DFU Service structure. - * @param[in] p_ble_evt Event received from the BLE stack. - */ -void ble_dfu_on_ble_evt(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt); - - -#ifdef __cplusplus -} -#endif - -#endif // BLE_DIS_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/arduino_primo.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/arduino_primo.h new file mode 100644 index 0000000000..2e75181840 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/arduino_primo.h @@ -0,0 +1,89 @@ +/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ +#ifndef ARDUINO_PRIMO_H +#define ARDUINO_PRIMO_H + +#ifdef __cplusplus +extern "C" { +#endif + +// LEDs definitions +#define LEDS_NUMBER 1 + +#define LED_1 25 + +#define LEDS_ACTIVE_STATE 0 + +#define LEDS_LIST { LED_1} + +#define BSP_LED_0 LED_1 + +#define LEDS_INV_MASK 0 + +#define BUTTONS_NUMBER 1 + +#define BUTTON_START 7 +#define BUTTON_1 7 +#define BUTTON_STOP 7 +#define BUTTON_PULL NRF_GPIO_PIN_PULLUP + +#define BUTTONS_ACTIVE_STATE 0 + +#define BUTTONS_LIST { BUTTON_1 } + +#define BSP_BUTTON_0 BUTTON_1 + +#define RX_PIN_NUMBER 11 +#define TX_PIN_NUMBER 12 +#define CTS_PIN_NUMBER UART_PIN_DISCONNECTED +#define RTS_PIN_NUMBER UART_PIN_DISCONNECTED +#define HWFC false + +// Arduino board mappings +#define ARDUINO_SCL_PIN 27 // SCL signal pin +#define ARDUINO_SDA_PIN 26 // SDA signal pin +#define ARDUINO_AREF_PIN 2 // Aref pin +#define ARDUINO_13_PIN 25 // Digital pin 13 +#define ARDUINO_12_PIN 24 // Digital pin 12 +#define ARDUINO_11_PIN 23 // Digital pin 11 +#define ARDUINO_10_PIN 22 // Digital pin 10 +#define ARDUINO_9_PIN 20 // Digital pin 9 +#define ARDUINO_8_PIN 19 // Digital pin 8 + +#define ARDUINO_7_PIN 18 // Digital pin 7 +#define ARDUINO_6_PIN 17 // Digital pin 6 +#define ARDUINO_5_PIN 16 // Digital pin 5 +#define ARDUINO_4_PIN 15 // Digital pin 4 +#define ARDUINO_3_PIN 14 // Digital pin 3 +#define ARDUINO_2_PIN 13 // Digital pin 2 +#define ARDUINO_1_PIN 12 // Digital pin 1 +#define ARDUINO_0_PIN 11 // Digital pin 0 + +#define ARDUINO_A0_PIN 3 // Analog channel 0 +#define ARDUINO_A1_PIN 4 // Analog channel 1 +#define ARDUINO_A2_PIN 28 // Analog channel 2 +#define ARDUINO_A3_PIN 29 // Analog channel 3 +#define ARDUINO_A4_PIN 30 // Analog channel 4 +#define ARDUINO_A5_PIN 31 // Analog channel 5 + +// Low frequency clock source to be used by the SoftDevice +#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ + .rc_ctiv = 0, \ + .rc_temp_ctiv = 0, \ + .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM} + + +#ifdef __cplusplus +} +#endif + +#endif // ARDUINO_PRIMO_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.c new file mode 100644 index 0000000000..9a9f01e055 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.c @@ -0,0 +1,137 @@ +/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. +* +* The information contained herein is property of Nordic Semiconductor ASA. +* Terms and conditions of usage are described in detail in NORDIC +* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. +* +* Licensees are granted free, non-transferable use of the information. NO +* WARRANTY of ANY KIND is provided. This heading must NOT be removed from +* the file. +* +*/ +#include "boards.h" +#include +#include + +#if LEDS_NUMBER > 0 +static const uint8_t m_board_led_list[LEDS_NUMBER] = LEDS_LIST; +#endif + +#if BUTTONS_NUMBER > 0 +static const uint8_t m_board_btn_list[BUTTONS_NUMBER] = BUTTONS_LIST; +#endif + +#if LEDS_NUMBER > 0 +bool bsp_board_led_state_get(uint32_t led_idx) +{ + ASSERT(led_idx < LEDS_NUMBER); + bool pin_set = nrf_gpio_pin_out_read(m_board_led_list[led_idx]) ? true : false; + return (pin_set == (LEDS_ACTIVE_STATE ? true : false)); +} + +void bsp_board_led_on(uint32_t led_idx) +{ + ASSERT(led_idx < LEDS_NUMBER); + nrf_gpio_pin_write(m_board_led_list[led_idx], LEDS_ACTIVE_STATE ? 1 : 0); +} + +void bsp_board_led_off(uint32_t led_idx) +{ + ASSERT(led_idx < LEDS_NUMBER); + nrf_gpio_pin_write(m_board_led_list[led_idx], LEDS_ACTIVE_STATE ? 0 : 1); +} + +void bsp_board_leds_off(void) +{ + uint32_t i; + for(i = 0; i < LEDS_NUMBER; ++i) + { + bsp_board_led_off(i); + } +} + +void bsp_board_leds_on(void) +{ + uint32_t i; + for(i = 0; i < LEDS_NUMBER; ++i) + { + bsp_board_led_on(i); + } +} + +void bsp_board_led_invert(uint32_t led_idx) +{ + ASSERT(led_idx < LEDS_NUMBER); + nrf_gpio_pin_toggle(m_board_led_list[led_idx]); +} + +void bsp_board_leds_init(void) +{ + uint32_t i; + for(i = 0; i < LEDS_NUMBER; ++i) + { + nrf_gpio_cfg_output(m_board_led_list[i]); + } + bsp_board_leds_off(); +} + +uint32_t bsp_board_led_idx_to_pin(uint32_t led_idx) +{ + ASSERT(led_idx < LEDS_NUMBER); + return m_board_led_list[led_idx]; +} + +uint32_t bsp_board_pin_to_led_idx(uint32_t pin_number) +{ + uint32_t ret = 0xFFFFFFFF; + uint32_t i; + for(i = 0; i < LEDS_NUMBER; ++i) + { + if (m_board_led_list[i] == pin_number) + { + ret = i; + break; + } + } + return ret; +} +#endif //LEDS_NUMBER > 0 + +#if BUTTONS_NUMBER > 0 +bool bsp_board_button_state_get(uint32_t button_idx) +{ + ASSERT(button_idx < BUTTONS_NUMBER); + bool pin_set = nrf_gpio_pin_read(m_board_btn_list[button_idx]) ? true : false; + return (pin_set == (BUTTONS_ACTIVE_STATE ? true : false)); +} + +void bsp_board_buttons_init(void) +{ + uint32_t i; + for(i = 0; i < BUTTONS_NUMBER; ++i) + { + nrf_gpio_cfg_input(m_board_btn_list[i], BUTTON_PULL); + } +} + +uint32_t bsp_board_pin_to_button_idx(uint32_t pin_number) +{ + uint32_t i; + uint32_t ret = 0xFFFFFFFF; + for(i = 0; i < BUTTONS_NUMBER; ++i) + { + if (m_board_btn_list[i] == pin_number) + { + ret = i; + break; + } + } + return ret; +} + +uint32_t bsp_board_button_idx_to_pin(uint32_t button_idx) +{ + ASSERT(button_idx < BUTTONS_NUMBER); + return m_board_btn_list[button_idx]; +} +#endif //BUTTONS_NUMBER > 0 diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.h new file mode 100644 index 0000000000..a5c38b5634 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.h @@ -0,0 +1,291 @@ +/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ +#ifndef BOARDS_H +#define BOARDS_H + +#include "nrf_gpio.h" + +#if defined(BOARD_NRF6310) + #include "nrf6310.h" +#elif defined(BOARD_PCA10000) + #include "pca10000.h" +#elif defined(BOARD_PCA10001) + #include "pca10001.h" +#elif defined(BOARD_PCA10002) + #include "pca10000.h" +#elif defined(BOARD_PCA10003) + #include "pca10003.h" +#elif defined(BOARD_PCA20006) + #include "pca20006.h" +#elif defined(BOARD_PCA10028) + #include "pca10028.h" +#elif defined(BOARD_PCA10031) + #include "pca10031.h" +#elif defined(BOARD_PCA10036) + #include "pca10036.h" +#elif defined(BOARD_PCA10040) + #include "pca10040.h" +#elif defined(BOARD_PCA10056) + #include "pca10056.h" +#elif defined(BOARD_WT51822) + #include "wt51822.h" +#elif defined(BOARD_N5DK1) + #include "n5_starterkit.h" +#elif defined (BOARD_D52DK1) + #include "d52_starterkit.h" +#elif defined (BOARD_ARDUINO_PRIMO) + #include "arduino_primo.h" +#elif defined(BOARD_CUSTOM) + #include "custom_board.h" +#else +#error "Board is not defined" + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Function for returning the state of an LED. + * + * @param led_idx LED index (starting from 0), as defined in the board-specific header. + * + * @return True if the LED is turned on. + */ +bool bsp_board_led_state_get(uint32_t led_idx); + +/** + * Function for turning on an LED. + * + * @param led_idx LED index (starting from 0), as defined in the board-specific header. + */ +void bsp_board_led_on(uint32_t led_idx); + +/** + * Function for turning off an LED. + * + * @param led_idx LED index (starting from 0), as defined in the board-specific header. + */ +void bsp_board_led_off(uint32_t led_idx); + +/** + * Function for inverting the state of an LED. + * + * @param led_idx LED index (starting from 0), as defined in the board-specific header. + */ +void bsp_board_led_invert(uint32_t led_idx); +/** + * Function for turning off all LEDs. + */ +void bsp_board_leds_off(void); + +/** + * Function for turning on all LEDs. + */ +void bsp_board_leds_on(void); + +/** + * Function for initializing LEDs. + */ +void bsp_board_leds_init(void); + +/** + * Function for converting pin number to LED index. + * + * @param pin_number Pin number. + * + * @return LED index of the given pin or 0xFFFFFFFF if invalid pin provided. + */ +uint32_t bsp_board_pin_to_led_idx(uint32_t pin_number); + +/** + * Function for converting LED index to pin number. + * + * @param led_idx LED index. + * + * @return Pin number. + */ +uint32_t bsp_board_led_idx_to_pin(uint32_t led_idx); + +/** + * Function for returning the state of a button. + * + * @param button_idx Button index (starting from 0), as defined in the board-specific header. + * + * @return True if the button is pressed. + */ +bool bsp_board_button_state_get(uint32_t button_idx); + +/** + * Function for initializing buttons. + */ +void bsp_board_buttons_init(void); + +/** + * Function for converting pin number to button index. + * + * @param pin_number Pin number. + * + * @return Button index of the given pin or 0xFFFFFFFF if invalid pin provided. + */ +uint32_t bsp_board_pin_to_button_idx(uint32_t pin_number); + + +/** + * Function for converting button index to pin number. + * + * @param button_idx Button index. + * + * @return Pin number. + */ +uint32_t bsp_board_button_idx_to_pin(uint32_t button_idx); + +#define BSP_BOARD_LED_0 0 +#define BSP_BOARD_LED_1 1 +#define BSP_BOARD_LED_2 2 +#define BSP_BOARD_LED_3 3 +#define BSP_BOARD_LED_4 4 +#define BSP_BOARD_LED_5 5 +#define BSP_BOARD_LED_6 6 +#define BSP_BOARD_LED_7 7 + +#ifdef BSP_LED_0 +#define BSP_LED_0_MASK (1<OUTSET = (leds_mask) & (LEDS_MASK & LEDS_INV_MASK); \ + NRF_GPIO->OUTCLR = (leds_mask) & (LEDS_MASK & ~LEDS_INV_MASK); } while (0) + +#define LEDS_ON(leds_mask) do { ASSERT(sizeof(leds_mask) == 4); \ + NRF_GPIO->OUTCLR = (leds_mask) & (LEDS_MASK & LEDS_INV_MASK); \ + NRF_GPIO->OUTSET = (leds_mask) & (LEDS_MASK & ~LEDS_INV_MASK); } while (0) + +#define LED_IS_ON(leds_mask) ((leds_mask) & (NRF_GPIO->OUT ^ LEDS_INV_MASK) ) + +#define LEDS_INVERT(leds_mask) do { uint32_t gpio_state = NRF_GPIO->OUT; \ + ASSERT(sizeof(leds_mask) == 4); \ + NRF_GPIO->OUTSET = ((leds_mask) & ~gpio_state); \ + NRF_GPIO->OUTCLR = ((leds_mask) & gpio_state); } while (0) + +#define LEDS_CONFIGURE(leds_mask) do { uint32_t pin; \ + ASSERT(sizeof(leds_mask) == 4); \ + for (pin = 0; pin < 32; pin++) \ + if ( (leds_mask) & (1 << pin) ) \ + nrf_gpio_cfg_output(pin); } while (0) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/d52_starterkit.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/d52_starterkit.h new file mode 100644 index 0000000000..2925bd9d5d --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/d52_starterkit.h @@ -0,0 +1,98 @@ +/* +This software is subject to the license described in the License.txt file +included with this software distribution. You may not use this file except in compliance +with this license. + +Copyright (c) Dynastream Innovations Inc. 2016 +All rights reserved. +*/ + +#ifndef D52STARTERKIT_H +#define D52STARTERKIT_H + +#include "nrf_gpio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// LEDs definitions for D52DK1 +#define LEDS_NUMBER 4 + +// IO board active low leds +// D52DK1 does not define LED_START or LED_STOP since the LEDS are not on sequential pins +#define LED_A 24 //LED A on D52 Starter Kit IO Board +#define LED_B 31 //LED B on D52 Starter Kit IO Board +#define LED_C 17 //LED C on D52 Starter Kit IO Board +#define LED_D 20 //LED D on D52 Starter Kit IO Board + +#define LEDS_ACTIVE_STATE 0 + +#define LEDS_LIST { LED_A, LED_B, LED_C, LED_D } + +#define BSP_LED_0 LED_A +#define BSP_LED_1 LED_B +#define BSP_LED_2 LED_C +#define BSP_LED_3 LED_D + +#define LEDS_INV_MASK LEDS_MASK + +#define BUTTONS_NUMBER 4 + +// IO board pull-up buttons +#define BUTTON_A 6 //BUTTON A on D52 Starter Kit IO Board +#define BUTTON_B 7 //BUTTON B on D52 Starter Kit IO Board +#define BUTTON_C 16 //BUTTON C on D52 Starter Kit IO Board +#define BUTTON_D 19 //BUTTON D on D52 Starter Kit IO Board +#define BUTTON_PULL NRF_GPIO_PIN_PULLUP + +#define BUTTONS_ACTIVE_STATE 0 + +#define BSP_BUTTON_0 BUTTON_A +#define BSP_BUTTON_1 BUTTON_B +#define BSP_BUTTON_2 BUTTON_C +#define BSP_BUTTON_3 BUTTON_D + +#define BUTTONS_LIST { BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D } + +// Battery board pull-up switches +#define SWITCH_1 12 // Switch 1 on D52 Starter Kit Battery Board +#define SWITCH_2 8 // Switch 2 on D52 Starter Kit Battery Board +#define SWITCH_3 15 // Switch 3 on D52 Starter Kit Battery Board +#define SWITCH_4 11 // Switch 4 on D52 Starter Kit Battery Board +#define SWITCH_5 14 // Switch 5 on D52 Starter Kit Battery Board +#define SWITCH_PULL NRF_GPIO_PIN_PULLUP + +#define SWITCHES_NUMBER 5 + +#define BSP_SWITCH_0 SWITCH_1 +#define BSP_SWITCH_1 SWITCH_2 +#define BSP_SWITCH_2 SWITCH_3 +#define BSP_SWITCH_3 SWITCH_4 +#define BSP_SWITCH_4 SWITCH_5 + +#define BSP_SWITCH_0_MASK (1< +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name The implemented functionality + * @{ + * + * Macros that defines functionality that is implemented into POWER peripheral. + */ +#if defined(POWER_INTENSET_SLEEPENTER_Msk) || defined(__SDK_DOXYGEN__) +/** + * @brief The fact that sleep events are present + * + * In some MCUs there is possibility to process sleep entering and exiting + * events. + */ +#define NRF_POWER_HAS_SLEEPEVT 1 +#else +#define NRF_POWER_HAS_SLEEPEVT 0 +#endif + +#if defined(POWER_RAM_POWER_S0POWER_Msk) || defined(__SDK_DOXYGEN__) +/** + * @brief The fact that RAMPOWER registers are present + * + * After nRF51, new way to manage RAM power was implemented. + * Special registers, one for every RAM block that makes it possible to + * power ON or OFF RAM segments and turn ON and OFF RAM retention in system OFF + * state. + */ +#define NRF_POWER_HAS_RAMPOWER_REGS 1 +#else +#define NRF_POWER_HAS_RAMPOWER_REGS 0 +#endif + +#if defined(POWER_POFCON_THRESHOLDVDDH_Msk) || defined(__SDK_DOXYGEN__) +/** + * @brief Auxiliary definition to mark the fact that VDDH is present + * + * This definition can be used in a code to decide if the part with VDDH + * related settings should be implemented. + */ +#define NRF_POWER_HAS_VDDH 1 +#else +#define NRF_POWER_HAS_VDDH 0 +#endif + +#if defined(POWER_USBREGSTATUS_VBUSDETECT_Msk) || defined(__SDK_DOXYGEN__) +/** + * @brief The fact that power module manages USB regulator + * + * In devices that have USB, power peripheral manages also connection + * detection and USB power regulator, that converts 5 V to 3.3 V + * used by USBD peripheral. + */ +#define NRF_POWER_HAS_USBREG 1 +#else +#define NRF_POWER_HAS_USBREG 0 +#endif +/** @} */ + +/* ------------------------------------------------------------------------------------------------ + * Begin of automatically generated part + * ------------------------------------------------------------------------------------------------ + */ + +/** + * @brief POWER tasks + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_POWER_TASK_CONSTLAT = offsetof(NRF_POWER_Type, TASKS_CONSTLAT), /**< Enable constant latency mode */ + NRF_POWER_TASK_LOWPWR = offsetof(NRF_POWER_Type, TASKS_LOWPWR ), /**< Enable low power mode (variable latency) */ +}nrf_power_task_t; /*lint -restore */ + +/** + * @brief POWER events + */ +typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */ +{ + NRF_POWER_EVENT_POFWARN = offsetof(NRF_POWER_Type, EVENTS_POFWARN ), /**< Power failure warning */ +#if NRF_POWER_HAS_SLEEPEVT + NRF_POWER_EVENT_SLEEPENTER = offsetof(NRF_POWER_Type, EVENTS_SLEEPENTER ), /**< CPU entered WFI/WFE sleep */ + NRF_POWER_EVENT_SLEEPEXIT = offsetof(NRF_POWER_Type, EVENTS_SLEEPEXIT ), /**< CPU exited WFI/WFE sleep */ +#endif +#if NRF_POWER_HAS_USBREG + NRF_POWER_EVENT_USBDETECTED = offsetof(NRF_POWER_Type, EVENTS_USBDETECTED), /**< Voltage supply detected on VBUS */ + NRF_POWER_EVENT_USBREMOVED = offsetof(NRF_POWER_Type, EVENTS_USBREMOVED ), /**< Voltage supply removed from VBUS */ + NRF_POWER_EVENT_USBPWRRDY = offsetof(NRF_POWER_Type, EVENTS_USBPWRRDY ), /**< USB 3.3 V supply ready */ +#endif +}nrf_power_event_t; /*lint -restore */ + +/** + * @brief POWER interrupts + */ +typedef enum +{ + NRF_POWER_INT_POFWARN_MASK = POWER_INTENSET_POFWARN_Msk , /**< Write '1' to Enable interrupt for POFWARN event */ +#if NRF_POWER_HAS_SLEEPEVT + NRF_POWER_INT_SLEEPENTER_MASK = POWER_INTENSET_SLEEPENTER_Msk , /**< Write '1' to Enable interrupt for SLEEPENTER event */ + NRF_POWER_INT_SLEEPEXIT_MASK = POWER_INTENSET_SLEEPEXIT_Msk , /**< Write '1' to Enable interrupt for SLEEPEXIT event */ +#endif +#if NRF_POWER_HAS_USBREG + NRF_POWER_INT_USBDETECTED_MASK = POWER_INTENSET_USBDETECTED_Msk, /**< Write '1' to Enable interrupt for USBDETECTED event */ + NRF_POWER_INT_USBREMOVED_MASK = POWER_INTENSET_USBREMOVED_Msk , /**< Write '1' to Enable interrupt for USBREMOVED event */ + NRF_POWER_INT_USBPWRRDY_MASK = POWER_INTENSET_USBPWRRDY_Msk , /**< Write '1' to Enable interrupt for USBPWRRDY event */ +#endif +}nrf_power_int_mask_t; + +/** + * @brief Function for activating a specific POWER task. + * + * @param task Task. + */ +__STATIC_INLINE void nrf_power_task_trigger(nrf_power_task_t task); + +/** + * @brief Function for returning the address of a specific POWER task register. + * + * @param task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_power_task_address_get(nrf_power_task_t task); + +/** + * @brief Function for clearing a specific event. + * + * @param event Event. + */ +__STATIC_INLINE void nrf_power_event_clear(nrf_power_event_t event); + +/** + * @brief Function for returning the state of a specific event. + * + * @param event Event. + * + * @retval true If the event is set. + * @retval false If the event is not set. + */ +__STATIC_INLINE bool nrf_power_event_check(nrf_power_event_t event); + +/** + * @brief Function for getting and clearing the state of specific event + * + * This function checks the state of the event and clears it. + * + * @param event Event. + * + * @retval true If the event was set. + * @retval false If the event was not set. + */ +__STATIC_INLINE bool nrf_power_event_get_and_clear(nrf_power_event_t event); + +/** + * @brief Function for returning the address of a specific POWER event register. + * + * @param event Event. + * + * @return Address. + */ +__STATIC_INLINE uint32_t nrf_power_event_address_get(nrf_power_event_t event); + +/** + * @brief Function for enabling selected interrupts. + * + * @param int_mask Interrupts mask. + */ +__STATIC_INLINE void nrf_power_int_enable(uint32_t int_mask); + +/** + * @brief Function for retrieving the state of selected interrupts. + * + * @param int_mask Interrupts mask. + * + * @retval true If any of selected interrupts is enabled. + * @retval false If none of selected interrupts is enabled. + */ +__STATIC_INLINE bool nrf_power_int_enable_check(uint32_t int_mask); + +/** + * @brief Function for retrieving the information about enabled interrupts. + * + * @return The flags of enabled interrupts. + */ +__STATIC_INLINE uint32_t nrf_power_int_enable_get(void); + +/** + * @brief Function for disabling selected interrupts. + * + * @param int_mask Interrupts mask. + */ +__STATIC_INLINE void nrf_power_int_disable(uint32_t int_mask); + + +/** @} */ /* End of nrf_power_hal */ + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +/* ------------------------------------------------------------------------------------------------ + * Internal functions + */ + +/** + * @internal + * @brief Internal function for getting task/event register address + * + * @oaram offset Offset of the register from the instance beginning + * + * @attention offset has to be modulo 4 value. In other case we can get hardware fault. + * @return Pointer to the register + */ +__STATIC_INLINE volatile uint32_t * nrf_power_regptr_get(uint32_t offset) +{ + return (volatile uint32_t *)(((uint8_t *)NRF_POWER) + (uint32_t)offset); +} + +/** + * @internal + * @brief Internal function for getting task/event register address - constant version + * + * @oaram offset Offset of the register from the instance beginning + * + * @attention offset has to be modulo 4 value. In other case we can get hardware fault. + * @return Pointer to the register + */ +__STATIC_INLINE volatile const uint32_t * nrf_power_regptr_get_c( + uint32_t offset) +{ + return (volatile const uint32_t *)(((uint8_t *)NRF_POWER) + + (uint32_t)offset); +} + +/* ------------------------------------------------------------------------------------------------ + * Interface functions definitions + */ + +void nrf_power_task_trigger(nrf_power_task_t task) +{ + *(nrf_power_regptr_get((uint32_t)task)) = 1UL; +} + +uint32_t nrf_power_task_address_get(nrf_power_task_t task) +{ + return (uint32_t)nrf_power_regptr_get_c((uint32_t)task); +} + +void nrf_power_event_clear(nrf_power_event_t event) +{ + *(nrf_power_regptr_get((uint32_t)event)) = 0UL; +} + +bool nrf_power_event_check(nrf_power_event_t event) +{ + return (bool)*nrf_power_regptr_get_c((uint32_t)event); +} + +bool nrf_power_event_get_and_clear(nrf_power_event_t event) +{ + bool ret = nrf_power_event_check(event); + if(ret) + { + nrf_power_event_clear(event); + } + return ret; +} + +uint32_t nrf_power_event_address_get(nrf_power_event_t event) +{ + return (uint32_t)nrf_power_regptr_get_c((uint32_t)event); +} + +void nrf_power_int_enable(uint32_t int_mask) +{ + NRF_POWER->INTENSET = int_mask; +} + +bool nrf_power_int_enable_check(uint32_t int_mask) +{ + return !!(NRF_POWER->INTENSET & int_mask); +} + +uint32_t nrf_power_int_enable_get(void) +{ + return NRF_POWER->INTENSET; +} + +void nrf_power_int_disable(uint32_t int_mask) +{ + NRF_POWER->INTENCLR = int_mask; +} + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + +/* ------------------------------------------------------------------------------------------------ + * End of automatically generated part + * ------------------------------------------------------------------------------------------------ + */ +/** + * @ingroup nrf_power_hal + * @{ + */ + +/** + * @brief Reset reason + */ +typedef enum +{ + NRF_POWER_RESETREAS_RESETPIN_MASK = POWER_RESETREAS_RESETPIN_Msk, /*!< Bit mask of RESETPIN field. *///!< NRF_POWER_RESETREAS_RESETPIN_MASK + NRF_POWER_RESETREAS_DOG_MASK = POWER_RESETREAS_DOG_Msk , /*!< Bit mask of DOG field. */ //!< NRF_POWER_RESETREAS_DOG_MASK + NRF_POWER_RESETREAS_SREQ_MASK = POWER_RESETREAS_SREQ_Msk , /*!< Bit mask of SREQ field. */ //!< NRF_POWER_RESETREAS_SREQ_MASK + NRF_POWER_RESETREAS_LOCKUP_MASK = POWER_RESETREAS_LOCKUP_Msk , /*!< Bit mask of LOCKUP field. */ //!< NRF_POWER_RESETREAS_LOCKUP_MASK + NRF_POWER_RESETREAS_OFF_MASK = POWER_RESETREAS_OFF_Msk , /*!< Bit mask of OFF field. */ //!< NRF_POWER_RESETREAS_OFF_MASK + NRF_POWER_RESETREAS_LPCOMP_MASK = POWER_RESETREAS_LPCOMP_Msk , /*!< Bit mask of LPCOMP field. */ //!< NRF_POWER_RESETREAS_LPCOMP_MASK + NRF_POWER_RESETREAS_DIF_MASK = POWER_RESETREAS_DIF_Msk , /*!< Bit mask of DIF field. */ //!< NRF_POWER_RESETREAS_DIF_MASK +#if defined(POWER_RESETREAS_NFC_Msk) || defined(__SDK_DOXYGEN__) + NRF_POWER_RESETREAS_NFC_MASK = POWER_RESETREAS_NFC_Msk , /*!< Bit mask of NFC field. */ +#endif +#if defined(POWER_RESETREAS_VBUS_Msk) || defined(__SDK_DOXYGEN__) + NRF_POWER_RESETREAS_VBUS_MASK = POWER_RESETREAS_VBUS_Msk , /*!< Bit mask of VBUS field. */ +#endif +}nrf_power_resetreas_mask_t; + +#if NRF_POWER_HAS_USBREG +/** + * @brief USBREGSTATUS register bit masks + * + * @sa nrf_power_usbregstatus_get + */ +typedef enum +{ + NRF_POWER_USBREGSTATUS_VBUSDETECT_MASK = POWER_USBREGSTATUS_VBUSDETECT_Msk, /**< USB detected or removed */ + NRF_POWER_USBREGSTATUS_OUTPUTRDY_MASK = POWER_USBREGSTATUS_OUTPUTRDY_Msk /**< USB 3.3 V supply ready */ +}nrf_power_usbregstatus_mask_t; +#endif + +/** + * @brief RAM blocks numbers + * + * @sa nrf_power_ramblock_mask_t + * @note + * Ram blocks has to been used in nrf51. + * In new CPU ram is divided into segments and this functionality is depreciated. + * For the newer MCU see the PS for mapping between internal RAM and RAM blocks, + * because this mapping is not 1:1, and functions related to old style blocks + * should not be used. + */ +typedef enum +{ + NRF_POWER_RAMBLOCK0 = POWER_RAMSTATUS_RAMBLOCK0_Pos, + NRF_POWER_RAMBLOCK1 = POWER_RAMSTATUS_RAMBLOCK1_Pos, + NRF_POWER_RAMBLOCK2 = POWER_RAMSTATUS_RAMBLOCK2_Pos, + NRF_POWER_RAMBLOCK3 = POWER_RAMSTATUS_RAMBLOCK3_Pos +}nrf_power_ramblock_t; + +/** + * @brief RAM blocks masks + * + * @sa nrf_power_ramblock_t + */ +typedef enum +{ + NRF_POWER_RAMBLOCK0_MASK = POWER_RAMSTATUS_RAMBLOCK0_Msk, + NRF_POWER_RAMBLOCK1_MASK = POWER_RAMSTATUS_RAMBLOCK1_Msk, + NRF_POWER_RAMBLOCK2_MASK = POWER_RAMSTATUS_RAMBLOCK2_Msk, + NRF_POWER_RAMBLOCK3_MASK = POWER_RAMSTATUS_RAMBLOCK3_Msk +}nrf_power_ramblock_mask_t; + +/** + * @brief RAM power state position of the bits + * + * @sa nrf_power_onoffram_mask_t + */ +typedef enum +{ + NRF_POWER_ONRAM0, /**< Keep RAM block 0 on or off in system ON Mode */ + NRF_POWER_OFFRAM0, /**< Keep retention on RAM block 0 when RAM block is switched off */ + NRF_POWER_ONRAM1, /**< Keep RAM block 1 on or off in system ON Mode */ + NRF_POWER_OFFRAM1, /**< Keep retention on RAM block 1 when RAM block is switched off */ + NRF_POWER_ONRAM2, /**< Keep RAM block 2 on or off in system ON Mode */ + NRF_POWER_OFFRAM2, /**< Keep retention on RAM block 2 when RAM block is switched off */ + NRF_POWER_ONRAM3, /**< Keep RAM block 3 on or off in system ON Mode */ + NRF_POWER_OFFRAM3, /**< Keep retention on RAM block 3 when RAM block is switched off */ +}nrf_power_onoffram_t; + +/** + * @brief RAM power state bit masks + * + * @sa nrf_power_onoffram_t + */ +typedef enum +{ + NRF_POWER_ONRAM0_MASK = 1U << NRF_POWER_ONRAM0, /**< Keep RAM block 0 on or off in system ON Mode */ + NRF_POWER_OFFRAM0_MASK = 1U << NRF_POWER_OFFRAM0, /**< Keep retention on RAM block 0 when RAM block is switched off */ + NRF_POWER_ONRAM1_MASK = 1U << NRF_POWER_ONRAM1, /**< Keep RAM block 1 on or off in system ON Mode */ + NRF_POWER_OFFRAM1_MASK = 1U << NRF_POWER_OFFRAM1, /**< Keep retention on RAM block 1 when RAM block is switched off */ + NRF_POWER_ONRAM2_MASK = 1U << NRF_POWER_ONRAM2, /**< Keep RAM block 2 on or off in system ON Mode */ + NRF_POWER_OFFRAM2_MASK = 1U << NRF_POWER_OFFRAM2, /**< Keep retention on RAM block 2 when RAM block is switched off */ + NRF_POWER_ONRAM3_MASK = 1U << NRF_POWER_ONRAM3, /**< Keep RAM block 3 on or off in system ON Mode */ + NRF_POWER_OFFRAM3_MASK = 1U << NRF_POWER_OFFRAM3, /**< Keep retention on RAM block 3 when RAM block is switched off */ +}nrf_power_onoffram_mask_t; + +/** + * @brief Power failure comparator thresholds + */ +typedef enum +{ + NRF_POWER_POFTHR_V21 = POWER_POFCON_THRESHOLD_V21, /**< Set threshold to 2.1 V */ + NRF_POWER_POFTHR_V23 = POWER_POFCON_THRESHOLD_V23, /**< Set threshold to 2.3 V */ + NRF_POWER_POFTHR_V25 = POWER_POFCON_THRESHOLD_V25, /**< Set threshold to 2.5 V */ + NRF_POWER_POFTHR_V27 = POWER_POFCON_THRESHOLD_V27, /**< Set threshold to 2.7 V */ +#if defined(POWER_POFCON_THRESHOLD_V17) || defined(__SDK_DOXYGEN__) + NRF_POWER_POFTHR_V17 = POWER_POFCON_THRESHOLD_V17, /**< Set threshold to 1.7 V */ + NRF_POWER_POFTHR_V18 = POWER_POFCON_THRESHOLD_V18, /**< Set threshold to 1.8 V */ + NRF_POWER_POFTHR_V19 = POWER_POFCON_THRESHOLD_V19, /**< Set threshold to 1.9 V */ + NRF_POWER_POFTHR_V20 = POWER_POFCON_THRESHOLD_V20, /**< Set threshold to 2.0 V */ + NRF_POWER_POFTHR_V22 = POWER_POFCON_THRESHOLD_V22, /**< Set threshold to 2.2 V */ + NRF_POWER_POFTHR_V24 = POWER_POFCON_THRESHOLD_V24, /**< Set threshold to 2.4 V */ + NRF_POWER_POFTHR_V26 = POWER_POFCON_THRESHOLD_V26, /**< Set threshold to 2.6 V */ + NRF_POWER_POFTHR_V28 = POWER_POFCON_THRESHOLD_V28, /**< Set threshold to 2.8 V */ +#endif +}nrf_power_pof_thr_t; + +#if NRF_POWER_HAS_VDDH +/** + * @brief Power failure comparator thresholds for VDDH + */ +typedef enum +{ + NRF_POWER_POFTHRVDDH_V27 = POWER_POFCON_THRESHOLDVDDH_V27, /**< Set threshold to 2.7 V */ + NRF_POWER_POFTHRVDDH_V28 = POWER_POFCON_THRESHOLDVDDH_V28, /**< Set threshold to 2.8 V */ + NRF_POWER_POFTHRVDDH_V29 = POWER_POFCON_THRESHOLDVDDH_V29, /**< Set threshold to 2.9 V */ + NRF_POWER_POFTHRVDDH_V30 = POWER_POFCON_THRESHOLDVDDH_V30, /**< Set threshold to 3.0 V */ + NRF_POWER_POFTHRVDDH_V31 = POWER_POFCON_THRESHOLDVDDH_V31, /**< Set threshold to 3.1 V */ + NRF_POWER_POFTHRVDDH_V32 = POWER_POFCON_THRESHOLDVDDH_V32, /**< Set threshold to 3.2 V */ + NRF_POWER_POFTHRVDDH_V33 = POWER_POFCON_THRESHOLDVDDH_V33, /**< Set threshold to 3.3 V */ + NRF_POWER_POFTHRVDDH_V34 = POWER_POFCON_THRESHOLDVDDH_V34, /**< Set threshold to 3.4 V */ + NRF_POWER_POFTHRVDDH_V35 = POWER_POFCON_THRESHOLDVDDH_V35, /**< Set threshold to 3.5 V */ + NRF_POWER_POFTHRVDDH_V36 = POWER_POFCON_THRESHOLDVDDH_V36, /**< Set threshold to 3.6 V */ + NRF_POWER_POFTHRVDDH_V37 = POWER_POFCON_THRESHOLDVDDH_V37, /**< Set threshold to 3.7 V */ + NRF_POWER_POFTHRVDDH_V38 = POWER_POFCON_THRESHOLDVDDH_V38, /**< Set threshold to 3.8 V */ + NRF_POWER_POFTHRVDDH_V39 = POWER_POFCON_THRESHOLDVDDH_V39, /**< Set threshold to 3.9 V */ + NRF_POWER_POFTHRVDDH_V40 = POWER_POFCON_THRESHOLDVDDH_V40, /**< Set threshold to 4.0 V */ + NRF_POWER_POFTHRVDDH_V41 = POWER_POFCON_THRESHOLDVDDH_V41, /**< Set threshold to 4.1 V */ + NRF_POWER_POFTHRVDDH_V42 = POWER_POFCON_THRESHOLDVDDH_V42, /**< Set threshold to 4.2 V */ +}nrf_power_pof_thrvddh_t; + +/** + * @brief Main regulator status + */ +typedef enum +{ + NRF_POWER_MAINREGSTATUS_NORMAL = POWER_MAINREGSTATUS_MAINREGSTATUS_Normal, /**< Normal voltage mode. Voltage supplied on VDD. */ + NRF_POWER_MAINREGSTATUS_HIGH = POWER_MAINREGSTATUS_MAINREGSTATUS_High /**< High voltage mode. Voltage supplied on VDDH. */ +}nrf_power_mainregstatus_t; + +#endif /* NRF_POWER_HAS_VDDH */ + +#if NRF_POWER_HAS_RAMPOWER_REGS +/** + * @brief Bit positions for RAMPOWER register + * + * All possible bits described, even if they are not used in selected MCU. + */ +typedef enum +{ + /** Keep RAM section S0 ON in System ON mode */ + NRF_POWER_RAMPOWER_S0POWER = POWER_RAM_POWER_S0POWER_Pos, + NRF_POWER_RAMPOWER_S1POWER, /**< Keep RAM section S1 ON in System ON mode */ + NRF_POWER_RAMPOWER_S2POWER, /**< Keep RAM section S2 ON in System ON mode */ + NRF_POWER_RAMPOWER_S3POWER, /**< Keep RAM section S3 ON in System ON mode */ + NRF_POWER_RAMPOWER_S4POWER, /**< Keep RAM section S4 ON in System ON mode */ + NRF_POWER_RAMPOWER_S5POWER, /**< Keep RAM section S5 ON in System ON mode */ + NRF_POWER_RAMPOWER_S6POWER, /**< Keep RAM section S6 ON in System ON mode */ + NRF_POWER_RAMPOWER_S7POWER, /**< Keep RAM section S7 ON in System ON mode */ + NRF_POWER_RAMPOWER_S8POWER, /**< Keep RAM section S8 ON in System ON mode */ + NRF_POWER_RAMPOWER_S9POWER, /**< Keep RAM section S9 ON in System ON mode */ + NRF_POWER_RAMPOWER_S10POWER, /**< Keep RAM section S10 ON in System ON mode */ + NRF_POWER_RAMPOWER_S11POWER, /**< Keep RAM section S11 ON in System ON mode */ + NRF_POWER_RAMPOWER_S12POWER, /**< Keep RAM section S12 ON in System ON mode */ + NRF_POWER_RAMPOWER_S13POWER, /**< Keep RAM section S13 ON in System ON mode */ + NRF_POWER_RAMPOWER_S14POWER, /**< Keep RAM section S14 ON in System ON mode */ + NRF_POWER_RAMPOWER_S15POWER, /**< Keep RAM section S15 ON in System ON mode */ + + /** Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S0RETENTION = POWER_RAM_POWER_S0RETENTION_Pos, + NRF_POWER_RAMPOWER_S1RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S2RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S3RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S4RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S5RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S6RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S7RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S8RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S9RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S10RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S11RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S12RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S13RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S14RETENTION, /**< Keep section retention in OFF mode when section is OFF */ + NRF_POWER_RAMPOWER_S15RETENTION, /**< Keep section retention in OFF mode when section is OFF */ +}nrf_power_rampower_t; + +#if defined ( __CC_ARM ) +#pragma push +#pragma diag_suppress 66 +#endif +/** + * @brief Bit masks for RAMPOWER register + * + * All possible bits described, even if they are not used in selected MCU. + */ +typedef enum +{ + NRF_POWER_RAMPOWER_S0POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S0POWER , + NRF_POWER_RAMPOWER_S1POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S1POWER , + NRF_POWER_RAMPOWER_S2POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S2POWER , + NRF_POWER_RAMPOWER_S3POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S3POWER , + NRF_POWER_RAMPOWER_S4POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S4POWER , + NRF_POWER_RAMPOWER_S5POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S5POWER , + NRF_POWER_RAMPOWER_S7POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S7POWER , + NRF_POWER_RAMPOWER_S8POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S8POWER , + NRF_POWER_RAMPOWER_S9POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S9POWER , + NRF_POWER_RAMPOWER_S10POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S10POWER, + NRF_POWER_RAMPOWER_S11POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S11POWER, + NRF_POWER_RAMPOWER_S12POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S12POWER, + NRF_POWER_RAMPOWER_S13POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S13POWER, + NRF_POWER_RAMPOWER_S14POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S14POWER, + NRF_POWER_RAMPOWER_S15POWER_MASK = 1UL << NRF_POWER_RAMPOWER_S15POWER, + + NRF_POWER_RAMPOWER_S0RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S0RETENTION , + NRF_POWER_RAMPOWER_S1RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S1RETENTION , + NRF_POWER_RAMPOWER_S2RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S2RETENTION , + NRF_POWER_RAMPOWER_S3RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S3RETENTION , + NRF_POWER_RAMPOWER_S4RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S4RETENTION , + NRF_POWER_RAMPOWER_S5RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S5RETENTION , + NRF_POWER_RAMPOWER_S7RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S7RETENTION , + NRF_POWER_RAMPOWER_S8RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S8RETENTION , + NRF_POWER_RAMPOWER_S9RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S9RETENTION , + NRF_POWER_RAMPOWER_S10RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S10RETENTION, + NRF_POWER_RAMPOWER_S11RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S11RETENTION, + NRF_POWER_RAMPOWER_S12RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S12RETENTION, + NRF_POWER_RAMPOWER_S13RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S13RETENTION, + NRF_POWER_RAMPOWER_S14RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S14RETENTION, + NRF_POWER_RAMPOWER_S15RETENTION_MASK = 1UL << NRF_POWER_RAMPOWER_S15RETENTION, +}nrf_power_rampower_mask_t; +#if defined ( __CC_ARM ) +#pragma pop +#endif +#endif /* NRF_POWER_HAS_RAMPOWER_REGS */ + + +/** + * @brief Get reset reason mask + * + * Function returns the reset reason. + * Unless cleared, the RESETREAS register is cumulative. + * A field is cleared by writing '1' to it (see @ref nrf_power_resetreas_clear). + * If none of the reset sources are flagged, + * this indicates that the chip was reset from the on-chip reset generator, + * which indicates a power-on-reset or a brown out reset. + * + * @return The mask of reset reasons constructed with @ref nrf_power_resetreas_mask_t. + */ +__STATIC_INLINE uint32_t nrf_power_resetreas_get(void); + +/** + * @brief Clear selected reset reason field + * + * Function clears selected reset reason fields. + * + * @param[in] mask The mask constructed from @ref nrf_power_resetreas_mask_t enumerator values. + * @sa nrf_power_resetreas_get + */ +__STATIC_INLINE void nrf_power_resetreas_clear(uint32_t mask); + +/** + * @brief Get RAMSTATUS register + * + * Returns the masks of RAM blocks that are powered ON. + * + * @return Value with bits sets according to masks in @ref nrf_power_ramblock_mask_t. + */ +__STATIC_INLINE uint32_t nrf_power_ramstatus_get(void); + +/** + * @brief Go to system OFF + * + * This function puts the CPU into system off mode. + * The only way to wake up the CPU is by reset. + * + * @note This function never returns. + */ +__STATIC_INLINE void nrf_power_system_off(void); + +/** + * @brief Set power failure comparator configuration + * + * Sets power failure comparator threshold and enable/disable flag. + * + * @param enabled Set to true if power failure comparator should be enabled. + * @param thr Set the voltage threshold value. + * + * @note + * If VDDH settings is present in the device, this function would + * clear it settings (set to the lowest voltage). + * Use @ref nrf_power_pofcon_vddh_set function to set new value. + */ +__STATIC_INLINE void nrf_power_pofcon_set(bool enabled, nrf_power_pof_thr_t thr); + +/** + * @brief Get power failure comparator configuration + * + * Get power failure comparator threshold and enable bit. + * + * @param[out] p_enabled Function would set this boolean variable to true + * if power failure comparator is enabled. + * The pointer can be NULL if we do not need this information. + * @return Threshold setting for power failure comparator + */ +__STATIC_INLINE nrf_power_pof_thr_t nrf_power_pofcon_get(bool * p_enabled); + +#if NRF_POWER_HAS_VDDH +/** + * @brief Set VDDH power failure comparator threshold + * + * @param thr Threshold to be set + */ +__STATIC_INLINE void nrf_power_pofcon_vddh_set(nrf_power_pof_thrvddh_t thr); + +/** + * @brief Get VDDH power failure comparator threshold + * + * @return VDDH threshold currently configured + */ +__STATIC_INLINE nrf_power_pof_thrvddh_t nrf_power_pofcon_vddh_get(void); +#endif + +/** + * @brief Set general purpose retention register + * + * @param val Value to be set in the register + */ +__STATIC_INLINE void nrf_power_gpregret_set(uint8_t val); + +/** + * @brief Get general purpose retention register + * + * @return The value from the register + */ +__STATIC_INLINE uint8_t nrf_power_gpregret_get(void); + +#if defined(POWER_GPREGRET2_GPREGRET_Msk) || defined(__SDK_DOXYGEN__) +/** + * @brief Set general purpose retention register 2 + * + * @param val Value to be set in the register + * @note This register is not available in nrf51 MCU family + */ +__STATIC_INLINE void nrf_power_gpregret2_set(uint8_t val); + +/** + * @brief Get general purpose retention register 2 + * + * @return The value from the register + * @note This register is not available in all MCUs. + */ +__STATIC_INLINE uint8_t nrf_power_gpregret2_get(void); +#endif + +/** + * @brief Enable or disable DCDC converter + * + * @param enable Set true to enable or false to disable DCDC converter. + * + * @note + * If the device consist of high voltage power input (VDDH) this setting + * would relate to the converter on low voltage side (1.3 V output). + */ +__STATIC_INLINE void nrf_power_dcdcen_set(bool enable); + +/** + * @brief Get the state of DCDC converter + * + * @retval true Converter is enabled + * @retval false Converter is disabled + * + * @note + * If the device consist of high voltage power input (VDDH) this setting + * would relate to the converter on low voltage side (1.3 V output). + */ +__STATIC_INLINE bool nrf_power_dcdcen_get(void); + +#if NRF_POWER_HAS_RAMPOWER_REGS +/** + * @brief Turn ON sections in selected RAM block. + * + * This function turns ON sections in block and also block retention. + * + * @sa nrf_power_rampower_mask_t + * @sa nrf_power_rampower_mask_off + * + * @param block RAM block index. + * @param section_mask Mask of the sections created by merging + * @ref nrf_power_rampower_mask_t flags. + */ +__STATIC_INLINE void nrf_power_rampower_mask_on(uint8_t block, uint32_t section_mask); + +/** + * @brief Turn ON sections in selected RAM block. + * + * This function turns OFF sections in block and also block retention. + * + * @sa nrf_power_rampower_mask_t + * @sa nrf_power_rampower_mask_off + * + * @param block RAM block index. + * @param section_mask Mask of the sections created by merging + * @ref nrf_power_rampower_mask_t flags. + */ +__STATIC_INLINE void nrf_power_rampower_mask_off(uint8_t block, uint32_t section_mask); + +/** + * @brief Get the mask of ON and retention sections in selected RAM block. + * + * @param block RAM block index. + * @return Mask of sections state composed from @ref nrf_power_rampower_mask_t flags. + */ +__STATIC_INLINE uint32_t nrf_power_rampower_mask_get(uint8_t block); +#endif /* NRF_POWER_HAS_RAMPOWER_REGS */ + +#if NRF_POWER_HAS_VDDH +/** + * @brief Enable of disable DCDC converter on VDDH + * + * @param enable Set true to enable or false to disable DCDC converter. + */ +__STATIC_INLINE void nrf_power_dcdcen_vddh_set(bool enable); + +/** + * @brief Get the state of DCDC converter on VDDH + * + * @retval true Converter is enabled + * @retval false Converter is disabled + */ +__STATIC_INLINE bool nrf_power_dcdcen_vddh_get(void); + +/** + * @brief Get main supply status + * + * @return Current main supply status + */ +__STATIC_INLINE nrf_power_mainregstatus_t nrf_power_mainregstatus_get(void); +#endif /* NRF_POWER_HAS_VDDH */ + +#if NRF_POWER_HAS_USBREG +/** + * + * @return Get the whole USBREGSTATUS register + * + * @return The USBREGSTATUS register value. + * Use @ref nrf_power_usbregstatus_mask_t values for bit masking. + * + * @sa nrf_power_usbregstatus_vbusdet_get + * @sa nrf_power_usbregstatus_outrdy_get + */ +__STATIC_INLINE uint32_t nrf_power_usbregstatus_get(void); + +/** + * @brief VBUS input detection status + * + * USBDETECTED and USBREMOVED events are derived from this information + * + * @retval false VBUS voltage below valid threshold + * @retval true VBUS voltage above valid threshold + * + * @sa nrf_power_usbregstatus_get + */ +__STATIC_INLINE bool nrf_power_usbregstatus_vbusdet_get(void); + +/** + * @brief USB supply output settling time elapsed + * + * @retval false USBREG output settling time not elapsed + * @retval true USBREG output settling time elapsed + * (same information as USBPWRRDY event) + * + * @sa nrf_power_usbregstatus_get + */ +__STATIC_INLINE bool nrf_power_usbregstatus_outrdy_get(void); +#endif /* NRF_POWER_HAS_USBREG */ + +/** @} */ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE uint32_t nrf_power_resetreas_get(void) +{ + return NRF_POWER->RESETREAS; +} + +__STATIC_INLINE void nrf_power_resetreas_clear(uint32_t mask) +{ + NRF_POWER->RESETREAS = mask; +} + +__STATIC_INLINE uint32_t nrf_power_ramstatus_get(void) +{ + return NRF_POWER->RAMSTATUS; +} + +__STATIC_INLINE void nrf_power_system_off(void) +{ + NRF_POWER->SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter; + /* Solution for simulated System OFF in debug mode. + * Also, because dead loop is placed here, we do not need to implement + * any barriers here. */ + while(true) + { + /* Intentionally empty - we would be here only in debug mode */ + } +} + +__STATIC_INLINE void nrf_power_pofcon_set(bool enabled, nrf_power_pof_thr_t thr) +{ + ASSERT(thr == (thr & (POWER_POFCON_THRESHOLD_Msk >> POWER_POFCON_THRESHOLD_Pos))); + NRF_POWER->POFCON = (((uint32_t)thr) << POWER_POFCON_THRESHOLD_Pos) | + (enabled ? + (POWER_POFCON_POF_Enabled << POWER_POFCON_POF_Pos) + : + (POWER_POFCON_POF_Disabled << POWER_POFCON_POF_Pos)); +} + +__STATIC_INLINE nrf_power_pof_thr_t nrf_power_pofcon_get(bool * p_enabled) +{ + uint32_t pofcon = NRF_POWER->POFCON; + if(NULL != p_enabled) + { + (*p_enabled) = ((pofcon & POWER_POFCON_POF_Msk) >> POWER_POFCON_POF_Pos) + == POWER_POFCON_POF_Enabled; + } + return (nrf_power_pof_thr_t)((pofcon & POWER_POFCON_THRESHOLD_Msk) >> + POWER_POFCON_THRESHOLD_Pos); +} + +#if NRF_POWER_HAS_VDDH +__STATIC_INLINE void nrf_power_pofcon_vddh_set(nrf_power_pof_thrvddh_t thr) +{ + ASSERT(thr == (thr & (POWER_POFCON_THRESHOLDVDDH_Msk >> POWER_POFCON_THRESHOLDVDDH_Pos))); + uint32_t pofcon = NRF_POWER->POFCON; + pofcon &= ~POWER_POFCON_THRESHOLDVDDH_Msk; + pofcon |= (((uint32_t)thr) << POWER_POFCON_THRESHOLDVDDH_Pos); + NRF_POWER->POFCON = pofcon; +} + +__STATIC_INLINE nrf_power_pof_thrvddh_t nrf_power_pofcon_vddh_get(void) +{ + return (nrf_power_pof_thrvddh_t)((NRF_POWER->POFCON & + POWER_POFCON_THRESHOLDVDDH_Msk) >> POWER_POFCON_THRESHOLDVDDH_Pos); +} +#endif /* NRF_POWER_HAS_VDDH */ + +__STATIC_INLINE void nrf_power_gpregret_set(uint8_t val) +{ + NRF_POWER->GPREGRET = val; +} + +__STATIC_INLINE uint8_t nrf_power_gpregret_get(void) +{ + return NRF_POWER->GPREGRET; +} + +#if defined(POWER_GPREGRET2_GPREGRET_Msk) || defined(__SDK_DOXYGEN__) +void nrf_power_gpregret2_set(uint8_t val) +{ + NRF_POWER->GPREGRET2 = val; +} + +__STATIC_INLINE uint8_t nrf_power_gpregret2_get(void) +{ + return NRF_POWER->GPREGRET2; +} +#endif + +__STATIC_INLINE void nrf_power_dcdcen_set(bool enable) +{ +#if NRF_POWER_HAS_VDDH + NRF_POWER->DCDCEN = (enable ? + POWER_DCDCEN_DCDCEN_Enabled : POWER_DCDCEN_DCDCEN_Disabled) << + POWER_DCDCEN_DCDCEN_Pos; +#else + NRF_POWER->DCDCEN = (enable ? + POWER_DCDCEN_DCDCEN_Enabled : POWER_DCDCEN_DCDCEN_Disabled) << + POWER_DCDCEN_DCDCEN_Pos; +#endif +} + +__STATIC_INLINE bool nrf_power_dcdcen_get(void) +{ +#if NRF_POWER_HAS_VDDH + return (NRF_POWER->DCDCEN & POWER_DCDCEN_DCDCEN_Msk) + == + (POWER_DCDCEN_DCDCEN_Enabled << POWER_DCDCEN_DCDCEN_Pos); +#else + return (NRF_POWER->DCDCEN & POWER_DCDCEN_DCDCEN_Msk) + == + (POWER_DCDCEN_DCDCEN_Enabled << POWER_DCDCEN_DCDCEN_Pos); +#endif +} + +#if NRF_POWER_HAS_RAMPOWER_REGS +__STATIC_INLINE void nrf_power_rampower_mask_on(uint8_t block, uint32_t section_mask) +{ + ASSERT(block < ARRAY_SIZE(NRF_POWER->RAM)); + NRF_POWER->RAM[block].POWERSET = section_mask; +} + +__STATIC_INLINE void nrf_power_rampower_mask_off(uint8_t block, uint32_t section_mask) +{ + ASSERT(block < ARRAY_SIZE(NRF_POWER->RAM)); + NRF_POWER->RAM[block].POWERCLR = section_mask; +} + +__STATIC_INLINE uint32_t nrf_power_rampower_mask_get(uint8_t block) +{ + ASSERT(block < ARRAY_SIZE(NRF_POWER->RAM)); + return NRF_POWER->RAM[block].POWER; +} +#endif /* NRF_POWER_HAS_RAMPOWER_REGS */ + +#if NRF_POWER_HAS_VDDH +__STATIC_INLINE void nrf_power_dcdcen_vddh_set(bool enable) +{ + NRF_POWER->DCDCEN0 = (enable ? + POWER_DCDCEN0_DCDCEN_Enabled : POWER_DCDCEN0_DCDCEN_Disabled) << + POWER_DCDCEN0_DCDCEN_Pos; +} + +bool nrf_power_dcdcen_vddh_get(void) +{ + return (NRF_POWER->DCDCEN0 & POWER_DCDCEN0_DCDCEN_Msk) + == + (POWER_DCDCEN0_DCDCEN_Enabled << POWER_DCDCEN0_DCDCEN_Pos); +} + +nrf_power_mainregstatus_t nrf_power_mainregstatus_get(void) +{ + return (nrf_power_mainregstatus_t)(((NRF_POWER->MAINREGSTATUS) & + POWER_MAINREGSTATUS_MAINREGSTATUS_Msk) >> + POWER_MAINREGSTATUS_MAINREGSTATUS_Pos); +} +#endif /* NRF_POWER_HAS_VDDH */ + +#if NRF_POWER_HAS_USBREG +__STATIC_INLINE uint32_t nrf_power_usbregstatus_get(void) +{ + return NRF_POWER->USBREGSTATUS; +} + +__STATIC_INLINE bool nrf_power_usbregstatus_vbusdet_get(void) +{ + return (nrf_power_usbregstatus_get() & + NRF_POWER_USBREGSTATUS_VBUSDETECT_MASK) != 0; +} + +__STATIC_INLINE bool nrf_power_usbregstatus_outrdy_get(void) +{ + return (nrf_power_usbregstatus_get() & + NRF_POWER_USBREGSTATUS_OUTPUTRDY_MASK) != 0; +} +#endif /* NRF_POWER_HAS_USBREG */ + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_POWER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.c new file mode 100644 index 0000000000..1cf4b15759 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.c @@ -0,0 +1,244 @@ +/* Copyright (c) Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ +#include "sdk_config.h" +#if POWER_ENABLED + +#include "nrf_drv_power.h" +#include "nrf_assert.h" +#include "nordic_common.h" + +/* Validate configuration */ +INTERRUPT_PRIORITY_VALIDATION(POWER_CONFIG_IRQ_PRIORITY); + +/** + * @internal + * @defgroup nrf_drv_power_internals POWER driver internals + * @ingroup nrf_drv_power + * + * Internal variables, auxiliary macros and functions of POWER driver. + * @{ + */ + +/** + * @brief Default configuration + * + * The structure with default configuration data. + * This structure would be used if configuration pointer given + * to the @ref nrf_drv_power_init is set to NULL. + */ +static const nrf_drv_power_config_t m_drv_power_config_default = +{ + .dcdcen = POWER_CONFIG_DEFAULT_DCDCEN, +#if NRF_POWER_HAS_VDDH + .dcdcenhv = POWER_CONFIG_DEFAULT_DCDCENHV, +#endif +}; + +/** + * @brief The initialization flag + */ +static bool m_initialized; + +/** + * @brief The handler of power fail comparator warning event + */ +static nrf_drv_power_pofwarn_event_handler_t m_pofwarn_handler; + +#if NRF_POWER_HAS_SLEEPEVT +/** + * @brief The handler of sleep event handler + */ +static nrf_drv_power_sleep_event_handler_t m_sleepevt_handler; +#endif + +#if NRF_POWER_HAS_USBREG +/** + * @brief The handler of USB power events + */ +static nrf_drv_power_usb_event_handler_t m_usbevt_handler; +#endif + +/** @} */ + +bool nrf_drv_power_init_check(void) +{ + return m_initialized; +} + +ret_code_t nrf_drv_power_init(nrf_drv_power_config_t const * p_config) +{ + nrf_drv_power_config_t const * p_used_config; + if(m_initialized) + { + return NRF_ERROR_MODULE_ALREADY_INITIALIZED; + } + + p_used_config = (p_config != NULL) ? + p_config : (&m_drv_power_config_default); + nrf_power_dcdcen_set(p_used_config->dcdcen); +#if NRF_POWER_HAS_VDDH + nrf_power_dcdcen_vddh_set(p_used_config->dcdcenhv); +#endif + + nrf_drv_common_power_clock_irq_init(); + + m_initialized = true; + return NRF_SUCCESS; +} + +void nrf_drv_power_uninit(void) +{ + ASSERT(m_initialized); + nrf_drv_power_pof_uninit(); +#if NRF_POWER_HAS_SLEEPEVT + nrf_drv_power_sleepevt_uninit(); +#endif +#if NRF_POWER_HAS_USBREG + nrf_drv_power_usbevt_uninit(); +#endif + m_initialized = false; +} + +void nrf_drv_power_pof_init(nrf_drv_power_pofwarn_config_t const * p_config) +{ + ASSERT(p_config != NULL); + + nrf_drv_power_pof_uninit(); + nrf_power_pofcon_set(true, p_config->thr); +#if NRF_POWER_HAS_VDDH + nrf_power_pofcon_vddh_set(p_config->thrvddh); +#endif + if(p_config->handler != NULL) + { + m_pofwarn_handler = p_config->handler; + nrf_power_int_enable(NRF_POWER_INT_POFWARN_MASK); + } +} + +void nrf_drv_power_pof_uninit(void) +{ + nrf_power_int_disable(NRF_POWER_INT_POFWARN_MASK); + m_pofwarn_handler = NULL; +} + +#if NRF_POWER_HAS_SLEEPEVT +void nrf_drv_power_sleepevt_init(nrf_drv_power_sleepevt_config_t const * p_config) +{ + ASSERT(p_config != NULL); + + nrf_drv_power_sleepevt_uninit(); + if(p_config->handler != NULL) + { + uint32_t enmask = 0; + m_sleepevt_handler = p_config->handler; + if(p_config->en_enter) + { + enmask |= NRF_POWER_INT_SLEEPENTER_MASK; + } + if(p_config->en_exit) + { + enmask |= NRF_POWER_INT_SLEEPEXIT_MASK; + } + nrf_power_int_enable(enmask); + } +} + +void nrf_drv_power_sleepevt_uninit(void) +{ + nrf_power_int_disable( + NRF_POWER_INT_SLEEPENTER_MASK | + NRF_POWER_INT_SLEEPEXIT_MASK); + m_sleepevt_handler = NULL; +} +#endif /* NRF_POWER_HAS_SLEEPEVT */ + +#if NRF_POWER_HAS_USBREG +void nrf_drv_power_usbevt_init(nrf_drv_power_usbevt_config_t const * p_config) +{ + nrf_drv_power_usbevt_uninit(); + if(p_config->handler != NULL) + { + m_usbevt_handler = p_config->handler; + nrf_power_int_enable( + NRF_POWER_INT_USBDETECTED_MASK | + NRF_POWER_INT_USBREMOVED_MASK | + NRF_POWER_INT_USBPWRRDY_MASK); + } +} + +void nrf_drv_power_usbevt_uninit(void) +{ + nrf_power_int_disable( + NRF_POWER_INT_USBDETECTED_MASK | + NRF_POWER_INT_USBREMOVED_MASK | + NRF_POWER_INT_USBPWRRDY_MASK); + m_usbevt_handler = NULL; +} +#endif /* NRF_POWER_HAS_USBREG */ + + +/** + * @ingroup nrf_drv_power_internals + * @brief Interrupt handler + * + * POWER peripheral interrupt handler + */ +#if NRF_DRV_COMMON_POWER_CLOCK_ISR +void nrf_drv_power_onIRQ(void) +#else +void POWER_POWER_IRQHandler(void) +#endif +{ + uint32_t enabled = nrf_power_int_enable_get(); + if((0 != (enabled & NRF_POWER_INT_POFWARN_MASK)) && + nrf_power_event_get_and_clear(NRF_POWER_EVENT_POFWARN)) + { + ASSERT(m_pofwarn_handler != NULL); /* Cannot be null if event is enabled */ + m_pofwarn_handler(); + } +#if NRF_POWER_HAS_SLEEPEVT + if((0 != (enabled & NRF_POWER_INT_SLEEPENTER_MASK)) && + nrf_power_event_get_and_clear(NRF_POWER_EVENT_SLEEPENTER)) + { + ASSERT(m_sleepevt_handler != NULL); /* Cannot be null if event is enabled */ + m_sleepevt_handler(NRF_DRV_POWER_SLEEP_EVT_ENTER); + } + if((0 != (enabled & NRF_POWER_INT_SLEEPEXIT_MASK)) && + nrf_power_event_get_and_clear(NRF_POWER_EVENT_SLEEPEXIT)) + { + ASSERT(m_sleepevt_handler != NULL); /* Cannot be null if event is enabled */ + m_sleepevt_handler(NRF_DRV_POWER_SLEEP_EVT_EXIT); + } +#endif +#if NRF_POWER_HAS_USBREG + if((0 != (enabled & NRF_POWER_INT_USBDETECTED_MASK)) && + nrf_power_event_get_and_clear(NRF_POWER_EVENT_USBDETECTED)) + { + ASSERT(m_usbevt_handler != NULL); /* Cannot be null if event is enabled */ + m_usbevt_handler(NRF_DRV_POWER_USB_EVT_DETECTED); + } + if((0 != (enabled & NRF_POWER_INT_USBREMOVED_MASK)) && + nrf_power_event_get_and_clear(NRF_POWER_EVENT_USBREMOVED)) + { + ASSERT(m_usbevt_handler != NULL); /* Cannot be null if event is enabled */ + m_usbevt_handler(NRF_DRV_POWER_USB_EVT_REMOVED); + } + if((0 != (enabled & NRF_POWER_INT_USBPWRRDY_MASK)) && + nrf_power_event_get_and_clear(NRF_POWER_EVENT_USBPWRRDY)) + { + ASSERT(m_usbevt_handler != NULL); /* Cannot be null if event is enabled */ + m_usbevt_handler(NRF_DRV_POWER_USB_EVT_READY); + } +#endif +} + +#endif /* POWER_ENABLED */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.h new file mode 100644 index 0000000000..ed76f5217a --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.h @@ -0,0 +1,321 @@ +/* Copyright (c) Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ +#ifndef NRF_DRV_POWER_H__ +#define NRF_DRV_POWER_H__ + +#include +#include +#include "nrf_power.h" +#include "sdk_config.h" +#include "nrf_drv_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup nrf_power Power HAL and driver + * @ingroup nrf_drivers + * @brief POWER peripheral APIs. + * + * The power peripheral HAL provides basic APIs for accessing + * the registers of the POWER peripheral. + * The POWER driver provides APIs on a higher level. + */ + +/** + * @defgroup nrf_drv_power POWER driver + * @{ + * @ingroup nrf_power + * @brief Driver for managing events and the state of POWER peripheral. + * + */ + +/** + * @brief Power mode possible configurations + */ +typedef enum +{ + NRF_DRV_POWER_MODE_CONSTLAT, /**< Constant latency mode *///!< NRF_DRV_POWER_MODE_CONSTLAT + NRF_DRV_POWER_MODE_LOWPWR /**< Low power mode *///!< NRF_DRV_POWER_MODE_LOWPWR +}nrf_drv_power_mode_t; + +#if NRF_POWER_HAS_SLEEPEVT +/** + * @brief Events from power system + */ +typedef enum +{ + NRF_DRV_POWER_SLEEP_EVT_ENTER, /**< CPU entered WFI/WFE sleep + * + * Keep in mind that if this interrupt is enabled, + * it means that CPU was waken up just after WFI by this interrupt. + */ + NRF_DRV_POWER_SLEEP_EVT_EXIT /**< CPU exited WFI/WFE sleep */ +}nrf_drv_power_sleep_evt_t; +#endif /* NRF_POWER_HAS_SLEEPEVT */ + +#if NRF_POWER_HAS_USBREG +/** + * @brief Events from USB power system + */ +typedef enum +{ + NRF_DRV_POWER_USB_EVT_DETECTED, /**< USB power detected on the connector (plugged in). */ + NRF_DRV_POWER_USB_EVT_REMOVED, /**< USB power removed from the connector. */ + NRF_DRV_POWER_USB_EVT_READY /**< USB power regulator ready. */ +}nrf_drv_power_usb_evt_t; + +/** + * @brief USB power state + * + * The single enumerator that holds all data about current state of USB + * related POWER. + * + * Organized this way that higher power state has higher numeric value + */ +typedef enum +{ + NRF_DRV_POWER_USB_STATE_DISCONNECTED, /**< No power on USB lines detected */ + NRF_DRV_POWER_USB_STATE_CONNECTED, /**< The USB power is detected, but USB power regulator is not ready */ + NRF_DRV_POWER_USB_STATE_READY /**< From the power point of view USB is ready for working */ +}nrf_drv_power_usb_state_t; +#endif /* NRF_POWER_HAS_USBREG */ + +/** + * @name Callback types + * + * Defined types of callback functions + * @{ + */ +/** + * @brief Event handler for power failure warning + */ +typedef void (*nrf_drv_power_pofwarn_event_handler_t)(void); + +#if NRF_POWER_HAS_SLEEPEVT +/** + * @brief Event handler for entering/exiting sleep + * + * @param event Event type + */ +typedef void (*nrf_drv_power_sleep_event_handler_t)(nrf_drv_power_sleep_evt_t event); +#endif + +#if NRF_POWER_HAS_USBREG +/** + * @brief Event handler for USB related power events + * + * @param event Event type + */ +typedef void (*nrf_drv_power_usb_event_handler_t)(nrf_drv_power_usb_evt_t event); +#endif +/** @} */ + +/** + * @brief General power configuration + * + * Parameters required to initialize power driver. + */ +typedef struct +{ + /** + * @brief Enable main DCDC regulator + * + * This bit only informs the driver that elements for DCDC regulator + * are installed and regulator can be used. + * The regulator would be enabled or disabled automatically + * automatically by the hardware, basing on current power requirement. + */ + bool dcdcen:1; + +#if NRF_POWER_HAS_VDDH + /** + * @brief Enable HV DCDC regulator + * + * This bit only informs the driver that elements for DCDC regulator + * are installed and regulator can be used. + * The regulator would be enabled or disabled automatically + * automatically by the hardware, basing on current power requirement. + */ + bool dcdcenhv: 1; +#endif +}nrf_drv_power_config_t; + +/** + * @brief The configuration for power failure comparator + * + * Configuration used to enable and configure power failure comparator + */ +typedef struct +{ + nrf_drv_power_pofwarn_event_handler_t handler; //!< Event handler + nrf_power_pof_thr_t thr; //!< Threshold for power failure detection +#if NRF_POWER_HAS_VDDH + nrf_power_pof_thrvddh_t thrvddh; //!< Threshold for power failure detection on VDDH pin +#endif +}nrf_drv_power_pofwarn_config_t; + +#if NRF_POWER_HAS_SLEEPEVT +/** + * @brief The configuration of sleep event processing + * + * Configuration used to enable and configure sleep event handling + */ +typedef struct +{ + nrf_drv_power_sleep_event_handler_t handler; //!< Event handler + bool en_enter:1; //!< Enable event on sleep entering + bool en_exit :1; //!< Enable event on sleep exiting +}nrf_drv_power_sleepevt_config_t; +#endif + +#if NRF_POWER_HAS_USBREG +/** + * @brief The configuration of USB related power events + * + * Configuration used to enable and configure USB power event handling + */ +typedef struct +{ + nrf_drv_power_usb_event_handler_t handler; //!< Event processing +}nrf_drv_power_usbevt_config_t; +#endif /* NRF_POWER_HAS_USBREG */ + +/** + * @brief Function for checking if driver is already initialized + * + * This function is used to check whatever common POWER_CLOCK common interrupt + * should be disabled or not if @ref nrf_drv_clock tries to disable the interrupt. + * + * @retval true Driver is initialized + * @retval false Driver is uninitialized + * + * @sa nrf_drv_power_uninit + */ +bool nrf_drv_power_init_check(void); + +/** + * @brief Initialize power module driver + * + * Enabled power module driver would process all the interrupts from power system. + * + * @param[in] p_config Driver configuration. Can be NULL - the default configuration + * from @em sdk_config.h file would be used then. + * + * @retval NRF_ERROR_MODULE_ALREADY_INITIALIZED Module is initialized already. + * @retval NRF_SUCCESS Successfully initialized. + */ +ret_code_t nrf_drv_power_init(nrf_drv_power_config_t const * p_config); + +/** + * @brief Unintialize power module driver + * + * Disables all the interrupt handling in the module. + * + * @sa nrf_drv_power_init + */ +void nrf_drv_power_uninit(void); + +/** + * @brief Initialize power failure comparator + * + * Configures and setups the power failure comparator and enables it. + * + * @param[in] p_config Configuration with values and event handler. + * If event handler is set to NULL, interrupt would be disabled. + */ +void nrf_drv_power_pof_init(nrf_drv_power_pofwarn_config_t const * p_config); + +/** + * @brief Turn off the power failure comparator + * + * Disables and clears the settings of the power failure comparator. + */ +void nrf_drv_power_pof_uninit(void); + +#if NRF_POWER_HAS_SLEEPEVT +/** + * @brief Initialize sleep entering and exiting events processing + * + * Configures and setups the sleep event processing. + * + * @param[in] p_config Configuration with values and event handler. + * + * @sa nrf_drv_power_sleepevt_uninit + */ +void nrf_drv_power_sleepevt_init(nrf_drv_power_sleepevt_config_t const * p_config); + +/** + * @brief Uninitialize sleep entering and exiting events processing + * + * @sa nrf_drv_power_sleepevt_init + */ +void nrf_drv_power_sleepevt_uninit(void); +#endif /* NRF_POWER_HAS_SLEEPEVT */ + +#if NRF_POWER_HAS_USBREG +/** + * @brief Initialize USB power event processing + * + * Configures and setups the USB power event processing. + * + * @param[in] p_config Configuration with values and event handler. + * + * @sa nrf_drv_power_usbevt_uninit + */ +void nrf_drv_power_usbevt_init(nrf_drv_power_usbevt_config_t const * p_config); + +/** + * @brief Uninitalize USB power event processing + * + * @sa nrf_drv_power_usbevt_init + */ +void nrf_drv_power_usbevt_uninit(void); + +/** + * @brief Get the status of USB power + * + * @return Current USB power status + */ +__STATIC_INLINE nrf_drv_power_usb_state_t nrf_drv_power_usbstatus_get(void); + +#endif /* NRF_POWER_HAS_USBREG */ + +/** @} */ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +#if NRF_POWER_HAS_USBREG +__STATIC_INLINE nrf_drv_power_usb_state_t nrf_drv_power_usbstatus_get(void) +{ + uint32_t status = nrf_power_usbregstatus_get(); + if(0 == (status & NRF_POWER_USBREGSTATUS_VBUSDETECT_MASK)) + { + return NRF_DRV_POWER_USB_STATE_DISCONNECTED; + } + if(0 == (status & NRF_POWER_USBREGSTATUS_OUTPUTRDY_MASK)) + { + return NRF_DRV_POWER_USB_STATE_CONNECTED; + } + return NRF_DRV_POWER_USB_STATE_READY; +} +#endif /* NRF_POWER_HAS_USBREG */ + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_DRV_POWER_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.c deleted file mode 100644 index 0794726951..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "nrf_drv_common.h" -#include "nrf_error.h" -#include "nrf_assert.h" -#include -#include -#include -#include "nrf_drv_swi.h" -#include "app_util_platform.h" - -#define NRF_LOG_MODULE_NAME "SWI" - -#if EGU_ENABLED -#if SWI_CONFIG_LOG_ENABLED -#define NRF_LOG_LEVEL SWI_CONFIG_LOG_LEVEL -#define NRF_LOG_INFO_COLOR SWI_CONFIG_INFO_COLOR -#define NRF_LOG_DEBUG_COLOR SWI_CONFIG_DEBUG_COLOR -#else //SWI_CONFIG_LOG_ENABLED -#define NRF_LOG_LEVEL 0 -#endif //SWI_CONFIG_LOG_ENABLED -#endif //EGU_ENABLED -#include "nrf_log.h" -#include "nrf_log_ctrl.h" - -STATIC_ASSERT(SWI_COUNT > 0); -STATIC_ASSERT(SWI_COUNT <= SWI_MAX); - -#ifdef SWI_DISABLE0 - #undef SWI_DISABLE0 - #define SWI_DISABLE0 1uL -#else - #if SWI_COUNT > 0 - #define SWI_DISABLE0 0uL - #else - #define SWI_DISABLE0 1uL - #endif -#endif - -#ifdef SWI_DISABLE1 - #undef SWI_DISABLE1 - #define SWI_DISABLE1 1uL -#else - #if SWI_COUNT > 1 - #define SWI_DISABLE1 0uL - #else - #define SWI_DISABLE1 1uL - #endif -#endif - -#ifdef SWI_DISABLE2 - #undef SWI_DISABLE2 - #define SWI_DISABLE2 1uL -#else - #if SWI_COUNT > 2 - #define SWI_DISABLE2 0uL - #else - #define SWI_DISABLE2 1uL - #endif -#endif - -#ifdef SWI_DISABLE3 - #undef SWI_DISABLE3 - #define SWI_DISABLE3 1uL -#else - #if SWI_COUNT > 3 - #define SWI_DISABLE3 0uL - #else - #define SWI_DISABLE3 1uL - #endif -#endif - -#ifdef SWI_DISABLE4 - #undef SWI_DISABLE4 - #define SWI_DISABLE4 1uL -#else - #if SWI_COUNT > 4 - #define SWI_DISABLE4 0uL - #else - #define SWI_DISABLE4 1uL - #endif -#endif - -#ifdef SWI_DISABLE5 - #undef SWI_DISABLE5 - #define SWI_DISABLE5 1uL -#else - #if SWI_COUNT > 5 - #define SWI_DISABLE5 0uL - #else - #define SWI_DISABLE5 1uL - #endif -#endif - -#define SWI_START_NUMBER ( (SWI_DISABLE0) \ - + (SWI_DISABLE0 * SWI_DISABLE1) \ - + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2) \ - + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3) \ - + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3 * SWI_DISABLE4) \ - + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3 * SWI_DISABLE4 \ - * SWI_DISABLE5) ) - -#define SWI_ARRAY_SIZE (SWI_COUNT - SWI_START_NUMBER) - -#if (SWI_COUNT <= SWI_START_NUMBER) - #undef SWI_ARRAY_SIZE - #define SWI_ARRAY_SIZE 1 -#endif - -static nrf_drv_state_t m_drv_state = NRF_DRV_STATE_UNINITIALIZED; -static nrf_swi_handler_t m_swi_handlers[SWI_ARRAY_SIZE]; - -#if !EGU_ENABLED -static nrf_swi_flags_t m_swi_flags[SWI_ARRAY_SIZE]; -#endif - -/**@brief Function for getting max channel number of given SWI. - * - * @param[in] swi SWI number. - * @return number of available channels. - */ -#if NRF_MODULE_ENABLED(EGU) -__STATIC_INLINE uint32_t swi_channel_number(nrf_swi_t swi) -{ - uint32_t retval = 0; - switch(swi){ - case 0: - retval = EGU0_CH_NUM; - break; - case 1: - retval = EGU1_CH_NUM; - break; - case 2: - retval = EGU2_CH_NUM; - break; - case 3: - retval = EGU3_CH_NUM; - break; - case 4: - retval = EGU4_CH_NUM; - break; - case 5: - retval = EGU5_CH_NUM; - break; - default: - retval = 0; - } - - return retval; -} -#else -#define swi_channel_number(swi) SWI_MAX_FLAGS -#endif - -#if NRF_MODULE_ENABLED(EGU) - -/**@brief Get the specific EGU instance. */ -__STATIC_INLINE NRF_EGU_Type * egu_instance_get(nrf_swi_t swi) -{ - return (NRF_EGU_Type*) (NRF_EGU0_BASE + (((uint32_t) swi) * (NRF_EGU1_BASE - NRF_EGU0_BASE))); -} - -/**@brief Software interrupt handler (using EGU). */ -static void nrf_drv_swi_process(nrf_swi_t swi) -{ - ASSERT(m_swi_handlers[swi - SWI_START_NUMBER]); - nrf_swi_flags_t flags = 0; - NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); - - for (uint8_t i = 0; i < swi_channel_number(swi); ++i) - { - nrf_egu_event_t egu_event = nrf_egu_event_triggered_get(NRF_EGUx, i); - if (nrf_egu_event_check(NRF_EGUx, egu_event)) - { - flags |= (1u << i); - nrf_egu_event_clear(NRF_EGUx, egu_event); - } - } - - m_swi_handlers[swi - SWI_START_NUMBER](swi, flags); -} - -#define SWI_HANDLER_TEMPLATE(NUM) void SWI##NUM##_EGU##NUM##_IRQHandler(void) \ - { \ - nrf_drv_swi_process(NUM); \ - } - -#else - -/**@brief Software interrupt handler (without EGU). */ -static void nrf_drv_swi_process(nrf_swi_t swi, nrf_swi_flags_t flags) -{ - ASSERT(m_swi_handlers[swi - SWI_START_NUMBER]); - m_swi_flags[swi - SWI_START_NUMBER] &= ~flags; - m_swi_handlers[swi - SWI_START_NUMBER](swi, flags); -} - - -#define SWI_HANDLER_TEMPLATE(NUM) void SWI##NUM##_IRQHandler(void) \ - { \ - nrf_drv_swi_process((NUM), m_swi_flags[(NUM) - SWI_START_NUMBER]); \ - } - -#endif - -#if SWI_DISABLE0 == 0 -SWI_HANDLER_TEMPLATE(0) -#endif - -#if SWI_DISABLE1 == 0 -SWI_HANDLER_TEMPLATE(1) -#endif - -#if SWI_DISABLE2 == 0 -SWI_HANDLER_TEMPLATE(2) -#endif - -#if SWI_DISABLE3 == 0 -SWI_HANDLER_TEMPLATE(3) -#endif - -#if SWI_DISABLE4 == 0 -SWI_HANDLER_TEMPLATE(4) -#endif - -#if SWI_DISABLE5 == 0 -SWI_HANDLER_TEMPLATE(5) -#endif - -#define AVAILABLE_SWI (0x3FuL & ~( \ - (SWI_DISABLE0 << 0) | (SWI_DISABLE1 << 1) | (SWI_DISABLE2 << 2) \ - | (SWI_DISABLE3 << 3) | (SWI_DISABLE4 << 4) | (SWI_DISABLE5 << 5) \ - )) - -#if (AVAILABLE_SWI == 0) - #warning No available SWIs. -#endif - -/**@brief Function for converting SWI number to system interrupt number. - * - * @param[in] swi SWI number. - * - * @retval IRQ number. - */ -__STATIC_INLINE IRQn_Type nrf_drv_swi_irq_of(nrf_swi_t swi) -{ - return (IRQn_Type)((uint32_t)SWI0_IRQn + (uint32_t)swi); -} - - -/**@brief Function for checking if given SWI is allocated. - * - * @param[in] swi SWI number. - */ -__STATIC_INLINE bool swi_is_allocated(nrf_swi_t swi) -{ - ASSERT(swi < SWI_COUNT); -#if SWI_START_NUMBER > 0 - if (swi < SWI_START_NUMBER) - { - return false; - } -#endif - /*lint -e(661) out of range case handled by assert above*/ - return m_swi_handlers[swi - SWI_START_NUMBER]; -} - -ret_code_t nrf_drv_swi_init(void) -{ - ret_code_t err_code; - - if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED) - { - m_drv_state = NRF_DRV_STATE_INITIALIZED; - err_code = NRF_SUCCESS; - NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; - } - err_code = NRF_ERROR_MODULE_ALREADY_INITIALIZED; - NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; -} - - -void nrf_drv_swi_uninit(void) -{ - ASSERT(m_drv_state != NRF_DRV_STATE_UNINITIALIZED) - - for (uint32_t i = SWI_START_NUMBER; i < SWI_COUNT; ++i) - { - m_swi_handlers[i - SWI_START_NUMBER] = NULL; - nrf_drv_common_irq_disable(nrf_drv_swi_irq_of((nrf_swi_t) i)); -#if NRF_MODULE_ENABLED(EGU) - NRF_EGU_Type * NRF_EGUx = egu_instance_get(i); - nrf_egu_int_disable(NRF_EGUx, NRF_EGU_INT_ALL); -#endif - } - m_drv_state = NRF_DRV_STATE_UNINITIALIZED; - return; -} - - -void nrf_drv_swi_free(nrf_swi_t * p_swi) -{ - ASSERT(swi_is_allocated(*p_swi)); - nrf_drv_common_irq_disable(nrf_drv_swi_irq_of(*p_swi)); - m_swi_handlers[(*p_swi) - SWI_START_NUMBER] = NULL; - *p_swi = NRF_SWI_UNALLOCATED; -} - - -ret_code_t nrf_drv_swi_alloc(nrf_swi_t * p_swi, nrf_swi_handler_t event_handler, uint32_t priority) -{ - ASSERT(event_handler); - uint32_t err_code = NRF_ERROR_NO_MEM; - - for (uint32_t i = SWI_START_NUMBER; i < SWI_COUNT; i++) - { - CRITICAL_REGION_ENTER(); - if ((!swi_is_allocated(i)) && (AVAILABLE_SWI & (1 << i))) - { - m_swi_handlers[i - SWI_START_NUMBER] = event_handler; - *p_swi = (nrf_swi_t) i; - nrf_drv_common_irq_enable(nrf_drv_swi_irq_of(*p_swi), priority); -#if NRF_MODULE_ENABLED(EGU) - NRF_EGU_Type * NRF_EGUx = egu_instance_get(i); - nrf_egu_int_enable(NRF_EGUx, NRF_EGU_INT_ALL); -#endif - err_code = NRF_SUCCESS; - } - CRITICAL_REGION_EXIT(); - if (err_code == NRF_SUCCESS) - { - NRF_LOG_INFO("SWI channel allocated: %d.\r\n", (*p_swi)); - break; - } - } - NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; -} - - -void nrf_drv_swi_trigger(nrf_swi_t swi, uint8_t flag_number) -{ - ASSERT(swi_is_allocated((uint32_t) swi)); - ASSERT(flag_number < swi_channel_number(swi)); -#if NRF_MODULE_ENABLED(EGU) - NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); - nrf_egu_task_trigger(NRF_EGUx, nrf_egu_task_trigger_get(NRF_EGUx, flag_number)); -#else - m_swi_flags[swi - SWI_START_NUMBER] |= (1 << flag_number); - NVIC_SetPendingIRQ(nrf_drv_swi_irq_of(swi)); -#endif -} - - -#if NRF_MODULE_ENABLED(EGU) - -uint32_t nrf_drv_swi_task_trigger_address_get(nrf_swi_t swi, uint8_t channel) -{ - NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); - return (uint32_t) nrf_egu_task_trigger_addres_get(NRF_EGUx, channel); -} - -uint32_t nrf_drv_swi_event_triggered_address_get(nrf_swi_t swi, uint8_t channel) -{ - NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); - return (uint32_t) nrf_egu_event_triggered_addres_get(NRF_EGUx, channel); -} - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.h deleted file mode 100644 index d7b3e384e5..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/swi/nrf_drv_swi.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/**@file - * - * @defgroup nrf_drv_swi SWI driver - * @{ - * @ingroup nrf_drivers - * - * @brief Driver for software interrupts (SWI). - * @details The SWI driver allows the user to allocate SWIs and pass extra flags to interrupt handler functions. - */ - -#ifndef NRF_DRV_SWI_H__ -#define NRF_DRV_SWI_H__ - -#include -#include -#include "app_util.h" -#include "app_util_platform.h" -#include "sdk_common.h" -#include "sdk_errors.h" -#include "nrf_peripherals.h" - -#ifndef EGU_ENABLED - #define EGU_ENABLED 0 -#endif - -#if NRF_MODULE_ENABLED(EGU) -#include "nrf_egu.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef uint8_t nrf_swi_t; ///< @brief SWI channel (unsigned integer). - -/** @brief SWI user flags (unsigned integer). - * - * User flags are set during the SWI trigger and passed to the callback function as an argument. - */ -typedef uint16_t nrf_swi_flags_t; - -/** @brief Unallocated channel value. */ -#define NRF_SWI_UNALLOCATED ((nrf_swi_t) 0xFFFFFFFFuL) - -/** @brief SWI handler function. - * - * Takes two arguments: SWI number (nrf_swi_t) and flags (nrf_swi_flags_t). - */ -typedef void (* nrf_swi_handler_t)(nrf_swi_t, nrf_swi_flags_t); - -/**@brief Maximum numbers of SWIs. This number is fixed for a specific chip. */ -#if NRF_MODULE_ENABLED(EGU) -#define SWI_MAX EGU_COUNT -#else -#define SWI_MAX SWI_COUNT -/**@brief Number of flags per SWI (fixed number). */ -#define SWI_MAX_FLAGS 16 -#endif - -#ifdef SOFTDEVICE_PRESENT - #if SWI_COUNT > 2 - #undef SWI_COUNT - #define SWI_COUNT 2 - #endif -#else - #ifdef SVCALL_AS_NORMAL_FUNCTION - // Serialization is enabled. - #if SWI_COUNT > 2 - #undef SWI_COUNT - #define SWI_COUNT 2 - #endif - #endif -#endif - -/**@brief Default SWI priority. */ -#define SWI_DEFAULT_PRIORITY APP_IRQ_PRIORITY_LOWEST - - -/**@brief Function for initializing the SWI module. - * - * @retval NRF_SUCCESS If the module was successfully initialized. - * @retval NRF_ERROR_MODULE_ALREADY_INITIALIZED If the module has already been initialized. - */ -ret_code_t nrf_drv_swi_init(void); - - -/**@brief Function for uninitializing the SWI module. - * - * This function also disables all SWIs. - */ -void nrf_drv_swi_uninit(void); - - -/**@brief Function for allocating a first unused SWI instance and setting a handler. - * @details The event handler function returns void and takes one uint32_t argument (SWI number). - * - * @param[out] p_swi Pointer to the SWI that has been allocated. - * @param[in] event_handler Event handler function (must not be NULL). - * @param[in] priority Interrupt priority. - * - * @retval NRF_SUCCESS If the SWI was successfully allocated. - * @retval NRF_ERROR_NO_MEM If there is no available SWI to be used. - */ -ret_code_t nrf_drv_swi_alloc(nrf_swi_t * p_swi, nrf_swi_handler_t event_handler, uint32_t priority); - - -/**@brief Function for freeing a previously allocated SWI. - * - * @param[in,out] p_swi SWI to free. The value is changed to NRF_SWI_UNALLOCATED on success. - */ -void nrf_drv_swi_free(nrf_swi_t * p_swi); - - -/**@brief Function for triggering the SWI. - * - * @param[in] swi SWI to trigger. - * @param[in] flag_number Number of user flag to trigger. - */ -void nrf_drv_swi_trigger(nrf_swi_t swi, uint8_t flag_number); - - -#if (EGU_ENABLED > 0) || defined(__SDK_DOXYGEN__) - - -/**@brief Function for returning the EGU trigger task address. - * - * @param[in] swi SWI instance. - * @param[in] channel Number of the EGU channel. - * - * @returns EGU trigger task address. - */ -uint32_t nrf_drv_swi_task_trigger_address_get(nrf_swi_t swi, uint8_t channel); - -/**@brief Function for returning the EGU triggered event address. - * - * @param[in] swi SWI instance. - * @param[in] channel Number of the EGU channel. - * - * @returns EGU triggered event address. - */ -uint32_t nrf_drv_swi_event_triggered_address_get(nrf_swi_t swi, uint8_t channel); - -#endif // NRF_MODULE_ENABLED(EGU) - - - -#ifdef __cplusplus -} -#endif - -#endif // NRF_DRV_SWI_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis_inst.def b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis_inst.def new file mode 100644 index 0000000000..be40002a67 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twis_slave/nrf_drv_twis_inst.def @@ -0,0 +1,20 @@ +/** + * @file + * @brief Xmacro file with contains enumeration of TWIS instances to implement + * + * Use this file everywhere where anything has to be generated for all active TWIS instances. + * Xmacro format: + * + * @code + X(n) + * @endcode + * + * Where @em n is number of the instance itself (0 for NRF_TWIS0). + */ +#if (TWIS0_ENABLED == 1) + X(0) +#endif +#if (TWIS1_ENABLED == 1) + X(1) +#endif +#undef X diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.c deleted file mode 100644 index d6e916b0a9..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.c +++ /dev/null @@ -1,972 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#include "sdk_common.h" -#if NRF_MODULE_ENABLED(UART) -#include "nrf_drv_uart.h" -#include "nrf_assert.h" -#include "nrf_drv_common.h" -#include "nrf_gpio.h" -#include "app_util_platform.h" - -#define NRF_LOG_MODULE_NAME "UART" - -#if UART_CONFIG_LOG_ENABLED -#define NRF_LOG_LEVEL UART_CONFIG_LOG_LEVEL -#define NRF_LOG_INFO_COLOR UART_CONFIG_INFO_COLOR -#define NRF_LOG_DEBUG_COLOR UART_CONFIG_DEBUG_COLOR -#define EVT_TO_STR(event) (event == NRF_UART_EVENT_ERROR ? "NRF_UART_EVENT_ERROR" : "UNKNOWN EVENT") -#else //UART_CONFIG_LOG_ENABLED -#define EVT_TO_STR(event) "" -#define NRF_LOG_LEVEL 0 -#endif //UART_CONFIG_LOG_ENABLED -#include "nrf_log.h" -#include "nrf_log_ctrl.h" - -#if (defined(UARTE_IN_USE) && defined(UART_IN_USE)) - // UARTE and UART combined - #define CODE_FOR_UARTE(code) if (m_cb[p_instance->drv_inst_idx].use_easy_dma) { code } - #define CODE_FOR_UARTE_INT(idx, code) if (m_cb[idx].use_easy_dma) { code } - #define CODE_FOR_UART(code) else { code } -#elif (defined(UARTE_IN_USE) && !defined(UART_IN_USE)) - // UARTE only - #define CODE_FOR_UARTE(code) { code } - #define CODE_FOR_UARTE_INT(idx, code) { code } - #define CODE_FOR_UART(code) -#elif (!defined(UARTE_IN_USE) && defined(UART_IN_USE)) - // UART only - #define CODE_FOR_UARTE(code) - #define CODE_FOR_UARTE_INT(idx, code) - #define CODE_FOR_UART(code) { code } -#else - #error "Wrong configuration." -#endif - -#define TX_COUNTER_ABORT_REQ_VALUE 256 - -typedef struct -{ - void * p_context; - nrf_uart_event_handler_t handler; - uint8_t const * p_tx_buffer; - uint8_t * p_rx_buffer; - uint8_t * p_rx_secondary_buffer; - volatile uint16_t tx_counter; - uint8_t tx_buffer_length; - uint8_t rx_buffer_length; - uint8_t rx_secondary_buffer_length; - volatile uint8_t rx_counter; - bool rx_enabled; - nrf_drv_state_t state; -#if (defined(UARTE_IN_USE) && defined(UART_IN_USE)) - bool use_easy_dma; -#endif -} uart_control_block_t; - -static uart_control_block_t m_cb[UART_ENABLED_COUNT]; - -__STATIC_INLINE void apply_config(nrf_drv_uart_t const * p_instance, nrf_drv_uart_config_t const * p_config) -{ - if (p_config->pseltxd != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_pin_set(p_config->pseltxd); - nrf_gpio_cfg_output(p_config->pseltxd); - } - if (p_config->pselrxd != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_cfg_input(p_config->pselrxd, NRF_GPIO_PIN_NOPULL); - } - - CODE_FOR_UARTE - ( - nrf_uarte_baudrate_set(p_instance->reg.p_uarte, (nrf_uarte_baudrate_t)p_config->baudrate); - nrf_uarte_configure(p_instance->reg.p_uarte, (nrf_uarte_parity_t)p_config->parity, - (nrf_uarte_hwfc_t)p_config->hwfc); - nrf_uarte_txrx_pins_set(p_instance->reg.p_uarte, p_config->pseltxd, p_config->pselrxd); - if (p_config->hwfc == NRF_UART_HWFC_ENABLED) - { - if (p_config->pselcts != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_NOPULL); - } - if (p_config->pselrts != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_pin_set(p_config->pselrts); - nrf_gpio_cfg_output(p_config->pselrts); - } - nrf_uarte_hwfc_pins_set(p_instance->reg.p_uarte, p_config->pselrts, p_config->pselcts); - } - ) - CODE_FOR_UART - ( - nrf_uart_baudrate_set(p_instance->reg.p_uart, p_config->baudrate); - nrf_uart_configure(p_instance->reg.p_uart, p_config->parity, p_config->hwfc); - nrf_uart_txrx_pins_set(p_instance->reg.p_uart, p_config->pseltxd, p_config->pselrxd); - if (p_config->hwfc == NRF_UART_HWFC_ENABLED) - { - if (p_config->pselcts != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_NOPULL); - } - if (p_config->pselrts != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_pin_set(p_config->pselrts); - nrf_gpio_cfg_output(p_config->pselrts); - } - nrf_uart_hwfc_pins_set(p_instance->reg.p_uart, p_config->pselrts, p_config->pselcts); - } - ) -} - -__STATIC_INLINE void interrupts_enable(const nrf_drv_uart_t * p_instance, uint8_t interrupt_priority) -{ - CODE_FOR_UARTE - ( - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDRX); - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDTX); - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ERROR); - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_RXTO); - nrf_uarte_int_enable(p_instance->reg.p_uarte, NRF_UARTE_INT_ENDRX_MASK | - NRF_UARTE_INT_ENDTX_MASK | - NRF_UARTE_INT_ERROR_MASK | - NRF_UARTE_INT_RXTO_MASK); - nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uarte), interrupt_priority); - ) - CODE_FOR_UART - ( - nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY); - nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_RXTO); - nrf_uart_int_enable(p_instance->reg.p_uart, NRF_UART_INT_MASK_TXDRDY | - NRF_UART_INT_MASK_RXTO); - nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uart), interrupt_priority); - ) -} - -__STATIC_INLINE void interrupts_disable(const nrf_drv_uart_t * p_instance) -{ - CODE_FOR_UARTE - ( - nrf_uarte_int_disable(p_instance->reg.p_uarte, NRF_UARTE_INT_ENDRX_MASK | - NRF_UARTE_INT_ENDTX_MASK | - NRF_UARTE_INT_ERROR_MASK | - NRF_UARTE_INT_RXTO_MASK); - nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uarte)); - ) - CODE_FOR_UART - ( - nrf_uart_int_disable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | - NRF_UART_INT_MASK_TXDRDY | - NRF_UART_INT_MASK_ERROR | - NRF_UART_INT_MASK_RXTO); - nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_uart)); - ) - -} - -__STATIC_INLINE void pins_to_default(const nrf_drv_uart_t * p_instance) -{ - /* Reset pins to default states */ - uint32_t txd; - uint32_t rxd; - uint32_t rts; - uint32_t cts; - - CODE_FOR_UARTE - ( - txd = nrf_uarte_tx_pin_get(p_instance->reg.p_uarte); - rxd = nrf_uarte_rx_pin_get(p_instance->reg.p_uarte); - rts = nrf_uarte_rts_pin_get(p_instance->reg.p_uarte); - cts = nrf_uarte_cts_pin_get(p_instance->reg.p_uarte); - nrf_uarte_txrx_pins_disconnect(p_instance->reg.p_uarte); - nrf_uarte_hwfc_pins_disconnect(p_instance->reg.p_uarte); - ) - CODE_FOR_UART - ( - txd = nrf_uart_tx_pin_get(p_instance->reg.p_uart); - rxd = nrf_uart_rx_pin_get(p_instance->reg.p_uart); - rts = nrf_uart_rts_pin_get(p_instance->reg.p_uart); - cts = nrf_uart_cts_pin_get(p_instance->reg.p_uart); - nrf_uart_txrx_pins_disconnect(p_instance->reg.p_uart); - nrf_uart_hwfc_pins_disconnect(p_instance->reg.p_uart); - ) - - if (txd != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_cfg_default(txd); - } - - if (rxd != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_cfg_default(rxd); - } - - if (cts != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_cfg_default(cts); - } - - if (rts != NRF_UART_PSEL_DISCONNECTED) - { - nrf_gpio_cfg_default(rts); - } - -} - -__STATIC_INLINE void uart_enable(const nrf_drv_uart_t * p_instance) -{ - CODE_FOR_UARTE(nrf_uarte_enable(p_instance->reg.p_uarte);) - CODE_FOR_UART(nrf_uart_enable(p_instance->reg.p_uart);); -} - -__STATIC_INLINE void uart_disable(const nrf_drv_uart_t * p_instance) -{ - CODE_FOR_UARTE(nrf_uarte_disable(p_instance->reg.p_uarte);) - CODE_FOR_UART(nrf_uart_disable(p_instance->reg.p_uart);); -} - -ret_code_t nrf_drv_uart_init(const nrf_drv_uart_t * p_instance, nrf_drv_uart_config_t const * p_config, - nrf_uart_event_handler_t event_handler) -{ - ASSERT(p_config); - uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - ret_code_t err_code = NRF_SUCCESS; - - if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED) - { - err_code = NRF_ERROR_INVALID_STATE; - NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; - } - -#if (defined(UARTE_IN_USE) && defined(UART_IN_USE)) - p_cb->use_easy_dma = p_config->use_easy_dma; -#endif - apply_config(p_instance, p_config); - - p_cb->handler = event_handler; - p_cb->p_context = p_config->p_context; - - if (p_cb->handler) - { - interrupts_enable(p_instance, p_config->interrupt_priority); - } - - uart_enable(p_instance); - p_cb->rx_buffer_length = 0; - p_cb->rx_secondary_buffer_length = 0; - p_cb->tx_buffer_length = 0; - p_cb->state = NRF_DRV_STATE_INITIALIZED; - p_cb->rx_enabled = false; - NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; -} - -void nrf_drv_uart_uninit(const nrf_drv_uart_t * p_instance) -{ - uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - - uart_disable(p_instance); - - if (p_cb->handler) - { - interrupts_disable(p_instance); - } - - pins_to_default(p_instance); - - p_cb->state = NRF_DRV_STATE_UNINITIALIZED; - p_cb->handler = NULL; - NRF_LOG_INFO("Instance uninitialized: %d.\r\n", p_instance->drv_inst_idx); -} - -#if defined(UART_IN_USE) -__STATIC_INLINE void tx_byte(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) -{ - nrf_uart_event_clear(p_uart, NRF_UART_EVENT_TXDRDY); - uint8_t txd = p_cb->p_tx_buffer[p_cb->tx_counter]; - p_cb->tx_counter++; - nrf_uart_txd_set(p_uart, txd); -} - -__STATIC_INLINE ret_code_t nrf_drv_uart_tx_for_uart(const nrf_drv_uart_t * p_instance) -{ - uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - ret_code_t err_code = NRF_SUCCESS; - - nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY); - nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STARTTX); - - tx_byte(p_instance->reg.p_uart, p_cb); - - if (p_cb->handler == NULL) - { - while (p_cb->tx_counter < (uint16_t) p_cb->tx_buffer_length) - { - while (!nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY) && - p_cb->tx_counter != TX_COUNTER_ABORT_REQ_VALUE) - { - } - if (p_cb->tx_counter != TX_COUNTER_ABORT_REQ_VALUE) - { - tx_byte(p_instance->reg.p_uart, p_cb); - } - } - - if (p_cb->tx_counter == TX_COUNTER_ABORT_REQ_VALUE) - { - err_code = NRF_ERROR_FORBIDDEN; - } - else - { - while (!nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_TXDRDY)) - { - } - nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPTX); - } - p_cb->tx_buffer_length = 0; - } - - NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; -} -#endif - -#if defined(UARTE_IN_USE) -__STATIC_INLINE ret_code_t nrf_drv_uart_tx_for_uarte(const nrf_drv_uart_t * p_instance) -{ - uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - ret_code_t err_code = NRF_SUCCESS; - - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDTX); - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_TXSTOPPED); - nrf_uarte_tx_buffer_set(p_instance->reg.p_uarte, p_cb->p_tx_buffer, p_cb->tx_buffer_length); - nrf_uarte_task_trigger(p_instance->reg.p_uarte, NRF_UARTE_TASK_STARTTX); - - if (p_cb->handler == NULL) - { - bool endtx; - bool txstopped; - do - { - endtx = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDTX); - txstopped = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_TXSTOPPED); - } - while ((!endtx) && (!txstopped)); - - if (txstopped) - { - err_code = NRF_ERROR_FORBIDDEN; - } - p_cb->tx_buffer_length = 0; - } - - NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; -} -#endif - -ret_code_t nrf_drv_uart_tx(const nrf_drv_uart_t * p_instance, uint8_t const * const p_data, uint8_t length) -{ - uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - ASSERT(p_cb->state == NRF_DRV_STATE_INITIALIZED); - ASSERT(length>0); - ASSERT(p_data); - - ret_code_t err_code; - - CODE_FOR_UARTE - ( - // EasyDMA requires that transfer buffers are placed in DataRAM, - // signal error if the are not. - if (!nrf_drv_is_in_RAM(p_data)) - { - err_code = NRF_ERROR_INVALID_ADDR; - NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; - } - ) - - if (nrf_drv_uart_tx_in_progress(p_instance)) - { - err_code = NRF_ERROR_BUSY; - NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; - } - p_cb->tx_buffer_length = length; - p_cb->p_tx_buffer = p_data; - p_cb->tx_counter = 0; - - NRF_LOG_INFO("Transfer tx_len: %d.\r\n", p_cb->tx_buffer_length); - NRF_LOG_DEBUG("Tx data:\r\n"); - NRF_LOG_HEXDUMP_DEBUG((uint8_t *)p_cb->p_tx_buffer, p_cb->tx_buffer_length * sizeof(p_cb->p_tx_buffer)); - - CODE_FOR_UARTE - ( - return nrf_drv_uart_tx_for_uarte(p_instance); - ) - CODE_FOR_UART - ( - return nrf_drv_uart_tx_for_uart(p_instance); - ) -} - -bool nrf_drv_uart_tx_in_progress(const nrf_drv_uart_t * p_instance) -{ - return (m_cb[p_instance->drv_inst_idx].tx_buffer_length != 0); -} - -#if defined(UART_IN_USE) -__STATIC_INLINE void rx_enable(const nrf_drv_uart_t * p_instance) -{ - nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_ERROR); - nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_RXDRDY); - nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STARTRX); -} - -__STATIC_INLINE void rx_byte(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) -{ - if (!p_cb->rx_buffer_length) - { - nrf_uart_event_clear(p_uart, NRF_UART_EVENT_RXDRDY); - // Byte received when buffer is not set - data lost. - (void) nrf_uart_rxd_get(p_uart); - return; - } - nrf_uart_event_clear(p_uart, NRF_UART_EVENT_RXDRDY); - p_cb->p_rx_buffer[p_cb->rx_counter] = nrf_uart_rxd_get(p_uart); - p_cb->rx_counter++; -} - -__STATIC_INLINE ret_code_t nrf_drv_uart_rx_for_uart(const nrf_drv_uart_t * p_instance, uint8_t * p_data, uint8_t length, bool second_buffer) -{ - ret_code_t err_code; - - uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - - if ((!p_cb->rx_enabled) && (!second_buffer)) - { - rx_enable(p_instance); - } - - if (p_cb->handler == NULL) - { - nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_RXTO); - - bool rxrdy; - bool rxto; - bool error; - do - { - do - { - error = nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_ERROR); - rxrdy = nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_RXDRDY); - rxto = nrf_uart_event_check(p_instance->reg.p_uart, NRF_UART_EVENT_RXTO); - } while ((!rxrdy) && (!rxto) && (!error)); - - if (error || rxto) - { - break; - } - rx_byte(p_instance->reg.p_uart, p_cb); - } while (p_cb->rx_buffer_length > p_cb->rx_counter); - - p_cb->rx_buffer_length = 0; - if (error) - { - err_code = NRF_ERROR_INTERNAL; - NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; - } - - if (rxto) - { - err_code = NRF_ERROR_FORBIDDEN; - NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; - } - - if (p_cb->rx_enabled) - { - nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STARTRX); - } - else - { - // Skip stopping RX if driver is forced to be enabled. - nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPRX); - } - } - else - { - nrf_uart_int_enable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); - } - err_code = NRF_SUCCESS; - NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; -} -#endif - -#if defined(UARTE_IN_USE) -__STATIC_INLINE ret_code_t nrf_drv_uart_rx_for_uarte(const nrf_drv_uart_t * p_instance, uint8_t * p_data, uint8_t length, bool second_buffer) -{ - ret_code_t err_code = NRF_SUCCESS; - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDRX); - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_RXTO); - nrf_uarte_rx_buffer_set(p_instance->reg.p_uarte, p_data, length); - if (!second_buffer) - { - nrf_uarte_task_trigger(p_instance->reg.p_uarte, NRF_UARTE_TASK_STARTRX); - } - else - { - nrf_uarte_shorts_enable(p_instance->reg.p_uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); - } - - if (m_cb[p_instance->drv_inst_idx].handler == NULL) - { - bool endrx; - bool rxto; - bool error; - do { - endrx = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ENDRX); - rxto = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_RXTO); - error = nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ERROR); - }while ((!endrx) && (!rxto) && (!error)); - - m_cb[p_instance->drv_inst_idx].rx_buffer_length = 0; - - if (error) - { - err_code = NRF_ERROR_INTERNAL; - } - - if (rxto) - { - err_code = NRF_ERROR_FORBIDDEN; - } - } - else - { - nrf_uarte_int_enable(p_instance->reg.p_uarte, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK); - } - NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; -} -#endif - -ret_code_t nrf_drv_uart_rx(const nrf_drv_uart_t * p_instance, uint8_t * p_data, uint8_t length) -{ - uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - - ASSERT(m_cb[p_instance->drv_inst_idx].state == NRF_DRV_STATE_INITIALIZED); - ASSERT(length>0); - - ret_code_t err_code; - - CODE_FOR_UARTE - ( - // EasyDMA requires that transfer buffers are placed in DataRAM, - // signal error if the are not. - if (!nrf_drv_is_in_RAM(p_data)) - { - err_code = NRF_ERROR_INVALID_ADDR; - NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; - } - ) - - bool second_buffer = false; - - if (p_cb->handler) - { - CODE_FOR_UARTE - ( - nrf_uarte_int_disable(p_instance->reg.p_uarte, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK); - ) - CODE_FOR_UART - ( - nrf_uart_int_disable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); - ) - } - if (p_cb->rx_buffer_length != 0) - { - if (p_cb->rx_secondary_buffer_length != 0) - { - if (p_cb->handler) - { - CODE_FOR_UARTE - ( - nrf_uarte_int_enable(p_instance->reg.p_uarte, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK); - ) - CODE_FOR_UART - ( - nrf_uart_int_enable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); - ) - } - err_code = NRF_ERROR_BUSY; - NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); - return err_code; - } - second_buffer = true; - } - - if (!second_buffer) - { - p_cb->rx_buffer_length = length; - p_cb->p_rx_buffer = p_data; - p_cb->rx_counter = 0; - p_cb->rx_secondary_buffer_length = 0; - } - else - { - p_cb->p_rx_secondary_buffer = p_data; - p_cb->rx_secondary_buffer_length = length; - } - - NRF_LOG_INFO("Transfer rx_len: %d.\r\n", length); - - - CODE_FOR_UARTE - ( - return nrf_drv_uart_rx_for_uarte(p_instance, p_data, length, second_buffer); - ) - CODE_FOR_UART - ( - return nrf_drv_uart_rx_for_uart(p_instance, p_data, length, second_buffer); - ) -} - -void nrf_drv_uart_rx_enable(const nrf_drv_uart_t * p_instance) -{ - //Easy dma mode does not support enabling receiver without setting up buffer. - CODE_FOR_UARTE - ( - ASSERT(false); - ) - CODE_FOR_UART - ( - if (!m_cb[p_instance->drv_inst_idx].rx_enabled) - { - rx_enable(p_instance); - m_cb[p_instance->drv_inst_idx].rx_enabled = true; - } - ) -} - -void nrf_drv_uart_rx_disable(const nrf_drv_uart_t * p_instance) -{ - //Easy dma mode does not support enabling receiver without setting up buffer. - CODE_FOR_UARTE - ( - ASSERT(false); - ) - CODE_FOR_UART - ( - nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPRX); - m_cb[p_instance->drv_inst_idx].rx_enabled = false; - ) -} - -uint32_t nrf_drv_uart_errorsrc_get(const nrf_drv_uart_t * p_instance) -{ - uint32_t errsrc; - CODE_FOR_UARTE - ( - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_ERROR); - errsrc = nrf_uarte_errorsrc_get_and_clear(p_instance->reg.p_uarte); - ) - CODE_FOR_UART - ( - nrf_uart_event_clear(p_instance->reg.p_uart, NRF_UART_EVENT_ERROR); - errsrc = nrf_uart_errorsrc_get_and_clear(p_instance->reg.p_uart); - ) - return errsrc; -} - -__STATIC_INLINE void rx_done_event(uart_control_block_t * p_cb, uint8_t bytes, uint8_t * p_data) -{ - nrf_drv_uart_event_t event; - - event.type = NRF_DRV_UART_EVT_RX_DONE; - event.data.rxtx.bytes = bytes; - event.data.rxtx.p_data = p_data; - - p_cb->handler(&event, p_cb->p_context); -} - -__STATIC_INLINE void tx_done_event(uart_control_block_t * p_cb, uint8_t bytes) -{ - nrf_drv_uart_event_t event; - - event.type = NRF_DRV_UART_EVT_TX_DONE; - event.data.rxtx.bytes = bytes; - event.data.rxtx.p_data = (uint8_t *)p_cb->p_tx_buffer; - - p_cb->tx_buffer_length = 0; - - p_cb->handler(&event, p_cb->p_context); -} - -void nrf_drv_uart_tx_abort(const nrf_drv_uart_t * p_instance) -{ - uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; - - CODE_FOR_UARTE - ( - nrf_uarte_event_clear(p_instance->reg.p_uarte, NRF_UARTE_EVENT_TXSTOPPED); - nrf_uarte_task_trigger(p_instance->reg.p_uarte, NRF_UARTE_TASK_STOPTX); - if (p_cb->handler == NULL) - { - while (!nrf_uarte_event_check(p_instance->reg.p_uarte, NRF_UARTE_EVENT_TXSTOPPED)); - } - ) - CODE_FOR_UART - ( - nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPTX); - if (p_cb->handler) - { - tx_done_event(p_cb, p_cb->tx_counter); - } - else - { - p_cb->tx_counter = TX_COUNTER_ABORT_REQ_VALUE; - } - ) - NRF_LOG_INFO("TX transaction aborted.\r\n"); -} - -void nrf_drv_uart_rx_abort(const nrf_drv_uart_t * p_instance) -{ - CODE_FOR_UARTE - ( - nrf_uarte_task_trigger(p_instance->reg.p_uarte, NRF_UARTE_TASK_STOPRX); - ) - CODE_FOR_UART - ( - nrf_uart_int_disable(p_instance->reg.p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); - nrf_uart_task_trigger(p_instance->reg.p_uart, NRF_UART_TASK_STOPRX); - ) - NRF_LOG_INFO("RX transaction aborted.\r\n"); -} - - -#if defined(UART_IN_USE) -__STATIC_INLINE void uart_irq_handler(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) -{ - if (nrf_uart_int_enable_check(p_uart, NRF_UART_INT_MASK_ERROR) && - nrf_uart_event_check(p_uart, NRF_UART_EVENT_ERROR)) - { - nrf_drv_uart_event_t event; - nrf_uart_event_clear(p_uart, NRF_UART_EVENT_ERROR); - NRF_LOG_DEBUG("Event: %s.\r\n", (uint32_t)EVT_TO_STR(NRF_UART_EVENT_ERROR)); - nrf_uart_int_disable(p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); - if (!p_cb->rx_enabled) - { - nrf_uart_task_trigger(p_uart, NRF_UART_TASK_STOPRX); - } - event.type = NRF_DRV_UART_EVT_ERROR; - event.data.error.error_mask = nrf_uart_errorsrc_get_and_clear(p_uart); - event.data.error.rxtx.bytes = p_cb->rx_buffer_length; - event.data.error.rxtx.p_data = p_cb->p_rx_buffer; - - //abort transfer - p_cb->rx_buffer_length = 0; - p_cb->rx_secondary_buffer_length = 0; - - p_cb->handler(&event,p_cb->p_context); - } - else if (nrf_uart_int_enable_check(p_uart, NRF_UART_INT_MASK_RXDRDY) && - nrf_uart_event_check(p_uart, NRF_UART_EVENT_RXDRDY)) - { - rx_byte(p_uart, p_cb); - if (p_cb->rx_buffer_length == p_cb->rx_counter) - { - if (p_cb->rx_secondary_buffer_length) - { - uint8_t * p_data = p_cb->p_rx_buffer; - uint8_t rx_counter = p_cb->rx_counter; - - //Switch to secondary buffer. - p_cb->rx_buffer_length = p_cb->rx_secondary_buffer_length; - p_cb->p_rx_buffer = p_cb->p_rx_secondary_buffer; - p_cb->rx_secondary_buffer_length = 0; - p_cb->rx_counter = 0; - rx_done_event(p_cb, rx_counter, p_data); - } - else - { - if (!p_cb->rx_enabled) - { - nrf_uart_task_trigger(p_uart, NRF_UART_TASK_STOPRX); - } - nrf_uart_int_disable(p_uart, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); - p_cb->rx_buffer_length = 0; - rx_done_event(p_cb, p_cb->rx_counter, p_cb->p_rx_buffer); - } - } - } - - if (nrf_uart_event_check(p_uart, NRF_UART_EVENT_TXDRDY)) - { - if (p_cb->tx_counter < (uint16_t) p_cb->tx_buffer_length) - { - tx_byte(p_uart, p_cb); - } - else - { - nrf_uart_event_clear(p_uart, NRF_UART_EVENT_TXDRDY); - if (p_cb->tx_buffer_length) - { - tx_done_event(p_cb, p_cb->tx_buffer_length); - } - } - } - - if (nrf_uart_event_check(p_uart, NRF_UART_EVENT_RXTO)) - { - nrf_uart_event_clear(p_uart, NRF_UART_EVENT_RXTO); - - // RXTO event may be triggered as a result of abort call. In th - if (p_cb->rx_enabled) - { - nrf_uart_task_trigger(p_uart, NRF_UART_TASK_STARTRX); - } - if (p_cb->rx_buffer_length) - { - p_cb->rx_buffer_length = 0; - rx_done_event(p_cb, p_cb->rx_counter, p_cb->p_rx_buffer); - } - } -} -#endif - -#if defined(UARTE_IN_USE) -__STATIC_INLINE void uarte_irq_handler(NRF_UARTE_Type * p_uarte, uart_control_block_t * p_cb) -{ - if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ERROR)) - { - nrf_drv_uart_event_t event; - - nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_ERROR); - - event.type = NRF_DRV_UART_EVT_ERROR; - event.data.error.error_mask = nrf_uarte_errorsrc_get_and_clear(p_uarte); - event.data.error.rxtx.bytes = nrf_uarte_rx_amount_get(p_uarte); - event.data.error.rxtx.p_data = p_cb->p_rx_buffer; - - //abort transfer - p_cb->rx_buffer_length = 0; - p_cb->rx_secondary_buffer_length = 0; - - p_cb->handler(&event, p_cb->p_context); - } - else if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ENDRX)) - { - nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_ENDRX); - uint8_t amount = nrf_uarte_rx_amount_get(p_uarte); - // If the transfer was stopped before completion, amount of transfered bytes - // will not be equal to the buffer length. Interrupted trunsfer is ignored. - if (amount == p_cb->rx_buffer_length) - { - if (p_cb->rx_secondary_buffer_length) - { - uint8_t * p_data = p_cb->p_rx_buffer; - nrf_uarte_shorts_disable(p_uarte, NRF_UARTE_SHORT_ENDRX_STARTRX); - p_cb->rx_buffer_length = p_cb->rx_secondary_buffer_length; - p_cb->p_rx_buffer = p_cb->p_rx_secondary_buffer; - p_cb->rx_secondary_buffer_length = 0; - rx_done_event(p_cb, amount, p_data); - } - else - { - p_cb->rx_buffer_length = 0; - rx_done_event(p_cb, amount, p_cb->p_rx_buffer); - } - } - } - - if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_RXTO)) - { - nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_RXTO); - if (p_cb->rx_buffer_length) - { - p_cb->rx_buffer_length = 0; - rx_done_event(p_cb, nrf_uarte_rx_amount_get(p_uarte), p_cb->p_rx_buffer); - } - } - - if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ENDTX)) - { - nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_ENDTX); - if (p_cb->tx_buffer_length) - { - tx_done_event(p_cb, nrf_uarte_tx_amount_get(p_uarte)); - } - } -} -#endif - -#if UART0_ENABLED -void UART0_IRQHandler(void) -{ - CODE_FOR_UARTE_INT - ( - UART0_INSTANCE_INDEX, - uarte_irq_handler(NRF_UARTE0, &m_cb[UART0_INSTANCE_INDEX]); - ) - CODE_FOR_UART - ( - uart_irq_handler(NRF_UART0, &m_cb[UART0_INSTANCE_INDEX]); - ) -} -#endif - -#if UART1_ENABLED -void UARTE1_IRQHandler(void) -{ - CODE_FOR_UARTE_INT - ( - UART1_INSTANCE_INDEX, - uarte_irq_handler(NRF_UARTE1, &m_cb[UART1_INSTANCE_INDEX]); - ) - CODE_FOR_UART - ( - uart_irq_handler(NRF_UART1, &m_cb[UART1_INSTANCE_INDEX]); - ) -} -#endif -#endif //NRF_MODULE_ENABLED(UART) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.h deleted file mode 100644 index 5cbec57107..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/uart/nrf_drv_uart.h +++ /dev/null @@ -1,429 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/**@file - * @addtogroup nrf_uart UART driver and HAL - * @ingroup nrf_drivers - * @brief UART API. - * @details The UART driver provides APIs for utilizing the UART peripheral. - * - * @defgroup nrf_drv_uart UART driver - * @{ - * @ingroup nrf_uart - * - * @brief UART driver. - */ - -#ifndef NRF_DRV_UART_H -#define NRF_DRV_UART_H - -#include "nrf_uart.h" -#ifdef UARTE_PRESENT -#include "nrf_uarte.h" -#endif - -#include "sdk_errors.h" -#include "sdk_config.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef UART1_ENABLED -#define UART1_ENABLED 0 -#endif - -#ifndef UART0_ENABLED -#define UART0_ENABLED 0 -#endif - -#define UART0_INSTANCE_INDEX 0 -#define UART1_INSTANCE_INDEX UART0_ENABLED -#define UART_ENABLED_COUNT UART0_ENABLED + UART1_ENABLED - -#if defined(UARTE_PRESENT) - #define NRF_DRV_UART_PERIPHERAL(id) \ - (CONCAT_3(UART, id, _CONFIG_USE_EASY_DMA) == 1 ? \ - (void *)CONCAT_2(NRF_UARTE, id) \ - : (void *)CONCAT_2(NRF_UART, id)) -#else - #define NRF_DRV_UART_PERIPHERAL(id) (void *)CONCAT_2(NRF_UART, id) -#endif - -// This set of macros makes it possible to exclude parts of code, when one type -// of supported peripherals is not used. - -#if defined(UARTE_PRESENT) - -#if (UART_EASY_DMA_SUPPORT == 1) -#define UARTE_IN_USE -#endif - -#if (UART_LEGACY_SUPPORT == 1) -#define UART_IN_USE -#endif - -#if (UART_ENABLED == 1) && ((!defined(UARTE_IN_USE) && !defined(UART_IN_USE)) || ((UART_EASY_DMA_SUPPORT == 0) && (UART_LEGACY_SUPPORT == 0))) -#error "Illegal settings in uart module!" -#endif - -#elif defined(UART_PRESENT) -#define UART_IN_USE -#endif - -/** - * @brief Structure for the UART driver instance. - */ -typedef struct -{ - union - { -#if (defined(UARTE_IN_USE)) - NRF_UARTE_Type * p_uarte; ///< Pointer to a structure with UARTE registers. -#endif -#if (defined(UART_IN_USE) || (UART_ENABLED == 0)) - NRF_UART_Type * p_uart; ///< Pointer to a structure with UART registers. -#endif - } reg; - uint8_t drv_inst_idx; ///< Driver instance index. -} nrf_drv_uart_t; - -/** - * @brief Macro for creating an UART driver instance. - */ -#define NRF_DRV_UART_INSTANCE(id) \ -{ \ - .reg = {NRF_DRV_UART_PERIPHERAL(id)}, \ - .drv_inst_idx = CONCAT_3(UART, id, _INSTANCE_INDEX),\ -} - -/** - * @brief Types of UART driver events. - */ -typedef enum -{ - NRF_DRV_UART_EVT_TX_DONE, ///< Requested TX transfer completed. - NRF_DRV_UART_EVT_RX_DONE, ///< Requested RX transfer completed. - NRF_DRV_UART_EVT_ERROR, ///< Error reported by UART peripheral. -} nrf_drv_uart_evt_type_t; - -/**@brief Structure for UART configuration. */ -typedef struct -{ - uint32_t pseltxd; ///< TXD pin number. - uint32_t pselrxd; ///< RXD pin number. - uint32_t pselcts; ///< CTS pin number. - uint32_t pselrts; ///< RTS pin number. - void * p_context; ///< Context passed to interrupt handler. - nrf_uart_hwfc_t hwfc; ///< Flow control configuration. - nrf_uart_parity_t parity; ///< Parity configuration. - nrf_uart_baudrate_t baudrate; ///< Baudrate. - uint8_t interrupt_priority; ///< Interrupt priority. -#ifdef UARTE_PRESENT - bool use_easy_dma; -#endif -} nrf_drv_uart_config_t; - -/**@brief UART default configuration. */ -#ifdef UARTE_PRESENT -#if !UART_LEGACY_SUPPORT -#define DEFAULT_CONFIG_USE_EASY_DMA true -#elif !UART_EASY_DMA_SUPPORT -#define DEFAULT_CONFIG_USE_EASY_DMA false -#else -#define DEFAULT_CONFIG_USE_EASY_DMA UART0_USE_EASY_DMA -#endif -#define NRF_DRV_UART_DEFAULT_CONFIG \ - { \ - .pseltxd = NRF_UART_PSEL_DISCONNECTED, \ - .pselrxd = NRF_UART_PSEL_DISCONNECTED, \ - .pselcts = NRF_UART_PSEL_DISCONNECTED, \ - .pselrts = NRF_UART_PSEL_DISCONNECTED, \ - .p_context = NULL, \ - .hwfc = (nrf_uart_hwfc_t)UART_DEFAULT_CONFIG_HWFC, \ - .parity = (nrf_uart_parity_t)UART_DEFAULT_CONFIG_PARITY, \ - .baudrate = (nrf_uart_baudrate_t)UART_DEFAULT_CONFIG_BAUDRATE, \ - .interrupt_priority = UART_DEFAULT_CONFIG_IRQ_PRIORITY, \ - .use_easy_dma = true \ - } -#else -#define NRF_DRV_UART_DEFAULT_CONFIG \ - { \ - .pseltxd = NRF_UART_PSEL_DISCONNECTED, \ - .pselrxd = NRF_UART_PSEL_DISCONNECTED, \ - .pselcts = NRF_UART_PSEL_DISCONNECTED, \ - .pselrts = NRF_UART_PSEL_DISCONNECTED, \ - .p_context = NULL, \ - .hwfc = (nrf_uart_hwfc_t)UART_DEFAULT_CONFIG_HWFC, \ - .parity = (nrf_uart_parity_t)UART_DEFAULT_CONFIG_PARITY, \ - .baudrate = (nrf_uart_baudrate_t)UART_DEFAULT_CONFIG_BAUDRATE, \ - .interrupt_priority = UART_DEFAULT_CONFIG_IRQ_PRIORITY, \ - } -#endif - -/**@brief Structure for UART transfer completion event. */ -typedef struct -{ - uint8_t * p_data; ///< Pointer to memory used for transfer. - uint8_t bytes; ///< Number of bytes transfered. -} nrf_drv_uart_xfer_evt_t; - -/**@brief Structure for UART error event. */ -typedef struct -{ - nrf_drv_uart_xfer_evt_t rxtx; ///< Transfer details includes number of bytes transfered. - uint32_t error_mask;///< Mask of error flags that generated the event. -} nrf_drv_uart_error_evt_t; - -/**@brief Structure for UART event. */ -typedef struct -{ - nrf_drv_uart_evt_type_t type; ///< Event type. - union - { - nrf_drv_uart_xfer_evt_t rxtx; ///< Data provided for transfer completion events. - nrf_drv_uart_error_evt_t error;///< Data provided for error event. - } data; -} nrf_drv_uart_event_t; - -/** - * @brief UART interrupt event handler. - * - * @param[in] p_event Pointer to event structure. Event is allocated on the stack so it is available - * only within the context of the event handler. - * @param[in] p_context Context passed to interrupt handler, set on initialization. - */ -typedef void (*nrf_uart_event_handler_t)(nrf_drv_uart_event_t * p_event, void * p_context); - -/** - * @brief Function for initializing the UART driver. - * - * This function configures and enables UART. After this function GPIO pins are controlled by UART. - * - * @param[in] p_instance Pointer to the driver instance structure. - * @param[in] p_config Initial configuration. Default configuration used if NULL. - * @param[in] event_handler Event handler provided by the user. If not provided driver works in - * blocking mode. - * - * @retval NRF_SUCCESS If initialization was successful. - * @retval NRF_ERROR_INVALID_STATE If driver is already initialized. - */ -ret_code_t nrf_drv_uart_init(nrf_drv_uart_t const * p_instance, - nrf_drv_uart_config_t const * p_config, - nrf_uart_event_handler_t event_handler); - -/** - * @brief Function for uninitializing the UART driver. - * @param[in] p_instance Pointer to the driver instance structure. - */ -void nrf_drv_uart_uninit(nrf_drv_uart_t const * p_instance); - -/** - * @brief Function for getting the address of a specific UART task. - * - * @param[in] p_instance Pointer to the driver instance structure. - * @param[in] task Task. - * - * @return Task address. - */ -__STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_drv_uart_t const * p_instance, - nrf_uart_task_t task); - -/** - * @brief Function for getting the address of a specific UART event. - * - * @param[in] p_instance Pointer to the driver instance structure. - * @param[in] event Event. - * - * @return Event address. - */ -__STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(nrf_drv_uart_t const * p_instance, - nrf_uart_event_t event); - -/** - * @brief Function for sending data over UART. - * - * If an event handler was provided in nrf_drv_uart_init() call, this function - * returns immediately and the handler is called when the transfer is done. - * Otherwise, the transfer is performed in blocking mode, i.e. this function - * returns when the transfer is finished. Blocking mode is not using interrupt so - * there is no context switching inside the function. - * - * @note Peripherals using EasyDMA (i.e. UARTE) require that the transfer buffers - * are placed in the Data RAM region. If they are not and UARTE instance is - * used, this function will fail with error code NRF_ERROR_INVALID_ADDR. - * - * @param[in] p_instance Pointer to the driver instance structure. - * @param[in] p_data Pointer to data. - * @param[in] length Number of bytes to send. - * - * @retval NRF_SUCCESS If initialization was successful. - * @retval NRF_ERROR_BUSY If driver is already transferring. - * @retval NRF_ERROR_FORBIDDEN If the transfer was aborted from a different context - * (blocking mode only, also see @ref nrf_drv_uart_rx_disable). - * @retval NRF_ERROR_INVALID_ADDR If p_data does not point to RAM buffer (UARTE only). - */ -ret_code_t nrf_drv_uart_tx(nrf_drv_uart_t const * p_instance, - uint8_t const * const p_data, uint8_t length); - -/** - * @brief Function for checking if UART is currently transmitting. - * - * @param[in] p_instance Pointer to the driver instance structure. - * - * @retval true If UART is transmitting. - * @retval false If UART is not transmitting. - */ -bool nrf_drv_uart_tx_in_progress(nrf_drv_uart_t const * p_instance); - -/** - * @brief Function for aborting any ongoing transmission. - * @note @ref NRF_DRV_UART_EVT_TX_DONE event will be generated in non-blocking mode. Event will - * contain number of bytes sent until abort was called. If Easy DMA is not used event will be - * called from the function context. If Easy DMA is used it will be called from UART interrupt - * context. - * - * @param[in] p_instance Pointer to the driver instance structure. - */ -void nrf_drv_uart_tx_abort(nrf_drv_uart_t const * p_instance); - -/** - * @brief Function for receiving data over UART. - * - * If an event handler was provided in the nrf_drv_uart_init() call, this function - * returns immediately and the handler is called when the transfer is done. - * Otherwise, the transfer is performed in blocking mode, i.e. this function - * returns when the transfer is finished. Blocking mode is not using interrupt so - * there is no context switching inside the function. - * The receive buffer pointer is double buffered in non-blocking mode. The secondary - * buffer can be set immediately after starting the transfer and will be filled - * when the primary buffer is full. The double buffering feature allows - * receiving data continuously. - * - * @note Peripherals using EasyDMA (i.e. UARTE) require that the transfer buffers - * are placed in the Data RAM region. If they are not and UARTE driver instance - * is used, this function will fail with error code NRF_ERROR_INVALID_ADDR. - * - * @param[in] p_instance Pointer to the driver instance structure. - * @param[in] p_data Pointer to data. - * @param[in] length Number of bytes to receive. - * - * @retval NRF_SUCCESS If initialization was successful. - * @retval NRF_ERROR_BUSY If the driver is already receiving - * (and the secondary buffer has already been set - * in non-blocking mode). - * @retval NRF_ERROR_FORBIDDEN If the transfer was aborted from a different context - * (blocking mode only, also see @ref nrf_drv_uart_rx_disable). - * @retval NRF_ERROR_INTERNAL If UART peripheral reported an error. - * @retval NRF_ERROR_INVALID_ADDR If p_data does not point to RAM buffer (UARTE only). - */ -ret_code_t nrf_drv_uart_rx(nrf_drv_uart_t const * p_instance, - uint8_t * p_data, uint8_t length); - -/** - * @brief Function for enabling receiver. - * - * UART has 6 byte long RX FIFO and it will be used to store incoming data. If user will not call - * UART receive function before FIFO is filled, overrun error will encounter. Enabling receiver - * without specifying RX buffer is supported only in UART mode (without Easy DMA). Receiver must be - * explicitly closed by the user @sa nrf_drv_uart_rx_disable. Function asserts if mode is wrong. - * - * @param[in] p_instance Pointer to the driver instance structure. - */ -void nrf_drv_uart_rx_enable(nrf_drv_uart_t const * p_instance); - -/** - * @brief Function for disabling receiver. - * - * Function must be called to close the receiver after it has been explicitly enabled by - * @sa nrf_drv_uart_rx_enable. Feature is supported only in UART mode (without Easy DMA). Function - * asserts if mode is wrong. - * - * @param[in] p_instance Pointer to the driver instance structure. - */ -void nrf_drv_uart_rx_disable(nrf_drv_uart_t const * p_instance); - -/** - * @brief Function for aborting any ongoing reception. - * @note @ref NRF_DRV_UART_EVT_RX_DONE event will be generated in non-blocking mode. The event will - * contain the number of bytes received until abort was called. The event is called from UART interrupt - * context. - * - * @param[in] p_instance Pointer to the driver instance structure. - */ -void nrf_drv_uart_rx_abort(nrf_drv_uart_t const * p_instance); - -/** - * @brief Function for reading error source mask. Mask contains values from @ref nrf_uart_error_mask_t. - * @note Function should be used in blocking mode only. In case of non-blocking mode error event is - * generated. Function clears error sources after reading. - * - * @param[in] p_instance Pointer to the driver instance structure. - * - * @retval Mask of reported errors. - */ -uint32_t nrf_drv_uart_errorsrc_get(nrf_drv_uart_t const * p_instance); - -#ifndef SUPPRESS_INLINE_IMPLEMENTATION -__STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_drv_uart_t const * p_instance, - nrf_uart_task_t task) -{ -#ifdef UART_IN_USE - return nrf_uart_task_address_get(p_instance->reg.p_uart, task); -#else - return nrf_uarte_task_address_get(p_instance->reg.p_uarte, (nrf_uarte_task_t)task); -#endif -} - -__STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(nrf_drv_uart_t const * p_instance, - nrf_uart_event_t event) -{ -#ifdef UART_IN_USE - return nrf_uart_event_address_get(p_instance->reg.p_uart, event); -#else - return nrf_uarte_event_address_get(p_instance->reg.p_uarte, (nrf_uarte_event_t)event); -#endif -} -#endif //SUPPRESS_INLINE_IMPLEMENTATION - -#ifdef __cplusplus -} -#endif - -#endif //NRF_DRV_UART_H -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.c new file mode 100644 index 0000000000..88eda467c3 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.c @@ -0,0 +1,33 @@ +/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(CRC32) +#include "crc32.h" + +#include + +uint32_t crc32_compute(uint8_t const * p_data, uint32_t size, uint32_t const * p_crc) +{ + uint32_t crc; + + crc = (p_crc == NULL) ? 0xFFFFFFFF : ~(*p_crc); + for (uint32_t i = 0; i < size; i++) + { + crc = crc ^ p_data[i]; + for (uint32_t j = 8; j > 0; j--) + { + crc = (crc >> 1) ^ (0xEDB88320U & ((crc & 1) ? 0xFFFFFFFF : 0)); + } + } + return ~crc; +} +#endif //NRF_MODULE_ENABLED(CRC32) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.h new file mode 100644 index 0000000000..30a6499272 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + +/** @file + * + * @defgroup crc32 CRC32 compute + * @{ + * @ingroup hci_transport + * + * @brief This module implements the CRC-32 calculation in the blocks. + */ + +#ifndef CRC32_H__ +#define CRC32_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Function for calculating CRC-32 in blocks. + * + * Feed each consecutive data block into this function, along with the current value of p_crc as + * returned by the previous call of this function. The first call of this function should pass NULL + * as the initial value of the crc in p_crc. + * + * @param[in] p_data The input data block for computation. + * @param[in] size The size of the input data block in bytes. + * @param[in] p_crc The previous calculated CRC-32 value or NULL if first call. + * + * @return The updated CRC-32 value, based on the input supplied. + */ +uint32_t crc32_compute(uint8_t const * p_data, uint32_t size, uint32_t const * p_crc); + + +#ifdef __cplusplus +} +#endif + +#endif // CRC32_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.c new file mode 100644 index 0000000000..dc3d10f42c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.c @@ -0,0 +1,407 @@ +/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(NRF_QUEUE) +#include "nrf_queue.h" +#include "app_util_platform.h" + +/**@brief Get next element index. + * + * @param[in] p_queue Pointer to the queue instance. + * @param[in] idx Current index. + * + * @return Next element index. + */ +__STATIC_INLINE size_t nrf_queue_next_idx(nrf_queue_t const * p_queue, size_t idx) +{ + ASSERT(p_queue != NULL); + return (idx < p_queue->size) ? (idx + 1) : 0; +} + +/**@brief Get current queue utilization. This function assumes that this process will not be interrupted. + * + * @param[in] p_queue Pointer to the queue instance. + * + * @return Current queue utilization. + */ +__STATIC_INLINE size_t queue_utilization_get(nrf_queue_t const * p_queue) +{ + return (p_queue->p_cb->back >= p_queue->p_cb->front) ? + (p_queue->p_cb->back - p_queue->p_cb->front) : + (p_queue->size + 1 - p_queue->p_cb->front + p_queue->p_cb->back); +} + +bool nrf_queue_is_full(nrf_queue_t const * p_queue) +{ + ASSERT(p_queue != NULL); + return (nrf_queue_next_idx(p_queue, p_queue->p_cb->back) == p_queue->p_cb->front); +} + +ret_code_t nrf_queue_push(nrf_queue_t const * p_queue, void const * p_element) +{ + ret_code_t status = NRF_SUCCESS; + + ASSERT(p_queue != NULL); + ASSERT(p_element != NULL); + + CRITICAL_REGION_ENTER(); + bool is_full = nrf_queue_is_full(p_queue); + + if (!is_full || (p_queue->mode == NRF_QUEUE_MODE_OVERFLOW)) + { + // Get write position. + size_t write_pos = p_queue->p_cb->back; + p_queue->p_cb->back = nrf_queue_next_idx(p_queue, p_queue->p_cb->back); + if (is_full) + { + // Overwrite the oldest element. + p_queue->p_cb->front = nrf_queue_next_idx(p_queue, p_queue->p_cb->front); + } + + // Write a new element. + switch (p_queue->element_size) + { + case sizeof(uint8_t): + ((uint8_t *)p_queue->p_buffer)[write_pos] = *((uint8_t *)p_element); + break; + + case sizeof(uint16_t): + ((uint16_t *)p_queue->p_buffer)[write_pos] = *((uint16_t *)p_element); + break; + + case sizeof(uint32_t): + ((uint32_t *)p_queue->p_buffer)[write_pos] = *((uint32_t *)p_element); + break; + + case sizeof(uint64_t): + ((uint64_t *)p_queue->p_buffer)[write_pos] = *((uint64_t *)p_element); + break; + + default: + memcpy((void *)((size_t)p_queue->p_buffer + write_pos * p_queue->element_size), + p_element, + p_queue->element_size); + break; + } + + // Update utilization. + size_t utilization = queue_utilization_get(p_queue); + if (p_queue->p_cb->max_utilization < utilization) + { + p_queue->p_cb->max_utilization = utilization; + } + } + else + { + status = NRF_ERROR_NO_MEM; + } + + CRITICAL_REGION_EXIT(); + + return status; +} + +ret_code_t nrf_queue_generic_pop(nrf_queue_t const * p_queue, + void * p_element, + bool just_peek) +{ + ret_code_t status = NRF_SUCCESS; + + ASSERT(p_queue != NULL); + ASSERT(p_element != NULL); + + CRITICAL_REGION_ENTER(); + + if (!nrf_queue_is_empty(p_queue)) + { + // Get read position. + size_t read_pos = p_queue->p_cb->front; + + // Update next read position. + if (!just_peek) + { + p_queue->p_cb->front = nrf_queue_next_idx(p_queue, p_queue->p_cb->front); + } + + // Read element. + switch (p_queue->element_size) + { + case sizeof(uint8_t): + *((uint8_t *)p_element) = ((uint8_t *)p_queue->p_buffer)[read_pos]; + break; + + case sizeof(uint16_t): + *((uint16_t *)p_element) = ((uint16_t *)p_queue->p_buffer)[read_pos]; + break; + + case sizeof(uint32_t): + *((uint32_t *)p_element) = ((uint32_t *)p_queue->p_buffer)[read_pos]; + break; + + case sizeof(uint64_t): + *((uint64_t *)p_element) = ((uint64_t *)p_queue->p_buffer)[read_pos]; + break; + + default: + memcpy(p_element, + (void const *)((size_t)p_queue->p_buffer + read_pos * p_queue->element_size), + p_queue->element_size); + break; + } + } + else + { + status = NRF_ERROR_NOT_FOUND; + } + + CRITICAL_REGION_EXIT(); + + return status; +} + +/**@brief Write elements to the queue. This function assumes that there is enough room in the queue + * to write the requested number of elements and that this process will not be interrupted. + * + * @param[in] p_queue Pointer to the nrf_queue_t instance. + * @param[in] p_data Pointer to the buffer with elements to write. + * @param[in] element_count Number of elements to write. + */ +static void queue_write(nrf_queue_t const * p_queue, void const * p_data, uint32_t element_count) +{ + size_t prev_available = nrf_queue_available_get(p_queue); + size_t continuous = p_queue->size + 1 - p_queue->p_cb->back; + void * p_write_ptr = (void *)((size_t)p_queue->p_buffer + + p_queue->p_cb->back * p_queue->element_size); + if (element_count <= continuous) + { + memcpy(p_write_ptr, + p_data, + element_count * p_queue->element_size); + + p_queue->p_cb->back = ((p_queue->p_cb->back + element_count) <= p_queue->size) + ? (p_queue->p_cb->back + element_count) + : 0; + } + else + { + size_t first_write_length = continuous * p_queue->element_size; + memcpy(p_write_ptr, + p_data, + first_write_length); + + size_t elements_left = element_count - continuous; + memcpy(p_queue->p_buffer, + (void const *)((size_t)p_data + first_write_length), + elements_left * p_queue->element_size); + + p_queue->p_cb->back = elements_left; + if (prev_available < element_count) + { + // Overwrite the oldest elements. + p_queue->p_cb->front = nrf_queue_next_idx(p_queue, p_queue->p_cb->back); + } + } + + // Update utilization. + size_t utilization = queue_utilization_get(p_queue); + if (p_queue->p_cb->max_utilization < utilization) + { + p_queue->p_cb->max_utilization = utilization; + } +} + +ret_code_t nrf_queue_write(nrf_queue_t const * p_queue, + void const * p_data, + size_t element_count) +{ + ret_code_t status = NRF_SUCCESS; + + ASSERT(p_queue != NULL); + ASSERT(p_data != NULL); + ASSERT(element_count <= p_queue->size); + + if (element_count == 0) + { + return NRF_SUCCESS; + } + + CRITICAL_REGION_ENTER(); + + if ((nrf_queue_available_get(p_queue) >= element_count) + || (p_queue->mode == NRF_QUEUE_MODE_OVERFLOW)) + { + queue_write(p_queue, p_data, element_count); + } + else + { + status = NRF_ERROR_NO_MEM; + } + + CRITICAL_REGION_EXIT(); + + return status; +} + + +size_t nrf_queue_in(nrf_queue_t const * p_queue, + void const * p_data, + size_t element_count) +{ + ASSERT(p_queue != NULL); + ASSERT(p_data != NULL); + + if (element_count == 0) + { + return 0; + } + + CRITICAL_REGION_ENTER(); + + if (p_queue->mode == NRF_QUEUE_MODE_OVERFLOW) + { + element_count = MIN(element_count, p_queue->size); + } + else + { + size_t available = nrf_queue_available_get(p_queue); + element_count = MIN(element_count, available); + } + + queue_write(p_queue, p_data, element_count); + + CRITICAL_REGION_EXIT(); + + return element_count; +} + +/**@brief Read elements from the queue. This function assumes that there are enough elements + * in the queue to read and that this process will not be interrupted. + * + * @param[in] p_queue Pointer to the nrf_queue_t instance. + * @param[out] p_data Pointer to the buffer where elements will be copied. + * @param[in] element_count Number of elements to read. + */ +static void queue_read(nrf_queue_t const * p_queue, void * p_data, uint32_t element_count) +{ + size_t continuous = (p_queue->p_cb->front <= p_queue->p_cb->back) + ? p_queue->p_cb->back - p_queue->p_cb->front + : p_queue->size + 1 - p_queue->p_cb->front; + void const * p_read_ptr = (void const *)((size_t)p_queue->p_buffer + + p_queue->p_cb->front * p_queue->element_size); + + if (element_count <= continuous) + { + memcpy(p_data, + p_read_ptr, + element_count * p_queue->element_size); + + p_queue->p_cb->front = ((p_queue->p_cb->front + element_count) <= p_queue->size) + ? (p_queue->p_cb->front + element_count) + : 0; + } + else + { + size_t first_read_length = continuous * p_queue->element_size; + memcpy(p_data, + p_read_ptr, + first_read_length); + + size_t elements_left = element_count - continuous; + memcpy((void *)((size_t)p_data + first_read_length), + p_queue->p_buffer, + elements_left * p_queue->element_size); + + p_queue->p_cb->front = elements_left; + } +} + +ret_code_t nrf_queue_read(nrf_queue_t const * p_queue, + void * p_data, + size_t element_count) +{ + ret_code_t status = NRF_SUCCESS; + + ASSERT(p_queue != NULL); + ASSERT(p_data != NULL); + + if (element_count == 0) + { + return NRF_SUCCESS; + } + + CRITICAL_REGION_ENTER(); + + if (element_count <= queue_utilization_get(p_queue)) + { + queue_read(p_queue, p_data, element_count); + } + else + { + status = NRF_ERROR_NOT_FOUND; + } + + CRITICAL_REGION_EXIT(); + + return status; +} + +size_t nrf_queue_out(nrf_queue_t const * p_queue, + void * p_data, + size_t element_count) +{ + ASSERT(p_queue != NULL); + ASSERT(p_data != NULL); + + if (element_count == 0) + { + return 0; + } + + CRITICAL_REGION_ENTER(); + + size_t utilization = queue_utilization_get(p_queue); + element_count = MIN(element_count, utilization); + + queue_read(p_queue, p_data, element_count); + + CRITICAL_REGION_EXIT(); + + return element_count; +} + +void nrf_queue_reset(nrf_queue_t const * p_queue) +{ + ASSERT(p_queue != NULL); + + CRITICAL_REGION_ENTER(); + + memset(p_queue->p_cb, 0, sizeof(nrf_queue_cb_t)); + + CRITICAL_REGION_EXIT(); +} + +size_t nrf_queue_utilization_get(nrf_queue_t const * p_queue) +{ + size_t utilization; + ASSERT(p_queue != NULL); + + CRITICAL_REGION_ENTER(); + + utilization = queue_utilization_get(p_queue); + + CRITICAL_REGION_EXIT(); + + return utilization; +} + +#endif // NRF_MODULE_ENABLED(NRF_QUEUE) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.h new file mode 100644 index 0000000000..e28b35b86c --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.h @@ -0,0 +1,374 @@ +/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + + +/** +* @defgroup nrf_queue Queue module +* @{ +* @ingroup app_common +* @brief Functions that handle the queue instances. +*/ + +#ifndef NRF_QUEUE_H__ +#define NRF_QUEUE_H__ + +#include +#include +#include +#include "nrf_assert.h" +#include "sdk_errors.h" +#include "app_util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Queue control block. */ +typedef struct +{ + size_t front; //!< Queue front index. + size_t back; //!< Queue back index. + size_t max_utilization; //!< Maximum utilization of the queue. +} nrf_queue_cb_t; + +/**@brief Supported queue modes. */ +typedef enum +{ + NRF_QUEUE_MODE_OVERFLOW, //!< If the queue is full, new element will not be accepted. + NRF_QUEUE_MODE_NO_OVERFLOW, //!< If the queue is full, new element will overwrite the oldest. +} nrf_queue_mode_t; + +/**@brief Instance of the queue. */ +typedef struct +{ + nrf_queue_cb_t * p_cb; //!< Pointer to the instance control block. + void * p_buffer; //!< Pointer to the memory that is used as storage. + size_t size; //!< Size of the queue. + size_t element_size; //!< Size of one element. + nrf_queue_mode_t mode; //!< Mode of the queue. +} nrf_queue_t; + +/**@brief Create a queue instance. + * + * @note This macro reserves memory for the given queue instance. + * + * @param[in] _type Type which is stored. + * @param[in] _name Name of the queue. + * @param[in] _size Size of the queue. + * @param[in] _mode Mode of the queue. + */ +#define NRF_QUEUE_DEF(_type, _name, _size, _mode) \ + static _type _name##_nrf_queue_buffer[(_size) + 1]; \ + static nrf_queue_cb_t _name##_nrf_queue_cb; \ + static const nrf_queue_t _name = \ + { \ + .p_cb = &_name##_nrf_queue_cb, \ + .p_buffer = _name##_nrf_queue_buffer, \ + .size = (_size), \ + .element_size = sizeof(_type), \ + .mode = _mode, \ + } + +/**@brief Declare a queue interface. + * + * @param[in] _type Type which is stored. + * @param[in] _name Name of the queue. + */ +#define NRF_QUEUE_INTERFACE_DEC(_type, _name) \ + ret_code_t _name##_push(_type const * p_element); \ + ret_code_t _name##_pop(_type * p_element); \ + ret_code_t _name##_peek(_type * p_element); \ + ret_code_t _name##_write(_type const * p_data, \ + size_t element_count); \ + ret_code_t _name##_read(_type * p_data, \ + size_t element_count); \ + size_t _name##_out(_type * p_data, \ + size_t element_count); \ + size_t _name##_in(_type const * p_data, \ + size_t element_count); \ + bool _name##_is_full(void); \ + bool _name##_is_empty(void); \ + size_t _name##_utilization_get(void); \ + size_t _name##_available_get(void); \ + size_t _name##_max_utilization_get(void); \ + void _name##_reset(void) + +/**@brief Define a custom queue interface. + * + * @param[in] _attr Function attribute that will be added to the queue function definition. + * @param[in] _type Type which is stored. + * @param[in] _name Name of the queue. + * @param[in] _p_queue Queue instance. + */ +#define NRF_QUEUE_INTERFACE_CUSTOM_DEF(_attr, _type, _name, _p_queue) \ + _attr ret_code_t _name##_push(_type const * p_element) \ + { \ + ASSERT((_p_queue) != NULL); \ + ASSERT((_p_queue)->element_size == sizeof(_type)); \ + return nrf_queue_push((_p_queue), p_element); \ + } \ + _attr ret_code_t _name##_pop(_type * p_element) \ + { \ + ASSERT((_p_queue) != NULL); \ + ASSERT((_p_queue)->element_size == sizeof(_type)); \ + return nrf_queue_pop((_p_queue), p_element); \ + } \ + _attr ret_code_t _name##_peek(_type * p_element) \ + { \ + ASSERT((_p_queue) != NULL); \ + ASSERT((_p_queue)->element_size == sizeof(_type)); \ + return nrf_queue_peek((_p_queue), p_element); \ + } \ + ret_code_t _name##_write(_type const * p_data, \ + size_t element_count) \ + { \ + ASSERT((_p_queue) != NULL); \ + ASSERT((_p_queue)->element_size == sizeof(_type)); \ + return nrf_queue_write((_p_queue), p_data, element_count); \ + } \ + ret_code_t _name##_read(_type * p_data, \ + size_t element_count) \ + { \ + ASSERT((_p_queue) != NULL); \ + ASSERT((_p_queue)->element_size == sizeof(_type)); \ + return nrf_queue_read((_p_queue), p_data, element_count); \ + } \ + size_t _name##_in(_type const * p_data, \ + size_t element_count) \ + { \ + ASSERT((_p_queue) != NULL); \ + ASSERT((_p_queue)->element_size == sizeof(_type)); \ + return nrf_queue_in((_p_queue), p_data, element_count); \ + } \ + size_t _name##_out(_type * p_data, \ + size_t element_count) \ + { \ + ASSERT((_p_queue) != NULL); \ + ASSERT((_p_queue)->element_size == sizeof(_type)); \ + return nrf_queue_out((_p_queue), p_data, element_count); \ + } \ + bool _name##_is_full(void) \ + { \ + ASSERT((_p_queue) != NULL); \ + return nrf_queue_is_full(_p_queue); \ + } \ + bool _name##_is_empty(void) \ + { \ + ASSERT((_p_queue) != NULL); \ + return nrf_queue_is_empty(_p_queue); \ + } \ + size_t _name##_utilization_get(void) \ + { \ + ASSERT((_p_queue) != NULL); \ + return nrf_queue_utilization_get(_p_queue); \ + } \ + size_t _name##_available_get(void) \ + { \ + ASSERT((_p_queue) != NULL); \ + return nrf_queue_available_get(_p_queue); \ + } \ + size_t _name##_max_utilization_get(void) \ + { \ + ASSERT((_p_queue) != NULL); \ + return nrf_queue_max_utilization_get(_p_queue); \ + } \ + void _name##_reset(void) \ + { \ + ASSERT((_p_queue) != NULL); \ + nrf_queue_reset(_p_queue); \ + } + +/**@brief Define a queue interface. + * + * @param[in] _type Type which is stored. + * @param[in] _name Name of the queue. + * @param[in] _p_queue Queue instance. + */ +#define NRF_QUEUE_INTERFACE_DEF(_type, _name, _p_queue) \ + NRF_QUEUE_INTERFACE_CUSTOM_DEF(/* empty */, _type, _name, _p_queue) + +/**@brief Define a local queue interface. + * + * @param[in] _type Type which is stored. + * @param[in] _name Name of the queue. + * @param[in] _p_queue Queue instance. + */ +#define NRF_QUEUE_INTERFACE_LOCAL_DEF(_type, _name, _p_queue) \ + NRF_QUEUE_INTERFACE_CUSTOM_DEF(static, _type, _name, _p_queue) + +/**@brief Function for pushing an element to the end of queue. + * + * @param[in] p_queue Pointer to the nrf_queue_t instance. + * @param[in] p_element Pointer to the element that will be stored in the queue. + * + * @return NRF_SUCCESS If an element has been successfully added. + * @return NRF_ERROR_NO_MEM If the queue is full (only in @ref NRF_QUEUE_MODE_NO_OVERFLOW). + */ +ret_code_t nrf_queue_push(nrf_queue_t const * p_queue, void const * p_element); + +/**@brief Generic pop implementation. + * + * @param[in] p_queue Pointer to the nrf_queue_t instance. + * @param[out] p_element Pointer where the element will be copied. + * @param[out] just_peek If true, the returned element will not be removed from queue. + * + * @return NRF_SUCCESS If an element was returned. + * @return NRF_ERROR_NOT_FOUND If there are no more elements in the queue. + */ +ret_code_t nrf_queue_generic_pop(nrf_queue_t const * p_queue, + void * p_element, + bool just_peek); + +/**@brief Pop element from the front of the queue. + * + * @param[in] _p_queue Pointer to the nrf_queue_t instance. + * @param[out] _p_element Pointer where the element will be copied. + * + * @return NRF_SUCCESS If an element was returned. + * @return NRF_ERROR_NOT_FOUND If there are no more elements in the queue. + */ +#define nrf_queue_pop(_p_queue, _p_element) nrf_queue_generic_pop((_p_queue), (_p_element), false) + +/**@brief Peek element from the front of the queue. + * + * @param[in] _p_queue Pointer to the nrf_queue_t instance. + * @param[out] _p_element Pointer where the element will be copied. + * + * @return NRF_SUCCESS If an element was returned. + * @return NRF_ERROR_NOT_FOUND If there are no more elements in the queue. + */ +#define nrf_queue_peek(_p_queue, _p_element) nrf_queue_generic_pop((_p_queue), (_p_element), true) + +/**@brief Function for writing elements to the queue. + * + * @param[in] p_queue Pointer to the nrf_queue_t instance. + * @param[in] p_data Pointer to the buffer with elements to write. + * @param[in] element_count Number of elements to write. + * + * @return NRF_SUCCESS If an element was written. + * @return NRF_ERROR_NO_MEM There is not enough space in the queue. No element was written. + */ +ret_code_t nrf_queue_write(nrf_queue_t const * p_queue, + void const * p_data, + size_t element_count); + +/**@brief Function for writing a portion of elements to the queue. + * + * @param[in] p_queue Pointer to the nrf_queue_t instance. + * @param[in] p_data Pointer to the buffer with elements to write. + * @param[in] element_count Number of elements to write. + * + * @return The number of added elements. + */ +size_t nrf_queue_in(nrf_queue_t const * p_queue, + void const * p_data, + size_t element_count); + +/**@brief Function for reading elements from the queue. + * + * @param[in] p_queue Pointer to the nrf_queue_t instance. + * @param[out] p_data Pointer to the buffer where elements will be copied. + * @param[in] element_count Number of elements to read. + * + * @return NRF_SUCCESS If an element was returned. + * @return NRF_ERROR_NOT_FOUND There is not enough elements in the queue. + */ +ret_code_t nrf_queue_read(nrf_queue_t const * p_queue, + void * p_data, + size_t element_count); + +/**@brief Function for reading a portion of elements from the queue. + * + * @param[in] p_queue Pointer to the nrf_queue_t instance. + * @param[out] p_data Pointer to the buffer where elements will be copied. + * @param[in] element_count Number of elements to read. + * + * @return The number of read elements. + */ +size_t nrf_queue_out(nrf_queue_t const * p_queue, + void * p_data, + size_t element_count); + +/**@brief Function for checking if the queue is full. + * + * @param[in] p_queue Pointer to the queue instance. + * + * @return True if the queue is full. + */ +bool nrf_queue_is_full(nrf_queue_t const * p_queue); + +/**@brief Function for checking if the queue is empty. + * + * @param[in] p_queue Pointer to the queue instance. + * + * @return True if the queue is empty. + */ +__STATIC_INLINE bool nrf_queue_is_empty(nrf_queue_t const * p_queue); + +/**@brief Function for getting the current queue utilization. + * + * @param[in] p_queue Pointer to the queue instance. + * + * @return Current queue utilization. + */ +size_t nrf_queue_utilization_get(nrf_queue_t const * p_queue); + +/**@brief Function for getting the size of available space. + * + * @param[in] p_queue Pointer to the queue instance. + * + * @return Size of available space. + */ +__STATIC_INLINE size_t nrf_queue_available_get(nrf_queue_t const * p_queue); + +/**@brief Function for getting the maximal queue utilization. + * + * @param[in] p_queue Pointer to the queue instance. + * + * @return Maximal queue utilization. + */ +__STATIC_INLINE size_t nrf_queue_max_utilization_get(nrf_queue_t const * p_queue); + +/**@brief Function for resetting the queue state. + * + * @param[in] p_queue Pointer to the queue instance. + */ +void nrf_queue_reset(nrf_queue_t const * p_queue); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE bool nrf_queue_is_empty(nrf_queue_t const * p_queue) +{ + ASSERT(p_queue != NULL); + return (p_queue->p_cb->front == p_queue->p_cb->back); +} + +__STATIC_INLINE size_t nrf_queue_available_get(nrf_queue_t const * p_queue) +{ + ASSERT(p_queue != NULL); + return p_queue->size - nrf_queue_utilization_get(p_queue); +} + +__STATIC_INLINE size_t nrf_queue_max_utilization_get(nrf_queue_t const * p_queue) +{ + ASSERT(p_queue != NULL); + return p_queue->p_cb->max_utilization; +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#ifdef __cplusplus +} +#endif + +#endif // NRF_QUEUE_H__ +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_function.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_function.h deleted file mode 100644 index 83ca8d6740..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_function.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef NRF_SVC_FUNCTION_H__ -#define NRF_SVC_FUNCTION_H__ - -#include -#include "section_vars.h" -#include "app_util.h" -#include "nrf_svci.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/** @brief Function to be called from an SVC handler. - * - * @warning The function prototype must be limited to a maximum of four arguments, due to the nature of SVC calls. - */ -typedef uint32_t (*nrf_svc_func_t)(); - -/** @brief Type holding the SVC number and the pointer to the corresponding function. - * - * Not that the function that is pointed to must not change version. - */ -typedef struct -{ - uint32_t svc_num; /**< Supervisor call number (actually 8-bit, padded for alignment). */ - uint32_t svci_num; /**< Supervisor call indirect number. */ - nrf_svc_func_t func_ptr; -} nrf_svc_func_reg_t; - - -// Verify that the size of nrf_svc_func_t is aligned. -STATIC_ASSERT(sizeof(nrf_svc_func_reg_t) % 4 == 0); - - -/** @brief Macro for registering a structure holding SVC number and function pointer. - * - * @details This macro places the variable in a section named "svc_data" that - the SVC handler uses during regular operation. - */ -#define SVC_REGISTER_FUNCTION(svc_var) NRF_SECTION_VARS_ADD(svc_data, svc_var) - - -#ifdef __cplusplus -} -#endif - -#endif // NRF_SVC_FUNCTION_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_handler.c deleted file mode 100644 index 8d21e9bd85..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svc_handler.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include "nrf_svc_function.h" -#include "nrf_error.h" - -#include "nrf_log.h" - - - //lint -save -e19 -e526 -NRF_SECTION_VARS_CREATE_SECTION(svc_data, const nrf_svc_func_t); -//lint -restore - - -#define SVC_DATA_SECTION_VARS_GET(i) NRF_SECTION_VARS_GET((i), nrf_svc_func_reg_t, svc_data) -#define SVC_DATA_SECTION_VARS_COUNT NRF_SECTION_VARS_COUNT(nrf_svc_func_reg_t, svc_data) - - -/**@brief Function for handling second stage of SuperVisor Calls (SVC). -* -* @details The function will use loop through the registered svc functions stored -* in the named section "svc_data" and will call the registered function -* if the svn_num corresponds with the registration. -* -* @param[in] svc_num SVC number for function to be executed -* @param[in] p_svc_args Argument list for the SVC. -* -* @return This function returns by updating p_svc_arsg[0]. This will be reported back to the caller of SVC -* @ref NRF_ERROR_SVC_HANDLER_MISSING is returned if no SVC handler is implemented for the -* provided svc_num. -*/ -void nrf_svc_handler_c(uint8_t svc_num, uint32_t * p_svc_args) -{ - uint32_t const num_funcs = SVC_DATA_SECTION_VARS_COUNT; - bool handled = false; - uint32_t svci_num = NRF_SVCI_SVC_NUM_INVALID; - - if(svc_num == NRF_SVCI_SVC_NUM) - { - /* load the stacked R12 as the svci_num */ - svci_num = p_svc_args[4]; - } - - for (int i = 0; i < num_funcs; i++) - { - nrf_svc_func_reg_t const * func_reg = SVC_DATA_SECTION_VARS_GET(i); - if (func_reg->svc_num != svc_num) - { - continue; - } - - if(svci_num != NRF_SVCI_SVC_NUM_INVALID && func_reg->svci_num != svci_num) - { - continue; - } - - p_svc_args[0] = func_reg->func_ptr(p_svc_args[0], p_svc_args[1], p_svc_args[2], p_svc_args[3]); - handled = true; - } - - if (handled == false) - { - p_svc_args[0] = NRF_ERROR_SVC_HANDLER_MISSING; - } -} - -/**@brief Function for handling the first stage of SuperVisor Calls (SVC) in assembly. -* -* @details The function will use the link register (LR) to determine the stack (PSP or MSP) to be -* used and then decode the SVC number afterwards. After decoding the SVC number then -* @ref C_SVC_Handler is called for further processing of the SVC. -*/ -#if defined ( __CC_ARM ) -__ASM void SVC_Handler(void) -{ -EXC_RETURN_CMD_PSP EQU 0xFFFFFFFD ; EXC_RETURN using PSP for ARM Cortex.If Link register contains this value it indicates the PSP was used before the SVC, otherwise the MSP was used. - - IMPORT nrf_svc_handler_c - LDR R0, =EXC_RETURN_CMD_PSP ; Load the EXC_RETURN into R0 to be able to compare against LR to determine stack pointer used. - CMP R0, LR ; Compare the link register with R0.If equal then PSP was used, otherwise MSP was used before SVC. - BNE UseMSP ; Branch to code fetching SVC arguments using MSP. - MRS R1, PSP ; Move PSP into R1. - B Call_nrf_svc_handler_c ; Branch to call_nrf_svc_handler_c below. -UseMSP ; - MRS R1, MSP ; MSP was used, therefore Move MSP into R1. -Call_nrf_svc_handler_c ; - LDR R0, [R1, #24] ; The arguments for the SVC was stacked.R1 contains Stack Pointer, the values stacked before SVC are R0, R1, R2, R3, R12, LR, PC(Return address), xPSR. - ; R1 contains current SP so the PC of the stacked frame is at SP + 6 words(24 bytes).We load the PC into R0. - SUBS R0, #2 ; The PC before the SVC is in R0.We subtract 2 to get the address prior to the instruction executed where the SVC number is located. - LDRB R0, [R0] ; SVC instruction low octet : Load the byte at the address before the PC to fetch the SVC number. - LDR R2, =nrf_svc_handler_c ; Load address of C implementation of SVC handler. - BX R2 ; Branch to C implementation of SVC handler.R0 is now the SVC number, R1 is the StackPointer where the arguments(R0 - R3) of the original SVC are located. - ALIGN -} -#elif defined ( __GNUC__ ) -void __attribute__((naked)) SVC_Handler(void) -{ - const uint32_t exc_return = 0xFFFFFFFD; // EXC_RETURN using PSP for ARM Cortex. If Link register contains this value it indicates the PSP was used before the SVC, otherwise the MSP was used. - - __ASM volatile( - "cmp lr, %0\t\n" // Compare the link register with argument 0 (%0), which is exc_return. If equal then PSP was used, otherwise MSP was used before SVC. - "bne UseMSP\t\n" // Branch to code fetching SVC arguments using MSP. - "mrs r1, psp\t\n" // Move PSP into R1. - "b Call_nrf_svc_handler_c\t\n" // Branch to Call_nrf_svc_handler_c below. - "UseMSP:\t\n" // - "mrs r1, msp\t\n" // MSP was used, therefore Move MSP into R1. - "Call_nrf_svc_handler_c:\t\n" // - "ldr r0, [r1, #24]\t\n" // The arguments for the SVC was stacked. R1 contains Stack Pointer, the values stacked before SVC are R0, R1, R2, R3, R12, LR, PC (Return address), xPSR. - // R1 contains current SP so the PC of the stacked frame is at SP + 6 words (24 bytes). We load the PC into R0. - "sub r0, r0, #2\t\n" // The PC before the SVC is in R0. We subtract 2 to get the address prior to the instruction executed where the SVC number is located. - "ldrb r0, [r0]\t\n" // SVC instruction low octet: Load the byte at the address before the PC to fetch the SVC number. - "bx %1\t\n" // Branch to C implementation of SVC handler, argument 1 (%1). R0 is now the SVC number, R1 is the StackPointer where the arguments (R0-R3) of the original SVC are located. - ".align\t\n" // - :: "r" (exc_return), "r" (nrf_svc_handler_c) // Argument list for the gcc assembly. exc_return is %0, nrf_svc_handler_c is %1. - : "r0", "r1" // List of register maintained manually. - ); -} -#elif defined ( __ICCARM__ ) -void SVC_Handler(void) -{ - __ASM("movs r0, #0x02\n" // Load 0x02 into R6 to prepare for exec return test. - "mvns r0, r0\n" // Invert R0 to obtain exec return code using PSP for ARM Cortex. - "cmp lr, r0\n" // Compare the link register with argument 0 (%0), which is exc_return. If equal then PSP was used, otherwise MSP was used before SVC. - "bne.n UseMSP\n" // Branch to code fetching SVC arguments using MSP. - "mrs r1, psp\n" // Move PSP into R1. - "b.n Call_nrf_svc_handler_c\t\n" // Branch to Call_nrf_svc_handler_c below. - "UseMSP: \n" // - "mrs r1, msp\n" // MSP was used, therefore Move MSP into R1. - "Call_nrf_svc_handler_c: \n" // - "ldr r0, [r1, #24]\n" // The arguments for the SVC was stacked. R1 contains Stack Pointer, the values stacked before SVC are R0, R1, R2, R3, R12, LR, PC (Return address), xPSR. - // R1 contains current SP so the PC of the stacked frame is at SP + 6 words (24 bytes). We load the PC into R0. - "subs r0, #0x02\n" // The PC before the SVC is in R0. We subtract 2 to get the address prior to the instruction executed where the SVC number is located. - "ldrb r0, [r0]\n" // SVC instruction low octet: Load the byte at the address before the PC to fetch the SVC number. - "bx %0\n" // Branch to C implementation of SVC handler, argument 1 (%1). R0 is now the SVC number, R1 is the StackPointer where the arguments (R0-R3) of the original SVC are located. - :: "r" (nrf_svc_handler_c) // Argument list for the gcc assembly. nrf_svc_handler_c is %0. - : "r0", "r1" // List of register maintained manually. - ); -} -#else - -#error Compiler not supported. - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svci.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svci.h deleted file mode 100644 index ed62f084ee..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/svc/nrf_svci.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef NRF_SVCI_H__ -#define NRF_SVCI_H__ - -#include "stdint.h" -#include "compiler_abstraction.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define NRF_SVCI_SVC_NUM 0 /**< SVC number used for all SVCI functions. */ -#define NRF_SVCI_SVC_NUM_INVALID (0xFFFFFFFF) /**< Invalid SVCI number. */ - - -#if defined (__CC_ARM) - - #define SVCI_DECL(svci_num, return_type, function_name, ...) \ - return_type __svc_indirect(NRF_SVCI_SVC_NUM) svci_##function_name(uint32_t _svci_num, ##__VA_ARGS__); - -#elif defined (__GNUC__) - - #ifdef __cplusplus - #define GCC_CAST_CPP (uint8_t) - #else - #define GCC_CAST_CPP - #endif - - #define SVCI_DECL(svci_num, return_type, function_name, ...) \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ - __attribute__((naked, unused)) \ - static return_type function_name(uint32_t svci_num, \ - __VA_ARGS__) \ - { \ - __asm __volatile ( \ - "mov r12, %1\n\t" \ - "svc %0\n\t" \ - "bx r14\n\t" \ - : /* no output */ \ - : "I" (GCC_CAST_CPP NRF_SVCI_SVC_NUM), "r" (svci_num) \ - : "r12" /* do we need to clobber? */ \ - ); \ - } \ - _Pragma("GCC diagnostic pop") - -#elif defined (__ICCARM__) - - #define SVCI_DECL(svci_num, return_type, function_name, ...) \ - /* Suppress return value warming. */ \ - _Pragma("diag_suppress=Pe940") \ - static return_type function_name(uint32_t svci_num, \ - __VA_ARGS__) \ - { \ - __asm volatile ( \ - "mov r12, %1\n\t" \ - "svc %0\n\t" \ - "bx r14\n\t" \ - : /* no output */ \ - : "I" (NRF_SVCI_SVC_NUM), "r" (svci_num) \ - : "r12" /* do we need to clobber? */ \ - ); \ - } - -#else - - #define SVCI_DECL(svci_number, return_type, function_name, ...) - -#endif - -#define VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, N, ...) N -#define VA_NARGS(...) VA_NARGS_IMPL(__VA_ARGS__, 4, 4, 3, 3, 2, 2, 1, 1, 0) - -#ifdef SVC_INTERFACE_CALL_AS_NORMAL_FUNCTION - -#define SVCI_0(svci_num, return_type, function_name) \ - return_type function_name(void) -#define SVCI_1(svci_num, return_type, function_name, p0t, p0n) \ - return_type function_name(p0t p0n) -#define SVCI_2(svci_num, return_type, function_name, p0t, p0n, p1t, p1n) \ - return_type function_name(p0t p0n, p1t p1n) -#define SVCI_3(svci_num, return_type, function_name, p0t, p0n, p1t, p1n, p2t, p2n) \ - return_type function_name(p0t p0n, p1t p1n, p2t p2n) -#define SVCI_4(svci_num, return_type, function_name, p0t, p0n, p1t, p1n, p2t, p2n, p3t, p3n) \ - return_type function_name(p0t p0n, p1t p1n, p2t p2n, p3t p3n) - -#else - -#define SVCI_0(svci_num, return_type, function_name) \ - SVCI_DECL(svci_num, return_type, function_name) \ - static __INLINE return_type function_name(void) {return svci_##function_name(svci_num);} - -#define SVCI_1(svci_num, return_type, function_name, p0t, p0n) \ - SVCI_DECL(svci_num, return_type, function_name, p0t p0n) \ - static __INLINE return_type function_name(p0t p0n) {return svci_##function_name(svci_num, p0n);} - -#define SVCI_2(svci_num, return_type, function_name, p0t, p0n, p1t, p1n) \ - SVCI_DECL(svci_num, return_type, function_name, p0t p0n, p1t p1n) \ - static __INLINE return_type function_name(p0t p0n, p1t p1n) {return svci_##function_name(svci_num, p0n, p1n);} - -#define SVCI_3(svci_num, return_type, function_name, p0t, p0n, p1t, p1n, p2t, p2n) \ - SVCI_DECL(svci_num, return_type, function_name, p0t p0n, p1t p1n, p2t p2n) \ - static __INLINE return_type function_name(p0t p0n, p1t p1n, p2t p2n) {return svci_##function_name(svci_num, p0n, p1n, p2n);} - -#define SVCI_4(svci_num, return_type, function_name, p0t, p0n, p1t, p1n, p2t, p2n, p3t, p3n) \ - SVCI_DECL(svci_num, return_type, function_name, p0t p0n, p1t p1n, p2t p2n, p3t p3n) \ - static __INLINE return_type function_name(p0t p0n, p1t p1n, p2t p2n, p3t p3n) {return svci_##function_name(svci_num, p0n, p1n, p2n, p3n);} - -#endif // SVCALL_AS_NORMAL_FUNCTION - -#define SVCI_IMPLI(count, svci_num, return_type, function_name, ...) SVCI##_##count (svci_num, return_type, function_name, ##__VA_ARGS__) -#define SVCI_IMPL(count, svci_num, return_type, function_name, ...) SVCI_IMPLI(count, svci_num, return_type, function_name, ##__VA_ARGS__) -#define SVCI(svci_num, return_type, function_name, ...) SVCI_IMPL(VA_NARGS(__VA_ARGS__), svci_num, return_type, function_name, ##__VA_ARGS__) - - - -#ifdef __cplusplus -} -#endif - -#endif // NRF_SVCI_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c new file mode 100644 index 0000000000..057e5fb34f --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c @@ -0,0 +1,1050 @@ +/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(APP_TIMER) +#include "app_timer.h" +#include +#include "nrf.h" +#include "nrf_soc.h" +#include "app_error.h" +#include "nrf_delay.h" +#include "app_util_platform.h" + +#define RTC1_IRQ_PRI APP_IRQ_PRIORITY_LOWEST /**< Priority of the RTC1 interrupt (used for checking for timeouts and executing timeout handlers). */ +#define SWI_IRQ_PRI APP_IRQ_PRIORITY_LOWEST /**< Priority of the SWI interrupt (used for updating the timer list). */ + +// The current design assumes that both interrupt handlers run at the same interrupt level. +// If this is to be changed, protection must be added to prevent them from interrupting each other +// (e.g. by using guard/trigger flags). +STATIC_ASSERT(RTC1_IRQ_PRI == SWI_IRQ_PRI); + +#define MAX_RTC_COUNTER_VAL 0x00FFFFFF /**< Maximum value of the RTC counter. */ + +#define RTC_COMPARE_OFFSET_MIN 3 /**< Minimum offset between the current RTC counter value and the Capture Compare register. Although the nRF51 Series User Specification recommends this value to be 2, we use 3 to be safer.*/ + +#define MAX_RTC_TASKS_DELAY 47 /**< Maximum delay until an RTC task is executed. */ + +#define SWI_IRQn SWI0_IRQn +#define SWI_IRQHandler SWI0_IRQHandler + +#define MODULE_INITIALIZED (m_op_queue.p_user_op_queue != NULL) /**< Macro designating whether the module has been initialized properly. */ + +/**@brief Timer node type. The nodes will be used form a linked list of running timers. */ +typedef struct +{ + uint32_t ticks_to_expire; /**< Number of ticks from previous timer interrupt to timer expiry. */ + uint32_t ticks_at_start; /**< Current RTC counter value when the timer was started. */ + uint32_t ticks_first_interval; /**< Number of ticks in the first timer interval. */ + uint32_t ticks_periodic_interval; /**< Timer period (for repeating timers). */ + bool is_running; /**< True if timer is running, False otherwise. */ + app_timer_mode_t mode; /**< Timer mode. */ + app_timer_timeout_handler_t p_timeout_handler; /**< Pointer to function to be executed when the timer expires. */ + void * p_context; /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */ + void * next; /**< Pointer to the next node. */ +} timer_node_t; + +STATIC_ASSERT(sizeof(timer_node_t) == APP_TIMER_NODE_SIZE); + +/**@brief Set of available timer operation types. */ +typedef enum +{ + TIMER_USER_OP_TYPE_NONE, /**< Invalid timer operation type. */ + TIMER_USER_OP_TYPE_START, /**< Timer operation type Start. */ + TIMER_USER_OP_TYPE_STOP, /**< Timer operation type Stop. */ + TIMER_USER_OP_TYPE_STOP_ALL /**< Timer operation type Stop All. */ +} timer_user_op_type_t; + +/**@brief Structure describing a timer start operation. */ +typedef struct +{ + uint32_t ticks_at_start; /**< Current RTC counter value when the timer was started. */ + uint32_t ticks_first_interval; /**< Number of ticks in the first timer interval. */ + uint32_t ticks_periodic_interval; /**< Timer period (for repeating timers). */ + void * p_context; /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */ +} timer_user_op_start_t; + +/**@brief Structure describing a timer operation. */ +typedef struct +{ + timer_user_op_type_t op_type; /**< Id of timer on which the operation is to be performed. */ + timer_node_t * p_node; + union + { + timer_user_op_start_t start; /**< Structure describing a timer start operation. */ + } params; +} timer_user_op_t; + +STATIC_ASSERT(sizeof(timer_user_op_t) <= APP_TIMER_USER_OP_SIZE); +STATIC_ASSERT(sizeof(timer_user_op_t) % 4 == 0); + +/**@brief Structure describing a timer operations queue. + * + * @details This queue will hold timer operations issued by the application + * until the timer interrupt handler processes these operations. + */ +typedef struct +{ + uint8_t first; /**< Index of first entry to have been inserted in the queue (i.e. the next entry to be executed). */ + uint8_t last; /**< Index of last entry to have been inserted in the queue. */ + uint8_t size; /**< Queue size. */ + timer_user_op_t * p_user_op_queue; /**< Queue buffer. */ +} timer_op_queue_t; + +STATIC_ASSERT(sizeof(timer_op_queue_t) % 4 == 0); + +#define CONTEXT_QUEUE_SIZE_MAX (2) + +static timer_op_queue_t m_op_queue; /**< Timer operations queue. */ +static timer_node_t * mp_timer_id_head; /**< First timer in list of running timers. */ +static uint32_t m_ticks_latest; /**< Last known RTC counter value. */ +static uint32_t m_ticks_elapsed[CONTEXT_QUEUE_SIZE_MAX]; /**< Timer internal elapsed ticks queue. */ +static uint8_t m_ticks_elapsed_q_read_ind; /**< Timer internal elapsed ticks queue read index. */ +static uint8_t m_ticks_elapsed_q_write_ind; /**< Timer internal elapsed ticks queue write index. */ +static app_timer_evt_schedule_func_t m_evt_schedule_func; /**< Pointer to function for propagating timeout events to the scheduler. */ +static bool m_rtc1_running; /**< Boolean indicating if RTC1 is running. */ +static bool m_rtc1_reset; /**< Boolean indicating if RTC1 counter has been reset due to last timer removed from timer list during the timer list handling. */ + +#if APP_TIMER_WITH_PROFILER +static uint8_t m_max_user_op_queue_utilization; /**< Maximum observed timer user operations queue utilization. */ +#endif + +/**@brief Function for initializing the RTC1 counter. + * + * @param[in] prescaler Value of the RTC1 PRESCALER register. Set to 0 for no prescaling. + */ +static void rtc1_init(uint32_t prescaler) +{ + NRF_RTC1->PRESCALER = prescaler; + NVIC_SetPriority(RTC1_IRQn, RTC1_IRQ_PRI); +} + + +/**@brief Function for starting the RTC1 timer. + */ +static void rtc1_start(void) +{ + NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE0_Msk; + NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE0_Msk; + + NVIC_ClearPendingIRQ(RTC1_IRQn); + NVIC_EnableIRQ(RTC1_IRQn); + + NRF_RTC1->TASKS_START = 1; + nrf_delay_us(MAX_RTC_TASKS_DELAY); + + m_rtc1_running = true; +} + + +/**@brief Function for stopping the RTC1 timer. + */ +static void rtc1_stop(void) +{ + NVIC_DisableIRQ(RTC1_IRQn); + + NRF_RTC1->EVTENCLR = RTC_EVTEN_COMPARE0_Msk; + NRF_RTC1->INTENCLR = RTC_INTENSET_COMPARE0_Msk; + + NRF_RTC1->TASKS_STOP = 1; + nrf_delay_us(MAX_RTC_TASKS_DELAY); + + NRF_RTC1->TASKS_CLEAR = 1; + m_ticks_latest = 0; + nrf_delay_us(MAX_RTC_TASKS_DELAY); + + m_rtc1_running = false; +} + + +/**@brief Function for returning the current value of the RTC1 counter. + * + * @return Current value of the RTC1 counter. + */ +static __INLINE uint32_t rtc1_counter_get(void) +{ + return NRF_RTC1->COUNTER; +} + + +/**@brief Function for computing the difference between two RTC1 counter values. + * + * @return Number of ticks elapsed from ticks_old to ticks_now. + */ +static __INLINE uint32_t ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old) +{ + return ((ticks_now - ticks_old) & MAX_RTC_COUNTER_VAL); +} + + +/**@brief Function for setting the RTC1 Capture Compare register 0, and enabling the corresponding + * event. + * + * @param[in] value New value of Capture Compare register 0. + */ +static __INLINE void rtc1_compare0_set(uint32_t value) +{ + NRF_RTC1->CC[0] = value; +} + + +/**@brief Function for inserting a timer in the timer list. + * + * @param[in] timer_id Id of timer to insert. + */ +static void timer_list_insert(timer_node_t * p_timer) +{ + if (mp_timer_id_head == NULL) + { + mp_timer_id_head = p_timer; + } + else + { + if (p_timer->ticks_to_expire <= mp_timer_id_head->ticks_to_expire) + { + mp_timer_id_head->ticks_to_expire -= p_timer->ticks_to_expire; + + p_timer->next = mp_timer_id_head; + mp_timer_id_head = p_timer; + } + else + { + timer_node_t * p_previous; + timer_node_t * p_current; + uint32_t ticks_to_expire; + + ticks_to_expire = p_timer->ticks_to_expire; + p_previous = mp_timer_id_head; + p_current = mp_timer_id_head; + + while ((p_current != NULL) && (ticks_to_expire > p_current->ticks_to_expire)) + { + ticks_to_expire -= p_current->ticks_to_expire; + p_previous = p_current; + p_current = p_current->next; + } + + if (p_current != NULL) + { + p_current->ticks_to_expire -= ticks_to_expire; + } + + p_timer->ticks_to_expire = ticks_to_expire; + p_timer->next = p_current; + p_previous->next = p_timer; + } + } +} + + +/**@brief Function for removing a timer from the timer queue. + * + * @param[in] timer_id Id of timer to remove. + */ +static void timer_list_remove(timer_node_t * p_timer) +{ + timer_node_t * p_previous; + timer_node_t * p_current; + uint32_t timeout; + + // Find the timer's position in timer list. + p_previous = mp_timer_id_head; + p_current = p_previous; + + while (p_current != NULL) + { + if (p_current == p_timer) + { + break; + } + p_previous = p_current; + p_current = p_current->next; + } + + // Timer not in active list. + if (p_current == NULL) + { + return; + } + + // Timer is the first in the list + if (p_previous == p_current) + { + mp_timer_id_head = mp_timer_id_head->next; + + // No more timers in the list. Reset RTC1 in case Start timer operations are present in the queue. + if (mp_timer_id_head == NULL) + { + NRF_RTC1->TASKS_CLEAR = 1; + m_ticks_latest = 0; + m_rtc1_reset = true; + } + } + + // Remaining timeout between next timeout. + timeout = p_current->ticks_to_expire; + + // Link previous timer with next of this timer, i.e. removing the timer from list. + p_previous->next = p_current->next; + + // If this is not the last timer, increment the next timer by this timer timeout. + p_current = p_previous->next; + if (p_current != NULL) + { + p_current->ticks_to_expire += timeout; + } +} + + +/**@brief Function for scheduling a check for timeouts by generating a RTC1 interrupt. + */ +static void timer_timeouts_check_sched(void) +{ + NVIC_SetPendingIRQ(RTC1_IRQn); +} + + +/**@brief Function for scheduling a timer list update by generating a SWI interrupt. + */ +static void timer_list_handler_sched(void) +{ + NVIC_SetPendingIRQ(SWI_IRQn); +} + + +/**@brief Function for executing an application timeout handler, either by calling it directly, or + * by passing an event to the @ref app_scheduler. + * + * @param[in] p_timer Pointer to expired timer. + */ +static void timeout_handler_exec(timer_node_t * p_timer) +{ + if (m_evt_schedule_func != NULL) + { + uint32_t err_code = m_evt_schedule_func(p_timer->p_timeout_handler, p_timer->p_context); + APP_ERROR_CHECK(err_code); + } + else + { + p_timer->p_timeout_handler(p_timer->p_context); + } +} + + +/**@brief Function for checking for expired timers. + */ +static void timer_timeouts_check(void) +{ + // Handle expired of timer + if (mp_timer_id_head != NULL) + { + timer_node_t * p_timer; + timer_node_t * p_previous_timer; + uint32_t ticks_elapsed; + uint32_t ticks_expired; + + // Initialize actual elapsed ticks being consumed to 0. + ticks_expired = 0; + + // ticks_elapsed is collected here, job will use it. + ticks_elapsed = ticks_diff_get(rtc1_counter_get(), m_ticks_latest); + + // Auto variable containing the head of timers expiring. + p_timer = mp_timer_id_head; + + // Expire all timers within ticks_elapsed and collect ticks_expired. + while (p_timer != NULL) + { + // Do nothing if timer did not expire. + if (ticks_elapsed < p_timer->ticks_to_expire) + { + break; + } + + // Decrement ticks_elapsed and collect expired ticks. + ticks_elapsed -= p_timer->ticks_to_expire; + ticks_expired += p_timer->ticks_to_expire; + + // Move to next timer. + p_previous_timer = p_timer; + p_timer = p_timer->next; + + // Execute Task. + if (p_previous_timer->is_running) + { + p_previous_timer->is_running = false; + timeout_handler_exec(p_previous_timer); + } + } + + // Prepare to queue the ticks expired in the m_ticks_elapsed queue. + if (m_ticks_elapsed_q_read_ind == m_ticks_elapsed_q_write_ind) + { + // The read index of the queue is equal to the write index. This means the new + // value of ticks_expired should be stored at a new location in the m_ticks_elapsed + // queue (which is implemented as a double buffer). + + // Check if there will be a queue overflow. + if (++m_ticks_elapsed_q_write_ind == CONTEXT_QUEUE_SIZE_MAX) + { + // There will be a queue overflow. Hence the write index should point to the start + // of the queue. + m_ticks_elapsed_q_write_ind = 0; + } + } + + // Queue the ticks expired. + m_ticks_elapsed[m_ticks_elapsed_q_write_ind] = ticks_expired; + + timer_list_handler_sched(); + } +} + + +/**@brief Function for acquiring the number of ticks elapsed. + * + * @param[out] p_ticks_elapsed Number of ticks elapsed. + * + * @return TRUE if elapsed ticks was read from queue, FALSE otherwise. + */ +static bool elapsed_ticks_acquire(uint32_t * p_ticks_elapsed) +{ + // Pick the elapsed value from queue. + if (m_ticks_elapsed_q_read_ind != m_ticks_elapsed_q_write_ind) + { + // Dequeue elapsed value. + m_ticks_elapsed_q_read_ind++; + if (m_ticks_elapsed_q_read_ind == CONTEXT_QUEUE_SIZE_MAX) + { + m_ticks_elapsed_q_read_ind = 0; + } + + *p_ticks_elapsed = m_ticks_elapsed[m_ticks_elapsed_q_read_ind]; + + m_ticks_latest += *p_ticks_elapsed; + m_ticks_latest &= MAX_RTC_COUNTER_VAL; + + return true; + } + else + { + // No elapsed value in queue. + *p_ticks_elapsed = 0; + return false; + } +} + + +/**@brief Function for handling the timer list deletions. + * + * @return TRUE if Capture Compare register must be updated, FALSE otherwise. + */ +static bool list_deletions_handler(void) +{ + timer_node_t * p_timer_old_head; + uint8_t user_ops_first = m_op_queue.first; + + // Remember the old head, so as to decide if new compare needs to be set. + p_timer_old_head = mp_timer_id_head; + + while (user_ops_first != m_op_queue.last) + { + timer_user_op_t * p_user_op = &m_op_queue.p_user_op_queue[user_ops_first]; + + // Traverse to next operation in queue. + user_ops_first++; + if (user_ops_first == m_op_queue.size) + { + user_ops_first = 0; + } + + switch (p_user_op->op_type) + { + case TIMER_USER_OP_TYPE_STOP: + // Delete node if timer is running. + timer_list_remove(p_user_op->p_node); + break; + + case TIMER_USER_OP_TYPE_STOP_ALL: + // Delete list of running timers, and mark all timers as not running. + while (mp_timer_id_head != NULL) + { + timer_node_t * p_head = mp_timer_id_head; + + p_head->is_running = false; + mp_timer_id_head = p_head->next; + } + break; + + default: + // No implementation needed. + break; + } + } + + // Detect change in head of the list. + return (mp_timer_id_head != p_timer_old_head); +} + + +/**@brief Function for updating the timer list for expired timers. + * + * @param[in] ticks_elapsed Number of elapsed ticks. + * @param[in] ticks_previous Previous known value of the RTC counter. + * @param[out] p_restart_list_head List of repeating timers to be restarted. + */ +static void expired_timers_handler(uint32_t ticks_elapsed, + uint32_t ticks_previous, + timer_node_t ** p_restart_list_head) +{ + uint32_t ticks_expired = 0; + + while (mp_timer_id_head != NULL) + { + timer_node_t * p_timer; + timer_node_t * p_timer_expired; + + // Auto variable for current timer node. + p_timer = mp_timer_id_head; + + // Do nothing if timer did not expire + if (ticks_elapsed < p_timer->ticks_to_expire) + { + p_timer->ticks_to_expire -= ticks_elapsed; + break; + } + + // Decrement ticks_elapsed and collect expired ticks. + ticks_elapsed -= p_timer->ticks_to_expire; + ticks_expired += p_timer->ticks_to_expire; + + // Timer expired, set ticks_to_expire zero. + p_timer->ticks_to_expire = 0; + + // Remove the expired timer from head. + p_timer_expired = mp_timer_id_head; + mp_timer_id_head = p_timer->next; + + // Timer will be restarted if periodic. + if (p_timer->ticks_periodic_interval != 0) + { + p_timer->ticks_at_start = (ticks_previous + ticks_expired) & MAX_RTC_COUNTER_VAL; + p_timer->ticks_first_interval = p_timer->ticks_periodic_interval; + p_timer->next = *p_restart_list_head; + *p_restart_list_head = p_timer_expired; + } + } +} + + +/**@brief Function for handling timer list insertions. + * + * @param[in] p_restart_list_head List of repeating timers to be restarted. + * + * @return TRUE if Capture Compare register must be updated, FALSE otherwise. + */ +static bool list_insertions_handler(timer_node_t * p_restart_list_head) +{ + timer_node_t * p_timer_id_old_head; + + // Remember the old head, so as to decide if new compare needs to be set. + p_timer_id_old_head = mp_timer_id_head; + + // Handle insertions of timers. + while ((p_restart_list_head != NULL) || (m_op_queue.first != m_op_queue.last)) + { + timer_node_t * p_timer; + + if (p_restart_list_head != NULL) + { + p_timer = p_restart_list_head; + p_restart_list_head = p_timer->next; + } + else + { + timer_user_op_t * p_user_op = &m_op_queue.p_user_op_queue[m_op_queue.first]; + + m_op_queue.first++; + if (m_op_queue.first == m_op_queue.size) + { + m_op_queue.first = 0; + } + + p_timer = p_user_op->p_node; + + if ((p_user_op->op_type != TIMER_USER_OP_TYPE_START) || p_timer->is_running) + { + continue; + } + + p_timer->ticks_at_start = p_user_op->params.start.ticks_at_start; + p_timer->ticks_first_interval = p_user_op->params.start.ticks_first_interval; + p_timer->ticks_periodic_interval = p_user_op->params.start.ticks_periodic_interval; + p_timer->p_context = p_user_op->params.start.p_context; + + if (m_rtc1_reset) + { + p_timer->ticks_at_start = 0; + } + } + + // Prepare the node to be inserted. + if ( + ((p_timer->ticks_at_start - m_ticks_latest) & MAX_RTC_COUNTER_VAL) + < + (MAX_RTC_COUNTER_VAL / 2) + ) + { + p_timer->ticks_to_expire = ticks_diff_get(p_timer->ticks_at_start, m_ticks_latest) + + p_timer->ticks_first_interval; + } + else + { + uint32_t delta_current_start; + + delta_current_start = ticks_diff_get(m_ticks_latest, p_timer->ticks_at_start); + if (p_timer->ticks_first_interval > delta_current_start) + { + p_timer->ticks_to_expire = p_timer->ticks_first_interval - delta_current_start; + } + else + { + p_timer->ticks_to_expire = 0; + } + } + + p_timer->ticks_at_start = 0; + p_timer->ticks_first_interval = 0; + p_timer->is_running = true; + p_timer->next = NULL; + + // Insert into list + timer_list_insert(p_timer); + } + + return (mp_timer_id_head != p_timer_id_old_head); +} + + +/**@brief Function for updating the Capture Compare register. + */ +static void compare_reg_update(timer_node_t * p_timer_id_head_old) +{ + // Setup the timeout for timers on the head of the list + if (mp_timer_id_head != NULL) + { + uint32_t ticks_to_expire = mp_timer_id_head->ticks_to_expire; + uint32_t pre_counter_val = rtc1_counter_get(); + uint32_t cc = m_ticks_latest; + uint32_t ticks_elapsed = ticks_diff_get(pre_counter_val, cc) + RTC_COMPARE_OFFSET_MIN; + + if (!m_rtc1_running) + { + // No timers were already running, start RTC + rtc1_start(); + } + + cc += (ticks_elapsed < ticks_to_expire) ? ticks_to_expire : ticks_elapsed; + cc &= MAX_RTC_COUNTER_VAL; + + rtc1_compare0_set(cc); + + uint32_t post_counter_val = rtc1_counter_get(); + + if ( + (ticks_diff_get(post_counter_val, pre_counter_val) + RTC_COMPARE_OFFSET_MIN) + > + ticks_diff_get(cc, pre_counter_val) + ) + { + // When this happens the COMPARE event may not be triggered by the RTC. + // The nRF51 Series User Specification states that if the COUNTER value is N + // (i.e post_counter_val = N), writing N or N + 1 to a CC register may not trigger a + // COMPARE event. Hence the RTC interrupt is forcefully pended by calling the following + // function. + rtc1_compare0_set(rtc1_counter_get()); // this should prevent CC to fire again in the background while the code is in RTC-ISR + nrf_delay_us(MAX_RTC_TASKS_DELAY); + timer_timeouts_check_sched(); + } + } + else + { +#if (APP_TIMER_KEEPS_RTC_ACTIVE == 0) + // No timers are running, stop RTC + rtc1_stop(); +#endif //(APP_TIMER_KEEPS_RTC_ACTIVE == 0) + } +} + + +/**@brief Function for handling changes to the timer list. + */ +static void timer_list_handler(void) +{ + timer_node_t * p_restart_list_head = NULL; + + uint32_t ticks_elapsed; + uint32_t ticks_previous; + bool ticks_have_elapsed; + bool compare_update; + timer_node_t * p_timer_id_head_old; + +#if APP_TIMER_WITH_PROFILER + { + uint8_t size = m_op_queue.size; + uint8_t first = m_op_queue.first; + uint8_t last = m_op_queue.last; + uint8_t utilization = (first <= last) ? (last - first) : (size + 1 - first + last); + + if (utilization > m_max_user_op_queue_utilization) + { + m_max_user_op_queue_utilization = utilization; + } + } +#endif + + // Back up the previous known tick and previous list head + ticks_previous = m_ticks_latest; + p_timer_id_head_old = mp_timer_id_head; + + // Get number of elapsed ticks + ticks_have_elapsed = elapsed_ticks_acquire(&ticks_elapsed); + + // Handle list deletions + compare_update = list_deletions_handler(); + + // Handle expired timers + if (ticks_have_elapsed) + { + expired_timers_handler(ticks_elapsed, ticks_previous, &p_restart_list_head); + compare_update = true; + } + + // Handle list insertions + if (list_insertions_handler(p_restart_list_head)) + { + compare_update = true; + } + + // Update compare register if necessary + if (compare_update) + { + compare_reg_update(p_timer_id_head_old); + } + m_rtc1_reset = false; +} + + +/**@brief Function for enqueueing a new operations queue entry. + * + * @param[in] last_index Index of the next last index to be enqueued. + */ +static void user_op_enque(uint8_t last_index) +{ + m_op_queue.last = last_index; +} + + +/**@brief Function for allocating a new operations queue entry. + * + * @param[out] p_last_index Index of the next last index to be enqueued. + * + * @return Pointer to allocated queue entry, or NULL if queue is full. + */ +static timer_user_op_t * user_op_alloc( uint8_t * p_last_index) +{ + uint8_t last; + timer_user_op_t * p_user_op; + + last = m_op_queue.last + 1; + if (last == m_op_queue.size) + { + // Overflow case. + last = 0; + } + if (last == m_op_queue.first) + { + // Queue is full. + return NULL; + } + + *p_last_index = last; + p_user_op = &m_op_queue.p_user_op_queue[m_op_queue.last]; + + return p_user_op; +} + + +/**@brief Function for scheduling a Timer Start operation. + * + * @param[in] timer_id Id of timer to start. + * @param[in] timeout_initial Time (in ticks) to first timer expiry. + * @param[in] timeout_periodic Time (in ticks) between periodic expiries. + * @param[in] p_context General purpose pointer. Will be passed to the timeout handler when + * the timer expires. + * @return NRF_SUCCESS on success, otherwise an error code. + */ + +static uint32_t timer_start_op_schedule(timer_node_t * p_node, + uint32_t timeout_initial, + uint32_t timeout_periodic, + void * p_context) +{ + uint8_t last_index; + uint32_t err_code = NRF_SUCCESS; + + CRITICAL_REGION_ENTER(); + timer_user_op_t * p_user_op = user_op_alloc(&last_index); + if (p_user_op == NULL) + { + err_code = NRF_ERROR_NO_MEM; + } + else + { + + p_user_op->op_type = TIMER_USER_OP_TYPE_START; + p_user_op->p_node = p_node; + p_user_op->params.start.ticks_at_start = rtc1_counter_get(); + p_user_op->params.start.ticks_first_interval = timeout_initial; + p_user_op->params.start.ticks_periodic_interval = timeout_periodic; + p_user_op->params.start.p_context = p_context; + + user_op_enque(last_index); + } + CRITICAL_REGION_EXIT(); + + if (err_code == NRF_SUCCESS) + { + timer_list_handler_sched(); + } + + return err_code; +} + + +/**@brief Function for scheduling a Timer Stop operation. + * + * @param[in] timer_id Id of timer to stop. + * @param[in] op_type Type of stop operation + * + * @return NRF_SUCCESS on successful scheduling a timer stop operation. NRF_ERROR_NO_MEM when there + * is no memory left to schedule the timer stop operation. + */ +static uint32_t timer_stop_op_schedule(timer_node_t * p_node, + timer_user_op_type_t op_type) +{ + uint8_t last_index; + uint32_t err_code = NRF_SUCCESS; + + CRITICAL_REGION_ENTER(); + timer_user_op_t * p_user_op = user_op_alloc(&last_index); + if (p_user_op == NULL) + { + err_code = NRF_ERROR_NO_MEM; + } + else + { + p_user_op->op_type = op_type; + p_user_op->p_node = p_node; + + user_op_enque(last_index); + } + CRITICAL_REGION_EXIT(); + + if (err_code == NRF_SUCCESS) + { + timer_list_handler_sched(); + } + + return err_code; +} + +/**@brief Function for handling the RTC1 interrupt. + * + * @details Checks for timeouts, and executes timeout handlers for expired timers. + */ +void RTC1_IRQHandler(void) +{ + // Clear all events (also unexpected ones) + NRF_RTC1->EVENTS_COMPARE[0] = 0; + NRF_RTC1->EVENTS_COMPARE[1] = 0; + NRF_RTC1->EVENTS_COMPARE[2] = 0; + NRF_RTC1->EVENTS_COMPARE[3] = 0; + NRF_RTC1->EVENTS_TICK = 0; + NRF_RTC1->EVENTS_OVRFLW = 0; + + // Check for expired timers + timer_timeouts_check(); +} + + +/**@brief Function for handling the SWI interrupt. + * + * @details Performs all updates to the timer list. + */ +void SWI_IRQHandler(void) +{ + timer_list_handler(); +} + + +uint32_t app_timer_init(uint32_t prescaler, + uint8_t op_queue_size, + void * p_buffer, + app_timer_evt_schedule_func_t evt_schedule_func) +{ + // Check that buffer is correctly aligned + if (!is_word_aligned(p_buffer)) + { + return NRF_ERROR_INVALID_PARAM; + } + // Check for NULL buffer + if (p_buffer == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Stop RTC to prevent any running timers from expiring (in case of reinitialization) + rtc1_stop(); + + m_evt_schedule_func = evt_schedule_func; + + // Initialize operation queue + m_op_queue.first = 0; + m_op_queue.last = 0; + m_op_queue.size = op_queue_size; + m_op_queue.p_user_op_queue = p_buffer; + + mp_timer_id_head = NULL; + m_ticks_elapsed_q_read_ind = 0; + m_ticks_elapsed_q_write_ind = 0; + +#if APP_TIMER_WITH_PROFILER + m_max_user_op_queue_utilization = 0; +#endif + + NVIC_ClearPendingIRQ(SWI_IRQn); + NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI); + NVIC_EnableIRQ(SWI_IRQn); + + rtc1_init(prescaler); + + m_ticks_latest = rtc1_counter_get(); + + return NRF_SUCCESS; +} + + +uint32_t app_timer_create(app_timer_id_t const * p_timer_id, + app_timer_mode_t mode, + app_timer_timeout_handler_t timeout_handler) +{ + // Check state and parameters + VERIFY_MODULE_INITIALIZED(); + + if (timeout_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + if (p_timer_id == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + if (((timer_node_t*)*p_timer_id)->is_running) + { + return NRF_ERROR_INVALID_STATE; + } + + timer_node_t * p_node = (timer_node_t *)*p_timer_id; + p_node->is_running = false; + p_node->mode = mode; + p_node->p_timeout_handler = timeout_handler; + return NRF_SUCCESS; +} + +uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context) +{ + uint32_t timeout_periodic; + timer_node_t * p_node = (timer_node_t*)timer_id; + + // Check state and parameters + VERIFY_MODULE_INITIALIZED(); + + if (timer_id == 0) + { + return NRF_ERROR_INVALID_STATE; + } + if (timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS) + { + return NRF_ERROR_INVALID_PARAM; + } + if (p_node->p_timeout_handler == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + // Schedule timer start operation + timeout_periodic = (p_node->mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0; + + return timer_start_op_schedule(p_node, + timeout_ticks, + timeout_periodic, + p_context); +} + + +uint32_t app_timer_stop(app_timer_id_t timer_id) +{ + timer_node_t * p_node = (timer_node_t*)timer_id; + // Check state and parameters + VERIFY_MODULE_INITIALIZED(); + + if ((timer_id == NULL) || (p_node->p_timeout_handler == NULL)) + { + return NRF_ERROR_INVALID_STATE; + } + + p_node->is_running = false; + // Schedule timer stop operation + return timer_stop_op_schedule(p_node, TIMER_USER_OP_TYPE_STOP); +} + + +uint32_t app_timer_stop_all(void) +{ + // Check state + VERIFY_MODULE_INITIALIZED(); + + return timer_stop_op_schedule(NULL, TIMER_USER_OP_TYPE_STOP_ALL); +} + + +uint32_t app_timer_cnt_get(void) +{ + return rtc1_counter_get(); +} + + +uint32_t app_timer_cnt_diff_compute(uint32_t ticks_to, + uint32_t ticks_from, + uint32_t * p_ticks_diff) +{ + *p_ticks_diff = ticks_diff_get(ticks_to, ticks_from); + return NRF_SUCCESS; +} + +#if APP_TIMER_WITH_PROFILER +uint8_t app_timer_op_queue_utilization_get(void) +{ + return m_max_user_op_queue_utilization; +} +#endif +#endif //NRF_MODULE_ENABLED(APP_TIMER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.h new file mode 100644 index 0000000000..f3d4c1a920 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.h @@ -0,0 +1,295 @@ +/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + +/** @file + * + * @defgroup app_timer Application Timer + * @{ + * @ingroup app_common + * + * @brief Application timer functionality. + * + * @details This module enables the application to create multiple timer instances based on the RTC1 + * peripheral. Checking for time-outs and invocation of user time-out handlers is performed + * in the RTC1 interrupt handler. List handling is done using a software interrupt (SWI0). + * Both interrupt handlers are running in APP_LOW priority level. + * + * @details When calling app_timer_start() or app_timer_stop(), the timer operation is just queued, + * and the software interrupt is triggered. The actual timer start/stop operation is + * executed by the SWI0 interrupt handler. Since the SWI0 interrupt is running in APP_LOW, + * if the application code calling the timer function is running in APP_LOW or APP_HIGH, + * the timer operation will not be performed until the application handler has returned. + * This will be the case, for example, when stopping a timer from a time-out handler when not using + * the scheduler. + * + * @details Use the USE_SCHEDULER parameter of the APP_TIMER_INIT() macro to select if the + * @ref app_scheduler should be used or not. Even if the scheduler is + * not used, app_timer.h will include app_scheduler.h, so when + * compiling, app_scheduler.h must be available in one of the compiler include paths. + */ + +#ifndef APP_TIMER_H__ +#define APP_TIMER_H__ +#include "sdk_config.h" +#include "app_error.h" +#include "app_util.h" +#include "compiler_abstraction.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define APP_TIMER_CLOCK_FREQ 32768 /**< Clock frequency of the RTC timer used to implement the app timer module. */ +#define APP_TIMER_MIN_TIMEOUT_TICKS 5 /**< Minimum value of the timeout_ticks parameter of app_timer_start(). */ + +#ifdef RTX +#define APP_TIMER_NODE_SIZE 40 /**< Size of app_timer.timer_node_t (used to allocate data). */ +#else +#define APP_TIMER_NODE_SIZE 32 /**< Size of app_timer.timer_node_t (used to allocate data). */ +#endif // RTX +#define APP_TIMER_USER_OP_SIZE 24 /**< Size of app_timer.timer_user_op_t (only for use inside APP_TIMER_BUF_SIZE()). */ + +/**@brief Compute number of bytes required to hold the application timer data structures. + * + * @param[in] OP_QUEUE_SIZE Size of the queue holding timer operations that are pending execution. + * Note that due to the queue implementation, this size must be one more + * than the size that is actually needed. + * + * @return Required application timer buffer size (in bytes). + */ +#define APP_TIMER_BUF_SIZE(OP_QUEUE_SIZE) \ + ( \ + ( \ + (((OP_QUEUE_SIZE) + 1) * APP_TIMER_USER_OP_SIZE) \ + ) \ + ) + +/**@brief Convert milliseconds to timer ticks. + * + * This macro uses 64-bit integer arithmetic, but as long as the macro parameters are + * constants (i.e. defines), the computation will be done by the preprocessor. + * + * When using this macro, ensure that the + * values provided as input result in an output value that is supported by the + * @ref app_timer_start function. For example, when the ticks for 1 ms is needed, the + * maximum possible value of PRESCALER must be 6, when @ref APP_TIMER_CLOCK_FREQ is 32768. + * This will result in a ticks value as 5. Any higher value for PRESCALER will result in a + * ticks value that is not supported by this module. + * + * @param[in] MS Milliseconds. + * @param[in] PRESCALER Value of the RTC1 PRESCALER register (must be the same value that was + * passed to APP_TIMER_INIT()). + * + * @return Number of timer ticks. + */ +#define APP_TIMER_TICKS(MS, PRESCALER)\ + ((uint32_t)ROUNDED_DIV((MS) * (uint64_t)APP_TIMER_CLOCK_FREQ, ((PRESCALER) + 1) * 1000)) + +typedef struct app_timer_t { uint32_t data[CEIL_DIV(APP_TIMER_NODE_SIZE, sizeof(uint32_t))]; } app_timer_t; + +/**@brief Timer ID type. + * Never declare a variable of this type, but use the macro @ref APP_TIMER_DEF instead.*/ +typedef app_timer_t * app_timer_id_t; + +/** + * @brief Create a timer identifier and statically allocate memory for the timer. + * + * @param timer_id Name of the timer identifier variable that will be used to control the timer. + */ +#define APP_TIMER_DEF(timer_id) \ + static app_timer_t timer_id##_data = { {0} }; \ + static const app_timer_id_t timer_id = &timer_id##_data + + +/**@brief Application time-out handler type. */ +typedef void (*app_timer_timeout_handler_t)(void * p_context); + +/**@brief Type of function for passing events from the timer module to the scheduler. */ +typedef uint32_t (*app_timer_evt_schedule_func_t) (app_timer_timeout_handler_t timeout_handler, + void * p_context); + +/**@brief Timer modes. */ +typedef enum +{ + APP_TIMER_MODE_SINGLE_SHOT, /**< The timer will expire only once. */ + APP_TIMER_MODE_REPEATED /**< The timer will restart each time it expires. */ +} app_timer_mode_t; + +/**@brief Initialize the application timer module. + * + * @details This macro handles dimensioning and allocation of the memory buffer required by the timer, + * making sure that the buffer is correctly aligned. It will also connect the timer module + * to the scheduler (if specified). + * + * @note This module assumes that the LFCLK is already running. If it is not, the module will + * be non-functional, since the RTC will not run. If you do not use a SoftDevice, you + * must start the LFCLK manually. See the rtc_example's lfclk_config() function + * for an example of how to do this. If you use a SoftDevice, the LFCLK is started on + * SoftDevice init. + * + * + * @param[in] PRESCALER Value of the RTC1 PRESCALER register. This will decide the + * timer tick rate. Set to 0 for no prescaling. + * @param[in] OP_QUEUE_SIZE Size of the queue holding timer operations that are pending execution. + * @param[in] SCHEDULER_FUNC Pointer to scheduler event handler + * + * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it + * several times as long as it is from the same location, for example, to do a re-initialization). + */ +/*lint -emacro(506, APP_TIMER_INIT) */ /* Suppress "Constant value Boolean */ +#define APP_TIMER_INIT(PRESCALER, OP_QUEUE_SIZE, SCHEDULER_FUNC) \ + do \ + { \ + static uint32_t APP_TIMER_BUF[CEIL_DIV(APP_TIMER_BUF_SIZE(OP_QUEUE_SIZE), \ + sizeof(uint32_t))]; \ + uint32_t ERR_CODE = app_timer_init((PRESCALER), \ + (OP_QUEUE_SIZE) + 1, \ + APP_TIMER_BUF, \ + SCHEDULER_FUNC); \ + APP_ERROR_CHECK(ERR_CODE); \ + } while (0) + + + +/**@brief Function for initializing the timer module. + * + * Normally, initialization should be done using the APP_TIMER_INIT() macro, because that macro will both + * allocate the buffers needed by the timer module (including aligning the buffers correctly) + * and take care of connecting the timer module to the scheduler (if specified). + * + * @param[in] prescaler Value of the RTC1 PRESCALER register. Set to 0 for no prescaling. + * @param[in] op_queue_size Size of the queue holding timer operations that are pending + * execution. Note that due to the queue implementation, this size must + * be one more than the size that is actually needed. + * @param[in] p_buffer Pointer to memory buffer for internal use in the app_timer + * module. The size of the buffer can be computed using the + * APP_TIMER_BUF_SIZE() macro. The buffer must be aligned to a + * 4 byte boundary. + * @param[in] evt_schedule_func Function for passing time-out events to the scheduler. Point to + * app_timer_evt_schedule() to connect to the scheduler. Set to NULL + * to make the timer module call the time-out handler directly from + * the timer interrupt handler. + * + * @retval NRF_SUCCESS If the module was initialized successfully. + * @retval NRF_ERROR_INVALID_PARAM If a parameter was invalid (buffer not aligned to a 4 byte + * boundary or NULL). + */ +uint32_t app_timer_init(uint32_t prescaler, + uint8_t op_queue_size, + void * p_buffer, + app_timer_evt_schedule_func_t evt_schedule_func); + +/**@brief Function for creating a timer instance. + * + * @param[in] p_timer_id Pointer to timer identifier. + * @param[in] mode Timer mode. + * @param[in] timeout_handler Function to be executed when the timer expires. + * + * @retval NRF_SUCCESS If the timer was successfully created. + * @retval NRF_ERROR_INVALID_PARAM If a parameter was invalid. + * @retval NRF_ERROR_INVALID_STATE If the application timer module has not been initialized or + * the timer is running. + * + * @note This function does the timer allocation in the caller's context. It is also not protected + * by a critical region. Therefore care must be taken not to call it from several interrupt + * levels simultaneously. + * @note The function can be called again on the timer instance and will re-initialize the instance if + * the timer is not running. + * @attention The FreeRTOS and RTX app_timer implementation does not allow app_timer_create to + * be called on the previously initialized instance. + */ +uint32_t app_timer_create(app_timer_id_t const * p_timer_id, + app_timer_mode_t mode, + app_timer_timeout_handler_t timeout_handler); + +/**@brief Function for starting a timer. + * + * @param[in] timer_id Timer identifier. + * @param[in] timeout_ticks Number of ticks (of RTC1, including prescaling) to time-out event + * (minimum 5 ticks). + * @param[in] p_context General purpose pointer. Will be passed to the time-out handler when + * the timer expires. + * + * @retval NRF_SUCCESS If the timer was successfully started. + * @retval NRF_ERROR_INVALID_PARAM If a parameter was invalid. + * @retval NRF_ERROR_INVALID_STATE If the application timer module has not been initialized or the timer + * has not been created. + * @retval NRF_ERROR_NO_MEM If the timer operations queue was full. + * + * @note The minimum timeout_ticks value is 5. + * @note For multiple active timers, time-outs occurring in close proximity to each other (in the + * range of 1 to 3 ticks) will have a positive jitter of maximum 3 ticks. + * @note When calling this method on a timer that is already running, the second start operation + * is ignored. + */ +uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context); + +/**@brief Function for stopping the specified timer. + * + * @param[in] timer_id Timer identifier. + * + * @retval NRF_SUCCESS If the timer was successfully stopped. + * @retval NRF_ERROR_INVALID_PARAM If a parameter was invalid. + * @retval NRF_ERROR_INVALID_STATE If the application timer module has not been initialized or the timer + * has not been created. + * @retval NRF_ERROR_NO_MEM If the timer operations queue was full. + */ +uint32_t app_timer_stop(app_timer_id_t timer_id); + +/**@brief Function for stopping all running timers. + * + * @retval NRF_SUCCESS If all timers were successfully stopped. + * @retval NRF_ERROR_INVALID_STATE If the application timer module has not been initialized. + * @retval NRF_ERROR_NO_MEM If the timer operations queue was full. + */ +uint32_t app_timer_stop_all(void); + +/**@brief Function for returning the current value of the RTC1 counter. + * + * @return Current value of the RTC1 counter. + */ +uint32_t app_timer_cnt_get(void); + +/**@brief Function for computing the difference between two RTC1 counter values. + * + * @param[in] ticks_to Value returned by app_timer_cnt_get(). + * @param[in] ticks_from Value returned by app_timer_cnt_get(). + * @param[out] p_ticks_diff Number of ticks from ticks_from to ticks_to. + * + * @retval NRF_SUCCESS If the counter difference was successfully computed. + */ +uint32_t app_timer_cnt_diff_compute(uint32_t ticks_to, + uint32_t ticks_from, + uint32_t * p_ticks_diff); + + +/**@brief Function for getting the maximum observed operation queue utilization. + * + * Function for tuning the module and determining OP_QUEUE_SIZE value and thus module RAM usage. + * + * @note APP_TIMER_WITH_PROFILER must be enabled to use this functionality. + * + * @return Maximum number of events in queue observed so far. + */ +uint8_t app_timer_op_queue_utilization_get(void); + + +#ifdef __cplusplus +} +#endif + +#endif // APP_TIMER_H__ + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.c new file mode 100644 index 0000000000..8973f0b88e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.c @@ -0,0 +1,34 @@ +/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + +#include "app_timer_appsh.h" +#include "app_scheduler.h" + +static void app_timer_evt_get(void * p_event_data, uint16_t event_size) +{ + app_timer_event_t * p_timer_event = (app_timer_event_t *)p_event_data; + + APP_ERROR_CHECK_BOOL(event_size == sizeof(app_timer_event_t)); + p_timer_event->timeout_handler(p_timer_event->p_context); +} + +uint32_t app_timer_evt_schedule(app_timer_timeout_handler_t timeout_handler, + void * p_context) +{ + app_timer_event_t timer_event; + + timer_event.timeout_handler = timeout_handler; + timer_event.p_context = p_context; + + return app_sched_event_put(&timer_event, sizeof(timer_event), app_timer_evt_get); +} + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.h new file mode 100644 index 0000000000..8b6cfcf185 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.h @@ -0,0 +1,53 @@ +/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + + #ifndef APP_TIMER_APPSH_H + #define APP_TIMER_APPSH_H + +#include "app_timer.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define APP_TIMER_SCHED_EVT_SIZE sizeof(app_timer_event_t) /**< Size of button events being passed through the scheduler (is to be used for computing the maximum size of scheduler events). */ + +/**@brief Macro for initializing the application timer module to use with app_scheduler. + * + * @param[in] PRESCALER Value of the RTC1 PRESCALER register. This will decide the + * timer tick rate. Set to 0 for no prescaling. + * @param[in] OP_QUEUES_SIZE Size of queues holding timer operations that are pending execution. + * @param[in] USE_SCHEDULER TRUE if the application is using the app_scheduler, + * FALSE otherwise. + * + * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it + * several times as long as it is from the same location, e.g. to do a reinitialization). + */ +#define APP_TIMER_APPSH_INIT(PRESCALER, OP_QUEUES_SIZE, USE_SCHEDULER) \ + APP_TIMER_INIT(PRESCALER, OP_QUEUES_SIZE, \ + (USE_SCHEDULER) ? app_timer_evt_schedule : NULL) + +typedef struct +{ + app_timer_timeout_handler_t timeout_handler; + void * p_context; +} app_timer_event_t; + +uint32_t app_timer_evt_schedule(app_timer_timeout_handler_t timeout_handler, + void * p_context); + +#ifdef __cplusplus +} +#endif + +#endif // APP_TIMER_APPSH_H + diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_ble_gzll.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_ble_gzll.c new file mode 100644 index 0000000000..e39c329464 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_ble_gzll.c @@ -0,0 +1,1050 @@ +/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(APP_TIMER) +#include "app_timer.h" +#include +#include "nrf.h" +#include "nrf_soc.h" +#include "app_error.h" +#include "nrf_delay.h" +#include "app_util_platform.h" + +#define RTC1_IRQ_PRI APP_IRQ_PRIORITY_LOWEST /**< Priority of the RTC1 interrupt (used for checking for timeouts and executing timeout handlers). */ +#define SWI_IRQ_PRI APP_IRQ_PRIORITY_LOWEST /**< Priority of the SWI interrupt (used for updating the timer list). */ + +// The current design assumes that both interrupt handlers run at the same interrupt level. +// If this is to be changed, protection must be added to prevent them from interrupting each other +// (e.g. by using guard/trigger flags). +STATIC_ASSERT(RTC1_IRQ_PRI == SWI_IRQ_PRI); + +#define MAX_RTC_COUNTER_VAL 0x00FFFFFF /**< Maximum value of the RTC counter. */ + +#define RTC_COMPARE_OFFSET_MIN 3 /**< Minimum offset between the current RTC counter value and the Capture Compare register. Although the nRF51 Series User Specification recommends this value to be 2, we use 3 to be safer.*/ + +#define MAX_RTC_TASKS_DELAY 47 /**< Maximum delay until an RTC task is executed. */ + +#define SWI_IRQn SWI1_IRQn +#define SWI_IRQHandler SWI1_IRQHandler + +#define MODULE_INITIALIZED (m_op_queue.p_user_op_queue != NULL) /**< Macro designating whether the module has been initialized properly. */ + +/**@brief Timer node type. The nodes will be used form a linked list of running timers. */ +typedef struct +{ + uint32_t ticks_to_expire; /**< Number of ticks from previous timer interrupt to timer expiry. */ + uint32_t ticks_at_start; /**< Current RTC counter value when the timer was started. */ + uint32_t ticks_first_interval; /**< Number of ticks in the first timer interval. */ + uint32_t ticks_periodic_interval; /**< Timer period (for repeating timers). */ + bool is_running; /**< True if timer is running, False otherwise. */ + app_timer_mode_t mode; /**< Timer mode. */ + app_timer_timeout_handler_t p_timeout_handler; /**< Pointer to function to be executed when the timer expires. */ + void * p_context; /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */ + void * next; /**< Pointer to the next node. */ +} timer_node_t; + +STATIC_ASSERT(sizeof(timer_node_t) == APP_TIMER_NODE_SIZE); + +/**@brief Set of available timer operation types. */ +typedef enum +{ + TIMER_USER_OP_TYPE_NONE, /**< Invalid timer operation type. */ + TIMER_USER_OP_TYPE_START, /**< Timer operation type Start. */ + TIMER_USER_OP_TYPE_STOP, /**< Timer operation type Stop. */ + TIMER_USER_OP_TYPE_STOP_ALL /**< Timer operation type Stop All. */ +} timer_user_op_type_t; + +/**@brief Structure describing a timer start operation. */ +typedef struct +{ + uint32_t ticks_at_start; /**< Current RTC counter value when the timer was started. */ + uint32_t ticks_first_interval; /**< Number of ticks in the first timer interval. */ + uint32_t ticks_periodic_interval; /**< Timer period (for repeating timers). */ + void * p_context; /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */ +} timer_user_op_start_t; + +/**@brief Structure describing a timer operation. */ +typedef struct +{ + timer_user_op_type_t op_type; /**< Id of timer on which the operation is to be performed. */ + timer_node_t * p_node; + union + { + timer_user_op_start_t start; /**< Structure describing a timer start operation. */ + } params; +} timer_user_op_t; + +STATIC_ASSERT(sizeof(timer_user_op_t) <= APP_TIMER_USER_OP_SIZE); +STATIC_ASSERT(sizeof(timer_user_op_t) % 4 == 0); + +/**@brief Structure describing a timer operations queue. + * + * @details This queue will hold timer operations issued by the application + * until the timer interrupt handler processes these operations. + */ +typedef struct +{ + uint8_t first; /**< Index of first entry to have been inserted in the queue (i.e. the next entry to be executed). */ + uint8_t last; /**< Index of last entry to have been inserted in the queue. */ + uint8_t size; /**< Queue size. */ + timer_user_op_t * p_user_op_queue; /**< Queue buffer. */ +} timer_op_queue_t; + +STATIC_ASSERT(sizeof(timer_op_queue_t) % 4 == 0); + +#define CONTEXT_QUEUE_SIZE_MAX (2) + +static timer_op_queue_t m_op_queue; /**< Timer operations queue. */ +static timer_node_t * mp_timer_id_head; /**< First timer in list of running timers. */ +static uint32_t m_ticks_latest; /**< Last known RTC counter value. */ +static uint32_t m_ticks_elapsed[CONTEXT_QUEUE_SIZE_MAX]; /**< Timer internal elapsed ticks queue. */ +static uint8_t m_ticks_elapsed_q_read_ind; /**< Timer internal elapsed ticks queue read index. */ +static uint8_t m_ticks_elapsed_q_write_ind; /**< Timer internal elapsed ticks queue write index. */ +static app_timer_evt_schedule_func_t m_evt_schedule_func; /**< Pointer to function for propagating timeout events to the scheduler. */ +static bool m_rtc1_running; /**< Boolean indicating if RTC1 is running. */ +static bool m_rtc1_reset; /**< Boolean indicating if RTC1 counter has been reset due to last timer removed from timer list during the timer list handling. */ + +#if APP_TIMER_WITH_PROFILER +static uint8_t m_max_user_op_queue_utilization; /**< Maximum observed timer user operations queue utilization. */ +#endif + +/**@brief Function for initializing the RTC1 counter. + * + * @param[in] prescaler Value of the RTC1 PRESCALER register. Set to 0 for no prescaling. + */ +static void rtc1_init(uint32_t prescaler) +{ + NRF_RTC1->PRESCALER = prescaler; + NVIC_SetPriority(RTC1_IRQn, RTC1_IRQ_PRI); +} + + +/**@brief Function for starting the RTC1 timer. + */ +static void rtc1_start(void) +{ + NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE0_Msk; + NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE0_Msk; + + NVIC_ClearPendingIRQ(RTC1_IRQn); + NVIC_EnableIRQ(RTC1_IRQn); + + NRF_RTC1->TASKS_START = 1; + nrf_delay_us(MAX_RTC_TASKS_DELAY); + + m_rtc1_running = true; +} + + +/**@brief Function for stopping the RTC1 timer. + */ +static void rtc1_stop(void) +{ + NVIC_DisableIRQ(RTC1_IRQn); + + NRF_RTC1->EVTENCLR = RTC_EVTEN_COMPARE0_Msk; + NRF_RTC1->INTENCLR = RTC_INTENSET_COMPARE0_Msk; + + NRF_RTC1->TASKS_STOP = 1; + nrf_delay_us(MAX_RTC_TASKS_DELAY); + + NRF_RTC1->TASKS_CLEAR = 1; + m_ticks_latest = 0; + nrf_delay_us(MAX_RTC_TASKS_DELAY); + + m_rtc1_running = false; +} + + +/**@brief Function for returning the current value of the RTC1 counter. + * + * @return Current value of the RTC1 counter. + */ +static __INLINE uint32_t rtc1_counter_get(void) +{ + return NRF_RTC1->COUNTER; +} + + +/**@brief Function for computing the difference between two RTC1 counter values. + * + * @return Number of ticks elapsed from ticks_old to ticks_now. + */ +static __INLINE uint32_t ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old) +{ + return ((ticks_now - ticks_old) & MAX_RTC_COUNTER_VAL); +} + + +/**@brief Function for setting the RTC1 Capture Compare register 0, and enabling the corresponding + * event. + * + * @param[in] value New value of Capture Compare register 0. + */ +static __INLINE void rtc1_compare0_set(uint32_t value) +{ + NRF_RTC1->CC[0] = value; +} + + +/**@brief Function for inserting a timer in the timer list. + * + * @param[in] timer_id Id of timer to insert. + */ +static void timer_list_insert(timer_node_t * p_timer) +{ + if (mp_timer_id_head == NULL) + { + mp_timer_id_head = p_timer; + } + else + { + if (p_timer->ticks_to_expire <= mp_timer_id_head->ticks_to_expire) + { + mp_timer_id_head->ticks_to_expire -= p_timer->ticks_to_expire; + + p_timer->next = mp_timer_id_head; + mp_timer_id_head = p_timer; + } + else + { + timer_node_t * p_previous; + timer_node_t * p_current; + uint32_t ticks_to_expire; + + ticks_to_expire = p_timer->ticks_to_expire; + p_previous = mp_timer_id_head; + p_current = mp_timer_id_head; + + while ((p_current != NULL) && (ticks_to_expire > p_current->ticks_to_expire)) + { + ticks_to_expire -= p_current->ticks_to_expire; + p_previous = p_current; + p_current = p_current->next; + } + + if (p_current != NULL) + { + p_current->ticks_to_expire -= ticks_to_expire; + } + + p_timer->ticks_to_expire = ticks_to_expire; + p_timer->next = p_current; + p_previous->next = p_timer; + } + } +} + + +/**@brief Function for removing a timer from the timer queue. + * + * @param[in] timer_id Id of timer to remove. + */ +static void timer_list_remove(timer_node_t * p_timer) +{ + timer_node_t * p_previous; + timer_node_t * p_current; + uint32_t timeout; + + // Find the timer's position in timer list. + p_previous = mp_timer_id_head; + p_current = p_previous; + + while (p_current != NULL) + { + if (p_current == p_timer) + { + break; + } + p_previous = p_current; + p_current = p_current->next; + } + + // Timer not in active list. + if (p_current == NULL) + { + return; + } + + // Timer is the first in the list + if (p_previous == p_current) + { + mp_timer_id_head = mp_timer_id_head->next; + + // No more timers in the list. Reset RTC1 in case Start timer operations are present in the queue. + if (mp_timer_id_head == NULL) + { + NRF_RTC1->TASKS_CLEAR = 1; + m_ticks_latest = 0; + m_rtc1_reset = true; + } + } + + // Remaining timeout between next timeout. + timeout = p_current->ticks_to_expire; + + // Link previous timer with next of this timer, i.e. removing the timer from list. + p_previous->next = p_current->next; + + // If this is not the last timer, increment the next timer by this timer timeout. + p_current = p_previous->next; + if (p_current != NULL) + { + p_current->ticks_to_expire += timeout; + } +} + + +/**@brief Function for scheduling a check for timeouts by generating a RTC1 interrupt. + */ +static void timer_timeouts_check_sched(void) +{ + NVIC_SetPendingIRQ(RTC1_IRQn); +} + + +/**@brief Function for scheduling a timer list update by generating a SWI interrupt. + */ +static void timer_list_handler_sched(void) +{ + NVIC_SetPendingIRQ(SWI_IRQn); +} + + +/**@brief Function for executing an application timeout handler, either by calling it directly, or + * by passing an event to the @ref app_scheduler. + * + * @param[in] p_timer Pointer to expired timer. + */ +static void timeout_handler_exec(timer_node_t * p_timer) +{ + if (m_evt_schedule_func != NULL) + { + uint32_t err_code = m_evt_schedule_func(p_timer->p_timeout_handler, p_timer->p_context); + APP_ERROR_CHECK(err_code); + } + else + { + p_timer->p_timeout_handler(p_timer->p_context); + } +} + + +/**@brief Function for checking for expired timers. + */ +static void timer_timeouts_check(void) +{ + // Handle expired of timer + if (mp_timer_id_head != NULL) + { + timer_node_t * p_timer; + timer_node_t * p_previous_timer; + uint32_t ticks_elapsed; + uint32_t ticks_expired; + + // Initialize actual elapsed ticks being consumed to 0. + ticks_expired = 0; + + // ticks_elapsed is collected here, job will use it. + ticks_elapsed = ticks_diff_get(rtc1_counter_get(), m_ticks_latest); + + // Auto variable containing the head of timers expiring. + p_timer = mp_timer_id_head; + + // Expire all timers within ticks_elapsed and collect ticks_expired. + while (p_timer != NULL) + { + // Do nothing if timer did not expire. + if (ticks_elapsed < p_timer->ticks_to_expire) + { + break; + } + + // Decrement ticks_elapsed and collect expired ticks. + ticks_elapsed -= p_timer->ticks_to_expire; + ticks_expired += p_timer->ticks_to_expire; + + // Move to next timer. + p_previous_timer = p_timer; + p_timer = p_timer->next; + + // Execute Task. + if (p_previous_timer->is_running) + { + p_previous_timer->is_running = false; + timeout_handler_exec(p_previous_timer); + } + } + + // Prepare to queue the ticks expired in the m_ticks_elapsed queue. + if (m_ticks_elapsed_q_read_ind == m_ticks_elapsed_q_write_ind) + { + // The read index of the queue is equal to the write index. This means the new + // value of ticks_expired should be stored at a new location in the m_ticks_elapsed + // queue (which is implemented as a double buffer). + + // Check if there will be a queue overflow. + if (++m_ticks_elapsed_q_write_ind == CONTEXT_QUEUE_SIZE_MAX) + { + // There will be a queue overflow. Hence the write index should point to the start + // of the queue. + m_ticks_elapsed_q_write_ind = 0; + } + } + + // Queue the ticks expired. + m_ticks_elapsed[m_ticks_elapsed_q_write_ind] = ticks_expired; + + timer_list_handler_sched(); + } +} + + +/**@brief Function for acquiring the number of ticks elapsed. + * + * @param[out] p_ticks_elapsed Number of ticks elapsed. + * + * @return TRUE if elapsed ticks was read from queue, FALSE otherwise. + */ +static bool elapsed_ticks_acquire(uint32_t * p_ticks_elapsed) +{ + // Pick the elapsed value from queue. + if (m_ticks_elapsed_q_read_ind != m_ticks_elapsed_q_write_ind) + { + // Dequeue elapsed value. + m_ticks_elapsed_q_read_ind++; + if (m_ticks_elapsed_q_read_ind == CONTEXT_QUEUE_SIZE_MAX) + { + m_ticks_elapsed_q_read_ind = 0; + } + + *p_ticks_elapsed = m_ticks_elapsed[m_ticks_elapsed_q_read_ind]; + + m_ticks_latest += *p_ticks_elapsed; + m_ticks_latest &= MAX_RTC_COUNTER_VAL; + + return true; + } + else + { + // No elapsed value in queue. + *p_ticks_elapsed = 0; + return false; + } +} + + +/**@brief Function for handling the timer list deletions. + * + * @return TRUE if Capture Compare register must be updated, FALSE otherwise. + */ +static bool list_deletions_handler(void) +{ + timer_node_t * p_timer_old_head; + uint8_t user_ops_first = m_op_queue.first; + + // Remember the old head, so as to decide if new compare needs to be set. + p_timer_old_head = mp_timer_id_head; + + while (user_ops_first != m_op_queue.last) + { + timer_user_op_t * p_user_op = &m_op_queue.p_user_op_queue[user_ops_first]; + + // Traverse to next operation in queue. + user_ops_first++; + if (user_ops_first == m_op_queue.size) + { + user_ops_first = 0; + } + + switch (p_user_op->op_type) + { + case TIMER_USER_OP_TYPE_STOP: + // Delete node if timer is running. + timer_list_remove(p_user_op->p_node); + break; + + case TIMER_USER_OP_TYPE_STOP_ALL: + // Delete list of running timers, and mark all timers as not running. + while (mp_timer_id_head != NULL) + { + timer_node_t * p_head = mp_timer_id_head; + + p_head->is_running = false; + mp_timer_id_head = p_head->next; + } + break; + + default: + // No implementation needed. + break; + } + } + + // Detect change in head of the list. + return (mp_timer_id_head != p_timer_old_head); +} + + +/**@brief Function for updating the timer list for expired timers. + * + * @param[in] ticks_elapsed Number of elapsed ticks. + * @param[in] ticks_previous Previous known value of the RTC counter. + * @param[out] p_restart_list_head List of repeating timers to be restarted. + */ +static void expired_timers_handler(uint32_t ticks_elapsed, + uint32_t ticks_previous, + timer_node_t ** p_restart_list_head) +{ + uint32_t ticks_expired = 0; + + while (mp_timer_id_head != NULL) + { + timer_node_t * p_timer; + timer_node_t * p_timer_expired; + + // Auto variable for current timer node. + p_timer = mp_timer_id_head; + + // Do nothing if timer did not expire + if (ticks_elapsed < p_timer->ticks_to_expire) + { + p_timer->ticks_to_expire -= ticks_elapsed; + break; + } + + // Decrement ticks_elapsed and collect expired ticks. + ticks_elapsed -= p_timer->ticks_to_expire; + ticks_expired += p_timer->ticks_to_expire; + + // Timer expired, set ticks_to_expire zero. + p_timer->ticks_to_expire = 0; + + // Remove the expired timer from head. + p_timer_expired = mp_timer_id_head; + mp_timer_id_head = p_timer->next; + + // Timer will be restarted if periodic. + if (p_timer->ticks_periodic_interval != 0) + { + p_timer->ticks_at_start = (ticks_previous + ticks_expired) & MAX_RTC_COUNTER_VAL; + p_timer->ticks_first_interval = p_timer->ticks_periodic_interval; + p_timer->next = *p_restart_list_head; + *p_restart_list_head = p_timer_expired; + } + } +} + + +/**@brief Function for handling timer list insertions. + * + * @param[in] p_restart_list_head List of repeating timers to be restarted. + * + * @return TRUE if Capture Compare register must be updated, FALSE otherwise. + */ +static bool list_insertions_handler(timer_node_t * p_restart_list_head) +{ + timer_node_t * p_timer_id_old_head; + + // Remember the old head, so as to decide if new compare needs to be set. + p_timer_id_old_head = mp_timer_id_head; + + // Handle insertions of timers. + while ((p_restart_list_head != NULL) || (m_op_queue.first != m_op_queue.last)) + { + timer_node_t * p_timer; + + if (p_restart_list_head != NULL) + { + p_timer = p_restart_list_head; + p_restart_list_head = p_timer->next; + } + else + { + timer_user_op_t * p_user_op = &m_op_queue.p_user_op_queue[m_op_queue.first]; + + m_op_queue.first++; + if (m_op_queue.first == m_op_queue.size) + { + m_op_queue.first = 0; + } + + p_timer = p_user_op->p_node; + + if ((p_user_op->op_type != TIMER_USER_OP_TYPE_START) || p_timer->is_running) + { + continue; + } + + p_timer->ticks_at_start = p_user_op->params.start.ticks_at_start; + p_timer->ticks_first_interval = p_user_op->params.start.ticks_first_interval; + p_timer->ticks_periodic_interval = p_user_op->params.start.ticks_periodic_interval; + p_timer->p_context = p_user_op->params.start.p_context; + + if (m_rtc1_reset) + { + p_timer->ticks_at_start = 0; + } + } + + // Prepare the node to be inserted. + if ( + ((p_timer->ticks_at_start - m_ticks_latest) & MAX_RTC_COUNTER_VAL) + < + (MAX_RTC_COUNTER_VAL / 2) + ) + { + p_timer->ticks_to_expire = ticks_diff_get(p_timer->ticks_at_start, m_ticks_latest) + + p_timer->ticks_first_interval; + } + else + { + uint32_t delta_current_start; + + delta_current_start = ticks_diff_get(m_ticks_latest, p_timer->ticks_at_start); + if (p_timer->ticks_first_interval > delta_current_start) + { + p_timer->ticks_to_expire = p_timer->ticks_first_interval - delta_current_start; + } + else + { + p_timer->ticks_to_expire = 0; + } + } + + p_timer->ticks_at_start = 0; + p_timer->ticks_first_interval = 0; + p_timer->is_running = true; + p_timer->next = NULL; + + // Insert into list + timer_list_insert(p_timer); + } + + return (mp_timer_id_head != p_timer_id_old_head); +} + + +/**@brief Function for updating the Capture Compare register. + */ +static void compare_reg_update(timer_node_t * p_timer_id_head_old) +{ + // Setup the timeout for timers on the head of the list + if (mp_timer_id_head != NULL) + { + uint32_t ticks_to_expire = mp_timer_id_head->ticks_to_expire; + uint32_t pre_counter_val = rtc1_counter_get(); + uint32_t cc = m_ticks_latest; + uint32_t ticks_elapsed = ticks_diff_get(pre_counter_val, cc) + RTC_COMPARE_OFFSET_MIN; + + if (!m_rtc1_running) + { + // No timers were already running, start RTC + rtc1_start(); + } + + cc += (ticks_elapsed < ticks_to_expire) ? ticks_to_expire : ticks_elapsed; + cc &= MAX_RTC_COUNTER_VAL; + + rtc1_compare0_set(cc); + + uint32_t post_counter_val = rtc1_counter_get(); + + if ( + (ticks_diff_get(post_counter_val, pre_counter_val) + RTC_COMPARE_OFFSET_MIN) + > + ticks_diff_get(cc, pre_counter_val) + ) + { + // When this happens the COMPARE event may not be triggered by the RTC. + // The nRF51 Series User Specification states that if the COUNTER value is N + // (i.e post_counter_val = N), writing N or N + 1 to a CC register may not trigger a + // COMPARE event. Hence the RTC interrupt is forcefully pended by calling the following + // function. + rtc1_compare0_set(rtc1_counter_get()); // this should prevent CC to fire again in the background while the code is in RTC-ISR + nrf_delay_us(MAX_RTC_TASKS_DELAY); + timer_timeouts_check_sched(); + } + } + else + { +#if (APP_TIMER_KEEPS_RTC_ACTIVE == 0) + // No timers are running, stop RTC + rtc1_stop(); +#endif //(APP_TIMER_KEEPS_RTC_ACTIVE == 0) + } +} + + +/**@brief Function for handling changes to the timer list. + */ +static void timer_list_handler(void) +{ + timer_node_t * p_restart_list_head = NULL; + + uint32_t ticks_elapsed; + uint32_t ticks_previous; + bool ticks_have_elapsed; + bool compare_update; + timer_node_t * p_timer_id_head_old; + +#if APP_TIMER_WITH_PROFILER + { + uint8_t size = m_op_queue.size; + uint8_t first = m_op_queue.first; + uint8_t last = m_op_queue.last; + uint8_t utilization = (first <= last) ? (last - first) : (size + 1 - first + last); + + if (utilization > m_max_user_op_queue_utilization) + { + m_max_user_op_queue_utilization = utilization; + } + } +#endif + + // Back up the previous known tick and previous list head + ticks_previous = m_ticks_latest; + p_timer_id_head_old = mp_timer_id_head; + + // Get number of elapsed ticks + ticks_have_elapsed = elapsed_ticks_acquire(&ticks_elapsed); + + // Handle list deletions + compare_update = list_deletions_handler(); + + // Handle expired timers + if (ticks_have_elapsed) + { + expired_timers_handler(ticks_elapsed, ticks_previous, &p_restart_list_head); + compare_update = true; + } + + // Handle list insertions + if (list_insertions_handler(p_restart_list_head)) + { + compare_update = true; + } + + // Update compare register if necessary + if (compare_update) + { + compare_reg_update(p_timer_id_head_old); + } + m_rtc1_reset = false; +} + + +/**@brief Function for enqueueing a new operations queue entry. + * + * @param[in] last_index Index of the next last index to be enqueued. + */ +static void user_op_enque(uint8_t last_index) +{ + m_op_queue.last = last_index; +} + + +/**@brief Function for allocating a new operations queue entry. + * + * @param[out] p_last_index Index of the next last index to be enqueued. + * + * @return Pointer to allocated queue entry, or NULL if queue is full. + */ +static timer_user_op_t * user_op_alloc( uint8_t * p_last_index) +{ + uint8_t last; + timer_user_op_t * p_user_op; + + last = m_op_queue.last + 1; + if (last == m_op_queue.size) + { + // Overflow case. + last = 0; + } + if (last == m_op_queue.first) + { + // Queue is full. + return NULL; + } + + *p_last_index = last; + p_user_op = &m_op_queue.p_user_op_queue[m_op_queue.last]; + + return p_user_op; +} + + +/**@brief Function for scheduling a Timer Start operation. + * + * @param[in] timer_id Id of timer to start. + * @param[in] timeout_initial Time (in ticks) to first timer expiry. + * @param[in] timeout_periodic Time (in ticks) between periodic expiries. + * @param[in] p_context General purpose pointer. Will be passed to the timeout handler when + * the timer expires. + * @return NRF_SUCCESS on success, otherwise an error code. + */ + +static uint32_t timer_start_op_schedule(timer_node_t * p_node, + uint32_t timeout_initial, + uint32_t timeout_periodic, + void * p_context) +{ + uint8_t last_index; + uint32_t err_code = NRF_SUCCESS; + + CRITICAL_REGION_ENTER(); + timer_user_op_t * p_user_op = user_op_alloc(&last_index); + if (p_user_op == NULL) + { + err_code = NRF_ERROR_NO_MEM; + } + else + { + + p_user_op->op_type = TIMER_USER_OP_TYPE_START; + p_user_op->p_node = p_node; + p_user_op->params.start.ticks_at_start = rtc1_counter_get(); + p_user_op->params.start.ticks_first_interval = timeout_initial; + p_user_op->params.start.ticks_periodic_interval = timeout_periodic; + p_user_op->params.start.p_context = p_context; + + user_op_enque(last_index); + } + CRITICAL_REGION_EXIT(); + + if (err_code == NRF_SUCCESS) + { + timer_list_handler_sched(); + } + + return err_code; +} + + +/**@brief Function for scheduling a Timer Stop operation. + * + * @param[in] timer_id Id of timer to stop. + * @param[in] op_type Type of stop operation + * + * @return NRF_SUCCESS on successful scheduling a timer stop operation. NRF_ERROR_NO_MEM when there + * is no memory left to schedule the timer stop operation. + */ +static uint32_t timer_stop_op_schedule(timer_node_t * p_node, + timer_user_op_type_t op_type) +{ + uint8_t last_index; + uint32_t err_code = NRF_SUCCESS; + + CRITICAL_REGION_ENTER(); + timer_user_op_t * p_user_op = user_op_alloc(&last_index); + if (p_user_op == NULL) + { + err_code = NRF_ERROR_NO_MEM; + } + else + { + p_user_op->op_type = op_type; + p_user_op->p_node = p_node; + + user_op_enque(last_index); + } + CRITICAL_REGION_EXIT(); + + if (err_code == NRF_SUCCESS) + { + timer_list_handler_sched(); + } + + return err_code; +} + +/**@brief Function for handling the RTC1 interrupt. + * + * @details Checks for timeouts, and executes timeout handlers for expired timers. + */ +void RTC1_IRQHandler(void) +{ + // Clear all events (also unexpected ones) + NRF_RTC1->EVENTS_COMPARE[0] = 0; + NRF_RTC1->EVENTS_COMPARE[1] = 0; + NRF_RTC1->EVENTS_COMPARE[2] = 0; + NRF_RTC1->EVENTS_COMPARE[3] = 0; + NRF_RTC1->EVENTS_TICK = 0; + NRF_RTC1->EVENTS_OVRFLW = 0; + + // Check for expired timers + timer_timeouts_check(); +} + + +/**@brief Function for handling the SWI interrupt. + * + * @details Performs all updates to the timer list. + */ +void SWI_IRQHandler(void) +{ + timer_list_handler(); +} + + +uint32_t app_timer_init(uint32_t prescaler, + uint8_t op_queue_size, + void * p_buffer, + app_timer_evt_schedule_func_t evt_schedule_func) +{ + // Check that buffer is correctly aligned + if (!is_word_aligned(p_buffer)) + { + return NRF_ERROR_INVALID_PARAM; + } + // Check for NULL buffer + if (p_buffer == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Stop RTC to prevent any running timers from expiring (in case of reinitialization) + rtc1_stop(); + + m_evt_schedule_func = evt_schedule_func; + + // Initialize operation queue + m_op_queue.first = 0; + m_op_queue.last = 0; + m_op_queue.size = op_queue_size; + m_op_queue.p_user_op_queue = p_buffer; + + mp_timer_id_head = NULL; + m_ticks_elapsed_q_read_ind = 0; + m_ticks_elapsed_q_write_ind = 0; + +#if APP_TIMER_WITH_PROFILER + m_max_user_op_queue_utilization = 0; +#endif + + NVIC_ClearPendingIRQ(SWI_IRQn); + NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI); + NVIC_EnableIRQ(SWI_IRQn); + + rtc1_init(prescaler); + + m_ticks_latest = rtc1_counter_get(); + + return NRF_SUCCESS; +} + + +uint32_t app_timer_create(app_timer_id_t const * p_timer_id, + app_timer_mode_t mode, + app_timer_timeout_handler_t timeout_handler) +{ + // Check state and parameters + VERIFY_MODULE_INITIALIZED(); + + if (timeout_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + if (p_timer_id == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + if (((timer_node_t*)*p_timer_id)->is_running) + { + return NRF_ERROR_INVALID_STATE; + } + + timer_node_t * p_node = (timer_node_t *)*p_timer_id; + p_node->is_running = false; + p_node->mode = mode; + p_node->p_timeout_handler = timeout_handler; + return NRF_SUCCESS; +} + +uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context) +{ + uint32_t timeout_periodic; + timer_node_t * p_node = (timer_node_t*)timer_id; + + // Check state and parameters + VERIFY_MODULE_INITIALIZED(); + + if (timer_id == 0) + { + return NRF_ERROR_INVALID_STATE; + } + if (timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS) + { + return NRF_ERROR_INVALID_PARAM; + } + if (p_node->p_timeout_handler == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + // Schedule timer start operation + timeout_periodic = (p_node->mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0; + + return timer_start_op_schedule(p_node, + timeout_ticks, + timeout_periodic, + p_context); +} + + +uint32_t app_timer_stop(app_timer_id_t timer_id) +{ + timer_node_t * p_node = (timer_node_t*)timer_id; + // Check state and parameters + VERIFY_MODULE_INITIALIZED(); + + if ((timer_id == NULL) || (p_node->p_timeout_handler == NULL)) + { + return NRF_ERROR_INVALID_STATE; + } + + p_node->is_running = false; + // Schedule timer stop operation + return timer_stop_op_schedule(p_node, TIMER_USER_OP_TYPE_STOP); +} + + +uint32_t app_timer_stop_all(void) +{ + // Check state + VERIFY_MODULE_INITIALIZED(); + + return timer_stop_op_schedule(NULL, TIMER_USER_OP_TYPE_STOP_ALL); +} + + +uint32_t app_timer_cnt_get(void) +{ + return rtc1_counter_get(); +} + + +uint32_t app_timer_cnt_diff_compute(uint32_t ticks_to, + uint32_t ticks_from, + uint32_t * p_ticks_diff) +{ + *p_ticks_diff = ticks_diff_get(ticks_to, ticks_from); + return NRF_SUCCESS; +} + +#if APP_TIMER_WITH_PROFILER +uint8_t app_timer_op_queue_utilization_get(void) +{ + return m_max_user_op_queue_utilization; +} +#endif +#endif //NRF_MODULE_ENABLED(APP_TIMER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_dox_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_dox_config.h new file mode 100644 index 0000000000..c142cfca40 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_dox_config.h @@ -0,0 +1,37 @@ +/** + * + * @defgroup app_timer_config Application timer functionality configuration + * @{ + * @ingroup app_timer + */ +/** @brief Enabling app_timer module + * + * Set to 1 to activate. + * + * @note This is an NRF_CONFIG macro. + */ +#define APP_TIMER_ENABLED + +/** @brief Enable app_timer profiling + * + * Set to 1 to activate. + * + * @note This is an NRF_CONFIG macro. + */ +#define APP_TIMER_WITH_PROFILER + + +/** @brief Enable RTC always on + * + * If option is enabled RTC is kept running even if there is no active timers. + * This option can be used when app_timer is used for timestamping. + * + * Set to 1 to activate. + * + * @note This is an NRF_CONFIG macro. + */ +#define APP_TIMER_KEEPS_RTC_ACTIVE + + + +/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_freertos.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_freertos.c new file mode 100644 index 0000000000..b7414b488e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_freertos.c @@ -0,0 +1,230 @@ +/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(APP_TIMER) +#include "FreeRTOS.h" +#include "task.h" +#include "timers.h" + +#include "app_timer.h" +#include +#include +#include "nrf.h" +#include "app_error.h" + +/* Check if RTC FreeRTOS version is used */ +#if configTICK_SOURCE != FREERTOS_USE_RTC +#error app_timer in FreeRTOS variant have to be used with RTC tick source configuration. Default configuration have to be used in other case. +#endif + +/** + * @brief Waiting time for the timer queue + * + * Number of system ticks to wait for the timer queue to put the message. + * It is strongly recommended to set this to the value bigger than 1. + * In other case if timer message queue is full - any operation on timer may fail. + * @note + * Timer functions called from interrupt context would never wait. + */ +#define APP_TIMER_WAIT_FOR_QUEUE 2 + +/**@brief This structure keeps information about osTimer.*/ +typedef struct +{ + void * argument; + TimerHandle_t osHandle; + app_timer_timeout_handler_t func; + /** + * This member is to make sure that timer function is only called if timer is running. + * FreeRTOS may have timer running even after stop function is called, + * because it processes commands in Timer task and stopping function only puts command into the queue. */ + bool active; +}app_timer_info_t; + +/** + * @brief Prescaler that was set by the user + * + * In FreeRTOS version of app_timer the prescaler setting is constant and done by the operating system. + * But the application expect the prescaler to be set according to value given in setup and then + * calculate required ticks using this value. + * For compatibility we remember the value set and use it for recalculation of required timer setting. + */ +static uint32_t m_prescaler; + +/* Check if freeRTOS timers are activated */ +#if configUSE_TIMERS == 0 + #error app_timer for freeRTOS requires configUSE_TIMERS option to be activated. +#endif + +/* Check if app_timer_t variable type can held our app_timer_info_t structure */ +STATIC_ASSERT(sizeof(app_timer_info_t) <= sizeof(app_timer_t)); + + +/** + * @brief Internal callback function for the system timer + * + * Internal function that is called from the system timer. + * It gets our parameter from timer data and sends it to user function. + * @param[in] xTimer Timer handler + */ +static void app_timer_callback(TimerHandle_t xTimer) +{ + app_timer_info_t * pinfo = (app_timer_info_t*)(pvTimerGetTimerID(xTimer)); + ASSERT(pinfo->osHandle == xTimer); + ASSERT(pinfo->func != NULL); + + if (pinfo->active) + pinfo->func(pinfo->argument); +} + + +uint32_t app_timer_init(uint32_t prescaler, + uint8_t op_queues_size, + void * p_buffer, + app_timer_evt_schedule_func_t evt_schedule_func) +{ + UNUSED_PARAMETER(op_queues_size); + UNUSED_PARAMETER(p_buffer); + UNUSED_PARAMETER(evt_schedule_func); + + m_prescaler = prescaler + 1; + + return NRF_SUCCESS; +} + + +uint32_t app_timer_create(app_timer_id_t const * p_timer_id, + app_timer_mode_t mode, + app_timer_timeout_handler_t timeout_handler) +{ + app_timer_info_t * pinfo = (app_timer_info_t*)(*p_timer_id); + uint32_t err_code = NRF_SUCCESS; + unsigned long timer_mode; + + if ((timeout_handler == NULL) || (p_timer_id == NULL)) + { + return NRF_ERROR_INVALID_PARAM; + } + if (pinfo->active) + { + return NRF_ERROR_INVALID_STATE; + } + + if (pinfo->osHandle == NULL) + { + /* New timer is created */ + memset(pinfo, 0, sizeof(app_timer_info_t)); + + if (mode == APP_TIMER_MODE_SINGLE_SHOT) + timer_mode = pdFALSE; + else + timer_mode = pdTRUE; + + pinfo->func = timeout_handler; + pinfo->osHandle = xTimerCreate(" ", 1000, timer_mode, pinfo, app_timer_callback); + + if (pinfo->osHandle == NULL) + err_code = NRF_ERROR_NULL; + } + else + { + /* Timer cannot be reinitialized using FreeRTOS API */ + return NRF_ERROR_INVALID_STATE; + } + + return err_code; +} + + +uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context) +{ + app_timer_info_t * pinfo = (app_timer_info_t*)(timer_id); + TimerHandle_t hTimer = pinfo->osHandle; + uint32_t rtc_prescaler = portNRF_RTC_REG->PRESCALER + 1; + /* Get back the microseconds to wait */ + uint32_t timeout_corrected = ROUNDED_DIV(timeout_ticks * m_prescaler, rtc_prescaler); + + if (hTimer == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + if (pinfo->active && (xTimerIsTimerActive(hTimer) != pdFALSE)) + { + // Timer already running - exit silently + return NRF_SUCCESS; + } + + pinfo->argument = p_context; + + if (__get_IPSR() != 0) + { + BaseType_t yieldReq = pdFALSE; + if (xTimerChangePeriodFromISR(hTimer, timeout_corrected, &yieldReq) != pdPASS) + { + return NRF_ERROR_NO_MEM; + } + + if ( xTimerStartFromISR(hTimer, &yieldReq) != pdPASS ) + { + return NRF_ERROR_NO_MEM; + } + + portYIELD_FROM_ISR(yieldReq); + } + else + { + if (xTimerChangePeriod(hTimer, timeout_corrected, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS) + { + return NRF_ERROR_NO_MEM; + } + + if (xTimerStart(hTimer, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS) + { + return NRF_ERROR_NO_MEM; + } + } + + pinfo->active = true; + return NRF_SUCCESS; +} + + +uint32_t app_timer_stop(app_timer_id_t timer_id) +{ + app_timer_info_t * pinfo = (app_timer_info_t*)(timer_id); + TimerHandle_t hTimer = pinfo->osHandle; + if (hTimer == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + if (__get_IPSR() != 0) + { + BaseType_t yieldReq = pdFALSE; + if (xTimerStopFromISR(timer_id, &yieldReq) != pdPASS) + { + return NRF_ERROR_NO_MEM; + } + portYIELD_FROM_ISR(yieldReq); + } + else + { + if (xTimerStop(timer_id, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS) + { + return NRF_ERROR_NO_MEM; + } + } + + pinfo->active = false; + return NRF_SUCCESS; +} +#endif //NRF_MODULE_ENABLED(APP_TIMER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c new file mode 100644 index 0000000000..117cba287e --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c @@ -0,0 +1,256 @@ +/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * Terms and conditions of usage are described in detail in NORDIC + * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * + * Licensees are granted free, non-transferable use of the information. NO + * WARRANTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(APP_TIMER) +#include "app_timer.h" +#include +#include "nrf.h" +#include "nrf_soc.h" +#include "app_error.h" +#include "cmsis_os.h" +#include "app_util_platform.h" + +#define RTC1_IRQ_PRI APP_IRQ_PRIORITY_LOWEST /**< Priority of the RTC1 interrupt. */ + +#define MAX_RTC_COUNTER_VAL 0x00FFFFFF /**< Maximum value of the RTC counter. */ + +/**@brief This structure keeps information about osTimer.*/ +typedef struct +{ + osTimerDef_t timerDef; + uint32_t buffer[6]; + osTimerId id; +}app_timer_info_t; + +/**@brief Store an array of timers with configuration. */ +typedef struct +{ + uint8_t max_timers; /**< The maximum number of timers*/ + uint32_t prescaler; + app_timer_info_t * app_timers; /**< Pointer to table of timers*/ +}app_timer_control_t; +app_timer_control_t app_timer_control; + +/**@brief This structure is defined by RTX. It keeps information about created osTimers. It is used in app_timer_start(). */ +typedef struct os_timer_cb_ +{ + struct os_timer_cb_ * next; /**< Pointer to next active Timer */ + uint8_t state; /**< Timer State */ + uint8_t type; /**< Timer Type (Periodic/One-shot). */ + uint16_t reserved; /**< Reserved. */ + uint32_t tcnt; /**< Timer Delay Count. */ + uint32_t icnt; /**< Timer Initial Count. */ + void * arg; /**< Timer Function Argument. */ + const osTimerDef_t * timer; /**< Pointer to Timer definition. */ +} os_timer_cb; + +/**@brief This functions are defined by RTX.*/ +//lint --save -e10 -e19 -e526 +extern osStatus svcTimerStop(osTimerId timer_id); /**< Used in app_timer_stop(). */ +extern osStatus svcTimerStart(osTimerId timer_id, uint32_t millisec); /**< Used in app_timer_start(). */ +// lint --restore +static void * rt_id2obj (void *id) /**< Used in app_timer_start(). This function gives information if osTimerID is valid */ +{ + if ((uint32_t)id & 3U) + { + return NULL; + } + +#ifdef OS_SECTIONS_LINK_INFO + + if ((os_section_id$$Base != 0U) && (os_section_id$$Limit != 0U)) + { + if (id < (void *)os_section_id$$Base) + { + return NULL; + } + + if (id >= (void *)os_section_id$$Limit) + { + return NULL; + } + } +#endif + + return id; +} + + + +uint32_t app_timer_init(uint32_t prescaler, + uint8_t op_queues_size, + void * p_buffer, + app_timer_evt_schedule_func_t evt_schedule_func) +{ + if (p_buffer == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + app_timer_control.prescaler = prescaler; + app_timer_control.app_timers = p_buffer; + NVIC_SetPriority(RTC1_IRQn, RTC1_IRQ_PRI); + + return NRF_SUCCESS; +} + + +uint32_t app_timer_create(app_timer_id_t const * p_timer_id, + app_timer_mode_t mode, + app_timer_timeout_handler_t timeout_handler) +{ + + if ((timeout_handler == NULL) || (p_timer_id == NULL)) + { + return NRF_ERROR_INVALID_PARAM; + } + + app_timer_info_t * p_timer_info = (app_timer_info_t *)*p_timer_id; + p_timer_info->timerDef.timer = p_timer_info->buffer; + p_timer_info->timerDef.ptimer = (os_ptimer)timeout_handler; + + p_timer_info->id = osTimerCreate(&(p_timer_info->timerDef), (os_timer_type)mode, NULL); + + if (p_timer_info->id) + return NRF_SUCCESS; + else + { + return NRF_ERROR_INVALID_PARAM; // This error is unspecified by rtx + } +} + +#define osTimerRunning 2 +uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context) +{ + if ((timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS)) + { + return NRF_ERROR_INVALID_PARAM; + } + uint32_t timeout_ms = + ((uint32_t)ROUNDED_DIV(timeout_ticks * 1000 * (app_timer_control.prescaler + 1), + (uint32_t)APP_TIMER_CLOCK_FREQ)); + + app_timer_info_t * p_timer_info = (app_timer_info_t *)timer_id; + if (rt_id2obj((void *)p_timer_info->id) == NULL) + return NRF_ERROR_INVALID_PARAM; + + // Pass p_context to timer_timeout_handler + ((os_timer_cb *)(p_timer_info->id))->arg = p_context; + + if (((os_timer_cb *)(p_timer_info->id))->state == osTimerRunning) + { + return NRF_SUCCESS; + } + // osTimerStart() returns osErrorISR if it is called in interrupt routine. + switch (osTimerStart((osTimerId)p_timer_info->id, timeout_ms) ) + { + case osOK: + return NRF_SUCCESS; + + case osErrorISR: + break; + + case osErrorParameter: + return NRF_ERROR_INVALID_PARAM; + + default: + return NRF_ERROR_INVALID_PARAM; + } + + // Start timer without svcCall + switch (svcTimerStart((osTimerId)p_timer_info->id, timeout_ms)) + { + case osOK: + return NRF_SUCCESS; + + case osErrorISR: + return NRF_ERROR_INVALID_STATE; + + case osErrorParameter: + return NRF_ERROR_INVALID_PARAM; + + default: + return NRF_ERROR_INVALID_PARAM; + } +} + +uint32_t app_timer_stop(app_timer_id_t timer_id) +{ + app_timer_info_t * p_timer_info = (app_timer_info_t *)timer_id; + switch (osTimerStop((osTimerId)p_timer_info->id) ) + { + case osOK: + return NRF_SUCCESS; + + case osErrorISR: + break; + + case osErrorParameter: + return NRF_ERROR_INVALID_PARAM; + + case osErrorResource: + return NRF_SUCCESS; + + default: + return NRF_ERROR_INVALID_PARAM; + } + + // Stop timer without svcCall + switch (svcTimerStop((osTimerId)p_timer_info->id)) + { + case osOK: + return NRF_SUCCESS; + + case osErrorISR: + return NRF_ERROR_INVALID_STATE; + + case osErrorParameter: + return NRF_ERROR_INVALID_PARAM; + + case osErrorResource: + return NRF_SUCCESS; + + default: + return NRF_ERROR_INVALID_PARAM; + } +} + + +uint32_t app_timer_stop_all(void) +{ + for (int i = 0; i < app_timer_control.max_timers; i++) + { + if (app_timer_control.app_timers[i].id) + { + (void)app_timer_stop((app_timer_id_t)app_timer_control.app_timers[i].id); + } + } + return 0; +} + + +extern uint32_t os_tick_val(void); +uint32_t app_timer_cnt_get(void) +{ + return os_tick_val(); +} + + +uint32_t app_timer_cnt_diff_compute(uint32_t ticks_to, + uint32_t ticks_from, + uint32_t * p_ticks_diff) +{ + *p_ticks_diff = ((ticks_to - ticks_from) & MAX_RTC_COUNTER_VAL); + return NRF_SUCCESS; +} +#endif //NRF_MODULE_ENABLED(APP_TIMER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_bitmask.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_bitmask.h new file mode 100644 index 0000000000..258734a269 --- /dev/null +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_bitmask.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is confidential property of Nordic Semiconductor. The use, + * copying, transfer or disclosure of such information is prohibited except by express written + * agreement with Nordic Semiconductor. + * + */ + + +#ifndef NRF_BITMASK_H +#define NRF_BITMASK_H + +#include "compiler_abstraction.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define BITMASK_BYTE_GET(abs_bit) ((abs_bit)/8) +#define BITMASK_RELBIT_GET(abs_bit) ((abs_bit) & 0x00000007) + +/** + * Function for checking if bit in the multi-byte bit mask is set. + * + * @param bit Bit index. + * @param p_mask A pointer to mask with bit fields. + * + * @return 0 if bit is not set, positive value otherwise. + */ +__STATIC_INLINE uint32_t nrf_bitmask_bit_is_set(uint32_t bit, void const * p_mask) +{ + uint8_t const * p_mask8 = (uint8_t const *)p_mask; + uint32_t byte_idx = BITMASK_BYTE_GET(bit); + bit = BITMASK_RELBIT_GET(bit); + return (1 << bit) & p_mask8[byte_idx]; +} + +/** + * Function for setting a bit in the multi-byte bit mask. + * + * @param bit Bit index. + * @param p_mask A pointer to mask with bit fields. + */ +__STATIC_INLINE void nrf_bitmask_bit_set(uint32_t bit, void * p_mask) +{ + uint8_t * p_mask8 = (uint8_t *)p_mask; + uint32_t byte_idx = BITMASK_BYTE_GET(bit); + bit = BITMASK_RELBIT_GET(bit); + p_mask8[byte_idx] |= (1 << bit); +} + +/** + * Function for clearing a bit in the multi-byte bit mask. + * + * @param bit Bit index. + * @param p_mask A pointer to mask with bit fields. + */ +__STATIC_INLINE void nrf_bitmask_bit_clear(uint32_t bit, void * p_mask) +{ + uint8_t * p_mask8 = (uint8_t *)p_mask; + uint32_t byte_idx = BITMASK_BYTE_GET(bit); + bit = BITMASK_RELBIT_GET(bit); + p_mask8[byte_idx] &= ~(1 << bit); +} + +/** + * Function for performing bitwise OR operation on two multi-byte bit masks. + * + * @param p_mask1 A pointer to the first bit mask. + * @param p_mask2 A pointer to the second bit mask. + * @param p_mask_out A pointer to the output bit mask. + * @param length Length of output mask in bytes. + */ +__STATIC_INLINE void nrf_bitmask_masks_or(void const * p_mask1, + void const * p_mask2, + void * p_out_mask, + uint32_t length) +{ + uint8_t const * p_mask8_1 = (uint8_t const *)p_mask1; + uint8_t const * p_mask8_2 = (uint8_t const *)p_mask2; + uint8_t * p_mask8_out = (uint8_t *)p_out_mask; + uint32_t i; + for (i = 0; i < length; i++) + { + p_mask8_out[i] = p_mask8_1[i] | p_mask8_2[i]; + } +} + +/** + * Function for performing bitwise AND operation on two multi-byte bit masks. + * + * @param p_mask1 A pointer to the first bit mask. + * @param p_mask2 A pointer to the second bit mask. + * @param p_mask_out A pointer to the output bit mask. + * @param length Length of output mask in bytes. + */ +__STATIC_INLINE void nrf_bitmask_masks_and(void const * p_mask1, + void const * p_mask2, + void * p_out_mask, + uint32_t length) +{ + uint8_t const * p_mask8_1 = (uint8_t const *)p_mask1; + uint8_t const * p_mask8_2 = (uint8_t const *)p_mask2; + uint8_t * p_mask8_out = (uint8_t *)p_out_mask; + uint32_t i; + for (i = 0; i < length; i++) + { + p_mask8_out[i] = p_mask8_1[i] & p_mask8_2[i]; + } +} + +#ifdef __cplusplus +} +#endif + +#endif //NRF_BITMASK_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c index c52fac72c3..3a219ad449 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c @@ -45,7 +45,6 @@ #include "mbed_error.h" #include "nrf_uart.h" #include "nrf_drv_common.h" -#include "nrf_drv_config.h" #include "app_util_platform.h" #include "nrf_gpio.h" @@ -56,8 +55,8 @@ #define UART_INSTANCE_ID 0 #define UART_CB uart_cb[UART_INSTANCE_ID] -#define UART_DEFAULT_BAUDRATE UART0_CONFIG_BAUDRATE -#define UART_DEFAULT_PARITY UART0_CONFIG_PARITY +#define UART_DEFAULT_BAUDRATE UART_DEFAULT_CONFIG_BAUDRATE +#define UART_DEFAULT_PARITY UART_DEFAULT_CONFIG_PARITY // expected the macro from mbed configuration system #ifndef MBED_CONF_NORDIC_UART_HWFC @@ -66,17 +65,17 @@ #endif #if MBED_CONF_NORDIC_UART_HWFC == 1 - #define UART_DEFAULT_HWFC UART0_CONFIG_HWFC + #define UART_DEFAULT_HWFC UART_DEFAULT_CONFIG_HWFC #else #define UART_DEFAULT_HWFC NRF_UART_HWFC_DISABLED #endif -#define UART_DEFAULT_CTS UART0_CONFIG_PSEL_CTS -#define UART_DEFAULT_RTS UART0_CONFIG_PSEL_RTS +#define UART_DEFAULT_CTS CTS_PIN_NUMBER +#define UART_DEFAULT_RTS RTS_PIN_NUMBER #ifdef NRF51 #define NRFx_MBED_UART_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW -#elif defined(NRF52) +#elif defined(NRF52) || defined(NRF52840_XXAA) #define NRFx_MBED_UART_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST #endif @@ -555,7 +554,7 @@ static void internal_set_hwfc(FlowControl type, nrf_gpio_cfg_input(UART_CB.pselcts, NRF_GPIO_PIN_NOPULL); } - UART_CB.hwfc = (type == FlowControlNone)? NRF_UART_HWFC_DISABLED : UART0_CONFIG_HWFC; + UART_CB.hwfc = (type == FlowControlNone)? NRF_UART_HWFC_DISABLED : UART_DEFAULT_CONFIG_HWFC; nrf_uart_configure(UART_INSTANCE, UART_CB.parity, UART_CB.hwfc); nrf_uart_hwfc_pins_set(UART_INSTANCE, UART_CB.pselrts, UART_CB.pselcts); diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c index cb677400d1..3d917c2dae 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c @@ -33,7 +33,7 @@ void sleep(void) // the processor from disabled interrupts. SCB->SCR |= SCB_SCR_SEVONPEND_Msk; -#ifdef NRF52 +#if defined(NRF52) || defined(NRF52840_XXAA) /* Clear exceptions and PendingIRQ from the FPU unit */ __set_FPSCR(__get_FPSCR() & ~(FPU_EXCEPTION_MASK)); (void) __get_FPSCR(); @@ -41,7 +41,7 @@ void sleep(void) #endif // If the SoftDevice is enabled, its API must be used to go to sleep. - if (softdevice_handler_isEnabled()) { + if (softdevice_handler_is_enabled()) { sd_power_mode_set(NRF_POWER_MODE_LOWPWR); sd_app_evt_wait(); } else { diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c index 985d24fcc6..f2b60de00b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c @@ -186,7 +186,7 @@ static void slave_event_handler(uint8_t spi_idx, // And prepare for the next transfer. // Previous data set in 'spi_slave_write' (if any) has been transmitted, // now use the default one, until some new is set by 'spi_slave_write'. - p_spi_info->tx_buf = NRF_DRV_SPIS_DEFAULT_ORC; + p_spi_info->tx_buf = SPIS_DEFAULT_ORC; nrf_drv_spis_buffers_set(&m_instances[spi_idx].slave, (uint8_t const *)&p_spi_info->tx_buf, 1, (uint8_t *)&p_spi_info->rx_buf, 1); @@ -228,7 +228,7 @@ static void prepare_master_config(nrf_drv_spi_config_t *p_config, p_config->frequency = p_spi_info->frequency; p_config->mode = (nrf_drv_spi_mode_t)p_spi_info->spi_mode; - p_config->irq_priority = SPI1_CONFIG_IRQ_PRIORITY; + p_config->irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY; p_config->orc = 0xFF; p_config->bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST; } @@ -242,9 +242,9 @@ static void prepare_slave_config(nrf_drv_spis_config_t *p_config, p_config->csn_pin = p_spi_info->ss_pin; p_config->mode = (nrf_drv_spis_mode_t)p_spi_info->spi_mode; - p_config->irq_priority = SPIS1_CONFIG_IRQ_PRIORITY; - p_config->orc = NRF_DRV_SPIS_DEFAULT_ORC; - p_config->def = NRF_DRV_SPIS_DEFAULT_DEF; + p_config->irq_priority = SPIS_DEFAULT_CONFIG_IRQ_PRIORITY; + p_config->orc = SPIS_DEFAULT_ORC; + p_config->def = SPIS_DEFAULT_DEF; p_config->bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST; p_config->csn_pullup = NRF_DRV_SPIS_DEFAULT_CSN_PULLUP; p_config->miso_drive = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE; @@ -360,7 +360,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) m_slave_event_handlers[SPI_IDX(obj)]); // Prepare the slave for transfer. - p_spi_info->tx_buf = NRF_DRV_SPIS_DEFAULT_ORC; + p_spi_info->tx_buf = SPIS_DEFAULT_ORC; nrf_drv_spis_buffers_set(SLAVE_INST(obj), (uint8_t const *)&p_spi_info->tx_buf, 1, (uint8_t *)&p_spi_info->rx_buf, 1); diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c index d3a9c9d63e..d7267b81cc 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c @@ -40,7 +40,6 @@ #include "common_rtc.h" #include "app_util.h" #include "nrf_drv_common.h" -#include "nrf_drv_config.h" #include "lp_ticker_api.h" @@ -132,7 +131,7 @@ void common_rtc_init(void) nrf_drv_common_irq_enable(nrf_drv_get_IRQn(COMMON_RTC_INSTANCE), #ifdef NRF51 APP_IRQ_PRIORITY_LOW -#elif defined(NRF52) +#elif defined(NRF52) || defined(NRF52840_XXAA) APP_IRQ_PRIORITY_LOWEST #endif ); diff --git a/targets/TARGET_NORDIC/mbed_rtx.h b/targets/TARGET_NORDIC/mbed_rtx.h index 7041a37f61..15c1ef684f 100644 --- a/targets/TARGET_NORDIC/mbed_rtx.h +++ b/targets/TARGET_NORDIC/mbed_rtx.h @@ -55,6 +55,21 @@ #define OS_CLOCK 64000000 #endif +#elif defined(TARGET_MCU_NRF52840) + +#ifndef INITIAL_SP +#define INITIAL_SP (0x20040000UL) +#endif +#ifndef OS_TASKCNT +#define OS_TASKCNT 24 +#endif +#ifndef OS_MAINSTKSIZE +#define OS_MAINSTKSIZE 2048 +#endif +#ifndef OS_CLOCK +#define OS_CLOCK 64000000 #endif -#endif +#endif // defined(TARGET_MCU_NRF51822)... + +#endif // #ifndef MBED_MBED_RTX_H diff --git a/targets/targets.json b/targets/targets.json index 1297e9a507..9d47dec698 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -2557,6 +2557,52 @@ }, "device_name": "nRF52832_xxAA" }, + "MCU_NRF52840": { + "inherits": ["Target"], + "core": "Cortex-M4F", + "macros": ["TARGET_NRF52840", "BLE_STACK_SUPPORT_REQD", "SOFTDEVICE_PRESENT", "S140", "NRF_SD_BLE_API_VERSION=5", "NRF52840_XXAA", "NRF_DFU_SETTINGS_VERSION=1"], + "extra_labels": ["NORDIC", "MCU_NRF52840", "NRF5_SDK13"], + "OUTPUT_EXT": "hex", + "is_disk_virtual": true, + "supported_toolchains": ["GCC_ARM", "ARM", "IAR"], + "public": false, + "detect_code": ["1101"], + "program_cycle_s": 6, + "MERGE_SOFT_DEVICE": true, + "EXPECTED_SOFTDEVICES_WITH_OFFSETS": [ + { + "boot": "", + "name": "s140_nrf52840_5.0.0-1.alpha_softdevice.hex", + "offset": 135168 + } + ], + "bootloader_select_index": 0, + "post_binary_hook": { + "function": "MCU_NRF51Code.binary_hook", + "toolchains": ["ARM_STD", "GCC_ARM", "IAR"] + }, + "MERGE_BOOTLOADER": false, + "features": [], + "config": { + "lf_clock_src": { + "value": "NRF_LF_SRC_XTAL", + "macro_name": "MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC" + }, + "uart_hwfc": { + "help": "Value: 1 for enable, 0 for disable", + "value": 1, + "macro_name": "MBED_CONF_NORDIC_UART_HWFC" + } + } + }, + "NRF52840_DK": { + "supported_form_factors": ["ARDUINO"], + "inherits": ["MCU_NRF52840"], + "macros_add": ["BOARD_PCA10056", "CONFIG_GPIO_AS_PINRESET", "SWI_DISABLE0"], + "device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE"], + "release_versions": ["2", "5"], + "device_name": "nRF52840_xxAA" + }, "BLUEPILL_F103C8": { "core": "Cortex-M3", "default_toolchain": "GCC_ARM", From aef41216a9b47e4fd0b5d235623ade15db26c72e Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 23 Dec 2016 15:33:39 +0100 Subject: [PATCH 08/31] ported-fixed for nRF52840 port + serial + analog + pin description + gpio + cmsis vector opp + gcc startup/scater file --- .../TARGET_MCU_NRF52832/pwmout_api.c | 399 ------------------ .../TARGET_MCU_NRF52840/PortNames.h | 3 +- .../TARGET_NRF52840_DK/PinNames.h | 242 ++++++----- .../TARGET_MCU_NRF52840/analogin_api.c | 91 ---- .../device/TOOLCHAIN_ARM_STD/nRF52832.sct | 22 +- .../TOOLCHAIN_ARM_STD/startup_nrf52832.s | 24 ++ .../TOOLCHAIN_GCC_ARM/startup_NRF52832.S | 13 + .../TARGET_MCU_NRF52840/device/cmsis_nvic.h | 2 +- .../TARGET_MCU_NRF52840/sdk/sdk_config.h | 6 +- .../{TARGET_MCU_NRF52832 => }/analogin_api.c | 32 ++ .../TARGET_NRF5_SDK13/gpio_api.c | 31 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h | 5 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c | 6 +- .../TARGET_NRF5_SDK13/port_api.c | 22 +- .../{TARGET_MCU_NRF52840 => }/pwmout_api.c | 0 15 files changed, 255 insertions(+), 643 deletions(-) delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/pwmout_api.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/analogin_api.c rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52832 => }/analogin_api.c (76%) rename targets/TARGET_NORDIC/TARGET_NRF5_SDK13/{TARGET_MCU_NRF52840 => }/pwmout_api.c (100%) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/pwmout_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/pwmout_api.c deleted file mode 100644 index 97e29f256d..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/pwmout_api.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "mbed_assert.h" -#include "mbed_error.h" -#include "pwmout_api.h" -#include "cmsis.h" -#include "pinmap.h" - -#if DEVICE_PWMOUT - -#include "app_util_platform.h" -#include "nrf_drv_pwm.h" - -#define MAX_PWM_COUNTERTOP (0x7FFF) // 0x7FFF is the max of COUNTERTOP value for the PWM peripherial of the nRF52. -#define MAX_PWM_PERIOD_US (MAX_PWM_COUNTERTOP * 8) // PWM hw is driven by 16 MHz clock, hence the tick is 1_us/16, - // and 128 is the max prescaler value. -#define MAX_PWM_PERIOD_MS ((MAX_PWM_PERIOD_US / 1000) + 1) // approximations advance -#define MAX_PWM_PERIOD_S ((MAX_PWM_PERIOD_US / 1000000) + 1) // approximations advance - - -#define PWM_INSTANCE_COUNT (PWM_COUNT) // import from the nrf_drv_config.h file - -///> instances of nRF52 PWM driver -static const nrf_drv_pwm_t m_pwm_driver[PWM_INSTANCE_COUNT] = -{ -#if PWM0_ENABLED - NRF_DRV_PWM_INSTANCE(0), -#endif -#if PWM1_ENABLED - NRF_DRV_PWM_INSTANCE(1), -#endif -#if PWM2_ENABLED - NRF_DRV_PWM_INSTANCE(2) -#endif -}; - -typedef struct -{ - uint32_t period_us; - uint32_t duty_us; - float duty; -} pwm_signal_t; /// PWM signal description type - -typedef struct -{ - nrf_drv_pwm_t * p_pwm_driver; - pwm_signal_t signal; - volatile nrf_pwm_values_common_t seq_values[1]; -} pwm_t; /// internal PWM instance support type - -static pwm_t m_pwm[PWM_INSTANCE_COUNT] = -{ -#if PWM0_ENABLED - {.p_pwm_driver = NULL}, -#endif -#if PWM1_ENABLED - {.p_pwm_driver = NULL}, -#endif -#if PWM2_ENABLED - {.p_pwm_driver = NULL} -#endif -}; /// Array of internal PWM instances. - -typedef struct -{ - uint16_t period_hwu; // unit related to pwm_clk - uint16_t duty_hwu; // unit related to pwm_clk - nrf_pwm_clk_t pwm_clk; -} pulsewidth_set_t; /// helper type for timing calculations - - -static void internal_pwmout_exe(pwmout_t *obj, bool new_period, bool initialization); - -// extern PWM nIRQ handler implementations -void PWM0_IRQHandler(void); -void PWM1_IRQHandler(void); -void PWM2_IRQHandler(void); - -static const peripheral_handler_desc_t pwm_handlers[PWM_INSTANCE_COUNT] = -{ - { - PWM0_IRQn, - (uint32_t)PWM0_IRQHandler - }, - { - PWM1_IRQn, - (uint32_t)PWM1_IRQHandler - }, - { - PWM2_IRQn, - (uint32_t)PWM2_IRQHandler - } -}; - -void pwmout_init(pwmout_t *obj, PinName pin) -{ - uint32_t i; - - for (i = 0; PWM_INSTANCE_COUNT; i++) - { - if (m_pwm[i].p_pwm_driver == NULL) // a driver instance not assigned to the obj? - { - NVIC_SetVector(pwm_handlers[i].IRQn, pwm_handlers[i].vector); - - obj->pin = pin; - - obj->pwm_channel = i; - - m_pwm[i].p_pwm_driver = (nrf_drv_pwm_t *) &m_pwm_driver[i]; - m_pwm[i].signal.period_us = 200000; // 0.02 s - m_pwm[i].signal.duty_us = 100000; - m_pwm[i].signal.duty = 0.5f; - - obj->pwm_struct = &m_pwm[i]; - - internal_pwmout_exe(obj, true, true); - - break; - } - } - - MBED_ASSERT(i != PWM_INSTANCE_COUNT); // assert if free instance was not found. -} - -void pwmout_free(pwmout_t *obj) -{ - nrf_drv_pwm_uninit( (nrf_drv_pwm_t*) obj->pwm_struct ); - - m_pwm[obj->pwm_channel].p_pwm_driver = NULL; -} - -void pwmout_write(pwmout_t *obj, float percent) -{ - - if (percent < 0) - { - percent = 0; - } - else if (percent > 1) - { - percent = 1; - } - - pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); - - p_pwm_signal->duty = percent; - - int us = (((int)p_pwm_signal->period_us) * percent); - - pwmout_pulsewidth_us(obj, us); -} - -float pwmout_read(pwmout_t *obj) -{ - pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); - - return (float)p_pwm_signal->duty_us / (float)p_pwm_signal->period_us; -} - -void pwmout_period(pwmout_t *obj, float seconds) -{ - // raught saturation < 0, quasi-max> - if (seconds > MAX_PWM_PERIOD_S) - { - seconds = MAX_PWM_PERIOD_S; - } - else if (seconds < 0) - { - seconds = 0; // f. pwmout_period_us will set period to min. value - } - - int us = seconds * 1000000; - - pwmout_period_us(obj, us); -} - -void pwmout_period_ms(pwmout_t *obj, int ms) -{ - // reught saturation < 0, quasi-max> - if (ms > MAX_PWM_PERIOD_MS) - { - ms = MAX_PWM_PERIOD_MS; - } - else if (ms < 0) - { - ms = 0; // f. pwmout_period_us will set period to min. value - } - - int us = ms * 1000; - - pwmout_period_us(obj, us); -} - - -void pwmout_period_us(pwmout_t *obj, int us) -{ - pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); - - // saturation <1, real-max> - if (us > MAX_PWM_PERIOD_US) - { - us = MAX_PWM_PERIOD_US; - } - else if (us < 1) - { - us = 1; - } - - p_pwm_signal->duty_us = (int)((float)us * p_pwm_signal->duty); - - p_pwm_signal->period_us = us; - - internal_pwmout_exe(obj, true, false); -} - -void pwmout_pulsewidth(pwmout_t *obj, float seconds) -{ - // raught saturation < 0, quasi-max> - if (seconds > MAX_PWM_PERIOD_S) - { - seconds = MAX_PWM_PERIOD_S; - } - else if (seconds < 0) - { - seconds = 0; - } - - int us = seconds * 1000000; - - pwmout_pulsewidth_us(obj,us); -} - -void pwmout_pulsewidth_ms(pwmout_t *obj, int ms) -{ - // raught saturation < 0, quasi-max> - if (ms > MAX_PWM_PERIOD_MS) - { - ms = MAX_PWM_PERIOD_MS; - } - else if (ms < 0) - { - ms = 0; - } - - int us = ms * 1000; - - pwmout_pulsewidth_us(obj, us); -} - -void pwmout_pulsewidth_us(pwmout_t *obj, int us) -{ - // saturation <0, real-max> - if (us > MAX_PWM_PERIOD_US) - { - us = MAX_PWM_PERIOD_US; - } - else if (us < 0) - { - us = 0; - } - - pwm_signal_t * p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); - - p_pwm_signal->duty_us = us; - p_pwm_signal->duty = us / p_pwm_signal->period_us; - - internal_pwmout_exe(obj, false, false); -} - - - - - - -static ret_code_t pulsewidth_us_set_get(int period_hwu, int duty_hwu, pulsewidth_set_t * p_settings) -{ - uint16_t div; - nrf_pwm_clk_t pwm_clk = NRF_PWM_CLK_16MHz; - - for(div = 1; div <= 128 ; div <<= 1) // 128 is the maximum of clock prescaler for PWM peripherial - { - if (MAX_PWM_COUNTERTOP >= period_hwu) - { - p_settings->period_hwu = period_hwu; // unit [us/16 * div] - p_settings->duty_hwu = duty_hwu; // unit [us/16 * div] - p_settings->pwm_clk = pwm_clk; - - return NRF_SUCCESS; - } - - period_hwu >>= 1; - duty_hwu >>= 1; - pwm_clk++; - } - - return NRF_ERROR_INVALID_PARAM; -} - - -static void internal_pwmout_exe(pwmout_t *obj, bool new_period, bool initialization) -{ - pulsewidth_set_t pulsewidth_set; - pwm_signal_t * p_pwm_signal; - nrf_drv_pwm_t * p_pwm_driver; - ret_code_t ret_code; - - p_pwm_signal = &(((pwm_t*)obj->pwm_struct)->signal); - - if (NRF_SUCCESS == pulsewidth_us_set_get(p_pwm_signal->period_us * 16, // base clk for PWM is 16 MHz - p_pwm_signal->duty_us * 16, // base clk for PWM is 16 MHz - &pulsewidth_set)) - { - p_pwm_driver = (((pwm_t*)obj->pwm_struct)->p_pwm_driver); - - const nrf_pwm_sequence_t seq = - { - .values.p_common = (nrf_pwm_values_common_t*) (((pwm_t*)obj->pwm_struct)->seq_values), - .length = 1, - .repeats = 0, - .end_delay = 0 - }; - - (((pwm_t*)obj->pwm_struct)->seq_values)[0] = pulsewidth_set.duty_hwu | 0x8000; - - if (new_period) - { - nrf_drv_pwm_config_t config0 = - { - .output_pins = - { - obj->pin | NRF_DRV_PWM_PIN_INVERTED, // channel 0 - NRF_DRV_PWM_PIN_NOT_USED, // channel 1 - NRF_DRV_PWM_PIN_NOT_USED, // channel 2 - NRF_DRV_PWM_PIN_NOT_USED, // channel 3 - }, - .irq_priority = PWM0_CONFIG_IRQ_PRIORITY, - .base_clock = pulsewidth_set.pwm_clk, - .count_mode = NRF_PWM_MODE_UP, - .top_value = pulsewidth_set.period_hwu, - .load_mode = NRF_PWM_LOAD_COMMON, - .step_mode = NRF_PWM_STEP_AUTO - }; - - if (!initialization) - { - nrf_drv_pwm_uninit(p_pwm_driver); - } - - ret_code = nrf_drv_pwm_init( p_pwm_driver, &config0, NULL); - - MBED_ASSERT(ret_code == NRF_SUCCESS); // assert if free instance was not found. - } - - nrf_drv_pwm_simple_playback(p_pwm_driver, &seq, 0, NRF_DRV_PWM_FLAG_LOOP); - } - else - { - MBED_ASSERT(0); // force assertion - } - -} - -#endif // DEVICE_PWMOUT diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h index c63624639b..2e8d6769c4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h @@ -44,7 +44,8 @@ extern "C" { #endif typedef enum { - Port0 = 0 //GPIO pins 0-31 + Port0 = 0, //GPIO pins 0-31 -> 0.0-0.31 + Port1 = 1 //GPIO pins 32-47 -> 1.0-1.15 } PortName; #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h index 2b86eca485..5d860570c0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h @@ -40,6 +40,7 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "nrf_gpio.h" #ifdef __cplusplus extern "C" { @@ -52,85 +53,122 @@ typedef enum { #define PORT_SHIFT 3 -typedef enum { - p0 = 0, - p1 = 1, - p2 = 2, - p3 = 3, - p4 = 4, - p5 = 5, - p6 = 6, - p7 = 7, - p8 = 8, - p9 = 9, - p10 = 10, - p11 = 11, - p12 = 12, - p13 = 13, - p14 = 14, - p15 = 15, - p16 = 16, - p17 = 17, - p18 = 18, - p19 = 19, - p20 = 20, - p21 = 21, - p22 = 22, - p23 = 23, - p24 = 24, - p25 = 25, - p26 = 26, - p27 = 27, - p28 = 28, - p29 = 29, - p30 = 30, - p31 = 31, +///> define macro producing for example Px_y = NRF_GPIO_PIN_MAP(x, y) +#define PinDef(port_num, pin_num) P##port_num##_##pin_num = NRF_GPIO_PIN_MAP(port_num, pin_num) - P0_0 = p0, - P0_1 = p1, - P0_2 = p2, - P0_3 = p3, - P0_4 = p4, - P0_5 = p5, - P0_6 = p6, - P0_7 = p7, - P0_8 = p8, - P0_9 = p9, - P0_10 = p10, - P0_11 = p11, - P0_12 = p12, - P0_13 = p13, - P0_14 = p14, - P0_15 = p15, +typedef enum { + PinDef(0 , 0), // P0_0 = 0... + PinDef(0 , 1), + PinDef(0 , 2), + PinDef(0 , 3), + PinDef(0 , 4), + PinDef(0 , 5), + PinDef(0 , 6), + PinDef(0 , 7), + PinDef(0 , 8), + PinDef(0 , 9), + PinDef(0 , 10), + PinDef(0 , 11), + PinDef(0 , 12), + PinDef(0 , 13), + PinDef(0 , 14), + PinDef(0 , 15), + PinDef(0 , 16), + PinDef(0 , 17), + PinDef(0 , 18), + PinDef(0 , 19), + PinDef(0 , 20), + PinDef(0 , 21), + PinDef(0 , 22), + PinDef(0 , 23), + PinDef(0 , 24), + PinDef(0 , 25), + PinDef(0 , 26), + PinDef(0 , 27), + PinDef(0 , 28), + PinDef(0 , 29), + PinDef(0 , 30), + PinDef(0 , 31), + + PinDef(1 , 0), //P1_1 = 32... + PinDef(1 , 1), + PinDef(1 , 2), + PinDef(1 , 3), + PinDef(1 , 4), + PinDef(1 , 5), + PinDef(1 , 6), + PinDef(1 , 7), + PinDef(1 , 8), + PinDef(1 , 9), + PinDef(1 , 10), + PinDef(1 , 11), + PinDef(1 , 12), + PinDef(1 , 13), + PinDef(1 , 14), + PinDef(1 , 15), + + // Port0 + p0 = P0_0, + p1 = P0_1, + p2 = P0_2, + p3 = P0_3, + p4 = P0_4, + p5 = P0_5, + p6 = P0_6, + p7 = P0_7, + p8 = P0_8, + p9 = P0_9, + p10 = P0_10, + p11 = P0_11, + p12 = P0_12, + p13 = P0_13, + p14 = P0_14, + p15 = P0_15, + p16 = P0_16, + p17 = P0_17, + p18 = P0_18, + p19 = P0_19, + p20 = P0_20, + p21 = P0_21, + p22 = P0_22, + p23 = P0_23, + p24 = P0_24, + p25 = P0_25, + p26 = P0_26, + p27 = P0_27, + p28 = P0_28, + p29 = P0_29, + p30 = P0_30, + p31 = P0_31, + + // Port1 + p32 = P1_0, + p33 = P1_1, + p34 = P1_2, + p35 = P1_3, + p36 = P1_4, + p37 = P1_5, + p38 = P1_6, + p39 = P1_7, + p40 = P1_8, + p41 = P1_9, + p42 = P1_10, + p43 = P1_11, + p44 = P1_12, + p45 = P1_13, + p46 = P1_14, + p47 = P1_15, + + LED1 = p13, + LED2 = p14, + LED3 = p15, + LED4 = p16, - P0_16 = p16, - P0_17 = p17, - P0_18 = p18, - P0_19 = p19, - P0_20 = p20, - P0_21 = p21, - P0_22 = p22, - P0_23 = p23, - - P0_24 = p24, - P0_25 = p25, - P0_26 = p26, - P0_27 = p27, - P0_28 = p28, - P0_29 = p29, - P0_30 = p30, - P0_31 = p31, - - LED1 = p17, - LED2 = p18, - LED3 = p19, - LED4 = p20, - - BUTTON1 = p13, - BUTTON2 = p14, - BUTTON3 = p15, - BUTTON4 = p16, + BUTTON1 = p11, + BUTTON2 = p12, + BUTTON3 = p24, + BUTTON4 = p25, RX_PIN_NUMBER = p8, TX_PIN_NUMBER = p6, @@ -141,39 +179,39 @@ typedef enum { USBTX = TX_PIN_NUMBER, USBRX = RX_PIN_NUMBER, - SPI_PSELMOSI0 = p23, - SPI_PSELMISO0 = p24, - SPI_PSELSS0 = p22, - SPI_PSELSCK0 = p25, + SPI_PSELMOSI0 = P1_13, + SPI_PSELMISO0 = P1_14, + SPI_PSELSS0 = P1_12, + SPI_PSELSCK0 = P1_15, - SPI_PSELMOSI1 = p12, - SPI_PSELMISO1 = p13, - SPI_PSELSS1 = p11, - SPI_PSELSCK1 = p14, + SPI_PSELMOSI1 = P1_2, + SPI_PSELMISO1 = P1_3, + SPI_PSELSS1 = P1_1, + SPI_PSELSCK1 = P1_4, - SPIS_PSELMOSI = p12, - SPIS_PSELMISO = p13, - SPIS_PSELSS = p11, - SPIS_PSELSCK = p14, + SPIS_PSELMOSI = P1_2, + SPIS_PSELMISO = P1_3, + SPIS_PSELSS = P1_1, + SPIS_PSELSCK = P1_4, I2C_SDA0 = p26, I2C_SCL0 = p27, - D0 = p11, - D1 = p12, - D2 = p13, - D3 = p14, - D4 = p15, - D5 = p16, - D6 = p17, - D7 = p18, + D0 = P1_1, + D1 = P1_2, + D2 = P1_3, + D3 = P1_4, + D4 = P1_5, + D5 = P1_6, + D6 = P1_7, + D7 = P1_8, - D8 = p19, - D9 = p20, - D10 = p22, - D11 = p23, - D12 = p24, - D13 = p25, + D8 = P1_10, + D9 = P1_11, + D10 = P1_12, + D11 = P1_13, + D12 = P1_14, + D13 = P1_15, D14 = p26, D15 = p27, diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/analogin_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/analogin_api.c deleted file mode 100644 index d33effecdf..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/analogin_api.c +++ /dev/null @@ -1,91 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mbed_assert.h" -#include "analogin_api.h" -#include "cmsis.h" -#include "pinmap.h" -#include "app_util_platform.h" -#include "nrf_drv_saadc.h" - -#ifdef DEVICE_ANALOGIN - -#define ADC_12BIT_RANGE 0xFFF -#define ADC_RANGE ADC_12BIT_RANGE - -static void analog_in_event_handler(nrf_drv_saadc_evt_t const *p_event)// type of nrf_drv_saadc_event_handler_t -{ - (void) p_event; -} - -static const nrf_drv_saadc_config_t saadc_config = -{ - .resolution = NRF_SAADC_RESOLUTION_12BIT, - .oversample = NRF_SAADC_OVERSAMPLE_DISABLED, - .interrupt_priority = SAADC_CONFIG_IRQ_PRIORITY -}; - -void SAADC_IRQHandler(void); - -void analogin_init(analogin_t *obj, PinName pin) -{ - ret_code_t ret_code; - - NVIC_SetVector(SAADC_IRQn, (uint32_t)SAADC_IRQHandler); - - ret_code = nrf_drv_saadc_init(&saadc_config, analog_in_event_handler); - MBED_ASSERT(((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_INVALID_STATE))); //NRF_ERROR_INVALID_STATE expected for multiple channels used. - - uint8_t saadcIn = nrf_drv_saadc_gpio_to_ain(pin); - MBED_ASSERT(saadcIn != NRF_SAADC_INPUT_DISABLED); - - obj->adc = ADC0_0; // only one instance of ADC in nRF52 SoC - obj->adc_pin = saadcIn - 1; - - nrf_saadc_channel_config_t channel_config = - NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(saadcIn); //Single ended, negative input to ADC shorted to GND. - - ret_code = nrf_drv_saadc_channel_init(obj->adc_pin, &channel_config); - MBED_ASSERT(ret_code == NRF_SUCCESS); -} - - -uint16_t analogin_read_u16(analogin_t *obj) -{ - int16_t adc_value; - ret_code_t ret_code; - - ret_code = nrf_drv_saadc_sample_convert(obj->adc_pin, &adc_value); - MBED_ASSERT(ret_code == NRF_SUCCESS); - - if (adc_value < 0) - { - // Even in the single ended mode measured value can be {-0}. Saturation for avoid casting to a big integer. - return 0; - } - else - { - return (uint16_t) adc_value; - } -} - -float analogin_read(analogin_t *obj) -{ - uint16_t value = analogin_read_u16(obj); - return (float)value * (1.0f / (float)ADC_RANGE); -} - -#endif // DEVICE_ANALOGIN diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct index 3bb13ec74a..2d68e31833 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct @@ -1,27 +1,13 @@ -;WITHOUT SOFTDEVICE: -;LR_IROM1 0x00000000 0x00040000 { -; ER_IROM1 0x00000000 0x00040000 { -; *.o (RESET, +First) -; *(InRoot$$Sections) -; .ANY (+RO) -; } -; RW_IRAM1 0x20000000 0x00004000 { -; .ANY (+RW +ZI) -; } -;} -; -;WITH SOFTDEVICE: - -LR_IROM1 0x1C000 0x0064000 { - ER_IROM1 0x1C000 0x0064000 { +LR_IROM1 0x21000 0x00DF000 { + ER_IROM1 0x21000 0x00DF000 { *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } - RW_IRAM0 0x20002EF8 UNINIT 0x000000D8 { ;no init section + RW_IRAM0 0x20002EF8 UNINIT 0x000000F4 { ;no init section *(noinit) } - RW_IRAM1 0x20002FD0 0x0000D030 { + RW_IRAM1 0x20002FEC 0x0003D014 { .ANY (+RW +ZI) } } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s index aac3e2c28f..8472a05e46 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s @@ -94,6 +94,13 @@ __Vectors DCD __initial_sp ; Top of Stack DCD RTC2_IRQHandler_v DCD I2S_IRQHandler_v DCD FPU_IRQHandler_v + DCD USBD_IRQHandler_v + DCD UARTE1_IRQHandler_v + DCD QSPI_IRQHandler_v + DCD CRYPTOCELL_IRQHandler_v + DCD SPIM3_IRQHandler_v + DCD 0 ; Reserved + DCD PWM3_IRQHandler_v __Vectors_End @@ -202,6 +209,16 @@ Default_Handler PROC EXPORT RTC2_IRQHandler_v [WEAK] EXPORT I2S_IRQHandler_v [WEAK] EXPORT FPU_IRQHandler_v [WEAK] + EXPORT USBD_IRQHandler_v [WEAK] + EXPORT UARTE1_IRQHandler_v [WEAK] + EXPORT QSPI_IRQHandler_v [WEAK] + EXPORT CRYPTOCELL_IRQHandler_v [WEAK] + EXPORT SPIM3_IRQHandler_v [WEAK] + EXPORT PWM3_IRQHandler_v [WEAK] + + + + POWER_CLOCK_IRQHandler RADIO_IRQHandler UARTE0_UART0_IRQHandler_v @@ -239,6 +256,13 @@ SPIM2_SPIS2_SPI2_IRQHandler_v RTC2_IRQHandler_v I2S_IRQHandler_v FPU_IRQHandler_v +USBD_IRQHandler_v +UARTE1_IRQHandler_v +QSPI_IRQHandler_v +CRYPTOCELL_IRQHandler_v +SPIM3_IRQHandler_v +PWM3_IRQHandler_v + B . ENDP ALIGN diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S index 1c6631e7dd..974d839ff5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S @@ -106,6 +106,13 @@ __Vectors: .long RTC2_IRQHandler_v .long I2S_IRQHandler_v .long FPU_IRQHandler_v + .long USBD_IRQHandler_v + .long UARTE1_IRQHandler_v + .long QSPI_IRQHandler_v + .long CRYPTOCELL_IRQHandler_v + .long SPIM3_IRQHandler_v + .long 0 /*Reserved */ + .long PWM3_IRQHandler_v .size __Vectors, . - __Vectors @@ -266,5 +273,11 @@ Default_Handler: IRQ RTC2_IRQHandler_v IRQ I2S_IRQHandler_v IRQ FPU_IRQHandler_v + IRQ USBD_IRQHandler_v + IRQ UARTE1_IRQHandler_v + IRQ QSPI_IRQHandler_v + IRQ CRYPTOCELL_IRQHandler_v + IRQ SPIM3_IRQHandler_v + IRQ PWM3_IRQHandler_v .end diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h index 1c3b6809e0..7822cd78d2 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/cmsis_nvic.h @@ -32,7 +32,7 @@ #ifndef MBED_CMSIS_NVIC_H #define MBED_CMSIS_NVIC_H -#define NVIC_NUM_VECTORS (16 + 38) // CORE + MCU Peripherals +#define NVIC_NUM_VECTORS (16 + 46) // CORE + MCU Peripherals #define NVIC_USER_IRQ_OFFSET 16 #include "nrf.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h index 41f30d9df1..846390ff60 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h @@ -2312,7 +2312,7 @@ // TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver //========================================================== #ifndef TWI_ENABLED -#define TWI_ENABLED 1 +#define TWI_ENABLED 0 #endif #if TWI_ENABLED // TWI_DEFAULT_CONFIG_FREQUENCY - Frequency @@ -2456,7 +2456,7 @@ // <1=> Enabled #ifndef UART_DEFAULT_CONFIG_HWFC -#define UART_DEFAULT_CONFIG_HWFC 0 +#define UART_DEFAULT_CONFIG_HWFC 1 #endif // UART_DEFAULT_CONFIG_PARITY - Parity @@ -2488,7 +2488,7 @@ // <268435456=> 57600 baud #ifndef UART_DEFAULT_CONFIG_BAUDRATE -#define UART_DEFAULT_CONFIG_BAUDRATE 30801920 +#define UART_DEFAULT_CONFIG_BAUDRATE 2576384 #endif // UART_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/analogin_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/analogin_api.c similarity index 76% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/analogin_api.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/analogin_api.c index d33effecdf..dcc0f44f0d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/analogin_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/analogin_api.c @@ -26,6 +26,9 @@ #define ADC_12BIT_RANGE 0xFFF #define ADC_RANGE ADC_12BIT_RANGE +__STATIC_INLINE nrf_saadc_input_t nrf_drv_saadc_gpio_to_ain(uint32_t pin); + + static void analog_in_event_handler(nrf_drv_saadc_evt_t const *p_event)// type of nrf_drv_saadc_event_handler_t { (void) p_event; @@ -88,4 +91,33 @@ float analogin_read(analogin_t *obj) return (float)value * (1.0f / (float)ADC_RANGE); } + +/** + * @brief Function for converting a GPIO pin number to an analog input pin number used in the channel + * configuration. + * + * @param[in] pin GPIO pin. + * + * @return Value representing an analog input pin. The function returns @ref NRF_SAADC_INPUT_DISABLED + * if the specified pin is not an analog input. + */ +__STATIC_INLINE nrf_saadc_input_t nrf_drv_saadc_gpio_to_ain(uint32_t pin) +{ + // AIN0 - AIN3 + if (pin >= 2 && pin <= 5) + { + //0 means "not connected", hence this "+ 1" + return (nrf_saadc_input_t)(pin - 2 + 1); + } + // AIN4 - AIN7 + else if (pin >= 28 && pin <= 31) + { + return (nrf_saadc_input_t)(pin - 24 + 1); + } + else + { + return NRF_SAADC_INPUT_DISABLED; + } +} + #endif // DEVICE_ANALOGIN diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c index a5c6c850c2..bec5e26876 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c @@ -19,8 +19,9 @@ #include "pinmap.h" #include "nrf_drv_gpiote.h" - #if defined(TARGET_MCU_NRF51822) + #define GPIO_PIN_COUNT 48 +#elif defined(TARGET_MCU_NRF51822) #define GPIO_PIN_COUNT 31 #else #define GPIO_PIN_COUNT 32 @@ -36,7 +37,13 @@ typedef struct { bool irq_rise : 1; } gpio_cfg_t; -uint32_t m_gpio_initialized; +#if GPIO_PIN_COUNT > 32 + typedef uint32_t gpio_mask_t; +#else + typedef uint32_t gpio_mask_t; +#endif + +gpio_mask_t m_gpio_initialized; gpio_cfg_t m_gpio_cfg[GPIO_PIN_COUNT]; @@ -46,7 +53,7 @@ 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}; -uint32_t m_gpio_irq_enabled; +gpio_mask_t m_gpio_irq_enabled; static void gpiote_irq_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) @@ -54,7 +61,7 @@ static void gpiote_irq_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t a nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(pin); gpio_irq_event event = (sense == NRF_GPIO_PIN_SENSE_LOW) ? IRQ_RISE : IRQ_FALL; - if (m_gpio_irq_enabled & (1UL << pin)) { + if (m_gpio_irq_enabled & ((gpio_mask_t)1 << pin)) { if (((event == IRQ_RISE) && m_gpio_cfg[pin].irq_rise) || ((event == IRQ_FALL) && m_gpio_cfg[pin].irq_fall)) { m_irq_handler(m_channel_ids[pin], event); @@ -84,7 +91,7 @@ int gpio_read(gpio_t *obj) { MBED_ASSERT(obj->pin != (PinName)NC); if (m_gpio_cfg[obj->pin].direction == PIN_OUTPUT) { - return ((NRF_GPIO->OUTSET & (1UL << obj->pin)) ? 1 : 0); + return (nrf_gpio_pin_out_read(obj->pin) ? 1 : 0); } else { return nrf_gpio_pin_read(obj->pin); } @@ -92,7 +99,7 @@ int gpio_read(gpio_t *obj) static void gpiote_pin_uninit(uint8_t pin) { - if (m_gpio_initialized & (1UL << pin)) { + if (m_gpio_initialized & ((gpio_mask_t)1 << pin)) { if ((m_gpio_cfg[pin].direction == PIN_OUTPUT) && (!m_gpio_cfg[pin].used_as_irq)) { nrf_drv_gpiote_out_uninit(pin); } @@ -116,7 +123,7 @@ static void gpio_apply_config(uint8_t pin) if (m_gpio_cfg[pin].used_as_irq) { cfg.pull = NRF_GPIO_PIN_PULLUP; nrf_drv_gpiote_in_init(pin, &cfg, gpiote_irq_handler); - if ((m_gpio_irq_enabled & (1 << pin)) + if ((m_gpio_irq_enabled & ((gpio_mask_t)1 << pin)) && (m_gpio_cfg[pin].irq_rise || m_gpio_cfg[pin].irq_fall)) { nrf_drv_gpiote_in_event_enable(pin, true); @@ -142,10 +149,10 @@ static void gpio_apply_config(uint8_t pin) nrf_drv_gpiote_out_config_t cfg = GPIOTE_CONFIG_OUT_SIMPLE(m_gpio_cfg[pin].init_high); nrf_drv_gpiote_out_init(pin, &cfg); } - m_gpio_initialized |= (1UL << pin); + m_gpio_initialized |= ((gpio_mask_t)1 << pin); } else { - m_gpio_initialized &= ~(1UL << pin); + m_gpio_initialized &= ~((gpio_mask_t)1 << pin); } } @@ -211,7 +218,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) { gpio_cfg_t* cfg = &m_gpio_cfg[obj->ch]; bool irq_enabled_before = - (m_gpio_irq_enabled & (1 << obj->ch)) && + (m_gpio_irq_enabled & ((gpio_mask_t)1 << obj->ch)) && (cfg->irq_rise || cfg->irq_fall); if (event == IRQ_RISE) { @@ -235,7 +242,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) void gpio_irq_enable(gpio_irq_t *obj) { - m_gpio_irq_enabled |= (1 << obj->ch); + m_gpio_irq_enabled |= ((gpio_mask_t)1 << obj->ch); if (m_gpio_cfg[obj->ch].irq_rise || m_gpio_cfg[obj->ch].irq_fall) { nrf_drv_gpiote_in_event_enable(obj->ch, true); } @@ -244,6 +251,6 @@ void gpio_irq_enable(gpio_irq_t *obj) void gpio_irq_disable(gpio_irq_t *obj) { - m_gpio_irq_enabled &= ~(1 << obj->ch); + m_gpio_irq_enabled &= ~((gpio_mask_t)1 << obj->ch); nrf_drv_gpiote_in_event_disable(obj->ch); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h index 209134b7d1..033cc85ba0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h @@ -8,7 +8,7 @@ * 1. Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * 2. Redistributions in// binary form, except as embedded into a Nordic Semiconductor ASA * integrated circuit in a product or a software update for such product, must reproduce * the above copyright notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the distribution. @@ -57,9 +57,6 @@ struct spi_s { }; struct port_s { - __IO uint32_t *reg_cnf; - __IO uint32_t *reg_out; - __I uint32_t *reg_in; PortName port; uint32_t mask; }; diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c index 989fbf209b..26fa761c1d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pinmap.c @@ -29,7 +29,9 @@ void pin_mode(PinName pin, PinMode mode) MBED_ASSERT(pin != (PinName)NC); uint32_t pin_number = (uint32_t)pin; + + NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); - NRF_GPIO->PIN_CNF[pin_number] &= ~GPIO_PIN_CNF_PULL_Msk; - NRF_GPIO->PIN_CNF[pin_number] |= (mode << GPIO_PIN_CNF_PULL_Pos); + reg->PIN_CNF[pin_number] &= ~GPIO_PIN_CNF_PULL_Msk; + reg->PIN_CNF[pin_number] |= (mode << GPIO_PIN_CNF_PULL_Pos); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c index ad3be04816..bb689e2fbe 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c @@ -40,10 +40,12 @@ #include "pinmap.h" #include "gpio_api.h" +static NRF_GPIO_Type * const m_ports[] = GPIO_REG_LIST; + + PinName port_pin(PortName port, int pin_n) { - (void) port; - return (PinName)(pin_n); + return NRF_GPIO_PIN_MAP(port, pin_n); } void port_init(port_t *obj, PortName port, int mask, PinDirection dir) @@ -51,10 +53,6 @@ void port_init(port_t *obj, PortName port, int mask, PinDirection dir) obj->port = port; obj->mask = mask; - obj->reg_out = &NRF_GPIO->OUT; - obj->reg_in = &NRF_GPIO->IN; - obj->reg_cnf = NRF_GPIO->PIN_CNF; - port_dir(obj, dir); } @@ -72,11 +70,14 @@ void port_mode(port_t *obj, PinMode mode) void port_dir(port_t *obj, PinDirection dir) { int i; + + volatile uint32_t *reg_cnf = (volatile uint32_t*) m_ports[obj->port]->PIN_CNF; + switch (dir) { case PIN_INPUT: for (i = 0; i<31; i++) { if (obj->mask & (1 << i)) { - obj->reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) + reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos); @@ -86,7 +87,7 @@ void port_dir(port_t *obj, PinDirection dir) case PIN_OUTPUT: for (i = 0; i<31; i++) { if (obj->mask & (1 << i)) { - obj->reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) + reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) @@ -99,10 +100,11 @@ void port_dir(port_t *obj, PinDirection dir) void port_write(port_t *obj, int value) { - *obj->reg_out = value; + m_ports[obj->port]->OUTSET = value & obj->mask; + m_ports[obj->port]->OUTCLR = (~value) & obj->mask; } int port_read(port_t *obj) { - return (*obj->reg_in); + return ((m_ports[obj->port]->IN) & obj->mask); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pwmout_api.c similarity index 100% rename from targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/pwmout_api.c rename to targets/TARGET_NORDIC/TARGET_NRF5_SDK13/pwmout_api.c From f0b3cd2ed06d42c9f9a4ede3bd296c061e0c7e2f Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 3 Jan 2017 18:06:20 +0100 Subject: [PATCH 09/31] to be commented --- .../device/TOOLCHAIN_ARM_STD/nRF52832.sct | 4 +- .../TARGET_MCU_NRF52840/sdk/sdk_config.h | 14 +- .../sdk/drivers_nrf/spi_master/nrf_drv_spi.c | 21 + .../sdk/drivers_nrf/spi_master/nrf_drv_spi.h | 5 + .../sdk/drivers_nrf/twi_master/nrf_drv_twi.c | 11 + .../sdk/drivers_nrf/twi_master/nrf_drv_twi.h | 13 + .../sdk/libraries/timer/app_timer.c | 3 + .../sdk/libraries/timer/app_timer_ble_gzll.c | 1050 ----------------- .../sdk/libraries/timer/app_timer_freertos.c | 230 ---- .../sdk/libraries/timer/app_timer_rtx.c | 5 +- 10 files changed, 66 insertions(+), 1290 deletions(-) delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_ble_gzll.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_freertos.c diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct index 2d68e31833..5cecefb903 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct @@ -4,10 +4,10 @@ LR_IROM1 0x21000 0x00DF000 { *(InRoot$$Sections) .ANY (+RO) } - RW_IRAM0 0x20002EF8 UNINIT 0x000000F4 { ;no init section + RW_IRAM0 0x20002EF8 UNINIT 0x000000F8 { ;no init section *(noinit) } - RW_IRAM1 0x20002FEC 0x0003D014 { + RW_IRAM1 0x20002FF0 0x0003D010 { .ANY (+RW +ZI) } } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h index 846390ff60..ded519da30 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h @@ -2312,7 +2312,7 @@ // TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver //========================================================== #ifndef TWI_ENABLED -#define TWI_ENABLED 0 +#define TWI_ENABLED 1 #endif #if TWI_ENABLED // TWI_DEFAULT_CONFIG_FREQUENCY - Frequency @@ -2779,7 +2779,7 @@ // APP_SCHEDULER_ENABLED - app_scheduler - Events scheduler //========================================================== #ifndef APP_SCHEDULER_ENABLED -#define APP_SCHEDULER_ENABLED 0 +#define APP_SCHEDULER_ENABLED 1 #endif #if APP_SCHEDULER_ENABLED // APP_SCHEDULER_WITH_PAUSE - Enabling pause feature @@ -2802,7 +2802,7 @@ // APP_TIMER_ENABLED - app_timer - Application timer functionality //========================================================== #ifndef APP_TIMER_ENABLED -#define APP_TIMER_ENABLED 0 +#define APP_TIMER_ENABLED 1 #endif #if APP_TIMER_ENABLED // APP_TIMER_WITH_PROFILER - Enable app_timer profiling @@ -2835,7 +2835,7 @@ // APP_UART_ENABLED - app_uart - UART driver //========================================================== #ifndef APP_UART_ENABLED -#define APP_UART_ENABLED 0 +#define APP_UART_ENABLED 1 #endif #if APP_UART_ENABLED // APP_UART_DRIVER_INSTANCE - UART instance used @@ -2860,14 +2860,14 @@ #ifndef APP_USBD_CLASS_HID_ENABLED -#define APP_USBD_CLASS_HID_ENABLED 0 +#define APP_USBD_CLASS_HID_ENABLED 1 #endif // APP_USBD_HID_GENERIC_ENABLED - app_usbd_hid_generic - USB HID generic #ifndef APP_USBD_HID_GENERIC_ENABLED -#define APP_USBD_HID_GENERIC_ENABLED 0 +#define APP_USBD_HID_GENERIC_ENABLED 1 #endif // APP_USBD_HID_KBD_ENABLED - app_usbd_hid_kbd - USB HID keyboard @@ -2881,7 +2881,7 @@ #ifndef APP_USBD_HID_MOUSE_ENABLED -#define APP_USBD_HID_MOUSE_ENABLED 0 +#define APP_USBD_HID_MOUSE_ENABLED 1 #endif // BUTTON_ENABLED - app_button - buttons handling module diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c index e7ffa06acb..b015d55805 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c @@ -601,6 +601,27 @@ ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t const * const p_instance, return err_code; ) } + +// modification for mbed-os +#if __MBED__ +void nrf_drv_spi_abort(nrf_drv_spi_t const * p_instance) +{ + spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + + CODE_FOR_SPIM + ( + nrf_spim_task_trigger(p_instance, NRF_SPIM_TASK_STOP); + while (!nrf_spim_event_check(p_instance, NRF_SPIM_EVENT_STOPPED)) {} + p_cb->transfer_in_progress = false; + ) + CODE_FOR_SPI + ( + p_cb->abort = true; + ) +} +#endif + #ifdef SPIM_IN_USE static void irq_handler_spim(NRF_SPIM_Type * p_spim, spi_control_block_t * p_cb) { diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h index 9b4ab898fd..fad2dddcb3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.h @@ -397,6 +397,11 @@ uint32_t nrf_drv_spi_start_task_get(nrf_drv_spi_t const * p_instance); */ uint32_t nrf_drv_spi_end_event_get(nrf_drv_spi_t const * p_instance); +// modification for mbed-os +#if __MBED__ +void nrf_drv_spi_abort(nrf_drv_spi_t const * p_instance); +#endif + #ifdef __cplusplus } #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c index fde2cefa11..2b203748ae 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c @@ -683,7 +683,18 @@ __STATIC_INLINE ret_code_t twi_xfer(twi_control_block_t * p_cb, } #endif +// modification for mbed-os +#if __MBED__ +bool nrf_drv_twi_is_busy(nrf_drv_twi_t const * p_instance) +{ + twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + return p_cb->busy; +} +#endif + #ifdef TWIM_IN_USE + + __STATIC_INLINE void twim_list_enable_handle(NRF_TWIM_Type * p_twim, uint32_t flags) { if (NRF_DRV_TWI_FLAG_TX_POSTINC & flags) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h index 52916c563c..c24d33c2b3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.h @@ -380,6 +380,19 @@ ret_code_t nrf_drv_twi_xfer(nrf_drv_twi_t const * p_instance, nrf_drv_twi_xfer_desc_t const * p_xfer_desc, uint32_t flags); +// modification for mbed-os +#if __MBED__ +/** + * @brief Function for checking the TWI driver state. + * + * @param[in] p_instance TWI instance. + * + * @retval true If the TWI driver is currently busy performing a transfer. + * @retval false If the TWI driver is ready for a new transfer. + */ +bool nrf_drv_twi_is_busy(nrf_drv_twi_t const * p_instance); +#endif + /** * @brief Function for getting the transferred data count. * diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c index 057e5fb34f..87e5292d84 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c @@ -9,6 +9,8 @@ * the file. * */ +#ifndef __MBED_CMSIS_RTOS_CM + #include "sdk_common.h" #if NRF_MODULE_ENABLED(APP_TIMER) #include "app_timer.h" @@ -1048,3 +1050,4 @@ uint8_t app_timer_op_queue_utilization_get(void) } #endif #endif //NRF_MODULE_ENABLED(APP_TIMER) +#endif // __MBED_CMSIS_RTOS_CM diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_ble_gzll.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_ble_gzll.c deleted file mode 100644 index e39c329464..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_ble_gzll.c +++ /dev/null @@ -1,1050 +0,0 @@ -/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ -#include "sdk_common.h" -#if NRF_MODULE_ENABLED(APP_TIMER) -#include "app_timer.h" -#include -#include "nrf.h" -#include "nrf_soc.h" -#include "app_error.h" -#include "nrf_delay.h" -#include "app_util_platform.h" - -#define RTC1_IRQ_PRI APP_IRQ_PRIORITY_LOWEST /**< Priority of the RTC1 interrupt (used for checking for timeouts and executing timeout handlers). */ -#define SWI_IRQ_PRI APP_IRQ_PRIORITY_LOWEST /**< Priority of the SWI interrupt (used for updating the timer list). */ - -// The current design assumes that both interrupt handlers run at the same interrupt level. -// If this is to be changed, protection must be added to prevent them from interrupting each other -// (e.g. by using guard/trigger flags). -STATIC_ASSERT(RTC1_IRQ_PRI == SWI_IRQ_PRI); - -#define MAX_RTC_COUNTER_VAL 0x00FFFFFF /**< Maximum value of the RTC counter. */ - -#define RTC_COMPARE_OFFSET_MIN 3 /**< Minimum offset between the current RTC counter value and the Capture Compare register. Although the nRF51 Series User Specification recommends this value to be 2, we use 3 to be safer.*/ - -#define MAX_RTC_TASKS_DELAY 47 /**< Maximum delay until an RTC task is executed. */ - -#define SWI_IRQn SWI1_IRQn -#define SWI_IRQHandler SWI1_IRQHandler - -#define MODULE_INITIALIZED (m_op_queue.p_user_op_queue != NULL) /**< Macro designating whether the module has been initialized properly. */ - -/**@brief Timer node type. The nodes will be used form a linked list of running timers. */ -typedef struct -{ - uint32_t ticks_to_expire; /**< Number of ticks from previous timer interrupt to timer expiry. */ - uint32_t ticks_at_start; /**< Current RTC counter value when the timer was started. */ - uint32_t ticks_first_interval; /**< Number of ticks in the first timer interval. */ - uint32_t ticks_periodic_interval; /**< Timer period (for repeating timers). */ - bool is_running; /**< True if timer is running, False otherwise. */ - app_timer_mode_t mode; /**< Timer mode. */ - app_timer_timeout_handler_t p_timeout_handler; /**< Pointer to function to be executed when the timer expires. */ - void * p_context; /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */ - void * next; /**< Pointer to the next node. */ -} timer_node_t; - -STATIC_ASSERT(sizeof(timer_node_t) == APP_TIMER_NODE_SIZE); - -/**@brief Set of available timer operation types. */ -typedef enum -{ - TIMER_USER_OP_TYPE_NONE, /**< Invalid timer operation type. */ - TIMER_USER_OP_TYPE_START, /**< Timer operation type Start. */ - TIMER_USER_OP_TYPE_STOP, /**< Timer operation type Stop. */ - TIMER_USER_OP_TYPE_STOP_ALL /**< Timer operation type Stop All. */ -} timer_user_op_type_t; - -/**@brief Structure describing a timer start operation. */ -typedef struct -{ - uint32_t ticks_at_start; /**< Current RTC counter value when the timer was started. */ - uint32_t ticks_first_interval; /**< Number of ticks in the first timer interval. */ - uint32_t ticks_periodic_interval; /**< Timer period (for repeating timers). */ - void * p_context; /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */ -} timer_user_op_start_t; - -/**@brief Structure describing a timer operation. */ -typedef struct -{ - timer_user_op_type_t op_type; /**< Id of timer on which the operation is to be performed. */ - timer_node_t * p_node; - union - { - timer_user_op_start_t start; /**< Structure describing a timer start operation. */ - } params; -} timer_user_op_t; - -STATIC_ASSERT(sizeof(timer_user_op_t) <= APP_TIMER_USER_OP_SIZE); -STATIC_ASSERT(sizeof(timer_user_op_t) % 4 == 0); - -/**@brief Structure describing a timer operations queue. - * - * @details This queue will hold timer operations issued by the application - * until the timer interrupt handler processes these operations. - */ -typedef struct -{ - uint8_t first; /**< Index of first entry to have been inserted in the queue (i.e. the next entry to be executed). */ - uint8_t last; /**< Index of last entry to have been inserted in the queue. */ - uint8_t size; /**< Queue size. */ - timer_user_op_t * p_user_op_queue; /**< Queue buffer. */ -} timer_op_queue_t; - -STATIC_ASSERT(sizeof(timer_op_queue_t) % 4 == 0); - -#define CONTEXT_QUEUE_SIZE_MAX (2) - -static timer_op_queue_t m_op_queue; /**< Timer operations queue. */ -static timer_node_t * mp_timer_id_head; /**< First timer in list of running timers. */ -static uint32_t m_ticks_latest; /**< Last known RTC counter value. */ -static uint32_t m_ticks_elapsed[CONTEXT_QUEUE_SIZE_MAX]; /**< Timer internal elapsed ticks queue. */ -static uint8_t m_ticks_elapsed_q_read_ind; /**< Timer internal elapsed ticks queue read index. */ -static uint8_t m_ticks_elapsed_q_write_ind; /**< Timer internal elapsed ticks queue write index. */ -static app_timer_evt_schedule_func_t m_evt_schedule_func; /**< Pointer to function for propagating timeout events to the scheduler. */ -static bool m_rtc1_running; /**< Boolean indicating if RTC1 is running. */ -static bool m_rtc1_reset; /**< Boolean indicating if RTC1 counter has been reset due to last timer removed from timer list during the timer list handling. */ - -#if APP_TIMER_WITH_PROFILER -static uint8_t m_max_user_op_queue_utilization; /**< Maximum observed timer user operations queue utilization. */ -#endif - -/**@brief Function for initializing the RTC1 counter. - * - * @param[in] prescaler Value of the RTC1 PRESCALER register. Set to 0 for no prescaling. - */ -static void rtc1_init(uint32_t prescaler) -{ - NRF_RTC1->PRESCALER = prescaler; - NVIC_SetPriority(RTC1_IRQn, RTC1_IRQ_PRI); -} - - -/**@brief Function for starting the RTC1 timer. - */ -static void rtc1_start(void) -{ - NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE0_Msk; - NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE0_Msk; - - NVIC_ClearPendingIRQ(RTC1_IRQn); - NVIC_EnableIRQ(RTC1_IRQn); - - NRF_RTC1->TASKS_START = 1; - nrf_delay_us(MAX_RTC_TASKS_DELAY); - - m_rtc1_running = true; -} - - -/**@brief Function for stopping the RTC1 timer. - */ -static void rtc1_stop(void) -{ - NVIC_DisableIRQ(RTC1_IRQn); - - NRF_RTC1->EVTENCLR = RTC_EVTEN_COMPARE0_Msk; - NRF_RTC1->INTENCLR = RTC_INTENSET_COMPARE0_Msk; - - NRF_RTC1->TASKS_STOP = 1; - nrf_delay_us(MAX_RTC_TASKS_DELAY); - - NRF_RTC1->TASKS_CLEAR = 1; - m_ticks_latest = 0; - nrf_delay_us(MAX_RTC_TASKS_DELAY); - - m_rtc1_running = false; -} - - -/**@brief Function for returning the current value of the RTC1 counter. - * - * @return Current value of the RTC1 counter. - */ -static __INLINE uint32_t rtc1_counter_get(void) -{ - return NRF_RTC1->COUNTER; -} - - -/**@brief Function for computing the difference between two RTC1 counter values. - * - * @return Number of ticks elapsed from ticks_old to ticks_now. - */ -static __INLINE uint32_t ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old) -{ - return ((ticks_now - ticks_old) & MAX_RTC_COUNTER_VAL); -} - - -/**@brief Function for setting the RTC1 Capture Compare register 0, and enabling the corresponding - * event. - * - * @param[in] value New value of Capture Compare register 0. - */ -static __INLINE void rtc1_compare0_set(uint32_t value) -{ - NRF_RTC1->CC[0] = value; -} - - -/**@brief Function for inserting a timer in the timer list. - * - * @param[in] timer_id Id of timer to insert. - */ -static void timer_list_insert(timer_node_t * p_timer) -{ - if (mp_timer_id_head == NULL) - { - mp_timer_id_head = p_timer; - } - else - { - if (p_timer->ticks_to_expire <= mp_timer_id_head->ticks_to_expire) - { - mp_timer_id_head->ticks_to_expire -= p_timer->ticks_to_expire; - - p_timer->next = mp_timer_id_head; - mp_timer_id_head = p_timer; - } - else - { - timer_node_t * p_previous; - timer_node_t * p_current; - uint32_t ticks_to_expire; - - ticks_to_expire = p_timer->ticks_to_expire; - p_previous = mp_timer_id_head; - p_current = mp_timer_id_head; - - while ((p_current != NULL) && (ticks_to_expire > p_current->ticks_to_expire)) - { - ticks_to_expire -= p_current->ticks_to_expire; - p_previous = p_current; - p_current = p_current->next; - } - - if (p_current != NULL) - { - p_current->ticks_to_expire -= ticks_to_expire; - } - - p_timer->ticks_to_expire = ticks_to_expire; - p_timer->next = p_current; - p_previous->next = p_timer; - } - } -} - - -/**@brief Function for removing a timer from the timer queue. - * - * @param[in] timer_id Id of timer to remove. - */ -static void timer_list_remove(timer_node_t * p_timer) -{ - timer_node_t * p_previous; - timer_node_t * p_current; - uint32_t timeout; - - // Find the timer's position in timer list. - p_previous = mp_timer_id_head; - p_current = p_previous; - - while (p_current != NULL) - { - if (p_current == p_timer) - { - break; - } - p_previous = p_current; - p_current = p_current->next; - } - - // Timer not in active list. - if (p_current == NULL) - { - return; - } - - // Timer is the first in the list - if (p_previous == p_current) - { - mp_timer_id_head = mp_timer_id_head->next; - - // No more timers in the list. Reset RTC1 in case Start timer operations are present in the queue. - if (mp_timer_id_head == NULL) - { - NRF_RTC1->TASKS_CLEAR = 1; - m_ticks_latest = 0; - m_rtc1_reset = true; - } - } - - // Remaining timeout between next timeout. - timeout = p_current->ticks_to_expire; - - // Link previous timer with next of this timer, i.e. removing the timer from list. - p_previous->next = p_current->next; - - // If this is not the last timer, increment the next timer by this timer timeout. - p_current = p_previous->next; - if (p_current != NULL) - { - p_current->ticks_to_expire += timeout; - } -} - - -/**@brief Function for scheduling a check for timeouts by generating a RTC1 interrupt. - */ -static void timer_timeouts_check_sched(void) -{ - NVIC_SetPendingIRQ(RTC1_IRQn); -} - - -/**@brief Function for scheduling a timer list update by generating a SWI interrupt. - */ -static void timer_list_handler_sched(void) -{ - NVIC_SetPendingIRQ(SWI_IRQn); -} - - -/**@brief Function for executing an application timeout handler, either by calling it directly, or - * by passing an event to the @ref app_scheduler. - * - * @param[in] p_timer Pointer to expired timer. - */ -static void timeout_handler_exec(timer_node_t * p_timer) -{ - if (m_evt_schedule_func != NULL) - { - uint32_t err_code = m_evt_schedule_func(p_timer->p_timeout_handler, p_timer->p_context); - APP_ERROR_CHECK(err_code); - } - else - { - p_timer->p_timeout_handler(p_timer->p_context); - } -} - - -/**@brief Function for checking for expired timers. - */ -static void timer_timeouts_check(void) -{ - // Handle expired of timer - if (mp_timer_id_head != NULL) - { - timer_node_t * p_timer; - timer_node_t * p_previous_timer; - uint32_t ticks_elapsed; - uint32_t ticks_expired; - - // Initialize actual elapsed ticks being consumed to 0. - ticks_expired = 0; - - // ticks_elapsed is collected here, job will use it. - ticks_elapsed = ticks_diff_get(rtc1_counter_get(), m_ticks_latest); - - // Auto variable containing the head of timers expiring. - p_timer = mp_timer_id_head; - - // Expire all timers within ticks_elapsed and collect ticks_expired. - while (p_timer != NULL) - { - // Do nothing if timer did not expire. - if (ticks_elapsed < p_timer->ticks_to_expire) - { - break; - } - - // Decrement ticks_elapsed and collect expired ticks. - ticks_elapsed -= p_timer->ticks_to_expire; - ticks_expired += p_timer->ticks_to_expire; - - // Move to next timer. - p_previous_timer = p_timer; - p_timer = p_timer->next; - - // Execute Task. - if (p_previous_timer->is_running) - { - p_previous_timer->is_running = false; - timeout_handler_exec(p_previous_timer); - } - } - - // Prepare to queue the ticks expired in the m_ticks_elapsed queue. - if (m_ticks_elapsed_q_read_ind == m_ticks_elapsed_q_write_ind) - { - // The read index of the queue is equal to the write index. This means the new - // value of ticks_expired should be stored at a new location in the m_ticks_elapsed - // queue (which is implemented as a double buffer). - - // Check if there will be a queue overflow. - if (++m_ticks_elapsed_q_write_ind == CONTEXT_QUEUE_SIZE_MAX) - { - // There will be a queue overflow. Hence the write index should point to the start - // of the queue. - m_ticks_elapsed_q_write_ind = 0; - } - } - - // Queue the ticks expired. - m_ticks_elapsed[m_ticks_elapsed_q_write_ind] = ticks_expired; - - timer_list_handler_sched(); - } -} - - -/**@brief Function for acquiring the number of ticks elapsed. - * - * @param[out] p_ticks_elapsed Number of ticks elapsed. - * - * @return TRUE if elapsed ticks was read from queue, FALSE otherwise. - */ -static bool elapsed_ticks_acquire(uint32_t * p_ticks_elapsed) -{ - // Pick the elapsed value from queue. - if (m_ticks_elapsed_q_read_ind != m_ticks_elapsed_q_write_ind) - { - // Dequeue elapsed value. - m_ticks_elapsed_q_read_ind++; - if (m_ticks_elapsed_q_read_ind == CONTEXT_QUEUE_SIZE_MAX) - { - m_ticks_elapsed_q_read_ind = 0; - } - - *p_ticks_elapsed = m_ticks_elapsed[m_ticks_elapsed_q_read_ind]; - - m_ticks_latest += *p_ticks_elapsed; - m_ticks_latest &= MAX_RTC_COUNTER_VAL; - - return true; - } - else - { - // No elapsed value in queue. - *p_ticks_elapsed = 0; - return false; - } -} - - -/**@brief Function for handling the timer list deletions. - * - * @return TRUE if Capture Compare register must be updated, FALSE otherwise. - */ -static bool list_deletions_handler(void) -{ - timer_node_t * p_timer_old_head; - uint8_t user_ops_first = m_op_queue.first; - - // Remember the old head, so as to decide if new compare needs to be set. - p_timer_old_head = mp_timer_id_head; - - while (user_ops_first != m_op_queue.last) - { - timer_user_op_t * p_user_op = &m_op_queue.p_user_op_queue[user_ops_first]; - - // Traverse to next operation in queue. - user_ops_first++; - if (user_ops_first == m_op_queue.size) - { - user_ops_first = 0; - } - - switch (p_user_op->op_type) - { - case TIMER_USER_OP_TYPE_STOP: - // Delete node if timer is running. - timer_list_remove(p_user_op->p_node); - break; - - case TIMER_USER_OP_TYPE_STOP_ALL: - // Delete list of running timers, and mark all timers as not running. - while (mp_timer_id_head != NULL) - { - timer_node_t * p_head = mp_timer_id_head; - - p_head->is_running = false; - mp_timer_id_head = p_head->next; - } - break; - - default: - // No implementation needed. - break; - } - } - - // Detect change in head of the list. - return (mp_timer_id_head != p_timer_old_head); -} - - -/**@brief Function for updating the timer list for expired timers. - * - * @param[in] ticks_elapsed Number of elapsed ticks. - * @param[in] ticks_previous Previous known value of the RTC counter. - * @param[out] p_restart_list_head List of repeating timers to be restarted. - */ -static void expired_timers_handler(uint32_t ticks_elapsed, - uint32_t ticks_previous, - timer_node_t ** p_restart_list_head) -{ - uint32_t ticks_expired = 0; - - while (mp_timer_id_head != NULL) - { - timer_node_t * p_timer; - timer_node_t * p_timer_expired; - - // Auto variable for current timer node. - p_timer = mp_timer_id_head; - - // Do nothing if timer did not expire - if (ticks_elapsed < p_timer->ticks_to_expire) - { - p_timer->ticks_to_expire -= ticks_elapsed; - break; - } - - // Decrement ticks_elapsed and collect expired ticks. - ticks_elapsed -= p_timer->ticks_to_expire; - ticks_expired += p_timer->ticks_to_expire; - - // Timer expired, set ticks_to_expire zero. - p_timer->ticks_to_expire = 0; - - // Remove the expired timer from head. - p_timer_expired = mp_timer_id_head; - mp_timer_id_head = p_timer->next; - - // Timer will be restarted if periodic. - if (p_timer->ticks_periodic_interval != 0) - { - p_timer->ticks_at_start = (ticks_previous + ticks_expired) & MAX_RTC_COUNTER_VAL; - p_timer->ticks_first_interval = p_timer->ticks_periodic_interval; - p_timer->next = *p_restart_list_head; - *p_restart_list_head = p_timer_expired; - } - } -} - - -/**@brief Function for handling timer list insertions. - * - * @param[in] p_restart_list_head List of repeating timers to be restarted. - * - * @return TRUE if Capture Compare register must be updated, FALSE otherwise. - */ -static bool list_insertions_handler(timer_node_t * p_restart_list_head) -{ - timer_node_t * p_timer_id_old_head; - - // Remember the old head, so as to decide if new compare needs to be set. - p_timer_id_old_head = mp_timer_id_head; - - // Handle insertions of timers. - while ((p_restart_list_head != NULL) || (m_op_queue.first != m_op_queue.last)) - { - timer_node_t * p_timer; - - if (p_restart_list_head != NULL) - { - p_timer = p_restart_list_head; - p_restart_list_head = p_timer->next; - } - else - { - timer_user_op_t * p_user_op = &m_op_queue.p_user_op_queue[m_op_queue.first]; - - m_op_queue.first++; - if (m_op_queue.first == m_op_queue.size) - { - m_op_queue.first = 0; - } - - p_timer = p_user_op->p_node; - - if ((p_user_op->op_type != TIMER_USER_OP_TYPE_START) || p_timer->is_running) - { - continue; - } - - p_timer->ticks_at_start = p_user_op->params.start.ticks_at_start; - p_timer->ticks_first_interval = p_user_op->params.start.ticks_first_interval; - p_timer->ticks_periodic_interval = p_user_op->params.start.ticks_periodic_interval; - p_timer->p_context = p_user_op->params.start.p_context; - - if (m_rtc1_reset) - { - p_timer->ticks_at_start = 0; - } - } - - // Prepare the node to be inserted. - if ( - ((p_timer->ticks_at_start - m_ticks_latest) & MAX_RTC_COUNTER_VAL) - < - (MAX_RTC_COUNTER_VAL / 2) - ) - { - p_timer->ticks_to_expire = ticks_diff_get(p_timer->ticks_at_start, m_ticks_latest) + - p_timer->ticks_first_interval; - } - else - { - uint32_t delta_current_start; - - delta_current_start = ticks_diff_get(m_ticks_latest, p_timer->ticks_at_start); - if (p_timer->ticks_first_interval > delta_current_start) - { - p_timer->ticks_to_expire = p_timer->ticks_first_interval - delta_current_start; - } - else - { - p_timer->ticks_to_expire = 0; - } - } - - p_timer->ticks_at_start = 0; - p_timer->ticks_first_interval = 0; - p_timer->is_running = true; - p_timer->next = NULL; - - // Insert into list - timer_list_insert(p_timer); - } - - return (mp_timer_id_head != p_timer_id_old_head); -} - - -/**@brief Function for updating the Capture Compare register. - */ -static void compare_reg_update(timer_node_t * p_timer_id_head_old) -{ - // Setup the timeout for timers on the head of the list - if (mp_timer_id_head != NULL) - { - uint32_t ticks_to_expire = mp_timer_id_head->ticks_to_expire; - uint32_t pre_counter_val = rtc1_counter_get(); - uint32_t cc = m_ticks_latest; - uint32_t ticks_elapsed = ticks_diff_get(pre_counter_val, cc) + RTC_COMPARE_OFFSET_MIN; - - if (!m_rtc1_running) - { - // No timers were already running, start RTC - rtc1_start(); - } - - cc += (ticks_elapsed < ticks_to_expire) ? ticks_to_expire : ticks_elapsed; - cc &= MAX_RTC_COUNTER_VAL; - - rtc1_compare0_set(cc); - - uint32_t post_counter_val = rtc1_counter_get(); - - if ( - (ticks_diff_get(post_counter_val, pre_counter_val) + RTC_COMPARE_OFFSET_MIN) - > - ticks_diff_get(cc, pre_counter_val) - ) - { - // When this happens the COMPARE event may not be triggered by the RTC. - // The nRF51 Series User Specification states that if the COUNTER value is N - // (i.e post_counter_val = N), writing N or N + 1 to a CC register may not trigger a - // COMPARE event. Hence the RTC interrupt is forcefully pended by calling the following - // function. - rtc1_compare0_set(rtc1_counter_get()); // this should prevent CC to fire again in the background while the code is in RTC-ISR - nrf_delay_us(MAX_RTC_TASKS_DELAY); - timer_timeouts_check_sched(); - } - } - else - { -#if (APP_TIMER_KEEPS_RTC_ACTIVE == 0) - // No timers are running, stop RTC - rtc1_stop(); -#endif //(APP_TIMER_KEEPS_RTC_ACTIVE == 0) - } -} - - -/**@brief Function for handling changes to the timer list. - */ -static void timer_list_handler(void) -{ - timer_node_t * p_restart_list_head = NULL; - - uint32_t ticks_elapsed; - uint32_t ticks_previous; - bool ticks_have_elapsed; - bool compare_update; - timer_node_t * p_timer_id_head_old; - -#if APP_TIMER_WITH_PROFILER - { - uint8_t size = m_op_queue.size; - uint8_t first = m_op_queue.first; - uint8_t last = m_op_queue.last; - uint8_t utilization = (first <= last) ? (last - first) : (size + 1 - first + last); - - if (utilization > m_max_user_op_queue_utilization) - { - m_max_user_op_queue_utilization = utilization; - } - } -#endif - - // Back up the previous known tick and previous list head - ticks_previous = m_ticks_latest; - p_timer_id_head_old = mp_timer_id_head; - - // Get number of elapsed ticks - ticks_have_elapsed = elapsed_ticks_acquire(&ticks_elapsed); - - // Handle list deletions - compare_update = list_deletions_handler(); - - // Handle expired timers - if (ticks_have_elapsed) - { - expired_timers_handler(ticks_elapsed, ticks_previous, &p_restart_list_head); - compare_update = true; - } - - // Handle list insertions - if (list_insertions_handler(p_restart_list_head)) - { - compare_update = true; - } - - // Update compare register if necessary - if (compare_update) - { - compare_reg_update(p_timer_id_head_old); - } - m_rtc1_reset = false; -} - - -/**@brief Function for enqueueing a new operations queue entry. - * - * @param[in] last_index Index of the next last index to be enqueued. - */ -static void user_op_enque(uint8_t last_index) -{ - m_op_queue.last = last_index; -} - - -/**@brief Function for allocating a new operations queue entry. - * - * @param[out] p_last_index Index of the next last index to be enqueued. - * - * @return Pointer to allocated queue entry, or NULL if queue is full. - */ -static timer_user_op_t * user_op_alloc( uint8_t * p_last_index) -{ - uint8_t last; - timer_user_op_t * p_user_op; - - last = m_op_queue.last + 1; - if (last == m_op_queue.size) - { - // Overflow case. - last = 0; - } - if (last == m_op_queue.first) - { - // Queue is full. - return NULL; - } - - *p_last_index = last; - p_user_op = &m_op_queue.p_user_op_queue[m_op_queue.last]; - - return p_user_op; -} - - -/**@brief Function for scheduling a Timer Start operation. - * - * @param[in] timer_id Id of timer to start. - * @param[in] timeout_initial Time (in ticks) to first timer expiry. - * @param[in] timeout_periodic Time (in ticks) between periodic expiries. - * @param[in] p_context General purpose pointer. Will be passed to the timeout handler when - * the timer expires. - * @return NRF_SUCCESS on success, otherwise an error code. - */ - -static uint32_t timer_start_op_schedule(timer_node_t * p_node, - uint32_t timeout_initial, - uint32_t timeout_periodic, - void * p_context) -{ - uint8_t last_index; - uint32_t err_code = NRF_SUCCESS; - - CRITICAL_REGION_ENTER(); - timer_user_op_t * p_user_op = user_op_alloc(&last_index); - if (p_user_op == NULL) - { - err_code = NRF_ERROR_NO_MEM; - } - else - { - - p_user_op->op_type = TIMER_USER_OP_TYPE_START; - p_user_op->p_node = p_node; - p_user_op->params.start.ticks_at_start = rtc1_counter_get(); - p_user_op->params.start.ticks_first_interval = timeout_initial; - p_user_op->params.start.ticks_periodic_interval = timeout_periodic; - p_user_op->params.start.p_context = p_context; - - user_op_enque(last_index); - } - CRITICAL_REGION_EXIT(); - - if (err_code == NRF_SUCCESS) - { - timer_list_handler_sched(); - } - - return err_code; -} - - -/**@brief Function for scheduling a Timer Stop operation. - * - * @param[in] timer_id Id of timer to stop. - * @param[in] op_type Type of stop operation - * - * @return NRF_SUCCESS on successful scheduling a timer stop operation. NRF_ERROR_NO_MEM when there - * is no memory left to schedule the timer stop operation. - */ -static uint32_t timer_stop_op_schedule(timer_node_t * p_node, - timer_user_op_type_t op_type) -{ - uint8_t last_index; - uint32_t err_code = NRF_SUCCESS; - - CRITICAL_REGION_ENTER(); - timer_user_op_t * p_user_op = user_op_alloc(&last_index); - if (p_user_op == NULL) - { - err_code = NRF_ERROR_NO_MEM; - } - else - { - p_user_op->op_type = op_type; - p_user_op->p_node = p_node; - - user_op_enque(last_index); - } - CRITICAL_REGION_EXIT(); - - if (err_code == NRF_SUCCESS) - { - timer_list_handler_sched(); - } - - return err_code; -} - -/**@brief Function for handling the RTC1 interrupt. - * - * @details Checks for timeouts, and executes timeout handlers for expired timers. - */ -void RTC1_IRQHandler(void) -{ - // Clear all events (also unexpected ones) - NRF_RTC1->EVENTS_COMPARE[0] = 0; - NRF_RTC1->EVENTS_COMPARE[1] = 0; - NRF_RTC1->EVENTS_COMPARE[2] = 0; - NRF_RTC1->EVENTS_COMPARE[3] = 0; - NRF_RTC1->EVENTS_TICK = 0; - NRF_RTC1->EVENTS_OVRFLW = 0; - - // Check for expired timers - timer_timeouts_check(); -} - - -/**@brief Function for handling the SWI interrupt. - * - * @details Performs all updates to the timer list. - */ -void SWI_IRQHandler(void) -{ - timer_list_handler(); -} - - -uint32_t app_timer_init(uint32_t prescaler, - uint8_t op_queue_size, - void * p_buffer, - app_timer_evt_schedule_func_t evt_schedule_func) -{ - // Check that buffer is correctly aligned - if (!is_word_aligned(p_buffer)) - { - return NRF_ERROR_INVALID_PARAM; - } - // Check for NULL buffer - if (p_buffer == NULL) - { - return NRF_ERROR_INVALID_PARAM; - } - - // Stop RTC to prevent any running timers from expiring (in case of reinitialization) - rtc1_stop(); - - m_evt_schedule_func = evt_schedule_func; - - // Initialize operation queue - m_op_queue.first = 0; - m_op_queue.last = 0; - m_op_queue.size = op_queue_size; - m_op_queue.p_user_op_queue = p_buffer; - - mp_timer_id_head = NULL; - m_ticks_elapsed_q_read_ind = 0; - m_ticks_elapsed_q_write_ind = 0; - -#if APP_TIMER_WITH_PROFILER - m_max_user_op_queue_utilization = 0; -#endif - - NVIC_ClearPendingIRQ(SWI_IRQn); - NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI); - NVIC_EnableIRQ(SWI_IRQn); - - rtc1_init(prescaler); - - m_ticks_latest = rtc1_counter_get(); - - return NRF_SUCCESS; -} - - -uint32_t app_timer_create(app_timer_id_t const * p_timer_id, - app_timer_mode_t mode, - app_timer_timeout_handler_t timeout_handler) -{ - // Check state and parameters - VERIFY_MODULE_INITIALIZED(); - - if (timeout_handler == NULL) - { - return NRF_ERROR_INVALID_PARAM; - } - if (p_timer_id == NULL) - { - return NRF_ERROR_INVALID_PARAM; - } - if (((timer_node_t*)*p_timer_id)->is_running) - { - return NRF_ERROR_INVALID_STATE; - } - - timer_node_t * p_node = (timer_node_t *)*p_timer_id; - p_node->is_running = false; - p_node->mode = mode; - p_node->p_timeout_handler = timeout_handler; - return NRF_SUCCESS; -} - -uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context) -{ - uint32_t timeout_periodic; - timer_node_t * p_node = (timer_node_t*)timer_id; - - // Check state and parameters - VERIFY_MODULE_INITIALIZED(); - - if (timer_id == 0) - { - return NRF_ERROR_INVALID_STATE; - } - if (timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS) - { - return NRF_ERROR_INVALID_PARAM; - } - if (p_node->p_timeout_handler == NULL) - { - return NRF_ERROR_INVALID_STATE; - } - - // Schedule timer start operation - timeout_periodic = (p_node->mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0; - - return timer_start_op_schedule(p_node, - timeout_ticks, - timeout_periodic, - p_context); -} - - -uint32_t app_timer_stop(app_timer_id_t timer_id) -{ - timer_node_t * p_node = (timer_node_t*)timer_id; - // Check state and parameters - VERIFY_MODULE_INITIALIZED(); - - if ((timer_id == NULL) || (p_node->p_timeout_handler == NULL)) - { - return NRF_ERROR_INVALID_STATE; - } - - p_node->is_running = false; - // Schedule timer stop operation - return timer_stop_op_schedule(p_node, TIMER_USER_OP_TYPE_STOP); -} - - -uint32_t app_timer_stop_all(void) -{ - // Check state - VERIFY_MODULE_INITIALIZED(); - - return timer_stop_op_schedule(NULL, TIMER_USER_OP_TYPE_STOP_ALL); -} - - -uint32_t app_timer_cnt_get(void) -{ - return rtc1_counter_get(); -} - - -uint32_t app_timer_cnt_diff_compute(uint32_t ticks_to, - uint32_t ticks_from, - uint32_t * p_ticks_diff) -{ - *p_ticks_diff = ticks_diff_get(ticks_to, ticks_from); - return NRF_SUCCESS; -} - -#if APP_TIMER_WITH_PROFILER -uint8_t app_timer_op_queue_utilization_get(void) -{ - return m_max_user_op_queue_utilization; -} -#endif -#endif //NRF_MODULE_ENABLED(APP_TIMER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_freertos.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_freertos.c deleted file mode 100644 index b7414b488e..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_freertos.c +++ /dev/null @@ -1,230 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ -#include "sdk_common.h" -#if NRF_MODULE_ENABLED(APP_TIMER) -#include "FreeRTOS.h" -#include "task.h" -#include "timers.h" - -#include "app_timer.h" -#include -#include -#include "nrf.h" -#include "app_error.h" - -/* Check if RTC FreeRTOS version is used */ -#if configTICK_SOURCE != FREERTOS_USE_RTC -#error app_timer in FreeRTOS variant have to be used with RTC tick source configuration. Default configuration have to be used in other case. -#endif - -/** - * @brief Waiting time for the timer queue - * - * Number of system ticks to wait for the timer queue to put the message. - * It is strongly recommended to set this to the value bigger than 1. - * In other case if timer message queue is full - any operation on timer may fail. - * @note - * Timer functions called from interrupt context would never wait. - */ -#define APP_TIMER_WAIT_FOR_QUEUE 2 - -/**@brief This structure keeps information about osTimer.*/ -typedef struct -{ - void * argument; - TimerHandle_t osHandle; - app_timer_timeout_handler_t func; - /** - * This member is to make sure that timer function is only called if timer is running. - * FreeRTOS may have timer running even after stop function is called, - * because it processes commands in Timer task and stopping function only puts command into the queue. */ - bool active; -}app_timer_info_t; - -/** - * @brief Prescaler that was set by the user - * - * In FreeRTOS version of app_timer the prescaler setting is constant and done by the operating system. - * But the application expect the prescaler to be set according to value given in setup and then - * calculate required ticks using this value. - * For compatibility we remember the value set and use it for recalculation of required timer setting. - */ -static uint32_t m_prescaler; - -/* Check if freeRTOS timers are activated */ -#if configUSE_TIMERS == 0 - #error app_timer for freeRTOS requires configUSE_TIMERS option to be activated. -#endif - -/* Check if app_timer_t variable type can held our app_timer_info_t structure */ -STATIC_ASSERT(sizeof(app_timer_info_t) <= sizeof(app_timer_t)); - - -/** - * @brief Internal callback function for the system timer - * - * Internal function that is called from the system timer. - * It gets our parameter from timer data and sends it to user function. - * @param[in] xTimer Timer handler - */ -static void app_timer_callback(TimerHandle_t xTimer) -{ - app_timer_info_t * pinfo = (app_timer_info_t*)(pvTimerGetTimerID(xTimer)); - ASSERT(pinfo->osHandle == xTimer); - ASSERT(pinfo->func != NULL); - - if (pinfo->active) - pinfo->func(pinfo->argument); -} - - -uint32_t app_timer_init(uint32_t prescaler, - uint8_t op_queues_size, - void * p_buffer, - app_timer_evt_schedule_func_t evt_schedule_func) -{ - UNUSED_PARAMETER(op_queues_size); - UNUSED_PARAMETER(p_buffer); - UNUSED_PARAMETER(evt_schedule_func); - - m_prescaler = prescaler + 1; - - return NRF_SUCCESS; -} - - -uint32_t app_timer_create(app_timer_id_t const * p_timer_id, - app_timer_mode_t mode, - app_timer_timeout_handler_t timeout_handler) -{ - app_timer_info_t * pinfo = (app_timer_info_t*)(*p_timer_id); - uint32_t err_code = NRF_SUCCESS; - unsigned long timer_mode; - - if ((timeout_handler == NULL) || (p_timer_id == NULL)) - { - return NRF_ERROR_INVALID_PARAM; - } - if (pinfo->active) - { - return NRF_ERROR_INVALID_STATE; - } - - if (pinfo->osHandle == NULL) - { - /* New timer is created */ - memset(pinfo, 0, sizeof(app_timer_info_t)); - - if (mode == APP_TIMER_MODE_SINGLE_SHOT) - timer_mode = pdFALSE; - else - timer_mode = pdTRUE; - - pinfo->func = timeout_handler; - pinfo->osHandle = xTimerCreate(" ", 1000, timer_mode, pinfo, app_timer_callback); - - if (pinfo->osHandle == NULL) - err_code = NRF_ERROR_NULL; - } - else - { - /* Timer cannot be reinitialized using FreeRTOS API */ - return NRF_ERROR_INVALID_STATE; - } - - return err_code; -} - - -uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context) -{ - app_timer_info_t * pinfo = (app_timer_info_t*)(timer_id); - TimerHandle_t hTimer = pinfo->osHandle; - uint32_t rtc_prescaler = portNRF_RTC_REG->PRESCALER + 1; - /* Get back the microseconds to wait */ - uint32_t timeout_corrected = ROUNDED_DIV(timeout_ticks * m_prescaler, rtc_prescaler); - - if (hTimer == NULL) - { - return NRF_ERROR_INVALID_STATE; - } - if (pinfo->active && (xTimerIsTimerActive(hTimer) != pdFALSE)) - { - // Timer already running - exit silently - return NRF_SUCCESS; - } - - pinfo->argument = p_context; - - if (__get_IPSR() != 0) - { - BaseType_t yieldReq = pdFALSE; - if (xTimerChangePeriodFromISR(hTimer, timeout_corrected, &yieldReq) != pdPASS) - { - return NRF_ERROR_NO_MEM; - } - - if ( xTimerStartFromISR(hTimer, &yieldReq) != pdPASS ) - { - return NRF_ERROR_NO_MEM; - } - - portYIELD_FROM_ISR(yieldReq); - } - else - { - if (xTimerChangePeriod(hTimer, timeout_corrected, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS) - { - return NRF_ERROR_NO_MEM; - } - - if (xTimerStart(hTimer, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS) - { - return NRF_ERROR_NO_MEM; - } - } - - pinfo->active = true; - return NRF_SUCCESS; -} - - -uint32_t app_timer_stop(app_timer_id_t timer_id) -{ - app_timer_info_t * pinfo = (app_timer_info_t*)(timer_id); - TimerHandle_t hTimer = pinfo->osHandle; - if (hTimer == NULL) - { - return NRF_ERROR_INVALID_STATE; - } - - if (__get_IPSR() != 0) - { - BaseType_t yieldReq = pdFALSE; - if (xTimerStopFromISR(timer_id, &yieldReq) != pdPASS) - { - return NRF_ERROR_NO_MEM; - } - portYIELD_FROM_ISR(yieldReq); - } - else - { - if (xTimerStop(timer_id, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS) - { - return NRF_ERROR_NO_MEM; - } - } - - pinfo->active = false; - return NRF_SUCCESS; -} -#endif //NRF_MODULE_ENABLED(APP_TIMER) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c index 117cba287e..5ce1b7abc8 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c @@ -9,7 +9,8 @@ * the file. * */ - +#ifdef __MBED_CMSIS_RTOS_CM + #include "sdk_common.h" #if NRF_MODULE_ENABLED(APP_TIMER) #include "app_timer.h" @@ -254,3 +255,5 @@ uint32_t app_timer_cnt_diff_compute(uint32_t ticks_to, return NRF_SUCCESS; } #endif //NRF_MODULE_ENABLED(APP_TIMER) + +#endif // __MBED_CMSIS_RTOS_CM From 46f72777dcace6b0d303b4becc59ffe5af1f822a Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 3 Jan 2017 19:42:04 +0100 Subject: [PATCH 10/31] make nRF52840 target compilable for ARM compiler - enable fstorage in sdk config - remove files of modules: bootloader, DFU bootloader and UICR setings --- .../TARGET_MCU_NRF52840/sdk/sdk_config.h | 37 + .../bootloader/ble_dfu/nrf_ble_dfu.c | 1037 ----------------- .../bootloader/ble_dfu/nrf_ble_dfu.h | 120 -- .../sdk/libraries/bootloader/dfu/nrf_dfu.c | 177 --- .../sdk/libraries/bootloader/dfu/nrf_dfu.h | 105 -- .../libraries/bootloader/dfu/nrf_dfu_mbr.c | 133 --- .../libraries/bootloader/dfu/nrf_dfu_mbr.h | 118 -- .../bootloader/dfu/nrf_dfu_settings.c | 260 ----- .../bootloader/dfu/nrf_dfu_settings.h | 87 -- .../libraries/bootloader/dfu/nrf_dfu_utils.c | 572 --------- .../libraries/bootloader/dfu/nrf_dfu_utils.h | 118 -- .../sdk/libraries/bootloader/nrf_bootloader.c | 99 -- .../sdk/libraries/bootloader/nrf_bootloader.h | 91 -- .../bootloader/nrf_bootloader_app_start.c | 209 ---- .../bootloader/nrf_bootloader_app_start.h | 70 -- .../bootloader/nrf_bootloader_info.c | 58 - .../bootloader/nrf_bootloader_info.h | 135 --- 17 files changed, 37 insertions(+), 3389 deletions(-) delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.h diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h index ded519da30..253f879999 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h @@ -2905,6 +2905,43 @@ #define CRC32_ENABLED 1 #endif +// FSTORAGE_ENABLED - fstorage - Flash storage module +//========================================================== +#ifndef FSTORAGE_ENABLED +#define FSTORAGE_ENABLED 1 +#endif +#if FSTORAGE_ENABLED +// FS_QUEUE_SIZE - Configures the size of the internal queue. +// Increase this if there are many users, or if it is likely that many +// operation will be queued at once without waiting for the previous operations +// to complete. In general, increase the queue size if you frequently receive +// @ref FS_ERR_QUEUE_FULL errors when calling @ref fs_store or @ref fs_erase. + +#ifndef FS_QUEUE_SIZE +#define FS_QUEUE_SIZE 4 +#endif + +// FS_OP_MAX_RETRIES - Number attempts to execute an operation if the SoftDevice fails. +// Increase this value if events return the @ref FS_ERR_OPERATION_TIMEOUT +// error often. The SoftDevice may fail to schedule flash access due to high BLE activity. + +#ifndef FS_OP_MAX_RETRIES +#define FS_OP_MAX_RETRIES 3 +#endif + +// FS_MAX_WRITE_SIZE_WORDS - Maximum number of words to be written to flash in a single operation. +// Tweaking this value can increase the chances of the SoftDevice being +// able to fit flash operations in between radio activity. This value is bound by the +// maximum number of words which the SoftDevice can write to flash in a single call to +// @ref sd_flash_write, which is 256 words for nRF51 ICs and 1024 words for nRF52 ICs. + +#ifndef FS_MAX_WRITE_SIZE_WORDS +#define FS_MAX_WRITE_SIZE_WORDS 1024 +#endif + +#endif //FSTORAGE_ENABLED +// + // ECC_ENABLED - ecc - Elliptic Curve Cryptography Library diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.c deleted file mode 100644 index 535bbc5bd7..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.c +++ /dev/null @@ -1,1037 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "nrf_ble_dfu.h" - -#include -#include "sdk_common.h" -#include "nrf_dfu_req_handler.h" -#include "nrf_dfu_transport.h" -#include "nrf_dfu_mbr.h" -#include "nrf_bootloader_info.h" -#include "ble_conn_params.h" -#include "boards.h" -#include "nrf_log.h" -#include "ble_hci.h" -#include "app_timer.h" -#include "softdevice_handler_appsh.h" -#include "nrf_log.h" -#include "nrf_delay.h" - -#define ADVERTISING_LED_PIN_NO BSP_LED_0 /**< Is on when device is advertising. */ -#define CONNECTED_LED_PIN_NO BSP_LED_1 /**< Is on when device has connected. */ - -#define DEVICE_NAME "DfuTarg" /**< Name of device. Will be included in the advertising data. */ -#define MANUFACTURER_NAME "NordicSemiconductor" /**< Manufacturer. Will be passed to Device Information Service. */ - -#define MIN_CONN_INTERVAL (uint16_t)(MSEC_TO_UNITS(15, UNIT_1_25_MS)) /**< Minimum acceptable connection interval. */ -#define MAX_CONN_INTERVAL_MS 30 /**< Maximum acceptable connection interval in milliseconds. */ -#define MAX_CONN_INTERVAL (uint16_t)(MSEC_TO_UNITS(MAX_CONN_INTERVAL_MS, UNIT_1_25_MS)) /**< Maximum acceptable connection interval . */ -#define SLAVE_LATENCY 0 /**< Slave latency. */ -#define CONN_SUP_TIMEOUT (4 * 100) /**< Connection supervisory timeout (4 seconds). */ - -#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ - -#define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(100, APP_TIMER_PRESCALER) /**< Time from the Connected event to first time sd_ble_gap_conn_param_update is called (100 milliseconds). */ -#define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(500, APP_TIMER_PRESCALER) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (500 milliseconds). */ -#define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */ - -#define MAX_ADV_DATA_LENGTH 20 /**< Maximum length of advertising data. */ - -#define APP_ADV_INTERVAL MSEC_TO_UNITS(25, UNIT_0_625_MS) /**< The advertising interval (25 ms.). */ -#define APP_ADV_TIMEOUT_IN_SECONDS BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED /**< The advertising timeout in units of seconds. This is set to @ref BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED so that the advertisement is done as long as there there is a call to @ref dfu_transport_close function.*/ - -#define APP_FEATURE_NOT_SUPPORTED BLE_GATT_STATUS_ATTERR_APP_BEGIN + 2 /**< Reply when unsupported features are requested. */ - -#define MAX_DFU_PKT_LEN (20) /**< Maximum length (in bytes) of the DFU Packet characteristic. */ -#define PKT_CREATE_PARAM_LEN (6) /**< Length (in bytes) of the parameters for Create Object request. */ -#define PKT_SET_PRN_PARAM_LEN (3) /**< Length (in bytes) of the parameters for Set Packet Receipt Notification request. */ -#define PKT_READ_OBJECT_INFO_PARAM_LEN (2) /**< Length (in bytes) of the parameters for Read Object Info request. */ -#define MAX_RESPONSE_LEN (15) /**< Maximum length (in bytes) of the response to a Control Point command. */ - - -#if (NRF_SD_BLE_API_VERSION <= 3) - #define NRF_BLE_MAX_MTU_SIZE GATT_MTU_SIZE_DEFAULT /**< MTU size used in the softdevice enabling and to reply to a BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST event. */ -#else - #define NRF_BLE_MAX_MTU_SIZE BLE_GATT_MTU_SIZE_DEFAULT /**< MTU size used in the softdevice enabling and to reply to a BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST event. */ -#endif - - -static ble_dfu_t m_dfu; /**< Structure used to identify the Device Firmware Update service. */ -static uint16_t m_pkt_notif_target; /**< Number of packets of firmware data to be received before transmitting the next Packet Receipt Notification to the DFU Controller. */ -static uint16_t m_pkt_notif_target_cnt; /**< Number of packets of firmware data received after sending last Packet Receipt Notification or since the receipt of a @ref BLE_DFU_PKT_RCPT_NOTIF_ENABLED event from the DFU service, which ever occurs later.*/ -static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current connection. */ - -#define DFU_BLE_FLAG_NONE (0) -#define DFU_BLE_FLAG_SERVICE_INITIALIZED (1 << 0) /**< Flag to check if the DFU service was initialized by the application.*/ -#define DFU_BLE_FLAG_IS_ADVERTISING (1 << 1) /**< Flag to indicate if advertising is ongoing.*/ -#define DFU_BLE_FLAG_TEAR_DOWN_IN_PROGRESS (1 << 2) /**< Flag to indicate whether a tear down is in progress. A tear down could be because the application has initiated it or the peer has disconnected. */ - -static uint32_t m_flags; - -static uint8_t m_notif_buffer[MAX_RESPONSE_LEN]; /**< Buffer used for sending notifications to peer. */ - -//lint -save -e545 -esym(526, dfu_trans) -esym(528, dfu_trans) -DFU_TRANSPORT_REGISTER(nrf_dfu_transport_t const dfu_trans) = -{ - .init_func = ble_dfu_transport_init, - .close_func = ble_dfu_transport_close -}; -//lint -restore - - -/**@brief Function for handling a Connection Parameters error. - * - * @param[in] nrf_error Error code. - */ -static void conn_params_error_handler(uint32_t nrf_error) -{ - APP_ERROR_HANDLER(nrf_error); -} - - -/**@brief Function for initializing the Connection Parameters module. - */ -static uint32_t conn_params_init(void) -{ - ble_conn_params_init_t cp_init = {0}; - - cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY; - cp_init.next_conn_params_update_delay = NEXT_CONN_PARAMS_UPDATE_DELAY; - cp_init.max_conn_params_update_count = MAX_CONN_PARAMS_UPDATE_COUNT; - cp_init.start_on_notify_cccd_handle = BLE_GATT_HANDLE_INVALID; - cp_init.disconnect_on_fail = false; - cp_init.error_handler = conn_params_error_handler; - - return ble_conn_params_init(&cp_init); -} - - -/**@brief Function for the Advertising functionality initialization. - * - * @details Encodes the required advertising data and passes it to the stack. - * The advertising data encoded here is specific for DFU. - * Setting advertising data can by done by calling @ref ble_advdata_set. - */ -static uint32_t advertising_init(uint8_t adv_flags) -{ - uint32_t err_code; - uint16_t len_advdata = 9; - uint16_t max_device_name_length = MAX_ADV_DATA_LENGTH - len_advdata; - uint16_t actual_device_name_length = max_device_name_length; - - uint8_t p_encoded_advdata[MAX_ADV_DATA_LENGTH]; - - // Encode flags. - p_encoded_advdata[0] = 0x2; - p_encoded_advdata[1] = BLE_GAP_AD_TYPE_FLAGS; - p_encoded_advdata[2] = adv_flags; - - // Encode 'more available' uuid list. - p_encoded_advdata[3] = 0x3; - p_encoded_advdata[4] = BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE; - p_encoded_advdata[5] = LSB_16(BLE_DFU_SERVICE_UUID); - p_encoded_advdata[6] = MSB_16(BLE_DFU_SERVICE_UUID); - - // Get GAP device name and length - err_code = sd_ble_gap_device_name_get(&p_encoded_advdata[9], &actual_device_name_length); - if (err_code != NRF_SUCCESS) - { - return err_code; - } - - // Set GAP device in advertising data. - if (actual_device_name_length <= max_device_name_length) - { - p_encoded_advdata[7] = actual_device_name_length + 1; // (actual_length + ADV_AD_TYPE_FIELD_SIZE(1)) - p_encoded_advdata[8] = BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME; - len_advdata += actual_device_name_length; - } - else - { - // Must use a shorter advertising name than the actual name of the device - p_encoded_advdata[7] = max_device_name_length + 1; // (length + ADV_AD_TYPE_FIELD_SIZE(1)) - p_encoded_advdata[8] = BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME; - len_advdata = MAX_ADV_DATA_LENGTH; - } - return sd_ble_gap_adv_data_set(p_encoded_advdata, len_advdata, NULL, 0); -} - - -/**@brief Function for starting advertising. - */ -static uint32_t advertising_start(void) -{ - uint32_t err_code; - ble_gap_adv_params_t adv_params; - - if ((m_flags & DFU_BLE_FLAG_IS_ADVERTISING) != 0) - { - return NRF_SUCCESS; - } - - // Initialize advertising parameters (used when starting advertising). - memset(&adv_params, 0, sizeof(adv_params)); - - err_code = advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE); - VERIFY_SUCCESS(err_code); - - adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND; - adv_params.p_peer_addr = NULL; - adv_params.fp = BLE_GAP_ADV_FP_ANY; - adv_params.interval = APP_ADV_INTERVAL; - adv_params.timeout = APP_ADV_TIMEOUT_IN_SECONDS; - - err_code = sd_ble_gap_adv_start(&adv_params); - VERIFY_SUCCESS(err_code); - - nrf_gpio_pin_clear(ADVERTISING_LED_PIN_NO); - nrf_gpio_pin_set(CONNECTED_LED_PIN_NO); - - m_flags |= DFU_BLE_FLAG_IS_ADVERTISING; - return NRF_SUCCESS; -} - - -/**@brief Function for stopping advertising. - */ -static uint32_t advertising_stop(void) -{ - uint32_t err_code; - - if ((m_flags & DFU_BLE_FLAG_IS_ADVERTISING) == 0) - { - return NRF_SUCCESS; - } - - err_code = sd_ble_gap_adv_stop(); - VERIFY_SUCCESS(err_code); - - nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO); - - m_flags |= DFU_BLE_FLAG_IS_ADVERTISING; - return NRF_SUCCESS; -} - - -static bool is_cccd_configured(ble_dfu_t * p_dfu) -{ - uint8_t cccd_val_buf[BLE_CCCD_VALUE_LEN]; - ble_gatts_value_t gatts_value = {0}; - - gatts_value.len = BLE_CCCD_VALUE_LEN; - gatts_value.p_value = cccd_val_buf; - - // Check the CCCD Value of DFU Control Point. - uint32_t err_code = sd_ble_gatts_value_get(m_conn_handle, - p_dfu->dfu_ctrl_pt_handles.cccd_handle, - &gatts_value); - VERIFY_SUCCESS(err_code); - - return ble_srv_is_notification_enabled(cccd_val_buf); -} - - -static uint32_t send_hvx(uint16_t conn_handle, uint16_t value_handle, uint16_t len) -{ - ble_gatts_hvx_params_t hvx_params = {0}; - - hvx_params.handle = value_handle; - hvx_params.type = BLE_GATT_HVX_NOTIFICATION; - hvx_params.p_len = &len; - hvx_params.p_data = m_notif_buffer; - - return sd_ble_gatts_hvx(conn_handle, &hvx_params); -} - - -static uint32_t response_send(ble_dfu_t * p_dfu, - uint8_t op_code, - nrf_dfu_res_code_t resp_val) -{ - uint16_t index = 0; - - NRF_LOG_INFO("Sending Response: [0x%01x, 0x%01x]\r\n", op_code, resp_val); - -#ifndef NRF51 - if (p_dfu == NULL) - { - return NRF_ERROR_NULL; - } -#endif - - if ((m_conn_handle == BLE_CONN_HANDLE_INVALID) || (m_flags & DFU_BLE_FLAG_SERVICE_INITIALIZED) == 0) - { - return NRF_ERROR_INVALID_STATE; - } - - m_notif_buffer[index++] = BLE_DFU_OP_CODE_RESPONSE; - - // Encode the Request Op code - m_notif_buffer[index++] = op_code; - - // Encode the Response Value. - m_notif_buffer[index++] = (uint8_t)resp_val; - - return send_hvx(m_conn_handle, p_dfu->dfu_ctrl_pt_handles.value_handle, index); -} - - -static uint32_t response_crc_cmd_send(ble_dfu_t * p_dfu, - uint32_t offset, - uint32_t crc) -{ - uint16_t index = 0; - - NRF_LOG_INFO("Sending CRC: [0x60, 0x03, 0x01, 0:x%08x, CRC:0x%08x]\r\n", offset, crc); - -#ifndef NRF51 - if (p_dfu == NULL) - { - return NRF_ERROR_NULL; - } -#endif - - if ((m_conn_handle == BLE_CONN_HANDLE_INVALID) || (m_flags & DFU_BLE_FLAG_SERVICE_INITIALIZED) == 0) - { - return NRF_ERROR_INVALID_STATE; - } - - m_notif_buffer[index++] = BLE_DFU_OP_CODE_RESPONSE; - - // Encode the Request Op code - m_notif_buffer[index++] = BLE_DFU_OP_CODE_CALCULATE_CRC; - - // Encode the Response Value. - m_notif_buffer[index++] = (uint8_t)NRF_DFU_RES_CODE_SUCCESS; - - // Encode the Offset Value. - index += uint32_encode(offset, &m_notif_buffer[index]); - - // Encode the Crc Value. - index += uint32_encode(crc, &m_notif_buffer[index]); - - return send_hvx(m_conn_handle, p_dfu->dfu_ctrl_pt_handles.value_handle, index); -} - - -static uint32_t response_select_object_cmd_send(ble_dfu_t * p_dfu, - uint32_t max_size, - uint32_t offset, - uint32_t crc) -{ - uint16_t index = 0; - - NRF_LOG_INFO("Sending Object Info: [0x60, 0x06, 0x01 max: 0:x%08x 0:x%08x, CRC:0x%08x]\r\n", max_size, offset, crc); -#ifndef NRF51 - if (p_dfu == NULL) - { - return NRF_ERROR_NULL; - } -#endif - - if ((m_conn_handle == BLE_CONN_HANDLE_INVALID) || (m_flags & DFU_BLE_FLAG_SERVICE_INITIALIZED) == 0) - { - return NRF_ERROR_INVALID_STATE; - } - - m_notif_buffer[index++] = BLE_DFU_OP_CODE_RESPONSE; - - // Encode the Request Op code - m_notif_buffer[index++] = BLE_DFU_OP_CODE_SELECT_OBJECT; - - // Encode the Success Response Value. - m_notif_buffer[index++] = (uint8_t)NRF_DFU_RES_CODE_SUCCESS; - - // Encode the Max Size Value. - index += uint32_encode(max_size, &m_notif_buffer[index]); - - // Encode the Offset Value. - index += uint32_encode(offset, &m_notif_buffer[index]); - - // Encode the Crc Value. - index += uint32_encode(crc, &m_notif_buffer[index]); - - return send_hvx(m_conn_handle, p_dfu->dfu_ctrl_pt_handles.value_handle, index); -} - - -/**@brief Function for handling a Write event on the Control Point characteristic. - * - * @param[in] p_dfu DFU Service Structure. - * @param[in] p_ble_write_evt Pointer to the write event received from BLE stack. - * - * @return NRF_SUCCESS on successful processing of control point write. Otherwise an error code. - */ -static uint32_t on_ctrl_pt_write(ble_dfu_t * p_dfu, ble_gatts_evt_write_t * p_ble_write_evt) -{ - nrf_dfu_res_code_t res_code; - nrf_dfu_req_t dfu_req; - nrf_dfu_res_t dfu_res = {{{0}}}; - - memset(&dfu_req, 0, sizeof(nrf_dfu_req_t)); - - switch (p_ble_write_evt->data[0]) - { - case BLE_DFU_OP_CODE_CREATE_OBJECT: - - if (p_ble_write_evt->len != PKT_CREATE_PARAM_LEN) - { - return response_send(p_dfu, - BLE_DFU_OP_CODE_CREATE_OBJECT, - NRF_DFU_RES_CODE_INVALID_PARAMETER); - } - - NRF_LOG_INFO("Received create object\r\n"); - - // Reset the packet receipt notification on create object - m_pkt_notif_target_cnt = m_pkt_notif_target; - - // Get type parameter - //lint -save -e415 - dfu_req.obj_type = p_ble_write_evt->data[1]; - //lint -restore - - // Get length value - //lint -save -e416 - dfu_req.object_size = uint32_decode(&(p_ble_write_evt->data[2])); - //lint -restore - - // Set req type - dfu_req.req_type = NRF_DFU_OBJECT_OP_CREATE; - - res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); - return response_send(p_dfu, BLE_DFU_OP_CODE_CREATE_OBJECT, res_code); - - case BLE_DFU_OP_CODE_EXECUTE_OBJECT: - NRF_LOG_INFO("Received execute object\r\n"); - - // Set req type - dfu_req.req_type = NRF_DFU_OBJECT_OP_EXECUTE; - - res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); - return response_send(p_dfu, BLE_DFU_OP_CODE_EXECUTE_OBJECT, res_code); - - case BLE_DFU_OP_CODE_SET_RECEIPT_NOTIF: - NRF_LOG_INFO("Set receipt notif\r\n"); - if (p_ble_write_evt->len != PKT_SET_PRN_PARAM_LEN) - { - return (response_send(p_dfu, - BLE_DFU_OP_CODE_SET_RECEIPT_NOTIF, - NRF_DFU_RES_CODE_INVALID_PARAMETER)); - } - - //lint -save -e415 - m_pkt_notif_target = uint16_decode(&(p_ble_write_evt->data[1])); - //lint -restore - m_pkt_notif_target_cnt = m_pkt_notif_target; - - return response_send(p_dfu, BLE_DFU_OP_CODE_SET_RECEIPT_NOTIF, NRF_DFU_RES_CODE_SUCCESS); - - case BLE_DFU_OP_CODE_CALCULATE_CRC: - NRF_LOG_INFO("Received calculate CRC\r\n"); - - dfu_req.req_type = NRF_DFU_OBJECT_OP_CRC; - - res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); - if (res_code == NRF_DFU_RES_CODE_SUCCESS) - { - return response_crc_cmd_send(p_dfu, dfu_res.offset, dfu_res.crc); - } - else - { - return response_send(p_dfu, BLE_DFU_OP_CODE_CALCULATE_CRC, res_code); - } - - case BLE_DFU_OP_CODE_SELECT_OBJECT: - - NRF_LOG_INFO("Received select object\r\n"); - if (p_ble_write_evt->len != PKT_READ_OBJECT_INFO_PARAM_LEN) - { - return response_send(p_dfu, - BLE_DFU_OP_CODE_SELECT_OBJECT, - NRF_DFU_RES_CODE_INVALID_PARAMETER); - } - - // Set object type to read info about - //lint -save -e415 - dfu_req.obj_type = p_ble_write_evt->data[1]; - //lint -restore - - dfu_req.req_type = NRF_DFU_OBJECT_OP_SELECT; - - res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); - if (res_code == NRF_DFU_RES_CODE_SUCCESS) - { - return response_select_object_cmd_send(p_dfu, dfu_res.max_size, dfu_res.offset, dfu_res.crc); - } - else - { - return response_send(p_dfu, BLE_DFU_OP_CODE_SELECT_OBJECT, res_code); - } - - default: - NRF_LOG_INFO("Received unsupported OP code\r\n"); - // Unsupported op code. - return response_send(p_dfu, - p_ble_write_evt->data[0], - NRF_DFU_RES_CODE_INVALID_PARAMETER); - } -} - - -/**@brief Function for handling the @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event from the - * SoftDevice. - * - * @param[in] p_dfu DFU Service Structure. - * @param[in] p_ble_evt Pointer to the event received from BLE stack. - */ -static bool on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) -{ - uint32_t err_code; - ble_gatts_rw_authorize_reply_params_t auth_reply = {0}; - ble_gatts_evt_rw_authorize_request_t * p_authorize_request; - ble_gatts_evt_write_t * p_ble_write_evt; - - p_authorize_request = &(p_ble_evt->evt.gatts_evt.params.authorize_request); - p_ble_write_evt = &(p_ble_evt->evt.gatts_evt.params.authorize_request.request.write); - - if ((p_authorize_request->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) && - (p_authorize_request->request.write.handle == p_dfu->dfu_ctrl_pt_handles.value_handle) && - (p_authorize_request->request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ) && - (p_authorize_request->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) && - (p_authorize_request->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) ) - { - auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; - auth_reply.params.write.update = 1; - auth_reply.params.write.offset = p_ble_write_evt->offset; - auth_reply.params.write.len = p_ble_write_evt->len; - auth_reply.params.write.p_data = p_ble_write_evt->data; - - if (!is_cccd_configured(p_dfu)) - { - // Send an error response to the peer indicating that the CCCD is improperly configured. - auth_reply.params.write.gatt_status = BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR; - - // Ignore response of auth reply - (void)sd_ble_gatts_rw_authorize_reply(m_conn_handle, &auth_reply); - return false; - } - - auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; - - err_code = sd_ble_gatts_rw_authorize_reply(m_conn_handle, &auth_reply); - return err_code == NRF_SUCCESS ? true: false; - } - else - { - return false; - } -} - - -/**@brief Function for handling the @ref BLE_GATTS_EVT_WRITE event from the SoftDevice. - * - * @param[in] p_dfu DFU Service Structure. - * @param[in] p_ble_evt Pointer to the event received from BLE stack. - */ -static void on_write(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt) -{ - if (p_ble_evt->evt.gatts_evt.params.write.handle == p_dfu->dfu_pkt_handles.value_handle) - { - nrf_dfu_res_code_t res_code; - nrf_dfu_req_t dfu_req; - nrf_dfu_res_t dfu_res = {{{0}}}; - - memset(&dfu_req, 0, sizeof(nrf_dfu_req_t)); - - // Set req type - dfu_req.req_type = NRF_DFU_OBJECT_OP_WRITE; - - // Set data and length - dfu_req.p_req = p_ble_evt->evt.gatts_evt.params.write.data; - dfu_req.req_len = p_ble_evt->evt.gatts_evt.params.write.len; - - res_code = nrf_dfu_req_handler_on_req(NULL, &dfu_req, &dfu_res); - if(res_code != NRF_DFU_RES_CODE_SUCCESS) - { - NRF_LOG_ERROR("Failure to run packet write\r\n"); - } - - // Check if a packet receipt notification is needed to be sent. - if (m_pkt_notif_target != 0 && --m_pkt_notif_target_cnt == 0) - { - (void)response_crc_cmd_send(p_dfu, dfu_res.offset, dfu_res.crc); - - // Reset the counter for the number of firmware packets. - m_pkt_notif_target_cnt = m_pkt_notif_target; - } - } -} - - -/**@brief Function for the Application's SoftDevice event handler. - * - * @param[in] p_ble_evt SoftDevice event. - */ -static void on_ble_evt(ble_evt_t * p_ble_evt) -{ - uint32_t err_code; - - switch (p_ble_evt->header.evt_id) - { - case BLE_GAP_EVT_CONNECTED: - nrf_gpio_pin_clear(CONNECTED_LED_PIN_NO); - nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO); - - m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; - m_flags &= ~DFU_BLE_FLAG_IS_ADVERTISING; - break; - - case BLE_GAP_EVT_DISCONNECTED: - // Restart advertising so that the DFU Controller can reconnect if possible. - err_code = advertising_start(); - APP_ERROR_CHECK(err_code); - - m_conn_handle = BLE_CONN_HANDLE_INVALID; - - break; - - case BLE_GAP_EVT_SEC_PARAMS_REQUEST: - { - err_code = sd_ble_gap_sec_params_reply(m_conn_handle, - BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, - NULL, - NULL); - APP_ERROR_CHECK(err_code); - } - break; - - case BLE_GATTS_EVT_TIMEOUT: - if (p_ble_evt->evt.gatts_evt.params.timeout.src == BLE_GATT_TIMEOUT_SRC_PROTOCOL) - { - err_code = sd_ble_gap_disconnect(m_conn_handle, - BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); - APP_ERROR_CHECK(err_code); - } - break; - - case BLE_EVT_USER_MEM_REQUEST: - err_code = sd_ble_user_mem_reply(m_conn_handle, NULL); - APP_ERROR_CHECK(err_code); - break; - - case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: - if (p_ble_evt->evt.gatts_evt.params.authorize_request.type - != BLE_GATTS_AUTHORIZE_TYPE_INVALID) - { - if (on_rw_authorize_req(&m_dfu, p_ble_evt)) - { - err_code = on_ctrl_pt_write(&m_dfu, - &(p_ble_evt->evt.gatts_evt.params.authorize_request.request.write)); -#ifdef NRF_DFU_DEBUG_VERSION - if (err_code != NRF_SUCCESS) - { - NRF_LOG_ERROR("Could not handle on_ctrl_pt_write. err_code: 0x%04x\r\n", err_code); - } -#else - // Swallow result - (void) err_code; -#endif - } - } - break; - - case BLE_GAP_EVT_SEC_INFO_REQUEST: - err_code = sd_ble_gap_sec_info_reply(p_ble_evt->evt.gap_evt.conn_handle, NULL, NULL, NULL); - APP_ERROR_CHECK(err_code); - break; - - case BLE_GATTS_EVT_SYS_ATTR_MISSING: - err_code = sd_ble_gatts_sys_attr_set(p_ble_evt->evt.gap_evt.conn_handle, NULL, 0, 0); - APP_ERROR_CHECK(err_code); - break; - - case BLE_GATTS_EVT_WRITE: - on_write(&m_dfu, p_ble_evt); - break; - -#if (NRF_SD_BLE_API_VERSION >= 3) - case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST: - err_code = sd_ble_gatts_exchange_mtu_reply(p_ble_evt->evt.gatts_evt.conn_handle, - NRF_BLE_MAX_MTU_SIZE); - APP_ERROR_CHECK(err_code); - break; // BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST -#endif - - default: - // No implementation needed. - break; - } -} - - -/**@brief Function for dispatching a SoftDevice event. - * - * @details This function is called from the SoftDevice event interrupt handler after a - * SoftDevice event has been received. - * - * @param[in] p_ble_evt SoftDevice event. - */ -static void ble_evt_dispatch(ble_evt_t * p_ble_evt) -{ - ble_conn_params_on_ble_evt(p_ble_evt); - on_ble_evt(p_ble_evt); -} - - -/**@brief Function for the LEDs initialization. - * - * @details Initializes all LEDs used by this application. - */ -static void leds_init(void) -{ - nrf_gpio_cfg_output(ADVERTISING_LED_PIN_NO); - nrf_gpio_cfg_output(CONNECTED_LED_PIN_NO); - nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO); - nrf_gpio_pin_set(CONNECTED_LED_PIN_NO); -} - - -static uint32_t gap_address_change(void) -{ - uint32_t err_code; - ble_gap_addr_t addr; - -#if (NRF_SD_BLE_API_VERSION < 3) - err_code = sd_ble_gap_address_get(&addr); -#else - err_code = sd_ble_gap_addr_get(&addr); -#endif - - VERIFY_SUCCESS(err_code); - - // Increase the BLE address by one when advertising openly. - addr.addr[0] += 1; - -#if (NRF_SD_BLE_API_VERSION < 3) - err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr); -#else - err_code = sd_ble_gap_addr_set(&addr); -#endif - - VERIFY_SUCCESS(err_code); - - return NRF_SUCCESS; -} - - -/**@brief Function for the GAP initialization. - * - * @details This function will setup all the necessary GAP (Generic Access Profile) parameters of - * the device. It also sets the permissions and appearance. - */ -static uint32_t gap_params_init(void) -{ - uint32_t err_code; - ble_gap_conn_params_t gap_conn_params = {0}; - ble_gap_conn_sec_mode_t sec_mode; - - - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); - - // This seems to not be implemented on Graviton - err_code = gap_address_change(); - VERIFY_SUCCESS(err_code); - - err_code = sd_ble_gap_device_name_set(&sec_mode, - (const uint8_t *)DEVICE_NAME, - strlen(DEVICE_NAME)); - - - VERIFY_SUCCESS(err_code); - - gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL; - gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL; - gap_conn_params.slave_latency = SLAVE_LATENCY; - gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT; - - err_code = sd_ble_gap_ppcp_set(&gap_conn_params); - return err_code; -} - - -static uint32_t ble_stack_init(bool init_softdevice) -{ - uint32_t err_code; - nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; - - if (init_softdevice) - { - err_code = nrf_dfu_mbr_init_sd(); - VERIFY_SUCCESS(err_code); - } - - NRF_LOG_INFO("vector table: 0x%08x\r\n", BOOTLOADER_START_ADDR); - err_code = sd_softdevice_vector_table_base_set(BOOTLOADER_START_ADDR); - VERIFY_SUCCESS(err_code); - NRF_LOG_INFO("vector table: 0x%08x\r\n", BOOTLOADER_START_ADDR); - - NRF_LOG_INFO("Error code - sd_softdevice_vector_table_base_set: 0x%08x\r\n", err_code); - //err_code = sd_softdevice_vector_table_base_set(BOOTLOADER_START_ADDR); - - NRF_LOG_INFO("Before SOFTDEVICE_HANDLER_APPSH_INIT\r\n"); - SOFTDEVICE_HANDLER_APPSH_INIT(&clock_lf_cfg, true); - NRF_LOG_INFO("After SOFTDEVICE_HANDLER_APPSH_INIT\r\n"); - - ble_enable_params_t ble_enable_params; - // Only one connection as a central is used when performing dfu. - err_code = softdevice_enable_get_default_config(1, 1, &ble_enable_params); - NRF_LOG_INFO("Error code - softdevice_enable_get_default_config: 0x%08x\r\n", err_code); - VERIFY_SUCCESS(err_code); - -#if (NRF_SD_BLE_API_VERSION >= 3) - ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_MAX_MTU_SIZE; -#endif - - NRF_LOG_INFO("Enabling softdevice.\r\n"); - // Enable BLE stack. - err_code = softdevice_enable(&ble_enable_params); - if (err_code != NRF_SUCCESS) - { - NRF_LOG_ERROR("Failed softdevice_enable: 0x%08x\r\n", err_code); - } - else - { - NRF_LOG_INFO("Softdevice enabled\r\n"); - } - - return err_code; -} - - -/**@brief Function for adding DFU Packet characteristic to the BLE Stack. - * - * @param[in] p_dfu DFU Service structure. - * - * @return NRF_SUCCESS on success. Otherwise an error code. - */ -static uint32_t dfu_pkt_char_add(ble_dfu_t * const p_dfu) -{ - ble_gatts_char_md_t char_md = {{0}}; - ble_gatts_attr_t attr_char_value = {0}; - ble_gatts_attr_md_t attr_md = {{0}}; - ble_uuid_t char_uuid; - - char_md.char_props.write_wo_resp = 1; - - char_uuid.type = p_dfu->uuid_type; - char_uuid.uuid = BLE_DFU_PKT_CHAR_UUID; - - BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); - - attr_md.vloc = BLE_GATTS_VLOC_STACK; - attr_md.vlen = 1; - - attr_char_value.p_uuid = &char_uuid; - attr_char_value.p_attr_md = &attr_md; - attr_char_value.max_len = MAX_DFU_PKT_LEN; - attr_char_value.p_value = NULL; - - return sd_ble_gatts_characteristic_add(p_dfu->service_handle, - &char_md, - &attr_char_value, - &p_dfu->dfu_pkt_handles); -} - - -/**@brief Function for adding DFU Control Point characteristic to the BLE Stack. - * - * @param[in] p_dfu DFU Service structure. - * - * @return NRF_SUCCESS on success. Otherwise an error code. - */ -static uint32_t dfu_ctrl_pt_add(ble_dfu_t * const p_dfu) -{ - ble_gatts_char_md_t char_md = {{0}}; - ble_gatts_attr_t attr_char_value = {0}; - ble_gatts_attr_md_t attr_md = {{0}}; - ble_uuid_t char_uuid; - - char_md.char_props.write = 1; - char_md.char_props.notify = 1; - - char_uuid.type = p_dfu->uuid_type; - char_uuid.uuid = BLE_DFU_CTRL_PT_UUID; - - BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); - - attr_md.vloc = BLE_GATTS_VLOC_STACK; - attr_md.wr_auth = 1; - attr_md.vlen = 1; - - attr_char_value.p_uuid = &char_uuid; - attr_char_value.p_attr_md = &attr_md; - attr_char_value.max_len = BLE_L2CAP_MTU_DEF; - attr_char_value.p_value = NULL; - - return sd_ble_gatts_characteristic_add(p_dfu->service_handle, - &char_md, - &attr_char_value, - &p_dfu->dfu_ctrl_pt_handles); -} - - -/**@brief Function for checking if the CCCD of DFU Control point is configured for Notification. - * - * @details This function checks if the CCCD of DFU Control Point characteristic is configured - * for Notification by the DFU Controller. - * - * @param[in] p_dfu DFU Service structure. - * - * @return True if the CCCD of DFU Control Point characteristic is configured for Notification. - * False otherwise. - */ -uint32_t ble_dfu_init(ble_dfu_t * p_dfu) -{ - ble_uuid_t service_uuid; - uint32_t err_code; - -#ifndef NRF51 - if (p_dfu == NULL) - { - return NRF_ERROR_NULL; - } -#endif - - m_conn_handle = BLE_CONN_HANDLE_INVALID; - - BLE_UUID_BLE_ASSIGN(service_uuid, BLE_DFU_SERVICE_UUID); - - err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, - &service_uuid, - &(p_dfu->service_handle)); - VERIFY_SUCCESS(err_code); - - const ble_uuid128_t base_uuid128 = - { - { - 0x50, 0xEA, 0xDA, 0x30, 0x88, 0x83, 0xB8, 0x9F, - 0x60, 0x4F, 0x15, 0xF3, 0x00, 0x00, 0xC9, 0x8E - } - }; - err_code = sd_ble_uuid_vs_add(&base_uuid128, &p_dfu->uuid_type); - VERIFY_SUCCESS(err_code); - - err_code = dfu_pkt_char_add(p_dfu); - VERIFY_SUCCESS(err_code); - - err_code = dfu_ctrl_pt_add(p_dfu); - VERIFY_SUCCESS(err_code); - - m_flags |= DFU_BLE_FLAG_SERVICE_INITIALIZED; - - return NRF_SUCCESS; -} - - -uint32_t ble_dfu_transport_init(void) -{ - uint32_t err_code; - - m_flags &= ~DFU_BLE_FLAG_NONE; - - leds_init(); - - err_code = ble_stack_init(true); - VERIFY_SUCCESS(err_code); - - err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); - VERIFY_SUCCESS(err_code); - - err_code = gap_params_init(); - VERIFY_SUCCESS(err_code); - - // Initialize the Device Firmware Update Service. - err_code = ble_dfu_init(&m_dfu); - VERIFY_SUCCESS(err_code); - - err_code = conn_params_init(); - VERIFY_SUCCESS(err_code); - - err_code = advertising_start(); - VERIFY_SUCCESS(err_code); - - return NRF_SUCCESS; -} - - -uint32_t ble_dfu_transport_close(void) -{ - uint32_t err_code = NRF_SUCCESS; - - if ((m_flags & DFU_BLE_FLAG_TEAR_DOWN_IN_PROGRESS) != 0) - { - return NRF_SUCCESS; - } - - m_flags |= DFU_BLE_FLAG_TEAR_DOWN_IN_PROGRESS; - - NRF_LOG_INFO("Waiting for buffers to be cleared before disconnect\r\n"); - nrf_delay_ms(MAX_CONN_INTERVAL_MS*4); - NRF_LOG_INFO("Disconnecting\r\n"); - - if (m_conn_handle != BLE_CONN_HANDLE_INVALID) - { - // Disconnect from peer. - err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); - VERIFY_SUCCESS(err_code); - } - else if ((m_flags & DFU_BLE_FLAG_IS_ADVERTISING) != 0) - { - // If not connected, then the device will be advertising. Hence stop the advertising. - err_code = advertising_stop(); - VERIFY_SUCCESS(err_code); - } - - // Stop the timer, disregard the result. - (void)ble_conn_params_stop(); - return err_code; -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.h deleted file mode 100644 index 4882acfa2a..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/ble_dfu/nrf_ble_dfu.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/**@file - * - * @defgroup nrf_ble_dfu DFU BLE Service - * @{ - * @ingroup sdk_nrf_bootloader - * @brief Device Firmware Update (DFU) transport layer for Bluetooth low energy. - * - * @details The Device Firmware Update (DFU) Service is a GATT-based service that can be used for - * performing firmware updates over BLE. Note that this implementation uses - * vendor-specific UUIDs for the service and characteristics and is intended to demonstrate - * firmware updates over BLE. See @ref lib_dfu_transport_ble "DFU Transport: BLE" for more information on the service and the profile. - */ - -#ifndef NRF_BLE_DFU_H__ -#define NRF_BLE_DFU_H__ - -#include -#include "ble_gatts.h" -#include "ble.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -// This is a 16-bit UUID. -#define BLE_DFU_SERVICE_UUID 0xFE59 //!< The UUID of the DFU Service. - -// These UUIDs are used with the Nordic base address to create a 128-bit UUID (0x8EC9XXXXF3154F609FB8838830DAEA50). -#define BLE_DFU_CTRL_PT_UUID 0x0001 //!< The UUID of the DFU Control Point. -#define BLE_DFU_PKT_CHAR_UUID 0x0002 //!< The UUID of the DFU Packet Characteristic. - - -/**@brief BLE DFU opcodes. - * - * @details These types of opcodes are used in control point access. - */ -typedef enum -{ - BLE_DFU_OP_CODE_CREATE_OBJECT = 0x01, /**< Value of the opcode field for a 'Create object' request. */ - BLE_DFU_OP_CODE_SET_RECEIPT_NOTIF = 0x02, /**< Value of the opcode field for a 'Set Packet Receipt Notification' request. */ - BLE_DFU_OP_CODE_CALCULATE_CRC = 0x03, /**< Value of the opcode field for a 'Calculating checksum' request. */ - BLE_DFU_OP_CODE_EXECUTE_OBJECT = 0x04, /**< Value of the opcode field for an 'Initialize DFU parameters' request. */ - BLE_DFU_OP_CODE_SELECT_OBJECT = 0x06, /**< Value of the opcode field for a 'Select object' request. */ - BLE_DFU_OP_CODE_RESPONSE = 0x60 /**< Value of the opcode field for a response.*/ -} ble_dfu_op_code_t; - - -/**@brief DFU Service. - * - * @details This structure contains status information related to the service. - */ -typedef struct -{ - uint16_t service_handle; /**< Handle of the DFU Service (as provided by the SoftDevice). */ - uint8_t uuid_type; /**< UUID type assigned to the DFU Service by the SoftDevice. */ - ble_gatts_char_handles_t dfu_pkt_handles; /**< Handles related to the DFU Packet Characteristic. */ - ble_gatts_char_handles_t dfu_ctrl_pt_handles; /**< Handles related to the DFU Control Point Characteristic. */ -} ble_dfu_t; - - -/**@brief Function for initializing the DFU Service. - * - * @retval NRF_SUCCESS If the DFU Service and its characteristics were successfully added to the - * SoftDevice. Otherwise, an error code is returned. - */ -uint32_t ble_dfu_transport_init(void); - - -/**@brief Function for closing down the DFU Service and disconnecting from the host. - * - * @retval NRF_SUCCESS If the DFU Service was correctly closed down. - */ -uint32_t ble_dfu_transport_close(void); - -#ifdef __cplusplus -} -#endif - -#endif // NRF_BLE_DFU_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.c deleted file mode 100644 index 43a80a07a0..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "nrf_dfu.h" -#include "nrf_dfu_transport.h" -#include "nrf_dfu_utils.h" -#include "nrf_bootloader_app_start.h" -#include "nrf_dfu_settings.h" -#include "nrf_gpio.h" -#include "app_scheduler.h" -#include "app_timer_appsh.h" -#include "nrf_log.h" -#include "boards.h" -#include "nrf_bootloader_info.h" -#include "nrf_dfu_req_handler.h" - -#define SCHED_MAX_EVENT_DATA_SIZE MAX(APP_TIMER_SCHED_EVT_SIZE, 0) /**< Maximum size of scheduler events. */ - -#define SCHED_QUEUE_SIZE 20 /**< Maximum number of events in the scheduler queue. */ - -#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ -#define APP_TIMER_OP_QUEUE_SIZE 4 /**< Size of timer operation queues. */ - -// Weak function implementation - -/** @brief Weak implemenation of nrf_dfu_check_enter. - * - * @note This function must be overridden to enable entering DFU mode at will. - * Default behaviour is to enter DFU when BOOTLOADER_BUTTON is pressed. - */ -__WEAK bool nrf_dfu_enter_check(void) -{ - if (nrf_gpio_pin_read(BOOTLOADER_BUTTON) == 0) - { - return true; - } - - if (s_dfu_settings.enter_buttonless_dfu == 1) - { - s_dfu_settings.enter_buttonless_dfu = 0; - APP_ERROR_CHECK(nrf_dfu_settings_write(NULL)); - return true; - } - return false; -} - - -// Internal Functions - -/**@brief Function for initializing the timer handler module (app_timer). - */ -static void timers_init(void) -{ - // Initialize timer module, making it use the scheduler. - APP_TIMER_APPSH_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, true); -} - - -/** @brief Function for event scheduler initialization. - */ -static void scheduler_init(void) -{ - APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE); -} - - -static void wait_for_event() -{ - // Transport is waiting for event? - while(true) - { - // Can't be emptied like this because of lack of static variables - (void)sd_app_evt_wait(); - app_sched_execute(); - } -} - - -void nrf_dfu_wait() -{ - app_sched_execute(); - (void)sd_app_evt_wait(); -} - - -uint32_t nrf_dfu_init() -{ - uint32_t ret_val = NRF_SUCCESS; - uint32_t enter_bootloader_mode = 0; - - NRF_LOG_INFO("In real nrf_dfu_init\r\n"); - - nrf_dfu_settings_init(); - - // Continue ongoing DFU operations - // Note that this part does not rely on SoftDevice interaction - ret_val = nrf_dfu_continue(&enter_bootloader_mode); - if(ret_val != NRF_SUCCESS) - { - NRF_LOG_INFO("Could not continue DFU operation: 0x%08x\r\n", ret_val); - enter_bootloader_mode = 1; - } - - // Check if there is a reason to enter DFU mode - // besides the effect of the continuation - if (nrf_dfu_enter_check()) - { - NRF_LOG_INFO("Application sent bootloader request\n"); - enter_bootloader_mode = 1; - } - - if(enter_bootloader_mode != 0 || !nrf_dfu_app_is_valid()) - { - timers_init(); - scheduler_init(); - - // Initializing transports - ret_val = nrf_dfu_transports_init(); - if (ret_val != NRF_SUCCESS) - { - NRF_LOG_ERROR("Could not initalize DFU transport: 0x%08x\r\n", ret_val); - return ret_val; - } - - (void)nrf_dfu_req_handler_init(); - - // This function will never return - NRF_LOG_INFO("Waiting for events\r\n"); - wait_for_event(); - NRF_LOG_INFO("After waiting for events\r\n"); - } - - if (nrf_dfu_app_is_valid()) - { - NRF_LOG_INFO("Jumping to: 0x%08x\r\n", MAIN_APPLICATION_START_ADDR); - nrf_bootloader_app_start(MAIN_APPLICATION_START_ADDR); - } - - // Should not be reached! - NRF_LOG_INFO("After real nrf_dfu_init\r\n"); - return NRF_SUCCESS; -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.h deleted file mode 100644 index eb3bc9134b..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/**@file - * - * @defgroup sdk_nrf_dfu DFU bootloader - * @{ - * @ingroup sdk_nrf_bootloader - * @brief Bootloader with Device Firmware Update (DFU) functionality. - * - * The DFU bootloader module, in combination with the @ref sdk_bootloader module, - * can be used to implement a bootloader that supports Device Firmware Updates. - */ - - -#ifndef NRF_DFU_H__ -#define NRF_DFU_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define BOOTLOADER_BUTTON (BSP_BUTTON_3) /**< Button for entering DFU mode. */ - -/** @brief Function for initializing a DFU operation. - * - * This function initializes a DFU operation and any transports that are registered - * in the system. - * - * @retval NRF_SUCCESS If the DFU operation was successfully initialized. - */ -uint32_t nrf_dfu_init(void); - - -/** @brief Function for checking if DFU mode should be entered. - * - * This function checks whether DFU mode is required. - * - * @retval true If DFU mode must be entered. - * @retval false If there is no need to enter DFU mode. - */ -bool nrf_dfu_enter_check(void); - - -/** @brief Function for checking if DFU should be reset (failsafe). - * - * This function will check if DFU should be reset (failsafe). - * - * If this returns true, DFU mode will be entered and DFU will be reset. - * - * @retval true If DFU must be reset (failsafe). - * @retval false If there is no need to reset DFU. - */ -bool nrf_dfu_check_failsafe_reset(void); - - -/** @brief Function for blocking until an event (i.e. incoming BLE packet) arrives. - */ -void nrf_dfu_wait(void); - -#ifdef __cplusplus -} -#endif - -#endif // NRF_DFU_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.c deleted file mode 100644 index 6871b8ac6c..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "nrf_dfu_mbr.h" -#include "nrf_mbr.h" -#include "nrf_dfu_types.h" -#include "nrf_log.h" - -uint32_t nrf_dfu_mbr_copy_bl(uint32_t * p_src, uint32_t len) -{ - uint32_t ret_val; - uint32_t const len_words = len / sizeof(uint32_t); - - sd_mbr_command_t command = - { - .command = SD_MBR_COMMAND_COPY_BL, - .params.copy_bl.bl_src = p_src, - .params.copy_bl.bl_len = len_words - }; - - ret_val = sd_mbr_command(&command); - - return ret_val; -} - - -uint32_t nrf_dfu_mbr_copy_sd(uint32_t * p_dst, uint32_t * p_src, uint32_t len) -{ - uint32_t ret_val; - uint32_t const len_words = len / sizeof(uint32_t); - - if((len_words & (CODE_PAGE_SIZE / sizeof(uint32_t) - 1)) != 0) - return NRF_ERROR_INVALID_LENGTH; - - sd_mbr_command_t command = - { - .command = SD_MBR_COMMAND_COPY_SD, - .params.copy_sd.src = p_src, - .params.copy_sd.dst = p_dst, - .params.copy_sd.len = len_words - }; - - ret_val = sd_mbr_command(&command); - - return ret_val; -} - - -uint32_t nrf_dfu_mbr_init_sd(void) -{ - uint32_t ret_val; - - sd_mbr_command_t command = - { - .command = SD_MBR_COMMAND_INIT_SD - }; - - ret_val = sd_mbr_command(&command); - - return ret_val; -} - - -uint32_t nrf_dfu_mbr_compare(uint32_t * p_ptr1, uint32_t * p_ptr2, uint32_t len) -{ - uint32_t ret_val; - uint32_t const len_words = len / sizeof(uint32_t); - - sd_mbr_command_t command = - { - .command = SD_MBR_COMMAND_COMPARE, - .params.compare.ptr1 = p_ptr1, - .params.compare.ptr2 = p_ptr2, - .params.compare.len = len_words - }; - - ret_val = sd_mbr_command(&command); - - return ret_val; -} - - -uint32_t nrf_dfu_mbr_vector_table_set(uint32_t address) -{ - uint32_t ret_val; - - NRF_LOG_INFO("running vector table set\r\n"); - sd_mbr_command_t command = - { - .command = SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, - .params.base_set.address = address - }; - - ret_val = sd_mbr_command(&command); - NRF_LOG_INFO("After running vector table set\r\n"); - - return ret_val; -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.h deleted file mode 100644 index 0d99e14e7d..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_mbr.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/**@file - * - * @defgroup sdk_nrf_dfu_mbr MBR functions - * @{ - * @ingroup sdk_nrf_dfu - */ - -#ifndef NRF_DFU_MBR_H__ -#define NRF_DFU_MBR_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @brief Function for copying the bootloader using an MBR command. - * - * @param[in] p_src Source address of the bootloader data to copy. - * @param[in] len Length of the data to copy in bytes. - * - * @return This function will return only if the command request could not be run. - * See @ref sd_mbr_command_copy_bl_t for possible return values. - */ -uint32_t nrf_dfu_mbr_copy_bl(uint32_t * p_src, uint32_t len); - - -/** @brief Function for copying the SoftDevice using an MBR command. - * - * @param[in] p_dst Target of the SoftDevice copy. - * @param[in] p_src Source address of the SoftDevice image to copy. - * @param[in] len Length of the data to copy in bytes. - * - * @retval NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly. - * @retval NRF_ERROR_INVALID_LENGTH Invalid len - * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). - * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. - * @retval NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. - */ -uint32_t nrf_dfu_mbr_copy_sd(uint32_t * p_dst, uint32_t * p_src, uint32_t len); - - -/** @brief Function for initializing the SoftDevice using an MBR command. - * - * @retval NRF_SUCCESS If the SoftDevice was copied successfully. - * Any other return value indicates that the SoftDevice - * could not be copied. - */ -uint32_t nrf_dfu_mbr_init_sd(void); - - -/** @brief Function for comparing source and target using an MBR command. - * - * @param[in] p_ptr1 First pointer to data to compare. - * @param[in] p_ptr2 Second pointer to data to compare. - * @param[in] len Length of the data to compare in bytes. - * - * @retval NRF_SUCCESS If the content of both memory blocks is equal. - * @retval NRF_ERROR_NULL If the content of the memory blocks differs. - */ -uint32_t nrf_dfu_mbr_compare(uint32_t * p_ptr1, uint32_t * p_ptr2, uint32_t len); - - -/** @brief Function for setting the address of the vector table using an MBR command. - * - * @param[in] address Address of the new vector table. - * - * @retval NRF_SUCCESS If the address of the new vector table was set. Any other - * return value indicates that the address could not be set. - */ -uint32_t nrf_dfu_mbr_vector_table_set(uint32_t address); - - -#ifdef __cplusplus -} -#endif - -#endif // NRF_DFU_MBR_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.c deleted file mode 100644 index f5661ebdfb..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "nrf_dfu_settings.h" -#include "nrf_dfu_flash.h" -#include "nrf_log.h" -#include "crc32.h" -#include -#include "app_scheduler.h" -#include "nrf_delay.h" - -/** @brief This variable reserves a codepage for bootloader specific settings, - * to ensure the compiler doesn't locate any code or variables at his location. - */ -#if defined (__CC_ARM ) - - uint8_t m_dfu_settings_buffer[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) - __attribute__((used)); - -#elif defined ( __GNUC__ ) - - uint8_t m_dfu_settings_buffer[CODE_PAGE_SIZE] __attribute__ ((section(".bootloaderSettings"))) - __attribute__((used)); - -#elif defined ( __ICCARM__ ) - - __no_init __root uint8_t m_dfu_settings_buffer[CODE_PAGE_SIZE] @ BOOTLOADER_SETTINGS_ADDRESS; - -#else - - #error Not a valid compiler/linker for m_dfu_settings placement. - -#endif // Compiler specific - -#ifndef BL_SETTINGS_ACCESS_ONLY -#if defined( NRF52_SERIES ) - -/**@brief This variable reserves a codepage for mbr parameters, to ensure the compiler doesn't - * locate any code or variables at his location. - */ -#if defined ( __CC_ARM ) - - uint8_t m_mbr_params_page[CODE_PAGE_SIZE] __attribute__((at(NRF_MBR_PARAMS_PAGE_ADDRESS))) __attribute__((used)); - -#elif defined ( __GNUC__ ) - - uint8_t m_mbr_params_page[CODE_PAGE_SIZE] __attribute__ ((section(".mbrParamsPage"))); - -#elif defined ( __ICCARM__ ) - - __no_init uint8_t m_mbr_params_page[CODE_PAGE_SIZE] @ NRF_MBR_PARAMS_PAGE_ADDRESS; - -#else - - #error Not a valid compiler/linker for m_mbr_params_page placement. - -#endif // Compiler specific - - -/**@brief This variable makes the linker script write the mbr parameters page address to the - * UICR register. This value will be written in the HEX file and thus written to the - * UICR when the bootloader is flashed into the chip. - */ -#if defined ( __CC_ARM ) - uint32_t m_uicr_mbr_params_page_address __attribute__((at(NRF_UICR_MBR_PARAMS_PAGE_ADDRESS))) - = NRF_MBR_PARAMS_PAGE_ADDRESS; - -#elif defined ( __GNUC__ ) - volatile uint32_t m_uicr_mbr_params_page_address __attribute__ ((section(".uicrMbrParamsPageAddress"))) - = NRF_MBR_PARAMS_PAGE_ADDRESS; -#elif defined ( __ICCARM__ ) - - __root const uint32_t m_uicr_mbr_params_page_address @ NRF_UICR_MBR_PARAMS_PAGE_ADDRESS - = NRF_MBR_PARAMS_PAGE_ADDRESS; - -#else - - #error Not a valid compiler/linker for m_mbr_params_page placement. - -#endif // Compiler specific - -#endif // #if defined( NRF52_SERIES ) - -#endif // #ifndef BL_SETTINGS_ACCESS_ONLY - -nrf_dfu_settings_t s_dfu_settings; - -//lint -save -esym(551, flash_operation_pending) -static bool flash_operation_pending; // barrier for reading flash -//lint -restore - -static dfu_flash_callback_t m_callback; - - -static void dfu_settings_write_callback(fs_evt_t const * const evt, fs_ret_t result) -{ - if (result == FS_SUCCESS) - { - flash_operation_pending = false; - } - if (m_callback != NULL) - { - m_callback(evt, result); - } -} - -static void delay_operation(void) -{ - nrf_delay_ms(100); - app_sched_execute(); -} - -static void wait_for_pending(void) -{ - while (flash_operation_pending == true) - { - NRF_LOG_INFO("Waiting for other flash operation to finish.\r\n"); - delay_operation(); - } -} - -static void wait_for_queue(void) -{ - while (fs_queue_is_full()) - { - NRF_LOG_INFO("Waiting for available space on flash queue.\r\n"); - delay_operation(); - } -} - - -uint32_t nrf_dfu_settings_calculate_crc(void) -{ - // the crc is calculated from the s_dfu_settings struct, except the crc itself and the init command - return crc32_compute((uint8_t*)&s_dfu_settings + 4, sizeof(nrf_dfu_settings_t) - 4 - sizeof(s_dfu_settings.init_command), NULL); -} - - -void nrf_dfu_settings_init(void) -{ - NRF_LOG_INFO("running nrf_dfu_settings_init\r\n"); - - uint32_t crc; - - flash_operation_pending = false; - - // Copy the DFU settings out of flash and into a buffer in RAM. - memcpy((void*)&s_dfu_settings, &m_dfu_settings_buffer[0], sizeof(nrf_dfu_settings_t)); - - if(s_dfu_settings.crc != 0xFFFFFFFF) - { - // CRC is set. Content must be valid - crc = nrf_dfu_settings_calculate_crc(); - if(crc == s_dfu_settings.crc) - { - return; - } - } - - // Reached if nothing is configured or if CRC was wrong - NRF_LOG_INFO("!!!!!!!!!!!!!!! Resetting bootloader settings !!!!!!!!!!!\r\n"); - memset(&s_dfu_settings, 0x00, sizeof(nrf_dfu_settings_t)); - s_dfu_settings.settings_version = NRF_DFU_SETTINGS_VERSION; - APP_ERROR_CHECK(nrf_dfu_settings_write(NULL)); -} - - -ret_code_t nrf_dfu_settings_write(dfu_flash_callback_t callback) -{ - ret_code_t err_code = FS_SUCCESS; - NRF_LOG_INFO("Erasing old settings at: 0x%08x\r\n", (uint32_t)&m_dfu_settings_buffer[0]); - - // Wait for any ongoing operation (because of multiple calls to nrf_dfu_settings_write) - wait_for_pending(); - - flash_operation_pending = true; - m_callback = callback; - - do - { - wait_for_queue(); - - // Not setting the callback function because ERASE is required before STORE - // Only report completion on successful STORE. - err_code = nrf_dfu_flash_erase((uint32_t*)&m_dfu_settings_buffer[0], 1, NULL); - - } while (err_code == FS_ERR_QUEUE_FULL); - - - if (err_code != FS_SUCCESS) - { - NRF_LOG_ERROR("Erasing from flash memory failed.\r\n"); - flash_operation_pending = false; - return NRF_ERROR_INTERNAL; - } - - s_dfu_settings.crc = nrf_dfu_settings_calculate_crc(); - - NRF_LOG_INFO("Writing 0x%08x words\r\n", sizeof(nrf_dfu_settings_t)/4); - - static nrf_dfu_settings_t temp_dfu_settings; - memcpy(&temp_dfu_settings, &s_dfu_settings, sizeof(nrf_dfu_settings_t)); - - do - { - wait_for_queue(); - - err_code = nrf_dfu_flash_store((uint32_t*)&m_dfu_settings_buffer[0], - (uint32_t*)&temp_dfu_settings, - sizeof(nrf_dfu_settings_t)/4, - dfu_settings_write_callback); - - } while (err_code == FS_ERR_QUEUE_FULL); - - if (err_code != FS_SUCCESS) - { - NRF_LOG_ERROR("Storing to flash memory failed.\r\n"); - flash_operation_pending = false; - return NRF_ERROR_INTERNAL; - } - - NRF_LOG_INFO("Writing settings...\r\n"); - return NRF_SUCCESS; -} - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.h deleted file mode 100644 index da9f1fb1f3..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_settings.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - /**@file - * - * @defgroup nrf_dfu_settings DFU settings - * @{ - * @ingroup sdk_nrf_dfu - */ - -#ifndef NRF_DFU_SETTINGS_H__ -#define NRF_DFU_SETTINGS_H__ - -#include -#include "app_util_platform.h" -#include "nrf_dfu_types.h" -#include "nrf_dfu_flash.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**@brief Global DFU settings. - * - * @note Using this variable is not thread-safe. - * - */ -extern nrf_dfu_settings_t s_dfu_settings; - - -/** @brief Function for writing DFU settings to flash. - * - * @param[in] callback Pointer to a function that is called after completing the write operation. - * - * @retval NRF_SUCCESS If the write process was successfully initiated. - * @retval NRF_ERROR_INTERNAL If a flash error occurred. - */ -ret_code_t nrf_dfu_settings_write(dfu_flash_callback_t callback); - - -/** @brief Function for initializing the DFU settings module. - */ -void nrf_dfu_settings_init(void); - - -#ifdef __cplusplus -} -#endif - -#endif // NRF_DFU_SETTINGS_H__ - -/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.c deleted file mode 100644 index 8892391567..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.c +++ /dev/null @@ -1,572 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "nrf_dfu_utils.h" - -#include -#include "nrf_dfu_settings.h" -#include "nrf_dfu_mbr.h" -#include "nrf_bootloader_app_start.h" -#include "nrf_bootloader_info.h" -#include "crc32.h" -#include "nrf_log.h" - - -static uint32_t align_to_page(uint32_t val, uint32_t page_size) -{ - return ((val + page_size - 1 ) &~ (page_size - 1)); -} - - -static void nrf_dfu_invalidate_bank(nrf_dfu_bank_t * p_bank) -{ - // Set the bank-code to invalid, and reset size/CRC - memset(p_bank, 0, sizeof(nrf_dfu_bank_t)); - - // Reset write pointer after completed operation - s_dfu_settings.write_offset = 0; - - // Reset SD size - s_dfu_settings.sd_size = 0; - - // Promote dual bank layout - s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_DUAL; - - // Signify that bank 0 is empty - s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_0; -} - - -/** @brief Function to continue App update - * - * @details This function will be called after reset if there is a valid application in Bank1 - * required to be copied down to bank0. - * - * @param[in] src_addr Source address of the application to copy from Bank1 to Bank0. - * - * @retval NRF_SUCCESS Continuation was successful. - * @retval NRF_ERROR_NULL Invalid data during compare. - * @retval FS_ERR_UNALIGNED_ADDR A call to fstorage was not aligned to a page boundary or the address was not word aliged. - * @retval FS_ERR_INVALID_ADDR The destination of a call to fstorage does not point to - * the start of a flash page or the operation would - * go beyond the flash memory boundary. - * @retval FS_ERR_NOT_INITIALIZED The fstorage module is not initialized. - * @retval FS_ERR_INVALID_CFG The initialization of the fstorage module is invalid. - * @retval FS_ERR_NULL_ARG A call to fstorage had an invalid NULL argument. - * @retval FS_ERR_INVALID_ARG A call to fstorage had invalid arguments. - * @retval FS_ERR_QUEUE_FULL If the internal operation queue of the fstorage module is full. - * @retval FS_ERR_FAILURE_SINCE_LAST If an error occurred in another transaction and fstorage cannot continue before - * the event has been dealt with. - */ -static uint32_t nrf_dfu_app_continue(uint32_t src_addr) -{ - // This function only in use when new app is present in bank 1 - uint32_t const image_size = s_dfu_settings.bank_1.image_size; - uint32_t const split_size = CODE_PAGE_SIZE; // Arbitrary number that must be page aligned - - uint32_t ret_val = NRF_SUCCESS; - uint32_t target_addr = MAIN_APPLICATION_START_ADDR + s_dfu_settings.write_offset; - uint32_t length_left = (image_size - s_dfu_settings.write_offset); - uint32_t cur_len; - uint32_t crc; - - NRF_LOG_INFO("Enter nrf_dfu_app_continue\r\n"); - - // Copy the application down safely - do - { - cur_len = (length_left > split_size) ? split_size : length_left; - - // Erase the target page - ret_val = nrf_dfu_flash_erase((uint32_t*) target_addr, split_size / CODE_PAGE_SIZE, NULL); - if (ret_val != NRF_SUCCESS) - { - return ret_val; - } - - // Flash one page - ret_val = nrf_dfu_flash_store((uint32_t*)target_addr, (uint32_t*)src_addr, cur_len, NULL); - if (ret_val != NRF_SUCCESS) - { - return ret_val; - } - - ret_val = nrf_dfu_mbr_compare((uint32_t*)target_addr, (uint32_t*)src_addr, cur_len); - if (ret_val != NRF_SUCCESS) - { - // We will not retry the copy - NRF_LOG_ERROR("Invalid data during compare: target: 0x%08x, src: 0x%08x\r\n", target_addr, src_addr); - return ret_val; - } - - // Erase the head (to handle growing bank 0) - ret_val = nrf_dfu_flash_erase((uint32_t*) src_addr, split_size / CODE_PAGE_SIZE, NULL); - if (ret_val != NRF_SUCCESS) - { - NRF_LOG_ERROR("App update: Failure erasing page at addr: 0x%08x\r\n", src_addr); - return ret_val; - } - - s_dfu_settings.write_offset += cur_len; - ret_val = nrf_dfu_settings_write(NULL); - - target_addr += cur_len; - src_addr += cur_len; - - length_left -= cur_len; - } - while(length_left > 0); - - // Check the crc of the copied data. Enable if so. - crc = crc32_compute((uint8_t*)MAIN_APPLICATION_START_ADDR, image_size, NULL); - - if (crc == s_dfu_settings.bank_1.image_crc) - { - NRF_LOG_INFO("Setting app as valid\r\n"); - s_dfu_settings.bank_0.bank_code = NRF_DFU_BANK_VALID_APP; - s_dfu_settings.bank_0.image_crc = crc; - s_dfu_settings.bank_0.image_size = image_size; - } - else - { - NRF_LOG_ERROR("CRC computation failed for copied app: src crc: 0x%08x, res crc: 0x08x\r\n", s_dfu_settings.bank_1.image_crc, crc); - } - - nrf_dfu_invalidate_bank(&s_dfu_settings.bank_1); - ret_val = nrf_dfu_settings_write(NULL); - - return ret_val; -} - -/** @brief Function to execute the continuation of a SoftDevice update. - * - * @param[in] src_addr Source address of the SoftDevice to copy from. - * @param[in] p_bank Pointer to the bank where the SoftDevice resides. - * - * @retval NRF_SUCCESS Continuation was successful. - * @retval NRF_ERROR_INVALID_LENGTH Invalid len - * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). - * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. - * @retval NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. - * @retval NRF_ERROR_NULL If the content of the memory blocks differs after copying. - */ -static uint32_t nrf_dfu_sd_continue_impl(uint32_t src_addr, - nrf_dfu_bank_t * p_bank) -{ - uint32_t ret_val = NRF_SUCCESS; - uint32_t target_addr = SOFTDEVICE_REGION_START + s_dfu_settings.write_offset; - uint32_t length_left = align_to_page(s_dfu_settings.sd_size - s_dfu_settings.write_offset, CODE_PAGE_SIZE); - uint32_t split_size = align_to_page(length_left / 4, CODE_PAGE_SIZE); - - NRF_LOG_INFO("Enter nrf_bootloader_dfu_sd_continue\r\n"); - - // This can be a continuation due to a power failure - src_addr += s_dfu_settings.write_offset; - - if (s_dfu_settings.sd_size != 0 && s_dfu_settings.write_offset == s_dfu_settings.sd_size) - { - NRF_LOG_INFO("SD already copied\r\n"); - return NRF_SUCCESS; - } - - NRF_LOG_INFO("Updating SD. Old SD ver: 0x%04x\r\n", SD_FWID_GET(MBR_SIZE)); - - do - { - NRF_LOG_INFO("Copying [0x%08x-0x%08x] to [0x%08x-0x%08x]: Len: 0x%08x\r\n", src_addr, src_addr + split_size, target_addr, target_addr + split_size, split_size); - - // Copy a chunk of the SD. Size in words - ret_val = nrf_dfu_mbr_copy_sd((uint32_t*)target_addr, (uint32_t*)src_addr, split_size); - if (ret_val != NRF_SUCCESS) - { - NRF_LOG_ERROR("Failed to copy SD: target: 0x%08x, src: 0x%08x, len: 0x%08x\r\n", target_addr, src_addr, split_size); - return ret_val; - } - - NRF_LOG_INFO("Finished copying [0x%08x-0x%08x] to [0x%08x-0x%08x]: Len: 0x%08x\r\n", src_addr, src_addr + split_size, target_addr, target_addr + split_size, split_size); - - // Validate copy. Size in words - ret_val = nrf_dfu_mbr_compare((uint32_t*)target_addr, (uint32_t*)src_addr, split_size); - if (ret_val != NRF_SUCCESS) - { - NRF_LOG_ERROR("Failed to Compare SD: target: 0x%08x, src: 0x%08x, len: 0x%08x\r\n", target_addr, src_addr, split_size); - return ret_val; - } - - NRF_LOG_INFO("Validated 0x%08x-0x%08x to 0x%08x-0x%08x: Size: 0x%08x\r\n", src_addr, src_addr + split_size, target_addr, target_addr + split_size, split_size); - - target_addr += split_size; - src_addr += split_size; - - if (split_size > length_left) - { - length_left = 0; - } - else - { - length_left -= split_size; - } - - NRF_LOG_INFO("Finished with the SD update.\r\n"); - - // Save the updated point of writes in case of power loss - s_dfu_settings.write_offset = s_dfu_settings.sd_size - length_left; - ret_val = nrf_dfu_settings_write(NULL); - } - while (length_left > 0); - - return ret_val; -} - - -/** @brief Function to continue SoftDevice update - * - * @details This function will be called after reset if there is a valid SoftDevice in Bank0 or Bank1 - * required to be relocated and activated through MBR commands. - * - * @param[in] src_addr Source address of the SoftDevice to copy from. - * @param[in] p_bank Pointer to the bank where the SoftDevice resides. - * - * @retval NRF_SUCCESS Continuation was successful. - * @retval NRF_ERROR_INVALID_LENGTH Invalid len - * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). - * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. - * @retval NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. - * @retval NRF_ERROR_NULL If the content of the memory blocks differs after copying. - */ -static uint32_t nrf_dfu_sd_continue(uint32_t src_addr, - nrf_dfu_bank_t * p_bank) -{ - uint32_t ret_val; - - ret_val = nrf_dfu_sd_continue_impl(src_addr, p_bank); - if (ret_val != NRF_SUCCESS) - { - NRF_LOG_ERROR("SD update continuation failed\r\n"); - return ret_val; - } - - nrf_dfu_invalidate_bank(p_bank); - ret_val = nrf_dfu_settings_write(NULL); - - return ret_val; -} - - -/** @brief Function to continue Bootloader update - * - * @details This function will be called after reset if there is a valid Bootloader in Bank0 or Bank1 - * required to be relocated and activated through MBR commands. - * - * @param[in] src_addr Source address of the BL to copy from. - * @param[in] p_bank Pointer to the bank where the SoftDevice resides. - * - * @return This fucntion will not return if the bootloader is copied succesfully. - * After the copy is verified the device will reset and start the new bootloader. - * - * @retval NRF_SUCCESS Continuation was successful. - * @retval NRF_ERROR_INVALID_LENGTH Invalid length of flash operation. - * @retval NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info). - * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. - * @retval NRF_ERROR_INTERNAL internal error that should not happen. - * @retval NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. - */ -static uint32_t nrf_dfu_bl_continue(uint32_t src_addr, nrf_dfu_bank_t * p_bank) -{ - uint32_t ret_val = NRF_SUCCESS; - uint32_t const len = (p_bank->image_size - s_dfu_settings.sd_size); - - // if the update is a combination of BL + SD, offset with SD size to get BL start address - src_addr += s_dfu_settings.sd_size; - - NRF_LOG_INFO("Verifying BL: Addr: 0x%08x, Src: 0x%08x, Len: 0x%08x\r\n", MAIN_APPLICATION_START_ADDR, src_addr, len); - - - // If the bootloader is the same as the banked version, the copy is finished - ret_val = nrf_dfu_mbr_compare((uint32_t*)BOOTLOADER_START_ADDR, (uint32_t*)src_addr, len); - if (ret_val == NRF_SUCCESS) - { - NRF_LOG_INFO("Bootloader was verified\r\n"); - - // Invalidate bank, marking completion - nrf_dfu_invalidate_bank(p_bank); - ret_val = nrf_dfu_settings_write(NULL); - } - else - { - NRF_LOG_INFO("Bootloader not verified, copying: Src: 0x%08x, Len: 0x%08x\r\n", src_addr, len); - // Bootloader is different than the banked version. Continue copy - // Note that if the SD and BL was combined, then the split point between them is in s_dfu_settings.sd_size - ret_val = nrf_dfu_mbr_copy_bl((uint32_t*)src_addr, len); - if(ret_val != NRF_SUCCESS) - { - NRF_LOG_ERROR("Request to copy BL failed\r\n"); - } - } - - return ret_val; -} - - -/** @brief Function to continue combined Bootloader and SoftDevice update - * - * @details This function will be called after reset if there is a valid Bootloader and SoftDevice in Bank0 or Bank1 - * required to be relocated and activated through MBR commands. - * - * @param[in] src_addr Source address of the combined Bootloader and SoftDevice to copy from. - * @param[in] p_bank Pointer to the bank where the SoftDevice resides. - * - * @retval NRF_SUCCESS Continuation was successful. - * @retval NRF_ERROR_INVALID_LENGTH Invalid len - * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). - * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. - * @retval NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. - * @retval NRF_ERROR_NULL If the content of the memory blocks differs after copying. - * @retval NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. - */ -static uint32_t nrf_dfu_sd_bl_continue(uint32_t src_addr, nrf_dfu_bank_t * p_bank) -{ - uint32_t ret_val = NRF_SUCCESS; - - NRF_LOG_INFO("Enter nrf_dfu_sd_bl_continue\r\n"); - - ret_val = nrf_dfu_sd_continue_impl(src_addr, p_bank); - if (ret_val != NRF_SUCCESS) - { - NRF_LOG_ERROR("SD+BL: SD copy failed\r\n"); - return ret_val; - } - - ret_val = nrf_dfu_bl_continue(src_addr, p_bank); - if (ret_val != NRF_SUCCESS) - { - NRF_LOG_ERROR("SD+BL: BL copy failed\r\n"); - return ret_val; - } - - return ret_val; -} - - -static uint32_t nrf_dfu_continue_bank(nrf_dfu_bank_t * p_bank, uint32_t src_addr, uint32_t * p_enter_dfu_mode) -{ - uint32_t ret_val = NRF_SUCCESS; - - switch (p_bank->bank_code) - { - case NRF_DFU_BANK_VALID_APP: - NRF_LOG_INFO("Valid App\r\n"); - if(s_dfu_settings.bank_current == NRF_DFU_CURRENT_BANK_1) - { - // Only continue copying if valid app in bank1 - ret_val = nrf_dfu_app_continue(src_addr); - } - break; - - case NRF_DFU_BANK_VALID_SD: - NRF_LOG_INFO("Valid SD\r\n"); - // There is a valid SD that needs to be copied (or continued) - ret_val = nrf_dfu_sd_continue(src_addr, p_bank); - (*p_enter_dfu_mode) = 1; - break; - - case NRF_DFU_BANK_VALID_BL: - NRF_LOG_INFO("Valid BL\r\n"); - // There is a valid BL that must be copied (or continued) - ret_val = nrf_dfu_bl_continue(src_addr, p_bank); - break; - - case NRF_DFU_BANK_VALID_SD_BL: - NRF_LOG_INFO("Single: Valid SD + BL\r\n"); - // There is a valid SD + BL that must be copied (or continued) - ret_val = nrf_dfu_sd_bl_continue(src_addr, p_bank); - // Set the bank-code to invalid, and reset size/CRC - (*p_enter_dfu_mode) = 1; - break; - - case NRF_DFU_BANK_INVALID: - default: - NRF_LOG_ERROR("Single: Invalid bank\r\n"); - break; - } - - return ret_val; -} - - -uint32_t nrf_dfu_continue(uint32_t * p_enter_dfu_mode) -{ - uint32_t ret_val; - nrf_dfu_bank_t * p_bank; - uint32_t src_addr = CODE_REGION_1_START; - - NRF_LOG_INFO("Enter nrf_dfu_continue\r\n"); - - if (s_dfu_settings.bank_layout == NRF_DFU_BANK_LAYOUT_SINGLE ) - { - p_bank = &s_dfu_settings.bank_0; - } - else if(s_dfu_settings.bank_current == NRF_DFU_CURRENT_BANK_0) - { - p_bank = &s_dfu_settings.bank_0; - } - else - { - p_bank = &s_dfu_settings.bank_1; - src_addr += align_to_page(s_dfu_settings.bank_0.image_size, CODE_PAGE_SIZE); - } - - ret_val = nrf_dfu_continue_bank(p_bank, src_addr, p_enter_dfu_mode); - return ret_val; -} - - -bool nrf_dfu_app_is_valid(void) -{ - NRF_LOG_INFO("Enter nrf_dfu_app_is_valid\r\n"); - if (s_dfu_settings.bank_0.bank_code != NRF_DFU_BANK_VALID_APP) - { - // Bank 0 has no valid app. Nothing to boot - NRF_LOG_INFO("Return false in valid app check\r\n"); - return false; - } - - // If CRC == 0, this means CRC check is skipped. - if (s_dfu_settings.bank_0.image_crc != 0) - { - uint32_t crc = crc32_compute((uint8_t*) CODE_REGION_1_START, - s_dfu_settings.bank_0.image_size, - NULL); - - if (crc != s_dfu_settings.bank_0.image_crc) - { - // CRC does not match with what is stored. - NRF_LOG_INFO("Return false in CRC\r\n"); - return false; - } - } - - NRF_LOG_INFO("Return true. App was valid\r\n"); - return true; -} - - -uint32_t nrf_dfu_find_cache(uint32_t size_req, bool dual_bank_only, uint32_t * p_address) -{ - // TODO: Prevalidate p_address and p_bank - - uint32_t free_size = DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED; - nrf_dfu_bank_t * p_bank; - - NRF_LOG_INFO("Enter nrf_dfu_find_cache\r\n"); - - // Simple check if size requirement can me met - if(free_size < size_req) - { - NRF_LOG_INFO("No way to fit the new firmware on device\r\n"); - return NRF_ERROR_NO_MEM; - } - - NRF_LOG_INFO("Bank content\r\n"); - NRF_LOG_INFO("Bank type: %d\r\n", s_dfu_settings.bank_layout); - NRF_LOG_INFO("Bank 0 code: 0x%02x: Size: %d\r\n", s_dfu_settings.bank_0.bank_code, s_dfu_settings.bank_0.image_size); - NRF_LOG_INFO("Bank 1 code: 0x%02x: Size: %d\r\n", s_dfu_settings.bank_1.bank_code, s_dfu_settings.bank_1.image_size); - - // Setting bank_0 as candidate - p_bank = &s_dfu_settings.bank_0; - - // Setting candidate address - (*p_address) = MAIN_APPLICATION_START_ADDR; - - // Calculate free size - if (s_dfu_settings.bank_0.bank_code == NRF_DFU_BANK_VALID_APP) - { - // Valid app present. - - NRF_LOG_INFO("free_size before bank select: %d\r\n", free_size); - - free_size -= align_to_page(p_bank->image_size, CODE_PAGE_SIZE); - - NRF_LOG_INFO("free_size: %d, size_req: %d\r\n", free_size, size_req); - - // Check if we can fit the new in the free space or if removal of old app is required. - if(size_req > free_size) - { - // Not enough room in free space (bank_1) - if ((dual_bank_only)) - { - NRF_LOG_ERROR("Failure: dual bank restriction\r\n"); - return NRF_ERROR_NO_MEM; - } - - // Can only support single bank update, clearing old app. - s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_SINGLE; - s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_0; - p_bank = &s_dfu_settings.bank_0; - NRF_LOG_INFO("Enforcing single bank\r\n"); - } - else - { - // Room in bank_1 for update - // Ensure we are using dual bank layout - s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_DUAL; - s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_1; - p_bank = &s_dfu_settings.bank_1; - // Set to first free page boundry after previous app - (*p_address) += align_to_page(s_dfu_settings.bank_0.image_size, CODE_PAGE_SIZE); - NRF_LOG_INFO("Using second bank\r\n"); - } - } - else - { - // No valid app present. Promoting dual bank. - s_dfu_settings.bank_layout = NRF_DFU_BANK_LAYOUT_DUAL; - s_dfu_settings.bank_current = NRF_DFU_CURRENT_BANK_0; - - p_bank = &s_dfu_settings.bank_0; - NRF_LOG_INFO("No previous, using bank 0\r\n"); - } - - // Set the bank-code to invalid, and reset size/CRC - memset(p_bank, 0, sizeof(nrf_dfu_bank_t)); - - // Store the Firmware size in the bank for continuations - p_bank->image_size = size_req; - return NRF_SUCCESS; -} - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.h deleted file mode 100644 index a1d49dde77..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/dfu/nrf_dfu_utils.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/**@file - * - * @defgroup sdk_nrf_dfu_utils DFU utilities - * @{ - * @ingroup sdk_nrf_dfu - */ - -#ifndef NRF_DFU_UTILS_H__ -#define NRF_DFU_UTILS_H__ - -#include -#include -#include "nrf_dfu_types.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - - -/** @brief Function for continuing an ongoing DFU operation. - * - * @details This function initiates or continues the DFU copy-back - * routines. These routines are fail-safe operations to activate - * either a new SoftDevice, Bootloader, combination of SoftDevice and - * Bootloader, or a new application. - * - * @details This function relies on accessing MBR commands through supervisor calls. - * It does not rely on the SoftDevice for flash operations. - * - * @note When updating the bootloader or both bootloader and SoftDevice in combination, - * this function does not return, but rather initiate a reboot to activate - * the new bootloader. - * - * @param[in,out] p_enter_dfu_mode True if the continuation failed or the update requires DFU mode. - * - * @retval NRF_SUCCESS If the DFU operation was continued successfully. - * Any other error code indicates that the DFU operation could - * not be continued. - */ -uint32_t nrf_dfu_continue(uint32_t * p_enter_dfu_mode); - - -/** @brief Function for checking if the main application is valid. - * - * @details This function checks if there is a valid application - * located at Bank 0. - * - * @retval true If a valid application has been detected. - * @retval false If there is no valid application. - */ -bool nrf_dfu_app_is_valid(void); - - -/** @brief Function for finding a cache write location for the DFU process. - * - * @details This function checks the size requirements and selects a location for - * placing the cache of the DFU images. - * The function tries to find enough space in Bank 1. If there is not enough space, - * the present application is erased. - * - * @param[in] size_req Requirements for the size of the new image. - * @param[in] dual_bank_only True to enforce dual-bank updates. In this case, if there - * is not enough space for caching the DFU image, the existing - * application is retained and the function returns an error. - * @param[out] p_address Updated to the cache address if a cache location is found. - * - * @retval NRF_SUCCESS If a cache location was found for the DFU process. - * @retval NRF_ERROR_NO_MEM If there is no space available on the device to continue the DFU process. - */ -uint32_t nrf_dfu_find_cache(uint32_t size_req, bool dual_bank_only, uint32_t * p_address); - - -#ifdef __cplusplus -} -#endif - -#endif // NRF_DFU_UTILS_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.c deleted file mode 100644 index 0144d960df..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "nrf_bootloader.h" - -#include "compiler_abstraction.h" -#include "nrf.h" -#include "nrf_bootloader_app_start.h" -#include "nrf_log.h" -#include "nrf_dfu.h" -#include "nrf_error.h" - - -/** @brief Weak implemenation of nrf_dfu_init - * - * @note This function will be overridden if nrf_dfu.c is - * compiled and linked with the project - */ - #if (__LINT__ != 1) -__WEAK uint32_t nrf_dfu_init(void) -{ - NRF_LOG_INFO("in weak nrf_dfu_init\r\n"); - return NRF_SUCCESS; -} -#endif - - -/** @brief Weak implementation of nrf_dfu_init - * - * @note This function must be overridden in application if - * user-specific initialization is needed. - */ -__WEAK uint32_t nrf_dfu_init_user(void) -{ - NRF_LOG_INFO("in weak nrf_dfu_init_user\r\n"); - return NRF_SUCCESS; -} - - -uint32_t nrf_bootloader_init(void) -{ - NRF_LOG_INFO("In nrf_bootloader_init\r\n"); - - uint32_t ret_val = NRF_SUCCESS; - - #if 0 - // Call user-defined init function if implemented - ret_val = nrf_dfu_init_user(); - if (ret_val != NRF_SUCCESS) - { - return ret_val; - } - #endif - - // Call DFU init function if implemented - ret_val = nrf_dfu_init(); - if (ret_val != NRF_SUCCESS) - { - return ret_val; - } - - NRF_LOG_INFO("After nrf_bootloader_init\r\n"); - return ret_val; -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.h deleted file mode 100644 index abfb3f7b7f..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/**@file - * - * @defgroup sdk_nrf_bootloader Bootloader modules - * @ingroup app_common - * @brief Modules for creating a bootloader. - * - * @defgroup sdk_bootloader Bootloader - * @{ - * @ingroup sdk_nrf_bootloader - * @brief Basic bootloader. - * - * The bootloader module can be used to implement a basic bootloader that - * can be extended with, for example, Device Firmware Update (DFU) support - * or custom functionality. - */ - -#ifndef NRF_BOOTLOADER_H__ -#define NRF_BOOTLOADER_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @brief Function for initializing the bootloader. - * - * @details This function is the entry point of all bootloader operations. - * If DFU functionality is compiled in, the DFU process is initialized - * when running this function. - * - * @retval NRF_SUCCESS If the bootloader was successfully initialized. - * Any other return code indicates that the operation failed. - */ -uint32_t nrf_bootloader_init(void); - - -/** @brief Function for customizing the bootloader initialization. - * - * @details This function is called during the initialization of the bootloader. - * It is implemented as weak function that can be overridden in the main file of the application. - * - * @retval NRF_SUCCESS If the user initialization was run successfully. - */ -uint32_t nrf_bootloader_user_init(void); - - -#ifdef __cplusplus -} -#endif - -#endif // NRF_BOOTLOADER_H__ -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.c deleted file mode 100644 index e8b390ce5c..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include "nrf_bootloader_app_start.h" -#include "compiler_abstraction.h" -#include "nrf_log.h" -#include "nrf_dfu_mbr.h" -#include "nrf_sdm.h" - -#if defined ( __CC_ARM ) -__ASM static void nrf_bootloader_app_start_impl(uint32_t start_addr) -{ - LDR R5, [R0] ; Get App initial MSP for bootloader. - MSR MSP, R5 ; Set the main stack pointer to the applications MSP. - LDR R0, [R0, #0x04] ; Load Reset handler into R0. This will be first argument to branch instruction (BX). - - MOVS R4, #0xFF ; Load ones to R4. - SXTB R4, R4 ; Sign extend R4 to obtain 0xFFFFFFFF instead of 0xFF. - MRS R5, IPSR ; Load IPSR to R5 to check for handler or thread mode. - CMP R5, #0x00 ; Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader. - BNE isr_abort ; If not zero we need to exit current ISR and jump to reset handler of bootloader. - - MOV LR, R4 ; Clear the link register and set to ones to ensure no return, R4 = 0xFFFFFFFF. - BX R0 ; Branch to reset handler of bootloader. - -isr_abort - ; R4 contains ones from line above. Will be popped as R12 when exiting ISR (Cleaning up the registers). - MOV R5, R4 ; Fill with ones before jumping to reset handling. We be popped as LR when exiting ISR. Ensures no return to application. - MOV R6, R0 ; Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR. - MOVS r7, #0x21 ; Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21. - REV r7, r7 ; Reverse byte order to put 0x21 as MSB. - PUSH {r4-r7} ; Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR. - - MOVS R4, #0x00 ; Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers). - MOVS R5, #0x00 ; Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers). - MOVS R6, #0x00 ; Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers). - MOVS R7, #0x00 ; Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers). - PUSH {r4-r7} ; Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine. - - MOVS R0, #0xF9 ; Move the execution return command into register, 0xFFFFFFF9. - SXTB R0, R0 ; Sign extend R0 to obtain 0xFFFFFFF9 instead of 0xF9. - BX R0 ; No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application. - ALIGN -} - -#elif defined ( __GNUC__ ) - -static void __attribute__ ((noinline)) nrf_bootloader_app_start_impl(uint32_t start_addr) -{ - __ASM volatile( - "ldr r0, [%0]\t\n" // Get App initial MSP for bootloader. - "msr msp, r0\t\n" // Set the main stack pointer to the applications MSP. - "ldr r0, [%0, #0x04]\t\n" // Load Reset handler into R0. - - "movs r4, #0xFF\t\n" // Move ones to R4. - "sxtb r4, r4\t\n" // Sign extend R4 to obtain 0xFFFFFFFF instead of 0xFF. - - "mrs r5, IPSR\t\n" // Load IPSR to R5 to check for handler or thread mode. - "cmp r5, #0x00\t\n" // Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader. - "bne isr_abort\t\n" // If not zero we need to exit current ISR and jump to reset handler of bootloader. - - "mov lr, r4\t\n" // Clear the link register and set to ones to ensure no return. - "bx r0\t\n" // Branch to reset handler of bootloader. - - "isr_abort: \t\n" - - "mov r5, r4\t\n" // Fill with ones before jumping to reset handling. Will be popped as LR when exiting ISR. Ensures no return to application. - "mov r6, r0\t\n" // Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR. - "movs r7, #0x21\t\n" // Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21. - "rev r7, r7\t\n" // Reverse byte order to put 0x21 as MSB. - "push {r4-r7}\t\n" // Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR. - - "movs r4, #0x00\t\n" // Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers). - "movs r5, #0x00\t\n" // Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers). - "movs r6, #0x00\t\n" // Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers). - "movs r7, #0x00\t\n" // Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers). - "push {r4-r7}\t\n" // Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine. - - "movs r0, #0xF9\t\n" // Move the execution return command into register, 0xFFFFFFF9. - "sxtb r0, r0\t\n" // Sign extend R0 to obtain 0xFFFFFFF9 instead of 0xF9. - "bx r0\t\n" // No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application. - ".align\t\n" - :: "r" (start_addr) // Argument list for the gcc assembly. start_addr is %0. - : "r0", "r4", "r5", "r6", "r7" // List of register maintained manually. - ); -} - -#elif defined ( __ICCARM__ ) - -static inline void nrf_bootloader_app_start_impl(uint32_t start_addr) -{ - __ASM("ldr r5, [%0]\n" // Get App initial MSP for bootloader. - "msr msp, r5\n" // Set the main stack pointer to the applications MSP. - "ldr r0, [%0, #0x04]\n" // Load Reset handler into R0. - - "movs r4, #0x00\n" // Load zero into R4. - "mvns r4, r4\n" // Invert R4 to ensure it contain ones. - - "mrs r5, IPSR\n" // Load IPSR to R5 to check for handler or thread mode - "cmp r5, #0x00\n" // Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader. - "bne.n isr_abort\n" // If not zero we need to exit current ISR and jump to reset handler of bootloader. - - "mov lr, r4\n" // Clear the link register and set to ones to ensure no return. - "bx r0\n" // Branch to reset handler of bootloader. - - "isr_abort: \n" - // R4 contains ones from line above. We be popped as R12 when exiting ISR (Cleaning up the registers). - "mov r5, r4\n" // Fill with ones before jumping to reset handling. Will be popped as LR when exiting ISR. Ensures no return to application. - "mov r6, r0\n" // Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR. - "movs r7, #0x21\n" // Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21. - "rev r7, r7\n" // Reverse byte order to put 0x21 as MSB. - "push {r4-r7}\n" // Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR. - - "movs r4, #0x00\n" // Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers). - "movs r5, #0x00\n" // Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers). - "movs r6, #0x00\n" // Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers). - "movs r7, #0x00\n" // Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers). - "push {r4-r7}\n" // Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine. - - "movs r0, #0x06\n" // Load 0x06 into R6 to prepare for exec return command. - "mvns r0, r0\n" // Invert 0x06 to obtain EXEC_RETURN, 0xFFFFFFF9. - "bx r0\n" // No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application. - :: "r" (start_addr) // Argument list for the IAR assembly. start_addr is %0. - : "r0", "r4", "r5", "r6", "r7"); // List of register maintained manually. -} - -#else - -#error Compiler not supported. - -#endif - - -void nrf_bootloader_app_start(uint32_t start_addr) -{ - NRF_LOG_INFO("Running nrf_bootloader_app_start with address: 0x%08x\r\n", start_addr); - -#ifdef BLE_STACK_SUPPORT_REQD - uint32_t err_code; - - //NRF_LOG_INFO("Initializing SD in mbr\r\n"); - err_code = nrf_dfu_mbr_init_sd(); - if(err_code != NRF_SUCCESS) - { - NRF_LOG_ERROR("Failed running nrf_dfu_mbr_init_sd\r\n"); - return; - } - -#endif - - // Disable interrupts - NRF_LOG_INFO("Disabling interrupts\r\n"); - - NVIC->ICER[0]=0xFFFFFFFF; -#if defined(__NRF_NVIC_ISER_COUNT) && __NRF_NVIC_ISER_COUNT == 2 - NVIC->ICER[1]=0xFFFFFFFF; -#endif - -#ifdef BLE_STACK_SUPPORT_REQD - // Set the sd softdevice vector table base address - NRF_LOG_INFO("Setting SD vector table base: 0x%08x\r\n", start_addr); - err_code = sd_softdevice_vector_table_base_set(start_addr); - if(err_code != NRF_SUCCESS) - { - NRF_LOG_ERROR("Failed running sd_softdevice_vector_table_base_set\r\n"); - return; - } -#endif - - // Run application - nrf_bootloader_app_start_impl(start_addr); -} - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.h deleted file mode 100644 index 891d3c828b..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_app_start.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/**@file - * - * @defgroup sdk_bootloader_app Application start - * @{ - * @ingroup sdk_bootloader - */ - -#ifndef NRF_BOOTLOADER_APP_START_H__ -#define NRF_BOOTLOADER_APP_START_H__ - -#include - -/**@brief Function for starting another application (and aborting the current one). - * - * @details This function uses the provided address to swap the stack pointer and then load - * the address of the reset handler to be executed. It checks the current system mode - * (thread/handler). If in thread mode, it resets into the other application. - * If in handler mode, isr_abort is executed to ensure that handler mode is left correctly. - * It then jumps into the reset handler of the other application. - * - * @note This function will never return, but issues a reset into the provided application. - * - * @param[in] start_addr Start address of the other application. This address must point to the - initial stack pointer of the application. - * - */ -void nrf_bootloader_app_start(uint32_t start_addr); - -#endif // NRF_BOOTLOADER_APP_START_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.c deleted file mode 100644 index 628e4e9f4e..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "nrf_bootloader_info.h" - - -/** @brief This variable ensures that the linker script will write the bootloader start address - * to the UICR register. This value will be written in the HEX file and thus written to - * UICR when the bootloader is flashed into the chip. - */ -#if defined (__CC_ARM ) - #pragma push - #pragma diag_suppress 1296 - uint32_t m_uicr_bootloader_start_address __attribute__((at(NRF_UICR_BOOTLOADER_START_ADDRESS))) - = BOOTLOADER_START_ADDR; - #pragma pop -#elif defined ( __GNUC__ ) - volatile uint32_t m_uicr_bootloader_start_address __attribute__ ((section(".uicrBootStartAddress"))) - = BOOTLOADER_START_ADDR; -#elif defined ( __ICCARM__ ) - __root const uint32_t m_uicr_bootloader_start_address @ NRF_UICR_BOOTLOADER_START_ADDRESS - = BOOTLOADER_START_ADDR; -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.h deleted file mode 100644 index dd861fb12e..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/bootloader/nrf_bootloader_info.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/**@file - * - * @defgroup sdk_bootloader_info Information - * @{ - * @ingroup sdk_bootloader - */ - -#ifndef NRF_BOOTLOADER_INFO_H__ -#define NRF_BOOTLOADER_INFO_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "nrf.h" - -#ifdef SOFTDEVICE_PRESENT -#include "nrf_sdm.h" -#endif - -/** @brief External definitions of symbols for the start of the application image. - */ -#if (__LINT__ == 1) - // No implementation -#elif defined ( __CC_ARM ) - extern uint32_t* Image$$ER_IROM1$$Base __attribute__((used)); -#elif defined ( __GNUC__ ) - extern uint32_t * __isr_vector; -#elif defined ( __ICCARM__ ) - extern void * __vector_table; -#else - #error Not a valid compiler/linker for application image symbols. -#endif - - -/** @brief Macro for getting the start address of the application image. - * - * This macro is valid only when absolute placement is used for the application - * image. The macro is not a compile time symbol. It cannot be used as a - * constant expression, for example, inside a static assert or linker script - * at-placement. - */ -#if (__LINT__ == 1) - #define BOOTLOADER_START_ADDR (0x3AC00) -#elif BOOTLOADER_START_ADDR - // Bootloader start address is defined at project level -#elif defined (__CC_ARM) - #define BOOTLOADER_START_ADDR (uint32_t)&Image$$ER_IROM1$$Base -#elif defined (__GNUC__) - #define BOOTLOADER_START_ADDR (uint32_t)&__isr_vector -#elif defined (__ICCARM__) - #define BOOTLOADER_START_ADDR (uint32_t)&__vector_table -#else - #error Not a valid compiler/linker for BOOTLOADER_START_ADDR. -#endif - - -/** - * @brief Bootloader start address in UICR. - * - * Register location in UICR where the bootloader start address is stored. - * - * @note If the value at the given location is 0xFFFFFFFF, the bootloader address is not set. - */ -#define NRF_UICR_BOOTLOADER_START_ADDRESS (NRF_UICR_BASE + 0x14) - - -#ifndef MAIN_APPLICATION_START_ADDR - - -#ifdef SOFTDEVICE_PRESENT - -/** @brief Main application start address (if the project uses a SoftDevice). - * - * @note The start address is equal to the end address of the SoftDevice. - */ -#define MAIN_APPLICATION_START_ADDR (SD_SIZE_GET(MBR_SIZE)) - -#else - -/** @brief Main application start address if the project does not use a SoftDevice. - * - * @note The MBR is required for the @ref sdk_bootloader to function. - */ -#define MAIN_APPLICATION_START_ADDR (MBR_SIZE) - -#endif - -#endif // #ifndef MAIN_APPLICATION_START_ADDR - - -#ifdef __cplusplus -} -#endif - -#endif // #ifndef NRF_BOOTLOADER_INFO_H__ -/** @} */ From 5649eef980d8a94b311024600401e13126e7c7e1 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 4 Jan 2017 11:48:38 +0100 Subject: [PATCH 11/31] Enabled nRF52840_DK's compilation for IAR IDE: - corected scater & startup file for IAR EW - fix warnings caused by port_api.c, ble_radio_notification.c, nrf_drv_spi.c (for IAR it was error), serial_api.c --- .../device/TOOLCHAIN_IAR/nRF52832.icf | 8 ++-- .../TOOLCHAIN_IAR/startup_NRF52832_IAR.s | 38 ++++++++++++++++++- .../TARGET_NRF5_SDK13/port_api.c | 2 +- .../ble_radio_notification.c | 1 + .../sdk/drivers_nrf/spi_master/nrf_drv_spi.c | 4 +- .../TARGET_NRF5_SDK13/serial_api.c | 8 ++-- 6 files changed, 49 insertions(+), 12 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf index d8dee15e57..4fa73dd2c8 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf @@ -2,12 +2,12 @@ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ -define symbol __ICFEDIT_intvec_start__ = 0x1c000; +define symbol __ICFEDIT_intvec_start__ = 0x21000; /*-Memory Regions-*/ -define symbol __ICFEDIT_region_ROM_start__ = 0x1c000; -define symbol __ICFEDIT_region_ROM_end__ = 0x7ffff; +define symbol __ICFEDIT_region_ROM_start__ = 0x21000; +define symbol __ICFEDIT_region_ROM_end__ = 0xfffff; define symbol __ICFEDIT_region_RAM_start__ = 0x20002ef8; -define symbol __ICFEDIT_region_RAM_end__ = 0x2000ffff; +define symbol __ICFEDIT_region_RAM_end__ = 0x2003ffff; export symbol __ICFEDIT_region_RAM_start__; export symbol __ICFEDIT_region_RAM_end__; /*-Sizes-*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s index b27d189e7d..26ba439712 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s @@ -118,7 +118,13 @@ __vector_table DCD RTC2_IRQHandler_v DCD I2S_IRQHandler_v DCD FPU_IRQHandler_v - + DCD USBD_IRQHandler_v + DCD UARTE1_IRQHandler_v + DCD QSPI_IRQHandler_v + DCD CRYPTOCELL_IRQHandler_v + DCD SPIM3_IRQHandler_v + DCD 0 /*Reserved */ + DCD PWM3_IRQHandler_v __Vectors_End __Vectors EQU __vector_table @@ -375,6 +381,36 @@ I2S_IRQHandler_v FPU_IRQHandler_v B . + PUBWEAK USBD_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +USBD_IRQHandler_v + B . + + PUBWEAK UARTE1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +UARTE1_IRQHandler_v + B . + + PUBWEAK QSPI_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +QSPI_IRQHandler_v + B . + + PUBWEAK CRYPTOCELL_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +CRYPTOCELL_IRQHandler_v + B . + + PUBWEAK SPIM3_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SPIM3_IRQHandler_v + B . + + PUBWEAK PWM3_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PWM3_IRQHandler_v + B . + END diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c index bb689e2fbe..9b7849c78c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c @@ -45,7 +45,7 @@ static NRF_GPIO_Type * const m_ports[] = GPIO_REG_LIST; PinName port_pin(PortName port, int pin_n) { - return NRF_GPIO_PIN_MAP(port, pin_n); + return (PinName)NRF_GPIO_PIN_MAP(port, pin_n); } void port_init(port_t *obj, PortName port, int mask, PinDirection dir) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c index 22989aff22..1f424e7386 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c @@ -37,6 +37,7 @@ */ #include "ble_radio_notification.h" +#include "nrf_nvic.h" #include diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c index b015d55805..ac6433b8e6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c @@ -611,8 +611,8 @@ void nrf_drv_spi_abort(nrf_drv_spi_t const * p_instance) CODE_FOR_SPIM ( - nrf_spim_task_trigger(p_instance, NRF_SPIM_TASK_STOP); - while (!nrf_spim_event_check(p_instance, NRF_SPIM_EVENT_STOPPED)) {} + nrf_spim_task_trigger(p_instance->p_registers, NRF_SPIM_TASK_STOP); + while (!nrf_spim_event_check(p_instance->p_registers, NRF_SPIM_EVENT_STOPPED)) {} p_cb->transfer_in_progress = false; ) CODE_FOR_SPI diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c index 3a219ad449..55c4be419c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c @@ -283,9 +283,9 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { nrf_uart_enable(UART_INSTANCE); } else { - UART_CB.baudrate = UART_DEFAULT_BAUDRATE; - UART_CB.parity = UART_DEFAULT_PARITY; - UART_CB.hwfc = UART_DEFAULT_HWFC; + UART_CB.baudrate = (nrf_uart_baudrate_t)UART_DEFAULT_BAUDRATE; + UART_CB.parity = (nrf_uart_parity_t)UART_DEFAULT_PARITY; + UART_CB.hwfc = (nrf_uart_hwfc_t)UART_DEFAULT_HWFC; UART_CB.pselcts = UART_DEFAULT_CTS; UART_CB.pselrts = UART_DEFAULT_RTS; @@ -554,7 +554,7 @@ static void internal_set_hwfc(FlowControl type, nrf_gpio_cfg_input(UART_CB.pselcts, NRF_GPIO_PIN_NOPULL); } - UART_CB.hwfc = (type == FlowControlNone)? NRF_UART_HWFC_DISABLED : UART_DEFAULT_CONFIG_HWFC; + UART_CB.hwfc = (nrf_uart_hwfc_t)((type == FlowControlNone)? NRF_UART_HWFC_DISABLED : UART_DEFAULT_CONFIG_HWFC); nrf_uart_configure(UART_INSTANCE, UART_CB.parity, UART_CB.hwfc); nrf_uart_hwfc_pins_set(UART_INSTANCE, UART_CB.pselrts, UART_CB.pselcts); From f1c3d75c21da5bd192bf1785ed9d5050adfcf1fa Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 4 Jan 2017 12:29:20 +0100 Subject: [PATCH 12/31] initial creation of nRF52840 BLE target implementation "NRF5_SDK13" as a copy of "NRF5" --- .../TARGET_NRF5_SDK13/CHANGELOG.md | 344 +++++++ .../TARGET_NRF5_SDK13/apache-2.0.txt | 13 + .../softdevice_nrf51822_licence_agreement.txt | 30 + .../TARGET_NRF5_SDK13/source/btle/btle.cpp | 313 ++++++ .../TARGET_NRF5_SDK13/source/btle/btle.h | 41 + .../source/btle/btle_advertising.cpp | 46 + .../source/btle/btle_advertising.h | 24 + .../source/btle/btle_clock.h | 133 +++ .../source/btle/btle_discovery.cpp | 146 +++ .../source/btle/btle_discovery.h | 22 + .../source/btle/btle_gap.cpp | 99 ++ .../TARGET_NRF5_SDK13/source/btle/btle_gap.h | 24 + .../source/btle/btle_security.cpp | 326 ++++++ .../source/btle/btle_security.h | 128 +++ .../source/btle/btle_security_pm.cpp | 440 ++++++++ .../source/btle/custom/custom_helper.cpp | 364 +++++++ .../source/btle/custom/custom_helper.h | 71 ++ .../source/common/ansi_escape.h | 103 ++ .../source/common/assertion.h | 197 ++++ .../TARGET_NRF5_SDK13/source/common/binary.h | 96 ++ .../source/common/ble_error.h | 151 +++ .../TARGET_NRF5_SDK13/source/common/common.h | 236 +++++ .../source/common/compiler.h | 160 +++ ...RF5xCharacteristicDescriptorDiscoverer.cpp | 303 ++++++ .../nRF5xCharacteristicDescriptorDiscoverer.h | 227 +++++ .../source/nRF5xDiscoveredCharacteristic.cpp | 63 ++ .../source/nRF5xDiscoveredCharacteristic.h | 45 + .../TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 947 ++++++++++++++++++ .../TARGET_NRF5_SDK13/source/nRF5xGap.h | 247 +++++ .../source/nRF5xGattClient.cpp | 50 + .../source/nRF5xGattClient.h | 218 ++++ .../source/nRF5xGattServer.cpp | 792 +++++++++++++++ .../source/nRF5xGattServer.h | 158 +++ .../source/nRF5xSecurityManager.h | 174 ++++ .../source/nRF5xServiceDiscovery.cpp | 312 ++++++ .../source/nRF5xServiceDiscovery.h | 366 +++++++ .../TARGET_NRF5_SDK13/source/nRF5xn.cpp | 224 +++++ .../TARGET_NRF5_SDK13/source/nRF5xn.h | 184 ++++ .../TARGET_NRF5_SDK13/source/projectconfig.h | 136 +++ 39 files changed, 7953 insertions(+) create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/CHANGELOG.md create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/apache-2.0.txt create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/softdevice_nrf51822_licence_agreement.txt create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_clock.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_gap.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_gap.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/ansi_escape.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/assertion.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/binary.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/ble_error.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/common.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/compiler.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xDiscoveredCharacteristic.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xDiscoveredCharacteristic.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattClient.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattClient.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xn.cpp create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xn.h create mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/projectconfig.h diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/CHANGELOG.md b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/CHANGELOG.md new file mode 100644 index 0000000000..bb4dad9a4a --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/CHANGELOG.md @@ -0,0 +1,344 @@ +# Change Log + +## [v2.5.3](https://github.com/ARMmbed/ble-nrf51822/tree/v2.5.3) (2016-02-16) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.5.2...v2.5.3) + +**Merged pull requests:** + +- Fix for compilation errors with S110 softdevice in btle.cpp [\#109](https://github.com/ARMmbed/ble-nrf51822/pull/109) ([ddavidebor](https://github.com/ddavidebor)) + +## [v2.5.2](https://github.com/ARMmbed/ble-nrf51822/tree/v2.5.2) (2016-02-16) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.5.1...v2.5.2) + +**Merged pull requests:** + +- Sync develop against master [\#113](https://github.com/ARMmbed/ble-nrf51822/pull/113) ([pan-](https://github.com/pan-)) +- Fix incorrect handles of characteristics descriptors. [\#112](https://github.com/ARMmbed/ble-nrf51822/pull/112) ([pan-](https://github.com/pan-)) + +## [v2.5.1](https://github.com/ARMmbed/ble-nrf51822/tree/v2.5.1) (2016-01-27) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.5.0...v2.5.1) + +**Merged pull requests:** + +- Remove Gap::state updates from this module [\#108](https://github.com/ARMmbed/ble-nrf51822/pull/108) ([andresag01](https://github.com/andresag01)) +- merge version [\#106](https://github.com/ARMmbed/ble-nrf51822/pull/106) ([pan-](https://github.com/pan-)) + +## [v2.5.0](https://github.com/ARMmbed/ble-nrf51822/tree/v2.5.0) (2016-01-12) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.4.1...v2.5.0) + +**Merged pull requests:** + +- Fix access to enum member [\#105](https://github.com/ARMmbed/ble-nrf51822/pull/105) ([pan-](https://github.com/pan-)) +- Hotfix dependency [\#104](https://github.com/ARMmbed/ble-nrf51822/pull/104) ([pan-](https://github.com/pan-)) +- Finish implementation of getAddressesFromBondTable [\#103](https://github.com/ARMmbed/ble-nrf51822/pull/103) ([andresag01](https://github.com/andresag01)) + +## [v2.4.1](https://github.com/ARMmbed/ble-nrf51822/tree/v2.4.1) (2016-01-11) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.4.0...v2.4.1) + +**Merged pull requests:** + +- merge branch develop \(v2.4.0\) [\#100](https://github.com/ARMmbed/ble-nrf51822/pull/100) ([pan-](https://github.com/pan-)) + +## [v2.4.0](https://github.com/ARMmbed/ble-nrf51822/tree/v2.4.0) (2016-01-10) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.3.1...v2.4.0) + +**Merged pull requests:** + +- Add implementation of experimental whitelisting API [\#99](https://github.com/ARMmbed/ble-nrf51822/pull/99) ([andresag01](https://github.com/andresag01)) + +## [v2.3.1](https://github.com/ARMmbed/ble-nrf51822/tree/v2.3.1) (2016-01-07) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.3.0...v2.3.1) + +**Merged pull requests:** + +- Update yotta module dependencies [\#98](https://github.com/ARMmbed/ble-nrf51822/pull/98) ([pan-](https://github.com/pan-)) + +## [v2.3.0](https://github.com/ARMmbed/ble-nrf51822/tree/v2.3.0) (2015-12-23) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.10...v2.3.0) + +**Merged pull requests:** + +- Implementation of Characteristic descriptor discovery [\#74](https://github.com/ARMmbed/ble-nrf51822/pull/74) ([pan-](https://github.com/pan-)) + +## [v2.2.10](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.10) (2015-12-23) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.9...v2.2.10) + +**Fixed bugs:** + +- nRF5xn::init don't verify if errors have occurred during btle\_init [\#59](https://github.com/ARMmbed/ble-nrf51822/issues/59) + +**Closed issues:** + +- A call to shutdown does not clear the state of some components of BLE API [\#85](https://github.com/ARMmbed/ble-nrf51822/issues/85) +- Memory allocation issue on the NRF51DK board. [\#76](https://github.com/ARMmbed/ble-nrf51822/issues/76) +- Terrible handling of initLen / minLen and variable length characteristics. [\#56](https://github.com/ARMmbed/ble-nrf51822/issues/56) + +**Merged pull requests:** + +- Fix shutdown of Gap instance to avoid NULL refs [\#96](https://github.com/ARMmbed/ble-nrf51822/pull/96) ([andresag01](https://github.com/andresag01)) +- Add check for return code of ble\_init [\#95](https://github.com/ARMmbed/ble-nrf51822/pull/95) ([andresag01](https://github.com/andresag01)) + +## [v2.2.9](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.9) (2015-12-18) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.8...v2.2.9) + +**Closed issues:** + +- Cannot open source input file "system\_nrf51.h" [\#52](https://github.com/ARMmbed/ble-nrf51822/issues/52) + +**Merged pull requests:** + +- Remove occurrence of deprecated appearance enum [\#92](https://github.com/ARMmbed/ble-nrf51822/pull/92) ([andresag01](https://github.com/andresag01)) + +## [v2.2.8](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.8) (2015-12-16) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.7...v2.2.8) + +## [v2.2.7](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.7) (2015-12-15) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.6...v2.2.7) + +**Merged pull requests:** + +- Replace deprecated inclusions of mbed.h [\#89](https://github.com/ARMmbed/ble-nrf51822/pull/89) ([andresag01](https://github.com/andresag01)) +- Improve shutdown to clear BLE API and not just SD [\#87](https://github.com/ARMmbed/ble-nrf51822/pull/87) ([andresag01](https://github.com/andresag01)) + +## [v2.2.6](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.6) (2015-12-15) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.5...v2.2.6) + +**Merged pull requests:** + +- follow the extraction of address related types from Gap.h into BLEProtocol.h [\#88](https://github.com/ARMmbed/ble-nrf51822/pull/88) ([rgrover](https://github.com/rgrover)) + +## [v2.2.5](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.5) (2015-12-11) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.3...v2.2.5) + +**Merged pull requests:** + +- Added SecurityManager::setLinkSecurity call for elevating security settings on a particular connection. [\#86](https://github.com/ARMmbed/ble-nrf51822/pull/86) ([marcuschangarm](https://github.com/marcuschangarm)) + +## [v2.2.3](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.3) (2015-12-10) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.2...v2.2.3) + +## [v2.2.2](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.2) (2015-12-08) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.1...v2.2.2) + +**Merged pull requests:** + +- Add -Wno-unused-function to supress-warnings.cmake [\#83](https://github.com/ARMmbed/ble-nrf51822/pull/83) ([andresag01](https://github.com/andresag01)) + +## [v2.2.1](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.1) (2015-12-08) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.2.0...v2.2.1) + +**Merged pull requests:** + +- WIP: UUID endian change [\#82](https://github.com/ARMmbed/ble-nrf51822/pull/82) ([marcuschangarm](https://github.com/marcuschangarm)) + +## [v2.2.0](https://github.com/ARMmbed/ble-nrf51822/tree/v2.2.0) (2015-12-02) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.1.4...v2.2.0) + +## [v2.1.4](https://github.com/ARMmbed/ble-nrf51822/tree/v2.1.4) (2015-12-02) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.1.3...v2.1.4) + +## [v2.1.3](https://github.com/ARMmbed/ble-nrf51822/tree/v2.1.3) (2015-12-02) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.1.2...v2.1.3) + +## [v2.1.2](https://github.com/ARMmbed/ble-nrf51822/tree/v2.1.2) (2015-12-02) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.1.1...v2.1.2) + +**Merged pull requests:** + +- Allow GattAttributes to have variable length [\#81](https://github.com/ARMmbed/ble-nrf51822/pull/81) ([andresag01](https://github.com/andresag01)) + +## [v2.1.1](https://github.com/ARMmbed/ble-nrf51822/tree/v2.1.1) (2015-12-02) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.1.0...v2.1.1) + +**Merged pull requests:** + +- Fixed endianness bug in nRF5xServiceDiscovery::processDiscoverUUIDResponse so it is consistent with BLE API. [\#80](https://github.com/ARMmbed/ble-nrf51822/pull/80) ([marcuschangarm](https://github.com/marcuschangarm)) +- Fixed bug in nRF5xGap.setAddress where random adresses where not set properly. [\#79](https://github.com/ARMmbed/ble-nrf51822/pull/79) ([marcuschangarm](https://github.com/marcuschangarm)) +- Separate concept of minlen and len for BLE chars [\#78](https://github.com/ARMmbed/ble-nrf51822/pull/78) ([andresag01](https://github.com/andresag01)) +- Split nordic sdk into its own module [\#75](https://github.com/ARMmbed/ble-nrf51822/pull/75) ([LiyouZhou](https://github.com/LiyouZhou)) + +## [v2.1.0](https://github.com/ARMmbed/ble-nrf51822/tree/v2.1.0) (2015-11-27) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.8...v2.1.0) + +**Merged pull requests:** + +- Update to sdk 8.1 [\#77](https://github.com/ARMmbed/ble-nrf51822/pull/77) ([LiyouZhou](https://github.com/LiyouZhou)) + +## [v2.0.8](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.8) (2015-11-26) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.7...v2.0.8) + +## [v2.0.7](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.7) (2015-11-26) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.6...v2.0.7) + +**Closed issues:** + +- test2000 [\#72](https://github.com/ARMmbed/ble-nrf51822/issues/72) +- test1000000 [\#71](https://github.com/ARMmbed/ble-nrf51822/issues/71) +- test4 [\#70](https://github.com/ARMmbed/ble-nrf51822/issues/70) +- test3 [\#69](https://github.com/ARMmbed/ble-nrf51822/issues/69) +- test2 [\#68](https://github.com/ARMmbed/ble-nrf51822/issues/68) + +**Merged pull requests:** + +- use Extern c around \#include to use nordic sdk headers implemented in C [\#73](https://github.com/ARMmbed/ble-nrf51822/pull/73) ([LiyouZhou](https://github.com/LiyouZhou)) + +## [v2.0.6](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.6) (2015-11-17) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.5...v2.0.6) + +**Closed issues:** + +- test [\#66](https://github.com/ARMmbed/ble-nrf51822/issues/66) + +**Merged pull requests:** + +- add Nordic's license agreement. [\#67](https://github.com/ARMmbed/ble-nrf51822/pull/67) ([rgrover](https://github.com/rgrover)) + +## [v2.0.5](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.5) (2015-11-16) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.4...v2.0.5) + +**Merged pull requests:** + +- Post radio notification callback through minar [\#65](https://github.com/ARMmbed/ble-nrf51822/pull/65) ([andresag01](https://github.com/andresag01)) + +## [v2.0.4](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.4) (2015-11-13) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.3...v2.0.4) + +**Merged pull requests:** + +- Fix assembly sequence to start bootloader in GCC [\#64](https://github.com/ARMmbed/ble-nrf51822/pull/64) ([andresag01](https://github.com/andresag01)) + +## [v2.0.3](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.3) (2015-11-09) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.2...v2.0.3) + +**Merged pull requests:** + +- Added watchdog header file from Nordic SDK 8.1 [\#62](https://github.com/ARMmbed/ble-nrf51822/pull/62) ([marcuschangarm](https://github.com/marcuschangarm)) + +## [v2.0.2](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.2) (2015-11-03) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/mbedos-release-15-11...v2.0.2) + +## [mbedos-release-15-11](https://github.com/ARMmbed/ble-nrf51822/tree/mbedos-release-15-11) (2015-11-03) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.1...mbedos-release-15-11) + +## [v2.0.1](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.1) (2015-11-02) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v2.0.0...v2.0.1) + +**Merged pull requests:** + +- Ensure that the initialization flags is set to false if the BLE stack is shutdown properly. [\#58](https://github.com/ARMmbed/ble-nrf51822/pull/58) ([pan-](https://github.com/pan-)) + +## [v2.0.0](https://github.com/ARMmbed/ble-nrf51822/tree/v2.0.0) (2015-11-02) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v1.1.0...v2.0.0) + +**Closed issues:** + +- Nordic SDK and SoftDevice [\#57](https://github.com/ARMmbed/ble-nrf51822/issues/57) +- shouldn't eab6631cb be merged into master? [\#54](https://github.com/ARMmbed/ble-nrf51822/issues/54) + +**Merged pull requests:** + +- Introduced changes for memory savings [\#55](https://github.com/ARMmbed/ble-nrf51822/pull/55) ([andresag01](https://github.com/andresag01)) + +## [v1.1.0](https://github.com/ARMmbed/ble-nrf51822/tree/v1.1.0) (2015-10-28) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v1.0.0...v1.1.0) + +**Closed issues:** + +- target dependencies in module.json [\#50](https://github.com/ARMmbed/ble-nrf51822/issues/50) + +**Merged pull requests:** + +- When connecting, if no scanning parameters are passed, use values from Gap parent. [\#53](https://github.com/ARMmbed/ble-nrf51822/pull/53) ([marcuschangarm](https://github.com/marcuschangarm)) + +## [v1.0.0](https://github.com/ARMmbed/ble-nrf51822/tree/v1.0.0) (2015-10-19) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/mbedos-techcon-oob2...v1.0.0) + +## [mbedos-techcon-oob2](https://github.com/ARMmbed/ble-nrf51822/tree/mbedos-techcon-oob2) (2015-10-19) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v0.4.8...mbedos-techcon-oob2) + +**Closed issues:** + +- rename the bootloader files with \_fota in the name? [\#51](https://github.com/ARMmbed/ble-nrf51822/issues/51) + +**Merged pull requests:** + +- Update S110 detection macros, again [\#49](https://github.com/ARMmbed/ble-nrf51822/pull/49) ([jpbrucker](https://github.com/jpbrucker)) +- Error check number of characteristics [\#48](https://github.com/ARMmbed/ble-nrf51822/pull/48) ([Timmmm](https://github.com/Timmmm)) + +## [v0.4.8](https://github.com/ARMmbed/ble-nrf51822/tree/v0.4.8) (2015-09-25) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v0.4.7...v0.4.8) + +**Closed issues:** + +- Error real cause loss in nRF5xGattServer.cpp [\#44](https://github.com/ARMmbed/ble-nrf51822/issues/44) + +**Merged pull requests:** + +- rgrover patch fixed [\#47](https://github.com/ARMmbed/ble-nrf51822/pull/47) ([fabiencomte](https://github.com/fabiencomte)) +- Update S110 detection macros [\#43](https://github.com/ARMmbed/ble-nrf51822/pull/43) ([jpbrucker](https://github.com/jpbrucker)) +- remove some unnecessary include paths [\#42](https://github.com/ARMmbed/ble-nrf51822/pull/42) ([autopulated](https://github.com/autopulated)) +- Add FOTA bootloader image [\#41](https://github.com/ARMmbed/ble-nrf51822/pull/41) ([jpbrucker](https://github.com/jpbrucker)) + +## [v0.4.7](https://github.com/ARMmbed/ble-nrf51822/tree/v0.4.7) (2015-08-13) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v0.4.6...v0.4.7) + +## [v0.4.6](https://github.com/ARMmbed/ble-nrf51822/tree/v0.4.6) (2015-08-11) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v0.4.5...v0.4.6) + +**Closed issues:** + +- remove duplication of global static variable BLE\_EVT\_BUFFER [\#39](https://github.com/ARMmbed/ble-nrf51822/issues/39) +- clearScanResponse\(\) [\#30](https://github.com/ARMmbed/ble-nrf51822/issues/30) +- Debug builds fail due to missing bsp.h [\#11](https://github.com/ARMmbed/ble-nrf51822/issues/11) + +**Merged pull requests:** + +- Disable GattClient features when using S110 SoftDevice [\#38](https://github.com/ARMmbed/ble-nrf51822/pull/38) ([jpbrucker](https://github.com/jpbrucker)) + +## [v0.4.5](https://github.com/ARMmbed/ble-nrf51822/tree/v0.4.5) (2015-08-10) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v0.4.4...v0.4.5) + +## [v0.4.4](https://github.com/ARMmbed/ble-nrf51822/tree/v0.4.4) (2015-08-07) +[Full Changelog](https://github.com/ARMmbed/ble-nrf51822/compare/v0.4.3...v0.4.4) + +**Closed issues:** + +- nrf51822 hangs after calling sd\_flash\_page\_erase\(\) [\#35](https://github.com/ARMmbed/ble-nrf51822/issues/35) +- nRF5xn::getVersion return \(Unknown\) with version 8 soft device [\#29](https://github.com/ARMmbed/ble-nrf51822/issues/29) + +**Merged pull requests:** + +- Changed Gap:: to GapAdvertisingParams:: because of change in BLE [\#34](https://github.com/ARMmbed/ble-nrf51822/pull/34) ([jslater8](https://github.com/jslater8)) +- Select the clock source dynamically on SoftDevice initialisation [\#32](https://github.com/ARMmbed/ble-nrf51822/pull/32) ([jpbrucker](https://github.com/jpbrucker)) +- Add S110 SoftDevice compatibility [\#28](https://github.com/ARMmbed/ble-nrf51822/pull/28) ([jpbrucker](https://github.com/jpbrucker)) + +## [v0.4.3](https://github.com/ARMmbed/ble-nrf51822/tree/v0.4.3) (2015-07-22) +**Closed issues:** + +- Target polling failed [\#24](https://github.com/ARMmbed/ble-nrf51822/issues/24) +- support handling of HVX Events \(notifications and indications\). [\#22](https://github.com/ARMmbed/ble-nrf51822/issues/22) +- provide an implementation for GattServer::areUpdatesEnabled\(\) [\#21](https://github.com/ARMmbed/ble-nrf51822/issues/21) +- getValueHandle\(\) returns characteristicIndex instead of attribute-handle [\#20](https://github.com/ARMmbed/ble-nrf51822/issues/20) +- Clash With Definition And Enum Naming [\#16](https://github.com/ARMmbed/ble-nrf51822/issues/16) +- Errors in GCC build [\#14](https://github.com/ARMmbed/ble-nrf51822/issues/14) +- bring s110 support back [\#10](https://github.com/ARMmbed/ble-nrf51822/issues/10) +- Allow adding a User Description descriptor to a GattCharacteristic. [\#9](https://github.com/ARMmbed/ble-nrf51822/issues/9) +- device\_manager\_peripheral.c includes app\_trace.h [\#7](https://github.com/ARMmbed/ble-nrf51822/issues/7) +- linking esb\_gcc.a \(nrf51822 enhanced shock burst\) with mbed [\#5](https://github.com/ARMmbed/ble-nrf51822/issues/5) +- The app\_timer usage may conflict [\#2](https://github.com/ARMmbed/ble-nrf51822/issues/2) +- Nordic License [\#1](https://github.com/ARMmbed/ble-nrf51822/issues/1) + +**Merged pull requests:** + +- Develop [\#25](https://github.com/ARMmbed/ble-nrf51822/pull/25) ([zoujixing](https://github.com/zoujixing)) +- Remove unnecessary 'compiler\_abstraction.h' to get rid of duplicate '… [\#23](https://github.com/ARMmbed/ble-nrf51822/pull/23) ([adfernandes](https://github.com/adfernandes)) +- restructure for minimal yotta compatibility [\#15](https://github.com/ARMmbed/ble-nrf51822/pull/15) ([autopulated](https://github.com/autopulated)) +- Fix various GCC compilation issues. [\#12](https://github.com/ARMmbed/ble-nrf51822/pull/12) ([adfernandes](https://github.com/adfernandes)) +- Fix for GCC lost in SDK v8.0 update [\#8](https://github.com/ARMmbed/ble-nrf51822/pull/8) ([rosterloh](https://github.com/rosterloh)) +- new target DELTA\_DFCM\_NNN40 with nrf51822 chip, config internal RC crystal. [\#6](https://github.com/ARMmbed/ble-nrf51822/pull/6) ([Marcomissyou](https://github.com/Marcomissyou)) +- Updated return value for nRF51GattServer::updateValue. Will now report w... [\#4](https://github.com/ARMmbed/ble-nrf51822/pull/4) ([marcuschangarm](https://github.com/marcuschangarm)) +- Added optional data and length fields to the return struct for authorize... [\#3](https://github.com/ARMmbed/ble-nrf51822/pull/3) ([marcuschangarm](https://github.com/marcuschangarm)) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/apache-2.0.txt b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/apache-2.0.txt new file mode 100644 index 0000000000..9327527edd --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/apache-2.0.txt @@ -0,0 +1,13 @@ +Copyright (c) 2015 ARM Limited + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/softdevice_nrf51822_licence_agreement.txt b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/softdevice_nrf51822_licence_agreement.txt new file mode 100644 index 0000000000..8e447f4c64 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/softdevice_nrf51822_licence_agreement.txt @@ -0,0 +1,30 @@ +/* + * S110/S120/S130 License Agreement + * + * Copyright (c) 2015, Nordic Semiconductor ASA, All rights reserved. + * + * Redistribution. Redistribution and use in binary form, without modification, + * are permitted provided that the following conditions are met: + * + * • Redistributions must reproduce the above copyright notice and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * • Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * • No reverse engineering, decompilation, or disassembly of this software is + * permitted. + * + * DISCLAIMER. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * / diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp new file mode 100644 index 0000000000..ec562e4e24 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp @@ -0,0 +1,313 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "common/common.h" +#include "nordic_common.h" + +#include "btle.h" +#include "btle_clock.h" + +#include "ble_flash.h" +#include "ble_conn_params.h" + +#include "btle_gap.h" +#include "btle_advertising.h" +#include "custom/custom_helper.h" + +#include "ble/GapEvents.h" +#include "nRF5xn.h" + +#ifdef S110 + #define IS_LEGACY_DEVICE_MANAGER_ENABLED 1 +#elif defined(S130) || defined(S132) + #define IS_LEGACY_DEVICE_MANAGER_ENABLED 0 +#endif + +extern "C" { +#if (IS_LEGACY_DEVICE_MANAGER_ENABLED) + #include "pstorage.h" + #include "device_manager.h" +#else + #include "fstorage.h" + #include "fds.h" + #include "peer_manager.h" + #include "ble_conn_state.h" +#endif + +#include "softdevice_handler.h" +#include "ble_stack_handler_types.h" +} + +#include "ble_hci.h" +#include "btle_discovery.h" + +#include "nRF5xGattClient.h" +#include "nRF5xServiceDiscovery.h" +#include "nRF5xCharacteristicDescriptorDiscoverer.h" + + +bool isEventsSignaled = false; + +extern "C" void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name); +void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t *p_file_name); +extern "C" void SD_EVT_IRQHandler(void); // export the softdevice event handler for registration by nvic-set-vector. + + +static void btle_handler(ble_evt_t *p_ble_evt); + +#if 0 +#define CENTRAL_LINK_COUNT (YOTTA_CFG_NORDIC_BLE_CENTRAL_LINKS) /**header.evt_id) { + case BLE_GAP_EVT_CONNECTED: { + Gap::Handle_t handle = p_ble_evt->evt.gap_evt.conn_handle; +#if defined(TARGET_MCU_NRF51_16K_S110) || defined(TARGET_MCU_NRF51_32K_S110) + /* Only peripheral role is supported by S110 */ + Gap::Role_t role = Gap::PERIPHERAL; +#else + Gap::Role_t role = static_cast(p_ble_evt->evt.gap_evt.params.connected.role); +#endif + gap.setConnectionHandle(handle); + const Gap::ConnectionParams_t *params = reinterpret_cast(&(p_ble_evt->evt.gap_evt.params.connected.conn_params)); + const ble_gap_addr_t *peer = &p_ble_evt->evt.gap_evt.params.connected.peer_addr; + const ble_gap_addr_t *own = &p_ble_evt->evt.gap_evt.params.connected.own_addr; + gap.processConnectionEvent(handle, + role, + static_cast(peer->addr_type), peer->addr, + static_cast(own->addr_type), own->addr, + params); + break; + } + + case BLE_GAP_EVT_DISCONNECTED: { + Gap::Handle_t handle = p_ble_evt->evt.gap_evt.conn_handle; + // Since we are not in a connection and have not started advertising, + // store bonds + gap.setConnectionHandle (BLE_CONN_HANDLE_INVALID); + + Gap::DisconnectionReason_t reason; + switch (p_ble_evt->evt.gap_evt.params.disconnected.reason) { + case BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION: + reason = Gap::LOCAL_HOST_TERMINATED_CONNECTION; + break; + case BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION: + reason = Gap::REMOTE_USER_TERMINATED_CONNECTION; + break; + case BLE_HCI_CONN_INTERVAL_UNACCEPTABLE: + reason = Gap::CONN_INTERVAL_UNACCEPTABLE; + break; + default: + /* Please refer to the underlying transport library for an + * interpretion of this reason's value. */ + reason = static_cast(p_ble_evt->evt.gap_evt.params.disconnected.reason); + break; + } + +#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) + // Close all pending discoveries for this connection + nRF5xGattClient& gattClient = ble.getGattClient(); + gattClient.characteristicDescriptorDiscoverer().terminate(handle, BLE_ERROR_INVALID_STATE); + gattClient.discovery().terminate(handle); +#endif + + gap.processDisconnectionEvent(handle, reason); + break; + } + + case BLE_GAP_EVT_PASSKEY_DISPLAY: + securityManager.processPasskeyDisplayEvent(p_ble_evt->evt.gap_evt.conn_handle, p_ble_evt->evt.gap_evt.params.passkey_display.passkey); + break; + + case BLE_GAP_EVT_TIMEOUT: + gap.processTimeoutEvent(static_cast(p_ble_evt->evt.gap_evt.params.timeout.src)); + break; + + case BLE_GATTC_EVT_TIMEOUT: + case BLE_GATTS_EVT_TIMEOUT: + // Disconnect on GATT Server and Client timeout events. + // ASSERT_STATUS_RET_VOID (sd_ble_gap_disconnect(m_conn_handle, + // BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION)); + break; + + case BLE_GAP_EVT_ADV_REPORT: { + const ble_gap_evt_adv_report_t *advReport = &p_ble_evt->evt.gap_evt.params.adv_report; + gap.processAdvertisementReport(advReport->peer_addr.addr, + advReport->rssi, + advReport->scan_rsp, + static_cast(advReport->type), + advReport->dlen, + advReport->data); + break; + } + + default: + break; + } + + gattServer.hwCallback(p_ble_evt); +} + +/*! @brief Callback when an error occurs inside the SoftDevice */ +void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name) +{ + ASSERT_TRUE(false, (void) 0); +} + +/*! + @brief Handler for general errors above the SoftDevice layer. + Typically we can' recover from this so we do a reset. +*/ +void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t *p_file_name) +{ + ASSERT_STATUS_RET_VOID( error_code ); + NVIC_SystemReset(); +} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h new file mode 100644 index 0000000000..d08784d1f0 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h @@ -0,0 +1,41 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BTLE_H_ +#define _BTLE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "common/common.h" + +#include "ble_srv_common.h" +#include "ble.h" + +error_t btle_init(void); + +// flag indicating if events have been signaled or not +// It is used by processEvents and signalEventsToProcess +// signalEventsToProcess raise the flag and processEvents +// clears it. +extern bool isEventsSignaled; + +#ifdef __cplusplus +} +#endif + +#endif // ifndef _BTLE_H_ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.cpp new file mode 100644 index 0000000000..cdaf6a4a49 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.cpp @@ -0,0 +1,46 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "common/common.h" + +#include "ble_advdata.h" +#include "btle.h" + +/**************************************************************************/ +/*! + @brief Starts the advertising process + + @returns +*/ +/**************************************************************************/ +error_t btle_advertising_start(void) +{ + ble_gap_adv_params_t adv_para = {0}; + + /* Set the default advertising parameters */ + adv_para.type = BLE_GAP_ADV_TYPE_ADV_IND; + adv_para.p_peer_addr = NULL; /* Undirected advertising */ + adv_para.fp = BLE_GAP_ADV_FP_ANY; + adv_para.p_whitelist = NULL; + adv_para.interval = (CFG_GAP_ADV_INTERVAL_MS * 8) / 5; /* Advertising + * interval in + * units of 0.625 + * ms */ + adv_para.timeout = CFG_GAP_ADV_TIMEOUT_S; + + ASSERT_STATUS( sd_ble_gap_adv_start(&adv_para)); + + return ERROR_NONE; +} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.h new file mode 100644 index 0000000000..a215153ab5 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.h @@ -0,0 +1,24 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BTLE_ADVERTISING_H_ +#define _BTLE_ADVERTISING_H_ + +#include "common/common.h" + +error_t btle_advertising_start(void); + +#endif // ifndef _BTLE_ADVERTISING_H_ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_clock.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_clock.h new file mode 100644 index 0000000000..bc4c1e29f4 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_clock.h @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _BTLE_CLOCK_H_ +#define _BTLE_CLOCK_H_ + +#include "nrf5x_lf_clk_helper.h" + +/** + * @brief Module that generates settings for the low-frequency (LF) clock configuration. + * + * This module provides macros that are generated from the mbed config system macros. + * + * + * + * As a result, this module provides the following: @n + * - literal value LFCLK_CONF_SOURCE @n + * - literal value LFCLK_CONF_ACCURACY @n + * - literal value LFCLK_CONF_RC_CTIV @n + * - literal value LFCLK_CONF_RC_TEMP_CTIV + */ + + + +#include "nrf_sdm.h" + +#define DEFAULT_LFCLK_CONF_ACCURACY NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM + +#ifdef NRF52 + #define MAX_LFCLK_CONF_RC_CTIV 32 +#else + #define MAX_LFCLK_CONF_RC_CTIV 64 +#endif + +#define MAX_LFCLK_CONF_RC_TEMP_CTIV 33 + +#define DEFAULT_LFCLK_CONF_RC_CTIV 16 // Check temperature every 16 * 250ms. +#define DEFAULT_LFCLK_CONF_RC_TEMP_CTIV 1 // Only calibrate if temperature has changed. + +#define NRF_LF_SRC_XTAL 2 +#define NRF_LF_SRC_SYNTH 3 +#define NRF_LF_SRC_RC 4 + +#if MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_RC + #define LFCLK_CONF_SOURCE NRF_CLOCK_LF_SRC_RC + + #ifdef MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL + #define LFCLK_CONF_RC_CTIV MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL + #else + #define LFCLK_CONF_RC_CTIV DEFAULT_LFCLK_CONF_RC_CTIV + #endif + + #ifdef MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG + #define LFCLK_CONF_RC_TEMP_CTIV MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG + #else + #define LFCLK_CONF_RC_TEMP_CTIV DEFAULT_LFCLK_CONF_RC_TEMP_CTIV + #endif + + #if (LFCLK_CONF_RC_CTIV < 1) || (LFCLK_CONF_RC_CTIV > MAX_LFCLK_CONF_RC_CTIV) + #error Calibration timer interval out of range! + #endif + + #if (LFCLK_CONF_RC_TEMP_CTIV < 0 ) || (LFCLK_CONF_RC_TEMP_CTIV > 33) + #error Number/mode of LF RC calibration intervals out of range! + #endif + +#elif MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_SYNTH + #define LFCLK_CONF_SOURCE NRF_CLOCK_LF_SRC_SYNTH + #define LFCLK_CONF_RC_CTIV 0 // Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. + #define LFCLK_CONF_RC_TEMP_CTIV 0 // Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. + + #ifdef MBED_CONF_NORDIC_LF_CLOCK_HF_SYNTH_ACCURACY + #define LFCLK_CONF_ACCURACY MBED_CONF_NORDIC_LF_CLOCK_HF_SYNTH_ACCURACY + #endif + +#else // default is NRF_LF_SRC_SYNTH + #define LFCLK_CONF_SOURCE NRF_CLOCK_LF_SRC_XTAL + #define LFCLK_CONF_RC_CTIV 0 // Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. + #define LFCLK_CONF_RC_TEMP_CTIV 0 // Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. + + #ifdef MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY + #define LFCLK_CONF_ACCURACY MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY + #endif + +#endif + +#ifndef LFCLK_CONF_ACCURACY + #define LFCLK_CONF_ACCURACY DEFAULT_LFCLK_CONF_ACCURACY +#endif + +#if (LFCLK_CONF_ACCURACY > NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM) || (LFCLK_CONF_ACCURACY < NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM) + #error Low frequency clock accuracy out of range! +#endif + + +#endif //_BTLE_CLOCK_H_ + + diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.cpp new file mode 100644 index 0000000000..0b6b1d6a9c --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.cpp @@ -0,0 +1,146 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nRF5xServiceDiscovery.h" +#include "nRF5xCharacteristicDescriptorDiscoverer.h" +#include "nRF5xGattClient.h" +#include "nRF5xn.h" + +#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) +void bleGattcEventHandler(const ble_evt_t *p_ble_evt) +{ + nRF5xn &ble = nRF5xn::Instance(BLE::DEFAULT_INSTANCE); + nRF5xGattClient &gattClient = (nRF5xGattClient &) ble.getGattClient(); + nRF5xServiceDiscovery &sdSingleton = gattClient.discovery(); + nRF5xCharacteristicDescriptorDiscoverer &characteristicDescriptorDiscoverer = + gattClient.characteristicDescriptorDiscoverer(); + + switch (p_ble_evt->header.evt_id) { + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + switch (p_ble_evt->evt.gattc_evt.gatt_status) { + case BLE_GATT_STATUS_SUCCESS: + sdSingleton.setupDiscoveredServices(&p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp); + break; + + case BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND: + default: + sdSingleton.terminate(); + break; + } + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + switch (p_ble_evt->evt.gattc_evt.gatt_status) { + case BLE_GATT_STATUS_SUCCESS: + sdSingleton.setupDiscoveredCharacteristics(&p_ble_evt->evt.gattc_evt.params.char_disc_rsp); + break; + + case BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND: + default: + sdSingleton.terminateCharacteristicDiscovery(BLE_ERROR_NONE); + break; + } + break; + + case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: + if (sdSingleton.isActive()) { + sdSingleton.processDiscoverUUIDResponse(&p_ble_evt->evt.gattc_evt.params.char_val_by_uuid_read_rsp); + } + break; + + case BLE_GATTC_EVT_READ_RSP: { + GattReadCallbackParams response = { + .connHandle = p_ble_evt->evt.gattc_evt.conn_handle, + .handle = p_ble_evt->evt.gattc_evt.params.read_rsp.handle, + .offset = p_ble_evt->evt.gattc_evt.params.read_rsp.offset, + .len = p_ble_evt->evt.gattc_evt.params.read_rsp.len, + .data = p_ble_evt->evt.gattc_evt.params.read_rsp.data, + }; + gattClient.processReadResponse(&response); + } + break; + + case BLE_GATTC_EVT_WRITE_RSP: { + GattWriteCallbackParams response = { + .connHandle = p_ble_evt->evt.gattc_evt.conn_handle, + .handle = p_ble_evt->evt.gattc_evt.params.write_rsp.handle, + .writeOp = (GattWriteCallbackParams::WriteOp_t)(p_ble_evt->evt.gattc_evt.params.write_rsp.write_op), + .offset = p_ble_evt->evt.gattc_evt.params.write_rsp.offset, + .len = p_ble_evt->evt.gattc_evt.params.write_rsp.len, + .data = p_ble_evt->evt.gattc_evt.params.write_rsp.data, + }; + gattClient.processWriteResponse(&response); + } + break; + + case BLE_GATTC_EVT_HVX: { + GattHVXCallbackParams params; + params.connHandle = p_ble_evt->evt.gattc_evt.conn_handle; + params.handle = p_ble_evt->evt.gattc_evt.params.hvx.handle; + params.type = static_cast(p_ble_evt->evt.gattc_evt.params.hvx.type); + params.len = p_ble_evt->evt.gattc_evt.params.hvx.len; + params.data = p_ble_evt->evt.gattc_evt.params.hvx.data; + + gattClient.processHVXEvent(¶ms); + } + break; + + case BLE_GATTC_EVT_DESC_DISC_RSP: { + uint16_t conn_handle = p_ble_evt->evt.gattc_evt.conn_handle; + uint16_t status = p_ble_evt->evt.gattc_evt.gatt_status; + const ble_gattc_evt_desc_disc_rsp_t& discovered_descriptors = p_ble_evt->evt.gattc_evt.params.desc_disc_rsp; + + switch(status) { + case BLE_GATT_STATUS_SUCCESS: + characteristicDescriptorDiscoverer.process( + conn_handle, + discovered_descriptors + ); + break; + case BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND: + // end of discovery + characteristicDescriptorDiscoverer.terminate(conn_handle, BLE_ERROR_NONE); + break; + default: + characteristicDescriptorDiscoverer.terminate(conn_handle, BLE_ERROR_UNSPECIFIED); + break; + } + } break; + + case BLE_GATTC_EVT_ATTR_INFO_DISC_RSP : { + uint16_t conn_handle = p_ble_evt->evt.gattc_evt.conn_handle; + uint16_t status = p_ble_evt->evt.gattc_evt.gatt_status; + const ble_gattc_evt_attr_info_disc_rsp_t& infos = p_ble_evt->evt.gattc_evt.params.attr_info_disc_rsp; + + switch(status) { + case BLE_GATT_STATUS_SUCCESS: + characteristicDescriptorDiscoverer.processAttributeInformation( + conn_handle, + infos + ); + break; + default: + characteristicDescriptorDiscoverer.terminate(conn_handle, BLE_ERROR_UNSPECIFIED); + break; + } + + } break; + } + + sdSingleton.progressCharacteristicDiscovery(); + sdSingleton.progressServiceDiscovery(); +} +#endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.h new file mode 100644 index 0000000000..9b7613e782 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.h @@ -0,0 +1,22 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BTLE_DISCOVERY_H_ +#define _BTLE_DISCOVERY_H_ + +void bleGattcEventHandler(const ble_evt_t *p_ble_evt); + +#endif /*_BTLE_DISCOVERY_H_*/ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_gap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_gap.cpp new file mode 100644 index 0000000000..a70f7165be --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_gap.cpp @@ -0,0 +1,99 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "common/common.h" + +#include "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; +#if SDK_CONN_PARAMS_MODULE_ENABLE +static void error_callback(uint32_t nrf_error); +#endif // SDK_CONN_PARAMS_MODULE_ENABLE + +/**************************************************************************/ +/*! + @brief Initialise GAP in the underlying SoftDevice + + @returns +*/ +/**************************************************************************/ +error_t btle_gap_init(void) +{ + ble_gap_conn_params_t gap_conn_params = {0}; + + gap_conn_params.min_conn_interval = msec_to_1_25msec(CFG_GAP_CONNECTION_MIN_INTERVAL_MS); // in 1.25ms units + gap_conn_params.max_conn_interval = msec_to_1_25msec(CFG_GAP_CONNECTION_MAX_INTERVAL_MS); // in 1.25ms unit + gap_conn_params.slave_latency = CFG_GAP_CONNECTION_SLAVE_LATENCY; + gap_conn_params.conn_sup_timeout = CFG_GAP_CONNECTION_SUPERVISION_TIMEOUT_MS / 10; // in 10ms unit + + ble_gap_conn_sec_mode_t sec_mode; + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); // no security is needed + + ASSERT_STATUS( sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *) CFG_GAP_LOCAL_NAME, strlen(CFG_GAP_LOCAL_NAME))); + ASSERT_STATUS( sd_ble_gap_appearance_set(CFG_GAP_APPEARANCE)); + ASSERT_STATUS( sd_ble_gap_ppcp_set(&gap_conn_params)); + ASSERT_STATUS( sd_ble_gap_tx_power_set(CFG_BLE_TX_POWER_LEVEL)); + + /** + * Call to conn_params_init() is not necessary; and so is disabled by default. + * This API should be exposed to the user to be invoked when necessary. + */ +#if SDK_CONN_PARAMS_MODULE_ENABLE + /* Connection Parameters */ + enum { + FIRST_UPDATE_DELAY = APP_TIMER_TICKS(5000, CFG_TIMER_PRESCALER), + NEXT_UPDATE_DELAY = APP_TIMER_TICKS(5000, CFG_TIMER_PRESCALER), + MAX_UPDATE_COUNT = 3 + }; + + ble_conn_params_init_t cp_init = {0}; + + cp_init.p_conn_params = NULL; + cp_init.first_conn_params_update_delay = FIRST_UPDATE_DELAY; + cp_init.next_conn_params_update_delay = NEXT_UPDATE_DELAY; + cp_init.max_conn_params_update_count = MAX_UPDATE_COUNT; + cp_init.start_on_notify_cccd_handle = BLE_GATT_HANDLE_INVALID; + cp_init.disconnect_on_fail = true; + cp_init.evt_handler = NULL; + cp_init.error_handler = error_callback; + + ASSERT_STATUS ( ble_conn_params_init(&cp_init)); +#endif // SDK_CONN_PARAMS_MODULE_ENABLE + + return ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Converts msecs to an integer representing 1.25ms units + + @param[in] ms + The number of milliseconds to conver to 1.25ms units + + @returns The number of 1.25ms units in the supplied number of ms +*/ +/**************************************************************************/ +static inline uint32_t msec_to_1_25msec(uint32_t interval_ms) +{ + return (interval_ms * 4) / 5; +} + +#if SDK_CONN_PARAMS_MODULE_ENABLE +static void error_callback(uint32_t nrf_error) +{ + ASSERT_STATUS_RET_VOID( nrf_error ); +} +#endif // SDK_CONN_PARAMS_MODULE_ENABLE diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_gap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_gap.h new file mode 100644 index 0000000000..828da3cd78 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_gap.h @@ -0,0 +1,24 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BTLE_GAP_H_ +#define _BTLE_GAP_H_ + +#include "common/common.h" + +error_t btle_gap_init(void); + +#endif // ifndef _BTLE_GAP_H_ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.cpp new file mode 100644 index 0000000000..389c9b5c4c --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.cpp @@ -0,0 +1,326 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#if defined(S110) +#include "btle.h" + +#include "nRF5xn.h" + +extern "C" { +#include "pstorage.h" +#include "device_manager.h" +#include "id_manager.h" +} + +#include "btle_security.h" + +static dm_application_instance_t applicationInstance; +static bool initialized = false; +static ret_code_t dm_handler(dm_handle_t const *p_handle, dm_event_t const *p_event, ret_code_t event_result); + +// default security parameters. Avoid "holes" between member assigments in order to compile by gcc++11. +static ble_gap_sec_params_t securityParameters = { + .bond = true, /**< Perform bonding. */ + .mitm = true, /**< Man In The Middle protection required. */ + .lesc = false, /**< Enable LE Secure Connection pairing. */ + .keypress = false, /**< Enable generation of keypress notifications. */ + .io_caps = SecurityManager::IO_CAPS_NONE, /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */ + .oob = 0, /**< Out Of Band data available. */ + .min_key_size = 16, /**< Minimum encryption key size in octets between 7 and 16. If 0 then not applicable in this instance. */ + .max_key_size = 16, /**< Maximum encryption key size in octets between min_key_size and 16. */ + .kdist_own = { + .enc = 0, /**< Long Term Key and Master Identification. */ + .id = 0, /**< Identity Resolving Key and Identity Address Information. */ + .sign = 0, /**< Connection Signature Resolving Key. */ + .link = 0 /**< Derive the Link Key from the LTK. */ + }, /**< Key distribution bitmap: keys that the local device will distribute. */ + .kdist_peer = { + .enc = 1, /**< Long Term Key and Master Identification. */ + .id = 1, /**< Identity Resolving Key and Identity Address Information. */ + .sign = 1, /**< Connection Signature Resolving Key. */ + .link = 0 /**< Derive the Link Key from the LTK. */ + } /**< Key distribution bitmap: keys that the peripheral device will distribute. */ +}; + +bool +btle_hasInitializedSecurity(void) +{ + return initialized; +} + +ble_error_t +btle_initializeSecurity(bool enableBonding, + bool requireMITM, + SecurityManager::SecurityIOCapabilities_t iocaps, + const SecurityManager::Passkey_t passkey) +{ + /* guard against multiple initializations */ + if (initialized) { + return BLE_ERROR_NONE; + } + + if (pstorage_init() != NRF_SUCCESS) { + return BLE_ERROR_UNSPECIFIED; + } + + ret_code_t rc; + if (passkey) { + ble_opt_t opts; + opts.gap_opt.passkey.p_passkey = const_cast(passkey); + if ((rc = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &opts)) != NRF_SUCCESS) { + switch (rc) { + case BLE_ERROR_INVALID_CONN_HANDLE: + case NRF_ERROR_INVALID_ADDR: + case NRF_ERROR_INVALID_PARAM: + default: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + } + } + } + + dm_init_param_t dm_init_param = { + .clear_persistent_data = false /* Set to true in case the module should clear all persistent data. */ + }; + if (dm_init(&dm_init_param) != NRF_SUCCESS) { + return BLE_ERROR_UNSPECIFIED; + } + + // update default security parameters with function call parameters + securityParameters.bond = enableBonding; + securityParameters.mitm = requireMITM; + securityParameters.io_caps = iocaps; + + const dm_application_param_t dm_param = { + .evt_handler = dm_handler, + .service_type = DM_PROTOCOL_CNTXT_GATT_CLI_ID, + .sec_param = securityParameters + }; + + if ((rc = dm_register(&applicationInstance, &dm_param)) != NRF_SUCCESS) { + switch (rc) { + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + case NRF_ERROR_NO_MEM: + return BLE_ERROR_NO_MEM; + default: + return BLE_ERROR_UNSPECIFIED; + } + } + + initialized = true; + return BLE_ERROR_NONE; +} + +ble_error_t +btle_purgeAllBondingState(void) +{ + ret_code_t rc; + if ((rc = dm_device_delete_all(&applicationInstance)) == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } + + switch (rc) { + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + case NRF_ERROR_NO_MEM: + return BLE_ERROR_NO_MEM; + default: + return BLE_ERROR_UNSPECIFIED; + } +} + +ble_error_t +btle_getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP) +{ + ret_code_t rc; + dm_handle_t dmHandle = { + .appl_id = applicationInstance, + }; + if ((rc = dm_handle_get(connectionHandle, &dmHandle)) != NRF_SUCCESS) { + if (rc == NRF_ERROR_NOT_FOUND) { + return BLE_ERROR_INVALID_PARAM; + } else { + return BLE_ERROR_UNSPECIFIED; + } + } + + if ((rc = dm_security_status_req(&dmHandle, reinterpret_cast(securityStatusP))) != NRF_SUCCESS) { + switch (rc) { + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + case NRF_ERROR_NO_MEM: + return BLE_ERROR_NO_MEM; + default: + return BLE_ERROR_UNSPECIFIED; + } + } + + return BLE_ERROR_NONE; +} + +ble_error_t +btle_setLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::SecurityMode_t securityMode) +{ + // use default and updated parameters as starting point + // and modify structure based on security mode. + ble_gap_sec_params_t params = securityParameters; + + switch (securityMode) { + case SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK: + /**< Require no protection, open link. */ + securityParameters.bond = false; + securityParameters.mitm = false; + break; + + case SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM: + /**< Require encryption, but no MITM protection. */ + securityParameters.bond = true; + securityParameters.mitm = false; + break; + + // not yet implemented security modes + case SecurityManager::SECURITY_MODE_NO_ACCESS: + case SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM: + /**< Require encryption and MITM protection. */ + case SecurityManager::SECURITY_MODE_SIGNED_NO_MITM: + /**< Require signing or encryption, but no MITM protection. */ + case SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM: + /**< Require signing or encryption, and MITM protection. */ + default: + return BLE_ERROR_NOT_IMPLEMENTED; + } + + // update security settings for given connection + uint32_t result = sd_ble_gap_authenticate(connectionHandle, ¶ms); + + if (result == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } else { + return BLE_ERROR_UNSPECIFIED; + } +} + +ret_code_t +dm_handler(dm_handle_t const *p_handle, dm_event_t const *p_event, ret_code_t event_result) +{ + nRF5xn &ble = nRF5xn::Instance(BLE::DEFAULT_INSTANCE); + nRF5xSecurityManager &securityManager = (nRF5xSecurityManager &) ble.getSecurityManager(); + + switch (p_event->event_id) { + case DM_EVT_SECURITY_SETUP: /* started */ { + const ble_gap_sec_params_t *peerParams = &p_event->event_param.p_gap_param->params.sec_params_request.peer_params; + securityManager.processSecuritySetupInitiatedEvent(p_event->event_param.p_gap_param->conn_handle, + peerParams->bond, + peerParams->mitm, + (SecurityManager::SecurityIOCapabilities_t)peerParams->io_caps); + break; + } + case DM_EVT_SECURITY_SETUP_COMPLETE: + securityManager. + processSecuritySetupCompletedEvent(p_event->event_param.p_gap_param->conn_handle, + (SecurityManager::SecurityCompletionStatus_t)(p_event->event_param.p_gap_param->params.auth_status.auth_status)); + break; + case DM_EVT_LINK_SECURED: { + unsigned securityMode = p_event->event_param.p_gap_param->params.conn_sec_update.conn_sec.sec_mode.sm; + unsigned level = p_event->event_param.p_gap_param->params.conn_sec_update.conn_sec.sec_mode.lv; + SecurityManager::SecurityMode_t resolvedSecurityMode = SecurityManager::SECURITY_MODE_NO_ACCESS; + switch (securityMode) { + case 1: + switch (level) { + case 1: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK; + break; + case 2: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM; + break; + case 3: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM; + break; + } + break; + case 2: + switch (level) { + case 1: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_SIGNED_NO_MITM; + break; + case 2: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM; + break; + } + break; + } + + securityManager.processLinkSecuredEvent(p_event->event_param.p_gap_param->conn_handle, resolvedSecurityMode); + break; + } + case DM_EVT_DEVICE_CONTEXT_STORED: + securityManager.processSecurityContextStoredEvent(p_event->event_param.p_gap_param->conn_handle); + break; + default: + break; + } + + return NRF_SUCCESS; +} + +ble_error_t +btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist) +{ + if (!btle_hasInitializedSecurity()) { + return BLE_ERROR_INITIALIZATION_INCOMPLETE; + } + ret_code_t err = dm_whitelist_create(&applicationInstance, p_whitelist); + if (err == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } else if (err == NRF_ERROR_NULL) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } else { + return BLE_ERROR_INVALID_STATE; + } +} + + +bool +btle_matchAddressAndIrk(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk) +{ + /* + * Use a helper function from the Nordic SDK to test whether the BLE + * address can be generated using the IRK. + */ + return im_address_resolve(p_addr, p_irk); +} + +void +btle_generateResolvableAddress(const ble_gap_irk_t &irk, ble_gap_addr_t &address) +{ + /* Set type to resolvable */ + address.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE; + + /* + * Assign a random number to the most significant 3 bytes + * of the address. + */ + address.addr[BLE_GAP_ADDR_LEN - 3] = 0x8E; + address.addr[BLE_GAP_ADDR_LEN - 2] = 0x4F; + address.addr[BLE_GAP_ADDR_LEN - 1] = 0x7C; + + /* Calculate the hash and store it in the top half of the address */ + ah(irk.irk, &address.addr[BLE_GAP_ADDR_LEN - 3], address.addr); +} +#endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.h new file mode 100644 index 0000000000..4f863975ab --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.h @@ -0,0 +1,128 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BTLE_SECURITY_H_ +#define _BTLE_SECURITY_H_ + +#include "ble/Gap.h" +#include "ble/SecurityManager.h" + +/** + * Function to test whether the SecurityManager has been initialized. + * Possible by a call to @ref btle_initializeSecurity(). + * + * @return True if the SecurityManager was previously initialized, false + * otherwise. + */ +bool btle_hasInitializedSecurity(void); + +/** + * Enable Nordic's Device Manager, which brings in functionality from the + * stack's Security Manager. The Security Manager implements the actual + * cryptographic algorithms and protocol exchanges that allow two devices to + * securely exchange data and privately detect each other. + * + * @param[in] enableBonding Allow for bonding. + * @param[in] requireMITM Require protection for man-in-the-middle attacks. + * @param[in] iocaps To specify IO capabilities of this peripheral, + * such as availability of a display or keyboard to + * support out-of-band exchanges of security data. + * @param[in] passkey To specify a static passkey. + * + * @return BLE_ERROR_NONE on success. + */ +ble_error_t btle_initializeSecurity(bool enableBonding = true, + bool requireMITM = true, + SecurityManager::SecurityIOCapabilities_t iocaps = SecurityManager::IO_CAPS_NONE, + const SecurityManager::Passkey_t passkey = NULL); + +/** + * Get the security status of a link. + * + * @param[in] connectionHandle + * Handle to identify the connection. + * @param[out] securityStatusP + * security status. + * + * @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure. + */ +ble_error_t btle_getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP); + +/** + * Set the security mode on a connection. Useful for elevating the security mode + * once certain conditions are met, e.g., a particular service is found. + * + * @param[in] connectionHandle + * Handle to identify the connection. + * @param[in] securityMode + * security mode. + * + * @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure. + */ +ble_error_t btle_setLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::SecurityMode_t securityMode); + +/** + * Function for deleting all peer device context and all related bonding + * information from the database. + * + * @retval BLE_ERROR_NONE On success, else an error code indicating reason for failure. + * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + */ +ble_error_t btle_purgeAllBondingState(void); + +/** + * Query the SoftDevice bond table to extract a whitelist containing the BLE + * addresses and IRKs of bonded devices. + * + * @param[in/out] p_whitelist + * (on input) p_whitelist->addr_count and + * p_whitelist->irk_count specify the maximum number of + * addresses and IRKs added to the whitelist structure. + * (on output) *p_whitelist is a whitelist containing the + * addresses and IRKs of the bonded devices. + * + * @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure. + */ +ble_error_t btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist); + +/** + * Function to test whether a BLE address is generated using an IRK. + * + * @param[in] p_addr + * Pointer to a BLE address. + * @param[in] p_irk + * Pointer to an IRK. + * + * @return True if p_addr can be generated using p_irk, false otherwise. + */ +bool btle_matchAddressAndIrk(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk); + +/** + * Function to generate a private resolvable BLE address. + * + * @param[out] p_addr + * The output address. + * @param[in] p_irk + * A reference to a IRK. + * + * @note This function does not generate a secure address since the prand number in the + * resolvable address is not truly random. Therefore, the output of this function + * is only meant to be used by the application internally but never exported. + */ +void btle_generateResolvableAddress(const ble_gap_irk_t &irk, ble_gap_addr_t &address); + +#endif /* _BTLE_SECURITY_H_ */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp new file mode 100644 index 0000000000..e29002d07a --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp @@ -0,0 +1,440 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(S130) || defined(S132) +#include "btle.h" + +#include "nRF5xn.h" + +extern "C" { +#include "peer_manager.h" +#include "id_manager.h" +#include "fds.h" +} + +#include "btle_security.h" + +static bool initialized = false; + +static void pm_handler(pm_evt_t const *p_event); +static bool _enc_in_progress = false; // helper flag for distinguish between state of link connected and link connected in progres of encryption establishing. +volatile static uint32_t async_ret_code; // busy loop support variable for asyncronous API. + +// default security parameters. Avoid "holes" between member assigments in order to compile by gcc++11. +static ble_gap_sec_params_t securityParameters = { + .bond = true, /**< Perform bonding. */ + .mitm = true, /**< Man In The Middle protection required. */ + .lesc = false, /**< Enable LE Secure Connection pairing. */ + .keypress = false, /**< Enable generation of keypress notifications. */ + .io_caps = SecurityManager::IO_CAPS_NONE, /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */ + .oob = 0, /**< Out Of Band data available. */ + .min_key_size = 16, /**< Minimum encryption key size in octets between 7 and 16. If 0 then not applicable in this instance. */ + .max_key_size = 16, /**< Maximum encryption key size in octets between min_key_size and 16. */ + .kdist_own = { + .enc = 0, /**< Long Term Key and Master Identification. */ + .id = 0, /**< Identity Resolving Key and Identity Address Information. */ + .sign = 0, /**< Connection Signature Resolving Key. */ + .link = 0 /**< Derive the Link Key from the LTK. */ + }, /**< Key distribution bitmap: keys that the local device will distribute. */ + .kdist_peer = { + .enc = 1, /**< Long Term Key and Master Identification. */ + .id = 1, /**< Identity Resolving Key and Identity Address Information. */ + .sign = 0, /**< Connection Signature Resolving Key. */ + .link = 0 /**< Derive the Link Key from the LTK. */ + } /**< Key distribution bitmap: keys that the peripheral device will distribute. */ +}; + +bool +btle_hasInitializedSecurity(void) +{ + return initialized; +} + + +ble_error_t +btle_initializeSecurity(bool enableBonding, + bool requireMITM, + SecurityManager::SecurityIOCapabilities_t iocaps, + const SecurityManager::Passkey_t passkey) +{ + /* guard against multiple initializations */ + if (initialized) { + return BLE_ERROR_NONE; + } + + ret_code_t rc; + if (passkey) { + ble_opt_t opts; + opts.gap_opt.passkey.p_passkey = const_cast(passkey); + if ((rc = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &opts)) != NRF_SUCCESS) { + switch (rc) { + case BLE_ERROR_INVALID_CONN_HANDLE: + case NRF_ERROR_INVALID_ADDR: + case NRF_ERROR_INVALID_PARAM: + default: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + } + } + } + + if (pm_init() != NRF_SUCCESS) { + return BLE_ERROR_UNSPECIFIED; + } + + // update default security parameters with function call parameters + securityParameters.bond = enableBonding; + securityParameters.mitm = requireMITM; + securityParameters.io_caps = iocaps; + + if (enableBonding) { + securityParameters.kdist_own.enc = 1; + securityParameters.kdist_own.id = 1; + } else { + securityParameters.kdist_own.enc = 0; + securityParameters.kdist_own.id = 0; + } + rc = pm_sec_params_set(&securityParameters); + + if (rc == NRF_SUCCESS) { + rc = pm_register(pm_handler); + } + + switch (rc) { + case NRF_SUCCESS: + initialized = true; + return BLE_ERROR_NONE; + + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + + case NRF_ERROR_INVALID_PARAM: + return BLE_ERROR_INVALID_PARAM; + + default: + return BLE_ERROR_UNSPECIFIED; + } + + + initialized = true; + return BLE_ERROR_NONE; +} + +ble_error_t +btle_purgeAllBondingState(void) +{ + ret_code_t rc; + + async_ret_code = NRF_ERROR_BUSY; + + rc = pm_peers_delete(); // it is asynhronous API + + if (rc == NRF_SUCCESS) + { + // waiting for respond from pm_handler + while (async_ret_code == NRF_ERROR_BUSY) { + // busy-loop + } + + rc = async_ret_code; + } + + switch (rc) { + case NRF_SUCCESS: + return BLE_ERROR_NONE; + + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + + default: + return BLE_ERROR_UNSPECIFIED; + } +} + +ble_error_t +btle_getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP) +{ + ret_code_t rc; + pm_conn_sec_status_t conn_sec_status; + + rc = pm_conn_sec_status_get(connectionHandle, &conn_sec_status); + + if (rc == NRF_SUCCESS) + { + if (conn_sec_status.encrypted) { + *securityStatusP = SecurityManager::ENCRYPTED; + } + else if (conn_sec_status.connected) { + if (_enc_in_progress) { + *securityStatusP = SecurityManager::ENCRYPTION_IN_PROGRESS; + } + else { + *securityStatusP = SecurityManager::NOT_ENCRYPTED; + } + } + + return BLE_ERROR_NONE; + } + + switch (rc) { + case BLE_ERROR_INVALID_CONN_HANDLE: + return BLE_ERROR_INVALID_PARAM; + + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + + default: + return BLE_ERROR_UNSPECIFIED; + } +} + +ble_error_t +btle_setLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::SecurityMode_t securityMode) +{ + // use default and updated parameters as starting point + // and modify structure based on security mode. + ret_code_t rc; + + switch (securityMode) { + case SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK: + /**< Require no protection, open link. */ + securityParameters.bond = false; + securityParameters.mitm = false; + securityParameters.kdist_own.enc = 0; + break; + + case SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM: + /**< Require encryption, but no MITM protection. */ + securityParameters.bond = true; + securityParameters.mitm = false; + securityParameters.kdist_own.enc = 1; + break; + + // not yet implemented security modes + case SecurityManager::SECURITY_MODE_NO_ACCESS: + case SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM: + /**< Require encryption and MITM protection. */ + case SecurityManager::SECURITY_MODE_SIGNED_NO_MITM: + /**< Require signing or encryption, but no MITM protection. */ + case SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM: + /**< Require signing or encryption, and MITM protection. */ + default: + return BLE_ERROR_NOT_IMPLEMENTED; + } + + // update security settings for given connection + + rc = pm_sec_params_set(&securityParameters); + + if (rc == NRF_SUCCESS) { + rc = pm_conn_secure(connectionHandle, false); + } + + switch (rc) { + case NRF_SUCCESS: + initialized = true; + return BLE_ERROR_NONE; + + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + + case NRF_ERROR_INVALID_PARAM: + return BLE_ERROR_INVALID_PARAM; + + default: + return BLE_ERROR_UNSPECIFIED; + } +} + + +void pm_handler(pm_evt_t const *p_event) +{ + nRF5xn &ble = nRF5xn::Instance(BLE::DEFAULT_INSTANCE); + nRF5xSecurityManager &securityManager = (nRF5xSecurityManager &) ble.getSecurityManager(); + ret_code_t err_code; + SecurityManager::SecurityMode_t resolvedSecurityMode; + + switch (p_event->evt_id) { + case PM_EVT_CONN_SEC_START: /* started */ { + const ble_gap_sec_params_t *peerParams = &securityParameters; + securityManager.processSecuritySetupInitiatedEvent(p_event->conn_handle, + peerParams->bond, + peerParams->mitm, + (SecurityManager::SecurityIOCapabilities_t)peerParams->io_caps); + _enc_in_progress = true; + break; + } + case PM_EVT_CONN_SEC_SUCCEEDED: + // Update the rank of the peer. + if (p_event->params.conn_sec_succeeded.procedure == PM_LINK_SECURED_PROCEDURE_BONDING) + { + err_code = pm_peer_rank_highest(p_event->peer_id); + } + + securityManager. + processSecuritySetupCompletedEvent(p_event->conn_handle, + SecurityManager::SEC_STATUS_SUCCESS);// SEC_STATUS_SUCCESS of SecurityCompletionStatus_t + + ble_gap_conn_sec_t conn_sec; + sd_ble_gap_conn_sec_get(p_event->conn_handle, &conn_sec); + + resolvedSecurityMode = SecurityManager::SECURITY_MODE_NO_ACCESS; + + switch (conn_sec.sec_mode.sm) { + case 1: + switch (conn_sec.sec_mode.lv) { + case 1: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK; + break; + case 2: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM; + break; + case 3: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM; + break; + } + break; + case 2: + switch (conn_sec.sec_mode.lv) { + case 1: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_SIGNED_NO_MITM; + break; + case 2: + resolvedSecurityMode = SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM; + break; + } + break; + } + + securityManager.processLinkSecuredEvent(p_event->conn_handle, resolvedSecurityMode); + + _enc_in_progress = false; + break; + + case PM_EVT_CONN_SEC_FAILED: + SecurityManager::SecurityCompletionStatus_t securityCompletionStatus; + + if ((uint32_t)p_event->params.conn_sec_failed.error >= PM_CONN_SEC_ERROR_BASE ) { + securityCompletionStatus = SecurityManager::SEC_STATUS_UNSPECIFIED; + } else { + securityCompletionStatus = + (SecurityManager::SecurityCompletionStatus_t)p_event->params.conn_sec_failed.error; + } + + securityManager. + processSecuritySetupCompletedEvent(p_event->conn_handle, securityCompletionStatus); + + _enc_in_progress = false; + break; + + case PM_EVT_BONDED_PEER_CONNECTED: + pm_peer_rank_highest(p_event->peer_id); + break; + + case PM_EVT_PEER_DATA_UPDATE_SUCCEEDED: + if (p_event->params.peer_data_update_succeeded.action == PM_PEER_DATA_OP_UPDATE) + { + securityManager.processSecurityContextStoredEvent(p_event->conn_handle); + } + break; + + case PM_EVT_PEER_DATA_UPDATE_FAILED: + break; + + case PM_EVT_PEERS_DELETE_SUCCEEDED: + async_ret_code = NRF_SUCCESS; // respond SUCCESS to the busy-loop in f. btle_purgeAllBondingState + break; + + case PM_EVT_PEERS_DELETE_FAILED: + async_ret_code = NRF_ERROR_INTERNAL; // respond FAILURE to the busy-loop in f. btle_purgeAllBondingState + break; + + case PM_EVT_STORAGE_FULL: + // Run garbage collection on the flash. + err_code = fds_gc(); + if (err_code == FDS_ERR_BUSY || err_code == FDS_ERR_NO_SPACE_IN_QUEUES) + { + // Retry. + } + else + { + APP_ERROR_CHECK(err_code); + } + break;//PM_EVT_STORAGE_FULL + + case PM_EVT_CONN_SEC_CONFIG_REQ:{ + // A connected peer (central) is trying to pair, but the Peer Manager already has a bond + // for that peer. Setting allow_repairing to false rejects the pairing request. + // If this event is ignored (pm_conn_sec_config_reply is not called in the event + // handler), the Peer Manager assumes allow_repairing to be false. + pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true}; + pm_conn_sec_config_reply(p_event->conn_handle, &conn_sec_config); + } + break;//PM_EVT_CONN_SEC_CONFIG_REQ + + default: + break; + } +} + +ble_error_t +btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist) +{ + if (!btle_hasInitializedSecurity()) { + return BLE_ERROR_INITIALIZATION_INCOMPLETE; + } + ret_code_t err = pm_whitelist_create( NULL, BLE_GAP_WHITELIST_ADDR_MAX_COUNT, p_whitelist); + if (err == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } else if (err == NRF_ERROR_NULL) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } else { + return BLE_ERROR_INVALID_STATE; + } +} + + +bool +btle_matchAddressAndIrk(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk) +{ + /* + * Use a helper function from the Nordic SDK to test whether the BLE + * address can be generated using the IRK. + */ + return im_address_resolve(p_addr, p_irk); +} + +void +btle_generateResolvableAddress(const ble_gap_irk_t &irk, ble_gap_addr_t &address) +{ + /* Set type to resolvable */ + address.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE; + + /* + * Assign a random number to the most significant 3 bytes + * of the address. + */ + address.addr[BLE_GAP_ADDR_LEN - 3] = 0x8E; + address.addr[BLE_GAP_ADDR_LEN - 2] = 0x4F; + address.addr[BLE_GAP_ADDR_LEN - 1] = 0x7C; + + /* Calculate the hash and store it in the top half of the address */ + ah(irk.irk, &address.addr[BLE_GAP_ADDR_LEN - 3], address.addr); +} +#endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.cpp new file mode 100644 index 0000000000..2a8e600c0a --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.cpp @@ -0,0 +1,364 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "custom_helper.h" + +/* + * The current version of the soft-device doesn't handle duplicate 128-bit UUIDs + * very well. It is therefore necessary to filter away duplicates before + * passing long UUIDs to sd_ble_uuid_vs_add(). The following types and data + * structures involved in maintaining a local cache of 128-bit UUIDs. + */ +typedef struct { + UUID::LongUUIDBytes_t uuid; + uint8_t type; +} converted_uuid_table_entry_t; + +static unsigned uuidTableEntries = 0; /* current usage of the table */ +converted_uuid_table_entry_t convertedUUIDTable[UUID_TABLE_MAX_ENTRIES]; + +void custom_reset_128bits_uuid_table() { + uuidTableEntries = 0; +} + +/** + * lookup the cache of previously converted 128-bit UUIDs to find a type value. + * @param uuid base 128-bit UUID + * @param recoveredType the type field of the 3-byte nRF's uuid. + * @return true if a match is found. + */ +static bool +lookupConvertedUUIDTable(const UUID::LongUUIDBytes_t uuid, uint8_t *recoveredType) +{ + unsigned i; + for (i = 0; i < uuidTableEntries; i++) { + unsigned byteIndex; + for (byteIndex = 0; byteIndex < UUID::LENGTH_OF_LONG_UUID; byteIndex++) { + /* Skip bytes 2 and 3, because they contain the shortUUID (16-bit) version of the + * long UUID; and we're comparing against the remainder. */ + if ((byteIndex == 2) || (byteIndex == 3)) { + continue; + } + + if (convertedUUIDTable[i].uuid[byteIndex] != uuid[byteIndex]) { + break; + } + } + + if (byteIndex == UUID::LENGTH_OF_LONG_UUID) { + *recoveredType = convertedUUIDTable[i].type; + return true; + } + } + + return false; +} + +static void +addToConvertedUUIDTable(const UUID::LongUUIDBytes_t uuid, uint8_t type) +{ + if (uuidTableEntries == UUID_TABLE_MAX_ENTRIES) { + return; /* recovery needed; or at least the user should be warned about this fact.*/ + } + + memcpy(convertedUUIDTable[uuidTableEntries].uuid, uuid, UUID::LENGTH_OF_LONG_UUID); + convertedUUIDTable[uuidTableEntries].uuid[2] = 0; + convertedUUIDTable[uuidTableEntries].uuid[3] = 0; + convertedUUIDTable[uuidTableEntries].type = type; + uuidTableEntries++; +} + +/** + * The nRF transport has its own 3-byte representation of a UUID. If the user- + * specified UUID is 128-bits wide, then the UUID base needs to be added to the + * soft-device and converted to a 3-byte handle before being used further. This + * function is responsible for this translation of user-specified UUIDs into + * nRF's representation. + * + * @param[in] uuid + * user-specified UUID + * @return nRF + * 3-byte UUID (containing a type and 16-bit UUID) representation + * to be used with SVC calls. + */ +ble_uuid_t custom_convert_to_nordic_uuid(const UUID &uuid) +{ + ble_uuid_t nordicUUID; + nordicUUID.uuid = uuid.getShortUUID(); + nordicUUID.type = BLE_UUID_TYPE_UNKNOWN; /* to be set below */ + + if (uuid.shortOrLong() == UUID::UUID_TYPE_SHORT) { + nordicUUID.type = BLE_UUID_TYPE_BLE; + } else { + if (!lookupConvertedUUIDTable(uuid.getBaseUUID(), &nordicUUID.type)) { + nordicUUID.type = custom_add_uuid_base(uuid.getBaseUUID()); + addToConvertedUUIDTable(uuid.getBaseUUID(), nordicUUID.type); + } + } + + return nordicUUID; +} + +/**************************************************************************/ +/*! + @brief Adds the base UUID to the custom service. All UUIDs used + by this service are based on this 128-bit UUID. + + @note This UUID needs to be added to the SoftDevice stack before + adding the service's primary service via + 'sd_ble_gatts_service_add' + + @param[in] p_uuid_base A pointer to the 128-bit UUID array (8*16) + + @returns The UUID type. + A return value of 0 should be considered an error. + + @retval 0x00 BLE_UUID_TYPE_UNKNOWN + @retval 0x01 BLE_UUID_TYPE_BLE + @retval 0x02 BLE_UUID_TYPE_VENDOR_BEGIN + + @section EXAMPLE + @code + + // Take note that bytes 2/3 are blank since these are used to identify + // the primary service and individual characteristics + #define CFG_CUSTOM_UUID_BASE "\x6E\x40\x00\x00\xB5\xA3\xF3\x93\xE0\xA9\xE5\x0E\x24\xDC\xCA\x9E" + + uint8_t uuid_type = custom_add_uuid_base(CFG_CUSTOM_UUID_BASE); + ASSERT(uuid_type > 0, ERROR_NOT_FOUND); + + // We can now safely add the primary service and any characteristics + // for our custom service ... + + @endcode +*/ +/**************************************************************************/ +uint8_t custom_add_uuid_base(uint8_t const *const p_uuid_base) +{ + ble_uuid128_t base_uuid; + uint8_t uuid_type = 0; + + for (unsigned i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) { + base_uuid.uuid128[i] = p_uuid_base[i]; + } + + ASSERT_INT( ERROR_NONE, sd_ble_uuid_vs_add( &base_uuid, &uuid_type ), 0); + + return uuid_type; +} + +/**************************************************************************/ +/*! + +*/ +/**************************************************************************/ +error_t custom_decode_uuid_base(uint8_t const *const p_uuid_base, + ble_uuid_t *p_uuid) +{ + UUID::LongUUIDBytes_t uuid_base_le; + + for (uint8_t i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) { + uuid_base_le[i] = p_uuid_base[i]; + } + + ASSERT_STATUS( sd_ble_uuid_decode(UUID::LENGTH_OF_LONG_UUID, uuid_base_le, p_uuid)); + + return ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Adds a new characteristic to the custom service, assigning + properties, a UUID add-on value, etc. + + @param[in] service_handle + @param[in] p_uuid The 16-bit value to add to the base UUID + for this characteristic (normally >1 + since 1 is typically used by the primary + service). + @param[in] char_props The characteristic properties, as + defined by ble_gatt_char_props_t + @param[in] max_length The maximum length of this characeristic + @param[in] has_variable_len Whether the characteristic data has + variable length. + @param[out] p_char_handle + + @returns + @retval ERROR_NONE Everything executed normally +*/ +/**************************************************************************/ +error_t custom_add_in_characteristic(uint16_t service_handle, + ble_uuid_t *p_uuid, + uint8_t properties, + SecurityManager::SecurityMode_t requiredSecurity, + uint8_t *p_data, + uint16_t length, + uint16_t max_length, + bool has_variable_len, + const uint8_t *userDescriptionDescriptorValuePtr, + uint16_t userDescriptionDescriptorValueLen, + bool readAuthorization, + bool writeAuthorization, + ble_gatts_char_handles_t *p_char_handle) +{ + /* Characteristic metadata */ + ble_gatts_attr_md_t cccd_md; + ble_gatt_char_props_t char_props; + + memcpy(&char_props, &properties, 1); + + if (char_props.notify || char_props.indicate) { + /* Notification requires cccd */ + memclr_( &cccd_md, sizeof(ble_gatts_attr_md_t)); + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); + } + + ble_gatts_char_md_t char_md = {0}; + + char_md.char_props = char_props; + char_md.p_cccd_md = + (char_props.notify || char_props.indicate) ? &cccd_md : NULL; + if ((userDescriptionDescriptorValueLen > 0) && (userDescriptionDescriptorValuePtr != NULL)) { + char_md.p_char_user_desc = const_cast(userDescriptionDescriptorValuePtr); + char_md.char_user_desc_max_size = userDescriptionDescriptorValueLen; + char_md.char_user_desc_size = userDescriptionDescriptorValueLen; + } + + /* Attribute declaration */ + ble_gatts_attr_md_t attr_md = {0}; + + attr_md.rd_auth = readAuthorization; + attr_md.wr_auth = writeAuthorization; + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + /* Always set variable size */ + attr_md.vlen = has_variable_len; + + if (char_props.read || char_props.notify || char_props.indicate) { + switch (requiredSecurity) { + case SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK : + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); + break; + case SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM : + BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.read_perm); + break; + case SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM : + BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&attr_md.read_perm); + break; + case SecurityManager::SECURITY_MODE_SIGNED_NO_MITM : + BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(&attr_md.read_perm); + break; + case SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM : + BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(&attr_md.read_perm); + break; + default: + break; + }; + } + + if (char_props.write || char_props.write_wo_resp) { + switch (requiredSecurity) { + case SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK : + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); + break; + case SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM : + BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.write_perm); + break; + case SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM : + BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&attr_md.write_perm); + break; + case SecurityManager::SECURITY_MODE_SIGNED_NO_MITM : + BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(&attr_md.write_perm); + break; + case SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM : + BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(&attr_md.write_perm); + break; + default: + break; + }; + } + + ble_gatts_attr_t attr_char_value = {0}; + + attr_char_value.p_uuid = p_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = length; + attr_char_value.max_len = max_length; + attr_char_value.p_value = p_data; + + ASSERT_STATUS ( sd_ble_gatts_characteristic_add(service_handle, + &char_md, + &attr_char_value, + p_char_handle)); + + return ERROR_NONE; +} + + + +/**************************************************************************/ +/*! + @brief Adds a new descriptor to the custom service, assigning + value, a UUID add-on value, etc. + + @param[in] char_handle + @param[in] p_uuid The 16-bit value to add to the base UUID + for this descriptor (normally >1 + since 1 is typically used by the primary + service). + @param[in] max_length The maximum length of this descriptor + @param[in] has_variable_len Whether the characteristic data has + variable length. + + @returns + @retval ERROR_NONE Everything executed normally +*/ +/**************************************************************************/ +error_t custom_add_in_descriptor(uint16_t char_handle, + ble_uuid_t *p_uuid, + uint8_t *p_data, + uint16_t length, + uint16_t max_length, + bool has_variable_len, + uint16_t *p_desc_handle) +{ + /* Descriptor metadata */ + ble_gatts_attr_md_t desc_md = {0}; + + desc_md.vloc = BLE_GATTS_VLOC_STACK; + /* Always set variable size */ + desc_md.vlen = has_variable_len; + + /* Make it readable and writable */ + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&desc_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&desc_md.write_perm); + + ble_gatts_attr_t attr_desc = {0}; + + attr_desc.p_uuid = p_uuid; + attr_desc.p_attr_md = &desc_md; + attr_desc.init_len = length; + attr_desc.max_len = max_length; + attr_desc.p_value = p_data; + + ASSERT_STATUS ( sd_ble_gatts_descriptor_add(char_handle, + &attr_desc, + p_desc_handle)); + + return ERROR_NONE; +} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h new file mode 100644 index 0000000000..658d10bfac --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h @@ -0,0 +1,71 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _CUSTOM_HELPER_H_ +#define _CUSTOM_HELPER_H_ + +#include "common/common.h" +#include "ble.h" +#include "ble/UUID.h" +#include "ble/GattCharacteristic.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define UUID_TABLE_MAX_ENTRIES (4) /* This is the maximum number of 128-bit UUIDs with distinct bases that + * we expect to be in use; increase this limit if needed. */ + +/** + * Reset the table of 128bits uuids. + * This table is used to keep track of vendors uuids added to the softdevice. + * It is important to reset it before disabling the softdevice otherwise the + * next time the softdevice will be enabled, this table will not be synchronmized + * with the softdevice table. + */ +void custom_reset_128bits_uuid_table(); +uint8_t custom_add_uuid_base(uint8_t const *const p_uuid_base); +error_t custom_decode_uuid(uint8_t const *const p_uuid_base, + ble_uuid_t *p_uuid); +ble_uuid_t custom_convert_to_nordic_uuid(const UUID &uuid); + +error_t custom_add_in_characteristic(uint16_t service_handle, + ble_uuid_t *p_uuid, + uint8_t properties, + SecurityManager::SecurityMode_t requiredSecurity, + uint8_t *p_data, + uint16_t length, + uint16_t max_length, + bool has_variable_len, + const uint8_t *userDescriptionDescriptorValuePtr, + uint16_t userDescriptionDescriptorValueLen, + bool readAuthorization, + bool writeAuthorization, + ble_gatts_char_handles_t *p_char_handle); + +error_t custom_add_in_descriptor(uint16_t char_handle, + ble_uuid_t *p_uuid, + uint8_t *p_data, + uint16_t length, + uint16_t max_length, + bool has_variable_len, + uint16_t *p_desc_handle); + +#ifdef __cplusplus +} +#endif + +#endif // ifndef _CUSTOM_HELPER_H_ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/ansi_escape.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/ansi_escape.h new file mode 100644 index 0000000000..392dedb44f --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/ansi_escape.h @@ -0,0 +1,103 @@ +/**************************************************************************/ +/*! + @file ansi_esc_code.h + @author hathach (tinyusb.org) + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, hathach (tinyusb.org) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This file is part of the tinyusb stack. +*/ +/**************************************************************************/ + +/** \file + * \brief TBD + * + * \note TBD + */ + +/** \ingroup TBD + * \defgroup TBD + * \brief TBD + * + * @{ + */ + +#ifndef _ANSI_ESC_CODE_H_ +#define _ANSI_ESC_CODE_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define CSI_CODE(seq) "\33[" seq +#define CSI_SGR(x) CSI_CODE(#x) "m" + +//------------- Cursor movement -------------// +#define ANSI_CURSOR_UP(n) CSI_CODE(#n "A") +#define ANSI_CURSOR_DOWN(n) CSI_CODE(#n "B") +#define ANSI_CURSOR_FORWARD(n) CSI_CODE(#n "C") +#define ANSI_CURSOR_BACKWARD(n) CSI_CODE(#n "D") +#define ANSI_CURSOR_LINE_DOWN(n) CSI_CODE(#n "E") +#define ANSI_CURSOR_LINE_UP(n) CSI_CODE(#n "F") +#define ANSI_CURSOR_POSITION(n, m) CSI_CODE(#n ";" #m "H") + +#define ANSI_ERASE_SCREEN(n) CSI_CODE(#n "J") +#define ANSI_ERASE_LINE(n) CSI_CODE(#n "K") + +/** text color */ +#define ANSI_TEXT_BLACK CSI_SGR(30) +#define ANSI_TEXT_RED CSI_SGR(31) +#define ANSI_TEXT_GREEN CSI_SGR(32) +#define ANSI_TEXT_YELLOW CSI_SGR(33) +#define ANSI_TEXT_BLUE CSI_SGR(34) +#define ANSI_TEXT_MAGENTA CSI_SGR(35) +#define ANSI_TEXT_CYAN CSI_SGR(36) +#define ANSI_TEXT_WHITE CSI_SGR(37) +#define ANSI_TEXT_DEFAULT CSI_SGR(39) + +/** background color */ +#define ANSI_BG_BLACK CSI_SGR(40) +#define ANSI_BG_RED CSI_SGR(41) +#define ANSI_BG_GREEN CSI_SGR(42) +#define ANSI_BG_YELLOW CSI_SGR(43) +#define ANSI_BG_BLUE CSI_SGR(44) +#define ANSI_BG_MAGENTA CSI_SGR(45) +#define ANSI_BG_CYAN CSI_SGR(46) +#define ANSI_BG_WHITE CSI_SGR(47) +#define ANSI_BG_DEFAULT CSI_SGR(49) + +#ifdef __cplusplus +} +#endif + +#endif /* _TUSB_ANSI_ESC_CODE_H_ */ + +/** @} */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/assertion.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/assertion.h new file mode 100644 index 0000000000..71bacb3e81 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/assertion.h @@ -0,0 +1,197 @@ +/**************************************************************************/ +/*! + @file assertion.h + @author hathach (tinyusb.org) + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, K. Townsend (microBuilder.eu) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/**************************************************************************/ + +/** \file + * \brief TBD + * + * \note TBD + */ + +/** \ingroup TBD + * \defgroup TBD + * \brief TBD + * + * @{ + */ + +#ifndef _ASSERTION_H_ +#define _ASSERTION_H_ + +#include "projectconfig.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +static inline void debugger_breakpoint(void) ATTR_ALWAYS_INLINE; +static inline void debugger_breakpoint(void) +{ +#ifndef _TEST_ + __asm("BKPT #0\n"); +#endif +} + +//--------------------------------------------------------------------+ +// Compile-time Assert +//--------------------------------------------------------------------+ +#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ + #define _ASSERT_COUNTER __COUNTER__ +#else + #define _ASSERT_COUNTER __LINE__ +#endif + +#define ASSERT_STATIC(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) } + +//--------------------------------------------------------------------+ +// Assert Helper +//--------------------------------------------------------------------+ +//#ifndef _TEST_ +// #define ASSERT_MESSAGE(format, ...) _PRINTF("Assert at %s: %s: %d: " format "\n", __BASE_FILE__, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__) +//#else +// #define ASSERT_MESSAGE(format, ...) _PRINTF("%d:note: Assert " format "\n", __LINE__, __VA_ARGS__) +//#endif + +#if CFG_DEBUG == 3 + #define ASSERT_MESSAGE(format, ...) debugger_breakpoint() +#elif CFG_DEBUG == 2 + #define ASSERT_MESSAGE(format, ...) printf("Assert at %s: %s: %d: " format "\n", __BASE_FILE__, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__) +#else + #define ASSERT_MESSAGE(format, ...) +#endif + +#define ASSERT_ERROR_HANDLER(x, para) \ + return (x) + +#define ASSERT_DEFINE_WITH_HANDLER(error_handler, handler_para, setup_statement, condition, error, format, ...) \ + do{\ + setup_statement;\ + if (!(condition)) {\ + ASSERT_MESSAGE(format, __VA_ARGS__);\ + error_handler(error, handler_para);\ + }\ + }while(0) + +#define ASSERT_DEFINE(...) ASSERT_DEFINE_WITH_HANDLER(ASSERT_ERROR_HANDLER, NULL, __VA_ARGS__) + +//--------------------------------------------------------------------+ +// error_t Status Assert TODO use ASSERT_DEFINE +//--------------------------------------------------------------------+ +#define ASSERT_STATUS_MESSAGE(sts, message) \ + ASSERT_DEFINE(error_t status = (error_t)(sts),\ + ERROR_NONE == status, status, "%s: %s", ErrorStr[status], message) + +#define ASSERT_STATUS(sts) \ + ASSERT_DEFINE(error_t status = (error_t)(sts),\ + ERROR_NONE == status, status, "error = %d", status) + +#define ASSERT_STATUS_RET_VOID(sts) \ + ASSERT_DEFINE(error_t status = (error_t)(sts),\ + ERROR_NONE == status, (void) 0, "error = %d", status) + +//--------------------------------------------------------------------+ +// Logical Assert +//--------------------------------------------------------------------+ +#define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false") +#define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true") + +//--------------------------------------------------------------------+ +// Pointer Assert +//--------------------------------------------------------------------+ +#define ASSERT_PTR(...) ASSERT_PTR_NOT_NULL(__VA_ARGS__) +#define ASSERT_PTR_NOT_NULL(pointer, error) ASSERT_DEFINE( , NULL != (pointer), error, "%s", "pointer is NULL") +#define ASSERT_PTR_NULL(pointer, error) ASSERT_DEFINE( , NULL == (pointer), error, "%s", "pointer is not NULL") + +//--------------------------------------------------------------------+ +// Integral Assert +//--------------------------------------------------------------------+ +#define ASSERT_XXX_EQUAL(type_format, expected, actual, error) \ + ASSERT_DEFINE(\ + uint32_t exp = (expected); uint32_t act = (actual),\ + exp==act,\ + error,\ + "expected " type_format ", actual " type_format, exp, act) + +#define ASSERT_XXX_WITHIN(type_format, lower, upper, actual, error) \ + ASSERT_DEFINE(\ + uint32_t low = (lower); uint32_t up = (upper); uint32_t act = (actual),\ + (low <= act) && (act <= up),\ + error,\ + "expected within " type_format " - " type_format ", actual " type_format, low, up, act) + +//--------------------------------------------------------------------+ +// Integer Assert +//--------------------------------------------------------------------+ +#define ASSERT_INT(...) ASSERT_INT_EQUAL(__VA_ARGS__) +#define ASSERT_INT_EQUAL(...) ASSERT_XXX_EQUAL("%d", __VA_ARGS__) +#define ASSERT_INT_WITHIN(...) ASSERT_XXX_WITHIN("%d", __VA_ARGS__) + +//--------------------------------------------------------------------+ +// Hex Assert +//--------------------------------------------------------------------+ +#define ASSERT_HEX(...) ASSERT_HEX_EQUAL(__VA_ARGS__) +#define ASSERT_HEX_EQUAL(...) ASSERT_XXX_EQUAL("0x%x", __VA_ARGS__) +#define ASSERT_HEX_WITHIN(...) ASSERT_XXX_WITHIN("0x%x", __VA_ARGS__) + +//--------------------------------------------------------------------+ +// Bin Assert +//--------------------------------------------------------------------+ +#define BIN8_PRINTF_PATTERN "%d%d%d%d%d%d%d%d" +#define BIN8_PRINTF_CONVERT(byte) \ + ((byte) & 0x80 ? 1 : 0), \ + ((byte) & 0x40 ? 1 : 0), \ + ((byte) & 0x20 ? 1 : 0), \ + ((byte) & 0x10 ? 1 : 0), \ + ((byte) & 0x08 ? 1 : 0), \ + ((byte) & 0x04 ? 1 : 0), \ + ((byte) & 0x02 ? 1 : 0), \ + ((byte) & 0x01 ? 1 : 0) + +#define ASSERT_BIN8(...) ASSERT_BIN8_EQUAL(__VA_ARGS__) +#define ASSERT_BIN8_EQUAL(expected, actual, error)\ + ASSERT_DEFINE(\ + uint8_t exp = (expected); uint8_t act = (actual),\ + exp==act,\ + error,\ + "expected " BIN8_PRINTF_PATTERN ", actual " BIN8_PRINTF_PATTERN, BIN8_PRINTF_CONVERT(exp), BIN8_PRINTF_CONVERT(act) ) + +#ifdef __cplusplus +} +#endif + +#endif /* _ASSERTION_H_ */ + +/** @} */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/binary.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/binary.h new file mode 100644 index 0000000000..585787eb2f --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/binary.h @@ -0,0 +1,96 @@ +/**************************************************************************/ +/*! + @file binary.h + @author hathach (tinyusb.org) + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, K. Townsend (microBuilder.eu) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/**************************************************************************/ + +/** \ingroup TBD + * \defgroup TBD + * \brief TBD + * + * @{ + */ + +#ifndef _BINARY_H_ +#define _BINARY_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +/// n-th Bit +#define BIT(n) (1 << (n)) + +/// set n-th bit of x to 1 +#define BIT_SET(x, n) ( (x) | BIT(n) ) + +/// clear n-th bit of x +#define BIT_CLR(x, n) ( (x) & (~BIT(n)) ) + +/// test n-th bit of x +#define BIT_TEST(x, n) ( (x) & BIT(n) ) + +#if defined(__GNUC__) && !defined(__CC_ARM) // keil does not support binary format + +#define BIN8(x) ((uint8_t) (0b##x)) +#define BIN16(b1, b2) ((uint16_t) (0b##b1##b2)) +#define BIN32(b1, b2, b3, b4) ((uint32_t) (0b##b1##b2##b3##b4)) + +#else + +// internal macro of B8, B16, B32 +#define _B8__(x) (((x&0x0000000FUL)?1:0) \ + +((x&0x000000F0UL)?2:0) \ + +((x&0x00000F00UL)?4:0) \ + +((x&0x0000F000UL)?8:0) \ + +((x&0x000F0000UL)?16:0) \ + +((x&0x00F00000UL)?32:0) \ + +((x&0x0F000000UL)?64:0) \ + +((x&0xF0000000UL)?128:0)) + +#define BIN8(d) ((uint8_t) _B8__(0x##d##UL)) +#define BIN16(dmsb,dlsb) (((uint16_t)BIN8(dmsb)<<8) + BIN8(dlsb)) +#define BIN32(dmsb,db2,db3,dlsb) \ + (((uint32_t)BIN8(dmsb)<<24) \ + + ((uint32_t)BIN8(db2)<<16) \ + + ((uint32_t)BIN8(db3)<<8) \ + + BIN8(dlsb)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _BINARY_H_ */ + +/** @} */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/ble_error.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/ble_error.h new file mode 100644 index 0000000000..36deb33080 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/ble_error.h @@ -0,0 +1,151 @@ +/**************************************************************************/ +/*! + @file ble_error.h + @author hathach (tinyusb.org) + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, K. Townsend (microBuilder.eu) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/**************************************************************************/ + +/** \file + * \brief Error Header + * + * \note TBD + */ + +/** \ingroup Group_Common + * \defgroup Group_Error Error Codes + * @{ + */ + +#ifndef _BLE_ERROR_H_ +#define _BLE_ERROR_H_ + +#include "projectconfig.h" + +#ifdef __cplusplus + extern "C" { +#endif + +typedef enum +{ + /*======================================================================= + NORDIC GLOBAL ERRORS 0x0000 .. 0x00FF + ----------------------------------------------------------------------- + Errors mapped from nrf_error.h + -----------------------------------------------------------------------*/ + ERROR_NONE = 0x0000 , ///< Successful command + ERROR_SVC_HANDLER_MISSING = 0x0001 , ///< SVC handler is missing + ERROR_SOFTDEVICE_NOT_ENABLED = 0x0002 , ///< SoftDevice has not been enabled + ERROR_INTERNAL = 0x0003 , ///< Internal Error + ERROR_NO_MEM = 0x0004 , ///< No Memory for operation + ERROR_NOT_FOUND = 0x0005 , ///< Not found + ERROR_NOT_SUPPORTED = 0x0006 , ///< Not supported + ERROR_INVALID_PARAM = 0x0007 , ///< Invalid Parameter + ERROR_INVALID_STATE = 0x0008 , ///< Invalid state, operation disallowed in this state + ERROR_INVALID_LENGTH = 0x0009 , ///< Invalid Length + ERROR_INVALID_FLAGS = 0x000A , ///< Invalid Flags + ERROR_INVALID_DATA = 0x000B , ///< Invalid Data + ERROR_DATA_SIZE = 0x000C , ///< Data size exceeds limit + ERROR_TIMEOUT = 0x000D , ///< Operation timed out + ERROR_NULL = 0x000E , ///< Null Pointer + ERROR_FORBIDDEN = 0x000F , ///< Forbidden Operation + ERROR_INVALID_ADDR = 0x0010 , ///< Bad Memory Address + ERROR_BUSY = 0x0011 , ///< Busy + /*=======================================================================*/ + + ERROR_INVALIDPARAMETER = 0x0100 , /**< An invalid parameter value was provided */ + ERROR_I2C_XFER_FAILED = 0x0101 , /**< an failed attempt to make I2C transfer */ + + /*======================================================================= + SIMPLE BINARY PROTOCOL ERRORS 0x0120 .. 0x013F + ----------------------------------------------------------------------- + Errors relating to the simple binary protocol (/src//protocol) + -----------------------------------------------------------------------*/ + ERROR_PROT_INVALIDMSGTYPE = 0x121, /**< Unexpected msg type encountered */ + ERROR_PROT_INVALIDCOMMANDID = 0x122, /**< Unknown or out of range command ID */ + ERROR_PROT_INVALIDPAYLOAD = 0x123, /**< Message payload has a problem (invalid len, etc.) */ + /*=======================================================================*/ + + //------------- based on Nordic SDM nrf_error_sdm.h -------------// + ERROR_SDM_LFCLK_SOURCE_UNKNOWN = 0x1000 , ///< Unknown lfclk source + ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION = 0x1001 , ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts) + ERROR_SDM_INCORRECT_CLENR0 = 0x1002 , ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing) + + //------------- based on Nordic SOC nrf_error_soc.h -------------// + /* Mutex Errors */ + ERROR_SOC_MUTEX_ALREADY_TAKEN = 0x2000 , ///< Mutex already taken + + /* NVIC errors */ + ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE = 0x2001 , ///< NVIC interrupt not available + ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED = 0x2002 , ///< NVIC interrupt priority not allowed + ERROR_SOC_NVIC_SHOULD_NOT_RETURN = 0x2003 , ///< NVIC should not return + + /* Power errors */ + ERROR_SOC_POWER_MODE_UNKNOWN = 0x2004 , ///< Power mode unknown + ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN = 0x2005 , ///< Power POF threshold unknown + ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN = 0x2006 , ///< Power off should not return + + /* Rand errors */ + ERROR_SOC_RAND_NOT_ENOUGH_VALUES = 0x2007 , ///< RAND not enough values + + /* PPI errors */ + ERROR_SOC_PPI_INVALID_CHANNEL = 0x2008 , ///< Invalid PPI Channel + ERROR_SOC_PPI_INVALID_GROUP = 0x2009 , ///< Invalid PPI Group + + //------------- based on Nordic STK (ble) ble_err.h -------------// + ERROR_BLE_INVALID_CONN_HANDLE = 0x3001 , /**< Invalid connection handle. */ + ERROR_BLE_INVALID_ATTR_HANDLE = 0x3002 , /**< Invalid attribute handle. */ + ERROR_BLE_NO_TX_BUFFERS = 0x3003 , /**< Buffer capacity exceeded. */ + + // L2CAP + ERROR_BLE_L2CAP_CID_IN_USE = 0x3100 , /**< CID already in use. */ + + // GAP + ERROR_BLE_GAP_UUID_LIST_MISMATCH = 0x3200 , /**< UUID list does not contain an integral number of UUIDs. */ + ERROR_BLE_GAP_DISCOVERABLE_WITH_WHITELIST = 0x3201 , /**< Use of Whitelist not permitted with discoverable advertising. */ + ERROR_BLE_GAP_INVALID_BLE_ADDR = 0x3202 , /**< The upper two bits of the address do not correspond to the specified address type. */ + + // GATTC + ERROR_BLE_GATTC_PROC_NOT_PERMITTED = 0x3300 , + + // GATTS + ERROR_BLEGATTS_INVALID_ATTR_TYPE = 0x3400 , /**< Invalid attribute type. */ + ERROR_BLEGATTS_SYS_ATTR_MISSING = 0x3401 , /**< System Attributes missing. */ + +}error_t; + +#ifdef __cplusplus + } +#endif + +#endif /* _BLE_ERROR_H_ */ + + /** @} */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/common.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/common.h new file mode 100644 index 0000000000..6002c6dfb7 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/common.h @@ -0,0 +1,236 @@ +/**************************************************************************/ +/*! + @file common.h + @author hathach (tinyusb.org) + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, K. Townsend (microBuilder.eu) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/**************************************************************************/ + +/** \defgroup Group_Common Common Files + * @{ + * + * \defgroup Group_CommonH common.h + * + * @{ + */ + +#ifndef _COMMON_H_ +#define _COMMON_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +//--------------------------------------------------------------------+ +// INCLUDES +//--------------------------------------------------------------------+ + +//------------- Standard Header -------------// +#include +#include +#include +#include +#include + +//------------- General Header -------------// +#include "projectconfig.h" +#include "compiler.h" +#include "assertion.h" +#include "binary.h" +#include "ble_error.h" + +//------------- MCU header -------------// +//#include "nrf.h" + +//--------------------------------------------------------------------+ +// TYPEDEFS +//--------------------------------------------------------------------+ +typedef unsigned char byte_t; +typedef float float32_t; +typedef double float64_t; + +//--------------------------------------------------------------------+ +// MACROS +//--------------------------------------------------------------------+ +#define STRING_(x) #x // stringify without expand +#define XSTRING_(x) STRING_(x) // expand then stringify +#define STRING_CONCAT_(a, b) a##b // concat without expand +#define XSTRING_CONCAT_(a, b) STRING_CONCAT_(a, b) // expand then concat + +#define U16_HIGH_U8(u16) ((uint8_t) (((u16) >> 8) & 0x00ff)) +#define U16_LOW_U8(u16) ((uint8_t) ((u16) & 0x00ff)) +#define U16_TO_U8S_BE(u16) U16_HIGH_U8(u16), U16_LOW_U8(u16) +#define U16_TO_U8S_LE(u16) U16_LOW_U8(u16), U16_HIGH_U8(u16) + +#define U32_B1_U8(u32) ((uint8_t) (((u32) >> 24) & 0x000000ff)) // MSB +#define U32_B2_U8(u32) ((uint8_t) (((u32) >> 16) & 0x000000ff)) +#define U32_B3_U8(u32) ((uint8_t) (((u32) >> 8) & 0x000000ff)) +#define U32_B4_U8(u32) ((uint8_t) ((u32) & 0x000000ff)) // LSB + +#define U32_TO_U8S_BE(u32) U32_B1_U8(u32), U32_B2_U8(u32), U32_B3_U8(u32), U32_B4_U8(u32) +#define U32_TO_U8S_LE(u32) U32_B4_U8(u32), U32_B3_U8(u32), U32_B2_U8(u32), U32_B1_U8(u32) + +//--------------------------------------------------------------------+ +// INLINE FUNCTION +//--------------------------------------------------------------------+ +#define memclr_(buffer, size) memset(buffer, 0, size) + +//------------- Conversion -------------// +/// form an uint32_t from 4 x uint8_t +static inline uint32_t u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint32_t u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4) +{ + return (b1 << 24) + (b2 << 16) + (b3 << 8) + b4; +} + +static inline uint8_t u16_high_u8(uint16_t u16) ATTR_CONST ATTR_ALWAYS_INLINE; +static inline uint8_t u16_high_u8(uint16_t u16) +{ + return (uint8_t) ((u16 >> 8) & 0x00ff); +} + +static inline uint8_t u16_low_u8(uint16_t u16) ATTR_CONST ATTR_ALWAYS_INLINE; +static inline uint8_t u16_low_u8(uint16_t u16) +{ + return (uint8_t) (u16 & 0x00ff); +} + +//------------- Min -------------// +static inline uint8_t min8_of(uint8_t x, uint8_t y) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint8_t min8_of(uint8_t x, uint8_t y) +{ + return (x < y) ? x : y; +} + +static inline uint16_t min16_of(uint16_t x, uint16_t y) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint16_t min16_of(uint16_t x, uint16_t y) +{ + return (x < y) ? x : y; +} + +static inline uint32_t min32_of(uint32_t x, uint32_t y) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint32_t min32_of(uint32_t x, uint32_t y) +{ + return (x < y) ? x : y; +} + +//------------- Max -------------// +static inline uint32_t max32_of(uint32_t x, uint32_t y) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint32_t max32_of(uint32_t x, uint32_t y) +{ + return (x > y) ? x : y; +} + +//------------- Align -------------// +static inline uint32_t align32 (uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint32_t align32 (uint32_t value) +{ + return (value & 0xFFFFFFE0UL); +} + +static inline uint32_t align16 (uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint32_t align16 (uint32_t value) +{ + return (value & 0xFFFFFFF0UL); +} + +static inline uint32_t align_n (uint32_t alignment, uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint32_t align_n (uint32_t alignment, uint32_t value) +{ + return value & (~(alignment-1)); +} + +static inline uint32_t align4k (uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint32_t align4k (uint32_t value) +{ + return (value & 0xFFFFF000UL); +} + +static inline uint32_t offset4k(uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint32_t offset4k(uint32_t value) +{ + return (value & 0xFFFUL); +} + +//------------- Mathematics -------------// +/// inclusive range checking +static inline bool is_in_range(uint32_t lower, uint32_t value, uint32_t upper) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline bool is_in_range(uint32_t lower, uint32_t value, uint32_t upper) +{ + return (lower <= value) && (value <= upper); +} + +/// exclusive range checking +static inline bool is_in_range_exclusive(uint32_t lower, uint32_t value, uint32_t upper) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline bool is_in_range_exclusive(uint32_t lower, uint32_t value, uint32_t upper) +{ + return (lower < value) && (value < upper); +} + +static inline uint8_t log2_of(uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint8_t log2_of(uint32_t value) +{ + uint8_t result = 0; // log2 of a value is its MSB's position + + while (value >>= 1) + { + result++; + } + return result; +} + +// return the number of set bits in value +static inline uint8_t cardinality_of(uint32_t value) ATTR_ALWAYS_INLINE ATTR_CONST; +static inline uint8_t cardinality_of(uint32_t value) +{ + // Brian Kernighan's method goes through as many iterations as there are set bits. So if we have a 32-bit word with only + // the high bit set, then it will only go once through the loop + // Published in 1988, the C Programming Language 2nd Ed. (by Brian W. Kernighan and Dennis M. Ritchie) + // mentions this in exercise 2-9. On April 19, 2006 Don Knuth pointed out to me that this method + // "was first published by Peter Wegner in CACM 3 (1960), 322. (Also discovered independently by Derrick Lehmer and + // published in 1964 in a book edited by Beckenbach.)" + uint8_t count; + for (count = 0; value; count++) + { + value &= value - 1; // clear the least significant bit set + } + + return count; +} + +#ifdef __cplusplus + } +#endif + +#endif /* _COMMON_H_ */ + +/** @} */ +/** @} */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/compiler.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/compiler.h new file mode 100644 index 0000000000..5b04ac05d0 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/common/compiler.h @@ -0,0 +1,160 @@ +/**************************************************************************/ +/*! + @file compiler.h + @author hathach (tinyusb.org) + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, K. Townsend (microBuilder.eu) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/**************************************************************************/ + +/** \file + * \brief GCC Header + */ + +/** \ingroup Group_Compiler + * \defgroup Group_GCC GNU GCC + * @{ + */ + +#ifndef _COMPILER_GCC_H_ +#define _COMPILER_GCC_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#include "projectconfig.h" + +//#ifndef __GNUC__ +// #define ATTR_ALWAYS_INLINE +// #define ATTR_CONST +//#else + +#ifdef _TEST_ + #define ATTR_ALWAYS_INLINE + #define STATIC_ + #define INLINE_ +#else + #define STATIC_ static + #define INLINE_ inline + + #if CFG_DEBUG == 3 + #define ATTR_ALWAYS_INLINE // no inline for debug = 3 + #endif +#endif + + +#ifdef __GNUC__ + +#define ALIGN_OF(x) __alignof__(x) + +/// Normally, the compiler places the objects it generates in sections like data or bss & function in text. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section +#define ATTR_SECTION(section) __attribute__ ((#section)) + +/// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, an error that includes message is diagnosed. This is useful for compile-time checking +#define ATTR_ERROR(Message) __attribute__ ((error(Message))) + +/// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, a warning that includes message is diagnosed. This is useful for compile-time checking +#define ATTR_WARNING(Message) __attribute__ ((warning(Message))) + +/** + * \defgroup Group_VariableAttr Variable Attributes + * @{ + */ + +/// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes +#define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) + +/// The packed attribute specifies that a variable or structure field should have the smallest possible alignment—one byte for a variable, and one bit for a field, unless you specify a larger value with the aligned attribute +#define ATTR_PACKED __attribute__ ((packed)) + +#define ATTR_PREPACKED + +#define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed)) +/** @} */ + +/** + * \defgroup Group_FuncAttr Function Attributes + * @{ + */ + +#ifndef ATTR_ALWAYS_INLINE +/// Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level is specified +#define ATTR_ALWAYS_INLINE __attribute__ ((always_inline)) +#endif + +/// The nonnull attribute specifies that some function parameters should be non-null pointers. f the compiler determines that a null pointer is passed in an argument slot marked as non-null, and the -Wnonnull option is enabled, a warning is issued. All pointer arguments are marked as non-null +#define ATTR_NON_NULL __attribute__ ((nonull)) + +/// Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be. These functions should be declared with the attribute pure +#define ATTR_PURE __attribute__ ((pure)) + +/// Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory. +/// Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const. It does not make sense for a const function to return void +#define ATTR_CONST __attribute__ ((const)) + +/// The deprecated attribute results in a warning if the function is used anywhere in the source file. This is useful when identifying functions that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated function, to enable users to easily find further information about why the function is deprecated, or what they should do instead. Note that the warnings only occurs for uses +#define ATTR_DEPRECATED __attribute__ ((deprecated)) + +/// Same as the deprecated attribute with optional message in the warning +#define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess))) + +/// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions that can be overridden in user code +#define ATTR_WEAK __attribute__ ((weak)) + +/// The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified +#define ATTR_ALIAS(func) __attribute__ ((alias(#func))) + +/// The weakref attribute marks a declaration as a weak reference. It is equivalent with weak + alias attribute, but require function is static +#define ATTR_WEAKREF(func) __attribute__ ((weakref(#func))) + +/// The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug +#define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) + +/// This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function is referenced only in inline assembly. +#define ATTR_USED __attribute__ ((used)) + +/// This attribute, attached to a function, means that the function is meant to be possibly unused. GCC does not produce a warning for this function. +#define ATTR_UNUSED __attribute__ ((unused)) + +#elif defined (__ICCARM__) //IAR + #define ATTR_ALWAYS_INLINE // IAR dosn't provide such a syntax extension in function's prototypes. + #define ATTR_CONST // IAR dosn't provide such a syntax extension in function's prototypes. +#endif + +/** @} */ + +#ifdef __cplusplus + } +#endif + +#endif /* _COMPILER_GCC_H_ */ + +/// @} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.cpp new file mode 100644 index 0000000000..7a910b8569 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.cpp @@ -0,0 +1,303 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2015 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "nRF5xCharacteristicDescriptorDiscoverer.h" +#include "ble_err.h" +#include "ble/DiscoveredCharacteristicDescriptor.h" + +nRF5xCharacteristicDescriptorDiscoverer::nRF5xCharacteristicDescriptorDiscoverer() : + discoveryRunning() { + // nothing to do +} + +nRF5xCharacteristicDescriptorDiscoverer::~nRF5xCharacteristicDescriptorDiscoverer() { + // nothing to do +} + +ble_error_t nRF5xCharacteristicDescriptorDiscoverer::launch( + const DiscoveredCharacteristic& characteristic, + const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback, + const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback +) { + Gap::Handle_t connHandle = characteristic.getConnectionHandle(); + // it is ok to deduce that the start handle for descriptors is after + // the characteristic declaration and the characteristic value declaration + // see BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] (3.3) + Gap::Handle_t descriptorStartHandle = characteristic.getDeclHandle() + 2; + Gap::Handle_t descriptorEndHandle = characteristic.getLastHandle(); + + // check if there is any descriptor to discover + if (descriptorEndHandle < descriptorStartHandle) { + CharacteristicDescriptorDiscovery::TerminationCallbackParams_t termParams = { + characteristic, + BLE_ERROR_NONE + }; + terminationCallback.call(&termParams); + return BLE_ERROR_NONE; + } + + // check if we can run this discovery + if (isConnectionInUse(connHandle)) { + return BLE_STACK_BUSY; + } + + // get a new discovery slot, if none are available, just return + Discovery* discovery = getAvailableDiscoverySlot(); + if(discovery == NULL) { + return BLE_STACK_BUSY; + } + + // try to launch the discovery + ble_error_t err = gattc_descriptors_discover(connHandle, descriptorStartHandle, descriptorEndHandle); + if(!err) { + // commit the new discovery to its slot + *discovery = Discovery(characteristic, discoveryCallback, terminationCallback); + } + + return err; +} + +bool nRF5xCharacteristicDescriptorDiscoverer::isActive(const DiscoveredCharacteristic& characteristic) const { + for(size_t i = 0; i < MAXIMUM_CONCURRENT_CONNECTIONS_COUNT; ++i) { + if(discoveryRunning[i].getCharacteristic() == characteristic) { + return true; + } + } + return false; +} + +void nRF5xCharacteristicDescriptorDiscoverer::requestTerminate(const DiscoveredCharacteristic& characteristic) { + Discovery* discovery = findRunningDiscovery(characteristic); + if(discovery) { + // call terminate anyway + terminate(discovery, BLE_ERROR_NONE); + } +} + +void nRF5xCharacteristicDescriptorDiscoverer::process(uint16_t connectionHandle, const ble_gattc_evt_desc_disc_rsp_t& descriptors) { + Discovery* discovery = findRunningDiscovery(connectionHandle); + // the discovery has been removed + if(!discovery) { + return; + } + + for (uint16_t i = 0; i < descriptors.count; ++i) { + const ble_gattc_desc_t& desc = descriptors.descs[i]; + const ble_uuid_t& uuid = desc.uuid; + + if (uuid.type == BLE_UUID_TYPE_BLE) { + discovery->process( + desc.handle, UUID(uuid.uuid) + ); + } else { + // discover attribute infos of the descriptor + ble_error_t err = gattc_attr_info_discover(connectionHandle, desc.handle, desc.handle); + if (err) { + terminate(discovery, err); + } + + return; + } + } + + // prepare the next discovery request (if needed) + uint16_t startHandle = descriptors.descs[descriptors.count - 1].handle + 1; + uint16_t endHandle = discovery->getCharacteristic().getLastHandle(); + + if(startHandle > endHandle) { + terminate(discovery, BLE_ERROR_NONE); + return; + } + + ble_error_t err = gattc_descriptors_discover(connectionHandle, startHandle, endHandle); + if(err) { + terminate(discovery, err); + return; + } +} + +void nRF5xCharacteristicDescriptorDiscoverer::processAttributeInformation( + uint16_t connectionHandle, const ble_gattc_evt_attr_info_disc_rsp_t& infos) { + Discovery* discovery = findRunningDiscovery(connectionHandle); + // the discovery has been removed + if(!discovery) { + return; + } + + // for all UUIDS found, process the discovery + for (uint16_t i = 0; i < infos.count; ++i) { + bool use_16bits_uuids = infos.format == BLE_GATTC_ATTR_INFO_FORMAT_16BIT; + const ble_gattc_attr_info_t& attr_info = infos.attr_info[i]; + UUID uuid = use_16bits_uuids ? UUID(attr_info.info.uuid16.uuid) : UUID(attr_info.info.uuid128.uuid128, UUID::LSB); + discovery->process(attr_info.handle, uuid); + } + + // prepare the next round of descriptors discovery + uint16_t startHandle = infos.attr_info[infos.count - 1].handle + 1; + uint16_t endHandle = discovery->getCharacteristic().getLastHandle(); + + if(startHandle > endHandle) { + terminate(discovery, BLE_ERROR_NONE); + return; + } + + ble_error_t err = gattc_descriptors_discover(connectionHandle, startHandle, endHandle); + if(err) { + terminate(discovery, err); + return; + } +} + +void nRF5xCharacteristicDescriptorDiscoverer::terminate(uint16_t handle, ble_error_t err) { + Discovery* discovery = findRunningDiscovery(handle); + // the discovery has already been terminated + if(!discovery) { + return; + } + + terminate(discovery, err); +} + +void nRF5xCharacteristicDescriptorDiscoverer::terminate(Discovery* discovery, ble_error_t err) { + // temporary copy, user code can try to launch a new discovery in the onTerminate + // callback. So, this discovery should not appear in such case. + Discovery tmp = *discovery; + *discovery = Discovery(); + tmp.terminate(err); +} + +nRF5xCharacteristicDescriptorDiscoverer::Discovery* +nRF5xCharacteristicDescriptorDiscoverer::findRunningDiscovery(const DiscoveredCharacteristic& characteristic) { + for(size_t i = 0; i < MAXIMUM_CONCURRENT_CONNECTIONS_COUNT; ++i) { + if((discoveryRunning[i].getCharacteristic() == characteristic) && + (discoveryRunning[i].isEmpty() == false)) { + return &discoveryRunning[i]; + } + } + return NULL; +} + +nRF5xCharacteristicDescriptorDiscoverer::Discovery* +nRF5xCharacteristicDescriptorDiscoverer::findRunningDiscovery(uint16_t handle) { + for(size_t i = 0; i < MAXIMUM_CONCURRENT_CONNECTIONS_COUNT; ++i) { + if((discoveryRunning[i].getCharacteristic().getConnectionHandle() == handle) && + (discoveryRunning[i].isEmpty() == false)) { + return &discoveryRunning[i]; + } + } + return NULL; +} + +nRF5xCharacteristicDescriptorDiscoverer::Discovery* +nRF5xCharacteristicDescriptorDiscoverer::getAvailableDiscoverySlot() { + for(size_t i = 0; i < MAXIMUM_CONCURRENT_CONNECTIONS_COUNT; ++i) { + if(discoveryRunning[i].isEmpty()) { + return &discoveryRunning[i]; + } + } + return NULL; +} + +bool nRF5xCharacteristicDescriptorDiscoverer::isConnectionInUse(uint16_t connHandle) { + return findRunningDiscovery(connHandle) != NULL; +} + +ble_error_t nRF5xCharacteristicDescriptorDiscoverer::gattc_descriptors_discover( + uint16_t connection_handle, uint16_t start_handle, uint16_t end_handle) { + + ble_gattc_handle_range_t discoveryRange = { + start_handle, + end_handle + }; + uint32_t err = sd_ble_gattc_descriptors_discover(connection_handle, &discoveryRange); + + switch(err) { + case NRF_SUCCESS: + return BLE_ERROR_NONE; + case BLE_ERROR_INVALID_CONN_HANDLE: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_INVALID_ADDR: + return BLE_ERROR_PARAM_OUT_OF_RANGE; + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + default: + return BLE_ERROR_UNSPECIFIED; + } +} + +ble_error_t nRF5xCharacteristicDescriptorDiscoverer::gattc_attr_info_discover( + uint16_t connection_handle, uint16_t start_handle, uint16_t end_handle) { + ble_gattc_handle_range_t handle_range = { start_handle, end_handle }; + uint32_t err = sd_ble_gattc_attr_info_discover(connection_handle, &handle_range); + + switch(err) { + case NRF_SUCCESS: + return BLE_ERROR_NONE; + case BLE_ERROR_INVALID_CONN_HANDLE: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_INVALID_ADDR: + return BLE_ERROR_PARAM_OUT_OF_RANGE; + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + default: + return BLE_ERROR_UNSPECIFIED; + } +} + + + +// implementation of nRF5xCharacteristicDescriptorDiscoverer::Discovery + +nRF5xCharacteristicDescriptorDiscoverer::Discovery::Discovery() : + characteristic(), onDiscovery(), onTerminate() { +} + +nRF5xCharacteristicDescriptorDiscoverer::Discovery::Discovery( + const DiscoveredCharacteristic& c, const DiscoveryCallback_t& dCb, const TerminationCallback_t& tCb) : + characteristic(c), onDiscovery(dCb), onTerminate(tCb) { +} + +void nRF5xCharacteristicDescriptorDiscoverer::Discovery::process( + GattAttribute::Handle_t handle, const UUID& uuid) { + CharacteristicDescriptorDiscovery::DiscoveryCallbackParams_t params = { + characteristic, + DiscoveredCharacteristicDescriptor( + characteristic.getGattClient(), + characteristic.getConnectionHandle(), + handle, + uuid + ) + }; + onDiscovery.call(¶ms); +} + +void nRF5xCharacteristicDescriptorDiscoverer::Discovery::terminate(ble_error_t err) { + CharacteristicDescriptorDiscovery::TerminationCallbackParams_t params = { + characteristic, + err + }; + + onTerminate.call(¶ms); +} + +bool nRF5xCharacteristicDescriptorDiscoverer::Discovery::isEmpty() const { + return *this == Discovery(); +} + +const DiscoveredCharacteristic& nRF5xCharacteristicDescriptorDiscoverer::Discovery::getCharacteristic() const { + return characteristic; +} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.h new file mode 100644 index 0000000000..26692ff936 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.h @@ -0,0 +1,227 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2015 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NRF_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__ +#define __NRF_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__ + +#include "ble/Gap.h" +#include "ble/DiscoveredCharacteristic.h" +#include "ble/CharacteristicDescriptorDiscovery.h" +#include "ble/GattClient.h" +#include "ble_gattc.h" + +/** + * @brief Manage the discovery of Characteristic descriptors + * @details is a bridge between BLE API and Nordic stack regarding Characteristic + * Descriptor discovery. The BLE API can launch, monitor and ask for termination + * of a discovery. The Nordic stack will provide new descriptors and indicate when + * the discovery is done. + */ +class nRF5xCharacteristicDescriptorDiscoverer +{ + typedef CharacteristicDescriptorDiscovery::DiscoveryCallback_t DiscoveryCallback_t; + typedef CharacteristicDescriptorDiscovery::TerminationCallback_t TerminationCallback_t; + +public: + /** + * @brief Construct a new characteristic descriptor discoverer. + */ + nRF5xCharacteristicDescriptorDiscoverer(); + + /** + * @brief Destroy a characteristic descriptor discoverer. + */ + ~nRF5xCharacteristicDescriptorDiscoverer(); + + /** + * Launch a new characteristic descriptor discovery for a given DiscoveredCharacteristic. + * @param characteristic The characteristic owning the descriptors to discover. + * @param discoveryCallback The callback called when a descriptor is discovered. + * @param terminationCallback The callback called when the discovery process end. + * @return BLE_ERROR_NONE if characteristic descriptor discovery is launched successfully; + * else an appropriate error. + * @note: this will be called by BLE API side. + */ + ble_error_t launch( + const DiscoveredCharacteristic& characteristic, + const DiscoveryCallback_t& discoveryCallback, + const TerminationCallback_t& terminationCallback + ); + + /** + * @brief indicate if a characteristic descriptor discovery is active for a + * given DiscoveredCharacteristic. + * @param characteristic The characteristic for whom the descriptor might be + * currently discovered. + * @return true if descriptors of characteristic are discovered, false otherwise. + * @note: this will be called by BLE API side. + */ + bool isActive(const DiscoveredCharacteristic& characteristic) const; + + /** + * @brief request the termination of characteristic descriptor discovery + * for a give DiscoveredCharacteristic + * @param characteristic The characteristic for whom the descriptor discovery + * should be stopped. + * @note: this will be called by BLE API side. + */ + void requestTerminate(const DiscoveredCharacteristic& characteristic); + + /** + * @brief process descriptors discovered from the Nordic stack. + * @param connectionHandle The connection handle upon which descriptors has been + * discovered. + * @param descriptors Discovered descriptors. + * @note This will be called by the Nordic stack. + */ + void process(uint16_t connectionHandle, const ble_gattc_evt_desc_disc_rsp_t& descriptors); + + /** + * @brief Called by the Nordic stack when the discovery is over. + * @param The connection handle upon which the discovery process is done. + * @param err An error if the termination is due to an error. + */ + void terminate(uint16_t connectionHandle, ble_error_t err); + + /** + * @brief process attribute informations from the Nordic stack. + * @param connectionHandle The connection handle upon which + * attribute informations has been fetch. + * @param infos Informations around attribute, in that case the + * 128bit UUID of a descriptor. + * @note This will be called by the Nordic stack. + */ + void processAttributeInformation(uint16_t handle, const ble_gattc_evt_attr_info_disc_rsp_t& infos); + +private: + // protection against copy construction and assignment + nRF5xCharacteristicDescriptorDiscoverer(const nRF5xCharacteristicDescriptorDiscoverer&); + nRF5xCharacteristicDescriptorDiscoverer& operator=(const nRF5xCharacteristicDescriptorDiscoverer&); + + /** + * @brief Discovery process, it store the DiscoveredCharacteristic, the + * discovery callback and the termination callback. + */ + class Discovery { + public: + /** + * @brief Construct an empty discovery, such can be considerate as a not running discovery. + * @note #isEmpty function will return true + */ + Discovery(); + + /** + * @brief Construct a valid discovery process. + * + * @param c the characteristic from whom descriptors will be discovered. + * @param dCb The discovery callback called each time a descriptor is discovered. + * @param tCb The termination callback called when the discovery terminate. + * + * @note #isEmpty function will return false + */ + Discovery(const DiscoveredCharacteristic& c, const DiscoveryCallback_t& dCb, const TerminationCallback_t& tCb); + + /** + * @brief Process the discovery of a descriptor. + * + * @param handle The attribute handle of the descriptor found + * @param uuid The UUID of the descriptor found. + */ + void process(GattAttribute::Handle_t handle, const UUID& uuid); + + /** + * @brief Terminate the discovery process. + * + * @param err Error associate with the termination + * @note after this call #isEmpty function will return true. + */ + void terminate(ble_error_t err); + + /** + * @brief check if the discovery process is empty or not. Empty discovery are + * not running. + * + * @detail Discovery are empty after: + * - a default construction + * - a copy construction form a default constructed + * - an assignment from a default constructed Discovery + * @return true if the Discovery is empty and false otherwise. + */ + bool isEmpty() const; + + /** + * @brief return the characteristic from whom descriptors are discovered. + * @return the characteristic from whom descriptors are discovered. + */ + const DiscoveredCharacteristic& getCharacteristic() const; + + /** + * @brief equal to operator, test if two discovery process are equal + * + * @param lhs left hand side of the expression + * @param rhs right hand side of the expression + * @return true if lhs == rhs + */ + friend bool operator==(const Discovery& lhs, const Discovery& rhs) { + return lhs.characteristic == rhs.characteristic && + lhs.onDiscovery == rhs.onDiscovery && + lhs.onTerminate == rhs.onTerminate; + } + + /** + * @brief not equal to operator, test if two discovery process are not equal + * + * @param lhs left hand side of the expression + * @param rhs right hand side of the expression + * @return true if lhs != rhs + */ + friend bool operator!=(const Discovery& lhs, const Discovery& rhs) { + return !(lhs == rhs); + } + + private: + DiscoveredCharacteristic characteristic; + DiscoveryCallback_t onDiscovery; + TerminationCallback_t onTerminate; + }; + + // find a running discovery process + Discovery* findRunningDiscovery(const DiscoveredCharacteristic& characteristic); + Discovery* findRunningDiscovery(uint16_t handle); + + // Called to terminate a discovery is over. + void terminate(Discovery* discovery, ble_error_t err); + + // get one slot for a discovery process + Discovery* getAvailableDiscoverySlot(); + + // indicate if a connection is already running a discovery + bool isConnectionInUse(uint16_t connHandle); + + // low level start of a discovery + static ble_error_t gattc_descriptors_discover(uint16_t connection_handle, uint16_t start_handle, uint16_t end_handle); + + // discovery of 128bits UUIDS + static ble_error_t gattc_attr_info_discover(uint16_t connection_handle, uint16_t start_handle, uint16_t end_handle); + + // count of concurrent connections which can run a descriptor discovery process + static const size_t MAXIMUM_CONCURRENT_CONNECTIONS_COUNT = 3; + + // array of running discoveries + Discovery discoveryRunning[MAXIMUM_CONCURRENT_CONNECTIONS_COUNT]; +}; + +#endif /*__NRF_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_H__*/ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xDiscoveredCharacteristic.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xDiscoveredCharacteristic.cpp new file mode 100644 index 0000000000..a44d0af7a0 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xDiscoveredCharacteristic.cpp @@ -0,0 +1,63 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nRF5xDiscoveredCharacteristic.h" +#include "nRF5xGattClient.h" +#include "ble_gatt.h" + +void +nRF5xDiscoveredCharacteristic::setup(nRF5xGattClient *gattcIn, + Gap::Handle_t connectionHandleIn, + ble_gatt_char_props_t propsIn, + GattAttribute::Handle_t declHandleIn, + GattAttribute::Handle_t valueHandleIn) +{ + gattc = gattcIn; + connHandle = connectionHandleIn; + declHandle = declHandleIn; + valueHandle = valueHandleIn; + + props._broadcast = propsIn.broadcast; + props._read = propsIn.read; + props._writeWoResp = propsIn.write_wo_resp; + props._write = propsIn.write; + props._notify = propsIn.notify; + props._indicate = propsIn.indicate; + props._authSignedWrite = propsIn.auth_signed_wr; +} + +void +nRF5xDiscoveredCharacteristic::setup(nRF5xGattClient *gattcIn, + Gap::Handle_t connectionHandleIn, + UUID::ShortUUIDBytes_t uuidIn, + ble_gatt_char_props_t propsIn, + GattAttribute::Handle_t declHandleIn, + GattAttribute::Handle_t valueHandleIn) +{ + gattc = gattcIn; + connHandle = connectionHandleIn; + uuid = uuidIn; + declHandle = declHandleIn; + valueHandle = valueHandleIn; + + props._broadcast = propsIn.broadcast; + props._read = propsIn.read; + props._writeWoResp = propsIn.write_wo_resp; + props._write = propsIn.write; + props._notify = propsIn.notify; + props._indicate = propsIn.indicate; + props._authSignedWrite = propsIn.auth_signed_wr; +} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xDiscoveredCharacteristic.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xDiscoveredCharacteristic.h new file mode 100644 index 0000000000..b2f0a0a87b --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xDiscoveredCharacteristic.h @@ -0,0 +1,45 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NRF_DISCOVERED_CHARACTERISTIC_H__ +#define __NRF_DISCOVERED_CHARACTERISTIC_H__ + +#include "ble/DiscoveredCharacteristic.h" +#include "ble_gatt.h" + +class nRF5xGattClient; /* forward declaration */ + +class nRF5xDiscoveredCharacteristic : public DiscoveredCharacteristic { +public: + void setup(nRF5xGattClient *gattcIn, + Gap::Handle_t connectionHandleIn, + ble_gatt_char_props_t propsIn, + GattAttribute::Handle_t declHandleIn, + GattAttribute::Handle_t valueHandleIn); + + void setup(nRF5xGattClient *gattcIn, + Gap::Handle_t connectionHandleIn, + UUID::ShortUUIDBytes_t uuidIn, + ble_gatt_char_props_t propsIn, + GattAttribute::Handle_t declHandleIn, + GattAttribute::Handle_t valueHandleIn); + + void setLastHandle(GattAttribute::Handle_t last) { + lastHandle = last; + } +}; + +#endif /* __NRF_DISCOVERED_CHARACTERISTIC_H__ */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp new file mode 100644 index 0000000000..2e9b254361 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -0,0 +1,947 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nRF5xn.h" +#ifdef YOTTA_CFG_MBED_OS + #include "mbed-drivers/mbed.h" +#else + #include "mbed.h" +#endif +#include "ble/BLE.h" + +#include "common/common.h" +#include "ble_advdata.h" +#include "ble_hci.h" + +void radioNotificationStaticCallback(bool param) { + nRF5xGap &gap = (nRF5xGap &) nRF5xn::Instance(BLE::DEFAULT_INSTANCE).getGap(); + gap.processRadioNotificationEvent(param); +} + +/**************************************************************************/ +/*! + @brief Sets the advertising parameters and payload for the device + + @param[in] params + Basic advertising details, including the advertising + delay, timeout and how the device should be advertised + @params[in] advData + The primary advertising data payload + @params[in] scanResponse + The optional Scan Response payload if the advertising + type is set to \ref GapAdvertisingParams::ADV_SCANNABLE_UNDIRECTED + in \ref GapAdveritinngParams + + @returns \ref ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly + + @retval BLE_ERROR_BUFFER_OVERFLOW + The proposed action would cause a buffer overflow. All + advertising payloads must be <= 31 bytes, for example. + + @retval BLE_ERROR_NOT_IMPLEMENTED + A feature was requested that is not yet supported in the + nRF51 firmware or hardware. + + @retval BLE_ERROR_PARAM_OUT_OF_RANGE + One of the proposed values is outside the valid range. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, const GapAdvertisingData &scanResponse) +{ + /* Make sure we don't exceed the advertising payload length */ + if (advData.getPayloadLen() > GAP_ADVERTISING_DATA_MAX_PAYLOAD) { + return BLE_ERROR_BUFFER_OVERFLOW; + } + + /* Make sure we have a payload! */ + if (advData.getPayloadLen() == 0) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + + /* Check the scan response payload limits */ + //if ((params.getAdvertisingType() == GapAdvertisingParams::ADV_SCANNABLE_UNDIRECTED)) + //{ + // /* Check if we're within the upper limit */ + // if (advData.getPayloadLen() > GAP_ADVERTISING_DATA_MAX_PAYLOAD) + // { + // return BLE_ERROR_BUFFER_OVERFLOW; + // } + // /* Make sure we have a payload! */ + // if (advData.getPayloadLen() == 0) + // { + // return BLE_ERROR_PARAM_OUT_OF_RANGE; + // } + //} + + /* Send advertising data! */ + ASSERT_TRUE(ERROR_NONE == + sd_ble_gap_adv_data_set(advData.getPayload(), + advData.getPayloadLen(), + scanResponse.getPayload(), + scanResponse.getPayloadLen()), + BLE_ERROR_PARAM_OUT_OF_RANGE); + + /* Make sure the GAP Service appearance value is aligned with the + *appearance from GapAdvertisingData */ + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), + BLE_ERROR_PARAM_OUT_OF_RANGE); + + /* ToDo: Perform some checks on the payload, for example the Scan Response can't */ + /* contains a flags AD type, etc. */ + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Starts the BLE HW, initialising any services that were + added before this function was called. + + @note All services must be added before calling this function! + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) +{ + /* Make sure we support the advertising type */ + if (params.getAdvertisingType() == GapAdvertisingParams::ADV_CONNECTABLE_DIRECTED) { + /* ToDo: This requires a propery security implementation, etc. */ + return BLE_ERROR_NOT_IMPLEMENTED; + } + + /* Check interval range */ + if (params.getAdvertisingType() == GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED) { + /* Min delay is slightly longer for unconnectable devices */ + if ((params.getIntervalInADVUnits() < GapAdvertisingParams::GAP_ADV_PARAMS_INTERVAL_MIN_NONCON) || + (params.getIntervalInADVUnits() > GapAdvertisingParams::GAP_ADV_PARAMS_INTERVAL_MAX)) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + } else { + if ((params.getIntervalInADVUnits() < GapAdvertisingParams::GAP_ADV_PARAMS_INTERVAL_MIN) || + (params.getIntervalInADVUnits() > GapAdvertisingParams::GAP_ADV_PARAMS_INTERVAL_MAX)) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + } + + /* Check timeout is zero for Connectable Directed */ + if ((params.getAdvertisingType() == GapAdvertisingParams::ADV_CONNECTABLE_DIRECTED) && (params.getTimeout() != 0)) { + /* Timeout must be 0 with this type, although we'll never get here */ + /* since this isn't implemented yet anyway */ + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + + /* Check timeout for other advertising types */ + if ((params.getAdvertisingType() != GapAdvertisingParams::ADV_CONNECTABLE_DIRECTED) && + (params.getTimeout() > GapAdvertisingParams::GAP_ADV_PARAMS_TIMEOUT_MAX)) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + + /* Allocate the stack's whitelist statically */ + ble_gap_whitelist_t whitelist; + ble_gap_addr_t *whitelistAddressPtrs[YOTTA_CFG_WHITELIST_MAX_SIZE]; + ble_gap_irk_t *whitelistIrkPtrs[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + /* Initialize the whitelist */ + whitelist.pp_addrs = whitelistAddressPtrs; + whitelist.pp_irks = whitelistIrkPtrs; + whitelist.addr_count = 0; + whitelist.irk_count = 0; + + /* Add missing IRKs to whitelist from the bond table held by the SoftDevice */ + if (advertisingPolicyMode != Gap::ADV_POLICY_IGNORE_WHITELIST) { + ble_error_t error = generateStackWhitelist(whitelist); + if (error != BLE_ERROR_NONE) { + return error; + } + } + + /* Start Advertising */ + ble_gap_adv_params_t adv_para = {0}; + + adv_para.type = params.getAdvertisingType(); + adv_para.p_peer_addr = NULL; // Undirected advertisement + adv_para.fp = advertisingPolicyMode; + adv_para.p_whitelist = &whitelist; + adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms) + adv_para.timeout = params.getTimeout(); + + uint32_t err = sd_ble_gap_adv_start(&adv_para); + switch(err) { + case ERROR_NONE: + return BLE_ERROR_NONE; + case NRF_ERROR_NO_MEM: + return BLE_ERROR_NO_MEM; + default: + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } +} + +/* Observer role is not supported by S110, return BLE_ERROR_NOT_IMPLEMENTED */ +#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) +ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) +{ + /* Allocate the stack's whitelist statically */ + ble_gap_whitelist_t whitelist; + ble_gap_addr_t *whitelistAddressPtrs[YOTTA_CFG_WHITELIST_MAX_SIZE]; + ble_gap_irk_t *whitelistIrkPtrs[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + /* Initialize the whitelist */ + whitelist.pp_addrs = whitelistAddressPtrs; + whitelist.pp_irks = whitelistIrkPtrs; + whitelist.addr_count = 0; + whitelist.irk_count = 0; + + /* Add missing IRKs to whitelist from the bond table held by the SoftDevice */ + if (scanningPolicyMode != Gap::SCAN_POLICY_IGNORE_WHITELIST) { + ble_error_t error = generateStackWhitelist(whitelist); + if (error != BLE_ERROR_NONE) { + return error; + } + } + + ble_gap_scan_params_t scanParams; + + scanParams.active = scanningParams.getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ + scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ + scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ + scanParams.interval = scanningParams.getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + scanParams.window = scanningParams.getWindow(); /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + scanParams.timeout = scanningParams.getTimeout(); /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ + + if (sd_ble_gap_scan_start(&scanParams) != NRF_SUCCESS) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + + return BLE_ERROR_NONE; +} + +ble_error_t nRF5xGap::stopScan(void) { + if (sd_ble_gap_scan_stop() == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } + + return BLE_STACK_BUSY; +} +#endif + +/**************************************************************************/ +/*! + @brief Stops the BLE HW and disconnects from any devices + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::stopAdvertising(void) +{ + /* Stop Advertising */ + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); + + state.advertising = 0; + + return BLE_ERROR_NONE; +} + +ble_error_t nRF5xGap::connect(const Address_t peerAddr, + BLEProtocol::AddressType_t peerAddrType, + const ConnectionParams_t *connectionParams, + const GapScanningParams *scanParamsIn) +{ + ble_gap_addr_t addr; + addr.addr_type = peerAddrType; + memcpy(addr.addr, peerAddr, Gap::ADDR_LEN); + + ble_gap_conn_params_t connParams; + if (connectionParams != NULL) { + connParams.min_conn_interval = connectionParams->minConnectionInterval; + connParams.max_conn_interval = connectionParams->maxConnectionInterval; + connParams.slave_latency = connectionParams->slaveLatency; + connParams.conn_sup_timeout = connectionParams->connectionSupervisionTimeout; + } else { + connParams.min_conn_interval = 50; + connParams.max_conn_interval = 100; + connParams.slave_latency = 0; + connParams.conn_sup_timeout = 600; + } + + /* Allocate the stack's whitelist statically */ + ble_gap_whitelist_t whitelist; + ble_gap_addr_t *whitelistAddressPtrs[YOTTA_CFG_WHITELIST_MAX_SIZE]; + ble_gap_irk_t *whitelistIrkPtrs[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + /* Initialize the whitelist */ + whitelist.pp_addrs = whitelistAddressPtrs; + whitelist.pp_irks = whitelistIrkPtrs; + whitelist.addr_count = 0; + whitelist.irk_count = 0; + + /* Add missing IRKs to whitelist from the bond table held by the SoftDevice */ + if (scanningPolicyMode != Gap::SCAN_POLICY_IGNORE_WHITELIST) { + ble_error_t error = generateStackWhitelist(whitelist); + if (error != BLE_ERROR_NONE) { + return error; + } + } + + ble_gap_scan_params_t scanParams; + scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ + scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ + if (scanParamsIn != NULL) { + scanParams.active = scanParamsIn->getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ + scanParams.interval = scanParamsIn->getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + scanParams.window = scanParamsIn->getWindow(); /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + scanParams.timeout = scanParamsIn->getTimeout(); /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ + } else { + scanParams.active = _scanningParams.getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ + scanParams.interval = _scanningParams.getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + scanParams.window = _scanningParams.getWindow(); /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ + scanParams.timeout = _scanningParams.getTimeout(); /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ + } + + uint32_t rc = sd_ble_gap_connect(&addr, &scanParams, &connParams); + if (rc == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } + switch (rc) { + case NRF_ERROR_INVALID_ADDR: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_INVALID_PARAM: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + case BLE_ERROR_GAP_INVALID_BLE_ADDR: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_NO_MEM: + return BLE_ERROR_NO_MEM; + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + default: + case BLE_ERROR_GAP_WHITELIST_IN_USE: + return BLE_ERROR_UNSPECIFIED; + } +} + +ble_error_t nRF5xGap::disconnect(Handle_t connectionHandle, DisconnectionReason_t reason) +{ + uint8_t code = BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION; + switch (reason) { + case REMOTE_USER_TERMINATED_CONNECTION: + code = BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION; + break; + case CONN_INTERVAL_UNACCEPTABLE: + code = BLE_HCI_CONN_INTERVAL_UNACCEPTABLE; + break; + default: + break; + } + + /* Disconnect if we are connected to a central device */ + ASSERT_INT(ERROR_NONE, sd_ble_gap_disconnect(connectionHandle, code), BLE_ERROR_PARAM_OUT_OF_RANGE); + + return BLE_ERROR_NONE; +} + +/*! + @brief Disconnects if we are connected to a central device + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly +*/ +ble_error_t nRF5xGap::disconnect(DisconnectionReason_t reason) +{ + return disconnect(m_connectionHandle, reason); +} + +ble_error_t nRF5xGap::getPreferredConnectionParams(ConnectionParams_t *params) +{ + ASSERT_INT(NRF_SUCCESS, + sd_ble_gap_ppcp_get(reinterpret_cast(params)), + BLE_ERROR_PARAM_OUT_OF_RANGE); + + return BLE_ERROR_NONE; +} + +ble_error_t nRF5xGap::setPreferredConnectionParams(const ConnectionParams_t *params) +{ + ASSERT_INT(NRF_SUCCESS, + sd_ble_gap_ppcp_set(reinterpret_cast(params)), + BLE_ERROR_PARAM_OUT_OF_RANGE); + + return BLE_ERROR_NONE; +} + +ble_error_t nRF5xGap::updateConnectionParams(Handle_t handle, const ConnectionParams_t *newParams) +{ + uint32_t rc; + + rc = sd_ble_gap_conn_param_update(handle, reinterpret_cast(const_cast(newParams))); + if (rc == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } else { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } +} + +/**************************************************************************/ +/*! + @brief Clear nRF5xGap's state. + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::reset(void) +{ + /* Clear all state that is from the parent, including private members */ + if (Gap::reset() != BLE_ERROR_NONE) { + return BLE_ERROR_INVALID_STATE; + } + + /* Clear derived class members */ + m_connectionHandle = BLE_CONN_HANDLE_INVALID; + + /* Set the whitelist policy filter modes to IGNORE_WHITELIST */ + advertisingPolicyMode = Gap::ADV_POLICY_IGNORE_WHITELIST; + scanningPolicyMode = Gap::SCAN_POLICY_IGNORE_WHITELIST; + + /* Clear the internal whitelist */ + whitelistAddressesSize = 0; + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Sets the 16-bit connection handle +*/ +/**************************************************************************/ +void nRF5xGap::setConnectionHandle(uint16_t con_handle) +{ + m_connectionHandle = con_handle; +} + +/**************************************************************************/ +/*! + @brief Gets the 16-bit connection handle +*/ +/**************************************************************************/ +uint16_t nRF5xGap::getConnectionHandle(void) +{ + return m_connectionHandle; +} + +/**************************************************************************/ +/*! + @brief Sets the BLE device address + + @returns ble_error_t + + @section EXAMPLE + + @code + + uint8_t device_address[6] = { 0xca, 0xfe, 0xf0, 0xf0, 0xf0, 0xf0 }; + nrf.getGap().setAddress(Gap::BLEProtocol::AddressType::RANDOM_STATIC, device_address); + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) +{ + uint8_t cycle_mode; + ble_gap_addr_t dev_addr; + + /* When using Public or Static addresses, the cycle mode must be None. + When using Random Private addresses, the cycle mode must be Auto. + In auto mode, the given address is ignored. + */ + if ((type == BLEProtocol::AddressType::PUBLIC) || (type == BLEProtocol::AddressType::RANDOM_STATIC)) + { + cycle_mode = BLE_GAP_ADDR_CYCLE_MODE_NONE; + memcpy(dev_addr.addr, address, ADDR_LEN); + } + else if ((type == BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE) || (type == BLEProtocol::AddressType::RANDOM_PRIVATE_NON_RESOLVABLE)) + { + cycle_mode = BLE_GAP_ADDR_CYCLE_MODE_AUTO; + // address is ignored when in auto mode + } + else + { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + + dev_addr.addr_type = type; + ASSERT_INT(ERROR_NONE, sd_ble_gap_address_set(cycle_mode, &dev_addr), BLE_ERROR_PARAM_OUT_OF_RANGE); + + return BLE_ERROR_NONE; +} + +ble_error_t nRF5xGap::getAddress(AddressType_t *typeP, Address_t address) +{ + ble_gap_addr_t dev_addr; + if (sd_ble_gap_address_get(&dev_addr) != NRF_SUCCESS) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + + if (typeP != NULL) { + *typeP = static_cast(dev_addr.addr_type); + } + if (address != NULL) { + memcpy(address, dev_addr.addr, ADDR_LEN); + } + return BLE_ERROR_NONE; +} + +ble_error_t nRF5xGap::setDeviceName(const uint8_t *deviceName) +{ + ble_gap_conn_sec_mode_t sec_mode; + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); // no security is needed + + if (sd_ble_gap_device_name_set(&sec_mode, deviceName, strlen((const char *)deviceName)) == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } else { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } +} + +ble_error_t nRF5xGap::getDeviceName(uint8_t *deviceName, unsigned *lengthP) +{ + if (sd_ble_gap_device_name_get(deviceName, (uint16_t *)lengthP) == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } else { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } +} + +ble_error_t nRF5xGap::setAppearance(GapAdvertisingData::Appearance appearance) +{ + if (sd_ble_gap_appearance_set(appearance) == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } else { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } +} + +ble_error_t nRF5xGap::getAppearance(GapAdvertisingData::Appearance *appearanceP) +{ + if ((sd_ble_gap_appearance_get(reinterpret_cast(appearanceP)) == NRF_SUCCESS)) { + return BLE_ERROR_NONE; + } else { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } +} + +/* (Valid values are -40, -20, -16, -12, -8, -4, 0, 4) */ +ble_error_t nRF5xGap::setTxPower(int8_t txPower) +{ + unsigned rc; + if ((rc = sd_ble_gap_tx_power_set(txPower)) != NRF_SUCCESS) { + switch (rc) { + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + case NRF_ERROR_INVALID_PARAM: + default: + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + } + + return BLE_ERROR_NONE; +} + +void nRF5xGap::getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP) +{ +#if defined(NRF51) + static const int8_t permittedTxValues[] = { + -30, -20, -16, -12, -8, -4, 0, 4 + }; +#elif defined(NRF52) + static const int8_t permittedTxValues[] = { + -40, -20, -16, -12, -8, -4, 0, 4 + }; +#else +#error permitted TX power values unknown for this SOC +#endif + + *valueArrayPP = permittedTxValues; + *countP = sizeof(permittedTxValues) / sizeof(int8_t); +} + +/**************************************************************************/ +/*! + @brief Get the capacity of the internal whitelist maintained by this + implementation. + + @returns The capacity of the internal whitelist. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +uint8_t nRF5xGap::getMaxWhitelistSize(void) const +{ + return YOTTA_CFG_WHITELIST_MAX_SIZE; +} + +/**************************************************************************/ +/*! + @brief Get a copy of the implementation's internal whitelist. + + @param[out] whitelistOut + A \ref Gap::Whitelist_t structure containing a copy of the + addresses in the implemenetation's internal whitelist. + + @returns \ref ble_errror_t + + @retval BLE_ERROR_NONE + Everything executed properly. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::getWhitelist(Gap::Whitelist_t &whitelistOut) const +{ + uint8_t i; + for (i = 0; i < whitelistAddressesSize && i < whitelistOut.capacity; ++i) { + memcpy(&whitelistOut.addresses[i], &whitelistAddresses[i], sizeof(BLEProtocol::Address_t)); + } + whitelistOut.size = i; + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Set the whitelist that will be used in the next call to + startAdvertising(). + + @param[in] whitelistIn + A reference to a \ref Gap::Whitelist_t structure + representing a whitelist containing all the white listed + BLE addresses. + + @returns \ref ble_errror_t + + @retval BLE_ERROR_NONE + Everything executed properly. + + BLE_ERROR_INVALID_PARAM + The supplied whitelist contains a private non-resolvable + address + + BLE_ERROR_PARAM_OUT_OF_RANGE + The size of the supplied whitelist exceeds the maximum + capacity of the implementation's internal whitelist. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::setWhitelist(const Gap::Whitelist_t &whitelistIn) +{ + if (whitelistIn.size > getMaxWhitelistSize()) { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } + + /* Test for invalid parameters before we change the internal state */ + for (uint8_t i = 0; i < whitelistIn.size; ++i) { + if (whitelistIn.addresses[i].type == BLEProtocol::AddressType::RANDOM_PRIVATE_NON_RESOLVABLE) { + /* This is not allowed because it is completely meaningless */ + return BLE_ERROR_INVALID_PARAM; + } + } + + whitelistAddressesSize = 0; + for (uint8_t i = 0; i < whitelistIn.size; ++i) { + memcpy(&whitelistAddresses[whitelistAddressesSize], &whitelistIn.addresses[i], sizeof(BLEProtocol::Address_t)); + whitelistAddressesSize++; + } + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Set the advertising policy filter mode that will be used in + the next call to startAdvertising(). + + @returns \ref ble_errror_t + + @retval BLE_ERROR_NONE + Everything executed properly. + + BLE_ERROR_NOT_IMPLEMENTED + This feature is currently note implemented. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::setAdvertisingPolicyMode(Gap::AdvertisingPolicyMode_t mode) +{ + advertisingPolicyMode = mode; + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Set the scanning policy filter mode that will be used in + the next call to startAdvertising(). + + @returns \ref ble_errror_t + + @retval BLE_ERROR_NONE + Everything executed properly. + + BLE_ERROR_NOT_IMPLEMENTED + This feature is currently note implemented. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::setScanningPolicyMode(Gap::ScanningPolicyMode_t mode) +{ + scanningPolicyMode = mode; + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Set the initiator policy filter mode that will be used in + the next call to startAdvertising() + + @returns \ref ble_errror_t + + @retval BLE_ERROR_NONE + Everything executed properly. + + BLE_ERROR_NOT_IMPLEMENTED + This feature is currently note implemented. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::setInitiatorPolicyMode(Gap::InitiatorPolicyMode_t mode) +{ + return BLE_ERROR_NOT_IMPLEMENTED; +} + +/**************************************************************************/ +/*! + @brief Get the current advertising policy filter mode. + + @returns The advertising policy filter mode. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +Gap::AdvertisingPolicyMode_t nRF5xGap::getAdvertisingPolicyMode(void) const +{ + return advertisingPolicyMode; +} + +/**************************************************************************/ +/*! + @brief Get the current scanning policy filter mode. + + @returns The scanning policy filter mode. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +Gap::ScanningPolicyMode_t nRF5xGap::getScanningPolicyMode(void) const +{ + return scanningPolicyMode; +} + +/**************************************************************************/ +/*! + @brief Get the current initiator policy filter mode. + + @returns The initiator policy filter mode. + + @note Currently initiator filtering using the whitelist is not + implemented in this module. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +Gap::InitiatorPolicyMode_t nRF5xGap::getInitiatorPolicyMode(void) const +{ + return Gap::INIT_POLICY_IGNORE_WHITELIST; +} + +/**************************************************************************/ +/*! + @brief Helper function used to populate the ble_gap_whitelist_t that + will be used by the SoftDevice for filtering requests. + + @returns \ref ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly + + @retval BLE_ERROR_INVALID_STATE + The internal stack was not initialized correctly. + + @note Both the SecurityManager and Gap must initialize correctly for + this function to succeed. + + @note This function is needed because for the BLE API the whitelist + is just a collection of keys, but for the stack it also includes + the IRK table. + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::generateStackWhitelist(ble_gap_whitelist_t &whitelist) +{ + ble_gap_whitelist_t whitelistFromBondTable; + ble_gap_addr_t *addressPtr[1]; + ble_gap_irk_t *irkPtr[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + + nRF5xSecurityManager& securityManager = (nRF5xSecurityManager&) nRF5xn::Instance(0).getSecurityManager(); + + if (securityManager.hasInitialized()) { + /* We do not care about the addresses, set the count to 0 */ + whitelistFromBondTable.addr_count = 0; + /* The Nordic SDK will return a failure if we set pp_addr to NULL */ + whitelistFromBondTable.pp_addrs = addressPtr; + /* We want all the IRKs we can get because we do not know which ones match the addresses */ + whitelistFromBondTable.irk_count = YOTTA_CFG_IRK_TABLE_MAX_SIZE; + whitelistFromBondTable.pp_irks = irkPtr; + + /* Use the security manager to get the IRKs from the bond table */ + ble_error_t error = securityManager.createWhitelistFromBondTable(whitelistFromBondTable); + if (error != BLE_ERROR_NONE) { + return error; + } + } else { + /** + * If there is no security manager then we cannot access the bond table, + * so disable IRK matching + */ + whitelistFromBondTable.addr_count = 0; + whitelistFromBondTable.irk_count = 0; + } + + /** + * For every private resolvable address in the local whitelist check if + * there is an IRK for said address in the bond table and add it to the + * local IRK list. + */ + whitelist.irk_count = 0; + whitelist.addr_count = 0; + for (uint8_t i = 0; i < whitelistAddressesSize; ++i) { + if (whitelistAddresses[i].addr_type == BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE) { + /* Test if there is a matching IRK for this private resolvable address */ + for (uint8_t j = 0; j < whitelistFromBondTable.irk_count; ++j) { + if (securityManager.matchAddressAndIrk(&whitelistAddresses[i], whitelistFromBondTable.pp_irks[j])) { + /* Found the corresponding IRK, add it to our local whitelist */ + whitelist.pp_irks[whitelist.irk_count] = whitelistFromBondTable.pp_irks[j]; + whitelist.irk_count++; + /* Make sure we do not look at this IRK again */ + if (j != whitelistFromBondTable.irk_count - 1) { + /** + * This is not the last IRK, so replace the pointer + * with the last pointer in the array + */ + whitelistFromBondTable.pp_irks[j] = + whitelistFromBondTable.pp_irks[whitelistFromBondTable.irk_count - 1]; + } + /** + * If the IRK is the last pointer in the array simply + * decrement the total IRK count + */ + whitelistFromBondTable.irk_count--; + break; + } + } + } else { + /* Include the address into the whitelist */ + whitelist.pp_addrs[whitelist.addr_count] = &whitelistAddresses[i]; + whitelist.addr_count++; + } + } + + return BLE_ERROR_NONE; +} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h new file mode 100644 index 0000000000..6af39a4080 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h @@ -0,0 +1,247 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NRF5x_GAP_H__ +#define __NRF5x_GAP_H__ + +#ifdef YOTTA_CFG_MBED_OS + #include "mbed-drivers/mbed.h" +#else + #include "mbed.h" +#endif +#ifndef YOTTA_CFG_WHITELIST_MAX_SIZE + #define YOTTA_CFG_WHITELIST_MAX_SIZE BLE_GAP_WHITELIST_ADDR_MAX_COUNT +#elif YOTTA_CFG_WHITELIST_MAX_SIZE > BLE_GAP_WHITELIST_ADDR_MAX_COUNT + #undef YOTTA_CFG_WHITELIST_MAX_SIZE + #define YOTTA_CFG_WHITELIST_MAX_SIZE BLE_GAP_WHITELIST_ADDR_MAX_COUNT +#endif +#ifndef YOTTA_CFG_IRK_TABLE_MAX_SIZE + #define YOTTA_CFG_IRK_TABLE_MAX_SIZE BLE_GAP_WHITELIST_IRK_MAX_COUNT +#elif YOTTA_CFG_IRK_TABLE_MAX_SIZE > BLE_GAP_WHITELIST_IRK_MAX_COUNT + #undef YOTTA_CFG_IRK_TABLE_MAX_SIZE + #define YOTTA_CFG_IRK_TABLE_MAX_SIZE BLE_GAP_WHITELIST_IRK_MAX_COUNT +#endif +#include "ble/blecommon.h" +#include "ble.h" +#include "ble/GapAdvertisingParams.h" +#include "ble/GapAdvertisingData.h" +#include "ble/Gap.h" +#include "ble/GapScanningParams.h" + +#include "nrf_soc.h" + +extern "C" { +#include "ble_radio_notification.h" +#include "app_util_platform.h" +} + +#include "btle_security.h" + +void radioNotificationStaticCallback(bool param); + +/**************************************************************************/ +/*! + \brief + +*/ +/**************************************************************************/ +class nRF5xGap : public Gap +{ +public: + /* Functions that must be implemented from Gap */ + virtual ble_error_t setAddress(AddressType_t type, const Address_t address); + virtual ble_error_t getAddress(AddressType_t *typeP, Address_t address); + virtual ble_error_t setAdvertisingData(const GapAdvertisingData &, const GapAdvertisingData &); + + virtual uint16_t getMinAdvertisingInterval(void) const {return GapAdvertisingParams::ADVERTISEMENT_DURATION_UNITS_TO_MS(BLE_GAP_ADV_INTERVAL_MIN);} + virtual uint16_t getMinNonConnectableAdvertisingInterval(void) const {return GapAdvertisingParams::ADVERTISEMENT_DURATION_UNITS_TO_MS(BLE_GAP_ADV_NONCON_INTERVAL_MIN);} + virtual uint16_t getMaxAdvertisingInterval(void) const {return GapAdvertisingParams::ADVERTISEMENT_DURATION_UNITS_TO_MS(BLE_GAP_ADV_INTERVAL_MAX);} + + virtual ble_error_t startAdvertising(const GapAdvertisingParams &); + virtual ble_error_t stopAdvertising(void); + virtual ble_error_t connect(const Address_t, BLEProtocol::AddressType_t peerAddrType, const ConnectionParams_t *connectionParams, const GapScanningParams *scanParams); + virtual ble_error_t disconnect(Handle_t connectionHandle, DisconnectionReason_t reason); + virtual ble_error_t disconnect(DisconnectionReason_t reason); + + virtual ble_error_t setDeviceName(const uint8_t *deviceName); + virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP); + virtual ble_error_t setAppearance(GapAdvertisingData::Appearance appearance); + virtual ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP); + + virtual ble_error_t setTxPower(int8_t txPower); + virtual void getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP); + + void setConnectionHandle(uint16_t con_handle); + uint16_t getConnectionHandle(void); + + virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params); + virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params); + virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params); + + virtual ble_error_t reset(void); + + /* + * The following functions are part of the whitelisting experimental API. + * Therefore, this functionality can change in the near future. + */ + virtual uint8_t getMaxWhitelistSize(void) const; + virtual ble_error_t getWhitelist(Gap::Whitelist_t &whitelistOut) const; + virtual ble_error_t setWhitelist(const Gap::Whitelist_t &whitelistIn); + + virtual ble_error_t setAdvertisingPolicyMode(AdvertisingPolicyMode_t mode); + virtual ble_error_t setScanningPolicyMode(ScanningPolicyMode_t mode); + virtual ble_error_t setInitiatorPolicyMode(InitiatorPolicyMode_t mode); + virtual Gap::AdvertisingPolicyMode_t getAdvertisingPolicyMode(void) const; + virtual Gap::ScanningPolicyMode_t getScanningPolicyMode(void) const; + virtual Gap::InitiatorPolicyMode_t getInitiatorPolicyMode(void) const; + + virtual ble_error_t initRadioNotification(void) { + if (ble_radio_notification_init(APP_IRQ_PRIORITY_HIGH /*MID*/, NRF_RADIO_NOTIFICATION_DISTANCE_800US, radioNotificationStaticCallback) == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } + + return BLE_ERROR_UNSPECIFIED; + } + +/* Observer role is not supported by S110, return BLE_ERROR_NOT_IMPLEMENTED */ +#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) + virtual ble_error_t startRadioScan(const GapScanningParams &scanningParams); + virtual ble_error_t stopScan(void); +#endif + +private: + /* + * Whitelisting API related structures and helper functions. + */ + + /* Policy modes set by the user. By default these are set to ignore the whitelist */ + Gap::AdvertisingPolicyMode_t advertisingPolicyMode; + Gap::ScanningPolicyMode_t scanningPolicyMode; + + /* Internal representation of a whitelist */ + uint8_t whitelistAddressesSize; + ble_gap_addr_t whitelistAddresses[YOTTA_CFG_WHITELIST_MAX_SIZE]; + + /* + * An internal function used to populate the ble_gap_whitelist_t that will be used by + * the SoftDevice for filtering requests. This function is needed because for the BLE + * API the whitelist is just a collection of keys, but for the stack it also includes + * the IRK table. + */ + ble_error_t generateStackWhitelist(ble_gap_whitelist_t &whitelist); + +private: + bool radioNotificationCallbackParam; /* parameter to be passed into the Timeout-generated radio notification callback. */ + Timeout radioNotificationTimeout; + + /* + * A helper function to post radio notification callbacks with low interrupt priority. + */ + void postRadioNotificationCallback(void) { +#ifdef YOTTA_CFG_MBED_OS + /* + * In mbed OS, all user-facing BLE events (interrupts) are posted to the + * MINAR scheduler to be executed as callbacks in thread mode. MINAR guards + * its critical sections from interrupts by acquiring CriticalSectionLock, + * which results in a call to sd_nvic_critical_region_enter(). Thus, it is + * safe to invoke MINAR APIs from interrupt context as long as those + * interrupts are blocked by sd_nvic_critical_region_enter(). + * + * Radio notifications are a special case for the above. The Radio + * Notification IRQ is handled at a very high priority--higher than the + * level blocked by sd_nvic_critical_region_enter(). Thus Radio Notification + * events can preempt MINAR's critical sections. Using MINAR APIs (such as + * posting an event) directly in processRadioNotification() may result in a + * race condition ending in a hard-fault. + * + * The solution is to *not* call MINAR APIs directly from the Radio + * Notification handling; i.e. to do the bulk of RadioNotification + * processing at a reduced priority which respects MINAR's critical + * sections. Unfortunately, on a cortex-M0, there is no clean way to demote + * priority for the currently executing interrupt--we wouldn't want to + * demote the radio notification handling anyway because it is sensitive to + * timing, and the system expects to finish this handling very quickly. The + * workaround is to employ a Timeout to trigger + * postRadioNotificationCallback() after a very short delay (~0 us) and post + * the MINAR callback that context. + * + * !!!WARNING!!! Radio notifications are very time critical events. The + * current solution is expected to work under the assumption that + * postRadioNotificationCalback() will be executed BEFORE the next radio + * notification event is generated. + */ + minar::Scheduler::postCallback( + mbed::util::FunctionPointer1(&radioNotificationCallback, &FunctionPointerWithContext::call).bind(radioNotificationCallbackParam) + ); +#else + /* + * In mbed classic, all user-facing BLE events execute callbacks in interrupt + * mode. Radio Notifications are a special case because its IRQ is handled at + * a very high priority. Thus Radio Notification events can preempt other + * operations that require interaction with the SoftDevice such as advertising + * payload updates and changing the Gap state. Therefore, executing a Radio + * Notification callback directly from processRadioNotification() may result + * in a race condition ending in a hard-fault. + * + * The solution is to *not* execute the Radio Notification callback directly + * from the Radio Notification handling; i.e. to do the bulk of the + * Radio Notification processing at a reduced priority. Unfortunately, on a + * cortex-M0, there is no clean way to demote priority for the currently + * executing interrupt--we wouldn't want to demote the radio notification + * handling anyway because it is sensitive to timing, and the system expects + * to finish this handling very quickly. The workaround is to employ a Timeout + * to trigger postRadioNotificationCallback() after a very short delay (~0 us) + * and execute the callback in that context. + * + * !!!WARNING!!! Radio notifications are very time critical events. The + * current solution is expected to work under the assumption that + * postRadioNotificationCalback() will be executed BEFORE the next radio + * notification event is generated. + */ + radioNotificationCallback.call(radioNotificationCallbackParam); +#endif /* #ifdef YOTTA_CFG_MBED_OS */ + } + + /** + * A helper function to process radio-notification events; to be called internally. + * @param param [description] + */ + void processRadioNotificationEvent(bool param) { + radioNotificationCallbackParam = param; + radioNotificationTimeout.attach_us(mbed::callback(this, &nRF5xGap::postRadioNotificationCallback), 0); + } + friend void radioNotificationStaticCallback(bool param); /* allow invocations of processRadioNotificationEvent() */ + +private: + uint16_t m_connectionHandle; + + /* + * Allow instantiation from nRF5xn when required. + */ + friend class nRF5xn; + + nRF5xGap() : + advertisingPolicyMode(Gap::ADV_POLICY_IGNORE_WHITELIST), + scanningPolicyMode(Gap::SCAN_POLICY_IGNORE_WHITELIST), + whitelistAddressesSize(0) { + m_connectionHandle = BLE_CONN_HANDLE_INVALID; + } + + nRF5xGap(nRF5xGap const &); + void operator=(nRF5xGap const &); +}; + +#endif // ifndef __NRF5x_GAP_H__ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattClient.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattClient.cpp new file mode 100644 index 0000000000..e79e47afa2 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattClient.cpp @@ -0,0 +1,50 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nRF5xGattClient.h" + +#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) +ble_error_t +nRF5xGattClient::launchServiceDiscovery(Gap::Handle_t connectionHandle, + ServiceDiscovery::ServiceCallback_t sc, + ServiceDiscovery::CharacteristicCallback_t cc, + const UUID &matchingServiceUUIDIn, + const UUID &matchingCharacteristicUUIDIn) +{ + return _discovery.launch(connectionHandle, sc, cc, matchingServiceUUIDIn, matchingCharacteristicUUIDIn); +} + +ble_error_t nRF5xGattClient::discoverCharacteristicDescriptors( + const DiscoveredCharacteristic& characteristic, + const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback, + const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback) +{ + return _characteristicDescriptorDiscoverer.launch( + characteristic, + discoveryCallback, + terminationCallback + ); +} + +bool nRF5xGattClient::isCharacteristicDescriptorsDiscoveryActive(const DiscoveredCharacteristic& characteristic) const { + return _characteristicDescriptorDiscoverer.isActive(characteristic); +} + +void nRF5xGattClient::terminateCharacteristicDescriptorsDiscovery(const DiscoveredCharacteristic& characteristic) { + return _characteristicDescriptorDiscoverer.requestTerminate(characteristic); +} + +#endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattClient.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattClient.h new file mode 100644 index 0000000000..5670d15b9d --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattClient.h @@ -0,0 +1,218 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NRF51822_GATT_CLIENT_H__ +#define __NRF51822_GATT_CLIENT_H__ + +#include "ble/GattClient.h" +#include "nRF5xServiceDiscovery.h" +#include "nRF5xCharacteristicDescriptorDiscoverer.h" + +class nRF5xGattClient : public GattClient +{ +public: + /** + * When using S110, all Gatt client features will return + * BLE_ERROR_NOT_IMPLEMENTED + */ +#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) + + /** + * Launch service discovery. Once launched, service discovery will remain + * active with callbacks being issued back into the application for matching + * services/characteristics. isActive() can be used to determine status; and + * a termination callback (if setup) will be invoked at the end. Service + * discovery can be terminated prematurely if needed using terminate(). + * + * @param connectionHandle + * Handle for the connection with the peer. + * @param sc + * This is the application callback for matching service. Taken as + * NULL by default. Note: service discovery may still be active + * when this callback is issued; calling asynchronous BLE-stack + * APIs from within this application callback might cause the + * stack to abort service discovery. If this becomes an issue, it + * may be better to make local copy of the discoveredService and + * wait for service discovery to terminate before operating on the + * service. + * @param cc + * This is the application callback for matching characteristic. + * Taken as NULL by default. Note: service discovery may still be + * active when this callback is issued; calling asynchronous + * BLE-stack APIs from within this application callback might cause + * the stack to abort service discovery. If this becomes an issue, + * it may be better to make local copy of the discoveredCharacteristic + * and wait for service discovery to terminate before operating on the + * characteristic. + * @param matchingServiceUUID + * UUID based filter for specifying a service in which the application is + * interested. By default it is set as the wildcard UUID_UNKNOWN, + * in which case it matches all services. If characteristic-UUID + * filter (below) is set to the wildcard value, then a service + * callback will be invoked for the matching service (or for every + * service if the service filter is a wildcard). + * @param matchingCharacteristicUUIDIn + * UUID based filter for specifying characteristic in which the application + * is interested. By default it is set as the wildcard UUID_UKNOWN + * to match against any characteristic. If both service-UUID + * filter and characteristic-UUID filter are used with non- wildcard + * values, then only a single characteristic callback is + * invoked for the matching characteristic. + * + * @Note Using wildcard values for both service-UUID and characteristic- + * UUID will result in complete service discovery--callbacks being + * called for every service and characteristic. + * + * @return + * BLE_ERROR_NONE if service discovery is launched successfully; else an appropriate error. + */ + virtual ble_error_t launchServiceDiscovery(Gap::Handle_t connectionHandle, + ServiceDiscovery::ServiceCallback_t sc = NULL, + ServiceDiscovery::CharacteristicCallback_t cc = NULL, + const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN), + const UUID &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)); + + virtual void onServiceDiscoveryTermination(ServiceDiscovery::TerminationCallback_t callback) { + _discovery.onTermination(callback); + } + + /** + * Is service-discovery currently active? + */ + virtual bool isServiceDiscoveryActive(void) const { + return _discovery.isActive(); + } + + /** + * Terminate an ongoing service-discovery. This should result in an + * invocation of the TerminationCallback if service-discovery is active. + */ + virtual void terminateServiceDiscovery(void) { + _discovery.terminate(); + } + + /** + * @brief Implementation of GattClient::discoverCharacteristicDescriptors + * @see GattClient::discoverCharacteristicDescriptors + */ + virtual ble_error_t discoverCharacteristicDescriptors( + const DiscoveredCharacteristic& characteristic, + const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback, + const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback + ); + + /** + * @brief Implementation of GattClient::isCharacteristicDiscoveryActive + * @see GattClient::isCharacteristicDiscoveryActive + */ + virtual bool isCharacteristicDescriptorsDiscoveryActive(const DiscoveredCharacteristic& characteristic) const; + + /** + * @brief Implementation of GattClient::terminateCharacteristicDiscovery + * @see GattClient::terminateCharacteristicDiscovery + */ + virtual void terminateCharacteristicDescriptorsDiscovery(const DiscoveredCharacteristic& characteristic); + + virtual ble_error_t read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const { + uint32_t rc = sd_ble_gattc_read(connHandle, attributeHandle, offset); + if (rc == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } + switch (rc) { + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + case BLE_ERROR_INVALID_CONN_HANDLE: + case NRF_ERROR_INVALID_STATE: + case NRF_ERROR_INVALID_ADDR: + default: + return BLE_ERROR_INVALID_STATE; + } + } + + virtual ble_error_t write(GattClient::WriteOp_t cmd, Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, size_t length, const uint8_t *value) const { + ble_gattc_write_params_t writeParams; + writeParams.write_op = cmd; + writeParams.flags = 0; /* this is inconsequential */ + writeParams.handle = attributeHandle; + writeParams.offset = 0; + writeParams.len = length; + writeParams.p_value = const_cast(value); + + uint32_t rc = sd_ble_gattc_write(connHandle, &writeParams); + if (rc == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } + switch (rc) { + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + case BLE_ERROR_NO_TX_PACKETS: + return BLE_ERROR_NO_MEM; + case BLE_ERROR_INVALID_CONN_HANDLE: + case NRF_ERROR_INVALID_STATE: + case NRF_ERROR_INVALID_ADDR: + default: + return BLE_ERROR_INVALID_STATE; + } + } + + /** + * @brief Clear nRF5xGattClient's state. + * + * @return + * BLE_ERROR_NONE if successful. + */ + virtual ble_error_t reset(void) { + /* Clear all state that is from the parent, including private members */ + if (GattClient::reset() != BLE_ERROR_NONE) { + return BLE_ERROR_INVALID_STATE; + } + + /* Clear derived class members */ + _discovery.reset(); + + return BLE_ERROR_NONE; + } + +public: + /* + * Allow instantiation from nRF5xn when required. + */ + friend class nRF5xn; + + nRF5xGattClient() : _discovery(this) { + /* empty */ + } + + nRF5xServiceDiscovery& discovery() { + return _discovery; + } + + nRF5xCharacteristicDescriptorDiscoverer& characteristicDescriptorDiscoverer() { + return _characteristicDescriptorDiscoverer; + } + +private: + nRF5xGattClient(const nRF5xGattClient &); + const nRF5xGattClient& operator=(const nRF5xGattClient &); + +private: + nRF5xServiceDiscovery _discovery; + nRF5xCharacteristicDescriptorDiscoverer _characteristicDescriptorDiscoverer; + +#endif // if !S110 +}; + +#endif // ifndef __NRF51822_GATT_CLIENT_H__ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.cpp new file mode 100644 index 0000000000..4a52030524 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.cpp @@ -0,0 +1,792 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nRF5xGattServer.h" +#ifdef YOTTA_CFG_MBED_OS + #include "mbed-drivers/mbed.h" +#else + #include "mbed.h" +#endif + +#include "common/common.h" +#include "btle/custom/custom_helper.h" + +#include "nRF5xn.h" + +namespace { + +static const ble_gatts_rw_authorize_reply_params_t write_auth_queue_full_reply = { + .type = BLE_GATTS_AUTHORIZE_TYPE_WRITE, + .params = { + .write = { + .gatt_status = BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL + } + } +}; + +static const ble_gatts_rw_authorize_reply_params_t write_auth_invalid_offset_reply = { + .type = BLE_GATTS_AUTHORIZE_TYPE_WRITE, + .params = { + .write = { + .gatt_status = BLE_GATT_STATUS_ATTERR_INVALID_OFFSET + } + } +}; + +static const ble_gatts_rw_authorize_reply_params_t write_auth_succes_reply = { + .type = BLE_GATTS_AUTHORIZE_TYPE_WRITE, + .params = { + .write = { + .gatt_status = BLE_GATT_STATUS_SUCCESS, + .update = 0 + } + } +}; + +static const ble_gatts_rw_authorize_reply_params_t write_auth_invalid_reply = { + .type = BLE_GATTS_AUTHORIZE_TYPE_WRITE, + .params = { + .write = { + .gatt_status = BLE_GATT_STATUS_ATTERR_INVALID + } + } +}; + +} + +/**************************************************************************/ +/*! + @brief Adds a new service to the GATT table on the peripheral + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly + + @section EXAMPLE + + @code + + @endcode +*/ +/**************************************************************************/ +ble_error_t nRF5xGattServer::addService(GattService &service) +{ + /* ToDo: Make sure this service UUID doesn't already exist (?) */ + /* ToDo: Basic validation */ + + /* Add the service to the nRF51 */ + ble_uuid_t nordicUUID; + nordicUUID = custom_convert_to_nordic_uuid(service.getUUID()); + + uint16_t serviceHandle; + ASSERT_TRUE( ERROR_NONE == + sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &nordicUUID, + &serviceHandle), + BLE_ERROR_PARAM_OUT_OF_RANGE ); + service.setHandle(serviceHandle); + + /* Add characteristics to the service */ + for (uint8_t i = 0; i < service.getCharacteristicCount(); i++) { + if (characteristicCount >= BLE_TOTAL_CHARACTERISTICS) { + return BLE_ERROR_NO_MEM; + } + GattCharacteristic *p_char = service.getCharacteristic(i); + + /* Skip any incompletely defined, read-only characteristics. */ + if ((p_char->getValueAttribute().getValuePtr() == NULL) && + (p_char->getValueAttribute().getLength() == 0) && + (p_char->getProperties() == GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ)) { + continue; + } + + nordicUUID = custom_convert_to_nordic_uuid(p_char->getValueAttribute().getUUID()); + + /* The user-description descriptor is a special case which needs to be + * handled at the time of adding the characteristic. The following block + * is meant to discover its presence. */ + const uint8_t *userDescriptionDescriptorValuePtr = NULL; + uint16_t userDescriptionDescriptorValueLen = 0; + for (uint8_t j = 0; j < p_char->getDescriptorCount(); j++) { + GattAttribute *p_desc = p_char->getDescriptor(j); + if (p_desc->getUUID() == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) { + userDescriptionDescriptorValuePtr = p_desc->getValuePtr(); + userDescriptionDescriptorValueLen = p_desc->getLength(); + } + } + + ASSERT_TRUE ( ERROR_NONE == + custom_add_in_characteristic(BLE_GATT_HANDLE_INVALID, + &nordicUUID, + p_char->getProperties(), + p_char->getRequiredSecurity(), + p_char->getValueAttribute().getValuePtr(), + p_char->getValueAttribute().getLength(), + p_char->getValueAttribute().getMaxLength(), + p_char->getValueAttribute().hasVariableLength(), + userDescriptionDescriptorValuePtr, + userDescriptionDescriptorValueLen, + p_char->isReadAuthorizationEnabled(), + p_char->isWriteAuthorizationEnabled(), + &nrfCharacteristicHandles[characteristicCount]), + BLE_ERROR_PARAM_OUT_OF_RANGE ); + + /* Update the characteristic handle */ + p_characteristics[characteristicCount] = p_char; + p_char->getValueAttribute().setHandle(nrfCharacteristicHandles[characteristicCount].value_handle); + characteristicCount++; + + /* Add optional descriptors if any */ + for (uint8_t j = 0; j < p_char->getDescriptorCount(); j++) { + if (descriptorCount >= BLE_TOTAL_DESCRIPTORS) { + return BLE_ERROR_NO_MEM; + } + + GattAttribute *p_desc = p_char->getDescriptor(j); + /* skip the user-description-descriptor here; this has already been handled when adding the characteristic (above). */ + if (p_desc->getUUID() == BLE_UUID_DESCRIPTOR_CHAR_USER_DESC) { + continue; + } + + nordicUUID = custom_convert_to_nordic_uuid(p_desc->getUUID()); + + ASSERT_TRUE(ERROR_NONE == + custom_add_in_descriptor(BLE_GATT_HANDLE_INVALID, + &nordicUUID, + p_desc->getValuePtr(), + p_desc->getLength(), + p_desc->getMaxLength(), + p_desc->hasVariableLength(), + &nrfDescriptorHandles[descriptorCount]), + BLE_ERROR_PARAM_OUT_OF_RANGE); + + p_descriptors[descriptorCount] = p_desc; + p_desc->setHandle(nrfDescriptorHandles[descriptorCount]); + descriptorCount++; + } + } + + serviceCount++; + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Reads the value of a characteristic, based on the service + and characteristic index fields + + @param[in] attributeHandle + The handle of the GattCharacteristic to read from + @param[in] buffer + Buffer to hold the the characteristic's value + (raw byte array in LSB format) + @param[in/out] len + input: Length in bytes to be read. + output: Total length of attribute value upon successful return. + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly +*/ +/**************************************************************************/ +ble_error_t nRF5xGattServer::read(GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) +{ + return read(BLE_CONN_HANDLE_INVALID, attributeHandle, buffer, lengthP); +} + +ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) +{ + ble_gatts_value_t value = { + .len = *lengthP, + .offset = 0, + .p_value = buffer, + }; + + ASSERT_TRUE( ERROR_NONE == + sd_ble_gatts_value_get(connectionHandle, attributeHandle, &value), + BLE_ERROR_PARAM_OUT_OF_RANGE); + *lengthP = value.len; + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Updates the value of a characteristic, based on the service + and characteristic index fields + + @param[in] charHandle + The handle of the GattCharacteristic to write to + @param[in] buffer + Data to use when updating the characteristic's value + (raw byte array in LSB format) + @param[in] len + The number of bytes in buffer + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly +*/ +/**************************************************************************/ +ble_error_t nRF5xGattServer::write(GattAttribute::Handle_t attributeHandle, const uint8_t buffer[], uint16_t len, bool localOnly) +{ + return write(BLE_CONN_HANDLE_INVALID, attributeHandle, buffer, len, localOnly); +} + +ble_error_t nRF5xGattServer::write(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const uint8_t buffer[], uint16_t len, bool localOnly) +{ + ble_error_t returnValue = BLE_ERROR_NONE; + + ble_gatts_value_t value = { + .len = len, + .offset = 0, + .p_value = const_cast(buffer), + }; + + if (localOnly) { + /* Only update locally regardless of notify/indicate */ + ASSERT_INT( ERROR_NONE, + sd_ble_gatts_value_set(connectionHandle, attributeHandle, &value), + BLE_ERROR_PARAM_OUT_OF_RANGE ); + return BLE_ERROR_NONE; + } + + int characteristicIndex = resolveValueHandleToCharIndex(attributeHandle); + if ((characteristicIndex != -1) && + (p_characteristics[characteristicIndex]->getProperties() & (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_INDICATE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY))) { + /* HVX update for the characteristic value */ + ble_gatts_hvx_params_t hvx_params; + + hvx_params.handle = attributeHandle; + hvx_params.type = + (p_characteristics[characteristicIndex]->getProperties() & GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) ? BLE_GATT_HVX_NOTIFICATION : BLE_GATT_HVX_INDICATION; + hvx_params.offset = 0; + hvx_params.p_data = const_cast(buffer); + hvx_params.p_len = &len; + + if (connectionHandle == BLE_CONN_HANDLE_INVALID) { /* use the default connection handle if the caller hasn't specified a valid connectionHandle. */ + nRF5xGap &gap = (nRF5xGap &) nRF5xn::Instance(BLE::DEFAULT_INSTANCE).getGap(); + connectionHandle = gap.getConnectionHandle(); + } + error_t error = (error_t) sd_ble_gatts_hvx(connectionHandle, &hvx_params); + if (error != ERROR_NONE) { + switch (error) { + case ERROR_BLE_NO_TX_BUFFERS: /* Notifications consume application buffers. The return value can be used for resending notifications. */ + case ERROR_BUSY: + returnValue = BLE_STACK_BUSY; + break; + + case ERROR_INVALID_STATE: + case ERROR_BLEGATTS_SYS_ATTR_MISSING: + returnValue = BLE_ERROR_INVALID_STATE; + break; + + default : + ASSERT_INT( ERROR_NONE, + sd_ble_gatts_value_set(connectionHandle, attributeHandle, &value), + BLE_ERROR_PARAM_OUT_OF_RANGE ); + + /* Notifications consume application buffers. The return value can + * be used for resending notifications. */ + returnValue = BLE_STACK_BUSY; + break; + } + } + } else { + uint32_t err = sd_ble_gatts_value_set(connectionHandle, attributeHandle, &value); + switch(err) { + case NRF_SUCCESS: + returnValue = BLE_ERROR_NONE; + break; + case NRF_ERROR_INVALID_ADDR: + case NRF_ERROR_INVALID_PARAM: + returnValue = BLE_ERROR_INVALID_PARAM; + break; + case NRF_ERROR_NOT_FOUND: + case NRF_ERROR_DATA_SIZE: + case BLE_ERROR_INVALID_CONN_HANDLE: + case BLE_ERROR_GATTS_INVALID_ATTR_TYPE: + returnValue = BLE_ERROR_PARAM_OUT_OF_RANGE; + break; + case NRF_ERROR_FORBIDDEN: + returnValue = BLE_ERROR_OPERATION_NOT_PERMITTED; + break; + default: + returnValue = BLE_ERROR_UNSPECIFIED; + break; + } + } + + return returnValue; +} + +ble_error_t nRF5xGattServer::areUpdatesEnabled(const GattCharacteristic &characteristic, bool *enabledP) +{ + /* Forward the call with the default connection handle. */ + nRF5xGap &gap = (nRF5xGap &) nRF5xn::Instance(BLE::DEFAULT_INSTANCE).getGap(); + return areUpdatesEnabled(gap.getConnectionHandle(), characteristic, enabledP); +} + +ble_error_t nRF5xGattServer::areUpdatesEnabled(Gap::Handle_t connectionHandle, const GattCharacteristic &characteristic, bool *enabledP) +{ + int characteristicIndex = resolveValueHandleToCharIndex(characteristic.getValueHandle()); + if (characteristicIndex == -1) { + return BLE_ERROR_INVALID_PARAM; + } + + /* Read the cccd value from the GATT server. */ + GattAttribute::Handle_t cccdHandle = nrfCharacteristicHandles[characteristicIndex].cccd_handle; + uint16_t cccdValue; + uint16_t length = sizeof(cccdValue); + ble_error_t rc = read(connectionHandle, cccdHandle, reinterpret_cast(&cccdValue), &length); + if (rc != BLE_ERROR_NONE) { + return rc; + } + if (length != sizeof(cccdValue)) { + return BLE_ERROR_INVALID_STATE; + } + + /* Check for NOTFICATION or INDICATION in CCCD. */ + if ((cccdValue & BLE_GATT_HVX_NOTIFICATION) || (cccdValue & BLE_GATT_HVX_INDICATION)) { + *enabledP = true; + } + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Clear nRF5xGattServer's state. + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly +*/ +/**************************************************************************/ +ble_error_t nRF5xGattServer::reset(void) +{ + /* Clear all state that is from the parent, including private members */ + if (GattServer::reset() != BLE_ERROR_NONE) { + return BLE_ERROR_INVALID_STATE; + } + + /* Clear derived class members */ + memset(p_characteristics, 0, sizeof(p_characteristics)); + memset(p_descriptors, 0, sizeof(p_descriptors)); + memset(nrfCharacteristicHandles, 0, sizeof(ble_gatts_char_handles_t)); + memset(nrfDescriptorHandles, 0, sizeof(nrfDescriptorHandles)); + descriptorCount = 0; + + releaseAllWriteRequests(); + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Callback handler for events getting pushed up from the SD +*/ +/**************************************************************************/ +void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt) +{ + GattAttribute::Handle_t handle_value; + GattServerEvents::gattEvent_t eventType; + const ble_gatts_evt_t *gattsEventP = &p_ble_evt->evt.gatts_evt; + + switch (p_ble_evt->header.evt_id) { + case BLE_GATTS_EVT_WRITE: { + /* There are 2 use case here: Values being updated & CCCD (indicate/notify) enabled */ + + /* 1.) Handle CCCD changes */ + handle_value = gattsEventP->params.write.handle; + int characteristicIndex = resolveCCCDHandleToCharIndex(handle_value); + if ((characteristicIndex != -1) && + (p_characteristics[characteristicIndex]->getProperties() & + (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_INDICATE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY))) { + + uint16_t cccd_value = (gattsEventP->params.write.data[1] << 8) | gattsEventP->params.write.data[0]; /* Little Endian but M0 may be mis-aligned */ + + if (((p_characteristics[characteristicIndex]->getProperties() & GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_INDICATE) && (cccd_value & BLE_GATT_HVX_INDICATION)) || + ((p_characteristics[characteristicIndex]->getProperties() & GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) && (cccd_value & BLE_GATT_HVX_NOTIFICATION))) { + eventType = GattServerEvents::GATT_EVENT_UPDATES_ENABLED; + } else { + eventType = GattServerEvents::GATT_EVENT_UPDATES_DISABLED; + } + + handleEvent(eventType, p_characteristics[characteristicIndex]->getValueHandle()); + return; + } + + /* 2.) Changes to the characteristic value will be handled with other events below */ + eventType = GattServerEvents::GATT_EVENT_DATA_WRITTEN; + } + break; + + case BLE_GATTS_EVT_HVC: + /* Indication confirmation received */ + eventType = GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED; + handle_value = gattsEventP->params.hvc.handle; + break; + + case BLE_EVT_TX_COMPLETE: { + handleDataSentEvent(p_ble_evt->evt.common_evt.params.tx_complete.count); + return; + } + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + sd_ble_gatts_sys_attr_set(gattsEventP->conn_handle, NULL, 0, 0); + return; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + switch (gattsEventP->params.authorize_request.type) { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + eventType = GattServerEvents::GATT_EVENT_READ_AUTHORIZATION_REQ; + handle_value = gattsEventP->params.authorize_request.request.read.handle; + break; + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + eventType = GattServerEvents::GATT_EVENT_WRITE_AUTHORIZATION_REQ; + handle_value = gattsEventP->params.authorize_request.request.write.handle; + break; + default: + return; + } + break; + + case BLE_EVT_USER_MEM_REQUEST: { + uint16_t conn_handle = p_ble_evt->evt.common_evt.conn_handle; + + // allocate a new long request for this connection + // NOTE: we don't care about the result at this stage, + // it is not possible to cancel the operation anyway. + // If the request was not allocated then it will gracefully failled + // at subsequent stages. + allocateLongWriteRequest(conn_handle); + sd_ble_user_mem_reply(conn_handle, NULL); + return; + } + + default: + return; + } + + int characteristicIndex = resolveValueHandleToCharIndex(handle_value); + if (characteristicIndex == -1) { + // filter out the case were the request is a long one, + // and there is no attribute handle provided + uint8_t write_op = gattsEventP->params.authorize_request.request.write.op; + if (eventType != GattServerEvents::GATT_EVENT_WRITE_AUTHORIZATION_REQ || + (write_op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW && + write_op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL)) { + return; + } + } + + /* Find index (charHandle) in the pool */ + switch (eventType) { + case GattServerEvents::GATT_EVENT_DATA_WRITTEN: { + GattWriteCallbackParams cbParams = { + .connHandle = gattsEventP->conn_handle, + .handle = handle_value, + .writeOp = static_cast(gattsEventP->params.write.op), + .offset = gattsEventP->params.write.offset, + .len = gattsEventP->params.write.len, + .data = gattsEventP->params.write.data + }; + handleDataWrittenEvent(&cbParams); + break; + } + case GattServerEvents::GATT_EVENT_WRITE_AUTHORIZATION_REQ: { + uint16_t conn_handle = gattsEventP->conn_handle; + const ble_gatts_evt_write_t& input_req = gattsEventP->params.authorize_request.request.write; + const uint16_t max_size = getBiggestCharacteristicSize(); + + // this is a long write request, handle it here. + switch (input_req.op) { + case BLE_GATTS_OP_PREP_WRITE_REQ: { + // verify that the request is not outside of the possible range + if ((input_req.offset + input_req.len) > max_size) { + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_invalid_offset_reply); + releaseLongWriteRequest(conn_handle); + return; + } + + // find the write request + long_write_request_t* req = findLongWriteRequest(conn_handle); + if (!req) { + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_invalid_reply); + return; + } + + // initialize the first request by setting the offset + if (req->length == 0) { + req->attr_handle = input_req.handle; + req->offset = input_req.offset; + } else { + // it should be the subsequent write + if ((req->offset + req->length) != input_req.offset) { + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_invalid_offset_reply); + releaseLongWriteRequest(conn_handle); + return; + } + + // it is not allowed to write multiple characteristic with the same request + if (input_req.handle != req->attr_handle) { + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_invalid_reply); + releaseLongWriteRequest(conn_handle); + return; + } + } + + // start the copy of what is in input + memcpy(req->data + req->length, input_req.data, input_req.len); + + // update the lenght of the data written + req->length = req->length + input_req.len; + + // success, signal it to the softdevice + ble_gatts_rw_authorize_reply_params_t reply = { + .type = BLE_GATTS_AUTHORIZE_TYPE_WRITE, + .params = { + .write = { + .gatt_status = BLE_GATT_STATUS_SUCCESS, + .update = 1, + .offset = input_req.offset, + .len = input_req.len, + .p_data = input_req.data + } + } + }; + + sd_ble_gatts_rw_authorize_reply(conn_handle, &reply); + } return; + + case BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL: { + releaseLongWriteRequest(conn_handle); + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_succes_reply); + } return; + + case BLE_GATTS_OP_EXEC_WRITE_REQ_NOW: { + long_write_request_t* req = findLongWriteRequest(conn_handle); + if (!req) { + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_invalid_reply); + return; + } + + GattWriteAuthCallbackParams cbParams = { + .connHandle = conn_handle, + .handle = req->attr_handle, + .offset = req->offset, + .len = req->length, + .data = req->data, + .authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member + * set to AUTH_CALLBACK_REPLY_SUCCESS if the client + * request is to proceed. */ + }; + uint16_t write_authorization = p_characteristics[characteristicIndex]->authorizeWrite(&cbParams); + + // the user code didn't provide the write authorization, + // just leave here. + if (write_authorization != AUTH_CALLBACK_REPLY_SUCCESS) { + // report the status of the operation in any cases + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_invalid_reply); + releaseLongWriteRequest(conn_handle); + return; + } + + // FIXME can't use ::write here, this function doesn't take the offset into account ... + ble_gatts_value_t value = { + .len = req->length, + .offset = req->offset, + .p_value = req->data + }; + uint32_t update_err = sd_ble_gatts_value_set(conn_handle, req->attr_handle, &value); + if (update_err) { + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_invalid_reply); + releaseLongWriteRequest(conn_handle); + return; + } + + sd_ble_gatts_rw_authorize_reply(conn_handle, &write_auth_succes_reply); + + GattWriteCallbackParams writeParams = { + .connHandle = conn_handle, + .handle = req->attr_handle, + .writeOp = static_cast(input_req.op), + .offset = req->offset, + .len = req->length, + .data = req->data, + }; + handleDataWrittenEvent(&writeParams); + releaseLongWriteRequest(conn_handle); + } return; + } + + GattWriteAuthCallbackParams cbParams = { + .connHandle = gattsEventP->conn_handle, + .handle = handle_value, + .offset = gattsEventP->params.authorize_request.request.write.offset, + .len = gattsEventP->params.authorize_request.request.write.len, + .data = gattsEventP->params.authorize_request.request.write.data, + .authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member + * set to AUTH_CALLBACK_REPLY_SUCCESS if the client + * request is to proceed. */ + }; + + ble_gatts_rw_authorize_reply_params_t reply = { + .type = BLE_GATTS_AUTHORIZE_TYPE_WRITE, + .params = { + .write = { + .gatt_status = p_characteristics[characteristicIndex]->authorizeWrite(&cbParams), + .update = 1, + .offset = cbParams.offset, + .len = cbParams.len, + .p_data = cbParams.data + } + } + }; + + if (reply.params.write.gatt_status != BLE_GATT_STATUS_SUCCESS) + { + reply.params.write.update = 0; + } + + sd_ble_gatts_rw_authorize_reply(gattsEventP->conn_handle, &reply); + + /* + * If write-authorization is enabled for a characteristic, + * AUTHORIZATION_REQ event (if replied with true) is *not* + * followed by another DATA_WRITTEN event; so we still need + * to invoke handleDataWritten(), much the same as we would + * have done if write-authorization had not been enabled. + */ + if (reply.params.write.gatt_status == BLE_GATT_STATUS_SUCCESS) { + GattWriteCallbackParams cbParams = { + .connHandle = gattsEventP->conn_handle, + .handle = handle_value, + .writeOp = static_cast(gattsEventP->params.authorize_request.request.write.op), + .offset = gattsEventP->params.authorize_request.request.write.offset, + .len = gattsEventP->params.authorize_request.request.write.len, + .data = gattsEventP->params.authorize_request.request.write.data, + }; + handleDataWrittenEvent(&cbParams); + } + break; + } + case GattServerEvents::GATT_EVENT_READ_AUTHORIZATION_REQ: { + GattReadAuthCallbackParams cbParams = { + .connHandle = gattsEventP->conn_handle, + .handle = handle_value, + .offset = gattsEventP->params.authorize_request.request.read.offset, + .len = 0, + .data = NULL, + .authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member + * set to AUTH_CALLBACK_REPLY_SUCCESS if the client + * request is to proceed. */ + }; + + ble_gatts_rw_authorize_reply_params_t reply = { + .type = BLE_GATTS_AUTHORIZE_TYPE_READ, + .params = { + .read = { + .gatt_status = p_characteristics[characteristicIndex]->authorizeRead(&cbParams) + } + } + }; + + if (cbParams.authorizationReply == BLE_GATT_STATUS_SUCCESS) { + if (cbParams.data != NULL) { + reply.params.read.update = 1; + reply.params.read.offset = cbParams.offset; + reply.params.read.len = cbParams.len; + reply.params.read.p_data = cbParams.data; + } + } + + sd_ble_gatts_rw_authorize_reply(gattsEventP->conn_handle, &reply); + break; + } + + default: + handleEvent(eventType, handle_value); + break; + } +} + +uint16_t nRF5xGattServer::getBiggestCharacteristicSize() const { + uint16_t result = 0; + for (size_t i = 0; i < characteristicCount; ++i) { + uint16_t current_size = p_characteristics[i]->getValueAttribute().getMaxLength(); + if (current_size > result) { + result = current_size; + } + } + return result; +} + +nRF5xGattServer::long_write_request_t* nRF5xGattServer::allocateLongWriteRequest(uint16_t connection_handle) { + for (size_t i = 0; i < TOTAL_CONCURRENT_LONG_WRITE_REQUESTS; ++i) { + long_write_request_t& req = long_write_requests[i]; + if (req.data == NULL) { + uint16_t block_size = getBiggestCharacteristicSize(); + req.data = static_cast(malloc(block_size)); + req.offset = 0; + req.length = 0; + req.conn_handle = connection_handle; + return &req; + } + } + // if nothing has been found then return null + return NULL; +} + +bool nRF5xGattServer::releaseLongWriteRequest(uint16_t connection_handle) { + long_write_request_t* req = findLongWriteRequest(connection_handle); + if (!req) { + return false; + } + + free(req->data); + req->data = NULL; + + // the other fields are not relevant, return now + return true; +} + +nRF5xGattServer::long_write_request_t* nRF5xGattServer::findLongWriteRequest(uint16_t connection_handle) { + for (size_t i = 0; i < TOTAL_CONCURRENT_LONG_WRITE_REQUESTS; ++i) { + long_write_request_t& req = long_write_requests[i]; + if (req.data != NULL && req.conn_handle == connection_handle) { + return &req; + } + } + // if nothing has been found then return null + return NULL; +} + +void nRF5xGattServer::releaseAllWriteRequests() { + for (size_t i = 0; i < TOTAL_CONCURRENT_LONG_WRITE_REQUESTS; ++i) { + long_write_request_t& req = long_write_requests[i]; + if (req.data != NULL) { + free(req.data); + req.data = NULL; + } + } +} \ No newline at end of file diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h new file mode 100644 index 0000000000..81481d3e89 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h @@ -0,0 +1,158 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NRF51822_GATT_SERVER_H__ +#define __NRF51822_GATT_SERVER_H__ + +#include + +#include "ble/blecommon.h" +#include "ble.h" /* nordic ble */ +#include "ble/Gap.h" +#include "ble/GattServer.h" + +class nRF5xGattServer : public GattServer +{ +public: + /* Functions that must be implemented from GattServer */ + virtual ble_error_t addService(GattService &); + virtual ble_error_t read(GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP); + virtual ble_error_t read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP); + virtual ble_error_t write(GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false); + virtual ble_error_t write(Gap::Handle_t connectionHandle, GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false); + virtual ble_error_t areUpdatesEnabled(const GattCharacteristic &characteristic, bool *enabledP); + virtual ble_error_t areUpdatesEnabled(Gap::Handle_t connectionHandle, const GattCharacteristic &characteristic, bool *enabledP); + virtual ble_error_t reset(void); + + /* nRF51 Functions */ + void eventCallback(void); + void hwCallback(ble_evt_t *p_ble_evt); + + +private: + const static unsigned BLE_TOTAL_CHARACTERISTICS = 20; + const static unsigned BLE_TOTAL_DESCRIPTORS = 8; + const static unsigned TOTAL_CONCURRENT_LONG_WRITE_REQUESTS = 3; + +private: + struct long_write_request_t { + // the connection handle for a long write request + uint16_t conn_handle; + + // the attribute handle for the long write request + // This implementation folow the bluetooth route + // where a write request target a single characteristic + // (see BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] - 4.9.4) + uint16_t attr_handle; + + // offset of the transaction + uint16_t offset; + + // length of the data + uint16_t length; + + // current data + uint8_t* data; + }; + + +private: + /** + * resolve a value attribute to its owning characteristic. + * @param valueHandle the value handle to be resolved. + * @return characteristic index if a resolution is found, else -1. + */ + int resolveValueHandleToCharIndex(GattAttribute::Handle_t valueHandle) const { + unsigned charIndex; + for (charIndex = 0; charIndex < characteristicCount; charIndex++) { + if (nrfCharacteristicHandles[charIndex].value_handle == valueHandle) { + return charIndex; + } + } + + return -1; + } + + /** + * resolve a CCCD attribute handle to its owning characteristic. + * @param cccdHandle the CCCD handle to be resolved. + * @return characteristic index if a resolution is found, else -1. + */ + int resolveCCCDHandleToCharIndex(GattAttribute::Handle_t cccdHandle) const { + unsigned charIndex; + for (charIndex = 0; charIndex < characteristicCount; charIndex++) { + if (nrfCharacteristicHandles[charIndex].cccd_handle == cccdHandle) { + return charIndex; + } + } + + return -1; + } + + /** + * Return the biggest size used by a characteristic in the server + */ + uint16_t getBiggestCharacteristicSize() const; + + /** + * Allocate a new write long request. return null if no requests are available. + * @param connection_handle The connection handle to be associated with the request. + * @return the allocated request or NULL if no requests are available. + */ + long_write_request_t* allocateLongWriteRequest(uint16_t connection_handle); + + /** + * Release a long write request and free a slot for subsequent write long requests. + * @param connection_handle The connection handle associated with the request + * @return true if the request where allocated and was release, false otherwise. + */ + bool releaseLongWriteRequest(uint16_t connection_handle); + + /** + * Find a long write request from a characteristic handle + * @param connection_handle The connection handle associated with the request. + * @return a pointer to the request if found otherwise NULL. + */ + long_write_request_t* findLongWriteRequest(uint16_t connection_handle); + + /** + * Release all pending write requests. + */ + void releaseAllWriteRequests(); + +private: + GattCharacteristic *p_characteristics[BLE_TOTAL_CHARACTERISTICS]; + ble_gatts_char_handles_t nrfCharacteristicHandles[BLE_TOTAL_CHARACTERISTICS]; + GattAttribute *p_descriptors[BLE_TOTAL_DESCRIPTORS]; + uint8_t descriptorCount; + uint16_t nrfDescriptorHandles[BLE_TOTAL_DESCRIPTORS]; + long_write_request_t long_write_requests[TOTAL_CONCURRENT_LONG_WRITE_REQUESTS]; + + /* + * Allow instantiation from nRF5xn when required. + */ + friend class nRF5xn; + + nRF5xGattServer() : GattServer(), p_characteristics(), nrfCharacteristicHandles(), p_descriptors(), descriptorCount(0), nrfDescriptorHandles(), long_write_requests() { + /* empty */ + } + +private: + nRF5xGattServer(const nRF5xGattServer &); + const nRF5xGattServer& operator=(const nRF5xGattServer &); +}; + +#endif // ifndef __NRF51822_GATT_SERVER_H__ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h new file mode 100644 index 0000000000..2fa7b05511 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h @@ -0,0 +1,174 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NRF51822_SECURITY_MANAGER_H__ +#define __NRF51822_SECURITY_MANAGER_H__ + +#include + +#include "nRF5xGap.h" +#include "ble/SecurityManager.h" +#include "btle_security.h" + +class nRF5xSecurityManager : public SecurityManager +{ +public: + /* Functions that must be implemented from SecurityManager */ + virtual ble_error_t init(bool enableBonding, + bool requireMITM, + SecurityIOCapabilities_t iocaps, + const Passkey_t passkey) { + return btle_initializeSecurity(enableBonding, requireMITM, iocaps, passkey); + } + + virtual ble_error_t getLinkSecurity(Gap::Handle_t connectionHandle, LinkSecurityStatus_t *securityStatusP) { + return btle_getLinkSecurity(connectionHandle, securityStatusP); + } + + virtual ble_error_t setLinkSecurity(Gap::Handle_t connectionHandle, SecurityMode_t securityMode) { + return btle_setLinkSecurity(connectionHandle, securityMode); + } + + virtual ble_error_t purgeAllBondingState(void) { + return btle_purgeAllBondingState(); + } + + /** + * @brief Returns a list of addresses from peers in the stacks bond table. + * + * @param[in/out] addresses + * (on input) @ref Gap::Whitelist_t structure where at + * most addresses.capacity addresses from bonded peers will + * be stored. + * (on output) A copy of the addresses from bonded peers. + * + * @return + * BLE_ERROR_NONE if successful. + */ + virtual ble_error_t getAddressesFromBondTable(Gap::Whitelist_t &addresses) const { + uint8_t i; + + ble_gap_whitelist_t whitelistFromBondTable; + ble_gap_addr_t *addressPtr[YOTTA_CFG_WHITELIST_MAX_SIZE]; + ble_gap_irk_t *irkPtr[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + + /* Initialize the structure so that we get as many addreses as the whitelist can hold */ + whitelistFromBondTable.addr_count = YOTTA_CFG_IRK_TABLE_MAX_SIZE; + whitelistFromBondTable.pp_addrs = addressPtr; + whitelistFromBondTable.irk_count = YOTTA_CFG_IRK_TABLE_MAX_SIZE; + whitelistFromBondTable.pp_irks = irkPtr; + + ble_error_t error = createWhitelistFromBondTable(whitelistFromBondTable); + if (error != BLE_ERROR_NONE) { + addresses.size = 0; + return error; + } + + /* Put all the addresses in the structure */ + for (i = 0; i < whitelistFromBondTable.addr_count; ++i) { + if (i >= addresses.capacity) { + /* Ran out of space in the output Gap::Whitelist_t */ + addresses.size = i; + return BLE_ERROR_NONE; + } + memcpy(&addresses.addresses[i], whitelistFromBondTable.pp_addrs[i], sizeof(BLEProtocol::Address_t)); + } + + /* Update the current address count */ + addresses.size = i; + + /* The assumption here is that the underlying implementation of + * createWhitelistFromBondTable() will not return the private resolvable + * addresses (which is the case in the SoftDevice). Rather it returns the + * IRKs, so we need to generate the private resolvable address by ourselves. + */ + for (i = 0; i < whitelistFromBondTable.irk_count; ++i) { + if (i + addresses.size >= addresses.capacity) { + /* Ran out of space in the output Gap::Whitelist_t */ + addresses.size += i; + return BLE_ERROR_NONE; + } + btle_generateResolvableAddress( + *whitelistFromBondTable.pp_irks[i], + (ble_gap_addr_t &) addresses.addresses[i + addresses.size] + ); + } + + /* Update the current address count */ + addresses.size += i; + + return BLE_ERROR_NONE; + } + + /** + * @brief Clear nRF5xSecurityManager's state. + * + * @return + * BLE_ERROR_NONE if successful. + */ + virtual ble_error_t reset(void) + { + if (SecurityManager::reset() != BLE_ERROR_NONE) { + return BLE_ERROR_INVALID_STATE; + } + + return BLE_ERROR_NONE; + } + + bool hasInitialized(void) const { + return btle_hasInitializedSecurity(); + } + +public: + /* + * Allow instantiation from nRF5xn when required. + */ + friend class nRF5xn; + + nRF5xSecurityManager() { + /* empty */ + } + +private: + nRF5xSecurityManager(const nRF5xSecurityManager &); + const nRF5xSecurityManager& operator=(const nRF5xSecurityManager &); + + /* + * Expose an interface that allows us to query the SoftDevice bond table + * and extract a whitelist. + */ + ble_error_t createWhitelistFromBondTable(ble_gap_whitelist_t &whitelistFromBondTable) const { + return btle_createWhitelistFromBondTable(&whitelistFromBondTable); + } + + /* + * Given a BLE address and a IRK this function check whether the address + * can be generated from the IRK. To do so, this function uses the hash + * function and algorithm described in the Bluetooth low Energy + * Specification. Internally, Nordic SDK functions are used. + */ + bool matchAddressAndIrk(ble_gap_addr_t *address, ble_gap_irk_t *irk) const { + return btle_matchAddressAndIrk(address, irk); + } + + /* + * Give nRF5xGap access to createWhitelistFromBondTable() and + * matchAddressAndIrk() + */ + friend class nRF5xGap; +}; + +#endif // ifndef __NRF51822_SECURITY_MANAGER_H__ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp new file mode 100644 index 0000000000..4bd0da6dd7 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp @@ -0,0 +1,312 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nRF5xServiceDiscovery.h" + +ble_error_t +nRF5xServiceDiscovery::launchCharacteristicDiscovery(Gap::Handle_t connectionHandle, + Gap::Handle_t startHandle, + Gap::Handle_t endHandle) +{ + characteristicDiscoveryStarted(connectionHandle); + + ble_gattc_handle_range_t handleRange = { + .start_handle = startHandle, + .end_handle = endHandle + }; + uint32_t rc = sd_ble_gattc_characteristics_discover(connectionHandle, &handleRange); + ble_error_t err = BLE_ERROR_NONE; + + switch (rc) { + case NRF_SUCCESS: + err = BLE_ERROR_NONE; + break; + case BLE_ERROR_INVALID_CONN_HANDLE: + case NRF_ERROR_INVALID_ADDR: + err = BLE_ERROR_INVALID_PARAM; + break; + case NRF_ERROR_BUSY: + err = BLE_STACK_BUSY; + break; + case NRF_ERROR_INVALID_STATE: + err = BLE_ERROR_INVALID_STATE; + break; + default: + err = BLE_ERROR_UNSPECIFIED; + break; + } + + if (err) { + terminateCharacteristicDiscovery(err); + } + return err; +} + +void +nRF5xServiceDiscovery::setupDiscoveredServices(const ble_gattc_evt_prim_srvc_disc_rsp_t *response) +{ + serviceIndex = 0; + numServices = response->count; + + /* Account for the limitation on the number of discovered services we can handle at a time. */ + if (numServices > BLE_DB_DISCOVERY_MAX_SRV) { + numServices = BLE_DB_DISCOVERY_MAX_SRV; + } + + serviceUUIDDiscoveryQueue.reset(); + for (unsigned i = 0; i < numServices; ++i) { + if (response->services[i].uuid.type == BLE_UUID_TYPE_UNKNOWN) { + serviceUUIDDiscoveryQueue.enqueue(i); + services[i].setup(response->services[i].handle_range.start_handle, + response->services[i].handle_range.end_handle); + } else { + services[i].setup(response->services[i].uuid.uuid, + response->services[i].handle_range.start_handle, + response->services[i].handle_range.end_handle); + } + } + + /* Trigger discovery of service UUID if necessary. */ + if (serviceUUIDDiscoveryQueue.getCount()) { + serviceUUIDDiscoveryQueue.triggerFirst(); + } +} + +void +nRF5xServiceDiscovery::setupDiscoveredCharacteristics(const ble_gattc_evt_char_disc_rsp_t *response) +{ + numCharacteristics = response->count; + + /* Account for the limitation on the number of discovered characteristics we can handle at a time. */ + if (numCharacteristics > BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV) { + numCharacteristics = BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV; + } + + charUUIDDiscoveryQueue.reset(); + for (unsigned charIndex = 0; charIndex < numCharacteristics; charIndex++) { + if (response->chars[charIndex].uuid.type == BLE_UUID_TYPE_UNKNOWN) { + charUUIDDiscoveryQueue.enqueue(charIndex); + characteristics[charIndex].setup(gattc, + connHandle, + response->chars[charIndex].char_props, + response->chars[charIndex].handle_decl, + response->chars[charIndex].handle_value); + } else { + characteristics[charIndex].setup(gattc, + connHandle, + response->chars[charIndex].uuid.uuid, + response->chars[charIndex].char_props, + response->chars[charIndex].handle_decl, + response->chars[charIndex].handle_value); + } + } + + /* Trigger discovery of char UUID if necessary. */ + if (charUUIDDiscoveryQueue.getCount()) { + charUUIDDiscoveryQueue.triggerFirst(); + } +} + +void +nRF5xServiceDiscovery::progressCharacteristicDiscovery(void) +{ + if (state != CHARACTERISTIC_DISCOVERY_ACTIVE) { + return; + } + + if ((discoveredCharacteristic != nRF5xDiscoveredCharacteristic()) && (numCharacteristics > 0)) { + discoveredCharacteristic.setLastHandle(characteristics[0].getDeclHandle() - 1); + + if ((matchingCharacteristicUUID == UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) || + ((matchingCharacteristicUUID == discoveredCharacteristic.getUUID()) && + (matchingServiceUUID != UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)))) { + if (characteristicCallback) { + characteristicCallback(&discoveredCharacteristic); + } + } + } + + for (uint8_t i = 0; i < numCharacteristics; ++i) { + if (state != CHARACTERISTIC_DISCOVERY_ACTIVE) { + return; + } + + if (i == (numCharacteristics - 1)) { + discoveredCharacteristic = characteristics[i]; + break; + } else { + characteristics[i].setLastHandle(characteristics[i + 1].getDeclHandle() - 1); + } + + if ((matchingCharacteristicUUID == UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) || + ((matchingCharacteristicUUID == characteristics[i].getUUID()) && + (matchingServiceUUID != UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)))) { + if (characteristicCallback) { + characteristicCallback(&characteristics[i]); + } + } + } + + if (state != CHARACTERISTIC_DISCOVERY_ACTIVE) { + return; + } + + Gap::Handle_t startHandle = (numCharacteristics > 0) ? characteristics[numCharacteristics - 1].getValueHandle() + 1 : SRV_DISC_END_HANDLE; + Gap::Handle_t endHandle = services[serviceIndex].getEndHandle(); + resetDiscoveredCharacteristics(); /* Note: resetDiscoveredCharacteristics() must come after fetching start and end Handles. */ + + if (startHandle < endHandle) { + ble_gattc_handle_range_t handleRange = { + .start_handle = startHandle, + .end_handle = endHandle + }; + if (sd_ble_gattc_characteristics_discover(connHandle, &handleRange) != NRF_SUCCESS) { + terminateCharacteristicDiscovery(BLE_ERROR_UNSPECIFIED); + } + } else { + terminateCharacteristicDiscovery(BLE_ERROR_NONE); + } +} + +void +nRF5xServiceDiscovery::progressServiceDiscovery(void) +{ + /* Iterate through the previously discovered services cached in services[]. */ + while ((state == SERVICE_DISCOVERY_ACTIVE) && (serviceIndex < numServices)) { + if ((matchingServiceUUID == UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) || + (matchingServiceUUID == services[serviceIndex].getUUID())) { + + if (serviceCallback && (matchingCharacteristicUUID == UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN))) { + serviceCallback(&services[serviceIndex]); + } + + if ((state == SERVICE_DISCOVERY_ACTIVE) && characteristicCallback) { + launchCharacteristicDiscovery(connHandle, services[serviceIndex].getStartHandle(), services[serviceIndex].getEndHandle()); + } else { + serviceIndex++; + } + } else { + serviceIndex++; + } + } + + /* Relaunch discovery of new services beyond the last entry cached in services[]. */ + if ((state == SERVICE_DISCOVERY_ACTIVE) && (numServices > 0) && (serviceIndex > 0)) { + /* Determine the ending handle of the last cached service. */ + Gap::Handle_t endHandle = services[serviceIndex - 1].getEndHandle(); + resetDiscoveredServices(); /* Note: resetDiscoveredServices() must come after fetching endHandle. */ + + if (endHandle == SRV_DISC_END_HANDLE) { + terminateServiceDiscovery(); + } else { + // the next service is located after the last handle discovered + // Launch a new discovery from [endHandle + 1 : 0xFFFF] + if (sd_ble_gattc_primary_services_discover(connHandle, endHandle + 1, NULL) != NRF_SUCCESS) { + terminateServiceDiscovery(); + } + } + } +} + +void +nRF5xServiceDiscovery::ServiceUUIDDiscoveryQueue::triggerFirst(void) +{ + while (numIndices) { /* loop until a call to char_value_by_uuid_read() succeeds or we run out of pending indices. */ + parentDiscoveryObject->state = DISCOVER_SERVICE_UUIDS; + + unsigned serviceIndex = getFirst(); + ble_uuid_t uuid = { + .uuid = BLE_UUID_SERVICE_PRIMARY, + .type = BLE_UUID_TYPE_BLE, + }; + ble_gattc_handle_range_t handleRange = { + .start_handle = parentDiscoveryObject->services[serviceIndex].getStartHandle(), + .end_handle = parentDiscoveryObject->services[serviceIndex].getEndHandle(), + }; + if (sd_ble_gattc_char_value_by_uuid_read(parentDiscoveryObject->connHandle, &uuid, &handleRange) == NRF_SUCCESS) { + return; + } + + /* Skip this service if we fail to launch a read for its service-declaration + * attribute. Its UUID will remain INVALID, and it may not match any filters. */ + dequeue(); + } + + /* Switch back to service discovery upon exhausting the service-indices pending UUID discovery. */ + if (parentDiscoveryObject->state == DISCOVER_SERVICE_UUIDS) { + parentDiscoveryObject->state = SERVICE_DISCOVERY_ACTIVE; + } +} + +void +nRF5xServiceDiscovery::CharUUIDDiscoveryQueue::triggerFirst(void) +{ + while (numIndices) { /* loop until a call to char_value_by_uuid_read() succeeds or we run out of pending indices. */ + parentDiscoveryObject->state = DISCOVER_CHARACTERISTIC_UUIDS; + + unsigned charIndex = getFirst(); + ble_uuid_t uuid = { + .uuid = BLE_UUID_CHARACTERISTIC, + .type = BLE_UUID_TYPE_BLE, + }; + ble_gattc_handle_range_t handleRange = { }; + handleRange.start_handle = parentDiscoveryObject->characteristics[charIndex].getDeclHandle(); + handleRange.end_handle = parentDiscoveryObject->characteristics[charIndex].getDeclHandle() + 1; + if (sd_ble_gattc_char_value_by_uuid_read(parentDiscoveryObject->connHandle, &uuid, &handleRange) == NRF_SUCCESS) { + return; + } + + /* Skip this service if we fail to launch a read for its service-declaration + * attribute. Its UUID will remain INVALID, and it may not match any filters. */ + dequeue(); + } + + /* Switch back to service discovery upon exhausting the service-indices pending UUID discovery. */ + if (parentDiscoveryObject->state == DISCOVER_CHARACTERISTIC_UUIDS) { + parentDiscoveryObject->state = CHARACTERISTIC_DISCOVERY_ACTIVE; + } +} + +void +nRF5xServiceDiscovery::processDiscoverUUIDResponse(const ble_gattc_evt_char_val_by_uuid_read_rsp_t *response) +{ + if (state == DISCOVER_SERVICE_UUIDS) { + if ((response->count == 1) && (response->value_len == UUID::LENGTH_OF_LONG_UUID)) { + UUID::LongUUIDBytes_t uuid; + memcpy(uuid, response->handle_value[0].p_value, UUID::LENGTH_OF_LONG_UUID); + + unsigned serviceIndex = serviceUUIDDiscoveryQueue.dequeue(); + services[serviceIndex].setupLongUUID(uuid, UUID::LSB); + + serviceUUIDDiscoveryQueue.triggerFirst(); + } else { + serviceUUIDDiscoveryQueue.dequeue(); + } + } else if (state == DISCOVER_CHARACTERISTIC_UUIDS) { + if ((response->count == 1) && (response->value_len == UUID::LENGTH_OF_LONG_UUID + 1 /* props */ + 2 /* value handle */)) { + UUID::LongUUIDBytes_t uuid; + + memcpy(uuid, &(response->handle_value[0].p_value[3]), UUID::LENGTH_OF_LONG_UUID); + + unsigned charIndex = charUUIDDiscoveryQueue.dequeue(); + characteristics[charIndex].setupLongUUID(uuid, UUID::LSB); + + charUUIDDiscoveryQueue.triggerFirst(); + } else { + charUUIDDiscoveryQueue.dequeue(); + } + } +} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h new file mode 100644 index 0000000000..52b8342971 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h @@ -0,0 +1,366 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NRF_SERVICE_DISCOVERY_H__ +#define __NRF_SERVICE_DISCOVERY_H__ + +#include "ble/ServiceDiscovery.h" +#include "ble/DiscoveredService.h" +#include "nRF5xDiscoveredCharacteristic.h" + +#include "ble.h" +#include "ble_gattc.h" + +class nRF5xGattClient; /* forward declaration */ + +class nRF5xServiceDiscovery : public ServiceDiscovery +{ +public: + static const uint16_t SRV_DISC_START_HANDLE = 0x0001; /**< The start handle value used during service discovery. */ + static const uint16_t SRV_DISC_END_HANDLE = 0xFFFF; /**< The end handle value used during service discovery. */ + +public: + static const unsigned BLE_DB_DISCOVERY_MAX_SRV = 4; /**< Maximum number of services we can retain information for after a single discovery. */ + static const unsigned BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV = 4; /**< Maximum number of characteristics per service we can retain information for. */ + +public: + nRF5xServiceDiscovery(nRF5xGattClient *gattcIn) : + gattc(gattcIn), + serviceIndex(0), + numServices(0), + numCharacteristics(0), + state(INACTIVE), + services(), + characteristics(), + serviceUUIDDiscoveryQueue(this), + charUUIDDiscoveryQueue(this), + onTerminationCallback(NULL) { + /* empty */ + } + + virtual ble_error_t launch(Gap::Handle_t connectionHandle, + ServiceDiscovery::ServiceCallback_t sc, + ServiceDiscovery::CharacteristicCallback_t cc, + const UUID &matchingServiceUUIDIn, + const UUID &matchingCharacteristicUUIDIn) + { + if (isActive()) { + return BLE_ERROR_INVALID_STATE; + } + + serviceCallback = sc; + characteristicCallback = cc; + matchingServiceUUID = matchingServiceUUIDIn; + matchingCharacteristicUUID = matchingCharacteristicUUIDIn; + + serviceDiscoveryStarted(connectionHandle); + + uint32_t rc; + if ((rc = sd_ble_gattc_primary_services_discover(connectionHandle, SRV_DISC_START_HANDLE, NULL)) != NRF_SUCCESS) { + terminate(); + switch (rc) { + case NRF_ERROR_INVALID_PARAM: + case BLE_ERROR_INVALID_CONN_HANDLE: + return BLE_ERROR_INVALID_PARAM; + case NRF_ERROR_BUSY: + return BLE_STACK_BUSY; + default: + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + } + } + + return BLE_ERROR_NONE; + } + + virtual bool isActive(void) const { + return state != INACTIVE; + } + + virtual void terminate(void) { + terminateServiceDiscovery(); + } + + void terminate(Gap::Handle_t connectionHandle) { + if(connHandle == connectionHandle) { + terminate(); + } + } + + virtual void onTermination(ServiceDiscovery::TerminationCallback_t callback) { + onTerminationCallback = callback; + } + + /** + * @brief Clear nRF5xServiceDiscovery's state. + * + * @return + * BLE_ERROR_NONE if successful. + */ + virtual ble_error_t reset(void) { + /* Clear all state that is from the parent, including private members */ + if (ServiceDiscovery::reset() != BLE_ERROR_NONE) { + return BLE_ERROR_INVALID_STATE; + } + + /* Clear derived class members */ + serviceIndex = 0; + numServices = 0; + numCharacteristics = 0; + + state = INACTIVE; + + serviceUUIDDiscoveryQueue.reset(); + charUUIDDiscoveryQueue.reset(); + + onTerminationCallback = NULL; + + return BLE_ERROR_NONE; + } + +private: + ble_error_t launchCharacteristicDiscovery(Gap::Handle_t connectionHandle, Gap::Handle_t startHandle, Gap::Handle_t endHandle); + +private: + void setupDiscoveredServices(const ble_gattc_evt_prim_srvc_disc_rsp_t *response); + void setupDiscoveredCharacteristics(const ble_gattc_evt_char_disc_rsp_t *response); + + void triggerServiceUUIDDiscovery(void); + void processDiscoverUUIDResponse(const ble_gattc_evt_char_val_by_uuid_read_rsp_t *response); + void removeFirstServiceNeedingUUIDDiscovery(void); + + void terminateServiceDiscovery(void) { + discoveredCharacteristic = nRF5xDiscoveredCharacteristic(); + + bool wasActive = isActive(); + state = INACTIVE; + + if (wasActive && onTerminationCallback) { + onTerminationCallback(connHandle); + } + } + + void terminateCharacteristicDiscovery(ble_error_t err) { + if (state == CHARACTERISTIC_DISCOVERY_ACTIVE) { + if(discoveredCharacteristic != nRF5xDiscoveredCharacteristic()) { + if(err == BLE_ERROR_NONE) { + // fullfill the last characteristic + discoveredCharacteristic.setLastHandle(services[serviceIndex].getEndHandle()); + + if ((matchingCharacteristicUUID == UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) || + ((matchingCharacteristicUUID == discoveredCharacteristic.getUUID()) && + (matchingServiceUUID != UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)))) { + if (characteristicCallback) { + characteristicCallback(&discoveredCharacteristic); + } + } + } + discoveredCharacteristic = nRF5xDiscoveredCharacteristic(); + } + + state = SERVICE_DISCOVERY_ACTIVE; + } + serviceIndex++; /* Progress service index to keep discovery alive. */ + } + +private: + void resetDiscoveredServices(void) { + numServices = 0; + serviceIndex = 0; + } + + void resetDiscoveredCharacteristics(void) { + numCharacteristics = 0; + } + +private: + void serviceDiscoveryStarted(Gap::Handle_t connectionHandle) { + connHandle = connectionHandle; + resetDiscoveredServices(); + state = SERVICE_DISCOVERY_ACTIVE; + } + +private: + void characteristicDiscoveryStarted(Gap::Handle_t connectionHandle) { + connHandle = connectionHandle; + resetDiscoveredCharacteristics(); + state = CHARACTERISTIC_DISCOVERY_ACTIVE; + } + +private: + /** + * A datatype to contain service-indices for which long UUIDs need to be + * discovered using read_val_by_uuid(). + */ + class ServiceUUIDDiscoveryQueue { + public: + ServiceUUIDDiscoveryQueue(nRF5xServiceDiscovery *parent) : + numIndices(0), + serviceIndices(), + parentDiscoveryObject(parent) { + /* empty */ + } + + public: + void reset(void) { + numIndices = 0; + for (unsigned i = 0; i < BLE_DB_DISCOVERY_MAX_SRV; i++) { + serviceIndices[i] = INVALID_INDEX; + } + } + void enqueue(int serviceIndex) { + serviceIndices[numIndices++] = serviceIndex; + } + int dequeue(void) { + if (numIndices == 0) { + return INVALID_INDEX; + } + + unsigned valueToReturn = serviceIndices[0]; + numIndices--; + for (unsigned i = 0; i < numIndices; i++) { + serviceIndices[i] = serviceIndices[i + 1]; + } + + return valueToReturn; + } + unsigned getFirst(void) const { + return serviceIndices[0]; + } + size_t getCount(void) const { + return numIndices; + } + + /** + * Trigger UUID discovery for the first of the enqueued ServiceIndices. + */ + void triggerFirst(void); + + private: + static const int INVALID_INDEX = -1; + + private: + size_t numIndices; + int serviceIndices[BLE_DB_DISCOVERY_MAX_SRV]; + + nRF5xServiceDiscovery *parentDiscoveryObject; + }; + friend class ServiceUUIDDiscoveryQueue; + + /** + * A datatype to contain characteristic-indices for which long UUIDs need to + * be discovered using read_val_by_uuid(). + */ + class CharUUIDDiscoveryQueue { + public: + CharUUIDDiscoveryQueue(nRF5xServiceDiscovery *parent) : + numIndices(0), + charIndices(), + parentDiscoveryObject(parent) { + /* empty */ + } + + public: + void reset(void) { + numIndices = 0; + for (unsigned i = 0; i < BLE_DB_DISCOVERY_MAX_SRV; i++) { + charIndices[i] = INVALID_INDEX; + } + } + void enqueue(int serviceIndex) { + charIndices[numIndices++] = serviceIndex; + } + int dequeue(void) { + if (numIndices == 0) { + return INVALID_INDEX; + } + + unsigned valueToReturn = charIndices[0]; + numIndices--; + for (unsigned i = 0; i < numIndices; i++) { + charIndices[i] = charIndices[i + 1]; + } + + return valueToReturn; + } + unsigned getFirst(void) const { + return charIndices[0]; + } + size_t getCount(void) const { + return numIndices; + } + + /** + * Trigger UUID discovery for the first of the enqueued charIndices. + */ + void triggerFirst(void); + + private: + static const int INVALID_INDEX = -1; + + private: + size_t numIndices; + int charIndices[BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV]; + + nRF5xServiceDiscovery *parentDiscoveryObject; + }; + friend class CharUUIDDiscoveryQueue; + +private: + friend void bleGattcEventHandler(const ble_evt_t *p_ble_evt); + void progressCharacteristicDiscovery(void); + void progressServiceDiscovery(void); + +private: + nRF5xGattClient *gattc; + +private: + uint8_t serviceIndex; /**< Index of the current service being discovered. This is intended for internal use during service discovery.*/ + uint8_t numServices; /**< Number of services at the peers GATT database.*/ + uint8_t numCharacteristics; /**< Number of characteristics within the service.*/ + + enum State_t { + INACTIVE, + SERVICE_DISCOVERY_ACTIVE, + CHARACTERISTIC_DISCOVERY_ACTIVE, + DISCOVER_SERVICE_UUIDS, + DISCOVER_CHARACTERISTIC_UUIDS, + } state; + + DiscoveredService services[BLE_DB_DISCOVERY_MAX_SRV]; /**< Information related to the current service being discovered. + * This is intended for internal use during service discovery. */ + nRF5xDiscoveredCharacteristic characteristics[BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV]; + + ServiceUUIDDiscoveryQueue serviceUUIDDiscoveryQueue; + CharUUIDDiscoveryQueue charUUIDDiscoveryQueue; + + TerminationCallback_t onTerminationCallback; + + /* + * The currently discovered characteristic. Discovery of a characteristic + * is a two phase process. + * First, declaration handle is fetched, it provide the UUID, the value handle and + * the properties of a characteristic. + * Second, the next declaration handle is fetched, with its declaration handle, it is + * possible to compute the last handle of the discovered characteristic and fill the + * missing part of the object. + * If there is no remaining characteristic to discover, the last handle of the + * discovered characteristic will be set to the last handle of its enclosing service. + */ + nRF5xDiscoveredCharacteristic discoveredCharacteristic; +}; + +#endif /*__NRF_SERVICE_DISCOVERY_H__*/ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xn.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xn.cpp new file mode 100644 index 0000000000..61d9a38d90 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xn.cpp @@ -0,0 +1,224 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifdef YOTTA_CFG_MBED_OS + #include "mbed-drivers/mbed.h" +#else + #include "mbed.h" +#endif +#include "nRF5xn.h" +#include "ble/blecommon.h" +#include "nrf_soc.h" + +#include "btle/btle.h" +#include "btle/custom/custom_helper.h" +#include "nrf_delay.h" + +extern "C" { +#include "softdevice_handler.h" +} + +/** + * The singleton which represents the nRF51822 transport for the BLE. + */ +static nRF5xn& getDeviceInstance() { + static nRF5xn deviceInstance; + return deviceInstance; +} + + +/** + * BLE-API requires an implementation of the following function in order to + * obtain its transport handle. + */ +BLEInstanceBase * +createBLEInstance(void) +{ + return &nRF5xn::Instance(BLE::DEFAULT_INSTANCE); +} + +nRF5xn& nRF5xn::Instance(BLE::InstanceID_t instanceId) +{ + return getDeviceInstance(); +} + +nRF5xn::nRF5xn(void) : + initialized(false), + instanceID(BLE::DEFAULT_INSTANCE), + gapInstance(), + gattServerInstance(NULL), + gattClientInstance(NULL), + securityManagerInstance(NULL) +{ +} + +nRF5xn::~nRF5xn(void) +{ +} + +const char *nRF5xn::getVersion(void) +{ + if (!initialized) { + return "INITIALIZATION_INCOMPLETE"; + } + + static char versionString[32]; + static bool versionFetched = false; + + if (!versionFetched) { + ble_version_t version; + if ((sd_ble_version_get(&version) == NRF_SUCCESS) && (version.company_id == 0x0059)) { + switch (version.version_number) { + case 0x07: + case 0x08: + snprintf(versionString, sizeof(versionString), "Nordic BLE4.1 ver:%u fw:%04x", version.version_number, version.subversion_number); + break; + default: + snprintf(versionString, sizeof(versionString), "Nordic (spec unknown) ver:%u fw:%04x", version.version_number, version.subversion_number); + break; + } + versionFetched = true; + } else { + strncpy(versionString, "unknown", sizeof(versionString)); + } + } + + return versionString; +} + +/**************************************************************************/ +/*! + @brief Initialize the BLE stack. + + @returns ble_error_t + + @retval BLE_ERROR_NONE if everything executed properly and + BLE_ERROR_ALREADY_INITIALIZED if the stack has already + been initialized (possibly through a call to nRF5xn::init()). + BLE_ERROR_INTERNAL_STACK_FAILURE is returned if initialization + of the internal stack (SoftDevice) failed. + +*/ +/**************************************************************************/ +ble_error_t nRF5xn::init(BLE::InstanceID_t instanceID, FunctionPointerWithContext callback) +{ + if (initialized) { + BLE::InitializationCompleteCallbackContext context = { + BLE::Instance(instanceID), + BLE_ERROR_ALREADY_INITIALIZED + }; + callback.call(&context); + return BLE_ERROR_ALREADY_INITIALIZED; + } + + instanceID = instanceID; + + /* ToDo: Clear memory contents, reset the SD, etc. */ + if (btle_init() != ERROR_NONE) { + return BLE_ERROR_INTERNAL_STACK_FAILURE; + } + + initialized = true; + BLE::InitializationCompleteCallbackContext context = { + BLE::Instance(instanceID), + BLE_ERROR_NONE + }; + callback.call(&context); + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! + @brief Purge the BLE stack of GATT and GAP state. + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly + + @note When using S110, GattClient::shutdown() will not be called + since Gatt client features are not supported. +*/ +/**************************************************************************/ +ble_error_t nRF5xn::shutdown(void) +{ + if (!initialized) { + return BLE_ERROR_INITIALIZATION_INCOMPLETE; + } + + /* + * Shutdown the SoftDevice first. This is because we need to disable all + * interrupts. Otherwise if we clear the BLE API and glue code first there + * will be many NULL references and no config information which could lead + * to errors if the shutdown process is interrupted. + */ + if (softdevice_handler_sd_disable() != NRF_SUCCESS) { + return BLE_STACK_BUSY; + } + + + /* Shutdown the BLE API and nRF51 glue code */ + ble_error_t error; + + if (gattServerInstance != NULL) { + error = gattServerInstance->reset(); + if (error != BLE_ERROR_NONE) { + return error; + } + } + + if (securityManagerInstance != NULL) { + error = securityManagerInstance->reset(); + if (error != BLE_ERROR_NONE) { + return error; + } + } + + /* S110 does not support BLE client features, nothing to reset. */ +#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) + if (gattClientInstance != NULL) { + error = gattClientInstance->reset(); + if (error != BLE_ERROR_NONE) { + return error; + } + } +#endif + + /* Gap instance is always present */ + error = gapInstance.reset(); + if (error != BLE_ERROR_NONE) { + return error; + } + + custom_reset_128bits_uuid_table(); + + initialized = false; + return BLE_ERROR_NONE; +} + +void +nRF5xn::waitForEvent(void) +{ + processEvents(); + sd_app_evt_wait(); +} + +void nRF5xn::processEvents() { + if (isEventsSignaled) { + isEventsSignaled = false; + intern_softdevice_events_execute(); + } +} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xn.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xn.h new file mode 100644 index 0000000000..33c7926e0d --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xn.h @@ -0,0 +1,184 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NRF51822_H__ +#define __NRF51822_H__ + +#include "ble/BLE.h" +#include "ble/blecommon.h" +#include "ble/BLEInstanceBase.h" + +#include "nRF5xGap.h" +#include "nRF5xGattServer.h" +#include "nRF5xGattClient.h" +#include "nRF5xSecurityManager.h" + +#include "btle.h" + +class nRF5xn : public BLEInstanceBase +{ +public: + nRF5xn(void); + virtual ~nRF5xn(void); + + virtual ble_error_t init(BLE::InstanceID_t instanceID, FunctionPointerWithContext callback); + virtual bool hasInitialized(void) const { + return initialized; + } + virtual ble_error_t shutdown(void); + virtual const char *getVersion(void); + + /** + * Accessors to GAP. This function checks whether gapInstance points to an + * object. If if does not, then the gapInstance is updated to + * &_getInstance before returning. + * + * @return A reference to GattServer. + * + * @note Unlike the GattClient, GattServer and SecurityManager, Gap is + * always needed in a BLE application. Therefore it is allocated + * statically. + */ + virtual Gap &getGap() { + return gapInstance; + }; + + /** + * Accessors to GATT Server. This function checks whether a GattServer + * object was previously instantiated. If such object does not exist, then + * it is created before returning. + * + * @return A reference to GattServer. + */ + virtual GattServer &getGattServer() { + if (gattServerInstance == NULL) { + gattServerInstance = new nRF5xGattServer(); + } + return *gattServerInstance; + }; + + /** + * Accessors to GATT Client. This function checks whether a GattClient + * object was previously instantiated. If such object does not exist, then + * it is created before returning. + * + * @return A reference to GattClient. + */ + virtual nRF5xGattClient &getGattClient() { + if (gattClientInstance == NULL) { + gattClientInstance = new nRF5xGattClient(); + } + return *gattClientInstance; + } + + /** + * Accessors to Security Manager. This function checks whether a SecurityManager + * object was previously instantiated. If such object does not exist, then + * it is created before returning. + * + * @return A reference to GattServer. + */ + virtual nRF5xSecurityManager &getSecurityManager() { + if (securityManagerInstance == NULL) { + securityManagerInstance = new nRF5xSecurityManager(); + } + return *securityManagerInstance; + } + + /** + * Accessors to GAP. This function checks whether gapInstance points to an + * object. If if does not, then the gapInstance is updated to + * &_getInstance before returning. + * + * @return A const reference to GattServer. + * + * @note Unlike the GattClient, GattServer and SecurityManager, Gap is + * always needed in a BLE application. Therefore it is allocated + * statically. + * + * @note The accessor is able to modify the object's state because the + * internal pointer has been declared mutable. + */ + virtual const nRF5xGap &getGap() const { + return gapInstance; + }; + + /** + * Accessors to GATT Server. This function checks whether a GattServer + * object was previously instantiated. If such object does not exist, then + * it is created before returning. + * + * @return A const reference to GattServer. + * + * @note The accessor is able to modify the object's state because the + * internal pointer has been declared mutable. + */ + virtual const nRF5xGattServer &getGattServer() const { + if (gattServerInstance == NULL) { + gattServerInstance = new nRF5xGattServer(); + } + return *gattServerInstance; + }; + + /** + * Accessors to Security Manager. This function checks whether a SecurityManager + * object was previously instantiated. If such object does not exist, then + * it is created before returning. + * + * @return A const reference to GattServer. + * + * @note The accessor is able to modify the object's state because the + * internal pointer has been declared mutable. + */ + virtual const nRF5xSecurityManager &getSecurityManager() const { + if (securityManagerInstance == NULL) { + securityManagerInstance = new nRF5xSecurityManager(); + } + return *securityManagerInstance; + } + + virtual void waitForEvent(void); + + virtual void processEvents(); + +public: + static nRF5xn& Instance(BLE::InstanceID_t instanceId); + +private: + bool initialized; + BLE::InstanceID_t instanceID; + +private: + mutable nRF5xGap gapInstance; /**< Gap instance whose reference is returned from a call to + * getGap(). Unlike the GattClient, GattServer and + * SecurityManager, Gap is always needed in a BLE application. */ + +private: + mutable nRF5xGattServer *gattServerInstance; /**< Pointer to the GattServer object instance. + * If NULL, then GattServer has not been initialized. + * The pointer has been declared as 'mutable' so that + * it can be assigned inside a 'const' function. */ + mutable nRF5xGattClient *gattClientInstance; /**< Pointer to the GattClient object instance. + * If NULL, then GattClient has not been initialized. + * The pointer has been declared as 'mutable' so that + * it can be assigned inside a 'const' function. */ + mutable nRF5xSecurityManager *securityManagerInstance; /**< Pointer to the SecurityManager object instance. + * If NULL, then SecurityManager has not been initialized. + * The pointer has been declared as 'mutable' so that + * it can be assigned inside a 'const' function. */ +}; + +#endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/projectconfig.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/projectconfig.h new file mode 100644 index 0000000000..15959850c4 --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/projectconfig.h @@ -0,0 +1,136 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _PROJECTCONFIG_H_ +#define _PROJECTCONFIG_H_ + +#include "ble/GapAdvertisingData.h" + +/*========================================================================= + MCU & BOARD SELCTION + + CFG_BOARD is one of the value defined in board.h + -----------------------------------------------------------------------*/ + #define CFG_BOARD BOARD_PCA10001 + #define CFG_MCU_STRING "nRF51822" +/*=========================================================================*/ + + +/*========================================================================= + CODE BASE VERSION SETTINGS + + Please do not modify this version number. To set a version number + for your project or firmware, change the values in your 'boards/' + config file. + -----------------------------------------------------------------------*/ + #define CFG_CODEBASE_VERSION_MAJOR 0 + #define CFG_CODEBASE_VERSION_MINOR 1 + #define CFG_CODEBASE_VERSION_REVISION 0 +/*=========================================================================*/ + + +/*========================================================================= + FIRMWARE VERSION SETTINGS + -----------------------------------------------------------------------*/ + #define CFG_FIRMWARE_VERSION_MAJOR 0 + #define CFG_FIRMWARE_VERSION_MINOR 0 + #define CFG_FIRMWARE_VERSION_REVISION 0 +/*=========================================================================*/ + + +/*========================================================================= + DEBUG LEVEL + ----------------------------------------------------------------------- + + CFG_DEBUG Level 3: Full debug output, any failed assert + will produce a breakpoint for the + debugger + Level 2: ATTR_ALWAYS_INLINE is null, ASSERT + has text + Level 1: ATTR_ALWAYS_INLINE is an attribute, + ASSERT has no text + Level 0: No debug information generated + + -----------------------------------------------------------------------*/ + #define CFG_DEBUG (1) + + #if (CFG_DEBUG > 3) || (CFG_DEBUG < 0) + #error "CFG_DEBUG must be a value between 0 (no debug) and 3" + #endif +/*=========================================================================*/ + + +/*========================================================================= + GENERAL NRF51 PERIPHERAL SETTINGS + ----------------------------------------------------------------------- + + CFG_SCHEDULER_ENABLE Set this to 'true' or 'false' depending on + if you use the event scheduler or not + + -----------------------------------------------------------------------*/ + #define CFG_SCHEDULER_ENABLE false + + /*------------------------------- GPIOTE ------------------------------*/ + #define CFG_GPIOTE_MAX_USERS 1 /**< Maximum number of users of the GPIOTE handler. */ + + /*-------------------------------- TIMER ------------------------------*/ + #define CFG_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. freq = (32768/(PRESCALER+1)) */ + #define CFG_TIMER_MAX_INSTANCE 1 /**< Maximum number of simultaneously created timers. */ + #define CFG_TIMER_OPERATION_QUEUE_SIZE 2 /**< Size of timer operation queues. */ +/*=========================================================================*/ + + +/*========================================================================= + BTLE SETTINGS + -----------------------------------------------------------------------*/ + + #define CFG_BLE_TX_POWER_LEVEL 0 /**< in dBm (Valid values are -40, -20, -16, -12, -8, -4, 0, 4) */ + + /*---------------------------- BOND MANAGER ---------------------------*/ + #define CFG_BLE_BOND_FLASH_PAGE_BOND (BLE_FLASH_PAGE_END-1) /**< Flash page used for bond manager bonding information.*/ + #define CFG_BLE_BOND_FLASH_PAGE_SYS_ATTR (BLE_FLASH_PAGE_END-3) /**< Flash page used for bond manager system attribute information. TODO check if we can use BLE_FLASH_PAGE_END-2*/ + #define CFG_BLE_BOND_DELETE_BUTTON_NUM 0 /**< Button to press to delete bond details during init */ + + /*------------------------------ SECURITY -----------------------------*/ + #define CFG_BLE_SEC_PARAM_MITM 0 /**< Man In The Middle protection not required. */ + #define CFG_BLE_SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE /**< No I/O capabilities. */ + #define CFG_BLE_SEC_PARAM_OOB 0 /**< Out Of Band data not available. */ + #define CFG_BLE_SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */ + #define CFG_BLE_SEC_PARAM_MAX_KEY_SIZE 16 + + /*--------------------------------- GAP -------------------------------*/ + #define CFG_GAP_APPEARANCE GapAdvertisingData::GENERIC_TAG + #define CFG_GAP_LOCAL_NAME "nRF5x" + + #define CFG_GAP_CONNECTION_MIN_INTERVAL_MS 50 /**< Minimum acceptable connection interval */ + #define CFG_GAP_CONNECTION_MAX_INTERVAL_MS 500 /**< Maximum acceptable connection interval */ + #define CFG_GAP_CONNECTION_SUPERVISION_TIMEOUT_MS 4000 /**< Connection supervisory timeout */ + #define CFG_GAP_CONNECTION_SLAVE_LATENCY 0 /**< Slave Latency in number of connection events. */ + + #define CFG_GAP_ADV_INTERVAL_MS 25 /**< The advertising interval in miliseconds, should be multiply of 0.625 */ + #define CFG_GAP_ADV_TIMEOUT_S 180 /**< The advertising timeout in units of seconds. */ +/*=========================================================================*/ + + +/*========================================================================= + VALIDATION + -----------------------------------------------------------------------*/ + #if CFG_BLE_TX_POWER_LEVEL != -40 && CFG_BLE_TX_POWER_LEVEL != -20 && CFG_BLE_TX_POWER_LEVEL != -16 && CFG_BLE_TX_POWER_LEVEL != -12 && CFG_BLE_TX_POWER_LEVEL != -8 && CFG_BLE_TX_POWER_LEVEL != -4 && CFG_BLE_TX_POWER_LEVEL != 0 && CFG_BLE_TX_POWER_LEVEL != 4 + #error "CFG_BLE_TX_POWER_LEVEL must be -40, -20, -16, -12, -8, -4, 0 or 4" + #endif +/*=========================================================================*/ + +#endif /* _PROJECTCONFIG_H_ */ From 5b36de9c4fdc47e3edcf28e86e5e869d0efe4cac Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 11 Jan 2017 11:24:06 +0100 Subject: [PATCH 13/31] nrf52840: add workaround for RTC errata 20 include thered main stack for cmsis rtos --- rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h | 2 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c | 16 ++++++++++++++++ targets/targets.json | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h b/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h index 410007facb..40aa2fff76 100644 --- a/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h +++ b/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h @@ -354,7 +354,7 @@ __attribute__((used)) void _mutex_release (OS_ID *mutex) { /* Main Thread definition */ extern void pre_main (void); -#if defined(TARGET_MCU_NRF52832) ||\ +#if defined(TARGET_MCU_NRF52840) ||\ defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832) || defined (TARGET_STM32F334R8) ||\ defined(TARGET_STM32F070RB) || defined(TARGET_STM32F072RB) || \ defined(TARGET_STM32F302R8) || defined(TARGET_STM32F303K8) || defined (TARGET_STM32F334C8) ||\ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c index d7267b81cc..a4d4bc5d89 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c @@ -76,6 +76,20 @@ void COMMON_RTC_IRQ_HANDLER(void) } } +// Function for fix errata 20: RTC Register values are invalid +__STATIC_INLINE void errata_20(void) +{ +#if defined(NRF52_ERRATA_20) + if (!softdevice_handler_is_enabled()) + { + NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; + NRF_CLOCK->TASKS_LFCLKSTART = 1; + while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {} + } + NRF_RTC1->TASKS_STOP = 0; +#endif +} + #if (defined (__ICCARM__)) && defined(TARGET_MCU_NRF51822)//IAR __stackless __task #endif @@ -87,6 +101,8 @@ void common_rtc_init(void) return; } + errata_20(); + NVIC_SetVector(RTC1_IRQn, (uint32_t)RTC1_IRQHandler); // RTC is driven by the low frequency (32.768 kHz) clock, a proper request diff --git a/targets/targets.json b/targets/targets.json index 9d47dec698..5326c38c6a 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -2560,7 +2560,7 @@ "MCU_NRF52840": { "inherits": ["Target"], "core": "Cortex-M4F", - "macros": ["TARGET_NRF52840", "BLE_STACK_SUPPORT_REQD", "SOFTDEVICE_PRESENT", "S140", "NRF_SD_BLE_API_VERSION=5", "NRF52840_XXAA", "NRF_DFU_SETTINGS_VERSION=1"], + "macros": ["TARGET_NRF52840", "BLE_STACK_SUPPORT_REQD", "SOFTDEVICE_PRESENT", "S140", "NRF_SD_BLE_API_VERSION=5", "NRF52840_XXAA", "NRF_DFU_SETTINGS_VERSION=1", "NRF_SD_BLE_API_VERSION=5"], "extra_labels": ["NORDIC", "MCU_NRF52840", "NRF5_SDK13"], "OUTPUT_EXT": "hex", "is_disk_virtual": true, @@ -2598,7 +2598,7 @@ "NRF52840_DK": { "supported_form_factors": ["ARDUINO"], "inherits": ["MCU_NRF52840"], - "macros_add": ["BOARD_PCA10056", "CONFIG_GPIO_AS_PINRESET", "SWI_DISABLE0"], + "macros_add": ["BOARD_PCA10056", "CONFIG_GPIO_AS_PINRESET", "SWI_DISABLE0", "NRF52_ERRATA_20"], "device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE"], "release_versions": ["2", "5"], "device_name": "nRF52840_xxAA" From 689d12df6202796b75e7e3f7b58bcc9f4f007355 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 16 Jan 2017 11:58:26 +0100 Subject: [PATCH 14/31] NRF5_SDK13: Make BLE sources compilable - this is not redy to use! - Remove ble_advertising.h/c - it was unused, redundant code - includes for SD header ble.h were changed to headers\ble.h in order to distingusch form feature-ble BLE.h - btle_init() introduced PM for disable privacy for API 3 and further. - temporary removed or mocked real implemantation of whitelist-ing support functionalities: btle_security.createWhitelistFromBondTable , gap::startAdvertising, gat::startRadioScan, gap::stopAdvertising Gap::generateStackWhitelist, Gap::getStackWhiteIdentityList-(mock) - Characteristic Descriptor Discoverer - aligned to the apply SD API - long uuid service's read spupport - add BLE features support to sdk configurations file - publicate sdk's id_manager.ah() function. - cutted out f. app_error_handler for mbed-os - removed PACKED definition form app_util_platform (redefined by mbed-os) - Gap::setAddress - allign to new SD API using peer manager - extend Gap::getPermittedTxPowerValues for nRF52840 --- .../TARGET_NRF5_SDK13/source/btle/btle.cpp | 13 +- .../TARGET_NRF5_SDK13/source/btle/btle.h | 2 +- .../source/btle/btle_advertising.cpp | 46 ------- .../source/btle/btle_advertising.h | 24 ---- .../source/btle/btle_security.h | 2 + .../source/btle/btle_security_pm.cpp | 5 +- .../source/btle/custom/custom_helper.h | 2 +- ...RF5xCharacteristicDescriptorDiscoverer.cpp | 24 +++- .../TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 127 +++++++++++++++++- .../TARGET_NRF5_SDK13/source/nRF5xGap.h | 25 +++- .../source/nRF5xGattServer.h | 2 +- .../source/nRF5xSecurityManager.h | 7 +- .../source/nRF5xServiceDiscovery.cpp | 19 ++- .../source/nRF5xServiceDiscovery.h | 2 +- .../TARGET_MCU_NRF52840/sdk/sdk_config.h | 81 +++++++++++ .../sdk/ble/ble_advertising/ble_advertising.h | 2 +- .../ble/ble_db_discovery/ble_db_discovery.c | 2 +- .../ble/ble_db_discovery/ble_db_discovery.h | 2 +- .../sdk/ble/ble_racp/ble_racp.h | 2 +- .../sdk/ble/common/ble_advdata.h | 2 +- .../sdk/ble/common/ble_conn_params.h | 2 +- .../sdk/ble/common/ble_conn_state.c | 2 +- .../sdk/ble/common/ble_conn_state.h | 2 +- .../sdk/ble/common/ble_gatt_db.h | 2 +- .../sdk/ble/common/ble_srv_common.c | 2 +- .../sdk/ble/common/ble_srv_common.h | 2 +- .../sdk/ble/peer_manager/gatt_cache_manager.h | 2 +- .../ble/peer_manager/gatts_cache_manager.h | 2 +- .../sdk/ble/peer_manager/id_manager.c | 2 +- .../sdk/ble/peer_manager/id_manager.h | 33 ++++- .../sdk/ble/peer_manager/peer_manager.h | 2 +- .../ble/peer_manager/peer_manager_internal.h | 2 +- .../ble/peer_manager/security_dispatcher.c | 2 +- .../ble/peer_manager/security_dispatcher.h | 2 +- .../sdk/ble/peer_manager/security_manager.h | 2 +- .../sdk/libraries/util/app_error.c | 2 + .../sdk/libraries/util/app_util_platform.h | 14 +- .../ble_stack_handler_types.h | 2 +- .../softdevice_handler/softdevice_handler.c | 2 +- .../softdevice_handler/softdevice_handler.h | 2 +- targets/targets.json | 2 +- 41 files changed, 356 insertions(+), 120 deletions(-) delete mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.cpp delete mode 100644 features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.h diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp index ec562e4e24..f05aa03c80 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp @@ -24,7 +24,7 @@ #include "ble_conn_params.h" #include "btle_gap.h" -#include "btle_advertising.h" +//#include "btle_advertising.h" #include "custom/custom_helper.h" #include "ble/GapEvents.h" @@ -165,6 +165,7 @@ error_t btle_init(void) return ERROR_INVALID_PARAM; } +#if (NRF_SD_BLE_API_VERSION <= 2) ble_gap_addr_t addr; if (sd_ble_gap_address_get(&addr) != NRF_SUCCESS) { return ERROR_INVALID_PARAM; @@ -172,6 +173,11 @@ error_t btle_init(void) if (sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr) != NRF_SUCCESS) { return ERROR_INVALID_PARAM; } +#else + ble_gap_privacy_params_t privacy_params = {0}; + privacy_params.privacy_mode = BLE_GAP_PRIVACY_MODE_OFF; + pm_privacy_set(&privacy_params); +#endif ASSERT_STATUS( softdevice_ble_evt_handler_set(btle_handler)); ASSERT_STATUS( softdevice_sys_evt_handler_set(sys_evt_dispatch)); @@ -218,8 +224,13 @@ static void btle_handler(ble_evt_t *p_ble_evt) #endif gap.setConnectionHandle(handle); const Gap::ConnectionParams_t *params = reinterpret_cast(&(p_ble_evt->evt.gap_evt.params.connected.conn_params)); +#if (NRF_SD_BLE_API_VERSION <= 2) const ble_gap_addr_t *peer = &p_ble_evt->evt.gap_evt.params.connected.peer_addr; const ble_gap_addr_t *own = &p_ble_evt->evt.gap_evt.params.connected.own_addr; +#else + const ble_gap_addr_t *peer = NULL; // @todo real implemantation pm_device_identities_list_set/get + const ble_gap_addr_t *own = NULL; +#endif gap.processConnectionEvent(handle, role, static_cast(peer->addr_type), peer->addr, diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h index d08784d1f0..47b556d5f6 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h @@ -24,7 +24,7 @@ extern "C" { #include "common/common.h" #include "ble_srv_common.h" -#include "ble.h" +#include "headers\ble.h" error_t btle_init(void); diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.cpp deleted file mode 100644 index cdaf6a4a49..0000000000 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "common/common.h" - -#include "ble_advdata.h" -#include "btle.h" - -/**************************************************************************/ -/*! - @brief Starts the advertising process - - @returns -*/ -/**************************************************************************/ -error_t btle_advertising_start(void) -{ - ble_gap_adv_params_t adv_para = {0}; - - /* Set the default advertising parameters */ - adv_para.type = BLE_GAP_ADV_TYPE_ADV_IND; - adv_para.p_peer_addr = NULL; /* Undirected advertising */ - adv_para.fp = BLE_GAP_ADV_FP_ANY; - adv_para.p_whitelist = NULL; - adv_para.interval = (CFG_GAP_ADV_INTERVAL_MS * 8) / 5; /* Advertising - * interval in - * units of 0.625 - * ms */ - adv_para.timeout = CFG_GAP_ADV_TIMEOUT_S; - - ASSERT_STATUS( sd_ble_gap_adv_start(&adv_para)); - - return ERROR_NONE; -} diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.h deleted file mode 100644 index a215153ab5..0000000000 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_advertising.h +++ /dev/null @@ -1,24 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _BTLE_ADVERTISING_H_ -#define _BTLE_ADVERTISING_H_ - -#include "common/common.h" - -error_t btle_advertising_start(void); - -#endif // ifndef _BTLE_ADVERTISING_H_ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.h index 4f863975ab..3197e83881 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security.h @@ -84,6 +84,7 @@ ble_error_t btle_setLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager */ ble_error_t btle_purgeAllBondingState(void); +#if (NRF_SD_BLE_API_VERSION <= 2) /** * Query the SoftDevice bond table to extract a whitelist containing the BLE * addresses and IRKs of bonded devices. @@ -98,6 +99,7 @@ ble_error_t btle_purgeAllBondingState(void); * @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure. */ ble_error_t btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist); +#endif /** * Function to test whether a BLE address is generated using an IRK. diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp index e29002d07a..b813eb13ed 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#if defined(S130) || defined(S132) +#if defined(S130) || defined(S132) || defined(S140) #include "btle.h" #include "nRF5xn.h" @@ -393,6 +393,7 @@ void pm_handler(pm_evt_t const *p_event) } } +#if (NRF_SD_BLE_API_VERSION <= 2) ble_error_t btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist) { @@ -408,7 +409,7 @@ btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist) return BLE_ERROR_INVALID_STATE; } } - +#endif bool btle_matchAddressAndIrk(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h index 658d10bfac..0defa7fd1c 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h @@ -18,7 +18,7 @@ #define _CUSTOM_HELPER_H_ #include "common/common.h" -#include "ble.h" +#include "headers\ble.h" #include "ble/UUID.h" #include "ble/GattCharacteristic.h" diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.cpp index 7a910b8569..4433a53f33 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xCharacteristicDescriptorDiscoverer.cpp @@ -136,6 +136,7 @@ void nRF5xCharacteristicDescriptorDiscoverer::processAttributeInformation( return; } +#if (NRF_SD_BLE_API_VERSION <= 2) // for all UUIDS found, process the discovery for (uint16_t i = 0; i < infos.count; ++i) { bool use_16bits_uuids = infos.format == BLE_GATTC_ATTR_INFO_FORMAT_16BIT; @@ -143,9 +144,30 @@ void nRF5xCharacteristicDescriptorDiscoverer::processAttributeInformation( UUID uuid = use_16bits_uuids ? UUID(attr_info.info.uuid16.uuid) : UUID(attr_info.info.uuid128.uuid128, UUID::LSB); discovery->process(attr_info.handle, uuid); } - // prepare the next round of descriptors discovery uint16_t startHandle = infos.attr_info[infos.count - 1].handle + 1; +#else + uint16_t startHandle; + // for all UUIDS found, process the discovery + if (infos.format == BLE_GATTC_ATTR_INFO_FORMAT_16BIT) { + + for (uint16_t i = 0; i < infos.count; ++i) { + UUID uuid = UUID(infos.info.attr_info16[i].uuid.uuid); + discovery->process(infos.info.attr_info16[i].handle, uuid); + } + + // prepare the next round of descriptors discovery + startHandle = infos.info.attr_info16[infos.count - 1].handle + 1; + } else { + for (uint16_t i = 0; i < infos.count; ++i) { + UUID uuid = UUID(infos.info.attr_info128[i].uuid.uuid128, UUID::LSB); + discovery->process(infos.info.attr_info128[i].handle, uuid); + } + + // prepare the next round of descriptors discovery + startHandle = infos.info.attr_info128[infos.count - 1].handle + 1; + } +#endif uint16_t endHandle = discovery->getCharacteristic().getLastHandle(); if(startHandle > endHandle) { diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp index 2e9b254361..358ab5c810 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -26,6 +26,11 @@ #include "ble_advdata.h" #include "ble_hci.h" +#if (NRF_SD_BLE_API_VERSION >= 3) + #include "peer_manager.h" +#endif + + void radioNotificationStaticCallback(bool param) { nRF5xGap &gap = (nRF5xGap &) nRF5xn::Instance(BLE::DEFAULT_INSTANCE).getGap(); gap.processRadioNotificationEvent(param); @@ -167,7 +172,8 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) (params.getTimeout() > GapAdvertisingParams::GAP_ADV_PARAMS_TIMEOUT_MAX)) { return BLE_ERROR_PARAM_OUT_OF_RANGE; } - + uint32_t err ; +#if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; ble_gap_addr_t *whitelistAddressPtrs[YOTTA_CFG_WHITELIST_MAX_SIZE]; @@ -185,18 +191,29 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) return error; } } - +#else + gapAdrHelper_t gapAdrHelper; + getStackWhiteIdentityList(gapAdrHelper); + err = apllyWhiteIdentityList(gapAdrHelper); + + if (err != BLE_ERROR_NONE) { + return (ble_error_t)err; + } +#endif /* Start Advertising */ ble_gap_adv_params_t adv_para = {0}; adv_para.type = params.getAdvertisingType(); adv_para.p_peer_addr = NULL; // Undirected advertisement adv_para.fp = advertisingPolicyMode; +#if (NRF_SD_BLE_API_VERSION <= 2) adv_para.p_whitelist = &whitelist; +#endif adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms) adv_para.timeout = params.getTimeout(); + - uint32_t err = sd_ble_gap_adv_start(&adv_para); + err = sd_ble_gap_adv_start(&adv_para); switch(err) { case ERROR_NONE: return BLE_ERROR_NONE; @@ -211,6 +228,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) #if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) { +#if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; ble_gap_addr_t *whitelistAddressPtrs[YOTTA_CFG_WHITELIST_MAX_SIZE]; @@ -228,12 +246,23 @@ ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) return error; } } +#else + gapAdrHelper_t gapAdrHelper; + getStackWhiteIdentityList(gapAdrHelper); + uint32_t err = apllyWhiteIdentityList(gapAdrHelper); + + if (err != BLE_ERROR_NONE) { + return (ble_error_t)err; + } +#endif ble_gap_scan_params_t scanParams; scanParams.active = scanningParams.getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ +#if (NRF_SD_BLE_API_VERSION <= 2) scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ +#endif scanParams.interval = scanningParams.getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ scanParams.window = scanningParams.getWindow(); /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ scanParams.timeout = scanningParams.getTimeout(); /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ @@ -302,6 +331,7 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, connParams.conn_sup_timeout = 600; } +#if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; ble_gap_addr_t *whitelistAddressPtrs[YOTTA_CFG_WHITELIST_MAX_SIZE]; @@ -319,10 +349,22 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, return error; } } +#else + gapAdrHelper_t gapAdrHelper; + getStackWhiteIdentityList(gapAdrHelper); + uint32_t err = apllyWhiteIdentityList(gapAdrHelper); + + if (err != BLE_ERROR_NONE) { + return (ble_error_t)err; + } +#endif ble_gap_scan_params_t scanParams; +#if (NRF_SD_BLE_API_VERSION <= 2) scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ +#endif + if (scanParamsIn != NULL) { scanParams.active = scanParamsIn->getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ scanParams.interval = scanParamsIn->getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ @@ -489,7 +531,13 @@ uint16_t nRF5xGap::getConnectionHandle(void) /**************************************************************************/ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) { +#if (NRF_SD_BLE_API_VERSION <= 2) uint8_t cycle_mode; +#else + ble_gap_privacy_params_t privacy_params = {0}; +#endif + + ble_gap_addr_t dev_addr; /* When using Public or Static addresses, the cycle mode must be None. @@ -498,12 +546,21 @@ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) */ if ((type == BLEProtocol::AddressType::PUBLIC) || (type == BLEProtocol::AddressType::RANDOM_STATIC)) { +#if (NRF_SD_BLE_API_VERSION <= 2) cycle_mode = BLE_GAP_ADDR_CYCLE_MODE_NONE; +#else + privacy_params.privacy_mode = BLE_GAP_PRIVACY_MODE_OFF; +#endif memcpy(dev_addr.addr, address, ADDR_LEN); } else if ((type == BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE) || (type == BLEProtocol::AddressType::RANDOM_PRIVATE_NON_RESOLVABLE)) { +#if (NRF_SD_BLE_API_VERSION <= 2) cycle_mode = BLE_GAP_ADDR_CYCLE_MODE_AUTO; +#else + privacy_params.privacy_mode = BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY; + privacy_params.private_addr_type = type; +#endif // address is ignored when in auto mode } else @@ -512,7 +569,12 @@ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) } dev_addr.addr_type = type; +#if (NRF_SD_BLE_API_VERSION <= 2) ASSERT_INT(ERROR_NONE, sd_ble_gap_address_set(cycle_mode, &dev_addr), BLE_ERROR_PARAM_OUT_OF_RANGE); +#else + ASSERT_INT(ERROR_NONE, pm_privacy_set(&privacy_params), BLE_ERROR_PARAM_OUT_OF_RANGE); + ASSERT_INT(ERROR_NONE, pm_id_addr_set(&dev_addr), BLE_ERROR_PARAM_OUT_OF_RANGE); +#endif return BLE_ERROR_NONE; } @@ -520,7 +582,7 @@ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) ble_error_t nRF5xGap::getAddress(AddressType_t *typeP, Address_t address) { ble_gap_addr_t dev_addr; - if (sd_ble_gap_address_get(&dev_addr) != NRF_SUCCESS) { + if (sd_ble_gap_addr_get(&dev_addr) != NRF_SUCCESS) { return BLE_ERROR_PARAM_OUT_OF_RANGE; } @@ -599,6 +661,10 @@ void nRF5xGap::getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *co static const int8_t permittedTxValues[] = { -40, -20, -16, -12, -8, -4, 0, 4 }; +#elif defined(NRF52840_XXAA) + static const int8_t permittedTxValues[] = { + -40, -20, -16, -12, -8, -4, 0, 4, 5, 6, 7, 8, 9 + }; #else #error permitted TX power values unknown for this SOC #endif @@ -846,6 +912,7 @@ Gap::InitiatorPolicyMode_t nRF5xGap::getInitiatorPolicyMode(void) const return Gap::INIT_POLICY_IGNORE_WHITELIST; } +#if (NRF_SD_BLE_API_VERSION <= 2) /**************************************************************************/ /*! @brief Helper function used to populate the ble_gap_whitelist_t that @@ -945,3 +1012,55 @@ ble_error_t nRF5xGap::generateStackWhitelist(ble_gap_whitelist_t &whitelist) return BLE_ERROR_NONE; } +#endif + +#if (NRF_SD_BLE_API_VERSION >= 3) + + +ble_error_t nRF5xGap::getStackWhiteIdentityList(gapAdrHelper_t &gapAdrHelper) +{ + // it's a mock + //@todo non trivial implementation + gapAdrHelper.num_of_whitelist_items = 0; + gapAdrHelper.num_of_identiti_items = 0; + return BLE_ERROR_NONE; +} + +ble_error_t nRF5xGap::apllyWhiteIdentityList(gapAdrHelper_t &gapAdrHelper) +{ + uint32_t retc; + + if (gapAdrHelper.num_of_identiti_items == 0) { + retc = sd_ble_gap_device_identities_set(NULL, NULL, 0); + } else { + retc = sd_ble_gap_device_identities_set(gapAdrHelper.identities, NULL /* Don't use local IRKs*/,gapAdrHelper.num_of_identiti_items); + } + + if (retc == NRF_SUCCESS) { + if (gapAdrHelper.num_of_whitelist_items == 0) { + retc = sd_ble_gap_whitelist_set(NULL, 0); + } else { + retc = sd_ble_gap_whitelist_set(gapAdrHelper.whitelist, gapAdrHelper.num_of_whitelist_items); + } + } + + switch(retc) { + case NRF_SUCCESS: + return BLE_ERROR_NONE; + + case BLE_ERROR_GAP_WHITELIST_IN_USE: //The whitelist is in use by a BLE role and cannot be set or cleared. + case BLE_ERROR_GAP_DEVICE_IDENTITIES_IN_USE: //The device identity list is in use and cannot be set or cleared. + return BLE_ERROR_ALREADY_INITIALIZED; + + case NRF_ERROR_INVALID_ADDR: + case BLE_ERROR_GAP_INVALID_BLE_ADDR: //Invalid address type is supplied. + case NRF_ERROR_DATA_SIZE: + case BLE_ERROR_GAP_DEVICE_IDENTITIES_DUPLICATE: //The device identity list contains multiple entries with the same identity address. + return BLE_ERROR_INVALID_PARAM; + + default: + return BLE_ERROR_UNSPECIFIED; + } +} + +#endif \ No newline at end of file diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h index 6af39a4080..7754330494 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h @@ -29,13 +29,17 @@ #define YOTTA_CFG_WHITELIST_MAX_SIZE BLE_GAP_WHITELIST_ADDR_MAX_COUNT #endif #ifndef YOTTA_CFG_IRK_TABLE_MAX_SIZE - #define YOTTA_CFG_IRK_TABLE_MAX_SIZE BLE_GAP_WHITELIST_IRK_MAX_COUNT + #if (NRF_SD_BLE_API_VERSION >= 3) + #define YOTTA_CFG_IRK_TABLE_MAX_SIZE BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT + #else + #define YOTTA_CFG_IRK_TABLE_MAX_SIZE BLE_GAP_WHITELIST_IRK_MAX_COUNT + #endif #elif YOTTA_CFG_IRK_TABLE_MAX_SIZE > BLE_GAP_WHITELIST_IRK_MAX_COUNT #undef YOTTA_CFG_IRK_TABLE_MAX_SIZE #define YOTTA_CFG_IRK_TABLE_MAX_SIZE BLE_GAP_WHITELIST_IRK_MAX_COUNT #endif #include "ble/blecommon.h" -#include "ble.h" +#include "headers\ble.h" #include "ble/GapAdvertisingParams.h" #include "ble/GapAdvertisingData.h" #include "ble/Gap.h" @@ -135,6 +139,7 @@ private: uint8_t whitelistAddressesSize; ble_gap_addr_t whitelistAddresses[YOTTA_CFG_WHITELIST_MAX_SIZE]; +#if (NRF_SD_BLE_API_VERSION <= 2) /* * An internal function used to populate the ble_gap_whitelist_t that will be used by * the SoftDevice for filtering requests. This function is needed because for the BLE @@ -142,6 +147,22 @@ private: * the IRK table. */ ble_error_t generateStackWhitelist(ble_gap_whitelist_t &whitelist); +#endif + +#if (NRF_SD_BLE_API_VERSION >= 3) + typedef struct + { + ble_gap_addr_t private_device[YOTTA_CFG_WHITELIST_MAX_SIZE + YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + ble_gap_addr_t * whitelist[YOTTA_CFG_WHITELIST_MAX_SIZE + YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + uint32_t num_of_whitelist_items; + ble_gap_id_key_t identitie[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + ble_gap_id_key_t * identities[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + uint32_t num_of_identiti_items; + } gapAdrHelper_t; + + ble_error_t getStackWhiteIdentityList(gapAdrHelper_t &gapAdrHelper); + ble_error_t apllyWhiteIdentityList(gapAdrHelper_t &gapAdrHelper); +#endif private: bool radioNotificationCallbackParam; /* parameter to be passed into the Timeout-generated radio notification callback. */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h index 81481d3e89..f296dc9580 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h @@ -20,7 +20,7 @@ #include #include "ble/blecommon.h" -#include "ble.h" /* nordic ble */ +#include "headers\ble.h" /* nordic ble */ #include "ble/Gap.h" #include "ble/GattServer.h" diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h index 2fa7b05511..4d1bc51d78 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h @@ -45,7 +45,7 @@ public: virtual ble_error_t purgeAllBondingState(void) { return btle_purgeAllBondingState(); } - +#if (NRF_SD_BLE_API_VERSION <= 2) /** * @brief Returns a list of addresses from peers in the stacks bond table. * @@ -112,7 +112,7 @@ public: return BLE_ERROR_NONE; } - +#endif /** * @brief Clear nRF5xSecurityManager's state. * @@ -146,6 +146,7 @@ private: nRF5xSecurityManager(const nRF5xSecurityManager &); const nRF5xSecurityManager& operator=(const nRF5xSecurityManager &); +#if (NRF_SD_BLE_API_VERSION <= 2) /* * Expose an interface that allows us to query the SoftDevice bond table * and extract a whitelist. @@ -153,7 +154,7 @@ private: ble_error_t createWhitelistFromBondTable(ble_gap_whitelist_t &whitelistFromBondTable) const { return btle_createWhitelistFromBondTable(&whitelistFromBondTable); } - +#endif /* * Given a BLE address and a IRK this function check whether the address * can be generated from the IRK. To do so, this function uses the hash diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp index 4bd0da6dd7..48e93cfccc 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp @@ -286,7 +286,15 @@ nRF5xServiceDiscovery::processDiscoverUUIDResponse(const ble_gattc_evt_char_val_ if (state == DISCOVER_SERVICE_UUIDS) { if ((response->count == 1) && (response->value_len == UUID::LENGTH_OF_LONG_UUID)) { UUID::LongUUIDBytes_t uuid; + +#if (NRF_SD_BLE_API_VERSION >= 3) + ble_gattc_handle_value_t iter; + memset(&iter, 0, sizeof(ble_gattc_handle_value_t)); + (void) sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter((ble_gattc_evt_t*)response, &iter); + memcpy(uuid, iter.p_value, UUID::LENGTH_OF_LONG_UUID); +#else memcpy(uuid, response->handle_value[0].p_value, UUID::LENGTH_OF_LONG_UUID); +#endif unsigned serviceIndex = serviceUUIDDiscoveryQueue.dequeue(); services[serviceIndex].setupLongUUID(uuid, UUID::LSB); @@ -298,9 +306,16 @@ nRF5xServiceDiscovery::processDiscoverUUIDResponse(const ble_gattc_evt_char_val_ } else if (state == DISCOVER_CHARACTERISTIC_UUIDS) { if ((response->count == 1) && (response->value_len == UUID::LENGTH_OF_LONG_UUID + 1 /* props */ + 2 /* value handle */)) { UUID::LongUUIDBytes_t uuid; - + +#if (NRF_SD_BLE_API_VERSION >= 3) + ble_gattc_handle_value_t iter; + memset(&iter, 0, sizeof(ble_gattc_handle_value_t)); + (void) sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter((ble_gattc_evt_t*)response, &iter); + memcpy(uuid, &(iter.p_value[3]), UUID::LENGTH_OF_LONG_UUID); +#else memcpy(uuid, &(response->handle_value[0].p_value[3]), UUID::LENGTH_OF_LONG_UUID); - +#endif + unsigned charIndex = charUUIDDiscoveryQueue.dequeue(); characteristics[charIndex].setupLongUUID(uuid, UUID::LSB); diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h index 52b8342971..7bd6e88936 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h @@ -21,7 +21,7 @@ #include "ble/DiscoveredService.h" #include "nRF5xDiscoveredCharacteristic.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gattc.h" class nRF5xGattClient; /* forward declaration */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h index 253f879999..0b5a84d16b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h @@ -6,6 +6,87 @@ #ifdef USE_APP_CONFIG #include "app_config.h" #endif +// Application + +//========================================================== +// NRF_BLE_CENTRAL_LINK_COUNT - Number of central links +#ifndef NRF_BLE_CENTRAL_LINK_COUNT +#define NRF_BLE_CENTRAL_LINK_COUNT 0 +#endif + +// NRF_BLE_CENTRAL_LINK_COUNT - Number of central links +#ifndef NRF_BLE_CENTRAL_LINK_COUNT +#define NRF_BLE_CENTRAL_LINK_COUNT 0 +#endif + +// NRF_BLE_PERIPHERAL_LINK_COUNT - Number of peripheral links +#ifndef NRF_BLE_PERIPHERAL_LINK_COUNT +#define NRF_BLE_PERIPHERAL_LINK_COUNT 1 +#endif + +// NRF_BLE_PERIPHERAL_LINK_COUNT - Number of peripheral links +#ifndef NRF_BLE_PERIPHERAL_LINK_COUNT +#define NRF_BLE_PERIPHERAL_LINK_COUNT 1 +#endif + +// +//========================================================== + +// nRF_BLE + +//========================================================== +// BLE_ADVERTISING_ENABLED - ble_advertising - Advertising module + + +#ifndef BLE_ADVERTISING_ENABLED +#define BLE_ADVERTISING_ENABLED 1 +#endif + +// BLE_DTM_ENABLED - ble_dtm - Module for testing RF/PHY using DTM commands + + +#ifndef BLE_DTM_ENABLED +#define BLE_DTM_ENABLED 0 +#endif + +// BLE_RACP_ENABLED - ble_racp - Record Access Control Point library + + +#ifndef BLE_RACP_ENABLED +#define BLE_RACP_ENABLED 0 +#endif + +// NRF_BLE_GATT_ENABLED - nrf_ble_gatt - GATT module +//========================================================== +#ifndef NRF_BLE_GATT_ENABLED +#define NRF_BLE_GATT_ENABLED 1 +#endif +#if NRF_BLE_GATT_ENABLED +// NRF_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size that is passed to the @ref sd_ble_enable function. +#ifndef NRF_BLE_GATT_MAX_MTU_SIZE +#define NRF_BLE_GATT_MAX_MTU_SIZE 158 +#endif + +#endif //NRF_BLE_GATT_ENABLED +// + +// NRF_BLE_QWR_ENABLED - nrf_ble_qwr - Queued writes support module (prepare/execute write) + + +#ifndef NRF_BLE_QWR_ENABLED +#define NRF_BLE_QWR_ENABLED 0 +#endif + +// PEER_MANAGER_ENABLED - peer_manager - Peer Manager + + +#ifndef PEER_MANAGER_ENABLED +#define PEER_MANAGER_ENABLED 1 +#endif + +// +//========================================================== + // nRF_Drivers //========================================================== diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h index bb01874d63..fd3329f9e1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h @@ -62,7 +62,7 @@ #include #include "nrf_error.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gattc.h" #include "ble_advdata.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c index 5b7852b2b5..eba5b3285d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.c @@ -40,7 +40,7 @@ #if NRF_MODULE_ENABLED(BLE_DB_DISCOVERY) #include "ble_db_discovery.h" #include -#include "ble.h" +#include "headers\ble.h" #include "ble_srv_common.h" #define NRF_LOG_MODULE_NAME "BLE_DB_DISC" #include "nrf_log.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h index c68fdeaeee..0372a68fad 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_db_discovery/ble_db_discovery.h @@ -70,7 +70,7 @@ #include #include "nrf_error.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gattc.h" #include "ble_srv_common.h" #include "ble_gatt_db.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h index 715bcb1670..a6a60614ce 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_racp/ble_racp.h @@ -49,7 +49,7 @@ #include #include -#include "ble.h" +#include "headers\ble.h" #include "ble_types.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h index cc16c20d8c..89ccfc4247 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h @@ -51,7 +51,7 @@ #include #include #include -#include "ble.h" +#include "headers\ble.h" #include "app_util.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h index ac69e0781f..230c949474 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h @@ -48,7 +48,7 @@ #define BLE_CONN_PARAMS_H__ #include -#include "ble.h" +#include "headers\ble.h" #include "ble_srv_common.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c index 3d008a9730..31cf4aaf28 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c @@ -40,7 +40,7 @@ #include #include #include -#include "ble.h" +#include "headers\ble.h" #include "sdk_mapped_flags.h" #include "app_error.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h index b39c76ff25..3820688117 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h @@ -68,7 +68,7 @@ #include #include -#include "ble.h" +#include "headers\ble.h" #include "sdk_mapped_flags.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h index d027c289d6..b85321dec7 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h @@ -47,7 +47,7 @@ #define BLE_GATT_DB_H__ #include -#include "ble.h" +#include "headers\ble.h" #include "ble_gattc.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c index de8c343f6a..5770f34522 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c @@ -45,7 +45,7 @@ #include #include "nordic_common.h" #include "app_error.h" -#include "ble.h" +#include "headers\ble.h" bool ble_srv_is_notification_enabled(uint8_t const * p_encoded_data) { diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h index 9836cba680..8e65597fbd 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h @@ -51,7 +51,7 @@ #include #include "ble_types.h" #include "app_util.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "ble_gatt.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h index 8c0055f6ee..24f1ffe35d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h index abf484fad8..c890335e70 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c index 75942d5471..9c4b44d45d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c @@ -41,7 +41,7 @@ #include "id_manager.h" #include -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "ble_conn_state.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h index d8ab77818e..503d3c4380 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "peer_manager_types.h" @@ -280,6 +280,37 @@ ret_code_t im_privacy_get(pm_privacy_params_t * p_privacy_params); */ bool im_address_resolve(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk); +/**@brief Function for calculating the ah() hash function described in Bluetooth core specification + * 4.2 section 3.H.2.2.2. + * + * @detail BLE uses a hash function to calculate the first half of a resolvable address + * from the second half of the address and an irk. This function will use the ECB + * periferal to hash these data acording to the Bluetooth core specification. + * + * @note The ECB expect little endian input and output. + * This function expect big endian and will reverse the data as necessary. + * + * @param[in] p_k The key used in the hash function. + * For address resolution this is should be the irk. + * The array must have a length of 16. + * @param[in] p_r The rand used in the hash function. For generating a new address + * this would be a random number. For resolving a resolvable address + * this would be the last half of the address being resolved. + * The array must have a length of 3. + * @param[out] p_local_hash The result of the hash operation. For address resolution this + * will match the first half of the address being resolved if and only + * if the irk used in the hash function is the same one used to generate + * the address. + * The array must have a length of 16. + * + * @note ====IMPORTANT==== + * This is a special modification to the original nRF5x SDK required by the mbed BLE API + * to be able to generate BLE private resolvable addresses. This function is used by + * the BLE API implementation for nRF5xSecurityManager::getAddressFromBondTable() in the + * ble-nrf52832 yotta module. + * ================= + */ +void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash); /**@brief Function for setting / clearing the whitelist. * diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h index c128a1ab7a..58f3a008bd 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h @@ -62,7 +62,7 @@ #include #include #include "sdk_common.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "peer_manager_types.h" #include "peer_database.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h index 5834b3a76d..b1f3de8ce6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c index ff292ebf92..8c6ca548b2 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c @@ -41,7 +41,7 @@ #include "security_dispatcher.h" #include -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "ble_conn_state.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h index fcc84ea546..a5f1e54ccb 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h index 8f915cfc4b..7aebac8346 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "ble.h" +#include "headers\ble.h" #include "ble_gap.h" #include "peer_manager_types.h" #include "security_dispatcher.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c index 3b39ac3657..6597a81f7d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_error.c @@ -63,6 +63,7 @@ */ /*lint -save -e14 */ +#if (!defined(FEATURE_BLE) && defined(__MBED__)) || !defined(__MBED__) // remove implementation for mbed-os BLE void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name) { error_info_t error_info = @@ -75,6 +76,7 @@ void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * UNUSED_VARIABLE(error_info); } +#endif /*lint -save -e14 */ void app_error_handler_bare(ret_code_t error_code) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h index ae345af544..675eab0ed4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/app_util_platform.h @@ -144,13 +144,13 @@ typedef enum #define NRF_BREAKPOINT_COND NRF_BREAKPOINT #endif // __CORTEX_M == 0x04 -#if defined ( __CC_ARM ) -#define PACKED(TYPE) __packed TYPE -#define PACKED_STRUCT PACKED(struct) -#elif defined ( __GNUC__ ) -#define PACKED __attribute__((packed)) -#define PACKED_STRUCT struct PACKED -#endif +// #if defined ( __CC_ARM ) +// #define PACKED(TYPE) __packed TYPE +// #define PACKED_STRUCT PACKED(struct) +// #elif defined ( __GNUC__ ) +// #define PACKED __attribute__((packed)) +// #define PACKED_STRUCT struct PACKED +// #endif void app_util_critical_region_enter (uint8_t *p_nested); void app_util_critical_region_exit (uint8_t nested); diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h index 7e308ded64..32535498c0 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h @@ -55,7 +55,7 @@ extern "C" { #ifdef BLE_STACK_SUPPORT_REQD #include -#include "ble.h" +#include "headers\ble.h" #include "nrf_sdm.h" #include "app_error.h" #include "app_util.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c index f5d1416e02..982bcb039c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c @@ -62,7 +62,7 @@ #elif defined(ANT_STACK_SUPPORT_REQD) #include "ant_interface.h" #elif defined(BLE_STACK_SUPPORT_REQD) - #include "ble.h" + #include "headers\ble.h" #endif #define RAM_START_ADDRESS 0x20000000 diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h index 1b8e4fca9b..11e2ca5c8a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h @@ -66,7 +66,7 @@ #include "ble_stack_handler_types.h" #include "ant_stack_handler_types.h" #if defined(BLE_STACK_SUPPORT_REQD) - #include "ble.h" + #include "headers\ble.h" #endif #include "app_ram_base.h" diff --git a/targets/targets.json b/targets/targets.json index 5326c38c6a..4acb1cb307 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -2582,7 +2582,7 @@ "toolchains": ["ARM_STD", "GCC_ARM", "IAR"] }, "MERGE_BOOTLOADER": false, - "features": [], + "features": ["BLE"], "config": { "lf_clock_src": { "value": "NRF_LF_SRC_XTAL", From 8aa71fa47a70bbe1127b812e06d66350f39fd610 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 16 Jan 2017 14:16:02 +0100 Subject: [PATCH 15/31] add mising fds configuration --- .../TARGET_MCU_NRF52840/sdk/sdk_config.h | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h index 0b5a84d16b..25ecf907d9 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/sdk/sdk_config.h @@ -2986,6 +2986,53 @@ #define CRC32_ENABLED 1 #endif +// FDS_ENABLED - fds - Flash data storage module +//========================================================== +#ifndef FDS_ENABLED +#define FDS_ENABLED 1 +#endif +#if FDS_ENABLED +// FDS_OP_QUEUE_SIZE - Size of the internal queue. +#ifndef FDS_OP_QUEUE_SIZE +#define FDS_OP_QUEUE_SIZE 4 +#endif + +// FDS_CHUNK_QUEUE_SIZE - Determines how many @ref fds_record_chunk_t structures can be buffered at any time. +#ifndef FDS_CHUNK_QUEUE_SIZE +#define FDS_CHUNK_QUEUE_SIZE 8 +#endif + +// FDS_MAX_USERS - Maximum number of callbacks that can be registered. +#ifndef FDS_MAX_USERS +#define FDS_MAX_USERS 8 +#endif + +// FDS_VIRTUAL_PAGES - Number of virtual flash pages to use. +// One of the virtual pages is reserved by the system for garbage collection. +// Therefore, the minimum is two virtual pages: one page to store data and +// one page to be used by the system for garbage collection. The total amount +// of flash memory that is used by FDS amounts to @ref FDS_VIRTUAL_PAGES +// @ref FDS_VIRTUAL_PAGE_SIZE * 4 bytes. + +#ifndef FDS_VIRTUAL_PAGES +#define FDS_VIRTUAL_PAGES 3 +#endif + +// FDS_VIRTUAL_PAGE_SIZE - The size of a virtual page of flash memory, expressed in number of 4-byte words. + + +// By default, a virtual page is the same size as a physical page. +// The size of a virtual page must be a multiple of the size of a physical page. +// <1024=> 1024 +// <2048=> 2048 + +#ifndef FDS_VIRTUAL_PAGE_SIZE +#define FDS_VIRTUAL_PAGE_SIZE 1024 +#endif + +#endif //FDS_ENABLED +// + // FSTORAGE_ENABLED - fstorage - Flash storage module //========================================================== #ifndef FSTORAGE_ENABLED From 42fcae481a9f9edd1266b569d17f427a39c29dff Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 25 Jan 2017 16:49:09 +0100 Subject: [PATCH 16/31] nRF5: whitelisting update fo SD API >-3.x.x --- .../TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 157 +++++++++++++++--- .../TARGET_NRF5_SDK13/source/nRF5xGap.h | 20 ++- .../device/TOOLCHAIN_ARM_STD/nRF52832.sct | 4 +- .../device/TOOLCHAIN_GCC_ARM/NRF52840.ld | 2 +- .../device/TOOLCHAIN_IAR/nRF52832.icf | 2 +- 5 files changed, 151 insertions(+), 34 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp index 358ab5c810..e5f23f62b4 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -28,6 +28,7 @@ #if (NRF_SD_BLE_API_VERSION >= 3) #include "peer_manager.h" + #include "peer_data_storage.h" #endif @@ -172,7 +173,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) (params.getTimeout() > GapAdvertisingParams::GAP_ADV_PARAMS_TIMEOUT_MAX)) { return BLE_ERROR_PARAM_OUT_OF_RANGE; } - uint32_t err ; + uint32_t err; #if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; @@ -192,9 +193,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) } } #else - gapAdrHelper_t gapAdrHelper; - getStackWhiteIdentityList(gapAdrHelper); - err = apllyWhiteIdentityList(gapAdrHelper); + err = updateWhiteAndIdentityListInStack(); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; @@ -247,9 +246,7 @@ ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) } } #else - gapAdrHelper_t gapAdrHelper; - getStackWhiteIdentityList(gapAdrHelper); - uint32_t err = apllyWhiteIdentityList(gapAdrHelper); + uint32_t err = updateWhiteAndIdentityListInStack(); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; @@ -262,6 +259,11 @@ ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) #if (NRF_SD_BLE_API_VERSION <= 2) scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ +#else + scanParams.use_whitelist = scanningPolicyMode; + scanParams.adv_dir_report = 0; + + #endif scanParams.interval = scanningParams.getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ scanParams.window = scanningParams.getWindow(); /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ @@ -350,9 +352,7 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, } } #else - gapAdrHelper_t gapAdrHelper; - getStackWhiteIdentityList(gapAdrHelper); - uint32_t err = apllyWhiteIdentityList(gapAdrHelper); + uint32_t err = updateWhiteAndIdentityListInStack(); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; @@ -363,6 +363,9 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, #if (NRF_SD_BLE_API_VERSION <= 2) scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ +#else + scanParams.use_whitelist = scanningPolicyMode; + scanParams.adv_dir_report = 0; #endif if (scanParamsIn != NULL) { @@ -1015,32 +1018,124 @@ ble_error_t nRF5xGap::generateStackWhitelist(ble_gap_whitelist_t &whitelist) #endif #if (NRF_SD_BLE_API_VERSION >= 3) + +/** + * Fuction for preparing setting of the whitelist-feature and identiti-reseolv-feature (privacy). + * + * Created setting are intended to be used to configure SoftDevices. + * + * @param[out] gapAdrHelper Reference to the struct for storing settings. + */ +ble_error_t nRF5xGap::getStackWhiteIdentityList(GapWhiteAndIdentityList_t &gapAdrHelper) +{ + uint32_t peers_to_check = pm_peer_count(); + pm_peer_id_t peer_id; + + ret_code_t ret; -ble_error_t nRF5xGap::getStackWhiteIdentityList(gapAdrHelper_t &gapAdrHelper) -{ - // it's a mock - //@todo non trivial implementation - gapAdrHelper.num_of_whitelist_items = 0; - gapAdrHelper.num_of_identiti_items = 0; + pm_peer_data_bonding_t bond_data; + pm_peer_data_t peer_data; + uint32_t const buf_size = sizeof(bond_data); + + memset(&peer_data, 0x00, sizeof(peer_data)); + peer_data.p_bonding_data = &bond_data; + + + + uint8_t irk_fund[YOTTA_CFG_WHITELIST_MAX_SIZE]; + + memset(irk_fund, 0x00, sizeof(irk_fund)); + + + gapAdrHelper.identities_cnt = 0; + + + peer_id = pm_next_peer_id_get(PM_PEER_ID_INVALID); + + nRF5xSecurityManager& securityManager = (nRF5xSecurityManager&) nRF5xn::Instance(0).getSecurityManager(); + + /** + * Build identities list: + * For every private resolvable address in the bond table check if + * there is maching address in th provided whitelist. + */ + while ((peer_id != PM_PEER_ID_INVALID) && (peers_to_check--)) + { + memset(&bond_data, 0x00, sizeof(bond_data)); + + // Read peer data from flash. + ret = pds_peer_data_read(peer_id, PM_PEER_DATA_ID_BONDING, + &peer_data, &buf_size); + + + if ((ret == NRF_ERROR_NOT_FOUND) || (ret == NRF_ERROR_INVALID_PARAM)) + { + // Peer data coulnd't be found in flash or peer ID is not valid. + return BLE_ERROR_UNSPECIFIED; + } + + if ( bond_data.peer_ble_id.id_addr_info.addr_type == BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE) + { + for (uint8_t i = 0; i < whitelistAddressesSize; ++i) + { + if (!irk_fund[i]) + { + if (whitelistAddresses[i].addr_type == BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE) + { + + //ble_gap_irk_t *p_dfg = &bond_data.peer_ble_id.id_info; + if (securityManager.matchAddressAndIrk(&whitelistAddresses[i], &bond_data.peer_ble_id.id_info)) + { + // Copy data to the buffer. + memcpy(&gapAdrHelper.identity[i], &bond_data.peer_ble_id, sizeof(ble_gap_id_key_t)); + gapAdrHelper.pp_identities[i] = &gapAdrHelper.identity[i]; + gapAdrHelper.identities_cnt++; + + irk_fund[i] = 1; // don't look at this address again + } + } + } + } + } + + // get next peer id + peer_id = pm_next_peer_id_get(peer_id); + } + + gapAdrHelper.addr_cnt = 0; + + /** + * Bulida whitelist from the rest of addresses (explicite addressess6) + */ + for (uint8_t i = 0; i < whitelistAddressesSize; ++i) + { + if (!irk_fund[i]) + { + memcpy(&gapAdrHelper.addr[i], &bond_data.peer_ble_id.id_addr_info, sizeof(ble_gap_addr_t)); + gapAdrHelper.pp_addr[i] = &gapAdrHelper.addr[i]; + gapAdrHelper.addr_cnt++; + } + } + return BLE_ERROR_NONE; } -ble_error_t nRF5xGap::apllyWhiteIdentityList(gapAdrHelper_t &gapAdrHelper) +ble_error_t nRF5xGap::apllyWhiteIdentityList(GapWhiteAndIdentityList_t &gapAdrHelper) { uint32_t retc; - if (gapAdrHelper.num_of_identiti_items == 0) { + if (gapAdrHelper.identities_cnt == 0) { retc = sd_ble_gap_device_identities_set(NULL, NULL, 0); } else { - retc = sd_ble_gap_device_identities_set(gapAdrHelper.identities, NULL /* Don't use local IRKs*/,gapAdrHelper.num_of_identiti_items); + retc = sd_ble_gap_device_identities_set(gapAdrHelper.pp_identities, NULL /* Don't use local IRKs*/,gapAdrHelper.identities_cnt); } if (retc == NRF_SUCCESS) { - if (gapAdrHelper.num_of_whitelist_items == 0) { + if (gapAdrHelper.addr_cnt == 0) { retc = sd_ble_gap_whitelist_set(NULL, 0); } else { - retc = sd_ble_gap_whitelist_set(gapAdrHelper.whitelist, gapAdrHelper.num_of_whitelist_items); + retc = sd_ble_gap_whitelist_set(gapAdrHelper.pp_addr, gapAdrHelper.addr_cnt); } } @@ -1063,4 +1158,24 @@ ble_error_t nRF5xGap::apllyWhiteIdentityList(gapAdrHelper_t &gapAdrHelper) } } +ble_error_t nRF5xGap::updateWhiteAndIdentityListInStack(void) +{ + GapWhiteAndIdentityList_t whiteAndIdentityList; + uint32_t err; + + /* Add missing IRKs to nRF5xGap's whitelist from the bond table held by the Peer Manager */ + if (advertisingPolicyMode != Gap::ADV_POLICY_IGNORE_WHITELIST) { + err = getStackWhiteIdentityList(whiteAndIdentityList); + + if (err != BLE_ERROR_NONE) { + return (ble_error_t)err; + } + } else { + whiteAndIdentityList.addr_cnt = 0; + whiteAndIdentityList.identities_cnt = 0; + } + + + return apllyWhiteIdentityList(whiteAndIdentityList); +} #endif \ No newline at end of file diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h index 7754330494..fc91068828 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h @@ -152,16 +152,18 @@ private: #if (NRF_SD_BLE_API_VERSION >= 3) typedef struct { - ble_gap_addr_t private_device[YOTTA_CFG_WHITELIST_MAX_SIZE + YOTTA_CFG_IRK_TABLE_MAX_SIZE]; - ble_gap_addr_t * whitelist[YOTTA_CFG_WHITELIST_MAX_SIZE + YOTTA_CFG_IRK_TABLE_MAX_SIZE]; - uint32_t num_of_whitelist_items; - ble_gap_id_key_t identitie[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; - ble_gap_id_key_t * identities[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; - uint32_t num_of_identiti_items; - } gapAdrHelper_t; + ble_gap_addr_t addr[YOTTA_CFG_WHITELIST_MAX_SIZE]; + ble_gap_addr_t * pp_addr[YOTTA_CFG_WHITELIST_MAX_SIZE]; + uint32_t addr_cnt; + + ble_gap_id_key_t identity[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + ble_gap_id_key_t * pp_identities[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + uint32_t identities_cnt; + } GapWhiteAndIdentityList_t; - ble_error_t getStackWhiteIdentityList(gapAdrHelper_t &gapAdrHelper); - ble_error_t apllyWhiteIdentityList(gapAdrHelper_t &gapAdrHelper); + ble_error_t getStackWhiteIdentityList(GapWhiteAndIdentityList_t &whiteAndIdentityList); + ble_error_t apllyWhiteIdentityList(GapWhiteAndIdentityList_t &whiteAndIdentityList); + ble_error_t updateWhiteAndIdentityListInStack(void); #endif private: diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct index 5cecefb903..37b77b1dd2 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct @@ -4,10 +4,10 @@ LR_IROM1 0x21000 0x00DF000 { *(InRoot$$Sections) .ANY (+RO) } - RW_IRAM0 0x20002EF8 UNINIT 0x000000F8 { ;no init section + RW_IRAM0 0x20003288 UNINIT 0x000000F8 { ;no init section *(noinit) } - RW_IRAM1 0x20002FF0 0x0003D010 { + RW_IRAM1 0x20003380 0x0003cc80 { .ANY (+RW +ZI) } } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld index bc606efb0a..16b5bf1d4f 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld @@ -19,7 +19,7 @@ MEMORY { FLASH (rx) : ORIGIN = 0x21000, LENGTH = 0xDF000 - RAM (rwx) : ORIGIN = 0x20002ef8, LENGTH = 0x3d108 + RAM (rwx) : ORIGIN = 0x20003288, LENGTH = 0x3cd78 } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf index 4fa73dd2c8..5a278aa31a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf @@ -6,7 +6,7 @@ define symbol __ICFEDIT_intvec_start__ = 0x21000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x21000; define symbol __ICFEDIT_region_ROM_end__ = 0xfffff; -define symbol __ICFEDIT_region_RAM_start__ = 0x20002ef8; +define symbol __ICFEDIT_region_RAM_start__ = 0x20003288; define symbol __ICFEDIT_region_RAM_end__ = 0x2003ffff; export symbol __ICFEDIT_region_RAM_start__; export symbol __ICFEDIT_region_RAM_end__; From 1366dfb65f7281b531d59397feb110fba3a480e9 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 25 Jan 2017 17:12:26 +0100 Subject: [PATCH 17/31] nrf5_SDK13 update copyright clause --- .../sdk/boards/arduino_primo.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/boards.c | 48 ++++++++++++++----- .../TARGET_NRF5_SDK13/sdk/boards/boards.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/nrf6310.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca10000.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca10001.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca10003.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca10028.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca10031.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca10036.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca10040.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca10056.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/pca20006.h | 40 +++++++++++++--- .../TARGET_NRF5_SDK13/sdk/boards/wt51822.h | 40 +++++++++++++--- .../sdk/drivers_nrf/hal/nrf_power.h | 40 +++++++++++++--- .../sdk/drivers_nrf/power/nrf_drv_power.c | 40 +++++++++++++--- .../sdk/drivers_nrf/power/nrf_drv_power.h | 40 +++++++++++++--- .../sdk/libraries/crc32/crc32.c | 40 +++++++++++++--- .../sdk/libraries/crc32/crc32.h | 40 +++++++++++++--- .../sdk/libraries/queue/nrf_queue.c | 40 +++++++++++++--- .../sdk/libraries/queue/nrf_queue.h | 40 +++++++++++++--- .../sdk/libraries/timer/app_timer.c | 40 +++++++++++++--- .../sdk/libraries/timer/app_timer.h | 40 +++++++++++++--- .../sdk/libraries/timer/app_timer_appsh.c | 40 +++++++++++++--- .../sdk/libraries/timer/app_timer_appsh.h | 40 +++++++++++++--- .../sdk/libraries/timer/app_timer_rtx.c | 40 +++++++++++++--- .../sdk/libraries/util/nrf_bitmask.h | 39 +++++++++++++-- 27 files changed, 896 insertions(+), 191 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/arduino_primo.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/arduino_primo.h index 2e75181840..48aa6bd3ff 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/arduino_primo.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/arduino_primo.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef ARDUINO_PRIMO_H #define ARDUINO_PRIMO_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.c index 9a9f01e055..6d79b8b540 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.c @@ -1,14 +1,40 @@ -/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. -* -* The information contained herein is property of Nordic Semiconductor ASA. -* Terms and conditions of usage are described in detail in NORDIC -* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. -* -* Licensees are granted free, non-transferable use of the information. NO -* WARRANTY of ANY KIND is provided. This heading must NOT be removed from -* the file. -* -*/ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ #include "boards.h" #include #include diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.h index a5c38b5634..3729d128ca 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/boards.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef BOARDS_H #define BOARDS_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/nrf6310.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/nrf6310.h index b306637881..857a3a6160 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/nrf6310.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/nrf6310.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef NRF6310_H__ #define NRF6310_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10000.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10000.h index 0e327f3817..e8bae27255 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10000.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10000.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA10000_H #define PCA10000_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10001.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10001.h index 9c5d708eec..4848b2d73c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10001.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10001.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA10001_H #define PCA10001_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10003.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10003.h index 7406d6d314..a0db9c13fa 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10003.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10003.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA10003_H #define PCA10003_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10028.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10028.h index 89f6228dae..9d04804ecc 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10028.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10028.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA10028_H #define PCA10028_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10031.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10031.h index 906be8c06b..29d37bf765 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10031.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10031.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA10031_H #define PCA10031_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10036.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10036.h index 25ca45d5b5..5a7e8501e6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10036.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10036.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA10036_H #define PCA10036_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10040.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10040.h index 78fceb4275..674a7bb1fc 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10040.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10040.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA10040_H #define PCA10040_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10056.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10056.h index 62b011a003..0d720ab828 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10056.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca10056.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA10056_H #define PCA10056_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca20006.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca20006.h index d6a908283b..ad6844507e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca20006.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/pca20006.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef PCA20006_H #define PCA20006_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/wt51822.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/wt51822.h index 24e517c90b..c764b2ee23 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/wt51822.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/boards/wt51822.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef WT51822_H #define WT51822_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_power.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_power.h index f56d9a19eb..c79283b448 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_power.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/hal/nrf_power.h @@ -1,13 +1,39 @@ -/* Copyright (c) Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef NRF_POWER_H__ #define NRF_POWER_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.c index 1cf4b15759..8870e7ee0d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.c @@ -1,13 +1,39 @@ -/* Copyright (c) Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #include "sdk_config.h" #if POWER_ENABLED diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.h index ed76f5217a..8df28361d4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/power/nrf_drv_power.h @@ -1,13 +1,39 @@ -/* Copyright (c) Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2000 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef NRF_DRV_POWER_H__ #define NRF_DRV_POWER_H__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.c index 88eda467c3..6f95fff527 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.c @@ -1,13 +1,39 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2013 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #include "sdk_common.h" #if NRF_MODULE_ENABLED(CRC32) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.h index 30a6499272..0a27555b16 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/crc32/crc32.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2015 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ /** @file diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.c index dc3d10f42c..22cbc5ace9 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.c @@ -1,13 +1,39 @@ -/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #include "sdk_common.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.h index e28b35b86c..e2b7280ac1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/queue/nrf_queue.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c index 87e5292d84..c18e42786d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.c @@ -1,13 +1,39 @@ -/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef __MBED_CMSIS_RTOS_CM diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.h index f3d4c1a920..cc4e104bed 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2012 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ /** @file diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.c index 8973f0b88e..b3df7095b9 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.c @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #include "app_timer_appsh.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.h index 8b6cfcf185..bcefc13580 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_appsh.h @@ -1,13 +1,39 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2014 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef APP_TIMER_APPSH_H diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c index 5ce1b7abc8..7e9a7bc10f 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/timer/app_timer_rtx.c @@ -1,13 +1,39 @@ -/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifdef __MBED_CMSIS_RTOS_CM diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_bitmask.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_bitmask.h index 258734a269..454af2b90c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_bitmask.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/libraries/util/nrf_bitmask.h @@ -1,10 +1,39 @@ -/* - * Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved. +/* + * Copyright (c) 2006 Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. * - * The information contained herein is confidential property of Nordic Semiconductor. The use, - * copying, transfer or disclosure of such information is prohibited except by express written - * agreement with Nordic Semiconductor. + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA + * integrated circuit in a product or a software update for such product, must reproduce + * the above copyright notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific prior + * written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary or object form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ From 9d8c05bbe894c71ae48a3302f3da0bca2ded9e79 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 31 Jan 2017 13:08:09 +0100 Subject: [PATCH 18/31] introduce API update to (v3.x.x and further)in BLE_GAP_EVT_CONNECTED service. whitelist and identiti list settings provider now takes into account scaner filter po0licy and advertise r filter policy --- .../TARGET_NRF5_SDK13/source/btle/btle.cpp | 27 +++++--- .../TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 68 +++++++++++-------- .../TARGET_NRF5_SDK13/source/nRF5xGap.h | 13 +++- .../source/nRF5xSecurityManager.h | 2 + .../porting_tools/replace_headers.py | 6 +- 5 files changed, 73 insertions(+), 43 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp index f05aa03c80..83004f1251 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp @@ -224,18 +224,27 @@ static void btle_handler(ble_evt_t *p_ble_evt) #endif gap.setConnectionHandle(handle); const Gap::ConnectionParams_t *params = reinterpret_cast(&(p_ble_evt->evt.gap_evt.params.connected.conn_params)); -#if (NRF_SD_BLE_API_VERSION <= 2) + const ble_gap_addr_t *peer = &p_ble_evt->evt.gap_evt.params.connected.peer_addr; +#if (NRF_SD_BLE_API_VERSION <= 2) const ble_gap_addr_t *own = &p_ble_evt->evt.gap_evt.params.connected.own_addr; -#else - const ble_gap_addr_t *peer = NULL; // @todo real implemantation pm_device_identities_list_set/get - const ble_gap_addr_t *own = NULL; -#endif + gap.processConnectionEvent(handle, - role, - static_cast(peer->addr_type), peer->addr, - static_cast(own->addr_type), own->addr, - params); + role, + static_cast(peer->addr_type), peer->addr, + static_cast(own->addr_type), own->addr, + params); +#else + Gap::AddressType_t addr_type; + Gap::Address_t own_address; + gap.getAddress(&addr_type, own_address); + + gap.processConnectionEvent(handle, + role, + static_cast(peer->addr_type), peer->addr, + addr_type, own_address, + params); +#endif break; } diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp index e5f23f62b4..36cfea8dc7 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -174,6 +174,9 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) 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; @@ -192,22 +195,21 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) return error; } } + + adv_para.p_whitelist = &whitelist; #else - err = updateWhiteAndIdentityListInStack(); + err = updateWhiteAndIdentityListInStack(nRF5xGap::avdvertising_purpose); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; } #endif /* Start Advertising */ - ble_gap_adv_params_t adv_para = {0}; + adv_para.type = params.getAdvertisingType(); adv_para.p_peer_addr = NULL; // Undirected advertisement adv_para.fp = advertisingPolicyMode; -#if (NRF_SD_BLE_API_VERSION <= 2) - adv_para.p_whitelist = &whitelist; -#endif adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms) adv_para.timeout = params.getTimeout(); @@ -227,6 +229,9 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) #if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) { + + ble_gap_scan_params_t scanParams; + #if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; @@ -245,26 +250,22 @@ ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) return error; } } + + scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ + scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ #else - uint32_t err = updateWhiteAndIdentityListInStack(); + uint32_t err = updateWhiteAndIdentityListInStack(nRF5xGap::scan_connect_purpose); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; } -#endif - ble_gap_scan_params_t scanParams; - - scanParams.active = scanningParams.getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ -#if (NRF_SD_BLE_API_VERSION <= 2) - scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ - scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ -#else scanParams.use_whitelist = scanningPolicyMode; scanParams.adv_dir_report = 0; - - #endif + + scanParams.active = scanningParams.getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ + scanParams.interval = scanningParams.getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ scanParams.window = scanningParams.getWindow(); /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ scanParams.timeout = scanningParams.getTimeout(); /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ @@ -333,6 +334,8 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, connParams.conn_sup_timeout = 600; } + ble_gap_scan_params_t scanParams; + #if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; @@ -351,23 +354,17 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, return error; } } + + scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ + scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ #else - uint32_t err = updateWhiteAndIdentityListInStack(); + uint32_t err = updateWhiteAndIdentityListInStack(nRF5xGap::scan_connect_purpose); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; } #endif - ble_gap_scan_params_t scanParams; -#if (NRF_SD_BLE_API_VERSION <= 2) - scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ - scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ -#else - scanParams.use_whitelist = scanningPolicyMode; - scanParams.adv_dir_report = 0; -#endif - if (scanParamsIn != NULL) { scanParams.active = scanParamsIn->getActiveScanning(); /**< If 1, perform active scanning (scan requests). */ scanParams.interval = scanParamsIn->getInterval(); /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ @@ -1020,9 +1017,12 @@ ble_error_t nRF5xGap::generateStackWhitelist(ble_gap_whitelist_t &whitelist) #if (NRF_SD_BLE_API_VERSION >= 3) /** - * Fuction for preparing setting of the whitelist-feature and identiti-reseolv-feature (privacy). + * Fuction for preparing setting of the whitelist-feature and identiti-reseolv-feature (privacy) for SoftDevice. * - * Created setting are intended to be used to configure SoftDevices. + * Gap::setWhitelist provide base for prepartion of this settings. + * This funtion matches resolvabele addreses (pased by Gap::setWhitelist) to IRK datas in boonds table. + * Therefore resovable addresses instead of being passed to the whitelist (intended to be passed to Softdevice) + * are passed to the identities list (intended to be passed to Softdevice). * * @param[out] gapAdrHelper Reference to the struct for storing settings. */ @@ -1158,13 +1158,21 @@ ble_error_t nRF5xGap::apllyWhiteIdentityList(GapWhiteAndIdentityList_t &gapAdrHe } } -ble_error_t nRF5xGap::updateWhiteAndIdentityListInStack(void) +ble_error_t nRF5xGap::updateWhiteAndIdentityListInStack(whiteAndIdentityListPurpose_t purpose) { GapWhiteAndIdentityList_t whiteAndIdentityList; uint32_t err; + bool provide_settings; + + if (purpose == nRF5xGap::avdvertising_purpose) { + provide_settings = (advertisingPolicyMode != Gap::ADV_POLICY_IGNORE_WHITELIST) ? true : false; + } else { //it must be nRF5xGap::scan_connect_purpose + provide_settings = (scanningPolicyMode != Gap::SCAN_POLICY_IGNORE_WHITELIST) ? true : false; + } + /* Add missing IRKs to nRF5xGap's whitelist from the bond table held by the Peer Manager */ - if (advertisingPolicyMode != Gap::ADV_POLICY_IGNORE_WHITELIST) { + if (provide_settings) { err = getStackWhiteIdentityList(whiteAndIdentityList); if (err != BLE_ERROR_NONE) { diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h index fc91068828..b4f465a12d 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h @@ -150,6 +150,7 @@ private: #endif #if (NRF_SD_BLE_API_VERSION >= 3) + /* internal type for pasing whitelist and identities list */ typedef struct { ble_gap_addr_t addr[YOTTA_CFG_WHITELIST_MAX_SIZE]; @@ -161,9 +162,19 @@ private: uint32_t identities_cnt; } GapWhiteAndIdentityList_t; + /* purpouse of updation the whitelist and identities settings */ + enum whiteAndIdentityListPurpose_t + { + scan_connect_purpose = 0, + avdvertising_purpose + } whiteAndIdentityListPurpose; + + /* Fuction for preparing setting of the whitelist-feature and identiti-reseolv-feature (privacy).*/ ble_error_t getStackWhiteIdentityList(GapWhiteAndIdentityList_t &whiteAndIdentityList); + /* Fuction for apllying setting of the whitelist-feature and identiti-reseolv-feature (privacy).*/ ble_error_t apllyWhiteIdentityList(GapWhiteAndIdentityList_t &whiteAndIdentityList); - ble_error_t updateWhiteAndIdentityListInStack(void); + /* Fuction which incorportes 2 above f. together */ + ble_error_t updateWhiteAndIdentityListInStack(whiteAndIdentityListPurpose_t purpose); #endif private: diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h index 4d1bc51d78..1b675806d9 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xSecurityManager.h @@ -57,6 +57,8 @@ public: * * @return * BLE_ERROR_NONE if successful. + * + * @todo check whether remove this function (because it is never called) */ virtual ble_error_t getAddressesFromBondTable(Gap::Whitelist_t &addresses) const { uint8_t i; diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/replace_headers.py b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/replace_headers.py index 6e13fd632d..1c985f6335 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/replace_headers.py +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/porting_tools/replace_headers.py @@ -40,9 +40,9 @@ def replace_header(in_path): print fn -pathes = ["C:/mbed/mbed-os/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk", - "C:/mbed/mbed-os/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832\sdk", - "C:/mbed/mbed-os/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840\sdk"] +pathes = ["..\\sdk", + "..\\TARGET_MCU_NRF52832\\sdk", + "..\\TARGET_MCU_NRF52840\\sdk"] for path in pathes: replace_header(path) From 4e188af065f022a8497c302471421081543b132a Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 1 Feb 2017 09:40:44 +0100 Subject: [PATCH 19/31] upgrade implementationof gap::connect in case of private address and whitelisting for SD API 3 and further --- .../TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 16 +++++++++++++++- .../TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp index 36cfea8dc7..a915584222 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -334,7 +334,7 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, connParams.conn_sup_timeout = 600; } - ble_gap_scan_params_t scanParams; + ble_gap_scan_params_t scanParams ={0}; #if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ @@ -363,6 +363,20 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, if (err != BLE_ERROR_NONE) { return (ble_error_t)err; } + + scanParams.use_whitelist = (whitelistAddressesSize) ? 1 : 0; + + if (addr.addr_type == ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE || addr.addr_type == ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE) { + /* If a device is using Resolvable Private Addresses Section 1.3.2.2 (Core spec v4.2 volume 6 part B), + it shall also have an Identity Address that is either a Public or Random Static address type.†+ For connecting a static address must be provided by the application to the softdevice. + The softdevice will resolve the address and connect to the right device if present. */ + addr.addr_id_peer = 1; + addr.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC; + } else { + addr.addr_id_peer = 0; + } + #endif if (scanParamsIn != NULL) { diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c index a4d4bc5d89..6280236dcb 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c @@ -42,6 +42,9 @@ #include "nrf_drv_common.h" #include "lp_ticker_api.h" +#if defined(NRF52_ERRATA_20) + #include "softdevice_handler.h" +#endif //------------------------------------------------------------------------------ // Common stuff used also by lp_ticker and rtc_api (see "common_rtc.h"). From 113ae4e06bd0d8d3e5994c2dafae395b2904aac4 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 2 Feb 2017 09:55:36 +0100 Subject: [PATCH 20/31] [NRF5_SDK13] fix: - bad number of pin from nRF52840 , - bad type of mask of gpio for nRF52940 - typo (object.h) - revert abort func. to spi_master driver - update twi_master driver to the newest (e8527f65e90eee6a4dd48ca55d3fc051a556320a master SDK nRF5) --- .../TARGET_NRF5_SDK13/gpio_api.c | 10 +++-- .../TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h | 2 +- .../sdk/drivers_nrf/spi_master/nrf_drv_spi.c | 15 +++++++ .../sdk/drivers_nrf/twi_master/nrf_drv_twi.c | 41 +++++++++++++++---- 4 files changed, 55 insertions(+), 13 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c index bec5e26876..c7ae53a759 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c @@ -20,11 +20,13 @@ #include "nrf_drv_gpiote.h" #if defined(TARGET_MCU_NRF51822) - #define GPIO_PIN_COUNT 48 -#elif defined(TARGET_MCU_NRF51822) #define GPIO_PIN_COUNT 31 -#else +#elif defined(TARGET_MCU_NRF52832) #define GPIO_PIN_COUNT 32 +#elif defined(TARGET_MCU_NRF52840) + #define GPIO_PIN_COUNT 48 +#else + #error not recognized gpio count for mcu #endif typedef struct { @@ -38,7 +40,7 @@ typedef struct { } gpio_cfg_t; #if GPIO_PIN_COUNT > 32 - typedef uint32_t gpio_mask_t; + typedef uint64_t gpio_mask_t; #else typedef uint32_t gpio_mask_t; #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h index 033cc85ba0..4ae7530509 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h @@ -8,7 +8,7 @@ * 1. Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * - * 2. Redistributions in// binary form, except as embedded into a Nordic Semiconductor ASA + * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA * integrated circuit in a product or a software update for such product, must reproduce * the above copyright notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the distribution. diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c index ac6433b8e6..848255ac68 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c @@ -129,6 +129,7 @@ typedef struct bool tx_done : 1; bool rx_done : 1; + bool abort : 1; } spi_control_block_t; static spi_control_block_t m_cb[ENABLED_SPI_COUNT]; @@ -401,6 +402,19 @@ static bool transfer_byte(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb) // see how the transfer is started in the 'nrf_drv_spi_transfer' // function. uint16_t bytes_used = p_cb->bytes_transferred + 1; + + if (p_cb->abort) + { + if (bytes_used < p_cb->evt.data.done.tx_length) + { + p_cb->evt.data.done.tx_length = bytes_used; + } + if (bytes_used < p_cb->evt.data.done.rx_length) + { + p_cb->evt.data.done.rx_length = bytes_used; + } + } + if (bytes_used < p_cb->evt.data.done.tx_length) { nrf_spi_txd_set(p_spi, p_cb->evt.data.done.p_tx_buffer[bytes_used]); @@ -577,6 +591,7 @@ ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t const * const p_instance, p_cb->evt.data.done = *p_xfer_desc; p_cb->tx_done = false; p_cb->rx_done = false; + p_cb->abort = false; if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) { diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c index 2b203748ae..38d084595b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/twi_master/nrf_drv_twi.c @@ -57,7 +57,7 @@ #define NRF_LOG_DEBUG_COLOR TWI_CONFIG_DEBUG_COLOR #define EVT_TO_STR(event) (event == NRF_DRV_TWI_EVT_DONE ? "EVT_DONE" : \ (event == NRF_DRV_TWI_EVT_ADDRESS_NACK ? "EVT_ADDRESS_NACK" : \ - (event == NRF_DRV_TWI_EVT_DATA_NACK ? "EVT_DATA_NACK" : "UNKNOWN ERROR")))))) + (event == NRF_DRV_TWI_EVT_DATA_NACK ? "EVT_DATA_NACK" : "UNKNOWN ERROR"))) #define EVT_TO_STR_TWI(event) (event == NRF_TWI_EVENT_STOPPED ? "NRF_TWI_EVENT_STOPPED" : \ (event == NRF_TWI_EVENT_RXDREADY ? "NRF_TWI_EVENT_RXDREADY" : \ (event == NRF_TWI_EVENT_TXDSENT ? "NRF_TWI_EVENT_TXDSENT" : \ @@ -129,6 +129,7 @@ | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos)) #define SDA_PIN_INIT_CONF_CLR SCL_PIN_INIT_CONF_CLR +#define HW_TIMEOUT 10000 // Control block - driver instance local data. typedef struct @@ -530,7 +531,10 @@ static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb, bool no_stop) { ret_code_t ret_code = NRF_SUCCESS; - + volatile int32_t hw_timeout; + + hw_timeout = HW_TIMEOUT; + nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED); nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT); @@ -556,9 +560,11 @@ static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb, } else { - while (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, (uint8_t *)p_data, length, no_stop)) - {} - + while ((hw_timeout > 0) && twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, (uint8_t *)p_data, length, no_stop)) + { + hw_timeout--; + } + if (p_cb->error) { uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(p_twi); @@ -569,6 +575,13 @@ static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb, } } + if (hw_timeout <= 0) + { + nrf_twi_disable(p_twi); + nrf_twi_enable(p_twi); + ret_code = NRF_ERROR_INTERNAL; + } + } return ret_code; } @@ -579,6 +592,9 @@ static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb, uint8_t length) { ret_code_t ret_code = NRF_SUCCESS; + volatile int32_t hw_timeout; + + hw_timeout = HW_TIMEOUT; nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED); nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR); @@ -610,9 +626,11 @@ static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb, } else { - while (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, (uint8_t*)p_data, length, false)) - {} - + while ((hw_timeout > 0) && twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, (uint8_t*)p_data, length, false)) + { + hw_timeout--; + } + if (p_cb->error) { uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(p_twi); @@ -622,6 +640,13 @@ static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb, ret_code = twi_process_error(errorsrc); } } + + if (hw_timeout <= 0) + { + nrf_twi_disable(p_twi); + nrf_twi_enable(p_twi); + ret_code = NRF_ERROR_INTERNAL; + } } return ret_code; } From 3a81e23cf21b8a415c7d4f2f06eb58eae9074f39 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 6 Feb 2017 12:12:26 +0100 Subject: [PATCH 21/31] [nRF5_SDK13] Changes from CR. - fix typso, renaming, repharse commnets. - fix alghoritm of white/id lists setup functions in nRF5xGap class. --- .../TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 92 ++++++++++--------- .../TARGET_NRF5_SDK13/source/nRF5xGap.h | 29 +++--- .../sdk/ble/peer_manager/id_manager.h | 20 ++-- 3 files changed, 74 insertions(+), 67 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp index a915584222..f478fe170c 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -198,7 +198,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) adv_para.p_whitelist = &whitelist; #else - err = updateWhiteAndIdentityListInStack(nRF5xGap::avdvertising_purpose); + err = updateWhiteAndIdentityListInStack(nRF5xGap::purpose_avdvertising); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; @@ -254,7 +254,7 @@ ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ #else - uint32_t err = updateWhiteAndIdentityListInStack(nRF5xGap::scan_connect_purpose); + uint32_t err = updateWhiteAndIdentityListInStack(nRF5xGap::purpose_scan_connect); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; @@ -358,7 +358,7 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ #else - uint32_t err = updateWhiteAndIdentityListInStack(nRF5xGap::scan_connect_purpose); + uint32_t err = updateWhiteAndIdentityListInStack(nRF5xGap::purpose_scan_connect); if (err != BLE_ERROR_NONE) { return (ble_error_t)err; @@ -366,11 +366,12 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, scanParams.use_whitelist = (whitelistAddressesSize) ? 1 : 0; - if (addr.addr_type == ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE || addr.addr_type == ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE) { + if ((addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE) + || (addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE)) { /* If a device is using Resolvable Private Addresses Section 1.3.2.2 (Core spec v4.2 volume 6 part B), it shall also have an Identity Address that is either a Public or Random Static address type.†- For connecting a static address must be provided by the application to the softdevice. - The softdevice will resolve the address and connect to the right device if present. */ + To establish a connection, a static address must be provided by the application to the SoftDevice. + The SoftDevice resolves the address and connects to the right device if it is available. */ addr.addr_id_peer = 1; addr.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC; } else { @@ -1031,35 +1032,27 @@ ble_error_t nRF5xGap::generateStackWhitelist(ble_gap_whitelist_t &whitelist) #if (NRF_SD_BLE_API_VERSION >= 3) /** - * Fuction for preparing setting of the whitelist-feature and identiti-reseolv-feature (privacy) for SoftDevice. + * Function for preparing settings of the whitelist feature and the identity-resolving feature (privacy) for the SoftDevice. * - * Gap::setWhitelist provide base for prepartion of this settings. - * This funtion matches resolvabele addreses (pased by Gap::setWhitelist) to IRK datas in boonds table. - * Therefore resovable addresses instead of being passed to the whitelist (intended to be passed to Softdevice) - * are passed to the identities list (intended to be passed to Softdevice). + * Gap::setWhitelist provides the base for preparation of these settings. + * This function matches resolvable addresses (passed by Gap::setWhitelist) to IRK data in bonds table. + * Therefore resolvable addresses instead of being passed to the whitelist (intended to be passed to the Softdevice) + * are passed to the identities list (intended to be passed to the Softdevice). * * @param[out] gapAdrHelper Reference to the struct for storing settings. */ ble_error_t nRF5xGap::getStackWhiteIdentityList(GapWhiteAndIdentityList_t &gapAdrHelper) { - uint32_t peers_to_check = pm_peer_count(); pm_peer_id_t peer_id; ret_code_t ret; pm_peer_data_bonding_t bond_data; - pm_peer_data_t peer_data; - uint32_t const buf_size = sizeof(bond_data); - memset(&peer_data, 0x00, sizeof(peer_data)); - peer_data.p_bonding_data = &bond_data; + uint8_t irk_found[YOTTA_CFG_WHITELIST_MAX_SIZE]; - - - uint8_t irk_fund[YOTTA_CFG_WHITELIST_MAX_SIZE]; - - memset(irk_fund, 0x00, sizeof(irk_fund)); + memset(irk_found, 0x00, sizeof(irk_found)); gapAdrHelper.identities_cnt = 0; @@ -1074,18 +1067,17 @@ ble_error_t nRF5xGap::getStackWhiteIdentityList(GapWhiteAndIdentityList_t &gapAd * For every private resolvable address in the bond table check if * there is maching address in th provided whitelist. */ - while ((peer_id != PM_PEER_ID_INVALID) && (peers_to_check--)) + while (peer_id != PM_PEER_ID_INVALID) { memset(&bond_data, 0x00, sizeof(bond_data)); // Read peer data from flash. - ret = pds_peer_data_read(peer_id, PM_PEER_DATA_ID_BONDING, - &peer_data, &buf_size); + ret = pm_peer_data_bonding_load(peer_id, &bond_data); if ((ret == NRF_ERROR_NOT_FOUND) || (ret == NRF_ERROR_INVALID_PARAM)) { - // Peer data coulnd't be found in flash or peer ID is not valid. + // Peer data could not be found in flash or peer ID is not valid. return BLE_ERROR_UNSPECIFIED; } @@ -1093,7 +1085,7 @@ ble_error_t nRF5xGap::getStackWhiteIdentityList(GapWhiteAndIdentityList_t &gapAd { for (uint8_t i = 0; i < whitelistAddressesSize; ++i) { - if (!irk_fund[i]) + if (!irk_found[i]) { if (whitelistAddresses[i].addr_type == BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE) { @@ -1102,11 +1094,10 @@ ble_error_t nRF5xGap::getStackWhiteIdentityList(GapWhiteAndIdentityList_t &gapAd if (securityManager.matchAddressAndIrk(&whitelistAddresses[i], &bond_data.peer_ble_id.id_info)) { // Copy data to the buffer. - memcpy(&gapAdrHelper.identity[i], &bond_data.peer_ble_id, sizeof(ble_gap_id_key_t)); - gapAdrHelper.pp_identities[i] = &gapAdrHelper.identity[i]; + memcpy(&gapAdrHelper.identities[i], &bond_data.peer_ble_id, sizeof(ble_gap_id_key_t)); gapAdrHelper.identities_cnt++; - irk_fund[i] = 1; // don't look at this address again + irk_found[i] = 1; // don't look at this address again } } } @@ -1117,39 +1108,52 @@ ble_error_t nRF5xGap::getStackWhiteIdentityList(GapWhiteAndIdentityList_t &gapAd peer_id = pm_next_peer_id_get(peer_id); } - gapAdrHelper.addr_cnt = 0; + gapAdrHelper.addrs_cnt = 0; /** - * Bulida whitelist from the rest of addresses (explicite addressess6) + * Build whitelist from the rest of addresses (explicit addresses) */ for (uint8_t i = 0; i < whitelistAddressesSize; ++i) { - if (!irk_fund[i]) + if (!irk_found[i]) { - memcpy(&gapAdrHelper.addr[i], &bond_data.peer_ble_id.id_addr_info, sizeof(ble_gap_addr_t)); - gapAdrHelper.pp_addr[i] = &gapAdrHelper.addr[i]; - gapAdrHelper.addr_cnt++; + memcpy(&gapAdrHelper.addrs[i], &whitelistAddresses[i], sizeof(ble_gap_addr_t)); + gapAdrHelper.addrs_cnt++; } } return BLE_ERROR_NONE; } -ble_error_t nRF5xGap::apllyWhiteIdentityList(GapWhiteAndIdentityList_t &gapAdrHelper) +ble_error_t nRF5xGap::applyWhiteIdentityList(GapWhiteAndIdentityList_t &gapAdrHelper) { uint32_t retc; if (gapAdrHelper.identities_cnt == 0) { retc = sd_ble_gap_device_identities_set(NULL, NULL, 0); } else { - retc = sd_ble_gap_device_identities_set(gapAdrHelper.pp_identities, NULL /* Don't use local IRKs*/,gapAdrHelper.identities_cnt); + ble_gap_id_key_t * pp_identities[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + + for (uint32_t i = 0; i < gapAdrHelper.identities_cnt; ++i) + { + pp_identities[i] = &gapAdrHelper.identities[i]; + } + + retc = sd_ble_gap_device_identities_set(pp_identities, NULL /* Don't use local IRKs*/,gapAdrHelper.identities_cnt); } if (retc == NRF_SUCCESS) { - if (gapAdrHelper.addr_cnt == 0) { + if (gapAdrHelper.addrs_cnt == 0) { retc = sd_ble_gap_whitelist_set(NULL, 0); } else { - retc = sd_ble_gap_whitelist_set(gapAdrHelper.pp_addr, gapAdrHelper.addr_cnt); + ble_gap_addr_t * pp_addrs[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + + for (uint32_t i = 0; i < gapAdrHelper.addrs_cnt; ++i) + { + pp_addrs[i] = &gapAdrHelper.addrs[i]; + } + + retc = sd_ble_gap_whitelist_set(pp_addrs, gapAdrHelper.addrs_cnt); } } @@ -1178,9 +1182,9 @@ ble_error_t nRF5xGap::updateWhiteAndIdentityListInStack(whiteAndIdentityListPurp uint32_t err; bool provide_settings; - if (purpose == nRF5xGap::avdvertising_purpose) { + if (purpose == nRF5xGap::purpose_avdvertising) { provide_settings = (advertisingPolicyMode != Gap::ADV_POLICY_IGNORE_WHITELIST) ? true : false; - } else { //it must be nRF5xGap::scan_connect_purpose + } else { //It must be nRF5xGap::purpose_scan_connect. provide_settings = (scanningPolicyMode != Gap::SCAN_POLICY_IGNORE_WHITELIST) ? true : false; } @@ -1193,11 +1197,11 @@ ble_error_t nRF5xGap::updateWhiteAndIdentityListInStack(whiteAndIdentityListPurp return (ble_error_t)err; } } else { - whiteAndIdentityList.addr_cnt = 0; + whiteAndIdentityList.addrs_cnt = 0; whiteAndIdentityList.identities_cnt = 0; } - return apllyWhiteIdentityList(whiteAndIdentityList); + return applyWhiteIdentityList(whiteAndIdentityList); } -#endif \ No newline at end of file +#endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h index b4f465a12d..ff53048974 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h @@ -150,30 +150,33 @@ private: #endif #if (NRF_SD_BLE_API_VERSION >= 3) - /* internal type for pasing whitelist and identities list */ + /* internal type for passing a whitelist and a identities list. */ typedef struct { - ble_gap_addr_t addr[YOTTA_CFG_WHITELIST_MAX_SIZE]; - ble_gap_addr_t * pp_addr[YOTTA_CFG_WHITELIST_MAX_SIZE]; - uint32_t addr_cnt; + ble_gap_addr_t addrs[YOTTA_CFG_WHITELIST_MAX_SIZE]; + uint32_t addrs_cnt; - ble_gap_id_key_t identity[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; - ble_gap_id_key_t * pp_identities[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; + ble_gap_id_key_t identities[YOTTA_CFG_IRK_TABLE_MAX_SIZE]; uint32_t identities_cnt; } GapWhiteAndIdentityList_t; - /* purpouse of updation the whitelist and identities settings */ + /* purpose of updating the whitelist and identities settings. */ enum whiteAndIdentityListPurpose_t { - scan_connect_purpose = 0, - avdvertising_purpose + purpose_scan_connect = 0, + purpose_avdvertising } whiteAndIdentityListPurpose; - /* Fuction for preparing setting of the whitelist-feature and identiti-reseolv-feature (privacy).*/ + /* Function for preparing setting of the whitelist feature and the identity-resolving feature (privacy).*/ ble_error_t getStackWhiteIdentityList(GapWhiteAndIdentityList_t &whiteAndIdentityList); - /* Fuction for apllying setting of the whitelist-feature and identiti-reseolv-feature (privacy).*/ - ble_error_t apllyWhiteIdentityList(GapWhiteAndIdentityList_t &whiteAndIdentityList); - /* Fuction which incorportes 2 above f. together */ + + /* Function for applying setting of the whitelist feature and identity-resolving feature (privacy).*/ + ble_error_t applyWhiteIdentityList(GapWhiteAndIdentityList_t &whiteAndIdentityList); + + /* Function for introducing whitelist feature and the identity-resolving feature setting into SoftDevice. + * + * Introduced settings are comply which scanning or advertising policies. + * This function incorporates getStackWhiteIdentityList and applyWhiteIdentityList together. */ ble_error_t updateWhiteAndIdentityListInStack(whiteAndIdentityListPurpose_t purpose); #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h index 503d3c4380..ed56fb1a0d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h @@ -284,14 +284,14 @@ bool im_address_resolve(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_i * 4.2 section 3.H.2.2.2. * * @detail BLE uses a hash function to calculate the first half of a resolvable address - * from the second half of the address and an irk. This function will use the ECB - * periferal to hash these data acording to the Bluetooth core specification. + * from the second half of the address and an IRK. This function uses the ECB + * peripheral to hash this data according to the Bluetooth core specification. * - * @note The ECB expect little endian input and output. - * This function expect big endian and will reverse the data as necessary. + * @note The ECB expects little endian input and output. + * This function expects big endian and will reverse the data as necessary. * * @param[in] p_k The key used in the hash function. - * For address resolution this is should be the irk. + * For address resolution this must be the IRK. * The array must have a length of 16. * @param[in] p_r The rand used in the hash function. For generating a new address * this would be a random number. For resolving a resolvable address @@ -299,15 +299,15 @@ bool im_address_resolve(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_i * The array must have a length of 3. * @param[out] p_local_hash The result of the hash operation. For address resolution this * will match the first half of the address being resolved if and only - * if the irk used in the hash function is the same one used to generate + * if the irk used in the hash function is the same one that was used to generate * the address. * The array must have a length of 16. * * @note ====IMPORTANT==== - * This is a special modification to the original nRF5x SDK required by the mbed BLE API - * to be able to generate BLE private resolvable addresses. This function is used by - * the BLE API implementation for nRF5xSecurityManager::getAddressFromBondTable() in the - * ble-nrf52832 yotta module. + * This is a special modification to the original nRF5 SDK. It is required by the mbed BLE API + * to generate BLE private resolvable addresses. This function is used by + * the BLE API implementation for nRF5xSecurityManager::getAddressFromBondTable() in the target's + * BLE implementation. * ================= */ void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash); From f32da7a9eebf35fb41f12c92c48ce5776bdc52e2 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 8 Feb 2017 17:18:14 +0100 Subject: [PATCH 22/31] [nRF5_SDK13] fix: Gap::setAddress implementation Gap::getPermittedTxPowerValues implemnetation --- .../TARGET_NRF5_SDK13/source/btle/btle.cpp | 3 +++ .../source/btle/btle_security_pm.cpp | 4 ---- .../TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 13 ++++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp index 83004f1251..470b45b67f 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.cpp @@ -165,6 +165,9 @@ error_t btle_init(void) return ERROR_INVALID_PARAM; } + // Peer Manger must been initialised prior any other call to its API (this file and btle_security_pm.cpp) + pm_init(); + #if (NRF_SD_BLE_API_VERSION <= 2) ble_gap_addr_t addr; if (sd_ble_gap_address_get(&addr) != NRF_SUCCESS) { diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp index b813eb13ed..8b0c16175e 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_security_pm.cpp @@ -94,10 +94,6 @@ btle_initializeSecurity(bool enableBonding, } } - if (pm_init() != NRF_SUCCESS) { - return BLE_ERROR_UNSPECIFIED; - } - // update default security parameters with function call parameters securityParameters.bond = enableBonding; securityParameters.mitm = requireMITM; diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp index f478fe170c..27eab41142 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -561,12 +561,15 @@ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) */ if ((type == BLEProtocol::AddressType::PUBLIC) || (type == BLEProtocol::AddressType::RANDOM_STATIC)) { + memcpy(dev_addr.addr, address, ADDR_LEN); #if (NRF_SD_BLE_API_VERSION <= 2) cycle_mode = BLE_GAP_ADDR_CYCLE_MODE_NONE; #else privacy_params.privacy_mode = BLE_GAP_PRIVACY_MODE_OFF; + + ASSERT_INT(ERROR_NONE, pm_id_addr_set(&dev_addr), BLE_ERROR_PARAM_OUT_OF_RANGE); + ASSERT_INT(ERROR_NONE, pm_privacy_set(&privacy_params), BLE_ERROR_PARAM_OUT_OF_RANGE); #endif - memcpy(dev_addr.addr, address, ADDR_LEN); } else if ((type == BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE) || (type == BLEProtocol::AddressType::RANDOM_PRIVATE_NON_RESOLVABLE)) { @@ -575,6 +578,8 @@ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) #else privacy_params.privacy_mode = BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY; privacy_params.private_addr_type = type; + + ASSERT_INT(ERROR_NONE, pm_privacy_set(&privacy_params), BLE_ERROR_PARAM_OUT_OF_RANGE); #endif // address is ignored when in auto mode } @@ -586,9 +591,6 @@ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) dev_addr.addr_type = type; #if (NRF_SD_BLE_API_VERSION <= 2) ASSERT_INT(ERROR_NONE, sd_ble_gap_address_set(cycle_mode, &dev_addr), BLE_ERROR_PARAM_OUT_OF_RANGE); -#else - ASSERT_INT(ERROR_NONE, pm_privacy_set(&privacy_params), BLE_ERROR_PARAM_OUT_OF_RANGE); - ASSERT_INT(ERROR_NONE, pm_id_addr_set(&dev_addr), BLE_ERROR_PARAM_OUT_OF_RANGE); #endif return BLE_ERROR_NONE; @@ -678,7 +680,7 @@ void nRF5xGap::getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *co }; #elif defined(NRF52840_XXAA) static const int8_t permittedTxValues[] = { - -40, -20, -16, -12, -8, -4, 0, 4, 5, 6, 7, 8, 9 + -40, -20, -16, -12, -8, -4, 0, 2, 3, 4, 5, 6, 7, 8, 9 }; #else #error permitted TX power values unknown for this SOC @@ -1118,6 +1120,7 @@ ble_error_t nRF5xGap::getStackWhiteIdentityList(GapWhiteAndIdentityList_t &gapAd if (!irk_found[i]) { memcpy(&gapAdrHelper.addrs[i], &whitelistAddresses[i], sizeof(ble_gap_addr_t)); + gapAdrHelper.addrs[i].addr_id_peer = 0; gapAdrHelper.addrs_cnt++; } } From 9f0d754ab67ed53f7b4f03fed57a9fed8a18fa52 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 9 Feb 2017 12:19:29 +0100 Subject: [PATCH 23/31] [NRF5_SDK13] fix: - whitelistin setup modifies identitiy flag and omits address' type. --- .../TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp index 27eab41142..98a19b82dc 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -733,7 +733,10 @@ ble_error_t nRF5xGap::getWhitelist(Gap::Whitelist_t &whitelistOut) const { uint8_t i; for (i = 0; i < whitelistAddressesSize && i < whitelistOut.capacity; ++i) { - memcpy(&whitelistOut.addresses[i], &whitelistAddresses[i], sizeof(BLEProtocol::Address_t)); + memcpy( &whitelistOut.addresses[i].address, &whitelistAddresses[whitelistAddressesSize].addr, sizeof(whitelistOut.addresses[i].address)); + whitelistOut.addresses[i].type = static_cast (whitelistAddresses[whitelistAddressesSize].addr_type); + + } whitelistOut.size = i; @@ -786,7 +789,8 @@ ble_error_t nRF5xGap::setWhitelist(const Gap::Whitelist_t &whitelistIn) whitelistAddressesSize = 0; for (uint8_t i = 0; i < whitelistIn.size; ++i) { - memcpy(&whitelistAddresses[whitelistAddressesSize], &whitelistIn.addresses[i], sizeof(BLEProtocol::Address_t)); + memcpy(&whitelistAddresses[whitelistAddressesSize].addr , &whitelistIn.addresses[i].address , sizeof(whitelistAddresses[whitelistAddressesSize].addr)); + whitelistAddresses[whitelistAddressesSize].addr_type = static_cast (whitelistIn.addresses[i].type); whitelistAddressesSize++; } From b1e55094aa9237a45ce56844be87d2655332bea1 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 22 Feb 2017 15:04:56 +0100 Subject: [PATCH 24/31] [NRF52480] fix bugs: - 128 bits service's UUID discovered by a GATT client was shifted. - not possible to connect while being scanning. - not possible to scanning while being connected. for sd >= 3 whitelisting is now setups into setWhitelist method - Gap::setAddress could failed - Gap::getWhitelist wron implemenation --- .../source/btle/btle_discovery.cpp | 2 +- .../TARGET_NRF5_SDK13/source/nRF5xGap.cpp | 76 +++++++------------ .../TARGET_NRF5_SDK13/source/nRF5xGap.h | 10 +-- .../source/nRF5xServiceDiscovery.cpp | 26 ++++--- .../source/nRF5xServiceDiscovery.h | 2 +- 5 files changed, 46 insertions(+), 70 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.cpp index 0b6b1d6a9c..99059f6623 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle_discovery.cpp @@ -57,7 +57,7 @@ void bleGattcEventHandler(const ble_evt_t *p_ble_evt) case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: if (sdSingleton.isActive()) { - sdSingleton.processDiscoverUUIDResponse(&p_ble_evt->evt.gattc_evt.params.char_val_by_uuid_read_rsp); + sdSingleton.processDiscoverUUIDResponse(&p_ble_evt->evt.gattc_evt); } break; diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp index 98a19b82dc..3ce8624111 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.cpp @@ -177,7 +177,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) ble_gap_adv_params_t adv_para = {0}; -#if (NRF_SD_BLE_API_VERSION <= 2) +#if (NRF_SD_BLE_API_VERSION <= 2) /* Allocate the stack's whitelist statically */ ble_gap_whitelist_t whitelist; ble_gap_addr_t *whitelistAddressPtrs[YOTTA_CFG_WHITELIST_MAX_SIZE]; @@ -197,13 +197,9 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) } adv_para.p_whitelist = &whitelist; -#else - err = updateWhiteAndIdentityListInStack(nRF5xGap::purpose_avdvertising); - - if (err != BLE_ERROR_NONE) { - return (ble_error_t)err; - } #endif + /* For NRF_SD_BLE_API_VERSION >= 3 nRF5xGap::setWhitelist setups the whitelist. */ + /* Start Advertising */ @@ -254,11 +250,7 @@ ble_error_t nRF5xGap::startRadioScan(const GapScanningParams &scanningParams) scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ #else - uint32_t err = updateWhiteAndIdentityListInStack(nRF5xGap::purpose_scan_connect); - - if (err != BLE_ERROR_NONE) { - return (ble_error_t)err; - } + /* For NRF_SD_BLE_API_VERSION >= 3 nRF5xGap::setWhitelist setups the whitelist. */ scanParams.use_whitelist = scanningPolicyMode; scanParams.adv_dir_report = 0; @@ -318,6 +310,7 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, const GapScanningParams *scanParamsIn) { ble_gap_addr_t addr; + addr.addr_type = peerAddrType; memcpy(addr.addr, peerAddr, Gap::ADDR_LEN); @@ -358,11 +351,7 @@ ble_error_t nRF5xGap::connect(const Address_t peerAddr, scanParams.selective = scanningPolicyMode; /**< If 1, ignore unknown devices (non whitelisted). */ scanParams.p_whitelist = &whitelist; /**< Pointer to whitelist, NULL if none is given. */ #else - uint32_t err = updateWhiteAndIdentityListInStack(nRF5xGap::purpose_scan_connect); - - if (err != BLE_ERROR_NONE) { - return (ble_error_t)err; - } + /* For NRF_SD_BLE_API_VERSION >= 3 nRF5xGap::setWhitelist setups the whitelist. */ scanParams.use_whitelist = (whitelistAddressesSize) ? 1 : 0; @@ -504,6 +493,7 @@ ble_error_t nRF5xGap::reset(void) /* Clear the internal whitelist */ whitelistAddressesSize = 0; + return BLE_ERROR_NONE; } @@ -566,6 +556,7 @@ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) cycle_mode = BLE_GAP_ADDR_CYCLE_MODE_NONE; #else privacy_params.privacy_mode = BLE_GAP_PRIVACY_MODE_OFF; + dev_addr.addr_type = type; ASSERT_INT(ERROR_NONE, pm_id_addr_set(&dev_addr), BLE_ERROR_PARAM_OUT_OF_RANGE); ASSERT_INT(ERROR_NONE, pm_privacy_set(&privacy_params), BLE_ERROR_PARAM_OUT_OF_RANGE); @@ -588,8 +579,8 @@ ble_error_t nRF5xGap::setAddress(AddressType_t type, const Address_t address) return BLE_ERROR_PARAM_OUT_OF_RANGE; } - dev_addr.addr_type = type; #if (NRF_SD_BLE_API_VERSION <= 2) + dev_addr.addr_type = type; ASSERT_INT(ERROR_NONE, sd_ble_gap_address_set(cycle_mode, &dev_addr), BLE_ERROR_PARAM_OUT_OF_RANGE); #endif @@ -731,10 +722,10 @@ uint8_t nRF5xGap::getMaxWhitelistSize(void) const /**************************************************************************/ ble_error_t nRF5xGap::getWhitelist(Gap::Whitelist_t &whitelistOut) const { - uint8_t i; + uint32_t i; for (i = 0; i < whitelistAddressesSize && i < whitelistOut.capacity; ++i) { - memcpy( &whitelistOut.addresses[i].address, &whitelistAddresses[whitelistAddressesSize].addr, sizeof(whitelistOut.addresses[i].address)); - whitelistOut.addresses[i].type = static_cast (whitelistAddresses[whitelistAddressesSize].addr_type); + memcpy( &whitelistOut.addresses[i].address, &whitelistAddresses[i].addr, sizeof(whitelistOut.addresses[0].address)); + whitelistOut.addresses[i].type = static_cast (whitelistAddresses[i].addr_type); } @@ -780,20 +771,24 @@ ble_error_t nRF5xGap::setWhitelist(const Gap::Whitelist_t &whitelistIn) } /* Test for invalid parameters before we change the internal state */ - for (uint8_t i = 0; i < whitelistIn.size; ++i) { + for (uint32_t i = 0; i < whitelistIn.size; ++i) { if (whitelistIn.addresses[i].type == BLEProtocol::AddressType::RANDOM_PRIVATE_NON_RESOLVABLE) { /* This is not allowed because it is completely meaningless */ return BLE_ERROR_INVALID_PARAM; } } - whitelistAddressesSize = 0; - for (uint8_t i = 0; i < whitelistIn.size; ++i) { - memcpy(&whitelistAddresses[whitelistAddressesSize].addr , &whitelistIn.addresses[i].address , sizeof(whitelistAddresses[whitelistAddressesSize].addr)); - whitelistAddresses[whitelistAddressesSize].addr_type = static_cast (whitelistIn.addresses[i].type); - whitelistAddressesSize++; + whitelistAddressesSize = whitelistIn.size; + + for (uint32_t i = 0; i < whitelistIn.size; ++i) { + memcpy(&whitelistAddresses[i].addr , &whitelistIn.addresses[i].address , sizeof(whitelistAddresses[0].addr)); + whitelistAddresses[i].addr_type = static_cast (whitelistIn.addresses[i].type); } +#if (NRF_SD_BLE_API_VERSION >= 3) + updateWhiteAndIdentityListInStack(); +#endif + return BLE_ERROR_NONE; } @@ -1183,32 +1178,17 @@ ble_error_t nRF5xGap::applyWhiteIdentityList(GapWhiteAndIdentityList_t &gapAdrHe } } -ble_error_t nRF5xGap::updateWhiteAndIdentityListInStack(whiteAndIdentityListPurpose_t purpose) +ble_error_t nRF5xGap::updateWhiteAndIdentityListInStack() { GapWhiteAndIdentityList_t whiteAndIdentityList; - uint32_t err; - bool provide_settings; - - if (purpose == nRF5xGap::purpose_avdvertising) { - provide_settings = (advertisingPolicyMode != Gap::ADV_POLICY_IGNORE_WHITELIST) ? true : false; - } else { //It must be nRF5xGap::purpose_scan_connect. - provide_settings = (scanningPolicyMode != Gap::SCAN_POLICY_IGNORE_WHITELIST) ? true : false; - } - + uint32_t err; - /* Add missing IRKs to nRF5xGap's whitelist from the bond table held by the Peer Manager */ - if (provide_settings) { - err = getStackWhiteIdentityList(whiteAndIdentityList); + err = getStackWhiteIdentityList(whiteAndIdentityList); - if (err != BLE_ERROR_NONE) { - return (ble_error_t)err; - } - } else { - whiteAndIdentityList.addrs_cnt = 0; - whiteAndIdentityList.identities_cnt = 0; + if (err != BLE_ERROR_NONE) { + return (ble_error_t)err; } - - + return applyWhiteIdentityList(whiteAndIdentityList); } #endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h index ff53048974..5c5d8391b3 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h @@ -160,13 +160,6 @@ private: uint32_t identities_cnt; } GapWhiteAndIdentityList_t; - /* purpose of updating the whitelist and identities settings. */ - enum whiteAndIdentityListPurpose_t - { - purpose_scan_connect = 0, - purpose_avdvertising - } whiteAndIdentityListPurpose; - /* Function for preparing setting of the whitelist feature and the identity-resolving feature (privacy).*/ ble_error_t getStackWhiteIdentityList(GapWhiteAndIdentityList_t &whiteAndIdentityList); @@ -175,9 +168,8 @@ private: /* Function for introducing whitelist feature and the identity-resolving feature setting into SoftDevice. * - * Introduced settings are comply which scanning or advertising policies. * This function incorporates getStackWhiteIdentityList and applyWhiteIdentityList together. */ - ble_error_t updateWhiteAndIdentityListInStack(whiteAndIdentityListPurpose_t purpose); + ble_error_t updateWhiteAndIdentityListInStack(void); #endif private: diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp index 48e93cfccc..02ccf90156 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.cpp @@ -236,6 +236,7 @@ nRF5xServiceDiscovery::ServiceUUIDDiscoveryQueue::triggerFirst(void) .start_handle = parentDiscoveryObject->services[serviceIndex].getStartHandle(), .end_handle = parentDiscoveryObject->services[serviceIndex].getEndHandle(), }; + if (sd_ble_gattc_char_value_by_uuid_read(parentDiscoveryObject->connHandle, &uuid, &handleRange) == NRF_SUCCESS) { return; } @@ -281,19 +282,22 @@ nRF5xServiceDiscovery::CharUUIDDiscoveryQueue::triggerFirst(void) } void -nRF5xServiceDiscovery::processDiscoverUUIDResponse(const ble_gattc_evt_char_val_by_uuid_read_rsp_t *response) +nRF5xServiceDiscovery::processDiscoverUUIDResponse(const ble_gattc_evt_t *p_gattc_evt) { + const ble_gattc_evt_char_val_by_uuid_read_rsp_t * response = &p_gattc_evt->params.char_val_by_uuid_read_rsp; + if (state == DISCOVER_SERVICE_UUIDS) { if ((response->count == 1) && (response->value_len == UUID::LENGTH_OF_LONG_UUID)) { UUID::LongUUIDBytes_t uuid; #if (NRF_SD_BLE_API_VERSION >= 3) - ble_gattc_handle_value_t iter; - memset(&iter, 0, sizeof(ble_gattc_handle_value_t)); - (void) sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter((ble_gattc_evt_t*)response, &iter); - memcpy(uuid, iter.p_value, UUID::LENGTH_OF_LONG_UUID); + /* SoftDevice API since 3.0.0 (e.g. sd 140 5.0.0-1.alpha) provide sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter() helper function, + * but it's not reliable for c++ build. + * Instead of it memcpy gets proper response's value field by offset from handle-value pair: [2 B handle|16 B value=uuid_128b] */ + + memcpy(uuid, (&response->handle_value + 2), UUID::LENGTH_OF_LONG_UUID); #else - memcpy(uuid, response->handle_value[0].p_value, UUID::LENGTH_OF_LONG_UUID); + memcpy(uuid, &(response->handle_value[0].p_value[0]), UUID::LENGTH_OF_LONG_UUID); #endif unsigned serviceIndex = serviceUUIDDiscoveryQueue.dequeue(); @@ -307,11 +311,11 @@ nRF5xServiceDiscovery::processDiscoverUUIDResponse(const ble_gattc_evt_char_val_ if ((response->count == 1) && (response->value_len == UUID::LENGTH_OF_LONG_UUID + 1 /* props */ + 2 /* value handle */)) { UUID::LongUUIDBytes_t uuid; -#if (NRF_SD_BLE_API_VERSION >= 3) - ble_gattc_handle_value_t iter; - memset(&iter, 0, sizeof(ble_gattc_handle_value_t)); - (void) sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter((ble_gattc_evt_t*)response, &iter); - memcpy(uuid, &(iter.p_value[3]), UUID::LENGTH_OF_LONG_UUID); +#if (NRF_SD_BLE_API_VERSION >= 3) + /* SoftDevice API since 3.0.0 (e.g. sd 140 5.0.0-1.alpha) provide sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter() helper function, + * but it's not reliable for c++ build. + * Instead of it memcpy gets proper response's value by offset: [2 B type| 1B prop |2 B value handle| 16 B value=uuid_128b] */ + memcpy(uuid, (&response->handle_value + 5), UUID::LENGTH_OF_LONG_UUID); #else memcpy(uuid, &(response->handle_value[0].p_value[3]), UUID::LENGTH_OF_LONG_UUID); #endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h index 7bd6e88936..2fad5c0800 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h @@ -139,7 +139,7 @@ private: void setupDiscoveredCharacteristics(const ble_gattc_evt_char_disc_rsp_t *response); void triggerServiceUUIDDiscovery(void); - void processDiscoverUUIDResponse(const ble_gattc_evt_char_val_by_uuid_read_rsp_t *response); + void processDiscoverUUIDResponse(const ble_gattc_evt_t *p_gattc_evt); void removeFirstServiceNeedingUUIDDiscovery(void); void terminateServiceDiscovery(void) { From 807cd23ed106fd01b32f5b07e73bfdb9ac345c88 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 23 Feb 2017 13:47:20 +0100 Subject: [PATCH 25/31] [nRF52840] Removed nRF52840 from memory constrained device list. --- rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h b/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h index 40aa2fff76..b96ef812c3 100644 --- a/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h +++ b/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h @@ -354,8 +354,7 @@ __attribute__((used)) void _mutex_release (OS_ID *mutex) { /* Main Thread definition */ extern void pre_main (void); -#if defined(TARGET_MCU_NRF52840) ||\ - defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832) || defined (TARGET_STM32F334R8) ||\ +#if defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832) || defined (TARGET_STM32F334R8) ||\ defined(TARGET_STM32F070RB) || defined(TARGET_STM32F072RB) || \ defined(TARGET_STM32F302R8) || defined(TARGET_STM32F303K8) || defined (TARGET_STM32F334C8) ||\ defined(TARGET_STM32F103RB) From e798edc604abe34f10e48ae1f8afe8afc4070354 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 27 Feb 2017 13:42:09 +0100 Subject: [PATCH 26/31] [NRF52840]: fix mbed-os-rtos-rtx-target_cortex_m-tests-memory-heap_and_stack@IAR by increasing heap size for IAR. Corected initial MSP for ARMCC. --- .../device/TOOLCHAIN_ARM_STD/startup_nrf52832.s | 2 +- .../TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s index 8472a05e46..253746ce87 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s @@ -25,7 +25,7 @@ ; POSSIBILITY OF SUCH DAMAGE. ; ---------------------------------------------------------------------------*/ -__initial_sp EQU 0x20010000 +__initial_sp EQU 0x20040000 PRESERVE8 THUMB diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf index 5a278aa31a..6c0e4f7eba 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf @@ -13,7 +13,7 @@ export symbol __ICFEDIT_region_RAM_end__; /*-Sizes-*/ /*Heap 1/4 of ram and stack 1/8*/ define symbol __ICFEDIT_size_cstack__ = 0x800; -define symbol __ICFEDIT_size_heap__ = 0x1800; +define symbol __ICFEDIT_size_heap__ = 0x3000; /**** End of ICF editor section. ###ICF###*/ define symbol __code_start_soft_device__ = 0x0; From b1b802f96c38ba1c1ecdace5a3a08eb8364a93d2 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 1 Mar 2017 08:34:07 +0100 Subject: [PATCH 27/31] i2c_api implementation has been changed in order to support single byte reads and writes (the latter are used in I2CEeprom module used in CI tests, and this caused that tests-i2c-api were failing). These operations (single byte transfers) are not possible to achieve with the driver from nrf5 SDK (nrf_drv_twi), so the new implementation uses TWI HAL only. --- .../TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c | 654 ++++++++++++++---- 1 file changed, 508 insertions(+), 146 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c index 1ac470a227..147891ce54 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Nordic Semiconductor ASA + * Copyright (c) 2017 Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -43,8 +43,17 @@ #include "mbed_assert.h" #include "mbed_error.h" -#include "nrf_drv_twi.h" +#include "nrf_twi.h" +#include "nrf_drv_common.h" +#include "sdk_config.h" #include "app_util_platform.h" +#include "nrf_gpio.h" +#include "nrf_delay.h" + +// An arbitrary value used as the counter in loops waiting for given event +// (e.g. STOPPED), needed to avoid infinite loops (and not involve any timers +// or tickers). +#define TIMEOUT_VALUE 1000 #if DEVICE_I2C_ASYNCH #define TWI_IDX(obj) ((obj)->i2c.twi_idx) @@ -53,60 +62,40 @@ #endif #define TWI_INFO(obj) (&m_twi_info[TWI_IDX(obj)]) -typedef struct { - bool initialized; - nrf_drv_twi_config_t config; - volatile bool transfer_finished; +#define TWI0_INSTANCE_INDEX 0 +#define TWI1_INSTANCE_INDEX TWI0_INSTANCE_INDEX+TWI0_ENABLED - #if DEVICE_I2C_ASYNCH - volatile uint32_t events; - void (*handler)(void); - uint32_t event_mask; - #endif +typedef struct { + bool initialized; + uint32_t pselsda; + uint32_t pselscl; + nrf_twi_frequency_t frequency; + bool start_twi; + +#if DEVICE_I2C_ASYNCH + volatile bool active; + uint8_t const *tx; + size_t tx_length; + uint8_t *rx; + size_t rx_length; + bool stop; + + volatile uint32_t events; + void (*handler)(void); + uint32_t evt_mask; +#endif // DEVICE_I2C_ASYNCH } twi_info_t; static twi_info_t m_twi_info[TWI_COUNT]; -static nrf_drv_twi_t const m_twi_instances[TWI_COUNT] = { +static NRF_TWI_Type * const m_twi_instances[TWI_COUNT] = { #if TWI0_ENABLED - NRF_DRV_TWI_INSTANCE(0), + NRF_TWI0, #endif #if TWI1_ENABLED - NRF_DRV_TWI_INSTANCE(1), + NRF_TWI1, #endif }; -static void twi_event_handler(nrf_drv_twi_evt_t const *event, void *context) -{ - twi_info_t * twi_info = TWI_INFO((i2c_t *)context); - twi_info->transfer_finished = true; - -#if DEVICE_I2C_ASYNCH - switch (event->type) { - case NRF_DRV_TWI_EVT_DONE: - twi_info->events |= I2C_EVENT_TRANSFER_COMPLETE; - break; - - case NRF_DRV_TWI_EVT_ADDRESS_NACK: - twi_info->events |= I2C_EVENT_ERROR_NO_SLAVE; - break; - - case NRF_DRV_TWI_EVT_DATA_NACK: - twi_info->events |= I2C_EVENT_ERROR; - break; - } - - if (twi_info->handler) { - twi_info->handler(); - } -#endif // DEVICE_I2C_ASYNCH -} - -static uint8_t twi_address(int i2c_address) -{ - // The TWI driver requires 7-bit slave address (without R/W bit). - return (i2c_address >> 1); -} - void SPI0_TWI0_IRQHandler(void); void SPI1_TWI1_IRQHandler(void); @@ -123,207 +112,580 @@ static const peripheral_handler_desc_t twi_handlers[TWI_COUNT] = SPI1_TWI1_IRQn, (uint32_t) SPI1_TWI1_IRQHandler } - #endif + #endif }; +#ifdef NRF51 + #define TWI_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW +#elif defined(NRF52) || defined(NRF52840_XXAA) + #define TWI_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST +#endif + + +#if DEVICE_I2C_ASYNCH +static void start_asynch_rx(twi_info_t *twi_info, NRF_TWI_Type *twi) +{ + if (twi_info->rx_length == 1 && twi_info->stop) { + nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_STOP_MASK); + } else { + nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_SUSPEND_MASK); + } + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STARTRX); +} + +static void twi_irq_handler(uint8_t instance_idx) +{ + twi_info_t *twi_info = &m_twi_info[instance_idx]; + + NRF_TWI_Type *twi = m_twi_instances[instance_idx]; + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) { + nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); + + // In case of an error, force STOP. + // The current transfer may be suspended (if it is RX), so it must be + // resumed before the STOP task is triggered. + nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); + + uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(twi); + twi_info->events |= I2C_EVENT_ERROR; + if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) { + twi_info->events |= I2C_EVENT_ERROR_NO_SLAVE; + } + if (errorsrc & NRF_TWI_ERROR_DATA_NACK) { + twi_info->events |= I2C_EVENT_TRANSFER_EARLY_NACK; + } + } + + bool finished = false; + + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_TXDSENT)) { + nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); + + MBED_ASSERT(twi_info->tx_length > 0); + --(twi_info->tx_length); + // Send next byte if there is still something to be sent. + if (twi_info->tx_length > 0) { + nrf_twi_txd_set(twi, *(twi_info->tx)); + ++(twi_info->tx); + // It TX is done, start RX if requested. + } else if (twi_info->rx_length > 0) { + start_asynch_rx(twi_info, twi); + // If there is nothing more to do, finalize the transfer. + } else { + if (twi_info->stop) { + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); + } else { + nrf_twi_task_trigger(twi, NRF_TWI_TASK_SUSPEND); + finished = true; + } + twi_info->events |= I2C_EVENT_TRANSFER_COMPLETE; + } + } + + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_RXDREADY)) { + nrf_twi_event_clear(twi, NRF_TWI_EVENT_RXDREADY); + + MBED_ASSERT(twi_info->rx_length > 0); + *(twi_info->rx) = nrf_twi_rxd_get(twi); + ++(twi_info->rx); + --(twi_info->rx_length); + + if (twi_info->rx_length > 0) { + // If more bytes should be received, resume the transfer + // (in case the stop condition should be generated after the next + // byte, change the shortcuts configuration first). + if (twi_info->rx_length == 1 && twi_info->stop) { + nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_STOP_MASK); + } + nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); + } else { + // If all requested bytes were received, finalize the transfer. + finished = true; + twi_info->events |= I2C_EVENT_TRANSFER_COMPLETE; + } + } + + if (finished || + nrf_twi_event_check(twi, NRF_TWI_EVENT_STOPPED) || + (nrf_twi_int_enable_check(twi, NRF_TWI_INT_SUSPENDED_MASK) && + nrf_twi_event_check(twi, NRF_TWI_EVENT_SUSPENDED))) { + // There is no need to clear the STOPPED and SUSPENDED events here, + // they will no longer generate the interrupt - see below. + + nrf_twi_shorts_set(twi, 0); + // Disable all interrupt sources. + nrf_twi_int_disable(twi, UINT32_MAX); + twi_info->active = false; + + if (twi_info->handler) { + twi_info->handler(); + } + } +} + +#if TWI0_ENABLED +static void irq_handler_twi0(void) +{ + twi_irq_handler(TWI0_INSTANCE_INDEX); +} +#endif +#if TWI1_ENABLED +static void irq_handler_twi1(void) +{ + twi_irq_handler(TWI1_INSTANCE_INDEX); +} +#endif +static nrf_drv_irq_handler_t const m_twi_irq_handlers[TWI_COUNT] = +{ +#if TWI0_ENABLED + irq_handler_twi0, +#endif +#if TWI1_ENABLED + irq_handler_twi1, +#endif +}; +#endif // DEVICE_I2C_ASYNCH + + +static void configure_twi_pin(uint32_t pin, nrf_gpio_pin_dir_t dir) +{ + nrf_gpio_cfg(pin, + dir, + NRF_GPIO_PIN_INPUT_CONNECT, + NRF_GPIO_PIN_PULLUP, + NRF_GPIO_PIN_S0D1, + NRF_GPIO_PIN_NOSENSE); +} + +static void twi_clear_bus(twi_info_t *twi_info) +{ + // Try to set SDA high, and check if no slave tries to drive it low. + nrf_gpio_pin_set(twi_info->pselsda); + configure_twi_pin(twi_info->pselsda, NRF_GPIO_PIN_DIR_OUTPUT); + // In case SDA is low, make up to 9 cycles on SCL line to help the slave + // that pulls SDA low release it. + if (!nrf_gpio_pin_read(twi_info->pselsda)) { + nrf_gpio_pin_set(twi_info->pselscl); + configure_twi_pin(twi_info->pselscl, NRF_GPIO_PIN_DIR_OUTPUT); + nrf_delay_us(4); + + for (int i = 0; i < 9; i++) { + if (nrf_gpio_pin_read(twi_info->pselsda)) { + break; + } + nrf_gpio_pin_clear(twi_info->pselscl); + nrf_delay_us(4); + nrf_gpio_pin_set(twi_info->pselscl); + nrf_delay_us(4); + } + + // Finally, generate STOP condition to put the bus into initial state. + nrf_gpio_pin_clear(twi_info->pselsda); + nrf_delay_us(4); + nrf_gpio_pin_set(twi_info->pselsda); + } +} void i2c_init(i2c_t *obj, PinName sda, PinName scl) { int i; for (i = 0; i < TWI_COUNT; ++i) { if (m_twi_info[i].initialized && - m_twi_info[i].config.sda == (uint32_t)sda && - m_twi_info[i].config.scl == (uint32_t)scl) { + m_twi_info[i].pselsda == (uint32_t)sda && + m_twi_info[i].pselscl == (uint32_t)scl) { TWI_IDX(obj) = i; - TWI_INFO(obj)->config.frequency = NRF_TWI_FREQ_100K; + TWI_INFO(obj)->frequency = NRF_TWI_FREQ_100K; i2c_reset(obj); return; } } - nrf_drv_twi_config_t const config = { - .scl = scl, - .sda = sda, - .frequency = NRF_TWI_FREQ_100K, -#ifdef NRF51 - .interrupt_priority = APP_IRQ_PRIORITY_LOW -#elif defined(NRF52) || defined(NRF52840_XXAA) - .interrupt_priority = APP_IRQ_PRIORITY_LOWEST -#endif - - }; - for (i = 0; i < TWI_COUNT; ++i) { if (!m_twi_info[i].initialized) { + TWI_IDX(obj) = i; + twi_info_t *twi_info = TWI_INFO(obj); + twi_info->initialized = true; + twi_info->pselsda = (uint32_t)sda; + twi_info->pselscl = (uint32_t)scl; + twi_info->frequency = NRF_TWI_FREQ_100K; + twi_info->start_twi = false; +#if DEVICE_I2C_ASYNCH + twi_info->active = false; +#endif + + twi_clear_bus(twi_info); + + configure_twi_pin(twi_info->pselsda, NRF_GPIO_PIN_DIR_INPUT); + configure_twi_pin(twi_info->pselscl, NRF_GPIO_PIN_DIR_INPUT); + + i2c_reset(obj); + +#if DEVICE_I2C_ASYNCH + nrf_drv_common_per_res_acquire(m_twi_instances[i], + m_twi_irq_handlers[i]); NVIC_SetVector(twi_handlers[i].IRQn, twi_handlers[i].vector); + nrf_drv_common_irq_enable(twi_handlers[i].IRQn, TWI_IRQ_PRIORITY); +#endif - nrf_drv_twi_t const *twi = &m_twi_instances[i]; - ret_code_t ret_code = - nrf_drv_twi_init(twi, &config, twi_event_handler, obj); - if (ret_code == NRF_SUCCESS) { - TWI_IDX(obj) = i; - TWI_INFO(obj)->initialized = true; - TWI_INFO(obj)->config = config; - - nrf_drv_twi_enable(twi); - return; - } + return; } } - // No available peripheral error("No available I2C peripheral\r\n"); } void i2c_reset(i2c_t *obj) { twi_info_t *twi_info = TWI_INFO(obj); - nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; - nrf_drv_twi_uninit(twi); - nrf_drv_twi_init(twi, &twi_info->config, twi_event_handler, obj); - nrf_drv_twi_enable(twi); + nrf_twi_disable(twi); + nrf_twi_pins_set(twi, twi_info->pselscl, twi_info->pselsda); + nrf_twi_frequency_set(twi, twi_info->frequency); + nrf_twi_enable(twi); } int i2c_start(i2c_t *obj) { - (void)obj; + twi_info_t *twi_info = TWI_INFO(obj); +#if DEVICE_I2C_ASYNCH + if (twi_info->active) { + return I2C_ERROR_BUS_BUSY; + } +#endif + twi_info->start_twi = true; - return -1; // Not implemented. + return 0; } int i2c_stop(i2c_t *obj) { - (void)obj; + NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; - return -1; // Not implemented. + // The current transfer may be suspended (if it is RX), so it must be + // resumed before the STOP task is triggered. + nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); + uint32_t remaining_time = TIMEOUT_VALUE; + do { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_STOPPED)) { + return 0; + } + } while (--remaining_time); + + return 1; } void i2c_frequency(i2c_t *obj, int hz) { twi_info_t *twi_info = TWI_INFO(obj); - nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; if (hz < 250000) { - twi_info->config.frequency = NRF_TWI_FREQ_100K; + twi_info->frequency = NRF_TWI_FREQ_100K; } else if (hz < 400000) { - twi_info->config.frequency = NRF_TWI_FREQ_250K; + twi_info->frequency = NRF_TWI_FREQ_250K; } else { - twi_info->config.frequency = NRF_TWI_FREQ_400K; + twi_info->frequency = NRF_TWI_FREQ_400K; } - nrf_twi_frequency_set(twi->reg.p_twi, twi_info->config.frequency); + nrf_twi_frequency_set(twi, twi_info->frequency); +} + +static uint8_t twi_address(int i2c_address) +{ + // The TWI peripheral requires 7-bit slave address (without R/W bit). + return (i2c_address >> 1); +} + +static void start_twi_read(NRF_TWI_Type *twi, int address) +{ + nrf_twi_event_clear(twi, NRF_TWI_EVENT_STOPPED); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_RXDREADY); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); + (void)nrf_twi_errorsrc_get_and_clear(twi); + + nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_SUSPEND_MASK); + + nrf_twi_address_set(twi, twi_address(address)); + nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STARTRX); } int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) { - (void)stop; + // Zero-length RX transfers are not supported. Such transfers cannot + // be easily achieved with TWI peripheral (some dirty tricks would be + // required for this), and they are actually useless (TX can be used + // to check if the address is acknowledged by a slave). + MBED_ASSERT(length > 0); twi_info_t *twi_info = TWI_INFO(obj); - nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; - - twi_info->transfer_finished = false; - ret_code_t ret_code = nrf_drv_twi_rx(twi, twi_address(address), - (uint8_t *)data, length); - if (ret_code != NRF_SUCCESS) { - return 0; +#if DEVICE_I2C_ASYNCH + if (twi_info->active) { + return I2C_ERROR_BUS_BUSY; } - while (!twi_info->transfer_finished) {} - return nrf_drv_twi_data_count_get(twi); +#endif + twi_info->start_twi = false; + + NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; + start_twi_read(twi, address); + + int result = length; + while (length > 0) { + int byte_read_result = i2c_byte_read(obj, (stop && length == 1)); + if (byte_read_result < 0) { + // When an error occurs, return the number of bytes that have been + // received successfully. + result -= length; + // Force STOP condition. + stop = 1; + break; + } + *data++ = (uint8_t)byte_read_result; + --length; + } + + if (stop) { + (void)i2c_stop(obj); + } + + return result; +} + +static uint8_t twi_byte_write(NRF_TWI_Type *twi, uint8_t data) +{ + nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); + + nrf_twi_txd_set(twi, data); + uint32_t remaining_time = TIMEOUT_VALUE; + do { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_TXDSENT)) { + nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); + return 1; // ACK received + } + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) { + nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); + return 0; // some error occurred + } + } while (--remaining_time); + + return 2; // timeout; +} + +static void start_twi_write(NRF_TWI_Type *twi, int address) +{ + nrf_twi_event_clear(twi, NRF_TWI_EVENT_STOPPED); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); + (void)nrf_twi_errorsrc_get_and_clear(twi); + + nrf_twi_shorts_set(twi, 0); + + nrf_twi_address_set(twi, twi_address(address)); + nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STARTTX); } int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) { twi_info_t *twi_info = TWI_INFO(obj); - nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; - - twi_info->transfer_finished = false; - ret_code_t ret_code = nrf_drv_twi_tx(twi, twi_address(address), - (uint8_t const *)data, length, (stop == 0)); - if (ret_code != NRF_SUCCESS) { - return 0; +#if DEVICE_I2C_ASYNCH + if (twi_info->active) { + return I2C_ERROR_BUS_BUSY; } - while (!twi_info->transfer_finished) {} - return nrf_drv_twi_data_count_get(twi); +#endif + twi_info->start_twi = false; + + NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; + start_twi_write(twi, address); + + // Special case - transaction with no data. + // It can be used to check if a slave acknowledges the address. + if (length == 0) { + nrf_twi_event_t event; + if (stop) { + event = NRF_TWI_EVENT_STOPPED; + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); + } else { + event = NRF_TWI_EVENT_SUSPENDED; + nrf_twi_event_clear(twi, event); + nrf_twi_task_trigger(twi, NRF_TWI_TASK_SUSPEND); + } + uint32_t remaining_time = TIMEOUT_VALUE; + do { + if (nrf_twi_event_check(twi, event)) { + break; + } + } while (--remaining_time); + + uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(twi); + if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) { + if (!stop) { + i2c_stop(obj); + } + return I2C_ERROR_NO_SLAVE; + } + + return (remaining_time ? 0 : I2C_ERROR_BUS_BUSY); + } + + int result = length; + do { + uint8_t byte_write_result = twi_byte_write(twi, (uint8_t)*data++); + if (byte_write_result != 1) { + if (byte_write_result == 0) { + // Check what kind of error has been signaled by TWI. + uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(twi); + if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) { + result = I2C_ERROR_NO_SLAVE; + } else { + // Some other error - return the number of bytes that + // have been sent successfully. + result -= length; + } + } else { + result = I2C_ERROR_BUS_BUSY; + } + // Force STOP condition. + stop = 1; + break; + } + --length; + } while (length > 0); + + if (stop) { + (void)i2c_stop(obj); + } + + return result; } int i2c_byte_read(i2c_t *obj, int last) { - (void)obj; - (void)last; + NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; - return -1; // Not implemented. + if (last) { + nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_STOP_MASK); + } + nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); + + uint32_t remaining_time = TIMEOUT_VALUE; + do { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_RXDREADY)) { + nrf_twi_event_clear(twi, NRF_TWI_EVENT_RXDREADY); + return nrf_twi_rxd_get(twi); + } + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) { + nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); + return I2C_ERROR_NO_SLAVE; + } + } while (--remaining_time); + + return I2C_ERROR_BUS_BUSY; } int i2c_byte_write(i2c_t *obj, int data) { - (void)obj; - (void)data; + NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; + twi_info_t *twi_info = TWI_INFO(obj); + if (twi_info->start_twi) { + twi_info->start_twi = false; - return -1; // Not implemented. + if (data & 1) { + start_twi_read(twi, data); + } else { + start_twi_write(twi, data); + } + return 1; + } else { + nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); + // 0 - TWI signaled error (NAK is the only possibility here) + // 1 - ACK received + // 2 - timeout (clock stretched for too long?) + return twi_byte_write(twi, (uint8_t)data); + } } #if DEVICE_I2C_ASYNCH - void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint32_t address, uint32_t stop, uint32_t handler, uint32_t event, DMAUsage hint) { - (void)stop; (void)hint; - if (i2c_active(obj)) { - return; - } - if ((tx_length == 0) && (rx_length == 0)) { - return; - } - twi_info_t *twi_info = TWI_INFO(obj); - twi_info->events = 0; - twi_info->handler = (void (*)(void))handler; - twi_info->event_mask = event; + if (twi_info->active) { + return; + } + twi_info->active = true; + twi_info->events = 0; + twi_info->handler = (void (*)(void))handler; + twi_info->evt_mask = event; + twi_info->tx_length = tx_length; + twi_info->tx = tx; + twi_info->rx_length = rx_length; + twi_info->rx = rx; + twi_info->stop = stop; - uint8_t twi_addr = twi_address(address); - nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; + NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; - if ((tx_length > 0) && (rx_length == 0)) { - nrf_drv_twi_xfer_desc_t const xfer = - NRF_DRV_TWI_XFER_DESC_TX(twi_addr, (uint8_t *)tx, tx_length); - nrf_drv_twi_xfer(twi, &xfer, - stop ? 0 : NRF_DRV_TWI_FLAG_TX_NO_STOP); - } - else if ((tx_length == 0) && (rx_length > 0)) { - nrf_drv_twi_xfer_desc_t const xfer = - NRF_DRV_TWI_XFER_DESC_RX(twi_addr, rx, rx_length); - nrf_drv_twi_xfer(twi, &xfer, 0); - } - else if ((tx_length > 0) && (rx_length > 0)) { - nrf_drv_twi_xfer_desc_t const xfer = - NRF_DRV_TWI_XFER_DESC_TXRX(twi_addr, - (uint8_t *)tx, tx_length, rx, rx_length); - nrf_drv_twi_xfer(twi, &xfer, 0); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_RXDREADY); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_STOPPED); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_SUSPENDED); + nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); + (void)nrf_twi_errorsrc_get_and_clear(twi); + + nrf_twi_address_set(twi, twi_address(address)); + nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); + // TX only, or TX + RX (after a repeated start). + if (tx_length > 0) { + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STARTTX); + nrf_twi_txd_set(twi, *(twi_info->tx)); + ++(twi_info->tx); + // RX only. + } else if (rx_length > 0) { + start_asynch_rx(twi_info, twi); + // Both 'tx_length' and 'rx_length' are 0 - this case may be used + // to test if the slave is presentand ready for transfer (by just + // sending the address and checking if it is acknowledged). + } else { + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STARTTX); + if (stop) { + nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); + } else { + nrf_twi_task_trigger(twi, NRF_TWI_TASK_SUSPEND); + nrf_twi_int_enable(twi, NRF_TWI_INT_SUSPENDED_MASK); + } + twi_info->events |= I2C_EVENT_TRANSFER_COMPLETE; } + + nrf_twi_int_enable(twi, NRF_TWI_INT_TXDSENT_MASK | + NRF_TWI_INT_RXDREADY_MASK | + NRF_TWI_INT_STOPPED_MASK | + NRF_TWI_INT_ERROR_MASK); } uint32_t i2c_irq_handler_asynch(i2c_t *obj) { twi_info_t *twi_info = TWI_INFO(obj); - return (twi_info->events & twi_info->event_mask); + return (twi_info->events & twi_info->evt_mask); } uint8_t i2c_active(i2c_t *obj) { - nrf_drv_twi_t const *twi = &m_twi_instances[TWI_IDX(obj)]; - return nrf_drv_twi_is_busy(twi); + twi_info_t *twi_info = TWI_INFO(obj); + return twi_info->active; } void i2c_abort_asynch(i2c_t *obj) { i2c_reset(obj); } - #endif // DEVICE_I2C_ASYNCH #endif // DEVICE_I2C From f6da6c02836b7c0dd355c5be7ddb040f86bab0d8 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 2 Mar 2017 16:48:17 +0100 Subject: [PATCH 28/31] =?UTF-8?q?[NRF52840]=20code=20formating,=20CR=20cha?= =?UTF-8?q?nges=20corrected=20spi=5Finit()=20to=20properly=20handle=20re-i?= =?UTF-8?q?nitialization=E2=80=A6=20#3842?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TARGET_MCU_NRF52840/PeripheralNames.h | 15 +- .../TARGET_MCU_NRF52840/PortNames.h | 3 +- .../TARGET_NRF5_SDK13/gpio_api.c | 89 +++--- .../TARGET_NRF5_SDK13/gpio_object.h | 16 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c | 255 ++++++++++++------ .../TARGET_NRF5_SDK13/nordic_critical.c | 6 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h | 21 +- .../TARGET_NRF5_SDK13/port_api.c | 71 +++-- .../TARGET_NRF5_SDK13/reloc_vector_table.c | 14 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c | 4 +- .../TARGET_NRF5_SDK13/serial_api.c | 244 ++++++++++------- .../TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c | 21 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c | 159 +++++++---- .../TARGET_NRF5_SDK13/us_ticker.c | 163 +++++++---- 14 files changed, 710 insertions(+), 371 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PeripheralNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PeripheralNames.h index 0fe6da592e..87d1983478 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PeripheralNames.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PeripheralNames.h @@ -49,28 +49,33 @@ extern "C" { #define STDIO_UART_RX RX_PIN_NUMBER #define STDIO_UART UART_0 -typedef enum { +typedef enum +{ UART_0 = (int)NRF_UART0_BASE } UARTName; -typedef enum { +typedef enum +{ SPI_0 = (int)NRF_SPI0_BASE, SPI_1 = (int)NRF_SPI1_BASE, SPIS = (int)NRF_SPIS1_BASE } SPIName; -typedef enum { +typedef enum +{ PWM_1 = 0, PWM_2 } PWMName; -typedef enum { +typedef enum +{ I2C_0 = (int)NRF_TWI0_BASE, I2C_1 = (int)NRF_TWI1_BASE } I2CName; -typedef enum { +typedef enum +{ ADC0_0 = (int)0 } ADCName; diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h index 2e8d6769c4..b0162fb1ee 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/PortNames.h @@ -43,7 +43,8 @@ extern "C" { #endif -typedef enum { +typedef enum +{ Port0 = 0, //GPIO pins 0-31 -> 0.0-0.31 Port1 = 1 //GPIO pins 32-47 -> 1.0-1.15 } PortName; diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c index c7ae53a759..4931b5330e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_api.c @@ -29,7 +29,8 @@ #error not recognized gpio count for mcu #endif -typedef struct { +typedef struct +{ bool used_as_gpio : 1; PinDirection direction : 1; bool init_high : 1; @@ -45,8 +46,8 @@ typedef struct { typedef uint32_t gpio_mask_t; #endif -gpio_mask_t m_gpio_initialized; -gpio_cfg_t m_gpio_cfg[GPIO_PIN_COUNT]; +static gpio_mask_t m_gpio_initialized; +static gpio_cfg_t m_gpio_cfg[GPIO_PIN_COUNT]; /*********** @@ -54,20 +55,22 @@ 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}; -gpio_mask_t m_gpio_irq_enabled; +static uint32_t m_channel_ids[GPIO_PIN_COUNT] = {0}; +static gpio_mask_t m_gpio_irq_enabled; static void gpiote_irq_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(pin); gpio_irq_event event = (sense == NRF_GPIO_PIN_SENSE_LOW) ? IRQ_RISE : IRQ_FALL; - - if (m_gpio_irq_enabled & ((gpio_mask_t)1 << pin)) { + + if (m_gpio_irq_enabled & ((gpio_mask_t)1 << pin)) + { if (((event == IRQ_RISE) && m_gpio_cfg[pin].irq_rise) - || ((event == IRQ_FALL) && m_gpio_cfg[pin].irq_fall)) { - m_irq_handler(m_channel_ids[pin], event); - } + || ((event == IRQ_FALL) && m_gpio_cfg[pin].irq_fall)) + { + m_irq_handler(m_channel_ids[pin], event); + } } } @@ -76,7 +79,8 @@ void GPIOTE_IRQHandler(void);// exported from nrf_drv_gpiote.c void gpio_init(gpio_t *obj, PinName pin) { obj->pin = pin; - if (pin == (PinName)NC) { + if (pin == (PinName)NC) + { return; } MBED_ASSERT((uint32_t)pin < GPIO_PIN_COUNT); @@ -92,20 +96,26 @@ void gpio_init(gpio_t *obj, PinName pin) int gpio_read(gpio_t *obj) { MBED_ASSERT(obj->pin != (PinName)NC); - if (m_gpio_cfg[obj->pin].direction == PIN_OUTPUT) { + if (m_gpio_cfg[obj->pin].direction == PIN_OUTPUT) + { return (nrf_gpio_pin_out_read(obj->pin) ? 1 : 0); - } else { + } + else + { return nrf_gpio_pin_read(obj->pin); } } static void gpiote_pin_uninit(uint8_t pin) { - if (m_gpio_initialized & ((gpio_mask_t)1 << pin)) { - if ((m_gpio_cfg[pin].direction == PIN_OUTPUT) && (!m_gpio_cfg[pin].used_as_irq)) { + if (m_gpio_initialized & ((gpio_mask_t)1 << pin)) + { + if ((m_gpio_cfg[pin].direction == PIN_OUTPUT) && (!m_gpio_cfg[pin].used_as_irq)) + { nrf_drv_gpiote_out_uninit(pin); } - else { + else + { nrf_drv_gpiote_in_uninit(pin); } } @@ -113,16 +123,19 @@ static void gpiote_pin_uninit(uint8_t pin) static void gpio_apply_config(uint8_t pin) { - if (m_gpio_cfg[pin].used_as_gpio || m_gpio_cfg[pin].used_as_irq) { + if (m_gpio_cfg[pin].used_as_gpio || m_gpio_cfg[pin].used_as_irq) + { if ((m_gpio_cfg[pin].direction == PIN_INPUT) - || (m_gpio_cfg[pin].used_as_irq)) { + || (m_gpio_cfg[pin].used_as_irq)) + { //Configure as input. nrf_drv_gpiote_in_config_t cfg; cfg.hi_accuracy = false; cfg.is_watcher = false; cfg.sense = NRF_GPIOTE_POLARITY_TOGGLE; - if (m_gpio_cfg[pin].used_as_irq) { + if (m_gpio_cfg[pin].used_as_irq) + { cfg.pull = NRF_GPIO_PIN_PULLUP; nrf_drv_gpiote_in_init(pin, &cfg, gpiote_irq_handler); if ((m_gpio_irq_enabled & ((gpio_mask_t)1 << pin)) @@ -131,8 +144,10 @@ static void gpio_apply_config(uint8_t pin) nrf_drv_gpiote_in_event_enable(pin, true); } } - else { - switch(m_gpio_cfg[pin].pull) { + else + { + switch (m_gpio_cfg[pin].pull) + { case PullUp: cfg.pull = NRF_GPIO_PIN_PULLUP; break; @@ -146,14 +161,16 @@ static void gpio_apply_config(uint8_t pin) nrf_drv_gpiote_in_init(pin, &cfg, NULL); } } - else { + else + { // Configure as output. nrf_drv_gpiote_out_config_t cfg = GPIOTE_CONFIG_OUT_SIMPLE(m_gpio_cfg[pin].init_high); nrf_drv_gpiote_out_init(pin, &cfg); } m_gpio_initialized |= ((gpio_mask_t)1 << pin); } - else { + else + { m_gpio_initialized &= ~((gpio_mask_t)1 << pin); } } @@ -161,7 +178,7 @@ static void gpio_apply_config(uint8_t pin) void gpio_mode(gpio_t *obj, PinMode mode) { - MBED_ASSERT(obj->pin <= GPIO_PIN_COUNT); + MBED_ASSERT(obj->pin != (PinName)NC); gpiote_pin_uninit(obj->pin); // try to uninitialize gpio before a change. @@ -172,7 +189,7 @@ void gpio_mode(gpio_t *obj, PinMode mode) void gpio_dir(gpio_t *obj, PinDirection direction) { - MBED_ASSERT(obj->pin <= GPIO_PIN_COUNT); + MBED_ASSERT(obj->pin != (PinName)NC); gpiote_pin_uninit(obj->pin); // try to uninitialize gpio before a change. @@ -187,7 +204,8 @@ void gpio_dir(gpio_t *obj, PinDirection direction) int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) { - if (pin == NC) { + if (pin == NC) + { return -1; } MBED_ASSERT((uint32_t)pin < GPIO_PIN_COUNT); @@ -223,19 +241,25 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) (m_gpio_irq_enabled & ((gpio_mask_t)1 << obj->ch)) && (cfg->irq_rise || cfg->irq_fall); - if (event == IRQ_RISE) { + if (event == IRQ_RISE) + { cfg->irq_rise = enable ? true : false; } - else if (event == IRQ_FALL) { + else if (event == IRQ_FALL) + { cfg->irq_fall = enable ? true : false; } bool irq_enabled_after = cfg->irq_rise || cfg->irq_fall; - if (irq_enabled_before != irq_enabled_after) { - if (irq_enabled_after) { + if (irq_enabled_before != irq_enabled_after) + { + if (irq_enabled_after) + { gpio_irq_enable(obj); - } else { + } + else + { gpio_irq_disable(obj); } } @@ -245,7 +269,8 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) void gpio_irq_enable(gpio_irq_t *obj) { m_gpio_irq_enabled |= ((gpio_mask_t)1 << obj->ch); - if (m_gpio_cfg[obj->ch].irq_rise || m_gpio_cfg[obj->ch].irq_fall) { + if (m_gpio_cfg[obj->ch].irq_rise || m_gpio_cfg[obj->ch].irq_fall) + { nrf_drv_gpiote_in_event_enable(obj->ch, true); } } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_object.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_object.h index f7b621a9ed..9a6db55284 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_object.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/gpio_object.h @@ -24,20 +24,26 @@ extern "C" { #endif -typedef struct { +typedef struct +{ PinName pin; } gpio_t; -static inline void gpio_write(gpio_t *obj, int value) { +static inline void gpio_write(gpio_t *obj, int value) +{ MBED_ASSERT(obj->pin != (PinName)NC); - if (value) { + if (value) + { nrf_gpio_pin_set(obj->pin); - } else { + } + else + { nrf_gpio_pin_clear(obj->pin); } } -static inline int gpio_is_connected(const gpio_t *obj) { +static inline int gpio_is_connected(const gpio_t *obj) +{ return obj->pin != (PinName)NC; } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c index 147891ce54..69a94770ba 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/i2c_api.c @@ -101,18 +101,18 @@ void SPI1_TWI1_IRQHandler(void); static const peripheral_handler_desc_t twi_handlers[TWI_COUNT] = { - #if TWI0_ENABLED +#if TWI0_ENABLED { SPI0_TWI0_IRQn, (uint32_t) SPI0_TWI0_IRQHandler }, - #endif - #if TWI1_ENABLED +#endif +#if TWI1_ENABLED { SPI1_TWI1_IRQn, (uint32_t) SPI1_TWI1_IRQHandler } - #endif +#endif }; #ifdef NRF51 #define TWI_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW @@ -124,9 +124,12 @@ static const peripheral_handler_desc_t twi_handlers[TWI_COUNT] = #if DEVICE_I2C_ASYNCH static void start_asynch_rx(twi_info_t *twi_info, NRF_TWI_Type *twi) { - if (twi_info->rx_length == 1 && twi_info->stop) { + if (twi_info->rx_length == 1 && twi_info->stop) + { nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_STOP_MASK); - } else { + } + else + { nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_SUSPEND_MASK); } nrf_twi_task_trigger(twi, NRF_TWI_TASK_STARTRX); @@ -137,7 +140,8 @@ static void twi_irq_handler(uint8_t instance_idx) twi_info_t *twi_info = &m_twi_info[instance_idx]; NRF_TWI_Type *twi = m_twi_instances[instance_idx]; - if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) + { nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); // In case of an error, force STOP. @@ -148,33 +152,44 @@ static void twi_irq_handler(uint8_t instance_idx) uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(twi); twi_info->events |= I2C_EVENT_ERROR; - if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) { + if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) + { twi_info->events |= I2C_EVENT_ERROR_NO_SLAVE; } - if (errorsrc & NRF_TWI_ERROR_DATA_NACK) { + if (errorsrc & NRF_TWI_ERROR_DATA_NACK) + { twi_info->events |= I2C_EVENT_TRANSFER_EARLY_NACK; } } bool finished = false; - if (nrf_twi_event_check(twi, NRF_TWI_EVENT_TXDSENT)) { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_TXDSENT)) + { nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); MBED_ASSERT(twi_info->tx_length > 0); --(twi_info->tx_length); // Send next byte if there is still something to be sent. - if (twi_info->tx_length > 0) { + if (twi_info->tx_length > 0) + { nrf_twi_txd_set(twi, *(twi_info->tx)); ++(twi_info->tx); - // It TX is done, start RX if requested. - } else if (twi_info->rx_length > 0) { + // It TX is done, start RX if requested. + } + else if (twi_info->rx_length > 0) + { start_asynch_rx(twi_info, twi); - // If there is nothing more to do, finalize the transfer. - } else { - if (twi_info->stop) { + // If there is nothing more to do, finalize the transfer. + } + else + { + if (twi_info->stop) + { nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); - } else { + } + else + { nrf_twi_task_trigger(twi, NRF_TWI_TASK_SUSPEND); finished = true; } @@ -182,7 +197,8 @@ static void twi_irq_handler(uint8_t instance_idx) } } - if (nrf_twi_event_check(twi, NRF_TWI_EVENT_RXDREADY)) { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_RXDREADY)) + { nrf_twi_event_clear(twi, NRF_TWI_EVENT_RXDREADY); MBED_ASSERT(twi_info->rx_length > 0); @@ -190,15 +206,19 @@ static void twi_irq_handler(uint8_t instance_idx) ++(twi_info->rx); --(twi_info->rx_length); - if (twi_info->rx_length > 0) { + if (twi_info->rx_length > 0) + { // If more bytes should be received, resume the transfer // (in case the stop condition should be generated after the next // byte, change the shortcuts configuration first). - if (twi_info->rx_length == 1 && twi_info->stop) { + if (twi_info->rx_length == 1 && twi_info->stop) + { nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_STOP_MASK); } nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); - } else { + } + else + { // If all requested bytes were received, finalize the transfer. finished = true; twi_info->events |= I2C_EVENT_TRANSFER_COMPLETE; @@ -208,7 +228,8 @@ static void twi_irq_handler(uint8_t instance_idx) if (finished || nrf_twi_event_check(twi, NRF_TWI_EVENT_STOPPED) || (nrf_twi_int_enable_check(twi, NRF_TWI_INT_SUSPENDED_MASK) && - nrf_twi_event_check(twi, NRF_TWI_EVENT_SUSPENDED))) { + nrf_twi_event_check(twi, NRF_TWI_EVENT_SUSPENDED))) + { // There is no need to clear the STOPPED and SUSPENDED events here, // they will no longer generate the interrupt - see below. @@ -217,7 +238,8 @@ static void twi_irq_handler(uint8_t instance_idx) nrf_twi_int_disable(twi, UINT32_MAX); twi_info->active = false; - if (twi_info->handler) { + if (twi_info->handler) + { twi_info->handler(); } } @@ -264,13 +286,16 @@ static void twi_clear_bus(twi_info_t *twi_info) configure_twi_pin(twi_info->pselsda, NRF_GPIO_PIN_DIR_OUTPUT); // In case SDA is low, make up to 9 cycles on SCL line to help the slave // that pulls SDA low release it. - if (!nrf_gpio_pin_read(twi_info->pselsda)) { + if (!nrf_gpio_pin_read(twi_info->pselsda)) + { nrf_gpio_pin_set(twi_info->pselscl); configure_twi_pin(twi_info->pselscl, NRF_GPIO_PIN_DIR_OUTPUT); nrf_delay_us(4); - for (int i = 0; i < 9; i++) { - if (nrf_gpio_pin_read(twi_info->pselsda)) { + for (int i = 0; i < 9; i++) + { + if (nrf_gpio_pin_read(twi_info->pselsda)) + { break; } nrf_gpio_pin_clear(twi_info->pselscl); @@ -289,10 +314,13 @@ static void twi_clear_bus(twi_info_t *twi_info) void i2c_init(i2c_t *obj, PinName sda, PinName scl) { int i; - for (i = 0; i < TWI_COUNT; ++i) { + + for (i = 0; i < TWI_COUNT; ++i) + { if (m_twi_info[i].initialized && m_twi_info[i].pselsda == (uint32_t)sda && - m_twi_info[i].pselscl == (uint32_t)scl) { + m_twi_info[i].pselscl == (uint32_t)scl) + { TWI_IDX(obj) = i; TWI_INFO(obj)->frequency = NRF_TWI_FREQ_100K; i2c_reset(obj); @@ -300,8 +328,10 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) } } - for (i = 0; i < TWI_COUNT; ++i) { - if (!m_twi_info[i].initialized) { + for (i = 0; i < TWI_COUNT; ++i) + { + if (!m_twi_info[i].initialized) + { TWI_IDX(obj) = i; twi_info_t *twi_info = TWI_INFO(obj); @@ -350,7 +380,8 @@ int i2c_start(i2c_t *obj) { twi_info_t *twi_info = TWI_INFO(obj); #if DEVICE_I2C_ASYNCH - if (twi_info->active) { + if (twi_info->active) + { return I2C_ERROR_BUS_BUSY; } #endif @@ -368,11 +399,15 @@ int i2c_stop(i2c_t *obj) nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); uint32_t remaining_time = TIMEOUT_VALUE; - do { - if (nrf_twi_event_check(twi, NRF_TWI_EVENT_STOPPED)) { + + do + { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_STOPPED)) + { return 0; } - } while (--remaining_time); + } + while (--remaining_time); return 1; } @@ -382,11 +417,16 @@ void i2c_frequency(i2c_t *obj, int hz) twi_info_t *twi_info = TWI_INFO(obj); NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; - if (hz < 250000) { + if (hz < 250000) + { twi_info->frequency = NRF_TWI_FREQ_100K; - } else if (hz < 400000) { + } + else if (hz < 400000) + { twi_info->frequency = NRF_TWI_FREQ_250K; - } else { + } + else + { twi_info->frequency = NRF_TWI_FREQ_400K; } nrf_twi_frequency_set(twi, twi_info->frequency); @@ -422,7 +462,8 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) twi_info_t *twi_info = TWI_INFO(obj); #if DEVICE_I2C_ASYNCH - if (twi_info->active) { + if (twi_info->active) + { return I2C_ERROR_BUS_BUSY; } #endif @@ -432,9 +473,12 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) start_twi_read(twi, address); int result = length; - while (length > 0) { + + while (length > 0) + { int byte_read_result = i2c_byte_read(obj, (stop && length == 1)); - if (byte_read_result < 0) { + if (byte_read_result < 0) + { // When an error occurs, return the number of bytes that have been // received successfully. result -= length; @@ -446,7 +490,8 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) --length; } - if (stop) { + if (stop) + { (void)i2c_stop(obj); } @@ -460,16 +505,21 @@ static uint8_t twi_byte_write(NRF_TWI_Type *twi, uint8_t data) nrf_twi_txd_set(twi, data); uint32_t remaining_time = TIMEOUT_VALUE; - do { - if (nrf_twi_event_check(twi, NRF_TWI_EVENT_TXDSENT)) { + + do + { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_TXDSENT)) + { nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); return 1; // ACK received } - if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) + { nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); return 0; // some error occurred } - } while (--remaining_time); + } + while (--remaining_time); return 2; // timeout; } @@ -492,7 +542,8 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) { twi_info_t *twi_info = TWI_INFO(obj); #if DEVICE_I2C_ASYNCH - if (twi_info->active) { + if (twi_info->active) + { return I2C_ERROR_BUS_BUSY; } #endif @@ -503,26 +554,36 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) // Special case - transaction with no data. // It can be used to check if a slave acknowledges the address. - if (length == 0) { + if (length == 0) + { nrf_twi_event_t event; - if (stop) { + if (stop) + { event = NRF_TWI_EVENT_STOPPED; nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); - } else { + } + else + { event = NRF_TWI_EVENT_SUSPENDED; nrf_twi_event_clear(twi, event); nrf_twi_task_trigger(twi, NRF_TWI_TASK_SUSPEND); } uint32_t remaining_time = TIMEOUT_VALUE; - do { - if (nrf_twi_event_check(twi, event)) { + + do + { + if (nrf_twi_event_check(twi, event)) + { break; } - } while (--remaining_time); + } + while (--remaining_time); uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(twi); - if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) { - if (!stop) { + if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) + { + if (!stop) + { i2c_stop(obj); } return I2C_ERROR_NO_SLAVE; @@ -532,20 +593,29 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) } int result = length; - do { + + do + { uint8_t byte_write_result = twi_byte_write(twi, (uint8_t)*data++); - if (byte_write_result != 1) { - if (byte_write_result == 0) { + if (byte_write_result != 1) + { + if (byte_write_result == 0) + { // Check what kind of error has been signaled by TWI. uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(twi); - if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) { + if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK) + { result = I2C_ERROR_NO_SLAVE; - } else { + } + else + { // Some other error - return the number of bytes that // have been sent successfully. result -= length; } - } else { + } + else + { result = I2C_ERROR_BUS_BUSY; } // Force STOP condition. @@ -553,9 +623,11 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) break; } --length; - } while (length > 0); + } + while (length > 0); - if (stop) { + if (stop) + { (void)i2c_stop(obj); } @@ -566,22 +638,28 @@ int i2c_byte_read(i2c_t *obj, int last) { NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; - if (last) { + if (last) + { nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_STOP_MASK); } nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); uint32_t remaining_time = TIMEOUT_VALUE; - do { - if (nrf_twi_event_check(twi, NRF_TWI_EVENT_RXDREADY)) { + + do + { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_RXDREADY)) + { nrf_twi_event_clear(twi, NRF_TWI_EVENT_RXDREADY); return nrf_twi_rxd_get(twi); } - if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) { + if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) + { nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); return I2C_ERROR_NO_SLAVE; } - } while (--remaining_time); + } + while (--remaining_time); return I2C_ERROR_BUS_BUSY; } @@ -590,16 +668,22 @@ int i2c_byte_write(i2c_t *obj, int data) { NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; twi_info_t *twi_info = TWI_INFO(obj); - if (twi_info->start_twi) { + if (twi_info->start_twi) + { twi_info->start_twi = false; - if (data & 1) { + if (data & 1) + { start_twi_read(twi, data); - } else { + } + else + { start_twi_write(twi, data); } return 1; - } else { + } + else + { nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); // 0 - TWI signaled error (NAK is the only possibility here) // 1 - ACK received @@ -618,7 +702,8 @@ void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, (void)hint; twi_info_t *twi_info = TWI_INFO(obj); - if (twi_info->active) { + if (twi_info->active) + { return; } twi_info->active = true; @@ -643,21 +728,29 @@ void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, nrf_twi_address_set(twi, twi_address(address)); nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); // TX only, or TX + RX (after a repeated start). - if (tx_length > 0) { + if (tx_length > 0) + { nrf_twi_task_trigger(twi, NRF_TWI_TASK_STARTTX); nrf_twi_txd_set(twi, *(twi_info->tx)); ++(twi_info->tx); - // RX only. - } else if (rx_length > 0) { + // RX only. + } + else if (rx_length > 0) + { start_asynch_rx(twi_info, twi); - // Both 'tx_length' and 'rx_length' are 0 - this case may be used - // to test if the slave is presentand ready for transfer (by just - // sending the address and checking if it is acknowledged). - } else { + // Both 'tx_length' and 'rx_length' are 0 - this case may be used + // to test if the slave is presentand ready for transfer (by just + // sending the address and checking if it is acknowledged). + } + else + { nrf_twi_task_trigger(twi, NRF_TWI_TASK_STARTTX); - if (stop) { + if (stop) + { nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); - } else { + } + else + { nrf_twi_task_trigger(twi, NRF_TWI_TASK_SUSPEND); nrf_twi_int_enable(twi, NRF_TWI_INT_SUSPENDED_MASK); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nordic_critical.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nordic_critical.c index 4f94263196..3bcd4c9501 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nordic_critical.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/nordic_critical.c @@ -28,7 +28,8 @@ static volatile uint32_t _entry_count = 0; void core_util_critical_section_enter() { // if a critical section has already been entered, just update the counter - if (_entry_count) { + if (_entry_count) + { ++_entry_count; return; } @@ -47,7 +48,8 @@ void core_util_critical_section_exit() --_entry_count; // If their is other segments which have entered the critical section, just leave - if (_entry_count) { + if (_entry_count) + { return; } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h index 4ae7530509..104ff64834 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/objects.h @@ -48,36 +48,43 @@ extern "C" { #endif -struct serial_s { +struct serial_s +{ uint32_t placeholder; // struct is unused by nRF5x API implementation }; // but it must be not empty (required by strict compiler - IAR) -struct spi_s { +struct spi_s +{ uint8_t spi_idx; }; -struct port_s { +struct port_s +{ PortName port; uint32_t mask; }; -struct pwmout_s { +struct pwmout_s +{ PWMName pwm_name; PinName pin; uint8_t pwm_channel; void * pwm_struct; }; -struct i2c_s { +struct i2c_s +{ uint8_t twi_idx; }; -struct analogin_s { +struct analogin_s +{ ADCName adc; uint8_t adc_pin; }; -struct gpio_irq_s { +struct gpio_irq_s +{ uint32_t ch; }; diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c index 9b7849c78c..f20edafeff 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c @@ -38,10 +38,21 @@ #include "port_api.h" #include "pinmap.h" -#include "gpio_api.h" static NRF_GPIO_Type * const m_ports[] = GPIO_REG_LIST; +#if defined(TARGET_MCU_NRF51822) + static const uint32_t m_gpio_pin_count[] = {31}; +#elif defined(TARGET_MCU_NRF52832) + static const uint32_t m_gpio_pin_count[] = {32}; +#elif defined(TARGET_MCU_NRF52840) + static const uint32_t m_gpio_pin_count[] = {32, 16}; +#else + #error not recognized gpio count for mcu +#endif + +#define GPIO_PORT_COUNT (sizeof(m_gpio_pin_count)/sizeof(uint32_t)) + PinName port_pin(PortName port, int pin_n) { @@ -50,6 +61,8 @@ PinName port_pin(PortName port, int pin_n) void port_init(port_t *obj, PortName port, int mask, PinDirection dir) { + MBED_ASSERT((uint32_t)port < GPIO_PORT_COUNT); + obj->port = port; obj->mask = mask; @@ -60,8 +73,10 @@ void port_mode(port_t *obj, PinMode mode) { uint32_t i; // The mode is set per pin: reuse pinmap logic - for (i = 0; i<31; i++) { - if (obj->mask & (1 << i)) { + for (i = 0; i < m_gpio_pin_count[obj->port]; i++) + { + if (obj->mask & (1 << i)) + { pin_mode(port_pin(obj->port, i), mode); } } @@ -72,29 +87,37 @@ void port_dir(port_t *obj, PinDirection dir) int i; volatile uint32_t *reg_cnf = (volatile uint32_t*) m_ports[obj->port]->PIN_CNF; - - switch (dir) { - case PIN_INPUT: - for (i = 0; i<31; i++) { - if (obj->mask & (1 << i)) { - reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) - | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) - | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) - | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos); + + switch (dir) + { + case PIN_INPUT: + + for (i = 0; i < m_gpio_pin_count[obj->port]; i++) + { + if (obj->mask & (1 << i)) + { + reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) + | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) + | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos); + } } - } - break; - case PIN_OUTPUT: - for (i = 0; i<31; i++) { - if (obj->mask & (1 << i)) { - reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) - | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) - | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) - | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) - | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + break; + + case PIN_OUTPUT: + + for (i = 0; i < m_gpio_pin_count[obj->port]; i++) + { + if (obj->mask & (1 << i)) + { + reg_cnf[i] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) + | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) + | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) + | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) + | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); + } } - } - break; + break; } } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/reloc_vector_table.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/reloc_vector_table.c index 2862e6c417..bf9577331a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/reloc_vector_table.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/reloc_vector_table.c @@ -66,11 +66,13 @@ extern uint32_t __Vectors[]; void nrf_reloc_vector_table(void) { // Copy and switch to dynamic vectors - uint32_t *old_vectors = (uint32_t*)VECTORS_FLASH_START; - uint32_t i; - for (i = 0; i< NVIC_NUM_VECTORS; i++) { - nrf_dispatch_vector[i] = old_vectors[i]; - } + uint32_t *old_vectors = (uint32_t*)VECTORS_FLASH_START; + uint32_t i; + + for (i = 0; i< NVIC_NUM_VECTORS; i++) + { + nrf_dispatch_vector[i] = old_vectors[i]; + } - sd_softdevice_vector_table_base_set((uint32_t) nrf_dispatch_vector); + sd_softdevice_vector_table_base_set((uint32_t) nrf_dispatch_vector); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c index cc4d0f118f..589b85cd59 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/rtc_api.c @@ -80,7 +80,9 @@ time_t rtc_read(void) void rtc_write(time_t t) { uint32_t seconds; - do { + + do + { seconds = rtc_seconds_get(); m_time_base = t - seconds; // If the number of seconds indicated by the counter changed during the diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c index 55c4be419c..e0b91656c8 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c @@ -83,39 +83,40 @@ int stdio_uart_inited = 0; serial_t stdio_uart; -typedef struct { - bool initialized; - uint32_t irq_context; - uart_irq_handler irq_handler; +typedef struct +{ + bool initialized; + uint32_t irq_context; + uart_irq_handler irq_handler; - uint32_t pselrxd; - uint32_t pseltxd; - uint32_t pselcts; - uint32_t pselrts; - nrf_uart_hwfc_t hwfc; - nrf_uart_parity_t parity; + uint32_t pselrxd; + uint32_t pseltxd; + uint32_t pselcts; + uint32_t pselrts; + nrf_uart_hwfc_t hwfc; + nrf_uart_parity_t parity; nrf_uart_baudrate_t baudrate; #if DEVICE_SERIAL_ASYNCH - bool volatile rx_active; + bool volatile rx_active; uint8_t *rx_buffer; - size_t rx_length; - size_t rx_pos; - void (*rx_asynch_handler)(); - uint8_t char_match; + size_t rx_length; + size_t rx_pos; + void (*rx_asynch_handler)(); + uint8_t char_match; - bool volatile tx_active; + bool volatile tx_active; const uint8_t *tx_buffer; - size_t tx_length; - size_t tx_pos; - void (*tx_asynch_handler)(); + size_t tx_length; + size_t tx_pos; + void (*tx_asynch_handler)(); - uint32_t events_wanted; - uint32_t events_occured; + uint32_t events_wanted; + uint32_t events_occured; - #define UART_IRQ_TX 1 - #define UART_IRQ_RX 2 - uint8_t irq_enabled; +#define UART_IRQ_TX 1 +#define UART_IRQ_RX 2 + uint8_t irq_enabled; #endif // DEVICE_SERIAL_ASYNCH } uart_ctlblock_t; @@ -130,7 +131,8 @@ static void end_asynch_rx(void) { // If RX interrupt is activated for synchronous operations, // don't disable it, just stop handling it here. - if (!(UART_CB.irq_enabled & UART_IRQ_RX)) { + if (!(UART_CB.irq_enabled & UART_IRQ_RX)) + { nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY); } UART_CB.rx_active = false; @@ -139,7 +141,8 @@ static void end_asynch_tx(void) { // If TX interrupt is activated for synchronous operations, // don't disable it, just stop handling it here. - if (!(UART_CB.irq_enabled & UART_IRQ_TX)) { + if (!(UART_CB.irq_enabled & UART_IRQ_TX)) + { nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_TXDRDY); } UART_CB.tx_active = false; @@ -149,10 +152,12 @@ static void end_asynch_tx(void) void UART_IRQ_HANDLER(void) { if (nrf_uart_int_enable_check(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY) && - nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_RXDRDY)) { + nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_RXDRDY)) + { - #if DEVICE_SERIAL_ASYNCH - if (UART_CB.rx_active) { +#if DEVICE_SERIAL_ASYNCH + if (UART_CB.rx_active) + { nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_RXDRDY); uint8_t rx_data = nrf_uart_rxd_get(UART_INSTANCE); @@ -162,21 +167,26 @@ void UART_IRQ_HANDLER(void) // If character matching should be performed, check if the current // data matches the given one. if (UART_CB.char_match != SERIAL_RESERVED_CHAR_MATCH && - rx_data == UART_CB.char_match) { + rx_data == UART_CB.char_match) + { // If it does, report the match and abort further receiving. UART_CB.events_occured |= SERIAL_EVENT_RX_CHARACTER_MATCH; - if (UART_CB.events_wanted & SERIAL_EVENT_RX_CHARACTER_MATCH) { + if (UART_CB.events_wanted & SERIAL_EVENT_RX_CHARACTER_MATCH) + { end_rx = true; } } - if (++UART_CB.rx_pos >= UART_CB.rx_length) { + if (++UART_CB.rx_pos >= UART_CB.rx_length) + { UART_CB.events_occured |= SERIAL_EVENT_RX_COMPLETE; end_rx = true; } - if (end_rx) { + if (end_rx) + { end_asynch_rx(); - if (UART_CB.rx_asynch_handler) { + if (UART_CB.rx_asynch_handler) + { // Use local variable to make it possible to start a next // transfer from callback routine. void (*handler)() = UART_CB.rx_asynch_handler; @@ -186,26 +196,31 @@ void UART_IRQ_HANDLER(void) } } else - #endif +#endif - if (UART_CB.irq_handler) { + if (UART_CB.irq_handler) + { UART_CB.irq_handler(UART_CB.irq_context, RxIrq); } } if (nrf_uart_int_enable_check(UART_INSTANCE, NRF_UART_INT_MASK_TXDRDY) && - nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_TXDRDY)) { + nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_TXDRDY)) + { - #if DEVICE_SERIAL_ASYNCH - if (UART_CB.tx_active) { - if (++UART_CB.tx_pos <= UART_CB.tx_length) { +#if DEVICE_SERIAL_ASYNCH + if (UART_CB.tx_active) + { + if (++UART_CB.tx_pos <= UART_CB.tx_length) + { // When there is still something to send, clear the TXDRDY event // and put next byte to transmitter. nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_TXDRDY); nrf_uart_txd_set(UART_INSTANCE, UART_CB.tx_buffer[UART_CB.tx_pos]); } - else { + else + { // When the TXDRDY event is set after the last byte to be sent // has been passed to the transmitter, the job is done and TX // complete can be indicated. @@ -214,7 +229,8 @@ void UART_IRQ_HANDLER(void) end_asynch_tx(); UART_CB.events_occured |= SERIAL_EVENT_TX_COMPLETE; - if (UART_CB.tx_asynch_handler) { + if (UART_CB.tx_asynch_handler) + { // Use local variable to make it possible to start a next // transfer from callback routine. void (*handler)() = UART_CB.tx_asynch_handler; @@ -224,27 +240,33 @@ void UART_IRQ_HANDLER(void) } } else - #endif +#endif - if (UART_CB.irq_handler) { + if (UART_CB.irq_handler) + { UART_CB.irq_handler(UART_CB.irq_context, TxIrq); } } #if DEVICE_SERIAL_ASYNCH - if (nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_ERROR)) { + if (nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_ERROR)) + { nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_ERROR); uint8_t errorsrc = nrf_uart_errorsrc_get_and_clear(UART_INSTANCE); - if (UART_CB.rx_asynch_handler) { + if (UART_CB.rx_asynch_handler) + { UART_CB.events_occured |= SERIAL_EVENT_ERROR; - if (errorsrc & NRF_UART_ERROR_PARITY_MASK) { + if (errorsrc & NRF_UART_ERROR_PARITY_MASK) + { UART_CB.events_occured |= SERIAL_EVENT_RX_PARITY_ERROR; } - if (errorsrc & NRF_UART_ERROR_FRAMING_MASK) { + if (errorsrc & NRF_UART_ERROR_FRAMING_MASK) + { UART_CB.events_occured |= SERIAL_EVENT_RX_FRAMING_ERROR; } - if (errorsrc & NRF_UART_ERROR_OVERRUN_MASK) { + if (errorsrc & NRF_UART_ERROR_OVERRUN_MASK) + { UART_CB.events_occured |= SERIAL_EVENT_RX_OVERRUN_ERROR; } UART_CB.rx_asynch_handler(); @@ -253,7 +275,9 @@ void UART_IRQ_HANDLER(void) #endif // DEVICE_SERIAL_ASYNCH } -void serial_init(serial_t *obj, PinName tx, PinName rx) { + +void serial_init(serial_t *obj, PinName tx, PinName rx) +{ NVIC_SetVector(UART0_IRQn, (uint32_t) UART0_IRQHandler); @@ -262,27 +286,32 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { (tx == NC) ? NRF_UART_PSEL_DISCONNECTED : (uint32_t)tx; UART_CB.pselrxd = (rx == NC) ? NRF_UART_PSEL_DISCONNECTED : (uint32_t)rx; - if (UART_CB.pseltxd != NRF_UART_PSEL_DISCONNECTED) { + if (UART_CB.pseltxd != NRF_UART_PSEL_DISCONNECTED) + { nrf_gpio_pin_set(UART_CB.pseltxd); nrf_gpio_cfg_output(UART_CB.pseltxd); } - if (UART_CB.pselrxd != NRF_UART_PSEL_DISCONNECTED) { + if (UART_CB.pselrxd != NRF_UART_PSEL_DISCONNECTED) + { nrf_gpio_cfg_input(UART_CB.pselrxd, NRF_GPIO_PIN_NOPULL); } - if (UART_CB.initialized) { + if (UART_CB.initialized) + { // For already initialized peripheral it is sufficient to reconfigure // RX/TX pins only. // Ensure that there is no unfinished TX transfer. - while (!serial_writable(obj)) { + while (!serial_writable(obj)) + { } // UART pins can be configured only when the peripheral is disabled. nrf_uart_disable(UART_INSTANCE); nrf_uart_txrx_pins_set(UART_INSTANCE, UART_CB.pseltxd, UART_CB.pselrxd); nrf_uart_enable(UART_INSTANCE); } - else { + else + { UART_CB.baudrate = (nrf_uart_baudrate_t)UART_DEFAULT_BAUDRATE; UART_CB.parity = (nrf_uart_parity_t)UART_DEFAULT_PARITY; UART_CB.hwfc = (nrf_uart_hwfc_t)UART_DEFAULT_HWFC; @@ -295,10 +324,10 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { nrf_uart_task_trigger(UART_INSTANCE, NRF_UART_TASK_STARTTX); nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY | - NRF_UART_INT_MASK_TXDRDY); - #if DEVICE_SERIAL_ASYNCH + NRF_UART_INT_MASK_TXDRDY); +#if DEVICE_SERIAL_ASYNCH nrf_uart_int_enable(UART_INSTANCE, NRF_UART_INT_MASK_ERROR); - #endif +#endif nrf_drv_common_irq_enable(UART_IRQn, NRFx_MBED_UART_IRQ_PRIORITY); // TX interrupt needs to be signaled when transmitter buffer is empty, @@ -315,7 +344,9 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { nrf_uart_hwfc_pins_disconnect(UART_INSTANCE); nrf_uart_enable(UART_INSTANCE); nrf_uart_txd_set(UART_INSTANCE, 0); - while (!nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_TXDRDY)) { + + while (!nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_TXDRDY)) + { } nrf_uart_disable(UART_INSTANCE); @@ -324,7 +355,8 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { nrf_uart_txrx_pins_set(UART_INSTANCE, UART_CB.pseltxd, UART_CB.pselrxd); nrf_uart_baudrate_set(UART_INSTANCE, UART_CB.baudrate); nrf_uart_configure(UART_INSTANCE, UART_CB.parity, UART_CB.hwfc); - if (UART_CB.hwfc == NRF_UART_HWFC_ENABLED) { + if (UART_CB.hwfc == NRF_UART_HWFC_ENABLED) + { internal_set_hwfc(FlowControlRTSCTS, (PinName) UART_CB.pselrts, (PinName) UART_CB.pselcts); } @@ -334,11 +366,13 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { UART_CB.initialized = true; } - if (tx == STDIO_UART_TX && rx == STDIO_UART_RX) { + if (tx == STDIO_UART_TX && rx == STDIO_UART_RX) + { stdio_uart_inited = 1; memcpy(&stdio_uart, obj, sizeof(serial_t)); } - else { + else + { stdio_uart_inited = 0; } } @@ -347,7 +381,8 @@ void serial_free(serial_t *obj) { (void)obj; - if (UART_CB.initialized) { + if (UART_CB.initialized) + { nrf_uart_disable(UART_INSTANCE); nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_TXDRDY | @@ -388,14 +423,18 @@ void serial_baud(serial_t *obj, int baudrate) { 1000000, UART_BAUDRATE_BAUDRATE_Baud1M } }; - if (baudrate <= 1200) { + if (baudrate <= 1200) + { UART_INSTANCE->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1200; return; } int const item_cnt = sizeof(acceptedSpeeds)/sizeof(acceptedSpeeds[0]); - for (int i = 1; i < item_cnt; i++) { - if ((uint32_t)baudrate < acceptedSpeeds[i][0]) { + + for (int i = 1; i < item_cnt; i++) + { + if ((uint32_t)baudrate < acceptedSpeeds[i][0]) + { UART_INSTANCE->BAUDRATE = acceptedSpeeds[i - 1][1]; return; } @@ -409,17 +448,24 @@ void serial_format(serial_t *obj, { (void)obj; - if (data_bits != 8) { + if (data_bits != 8) + { error("UART supports only 8 data bits.\r\n"); } - if (stop_bits != 1) { + if (stop_bits != 1) + { error("UART supports only 1 stop bits.\r\n"); } - if (parity == ParityNone) { + if (parity == ParityNone) + { UART_CB.parity = NRF_UART_PARITY_EXCLUDED; - } else if (parity == ParityEven) { + } + else if (parity == ParityEven) + { UART_CB.parity = NRF_UART_PARITY_INCLUDED; - } else { + } + else + { error("UART supports only even parity.\r\n"); } @@ -437,29 +483,34 @@ void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) { (void)obj; - if (enable) { - switch (irq) { + if (enable) + { + switch (irq) + { case RxIrq: - #if DEVICE_SERIAL_ASYNCH +#if DEVICE_SERIAL_ASYNCH UART_CB.irq_enabled |= UART_IRQ_RX; - #endif +#endif nrf_uart_int_enable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY); break; case TxIrq: - #if DEVICE_SERIAL_ASYNCH +#if DEVICE_SERIAL_ASYNCH UART_CB.irq_enabled |= UART_IRQ_TX; - #endif +#endif nrf_uart_int_enable(UART_INSTANCE, NRF_UART_INT_MASK_TXDRDY); break; } - } else { - switch (irq) { + } + else + { + switch (irq) + { case RxIrq: - #if DEVICE_SERIAL_ASYNCH +#if DEVICE_SERIAL_ASYNCH UART_CB.irq_enabled &= ~UART_IRQ_RX; if (!UART_CB.rx_active) - #endif +#endif { nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY); @@ -467,10 +518,10 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) break; case TxIrq: - #if DEVICE_SERIAL_ASYNCH +#if DEVICE_SERIAL_ASYNCH UART_CB.irq_enabled &= ~UART_IRQ_TX; if (!UART_CB.tx_active) - #endif +#endif { nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_TXDRDY); @@ -482,7 +533,8 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) int serial_getc(serial_t *obj) { - while (!serial_readable(obj)) { + while (!serial_readable(obj)) + { } nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_RXDRDY); @@ -491,7 +543,8 @@ int serial_getc(serial_t *obj) void serial_putc(serial_t *obj, int c) { - while (!serial_writable(obj)) { + while (!serial_writable(obj)) + { } nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_TXDRDY); @@ -502,7 +555,8 @@ int serial_readable(serial_t *obj) { (void)obj; #if DEVICE_SERIAL_ASYNCH - if (UART_CB.rx_active) { + if (UART_CB.rx_active) + { return 0; } #endif @@ -513,7 +567,8 @@ int serial_writable(serial_t *obj) { (void)obj; #if DEVICE_SERIAL_ASYNCH - if (UART_CB.tx_active) { + if (UART_CB.tx_active) + { return 0; } #endif @@ -546,11 +601,13 @@ static void internal_set_hwfc(FlowControl type, UART_CB.pselcts = ((txflow == NC) || (type == FlowControlRTS)) ? NRF_UART_PSEL_DISCONNECTED : (uint32_t)txflow; - if (UART_CB.pselrts != NRF_UART_PSEL_DISCONNECTED) { + if (UART_CB.pselrts != NRF_UART_PSEL_DISCONNECTED) + { nrf_gpio_pin_set(UART_CB.pselrts); nrf_gpio_cfg_output(UART_CB.pselrts); } - if (UART_CB.pselcts != NRF_UART_PSEL_DISCONNECTED) { + if (UART_CB.pselcts != NRF_UART_PSEL_DISCONNECTED) + { nrf_gpio_cfg_input(UART_CB.pselcts, NRF_GPIO_PIN_NOPULL); } @@ -571,7 +628,8 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, } -void serial_clear(serial_t *obj) { +void serial_clear(serial_t *obj) +{ (void)obj; } @@ -584,7 +642,8 @@ int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, (void)obj; (void)tx_width; (void)hint; - if (UART_CB.tx_active || !tx_length) { + if (UART_CB.tx_active || !tx_length) + { return 0; } @@ -608,7 +667,8 @@ void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, (void)obj; (void)rx_width; (void)hint; - if (UART_CB.rx_active || !rx_length) { + if (UART_CB.rx_active || !rx_length) + { return; } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c index 3d917c2dae..cc73962fcc 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sleep.c @@ -25,7 +25,7 @@ #define FPU_EXCEPTION_MASK 0x0000009F -void sleep(void) +void hal_sleep(void) { // ensure debug is disconnected if semihost is enabled.... @@ -41,10 +41,13 @@ void sleep(void) #endif // If the SoftDevice is enabled, its API must be used to go to sleep. - if (softdevice_handler_is_enabled()) { + if (softdevice_handler_is_enabled()) + { sd_power_mode_set(NRF_POWER_MODE_LOWPWR); sd_app_evt_wait(); - } else { + } + else + { NRF_POWER->TASKS_LOWPWR = 1; // Note: it is not sufficient to just use WFE here, since the internal @@ -61,10 +64,13 @@ void sleep(void) __WFE(); // Test if there is an interrupt pending (mask reserved regions) - if (SCB->ICSR & (SCB_ICSR_RESERVED_BITS_MASK)) { + if (SCB->ICSR & (SCB_ICSR_RESERVED_BITS_MASK)) + { // Ok, there is an interrut pending, no need to go to sleep return; - } else { + } + else + { // next event will wakeup the CPU // If an interrupt occured between the test of SCB->ICSR and this // instruction, WFE will just not put the CPU to sleep @@ -73,8 +79,7 @@ void sleep(void) } } -void deepsleep(void) +void hal_deepsleep(void) { - sleep(); - // NRF_POWER->SYSTEMOFF=1; + hal_sleep(); } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c index f2b60de00b..da75772099 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/spi_api.c @@ -58,16 +58,18 @@ #define MASTER_INST(obj) (&m_instances[SPI_IDX(obj)].master) #define SLAVE_INST(obj) (&m_instances[SPI_IDX(obj)].slave) -typedef struct { - bool initialized; - bool master; +typedef struct +{ + bool initialized; + bool master; uint8_t sck_pin; uint8_t mosi_pin; uint8_t miso_pin; uint8_t ss_pin; uint8_t spi_mode; nrf_drv_spi_frequency_t frequency; - volatile union { + volatile union + { bool busy; // master bool readable; // slave } flag; @@ -81,8 +83,9 @@ typedef struct { } spi_info_t; static spi_info_t m_spi_info[SPI_COUNT]; -typedef struct { - nrf_drv_spi_t master; +typedef struct +{ + nrf_drv_spi_t master; nrf_drv_spis_t slave; } sdk_driver_instances_t; @@ -90,25 +93,25 @@ void SPI0_TWI0_IRQHandler(void); void SPI1_TWI1_IRQHandler(void); void SPIM2_SPIS2_SPI2_IRQHandler(void); -static const peripheral_handler_desc_t spi_hanlder_desc[SPI_COUNT] = { +static const peripheral_handler_desc_t spi_handler_desc[SPI_COUNT] = { #if SPI0_ENABLED { - SPIS0_IRQ, + SPI0_IRQ, (uint32_t) SPI0_TWI0_IRQHandler }, #endif #if SPI1_ENABLED { - SPIS1_IRQ, + SPI1_IRQ, (uint32_t) SPI1_TWI1_IRQHandler }, #endif #if SPI2_ENABLED { - SPIS2_IRQ, + SPI2_IRQ, (uint32_t) SPIM2_SPIS2_SPI2_IRQHandler }, -#endif +#endif }; @@ -138,9 +141,11 @@ static void master_event_handler(uint8_t spi_idx, { spi_info_t *p_spi_info = &m_spi_info[spi_idx]; - if (p_event->type == NRF_DRV_SPI_EVENT_DONE) { + if (p_event->type == NRF_DRV_SPI_EVENT_DONE) + { p_spi_info->flag.busy = false; - if (p_spi_info->handler) { + if (p_spi_info->handler) + { void (*handler)(void) = (void (*)(void))p_spi_info->handler; p_spi_info->handler = 0; handler(); @@ -179,7 +184,8 @@ static void slave_event_handler(uint8_t spi_idx, { spi_info_t *p_spi_info = &m_spi_info[spi_idx]; - if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) { + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { // Signal that there is some data received that could be read. p_spi_info->flag.readable = true; @@ -254,12 +260,35 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) { int i; - for (i = 0; i < SPI_COUNT; ++i) { + + // This block is only a workaround that allows to create SPI object several + // times, what would be otherwise impossible in the current implementation + // of mbed driver that does not call spi_free() from SPI destructor. + // Once this mbed's imperfection is corrected, this block should be removed. + for (i = 0; i < SPI_COUNT; ++i) + { spi_info_t *p_spi_info = &m_spi_info[i]; - if (!p_spi_info->initialized) { - - NVIC_SetVector(spi_hanlder_desc[i].IRQn, spi_hanlder_desc[i].vector); - + + if (p_spi_info->initialized && + p_spi_info->mosi_pin == (uint8_t)mosi && + p_spi_info->miso_pin == (uint8_t)miso && + p_spi_info->sck_pin == (uint8_t)sclk && + p_spi_info->ss_pin == (uint8_t)ssel) + { + // Reuse the already allocated SPI instance (instead of allocating + // a new one), if it appears to be initialized with exactly the same + // pin assignments. + SPI_IDX(obj) = i; + return; + } + } + + for (i = 0; i < SPI_COUNT; ++i) + { + spi_info_t *p_spi_info = &m_spi_info[i]; + + if (!p_spi_info->initialized) + { p_spi_info->sck_pin = (uint8_t)sclk; p_spi_info->mosi_pin = (mosi != NC) ? (uint8_t)mosi : NRF_DRV_SPI_PIN_NOT_USED; @@ -270,22 +299,25 @@ void spi_init(spi_t *obj, p_spi_info->spi_mode = (uint8_t)NRF_DRV_SPI_MODE_0; p_spi_info->frequency = NRF_DRV_SPI_FREQ_1M; + NVIC_SetVector(spi_handler_desc[i].IRQn, spi_handler_desc[i].vector); + // By default each SPI instance is initialized to work as a master. // Should the slave mode be used, the instance will be reconfigured // appropriately in 'spi_format'. nrf_drv_spi_config_t config; prepare_master_config(&config, p_spi_info); - nrf_drv_spi_t const *p_spi = &m_instances[i].master; - ret_code_t ret_code = nrf_drv_spi_init(p_spi, - &config, m_master_event_handlers[i]); - if (ret_code == NRF_SUCCESS) { + nrf_drv_spi_t const *p_spi = &m_instances[i].master; + ret_code_t ret_code = nrf_drv_spi_init(p_spi, + &config, m_master_event_handlers[i]); + if (ret_code == NRF_SUCCESS) + { p_spi_info->initialized = true; p_spi_info->master = true; p_spi_info->flag.busy = false; - #if DEVICE_SPI_ASYNCH - p_spi_info->handler = 0; - #endif +#if DEVICE_SPI_ASYNCH + p_spi_info->handler = 0; +#endif SPI_IDX(obj) = i; return; @@ -300,10 +332,13 @@ void spi_init(spi_t *obj, void spi_free(spi_t *obj) { spi_info_t *p_spi_info = SPI_INFO(obj); - if (p_spi_info->master) { + + if (p_spi_info->master) + { nrf_drv_spi_uninit(MASTER_INST(obj)); } - else { + else + { nrf_drv_spis_uninit(SLAVE_INST(obj)); } p_spi_info->initialized = false; @@ -316,10 +351,12 @@ int spi_busy(spi_t *obj) void spi_format(spi_t *obj, int bits, int mode, int slave) { - if (bits != 8) { + if (bits != 8) + { error("Only 8-bits SPI is supported\r\n"); } - if (mode > 3) { + if (mode > 3) + { error("SPI format error\r\n"); } @@ -337,15 +374,18 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) // If the peripheral is currently working as a master, the SDK driver // it uses needs to be switched from SPI to SPIS. - if (p_spi_info->master) { + if (p_spi_info->master) + { nrf_drv_spi_uninit(MASTER_INST(obj)); } // I the SPI mode has to be changed, the SDK's SPIS driver needs to be // re-initialized (there is no other way to change its configuration). - else if (p_spi_info->spi_mode != (uint8_t)new_mode) { + else if (p_spi_info->spi_mode != (uint8_t)new_mode) + { nrf_drv_spis_uninit(SLAVE_INST(obj)); } - else { + else + { return; } @@ -377,15 +417,18 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) // If the peripheral is currently working as a slave, the SDK driver // it uses needs to be switched from SPIS to SPI. - if (!p_spi_info->master) { + if (!p_spi_info->master) + { nrf_drv_spis_uninit(SLAVE_INST(obj)); } // I the SPI mode has to be changed, the SDK's SPI driver needs to be // re-initialized (there is no other way to change its configuration). - else if (p_spi_info->spi_mode != (uint8_t)new_mode) { + else if (p_spi_info->spi_mode != (uint8_t)new_mode) + { nrf_drv_spi_uninit(MASTER_INST(obj)); } - else { + else + { return; } @@ -404,19 +447,33 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) static nrf_drv_spi_frequency_t freq_translate(int hz) { nrf_drv_spi_frequency_t frequency; - if (hz<250000) { //125Kbps + + if (hz<250000) //125Kbps + { frequency = NRF_DRV_SPI_FREQ_125K; - } else if (hz<500000) { //250Kbps + } + else if (hz<500000) //250Kbps + { frequency = NRF_DRV_SPI_FREQ_250K; - } else if (hz<1000000) { //500Kbps + } + else if (hz<1000000) //500Kbps + { frequency = NRF_DRV_SPI_FREQ_500K; - } else if (hz<2000000) { //1Mbps + } + else if (hz<2000000) //1Mbps + { frequency = NRF_DRV_SPI_FREQ_1M; - } else if (hz<4000000) { //2Mbps + } + else if (hz<4000000) //2Mbps + { frequency = NRF_DRV_SPI_FREQ_2M; - } else if (hz<8000000) { //4Mbps + } + else if (hz<8000000) //4Mbps + { frequency = NRF_DRV_SPI_FREQ_4M; - } else { //8Mbps + } + else //8Mbps + { frequency = NRF_DRV_SPI_FREQ_8M; } return frequency; @@ -429,7 +486,8 @@ void spi_frequency(spi_t *obj, int hz) if (p_spi_info->master) { - if (p_spi_info->frequency != new_frequency) { + if (p_spi_info->frequency != new_frequency) + { p_spi_info->frequency = new_frequency; nrf_drv_spi_config_t config; @@ -450,7 +508,9 @@ int spi_master_write(spi_t *obj, int value) spi_info_t *p_spi_info = SPI_INFO(obj); #if DEVICE_SPI_ASYNCH - while (p_spi_info->flag.busy) { + + while (p_spi_info->flag.busy) + { } #endif @@ -459,7 +519,9 @@ int spi_master_write(spi_t *obj, int value) (void)nrf_drv_spi_transfer(MASTER_INST(obj), (uint8_t const *)&p_spi_info->tx_buf, 1, (uint8_t *)&p_spi_info->rx_buf, 1); - while (p_spi_info->flag.busy) { + + while (p_spi_info->flag.busy) + { } return p_spi_info->rx_buf; @@ -470,14 +532,15 @@ int spi_slave_receive(spi_t *obj) spi_info_t *p_spi_info = SPI_INFO(obj); MBED_ASSERT(!p_spi_info->master); return p_spi_info->flag.readable; -; } int spi_slave_read(spi_t *obj) { spi_info_t *p_spi_info = SPI_INFO(obj); MBED_ASSERT(!p_spi_info->master); - while (!p_spi_info->flag.readable) { + + while (!p_spi_info->flag.readable) + { } p_spi_info->flag.readable = false; return p_spi_info->rx_buf; diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c index 6280236dcb..ebc79dcea3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c @@ -51,7 +51,7 @@ // #include "app_util_platform.h" -bool m_common_rtc_enabled = false; +bool m_common_rtc_enabled = false; uint32_t volatile m_common_rtc_overflows = 0; #if defined(TARGET_MCU_NRF51822) @@ -60,18 +60,21 @@ void common_rtc_irq_handler(void) void COMMON_RTC_IRQ_HANDLER(void) #endif { - if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, US_TICKER_EVENT)) { + if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, US_TICKER_EVENT)) + { us_ticker_irq_handler(); } #if DEVICE_LOWPOWERTIMER - if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, LP_TICKER_EVENT)) { + if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, LP_TICKER_EVENT)) + { lp_ticker_irq_handler(); } #endif - if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, NRF_RTC_EVENT_OVERFLOW)) { + if (nrf_rtc_event_pending(COMMON_RTC_INSTANCE, NRF_RTC_EVENT_OVERFLOW)) + { nrf_rtc_event_clear(COMMON_RTC_INSTANCE, NRF_RTC_EVENT_OVERFLOW); // Don't disable this event. It shall occur periodically. @@ -85,29 +88,33 @@ __STATIC_INLINE void errata_20(void) #if defined(NRF52_ERRATA_20) if (!softdevice_handler_is_enabled()) { - NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; - NRF_CLOCK->TASKS_LFCLKSTART = 1; - while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {} + NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; + NRF_CLOCK->TASKS_LFCLKSTART = 1; + + while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) + { + } } - NRF_RTC1->TASKS_STOP = 0; -#endif + NRF_RTC1->TASKS_STOP = 0; +#endif } #if (defined (__ICCARM__)) && defined(TARGET_MCU_NRF51822)//IAR -__stackless __task +__stackless __task #endif void RTC1_IRQHandler(void); void common_rtc_init(void) { - if (m_common_rtc_enabled) { + if (m_common_rtc_enabled) + { return; } errata_20(); - + NVIC_SetVector(RTC1_IRQn, (uint32_t)RTC1_IRQHandler); - + // RTC is driven by the low frequency (32.768 kHz) clock, a proper request // must be made to have it running. // Currently this clock is started in 'SystemInit' (see "system_nrf51.c" @@ -128,32 +135,32 @@ void common_rtc_init(void) // events will be enabled or disabled as needed (such approach is more // energy efficient). nrf_rtc_int_enable(COMMON_RTC_INSTANCE, - #if DEVICE_LOWPOWERTIMER - LP_TICKER_INT_MASK | - #endif - US_TICKER_INT_MASK | - NRF_RTC_INT_OVERFLOW_MASK); +#if DEVICE_LOWPOWERTIMER + LP_TICKER_INT_MASK | +#endif + US_TICKER_INT_MASK | + NRF_RTC_INT_OVERFLOW_MASK); // This event is enabled permanently, since overflow indications are needed // continuously. nrf_rtc_event_enable(COMMON_RTC_INSTANCE, NRF_RTC_INT_OVERFLOW_MASK); // All other relevant events are initially disabled. nrf_rtc_event_disable(COMMON_RTC_INSTANCE, - #if defined(TARGET_MCU_NRF51822) - OS_TICK_INT_MASK | - #endif - #if DEVICE_LOWPOWERTIMER - LP_TICKER_INT_MASK | - #endif - US_TICKER_INT_MASK); +#if defined(TARGET_MCU_NRF51822) + OS_TICK_INT_MASK | +#endif +#if DEVICE_LOWPOWERTIMER + LP_TICKER_INT_MASK | +#endif + 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); @@ -192,10 +199,12 @@ void common_rtc_set_interrupt(uint32_t us_timestamp, uint32_t cc_channel, uint64_t current_time64 = common_rtc_64bit_us_get(); // [add upper 32 bits from the current time to the timestamp value] uint64_t timestamp64 = us_timestamp + - (current_time64 & ~(uint64_t)0xFFFFFFFF); + (current_time64 & ~(uint64_t)0xFFFFFFFF); + // [if the original timestamp value happens to be after the 32 bit counter // of microsends overflows, correct the upper 32 bits accordingly] - if (us_timestamp < (uint32_t)(current_time64 & 0xFFFFFFFF)) { + if (us_timestamp < (uint32_t)(current_time64 & 0xFFFFFFFF)) + { timestamp64 += ((uint64_t)1 << 32); } // [microseconds -> ticks, always round the result up to avoid too early @@ -209,7 +218,8 @@ void common_rtc_set_interrupt(uint32_t us_timestamp, uint32_t cc_channel, // value is 2 ticks. This guarantees that the compare trigger is properly // setup before the compare condition occurs. uint32_t closest_safe_compare = common_rtc_32bit_ticks_get() + 2; - if ((int)(compare_value - closest_safe_compare) <= 0) { + if ((int)(compare_value - closest_safe_compare) <= 0) + { compare_value = closest_safe_compare; } @@ -251,7 +261,7 @@ void us_ticker_clear_interrupt(void) // alternative source of RTOS ticks. #if defined(TARGET_MCU_NRF51822) -#include "toolchain.h" +#include "mbed_toolchain.h" #define MAX_RTC_COUNTER_VAL ((1uL << RTC_COUNTER_BITS) - 1) @@ -273,7 +283,9 @@ static uint32_t previous_tick_cc_value = 0; */ MBED_WEAK uint32_t const os_trv; MBED_WEAK uint32_t const os_clockrate; -MBED_WEAK void OS_Tick_Handler() { } +MBED_WEAK void OS_Tick_Handler() +{ +} #if defined (__CC_ARM) /* ARMCC Compiler */ @@ -414,14 +426,18 @@ __stackless __task void COMMON_RTC_IRQ_HANDLER(void) * Return the next number of clock cycle needed for the next tick. * @note This function has been carrefuly optimized for a systick occuring every 1000us. */ -static uint32_t get_next_tick_cc_delta() { +static uint32_t get_next_tick_cc_delta() +{ uint32_t delta = 0; - if (os_clockrate != 1000) { + if (os_clockrate != 1000) + { // In RTX, by default SYSTICK is is used. // A tick event is generated every os_trv + 1 clock cycles of the system timer. delta = os_trv + 1; - } else { + } + else + { // If the clockrate is set to 1000us then 1000 tick should happen every second. // Unfortunatelly, when clockrate is set to 1000, os_trv is equal to 31. // If (os_trv + 1) is used as the delta value between two ticks, 1000 ticks will be @@ -437,20 +453,26 @@ static uint32_t get_next_tick_cc_delta() { // Every five ticks (20%, 200 delta in one second), the delta is equal to 32 // The remaining (32) deltas equal to 32 are distributed using primes numbers. static uint32_t counter = 0; - if ((counter % 5) == 0 || (counter % 31) == 0 || (counter % 139) == 0 || (counter == 503)) { + if ((counter % 5) == 0 || (counter % 31) == 0 || (counter % 139) == 0 || (counter == 503)) + { delta = 32; - } else { + } + else + { delta = 33; } ++counter; - if (counter == 1000) { + if (counter == 1000) + { counter = 0; } } return delta; } -static inline void clear_tick_interrupt() { + +static inline void clear_tick_interrupt() +{ nrf_rtc_event_clear(COMMON_RTC_INSTANCE, OS_TICK_EVENT); nrf_rtc_event_disable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK); } @@ -462,21 +484,31 @@ static inline void clear_tick_interrupt() { * @param val value to check * @return true if the value is included in the range and false otherwise. */ -static inline bool is_in_wrapped_range(uint32_t begin, uint32_t end, uint32_t val) { +static inline bool is_in_wrapped_range(uint32_t begin, uint32_t end, uint32_t val) +{ // regular case, begin < end // return true if begin <= val < end - if (begin < end) { - if (begin <= val && val < end) { + if (begin < end) + { + if (begin <= val && val < end) + { return true; - } else { + } + else + { return false; } - } else { + } + else + { // In this case end < begin because it has wrap around the limits // return false if end < val < begin - if (end < val && val < begin) { + if (end < val && val < begin) + { return false; - } else { + } + else + { return true; } } @@ -486,7 +518,8 @@ static inline bool is_in_wrapped_range(uint32_t begin, uint32_t end, uint32_t va /** * Register the next tick. */ -static void register_next_tick() { +static void register_next_tick() +{ previous_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); uint32_t delta = get_next_tick_cc_delta(); uint32_t new_compare_value = (previous_tick_cc_value + delta) & MAX_RTC_COUNTER_VAL; @@ -502,7 +535,8 @@ static void register_next_tick() { uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); // If an overflow occur, set the next tick in COUNTER + delta clock cycles - if (is_in_wrapped_range(previous_tick_cc_value, new_compare_value, current_counter + 1) == false) { + if (is_in_wrapped_range(previous_tick_cc_value, new_compare_value, current_counter + 1) == false) + { new_compare_value = current_counter + delta; } nrf_rtc_cc_set(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL, new_compare_value); @@ -545,8 +579,9 @@ void os_tick_irqack(void) * @note This function is exposed by RTX kernel. * @return 1 if the timer has overflowed and 0 otherwise. */ -uint32_t os_tick_ovf(void) { - uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); +uint32_t os_tick_ovf(void) +{ + uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); uint32_t next_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); return is_in_wrapped_range(previous_tick_cc_value, next_tick_cc_value, current_counter) ? 0 : 1; @@ -561,25 +596,35 @@ uint32_t os_tick_ovf(void) { * descending order, even if the internal counter used is an ascending one. * @return the value of the alternative hardware timer. */ -uint32_t os_tick_val(void) { - uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); +uint32_t os_tick_val(void) +{ + uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); uint32_t next_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); // do not use os_tick_ovf because its counter value can be different - if(is_in_wrapped_range(previous_tick_cc_value, next_tick_cc_value, current_counter)) { - if (next_tick_cc_value > previous_tick_cc_value) { + if (is_in_wrapped_range(previous_tick_cc_value, next_tick_cc_value, current_counter)) + { + if (next_tick_cc_value > previous_tick_cc_value) + { return next_tick_cc_value - current_counter; - } else if(current_counter <= next_tick_cc_value) { + } + else if (current_counter <= next_tick_cc_value) + { return next_tick_cc_value - current_counter; - } else { + } + else + { return next_tick_cc_value + (MAX_RTC_COUNTER_VAL - current_counter); } - } else { + } + else + { // use (os_trv + 1) has the base step, can be totally inacurate ... uint32_t clock_cycles_by_tick = os_trv + 1; // if current counter has wrap arround, add the limit to it. - if (current_counter < next_tick_cc_value) { + if (current_counter < next_tick_cc_value) + { current_counter = current_counter + MAX_RTC_COUNTER_VAL; } From 71f302268e5987a9c18ee00d84b0b9e77ec49770 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 3 Mar 2017 10:51:20 +0100 Subject: [PATCH 29/31] [NRF52840] Removed nrf52 targets files form nrf5_sdk13 sources. --- .../TARGET_MCU_NRF52832/PeripheralNames.h | 81 - .../TARGET_MCU_NRF52832/PortNames.h | 53 - .../TARGET_DELTA_DFBM_NQ620/PinNames.h | 202 - .../TARGET_DELTA_DFBM_NQ620/device.h | 38 - .../TARGET_DELTA_DFBM_NQ620/mbed_overrides.c | 21 - .../TARGET_NRF52_DK/PinNames.h | 203 - .../TARGET_NRF52_DK/device.h | 38 - .../TARGET_UBLOX_EVA_NINA/PinNames.h | 106 - .../TARGET_UBLOX_EVA_NINA/device.h | 23 - .../device/TOOLCHAIN_ARM_STD/nRF52832.sct | 27 - .../TOOLCHAIN_ARM_STD/startup_nrf52832.s | 245 - .../device/TOOLCHAIN_ARM_STD/sys.cpp | 31 - .../device/TOOLCHAIN_GCC_ARM/NRF52832.ld | 190 - .../TOOLCHAIN_GCC_ARM/startup_NRF52832.S | 270 - .../device/TOOLCHAIN_IAR/nRF52832.icf | 46 - .../TOOLCHAIN_IAR/startup_NRF52832_IAR.s | 381 - .../TARGET_MCU_NRF52832/device/cmsis.h | 24 - .../TARGET_MCU_NRF52832/device/cmsis_nvic.c | 43 - .../TARGET_MCU_NRF52832/device/cmsis_nvic.h | 53 - .../TARGET_MCU_NRF52832/device/system_nrf52.c | 321 - .../TARGET_MCU_NRF52832/device/system_nrf52.h | 78 - .../sdk/softdevice/s132/headers/ble.h | 689 -- .../sdk/softdevice/s132/headers/ble_err.h | 92 - .../sdk/softdevice/s132/headers/ble_gap.h | 2022 ----- .../sdk/softdevice/s132/headers/ble_gatt.h | 222 - .../sdk/softdevice/s132/headers/ble_gattc.h | 669 -- .../sdk/softdevice/s132/headers/ble_gatts.h | 778 -- .../sdk/softdevice/s132/headers/ble_hci.h | 133 - .../sdk/softdevice/s132/headers/ble_l2cap.h | 204 - .../sdk/softdevice/s132/headers/ble_ranges.h | 140 - .../sdk/softdevice/s132/headers/ble_types.h | 207 - .../softdevice/s132/headers/nrf52/nrf_mbr.h | 219 - .../sdk/softdevice/s132/headers/nrf_error.h | 89 - .../softdevice/s132/headers/nrf_error_sdm.h | 69 - .../softdevice/s132/headers/nrf_error_soc.h | 84 - .../sdk/softdevice/s132/headers/nrf_nvic.h | 521 -- .../sdk/softdevice/s132/headers/nrf_sd_def.h | 58 - .../sdk/softdevice/s132/headers/nrf_sdm.h | 335 - .../sdk/softdevice/s132/headers/nrf_soc.h | 908 -- .../sdk/softdevice/s132/headers/nrf_svc.h | 90 - .../s132_nrf52_5.0.0-1.alpha_softdevice.hex | 8052 ----------------- .../TARGET_NRF5_SDK13/port_api.c | 2 +- 42 files changed, 1 insertion(+), 18056 deletions(-) delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PeripheralNames.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PortNames.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/device.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/device.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/device.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/sys.cpp delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.c delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_err.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gap.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatt.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gattc.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatts.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_hci.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_l2cap.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_ranges.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_types.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h delete mode 100644 targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_5.0.0-1.alpha_softdevice.hex diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PeripheralNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PeripheralNames.h deleted file mode 100644 index 0fe6da592e..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PeripheralNames.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef MBED_PERIPHERALNAMES_H -#define MBED_PERIPHERALNAMES_H - -#include "cmsis.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define STDIO_UART_TX TX_PIN_NUMBER -#define STDIO_UART_RX RX_PIN_NUMBER -#define STDIO_UART UART_0 - -typedef enum { - UART_0 = (int)NRF_UART0_BASE -} UARTName; - - -typedef enum { - SPI_0 = (int)NRF_SPI0_BASE, - SPI_1 = (int)NRF_SPI1_BASE, - SPIS = (int)NRF_SPIS1_BASE -} SPIName; - -typedef enum { - PWM_1 = 0, - PWM_2 -} PWMName; - -typedef enum { - I2C_0 = (int)NRF_TWI0_BASE, - I2C_1 = (int)NRF_TWI1_BASE -} I2CName; - -typedef enum { - ADC0_0 = (int)0 -} ADCName; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PortNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PortNames.h deleted file mode 100644 index c63624639b..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/PortNames.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef MBED_PORTNAMES_H -#define MBED_PORTNAMES_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - Port0 = 0 //GPIO pins 0-31 -} PortName; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h deleted file mode 100644 index c9cb931707..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef MBED_PINNAMES_H -#define MBED_PINNAMES_H - -#include "cmsis.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - -#define PORT_SHIFT 3 - -typedef enum { - p0 = 0, - p1 = 1, - p2 = 2, - p3 = 3, - p4 = 4, - p5 = 5, - p6 = 6, - p7 = 7, - p8 = 8, - p9 = 9, - p10 = 10, - p11 = 11, - p12 = 12, - p13 = 13, - p14 = 14, - p15 = 15, - p16 = 16, - p17 = 17, - p18 = 18, - p19 = 19, - p20 = 20, - p21 = 21, - p22 = 22, - p23 = 23, - p24 = 24, - p25 = 25, - p26 = 26, - p27 = 27, - p28 = 28, - p29 = 29, - p30 = 30, - p31 = 31, - - P0_0 = p0, - P0_1 = p1, - P0_2 = p2, - P0_3 = p3, - P0_4 = p4, - P0_5 = p5, - P0_6 = p6, - P0_7 = p7, - - P0_8 = p8, - P0_9 = p9, - P0_10 = p10, - P0_11 = p11, - P0_12 = p12, - P0_13 = p13, - P0_14 = p14, - P0_15 = p15, - - P0_16 = p16, - P0_17 = p17, - P0_18 = p18, - P0_19 = p19, - P0_20 = p20, - P0_21 = p21, - P0_22 = p22, - P0_23 = p23, - - P0_24 = p24, - P0_25 = p25, - P0_26 = p26, - P0_27 = p27, - P0_28 = p28, - P0_29 = p29, - P0_30 = p30, - - LED1 = p17, - LED2 = p18, - LED3 = p19, - LED4 = p20, - - BUTTON1 = p13, - BUTTON2 = p14, - BUTTON3 = p15, - BUTTON4 = p16, - - RX_PIN_NUMBER = p11, - TX_PIN_NUMBER = p12, - CTS_PIN_NUMBER = p13, - RTS_PIN_NUMBER = p14, - - // mBed interface Pins - USBTX = TX_PIN_NUMBER, - USBRX = RX_PIN_NUMBER, - - SPI_PSELMOSI0 = p23, - SPI_PSELMISO0 = p24, - SPI_PSELSS0 = p22, - SPI_PSELSCK0 = p25, - - SPI_PSELMOSI1 = p12, - SPI_PSELMISO1 = p13, - SPI_PSELSS1 = p11, - SPI_PSELSCK1 = p14, - - SPIS_PSELMOSI = p12, - SPIS_PSELMISO = p13, - SPIS_PSELSS = p11, - SPIS_PSELSCK = p14, - - I2C_SDA0 = p26, - I2C_SCL0 = p27, - - D0 = p11, - D1 = p12, - D2 = p13, - D3 = p14, - D4 = p15, - D5 = p16, - D6 = p17, - D7 = p18, - - D8 = p19, - D9 = p20, - D10 = p22, - D11 = p23, - D12 = p24, - D13 = p25, - - D14 = p26, - D15 = p27, - - A0 = p3, - A1 = p4, - A2 = p28, - A3 = p29, - A4 = p30, - A5 = p31, - - // Not connected - NC = (int)0xFFFFFFFF -} PinName; - -typedef enum { - PullNone = 0, - PullDown = 1, - PullUp = 3, - PullDefault = PullUp -} PinMode; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/device.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/device.h deleted file mode 100644 index 2427e752ea..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/device.h +++ /dev/null @@ -1,38 +0,0 @@ -// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches. -// Check the 'features' section of the target description in 'targets.json' for more details. -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MBED_DEVICE_H -#define MBED_DEVICE_H - - - - - - - - - - - - - - - - -#include "objects.h" - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c deleted file mode 100644 index b1ff3e2fde..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c +++ /dev/null @@ -1,21 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2016 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -void mbed_sdk_init() -{ - printf("", __TIME__, __DATE__); - -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h deleted file mode 100644 index 2b86eca485..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2016 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef MBED_PINNAMES_H -#define MBED_PINNAMES_H - -#include "cmsis.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - -#define PORT_SHIFT 3 - -typedef enum { - p0 = 0, - p1 = 1, - p2 = 2, - p3 = 3, - p4 = 4, - p5 = 5, - p6 = 6, - p7 = 7, - p8 = 8, - p9 = 9, - p10 = 10, - p11 = 11, - p12 = 12, - p13 = 13, - p14 = 14, - p15 = 15, - p16 = 16, - p17 = 17, - p18 = 18, - p19 = 19, - p20 = 20, - p21 = 21, - p22 = 22, - p23 = 23, - p24 = 24, - p25 = 25, - p26 = 26, - p27 = 27, - p28 = 28, - p29 = 29, - p30 = 30, - p31 = 31, - - P0_0 = p0, - P0_1 = p1, - P0_2 = p2, - P0_3 = p3, - P0_4 = p4, - P0_5 = p5, - P0_6 = p6, - P0_7 = p7, - - P0_8 = p8, - P0_9 = p9, - P0_10 = p10, - P0_11 = p11, - P0_12 = p12, - P0_13 = p13, - P0_14 = p14, - P0_15 = p15, - - P0_16 = p16, - P0_17 = p17, - P0_18 = p18, - P0_19 = p19, - P0_20 = p20, - P0_21 = p21, - P0_22 = p22, - P0_23 = p23, - - P0_24 = p24, - P0_25 = p25, - P0_26 = p26, - P0_27 = p27, - P0_28 = p28, - P0_29 = p29, - P0_30 = p30, - P0_31 = p31, - - LED1 = p17, - LED2 = p18, - LED3 = p19, - LED4 = p20, - - BUTTON1 = p13, - BUTTON2 = p14, - BUTTON3 = p15, - BUTTON4 = p16, - - RX_PIN_NUMBER = p8, - TX_PIN_NUMBER = p6, - CTS_PIN_NUMBER = p7, - RTS_PIN_NUMBER = p5, - - // mBed interface Pins - USBTX = TX_PIN_NUMBER, - USBRX = RX_PIN_NUMBER, - - SPI_PSELMOSI0 = p23, - SPI_PSELMISO0 = p24, - SPI_PSELSS0 = p22, - SPI_PSELSCK0 = p25, - - SPI_PSELMOSI1 = p12, - SPI_PSELMISO1 = p13, - SPI_PSELSS1 = p11, - SPI_PSELSCK1 = p14, - - SPIS_PSELMOSI = p12, - SPIS_PSELMISO = p13, - SPIS_PSELSS = p11, - SPIS_PSELSCK = p14, - - I2C_SDA0 = p26, - I2C_SCL0 = p27, - - D0 = p11, - D1 = p12, - D2 = p13, - D3 = p14, - D4 = p15, - D5 = p16, - D6 = p17, - D7 = p18, - - D8 = p19, - D9 = p20, - D10 = p22, - D11 = p23, - D12 = p24, - D13 = p25, - - D14 = p26, - D15 = p27, - - A0 = p3, - A1 = p4, - A2 = p28, - A3 = p29, - A4 = p30, - A5 = p31, - - // Not connected - NC = (int)0xFFFFFFFF -} PinName; - -typedef enum { - PullNone = 0, - PullDown = 1, - PullUp = 3, - PullDefault = PullUp -} PinMode; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/device.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/device.h deleted file mode 100644 index 2427e752ea..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_NRF52_DK/device.h +++ /dev/null @@ -1,38 +0,0 @@ -// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches. -// Check the 'features' section of the target description in 'targets.json' for more details. -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MBED_DEVICE_H -#define MBED_DEVICE_H - - - - - - - - - - - - - - - - -#include "objects.h" - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h deleted file mode 100644 index e29473888f..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef MBED_PINNAMES_H -#define MBED_PINNAMES_H - -#include "cmsis.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - -#define PORT_SHIFT 3 - -typedef enum { - // nRF52 pin names - p0 = 0, - p1 = 1, - p2 = 2, - p3 = 3, - p4 = 4, - p5 = 5, - p6 = 6, - p7 = 7, - p8 = 8, - p9 = 9, - p10 = 10, - p11 = 11, - p12 = 12, - p13 = 13, - p14 = 14, - p15 = 15, - p16 = 16, - p17 = 17, - p18 = 18, - p19 = 19, - p20 = 20, - p21 = 21, - p22 = 22, - p23 = 23, - p24 = 24, - p25 = 25, - p26 = 26, - p27 = 27, - p28 = 28, - p29 = 29, - p30 = 30, - p31 = 31, - NC = (int)0xFFFFFFFF, // Not connected - - //NINA-B1 module pin names - NINA_B1_GPIO_1 = p8, - NINA_B1_GPIO_2 = p11, - NINA_B1_GPIO_3 = p12, - NINA_B1_GPIO_4 = p13, - NINA_B1_GPIO_5 = p14, - NINA_B1_GPIO_7 = p16, - NINA_B1_GPIO_8 = p18, - - NINA_B1_GPIO_16 = p28, - NINA_B1_GPIO_17 = p29, - NINA_B1_GPIO_18 = p30, - - NINA_B1_GPIO_20 = p31, - NINA_B1_GPIO_21 = p7, - NINA_B1_GPIO_22 = p6, - NINA_B1_GPIO_23 = p5, - NINA_B1_GPIO_24 = p2, - NINA_B1_GPIO_25 = p3, - NINA_B1_GPIO_27 = p4, - NINA_B1_GPIO_28 = p9, - NINA_B1_GPIO_29 = p10, - - // Board pins - LED1 = NINA_B1_GPIO_7, // ORANGE - LED2 = NC, - LED3 = NC, - LED4 = NC, - - // Nordic SDK pin names - RX_PIN_NUMBER = p5, - TX_PIN_NUMBER = p6, - CTS_PIN_NUMBER = p7, - RTS_PIN_NUMBER = p31, - I2C_SDA0 = p2, - I2C_SCL0 = p3, - - // mBed interface pins - USBTX = TX_PIN_NUMBER, - USBRX = RX_PIN_NUMBER -} PinName; - -typedef enum { - PullNone = 0, - PullDown = 1, - PullUp = 3, - PullDefault = PullUp -} PinMode; - -#ifdef __cplusplus -} - -#endif -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/device.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/device.h deleted file mode 100644 index 493844b801..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/device.h +++ /dev/null @@ -1,23 +0,0 @@ -// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches. -// Check the 'features' section of the target description in 'targets.json' for more details. -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MBED_DEVICE_H -#define MBED_DEVICE_H - -#include "objects.h" - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct deleted file mode 100644 index 3bb13ec74a..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct +++ /dev/null @@ -1,27 +0,0 @@ -;WITHOUT SOFTDEVICE: -;LR_IROM1 0x00000000 0x00040000 { -; ER_IROM1 0x00000000 0x00040000 { -; *.o (RESET, +First) -; *(InRoot$$Sections) -; .ANY (+RO) -; } -; RW_IRAM1 0x20000000 0x00004000 { -; .ANY (+RW +ZI) -; } -;} -; -;WITH SOFTDEVICE: - -LR_IROM1 0x1C000 0x0064000 { - ER_IROM1 0x1C000 0x0064000 { - *.o (RESET, +First) - *(InRoot$$Sections) - .ANY (+RO) - } - RW_IRAM0 0x20002EF8 UNINIT 0x000000D8 { ;no init section - *(noinit) - } - RW_IRAM1 0x20002FD0 0x0000D030 { - .ANY (+RW +ZI) - } -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s deleted file mode 100644 index aac3e2c28f..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/startup_nrf52832.s +++ /dev/null @@ -1,245 +0,0 @@ -;/* Copyright (c) 2012 ARM LIMITED -; -; All rights reserved. -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; - Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; - Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; - Neither the name of ARM nor the names of its contributors may be used -; to endorse or promote products derived from this software without -; specific prior written permission. -; * -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE -; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -; POSSIBILITY OF SUCH DAMAGE. -; ---------------------------------------------------------------------------*/ - -__initial_sp EQU 0x20010000 - - PRESERVE8 - THUMB - -; Vector Table Mapped to Address 0 at Reset - - AREA RESET, DATA, READONLY - EXPORT __Vectors - EXPORT __Vectors_End - EXPORT __Vectors_Size - -__Vectors DCD __initial_sp ; Top of Stack - DCD Reset_Handler - DCD NMI_Handler - DCD HardFault_Handler - DCD MemoryManagement_Handler - DCD BusFault_Handler - DCD UsageFault_Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD SVC_Handler - DCD DebugMonitor_Handler - DCD 0 ; Reserved - DCD PendSV_Handler - DCD SysTick_Handler - - ; External Interrupts - DCD POWER_CLOCK_IRQHandler - DCD RADIO_IRQHandler - DCD UARTE0_UART0_IRQHandler_v - DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v - DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v - DCD NFCT_IRQHandler_v - DCD GPIOTE_IRQHandler_v - DCD SAADC_IRQHandler_v - DCD TIMER0_IRQHandler_v - DCD TIMER1_IRQHandler_v - DCD TIMER2_IRQHandler_v - DCD RTC0_IRQHandler - DCD TEMP_IRQHandler_v - DCD RNG_IRQHandler - DCD ECB_IRQHandler - DCD CCM_AAR_IRQHandler - DCD WDT_IRQHandler_v - DCD RTC1_IRQHandler_v - DCD QDEC_IRQHandler_v - DCD COMP_LPCOMP_IRQHandler_v - DCD SWI0_EGU0_IRQHandler_v - DCD SWI1_EGU1_IRQHandler_v - DCD SWI2_EGU2_IRQHandler_v - DCD SWI3_EGU3_IRQHandler_v - DCD SWI4_EGU4_IRQHandler - DCD SWI5_EGU5_IRQHandler - DCD TIMER3_IRQHandler_v - DCD TIMER4_IRQHandler_v - DCD PWM0_IRQHandler_v - DCD PDM_IRQHandler_v - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD MWU_IRQHandler - DCD PWM1_IRQHandler_v - DCD PWM2_IRQHandler_v - DCD SPIM2_SPIS2_SPI2_IRQHandler_v - DCD RTC2_IRQHandler_v - DCD I2S_IRQHandler_v - DCD FPU_IRQHandler_v - -__Vectors_End - -__Vectors_Size EQU __Vectors_End - __Vectors - - AREA |.text|, CODE, READONLY - -; Reset Handler - - -Reset_Handler PROC - EXPORT Reset_Handler [WEAK] - IMPORT SystemInit - IMPORT __main - IMPORT nrf_reloc_vector_table - - - LDR R0, =SystemInit - BLX R0 - LDR R0, =nrf_reloc_vector_table - BLX R0 - LDR R0, =__main - BX R0 - ENDP - -; Dummy Exception Handlers (infinite loops which can be modified) - -NMI_Handler PROC - EXPORT NMI_Handler [WEAK] - B . - ENDP -HardFault_Handler\ - PROC - EXPORT HardFault_Handler [WEAK] - B . - ENDP -MemoryManagement_Handler\ - PROC - EXPORT MemoryManagement_Handler [WEAK] - B . - ENDP -BusFault_Handler\ - PROC - EXPORT BusFault_Handler [WEAK] - B . - ENDP -UsageFault_Handler\ - PROC - EXPORT UsageFault_Handler [WEAK] - B . - ENDP -SVC_Handler PROC - EXPORT SVC_Handler [WEAK] - B . - ENDP -DebugMonitor_Handler\ - PROC - EXPORT DebugMonitor_Handler [WEAK] - B . - ENDP -PendSV_Handler PROC - EXPORT PendSV_Handler [WEAK] - B . - ENDP -SysTick_Handler PROC - EXPORT SysTick_Handler [WEAK] - B . - ENDP - -Default_Handler PROC - - EXPORT POWER_CLOCK_IRQHandler [WEAK] - EXPORT RADIO_IRQHandler [WEAK] - EXPORT UARTE0_UART0_IRQHandler_v [WEAK] - EXPORT SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v [WEAK] - EXPORT SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v [WEAK] - EXPORT NFCT_IRQHandler_v [WEAK] - EXPORT GPIOTE_IRQHandler_v [WEAK] - EXPORT SAADC_IRQHandler_v [WEAK] - EXPORT TIMER0_IRQHandler_v [WEAK] - EXPORT TIMER1_IRQHandler_v [WEAK] - EXPORT TIMER2_IRQHandler_v [WEAK] - EXPORT RTC0_IRQHandler [WEAK] - EXPORT TEMP_IRQHandler_v [WEAK] - EXPORT RNG_IRQHandler [WEAK] - EXPORT ECB_IRQHandler [WEAK] - EXPORT CCM_AAR_IRQHandler [WEAK] - EXPORT WDT_IRQHandler_v [WEAK] - EXPORT RTC1_IRQHandler_v [WEAK] - EXPORT QDEC_IRQHandler_v [WEAK] - EXPORT COMP_LPCOMP_IRQHandler_v [WEAK] - EXPORT SWI0_EGU0_IRQHandler_v [WEAK] - EXPORT SWI1_EGU1_IRQHandler_v [WEAK] - EXPORT SWI2_EGU2_IRQHandler_v [WEAK] - EXPORT SWI3_EGU3_IRQHandler_v [WEAK] - EXPORT SWI4_EGU4_IRQHandler [WEAK] - EXPORT SWI5_EGU5_IRQHandler [WEAK] - EXPORT TIMER3_IRQHandler_v [WEAK] - EXPORT TIMER4_IRQHandler_v [WEAK] - EXPORT PWM0_IRQHandler_v [WEAK] - EXPORT PDM_IRQHandler_v [WEAK] - EXPORT MWU_IRQHandler [WEAK] - EXPORT PWM1_IRQHandler_v [WEAK] - EXPORT PWM2_IRQHandler_v [WEAK] - EXPORT SPIM2_SPIS2_SPI2_IRQHandler_v [WEAK] - EXPORT RTC2_IRQHandler_v [WEAK] - EXPORT I2S_IRQHandler_v [WEAK] - EXPORT FPU_IRQHandler_v [WEAK] -POWER_CLOCK_IRQHandler -RADIO_IRQHandler -UARTE0_UART0_IRQHandler_v -SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v -SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v -NFCT_IRQHandler_v -GPIOTE_IRQHandler_v -SAADC_IRQHandler_v -TIMER0_IRQHandler_v -TIMER1_IRQHandler_v -TIMER2_IRQHandler_v -RTC0_IRQHandler -TEMP_IRQHandler_v -RNG_IRQHandler -ECB_IRQHandler -CCM_AAR_IRQHandler -WDT_IRQHandler_v -RTC1_IRQHandler_v -QDEC_IRQHandler_v -COMP_LPCOMP_IRQHandler_v -SWI0_EGU0_IRQHandler_v -SWI1_EGU1_IRQHandler_v -SWI2_EGU2_IRQHandler_v -SWI3_EGU3_IRQHandler_v -SWI4_EGU4_IRQHandler -SWI5_EGU5_IRQHandler -TIMER3_IRQHandler_v -TIMER4_IRQHandler_v -PWM0_IRQHandler_v -PDM_IRQHandler_v -MWU_IRQHandler -PWM1_IRQHandler_v -PWM2_IRQHandler_v -SPIM2_SPIS2_SPI2_IRQHandler_v -RTC2_IRQHandler_v -I2S_IRQHandler_v -FPU_IRQHandler_v - B . - ENDP - ALIGN - END diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/sys.cpp b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/sys.cpp deleted file mode 100644 index 2f1024ace8..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/sys.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Copyright (C) 2009-2011 ARM Limited. All rights reserved. - * - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld deleted file mode 100644 index d049cd8818..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Linker script to configure memory regions. */ - -MEMORY -{ - FLASH (rx) : ORIGIN = 0x1C000, LENGTH = 0x64000 - RAM (rwx) : ORIGIN = 0x20002ef8, LENGTH = 0xd108 -} - - -OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") - -/* Linker script to place sections and symbol values. Should be used together - * with the other linker script that defines memory regions FLASH and RAM. - * It references the following symbols that must be defined in code: - * Reset_Handler : Entry of reset handler - * - * It defines the following symbols that the code can use without definition: - * __exidx_start - * __exidx_end - * __etext - * __data_start__ - * __preinit_array_start - * __preinit_array_end - * __init_array_start - * __init_array_end - * __fini_array_start - * __fini_array_end - * __data_end__ - * __bss_start__ - * __bss_end__ - * __end__ - * end - * __HeapLimit - * __StackLimit - * __StackTop - * __stack - */ -ENTRY(Reset_Handler) - - -SECTIONS -{ - .text : - { - KEEP(*(.Vectors)) - *(.text*) - - KEEP(*(.init)) - KEEP(*(.fini)) - - /* .ctors */ - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - - /* .dtors */ - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) - *(SORT(.dtors.*)) - *(.dtors) - - *(.rodata*) - - KEEP(*(.eh_frame*)) - } > FLASH - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - . = ALIGN(4); - } > FLASH - - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - . = ALIGN(4); - } > FLASH - __exidx_end = .; - - __etext = .; - - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - - . = ALIGN(4); - /* init data */ - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - - - . = ALIGN(4); - /* finit data */ - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - - . = ALIGN(4); - PROVIDE(__start_fs_data = .); - KEEP(*(.fs_data)) - PROVIDE(__stop_fs_data = .); - - *(.jcr) - . = ALIGN(4); - /* All data end */ - __data_end__ = .; - - } > RAM - - __edata = .; - - .noinit : - { - PROVIDE(__start_noinit = .); - KEEP(*(.noinit)) - PROVIDE(__stop_noinit = .); - } > RAM - - .bss : - { - . = ALIGN(4); - __bss_start__ = .; - *(.bss*) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - } > RAM - - .heap (NOLOAD): - { - __end__ = .; - end = __end__; - *(.heap*); - - /* Expand the heap to reach the stack boundary. */ - ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - 0x800), "heap region overflowed into stack"); - . += (ORIGIN(RAM) + LENGTH(RAM) - 0x800) - .; - } > RAM - PROVIDE(__heap_start = ADDR(.heap)); - PROVIDE(__heap_size = SIZEOF(.heap)); - PROVIDE(__mbed_sbrk_start = ADDR(.heap)); - PROVIDE(__mbed_krbs_start = ADDR(.heap) + SIZEOF(.heap)); - - /* .stack_dummy section does not contain any symbols. It is only - * used for the linker script to calculate the size of stack sections - * and assign values to stack symbols later. */ - .stack (NOLOAD): - { - __StackLimit = .; - *(.stack*) - . += (ORIGIN(RAM) + LENGTH(RAM) - .); - } > RAM - - /* Set the stack top to the end of RAM and move down the stack limit by - * the size of the stack_dummy section. */ - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack); - PROVIDE(__stack = __StackTop); -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S deleted file mode 100644 index 1c6631e7dd..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2013 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/* -NOTE: Template files (including this one) are application specific and therefore -expected to be copied into the application project folder prior to its use! -*/ - - .syntax unified - .arch armv7e-m - - .section .Vectors - .align 2 - .globl __Vectors -__Vectors: - .long __StackTop /* Top of Stack */ - .long Reset_Handler - .long NMI_Handler - .long HardFault_Handler - .long MemoryManagement_Handler - .long BusFault_Handler - .long UsageFault_Handler - .long 0 /*Reserved */ - .long 0 /*Reserved */ - .long 0 /*Reserved */ - .long 0 /*Reserved */ - .long SVC_Handler - .long 0 /*Reserved */ - .long 0 /*Reserved */ - .long PendSV_Handler - .long SysTick_Handler - - /* External Interrupts */ - .long POWER_CLOCK_IRQHandler - .long RADIO_IRQHandler - .long UARTE0_UART0_IRQHandler_v - .long SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v - .long SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v - .long NFCT_IRQHandler_v - .long GPIOTE_IRQHandler_v - .long SAADC_IRQHandler_v - .long TIMER0_IRQHandler_v - .long TIMER1_IRQHandler_v - .long TIMER2_IRQHandler_v - .long RTC0_IRQHandler - .long TEMP_IRQHandler_v - .long RNG_IRQHandler - .long ECB_IRQHandler - .long CCM_AAR_IRQHandler - .long WDT_IRQHandler_v - .long RTC1_IRQHandler_v - .long QDEC_IRQHandler_v - .long COMP_LPCOMP_IRQHandler_v - .long SWI0_EGU0_IRQHandler_v - .long SWI1_EGU1_IRQHandler_v - .long SWI2_EGU2_IRQHandler_v - .long SWI3_EGU3_IRQHandler_v - .long SWI4_EGU4_IRQHandler - .long SWI5_EGU5_IRQHandler - .long TIMER3_IRQHandler_v - .long TIMER4_IRQHandler_v - .long PWM0_IRQHandler_v - .long PDM_IRQHandler_v - .long 0 /*Reserved */ - .long 0 /*Reserved */ - .long MWU_IRQHandler - .long PWM1_IRQHandler_v - .long PWM2_IRQHandler_v - .long SPIM2_SPIS2_SPI2_IRQHandler_v - .long RTC2_IRQHandler_v - .long I2S_IRQHandler_v - .long FPU_IRQHandler_v - - - .size __Vectors, . - __Vectors - -/* Reset Handler */ - - .text - .thumb - .thumb_func - .align 1 - .globl Reset_Handler - .type Reset_Handler, %function -Reset_Handler: - .fnstart - - -/* Loop to copy data from read only memory to RAM. The ranges - * of copy from/to are specified by following symbols evaluated in - * linker script. - * __etext: End of code section, i.e., begin of data sections to copy from. - * __data_start__/__data_end__: RAM address range that data should be - * copied to. Both must be aligned to 4 bytes boundary. */ - - ldr r1, =__etext - ldr r2, =__data_start__ - ldr r3, =__data_end__ - - subs r3, r2 - ble .LC0 - -.LC1: - subs r3, 4 - ldr r0, [r1,r3] - str r0, [r2,r3] - bgt .LC1 -.LC0: - - LDR R0, =SystemInit - BLX R0 - LDR R0, =nrf_reloc_vector_table - BLX R0 - LDR R0, =_start - BX R0 - - .pool - .cantunwind - .fnend - .size Reset_Handler,.-Reset_Handler - - .section ".text" - - -/* Dummy Exception Handlers (infinite loops which can be modified) */ - - .weak NMI_Handler - .type NMI_Handler, %function -NMI_Handler: - B . - .size NMI_Handler, . - NMI_Handler - - - .weak HardFault_Handler - .type HardFault_Handler, %function -HardFault_Handler: - B . - .size HardFault_Handler, . - HardFault_Handler - - - .weak MemoryManagement_Handler - .type MemoryManagement_Handler, %function -MemoryManagement_Handler: - B . - .size MemoryManagement_Handler, . - MemoryManagement_Handler - - - .weak BusFault_Handler - .type BusFault_Handler, %function -BusFault_Handler: - B . - .size BusFault_Handler, . - BusFault_Handler - - - .weak UsageFault_Handler - .type UsageFault_Handler, %function -UsageFault_Handler: - B . - .size UsageFault_Handler, . - UsageFault_Handler - - - .weak SVC_Handler - .type SVC_Handler, %function -SVC_Handler: - B . - .size SVC_Handler, . - SVC_Handler - - - .weak PendSV_Handler - .type PendSV_Handler, %function -PendSV_Handler: - B . - .size PendSV_Handler, . - PendSV_Handler - - - .weak SysTick_Handler - .type SysTick_Handler, %function -SysTick_Handler: - B . - .size SysTick_Handler, . - SysTick_Handler - - -/* IRQ Handlers */ - - .globl Default_Handler - .type Default_Handler, %function -Default_Handler: - B . - .size Default_Handler, . - Default_Handler - - .macro IRQ handler - .weak \handler - .set \handler, Default_Handler - .endm - - IRQ POWER_CLOCK_IRQHandler /* restricted */ - IRQ RADIO_IRQHandler /* blocked */ - IRQ UARTE0_UART0_IRQHandler_v - IRQ SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v - IRQ SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v - IRQ NFCT_IRQHandler_v - IRQ GPIOTE_IRQHandler_v - IRQ SAADC_IRQHandler_v - IRQ TIMER0_IRQHandler_v - IRQ TIMER1_IRQHandler_v - IRQ TIMER2_IRQHandler_v - IRQ RTC0_IRQHandler /* blocked */ - IRQ TEMP_IRQHandler_v - IRQ RNG_IRQHandler /* restricted */ - IRQ ECB_IRQHandler /* restricted */ - IRQ CCM_AAR_IRQHandler /* blocked */ - IRQ WDT_IRQHandler_v - IRQ RTC1_IRQHandler_v - IRQ QDEC_IRQHandler_v - IRQ COMP_LPCOMP_IRQHandler_v - IRQ SWI0_EGU0_IRQHandler_v - IRQ SWI1_EGU1_IRQHandler_v /* restricted for Radio Notification */ - IRQ SWI2_EGU2_IRQHandler_v /* blocked for SoftDevice Event */ - IRQ SWI3_EGU3_IRQHandler_v - IRQ SWI4_EGU4_IRQHandler /* blocked */ - IRQ SWI5_EGU5_IRQHandler /* blocked */ - IRQ TIMER3_IRQHandler_v - IRQ TIMER4_IRQHandler_v - IRQ PWM0_IRQHandler_v - IRQ PDM_IRQHandler_v - IRQ MWU_IRQHandler /* restricted */ - IRQ PWM1_IRQHandler_v - IRQ PWM2_IRQHandler_v - IRQ SPIM2_SPIS2_SPI2_IRQHandler_v - IRQ RTC2_IRQHandler_v - IRQ I2S_IRQHandler_v - IRQ FPU_IRQHandler_v - - .end diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf deleted file mode 100644 index d8dee15e57..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf +++ /dev/null @@ -1,46 +0,0 @@ -/*###ICF### Section handled by ICF editor, don't touch! ****/ -/*-Editor annotation file-*/ -/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ -/*-Specials-*/ -define symbol __ICFEDIT_intvec_start__ = 0x1c000; -/*-Memory Regions-*/ -define symbol __ICFEDIT_region_ROM_start__ = 0x1c000; -define symbol __ICFEDIT_region_ROM_end__ = 0x7ffff; -define symbol __ICFEDIT_region_RAM_start__ = 0x20002ef8; -define symbol __ICFEDIT_region_RAM_end__ = 0x2000ffff; -export symbol __ICFEDIT_region_RAM_start__; -export symbol __ICFEDIT_region_RAM_end__; -/*-Sizes-*/ -/*Heap 1/4 of ram and stack 1/8*/ -define symbol __ICFEDIT_size_cstack__ = 0x800; -define symbol __ICFEDIT_size_heap__ = 0x1800; -/**** End of ICF editor section. ###ICF###*/ - -define symbol __code_start_soft_device__ = 0x0; - -define memory mem with size = 4G; -define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; -define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; - -define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; -define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; - -initialize by copy { readwrite }; -do not initialize { section .noinit }; - -keep { section .intvec }; -place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; -place in ROM_region { readonly }; -place in RAM_region { readwrite, - block HEAP, - block CSTACK }; - -/*This is used for mbed applications build inside the Embedded workbench -Applications build with the python scritps use a hex merge so need to merge it -inside the linker. The linker can only use binary files so the hex merge is not possible -through the linker. That is why a binary is used instead of a hex image for the embedded project. -*/ -if(isdefinedsymbol(SOFT_DEVICE_BIN)) -{ - place at address mem:__code_start_soft_device__ { section .noinit_softdevice }; -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s deleted file mode 100644 index b27d189e7d..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s +++ /dev/null @@ -1,381 +0,0 @@ -;/* Copyright (c) 2012 ARM LIMITED -; -; All rights reserved. -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; - Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; - Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; - Neither the name of ARM nor the names of its contributors may be used -; to endorse or promote products derived from this software without -; specific prior written permission. -; * -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE -; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -; POSSIBILITY OF SUCH DAMAGE. -; ---------------------------------------------------------------------------*/ - - -; The modules in this file are included in the libraries, and may be replaced -; by any user-defined modules that define the PUBLIC symbol _program_start or -; a user defined start symbol. -; To override the cstartup defined in the library, simply add your modified -; version to the workbench project. -; -; The vector table is normally located at address 0. -; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. -; The name "__vector_table" has special meaning for C-SPY: -; it is where the SP start value is found, and the NVIC vector -; table register (VTOR) is initialized to this address if != 0. - - - - MODULE ?cstartup - - ;; Stack size default : Defined in *.icf (linker file). Can be modified inside EW. - ;; Heap size default : Defined in *.icf (linker file). Can be modified inside EW. - - ;; Forward declaration of sections. - SECTION CSTACK:DATA:NOROOT(3) - - SECTION .intvec:CODE:NOROOT(2) - - EXTERN __iar_program_start - EXTERN SystemInit - EXTERN nrf_reloc_vector_table - PUBLIC __vector_table - PUBLIC __Vectors - PUBLIC __Vectors_End - PUBLIC __Vectors_Size - - DATA - -__vector_table - DCD sfe(CSTACK) - DCD Reset_Handler - DCD NMI_Handler - DCD HardFault_Handler - DCD MemoryManagement_Handler - DCD BusFault_Handler - DCD UsageFault_Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD SVC_Handler - DCD DebugMonitor_Handler - DCD 0 ; Reserved - DCD PendSV_Handler - DCD SysTick_Handler - - ; External Interrupts - DCD POWER_CLOCK_IRQHandler - DCD RADIO_IRQHandler - DCD UARTE0_UART0_IRQHandler_v - DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v - DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v - DCD NFCT_IRQHandler_v - DCD GPIOTE_IRQHandler_v - DCD SAADC_IRQHandler_v - DCD TIMER0_IRQHandler_v - DCD TIMER1_IRQHandler_v - DCD TIMER2_IRQHandler_v - DCD RTC0_IRQHandler - DCD TEMP_IRQHandler_v - DCD RNG_IRQHandler - DCD ECB_IRQHandler - DCD CCM_AAR_IRQHandler - DCD WDT_IRQHandler_v - DCD RTC1_IRQHandler_v - DCD QDEC_IRQHandler_v - DCD COMP_LPCOMP_IRQHandler_v - DCD SWI0_EGU0_IRQHandler_v - DCD SWI1_EGU1_IRQHandler_v - DCD SWI2_EGU2_IRQHandler_v - DCD SWI3_EGU3_IRQHandler_v - DCD SWI4_EGU4_IRQHandler - DCD SWI5_EGU5_IRQHandler - DCD TIMER3_IRQHandler_v - DCD TIMER4_IRQHandler_v - DCD PWM0_IRQHandler_v - DCD PDM_IRQHandler_v - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD MWU_IRQHandler - DCD PWM1_IRQHandler_v - DCD PWM2_IRQHandler_v - DCD SPIM2_SPIS2_SPI2_IRQHandler_v - DCD RTC2_IRQHandler_v - DCD I2S_IRQHandler_v - DCD FPU_IRQHandler_v - - -__Vectors_End -__Vectors EQU __vector_table -__Vectors_Size EQU __Vectors_End - __Vectors - - -; Default handlers. - THUMB - - PUBWEAK Reset_Handler - SECTION .text:CODE:NOROOT(2) -Reset_Handler - - LDR R0, =SystemInit - BLX R0 - LDR R0, =nrf_reloc_vector_table - BLX R0 - LDR R0, =__iar_program_start - BX R0 - - ; Dummy exception handlers - - - PUBWEAK NMI_Handler - SECTION .text:CODE:NOROOT(1) -NMI_Handler - B . - - PUBWEAK HardFault_Handler - SECTION .text:CODE:NOROOT(1) -HardFault_Handler - B . - - PUBWEAK MemoryManagement_Handler - SECTION .text:CODE:NOROOT(1) -MemoryManagement_Handler - B . - - PUBWEAK BusFault_Handler - SECTION .text:CODE:NOROOT(1) -BusFault_Handler - B . - - PUBWEAK UsageFault_Handler - SECTION .text:CODE:NOROOT(1) -UsageFault_Handler - B . - - PUBWEAK SVC_Handler - SECTION .text:CODE:NOROOT(1) -SVC_Handler - B . - - PUBWEAK DebugMonitor_Handler - SECTION .text:CODE:NOROOT(1) -DebugMonitor_Handler - B . - - PUBWEAK PendSV_Handler - SECTION .text:CODE:NOROOT(1) -PendSV_Handler - B . - - PUBWEAK SysTick_Handler - SECTION .text:CODE:NOROOT(1) -SysTick_Handler - B . - - - ; Dummy interrupt handlers - - PUBWEAK POWER_CLOCK_IRQHandler - SECTION .text:CODE:NOROOT(1) -POWER_CLOCK_IRQHandler - B . - - PUBWEAK RADIO_IRQHandler - SECTION .text:CODE:NOROOT(1) -RADIO_IRQHandler - B . - - PUBWEAK UARTE0_UART0_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -UARTE0_UART0_IRQHandler_v - B . - - PUBWEAK SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler_v - B . - - PUBWEAK SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler_v - B . - - PUBWEAK NFCT_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -NFCT_IRQHandler_v - B . - - PUBWEAK GPIOTE_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -GPIOTE_IRQHandler_v - B . - - PUBWEAK SAADC_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -SAADC_IRQHandler_v - B . - - PUBWEAK TIMER0_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -TIMER0_IRQHandler_v - B . - - PUBWEAK TIMER1_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -TIMER1_IRQHandler_v - B . - - PUBWEAK TIMER2_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -TIMER2_IRQHandler_v - B . - - PUBWEAK RTC0_IRQHandler - SECTION .text:CODE:NOROOT(1) -RTC0_IRQHandler - B . - - PUBWEAK TEMP_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -TEMP_IRQHandler_v - B . - - PUBWEAK RNG_IRQHandler - SECTION .text:CODE:NOROOT(1) -RNG_IRQHandler - B . - - PUBWEAK ECB_IRQHandler - SECTION .text:CODE:NOROOT(1) -ECB_IRQHandler - B . - - PUBWEAK CCM_AAR_IRQHandler - SECTION .text:CODE:NOROOT(1) -CCM_AAR_IRQHandler - B . - - PUBWEAK WDT_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -WDT_IRQHandler_v - B . - - PUBWEAK RTC1_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -RTC1_IRQHandler_v - B . - - PUBWEAK QDEC_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -QDEC_IRQHandler_v - B . - - PUBWEAK COMP_LPCOMP_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -COMP_LPCOMP_IRQHandler_v - B . - - PUBWEAK SWI0_EGU0_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -SWI0_EGU0_IRQHandler_v - B . - - PUBWEAK SWI1_EGU1_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -SWI1_EGU1_IRQHandler_v - B . - - PUBWEAK SWI2_EGU2_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -SWI2_EGU2_IRQHandler_v - B . - - PUBWEAK SWI3_EGU3_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -SWI3_EGU3_IRQHandler_v - B . - - PUBWEAK SWI4_EGU4_IRQHandler - SECTION .text:CODE:NOROOT(1) -SWI4_EGU4_IRQHandler - B . - - PUBWEAK SWI5_EGU5_IRQHandler - SECTION .text:CODE:NOROOT(1) -SWI5_EGU5_IRQHandler - B . - - PUBWEAK TIMER3_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -TIMER3_IRQHandler_v - B . - - PUBWEAK TIMER4_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -TIMER4_IRQHandler_v - B . - - PUBWEAK PWM0_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -PWM0_IRQHandler_v - B . - - PUBWEAK PDM_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -PDM_IRQHandler_v - B . - - PUBWEAK MWU_IRQHandler - SECTION .text:CODE:NOROOT(1) -MWU_IRQHandler - B . - - PUBWEAK PWM1_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -PWM1_IRQHandler_v - B . - - PUBWEAK PWM2_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -PWM2_IRQHandler_v - B . - - PUBWEAK SPIM2_SPIS2_SPI2_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -SPIM2_SPIS2_SPI2_IRQHandler_v - B . - - PUBWEAK RTC2_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -RTC2_IRQHandler_v - B . - - PUBWEAK I2S_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -I2S_IRQHandler_v - B . - - PUBWEAK FPU_IRQHandler_v - SECTION .text:CODE:NOROOT(1) -FPU_IRQHandler_v - B . - - - END - - diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis.h deleted file mode 100644 index 214885742d..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * PackageLicenseDeclared: Apache-2.0 - * Copyright (c) 2016 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MBED_CMSIS_H -#define MBED_CMSIS_H - -#include "nrf.h" -#include "cmsis_nvic.h" - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.c deleted file mode 100644 index 2efb6da48c..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.c +++ /dev/null @@ -1,43 +0,0 @@ -/* mbed Microcontroller Library - * CMSIS-style functionality to support dynamic vectors - ******************************************************************************* - * Copyright (c) 2016 ARM Limited. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of ARM Limited nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ -#include "cmsis_nvic.h" - -extern uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS]; - -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) -{ - nrf_dispatch_vector[IRQn + NVIC_USER_IRQ_OFFSET] = vector; -} - -uint32_t NVIC_GetVector(IRQn_Type IRQn) -{ - return nrf_dispatch_vector[IRQn + NVIC_USER_IRQ_OFFSET]; -} diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.h deleted file mode 100644 index 0837075c40..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/cmsis_nvic.h +++ /dev/null @@ -1,53 +0,0 @@ -/* mbed Microcontroller Library - * CMSIS-style functionality to support dynamic vectors - ******************************************************************************* - * Copyright (c) 2016 ARM Limited. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of ARM Limited nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifndef MBED_CMSIS_NVIC_H -#define MBED_CMSIS_NVIC_H - -#define NVIC_NUM_VECTORS (16 + 38) // CORE + MCU Peripherals -#define NVIC_USER_IRQ_OFFSET 16 - -#include "nrf52.h" -#include "cmsis.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.c deleted file mode 100644 index 89d125a37d..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#include -#include -#include "nrf.h" -#include "system_nrf52.h" -#include "nrf5x_lf_clk_helper.h" - -/*lint ++flb "Enter library region" */ - -#define __SYSTEM_CLOCK_64M (64000000UL) - -static bool errata_16(void); -static bool errata_31(void); -static bool errata_32(void); -static bool errata_36(void); -static bool errata_37(void); -static bool errata_57(void); -static bool errata_66(void); - - -#if defined ( __CC_ARM ) - uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; -#elif defined ( __ICCARM__ ) - __root uint32_t SystemCoreClock = __SYSTEM_CLOCK_64M; -#elif defined ( __GNUC__ ) - uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M; -#endif - -void SystemCoreClockUpdate(void) -{ - SystemCoreClock = __SYSTEM_CLOCK_64M; -} - -void SystemInit(void) -{ - /* Workaround for Errata 16 "System: RAM may be corrupt on wakeup from CPU IDLE" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_16()){ - *(volatile uint32_t *)0x4007C074 = 3131961357ul; - } - - /* Workaround for Errata 31 "CLOCK: Calibration values are not correctly loaded from FICR at reset" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_31()){ - *(volatile uint32_t *)0x4000053C = ((*(volatile uint32_t *)0x10000244) & 0x0000E000) >> 13; - } - - /* Workaround for Errata 32 "DIF: Debug session automatically enables TracePort pins" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_32()){ - CoreDebug->DEMCR &= ~CoreDebug_DEMCR_TRCENA_Msk; - } - - /* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_36()){ - NRF_CLOCK->EVENTS_DONE = 0; - NRF_CLOCK->EVENTS_CTTO = 0; - NRF_CLOCK->CTIV = 0; - } - - /* Workaround for Errata 37 "RADIO: Encryption engine is slow by default" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_37()){ - *(volatile uint32_t *)0x400005A0 = 0x3; - } - - /* Workaround for Errata 57 "NFCT: NFC Modulation amplitude" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_57()){ - *(volatile uint32_t *)0x40005610 = 0x00000005; - *(volatile uint32_t *)0x40005688 = 0x00000001; - *(volatile uint32_t *)0x40005618 = 0x00000000; - *(volatile uint32_t *)0x40005614 = 0x0000003F; - } - - /* Workaround for Errata 66 "TEMP: Linearity specification not met with default settings" found at the Errata document - for your device located at https://infocenter.nordicsemi.com/ */ - if (errata_66()){ - NRF_TEMP->A0 = NRF_FICR->TEMP.A0; - NRF_TEMP->A1 = NRF_FICR->TEMP.A1; - NRF_TEMP->A2 = NRF_FICR->TEMP.A2; - NRF_TEMP->A3 = NRF_FICR->TEMP.A3; - NRF_TEMP->A4 = NRF_FICR->TEMP.A4; - NRF_TEMP->A5 = NRF_FICR->TEMP.A5; - NRF_TEMP->B0 = NRF_FICR->TEMP.B0; - NRF_TEMP->B1 = NRF_FICR->TEMP.B1; - NRF_TEMP->B2 = NRF_FICR->TEMP.B2; - NRF_TEMP->B3 = NRF_FICR->TEMP.B3; - NRF_TEMP->B4 = NRF_FICR->TEMP.B4; - NRF_TEMP->B5 = NRF_FICR->TEMP.B5; - NRF_TEMP->T0 = NRF_FICR->TEMP.T0; - NRF_TEMP->T1 = NRF_FICR->TEMP.T1; - NRF_TEMP->T2 = NRF_FICR->TEMP.T2; - NRF_TEMP->T3 = NRF_FICR->TEMP.T3; - NRF_TEMP->T4 = NRF_FICR->TEMP.T4; - } - - /* Enable the FPU if the compiler used floating point unit instructions. __FPU_USED is a MACRO defined by the - * compiler. Since the FPU consumes energy, remember to disable FPU use in the compiler if floating point unit - * operations are not used in your code. */ - #if (__FPU_USED == 1) - SCB->CPACR |= (3UL << 20) | (3UL << 22); - __DSB(); - __ISB(); - #endif - - /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined, - two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as - normal GPIOs. */ - #if defined (CONFIG_NFCT_PINS_AS_GPIOS) - if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){ - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NVIC_SystemReset(); - } - #endif - - /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not - defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be - reserved for PinReset and not available as normal GPIO. */ - #if defined (CONFIG_GPIO_AS_PINRESET) - if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) || - ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){ - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_UICR->PSELRESET[0] = 21; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_UICR->PSELRESET[1] = 21; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){} - NVIC_SystemReset(); - } - #endif - - /* Enable SWO trace functionality. If ENABLE_SWO is not defined, SWO pin will be used as GPIO (see Product - Specification to see which one). */ - #if defined (ENABLE_SWO) - CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; - NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos; - NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - #endif - - /* Enable Trace functionality. If ENABLE_TRACE is not defined, TRACE pins will be used as GPIOs (see Product - Specification to see which ones). */ - #if defined (ENABLE_TRACE) - CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; - NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Parallel << CLOCK_TRACECONFIG_TRACEMUX_Pos; - NRF_P0->PIN_CNF[14] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - NRF_P0->PIN_CNF[15] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - NRF_P0->PIN_CNF[16] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - NRF_P0->PIN_CNF[20] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); - #endif - - SystemCoreClockUpdate(); - - // Start the LF oscilator according to the mbed configuration (over the nrf5x_lf_clk_helper.h file) - NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_TO_USE << CLOCK_LFCLKSRC_SRC_Pos); - NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; - NRF_CLOCK->TASKS_LFCLKSTART = 1; - - // Wait for the external oscillator to start up. - while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) { - // Do nothing. - } -} - - -static bool errata_16(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - } - - return false; -} - -static bool errata_31(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) - { - return true; - } - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) - { - return true; - } - } - - return false; -} - -static bool errata_32(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - } - - return false; -} - -static bool errata_36(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) - { - return true; - } - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) - { - return true; - } - } - - return false; -} - -static bool errata_37(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - } - - return false; -} - -static bool errata_57(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) - { - return true; - } - } - - return false; -} - -static bool errata_66(void) -{ - if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) - { - if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) - { - return true; - } - } - - return false; -} - - -/*lint --flb "Leave library region" */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.h deleted file mode 100644 index 5ecc271059..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/device/system_nrf52.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef SYSTEM_NRF52_H -#define SYSTEM_NRF52_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - -extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ - -/** - * Initialize the system - * - * @param none - * @return none - * - * @brief Setup the microcontroller system. - * Initialize the System and update the SystemCoreClock variable. - */ -extern void SystemInit (void); - -/** - * Update SystemCoreClock variable - * - * @param none - * @return none - * - * @brief Updates the SystemCoreClock with current core Clock - * retrieved from cpu registers. - */ -extern void SystemCoreClockUpdate (void); - -#ifdef __cplusplus -} -#endif - -#endif /* SYSTEM_NRF52_H */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble.h deleted file mode 100644 index 86d4d9adff..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble.h +++ /dev/null @@ -1,689 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_COMMON BLE SoftDevice Common - @{ - @defgroup ble_api Events, type definitions and API calls - @{ - - @brief Module independent events, type definitions and API calls for the BLE SoftDevice. - - */ - -#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" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup BLE_COMMON_ENUMERATIONS Enumerations - * @{ */ - -/** - * @brief Common API SVC numbers. - */ -enum BLE_COMMON_SVCS -{ - SD_BLE_ENABLE = BLE_SVC_BASE, /**< Enable and initialize the BLE stack */ - SD_BLE_EVT_GET, /**< Get an event from the pending events queue. */ - SD_BLE_TX_PACKET_COUNT_GET, /**< Get the total number of available application transmission packets for a particular connection. */ - SD_BLE_UUID_VS_ADD, /**< Add a Vendor Specific UUID. */ - SD_BLE_UUID_DECODE, /**< Decode UUID bytes. */ - SD_BLE_UUID_ENCODE, /**< Encode UUID bytes. */ - SD_BLE_VERSION_GET, /**< Get the local version information (company id, Link Layer Version, Link Layer Subversion). */ - SD_BLE_USER_MEM_REPLY, /**< User Memory Reply. */ - SD_BLE_OPT_SET, /**< Set a BLE option. */ - SD_BLE_OPT_GET, /**< Get a BLE option. */ -}; - - /** - * @brief BLE Module Independent Event IDs. - */ -enum BLE_COMMON_EVTS -{ - BLE_EVT_TX_COMPLETE = BLE_EVT_BASE, /**< Transmission Complete. @ref ble_evt_tx_complete_t */ - BLE_EVT_USER_MEM_REQUEST, /**< User Memory request. @ref ble_evt_user_mem_request_t */ - BLE_EVT_USER_MEM_RELEASE, /**< User Memory release. @ref ble_evt_user_mem_release_t */ - BLE_EVT_DATA_LENGTH_CHANGED /**< Link layer PDU length changed. @ref ble_evt_data_length_changed_t. */ -}; - -/**@brief BLE connection bandwidth types. - * Bandwidth types supported by the SoftDevice. The bandwidth type dictates the maximum number of full length packets per connection interval. - */ -enum BLE_CONN_BWS -{ - BLE_CONN_BW_INVALID = 0, /**< Invalid connection bandwidth. */ - BLE_CONN_BW_LOW, /**< Low connection bandwidth. */ - BLE_CONN_BW_MID, /**< Medium connection bandwidth. */ - BLE_CONN_BW_HIGH /**< High connection bandwidth. */ -}; - -/**@brief Common Option IDs. - * IDs that uniquely identify a common option. - */ -enum BLE_COMMON_OPTS -{ - BLE_COMMON_OPT_CONN_BW = BLE_OPT_BASE, /**< Bandwidth configuration @ref ble_common_opt_conn_bw_t */ - BLE_COMMON_OPT_PA_LNA, /**< PA and LNA options */ - BLE_COMMON_OPT_CONN_EVT_EXT, /**< Extended connection events option */ -}; - -/** @} */ - -/** @addtogroup BLE_COMMON_DEFINES Defines - * @{ */ - -/** @brief Required pointer alignment for BLE Events. -*/ -#define BLE_EVT_PTR_ALIGNMENT 4 - -/** @brief Leaves the maximum of the two arguments. -*/ -#define BLE_MAX(a, b) ((a) < (b) ? (b) : (a)) - -/** @brief Maximum possible length for BLE Events. - * @note Value of @ref ble_gatt_enable_params_t::att_mtu shall be used as a parameter. - * If that value is set to 0 then @ref BLE_GATT_MTU_SIZE_DEFAULT must be used instead. -*/ -#define BLE_EVT_LEN_MAX(ATT_MTU) (BLE_MAX( \ - sizeof(ble_evt_t), \ - BLE_MAX( \ - offsetof(ble_evt_t, evt.gattc_evt.params.rel_disc_rsp.includes) + ((ATT_MTU) - 2) / 6 * sizeof(ble_gattc_include_t), \ - offsetof(ble_evt_t, evt.gattc_evt.params.attr_info_disc_rsp.info.attr_info16) + ((ATT_MTU) - 2) / 4 * sizeof(ble_gattc_attr_info16_t) \ - ) \ -)) - -/** @defgroup BLE_USER_MEM_TYPES User Memory Types - * @{ */ -#define BLE_USER_MEM_TYPE_INVALID 0x00 /**< Invalid User Memory Types. */ -#define BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES 0x01 /**< User Memory for GATTS queued writes. */ -/** @} */ - -/** @defgroup BLE_UUID_VS_COUNTS Vendor Specific UUID counts - * @{ - */ -#define BLE_UUID_VS_COUNT_MIN 1 /**< Minimum VS UUID count. */ -#define BLE_UUID_VS_COUNT_DEFAULT 0 /**< Use the default VS UUID count (10 for this version of the SoftDevice). */ -/** @} */ - -/** @} */ - -/** @addtogroup BLE_COMMON_STRUCTURES Structures - * @{ */ - -/**@brief User Memory Block. */ -typedef struct -{ - uint8_t *p_mem; /**< Pointer to the start of the user memory block. */ - uint16_t len; /**< Length in bytes of the user memory block. */ -} ble_user_mem_block_t; - -/** - * @brief Event structure for @ref BLE_EVT_TX_COMPLETE. - */ -typedef struct -{ - uint8_t count; /**< Number of packets transmitted. */ -} ble_evt_tx_complete_t; - -/**@brief Event structure for @ref BLE_EVT_USER_MEM_REQUEST. */ -typedef struct -{ - uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */ -} ble_evt_user_mem_request_t; - -/**@brief Event structure for @ref BLE_EVT_USER_MEM_RELEASE. */ -typedef struct -{ - uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */ - ble_user_mem_block_t mem_block; /**< User memory block */ -} ble_evt_user_mem_release_t; - -/**@brief Event structure for @ref BLE_EVT_DATA_LENGTH_CHANGED. */ -typedef struct -{ - uint16_t max_tx_octets; /**< The maximum number of payload octets in a Link Layer Data Channel PDU that the local Controller will send. Range: 27-251 */ - uint16_t max_tx_time; /**< The maximum time (in microseconds) that the local Controller will take to send a Link Layer Data Channel PDU. Range: 328-2120 */ - uint16_t max_rx_octets; /**< The maximum number of payload octets in a Link Layer Data Channel PDU that the local controller expects to receive. Range: 27-251 */ - uint16_t max_rx_time; /**< The maximum time (in microseconds) that the local Controller expects to take to receive a Link Layer Data Channel PDU. Range: 328-2120 */ -} ble_evt_data_length_changed_t; - -/**@brief Event structure for events not associated with a specific function module. */ -typedef struct -{ - uint16_t conn_handle; /**< Connection Handle on which this event occurred. */ - union - { - ble_evt_tx_complete_t tx_complete; /**< Transmission Complete. */ - ble_evt_user_mem_request_t user_mem_request; /**< User Memory Request Event Parameters. */ - ble_evt_user_mem_release_t user_mem_release; /**< User Memory Release Event Parameters. */ - ble_evt_data_length_changed_t data_length_changed; /**< Data Length Changed Event Parameters. */ - } params; /**< Event parameter union. */ -} ble_common_evt_t; - -/**@brief BLE Event header. */ -typedef struct -{ - uint16_t evt_id; /**< Value from a BLE__EVT series. */ - uint16_t evt_len; /**< Length in octets including this header. */ -} ble_evt_hdr_t; - -/**@brief Common BLE Event type, wrapping the module specific event reports. */ -typedef struct -{ - ble_evt_hdr_t header; /**< Event header. */ - union - { - ble_common_evt_t common_evt; /**< Common Event, evt_id in BLE_EVT_* series. */ - ble_gap_evt_t gap_evt; /**< GAP originated event, evt_id in BLE_GAP_EVT_* series. */ - ble_l2cap_evt_t l2cap_evt; /**< L2CAP originated event, evt_id in BLE_L2CAP_EVT* series. */ - ble_gattc_evt_t gattc_evt; /**< GATT client originated event, evt_id in BLE_GATTC_EVT* series. */ - ble_gatts_evt_t gatts_evt; /**< GATT server originated event, evt_id in BLE_GATTS_EVT* series. */ - } evt; /**< Event union. */ -} ble_evt_t; - - -/** - * @brief Version Information. - */ -typedef struct -{ - uint8_t version_number; /**< Link Layer Version number for BT 4.1 spec is 7 (https://www.bluetooth.org/en-us/specification/assigned-numbers/link-layer). */ - uint16_t company_id; /**< Company ID, Nordic Semiconductor's company ID is 89 (0x0059) (https://www.bluetooth.org/apps/content/Default.aspx?doc_id=49708). */ - uint16_t subversion_number; /**< Link Layer Sub Version number, corresponds to the SoftDevice Config ID or Firmware ID (FWID). */ -} ble_version_t; - -/** - * @brief Configuration parameters for the PA and LNA. - */ -typedef struct -{ - uint8_t enable :1; /**< Enable toggling for this amplifier */ - uint8_t active_high :1; /**< Set the pin to be active high */ - uint8_t gpio_pin :6; /**< The GPIO pin to toggle for this amplifier */ -} ble_pa_lna_cfg_t; - -/** - * @brief PA & LNA GPIO toggle configuration - * - * This option configures the SoftDevice to toggle pins when the radio is active for use with a power amplifier and/or - * a low noise amplifier. - * - * Toggling the pins is achieved by using two PPI channels and a GPIOTE channel. The hardware channel IDs are provided - * by the application and should be regarded as reserved as long as any PA/LNA toggling is enabled. - * - * @note @ref sd_ble_opt_get is not supported for this option. - * @note This feature is only supported for nRF52, on nRF51 @ref NRF_ERROR_NOT_SUPPORTED will always be returned. - * @note Setting this option while the radio is in use (i.e. any of the roles are active) may have undefined consequences - * and must be avoided by the application. - */ -typedef struct -{ - ble_pa_lna_cfg_t pa_cfg; /**< Power Amplifier configuration */ - ble_pa_lna_cfg_t lna_cfg; /**< Low Noise Amplifier configuration */ - - uint8_t ppi_ch_id_set; /**< PPI channel used for radio pin setting */ - uint8_t ppi_ch_id_clr; /**< PPI channel used for radio pin clearing */ - uint8_t gpiote_ch_id; /**< GPIOTE channel used for radio pin toggling */ -} ble_common_opt_pa_lna_t; - -/** - * @brief BLE connection bandwidth configuration parameters - */ -typedef struct -{ - uint8_t conn_bw_tx; /**< Connection bandwidth configuration for transmission, see @ref BLE_CONN_BWS.*/ - uint8_t conn_bw_rx; /**< Connection bandwidth configuration for reception, see @ref BLE_CONN_BWS.*/ -} ble_conn_bw_t; - -/**@brief BLE connection specific bandwidth configuration parameters. - * - * This can be used with @ref sd_ble_opt_set to set the bandwidth configuration to be used when creating connections. - * - * Call @ref sd_ble_opt_set with this option prior to calling @ref sd_ble_gap_adv_start or @ref sd_ble_gap_connect. - * - * The bandwidth configurations set via @ref sd_ble_opt_set are maintained separately for central and peripheral - * connections. The given configurations are used for all future connections of the role indicated in this structure - * unless they are changed by subsequent @ref sd_ble_opt_set calls. - * - * @note When this option is not used, the SoftDevice will use the default options: - * - @ref BLE_CONN_BW_HIGH for @ref BLE_GAP_ROLE_PERIPH connections (both transmission and reception). - * - @ref BLE_CONN_BW_MID for @ref BLE_GAP_ROLE_CENTRAL connections (both transmisison and reception). - * This option allows the application to selectively override these defaults for each role. - * - * @note The global memory pool configuration can be set with the @ref ble_conn_bw_counts_t configuration parameter, which - * is provided to @ref sd_ble_enable. - * - * @note @ref sd_ble_opt_get is not supported for this option. - * @note Please refer to SoftDevice Specification for more information on bandwidth configuration. - * - * @mscs - * @mmsc{@ref BLE_COMMON_CONF_BW} - * @endmscs - * - * @retval ::NRF_SUCCESS Set successfully. - * @retval ::BLE_ERROR_INVALID_ROLE The role is invalid. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid bandwidth configuration parameters. - * @retval ::NRF_ERROR_NOT_SUPPORTED If the combination of role and bandwidth configuration is not supported. - */ -typedef struct -{ - uint8_t role; /**< BLE role of the connection, see @ref BLE_GAP_ROLES. */ - ble_conn_bw_t conn_bw; /**< Bandwidth configuration parameters. */ -} ble_common_opt_conn_bw_t; - -/** - * @brief Configuration of extended BLE connection events. - * - * When enabled the SoftDevice will dynamically extend the connection event when possible. - * - * The connection event length is controlled by the bandwidth configuration as set by @ref ble_common_opt_conn_bw_t. - * The connection event can be extended if there is time to send another packet pair before the start of the next connection interval, - * and if there are no conflicts with other BLE roles requesting radio time. - * - * @note @ref sd_ble_opt_get is not supported for this option. - */ -typedef struct -{ - uint8_t enable : 1; /**< Enable extended BLE connection events, disabled by default. */ -} ble_common_opt_conn_evt_ext_t; - -/**@brief Option structure for common options. */ -typedef union -{ - ble_common_opt_conn_bw_t conn_bw; /**< Parameters for the connection bandwidth option. */ - ble_common_opt_pa_lna_t pa_lna; /**< Parameters for controlling PA and LNA pin toggling. */ - ble_common_opt_conn_evt_ext_t conn_evt_ext; /**< Parameters for enabling extended connection events. */ -} ble_common_opt_t; - -/**@brief Common BLE Option type, wrapping the module specific options. */ -typedef union -{ - ble_common_opt_t common_opt; /**< COMMON options, opt_id in @ref BLE_COMMON_OPTS series. */ - ble_gap_opt_t gap_opt; /**< GAP option, opt_id in @ref BLE_GAP_OPTS series. */ -} ble_opt_t; - -/** - * @brief BLE bandwidth count parameters - * - * These parameters are used to configure the memory pools allocated within the SoftDevice for application packets - * (both transmission and reception) for all connections. - * - * @note The sum of all three counts must add up to the sum of @ref ble_gap_enable_params_t::central_conn_count and - * @ref ble_gap_enable_params_t::periph_conn_count in @ref ble_gap_enable_params_t. - */ -typedef struct { - uint8_t high_count; /**< Total number of high bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ - uint8_t mid_count; /**< Total number of medium bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ - uint8_t low_count; /**< Total number of low bandwidth TX or RX memory pools available to the application at runtime for all active connections. */ -} ble_conn_bw_count_t; - -/** - * @brief BLE bandwidth global memory pool configuration parameters - * - * These configuration parameters are used to set the amount of memory dedicated to application packets for - * all connections. The application should specify the most demanding configuration for the intended use. - * - * Please refer to the SoftDevice Specification for more information on bandwidth configuration. - * - * @note Each connection created at runtime requires both a TX and an RX memory pool. By the use of these configuration - * parameters, the application can decide the size and total number of the global memory pools that will be later - * available for connection creation. - * - * @mscs - * @mmsc{@ref BLE_COMMON_CONF_BW} - * @endmscs - * - */ -typedef struct { - ble_conn_bw_count_t tx_counts; /**< Global memory pool configuration for transmission.*/ - ble_conn_bw_count_t rx_counts; /**< Global memory pool configuration for reception.*/ -} ble_conn_bw_counts_t; - -/** - * @brief BLE Common Initialization parameters. - * - * @note If @ref p_conn_bw_counts is NULL the SoftDevice will assume default bandwidth configuration for all connections. - * To fit a custom bandwidth configuration requirement, the application developer may have to specify a custom memory - * pool configuration here. See @ref ble_common_opt_conn_bw_t for bandwidth configuration of individual connections. - * Please refer to the SoftDevice Specification for more information on bandwidth configuration. - */ -typedef struct -{ - uint16_t vs_uuid_count; /**< Maximum number of 128-bit, Vendor Specific UUID bases to allocate. */ - ble_conn_bw_counts_t *p_conn_bw_counts; /**< Bandwidth configuration parameters or NULL for defaults. */ -} ble_common_enable_params_t; - -/** - * @brief BLE Initialization parameters. - */ -typedef struct -{ - ble_common_enable_params_t common_enable_params; /**< Common init parameters @ref ble_common_enable_params_t. */ - ble_gap_enable_params_t gap_enable_params; /**< GAP init parameters @ref ble_gap_enable_params_t. */ - ble_gatt_enable_params_t gatt_enable_params; /**< GATT init parameters @ref ble_gatt_enable_params_t. */ - ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init parameters @ref ble_gatts_enable_params_t. */ -} ble_enable_params_t; - -/** @} */ - -/** @addtogroup BLE_COMMON_FUNCTIONS Functions - * @{ */ - -/**@brief Enable the BLE stack - * - * @param[in, out] p_ble_enable_params Pointer to ble_enable_params_t - * @param[in, out] p_app_ram_base Pointer to a variable containing the start address of the application RAM region - * (APP_RAM_BASE). On return, this will contain the minimum start address of the application RAM region required by the - * SoftDevice for this configuration. Calling @ref sd_ble_enable() with *p_app_ram_base set to 0 can be used during - * development to find out how much memory a specific configuration will need. - * - * @note The memory requirement for a specific configuration will not increase between SoftDevices with the same major - * version number. - * - * @note At runtime the IC's RAM is split into 2 regions: The SoftDevice RAM region is located between 0x20000000 and - * APP_RAM_BASE-1 and the application's RAM region is located between APP_RAM_BASE and the start of the call stack. - * - * @details This call initializes the BLE stack, no other BLE related function can be called before this one. - * - * @mscs - * @mmsc{@ref BLE_COMMON_ENABLE} - * @endmscs - * - * @retval ::NRF_SUCCESS The BLE stack has been initialized successfully. - * @retval ::NRF_ERROR_INVALID_STATE The BLE stack had already been initialized and cannot be reinitialized. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. - * @retval ::NRF_ERROR_INVALID_LENGTH One or more of the following is true: - * - The specified Attribute Table size is too small. - * The minimum acceptable size is defined by @ref BLE_GATTS_ATTR_TAB_SIZE_MIN. - * - The specified Attribute Table size is not a multiple of 4. - * - The device name length is invalid (must be between 0 and @ref BLE_GAP_DEVNAME_MAX_LEN). - * - The device name length is too long for the given Attribute Table. - * @retval ::NRF_ERROR_INVALID_PARAM One or more of the following is true: - * - Incorrectly configured VS UUID count. - * - Invalid connection count parameters. - * - Invalid device name location (vloc). - * - Invalid device name security mode. - * - Invalid maximum ATT_MTU size, see @ref ble_gatt_enable_params_t::att_mtu. - * @retval ::NRF_ERROR_NOT_SUPPORTED Device name security mode is not supported. - * @retval ::NRF_ERROR_NO_MEM The amount of memory assigned to the SoftDevice by *p_app_ram_base is not - * large enough to fit this configuration's memory requirement. Check *p_app_ram_base - * and set the start address of the application RAM region accordingly. - * @retval ::NRF_ERROR_CONN_COUNT The requested number of connections exceeds the maximum supported by the SoftDevice. - * Please refer to the SoftDevice Specification for more information on role configuration. - */ -SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params, uint32_t * p_app_ram_base)); - -/**@brief Get an event from the pending events queue. - * - * @param[out] p_dest Pointer to buffer to be filled in with an event, or NULL to retrieve the event length. - * This buffer must be aligned to the extend defined by @ref BLE_EVT_PTR_ALIGNMENT. - * The buffer should be interpreted as a @ref ble_evt_t struct. - * @param[in, out] p_len Pointer the length of the buffer, on return it is filled with the event length. - * - * @details This call allows the application to pull a BLE event from the BLE stack. The application is signaled that - * an event is available from the BLE stack by the triggering of the SD_EVT_IRQn interrupt. - * The application is free to choose whether to call this function from thread mode (main context) or directly from the - * Interrupt Service Routine that maps to SD_EVT_IRQn. In any case however, and because the BLE stack runs at a higher - * priority than the application, this function should be called in a loop (until @ref NRF_ERROR_NOT_FOUND is returned) - * every time SD_EVT_IRQn is raised to ensure that all available events are pulled from the BLE stack. Failure to do so - * could potentially leave events in the internal queue without the application being aware of this fact. - * - * Sizing the p_dest buffer is equally important, since the application needs to provide all the memory necessary for the event to - * be copied into application memory. If the buffer provided is not large enough to fit the entire contents of the event, - * @ref NRF_ERROR_DATA_SIZE will be returned and the application can then call again with a larger buffer size. - * The maximum possible event length is defined by @ref BLE_EVT_LEN_MAX. The application may also "peek" the event length - * by providing p_dest as a NULL pointer and inspecting the value of *p_len upon return: - * - * \code - * uint16_t len; - * errcode = sd_ble_evt_get(NULL, &len); - * \endcode - * - * @mscs - * @mmsc{@ref BLE_COMMON_IRQ_EVT_MSC} - * @mmsc{@ref BLE_COMMON_THREAD_EVT_MSC} - * @endmscs - * - * @retval ::NRF_SUCCESS Event pulled and stored into the supplied buffer. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. - * @retval ::NRF_ERROR_NOT_FOUND No events ready to be pulled. - * @retval ::NRF_ERROR_DATA_SIZE Event ready but could not fit into the supplied buffer. - */ -SVCALL(SD_BLE_EVT_GET, uint32_t, sd_ble_evt_get(uint8_t *p_dest, uint16_t *p_len)); - - -/**@brief Get the total number of available guaranteed application transmission packets for a particular connection. - * - * @details This call allows the application to obtain the total number of guaranteed application transmission packets - * available for a connection. Please note that this does not return the number of free packets, but rather the total - * amount of them for that particular connection. The application has two options to handle transmitting application packets: - * - Use a simple arithmetic calculation: after connection creation time the application should use this function to - * find out the total amount of guaranteed packets available to it and store it in a variable. - * Every time a packet is successfully queued for a transmission on this connection using any of the exposed functions in - * this BLE API, the application should decrement that variable. Conversely, whenever a @ref BLE_EVT_TX_COMPLETE event - * with the conn_handle matching the particular connection is received by the application, it should retrieve the count - * field in such event and add that number to the same variable storing the number of available guaranteed packets. This - * mechanism allows the application to be aware at any time of the number of guaranteed application packets available for - * each of the active connections, and therefore it can know with certainty whether it is possible to send more data or - * it has to wait for a @ref BLE_EVT_TX_COMPLETE event before it proceeds. - * The application can still pursue transmissions when the number of guaranteed application packets available is smaller - * than or equal to zero, but successful queuing of the tranmsission is not guaranteed. - * - Choose to simply not keep track of available packets at all, and instead handle the @ref BLE_ERROR_NO_TX_PACKETS error - * by queueing the packet to be transmitted and try again as soon as a @ref BLE_EVT_TX_COMPLETE event arrives. - * - * The API functions that may consume an application packet depending on the parameters supplied to them can be found below: - * - @ref sd_ble_gattc_write (write without response only) - * - @ref sd_ble_gatts_hvx (notifications only) - * - @ref sd_ble_l2cap_tx (all packets) - * - * @param[in] conn_handle Connection handle. - * @param[out] p_count Pointer to a uint8_t which will contain the number of application transmission packets upon - * successful return. - * @mscs - * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} - * @endmscs - * - * @retval ::NRF_SUCCESS Number of application transmission packets retrieved successfully. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - */ -SVCALL(SD_BLE_TX_PACKET_COUNT_GET, uint32_t, sd_ble_tx_packet_count_get(uint16_t conn_handle, uint8_t *p_count)); - - -/**@brief Add a Vendor Specific base UUID. - * - * @details This call enables the application to add a vendor specific base UUID to the BLE stack's table, for later - * use with all other modules and APIs. This then allows the application to use the shorter, 24-bit @ref ble_uuid_t - * format when dealing with both 16-bit and 128-bit UUIDs without having to check for lengths and having split code - * paths. This is accomplished by extending the grouping mechanism that the Bluetooth SIG standard base UUID uses - * for all other 128-bit UUIDs. The type field in the @ref ble_uuid_t structure is an index (relative to - * @ref BLE_UUID_TYPE_VENDOR_BEGIN) to the table populated by multiple calls to this function, and the uuid field - * in the same structure contains the 2 bytes at indices 12 and 13. The number of possible 128-bit UUIDs available to - * the application is therefore the number of Vendor Specific UUIDs added with the help of this function times 65536, - * although restricted to modifying bytes 12 and 13 for each of the entries in the supplied array. - * - * @note Bytes 12 and 13 of the provided UUID will not be used internally, since those are always replaced by - * the 16-bit uuid field in @ref ble_uuid_t. - * - * @note If a UUID is already present in the BLE stack's internal table, the corresponding index will be returned in - * p_uuid_type along with an NRF_SUCCESS error code. - * - * @param[in] p_vs_uuid Pointer to a 16-octet (128-bit) little endian Vendor Specific UUID disregarding - * bytes 12 and 13. - * @param[out] p_uuid_type Pointer to a uint8_t where the type field in @ref ble_uuid_t corresponding to this UUID will be stored. - * - * @retval ::NRF_SUCCESS Successfully added the Vendor Specific UUID. - * @retval ::NRF_ERROR_INVALID_ADDR If p_vs_uuid or p_uuid_type is NULL or invalid. - * @retval ::NRF_ERROR_NO_MEM If there are no more free slots for VS UUIDs. - */ -SVCALL(SD_BLE_UUID_VS_ADD, uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type)); - - -/** @brief Decode little endian raw UUID bytes (16-bit or 128-bit) into a 24 bit @ref ble_uuid_t structure. - * - * @details The raw UUID bytes excluding bytes 12 and 13 (i.e. bytes 0-11 and 14-15) of p_uuid_le are compared - * to the corresponding ones in each entry of the table of vendor specific UUIDs populated with @ref sd_ble_uuid_vs_add - * to look for a match. If there is such a match, bytes 12 and 13 are returned as p_uuid->uuid and the index - * relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN as p_uuid->type. - * - * @note If the UUID length supplied is 2, then the type set by this call will always be @ref BLE_UUID_TYPE_BLE. - * - * @param[in] uuid_le_len Length in bytes of the buffer pointed to by p_uuid_le (must be 2 or 16 bytes). - * @param[in] p_uuid_le Pointer pointing to little endian raw UUID bytes. - * @param[out] p_uuid Pointer to a @ref ble_uuid_t structure to be filled in. - * - * @retval ::NRF_SUCCESS Successfully decoded into the @ref ble_uuid_t structure. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_LENGTH Invalid UUID length. - * @retval ::NRF_ERROR_NOT_FOUND For a 128-bit UUID, no match in the populated table of UUIDs. - */ -SVCALL(SD_BLE_UUID_DECODE, uint32_t, sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const *p_uuid_le, ble_uuid_t *p_uuid)); - - -/** @brief Encode a @ref ble_uuid_t structure into little endian raw UUID bytes (16-bit or 128-bit). - * - * @note The pointer to the destination buffer p_uuid_le may be NULL, in which case only the validity and size of p_uuid is computed. - * - * @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes. - * @param[out] p_uuid_le_len Pointer to a uint8_t that will be filled with the encoded length (2 or 16 bytes). - * @param[out] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes (2 or 16) will be stored. - * - * @retval ::NRF_SUCCESS Successfully encoded into the buffer. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid UUID type. - */ -SVCALL(SD_BLE_UUID_ENCODE, uint32_t, sd_ble_uuid_encode(ble_uuid_t const *p_uuid, uint8_t *p_uuid_le_len, uint8_t *p_uuid_le)); - - -/**@brief Get Version Information. - * - * @details This call allows the application to get the BLE stack version information. - * - * @param[out] p_version Pointer to a ble_version_t structure to be filled in. - * - * @retval ::NRF_SUCCESS Version information stored successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_BUSY The BLE stack is busy (typically doing a locally-initiated disconnection procedure). - */ -SVCALL(SD_BLE_VERSION_GET, uint32_t, sd_ble_version_get(ble_version_t *p_version)); - - -/**@brief Provide a user memory block. - * - * @note This call can only be used as a response to a @ref BLE_EVT_USER_MEM_REQUEST event issued to the application. - * - * @param[in] conn_handle Connection handle. - * @param[in,out] p_block Pointer to a user memory block structure. - * - * @mscs - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_PEER_CANCEL_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_AUTH_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_AUTH_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_NOAUTH_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} - * @endmscs - * - * @retval ::NRF_SUCCESS Successfully queued a response to the peer. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection state or no execute write request pending. - * @retval ::NRF_ERROR_BUSY The BLE stack is busy. Retry at later time. - */ -SVCALL(SD_BLE_USER_MEM_REPLY, uint32_t, sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block)); - -/**@brief Set a BLE option. - * - * @details This call allows the application to set the value of an option. - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_BONDING_STATIC_PK_MSC} - * @mmsc{@ref BLE_COMMON_CONF_BW} - * @endmscs - * - * @param[in] opt_id Option ID, see @ref BLE_COMMON_OPTS and @ref BLE_GAP_OPTS. - * @param[in] p_opt Pointer to a ble_opt_t structure containing the option value. - * - * @retval ::NRF_SUCCESS Option set successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. - * @retval ::NRF_ERROR_INVALID_STATE Unable to set the parameter at this time. - * @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed. - */ -SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt)); - - -/**@brief Get a BLE option. - * - * @details This call allows the application to retrieve the value of an option. - * - * @param[in] opt_id Option ID, see @ref BLE_COMMON_OPTS and @ref BLE_GAP_OPTS. - * @param[out] p_opt Pointer to a ble_opt_t structure to be filled in. - * - * @retval ::NRF_SUCCESS Option retrieved successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. - * @retval ::NRF_ERROR_INVALID_STATE Unable to retrieve the parameter at this time. - * @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed. - * @retval ::NRF_ERROR_NOT_SUPPORTED This option is not supported. - * - */ -SVCALL(SD_BLE_OPT_GET, uint32_t, sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt)); - -/** @} */ -#ifdef __cplusplus -} -#endif -#endif /* BLE_H__ */ - -/** - @} - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_err.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_err.h deleted file mode 100644 index cfbcd503c9..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_err.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_COMMON - @{ - @addtogroup nrf_error - @{ - @ingroup BLE_COMMON - @} - - @defgroup ble_err General error codes - @{ - - @brief General error code definitions for the BLE API. - - @ingroup BLE_COMMON -*/ -#ifndef NRF_BLE_ERR_H__ -#define NRF_BLE_ERR_H__ - -#include "nrf_error.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* @defgroup BLE_ERRORS Error Codes - * @{ */ -#define BLE_ERROR_NOT_ENABLED (NRF_ERROR_STK_BASE_NUM+0x001) /**< @ref sd_ble_enable has not been called. */ -#define BLE_ERROR_INVALID_CONN_HANDLE (NRF_ERROR_STK_BASE_NUM+0x002) /**< Invalid connection handle. */ -#define BLE_ERROR_INVALID_ATTR_HANDLE (NRF_ERROR_STK_BASE_NUM+0x003) /**< Invalid attribute handle. */ -#define BLE_ERROR_NO_TX_PACKETS (NRF_ERROR_STK_BASE_NUM+0x004) /**< Not enough application packets available on this connection. */ -#define BLE_ERROR_INVALID_ROLE (NRF_ERROR_STK_BASE_NUM+0x005) /**< Invalid role. */ -/** @} */ - - -/** @defgroup BLE_ERROR_SUBRANGES Module specific error code subranges - * @brief Assignment of subranges for module specific error codes. - * @note For specific error codes, see ble_.h or ble_error_.h. - * @{ */ -#define NRF_L2CAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x100) /**< L2CAP specific errors. */ -#define NRF_GAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x200) /**< GAP specific errors. */ -#define NRF_GATTC_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x300) /**< GATT client specific errors. */ -#define NRF_GATTS_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x400) /**< GATT server specific errors. */ -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif - - -/** - @} - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gap.h deleted file mode 100644 index 34946746fe..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gap.h +++ /dev/null @@ -1,2022 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_GAP Generic Access Profile (GAP) - @{ - @brief Definitions and prototypes for the GAP interface. - */ - -#ifndef BLE_GAP_H__ -#define BLE_GAP_H__ - -#include "ble_types.h" -#include "ble_ranges.h" -#include "nrf_svc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**@addtogroup BLE_GAP_ENUMERATIONS Enumerations - * @{ */ - -/**@brief GAP API SVC numbers. - */ -enum BLE_GAP_SVCS -{ - SD_BLE_GAP_ADDR_SET = BLE_GAP_SVC_BASE, /**< Set own Bluetooth Address. */ - SD_BLE_GAP_ADDR_GET, /**< Get own Bluetooth Address. */ - SD_BLE_GAP_WHITELIST_SET, /**< Set active whitelist. */ - SD_BLE_GAP_DEVICE_IDENTITIES_SET, /**< Set device identity list. */ - SD_BLE_GAP_PRIVACY_SET, /**< Set Privacy settings*/ - SD_BLE_GAP_PRIVACY_GET, /**< Get Privacy settings*/ - SD_BLE_GAP_ADV_DATA_SET, /**< Set Advertising Data. */ - SD_BLE_GAP_ADV_START, /**< Start Advertising. */ - SD_BLE_GAP_ADV_STOP, /**< Stop Advertising. */ - SD_BLE_GAP_CONN_PARAM_UPDATE, /**< Connection Parameter Update. */ - SD_BLE_GAP_DISCONNECT, /**< Disconnect. */ - SD_BLE_GAP_TX_POWER_SET, /**< Set TX Power. */ - SD_BLE_GAP_APPEARANCE_SET, /**< Set Appearance. */ - SD_BLE_GAP_APPEARANCE_GET, /**< Get Appearance. */ - SD_BLE_GAP_PPCP_SET, /**< Set PPCP. */ - SD_BLE_GAP_PPCP_GET, /**< Get PPCP. */ - SD_BLE_GAP_DEVICE_NAME_SET, /**< Set Device Name. */ - SD_BLE_GAP_DEVICE_NAME_GET, /**< Get Device Name. */ - SD_BLE_GAP_AUTHENTICATE, /**< Initiate Pairing/Bonding. */ - SD_BLE_GAP_SEC_PARAMS_REPLY, /**< Reply with Security Parameters. */ - SD_BLE_GAP_AUTH_KEY_REPLY, /**< Reply with an authentication key. */ - SD_BLE_GAP_LESC_DHKEY_REPLY, /**< Reply with an LE Secure Connections DHKey. */ - SD_BLE_GAP_KEYPRESS_NOTIFY, /**< Notify of a keypress during an authentication procedure. */ - SD_BLE_GAP_LESC_OOB_DATA_GET, /**< Get the local LE Secure Connections OOB data. */ - SD_BLE_GAP_LESC_OOB_DATA_SET, /**< Set the remote LE Secure Connections OOB data. */ - SD_BLE_GAP_ENCRYPT, /**< Initiate encryption procedure. */ - SD_BLE_GAP_SEC_INFO_REPLY, /**< Reply with Security Information. */ - SD_BLE_GAP_CONN_SEC_GET, /**< Obtain connection security level. */ - SD_BLE_GAP_RSSI_START, /**< Start reporting of changes in RSSI. */ - SD_BLE_GAP_RSSI_STOP, /**< Stop reporting of changes in RSSI. */ - SD_BLE_GAP_SCAN_START, /**< Start Scanning. */ - SD_BLE_GAP_SCAN_STOP, /**< Stop Scanning. */ - SD_BLE_GAP_CONNECT, /**< Connect. */ - SD_BLE_GAP_CONNECT_CANCEL, /**< Cancel ongoing connection procedure. */ - SD_BLE_GAP_RSSI_GET, /**< Get the last RSSI sample. */ - SD_BLE_GAP_PHY_REQUEST, /**< Initiate PHY Update procedure. */ -}; - -/**@brief GAP Event IDs. - * IDs that uniquely identify an event coming from the stack to the application. - */ -enum BLE_GAP_EVTS -{ - BLE_GAP_EVT_CONNECTED = BLE_GAP_EVT_BASE, /**< Connection established. \n See @ref ble_gap_evt_connected_t. */ - BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. \n See @ref ble_gap_evt_disconnected_t. */ - BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. \n See @ref ble_gap_evt_conn_param_update_t. */ - BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. \n Reply with @ref sd_ble_gap_sec_params_reply. \n See @ref ble_gap_evt_sec_params_request_t. */ - BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. \n Reply with @ref sd_ble_gap_sec_info_reply. \n See @ref ble_gap_evt_sec_info_request_t. */ - BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. \n In LESC Numeric Comparison, reply with @ref sd_ble_gap_auth_key_reply. \n See @ref ble_gap_evt_passkey_display_t. */ - BLE_GAP_EVT_KEY_PRESSED, /**< Notification of a keypress on the remote device.\n See @ref ble_gap_evt_key_pressed_t */ - BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. \n Reply with @ref sd_ble_gap_auth_key_reply. \n See @ref ble_gap_evt_auth_key_request_t. */ - BLE_GAP_EVT_LESC_DHKEY_REQUEST, /**< Request to calculate an LE Secure Connections DHKey. \n Reply with @ref sd_ble_gap_lesc_dhkey_reply. \n See @ref ble_gap_evt_lesc_dhkey_request_t */ - BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. \n See @ref ble_gap_evt_auth_status_t. */ - BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. \n See @ref ble_gap_evt_conn_sec_update_t. */ - BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. \n See @ref ble_gap_evt_timeout_t. */ - BLE_GAP_EVT_RSSI_CHANGED, /**< RSSI report. \n See @ref ble_gap_evt_rssi_changed_t. */ - BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. \n See @ref ble_gap_evt_adv_report_t. */ - BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. \n See @ref ble_gap_evt_sec_request_t. */ - BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. \n Reply with @ref sd_ble_gap_conn_param_update. \n See @ref ble_gap_evt_conn_param_update_request_t. */ - BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. \n See @ref ble_gap_evt_scan_req_report_t. */ - BLE_GAP_EVT_PHY_UPDATE, /**< PHY have been updated \n See @ref ble_gap_evt_phy_update_t. */ -}; - -/**@brief GAP Option IDs. - * IDs that uniquely identify a GAP option. - */ -enum BLE_GAP_OPTS -{ - BLE_GAP_OPT_CH_MAP = BLE_GAP_OPT_BASE, /**< Channel Map. @ref ble_gap_opt_ch_map_t */ - BLE_GAP_OPT_LOCAL_CONN_LATENCY, /**< Local connection latency. @ref ble_gap_opt_local_conn_latency_t */ - BLE_GAP_OPT_PASSKEY, /**< Set passkey. @ref ble_gap_opt_passkey_t */ - BLE_GAP_OPT_SCAN_REQ_REPORT, /**< Scan request report. @ref ble_gap_opt_scan_req_report_t */ - BLE_GAP_OPT_COMPAT_MODE, /**< Compatibility mode. @ref ble_gap_opt_compat_mode_t */ - BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT, /**< Set Authenticated payload timeout. @ref ble_gap_opt_auth_payload_timeout_t */ - BLE_GAP_OPT_EXT_LEN, /**< Extended length packets. @ref ble_gap_opt_ext_len_t */ - BLE_GAP_OPT_PREFERRED_PHYS_SET, /**< Set the preferred PHYs for all new connections. @ref ble_gap_opt_preferred_phys_t */ -}; - -/** @} */ - -/**@addtogroup BLE_GAP_DEFINES Defines - * @{ */ - -/**@defgroup BLE_ERRORS_GAP SVC return values specific to GAP - * @{ */ -#define BLE_ERROR_GAP_UUID_LIST_MISMATCH (NRF_GAP_ERR_BASE + 0x000) /**< UUID list does not contain an integral number of UUIDs. */ -#define BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST (NRF_GAP_ERR_BASE + 0x001) /**< Use of Whitelist not permitted with discoverable advertising. */ -#define BLE_ERROR_GAP_INVALID_BLE_ADDR (NRF_GAP_ERR_BASE + 0x002) /**< The upper two bits of the address do not correspond to the specified address type. */ -#define BLE_ERROR_GAP_WHITELIST_IN_USE (NRF_GAP_ERR_BASE + 0x003) /**< Attempt to modify the whitelist while already in use by another operation. */ -#define BLE_ERROR_GAP_DEVICE_IDENTITIES_IN_USE (NRF_GAP_ERR_BASE + 0x004) /**< Attempt to modify the device identity list while already in use by another operation. */ -#define BLE_ERROR_GAP_DEVICE_IDENTITIES_DUPLICATE (NRF_GAP_ERR_BASE + 0x005) /**< The device identity list contains entries with duplicate identity addresses. */ -/**@} */ - - -/**@defgroup BLE_GAP_ROLES GAP Roles - * @note Not explicitly used in peripheral API, but will be relevant for central API. - * @{ */ -#define BLE_GAP_ROLE_INVALID 0x0 /**< Invalid Role. */ -#define BLE_GAP_ROLE_PERIPH 0x1 /**< Peripheral Role. */ -#define BLE_GAP_ROLE_CENTRAL 0x2 /**< Central Role. */ -/**@} */ - - -/**@defgroup BLE_GAP_TIMEOUT_SOURCES GAP Timeout sources - * @{ */ -#define BLE_GAP_TIMEOUT_SRC_ADVERTISING 0x00 /**< Advertising timeout. */ -#define BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST 0x01 /**< Security request timeout. */ -#define BLE_GAP_TIMEOUT_SRC_SCAN 0x02 /**< Scanning timeout. */ -#define BLE_GAP_TIMEOUT_SRC_CONN 0x03 /**< Connection timeout. */ -#define BLE_GAP_TIMEOUT_SRC_AUTH_PAYLOAD 0x04 /**< Authenticated payload timeout. */ -/**@} */ - - -/**@defgroup BLE_GAP_ADDR_TYPES GAP Address types - * @{ */ -#define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public address. */ -#define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random static address. */ -#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE 0x02 /**< Random private resolvable address. */ -#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**< Random private non-resolvable address. */ -/**@} */ - - -/**@brief The default interval in seconds at which a private address is refreshed. */ -#define BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S (900) /* 15 minutes. */ -/**@brief The maximum interval in seconds at which a private address can be refreshed. */ -#define BLE_GAP_MAX_PRIVATE_ADDR_CYCLE_INTERVAL_S (41400) /* 11 hours 30 minutes. */ - - -/** @brief BLE address length. */ -#define BLE_GAP_ADDR_LEN (6) - - -/**@defgroup BLE_GAP_PRIVACY_MODES Privacy modes - * @{ */ -#define BLE_GAP_PRIVACY_MODE_OFF 0x00 /**< Device will send and accept its identity address for its own address. */ -#define BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY 0x01 /**< Device will send and accept only private addresses for its own address. */ -/**@} */ - - -/**@defgroup BLE_GAP_AD_TYPE_DEFINITIONS GAP Advertising and Scan Response Data format - * @note Found at https://www.bluetooth.org/Technical/AssignedNumbers/generic_access_profile.htm - * @{ */ -#define BLE_GAP_AD_TYPE_FLAGS 0x01 /**< Flags for discoverability. */ -#define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE 0x02 /**< Partial list of 16 bit service UUIDs. */ -#define BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE 0x03 /**< Complete list of 16 bit service UUIDs. */ -#define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_MORE_AVAILABLE 0x04 /**< Partial list of 32 bit service UUIDs. */ -#define BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE 0x05 /**< Complete list of 32 bit service UUIDs. */ -#define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE 0x06 /**< Partial list of 128 bit service UUIDs. */ -#define BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE 0x07 /**< Complete list of 128 bit service UUIDs. */ -#define BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME 0x08 /**< Short local device name. */ -#define BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME 0x09 /**< Complete local device name. */ -#define BLE_GAP_AD_TYPE_TX_POWER_LEVEL 0x0A /**< Transmit power level. */ -#define BLE_GAP_AD_TYPE_CLASS_OF_DEVICE 0x0D /**< Class of device. */ -#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C 0x0E /**< Simple Pairing Hash C. */ -#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R 0x0F /**< Simple Pairing Randomizer R. */ -#define BLE_GAP_AD_TYPE_SECURITY_MANAGER_TK_VALUE 0x10 /**< Security Manager TK Value. */ -#define BLE_GAP_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS 0x11 /**< Security Manager Out Of Band Flags. */ -#define BLE_GAP_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE 0x12 /**< Slave Connection Interval Range. */ -#define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT 0x14 /**< List of 16-bit Service Solicitation UUIDs. */ -#define BLE_GAP_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT 0x15 /**< List of 128-bit Service Solicitation UUIDs. */ -#define BLE_GAP_AD_TYPE_SERVICE_DATA 0x16 /**< Service Data - 16-bit UUID. */ -#define BLE_GAP_AD_TYPE_PUBLIC_TARGET_ADDRESS 0x17 /**< Public Target Address. */ -#define BLE_GAP_AD_TYPE_RANDOM_TARGET_ADDRESS 0x18 /**< Random Target Address. */ -#define BLE_GAP_AD_TYPE_APPEARANCE 0x19 /**< Appearance. */ -#define BLE_GAP_AD_TYPE_ADVERTISING_INTERVAL 0x1A /**< Advertising Interval. */ -#define BLE_GAP_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS 0x1B /**< LE Bluetooth Device Address. */ -#define BLE_GAP_AD_TYPE_LE_ROLE 0x1C /**< LE Role. */ -#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_HASH_C256 0x1D /**< Simple Pairing Hash C-256. */ -#define BLE_GAP_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R256 0x1E /**< Simple Pairing Randomizer R-256. */ -#define BLE_GAP_AD_TYPE_SERVICE_DATA_32BIT_UUID 0x20 /**< Service Data - 32-bit UUID. */ -#define BLE_GAP_AD_TYPE_SERVICE_DATA_128BIT_UUID 0x21 /**< Service Data - 128-bit UUID. */ -#define BLE_GAP_AD_TYPE_URI 0x24 /**< URI */ -#define BLE_GAP_AD_TYPE_3D_INFORMATION_DATA 0x3D /**< 3D Information Data. */ -#define BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFF /**< Manufacturer Specific Data. */ -/**@} */ - - -/**@defgroup BLE_GAP_ADV_FLAGS GAP Advertisement Flags - * @{ */ -#define BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE (0x01) /**< LE Limited Discoverable Mode. */ -#define BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE (0x02) /**< LE General Discoverable Mode. */ -#define BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED (0x04) /**< BR/EDR not supported. */ -#define BLE_GAP_ADV_FLAG_LE_BR_EDR_CONTROLLER (0x08) /**< Simultaneous LE and BR/EDR, Controller. */ -#define BLE_GAP_ADV_FLAG_LE_BR_EDR_HOST (0x10) /**< Simultaneous LE and BR/EDR, Host. */ -#define BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE (BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) /**< LE Limited Discoverable Mode, BR/EDR not supported. */ -#define BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE (BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED) /**< LE General Discoverable Mode, BR/EDR not supported. */ -/**@} */ - - -/**@defgroup BLE_GAP_ADV_INTERVALS GAP Advertising interval max and min - * @{ */ -#define BLE_GAP_ADV_INTERVAL_MIN 0x0020 /**< Minimum Advertising interval in 625 us units, i.e. 20 ms. */ -#define BLE_GAP_ADV_NONCON_INTERVAL_MIN 0x00A0 /**< Minimum Advertising interval in 625 us units for non connectable mode, i.e. 100 ms. */ -#define BLE_GAP_ADV_INTERVAL_MAX 0x4000 /**< Maximum Advertising interval in 625 us units, i.e. 10.24 s. */ - /**@} */ - - -/**@defgroup BLE_GAP_SCAN_INTERVALS GAP Scan interval max and min - * @{ */ -#define BLE_GAP_SCAN_INTERVAL_MIN 0x0004 /**< Minimum Scan interval in 625 us units, i.e. 2.5 ms. */ -#define BLE_GAP_SCAN_INTERVAL_MAX 0x4000 /**< Maximum Scan interval in 625 us units, i.e. 10.24 s. */ - /** @} */ - - -/**@defgroup BLE_GAP_SCAN_WINDOW GAP Scan window max and min - * @{ */ -#define BLE_GAP_SCAN_WINDOW_MIN 0x0004 /**< Minimum Scan window in 625 us units, i.e. 2.5 ms. */ -#define BLE_GAP_SCAN_WINDOW_MAX 0x4000 /**< Maximum Scan window in 625 us units, i.e. 10.24 s. */ - /** @} */ - - -/**@defgroup BLE_GAP_SCAN_TIMEOUT GAP Scan timeout max and min - * @{ */ -#define BLE_GAP_SCAN_TIMEOUT_MIN 0x0001 /**< Minimum Scan timeout in seconds. */ -#define BLE_GAP_SCAN_TIMEOUT_MAX 0xFFFF /**< Maximum Scan timeout in seconds. */ - /** @} */ - - -/**@brief Maximum size of advertising data in octets. */ -#define BLE_GAP_ADV_MAX_SIZE (31) - - -/**@defgroup BLE_GAP_ADV_TYPES GAP Advertising types - * @{ */ -#define BLE_GAP_ADV_TYPE_ADV_IND 0x00 /**< Connectable undirected. */ -#define BLE_GAP_ADV_TYPE_ADV_DIRECT_IND 0x01 /**< Connectable directed. */ -#define BLE_GAP_ADV_TYPE_ADV_SCAN_IND 0x02 /**< Scannable undirected. */ -#define BLE_GAP_ADV_TYPE_ADV_NONCONN_IND 0x03 /**< Non connectable undirected. */ -/**@} */ - - -/**@defgroup BLE_GAP_ADV_FILTER_POLICIES GAP Advertising filter policies - * @{ */ -#define BLE_GAP_ADV_FP_ANY 0x00 /**< Allow scan requests and connect requests from any device. */ -#define BLE_GAP_ADV_FP_FILTER_SCANREQ 0x01 /**< Filter scan requests with whitelist. */ -#define BLE_GAP_ADV_FP_FILTER_CONNREQ 0x02 /**< Filter connect requests with whitelist. */ -#define BLE_GAP_ADV_FP_FILTER_BOTH 0x03 /**< Filter both scan and connect requests with whitelist. */ -/**@} */ - - -/**@defgroup BLE_GAP_ADV_TIMEOUT_VALUES GAP Advertising timeout values - * @{ */ -#define BLE_GAP_ADV_TIMEOUT_LIMITED_MAX (180) /**< Maximum advertising time in limited discoverable mode (TGAP(lim_adv_timeout) = 180s). */ -#define BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED (0) /**< Unlimited advertising in general discoverable mode. */ -/**@} */ - - -/**@defgroup BLE_GAP_DISC_MODES GAP Discovery modes - * @{ */ -#define BLE_GAP_DISC_MODE_NOT_DISCOVERABLE 0x00 /**< Not discoverable discovery Mode. */ -#define BLE_GAP_DISC_MODE_LIMITED 0x01 /**< Limited Discovery Mode. */ -#define BLE_GAP_DISC_MODE_GENERAL 0x02 /**< General Discovery Mode. */ -/**@} */ - - -/**@defgroup BLE_GAP_IO_CAPS GAP IO Capabilities - * @{ */ -#define BLE_GAP_IO_CAPS_DISPLAY_ONLY 0x00 /**< Display Only. */ -#define BLE_GAP_IO_CAPS_DISPLAY_YESNO 0x01 /**< Display and Yes/No entry. */ -#define BLE_GAP_IO_CAPS_KEYBOARD_ONLY 0x02 /**< Keyboard Only. */ -#define BLE_GAP_IO_CAPS_NONE 0x03 /**< No I/O capabilities. */ -#define BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY 0x04 /**< Keyboard and Display. */ -/**@} */ - - -/**@defgroup BLE_GAP_AUTH_KEY_TYPES GAP Authentication Key Types - * @{ */ -#define BLE_GAP_AUTH_KEY_TYPE_NONE 0x00 /**< No key (may be used to reject). */ -#define BLE_GAP_AUTH_KEY_TYPE_PASSKEY 0x01 /**< 6-digit Passkey. */ -#define BLE_GAP_AUTH_KEY_TYPE_OOB 0x02 /**< Out Of Band data. */ -/**@} */ - - -/**@defgroup BLE_GAP_KP_NOT_TYPES GAP Keypress Notification Types - * @{ */ -#define BLE_GAP_KP_NOT_TYPE_PASSKEY_START 0x00 /**< Passkey entry started. */ -#define BLE_GAP_KP_NOT_TYPE_PASSKEY_DIGIT_IN 0x01 /**< Passkey digit entered. */ -#define BLE_GAP_KP_NOT_TYPE_PASSKEY_DIGIT_OUT 0x02 /**< Passkey digit erased. */ -#define BLE_GAP_KP_NOT_TYPE_PASSKEY_CLEAR 0x03 /**< Passkey cleared. */ -#define BLE_GAP_KP_NOT_TYPE_PASSKEY_END 0x04 /**< Passkey entry completed. */ -/**@} */ - - -/**@defgroup BLE_GAP_SEC_STATUS GAP Security status - * @{ */ -#define BLE_GAP_SEC_STATUS_SUCCESS 0x00 /**< Procedure completed with success. */ -#define BLE_GAP_SEC_STATUS_TIMEOUT 0x01 /**< Procedure timed out. */ -#define BLE_GAP_SEC_STATUS_PDU_INVALID 0x02 /**< Invalid PDU received. */ -#define BLE_GAP_SEC_STATUS_RFU_RANGE1_BEGIN 0x03 /**< Reserved for Future Use range #1 begin. */ -#define BLE_GAP_SEC_STATUS_RFU_RANGE1_END 0x80 /**< Reserved for Future Use range #1 end. */ -#define BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED 0x81 /**< Passkey entry failed (user cancelled or other). */ -#define BLE_GAP_SEC_STATUS_OOB_NOT_AVAILABLE 0x82 /**< Out of Band Key not available. */ -#define BLE_GAP_SEC_STATUS_AUTH_REQ 0x83 /**< Authentication requirements not met. */ -#define BLE_GAP_SEC_STATUS_CONFIRM_VALUE 0x84 /**< Confirm value failed. */ -#define BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP 0x85 /**< Pairing not supported. */ -#define BLE_GAP_SEC_STATUS_ENC_KEY_SIZE 0x86 /**< Encryption key size. */ -#define BLE_GAP_SEC_STATUS_SMP_CMD_UNSUPPORTED 0x87 /**< Unsupported SMP command. */ -#define BLE_GAP_SEC_STATUS_UNSPECIFIED 0x88 /**< Unspecified reason. */ -#define BLE_GAP_SEC_STATUS_REPEATED_ATTEMPTS 0x89 /**< Too little time elapsed since last attempt. */ -#define BLE_GAP_SEC_STATUS_INVALID_PARAMS 0x8A /**< Invalid parameters. */ -#define BLE_GAP_SEC_STATUS_DHKEY_FAILURE 0x8B /**< DHKey check failure. */ -#define BLE_GAP_SEC_STATUS_NUM_COMP_FAILURE 0x8C /**< Numeric Comparison failure. */ -#define BLE_GAP_SEC_STATUS_BR_EDR_IN_PROG 0x8D /**< BR/EDR pairing in progress. */ -#define BLE_GAP_SEC_STATUS_X_TRANS_KEY_DISALLOWED 0x8E /**< BR/EDR Link Key cannot be used for LE keys. */ -#define BLE_GAP_SEC_STATUS_RFU_RANGE2_BEGIN 0x8F /**< Reserved for Future Use range #2 begin. */ -#define BLE_GAP_SEC_STATUS_RFU_RANGE2_END 0xFF /**< Reserved for Future Use range #2 end. */ -/**@} */ - - -/**@defgroup BLE_GAP_SEC_STATUS_SOURCES GAP Security status sources - * @{ */ -#define BLE_GAP_SEC_STATUS_SOURCE_LOCAL 0x00 /**< Local failure. */ -#define BLE_GAP_SEC_STATUS_SOURCE_REMOTE 0x01 /**< Remote failure. */ -/**@} */ - - -/**@defgroup BLE_GAP_CP_LIMITS GAP Connection Parameters Limits - * @{ */ -#define BLE_GAP_CP_MIN_CONN_INTVL_NONE 0xFFFF /**< No new minimum connection interval specified in connect parameters. */ -#define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest minimum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */ -#define BLE_GAP_CP_MIN_CONN_INTVL_MAX 0x0C80 /**< Highest minimum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */ -#define BLE_GAP_CP_MAX_CONN_INTVL_NONE 0xFFFF /**< No new maximum connection interval specified in connect parameters. */ -#define BLE_GAP_CP_MAX_CONN_INTVL_MIN 0x0006 /**< Lowest maximum connection interval permitted, in units of 1.25 ms, i.e. 7.5 ms. */ -#define BLE_GAP_CP_MAX_CONN_INTVL_MAX 0x0C80 /**< Highest maximum connection interval permitted, in units of 1.25 ms, i.e. 4 s. */ -#define BLE_GAP_CP_SLAVE_LATENCY_MAX 0x01F3 /**< Highest slave latency permitted, in connection events. */ -#define BLE_GAP_CP_CONN_SUP_TIMEOUT_NONE 0xFFFF /**< No new supervision timeout specified in connect parameters. */ -#define BLE_GAP_CP_CONN_SUP_TIMEOUT_MIN 0x000A /**< Lowest supervision timeout permitted, in units of 10 ms, i.e. 100 ms. */ -#define BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX 0x0C80 /**< Highest supervision timeout permitted, in units of 10 ms, i.e. 32 s. */ -/**@} */ - - -/**@brief GAP device name defines. */ -#define BLE_GAP_DEVNAME_DEFAULT "nRF5x" /**< Default device name value. */ -#define BLE_GAP_DEVNAME_DEFAULT_LEN 31 /**< Default number of octets in device name. */ -#define BLE_GAP_DEVNAME_MAX_LEN 248 /**< Maximum number of octets in device name. */ - - -/**@brief Disable RSSI events for connections */ -#define BLE_GAP_RSSI_THRESHOLD_INVALID 0xFF - -/**@defgroup BLE_GAP_PHYS GAP PHYs - * @{ */ -#define BLE_GAP_PHY_1MBPS 0x01 /**< 1 Mbps PHY. */ -#define BLE_GAP_PHY_2MBPS 0x02 /**< 2 Mbps PHY. */ -/**@} */ - -/**@defgroup BLE_GAP_CONN_SEC_MODE_SET_MACROS GAP attribute security requirement setters - * - * See @ref ble_gap_conn_sec_mode_t. - * @{ */ -/**@brief Set sec_mode pointed to by ptr to have no access rights.*/ -#define BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(ptr) do {(ptr)->sm = 0; (ptr)->lv = 0;} while(0) -/**@brief Set sec_mode pointed to by ptr to require no protection, open link.*/ -#define BLE_GAP_CONN_SEC_MODE_SET_OPEN(ptr) do {(ptr)->sm = 1; (ptr)->lv = 1;} while(0) -/**@brief Set sec_mode pointed to by ptr to require encryption, but no MITM protection.*/ -#define BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 2;} while(0) -/**@brief Set sec_mode pointed to by ptr to require encryption and MITM protection.*/ -#define BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 3;} while(0) -/**@brief Set sec_mode pointed to by ptr to require LESC encryption and MITM protection.*/ -#define BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(ptr) do {(ptr)->sm = 1; (ptr)->lv = 4;} while(0) -/**@brief Set sec_mode pointed to by ptr to require signing or encryption, no MITM protection needed.*/ -#define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 1;} while(0) -/**@brief Set sec_mode pointed to by ptr to require signing or encryption with MITM protection.*/ -#define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(ptr) do {(ptr)->sm = 2; (ptr)->lv = 2;} while(0) -/**@} */ - - -/**@brief GAP Security Random Number Length. */ -#define BLE_GAP_SEC_RAND_LEN 8 - - -/**@brief GAP Security Key Length. */ -#define BLE_GAP_SEC_KEY_LEN 16 - - -/**@brief GAP LE Secure Connections Elliptic Curve Diffie-Hellman P-256 Public Key Length. */ -#define BLE_GAP_LESC_P256_PK_LEN 64 - - -/**@brief GAP LE Secure Connections Elliptic Curve Diffie-Hellman DHKey Length. */ -#define BLE_GAP_LESC_DHKEY_LEN 32 - - -/**@brief GAP Passkey Length. */ -#define BLE_GAP_PASSKEY_LEN 6 - - -/**@brief Maximum amount of addresses in the whitelist. */ -#define BLE_GAP_WHITELIST_ADDR_MAX_COUNT (8) - - -/**@brief Maximum amount of identities in the device identities list. */ -#define BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT (8) - - -/**@defgroup GAP_SEC_MODES GAP Security Modes - * @{ */ -#define BLE_GAP_SEC_MODE 0x00 /**< No key (may be used to reject). */ -/**@} */ -/** @} */ - - -/**@addtogroup BLE_GAP_STRUCTURES Structures - * @{ */ - -/**@brief Bluetooth Low Energy address. */ -typedef struct -{ - uint8_t addr_id_peer : 1; /**< Only valid for peer addresses. - Reference to peer in device identities list (as set with @ref sd_ble_gap_device_identities_set) when peer is using privacy. */ - uint8_t addr_type : 7; /**< See @ref BLE_GAP_ADDR_TYPES. */ - uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */ -} ble_gap_addr_t; - - -/**@brief GAP connection parameters. - * - * @note When ble_conn_params_t is received in an event, both min_conn_interval and - * max_conn_interval will be equal to the connection interval set by the central. - * - * @note If both conn_sup_timeout and max_conn_interval are specified, then the following constraint applies: - * conn_sup_timeout * 4 > (1 + slave_latency) * max_conn_interval - * that corresponds to the following Bluetooth Spec requirement: - * The Supervision_Timeout in milliseconds shall be larger than - * (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds. - */ -typedef struct -{ - uint16_t min_conn_interval; /**< Minimum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/ - uint16_t max_conn_interval; /**< Maximum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/ - uint16_t slave_latency; /**< Slave Latency in number of connection events, see @ref BLE_GAP_CP_LIMITS.*/ - uint16_t conn_sup_timeout; /**< Connection Supervision Timeout in 10 ms units, see @ref BLE_GAP_CP_LIMITS.*/ -} ble_gap_conn_params_t; - - -/**@brief GAP connection security modes. - * - * Security Mode 0 Level 0: No access permissions at all (this level is not defined by the Bluetooth Core specification).\n - * Security Mode 1 Level 1: No security is needed (aka open link).\n - * Security Mode 1 Level 2: Encrypted link required, MITM protection not necessary.\n - * Security Mode 1 Level 3: MITM protected encrypted link required.\n - * Security Mode 1 Level 4: LESC MITM protected encrypted link required.\n - * Security Mode 2 Level 1: Signing or encryption required, MITM protection not necessary.\n - * Security Mode 2 Level 2: MITM protected signing required, unless link is MITM protected encrypted.\n - */ -typedef struct -{ - uint8_t sm : 4; /**< Security Mode (1 or 2), 0 for no permissions at all. */ - uint8_t lv : 4; /**< Level (1, 2, 3 or 4), 0 for no permissions at all. */ - -} ble_gap_conn_sec_mode_t; - - -/**@brief GAP connection security status.*/ -typedef struct -{ - ble_gap_conn_sec_mode_t sec_mode; /**< Currently active security mode for this connection.*/ - uint8_t encr_key_size; /**< Length of currently active encryption key, 7 to 16 octets (only applicable for bonding procedures). */ -} ble_gap_conn_sec_t; - - -/** - * @brief Device name and its properties - * @note If @ref max_len is more than @ref BLE_GAP_DEVNAME_DEFAULT_LEN and vloc is set to @ref BLE_GATTS_VLOC_STACK, the attribute table size must be increased to have room for the longer device name (see @ref ble_gatts_enable_params_t). - */ -typedef struct -{ - ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */ - uint8_t vloc:2; /**< Value location, see @ref BLE_GATTS_VLOCS.*/ - uint8_t *p_value; /**< Pointer to where the value (device name) is stored or will be stored.*/ - uint16_t current_len; /**< Current length in bytes of the memory pointed to by p_value.*/ - uint16_t max_len; /**< Maximum length in bytes of the memory pointed to by p_value.*/ -} ble_gap_device_name_t; - - -/** - * @brief BLE GAP initialization parameters. - */ -typedef struct -{ - uint8_t periph_conn_count; /**< Number of connections acting as a peripheral */ - uint8_t central_conn_count; /**< Number of connections acting as a central */ - uint8_t central_sec_count; /**< Number of SMP instances for all connections acting as a central. */ - ble_gap_device_name_t const *p_device_name; /**< Pointer to device name instance. If NULL, @ref sd_ble_enable() will set the device name to @ref BLE_GAP_DEVNAME_DEFAULT. */ -} ble_gap_enable_params_t; - - -/**@brief Identity Resolving Key. */ -typedef struct -{ - uint8_t irk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing IRK. */ -} ble_gap_irk_t; - - -/**@brief Channel mask for RF channels used in advertising. */ -typedef struct -{ - uint8_t ch_37_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 37 */ - uint8_t ch_38_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 38 */ - uint8_t ch_39_off : 1; /**< Setting this bit to 1 will turn off advertising on channel 39 */ -} ble_gap_adv_ch_mask_t; - - -/**@brief GAP advertising parameters. */ -typedef struct -{ - uint8_t type; /**< See @ref BLE_GAP_ADV_TYPES. */ - ble_gap_addr_t const *p_peer_addr; /**< Address of a known peer. - - When privacy is enabled and the local device use @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE addresses, the device identity list is searched for a matching - entry. If the local IRK for that device identity is set, the local IRK for that device will be used to generate the advertiser address field in the advertise packet. - - If type is @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this must be set to the targeted initiator. If the initiator is in the device identity list, - the peer IRK for that device will be used to generate the initiator address field in the ADV_DIRECT_IND packet. */ - uint8_t fp; /**< Filter Policy, see @ref BLE_GAP_ADV_FILTER_POLICIES. */ - uint16_t interval; /**< Advertising interval between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s), see @ref BLE_GAP_ADV_INTERVALS. - - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for high duty cycle directed advertising. - - If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, set @ref BLE_GAP_ADV_INTERVAL_MIN <= interval <= @ref BLE_GAP_ADV_INTERVAL_MAX for low duty cycle advertising.*/ - uint16_t timeout; /**< Advertising timeout between 0x0001 and 0x3FFF in seconds, 0x0000 disables timeout. See also @ref BLE_GAP_ADV_TIMEOUT_VALUES. If type equals @ref BLE_GAP_ADV_TYPE_ADV_DIRECT_IND, this parameter must be set to 0 for High duty cycle directed advertising. */ - ble_gap_adv_ch_mask_t channel_mask; /**< Advertising channel mask. See @ref ble_gap_adv_ch_mask_t. */ -} ble_gap_adv_params_t; - - -/**@brief GAP scanning parameters. */ -typedef struct -{ - uint8_t active : 1; /**< If 1, perform active scanning (scan requests). */ - uint8_t use_whitelist : 1; /**< If 1, filter advertisers using current active whitelist. */ - uint8_t adv_dir_report : 1; /**< If 1, also report directed advertisements where the initiator field is set to a private resolvable address, - even if the address did not resolve to an entry in the device identity list. A report will be generated - even if the peer is not in the whitelist. */ - uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ - uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */ - uint16_t timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ -} ble_gap_scan_params_t; - - -/**@brief Device Privacy. - * - * The privacy feature provides a way for the device to avoid being tracked over a period of time. - * The privacy feature, when enabled, hides the local device identity and replaces it with a private address - * that is automatically refreshed at a specified interval. - * - * If a device still wants to be recognized by other peers, it needs to share it's Identity Resolving Key (IRK). - * With this key, a device can generate a random private address that can only be recognized by peers in possession of that key, - * and devices can establish connections without revealing their real identities. - * - * @note If the device IRK is updated, the new IRK becomes the one to be distributed in all - * bonding procedures performed after @ref sd_ble_gap_privacy_set returns. - * The IRK distributed during bonding procedure is the device IRK that is active when @ref sd_ble_gap_sec_params_reply is called. - */ -typedef struct -{ - uint8_t privacy_mode; /**< Privacy mode, see @ref BLE_GAP_PRIVACY_MODES. Default is @ref BLE_GAP_PRIVACY_MODE_OFF. */ - uint8_t private_addr_type; /**< The private address type must be either @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. */ - uint16_t private_addr_cycle_s; /**< Private address cycle interval in seconds. Providing an address cycle value of 0 will use the default value defined by @ref BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S. */ - ble_gap_irk_t *p_device_irk; /**< When used as input, pointer to IRK structure that will be used as the default IRK. If NULL, the device default IRK will be used. - When used as output, pointer to IRK structure where the current default IRK will be written to. If NULL, this argument is ignored. - By default, the default IRK is used to generate random private resolvable addresses for the local device unless instructed otherwise. */ -} ble_gap_privacy_params_t; - - -/**@brief Physical Layer configuration - * @note tx_phys and rx_phys are bitfields, to indicate multiple preferred PHYs for each direction they can be ORed together. - * @code - * p_gap_phys->tx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; - * p_gap_phys->rx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; - * @endcode - * - */ -typedef struct -{ - uint8_t tx_phys; /**< Preferred transmit PHYs, see @ref BLE_GAP_PHYS. */ - uint8_t rx_phys; /**< Preferred receive PHYs, see @ref BLE_GAP_PHYS. */ -} ble_gap_phys_t; - -/** @brief Keys that can be exchanged during a bonding procedure. */ -typedef struct -{ - uint8_t enc : 1; /**< Long Term Key and Master Identification. */ - uint8_t id : 1; /**< Identity Resolving Key and Identity Address Information. */ - uint8_t sign : 1; /**< Connection Signature Resolving Key. */ - uint8_t link : 1; /**< Derive the Link Key from the LTK. */ -} ble_gap_sec_kdist_t; - - -/**@brief GAP security parameters. */ -typedef struct -{ - uint8_t bond : 1; /**< Perform bonding. */ - uint8_t mitm : 1; /**< Enable Man In The Middle protection. */ - uint8_t lesc : 1; /**< Enable LE Secure Connection pairing. */ - uint8_t keypress : 1; /**< Enable generation of keypress notifications. */ - uint8_t io_caps : 3; /**< IO capabilities, see @ref BLE_GAP_IO_CAPS. */ - uint8_t oob : 1; /**< The OOB data flag. - - In LE legacy pairing, this flag is set if a device has out of band authentication data. - The OOB method is used if both of the devices have out of band authentication data. - - In LE Secure Connections pairing, this flag is set if a device has the peer device's out of band authentication data. - The OOB method is used if at least one device has the peer device's OOB data available. */ - uint8_t min_key_size; /**< Minimum encryption key size in octets between 7 and 16. If 0 then not applicable in this instance. */ - uint8_t max_key_size; /**< Maximum encryption key size in octets between min_key_size and 16. */ - ble_gap_sec_kdist_t kdist_own; /**< Key distribution bitmap: keys that the local device will distribute. */ - ble_gap_sec_kdist_t kdist_peer; /**< Key distribution bitmap: keys that the remote device will distribute. */ -} ble_gap_sec_params_t; - - -/**@brief GAP Encryption Information. */ -typedef struct -{ - uint8_t ltk[BLE_GAP_SEC_KEY_LEN]; /**< Long Term Key. */ - uint8_t lesc : 1; /**< Key generated using LE Secure Connections. */ - uint8_t auth : 1; /**< Authenticated Key. */ - uint8_t ltk_len : 6; /**< LTK length in octets. */ -} ble_gap_enc_info_t; - - -/**@brief GAP Master Identification. */ -typedef struct -{ - uint16_t ediv; /**< Encrypted Diversifier. */ - uint8_t rand[BLE_GAP_SEC_RAND_LEN]; /**< Random Number. */ -} ble_gap_master_id_t; - - -/**@brief GAP Signing Information. */ -typedef struct -{ - uint8_t csrk[BLE_GAP_SEC_KEY_LEN]; /**< Connection Signature Resolving Key. */ -} ble_gap_sign_info_t; - - -/**@brief GAP LE Secure Connections P-256 Public Key. */ -typedef struct -{ - uint8_t pk[BLE_GAP_LESC_P256_PK_LEN]; /**< LE Secure Connections Elliptic Curve Diffie-Hellman P-256 Public Key. Stored in the standard SMP protocol format: {X,Y} both in little-endian. */ -} ble_gap_lesc_p256_pk_t; - - -/**@brief GAP LE Secure Connections DHKey. */ -typedef struct -{ - uint8_t key[BLE_GAP_LESC_DHKEY_LEN]; /**< LE Secure Connections Elliptic Curve Diffie-Hellman Key. Stored in little-endian. */ -} ble_gap_lesc_dhkey_t; - - -/**@brief GAP LE Secure Connections OOB data. */ -typedef struct -{ - ble_gap_addr_t addr; /**< Bluetooth address of the device. */ - uint8_t r[BLE_GAP_SEC_KEY_LEN]; /**< Random Number. */ - uint8_t c[BLE_GAP_SEC_KEY_LEN]; /**< Confirm Value. */ -} ble_gap_lesc_oob_data_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_CONNECTED. */ -typedef struct -{ - ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 - and the address is the device's identity address. */ - uint8_t role; /**< BLE role for this connection, see @ref BLE_GAP_ROLES */ - ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ -} ble_gap_evt_connected_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_DISCONNECTED. */ -typedef struct -{ - uint8_t reason; /**< HCI error code, see @ref BLE_HCI_STATUS_CODES. */ -} ble_gap_evt_disconnected_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE. */ -typedef struct -{ - ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ -} ble_gap_evt_conn_param_update_t; - -/**@brief Event Structure for @ref BLE_GAP_EVT_PHY_UPDATE. */ -typedef struct -{ - uint8_t status; /**< Status of the procedure, see @ref BLE_HCI_STATUS_CODES */ - uint8_t tx_phy; /**< TX PHY for this connection, see @ref BLE_GAP_PHYS. */ - uint8_t rx_phy; /**< RX PHY for this connection, see @ref BLE_GAP_PHYS. */ -} ble_gap_evt_phy_update_t; - -/**@brief Event structure for @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. */ -typedef struct -{ - ble_gap_sec_params_t peer_params; /**< Initiator Security Parameters. */ -} ble_gap_evt_sec_params_request_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_SEC_INFO_REQUEST. */ -typedef struct -{ - ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */ - ble_gap_master_id_t master_id; /**< Master Identification for LTK lookup. */ - uint8_t enc_info : 1; /**< If 1, Encryption Information required. */ - uint8_t id_info : 1; /**< If 1, Identity Information required. */ - uint8_t sign_info : 1; /**< If 1, Signing Information required. */ -} ble_gap_evt_sec_info_request_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_PASSKEY_DISPLAY. */ -typedef struct -{ - uint8_t passkey[BLE_GAP_PASSKEY_LEN]; /**< 6-digit passkey in ASCII ('0'-'9' digits only). */ - uint8_t match_request : 1; /**< If 1 requires the application to report the match using @ref sd_ble_gap_auth_key_reply - with either @ref BLE_GAP_AUTH_KEY_TYPE_NONE if there is no match or - @ref BLE_GAP_AUTH_KEY_TYPE_PASSKEY if there is a match. */ -} ble_gap_evt_passkey_display_t; - -/**@brief Event structure for @ref BLE_GAP_EVT_KEY_PRESSED. */ -typedef struct -{ - uint8_t kp_not; /**< Keypress notification type, see @ref BLE_GAP_KP_NOT_TYPES. */ -} ble_gap_evt_key_pressed_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_AUTH_KEY_REQUEST. */ -typedef struct -{ - uint8_t key_type; /**< See @ref BLE_GAP_AUTH_KEY_TYPES. */ -} ble_gap_evt_auth_key_request_t; - -/**@brief Event structure for @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST. */ -typedef struct -{ - ble_gap_lesc_p256_pk_t *p_pk_peer; /**< LE Secure Connections remote P-256 Public Key. This will point to the application-supplied memory - inside the keyset during the call to @ref sd_ble_gap_sec_params_reply. */ - uint8_t oobd_req :1; /**< LESC OOB data required. A call to @ref sd_ble_gap_lesc_oob_data_set is required to complete the procedure. */ -} ble_gap_evt_lesc_dhkey_request_t; - - -/**@brief Security levels supported. - * @note See Bluetooth Specification Version 4.2 Volume 3, Part C, Chapter 10, Section 10.2.1. -*/ -typedef struct -{ - uint8_t lv1 : 1; /**< If 1: Level 1 is supported. */ - uint8_t lv2 : 1; /**< If 1: Level 2 is supported. */ - uint8_t lv3 : 1; /**< If 1: Level 3 is supported. */ - uint8_t lv4 : 1; /**< If 1: Level 4 is supported. */ -} ble_gap_sec_levels_t; - - -/**@brief Encryption Key. */ -typedef struct -{ - ble_gap_enc_info_t enc_info; /**< Encryption Information. */ - ble_gap_master_id_t master_id; /**< Master Identification. */ -} ble_gap_enc_key_t; - - -/**@brief Identity Key. */ -typedef struct -{ - ble_gap_irk_t id_info; /**< Identity Resolving Key. */ - ble_gap_addr_t id_addr_info; /**< Identity Address. */ -} ble_gap_id_key_t; - - -/**@brief Security Keys. */ -typedef struct -{ - ble_gap_enc_key_t *p_enc_key; /**< Encryption Key, or NULL. */ - ble_gap_id_key_t *p_id_key; /**< Identity Key, or NULL. */ - ble_gap_sign_info_t *p_sign_key; /**< Signing Key, or NULL. */ - ble_gap_lesc_p256_pk_t *p_pk; /**< LE Secure Connections P-256 Public Key. When in debug mode the application must use the value defined - in the Core Bluetooth Specification v4.2 Vol.3, Part H, Section 2.3.5.6.1 */ -} ble_gap_sec_keys_t; - - -/**@brief Security key set for both local and peer keys. */ -typedef struct -{ - ble_gap_sec_keys_t keys_own; /**< Keys distributed by the local device. For LE Secure Connections the encryption key will be generated locally and will always be stored if bonding. */ - ble_gap_sec_keys_t keys_peer; /**< Keys distributed by the remote device. For LE Secure Connections, p_enc_key must always be NULL. */ -} ble_gap_sec_keyset_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_AUTH_STATUS. */ -typedef struct -{ - uint8_t auth_status; /**< Authentication status, see @ref BLE_GAP_SEC_STATUS. */ - uint8_t error_src : 2; /**< On error, source that caused the failure, see @ref BLE_GAP_SEC_STATUS_SOURCES. */ - uint8_t bonded : 1; /**< Procedure resulted in a bond. */ - ble_gap_sec_levels_t sm1_levels; /**< Levels supported in Security Mode 1. */ - ble_gap_sec_levels_t sm2_levels; /**< Levels supported in Security Mode 2. */ - ble_gap_sec_kdist_t kdist_own; /**< Bitmap stating which keys were exchanged (distributed) by the local device. If bonding with LE Secure Connections, the enc bit will be always set. */ - ble_gap_sec_kdist_t kdist_peer; /**< Bitmap stating which keys were exchanged (distributed) by the remote device. If bonding with LE Secure Connections, the enc bit will never be set. */ -} ble_gap_evt_auth_status_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_CONN_SEC_UPDATE. */ -typedef struct -{ - ble_gap_conn_sec_t conn_sec; /**< Connection security level. */ -} ble_gap_evt_conn_sec_update_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_TIMEOUT. */ -typedef struct -{ - uint8_t src; /**< Source of timeout event, see @ref BLE_GAP_TIMEOUT_SOURCES. */ -} ble_gap_evt_timeout_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_RSSI_CHANGED. */ -typedef struct -{ - int8_t rssi; /**< Received Signal Strength Indication in dBm. */ -} ble_gap_evt_rssi_changed_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_ADV_REPORT. */ -typedef struct -{ - ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 - and the address is the device's identity address. */ - ble_gap_addr_t direct_addr; /**< Set when the scanner is unable to resolve the private resolvable address of the initiator - field of a directed advertisement packet and the scanner has been enabled to report this in @ref ble_gap_scan_params_t::adv_dir_report. */ - int8_t rssi; /**< Received Signal Strength Indication in dBm. */ - uint8_t scan_rsp : 1; /**< If 1, the report corresponds to a scan response and the type field may be ignored. */ - uint8_t type : 2; /**< See @ref BLE_GAP_ADV_TYPES. Only valid if the scan_rsp field is 0. */ - uint8_t dlen : 5; /**< Advertising or scan response data length. */ - uint8_t data[BLE_GAP_ADV_MAX_SIZE]; /**< Advertising or scan response data. */ -} ble_gap_evt_adv_report_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_SEC_REQUEST. */ -typedef struct -{ - uint8_t bond : 1; /**< Perform bonding. */ - uint8_t mitm : 1; /**< Man In The Middle protection requested. */ - uint8_t lesc : 1; /**< LE Secure Connections requested. */ - uint8_t keypress : 1; /**< Generation of keypress notifications requested. */ -} ble_gap_evt_sec_request_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST. */ -typedef struct -{ - ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ -} ble_gap_evt_conn_param_update_request_t; - - -/**@brief Event structure for @ref BLE_GAP_EVT_SCAN_REQ_REPORT. */ -typedef struct -{ - int8_t rssi; /**< Received Signal Strength Indication in dBm. */ - ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr resolved: @ref ble_gap_addr_t::addr_id_peer is set to 1 - and the address is the device's identity address. */ -} ble_gap_evt_scan_req_report_t; - - -/**@brief GAP event structure. */ -typedef struct -{ - uint16_t conn_handle; /**< Connection Handle on which event occurred. */ - union /**< union alternative identified by evt_id in enclosing struct. */ - { - ble_gap_evt_connected_t connected; /**< Connected Event Parameters. */ - ble_gap_evt_disconnected_t disconnected; /**< Disconnected Event Parameters. */ - ble_gap_evt_conn_param_update_t conn_param_update; /**< Connection Parameter Update Parameters. */ - ble_gap_evt_sec_params_request_t sec_params_request; /**< Security Parameters Request Event Parameters. */ - ble_gap_evt_sec_info_request_t sec_info_request; /**< Security Information Request Event Parameters. */ - ble_gap_evt_passkey_display_t passkey_display; /**< Passkey Display Event Parameters. */ - ble_gap_evt_key_pressed_t key_pressed; /**< Key Pressed Event Parameters. */ - ble_gap_evt_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */ - ble_gap_evt_lesc_dhkey_request_t lesc_dhkey_request; /**< LE Secure Connections DHKey calculation request. */ - ble_gap_evt_auth_status_t auth_status; /**< Authentication Status Event Parameters. */ - ble_gap_evt_conn_sec_update_t conn_sec_update; /**< Connection Security Update Event Parameters. */ - ble_gap_evt_timeout_t timeout; /**< Timeout Event Parameters. */ - ble_gap_evt_rssi_changed_t rssi_changed; /**< RSSI Event Parameters. */ - ble_gap_evt_adv_report_t adv_report; /**< Advertising Report Event Parameters. */ - ble_gap_evt_sec_request_t sec_request; /**< Security Request Event Parameters. */ - ble_gap_evt_conn_param_update_request_t conn_param_update_request; /**< Connection Parameter Update Parameters. */ - ble_gap_evt_scan_req_report_t scan_req_report; /**< Scan Request Report Parameters. */ - ble_gap_evt_phy_update_t phy_update; /**< PHY Update Parameters. */ - } params; /**< Event Parameters. */ -} ble_gap_evt_t; - - -/**@brief Channel Map option. - * Used with @ref sd_ble_opt_get to get the current channel map - * or @ref sd_ble_opt_set to set a new channel map. When setting the - * channel map, it applies to all current and future connections. When getting the - * current channel map, it applies to a single connection and the connection handle - * must be supplied. - * - * @note Setting the channel map may take some time, depending on connection parameters. - * The time taken may be different for each connection and the get operation will - * return the previous channel map until the new one has taken effect. - * - * @note After setting the channel map, by spec it can not be set again until at least 1 s has passed. - * See Bluetooth Specification Version 4.1 Volume 2, Part E, Section 7.3.46. - * - * @retval ::NRF_SUCCESS Get or set successful. - * @retval ::NRF_ERROR_BUSY Channel map was set again before enough time had passed. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied for get. - * @retval ::NRF_ERROR_NOT_SUPPORTED Returned by sd_ble_opt_set in peripheral-only SoftDevices. - * - */ -typedef struct -{ - uint16_t conn_handle; /**< Connection Handle (only applicable for get) */ - uint8_t ch_map[5]; /**< Channel Map (37-bit). */ -} ble_gap_opt_ch_map_t; - - -/**@brief Local connection latency option. - * - * Local connection latency is a feature which enables the slave to improve - * current consumption by ignoring the slave latency set by the peer. The - * local connection latency can only be set to a multiple of the slave latency, - * and cannot be longer than half of the supervision timeout. - * - * Used with @ref sd_ble_opt_set to set the local connection latency. The - * @ref sd_ble_opt_get is not supported for this option, but the actual - * local connection latency (unless set to NULL) is set as a return parameter - * when setting the option. - * - * @note The latency set will be truncated down to the closest slave latency event - * multiple, or the nearest multiple before half of the supervision timeout. - * - * @note The local connection latency is disabled by default, and needs to be enabled for new - * connections and whenever the connection is updated. - * - * @retval ::NRF_SUCCESS Set successfully. - * @retval ::NRF_ERROR_NOT_SUPPORTED Get is not supported. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter. - */ -typedef struct -{ - uint16_t conn_handle; /**< Connection Handle */ - uint16_t requested_latency; /**< Requested local connection latency. */ - uint16_t * p_actual_latency; /**< Pointer to storage for the actual local connection latency (can be set to NULL to skip return value). */ -} ble_gap_opt_local_conn_latency_t; - - -/**@brief Passkey Option. - * - * Structure containing the passkey to be used during pairing. This can be used with @ref - * sd_ble_opt_set to make the SoftDevice use a pre-programmed passkey for authentication - * instead of generating a random one. - * - * @note Repeated pairing attempts using the same pre-programmed passkey makes pairing vulnerable to MITM attacks. - * - * @note @ref sd_ble_opt_get is not supported for this option. - * - */ -typedef struct -{ - uint8_t * p_passkey; /**< Pointer to 6-digit ASCII string (digit 0..9 only, no NULL termination) passkey to be used during pairing. If this is NULL, the SoftDevice will generate a random passkey if required.*/ -} ble_gap_opt_passkey_t; - - -/**@brief Scan request report option. - * - * This can be used with @ref sd_ble_opt_set to make the SoftDevice send - * @ref BLE_GAP_EVT_SCAN_REQ_REPORT events. - * - * @note Due to the limited space reserved for scan request report events, - * not all received scan requests will be reported. - * - * @note If whitelisting is used, only whitelisted requests are reported. - * - * @retval ::NRF_SUCCESS Set successfully. - * @retval ::NRF_ERROR_INVALID_STATE When advertising is ongoing while the option is set. - */ -typedef struct -{ - uint8_t enable : 1; /**< Enable scan request reports. */ -} ble_gap_opt_scan_req_report_t; - - -/**@brief Compatibility mode option. - * - * This can be used with @ref sd_ble_opt_set to enable and disable - * compatibility modes. Compatibility modes are disabled by default. - * - * @note Compatibility mode 1 enables interoperability with devices that do not support - * a value of 0 for the WinOffset parameter in the Link Layer CONNECT_REQ packet. - * - * @retval ::NRF_SUCCESS Set successfully. - * @retval ::NRF_ERROR_INVALID_STATE When connection creation is ongoing while mode 1 is set. - */ -typedef struct -{ - uint8_t mode_1_enable : 1; /**< Enable compatibility mode 1.*/ -} ble_gap_opt_compat_mode_t; - -/**@brief Data length extension option. - * - * This can be used with @ref sd_ble_opt_set to enable longer data packets. - * - * @note An rxtx_max_pdu_payload_size of 0 will result in the default minimum payload size of 27. - * @note Not supported by SoftDevices for nRF51 Series devices. - * @note The parameters for a connection are applied when a connection complete - * event is generated for the host. - * - * - * @retval ::NRF_SUCCESS Set successfully. - * @retval ::NRF_ERROR_INVALID_PARAM If the payload size is not 0 or a valid link layer PDU payload size. - * @retval ::NRF_ERROR_NOT_SUPPORTED If called on a SoftDevice designed for nRF51 (e.g. s130). - */ -typedef struct -{ - uint8_t rxtx_max_pdu_payload_size; /**< Max PDU payload size (in octets). */ -} ble_gap_opt_ext_len_t; - - - -/**@brief Authenticated payload timeout option. - * - * This can be used with @ref sd_ble_opt_set to change the Authenticated payload timeout to a value other than the default of 8 minutes. - * - * @note The authenticated payload timeout event ::BLE_GAP_TIMEOUT_SRC_AUTH_PAYLOAD will be generated - * if auth_payload_timeout time has elapsed without receiving a packet with a valid MIC on an encrypted - * link. - * - * @note The LE ping procedure will be initiated before the timer expires to give the peer a chance - * to reset the timer. In addition the stack will try to prioritize running of LE ping over other - * activities to increase chances of finishing LE ping before timer expires. To avoid side-effects - * on other activities, it is recommended to use high timeout values. - * Recommended timeout > 2*(connInterval * (6 + connSlaveLatency)). - * - * @retval ::NRF_SUCCESS Set successfully. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. auth_payload_timeout was outside of allowed range. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle parameter. - */ -typedef struct -{ - uint16_t conn_handle; /**< Connection Handle */ - uint16_t auth_payload_timeout; /**< Requested timeout in 10 ms unit. Maximum is 48 000 (=480 000 ms =8 min). Minimum is 1 (=10ms). */ -} ble_gap_opt_auth_payload_timeout_t; - -/**@brief Preferred PHY option - * - * @details This can be used with @ref sd_ble_opt_set to change the preferred PHYs. Before this function is called the PHYs - * for peer initiated PHY Update procedure is @ref BLE_GAP_PHY_1MBPS. If @ref ble_gap_opt_preferred_phys_t::tx_phys or - * @ref ble_gap_opt_preferred_phys_t::rx_phys is 0, then the stack will select PHYs based on the peer requirements on that specific direction. - * - * @note The preferred PHYs are only valid for newly created connections after this option is called. If the PHYs should be - * changed for an existing link the @ref sd_ble_gap_phy_request would have to be called, and that would try to update the - * PHYs for the given link. - * - * @note tx_phys and rx_phys are bitfields, to indicate multiple preferred PHYs for each direction they can be ORed together. - * @code - * tx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; - * rx_phys = BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_2MBPS; - * @endcode - * - * @events - * @event{@ref BLE_GAP_EVT_PHY_UPDATE, Result of the PHY Update if initiated by peer.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_CENTRAL_PHY_REQUEST} - * @mmsc{@ref BLE_GAP_PERIPHERAL_PHY_REQUEST} - * @endmscs - * - * @retval ::NRF_SUCCESS Set successfully. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - */ -typedef struct -{ - uint8_t tx_phys; /**< Preferred transmit PHYs, see @ref BLE_GAP_PHYS. */ - uint8_t rx_phys; /**< Preferred receive PHYs, see @ref BLE_GAP_PHYS. */ -} ble_gap_opt_preferred_phys_t; - -/**@brief Option structure for GAP options. */ -typedef union -{ - ble_gap_opt_ch_map_t ch_map; /**< Parameters for the Channel Map option. */ - ble_gap_opt_local_conn_latency_t local_conn_latency; /**< Parameters for the Local connection latency option */ - ble_gap_opt_passkey_t passkey; /**< Parameters for the Passkey option.*/ - ble_gap_opt_scan_req_report_t scan_req_report; /**< Parameters for the scan request report option.*/ - ble_gap_opt_compat_mode_t compat_mode; /**< Parameters for the compatibility mode option.*/ - ble_gap_opt_ext_len_t ext_len; /**< Parameters for the extended length option. */ - ble_gap_opt_auth_payload_timeout_t auth_payload_timeout; /**< Parameters for the authenticated payload timeout option.*/ - ble_gap_opt_preferred_phys_t preferred_phys; /**< Parameters for the preferred PHYs option. */ -} ble_gap_opt_t; -/**@} */ - - -/**@addtogroup BLE_GAP_FUNCTIONS Functions - * @{ */ - -/**@brief Set the local Bluetooth identity address. - * - * The local Bluetooth identity address is the address that identifies this device to other peers. - * The address type must be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC. - * The identity address cannot be changed while roles are running. - * - * @note This address will be distributed to the peer during bonding. - * If the address changes, the address stored in the peer device will not be valid and the ability to - * reconnect using the old address will be lost. - * - * @note By default the SoftDevice will set an address of type @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC upon being - * enabled. The address is a random number populated during the IC manufacturing process and remains unchanged - * for the lifetime of each IC. - * - * @mscs - * @mmsc{@ref BLE_GAP_ADV_MSC} - * @endmscs - * - * @param[in] p_addr Pointer to address structure. - * - * @retval ::NRF_SUCCESS Address successfully set. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address. - * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. - * @retval ::NRF_ERROR_INVALID_STATE The identity address cannot be changed while the roles are running. - */ -SVCALL(SD_BLE_GAP_ADDR_SET, uint32_t, sd_ble_gap_addr_set(ble_gap_addr_t const *p_addr)); - - -/**@brief Get local Bluetooth identity address. - * - * @note This will always return the identity address irrespective of the privacy settings, - * i.e. the address type will always be either @ref BLE_GAP_ADDR_TYPE_PUBLIC or @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC. - * - * @param[out] p_addr Pointer to address structure to be filled in. - * - * @retval ::NRF_SUCCESS Address successfully retrieved. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid or NULL pointer supplied. - */ -SVCALL(SD_BLE_GAP_ADDR_GET, uint32_t, sd_ble_gap_addr_get(ble_gap_addr_t *p_addr)); - - -/**@brief Set the active whitelist in the SoftDevice. - * - * @note Only one whitelist can be used at a time and the whitelist is shared between the BLE roles. - * The whitelist cannot be set if a BLE role is using the whitelist. - * - * @note If an address is resolved using the information in the device identity list, then the whitelist - * filter policy applies to the peer identity address and not the resolvable address sent on air. - * - * @mscs - * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} - * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_PRIVATE_SCAN_MSC} - * @endmscs - * - * @param[in] pp_wl_addrs Pointer to a whitelist of peer addresses, if NULL the whitelist will be cleared. - * @param[in] len Length of the whitelist, maximum @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. - * - * @retval ::NRF_SUCCESS The whitelist is successfully set/cleared. - * @retval ::NRF_ERROR_INVALID_ADDR The whitelist (or one of its entries) provided is invalid. - * @retval ::BLE_ERROR_GAP_WHITELIST_IN_USE The whitelist is in use by a BLE role and cannot be set or cleared. - * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. - * @retval ::NRF_ERROR_DATA_SIZE The given whitelist size is invalid (zero or too large); this can only return when - * pp_wl_addrs is not NULL. - */ -SVCALL(SD_BLE_GAP_WHITELIST_SET, uint32_t, sd_ble_gap_whitelist_set(ble_gap_addr_t const * const * pp_wl_addrs, uint8_t len)); - - -/**@brief Set device identity list. - * - * @note Only one device identity list can be used at a time and the list is shared between the BLE roles. - * The device identity list cannot be set if a BLE role is using the list. - * - * @param[in] pp_id_keys Pointer to an array of peer identity addresses and peer IRKs, if NULL the device identity list will be cleared. - * @param[in] pp_local_irks Pointer to an array of local IRKs. Each entry in the array maps to the entry in pp_id_keys at the same index. - * To fill in the list with the currently set device IRK for all peers, set to NULL. - * @param[in] len Length of the device identity list, maximum @ref BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT. - * - * @mscs - * @mmsc{@ref BLE_GAP_PRIVACY_ADV_MSC} - * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_MSC} - * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_PRIVATE_SCAN_MSC} - * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_CONN_PRIV_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_CONN_PRIV_MSC} - * @endmscs - * - * @retval ::NRF_SUCCESS The device identity list successfully set/cleared. - * @retval ::NRF_ERROR_INVALID_ADDR The device identity list (or one of its entries) provided is invalid. - This code may be returned if the local IRK list also has an invalid entry. - * @retval ::BLE_ERROR_GAP_DEVICE_IDENTITIES_IN_USE The device identity list is in use and cannot be set or cleared. - * @retval ::BLE_ERROR_GAP_DEVICE_IDENTITIES_DUPLICATE The device identity list contains multiple entries with the same identity address. - * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. - * @retval ::NRF_ERROR_DATA_SIZE The given device identity list size invalid (zero or too large); this can - * only return when pp_id_keys is not NULL. - */ -SVCALL(SD_BLE_GAP_DEVICE_IDENTITIES_SET, uint32_t, sd_ble_gap_device_identities_set(ble_gap_id_key_t const * const * pp_id_keys, ble_gap_irk_t const * const * pp_local_irks, uint8_t len)); - - -/**@brief Set privacy settings. - * - * @note Privacy settings cannot be set while BLE roles are running. - * - * @param[in] p_privacy_params Privacy settings. - * - * @mscs - * @mmsc{@ref BLE_GAP_PRIVACY_ADV_MSC} - * @mmsc{@ref BLE_GAP_PRIVACY_SCAN_MSC} - * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} - * @endmscs - * - * @retval ::NRF_SUCCESS Set successfully. - * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. - * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid address type is supplied. - * @retval ::NRF_ERROR_INVALID_ADDR The pointer to privacy settings is NULL or invalid. - Otherwise, the p_device_irk pointer in privacy parameter is an invalid pointer. - * @retval ::NRF_ERROR_INVALID_PARAM Out of range parameters are provided. - * @retval ::NRF_ERROR_INVALID_STATE Privacy settings cannot be changed while BLE roles using privacy are enabled. - */ -SVCALL(SD_BLE_GAP_PRIVACY_SET, uint32_t, sd_ble_gap_privacy_set(ble_gap_privacy_params_t const *p_privacy_params)); - - -/**@brief Get privacy settings. - * - * @note The privacy settings returned include the current device irk as well. - * - * @param[in] p_privacy_params Privacy settings. - * - * @retval ::NRF_SUCCESS Privacy settings read. - * @retval ::NRF_ERROR_INVALID_ADDR The pointer given for returning the privacy settings may be NULL or invalid. - Otherwise, the p_device_irk pointer in privacy parameter is an invalid pointer. - */ -SVCALL(SD_BLE_GAP_PRIVACY_GET, uint32_t, sd_ble_gap_privacy_get(ble_gap_privacy_params_t *p_privacy_params)); - - -/**@brief Set, clear or update advertising and scan response data. - * - * @note The format of the advertising data will be checked by this call to ensure interoperability. - * Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and - * duplicating the local name in the advertising data and scan response data. - * - * @note To clear the advertising data and set it to a 0-length packet, simply provide a valid pointer (p_data/p_sr_data) with its corresponding - * length (dlen/srdlen) set to 0. - * - * @note The call will fail if p_data and p_sr_data are both NULL since this would have no effect. - * - * @mscs - * @mmsc{@ref BLE_GAP_ADV_MSC} - * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} - * @endmscs - * - * @param[in] p_data Raw data to be placed in advertising packet. If NULL, no changes are made to the current advertising packet data. - * @param[in] dlen Data length for p_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_data is NULL, can be 0 if p_data is not NULL. - * @param[in] p_sr_data Raw data to be placed in scan response packet. If NULL, no changes are made to the current scan response packet data. - * @param[in] srdlen Data length for p_sr_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL. - * - * @retval ::NRF_SUCCESS Advertising data successfully updated or cleared. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, both p_data and p_sr_data cannot be NULL. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_FLAGS Invalid combination of advertising flags supplied. - * @retval ::NRF_ERROR_INVALID_DATA Invalid data type(s) supplied, check the advertising data format specification. - * @retval ::NRF_ERROR_INVALID_LENGTH Invalid data length(s) supplied. - * @retval ::NRF_ERROR_NOT_SUPPORTED Unsupported data type. - * @retval ::BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied. - */ -SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const *p_data, uint8_t dlen, uint8_t const *p_sr_data, uint8_t srdlen)); - - -/**@brief Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). - * - * @note An application can start an advertising procedure for broadcasting purposes while a connection - * is active. After a @ref BLE_GAP_EVT_CONNECTED event is received, this function may therefore - * be called to start a broadcast advertising procedure. The advertising procedure - * cannot however be connectable (it must be of type @ref BLE_GAP_ADV_TYPE_ADV_SCAN_IND or - * @ref BLE_GAP_ADV_TYPE_ADV_NONCONN_IND). @note Only one advertiser may be active at any time. - * - * @events - * @event{@ref BLE_GAP_EVT_CONNECTED, Generated after connection has been established through connectable advertising.} - * @event{@ref BLE_GAP_EVT_TIMEOUT, Advertisement has timed out.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_ADV_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_CONN_PRIV_MSC} - * @mmsc{@ref BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC} - * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} - * @endmscs - * - * @param[in] p_adv_params Pointer to advertising parameters structure. - * - * @retval ::NRF_SUCCESS The BLE stack has started advertising. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::NRF_ERROR_CONN_COUNT The limit of available connections has been reached; connectable advertiser cannot be started. - * @retval ::NRF_ERROR_NO_MEM The configured memory pools (see @ref ble_conn_bw_counts_t) are not large enough for the - * bandwidth selected for this connection. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check the accepted ranges and limits. - * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Bluetooth address supplied. - * @retval ::BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible. - * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. - * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. - * Stop one or more currently active roles (Central, Peripheral or Observer) and try again - */ -SVCALL(SD_BLE_GAP_ADV_START, uint32_t, sd_ble_gap_adv_start(ble_gap_adv_params_t const *p_adv_params)); - - -/**@brief Stop advertising (GAP Discoverable, Connectable modes, Broadcast Procedure). - * - * @mscs - * @mmsc{@ref BLE_GAP_ADV_MSC} - * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} - * @endmscs - * - * @retval ::NRF_SUCCESS The BLE stack has stopped advertising. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in advertising state). - */ -SVCALL(SD_BLE_GAP_ADV_STOP, uint32_t, sd_ble_gap_adv_stop(void)); - - -/**@brief Update connection parameters. - * - * @details In the central role this will initiate a Link Layer connection parameter update procedure, - * otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for - * the central to perform the procedure. In both cases, and regardless of success or failure, the application - * will be informed of the result with a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE event. - * - * @details This function can be used as a central both to reply to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST or to start the procedure unrequested. - * - * @events - * @event{@ref BLE_GAP_EVT_CONN_PARAM_UPDATE, Result of the connection parameter update procedure.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_CPU_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} - * @mmsc{@ref BLE_GAP_MULTILINK_CPU_MSC} - * @mmsc{@ref BLE_GAP_MULTILINK_CTRL_PROC_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_CPU_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_conn_params Pointer to desired connection parameters. If NULL is provided on a peripheral role, - * the parameters in the PPCP characteristic of the GAP service will be used instead. - * If NULL is provided on a central role and in response to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, the peripheral request will be rejected - * - * @retval ::NRF_SUCCESS The Connection Update procedure has been started successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, process pending events and wait for pending procedures to complete and retry. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. - */ -SVCALL(SD_BLE_GAP_CONN_PARAM_UPDATE, uint32_t, sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_t const *p_conn_params)); - - -/**@brief Disconnect (GAP Link Termination). - * - * @details This call initiates the disconnection procedure, and its completion will be communicated to the application - * with a @ref BLE_GAP_EVT_DISCONNECTED event. - * - * @events - * @event{@ref BLE_GAP_EVT_DISCONNECTED, Generated when disconnection procedure is complete.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_CONN_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES (accepted values are @ref BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and @ref BLE_HCI_CONN_INTERVAL_UNACCEPTABLE). - * - * @retval ::NRF_SUCCESS The disconnection procedure has been started successfully. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (disconnection is already in progress). - */ -SVCALL(SD_BLE_GAP_DISCONNECT, uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code)); - - -/**@brief Set the radio's transmit power. - * - * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, 3, and 4 dBm). - * - * @note The +3dBm setting is only available on nRF52 series ICs. - * @note The -30dBm setting is only available on nRF51 series ICs. - * @note The -40dBm setting is only available on nRF52 series ICs. - * - * @retval ::NRF_SUCCESS Successfully changed the transmit power. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - */ -SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power)); - - -/**@brief Set GAP Appearance value. - * - * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES. - * - * @retval ::NRF_SUCCESS Appearance value set successfully. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - */ -SVCALL(SD_BLE_GAP_APPEARANCE_SET, uint32_t, sd_ble_gap_appearance_set(uint16_t appearance)); - - -/**@brief Get GAP Appearance value. - * - * @param[out] p_appearance Pointer to appearance (16-bit) to be filled in, see @ref BLE_APPEARANCES. - * - * @retval ::NRF_SUCCESS Appearance value retrieved successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - */ -SVCALL(SD_BLE_GAP_APPEARANCE_GET, uint32_t, sd_ble_gap_appearance_get(uint16_t *p_appearance)); - - -/**@brief Set GAP Peripheral Preferred Connection Parameters. - * - * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the desired parameters. - * - * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters set successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - */ -SVCALL(SD_BLE_GAP_PPCP_SET, uint32_t, sd_ble_gap_ppcp_set(ble_gap_conn_params_t const *p_conn_params)); - - -/**@brief Get GAP Peripheral Preferred Connection Parameters. - * - * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters will be stored. - * - * @retval ::NRF_SUCCESS Peripheral Preferred Connection Parameters retrieved successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - */ -SVCALL(SD_BLE_GAP_PPCP_GET, uint32_t, sd_ble_gap_ppcp_get(ble_gap_conn_params_t *p_conn_params)); - - -/**@brief Set GAP device name. - * - * @param[in] p_write_perm Write permissions for the Device Name characteristic, see @ref ble_gap_conn_sec_mode_t. - * @param[in] p_dev_name Pointer to a UTF-8 encoded, non NULL-terminated string. - * @param[in] len Length of the UTF-8, non NULL-terminated string pointed to by p_dev_name in octets (must be smaller or equal than @ref BLE_GAP_DEVNAME_MAX_LEN). - * - * @note If the device name is located in application flash memory (see @ref ble_gap_device_name_t), it cannot be changed. Then @ref NRF_ERROR_FORBIDDEN will be returned. - * - * @retval ::NRF_SUCCESS GAP device name and permissions set successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. - * @retval ::NRF_ERROR_FORBIDDEN Device name is not writable. - */ -SVCALL(SD_BLE_GAP_DEVICE_NAME_SET, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len)); - - -/**@brief Get GAP device name. - * - * @note If the device name is longer than the size of the supplied buffer, - * p_len will return the complete device name length, - * and not the number of bytes actually returned in p_dev_name. - * The application may use this information to allocate a suitable buffer size. - * - * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8 non NULL-terminated string will be placed. Set to NULL to obtain the complete device name length. - * @param[in,out] p_len Length of the buffer pointed by p_dev_name, complete device name length on output. - * - * @retval ::NRF_SUCCESS GAP device name retrieved successfully. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. - */ -SVCALL(SD_BLE_GAP_DEVICE_NAME_GET, uint32_t, sd_ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_len)); - - -/**@brief Initiate the GAP Authentication procedure. - * - * @details In the central role, this function will send an SMP Pairing Request (or an SMP Pairing Failed if rejected), - * otherwise in the peripheral role, an SMP Security Request will be sent. - * - * @events - * @event{Depending on the security parameters set and the packet exchanges with the peer\, the following events may be generated:} - * @event{@ref BLE_GAP_EVT_SEC_PARAMS_REQUEST} - * @event{@ref BLE_GAP_EVT_SEC_INFO_REQUEST} - * @event{@ref BLE_GAP_EVT_PASSKEY_DISPLAY} - * @event{@ref BLE_GAP_EVT_KEY_PRESSED} - * @event{@ref BLE_GAP_EVT_AUTH_KEY_REQUEST} - * @event{@ref BLE_GAP_EVT_LESC_DHKEY_REQUEST} - * @event{@ref BLE_GAP_EVT_CONN_SEC_UPDATE} - * @event{@ref BLE_GAP_EVT_AUTH_STATUS} - * @event{@ref BLE_GAP_EVT_TIMEOUT} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_SEC_REQ_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_SEC_REQ_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_PAIRING_JW_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_JW_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_sec_params Pointer to the @ref ble_gap_sec_params_t structure with the security parameters to be used during the pairing or bonding procedure. - * In the peripheral role, only the bond, mitm, lesc and keypress fields of this structure are used. - * In the central role, this pointer may be NULL to reject a Security Request. - * - * @retval ::NRF_SUCCESS Successfully initiated authentication procedure. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. - * @retval ::NRF_ERROR_NO_MEM The maximum number of authentication procedures that can run in parallel for the given role is reached. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::NRF_ERROR_NOT_SUPPORTED Setting of sign or link fields in @ref ble_gap_sec_kdist_t not supported. - * @retval ::NRF_ERROR_TIMEOUT A SMP timeout has occurred, and further SMP operations on this link is prohibited. - */ -SVCALL(SD_BLE_GAP_AUTHENTICATE, uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const *p_sec_params)); - - -/**@brief Reply with GAP security parameters. - * - * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. - * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. - * - * @events - * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_JW_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_BONDING_JW_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_PERIPH_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_CENTRAL_OOB_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_BONDING_STATIC_PK_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_CONFIRM_FAIL_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_PAIRING_JW_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_PD_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_KS_TOO_SMALL_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_APP_ERROR_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_REMOTE_PAIRING_FAIL_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_PAIRING_TIMEOUT_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_PAIRING_JW_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_JW_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS. - * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters structure. In the central role this must be set to NULL, as the parameters have - * already been provided during a previous call to @ref sd_ble_gap_authenticate. - * @param[in,out] p_sec_keyset Pointer to a @ref ble_gap_sec_keyset_t security keyset structure. Any keys generated and/or distributed as a result of the ongoing security procedure - * will be stored into the memory referenced by the pointers inside this structure. The keys will be stored and available to the application - * upon reception of a @ref BLE_GAP_EVT_AUTH_STATUS event. - * Note that the SoftDevice expects the application to provide memory for storing the - * peer's keys. So it must be ensured that the relevant pointers inside this structure are not NULL. The pointers to the local key - * can, however, be NULL, in which case, the local key data will not be available to the application upon reception of the - * @ref BLE_GAP_EVT_AUTH_STATUS event. - * - * @retval ::NRF_SUCCESS Successfully accepted security parameter from the application. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::NRF_ERROR_NOT_SUPPORTED Setting of sign or link fields in @ref ble_gap_sec_kdist_t not supported. - */ -SVCALL(SD_BLE_GAP_SEC_PARAMS_REPLY, uint32_t, sd_ble_gap_sec_params_reply(uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params, ble_gap_sec_keyset_t const *p_sec_keyset)); - - -/**@brief Reply with an authentication key. - * - * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_REQUEST or a @ref BLE_GAP_EVT_PASSKEY_DISPLAY, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. - * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. - * - * @events - * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_BONDING_PK_CENTRAL_OOB_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] key_type See @ref BLE_GAP_AUTH_KEY_TYPES. - * @param[in] p_key If key type is @ref BLE_GAP_AUTH_KEY_TYPE_NONE, then NULL. - * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_PASSKEY, then a 6-byte ASCII string (digit 0..9 only, no NULL termination) - * or NULL when confirming LE Secure Connections Numeric Comparison. - * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format. - * - * @retval ::NRF_SUCCESS Authentication key successfully set. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - */ -SVCALL(SD_BLE_GAP_AUTH_KEY_REPLY, uint32_t, sd_ble_gap_auth_key_reply(uint16_t conn_handle, uint8_t key_type, uint8_t const *p_key)); - -/**@brief Reply with an LE Secure connections DHKey. - * - * @details This function is only used to reply to a @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST, calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. - * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. - * - * @events - * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_LESC_PAIRING_JW_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_NC_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_PD_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_dhkey LE Secure Connections DHKey. - * - * @retval ::NRF_SUCCESS DHKey successfully set. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - */ -SVCALL(SD_BLE_GAP_LESC_DHKEY_REPLY, uint32_t, sd_ble_gap_lesc_dhkey_reply(uint16_t conn_handle, ble_gap_lesc_dhkey_t const *p_dhkey)); - -/**@brief Notify the peer of a local keypress. - * - * @details This function can only be used when an authentication procedure using LE Secure Connection is in progress. Calling it at other times will result in an @ref NRF_ERROR_INVALID_STATE. - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] kp_not See @ref BLE_GAP_KP_NOT_TYPES. - * - * @retval ::NRF_SUCCESS Keypress notification successfully queued for transmission. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. Either not entering a passkey or keypresses have not been enabled by both peers. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::NRF_ERROR_BUSY The BLE stack is busy. Retry at later time. - */ -SVCALL(SD_BLE_GAP_KEYPRESS_NOTIFY, uint32_t, sd_ble_gap_keypress_notify(uint16_t conn_handle, uint8_t kp_not)); - -/**@brief Generate a set of OOB data to send to a peer out of band. - * - * @note The @ref ble_gap_addr_t included in the OOB data returned will be the currently active one (or, if a connection has already been established, - * the one used during connection setup). The application may manually overwrite it with an updated value. - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. Can be BLE_CONN_HANDLE_INVALID if a BLE connection has not been established yet. - * @param[in] p_pk_own LE Secure Connections local P-256 Public Key. - * @param[out] p_oobd_own The OOB data to be sent out of band to a peer. - * - * @retval ::NRF_SUCCESS OOB data successfully generated. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - */ -SVCALL(SD_BLE_GAP_LESC_OOB_DATA_GET, uint32_t, sd_ble_gap_lesc_oob_data_get(uint16_t conn_handle, ble_gap_lesc_p256_pk_t const *p_pk_own, ble_gap_lesc_oob_data_t *p_oobd_own)); - -/**@brief Provide the OOB data sent/received out of band. - * - * @note An authentication procedure with OOB selected as an algorithm must be in progress when calling this function. - * @note A @ref BLE_GAP_EVT_LESC_DHKEY_REQUEST event with the oobd_req set to 1 must have been received prior to calling this function. - * - * @events - * @event{This function is used during authentication procedures\, see the list of events in the documentation of @ref sd_ble_gap_authenticate.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_oobd_own The OOB data sent out of band to a peer or NULL if the peer has not received OOB data. - * Must correspond to @ref ble_gap_sec_params_t::oob flag in @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST. - * @param[in] p_oobd_peer The OOB data received out of band from a peer or NULL if none received. - * Must correspond to @ref ble_gap_sec_params_t::oob flag in @ref sd_ble_gap_authenticate in the central role - * or @ref sd_ble_gap_sec_params_reply in the peripheral role. - * - * @retval ::NRF_SUCCESS OOB data accepted. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - */ -SVCALL(SD_BLE_GAP_LESC_OOB_DATA_SET, uint32_t, sd_ble_gap_lesc_oob_data_set(uint16_t conn_handle, ble_gap_lesc_oob_data_t const *p_oobd_own, ble_gap_lesc_oob_data_t const *p_oobd_peer)); - -/**@brief Initiate GAP Encryption procedure. - * - * @details In the central role, this function will initiate the encryption procedure using the encryption information provided. - * - * @events - * @event{@ref BLE_GAP_EVT_CONN_SEC_UPDATE, The connection security has been updated.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_ENC_MSC} - * @mmsc{@ref BLE_GAP_MULTILINK_CTRL_PROC_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_SEC_REQ_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_master_id Pointer to a @ref ble_gap_master_id_t master identification structure. - * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure. - * - * @retval ::NRF_SUCCESS Successfully initiated authentication procedure. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. - * @retval ::NRF_ERROR_BUSY Procedure already in progress or not allowed at this time, wait for pending procedures to complete and retry. - */ -SVCALL(SD_BLE_GAP_ENCRYPT, uint32_t, sd_ble_gap_encrypt(uint16_t conn_handle, ble_gap_master_id_t const *p_master_id, ble_gap_enc_info_t const *p_enc_info)); - - -/**@brief Reply with GAP security information. - * - * @details This function is only used to reply to a @ref BLE_GAP_EVT_SEC_INFO_REQUEST, calling it at other times will result in @ref NRF_ERROR_INVALID_STATE. - * @note If the call returns an error code, the request is still pending, and the reply call may be repeated with corrected parameters. - * @note Data signing is not yet supported, and p_sign_info must therefore be NULL. - * - * @mscs - * @mmsc{@ref BLE_GAP_PERIPH_ENC_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information structure. May be NULL to signal none is available. - * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t identity information structure. May be NULL to signal none is available. - * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information structure. May be NULL to signal none is available. - * - * @retval ::NRF_SUCCESS Successfully accepted security information. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - */ -SVCALL(SD_BLE_GAP_SEC_INFO_REPLY, uint32_t, sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_t const *p_enc_info, ble_gap_irk_t const *p_id_info, ble_gap_sign_info_t const *p_sign_info)); - - -/**@brief Get the current connection security. - * - * @param[in] conn_handle Connection handle. - * @param[out] p_conn_sec Pointer to a @ref ble_gap_conn_sec_t structure to be filled in. - * - * @retval ::NRF_SUCCESS Current connection security successfully retrieved. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - */ -SVCALL(SD_BLE_GAP_CONN_SEC_GET, uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t *p_conn_sec)); - - -/**@brief Start reporting the received signal strength to the application. - * - * A new event is reported whenever the RSSI value changes, until @ref sd_ble_gap_rssi_stop is called. - * - * @events - * @event{@ref BLE_GAP_EVT_RSSI_CHANGED, New RSSI data available. How often the event is generated is - dependent on the settings of the threshold_dbm - and skip_count input parameters.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} - * @mmsc{@ref BLE_GAP_RSSI_FILT_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] threshold_dbm Minimum change in dBm before triggering the @ref BLE_GAP_EVT_RSSI_CHANGED event. Events are disabled if threshold_dbm equals @ref BLE_GAP_RSSI_THRESHOLD_INVALID. - * @param[in] skip_count Number of RSSI samples with a change of threshold_dbm or more before sending a new @ref BLE_GAP_EVT_RSSI_CHANGED event. - * - * @retval ::NRF_SUCCESS Successfully activated RSSI reporting. - * @retval ::NRF_ERROR_INVALID_STATE Disconnection in progress. Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - */ -SVCALL(SD_BLE_GAP_RSSI_START, uint32_t, sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count)); - - -/**@brief Stop reporting the received signal strength. - * - * @note An RSSI change detected before the call but not yet received by the application - * may be reported after @ref sd_ble_gap_rssi_stop has been called. - * - * @mscs - * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} - * @mmsc{@ref BLE_GAP_RSSI_FILT_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * - * @retval ::NRF_SUCCESS Successfully deactivated RSSI reporting. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - */ -SVCALL(SD_BLE_GAP_RSSI_STOP, uint32_t, sd_ble_gap_rssi_stop(uint16_t conn_handle)); - - -/**@brief Get the received signal strength for the last connection event. - * - * @ref sd_ble_gap_rssi_start must be called to start reporting RSSI before using this function. @ref NRF_ERROR_NOT_FOUND - * will be returned until RSSI was sampled for the first time after calling @ref sd_ble_gap_rssi_start. - * - * @mscs - * @mmsc{@ref BLE_GAP_CENTRAL_RSSI_READ_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored. - * - * @retval ::NRF_SUCCESS Successfully read the RSSI. - * @retval ::NRF_ERROR_NOT_FOUND No sample is available. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::NRF_ERROR_INVALID_STATE RSSI reporting is not ongoing, or disconnection in progress. - */ -SVCALL(SD_BLE_GAP_RSSI_GET, uint32_t, sd_ble_gap_rssi_get(uint16_t conn_handle, int8_t *p_rssi)); - - -/**@brief Start scanning (GAP Discovery procedure, Observer Procedure). - * - * - * @events - * @event{@ref BLE_GAP_EVT_ADV_REPORT, An advertising or scan response packet has been received.} - * @event{@ref BLE_GAP_EVT_TIMEOUT, Scanner has timed out.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_SCAN_MSC} - * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} - * @endmscs - * - * @param[in] p_scan_params Pointer to scan parameters structure. - * - * @retval ::NRF_SUCCESS Successfully initiated scanning procedure. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. - * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. - * Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again - */ -SVCALL(SD_BLE_GAP_SCAN_START, uint32_t, sd_ble_gap_scan_start(ble_gap_scan_params_t const *p_scan_params)); - - -/**@brief Stop scanning (GAP Discovery procedure, Observer Procedure). - * - * @mscs - * @mmsc{@ref BLE_GAP_SCAN_MSC} - * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} - * @endmscs - * - * @retval ::NRF_SUCCESS Successfully stopped scanning procedure. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in scanning state). - */ -SVCALL(SD_BLE_GAP_SCAN_STOP, uint32_t, sd_ble_gap_scan_stop(void)); - - -/**@brief Create a connection (GAP Link Establishment). - * - * @note If a scanning procedure is currently in progress it will be automatically stopped when calling this function. - * - * @mscs - * @mmsc{@ref BLE_GAP_WL_SHARE_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_CONN_PRIV_MSC} - * @mmsc{@ref BLE_GAP_CENTRAL_CONN_MSC} - * @endmscs - * - * @param[in] p_peer_addr Pointer to peer address. If the use_whitelist bit is set in @ref ble_gap_scan_params_t, then this is ignored. - * If @ref ble_gap_addr_t::addr_id_peer is set then p_peer_addr must be present in the device identity list - * see @ref sd_ble_gap_device_identities_set. - * @param[in] p_scan_params Pointer to scan parameters structure. - * @param[in] p_conn_params Pointer to desired connection parameters. - * - * @retval ::NRF_SUCCESS Successfully initiated connection procedure. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid parameter(s) pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - - Invalid parameter(s) in p_scan_params or p_conn_params. - - Use of whitelist requested but whitelist has not been set, see @ref sd_ble_gap_whitelist_set. - - Peer address was not present in the device identity list, see @ref sd_ble_gap_device_identities_set. - * @retval ::NRF_ERROR_INVALID_STATE The SoftDevice is in an invalid state to perform this operation. This may be due to an - * existing locally initiated connect procedure, which must complete before initiating again. - * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Peer address. - * @retval ::NRF_ERROR_CONN_COUNT The limit of available connections has been reached. - * @retval ::NRF_ERROR_NO_MEM The configured memory pool (see @ref ble_conn_bw_counts_t) is not large enough for the - * bandwidth selected for this connection. - * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. If another connection is being established - * wait for the corresponding @ref BLE_GAP_EVT_CONNECTED event before calling again. - * @retval ::NRF_ERROR_RESOURCES Not enough BLE role slots available. - * Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again - */ -SVCALL(SD_BLE_GAP_CONNECT, uint32_t, sd_ble_gap_connect(ble_gap_addr_t const *p_peer_addr, ble_gap_scan_params_t const *p_scan_params, ble_gap_conn_params_t const *p_conn_params)); - - -/**@brief Cancel a connection establishment. - * - * @mscs - * @mmsc{@ref BLE_GAP_CENTRAL_CONN_MSC} - * @endmscs - * - * @retval ::NRF_SUCCESS Successfully cancelled an ongoing connection procedure. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - */ -SVCALL(SD_BLE_GAP_CONNECT_CANCEL, uint32_t, sd_ble_gap_connect_cancel(void)); - - -/**@brief PHY Update Request - * - * @details This function is used to request a new PHY configuration for a central or a peripheral connection. It will always generate a - * @ref BLE_GAP_EVT_PHY_UPDATE event if successfully executed. If @ref ble_gap_phys_t::tx_phys or @ref ble_gap_phys_t::rx_phys - * is 0, then the stack will select PHYs based on the peer requirements on that specific direction. If the peer does not support - * the PHY Update procedure, then the resulting @ref BLE_GAP_EVT_PHY_UPDATE event will have a status different from - * @ref BLE_HCI_STATUS_CODE_SUCCESS. - * - * @note The requested PHYs does not have to be within the set of the preferred PHYs. - * - * @events - * @event{@ref BLE_GAP_EVT_PHY_UPDATE, Result of the PHY Update procedure procedure.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GAP_CENTRAL_PHY_REQUEST} - * @mmsc{@ref BLE_GAP_PERIPHERAL_PHY_REQUEST} - * @endmscs - * - * @param[in] conn_handle Connection handle to indicate the connection for which the PHY Update is requested. - * @param[in] p_gap_phys Pointer to PHY structure. - * - * @retval ::NRF_SUCCESS Successfully requested a PHY Update. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Unsupported PHYs supplied to the call. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::NRF_ERROR_BUSY Procedure is already in progress or not allowed at this time. Process pending events and wait for the pending procedure to complete and retry. - * - */ -SVCALL(SD_BLE_GAP_PHY_REQUEST, uint32_t, sd_ble_gap_phy_request(uint16_t conn_handle, ble_gap_phys_t const *p_gap_phys)); - -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif // BLE_GAP_H__ - -/** - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatt.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatt.h deleted file mode 100644 index cfa3860b5f..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatt.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_GATT Generic Attribute Profile (GATT) Common - @{ - @brief Common definitions and prototypes for the GATT interfaces. - */ - -#ifndef BLE_GATT_H__ -#define BLE_GATT_H__ - -#include "ble_types.h" -#include "ble_ranges.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup BLE_GATT_DEFINES Defines - * @{ */ - -/** @brief Default MTU size, in bytes. */ -#define BLE_GATT_MTU_SIZE_DEFAULT 23 - -/**@brief Invalid Attribute Handle. */ -#define BLE_GATT_HANDLE_INVALID 0x0000 - -/**@brief First Attribute Handle. */ -#define BLE_GATT_HANDLE_START 0x0001 - -/**@brief Last Attribute Handle. */ -#define BLE_GATT_HANDLE_END 0xFFFF - -/** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources - * @{ */ -#define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */ -/** @} */ - -/** @defgroup BLE_GATT_WRITE_OPS GATT Write operations - * @{ */ -#define BLE_GATT_OP_INVALID 0x00 /**< Invalid Operation. */ -#define BLE_GATT_OP_WRITE_REQ 0x01 /**< Write Request. */ -#define BLE_GATT_OP_WRITE_CMD 0x02 /**< Write Command. */ -#define BLE_GATT_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */ -#define BLE_GATT_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */ -#define BLE_GATT_OP_EXEC_WRITE_REQ 0x05 /**< Execute Write Request. */ -/** @} */ - -/** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags - * @{ */ -#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00 /**< Cancel prepared write. */ -#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01 /**< Execute prepared write. */ -/** @} */ - -/** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations - * @{ */ -#define BLE_GATT_HVX_INVALID 0x00 /**< Invalid Operation. */ -#define BLE_GATT_HVX_NOTIFICATION 0x01 /**< Handle Value Notification. */ -#define BLE_GATT_HVX_INDICATION 0x02 /**< Handle Value Indication. */ -/** @} */ - -/** @defgroup BLE_GATT_STATUS_CODES GATT Status Codes - * @{ */ -#define BLE_GATT_STATUS_SUCCESS 0x0000 /**< Success. */ -#define BLE_GATT_STATUS_UNKNOWN 0x0001 /**< Unknown or not applicable status. */ -#define BLE_GATT_STATUS_ATTERR_INVALID 0x0100 /**< ATT Error: Invalid Error Code. */ -#define BLE_GATT_STATUS_ATTERR_INVALID_HANDLE 0x0101 /**< ATT Error: Invalid Attribute Handle. */ -#define BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED 0x0102 /**< ATT Error: Read not permitted. */ -#define BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED 0x0103 /**< ATT Error: Write not permitted. */ -#define BLE_GATT_STATUS_ATTERR_INVALID_PDU 0x0104 /**< ATT Error: Used in ATT as Invalid PDU. */ -#define BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION 0x0105 /**< ATT Error: Authenticated link required. */ -#define BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED 0x0106 /**< ATT Error: Used in ATT as Request Not Supported. */ -#define BLE_GATT_STATUS_ATTERR_INVALID_OFFSET 0x0107 /**< ATT Error: Offset specified was past the end of the attribute. */ -#define BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION 0x0108 /**< ATT Error: Used in ATT as Insufficient Authorisation. */ -#define BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL 0x0109 /**< ATT Error: Used in ATT as Prepare Queue Full. */ -#define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A /**< ATT Error: Used in ATT as Attribute not found. */ -#define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG 0x010B /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */ -#define BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE 0x010C /**< ATT Error: Encryption key size used is insufficient. */ -#define BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH 0x010D /**< ATT Error: Invalid value size. */ -#define BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR 0x010E /**< ATT Error: Very unlikely error. */ -#define BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION 0x010F /**< ATT Error: Encrypted link required. */ -#define BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE 0x0110 /**< ATT Error: Attribute type is not a supported grouping attribute. */ -#define BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES 0x0111 /**< ATT Error: Encrypted link required. */ -#define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN 0x0112 /**< ATT Error: Reserved for Future Use range #1 begin. */ -#define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END 0x017F /**< ATT Error: Reserved for Future Use range #1 end. */ -#define BLE_GATT_STATUS_ATTERR_APP_BEGIN 0x0180 /**< ATT Error: Application range begin. */ -#define BLE_GATT_STATUS_ATTERR_APP_END 0x019F /**< ATT Error: Application range end. */ -#define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN 0x01A0 /**< ATT Error: Reserved for Future Use range #2 begin. */ -#define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END 0x01DF /**< ATT Error: Reserved for Future Use range #2 end. */ -#define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN 0x01E0 /**< ATT Error: Reserved for Future Use range #3 begin. */ -#define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END 0x01FC /**< ATT Error: Reserved for Future Use range #3 end. */ -#define BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR 0x01FD /**< ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly configured. */ -#define BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG 0x01FE /**< ATT Common Profile and Service Error: Procedure Already in Progress. */ -#define BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE 0x01FF /**< ATT Common Profile and Service Error: Out Of Range. */ -/** @} */ - - -/** @defgroup BLE_GATT_CPF_FORMATS Characteristic Presentation Formats - * @note Found at http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml - * @{ */ -#define BLE_GATT_CPF_FORMAT_RFU 0x00 /**< Reserved For Future Use. */ -#define BLE_GATT_CPF_FORMAT_BOOLEAN 0x01 /**< Boolean. */ -#define BLE_GATT_CPF_FORMAT_2BIT 0x02 /**< Unsigned 2-bit integer. */ -#define BLE_GATT_CPF_FORMAT_NIBBLE 0x03 /**< Unsigned 4-bit integer. */ -#define BLE_GATT_CPF_FORMAT_UINT8 0x04 /**< Unsigned 8-bit integer. */ -#define BLE_GATT_CPF_FORMAT_UINT12 0x05 /**< Unsigned 12-bit integer. */ -#define BLE_GATT_CPF_FORMAT_UINT16 0x06 /**< Unsigned 16-bit integer. */ -#define BLE_GATT_CPF_FORMAT_UINT24 0x07 /**< Unsigned 24-bit integer. */ -#define BLE_GATT_CPF_FORMAT_UINT32 0x08 /**< Unsigned 32-bit integer. */ -#define BLE_GATT_CPF_FORMAT_UINT48 0x09 /**< Unsigned 48-bit integer. */ -#define BLE_GATT_CPF_FORMAT_UINT64 0x0A /**< Unsigned 64-bit integer. */ -#define BLE_GATT_CPF_FORMAT_UINT128 0x0B /**< Unsigned 128-bit integer. */ -#define BLE_GATT_CPF_FORMAT_SINT8 0x0C /**< Signed 2-bit integer. */ -#define BLE_GATT_CPF_FORMAT_SINT12 0x0D /**< Signed 12-bit integer. */ -#define BLE_GATT_CPF_FORMAT_SINT16 0x0E /**< Signed 16-bit integer. */ -#define BLE_GATT_CPF_FORMAT_SINT24 0x0F /**< Signed 24-bit integer. */ -#define BLE_GATT_CPF_FORMAT_SINT32 0x10 /**< Signed 32-bit integer. */ -#define BLE_GATT_CPF_FORMAT_SINT48 0x11 /**< Signed 48-bit integer. */ -#define BLE_GATT_CPF_FORMAT_SINT64 0x12 /**< Signed 64-bit integer. */ -#define BLE_GATT_CPF_FORMAT_SINT128 0x13 /**< Signed 128-bit integer. */ -#define BLE_GATT_CPF_FORMAT_FLOAT32 0x14 /**< IEEE-754 32-bit floating point. */ -#define BLE_GATT_CPF_FORMAT_FLOAT64 0x15 /**< IEEE-754 64-bit floating point. */ -#define BLE_GATT_CPF_FORMAT_SFLOAT 0x16 /**< IEEE-11073 16-bit SFLOAT. */ -#define BLE_GATT_CPF_FORMAT_FLOAT 0x17 /**< IEEE-11073 32-bit FLOAT. */ -#define BLE_GATT_CPF_FORMAT_DUINT16 0x18 /**< IEEE-20601 format. */ -#define BLE_GATT_CPF_FORMAT_UTF8S 0x19 /**< UTF-8 string. */ -#define BLE_GATT_CPF_FORMAT_UTF16S 0x1A /**< UTF-16 string. */ -#define BLE_GATT_CPF_FORMAT_STRUCT 0x1B /**< Opaque Structure. */ -/** @} */ - -/** @defgroup BLE_GATT_CPF_NAMESPACES GATT Bluetooth Namespaces - * @{ - */ -#define BLE_GATT_CPF_NAMESPACE_BTSIG 0x01 /**< Bluetooth SIG defined Namespace. */ -#define BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN 0x0000 /**< Namespace Description Unknown. */ -/** @} */ - -/** @} */ - -/** @addtogroup BLE_GATT_STRUCTURES Structures - * @{ */ - -/** - * @brief BLE GATT initialization parameters. - */ -typedef struct -{ - uint16_t att_mtu; /**< Maximum size of ATT packet the SoftDevice can send or receive. - If it is 0 then @ref BLE_GATT_MTU_SIZE_DEFAULT will be used. - Otherwise @ref BLE_GATT_MTU_SIZE_DEFAULT is the minimum value. - @mscs - @mmsc{@ref BLE_GATTC_MTU_EXCHANGE} - @mmsc{@ref BLE_GATTS_MTU_EXCHANGE} - @endmscs - */ -} ble_gatt_enable_params_t; - -/**@brief GATT Characteristic Properties. */ -typedef struct -{ - /* Standard properties */ - uint8_t broadcast :1; /**< Broadcasting of the value permitted. */ - uint8_t read :1; /**< Reading the value permitted. */ - uint8_t write_wo_resp :1; /**< Writing the value with Write Command permitted. */ - uint8_t write :1; /**< Writing the value with Write Request permitted. */ - uint8_t notify :1; /**< Notications of the value permitted. */ - uint8_t indicate :1; /**< Indications of the value permitted. */ - uint8_t auth_signed_wr :1; /**< Writing the value with Signed Write Command permitted. */ -} ble_gatt_char_props_t; - -/**@brief GATT Characteristic Extended Properties. */ -typedef struct -{ - /* Extended properties */ - uint8_t reliable_wr :1; /**< Writing the value with Queued Write operations permitted. */ - uint8_t wr_aux :1; /**< Writing the Characteristic User Description descriptor permitted. */ -} ble_gatt_char_ext_props_t; - -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif // BLE_GATT_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gattc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gattc.h deleted file mode 100644 index c36a4d7e34..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gattc.h +++ /dev/null @@ -1,669 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client - @{ - @brief Definitions and prototypes for the GATT Client interface. - */ - -#ifndef BLE_GATTC_H__ -#define BLE_GATTC_H__ - -#include "ble_gatt.h" -#include "ble_types.h" -#include "ble_ranges.h" -#include "nrf_svc.h" -#include "nrf_error.h" -#include "nrf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup BLE_GATTC_ENUMERATIONS Enumerations - * @{ */ - -/**@brief GATTC API SVC numbers. */ -enum BLE_GATTC_SVCS -{ - SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */ - SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */ - SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */ - SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */ - SD_BLE_GATTC_ATTR_INFO_DISCOVER, /**< Attribute Information Discovery. */ - SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */ - SD_BLE_GATTC_READ, /**< Generic read. */ - SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */ - SD_BLE_GATTC_WRITE, /**< Generic write. */ - SD_BLE_GATTC_HV_CONFIRM, /**< Handle Value Confirmation. */ - SD_BLE_GATTC_EXCHANGE_MTU_REQUEST, /**< Exchange MTU Request. */ -}; - -/** - * @brief GATT Client Event IDs. - */ -enum BLE_GATTC_EVTS -{ - BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. \n See @ref ble_gattc_evt_prim_srvc_disc_rsp_t. */ - BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. \n See @ref ble_gattc_evt_rel_disc_rsp_t. */ - BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. \n See @ref ble_gattc_evt_char_disc_rsp_t. */ - BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. \n See @ref ble_gattc_evt_desc_disc_rsp_t. */ - BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, /**< Attribute Information Response event. \n See @ref ble_gattc_evt_attr_info_disc_rsp_t. */ - BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. \n See @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t. */ - BLE_GATTC_EVT_READ_RSP, /**< Read Response event. \n See @ref ble_gattc_evt_read_rsp_t. */ - BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. \n See @ref ble_gattc_evt_char_vals_read_rsp_t. */ - BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. \n See @ref ble_gattc_evt_write_rsp_t. */ - BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. \n Confirm indication with @ref sd_ble_gattc_hv_confirm. \n See @ref ble_gattc_evt_hvx_t. */ - BLE_GATTC_EVT_EXCHANGE_MTU_RSP, /**< Exchange MTU Response event. \n See @ref ble_gattc_evt_exchange_mtu_rsp_t. */ - BLE_GATTC_EVT_TIMEOUT /**< Timeout event. \n See @ref ble_gattc_evt_timeout_t. */ -}; - -/** @} */ - -/** @addtogroup BLE_GATTC_DEFINES Defines - * @{ */ - -/** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC - * @{ */ -#define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000) /**< Procedure not Permitted. */ -/** @} */ - -/** @defgroup BLE_GATTC_ATTR_INFO_FORMAT Attribute Information Formats - * @{ */ -#define BLE_GATTC_ATTR_INFO_FORMAT_16BIT 1 /**< 16-bit Attribute Information Format. */ -#define BLE_GATTC_ATTR_INFO_FORMAT_128BIT 2 /**< 128-bit Attribute Information Format. */ -/** @} */ - -/** @} */ - -/** @addtogroup BLE_GATTC_STRUCTURES Structures - * @{ */ - -/**@brief Operation Handle Range. */ -typedef struct -{ - uint16_t start_handle; /**< Start Handle. */ - uint16_t end_handle; /**< End Handle. */ -} ble_gattc_handle_range_t; - - -/**@brief GATT service. */ -typedef struct -{ - ble_uuid_t uuid; /**< Service UUID. */ - ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */ -} ble_gattc_service_t; - - -/**@brief GATT include. */ -typedef struct -{ - uint16_t handle; /**< Include Handle. */ - ble_gattc_service_t included_srvc; /**< Handle of the included service. */ -} ble_gattc_include_t; - - -/**@brief GATT characteristic. */ -typedef struct -{ - ble_uuid_t uuid; /**< Characteristic UUID. */ - ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ - uint8_t char_ext_props : 1; /**< Extended properties present. */ - uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */ - uint16_t handle_value; /**< Handle of the Characteristic Value. */ -} ble_gattc_char_t; - - -/**@brief GATT descriptor. */ -typedef struct -{ - uint16_t handle; /**< Descriptor Handle. */ - ble_uuid_t uuid; /**< Descriptor UUID. */ -} ble_gattc_desc_t; - - -/**@brief Write Parameters. */ -typedef struct -{ - uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ - uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ - uint16_t handle; /**< Handle to the attribute to be written. */ - uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ - uint16_t len; /**< Length of data in bytes. */ - uint8_t const *p_value; /**< Pointer to the value data. */ -} ble_gattc_write_params_t; - -/**@brief Attribute Information for 16-bit Attribute UUID. */ -typedef struct -{ - uint16_t handle; /**< Attribute handle. */ - ble_uuid_t uuid; /**< 16-bit Attribute UUID. */ -} ble_gattc_attr_info16_t; - -/**@brief Attribute Information for 128-bit Attribute UUID. */ -typedef struct -{ - uint16_t handle; /**< Attribute handle. */ - ble_uuid128_t uuid; /**< 128-bit Attribute UUID. */ -} ble_gattc_attr_info128_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */ -typedef struct -{ - uint16_t count; /**< Service count. */ - ble_gattc_service_t services[1]; /**< Service data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_prim_srvc_disc_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_REL_DISC_RSP. */ -typedef struct -{ - uint16_t count; /**< Include count. */ - ble_gattc_include_t includes[1]; /**< Include data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_rel_disc_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_DISC_RSP. */ -typedef struct -{ - uint16_t count; /**< Characteristic count. */ - ble_gattc_char_t chars[1]; /**< Characteristic data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_char_disc_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_DESC_DISC_RSP. */ -typedef struct -{ - uint16_t count; /**< Descriptor count. */ - ble_gattc_desc_t descs[1]; /**< Descriptor data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_desc_disc_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP. */ -typedef struct -{ - uint16_t count; /**< Attribute count. */ - uint8_t format; /**< Attribute information format, see @ref BLE_GATTC_ATTR_INFO_FORMAT. */ - union { - ble_gattc_attr_info16_t attr_info16[1]; /**< Attribute information for 16-bit Attribute UUID. - @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ - ble_gattc_attr_info128_t attr_info128[1]; /**< Attribute information for 128-bit Attribute UUID. - @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ - } info; /**< Attribute information union. */ -} ble_gattc_evt_attr_info_disc_rsp_t; - -/**@brief GATT read by UUID handle value pair. */ -typedef struct -{ - uint16_t handle; /**< Attribute Handle. */ - uint8_t *p_value; /**< Pointer to the Attribute Value, length is available in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t::value_len. */ -} ble_gattc_handle_value_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */ -typedef struct -{ - uint16_t count; /**< Handle-Value Pair Count. */ - uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */ - uint8_t handle_value[1]; /**< Handle-Value(s) list. To iterate through the list use @ref sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter. - @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_char_val_by_uuid_read_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_READ_RSP. */ -typedef struct -{ - uint16_t handle; /**< Attribute Handle. */ - uint16_t offset; /**< Offset of the attribute data. */ - uint16_t len; /**< Attribute data length. */ - uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_read_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */ -typedef struct -{ - uint16_t len; /**< Concatenated Attribute values length. */ - uint8_t values[1]; /**< Attribute values. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_char_vals_read_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_WRITE_RSP. */ -typedef struct -{ - uint16_t handle; /**< Attribute Handle. */ - uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */ - uint16_t offset; /**< Data offset. */ - uint16_t len; /**< Data length. */ - uint8_t data[1]; /**< Data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_write_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_HVX. */ -typedef struct -{ - uint16_t handle; /**< Handle to which the HVx operation applies. */ - uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ - uint16_t len; /**< Attribute data length. */ - uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gattc_evt_hvx_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP. */ -typedef struct -{ - uint16_t server_rx_mtu; /**< Server RX MTU size. */ -} ble_gattc_evt_exchange_mtu_rsp_t; - -/**@brief Event structure for @ref BLE_GATTC_EVT_TIMEOUT. */ -typedef struct -{ - uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ -} ble_gattc_evt_timeout_t; - -/**@brief GATTC event structure. */ -typedef struct -{ - uint16_t conn_handle; /**< Connection Handle on which event occured. */ - uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ - uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases @ref BLE_GATT_HANDLE_INVALID. */ - union - { - ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */ - ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */ - ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */ - ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */ - ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */ - ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */ - ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */ - ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */ - ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */ - ble_gattc_evt_exchange_mtu_rsp_t exchange_mtu_rsp; /**< Exchange MTU Response Event Parameters. */ - ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */ - ble_gattc_evt_attr_info_disc_rsp_t attr_info_disc_rsp; /**< Attribute Information Discovery Event Parameters. */ - } params; /**< Event Parameters. @note Only valid if @ref gatt_status == @ref BLE_GATT_STATUS_SUCCESS. */ -} ble_gattc_evt_t; -/** @} */ - -/** @addtogroup BLE_GATTC_FUNCTIONS Functions - * @{ */ - -/**@brief Initiate or continue a GATT Primary Service Discovery procedure. - * - * @details This function initiates or resumes a Primary Service discovery procedure, starting from the supplied handle. - * If the last service has not been reached, this function must be called again with an updated start handle value to continue the search. - * - * @note If any of the discovered services have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with - * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. - * - * @events - * @event{@ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_PRIM_SRVC_DISC_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] start_handle Handle to start searching from. - * @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned. - * - * @retval ::NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, uint32_t, sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *p_srvc_uuid)); - - -/**@brief Initiate or continue a GATT Relationship Discovery procedure. - * - * @details This function initiates or resumes the Find Included Services sub-procedure. If the last included service has not been reached, - * this must be called again with an updated handle range to continue the search. - * - * @events - * @event{@ref BLE_GATTC_EVT_REL_DISC_RSP} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_REL_DISC_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. - * - * @retval ::NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); - - -/**@brief Initiate or continue a GATT Characteristic Discovery procedure. - * - * @details This function initiates or resumes a Characteristic discovery procedure. If the last Characteristic has not been reached, - * this must be called again with an updated handle range to continue the discovery. - * - * @note If any of the discovered characteristics have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with - * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. - * - * @events - * @event{@ref BLE_GATTC_EVT_CHAR_DISC_RSP} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_CHAR_DISC_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. - * - * @retval ::NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); - - -/**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure. - * - * @details This function initiates or resumes a Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached, - * this must be called again with an updated handle range to continue the discovery. - * - * @events - * @event{@ref BLE_GATTC_EVT_DESC_DISC_RSP} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_DESC_DISC_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on. - * - * @retval ::NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); - - -/**@brief Initiate or continue a GATT Read using Characteristic UUID procedure. - * - * @details This function initiates or resumes a Read using Characteristic UUID procedure. If the last Characteristic has not been reached, - * this must be called again with an updated handle range to continue the discovery. - * - * @events - * @event{@ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_READ_UUID_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] p_uuid Pointer to a Characteristic value UUID to read. - * @param[in] p_handle_range A pointer to the range of handles to perform this procedure on. - * - * @retval ::NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, uint32_t, sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_t const *p_uuid, ble_gattc_handle_range_t const *p_handle_range)); - - -/**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure. - * - * @details This function initiates or resumes a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor - * to be read is longer than ATT_MTU - 1, this function must be called multiple times with appropriate offset to read the - * complete value. - * - * @events - * @event{@ref BLE_GATTC_EVT_READ_RSP} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_VALUE_READ_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] handle The handle of the attribute to be read. - * @param[in] offset Offset into the attribute value to be read. - * - * @retval ::NRF_SUCCESS Successfully started or resumed the Read (Long) procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset)); - - -/**@brief Initiate a GATT Read Multiple Characteristic Values procedure. - * - * @details This function initiates a GATT Read Multiple Characteristic Values procedure. - * - * @events - * @event{@ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_READ_MULT_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read. - * @param[in] handle_count The number of handles in p_handles. - * - * @retval ::NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const *p_handles, uint16_t handle_count)); - - -/**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure. - * - * @details This function can perform all write procedures described in GATT. - * - * @note It is important to note that a write without response will consume an application buffer, and will therefore - * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write (with response) on the other hand will use the - * standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response - * has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. - * - * @events - * @event{@ref BLE_GATTC_EVT_WRITE_RSP, Generated when using write request or queued writes.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_VALUE_WRITE_MSC} - * @mmsc{@ref BLE_GATTC_VALUE_LONG_WRITE_MSC} - * @mmsc{@ref BLE_GATTC_VALUE_RELIABLE_WRITE_MSC} - * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] p_write_params A pointer to a write parameters structure. - * - * @retval ::NRF_SUCCESS Successfully started the Write procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. - * @retval ::NRF_ERROR_BUSY Procedure already in progress. - * @retval ::BLE_ERROR_NO_TX_PACKETS No available application packets for this connection. - */ -SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params)); - - -/**@brief Send a Handle Value Confirmation to the GATT Server. - * - * @mscs - * @mmsc{@ref BLE_GATTC_HVI_MSC} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] handle The handle of the attribute in the indication. - * - * @retval ::NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no Indication pending to be confirmed. - * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle. - */ -SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle)); - -/**@brief Discovers information about a range of attributes on a GATT server. - * - * @events - * @event{@ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, Generated when information about a range of attributes has been received.} - * @endevents - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] p_handle_range The range of handles to request information about. - * - * @retval ::NRF_SUCCESS Successfully started an attribute information discovery procedure. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid connection state - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_ATTR_INFO_DISCOVER, uint32_t, sd_ble_gattc_attr_info_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * p_handle_range)); - -/**@brief Start an ATT_MTU exchange by sending an Exchange MTU Request to the server. - * - * @details The SoftDevice sets ATT_MTU to the minimum of: - * - The Client RX MTU value, and - * - The Server RX MTU value from @ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP. - * - * However, the SoftDevice never sets ATT_MTU lower than @ref BLE_GATT_MTU_SIZE_DEFAULT. - * - * @events - * @event{@ref BLE_GATTC_EVT_EXCHANGE_MTU_RSP} - * @event{@ref BLE_EVT_DATA_LENGTH_CHANGED, Generated if a data length update procedure is performed after the ATT_MTU exchange.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTC_MTU_EXCHANGE} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] client_rx_mtu Client RX MTU size. - * - The minimum value is @ref BLE_GATT_MTU_SIZE_DEFAULT. - * - The maximum value is @ref ble_gatt_enable_params_t::att_mtu. - * - The value must be equal to Server RX MTU size given in @ref sd_ble_gatts_exchange_mtu_reply - * if an ATT_MTU exchange has already been performed in the other direction. - * - * @retval ::NRF_SUCCESS Successfully sent request to the server. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid connection state or an ATT_MTU exchange was already requested once. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid Client RX MTU size supplied. - * @retval ::NRF_ERROR_BUSY Client procedure already in progress. - */ -SVCALL(SD_BLE_GATTC_EXCHANGE_MTU_REQUEST, uint32_t, sd_ble_gattc_exchange_mtu_request(uint16_t conn_handle, uint16_t client_rx_mtu)); - -/**@brief Iterate through Handle-Value(s) list in @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event. - * - * @param[in] p_gattc_evt Pointer to event buffer containing @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP event. - * @note If the buffer contains different event, behavior is undefined. - * @param[in,out] p_iter Iterator, points to @ref ble_gattc_handle_value_t structure that will be filled in with - * the next Handle-Value pair in each iteration. If the function returns other than - * @ref NRF_SUCCESS, it will not be changed. - * - To start iteration, initialize the structure to zero. - * - To continue, pass the value from previous iteration. - * - * \code - * ble_gattc_handle_value_t iter; - * memset(&iter, 0, sizeof(ble_gattc_handle_value_t)); - * while (sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(&ble_evt.evt.gattc_evt, &iter) == NRF_SUCCESS) - * { - * app_handle = iter.handle; - * memcpy(app_value, iter.p_value, ble_evt.evt.gattc_evt.params.char_val_by_uuid_read_rsp.value_len); - * } - * \endcode - * - * @retval ::NRF_SUCCESS Successfully retrieved the next Handle-Value pair. - * @retval ::NRF_ERROR_NOT_FOUND No more Handle-Value pairs available in the list. - */ -__STATIC_INLINE uint32_t sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(ble_gattc_evt_t *p_gattc_evt, ble_gattc_handle_value_t *p_iter); - -/** @} */ - -#ifndef SUPPRESS_INLINE_IMPLEMENTATION - -__STATIC_INLINE uint32_t sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter(ble_gattc_evt_t *p_gattc_evt, ble_gattc_handle_value_t *p_iter) -{ - uint32_t value_len = p_gattc_evt->params.char_val_by_uuid_read_rsp.value_len; - uint8_t *p_first = p_gattc_evt->params.char_val_by_uuid_read_rsp.handle_value; - uint8_t *p_next = p_iter->p_value ? p_iter->p_value + value_len : p_first; - - if ((p_next - p_first) / (sizeof(uint16_t) + value_len) < p_gattc_evt->params.char_val_by_uuid_read_rsp.count) - { - p_iter->handle = (uint16_t)p_next[1] << 8 | p_next[0]; - p_iter->p_value = p_next + sizeof(uint16_t); - return NRF_SUCCESS; - } - else - { - return NRF_ERROR_NOT_FOUND; - } -} - -#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ - -#ifdef __cplusplus -} -#endif -#endif /* BLE_GATTC_H__ */ - -/** - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatts.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatts.h deleted file mode 100644 index b85735ec31..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_gatts.h +++ /dev/null @@ -1,778 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_GATTS Generic Attribute Profile (GATT) Server - @{ - @brief Definitions and prototypes for the GATTS interface. - */ - -#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_svc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup BLE_GATTS_ENUMERATIONS Enumerations - * @{ */ - -/** - * @brief GATTS API SVC numbers. - */ -enum BLE_GATTS_SVCS -{ - SD_BLE_GATTS_SERVICE_ADD = BLE_GATTS_SVC_BASE, /**< Add a service. */ - SD_BLE_GATTS_INCLUDE_ADD, /**< Add an included service. */ - SD_BLE_GATTS_CHARACTERISTIC_ADD, /**< Add a characteristic. */ - SD_BLE_GATTS_DESCRIPTOR_ADD, /**< Add a generic attribute. */ - SD_BLE_GATTS_VALUE_SET, /**< Set an attribute value. */ - SD_BLE_GATTS_VALUE_GET, /**< Get an attribute value. */ - SD_BLE_GATTS_HVX, /**< Handle Value Notification or Indication. */ - SD_BLE_GATTS_SERVICE_CHANGED, /**< Perform a Service Changed Indication to one or more peers. */ - SD_BLE_GATTS_RW_AUTHORIZE_REPLY, /**< Reply to an authorization request for a read or write operation on one or more attributes. */ - SD_BLE_GATTS_SYS_ATTR_SET, /**< Set the persistent system attributes for a connection. */ - SD_BLE_GATTS_SYS_ATTR_GET, /**< Retrieve the persistent system attributes. */ - SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, /**< Retrieve the first valid user handle. */ - SD_BLE_GATTS_ATTR_GET, /**< Retrieve the UUID and/or metadata of an attribute. */ - SD_BLE_GATTS_EXCHANGE_MTU_REPLY /**< Reply to Exchange MTU Request. */ -}; - -/** - * @brief GATT Server Event IDs. - */ -enum BLE_GATTS_EVTS -{ - BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE, /**< Write operation performed. \n See @ref ble_gatts_evt_write_t. */ - BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST, /**< Read/Write Authorization request. \n Reply with @ref sd_ble_gatts_rw_authorize_reply. \n See @ref ble_gatts_evt_rw_authorize_request_t. */ - BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending. \n Respond with @ref sd_ble_gatts_sys_attr_set. \n See @ref ble_gatts_evt_sys_attr_missing_t. */ - BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. \n See @ref ble_gatts_evt_hvc_t. */ - BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. No additional event structure applies. */ - BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST, /**< Exchange MTU Request. \n Reply with @ref sd_ble_gatts_exchange_mtu_reply. \n See @ref ble_gatts_evt_exchange_mtu_request_t. */ - BLE_GATTS_EVT_TIMEOUT /**< Peer failed to resonpond to an ATT request in time. \n See @ref ble_gatts_evt_timeout_t. */ -}; -/** @} */ - -/** @addtogroup BLE_GATTS_DEFINES Defines - * @{ */ - -/** @defgroup BLE_ERRORS_GATTS SVC return values specific to GATTS - * @{ */ -#define BLE_ERROR_GATTS_INVALID_ATTR_TYPE (NRF_GATTS_ERR_BASE + 0x000) /**< Invalid attribute type. */ -#define BLE_ERROR_GATTS_SYS_ATTR_MISSING (NRF_GATTS_ERR_BASE + 0x001) /**< System Attributes missing. */ -/** @} */ - -/** @defgroup BLE_GATTS_ATTR_LENS_MAX Maximum attribute lengths - * @{ */ -#define BLE_GATTS_FIX_ATTR_LEN_MAX (510) /**< Maximum length for fixed length Attribute Values. */ -#define BLE_GATTS_VAR_ATTR_LEN_MAX (512) /**< Maximum length for variable length Attribute Values. */ -/** @} */ - -/** @defgroup BLE_GATTS_SRVC_TYPES GATT Server Service Types - * @{ */ -#define BLE_GATTS_SRVC_TYPE_INVALID 0x00 /**< Invalid Service Type. */ -#define BLE_GATTS_SRVC_TYPE_PRIMARY 0x01 /**< Primary Service. */ -#define BLE_GATTS_SRVC_TYPE_SECONDARY 0x02 /**< Secondary Type. */ -/** @} */ - - -/** @defgroup BLE_GATTS_ATTR_TYPES GATT Server Attribute Types - * @{ */ -#define BLE_GATTS_ATTR_TYPE_INVALID 0x00 /**< Invalid Attribute Type. */ -#define BLE_GATTS_ATTR_TYPE_PRIM_SRVC_DECL 0x01 /**< Primary Service Declaration. */ -#define BLE_GATTS_ATTR_TYPE_SEC_SRVC_DECL 0x02 /**< Secondary Service Declaration. */ -#define BLE_GATTS_ATTR_TYPE_INC_DECL 0x03 /**< Include Declaration. */ -#define BLE_GATTS_ATTR_TYPE_CHAR_DECL 0x04 /**< Characteristic Declaration. */ -#define BLE_GATTS_ATTR_TYPE_CHAR_VAL 0x05 /**< Characteristic Value. */ -#define BLE_GATTS_ATTR_TYPE_DESC 0x06 /**< Descriptor. */ -#define BLE_GATTS_ATTR_TYPE_OTHER 0x07 /**< Other, non-GATT specific type. */ -/** @} */ - - -/** @defgroup BLE_GATTS_OPS GATT Server Operations - * @{ */ -#define BLE_GATTS_OP_INVALID 0x00 /**< Invalid Operation. */ -#define BLE_GATTS_OP_WRITE_REQ 0x01 /**< Write Request. */ -#define BLE_GATTS_OP_WRITE_CMD 0x02 /**< Write Command. */ -#define BLE_GATTS_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */ -#define BLE_GATTS_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */ -#define BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL 0x05 /**< Execute Write Request: Cancel all prepared writes. */ -#define BLE_GATTS_OP_EXEC_WRITE_REQ_NOW 0x06 /**< Execute Write Request: Immediately execute all prepared writes. */ -/** @} */ - -/** @defgroup BLE_GATTS_VLOCS GATT Value Locations - * @{ */ -#define BLE_GATTS_VLOC_INVALID 0x00 /**< Invalid Location. */ -#define BLE_GATTS_VLOC_STACK 0x01 /**< Attribute Value is located in stack memory, no user memory is required. */ -#define BLE_GATTS_VLOC_USER 0x02 /**< Attribute Value is located in user memory. This requires the user to maintain a valid buffer through the lifetime of the attribute, since the stack - will read and write directly to the memory using the pointer provided in the APIs. There are no alignment requirements for the buffer. */ -/** @} */ - -/** @defgroup BLE_GATTS_AUTHORIZE_TYPES GATT Server Authorization Types - * @{ */ -#define BLE_GATTS_AUTHORIZE_TYPE_INVALID 0x00 /**< Invalid Type. */ -#define BLE_GATTS_AUTHORIZE_TYPE_READ 0x01 /**< Authorize a Read Operation. */ -#define BLE_GATTS_AUTHORIZE_TYPE_WRITE 0x02 /**< Authorize a Write Request Operation. */ -/** @} */ - -/** @defgroup BLE_GATTS_SYS_ATTR_FLAGS System Attribute Flags - * @{ */ -#define BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS (1 << 0) /**< Restrict system attributes to system services only. */ -#define BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS (1 << 1) /**< Restrict system attributes to user services only. */ -/** @} */ - -/** @defgroup BLE_GATTS_ATTR_TAB_SIZE Attribute Table size - * @{ - */ -#define BLE_GATTS_ATTR_TAB_SIZE_MIN 248 /**< Minimum Attribute Table size */ -#define BLE_GATTS_ATTR_TAB_SIZE_DEFAULT 0x0000 /**< Default Attribute Table size (0x580 bytes for this version of the SoftDevice). */ -/** @} */ - -/** @} */ - -/** @addtogroup BLE_GATTS_STRUCTURES Structures - * @{ */ - -/** - * @brief BLE GATTS initialization parameters. - */ -typedef struct -{ - uint8_t service_changed:1; /**< Include the Service Changed characteristic in the Attribute Table. */ - uint32_t attr_tab_size; /**< Attribute Table size in bytes. The size must be a multiple of 4. @ref BLE_GATTS_ATTR_TAB_SIZE_DEFAULT is used to set the default size. */ -} ble_gatts_enable_params_t; - -/**@brief Attribute metadata. */ -typedef struct -{ - ble_gap_conn_sec_mode_t read_perm; /**< Read permissions. */ - ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */ - uint8_t vlen :1; /**< Variable length attribute. */ - uint8_t vloc :2; /**< Value location, see @ref BLE_GATTS_VLOCS.*/ - uint8_t rd_auth :1; /**< Read authorization and value will be requested from the application on every read operation. */ - uint8_t wr_auth :1; /**< Write authorization will be requested from the application on every Write Request operation (but not Write Command). */ -} ble_gatts_attr_md_t; - - -/**@brief GATT Attribute. */ -typedef struct -{ - ble_uuid_t *p_uuid; /**< Pointer to the attribute UUID. */ - ble_gatts_attr_md_t *p_attr_md; /**< Pointer to the attribute metadata structure. */ - uint16_t init_len; /**< Initial attribute value length in bytes. */ - uint16_t init_offs; /**< Initial attribute value offset in bytes. If different from zero, the first init_offs bytes of the attribute value will be left uninitialized. */ - uint16_t max_len; /**< Maximum attribute value length in bytes, see @ref BLE_GATTS_ATTR_LENS_MAX for maximum values. */ - uint8_t* p_value; /**< Pointer to the attribute data. Please note that if the @ref BLE_GATTS_VLOC_USER value location is selected in the attribute metadata, this will have to point to a buffer - that remains valid through the lifetime of the attribute. This excludes usage of automatic variables that may go out of scope or any other temporary location. - The stack may access that memory directly without the application's knowledge. For writable characteristics, this value must not be a location in flash memory.*/ -} ble_gatts_attr_t; - -/**@brief GATT Attribute Value. */ -typedef struct -{ - uint16_t len; /**< Length in bytes to be written or read. Length in bytes written or read after successful return.*/ - uint16_t offset; /**< Attribute value offset. */ - uint8_t *p_value; /**< Pointer to where value is stored or will be stored. - If value is stored in user memory, only the attribute length is updated when p_value == NULL. - Set to NULL when reading to obtain the complete length of the attribute value */ -} ble_gatts_value_t; - - -/**@brief GATT Characteristic Presentation Format. */ -typedef struct -{ - uint8_t format; /**< Format of the value, see @ref BLE_GATT_CPF_FORMATS. */ - int8_t exponent; /**< Exponent for integer data types. */ - uint16_t unit; /**< Unit from Bluetooth Assigned Numbers. */ - uint8_t name_space; /**< Namespace from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */ - uint16_t desc; /**< Namespace description from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */ -} ble_gatts_char_pf_t; - - -/**@brief GATT Characteristic metadata. */ -typedef struct -{ - ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ - ble_gatt_char_ext_props_t char_ext_props; /**< Characteristic Extended Properties. */ - uint8_t *p_char_user_desc; /**< Pointer to a UTF-8 encoded string (non-NULL terminated), NULL if the descriptor is not required. */ - uint16_t char_user_desc_max_size; /**< The maximum size in bytes of the user description descriptor. */ - uint16_t char_user_desc_size; /**< The size of the user description, must be smaller or equal to char_user_desc_max_size. */ - ble_gatts_char_pf_t* p_char_pf; /**< Pointer to a presentation format structure or NULL if the CPF descriptor is not required. */ - ble_gatts_attr_md_t* p_user_desc_md; /**< Attribute metadata for the User Description descriptor, or NULL for default values. */ - ble_gatts_attr_md_t* p_cccd_md; /**< Attribute metadata for the Client Characteristic Configuration Descriptor, or NULL for default values. */ - ble_gatts_attr_md_t* p_sccd_md; /**< Attribute metadata for the Server Characteristic Configuration Descriptor, or NULL for default values. */ -} ble_gatts_char_md_t; - - -/**@brief GATT Characteristic Definition Handles. */ -typedef struct -{ - uint16_t value_handle; /**< Handle to the characteristic value. */ - uint16_t user_desc_handle; /**< Handle to the User Description descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ - uint16_t cccd_handle; /**< Handle to the Client Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ - uint16_t sccd_handle; /**< Handle to the Server Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */ -} ble_gatts_char_handles_t; - - -/**@brief GATT HVx parameters. */ -typedef struct -{ - uint16_t handle; /**< Characteristic Value Handle. */ - uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ - uint16_t offset; /**< Offset within the attribute value. */ - uint16_t *p_len; /**< Length in bytes to be written, length in bytes written after successful return. */ - uint8_t *p_data; /**< Actual data content, use NULL to use the current attribute value. */ -} ble_gatts_hvx_params_t; - -/**@brief GATT Authorization parameters. */ -typedef struct -{ - uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ - uint8_t update : 1; /**< If set, data supplied in p_data will be used to update the attribute value. - Please note that for @ref BLE_GATTS_AUTHORIZE_TYPE_WRITE operations this bit must always be set, - as the data to be written needs to be stored and later provided by the application. */ - uint16_t offset; /**< Offset of the attribute value being updated. */ - uint16_t len; /**< Length in bytes of the value in p_data pointer, see @ref BLE_GATTS_ATTR_LENS_MAX. */ - const uint8_t *p_data; /**< Pointer to new value used to update the attribute value. */ -} ble_gatts_authorize_params_t; - -/**@brief GATT Read or Write Authorize Reply parameters. */ -typedef struct -{ - uint8_t type; /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */ - union { - ble_gatts_authorize_params_t read; /**< Read authorization parameters. */ - ble_gatts_authorize_params_t write; /**< Write authorization parameters. */ - } params; /**< Reply Parameters. */ -} ble_gatts_rw_authorize_reply_params_t; - - - -/**@brief Event structure for @ref BLE_GATTS_EVT_WRITE. */ -typedef struct -{ - uint16_t handle; /**< Attribute Handle. */ - ble_uuid_t uuid; /**< Attribute UUID. */ - uint8_t op; /**< Type of write operation, see @ref BLE_GATTS_OPS. */ - uint8_t auth_required; /**< Writing operation deferred due to authorization requirement. Application may use @ref sd_ble_gatts_value_set to finalise the writing operation. */ - uint16_t offset; /**< Offset for the write operation. */ - uint16_t len; /**< Length of the received data. */ - uint8_t data[1]; /**< Received data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_gatts_evt_write_t; - -/**@brief Event substructure for authorized read requests, see @ref ble_gatts_evt_rw_authorize_request_t. */ -typedef struct -{ - uint16_t handle; /**< Attribute Handle. */ - ble_uuid_t uuid; /**< Attribute UUID. */ - uint16_t offset; /**< Offset for the read operation. */ -} ble_gatts_evt_read_t; - -/**@brief Event structure for @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST. */ -typedef struct -{ - uint8_t type; /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */ - union { - ble_gatts_evt_read_t read; /**< Attribute Read Parameters. */ - ble_gatts_evt_write_t write; /**< Attribute Write Parameters. */ - } request; /**< Request Parameters. */ -} ble_gatts_evt_rw_authorize_request_t; - -/**@brief Event structure for @ref BLE_GATTS_EVT_SYS_ATTR_MISSING. */ -typedef struct -{ - uint8_t hint; /**< Hint (currently unused). */ -} ble_gatts_evt_sys_attr_missing_t; - - -/**@brief Event structure for @ref BLE_GATTS_EVT_HVC. */ -typedef struct -{ - uint16_t handle; /**< Attribute Handle. */ -} ble_gatts_evt_hvc_t; - -/**@brief Event structure for @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST. */ -typedef struct -{ - uint16_t client_rx_mtu; /**< Client RX MTU size. */ -} ble_gatts_evt_exchange_mtu_request_t; - -/**@brief Event structure for @ref BLE_GATTS_EVT_TIMEOUT. */ -typedef struct -{ - uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ -} ble_gatts_evt_timeout_t; - - -/**@brief GATTS event structure. */ -typedef struct -{ - uint16_t conn_handle; /**< Connection Handle on which the event occurred. */ - union - { - ble_gatts_evt_write_t write; /**< Write Event Parameters. */ - ble_gatts_evt_rw_authorize_request_t authorize_request; /**< Read or Write Authorize Request Parameters. */ - ble_gatts_evt_sys_attr_missing_t sys_attr_missing; /**< System attributes missing. */ - ble_gatts_evt_hvc_t hvc; /**< Handle Value Confirmation Event Parameters. */ - ble_gatts_evt_exchange_mtu_request_t exchange_mtu_request; /**< Exchange MTU Request Event Parameters. */ - ble_gatts_evt_timeout_t timeout; /**< Timeout Event. */ - } params; /**< Event Parameters. */ -} ble_gatts_evt_t; - -/** @} */ - -/** @addtogroup BLE_GATTS_FUNCTIONS Functions - * @{ */ - -/**@brief Add a service declaration to the Attribute Table. - * - * @note Secondary Services are only relevant in the context of the entity that references them, it is therefore forbidden to - * add a secondary service declaration that is not referenced by another service later in the Attribute Table. - * - * @mscs - * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} - * @endmscs - * - * @param[in] type Toggles between primary and secondary services, see @ref BLE_GATTS_SRVC_TYPES. - * @param[in] p_uuid Pointer to service UUID. - * @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored. - * - * @retval ::NRF_SUCCESS Successfully added a service declaration. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, Vendor Specific UUIDs need to be present in the table. - * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. - * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. - */ -SVCALL(SD_BLE_GATTS_SERVICE_ADD, uint32_t, sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, uint16_t *p_handle)); - - -/**@brief Add an include declaration to the Attribute Table. - * - * @note It is currently only possible to add an include declaration to the last added service (i.e. only sequential population is supported at this time). - * - * @note The included service must already be present in the Attribute Table prior to this call. - * - * @mscs - * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} - * @endmscs - * - * @param[in] service_handle Handle of the service where the included service is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. - * @param[in] inc_srvc_handle Handle of the included service. - * @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored. - * - * @retval ::NRF_SUCCESS Successfully added an include declaration. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, handle values need to match previously added services. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. - * @retval ::NRF_ERROR_NOT_SUPPORTED Feature is not supported, service_handle must be that of the last added service. - * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, self inclusions are not allowed. - * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. - * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. - */ -SVCALL(SD_BLE_GATTS_INCLUDE_ADD, uint32_t, sd_ble_gatts_include_add(uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *p_include_handle)); - - -/**@brief Add a characteristic declaration, a characteristic value declaration and optional characteristic descriptor declarations to the Attribute Table. - * - * @note It is currently only possible to add a characteristic to the last added service (i.e. only sequential population is supported at this time). - * - * @note Several restrictions apply to the parameters, such as matching permissions between the user description descriptor and the writeable auxiliaries bits, - * readable (no security) and writeable (selectable) CCCDs and SCCDs and valid presentation format values. - * - * @note If no metadata is provided for the optional descriptors, their permissions will be derived from the characteristic permissions. - * - * @mscs - * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} - * @endmscs - * - * @param[in] service_handle Handle of the service where the characteristic is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. - * @param[in] p_char_md Characteristic metadata. - * @param[in] p_attr_char_value Pointer to the attribute structure corresponding to the characteristic value. - * @param[out] p_handles Pointer to the structure where the assigned handles will be stored. - * - * @retval ::NRF_SUCCESS Successfully added a characteristic. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, service handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a service context is required. - * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. - * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. - * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. - */ -SVCALL(SD_BLE_GATTS_CHARACTERISTIC_ADD, uint32_t, sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_t const *p_char_md, ble_gatts_attr_t const *p_attr_char_value, ble_gatts_char_handles_t *p_handles)); - - -/**@brief Add a descriptor to the Attribute Table. - * - * @note It is currently only possible to add a descriptor to the last added characteristic (i.e. only sequential population is supported at this time). - * - * @mscs - * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC} - * @endmscs - * - * @param[in] char_handle Handle of the characteristic where the descriptor is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. - * @param[in] p_attr Pointer to the attribute structure. - * @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored. - * - * @retval ::NRF_SUCCESS Successfully added a descriptor. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, characteristic handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints. - * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a characteristic context is required. - * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack. - * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. - * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. - */ -SVCALL(SD_BLE_GATTS_DESCRIPTOR_ADD, uint32_t, sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_t const *p_attr, uint16_t *p_handle)); - -/**@brief Set the value of a given attribute. - * - * @note Values other than system attributes can be set at any time, regardless of wheter any active connections exist. - * - * @mscs - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. Ignored if the value does not belong to a system attribute. - * @param[in] handle Attribute handle. - * @param[in,out] p_value Attribute value information. - * - * @retval ::NRF_SUCCESS Successfully set the value of the attribute. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. - * @retval ::NRF_ERROR_FORBIDDEN Forbidden handle supplied, certain attributes are not modifiable by the application. - * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied on a system attribute. - */ -SVCALL(SD_BLE_GATTS_VALUE_SET, uint32_t, sd_ble_gatts_value_set(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)); - -/**@brief Get the value of a given attribute. - * - * @note If the attribute value is longer than the size of the supplied buffer, - * p_len will return the total attribute value length (excluding offset), - * and not the number of bytes actually returned in p_data. - * The application may use this information to allocate a suitable buffer size. - * - * @note When retrieving system attribute values with this function, the connection handle - * may refer to an already disconnected connection. Refer to the documentation of - * @ref sd_ble_gatts_sys_attr_get for further information. - * - * @param[in] conn_handle Connection handle. Ignored if the value does not belong to a system attribute. - * @param[in] handle Attribute handle. - * @param[in,out] p_value Attribute value information. - * - * @retval ::NRF_SUCCESS Successfully retrieved the value of the attribute. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid attribute offset supplied. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied on a system attribute. - * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. - */ -SVCALL(SD_BLE_GATTS_VALUE_GET, uint32_t, sd_ble_gatts_value_get(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)); - -/**@brief Notify or Indicate an attribute value. - * - * @details This function checks for the relevant Client Characteristic Configuration descriptor value to verify that the relevant operation - * (notification or indication) has been enabled by the client. It is also able to update the attribute value before issuing the PDU, so that - * the application can atomically perform a value update and a server initiated transaction with a single API call. - * If the application chooses to indicate an attribute value, a @ref BLE_GATTS_EVT_HVC event will be issued as soon as the confirmation arrives from - * the peer. - * - * @note The local attribute value may be updated even if an outgoing packet is not sent to the peer due to an error during execution. - * The Attribute Table has been updated if one of the following error codes is returned: @ref NRF_ERROR_INVALID_STATE, @ref NRF_ERROR_BUSY, - * @ref NRF_ERROR_FORBIDDEN, @ref BLE_ERROR_GATTS_SYS_ATTR_MISSING and @ref BLE_ERROR_NO_TX_PACKETS. - * The caller can check whether the value has been updated by looking at the contents of *(p_hvx_params->p_len). - * - * @note It is important to note that a notification will consume an application buffer, and will therefore - * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. An indication on the other hand will use the - * standard server internal buffer and thus will only generate a @ref BLE_GATTS_EVT_HVC event as soon as the confirmation - * has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. - * - * @events - * @event{@ref BLE_EVT_TX_COMPLETE, Transmission complete.} - * @event{@ref BLE_GATTS_EVT_HVC, Confirmation received from peer.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC} - * @mmsc{@ref BLE_GATTS_HVN_MSC} - * @mmsc{@ref BLE_GATTS_HVI_MSC} - * @mmsc{@ref BLE_GATTS_HVX_DISABLED_MSC} - * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_hvx_params Pointer to an HVx parameters structure. If the p_data member contains a non-NULL pointer the attribute value will be updated with - * the contents pointed by it before sending the notification or indication. - * - * @retval ::NRF_SUCCESS Successfully queued a notification or indication for transmission, and optionally updated the attribute value. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE One or more of the following is true: - * - Invalid Connection State - * - Notifications and/or indications not enabled in the CCCD - * - An ATT_MTU exchange is ongoing - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied. Only attributes added directly by the application are available to notify and indicate. - * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE Invalid attribute type(s) supplied, only characteristic values may be notified and indicated. - * @retval ::NRF_ERROR_NOT_FOUND Attribute not found. - * @retval ::NRF_ERROR_FORBIDDEN The connection's current security level is lower than the one required by the write permissions of the CCCD associated with this characteristic. - * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. - * @retval ::NRF_ERROR_BUSY Procedure already in progress. - * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. - * @retval ::BLE_ERROR_NO_TX_PACKETS No available application packets for this connection, applies only to notifications. - */ -SVCALL(SD_BLE_GATTS_HVX, uint32_t, sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const *p_hvx_params)); - -/**@brief Indicate the Service Changed attribute value. - * - * @details This call will send a Handle Value Indication to one or more peers connected to inform them that the Attribute - * Table layout has changed. As soon as the peer has confirmed the indication, a @ref BLE_GATTS_EVT_SC_CONFIRM event will - * be issued. - * - * @note Some of the restrictions and limitations that apply to @ref sd_ble_gatts_hvx also apply here. - * - * @events - * @event{@ref BLE_GATTS_EVT_SC_CONFIRM, Confirmation of attribute table change received from peer.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTS_SC_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] start_handle Start of affected attribute handle range. - * @param[in] end_handle End of affected attribute handle range. - * - * @retval ::NRF_SUCCESS Successfully queued the Service Changed indication for transmission. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_NOT_SUPPORTED Service Changed not enabled at initialization. See @ref sd_ble_enable and @ref ble_gatts_enable_params_t. - * @retval ::NRF_ERROR_INVALID_STATE One or more of the following is true: - * - Invalid Connection State - * - Notifications and/or indications not enabled in the CCCD - * - An ATT_MTU exchange is ongoing - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied, handles must be in the range populated by the application. - * @retval ::NRF_ERROR_BUSY Procedure already in progress. - * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value. - */ -SVCALL(SD_BLE_GATTS_SERVICE_CHANGED, uint32_t, sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle)); - -/**@brief Respond to a Read/Write authorization request. - * - * @note This call should only be used as a response to a @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event issued to the application. - * - * @mscs - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_AUTH_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_AUTH_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC} - * @mmsc{@ref BLE_GATTS_READ_REQ_AUTH_MSC} - * @mmsc{@ref BLE_GATTS_WRITE_REQ_AUTH_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC} - * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_PEER_CANCEL_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_rw_authorize_reply_params Pointer to a structure with the attribute provided by the application. - * - * @note @ref ble_gatts_authorize_params_t::p_data is ignored when this function is used to respond - * to a @ref BLE_GATTS_AUTHORIZE_TYPE_READ event if @ref ble_gatts_authorize_params_t::update - * is set to 0. - * - * @retval ::NRF_SUCCESS Successfully queued a response to the peer, and in the case of a write operation, Attribute Table updated. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no authorization request pending. - * @retval ::NRF_ERROR_INVALID_PARAM Authorization op invalid, - * handle supplied does not match requested handle, - * or invalid data to be written provided by the application. - * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. - */ -SVCALL(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, uint32_t, sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *p_rw_authorize_reply_params)); - - -/**@brief Update persistent system attribute information. - * - * @details Supply information about persistent system attributes to the stack, - * previously obtained using @ref sd_ble_gatts_sys_attr_get. - * This call is only allowed for active connections, and is usually - * made immediately after a connection is established with an known bonded device, - * often as a response to a @ref BLE_GATTS_EVT_SYS_ATTR_MISSING. - * - * p_sysattrs may point directly to the application's stored copy of the system attributes - * obtained using @ref sd_ble_gatts_sys_attr_get. - * If the pointer is NULL, the system attribute info is initialized, assuming that - * the application does not have any previously saved system attribute data for this device. - * - * @note The state of persistent system attributes is reset upon connection establishment and then remembered for its duration. - * - * @note If this call returns with an error code different from @ref NRF_SUCCESS, the storage of persistent system attributes may have been completed only partially. - * This means that the state of the attribute table is undefined, and the application should either provide a new set of attributes using this same call or - * reset the SoftDevice to return to a known state. - * - * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be modified. - * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be modified. - * - * @mscs - * @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC} - * @mmsc{@ref BLE_GATTS_SYS_ATTRS_UNK_PEER_MSC} - * @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle. - * @param[in] p_sys_attr_data Pointer to a saved copy of system attributes supplied to the stack, or NULL. - * @param[in] len Size of data pointed by p_sys_attr_data, in octets. - * @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS - * - * @retval ::NRF_SUCCESS Successfully set the system attribute information. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid flags supplied. - * @retval ::NRF_ERROR_INVALID_DATA Invalid data supplied, the data should be exactly the same as retrieved with @ref sd_ble_gatts_sys_attr_get. - * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. - * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. - */ -SVCALL(SD_BLE_GATTS_SYS_ATTR_SET, uint32_t, sd_ble_gatts_sys_attr_set(uint16_t conn_handle, uint8_t const *p_sys_attr_data, uint16_t len, uint32_t flags)); - - -/**@brief Retrieve persistent system attribute information from the stack. - * - * @details This call is used to retrieve information about values to be stored perisistently by the application - * during the lifetime of a connection or after it has been terminated. When a new connection is established with the same bonded device, - * the system attribute information retrieved with this function should be restored using using @ref sd_ble_gatts_sys_attr_set. - * If retrieved after disconnection, the data should be read before a new connection established. The connection handle for - * the previous, now disconnected, connection will remain valid until a new one is created to allow this API call to refer to it. - * Connection handles belonging to active connections can be used as well, but care should be taken since the system attributes - * may be written to at any time by the peer during a connection's lifetime. - * - * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be returned. - * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be returned. - * - * @mscs - * @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC} - * @endmscs - * - * @param[in] conn_handle Connection handle of the recently terminated connection. - * @param[out] p_sys_attr_data Pointer to a buffer where updated information about system attributes will be filled in. The format of the data is described - * in @ref BLE_GATTS_SYS_ATTRS_FORMAT. NULL can be provided to obtain the length of the data. - * @param[in,out] p_len Size of application buffer if p_sys_attr_data is not NULL. Unconditially updated to actual length of system attribute data. - * @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS - * - * @retval ::NRF_SUCCESS Successfully retrieved the system attribute information. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid flags supplied. - * @retval ::NRF_ERROR_DATA_SIZE The system attribute information did not fit into the provided buffer. - * @retval ::NRF_ERROR_NOT_FOUND No system attributes found. - */ -SVCALL(SD_BLE_GATTS_SYS_ATTR_GET, uint32_t, sd_ble_gatts_sys_attr_get(uint16_t conn_handle, uint8_t *p_sys_attr_data, uint16_t *p_len, uint32_t flags)); - - -/**@brief Retrieve the first valid user attribute handle. - * - * @param[out] p_handle Pointer to an integer where the handle will be stored. - * - * @retval ::NRF_SUCCESS Successfully retrieved the handle. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - */ -SVCALL(SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, uint32_t, sd_ble_gatts_initial_user_handle_get(uint16_t *p_handle)); - -/**@brief Retrieve the attribute UUID and/or metadata. - * - * @param[in] handle Attribute handle - * @param[out] p_uuid UUID of the attribute. Use NULL to omit this field. - * @param[out] p_md Metadata of the attribute. Use NULL to omit this field. - * - * @retval ::NRF_SUCCESS Successfully retrieved the attribute metadata, - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameters supplied. Returned when both @c p_uuid and @c p_md are NULL. - * @retval ::NRF_ERROR_NOT_FOUND Attribute was not found. - */ -SVCALL(SD_BLE_GATTS_ATTR_GET, uint32_t, sd_ble_gatts_attr_get(uint16_t handle, ble_uuid_t * p_uuid, ble_gatts_attr_md_t * p_md)); - -/**@brief Reply to an ATT_MTU exchange request by sending an Exchange MTU Response to the client. - * - * @details This function is only used to reply to a @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST event. - * - * @details The SoftDevice sets ATT_MTU to the minimum of: - * - The Client RX MTU value from @ref BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST, and - * - The Server RX MTU value. - * - * However, the SoftDevice never sets ATT_MTU lower than @ref BLE_GATT_MTU_SIZE_DEFAULT. - * - * @events - * @event{@ref BLE_EVT_DATA_LENGTH_CHANGED, Generated if a data length update procedure is performed after the ATT_MTU exchange.} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_GATTS_MTU_EXCHANGE} - * @endmscs - * - * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. - * @param[in] server_rx_mtu Server RX MTU size. - * - The minimum value is @ref BLE_GATT_MTU_SIZE_DEFAULT. - * - The maximum value is @ref ble_gatt_enable_params_t::att_mtu. - * - The value must be equal to Client RX MTU size given in @ref sd_ble_gattc_exchange_mtu_request - * if an ATT_MTU exchange has already been performed in the other direction. - * - * @retval ::NRF_SUCCESS Successfully sent response to the client. - * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. - * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no ATT_MTU exchange request pending. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid Server RX MTU size supplied. - * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time. - */ -SVCALL(SD_BLE_GATTS_EXCHANGE_MTU_REPLY, uint32_t, sd_ble_gatts_exchange_mtu_reply(uint16_t conn_handle, uint16_t server_rx_mtu)); -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif // BLE_GATTS_H__ - -/** - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_hci.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_hci.h deleted file mode 100644 index fd619b52c8..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_hci.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_COMMON - @{ -*/ - - -#ifndef BLE_HCI_H__ -#define BLE_HCI_H__ -#ifdef __cplusplus -extern "C" { -#endif - -/** @defgroup BLE_HCI_STATUS_CODES Bluetooth status codes - * @{ */ - -#define BLE_HCI_STATUS_CODE_SUCCESS 0x00 /**< Success. */ -#define BLE_HCI_STATUS_CODE_UNKNOWN_BTLE_COMMAND 0x01 /**< Unknown BLE Command. */ -#define BLE_HCI_STATUS_CODE_UNKNOWN_CONNECTION_IDENTIFIER 0x02 /**< Unknown Connection Identifier. */ -/*0x03 Hardware Failure -0x04 Page Timeout -*/ -#define BLE_HCI_AUTHENTICATION_FAILURE 0x05 /**< Authentication Failure. */ -#define BLE_HCI_STATUS_CODE_PIN_OR_KEY_MISSING 0x06 /**< Pin or Key missing. */ -#define BLE_HCI_MEMORY_CAPACITY_EXCEEDED 0x07 /**< Memory Capacity Exceeded. */ -#define BLE_HCI_CONNECTION_TIMEOUT 0x08 /**< Connection Timeout. */ -/*0x09 Connection Limit Exceeded -0x0A Synchronous Connection Limit To A Device Exceeded -0x0B ACL Connection Already Exists*/ -#define BLE_HCI_STATUS_CODE_COMMAND_DISALLOWED 0x0C /**< Command Disallowed. */ -/*0x0D Connection Rejected due to Limited Resources -0x0E Connection Rejected Due To Security Reasons -0x0F Connection Rejected due to Unacceptable BD_ADDR -0x10 Connection Accept Timeout Exceeded -0x11 Unsupported Feature or Parameter Value*/ -#define BLE_HCI_STATUS_CODE_INVALID_BTLE_COMMAND_PARAMETERS 0x12 /**< Invalid BLE Command Parameters. */ -#define BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION 0x13 /**< Remote User Terminated Connection. */ -#define BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES 0x14 /**< Remote Device Terminated Connection due to low resources.*/ -#define BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF 0x15 /**< Remote Device Terminated Connection due to power off. */ -#define BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION 0x16 /**< Local Host Terminated Connection. */ -/* -0x17 Repeated Attempts -0x18 Pairing Not Allowed -0x19 Unknown LMP PDU -*/ -#define BLE_HCI_UNSUPPORTED_REMOTE_FEATURE 0x1A /**< Unsupported Remote Feature. */ -/* -0x1B SCO Offset Rejected -0x1C SCO Interval Rejected -0x1D SCO Air Mode Rejected*/ -#define BLE_HCI_STATUS_CODE_INVALID_LMP_PARAMETERS 0x1E /**< Invalid LMP Parameters. */ -#define BLE_HCI_STATUS_CODE_UNSPECIFIED_ERROR 0x1F /**< Unspecified Error. */ -/*0x20 Unsupported LMP Parameter Value -0x21 Role Change Not Allowed -*/ -#define BLE_HCI_STATUS_CODE_LMP_RESPONSE_TIMEOUT 0x22 /**< LMP Response Timeout. */ -#define BLE_HCI_STATUS_CODE_LMP_ERROR_TRANSACTION_COLLISION 0x23 /**< LMP Error Transaction Collision/LL Procedure Collision. */ -#define BLE_HCI_STATUS_CODE_LMP_PDU_NOT_ALLOWED 0x24 /**< LMP PDU Not Allowed. */ -/*0x25 Encryption Mode Not Acceptable -0x26 Link Key Can Not be Changed -0x27 Requested QoS Not Supported -*/ -#define BLE_HCI_INSTANT_PASSED 0x28 /**< Instant Passed. */ -#define BLE_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED 0x29 /**< Pairing with Unit Key Unsupported. */ -#define BLE_HCI_DIFFERENT_TRANSACTION_COLLISION 0x2A /**< Different Transaction Collision. */ -/* -0x2B Reserved -0x2C QoS Unacceptable Parameter -0x2D QoS Rejected -0x2E Channel Classification Not Supported -0x2F Insufficient Security -0x30 Parameter Out Of Mandatory Range -0x31 Reserved -0x32 Role Switch Pending -0x33 Reserved -0x34 Reserved Slot Violation -0x35 Role Switch Failed -0x36 Extended Inquiry Response Too Large -0x37 Secure Simple Pairing Not Supported By Host. -0x38 Host Busy - Pairing -0x39 Connection Rejected due to No Suitable Channel Found*/ -#define BLE_HCI_CONTROLLER_BUSY 0x3A /**< Controller Busy. */ -#define BLE_HCI_CONN_INTERVAL_UNACCEPTABLE 0x3B /**< Connection Interval Unacceptable. */ -#define BLE_HCI_DIRECTED_ADVERTISER_TIMEOUT 0x3C /**< Directed Adverisement Timeout. */ -#define BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE 0x3D /**< Connection Terminated due to MIC Failure. */ -#define BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED 0x3E /**< Connection Failed to be Established. */ - -/** @} */ - - -#ifdef __cplusplus -} -#endif -#endif // BLE_HCI_H__ - -/** @} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_l2cap.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_l2cap.h deleted file mode 100644 index eaad7e50fc..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_l2cap.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_L2CAP Logical Link Control and Adaptation Protocol (L2CAP) - @{ - @brief Definitions and prototypes for the L2CAP interface. - */ - -#ifndef BLE_L2CAP_H__ -#define BLE_L2CAP_H__ - -#include "ble_types.h" -#include "ble_ranges.h" -#include "ble_err.h" -#include "nrf_svc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**@addtogroup BLE_L2CAP_ENUMERATIONS Enumerations - * @{ */ - -/**@brief L2CAP API SVC numbers. */ -enum BLE_L2CAP_SVCS -{ - SD_BLE_L2CAP_CID_REGISTER = BLE_L2CAP_SVC_BASE, /**< Register a CID. */ - SD_BLE_L2CAP_CID_UNREGISTER, /**< Unregister a CID. */ - SD_BLE_L2CAP_TX /**< Transmit a packet. */ -}; - -/**@brief L2CAP Event IDs. */ -enum BLE_L2CAP_EVTS -{ - BLE_L2CAP_EVT_RX = BLE_L2CAP_EVT_BASE /**< L2CAP packet received. */ -}; - -/** @} */ - -/**@addtogroup BLE_L2CAP_DEFINES Defines - * @{ */ - -/**@defgroup BLE_ERRORS_L2CAP SVC return values specific to L2CAP - * @{ */ -#define BLE_ERROR_L2CAP_CID_IN_USE (NRF_L2CAP_ERR_BASE + 0x000) /**< CID already in use. */ -/** @} */ - -/**@brief Default L2CAP MTU. */ -#define BLE_L2CAP_MTU_DEF (23) - -/**@brief Invalid Channel Identifier. */ -#define BLE_L2CAP_CID_INVALID (0x0000) - -/**@brief Dynamic Channel Identifier base. */ -#define BLE_L2CAP_CID_DYN_BASE (0x0040) - -/**@brief Maximum amount of dynamic CIDs. */ -#define BLE_L2CAP_CID_DYN_MAX (8) - -/** @} */ - -/**@addtogroup BLE_L2CAP_STRUCTURES Structures - * @{ */ - -/**@brief Packet header format for L2CAP transmission. */ -typedef struct -{ - uint16_t len; /**< Length of valid info in data member. */ - uint16_t cid; /**< Channel ID on which packet is transmitted. */ -} ble_l2cap_header_t; - - -/**@brief L2CAP Received packet event report. */ -typedef struct -{ - ble_l2cap_header_t header; /**< L2CAP packet header. */ - uint8_t data[1]; /**< Packet data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. - See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ -} ble_l2cap_evt_rx_t; - - -/**@brief L2CAP event callback event structure. */ -typedef struct -{ - uint16_t conn_handle; /**< Connection Handle on which event occured. */ - union - { - ble_l2cap_evt_rx_t rx; /**< RX Event parameters. */ - } params; /**< Event Parameters. */ -} ble_l2cap_evt_t; - -/** @} */ - -/**@addtogroup BLE_L2CAP_FUNCTIONS Functions - * @{ */ - -/**@brief Register a CID with L2CAP. - * - * @details This registers a higher protocol layer with the L2CAP multiplexer, and is requried prior to all operations on the CID. - * - * @mscs - * @mmsc{@ref BLE_L2CAP_API_MSC} - * @endmscs - * - * @param[in] cid L2CAP CID. - * - * @retval ::NRF_SUCCESS Successfully registered a CID with the L2CAP layer. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CID must be above @ref BLE_L2CAP_CID_DYN_BASE. - * @retval ::BLE_ERROR_L2CAP_CID_IN_USE L2CAP CID already in use. - * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. - */ -SVCALL(SD_BLE_L2CAP_CID_REGISTER, uint32_t, sd_ble_l2cap_cid_register(uint16_t cid)); - -/**@brief Unregister a CID with L2CAP. - * - * @details This unregisters a previously registerd higher protocol layer with the L2CAP multiplexer. - * - * @mscs - * @mmsc{@ref BLE_L2CAP_API_MSC} - * @endmscs - * - * @param[in] cid L2CAP CID. - * - * @retval ::NRF_SUCCESS Successfully unregistered the CID. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - * @retval ::NRF_ERROR_NOT_FOUND CID not previously registered. - */ -SVCALL(SD_BLE_L2CAP_CID_UNREGISTER, uint32_t, sd_ble_l2cap_cid_unregister(uint16_t cid)); - -/**@brief Transmit an L2CAP packet. - * - * @note It is important to note that a call to this function will consume an application packet, and will therefore - * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. - * Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. - * - * @events - * @event{@ref BLE_EVT_TX_COMPLETE} - * @event{@ref BLE_L2CAP_EVT_RX} - * @endevents - * - * @mscs - * @mmsc{@ref BLE_L2CAP_API_MSC} - * @endmscs - * - * @param[in] conn_handle Connection Handle. - * @param[in] p_header Pointer to a packet header containing length and CID. - * @param[in] p_data Pointer to the data to be transmitted. - * - * @retval ::NRF_SUCCESS Successfully queued an L2CAP packet for transmission. - * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. - * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register. - * @retval ::NRF_ERROR_NOT_FOUND CID not found. - * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation. - * @retval ::BLE_ERROR_NO_TX_PACKETS Not enough application packets available. - * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF. - */ -SVCALL(SD_BLE_L2CAP_TX, uint32_t, sd_ble_l2cap_tx(uint16_t conn_handle, ble_l2cap_header_t const *p_header, uint8_t const *p_data)); - -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif // BLE_L2CAP_H__ - -/** - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_ranges.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_ranges.h deleted file mode 100644 index 051d1438d1..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_ranges.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_COMMON - @{ - @defgroup ble_ranges Module specific SVC, event and option number subranges - @{ - - @brief Definition of SVC, event and option number subranges for each API module. - - @note - SVCs, event and option numbers are split into subranges for each API module. - Each module receives its entire allocated range of SVC calls, whether implemented or not, - but return BLE_ERROR_NOT_SUPPORTED for unimplemented or undefined calls in its range. - - Note that the symbols BLE__SVC_LAST is the end of the allocated SVC range, - rather than the last SVC function call actually defined and implemented. - - Specific SVC, event and option values are defined in each module's ble_.h file, - which defines names of each individual SVC code based on the range start value. -*/ - -#ifndef BLE_RANGES_H__ -#define BLE_RANGES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define BLE_SVC_BASE 0x60 /**< Common BLE SVC base. */ -#define BLE_SVC_LAST 0x6B /**< Common BLE SVC last. */ - - -#define BLE_GAP_SVC_BASE 0x6C /**< GAP BLE SVC base. */ -#define BLE_GAP_SVC_LAST 0x93 /**< GAP BLE SVC last. */ - - -#define BLE_GATTC_SVC_BASE 0x94 /**< GATTC BLE SVC base. */ -#define BLE_GATTC_SVC_LAST 0x9F /**< GATTC BLE SVC last. */ - - -#define BLE_GATTS_SVC_BASE 0xA0 /**< GATTS BLE SVC base. */ -#define BLE_GATTS_SVC_LAST 0xAF /**< GATTS BLE SVC last. */ - - -#define BLE_L2CAP_SVC_BASE 0xB0 /**< L2CAP BLE SVC base. */ -#define BLE_L2CAP_SVC_LAST 0xBF /**< L2CAP BLE SVC last. */ - - -#define BLE_EVT_INVALID 0x00 /**< Invalid BLE Event. */ - - -#define BLE_EVT_BASE 0x01 /**< Common BLE Event base. */ -#define BLE_EVT_LAST 0x0F /**< Common BLE Event last. */ - - -#define BLE_GAP_EVT_BASE 0x10 /**< GAP BLE Event base. */ -#define BLE_GAP_EVT_LAST 0x2F /**< GAP BLE Event last. */ - - -#define BLE_GATTC_EVT_BASE 0x30 /**< GATTC BLE Event base. */ -#define BLE_GATTC_EVT_LAST 0x4F /**< GATTC BLE Event last. */ - - -#define BLE_GATTS_EVT_BASE 0x50 /**< GATTS BLE Event base. */ -#define BLE_GATTS_EVT_LAST 0x6F /**< GATTS BLE Event last. */ - - -#define BLE_L2CAP_EVT_BASE 0x70 /**< L2CAP BLE Event base. */ -#define BLE_L2CAP_EVT_LAST 0x8F /**< L2CAP BLE Event last. */ - - -#define BLE_OPT_INVALID 0x00 /**< Invalid BLE Option. */ - - -#define BLE_OPT_BASE 0x01 /**< Common BLE Option base. */ -#define BLE_OPT_LAST 0x1F /**< Common BLE Option last. */ - - -#define BLE_GAP_OPT_BASE 0x20 /**< GAP BLE Option base. */ -#define BLE_GAP_OPT_LAST 0x3F /**< GAP BLE Option last. */ - - -#define BLE_GATTC_OPT_BASE 0x40 /**< GATTC BLE Option base. */ -#define BLE_GATTC_OPT_LAST 0x5F /**< GATTC BLE Option last. */ - - -#define BLE_GATTS_OPT_BASE 0x60 /**< GATTS BLE Option base. */ -#define BLE_GATTS_OPT_LAST 0x7F /**< GATTS BLE Option last. */ - - -#define BLE_L2CAP_OPT_BASE 0x80 /**< L2CAP BLE Option base. */ -#define BLE_L2CAP_OPT_LAST 0x9F /**< L2CAP BLE Option last. */ - - -#ifdef __cplusplus -} -#endif -#endif /* BLE_RANGES_H__ */ - -/** - @} - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_types.h deleted file mode 100644 index a85332a4c3..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/ble_types.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - @addtogroup BLE_COMMON - @{ - @defgroup ble_types Common types and macro definitions - @{ - - @brief Common types and macro definitions for the BLE SoftDevice. - */ - -#ifndef BLE_TYPES_H__ -#define BLE_TYPES_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup BLE_TYPES_DEFINES Defines - * @{ */ - -/** @defgroup BLE_CONN_HANDLES BLE Connection Handles - * @{ */ -#define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */ -#define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */ -/** @} */ - - -/** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs - * @{ */ -/* Generic UUIDs, applicable to all services */ -#define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */ -#define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */ -#define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */ -#define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */ -#define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */ -#define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */ -#define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */ -#define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */ -#define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */ -#define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */ -#define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */ -/* GATT specific UUIDs */ -#define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */ -#define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */ -/* GAP specific UUIDs */ -#define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */ -#define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_CAR 0x2AA6 /**< Central Address Resolution Characteristic. */ -/** @} */ - - -/** @defgroup BLE_UUID_TYPES Types of UUID - * @{ */ -#define BLE_UUID_TYPE_UNKNOWN 0x00 /**< Invalid UUID type. */ -#define BLE_UUID_TYPE_BLE 0x01 /**< Bluetooth SIG UUID (16-bit). */ -#define BLE_UUID_TYPE_VENDOR_BEGIN 0x02 /**< Vendor UUID types start at this index (128-bit). */ -/** @} */ - - -/** @defgroup BLE_APPEARANCES Bluetooth Appearance values - * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml - * @{ */ -#define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */ -#define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */ -#define BLE_APPEARANCE_GENERIC_COMPUTER 128 /**< Generic Computer. */ -#define BLE_APPEARANCE_GENERIC_WATCH 192 /**< Generic Watch. */ -#define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193 /**< Watch: Sports Watch. */ -#define BLE_APPEARANCE_GENERIC_CLOCK 256 /**< Generic Clock. */ -#define BLE_APPEARANCE_GENERIC_DISPLAY 320 /**< Generic Display. */ -#define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384 /**< Generic Remote Control. */ -#define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448 /**< Generic Eye-glasses. */ -#define BLE_APPEARANCE_GENERIC_TAG 512 /**< Generic Tag. */ -#define BLE_APPEARANCE_GENERIC_KEYRING 576 /**< Generic Keyring. */ -#define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640 /**< Generic Media Player. */ -#define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704 /**< Generic Barcode Scanner. */ -#define BLE_APPEARANCE_GENERIC_THERMOMETER 768 /**< Generic Thermometer. */ -#define BLE_APPEARANCE_THERMOMETER_EAR 769 /**< Thermometer: Ear. */ -#define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832 /**< Generic Heart rate Sensor. */ -#define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833 /**< Heart Rate Sensor: Heart Rate Belt. */ -#define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896 /**< Generic Blood Pressure. */ -#define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897 /**< Blood Pressure: Arm. */ -#define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898 /**< Blood Pressure: Wrist. */ -#define BLE_APPEARANCE_GENERIC_HID 960 /**< Human Interface Device (HID). */ -#define BLE_APPEARANCE_HID_KEYBOARD 961 /**< Keyboard (HID Subtype). */ -#define BLE_APPEARANCE_HID_MOUSE 962 /**< Mouse (HID Subtype). */ -#define BLE_APPEARANCE_HID_JOYSTICK 963 /**< Joystiq (HID Subtype). */ -#define BLE_APPEARANCE_HID_GAMEPAD 964 /**< Gamepad (HID Subtype). */ -#define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965 /**< Digitizer Tablet (HID Subtype). */ -#define BLE_APPEARANCE_HID_CARD_READER 966 /**< Card Reader (HID Subtype). */ -#define BLE_APPEARANCE_HID_DIGITAL_PEN 967 /**< Digital Pen (HID Subtype). */ -#define BLE_APPEARANCE_HID_BARCODE 968 /**< Barcode Scanner (HID Subtype). */ -#define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024 /**< Generic Glucose Meter. */ -#define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088 /**< Generic Running Walking Sensor. */ -#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089 /**< Running Walking Sensor: In-Shoe. */ -#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090 /**< Running Walking Sensor: On-Shoe. */ -#define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091 /**< Running Walking Sensor: On-Hip. */ -#define BLE_APPEARANCE_GENERIC_CYCLING 1152 /**< Generic Cycling. */ -#define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153 /**< Cycling: Cycling Computer. */ -#define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154 /**< Cycling: Speed Sensor. */ -#define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155 /**< Cycling: Cadence Sensor. */ -#define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156 /**< Cycling: Power Sensor. */ -#define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157 /**< Cycling: Speed and Cadence Sensor. */ -#define BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 3136 /**< Generic Pulse Oximeter. */ -#define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137 /**< Fingertip (Pulse Oximeter subtype). */ -#define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138 /**< Wrist Worn(Pulse Oximeter subtype). */ -#define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200 /**< Generic Weight Scale. */ -#define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Activity. */ -#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device (Outdoor Sports Activity subtype). */ -#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */ -#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports Activity subtype). */ -#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */ -/** @} */ - -/** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */ -#define BLE_UUID_BLE_ASSIGN(instance, value) do {\ - instance.type = BLE_UUID_TYPE_BLE; \ - instance.uuid = value;} while(0) - -/** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */ -#define BLE_UUID_COPY_PTR(dst, src) do {\ - (dst)->type = (src)->type; \ - (dst)->uuid = (src)->uuid;} while(0) - -/** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */ -#define BLE_UUID_COPY_INST(dst, src) do {\ - (dst).type = (src).type; \ - (dst).uuid = (src).uuid;} while(0) - -/** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ -#define BLE_UUID_EQ(p_uuid1, p_uuid2) \ - (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid)) - -/** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ -#define BLE_UUID_NEQ(p_uuid1, p_uuid2) \ - (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid)) - -/** @} */ - -/** @addtogroup BLE_TYPES_STRUCTURES Structures - * @{ */ - -/** @brief 128 bit UUID values. */ -typedef struct -{ - uint8_t uuid128[16]; /**< Little-Endian UUID bytes. */ -} ble_uuid128_t; - -/** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */ -typedef struct -{ - uint16_t uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */ - uint8_t type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is @ref BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */ -} ble_uuid_t; - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* BLE_TYPES_H__ */ - -/** - @} - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h deleted file mode 100644 index 22d0834da1..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf52/nrf_mbr.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -/** - @defgroup nrf_mbr_api Master Boot Record API - @{ - - @brief APIs for updating SoftDevice and BootLoader - -*/ - -/* Header guard */ -#ifndef NRF_MBR_H__ -#define NRF_MBR_H__ - -#include "nrf_svc.h" -#include - -#ifndef NRF52 -#error "This header file shall only be included for nRF52 projects" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup NRF_MBR_DEFINES Defines - * @{ */ - -/**@brief MBR SVC Base number. */ -#define MBR_SVC_BASE (0x18) - -/**@brief Page size in words. */ -#define MBR_PAGE_SIZE_IN_WORDS (1024) - -/** @brief The size that must be reserved for the MBR when a softdevice is written to flash. -This is the offset where the first byte of the softdevice hex file is written.*/ -#define MBR_SIZE (0x1000) - -/** @} */ - -/** @addtogroup NRF_MBR_ENUMS Enumerations - * @{ */ - -/**@brief nRF Master Boot Record API SVC numbers. */ -enum NRF_MBR_SVCS -{ - SD_MBR_COMMAND = MBR_SVC_BASE, /**< ::sd_mbr_command */ -}; - -/**@brief Possible values for ::sd_mbr_command_t.command */ -enum NRF_MBR_COMMANDS -{ - SD_MBR_COMMAND_COPY_BL, /**< Copy a new BootLoader. @see sd_mbr_command_copy_bl_t */ - SD_MBR_COMMAND_COPY_SD, /**< Copy a new SoftDevice. @see ::sd_mbr_command_copy_sd_t*/ - SD_MBR_COMMAND_INIT_SD, /**< Init forwarding interrupts to SD, and run reset function in SD*/ - SD_MBR_COMMAND_COMPARE, /**< This command works like memcmp. @see ::sd_mbr_command_compare_t*/ - SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, /**< Start forwarding all exception to this address @see ::sd_mbr_command_vector_table_base_set_t*/ -}; - -/** @} */ - -/** @addtogroup NRF_MBR_TYPES Types - * @{ */ - -/**@brief This command copies part of a new SoftDevice - * The destination area is erased before copying. - * If dst is in the middle of a flash page, that whole flash page will be erased. - * If (dst+len) is in the middle of a flash page, that whole flash page will be erased. - * - * The user of this function is responsible for setting the BPROT registers. - * - * @retval ::NRF_SUCCESS indicates that the contents of the memory blocks where copied correctly. - * @retval ::NRF_ERROR_INTERNAL indicates that the contents of the memory blocks where not verified correctly after copying. - */ -typedef struct -{ - uint32_t *src; /**< Pointer to the source of data to be copied.*/ - uint32_t *dst; /**< Pointer to the destination where the content is to be copied.*/ - uint32_t len; /**< Number of 32 bit words to copy. Must be a multiple of @ref MBR_PAGE_SIZE_IN_WORDS words.*/ -} sd_mbr_command_copy_sd_t; - - -/**@brief This command works like memcmp, but takes the length in words. - * - * @retval ::NRF_SUCCESS indicates that the contents of both memory blocks are equal. - * @retval ::NRF_ERROR_NULL indicates that the contents of the memory blocks are not equal. - */ -typedef struct -{ - uint32_t *ptr1; /**< Pointer to block of memory. */ - uint32_t *ptr2; /**< Pointer to block of memory. */ - uint32_t len; /**< Number of 32 bit words to compare.*/ -} sd_mbr_command_compare_t; - - -/**@brief This command copies a new BootLoader. - * With this command, destination of BootLoader is always the address written in NRF_UICR->BOOTADDR. - * - * Destination is erased by this function. - * If (destination+bl_len) is in the middle of a flash page, that whole flash page will be erased. - * - * This function will use PROTENSET to protect the flash that is not intended to be written. - * - * On Success, this function will not return. It will start the new BootLoader from reset-vector as normal. - * - * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. - * @retval ::NRF_ERROR_FORBIDDEN if NRF_UICR->BOOTADDR is not set. - * @retval ::NRF_ERROR_INVALID_LENGTH if parameters attempts to read or write outside flash area. - * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) - */ -typedef struct -{ - uint32_t *bl_src; /**< Pointer to the source of the Bootloader to be be copied.*/ - uint32_t bl_len; /**< Number of 32 bit words to copy for BootLoader. */ -} sd_mbr_command_copy_bl_t; - -/**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the MBR - * - * Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset. - * - * To restore default forwarding this function should be called with @param address set to 0. - * The MBR will then start forwarding to interrupts to the address in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. - * - * On Success, this function will not return. It will reset the device. - * - * @retval ::NRF_ERROR_INTERNAL indicates an internal error that should not happen. - * @retval ::NRF_ERROR_INVALID_ADDR if parameter address is outside of the flash size. - * @retval ::NRF_ERROR_NO_MEM if no parameter page is provided (see sds for more info) - */ -typedef struct -{ - uint32_t address; /**< The base address of the interrupt vector table for forwarded interrupts.*/ -} sd_mbr_command_vector_table_base_set_t; - - -typedef struct -{ - uint32_t command; /**< type of command to be issued see @ref NRF_MBR_COMMANDS. */ - union - { - sd_mbr_command_copy_sd_t copy_sd; /**< Parameters for copy SoftDevice.*/ - sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ - sd_mbr_command_copy_bl_t copy_bl; /**< Parameters for copy BootLoader. Requires parameter page. */ - sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set. Requires parameter page.*/ - } params; -} sd_mbr_command_t; - -/** @} */ - -/** @addtogroup NRF_MBR_FUNCTIONS Functions - * @{ */ - -/**@brief Issue Master Boot Record commands - * - * Commands used when updating a SoftDevice and bootloader. - * - * The SD_MBR_COMMAND_COPY_BL and SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET requires parameters to be - * retained by the MBR when resetting the IC. This is done in a separate flash page - * provided by the application. The uicr register UICR.NRFFW[1] must be set - * to an address corresponding to a page in the application flash space. This page will be cleared - * by the MBR and used to store the command before reset. When the UICR.NRFFW[1] field is set - * the page it refers to must not be used by the application. If the UICR.NRFFW[1] is set to - * 0xFFFFFFFF (the default) MBR commands which use flash will be unavailable and return - * NRF_ERROR_NO_MEM. - * - * @param[in] param Pointer to a struct describing the command. - * - * @note for retvals see ::sd_mbr_command_copy_sd_t ::sd_mbr_command_copy_bl_t ::sd_mbr_command_compare_t ::sd_mbr_command_vector_table_base_set_t - * - * @retval NRF_ERROR_NO_MEM if UICR.NRFFW[1] is not set (i.e. is 0xFFFFFFFF). - * @retval NRF_ERROR_INVALID_PARAM if an invalid command is given. -*/ -SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); - -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif // NRF_MBR_H__ - -/** - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h deleted file mode 100644 index 26486f93c0..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - /** - @defgroup nrf_error SoftDevice Global Error Codes - @{ - - @brief Global Error definitions -*/ - -/* Header guard */ -#ifndef NRF_ERROR_H__ -#define NRF_ERROR_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @defgroup NRF_ERRORS_BASE Error Codes Base number definitions - * @{ */ -#define NRF_ERROR_BASE_NUM (0x0) ///< Global error base -#define NRF_ERROR_SDM_BASE_NUM (0x1000) ///< SDM error base -#define NRF_ERROR_SOC_BASE_NUM (0x2000) ///< SoC error base -#define NRF_ERROR_STK_BASE_NUM (0x3000) ///< STK error base -/** @} */ - -#define NRF_SUCCESS (NRF_ERROR_BASE_NUM + 0) ///< Successful command -#define NRF_ERROR_SVC_HANDLER_MISSING (NRF_ERROR_BASE_NUM + 1) ///< SVC handler is missing -#define NRF_ERROR_SOFTDEVICE_NOT_ENABLED (NRF_ERROR_BASE_NUM + 2) ///< SoftDevice has not been enabled -#define NRF_ERROR_INTERNAL (NRF_ERROR_BASE_NUM + 3) ///< Internal Error -#define NRF_ERROR_NO_MEM (NRF_ERROR_BASE_NUM + 4) ///< No Memory for operation -#define NRF_ERROR_NOT_FOUND (NRF_ERROR_BASE_NUM + 5) ///< Not found -#define NRF_ERROR_NOT_SUPPORTED (NRF_ERROR_BASE_NUM + 6) ///< Not supported -#define NRF_ERROR_INVALID_PARAM (NRF_ERROR_BASE_NUM + 7) ///< Invalid Parameter -#define NRF_ERROR_INVALID_STATE (NRF_ERROR_BASE_NUM + 8) ///< Invalid state, operation disallowed in this state -#define NRF_ERROR_INVALID_LENGTH (NRF_ERROR_BASE_NUM + 9) ///< Invalid Length -#define NRF_ERROR_INVALID_FLAGS (NRF_ERROR_BASE_NUM + 10) ///< Invalid Flags -#define NRF_ERROR_INVALID_DATA (NRF_ERROR_BASE_NUM + 11) ///< Invalid Data -#define NRF_ERROR_DATA_SIZE (NRF_ERROR_BASE_NUM + 12) ///< Invalid Data size -#define NRF_ERROR_TIMEOUT (NRF_ERROR_BASE_NUM + 13) ///< Operation timed out -#define NRF_ERROR_NULL (NRF_ERROR_BASE_NUM + 14) ///< Null Pointer -#define NRF_ERROR_FORBIDDEN (NRF_ERROR_BASE_NUM + 15) ///< Forbidden Operation -#define NRF_ERROR_INVALID_ADDR (NRF_ERROR_BASE_NUM + 16) ///< Bad Memory Address -#define NRF_ERROR_BUSY (NRF_ERROR_BASE_NUM + 17) ///< Busy -#define NRF_ERROR_CONN_COUNT (NRF_ERROR_BASE_NUM + 18) ///< Maximum connection count exceeded. -#define NRF_ERROR_RESOURCES (NRF_ERROR_BASE_NUM + 19) ///< Not enough resources for operation - -#ifdef __cplusplus -} -#endif -#endif // NRF_ERROR_H__ - -/** - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h deleted file mode 100644 index fc4728ddf5..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_sdm.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - /** - @addtogroup nrf_sdm_api - @{ - @defgroup nrf_sdm_error SoftDevice Manager Error Codes - @{ - - @brief Error definitions for the SDM API -*/ - -/* Header guard */ -#ifndef NRF_ERROR_SDM_H__ -#define NRF_ERROR_SDM_H__ - -#include "nrf_error.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN (NRF_ERROR_SDM_BASE_NUM + 0) ///< Unknown lfclk source. -#define NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION (NRF_ERROR_SDM_BASE_NUM + 1) ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts). -#define NRF_ERROR_SDM_INCORRECT_CLENR0 (NRF_ERROR_SDM_BASE_NUM + 2) ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing). - -#ifdef __cplusplus -} -#endif -#endif // NRF_ERROR_SDM_H__ - -/** - @} - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h deleted file mode 100644 index e1c5f272aa..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_error_soc.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -/** - @addtogroup nrf_soc_api - @{ - @defgroup nrf_soc_error SoC Library Error Codes - @{ - - @brief Error definitions for the SoC library - -*/ - -/* Header guard */ -#ifndef NRF_ERROR_SOC_H__ -#define NRF_ERROR_SOC_H__ - -#include "nrf_error.h" -#ifdef __cplusplus -extern "C" { -#endif - -/* Mutex Errors */ -#define NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN (NRF_ERROR_SOC_BASE_NUM + 0) ///< Mutex already taken - -/* NVIC errors */ -#define NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE (NRF_ERROR_SOC_BASE_NUM + 1) ///< NVIC interrupt not available -#define NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED (NRF_ERROR_SOC_BASE_NUM + 2) ///< NVIC interrupt priority not allowed -#define NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN (NRF_ERROR_SOC_BASE_NUM + 3) ///< NVIC should not return - -/* Power errors */ -#define NRF_ERROR_SOC_POWER_MODE_UNKNOWN (NRF_ERROR_SOC_BASE_NUM + 4) ///< Power mode unknown -#define NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN (NRF_ERROR_SOC_BASE_NUM + 5) ///< Power POF threshold unknown -#define NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN (NRF_ERROR_SOC_BASE_NUM + 6) ///< Power off should not return - -/* Rand errors */ -#define NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES (NRF_ERROR_SOC_BASE_NUM + 7) ///< RAND not enough values - -/* PPI errors */ -#define NRF_ERROR_SOC_PPI_INVALID_CHANNEL (NRF_ERROR_SOC_BASE_NUM + 8) ///< Invalid PPI Channel -#define NRF_ERROR_SOC_PPI_INVALID_GROUP (NRF_ERROR_SOC_BASE_NUM + 9) ///< Invalid PPI Group - -#ifdef __cplusplus -} -#endif -#endif // NRF_ERROR_SOC_H__ -/** - @} - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h deleted file mode 100644 index 77f1e77e4d..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_nvic.h +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -/** - * @defgroup nrf_nvic_api SoftDevice NVIC API - * @{ - * - * @note In order to use this module, the following code has to be added to a .c file: - * \code - * nrf_nvic_state_t nrf_nvic_state = {0}; - * \endcode - * - * @note Definitions and declarations starting with __ (double underscore) in this header file are - * not intended for direct use by the application. - * - * @brief APIs for the accessing NVIC when using a SoftDevice. - * - */ - -#ifndef NRF_NVIC_H__ -#define NRF_NVIC_H__ - -#include -#include "nrf.h" - -#include "nrf_error_soc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**@addtogroup NRF_NVIC_DEFINES Defines - * @{ */ - -/**@defgroup NRF_NVIC_ISER_DEFINES SoftDevice NVIC internal definitions - * @{ */ - -#define __NRF_NVIC_NVMC_IRQn (30) /**< The peripheral ID of the NVMC. IRQ numbers are used to identify peripherals, but the NVMC doesn't have an IRQ number in the MDK. */ - -#ifdef NRF51 - #define __NRF_NVIC_ISER_COUNT (1) /**< The number of ISER/ICER registers in the NVIC that are used. */ - - /**@brief Interrupts used by the SoftDevice. */ - #define __NRF_NVIC_SD_IRQS_0 ((uint32_t)( \ - (1U << POWER_CLOCK_IRQn) \ - | (1U << RADIO_IRQn) \ - | (1U << RTC0_IRQn) \ - | (1U << TIMER0_IRQn) \ - | (1U << RNG_IRQn) \ - | (1U << ECB_IRQn) \ - | (1U << CCM_AAR_IRQn) \ - | (1U << TEMP_IRQn) \ - | (1U << __NRF_NVIC_NVMC_IRQn) \ - | (1U << (uint32_t)SWI4_IRQn) \ - | (1U << (uint32_t)SWI5_IRQn) \ - )) - - /**@brief Interrupts available for to application. */ - #define __NRF_NVIC_APP_IRQS_0 (~__NRF_NVIC_SD_IRQS_0) -#endif - -#ifdef NRF52 - #define __NRF_NVIC_ISER_COUNT (2) /**< The number of ISER/ICER registers in the NVIC that are used. */ - - /**@brief Interrupts used by the SoftDevice. */ - #define __NRF_NVIC_SD_IRQS_0 ((uint32_t)( \ - (1U << POWER_CLOCK_IRQn) \ - | (1U << RADIO_IRQn) \ - | (1U << RTC0_IRQn) \ - | (1U << TIMER0_IRQn) \ - | (1U << RNG_IRQn) \ - | (1U << ECB_IRQn) \ - | (1U << CCM_AAR_IRQn) \ - | (1U << TEMP_IRQn) \ - | (1U << __NRF_NVIC_NVMC_IRQn) \ - | (1U << (uint32_t)SWI4_EGU4_IRQn) \ - | (1U << (uint32_t)SWI5_EGU5_IRQn) \ - )) - #define __NRF_NVIC_SD_IRQS_1 ((uint32_t)0) - - /**@brief Interrupts available for to application. */ - #define __NRF_NVIC_APP_IRQS_0 (~__NRF_NVIC_SD_IRQS_0) - #define __NRF_NVIC_APP_IRQS_1 (~__NRF_NVIC_SD_IRQS_1) -#endif -/**@} */ - -/**@} */ - -/**@addtogroup NRF_NVIC_VARIABLES Variables - * @{ */ - -/**@brief Type representing the state struct for the SoftDevice NVIC module. */ -typedef struct -{ - uint32_t volatile __irq_masks[__NRF_NVIC_ISER_COUNT]; /**< IRQs enabled by the application in the NVIC. */ - uint32_t volatile __cr_flag; /**< Non-zero if already in a critical region */ -} nrf_nvic_state_t; - -/**@brief Variable keeping the state for the SoftDevice NVIC module. This must be declared in an - * application source file. */ -extern nrf_nvic_state_t nrf_nvic_state; - -/**@} */ - -/**@addtogroup NRF_NVIC_INTERNAL_FUNCTIONS SoftDevice NVIC internal functions - * @{ */ - -/**@brief Disables IRQ interrupts globally, including the SoftDevice's interrupts. - * - * @retval The value of PRIMASK prior to disabling the interrupts. - */ -__STATIC_INLINE int __sd_nvic_irq_disable(void); - -/**@brief Enables IRQ interrupts globally, including the SoftDevice's interrupts. - */ -__STATIC_INLINE void __sd_nvic_irq_enable(void); - -/**@brief Checks if IRQn is available to application - * @param[in] IRQn irq to check - * - * @retval 1 (true) if the irq to check is available to the application - */ -__STATIC_INLINE uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn); - -/**@brief Checks if priority is available to application - * @param[in] priority priority to check - * - * @retval 1 (true) if the priority to check is available to the application - */ -__STATIC_INLINE uint32_t __sd_nvic_is_app_accessible_priority(uint32_t priority); - -/**@} */ - -/**@addtogroup NRF_NVIC_FUNCTIONS SoftDevice NVIC public functions - * @{ */ - -/**@brief Enable External Interrupt. - * @note Corresponds to NVIC_EnableIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS. - * - * @retval ::NRF_SUCCESS The interrupt was enabled. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt has a priority not available for the application. - */ -__STATIC_INLINE uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn); - -/**@brief Disable External Interrupt. - * @note Corresponds to NVIC_DisableIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS. - * - * @retval ::NRF_SUCCESS The interrupt was disabled. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application. - */ -__STATIC_INLINE uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn); - -/**@brief Get Pending Interrupt. - * @note Corresponds to NVIC_GetPendingIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_GetPendingIRQ documentation in CMSIS. - * @param[out] p_pending_irq Return value from NVIC_GetPendingIRQ. - * - * @retval ::NRF_SUCCESS The interrupt is available for the application. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. - */ -__STATIC_INLINE uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq); - -/**@brief Set Pending Interrupt. - * @note Corresponds to NVIC_SetPendingIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS. - * - * @retval ::NRF_SUCCESS The interrupt is set pending. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. - */ -__STATIC_INLINE uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn); - -/**@brief Clear Pending Interrupt. - * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS. - * - * @retval ::NRF_SUCCESS The interrupt pending flag is cleared. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. - */ -__STATIC_INLINE uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn); - -/**@brief Set Interrupt Priority. - * @note Corresponds to NVIC_SetPriority in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * @pre Priority is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_SetPriority documentation in CMSIS. - * @param[in] priority A valid IRQ priority for use by the application. - * - * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt priority is not available for the application. - */ -__STATIC_INLINE uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority); - -/**@brief Get Interrupt Priority. - * @note Corresponds to NVIC_GetPriority in CMSIS. - * - * @pre IRQn is valid and not reserved by the stack. - * - * @param[in] IRQn See the NVIC_GetPriority documentation in CMSIS. - * @param[out] p_priority Return value from NVIC_GetPriority. - * - * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority. - * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE - IRQn is not available for the application. - */ -__STATIC_INLINE uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority); - -/**@brief System Reset. - * @note Corresponds to NVIC_SystemReset in CMSIS. - * - * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN - */ -__STATIC_INLINE uint32_t sd_nvic_SystemReset(void); - -/**@brief Enter critical region. - * - * @post Application interrupts will be disabled. - * @note sd_nvic_critical_region_enter() and ::sd_nvic_critical_region_exit() must be called in matching pairs inside each - * execution context - * @sa sd_nvic_critical_region_exit - * - * @param[out] p_is_nested_critical_region If 1, the application is now in a nested critical region. - * - * @retval ::NRF_SUCCESS - */ -__STATIC_INLINE uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region); - -/**@brief Exit critical region. - * - * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter. - * @post If not in a nested critical region, the application interrupts will restored to the state before ::sd_nvic_critical_region_enter was called. - * - * @param[in] is_nested_critical_region If this is set to 1, the critical region won't be exited. @sa sd_nvic_critical_region_enter. - * - * @retval ::NRF_SUCCESS - */ -__STATIC_INLINE uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region); - -/**@} */ - -#ifndef SUPPRESS_INLINE_IMPLEMENTATION - -__STATIC_INLINE int __sd_nvic_irq_disable(void) -{ - int pm = __get_PRIMASK(); - __disable_irq(); - return pm; -} - -__STATIC_INLINE void __sd_nvic_irq_enable(void) -{ - __enable_irq(); -} - -__STATIC_INLINE uint32_t __sd_nvic_app_accessible_irq(IRQn_Type IRQn) -{ - if (IRQn < 32) - { - return ((1UL<= (1 << __NVIC_PRIO_BITS)) - { - return 0; - } -#ifdef NRF51 - if( priority == 0 - || priority == 2 - ) - { - return 0; - } -#endif -#ifdef NRF52 - if( priority == 0 - || priority == 1 - || priority == 4 - || priority == 5 - ) - { - return 0; - } -#endif - return 1; -} - - -__STATIC_INLINE uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn) -{ - if (!__sd_nvic_app_accessible_irq(IRQn)) - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; - } - if (!__sd_nvic_is_app_accessible_priority(NVIC_GetPriority(IRQn))) - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED; - } - - if (nrf_nvic_state.__cr_flag) - { - nrf_nvic_state.__irq_masks[(uint32_t)((int32_t)IRQn) >> 5] |= (uint32_t)(1 << ((uint32_t)((int32_t)IRQn) & (uint32_t)0x1F)); - } - else - { - NVIC_EnableIRQ(IRQn); - } - return NRF_SUCCESS; -} - -__STATIC_INLINE uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn) -{ - if (!__sd_nvic_app_accessible_irq(IRQn)) - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; - } - - if (nrf_nvic_state.__cr_flag) - { - nrf_nvic_state.__irq_masks[(uint32_t)((int32_t)IRQn) >> 5] &= ~(1UL << ((uint32_t)(IRQn) & 0x1F)); - } - else - { - NVIC_DisableIRQ(IRQn); - } - - return NRF_SUCCESS; -} - -__STATIC_INLINE uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq) -{ - if (__sd_nvic_app_accessible_irq(IRQn)) - { - *p_pending_irq = NVIC_GetPendingIRQ(IRQn); - return NRF_SUCCESS; - } - else - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; - } -} - -__STATIC_INLINE uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn) -{ - if (__sd_nvic_app_accessible_irq(IRQn)) - { - NVIC_SetPendingIRQ(IRQn); - return NRF_SUCCESS; - } - else - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; - } -} - -__STATIC_INLINE uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn) -{ - if (__sd_nvic_app_accessible_irq(IRQn)) - { - NVIC_ClearPendingIRQ(IRQn); - return NRF_SUCCESS; - } - else - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; - } -} - -__STATIC_INLINE uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if (!__sd_nvic_app_accessible_irq(IRQn)) - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; - } - - if (!__sd_nvic_is_app_accessible_priority(priority)) - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED; - } - - NVIC_SetPriority(IRQn, (uint32_t)priority); - return NRF_SUCCESS; -} - -__STATIC_INLINE uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority) -{ - if (__sd_nvic_app_accessible_irq(IRQn)) - { - *p_priority = (NVIC_GetPriority(IRQn) & 0xFF); - return NRF_SUCCESS; - } - else - { - return NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE; - } -} - -__STATIC_INLINE uint32_t sd_nvic_SystemReset(void) -{ - NVIC_SystemReset(); - return NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN; -} - -__STATIC_INLINE uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region) -{ - int was_masked = __sd_nvic_irq_disable(); - if (!nrf_nvic_state.__cr_flag) - { - nrf_nvic_state.__cr_flag = 1; - nrf_nvic_state.__irq_masks[0] = ( NVIC->ICER[0] & __NRF_NVIC_APP_IRQS_0 ); - NVIC->ICER[0] = __NRF_NVIC_APP_IRQS_0; - #ifdef NRF52 - nrf_nvic_state.__irq_masks[1] = ( NVIC->ICER[1] & __NRF_NVIC_APP_IRQS_1 ); - NVIC->ICER[1] = __NRF_NVIC_APP_IRQS_1; - #endif - *p_is_nested_critical_region = 0; - } - else - { - *p_is_nested_critical_region = 1; - } - if (!was_masked) - { - __sd_nvic_irq_enable(); - } - return NRF_SUCCESS; -} - -__STATIC_INLINE uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region) -{ - if (nrf_nvic_state.__cr_flag && (is_nested_critical_region == 0)) - { - int was_masked = __sd_nvic_irq_disable(); - NVIC->ISER[0] = nrf_nvic_state.__irq_masks[0]; - #ifdef NRF52 - NVIC->ISER[1] = nrf_nvic_state.__irq_masks[1]; - #endif - nrf_nvic_state.__cr_flag = 0; - if (!was_masked) - { - __sd_nvic_irq_enable(); - } - } - - return NRF_SUCCESS; -} - -#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ - -#ifdef __cplusplus -} -#endif - -#endif // NRF_NVIC_H__ - -/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h deleted file mode 100644 index 9cb516acde..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sd_def.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2015 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef NRF_SD_DEF_H__ -#define NRF_SD_DEF_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define SD_PPI_CHANNELS_USED 0xFFFE0000uL /**< PPI channels utilized by SotfDevice (not available to the application). */ -#define SD_PPI_GROUPS_USED 0x0000000CuL /**< PPI groups utilized by SoftDevice (not available to the application). */ -#define SD_TIMERS_USED 0x00000001uL /**< Timers used by SoftDevice. */ -#define SD_SWI_USED 0x0000003CuL /**< Software interrupts used by SoftDevice */ - - -#ifdef __cplusplus -} -#endif - -#endif /* NRF_SD_DEF_H__ */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h deleted file mode 100644 index b7fbe0e746..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_sdm.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -/** - @defgroup nrf_sdm_api SoftDevice Manager API - @{ - - @brief APIs for SoftDevice management. - -*/ - -#ifndef NRF_SDM_H__ -#define NRF_SDM_H__ - -#include "nrf_svc.h" -#include "nrf.h" -#include "nrf_soc.h" -#include "nrf_error_sdm.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup NRF_SDM_DEFINES Defines - * @{ */ -#ifdef NRFSOC_DOXYGEN -/// Declared in nrf_mbr.h -#define MBR_SIZE 0 -#warning test -#endif - -/** @brief The major version for the SoftDevice binary distributed with this header file. */ -#define SD_MAJOR_VERSION (5) - -/** @brief The minor version for the SoftDevice binary distributed with this header file. */ -#define SD_MINOR_VERSION (0) - -/** @brief The bugfix version for the SoftDevice binary distributed with this header file. */ -#define SD_BUGFIX_VERSION (0) - -/** @brief The full version number for the SoftDevice binary this header file was distributed - * with, as a decimal number in the form Mmmmbbb, where: - * - M is major version (one or more digits) - * - mmm is minor version (three digits) - * - bbb is bugfix version (three digits). */ -#define SD_VERSION (SD_MAJOR_VERSION * 1000000 + SD_MINOR_VERSION * 1000 + SD_BUGFIX_VERSION) - -/** @brief SoftDevice Manager SVC Base number. */ -#define SDM_SVC_BASE 0x10 - -/** @brief Invalid info field. Returned when an info field does not exist. */ -#define SDM_INFO_FIELD_INVALID (0) - -/** @brief Defines the SoftDevice Information Structure location (address) as an offset from -the start of the softdevice (without MBR)*/ -#define SOFTDEVICE_INFO_STRUCT_OFFSET (0x2000) - -/** @brief Defines the absolute SoftDevice Information Structure location (address) when the - * SoftDevice is installed just above the MBR (the usual case). */ -#define SOFTDEVICE_INFO_STRUCT_ADDRESS (SOFTDEVICE_INFO_STRUCT_OFFSET + MBR_SIZE) - -/** @brief Defines the offset for the SoftDevice Information Structure size value relative to the - * SoftDevice base address. The size value is of type uint8_t. */ -#define SD_INFO_STRUCT_SIZE_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET) - -/** @brief Defines the offset for the SoftDevice size value relative to the SoftDevice base address. - * The size value is of type uint32_t. */ -#define SD_SIZE_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x08) - -/** @brief Defines the offset for FWID value relative to the SoftDevice base address. The FWID value - * is of type uint16_t. */ -#define SD_FWID_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x0C) - -/** @brief Defines the offset for the SoftDevice ID relative to the SoftDevice base address. The ID - * is of type uint32_t. */ -#define SD_ID_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x10) - -/** @brief Defines the offset for the SoftDevice version relative to the SoftDevice base address in - * the same format as @ref SD_VERSION, stored as an uint32_t. */ -#define SD_VERSION_OFFSET (SOFTDEVICE_INFO_STRUCT_OFFSET + 0x14) - -/** @brief Defines a macro for retreiving the actual SoftDevice Information Structure size value - * from a given base address. Use @ref MBR_SIZE as the argument when the SoftDevice is - * installed just above the MBR (the usual case). */ -#define SD_INFO_STRUCT_SIZE_GET(baseaddr) (*((uint8_t *) ((baseaddr) + SD_INFO_STRUCT_SIZE_OFFSET))) - -/** @brief Defines a macro for retreiving the actual SoftDevice size value from a given base - * address. Use @ref MBR_SIZE as the argument when the SoftDevice is installed just above - * the MBR (the usual case). */ -#define SD_SIZE_GET(baseaddr) (*((uint32_t *) ((baseaddr) + SD_SIZE_OFFSET))) - -/** @brief Defines a macro for retreiving the actual FWID value from a given base address. Use @ref - * MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the usual - * case). */ -#define SD_FWID_GET(baseaddr) (*((uint16_t *) ((baseaddr) + SD_FWID_OFFSET))) - -/** @brief Defines a macro for retreiving the actual SoftDevice ID from a given base address. Use - * @ref MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the - * usual case). */ -#define SD_ID_GET(baseaddr) ((SD_INFO_STRUCT_SIZE_GET(baseaddr) > (SD_ID_OFFSET - SOFTDEVICE_INFO_STRUCT_OFFSET)) \ - ? (*((uint32_t *) ((baseaddr) + SD_ID_OFFSET))) : SDM_INFO_FIELD_INVALID) - -/** @brief Defines a macro for retreiving the actual FWID value from a given base address. Use @ref - * MBR_SIZE as the argument when the SoftDevice is installed just above the MBR (the usual - * case). */ -#define SD_VERSION_GET(baseaddr) ((SD_INFO_STRUCT_SIZE_GET(baseaddr) > (SD_VERSION_OFFSET - SOFTDEVICE_INFO_STRUCT_OFFSET)) \ - ? (*((uint32_t *) ((baseaddr) + SD_VERSION_OFFSET))) : SDM_INFO_FIELD_INVALID) - -/**@defgroup NRF_FAULT_ID_RANGES Fault ID ranges - * @{ */ -#define NRF_FAULT_ID_SD_RANGE_START 0x00000000 /**< SoftDevice ID range start. */ -#define NRF_FAULT_ID_APP_RANGE_START 0x00001000 /**< Application ID range start. */ -/**@} */ - -/**@defgroup NRF_FAULT_IDS Fault ID types - * @{ */ -#define NRF_FAULT_ID_SD_ASSERT (NRF_FAULT_ID_SD_RANGE_START + 1) /**< SoftDevice assertion. The info parameter is reserved for future used. */ -#define NRF_FAULT_ID_APP_MEMACC (NRF_FAULT_ID_APP_RANGE_START + 1) /**< Application invalid memory access (nRF52 only). The info parameter will contain 0x00000000, in case of SoftDevice RAM - access violation. In case of SoftDevice peripheral register violation the info parameter will contain the sub-region number of PREGION[0], on whose address range the unallowed - write access caused the memory access fault. */ -/**@} */ - -/** @} */ - -/** @addtogroup NRF_SDM_ENUMS Enumerations - * @{ */ - -/**@brief nRF SoftDevice Manager API SVC numbers. */ -enum NRF_SD_SVCS -{ - SD_SOFTDEVICE_ENABLE = SDM_SVC_BASE, /**< ::sd_softdevice_enable */ - SD_SOFTDEVICE_DISABLE, /**< ::sd_softdevice_disable */ - SD_SOFTDEVICE_IS_ENABLED, /**< ::sd_softdevice_is_enabled */ - SD_SOFTDEVICE_VECTOR_TABLE_BASE_SET, /**< ::sd_softdevice_vector_table_base_set */ - SVC_SDM_LAST /**< Placeholder for last SDM SVC */ -}; - -/** @} */ - -/** @addtogroup NRF_SDM_DEFINES Defines - * @{ */ - -/**@defgroup NRF_CLOCK_LF_XTAL_ACCURACY Clock accuracy - * @{ */ - -#define NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM (0) /**< Default: 250 ppm */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM (1) /**< 500 ppm */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM (2) /**< 150 ppm */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM (3) /**< 100 ppm */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM (4) /**< 75 ppm */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM (5) /**< 50 ppm */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM (6) /**< 30 ppm */ -#define NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM (7) /**< 20 ppm */ - -/** @} */ - -/**@defgroup NRF_CLOCK_LF_SRC Possible lfclk oscillator sources - * @{ */ - -#define NRF_CLOCK_LF_SRC_RC (0) /**< LFCLK RC oscillator. */ -#define NRF_CLOCK_LF_SRC_XTAL (1) /**< LFCLK crystal oscillator. */ -#define NRF_CLOCK_LF_SRC_SYNTH (2) /**< LFCLK Synthesized from HFCLK. */ - -/** @} */ - -/** @} */ - -/** @addtogroup NRF_SDM_TYPES Types - * @{ */ - -/**@brief Type representing lfclk oscillator source. */ -typedef struct -{ - uint8_t source; /**< LF oscillator clock source, see @ref NRF_CLOCK_LF_SRC. */ - uint8_t rc_ctiv; /**< Only for NRF_CLOCK_LF_SRC_RC: Calibration timer interval in 1/4 second - units (nRF51: 1-64, nRF52: 1-32). - @note To avoid excessive clock drift, 0.5 degrees Celsius is the - maximum temperature change allowed in one calibration timer - interval. The interval should be selected to ensure this. - - @note Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. */ - uint8_t rc_temp_ctiv; /**< Only for NRF_CLOCK_LF_SRC_RC: How often (in number of calibration - intervals) the RC oscillator shall be calibrated if the temperature - hasn't changed. - 0: Always calibrate even if the temperature hasn't changed. - 1: Only calibrate if the temperature has changed (nRF51 only). - 2-33: Check the temperature and only calibrate if it has changed, - however calibration will take place every rc_temp_ctiv - intervals in any case. - - @note Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. - - @note For nRF52, the application must ensure calibration at least once - every 8 seconds to ensure +/-250ppm clock stability. The - recommended configuration for NRF_CLOCK_LF_SRC_RC on nRF52 is - rc_ctiv=16 and rc_temp_ctiv=2. This will ensure calibration at - least once every 8 seconds and for temperature changes of 0.5 - degrees Celsius every 4 seconds. See the Product Specification - for the nRF52 device being used for more information.*/ - uint8_t xtal_accuracy; /**< External crystal clock accuracy used in the LL to compute timing windows. - - @note For the NRF_CLOCK_LF_SRC_RC clock source this parameter is ignored. */ -} nrf_clock_lf_cfg_t; - -/**@brief Fault Handler type. - * - * When certain unrecoverable errors occur within the application or SoftDevice the fault handler will be called back. - * The protocol stack will be in an undefined state when this happens and the only way to recover will be to - * perform a reset, using e.g. CMSIS NVIC_SystemReset(). - * If the application returns from the fault handler the SoftDevice will call NVIC_SystemReset(). - * - * @note This callback is executed in HardFault context, thus SVC functions cannot be called from the fault callback. - * - * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. - * @param[in] pc The program counter of the instruction that triggered the fault. - * @param[in] info Optional additional information regarding the fault. Refer to each Fault identifier for details. - * - * @note When id is set to NRF_FAULT_ID_APP_MEMACC, pc will contain the address of the instruction being executed at the time when - * the fault is detected by the CPU. The CPU program counter may have advanced up to 2 instructions (no branching) after the one that triggered the fault. - */ -typedef void (*nrf_fault_handler_t)(uint32_t id, uint32_t pc, uint32_t info); - -/** @} */ - -/** @addtogroup NRF_SDM_FUNCTIONS Functions - * @{ */ - -/**@brief Enables the SoftDevice and by extension the protocol stack. - * - * @note Some care must be taken if a low frequency clock source is already running when calling this function: - * If the LF clock has a different source then the one currently running, it will be stopped. Then, the new - * clock source will be started. - * - * @note This function has no effect when returning with an error. - * - * @post If return code is ::NRF_SUCCESS - * - SoC library and protocol stack APIs are made available. - * - A portion of RAM will be unavailable (see relevant SDS documentation). - * - Some peripherals will be unavailable or available only through the SoC API (see relevant SDS documentation). - * - Interrupts will not arrive from protected peripherals or interrupts. - * - nrf_nvic_ functions must be used instead of CMSIS NVIC_ functions for reliable usage of the SoftDevice. - * - Interrupt latency may be affected by the SoftDevice (see relevant SDS documentation). - * - Chosen low frequency clock source will be running. - * - * @param p_clock_lf_cfg Low frequency clock source and accuracy. - If NULL the clock will be configured as an rc source with rc_ctiv = 16 and .rc_temp_ctiv = 2 - In the case of XTAL source, the PPM accuracy of the chosen clock source must be greater than or equal to the actual characteristics of your XTAL clock. - * @param fault_handler Callback to be invoked in case of fault, cannot be NULL. - * - * @retval ::NRF_SUCCESS - * @retval ::NRF_ERROR_INVALID_ADDR Invalid or NULL pointer supplied. - * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and fault handler cannot be updated. - * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level. - * @retval ::NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN Unknown low frequency clock source selected. - */ -SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler)); - - -/**@brief Disables the SoftDevice and by extension the protocol stack. - * - * Idempotent function to disable the SoftDevice. - * - * @post SoC library and protocol stack APIs are made unavailable. - * @post All interrupts that was protected by the SoftDevice will be disabled and initialized to priority 0 (highest). - * @post All peripherals used by the SoftDevice will be reset to default values. - * @post All of RAM become available. - * @post All interrupts are forwarded to the application. - * @post LFCLK source chosen in ::sd_softdevice_enable will be left running. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_SOFTDEVICE_DISABLE, uint32_t, sd_softdevice_disable(void)); - -/**@brief Check if the SoftDevice is enabled. - * - * @param[out] p_softdevice_enabled If the SoftDevice is enabled: 1 else 0. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_SOFTDEVICE_IS_ENABLED, uint32_t, sd_softdevice_is_enabled(uint8_t * p_softdevice_enabled)); - -/**@brief Sets the base address of the interrupt vector table for interrupts forwarded from the SoftDevice - * - * This function is only intended to be called when a bootloader is enabled. - * - * @param[in] address The base address of the interrupt vector table for forwarded interrupts. - - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_SOFTDEVICE_VECTOR_TABLE_BASE_SET, uint32_t, sd_softdevice_vector_table_base_set(uint32_t address)); - -/** @} */ - -#ifdef __cplusplus -} -#endif -#endif // NRF_SDM_H__ - -/** - @} -*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h deleted file mode 100644 index 3340f1417b..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_soc.h +++ /dev/null @@ -1,908 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -/** - * @defgroup nrf_soc_api SoC Library API - * @{ - * - * @brief APIs for the SoC library. - * - */ - -#ifndef NRF_SOC_H__ -#define NRF_SOC_H__ - -#include -#include -#include "nrf_svc.h" -#include "nrf.h" - -#include "nrf_error_soc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**@addtogroup NRF_SOC_DEFINES Defines - * @{ */ - -/**@brief The number of the lowest SVC number reserved for the SoC library. */ -#define SOC_SVC_BASE (0x20) /**< Base value for SVCs that are available when the SoftDevice is disabled. */ -#define SOC_SVC_BASE_NOT_AVAILABLE (0x2B) /**< Base value for SVCs that are not available when the SoftDevice is disabled. */ - -/**@brief Guranteed time for application to process radio inactive notification. */ -#define NRF_RADIO_NOTIFICATION_INACTIVE_GUARANTEED_TIME_US (62) - -/**@brief The minimum allowed timeslot extension time. */ -#define NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US (200) - -#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. */ - -#ifdef NRF51 -#define SD_EVT_IRQn (SWI2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ -#define SD_EVT_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. */ -#endif -#ifdef NRF52 -#define SD_EVT_IRQn (SWI2_EGU2_IRQn) /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ -#define SD_EVT_IRQHandler (SWI2_EGU2_IRQHandler) /**< SoftDevice Event IRQ handler. Used for both protocol events and SoC events. */ -#define RADIO_NOTIFICATION_IRQn (SWI1_EGU1_IRQn) /**< The radio notification IRQ number. */ -#define RADIO_NOTIFICATION_IRQHandler (SWI1_EGU1_IRQHandler) /**< The radio notification IRQ handler. */ -#endif - -#define NRF_RADIO_LENGTH_MIN_US (100) /**< The shortest allowed radio timeslot, in microseconds. */ -#define NRF_RADIO_LENGTH_MAX_US (100000) /**< The longest allowed radio timeslot, in microseconds. */ - -#define NRF_RADIO_DISTANCE_MAX_US (128000000UL - 1UL) /**< The longest timeslot distance, in microseconds, allowed for the distance parameter (see @ref nrf_radio_request_normal_t) in the request. */ - -#define NRF_RADIO_EARLIEST_TIMEOUT_MAX_US (128000000UL - 1UL) /**< The longest timeout, in microseconds, allowed when requesting the earliest possible timeslot. */ - -#define NRF_RADIO_START_JITTER_US (2) /**< The maximum jitter in @ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START relative to the requested start time. */ - -/**@} */ - -/**@addtogroup NRF_SOC_ENUMS Enumerations - * @{ */ - -/**@brief The SVC numbers used by the SVC functions in the SoC library. */ -enum NRF_SOC_SVCS -{ - SD_PPI_CHANNEL_ENABLE_GET = SOC_SVC_BASE, - 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_FLASH_PAGE_ERASE, - SD_FLASH_WRITE, - SD_FLASH_PROTECT, - SD_MUTEX_NEW = SOC_SVC_BASE_NOT_AVAILABLE, - SD_MUTEX_ACQUIRE, - SD_MUTEX_RELEASE, - SD_RAND_APPLICATION_POOL_CAPACITY_GET, - SD_RAND_APPLICATION_BYTES_AVAILABLE_GET, - SD_RAND_APPLICATION_VECTOR_GET, - 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_EVT_WAIT, - SD_CLOCK_HFCLK_REQUEST, - SD_CLOCK_HFCLK_RELEASE, - SD_CLOCK_HFCLK_IS_RUNNING, - SD_RADIO_NOTIFICATION_CFG_SET, - SD_ECB_BLOCK_ENCRYPT, - SD_ECB_BLOCKS_ENCRYPT, - SD_RADIO_SESSION_OPEN, - SD_RADIO_SESSION_CLOSE, - SD_RADIO_REQUEST, - SD_EVT_GET, - SD_TEMP_GET, - SVC_SOC_LAST -}; - -/**@brief Possible values of a ::nrf_mutex_t. */ -enum NRF_MUTEX_VALUES -{ - NRF_MUTEX_FREE, - NRF_MUTEX_TAKEN -}; - -/**@brief Power modes. */ -enum NRF_POWER_MODES -{ - NRF_POWER_MODE_CONSTLAT, /**< Constant latency mode. See power management in the reference manual. */ - NRF_POWER_MODE_LOWPWR /**< Low power mode. See power management in the reference manual. */ -}; - - -/**@brief Power failure thresholds */ -enum NRF_POWER_THRESHOLDS -{ - NRF_POWER_THRESHOLD_V21, /**< 2.1 Volts power failure threshold. */ - NRF_POWER_THRESHOLD_V23, /**< 2.3 Volts power failure threshold. */ - NRF_POWER_THRESHOLD_V25, /**< 2.5 Volts power failure threshold. */ - NRF_POWER_THRESHOLD_V27 /**< 2.7 Volts power failure threshold. */ -}; - - -/**@brief DC/DC converter modes. */ -enum NRF_POWER_DCDC_MODES -{ - NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */ - NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */ -}; - -/**@brief Radio notification distances. */ -enum NRF_RADIO_NOTIFICATION_DISTANCES -{ - NRF_RADIO_NOTIFICATION_DISTANCE_NONE = 0, /**< The event does not have a notification. */ - NRF_RADIO_NOTIFICATION_DISTANCE_800US, /**< The distance from the active notification to start of radio activity. */ - NRF_RADIO_NOTIFICATION_DISTANCE_1740US, /**< The distance from the active notification to start of radio activity. */ - NRF_RADIO_NOTIFICATION_DISTANCE_2680US, /**< The distance from the active notification to start of radio activity. */ - NRF_RADIO_NOTIFICATION_DISTANCE_3620US, /**< The distance from the active notification to start of radio activity. */ - NRF_RADIO_NOTIFICATION_DISTANCE_4560US, /**< The distance from the active notification to start of radio activity. */ - NRF_RADIO_NOTIFICATION_DISTANCE_5500US /**< The distance from the active notification to start of radio activity. */ -}; - - -/**@brief Radio notification types. */ -enum NRF_RADIO_NOTIFICATION_TYPES -{ - NRF_RADIO_NOTIFICATION_TYPE_NONE = 0, /**< The event does not have a radio notification signal. */ - NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE, /**< Using interrupt for notification when the radio will be enabled. */ - NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, /**< Using interrupt for notification when the radio has been disabled. */ - NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH, /**< Using interrupt for notification both when the radio will be enabled and disabled. */ -}; - -/**@brief The Radio signal callback types. */ -enum NRF_RADIO_CALLBACK_SIGNAL_TYPE -{ - NRF_RADIO_CALLBACK_SIGNAL_TYPE_START, /**< This signal indicates the start of the radio timeslot. */ - NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0, /**< This signal indicates the NRF_TIMER0 interrupt. */ - NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO, /**< This signal indicates the NRF_RADIO interrupt. */ - NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED, /**< This signal indicates extend action failed. */ - NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_SUCCEEDED /**< This signal indicates extend action succeeded. */ -}; - -/**@brief The actions requested by the signal callback. - * - * This code gives the SOC instructions about what action to take when the signal callback has - * returned. - */ -enum NRF_RADIO_SIGNAL_CALLBACK_ACTION -{ - NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE, /**< Return without action. */ - NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND, /**< Request an extension of the current timeslot (maximum execution time for this action is when the extension succeeded). */ - NRF_RADIO_SIGNAL_CALLBACK_ACTION_END, /**< End the current radio timeslot. */ - NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END /**< Request a new radio timeslot and end the current timeslot. */ -}; - -/**@brief Radio timeslot high frequency clock source configuration. */ -enum NRF_RADIO_HFCLK_CFG -{ - NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED, /**< The SoftDevice will guarantee that the high frequency clock source is the - external crystal for the whole duration of the timeslot. This should be the - preferred option for events that use the radio or require high timing accuracy. */ - NRF_RADIO_HFCLK_CFG_NO_GUARANTEE /**< This configuration allows for earlier and tighter scheduling of timeslots. - The RC oscillator may be the clock source in part or for the whole duration of the timeslot. - The RC oscillator's accuracy must therefore be taken into consideration. - @note If the application will use the radio peripheral in timeslots with this configuration, - it must make sure that the crystal is running and stable before starting the radio. */ -}; - -/**@brief Radio timeslot priorities. */ -enum NRF_RADIO_PRIORITY -{ - NRF_RADIO_PRIORITY_HIGH, /**< High (equal priority as the normal connection priority of the SoftDevice stack(s)). */ - NRF_RADIO_PRIORITY_NORMAL, /**< Normal (equal priority as the priority of secondary activites of the SoftDevice stack(s)). */ -}; - -/**@brief Radio timeslot request type. */ -enum NRF_RADIO_REQUEST_TYPE -{ - NRF_RADIO_REQ_TYPE_EARLIEST, /**< Request radio timeslot as early as possible. This should always be used for the first request in a session. */ - NRF_RADIO_REQ_TYPE_NORMAL /**< Normal radio timeslot request. */ -}; - -/**@brief SoC Events. */ -enum NRF_SOC_EVTS -{ - NRF_EVT_HFCLKSTARTED, /**< Event indicating that the HFCLK has started. */ - NRF_EVT_POWER_FAILURE_WARNING, /**< Event indicating that a power failure warning has occurred. */ - NRF_EVT_FLASH_OPERATION_SUCCESS, /**< Event indicating that the ongoing flash operation has completed successfully. */ - NRF_EVT_FLASH_OPERATION_ERROR, /**< Event indicating that the ongoing flash operation has timed out with an error. */ - NRF_EVT_RADIO_BLOCKED, /**< Event indicating that a radio timeslot was blocked. */ - NRF_EVT_RADIO_CANCELED, /**< Event indicating that a radio timeslot was canceled by SoftDevice. */ - NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN, /**< Event indicating that a radio timeslot signal callback handler return was invalid. */ - NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio timeslot session is idle. */ - NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio timeslot session is closed. */ - NRF_EVT_NUMBER_OF_EVTS -}; - -/**@} */ - - -/**@addtogroup NRF_SOC_STRUCTURES Structures - * @{ */ - -/**@brief Represents a mutex for use with the nrf_mutex functions. - * @note Accessing the value directly is not safe, use the mutex functions! - */ -typedef volatile uint8_t nrf_mutex_t; - -/**@brief Parameters for a request for a timeslot as early as possible. */ -typedef struct -{ - uint8_t hfclk; /**< High frequency clock source, see @ref NRF_RADIO_HFCLK_CFG. */ - uint8_t priority; /**< The radio timeslot priority, see @ref NRF_RADIO_PRIORITY. */ - uint32_t length_us; /**< The radio timeslot length (in the range 100 to 100,000] microseconds). */ - uint32_t timeout_us; /**< Longest acceptable delay until the start of the requested timeslot (up to @ref NRF_RADIO_EARLIEST_TIMEOUT_MAX_US microseconds). */ -} nrf_radio_request_earliest_t; - -/**@brief Parameters for a normal radio timeslot request. */ -typedef struct -{ - uint8_t hfclk; /**< High frequency clock source, see @ref NRF_RADIO_HFCLK_CFG. */ - uint8_t priority; /**< The radio timeslot priority, see @ref NRF_RADIO_PRIORITY. */ - uint32_t distance_us; /**< Distance from the start of the previous radio timeslot (up to @ref NRF_RADIO_DISTANCE_MAX_US microseconds). */ - uint32_t length_us; /**< The radio timeslot length (in the range [100..100,000] microseconds). */ -} nrf_radio_request_normal_t; - -/**@brief Radio timeslot request parameters. */ -typedef struct -{ - uint8_t request_type; /**< Type of request, see @ref NRF_RADIO_REQUEST_TYPE. */ - union - { - nrf_radio_request_earliest_t earliest; /**< Parameters for requesting a radio timeslot as early as possible. */ - nrf_radio_request_normal_t normal; /**< Parameters for requesting a normal radio timeslot. */ - } params; /**< Parameter union. */ -} nrf_radio_request_t; - -/**@brief Return parameters of the radio timeslot signal callback. */ -typedef struct -{ - uint8_t callback_action; /**< The action requested by the application when returning from the signal callback, see @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION. */ - union - { - struct - { - nrf_radio_request_t * p_next; /**< The request parameters for the next radio timeslot. */ - } request; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END. */ - struct - { - uint32_t length_us; /**< Requested extension of the radio timeslot duration (microseconds) (for minimum time see @ref NRF_RADIO_MINIMUM_TIMESLOT_LENGTH_EXTENSION_TIME_US). */ - } extend; /**< Additional parameters for return_code @ref NRF_RADIO_SIGNAL_CALLBACK_ACTION_EXTEND. */ - } params; /**< Parameter union. */ -} nrf_radio_signal_callback_return_param_t; - -/**@brief The radio timeslot signal callback type. - * - * @note In case of invalid return parameters, the radio timeslot will automatically end - * immediately after returning from the signal callback and the - * @ref NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN event will be sent. - * @note The returned struct pointer must remain valid after the signal callback - * function returns. For instance, this means that it must not point to a stack variable. - * - * @param[in] signal_type Type of signal, see @ref NRF_RADIO_CALLBACK_SIGNAL_TYPE. - * - * @return Pointer to structure containing action requested by the application. - */ -typedef nrf_radio_signal_callback_return_param_t * (*nrf_radio_signal_callback_t) (uint8_t signal_type); - -/**@brief AES ECB parameter typedefs */ -typedef uint8_t soc_ecb_key_t[SOC_ECB_KEY_LENGTH]; /**< Encryption key type. */ -typedef uint8_t soc_ecb_cleartext_t[SOC_ECB_CLEARTEXT_LENGTH]; /**< Cleartext data type. */ -typedef uint8_t soc_ecb_ciphertext_t[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Ciphertext data type. */ - -/**@brief AES ECB data structure */ -typedef struct -{ - soc_ecb_key_t key; /**< Encryption key. */ - soc_ecb_cleartext_t cleartext; /**< Cleartext data. */ - soc_ecb_ciphertext_t ciphertext; /**< Ciphertext data. */ -} nrf_ecb_hal_data_t; - -/**@brief AES ECB block. Used to provide multiple blocks in a single call - to @ref sd_ecb_blocks_encrypt.*/ -typedef struct -{ - soc_ecb_key_t* p_key; /**< Pointer to the Encryption key. */ - soc_ecb_cleartext_t* p_cleartext; /**< Pointer to the Cleartext data. */ - soc_ecb_ciphertext_t* p_ciphertext; /**< Pointer to the Ciphertext data. */ -} nrf_ecb_hal_data_block_t; - -/**@} */ - -/**@addtogroup NRF_SOC_FUNCTIONS Functions - * @{ */ - -/**@brief Initialize a mutex. - * - * @param[in] p_mutex Pointer to the mutex to initialize. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_MUTEX_NEW, uint32_t, sd_mutex_new(nrf_mutex_t * p_mutex)); - -/**@brief Attempt to acquire a mutex. - * - * @param[in] p_mutex Pointer to the mutex to acquire. - * - * @retval ::NRF_SUCCESS The mutex was successfully acquired. - * @retval ::NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN The mutex could not be acquired. - */ -SVCALL(SD_MUTEX_ACQUIRE, uint32_t, sd_mutex_acquire(nrf_mutex_t * p_mutex)); - -/**@brief Release a mutex. - * - * @param[in] p_mutex Pointer to the mutex to release. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_MUTEX_RELEASE, uint32_t, sd_mutex_release(nrf_mutex_t * p_mutex)); - -/**@brief Query the capacity of the application random pool. - * - * @param[out] p_pool_capacity The capacity of the pool. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_RAND_APPLICATION_POOL_CAPACITY_GET, uint32_t, sd_rand_application_pool_capacity_get(uint8_t * p_pool_capacity)); - -/**@brief Get number of random bytes available to the application. - * - * @param[out] p_bytes_available The number of bytes currently available in the pool. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_RAND_APPLICATION_BYTES_AVAILABLE_GET, uint32_t, sd_rand_application_bytes_available_get(uint8_t * p_bytes_available)); - -/**@brief Get random bytes from the application pool. - * - * @param[out] p_buff Pointer to unit8_t buffer for storing the bytes. - * @param[in] length Number of bytes to take from pool and place in p_buff. - * - * @retval ::NRF_SUCCESS The requested bytes were written to p_buff. - * @retval ::NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES No bytes were written to the buffer, because there were not enough bytes available. -*/ -SVCALL(SD_RAND_APPLICATION_VECTOR_GET, uint32_t, sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length)); - -/**@brief Gets the reset reason register. - * - * @param[out] p_reset_reason Contents of the NRF_POWER->RESETREAS register. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_RESET_REASON_GET, uint32_t, sd_power_reset_reason_get(uint32_t * p_reset_reason)); - -/**@brief Clears the bits of the reset reason register. - * - * @param[in] reset_reason_clr_msk Contains the bits to clear from the reset reason register. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_RESET_REASON_CLR, uint32_t, sd_power_reset_reason_clr(uint32_t reset_reason_clr_msk)); - -/**@brief Sets the power mode when in CPU sleep. - * - * @param[in] power_mode The power mode to use when in CPU sleep, see @ref NRF_POWER_MODES. @sa sd_app_evt_wait - * - * @retval ::NRF_SUCCESS The power mode was set. - * @retval ::NRF_ERROR_SOC_POWER_MODE_UNKNOWN The power mode was unknown. - */ -SVCALL(SD_POWER_MODE_SET, uint32_t, sd_power_mode_set(uint8_t power_mode)); - -/**@brief Puts the chip in System OFF mode. - * - * @retval ::NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN - */ -SVCALL(SD_POWER_SYSTEM_OFF, uint32_t, sd_power_system_off(void)); - -/**@brief Enables or disables the power-fail comparator. - * - * Enabling this will give a softdevice event (NRF_EVT_POWER_FAILURE_WARNING) when the power failure warning occurs. - * The event can be retrieved with sd_evt_get(); - * - * @param[in] pof_enable True if the power-fail comparator should be enabled, false if it should be disabled. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_POF_ENABLE, uint32_t, sd_power_pof_enable(uint8_t pof_enable)); - -/**@brief Sets the power-fail threshold value. - * - * @param[in] threshold The power-fail threshold value to use, see @ref NRF_POWER_THRESHOLDS. - * - * @retval ::NRF_SUCCESS The power failure threshold was set. - * @retval ::NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN The power failure threshold is unknown. - */ -SVCALL(SD_POWER_POF_THRESHOLD_SET, uint32_t, sd_power_pof_threshold_set(uint8_t threshold)); - -/**@brief Sets bits in the NRF_POWER->RAMON register. - * - * @param[in] ramon Contains the bits needed to be set in the NRF_POWER->RAMON register. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_RAMON_SET, uint32_t, sd_power_ramon_set(uint32_t ramon)); - -/**@brief Clears bits in the NRF_POWER->RAMON register. - * - * @param ramon Contains the bits needed to be cleared in the NRF_POWER->RAMON register. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_RAMON_CLR, uint32_t, sd_power_ramon_clr(uint32_t ramon)); - -/**@brief Get contents of NRF_POWER->RAMON register, indicates power status of ram blocks. - * - * @param[out] p_ramon Content of NRF_POWER->RAMON register. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_RAMON_GET, uint32_t, sd_power_ramon_get(uint32_t * p_ramon)); - -/**@brief Set bits in the general purpose retention registers (NRF_POWER->GPREGRET*). - * - * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. - * @param[in] gpregret_msk Bits to be set in the GPREGRET register. - * - * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_GPREGRET_SET, uint32_t, sd_power_gpregret_set(uint32_t gpregret_id, uint32_t gpregret_msk)); - -/**@brief Clear bits in the general purpose retention registers (NRF_POWER->GPREGRET*). - * - * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. - * @param[in] gpregret_msk Bits to be clear in the GPREGRET register. - * - * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_GPREGRET_CLR, uint32_t, sd_power_gpregret_clr(uint32_t gpregret_id, uint32_t gpregret_msk)); - -/**@brief Get contents of the general purpose retention registers (NRF_POWER->GPREGRET*). - * - * @param[in] gpregret_id 0 for GPREGRET, 1 for GPREGRET2. - * @param[out] p_gpregret Contents of the GPREGRET register. - * - * @note nRF51 does only have one general purpose retained register, so gpregret_id must be 0 on nRF51. - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_POWER_GPREGRET_GET, uint32_t, sd_power_gpregret_get(uint32_t gpregret_id, uint32_t *p_gpregret)); - -/**@brief Sets the DCDC mode. - * - * Enable or disable the DCDC peripheral. - * - * @param[in] dcdc_mode The mode of the DCDC, see @ref NRF_POWER_DCDC_MODES. - * - * @retval ::NRF_SUCCESS - * @retval ::NRF_ERROR_INVALID_PARAM The DCDC mode is invalid. - */ -SVCALL(SD_POWER_DCDC_MODE_SET, uint32_t, sd_power_dcdc_mode_set(uint8_t dcdc_mode)); - -/**@brief Request the high frequency crystal oscillator. - * - * 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. - * - * @see sd_clock_hfclk_is_running - * @see sd_clock_hfclk_release - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_CLOCK_HFCLK_REQUEST, uint32_t, sd_clock_hfclk_request(void)); - -/**@brief Releases the high frequency crystal oscillator. - * - * Will stop the high frequency crystal oscillator, this happens immediately. - * - * @see sd_clock_hfclk_is_running - * @see sd_clock_hfclk_request - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_CLOCK_HFCLK_RELEASE, uint32_t, sd_clock_hfclk_release(void)); - -/**@brief Checks if the high frequency crystal oscillator is running. - * - * @see sd_clock_hfclk_request - * @see sd_clock_hfclk_release - * - * @param[out] p_is_running 1 if the external crystal oscillator is running, 0 if not. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_CLOCK_HFCLK_IS_RUNNING, uint32_t, sd_clock_hfclk_is_running(uint32_t * p_is_running)); - -/**@brief Waits for an application event. - * - * 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). @sa CMSIS_SCB - * - * @note If an application interrupt has happened since the last time sd_app_evt_wait was - * called this function will return immediately and not go to sleep. This is to avoid race - * conditions that can occur when a flag is updated in the interrupt handler and processed - * in the main loop. - * - * @post An application interrupt has happened or a interrupt pending flag is set. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_APP_EVT_WAIT, uint32_t, sd_app_evt_wait(void)); - -/**@brief Get PPI channel enable register contents. - * - * @param[out] p_channel_enable The contents of the PPI CHEN register. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_PPI_CHANNEL_ENABLE_GET, uint32_t, sd_ppi_channel_enable_get(uint32_t * p_channel_enable)); - -/**@brief Set PPI channel enable register. - * - * @param[in] channel_enable_set_msk Mask containing the bits to set in the PPI CHEN register. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_PPI_CHANNEL_ENABLE_SET, uint32_t, sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk)); - -/**@brief Clear PPI channel enable register. - * - * @param[in] channel_enable_clr_msk Mask containing the bits to clear in the PPI CHEN register. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_PPI_CHANNEL_ENABLE_CLR, uint32_t, sd_ppi_channel_enable_clr(uint32_t channel_enable_clr_msk)); - -/**@brief Assign endpoints to a PPI channel. - * - * @param[in] channel_num Number of the PPI channel to assign. - * @param[in] evt_endpoint Event endpoint of the PPI channel. - * @param[in] task_endpoint Task endpoint of the PPI channel. - * - * @retval ::NRF_ERROR_SOC_PPI_INVALID_CHANNEL The channel number is invalid. - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_PPI_CHANNEL_ASSIGN, uint32_t, sd_ppi_channel_assign(uint8_t channel_num, const volatile void * evt_endpoint, const volatile void * task_endpoint)); - -/**@brief Task to enable a channel group. - * - * @param[in] group_num Number of the channel group. - * - * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_PPI_GROUP_TASK_ENABLE, uint32_t, sd_ppi_group_task_enable(uint8_t group_num)); - -/**@brief Task to disable a channel group. - * - * @param[in] group_num Number of the PPI group. - * - * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_PPI_GROUP_TASK_DISABLE, uint32_t, sd_ppi_group_task_disable(uint8_t group_num)); - -/**@brief Assign PPI channels to a channel group. - * - * @param[in] group_num Number of the channel group. - * @param[in] channel_msk Mask of the channels to assign to the group. - * - * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_PPI_GROUP_ASSIGN, uint32_t, sd_ppi_group_assign(uint8_t group_num, uint32_t channel_msk)); - -/**@brief Gets the PPI channels of a channel group. - * - * @param[in] group_num Number of the channel group. - * @param[out] p_channel_msk Mask of the channels assigned to the group. - * - * @retval ::NRF_ERROR_SOC_PPI_INVALID_GROUP The group number is invalid. - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_PPI_GROUP_GET, uint32_t, sd_ppi_group_get(uint8_t group_num, uint32_t * p_channel_msk)); - -/**@brief Configures the Radio Notification signal. - * - * @note - * - The notification signal latency depends on the interrupt priority settings of SWI used - * for notification signal. - * - To ensure that the radio notification signal behaves in a consistent way, always - * configure radio notifications when there is no protocol stack or other SoftDevice - * activity in progress. It is recommended that the radio notification signal is - * configured directly after the SoftDevice has been enabled. - * - In the period between the ACTIVE signal and the start of the Radio Event, the SoftDevice - * will interrupt the application to do Radio Event preparation. - * - Using the Radio Notification feature may limit the bandwidth, as the SoftDevice may have - * to shorten the connection events to have time for the Radio Notification signals. - * - * @param[in] type Type of notification signal, see @ref NRF_RADIO_NOTIFICATION_TYPES. - * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE shall be used to turn off radio - * notification. Using @ref NRF_RADIO_NOTIFICATION_DISTANCE_NONE is - * recommended (but not required) to be used with - * @ref NRF_RADIO_NOTIFICATION_TYPE_NONE. - * - * @param[in] distance Distance between the notification signal and start of radio activity, see @ref NRF_RADIO_NOTIFICATION_DISTANCES. - * This parameter is ignored when @ref NRF_RADIO_NOTIFICATION_TYPE_NONE or - * @ref NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE is used. - * - * @retval ::NRF_ERROR_INVALID_PARAM The group number is invalid. - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_RADIO_NOTIFICATION_CFG_SET, uint32_t, sd_radio_notification_cfg_set(uint8_t type, uint8_t distance)); - -/**@brief Encrypts a block according to the specified parameters. - * - * 128-bit AES encryption. - * - * @note: - * - The application may set the SEVONPEND bit in the SCR to 1 to make the SoftDevice sleep while - * the ECB is running. The SEVONPEND bit should only be cleared (set to 0) from application - * main or low interrupt level. - * - * @param[in, out] p_ecb_data Pointer to the ECB parameters' struct (two input - * parameters and one output parameter). - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_ECB_BLOCK_ENCRYPT, uint32_t, sd_ecb_block_encrypt(nrf_ecb_hal_data_t * p_ecb_data)); - -/**@brief Encrypts multiple data blocks provided as an array of data block structures. - * - * @details: Performs 128-bit AES encryption on multiple data blocks - * - * @note: - * - The application may set the SEVONPEND bit in the SCR to 1 to make the SoftDevice sleep while - * the ECB is running. The SEVONPEND bit should only be cleared (set to 0) from application - * main or low interrupt level. - * - * @param[in] block_count Count of blocks in the p_data_blocks array. - * @param[in,out] p_data_blocks Pointer to the first entry in a contiguous array of - * @ref nrf_ecb_hal_data_block_t structures. - * - * @retval ::NRF_SUCCESS - */ -SVCALL(SD_ECB_BLOCKS_ENCRYPT, uint32_t, sd_ecb_blocks_encrypt(uint8_t block_count, nrf_ecb_hal_data_block_t * p_data_blocks)); - -/**@brief Gets any pending events generated by the SoC API. - * - * The application should keep calling this function to get events, until ::NRF_ERROR_NOT_FOUND is returned. - * - * @param[out] p_evt_id Set to one of the values in @ref NRF_SOC_EVTS, if any events are pending. - * - * @retval ::NRF_SUCCESS An event was pending. The event id is written in the p_evt_id parameter. - * @retval ::NRF_ERROR_NOT_FOUND No pending events. - */ -SVCALL(SD_EVT_GET, uint32_t, sd_evt_get(uint32_t * p_evt_id)); - -/**@brief Get the temperature measured on the chip - * - * This function will block until the temperature measurement is done. - * It takes around 50us from call to return. - * - * @param[out] p_temp Result of temperature measurement. Die temperature in 0.25 degrees celsius. - * - * @retval ::NRF_SUCCESS A temperature measurement was done, and the temperature was written to temp - */ -SVCALL(SD_TEMP_GET, uint32_t, sd_temp_get(int32_t * p_temp)); - -/**@brief Flash Write -* -* Commands to write a buffer to flash -* -* If the SoftDevice is enabled: -* This call initiates the flash access command, and its completion will be communicated to the -* application with exactly one of the following events: -* - @ref NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed. -* - @ref NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started. -* -* If the SoftDevice is not enabled no event will be generated, and this call will return @ref NRF_SUCCESS when the - * write has been completed -* -* @note -* - This call takes control over the radio and the CPU during flash erase and write to make sure that -* they will not interfere with the flash access. This means that all interrupts will be blocked -* for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual -* and the command parameters). -* - The data in the p_src buffer should not be modified before the @ref NRF_EVT_FLASH_OPERATION_SUCCESS -* or the @ref NRF_EVT_FLASH_OPERATION_ERROR have been received if the SoftDevice is enabled. -* -* -* @param[in] p_dst Pointer to start of flash location to be written. -* @param[in] p_src Pointer to buffer with data to be written. -* @param[in] size Number of 32-bit words to write. Maximum size is 256 32-bit words for nRF51 and 1024 for nRF52. -* -* @retval ::NRF_ERROR_INVALID_ADDR Tried to write to a non existing flash address, or p_dst or p_src was unaligned. -* @retval ::NRF_ERROR_BUSY The previous command has not yet completed. -* @retval ::NRF_ERROR_INVALID_LENGTH Size was 0, or higher than the maximum allowed size. -* @retval ::NRF_ERROR_FORBIDDEN Tried to write to or read from protected location. -* @retval ::NRF_SUCCESS The command was accepted. -*/ -SVCALL(SD_FLASH_WRITE, uint32_t, sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size)); - - -/**@brief Flash Erase page -* -* Commands to erase a flash page -* If the SoftDevice is enabled: -* This call initiates the flash access command, and its completion will be communicated to the -* application with exactly one of the following events: -* - @ref NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed. -* - @ref NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started. -* -* If the SoftDevice is not enabled no event will be generated, and this call will return @ref NRF_SUCCESS when the -* erase has been completed -* -* @note -* - This call takes control over the radio and the CPU during flash erase and write to make sure that -* they will not interfere with the flash access. This means that all interrupts will be blocked -* for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual -* and the command parameters). -* -* -* @param[in] page_number Pagenumber of the page to erase -* @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error. -* @retval ::NRF_ERROR_INVALID_ADDR Tried to erase to a non existing flash page. -* @retval ::NRF_ERROR_BUSY The previous command has not yet completed. -* @retval ::NRF_ERROR_FORBIDDEN Tried to erase a protected page. -* @retval ::NRF_SUCCESS The command was accepted. -*/ -SVCALL(SD_FLASH_PAGE_ERASE, uint32_t, sd_flash_page_erase(uint32_t page_number)); - - -/**@brief Flash Protection set - * - * Commands to set the flash protection configuration registers. - On nRF51 this sets the PROTENSETx registers of the MPU peripheral. - On nRF52 this sets the CONFIGx registers of the BPROT peripheral. - * - * @note To read the values read them directly. They are only write-protected. - * - * @param[in] block_cfg0 Value to be written to the configuration register. - * @param[in] block_cfg1 Value to be written to the configuration register. - * @param[in] block_cfg2 Value to be written to the configuration register (ignored on nRF51). - * @param[in] block_cfg3 Value to be written to the configuration register (ignored on nRF51). - * - * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice. - * @retval ::NRF_SUCCESS Values successfully written to configuration registers. - */ -SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t block_cfg0, uint32_t block_cfg1, uint32_t block_cfg2, uint32_t block_cfg3)); - -/**@brief Opens a session for radio timeslot requests. - * - * @note Only one session can be open at a time. - * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START) will be called when the radio timeslot - * starts. From this point the NRF_RADIO and NRF_TIMER0 peripherals can be freely accessed - * by the application. - * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0) is called whenever the NRF_TIMER0 - * interrupt occurs. - * @note p_radio_signal_callback(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO) is called whenever the NRF_RADIO - * interrupt occurs. - * @note p_radio_signal_callback() will be called at ARM interrupt priority level 0. This - * implies that none of the sd_* API calls can be used from p_radio_signal_callback(). - * - * @param[in] p_radio_signal_callback The signal callback. - * - * @retval ::NRF_ERROR_INVALID_ADDR p_radio_signal_callback is an invalid function pointer. - * @retval ::NRF_ERROR_BUSY If session cannot be opened. - * @retval ::NRF_ERROR_INTERNAL If a new session could not be opened due to an internal error. - * @retval ::NRF_SUCCESS Otherwise. - */ - SVCALL(SD_RADIO_SESSION_OPEN, uint32_t, sd_radio_session_open(nrf_radio_signal_callback_t p_radio_signal_callback)); - -/**@brief Closes a session for radio timeslot requests. - * - * @note Any current radio timeslot will be finished before the session is closed. - * @note If a radio timeslot is scheduled when the session is closed, it will be canceled. - * @note The application cannot consider the session closed until the @ref NRF_EVT_RADIO_SESSION_CLOSED - * event is received. - * - * @retval ::NRF_ERROR_FORBIDDEN If session not opened. - * @retval ::NRF_ERROR_BUSY If session is currently being closed. - * @retval ::NRF_SUCCESS Otherwise. - */ - SVCALL(SD_RADIO_SESSION_CLOSE, uint32_t, sd_radio_session_close(void)); - -/**@brief Requests a radio timeslot. - * - * @note The request type is determined by p_request->request_type, and can be one of @ref NRF_RADIO_REQ_TYPE_EARLIEST - * and @ref NRF_RADIO_REQ_TYPE_NORMAL. The first request in a session must always be of type @ref NRF_RADIO_REQ_TYPE_EARLIEST. - * @note For a normal request (@ref NRF_RADIO_REQ_TYPE_NORMAL), the start time of a radio timeslot is specified by - * p_request->distance_us and is given relative to the start of the previous timeslot. - * @note A too small p_request->distance_us will lead to a @ref NRF_EVT_RADIO_BLOCKED event. - * @note Timeslots scheduled too close will lead to a @ref NRF_EVT_RADIO_BLOCKED event. - * @note See the SoftDevice Specification for more on radio timeslot scheduling, distances and lengths. - * @note If an opportunity for the first radio timeslot is not found before 100ms after the call to this - * function, it is not scheduled, and instead a @ref NRF_EVT_RADIO_BLOCKED event is sent. - * The application may then try to schedule the first radio timeslot again. - * @note Successful requests will result in nrf_radio_signal_callback_t(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START). - * Unsuccessful requests will result in a @ref NRF_EVT_RADIO_BLOCKED event, see @ref NRF_SOC_EVTS. - * @note The jitter in the start time of the radio timeslots is +/- @ref NRF_RADIO_START_JITTER_US us. - * @note The nrf_radio_signal_callback_t(@ref NRF_RADIO_CALLBACK_SIGNAL_TYPE_START) call has a latency relative to the - * specified radio timeslot start, but this does not affect the actual start time of the timeslot. - * @note NRF_TIMER0 is reset at the start of the radio timeslot, and is clocked at 1MHz from the high frequency - * (16 MHz) clock source. If p_request->hfclk_force_xtal is true, the high frequency clock is - * guaranteed to be clocked from the external crystal. - * @note The SoftDevice will neither access the NRF_RADIO peripheral nor the NRF_TIMER0 peripheral - * during the radio timeslot. - * - * @param[in] p_request Pointer to the request parameters. - * - * @retval ::NRF_ERROR_FORBIDDEN If session not opened or the session is not IDLE. - * @retval ::NRF_ERROR_INVALID_ADDR If the p_request pointer is invalid. - * @retval ::NRF_ERROR_INVALID_PARAM If the parameters of p_request are not valid. - * @retval ::NRF_SUCCESS Otherwise. - */ - SVCALL(SD_RADIO_REQUEST, uint32_t, sd_radio_request(nrf_radio_request_t * p_request )); - -/**@} */ - -#ifdef __cplusplus -} -#endif -#endif // NRF_SOC_H__ - -/**@} */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h deleted file mode 100644 index 9d62a02581..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/headers/nrf_svc.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2000 Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA - * integrated circuit in a product or a software update for such product, must reproduce - * the above copyright notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific prior - * written permission. - * - * 4. This software, with or without modification, must only be used with a - * Nordic Semiconductor ASA integrated circuit. - * - * 5. Any software provided in binary or object form under this license must not be reverse - * engineered, decompiled, modified and/or disassembled. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef NRF_SVC__ -#define NRF_SVC__ - -#include "stdint.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef SVCALL_AS_NORMAL_FUNCTION -#define SVCALL(number, return_type, signature) return_type signature -#else - -#ifndef SVCALL -#if defined (__CC_ARM) -#define SVCALL(number, return_type, signature) return_type __svc(number) signature -#elif defined (__GNUC__) -#ifdef __cplusplus -#define GCC_CAST_CPP (uint16_t) -#else -#define GCC_CAST_CPP -#endif -#define SVCALL(number, return_type, signature) \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ - __attribute__((naked)) \ - __attribute__((unused)) \ - static return_type signature \ - { \ - __asm( \ - "svc %0\n" \ - "bx r14" : : "I" (GCC_CAST_CPP number) : "r0" \ - ); \ - } \ - _Pragma("GCC diagnostic pop") - -#elif defined (__ICCARM__) -#define PRAGMA(x) _Pragma(#x) -#define SVCALL(number, return_type, signature) \ -PRAGMA(swi_number = (number)) \ - __swi return_type signature; -#else -#define SVCALL(number, return_type, signature) return_type signature -#endif -#endif // SVCALL - -#endif // SVCALL_AS_NORMAL_FUNCTION - -#ifdef __cplusplus -} -#endif -#endif // NRF_SVC__ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_5.0.0-1.alpha_softdevice.hex b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_5.0.0-1.alpha_softdevice.hex deleted file mode 100644 index 6890ab4de5..0000000000 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_5.0.0-1.alpha_softdevice.hex +++ /dev/null @@ -1,8052 +0,0 @@ -:020000040000FA -:1000000000040020E508000079050000C508000094 -:10001000830500008D05000097050000000000002A -:1000200000000000000000000000000009090000BE -:10003000A105000000000000AB050000B5050000B0 -:10004000BF050000C9050000D3050000DD05000064 -:10005000E7050000F1050000FB05000005060000B3 -:100060000F06000019060000230600002D06000000 -:1000700037060000410600004B0600005506000050 -:100080005F06000069060000730600007D060000A0 -:1000900087060000910600009B060000A5060000F0 -:1000A000AF060000B9060000C3060000CD06000040 -:1000B000D7060000E1060000EB060000F506000090 -:1000C000FF06000009070000130700001D070000DD -:1000D00027070000310700003B070000450700002C -:1000E0004F07000059070000630700006D0700007C -:1000F00077070000810700008B07000095070000CC -:100100009F0700001FB500F003F88DE80F001FBD2A -:1001100000F0DEBB1FB56FF00100009040100390AF -:10012000029001904FF010208069000B420900F00E -:100130001F045DF822300120A04083434DF8223097 -:10014000684600F044F91FBDF0B54FF6FF734FF459 -:10015000B4751A466E1E11E0A94201D3344600E080 -:100160000C46091B30F8027B641E3B441A44F9D14B -:100170009CB204EB134394B204EB12420029EBD17E -:1001800098B200EB134002EB124140EA0140F0BD8F -:10019000DD4992B00446D1E90001CDE91001FF220A -:1001A0004021684600F03AFB94E80F008DE80F000C -:1001B000684610A902E004C841F8042D8842FAD12B -:1001C00010216846FFF7C0FF1090AA208DF8440068 -:1001D000FFF7A0FF00F0F2F84FF01024A069102202 -:1001E0006946803000F001F9A069082210A900F0EA -:1001F000FCF800F0D7F84FF080510A6949690068AF -:100200004A43824201D8102070470020704710B541 -:10021000D0E900214FF0805002EB8103026944696C -:100220006243934209D84FF01022536903EB8103D4 -:100230000169406941438B4201D9092010BD5069D1 -:10024000401C01D0002010BD0F2010BD70B501680A -:100250000446AE4D4FF01020062951D2DFE801F0E0 -:10026000320318283B1DD4E90265646829463046EC -:1002700000F0CDF82A462146304600F0B6F8AA0034 -:100280002146304600F09EFA002800D0032070BDC1 -:1002900000F050FB4FF4805007E0201DFFF7ABFF4C -:1002A0000028F4D100F046FB60682860002070BD93 -:1002B000241D94E80700920000F084FA0028F6D08C -:1002C0000E2070BD8069401C12D0201DFFF79FFFDB -:1002D0000028F6D109E08069401C09D0201DFFF7F5 -:1002E0008AFF0028EDD1606820B12046FFF750FF5B -:1002F000042070BDFFF70EFF00F060F800F052F828 -:10030000072070BD10B50C46182802D001200860E7 -:1003100010BD2068FFF79AFF206010BD4FF0102439 -:10032000A069401C05D0A569A66980353079AA2846 -:1003300008D06069401C2DD060690068401C29D03D -:1003400060692CE010212846FFF7FEFE31688142EB -:100350001CD1A16901F18002C03105E030B108CAA9 -:1003600051F8040D984201D1012000E000208A429A -:10037000F4D158B1286810B1042803D0FEE728460C -:1003800000F057F861496868086008E000F016F866 -:1003900000F008F84FF480500168491C01D000F0CB -:1003A000A3FAFEE7BFF34F8F59480168594A01F499 -:1003B000E06111430160BFF34F8FFEE74FF0102063 -:1003C0008169491C02D0806900F0ADB87047524A7B -:1003D00001681160121D416811604F4A8168103236 -:1003E0001160111DC068086070472DE9F041174683 -:1003F0000D460646002406E03046296800F0A6F8BF -:10040000641C2D1D361DBC42F6D3BDE8F08170B5CD -:100410000C4605464FF4806608E0284600F083F855 -:10042000B44205D3A4F5806405F58055002CF4D1C1 -:1004300070BD4168044609B1012500E000254FF078 -:1004400010267069A268920000F0BCF9C8B120467D -:1004500000F01AF89DB17669A56864684FF4002031 -:1004600084420AD2854208D229463046FFF7CFFFA0 -:100470002A4621463046FFF7B8FFFFF79FFFFFF7F8 -:1004800091FFFFF747FEF8E72DE9FF414FF01024F9 -:10049000616980680D0B01EB800000F6FF70010BB5 -:1004A00000200090019002900246039068460123CC -:1004B0000BE0560902F01F0C50F8267003FA0CFCF2 -:1004C00047EA0C0740F82670521CAA42F1D30AE012 -:1004D0004A0901F01F0650F8225003FA06F6354388 -:1004E00040F82250491C8029F2D3A169090B4A091E -:1004F00001F01F0150F822408B409C4340F82240FD -:10050000FFF765FFBDE8FF815809000000000020EB -:100510000CED00E00400FA050006004014480168F4 -:100520000029FCD07047134A0221116010490B6862 -:10053000002BFCD00F4B1B1D186008680028FCD056 -:100540000020106008680028FCD07047094B10B5E7 -:1005500001221A60064A1468002CFCD00160106861 -:100560000028FCD00020186010680028FCD010BDC6 -:1005700000E4014004E5014008208F49096809585A -:10058000084710208C4909680958084714208A49EF -:100590000968095808471820874909680958084711 -:1005A0003020854909680958084738208249096878 -:1005B000095808473C2080490968095808474020E5 -:1005C0007D4909680958084744207B49096809584A -:1005D0000847482078490968095808474C20764957 -:1005E000096809580847502073490968095808479D -:1005F0005420714909680958084758206E4909680C -:10060000095808475C206C49096809580847602068 -:100610006949096809580847642067490968095801 -:100620000847682064490968095808476C206249EE -:1006300009680958084770205F4909680958084740 -:1006400074205D4909680958084778205A490968A3 -:10065000095808477C2058490968095808478020EC -:1006600055490968095808478420534909680958B9 -:100670000847882050490968095808478C204E4986 -:1006800009680958084790204B49096809580847E4 -:10069000942049490968095808479820464909683B -:1006A000095808479C204449096809580847A02070 -:1006B0004149096809580847A4203F490968095871 -:1006C0000847A8203C49096809580847AC203A491E -:1006D000096809580847B020374909680958084788 -:1006E000B4203549096809580847B82032490968D3 -:1006F00009580847BC203049096809580847C020F4 -:100700002D49096809580847C4202B490968095828 -:100710000847C8202849096809580847CC202649B5 -:10072000096809580847D02023490968095808472B -:10073000D4202149096809580847D8201E4909686A -:1007400009580847DC201C49096809580847E02077 -:100750001949096809580847E420174909680958E0 -:100760000847E8201449096809580847EC2012494D -:10077000096809580847F0200F49096809580847CF -:10078000F4200D49096809580847F8200A49096802 -:1007900009580847FC2008490968095808475FF4C8 -:1007A0008070054909680958084700000348044952 -:1007B000024A034B70470000000000206809000057 -:1007C0006809000040EA010310B59B070FD1042A15 -:1007D0000DD310C808C9121F9C42F8D020BA19BA0C -:1007E000884201D9012010BD4FF0FF3010BD1AB171 -:1007F000D30703D0521C07E0002010BD10F8013BC6 -:1008000011F8014B1B1B07D110F8013B11F8014BEC -:100810001B1B01D1921EF1D1184610BD02F0FF033F -:1008200043EA032242EA024200F005B870477047EB -:1008300070474FF000020429C0F0128010F0030C42 -:1008400000F01B80CCF1040CBCF1020F18BF00F8C3 -:10085000012BA8BF20F8022BA1EB0C0100F00DB872 -:100860005FEAC17C24BF00F8012B00F8012B48BFD0 -:1008700000F8012B70474FF0000200B51346944674 -:100880009646203922BFA0E80C50A0E80C50B1F1E8 -:100890002001BFF4F7AF090728BFA0E80C5048BFFC -:1008A0000CC05DF804EB890028BF40F8042B08BF9A -:1008B000704748BF20F8022B11F0804F18BF00F896 -:1008C000012B7047014B1B68DB68184700000020B4 -:1008D00009480A497047FFF7FBFFFFF713FC00BD0B -:1008E00020BFFDE7064B1847064A1060016881F3F8 -:1008F0000888406800470000680900006809000097 -:100900001D030000000000201EF0040F0CBFEFF3D9 -:100910000881EFF30981886902380078182803D12B -:1009200000E00000074A1047074A12682C3212689C -:100930001047000000B5054B1B68054A9B589847B7 -:1009400000BD000005030000000000205409000065 -:1009500004000000001000000000000000FFFFFF86 -:040960000090D00330 -:101000004812002001F701007D9F00006FF60100EB -:101010007D9F00007D9F00007D9F0000000000007C -:1010200000000000000000000000000059F701006F -:101030007D9F0000000000007D9F00007D9F00005C -:10104000C1F70100C7F701007D9F00007D9F0000F0 -:101050007D9F00007D9F00007D9F00007D9F000020 -:10106000CDF701007D9F00007D9F0000D3F70100B8 -:101070007D9F0000D9F70100DFF70100E5F70100CF -:101080007D9F00007D9F00007D9F00007D9F0000F0 -:101090007D9F00007D9F00007D9F00007D9F0000E0 -:1010A000EBF70100F1F701007D9F00007D9F00003C -:1010B0007D9F00007D9F00007D9F00007D9F0000C0 -:1010C000F7F701007D9F00007D9F00007D9F0000DD -:1010D0007D9F00007D9F00007D9F00007D9F0000A0 -:1010E0007D9F00007D9F00007D9F00007D9F000090 -:1010F0007D9F00007D9F00007D9F00007D9F000080 -:101100007D9F00007D9F000000F002F81EF0E5FAD0 -:101110000AA090E8000C82448344AAF10107DA4552 -:1011200001D11EF0DAFAAFF2090EBAE80F0013F09F -:10113000010F18BFFB1A43F00103184718EC010018 -:1011400038EC01000A4410F8014B14F00F0508BFF9 -:1011500010F8015B240908BF10F8014B6D1E05D083 -:1011600010F8013B6D1E01F8013BF9D1641E03D05C -:10117000641E01F8015BFBD19142E4D3704700008B -:101180000023002400250026103A28BF78C1FBD890 -:10119000520728BF30C148BF0B6070471FB500F031 -:1011A0003DF88DE80F001FBD1EF0040F0CBFEFF3DC -:1011B0000880EFF30980014A10470000CF9D00002E -:1011C0008269034981614FF00100104470470000BB -:1011D000D511000001B41EB400B511F057F801B4E8 -:1011E0000198864601BC01B01EBD0000F0B4404627 -:1011F000494652465B460FB402A0013001B506488D -:10120000004700BF01BC86460FBC80468946924617 -:101210009B46F0BC70470000091100001EF05ABA4E -:1012200070B51C4C054608202070A01C00F065F825 -:101230005920A08029462046BDE8704006F092BFA4 -:1012400010B506F09AFF13490020891E087010BDE2 -:1012500070B50C460F49891E097829B1A0F16001CB -:10126000532906D3012011E0602802D043F2010087 -:101270000CE020CC084E94E80E0006EB8000A0F5B0 -:101280008050241FD0F8806E2846B047206070BD83 -:10129000012070470A00002050F8010010B50446F4 -:1012A0000021012000F03FF80021182000F03BF859 -:1012B00000210B2000F037F80421192000F033F84A -:1012C00004210D2000F02FF804210E2000F02BF84F -:1012D00004210F2000F027F80421C84300F023F870 -:1012E0000721162000F01FF80721152000F01BF839 -:1012F0002046FFF795FF002010BD90210180704728 -:10130000FFF79EBF10487047104A10B514680F4B86 -:101310000F4A08331A60FFF79BFF0C48001D04605A -:1013200010BD704770474907090E002806DA00F023 -:101330000F0000F1E02080F8141D704700F1E0205C -:1013400080F800147047000003F9004310050240C4 -:101350000100000130B5F74D044610280AD0112CC9 -:1013600006D02846122C817806D0132C08D0FFDF37 -:10137000AC7030BDFFDFFBE71129F9D0FFDFF7E7E5 -:101380001129F5D0FFDFF3E770B50FF06CF90446D3 -:1013900010F044FD201AC4B206200DF047FB0546AC -:1013A00006200DF04BFB2E1A07200DF03FFB0546E3 -:1013B00007200DF043FBDF49281A321888781228DD -:1013C0000DD000231A4413280BD0002002440878C3 -:1013D000022808D000201044201AC0B270BD01239A -:1013E000F0E70120F2E70120F5E7D24800B50079E7 -:1013F000D049420897B051F8050F89880CD01722C0 -:101400008DF80020CDF80200ADF806100BA9684653 -:101410000AF0F8FE17B000BD4322F1E702210DF0FB -:101420005ABB2DE9F04196B01D4690460E46074640 -:10143000FFF7F4FF04000BD02078222804D3A07F0C -:10144000C0F34010A84206D1082016B0BDE8F081D4 -:1014500043F20200F9E748208DF80000ADF8027071 -:101460003DB101208DF804008DF805608DF80680EF -:1014700002E000208DF804000BA968460AF0C2FEC5 -:10148000A07F65F34510A0770020DEE730B5044665 -:10149000A1F120000D460A284AD2DFE800F0050736 -:1014A0000C1C2328353A3F44FFDF42E020782028F7 -:1014B0003FD1FFDF3DE09F480178032939D0807894 -:1014C000132836D02078242833D0252831D023285B -:1014D0002FD0FFDF2DE0207822282AD0232828D8FB -:1014E000FFDF26E02078222823D0FFDF21E02078CC -:1014F00022281ED024281CD026281AD0272818D00D -:10150000292816D0FFDF14E02078252811D0FFDF2E -:101510000FE0207825280CD0FFDF0AE0207825286E -:1015200007D0FFDF05E02078282802D0FFDF00E0A9 -:10153000FFDF257030BD30B50B8840F67B444FF699 -:10154000FF72022801D0934204D09D1FA54224D2ED -:10155000022802D04D88954203D04D88AD1FA54288 -:101560001BD24C88A34218D88B88B3F5FA7F14D2CB -:10157000022802D0C888904205D0C88840F6774536 -:101580000A38A84209D2C888904208D0944206D0AE -:101590005B1C6343B3EB800F01DB072030BD0020F1 -:1015A00030BD70B514460D46064611F0DDF860B941 -:1015B0000DB1A54201D90C2070BD002409E000BF87 -:1015C00056F8240011F0D0F808B1102070BD641C4A -:1015D000E4B2AC42F4D3002070BDF0B50024059D08 -:1015E00010B1A94203D851E009B90020F0BD09208B -:1015F000F0BD055D8DB107197E78112E3FD00FDC4F -:101600000A2E3CD2DFE806F03B1624242A2A2C2C92 -:101610003333025D72BB641CE4B28C42F9D3E4E75D -:101620001D2E2CDAA6F11206042E28D2DFE806F0D1 -:1016300027271018022DDAD1BD781D70072D01D291 -:101640006D0701D40A20F0BD157845F0010515E0BD -:10165000EE43F60707E0012D07D010E00620F0BDAD -:101660002E07A6F18056002EF5D06046F0BD157805 -:10167000AE0701D50B20F0BD45F002051570055DE4 -:10168000641C2C44E4B28C4202D9B0E74FF4485CAD -:101690008C42AED3A9E710B50278540809D00122D4 -:1016A00043F20223012C07D0022C0DD0032C13D1BE -:1016B0000FE00020087005E080790324B4EB901F50 -:1016C0000AD10A70002010BD8079B2EB901F03D1BF -:1016D000F7E780798009F4D0184610BD154A917B50 -:1016E00039B1D17B022908D0032908D043F2022066 -:1016F00070470146101D01F0BFBB032100E001212E -:1017000001700020704738B50C460546694601F067 -:10171000B3FB00280DD19DF80010207861F347003D -:10172000207055F8010FC4F80100A888A4F805003E -:10173000002038BDB401002038B51378C0B10228AC -:1017400016D0FAA46D46246800944C7905EB9414E5 -:10175000247864F34703137003280ED003F0FE00CF -:1017600010700868C2F801008888A2F8050038BD2A -:1017700023F0FE0313700228EED1D8B240F001002E -:10178000EEE730B50C46097897B0222902D208203E -:1017900017B030BD28218DF80010ADF80200132AD3 -:1017A00003D03B2A01D00720F2E78DF804200BA9D3 -:1017B00068460AF027FD050003D121212046FFF7E6 -:1017C00065FE2846E4E700B597B023218DF80010A8 -:1017D000ADF802001088ADF804005088ADF806009E -:1017E000D088ADF80A009088ADF808000020ADF868 -:1017F0000C00ADF80E000BA968460AF003FD09E6DF -:101800002DE9FF470220CA4E8DF804000027708A98 -:10181000ADF80600B84643F202094DE001A80DF00C -:10182000C4F8050006D0708AA8B3A6F81280ADF8F7 -:1018300006803FE0039CA07F01072DD504F1240022 -:101840000090A28EBDF80800214604F1360301F095 -:10185000A2FF050005D04D452BD0112D3DD0FFDF57 -:101860003BE0A07F20F00800A077E07F810861F3D3 -:101870000000C10861F34100E07794F8210000F016 -:101880001F0084F820002078282827D1292120460D -:10189000FFF7FCFD22E015E040070BD5BDF808007E -:1018A000214604F10E02FFF78EFF05000DD04D45D5 -:1018B00010D100257F1CFFB202200DF0B7F8401CAC -:1018C000B842ABD8052D12D008E0A07F20F004006C -:1018D000A07703E0112D00D0FFDF0025BDF8060042 -:1018E0007082052D05D0284604B0BDE8F087A6F823 -:1018F00012800020F8E72DE9F047040000D1FFDF57 -:1019000020788B4E20F00F00801C20F0F00070300B -:10191000207060680178091F1529E6D2DFE801F020 -:10192000580B0C5CF80C0DF8F835580C0C587F5817 -:10193000580C0C585800FFDFD7E785882846FFF77A -:101940006DFD040000D1FFDF06F0BEFC707C21219C -:1019500040F0040070742046FFF798FD284607F019 -:10196000A1F9284603F05AFF284604F0B3FF2946A0 -:10197000022010F0B6FEA07F20F01000A077FFF745 -:101980003FFF0028B1D0FFDFAFE786883046FFF782 -:1019900045FD00B9FFDF60688078012800D0FFDFD7 -:1019A00060688179304607F0D9FB05009DD006F0CC -:1019B00088FC040000D1FFDF207820F00F00801C9D -:1019C00020F0F000203020706680062020726572C2 -:1019D000BDE8F04706F078BC86883046FFF71EFD6C -:1019E000050000D1FFDF06F06FFC60683146C0885B -:1019F000288160680089688160684089A881022028 -:101A000010F06FFE0020A875A87F00F003000228E8 -:101A100092D1FFF7F5FE00288ED0FFDF65E78078D2 -:101A20003C2803D0002502280AD000E00125002729 -:101A300020B13C2802D0022800D0FFDF17B1A0E07F -:101A40000127F5E706F040FC707C002D40F008000F -:101A500070746AD165680221B5F80480AD1C4746F0 -:101A600038460DF02FF80446032138460DF02AF8C9 -:101A70008246052138460DF025F881460421384676 -:101A80000DF020F8074604B9FFDFBAF1000F00D1CE -:101A9000FFDFB9F1000F00D1FFDF07B9FFDF22211F -:101AA0002046FFF7F3FC2879012832D00227A07FD7 -:101AB000062167F30100A077288B2081688B608165 -:101AC000A88BA08105F1120001F00DFA18B3687916 -:101AD000800700D5FFDF6979E07D61F34700E0759D -:101AE000D5F80600A0616889A083062105F10C00E5 -:101AF00001F0F9F9F0B130794108607861F34700FD -:101B00006070D6F80500C4F80200B6F809001AE0C3 -:101B100044E00127CBE7E07D20F0FE00801CE0756B -:101B2000D5F81200A061E88ADEE71DE00302FF019C -:101B3000B4010020607820F0FE00801C6070E8682E -:101B4000C4F80200288AE080F948007884F822006E -:101B5000A07F00F00301404607F096F8012F03D064 -:101B6000022F0ED0FFDFC0E63078032800D0FFDF61 -:101B70000021084610F0B5FDBDE8F047012001F056 -:101B800055B9B078132800D0FFDF0021072010F0EE -:101B9000A8FDBDE8F0471120FFF7DCBB2046BDE8FB -:101BA000F04702F0BBB82DE9F047054600780C4637 -:101BB00000270109DFF87CA391463E46012974D035 -:101BC00000234FF6FF70022970D0072909D00A2997 -:101BD0006DD0FFDFA9F800600CB12780668000207F -:101BE00083E6D5F804C004F108029CF8001012291D -:101BF00067D00EDC04F118080A2913D004DC04298C -:101C00007ED007297DD13FE00E2951D01129F9D18D -:101C1000BAE0132976D0142975D017293CD0182999 -:101C2000F0D1D4E011270926002C76D0BCF804802E -:101C3000A4F804806868807920729AF811104046F0 -:101C400021F004018AF8111004210CF056FF05213F -:101C500040460CF052FF002140460CF04EFF01219F -:101C600040460CF04AFF032140460CF046FF02219B -:101C700040460CF042FF062140460CF03EFF072193 -:101C800040460CF03AFFA5E712271026BCF80400E6 -:101C9000214601F009F99DE71C270926A4B3BCF8E9 -:101CA0000200A0806868007934E1D8E003E1D0E068 -:101CB0001B27092644B30420207268684088A0804E -:101CC00088E79CF802003C282AD0102718260CF13F -:101CD000020CCCB1BCF80200A080BCF818006082F5 -:101CE000BCF818002082BCF81A00A082BCF81C00C6 -:101CF000E0829CF805000CF10601FFF71DFD04E0F1 -:101D000018E0A5E090E072E007E09CF8040010B154 -:101D10000120E07309E00220FBE7A9F800605EE71C -:101D20001B270926002CF8D023729AF8111021F0F5 -:101D30000801D4E01D273726002CEED0A08069686A -:101D40000879491DFFF7F8FC686890F82B00A0752A -:101D50006868C0780428E07D13D020F00100E075A9 -:101D600069681F22C97861F34200E0756968C97A21 -:101D700061F3C700E075696840460C311DF0B2FBA5 -:101D800028E740F00100EAE71D273726002CC4D0E1 -:101D9000A0806968481D0B7901461846FFF7CCFC06 -:101DA000696804F10F02C87A0C31FFF7C5FC686856 -:101DB000807CA0756868C178E07D61F3420020F006 -:101DC000F900E0751F2140461DF025FC02E72027A1 -:101DD0001026002CA1D0A080686804F10902407A86 -:101DE00020726868C11C8078FFF7A6FCF2E6212704 -:101DF0000B26002C91D0BCF80400A0806868807885 -:101E0000207268688079012803D0022801D0FFDFA2 -:101E1000002060726868C079012803D0022801D0D0 -:101E2000FFDF0020A072D5E604271026002C84D006 -:101E3000BCF80200A0806868808820816868C0883B -:101E4000608168680089A08168684089E081C1E696 -:101E50004A4621462846BDE8F04702F0D4B8287A21 -:101E6000012803D0022814D0FFDFB3E61F27102675 -:101E7000002C8CD06888A08068892081A889608126 -:101E8000E889A081288AE0819AF8111021F02001C8 -:101E900025E0122710266888214601F005F8002C5D -:101EA00098D0687800F0070005288FD19AF81110B3 -:101EB00021F0020113E0297A07292DD2DFE801F091 -:101EC0000512120404042300C2E71B270926002C74 -:101ED00090D0A08023729AF8111021F001018AF8A5 -:101EE000111077E61B270926002CA0D0A080287AA5 -:101EF000012806D0032020729AF8111021F0100159 -:101F0000EDE70220F7E701270926002C8FD068882B -:101F1000A080687A20725DE6FFDF5BE610B50548B9 -:101F200096B08078132807D0082016B010BD0000A6 -:101F300010000020B401002022208DF800000BA921 -:101F400068460AF05FF904460021072010F0C9FB3B -:101F50002046EAE700B5FF4897B08078122801D004 -:101F600008204CE41E208DF8000000208DF80200AF -:101F70008DF803000BA968460AF044F90028F0D157 -:101F80000021072010F0ADFB1120FFF7E3F900203E -:101F900035E400B5EF4897B00078012814D01B2035 -:101FA0008DF8000000208DF802000BA968460AF0A9 -:101FB00029F9002807D10021084610F092FB0120E2 -:101FC00000F034FF00201AE4082018E42DE9F04165 -:101FD000E04C002740B102281DD0072842D0082835 -:101FE00000D0FFDFBDE8F081FFF7D3FF0028F9D173 -:101FF00006F067F90028F5D0017821F00F01891C5F -:1020000021F0F00120310170077206F05DF9607C6B -:1020100040F001001DE08EB23046FFF7FFF90500E9 -:1020200000D1FFDF28782128DCD006F04AF990B1F2 -:10203000017821F00F01891C21F0F00110310170AD -:10204000022101724680AF7506F03EF9607C40F0D7 -:1020500002006074C6E729463046BDE8F04113220D -:10206000FFF78FBBA578122D03D0132D04D0FFDF0F -:10207000B8E7FFF76FFF01E0FFF750FF0028B1D18D -:1020800006F01FF90028ADD0017821F00F01891C5E -:1020900021F0F00120310170122D07D002210172D0 -:1020A00006F012F9607C40F01000D2E70121F6E75B -:1020B0002DE9F04116460C00074600D1FFDF3078CD -:1020C00020F00F00801C20F0F000103030702078DD -:1020D000012803D0022817D0FFDF83E73846FFF737 -:1020E0009DF9050000D1FFDF0220A87506F0ECF88D -:1020F0002068B0606068F060208930829548417C3B -:1021000041F0200141746DE73846FFF787F905007B -:1021100000D1FFDF61884FF6FF70814209D1A288AC -:10212000824206D129463846BDE8F0411322FFF726 -:1021300028BB814201D1A08848B106F0C5F82068CB -:10214000B0606068F06020893082002006E078236B -:1021500000223946022010F027FA0120A87541E735 -:1021600030B5054697B00C46084610F0FDFA80BB26 -:1021700000200121203D082D6CD2DFE805F0042667 -:102180004145505765730021082010F083FA10B1C3 -:10219000112017B030BD24208DF80000D4F80200C3 -:1021A000CDF80200A0798DF806000BA968460AF068 -:1021B00029F8050054D1082300221146184610F0D2 -:1021C000F3F908284CD0FFDF4AE0606810F00EFBFE -:1021D00008B11020DDE74B208DF800002088ADF815 -:1021E00002006088ADF804000BA968460AF00AF8FE -:1021F000050035D1606870B3BDF8301001802FE064 -:10220000206802F0A1F908E04C2209E08DF80210E4 -:1022100015E000BF8DF8020011E0054620E04522E0 -:102220008DF800202278D207F4D0EFE738208DF81F -:1022300000002088ADF802006088ADF804000BA90A -:10224000684609F0DFFFE8E7207828B1A0F11B011C -:10225000E12902D3072503E01B203F490025087030 -:10226000284696E72078800802D16078800801D05F -:1022700007208EE73F208DF8000020788DF80300BE -:1022800060788DF80400207830B100208DF80200CD -:10229000617819B1002102E00120F7E7022108432B -:1022A000B8E730B5054697B00C46084610F080FAFE -:1022B00008B110206DE7202D07D0212D25D0222D2B -:1022C00023D0232D21D0072063E72088FFF7A6F82D -:1022D00020B10078222804D208205AE743F20200F5 -:1022E00057E725208DF800002088ADF802000BA9E3 -:1022F000684609F087FF0028DCD1DDF83210C4F809 -:1023000002109DF83610A17143E7062041E71148FD -:10231000001D70470F49087470470E48007C00F09C -:102320000100704738B514210A481DF052F9012008 -:1023300000F07CFD1120FFF70DF80749FB20054C4C -:102340000870611D684605F01CFF9DF8001020799B -:1023500004E00000B40100201000002061F34700F9 -:1023600020F0010020710020A0734FF46170A08163 -:102370000220E073FFF739F800B1FFDF00F04CFEF8 -:1023800001F087FC38BD10B50C463E2120461DF0FB -:1023900020F9A07F20F00300A077202020700020EB -:1023A000A07584F82300C1E570477CB5054610F0A0 -:1023B000DBF908B110207CBDFE4C211D6068009047 -:1023C000A06801902846FFF79EF90028F3D1FFF797 -:1023D0000CF80028EFD000996160BDF8041021814D -:1023E0009DF80610A1727CBD10B5044610F0E0F90E -:1023F00008B110209AE5EF4922460879491D4008A6 -:10240000FFF79AF9002091E52DE9F0479CB00D46C1 -:1024100004004FF0000812D00822FFF7C2F800288D -:102420001CD1002609E000BF54F8260004A9FFF7DC -:1024300032F9002812D1761CF6B2AE42F4D32F4600 -:102440000A2006AD0DF1440A8DF8180026465146C3 -:10245000284609F0D7FE20B143F203201CB0BDE8A6 -:10246000F0874046DFF84C8388F803002EB3002441 -:102470004FF00B091DE000BF56F8240005A9FFF737 -:102480000AF900B1FFDF9DF81400A87056F8240087 -:1024900050F8011FC5F803108088A5F8070085F8DB -:1024A00000905146284609F0ADFE00B1FFDF641CE4 -:1024B000E4B2BC42E0D388F803700020CEE72DE9F7 -:1024C000F0479EB01546894604001ED00F460822EC -:1024D0002946FFF766F8002811D1002613E000BF57 -:1024E00054F8260005A9103000F0C6FC002806D1DB -:1024F0003FB157F8260010F037F910B110201EB088 -:10250000ADE7761CF6B2AE42EAD30026A5F101088B -:102510001CE000BF06F1010A0AF0FF0712E000BF4D -:1025200054F82600017C4A0854F827100B7CB2EBC3 -:10253000530F05D10622113011311CF0A7FFC0B195 -:102540007F1CFFB2AF42EBD30AF0FF064645E1DB4A -:10255000C8462F46342007AD0DF148098DF81C0000 -:1025600026464946284609F04DFE28B143F204208C -:10257000C5E743F20520C2E796B300242CE000BF74 -:1025800056F82400A91C103000F076FC00B1FFDFE3 -:1025900056F82400102250F8111FC5F80310808847 -:1025A000A5F8070056F8241005F109001CF09AFF61 -:1025B000B8F1000F15D058F82410102205F11900B9 -:1025C0001CF090FF322028704946284609F01AFE78 -:1025D00000B1FFDF641CE4B2BC42D1D3012206E0AB -:1025E00004E005F1190001F0A3FFEBE700224946E2 -:1025F000284600F06CFC002081E770B596B00446D8 -:1026000010F0B2F818B9606810F0F9F810B11020A5 -:1026100016B070BD60884AF2B811884205D820789B -:10262000644D6E4618B1012804D00720F0E7FEF78C -:10263000DCFE1AE06078022804D0032802D043F2BE -:102640000220E5E7E87317208DF80000E97B002001 -:10265000CDF80200ADF80600022932D003292DD0B2 -:10266000FFDF0BA9684609F0CDFD0028D0D16068D6 -:1026700001F051FF207870B101208DF80200F01CAC -:1026800001F056FF4E208DF800000BA9684609F0B6 -:10269000B9FD00B1FFDF6088A8B1A88180B2ADF8B4 -:1026A000020030208DF800000BA9684609F0AAFD51 -:1026B00000B1FFDF2078A8730020A9E78DF807009C -:1026C000CFE74020FAE74FF46170E6E710B5044623 -:1026D00010F06EF820B9606838B110F087F808B1D2 -:1026E000102023E4606801F023FF32488189618073 -:1026F000C17B6170807B2070002017E42DE9F041E0 -:102700009CB0054600208DF864008DF860008DF8BF -:1027100030008DF868001E4614468846284610F0A2 -:102720006EF818B9204610F06AF810B110201CB0ED -:1027300058E455EA040018D01F270CAB19AA4146EB -:1027400028460097FEF749FF0028F0D11AAB18AAD7 -:10275000314620460097FEF740FF0028E7D19DF85C -:102760006000C00703D00A20E1E70720DFE701AFE0 -:102770007DB11A208DF804008DF806804246294666 -:10278000F81C1CF0AFFE0DA901A809F03BFD0028C4 -:10279000CDD194B120208DF804008DF8066032462A -:1027A0002146F81C1CF09EFE0DA901A809F02AFD87 -:1027B000002801E0B4010020B9D1FF499DF83000A4 -:1027C00048700020B3E72DE9F0439BB04FF00008BC -:1027D000FAA104468DF83480D1E90001CDE9190150 -:1027E00020460FF0C1FF90B92078012803D160681E -:1027F0000FF0BAFF58B9F04D4FF00109A87B50B166 -:10280000E87B022807D160680FF0F9FF18B11020AB -:102810001BB0BDE8F0832878012801D00820F7E735 -:1028200007200CF00BF918B9207848B1012807D01F -:10283000FEF7AAFD30B1687C10F00C0F08D103E060 -:102840001220E5E71320E3E7C10701D1800701D596 -:102850001120DDE7608943F6E172A0F12001914289 -:10286000217807D301297CD100287AD1A1890029B8 -:1028700077D10FE0022901D0032901D1A02870D31C -:10288000012907D06978C90704D0A189002968D037 -:10289000B42966D8217831B1012908D0022904D0A1 -:1028A00003295ED10AE0002609E0022607E008B904 -:1028B000A08908B1042609E0012607E00326A87BC9 -:1028C00050B1E87B022807D1606828B10DA9606883 -:1028D000FEF7E1FE00289BD1207A30B1012806D016 -:1028E000022806D003286DD105E0002704E0012767 -:1028F00002E0022700E003270EB1022E0ED16FB1D5 -:10290000E87870B36878800702D043F201207FE74F -:10291000022E03D1022F55D0032F53D018208DF84B -:1029200038006089ADF83A006089ADF83C008DF858 -:102930003E600DF13F00FEF7D1FE00B1FFDF9DF8D4 -:1029400034008DF840002078012806D0A87B68B1BB -:10295000E87B02280AD1606840B1606850F8011F26 -:1029600000E02FE0CDF84110808802E04046CDF82D -:102970004180ADF845008DF84870A07BC0F340025F -:10298000014662F35F01C0F3800041EA800019A9AB -:10299000085C8DF84700A8B169460EA809F032FC22 -:1029A0000028B4D11B208DF838008DF83A90694684 -:1029B0000EA809F027FC0028A9D19DF801001B28CA -:1029C00019D101E0072023E7052E09D2DFE806F040 -:1029D000030305050300032000E0022000F026FAAF -:1029E000012E0AD0A08940B1002283001146104672 -:1029F0000FF0DAFD08B103200AE7002008E72DE90F -:102A0000FC4107460D46032608460FF0F8FE002855 -:102A100064D13846FEF702FD040005D02078222854 -:102A200005D20820BDE8FC8143F20200FAE7A07F4E -:102A300000F0030C2DB129466046FEF77CFD060030 -:102A4000F0D15D48BCF1010F05D0BCF1020F17D0E9 -:102A5000FFDF3046E6E7A27D2946012A02D0407C0E -:102A6000800701D51120DDE729B9684600F0E1FBB8 -:102A70000028D7D16946384606F0F3FA0646E8E75B -:102A8000A17D022914D1407C800611D425B1A07FFC -:102A900040070BD4002100E00121384606F029FB55 -:102AA0000600D6D1A075002DD3D002E01126D0E7C4 -:102AB000A5B12A4621463846FEF785FE064611286E -:102AC000C7D1A07F4107C4D4296844F80E1F6968A4 -:102AD000616040F0040020740026BAE71020A1E7EE -:102AE00070B50C460546FEF799FC010005D022465C -:102AF0002846BDE87040FEF744BE43F2020070BDB8 -:102B000000B597B042218DF800108DF802000BA996 -:102B1000684609F077FB17B000BD0123FEF781BCC2 -:102B200000231A461946FEF77CBC30B597B0044620 -:102B30000FF01AFE10B1102017B030BD204600F083 -:102B400089F90028F8D11C4DA878112801D0082057 -:102B5000F2E7FEF719FC20B1687CC00603D511200E -:102B6000EAE71320E8E72078800701D5E87848B342 -:102B70001D208DF800002078022200F001008DF861 -:102B800002006088ADF80400A088ADF80600207847 -:102B9000C0F3400102EA500001438DF8091002A879 -:102BA000FEF79CFD00B1FFDF0BA9684609F02AFB88 -:102BB0000028C1D11E2006E0B4010020070605044C -:102BC0000302010017E08DF8000001208DF80200DB -:102BD00000208DF803000BA9684609F013FB0028BC -:102BE000AAD1E08800F052F90400A5D11220FEF726 -:102BF000B1FB2046A0E707209EE7F0B597B0154649 -:102C00000C4607460FF0FBFD38B920460FF0ACFD2F -:102C100018B928460FF0A8FD10B1102017B0F0BD6C -:102C2000B84E707C10F0180F01D1400701D511206B -:102C3000F4E7204600F00EF90028EFD129460220E3 -:102C4000FEF779FC0028E9D1B078112803D01228CA -:102C500001D00820E2E72078C0F34001394311D0C9 -:102C6000800700D577B906200BF0E8FE40B1207848 -:102C7000800701D5F07828B1B078122804D007E099 -:102C80001220CBE70720C9E7FFF764F90028C5D178 -:102C9000FEF77AFB022801D21320BFE721208DF82E -:102CA00000006088ADF80200A088ADF8040020782C -:102CB000C0F340008DF806002078800716D43878DD -:102CC000420808D0012A18D043F20221022A18D063 -:102CD000032A18D115E0C00700D002208DF80700A4 -:102CE00057F8010F0290B888ADF80C000DF10E00F6 -:102CF000FEF7F4FC58B1032090E7C00705D003208D -:102D0000ECE7C00701D0084688E70120E6E72888FD -:102D1000ADF810006888ADF81200A888ADF814006E -:102D2000E888ADF816000020ADF81800ADF81A00DC -:102D30000BA9684609F066FA00288BD1E08800F0FC -:102D4000A5F8040086D11320FEF704FB204665E7B2 -:102D500030B5054697B00C4608460FF029FD08B17E -:102D60001020E9E62846FEF759FB38B10178222900 -:102D700002D3807F800604D40820DDE643F20200FF -:102D8000DAE613208DF80000ADF802500BA9684672 -:102D900009F038FA0028E4D19DF932107F2901D0DA -:102DA0002170C9E60520C7E630B5054697B00C4648 -:102DB00008460FF0D9FC08B11020BDE62846FEF702 -:102DC0002DFB20B10078222804D20820B4E643F27B -:102DD0000200B1E62178E8B2890802D16178890859 -:102DE00001D00720A8E652218DF80010ADF80200AE -:102DF00020788DF8050060788DF80600207838B1CD -:102E00005FF000008DF80400617819B1002102E044 -:102E10000120F7E7022108438DF804000020ADF8F7 -:102E200008000BA9684609F0EDF985E630B5354D87 -:102E3000040008D0012C04D0022C06D0032C04D0AE -:102E4000FFDF2C7030BDFFDFFBE728780128F8D0CA -:102E5000FFDFF6E7418843F6FD730A1F9A4209D265 -:102E60008088042806D3B0F5804F03D8884201D863 -:102E700000207047072070470278520804D0012ACA -:102E800002D043F202207047FEF705BC10B548B1EE -:102E900083000022114607200FF086FB072801D08F -:102EA00003201EE400201CE470B50C0006460DD083 -:102EB000FEF7B4FA050000D1FFDFA6802889208143 -:102EC000288960816889A081A889E08170BD10B5DA -:102ED00002F0010282703122027009F093F9002899 -:102EE00000D0FFDF09E410B500231A4603E0845C3C -:102EF0002343521CD2B28A42F9D30BB10020D0E74F -:102F00000120CEE7B40100204FF0E0224FF4004151 -:102F10000020C2F880112049087020499002086002 -:102F2000704730B51C4D04462878A04218BF002CCD -:102F300002D0002818BFFFDF2878A04208BF30BDAC -:102F40002C701749154A0020ECB1164DDFF858C017 -:102F5000131F012C0DD0022C1CBFFFDF30BD0860F9 -:102F600003200860CCF800504FF400001060186097 -:102F700030BD086002200860CCF800504FF040706F -:102F80001060186030BD086008604FF0607010601D -:102F900030BD00B5FFDF00BD1A00002008F501407C -:102FA00000F50040FC02002014F50040094810B56F -:102FB00004680A49084808600EF091F8084804605F -:102FC00010BD0849002008604FF0E0210220C1F840 -:102FD0008002704710050240010000011805024000 -:102FE00014050240FC1F004010B50FF095FDFFF7DF -:102FF0008BFF0FF035FCBDE810400FF0E7BC7047C9 -:1030000018FFFFFFDBE5B151000002009000FFFF59 -:1030100084000000404B4C00FE48002101604160EC -:1030200070472DE9F743044692B091460120FFF71F -:1030300071F960680FF0DAFB58B160680FF0DFFBE0 -:1030400038B9607800F00300022802D10020FFF7B1 -:1030500061F94D4648460FF087FB18B1102015B0B6 -:10306000BDE8F08329460120FEF765FA0028F6D175 -:1030700001258DF842504FF4C050ADF840000022B9 -:1030800010A9284603F0B8FE0028E8D18DF8425078 -:103090004FF42850ADF8400000261C2168460796E2 -:1030A0001CF0B9FA9DF81C0007AF20F00F00401C7F -:1030B00020F0F00010308DF81C0020788DF81D00F5 -:1030C00061789DF81E000DF1400861F3420040F068 -:1030D00001008DF81E009DF8000008AA40F00200D3 -:1030E0008DF800002089ADF83000ADF832606089BD -:1030F000ADF834000B9760680E900AA9CDF82880CF -:10310000684603F078FC0028A9D1C24CBDF8200025 -:1031100008AA20808DF8425042F60120ADF8400008 -:103120009DF81E000AA920F00600801C20F0010076 -:103130008DF81E000220ADF83000ADF8340013A861 -:103140000E90684603F057FC002888D1BDF8200097 -:103150006080211D484600F032F9002887D18DF8A3 -:10316000425042F6A620ADF840001C216846079662 -:103170001CF051FA9DF81C00ADF8345020F00F00FF -:10318000401C20F0F00010308DF81C009DF81D0050 -:1031900008AA20F0FF008DF81D009DF81E000AA966 -:1031A00020F0060040F00100801C8DF81E009DF804 -:1031B00000008DF8445040F002008DF80000CDE989 -:1031C0000A8711A80E90ADF83050684603F013FC42 -:1031D000002899D1BDF82000E08000203FE73EB5EF -:1031E00004460820ADF8000020460FF0BDFA08B1F3 -:1031F00010203EBD21460120FEF79DF90028F8D1A0 -:103200002088ADF804006088ADF80600A088ADF80D -:103210000800E088ADF80A007E4801AB6A46808865 -:10322000002103F0E3FFBDF800100829E1D00320DE -:103230003EBD1FB50446002002900820ADF80800EE -:10324000CDF80CD020460FF08FFA10B1102004B04A -:1032500010BD704802AA81884FF6FF7004F09EF9F5 -:103260000028F4D1BDF80810082901D00320EEE7AA -:10327000BDF800102180BDF802106180BDF8041077 -:10328000A180BDF80610E180E1E701B582B002201F -:10329000ADF800005F4802AB6A464088002103F0A9 -:1032A000A5FFBDF80010022900D003200EBD1CB5FB -:1032B000002100910221ADF8001001900FF078FA82 -:1032C00008B110201CBD53486A4641884FF6FF7074 -:1032D00004F064F9BDF800100229F3D003201CBDEE -:1032E000FEB514460E460746FFF717F828B13046DC -:1032F0000FF03AFA18B11020FEBD0F20FEBDF82CD9 -:1033000001D90C20FEBD38460FF02EFA414D18BBF6 -:10331000288801A903F0F8F80028F3D138788DF84F -:103320000500288801A903F03FFF0028EAD100909A -:103330009DF800009DF8051040F002008DF8000097 -:10334000090703D040F008008DF80000288869467E -:1033500003F0C7FE0028D5D1ADF8084028883346D1 -:1033600002AA002103F042FFBDF80810A142C9D013 -:103370000320FEBD7CB50546002000900190088822 -:10338000ADF800000C46284601950FF02FFA18B949 -:1033900020460FF00DFA08B110207CBD15B1BDF824 -:1033A000000050B11B486A4601884FF6FF7004F0D8 -:1033B000F5F8BDF8001021807CBD0C207CBD30B537 -:1033C00093B0044600200D460090142101A81CF083 -:1033D00022F91C2108A81CF01EF99DF80000CDF868 -:1033E00008D020F00F00401C20F0F00010308DF8C5 -:1033F00000009DF8010020F0FF008DF801009DF80D -:10340000200040F002008DF8200001208DF84600D9 -:1034100002E000001200002042F60420ADF8440053 -:1034200011A801902088ADF83C006088ADF83E00FE -:10343000A088ADF84000E088ADF842009DF8020099 -:1034400006AA20F00600801C20F001008DF8020082 -:103450000820ADF80C00ADF810000FA8059001A9E8 -:1034600008A803F0C8FA002803D1BDF81800288086 -:10347000002013B030BD000010B504460FF074F901 -:1034800008B1102010BD2078C0F30210042807D81E -:103490006078072804D3A178102901D8814201D28D -:1034A000072010BDE078410706D421794A0703D4EC -:1034B000000701D4080701D5062010BD002010BD6B -:1034C00010B513785C08C37F64F30003C3771478E6 -:1034D000A40864F34103C3771078C309887863F3C1 -:1034E0004100887013781C094B7864F347134B70C4 -:1034F0001378DB0863F3000088705078487110BDC2 -:1035000010B5C4780B7864F300030B70C4786408BA -:1035100064F341030B70C478A40864F382030B7056 -:10352000C478E40864F3C3030B700379117863F380 -:103530000001117003795B0863F341011170037995 -:103540009B0863F3820111700079C00860F3C30126 -:10355000117010BD70B514460D46064604F0B1FE5C -:1035600080B10178142221F00F01891C21F0F001B3 -:10357000A03100F8081B21461BF0F9FFBDE87040A0 -:1035800004F0A2BE29463046BDE870401322FEF783 -:10359000F8B870B514460E46054604F092FE70B1B8 -:1035A000017821F00F01891C21F0F0012031017018 -:1035B000458021688160BDE8704004F085BE3146D9 -:1035C0002846BDE870401322FEF7DBB810B5FE4C6C -:1035D00094F8300000280CD104F120014FF6FF725E -:1035E000A1F110000CF0B5FE00B1FFDF012084F85E -:1035F000300010BD2DE9F047064608A8894690E83E -:1036000030041F469046142128461CF004F800217F -:10361000CAF80010B8F1000F03D0B9F1000F03D1C0 -:1036200014E03878C00711D020680FF0C1F8E8BB6B -:10363000B8F1000F07D120681230286020681430DC -:1036400068602068A8602168CAF800103878800790 -:1036500028D560680FF0CAF840BBB9F1000F2DD033 -:10366000FEF755FE0168C6F8B4118188A6F8B811B6 -:10367000807986F8BA01FFF7A9FFDFF84C8308F1DB -:103680002008C5F80C80626862B196F8B40106F2B1 -:10369000B51140081032FEF74FF81022414660681D -:1036A0001BF020FF3878400712D500E003E0A06847 -:1036B0000FF07EF850B11020BDE8F0876068002858 -:1036C000F9D0E8606068C6F8B001EBE7A06828614F -:1036D0000020F1E730B5054608780C4620F00F00D1 -:1036E000401C20F0F001103121700020607095F82E -:1036F000230030B104280FD0052811D0062814D09B -:10370000FFDF20780121B1EB101F04D295F82000D3 -:1037100000F01F00607030BD21F0F000203002E0AA -:1037200021F0F00030302070EBE721F0F000403065 -:10373000F9E710B510B190F8A94044B1A24890F84B -:10374000354000205CB108601060186010BD00F1C9 -:10375000A8040C6000F1D001F8301160F5E79A4C34 -:1037600034340C60F0E700B58BB00723CDE90212CA -:103770008DF801300191944900236431059109933A -:1037800001468DF8103068460CF0BBFD002800D0D3 -:10379000FFDF0BB000BD30B597B00C462C251A9951 -:1037A0008DF80050ADF80200B3B118680190586868 -:1037B0000290ADF80C2010220DF10E001BF092FECD -:1037C0000BA9684608F01EFD002803D1A17F41F037 -:1037D0001001A17717B030BD00200190E8E72DE976 -:1037E000F0470646008A8CB080B20D468246FDF74F -:1037F00015FE0446744F3078283FDFF8CC814FF037 -:103800000009122873D2DFE800F072E93509367733 -:103810007E98A8F3E7E6E5E4E35BE3E3A07F00F04E -:103820000300012806D0002150460BF054F9050092 -:1038300003D101E00121F7E7FFDF98F85C100906EA -:1038400002D5D8F860000BE0032105F121000EF04D -:1038500037FCD5F821005D49B0FBF1F201FB120005 -:10386000C5F8210070686866B068A86620782528C9 -:1038700000D0FFDFECE0A07F00F00300012806D0BD -:10388000002150460BF027F9060003D101E0012189 -:10389000F7E7FFDF7078810702D52178252904D06A -:1038A00040F0010070700CB006E70220287096F816 -:1038B0002000287106F121003136C5E90206F2E741 -:1038C000A07F00F00300012806D0002150460BF035 -:1038D00002F9040003D101E00121F7E7FFDF60787E -:1038E000C10605D51320287041346C60DBE7CEE1BA -:1038F00040F008006070D6E73348082128380EF001 -:10390000DFFB032016E02A208DF8000010220DF1C5 -:10391000020071681BF0E6FD10220DF11200B16883 -:103920001BF0E0FD284968462C3908F06BFC00B11B -:10393000FFDF042028706F60B5E7E07FC00600D588 -:10394000FFDFB0680090B38806220321504605F0DF -:1039500002FA0028A7D0FFDFA5E704B9FFDF7168EE -:1039600021B1102204F124001BF0BCFD28212046C7 -:10397000FDF78CFDA07F00F0030002280ED104F1BA -:103980002400002300901A4621465046FFF703FF0B -:10399000112807D029212046FDF778FD307A84F8D8 -:1039A000200080E7A07F000700D5FFDF14F81E0F7E -:1039B00040F008002070A4F81690C4F81890C4F8DD -:1039C0001C90617808460AE0F401002040420F0094 -:1039D00030E058E196E08CE062E009E03FE061F31E -:1039E0008200410861F3C3006070307AE0705AE7EA -:1039F000A07F00F00300012806D0002150460BF004 -:103A00006AF8040003D101E00121F7E7FFDF02219A -:103A100004F175000EF054FB1020287004F5DA70E4 -:103A20006860B4F875002882FE486C346C61C5E9A2 -:103A3000028038E7A07F00F00300012805D00021B4 -:103A400050460BF048F818B901E00121F8E7FFDF14 -:103A50000CB0324621465046BDE8F0477AE504B93D -:103A6000FFDF207821289CD93079012802D0022854 -:103A70000AD103E0E07F40F01000E07798F85C1096 -:103A800041F0010188F85C10324621465046FFF7AC -:103A900061FD0CB02046BDE8F0472321FDF7F6BCE0 -:103AA000327901230321504605F004F878B1112042 -:103AB0002870327905F10800AA80031D00900321C7 -:103AC000504605F074F8002891D0FFDFEBE6A07FA8 -:103AD00000F00300012806D0002150460AF0FBFF49 -:103AE000040003D101E00121F7E7FFDF3079207006 -:103AF000D9E60321504605F0CFFB002899D11220CA -:103B00002870D0E6A07F00F00300012806D0002135 -:103B100050460AF0E0FF050003D101E00121F7E77C -:103B2000FFDF95F8740000F00300012878D1A07F32 -:103B300000F00307E07FC0F3400616B1012F04D068 -:103B40002BE095F89000C0072AD0D5F8AC1119B336 -:103B500095F87320087C62F387000874E27FD5F83B -:103B6000AC1162F341000874D5F8AC1166F30000A3 -:103B70000874AEB1D5F8AC01102204F124017835F7 -:103B80001BF0B0FC287E40F001002876287820F059 -:103B9000010005F8780900E016B1022F04D02CE0EE -:103BA00095F87800C00726D0D5F8A81119B395F874 -:103BB0007320087C62F387000874E27FD5F8A811AF -:103BC00062F341000874D5F8A81166F30000087488 -:103BD0008EB1D5F8A801102204F1240178351BF02C -:103BE00081FC287840F0010005F8180B287820F0B7 -:103BF000010005F89009022F41D0002000EB4000A1 -:103C000005EBC00090F87800800709D595F86C00A6 -:103C1000D5F8B021400805F16D011032FDF78CFD9B -:103C200005208DF8000015F8740F6A4600F00300B7 -:103C30008DF8010028798DF80200287F8DF80300A7 -:103C400021465046FFF7A5FC2078252805D02128DD -:103C500007D0FFDF2078222803D922212046FDF754 -:103C600015FCA07F00F0030001280AD00021504677 -:103C70000AF043FF00283FF422AEFFDF13E60120E5 -:103C8000BCE70121F3E7716881F801900BE6FFDFE3 -:103C900009E670B5634C0025103C14F85C0F20F069 -:103CA0008000207065600CF0F4FA5E49A1F110000C -:103CB00004F099FA04F82C5C0620607259487C30B4 -:103CC00020615030A0611030E06170BD70B50D46CC -:103CD000FDF7A4FB040000D1FFDF4FF4DE7128469E -:103CE0001BF099FC4F485430686104F124002861AE -:103CF000A07F00F00300012808D0022105F5907094 -:103D00000CF0C8FA002800D0FFDF70BD0121F5E7F4 -:103D10000A46014602F590700CF0DCBA70B5054613 -:103D200040689CB0017808290DD00B2903D00C29DC -:103D300036D101218171686886883046FDF76EFBB7 -:103D4000040033D131E046883046FDF767FB0400BC -:103D500000D1FFDF2078212822D0282822D16868CE -:103D600002210C3001F0B2F9E0B168680821001DB1 -:103D700001F0ACF9B0B12D208DF80000ADF8026073 -:103D8000102204F1240101A81BF0ACFB0BA968462A -:103D900008F038FA00B1FFDF29212046FDF776FB55 -:103DA0001CB070BD04F090FAFAE7FFDFA07F00F0CE -:103DB0000301022902D120F01000A07720782128E9 -:103DC0000AD06868817909B1807880B1A07F00F05D -:103DD0000300022859D0FFDFA07F00F00300022873 -:103DE000DED1FDF70DFD0028DAD0FFDFD8E704F0C3 -:103DF0006BFAE07FC10723D0800701D5062000E0E1 -:103E0000052084F82300207829281BD02428E3D11A -:103E1000314606200EF065FC22212046FDF736FBD8 -:103E2000A07F01E00402002000F0030001282AD056 -:103E3000002130460AF061FE0028CDD0FFDFCBE73D -:103E40000420DEE7A07F00F00300012806D0002157 -:103E500030460AF040FE050003D101E00121F7E7FA -:103E6000FFDF25212046FDF711FB0F208DF85800BC -:103E700016A905F590700CF024FA0228ACD00028A1 -:103E8000AAD0FFDFA8E70121D3E704F01DFAA3E7DA -:103E90002DE9F0438BB09946154688460646FDF756 -:103EA000BDFA04004ED0207822284BD3232849D0D5 -:103EB000E07FC00646D4A07F00F00300012806D0B2 -:103EC000002130460AF007FE070002D00BE0012176 -:103ED000F7E7A07F00F00300012804D1012130465C -:103EE0000AF0F0FD074601AB02AA03A93846FFF726 -:103EF00020FC039800B9FFDF4FB1039807F59077D6 -:103F000087612078222806D0242804D007E003996E -:103F10000020886103E025212046FDF7B7FA0398C9 -:103F20000B21417046628580C0E9028902990161D6 -:103F30000199416104A90CF0E4F9022802D000289B -:103F400000D0FFDF0BB0BDE8F08330B587B0054689 -:103F5000FDF764FA017822292FD9807F00F0030051 -:103F6000012806D0002128460AF0B5FD040003D13F -:103F700001E00121F7E7FFDF227801230321284632 -:103F800004F098FD002818D011208DF80400227844 -:103F900003A80090ADF8082004AB0321284604F0E4 -:103FA00006FE00B1FFDF01A904F590700CF089F95D -:103FB000022802D0002800D0FFDF07B030BD10B5C6 -:103FC00086B00446FDF72AFA0178222919D9807FA4 -:103FD00000F00300012806D0002120460AF07BFDF6 -:103FE000040003D101E00121F7E7FFDF12208DF883 -:103FF0000000694604F590700CF063F9002800D0C9 -:10400000FFDF06B010BD2DE9F05F05460C46002726 -:104010000078904601093E46BB4604F1080A022991 -:104020007ED0072902D00A2909D142E068680178C8 -:10403000082905D00B292CD00C292AD0FFDFC6E196 -:1040400014271C26002C6CD04088A080FDF7E6F9D0 -:104050005FEA000900D1FFDF99F8170052464008D7 -:1040600009F11801FDF768FB68688089208268689B -:104070004168C4F812108068C4F81600A07E20F0D1 -:10408000060040F00100A07699F81E0040F04001C3 -:104090004DE01A270A26002CD5D08088A080FDF795 -:1040A000BDF9050000D1FFDF51462846FFF712FB9E -:1040B0008DE10CB1288BA080287A0E287ED006DCFA -:1040C00001287CD0022808D0032804D135E010282C -:1040D00076D0112875D0FFDF79E11E270926002C44 -:1040E000B1D0A088FDF79AF95FEA000900D1FFDF9F -:1040F000287B00F003000128207A1BD020F001006B -:104100002072297B890861F341002072297BC9084C -:1041100061F382002072297B090961F3C30001E089 -:104120004AE117E1207299F81E0040F0800189F8F9 -:104130001E104CE140F00100E2E713270D26002C91 -:10414000AAD0A088FDF76AF98146807F00F00300BD -:10415000012806D00021A0880AF0BDFC050003D18B -:1041600001E00121F7E7FFDF99F81E0000F00302EC -:10417000012A59D0A86E817801F003010129217A22 -:1041800054D021F00101217283789B0863F341012F -:1041900021728378DB0863F38201217283781B0923 -:1041A00063F3C3012172037863F30611217243782C -:1041B00063F3C711217284F809B003E05EE0A4E064 -:1041C0008CE09CE0C178A172012A32D04279E17A78 -:1041D00062F30001E1724279520862F34101E17237 -:1041E0004279920862F38201E1724279D20862F365 -:1041F000C301E1720279217B62F30001217302792C -:10420000520862F3410121730279920862F382013C -:1042100021730079C00860F3C301217399F800008D -:1042200023285AD9262168E0686EA4E741F00101ED -:10423000A9E70279E17A62F30001E172027952089A -:1042400062F34101E1720279920862F38201E17244 -:104250000279D20862F3C301E1724279217B62F3F1 -:10426000000121734279520862F3410121734279BE -:10427000920862F3820121734079CBE71827102658 -:10428000002C67D0A088FDF7C9F88246807F00F037 -:104290000300012807D00021A0880AF01CFC5FEA77 -:1042A000000903D101E00121F6E7FFDFE868A06023 -:1042B00099F8010040F0040189F8011099F8020012 -:1042C000800708D5012020739AF8000023287ED9A2 -:1042D0002721504663E084F80CB078E015270F26BC -:1042E000C4B3A088FDF79AF8814606225146E868D3 -:1042F00007F0F0FF0120A073AEE048464FE016271C -:1043000009263CB3287B207261E0297BFE48022904 -:104310000CD019270E26ECB101290DD003291AD093 -:1043200004291BD0052919D0FFDF23E01B2709260C -:10433000BCB30121217205E001212172617A21F0D3 -:104340000301617210F85C1F4A08520062F3060113 -:1043500001700FE02BE00220207207E0687B052946 -:1043600000F00F0040F0800020721BD0607A20F037 -:1043700003006072A088FDF751F8054600782128F7 -:1043800025D0232800D0FFDFA87F00F003000128FC -:1043900010D00021A0880AF0B0FB22212846FDF7AA -:1043A00075F814E0607A20F00300401CE1E7A8F8FB -:1043B000006011E00121EDE70CB16888A080287A47 -:1043C00003282BD004280AD005284BD0FFDFA8F8FB -:1043D00000600CB1278066800020BDE8F09F1527A3 -:1043E0000F26002CE3D0A088FDF718F8807F00F09E -:1043F0000300012806D00021A0880AF06CFB05000C -:1044000003D101E00121F7E7FFDFD5F82100062203 -:10441000514607F05FFF84F80EB0D8E7172709264A -:10442000002CC4D0A088FCF7F9FF8146807F00F003 -:104430000300012806D00021A0880AF04CFB0500EB -:1044400003D101E00121F7E7FFDFA878800701D55C -:10445000022000E00120207299F800002328B6D93C -:1044600027214AE719270E26002CA0D0A088FCF7A8 -:10447000D5FF5FEA000900D1FFDFC4F808B0A4F857 -:104480000CB084F808B0A07A40F00300A07299F84C -:104490001F1061F38200A07299F81F1001EA510108 -:1044A00061F3C300A072687A00F0030001288ED186 -:1044B000607A40F00400607299F81E00E97A00F01A -:1044C0000300012813D0607B61F300006073AA7AB7 -:1044D000217B62F300012173EA7A520862F3410002 -:1044E0006073A87A400860F3410121736FE7207B75 -:1044F00061F300002073AA7A617B62F300016173AB -:10450000EA7A520862F341002073A87A400860F307 -:10451000410161735BE710B57B4C30B1014610225D -:1045200004F120001AF0DEFF012084F8300010BDF5 -:1045300010B50446FFF74AF8734920461022BDE83B -:10454000104020311AF0CEBF70B56F4C06004FF00E -:10455000000514D00EF008F908B110250DE0062171 -:10456000304607F09EFE411C06D0206614F85C0F12 -:1045700040F08000207000E00725284670BD14F848 -:104580005C0F20F08000F5E7007810F00F0204D0F7 -:10459000012A05D0022A0CD110E0000909D10AE055 -:1045A0000009012807D0022805D0032803D00428D9 -:1045B00001D0072070470870002070470620704720 -:1045C00005282AD2DFE800F003070F171F0008783C -:1045D00020F0FF001EE0087820F00F00401C20F0C3 -:1045E000F000103016E0087820F00F00401C20F09A -:1045F000F00020300EE0087820F00F00401C20F082 -:10460000F000303006E0087820F00F00401C20F069 -:10461000F0004030087000207047072070472DE9F7 -:10462000F041804688B00D46002708460EF0E7F8B6 -:10463000A8B94046FCF7F2FE040003D020782228F7 -:1046400015D104E043F2020008B0BDE8F08145B99D -:10465000A07F010603D500F00300022801D010203E -:10466000F2E7A07FC10601D4010702D50DB10820F1 -:10467000EAE7254991F85C10C90701D01120E3E76A -:10468000E17FC90601D50D20DEE700F00300022816 -:1046900005D125B12846FEF7EFFE0700D4D1A07F53 -:1046A00000F00300012806D0002140460AF013FA6A -:1046B000060002D00CE00121F7E7A07F00F0030024 -:1046C00001280BD0002140460AF0FCF9060007D073 -:1046D000A07F00F00300022804D009E00121F2E7E6 -:1046E0000420B1E725B12A4631462046FEF7E8FE10 -:1046F00007AB1A4669463046FFF71BF8009800B929 -:10470000FFDF0C20009901E0F4010020487006F55D -:104710009070C1F82480486100200881A07F00F0DB -:104720000300012828D0EDB302200871301D8861F4 -:10473000707840090877B078C0F34000487728784F -:1047400000F00102887F62F301008877E27F62F364 -:1047500082008877E27F520862F3C3008877B278DC -:1047600062F304108877A878C87701F121022846FF -:104770002031FEF7C5FE22E001200871287800F004 -:104780000102087E62F3010008762A78520862F37B -:10479000820008762A78920862F3C30008762A78A5 -:1047A000D20800E007E062F30410087624212046D6 -:1047B000FCF76CFE0BE0032008710520087625212C -:1047C0002046FCF763FEA07F20F08000A07701A9BF -:1047D00000980BF096FD022801D000B1FFDF3846AB -:1047E00032E72DE9FF4FF94A0D4699B09A4607CABC -:1047F00014AB002783E807001998FCF70FFE0600AA -:1048000006D03078262806D008201DB0BDE8F08FED -:1048100043F20200F9E7B07F00F00309B9F1010F9C -:1048200003D0B9F1020F07D008E03DB91B98FEF79D -:1048300023FE0028E9D101E01B9878BBB07F00F08F -:104840000300012806D0002119980AF044F9040059 -:1048500003D101E00121F7E7FFDF852D25D007DC3B -:10486000D5B1812D1BD0822D1BD0832D08D11AE00C -:10487000862D1CD0882D1CD0892D1CD08A2D1CD0B3 -:104880000F2020710F281AD001208DF83400201D30 -:104890000E902079A8B158E10020F2E70FE0012046 -:1048A000EFE70220EDE70320EBE70520E9E706202C -:1048B000E7E70820E5E70920E3E70A20E1E707202A -:1048C000A3E7B9F1010F17D0D4E9195080460220AF -:1048D000019001200090A87898F80210C0F3C00061 -:1048E000C1F3C00108405FEA000B5DD050460DF0F7 -:1048F0003BFF00286CD12DE0D4E9198501200190FF -:1049000002200090214630461B9AFEF7D9FD1B98E5 -:10491000007800F00101A87861F30100A870F17F30 -:1049200061F38200A870F17F490861F3C300A870A9 -:10493000A17861F30410A870607840092870A0780D -:10494000C0F3400068701B988078E87000206871A0 -:104950002871C0E7DAF80C000DF006FFC0BBDAF8EA -:104960001C000DF001FF98BBDAF80C00A060DAF82B -:104970001C00E06098F80100A17800F0010041EA15 -:104980004000A07098F80210C0B2C1F30011891E57 -:104990000840A070002084F82000009906F117005C -:1049A00002290BD001210AE098F80110A07801F04B -:1049B0000101FD2242EA41010840E2E7002104EB47 -:1049C000810188610199701C022902D0012101E056 -:1049D00028E0002104EB81018861A87800F0030041 -:1049E000012849D198F8020000F00300012843D1C2 -:1049F000B9F1010F04D12A1D691D1B98FEF780FD36 -:104A0000297998F8040001408DF82C10687998F8FD -:104A1000052010408DF8300001432DD050460DF098 -:104A2000A3FE08B11020F0E60AF1100004F5D471DD -:104A300004F17C020490B9F1020F3CD00090CDE962 -:104A4000012100210BAB5A462046FEF7D3FD00287A -:104A5000E9D104F5D67104F19402B9F1010F30D017 -:104A600004980090CDE9012100210CAB5A46204664 -:104A7000FEF7C0FD0028D6D1A078800740D4A878E2 -:104A800098F80210C0F38000C1F38001084337D0CA -:104A9000297898F8000014AAB9F1010F17D032F85C -:104AA00010204B00DA4012F0030718D0012F1ED05F -:104AB000022F12D11DE0CDF800A0CDE90121012186 -:104AC000C0E7CDF800A0CDE901210121CDE732F802 -:104AD00011204300DA4002F00307032F07D0BBF197 -:104AE000000F0DD0012906D0042904D008E00227C8 -:104AF000F5E70127F3E7012801D0042800D10427B6 -:104B0000F07F40F001006BF34100F077A07881075F -:104B10004FF003000CD5A071BBF1000F15D100BF01 -:104B20008DF85C0017AA31461998FEF732FD0CE0AB -:104B30000221022F18D0012F18D0042F22D00020DC -:104B4000A071F07F20F00100F07725213046FCF7BE -:104B50009DFC0DA904F590700BF0B3FB10B1022879 -:104B600000D0FFDF002050E6A171D9E7A1710D212F -:104B700004F124001AF04FFD607840F002006070EC -:104B80000420CDE70120A071DFE72DE9F04387B0D5 -:104B9000914688460446FCF741FC070006D0387869 -:104BA000272806D0082007B0BDE8F08343F20200B2 -:104BB000F9E7B87F00F00300012809D00021204662 -:104BC00009F089FF040006D104E000009CF901000F -:104BD0000121F4E7FFDFA679012E08D0B8F1000F1C -:104BE0000FD048460DF0C0FDB8B11020DBE7B9F199 -:104BF000000F25D1B8F1000F09D0B8F1010F1FD176 -:104C000020E0022E05D0032E05D0FFDF28E00C2582 -:104C100026E0012524E0022522E0B8F1020F03D0AE -:104C2000B8F1010F0AD00BE0032E09D100251022A4 -:104C3000494604F121001AF055FC11E0022E01D082 -:104C40000720B0E70025102104F121001AF0C1FC73 -:104C50005FEA090004D0062107F023FBC4F8210015 -:104C60006078252140F0020060703846FCF70EFCA9 -:104C70006078C10713D020F00100607002208DF829 -:104C8000000004F1210002908DF804506946FF30C5 -:104C90000BF017FB022804D018B1FFDF01E084F805 -:104CA000205000207FE730B587B00D460446FCF762 -:104CB000B5FB88B1807F00F0030001280FD00021F0 -:104CC000204609F008FF04000ED028460DF04CFDE8 -:104CD00038B1102007B030BD43F20200FAE70121DD -:104CE000EEE76078400701D40820F3E7294604F195 -:104CF0004100202205461AF0F5FB607840F01000D4 -:104D0000607001070FD520F00800607013208DF847 -:104D10000000694604F5907001950BF0D2FA022864 -:104D200001D000B1FFDF0020D4E770B592B00D468E -:104D30000646FCF773FB18B10178272940D103E040 -:104D400043F2020012B070BD807F00F00300012822 -:104D500006D00021304609F0BEFE040003D101E078 -:104D60000121F7E7FFDFA079022829D1A078C00749 -:104D700026D0002302220321304603F09BFE08B315 -:104D80000C208DF805000A9604A804F59074022200 -:104D900000900694ADF80C2005AB0321304603F0DB -:104DA00006FF00B1FFDF04208DF808008DF81C50CD -:104DB0000BA901A80BF0A5FA00B1FFDF0020C1E7A5 -:104DC0000820BFE71120BDE770B5064686B014463F -:104DD0000D4608460DF0C8FC18B920460DF0E8FC59 -:104DE00010B1102006B070BDA6F57F40FF380ED080 -:104DF0003046FCF713FB38B1417822464B08811C42 -:104E00001846FCF799FC07E043F20200EAE7204667 -:104E1000FDF7EAFA0028E5D11021E01D0DF050F968 -:104E2000E21D29466846FEF79EFC102204F1170099 -:104E300001991AF057FB0020D4E72DE9F041044610 -:104E400090B015468846002708460DF0D8FC18B9E2 -:104E500028460DF0D4FC18B1102010B0BDE8F08148 -:104E60002046FCF7DBFA060003D03078272818D15B -:104E700002E043F20200F0E7B07F00F003000128F7 -:104E800006D00021204609F026FE040003D101E0EF -:104E90000121F7E7FFDF6078400702D5A07880079F -:104EA00001D40820D9E7B07F00F00300012818D012 -:104EB000D4E91901407800B1B5B1487810B1B8F122 -:104EC000000F11D0C5B1EA1D02A8E168FEF74BFC46 -:104ED000102205F1170003991AF0D8FA30B104270F -:104EE0000AE0D4E91910E5E70720B6E71022E91D2A -:104EF00004F131001AF0F6FAB8F1000F06D01022D2 -:104F000008F1070104F121001AF0ECFA607825217C -:104F100040F0020060703046FCF7B8FA6078C107D4 -:104F200015D020F00100607002208DF8200004F1FF -:104F300021000A9010300B908DF8247008A9EF30F2 -:104F40000BF0BFF9022804D018B1FFDF01E084F8AC -:104F50002070002081E7F8B515460E460746FCF79D -:104F60005DFA040004D02078222804D00820F8BD7F -:104F700043F20200F8BDA07F00F00300022802D037 -:104F800043F20500F8BD30460DF0EEFB18B9284697 -:104F90000DF0EAFB08B11020F8BD00953288B31C73 -:104FA00021463846FEF7F7FB112814D00028F3D12C -:104FB000297C4A08E17F62F30001E1772A7C62F3F1 -:104FC0004101E177297C890884F82010A17F21F034 -:104FD0008001A177F8BDA17F0907FBD4D6F80200B4 -:104FE000C4F83600D6F80600C4F83A003088A08627 -:104FF0001022294604F124001AF074FA287C410892 -:10500000E07F61F38200E077297C61F3C300E07701 -:10501000287C800884F82100A07F40F00800A07759 -:105020000020D3E770B596B00D46064613B10720B1 -:1050300016B070BDFCF7F2F9040007D020782228E2 -:1050400002D3A07F400604D40820F1E743F2020017 -:10505000EEE7C5B12D208DF80000ADF802601022FA -:10506000294601A81AF03EFA287C4108E07F61F346 -:105070000000E077297C61F34100E077287C80081C -:1050800084F8200004E02E208DF80000ADF80260C6 -:105090000BA9684607F0B6F8A17F21F04001A1777F -:1050A000C6E770B50D46FCF7B9F9040005D02846EF -:1050B0000DF07EFB20B1102070BD43F2020070BDE8 -:1050C00029462046FEF706FB002070BD05E000BF24 -:1050D00010F8012B0AB100207047491E89B2F7D29F -:1050E00001207047F0B50078059F1E4614460D4616 -:1050F000012800D0FFDF0C2030803A203880002CBF -:1051000008D0287A052806D0287B012800D0FFDFA8 -:1051100017206081F0BDA889FBE72DE9F04786B034 -:10512000144691F80C900E9A0D46B9F1010F0BD070 -:10513000102100782E8A8846052807D0062833D00B -:10514000FFDF06B0BDE8F0870221F2E7E8890C2115 -:1051500000EB400001EB4000188033201080002C51 -:10516000EFD0E889608100271AE00096688808F18E -:10517000020301AA696900F06FFE06EB0800801CBB -:1051800007EB470186B204EB4102BDF804009081B1 -:105190000DF1060140460E320BF054F97F1CBFB2F0 -:1051A0006089B842E1D8CCE734201080E889B9F1B1 -:1051B000010F11D0122148430E301880002CC0D0AE -:1051C000E88960814846B9F1010F00D002202073C0 -:1051D00000270DF1040A1FE00621ECE7009668881D -:1051E00008F1020301AA696900F036FE06EB080027 -:1051F000801C86B2B9F1010F12D007EBC70004EB97 -:105200004000BDF80410C18110220AF102011030E3 -:105210001AF068F97F1CBFB26089B842DED890E707 -:1052200007EB470104EB4102BDF80400D0810AF10D -:105230000201404610320BF005F9EBE72DE9F0478B -:105240000E4688B090F800C096F80C80378AF58931 -:105250000C20109902F10C044FF0000ABCF1030F6E -:1052600008D0BCF1040F3ED0BCF1070F7DD0FFDFAA -:1052700008B067E705EB850C00EB4C001880312087 -:105280000880002AF4D0A8F1060000F0FF0955813B -:1052900025E0182101A81AF0BEF90097708843464E -:1052A00001AA716900F0D8FDBDF804002080BDF8A6 -:1052B0000600E080BDF808002081A21C0DF10A0163 -:1052C00048460BF0BFF8B9F1000F00D018B184F8D0 -:1052D00004A0A4F802A007EB080087B20A346D1EF0 -:1052E000ADB2D6D2C4E705EB850C00EB4C001880BC -:1052F00032200880002ABBD0A8F1050000F0FF0989 -:10530000558137E000977088434601AA716900F023 -:10531000A3FD9DF80600BDF80410E1802179420844 -:1053200060F3000162F34101820862F38201C20866 -:1053300062F3C301020962F30411420962F34511E9 -:10534000820962F386112171C0096071BDF80700FE -:10535000208122460DF1090148460BF073F818B17F -:1053600084F802A0A4F800A000E007E007EB080022 -:1053700087B20A346D1EADB2C4D279E7A8F102003B -:1053800084B205FB08F000F10E0CA3F800C0352331 -:105390000B80002AA6D055819481009783B2708833 -:1053A0000E32716900F058FD62E72DE9F84F1E4694 -:1053B0000A9D0C4681462AB1607A00F58070D08043 -:1053C000E089108199F800000C274FF000084FF099 -:1053D0000E0A0D2873D2DFE800F09E070E1C28305D -:1053E0003846556A73737300214648460095FFF7A7 -:1053F00079FEBDE8F88F207B9146082802D003286B -:1054000000D0FFDF378030200AE000BFA9F80A8013 -:10541000EFE7207B9146042800D0FFDF3780312062 -:105420002880B9F1000FF1D1E3E7207B91460428F1 -:1054300000D0FFDF37803220F2E7207B9146022840 -:1054400000D0FFDF37803320EAE7207B17460228B1 -:1054500000D0FFDF3420A6F800A02880002FC8D09D -:10546000A7F80A80C5E7207B1746042800D0FFDF95 -:105470003520A6F800A02880002FBAD04046A7F813 -:105480000A8012E0207B1746052802D0062800D0AB -:10549000FFDF1020308036202880002FA9D0E0893F -:1054A0007881A7F80E80B9F80200B881A1E7207BC7 -:1054B0009146072800D0FFDF37803720B0E72AE089 -:1054C0004FF0120018804FF038001700288090D05D -:1054D000E0897881A7F80E80A7F8108099F800007D -:1054E0000A2805D00B2809D00C280DD0FFDF80E753 -:1054F000207B0C2800D0FFDF01200AE0207B0D2854 -:1055000000D0FFDF042004E0207B0E2800D0FFDF66 -:10551000052038736DE7FFDF6BE770B50C46054675 -:10552000FBF77CFF20B10078222804D2082070BD50 -:1055300043F2020070BD0521284609F0CCFA206034 -:1055400008B1002070BD032070BDFFB585B00746CF -:10555000089814460D46022628B908A93846FFF7D0 -:10556000DCFF002840D108980121801D04F093FD44 -:10557000ADF8080002464DB100233146384603F02D -:1055800099FA98B30898007880BB05E0207809283C -:1055900020D00F282BD0FFDF03A8009004ABBDF86C -:1055A00008203146384603F002FB00281CD1089839 -:1055B00002A9801D60606780DDE90332204604F0A7 -:1055C00077FD40B3072824D2DFE800F01A18232320 -:1055D000211C1E00072600233146384603F06AFAD4 -:1055E0000028D9D143F2040009B0F0BD06E0002341 -:1055F0003146384603F05EFA0028CDD11120F3E79A -:105600000020F1E70820EFE743F20300ECE7072072 -:10561000EAE70320E8E703980090BDF80830042289 -:105620003146384603F097FB0028DDD1002DDBD052 -:1056300008990D70D8E710B586B01C46AAB10423AE -:105640008DF800301388ADF808305288ADF80A2084 -:105650008A788DF80E200988ADF80C1000236A4670 -:105660002146FFF772FF06B010BD1020FBE770B5B2 -:105670000D46052109F02FFA040000D1FFDF29466D -:10568000A01DBDE8704004F0EFBC70B596B00C46AC -:105690000646FFF7ECFF05462146304601F0CFFDF8 -:1056A0000121304601F0E9FD002D25D13046FBF700 -:1056B000B5FE050000D1FFDF95F822001B281BD99D -:1056C000172C19D93A208DF80000ADF8026095F832 -:1056D0002200211D884201D9241D00E00446ADF8B6 -:1056E000044040F64800ADF806000BA9684606F0F5 -:1056F00089FD002800D0FFDF16B070BD2DE9F8430A -:105700000D468046002602F0DCFD0446287812286B -:1057100078D2DFE800F07753533C355532321332FC -:1057200032320932323232322879001FC0B20228B6 -:1057300001D0102810D114BBFFDF34E004B9FFDF23 -:105740000521404609F0C7F90078032806D004284F -:105750000BD0072827D0FFDF072654E02879801FC9 -:10576000C0B202281FD050B1F6E72879401FC0B25E -:10577000022818D0102816D0EEE704B9FFDF12E097 -:1057800004B9FFDF287901280DD1172136E0052162 -:10579000404609F0A0F9070000D1FFDFB91D4046DF -:1057A00004F03BFC2CB12A462146404600F064FB45 -:1057B00029E013214046FDF793F924E0FFDF22E0C2 -:1057C00004B9FFDF0521404609F085F9070000D143 -:1057D000FFDF6946B81D04F028FC00B1FFDFA9888F -:1057E000172901D2172200E00A46BDF800008242C4 -:1057F00002D9014602E005E01729C6D34046FFF76B -:1058000044FFD0E7FFDF3046BDE8F8830020087092 -:10581000881D04F0F6BB891D04F006BC70B5054672 -:10582000052109F058F9040000D1FFDFA11D284629 -:10583000BDE8704004F0F1BB2DE9F74F90B04FF098 -:10584000000AADF830A0ADF804A047880C46054624 -:105850000521384609F03FF9060000D1FFDF24B1E9 -:10586000A780A4F806A0A4F808A0297A04F11000E3 -:105870003827C91E4FF00C0B4FF001084FF01209EA -:1058800002900F297ED2DFE801F0F2F1F08008D318 -:10589000898EA03DDCF3EEB7B7003078022800D047 -:1058A000FFDFA8890BEBC001ADF804103021ADF883 -:1058B0003010002C25D06081B5F80E8000271DE047 -:1058C00004EBC709317989F80E107188A9F80C101A -:1058D000CDF800806888042305AA296900F0BCFA85 -:1058E000BDF81410A9F8101008F10400BDF8161046 -:1058F0007F1C1FFA80F8A9F81210BFB26089B84265 -:10590000DED809E13078022800D0FFDFE9890BEB0F -:10591000C100ADF804003020ADF8300095F80CB0AF -:10592000002CABF10400C0B20F90EAD06181B5F851 -:105930001090002723E000BFCDF8009068885B46F8 -:1059400003AA696900F088FA09EB0B001FFA80F9D5 -:1059500004EBC70808F10C0204A90F980AF072FDC5 -:1059600018B188F80EA0A8F80CA0BDF80C10A8F883 -:105970001010BDF80E107F1CA8F81210BFB260897D -:10598000B84200E0C7E0D7D8C6E00CA8009001AB51 -:10599000224629463046FFF7C0FBBDE03078082894 -:1059A00005D0FFDF03E03078082800D0FFDFE8896A -:1059B0001030ADF804003620ADF83000002C3FD098 -:1059C000A98961817188A18127E03078092800D0F8 -:1059D000FFDFA88900F10C01ADF804103721ADF804 -:1059E0003010002C2CD06081E8890090AB89688849 -:1059F00004F10C02296955E0E8893921103080B2A0 -:105A0000ADF80400ADF83010002C72D0A989618186 -:105A1000287A10280AD002212173E989E181288A95 -:105A20000090EB8968886969029A3BE00121F3E7FD -:105A30000CA8009001AB224629463046FFF7FEFB3A -:105A40006AE030780A2800D0FFDFADF80490ADF8A6 -:105A500030704CB3A9896181A4F810A0A4F80EA0FD -:105A600084F80C8058E020E002E030E038E041E0CB -:105A700030780B2800D0FFDF288AADF83070123064 -:105A8000ADF8040084B104212173A9896181E989F9 -:105A9000E181298A2182688A00902B8A688804F132 -:105AA0001202696900F0D8F936E030780C2800D08D -:105AB000FFDFADF80490ADF8307044B305212173D9 -:105AC000A4F80AA0A4F80EA0A4F810A024E00CA842 -:105AD000009001AB224629463046FFF703FB1BE04E -:105AE0000CA8009001AB224629463046FFF75DFC2A -:105AF00012E00DE00B203B21ADF80400ADF83010B2 -:105B000034B1A4F80680A4F808A084F80AA003E041 -:105B10001299088014E0FFDF1299BDF80400088094 -:105B200074B1BDF830002080BDF804006080287A90 -:105B3000032805D0102803D0112801D086F800A032 -:105B400013B00020BDE8F08F2DE9F84356880F46CA -:105B5000804615460521304608F0BDFF040000D1FF -:105B6000FFDFA41D00943B46414630466A6804F0BE -:105B700053FC49E670B50D46052108F0ACFF040062 -:105B800000D1FFDF2946A01DBDE8704004F058BADF -:105B900070B50D46052108F09EFF040000D1FFDF1F -:105BA0002946A01DBDE8704004F07DBA2DE9F04300 -:105BB0008BB00D461446814606A9FFF7AEFC0028BF -:105BC00014D14FF6FF7601274FF420588CB10320F3 -:105BD0008DF800001020ADF8100007A8059007AA66 -:105BE000204604A90AF04DFC78B107200BB0BDE8AF -:105BF000F0830820ADF808508DF80E708DF8000085 -:105C0000ADF80A60ADF80C800CE00698A17801713F -:105C1000218841808DF80E70ADF80850ADF80C80E9 -:105C2000ADF80A606A4602214846069BFFF78DFCE4 -:105C3000DCE708B501228DF8022042F60202ADF839 -:105C400000200A4603236946FFF7F5FC08BD08B5A6 -:105C500001228DF8022042F60302ADF800200A4628 -:105C600004236946FFF7E7FC08BD00B587B079B1AA -:105C700002228DF800200A88ADF808204988ADF886 -:105C80000A1000236A460521FFF75FFC07B000BD3C -:105C90001020FBE709B10723CDE40720704770B55A -:105CA00088B00D461446064606A9FFF736FC0028C4 -:105CB0000ED17CB10620ADF808508DF80000ADF88B -:105CC0000A40069B6A4608215C803046FFF73DFC8F -:105CD00008B070BD05208DF80000ADF80850F0E761 -:105CE00000B587B059B107238DF80030ADF8082012 -:105CF000039100236A460921FFF727FCC6E710201D -:105D0000C4E770B588B00C460646002506A9FFF723 -:105D100004FC0028DCD106980121801D04F0BBF9A9 -:105D20009CB12178062921D2DFE801F02005051673 -:105D30000318801E80B2C01EE28880B20AB1A36838 -:105D40001BB1824203D90C20C2E71020C0E704290E -:105D500004D0A08850B901E00620B9E7012913D08A -:105D6000022905D004291CD005292AD00720AFE735 -:105D700009208DF800006088ADF80800E088ADF8D3 -:105D80000A00A068039023E00C208DF800006088D2 -:105D9000ADF80800E088ADF80A00A0680A25039075 -:105DA00016E00D208DF800006088ADF80800A0888E -:105DB000ADF80A00E088ADF80C00A0680B2504904F -:105DC00006E00E208DF8000060788DF808000C25A4 -:105DD0006A4629463046069BFFF7B7FB78E700B5D1 -:105DE00087B00F228DF80020ADF8081000236A4616 -:105DF0001946FFF7AAFB49E700B587B071B1022247 -:105E00008DF800200A88ADF808204988ADF80A10FE -:105E100000236A460621FFF798FB37E7102035E795 -:105E200070B586B0064601200D46ADF808108DF815 -:105E30000000014600236A463046FFF786FB040057 -:105E400008D12946304601F0EBF90021304601F037 -:105E500014FA204606B070BDF8B51C4615460E462D -:105E6000069F08F093FF2346FF1DBCB231462A4629 -:105E7000009408F07AFBF8BD10B548800878144605 -:105E800020F00F00C01C20F0F00090300B4608708E -:105E90001822214603F1080019F069FBBDE8104003 -:105EA00002F012BA18B18178012938D101E010202E -:105EB0007047018842F60112881A914231D018DCED -:105EC00042F60102A1EB020091422AD00CDC41B360 -:105ED000B1F5C05F25D06FF4C050081821D0A0F5EF -:105EE0007060FF381BD11CE001281AD002280AD1AB -:105EF00017E0B0F5807F14D008DC012811D002280B -:105F00000FD003280DD0FF2809D10AE0B0F5817F1A -:105F100007D0A0F58070033803D0012801D00020FD -:105F200070470F2070470B2826D008DC1BD2DFE813 -:105F300000F01C2025251A25292325271E001128BD -:105F40001CD008DC0C2817D00D281DD00F2815D028 -:105F5000102808D110E0822809D0842810D0852884 -:105F600010D0872812D003207047002070470520EA -:105F7000704743F203007047072070470F207047B7 -:105F800004207047062070470C20704743F202003F -:105F9000704708280DD2DFE800F00406040C0C0856 -:105FA0000C0A002070471120704707207047082016 -:105FB00070470320704738B50C46050041D069464C -:105FC000FEF7E2FA002819D19DF80010607861F31D -:105FD000020060706946681CFEF7D6FA00280DD1F1 -:105FE0009DF80010607861F3C5006070A978C1F376 -:105FF0004101012903D0022905D0072038BD2178AD -:1060000021F0200102E0217841F0200121704107B8 -:1060100004D0A978C90861F386106070607810F028 -:10602000380F07D0A978090961F3C710607010F024 -:10603000380F02D16078400603D5207840F0400048 -:106040002070002038BD70B5044600200880154639 -:106050006068FFF7B0FF002816D12089A189884227 -:1060600011D860688078C0070AD0B1F5007F0AD8DF -:1060700040F20120B1FBF0F200FB1210288007E093 -:10608000B1F5FF7F01D90C2070BD01F201212980FB -:10609000002070BD10B50478137864F3000313700A -:1060A0000478640864F3410313700478A40864F36B -:1060B000820313700478E40864F3C3031370047854 -:1060C000240964F3041313700478640964F345131A -:1060D00013700078800960F38613137031B108786B -:1060E000C10701D1800701D5012000E0002060F345 -:1060F000C713137010BD4278530702D002F0070394 -:1061000006E012F0380F02D0C2F3C20300E0012310 -:106110004A7863F302024A70407810F0380F02D0D8 -:10612000C0F3C20005E0430702D000F0070000E022 -:10613000012060F3C5024A7070472DE9F04F95B019 -:106140000D00804615D0B8F1000F16D01221284658 -:1061500019F03FFA4FF6FF7B05AA0121584605F0DA -:106160008DFE0024264637464FF420596FF4205AFE -:1061700075E0102015B0BDE8F08F0720FAE700BFEA -:106180009DF81E0001280AD1BDF81C0048450BD01F -:1061900010EB0A000AD001280CD002280CD0042CE5 -:1061A0000ED0052C0FD10DE0012400E00224BDF833 -:1061B0001A6008E0032406E00424BDF81A7002E027 -:1061C000052400E00624BDF81A10414547D12C747F -:1061D000BEB34FF0000810AA4FF0070ACDE90282C3 -:1061E000CDE900A80DF13C091023CDF810904246EE -:1061F0003146584605F0F5FE08BBBDF83C002A467E -:10620000C0B210A90AF01EF9C8B9AE81CFB1CDE96C -:1062100000A80DF1080C0AAE40468CE84102132399 -:1062200000223946584605F0DCFE40B9BDF83C0076 -:10623000F11CC01EC0B22A1D0AF004F910B10320DF -:1062400098E70AE0BDF82900E881062C05D19DF801 -:106250001E00A872BDF81C00288100208AE705A84E -:1062600005F018FE00288BD0FFF75DFE82E72DE9D0 -:10627000F8439846DDE9087614460D00814600D1C2 -:10628000FFDF0CB1012100E0002105F1080004F05E -:10629000FCFC3080024600232146484602F00AFCFE -:1062A00040B10097328843462146484602F07FFCC1 -:1062B000BDE8F883072C01D01120F9E743F2040070 -:1062C000F6E72DE9F0438BB00D46DDE912878146F4 -:1062D0001C461646142103A819F09DF9012002213D -:1062E0008DF810108DF80C008DF81170ADF8146059 -:1062F00064B1A178C90709D08DF81600E088ADF81F -:106300001A00A088ADF81800A06807900AA908A88C -:10631000CDE9000109AB002229464846FFF7A7FF57 -:1063200000280ED1DDE90801CDE9001008350AABDF -:106330004246029503A9484605F062F820B1FFF7EE -:1063400028FE0BB0BDE8F08308980090BDF8283017 -:1063500004220021484602F0FEFCF2E7F0B58BB0C3 -:1063600000240646069407940727089405A8099474 -:10637000019400970294CDE903400D461023224674 -:10638000304605F02EFE78B90AA806A901940097B8 -:106390000294CDE90310BDF814300022294630469E -:1063A00005F0F5FB002801D0FFF7BDFD0BB0F0BDF7 -:1063B00005F09DBA2DE9FC410C468046002601F00F -:1063C00080FF054620780D2871D2DFE800F099079C -:1063D0000B90189A3C3C55768C7B8100404601F02E -:1063E0009FFF8EE00421404608F075FB070000D1B6 -:1063F000FFDF07F10801404604F0DEFB50E0042116 -:10640000404608F068FB070000D1FFDFE088ADF8E8 -:106410000000002038809DF80000010704D5C00668 -:1064200002D5A088388005E09DF80100400668D5B7 -:10643000A088788005B9FFDF22462946404601F052 -:10644000CFFB02265DE0E188ADF800109DF8011059 -:1064500009060ED5072802D0062809D009E0042134 -:10646000404608F038FB060000D1FFDFA0887080AE -:106470000226B5B9FFDF14E00421404608F02BFBEB -:10648000070000D1FFDF07F1080005F067FA90F080 -:10649000010F02D1E079000633D50226A7F8048067 -:1064A00035B122462946404601F09AFB29E027E013 -:1064B00013214046FCF714FB23E00226002DF0D107 -:1064C000FFDFEEE702260121404601F06DFF18E0F4 -:1064D000606800902089ADF80400012269464046BA -:1064E00001F083FF0DE0002DDBD1FFDFD9E70226AD -:1064F00000214046FFF74CFB002DD2D1FFDFD0E753 -:10650000FFDF3046BDE8FC813EB50C0009D00146F6 -:106510006B4601AA002005F0E6FD20B1FFF703FD60 -:106520003EBD10203EBD00202080A0709DF80500DB -:1065300002A900F00700FEF743F850B99DF80800E3 -:1065400020709DF8050002A9C0F3C200FEF738F8DC -:1065500008B103203EBD9DF8080060709DF805005D -:10656000C109A07861F30410A0709DF80510890995 -:1065700061F3C300A0709DF80410890601D50221C3 -:1065800000E0012161F342009DF8001061F300007A -:10659000A07000203EBD70B5144606460D4651EA77 -:1065A000040005D075B108460CF020F978B901E077 -:1065B000072070BD2946304605F0F6FD10B1BDE854 -:1065C0007040B0E454B120460CF010F908B110202E -:1065D00070BD21463046BDE8704095E7002070BD93 -:1065E0002DE9FE4F05460C46007A0A31009104F170 -:1065F00008010291904600270C31821E3E464FF062 -:10660000020B4FF0010A0191092A75D2DFE802F06E -:10661000F3F20574252577B6F4006888042108F0A4 -:106620005AFA060000D1FFDF308810B15227072642 -:10663000E9E051271026002C7ED06888A08084F8DD -:1066400006A0A88900220099FFF7A5FF002874D1B1 -:10665000A8892081288AE081F8E0B5F812900728FF -:1066600025D1E87B000622D5512709F1140086B216 -:10667000002CE1D0A88900220099FFF78CFF0028A8 -:106680007AD16888A08084F806B0A889208184F82F -:106690000EA0288A2082A4F81290A88A0090688808 -:1066A0004B46A969DDF8042001F077FACEE05027C7 -:1066B00009F1120086B2002C3ED0A889002202996E -:1066C000FFF769FF002857D16888A080A889E0807B -:1066D000287A072811D002202073288AE081E87BDD -:1066E0004B46C0096073A4F81090A88A009068888F -:1066F00004F11202A969D7E7A7E00120ECE7688856 -:10670000042108F0E8F9B5F812A05FEA000900D109 -:10671000FFDF09F1080005F021F990F0010F02D127 -:10672000E87B000627D50AF11400512786B2002C19 -:106730007FD06888A08001E070E01DE0A889002279 -:106740000099FFF728FF002816D184F806B0A88921 -:1067500020810420A073288A2082A4F812A0A88A8D -:10676000009068885346A969019A01F016FAA98930 -:10677000A9F802106AE00320BDE8FE8F6888FAF7E6 -:106780004DFE82466888042108F0A5F98146BAF1D9 -:10679000000F00D1FFDFB9F1000F00D1FFDFB9F822 -:1067A0000400A0F57F41FF3902D05127142601E0F3 -:1067B0005027122694B36888A080502F06D084F802 -:1067C00006B0287B029901F0F8F93FE0287BA11D73 -:1067D00001F0F3F900219AF82300CDE900010B46FE -:1067E000B9F8022068884946FFF76BFD0028C3D13D -:1067F0002CE001E013E01FE0FE49A889C98881422E -:1068000005D1542706264CB16888A0801EE0532786 -:106810000CE06888A080A889E08017E009E068881B -:10682000042108F058F900B9FFDF55270826002C8D -:10683000EFD1A8F800600EE056270726002CF8D00C -:106840006888A0800020A07100E0FFDFA8F8006049 -:106850000CB12780668000208EE7E6490020087092 -:10686000704710B586B0002221F8022B044621F8AB -:10687000022B4FF6FF7021F8040B204604F083F939 -:106880006A460121204605F0F9FA19E09DF8030057 -:10689000000715D5BDF806102046FFF75FFD9DF8EF -:1068A0000300BDF8061040F010008DF80300BDF89D -:1068B0000300ADF81400FF232046059A05F03FFCC5 -:1068C000684605F0E7FA0028E0D006B010BD0831B0 -:1068D00004F079B970B50546042108F0FCF804000D -:1068E00000D1FFDF04F108012846BDE8704004F044 -:1068F00063B970B58EB00C460646FAF78FFD0500F9 -:1069000005D02878222805D208200EB070BD43F2A9 -:106910000200FAE70CB1A08870B101208DF81400D4 -:1069200003208DF8180000208DF8190034B1A088DC -:10693000ADF82000206803E00920E6E7ADF820006C -:1069400007900421304608F0C6F8040000D1FFDFAC -:106950000AA903A8CDE9000104AB00222146304674 -:10696000FFF785FC0028D0D1DDE9031004F108020F -:106970008DE8070095F823200AAB05A9304604F0FE -:106980003FFD10B1FFF705FBBFE703980090BDF88E -:10699000283004220021304602F0DDF94FF6FF7165 -:1069A000A180B2E72DE9FF4F85B01F46DDE91390C6 -:1069B000904646888B463046DDF848A0FAF72EFD13 -:1069C00005460421304608F086F8044605B9FFDF85 -:1069D00004B9FFDF0834CDF808A0CDE90394CDE970 -:1069E000008795F823205B463046059904F05DF951 -:1069F00009B0BDE8F08F2DE9F04F9BB004464FF091 -:106A000000087C48ADF85480ADF82C80ADF850807B -:106A1000A0F80480ADF81480ADF81880ADF820809F -:106A2000ADF81C80007816460D464746012808D070 -:106A3000022806D0032804D0042802D008201BB066 -:106A4000D7E720460BF090FED0BB28460BF08CFE1B -:106A5000B0BB60680BF0D3FE90BB606848B1608942 -:106A60002189884202D8B1F5007F01D90C20E6E7E0 -:106A700080460AAA06A92846FFF7E5FA0028DED1D3 -:106A800068688078C0F34100022808D19DF8190099 -:106A900010F0380F03D028690BF0A8FE80B905A9C3 -:106AA0002069FFF788FA0028C9D1206950B16078C1 -:106AB00080079DF8150000F0380002D5E8B301E02A -:106AC00011E0D0BB9DF8140080060ED59DF815008E -:106AD00010F0380F03D060680BF088FE18B96068BA -:106AE0000BF08DFE08B11020A9E707A96069FFF738 -:106AF00062FA0028A3D1606940B19DF81D0000F042 -:106B0000070101293BD110F0380F38D008A9A0693E -:106B1000FFF751FA002892D19DF81C0080062ED470 -:106B20009DF8200080062AD4A06950B19DF821006C -:106B300000F00701012922D100E020E010F0380F19 -:106B40001DD0E06818B10078C8B11C2817D20EAA71 -:106B5000611C2046FFF79EFA0120B94660F30F271B -:106B6000BA4607468DF84E0042F60300ADF84C00D9 -:106B70000DF13B0217A9286809F083FC08B1072032 -:106B80005DE79DF85C0016A9CDF80090C01CCDE92A -:106B9000019100F0FF0B00230BF20122514613A8D4 -:106BA00005F0AFF840BBBDF858000D9011492A8997 -:106BB0002869091D0092CDE901016B89BDF82820E3 -:106BC0002868069905F09DF801007DD120784FF0E6 -:106BD000020AC10601D480062DD5ADF80C9060697B -:106BE00070B907A906A8FFF786FA9DF81D0020F0E6 -:106BF000070002E0F002002036E0401C8DF81D0086 -:106C00009DF81C008DF84E7040F0C8008DF81C00F7 -:106C100042F60210ADF84C000BA903AACDF800A073 -:106C2000CDE90121002340F2032213A8079905F0C2 -:106C300068F8010048D1FC484D465B468088ADF8B5 -:106C400039000EA8CDE90290CDF80490CDF810904F -:106C50004FF007090022CDF80090BDF858104FF60C -:106C6000FF7004F094FF10B1FFF75DF9E7E69DF8BF -:106C70003800000625D52946012060F30F218DF844 -:106C80004E704FF42450ADF84C00ADF810506278BF -:106C90009DF81000002362F300008DF81000627868 -:106CA000CDF800A0520862F341008DF8100004AA4C -:106CB000CDE9012540F2032213A805F022F80100D6 -:106CC00002D1606850B300E081E0206960B905A995 -:106CD00006A8FFF710FA6078800705D49DF8150024 -:106CE00020F038008DF815008DF84E7042F6011036 -:106CF000ADF84C00208940F20121B0FBF1F201FB1C -:106D00001202606814ABCDF80080CDE901030023C6 -:106D100013A8059904F0F5FF010058D12078C007A9 -:106D200029D0ADF80C50A06950B908A906A8FFF702 -:106D3000E2F99DF8210020F00700401C8DF82100A9 -:106D40009DF820008DF84E7040F040008DF8200036 -:106D500042F60310ADF84C0015A903AACDF800A027 -:106D6000CDE90121002340F2032213A8089904F081 -:106D7000C8FF01002BD1E06868B32946012060F309 -:106D80000F218DF84E7042F60410ADF84C00E0680B -:106D9000002302788DF8602040788DF86100E0686B -:106DA00018AA4088ADF86200E06800798DF86400A8 -:106DB000E068C088ADF86500CDF80090CDE9012508 -:106DC0004FF4027213A804F09CFF010003D00D9849 -:106DD00000F01CFF33E694480321017056B180880F -:106DE0003080BDF850007080BDF82C00B080BDF838 -:106DF0005400F080002022E670B501258AB01646C6 -:106E00000B46012802D0022816D104E08DF80E505E -:106E10004FF4205003E08DF80E5042F60100ADF81B -:106E20000C0063B10024601C60F30F2404AA08A9BD -:106E3000184609F026FB20B107200AB070BD1020CB -:106E4000FBE704A99DF820207748CDE90021801CAC -:106E500002900023214603A802F2012204F051FF10 -:106E600010B1FFF760F8E8E76F480EB14188318054 -:106E700005700020E1E770B594B0044601268DF856 -:106E80003E6041F60100ADF83C0012AA0FA9304661 -:106E9000FFF7B2FF002848D12078634CC0074FF0BD -:106EA000000544D01C2102A818F0B5FB9DF808008D -:106EB0008DF83E6040F020008DF8080042F6052075 -:106EC000ADF83C000E959DF83A00119520F00600B3 -:106ED000801C8DF83A009DF838006A4620F0FF00CB -:106EE0008DF838009DF8390009A920F0FF008DF8D1 -:106EF00039000420ADF82C00ADF830000EA80A903F -:106F000011A80D900FA80990ADF82E5002A8FFF718 -:106F100072FD002809D1BDF80000E080BDF8040032 -:106F20002081401C60812570002014B070BDE58078 -:106F30002581BDF84800F4E72DE9F74F3A49A0B0A4 -:106F40004FF000090A78012A04D0022A02D0082052 -:106F500023B04EE54A88824201D00620F8E7219806 -:106F60008A46824201D10720F2E70024012021460F -:106F7000621CADF848004FF6FF7862F30F218DF8E0 -:106F80006E000691ADF84A8042F6020B8DF8724011 -:106F90001CA9ADF86CB0ADF870401391ADF85080FD -:106FA00012A804F09BFF00252E462F460DAB0722AA -:106FB00012A9404604F095FF78B182285FD195B3BD -:106FC0008EB3ADF86450ADF866609DF85E008DF844 -:106FD000144019AC012866D06DE09DF83A002FB33B -:106FE00001285BD1BDF83810594521D118A809A94D -:106FF00001940294CDE9031007200090BDF83610EB -:1070000010230022404604F0ECFFC0BBBDF8600036 -:10701000042801D006284CD1BDF8241021988142C3 -:107020003CD10F2094E73CE0F0020020012835D14C -:10703000BDF83800B0F5205F03D042F60101884268 -:107040002CD1BAF80200BDF83610884201D10127D0 -:1070500000E0002705B19EB1219881421ED118A8F9 -:1070600009AA01940294CDE90320072000900D465F -:1070700010230022404604F0B4FF00B902E02DE0E6 -:107080004E460BE0BDF86000022801D0102810D158 -:10709000C0B217AA09A909F0D5F950B9BDF83690C0 -:1070A00084E7052054E705A917A8221D09F0E9F98E -:1070B00008B103204CE79DF814000023001DC2B264 -:1070C0008DF8142022980092CDE901401BA8069962 -:1070D00004F017FE10B902228AF80020FEF723FF01 -:1070E00036E710B50B46401E88B084B205AA0021D1 -:1070F0001846FEF7CFFF00200DF1080C06AA05A9DF -:1071000001908CE80700072000900123002221460F -:107110004FF6FF7004F03BFD0446BDF8180001284F -:1071200000D0FFDF2046FEF7FEFE08B010BDF0B530 -:10713000FE4F044687B038780E46032804D0042852 -:1071400002D0082007B0F0BD04AA03A92046FEF72C -:107150007AFF0500F6D160688078C0F3410002280C -:107160000AD19DF80D0010F0380F05D020690BF002 -:107170003DFB08B11020E5E7208905AA21698DE8CB -:1071800007006389BDF810202068039904F0B9FD59 -:1071900010B1FEF7C8FED5E716B1BDF81400308077 -:1071A000042038702846CDE7F8B50C0006460CD010 -:1071B00001464FF6FF7500236A46284604F093FF08 -:1071C00028B100BFFEF7AFFEF8BD1020F8BD69463C -:1071D0002046FEF7F0FE0028F8D1A078314600F0F6 -:1071E00001032846009A04F0AAFFEBE730B587B008 -:1071F000144600220DF1080C05AD01928CE82C001C -:10720000072200920A46014623884FF6FF7004F0D9 -:10721000BEFCBDF814102180FEF785FE07B030BD1E -:1072200070B50D46042107F056FC040000D1FFDFC5 -:10723000294604F10800BDE8704003F0E3BC70B5D6 -:107240000D46042107F047FC040000D1FFDF29466A -:1072500004F10800BDE8704003F0FABC70B50D46BB -:10726000042107F038FC040000D1FFDF294604F1B7 -:107270000800BDE8704003F008BD70B50D4604215C -:1072800007F029FC040000D1FFDF294604F10800C3 -:10729000BDE8704003F003BD0121FEF779BC2DE984 -:1072A000F04194B04FF000060C008046ADF8146039 -:1072B0001AD0E06828B1A068B0B10188ADF8141008 -:1072C00006804046FAF7AAF8050043F2020757D0B5 -:1072D0002878222852D3A078012807D0022805D088 -:1072E000072014B0BDE8F0811020FAE7208878B1BB -:1072F000401C81B208AA404604F0C0FD08A804F072 -:10730000C9FD9DF82A204FF45051012A0DD102E009 -:1073100043F20300E5E7BDF82820A2F52453023B21 -:1073200003D1822801D098B901E00846D9E7E06886 -:10733000A8B105A901960296CDE9030107200090A6 -:10734000A2882188BDF81430404604F020FC10B11A -:10735000FEF7E9FDC5E7A168BDF8140008809DF8B7 -:107360002300C00602D543F20140BAE70C9838B1B9 -:10737000A1780078012905D0800708D40820B0E75B -:107380003846AEE7C007F9D00726022001E0012603 -:1073900003208DF834009DF8240010F0380F00D140 -:1073A000FFDF9DF824006249C0F3C200084495F84D -:1073B000231010F8010C884201D90F2091E7208892 -:1073C000ADF838000421404607F085FB040000D1E9 -:1073D000FFDF12A907A8CDE9000106AB324621461E -:1073E0004046FEF744FF002894D1DDE90601083449 -:1073F0008DE8130012AB07220DA9404604F000F8F7 -:1074000010B1FEF7C6FD6CE707980090BDF8483054 -:1074100004223146404601F09EFC62E770B5064604 -:1074200015460C460846FEF73DFD002805D12A46C4 -:1074300021463046BDE87040DEE470BD7CE570B5A5 -:107440001E4614460D0009D044B1616831B138B10F -:1074500036494988814203D0072070BD102070BD95 -:107460002068FEF71FFD0028F9D132462146284644 -:10747000BDE87040FFF7BFBA70B515460C0006D0E6 -:1074800038B12A498988814203D0072070BD102075 -:1074900070BD2068FEF706FD0028F9D12946204678 -:1074A000BDE8704043E670B5064686B00D4614460A -:1074B00010460BF07DF9E8BB60680BF0A0F9C8BB83 -:1074C000A6F57F40FF3803D03046F9F7A7FF80B11B -:1074D00028466946FEF731FE00280CD19DF81010B1 -:1074E0000F20082940D2DFE801F008060606060A48 -:1074F0000A0843F2020006B070BD0320FBE79DF8C6 -:107500000210012908D1BDF80010B1F5C05FF2D01A -:107510006FF4C052D142EED09DF80610012911D16E -:10752000BDF80410A1F52851062904E0F00200205E -:10753000A6F9010029E005D2DFE801F00303040306 -:107540000303D8E79DF80A1001290ED1BDF80810F1 -:10755000B1F5245FCFD0A1F524510239CBD0012958 -:10756000C9D0022901D1C6E7FFDF606878B90023DE -:1075700005AA2946304604F0B6FD10B1FEF7D3FC4B -:10758000B9E79DF81400800601D41020B3E76188A4 -:10759000224628466368FFF729FEACE72DE9F04351 -:1075A000814687B08846144610460BF001F918B1A1 -:1075B000102007B0BDE8F083002306AA41464846E4 -:1075C00004F091FD18B100BFFEF7ADFCF1E79DF8A6 -:1075D0001800C00602D543F20140EAE7002507275C -:1075E00005A8019500970295CDE9035062884FF6F2 -:1075F000FF734146484604F0F4FC060013D160686E -:107600000BF0D6F860B960680195CDE9025000979B -:107610000495238862884146484604F0E2FC064609 -:10762000BDF8140020803046CEE739B1F84B0A8807 -:107630001B899A4202D843F2030070472FE610B527 -:1076400086B0F34C0423ADF81430E38843B12489A9 -:107650008C4201D2914205D943F2030006B010BD1D -:107660000620FBE7ADF81010002100910191ADF864 -:10767000003002218DF8021005A9029104A903919E -:10768000ADF812206946FFF70AFEE7E72DE9FC474F -:1076900081460F4608460BF067F888BB4846F9F765 -:1076A000BDFE5FEA00080AD098F80000222829D31E -:1076B0000421484607F00FFA060005D103E043F223 -:1076C0000200BDE8FC87FFDF06F1080003F0A1FA25 -:1076D00005463878012803D0022804D00720F0E7B7 -:1076E000A8070FD502E015F0340F0BD0B8793C1D78 -:1076F000C00709D0E08838B1A0680BF035F818B1A0 -:107700001020DEE70820DCE73A782088002128B343 -:10771000A0F201130721112B18D20CD2DFE803F0DD -:107720000B090D0B1D0B121D100B0B1D1D1D1D0B31 -:107730001D00022A11D10846C3E7012AFBD00CE044 -:10774000EA0600E0AA06002AF5DA06E0A0F5C07213 -:107750001F2A02D97D3A022AEDD8C1B298F8230037 -:10776000CDE900017288234631464846FEF7A9FD5F -:10777000A7E72DE9FF4F8BB01E4615460C464FF08C -:1077800000080F460B98F9F749FE30B1007822281F -:1077900006D208200FB0BDE8F08F43F20200F9E7EF -:1077A000B00801D00720F5E7032E00D100264FF6E0 -:1077B000FF7ACCB1022D70D320460BF020F830B9FF -:1077C00004EB0509A9F101000BF019F808B110202C -:1077D000E0E7AD1EAAB22146504604F08CFD39F810 -:1077E000021C884259D1ADB28948B10702D501893E -:1077F000491C00E001211FFA81F9F10701D0068937 -:1078000000E0564605AA49460B9804F037FB4FF0B6 -:10781000070B4FF0000A0BE0788810283DD808F1DC -:10782000040108441FFA80F8A84536D804EB08077D -:10783000AFB339884945EFD351E000BF9DF8170039 -:1078400002074CD564B304EB080708F104027B88F7 -:107850001FFA82F8102B20D803EB0802AA421CD88A -:107860003A88914219D1C0061BD5CDE900BA0DF175 -:1078700008090AAA04EB0801504689E8070039887C -:1078800000220B9804F083F910B1FEF74CFB81E75E -:107890007888BDF82810884203D00B207AE71EE0D4 -:1078A00005E0798801EB08001FFA80F806E0C006C1 -:1078B00004D50B98FEF752FD002889D19DF81700DA -:1078C000BDF81A1020F010008DF81700BDF8170051 -:1078D000ADF80000FF23009A0B9804F030FC05A8D7 -:1078E00004F0D8FA18B9BDF81A10B142A6D904218B -:1078F0000B9807F0F0F8040000D1FFDF22885AB19E -:10790000CDE900BA5546002321460B98FEF7D9FC75 -:107910000028BCD125803DE700203BE72DE9FF4F43 -:107920008BB01E4617000D464FF0000411D0B00872 -:1079300001D007202EE7032E00D100265DB10846B6 -:107940000AF054FF28B93888691E08440AF04EFF2F -:1079500008B110201EE72E4AB00701D5518900E07A -:107960000121F0074FF6FF7802D05089401E00E059 -:10797000404686B206AA0B9804F080FA4FF0000940 -:107980004FF0070B0DF1140A39E000BF9DF81B0002 -:10799000000734D5CDF80490CDF800B0CDF80890AC -:1079A000CDE9039A434600220B9804F01AFB60BB12 -:1079B00005B3BDF814103A8821442819091D8A42DC -:1079C00032D3BDF81E2020F8022BBDF8142020F879 -:1079D000022BCDE900B9CDE90290CDF810A0BDF899 -:1079E0001E10BDF8143000220B9804F0FAFA08B10A -:1079F0000320CFE6BDF814002044001D84B206A881 -:107A000004F048FA30B1822808D0FEF78CFAC1E6BB -:107A1000F0020020BDF81E10B142B7D934B17DB1DB -:107A20003888A11C884203D20C20B3E60520B1E6B9 -:107A300022462946404604F05EFC01462819018092 -:107A4000A41C3C800020A5E610B504460AF0B0FE58 -:107A500008B1102010BD734840892080002010BD5F -:107A6000F0B5A3B00C4606460025142105A817F072 -:107A7000D2FD01208DF814008DF8180000208DF83B -:107A80001900ADF81C403046F9F7C8FC28B1007861 -:107A9000222805D2082023B0F0BD43F20200FAE705 -:107AA0000421304607F017F8070000D1FFDF0AA9CC -:107AB00003A8CDE9000104AB002239463046FEF7A9 -:107AC000D6FB0028E7D1DDE90301CDE90010083736 -:107AD0000AAB0722029705A9304603F091FC10B1CA -:107AE000FEF757FAD7E703980090BDF82830042234 -:107AF0002946304601F02FF900B1FFDF214630461C -:107B0000FEF738F816A9384603F072F800B1FFDF27 -:107B1000BDF85800172801D2172100E00146A14204 -:107B200004D8172801D2172400E004462146304625 -:107B3000FFF785FB074621463046FDF798FD2946AD -:107B4000304601F0A9FB00B9FFDF27BB3046F9F74B -:107B500065FC050000D1FFDF95F822001B281AD92B -:107B6000172C18D93A208DF82C00ADF82E6095F816 -:107B70002200211D884201D9241D00E00446ADF8F1 -:107B8000304040F64800ADF8320017A90BA804F0C9 -:107B900039FB00B1FFDF00207DE7F8B51C46154634 -:107BA0000E46069F07F0F2F82346FF1DBCB2314691 -:107BB0002A46009406F0D9FCF8BD70B50C4605467F -:107BC0000E21204617F005FD002020802DB1012D4B -:107BD00001D0FFDF70BD062000E00520A07170BD60 -:107BE00010B548800878144620F00F00001D20F0E2 -:107BF000F00080300B4608701422214603F1080083 -:107C000017F0B5FCBDE8104000F05EBB10B50C46A7 -:107C100004F000F900B1FFDF2046BDE81040FEF798 -:107C200082B90000F002002010B50446007896B03A -:107C3000022805D0012803D043F2050016B010BD7C -:107C4000A17889290AD06078892807D021B1032931 -:107C500002D808B1032801D90720EFE750208DF89A -:107C600000002078022801D0012000E000208DF8DB -:107C70000200607800F016FEC01D8DF80300A078A9 -:107C8000012815D000F00EFE10F101008DF804005F -:107C9000607800F007FE8DF80500A07800F002FE85 -:107CA0008DF806009DF805200621102A04D005E075 -:107CB000022000F0F7FDE9E78DF80510102801D14A -:107CC0008DF806102078012804D19DF80300401C8F -:107CD0008DF8030002F07EF9001DADF808000BA935 -:107CE000684604F08FFA00B1FFDF0020A6E72DE917 -:107CF000FF4FF94991B00600D1E900010396CDE9A3 -:107D00000C01507A117A15460844C7B222D00024DB -:107D10004FF00009CDF81C904FF0050BADF81CB0EA -:107D20001F20ADF81E00EDA00690CDF81490F01DB8 -:107D30008DF814904FF0010A20F007008DF815A07F -:107D4000B04200D0FFDF28880399401C1FFA80F85A -:107D500014B107E00124DBE708F0FF0008F018FB8E -:107D600000B1FFDF03993A4601EB0810C01C20F078 -:107D70000301D5F8188003913CB981F800901FFAEF -:107D800088F003F0CBFE00B1FFDF0399234601EB3F -:107D900008000390A87A297A3A460844C1B203A899 -:107DA00000F0CEFD0398C01C20F003000390697A18 -:107DB00000912B7AAA7A04B1002002A906F067FD8F -:107DC00000B1FFDFBDF8081003983A460844DDE92A -:107DD0001F31C01C20F00300DDF850C01E9FCDE90C -:107DE0000210CDE9007304B10020634608A906F033 -:107DF000D9FE00B1FFDF089903980844C01D20F0A8 -:107E0000070003901299821B002C0A6040D1B64AE9 -:107E1000B4491160111D401E086001232C220EA9D7 -:107E2000B24806F0B4FC00F04BFD00211E220846CB -:107E300002F0E0F8FAF776FA00F0EAFEFEF70DFD40 -:107E4000E8680CAA214620B1FBF7EBF830B1FFDF60 -:107E500004E005A8FBF7E5F800B1FFDF05F1140029 -:107E6000FFF709F800B1FFDF4FF4A871A04817F041 -:107E7000D2FB9F48022180F849A180F84AA180F8EE -:107E80004B1180F84C91062180F84D1180F804B018 -:107E900015B0BDE8F08F70B5954D0646287805EB16 -:107EA0004014E8780834A0B9A81990F848010028CF -:107EB00010D0A8780A2800D3FFDF207820F0FF0038 -:107EC0002070607866F3020020F0080060700120E6 -:107ED000E870204670BD2DE9F04105460C460027AC -:107EE0000078052190463E46B1EB101F00D0FFDF21 -:107EF000287A58B101280FD0FFDF00BFA8F8006032 -:107F00000CB1278066800020BDE8F0810227092699 -:107F100074B16888A08008E00327142644B16888FB -:107F2000A0802869E060A88A2082287B2072E5E78B -:107F3000A8F80060E7E700B597B051218DF8001070 -:107F400000780BA900F001008DF80200684604F0EB -:107F500059F917B000BD00B5017897B001F00101E3 -:107F60008DF80210417801F001018DF803100178BD -:107F7000C1F340018DF804104178C1F340018DF840 -:107F80000510017889088DF80610417889088DF868 -:107F9000071081788DF80810C1788DF809100079E4 -:107FA0008DF80A004D208DF800000BA9684604F0FA -:107FB00029F9CEE72DE9F04F4D4E97B04FF6FF7AF5 -:107FC0004FF0000996F8490108B3022000F044FD83 -:107FD0000120FFF760FF0446444806F009FC60609A -:107FE00000B9FFDF606804F05AF960B12046F9F784 -:107FF00082FC204600F035FD0028E3D13B48616853 -:1080000006F0FFFBDEE73948616806F0FAFB49201D -:108010008DF82C0069460BA804F0F4F800B1FFDFDE -:10802000002581E068460DEB050400EB4501A07DCD -:10803000B1F80680C10704D0400702D4404601F0E1 -:108040000DF9A07D80076DD5404606F09FFE040027 -:1080500000D1FFDF0321404606F03DFD070050D16F -:10806000FFDF4EE0786810B10078FF2851D004207F -:1080700000F0F2FC0320FFF70EFF8346204606F0D7 -:1080800005FACBF8040000B9FFDFDBF8040006F0C6 -:10809000DFFA00210B900170ABF80280584600F027 -:1080A000AEFE204606F0D6FA00B9FFDFC2465846BB -:1080B00000F0D7FC18B99BF80100000702D50B9817 -:1080C00078601EE07868A8B10178491C11F0FF01C2 -:1080D000017016D1FFDF14E0ACF901006E52463595 -:1080E0007800000000000020000602407C0500200F -:1080F0002C04002000221146204600F0D1FB00B9DC -:10810000FFDF96F84B0120B1404600F03CFE00280E -:10811000A8D196F8490128B1204606F011FB08B114 -:108120004FF001096D1CEDB29DF80400A8423FF626 -:1081300079AFB9F1000F7FF443AFAAF57F41FF3962 -:108140000AD04A218DF80010ADF802A00BA96846AC -:1081500004F058F800B1FFDF17B00520BDE8F04F7C -:1081600000F07ABC10B5FC4CA0600868E060AFF28B -:10817000BB1001F088FE607010BDF7490020087048 -:10818000704730B505464FF080500C46D0F8A4102B -:1081900097B0491C05D1D0F8A810C9430904090CAF -:1081A00008D050F8A01F01F001012970416821603A -:1081B00080680EE02B208DF800000BA9684604F0C3 -:1081C00021F800B1FFDF012028700C982060BDF875 -:1081D0003400A0802878002803D0607940F0C000E7 -:1081E000607117B030BDF0B54FF080540746D4F839 -:1081F000800097B00D462B26401C0BD1D4F884008C -:10820000401C07D1D4F88800401C03D1D4F88C005E -:10821000401C0BD0D4F880003860D4F8840078601B -:10822000D4F88800B860D4F88C0016E08DF82C6083 -:1082300069460BA803F0E6FF00B1FFDF0198386044 -:10824000029878608DF82C6069460BA803F0DAFF7D -:1082500000B1FFDF0198B8600298F860D4F8900090 -:10826000401C0BD1D4F89400401C07D1D4F89800DE -:10827000401C03D1D4F89C00401C08D054F8900F47 -:10828000286060686860A068A860E06816E08DF803 -:1082900000600BA9684603F0B5FF00B1FFDF0C9842 -:1082A00028600D9868608DF800600BA9684603F09F -:1082B000A9FF00B1FFDF0C98A8600D98E86017B027 -:1082C000F0BDA6480079E6E570B5A44CE07828B387 -:1082D000207804EB4010407A00F00700204490F82A -:1082E000480100B9FFDF2078002504EB4010407AF8 -:1082F00000F00700011991F84801401E81F848017B -:108300002078401CC0B220700A2800D12570A078C7 -:10831000401CA07009F0C3FDE57070BDFFDF70BDAB -:108320003EB50546032106F0D6FB0446284606F076 -:108330002DFD054604B9FFDF606818B10078FF28FD -:1083400000D1FFDF01AA6946284600F0A9FA60B90A -:10835000FFDF0AE0002202A9284600F0A1FA00B9D6 -:10836000FFDF9DF8080000B1FFDF9DF80000411E0F -:108370008DF80010EED260680199884201D100208A -:108380006060764C94F84B01022800D3FFDF94F82C -:108390004B0118B97048407801F094FD94F84B01F6 -:1083A000401C84F84B013EBD70B50546A0F57F40EA -:1083B0000C46FF3800D1FFDF012C01D0FFDF70BD7C -:1083C000FFF77FFF040000D1FFDF207820F00F00CF -:1083D000401D20F0F0005030207065800020207299 -:1083E00001202073BDE870406EE770B515460C465D -:1083F0000646FFF766FF90B1017821F00F01491D95 -:1084000021F0F00150310170468001210172216894 -:108410000161A18881820573BDE8704054E7304650 -:10842000BDE870401321FAF75BBB70B505460C46FA -:1084300008460AF0BDF908B1102070BD2846F8F7CB -:10844000EDFF28B1284600F018FF2070002070BD15 -:1084500043F2020070BD2DE9F04F04463E488946C4 -:1084600087B0017811B1082007B012E53A483C49BD -:10847000416020460AF09CF900287DD148460AF068 -:1084800097F9002878D1637A217A5818FF286AD89A -:108490002088FE2867D800B90A202080A06908B982 -:1084A0004FF4B060A0616068A0B14578827805EBB8 -:1084B00045052A440578067905EB450502EB45029A -:1084C0004579C07805EB450505EB8605C0EBC00096 -:1084D000284409E003EB430001EB410200EB4202B8 -:1084E000C1EBC10505EB830086B2C3EBC3001044AA -:1084F000C1EBC1021044084487B2208A01F060FD3C -:108500000028B1D101F066FD001D7843059001F00F -:1085100061FD001D00FB06F8E168A06900F05CFA4F -:108520005FEA000AA0D1A17A607A814236D84FF082 -:10853000120B08280ED8207A01280BD808F093F8DF -:10854000054609F06BFC2A1A217A607A521E0B1834 -:108550009A4209DA584687E71C0000202C040020C4 -:108560004813002008E019E065688B460090BDB113 -:1085700028460AF044F908B1102075E7A978687810 -:1085800008442978421800985844904206D16A79E4 -:1085900029791144EA781144884201D0072063E721 -:1085A000CDF80080CDE90176224603A90020059B85 -:1085B000FFF79DFBF84D039AD9F800306868111851 -:1085C000994202D8B2F5803F03D30420C9F80010C5 -:1085D0004AE7CDF80080CDE90176224604A9059B43 -:1085E000FFF785FBDDE90301884200D0FFDF049837 -:1085F000696808446860C9F80000E84901202870EB -:108600000870504630E72DE9F04707460C4608460B -:108610000AF0CEF840B938460AF0E8F820B9F81C5C -:1086200020F00300B84202D01020BDE8F087DC48FB -:108630004FF00008817889B14178824600EB4115FE -:10864000B4F8009015F8080F234600F00F00002240 -:10865000294600F013FA060004D013E0A4F80080C5 -:108660000520E2E797B12188494501D90C260DE0A4 -:108670002878234600F00F003A46294600F0FEF91C -:10868000060005D00C2E01D0A4F800803046CCE7BF -:108690009AF801005446401CC0B28AF801000A282A -:1086A00001D184F80180A078401EA070697801F0A3 -:1086B0000700062827D2DFE800F026091E031E1E49 -:1086C0000807E3D46888FFF72BFEDFE7B548696841 -:1086D00006F097F894F8490130B9AF48407801F0B6 -:1086E000F1FB94F8490100B1FFDF94F84901401C07 -:1086F00084F84901CAE700EB0A0191F84801401CDF -:1087000081F84801C2E7FFDFC0E770B50D460446B7 -:108710000AF02AF818B928460AF04AF808B11020D9 -:1087200070BD29462046BDE8704007F068BE70B5B0 -:10873000044615460E4608460AF016F818B92846AB -:108740000AF036F808B1102070BD022C03D0102CAE -:1087500001D0092070BD2A463146204607F072FE3E -:108760000028F7D0052070BD70B514460D460646AA -:1087700009F0FAFF38B928460AF01AF818B9204665 -:108780000AF034F808B1102070BD22462946304660 -:1087900007F077FE0028F7D0072070BD10B596B01F -:1087A00004460AF005F810B1102016B010BD0F20D5 -:1087B0008DF800000BA9684603F024FD0028F4D1D1 -:1087C0009DF834002070BDF836006080BDF8380098 -:1087D000A0800020E9E770B505460C4608460AF07F -:1087E00005F820B93CB1206809F0E2FF08B110207B -:1087F00070BDA08828B121462846BDE87040FEF72C -:1088000078B8092070BD70B504460D46084609F0D9 -:10881000ABFF30B9601E1E2814D8284609F0A4FF0B -:1088200008B1102070BD032C01D9072070BD04B918 -:10883000FFDF5D4800EB840050F8041C2846BDE8CB -:1088400070400847A4F120001F28EED82946204692 -:10885000BDE87040F9F784BC70B504460D46084683 -:1088600009F0A6FF30B9601E1E280FD8284609F06F -:108870007BFF08B1102070BD012C03D0022C01D069 -:10888000032C01D1062070BD072070BDA4F120008B -:108890001F28F9D829462046BDE87040F9F701BDE8 -:1088A00005F07DBC892805D0032805D0022805D015 -:1088B0000120704710207047062070470320704742 -:1088C00010B596B0FAF790FB33484178806803F012 -:1088D00089FE314801240C300178012916D141214B -:1088E0008DF80010C0788DF8020010B1012803D077 -:1088F00005E08DF8024002E000208DF80200684695 -:1089000005F0EEF910B10BA803F02DFF02208DF851 -:108910002C008DF82D008DF82E000BA8FFF784F9A0 -:1089200000B1FFDF8DF82C4003208DF82D008DF86D -:108930002E000BA8FFF778F9002800D0FFDF34E7FE -:108940002DE9F0410646022012B101EB4200401D24 -:10895000C7B23068C01C20F003023260DBB9104897 -:108960003B460921243809F0F0FD002408E0092CD9 -:1089700024D2DFE804F005070509090B0B05050003 -:108980000A4804E00A4802E00A4800E00A4809F000 -:10899000FBFD054613E019E01C0000200800002044 -:1089A0002C0400207C050020CCF90100CD1F000024 -:1089B000AD8C0000DB9F000045010100FFDFA542F8 -:1089C00000D0FFDF641CE4B2092CD0D3306800EB88 -:1089D00007103060BDE8F08138B50C00054604D0C2 -:1089E000084609F0C1FE10BB02E0F62830D331E0A2 -:1089F000606809F0B9FED0B9607800F00300012882 -:108A000003D0022801D0072038BD69462046FBF775 -:108A1000BBFD0028F8D1607800F00300022808D1DF -:108A20009DF8000028B1606809F0E0FE08B1102050 -:108A300038BD6089F8280BD82189814208D861782F -:108A400001F00301012905D1D73080B2A84201D934 -:108A5000092038BD002038BD144908710020C870B5 -:108A600070471249CA782AB10A7801EB42110831DD -:108A7000814201D001207047002070472DE9F0416C -:108A8000044600201880601E1D4616460F46052825 -:108A900000D3FFDF06482A4600EB8400314650F839 -:108AA000043C3846BDE8F041184700002C04002083 -:108AB000B4F901002DE9F0478A4698461546064666 -:108AC000032106F008F80446304606F071F90D352A -:108AD000AFB2002581462E4604B9FFDFB9F1000F81 -:108AE00000D1FFDF04EB8A000189B94200D30125E0 -:108AF000218CB94202D2BAF1060F00D3012638EA1E -:108B0000050104D0817A41F0020181720BE038EA5C -:108B1000060108D0817A41F00401817214F8220F15 -:108B200040F00400207005EA0600BDE8F0872DE95A -:108B3000F0478246DDE90846174604F10D009946E4 -:108B40000D461FFA80F80023224639465046FFF7AB -:108B5000B1FF60B1A87800061BD426F8044C26F8B3 -:108B6000029C504606F024F9060008D106E0072FC3 -:108B700001D01120D9E743F20400D6E7FFDF241D1E -:108B80003046A1B205F002FA00B9FFDF504603F00B -:108B90008BFC05EB8700062F0289A2EB08010181FF -:108BA00003D2298CA1EB080028840020BDE72DE921 -:108BB000F8431D4617460E46DDF8208006F0F8F80B -:108BC00004001BD03F1DB9B205F090F92860C0B178 -:108BD00005F03EFD067020466A46296805F077FCE0 -:108BE000009800210A460180817003F01FFD009863 -:108BF000C01DC8F800000020BDE8F88343F2020061 -:108C0000FAE7072E01D01120F6E743F20400F3E75C -:108C100010B501F0DFF90021F74B0A4623F81120C7 -:108C2000491C0829FAD3F44A00F10D011032400022 -:108C3000118051801A3090804E20D0801181518156 -:108C4000C1EBC100908110BD70B50C46897821F050 -:108C5000FF01A170217821F00F01217001216170C5 -:108C60000021616006F0A4F8050000D1FFDF28466E -:108C700005F03AF9E04910318989401A20852046EB -:108C8000BDE8704000F0A0BB70B50D46032105F0B3 -:108C900022FF040000D1FFDFA07865F30600A0707A -:108CA00070BD70470146012009F01BBD3EB58DB275 -:108CB0000321284605F00FFF040000D1FFDF2078D4 -:108CC000002220F00F00207002208DF800004FF6E7 -:108CD000FF70ADF80200ADF8040069462846F9F7C8 -:108CE000E7F93EBD2DE9F84F05460C460027007810 -:108CF000012192463E46B1EB101F00D0FFDF287ADB -:108D0000032809D0FFDF00BFAAF800600CB127805C -:108D100066800020BDE8F88FB5F80C80702708F158 -:108D20000A0086B2A4B16888A08068892081A4F86E -:108D300006806888D5F8049004F10A0506F026F844 -:108D40002A46072549464346009505F00EFCDBE719 -:108D5000AAF80060DDE72DE9FC410F461C461646E7 -:108D600080460321089D05F0B6FE010008D0334679 -:108D70003A464046CDE90045FFF7D9FEBDE8FC8103 -:108D800043F20200FAE7F8B50546A0F57F40FF3848 -:108D900015D0284605F0FAFF040000D1FFDF204679 -:108DA00005F074FB00280BD001466A46204605F00A -:108DB0008EFB009CB4F80500E41C052801D00120BE -:108DC000F8BD2E460321284605F085FE050000D19A -:108DD000FFDF2079122807D120880C2804D1A87839 -:108DE00000F07F00022806D000230622042130462E -:108DF000FFF760FEF8BD002306220521F7E72DE905 -:108E0000F04F044689B0408805F0C0FF050000D14E -:108E1000FFDF06AA2846616800F0C7FA069D001F1A -:108E200035F8032F6E8882421FD14FF0010B4FF0AF -:108E30000008042E1CD0052E79D0062E71D0402EAD -:108E400013D31546304600F0B2FA08280DD020782A -:108E500020F00F00401C20F0F000103020700320A4 -:108E600020726681A581FFF72FFA09B0BDE8F08F67 -:108E700016462D1D224629463046FCF765FEC0B237 -:108E80000828F2D1ADF81080CDF80C80608803215D -:108E900005F021FE070000D1FFDF57483989103067 -:108EA000008881420FD360880021FEF7D7F9ADF822 -:108EB0001000024603A80090608805AB0021FFF770 -:108EC00076FE00B1FFDF03980599CDE9001002940A -:108ED00004AB2A4630466168FDF764FDC0B2052840 -:108EE0001DD2DFE800F0041C03150300BDE7BDF848 -:108EF00010000028B9D003990423CDE9000160884F -:108F000000223946FFF713FE0028AED0FFDFACE7A2 -:108F1000607840F008006070A7E708E001E0FFDF3C -:108F2000A3E76088291D6368FAF7B2FF9DE716463C -:108F300027466088032105F0CEFD040000D1FFDF45 -:108F40008DF80880A078C146400600D1FFDF042ECE -:108F50008BD3297941F30000401C06D162786B79EC -:108F60009A4282D122781207D1D04FF002081429F8 -:108F700039DA4FF6FF7A012933D0122902D01329AA -:108F800031D11CE00C2E2ED1A17801F07F010129F6 -:108F900029D0207820F00F00401C20706879607084 -:108FA0008DF808B02889ADF80A006889ADF80C0082 -:108FB000A889ADF80E00E889ADF8100016E0062E7D -:108FC00011D1207820F00F0020707988012009F05D -:108FD00088FB8DF80880ADF80AA02889ADF80C0050 -:108FE00004E0062E0AD09DF80810B9B178883A46F8 -:108FF00002A9F9F75DF838E7AC050020207820F0E9 -:109000000F0020707988012009F06BFB8DF8088033 -:109010002889ADF80A00ADF80CA0E7E7002885D054 -:109020007E8805A8009007AB062204213046FFF792 -:10903000BEFD00B1FFDF05980523042280F800B0D3 -:1090400069794170A0F80280A0F804900621CDE96A -:10905000001021463046FFF76AFD0028CBD0FFDF25 -:1090600003E77FB50D460646032105F034FD0400F5 -:109070003AD0207800F00F00012838D002A80090E4 -:1090800003AB0C2205213046FFF791FD002829D1C2 -:10909000029812210523017061781A46891C4170DB -:1090A00008214180298881806988C180A98801813F -:1090B000E98841810C21CDE9001021463046FFF7B7 -:1090C00036FD00B1FFDFF02300223146012009F018 -:1090D0006BFA207820F00F00401C20706078801C14 -:1090E0006070002004B070BD43F20200FAE7112066 -:1090F000F8E77FB50D460646032105F0ECFC0400B9 -:1091000006D0207800F00F00012804D00820E9E7FD -:1091100043F20200E6E702A8009003AB0622052115 -:109120003046FFF744FD0028DCD1029813210523C7 -:109130000170617841700221418085800621CDE96E -:1091400000101A4621463046FFF7F1FC00B1FFDF60 -:10915000207820F00F0020700020C3E72DE9F84FA1 -:109160000E468146032105F0B6FC0546484605F04B -:109170001FFE80464FF0000B05B9FFDFB8F1000F6E -:109180005AD1FFDF58E040466946002205F007F853 -:109190009DF800408246082C00D3FFDF05EB8407D2 -:1091A0000AF109003989062C0144398102D2298C3F -:1091B00008442884072C03D10BF1010000F0FF0BB9 -:1091C000B97AC80711D0072C03D0894A32F81400A5 -:1091D00000E0288D3A89824207D321F00100B8725D -:1091E000484674B3032C2DD0FFDFB87A810706D52B -:1091F00020F00200B8724846032C29D0FFDF062C6D -:109200001AD800BF95F82200410715D520F00400B8 -:1092100085F822005FF0000405EB84018A7A50078C -:1092200006D522F0040088724846032C13D0FFDFD5 -:10923000641CE4B2062CEFD3761EF6B2A3D25846D5 -:1092400068E502E0FAF7BBFECFE7FEF725F8CCE7CA -:10925000FAF77BFED6E7FAF778FEE9E710B50321C7 -:1092600005F039FC040000D1FFDF204600F0ACF827 -:10927000A07840F08000A07010BD10B5032105F06B -:109280002AFC040000D1FFDF00F0A4FE218D0D3088 -:10929000B1FBF0F0C0B210BD70B50D46032105F072 -:1092A0001AFC040000D1FFDF062D00D9FFDF072DD7 -:1092B00003D04F4830F8150000E0208D04EB850105 -:1092C0000A89824205D28A7A012042F001028A721A -:1092D00070BD002070BD10B50446402801D20720A3 -:1092E00010BD00F064F8082802D04FF4445010BDBF -:1092F0003F480021103802E0491C082903D230F809 -:109300001120002AF8D1082903D020F811400020AC -:1093100010BD042010BD10B5402801D2072010BD9B -:1093200000F045F8082806D0314A0021103A22F80A -:109330001010084610BD052010BD2DE9FE4315464E -:109340000C00804606D02DB16088402804D207204A -:10935000BDE8FE831020FBE7218811B300F027F859 -:10936000082820D002A80090228801AB072140469F -:10937000FFF71DFC0028EBD140462788019E05F031 -:1093800017FD2A46072531463B46009505F026F98C -:10939000029800902388628807214046FFF7DBFC93 -:1093A000D6E70C20D4E70520D2E705F090B80146B7 -:1093B0000F4A0020103A02E0401C082803D232F87D -:1093C00010308B42F8D1704710B504462021083088 -:1093D00016F021F90648002104EB810330F8112032 -:1093E000491C1A810629F7D9208DA08410BD0000E0 -:1093F000BC05002030B44FF0E02001234FF4006C96 -:109400000021C0F880C11D02C0F880511C06C0F8C0 -:109410008041F34A82F80014D21E82F80014F14A07 -:1094200082F80014F04A53609360C2F84011C2F809 -:109430004411C2F84811C0F880C2C0F88052C0F888 -:109440008042C0F800C1C0F80041136030BC7047D2 -:1094500070B401204FF0E023C6024FF0000CC3F8B7 -:1094600080610402C3F880410506C3F88051DE4ADA -:1094700050609060DD4801680029FCD1C2F840C10D -:10948000C2F844C1C2F848C1C3F88062C3F8804240 -:10949000C3F8805270BC70474FF0E0204FF4006179 -:1094A000C0F88012C910C0F880127047002804BFAD -:1094B000CF487047012804BFCE487047022804BF38 -:1094C000CD48704700B5FFDF002000BD08B5C64994 -:1094D000002298B101282FD002281CBFFFDF08BD51 -:1094E0004FF48020C1F80803C1F84803C348026064 -:1094F000C1F84821C0480068009008BD4FF4803092 -:10950000C1F80803C1F84803BD4B1A60C1F84021F7 -:10951000BC4BC1031960BC49C1F80803BB480260D9 -:10952000C1F840214FF0E0238015C3F88001C1F855 -:109530000022B748027008BD4FF40030C1F808039C -:10954000C1F84803B3480260C1F84421A948006843 -:10955000009008BD70B5DFF890C2042600240125F4 -:10956000B0B101284CD002281CBFFFDF70BDAA4853 -:109570004FF48022012BC0F8401518BFCCF8082307 -:10958000C0F8404108BFCCF80423CCF8442370BD98 -:10959000881E20F07F40CCF840054FF48030CCF896 -:1095A0000803CCF84041CCF84403012B14BF002140 -:1095B0000121974B597094490D61DFF860C2CCF8D6 -:1095C0000040974C4FF0020CC4F800C0DFF854C2C2 -:1095D000CCF80060DFF834C23D32CCF80020C1F88E -:1095E00000524FF0E0224FF4807CC2F880C2C1F8F4 -:1095F0000403C2F800C108048B4908601D7070BDE7 -:109600008A4A4FF40030012BC2F8401518BFCCF83D -:109610000803C2F8404108BFCCF80403CCF8440367 -:1096200070BD72480068704770B58148056882490E -:10963000804808606C4CD4F84001002601280AD10B -:10964000D4F8080310F4803F05D04FF48030C4F8FC -:109650000803C4F84061D4F8440101280DD1D4F8BE -:10966000080310F4003F08D04FF40030C4F808039A -:10967000C4F84461012007F034FCD4F84801012803 -:109680000DD1D4F8080310F4802F08D04FF48020B7 -:10969000C4F80803C4F84861022007F022FC6748B8 -:1096A000056070BD624810B5046863496148086090 -:1096B00057490878002808BF03201AD0514A4FF0B4 -:1096C00000401060504AC00BC2F808034F4B002006 -:1096D0001860C2F840014FF0E02C9315CCF88031AF -:1096E000C2F8000208704A78002A1CBF48700020A7 -:1096F00001D007F0F6FB5148046010BD4FF0E021A7 -:109700004FF08070C1F8000270474FF0E0214FF039 -:109710008070C1F8800270474FF0E0214FF40010D4 -:10972000C1F8000270474FF0E0214FF40010C1F87B -:10973000800270473449012008614FF0E0210002A7 -:10974000C1F88002704730494FF47C10C1F808031B -:1097500000200146820002F1804202F50042C2F878 -:109760004015C2F84011401CC0B20628F2D3704721 -:10977000410A43F609525143C0F3080010FB02F0BE -:1097800000F5807001EB50207047430B48F2376CB6 -:1097900003FB0CF31B0C4FEA432CC1F800C0DFF8AD -:1097A000A0C003FB0C0327484CF2F72C5843400D94 -:1097B00010FB0CFC0CEB432303F580735B1213705E -:1097C0000A68104408607047194810B504681A49BF -:1097D0001848086007F01EFF1848046010BD00001C -:1097E0000BE000E018E000E000B0004004B50040ED -:1097F0004081004044B1004048B1004048B50040BD -:1098000040B5004008F50140008000404085004020 -:109810002C00002044B5004008B000400485004002 -:10982000088500401085004004F5014004B0004068 -:109830001005024001000001180502401405024015 -:10984000F7C2FFFF6F0C010010B5EFF3108000F0BE -:10985000010472B6EB484178491C417040780128F8 -:1098600001D108F03BFB002C00D162B610BD70B5F1 -:10987000E44CE07848B90125E570FFF7E5FF08F012 -:1098800035FB20B1002008F011FB002070BD4FF027 -:1098900080406571C0F80453F7E770B5EFF31080AE -:1098A00000F0010572B6D74C607800B9FFDF607830 -:1098B000401E6070607808B908F014FB002D00D1DC -:1098C00062B670BDCF4810B5C17821B10021417199 -:1098D000C170FFF7E2FF002010BD10B5044608F08C -:1098E00005FBC849C978084000D00120206000204D -:1098F00010BD2DE9F05FDFF80C934278817889F88C -:109900000620002589F80710064689F808500078D7 -:109910002F4620B101280FD002280FD0FFDF08F01A -:10992000F2FA98B108F0F6FAA8420FD1284608F0EA -:10993000F5FA0028FAD047E00125F0E7FFF784FFA9 -:1099400008F0D4FA0028FBD00225E8E701208407BC -:10995000E060C4F80471AC490D600107D1F844120D -:10996000A94AC1F3423124321160A7494FF0020BDA -:1099700034310860C4F804B3A060DFF890A2DAF8CC -:109980000010C94341F3001101F10108DAF8001099 -:1099900041F01001CAF8001000E020BFD4F8040123 -:1099A0000028FAD0284608F0B9FA0028FAD0B8F111 -:1099B000000F05D1DAF8001021F01001CAF80010EC -:1099C000C4F808B3C4F8047199F807004C4670B1A4 -:1099D000307860B908F08AFA064608F07BFC6FF030 -:1099E000004116B1C4E9031001E0C4E9030115B157 -:1099F0002771BDE8F09F01202071BDE8F05F00F005 -:109A0000DFB870B5050000D1FFDF4FF080424FF0A6 -:109A1000FF30C2F808030021C2F80011C2F8041197 -:109A2000C2F80C11C2F81011764C617008F064FA9B -:109A300010B10120E07060702846BDE8704058E722 -:109A40002DE9F0410125AF077D616E4CE079F0B161 -:109A5000012803D0217A401E814218DA08F046FA24 -:109A6000064608F037FCE179012902D9217A491C20 -:109A700021720EB1216900E0E168411A022902DA7F -:109A800011F1020F0EDC0EB1206100E0E060FFF783 -:109A9000DBFE08F02BFA10B13D61A57000E02570E7 -:109AA00000202072BDE8F0812DE9F05F5848D0F821 -:109AB00000B0574A5749083211608406D4F80801AB -:109AC00010B14FF0010801E04FF00008D4F8000198 -:109AD00000B101208146D4F8040108B1012600E05C -:109AE0000026D4F80C0100B101208246D4F8100100 -:109AF00008B1012700E0002748EA090126EA010031 -:109B000020EA0A00B84300D0FFDF0025B8F1000FBB -:109B100004D0C4F80851012008F0C8F9DFF8E48047 -:109B2000B9F1000F13D0C4F8005198F8050020B126 -:109B300088F80550002008F0B9F998F8000030B115 -:109B400008F0D4F918B1012088F8020020610EB1A4 -:109B5000C4F80451BAF1000F0AD0C4F80C5198F8B7 -:109B60000200464600B9FFDFB5703570FFF795FE7D -:109B700037B1C4F8105198F8040008B1FFF760FF3E -:109B80002349091DC1F800B033E770B51D4DE878D1 -:109B900008B908F0A7F901208407A061A87850B19E -:109BA000D4F80C0120B9002008F0B8F90028F7D14A -:109BB0000020C4F80C014FF0FF30C4F8080370BD5A -:109BC0002DE9F0411926B507C5F808630124AC61F9 -:109BD0000020C5F80001C5F80C01C5F8100108F017 -:109BE00085F9084F10B1BC702C6100E03C70FFF7A4 -:109BF0002BFE0549B87920310860C5F804636C6113 -:109C000050E70000300000201805004010ED00E093 -:109C1000100502400100000110B50D2000F06FF8A2 -:109C2000C4B26FF0040000F06AF8C0B2844200D001 -:109C3000FFDF3A490120086010BD70B50D2000F02B -:109C400048F8374C0020C4F800010125C4F804533B -:109C50000D2000F049F825604FF0E0216014C1F8B4 -:109C6000000170BD10B50D2000F033F82C48012123 -:109C700041600021C0F80011BDE810400D2000F047 -:109C800033B8284810B504682649274808310860C9 -:109C90002349D1F80001012804D0FFDF2148001D2D -:109CA000046010BD1D48001D00680022C0B2C1F84C -:109CB000002108F024FAF1E710B51948D0F8001196 -:109CC0000029FBD0FFF7DDFFBDE810400D2000F0BC -:109CD0000BB800F01F02012191404009800000F103 -:109CE000E020C0F88011704700F01F020121914070 -:109CF0004009800000F1E020C0F880127047002881 -:109D000006DA00F00F0000F1E02090F8140D03E0F7 -:109D100000F1E02090F800044009704704D50040AD -:109D200000D00040100502400100000110B52020C5 -:109D300000F075F8202000F07DF84449202081F8DB -:109D40000004434900060860091D42480860F7F70F -:109D5000D9FA3F49C83108603F48D0F8041341F0B0 -:109D60000101C0F80413D0F8041341F08071C0F869 -:109D70000413364901201C39C1F8000110BD10B58B -:109D8000202000F04CF8324800210160001D0160E5 -:109D90002F4A481EE83A10602F4AC2F808032C4B9D -:109DA000C8331960C2F80001C2F860012B4908608D -:109DB000BDE81040202000F03DB825492848EC3986 -:109DC0000860704722492648E8390860704770B536 -:109DD0001F4A8069E83A224911601F49D1F80061A1 -:109DE0000023204D1D4A5C1E1EB1A84206D300214F -:109DF0000FE0D1F8606186B1A84209D2C1F8003104 -:109E0000C1F860311460BDE87040202000F012B845 -:109E10001168BDE8704015F029BCFFDF70BD00F08F -:109E20001F02012191404009800000F1E020C0F8AC -:109E30008011704700F01F0201219140400980000D -:109E400000F1E020C0F880127047000020E000E040 -:109E500000060240441300200000024000040240BB -:109E600001000001000002004FF0E0214FF00070FF -:109E7000C1F88001C1F88002384B802283F80024A9 -:109E8000C1F80001704700B502460420344903E0E0 -:109E900001EBC0031B792BB1401EC0B2F8D2FFDF2B -:109EA000FF2000BD41F8302001EBC00100224A71C3 -:109EB0008A7101220A7100BD294A002102EBC0000B -:109EC0000171704710B50446042800D3FFDF244811 -:109ED00000EBC4042079012800D0FFDF6079A1796C -:109EE000401CC0B2814200D060714FF0E0214FF0C1 -:109EF0000070C1F8000210BD2DE9F0411948056855 -:109F000018491948083108601448042690F80004DC -:109F1000134F4009154C042818D0FFDF16E02178B4 -:109F200007EBC1000279012A08D1427983799A426C -:109F300004D04279827157F8310080472078401C64 -:109F4000C0B22070042801D300202070761EF6B223 -:109F5000E5D20448001D0560BDE8F08119E000E08D -:109F6000CC05002010050240010000014400002043 -:109F70000F4A12680D498A420CD118470C4A1268E0 -:109F80000A4B9A4206D101B508F072F9FFF715FFA6 -:109F9000BDE80140074909680958084706480749CC -:109FA000054A064B7047000000000000BEBAFECA1A -:109FB000A0000020040000204812002048120020C9 -:109FC00018B1172802D207207047172008490880C7 -:109FD0000020704706480088704770B50C4605465B -:109FE00000F0B7FB21462846BDE8704001F072BC86 -:109FF00046000020FE4B586019721A80C90015F007 -:10A000000ABB10B504460E2115F0E3FA1720208193 -:10A01000207B40F00A00207310BD4FF6FF720A80CB -:10A020000146032008F05DBB7047027BD30701D1D6 -:10A03000920703D4408908800020704705207047AC -:10A04000027B920700D541817047014600200988B4 -:10A0500047F2FE12114200D00120E549497A002959 -:10A0600001D040F00800704700B50346007BC007F0 -:10A0700001D0052000BD19811846FFF7E6FFC00793 -:10A0800003D0187B40F004001873187B40F00100E7 -:10A090001873002000BD027B520700D509B100896A -:10A0A000704717207047027B61F3C3020273704749 -:10A0B0002DE9F04F0E46017804464FF0010B0BFAE4 -:10A0C00001F047F2FF1100EA010961681D464FF6F1 -:10A0D000FF73088887B09646984206D0B9F1000F02 -:10A0E00007D047F2FE12104203D0012007B0BDE8AE -:10A0F000F08F40EA090008804FF0000A8DB185F822 -:10A1000000A02078002705220221102874D2DFE861 -:10A1100000F0730D323C516B747E51C8C49ACCFD73 -:10A12000FCFB20780B28ECD00420DFE76068B4F853 -:10A130000880007B80077DD5B8F1170F4CD3FFF75F -:10A1400049FF4045FAD360684089172801D340454C -:10A1500042D1287820F03F00801C2870A5F80180AB -:10A16000032030806168A1F80A806068017B21F0DB -:10A170000201017334E1042028702089A5F8010050 -:10A180006089A5F8030032802AE1208A3188C01D49 -:10A190001FFA80F84145D1D3062005F8010B20892C -:10A1A000288060896880A089A88007200090238A81 -:10A1B000626941E0082810D0082028702089A5F89D -:10A1C00001006089A5F8030032806A1D694604F128 -:10A1D0000C0006F056F910B1CCE01020EDE7308805 -:10A1E0009DF80010084456E00A2028702089A5F840 -:10A1F000010003203080B2E004E10C2028702089A7 -:10A20000A5F801006089A5F803003280A7E0208945 -:10A21000B6F800C00BEB40021FFA82F8C44576D3B3 -:10A22000B8F1050F73D30E222A7003EA4003CDF86C -:10A2300000B000E08AE0E2686088714600F095FABC -:10A24000A6F80080CCE06A48427A002A7ED0521EEE -:10A2500042724068227AE36800EBC205AA88286847 -:10A26000D3F800C01044A0F1080240F808CC5868A8 -:10A2700050608DF800108DF801A028680290A88821 -:10A28000ADF8040060886946FBF738FAA5F804A029 -:10A29000002E01D050463080A2E0287840F08001A6 -:10A2A0002970287840F04001297060893188C01CED -:10A2B0001FFA80F841455DD3287820F03F00123026 -:10A2C00028702189A5F80110032000906389608817 -:10A2D0007146E26800F049FAA6F800802878410645 -:10A2E0003DD500067CD58DF800B08DF801A03188F1 -:10A2F000CDE9025A091DDFF8F8800420ADF80410FA -:10A30000049098F8080003E055E04BE02BE031E0C2 -:10A310008DF8140060886946FBF7F0F9074630882D -:10A320000C303080022F01D0DFB36EE09DF8142096 -:10A33000D8F8041098F80830404601EBC2019A4260 -:10A3400018D28A88B2B9427A521C00E037E088F805 -:10A3500009200D6030888880A6F800A055E061686B -:10A36000208988803CE0A0893188401D1FFA80F850 -:10A37000414501D2042748E02878714620F03F008B -:10A38000163028702089A5F801006089A5F803001F -:10A390000092A3896088226900F0E7F9A6F800809E -:10A3A000DDE71DE0287820F03F0018302870207A83 -:10A3B0006870318014E060680188090401D40527C1 -:10A3C00023E0C0882189884201D006271DE01E2095 -:10A3D0002870A6F800B06068018821F4004101806F -:10A3E000B9F1000F11D0024861880088830001E0B4 -:10A3F000EC0500200022032008F0D6F861682078E0 -:10A40000887007E0A6F800A003276068018821EAA9 -:10A4100009010180384669E62DE9F04F87B01746FB -:10A42000109C0D0083461E461AD03078C10703D019 -:10A4300000F03F00192801D9012100E00021204649 -:10A44000FFF729FEA8420BD32088A0F57F41FF39F2 -:10A4500006D03078410601D4000603D5082045E631 -:10A46000072043E600208DF800008DF801003078C9 -:10A470006B1E00F03F0C0122A81E4FF0050A4FF0A2 -:10A48000020999B2BCF1200F76D2DFE80CF08C10F3 -:10A49000755F7569758D759E75B875BD75CB75D70A -:10A4A00075E4757575F475F275F175F0758C052D9B -:10A4B00079D104208DF80000A0788DF80400708810 -:10A4C000ADF8060030798DF80100707800F03F009B -:10A4D0000C2829D00ADCA0F10200092863D2DFE8A9 -:10A4E00000F0126215621A621D622000122824D048 -:10A4F00004DC0E281BD01028DAD11BE016281FD050 -:10A500001828D5D11FE02078800701E02078400787 -:10A51000002848DAF1E020780007F9E72078C00643 -:10A52000F6E720788006F3E720784006F0E7207809 -:10A530000006EDE72088C005EAE72088C004E7E7C9 -:10A5400020888004E4E720884004E1E72078800741 -:10A5500029D5032D27D18DF800A0B6F8010083E09E -:10A56000217849071FD5062D1DD381B270780128A7 -:10A5700003D0022817D102E0CCE0022000E0102036 -:10A5800006228DF8002072788DF80420801CB1FB23 -:10A59000F0F2ADF8062092B242438A4203D103970B -:10A5A000ADF80890A9E07BE02078000778D5072176 -:10A5B00098B28DF800108108ADF80410B0EB810F4F -:10A5C0006ED10297ADF8062097E02178C90667D5CD -:10A5D000022D65D381B208208DF800007078022822 -:10A5E0005ED300BFB1FBF0F28DF80400ADF8062099 -:10A5F00092B242438A4253D1ADF808907CE0207871 -:10A6000080064DD5092003E02078400648D50A2071 -:10A610008DF80000A088ADF80400ADF80610ADF884 -:10A62000082069E02078000672D50B20ADF80410F0 -:10A630008DF80000ADF8062002975EE02188C9057C -:10A6400066D5022D64D381B20C208DF8000070789D -:10A6500004285DD3C6E72088C00459D5012D57D101 -:10A660000D208DF80000A088ADF8040045E021E041 -:10A6700026E016E0FFE72088800449D5052D47D362 -:10A680000E208DF80000A088ADF80400B6F8030095 -:10A690006D1FADF80850ADF80600ADF80AA02BE02C -:10A6A00036E02088400433D5012D31D10F208DF8BC -:10A6B000000022E0208800042AD4B6F80100E080DF -:10A6C000207B000724D5032D22D3307800F03F00F3 -:10A6D0001B2819D011208DF80000208840F400407C -:10A6E000A4F80000B6F80100ADF80400ED1E032048 -:10A6F000ADF80650ADF80800039769465846FAF7DA -:10A70000FDFF050008D016E010208DF80000E9E7F5 -:10A71000072510E008250EE0307800F03F001B28E8 -:10A7200009D01D2807D05946032007F0DAFF2088FA -:10A7300000F400402080207B400708D52046FFF72A -:10A7400084FCC00703D1207B20F00400207328463E -:10A75000CCE400B587B0032805D18DF8000088B29D -:10A760006946FAF7CBFF07B000BDF8B51C461546A1 -:10A770000E46069F04F01CFB2346FF1DBCB231466B -:10A780002A46009403F02AFFF8BD00002DE9FF4F90 -:10A790008DB09B46DDE91B47DDF87CA00D46082BFC -:10A7A00005D0E86901F0EFF850B11020C8E020882A -:10A7B000092140F0100020808AF80010022017E0E4 -:10A7C000E96901208871EA694FF420519180E969B3 -:10A7D0008872E96942F601000881E96900208873FE -:10A7E000208840F02000208011208AF800000420FA -:10A7F000804638780A900A2038704FF0020905F137 -:10A8000018004E460C9001F069FB444678E000BF0A -:10A81000BBF1100F0CD1022E0AD0A9EB0400801C52 -:10A8200080B20090022305AA1E990D9801F09BF8B2 -:10A83000BDF816101A98814203D9FE4800790F908E -:10A8400004E003D10A9808B138702DE0CDF80090EB -:10A850004FF002030DF116021E990D9801F083F8D6 -:10A860001D980088811BA1EB080083B2C8F1FF008E -:10A87000984200D2034609EB0801002089B2CDE9D5 -:10A8800002101E9A0F9800900DF12C0C0192CDF839 -:10A8900010C0BDF8161000220D9801F0A2FB387010 -:10A8A00050B1C0B2832803D0BDF81600288334E02D -:10A8B000022011B0BDE8F08FBDF82C00022E00EB95 -:10A8C0000801CCB20CD09AF80110A14205D1BDF814 -:10A8D0002010814206D0FF2C04D09AF801401EE0DF -:10A8E0008AF80140D34800680178052902D1BDF8F3 -:10A8F0001610818009EB04001FFA80F9301986B226 -:10A90000DDE90C1005AB0F9A01F0EBFA28B91D98A0 -:10A910000088801BA042BFF67BAF022E11D0BBF196 -:10A92000100F0AD1A9EB0400801C80B20090022312 -:10A9300005AA1E990D9801F016F81D9806800020B2 -:10A9400038700020B5E72DE9F8439C46089E134671 -:10A950000027B26B9AB3491F8CB2F18FA1F57F45E6 -:10A96000FF3D05D05518AD882944891D8DB200E002 -:10A9700000252919B6F83C800831414520D82A44E1 -:10A98000BCF8011022F8021BBCF8031022F8021BCD -:10A99000984622F8024B914604F0F8F94FF00C0C5F -:10A9A00041464A462346CDF800C003F0DEFDF58758 -:10A9B000B16B00202944A41D2144088003E001E07C -:10A9C000092700E083273846BDE8F88310B50B88D7 -:10A9D000848F9C420CD9846BE018048844B184882D -:10A9E00024F40044A41D23440B801060002010BDFB -:10A9F000822010BD2DE9F0478AB000259046894697 -:10AA00008246ADF8185007274BE0059806888088E5 -:10AA1000000446D4A8F8006007A8019500970295A5 -:10AA2000CDE903504FF4007300223146504601F047 -:10AA3000D8FA04003CD1BDF81800ADF82000059804 -:10AA400004888188B44216D10A0414D40195029571 -:10AA5000039521F400410097049541F48043428816 -:10AA60002146504601F093F804000BD105988188E7 -:10AA700041F40041818005AA08A94846FFF7A6FFD6 -:10AA80000400DCD000970598029501950395049584 -:10AA90000188BDF81C300022504601F078F8822C65 -:10AAA00006D105AA06A94846FFF790FF0400ACD0DE -:10AAB000ADF8185004E00598818821F400418180A8 -:10AAC00005AA06A94846FFF781FF0028F3D0822C8B -:10AAD00003D020460AB0BDE8F0870020FAE710B5A1 -:10AAE0000C46896B86B051B10C218DF80010A18FF6 -:10AAF000ADF80810A16B01916946FBF75BFC0020E3 -:10AB00004FF6FF71A063E187A08706B010BD2DE965 -:10AB1000F0410D460746896B0020069E1446002929 -:10AB200011D0012B0FD1324629463846FFF762FF7C -:10AB3000002808D1002C06D0324629463846BDE808 -:10AB4000F04100F02FBFBDE8F081F8B51D46DDE90A -:10AB5000067CDDE90864531DBCF800E09BB29E450D -:10AB600001D20720F8BDACF80030172304F8013BF0 -:10AB7000134621806580052100913A46314600F058 -:10AB8000F2FE0020F8BD10B50C464821204614F016 -:10AB900042FD04F1080044F81C0F00204FF6FF713D -:10ABA000E061618420841720A08494F8280040F09C -:10ABB0000A0084F8280010BD4FF6FF720A80014693 -:10ABC000042007F08EBD30B585B00C460546FFF772 -:10ABD00086FFA18E284629B101218DF80010694613 -:10ABE000FBF7E8FB0020E0622063606305B030BD46 -:10ABF00090F84420920703D44088088000207047D2 -:10AC00000620704790F84420920701D5A0F8421022 -:10AC100070470146002009880A0700D5012011F07D -:10AC2000F00F01D040F00200CA0501D540F0040049 -:10AC30008A0501E04800002001D540F010004A05D7 -:10AC400001D540F02000090501D540F040007047D3 -:10AC500000B5034690F84400C00701D0062000BDAF -:10AC6000A3F840101846FFF7D4FF10F0760F05D078 -:10AC700093F8440040F0040083F8440013F8440FB4 -:10AC800040F001001870002000BD90F844205207E9 -:10AC900000D511B1B0F8400070471720704710F888 -:10ACA000442F61F3C302027070472DE9FF4F9DB03E -:10ACB0000E00DDE92D34DDE92A5725D02878C107BB -:10ACC00003D000F03F00192801D9012100E0002144 -:10ACD0002046FFF7DAFFB04216D3287841060FD49A -:10ACE00000F03F011E2909D0228812F47F6F0BD19A -:10ACF000398849B1A2F57F41FF3905D0010606D553 -:10AD000000F03F00122802D0042021B0D2E5F9491A -:10AD10001F984FF0000908718DF818908DF8309049 -:10AD20000CAA0A60ADF81C90ADF8289029789A46D4 -:10AD300001F03F0C701F032204F11803CB464FF0C3 -:10AD400004084FF0060E1693BCF11F0F7DD2DFE80A -:10AD50000CF07C7C107C257CA57CEF7CEE7CED7C73 -:10AD6000EC7CEF7CEB7C7C7CEA7CE97C7C7C7C7CF6 -:10AD7000E80094F84410B5F80100890701D5032EC6 -:10AD800002D08DF8188025E34FF40061ADF828104B -:10AD900060808DF83020ADF83400F3E2052EF0D15C -:10ADA000B5F801002083ADF81C00B5F803106183ED -:10ADB00008B1884201D9012077E184F80AB0A4F8EB -:10ADC00008B04FF6FF702084169801F087F8052030 -:10ADD0008AF8000002208046039011AB1F9A169952 -:10ADE0001D9801F07EF888BB9DF84A00012804D028 -:10ADF00002218AF80110102003E001208AF80100E6 -:10AE000002208346002201A912A805F03AFBD8BB14 -:10AE10009DF80400834537D13A88801CA2EB0801D5 -:10AE2000814231DB0398009002230DF146022C99F8 -:10AE30001D9800F098FD039808F10208801C80B26C -:10AE4000039018AA01A912A801E0A4E21FE005F0EE -:10AE500018FB039800909DF8043018AA2C991D98AF -:10AE600000F081FD9DF8041011AB08EB01001FFA02 -:10AE700080F803981F9A084480B2039016991D9891 -:10AE800001F02FF80028BDD0B8F1020F03D10A203D -:10AE90008DF8180071E2A7F800806EE2072EFFF42B -:10AEA00070AFB5F801002083ADF81C00B5F80310B1 -:10AEB000618300283FF47FAF88423FF67CAF4FF0BC -:10AEC000010884F80A80B5F8050020810020A073ED -:10AED000E06900F058FD80B9E16942F6010081F8AF -:10AEE0000680E2694FF420519180E16981F80A807F -:10AEF000E1690881E16900208873F01F20842098AF -:10AF00004FF007086062A4F82280169800F0E6FF70 -:10AF10008AF800804FF0010B0020D846ADF84600BB -:10AF200029E016E2AAE13FE1E6E00FE2ACE087E0CB -:10AF300048E000BFB8F1010F13D0E0698079012823 -:10AF400003D1BDF84400ADF80E00042303AACDF8E8 -:10AF500000B02C991D9800F006FD0BF104001FFABB -:10AF600080FBBDF84600ADF80C00ADF80E0008F10E -:10AF700004001FFA80F811AB1F9A16991D9800F073 -:10AF8000B0FF20B93988A1EB08000428D2D2B8F16B -:10AF9000010F3FF47CAFE0698079012805D0BDF84E -:10AFA0004410A1F57F40FF3803D1BDF84400ADF84F -:10AFB0000E00042303AACDF800B02C991D9800F0D0 -:10AFC000D2FC68E7072E02D0152E7FF4DAAEB5F872 -:10AFD00001102183ADF81C10B5F80320628300290D -:10AFE0003FF4E9AE91423FF6E6AE0121A172A4F82A -:10AFF00008B084F80EB0052E07D0C0B2691DE26912 -:10B0000005F020FA00287FF442AF4FF6FF7020844D -:10B010002C99CDF814A0CDE9037106AA0AA9CDF8A0 -:10B0200000B0CDE901122878214600F03F031F9AB5 -:10B030001D98FFF7ABFB8146208BADF81C009CE10F -:10B04000032EC2D14020ADF82800B5F801102183AD -:10B05000ADF81C1005A8DDF8B0C0CDE903B00123A0 -:10B06000CDE901C31F98009038880022401E83B2AA -:10B070001D9800F0B6FF8DF8180080BB0B218AF8F0 -:10B080000010BDF8140033E0052E9ED18020ADF8ED -:10B090002800B5F801102183B5F803002084ADF82D -:10B0A0001C10B0F5007F03D907208DF8180091E13E -:10B0B00040F47C42228412A8DDF8B080CDE903B0D0 -:10B0C0004FF0010CCDE9018C1F9800903888401E8C -:10B0D00083B21D9800F085FF8DF8180018B1832801 -:10B0E000ADD10220C8E00D218AF80010BDF848005B -:10B0F000401C29E148000020C80900EB400002EB99 -:10B100008000B04204D948067FF53BAE58461BE1AB -:10B11000B5F801C0ADF81CC02978490607D58DF8EF -:10B1200030E02978090605D58DF830B036E10721E1 -:10B130008DF83010209B03220193CDE9022B1F993B -:10B14000A6EB0008CDF810B000911FFA88F300229A -:10B1500061461D9800F01BFD8DF818008DF830B089 -:10B16000297849060DD52088C00506D5208BBDF865 -:10B170001C10884201D1C4F824B058468DF818B08C -:10B18000E2E0832801D14FF002094FF48070ADF85E -:10B190002800BDF81C002083A4F82080209860625D -:10B1A000032060841321CCE0052EFFF4EAADB5F84E -:10B1B0000110ADF81C10A28F5AB3A2F57F43FE3BDD -:10B1C00027D008228DF83020DDF880C00523CDE996 -:10B1D000023BCDF804C0CDF810B01F9A80B240F405 -:10B1E00000430092D846B5F803201D9800F0CFFC2C -:10B1F0004FF400718DF818008DF83080ADF82810EC -:10B20000832810D0F8B1A08FA0F57F41FE3907D078 -:10B21000E0E00B228DF830204FF6FE72A287D3E7D4 -:10B22000A4F83C80D6E02B4600943146209A1D9825 -:10B23000FFF789FB8DF8180008B183284CD1BDF8C1 -:10B240001C0020834DE72B4600943146209A1D9820 -:10B25000FFF779FB8DF81800F0BBE18FA06B084475 -:10B26000831D2C99CDE90037CDE9021A43888288E5 -:10B2700001881D98FFF769FC81467EE095F8018002 -:10B28000022E7DD15FEA080002D0B8F1010F77D11C -:10B2900009208DF8300007A800908DF834804346CF -:10B2A000002221461D98FFF732FC8DF835008DF8FD -:10B2B00036B050B9B8F1010F12D0B8F1000F04D177 -:10B2C000A18FA1F57F40FF380AD0A08F40B18DF843 -:10B2D00030B04FF4806000E04FE0ADF828000DE0A2 -:10B2E0000CA91D98FBF766F881464FF480608DF835 -:10B2F00030B0ADF82800B9F1020F06D0FE48006862 -:10B30000807928B18DF8180041E0A4F8188047E052 -:10B31000B9F1000F03D081208DF8180040E007A894 -:10B3200000904346012221461D98FFF7F0FB8DF85F -:10B33000180021461D98FFF7D2FB9DF81800E0B9D0 -:10B3400019218AF800100120388016E08DF818E0E5 -:10B3500040E02078000721D5012E1FD10A208DF86A -:10B360003000E088ADF8340004201D9907F0B9F9E9 -:10B370000820ADF82800A7F800B09DF8300000E0E4 -:10B380000CE020B10CA91D98FBF714F88146B9F127 -:10B39000000F1CD004E048067FF5F3AC4FF0040921 -:10B3A0002088BDF8281008432080BDF828008005BB -:10B3B0000BD5A18FA1F57F40FE3806D12098E06221 -:10B3C0002A982063A6864FF0030948469DE49DF81D -:10B3D000180078B101208AF8000029788AF8011055 -:10B3E000BDF81C10AAF802109DF818008AF8040095 -:10B3F000052038802188BDF8280081432180E4E7BA -:10B400002DE9FF4F8846097895B0012088404FF21A -:10B410000901249C0840ADF820002188DDF888A0AF -:10B42000A1F57F424FF00009FF3A02D028B108078A -:10B4300003D5012019B0BDE8F08F239E4FF0000B1B -:10B440000EA886F800B018995D460988ADF834104A -:10B45000A9498DF81CB0179A0A718DF838B00860A8 -:10B4600098F80000012834D0022809D003287DD1A3 -:10B47000307820F03F001D303070B8F80400E080D4 -:10B4800098F80000022804D1307820F03F001B30EB -:10B49000307094F84400000768D503210720CDE9F7 -:10B4A000000ACDE9021B05ABBDF834000493C01EB1 -:10B4B00083B2B8F804100022159800F092FD00281D -:10B4C000D5D1B8F80400A6F80100BDF81400C01CDE -:10B4D000FAE098F805108DF81C1098F8040001287F -:10B4E00006D04FF4007902282BD00328BFD163E1A6 -:10B4F0002088B8F8087010F40060ADF8200035D04E -:10B50000172F1CD3FEF766FDB84218D3B4F84200DB -:10B51000172801D3B84212D1307820F03F00C01C68 -:10B520003070A6F801700320ADF83400A4F8427022 -:10B5300094F8440020F0020084F844005AE1052504 -:10B5400073E1208808F1080700F4FE60ADF82000E0 -:10B5500010F0F00F1DD010F0C00F03D03888228BF0 -:10B560009042ECD1A9B9B878C00700E057E110D0FB -:10B57000B9680720CDE902B1CDF804B00090CDF84C -:10B5800010B0FB88BA883988159800F000FB0028B5 -:10B59000D5D1BDF8200080284AD006DC10280DD077 -:10B5A00020280BD040288BD124E0B0F5807F66D0D6 -:10B5B00048457DD0B0F5806F98D1D6E0C00601D562 -:10B5C000082000E0102081460DA907AA0520CDE93A -:10B5D00002218DF83800ADF83CB0CDE904A608A9E9 -:10B5E0003888CDE900014B46072221461598FFF720 -:10B5F000CDF89FE09DF81C004FF00A0900289DD16E -:10B6000001210720CDE9000ACDE9021B05ABBDF8F9 -:10B6100034000493401E83B2218B0022159800F061 -:10B62000E0FC8DF81C000B203070BDF814001CE00D -:10B630009DF81C004FF00C0900281FD101210720A4 -:10B64000CDE9000ACDE9021B13AB0493BDF8340029 -:10B65000228C401E83B2218B159800F0C2FC8DF81D -:10B660001C000D203070BDF84C00401CADF83400BB -:10B6700005208DF83800208BADF83C00BAE0388802 -:10B68000218B884284D19DF81C004FF012090028BC -:10B690001CD1606AA8B1B878C0073FF450AFBA684F -:10B6A000CDF804B0CDE902B20720CDF810B000E02B -:10B6B0000DE00090FB88BA88159800F068FA8DF8C4 -:10B6C0001C00132030700120ADF8340092E039885E -:10B6D000208B8142D6D19DF81C004FF0160900281E -:10B6E000A06B0BD0F0B34FF6FF7100205F46ADF8B2 -:10B6F00008B0009129E000004800002068B1B97846 -:10B70000C907BFD1E18F0DAB0844821D03968DE8B8 -:10B710000C0443888288018809E0B878C007BCD04F -:10B72000BA680DAB03968DE80C04BB88FA881598AF -:10B73000FFF70BFA05005DD0072D71D075E0009181 -:10B7400005AA02A92046FFF741F9E28FBDF80810CB -:10B750008A4201D00028F2D0E08FA16B0844078014 -:10B76000009800E046E0E08744E09DF81C004FF0C0 -:10B77000180940B1208BC8B138882083214615981C -:10B78000FFF7ADF936E004F118000090237E0122A6 -:10B7900021461598FFF7BBF98DF81C000028EDD164 -:10B7A000192030700120ADF83400E7E70525214667 -:10B7B0001598FFF794F938E0208800F40070ADF890 -:10B7C000200048452BD1A08FA0F57F41FE3998D1AC -:10B7D000D8F808004FF0160948B1A063B8F80C106B -:10B7E000A1874FF6FF71E187A0F800B002E04FF6A5 -:10B7F000FF70A087BDF8200030F47F611AD0782355 -:10B8000000220420159906F0CFFE98F80000207160 -:10B810002088BDF82010084320800EE000E00725B6 -:10B820002088BDF8201088432080208810F47F6F86 -:10B830001CD03AE02188814321809DF8380020B156 -:10B840000EA91598FAF7B6FD05469DF81C000028CC -:10B85000EBD086F8019001203070208B70809DF82D -:10B860001C0030710520ADF83400DEE7A18EE1B197 -:10B8700018980DAB0088ADF834002398CDE9030487 -:10B88000CDE9013A206B0090E36A179A1598FFF70B -:10B890000CFA054601208DF838000EA91598FAF724 -:10B8A00089FD00B10546A4F834B094F8440040077F -:10B8B0000AD52046FFF7ADF910F0760F04D114F841 -:10B8C000440F20F0040020701898BDF83410018057 -:10B8D0002846AFE500B585B0042806D102208DF8D2 -:10B8E000000088B26946FAF765FD05B000BD10B5E5 -:10B8F0003F4C0B782268012B02D0022B2AD111E099 -:10B9000013780BB1052B01D10423137023688A88A7 -:10B910009A802268CB88D38022680B891381498959 -:10B9200051810DE08B8893802268CB88D380226878 -:10B930000B8913814B8953818B899381096911612B -:10B940002168FAF737FD226800210228117003D020 -:10B95000002800D0812010BD832010BD806B0028FE -:10B9600000D001207047F8B51C4615460E46069FCC -:10B9700003F01EFA2346FF1DBCB231462A4600944E -:10B9800002F02CFEF8BD8178012909D10088B0F5BC -:10B99000205F03D042F60101884201D100207047A8 -:10B9A00007207047F0B587B0002415460E460746BD -:10B9B000ADF8144010E0069801882980811DCDE97A -:10B9C00002410721019404940091838842880188F0 -:10B9D000384600F0DCF830B906AA05A93046FEF773 -:10B9E000F5FF0028E7D0822800D1002007B0F0BD85 -:10B9F0004800002010B58B7883B102789A4205D1B7 -:10BA00000B885BB102E08B79091D4BB18B789A42B0 -:10BA1000F9D1B0F801300C88A342F4D1002010BD58 -:10BA2000812010BD072826D012B1012A27D103E0BA -:10BA3000497801F0070102E04978C1F3C201052904 -:10BA40001DD2DFE801F00318080C12000AB1032030 -:10BA500070470220704704280DD250B10DE0052830 -:10BA600009D2801E022808D303E0062803D0032849 -:10BA700003D005207047002070470F2070478120B9 -:10BA8000704710B513880B800B781C061FD5FA4C35 -:10BA9000A47A844204D843F010000870002010BD3E -:10BAA00094682478C44064F304130B701378D1783D -:10BAB00003F0030341EA032140F20123B1FBF3F455 -:10BAC00003FB1411926800FB0120401C10BD90681C -:10BAD00010BD37B5BDF8041011809DF8045029063B -:10BAE0001BD5E54901239468897A814209D8FE284B -:10BAF0000FD1E80602D58B405B1E00E000232370C7 -:10BB000007E0217883409943C5F30013834019432C -:10BB10002170107820F0100010703EBD2DE9F0412A -:10BB20000746C81C0E4620F00300B04202D0862013 -:10BB3000BDE8F081082A01D90E20F9E7CE4D00209A -:10BB400034462E60AF802881AA72E8801AE0E98826 -:10BB5000491CE980810614D4E17800F0030041EA31 -:10BB6000002040F20121B0FBF1F201FB120120683C -:10BB700000F037FB2989084480B22881381A304404 -:10BB8000A0600C3420784107E1D40020D0E72DE9F3 -:10BB9000FF4F89B01646DDE9168A0F46994623F411 -:10BBA0004045084600F00DFB04000FD0099802F054 -:10BBB0005BFF0290207800060AD5AF48817A029890 -:10BBC000814205D887200DB0BDE8F08F0120FAE74B -:10BBD000224601A90298FFF754FF834600208DF802 -:10BBE0000C004046B8F1070F1AD001222146FFF79A -:10BBF00019FF0028E7D12078400611D502208DF8E2 -:10BC00000C00ADF81070BDF80400ADF81200ADF8EE -:10BC100014601898ADF81650CDF81CA0ADF81800B7 -:10BC20005FEA094004D500252E46A84601270CE00E -:10BC30002178E07801F0030140EA012040F201217F -:10BC4000B0FBF1F2804601FB12875FEA494009D55B -:10BC5000B84507D1A178207901F0030140EA01201D -:10BC6000B04201D3BE4201D90720ACE7A8191FFAA0 -:10BC700080F9B94501D90D20A5E79DF80C0028B140 -:10BC800003A90998FAF794FB00289CD1B84507D17D -:10BC9000A0784FEA192161F30100A07084F80490A4 -:10BCA0001A9800B10580199850EA0A0027D019980F -:10BCB00030B10BEB06002A46199913F013FC0EE085 -:10BCC0000BEB06085746189E099803F05FF82B46C1 -:10BCD000F61DB5B239464246009502F046FC2246B2 -:10BCE00001A90298FFF7CDFE9DF80400224620F03E -:10BCF00010008DF80400DDE90110FFF7EAFE0020D6 -:10BD000061E72DE9FF4FDFF8709182461746B9F8D9 -:10BD10000610D9F8000001EB410100EB810440F26C -:10BD20000120B2FBF0F185B000FB11764D46DDF845 -:10BD30004C803146069800F054FA29682A898B46CF -:10BD4000611A0C3101441144AB8889B28B4202D88C -:10BD5000842009B038E70699CDB2290603D5A90693 -:10BD600001D58520F5E7B9F806C00CF1010C1FFAE2 -:10BD70008CFCA9F806C0149909B1A1F800C0A90665 -:10BD800002D5C4F8088007E0104480B2A9F8080082 -:10BD9000191A01EB0B00A0602246FE200699FFF75E -:10BDA00098FEE77026712078390A61F30100320AA3 -:10BDB000A17840F0040062F30101A17020709AF8AC -:10BDC00002006071BAF80000E080002626732806A1 -:10BDD00002D599F80A7000E00127A80601D54FF0B6 -:10BDE00000084D4600244FF007090FE0CDE9026836 -:10BDF0000196CDF800900496E9882046129B089A97 -:10BE0000FFF7C5FE0028A4D1641CE4B2BC42EDD308 -:10BE100000209EE72DE9F047804600F0D2F90700A8 -:10BE200005D000264446144D40F2012916E00120B9 -:10BE3000BDE8F087204600F0C4F90278C17802F02E -:10BE4000030241EA0222B2FBF9F309FB1321006865 -:10BE500000F0C7F93044641C86B2A4B2E988601EC1 -:10BE60008142E7DCA8F10100E8802889801B288155 -:10BE700000203870DCE70000F805002010B51446FB -:10BE800031B1491E218002F0EFFDA070002010BDED -:10BE9000012010BD10B5DA4904460088CA889042D6 -:10BEA00001D3822010BD096800EB400001EB800245 -:10BEB0005079A072D08820819178107901F0030127 -:10BEC00040EA0120A081A078E11CFFF7DAFD2061A3 -:10BED0002088401C2080E080002010BD01210182CC -:10BEE00070472DE9FF4F85B04FF6FF788246A3F8E3 -:10BEF000008048681F460D4680788DF80600486827 -:10BF00000088ADF8040000208DF80A00088A0C882B -:10BF1000A04200D304462C8241E0288A401C28829B -:10BF2000701D6968FFF766FDB8BB3988414501D1CE -:10BF3000601E38806888A04236D3B178307901F02D -:10BF4000030140EA012901A9701DFFF753FD20BB41 -:10BF5000298941452CD0002231460798FFF762FD20 -:10BF6000D8B92989494518D1E9680391B5F80AC0BB -:10BF7000D6F808B05046CDF800C002F007FFDDF853 -:10BF800000C05A460CF1070C1FFA8CFC4B46039973 -:10BF9000CDF800C002F0ACFA50B1641CA4B2204647 -:10BFA00000F00FF90600B8D1641E2C828220D0E682 -:10BFB0007C807079B871F088B8803178F07801F0C1 -:10BFC000030140EA01207881A7F80C90504602F066 -:10BFD0004BFD324607F10801FFF753FD38610020A1 -:10BFE000B7E62DE9FF4F87B081461C469246DDF843 -:10BFF00060B0DDF85480089800F0E3F805000CD03C -:10C00000484602F031FD2978090608D57C49897A2D -:10C01000814204D887200BB0D6E50120FBE7CAF3A4 -:10C0200009062A4601A9FFF72CFD074614980728A0 -:10C030001CD000222946FFF7F5FC0028EBD1287818 -:10C04000400613D501208DF808000898ADF80C00C3 -:10C05000BDF80400ADF80E00ADF81060ADF8124068 -:10C0600002A94846FAF7A4F90028D4D12978E8783B -:10C0700001F0030140EA0121AA78287902F00302C5 -:10C0800040EA0220564507D0B1F5007F04D9611E71 -:10C09000814201DD0B20BEE7864201D90720BAE7C5 -:10C0A000801B85B2A54200D92546BBF1000F01D007 -:10C0B000ABF80050179818B1B9192A4613F012FAC4 -:10C0C000B8F1000F0DD03E4448464446169F02F09A -:10C0D0006FFE2146FF1DBCB232462B46009402F093 -:10C0E0007DFA002097E72DE9F04107461D461646E8 -:10C0F000084600F066F804000BD0384602F0B4FCA5 -:10C100002178090607D53E49897A814203D88720DC -:10C110000EE501200CE522463146FFF7B2FC65B181 -:10C120002178E07801F0030140EA0120B0F5007FBA -:10C1300001D8012000E0002028700020F8E42DE95B -:10C14000F04107461D461646084600F03AF804003E -:10C150000BD0384602F088FC2178090607D528491B -:10C16000897A814203D88720E2E40120E0E4224674 -:10C170003146FFF7AEFCFF2D14D02178E07801F0B6 -:10C18000030240EA022040F20122B0FBF2F302FB7C -:10C19000130015B900F2012080B2E070000A60F3CC -:10C1A000010121700020C3E410B50C4600F009F82D -:10C1B00028B1C18821804079A070002010BD0120E5 -:10C1C00010BD0F49CA88824209D340B1096800EB0B -:10C1D00040006FF00B0202EB800008447047002023 -:10C1E0007047C0B2820609D4000605D50448807A9B -:10C1F0004843401C80B27047084670470020704793 -:10C20000F805002010B50C4601F06AFD80B3204609 -:10C2100000F0A9FA68B322780F2A09D0102A07D0B3 -:10C22000022A05D0032A03D0152A2ED0FFDF1DE0F5 -:10C23000A0781E282DD00EDC0C2824D008DC09287C -:10C2400027D2DFE800F013261726261E1E1A1C0030 -:10C2500012281ED11BE0302819D01ADDA0F13A00B7 -:10C26000032816D2DFE800F011150B00002010BDE6 -:10C2700013E010E043F20200F9E70420F7E70D2095 -:10C28000F5E70F20F3E70820F1E71120EFE707209B -:10C29000EDE70320EBE7FFDFE8E7FFDFE6E700F08D -:10C2A00062BA70B50346002002466FF02F050EE01B -:10C2B0009C5CA4F130060A2E02D34FF0FF3070BD13 -:10C2C00000EB800005EB4000521C2044D2B28A42B1 -:10C2D000EED370BD30B50A240AE0B0FBF4F304FBE2 -:10C2E00013008D18303005F8010C521E1846D2B2DA -:10C2F000002AF2D130BD30B500234FF6FF7510E0B3 -:10C30000040A44EA002084B2C85C6040C0F303140D -:10C31000604005EA00344440E0B25B1C84EA40100F -:10C320009BB29342ECD330BD10B50AF024FA042836 -:10C3300003D00AF020FA052802D108F015FD50B903 -:10C340000AF024FA032803D00AF026FA032804D1BD -:10C3500007F0C2FC08B1012010BD002010BD70B56F -:10C360000C460546062102F0B6FB606008B10020CD -:10C3700006E00721284602F0AEFB606018B10120FC -:10C380002070002070BD022070BD2DE9FC470C46D6 -:10C3900006466946FFF7E3FF00287DD19DF80000BF -:10C3A00050B107F02BFCB0427CD0214630460DF056 -:10C3B000A6FF002873D115E008F022FAB04271D030 -:10C3C000214630460CF089FC002868D1019D95F883 -:10C3D000C800503518B9687E08B1012000E000207F -:10C3E000804603E0019D95F8698050354FF0010AC1 -:10C3F00095F835004FF00009A0B195F83600800798 -:10C4000010D584F8019084F800A084F80290A680EA -:10C4100095F83710A171298F2181698F618185F885 -:10C4200035903CE0304602F0C3FC070000D1FFDF4E -:10C43000384601F068FE10F0FF0008D084F8019043 -:10C440000D212170A680E08084F802A027E030460C -:10C4500002F09CFC070000D1FFDFB8F1000F21D0F3 -:10C46000384601F0E1FEB8B19DF8000038B90198F6 -:10C47000D0F8F0004188B14201D180F800903046F8 -:10C4800007F076FA84F801900A21217084F802906E -:10C49000A680A97EA17100E004E085F81990012032 -:10C4A000BDE8FC870020FBE71CB56946FFF757FF96 -:10C4B00000B1FFDF684601F06CFCFA490020896892 -:10C4C000A1F8CA001CBD2DE9FC4104460E46062019 -:10C4D00002F0ACFA0546072002F0A8FA2844C7B2D9 -:10C4E0000025A8463E4417E02088401C80B22080EA -:10C4F000B04202D34046A4F8008080B2B84204D3D0 -:10C50000B04202D20020BDE8FC816946FFF727FF58 -:10C510000028F8D06D1CEDB2AE42E5D84FF6FF70A2 -:10C5200020801220EFE738B54FF6FF70ADF800001D -:10C530000DE00621BDF8000002F0DFFA04460721F5 -:10C54000BDF8000002F0D9FA0CB100B1FFDF002104 -:10C550006846FFF7B8FF0028EBD038BD2DE9F04161 -:10C56000D1A00679076807F071FA0FF0A5FED04C4C -:10C570004FF00408102024F8388F002560804FF613 -:10C58000FF70208484F82250A08404F8075C04F82B -:10C59000385C04F80A5C04F8045CC5492571C4F8E9 -:10C5A00005703D316672481E0CF04BFDA5721B20D4 -:10C5B000A0814FF4A471E181208261820121217563 -:10C5C00061750A21A17584F81780032121766176AF -:10C5D0000E21A1760721E176062121776177E0839C -:10C5E000BDE8F08170B5AF4C0D466060217007F07A -:10C5F000A7F9FFF798FFFFF7B1FF207809F00DFECC -:10C6000008F0ECF9217860680CF032FC20780EF02C -:10C61000A1FF28460AF006FE07F0FAFA21786068C2 -:10C620000DF04CFFBDE870400FF046BE10B5012480 -:10C630000AB1002010BD21B1012903D000242046F9 -:10C6400010BD022111F00CF9F9E72DE9F0470400C3 -:10C6500000D1FFDF964D002695F8310058B1667085 -:10C660001520207095F83200A07095F83300E07026 -:10C6700085F8316068E0287840B12C22A91C20465A -:10C6800012F030FF0F2020702E705DE095F82E0024 -:10C6900060B10120E07095F82F00A07095F830008F -:10C6A00060701020207085F82E604DE080480221D7 -:10C6B0005C308246FFF707FF00B1FFDFB5F85C9002 -:10C6C000062002F0B3F90746072002F0AFF938441C -:10C6D000C7B2781C00F0FF08B5F85C00B84212D170 -:10C6E000204608F019F850BB95F8340078B366700E -:10C6F000122020702021A01C12F06BFF0220A070DD -:10C7000085F8346020E040451AD1204607F044FA0D -:10C71000E8B12078122817D1A0783C2814D1A0883D -:10C72000072102F0D8F9050000D1FFDF288807F0C3 -:10C730001FF9A088072102F0E0F900B1FFDF03E054 -:10C740002146FFF722FE10B10120BDE8F087FFE788 -:10C7500002215046FFF7B7FE18B9B5F85C104945FD -:10C76000BAD10020F1E770E710B5514C207828B11C -:10C770000A21BDE810400F2001F0D0BAFFF7D4FD28 -:10C7800008B10C2002E00FF0DDFD00202071012037 -:10C7900060710A21E170207010BD70B5444D0446EF -:10C7A000287828B1BDE8704032210F2001F0B6BAD8 -:10C7B000207818B1012801D0122010E001F0BBFA56 -:10C7C00020B10FF00AFF08B10C2008E0207801F03A -:10C7D00095FA04F11703E21D611C0FF00BFE28719E -:10C7E000012068713221E970287070BD70B5304C3D -:10C7F0000546207828B1BDE870400B210F2001F0DC -:10C800008DBA287818B1012801D012200EE0FFF768 -:10C810008BFD08B10C2009E0287801F06FFA691C43 -:10C820000FF057FD08B1002000E007202071012023 -:10C8300060710B21E170207070BD10B51C4C217827 -:10C8400029B13021BDE810400F2001F067BA0088FF -:10C850000FF0C6FE302110B10020207100E02171E0 -:10C8600001206071E170207010BD70B5104C05465C -:10C87000207828B1BDE8704031210F2001F04EBA78 -:10C8800001F059FA08B10C2005E0287800F0010009 -:10C890000FF0A0FE00202071012060713121E170B5 -:10C8A000207070BD50000020FFFFFFFF1F00000040 -:10C8B0000406002010B5F94C207828B13421BDE8D9 -:10C8C00010400F2001F02ABA01F035FA20B10FF024 -:10C8D00084FE08B10C2002E00FF0E3FD002020717F -:10C8E000012060713421E170207010BDEB480178A7 -:10C8F00019B10F21084601F011BA002101710F2171 -:10C900008170C170FF2181714FF6FF710181E4498F -:10C9100049680A7882728A8882814988C1810121A6 -:10C92000417101707047DD490A781AB14A210F2020 -:10C9300001F0F4B90088A1F85800012081F85A00EC -:10C9400000220A7148714A22CA700870704710B5F7 -:10C95000D24C207828B12B21BDE810400F2001F0E7 -:10C96000DDB90821A01D05F0ABFB002020710120DE -:10C9700060712B21E170207010BD70B5C74C21781B -:10C9800029B1BDE8704042210F2001F0C7B990F9EC -:10C990000000042816D0032814D098B1011D11D02E -:10C9A00010F1080F0ED010F10C0F0BD010F1100F7A -:10C9B00008D010F1140F05D010F1280F02D012206A -:10C9C000207103E0002506F0E5F925714220E070B2 -:10C9D00001206071207064E710B5B04C217829B156 -:10C9E0002A21BDE810400F2001F098B9A31D0122B3 -:10C9F00000F1100110F067FB002020710F20A070E3 -:10CA00002A20E07001206071207010BD2DE9FF41E7 -:10CA1000A24C207828B149210F2001F07FF9BDE810 -:10CA2000FF814FF0000884F80680B4F85800ADF894 -:10CA3000040002A9FFF793FC20B1002101A8FFF731 -:10CA400042FDE8BBBDF80400ADF8000002A980B2C9 -:10CA5000FFF785FC00B1FFDFBDF8000002F0A8F988 -:10CA6000050000D1FFDF2846039F01F0E4FB80F0C2 -:10CA7000010697F86950BDF8000002F087F9070039 -:10CA800000D1FFDF384601F0CFFB80F0010255EA0C -:10CA9000020019D0A179BDF8000004EB4101088122 -:10CAA0007E49A3791831585C65F300005854A37986 -:10CAB00062F341005854A27966F38200505400E0BA -:10CAC0000DE0A079401CA07100216846FFF7FBFC37 -:10CAD00028B9BDF80000BDF804108842B6D1012085 -:10CAE00084F8048060714921E170207097E770B587 -:10CAF0006A4C0546207828B1BDE8704045210F20DA -:10CB000001F00CB909F037FE052804D0284609F0D9 -:10CB100071FB002000E00C20207101206071452194 -:10CB2000E1702070BDE670B55C4C0546207828B1F8 -:10CB3000BDE8704043210F2001F0F0B801F0FBF890 -:10CB400038B10C202071012060714321E170207008 -:10CB5000A7E62946002006F07AFF0020F2E770B52C -:10CB60004E4C0546207828B1BDE8704041210F2089 -:10CB700001F0D4B809F0FBFB10B90AF020FE68B14F -:10CB800028780AF09EFB287808F025F9002020710B -:10CB9000012060714121E170207082E60C20F6E7EF -:10CBA00070B53E4C0546207828B1BDE8704017218D -:10CBB0000F2001F0B3B801F0BEF838B10C2020719D -:10CBC000012060711721E17020706AE6294601207A -:10CBD00006F03DFF0020F2E738B5304D04462878D6 -:10CBE00028B1BDE838404D210F2001F097B82279D7 -:10CBF00061798A4215D0A079E379984211D01F2A31 -:10CC00000FD81F290DD80022114611F095FF40B909 -:10CC10000022E079114611F08FFF10B9207A072821 -:10CC200001D9122015E04FF6FF70ADF8000009F0B1 -:10CC3000ADFDA8B909F0B0FD90B909F09CFD78B937 -:10CC400000216846FFF73FFC50B1204605F09EFFEB -:10CC500000202871012068714D21E970287038BDCD -:10CC60000C20F6E72DE9FC470C4C054694F82E0005 -:10CC700020B12821102001F051F811E4282084F877 -:10CC80003000012184F82E10A8784FF000091A28EE -:10CC90002BD014DC162837D204E000000406002054 -:10CCA00050000020DFE800F03030303030213030EC -:10CCB00030303030303030303030302121212A28AF -:10CCC00022D00BDCA0F11E000C281DD2DFE800F002 -:10CCD0001C1C1C1C1C1C1C1C1C1C1C0D3A38042875 -:10CCE00012D2DFE800F0110211022888B0F5706F4F -:10CCF0000AD21F20884684F82F0028886946FFF74B -:10CD00002EFB18B1022019E0122017E09DF8000058 -:10CD1000019F002806D007F58377019E05D106F113 -:10CD2000E90604E007F1E807F7E706F207166846A8 -:10CD300001F024F808B1387818B10C2084F82F00DD -:10CD40009BE787F80080A878307084F82F906846B9 -:10CD500001F01FF891E77CB5FD4C0546207820B125 -:10CD600025210F2000F0DAFF7CBD28886946FFF7F7 -:10CD7000F6FA002160B102202071A1602173E180E8 -:10CD80000F20A0702520E0700120607120707CBD14 -:10CD9000019A104612F1500282F83F108368A36096 -:10CDA000037B237392F83F30002BF5D12888E08075 -:10CDB000E6E710B540B10478406813B1B0F844001C -:10CDC00003E0B0F8460000E0FB201B2908D38142B5 -:10CDD00006D8B2F5A47F03D340F64800824201D9B9 -:10CDE000122010BD002010BD7CB5D94D0446287816 -:10CDF00020B13A210F2000F091FF7CBD01266E7119 -:10CE00001F2028710F20A8703A20E8702E7020880B -:10CE10006946FFF7A4FA08B102200DE0A2886188F4 -:10CE200001236846FFF7C5FF30B9A2886188002357 -:10CE30006846FFF7BEFF08B128717CBD9DF8001061 -:10CE40000020002901990988E9802871019918D0EA -:10CE500081F82961019A6188A2F82E11019AA188AE -:10CE6000A2F83011019A6188A2F82A11019AA188CA -:10CE7000A2F82C11019981F82861019981F8290102 -:10CE80007CBD81F80161019A6188A2F80611019ABE -:10CE9000A188A2F80811019A6188A2F80211019AEA -:10CEA000A188A2F80411019981F80061019981F823 -:10CEB00001017CBD034600200AB1012200E00222EC -:10CEC0001A4204D14A0703D0890700D111207047C4 -:10CED000122070477CB59E4D0446287820B13F2132 -:10CEE0000F2000F01BFF7CBD012068711F212971FC -:10CEF0000F21A9703F21E970287061782078012204 -:10CF0000FFF7D8FF28B9A17820780022FFF7D2FFD9 -:10CF100008B128717CBD617820786B46012200F051 -:10CF200046FFA178207801AB002200F040FF9DF879 -:10CF3000000085F84C009DF8040085F84D000020A5 -:10CF4000E7E770B5824D86B004461F200E4685F88F -:10CF50002F00208803A9FFF702FA08B102200BE096 -:10CF6000E178A0780122FFF7A5FF28B92179A07800 -:10CF70000022FFF79FFF18B185F82F0006B090E45C -:10CF8000E178A07802AB012200F011FF2179A078AE -:10CF90006B46002200F00BFF9DF80C3001203A2276 -:10CFA0000021002B049B93F891301AD0012B31D033 -:10CFB000049A82F83401049A82F83201049880F8C5 -:10CFC0003361049A9DF8080082F83501049A9DF8AF -:10CFD000000082F83601049880F8341185F82F108B -:10CFE000CCE7012B16D0049A82F80C01049A82F83F -:10CFF0000A01049880F80B61049A9DF8080082F8F1 -:10D000000D01049A9DF8000082F80E01049880F842 -:10D010000C11E3E785F82F20B0E71CB54C4991F8D7 -:10D020002E202AB1BDE81C405221102000F076BE0F -:10D03000522281F83020012281F82E200188ADF89B -:10D04000001081788DF80210C1788DF803100179F5 -:10D050008DF80410C088ADF8060000216846FFF77F -:10D0600070FF1CBD2DE9F041394C0546207828B1F0 -:10D07000BDE8F0411D210F2000F050BE1F2020719F -:10D08000012060711D21E170207009F074FB0C26F5 -:10D0900004283CD005283AD0A9791220012904D0CF -:10D0A00019B1022901D0032926D1297809B1012912 -:10D0B00022D1E97929B1012903D0022901D003291C -:10D0C0001AD1698843F6FD720B1F3020934213D2A8 -:10D0D000AB881B1F93420FD22187A8886087002747 -:10D0E000A87907F0B2FD90B1E87907F005FE28783D -:10D0F000012804D030B10CE02071BDE8F08100219E -:10D10000022001E00021012007F025FE08B1267170 -:10D11000F3E72771F1E770B50D4C217829B1BDE82F -:10D1200070401E210F2000F0F9BD1F212171012147 -:10D1300061711E22E270217002781221012A00D052 -:10D140001AB9407830B1012804D0217143E40000BD -:10D150000406002000260C25012A08D009F00BFB4C -:10D16000052802D008F072FF40B1257133E407F0C2 -:10D1700083FD618F208F09F007F9F5E726712AE416 -:10D180002DE9F047FD4C0646B0F84600B4F844508F -:10D190000F46854200D3054696F84D1000F0B5FDC8 -:10D1A0000146B4F84600814205D896F84D10B6F80D -:10D1B000460000F0AAFD8046A146B4F84840B6F803 -:10D1C0004400844200D3044696F84C1000F09DFDC4 -:10D1D0000146B9F84A00814205D896F84C10B6F8D5 -:10D1E000440000F092FD4FF4A4721B2C01D0904239 -:10D1F00003D11B2D08D0904506D0FD80A7F80880EC -:10D200007C80B88001203870BDE8F0872DE9FC5F94 -:10D210000646AFF66C11D94DD1E900A195F82E0064 -:10D22000884628B1BDE8FC5F2121102000F076BDC2 -:10D230001F2085F82F00212085F830004FF0010BCA -:10D2400085F82EB0304600F0BEFD002811D109F05F -:10D2500092FA05280CD009F08EFA042808D095F827 -:10D26000340028B907F0CCFAA0F57F41FF3901D08E -:10D270000C20D4E0062101A801F0FEFB04007CD0C4 -:10D2800003210FF04CFDB5F85600A4F84400B5F8A2 -:10D290005600A4F8460095F84C0084F84A0095F82A -:10D2A0004D0084F84B0095F84F000090B5F85610EB -:10D2B00095F84E3020880A4601F0BFFC04287DD046 -:10D2C00000B1FFDF208806F052FB04F10D07B4F82F -:10D2D00000900421384604F0F3FE494638460FF02A -:10D2E00066FEA7A03F1D006800900321684604F079 -:10D2F00072FE002069460A5C3A54401CC0B2032802 -:10D30000F9D3308A6080708AA080B08AE08095F876 -:10D31000512095F85010012320460FF0FAFF0146E6 -:10D32000204610F05CF84FF0000984F8569084F81D -:10D3300057904F46707900F0E1FC6076D6F8060011 -:10D34000C4F81A007089E083C4F808A084F80C803F -:10D3500084F8F8B004F580712046FFF711FF8DF8CE -:10D3600000700121684604F036FE9DF8000000F0D0 -:10D370000701C0F3C102114400E01DE0C0F34010FA -:10D3800008448DF80000401D2076092801D208309D -:10D390002076002120460FF0C2FC307B07F055FCC0 -:10D3A000A0B107F069FC71793079B21D07F0AFFCCC -:10D3B000070017D023E001E0092030E02088062193 -:10D3C00001F09BFB00B1FFDF072028E0208806F07A -:10D3D000CFFA2088062101F090FB00283FF448AFE7 -:10D3E000FFDF45E72146032007F0B5FC070006D123 -:10D3F00072883188204608F03CFF07000CD0208856 -:10D4000006F0B6FA2088062101F077FB00B1FFDFB5 -:10D4100085F82F70BDE8FC9F484684F8EC9085F8AD -:10D420002F00F7E738B5554C207820B122210F2086 -:10D4300000F074FC38BD1F20207101256571222089 -:10D44000E070257094F8340010BB09F094F90528B9 -:10D4500005D007F0D5F9A0F57F41FF3918D000209D -:10D460002071684608F0D1FF0028E3D100980088B9 -:10D4700006F07EFA00980621008801F03EFB00B11C -:10D48000FFDF404884F834500078FCF71BFD38BDBE -:10D490000C20207138BD2DE9F041384D044695F837 -:10D4A0002E0028B1BDE8F0412321102000F036BC49 -:10D4B0001F2085F82F00232085F83000012085F8F3 -:10D4C0002E00618840F67B438A1F30209A4251D259 -:10D4D000A288961F9E424DD291424BD8E188B1F569 -:10D4E000FA7F47D2218940F67746A1F10A03B34279 -:10D4F00040D2B1EBD20F3DD96189A289914239D88E -:10D500004FF000082088062101F0E5FA06004FF0F0 -:10D51000020707D000F024FC20B1D6F8F000017813 -:10D5200039B902E085F82F70E7E5D6F82C110978B3 -:10D5300009B13A201EE005218171D6F8F00041467C -:10D54000A0F80880D6F8F020A0885081D6F8F02006 -:10D55000E0889081D6F8F0202089D081D6F8F000BC -:10D56000028943899A4204D88279082A01D89A42CA -:10D570000AD3122085F82F00BFE500000406002022 -:10D58000112233005000002022884280D6F8F0009B -:10D59000077085F82F10B0E52DE9FE43FE4C0646D6 -:10D5A000207830B103B02421BDE8F0430F2000F013 -:10D5B000B5BB012565712420E070257030460FF061 -:10D5C00018FD08B1002000E01220207100282BD1A6 -:10D5D00084F83C503068C4F83D00307984F841004C -:10D5E0004FF0000884F83C806946062001F0FFF9FE -:10D5F00000B1FFDF684601F0D8F998B9BDF80470B2 -:10D60000BDF80400062101F066FA060000D1FFDF34 -:10D6100086F8F850684601F0C8F918B9BDF804005A -:10D62000B842EDD184F80480BDE8FE832DE9F041D5 -:10D63000D94D064695F82E0028B1BDE8F0412C21C1 -:10D64000102000F06BBB1F2085F82F002C2085F8E0 -:10D650003000012085F82E003088062101F03BFAC9 -:10D66000040007D000F07CFB20B1D4F8F01008785B -:10D6700030B901E0022026E0D4F82C01007808B18E -:10D680003A2020E08C200027005D10F0010F19D017 -:10D69000D6F802004860D6F80600886054F8F00F0B -:10D6A000718910228181206806F10C010E3011F081 -:10D6B00019FF21680320087021683088488085F8A8 -:10D6C0002F701AE50C2085F82F0016E570B5B24DC5 -:10D6D00004460C26287828B1BDE8704018210F2098 -:10D6E00000F01CBB09F052F803284BD009F054F8A5 -:10D6F000032847D0A07908B101282DD1607928B13D -:10D70000012803D0022801D0032825D1A07B28B10D -:10D71000012803D0022801D003281DD1607BD8B195 -:10D72000C00819D162884FF48040824202D8218813 -:10D73000814203D9207901280ED118E0207930B137 -:10D74000012814D0022805D0032805D102E0202AA0 -:10D750000BD30CE0A0290AD22079042805D1208817 -:10D76000202802D36188884201D912260AE0607914 -:10D7700006F0B9FA30B1207985F83600204606F077 -:10D780001CFB064601202E7168711821E970287073 -:10D79000DCE410B5804C217829B11A21BDE8104095 -:10D7A0000F2000F0BBBA01781F2902D91220207186 -:10D7B00006E0002121710278411C104606F074FB3E -:10D7C000012060711A21E170207010BD10B5724CFB -:10D7D000217829B12021BDE810400F2000F09EBA29 -:10D7E00001781F2902D91220207106E00021217141 -:10D7F0000278411C104606F046FB01206071202192 -:10D80000E170207010BD2DE9FC41634C217829B1F5 -:10D81000BDE8FC411B210F2000F080BA0127677191 -:10D820000C21217100780026012804D0002875D031 -:10D830001220207197E006F020FA002819D006F097 -:10D8400065FA94F83600A8B1012813D0042811D045 -:10D8500008F0A2FF00280CD108F098FF18B108F0DA -:10D8600095FF02287FD1002009F02EFD00B1FFDFD7 -:10D87000267178E008F08AFF002874D108F08CFF48 -:10D88000002870D106F0BAF9A0F57F41FF396AD1BE -:10D89000072101A801F0F0F84049054688602800FA -:10D8A00000D1FFDF032128460FF032F9284606F0A9 -:10D8B00034FC34F8560FA5F8440034F80A09A5F8EA -:10D8C0004600207885F84A00607885F84B00627A37 -:10D8D000217A002328460FF01CFD0146002228462D -:10D8E0000FF098FDE07900906189A37928880A46B5 -:10D8F0004C3C01F0A2F990B1042800D0FFDF288849 -:10D90000072101F0FAF800B1FFDF072084F80400D6 -:10D9100005F594712846FFF733FC24E009E02888D8 -:10D9200006F025F8284609F0CFFC00B1FFDF26718C -:10D93000EEE708F02BFF032803D008F02DFF0328A3 -:10D9400011D108F026FF0546002009F0F7FB50B979 -:10D95000267145B1288806F00BF82888072101F0C8 -:10D96000CCF800B1FFDF1B20E0702770BDE8FC8120 -:10D970002DE9F041084C0646207828B1BDE8F04179 -:10D980002D210F2000F0CAB93088072101F0A3F83B -:10D9900005004FF0010703E00406002050000020BE -:10D9A00020D095F8090140B995F85C00112801D004 -:10D9B000122802D195F84C0150B10C2020710F2093 -:10D9C000A0702D20E0703088E08067712770ABE593 -:10D9D0001022B11C05F5857011F084FD85F80971E0 -:10D9E0000020EBE70220E9E770B5FF4C0546207800 -:10D9F00028B1BDE870402E210F2000F08FB9288893 -:10DA0000072101F068F8022178B190F809212AB9BC -:10DA100090F85C20112A04D0122A02D00C20207128 -:10DA200004E080F809110020F9E721710F20A070AF -:10DA30002E20E0702888E080012060712070A7E629 -:10DA40002DE9FC47E84C0646207828B138210F2004 -:10DA500000F064F9BDE8FC8770884BF68032122133 -:10DA600090420AD848B14FF0000830886946FEF766 -:10DA700076FC20B10220207110E021710EE00198A7 -:10DA800000F15009851C2F887288394648460FF0EE -:10DA900035F82888B842F6D184F8048001206071F6 -:10DAA0003821E1702070D5E77CB5CF4C0546207851 -:10DAB00020B148210F2000F031F97CBD288869464B -:10DAC000FEF74DFC38B10220207101206071482121 -:10DAD000E17020707CBD01987F22014680F85820BB -:10DAE00080F85920002280F85A20A87801F8280FE1 -:10DAF000E8784870287988702271E6E71CB5BA4C3E -:10DB0000217821B113210F2000F008F91CBD0088F5 -:10DB10006946FEF724FC08B1022005E0019890F860 -:10DB20002810012902D00C20207106E05821002283 -:10DB30002271095C21720088E0800120607113214C -:10DB4000E1700F21A17020701CBD2DE9F041A64CA1 -:10DB50000546207828B1BDE8F0414B210F2000F0A8 -:10DB6000DDB82888072100F0B6FF012358B382886A -:10DB70006D88C688418803EB4207BD4217D342F245 -:10DB800010777E43BF107943B6FBF1F1491E89B28D -:10DB90004FF4FA76B14200D931468D4200D229467F -:10DBA000491C521CB1FBF2F15143491E8AB290F854 -:10DBB000381101B90284E2800020207163714B208A -:10DBC000E0702370B0E40220F7E787490A781AB1C1 -:10DBD00050210F2000F0A2B8427862B1827852B191 -:10DBE000C27842B1027932B1C2881B2A03D30378CA -:10DBF0001BB1012B01D0122008E0A1F856200278B9 -:10DC0000D0F801004AB1C1F852000020087101208B -:10DC100048715022CA7008707047C1F84E00F4E78E -:10DC200070B5714C0546207828B1BDE8704051218F -:10DC30000F2000F073B8287800F0010008F010FC05 -:10DC4000287800F0010009F05DFC0020207101201F -:10DC500060715121E17020709AE570B5624D044603 -:10DC6000287828B1BDE870404E210F2000F056B84A -:10DC700000F061F808B10C200DE0601C0EF0E8FD2A -:10DC8000207800F0010006F03DF8207800F0010057 -:10DC900006F0EEFF00202871012068714E21E97026 -:10DCA000287075E570B5504C0546207828B1BDE860 -:10DCB00070404C210F2000F031B808F067FD10B91A -:10DCC00008F06AFD08B10C2003E0287806F0FCF8A3 -:10DCD00000202071012060714C21E170207057E517 -:10DCE00010B50178532907D2404A52F8211019B1D2 -:10DCF000801C8847012010BD002010BD18B10228EB -:10DD000001D00120704700207047022903D0C000D5 -:10DD1000703080B2704780003C30FAE7324A92F8A7 -:10DD20003130002B06D182F8320082F83310012006 -:10DD300082F83100704710B508F01DFD04280DD0A1 -:10DD400008F019FD052809D008F020FD032805D0AA -:10DD500008F022FD032801D0002010BD012010BDD5 -:10DD600090F8691041B990F8C81029B190F8C8002E -:10DD7000042801D0012070470020704701784068D6 -:10DD800021B190F8690010B100207047E8E7012048 -:10DD900070470178012909D1406890F8D510002911 -:10DDA00004D0002180F8D51009F0E3BB70470AB118 -:10DDB000012200E00222024201D0032001E001F032 -:10DDC00003001870704710B5038843F6FD711A1FE1 -:10DDD0008A4229D24288141F8C4225D29A4223D8E3 -:10DDE000C289911F04E0000004060020D8F9010058 -:10DDF00040F67B43994217D2018A8C1F9C4213D272 -:10DE00008A4211D8428AB2F5FA7F0DD2828A40F650 -:10DE10007744A2F10A03A34206D2B2EBD10F03D991 -:10DE2000C18A028B914201D9302010BD017911B114 -:10DE3000012910D107E0417929B1012903D0022934 -:10DE400001D0032907D1007B38B1012805D0022871 -:10DE500003D0032801D0122010BD002010BD000007 -:10DE60004A30704708440830424301F14A001044E8 -:10DE700080B27047F0B51D460446A818059B0830CF -:10DE800000FB03F205F14A00104487B2B94238BFE3 -:10DE9000FFDF002626606660A660E6602661666198 -:10DEA000A661E66126624FF6FF706662A082A7F166 -:10DEB000280080B265776080B0F5004F88BFFFDF33 -:10DEC000608805F13C01884238BFFFDF6088401B55 -:10DED000A0F13C011B2934BF1B203C382080A677D1 -:10DEE000F0BD816188617047408870472DE9F04F2F -:10DEF0000D46C188044600F12808008921F400433A -:10DF000020F4004221F4004620F400474FF0010ABB -:10DF10004FF000099A4208D100F4004001F400419A -:10DF200088421CBF0020BDE8F08FB7420BD9617F4B -:10DF3000B81B401A083885421BDC08EB060000219C -:10DF4000058041801EE06088617F801B401AB0F12F -:10DF5000080B0ED4BBF11B0FB8BFFFDF5D45D4BF6C -:10DF600029461FFA8BF1681A0204120C18BFBA4234 -:10DF700004DD84F817900020BDE8F08F08EB060060 -:10DF80000180428084F817A0BDE8F08F2DE9F041B0 -:10DF9000044600F12802C08820F40043E07D0028F8 -:10DFA00008BFBDE8F081D0180288438813448B4233 -:10DFB0003CBF0020BDE8F081002791429CBF01805A -:10DFC000478013D9891A0D042D0C45800ED0E088A6 -:10DFD000A61D20F40040854288BFFFDF30884FF443 -:10DFE000004121EA0000284330800AE0627F008877 -:10DFF00002F108031044083081B26288A01D00F0CD -:10E00000A8FBE7750120BDE8F08130B4B0F804C08A -:10E01000C488034600F128052CF400402844A44598 -:10E0200003D10020188230BC7047B3F80CC00488BC -:10E03000A44509D34088ACEB040CA0EB0C0084B2DF -:10E040000CEB0500C01E06E0A4EB0C045D7FA4B23F -:10E05000AC446044401DB1F800C0A44588BF0C80AA -:10E06000B3F80CC0BCF1000F0CBF4FF0010C4FF027 -:10E07000000C82F800C00988198230BC70472DE975 -:10E08000F041044600F12801808820F40040451842 -:10E09000208A002808BFBDE8F081A08910B9A069D6 -:10E0A000807F2871A089218A084480B2A0812988B4 -:10E0B0006A881144814238BFFFDF28886D88A289B1 -:10E0C0004119002791421AD175B1A088261D20F46C -:10E0D0000040A84238BFFFDF30884FF4004121EAFA -:10E0E00000002843308009E0627F1044083081B28C -:10E0F00002F108036288201D00F02BFBA781278214 -:10E100000120BDE8F0812DE9F0474189B0F8048095 -:10E110000027044600F1280A414518BF4FF4004982 -:10E120003AD000BF21F40040504446886EB1608967 -:10E1300004F10A0520F40040B04238BFFFDF288810 -:10E1400029EA00003043288021E0637F008803F142 -:10E15000080C18446389083023F400456288284479 -:10E1600080B204F10A0190420BD2121A92B20CF161 -:10E170001B0C62452CBF03F4004229EA030004D2C1 -:10E1800004E0801A80B229EA030210430880781C58 -:10E19000618987B24145C5D13846BDE8F0872DE990 -:10E1A000F047B0F808800B46044600F12801B0F8AB -:10E1B0000A90808828F4004C01EB0C05804504BFD0 -:10E1C0000020BDE8F087002A1CBF681D106023B145 -:10E1D000627F691D184611F085F92F886D888DB111 -:10E1E000E81987B2208904F1080620F40040A8420B -:10E1F00038BFFFDF30884FF4004121EA0000284398 -:10E2000030800AE0607F6288C119083100F108039C -:10E2100089B204F1080000F09CFAC84504BF2089C7 -:10E2200060813846BDE8F0878188C08881420CBF94 -:10E230000120002070478188008988420CBF01209E -:10E240000020704730B48488C28800F1280324F489 -:10E25000004C22F40041634494421BD08289048A1A -:10E2600015191C885A88A3189D4216D312B18A42E8 -:10E2700010D212E0437F0CF1080C1A196244408856 -:10E2800092B2801A80B22333984201D211B104E0D5 -:10E290008A4202D130BC0020704730BC0120704758 -:10E2A0002DE9F007B0F806C0048900F128070246FE -:10E2B0002CF400457E1924F400492CF4004A002077 -:10E2C00024F400434FF00108D1450AD104F400447E -:10E2D0000CF4004C644504D05082BDE8F0070020E7 -:10E2E0007047AB4208D992F81DC05B1BA3EB0C032F -:10E2F000A3F10804002308E0B2F802C0547FACEB9D -:10E30000050CACEB040CACF10804002CE4DBB2F817 -:10E310000EC0BCF1000F0DD0B6F800C075884DB12D -:10E320005B1B10778B42D7DBD0893844A0EB0C0005 -:10E33000C01E09E0A4EB0C0410778C4208DB507F70 -:10E34000D38918443044401D5182BDE8F00770471E -:10E350008B42A8BF82F81C80E6DABDE72DE9F05FAA -:10E36000044600F1280AC088934620F400400AEBD6 -:10E370000005608A894608B1484502D20020BDE800 -:10E38000F09FE08980B1B5F800806E8808EB060147 -:10E39000884218BFFFDF207F4FF0000750EA0601D8 -:10E3A00008D0002840D04AE04FF00008A17F464640 -:10E3B0002971F0E7E08948B1617F01444819B4F858 -:10E3C0001F10A0F8051094F82110C171E18908EB25 -:10E3D00009004944E18128806F80BBF1000F19D00A -:10E3E000607F298800F108030144083189B26288FE -:10E3F000A01D00F0AEF9E781A07F401CA077A07DB2 -:10E4000000281CBFE088A082A7756782E7750120FD -:10E41000BDE8F09F607FE18908442844B0F805100A -:10E42000A4F81F10C0792EE0E089B4F81F10504402 -:10E43000A0EB080020F8031D94F82110817006EB72 -:10E44000090086B2E089BBF1000F4844E081A5F8DD -:10E4500000806E800ED0E088A51D20F40040B04200 -:10E4600038BFFFDF28884FF4004121EA0000304325 -:10E470002880C0E7E0895044A0EB080030F8031D75 -:10E48000A4F81F10807884F82100BEE7818800F18D -:10E49000280221F4004C6244B0F814C0C3886145DE -:10E4A00018BF99420FD0818969B9806968B18388A2 -:10E4B0000189994209D021F400412830084411799A -:10E4C0000079884201D1002070471046704700F162 -:10E4D0002803407F01F1050C604410600888002883 -:10E4E00004BFD81E106008884988084480B270476D -:10E4F0002DE9F04115460A4600F128061C46407FEA -:10E50000531D034410885788069900281CBFC01C5F -:10E5100080B226D088429CBF081A80B213D9401A14 -:10E52000A042A8BF20461FFA80F858184246294644 -:10E5300010F0ACFF002818BFBDE8F0814544A4EB03 -:10E54000080084B2002001198F423CBF4FF0FF3019 -:10E55000BDE8F081304422462946BDE8F04110F084 -:10E5600095BFFA1C97B2F61ED4E72DE9F04100F1F1 -:10E5700028071D46407F4B1D03441646088800248B -:10E58000B1F80280069A00281CBFC01C80B21FD0C0 -:10E5900090429CBF101A80B20DD9801AA842A8BF21 -:10E5A000284684B299182246304610F09BFF281B5B -:10E5B00085B2264400204119414506D839182A461B -:10E5C000304610F08FFF601984B22046BDE8F0811C -:10E5D00008F103011FFA81F8FF1ED9E72DE9F04188 -:10E5E00016460A4600F128071D46407F531D034486 -:10E5F00010880024B2F80280069900281CBFC01CB5 -:10E6000080B21FD088429CBF081A80B20DD9401A30 -:10E61000A842A8BF284684B258182246314610F0B6 -:10E6200061FF281B85B2264400204119414506D8C8 -:10E6300038442A46314610F055FF601984B220460E -:10E64000BDE8F08108F103021FFA82F8FF1ED9E746 -:10E65000401D704770B5044600F12801C2888088CB -:10E6600020F400431944904208D0A289002A04BF34 -:10E67000228A002A02D1A28A904201D1002070BDD4 -:10E68000B1F800C04D8885B1261D20F40040A84295 -:10E6900038BFFFDF30884FF4004121EA00002843F3 -:10E6A000308000202082012070BD607F0CF10801C5 -:10E6B00000F10803084481B26288201D00F049F887 -:10E6C000EFE70021C18101774182C17581757047F3 -:10E6D00003881380C289002A04BF00207047C288C3 -:10E6E00000F1280322F400421A440A60C0897047EE -:10E6F00010B50446808AA0F57F41FF3918BFFFDFBF -:10E70000E088A082E089002818BF0120A07510BD14 -:10E710004FF6FF71818200218175704710B5044664 -:10E72000808AA0F57F41FF3908BFFFDFA07D28B9AF -:10E73000A088A18A884204BF002010BD012010BD1E -:10E740008188828A914205BF807D002800200120B7 -:10E75000704710B4B0F800C02CF40044214489B2D2 -:10E760004FF4004491420AD2521A92B21B339A4299 -:10E770002CBF0CF4004224EA0C0104D204E0891AF4 -:10E7800089B224EA0C021143018010BC70472DE9C4 -:10E79000F04188464FF6FC7102F103021E46040068 -:10E7A00002EA010509D00027E01C20F00300A04286 -:10E7B00000D0FFDF201D01210CE00127F4E7024615 -:10E7C00028442FB9B14201D2034600E00023136070 -:10E7D000491CC9B2B142F2D9011BC8F80010002F80 -:10E7E00004D10EB1201D00E000202060BDE8F081C2 -:10E7F000024600201168002902D00846096811600D -:10E80000704702680A60016070474FF6FC73C91CCC -:10E810001940101A001F90FBF1F0C0B270474FF67C -:10E82000FC73C91C1940001D01FB02007047000069 -:10E83000F8B5D24D04460E46A878A04200D8FFDFB6 -:10E8400005EB8607B86A50F8240000B1FFDFB8680E -:10E85000FFF7CEFF05000DD0B86A062E40F8245011 -:10E860000AD0082E00D3FFDFC548294650F82620DD -:10E87000204690472846F8BDC048C24B7A30A0F1E8 -:10E880002E020090294620460AF011FAF2E72DE9FF -:10E89000F84F8046DDF828901E4603EB09009346AA -:10E8A0008A46C4B25FEA080707D00025FF2800D9CE -:10E8B000FFDFBAF1000F03D101E00125F6E7FFDF2A -:10E8C00008F1030020F00301414500D0FFDFCB45F4 -:10E8D00000D9FFDF65B9A94A00204C324FF6FF711D -:10E8E00010705180A74A1070A44A7A32107051807B -:10E8F000A24880F800B046708470C47004714471FE -:10E9000080F80690DFF878B2C67100260BF1400B54 -:10E910008146FF1C27F003000746002D02D109EBBA -:10E92000860188603BF8162019F8063001D04FF0B8 -:10E9300000006946FFF72BFF0098761CF6B20744EB -:10E94000082EE6D3FF1C27F003002346064675B1C8 -:10E95000002002226946FFF71AFF009831180020B4 -:10E9600003464E46C91C21F003021DB110E0C9F850 -:10E970004800EEE706EB80070021BA6206E000BF20 -:10E98000D7F828C04CF82130491CC9B2A142F7D3AE -:10E99000401CC0B202EB84010828E3D3A1EB0800BD -:10E9A000AAF800000020BDE8F88F10B5044603F077 -:10E9B000FFFE08B1102010BD2078704A618802EB7C -:10E9C000800092780EE0836A53F8213043B14A1CEC -:10E9D0006280A180806A50F82100A060002010BDF4 -:10E9E000491C89B28A42EED86180052010BD70B5FD -:10E9F00005460C46084603F0DBFE08B1102070BD4A -:10EA0000082D01D3072070BD25700020608070BDE7 -:10EA10000EB56946FFF7EBFF00B1FFDF6846FFF771 -:10EA2000C4FF08B100200EBD01200EBD10B5044684 -:10EA3000082800D3FFDF5148005D10BD3EB50546F4 -:10EA400000246946FFF7D3FF18B1FFDF01E0641C23 -:10EA5000E4B26846FFF7A9FF0028F8D02846FFF780 -:10EA6000E5FF001BC0B23EBD44498978814201D90F -:10EA7000C0B27047FF2070472DE9F0410C460546B3 -:10EA8000062901D0072C10D13C4FB86CFFF7B0FE1F -:10EA900002004FF6FF7604D00221B86CFFF7B5FEF6 -:10EAA00000E030462880B04202D10020BDE8F0816D -:10EAB0002146FFF7BDFE040002D1288800F050F87F -:10EAC0002046F3E7A0F57F42FF3A01D0082901D3A1 -:10EAD00000207047ACE6A0F57F42FF3A0BD0082932 -:10EAE00009D2264A9378834205D902EB8101896ACB -:10EAF00051F820007047002070472DE9F04104468E -:10EB00000D46A4F57F4143F20200FF39CED0082D17 -:10EB100001D30720CAE719494FF000088A78A242BA -:10EB2000C4D901EB85072146BA6A52F82460002E49 -:10EB3000BCD0134A08462032314652F8252090476F -:10EB4000B96A062D41F8248001D0072D02D1204654 -:10EB500000F006F83146B868FFF753FE0020A5E73D -:10EB600010B5064CC2B20221A06CFFF758FE014658 -:10EB7000A06CBDE81040FFF744BE00006406002012 -:10EB800024FB01005C00002001469B480022006835 -:10EB90000260037A00EB830040F80C2F818011465D -:10EBA00000F01AB92DE9F05F9846DDF828B0DDF8DD -:10EBB00030A01546894604004FF0000627D00027F4 -:10EBC000E01C20F00300A04200D0FFDF85B301204D -:10EBD000FFF746F900FB05610AEBCA0202EB0B00E6 -:10EBE0000E180120FFF73CF900FB05610B9800EBC4 -:10EBF000C00202EB0800084405EB450100EB4100B0 -:10EC0000143000EB850000EB850617B110E00127FA -:10EC1000D6E77948A6EB8507A9000460257204F1C0 -:10EC20000C000C3F606010F0F6FCB8B2FFF7ACFFD0 -:10EC30000020C9F80060BDE8F09F2DE9FF4F6E4C41 -:10EC4000814681B020689A468B4600B9FFDF206874 -:10EC5000027A4A4503D9426852F8291021B143F299 -:10EC6000020005B0BDE8F08F006800B9FFDF0121A8 -:10EC70000E9A0398FFF7F6F8C61C4FF6FC752E4067 -:10EC8000584601215246FFF7EDF8C01C00EA05087E -:10EC900008EB0600001D85B257480027006804688D -:10ECA00001E027460446206838B1A188A942F8D17E -:10ECB0003946204600F098F813E005F10800A188D5 -:10ECC00080B281422ED33946204600F08DF8A088CC -:10ECD0000022411B601902608180394600F07CF8F7 -:10ECE000A580A08860802680251D0E9F0123039AA1 -:10ECF000314628460097FFF7BDF820884146284452 -:10ED00005A460123CDF800A0FFF7B4F82088411936 -:10ED10002846FFF7E6F8384800684168002041F8C7 -:10ED200029409EE704209CE770B5334C05462068D7 -:10ED300000B9FFDF2068017AA94210D9426852F871 -:10ED4000250060B14188002342F8253003608180AE -:10ED5000194600F041F8216800200A7A08E043F2E1 -:10ED6000020070BD4B6853F820306BB9401CC0B234 -:10ED70008242F7D8002002E08A88104480B20968F5 -:10ED80000029F9D1FFF700FF002070BD70B51A4EC1 -:10ED900005460024306800B9FFDF3068017AA942D7 -:10EDA00004D9406850F8250000B1041D204670BD0C -:10EDB00070B5114E05460024306800B9FFDF306899 -:10EDC000017AA94206D9406850F8251011B131F8EE -:10EDD000040B4418204670BD19B10A68026008602F -:10EDE000704705490968F8E7006809B1086070478D -:10EDF00001490968FAE700006400002070B5044684 -:10EE000000780E4601281AD0072802D00C281AD103 -:10EE100015E0A068216905780B2D0CD0052003F0C2 -:10EE200060FC052D0FD0782300220520D4F81010A7 -:10EE300003F0BAFB07E0782300220620F8E705205C -:10EE4000216903F04EFC31462046BDE8704001F0D8 -:10EE5000A7B910B500F13902C3799478411D64F067 -:10EE600003042340C371DB070DD04B795479234051 -:10EE70004B710B79127913400B718278C9788A42F1 -:10EE800000D9817010BD00224A710A71F5E74178FE -:10EE9000012900D00C21017070472DE9F74F86B091 -:10EEA00000208C690D468DF8040009780127FA4886 -:10EEB00016464FF0070A4FF011094FF00A0B2A29A6 -:10EEC00078D2DFE811F02A00110352036903A80386 -:10EED000B303CC03FA030F043B04620481049A04D5 -:10EEE000D504E604050510053005540577059C0595 -:10EEF000C605E005EE050F06270630066306850603 -:10EF0000D6060D071B074B076A0779078A07C40750 -:10EF1000FB072708E407E807ED0714B120781D2850 -:10EF200029D0D5F808805FEA080043D001208DF889 -:10EF30000400686A059003208DF808008DF809B078 -:10EF4000286A0390A8880028EFD098F8001091B1A3 -:10EF50000F2910D27ED2DFE801F07D144CDCFDFCDD -:10EF6000FBFAF9F8F7089FF6F500022822D124B140 -:10EF700020780C2801D0002770E302208DF80400CF -:10EF8000ACE10620696A03F0ACFBA8880728EDD144 -:10EF9000204601F000F9022809D0204601F0FBF8D4 -:10EFA000032808D9204601F0F6F8072803D20120EB -:10EFB000207005E011E2002CB7D020780128D5D1CF -:10EFC00098F80400C11F0A2903D300BF85F81CB0BC -:10EFD00089E2A070D8F80010A163B8F80410A187E6 -:10EFE00098F8060084F83E00012028700320207065 -:10EFF00046E00728BAD1002C97D020780D28B5D14B -:10F0000098F8031094F83B20C1F3C000C2F3C0028B -:10F01000104201D00E2000E00F20890707D198F898 -:10F0200005100142D2D198F806100142CED194F8D1 -:10F030003D2098F8051020EA02021142C6D194F84A -:10F040003E2098F8061090430142BFD198F8040082 -:10F05000C11F00E045E20A29B8D2617F814201D98F -:10F060000620C2E3D8F800106160B8F804102181CE -:10F0700098F80600A072012028700E20207003204E -:10F080008DF80400686A059004F139000290601D53 -:10F0900003901730049067E2412890D1204601F098 -:10F0A0007AF8042802D1E078C00704D1204601F0A4 -:10F0B00072F80F289ED1A88CEF6880B24FF0400AFA -:10F0C000D4F82480FFF762FE3946082742465346AB -:10F0D0000097FFF74AFA0E208DF80400686A059041 -:10F0E000606A0290002101A8FFF788FE20780428BA -:10F0F00006D0A07F38B1012805D0032806D0AEE3A2 -:10F10000052020700BE284F8009034E71220207074 -:10F1100066E01128C1D1204601F03DF8042802D153 -:10F12000E078C00719D0204601F035F8062805D14F -:10F13000E078C00711D1A07F02280ED0204601F050 -:10F140002AF808E0AFE07DE09AE16EE14EE106E1E9 -:10F15000E5E0CBE01CE011289FD1102208F101016D -:10F1600004F1480010F0BEF9607801280DD012209B -:10F170002070E078C00703D0A07F88B301282FD08B -:10F1800085F800B08DF804B0F0E384F800A027E023 -:10F1900011288FD1204600F0FEFF082804D0204619 -:10F1A00000F0F9FF132885D12869D8B16869C8B182 -:10F1B00004F17800102208F10101074610F092F9DD -:10F1C0002078082812D014202070E078C0070FD0D3 -:10F1D000A07F022818D06178022912D00328CFD14D -:10F1E0000420FDE300208DF80400F6E00920EBE7A1 -:10F1F0000B202870296901204870206CC1E90107A3 -:10F2000092E208B1012870D10B202870296981F899 -:10F2100001A0606A4860206AC1E9020778E2206CB8 -:10F22000E2780068C2F34402521ED04000F00100B0 -:10F2300040F0800000E000200874E06A48617CE251 -:10F240000746F9E31128D0D1204600F0A4FF0A2890 -:10F2500002D1E078C00704D1204600F09CFF1528B9 -:10F26000C3D1102208F1010104F1480010F03AF96D -:10F2700020780A2812D016202070122028702969C0 -:10F280000920487004F15800486020308860103828 -:10F29000C860206C0861ACE370FC01000B2020709A -:10F2A000E4E22870D9E102289FD1204600F073FFE4 -:10F2B000042804D3204600F06EFF082809D3204616 -:10F2C00000F069FF0E2890D3204600F064FF12285A -:10F2D0008BD2A07F022888D18DF80490686A0590AF -:10F2E00098F801008DF80800FBE36CE20228AAD12F -:10F2F000204600F050FF00286FD0204600F04BFF62 -:10F300000128F9D0204600F046FF0C28F4D0052053 -:10F310008DF8080098F801008DF8090065E71128BC -:10F32000FCD1002CFAD020781728F7D16178E06A58 -:10F33000022912D05FF0000101EB4101182606EB13 -:10F34000C1011022405808F1010110F0CBF805204E -:10F35000696A00F013FF26700DE60121ECE70B2827 -:10F36000DCD1002CDAD020781828D7D16178E06A77 -:10F3700002292CD05FF0000101EB4101102202EBC9 -:10F38000C1014158B8F8010008806078E16A02289C -:10F3900020D0002000EB4002142000EBC2000958EE -:10F3A000404650F8032F0A60406848600520696AAB -:10F3B00000F0E4FE6078022810D04FF000002044F6 -:10F3C000407A20F001000CD14FF001010BE04FF02A -:10F3D0000101D1E74FF00100DCE77FE24FF00100CF -:10F3E000EDE74FF000012144487279E3112895D1EF -:10F3F000002C93D02078192890D16078E16A0228F7 -:10F4000011D0002000EB40021C2000EBC2001022B3 -:10F41000085808F1010110F065F80520696A00F04C -:10F42000ADFE1A20F5E00120ECE7082898D1002C69 -:10F4300098D020781A2893D1E06A98F801200178B2 -:10F4400062F347010170E16AD8F8022041F8012F08 -:10F45000B8F8060088800520696A00F08FFE6078A1 -:10F46000022807D04FF000002044407A20F002012B -:10F470002BD033E04FF00100F6E7204441722FE338 -:10F480001128B4D1002CB4D020781B28AFD16178DA -:10F49000E06A02291CD0002101EB4101202202EB8D -:10F4A000C1011022405808F1010110F01BF805209D -:10F4B000696A00F063FE607802280CD04FF000000B -:10F4C0002044407A20F0040108D14FF00100D4E735 -:10F4D0004FF00101E0E74FF00100F1E74FF00000CD -:10F4E000CBE785F81CA0FAE33078012884D11C22F0 -:10F4F00004F11C00716810F03AF8E079C10894F842 -:10F500003B0001EAD001E07861F30000E070217F68 -:10F51000F1BB217803290AD0C0073FF4F9AD0320DD -:10F5200028708DF804B0686A059041209EE3607FE2 -:10F53000A17888423FF694AD02272771E1792046F1 -:10F5400021F0E001E171617A21F0F0016172A17AAC -:10F5500021F0F001A172FFF77CFC2F708DF804B050 -:10F56000686A05908DF808A0F2E33078112888D1F8 -:10F570008DF804A0696A0591B1680391ADF808A0FF -:10F5800008466168016021898180A17A817100E06B -:10F590006AE004202070A4E230781128A6D18DF80A -:10F5A00004A0686A0590301D02AB07C883E8070015 -:10F5B0004120ADF8080008460C210170A88CD6F84F -:10F5C0000C8080B24027D4F82090FFF7F1FB414631 -:10F5D0004FF008084A463B46CDF80080FEF7FEFF94 -:10F5E000002101A8FFF70AFCE07820F03E00801C13 -:10F5F000E0702078052801D00F200AE0A07F0028C5 -:10F600003FF4C3AD0128FBD003287DD184F80080EE -:10F61000B1E42070AFE430780328A8D170680168A5 -:10F62000A1664068E0660520287035E2317803293C -:10F630009DD171680A68226749686167216C51B978 -:10F64000A17F19B1012901D0062029E185F800A088 -:10F650002064606401E085F800A00327F3E33178BB -:10F66000022984D1317909B1297737E1A17F0229B3 -:10F6700010D00329EFD16178012910D0A17994F835 -:10F680003A2001290FD02064E178C90713D0012A5C -:10F690000ED010E0B0680028E7D020640BE0A2791B -:10F6A00094F83A10EDE7B1680029DED02164EBE769 -:10F6B000F0680028D9D06064CDE78DF804B0696A9D -:10F6C0000591E1785846C90709D06178022903D12C -:10F6D000A17F29B1012903D0A17F032900D00820EF -:10F6E000287012E230781128BFD1B0682862092052 -:10F6F0002870E0782969C0070FD081F801A0206A3E -:10F700004860606A886000E0ABE004F16800C860AF -:10F71000A07F02287FF48FAD81E501204870206C26 -:10F72000486004F16800886004F13800C860201D5A -:10F730000861206B4861606B88611FE2E178307876 -:10F74000C90701D0062100E00A2188428DD1207826 -:10F75000072817D084F800908DF804A0686A0590F7 -:10F76000286A0390ADF80890032100F8011B1022CD -:10F7700071680FF0B7FE002101A8FFF73FFB0020E2 -:10F780002862C2E408202070E6E730781128ABD167 -:10F790008DF804A0686A0590B0680390ADF80890F1 -:10F7A000042100F8011B102204F168010FF09AFEF9 -:10F7B000002101A8FFF722FB2078092801D013209F -:10F7C00027E784F800B016E0E1783078C90701D067 -:10F7D000062100E00A21884286D1102204F1480067 -:10F7E00071680FF053FE10B104202877A2E320784F -:10F7F00009283FF4C5AC0C2053E5E078C10735D0AB -:10F80000A17F012902D002291BD02CE00D202870F5 -:10F81000296981F801B06078012809D0206A486020 -:10F82000606A886004F16800C8601030086104E50F -:10F83000606A4860206A886004F17800C860103807 -:10F84000F4E7C0F3440114290DD24FF0006101EB3D -:10F85000B0104FEAB060E0706078012801D010204D -:10F8600055E40620D5E6607801288AD00E2018E5F8 -:10F87000307809288BD185F800B010208DF804006D -:10F88000686A059070680290002101A8FFF7B6FA37 -:10F89000E9E7E078C00706D0A07F01281FD10F203C -:10F8A00028700420F8E0152028702969022048708B -:10F8B000206C48606078012805D004F178008860E9 -:10F8C0001038C8605AE104F1680088601030F8E729 -:10F8D00030780228CED1307908B1287728E310207B -:10F8E00028700F20D8E030781328F7D185F80090E1 -:10F8F00029690820487070684860607801280DD038 -:10F9000004F1680088601030C860206B0861606B8B -:10F91000486104F158008861A06A21E004F1780090 -:10F9200088601038F0E730780728D7D16078012850 -:10F930001AD1A078A16A0A18C0F1100110460FF080 -:10F9400048FE1220287029690920487004F15800E7 -:10F950004860203088601038C860206C086141E041 -:10F96000C861E06A086209E11320C9E0CBE03078A1 -:10F970000828B3D1102204F1480071680FF086FD09 -:10F9800008B10B2031E720780B28EDD02046FFF797 -:10F9900060FAA078A16A0A18C0F1100110460FF0B1 -:10F9A00018FE1620287008208DF80400686A05905B -:10F9B000002049E03078112890D1B06828621420E6 -:10F9C000287029690920487004F1580048601030F7 -:10F9D00088601030C860606C08616078012800E0C1 -:10F9E0009EE006D004F139004861206B8861606BAD -:10F9F000B6E7601D4861606B8861206BB0E73078C6 -:10FA0000082892D18DF804A0686A0590286A0390AE -:10FA1000ADF808900D2100F8011B102271680FF05D -:10FA200061FD002101A8FFF7E9F900202862617853 -:10FA3000012902D01520ECE569E216212970082180 -:10FA40008DF80410696A05910290A0788DF80C0079 -:10FA50007EE130780B288CD116202870607802283F -:10FA600002D12046FFF7F5F9A07871680A18C0F1B5 -:10FA7000100110460FF0ADFD08208DF80400686AF3 -:10FA800005907068E0E730780F2895D1E079C007DD -:10FA90007BD01720287009208DF80400686A059033 -:10FAA00056E13078102887D11422311D04F11C0052 -:10FAB0000FF05DFDE16A208DA1F80900E16AA078F0 -:10FAC000C871E179E26A01F003011172E16A627AB8 -:10FAD0000A73E16AA07A81F824006078012876D060 -:10FAE000B3E13EE26078022801D0012000E000206E -:10FAF0002044407AC0070BD0E078C00708D1192015 -:10FB000028708DF804B0686A05908DF808901FE1A0 -:10FB10001E2071E63078112874D1B06828621A204E -:10FB200028700520B8E7307803286BD16078E26A46 -:10FB3000022801D0012000E0002000EB4001142049 -:10FB400000EBC1015158726813680B6052684A603B -:10FB50001B212970D5E9041205234B70636A4B60A1 -:10FB60006778E36A022F01D0012700E0002707EB46 -:10FB7000470700EBC7001858C1E90202686A4862EB -:10FB8000069800F024FBFFF75BBB87E130780E2876 -:10FB900038D16078E26A022801D0012000E000201C -:10FBA00000EB4000102101EBC00002231058093285 -:10FBB00071680EF05DF81C202870296904204870D7 -:10FBC000206A4860E06A09308860F84879E65AE1BE -:10FBD00030780D2816D16178E06A022901D0012120 -:10FBE00000E0002101EB4101182707EBC101A278D9 -:10FBF000405871680FF076FC6178E06A022902D003 -:10FC0000012101E0A9E0002101EB410107EBC10165 -:10FC10004058A1780844C1F110010FF0DAFC8DF8CA -:10FC200004A0686A0590286A0390ADF80890062140 -:10FC300001706278E16A022A01D0012200E000220C -:10FC400002EB420207EBC202401C895810220FF05F -:10FC500049FC002101A8FFF7D1F8002028621D20EF -:10FC600028708DF804B0686A05900B208DF80800A4 -:10FC70006EE03078112870D18DF804A0686A059084 -:10FC8000B06803900B20ADF80800039880F800A03E -:10FC90006278E16A022A01D0012200E0002202EB30 -:10FCA0004202102303EBC20289580988A0F8011010 -:10FCB0006178E26A022901D0012100E0002101EB14 -:10FCC0004103142101EBC30151580A6840F8032F86 -:10FCD00049684160002101A8FFF790F818E729E181 -:10FCE0006078022801D0012000E000202044407A02 -:10FCF000800701D51F2003E721207DE530781128FA -:10FD00002BD18DF804A0686A0590B0680390ADF817 -:10FD10000890082707706178E26A022901D0012162 -:10FD200000E0002101EB41031C2101EBC301401C59 -:10FD3000515810220FF0D6FB002101A8FFF75EF802 -:10FD4000202028708DF804B0686A05908DF808703E -:10FD5000314601A8FFF752F815E775E03078112811 -:10FD600072D18DF804A0686A0590B06803900820ED -:10FD7000ADF80800039809210170E1690978490884 -:10FD80004170E16951F8012FC0F802208988C180D3 -:10FD9000002101A8FFF732F8AEE76078022801D011 -:10FDA000012100E000212144497A490701D52220A0 -:10FDB000A6E6012849D068E03078112844D1B0681F -:10FDC000286223202870296904204870206A48602E -:10FDD000E06A09308860764873E530780D2833D1C1 -:10FDE0006178E06A022901D0012100E0002101EBE5 -:10FDF0004101202707EBC1011022405871680FF024 -:10FE000071FB8DF804A0686A0590286A0390ADF82C -:10FE1000089080F800B06278E16A022A01D00122DD -:10FE200000E0002202EB420207EBC202401C8958AC -:10FE300010220FF057FB002101A8FEF7DFFF002082 -:10FE400028626078B5E791E037E02420D4E4607858 -:10FE500002280BD000202044407AC10702D0E1786C -:10FE6000C90705D0810705D51920A9E40120F2E7CB -:10FE70001720A5E4400701D51B20A1E41C20207019 -:10FE80006078012801D01820B6E42720B4E42820A7 -:10FE900028700B2000E63078122849D12920ABE4E5 -:10FEA0002078012844D00C2842D02046FEF7EFFFEE -:10FEB0000C208DF80400686A059039E030784FF026 -:10FEC0002608112805D012203070032785F80080FD -:10FED0004CE08DF804A0686A0590B0680390022099 -:10FEE000ADF80800039805210170297F41700021B9 -:10FEF00001A8FEF783FF0B208DF80400686A0590C7 -:10FF0000314601A8FEF77AFF074685F80080012FE9 -:10FF10000ED02BE001208DF80400686A05900420C3 -:10FF20008DF80800287F8DF809000020287712E05E -:10FF3000287F80B11D202070252028708DF804B006 -:10FF4000686A059002208DF80800314601A8FEF786 -:10FF500055FF07460AE00CB1FE2020709DF8040012 -:10FF600020B1002101A8FEF749FF0AE409B0384694 -:10FF7000BDE8F08F2DE9F04F0C4601274E69097856 -:10FF800085B09046BA464FF00209072021B10129F9 -:10FF90004ED002291FD1C8E0217901290AD00229B7 -:10FFA00015D0032910D0042915D11BE068FC0100ED -:10FFB00074FB0100707801280CD10620616A02F000 -:10FFC00069FB002807D11AE01D20307017E0717816 -:10FFD000022901D0052796E031780C2927D18DF828 -:10FFE00004000EE03078011F042902D30E380328E4 -:10FFF0001DD2B07F02281AD12089022817D38DF88C -:020000040001F9 -:10000000049084F800A020899DF80410884203D24F -:100010000A208DF800003FE01121083488F8001014 -:1000200094E80E00C8E901120327C8F80C306AE012 -:1000300098F80010112966D18DF80000616A0491CA -:10004000D8F80850029521794FF00B0B012906D002 -:10005000022929D0032911D0042954D15AE0ADF83E -:10006000049085F800B0207E4F4600F01F006870B5 -:1000700000216846FEF7C2FE377043E0ADF80490F9 -:1000800005202870207E68704E4600216846FEF7E5 -:10009000B5FE26708DF800B0606A0490414668464F -:1000A000FEF7ACFE07462EE0ADF8040085F800A090 -:1000B000207F6870607F00F00100A870A07F00F0D2 -:1000C0001F00E870E17F2971C0071FD094F820005D -:1000D00000F00F00687194F8210000F00F00A87183 -:1000E00000216846FEF78AFE2868B063A888B087BA -:1000F000A87986F83E00A069407870772879B070BA -:100100000D2030700027384605B031E70020A87177 -:100110006871E5E7ADF804900E202870207E6870C5 -:1001200000216846FEF76AFEECE7FE2030708DF88D -:1001300000A0606A049004208DF80400207E8DF8F1 -:100140000500EDE700B50023012285B005280FD09A -:1001500006280BD102208DF8002004918DF80400B0 -:100160008DF8053000216846FEF748FE05B000BD59 -:100170008DF8002004918DF80420F1E770B50C464D -:10018000054602F0AEFA21462846BDE870407823C5 -:10019000002202F009BA08B1007870470C207047BD -:1001A00070B50C0005784FF000010CD0217021468D -:1001B000F3F715FB74482178405D884201D1032094 -:1001C00070BD022070BDF3F70AFB002070BD027BFA -:1001D000032A05D000220A704B780B2B02D003E0D3 -:1001E000042070470A770A62027B9300521C027354 -:1001F000C15003207047F0B585B00F460546012475 -:10020000287B05EB800050F8046C7078411E0C29A7 -:100210000AD25D493A46123101EB8000314650F86E -:10022000043C2846984704460CB1012C11D1287B88 -:10023000401E10F0FF00287301D00324E0E70D20DA -:100240008DF80000706A0490002101966846FFF75F -:10025000A7FF032CD4D005B02046F0BD70B51546DD -:100260000A46044629461046FFF7C5FF064674B104 -:100270002078FE280BD1207E30B10020287029463E -:1002800004F10C00FFF7B7FF2046FEF700FE3046F2 -:1002900070BD704770B50E46044688210FF0BBF95B -:1002A0000225012E03D0022E04D0052070BD0120AE -:1002B000607000E065702046FEF7E9FDA57700203C -:1002C00070BD28B1027E1AB10A4600F10C01C5E7E3 -:1002D0000120704730B5044687B00D46062002F075 -:1002E00000FA2946052002F0FCF92078FE2806D005 -:1002F00000208DF8000069462046FFF7E2FF07B0B6 -:1003000030BD7FB50E4600218DF80C1041780B29C9 -:1003100003D00C2903D0002405E0846900E044697F -:100320000CB1217E91B16D4601462846FFF74FFF83 -:10033000032809D1324629462046FFF78FFF9DF852 -:100340000C10002900D0042004B070BD04F10C058D -:10035000EAE710B590B00C4607900B480421801EC8 -:1003600008900A488DF8191009900F92694606A85E -:10037000FFF7C7FF002805D11022204601990FF092 -:10038000B1F8002010B010BD7AFB010068FC01003C -:1003900070B50D46040011D085B1210128460FF03B -:1003A00018F910224E4928460FF09CF84C480121BC -:1003B0000838018044804560002070BD012070BD78 -:1003C00070B5474E00240546083E10E07068AA7BD1 -:1003D00000EB0410817B914208D1C17BEA7B914202 -:1003E00004D10C2229460FF051F830B1641C30883A -:1003F0008442EBDB4FF0FF3070BD204670BD70B51E -:100400000D46060006D02DB1FFF7DAFF002803DB0A -:10041000401C14E0102070BD314C083C20886288DC -:10042000411C914201D9042070BD6168102201EB8A -:10043000001031460FF056F82088401C20802870AC -:10044000002070BD70B514460D0018D0BCB100215D -:10045000A170022802D0102811D105E0288870B1BF -:100460000121A170108008E02846FFF7A9FF0028AD -:1004700005DB401CA070A8892080002070BD0120F1 -:1004800070BD70B5054614460E000BD000203070CC -:10049000A878012808D005D91149A1F108010A88D6 -:1004A00090420AD9012070BD24B128782070288894 -:1004B000000A5070022008700FE064B149681022F1 -:1004C00001EB0011204610390FF00CF8287820734A -:1004D0002888000A607310203070002070BD000072 -:1004E000700000202DE9F041FE4C207EE17D884225 -:1004F00008BFBDE8F0810126FB4D0027E07D215CAF -:1005000001EB810205EB8200037C052B18D0037CF4 -:10051000062B23D0037C072B34D0437C002B08BF51 -:10052000FFDF29D04774E07D16280EBF0020E07D54 -:10053000401CE075481CC0B255F8222007211AE083 -:100540000674E07D16281ABFE07D401C0020E0758F -:10055000481CC0B255F8222002210CE00674E07D50 -:1005600016281ABFE07D401C0020E075481C55F895 -:100570002220C0B203219047207EE17D8842BDD178 -:10058000BDE8F0810674E07D16281ABFE07D401CAE -:100590000020E075481CC0B255F822200821EAE787 -:1005A00070B5D24D0C2085F82900A5F53B700024CC -:1005B00080F8CD4180F8CC4100F5F4700476C47524 -:1005C00005F12C000EF0B0F9A5F58E70047585F8D4 -:1005D0002B40601E2C60A86085F8254085F82240DD -:1005E00085F8234085F8244085F82140C048A5F1CE -:1005F000E80104704470002000EB800201EB8202ED -:100600001474401CC0B20B28F6D30120F8F75EFF2B -:100610000020F8F75BFF012085F82600F9F724FC9D -:10062000B448F9F730FCB44C2070B448F9F72BFC0F -:100630006070BDE87040F8F7DDBE10B5F8F708FF50 -:10064000AD4C2078F9F738FC6078F9F735FCA74C09 -:1006500094F82800002808BF10BDF9F71EF9002003 -:1006600084F8280010BD0B20704770B59F4C94F89B -:10067000260000281CBFFFDF70BD94F82B00002867 -:1006800008BFFFDFF8F7CDFF62690025811A6FF020 -:100690007F43B1F5800F24BFA2EB000CBCF5800FA7 -:1006A0000DD38B4203D2991A0844411C07E06345DD -:1006B00028BFFFDF05D2181A1044401C4142002910 -:1006C00000DBFFDF012684F8266084F82B5094F8C5 -:1006D00029100420844A01EB810102EB8101087496 -:1006E000A068B0F1FF3F04D0B01EA0600120F8F771 -:1006F000EDFE0020F8F7EAFEF9F725F8F8F7CCFE52 -:1007000025600EF0B5FAF9F715F87D48056005602B -:100710004FF0E0214FF40040C1F88002F2F751FCA5 -:1007200073480078022804D0032805D194F82300E8 -:1007300010B184F8226001E084F82250BDE87040D6 -:10074000F8F7DCBF034668490B2000BF00EB8002CE -:1007500001EB820212F8042C22B1401E10F0FF00BF -:10076000F4D1704700EB800201EB8201012241F8D5 -:10077000143C01F8042C7047012804D0032808BF5A -:10078000002926D000E021B3584B4FF0000C83F82D -:1007900021C0574A0028907014BF022882F803C075 -:1007A0000BD0072915D2DFE801F01404060C0E1057 -:1007B00012001B2000E03A20D070012083F82100B5 -:1007C00070475820F8E77720F6E79620F4E7B52041 -:1007D000F2E700207047464810B54078F8F7C8FFA8 -:1007E00080B210BD30B5421E3F49002500EB8000AD -:1007F00001EB80040A2A02D814F8040C00B9FFDFC8 -:1008000014F8040C012818BFFFDF04F8045C30BDA5 -:1008100070B53C4C94F8CD0194F8CC1188420CBFD3 -:1008200001250025F8F7FDFEF8F7A2FF94F8CD1199 -:1008300094F8CC2191420CBF01210021A942E9D1B9 -:1008400070BD30B50D46304A44190021101A71EBC5 -:10085000010038BFFFDF2D488542C8BFFFDF2C48AD -:100860008542B8BFFFDF2B488442A8BF2A4804DA7C -:10087000002CAABF2046274830BD201830BD70B5D7 -:10088000194900EB800001EB8004244A54F8101D44 -:10089000607A002852F8202011440CBF0420022066 -:1008A000084420F07F40F8F763FF94F90850164A97 -:1008B00044190021101A71EB010038BFFFDF134803 -:1008C0008542C8BFFFDF12488542B8BFFFDF11482D -:1008D0008442A8BF104804DA002CAABF20460D4865 -:1008E00070BD1DE0D8080020F4080020DC090020BD -:1008F000820000205524010080000020E504010052 -:1009000000F50040F0060020FF7F841E0020A107B4 -:1009100000E05EF80080841E00807BE1BCFB0100EB -:10092000201870BD2DE9F04F0646FF4885B00068DD -:10093000C005C00D11D0103840B20028B8BF00F07B -:100940000F0000F1E020B4BF90F8140D90F80004FF -:10095000400908BF4FF0010A01D04FF0000A30787B -:1009600000281FBF0128002005B0BDE8F08F3079B6 -:1009700000280CBF04210221EC4ABAF1000F52F802 -:10098000200001EB000903D1E949002081F827008C -:100990006C4602AA2146B068F8F7F7FE9DF90820D8 -:1009A000F068211D10440122C01C1F28B8BF01920D -:1009B00008DB03AAF8F7E9FE9DF80C0010B10198D6 -:1009C000401C0190DDE900100844401D20F07F40EC -:1009D0000190A1EB090020F07F40009070798DF824 -:1009E0000A0000980390F8F71CFE009A019B121A67 -:1009F000181AD04922F07F4220F07F40B2F5800FD4 -:100A000026D2814224D3CA4890F82950009CCA4F6C -:100A1000181B20F07F486FF07F40001BAB4604900E -:100A20000C2D24D005EB850007EB80026FF07F438F -:100A30005068011BB1F5800F12D3A4EB000CBCF57C -:100A4000800F0DD38B4205D204990844411C07E066 -:100A500000205FE0634509D2191A0819401C414281 -:100A60000029BCBFAB46957CDADB00E0FFDF5D45CB -:100A700025D00BEB8B0007EB80026FF07F40916875 -:100A80000B1BB3F5800F12D3A4EB010CBCF5800F48 -:100A90000DD3984203D204980844431C07E06045F4 -:100AA00028BFFFDF0BD2431A1819401C4342002B0A -:100AB00005DD9DF80A00927B904228BF0C460C2D64 -:100AC00018BF9DF80A1010D005EB850007EB8000D9 -:100AD0004268121B22F07F42424506D2827B91423D -:100AE00028BF8468857C0C2DEED10098A04205D0EB -:100AF00004EB080020F07F400094019000990398D7 -:100B0000814206D001EB090020F07F40F8F730FE6B -:100B1000B0600120864991F82710002904BF05B074 -:100B2000BDE8F08FBAF1000F3FF42EAF05B0BDE87D -:100B3000F08F2DE9F04F064687B00C467F480DF048 -:100B4000FBFE4FF00108002835D07D4F387D00288E -:100B500018BFFFDF3E742079794D05F10C02287231 -:100B6000607968722946A068F8F70FFE95F90C00C5 -:100B70000F2804DD1F3828732868401C286095F969 -:100B80000C00E1682E1D0844C01C1F28B8BFC6F821 -:100B9000008009DB6A463146F8F7F7FD9DF8000052 -:100BA00010B13068401C30602078A87287F814803B -:100BB00007B0BDE8F08F634D95F8CD0116281ED023 -:100BC00095F8CD0195F8CC11401C884200D1FFDF8B -:100BD00055480068C005C00D1AD0103841B2002930 -:100BE000BDBF01F00F0000F1E02090F8140D01F1FD -:100BF000E020A8BF90F80004400909D104E095F86E -:100C0000CC010028E4D1E2E72078002818BFFFDFFC -:100C10004C4890F8CD1101EB810100EB8100067486 -:100C20002078012800F04A81022843D0454890F8F6 -:100C3000CD1101EB810100EB8105207928726079EB -:100C4000687205F10C022946A068F8F79EFD95F937 -:100C50000C000F2804DD1F3828732868401C28600A -:100C600095F90C10E0682E1D0844C01C1F28B8BF61 -:100C7000C6F8008009DB6A463146F8F786FD9DF824 -:100C8000000010B13068401C30602078A8722D48F8 -:100C900090F8CD1116290EBF002190F8CD11491CF6 -:100CA00080F8CD1125480DF05DFE07B0BDE8F04F8E -:100CB000F8F724BD234890F8CD1101AA01EB81017A -:100CC00000EB81076946E068F8F75FFD9DF90400D5 -:100CD0000F28CCBF0120002000993D1D0844019041 -:100CE000A068C01C1F28B8BFC5F8008009DB6A4691 -:100CF0002946F8F74AFD9DF8000010B12868401C0D -:100D000028600220B87260797872207938720028E1 -:100D10000CBF04210221054A52F82000014403912E -:100D20007A68481D10440FE004ED00E0BCFB0100B0 -:100D3000DC090020FFFF3F00F4080020080A002023 -:100D4000C0080020F0060020019900900844039993 -:100D5000401A0590FD4C002084F82700F8F761FC4C -:100D6000386001998046084420F07F40F86094F88C -:100D700029000C287ED0214691F8290000EB800242 -:100D8000A1F1E80000EB82025668009A324422F09A -:100D90007F42029297F809B091F829503446111B0E -:100DA00021F07F4A6FF07F41891BA94604910C2DE9 -:100DB00023D0E74805EB850100EB81026FF07F430C -:100DC0005068011BB1F5800F24BFA4EB000CBCF5EB -:100DD000800F0BD38B4203D204990844411C05E0D9 -:100DE000634509D2191A0819401C41420029BCBFA9 -:100DF000A946957CDBDB00E0FFDF4D4524D0D448DD -:100E000009EB890100EB81036FF07F429868011BB9 -:100E1000B1F5800F12D3A4EB000CBCF5800F0DD3FD -:100E20008A4203D204990144491C07E0624528BF65 -:100E3000FFDF09D2121A1119491C4942002903DDAA -:100E4000997B8B4528BF04460C2D18BFC04910D094 -:100E500005EB850001EB80004268121B22F07F4207 -:100E6000524506D2827B934528BF8468857C0C2D31 -:100E7000EED100E01BE0A64205D004EB0A0020F012 -:100E80007F4026460290029AA6EB080020F07F40A1 -:100E9000A2EB0802059922F07F42B0F5800F06D23E -:100EA000914204D30398304420F07F403860A74833 -:100EB00090F8270000287FF44DAFE8E6A548851993 -:100EC00015F8010C002818BFFFDF05F8018CADE60E -:100ED0000020F8F7EBBA0120F8F7E8BA9E4800784E -:100EE00070472DE9F0419A4E00274FF00308012585 -:100EF00006F1E80450B301285BD0022800F0E98035 -:100F000003281CBFFFDFBDE8F08194F829000C28FE -:100F100008BFFFDF84F8267084F82B5094F829006E -:100F200000EB800006EB800080F81080F8F7EDFB06 -:100F300094F8290094F82910401CC0B201EB8101FB -:100F400056F82120BDE8F0410521104794F829000A -:100F50000C2808BFFFDF84F8267084F82B5094F823 -:100F6000290000EB800006EB800080F81080F8F785 -:100F7000CCFB207F002818BFFFDF84F8255000201D -:100F8000F8F7A4FAA168B1F1FF3F04D001230022D1 -:100F90001846F8F7DFFA94F8290094F82910401C55 -:100FA000C0B201EB810156F82120BDE8F0410121DA -:100FB000104794F829000C2808BFFFDF84F826703A -:100FC00084F82B5094F8290000EB800006EB800099 -:100FD00080F81080F8F799FB0120F8F777FA94F879 -:100FE000250000281CBFA068B0F1FF3F0DD094F889 -:100FF000290094F82910401CC0B201EB810156F879 -:101000002120BDE8F04106211047207F012815D09E -:1010100002281FD0032833D004281CBFFFDFBDE8FF -:10102000F08194F8201060680123411A00221846CC -:10103000F8F790FA94F82800B8BB37E094F8240049 -:1010400028B184F82470F8F767FB84F823502777D9 -:10105000BDE8F08194F8280018B9F8F7F5FB84F89A -:10106000285094F8290094F82910401CC0B201EBD4 -:10107000810156F82120002190472777BDE8F081B3 -:10108000217B60680123411A00221846F8F762FAB2 -:1010900094F8240028B184F82470F8F73DFB84F814 -:1010A000235002202077BDE8F08103E0F8F7CCFB65 -:1010B00084F8285094F8290094F82910401CC0B2F4 -:1010C00001EB810156F82120002190472577BDE8EA -:1010D000F08121480078BDE8F041F8F7F3BE10B583 -:1010E0001A4C94F829000C2808BFFFDF94F8290057 -:1010F00094F82910401CC0B2154A01EB810152F846 -:101100002120BDE81040042110472DE9F84F80460A -:10111000087C104C401EC6B20D46A05D01281DD0B3 -:10112000022825D0297CDFF828A0481EC4B204EB91 -:1011300084020AEB8206371D0A2821D801EB8100C0 -:101140000AEB800010F8040CD8B919E0DC09002083 -:10115000F4080020D009002080000020A87A01288F -:1011600014BF02200020A05518BFBDE8F88FD9E7B2 -:10117000A87A012818BFFFDF0021A972A155D1E785 -:10118000FFDF307CDFF8289407280BD11720009070 -:1011900099F8172009F11803494620460DF018F96F -:1011A00001203074307C012804D0A87A012818BFAF -:1011B000FFDF02D0A87A01284BD1FE4B307C0228F9 -:1011C00018D099F81800162872D099F8180099F8D4 -:1011D0001710401C884200D1FFDF0120707499F87D -:1011E000180009F8004099F81800162800F09E81B0 -:1011F00000F093B9F04A92F829000146A04207D0C6 -:10120000014600EB810003EB8000807CA042F7D117 -:1012100092F829C084450CD192F8291001EB810184 -:1012200003EB8101897C82F82910012182F82A10C0 -:1012300009E000EB800203EB820201EB810103EB8A -:101240008101927C8A7400EB800003EB80000C210A -:101250008174287AD949002851F820A02968A1EB87 -:101260000A010CBF04200220081A20F07F423A60D5 -:10127000D5E90001084420F07F407860A87A022870 -:1012800018BF287B1ED038727868401D20F07F4040 -:101290007860687AB872287A06257872032872D244 -:1012A000002870D000F022FE00286DD0A1E0FFE7FA -:1012B00099F81700002890D18EE700BF89F8180030 -:1012C000BDE8F88F287A00280CBF0420022000EB2C -:1012D0000A036868591D00EB010BB9484078504576 -:1012E00003D9B54991F8231011B10BF1060003E0C1 -:1012F000A0EB0A005844801DAF4991F829C0BCF109 -:101300000C0F25D091F829C00CEB8C0EA1F1E80C44 -:101310000CEB8E0CDCF804C0624519D0DFF8A4C2D7 -:1013200091F8291001EB8102A24901EB82014A6880 -:101330008968A2EB080222F07F42A1EB080121F0AC -:101340007F41904298BFB2F5800F9DD28C459BD3D0 -:101350004044A0EB0B0020F07F4139601944E8685D -:1013600021F07F410A1A6FF07F4CB2F5800F24BF45 -:10137000431AB3F5800F11D3944506D2ACEB0000AD -:101380000844421C0AE034E02FE09C4528BFFFDF00 -:101390001DD2ACEB01010844401C4242002A16DD7C -:1013A0000520307499F81800162819D099F81800FB -:1013B00099F81710401C884200D1FFDF99F81800F7 -:1013C00009F8004099F8180016287BD0A5E0386885 -:1013D000ABF10501084420F07F407860002052E71F -:1013E00099F817000028E9D1E7E7CAF138054FF06E -:1013F000320A73480178012918BF03290AD14078BD -:10140000504507D96C4991F82310002904BFA0EB7F -:101410000A0005446B4B3868A0EB0802786822F09C -:101420007F41A0EB080020F07F4C8D4298BFB1F5C2 -:10143000800F1BD2634519D35F4991F829300C2BDB -:1014400030D091F829504FF00C0BDA46594905EB92 -:10145000850301EB8303D3F808C0ACEB080C94457B -:1014600031D8AB469D7C0C2DF0D193E00520307433 -:1014700099F81800162810D099F8180099F8171044 -:10148000401C884200D1FFDF99F8180009F800409D -:1014900099F81800162849D03FE099F8170000285D -:1014A000F2D1F0E70220307491F829000C2818BF1F -:1014B00091F82900B07481F82940012081F82A00B0 -:1014C000BDE8F88F32E00C2D1CBFAA46002261D087 -:1014D0000AEB8A0301EB8303D3F804C0ACEB080CDE -:1014E00084452CD29A7B97F80AC0944520D30520D6 -:1014F000307499F81800162813D099F8180099F844 -:101500001710401C884200D1FFDF99F8180009F835 -:10151000004099F81800162808D099F81800401CC7 -:10152000CCE699F817000028EFD1EDE70020C5E6DA -:1015300093F812A00122BAF10C0FC9D103E0002ADE -:1015400008BFAA4626D02F461A4807EB870100EBB2 -:101550008108062288F8102099F81800162838D03B -:1015600099F81800411C99F81700814200D1FFDF5B -:1015700099F8180009F8007099F8180016280EBF9D -:10158000002099F81800401C89F8180098F812708B -:10159000BA45D9D10220074F307407F1E80090F81E -:1015A0002910A9421AD186F812A080F829400BE030 -:1015B000D8080020F4080020DC090020BCFB010052 -:1015C00082000020FFFF3F00012180F82A10BDE8C3 -:1015D000F88F99F817000028CAD1C8E70C2D0CD055 -:1015E000BBF10C0F08BFFFDF0BEB8B0007EB80009C -:1015F000847486F812A0BDE8F88FBBF10C0F08BF09 -:10160000FFDF0BEB8B0007EB800084740C20B074C1 -:10161000BDE8F88F2DE9F04F83B0F8F702F80546E2 -:101620004FF00C0BFE4C94F829100026A4F1E809A9 -:101630004FF001080C292FD094F82920214602EB05 -:10164000820209EB8202127C042A25D091F829201B -:1016500002EB820209EB8202127C032A04BF03B070 -:10166000BDE8F08F2A4620696169801A491BED4B5D -:1016700020F07F4021F07F4106283CBF03B0BDE849 -:10168000F08FB0F5800F24BF03B0BDE8F08F8B4220 -:101690003CBF03B0BDE8F08FA068B0F1FF3F18BFBA -:1016A000FFDF84F8256094F82900DF4F0C2809D06B -:1016B00094F8290000EB800009EB8000007C0428EE -:1016C00008D01AE094F82100B8B1F8787870B878AA -:1016D000387012E094F829B00BEB8B0009EB800016 -:1016E00080F8108094F8290000EB800009EB80005E -:1016F000807C84F8290084F82A80DFF830A39AF8E7 -:10170000CD019AF8CC11884219D000BF9AF8CC01CB -:1017100000EB80000AEB80012846FFF7F6FC9AF800 -:10172000CC0116280EBF00209AF8CC01401C8AF884 -:10173000CC019AF8CD019AF8CC118842E6D1DFF8B5 -:10174000F0A29AF8140028B151462846FFF7DDFCB4 -:101750008AF81460BBF10C0F06D00BEB8B0009EB81 -:101760008000017C01292BD094F829000C2800F07E -:10177000ED8094F82A00002800F0F78084F82A60B1 -:1017800094F8290000EB8001AA4800EB8102A0F543 -:101790000173D2E90101D268C3F80423C3E9BF0190 -:1017A000607E00280CBF4FF004094FF00209A249E7 -:1017B000022811F82010217318BF012834D123E02A -:1017C00007210174DFF874A29AF81800162816D0C1 -:1017D0009AF818009AF81710401C884200D1FFDFD1 -:1017E0009AF818000AF800B09AF8180016280EBFE8 -:1017F00000209AF81800401C8AF81800B4E79AF8FC -:1018000017000028ECD1EAE720690844421B22F0C7 -:101810007F42382A08D903213238617620F07F4090 -:1018200020613220207309E0322907D294F8280081 -:1018300058B9F8F709F884F8288006E094F82800E9 -:1018400018B1F8F72AF884F828607B7884F82030FB -:1018500094F80CA038780621A3EB0A02012818BFDF -:10186000032804D184F82480002AC8BF911D94F86D -:1018700022B0BBF1000F18BF891C206901905044B1 -:10188000484420F07F406060BAF1000F14BF02208E -:101890000020207794F82400002808BFBBF1000F37 -:1018A00037D060480090D4F810E0D4F814C0AEEB04 -:1018B000050E2EF07F4EACEB050C20462CF07F4C35 -:1018C000714598BFBEF5800F1FD2009961451CD3AA -:1018D000002A0FDD0199BAF1000FA1EB02010161AD -:1018E0001944494421F07F4141600CBF012103218B -:1018F00021770EE004DA002B0CBF02210421F7E768 -:10190000BBF1000F08BFFFDF03E080F8246084F81C -:101910002260207F40B12069012300EB09010022F1 -:101920001846F7F717FE02E00120F7F7CFFD94F80D -:101930002900012300EB80013E4800EB8100616833 -:1019400090F90C200020F7F705FE0EE00120F7F7D4 -:10195000BDFD0020F7F7BAFDF7F79EFD94F82800CB -:1019600018B1F7F79AFF84F8286094F8220028B19C -:10197000F7F7D2FE84F8236084F8226094F82100FF -:1019800018B1F8787870B878387094F8240030B1CD -:1019900084F823603878002808BF84F8246027483A -:1019A000017EC07D814203D025484078F8F78AFA4D -:1019B00084F8278003B0BDE8F08F70B5184C054659 -:1019C00082B094F829000C2808BFFFDF94F82900A2 -:1019D00000EB8000174E06EB8000007C032818BF48 -:1019E000FFDFA068B0F1FF3F18BFFFDF94F82900C8 -:1019F00001AA00EB800006EB8000694690F90C001C -:101A00002844F7F7C2FE9DF904000F28CCBF01203F -:101A10000020009908446168084420F07F4111E0EB -:101A2000DC090020FFFF3F0082000020F0060020BC -:101A3000C0080020F4080020BCFB0100D8080020EA -:101A400080000020A16094F82500002804BF02B0A7 -:101A500070BD012302B00022BDE870401846F7F7C0 -:101A600079BD744A0B1A02F1010CB3EB9C0F3CBF19 -:101A70001846704710B5441AB4EB9C0F3CBF18468B -:101A800010BD9A4203D2101A0844401C10BD944263 -:101A90009EBFFFDF002010BD511A0844401C404289 -:101AA00010BD0123002201460220F7F753BD02209A -:101AB000F7F70CBDF7F7B5BD2DE9F0415E4C0546D3 -:101AC00082B094F82B00002808BFFFDF642D50D3AC -:101AD0005A480022401B72EB02004AD3584890F843 -:101AE000CD1190F8CC01814243D15648007D0028A9 -:101AF0003FD194F82900DFF8508100EB800008EB1B -:101B00008006206801AA28446946F7F73EFE9DF941 -:101B10000400002802DD0098401C0090B168009885 -:101B200072680F18BA1A22F07F42B2F5800F20D2E5 -:101B3000B27C0C2A09D002EB820208EB82025268C6 -:101B4000511A21F07F41814213D3A068B0F1FF3FC9 -:101B500005D00120F7F7BAFC4FF0FF30A0602068F5 -:101B60002844206027F07F40606102B00120BDE87A -:101B7000F08102B00020BDE8F0812DE9F84306466F -:101B8000401EC7B2304807EB870100EB8104207C80 -:101B9000002808BFFFDF2A4A92F8CC1192F8CD0145 -:101BA00081420DD001EB810302EB83031B7CB34226 -:101BB00010D016290CBF0021491CC9B28142F1D1B5 -:101BC00020484FF0170800F11805017D29B3007C6B -:101BD000B04222D10020BDE8F883207C05281FBF39 -:101BE000207C0628207C07280AD184F81090CDF8A4 -:101BF0000080EA7D05F11803144938460CF0E8FB33 -:101C0000607C68B16674CDF80080EA7D05F1180348 -:101C10000E4938460CF0DCFB02E04FF001090026CB -:101C2000207C012804BF607C0028D6D10120BDE8BB -:101C3000F8830000FF7F841EDC090020FF1FA1073E -:101C4000F0060020C0080020F4080020D80800207A -:101C5000F0B5734AD2F80032724D002401212E787B -:101C600056B9714E3460704F03263F1D3E606E4F73 -:101C700004260C373E602970C2F80042D160116022 -:101C8000694C4834D16425688542FBD35160D160EA -:101C9000C2F80032F0BD2DE9F041044680074FF054 -:101CA00000054FF0010604D560480560066024F089 -:101CB0000204E0044FF0FF3705D55D484660C0F8E8 -:101CC000087324F48054600003D55A48056024F05A -:101CD0008044E0050FD55248C0F80052C0F80873A0 -:101CE00051490D60091D0D604F4A04210C321160ED -:101CF000066124F48074A00409D54F484660C0F8FA -:101D00000052C0F808734D48056024F40054C4F331 -:101D10008030C4F3C031884200D0FFDF14F4404F5C -:101D200014D047484660C0F8087346488660C0F83B -:101D30000052C0F8087344490D600A1D16608660A1 -:101D4000C0F808730D60166024F4404420050AD5DD -:101D50003E4846608660C0F80873C0F848733C4847 -:101D6000056024F400640CF05DFF3A48044200D0A2 -:101D7000FFDFBDE8F08170B5202500224FEA0203A5 -:101D800020FA02F1C90719D051B201F01F0601244F -:101D9000B4404E09B60006F1E026C6F88041C6F808 -:101DA0008042002906DA01F00F0101F1E02181F8FB -:101DB000143D03E001F1E02181F80034521CAA42F5 -:101DC000DED370BD70B5174C0D466060FFF763FF42 -:101DD0006068FFF7D0FF2846F7F713FE0CF052FBC0 -:101DE00000F0D5F80CF01EFF0CF069FEF8F73CF897 -:101DF000BDE870400CF0F4BB10B50A4C6068FFF70A -:101E00004AFF6068FFF7B7FF0CF00CFFF7F7BDFE65 -:101E10000020606010BD0348406870470220704792 -:101E2000008000408800002004850040FC1F004026 -:101E300000C0004004E5014000D0004004D500404F -:101E400000E0004000F0004000F5004000B000401D -:101E500008B50040FEFF0FFC70B51F490A68BAB113 -:101E600000231D4601244A68521C4A60092A00D3F7 -:101E70004D600E7904FA06F20E6816420AD072B668 -:101E80000B6893430B6062B649680160002070BD27 -:101E9000052070BD5B1C092BE5D3FFDFF8E74FF091 -:101EA000E0214FF48000C1F800027047EFF3108189 -:101EB00011F0010F72B64FF0010202FA00F206486B -:101EC000036842EA0302026000D162B6E7E7024813 -:101ED00000210160416070479000002001208107CF -:101EE0000860704701208107486070471248006809 -:101EF000C00700D0012070470F48001F0068C007CE -:101F000000D0012070470C4808300068C00700D09E -:101F100001207047084810300068704706490C31AE -:101F20000A68D20306D5096801F00301814201D194 -:101F300001207047002070470C040040C84911F888 -:101F4000210F4978884201D3401A02E0C1F12101F2 -:101F50000844C0B27047C249233111F8210F4978B3 -:101F6000884201D3401A02E0C1F121010844C0B205 -:101F70007047BB49463111F8210F4978884201D397 -:101F8000401A02E0C1F121010844C0B27047B549CE -:101F900010B5802081F80004B1490020233101F8F8 -:101FA000210F4870AE4901F8210F4870AC49463105 -:101FB00001F8210F4870AC480CF0B6FCAA48401C50 -:101FC0000CF0B2FCF7F728FEBDE8104000F03DB978 -:101FD00020207047B2E770B50C4605460026FFF793 -:101FE000ADFF01469E48A14212D30022641EE4B216 -:101FF0000DD390F82210435C491CC9B205F8013B8F -:1020000080F822102129F1D180F82220EEE7012664 -:1020100000F01BF9304670BD202070479BE770B57B -:102020000C4605460026FFF796FF01468C482330F4 -:10203000A14212D30022641EE4B20DD390F8221004 -:10204000435C491CC9B205F8013B80F822102129E4 -:10205000F1D180F82220EEE7012600F0F6F83046B4 -:1020600070BD202101700020704710B50446FFF7B5 -:1020700080FF2070002010BD70B50C460546FFF7AC -:1020800078FF014676484630A14213D30022641EF1 -:10209000E4B20DD390F82210435C491CC9B205F894 -:1020A000013B80F822102129F1D180F82220EEE7AF -:1020B000002401E042F2070400F0C7F8204670BD9A -:1020C00070B50C460546212900D9FFDF6748006836 -:1020D000103840B200F0A0F8C6B20D2000F09CF815 -:1020E000C0B2864204D2FFDF02E000BFF7F7E4FD92 -:1020F00021462846FFF76FFF0028F7D070BD2DE975 -:10210000F047DFF86481564CA8F1010807462334F4 -:1021100098F80000DFF84891002604F1230A38B946 -:1021200094F8221094F82100212200F084F890B154 -:102130004D4699F8221099F82100212200F07BF8F1 -:10214000B8B155469AF822109AF82100212200F0E1 -:1021500072F848B335E094F82100275494F8210030 -:10216000401CC0B284F8210021282AD184F82160C3 -:1021700027E095F821002F5495F82100401CC0B2AB -:1021800085F82100212801D185F8216098F8000008 -:102190004746B0B195F8221095F82100212200F0B1 -:1021A0004AF870B13E700CE095F821002F5495F874 -:1021B0002100401CC0B285F82100212801D185F8FA -:1021C000216094F8221094F82100212200F033F8C5 -:1021D00000281FD099F8221099F82100212200F040 -:1021E0002AF8002816D09AF822109AF82100212205 -:1021F00000F021F800280DD0F7F734FD1A480CF054 -:102200009BFBB0F5005F00D0FFDFBDE8F04716484C -:102210000CF0A8BBBDE8F087002806DA00F00F003C -:1022200000F1E02090F8140D03E000F1E02090F8B8 -:10223000000440097047401C884204D0904200D1FD -:1022400009B1002070470120704710B506480CF016 -:1022500073FB002803D1BDE81040F7F7EEBC10BDBA -:102260000C0A00200DE000E09900002004ED00E0E1 -:10227000164908784A78401CC0B2904205D0144BE9 -:1022800001221A60BFF34F8F087070472DE9F041AB -:102290000E4C4FF0E02600BFF7F794FD20BF40BF83 -:1022A00020BF677820786070D6F80052EFF72AF8E0 -:1022B000854305D1D6F8040210B92078B842EBD096 -:1022C000F7F77BFD0020BDE8F08100009B000020B7 -:1022D000180502402DE9F041012528034FF0E021C7 -:1022E0000026C1F880011E4CC4F800610C2000F0EB -:1022F0002CF81C4801680268C94341F3001142F000 -:1023000010020260C4F804532560491C00E020BF9D -:10231000D4F80021002AFAD019B9016821F010017F -:102320000160114807686560C4F80853C4F800618B -:102330000C2000F00AF83846BDE8F08110B50446DC -:10234000FFF7C8FF2060002010BD00F01F02012130 -:1023500091404009800000F1E020C0F880127047F1 -:1023600000C0004010ED00E008C500402DE9F04736 -:10237000F84C0646FF21606800EB061211702178C8 -:10238000FF2916D04FF0080909EB011109EB0617D8 -:102390004158C059491E21F07F4100F0DDF918B1C4 -:1023A00094F80080454614E06168207801EB06113E -:1023B00008702670BDE8F087626809EB0510D159F6 -:1023C000105800F0C9F930B96068A84600EB081051 -:1023D0000578FF2DF0D1606800EB061100EB0810C6 -:1023E0000D700670E6E7F0B5DA4B044600200125D3 -:1023F0005A680C261B7A0BE005EB0017D75DA74245 -:1024000004D106EB0017D7598F4204D0401CC0B24C -:102410008342F1D8FF20F0BD70B5FFF74BFBCD4CE8 -:10242000014608252278606805EB0212805800F00A -:1024300093F9012808D92178606805EB011140580B -:10244000BDE87040FFF72DBBFEF748FDBDE87040CA -:10245000F7F738BD2DE9F041BE4C2578FFF72AFB90 -:102460000146FF2D6FD04FF00808626808EB051693 -:10247000905900F071F90228606801D980595EE036 -:1024800000EB051109782170022101EB0511425C76 -:102490005AB1521E4254815901F5000121F07F4189 -:1024A00081512846FFF762FF34E00423012203EB49 -:1024B000051302EB051250F803C0875CBCF1000F56 -:1024C00010D0BCF5806F10D9CCF3090250F806C0CB -:1024D0000CEB423C2CF07F4C40F806C0C3589A1AD3 -:1024E000920A09E0FF2181540AE0825902EB4C3242 -:1024F00022F07F428251002242542846FFF736FFE5 -:102500000C21606801EB05114158E06850F8272064 -:10251000384690472078FF2815D0FFF7CBFA0146C0 -:102520002278606808EB02124546805800F014F9E2 -:10253000012891D92178606805EB01114058BDE868 -:10254000F041FFF7AEBABDE8F081F0B51D46144684 -:102550000E460746FF2B00D3FFDFA00700D0FFDFAA -:102560007C48FF210022C760446005720674017038 -:1025700042701046012204E002EB0013401CE154BB -:10258000C0B2A842F8D3F0BD70B5724C064665786B -:10259000207C854200D3FFDFE06840F8256060784A -:1025A000401C6070284670BD2DE9FF5F1D468B46BC -:1025B0000746FF24FFF77EFADFF89891064699F860 -:1025C0000100B84200D8FFDF00214FF001084FF0B2 -:1025D0000C0A99F80820D9F804000EE008EB011362 -:1025E000C35CFF2B27D0BB4205D10AEB011350F887 -:1025F00003C0DC4521D0491CC9B28A42EED8FF2C69 -:102600001BD008EB04110AEB0412475440F802B047 -:102610000421029B0022012B01EB041111D0425036 -:102620004FF4806808234FF0020C454519D9A905DD -:10263000890D08D008E00C46DDE7FF2004B0BDE8B6 -:10264000F09F4550ECE7414606EB413203EB0413A3 -:1026500022F07F42C250691A0CEB0412890A81549D -:102660000BE005B9012506EB453103EB041321F01E -:102670007F41C1500CEB0411425499F800502046A0 -:10268000FFF774FE99F80000A84201D0FFF7C4FEDE -:102690003846D3E770B50C460546FFF70BFA0646F9 -:1026A00021462846FFF79FFE0446FF2817D0294DF4 -:1026B000082101EB041168684058314600F04CF8DD -:1026C00000F58050400B02216A6801EB0411515C57 -:1026D00009B100EB8120002800D1012070BD00204D -:1026E00070BD2DE9F0410F468046FFF77CFEFF28C4 -:1026F0001BD0184E357871682A462C4605E0844276 -:1027000006D0254601EB05131C78FF2CF7D10CE011 -:10271000FF2C0AD0A5420CD101EB021000783070DA -:10272000FF2804D0FFF778FE03E000200BE7FFF757 -:10273000BEF939464046FFF7ADFFFF22012371681D -:1027400003EB0413CA5401EB041201EB05111278D8 -:102750000A70F8E6780A0020401A20F07F40B0F5B1 -:10276000000F00D90020704770B50446A0F50000A6 -:102770002C4EB0F1786F02D23444A4F500042A48FC -:10278000844201D2012500E0002500F041F830B17B -:10279000B4420BD32548006804E0284370BDB4421E -:1027A00004D32348844201D20120F6E70020F4E755 -:1027B00010B50446A0F50000B0F1786F03D21948B7 -:1027C0000444A4F5000400F023F84FF0804130B138 -:1027D0001648006804E08C4204D2012003E014484B -:1027E0008442F8D2002080F0010010BD10B520B165 -:1027F000FFF7DEFF08B1012010BD002010BD10B5AD -:1028000020B1FFF7B1FF08B1012010BD002010BDBD -:10281000084809490068884201D10120704700201A -:10282000704700000000002000000200200000208F -:1028300008000020A0000020BEBAFECA0548064AD3 -:102840000168914201D10021016004490120086022 -:1028500070470000A0000020BEBAFECA40E501405B -:10286000534800210170417010218170704770B58C -:10287000054616460C460220F0F753FB4C49012052 -:1028800008704C49F01E08604B480560001F04604A -:1028900070BD10B50220F0F744FB454901200870D7 -:1028A00046480021C0F80011C0F80411C0F8081112 -:1028B00043494FF40000086010BD3D480178C9B19C -:1028C000404A4FF4000111603C49D1F80031002228 -:1028D000002B1CBFD1F80431002B02D0D1F8081115 -:1028E00011B14270102103E001214170364909689D -:1028F000817002700020F0F714BB2D480178002988 -:1029000004BF407870472D48D0F80011002904BF5B -:1029100002207047D0F8001100291CBFD0F8041124 -:10292000002905D0D0F80801002804BF0120704715 -:10293000002070471E4800B50278204B4078C8211F -:10294000491EC9B282B1D3F800C1BCF1000F10D04A -:10295000D3F8000100281CBFD3F8040100280BD0D5 -:10296000D3F8080150B107E0022802D0012805D0B1 -:1029700002E00029E4D1FFDF002000BD012000BDFE -:102980000B480178002904BF807870470B48D0F8C5 -:10299000001100291CBFD0F80411002902D0D0F882 -:1029A000080108B11020704707480068C0B270479E -:1029B000A400002010F5004008F5004000F00040A1 -:1029C00004F5014008F5014000F400404A480021A8 -:1029D00001704170704770B5064614460D460120DF -:1029E000F0F79FFA45480660001D0460001D056071 -:1029F00070BD70B5404A012540EA01411570404A5A -:102A000041F0807111603F4C0026C4F804613E4AD9 -:102A10004FF040711160002802BFC4F800522560D9 -:102A200070BD012818BFFFDFC4F8006225604FF0B9 -:102A300000703649086070BD2F48017879B1324A7C -:102A40004FF0407111602F49D1F804210021002A74 -:102A500008BF417002D02E4A1268427001700020F7 -:102A6000F0F75FBA24480178002904BF4078704726 -:102A70002448D0F80401002808BF704724480068A3 -:102A8000C0B27047002808BF704730B51A480078B8 -:102A9000002808BFFFDF1B48D0F80411002918BF29 -:102AA00030BD0224C0F80443DFF868C0DCF8001031 -:102AB000C1F30015DCF8001041F01001CCF8001053 -:102AC000D0F80411002904BF4FF400414FF0E02278 -:102AD00007D100BFC2F8801220BFD0F80431002B0C -:102AE000F8D02DB9DCF8001021F01001CCF800105E -:102AF000C0F8084330BD0000A700002008F50040E2 -:102B000004F5004000F0004008F5014004F50140E4 -:102B100000F4004010ED00E070B5F74C00250120F6 -:102B20006570257025626572A572E07284F829507F -:102B3000256304F13C00A5630BF0F6FE002818BFE6 -:102B4000FFDF84F82450ED480CF072FEEC494FF0A2 -:102B500011300860091D0860091D0860091D086022 -:102B6000091D0D60091D0860091D0860091D086028 -:102B7000091D0860091D0860091D0860091D08601D -:102B8000091D0860091D0860657770BD30B4DA4919 -:102B90000268DFF874C34A6142688A61007A087784 -:102BA0000A7DD84BACF1040401204AB10A7E00FA38 -:102BB00002F21A608D7D002D0CBF2260CCF800203F -:102BC0004A7D002A04BF30BC70474A7E904018609E -:102BD000C97D00290CBF2060CCF8000030BC7047D4 -:102BE000CB49CA480860091DCA480860704730B51B -:102BF0000546002908BF002404D0012914BFFFDFC7 -:102C00004FF0807444F4847040F48010C049086030 -:102C1000E8B240F44030091D40F000700860BE4842 -:102C2000D0F80001002818BFFFDF30BD002800B534 -:102C3000BA4908BF032004D0012816BFFFDF0420D3 -:102C400000BD086000BD70B502244FF0E0250120F2 -:102C50000022C5F88041B2490A600860B14BC10743 -:102C60001960B1490B6823F0770343F0880343F000 -:102C700000430B60AD4B40F25B6119601B1F40F2DB -:102C800003111960191F0860A44803230360A849B1 -:102C900096200860984EA74896F9241011F1080F65 -:102CA00008BFF8213CD014DC11F1280F08BFD8214F -:102CB00036D011F1140F08BFEC2131D011F1100FF3 -:102CC00008BFF0212CD011F10C0F08BFF42127D040 -:102CD00010E011F1040F08BFFC2121D0002908BF2A -:102CE000026008D0032908BF036004D0042908BF8C -:102CF000016000D0FFDF707F002814BF4FF4C020B8 -:102D00008D488E4908608F498D480860091F8E489C -:102D10000860C5F8804280491020C1F8040370BDE6 -:102D20000160E8E7744A0368C2F802308088D08006 -:102D300011727047704890F8290070476E4A5170C0 -:102D400010707047F0B50546800000F1804000F536 -:102D500080508B88C0F820360B78D1F8011043EAF8 -:102D60000121C0F8001605F10800012707FA00F656 -:102D7000764C002A04BF2068B04304D0012A18BF53 -:102D8000FFDF206830432060206807FA05F1084320 -:102D90002060F0BD10B56749044610F1080F08BF68 -:102DA000F8202CD014DC14F1280F08BFD82026D02E -:102DB00014F1140F08BFEC2021D014F1100F08BF3C -:102DC000F0201CD014F10C0F08BFF42017D011E034 -:102DD00014F1040F08BFFC2011D0002C08BF002004 -:102DE0000DD0032C08BF032009D0042C04BF0420FD -:102DF000086000D0FFDF404880F8244010BD086024 -:102E0000F9E73D4890F8340070473B4890F83600A9 -:102E100070474F4AC178116000684E49000208604F -:102E20007047252808BF02210ED0262808BF1A2186 -:102E30000AD0272808BF502106D00A2894BF0422B0 -:102E4000062202EB4001C9B2434A116043490860BF -:102E5000704729490862704727498A7A012A4AD06F -:102E6000022A18BF70474B7D002B08BF7047DFF860 -:102E7000F0C0012A7ED0CA7D4B7E002A18BF0122F5 -:102E800010F17D00CCF80000DFF8D8C00020CCF8AD -:102E90004C01180282F0010240EA025040F0031295 -:102EA000087F830003F1804303F5C043C3F8102576 -:102EB0002D4A02EB8002887EC30003F1804303F5B4 -:102EC000F833C3F81425DFF8A4C0C3F810C5C97ED1 -:102ED000CB0003F1804303F5F833C3F814251A4AF5 -:102EE000C3F81025012202FA00F002FA01F10843AA -:102EF0001F49086070473EE08C0A0020A00A0020AD -:102F0000000E0040180500500C050050060102009C -:102F10001415004025000302001000401015004069 -:102F2000FC1F0040741700403C170040381500405B -:102F3000441500400C1500400000040408F5014051 -:102F400040800040A4F501401011004040160040B0 -:102F5000241500401C150040081500405415004081 -:102F60004C85004000800040006000404C810040E3 -:102F700004F5014004E00B7D002B7FF478AF70472F -:102F80008A7D0B7E002A18BF01227E307AE72DE968 -:102F9000F84F00280CBF01220222FC4DFC4C0320FC -:102FA000AA72C4F80002687F002814BF4FF4C02042 -:102FB000F848F94F38604FF00108002933D0012953 -:102FC0004ED002291CBFFFDFBDE8F88F286A002819 -:102FD00008BFFFDF296A286B0844F0490860F149FF -:102FE000EF480860A97AF04801290EBF0460EF4954 -:102FF0000160A86B40F40020A863D4F800924FF061 -:10300000100AC4F808A30026C4F80062E8484FF488 -:10301000802BC0F800B0FF208DF80000C4F81061CC -:10302000C4F810803BE0012A13D0C4F80480022ABF -:1030300018BFBDE8F88F687D002808BFBDE8F88F8D -:10304000DC48C0F84C80DC480068BDE8F84F0A3026 -:1030500002E7C4F80080287D0028F1D1BDE8F88F90 -:10306000CA48012A806B07D0022A18BFFFDF09D0A7 -:10307000BDE8F84F0A20EFE640F48010A8634FF453 -:10308000801004E040F40010A8634FF40010386092 -:10309000EEE700BF9DF80000401E8DF800009DF88F -:1030A000000018B1D4F810010028F3D09DF80000FA -:1030B000002808BFFFDFC4F80061C4F80C61C4F841 -:1030C0001061C4F80461C4F81461C4F81861C4F84C -:1030D0002861BA4800680090C4F80092C7F800B0B0 -:1030E000C4F804A34FF400203860296A286BBDE8B7 -:1030F000F84F08440A30AFE62DE9F847A44CD4F85D -:10310000000220F00309D4F804034FF0100AC0F3C2 -:103110000018C4F808A30026C4F800629B4D687F1D -:10312000002814BF4FF4C0209A48A1490860A87A2B -:103130000127012802D0022803D014E0287D10B90D -:1031400011E0687D78B1A87EEA7E07FA00F007FA00 -:1031500002F210430860287F800000F1804000F5F3 -:10316000C040C0F81065FF208DF80000C4F8106161 -:10317000276104E09DF80000401E8DF800009DF8D6 -:10318000000018B1D4F810010028F3D09DF8000019 -:10319000002808BFFFDFC4F81061C4F828616E7210 -:1031A000AE72EF72C4F80092B8F1000F18BFC4F805 -:1031B00004A3BDE8F8870068814920F07F400860DB -:1031C00070474FF0E0200221C0F88011C0F8801253 -:1031D00070474FF0E0210220C1F8000170477949A3 -:1031E0000870704710B578480BF0A6FB002818BF90 -:1031F000FFDF10BD74480BF0B5BB74490860704721 -:1032000030B5624C0546206BA84228BFFFDF012085 -:1032100020732561607F40B1A81C20615C48D0F814 -:10322000001241F04001C0F8001262490020C1F8CC -:103230004401674920690860A06B574940F4800049 -:10324000A0634FF48000086030BD002804BF282030 -:103250007047012804BF1820704700B5FFDF282001 -:1032600000BD002804BF41F2D4707047012804BF9C -:1032700041F20400704700B5FFDF41F2D47000BD99 -:10328000002804BF42F2B8407047012804BF41F251 -:103290008830704700B5FFDF42F2B84000BDF0B59E -:1032A0003A4C06464FF002000D00207308BF42F270 -:1032B000B84706D0012D1ABFFFDF42F2B84741F2EE -:1032C0008837002E08BF41F2D47006D0012E1ABFF5 -:1032D000FFDF41F2D47041F20400381A3D49002D5D -:1032E00008444FF47A71B0FBF1F608BF282004D0EF -:1032F000012D1ABFFFDF282018203044801D2061D7 -:10330000617F41B1801C20612148D0F8001241F05A -:103310004001C0F8001227490020C1F8440121698A -:10332000206B08442A490860F0BD184901204877FD -:103330002949022008602A4928480860091F2948AD -:1033400008607047114900204877704718494FF4CA -:10335000800008600D48816B21F4800181630021A9 -:103360000173704778B514460D460646022994BF8E -:10337000022CFFDF1C481D4900680090684600EBE6 -:1033800045000057301A086078BD00008C0A002004 -:10339000001000400000040404F50140488500408E -:1033A00048810040A8F50140ACF501400410004000 -:1033B00008F50140008000404C8500401811004095 -:1033C0003C150040A9000020C80A00200415004058 -:1033D00044850040FF5702006015004044800040D3 -:1033E0009CF5014028110040D4FB01004415004029 -:1033F00078B514460D460646022A94BF022DFFDF1B -:10340000F948FA4940680090684600EB45000057CB -:10341000301A086078BDF64801214160C160002182 -:10342000C0F84411F3480160F34801637047F24863 -:1034300000B5407F002818BFFFDF4020EF4908603B -:10344000EF48D0F8001241F04001C0F8001200BD72 -:10345000E94800B5407F002818BFFFDFE848D0F8F2 -:10346000001221F04001C0F80012E4490020086079 -:1034700000BDE348D0F8001221F01001C0F800129E -:10348000012181617047DE480021C0F81C11D0F88D -:10349000001241F01001C0F800127047D84981B005 -:1034A000D1F81C21012A1EBF002001B07047D54A67 -:1034B000126802F07F02524202700020C1F81C0123 -:1034C000D14800680090012001B0704730B50C0071 -:1034D000054608BFFFDF14F0010F1CBF012CFFDF02 -:1034E000002D0CBF01200220C34901284872CC7274 -:1034F000C34904BFD1F8000240F0040007D00228FD -:1035000007BFD1F8000240F00800FFDF30BDC1F86E -:10351000000230BD70B5B84C0022E17A11F0020F04 -:1035200018BF10F0040F16D111F0100F1CBF94F843 -:103530003530002B02D094F8373063B111F0080F0A -:103540001CBF94F82830002B05D111F0040F03D0D4 -:1035500094F8291001B90122657AA94900234FF096 -:10356000010C35B100F00200104314D0BDE87040EA -:10357000C2E5607F002814BF4FF4C020A348A44ACE -:103580001060D1F8000220F00300C1F80002A3721D -:1035900084F80BC070BD012D14D0022D18BFFFDFC1 -:1035A0001CD0A07A01280CBF9A489B484FF47A712E -:1035B00000F2E730B0FBF1F0216BBDE87040081A73 -:1035C0008C3049E4D1F8000220F00400C1F8000278 -:1035D000637284F80BC084F80AC0E2E7D1F80002F5 -:1035E00020F00800C1F80002637284F80BC00220CA -:1035F000A072D6E72DE9F84F7D4FD7F84C217E4CCD -:1036000083494FF00108A07A0026CAB1012802D0F0 -:10361000022803D014E0227D12B911E0627D7AB154 -:10362000A27EE37E08FA02F208FA03F31A430A6064 -:10363000227F920002F1804202F5C042C2F810657A -:10364000A26B0A60A663217B29B1D7F84411012936 -:1036500008BF012200D00022694DD5F810110129C0 -:103660000CBF40210021012805BFD5F80C31012BEA -:10367000002320231943012805BFD5F80431012B6D -:10368000002310231943654B022804BFD3F800C060 -:10369000BCF1010F07D1D5F80CC1BCF1010F08BF77 -:1036A0004FF0080C01D04FF0000C4CEA0101022849 -:1036B00004BF1B68002B05D1D5F80C31012B08BFC6 -:1036C000042300D000231943022803D1002A18BF85 -:1036D000022200D100221143022804BFD5F80401C0 -:1036E000012805D1D7F84401012818BF012000D1D5 -:1036F000002040EA01094A48016811F0FF0F03D099 -:10370000D5F81411012900D0002184F83410006884 -:1037100010F0FF0F03D0D5F81801012800D00020C9 -:1037200084F835003F48006884F836003348006864 -:1037300018B1FFF7E2F8012800D0002084F8370024 -:10374000C5F80061C5F80C61C5F81061C5F80461E1 -:10375000C5F81461C5F81861C5F8286132480068D9 -:103760000090C7F84461314800684D46DFF8849006 -:103770000090D9F80000E062617F00291CBF801E24 -:10378000E0622B4800682063A07ADFF8A8A0022836 -:103790000CD1607850B1DAF800100978084021782F -:1037A00031EA000008BF84F8288001D084F828603E -:1037B000DFF8848015F0010F44D098F800101F4AFC -:1037C0004908E06A52F82110884701211C4A98F8FC -:1037D0000030206B52F82320904700BF98F800007B -:1037E00010F0010F39D04DE0D4FB0100441500402A -:1037F00000800040448500408C0A00206015004095 -:1038000000100040481500401C1100400000040456 -:1038100008F50140F0FE0100B0F80100001400407E -:103820004016004008140040181100404481004038 -:103830004085004004150040A9000020DCFB010089 -:1038400014FC010015F0200F18BF0221BED115F0A5 -:10385000020F18BF0021B9D1C0E7DAF80000062234 -:1038600000F10901A01C0BF011FE40B9207ADAF832 -:1038700000100978B0EBD11F08BF012000D0002054 -:1038800084F829002846FFF745FE15F0020F05D001 -:10389000274898F8001050F82100804715F00C0FC9 -:1038A00007D0244898F8001050F82110C5F3C00044 -:1038B000884715F0200F05D01F4898F8001050F8E1 -:1038C0002100804798F80000022805D105F06E001D -:1038D000402806D101F083FA98F80000042828BF98 -:1038E000FFDFA07A022818BFBDE8F88F207B0028F0 -:1038F00008BFBDE8F88FC7F84461022814D001283A -:1039000018BFFFDF216B2069884298BFFFDF206965 -:10391000C9F80000A06B094940F48000A0634FF48F -:1039200080000860BDE8F88F2169206B0844EFE74C -:10393000E4FB0100F4FB010004FC010004F501407C -:1039400010B53F4809F089FF00213D4809F0B4FF58 -:1039500001213B4809F084FF3A49002081F8220008 -:103960004FF6FF70888438490880488010BD704742 -:1039700034498A8C824218BF7047002081F82200A7 -:103980004FF6FF70888470472D49016070472E49BB -:10399000088070472B498A8CA2F57F43FF3B03D0F8 -:1039A000002101600846704791F822202549012A2C -:1039B0001ABF0160012000207047224901F1220056 -:1039C00091F82220012A04BF0020704701220270D2 -:1039D0001D4800888884104670471B4948807047FE -:1039E0001849194B8A8C5B889A4206D191F822209B -:1039F000002A1EBF01600120704700207047114857 -:103A0000114A818C5288914209D14FF6FF7181840D -:103A100010F8221F19B10021017001207047002009 -:103A200070470848084A818C5288914205D190F825 -:103A3000220000281CBF00207047012070470000B2 -:103A4000F20A0020CC0A0020AA0000207047514A48 -:103A5000012340B1012818BF7047137008689060B7 -:103A600088889081704753700868C2F8020088887F -:103A7000D0807047474A10B1012807D00EE0507837 -:103A800060B1D2F802000860D08804E0107828B154 -:103A900090680860908988800120704700207047F6 -:103AA0003C4910B1012803D006E0487810B903E082 -:103AB000087808B1012070470020704730B58DB0FC -:103AC0000C4605460D2104A80BF0A5FDE0788DF805 -:103AD0001F0020798DF81E0060798DF81D00286880 -:103AE000009068680190A8680290E86803906846B2 -:103AF0000AF062FD20789DF82F1088420CD1607882 -:103B00009DF82E10884207D1A0789DF82D1088428C -:103B100002BF01200DB030BD00200DB030BD30B56A -:103B20000C4605468DB00321E01CFEF778FA60795B -:103B30000D2120F0C00040F04000607104A80BF09F -:103B40006AFDE0788DF81F0020798DF81E006079FD -:103B50008DF81D002868009068680190A8680290A0 -:103B6000E868039068460AF027FD9DF82F00207052 -:103B70009DF82E0060709DF82D00A0700DB030BD36 -:103B800010B504460621FEF74AFA607920F0C0001D -:103B9000607110BDAE00002070B5FF4C054694F872 -:103BA0008C00002601281BD094F86A0001281CBF55 -:103BB000002070BD6E7012202870202204F16C016C -:103BC000A81C0BF08FFC0120A87184F86A60F348F0 -:103BD00040680088FBF7DAF8FAF79AFD012070BD1B -:103BE0006E7018202870D4F88D00C5F80200D4F843 -:103BF0009100C5F8060084F88C60EFE7E64890F87D -:103C00006A10002914BFB0F86E004FF6FF707047BD -:103C100070B5E24800240470017800291CBFFFDF62 -:103C200070BDDD4D85F8624085F8634085F86440DD -:103C300085F8654085F8664085F85E4085F8604007 -:103C400085F8564085F8364085F868407F218170B8 -:103C500095F8670028B1FFF7FBFBFEF72EFE85F80D -:103C6000674085F86A4085F88C40CD4809F098FC9B -:103C7000BDE87040CB4809F093BCC74890F862009B -:103C80007047C54900B591F8580091F85710C0F336 -:103C90008002C0F340031A4400F0010010440529DB -:103CA00010D2DFE801F00B070B030900BE4931F821 -:103CB000100000BDBD4800BDBD4900E0BD4931F860 -:103CC000100000BDFFDF002000BDB34840F27121AD -:103CD000B0F85A0048437047AF4890F86900002890 -:103CE00018BF0120704710B5040016BF022C002039 -:103CF0000120FFF7D5FE002808BF10BDA6480472BA -:103D0000012010BDA44981F86000704710B5A24C95 -:103D1000207A002816BF022800200120607204F1DA -:103D20000A01FFF7A7FE207A022816BF0328012107 -:103D3000002184F85F10082084F85D00607A04F1A7 -:103D40000A02012804BF527912F0C00F0AD004F110 -:103D50000A02012804D1507900F0C000402801D0A7 -:103D6000002000E0012084F85E0029B994F8570093 -:103D7000012818BF042806D1207C04F1110108F0A5 -:103D80003DFC84F85D004AF2B8102060FCF740FD6D -:103D9000606004F10A01824809F028FC617A8048D9 -:103DA00009F040FC04F10A017E4809F01FFC617A29 -:103DB000BDE810407B4809F035BC70B5764C417BBE -:103DC00084F85810017984F8571001290CBF00229B -:103DD0000288A4F85A20827B84F869208279002A1C -:103DE00016BF022A002201222274D0F80720C4F84C -:103DF0001120B0F80B00A4F8150094F85600012526 -:103E0000002818BF84F8635094F83600002818BFC3 -:103E100084F8645005292DD2DFE801F00308222739 -:103E2000080000215E4809F0BEFB24E001215C4847 -:103E300009F0B9FB04F11101594809F0E5FB207CB8 -:103E400020B1012818BFFFDF05D014E0002154483D -:103E500009F0F5FB0FE00121514809F0F0FB0AE001 -:103E600006214F4809F09FFB05E002214C4809F06C -:103E70009AFB00E0FFDF04214A4809F094FB84F834 -:103E80006250002070BD70B5434C0546002084F898 -:103E900064002A4604F117000BF024FB84F8365026 -:103EA000012084F8640070BD10B53B4C002284F8FA -:103EB000632084F85600024604F137000BF012FB31 -:103EC000012084F8630010BD334981F86800704711 -:103ED000F0B5324E83B0307828BB2F4C94F8620096 -:103EE00008B3FFF77FF9002584F861507570284604 -:103EF000FFF775F9FEF7A7FEFEF772FE2E48FEF7F4 -:103F000088FF2E48FFF757F900210846FFF7C7F949 -:103F100094F85800002610F0010F07D02520FEF776 -:103F200080FF012611E003B00C20F0BD10F0020F5D -:103F300004D02620FEF775FF022606E010F0040FDD -:103F400003D02720FEF76DFF0426FEF749FE84F814 -:103F50005C60FFF73EF901210020FFF718F80F2100 -:103F60000520FEF7EBFE94F85E00002804BF94F8ED -:103F70005F00002805D194F85700012818BF0428D5 -:103F80007ED1FCF745FC064631466068FDF769FDC9 -:103F90000B49B0FBF1F715E0140B0020BC0000202A -:103FA000AC0B0020D40B002034FC010091891300DD -:103FB0003CFC01002CFC010027FC010024FC01005A -:103FC00040420F0001FB170041423046FCF739FC2C -:103FD000606020683844206008F00DFB216888424A -:103FE0006CD8C4E9005694F85D0008F023FB06463F -:103FF00094F85F000127002818BF002E04D010217C -:10400000304609F02CF868B194F8600000281CBF15 -:1040100094F85E0000281AD0607A04F10A010128A1 -:104020000DD011E0677204F10A013046FFF777FD09 -:1040300094F85D1004F10A0008F0DBFB07E0487912 -:1040400000F0C00040281CD00846FFF799FD04F19D -:104050000A01FE4809F0CAFA617AFC4809F0E2FA5E -:1040600004F10A01FA4809F0C1FA617AF84809F046 -:10407000D9FA94F85700012818BF04281ED107E088 -:104080001CE008F0EAFB04F10A01FFF748FDDEE757 -:1040900094F85D0008F0D7FA06000FD0102108F060 -:1040A000DEFF58B969463046FFF739FD6946E748F3 -:1040B00009F0AAFA0121E54809F0C1FA617A04F190 -:1040C0000A00FEF72FFE94F8570001281EBF0428AF -:1040D00094F86300002808D094F8562004F13701C2 -:1040E000DA4809F0CAFA84F8635094F8640040B1E1 -:1040F00094F8362004F11701D54809F0EAFA84F85B -:10410000645008F0EAFAD34808F064FB84F86700CA -:10411000FFF770F803B00020F0BDCF49486070474A -:1041200070B5CE4C05002BD094F8580094F85C1074 -:10413000002620EA010212F0010F04D02520FEF72C -:1041400070FE012615E010F0020F02D011F0020FF0 -:1041500006D010F0040F0CD011F0040F05D008E0C9 -:104160002620FEF75EFE022603E02720FEF759FE1A -:104170000426FEF735FD94F85C00304384F85C00BB -:1041800094F8610040B194F85700012808BFFFDFA0 -:10419000BDE8704000F06EBA1DB102210020FEF7AC -:1041A000F6FE94F86500A948FFF727F894F8570041 -:1041B000052809D2DFE800F0030303090300012109 -:1041C0000846FFF783F900E0FFDF94F8580094F801 -:1041D0005C1030EA01014FF0010002D09E490870E6 -:1041E00070BD94F85710012912BF84F861000021B6 -:1041F00084F85C10F2E710B5FEF7F4FF96480078FB -:1042000040B9964890F8620020B10020FFF788FF7F -:10421000002010BDFFF7FFF8FFF798F8FEF76CFFDE -:10422000FEF7CFFFFEF7E6FF0C2010BD8A49012004 -:1042300048707047894981F86600704770B500255D -:1042400003F064F968B14FF49670FEF702FE824EF7 -:104250003078012809D0022801D003282ED0FFDFB2 -:1042600070BDBDE8704000F005BA7C4C94F8570072 -:10427000032823D094F8670018B1FEF70AFBFFF774 -:10428000D6F87448FEF7B9FF94F85700012818BF14 -:1042900004280AD094F86900012814BF03281025C7 -:1042A00045F00E010020FFF711F994F8680001288D -:1042B00008BFFFF7E8F80220307070BDBDE870401D -:1042C00001202DE770B5654C634D94F86800012816 -:1042D00020D000BF94F8670018B1FFF7B9F8FEF7D7 -:1042E000ECFA03F013F9F8B12878022818BFFFDFC1 -:1042F00094F85700012804BF4FF41970FEF7A9FD88 -:104300000120FFF70DFF287800281EBF287801281C -:10431000FFDF70BD5248FFF7C1F8002804BF7F20BF -:10432000A870FFF7A6F8D5E7BDE8704000F0A2B985 -:104330002DE9F05F07464FF00009FEF762FD464E9B -:1043400082463078022818BFFFDF444D7F2495F85D -:10435000680001282CD03F4809F044F983464FF00B -:10436000FF08002F71D03B4809F043FA00286CD0B9 -:10437000FEF7E0FC002868D095F86700354F68B17B -:1043800008F090F98046FF2808D00146F81C08F094 -:104390007AF9404608F091F940EA0A0A58464FF087 -:1043A000010B062851D2DFE800F09494940C94633A -:1043B0002B48FFF773F8002808BFB470FFF759F8CF -:1043C000C9E795F85700012818BF04283DD0BAF175 -:1043D000000F05D195F86900002818BF022878D190 -:1043E00095F86800012804BF95F88C00002805D0D6 -:1043F0001748FEF702FF032030706CE085F88CB0A0 -:10440000B8F1FF0F0FD005F18E02511E404608F0A3 -:1044100023F9002808BFFFDF95F88D0040F0020067 -:1044200085F88D000CE03878C0F3801085F88D0099 -:10443000D5F8EB00C5F88E00B5F8EF00A5F89200AE -:10444000B07805F194077F280CE042E0AC0B002027 -:10445000D40B0020FC0B0020BC000020140B00201B -:10446000BE00002008BFFFDFB0783870B470BFE72F -:104470003878297CC0F38010884209D1062205F1E2 -:104480001101F81C0BF002F8002808BF012000D031 -:10449000002095F85D102C46414504D1B8F1FF0F7E -:1044A00018BF012100D10021014394F857000128D1 -:1044B00018BF042800D149B958B9BAF1000F05D185 -:1044C00094F86900002818BF012802D194F866000A -:1044D000D8B14FF0010995F8670018B1FEF7B8FFA1 -:1044E000FEF7EBF9B9F1000F1CBF0120FFF718FE32 -:1044F000307800281ABF30780128BDE8F09F307866 -:10450000032818BFFFDFBDE8F09F7068D4F8F710EC -:10451000C0F80D10B4F8FB10A0F8111094F8FD10BD -:10452000C174B97D0175B7F81710C182B7F81910B9 -:104530004180B7F81B108180B7F81D10C180724907 -:1045400008300BF07AF997F8240000F01F0170682A -:10455000017697F82410490980F8041194F86A004C -:10456000002818BFFFDF4FF0000A204684F86CA037 -:1045700074682188A0F86E106188A0F88410A18862 -:10458000A0F88610E188A0F8881094F8041180F84B -:104590008A1090F85F1049B1427A00F10A01012AAD -:1045A00004D1497901F0C001402934D090F860105D -:1045B00041B1417A00F10A02012904BF517911F099 -:1045C000C00F28D0C0F878A0A0F87CA039780546A4 -:1045D000C1F380116176D0F8EB00C4F81A00B5F889 -:1045E000EF10E183B8F1FF0F1CD0C5F87E00E08B1F -:1045F000A5F8820005F172022F46511E404608F0D0 -:104600002BF8002808BFFFDF97F8710040F0020088 -:1046100087F8710013E0D0F80A108167C189A0F80B -:104620007C10D3E739480BF0FFF8617E85F87110F4 -:10463000D4F81A10C5F87210E18BA5F8761085F839 -:104640006AB070680088FAF7A1FBFAF751F886F8AB -:1046500000A0FEF7E0FEFEF779FEFEF74DFDFEF747 -:10466000B0FDFEF7C7FD012003F023F833E7002279 -:1046700003F087B870B5FEF7CEFEFEF767FEFEF7D3 -:104680003BFDFEF79EFD224C002694F8670028B102 -:10469000FEF7DEFEFEF711F984F867601D4D2E70FF -:1046A000FEF7A8FD94F85700012804D0BDE870403B -:1046B000002002F0FEBF022002F0FBFF94F86A0027 -:1046C000002818BFFFDF6878002808BF70BD207C75 -:1046D00084F87100D4F81100C4F87200B4F8150021 -:1046E000A4F876003C2084F86C0068680188A4F87F -:1046F0006E10012184F86A100088FAF747FBF9F779 -:10470000F7FF6E7070BD00001B0C0020920B0020A4 -:10471000140B0020BC0000202DE9F041FF4F04469F -:1047200000207978FE4D4FF00108064611B10129AD -:1047300025D007E095F84D10002918BF87F80180B3 -:1047400000D0012079782B2211FB02F1294491F845 -:10475000222010431AD02A22A01C23310AF0C2FEC4 -:1047600066700420207084F8028078782B2110FB7A -:1047700001F0284480F822600120BDE8F08195F81E -:104780002210002918BF7E70DBD1DBE795F8780096 -:10479000D0B1D5F87900C4F80200D5F87D00C4F88E -:1047A0000600D5F88100C4F80A00D5F88500C4F8E1 -:1047B0000E0095F88900A07466701120207084F8AE -:1047C000028085F8786018E0287801281CBF002056 -:1047D000BDE8F0816670122020702022A91CA01C68 -:1047E0000AF080FEA6712E7085F8A860D5F89800B2 -:1047F0000088FAF7CBFAF9F78BFF0120BDE8F081CA -:10480000C7480178002914BF80884FF6FF707047B1 -:104810002DE9F041C24C064694F82200002818BF4A -:10482000BDE8F081304608F0DDFE0146012500209C -:10483000072937D2DFE801F00A04073636360900C7 -:1048400084F8245009E0032000E0022084F82400CA -:1048500004F12D01304608F026FF84F82C0094F86E -:10486000AD0018B1FEF749F801281FD0304608F016 -:10487000E2FE84F8250004F12601304608F0BDFE72 -:10488000A64E04F14C0730787F2808BFFFDF307850 -:1048900038707F20307084F82250BDE8F04103204A -:1048A00001F06CBE84F82C00BDE8F081FEF768F8DA -:1048B00004F12602511E07F0CFFE002808BFFFDFDB -:1048C00094F8251041F0020184F82510D8E710B5BE -:1048D000002001F0C8FD924CA0B1FEF77AFC002147 -:1048E0000120FEF754FB04F1BC00FEF786FCD4F86F -:1048F000B400FEF785FC94F89C00032818BF02283A -:104900001FD022E0FEF787FDFEF720FDFEF7F4FB47 -:10491000FEF757FC94F8AD0030B1FEF799FDFDF7B6 -:10492000CCFF002084F8AD00012084F8B8000220FC -:1049300084F8B000FEF75EFCBDE81040002001F0F6 -:104940001DBE01210020FEF7C1FDFEF79CFD94F87D -:10495000AD0018B1FDF79DFFFEF769FD032084F857 -:10496000B00010BD6E490028B1F8BA202DD0FF2A42 -:104970000CD24FF6FF7000EA4200A1F8BA00FF28FF -:1049800088BFFF2002D900BFA1F8BA00634842687F -:10499000012A12BF002A0D224260D243C2EBC20399 -:1049A00003EB021291F8B930DB4303EB830CCCEB41 -:1049B00083131A444260900CB1F8BA20B0FBF2F3B2 -:1049C00002FB130081F8B9007047012ADED95008B4 -:1049D000A1F8BA0008BF0120D8D1D5E770B5504C76 -:1049E000002584F8B050012684F8B06094F8B00037 -:1049F00002281BBF94F8B00001280020FFDF18BF79 -:104A000070BD2B2101FB004181F82250401CC0B237 -:104A10000228F6D3257094F8AD0028B1FEF718FDF2 -:104A2000FDF74BFF84F8AD5084F8A85084F8A950E6 -:104A300084F8AC5084F89760394884F89C5084F826 -:104A4000AF5040F2011120F8941F817070BD2DE924 -:104A5000F041334C05460C2794F8B00001281FBFE5 -:104A600094F8B00002280C20BDE8F081FEF7BAFBF4 -:104A7000FEF7E9F8FEF7B4F894F894000126002850 -:104A800001BF94F89500002894F8960000281CBFF8 -:104A900094F8A900002877D094F89C00032802D04D -:104AA000022805D008E005211E4800F082FE03E040 -:104AB00003211C4800F07DFE94F8AA00002804BFE2 -:104AC00094F8AB00002845D0FBF7A2FE0746394614 -:104AD000D4F8A400FCF7C5FF1349B0FBF1F801FBC3 -:104AE000180041423846FBF7ACFEC4F8A400D4F8E5 -:104AF000A0004044C4F8A00007F07DFDD4F8A01049 -:104B0000884227D80020C4E9280794F8AB00002881 -:104B100018BF07F07AFE94F8AC0007E0C40000204C -:104B2000240C0020080D002040420F0000281CBF6C -:104B300094F8AA0000280DD094F88D0004F18E019D -:104B4000012804D1487900F0C00040280ED0084662 -:104B5000FFF716F894F88D1004F18E00FEF7E2F8D6 -:104B600094F8B0000027012817D107E007F075FE80 -:104B700004F18E01FEF7D3FFECE705E084F8B8609E -:104B8000022084F8B00008E094F8B000022802BFC8 -:104B900084F8B0600C20BDE8F08194F89700A0B1D3 -:104BA00094F89C00032818BF07F0B8FDFE4807F0F2 -:104BB00011FE84F8AD00FD48C4F8B450FEF7FBFACE -:104BC000FEF718FB3846BDE8F08107F086FDEDE7FB -:104BD00070B5FEF707FBF64C94F8B000022803D03E -:104BE000FEF708FB0C2070BD012084F8B900A4F882 -:104BF000BA000220FEF7F3FAEE48FEF70AF9EE4B90 -:104C0000002004F1940200BF94F8AF10491CA3FBEC -:104C1000015C4FEA5C0CACEB8C0C6144C9B284F8CB -:104C2000AF10895C012907D0401CC0B20328EBD328 -:104C3000FFF74DFE002070BD94F8AF00DF49085C1F -:104C4000FEF7EFF8FDF7CCFFF2E710B5040016BF52 -:104C5000022C00200120FEF723FF002808BF10BD12 -:104C6000D348002180F88C4080F8A910012010BDA5 -:104C7000CF4981F8AC00704710B5CD4C94F88C004A -:104C8000002816BF02280020012084F88D0004F1BE -:104C90008E01FEF7EFFE012084F8A90094F88C0045 -:104CA000022816BF03280121002184F8AB1094F8D4 -:104CB0008D0004F18E02012804BF527912F0C00F5A -:104CC0000AD004F18E02012804D1507900F0C0000E -:104CD000402801D0002000E0012084F8AA0000282C -:104CE00004BF002910BDFBF793FDC4F8A4004AF2ED -:104CF000B810C4F8A00010BD002816BF0228012279 -:104D00000022AB4981F8972081F89D00704770B56B -:104D1000A74D0C4600280CBF0121002185F89710F3 -:104D200085F89E004FF0080085F89F000BD1002CFD -:104D30001ABF022C01200020114607F05FFC85F805 -:104D40009F00082801D0002070BD022C14BF032C46 -:104D50001220F8D170BD964A032808BFC2F89810F7 -:104D600082F89C0000207047914991F89C0003282C -:104D700004D0012818BF022807D004E091F89E0053 -:104D8000012808BF70470020704791F89D00012856 -:104D900014BF03280120F6D1704710B5FEF73BFB86 -:104DA000FEF7D4FAFEF7A8F9FEF70BFA804C94F858 -:104DB000AD0030B1FEF74CFBFDF77FFD002084F81D -:104DC000AD00012084F8B800022084F8B000FEF79E -:104DD00011FA002010BD764981F8B100704710B576 -:104DE000FEF719FBFEF7B2FAFEF786F9FEF7E9F9CE -:104DF0006F4C94F8AD0030B1FEF72AFBFDF75DFD76 -:104E0000002084F8AD00012084F8B800022084F866 -:104E1000B000FEF7EFF9BDE81040002001F0AEBB96 -:104E20002DE9F84F624DFF2100247F27DFF89081A4 -:104E300085F8AE10002800F0CD8205F1BC0008F026 -:104E4000A8FC30B905F1BC0008F0C3FC002800F054 -:104E5000C18295F8B000544E052880F0B882DFE892 -:104E600000F0F3F3F303F2004F4808F0BBFB88F8BF -:104E7000020095F8970028B9FDF7C3FF002808BF86 -:104E8000002400D0012495F8AD0070B107F00AFCB1 -:104E900085F8AE00FF280CD00146F01C07F0F3FBAC -:104EA00095F8AE0007F009FC044395F8AE00FF2822 -:104EB0000AD195F8970090B195F89C00032803D08B -:104EC00007F07DFC85F8AE0098F80200072880F016 -:104ED000C181DFE800F03FBA07FCFCFC240007F0CA -:104EE0003CFCEFE795F8AD0018B1FEF7B1FAFDF71D -:104EF000E4FC3348FEF7D2FA002808BF88F80070B7 -:104F0000FEF7B7FA002C00F04F8195F89C000128BD -:104F100018BF022840F04881FEF7EEF877E095F8D8 -:104F2000AD0018B1FEF794FAFDF7C7FC2448FEF770 -:104F3000B5FA002808BF88F80070FEF79AFA002C2E -:104F400000F0328195F89C00022859D001285ED0EB -:104F500000F02AB995F8AD0018B1FEF779FAFDF71F -:104F6000ACFC1748FEF79AFA002808BF88F80070D2 -:104F7000FEF77FFA002C00F0178195F89C000228BC -:104F80003ED0012843D003281CBFFFDFBDE8F88FC7 -:104F9000F178D5F89800827E91422AD13179C27E8B -:104FA000914226D171790DE0E00C002044FC010013 -:104FB000240C00204AFC0100ABAAAAAA47FC01006D -:104FC000C4000020027F914213D1B179427F914207 -:104FD0000FD1F179827F91420BD1317AC27F914218 -:104FE00007D13178427EC1F38011914208BF01217F -:104FF00000D0002195F89E20012A0ED0E1B1CFE02B -:10500000FA48FFF705FCBDE8F84F00F001BBF74890 -:10501000FFF7FEFBBDE8F84F59E4002972D100BF4D -:1050200000F11A01F14808F0E8FAF04808F003FB33 -:10503000D5F898104876B3E095F8AE0095F89F1033 -:1050400088427CD1ACE014E1C1E195F8AD0018B123 -:10505000FEF7FEF9FDF731FCE548FEF71FFA0028E0 -:1050600008BF88F80070FEF704FA95F8AB00002836 -:105070000CBF4FF0010B4FF0000B4FF000093078E0 -:1050800006F10901C00907D0487900F0C0004028A6 -:1050900008BF4FF0010A01D04FF0000A95F89C00BC -:1050A000032806D195F89700002818BF95F89F00AF -:1050B00001D195F8AE0007F0BDFA009088B110213B -:1050C00007F0CDFF002818BF4FF0010B00E0C1E052 -:1050D000BAF1000F05D006F109010098FEF7EEFCC9 -:1050E000814695F89C0003280DD0FEF705F83CB3E7 -:1050F000FDF720FE50EA09005CD0BC48FFF788FBB2 -:1051000000F039B94CE0D5F89800F178827E9142F0 -:105110001ED13179C27E91421AD17179027F9142BA -:1051200016D1B179427F914212D1F179827F9142B9 -:105130000ED1317AC27F91420AD1317801E033E059 -:1051400038E0407EC1F38011814208BF012600D0C3 -:105150000026B9F1000F05D1BBF1000F04D0FDF717 -:10516000E9FD08B1012200E0002295F89E00012827 -:1051700001D010B10AE03CB908E02EB995F8AE10A4 -:1051800095F89F30994201D1012100E000210A42A7 -:105190000AD0012804BF002ED5F898003FF440AF94 -:1051A000BDE8F84F00F097BAFDF7A6FFBDE8F84F4D -:1051B000FFF78DBB95F89D00032818BF02287DD10D -:1051C000BAF1000F7AD0B9F1000F77D1874E95F878 -:1051D0007800002872D1012485F87A4095F8AD0056 -:1051E00018B1FDF78AFB012823D0304608F023FAD6 -:1051F00085F87B0005F17C01304608F0FEF9304669 -:1052000008F026FA85F8820005F18301304608F09F -:1052100002FA98F8000005F189067F2808BFFFDF31 -:1052200098F80000307088F8007085F87840032006 -:105230009FE0FDF7A5FB05F17C02511E07F00CFA7B -:10524000002808BFFFDF95F87B0040F0020085F8DA -:105250007B00D4E795F8AD0018B1FEF7F9F8FDF73B -:105260002CFB6348FEF71AF9002871D188F800700A -:10527000D1E05E4808F0B6F988F802005D48F178A0 -:10528000427A91421ED13179827A91421AD1717952 -:10529000C27A914216D1B179027B914212D1F17951 -:1052A000427B91420ED1317A827B91420AD1317890 -:1052B0000078C1F38011B1EBD01F00E049E008BFD6 -:1052C000012600D00026FDF717FF98F802000428F9 -:1052D00067D1E6B34648FEF7E1F8002808BF88F832 -:1052E0000070FEF7C6F895F8B80000281CBF002033 -:1052F000FFF738FB4FF0010985F8B8903B4E95F861 -:105300004D0030BB042085F84F0095F8AD00A6F1A4 -:10531000910418B1FDF7F1FA012830D0304608F0B9 -:105320008AF9354981F8500004F12601304608F029 -:1053300064F900BF05F15801304608F0E0F985F83E -:1053400057001F2884BF1F2085F8570002E028E07F -:1053500061E010E098F8000005F177047F2808BFAD -:10536000FFDF98F80000207088F8007085F84D90F5 -:10537000042001F003F9BDE8F84FFFF7A8BAFDF7E4 -:10538000FFFA04F12602511E07F066F9002808BF53 -:10539000FFDF194890F8500040F0020084F8250023 -:1053A000C8E71348FEF77AF8002808BF88F80070AD -:1053B000FEF75FF895F8B800002804BF0120FFF75A -:1053C000D1FA85F8B840BDE8F84FFFF780BAFFDFA3 -:1053D000BDE8F88F95F8B000052828BFBDE8F88F24 -:1053E000DFE800F00303030C2100F1E7E00C0020EC -:1053F000C4000020080D0020240C002095F8AD000A -:1054000018B1FEF725F8FDF758FAFE48FEF746F802 -:1054100000283FF42BAFFEF72CF8FDF76DFEBDE83A -:10542000F84FFFF754BAF748FEF738F8002808BFDE -:1054300088F80070FEF71DF895F8B800002804BF42 -:105440000120FFF78FFA85F8B840FDF755FEBDE85B -:10545000F84FFFF73CBA70B5EB4C94F8B000072852 -:1054600077D2DFE800F08C8C8C8C8C040D00E74840 -:10547000FDF7C3FEFEF707F8042084F8B00070BD06 -:10548000FDF7C9FFFDF762FFFDF736FEFDF799FE58 -:10549000012584F8B850022084F8B000FDF7AAFE78 -:1054A0002078002818BFFFDF0026A670D4F89800E7 -:1054B0000188A180418861838188A183C088E083BD -:1054C00094F8B10084F8200094F8AB10D04849B1AA -:1054D0000178C21CC1F3801121B1517901F0C001E2 -:1054E00040292ED094F8AC1041B110F8031BC1F341 -:1054F000801119B1407910F0C00F22D0C5480AF0D0 -:1055000093F900BF94F8AD0018B1FDF7F6F9012842 -:1055100020D0D4F89800417EE171D0F81A10A16033 -:10552000C08BA081666126832570D4F8980000881E -:10553000F9F72CFCF9F7DCF8BDE87040022001F027 -:105540001DB8D4F8E700C4F80E00B4F8EB00608290 -:10555000D8E714E0FDF714FA04F10802E11D07F0A2 -:105560007BF8002808BFFFDFE07940F00200E0711F -:10557000D4F8BF006061B4F8C3002083D4E7FFDF34 -:1055800070BD70B5A04C94F8B0000025052828BF68 -:1055900070BDDFE800F03939391B03009948FDF789 -:1055A0007DFF10B997497F200870FDF762FF94F8DE -:1055B000B800002804BF0120FFF7D4F984F8B850E0 -:1055C000FDF79AFDBDE87040FFF781B9FDF723FFB5 -:1055D000FDF7BCFEFDF790FDFDF7F3FD94F8AD007F -:1055E00028B1FDF735FFFDF768F984F8AD500120CB -:1055F00084F8B800022084F8B000FDF7FBFDBDE898 -:105600007040002000F0BABF70BD002201F098B8D1 -:1056100070B5012000F027FF7B4CC8B104F1E40114 -:10562000A1F1280008F017F804F1E40694F88D10B1 -:10563000304607F0F7FF04F18E01304607F0D6FF41 -:1056400094F8AB00C0B394F89C0003281FD025E069 -:10565000FDF7E1FEFDF77AFEFDF74EFDFDF7B1FD2A -:1056600094F8AD0030B1FDF7F3FEFDF726F9002008 -:1056700084F8AD00012084F8B800022084F8B0005E -:10568000FDF7B8FDBDE87040002000F077BF94F84A -:105690009700002818BF94F89F0001D194F8AE003D -:1056A00007F0DDF8050007D00121304607F0BAFF0A -:1056B0002946304607F09AFF5548FDF79EFD012127 -:1056C0000846FDF703FF00210846FDF7E8FD052029 -:1056D00084F8B00070BD2DE9F041022000F0C3FE57 -:1056E000494C0126E0B1012000F048FF04F1E4013B -:1056F000A1F1280007F0AFFF04F1E40794F88D1042 -:10570000384607F08FFF04F18E01384607F06EFF30 -:1057100094F8AB00B8B394F89C0003281ED024E0A2 -:10572000FDF779FEFDF712FEFDF7E6FCFDF749FDFA -:1057300094F8AD0030B1FDF78BFEFDF7BEF8002008 -:1057400084F8AD0084F8B860022084F8B000FDF75A -:1057500051FDBDE8F041002000F010BF94F8970023 -:10576000002818BF94F89F0001D194F8AE0007F00C -:1057700076F8050007D00121384607F053FF294687 -:10578000384607F033FFD4F89800C18A204807F064 -:10579000E2FFD4F89800017D1D4807F0E0FF1C48A7 -:1057A000FDF72BFD84F8A860062084F8B000BDE862 -:1057B000F08170B50C46054607F0F2FE032C53D07D -:1057C000052C18BF70BD0521284607F0ECFE0E4CD5 -:1057D000D4F8980000F10D01284607F0A6FFD4F890 -:1057E000980000F11101284607F0A3FFD4F89800B3 -:1057F000017D284607F0B3FFD4F89800C18A2846F7 -:105800000AE00000C4000020240C0020E00C00206E -:10581000080D0020320C002007F09DFFD4F89800FE -:105820004188284607F08BFFD4F8980081882846E5 -:1058300007F089FFD4F89800C188284607F087FF51 -:10584000D4F8980000F10801284607F09FFFD4F82B -:105850009800017E284607F084FF94F8B11028468E -:10586000BDE8704007F087BF2846BDE870400321BF -:1058700007F099BE2DE9FF5F06460C46488840F2C6 -:10588000E24100FB01FBE08A002500FB01FA94F8ED -:105890005B001746082816BF07284FF001084FF095 -:1058A0000008039818B10121204603F0E5FA94F8A6 -:1058B000C800DFF8149448B1012878D002285DD0E0 -:1058C000032818BFFFDF72D000F0CFB8002F08BF49 -:1058D000FFDFFE4D6868002808BFFFDF94F84C002A -:1058E000012808BF002004D002281ABFFFDF0020D3 -:1058F0000120FDF7B6FC00F2E7314FF47A70B1FBFE -:10590000F0F1F24840680D1894F84C00012808BFE7 -:10591000002004D002281ABFFFDF00200120FDF77D -:10592000A0FC074694F84C00012804D002280CBFC4 -:10593000CB46FFDF01D0DFF898B394F84C00012884 -:1059400005D002280CBF4FF47A70FFDF01D04FF46E -:10595000C860584438444AF2531101444FF47A70F5 -:10596000B1FBF0F040F2E241081A00EB0A01D7481F -:10597000006928440844051D012014E0DFF84CB3F9 -:10598000791EDBF80400084308BFFFDFD148006838 -:1059900000EB0A0537B1DBF8040000F20F30A84233 -:1059A00088BFFFDF032084F8C8005DE0FFE794F8BC -:1059B0005B005D4620281CBF94F85C00202845D180 -:1059C000B4F85000B4F8FE10401A401C00B2002891 -:1059D0003CDB94F8FC00C8B394F84C00012804D0D8 -:1059E00002280CBFCA46FFDF01D0DFF8E4A294F81A -:1059F0004C00012805D002280CBF4FF47A70FFDF5D -:105A000001D04FF4C8600AEB000B94F8FC000128A9 -:105A100004D002280CBFCA46FFDF01D0DFF8B0A2D5 -:105A200094F8FC00012805D002280CBF4FF47A70CE -:105A3000FFDF01D04FF4C8605044ABEB000000F230 -:105A4000E7314FF47A7091FBF0F0054467B19F4F56 -:105A5000786818B97888002818BFFFDF786800F2E6 -:105A60000F30A84288BFFFDF05B9FFDF2946D4F811 -:105A7000CC00FAF7E6FEC4F8CC00B060002030702D -:105A800001273771204603F0E0FAA8F1010108422E -:105A900008BF777106D094F8C80001280CBF022017 -:105AA0000320707194F84C00012803D0022818BF1D -:105AB000FFDF01D0DFF8189294F84C00012805D0E0 -:105AC00002280CBF4FF47A70FFDF01D04FF4C8609A -:105AD000814494F84D00012808BF002004D002281A -:105AE0001ABFFFDF00200120FDF7CAFB48444AF23D -:105AF000AB3101444FF47A70B1FBF0F0616A00F20F -:105B00003D100844F060039830EA080004BF04B078 -:105B1000BDE8F09F2946304607F096FB1FFA80F853 -:105B2000204603F092FA40450FD88046777105FB76 -:105B300008F1D4F8CC00FAF784FEB060294630466C -:105B400007F082FB40441FFA80F84146204603F0EC -:105B500093F9B068C4F8CC0004B0BDE8F09F2DE91B -:105B6000F0475D4E054684B096F800040C46DFF819 -:105B70006CA140099AF800144909884218BFFFDF58 -:105B800096F800044009564991F8001449098842E2 -:105B900018BFFFDF4D4E6F1E06F13C0909EB4508AB -:105BA0000025092C80F00A81DFE804F0056D777785 -:105BB00072FEFEFEB4000B2FA8BFFFDF38F8020C08 -:105BC0000621F8F788FF040008BFFFDF0B2FA8BFEE -:105BD000FFDF38F8020C2188884218BFFFDF94F8F5 -:105BE000C800002808BFFFDF204602F012FF7560E2 -:105BF000758021460020356107F061FB00F19807B0 -:105C0000606AB8422ED994F84C00012804D00228CA -:105C10000CBF2D4DFFDF00D02D4D94F84C00012816 -:105C200005D002280CBF4FF47A70FFDF01D04FF48B -:105C3000C860054494F84D00012808BF002004D036 -:105C400002281ABFFFDF00200120FDF719FB2844BE -:105C50004AF2AB3108444FF47A71B0FBF1F1606A5B -:105C60000844C51B21460020B56007F028FB618869 -:105C700040F2E24251439830081AA0F20F30F0602F -:105C800004B0BDE8F08704B0BDE8F04702F0E6BF1D -:105C900004B0BDE8F047FDF7ADBC9AF8140D11490A -:105CA000400991F800144909884218BFFFDF0B2F03 -:105CB000A8BFFFDF38F8020C0621F8F70CFF04003C -:105CC00008BFFFDF0B2F0FE0E46A0100300D00205A -:105CD000445B0100D000002001E000E00BE000E0A8 -:105CE00018E000E019E000E0A8BFFFDF38F8020C80 -:105CF0002188884218BFFFDF002201232146684621 -:105D0000FFF7B8FD94F8D2006946FAF712FF04B025 -:105D1000BDE8F0870B2FA8BFFFDF38F8020C062183 -:105D2000F8F7D9FE040008BFFFDF0B2FA8BFFFDF85 -:105D300038F8020C2188884218BFFFDF94F8C800A9 -:105D4000042818BFFFDF84F8C85094F8D2704FF6CB -:105D5000FF78781E0B28A8BFFFDF09EB470020F86B -:105D6000028C94F8D200FAF73DFD84F8D250D4F8B2 -:105D7000D800002804BFD4F8D400706108D0D4E95A -:105D800037121144826911448161D4E93501C86038 -:105D9000D4F8D40000281CBFD4F8D810016106D173 -:105DA000D4F8D800002800E008E018BF8561FE485C -:105DB000007804B0BDE8F047F4F784B8FFDF04B022 -:105DC000BDE8F0872DE9F047F84D0746E88B6C6891 -:105DD000401CE88328784FF00008002808BFFFDF48 -:105DE00007D0DFF8CCA3042814D0052818BFFFDFA4 -:105DF00040D021462869FAF724FDB86087F8008072 -:105E000001203871A86800F22710F860287804286B -:105E10007CD185E00029ECD02E69DAF8141039B372 -:105E20008946C9680029FBD1B9F1000F20D099F843 -:105E30000000002808BFFFDFD9F81410D9F80400CB -:105E400001443046FBF70DFE002807DA211A4A1EEE -:105E500092FBF4F202FB0406214604E090FBF4F20C -:105E600002FB140621468E4288BFFFDF3446C0E79E -:105E70004446BEE70029BCD0D5F81890B9F1000F10 -:105E800008BFFFDF0026D9F8DC10DAF814403046EE -:105E9000721E5CB1A069884228BF824284BF02465C -:105EA00026462046E468002CF4D106B9064609F1DE -:105EB000C804C9F8D860002E04BFC4F80C80CAF822 -:105EC000144005D0F068F460E060002818BF046159 -:105ED000D4F81090C4F81880B9F1000F0ED0D9F89A -:105EE000180048B1D4F814A0504538BFFFDFD9F8E6 -:105EF0001800A0EB0A00A061C9F81880002E08BFA6 -:105F0000C5F8208009D03078002800E00DE008BFF7 -:105F1000FFDF716970680844286240F6B83468E7AA -:105F2000E88B0A2838BF032000D302207871E88B61 -:105F3000012806D93846696807F086F9E98B0844D4 -:105F4000E883B8682861BDE8F0872DE9F041994CF5 -:105F5000804684B094F800040E46974F410997F8A4 -:105F600000044009814218BFFFDF94F80004400993 -:105F7000924991F800144909884218BFFFDF0025B3 -:105F80000122092E894C5DD2DFE806F0051B36366A -:105F9000315C5C184B0062732273607800281CBF70 -:105FA00004B0BDE8F0818248456005612573A068B2 -:105FB000CD38FEF74CFD002818BFFFDF04B0BDE868 -:105FC000F081607850B1207B002808BFFEF7E5FE25 -:105FD000657304B0BDE8F041FAF747BBA273FEF762 -:105FE000F7FD002818BFFFDF04B0BDE8F08104B062 -:105FF000BDE8F041FDF7FEBA97F8140D704940096D -:1060000091F800144909884218BFFFDF0021684653 -:10601000FFF7D8FE69464046FAF78BFD04B0BDE8AD -:10602000F0812078052818BFFFDF207F002808BFF7 -:10603000FFDF25772570207DFAF7D4FB257504B0A6 -:10604000BDE8F081FFDF04B0BDE8F0812DE9F0414B -:10605000564C84B00025207804281FBF20780528DE -:106060000C2004B018BFBDE8F08101276770607B89 -:10607000002690B172B6607B00281CBFA07B002870 -:1060800005D0FEF78AFE6673A673FAF7EEFA62B6DB -:10609000207DFBF772FDD0B913E094F81480032043 -:1060A0008DF804008DF80500FAF7B2FB02904FF06E -:1060B000FF3003908DF8007069464046FAF739FDCD -:1060C000E6E720BF207DFBF758FD0028F9D0207FB0 -:1060D00028B126772078052818BFFFDF0C256670C9 -:1060E0002670207DFAF77EFB267504B02846BDE8B1 -:1060F000F0812DE9F0472D4884B00078002818BFC2 -:10610000FFF7A4FF01202A4E307069460620F8F7F9 -:106110006EFC002818BFFFDF00254FF6FF7718E060 -:10612000029800281CBF90F8C810002911D00088E0 -:10613000B84218BFDFF88C8056D00621F8F7CBFCA8 -:10614000040008BFFFDF94F8D200FBF716FD68B922 -:1061500005E06846F8F729FC0028E1D044E020BFBC -:1061600094F8D200FBF709FD0028F8D084F8C85055 -:1061700094F8D2904FF6FF7AA9F101000B28A8BF3E -:10618000FFDF08EB490020F802AC94F8D200FAF7E0 -:1061900029FB84F8D25069460620F8F728FC00282D -:1061A00018BFFFDF1BE00000CC000020480D0020DE -:1061B000300D002001E000E00BE000E018E000E01E -:1061C00019E000E06C0D0020029800281CBF90F838 -:1061D000C810002903D00088B842AED104E0684658 -:1061E000F8F7E3FB0028EFD03570756104B00020AC -:1061F000BDE8F08710B50078FE4C60B101280CBFF7 -:1062000040F6C410FFDF06D0A06841F66A0188425C -:1062100028BFFFDF10BDA060F6E710B5F54C0023E6 -:106220002070F548037043700377037343738373DF -:1062300083610375183843703C304FF6FF7101805D -:106240000522418020F8041F521EFAD1180008BF11 -:10625000A36005D0002B0EBFFFDF40F6C410A06086 -:10626000A06841F66A01884228BFFFDFBDE8104000 -:106270003FE72DE9F043E04C054685B0207817460E -:10628000884600281EBF0C2005B0BDE8F08395F8B5 -:106290004C000026012805D002280CBFDFF85C93D3 -:1062A000FFDF01D0DFF8589395F84C00012805D0A6 -:1062B00002280CBF4FF47A70FFDF01D04FF4C860A2 -:1062C000814495F84D00012808BF002004D0022821 -:1062D0001ABFFFDF00200120FCF7D2FF48444AF23A -:1062E000AB3108444FF47A79B0FBF9F0696A00F2F7 -:1062F0000A300844C5F8DC00A56195F8C8000028FC -:1063000018BFFFDF40F2712008FB00F06060002042 -:10631000FCF7B6FF00F2E730B0FBF9F040F2712174 -:1063200007FB0100A0606168A1F53D71884298BF3C -:106330000146B448A160066105202070667026778A -:10634000E683B148FAF7FEF92075002808BFFFDFA1 -:10635000FAF75EFA206101216846FFF733FD207DE0 -:106360006946FAF7E6FB05B00020BDE8F083A248D5 -:10637000007800281CBF0020704710B50620F8F7F1 -:1063800047FB80F0010010BD30B59B4C85B02278F2 -:10639000002A1EBF0C2005B030BD0D4640F2712111 -:1063A000484360600020FCF76BFF4FF47A7100F205 -:1063B000E730B0FBF1F040F2712105FB0100A06075 -:1063C0006168A1F53D71884298BF01460020A16037 -:1063D000607004212170E0838B48FAF7B3F92075CF -:1063E000002808BFFFDFFAF713FA40F6B831FAF7D2 -:1063F00028FA206101216846FFF7E4FC207D694608 -:10640000FAF797FB05B0002030BD70B57A4CA16952 -:106410000160FFF71BFE002300BBA169D1F8D82063 -:106420005AB1D1E937C5AC449569AC44C2F818C03B -:10643000D1E9352CCCF80C2005E0DFF8C8C1D1F843 -:10644000D420CCF81420D1F8D420D1F8D810002AC8 -:1064500018BF116102D1002918BF8B61A36170BD03 -:10646000684948707047674910B54968002801F1CC -:10647000980408BF04F5BC7409D0012808BF04F5CE -:10648000317404D0022814BFFFDF04F5B0745A48F9 -:106490008068A0428CBF0120002010BD10B5594C6F -:1064A000607828B1D4E90201626806F0F4FEA060C9 -:1064B000D4E9010188429CBF2078002814BF002045 -:1064C000012010BD042210B584B0002938D0012964 -:1064D00001BF032180F8C81004B010BD022928D0E4 -:1064E00003291EBFFFDF04B010BD0446408840F200 -:1064F000E241484345490860D4F8F0000089E08251 -:10650000D4F8F00080792075D4F8F00040896080DC -:10651000D4F8F0008089A080D4F8F000C089E08031 -:106520002046616A06F05BFF022084F8C80004B0D0 -:1065300010BD80F8C82004B0BDE81040FAF795B847 -:10654000044630480078002818BF84F8C82004D0DA -:1065500004B0BDE81040FAF788B8012200232146B4 -:106560006846FFF787F994F8D2006946FAF7E1FA2E -:10657000B4F85000401CA4F85000E9E72DE9F041C0 -:106580001C4F00251C4C397884B0052880F0D3803E -:10659000DFE800F003137FCBCB00E5830846F3F779 -:1065A00091FC6078002873D100216846FFF70AFC4F -:1065B000207D6946FAF7BDFA7CE00020FCF760FE1A -:1065C0001349DFF8408008444FF47A71B0FBF1F0D2 -:1065D0002169D8F8042040F2E2431144081AA16965 -:1065E00000F2DE604A88C83102FB03F5D8F81420B7 -:1065F0008A420FE0CC000020480D0020E46A010030 -:10660000445B0100300D00204B5F0100D0000020F2 -:10661000D702020008BF002614D0216AFBF721FA36 -:10662000002807DA291A4A1E92FBF5F202FB05063A -:10663000294604E090FBF5F202FB150629468E423E -:1066400088BFFFDFB868864208D2A06940F2712295 -:106650004188C1824A4306EB420605E040F2E2402F -:10666000B6FBF0F0A169C882A06905210175C08A56 -:106670006FF41C71484306EB400040F63541C8F802 -:106680001000B0EB410F28BFFFDF04B0BDE8F08180 -:1066900010E0E5830846F3F715FC01202077A06998 -:1066A0002169C0F8CC1080F8C8502178052918BF9E -:1066B000FFDF06D0F9F7D9FF6573A57304B0BDE815 -:1066C000F081002808BFFFDFA06990F8C80000280B -:1066D00018BFFFDFA06990F8D200002818BFFFDFC5 -:1066E0002648FAF72FF8A169064681F8D2000F88EC -:1066F000401E0B28A8BFFFDF214800EB460020F812 -:10670000027CA06990F8D200002808BFFFDF0023B8 -:1067100001226846A169FFF7ADF8A069694690F8C3 -:10672000D200FAF706FAA561C4E704B00846BDE84E -:10673000F041F3F7C7BBFFDF04B0BDE8F08170475D -:1067400070B5104D0446A1B1012908BF401E10D0FC -:1067500002291CBFFFDF70BD6888401C688010469E -:10676000FCF77FFD4FF47A7100F2E730B0FBF1F0F7 -:10677000201A686070BD0448007870475F5B0100B4 -:106780006C0D0020300D0020480D0020F748C07E21 -:106790007047F74840687047F648C07E70472DE95B -:1067A000FF4FDFF8C88391B09A46D8F82400D8F894 -:1067B0000050934604680F464FF0000994F84D00CE -:1067C0000A901E9840EA0A000E9094F85C0008288F -:1067D0000CBF012000200B90BAF1000F04BF1198EC -:1067E00003284CD10B98002849D0B4F81C01584517 -:1067F00045D1DE482646CDE90450204604F0F1FAA2 -:106800000598B6F8DE10DE4A008B014404988160DA -:10681000D94840680068816904980160708840F236 -:10682000E241414304984160B6F82001F08296F8B5 -:106830001E013075B6F822017080B6F82411B180BF -:10684000B6F82611F180CD490B79096832F813307A -:1068500091F8041132F8111019440A04120C4FF087 -:10686000000105D002FB00F1C648B1FBF0F0411C6D -:106870008AB23046716A06F0CDFD02201190D8F838 -:106880000000BAF1000F00690F90D8F820000890BE -:10689000B4F8DE000490B4F8FC00D4F8F8100791C6 -:1068A00006D095F8341061B115B00220BDE8F08F24 -:1068B00004F1D801059120310C9108F10406091D5D -:1068C00007E005F148010591091D0C9105F1380615 -:1068D000091D0D91B4F85010ABEB0000ABEB0101BA -:1068E00009B200B20991002806DAA348006840699D -:1068F000079001200E9008461199002969D00129BE -:1069000000F09781022900F0CE80032918BFFFDF35 -:1069100000F0E98149460798F9F793FF0C99BAF11D -:10692000000F08600D98A0F800B00C980068B060E7 -:1069300014BF032001203071D5E90710814287BFC1 -:1069400005990860059801600598616A0068084427 -:1069500000F24F10F060012070710B99002900F0D7 -:106960005B821E99C9B100BFB4F8F020002A0CBFA9 -:106970000021B4F8F210A4F8F21094F8F430491C95 -:106980005943914209D27179491E002905DD707180 -:10699000B4F8F200401CA4F8F20086F800A0BAF1A6 -:1069A000000F1CBF95F8340000287FF47DAF8AF0FB -:1069B000010085F8350098F81C0098F81B20314636 -:1069C00098F81A309A4200F04E82FAF7B2F800F0C6 -:1069D00053BA0898002808BFFFDFE08A40F271210F -:1069E0004843490001EB40010020002F06D06548D4 -:1069F00007FB01F1B1FBF0F000F101006861608874 -:106A000040F2E24100FB01F14FF0000006D05D488A -:106A100007FB01F1B1FBF0F000F10100A86108985B -:106A200000F101094FF00000FCF72AFC00F5AC3042 -:106A30004AF2B12100F5517001444FF47A70B1FB74 -:106A4000F0F0E18A40F2712251436F69C0EB4100DE -:106A5000C01B484400F2C249207D510010FB01F0E8 -:106A600004900020FCF70CFC00F5AC3101F55171ED -:106A70004AF2531001444FF47A70B1FBF0F000EB8E -:106A8000470104980F180020FCF7DFFB3844623000 -:106A9000E86128620898A9EB0000401EB0F5387F35 -:106AA00098BFFFDF36E7E08A40F271216A68484309 -:106AB00002EB40010020002F06D0324807FB01F115 -:106AC000B1FBF0F000F101006861618840F2E2433F -:106AD00001FB03F34FF0000106D02A4907FB03F343 -:106AE000B3FBF1F101F10101A9610499E9BB1E9920 -:106AF000D9B394F84D00012804D002280CBF224FCE -:106B0000FFDF00D0214F94F84D00012808BF00207E -:106B100004D002281ABFFFDF00200120FCF7B0FBE1 -:106B200039184AF2531001444FF47A70B1FBF0F077 -:106B30006969E28A014440F2712368685A4300EBB4 -:106B40004200471A94F84D00012808BF002004D0E5 -:106B500002281ABFFFDF00200120FCF776FB0F9907 -:106B6000081A3844A0F120091AE011E0840D002031 -:106B7000F0000020AC0D0020E0000020E800002024 -:106B80004EFC010040420F00E46A0100445B01003A -:106B9000E18A40F27123594302EB4101A1EB000964 -:106BA000AA682968686901FB02000990207D40F20B -:106BB000E24110FB01F0089094F84D000490012888 -:106BC00008BFF84F08D002281BBFFFDFF54FF64F74 -:106BD000FFDF08BF012001D04FF00000FCF750FBA1 -:106BE00039184AF2531001444FF47A70B1FBF0F1B6 -:106BF000099801EB400108980F180498012808BF74 -:106C0000002004D002281ABFFFDF00200120FCF77B -:106C10001CFB38446030E861618840F27122A86949 -:106C20005143C0EB4100A0F5477028620120287352 -:106C300070E6628840F27123A9695A43C1EB4202AF -:106C400002FB00F9099A0498D5F800C00244A8682C -:106C50006B69121A0CFB0030521E02FB01000A90F5 -:106C6000207D40F2E24110FB01F0099094F84D00C4 -:106C70000490012808BFCB4F08D002281BBFFFDFBC -:106C8000C84FC94FFFDF08BF012001D04FF00000FF -:106C9000FCF7F6FA39184AF2531001444FF47A70AF -:106CA000B1FBF0F10A9801EB400109980F18049824 -:106CB000012808BF002004D002281ABFFFDF0020EF -:106CC0000120FCF7C2FA38446030E861A9F547704A -:106CD0002862B648406800283FF41CAE0898002897 -:106CE00008BFFFDF16E6628840F27123A9695A43A4 -:106CF000C1EB420101FB00F994F85B0020281CBFA6 -:106D000094F85C0020280BD1B4F81C01ABEB000018 -:106D100000B2002804DB94F81F01002818BF0A9075 -:106D20000E9830B1049800280F9840D0002818BF62 -:106D3000FFDF099904980844A969484304900A9818 -:106D40000890012808BF974F08D002281BBFFFDF1B -:106D5000944F954FFFDF08BF012001D04FF0000096 -:106D6000FCF78EFA39184AF2531001444FF47A7046 -:106D7000B1FBF0F1049801EB40070898012808BF27 -:106D8000002004D002281ABFFFDF00200120FCF7FA -:106D90005CFA38446030E861618840F27122A86989 -:106DA0005143C0EB4100A0F547702862B2E50028CE -:106DB0001ABF08980028FFDF0A98012808BF794FFA -:106DC00008D002281BBFFFDF764F774FFFDF08BFD9 -:106DD000012001D04FF00000FCF752FA39184AF2B6 -:106DE000531001444FF47A70B1FBF0F0A9EB0007A7 -:106DF00094F84D00012808BF002004D002281ABFD3 -:106E0000FFDF00200120FCF720FA0F99081A384410 -:106E1000A0F120098DE700BFB4F8C810A1EB0B0169 -:106E200009B20029C4BF03217171119900293FF4EF -:106E300098AD1E9900297FF497AD618840F27122C8 -:106E4000A8695143C0EB4101304606F0FDF900044A -:106E5000000C3FF4A2AD1F99002918BF0880012043 -:106E600015B0BDE8F08F002088F81B0088F81A00E4 -:106E7000C8F80000C8F8240015B00020BDE8F08F65 -:106E800070B54A4D0929D5E900327BD2DFE801F01F -:106E9000056981907DA3A3669F0000201062D17ECA -:106EA00004295CD2DFE801F05B5B0253516A0C6895 -:106EB0001168C88111680861106890F8350040B900 -:106EC000F9F7A6FC69680968096CFAF7CAFD002899 -:106ED0001BDC686801684A8EB4F850108A4207D1FA -:106EE000B4F8CC20511AA4F8CE10A4F8502006E033 -:106EF000511AA4F8CE100168498EA4F85010026807 -:106F0000C1681164C16841611CE068680168098E4C -:106F1000B4F85020891AA4F8CE100168098EA4F89C -:106F2000501001680A6CC2600A6C4261896CC4F836 -:106F3000D8100168C96CC4F8F8100068B0F85000A7 -:106F4000A4F8FC002046BDE8704003F089BDD0687D -:106F50005061FCF7BDFF002818BFFFDF70BDFFDFE9 -:106F600070BDD07E04280ED2DFE800F00D0D0206C1 -:106F7000BDE8704003F033BFFDF73DF9002818BFAE -:106F8000FFDF70BD27E0FFDF70BDBDE87040FCF79C -:106F900031BBD87E022816D0D87E032818BFFFDF69 -:106FA0000DE00000445B0100E46A0100E000002005 -:106FB000D87E022807D0D87E032818BFFFDFBDE89F -:106FC000704000F009BCBDE8704000F075BCBDE841 -:106FD0007040F9F707BCFFDF70BD2DE9F047FB4DAE -:106FE0000026FB4F82460C464FF00109092979D251 -:106FF000DFE801F005657171657878717100686886 -:10700000DFF8CC83002818BFFFDF21465046C5F8C3 -:107010000480FFF735FFF87E022818BFBDE8F0872F -:107020006868D0F80080406A0568F9F7D4FB044628 -:1070300095F84D00DFF89CA3012808BF002008D078 -:10704000022817BFFFDFDFF890A3FFDF002008BF93 -:107050000120FCF715F950444AF2531108444FF44B -:107060007A71B0FBF1F0D8F8181040F271220844A0 -:1070700069885143C0EB4100A0F1200AB72C98BFAA -:10708000B7242946012006F01AF92044AAEB000093 -:10709000A0F201342946012006F011F9696A9C30FA -:1070A000814288BF0E1AC8F82C40A64238BF344629 -:1070B000C8F82840386880F83490BDE8F08750461A -:1070C000FFF7DEFEF87E022804BF386880F83490AF -:1070D000BDE8F08706E050462F60FFF7D1FE2E6036 -:1070E000BDE8F087FFDFBDE8F0872DE9F041B74C40 -:1070F00007460D4609291ED2DFE801F005101414D9 -:10710000101D1D1414006068B44E002818BFFFDF66 -:10711000294638466660BDE8F041B1E63846BDE82C -:10712000F041ADE6AD4820603846FFF7A9FE0020EB -:107130002060BDE8F081FFDFBDE8F081F0B5A44933 -:1071400085B00026CA7EA14C032A03D02831CA7E0E -:10715000032A64D10025216000B3012806BF032063 -:107160008876FFDF0AD02068002E05604562256022 -:1071700055D09B48456005B00020F0BD2068C17E19 -:1071800029B1C17E827E914208BF20BFF6D0C17E68 -:1071900000290CBF012600268576E4E70026032798 -:1071A00008468F76C97E032904D0C07E002808BF18 -:1071B000012631E00120FDF73DF82068007F00281E -:1071C00008BFFFDF2068067F8DF804708DF805701A -:1071D000F9F71EFB02904FF4FA70039001208DF82E -:1071E000000069463046F9F7A4FC2068007FFAF7F2 -:1071F000C4FC30B920BF2068007FFAF7BEFC00282D -:10720000F8D02068007FF9F7EDFA20680577C57699 -:10721000857605600126456220688576A3E705B07E -:107220000C20F0BD2DE9F0416E4E054696F80004A5 -:107230006D4C400994F800144909884218BFFFDFDB -:1072400096F800044009694991F8001449098842F8 -:1072500018BFFFDF94F8140D4009654991F8001438 -:107260004909884218BFFFDF624800240570584D65 -:10727000EC76AC7605F12806F476B4760121103070 -:1072800000F10807017104606C6274622C60346064 -:1072900005F150087C6088F83740284600F01EFC55 -:1072A00005F1280000F01AFC88F80C407C706C6135 -:1072B0007461AC76B476A7F1100044600460BDE858 -:1072C000F0814D49087170472DE9F8434049054662 -:1072D000CA7E3E4C01F12800002A04BFC27E002A6B -:1072E00072D0C97E022907BFC17E00290C20BDE8EB -:1072F000F88320604148F9F725FA21680877384873 -:1073000045602168086014384862ADB1012105F17B -:10731000F400FAF7D5FE0620F7F788FB06460720AB -:10732000F7F784FB95F8F4103044B1FBF0F200FB62 -:107330001210401C85F8F4002068007F002808BF68 -:10734000FFDFF9F748FA2E49091838BF40F2F65026 -:1073500000F26B1087B220680326C676FCF791FC1A -:1073600021680861FCF7B1FC00254FF001080028F6 -:107370004FD0FCF7AAFC21684A6A10600868012116 -:1073800080F800806846FAF726FE9DF8000042F279 -:1073900010710002B0FBF1F201FB12000744F9F793 -:1073A00037FA3946F9F74DFA2168C8602268167233 -:1073B00056721571107FD37E111D92F81AC0634565 -:1073C00034D0F9F7B6FB35E01CE00000E000002007 -:1073D000840D0020445B0100E46A0100AC0D002034 -:1073E000F000002001E000E00BE000E018E000E029 -:1073F00019E000E0D8000020E8000020EB70010058 -:107400000AFAFFFFFE482160F9F79CF92168087726 -:1074100075E7F9F7FDF93946F9F713FA2168C860FD -:1074200008680570086880F80180BFE7D576957612 -:1074300015605562206805830020FCF7FBFE0020E4 -:107440002560BDE8F8832DE9F041EE4E82B0F17E73 -:1074500019B906F12801C97E19B102B00C20BDE8A6 -:10746000F0810221F176DFF8A483E74DC6F824808D -:1074700035600024C8F800002C73A0F8FC40E44FED -:1074800098F8041090F80421438837F8111037F861 -:10749000122011440A04120C214605D002FB03F10C -:1074A000DC4AB1FBF2F1491C8AB2416A05F0B2FF35 -:1074B00000940194D8F8001098F80400002391F883 -:1074C000041137F810001A4637F81110084481B239 -:1074D0001846FFF764F9002818BFFFDFAC600120F1 -:1074E0002C6028736C862C8685F83640D8F800000E -:1074F000B0F85010491EA0F85010348302B000209C -:10750000BDE8F081C04981F837007047C24810B526 -:1075100040680124817E032908BF002409D0016846 -:10752000497831B1006ABD49884284BF0024FCF724 -:107530007DFE204610BD70B5B74844682068C189FB -:10754000491CC1812268D2E90A0192F83720256AD4 -:10755000002A1CBF2A4605F09EFE216885428862EB -:1075600005D82068007B01281CBF012070BD0020C9 -:1075700070BD2DE9F043A84CA24883B02060416A59 -:10758000006800260D6880F8346095F8D610002950 -:1075900004BF007B032856D1F9F73AF90146206869 -:1075A0004069FAF75EFA00F2617000284BDD21684D -:1075B00040F271274A6A0B681268D3F818C05288E3 -:1075C0007A43CCEB4202B0FBF2F0B5F85020401CFD -:1075D000104418860868B5F8CC20018E511A09B2FB -:1075E000002930DD012180F83610B5F87600B5F8B5 -:1075F0007410DFF81C82401AB5F85010401E084481 -:1076000087B20DF1080917E0516A097938F81110AD -:10761000CDE90069028E95F80431007B38F813300B -:10762000194489B20123FFF7BAF860B101280ED0DE -:10763000022818BFFFDF06D022681068018E791A71 -:1076400009B20029E0DA266003B0BDE8F0832068C3 -:107650000068018EBDF8082011440186ECE770B582 -:1076600000256D4C052822D2DFE800F0141C030E23 -:107670000D00002000F0A6F96068C57685760560EB -:10768000456268B1656070BD2068C5768576056025 -:10769000456270BD012000F095F960680028F1D1C5 -:1076A000FFDFEFE7616803200968087370BDFFDF43 -:1076B00070BD2DE9F041584D002478B1012814D057 -:1076C00002281CBFFFDFBDE8F08100F0C0F9686848 -:1076D000C47684760460446220B929E000F0B7F9EA -:1076E000686828B36C60BDE8F08168684669016825 -:1076F0004C70C47684764A4F0460446200217868F6 -:1077000005F006FA786880F81A4180F81B41C0F845 -:10771000F860FFF798FE002818BFFFDFF8F7A5FF15 -:1077200040486C600078F2F7CDFB6C60BDE8F081FA -:10773000FFDFD7E7384910B54C68E17E022918BF52 -:1077400010BD2168CA89002A18BF10BD0861606A8F -:10775000006890F84D00012808BF002004D00228DE -:107760001ABFFFDF00200120FBF76FFD21680A69C7 -:10777000101A8A6A02448A622168CA6A1044C8627E -:1077800010BD70B5244D04460029686804BF04622A -:1077900070BD012902BF611E016270BD02291CBFBC -:1077A000FFDF70BD1046FBF75CFD4FF47A7100F20D -:1077B000E140B0FBF1F06968201A086270BD1A4818 -:1077C000C07E00281CBF0020704710B50720F7F7C7 -:1077D0001FF980F0010010BD2DE9F8430E4D4FF068 -:1077E0000308002728680126041D80F80880077117 -:1077F0000068407801284ED00121684616E000005C -:10780000DB6F0100840D0020D40D0020E800002073 -:107810004EFC010040420F00E0000020CF82130028 -:10782000F0000020D8000020AC0D0020FAF7D3FBB8 -:107830009DF8000042F210710002B0FBF1F201FB72 -:1078400012002968496A09680E183146A068F8F7DD -:10785000F8FFA0603146204605F0F6FC461C28687B -:10786000018B0A299CBF31440183984988421CBF7F -:10787000018B0A2992BF84F8058002216171027F81 -:10788000C37E214690F81AC063450FD0BDE8F84387 -:107890001046F9F74EB94FF47A71A068F8F7D1FFA6 -:1078A000A0600021204605F0CFFCD8E7C776877698 -:1078B00007604762BDE8F8832DE9F047844E84B045 -:1078C0003068416A04680D68F8F7A2FF32685269AF -:1078D00001461046FAF7C5F83168002700284A6AC1 -:1078E000126808BF38460AD00B68528840F2712CE3 -:1078F0009B6902FB0CF2C3EB4202B0FBF2F095F87D -:107900005C20082A0ED0B5F85020638E02EB000CE4 -:107910006345AEBF581C401C1044608694F8360086 -:1079200058B903E0608E401C608606E0608EB5F8B2 -:10793000CC20904204BF401C6086088BDFF8948105 -:10794000401C0883B5F87600B5F874100DF1080AEC -:10795000401AB5F85010401E08441FFA80F919E08B -:107960003068406A007938F81000CDE9007A95F85F -:10797000041138F81110084481B2207B0023FEF76F -:107980000EFF002804BF04B0BDE8F087012818BF2F -:10799000FFDF11D0628EA9EB020000B20028DFDA0F -:1079A000082085F86A00012085F8690004B028469F -:1079B000BDE8F04702F086BD608EBDF808100844AF -:1079C0006086E7E7F0B5424E002483B07168012875 -:1079D0004A6A15682ED110793E4B0A6833F81000B8 -:1079E000177B4FF0010C032F03D0117B012910D01E -:1079F00020E0946009680C60CDE900C495F804119A -:107A0000B5F8CC2033F811100023084481B20320CC -:107A10000BE0CDE900C495F80411B5F8CC2033F89B -:107A200011100023084481B20120FEF7B8FE00289F -:107A300018BFFFDFF8F719FE706804830268B5F815 -:107A400050105186006880F8364003B0F0BD38B55C -:107A50001F4C00200546616809684A78002A18BF53 -:107A60004D702AD1097861B101216846FAF7D7FA39 -:107A70009DF8000042F210710002B0FBF1F201FB30 -:107A800012006268516A09680144D068F8F7D9FEAB -:107A90006268D060157103205072107FD37E111D73 -:107AA00092F81AC0634502D0F9F743F803E0D5769F -:107AB00095761560556260680583F8F7D6FD06482F -:107AC0000078BDE83840F2F7FDB90000AC0D0020A9 -:107AD000E00000204EFC0100D80000202DE9F04716 -:107AE000DFF874801D4C05464FF01F090027EE7E1D -:107AF000042E23D2DFE806F02922021D454518BFD7 -:107B0000FFDF02202560A8762168C87E28B1C87EE4 -:107B10008A7E904208BF20BFF6D0C87E8F760028AC -:107B20001CBF4FF00C0927600CD10F604F6227601B -:107B30000BE00120FFF702FB814600E0FFDFB9F117 -:107B4000000F02D0E87EB042D1D1E87E002818BFF5 -:107B5000FFDFBDE8F0870000840D0020E00000207A -:107B600010B584B004466846FBF714FF002808BF30 -:107B7000FFDF009805F071FE0321009805F084FEF8 -:107B80000098017821F010010170214605F0F9FEFE -:107B9000192C80F02B81DFE804F03A2A0D65FAFAFF -:107BA000F91C9FFAF9F988FAFAFAFAF8F9F9ADC965 -:107BB000E5FAFC00FD48806890F8E910009805F0AF -:107BC00065FFFBF7FAFE00281CBF04B010BD00F0F3 -:107BD000F9B8F648806890F8C110009805F0A6FF43 -:107BE000FBF7EBFE002840F0258100F022B9EF48BA -:107BF0008068D0F8F400411C009805F038FFFBF7CE -:107C0000DCFE00281CBF04B010BD00F0DBB8E74C60 -:107C1000A068D0F8F0008179009805F0FCFEA0681B -:107C2000D0F8F0000189009805F0EEFEA068D0F8C9 -:107C3000F0004189009805F0D2FEA068D0F8F0006D -:107C40008189009805F0D2FEA068D0F8F000C189C3 -:107C5000009805F0D2FEFBF7B0FE00281CBF04B070 -:107C600010BDAFE0D14CA068D0F8F000011D009825 -:107C700005F010FFA068D0F8F00000F10C010098AA -:107C800005F012FFA068D0F8F00000F11E01009886 -:107C900005F010FFA06800F1B801009805F018FF8A -:107CA000FBF78BFE002873D1C1E0C04C60690178FE -:107CB000009805F025FF60698188009805F022FF93 -:107CC00060694188009805F021FFFBF776FE0028E7 -:107CD0001CBF04B010BD75E0B549D1E90001CDE984 -:107CE000020102A9009805F025FFFBF766FE0028B7 -:107CF0004ED19CE0AD4CA068B0F84010009805F063 -:107D000023FFA068B0F84210009805F021FFA0689A -:107D1000818F009805F020FFA068C18F009805F0C2 -:107D20001FFFFBF74AFE002877D180E09F4CA06838 -:107D3000818F009805F010FFA068C18F009805F0B2 -:107D40000FFFA068B0F84010009805F0FDFEA06895 -:107D5000B0F84210009805F0FBFEFBF72EFE00285D -:107D600068D166E0914CA06890F80D11009805F07C -:107D700027FFA06890F80E11009805F025FFFBF78B -:107D80001CFE002849D152E003E01EE02FE02DE068 -:107D900043E0864CA06890F8FC0005F0A0FB01468B -:107DA000009805F015FFA06890F8FD0005F097FB1E -:107DB0000146009805F010FFFBF7FFFD00281CBFEF -:107DC00004B010BDFFDF04B010BD784CA06890F87F -:107DD000E510009805F024FFA06890F8E4100098E2 -:107DE00005F022FFFBF7E9FD20BB22E0FFDFFBF7F8 -:107DF000E4FD002808BFFFDF0C2C19BF132C182C42 -:107E000004B010BD112C1CBF072C152C12D0012C56 -:107E100019BF002C022C04B010BD002163488068FB -:107E2000A0F87A10012180F87E1004B010BDFFDFA9 -:107E3000F3E7FFDF5D4900208968A1F8800004B006 -:107E400010BD2DE9F043594C83B0207910F0010F9B -:107E500004BF03B0BDE8F083206900230521C57885 -:107E6000A06890F85B20503005F098F9002818BF02 -:107E7000022D0CD00B2D18BF042D08D0052D1CBFD2 -:107E8000062D0D2D03D0607840F0080060706078FA -:107E900000281CBF03B0BDE8F0832069C078801EB5 -:107EA000162880F0E683DFE810F01600E4038F0068 -:107EB000AD0006012E00E403C801E4038500500173 -:107EC000C800E403E403E403E40337021E024F02A4 -:107ED000B9022F03A403A0680023012190F85D20BC -:107EE000503005F05BF9002840F0D183206905F09F -:107EF000CFFDA16881F8EA00022081F85D00002032 -:107F000081F882003CE0A0680921002390F85B2002 -:107F1000503005F043F920B1206905F009FE122820 -:107F200014D0A0680A21002390F85B20503005F09F -:107F300035F920B1206905F0FBFD14281AD020691D -:107F400005F0F6FD162840F0A2831DE0A06801258B -:107F5000002390F85B200921503005F01FF900281C -:107F600008BF657000F093836078002800F0CA8134 -:107F700000F08DBBA168002081F8900081F85B00C3 -:107F800081F87E0000F083BBA06890F85B101C298C -:107F900040F07D83002180F8911080F85B1080F81C -:107FA0007E101A2001F089F800F071BBF800002063 -:107FB00060FC0100A06890F85B100C2947D10021FB -:107FC00080F85F100F2134E0A06890F85B10102952 -:107FD0003DD1D0F8F01000884988814218BFFFDFFA -:107FE000A068D0F8F00000F12601206905F07DFDC1 -:107FF000A06800F1BC01206905F07FFD1320A16895 -:1080000000F07ABAA26892F85B0013281FD1D2F868 -:10801000F00002F1A80300F11E0100220E3005F06D -:1080200052F8A0680021C0E92611012180F85F10F4 -:10803000152180F85B1000F02ABBA16891F85B0065 -:10804000132812BF102891F88400002802D00220C3 -:1080500000F073BA206905F067FDA168002581F87A -:10806000C00081F8835081F87E50D1F8F000098873 -:108070004088884218BFFFDFA068D0F8F0100D706C -:10808000D0F82C110A78002A18BFFFDF40F02681B3 -:108090000288CA80D0F82C2190F8C0101171D0F855 -:1080A0002C110D72D0F82C210B211170D0F82C213D -:1080B0000188518040E0A06890F85B101829C6D173 -:1080C000002580F8835080F87E50D0F8F0100088AA -:1080D0004988814218BFFFDFA068D0F8F0100D700A -:1080E000D0F82C110A78002A18BFFFDF40F0F68084 -:1080F00090F884207AB180F884500288CA80D0F841 -:108100002C110D71D0F82C210C211170D0F82C21DC -:108110000188518010E00288CA80D0F82C110D71BE -:10812000D0F82C2101211172D0F82C210B211170D3 -:10813000D0F82C21018851800088F6F727FEF6F749 -:10814000D7FAE078F1F7BEFEC8E0A0680023194630 -:1081500090F85C20503005F021F850B9A068002359 -:10816000082190F85B20503005F018F8002800F046 -:1081700045826078002840F08A82A06890F88600E6 -:1081800010F0020F17D1206905F0C4FCA16881F836 -:108190008700206905F0C0FCA168A1F8880020696B -:1081A00005F0BDFCA168A1F88A0091F8860040F0B6 -:1081B000020081F88600A06890F8861011F0010F87 -:1081C00015D190F85C2000231946503004F0E6FFEA -:1081D000002808BFFFDF0121A068042280F85C109E -:1081E00080F8EC2080F882100021A0F88010A068B0 -:1081F00090F85B10012907D1002180F85B1080F80E -:108200007E10E078F1F75EFEA168D1F8F0000988F1 -:1082100042888A4204BF0178042940F03882002550 -:108220000570E078F1F74EFEA06890F85B10002929 -:1082300008BF80F87E5000F02ABAA068002307210A -:1082400090F85B20503004F0A9FF002800F0D681A0 -:108250006078002840F01B826946206905F0ABFC7D -:10826000A0689DF80020002590F88C10114001F0C6 -:108270002F0180F88C1090F88D109DF8012011408E -:1082800001F02F0180F88D1080F87E50D0F8F010AA -:1082900000884988814218BFFFDFA068D0F8F0103D -:1082A0000D70D0F82C110A78002A18BFFFDF15D105 -:1082B0000288CA80D0F82C110D71D0F82C11009AC8 -:1082C0008A60019ACA60D0F82C21062111700188B9 -:1082D000D0F82C014180E078F1F7F4FDA06880F837 -:1082E0005B5000F0D4B9A0680023092190F85B200E -:1082F000503004F053FF002800F08081607800289F -:1083000040F0C581A168002081F8720081F87E00EC -:1083100081F85B0000F0BBB9A0680023194690F813 -:108320005C20503004F03AFF002800F0678160784C -:10833000002840F0AC81A0680021A0F88010012145 -:1083400080F882100B2165E0A0680023194690F8A0 -:108350005C20503004F022FF00287DD0206905F019 -:108360000BFC28B3206905F0FFFB0646206905F0E9 -:10837000FDFB0546206905F0FBFB0746206905F07B -:10838000F9FBA1688F86CE8608874D8791F890000B -:1083900000281CBF91F85B001A2833D06846FBF711 -:1083A0001FFB58B3009805F018FB142820D025E0D7 -:1083B000A0680023194690F85C20503004F0EEFECF -:1083C000002800F01B816078002840F0608120695F -:1083D00005F003FBA16881F8C100052081F85C006D -:1083E0000020A1F88000012081F8820000F04FB940 -:1083F000A168002081F87E00FBF701FBA168002046 -:1084000081F89000A0680021A0F88010012180F878 -:1084100082101B2180F85C1000F039B9A06800239D -:108420000A2190F85B20503004F0B8FEA0B120691A -:1084300005F0A2FBE8B3206905F09AFB0746206926 -:1084400005F098FB0546206905F08EFB064620697D -:1084500005F08CFBA16800E051E0B1F82C80CB8DD9 -:10846000B1F830C04A8E8F86CE860D874887B1F826 -:108470003C90B14598BF4E468E85B1F84090B945C5 -:1084800098BF4F46CF85B1F83E90814598BF48468A -:108490000886B1F84290A94598BF4D464D869F4247 -:1084A00038BF1F46CF85954238BF15464D86464595 -:1084B00000E01BE008BF9F4203D1604508BF954222 -:1084C00014D00A88A1F81A218A8DA1F81C210A8EDD -:1084D000A1F81E21CA8D01F58870A1F82021498ECE -:1084E000418201210172E078F1F7ECFCA1680020E3 -:1084F00081F8900081F87E0081F85B00C7E0607829 -:1085000040F001006070C2E0A0680023194690F8B6 -:108510005C20503004F042FEC0B3A06890F85B20AD -:108520001C2A0CD000230B21503004F037FE002809 -:108530001CBF607840F0200011D06070A7E02321BC -:1085400080F8E410162280F8E520172180F85C10EE -:10855000012180F882100021A0F8801097E0A06827 -:1085600090F85B0005F013F888B1A0682A22162164 -:1085700080F8E42080F8E510172180F85C100121D4 -:1085800080F882100021A0F8801080E036E0206999 -:1085900005F018FB00F0070060F30705206905F0FF -:1085A00015FB00F0070060F30F25A06801210026ED -:1085B00080F88210A0F880601D2180F85C10B0F86F -:1085C0004A10ADF800102946C56C009804F08CFFE5 -:1085D000EAB2C1B28A4219BFA26882F8FC10A1684F -:1085E00081F8FC60C5F30721C0F30720814238D130 -:1085F0003BE0A06890F85B001C2801D001209CE7BC -:10860000206905F0DFFA00F0070060F30705206934 -:1086100005F0DCFA00F0070060F30F25A0680121E7 -:10862000002680F87E10A0F87A601F2180F85B1089 -:10863000B0F80D11ADF800102946C56C009804F093 -:1086400053FFEAB2C1B28A4219BFA26882F8FC1095 -:10865000A16881F8FC60C5F30721C0F307208142BF -:1086600003D0A16881F8FD0011E0A06880F8FD60EA -:108670000DE0A0680023194690F85C20503004F00B -:108680008DFD0028BAD0607800283FF4A0AEA06825 -:10869000D0E92812491C42F10002C0E9281203B0B7 -:1086A000BDE8F0832DE9F047FE4D04464FF000078A -:1086B000687808436870287910F0200F2846806891 -:1086C00018BFA0F8747004D1B0F87410491CA0F859 -:1086D000741090F86010012639B990F85B200023DF -:1086E0000621503004F05AFD58B3A88810F4006FEA -:1086F00007D0A86890F86010002918BFA0F86C7027 -:108700001FD1A868B0F86C10491C89B2A0F86C1091 -:10871000B0F86E208A422CBF511A00218288521D67 -:108720008A4228BF80F87260B0F86C10B0F86E20F2 -:10873000914206D3A0F86C7080F81661E878F1F7E2 -:10874000C1FB287910F0600F08D0A86890F85E107F -:1087500021B980F85E600121FDF7B4FE4FF00808F2 -:10876000002C47D16878002842D1287910F0040FF6 -:108770000DD0A86890F85B00052808BFFFDFA86847 -:1087800090F85D10022904BF2E7080F85D7000F033 -:108790000CFF287910F0080F0AD0687840B9A86853 -:1087A00090F85D10032903D10221297080F85D70D3 -:1087B000FFF747FBA87810F0080F16D0A868002331 -:1087C000052190F85B20503004F0E8FC50B185F8AA -:1087D0000180A868D0F82C1108780B2808BF002069 -:1087E000087002E0002003F01BFAA86800F066FEA3 -:1087F00000F097FCA868A14600F1500490F8E8004A -:1088000030B9627B00230121204604F0C7FC10B17F -:10881000208D401C20853D21B9F1000F18D128780A -:10882000022808BF16200ED0012804BFA86890F8BF -:10883000EA0008D06878E8B110F0140F1CBF1E20C1 -:10884000A07602D005E0A07603E010F0080F02D079 -:10885000A176667641E010F0030F03D02A20A076BF -:1088600066763AE010F0200F08BFFFDF2320A076E5 -:10887000667632E094F82E0028B1608D411C618547 -:10888000A18D884213D294F8320028B1208E411C69 -:108890002186A18D88420AD2218DE08C814203D3AA -:1088A000AA6892F8E82012B9A28D914203D322203F -:1088B000A076667611E0A17B31B1A18C814228BF00 -:1088C00084F81A80C5D206E0A08C062803D33E2087 -:1088D000A076667601E0607E58B1E7722773A773D1 -:1088E0000221A868FDF7EEFDE878BDE8F047F1F752 -:1088F000E9BAA868BDE8F0470021FDF7E3BD694982 -:108900004A788B781A430ED101280AD0087910F0E2 -:10891000040F04D0886890F85D00022803D001207D -:108920007047FDF7BBBD0020704770B55D4C054634 -:108930000E46A0882843A08015F0020F04D015F041 -:10894000010F18BFFFDFE66015F0010F18BF2661A9 -:1089500015F0020F12D0304605F03FF8062802D07D -:108960000B283BD00AE0A06890F85B10152905D1D0 -:108970000021C0E92811012180F8601015F0800F56 -:108980001CBF0820A07015F4806F08BF70BDA168DF -:10899000B1F8500089880844801D85B2304605F042 -:1089A0001CF8012822D0304605F017F838B33046BD -:1089B00005F013F8182818BF70BDA06890F8FC10D7 -:1089C000002902BF90F8FD1000290025A0F8FE50F4 -:1089D00029463046BDE8704005F002B9A06890F81D -:1089E0005B100F2908BF0021C8D1C5E7A068294640 -:1089F000A0F8FA503046BDE8704005F040B8A068D5 -:108A00002946D0F8F00085803046BDE8704005F07A -:108A100006B8F8B5234D00260446A860AE806E70F7 -:108A2000AE702E7037460088FAF7B1FFA86800884C -:108A3000FAF7D3FFB4F8D000A968401C82B201F164 -:108A4000500004F058FA002818BFFFDF94F85C00CB -:108A500020280AD1B4F85010B4F8FE00081A00B269 -:108A60000028A4BF6878002804D094F85B00202870 -:108A70003DD119E0A86890F8FC10002908BF90F8D3 -:108A80004C1080F84C1090F8FD10002908BF90F8A9 -:108A90004D1080F84D10002000F00FFB84F85C6052 -:108AA00025E00000F8000020B4F85010B4F8FE00F3 -:108AB000081A00B20028A4BF6878002817D1A86857 -:108AC00090F8FC10002908BF90F84C1080F84C106A -:108AD00090F8FD10002908BF90F84D1080F84D1057 -:108AE000002000F0EAFA84F8916084F85B60A4F852 -:108AF000D060A86890F87E1029B1B0F87A10B0F86C -:108B00007C20914229D290F8821029B1B0F88010CF -:108B1000B0F87C20914220D2B0F87820B0F87610DE -:108B20008A421AD290F85E20B0F874001AB38842D4 -:108B300013D2FD480090FD4BFD4A2146384602F015 -:108B400045FFA8680023052190F85B20503004F011 -:108B500025FB002818BF02F006FDA86890F8001158 -:108B6000012411B390F80111002904BF90F890106E -:108B7000002903D019E00628EFD2DAE790F85C105C -:108B80001B2912D0B0F802118187B0F80411C187F7 -:108B9000B0F8061129B1A0F84010B0F80811A0F8FB -:108BA000421080F8904080F8006190F80A11002986 -:108BB00008BFF8BD90F80C11002906BF90F891107D -:108BC0000029F8BD90F85B2000230B21503004F001 -:108BD000E5FA002818BFF8BDA86800230B2190F81B -:108BE0005C20503004F0DAFA002818BFF8BDA868FD -:108BF00090F84C2090F80D11012A06D0022A07D0D7 -:108C0000032A08BF042905D016E0012914D101E088 -:108C1000022911D190F84D2090F80E11012A06D0AA -:108C2000022A07D0032A08BF042913D004E001292F -:108C300002D10FE002290DD080F89140A86890F889 -:108C40000B1100291CBFB0F80D11A0F84A1080F8D4 -:108C50000A61F8BD002000F030FAEFE7B5488068FF -:108C600090F87E1029B1B0F87A10B0F87C209142CB -:108C70001AD290F8821029B1B0F88010B0F87C2098 -:108C8000914211D2B0F87820B0F876108A420BD217 -:108C900090F85E20B0F8740022B1884204D200BF80 -:108CA00002F04BBF0628FBD300200146FAE42DE971 -:108CB000F0410C4607461D4616464FF49871204673 -:108CC000DDF8188006F0A7FC2780C4F82C81C4E9E1 -:108CD0003C65BDE8F081F6F727B82DE9F0410D4677 -:108CE00007460621F5F7F7FE040008BFBDE8F0814E -:108CF000D4F82C012188002642888A4208D10078C5 -:108D0000072810D00C281FD00B2835D0062850D0AB -:108D100094F8160100285ED06E700E20287084F83A -:108D200016616F8042E06E7007202870D4F82C0125 -:108D30004168C5F802108168C5F80610808968810D -:108D4000D4F82C01067031E00846F6F71FF8074604 -:108D5000F5F7E4FCB8B96E700C202870D4F82C013B -:108D60004068C5F80200D4F82C0106703846F5F7C3 -:108D7000CFFC0120BDE8F0810846F6F707F807466A -:108D8000F5F7CCFC10B10020BDE8F0816E700B202F -:108D90002870D4F82C014168C5F802100089E880D9 -:108DA000D4F82C0106703846F5F7B2FC0120BDE876 -:108DB000F0816E7006202870D4F82C01416882681A -:108DC000C068C5F80210C5F80620C5F80A00D4F836 -:108DD0002C010670EAE794F81801C8B16E701320F0 -:108DE000287094F818010028E0D000BF84F81861BA -:108DF000D4F81A01C5F80200D4F81E01C5F806001F -:108E0000B4F82201688194F818010028EED1CDE76A -:108E100094F8100188B16E701720287094F8100132 -:108E20000028C3D084F81061D4F81201C5F80200FC -:108E300094F810010028F5D1B8E794F8240100282F -:108E400008BFBDE8F0816E701420287094F82401EA -:108E50000028ABD084F82461D4F82601C5F80200BC -:108E6000B4F82A01E88094F824010028F2D19DE7A3 -:108E7000304A5061D17070472DE9F0470446481ED2 -:108E800085B238BFBDE8F0870127DFF8A89004F16C -:108E900008084FF0070A0026B4F8D000401CA4F8D8 -:108EA000D000B4F87400401CA4F8740094F860007A -:108EB00040B994F85B200023062104F1500004F02F -:108EC0006DF9D8B1B4F86C00401C80B2A4F86C0005 -:108ED000B4F86E1081422CBF0A1A0022A3885B1DD1 -:108EE000934228BF84F87270884207D3A4F86C605C -:108EF00084F8167199F80300F0F7E4FF94F87E0007 -:108F000020B1B4F87A00401CA4F87A0094F88200EA -:108F100020B1B4F88000401CA4F8800094F8E80068 -:108F200088B994F85D2007E0A5860100FF8801005C -:108F30002B890100F80000200023012104F15000DA -:108F400004F02CF920B1B4F87800401CA4F87800A3 -:108F500094F85B0007281FD1B4F85000411CB4F806 -:108F6000FA00814262D1D4F8F400411C404606F078 -:108F700064FC0221204603F0D2FE84F85B6084F892 -:108F80008F70D4F8F4000078002808BFFFDFD4F811 -:108F9000F4000178491E017094F85B00082845D15F -:108FA000B4F85000411CD4F8F000808881423DD1D3 -:108FB000D4F82C010178002918BFFFDF22D12188C5 -:108FC000C180D4F8F0004189D4F82C010181D4F893 -:108FD000F0008189D4F82C014181D4F8F000C189D6 -:108FE000D4F82C018181D4F82C010671D4F82C011D -:108FF00080F800A0D4F82C012188418099F8030062 -:10900000F0F760FF0121204603F089FE032120468E -:10901000FDF758FAD4F8F00041882088814218BF43 -:10902000FFDFD4F8F000067084F85B60B4F85000FD -:10903000401C691EA4F850008DB2BFF42DAFBDE8EE -:10904000F087FE4AC2E90601704770B50446B0F8E1 -:10905000740094F85E10002908BFC0F1020503D027 -:10906000B4F87610081A051F94F8720040B194F80D -:109070005B200023092104F1500004F08FF8A0B117 -:10908000B4F86C6094F8600058B994F85B20002341 -:10909000062104F1500004F081F8002808BF28469A -:1090A00003D0B4F86E00801B001F8542C8BF054680 -:1090B000002DD4BF0020A8B270BD10B5DF4CA16850 -:1090C0000A88A1F8282181F8260191F84C0001288E -:1090D00008BF012108D0022808BF022104D00328BC -:1090E0001ABFFFDF00210321A06880F82A1190F841 -:1090F0004D00012808BF012108D0022808BF022125 -:1091000004D003281ABFFFDF00210321A06880F8E4 -:109110002B11012180F82411E078BDE81040F0F710 -:10912000D1BE2DE9F84F6846FAF734FC002808BF95 -:10913000BDE8F88FC14C6078002818BFBDE8F88FF3 -:10914000A0680023012190F85D20503004F026F83B -:10915000002818BFBDE8F88FA06890F8E810002933 -:1091600018BF02204DD190F85B20002319465030E3 -:1091700004F014F840B1A06890F8720020B11220F9 -:10918000FEF7EEFCBDE8F88FA06890F85B200E2A91 -:1091900021D00F2A08BF0B2033D0152A08BF062084 -:1091A0002FD000251F2A30D000230421503003F097 -:1091B000F5FF002818BFBDE8F88FA068012690F8D9 -:1091C0005C1017297DD028DC012952D005294BD00D -:1091D0000B295BD025E0F8F721FF0C2838BFBDE84C -:1091E000F88FA0680821D0F8F0001E30F8F717FFBC -:1091F00028B1A0680421B830F8F711FF00B9FFDFEB -:109200000320FEF7ADFCBDE8F88F1820FEF7A8FCA0 -:10921000A068A0F87A50BDE8F88F1B293DD01D2921 -:109220007ED0D0F8F020117800297AD051880288B9 -:10923000914276D190F85B2000231946503003F01C -:10924000ADFF00286DD0A168D1F8F00000780228A9 -:1092500008BF002066D0032865D0042874D00528F4 -:1092600008BF08205ED0B4E00720FEF779FCA068B4 -:1092700066E00C20FEF774FCA068A0F8805090F81F -:10928000861041F0010180F8861059E01320FEF7A6 -:1092900067FCA068A0F8805052E0C18EB0F83CC0D6 -:1092A000B0F82CA0B0F82E80B0F83090478E614511 -:1092B00038BF8C46A0F82CC0838EB0F840108B428B -:1092C00000E04AE028BF0B46C385028FB0F8421089 -:1092D0008A4228BF0A464286B0F83AB0C18F8B4511 -:1092E00038BF59460186434538BF4346C385BA4215 -:1092F00038BF3A464286D44508BF434503D1494565 -:1093000008BFBA4218D00288A0F81A21828DA0F8AE -:109310001C21028EA0F81E2100F58871C28D03E089 -:1093200013E056E02AE020E0A0F82021408E488299 -:109330000E72E078F0F7C6FD1520FEF711FCA0686C -:1093400080F85C50BDE8F88F30E01820FEF708FC8C -:10935000A068A0F88050BDE8F88F1120FEF700FC4F -:10936000A06880F85C50BDE8F88F91F85F0040B1CC -:1093700091F86000002808BFFFDF0A20FEF7F0FB2D -:1093800027E0F8F74BFE0C2823D3A0680821D0F87B -:10939000F0001E30F8F743FE28B1A0680421B83071 -:1093A000F8F73DFE00B9FFDF0320E7E791F88600FC -:1093B00010F0030F0DD10C20FEF7D2FBA068A0F82F -:1093C0007A5080F87E6090F8861041F0010180F8B4 -:1093D00086106846FAF7DEFA002808BFBDE8F88F65 -:1093E000A0680023194690F85B20503003F0D6FEA9 -:1093F000002808BFBDE8F88FA06890F8F810E9B31E -:10940000A1690978D1BBB0F850100A2937D900F109 -:1094100008010522E06906F039F80028A06804BFB9 -:1094200080F8F850BDE8F88FD0F8F400017881B1E9 -:10943000411C0522E06906F029F801E0F80000204F -:10944000002818BFBDE8F88FA068D0F8F4000078B5 -:1094500030B9A068E169D0F8F400401C06F0EDF9DD -:10946000A068D0F8F4000178491C01700120FEF7D3 -:1094700077FBA06880F8F850BDE8F88FFFE790F818 -:10948000901039B190F85C001B2814BF1420BDE87F -:10949000F88FB6E690F89110002908BFBDE8F88F64 -:1094A00090F85C2000230B21503003F077FE002859 -:1094B00008BF16203FF4A5AEBDE8F88F70B504468E -:1094C00090F85B000025072822D1B4F85000B4F8CA -:1094D000FA10401C884218BF70BDD4F8F400411C3B -:1094E00004F1080006F0A9F90221204603F017FC58 -:1094F00084F85B50012084F88F00D4F8F4000078E1 -:10950000002808BFFFDFD4F8F4000178491E01707D -:1095100094F85B00082818BF70BDB4F85000D4F868 -:10952000F010401C8988884218BF70BDD4F82C0107 -:109530000178002918BFFFDF22D12188C180D4F82B -:10954000F000D4F82C1140890881D4F8F000D4F848 -:109550002C1180894881D4F8F000D4F82C11C089EE -:109560008881D4F82C010571D4F82C1107200870DB -:10957000D4F82C1120884880C348C078F0F7A2FCAA -:109580000121204603F0CBFB03212046FCF79AFF84 -:10959000D4F8F00021884088884218BFFFDFD4F853 -:1095A000F000057084F85B5070BD10B5B64C2079A2 -:1095B00010F0020F08BF10BD6078002818BF10BD62 -:1095C000E068C078192880F05C81DFE800F0514144 -:1095D0000D80FCFC972231FC6174A2FCFCFCFCFBBE -:1095E000D22DE2FDF9FCF800A0680023012190F8DB -:1095F0005D20503003F0D2FD002818BF10BD0321BC -:10960000A06880F85D10002180F87E1080F882103C -:1096100010BDA0680023194690F85C20503003F07C -:10962000BDFD002808BF10BD0020A16800F026B9CC -:10963000A0680023194690F85B20503003F0AEFD7F -:10964000002808BFFFDF0920A16881F85B0010BD7A -:10965000A0680023194690F85B20503003F09EFD6F -:10966000002808BFFFDF0720A16881F85B0010BD5C -:10967000A0680023194690F85B20503003F08EFD5F -:10968000002808BFFFDF0820A16881F85B0010BD3B -:10969000A0680023194690F85B20503003F07EFD4F -:1096A000002808BFFFDF0121A06880F883100C218B -:1096B00080F85B1010BDA06890F85B000F2818BF01 -:1096C000FFDF0121A06880F884100E21F0E7A06878 -:1096D0000023194690F85B20503003F05FFD28B955 -:1096E000A06890F88400002808BFFFDF0121A0686F -:1096F00080F88310102180F85B1010BDA06890F8EE -:109700005B00152818BFFFDF1820A16881F85B00F7 -:1097100010BDA068D0F8F01003884A889A4204BFB0 -:109720000978042919D190F85B200023194650309C -:1097300003F034FD002808BFFFDFA06890F8861012 -:1097400011F0020F04BF012180F85B1005D0002149 -:1097500080F87E10D0F8F0000170A0680023194650 -:1097600090F85C20503003F019FD00287FF45CAFC6 -:1097700010BDA0680023194690F85B20503003F01C -:109780000DFD002808BFFFDF0A20A16881F85B00FB -:1097900010BDA06890F89000012818BFFFDFA068F6 -:1097A0000023194690F85B20503003F0F7FC0028A6 -:1097B00008BFFFDF1A20A16881F85B0010BD25E01B -:1097C0000EE001E04CE05CE0A0680023194690F850 -:1097D0005C20503003F0E2FC002808BFFFDF23E7E5 -:1097E000A06890F89100012818BFFFDFA06800234F -:1097F000194690F85B20503003F0D0FC002808BFD9 -:10980000FFDF1C20A16881F85B00D7E7A06890F813 -:109810005C101D2912D090F85B101F2918BFFFDFC4 -:10982000CCD1B0F8FE1000291CBF202180F85B10BD -:109830000DD0A168002081F87E00BFE7B0F8FE10CF -:10984000002918BF202180F85C100021DEE60021ED -:1098500080F85B1080F891100846FFF72EFCE8E7CF -:10986000A06890F85B001C2818BF072802D00828C1 -:1098700018BFFFDF0020A16881F85C0081F882003A -:109880009CE7FFDF9AE70000F80000202DE9F04197 -:10989000FC4C0646606904F0A0F8E168002701F17D -:1098A0005B02012581F8C1004FF0050896420ED1F8 -:1098B00005FA00F010F0807F08BFFFDFE06880F855 -:1098C0005B80A0F87A7080F87E50BDE8F08101F1ED -:1098D0005C0086421CBFFFDFBDE8F08181F85C8040 -:1098E000A1F8807081F88250BDE8F0812DE9F04345 -:1098F000E44C83B0207910F0010F04BF03B0BDE841 -:10990000F083606901230521C578E06890F85C2048 -:10991000503003F043FC002818BF022D0BD00A2D55 -:1099200018BF0B2D07D0032D18BF062D03D060786C -:1099300040F008006070607800281CBF03B0BDE8EC -:10994000F0836069C078192880F0BF83DFE800F0F9 -:109950004C260DC5FDFDFCFBFAFDA1BDF9FDFDFD8D -:10996000FDF8F7F6F5F4F3FDF200E068012319467F -:1099700090F85D20503003F011FC002840F09A83ED -:10998000606904F085F8E16881F80801022081F837 -:109990005D00002081F8820000F07ABBE0680123BE -:1099A000002190F85C20503003F0F8FB00287DD0B7 -:1099B0006078002840F07E83606904F064F8E16814 -:1099C000A1F81C01B1F85020801A00B247F6FE72CF -:1099D0008242A8BF002853DD01F58F71606904F051 -:1099E00049F80620E16840E0E0680123002190F892 -:1099F0005C20503003F0D2FB002857D0607800285C -:109A000040F05883606904F011F890B3606904F085 -:109A10000AF8E168A1F81C01B1F85020801A00B2E0 -:109A200047F6FE728242A8BF002829DD606903F074 -:109A3000F4FFE16881F81E01606903F0E9FFE16865 -:109A4000A1F82001606903F0CEFFE168A1F82201CE -:109A5000606903F0CFFFE168A1F82401606903F0B9 -:109A6000D0FFE168A1F82601082081F85C0000F031 -:109A700021BBFFE7E0685C30FFF708FF00F01ABB8E -:109A8000282081F86A00012081F8690000F012BBEB -:109A90000CE0E0680123002190F85C20503003F0D6 -:109AA0007DFB18B1607820B100F004BB012000F00C -:109AB0008DB9E0680021A0F88010012180F88210A3 -:109AC0000D2180F85C1000F0F5BAE06890F85C10A9 -:109AD0000E2908BF0F2156D15CE0E0680123002168 -:109AE00090F85C20503003F059FB20B9E06890F802 -:109AF00084000028DAD06078002840F0DB82E0683B -:109B000000210125A0F8801080F8825000F1E001CA -:109B1000606903F0D6FFE06800F1B801606903F006 -:109B2000DBFFE06890F84C01002818BFFFDFE06819 -:109B300001880BE0E6E1C1E14BE103E1D2E0E9E0BD -:109B400052E22BE0A0E062E218E0BEE2A0F84E1183 -:109B500000F5A871606903F0A2FFE06800F5AC7140 -:109B6000606903F0A4FFE06880F84C51112180F88F -:109B70005C10E078F0F7A6F900F09CBAE06890F885 -:109B80005C10142902D0022000F020B9002180F8D6 -:109B90008210192180F85C1000F08CBAE068012373 -:109BA000002190F85C20503003F0F8FA50B9E068DA -:109BB0000123082190F85B20503003F0EFFA0028D1 -:109BC0003FF474AF6078002840F07482E06890F849 -:109BD000860010F0020F17D1606903F09BFFE16867 -:109BE00081F88700606903F097FFE168A1F88800B9 -:109BF000606903F094FFE168A1F88A0091F886009B -:109C000040F0020081F88600E06890F8861011F0BC -:109C1000010F15D190F85C2001230021503003F092 -:109C2000BDFA002808BFFFDF0121E068042280F8A8 -:109C30005C1080F81B2180F882100021A0F88010B1 -:109C4000E06890F85B10012907D1002180F85B10D3 -:109C500080F87E10E078F0F735F9E06890F81A1196 -:109C6000042940F02782002580F81A51E078F0F7A7 -:109C700029F9E06890F85B10002908BF80F87E5051 -:109C800000F018BA18010020E0680123002190F8C4 -:109C90005C20503003F082FA00283FF407AF607870 -:109CA000002840F007826946606903F048FFE068D9 -:109CB0009DF8002090F88C10114001F02F0180F8E1 -:109CC0008C1090F88D109DF80120114001F02F01AB -:109CD00080F88D100021A0F88010012180F88210FA -:109CE000092157E7E0680123092190F85B205030F3 -:109CF00003F054FA00283FF4D9AE6078002840F011 -:109D0000D981E16881F8720081F87E0081F85B00FA -:109D100000F0D0B9E0680123002190F85C205030B9 -:109D200003F03CFA00283FF4C1AE6078002840F010 -:109D3000C181E0680021A0F88010012180F8821024 -:109D40000B2127E7E0680123002190F85C205030C8 -:109D500003F024FA00287DD0606903F00DFF00288D -:109D600004BFE0685C3000F01D81606903F0FCFE18 -:109D70000646606903F0FAFE0546606903F0F8FEE6 -:109D80000746606903F0F6FEE1688F86CE86088795 -:109D90004D8791F8900000281CBF91F85B001A28AD -:109DA0000BD06846F9F71CFE38B10098C07814282B -:109DB00003D0E168002081F89000E0680021A0F85D -:109DC0008010012180F882101B21E3E6607000F012 -:109DD00071B9E06801230A2190F85B20503003F04C -:109DE000DDF9B8B3606903F0C7FEA0B3606903F0A2 -:109DF000BFFE0746606903F0BDFE0546606903F0DB -:109E0000B3FE0646606903F0B1FEE168B1F82C804C -:109E1000CB8DB1F830C04A8E8F86CE860D874887AD -:109E2000B1F83C90B14598BF4E468E85B1F8409050 -:109E3000B94598BF4F46CF85B1F84290A94598BF24 -:109E40004D464D86B1F83E90814598BF48460886FC -:109E50009F4201E02EE024E038BF1F46CF859542A7 -:109E600038BF15464D86464508BF9F4203D1604521 -:109E700008BF954215D00A88A1F860218A8DA1F803 -:109E800062210A8EA1F86421CA8D01F59C70A1F8A7 -:109E90006621498E0186012180F82610E078F0F7CE -:109EA00011F8E168002081F8900081F87E0081F8C7 -:109EB0005B00FFE0607840F0010087E7E068012385 -:109EC000002190F85C20503003F068F900283FF43E -:109ED000EDADE06890F85B0020283FF4E7AD6078D6 -:109EE000002861D1606903F071FE00F00701E068AD -:109EF00080F805110021A0F88010012180F882105F -:109F00001D2147E6E06890F85C1090F85B201E2960 -:109F100002D01C2A2ED036E61C2A2BD01E2908BFC0 -:109F200000F15C05606903F061FE58B36169E068A7 -:109F300003F08DFA064610F0FF0704BFC6F30720B2 -:109F4000002832D0606903F04FFEE168A1F81C01DF -:109F5000B1F85020801A00B247F6FE728242A8BFC4 -:109F600000282FDD81F81E71300A81F81F012020A2 -:109F700028702DE01D291CBF1E2900F15B053FF450 -:109F800002AECFE7E06890F85B101C2909D10021F0 -:109F900080F89110302000F051FFE168182081F81E -:109FA000C2002846FFF772FC84E000212970E068B7 -:109FB00000F15B0295420BD180F89110002000F077 -:109FC0003DFF05E0282081F86A00012081F8690042 -:109FD000E06800F15C018D424FF000010CBF80F899 -:109FE000821080F87E1065E0606903F01BFE162881 -:109FF00060D1E06890F85B101C295BD1002180F8EB -:10A000005B1080F8911080F87E10232050E0E0680B -:10A010000921012390F85B20503003F0BFF820B1F4 -:10A02000606903F085FD122813D0E0680A2101233E -:10A0300090F85B20503003F0B1F820B1606903F074 -:10A0400077FD14281DD0606903F072FD162831D108 -:10A0500021E0E06801252B4690F85B200921503073 -:10A0600003F09CF8002808BF657023D0607808BB17 -:10A07000E068002180F8721080F87E1080F85B1094 -:10A0800018E0E168002081F8900081F85B0000BFD3 -:10A0900081F87E000EE0E16891F85B001C2809D190 -:10A0A000002081F8910081F85B0081F87E001A2081 -:10A0B00000F0C4FEE068D0E928134A1C43F1000117 -:10A0C000C0E9282103B0BDE8F083E0680123002146 -:10A0D00090F85C20503003F061F8002801BF0120A7 -:10A0E000607003B0BDE8F083607800283FF4C2AC34 -:10A0F00003B0BDE8F08330B585B004466846F9F793 -:10A1000049FC002808BFFFDF009803F0A6FB0321ED -:10A11000009803F0B9FB0098017821F0100101705C -:10A12000214603F02EFCA01E162876D2DFE800F0B0 -:10A130000BAA23ABAB1BAA47AAAB3631AAAAAAAA81 -:10A14000ABAB5D768E9CFE48C06890F88E1021B156 -:10A150000621009803F09AFC95E090F8071100980A -:10A1600003F094FC8FE0F648C06890F8C1100098A6 -:10A1700003F0DCFC87E0F24DE86800F1E8010098AC -:10A1800003F0AEFCE86800F1BC01009803F0B2FCFB -:10A1900079E00621009803F0C5FC74E0E84DA8685A -:10A1A0000178009803F0ACFCA8688188009803F05F -:10A1B000A9FCA8684188009803F0A8FC63E000208F -:10A1C00002900390DE48C06890F88C1001F0F50111 -:10A1D0008DF8081090F88D0002A900F001008DF8AC -:10A1E0000900009803F0E2FC4DE0D54DE868B0F8B6 -:10A1F0004010009803F0A8FCE868B0F842100098FE -:10A2000003F0A6FCE868818F009803F0A5FCE868DD -:10A21000C18F009803F0A4FC35E033E0C84DE86836 -:10A22000818F009803F098FCE868C18F009803F0D4 -:10A2300097FCE868B0F84010009803F085FCE868E7 -:10A24000B0F84210009803F083FC1CE0BC4DE868B5 -:10A2500090F83511009803F0B3FCE86890F83611D7 -:10A26000009803F0B1FC0EE0B54DE86890F84A1094 -:10A27000009803F0A5FCE86890F84B10009803F0F4 -:10A28000A3FC00E0FFDFF9F798FB002808BFFFDF21 -:10A290000C2C12BF072C05B030BD122C1CBF142C87 -:10A2A000162C0DD0022C04BF05B030BD0021A448EF -:10A2B000C068A0F88010012180F8821005B030BD80 -:10A2C0009F480021C068A0F87A10012180F87E1014 -:10A2D00005B030BD70B50C4605464FF4C071204640 -:10A2E00005F099F92580002084F8380184F84401AC -:10A2F00084F84C0184F85A0170BDF4F715BD2DE9BE -:10A30000F0410D4607460721F4F7E5FB040008BFBE -:10A31000BDE8F08194F838010026C8B16E700720BE -:10A32000287094F8380188B1268484F83861D4F80C -:10A330003A01C5F80200D4F83E01C5F80600B4F8A9 -:10A340004201688194F838010028EDD1AE7044E0F4 -:10A3500094F84401002837D094F844010B2818D011 -:10A360000C2818BFFFDF38D12088F4F70FFD07460F -:10A37000F4F7D4F9A0B96E700C20287094F8460157 -:10A38000A8702088A88084F844613846F4F7C0F9A2 -:10A3900023E02088F4F7FAFC0746F4F7BFF910B180 -:10A3A0000020BDE8F0816E700B20287094F8460103 -:10A3B000A8702088A88094F84A01A87184F84461A4 -:10A3C0003846F4F7A5F908E094F8700140B16E70D2 -:10A3D0000E20287084F870616F800120BDE8F08144 -:10A3E00094F84C0180B16E70082028702088688035 -:10A3F000D4F85001D4F854116860A960B4F8580139 -:10A40000A88184F84C61E8E794F85A0140B16E7075 -:10A4100016202870B4F85C01688084F85A61DCE783 -:10A4200094F86A0188B16E701720287094F86A0158 -:10A430000028D2D084F86A61D4F86C01C5F8020013 -:10A4400094F86A010028F5D1C7E794F85E01C8B115 -:10A450006E701320287094F85E010028BDD000BFF4 -:10A4600084F85E61D4F86001C5F80200D4F8640194 -:10A47000C5F80600B4F86801688194F85E01002808 -:10A48000EED1AAE794F87201002808BFBDE8F08178 -:10A490006E701420287094F8720100289DD000BFBF -:10A4A00084F87261D4F87401C5F80200B4F8780138 -:10A4B000E88094F872010028F2D18EE7204A90607B -:10A4C000D170704710B5002180F85B1080F85C10E7 -:10A4D00080F85E1090F8D600002814BF02200320F8 -:10A4E000FDF7BDF81648C078BDE81040EFF7EABCAC -:10A4F0002DE9F047124C80460D46E0680088F4F7DD -:10A5000057FC060008BFFFDF6078284360702079A1 -:10A510004FF0000510F0200FE0681CBFA0F8745049 -:10A5200080F8DC5004D1B0F87410491CA0F8741005 -:10A53000E068012790F8601051B990F85C2001E0C4 -:10A540001801002001230621503002F027FE48B3F5 -:10A55000A08810F4006F07D0E06890F86010002920 -:10A5600018BFA0F86C501DD1E168B1F86C00401C18 -:10A5700080B2A1F86C00B1F86E3083422CBF1A1A79 -:10A580000022B4F806C00CF1050C624598BF81F8B2 -:10A590007270984206D3A1F86C5081F87071E0781F -:10A5A000EFF790FC20794FF0020910F0600F11D006 -:10A5B000E06890F85E1011B1032906D00AE080F837 -:10A5C0005E700120FDF74BF804E080F85E900120FA -:10A5D000FDF745F8E06890F85E10012905D1A188E3 -:10A5E00011F4807F18BF80F85E90B8F1000F7DD124 -:10A5F000A18811F4007F18BFA0F8F05004D1B0F882 -:10A60000F010491CA0F8F01000F04CFC00F005FE22 -:10A6100001F0FCFA0028E06818BFA0F8D05004D17F -:10A62000B0F8D010491CA0F8D01001F0F2FA40B1F7 -:10A63000E06890F8DC1002299CBF491C80F8DC100F -:10A6400004D8E06890F8DC00022806D9E068A0F899 -:10A65000D050A0F8D25080F8DC50E06801230021EF -:10A6600090F85C20503002F099FD20B9E06890F835 -:10A670005C00072859D1E0680123002190F85B2095 -:10A68000503002F08BFD00284FD0E06801230021FC -:10A6900090F85D20503002F081FD002845D0E06840 -:10A6A00090F85E10022904BF90F8DC0000283CD12D -:10A6B0003046F3F7B9FDB8B3F9F7B3F9A0B3E068E2 -:10A6C000B0F8CA10012930D980F8D570B0F87620DA -:10A6D000B0F87410931E9942AFBF0121511A491E60 -:10A6E00089B2B0F8D020E3889A4200E034E02FBF6E -:10A6F00001229A1A521C92B2914288BF1146012936 -:10A7000008BF80F8D55090F8002192B1B0F8D2205F -:10A71000B0F8020182422FBF0120801A401C80B293 -:10A72000814288BF014604E0FFE7E068012180F82C -:10A73000D550D4F80CC0BCF85020501880B2ACF8FA -:10A74000CC009CF85E10002918BF01290ED0022908 -:10A750001CBF0329FFDF0CD0A088C0F340200028D5 -:10A76000E06818BFA0F8DE505FD157E0ACF8C80031 -:10A77000F2E79CF85D10032922D0BCF87400BCF805 -:10A7800076100026821C914206D3081A801E060409 -:10A79000360C1CBF701E86B29CF8720058B19CF833 -:10A7A0005B20012309210CF1500002F0F7FC002886 -:10A7B00008BF00262BD0E06890F8601099B90AE035 -:10A7C000BCF874100329D1D3BCF876001044401CA7 -:10A7D000ACF8C800C0E790F85C2001230621503097 -:10A7E00002F0DCFC78B1E1680020B1F86E20B1F82D -:10A7F0006C108B1C9A4203D3501A801E18BF401E47 -:10A80000B04238BF86B2002E1CBF701E86B2E06810 -:10A81000B0F8CC103144A0F8C8109DE7B0F8DE10B5 -:10A82000B0F8CE201144A0F8DE10E06890F80611D0 -:10A8300039B990F85D2001231946503002F0AEFC82 -:10A8400038B1E068B0F87810B0F8CE201144A0F824 -:10A850007810E06890F87EC0BCF1000F06D0B0F828 -:10A860007A10B0F8CE201144A0F87A1090F8823017 -:10A8700033B1B0F88010B0F8CE201144A0F88010A9 -:10A880003D22B8F1000F02D080F86A2010E0217854 -:10A89000022910D0012908BF90F8081106D061786C -:10A8A000F1B111F0140F18BF1E210BD080F86A10FF -:10A8B00080F869704DE090F88E10002914BF0621D1 -:10A8C0001621F3E711F0080FDED111F0030F08BFD6 -:10A8D000FFDF2A21E06880F86A1080F8697038E0AC -:10A8E000BCF1000F05D0B0F87A10B0F87C2091428E -:10A8F0000FD22BB1B0F88010B0F87C20914208D272 -:10A90000B0F87820B0F876108A4208D390F8062183 -:10A910002AB1222180F86A1080F8697019E090F855 -:10A920005E204AB1B0F874208A420FD3082180F823 -:10A930006A1080F869700CE0B0F87410062905D32D -:10A940003E2180F86A1080F8697002E090F8690092 -:10A9500090B1E06880F85B5080F85C5080F85E5001 -:10A9600090F8D600002814BF02200320FCF777FEE1 -:10A97000E078EFF7A7FA02E00020FCF770FEE0684D -:10A9800080F8D650BDE8F087FB494A788B781A43A7 -:10A990000DD150B1087910F0080F04D0C86890F8B4 -:10A9A0005D00032803D001207047FCF7C4BD0020E0 -:10A9B00070472DE9F041F04C05460E46A08828432B -:10A9C000A08015F0020F04D015F0010F18BFFFDFB3 -:10A9D000266115F0010F4FF000084FF001071CD061 -:10A9E0003046666102F0F9FF062802D00B280BD032 -:10A9F00013E0E06890F85C1014290ED10021C0E942 -:10AA0000261180F85F7008E0E06890F85C100E296D -:10AA100004BF80F85F8080F8847015F0020F18D0B2 -:10AA20002069C078052802D00B280BD011E0E0681F -:10AA300090F85C1012290CD10021C0E9281180F88F -:10AA4000607006E0E06890F85C100D2908BF80F89F -:10AA5000608015F0800F1CBF0820A070BDE8F08159 -:10AA60002DE9F047C44C82B00126216900250191EF -:10AA7000A5806570A5702570E06066F307098046C3 -:10AA800080F8D6600088F4F793F95FEA000A08BFFF -:10AA9000FFDFE0680088F8F77AFFE0680088F8F7E1 -:10AAA0009CFFE068B0F8CA00D0B101A8F8F772FFC7 -:10AAB000B0B1E06890F8061191B190F85D200123E3 -:10AAC0001946503002F06AFB50B9E068A0F878509F -:10AAD00080F88E500220FFF70EFBE06880F8D5501A -:10AAE000D4F80CC09CF8380138B9BCF82000BCF888 -:10AAF0000410884288BFE08002D8BCF80400E080DF -:10AB0000BCF8CE00401E87B2BCF8D0003844ACF888 -:10AB1000D0009CF8D40000281CBFACF8D2508CF8B0 -:10AB2000D45004D1BCF8D2003844ACF8D200BCF800 -:10AB300074003844ACF874009CF8600040B99CF88C -:10AB40005C20012306210CF1500002F027FB28B104 -:10AB5000E068B0F86C103944A0F86C10E068B0F808 -:10AB6000CA1001299CBF491CA0F8CA10002F18BFA9 -:10AB700080F8DC5090F8D510A1B1B0F8D000E18891 -:10AB800088420FD25046F3F74FFB58B1E06890F877 -:10AB9000001139B1B0F8D210B0F80201814228BFDB -:10ABA00001F03AF8E26882F8D55092F85C00062885 -:10ABB00018BF072819D1B2F85010B2F81C31C91AC1 -:10ABC00009B2002911DB02F58F7102F1080004F0CF -:10ABD00034FE0221E06801F09BFFE06880F81B5121 -:10ABE00080F85C5080F88F6048E0202820D1B2F8CF -:10ABF0005000B2F81C11401A00B2002818DB92F87D -:10AC00001E01002808BF92F84C0082F84C0092F810 -:10AC10001F01002808BF92F84D0082F84D00002067 -:10AC200000F00CF9E06880F81B5180F85C5025E0DA -:10AC300092F85B00202821D1B2F85000B2F81C1124 -:10AC4000401A00B2002819DB92F81E01002808BF44 -:10AC500092F84C0082F84C0092F81F01002808BFBF -:10AC600092F84D0082F84D00002000F0E7F8E0680F -:10AC700080F8915080F81B5180F85B50E16801F139 -:10AC80005000B1F8CE2002F036F9E06890F80011DB -:10AC9000002918BFA0F8D25038480090384B394AE4 -:10ACA0004146484600F092FEE0680123052190F8F5 -:10ACB0005C20503002F072FA002818BF00F053FCFC -:10ACC000E06890F82811F1B190F82911002904BF2B -:10ACD00090F89010002916D190F85C101B2912D022 -:10ACE000B0F82A118187B0F82C11C187B0F82E1165 -:10ACF00029B1A0F84010B0F83011A0F8421080F847 -:10AD0000906080F8285190F83211002904BF02B0F9 -:10AD1000BDE8F08790F83411002907BF90F8911032 -:10AD2000002902B0BDE8F08790F85B2001230B21D9 -:10AD3000503002F033FA00281CBF02B0BDE8F087A3 -:10AD4000E06801230B2190F85C20503002F026FAD5 -:10AD500000281CBF02B0BDE8F087E06890F84C20E6 -:10AD600090F83511012A0FD0022A10D0032A08BF0B -:10AD700004290ED01FE0000018010020F1A40100FA -:10AD800089A90100B3A90100012914D101E0022918 -:10AD900011D190F84D2090F83611012A06D0022AE0 -:10ADA00007D0032A08BF042915D004E0012902D1E5 -:10ADB00011E002290FD080F89160E06890F833111B -:10ADC00000291CBFB0F83511A0F84A1080F83251A4 -:10ADD00002B0BDE8F087002000F030F8EDE700F0A9 -:10ADE000ACBE10B50446B0F822214388B0F8241157 -:10ADF000B0F826019A4201BFA3889942E38898429D -:10AE00000FD02388A4F83C31A4F83E21A4F84011C7 -:10AE1000A4F84201012084F83801FC48C078EFF71B -:10AE200051F80121204601F073FE002084F81B0137 -:10AE300084F85C00032084F85E0010BD10B5F34C6C -:10AE4000E1680A88A1F8762181F8740191F84C0034 -:10AE5000012808BF012108D0022808BF022104D020 -:10AE600003281ABFFFDF00210321E06880F8781172 -:10AE700090F84D00012808BF012108D0022808BF22 -:10AE8000022104D003281ABFFFDF00210321E0685C -:10AE900080F87911012180F87211E078BDE8104046 -:10AEA000EFF710B82DE9F041D84C4FF002084FF001 -:10AEB0000005207910F0080F14D0607890B9E06890 -:10AEC00090F85C10162905D180F8835080F88250E4 -:10AED00080F85C5090F85D10032904BF84F800806E -:10AEE00080F85D50FEF702FDA1884FF0010611F0D9 -:10AEF000040F4FF0070719D06078B8B9E06890F8F0 -:10AF00005C20062A08BF80F81B6108D0082A08BF09 -:10AF100080F81B8103D0202A08BF80F81B7190F8AD -:10AF20005D20022A04BF267080F85D5011F0020FE8 -:10AF300000F049816078002840F045812069C078A0 -:10AF4000801E162880F03E81DFE800F00BF9646F68 -:10AF5000851EF948F955B97AF9F9F9F9E4F8FDF6D9 -:10AF6000F5F4E0680123194690F85D20503002F0B6 -:10AF700015F9002840F02781E068032180F85D1072 -:10AF800080F87E5000F0DCB8206902F0D1FD064662 -:10AF9000E06890F85C10052905D090F85B00052862 -:10AFA00018BFFFDF04D0E06890F85B0005280AD1E5 -:10AFB000E06890F8C210B14204BF80F85B5080F89E -:10AFC0007E5000F00081E06890F85C1005290CBF0D -:10AFD00080F85C50FFDF40F0F680B1E0E06890F868 -:10AFE0005C00092818BFFFDFE06880F8825080F815 -:10AFF0005C5000F0E8B8E06890F85C000D2818BFDD -:10B00000FFDFE0685FF00E0180F8836080F85C107D -:10B0100000F0D9B8E06890F85C00112818BFFFDF95 -:10B02000E068122180F88360F0E7E06890F85C0047 -:10B03000122818BFFFDF1420E16881F85C00C2E02D -:10B04000E06890F85C00122818BFFFDF1620E16866 -:10B0500081F85C00B7E0E06890F85C00192818BF40 -:10B06000FFDFE06880F8835080F8825090F8440158 -:10B07000002818BFFFDFE06890F8841041B180F825 -:10B0800084500188A0F8481180F846510C2107E04F -:10B090000188A0F8481180F8465180F84A610B21D8 -:10B0A00080F844110088F3F771FEF3F721FBE07894 -:10B0B000EEF708FFD4F80C0080F85C5083E0E068FD -:10B0C00090F81A1104290ED0E0680123082190F8A5 -:10B0D0005C20503002F062F800281CBFE06880F865 -:10B0E000825070D0E8E790F85B20012300215030B7 -:10B0F00002F054F8002808BFFFDFE06890F88610DF -:10B1000011F0020F0EBF80F85B6080F87E5080F86F -:10B110001A51D9E7E0680123002190F85B205030F4 -:10B1200002F03CF8002808BFFFDF0A20E16881F840 -:10B130005B0048E03BE024E01BE004E01FE041E06E -:10B1400080F882503FE0E06890F89000012818BF36 -:10B15000FFDFE0680123002190F85B20503002F00F -:10B160001DF8002808BFFFDF1A20E16881F85B00A6 -:10B1700029E0E06890F85C00002818BFFFDFE06875 -:10B18000DEE7E06890F89100012818BFFFDFE06873 -:10B190000123002190F85B20503001F0FFFF0028D0 -:10B1A00008BFFFDF1C20E16881F85B000BE0E0686E -:10B1B00090F85C001D2818BFFFDF1E20E16881F8B1 -:10B1C0005C0000E0FFDF207910F0100F08D06078FD -:10B1D00030B9E06890F85C10062908BF80F85C7010 -:10B1E000A07810F0080F08BFBDE8F081E0680123E7 -:10B1F000052190F85C20503001F0D0FF40B10820CC -:10B200006070E06880F84451BDE8F08118010020CA -:10B21000BDE8F041002000F003BD2DE9F84F68467D -:10B22000F8F7B8FB002808BFBDE8F88FC84C607875 -:10B23000002818BFBDE8F88FE0680123194690F890 -:10B240005D20503001F0AAFF002818BFBDE8F88F3C -:10B25000E068002590F8061129B1A0F8785080F830 -:10B260008E50022083E090F85B20012300215030B3 -:10B2700001F094FF78B1E0680123042190F85C208C -:10B28000503001F08BFF30B9E06890F87200002870 -:10B2900018BF12206BD1E06890F85B1005290FD021 -:10B2A00090F85C200126112A4DD018DC092A08BF2D -:10B2B00009205CD00CDC012A74D0052A3BD018E0B0 -:10B2C0000720FEF718FFE068A0F87A50BDE8F88F75 -:10B2D0000B2A68D00D2A08BF0B2048D009E0122A9B -:10B2E00049D0192A79D01B2A76D01D2A08BF1720E9 -:10B2F0003DD001230421503001F050FF002818BF39 -:10B30000BDE8F88FE06890F81A1100297BD090F81A -:10B310005B2001230021503001F040FF002872D053 -:10B32000E06890F81A11042904BF90F8860010F024 -:10B33000030F69D0D0E00720FEF7DDFEE068A0F83B -:10B340008050BDE8F88FF6F769FE0C2838BFBDE8DD -:10B35000F88F0821E068E830F6F761FE28B1E06870 -:10B360000421BC30F6F75BFE00B9FFDF0420FEF7D6 -:10B37000C2FEBDE8F88F90F80911012914D0022906 -:10B3800018BFBDE8F88F90F8841000291ABF80F824 -:10B390008E6002200D20FEF7AEFEE06880F80951B5 -:10B3A000BDE8F88F21E030E090F84411002918BF83 -:10B3B000BDE8F88F00F1A80300F1E001002200F5DC -:10B3C000857001F080FE0520FEF795FEE06880F8AC -:10B3D0000951BDE8F88F00E01EE00620FEF78BFE65 -:10B3E000E06880F88250BDE8F88F0C20FEF783FEFD -:10B3F000E068A0F8805090F8861041F0010180F8D4 -:10B400008610BDE8F88F67E058E01320FEF773FE62 -:10B41000E068A0F880504DE0C18E838FB0F82CA07A -:10B42000B0F82E80B0F83090478E994238BF0B4666 -:10B430008385828EB0F840108A4228BF0A46C285B2 -:10B44000B0F838C0B0F842108C4538BF614641862C -:10B45000B0F83AC0B0F83EB0DC4528BFDC46A0F8F2 -:10B4600030C0424538BF4246C285B94238BF39462E -:10B470004186534508BF424503D1CC4508BFB94278 -:10B4800014D00288A0F86021828DA0F86221028E7B -:10B49000A0F86421C28D00F59C71A0F86621408E51 -:10B4A000088681F82660E078EEF70CFD1520FEF79F -:10B4B00022FEE06880F85C50BDE8F88F0C20FEF7B3 -:10B4C0001AFEE068A0F87A5080F87E6090F8861046 -:10B4D00041F0010180F886106846F8F75BFA002811 -:10B4E00008BFBDE8F88FE0680123002190F85B20D9 -:10B4F000503001F053FE50B1E06890F890100029F0 -:10B500001EBF90F85C001B2814207FF430AFE06869 -:10B510000123002190F85B20503001F03FFE00280D -:10B5200008BFBDE8F88FE06890F89110002908BFC7 -:10B53000BDE8F88F90F85C2001230B21503001F01A -:10B540002DFE002808BF16203FF411AFBDE8F88F8C -:10B550001801002030B5F84C05462078002818BFA7 -:10B56000FFDFA57230BDF449012048727047F348EF -:10B5700010B541680278406891F85B408C4690F8BD -:10B580004C0001F15003202C1CBF1B7B202B12D040 -:10B590001C2C2DD01E2B18BF10BD002A08BF10BDBB -:10B5A0009CF84A2091F80511114011F0010F35D097 -:10B5B00003283DD03FE06AB191F81E11002908BF71 -:10B5C00010BD032818BF032932D0012818BF012954 -:10B5D00031D02BE091F8FC10002908BF10BD0328E2 -:10B5E00018BF032924D0012818BF012923D01DE04A -:10B5F0001E2BD2D0002A08BF10BD91F8351111F0D2 -:10B60000010F02D0032813D015E011F0020F08BF7C -:10B6100010BD03280CD001280DD007E011F0020F57 -:10B6200008BF10BD032803D0012804D0022010BD9C -:10B63000FFDF002010BD012010BD2DE9F047BF4FF6 -:10B640004FF0000839464FF001094E686FF00E03C5 -:10B650006FF00D0C708E96F84D10024602290CBF4B -:10B6600003EB92020CEBD20292B2F58DAA4206D8FD -:10B67000022914BF0CEBD00003EB900085B2AE4C56 -:10B680002946606BF2F70CFEDFF8B4A2E0620028F6 -:10B6900019BF84F80280A06284F80290C4F828A040 -:10B6A0003878786800F15008012000F03DFD98F8E6 -:10B6B0001000002838D008F15801A14891E80E1078 -:10B6C00000F5027989E80E10D8F86810C0F8211248 -:10B6D000D8F86C10C0F8251200F58170F7F78DFDD1 -:10B6E000387800280CBF0120002080F00101954827 -:10B6F0000176D8E91412C0E90412C4F828A0514612 -:10B70000A581A0F58372F7F766F996F84D00012838 -:10B7100008BF002104D002281ABFFFDF0021012149 -:10B720000120F7F766F904E0A06AF7F766FDF7F77E -:10B7300083F901210020F7F7C9FE02202070BDE83F -:10B74000F0872DE9F04FDFF8F48183B04146A1F195 -:10B7500014004C680090012794F8550004F150053E -:10B76000A1F1380670B301287DD002287FD00328CC -:10B7700018BFFFDF76D0706A0823017821F0080136 -:10B780000170AA7903EAC202114321F00401017099 -:10B79000EA79042303EA8202114321F010010170C7 -:10B7A00095F805A0306BF2F74DFD8146F8F739F9B1 -:10B7B000BAF1020F73D0BAF1010F74D0BAF1030FCE -:10B7C00075D079E0B4F830B0FFF7D1FE6FF00E0914 -:10B7D0006FF00D0A022814BF0AEBDB0009EB9B0097 -:10B7E00081B2A08D81420AD8B4F830B0FFF7BFFE15 -:10B7F000022814BF0AEBDB0009EB9B0080B2ADF816 -:10B800000800A4F848000098F8F7EAF838B1716A1F -:10B81000F770B2694FF48060904703201EE001AAE0 -:10B8200002A9306BF2F7F1FB706210B195F833109A -:10B8300021B10098F8F7A8F86F719CE79DF8041003 -:10B8400029B9002101808170012102F01DF8BDF8A5 -:10B850000800C1B2706A02F0E9F9022068718AE753 -:10B8600001E004E011E00098F8F78EF883E7B4F8FF -:10B870004800ADF8000001AA6946306BF2F7C5FB3D -:10B880007062002808BFFFDF75E70098F8F7A8F896 -:10B89000002808BFFFDF6EE701E004E007E030EAC0 -:10B8A000090009D106E030EA090005D102E0B9F14A -:10B8B000000F01D0012100E00021706A027842EA05 -:10B8C00001110170E97B00291CBF697901293BD076 -:10B8D00005F158011A4891E80E1000F5027989E83F -:10B8E0000E10A96EC0F82112E96EC0F8251200F5FD -:10B8F0008170F7F782FC98F8000000280CBF012146 -:10B90000002110480176D5E91212C0E90412A0F511 -:10B910008371726AF7F75FF894F84C00012808BF4A -:10B92000002104D002281ABFFFDF002101210020DE -:10B93000F7F75FF80CE000003001002068010020FC -:10B94000280E002030100020F7F757FCF7F774F8A6 -:10B9500098F8000028B1706A007810F0100F05D038 -:10B960000CE001210846F7F7B1FD0AE0FE48007837 -:10B9700010F0100F04BF7079002802D0F078002872 -:10B98000EFD0B079C8B9B77194F84D00012808BF5D -:10B99000002504D002281ABFFFDF0025012594F8F6 -:10B9A0004C00012808BF002004D002281ABFFFDF86 -:10B9B000002001202946F7F772FC706A0188318265 -:10B9C0008078B074377003B0BDE8F08F2DE9F04790 -:10B9D000E64C8146DDF8208020781E4617460D464D -:10B9E00028B9002F1CBF002EB8F1000F00D1FFDFD7 -:10B9F000C4F82080C4E90E95C4E906760020607280 -:10BA0000207260712071A071E071D94EE070E08108 -:10BA1000307805F150092888F3F7CAF9206328889F -:10BA2000F3F7B4F96063F7F7DDFBF7F70CF9F7F715 -:10BA30007CFC05F11100F7F7BEFB05F10D00F7F7EF -:10BA4000E8F9307800280CBF03200120F7F7C7FB86 -:10BA500099F81800F7F7E5F9F7F7BBFB30786FF0C6 -:10BA60000E076FF00D08F8B1698E95F84D0099F842 -:10BA70001020EC8D02280B460CBF07EB930308EB5C -:10BA8000D3039BB2A34206D8022814BF08EBD1010E -:10BA900007EB91018CB2002A1CBF211D8CB201283A -:10BAA00041D0022841D023E099F80F90B5F82CA09E -:10BAB0002C8EFFF75CFD022814BF08EBD40107EBC6 -:10BAC000940189B2514588BF544606D802280CBF5C -:10BAD00007EB940008EBD40084B2B9F1000F1CBF4F -:10BAE000201D84B295F84C0001281CD002281CD0DF -:10BAF000FFDF00252846F7F799F829462046F7F793 -:10BB000076F830784FF0010188B10120F7F73FFA5D -:10BB10007068D0F8D800F7F773FBFFF78EFDBDE82B -:10BB2000F047F7F767BB0025E4E70125E2E70020CF -:10BB3000F7F72DFAFFF705FEF1E770B58C488B4D4E -:10BB400005F1380100784C68002834D094F84C0096 -:10BB5000012808BF002604D002281ABFFFDF0026F4 -:10BB6000012694F84D00012808BF002104D00228C6 -:10BB70001ABFFFDF0021012132469620F7F7F2FBC2 -:10BB80002878022818BFFFDF94F84C50F7F72AFBFB -:10BB900094F82800012808BFF7F775FC012D08BFAD -:10BBA000002004D0022D1ABFFFDF00200120BDE8D5 -:10BBB0007040F7F73BB894F84D00012808BF002605 -:10BBC00004D002281ABFFFDF0026012694F84C009B -:10BBD000012808BF002104D002281ABFFFDF00217E -:10BBE000012132469620F7F703FC2878012818BF78 -:10BBF000FFDF94F84D50C9E75C4810B50078022883 -:10BC000018BFFFDFBDE8104000F0EABA574880795E -:10BC1000704756484079704754490120C8717047B1 -:10BC20002DE9F04706005248504D4FF0010740689B -:10BC30004FF0000800F15004A86A90F8019018BF76 -:10BC4000012E03D1696B03F023F968706878A0B105 -:10BC5000012830D0022848D003281CBFFFDFBDE8F0 -:10BC6000F087012E08BFBDE8F087686BF2F729FD69 -:10BC7000A87ABDE8F047EEF725B9012E08D00122D9 -:10BC80004946686BF2F76AFB022E08BFBDE8F087F1 -:10BC9000D4E91402411C42F10000C4E91410E07917 -:10BCA000012802D184F8078000E0E771A87ABDE896 -:10BCB000F047EEF707B9012E08D000224946686B1D -:10BCC000F2F74CFB022E08BFBDE8F087D4E914015F -:10BCD000401C41F10001C4E91401E07901280CBFC6 -:10BCE00084F80780E771BDE8F087012E06D0686B05 -:10BCF000F2F7E7FC022E08BFBDE8F087D4E9140193 -:10BD0000401C41F10001C4E91401E0790128CCD1C3 -:10BD1000C8E72DE9F041164F4FF000083846A7F16B -:10BD200038044068012600F150052078012818BF2A -:10BD3000FFDFA87850B185F80280E670A26941461D -:10BD4000042090473878002818BF2E71606A0321BC -:10BD5000007831EA000004BFE87800280CD1EE70CA -:10BD6000616A0220E67005E04301002030010020F6 -:10BD700068010020A26990470121002000F053FAD9 -:10BD8000002808BF7C6803D0BDE8F04100F028BA65 -:10BD9000FFF753FC94F84C00012808BF002004D0A2 -:10BDA00002281ABFFFDF00200120F6F73FFF94F8BA -:10BDB0004C00012808BF002504D002281ABFFFDF6D -:10BDC0000025012594F84D00012808BF002104D06A -:10BDD00002281ABFFFDF002101212A46BDE8F041F9 -:10BDE0009620F7F7BFBA2DE9F84FFB4E8346304651 -:10BDF000A6F138054068317800F1500A002728780C -:10BE00004FF00108B946022818BFFFDFE88940F467 -:10BE10000070E881002000F087F99AF81000BBF16B -:10BE2000000F00F0ED80F6F72DFEF6F71BFE90B93F -:10BE30009AF8100078B1A86A417861B100789AF850 -:10BE40000710C0F3C000884205D185F80480BDE822 -:10BE5000F84F00F0C5B9A86A0188A5F813108078DA -:10BE60006875E88940F02000E8816F71307870686B -:10BE700050300090746894F82800012818D1F7F722 -:10BE8000F8FA2046009901F05EF988B13078002870 -:10BE900070680CBF00F5887000F5B570218841808E -:10BEA0000099097A017180F80080A87AEEF70AF803 -:10BEB000A86A9AF806100078C0F38000884233D050 -:10BEC0003078706800F1500490F8550040B30228B3 -:10BED00044D06771307840B12079394628B121715A -:10BEE00085F80380AA6910209047E07890B1E77048 -:10BEF000F7F785FD002808BFFFDF082085F80380DD -:10BF0000AA6900219047D4E91202411C42F10000C5 -:10BF1000C4E91210A07901280CBFA77184F806802B -:10BF2000E88940F48070E881A86A9AF807300178BF -:10BF3000C1F3C0029A4250D13278726801F0030115 -:10BF400002F15004012918BF022933D003291CBF74 -:10BF5000287A40F0040012D028723EE0286BF2F7F5 -:10BF60008EF8002808BFFFDFD4E91210491C40F109 -:10BF70000000C4E91210A87AEDF7A4FFA9E701F0C8 -:10BF8000A4FC98B184F80280E989404641F400613C -:10BF9000E981A96A85F80380AA699047E0790128B8 -:10BFA00001D1E77119E084F8078016E0287A40F0A3 -:10BFB0001000D1E74078F8B1E98941F40061E981E6 -:10BFC000A97851B9FB28F1D8687A002808BFC14682 -:10BFD00003D08020AA69002190475946012000F033 -:10BFE00022F960B39AF81000002818BFBBF1000FC7 -:10BFF0001BD0A87868B118E0E0790128D3D1D0E748 -:10C00000002818BF03F01EFCE88940F04000E881DA -:10C01000E3E7A96AAA894878904288BF1046C21C03 -:10C02000E86A03F05FFAE86AA862B9F1000F1CBF82 -:10C030000020FFF7F5FDBDE8F84F00F0D1B83078EB -:10C040007468B9F1000F1CBF0120FFF7E9FDFFF78D -:10C0500078FB9AF81000002818BFBBF1000F0DD034 -:10C06000A87858B9A96AAA894878904288BF10462A -:10C07000C21CE86A03F036FAE86AA862B9F1000F58 -:10C080001CBF0220FFF7CCFD94F84D00012808BF2B -:10C09000002004D002281ABFFFDF00200120F6F79D -:10C0A000C5FD94F84D00012808BF002504D00228E2 -:10C0B0001ABFFFDF0025012594F84C00012808BFB6 -:10C0C000002104D002281ABFFFDF002101212A46E7 -:10C0D000BDE8F84F9620F7F78BB970B505463E4896 -:10C0E0000C460178406890F84C2071B1012A08BFD5 -:10C0F000002204D0022A1ABFFFDF002201222146BB -:10C100002846BDE87040FBF73CBB012A08BF00226F -:10C1100004D0022A1ABFFFDF00220122214628464E -:10C12000BDE87040FAF70CBB2DE9F0472A496FF0E3 -:10C130000E06771C4D680A7805F15001F0B10A7CB3 -:10C14000688E95F84D10EC8D022903460CBF06EB66 -:10C15000930307EBD3039BB2A34206D8022914BF73 -:10C1600007EBD00006EB900084B2002A1CBF201D14 -:10C1700084B201292DD0022930D023E091F80F801C -:10C18000B5F82C902C8EFFF7F2F9022814BF07EBBC -:10C19000D40106EB940189B2494588BF4C4606D8C4 -:10C1A00002280CBF06EB940007EBD40084B2B8F170 -:10C1B000000F1CBF201D84B295F84C00012808D048 -:10C1C00002280BD0FFDF00212046BDE8F047F6F73C -:10C1D0000EBD0021F8E70000680100200121F3E70F -:10C1E00070B5314900254C68F7F715F9F7F7AEF847 -:10C1F000F6F782FFF6F7E5FFF6F71EFCF7F7A2F871 -:10C20000F6F7F8FF94F82800012808BFF7F731F98E -:10C21000264C0021A269E0899047226A217A207980 -:10C220009047257070BD70B5204C0546002908BFA9 -:10C23000012D05D16079401CC0B26071012830D851 -:10C24000E1692846884700282BD0E179184839B1A0 -:10C25000012D01BF41780029017811F0100F20D085 -:10C26000217AF1B910490978002918BF002102D0BC -:10C27000294304D013E0012D18BF0121F8D10D4945 -:10C28000097811F0100F04BF007810F0100F08D0DB -:10C29000E07830B9A07810B111F0100F01D0002073 -:10C2A00070BD012070BD0000680100203001002039 -:10C2B000430100204001002010B540F2BB11F748B7 -:10C2C00003F087F9F648002141704FF46171418015 -:10C2D00010BD2DE9F0410F46064600F0D6FAEF4CAE -:10C2E000102817D004EBC00191F8421111F0010F92 -:10C2F0001CBF0120BDE8F081617808291FD2617858 -:10C3000004EBC000491C6170012180F8421108460D -:10C31000BDE8F0816178082911D22578681C207069 -:10C3200004EBC5083868C8F83C01B888A8F8400193 -:10C33000102D28BFFFDF88F83B612846DFE700208B -:10C34000BDE8F081D5480178491E4BB2002BB8BF3B -:10C35000704770B45FF0000500EBC30191F8421123 -:10C3600011F0010F3BD04278D9B2521E427000EB5F -:10C37000C10282F8425190F802C00022BCF1000FC5 -:10C380000BD9841894F803618E4202D1102A26D169 -:10C3900003E0521CD2B29445F3D80278521ED2B2B6 -:10C3A00002708A421BD000EBC20200EBC10CD2F833 -:10C3B0003B41CCF83B41D2F83F21CCF83F21847877 -:10C3C00090F800C00022002C09D9861896F8036165 -:10C3D00066450AD1102A1CBF024482F80311591E77 -:10C3E0004BB2002BB8DA70BC7047521CD2B29442E8 -:10C3F000EBD8F4E72DE9F0471E46174688468146FC -:10C4000000F043FAA54C0546102831D0A078002151 -:10C4100000280ED9621892F80331AB4205D11029D9 -:10C420001CBF1220BDE8F08703E0491CC9B2884256 -:10C43000F0D8082832D2102D1DD000BF94F8028009 -:10C44000102208F10100A07004EB081909F10300A3 -:10C45000394600F027FE09F183001022314600F032 -:10C4600021FE04EB080080F803510020BDE8F087AE -:10C47000A078082812D22578681C207004EBC50A21 -:10C48000D8F80000CAF83C01B8F80400AAF8400146 -:10C49000102D28BFFFDF8AF83B91CFE70720BDE8CA -:10C4A000F08770B47D488178491E4BB2002BBCBF29 -:10C4B00070BC704703F0FF0C8178491ECAB28270CD -:10C4C00050FA83F191F8031194453AD000EB02142D -:10C4D00000EB0C15D4F80360C5F80360D4F80760CE -:10C4E000C5F80760D4F80B60C5F80B60D4F80F608E -:10C4F000C5F80F60D4F88360C5F88360D4F887600E -:10C50000C5F88760D4F88B60C5F88B60D4F88F408D -:10C51000C5F88F40841800EB0C0502EB420294F83A -:10C5200003410CEB4C0C00EB420285F8034100EB9D -:10C530004C0CD2F80B41CCF80B41B2F80F21ACF8FF -:10C540000F2100EBC10292F8422112F0010F35D108 -:10C5500090F802C000220C46BCF1000F0BD98518E0 -:10C5600095F803518D4202D1102A27D103E0521CC5 -:10C57000D2B29445F3D80178491EC9B20170A142E4 -:10C580001CD000EBC10100EBC402D1F83BC1C2F8E2 -:10C590003BC1D1F83F11C2F83F1190F802C00278B8 -:10C5A0000021BCF1000F09D9451895F803519542B7 -:10C5B0000BD110291CBF014481F80341591E4BB215 -:10C5C000002BBFF677AF70BC7047491CC9B28C45D1 -:10C5D000EAD8F3E7324948707047314840787047ED -:10C5E00038B14AF2B811884203D82D494880012059 -:10C5F0007047002070472A484088704710B500F007 -:10C6000044F9102814D0254A0146002092F802C0AF -:10C61000BCF1000F0CD9131893F803318B4203D1EE -:10C62000102818BF10BD03E0401CC0B28445F2D8EA -:10C63000082010BD19498A78824286BF01EB00109C -:10C6400083300020704715498A78824286BF01EB0B -:10C650000010C01C00207047104B93F802C08445A6 -:10C660009CBF00207047184490F8030103EBC00002 -:10C6700090F83B310B70D0F83C111160B0F84001DC -:10C68000908001207047054A114491F80321044924 -:10C690000A7002684A60808808817047581000203C -:10C6A0007001002010B5F6F745F9002804BFFF20FF -:10C6B00010BDBDE81040F6F763B9F1498A788242AF -:10C6C0009CBF00207047084490F8030101EBC000B4 -:10C6D00090F8420100F00100704770B5E84E002468 -:10C6E00025463078002814D906EBC50090F8421191 -:10C6F00011F0010F08D090F83B2100F59E71204603 -:10C70000631CDCB2F6F71EFB681CC5B23078A84289 -:10C71000EAD87078A04218BFFFDF70BD70B5D84C62 -:10C7200000263546A078002812D96019731C90F8AD -:10C73000030104EBC00000F59E7190F83B213046E8 -:10C74000DEB2F6F7FFFA681CC5B2A078A842ECD8B2 -:10C75000C0B2B04218BFFFDF70BD10B5F6F751FB95 -:10C7600058B30024F6F751FBC54A00211378002B7B -:10C7700023D900BF02EBC10C9CF842C11CF0010F91 -:10C7800017D084421CBF04F1010C0CF0FF0410D13F -:10C7900093780020002B0AD902EB000C9CF803C10F -:10C7A0008C4508BF10BD401CC0B28342F4D8102095 -:10C7B00010BD491CC9B28B42DCD8082010BD10B591 -:10C7C000F6F71FFB002804BF082010BDBDE810408D -:10C7D000F6F71BBBAB4910B5497841B1A84B997826 -:10C7E00029B1C21CD81CF6F742F8012010BD002068 -:10C7F00010BDA34A01EB410102EB41010268C1F8FF -:10C800000B218088A1F80F01704770B59C4D002462 -:10C81000A878002898BF70BDC0B2A04212D905EB1D -:10C82000041010F183060DD01021304600F017FCE3 -:10C8300040B904EB440005EB400000F20B11304618 -:10C84000F7F76DF9601CC4B2A878A042E4D870BDB7 -:10C85000014610228C4800F025BC8B48704770B50B -:10C86000874D0446A878A04206D905EB0410102194 -:10C87000833000F0F4FB08B1002070BD04EB4400ED -:10C8800005EB400000F20B1070BD2DE9F0417C4D2E -:10C890000646002428780F46002811D905EBC4006D -:10C8A00090F83B11B14206D10622394600F59E7040 -:10C8B00002F0ECFD38B1601CC4B22878A042EDD87B -:10C8C0001020BDE8F0812046BDE8F0816C4910B42D -:10C8D0004A7801EBC003521E4A70002283F84221BD -:10C8E00091F802C0BCF1000F0DD98B1893F80341E9 -:10C8F000844204D1102A1CBF10BC704703E0521CB4 -:10C90000D2B29445F1D80A78521ED2B20A7082424D -:10C9100004BF10BC704701EBC00301EBC202D2F8A8 -:10C920003BC1C3F83BC1D2F83F21C3F83F218C780B -:10C9300091F800C00022002C9CBF10BC70478B18DF -:10C9400093F80331634506D1102A1CBF114481F8C6 -:10C95000030110BC7047521CD2B29442EFD810BCF5 -:10C96000704770B446490D188A78521ED3B28B7046 -:10C9700095F80321984239D001EB001C01EB031418 -:10C9800000EB4000D4F80360CCF80360D4F80760F3 -:10C99000CCF80760D4F80B60CCF80B60D4F80F60CB -:10C9A000CCF80F60D4F88360CCF88360D4F887604B -:10C9B000CCF88760D4F88B60CCF88B60D4F88F40CB -:10C9C000CCF88F4001EB030C03EB43039CF803C14D -:10C9D00001EB430385F803C101EB4000D3F80BC121 -:10C9E000C0F80BC1B3F80F31A0F80F3101EBC20052 -:10C9F00090F8420110F0010F1CBF70BC704700207E -:10CA00008C78002C0DD90B1893F803C1944504D1F0 -:10CA100010281CBF70BC704703E0401CC0B28442A9 -:10CA2000F1D80878401EC0B20870904204BF70BCB4 -:10CA3000704701EBC20301EBC000D0F83BC1C3F863 -:10CA40003BC1D0F83F01C3F83F018C780B78002040 -:10CA5000002C9CBF70BC704701EB000C9CF803C11C -:10CA60009C4506D110281CBF084480F8032170BCE7 -:10CA70007047401CC0B28442EED870BC70470000C2 -:10CA800058100020700100201312002010B50A7BFE -:10CA900002F01F020A73002282758B181B7A03F0C2 -:10CAA000010C5B0803F00104A4445B0803F00104DB -:10CAB000A4445B0803F00104A4445B0803F00104F0 -:10CAC00064444FEA530C0CF0010323444FEA5C0C1E -:10CAD0000CF00104234403EB5C0300EB020C521C3A -:10CAE0008CF8113090F816C0D2B263448375052AD1 -:10CAF000D3D3D8B2252888BFFFDF10BD002383839E -:10CB0000028401EBC202521EB2FBF1F1C1837047F5 -:10CB10000A4630B40021032A0DD04FF4FA4C002A03 -:10CB20007DD0012A7CD0022A1CBF30BC7047014650 -:10CB300030BC5030AAE7A0F8501080F8561080F8AA -:10CB4000571080F85B1080F85C1080F85D1080F85A -:10CB50005E1080F8521080F8531080F8541080F85E -:10CB6000551080F86910A0F86C1080F87210A0F8C9 -:10CB70007410A0F87A1080F87E10A0F8801080F869 -:10CB8000821080F8671080F8681080F85F1080F8D5 -:10CB9000601080F8831080F8841080F88610F522E9 -:10CBA00080F88C20012280F88D20A0F8781080F881 -:10CBB0008F10A0F8C810A0F8CA10A0F8CC10A0F8E8 -:10CBC000CE10A0F8D010A0F8D21080F8D510A0F8A0 -:10CBD000DE1080F8DC10A0F8F010A0F8F21080F859 -:10CBE0002810018480F84C2080F84D204FF44862D2 -:10CBF00042801B228286C2864FF4A4734387038738 -:10CC00008285C28543860386A0F84020A0F8423082 -:10CC10008287C387A0F84420A0F8462001E012E0F4 -:10CC20004FE0A0F8482080F8901080F8281180F894 -:10CC3000911080F8321180F8001180F8061180F808 -:10CC4000091130BC7047A0F8DE1080F8D610428879 -:10CC5000FE4B1344B3FBF2F3A0F86E304BF6803377 -:10CC6000A0F87030C488A0F87410B0F8781000F103 -:10CC70005003514391FBF2F1A0F87810E100B1FBB1 -:10CC8000F2F1491C89B201FB02F4A0F87610B4F568 -:10CC9000C84FC4BF491ED984BCFBF2F1491C998519 -:10CCA00002F5802101F5EE31A1F1010CBCFBF2F19E -:10CCB000D983B3F81CC00CFB02F1B1FBF2F19983EC -:10CCC00035E7A0F8DE1000F150024488B0F82231B8 -:10CCD000B0F826019184118DC0006143B0FBF3F0E0 -:10CCE00091FBF3F1401C118580B200FB03F1D0846D -:10CCF000B1F5C84FC4BF401ED084BCFBF3F0401C4C -:10CD00009085108C03EBC000401EB0FBF3F0D08385 -:10CD1000908B6043B0FBF3F0908330BC70470A46C1 -:10CD200030B40021032A0DD04FF4FA4C002A7CD0F5 -:10CD3000012A79D0022A1CBF30BC7047014630BCA2 -:10CD40005030A3E6A0F8501080F8561080F8571025 -:10CD500080F85B1080F85C1080F85D1080F85E1041 -:10CD600080F8521080F8531080F8541080F8551055 -:10CD700080F86910A0F86C1080F87210A0F8741098 -:10CD8000A0F87A1080F87E10A0F8801080F8821049 -:10CD900080F8671080F8681080F85F1080F86010E5 -:10CDA00080F8831080F8841080F88610F52280F8CF -:10CDB0008C20012280F88D20A0F8781080F88F1048 -:10CDC000A0F8D01080F8D21080F8C810C0F8CC10AD -:10CDD00080F8281080F84C2080F84D201B22828695 -:10CDE000C2864FF4A473438703878285C285438636 -:10CDF0000386A0F84020A0F842308287C387A0F8BD -:10CE00004420A0F84620A0F8482080F8901080F830 -:10CE1000001180F8911080F80A1180F8E81080F86D -:10CE2000F81030BC704700E039E04288874B13446B -:10CE3000B3FBF2F3A0F86E304BF68033A0F87030FD -:10CE4000C488A0F87410B0F8781000F15003514372 -:10CE500091FBF2F1A0F87810E100B1FBF2F1491C6E -:10CE600089B201FB02F4A0F87610B4F5C84FC4BF34 -:10CE7000491ED984BCFBF2F1491C998502F5802139 -:10CE800001F5EE31A1F1010CBCFBF2F1D983B3F84D -:10CE90001CC00CFB02F1B1FBF2F199834EE7D0F814 -:10CEA000F04000F1500243886089E4899184118D3B -:10CEB000594391FBF0F11185E100B1FBF0F1491C00 -:10CEC00089B201FB00F4D184B4F5C84FC4BF491E38 -:10CED000D184BCFBF0F1491C9185118C00EBC101A0 -:10CEE000491EB1FBF0F1D183918B5943B1FBF0F0B6 -:10CEF000908330BC7047837D0BB1252B01D9122064 -:10CF00007047002A04BF0020704770B490F817C023 -:10CF10000C7E4F4D04FB02C22C464FF0000CE2FB8E -:10CF2000054C4FEA1C1C6FF024040CFB0422D2B207 -:10CF300001EBD20CC27502F007059CF808C0012471 -:10CF400004FA05F51CEA050F18BF02762CD1B2FBD6 -:10CF5000F3FC03FB1C22521CD2B24FF0000C00BFAA -:10CF600000EB0C035B7C93423CBFD21AD2B20ED3CF -:10CF700001EB0C0500232D7A04FA03F635421CBFA1 -:10CF8000521ED2B26AB15B1CDBB2082BF4D30CF197 -:10CF9000010303F0FF0CBCF1050FE1D370BC1F20AF -:10CFA000704703EBCC01017670BC0020704730B5B0 -:10CFB0000D460446072988BFFFDFE07805F007012A -:10CFC00000F05000084340F08800E070A07800F0C6 -:10CFD000A70040F01800A070607800F05E0040F0FC -:10CFE00020006070207800F0BC0040F0400020700D -:10CFF00030BD017931F01F0113BF0020002211461E -:10D00000704710B4435C491C03F0010C5B0803F04B -:10D010000104A4445B0803F00104A4445B0803F08A -:10D020000104A4445B0803F00104A4445B0803F07A -:10D0300001045B08A44403F00104A4440CEB530373 -:10D040001A44D2B20529DDDB012A03E0FFDB05002B -:10D0500053E4B36E8CBF0120002010BC704730B485 -:10D060000022A1F1010CBCF1000F11DD431E11F0F3 -:10D07000010F08BF13F8012F5C785FEA6C0C07D032 -:10D0800013F8025F22435C782A43BCF1010CF7D10C -:10D09000491E5CBF405C0243002A0CBF01200020F7 -:10D0A00030BC7047130008BF704710B401EB030C8D -:10D0B000D41A1CF801CC5B1E00F804C013F0FF0367 -:10D0C000F4D110BC7047F0B58DB0164610251C4643 -:10D0D0006A46AC4600EB0C03A5EB0C0713F8013CC9 -:10D0E000D355ACF1010313F0FF0CF3D11546103208 -:10D0F000102084460B18ACEB000713F8013C401ECF -:10D10000D35510F0FF00F5D1284601F055FA86B14D -:10D11000102005F1200201461318A1EB000C13F8B2 -:10D12000013C401E04F80C3010F0FF00F4D10DB0AB -:10D13000F0BD08982060099860600A98A0600B987C -:10D14000E0600DB0F0BD38B505460C466846F6F710 -:10D15000A5F9002808BF38BD9DF90020227294F976 -:10D1600009100020511A48BF494295F829308B42D6 -:10D17000C8BF38BDFF2B08BF38BDA17A491CC9B252 -:10D18000A17295F82A30994203D8617A7F2918BF95 -:10D1900038BD62720020A072012038BD0C294FD228 -:10D1A000DFE801F006090E13161B323C3F4C4247E4 -:10D1B000002A47D044E0022A18BF032A42D03FE0A9 -:10D1C000072A18BF062A3DD03AE0082A3AD037E0AD -:10D1D000A2F10C000D2835D932E023B1A2F10D00E7 -:10D1E0000C282FD92CE00F2A18BF0E2A2AD090F82D -:10D1F000340020B10F2A23D3182A23D920E0132A80 -:10D200001ED3182A1ED91BE0A2F10C01032919D93B -:10D2100090F83400A0B1192A14D911E0092A11D0CC -:10D220000EE0012A0ED00BE01A2A18BF1B2A09D0E3 -:10D2300006E0A2F11C00042804D901E00A2A01D06A -:10D2400000207047012070472DE9F04187680D46A6 -:10D2500004462046F3F766FB90B1CDB13846A1688D -:10D26000F4F7FFFBA0B1401EB0FBF5F0461C06FB37 -:10D2700005F13846F3F7E5FAA0603046BDE8F081E5 -:10D28000F3F7C6FA40F26171F3F7DBFAA060E0E76A -:10D290000020BDE8F081904228BF704770B5044679 -:10D2A000101B642838BF642025188D4205D8F4F778 -:10D2B00003FC00281CBF284670BD204670BD91F8B5 -:10D2C0004C308A8D022B07BF92003C32D200703264 -:10D2D00092B20B8E934238BF1A46CB8D91F84DC057 -:10D2E000BCF1020F07BF9B003C33DB0070339BB2E5 -:10D2F000498E994238BF0B46012100280CBF0120FE -:10D30000002003FB01219831002818BF04200844A5 -:10D310007047F0B4B0F844C0BCF1FB0F28BF4FF029 -:10D32000FB0C90F84C40022C07BF4FEA8C0C0CF120 -:10D330003C0C4FEACC0C0CF1700C1FFA8CF6B0F8D8 -:10D340004650FB2D28BFFB2590F84DC0BCF1020FC5 -:10D3500007BFA8003C30E800703085B20020022CE6 -:10D360000CBF3C247024BCF1020F0CBF4FF03C0CEE -:10D370004FF0700C914234BF012700270F44FFB2D9 -:10D380008A4234BF012100211144C9B28F4234BF07 -:10D390000A463A46002A04BFF0BC704706FB07F075 -:10D3A00005FB01008F4205D93944C1EB42011CFB4A -:10D3B000010005E004D23944C1EB420114FB010035 -:10D3C0004FF04D0112FB01F100EB8100A0F19C0038 -:10D3D000002B14BF042100210844F0BC704730B575 -:10D3E0000C46054601460020FFF769FF698840F2B8 -:10D3F00071225143694A844202EB410134BF024623 -:10D4000022468A4228BF084602D2844228BF2046CC -:10D41000686230BD70B50C460546014616460120CF -:10D42000FFF74DFF698840F271225143C6EB41017D -:10D43000A1F22131844234BF024622468A4228BFEB -:10D44000084602D2844228BF2046686270BDF8B503 -:10D4500005460E46084600F0BDFB0446304600F087 -:10D46000BDFB014610F0010F18BF012008D111F0DB -:10D47000020F18BF022003D111F0040018BF0320CF -:10D480008DF8000014F0010F18BF012208D114F02C -:10D49000020F18BF022203D114F0040218BF0322A6 -:10D4A0008DF8012011F0030F08BF00208DF8000057 -:10D4B00014F0030F08BF00228DF8012095F84C10DE -:10D4C000884208BF00208DF8000095F84D00824288 -:10D4D00008BF00228DF80120BDF80000F8BD01282A -:10D4E0001CBF02280020704718B4CBB2C1F3072C30 -:10D4F000C1B2C0F30720012B07D0022B09D0042BA7 -:10D5000008BFBCF1040F24D006E0BCF1010F03D129 -:10D510001FE0BCF1020F1CD0012906D0022907D060 -:10D52000042908BF042814D004E0012802D110E027 -:10D5300002280ED001EA0C0161F3070210EA030091 -:10D5400060F30F22D0B210F0020F18BF02200BD1EF -:10D5500006E0084003EA0C01084060F30702EFE729 -:10D5600010F0010018BF01208DF80000C2F3072061 -:10D5700010F0020F18BF022003D110F0010018BFF5 -:10D5800001208DF80100BDF8000018BC7047072885 -:10D5900016BF08280120002070470000F1FCFFFFA3 -:10D5A000282102F016B830B50546007801F00F02C8 -:10D5B00020F00F001043287007290BD2DFE801F09C -:10D5C0000406040604080400062405E00C2403E015 -:10D5D000222401E00024FFDF687820F03F00204390 -:10D5E000687030BD007800F00F0070470A68C0F81E -:10D5F00003208988A0F807107047D0F803200A603C -:10D60000B0F80700888070470A68C0F80920898848 -:10D61000A0F80D107047D0F809200A60B0F80D008E -:10D62000888070470278402322F0400203EA81118B -:10D630001143017070470078C0F380107047027882 -:10D64000802322F0800203EAC11111430170704768 -:10D650000078C0097047D0F80320C1F80920B0F85D -:10D660000720A1F80D200A7822F080020A700078C5 -:10D67000800942EAC0100870704770B515460E4622 -:10D6800004461F2A88BFFFDF2A46314604F10900FD -:10D6900001F028FF6078A91D20F03F0001F03F0154 -:10D6A0000843607070BD70B5054640780E4600F0C6 -:10D6B0003F04062C38BFFFDFA01FC4B21F2C88BF59 -:10D6C0001F24224605F10901304601F00BFF2046D8 -:10D6D00070BD70B515460E4604461F2A88BFFFDF91 -:10D6E0002A46314604F1090001F0FCFE6078A91DCC -:10D6F00020F03F0001F03F010843607070BD70B53D -:10D70000054640780E4600F03F04062C38BFFFDF88 -:10D71000A01FC4B21F2C88BFFFDF224605F10901FC -:10D72000304601F0DFFE204670BD0968C0F80F10DA -:10D7300070470A88A0F813208978417570474176B0 -:10D74000090A81767047C176090A017770474177E7 -:10D75000090A81777047C175090A0176704781759A -:10D76000704790F8242001F01F0122F01F0211439E -:10D7700080F82410704790F82420E02322F0E00283 -:10D7800003EA4111114380F8241070471F3002F062 -:10D7900054B84178007801F03F0110F00F0006D036 -:10D7A000012808D0022809D006280BD00FE0881FD6 -:10D7B0001F280AD90BE00C2909D106E0881F1F2871 -:10D7C00003D904E0881F1F2801D8012070470020DA -:10D7D00070474178007801F03F0100F00F00042805 -:10D7E00005D1062903D325299CBF012070470020BD -:10D7F000704710B4017801F00F01032922D00529E8 -:10D8000025D14478B0F81910B0F81BC0B0F8173023 -:10D81000827D04F03F04222C19D1062917D3B1F5DB -:10D82000486F98BFBCF5FA7F11D282B1082A98BF21 -:10D830008A420CD28B429CBFB0F81D00B0F5486FF5 -:10D8400005D807E0407800F03F000C2802D010BC5B -:10D850000020704710BC01207047222101F0B9BEA2 -:10D8600000B5027801F0030322F003021A430270AC -:10D8700000224270012914BF022900BD032912BFF2 -:10D88000FFDF0121417000BD01F0030300B5027804 -:10D8900022F003021A43027000224270012914BFD1 -:10D8A000022900BD032912BFFFDF0121417000BD25 -:10D8B000007800F0030070470278102322F0100275 -:10D8C00003EA01111143017070474178F9B1C07842 -:10D8D000192850D2DFE800F00D101316191C1F2272 -:10D8E00025282B2E31344F4F4F4C373A3D4043467D -:10D8F00049000C2941D042E008293ED03FE00229EE -:10D900003BD03CE0172938D039E00D2935D036E03E -:10D91000012932D033E001292FD030E002292CD068 -:10D920002DE0092929D02AE0092926D027E001295C -:10D9300023D024E0012920D021E006291DD01EE0BB -:10D9400002291AD01BE0012917D018E0012914D0B0 -:10D9500015E0092911D012E009290ED00FE00329A2 -:10D960000BD00CE0032908D009E0052905D006E01A -:10D97000032902D003E0FB2901D8012070470020D1 -:10D98000704730B50546C170192922D2DFE801F091 -:10D990000D0F111315171711191917171B11212125 -:10D9A000211D171719191D1D1F000C2413E0082431 -:10D9B00011E002240FE017240DE00D240BE00124F8 -:10D9C00009E0092407E0062405E0032403E0052418 -:10D9D00001E00024FFDF6C7030BDC0787047C1717A -:10D9E000090A01727047B0F8070070474172090ACE -:10D9F00081727047B0F809007047C172090A01735B -:10DA00007047B0F80B0070474171090A8171704787 -:10DA1000B0F8050070470171704700797047417395 -:10DA2000090A81737047B0F80D00704730B4B0F840 -:10DA30000720824DB0F809C0B0F805300179941F75 -:10DA40002D1998BFBCF5FA7F0ED269B1082998BF8D -:10DA5000914209D293429FBFB0F80B00B0F5486FD6 -:10DA6000012030BC98BF7047002030BC7047001DBB -:10DA700001F0E3BE021D0846114601F0DEBE417210 -:10DA8000090A81727047B0F8090070470171704748 -:10DA9000007970470A68426049688160704742684F -:10DAA0000A60806848607047098881817047808972 -:10DAB000088070470A68C0F80E204968C0F8121044 -:10DAC0007047D0F80E200A60D0F812004860704706 -:10DAD0000968C0F816107047D0F816000860704743 -:10DAE0000A68426049688160704742680A608068DD -:10DAF000486070470968C1607047C0680860704737 -:10DB0000017170474171090A81717047C171090A39 -:10DB10000172704700797047B0F805007047B0F89F -:10DB200007007047017170470079704701717047B5 -:10DB3000007970470A6842604968816070474268AE -:10DB40000A608068486070470171090A4171704736 -:10DB50008171090AC17170470172090A41727047E7 -:10DB60008172090AC172704780887047C088704707 -:10DB7000008970474089704701891B2914D3FB290C -:10DB800012D84189B1F5A47F21BF40F648028A42EC -:10DB900081881B2908D3FB2906D8C088B0F5A47F4B -:10DBA00022BF824201207047002070470A6842600D -:10DBB00049688160704742680A60806848607047C1 -:10DBC0000171704700797047417170474079704723 -:10DBD0000171704700797047417170474079704713 -:10DBE0008171090AC1717047C088704714A282B060 -:10DBF000D2E90012CDE900120179407901F0070263 -:10DC000069461DF80220012A07D800F00700085CC9 -:10DC100001289EBF012002B07047002002B070476B -:10DC200001717047007970474171704730B50C46FB -:10DC30000546FB2988BFFFDF6C7030BD86F3FFFF10 -:10DC4000000101020102020370B50446C2F1100591 -:10DC5000281901F047FC15F0FF0108D0491EC9B290 -:10DC6000802060542046BDE8704001F0B2BC70BD19 -:10DC700030B505E05B1EDBB2CC5CD55C6C40C454B7 -:10DC8000002BF7D130BD10B5002409E00B78521EEF -:10DC900044EA430300F8013B11F8013BD2B2DC092E -:10DCA000002AF3D110BD2DE9F0410C46012009787E -:10DCB000FF4E92B0154602274FF006084FF0040CB5 -:10DCC00071B101291ED0022945D0032905D1297837 -:10DCD000042902D105201070002012B0BDE8F081A7 -:10DCE000606850B1CDE90106012020708DF80080F8 -:10DCF000606A04901146684663E0277085F800C0AA -:10DD0000566026E029780429E7D169681022206945 -:10DD1000FFF7B9FF6868C07B000606D5E44A2069B2 -:10DD2000102310320146FFF7A3FFD4E9041010229C -:10DD3000FFF7A9FF2069C07B000606D5DC4A6069B1 -:10DD4000102310320146FFF793FF277085F800C0BB -:10DD50006E600320C1E729780429BED1A08910286C -:10DD60000CD9A0F1100080B2A081A1684FF010037F -:10DD7000014468466A68FFF77BFF18E004D14FF062 -:10DD800010032269A16807E0C2B20DA8A168FFF7DD -:10DD90005BFF626910230DA909A8FFF769FF102333 -:10DDA00009A968466A68FFF763FF0320207060686E -:10DDB0000590CDF818D08DF81080606A089029463B -:10DDC00004A8F2F7EDF988E72DE9F04107460D4682 -:10DDD00001200B7806213BB1012B04D11378052BD0 -:10DDE00001D11170002079E76C6901262022617051 -:10DDF000E8686060686A6062A168287C0870A68133 -:10DE0000A068A968401C01F06DFBA0892022203089 -:10DE1000A081A0686968213001F064FBA0892146D7 -:10DE20002030A0812E703846BDE8F041F2F7CFB91E -:10DE30002DE9F05F0D468346012009781746064616 -:10DE40004FF00608D1B1DFF868A24FF00009AAF13F -:10DE5000080A012923D002297ED003290CD1397860 -:10DE6000052909D179681022E86901F03BFB0720F8 -:10DE70003870183500207D60BDE8F09F2C6A8C4812 -:10DE8000202284F80180203060602020A081686A10 -:10DE900060626968A06801F025FB2E70D4E03978D3 -:10DEA0000529E9D12C6A84F80180686A60625168AA -:10DEB0001022E86901F016FBE8696060A0684F462F -:10DEC00080F80090A681A0684670A089401C80B2AE -:10DED000A081A1680844696951F8012F026089880E -:10DEE0008180A089801D80B2A0816969A2680978BB -:10DEF000C1F340011154A089401C80B2A081A168E7 -:10DF00000844296951F8012F026089888180A0891D -:10DF1000801D80B2A0812969A2680978C1F34001FF -:10DF20001154A0891022401C80B2A081A16808442D -:10DF3000E96801F0D7FAA0891022103080B2A081E0 -:10DF4000A1680844A96801F0CDFAA089103080B218 -:10DF5000A081A168014400E00DE0DAF80400086047 -:10DF6000A089001D80B2A081A1680F54A089401C27 -:10DF7000A081022067E03978052992D151681022EA -:10DF8000A86901F0AFFA2C6A84F80180E869606042 -:10DF9000686A6062A16881F80090A681A0684670F6 -:10DFA000A089401C80B2A081A1680844696951F829 -:10DFB000012F026089888180A089801D80B2A081A4 -:10DFC0006969A2680978C1F340011154A089401C15 -:10DFD00080B2A081A1680844296951F8012F02602C -:10DFE00089888180A089801D80B2A0812969A2686A -:10DFF0000978C1F340011154A0891022401C80B25D -:10E00000A081A1680844E96801F06CFAA089102297 -:10E01000103080B2A081A1680844A96801F062FABA -:10E02000A089103080B2A081A1680144DAF8040010 -:10E030000860A089001D80B2A081A1680E54A0894B -:10E04000401CA0810320287021465846BDE8F05F9F -:10E05000F2F7BDB870B50D4606460978012041B10A -:10E06000012905D11178052902D10820107000205E -:10E0700070BD2C6A0620607069686160696A6162BF -:10E08000EA69A16852F8013F0B6092888A80A081FA -:10E09000E869A1680078C0F340008871A089401C3D -:10E0A00080B2A081A1680844A96951F8012F01E05C -:10E0B00070FC0100026089888180A089801D80B287 -:10E0C000A081A969A2680978C1F340011154A0890F -:10E0D000401C80B2A081A168084469690A88028056 -:10E0E00089788170A0891022C01C80B2A081A168AB -:10E0F0000844296901F0F6F9A0891022103080B295 -:10E10000A081A1680844E96801F0ECF9A089102217 -:10E11000103080B2A081A1680844A96801F0E2F93A -:10E12000A08921461030A081012028703046BDE82A -:10E130007040F2F74CB870B50D46064609780120DC -:10E1400059B1012908D11178052905D1092010708C -:10E15000506800685060002070BD6C690620102275 -:10E160006070E8686060686A60622969A06801F0B0 -:10E17000B9F91020A081A06820221030A96801F010 -:10E18000B1F9A0892022203080B2A081A168084482 -:10E19000696801F0A7F9A08921462030A0810120FB -:10E1A00028703046BDE87040F2F711B870B50C46E3 -:10E1B000012009788EB01546062659B1012934D0C0 -:10E1C000022905D12978042902D10A2010700020E3 -:10E1D0000EB070BD606910236A460078C0F340003D -:10E1E0008DF80000A0690078C0F340008DF80100B0 -:10E1F000E0680168CDF802108188ADF806108079DA -:10E200008DF8080020690168CDF809108188ADF803 -:10E210000D1080798DF80F006068059009A80690B0 -:10E22000A168FFF725FD01201DE029780429CFD141 -:10E23000A06910236A4650F8011F00918088ADF84C -:10E240000400606950F8011FCDF806108088ADF811 -:10E250000A00002003906068059009A8069069688C -:10E26000FFF706FD022020708DF81060606A0890AC -:10E27000294604A8F1F794FFAAE700B50B7889B006 -:10E2800001204BB1012B05D11178042902D10B20BB -:10E290001070002009B000BD4868019005A80290E8 -:10E2A000C868036805934068069088680368079308 -:10E2B000406808900120087006208DF80000486A28 -:10E2C000049011466846F1F76BFFE3E700B50B7861 -:10E2D00089B0012043B1012BDCD111780429D9D1B7 -:10E2E0000C2010700020D5E74868019005A8029026 -:10E2F000886803680593406806900020079008909E -:10E300000120087006208DF80000486A049011462C -:10E310006846F1F745FFBDE700B50B7889B00120ED -:10E3200043B1012BB6D111780429B3D10D2010705F -:10E330000020AFE748680590CDF818D088680088BD -:10E34000ADF80000C8680088ADF802000020019018 -:10E35000029003900120087006208DF81000486A92 -:10E360000890114604A8F1F71BFF93E730B4034669 -:10E370000C7801205CB1012C15D0022C05D111784C -:10E380000C2902D10E201070002030BC70470120F3 -:10E390000870C868042242704A6842600B4A826072 -:10E3A000921EC2600BE014780D2CEED10220087092 -:10E3B000C86803244470526842608A688260496A6F -:10E3C0004162014630BC1846F1F701BF6AFC01000A -:10E3D00070B41D78039C4FF0000CAA4204BF70BCBF -:10E3E00070478E5C864208BF4FF0010C02D0BCF132 -:10E3F000000F05D0561CA64208BF00268E5D8E5425 -:10E40000561CA6420CBF0022521CD2B2AA42E8D12E -:10E41000BCF1000F04BF70BC70471878411E197022 -:10E420003CBF601E187070BC704700002DE9F041C1 -:10E430000C4611490D68104A104908321160A0F1CC -:10E4400020012A2901D301200CE03E2810D040CC25 -:10E450000B4F94E80E0007EB8000241F50F8807CDF -:10E460003046B84720600448001D0560BDE8F081D3 -:10E470002046E2F7A5FEF5E7100502400100000185 -:10E48000A0FC010010B5524800F04EFA00B1FFDFC9 -:10E490004F48401C00F048FA002800D0FFDF10BDB4 -:10E4A0002DE9F14F4B4ED6F800B00127484800F057 -:10E4B00043FADFF81C8128B95FF0000708F101007A -:10E4C00000F050FA444C00254FF003090120606031 -:10E4D000C4F80051C4F80451009931602060DFF89D -:10E4E000FCA018E0DAF80000C00614D50E2000F0F9 -:10E4F00064F8EFF3108010F0010072B600D0012034 -:10E50000C4F80493D4F8001119B9D4F8041101B96E -:10E5100020BF00B962B6D4F8000118B9D4F80401DC -:10E520000028DFD0D4F804010028CFD137B1C6F8D5 -:10E5300000B008F1010000F0FFF911E008F101005E -:10E5400000F0FAF90028B9D1C4F80893C4F80451CE -:10E55000C4F800510E2000F030F81D4800F002FA17 -:10E560000020BDE8F88F2DE9F0438DB00D4606463A -:10E5700000240DF110090DF1200817E004EB440709 -:10E58000102255F82710684600F0ACFF05EB87070E -:10E5900010224846796800F0A5FF6846FFF780FF23 -:10E5A00010224146B86800F09DFF641CB442E5DBD0 -:10E5B0000DB00020BDE8F08372E700F01F020121DA -:10E5C00091404009800000F1E020C0F880127047BF -:10E5D0007A01002004E5004000E0004010ED00E07A -:10E5E000C748002101708170704770B5C54D012387 -:10E5F0002B60C54B1C68002CFCD0002407E00E6883 -:10E6000006601E68002EFCD0001D091D641C94428B -:10E61000F5D30020286018680028FCD070BD70B5C4 -:10E62000B74E0446B94D3078022800D0FFDFAC4227 -:10E6300000D3FFDF7169B648012903D847F2305291 -:10E64000944201DD03224271491C7161291BC160A2 -:10E65000AF497078BDE87040F2F76BBA70B5A84C5E -:10E660000D466178884200D0FFDFA84E092D4FD2B9 -:10E67000DFE805F04E0522314E4E4E4E3C0020782C -:10E68000022800D0FFDF03202070A078022802D0EB -:10E69000012804D008E0A06800F036FC04E004F192 -:10E6A000080007C8FFF7A1FF052020700020A07018 -:10E6B000BDE87040F1F7D9BFF2F7AAF801466068EB -:10E6C000F3F7CFF9B04202D2616902290BD30320DC -:10E6D000F3F7ECFB12E0F2F79BF801466068F3F702 -:10E6E000C0F9B042F3D2BDE8704098E72078022824 -:10E6F0000AD0052806D0FFDF04202070BDE8704056 -:10E7000000F0F4B8022000E00320F3F7CFFBF3E7BA -:10E71000FFDF70BD70B50546F2F77AF8784C60609F -:10E720002078012800D0FFDF7949022008700022FC -:10E730000A718D6004224A71744ACA602070607840 -:10E74000BDE87040F2F7F5B910B56D4CA07808B986 -:10E75000207808B1112010BD6E48F1F7F3FF60700A -:10E76000607820B1012020700020606110BD03207E -:10E7700010BD0246010B0120B2F5003F02D28840D5 -:10E7800000F03CBEB2F5802F03D22039884000F063 -:10E790003DBEB2F5C02F03D24039884000F03FBEE5 -:10E7A000B2F5002F03D26039884000F041BE00204E -:10E7B00070472DE9F041144600EB84070E460546EC -:10E7C0003F1F00F0B4FB4FF080510A69504306EB45 -:10E7D0008402121FB24201D2012200E000221CB1C9 -:10E7E0000969B4EB910F02D90920BDE8F0814A49CB -:10E7F0008D4216D3AF4214D3854205D2874203D24D -:10E8000045EA0600800701D01020EEE78E4208D3CB -:10E810003AB92846FFF7ADFF18B93846FFF7A9FF08 -:10E8200008B10F20E1E73D483D490068884205D026 -:10E83000224631462846FFF7D8FE10E0FFF784FF56 -:10E840000028D2D12E4801218560C0E9036481707F -:10E850004FF4A97104FB01F01830FFF75BFF0020B3 -:10E86000C3E770B54FF08055044628692A49B1FBCB -:10E87000F0F084420AD300F05AFBA04201D81020E5 -:10E8800070BD28696043FFF774FF08B10F2070BDA9 -:10E89000224823490068884204D02869604300F078 -:10E8A00033FB0CE0FFF750FF0028F0D12969144832 -:10E8B00061438160022181701A48FFF72BFF00201D -:10E8C00070BD1548010B01208840401E704770B58F -:10E8D0000D460446FFF7F5FF204201D00F2070BD22 -:10E8E00029462046BDE8704000F0ABBD10B5044C91 -:10E8F0006078F1F777FF00202070A07010BD000055 -:10E900007C01002004E5014000E40140105C0C00A3 -:10E91000241200205DE6010000000200A00000209B -:10E92000BEBAFECA7C5E0100002101700846704735 -:10E930000146002008707047EFF3108101F00101DB -:10E9400072B60278012A01D0012200E000220123E0 -:10E95000037001B962B60AB1002070474FF400504D -:10E960007047E9E7EFF3108111F0010F72B64FF035 -:10E970000002027000D162B600207047F2E700008A -:10E98000564909680160002070475449086000201A -:10E99000704701218A0720B1012804D042F2040007 -:10E9A0007047916700E0D167002070474C49012013 -:10E9B000086042F20600704708B50423484A190768 -:10E9C000103230B1C1F80433106840F0010010601B -:10E9D0000BE0106820F001001060C1F8083300203F -:10E9E000C1F808013F4800680090002008BD3C497C -:10E9F000103140B101280CD0022812D0032816D0C3 -:10EA000042F205007047086820F01E0040F0100038 -:10EA100004E0086820F01E0040F0140008600020A8 -:10EA20007047086820F01E0040F01800F6E70868FC -:10EA300020F01E0040F01C00F0E7294924310A684C -:10EA400002430A6000207047254924310A68824346 -:10EA50000A600020704722492431096801600020C3 -:10EA60007047012801D9072070471F4A52F820003B -:10EA700002680A43026000207047012801D907207C -:10EA80007047194A52F8200002688A430260002049 -:10EA90007047012801D907207047134A52F8200017 -:10EAA0000068086000207047020010494FF0000025 -:10EAB00003D0012A01D0072070470A6070474FF049 -:10EAC00080410020C1F808014FF0E020802180F84B -:10EAD00000140121C0F8001170470000000400403C -:10EAE000000500400801004048FD01007805004095 -:10EAF0006249634B0A6863499A42096801D1C1F3CC -:10EB000010010160002070475C495D4B0A685D4957 -:10EB1000091D9A4201D1C0F310000860002070471F -:10EB20005649574B0A68574908319A4201D1C0F3F8 -:10EB3000100008600020704730B5504B504D1C68E5 -:10EB400042F20803AC4202D0142802D203E011289A -:10EB500001D3184630BDC3004B481844C0F8101507 -:10EB6000C0F81425002030BD4449454B0A6842F2E4 -:10EB700009019A4202D0062802D203E0042801D3F8 -:10EB800008467047404A012142F830100020704783 -:10EB90003A493B4B0A6842F209019A4202D00628E0 -:10EBA00002D203E0042801D308467047364A012107 -:10EBB00002EBC00041600020704770B52F4A304E14 -:10EBC000314C156842F2090304EB8002B54204D0CF -:10EBD000062804D2C2F8001807E0042801D318461A -:10EBE00070BDC1F31000C2F80008002070BD70B500 -:10EBF000224A234E244C156842F2090304EB80029A -:10EC0000B54204D0062804D2D2F8000807E0042850 -:10EC100001D3184670BDD2F80008C0F31000086098 -:10EC2000002070BD174910B5083118480860112040 -:10EC3000154A002102EBC003C3F81015C3F81415E0 -:10EC4000401C1428F6D3002006E0042804D302EB6D -:10EC50008003C3F8001807E002EB8003D3F80048F4 -:10EC6000C4F31004C3F80048401C0628EDD310BDBF -:10EC7000044906480831086070470000A0000020E1 -:10EC8000BEBAFECA00F5014000F001400000FEFFE0 -:10EC9000754B1B6803B19847BFF34F8F73480168EA -:10ECA000734A01F4E06111430160BFF34F8FFEE747 -:10ECB00010B572B600F0CEF850B1E2F721FBF1F7D3 -:10ECC000BCFCF3F799F8EBF75AF86A4900200860A2 -:10ECD00062B6002010BD70B50C46054672B600F055 -:10ECE000B9F810B162B6082070BDE2F77FFAE2F71A -:10ECF00009FB0246002043099B0003F1E02300F0DA -:10ED00001F01D3F80031CB40D9071DD0202803D2F2 -:10ED100022FA00F1C90724D141B2002906DA01F034 -:10ED20000F0101F1E02191F8141D03E001F1E02150 -:10ED300091F800144909082913D291B1012910D082 -:10ED400004290ED005290CD0401C6428D3D3EAF73F -:10ED5000EDFF4849484808602046F3F705FD58B9DB -:10ED600003E062B641F2010070BD3F4804602DB17E -:10ED70002846F3F744FD18B110242BE03F4D18E06E -:10ED80002878022802D94FF4805423E00724002871 -:10ED9000687801D058B908E0E0B120281AD8A878DE -:10EDA000212817D8012815D003E0A87808B162B649 -:10EDB00012E03349802081F8140DE2F7A3FA2946C6 -:10EDC000F3F700F8F1F7ECFB00F0E8F82846E2F77B -:10EDD00065FA044662B61CB1FFF76AFF204670BDB3 -:10EDE000002070BD10B5044600F034F800B10120D9 -:10EDF0002070002010BD234908600020704770B5C6 -:10EE00000C4621490D682049204E08310E6010281B -:10EE100007D011280CD012280FD0132811D00120B0 -:10EE200013E0D4E90001FFF756FF354620600DE0FE -:10EE3000FFF73EFF0025206008E02068FFF7D2FFC3 -:10EE400003E0104920680860002020600E48001D83 -:10EE5000056070BD074808490068884201D101205B -:10EE60007047002070470000940100200CED00E086 -:10EE70000400FA05A0000020BEBAFECA50FD010041 -:10EE80000BE000E00400002010050240010000013A -:10EE90002DE9F04184B088460746FEF709FD054696 -:10EEA0007E786A4601A94046EFF712FC04000ED0B6 -:10EEB000012D1EBF032004B0BDE8F08102AA404628 -:10EEC0000199EFF704FB0298B0F803000AE0022D65 -:10EED00014D1042E12D3B7F80300BDF80020011D91 -:10EEE0008A420BD3001D80B2A119814238BF012094 -:10EEF00008BF00209CBF04B0BDE8F0814FF00200C5 -:10EF000004B0BDE8F08100000B4A022111600B49FA -:10EF10000B68002BFCD0084B1B1D186008680028EC -:10EF2000FCD00020106008680028FCD070474FF02B -:10EF3000805040697047000004E5014000E4014052 -:10EF400010B54FF000040B460200204621461ED0AB -:10EF5000012A04D0022A04D0032A1DD103E0012093 -:10EF600002E0022013E00320072B15D2DFE803F0B4 -:10EF7000140406080A0C0E00012108E0022106E034 -:10EF8000032104E0042102E0052100E00621F1F75D -:10EF9000F3FB08B1204610BD0724FBE7FE4805211E -:10EFA0008170002101704170C17081607047FB4920 -:10EFB0000A78022A06D0CA681044C860C868323885 -:10EFC000F2F7FBBC8A68104488608868F7E703782A -:10EFD000F349F44A13B1012B0ED011E00379012B50 -:10EFE00000D06BB943790BB1012B09D18368643B25 -:10EFF0008B4205D2C0680EE00379012B02D00BB121 -:10F000000020704743790BB1012BF9D1C368643BF1 -:10F010008B42F5D280689042F2D8012070472DE9EA -:10F02000F04704460226F1F756FF006800B1FFDF03 -:10F03000D94D01273CB12078B0B1012805D0022874 -:10F0400010D0032813D02F710CE06068C82807D3B4 -:10F05000F2F732FD20B16068FFF7A9FF012603E057 -:10F06000002601E000F0AFF93046BDE8F0872878CF -:10F070000028F7D16068FFF7AAFF0028E3D0606896 -:10F08000DFF81883007810B3A878042800D0FFDFD9 -:10F090000020474688F8000060680079C0B300206F -:10F0A000387160684079A0B3042078716068816825 -:10F0B000E868F1F7C6FBB8606068C0683230F86095 -:10F0C0000320A870B549E878F1F733FDCAE74FF09F -:10F0D0000209404688F8009061680979D1B10021A1 -:10F0E000017161684979B9B1042141716168896828 -:10F0F000323181606168C968C160C068A64C14344F -:10F100006060F1F785FB20606F7085F80290A9E7D9 -:10F1100004E005E00321E3E70321E6E70120BFE780 -:10F120000320C2E72DE9F0479B4C8846E1788842EE -:10F1300000D0FFDFDFF8609200250127974E09F12C -:10F140001409B8F1090F76D2DFE808F0050D2A3D61 -:10F15000646A769E7E00A078032886D0A078022874 -:10F1600083D0FFDF81E7A078032803D0A0780228AE -:10F1700000D0FFDF0420A0702571207800285FD127 -:10F18000FFF715FF3078022806D0B068E06000F085 -:10F190006CF92061002048E0E078F1F770FBF5E7BA -:10F1A000A078032803D0A078022800D0FFDF2078C1 -:10F1B00078BBA078032812D1042026E00420F2F7BF -:10F1C00075FEA57051E7A078032803D0A078022827 -:10F1D00000D0FFDF2078E0B9A078032814D0F1F741 -:10F1E00017FB01464F46D9F80000F2F73AFC002819 -:10F1F000E4DB79688142E1DB081AF0606749E07876 -:10F20000BDE8F047F1F795BC0520F2F74FFEA77077 -:10F210002BE724E0A078042800D0FFDF022004E0E0 -:10F22000A078042800D0FFDF0120A1688847FFF7FD -:10F23000F6FE05462EE027E0A078042800D0FFDF88 -:10F24000BDE8F04700F0BFB8A078042805D060788A -:10F2500010B1A078022800D0FFDF207818B1BDE8F7 -:10F26000F04700F0B9B8207920B10620F2F71EFE71 -:10F270002571CCE7607828B14849E078F1F759FC6E -:10F280006570F2E60720C0E7FFDFEEE63DB1012D35 -:10F2900003D0FFDF022DF9D1E7E60420C5E7032004 -:10F2A000C3E770B5050005D03B4CA078052803D016 -:10F2B000112070BD102070BD3B48F1F743FAE0709B -:10F2C000E07818B1A5600020A07070BD032070BD6B -:10F2D000314810B5017809B1112010BD8178052998 -:10F2E0000CD0817801290BD0817849B101210170BE -:10F2F0008178012904D0807810B103E00F2010BD7F -:10F3000000F06AF8002010BD2DE9F041224E0446BD -:10F31000B07808B101280AD164B12046FFF757FE42 -:10F3200050B120781D4D48B1B078012822D00F206F -:10F33000BDE8F0811020FBE70720F9E702272F70D6 -:10F34000207998B100202871607988B10420687113 -:10F35000A0683230A860E068E860E8680E4C1434B9 -:10F360006060F1F755FA2060B77022E00320EAE709 -:10F370000320ECE700202870207900B300202871DA -:10F380006079F0B104206871A168F068F1F759FA6A -:10F39000A860E068323009E09801002034120020B3 -:10F3A0003D860100FF1FA10725F10100E860032051 -:10F3B000B0701049F078F1F7BCFB0020B8E70320EB -:10F3C000DDE70320DFE70C4810B5006900F045F8E1 -:10F3D000BDE81040F1F749B910B5074CE078F1F7F6 -:10F3E00001FA0820F2F762FD0520A07000202070CD -:10F3F000607010BD34120020980100201F49096878 -:10F40000014201D001207047002070471B49091DAF -:10F410000968014201D00120704700207047174958 -:10F4200010310968014201D0012070470020704767 -:10F43000124914310968014201D0012070470020AF -:10F44000704710B50D4C2060201D01600B48103036 -:10F450000260001D0360002010BD09490A6848F2DF -:10F4600002139A4302430A607047054A116848F242 -:10F47000021301EA0300994311607047000600403F -:10F48000C8060240704770477047704740EA010362 -:10F4900010B59B070FD1042A0DD310C808C9121F3D -:10F4A0009C42F8D020BA19BA884201D9012010BD77 -:10F4B0004FF0FF3010BD1AB1D30703D0521C07E044 -:10F4C000002010BD10F8013B11F8014B1B1B07D1A8 -:10F4D00010F8013B11F8014B1B1B01D1921EF1D119 -:10F4E000184610BD032A40F2308010F0030C00F0E3 -:10F4F000158011F8013BBCF1020F624498BF11F86E -:10F5000001CB00F8013B38BF11F8013BA2F1040226 -:10F5100098BF00F801CB38BF00F8013B11F003039E -:10F5200000F02580083AC0F0088051F8043B083A02 -:10F5300051F804CBA0E80810F5E7121D5CBF51F8A4 -:10F54000043B40F8043BAFF30080D20724BF11F81E -:10F55000013B11F801CB48BF11F8012B24BF00F883 -:10F56000013B00F801CB48BF00F8012B704710B5F4 -:10F57000203AC0F00B80B1E81850203AA0E81850AB -:10F58000B1E81850A0E81850BFF4F5AF5FEA027C6C -:10F5900024BFB1E81850A0E8185044BF18C918C0DB -:10F5A000BDE810405FEA827C24BF51F8043B40F87C -:10F5B000043B08BF7047D20728BF31F8023B48BF61 -:10F5C00011F8012B28BF20F8023B48BF00F8012B9F -:10F5D00070474FF000020429C0F0128010F0030CB5 -:10F5E00000F01B80CCF1040CBCF1020F18BF00F836 -:10F5F000012BA8BF20F8022BA1EB0C0100F00DB8E5 -:10F600005FEAC17C24BF00F8012B00F8012B48BF42 -:10F6100000F8012B70474FF0000200B513469446E6 -:10F620009646203922BFA0E80C50A0E80C50B1F15A -:10F630002001BFF4F7AF090728BFA0E80C5048BF6E -:10F640000CC05DF804EB890028BF40F8042B08BF0C -:10F65000704748BF20F8022B11F0804F18BF00F808 -:10F66000012B70477047704770477047FEDF0420DA -:10F670007146084219D10699134A914215DC069940 -:10F6800002394878DF2810D10878FE2807D0FF28F3 -:10F690000BD14FF001004FF000020C4B184741F224 -:10F6A00001000099019A094B184706980599084BE3 -:10F6B000002B02D01B68DB6818474FF0FF304FF07B -:10F6C00000017246014B18470000020091EC010056 -:10F6D00004000020184819497047FFF7FBFFE1F7C5 -:10F6E0005DFD00BD4FF4805015490968884203D183 -:10F6F000144A13605B68184700BD000020BFFDE797 -:10F700004FF480500E490968884210D10E4B18689A -:10F710004FF0FF318842F1D080F308884FF020216C -:10F72000884204DD0948026802210A430260084851 -:10F73000804708488047FFDF481200204812002019 -:10F74000000000200400002000000200240500400A -:10F750003D280100E5F6010004207146084202D070 -:10F76000EFF3098101E0EFF308818869023800783E -:10F77000102813DB20280FDB2B280BDB0A4A12682A -:10F780000A4B9A4203D1602804DB094A1047022041 -:10F7900008607047074A1047074A1047074A12682F -:10F7A0002C32126810470000A0000020BEBAFECA2A -:10F7B000091300002DE40100FFED0100040000200A -:10F7C0000E4B0F4908470F4B0D4908470E4B0C498C -:10F7D00008470E4B0A4908470D4B094908470D4B8E -:10F7E000074908470C4B064908470C4B0449084792 -:10F7F0000B4B034908470B4B01490847A99A0000E6 -:10F80000719F0000AD2F0000A59600002996000012 -:10F81000839C000025130000932F0000C99700006F -:10F82000F99E0000A911000000210160818070474D -:10F83000002101604160017270470A6802600B7923 -:10F8400003717047014901208860704700F0004053 -:10F8500057840000078600002B8400000B870000FF -:10F860002F870000698700009D870000D787000070 -:10F8700007880000598800009112000091120000D2 -:10F88000AB230000E923000009240000BF2400008E -:10F89000FB250000CD260000FD260000C727000044 -:10F8A000931F0000FF290000E12A0000012B000047 -:10F8B0008B320000AF320000DF3100003332000035 -:10F8C000E1320000753300001F460000E3470000EE -:10F8D0008B4B0000A74C00002B4D0000C94D0000D1 -:10F8E0003B4E0000574F000025500000A350000081 -:10F8F0001B2B0000212B00002B2B0000551F0000AC -:10F90000FB2B00001D1F0000512D0000A92D000041 -:10F91000911200009112000091120000911200005B -:10F92000AD5B0000335C00004F5C00006B5C0000CE -:10F93000F95D0000955C00009F5C0000E15C000048 -:10F94000035D0000DF5D0000215E000091120000F9 -:10F950001D7400003D7400003F74000079740000C5 -:10F96000A77400009D7500002B7600003F76000014 -:10F970008D760000737700001D790000497A000041 -:10F9800097650000617A000091120000911200005A -:10F99000D7920000179300003B9300001001100164 -:10F9A0003A0200001A02000405060000FFFFFFFFF4 -:10F9B0000000FFFFE58C0000A71B00003958000085 -:10F9C000E1650000D77E000000000000297C0000F7 -:10F9D000577F0000377F000000000000000000009B -:10F9E0000000000000000000000000000000000017 -:10F9F0000000000000000000000000000000000007 -:10FA000069C70000EDC70000000000000000000012 -:10FA100000000000EDC80000000000000000000031 -:10FA200000000000FDDA00000000000000000000FF -:10FA300000000000A1CB0000CDD6000000000000B7 -:10FA400093D7000007D800000000000065D0000038 -:10FA500017D1000000000000CDD700000DD200003B -:10FA600025D4000097D4000099D5000057CD0000A0 -:10FA7000000000000000000065CC00000000000055 -:10FA8000D9C900004FC900002DD6000071D900006F -:10FA9000E9D90000000000003BC800006BC800006E -:10FAA0009BC7000000000000B5C800000000000077 -:10FAB000000000000000000041DA0000000000002B -:10FAC000E9CD000000000000000000000000000080 -:10FAD00000000000D5CE0000000000005FCB000059 -:10FAE0007BC9000027CB000000000000EFCA000027 -:10FAF0000000000000000000A9DA00000DCA0000AC -:10FB000027C900004BDB0000A5DC0000D9CB0000BA -:10FB10005BDC000000000000CBDB000021DC00000B -:10FB20001BD00000CD3C0000CD3C0000872300002E -:10FB3000498C0000636800000D58000000000000C0 -:10FB4000D5A20100113D0000113D0000A9230000D5 -:10FB5000A38C0000CF68000017580000D78C01006C -:10FB6000FBA20100BC01BC013E002C0050001400AF -:10FB700030018001010000000100000000010203CB -:10FB800004000F101112000000130000ADE101008D -:10FB90007BE20100CDE2010019E301006DE3010009 -:10FBA000A7DC0100C9DD010031DE010055E00100E4 -:10FBB00037E101009BEE000075FF0000000000002F -:10FBC000060000000A000000320000007300000080 -:10FBD000B40000000004FD000000FC0235770100C5 -:10FBE0003F670100C5420100F9BB010083550100D8 -:10FBF000F9BB010031430100E7BD0100214E0100C6 -:10FC0000E7BD01003D42010013BD01005754010052 -:10FC100013BD01006F460100DBC001000B5601005F -:10FC2000DBC00100555555D6BE898E000000660622 -:10FC3000F30C801300000A033B066C090000560415 -:10FC4000D308500D555555252627D6BE898EF4016B -:10FC5000FA00960064004B0032001E001400000001 -:10FC6000250100000000000000000300656C7462C4 -:10FC70000000000000000000000000000000000084 -:10FC800087000000000000000000000000000000ED -:10FC9000BE83605ADB0B376038A5F5AA9183886C68 -:10FCA000F1EA010009EB010021EB010039EB010051 -:10FCB00069EB010091EB0100BBEB0100EFEB0100F0 -:10FCC00063E80100B3E70100CFE8010029E9010082 -:10FCD00039E9010065E90100632001006B200100A2 -:10FCE0007920010093E90100ADE9010081E90100FB -:10FCF0008BE90100B9E90100EFE901003BEA0100ED -:10FD000049EA010057EA010063EA01007BEA0100C9 -:10FD100093EA0100A9EA0100000000006F980000CA -:10FD2000C5980000DB98000041EF0100A1E401004C -:10FD300067E50100A3F20100D1F2010009F301001F -:10FD4000591E01003D2301001C0500402005004014 -:10FD50000010020074FD010008000020AC0100004A -:10FD60004411000098FD0100B4010020941000002F -:10FD700080110000013F0222173601000100703798 -:10FD800020FB349B5F80041F800010022C01337F16 -:08FD90000102A8290244100041 -:00000001FF diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c index f20edafeff..faecdc9de5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c @@ -84,7 +84,7 @@ void port_mode(port_t *obj, PinMode mode) void port_dir(port_t *obj, PinDirection dir) { - int i; + uint32_t i; volatile uint32_t *reg_cnf = (volatile uint32_t*) m_ports[obj->port]->PIN_CNF; From c78f73ca63d24ab68215246a3a94a8b528defb59 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Mon, 13 Mar 2017 14:53:19 +0200 Subject: [PATCH 30/31] Fix compilation errors on linux machine Change path of include from '\' to '/', which works on linux as well. --- .../targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h | 2 +- .../TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h | 2 +- .../targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h | 2 +- .../TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h | 2 +- .../TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h | 2 +- .../sdk/ble/peer_manager/gatts_cache_manager.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h | 2 +- .../sdk/ble/peer_manager/peer_manager_internal.h | 2 +- .../sdk/ble/peer_manager/security_dispatcher.c | 2 +- .../sdk/ble/peer_manager/security_dispatcher.h | 2 +- .../TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h | 2 +- .../common/softdevice_handler/ble_stack_handler_types.h | 2 +- .../softdevice/common/softdevice_handler/softdevice_handler.c | 2 +- .../softdevice/common/softdevice_handler/softdevice_handler.h | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h index 47b556d5f6..26f9cf5542 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/btle.h @@ -24,7 +24,7 @@ extern "C" { #include "common/common.h" #include "ble_srv_common.h" -#include "headers\ble.h" +#include "headers/ble.h" error_t btle_init(void); diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h index 0defa7fd1c..6d6f272aca 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/btle/custom/custom_helper.h @@ -18,7 +18,7 @@ #define _CUSTOM_HELPER_H_ #include "common/common.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble/UUID.h" #include "ble/GattCharacteristic.h" diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h index 5c5d8391b3..d5cc670299 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGap.h @@ -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/ble.h" #include "ble/GapAdvertisingParams.h" #include "ble/GapAdvertisingData.h" #include "ble/Gap.h" diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h index f296dc9580..f69f0e9b88 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xGattServer.h @@ -20,7 +20,7 @@ #include #include "ble/blecommon.h" -#include "headers\ble.h" /* nordic ble */ +#include "headers/ble.h" /* nordic ble */ #include "ble/Gap.h" #include "ble/GattServer.h" diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h index 2fad5c0800..a2bfa6fa8d 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source/nRF5xServiceDiscovery.h @@ -21,7 +21,7 @@ #include "ble/DiscoveredService.h" #include "nRF5xDiscoveredCharacteristic.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gattc.h" class nRF5xGattClient; /* forward declaration */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h index fd3329f9e1..af409e8f18 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_advertising/ble_advertising.h @@ -62,7 +62,7 @@ #include #include "nrf_error.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gattc.h" #include "ble_advdata.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h index 89ccfc4247..d67ca5fab7 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_advdata.h @@ -51,7 +51,7 @@ #include #include #include -#include "headers\ble.h" +#include "headers/ble.h" #include "app_util.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h index 230c949474..eaf7d84a71 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_params.h @@ -48,7 +48,7 @@ #define BLE_CONN_PARAMS_H__ #include -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_srv_common.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c index 31cf4aaf28..6303b50f2c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.c @@ -40,7 +40,7 @@ #include #include #include -#include "headers\ble.h" +#include "headers/ble.h" #include "sdk_mapped_flags.h" #include "app_error.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h index 3820688117..8a4417df19 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_conn_state.h @@ -68,7 +68,7 @@ #include #include -#include "headers\ble.h" +#include "headers/ble.h" #include "sdk_mapped_flags.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h index b85321dec7..712e0520d1 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_gatt_db.h @@ -47,7 +47,7 @@ #define BLE_GATT_DB_H__ #include -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gattc.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c index 5770f34522..5f3dd17df3 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.c @@ -45,7 +45,7 @@ #include #include "nordic_common.h" #include "app_error.h" -#include "headers\ble.h" +#include "headers/ble.h" bool ble_srv_is_notification_enabled(uint8_t const * p_encoded_data) { diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h index 8e65597fbd..660e9bf7f5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/common/ble_srv_common.h @@ -51,7 +51,7 @@ #include #include "ble_types.h" #include "app_util.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "ble_gatt.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h index 24f1ffe35d..fe95dba545 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatt_cache_manager.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h index c890335e70..628276ceab 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/gatts_cache_manager.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c index 9c4b44d45d..b999a85277 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.c @@ -41,7 +41,7 @@ #include "id_manager.h" #include -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "ble_conn_state.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h index ed56fb1a0d..e680f41089 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/id_manager.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h index 58f3a008bd..b5cc5af781 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager.h @@ -62,7 +62,7 @@ #include #include #include "sdk_common.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "peer_manager_types.h" #include "peer_database.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h index b1f3de8ce6..79551404e9 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/peer_manager_internal.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c index 8c6ca548b2..a87030bf34 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.c @@ -41,7 +41,7 @@ #include "security_dispatcher.h" #include -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "ble_conn_state.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h index a5f1e54ccb..7d0b45dc46 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_dispatcher.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "peer_manager_types.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h index 7aebac8346..c1043a6a3d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/peer_manager/security_manager.h @@ -42,7 +42,7 @@ #include #include "sdk_errors.h" -#include "headers\ble.h" +#include "headers/ble.h" #include "ble_gap.h" #include "peer_manager_types.h" #include "security_dispatcher.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h index 32535498c0..7be7850f58 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/ble_stack_handler_types.h @@ -55,7 +55,7 @@ extern "C" { #ifdef BLE_STACK_SUPPORT_REQD #include -#include "headers\ble.h" +#include "headers/ble.h" #include "nrf_sdm.h" #include "app_error.h" #include "app_util.h" diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c index 982bcb039c..34e534e9f6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.c @@ -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/ble.h" #endif #define RAM_START_ADDRESS 0x20000000 diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h index 11e2ca5c8a..59bc60f3d5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/softdevice/common/softdevice_handler/softdevice_handler.h @@ -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/ble.h" #endif #include "app_ram_base.h" From 680d086c708431a013cb7691d47a356c5cdcaf8a Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 22 Mar 2017 13:15:11 +0100 Subject: [PATCH 31/31] [nRF52840] use core_util_critical_section_enter/exit instead of __enable_irq/__disable_irq --- targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c index ebc79dcea3..1ef96f5438 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c @@ -41,6 +41,7 @@ #include "app_util.h" #include "nrf_drv_common.h" #include "lp_ticker_api.h" +#include "mbed_critical.h" #if defined(NRF52_ERRATA_20) #include "softdevice_handler.h" @@ -531,7 +532,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. - __disable_irq(); + core_util_critical_section_enter(); uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); // If an overflow occur, set the next tick in COUNTER + delta clock cycles @@ -543,7 +544,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); - __enable_irq(); + core_util_critical_section_exit(); } /**